From: support Date: Fri, 10 Feb 2023 11:23:03 +0000 (+0000) Subject: Built motion from commit dbf3a7e2.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22angular-material.layout.css/%22?a=commitdiff_plain;h=0ed01286375077cd2955cdaf801db7a783b9f66d;p=motion2.git Built motion from commit dbf3a7e2.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 55666ab..3cc4f1b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-02T13:19:12.717Z", + "time": "2023-02-10T11:13:46.981Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5f6d914..a450d1f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-02T13:19:12.717Z", + "time": "2023-02-10T11:13:46.981Z", "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 83afe3c..0febe6e 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 _0x4134=['integration','jscripty','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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]','STRING','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','contactManager'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x4134,0x89));var _0x4413=function(_0x4be9f5,_0x57ad55){_0x4be9f5=_0x4be9f5-0x0;var _0xe5636=_0x4134[_0x4be9f5];return _0xe5636;};'use strict';var Sequelize=require(_0x4413('0x0'));module['exports']={'name':{'type':Sequelize[_0x4413('0x1')],'get':function(_0x11dc8f){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4413('0x2'),_0x4413('0x3'),'motionbar',_0x4413('0x4'),'urlForward','browser','bot','script']],'msg':_0x4413('0x5')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x6')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x7')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x4413('0x8')},'data5':{'type':Sequelize[_0x4413('0x9')](0x1000),'comments':_0x4413('0xa')},'data6':{'type':Sequelize['STRING'],'comments':_0x4413('0xb')},'data7':{'type':Sequelize[_0x4413('0xc')],'comments':_0x4413('0xd')}}; \ No newline at end of file +var _0xdb26=['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)]','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x342038,_0x195968){var _0x378a87=function(_0x4a9f71){while(--_0x4a9f71){_0x342038['push'](_0x342038['shift']());}};_0x378a87(++_0x195968);}(_0xdb26,0x16e));var _0x6db2=function(_0x3f823a,_0x29330a){_0x3f823a=_0x3f823a-0x0;var _0x440e40=_0xdb26[_0x3f823a];return _0x440e40;};'use strict';var Sequelize=require(_0x6db2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6db2('0x1')],'get':function(_0x2f491f){return this[_0x6db2('0x2')](_0x6db2('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x6db2('0x4'),_0x6db2('0x5'),_0x6db2('0x6'),_0x6db2('0x7'),'urlForward',_0x6db2('0x8'),_0x6db2('0x9'),_0x6db2('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x6db2('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x6db2('0xc')},'data2':{'type':Sequelize[_0x6db2('0xd')](0x1000),'comment':_0x6db2('0xe')},'data3':{'type':Sequelize[_0x6db2('0xd')](0x1000),'comment':_0x6db2('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x6db2('0x10')},'data5':{'type':Sequelize[_0x6db2('0xd')](0x1000),'comments':_0x6db2('0x11')},'data6':{'type':Sequelize[_0x6db2('0xd')],'comments':_0x6db2('0x12')},'data7':{'type':Sequelize[_0x6db2('0x13')],'comments':_0x6db2('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 117047a..9b42cc0 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 _0xf416=['bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','status','sendStatus','error','stack','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xdf6852,_0x463851){var _0x1f8f7c=function(_0x2c76d8){while(--_0x2c76d8){_0xdf6852['push'](_0xdf6852['shift']());}};_0x1f8f7c(++_0x463851);}(_0xf416,0x199));var _0x6f41=function(_0x501d6e,_0x17ec39){_0x501d6e=_0x501d6e-0x0;var _0x679768=_0xf416[_0x501d6e];return _0x679768;};'use strict';var emlformat=require(_0x6f41('0x0'));var rimraf=require(_0x6f41('0x1'));var zipdir=require(_0x6f41('0x2'));var jsonpatch=require(_0x6f41('0x3'));var rp=require(_0x6f41('0x4'));var moment=require('moment');var BPromise=require(_0x6f41('0x5'));var Mustache=require(_0x6f41('0x6'));var util=require(_0x6f41('0x7'));var path=require('path');var sox=require(_0x6f41('0x8'));var csv=require(_0x6f41('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f41('0xa'));var _=require('lodash');var squel=require(_0x6f41('0xb'));var crypto=require(_0x6f41('0xc'));var jsforce=require(_0x6f41('0xd'));var deskjs=require(_0x6f41('0xe'));var toCsv=require(_0x6f41('0x9'));var querystring=require(_0x6f41('0xf'));var Papa=require(_0x6f41('0x10'));var Redis=require(_0x6f41('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f41('0x12'));var as=require(_0x6f41('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f41('0x14'))(_0x6f41('0x15'));var utils=require(_0x6f41('0x16'));var config=require(_0x6f41('0x17'));var licenseUtil=require(_0x6f41('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2432ce,_0x1e4bee){_0x1e4bee=_0x1e4bee||0xcc;return function(_0x16ab96){if(_0x16ab96){return _0x2432ce['sendStatus'](_0x1e4bee);}return _0x2432ce['status'](_0x1e4bee)['end']();};}function respondWithResult(_0x53faf9,_0x2fae71){_0x2fae71=_0x2fae71||0xc8;return function(_0x441cc1){if(_0x441cc1){return _0x53faf9['status'](_0x2fae71)[_0x6f41('0x19')](_0x441cc1);}};}function respondWithFilteredResult(_0x21e19e,_0x364631){return function(_0x58bbfd){if(_0x58bbfd){var _0x542ebc=typeof _0x364631[_0x6f41('0x1a')]===_0x6f41('0x1b')&&typeof _0x364631[_0x6f41('0x1c')]==='undefined';var _0x474be1=_0x58bbfd['count'];var _0x5d3a06=_0x542ebc?0x0:_0x364631['offset'];var _0x12e046=_0x542ebc?_0x58bbfd[_0x6f41('0x1d')]:_0x364631[_0x6f41('0x1a')]+_0x364631[_0x6f41('0x1c')];var _0x438115;if(_0x12e046>=_0x474be1){_0x12e046=_0x474be1;_0x438115=0xc8;}else{_0x438115=0xce;}_0x21e19e['status'](_0x438115);return _0x21e19e[_0x6f41('0x1e')](_0x6f41('0x1f'),_0x5d3a06+'-'+_0x12e046+'/'+_0x474be1)[_0x6f41('0x19')](_0x58bbfd);}return null;};}function patchUpdates(_0x4ec7bc){return function(_0x4c036a){try{jsonpatch[_0x6f41('0x20')](_0x4c036a,_0x4ec7bc,!![]);}catch(_0x5d80db){return BPromise['reject'](_0x5d80db);}return _0x4c036a['save']();};}function saveUpdates(_0x787418,_0x1f4f75){return function(_0x477d34){if(_0x477d34){return _0x477d34[_0x6f41('0x21')](_0x787418)['then'](function(_0x16b9b2){return _0x16b9b2;});}return null;};}function removeEntity(_0x1f967e,_0x7bf27a){return function(_0x3cbd21){if(_0x3cbd21){return _0x3cbd21[_0x6f41('0x22')]()[_0x6f41('0x23')](function(){_0x1f967e[_0x6f41('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa16438,_0x115975){return function(_0x3360d7){if(!_0x3360d7){_0xa16438[_0x6f41('0x25')](0x194);}return _0x3360d7;};}function handleError(_0x5844b6,_0x5040f1){_0x5040f1=_0x5040f1||0x1f4;return function(_0x5f4086){logger[_0x6f41('0x26')](_0x5f4086[_0x6f41('0x27')]);if(_0x5f4086['name']){delete _0x5f4086['name'];}_0x5844b6[_0x6f41('0x24')](_0x5040f1)[_0x6f41('0x28')](_0x5f4086);};}exports[_0x6f41('0x21')]=function(_0x53dd43,_0x182157){if(_0x53dd43[_0x6f41('0x29')]['id']){delete _0x53dd43['body']['id'];}return db[_0x6f41('0x2a')][_0x6f41('0x2b')]({'where':{'id':_0x53dd43[_0x6f41('0x2c')]['id']}})[_0x6f41('0x23')](handleEntityNotFound(_0x182157,null))[_0x6f41('0x23')](saveUpdates(_0x53dd43[_0x6f41('0x29')],null))['then'](respondWithResult(_0x182157,null))[_0x6f41('0x2d')](handleError(_0x182157,null));};exports[_0x6f41('0x22')]=function(_0x412d97,_0x565301){return db[_0x6f41('0x2a')][_0x6f41('0x2b')]({'where':{'id':_0x412d97[_0x6f41('0x2c')]['id']}})[_0x6f41('0x23')](handleEntityNotFound(_0x565301,null))['then'](removeEntity(_0x565301,null))[_0x6f41('0x2d')](handleError(_0x565301,null));}; \ No newline at end of file +var _0x5de7=['reject','save','update','then','destroy','end','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5de7,0x1bd));var _0x75de=function(_0x3f4607,_0x1512b9){_0x3f4607=_0x3f4607-0x0;var _0x52084b=_0x5de7[_0x3f4607];return _0x52084b;};'use strict';var emlformat=require(_0x75de('0x0'));var rimraf=require(_0x75de('0x1'));var zipdir=require(_0x75de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x75de('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x75de('0x4'));var util=require(_0x75de('0x5'));var path=require(_0x75de('0x6'));var sox=require('sox');var csv=require(_0x75de('0x7'));var ejs=require(_0x75de('0x8'));var fs=require('fs');var fs_extra=require(_0x75de('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x75de('0xa'));var jsforce=require(_0x75de('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x75de('0x7'));var querystring=require(_0x75de('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x75de('0xd'));var qs=require(_0x75de('0xe'));var as=require(_0x75de('0xf'));var hardwareService=require(_0x75de('0x10'));var logger=require(_0x75de('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75de('0x12'))['db'];function respondWithStatusCode(_0x453309,_0xee0154){_0xee0154=_0xee0154||0xcc;return function(_0x1b76db){if(_0x1b76db){return _0x453309[_0x75de('0x13')](_0xee0154);}return _0x453309['status'](_0xee0154)['end']();};}function respondWithResult(_0x4514e9,_0x1b29ea){_0x1b29ea=_0x1b29ea||0xc8;return function(_0x38d41e){if(_0x38d41e){return _0x4514e9[_0x75de('0x14')](_0x1b29ea)['json'](_0x38d41e);}};}function respondWithFilteredResult(_0x3d3ab2,_0x4b7d47){return function(_0x10ad0f){if(_0x10ad0f){var _0x1d014b=typeof _0x4b7d47[_0x75de('0x15')]===_0x75de('0x16')&&typeof _0x4b7d47[_0x75de('0x17')]==='undefined';var _0x3acddd=_0x10ad0f['count'];var _0x2b3aee=_0x1d014b?0x0:_0x4b7d47[_0x75de('0x15')];var _0x4b8815=_0x1d014b?_0x10ad0f[_0x75de('0x18')]:_0x4b7d47[_0x75de('0x15')]+_0x4b7d47[_0x75de('0x17')];var _0x590773;if(_0x4b8815>=_0x3acddd){_0x4b8815=_0x3acddd;_0x590773=0xc8;}else{_0x590773=0xce;}_0x3d3ab2[_0x75de('0x14')](_0x590773);return _0x3d3ab2[_0x75de('0x19')](_0x75de('0x1a'),_0x2b3aee+'-'+_0x4b8815+'/'+_0x3acddd)['json'](_0x10ad0f);}return null;};}function patchUpdates(_0xa35971){return function(_0x476dc5){try{jsonpatch[_0x75de('0x1b')](_0x476dc5,_0xa35971,!![]);}catch(_0x3a7a47){return BPromise[_0x75de('0x1c')](_0x3a7a47);}return _0x476dc5[_0x75de('0x1d')]();};}function saveUpdates(_0x4a177e,_0x4cfc37){return function(_0x54a01f){if(_0x54a01f){return _0x54a01f[_0x75de('0x1e')](_0x4a177e)[_0x75de('0x1f')](function(_0x31a0dc){return _0x31a0dc;});}return null;};}function removeEntity(_0xb04bc9,_0x393b8a){return function(_0x3f989d){if(_0x3f989d){return _0x3f989d[_0x75de('0x20')]()[_0x75de('0x1f')](function(){_0xb04bc9['status'](0xcc)[_0x75de('0x21')]();});}};}function handleEntityNotFound(_0x2f4d5e,_0x1d080a){return function(_0x4a3de6){if(!_0x4a3de6){_0x2f4d5e[_0x75de('0x13')](0x194);}return _0x4a3de6;};}function handleError(_0x35e9de,_0x306ded){_0x306ded=_0x306ded||0x1f4;return function(_0x1b2b07){logger[_0x75de('0x22')](_0x1b2b07[_0x75de('0x23')]);if(_0x1b2b07[_0x75de('0x24')]){delete _0x1b2b07[_0x75de('0x24')];}_0x35e9de[_0x75de('0x14')](_0x306ded)[_0x75de('0x25')](_0x1b2b07);};}exports['update']=function(_0x1e30cd,_0x11a092){if(_0x1e30cd[_0x75de('0x26')]['id']){delete _0x1e30cd[_0x75de('0x26')]['id'];}return db[_0x75de('0x27')][_0x75de('0x28')]({'where':{'id':_0x1e30cd['params']['id']}})[_0x75de('0x1f')](handleEntityNotFound(_0x11a092,null))['then'](saveUpdates(_0x1e30cd[_0x75de('0x26')],null))[_0x75de('0x1f')](respondWithResult(_0x11a092,null))['catch'](handleError(_0x11a092,null));};exports[_0x75de('0x20')]=function(_0x22afa3,_0x5cfad8){return db[_0x75de('0x27')][_0x75de('0x28')]({'where':{'id':_0x22afa3[_0x75de('0x29')]['id']}})['then'](handleEntityNotFound(_0x5cfad8,null))[_0x75de('0x1f')](removeEntity(_0x5cfad8,null))[_0x75de('0x2a')](handleError(_0x5cfad8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index cb0a455..95c5d51 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 _0x17a5=['../../config/logger','moment','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions','util'];(function(_0x4a2384,_0x1586a7){var _0x5eee54=function(_0x1a130a){while(--_0x1a130a){_0x4a2384['push'](_0x4a2384['shift']());}};_0x5eee54(++_0x1586a7);}(_0x17a5,0x1d5));var _0x517a=function(_0xdfbe21,_0xbc92de){_0xdfbe21=_0xdfbe21-0x0;var _0x5e1e86=_0x17a5[_0xdfbe21];return _0x5e1e86;};'use strict';var _=require('lodash');var util=require(_0x517a('0x0'));var logger=require(_0x517a('0x1'))('api');var moment=require(_0x517a('0x2'));var BPromise=require('bluebird');var rp=require(_0x517a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x517a('0x4'));var config=require('../../config/environment');var attributes=require(_0x517a('0x5'));module[_0x517a('0x6')]=function(_0x3c34f8,_0x4db37b){return _0x3c34f8[_0x517a('0x7')](_0x517a('0x8'),attributes,{'tableName':_0x517a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['rimraf','./action.attributes','define','Action','lodash','util','../../config/logger','moment','path'];(function(_0x19f02c,_0x19a152){var _0x38b31e=function(_0x346b84){while(--_0x346b84){_0x19f02c['push'](_0x19f02c['shift']());}};_0x38b31e(++_0x19a152);}(_0x7046,0x1c6));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))('api');var moment=require(_0x6704('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6704('0x4'));var rimraf=require(_0x6704('0x5'));var config=require('../../config/environment');var attributes=require(_0x6704('0x6'));module['exports']=function(_0x3a2ef8,_0x3b99da){return _0x3a2ef8[_0x6704('0x7')](_0x6704('0x8'),attributes,{'tableName':'tools_actions','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 f67859f..178bb01 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x53ec,0x192));var _0xc53e=function(_0x10eb38,_0x2086bd){_0x10eb38=_0x10eb38-0x0;var _0x5af9b5=_0x53ec[_0x10eb38];return _0x5af9b5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1cb9,0x14e));var _0x91cb=function(_0x7307cd,_0x2df2ab){_0x7307cd=_0x7307cd-0x0;var _0x38cdb0=_0x1cb9[_0x7307cd];return _0x38cdb0;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9a49986..487171b 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 _0x007d=['connect-timeout','express','fs-extra','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','util'];(function(_0xd8151c,_0x55918f){var _0x2e9c71=function(_0x12c66d){while(--_0x12c66d){_0xd8151c['push'](_0xd8151c['shift']());}};_0x2e9c71(++_0x55918f);}(_0x007d,0x11e));var _0xd007=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x007d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd007('0x0'));var util=require(_0xd007('0x1'));var path=require('path');var timeout=require(_0xd007('0x2'));var express=require(_0xd007('0x3'));var router=express['Router']();var fs_extra=require(_0xd007('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd007('0x5'));var config=require('../../config/environment');var controller=require(_0xd007('0x6'));router[_0xd007('0x7')](_0xd007('0x8'),auth[_0xd007('0x9')](),controller['update']);router['delete'](_0xd007('0x8'),auth[_0xd007('0x9')](),controller[_0xd007('0xa')]);module[_0xd007('0xb')]=router; \ No newline at end of file +var _0x1c33=['Router','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express'];(function(_0x4f7bde,_0x27c8e1){var _0x5cc36b=function(_0x3a76ee){while(--_0x3a76ee){_0x4f7bde['push'](_0x4f7bde['shift']());}};_0x5cc36b(++_0x27c8e1);}(_0x1c33,0x10d));var _0x31c3=function(_0xdf2f4b,_0x235a6a){_0xdf2f4b=_0xdf2f4b-0x0;var _0x521c49=_0x1c33[_0xdf2f4b];return _0x521c49;};'use strict';var multer=require(_0x31c3('0x0'));var util=require(_0x31c3('0x1'));var path=require('path');var timeout=require(_0x31c3('0x2'));var express=require(_0x31c3('0x3'));var router=express[_0x31c3('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(_0x31c3('0x5'));router[_0x31c3('0x6')](_0x31c3('0x7'),auth['isAuthenticated'](),controller[_0x31c3('0x8')]);router[_0x31c3('0x9')](_0x31c3('0x7'),auth[_0x31c3('0xa')](),controller[_0x31c3('0xb')]);module[_0x31c3('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index dc10eaa..50282a9 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x262d66,_0x3eb656){var _0x549a57=function(_0x5b0dc5){while(--_0x5b0dc5){_0x262d66['push'](_0x262d66['shift']());}};_0x549a57(++_0x3eb656);}(_0x7c09,0x102));var _0x97c0=function(_0x54a132,_0x481e8f){_0x54a132=_0x54a132-0x0;var _0x30aef6=_0x7c09[_0x54a132];return _0x30aef6;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x379ea0,_0x5f1136){var _0x46822e=function(_0x24a840){while(--_0x24a840){_0x379ea0['push'](_0x379ea0['shift']());}};_0x46822e(++_0x5f1136);}(_0xe14b,0x93));var _0xbe14=function(_0x571914,_0x2142ab){_0x571914=_0x571914-0x0;var _0x5744ec=_0xe14b[_0x571914];return _0x5744ec;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0bce553..d22e46c 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 _0xbb9e=['stack','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','replace','format','orderBy','order','DESC','alias','joins','parse','includes','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','foreignTable','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','function','debug','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','get','UserProfileResource','end','error'];(function(_0x5a194c,_0x315e13){var _0xa3e3ba=function(_0x2b1273){while(--_0x2b1273){_0x5a194c['push'](_0x5a194c['shift']());}};_0xa3e3ba(++_0x315e13);}(_0xbb9e,0x11e));var _0xebb9=function(_0x5d77be,_0x11ed48){_0x5d77be=_0x5d77be-0x0;var _0x2fb36c=_0xbb9e[_0x5d77be];return _0x2fb36c;};'use strict';var emlformat=require(_0xebb9('0x0'));var rimraf=require(_0xebb9('0x1'));var zipdir=require(_0xebb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebb9('0x3'));var moment=require('moment');var BPromise=require(_0xebb9('0x4'));var Mustache=require('mustache');var util=require(_0xebb9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xebb9('0x6'));var ejs=require(_0xebb9('0x7'));var fs=require('fs');var fs_extra=require(_0xebb9('0x8'));var _=require('lodash');var squel=require(_0xebb9('0x9'));var crypto=require(_0xebb9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xebb9('0xb'));var toCsv=require(_0xebb9('0x6'));var querystring=require(_0xebb9('0xc'));var Papa=require(_0xebb9('0xd'));var Redis=require(_0xebb9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xebb9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebb9('0x10'));var logger=require(_0xebb9('0x11'))(_0xebb9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebb9('0x13'));var db=require(_0xebb9('0x14'))['db'];var dbH=require('../../mysqldb')[_0xebb9('0x15')];function respondWithStatusCode(_0x2b63a8,_0x596655){_0x596655=_0x596655||0xcc;return function(_0x491b08){if(_0x491b08){return _0x2b63a8[_0xebb9('0x16')](_0x596655);}return _0x2b63a8[_0xebb9('0x17')](_0x596655)['end']();};}function respondWithResult(_0x209c9f,_0xa910e9){_0xa910e9=_0xa910e9||0xc8;return function(_0xbdb7fb){if(_0xbdb7fb){return _0x209c9f[_0xebb9('0x17')](_0xa910e9)[_0xebb9('0x18')](_0xbdb7fb);}};}function respondWithFilteredResult(_0x4ac9bb,_0x2ed7b4){return function(_0x4ac45d){if(_0x4ac45d){var _0x19442c=typeof _0x2ed7b4['offset']==='undefined'&&typeof _0x2ed7b4['limit']===_0xebb9('0x19');var _0x39e90f=_0x4ac45d[_0xebb9('0x1a')];var _0x11ed8=_0x19442c?0x0:_0x2ed7b4[_0xebb9('0x1b')];var _0x305618=_0x19442c?_0x4ac45d[_0xebb9('0x1a')]:_0x2ed7b4[_0xebb9('0x1b')]+_0x2ed7b4[_0xebb9('0x1c')];var _0x5df964;if(_0x305618>=_0x39e90f){_0x305618=_0x39e90f;_0x5df964=0xc8;}else{_0x5df964=0xce;}_0x4ac9bb[_0xebb9('0x17')](_0x5df964);return _0x4ac9bb[_0xebb9('0x1d')](_0xebb9('0x1e'),_0x11ed8+'-'+_0x305618+'/'+_0x39e90f)['json'](_0x4ac45d);}return null;};}function patchUpdates(_0x3cbfa6){return function(_0x4b66fe){try{jsonpatch['apply'](_0x4b66fe,_0x3cbfa6,!![]);}catch(_0x337da9){return BPromise[_0xebb9('0x1f')](_0x337da9);}return _0x4b66fe[_0xebb9('0x20')]();};}function saveUpdates(_0x577ff1,_0x24aa14){return function(_0x155018){if(_0x155018){return _0x155018['update'](_0x577ff1)[_0xebb9('0x21')](function(_0x308406){return _0x308406;});}return null;};}function removeEntity(_0x4a1a6a,_0x4a14b9){return function(_0x4b190d){if(_0x4b190d){return _0x4b190d['destroy']()['then'](function(){var _0x161855=_0x4b190d[_0xebb9('0x22')]({'plain':!![]});var _0x3bde42='CustomReports';return db[_0xebb9('0x23')]['destroy']({'where':{'type':_0x3bde42,'resourceId':_0x161855['id']}})[_0xebb9('0x21')](function(){return _0x4b190d;});})[_0xebb9('0x21')](function(){_0x4a1a6a[_0xebb9('0x17')](0xcc)[_0xebb9('0x24')]();});}};}function handleEntityNotFound(_0x3dc296,_0xafe3a3){return function(_0x16e021){if(!_0x16e021){_0x3dc296[_0xebb9('0x16')](0x194);}return _0x16e021;};}function handleError(_0x5994c3,_0x2d7c85){_0x2d7c85=_0x2d7c85||0x1f4;return function(_0x3e3f62){logger[_0xebb9('0x25')](_0x3e3f62[_0xebb9('0x26')]);if(_0x3e3f62['name']){delete _0x3e3f62['name'];}_0x5994c3[_0xebb9('0x17')](_0x2d7c85)[_0xebb9('0x27')](_0x3e3f62);};}exports['index']=function(_0xf8c6f4,_0xffbc38){var _0x166e3f={},_0x1c33a4={},_0x3e2dca={'count':0x0,'rows':[]};var _0x1d5811=_[_0xebb9('0x28')](db[_0xebb9('0x29')][_0xebb9('0x2a')],function(_0x536266){return{'name':_0x536266[_0xebb9('0x2b')],'type':_0x536266['type'][_0xebb9('0x2c')]};});_0x1c33a4[_0xebb9('0x2d')]=_['map'](_0x1d5811,_0xebb9('0x2e'));_0x1c33a4[_0xebb9('0x2f')]=_[_0xebb9('0x30')](_0xf8c6f4['query']);_0x1c33a4[_0xebb9('0x31')]=_['intersection'](_0x1c33a4[_0xebb9('0x2d')],_0x1c33a4[_0xebb9('0x2f')]);_0x166e3f[_0xebb9('0x32')]=_['intersection'](_0x1c33a4[_0xebb9('0x2d')],qs['fields'](_0xf8c6f4[_0xebb9('0x2f')]['fields']));_0x166e3f['attributes']=_0x166e3f['attributes']['length']?_0x166e3f[_0xebb9('0x32')]:_0x1c33a4[_0xebb9('0x2d')];if(!_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x33')]('nolimit')){_0x166e3f[_0xebb9('0x1c')]=qs[_0xebb9('0x1c')](_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x1c')]);_0x166e3f[_0xebb9('0x1b')]=qs['offset'](_0xf8c6f4['query'][_0xebb9('0x1b')]);}_0x166e3f['order']=qs['sort'](_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x34')]);_0x166e3f['where']=qs[_0xebb9('0x31')](_[_0xebb9('0x35')](_0xf8c6f4[_0xebb9('0x2f')],_0x1c33a4[_0xebb9('0x31')]),_0x1d5811);if(_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x36')]){_0x166e3f[_0xebb9('0x37')]=_[_0xebb9('0x38')](_0x166e3f[_0xebb9('0x37')],{'$or':_[_0xebb9('0x28')](_0x1d5811,function(_0x374437){if(_0x374437[_0xebb9('0x39')]!==_0xebb9('0x3a')){var _0x257e74={};_0x257e74[_0x374437['name']]={'$like':'%'+_0xf8c6f4['query'][_0xebb9('0x36')]+'%'};return _0x257e74;}})});}_0x166e3f=_[_0xebb9('0x38')]({},_0x166e3f,_0xf8c6f4[_0xebb9('0x3b')]);var _0x5a88d1={'where':_0x166e3f[_0xebb9('0x37')]};return db[_0xebb9('0x29')][_0xebb9('0x1a')](_0x5a88d1)[_0xebb9('0x21')](function(_0x102126){_0x3e2dca['count']=_0x102126;if(_0xf8c6f4['query'][_0xebb9('0x3c')]){_0x166e3f[_0xebb9('0x3d')]=[{'all':!![]}];}return db[_0xebb9('0x29')][_0xebb9('0x3e')](_0x166e3f);})[_0xebb9('0x21')](function(_0x353dfa){_0x3e2dca[_0xebb9('0x3f')]=_0x353dfa;return _0x3e2dca;})[_0xebb9('0x21')](respondWithFilteredResult(_0xffbc38,_0x166e3f))[_0xebb9('0x40')](handleError(_0xffbc38,null));};exports[_0xebb9('0x41')]=function(_0x3e5306,_0xce287c){var _0x58ca9e={'raw':![],'where':{'id':_0x3e5306[_0xebb9('0x42')]['id']}},_0x138651={};_0x138651[_0xebb9('0x2d')]=_[_0xebb9('0x30')](db[_0xebb9('0x29')][_0xebb9('0x2a')]);_0x138651[_0xebb9('0x2f')]=_[_0xebb9('0x30')](_0x3e5306[_0xebb9('0x2f')]);_0x138651['filters']=_[_0xebb9('0x43')](_0x138651[_0xebb9('0x2d')],_0x138651[_0xebb9('0x2f')]);_0x58ca9e[_0xebb9('0x32')]=_[_0xebb9('0x43')](_0x138651[_0xebb9('0x2d')],qs['fields'](_0x3e5306[_0xebb9('0x2f')][_0xebb9('0x44')]));_0x58ca9e['attributes']=_0x58ca9e[_0xebb9('0x32')][_0xebb9('0x45')]?_0x58ca9e[_0xebb9('0x32')]:_0x138651[_0xebb9('0x2d')];if(_0x3e5306[_0xebb9('0x2f')][_0xebb9('0x3c')]){_0x58ca9e[_0xebb9('0x3d')]=[{'all':!![]}];}_0x58ca9e=_[_0xebb9('0x38')]({},_0x58ca9e,_0x3e5306['options']);return db['AnalyticCustomReport']['find'](_0x58ca9e)[_0xebb9('0x21')](handleEntityNotFound(_0xce287c,null))[_0xebb9('0x21')](respondWithResult(_0xce287c,null))[_0xebb9('0x40')](handleError(_0xce287c,null));};exports['create']=function(_0x59b9dc,_0x4115c0){return db['AnalyticCustomReport']['create'](_0x59b9dc[_0xebb9('0x46')],{})[_0xebb9('0x21')](function(_0x3a975d){var _0xa682b=_0x59b9dc[_0xebb9('0x47')]['get']({'plain':!![]});if(!_0xa682b)throw new Error(_0xebb9('0x48'));if(_0xa682b['role']===_0xebb9('0x47')){var _0x55f861=_0x3a975d[_0xebb9('0x22')]({'plain':!![]});var _0x6bb57e='Reports';return db['UserProfileSection'][_0xebb9('0x49')]({'where':{'name':_0x6bb57e,'userProfileId':_0xa682b['userProfileId']},'raw':!![]})[_0xebb9('0x21')](function(_0x33ab6c){if(_0x33ab6c&&_0x33ab6c[_0xebb9('0x4a')]===0x0){return db[_0xebb9('0x23')][_0xebb9('0x4b')]({'name':_0x55f861[_0xebb9('0x2e')],'resourceId':_0x55f861['id'],'type':_0xebb9('0x4c'),'sectionId':_0x33ab6c['id']},{})[_0xebb9('0x21')](function(){return _0x3a975d;});}else{return _0x3a975d;}})['catch'](function(_0x47dede){logger[_0xebb9('0x25')](_0xebb9('0x4d'),_0x47dede);throw _0x47dede;});}return _0x3a975d;})[_0xebb9('0x21')](respondWithResult(_0x4115c0,0xc9))[_0xebb9('0x40')](handleError(_0x4115c0,null));};exports[_0xebb9('0x4e')]=function(_0x5385a9,_0x477e3b){if(_0x5385a9['body']['id']){delete _0x5385a9['body']['id'];}return db[_0xebb9('0x29')][_0xebb9('0x49')]({'where':{'id':_0x5385a9['params']['id']}})[_0xebb9('0x21')](handleEntityNotFound(_0x477e3b,null))['then'](saveUpdates(_0x5385a9[_0xebb9('0x46')],null))[_0xebb9('0x21')](respondWithResult(_0x477e3b,null))[_0xebb9('0x40')](handleError(_0x477e3b,null));};exports['destroy']=function(_0x4c7dd2,_0x4248f1){return db[_0xebb9('0x29')][_0xebb9('0x49')]({'where':{'id':_0x4c7dd2[_0xebb9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4248f1,null))[_0xebb9('0x21')](removeEntity(_0x4248f1,null))[_0xebb9('0x40')](handleError(_0x4248f1,null));};exports[_0xebb9('0x4f')]=function(_0x1f2e3f,_0x1c197d){var _0x1caaa=0xa;var _0x734350=['join','left_join',_0xebb9('0x50'),_0xebb9('0x51')];var _0x361b50={'SUM':_0xebb9('0x52'),'COUNT':_0xebb9('0x53'),'COUNT DISTINCT':_0xebb9('0x54'),'MAX':'MAX(%s)','MIN':_0xebb9('0x55'),'AVG':_0xebb9('0x56'),'GROUP_CONCAT':_0xebb9('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x5a676b={'SEC_TO_TIME':_0xebb9('0x59'),'DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x37b29d=function(_0x19e390){return!_['includes'](['IS\x20NULL',_0xebb9('0x5d'),_0xebb9('0x5e'),_0xebb9('0x5f')],_0x19e390);};var _0x2732d2=function(_0x251f08){if(!_0x251f08||!_0x251f08[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x1df289='(',_0x121eb2=0x0;_0x121eb2<_0x251f08['rules'][_0xebb9('0x45')];_0x121eb2+=0x1){_0x121eb2>0x0&&(_0x1df289+='\x20'+_0x251f08[_0xebb9('0x61')]+'\x20');_0x1df289+=_0x251f08['rules'][_0x121eb2][_0xebb9('0x62')]?_0x2732d2(_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x62')]):_0x251f08[_0xebb9('0x60')][_0x121eb2]['field']+'\x20'+_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x63')]+(_0x37b29d(_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x63')])?'\x20'+_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x64')]:'');}return _0x1df289+')';};var _0x39cea6={'where':{'id':_0x1f2e3f[_0xebb9('0x42')]['id']}},_0x4579f4,_0x3525ec,_0x5dcfc1,_0x4ae4d6,_0x443130;_0x39cea6=_[_0xebb9('0x38')]({},_0x39cea6,_0x1f2e3f[_0xebb9('0x3b')]);return db[_0xebb9('0x29')]['find'](_0x39cea6)[_0xebb9('0x21')](function(_0x2f33a0){if(_0x2f33a0){_0x4579f4=_0x2f33a0;return _0x2f33a0[_0xebb9('0x65')]();}return null;})[_0xebb9('0x21')](function(_0x255969){if(_0x255969){if(!_0x255969[_0xebb9('0x45')]){throw new db[(_0xebb9('0x66'))][(_0xebb9('0x67'))](_0xebb9('0x68'),0x193);}_0x3525ec=_0x255969;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x1eb045){if(_0x1eb045){_0x5dcfc1=_[_0xebb9('0x6a')](_0x1eb045,'id');var _0x4100f3;var _0x14406b=squel[_0xebb9('0x6b')]();_0x14406b[_0xebb9('0x6c')](_0x4579f4['table']);for(var _0x1415b1=0x0;_0x1415b1<_0x3525ec[_0xebb9('0x45')];_0x1415b1+=0x1){_0x4100f3=_0x3525ec[_0x1415b1][_0xebb9('0x6d')]?_0x5dcfc1[_0x3525ec[_0x1415b1][_0xebb9('0x6d')]][_0xebb9('0x6e')]:_0x3525ec[_0x1415b1][_0xebb9('0x6f')];_0x4100f3=_0x3525ec[_0x1415b1]['function']?_[_0xebb9('0x70')](_0x361b50[_0x3525ec[_0x1415b1]['function']],'%s',_0x4100f3):_0x4100f3;_0x4100f3=_0x3525ec[_0x1415b1]['format']?_[_0xebb9('0x70')](_0x5a676b[_0x3525ec[_0x1415b1][_0xebb9('0x71')]],'%s',_0x4100f3):_0x4100f3;if(_0x3525ec[_0x1415b1]['groupBy']){_0x14406b[_0xebb9('0x62')](_0x4100f3);}_0x3525ec[_0x1415b1][_0xebb9('0x72')]&&_0x14406b[_0xebb9('0x73')](_0x4100f3,_0x3525ec[_0x1415b1]['orderBy']===_0xebb9('0x74')?![]:!![]);_0x14406b[_0xebb9('0x6f')](_0x4100f3,_0x3525ec[_0x1415b1][_0xebb9('0x75')]||_0x4100f3);}if(_0x4579f4[_0xebb9('0x76')]){_0x4579f4['joins']=JSON[_0xebb9('0x77')](_0x4579f4[_0xebb9('0x76')]);for(var _0x382fed=0x0;_0x382fed<_0x4579f4[_0xebb9('0x76')][_0xebb9('0x45')];_0x382fed+=0x1){if(_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x39')]&&_[_0xebb9('0x78')](_0x734350,_0x4579f4[_0xebb9('0x76')][_0x382fed]['type'])&&_0x4579f4[_0xebb9('0x76')][_0x382fed]['parentKey']&&_0x4579f4[_0xebb9('0x76')][_0x382fed]['foreignTable']&&_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x79')]){_0x14406b[_0x4579f4[_0xebb9('0x76')][_0x382fed]['type']](_0x4579f4['joins'][_0x382fed]['foreignTable'],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x4579f4[_0xebb9('0x7b')],_0x4579f4['joins'][_0x382fed][_0xebb9('0x7c')],_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x7d')],_0x4579f4['joins'][_0x382fed][_0xebb9('0x79')]));}}}if(_0x4579f4[_0xebb9('0x7e')]){_0x4579f4['conditions']=JSON[_0xebb9('0x77')](_0x4579f4['conditions']);_0x14406b[_0xebb9('0x37')](_0x2732d2(_0x4579f4['conditions'][_0xebb9('0x62')]));}_0x443130=_0x14406b[_0xebb9('0x7f')]();_0x14406b[_0xebb9('0x1c')](_0x1caaa);_0x14406b[_0xebb9('0x1b')](0x0);logger['debug'](_0xebb9('0x80'),_0x14406b['toString']());return dbH[_0xebb9('0x81')]['query'](_0x14406b[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')][_0xebb9('0x84')]});}})[_0xebb9('0x21')](respondWithResult(_0x1c197d,null))[_0xebb9('0x40')](handleError(_0x1c197d,null));};function runReport(_0x2cc099,_0x573e34,_0x501aea){var _0x38fe62=_0x573e34['name'];var _0x2a7f64=0xa;var _0x4e3d08=[_0xebb9('0x85'),_0xebb9('0x86'),_0xebb9('0x50'),_0xebb9('0x51')];var _0x353d35={'SUM':_0xebb9('0x52'),'COUNT':_0xebb9('0x53'),'COUNT DISTINCT':_0xebb9('0x54'),'MAX':_0xebb9('0x87'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xebb9('0x88'),'GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x3d5b12={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2366d2=function(_0x221561){return!_[_0xebb9('0x78')]([_0xebb9('0x89'),_0xebb9('0x5d'),'IS\x20EMPTY',_0xebb9('0x5f')],_0x221561);};var _0x35b66d=function(_0x1f69b2){if(!_0x1f69b2||!_0x1f69b2[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x3de965='(',_0x54dbdf=0x0;_0x54dbdf<_0x1f69b2[_0xebb9('0x60')][_0xebb9('0x45')];_0x54dbdf+=0x1){_0x54dbdf>0x0&&(_0x3de965+='\x20'+_0x1f69b2[_0xebb9('0x61')]+'\x20');_0x3de965+=_0x1f69b2['rules'][_0x54dbdf][_0xebb9('0x62')]?_0x35b66d(_0x1f69b2['rules'][_0x54dbdf]['group']):_0x1f69b2[_0xebb9('0x60')][_0x54dbdf][_0xebb9('0x6f')]+'\x20'+_0x1f69b2['rules'][_0x54dbdf][_0xebb9('0x63')]+(_0x2366d2(_0x1f69b2[_0xebb9('0x60')][_0x54dbdf]['condition'])?'\x20'+_0x1f69b2[_0xebb9('0x60')][_0x54dbdf][_0xebb9('0x64')]:'');}return _0x3de965+')';};var _0x1a4149={'where':{'id':_0x2cc099['id']}},_0x5e8413,_0x4c8513,_0x5102f0,_0x25b164,_0x425b05;_0x1a4149=_[_0xebb9('0x38')]({},_0x1a4149,_0x501aea);return db[_0xebb9('0x29')][_0xebb9('0x49')](_0x1a4149)['then'](function(_0x385e2f){if(_0x385e2f){_0x5e8413=_0x385e2f;return _0x385e2f[_0xebb9('0x65')]();}return null;})[_0xebb9('0x21')](function(_0x47325c){if(_0x47325c){if(!_0x47325c[_0xebb9('0x45')]){throw new db['Sequelize'][(_0xebb9('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4c8513=_0x47325c;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x6ab956){if(_0x6ab956){_0x5102f0=_['keyBy'](_0x6ab956,'id');var _0x507a1b;var _0x4c99cf=squel['select']();_0x4c99cf[_0xebb9('0x6c')](_0x5e8413[_0xebb9('0x7b')]);for(var _0xcf3bfc=0x0;_0xcf3bfc<_0x4c8513[_0xebb9('0x45')];_0xcf3bfc+=0x1){_0x507a1b=_0x4c8513[_0xcf3bfc][_0xebb9('0x6d')]?_0x5102f0[_0x4c8513[_0xcf3bfc][_0xebb9('0x6d')]][_0xebb9('0x6e')]:_0x4c8513[_0xcf3bfc][_0xebb9('0x6f')];_0x507a1b=_0x4c8513[_0xcf3bfc]['function']?_[_0xebb9('0x70')](_0x353d35[_0x4c8513[_0xcf3bfc]['function']],'%s',_0x507a1b):_0x507a1b;_0x507a1b=_0x4c8513[_0xcf3bfc]['format']?_[_0xebb9('0x70')](_0x3d5b12[_0x4c8513[_0xcf3bfc][_0xebb9('0x71')]],'%s',_0x507a1b):_0x507a1b;if(_0x4c8513[_0xcf3bfc][_0xebb9('0x8a')]){_0x4c99cf[_0xebb9('0x62')](_0x507a1b);}_0x4c8513[_0xcf3bfc][_0xebb9('0x72')]&&_0x4c99cf[_0xebb9('0x73')](_0x507a1b,_0x4c8513[_0xcf3bfc][_0xebb9('0x72')]===_0xebb9('0x74')?![]:!![]);_0x4c99cf['field'](_0x507a1b,_0x4c8513[_0xcf3bfc][_0xebb9('0x75')]||_0x507a1b);}if(_0x5e8413[_0xebb9('0x76')]){_0x5e8413[_0xebb9('0x76')]=JSON[_0xebb9('0x77')](_0x5e8413[_0xebb9('0x76')]);for(var _0x497e2d=0x0;_0x497e2d<_0x5e8413['joins'][_0xebb9('0x45')];_0x497e2d+=0x1){if(_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x39')]&&_['includes'](_0x4e3d08,_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x39')])&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x7c')]&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x7d')]&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x79')]){_0x4c99cf[_0x5e8413['joins'][_0x497e2d][_0xebb9('0x39')]](_0x5e8413[_0xebb9('0x76')][_0x497e2d]['foreignTable'],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x5e8413['table'],_0x5e8413[_0xebb9('0x76')][_0x497e2d]['parentKey'],_0x5e8413[_0xebb9('0x76')][_0x497e2d]['foreignTable'],_0x5e8413['joins'][_0x497e2d]['foreignKey']));}}}if(_0x5e8413[_0xebb9('0x7e')]){_0x5e8413[_0xebb9('0x7e')]=JSON[_0xebb9('0x77')](_0x5e8413[_0xebb9('0x7e')]);_0x4c99cf[_0xebb9('0x37')](_0x35b66d(_0x5e8413[_0xebb9('0x7e')][_0xebb9('0x62')]));}_0x425b05=_0x4c99cf['clone']();_0x4c99cf[_0xebb9('0x1c')](_0x2a7f64);_0x4c99cf[_0xebb9('0x1b')](0x0);return;}})[_0xebb9('0x21')](function(){if(_0x573e34[_0xebb9('0x8b')]===_0xebb9('0x8c')){return null;}var _0x451bae=_[_0xebb9('0x38')](_0x573e34,{'name':_0x573e34[_0xebb9('0x8d')]||_0x573e34[_0xebb9('0x2e')]||_0x5e8413[_0xebb9('0x2e')],'basename':_0x38fe62,'savename':util[_0xebb9('0x71')](_0xebb9('0x8e'),_0x573e34[_0xebb9('0x2e')]||_0x5e8413[_0xebb9('0x2e')],require(_0xebb9('0x8f'))[_0xebb9('0x90')](0x4),_0x573e34[_0xebb9('0x8b')]||_0xebb9('0x91')),'reportId':_0x5e8413['id'],'reportType':_0xebb9('0x92')});return db['AnalyticExtractedReport'][_0xebb9('0x4b')](_0x451bae,{'raw':!![]});})[_0xebb9('0x21')](function(_0x7fcb8a){if(_0x5e8413['table']===_0xebb9('0x93')){_0x425b05['where'](_0x5e8413[_0xebb9('0x7b')]+_0xebb9('0x94'),_0x573e34[_0xebb9('0x95')],_0x573e34[_0xebb9('0x96')]);}else{_0x425b05[_0xebb9('0x37')](_0x5e8413['table']+_0xebb9('0x97'),_0x573e34[_0xebb9('0x95')],_0x573e34[_0xebb9('0x96')]);}if(_0x7fcb8a){logger['info'](_0xebb9('0x98'),_0x425b05[_0xebb9('0x82')]());require('child_process')[_0xebb9('0x99')](path[_0xebb9('0x85')](__dirname,_0xebb9('0x9a'),_0x7fcb8a[_0xebb9('0x8b')]),[_0x7fcb8a['id'],_0x425b05['toString'](),path[_0xebb9('0x85')](__dirname,_0xebb9('0x9b'),_0x7fcb8a[_0xebb9('0x9c')]),_0x38fe62]);return _0x7fcb8a;}else{var _0x4be535=squel[_0xebb9('0x6b')]();_0x4be535[_0xebb9('0x6c')]('('+_0x425b05[_0xebb9('0x82')]()+')',_0xebb9('0x9d'));_0x4be535[_0xebb9('0x6f')](_0xebb9('0x9e'),_0xebb9('0x1a'));_0x425b05[_0xebb9('0x1c')](_0x573e34[_0xebb9('0x1c')]||_0x2a7f64);_0x425b05['offset'](_0x573e34[_0xebb9('0x1b')]||0x0);return dbH[_0xebb9('0x81')][_0xebb9('0x2f')](_0x4be535[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')]['QueryTypes']['SELECT']})[_0xebb9('0x21')](function(_0x195904){if(!_0x195904[_0xebb9('0x45')]){_0x25b164=0x0;}else{_0x25b164=_0x195904[0x0][_0xebb9('0x1a')]||0x0;}return dbH['sequelize'][_0xebb9('0x2f')](_0x425b05['toString'](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')]['SELECT']});})[_0xebb9('0x21')](function(_0x394065){return{'rows':_0x394065||[],'count':_0x25b164};});}});}exports['run']=function(_0x65d6ed,_0x1c09fe){return runReport(_0x65d6ed[_0xebb9('0x42')],_0x65d6ed[_0xebb9('0x2f')],_0x65d6ed['options'])[_0xebb9('0x21')](respondWithResult(_0x1c09fe,null))[_0xebb9('0x40')](handleError(_0x1c09fe,null));};exports[_0xebb9('0x9f')]=runReport;exports[_0xebb9('0x2f')]=function(_0x5867af,_0x10a40b){var _0x943392=0xa;var _0x1bdf62=['join','left_join',_0xebb9('0x50'),_0xebb9('0x51')];var _0x15cdf8={'SUM':'SUM(%s)','COUNT':_0xebb9('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xebb9('0x87'),'MIN':_0xebb9('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xebb9('0x57'),'GROUP_CONCAT ASC':_0xebb9('0x88'),'GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x4ff385={'SEC_TO_TIME':_0xebb9('0x59'),'DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ab074=function(_0x1c844f){return!_['includes']([_0xebb9('0x89'),'IS\x20NOT\x20NULL',_0xebb9('0x5e'),_0xebb9('0x5f')],_0x1c844f);};var _0x15c4ba=function(_0x43db8b){if(!_0x43db8b||!_0x43db8b[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x466751='(',_0x52ed4b=0x0;_0x52ed4b<_0x43db8b[_0xebb9('0x60')][_0xebb9('0x45')];_0x52ed4b+=0x1){_0x52ed4b>0x0&&(_0x466751+='\x20'+_0x43db8b[_0xebb9('0x61')]+'\x20');_0x466751+=_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x62')]?_0x15c4ba(_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x62')]):_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x6f')]+'\x20'+_0x43db8b[_0xebb9('0x60')][_0x52ed4b]['condition']+(_0x1ab074(_0x43db8b[_0xebb9('0x60')][_0x52ed4b]['condition'])?'\x20'+_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x64')]:'');}return _0x466751+')';};var _0x29208f={'where':{'id':_0x5867af['params']['id']}},_0x43cfd3,_0x2a0f69,_0x549444,_0x456b21,_0x22f4dc;_0x29208f=_['merge']({},_0x29208f,_0x5867af[_0xebb9('0x3b')]);return db[_0xebb9('0x29')][_0xebb9('0x49')](_0x29208f)['then'](function(_0x503402){if(_0x503402){_0x43cfd3=_0x503402;return _0x503402['getFields']();}return null;})[_0xebb9('0x21')](function(_0x3f54e5){if(_0x3f54e5){if(!_0x3f54e5[_0xebb9('0x45')]){throw new db[(_0xebb9('0x66'))][(_0xebb9('0x67'))](_0xebb9('0x68'),0x193);}_0x2a0f69=_0x3f54e5;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x1f0a5d){if(_0x1f0a5d){_0x549444=_[_0xebb9('0x6a')](_0x1f0a5d,'id');var _0x31add8;var _0x272a3b=squel[_0xebb9('0x6b')]();_0x272a3b['from'](_0x43cfd3[_0xebb9('0x7b')]);for(var _0x285295=0x0;_0x285295<_0x2a0f69[_0xebb9('0x45')];_0x285295+=0x1){_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0x6d')]?_0x549444[_0x2a0f69[_0x285295][_0xebb9('0x6d')]]['metric']:_0x2a0f69[_0x285295][_0xebb9('0x6f')];_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0xa0')]?_[_0xebb9('0x70')](_0x15cdf8[_0x2a0f69[_0x285295][_0xebb9('0xa0')]],'%s',_0x31add8):_0x31add8;_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0x71')]?_[_0xebb9('0x70')](_0x4ff385[_0x2a0f69[_0x285295][_0xebb9('0x71')]],'%s',_0x31add8):_0x31add8;if(_0x2a0f69[_0x285295][_0xebb9('0x8a')]){_0x272a3b['group'](_0x31add8);}_0x2a0f69[_0x285295][_0xebb9('0x72')]&&_0x272a3b[_0xebb9('0x73')](_0x31add8,_0x2a0f69[_0x285295][_0xebb9('0x72')]===_0xebb9('0x74')?![]:!![]);_0x272a3b[_0xebb9('0x6f')](_0x31add8,_0x2a0f69[_0x285295][_0xebb9('0x75')]||_0x31add8);}if(_0x43cfd3['joins']){_0x43cfd3[_0xebb9('0x76')]=JSON[_0xebb9('0x77')](_0x43cfd3['joins']);for(var _0xee197b=0x0;_0xee197b<_0x43cfd3['joins']['length'];_0xee197b+=0x1){if(_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x39')]&&_[_0xebb9('0x78')](_0x1bdf62,_0x43cfd3[_0xebb9('0x76')][_0xee197b]['type'])&&_0x43cfd3['joins'][_0xee197b]['parentKey']&&_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')]&&_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x79')]){_0x272a3b[_0x43cfd3[_0xebb9('0x76')][_0xee197b]['type']](_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x43cfd3[_0xebb9('0x7b')],_0x43cfd3[_0xebb9('0x76')][_0xee197b]['parentKey'],_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')],_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x79')]));}}}if(_0x43cfd3[_0xebb9('0x7e')]){_0x43cfd3[_0xebb9('0x7e')]=JSON[_0xebb9('0x77')](_0x43cfd3[_0xebb9('0x7e')]);_0x272a3b['where'](_0x15c4ba(_0x43cfd3[_0xebb9('0x7e')][_0xebb9('0x62')]));}_0x22f4dc=_0x272a3b[_0xebb9('0x7f')]();_0x272a3b['limit'](_0x943392);_0x272a3b[_0xebb9('0x1b')](0x0);logger[_0xebb9('0xa1')](_0xebb9('0x80'),_0x272a3b[_0xebb9('0x82')]());return dbH['sequelize'][_0xebb9('0x2f')](_0x272a3b[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x22f4dc['toString']()};})['then'](respondWithResult(_0x10a40b,null))[_0xebb9('0x40')](handleError(_0x10a40b,null));}; \ No newline at end of file +var _0x6c1d=['../../mysqldb','sendStatus','end','undefined','count','offset','status','set','json','apply','save','update','destroy','then','get','CustomReports','UserProfileResource','error','name','send','index','AnalyticCustomReport','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','rawAttributes','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','body','params','preview','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20EMPTY','select','alias','clone','output','web','fullPath','%s-%s.%s','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','right_join','SUM(%s)','UNIX_TIMESTAMP(%s)','operator','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util'];(function(_0x3dfade,_0x54ad41){var _0xb51af7=function(_0x587b94){while(--_0x587b94){_0x3dfade['push'](_0x3dfade['shift']());}};_0xb51af7(++_0x54ad41);}(_0x6c1d,0x124));var _0xd6c1=function(_0x3c9e24,_0x2d3c82){_0x3c9e24=_0x3c9e24-0x0;var _0x33501c=_0x6c1d[_0x3c9e24];return _0x33501c;};'use strict';var emlformat=require(_0xd6c1('0x0'));var rimraf=require(_0xd6c1('0x1'));var zipdir=require(_0xd6c1('0x2'));var jsonpatch=require(_0xd6c1('0x3'));var rp=require(_0xd6c1('0x4'));var moment=require(_0xd6c1('0x5'));var BPromise=require(_0xd6c1('0x6'));var Mustache=require(_0xd6c1('0x7'));var util=require(_0xd6c1('0x8'));var path=require(_0xd6c1('0x9'));var sox=require(_0xd6c1('0xa'));var csv=require('to-csv');var ejs=require(_0xd6c1('0xb'));var fs=require('fs');var fs_extra=require(_0xd6c1('0xc'));var _=require(_0xd6c1('0xd'));var squel=require('squel');var crypto=require(_0xd6c1('0xe'));var jsforce=require(_0xd6c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd6c1('0x10'));var querystring=require(_0xd6c1('0x11'));var Papa=require(_0xd6c1('0x12'));var Redis=require('ioredis');var authService=require(_0xd6c1('0x13'));var qs=require(_0xd6c1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6c1('0x15'));var utils=require('../../config/utils');var config=require(_0xd6c1('0x16'));var licenseUtil=require(_0xd6c1('0x17'));var db=require(_0xd6c1('0x18'))['db'];var dbH=require(_0xd6c1('0x18'))['dbH'];function respondWithStatusCode(_0x58326d,_0xd28356){_0xd28356=_0xd28356||0xcc;return function(_0x57020c){if(_0x57020c){return _0x58326d[_0xd6c1('0x19')](_0xd28356);}return _0x58326d['status'](_0xd28356)[_0xd6c1('0x1a')]();};}function respondWithResult(_0x3fcb68,_0x8180eb){_0x8180eb=_0x8180eb||0xc8;return function(_0x4c4190){if(_0x4c4190){return _0x3fcb68['status'](_0x8180eb)['json'](_0x4c4190);}};}function respondWithFilteredResult(_0x4ca916,_0x501df0){return function(_0x5e6be8){if(_0x5e6be8){var _0x2016fb=typeof _0x501df0['offset']===_0xd6c1('0x1b')&&typeof _0x501df0['limit']==='undefined';var _0x2df02b=_0x5e6be8[_0xd6c1('0x1c')];var _0x5ea588=_0x2016fb?0x0:_0x501df0[_0xd6c1('0x1d')];var _0x1bb32a=_0x2016fb?_0x5e6be8[_0xd6c1('0x1c')]:_0x501df0[_0xd6c1('0x1d')]+_0x501df0['limit'];var _0x43ff21;if(_0x1bb32a>=_0x2df02b){_0x1bb32a=_0x2df02b;_0x43ff21=0xc8;}else{_0x43ff21=0xce;}_0x4ca916[_0xd6c1('0x1e')](_0x43ff21);return _0x4ca916[_0xd6c1('0x1f')]('Content-Range',_0x5ea588+'-'+_0x1bb32a+'/'+_0x2df02b)[_0xd6c1('0x20')](_0x5e6be8);}return null;};}function patchUpdates(_0x4bbddd){return function(_0x25cc71){try{jsonpatch[_0xd6c1('0x21')](_0x25cc71,_0x4bbddd,!![]);}catch(_0x329f79){return BPromise['reject'](_0x329f79);}return _0x25cc71[_0xd6c1('0x22')]();};}function saveUpdates(_0x499918,_0x43fbb9){return function(_0x55c588){if(_0x55c588){return _0x55c588[_0xd6c1('0x23')](_0x499918)['then'](function(_0x25c46e){return _0x25c46e;});}return null;};}function removeEntity(_0x52385b,_0x1b3eae){return function(_0x4621e1){if(_0x4621e1){return _0x4621e1[_0xd6c1('0x24')]()[_0xd6c1('0x25')](function(){var _0x533b96=_0x4621e1[_0xd6c1('0x26')]({'plain':!![]});var _0x4db381=_0xd6c1('0x27');return db[_0xd6c1('0x28')][_0xd6c1('0x24')]({'where':{'type':_0x4db381,'resourceId':_0x533b96['id']}})[_0xd6c1('0x25')](function(){return _0x4621e1;});})[_0xd6c1('0x25')](function(){_0x52385b[_0xd6c1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d21a8,_0x308a14){return function(_0x30b841){if(!_0x30b841){_0x1d21a8[_0xd6c1('0x19')](0x194);}return _0x30b841;};}function handleError(_0x3284ab,_0x3d2ea6){_0x3d2ea6=_0x3d2ea6||0x1f4;return function(_0x13ab8e){logger[_0xd6c1('0x29')](_0x13ab8e['stack']);if(_0x13ab8e[_0xd6c1('0x2a')]){delete _0x13ab8e['name'];}_0x3284ab[_0xd6c1('0x1e')](_0x3d2ea6)[_0xd6c1('0x2b')](_0x13ab8e);};}exports[_0xd6c1('0x2c')]=function(_0x100b55,_0x12075c){var _0x5a047a={},_0x46d359={},_0x56b5d9={'count':0x0,'rows':[]};var _0x5bfbcf=_['map'](db[_0xd6c1('0x2d')]['rawAttributes'],function(_0x257f1f){return{'name':_0x257f1f['fieldName'],'type':_0x257f1f['type']['key']};});_0x46d359[_0xd6c1('0x2e')]=_['map'](_0x5bfbcf,_0xd6c1('0x2a'));_0x46d359[_0xd6c1('0x2f')]=_[_0xd6c1('0x30')](_0x100b55[_0xd6c1('0x2f')]);_0x46d359[_0xd6c1('0x31')]=_['intersection'](_0x46d359[_0xd6c1('0x2e')],_0x46d359[_0xd6c1('0x2f')]);_0x5a047a[_0xd6c1('0x32')]=_[_0xd6c1('0x33')](_0x46d359[_0xd6c1('0x2e')],qs[_0xd6c1('0x34')](_0x100b55[_0xd6c1('0x2f')][_0xd6c1('0x34')]));_0x5a047a[_0xd6c1('0x32')]=_0x5a047a[_0xd6c1('0x32')][_0xd6c1('0x35')]?_0x5a047a[_0xd6c1('0x32')]:_0x46d359[_0xd6c1('0x2e')];if(!_0x100b55[_0xd6c1('0x2f')]['hasOwnProperty'](_0xd6c1('0x36'))){_0x5a047a[_0xd6c1('0x37')]=qs[_0xd6c1('0x37')](_0x100b55[_0xd6c1('0x2f')][_0xd6c1('0x37')]);_0x5a047a['offset']=qs[_0xd6c1('0x1d')](_0x100b55[_0xd6c1('0x2f')][_0xd6c1('0x1d')]);}_0x5a047a[_0xd6c1('0x38')]=qs[_0xd6c1('0x39')](_0x100b55[_0xd6c1('0x2f')]['sort']);_0x5a047a[_0xd6c1('0x3a')]=qs['filters'](_[_0xd6c1('0x3b')](_0x100b55[_0xd6c1('0x2f')],_0x46d359[_0xd6c1('0x31')]),_0x5bfbcf);if(_0x100b55[_0xd6c1('0x2f')][_0xd6c1('0x3c')]){_0x5a047a[_0xd6c1('0x3a')]=_[_0xd6c1('0x3d')](_0x5a047a[_0xd6c1('0x3a')],{'$or':_['map'](_0x5bfbcf,function(_0x251d79){if(_0x251d79[_0xd6c1('0x3e')]!==_0xd6c1('0x3f')){var _0x5df1dd={};_0x5df1dd[_0x251d79['name']]={'$like':'%'+_0x100b55[_0xd6c1('0x2f')][_0xd6c1('0x3c')]+'%'};return _0x5df1dd;}})});}_0x5a047a=_[_0xd6c1('0x3d')]({},_0x5a047a,_0x100b55['options']);var _0x5569df={'where':_0x5a047a[_0xd6c1('0x3a')]};return db[_0xd6c1('0x2d')][_0xd6c1('0x1c')](_0x5569df)[_0xd6c1('0x25')](function(_0x470247){_0x56b5d9[_0xd6c1('0x1c')]=_0x470247;if(_0x100b55['query']['includeAll']){_0x5a047a[_0xd6c1('0x40')]=[{'all':!![]}];}return db[_0xd6c1('0x2d')][_0xd6c1('0x41')](_0x5a047a);})[_0xd6c1('0x25')](function(_0x3d1715){_0x56b5d9[_0xd6c1('0x42')]=_0x3d1715;return _0x56b5d9;})[_0xd6c1('0x25')](respondWithFilteredResult(_0x12075c,_0x5a047a))[_0xd6c1('0x43')](handleError(_0x12075c,null));};exports['show']=function(_0xd446db,_0x39ab9d){var _0xfdefc8={'raw':![],'where':{'id':_0xd446db['params']['id']}},_0x357a52={};_0x357a52['model']=_[_0xd6c1('0x30')](db[_0xd6c1('0x2d')][_0xd6c1('0x44')]);_0x357a52[_0xd6c1('0x2f')]=_['keys'](_0xd446db[_0xd6c1('0x2f')]);_0x357a52['filters']=_[_0xd6c1('0x33')](_0x357a52['model'],_0x357a52[_0xd6c1('0x2f')]);_0xfdefc8['attributes']=_['intersection'](_0x357a52[_0xd6c1('0x2e')],qs['fields'](_0xd446db[_0xd6c1('0x2f')]['fields']));_0xfdefc8[_0xd6c1('0x32')]=_0xfdefc8['attributes'][_0xd6c1('0x35')]?_0xfdefc8[_0xd6c1('0x32')]:_0x357a52[_0xd6c1('0x2e')];if(_0xd446db[_0xd6c1('0x2f')]['includeAll']){_0xfdefc8[_0xd6c1('0x40')]=[{'all':!![]}];}_0xfdefc8=_[_0xd6c1('0x3d')]({},_0xfdefc8,_0xd446db[_0xd6c1('0x45')]);return db[_0xd6c1('0x2d')][_0xd6c1('0x46')](_0xfdefc8)[_0xd6c1('0x25')](handleEntityNotFound(_0x39ab9d,null))[_0xd6c1('0x25')](respondWithResult(_0x39ab9d,null))[_0xd6c1('0x43')](handleError(_0x39ab9d,null));};exports['create']=function(_0x330533,_0x4562c9){return db['AnalyticCustomReport'][_0xd6c1('0x47')](_0x330533['body'],{})['then'](function(_0x447b8a){var _0xe19d3=_0x330533['user'][_0xd6c1('0x26')]({'plain':!![]});if(!_0xe19d3)throw new Error(_0xd6c1('0x48'));if(_0xe19d3['role']===_0xd6c1('0x49')){var _0x31ce18=_0x447b8a['get']({'plain':!![]});var _0x30ae38=_0xd6c1('0x4a');return db[_0xd6c1('0x4b')][_0xd6c1('0x46')]({'where':{'name':_0x30ae38,'userProfileId':_0xe19d3['userProfileId']},'raw':!![]})[_0xd6c1('0x25')](function(_0x2a3db7){if(_0x2a3db7&&_0x2a3db7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x31ce18[_0xd6c1('0x2a')],'resourceId':_0x31ce18['id'],'type':'CustomReports','sectionId':_0x2a3db7['id']},{})['then'](function(){return _0x447b8a;});}else{return _0x447b8a;}})['catch'](function(_0x3b9608){logger[_0xd6c1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b9608);throw _0x3b9608;});}return _0x447b8a;})['then'](respondWithResult(_0x4562c9,0xc9))[_0xd6c1('0x43')](handleError(_0x4562c9,null));};exports[_0xd6c1('0x23')]=function(_0x3f3fd8,_0x553d36){if(_0x3f3fd8[_0xd6c1('0x4c')]['id']){delete _0x3f3fd8[_0xd6c1('0x4c')]['id'];}return db[_0xd6c1('0x2d')][_0xd6c1('0x46')]({'where':{'id':_0x3f3fd8[_0xd6c1('0x4d')]['id']}})[_0xd6c1('0x25')](handleEntityNotFound(_0x553d36,null))['then'](saveUpdates(_0x3f3fd8[_0xd6c1('0x4c')],null))[_0xd6c1('0x25')](respondWithResult(_0x553d36,null))[_0xd6c1('0x43')](handleError(_0x553d36,null));};exports[_0xd6c1('0x24')]=function(_0x3a3cbd,_0x3c3bad){return db[_0xd6c1('0x2d')][_0xd6c1('0x46')]({'where':{'id':_0x3a3cbd[_0xd6c1('0x4d')]['id']}})[_0xd6c1('0x25')](handleEntityNotFound(_0x3c3bad,null))[_0xd6c1('0x25')](removeEntity(_0x3c3bad,null))[_0xd6c1('0x43')](handleError(_0x3c3bad,null));};exports[_0xd6c1('0x4e')]=function(_0x22a495,_0x2a5569){var _0x4d7e02=0xa;var _0x3a77d0=[_0xd6c1('0x4f'),_0xd6c1('0x50'),'right_join',_0xd6c1('0x51')];var _0x2f99df={'SUM':'SUM(%s)','COUNT':_0xd6c1('0x52'),'COUNT DISTINCT':_0xd6c1('0x53'),'MAX':_0xd6c1('0x54'),'MIN':_0xd6c1('0x55'),'AVG':_0xd6c1('0x56'),'GROUP_CONCAT':_0xd6c1('0x57'),'GROUP_CONCAT ASC':_0xd6c1('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15626a={'SEC_TO_TIME':_0xd6c1('0x59'),'DATE':_0xd6c1('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x369466=function(_0x476426){return!_[_0xd6c1('0x5b')]([_0xd6c1('0x5c'),_0xd6c1('0x5d'),_0xd6c1('0x5e'),'IS\x20NOT\x20EMPTY'],_0x476426);};var _0x264554=function(_0x5a87be){if(!_0x5a87be||!_0x5a87be[_0xd6c1('0x5f')][_0xd6c1('0x35')]){return'';}for(var _0x36dfac='(',_0x4608fb=0x0;_0x4608fb<_0x5a87be['rules'][_0xd6c1('0x35')];_0x4608fb+=0x1){_0x4608fb>0x0&&(_0x36dfac+='\x20'+_0x5a87be['operator']+'\x20');_0x36dfac+=_0x5a87be[_0xd6c1('0x5f')][_0x4608fb]['group']?_0x264554(_0x5a87be[_0xd6c1('0x5f')][_0x4608fb]['group']):_0x5a87be['rules'][_0x4608fb][_0xd6c1('0x60')]+'\x20'+_0x5a87be[_0xd6c1('0x5f')][_0x4608fb][_0xd6c1('0x61')]+(_0x369466(_0x5a87be[_0xd6c1('0x5f')][_0x4608fb][_0xd6c1('0x61')])?'\x20'+_0x5a87be[_0xd6c1('0x5f')][_0x4608fb][_0xd6c1('0x62')]:'');}return _0x36dfac+')';};var _0x174028={'where':{'id':_0x22a495[_0xd6c1('0x4d')]['id']}},_0x46dbe1,_0x4124c5,_0x2e849b,_0x41f088,_0x275141;_0x174028=_[_0xd6c1('0x3d')]({},_0x174028,_0x22a495[_0xd6c1('0x45')]);return db[_0xd6c1('0x2d')][_0xd6c1('0x46')](_0x174028)['then'](function(_0x209ee7){if(_0x209ee7){_0x46dbe1=_0x209ee7;return _0x209ee7[_0xd6c1('0x63')]();}return null;})[_0xd6c1('0x25')](function(_0x262a2a){if(_0x262a2a){if(!_0x262a2a[_0xd6c1('0x35')]){throw new db[(_0xd6c1('0x64'))][(_0xd6c1('0x65'))](_0xd6c1('0x66'),0x193);}_0x4124c5=_0x262a2a;return db[_0xd6c1('0x67')][_0xd6c1('0x41')]({'raw':!![]});}return null;})[_0xd6c1('0x25')](function(_0x270726){if(_0x270726){_0x2e849b=_[_0xd6c1('0x68')](_0x270726,'id');var _0x2c50b4;var _0x590d49=squel['select']();_0x590d49[_0xd6c1('0x69')](_0x46dbe1[_0xd6c1('0x6a')]);for(var _0x1c6e78=0x0;_0x1c6e78<_0x4124c5['length'];_0x1c6e78+=0x1){_0x2c50b4=_0x4124c5[_0x1c6e78][_0xd6c1('0x6b')]?_0x2e849b[_0x4124c5[_0x1c6e78][_0xd6c1('0x6b')]][_0xd6c1('0x6c')]:_0x4124c5[_0x1c6e78][_0xd6c1('0x60')];_0x2c50b4=_0x4124c5[_0x1c6e78][_0xd6c1('0x6d')]?_[_0xd6c1('0x6e')](_0x2f99df[_0x4124c5[_0x1c6e78][_0xd6c1('0x6d')]],'%s',_0x2c50b4):_0x2c50b4;_0x2c50b4=_0x4124c5[_0x1c6e78][_0xd6c1('0x6f')]?_[_0xd6c1('0x6e')](_0x15626a[_0x4124c5[_0x1c6e78][_0xd6c1('0x6f')]],'%s',_0x2c50b4):_0x2c50b4;if(_0x4124c5[_0x1c6e78][_0xd6c1('0x70')]){_0x590d49[_0xd6c1('0x71')](_0x2c50b4);}_0x4124c5[_0x1c6e78][_0xd6c1('0x72')]&&_0x590d49[_0xd6c1('0x38')](_0x2c50b4,_0x4124c5[_0x1c6e78][_0xd6c1('0x72')]===_0xd6c1('0x73')?![]:!![]);_0x590d49[_0xd6c1('0x60')](_0x2c50b4,_0x4124c5[_0x1c6e78]['alias']||_0x2c50b4);}if(_0x46dbe1[_0xd6c1('0x74')]){_0x46dbe1[_0xd6c1('0x74')]=JSON[_0xd6c1('0x75')](_0x46dbe1[_0xd6c1('0x74')]);for(var _0x24d22d=0x0;_0x24d22d<_0x46dbe1[_0xd6c1('0x74')]['length'];_0x24d22d+=0x1){if(_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x3e')]&&_['includes'](_0x3a77d0,_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x3e')])&&_0x46dbe1['joins'][_0x24d22d][_0xd6c1('0x76')]&&_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x77')]&&_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x78')]){_0x590d49[_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x3e')]](_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x77')],null,util[_0xd6c1('0x6f')](_0xd6c1('0x79'),_0x46dbe1['table'],_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x76')],_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x77')],_0x46dbe1[_0xd6c1('0x74')][_0x24d22d][_0xd6c1('0x78')]));}}}if(_0x46dbe1[_0xd6c1('0x7a')]){_0x46dbe1[_0xd6c1('0x7a')]=JSON['parse'](_0x46dbe1[_0xd6c1('0x7a')]);_0x590d49[_0xd6c1('0x3a')](_0x264554(_0x46dbe1['conditions'][_0xd6c1('0x71')]));}_0x275141=_0x590d49['clone']();_0x590d49[_0xd6c1('0x37')](_0x4d7e02);_0x590d49[_0xd6c1('0x1d')](0x0);logger[_0xd6c1('0x7b')](_0xd6c1('0x7c'),_0x590d49[_0xd6c1('0x7d')]());return dbH['sequelize'][_0xd6c1('0x2f')](_0x590d49[_0xd6c1('0x7d')](),{'type':dbH[_0xd6c1('0x7e')][_0xd6c1('0x7f')]['SELECT']});}})[_0xd6c1('0x25')](respondWithResult(_0x2a5569,null))['catch'](handleError(_0x2a5569,null));};function runReport(_0x1e1654,_0xbf7f07,_0x133866){var _0x251898=_0xbf7f07[_0xd6c1('0x2a')];var _0x738bca=0xa;var _0x49375f=[_0xd6c1('0x4f'),_0xd6c1('0x50'),'right_join',_0xd6c1('0x51')];var _0x25caa8={'SUM':'SUM(%s)','COUNT':_0xd6c1('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd6c1('0x54'),'MIN':_0xd6c1('0x55'),'AVG':_0xd6c1('0x56'),'GROUP_CONCAT':_0xd6c1('0x57'),'GROUP_CONCAT ASC':_0xd6c1('0x58'),'GROUP_CONCAT DESC':_0xd6c1('0x80')};var _0x5cf0b7={'SEC_TO_TIME':_0xd6c1('0x59'),'DATE':_0xd6c1('0x5a'),'HOUR':_0xd6c1('0x81'),'ROUND':_0xd6c1('0x82'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3f95b2=function(_0xb8a6a9){return!_[_0xd6c1('0x5b')]([_0xd6c1('0x5c'),_0xd6c1('0x5d'),_0xd6c1('0x5e'),_0xd6c1('0x83')],_0xb8a6a9);};var _0x57c39c=function(_0x83f4a){if(!_0x83f4a||!_0x83f4a[_0xd6c1('0x5f')][_0xd6c1('0x35')]){return'';}for(var _0x544c33='(',_0x5f348f=0x0;_0x5f348f<_0x83f4a['rules'][_0xd6c1('0x35')];_0x5f348f+=0x1){_0x5f348f>0x0&&(_0x544c33+='\x20'+_0x83f4a['operator']+'\x20');_0x544c33+=_0x83f4a[_0xd6c1('0x5f')][_0x5f348f][_0xd6c1('0x71')]?_0x57c39c(_0x83f4a[_0xd6c1('0x5f')][_0x5f348f][_0xd6c1('0x71')]):_0x83f4a[_0xd6c1('0x5f')][_0x5f348f]['field']+'\x20'+_0x83f4a[_0xd6c1('0x5f')][_0x5f348f][_0xd6c1('0x61')]+(_0x3f95b2(_0x83f4a[_0xd6c1('0x5f')][_0x5f348f][_0xd6c1('0x61')])?'\x20'+_0x83f4a['rules'][_0x5f348f][_0xd6c1('0x62')]:'');}return _0x544c33+')';};var _0x354481={'where':{'id':_0x1e1654['id']}},_0x15c021,_0x24c55c,_0x33294c,_0x56cc03,_0x51a0cb;_0x354481=_['merge']({},_0x354481,_0x133866);return db[_0xd6c1('0x2d')][_0xd6c1('0x46')](_0x354481)[_0xd6c1('0x25')](function(_0x2d4cd){if(_0x2d4cd){_0x15c021=_0x2d4cd;return _0x2d4cd[_0xd6c1('0x63')]();}return null;})[_0xd6c1('0x25')](function(_0x1b9e98){if(_0x1b9e98){if(!_0x1b9e98[_0xd6c1('0x35')]){throw new db[(_0xd6c1('0x64'))][(_0xd6c1('0x65'))](_0xd6c1('0x66'),0x193);}_0x24c55c=_0x1b9e98;return db[_0xd6c1('0x67')]['findAll']({'raw':!![]});}return null;})[_0xd6c1('0x25')](function(_0x392e98){if(_0x392e98){_0x33294c=_['keyBy'](_0x392e98,'id');var _0x25a97e;var _0x335e03=squel[_0xd6c1('0x84')]();_0x335e03[_0xd6c1('0x69')](_0x15c021[_0xd6c1('0x6a')]);for(var _0xa7271a=0x0;_0xa7271a<_0x24c55c[_0xd6c1('0x35')];_0xa7271a+=0x1){_0x25a97e=_0x24c55c[_0xa7271a][_0xd6c1('0x6b')]?_0x33294c[_0x24c55c[_0xa7271a][_0xd6c1('0x6b')]][_0xd6c1('0x6c')]:_0x24c55c[_0xa7271a][_0xd6c1('0x60')];_0x25a97e=_0x24c55c[_0xa7271a]['function']?_[_0xd6c1('0x6e')](_0x25caa8[_0x24c55c[_0xa7271a][_0xd6c1('0x6d')]],'%s',_0x25a97e):_0x25a97e;_0x25a97e=_0x24c55c[_0xa7271a]['format']?_['replace'](_0x5cf0b7[_0x24c55c[_0xa7271a][_0xd6c1('0x6f')]],'%s',_0x25a97e):_0x25a97e;if(_0x24c55c[_0xa7271a]['groupBy']){_0x335e03[_0xd6c1('0x71')](_0x25a97e);}_0x24c55c[_0xa7271a]['orderBy']&&_0x335e03['order'](_0x25a97e,_0x24c55c[_0xa7271a][_0xd6c1('0x72')]==='DESC'?![]:!![]);_0x335e03[_0xd6c1('0x60')](_0x25a97e,_0x24c55c[_0xa7271a][_0xd6c1('0x85')]||_0x25a97e);}if(_0x15c021[_0xd6c1('0x74')]){_0x15c021[_0xd6c1('0x74')]=JSON[_0xd6c1('0x75')](_0x15c021[_0xd6c1('0x74')]);for(var _0x1fceac=0x0;_0x1fceac<_0x15c021['joins'][_0xd6c1('0x35')];_0x1fceac+=0x1){if(_0x15c021[_0xd6c1('0x74')][_0x1fceac]['type']&&_[_0xd6c1('0x5b')](_0x49375f,_0x15c021[_0xd6c1('0x74')][_0x1fceac][_0xd6c1('0x3e')])&&_0x15c021['joins'][_0x1fceac][_0xd6c1('0x76')]&&_0x15c021[_0xd6c1('0x74')][_0x1fceac]['foreignTable']&&_0x15c021[_0xd6c1('0x74')][_0x1fceac][_0xd6c1('0x78')]){_0x335e03[_0x15c021[_0xd6c1('0x74')][_0x1fceac][_0xd6c1('0x3e')]](_0x15c021[_0xd6c1('0x74')][_0x1fceac][_0xd6c1('0x77')],null,util[_0xd6c1('0x6f')](_0xd6c1('0x79'),_0x15c021['table'],_0x15c021[_0xd6c1('0x74')][_0x1fceac][_0xd6c1('0x76')],_0x15c021[_0xd6c1('0x74')][_0x1fceac]['foreignTable'],_0x15c021[_0xd6c1('0x74')][_0x1fceac]['foreignKey']));}}}if(_0x15c021[_0xd6c1('0x7a')]){_0x15c021[_0xd6c1('0x7a')]=JSON[_0xd6c1('0x75')](_0x15c021[_0xd6c1('0x7a')]);_0x335e03['where'](_0x57c39c(_0x15c021['conditions'][_0xd6c1('0x71')]));}_0x51a0cb=_0x335e03[_0xd6c1('0x86')]();_0x335e03[_0xd6c1('0x37')](_0x738bca);_0x335e03[_0xd6c1('0x1d')](0x0);return;}})['then'](function(){if(_0xbf7f07[_0xd6c1('0x87')]===_0xd6c1('0x88')){return null;}var _0x2eac64=_['merge'](_0xbf7f07,{'name':_0xbf7f07[_0xd6c1('0x89')]||_0xbf7f07[_0xd6c1('0x2a')]||_0x15c021[_0xd6c1('0x2a')],'basename':_0x251898,'savename':util[_0xd6c1('0x6f')](_0xd6c1('0x8a'),_0xbf7f07['name']||_0x15c021[_0xd6c1('0x2a')],require('randomstring')['generate'](0x4),_0xbf7f07[_0xd6c1('0x87')]||_0xd6c1('0x8b')),'reportId':_0x15c021['id'],'reportType':'custom'});return db[_0xd6c1('0x8c')][_0xd6c1('0x47')](_0x2eac64,{'raw':!![]});})['then'](function(_0x75ba05){if(_0x15c021[_0xd6c1('0x6a')]==='cdr'){_0x51a0cb[_0xd6c1('0x3a')](_0x15c021[_0xd6c1('0x6a')]+_0xd6c1('0x8d'),_0xbf7f07[_0xd6c1('0x8e')],_0xbf7f07[_0xd6c1('0x8f')]);}else{_0x51a0cb[_0xd6c1('0x3a')](_0x15c021[_0xd6c1('0x6a')]+_0xd6c1('0x90'),_0xbf7f07[_0xd6c1('0x8e')],_0xbf7f07[_0xd6c1('0x8f')]);}if(_0x75ba05){logger[_0xd6c1('0x91')]('Run\x20Query:',_0x51a0cb[_0xd6c1('0x7d')]());require(_0xd6c1('0x92'))[_0xd6c1('0x93')](path[_0xd6c1('0x4f')](__dirname,_0xd6c1('0x94'),_0x75ba05[_0xd6c1('0x87')]),[_0x75ba05['id'],_0x51a0cb['toString'](),path[_0xd6c1('0x4f')](__dirname,_0xd6c1('0x95'),_0x75ba05[_0xd6c1('0x96')]),_0x251898]);return _0x75ba05;}else{var _0x41fd80=squel[_0xd6c1('0x84')]();_0x41fd80[_0xd6c1('0x69')]('('+_0x51a0cb['toString']()+')',_0xd6c1('0x97'));_0x41fd80[_0xd6c1('0x60')](_0xd6c1('0x98'),_0xd6c1('0x1c'));_0x51a0cb[_0xd6c1('0x37')](_0xbf7f07[_0xd6c1('0x37')]||_0x738bca);_0x51a0cb[_0xd6c1('0x1d')](_0xbf7f07[_0xd6c1('0x1d')]||0x0);return dbH[_0xd6c1('0x7e')][_0xd6c1('0x2f')](_0x41fd80[_0xd6c1('0x7d')](),{'type':dbH[_0xd6c1('0x7e')]['QueryTypes'][_0xd6c1('0x99')]})[_0xd6c1('0x25')](function(_0x391a1f){if(!_0x391a1f[_0xd6c1('0x35')]){_0x56cc03=0x0;}else{_0x56cc03=_0x391a1f[0x0][_0xd6c1('0x1c')]||0x0;}return dbH[_0xd6c1('0x7e')]['query'](_0x51a0cb[_0xd6c1('0x7d')](),{'type':dbH[_0xd6c1('0x7e')]['QueryTypes'][_0xd6c1('0x99')]});})[_0xd6c1('0x25')](function(_0x2cb8f3){return{'rows':_0x2cb8f3||[],'count':_0x56cc03};});}});}exports['run']=function(_0x5e3e4c,_0x580e50){return runReport(_0x5e3e4c['params'],_0x5e3e4c[_0xd6c1('0x2f')],_0x5e3e4c[_0xd6c1('0x45')])[_0xd6c1('0x25')](respondWithResult(_0x580e50,null))[_0xd6c1('0x43')](handleError(_0x580e50,null));};exports['runReport']=runReport;exports[_0xd6c1('0x2f')]=function(_0xd8dbac,_0x211d3d){var _0x55033c=0xa;var _0x4b9029=[_0xd6c1('0x4f'),_0xd6c1('0x50'),_0xd6c1('0x9a'),_0xd6c1('0x51')];var _0x54fb63={'SUM':_0xd6c1('0x9b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd6c1('0x53'),'MAX':_0xd6c1('0x54'),'MIN':_0xd6c1('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd6c1('0x57'),'GROUP_CONCAT ASC':_0xd6c1('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4b0b61={'SEC_TO_TIME':_0xd6c1('0x59'),'DATE':_0xd6c1('0x5a'),'HOUR':_0xd6c1('0x81'),'ROUND':_0xd6c1('0x82'),'UNIX_TIMESTAMP':_0xd6c1('0x9c')};var _0x5f4999=function(_0x15fde2){return!_[_0xd6c1('0x5b')]([_0xd6c1('0x5c'),_0xd6c1('0x5d'),'IS\x20EMPTY',_0xd6c1('0x83')],_0x15fde2);};var _0x39b974=function(_0x5c1ec4){if(!_0x5c1ec4||!_0x5c1ec4[_0xd6c1('0x5f')]['length']){return'';}for(var _0xfaaf75='(',_0x50c444=0x0;_0x50c444<_0x5c1ec4['rules'][_0xd6c1('0x35')];_0x50c444+=0x1){_0x50c444>0x0&&(_0xfaaf75+='\x20'+_0x5c1ec4[_0xd6c1('0x9d')]+'\x20');_0xfaaf75+=_0x5c1ec4['rules'][_0x50c444][_0xd6c1('0x71')]?_0x39b974(_0x5c1ec4[_0xd6c1('0x5f')][_0x50c444]['group']):_0x5c1ec4[_0xd6c1('0x5f')][_0x50c444][_0xd6c1('0x60')]+'\x20'+_0x5c1ec4[_0xd6c1('0x5f')][_0x50c444]['condition']+(_0x5f4999(_0x5c1ec4[_0xd6c1('0x5f')][_0x50c444][_0xd6c1('0x61')])?'\x20'+_0x5c1ec4[_0xd6c1('0x5f')][_0x50c444][_0xd6c1('0x62')]:'');}return _0xfaaf75+')';};var _0x4c5f13={'where':{'id':_0xd8dbac['params']['id']}},_0x257f4a,_0x320ee0,_0x4256e0,_0x25f7ba,_0x4611a4;_0x4c5f13=_[_0xd6c1('0x3d')]({},_0x4c5f13,_0xd8dbac[_0xd6c1('0x45')]);return db[_0xd6c1('0x2d')][_0xd6c1('0x46')](_0x4c5f13)['then'](function(_0x1f1f50){if(_0x1f1f50){_0x257f4a=_0x1f1f50;return _0x1f1f50[_0xd6c1('0x63')]();}return null;})[_0xd6c1('0x25')](function(_0x50076c){if(_0x50076c){if(!_0x50076c['length']){throw new db['Sequelize'][(_0xd6c1('0x65'))](_0xd6c1('0x66'),0x193);}_0x320ee0=_0x50076c;return db[_0xd6c1('0x67')][_0xd6c1('0x41')]({'raw':!![]});}return null;})[_0xd6c1('0x25')](function(_0x5ccbab){if(_0x5ccbab){_0x4256e0=_[_0xd6c1('0x68')](_0x5ccbab,'id');var _0x2bfaa6;var _0x529fd7=squel[_0xd6c1('0x84')]();_0x529fd7[_0xd6c1('0x69')](_0x257f4a[_0xd6c1('0x6a')]);for(var _0x7d2e54=0x0;_0x7d2e54<_0x320ee0['length'];_0x7d2e54+=0x1){_0x2bfaa6=_0x320ee0[_0x7d2e54][_0xd6c1('0x6b')]?_0x4256e0[_0x320ee0[_0x7d2e54]['MetricId']][_0xd6c1('0x6c')]:_0x320ee0[_0x7d2e54][_0xd6c1('0x60')];_0x2bfaa6=_0x320ee0[_0x7d2e54]['function']?_[_0xd6c1('0x6e')](_0x54fb63[_0x320ee0[_0x7d2e54][_0xd6c1('0x6d')]],'%s',_0x2bfaa6):_0x2bfaa6;_0x2bfaa6=_0x320ee0[_0x7d2e54][_0xd6c1('0x6f')]?_[_0xd6c1('0x6e')](_0x4b0b61[_0x320ee0[_0x7d2e54]['format']],'%s',_0x2bfaa6):_0x2bfaa6;if(_0x320ee0[_0x7d2e54]['groupBy']){_0x529fd7[_0xd6c1('0x71')](_0x2bfaa6);}_0x320ee0[_0x7d2e54][_0xd6c1('0x72')]&&_0x529fd7['order'](_0x2bfaa6,_0x320ee0[_0x7d2e54]['orderBy']==='DESC'?![]:!![]);_0x529fd7[_0xd6c1('0x60')](_0x2bfaa6,_0x320ee0[_0x7d2e54][_0xd6c1('0x85')]||_0x2bfaa6);}if(_0x257f4a[_0xd6c1('0x74')]){_0x257f4a[_0xd6c1('0x74')]=JSON['parse'](_0x257f4a['joins']);for(var _0x58af57=0x0;_0x58af57<_0x257f4a[_0xd6c1('0x74')][_0xd6c1('0x35')];_0x58af57+=0x1){if(_0x257f4a[_0xd6c1('0x74')][_0x58af57][_0xd6c1('0x3e')]&&_[_0xd6c1('0x5b')](_0x4b9029,_0x257f4a[_0xd6c1('0x74')][_0x58af57][_0xd6c1('0x3e')])&&_0x257f4a[_0xd6c1('0x74')][_0x58af57][_0xd6c1('0x76')]&&_0x257f4a['joins'][_0x58af57]['foreignTable']&&_0x257f4a['joins'][_0x58af57][_0xd6c1('0x78')]){_0x529fd7[_0x257f4a['joins'][_0x58af57]['type']](_0x257f4a[_0xd6c1('0x74')][_0x58af57][_0xd6c1('0x77')],null,util[_0xd6c1('0x6f')](_0xd6c1('0x79'),_0x257f4a[_0xd6c1('0x6a')],_0x257f4a[_0xd6c1('0x74')][_0x58af57][_0xd6c1('0x76')],_0x257f4a['joins'][_0x58af57][_0xd6c1('0x77')],_0x257f4a['joins'][_0x58af57][_0xd6c1('0x78')]));}}}if(_0x257f4a['conditions']){_0x257f4a[_0xd6c1('0x7a')]=JSON[_0xd6c1('0x75')](_0x257f4a[_0xd6c1('0x7a')]);_0x529fd7['where'](_0x39b974(_0x257f4a[_0xd6c1('0x7a')]['group']));}_0x4611a4=_0x529fd7[_0xd6c1('0x86')]();_0x529fd7[_0xd6c1('0x37')](_0x55033c);_0x529fd7[_0xd6c1('0x1d')](0x0);logger[_0xd6c1('0x7b')]('Limited\x20Query:',_0x529fd7['toString']());return dbH[_0xd6c1('0x7e')][_0xd6c1('0x2f')](_0x529fd7[_0xd6c1('0x7d')](),{'type':dbH[_0xd6c1('0x7e')][_0xd6c1('0x7f')][_0xd6c1('0x99')]});}})[_0xd6c1('0x25')](function(){return{'sql':_0x4611a4[_0xd6c1('0x7d')]()};})[_0xd6c1('0x25')](respondWithResult(_0x211d3d,null))['catch'](handleError(_0x211d3d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 050df8b..538f298 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 _0x57a9=['bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x30de86,_0x3f067c){var _0x84c896=function(_0x59c517){while(--_0x59c517){_0x30de86['push'](_0x30de86['shift']());}};_0x84c896(++_0x3f067c);}(_0x57a9,0x158));var _0x957a=function(_0xf92e67,_0x5de510){_0xf92e67=_0xf92e67-0x0;var _0x23438d=_0x57a9[_0xf92e67];return _0x23438d;};'use strict';var _=require(_0x957a('0x0'));var util=require(_0x957a('0x1'));var logger=require(_0x957a('0x2'))(_0x957a('0x3'));var moment=require('moment');var BPromise=require(_0x957a('0x4'));var rp=require(_0x957a('0x5'));var fs=require('fs');var path=require(_0x957a('0x6'));var rimraf=require('rimraf');var config=require(_0x957a('0x7'));var attributes=require(_0x957a('0x8'));module[_0x957a('0x9')]=function(_0x19417e,_0x2792b1){return _0x19417e[_0x957a('0xa')](_0x957a('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf44b=['api','moment','bluebird','request-promise','path','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x5a666a,_0x4b3a24){var _0x3800f1=function(_0x13c22f){while(--_0x13c22f){_0x5a666a['push'](_0x5a666a['shift']());}};_0x3800f1(++_0x4b3a24);}(_0xf44b,0x18c));var _0xbf44=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xf44b[_0x33fcbb];return _0x2efe40;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbf44('0x0'));var moment=require(_0xbf44('0x1'));var BPromise=require(_0xbf44('0x2'));var rp=require(_0xbf44('0x3'));var fs=require('fs');var path=require(_0xbf44('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf44('0x5'));module['exports']=function(_0x31cb34,_0x4b532d){return _0x31cb34[_0xbf44('0x6')](_0xbf44('0x7'),attributes,{'tableName':_0xbf44('0x8'),'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 8f8c8bf..7de3d3a 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 _0x05d0=['rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x05d0,0x1ad));var _0x005d=function(_0x381aea,_0x340970){_0x381aea=_0x381aea-0x0;var _0x29a7c3=_0x05d0[_0x381aea];return _0x29a7c3;};'use strict';var _=require(_0x005d('0x0'));var util=require(_0x005d('0x1'));var moment=require(_0x005d('0x2'));var BPromise=require('bluebird');var rs=require(_0x005d('0x3'));var fs=require('fs');var Redis=require(_0x005d('0x4'));var db=require(_0x005d('0x5'))['db'];var utils=require(_0x005d('0x6'));var logger=require(_0x005d('0x7'))(_0x005d('0x8'));var config=require(_0x005d('0x9'));var jayson=require(_0x005d('0xa'));var client=jayson[_0x005d('0xb')][_0x005d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aeabc,_0x4cf4bf,_0x14373f){return new BPromise(function(_0x50dee8,_0x25583b){return client['request'](_0x2aeabc,_0x14373f)['then'](function(_0x163c2b){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4cf4bf,_0x005d('0xd'));logger[_0x005d('0xe')](_0x005d('0xf'),_0x4cf4bf,_0x005d('0xd'),JSON[_0x005d('0x10')](_0x163c2b));if(_0x163c2b['error']){if(_0x163c2b[_0x005d('0x11')][_0x005d('0x12')]===0x1f4){logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x163c2b[_0x005d('0x11')][_0x005d('0x14')]);return _0x25583b(_0x163c2b[_0x005d('0x11')]['message']);}logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x163c2b['error'][_0x005d('0x14')]);return _0x50dee8(_0x163c2b[_0x005d('0x11')][_0x005d('0x14')]);}else{logger[_0x005d('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4cf4bf,'request\x20sent');_0x50dee8(_0x163c2b[_0x005d('0x16')]['message']);}})['catch'](function(_0x40793d){logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x40793d);_0x25583b(_0x40793d);});});} \ No newline at end of file +var _0x2ddc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5254a5,_0x682eaa){var _0x3a36b7=function(_0x54f40c){while(--_0x54f40c){_0x5254a5['push'](_0x5254a5['shift']());}};_0x3a36b7(++_0x682eaa);}(_0x2ddc,0x1b2));var _0xc2dd=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2ddc[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0xc2dd('0x0'));var moment=require(_0xc2dd('0x1'));var BPromise=require(_0xc2dd('0x2'));var rs=require(_0xc2dd('0x3'));var fs=require('fs');var Redis=require(_0xc2dd('0x4'));var db=require(_0xc2dd('0x5'))['db'];var utils=require(_0xc2dd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc2dd('0x7'));var jayson=require(_0xc2dd('0x8'));var client=jayson[_0xc2dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41b3b0,_0x2493fa,_0x1b2ada){return new BPromise(function(_0x35deef,_0x5f1e4c){return client[_0xc2dd('0xa')](_0x41b3b0,_0x1b2ada)[_0xc2dd('0xb')](function(_0x3a985f){logger['info'](_0xc2dd('0xc'),_0x2493fa,_0xc2dd('0xd'));logger[_0xc2dd('0xe')](_0xc2dd('0xf'),_0x2493fa,_0xc2dd('0xd'),JSON[_0xc2dd('0x10')](_0x3a985f));if(_0x3a985f[_0xc2dd('0x11')]){if(_0x3a985f['error'][_0xc2dd('0x12')]===0x1f4){logger[_0xc2dd('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2493fa,_0x3a985f[_0xc2dd('0x11')][_0xc2dd('0x13')]);return _0x5f1e4c(_0x3a985f[_0xc2dd('0x11')][_0xc2dd('0x13')]);}logger[_0xc2dd('0x11')](_0xc2dd('0xc'),_0x2493fa,_0x3a985f[_0xc2dd('0x11')]['message']);return _0x35deef(_0x3a985f['error']['message']);}else{logger[_0xc2dd('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2493fa,'request\x20sent');_0x35deef(_0x3a985f[_0xc2dd('0x15')][_0xc2dd('0x13')]);}})[_0xc2dd('0x16')](function(_0x55c520){logger[_0xc2dd('0x11')](_0xc2dd('0xc'),_0x2493fa,_0x55c520);_0x5f1e4c(_0x55c520);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 767c688..72eebf8 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 _0xd753=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','multer'];(function(_0x298bf2,_0x183093){var _0x39d076=function(_0xcb9356){while(--_0xcb9356){_0x298bf2['push'](_0x298bf2['shift']());}};_0x39d076(++_0x183093);}(_0xd753,0x137));var _0x3d75=function(_0x3f645e,_0x14b15b){_0x3f645e=_0x3f645e-0x0;var _0x277d67=_0xd753[_0x3f645e];return _0x277d67;};'use strict';var multer=require(_0x3d75('0x0'));var util=require(_0x3d75('0x1'));var path=require('path');var timeout=require(_0x3d75('0x2'));var express=require(_0x3d75('0x3'));var router=express[_0x3d75('0x4')]();var fs_extra=require(_0x3d75('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d75('0x6'));var config=require(_0x3d75('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x3d75('0x8')]('/',auth[_0x3d75('0x9')](),controller[_0x3d75('0xa')]);router[_0x3d75('0x8')](_0x3d75('0xb'),auth['isAuthenticated'](),controller[_0x3d75('0xc')]);router[_0x3d75('0x8')](_0x3d75('0xd'),auth[_0x3d75('0x9')](),controller['preview']);router['get'](_0x3d75('0xe'),auth[_0x3d75('0x9')](),controller[_0x3d75('0xf')]);router[_0x3d75('0x8')](_0x3d75('0x10'),auth[_0x3d75('0x9')](),controller[_0x3d75('0x11')]);router[_0x3d75('0x12')]('/',auth['isAuthenticated'](),controller[_0x3d75('0x13')]);router[_0x3d75('0x14')]('/:id',auth[_0x3d75('0x9')](),controller[_0x3d75('0x15')]);router[_0x3d75('0x16')](_0x3d75('0xb'),auth[_0x3d75('0x9')](),controller['destroy']);module[_0x3d75('0x17')]=router; \ No newline at end of file +var _0x554f=['preview','run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x2a24d9,_0xa1323d){var _0x640a7d=function(_0x237a56){while(--_0x237a56){_0x2a24d9['push'](_0x2a24d9['shift']());}};_0x640a7d(++_0xa1323d);}(_0x554f,0x170));var _0xf554=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x554f[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0xf554('0x0'));var util=require(_0xf554('0x1'));var path=require(_0xf554('0x2'));var timeout=require(_0xf554('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf554('0x4'));var auth=require(_0xf554('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf554('0x6'));var controller=require(_0xf554('0x7'));router[_0xf554('0x8')]('/',auth[_0xf554('0x9')](),controller[_0xf554('0xa')]);router[_0xf554('0x8')](_0xf554('0xb'),auth[_0xf554('0x9')](),controller['show']);router[_0xf554('0x8')]('/:id/preview',auth[_0xf554('0x9')](),controller[_0xf554('0xc')]);router['get']('/:id/run',auth[_0xf554('0x9')](),controller[_0xf554('0xd')]);router[_0xf554('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0xf554('0xe')]('/',auth[_0xf554('0x9')](),controller[_0xf554('0xf')]);router[_0xf554('0x10')](_0xf554('0xb'),auth[_0xf554('0x9')](),controller[_0xf554('0x11')]);router[_0xf554('0x12')](_0xf554('0xb'),auth[_0xf554('0x9')](),controller['destroy']);module[_0xf554('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index bf7ccc1..857b8be 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x4417e2,_0x4d53b1){var _0x58b483=function(_0x1857be){while(--_0x1857be){_0x4417e2['push'](_0x4417e2['shift']());}};_0x58b483(++_0x4d53b1);}(_0x814b,0x1a2));var _0xb814=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0x814b[_0x9a7ea6];return _0x1c2040;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x23f3e6,_0x18df9d){var _0x5e9bc4=function(_0x431195){while(--_0x431195){_0x23f3e6['push'](_0x23f3e6['shift']());}};_0x5e9bc4(++_0x18df9d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x270cac,_0x2be790){_0x270cac=_0x270cac-0x0;var _0x4fe8ae=_0x9c5a[_0x270cac];return _0x4fe8ae;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5988d08..8a77aae 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x426f3a,_0x3ad8bb){var _0x1f01b3=function(_0x2b96e4){while(--_0x2b96e4){_0x426f3a['push'](_0x426f3a['shift']());}};_0x1f01b3(++_0x3ad8bb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5408c9,_0x19f8e7){_0x5408c9=_0x5408c9-0x0;var _0x4512df=_0x3f8a[_0x5408c9];return _0x4512df;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +var _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x32d466,_0x80b652){var _0x2256a8=function(_0x445dda){while(--_0x445dda){_0x32d466['push'](_0x32d466['shift']());}};_0x2256a8(++_0x80b652);}(_0x814b,0x1a2));var _0xb814=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x814b[_0x2891d1];return _0x486948;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 258c62c..0f7ee20 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 _0x8e2e=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x307008,_0x5344cf){var _0x41c656=function(_0x4e4c2a){while(--_0x4e4c2a){_0x307008['push'](_0x307008['shift']());}};_0x41c656(++_0x5344cf);}(_0x8e2e,0x172));var _0xe8e2=function(_0x105c50,_0x29ba3e){_0x105c50=_0x105c50-0x0;var _0x570327=_0x8e2e[_0x105c50];return _0x570327;};'use strict';var _=require(_0xe8e2('0x0'));var util=require(_0xe8e2('0x1'));var logger=require(_0xe8e2('0x2'))(_0xe8e2('0x3'));var moment=require('moment');var BPromise=require(_0xe8e2('0x4'));var rp=require(_0xe8e2('0x5'));var fs=require('fs');var path=require(_0xe8e2('0x6'));var rimraf=require(_0xe8e2('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xe8e2('0x8')]=function(_0x2b5a2d,_0x18480f){return _0x2b5a2d[_0xe8e2('0x9')](_0xe8e2('0xa'),attributes,{'tableName':_0xe8e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ae7=['AnalyticDefaultReport','lodash','api','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0x22c5e3,_0x226ea1){var _0x313bfd=function(_0xc47f0f){while(--_0xc47f0f){_0x22c5e3['push'](_0x22c5e3['shift']());}};_0x313bfd(++_0x226ea1);}(_0x3ae7,0x15f));var _0x73ae=function(_0x386292,_0x7e5d9a){_0x386292=_0x386292-0x0;var _0x2522e8=_0x3ae7[_0x386292];return _0x2522e8;};'use strict';var _=require(_0x73ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x73ae('0x1'));var moment=require('moment');var BPromise=require(_0x73ae('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ae('0x3'));var rimraf=require(_0x73ae('0x4'));var config=require(_0x73ae('0x5'));var attributes=require(_0x73ae('0x6'));module[_0x73ae('0x7')]=function(_0x42ecc9,_0xd2190d){return _0x42ecc9[_0x73ae('0x8')](_0x73ae('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4970ba0..443dbde 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 _0x2318=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x52ce8b,_0x51a3c1){var _0x5a7e57=function(_0x54f3d2){while(--_0x54f3d2){_0x52ce8b['push'](_0x52ce8b['shift']());}};_0x5a7e57(++_0x51a3c1);}(_0x2318,0x103));var _0x8231=function(_0x27d7ca,_0x111288){_0x27d7ca=_0x27d7ca-0x0;var _0x10f817=_0x2318[_0x27d7ca];return _0x10f817;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var moment=require(_0x8231('0x2'));var BPromise=require(_0x8231('0x3'));var rs=require(_0x8231('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8231('0x5'))['db'];var utils=require(_0x8231('0x6'));var logger=require(_0x8231('0x7'))('rpc');var config=require(_0x8231('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8231('0x9')][_0x8231('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba3a9c,_0x29fe0b,_0x3fec98){return new BPromise(function(_0x2f6512,_0x454324){return client[_0x8231('0xb')](_0xba3a9c,_0x3fec98)[_0x8231('0xc')](function(_0x28a7fa){logger[_0x8231('0xd')](_0x8231('0xe'),_0x29fe0b,_0x8231('0xf'));logger[_0x8231('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x29fe0b,_0x8231('0xf'),JSON[_0x8231('0x11')](_0x28a7fa));if(_0x28a7fa[_0x8231('0x12')]){if(_0x28a7fa['error'][_0x8231('0x13')]===0x1f4){logger['error'](_0x8231('0xe'),_0x29fe0b,_0x28a7fa[_0x8231('0x12')]['message']);return _0x454324(_0x28a7fa[_0x8231('0x12')][_0x8231('0x14')]);}logger['error'](_0x8231('0xe'),_0x29fe0b,_0x28a7fa['error']['message']);return _0x2f6512(_0x28a7fa[_0x8231('0x12')][_0x8231('0x14')]);}else{logger[_0x8231('0xd')](_0x8231('0xe'),_0x29fe0b,_0x8231('0xf'));_0x2f6512(_0x28a7fa['result'][_0x8231('0x14')]);}})['catch'](function(_0x11a519){logger[_0x8231('0x12')](_0x8231('0xe'),_0x29fe0b,_0x11a519);_0x454324(_0x11a519);});});} \ No newline at end of file +var _0xd911=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','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','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd911,0x18d));var _0x1d91=function(_0x22df4d,_0xa4790a){_0x22df4d=_0x22df4d-0x0;var _0x6a2020=_0xd911[_0x22df4d];return _0x6a2020;};'use strict';var _=require('lodash');var util=require(_0x1d91('0x0'));var moment=require(_0x1d91('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d91('0x2'));var db=require(_0x1d91('0x3'))['db'];var utils=require(_0x1d91('0x4'));var logger=require(_0x1d91('0x5'))(_0x1d91('0x6'));var config=require(_0x1d91('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38a302,_0x1857b1,_0x4d90f9){return new BPromise(function(_0x535af5,_0x3ceb7f){return client[_0x1d91('0x8')](_0x38a302,_0x4d90f9)[_0x1d91('0x9')](function(_0x279ad4){logger[_0x1d91('0xa')](_0x1d91('0xb'),_0x1857b1,_0x1d91('0xc'));logger[_0x1d91('0xd')](_0x1d91('0xe'),_0x1857b1,_0x1d91('0xc'),JSON[_0x1d91('0xf')](_0x279ad4));if(_0x279ad4[_0x1d91('0x10')]){if(_0x279ad4[_0x1d91('0x10')]['code']===0x1f4){logger[_0x1d91('0x10')](_0x1d91('0xb'),_0x1857b1,_0x279ad4[_0x1d91('0x10')][_0x1d91('0x11')]);return _0x3ceb7f(_0x279ad4[_0x1d91('0x10')][_0x1d91('0x11')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1857b1,_0x279ad4['error'][_0x1d91('0x11')]);return _0x535af5(_0x279ad4[_0x1d91('0x10')][_0x1d91('0x11')]);}else{logger['info'](_0x1d91('0xb'),_0x1857b1,'request\x20sent');_0x535af5(_0x279ad4[_0x1d91('0x12')][_0x1d91('0x11')]);}})[_0x1d91('0x13')](function(_0x3059d8){logger[_0x1d91('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1857b1,_0x3059d8);_0x3ceb7f(_0x3059d8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dc2eac2..677fc73 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 _0x13c6=['isAuthenticated','preview','/:id/run','/:id/query','query','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/preview'];(function(_0x2258c3,_0x38fa00){var _0x84c586=function(_0x130a2b){while(--_0x130a2b){_0x2258c3['push'](_0x2258c3['shift']());}};_0x84c586(++_0x38fa00);}(_0x13c6,0xb2));var _0x613c=function(_0x52338b,_0x295a6c){_0x52338b=_0x52338b-0x0;var _0x546138=_0x13c6[_0x52338b];return _0x546138;};'use strict';var multer=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var path=require(_0x613c('0x2'));var timeout=require(_0x613c('0x3'));var express=require(_0x613c('0x4'));var router=express[_0x613c('0x5')]();var fs_extra=require(_0x613c('0x6'));var auth=require(_0x613c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x613c('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x613c('0x9')]('/',auth['isAuthenticated'](),controller[_0x613c('0xa')]);router[_0x613c('0x9')](_0x613c('0xb'),auth['isAuthenticated'](),controller[_0x613c('0xc')]);router[_0x613c('0x9')](_0x613c('0xd'),auth[_0x613c('0xe')](),controller[_0x613c('0xf')]);router[_0x613c('0x9')](_0x613c('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x613c('0x9')](_0x613c('0x11'),auth[_0x613c('0xe')](),controller[_0x613c('0x12')]);router[_0x613c('0x13')]('/',auth['isAuthenticated'](),controller[_0x613c('0x14')]);router['put'](_0x613c('0xb'),auth[_0x613c('0xe')](),controller[_0x613c('0x15')]);router[_0x613c('0x16')](_0x613c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x613c('0x17')]=router; \ No newline at end of file +var _0xfaf6=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x23960f,_0x337d10){var _0x4157df=function(_0x1d3bd4){while(--_0x1d3bd4){_0x23960f['push'](_0x23960f['shift']());}};_0x4157df(++_0x337d10);}(_0xfaf6,0xcd));var _0x6faf=function(_0x4ab9de,_0x3bdf1a){_0x4ab9de=_0x4ab9de-0x0;var _0x516c92=_0xfaf6[_0x4ab9de];return _0x516c92;};'use strict';var multer=require('multer');var util=require(_0x6faf('0x0'));var path=require(_0x6faf('0x1'));var timeout=require(_0x6faf('0x2'));var express=require(_0x6faf('0x3'));var router=express[_0x6faf('0x4')]();var fs_extra=require(_0x6faf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6faf('0x6'));var config=require(_0x6faf('0x7'));var controller=require(_0x6faf('0x8'));router[_0x6faf('0x9')]('/',auth[_0x6faf('0xa')](),controller[_0x6faf('0xb')]);router['get'](_0x6faf('0xc'),auth[_0x6faf('0xa')](),controller[_0x6faf('0xd')]);router[_0x6faf('0x9')](_0x6faf('0xe'),auth['isAuthenticated'](),controller[_0x6faf('0xf')]);router[_0x6faf('0x9')](_0x6faf('0x10'),auth[_0x6faf('0xa')](),controller[_0x6faf('0x11')]);router[_0x6faf('0x9')](_0x6faf('0x12'),auth[_0x6faf('0xa')](),controller['query']);router[_0x6faf('0x13')]('/',auth[_0x6faf('0xa')](),controller['create']);router[_0x6faf('0x14')](_0x6faf('0xc'),auth[_0x6faf('0xa')](),controller[_0x6faf('0x15')]);router[_0x6faf('0x16')](_0x6faf('0xc'),auth[_0x6faf('0xa')](),controller[_0x6faf('0x17')]);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 e9632ec..6cd2d0b 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 _0x6edd=['DATE','ENUM','manual','UNSIGNED','exports','STRING','csv'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x6edd,0x177));var _0xd6ed=function(_0x97abee,_0x2f7f31){_0x97abee=_0x97abee-0x0;var _0x4c734e=_0x6edd[_0x97abee];return _0x4c734e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd6ed('0x0')]={'name':{'type':Sequelize[_0xd6ed('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd6ed('0x2'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xd6ed('0x2')},'savename':{'type':Sequelize[_0xd6ed('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd6ed('0x3')]},'endDate':{'type':Sequelize[_0xd6ed('0x3')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd6ed('0x4')](_0xd6ed('0x5'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xd6ed('0x6')]},'reportType':{'type':Sequelize[_0xd6ed('0x1')]}}; \ No newline at end of file +var _0x1391=['Loading','manual','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE'];(function(_0x4216cb,_0x189803){var _0xf72da2=function(_0x2cd181){while(--_0x2cd181){_0x4216cb['push'](_0x4216cb['shift']());}};_0xf72da2(++_0x189803);}(_0x1391,0x7b));var _0x1139=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x1391[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x1139('0x0'));var moment=require(_0x1139('0x1'));module[_0x1139('0x2')]={'name':{'type':Sequelize[_0x1139('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1139('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x1139('0x4')]('csv',_0x1139('0x5'),_0x1139('0x6')),'allowNull':![],'defaultValue':_0x1139('0x7')},'savename':{'type':Sequelize[_0x1139('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1139('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x1139('0x3')],'defaultValue':_0x1139('0x9')},'type':{'type':Sequelize[_0x1139('0x4')](_0x1139('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x1139('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'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 baa49e7..fe9987e 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 _0x6517=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','root','server/files/reports','savename','Sequelize','exists','download','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports'];(function(_0x59b229,_0x17f45b){var _0x4cf6a5=function(_0x391efa){while(--_0x391efa){_0x59b229['push'](_0x59b229['shift']());}};_0x4cf6a5(++_0x17f45b);}(_0x6517,0xca));var _0x7651=function(_0x4b49e7,_0x141f78){_0x4b49e7=_0x4b49e7-0x0;var _0x156258=_0x6517[_0x4b49e7];return _0x156258;};'use strict';var emlformat=require(_0x7651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7651('0x1'));var jsonpatch=require(_0x7651('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7651('0x3'));var Mustache=require('mustache');var util=require(_0x7651('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7651('0x5'));var ejs=require(_0x7651('0x6'));var fs=require('fs');var fs_extra=require(_0x7651('0x7'));var _=require(_0x7651('0x8'));var squel=require(_0x7651('0x9'));var crypto=require(_0x7651('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7651('0xb'));var toCsv=require(_0x7651('0x5'));var querystring=require(_0x7651('0xc'));var Papa=require(_0x7651('0xd'));var Redis=require(_0x7651('0xe'));var authService=require(_0x7651('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7651('0x10'));var hardwareService=require(_0x7651('0x11'));var logger=require('../../config/logger')(_0x7651('0x12'));var utils=require('../../config/utils');var config=require(_0x7651('0x13'));var licenseUtil=require(_0x7651('0x14'));var db=require(_0x7651('0x15'))['db'];function respondWithStatusCode(_0x5985de,_0x4a50bb){_0x4a50bb=_0x4a50bb||0xcc;return function(_0x2d7036){if(_0x2d7036){return _0x5985de[_0x7651('0x16')](_0x4a50bb);}return _0x5985de[_0x7651('0x17')](_0x4a50bb)[_0x7651('0x18')]();};}function respondWithResult(_0x1518d1,_0xa2913f){_0xa2913f=_0xa2913f||0xc8;return function(_0x1f1472){if(_0x1f1472){return _0x1518d1[_0x7651('0x17')](_0xa2913f)[_0x7651('0x19')](_0x1f1472);}};}function respondWithFilteredResult(_0x30f8bc,_0x33b0b7){return function(_0x467d5c){if(_0x467d5c){var _0x330d68=typeof _0x33b0b7[_0x7651('0x1a')]===_0x7651('0x1b')&&typeof _0x33b0b7[_0x7651('0x1c')]===_0x7651('0x1b');var _0x5a22b4=_0x467d5c[_0x7651('0x1d')];var _0x4c933f=_0x330d68?0x0:_0x33b0b7['offset'];var _0x44965d=_0x330d68?_0x467d5c[_0x7651('0x1d')]:_0x33b0b7['offset']+_0x33b0b7[_0x7651('0x1c')];var _0x58a3cb;if(_0x44965d>=_0x5a22b4){_0x44965d=_0x5a22b4;_0x58a3cb=0xc8;}else{_0x58a3cb=0xce;}_0x30f8bc[_0x7651('0x17')](_0x58a3cb);return _0x30f8bc['set'](_0x7651('0x1e'),_0x4c933f+'-'+_0x44965d+'/'+_0x5a22b4)[_0x7651('0x19')](_0x467d5c);}return null;};}function patchUpdates(_0x23b692){return function(_0x4835df){try{jsonpatch[_0x7651('0x1f')](_0x4835df,_0x23b692,!![]);}catch(_0x56afee){return BPromise[_0x7651('0x20')](_0x56afee);}return _0x4835df[_0x7651('0x21')]();};}function saveUpdates(_0x2eb5da,_0x59785e){return function(_0x12a667){if(_0x12a667){return _0x12a667[_0x7651('0x22')](_0x2eb5da)[_0x7651('0x23')](function(_0x584056){return _0x584056;});}return null;};}function removeEntity(_0x7a4c4b,_0x220482){return function(_0x5caef8){if(_0x5caef8){return _0x5caef8[_0x7651('0x24')]()[_0x7651('0x23')](function(){var _0x3d2d9a=_0x5caef8[_0x7651('0x25')]({'plain':!![]});var _0x14e071='ExtractedReports';return db[_0x7651('0x26')]['destroy']({'where':{'type':_0x14e071,'resourceId':_0x3d2d9a['id']}})['then'](function(){return _0x5caef8;});})[_0x7651('0x23')](function(){_0x7a4c4b['status'](0xcc)[_0x7651('0x18')]();});}};}function handleEntityNotFound(_0x5549de,_0x748c1c){return function(_0x44b0c1){if(!_0x44b0c1){_0x5549de['sendStatus'](0x194);}return _0x44b0c1;};}function handleError(_0x1a9c20,_0x22f9aa){_0x22f9aa=_0x22f9aa||0x1f4;return function(_0x451595){logger[_0x7651('0x27')](_0x451595[_0x7651('0x28')]);if(_0x451595[_0x7651('0x29')]){delete _0x451595[_0x7651('0x29')];}_0x1a9c20[_0x7651('0x17')](_0x22f9aa)[_0x7651('0x2a')](_0x451595);};}exports[_0x7651('0x2b')]=function(_0x36d189,_0x4b6d6b){var _0x413cc5={},_0x1b61b3={},_0x28ed85={'count':0x0,'rows':[]};var _0x5715a3=_[_0x7651('0x2c')](db[_0x7651('0x2d')][_0x7651('0x2e')],function(_0x272307){return{'name':_0x272307[_0x7651('0x2f')],'type':_0x272307['type']['key']};});_0x1b61b3[_0x7651('0x30')]=_[_0x7651('0x2c')](_0x5715a3,_0x7651('0x29'));_0x1b61b3[_0x7651('0x31')]=_['keys'](_0x36d189[_0x7651('0x31')]);_0x1b61b3[_0x7651('0x32')]=_[_0x7651('0x33')](_0x1b61b3[_0x7651('0x30')],_0x1b61b3[_0x7651('0x31')]);_0x413cc5[_0x7651('0x34')]=_['intersection'](_0x1b61b3[_0x7651('0x30')],qs[_0x7651('0x35')](_0x36d189['query'][_0x7651('0x35')]));_0x413cc5['attributes']=_0x413cc5[_0x7651('0x34')][_0x7651('0x36')]?_0x413cc5[_0x7651('0x34')]:_0x1b61b3[_0x7651('0x30')];if(!_0x36d189[_0x7651('0x31')][_0x7651('0x37')](_0x7651('0x38'))){_0x413cc5[_0x7651('0x1c')]=qs[_0x7651('0x1c')](_0x36d189[_0x7651('0x31')][_0x7651('0x1c')]);_0x413cc5[_0x7651('0x1a')]=qs[_0x7651('0x1a')](_0x36d189[_0x7651('0x31')][_0x7651('0x1a')]);}_0x413cc5['order']=qs[_0x7651('0x39')](_0x36d189['query'][_0x7651('0x39')]);_0x413cc5[_0x7651('0x3a')]=qs['filters'](_['pick'](_0x36d189[_0x7651('0x31')],_0x1b61b3[_0x7651('0x32')]),_0x5715a3);if(_0x36d189[_0x7651('0x31')][_0x7651('0x3b')]){_0x413cc5[_0x7651('0x3a')]=_['merge'](_0x413cc5[_0x7651('0x3a')],{'$or':_['map'](_0x5715a3,function(_0x21de96){if(_0x21de96[_0x7651('0x3c')]!==_0x7651('0x3d')){var _0xf3f1c5={};_0xf3f1c5[_0x21de96[_0x7651('0x29')]]={'$like':'%'+_0x36d189[_0x7651('0x31')][_0x7651('0x3b')]+'%'};return _0xf3f1c5;}})});}_0x413cc5=_['merge']({},_0x413cc5,_0x36d189[_0x7651('0x3e')]);var _0xcb08c2={'where':_0x413cc5[_0x7651('0x3a')]};return db[_0x7651('0x2d')][_0x7651('0x1d')](_0xcb08c2)[_0x7651('0x23')](function(_0x6c21fd){_0x28ed85['count']=_0x6c21fd;if(_0x36d189['query'][_0x7651('0x3f')]){_0x413cc5[_0x7651('0x40')]=[{'all':!![]}];}return db[_0x7651('0x2d')][_0x7651('0x41')](_0x413cc5);})[_0x7651('0x23')](function(_0x52138e){_0x28ed85[_0x7651('0x42')]=_0x52138e;return _0x28ed85;})['then'](respondWithFilteredResult(_0x4b6d6b,_0x413cc5))[_0x7651('0x43')](handleError(_0x4b6d6b,null));};exports['show']=function(_0x1e4432,_0x1ca909){var _0x3c1c81={'raw':!![],'where':{'id':_0x1e4432[_0x7651('0x44')]['id']}},_0x3f19b9={};_0x3f19b9[_0x7651('0x30')]=_[_0x7651('0x45')](db[_0x7651('0x2d')]['rawAttributes']);_0x3f19b9['query']=_[_0x7651('0x45')](_0x1e4432[_0x7651('0x31')]);_0x3f19b9[_0x7651('0x32')]=_[_0x7651('0x33')](_0x3f19b9[_0x7651('0x30')],_0x3f19b9[_0x7651('0x31')]);_0x3c1c81[_0x7651('0x34')]=_[_0x7651('0x33')](_0x3f19b9['model'],qs[_0x7651('0x35')](_0x1e4432['query'][_0x7651('0x35')]));_0x3c1c81['attributes']=_0x3c1c81[_0x7651('0x34')][_0x7651('0x36')]?_0x3c1c81[_0x7651('0x34')]:_0x3f19b9['model'];if(_0x1e4432['query'][_0x7651('0x3f')]){_0x3c1c81['include']=[{'all':!![]}];}_0x3c1c81=_['merge']({},_0x3c1c81,_0x1e4432[_0x7651('0x3e')]);return db['AnalyticExtractedReport'][_0x7651('0x46')](_0x3c1c81)[_0x7651('0x23')](handleEntityNotFound(_0x1ca909,null))[_0x7651('0x23')](respondWithResult(_0x1ca909,null))[_0x7651('0x43')](handleError(_0x1ca909,null));};exports['create']=function(_0x336d42,_0x4fdc9f){return db['AnalyticExtractedReport'][_0x7651('0x47')](_0x336d42[_0x7651('0x48')],{})['then'](function(_0x41160b){var _0x41cad6=_0x336d42[_0x7651('0x49')][_0x7651('0x25')]({'plain':!![]});if(!_0x41cad6)throw new Error(_0x7651('0x4a'));if(_0x41cad6[_0x7651('0x4b')]===_0x7651('0x49')){var _0x26ef0f=_0x41160b[_0x7651('0x25')]({'plain':!![]});var _0x3c3072=_0x7651('0x4c');return db[_0x7651('0x4d')]['find']({'where':{'name':_0x3c3072,'userProfileId':_0x41cad6[_0x7651('0x4e')]},'raw':!![]})[_0x7651('0x23')](function(_0x165ea4){if(_0x165ea4&&_0x165ea4[_0x7651('0x4f')]===0x0){return db['UserProfileResource'][_0x7651('0x47')]({'name':_0x26ef0f['name'],'resourceId':_0x26ef0f['id'],'type':_0x165ea4[_0x7651('0x29')],'sectionId':_0x165ea4['id']},{})[_0x7651('0x23')](function(){return _0x41160b;});}else{return _0x41160b;}})['catch'](function(_0x543b5d){logger[_0x7651('0x27')](_0x7651('0x50'),_0x543b5d);throw _0x543b5d;});}return _0x41160b;})[_0x7651('0x23')](respondWithResult(_0x4fdc9f,0xc9))[_0x7651('0x43')](handleError(_0x4fdc9f,null));};exports[_0x7651('0x22')]=function(_0x4b9feb,_0x523bb3){if(_0x4b9feb[_0x7651('0x48')]['id']){delete _0x4b9feb[_0x7651('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x7651('0x46')]({'where':{'id':_0x4b9feb[_0x7651('0x44')]['id']}})[_0x7651('0x23')](handleEntityNotFound(_0x523bb3,null))[_0x7651('0x23')](saveUpdates(_0x4b9feb[_0x7651('0x48')],null))[_0x7651('0x23')](respondWithResult(_0x523bb3,null))[_0x7651('0x43')](handleError(_0x523bb3,null));};exports[_0x7651('0x24')]=function(_0x3d87b8,_0x12289a){return db[_0x7651('0x2d')][_0x7651('0x46')]({'where':{'id':_0x3d87b8[_0x7651('0x44')]['id']}})['then'](handleEntityNotFound(_0x12289a,null))[_0x7651('0x23')](removeEntity(_0x12289a,null))[_0x7651('0x43')](handleError(_0x12289a,null));};exports['download']=function(_0x2234aa,_0x340ef9,_0x396deb){return db[_0x7651('0x2d')][_0x7651('0x46')]({'where':{'id':_0x2234aa[_0x7651('0x44')]['id']},'attributes':[_0x7651('0x29'),_0x7651('0x51'),'savename',_0x7651('0x52')],'raw':!![]})[_0x7651('0x23')](handleEntityNotFound(_0x340ef9,null))['then'](function(_0x31c976){if(_0x31c976){if(!fs[_0x7651('0x53')](path['join'](config[_0x7651('0x54')],_0x7651('0x55'),_0x31c976[_0x7651('0x56')]))){throw new db[(_0x7651('0x57'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x2234aa['query'][_0x7651('0x58')]){return _0x340ef9[_0x7651('0x16')](0xc8);}return _0x340ef9[_0x7651('0x59')](path['join'](config[_0x7651('0x54')],'server/files/reports',_0x31c976['savename']),util[_0x7651('0x5a')](_0x7651('0x5b'),_0x31c976[_0x7651('0x51')]||_0x31c976[_0x7651('0x29')],_0x31c976['output'][_0x7651('0x5c')]()));}})[_0x7651('0x43')](handleError(_0x340ef9,null));}; \ No newline at end of file +var _0x9564=['basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','map','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','AnalyticExtractedReport','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','download'];(function(_0x44c301,_0x511f7a){var _0x549043=function(_0x4db677){while(--_0x4db677){_0x44c301['push'](_0x44c301['shift']());}};_0x549043(++_0x511f7a);}(_0x9564,0x1ca));var _0x4956=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0x9564[_0x33f2fa];return _0xe5b3b3;};'use strict';var emlformat=require(_0x4956('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4956('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4956('0x2'));var moment=require('moment');var BPromise=require(_0x4956('0x3'));var Mustache=require(_0x4956('0x4'));var util=require(_0x4956('0x5'));var path=require('path');var sox=require(_0x4956('0x6'));var csv=require('to-csv');var ejs=require(_0x4956('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4956('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x4956('0x9'));var toCsv=require(_0x4956('0xa'));var querystring=require(_0x4956('0xb'));var Papa=require(_0x4956('0xc'));var Redis=require('ioredis');var authService=require(_0x4956('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4956('0xe'));var logger=require(_0x4956('0xf'))(_0x4956('0x10'));var utils=require(_0x4956('0x11'));var config=require(_0x4956('0x12'));var licenseUtil=require(_0x4956('0x13'));var db=require(_0x4956('0x14'))['db'];function respondWithStatusCode(_0x66123e,_0x488bbb){_0x488bbb=_0x488bbb||0xcc;return function(_0x3ca588){if(_0x3ca588){return _0x66123e['sendStatus'](_0x488bbb);}return _0x66123e[_0x4956('0x15')](_0x488bbb)['end']();};}function respondWithResult(_0x214a7c,_0x170e7f){_0x170e7f=_0x170e7f||0xc8;return function(_0x1854a3){if(_0x1854a3){return _0x214a7c[_0x4956('0x15')](_0x170e7f)[_0x4956('0x16')](_0x1854a3);}};}function respondWithFilteredResult(_0x1e01e8,_0x3787fb){return function(_0x2a4719){if(_0x2a4719){var _0x283e57=typeof _0x3787fb[_0x4956('0x17')]===_0x4956('0x18')&&typeof _0x3787fb['limit']===_0x4956('0x18');var _0x88a0d5=_0x2a4719['count'];var _0x6acf3=_0x283e57?0x0:_0x3787fb['offset'];var _0x14a193=_0x283e57?_0x2a4719[_0x4956('0x19')]:_0x3787fb[_0x4956('0x17')]+_0x3787fb[_0x4956('0x1a')];var _0x600a4a;if(_0x14a193>=_0x88a0d5){_0x14a193=_0x88a0d5;_0x600a4a=0xc8;}else{_0x600a4a=0xce;}_0x1e01e8[_0x4956('0x15')](_0x600a4a);return _0x1e01e8[_0x4956('0x1b')](_0x4956('0x1c'),_0x6acf3+'-'+_0x14a193+'/'+_0x88a0d5)['json'](_0x2a4719);}return null;};}function patchUpdates(_0x398c04){return function(_0x4708ec){try{jsonpatch[_0x4956('0x1d')](_0x4708ec,_0x398c04,!![]);}catch(_0x2a0a0e){return BPromise['reject'](_0x2a0a0e);}return _0x4708ec[_0x4956('0x1e')]();};}function saveUpdates(_0x3de3cf,_0x54a77e){return function(_0x5f1aad){if(_0x5f1aad){return _0x5f1aad[_0x4956('0x1f')](_0x3de3cf)[_0x4956('0x20')](function(_0x284aee){return _0x284aee;});}return null;};}function removeEntity(_0x18612c,_0x219b54){return function(_0x5ea15d){if(_0x5ea15d){return _0x5ea15d[_0x4956('0x21')]()[_0x4956('0x20')](function(){var _0x5b1543=_0x5ea15d[_0x4956('0x22')]({'plain':!![]});var _0x5b8cc5=_0x4956('0x23');return db[_0x4956('0x24')]['destroy']({'where':{'type':_0x5b8cc5,'resourceId':_0x5b1543['id']}})['then'](function(){return _0x5ea15d;});})[_0x4956('0x20')](function(){_0x18612c[_0x4956('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f564,_0x3ed9bc){return function(_0x53b643){if(!_0x53b643){_0x49f564[_0x4956('0x25')](0x194);}return _0x53b643;};}function handleError(_0x1a44eb,_0x5bb4b3){_0x5bb4b3=_0x5bb4b3||0x1f4;return function(_0x126252){logger[_0x4956('0x26')](_0x126252[_0x4956('0x27')]);if(_0x126252[_0x4956('0x28')]){delete _0x126252[_0x4956('0x28')];}_0x1a44eb[_0x4956('0x15')](_0x5bb4b3)[_0x4956('0x29')](_0x126252);};}exports['index']=function(_0x2371f1,_0x465da2){var _0x3de0fb={},_0x2cc546={},_0x927481={'count':0x0,'rows':[]};var _0x3b81e8=_[_0x4956('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x5c8913){return{'name':_0x5c8913['fieldName'],'type':_0x5c8913[_0x4956('0x2b')]['key']};});_0x2cc546[_0x4956('0x2c')]=_['map'](_0x3b81e8,_0x4956('0x28'));_0x2cc546[_0x4956('0x2d')]=_[_0x4956('0x2e')](_0x2371f1['query']);_0x2cc546[_0x4956('0x2f')]=_['intersection'](_0x2cc546['model'],_0x2cc546[_0x4956('0x2d')]);_0x3de0fb[_0x4956('0x30')]=_['intersection'](_0x2cc546[_0x4956('0x2c')],qs[_0x4956('0x31')](_0x2371f1[_0x4956('0x2d')][_0x4956('0x31')]));_0x3de0fb['attributes']=_0x3de0fb[_0x4956('0x30')][_0x4956('0x32')]?_0x3de0fb[_0x4956('0x30')]:_0x2cc546['model'];if(!_0x2371f1[_0x4956('0x2d')][_0x4956('0x33')](_0x4956('0x34'))){_0x3de0fb[_0x4956('0x1a')]=qs['limit'](_0x2371f1[_0x4956('0x2d')]['limit']);_0x3de0fb['offset']=qs[_0x4956('0x17')](_0x2371f1[_0x4956('0x2d')][_0x4956('0x17')]);}_0x3de0fb['order']=qs[_0x4956('0x35')](_0x2371f1[_0x4956('0x2d')][_0x4956('0x35')]);_0x3de0fb[_0x4956('0x36')]=qs[_0x4956('0x2f')](_[_0x4956('0x37')](_0x2371f1[_0x4956('0x2d')],_0x2cc546[_0x4956('0x2f')]),_0x3b81e8);if(_0x2371f1[_0x4956('0x2d')][_0x4956('0x38')]){_0x3de0fb['where']=_[_0x4956('0x39')](_0x3de0fb['where'],{'$or':_['map'](_0x3b81e8,function(_0x10bd18){if(_0x10bd18[_0x4956('0x2b')]!==_0x4956('0x3a')){var _0x32b95e={};_0x32b95e[_0x10bd18[_0x4956('0x28')]]={'$like':'%'+_0x2371f1['query'][_0x4956('0x38')]+'%'};return _0x32b95e;}})});}_0x3de0fb=_[_0x4956('0x39')]({},_0x3de0fb,_0x2371f1['options']);var _0x5c4120={'where':_0x3de0fb[_0x4956('0x36')]};return db[_0x4956('0x3b')]['count'](_0x5c4120)['then'](function(_0x3faf2f){_0x927481['count']=_0x3faf2f;if(_0x2371f1[_0x4956('0x2d')][_0x4956('0x3c')]){_0x3de0fb[_0x4956('0x3d')]=[{'all':!![]}];}return db[_0x4956('0x3b')][_0x4956('0x3e')](_0x3de0fb);})[_0x4956('0x20')](function(_0x44df16){_0x927481[_0x4956('0x3f')]=_0x44df16;return _0x927481;})[_0x4956('0x20')](respondWithFilteredResult(_0x465da2,_0x3de0fb))['catch'](handleError(_0x465da2,null));};exports[_0x4956('0x40')]=function(_0x1ed04a,_0x5ae8d2){var _0x153a69={'raw':!![],'where':{'id':_0x1ed04a[_0x4956('0x41')]['id']}},_0x339aaa={};_0x339aaa['model']=_[_0x4956('0x2e')](db[_0x4956('0x3b')][_0x4956('0x42')]);_0x339aaa[_0x4956('0x2d')]=_[_0x4956('0x2e')](_0x1ed04a[_0x4956('0x2d')]);_0x339aaa['filters']=_['intersection'](_0x339aaa[_0x4956('0x2c')],_0x339aaa['query']);_0x153a69[_0x4956('0x30')]=_[_0x4956('0x43')](_0x339aaa['model'],qs[_0x4956('0x31')](_0x1ed04a[_0x4956('0x2d')]['fields']));_0x153a69[_0x4956('0x30')]=_0x153a69[_0x4956('0x30')][_0x4956('0x32')]?_0x153a69[_0x4956('0x30')]:_0x339aaa[_0x4956('0x2c')];if(_0x1ed04a[_0x4956('0x2d')][_0x4956('0x3c')]){_0x153a69[_0x4956('0x3d')]=[{'all':!![]}];}_0x153a69=_[_0x4956('0x39')]({},_0x153a69,_0x1ed04a['options']);return db[_0x4956('0x3b')][_0x4956('0x44')](_0x153a69)['then'](handleEntityNotFound(_0x5ae8d2,null))['then'](respondWithResult(_0x5ae8d2,null))[_0x4956('0x45')](handleError(_0x5ae8d2,null));};exports[_0x4956('0x46')]=function(_0x4056f9,_0x4fc6db){return db[_0x4956('0x3b')]['create'](_0x4056f9[_0x4956('0x47')],{})[_0x4956('0x20')](function(_0x5a1a79){var _0x230335=_0x4056f9[_0x4956('0x48')][_0x4956('0x22')]({'plain':!![]});if(!_0x230335)throw new Error(_0x4956('0x49'));if(_0x230335[_0x4956('0x4a')]==='user'){var _0x79d2f=_0x5a1a79[_0x4956('0x22')]({'plain':!![]});var _0x5d752c=_0x4956('0x23');return db['UserProfileSection'][_0x4956('0x44')]({'where':{'name':_0x5d752c,'userProfileId':_0x230335['userProfileId']},'raw':!![]})[_0x4956('0x20')](function(_0x499ac9){if(_0x499ac9&&_0x499ac9['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x79d2f[_0x4956('0x28')],'resourceId':_0x79d2f['id'],'type':_0x499ac9[_0x4956('0x28')],'sectionId':_0x499ac9['id']},{})['then'](function(){return _0x5a1a79;});}else{return _0x5a1a79;}})[_0x4956('0x45')](function(_0xb83011){logger[_0x4956('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb83011);throw _0xb83011;});}return _0x5a1a79;})[_0x4956('0x20')](respondWithResult(_0x4fc6db,0xc9))[_0x4956('0x45')](handleError(_0x4fc6db,null));};exports['update']=function(_0x36143b,_0x508935){if(_0x36143b[_0x4956('0x47')]['id']){delete _0x36143b[_0x4956('0x47')]['id'];}return db[_0x4956('0x3b')][_0x4956('0x44')]({'where':{'id':_0x36143b['params']['id']}})[_0x4956('0x20')](handleEntityNotFound(_0x508935,null))[_0x4956('0x20')](saveUpdates(_0x36143b[_0x4956('0x47')],null))[_0x4956('0x20')](respondWithResult(_0x508935,null))['catch'](handleError(_0x508935,null));};exports[_0x4956('0x21')]=function(_0x5029d2,_0x45b290){return db[_0x4956('0x3b')]['find']({'where':{'id':_0x5029d2[_0x4956('0x41')]['id']}})['then'](handleEntityNotFound(_0x45b290,null))[_0x4956('0x20')](removeEntity(_0x45b290,null))[_0x4956('0x45')](handleError(_0x45b290,null));};exports[_0x4956('0x4b')]=function(_0x3e45a7,_0x3b002e,_0x10d600){return db[_0x4956('0x3b')][_0x4956('0x44')]({'where':{'id':_0x3e45a7['params']['id']},'attributes':[_0x4956('0x28'),_0x4956('0x4c'),'savename',_0x4956('0x4d')],'raw':!![]})[_0x4956('0x20')](handleEntityNotFound(_0x3b002e,null))['then'](function(_0x51c945){if(_0x51c945){if(!fs[_0x4956('0x4e')](path[_0x4956('0x4f')](config[_0x4956('0x50')],_0x4956('0x51'),_0x51c945[_0x4956('0x52')]))){throw new db[(_0x4956('0x53'))][(_0x4956('0x54'))](_0x4956('0x55'));}if(_0x3e45a7[_0x4956('0x2d')]['exists']){return _0x3b002e[_0x4956('0x25')](0xc8);}return _0x3b002e[_0x4956('0x4b')](path[_0x4956('0x4f')](config[_0x4956('0x50')],_0x4956('0x51'),_0x51c945[_0x4956('0x52')]),util[_0x4956('0x56')](_0x4956('0x57'),_0x51c945[_0x4956('0x4c')]||_0x51c945[_0x4956('0x28')],_0x51c945[_0x4956('0x4d')][_0x4956('0x58')]()));}})[_0x4956('0x45')](handleError(_0x3b002e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index dae15a0..b922836 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 _0xd975=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x16f89f,_0x3a8f2e){var _0x4968a8=function(_0x363eff){while(--_0x363eff){_0x16f89f['push'](_0x16f89f['shift']());}};_0x4968a8(++_0x3a8f2e);}(_0xd975,0xfe));var _0x5d97=function(_0x4ebe3d,_0x439c56){_0x4ebe3d=_0x4ebe3d-0x0;var _0x4adf00=_0xd975[_0x4ebe3d];return _0x4adf00;};'use strict';var _=require(_0x5d97('0x0'));var util=require(_0x5d97('0x1'));var logger=require(_0x5d97('0x2'))(_0x5d97('0x3'));var moment=require(_0x5d97('0x4'));var BPromise=require(_0x5d97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d97('0x6'));var rimraf=require(_0x5d97('0x7'));var config=require(_0x5d97('0x8'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x3f5e05,_0x12f073){return _0x3f5e05[_0x5d97('0x9')](_0x5d97('0xa'),attributes,{'tableName':_0x5d97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6edb=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0xbb772f,_0x299c73){var _0x3d7f23=function(_0xe38c44){while(--_0xe38c44){_0xbb772f['push'](_0xbb772f['shift']());}};_0x3d7f23(++_0x299c73);}(_0x6edb,0xa8));var _0xb6ed=function(_0x58df23,_0x3e9eb9){_0x58df23=_0x58df23-0x0;var _0x2fcd18=_0x6edb[_0x58df23];return _0x2fcd18;};'use strict';var _=require('lodash');var util=require(_0xb6ed('0x0'));var logger=require(_0xb6ed('0x1'))(_0xb6ed('0x2'));var moment=require(_0xb6ed('0x3'));var BPromise=require(_0xb6ed('0x4'));var rp=require(_0xb6ed('0x5'));var fs=require('fs');var path=require(_0xb6ed('0x6'));var rimraf=require(_0xb6ed('0x7'));var config=require(_0xb6ed('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0xb6ed('0x9')]=function(_0x34fd02,_0x27cf58){return _0x34fd02['define'](_0xb6ed('0xa'),attributes,{'tableName':_0xb6ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a072997..f7f7a95 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 _0xf4cf=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf4cf,0x1e0));var _0xff4c=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf4cf[_0xa8883];return _0x479426;};'use strict';var _=require(_0xff4c('0x0'));var util=require(_0xff4c('0x1'));var moment=require(_0xff4c('0x2'));var BPromise=require(_0xff4c('0x3'));var rs=require(_0xff4c('0x4'));var fs=require('fs');var Redis=require(_0xff4c('0x5'));var db=require(_0xff4c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xff4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xff4c('0x8'));var client=jayson[_0xff4c('0x9')][_0xff4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9679a1,_0x351121,_0x566b18){return new BPromise(function(_0x294309,_0x1cc9c9){return client[_0xff4c('0xb')](_0x9679a1,_0x566b18)[_0xff4c('0xc')](function(_0xf17d3d){logger[_0xff4c('0xd')](_0xff4c('0xe'),_0x351121,_0xff4c('0xf'));logger[_0xff4c('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x351121,_0xff4c('0xf'),JSON[_0xff4c('0x11')](_0xf17d3d));if(_0xf17d3d[_0xff4c('0x12')]){if(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x13')]===0x1f4){logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0xf17d3d['error']['message']);return _0x1cc9c9(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);}logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);return _0x294309(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);}else{logger[_0xff4c('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x351121,_0xff4c('0xf'));_0x294309(_0xf17d3d[_0xff4c('0x15')][_0xff4c('0x14')]);}})[_0xff4c('0x16')](function(_0x188f33){logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0x188f33);_0x1cc9c9(_0x188f33);});});} \ No newline at end of file +var _0x42ec=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x173c15,_0x552670){var _0x10ded7=function(_0x5c1259){while(--_0x5c1259){_0x173c15['push'](_0x173c15['shift']());}};_0x10ded7(++_0x552670);}(_0x42ec,0x1bf));var _0xc42e=function(_0x2cc97b,_0x1ed001){_0x2cc97b=_0x2cc97b-0x0;var _0x28fb55=_0x42ec[_0x2cc97b];return _0x28fb55;};'use strict';var _=require('lodash');var util=require(_0xc42e('0x0'));var moment=require(_0xc42e('0x1'));var BPromise=require(_0xc42e('0x2'));var rs=require(_0xc42e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc42e('0x4'));var logger=require(_0xc42e('0x5'))(_0xc42e('0x6'));var config=require(_0xc42e('0x7'));var jayson=require(_0xc42e('0x8'));var client=jayson[_0xc42e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43977a,_0x31fc77,_0x113847){return new BPromise(function(_0x5c726b,_0x3130d7){return client[_0xc42e('0xa')](_0x43977a,_0x113847)[_0xc42e('0xb')](function(_0x164298){logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,_0xc42e('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x31fc77,_0xc42e('0xe'),JSON[_0xc42e('0xf')](_0x164298));if(_0x164298[_0xc42e('0x10')]){if(_0x164298[_0xc42e('0x10')][_0xc42e('0x11')]===0x1f4){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x3130d7(_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);}logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x5c726b(_0x164298['error'][_0xc42e('0x12')]);}else{logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,'request\x20sent');_0x5c726b(_0x164298[_0xc42e('0x13')][_0xc42e('0x12')]);}})['catch'](function(_0xf366cd){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0xf366cd);_0x3130d7(_0xf366cd);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e90e4c7..09e90e8 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 _0x6210=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete','destroy','multer','Router'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x6210,0x1a0));var _0x0621=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x6210[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x0621('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0621('0x1')]();var fs_extra=require(_0x0621('0x2'));var auth=require(_0x0621('0x3'));var interaction=require(_0x0621('0x4'));var config=require(_0x0621('0x5'));var controller=require(_0x0621('0x6'));router[_0x0621('0x7')]('/',auth[_0x0621('0x8')](),controller[_0x0621('0x9')]);router['get'](_0x0621('0xa'),auth[_0x0621('0x8')](),controller[_0x0621('0xb')]);router[_0x0621('0x7')](_0x0621('0xc'),auth[_0x0621('0x8')](),controller['download']);router[_0x0621('0xd')]('/',auth[_0x0621('0x8')](),controller[_0x0621('0xe')]);router[_0x0621('0xf')](_0x0621('0xa'),auth['isAuthenticated'](),controller[_0x0621('0x10')]);router[_0x0621('0x11')]('/:id',auth[_0x0621('0x8')](),controller[_0x0621('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0a0c=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','/:id','show','get','/:id/download','download'];(function(_0x272125,_0x3324c0){var _0x3b6a02=function(_0xa5c7cc){while(--_0xa5c7cc){_0x272125['push'](_0x272125['shift']());}};_0x3b6a02(++_0x3324c0);}(_0x0a0c,0x7a));var _0xc0a0=function(_0x1ec74d,_0x5644af){_0x1ec74d=_0x1ec74d-0x0;var _0x45bced=_0x0a0c[_0x1ec74d];return _0x45bced;};'use strict';var multer=require(_0xc0a0('0x0'));var util=require(_0xc0a0('0x1'));var path=require(_0xc0a0('0x2'));var timeout=require(_0xc0a0('0x3'));var express=require(_0xc0a0('0x4'));var router=express['Router']();var fs_extra=require(_0xc0a0('0x5'));var auth=require(_0xc0a0('0x6'));var interaction=require(_0xc0a0('0x7'));var config=require(_0xc0a0('0x8'));var controller=require(_0xc0a0('0x9'));router['get']('/',auth[_0xc0a0('0xa')](),controller['index']);router['get'](_0xc0a0('0xb'),auth[_0xc0a0('0xa')](),controller[_0xc0a0('0xc')]);router[_0xc0a0('0xd')](_0xc0a0('0xe'),auth[_0xc0a0('0xa')](),controller[_0xc0a0('0xf')]);router[_0xc0a0('0x10')]('/',auth[_0xc0a0('0xa')](),controller[_0xc0a0('0x11')]);router[_0xc0a0('0x12')](_0xc0a0('0xb'),auth[_0xc0a0('0xa')](),controller[_0xc0a0('0x13')]);router[_0xc0a0('0x14')](_0xc0a0('0xb'),auth[_0xc0a0('0xa')](),controller[_0xc0a0('0x15')]);module[_0xc0a0('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 204ebf4..b5faaa0 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 _0x5b7f=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x15a9df,_0x3eb9f3){var _0x20af34=function(_0x53e140){while(--_0x53e140){_0x15a9df['push'](_0x15a9df['shift']());}};_0x20af34(++_0x3eb9f3);}(_0x5b7f,0x81));var _0xf5b7=function(_0xd0424e,_0x16522d){_0xd0424e=_0xd0424e-0x0;var _0x3c60db=_0x5b7f[_0xd0424e];return _0x3c60db;};'use strict';var Sequelize=require(_0xf5b7('0x0'));module[_0xf5b7('0x1')]={'field':{'type':Sequelize[_0xf5b7('0x2')]},'alias':{'type':Sequelize[_0xf5b7('0x3')]},'function':{'type':Sequelize[_0xf5b7('0x3')]},'format':{'type':Sequelize[_0xf5b7('0x3')]},'groupBy':{'type':Sequelize[_0xf5b7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf5b7('0x3')]},'custom':{'type':Sequelize[_0xf5b7('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa945=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x12fb0e,_0x430744){var _0x13f8d3=function(_0x229c3b){while(--_0x229c3b){_0x12fb0e['push'](_0x12fb0e['shift']());}};_0x13f8d3(++_0x430744);}(_0xa945,0x97));var _0x5a94=function(_0x35289d,_0x230ce7){_0x35289d=_0x35289d-0x0;var _0x2dec71=_0xa945[_0x35289d];return _0x2dec71;};'use strict';var Sequelize=require(_0x5a94('0x0'));module[_0x5a94('0x1')]={'field':{'type':Sequelize[_0x5a94('0x2')]},'alias':{'type':Sequelize[_0x5a94('0x3')]},'function':{'type':Sequelize[_0x5a94('0x3')]},'format':{'type':Sequelize[_0x5a94('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5a94('0x3')]},'custom':{'type':Sequelize[_0x5a94('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 133e024..7b72582 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 _0x8c0e=['includeAll','catch','create','body','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x29518d,_0x1e5f3c){var _0x307961=function(_0x2a948e){while(--_0x2a948e){_0x29518d['push'](_0x29518d['shift']());}};_0x307961(++_0x1e5f3c);}(_0x8c0e,0x1a6));var _0xe8c0=function(_0x5dcac6,_0x16c78e){_0x5dcac6=_0x5dcac6-0x0;var _0x2b156d=_0x8c0e[_0x5dcac6];return _0x2b156d;};'use strict';var emlformat=require(_0xe8c0('0x0'));var rimraf=require(_0xe8c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8c0('0x2'));var rp=require(_0xe8c0('0x3'));var moment=require(_0xe8c0('0x4'));var BPromise=require(_0xe8c0('0x5'));var Mustache=require(_0xe8c0('0x6'));var util=require(_0xe8c0('0x7'));var path=require(_0xe8c0('0x8'));var sox=require('sox');var csv=require(_0xe8c0('0x9'));var ejs=require(_0xe8c0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8c0('0xb'));var _=require(_0xe8c0('0xc'));var squel=require(_0xe8c0('0xd'));var crypto=require(_0xe8c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8c0('0xf'));var toCsv=require(_0xe8c0('0x9'));var querystring=require(_0xe8c0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe8c0('0x11'));var hardwareService=require(_0xe8c0('0x12'));var logger=require('../../config/logger')(_0xe8c0('0x13'));var utils=require(_0xe8c0('0x14'));var config=require(_0xe8c0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24165a,_0x19c661){_0x19c661=_0x19c661||0xcc;return function(_0xcb594f){if(_0xcb594f){return _0x24165a[_0xe8c0('0x16')](_0x19c661);}return _0x24165a['status'](_0x19c661)[_0xe8c0('0x17')]();};}function respondWithResult(_0x29fe7d,_0x2f844a){_0x2f844a=_0x2f844a||0xc8;return function(_0x131d38){if(_0x131d38){return _0x29fe7d[_0xe8c0('0x18')](_0x2f844a)[_0xe8c0('0x19')](_0x131d38);}};}function respondWithFilteredResult(_0x2ee2dd,_0x3cac3a){return function(_0x419f14){if(_0x419f14){var _0x5f743c=typeof _0x3cac3a[_0xe8c0('0x1a')]===_0xe8c0('0x1b')&&typeof _0x3cac3a[_0xe8c0('0x1c')]===_0xe8c0('0x1b');var _0x35fdf4=_0x419f14[_0xe8c0('0x1d')];var _0x194d3b=_0x5f743c?0x0:_0x3cac3a[_0xe8c0('0x1a')];var _0x424575=_0x5f743c?_0x419f14['count']:_0x3cac3a[_0xe8c0('0x1a')]+_0x3cac3a[_0xe8c0('0x1c')];var _0x22c249;if(_0x424575>=_0x35fdf4){_0x424575=_0x35fdf4;_0x22c249=0xc8;}else{_0x22c249=0xce;}_0x2ee2dd[_0xe8c0('0x18')](_0x22c249);return _0x2ee2dd[_0xe8c0('0x1e')](_0xe8c0('0x1f'),_0x194d3b+'-'+_0x424575+'/'+_0x35fdf4)['json'](_0x419f14);}return null;};}function patchUpdates(_0x3094e3){return function(_0x343049){try{jsonpatch[_0xe8c0('0x20')](_0x343049,_0x3094e3,!![]);}catch(_0x1835c4){return BPromise[_0xe8c0('0x21')](_0x1835c4);}return _0x343049[_0xe8c0('0x22')]();};}function saveUpdates(_0x48c46e,_0xe3e420){return function(_0x1d2dfa){if(_0x1d2dfa){return _0x1d2dfa[_0xe8c0('0x23')](_0x48c46e)[_0xe8c0('0x24')](function(_0x5570e4){return _0x5570e4;});}return null;};}function removeEntity(_0x398112,_0x1e18c9){return function(_0x4dc38d){if(_0x4dc38d){return _0x4dc38d[_0xe8c0('0x25')]()[_0xe8c0('0x24')](function(){_0x398112[_0xe8c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2504b4,_0x49e2e3){return function(_0x4f1855){if(!_0x4f1855){_0x2504b4[_0xe8c0('0x16')](0x194);}return _0x4f1855;};}function handleError(_0x550d10,_0x401b1a){_0x401b1a=_0x401b1a||0x1f4;return function(_0x1bceac){logger[_0xe8c0('0x26')](_0x1bceac['stack']);if(_0x1bceac[_0xe8c0('0x27')]){delete _0x1bceac['name'];}_0x550d10['status'](_0x401b1a)[_0xe8c0('0x28')](_0x1bceac);};}exports[_0xe8c0('0x29')]=function(_0x342c19,_0x248c02){var _0x285e10={},_0x4997cd={},_0x11c4a5={'count':0x0,'rows':[]};var _0x460da2=_[_0xe8c0('0x2a')](db[_0xe8c0('0x2b')][_0xe8c0('0x2c')],function(_0x14939e){return{'name':_0x14939e[_0xe8c0('0x2d')],'type':_0x14939e[_0xe8c0('0x2e')][_0xe8c0('0x2f')]};});_0x4997cd[_0xe8c0('0x30')]=_[_0xe8c0('0x2a')](_0x460da2,'name');_0x4997cd['query']=_[_0xe8c0('0x31')](_0x342c19[_0xe8c0('0x32')]);_0x4997cd[_0xe8c0('0x33')]=_['intersection'](_0x4997cd[_0xe8c0('0x30')],_0x4997cd[_0xe8c0('0x32')]);_0x285e10[_0xe8c0('0x34')]=_[_0xe8c0('0x35')](_0x4997cd['model'],qs[_0xe8c0('0x36')](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x36')]));_0x285e10[_0xe8c0('0x34')]=_0x285e10['attributes'][_0xe8c0('0x37')]?_0x285e10['attributes']:_0x4997cd[_0xe8c0('0x30')];if(!_0x342c19[_0xe8c0('0x32')]['hasOwnProperty'](_0xe8c0('0x38'))){_0x285e10[_0xe8c0('0x1c')]=qs[_0xe8c0('0x1c')](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x1c')]);_0x285e10['offset']=qs[_0xe8c0('0x1a')](_0x342c19['query'][_0xe8c0('0x1a')]);}_0x285e10[_0xe8c0('0x39')]=qs['sort'](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3a')]);_0x285e10[_0xe8c0('0x3b')]=qs[_0xe8c0('0x33')](_[_0xe8c0('0x3c')](_0x342c19[_0xe8c0('0x32')],_0x4997cd['filters']),_0x460da2);if(_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3d')]){_0x285e10[_0xe8c0('0x3b')]=_[_0xe8c0('0x3e')](_0x285e10[_0xe8c0('0x3b')],{'$or':_[_0xe8c0('0x2a')](_0x460da2,function(_0x2b6b9c){if(_0x2b6b9c[_0xe8c0('0x2e')]!==_0xe8c0('0x3f')){var _0x51e3f6={};_0x51e3f6[_0x2b6b9c[_0xe8c0('0x27')]]={'$like':'%'+_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3d')]+'%'};return _0x51e3f6;}})});}_0x285e10=_[_0xe8c0('0x3e')]({},_0x285e10,_0x342c19[_0xe8c0('0x40')]);var _0x2cc35e={'where':_0x285e10[_0xe8c0('0x3b')]};return db[_0xe8c0('0x2b')][_0xe8c0('0x1d')](_0x2cc35e)['then'](function(_0x1f14d4){_0x11c4a5[_0xe8c0('0x1d')]=_0x1f14d4;if(_0x342c19['query']['includeAll']){_0x285e10[_0xe8c0('0x41')]=[{'all':!![]}];}return db[_0xe8c0('0x2b')][_0xe8c0('0x42')](_0x285e10);})[_0xe8c0('0x24')](function(_0x1dc5fa){_0x11c4a5[_0xe8c0('0x43')]=_0x1dc5fa;return _0x11c4a5;})[_0xe8c0('0x24')](respondWithFilteredResult(_0x248c02,_0x285e10))['catch'](handleError(_0x248c02,null));};exports[_0xe8c0('0x44')]=function(_0x583510,_0x2bfe37){var _0x5dcf92={'raw':![],'where':{'id':_0x583510[_0xe8c0('0x45')]['id']}},_0x2d0be2={};_0x2d0be2['model']=_['keys'](db[_0xe8c0('0x2b')][_0xe8c0('0x2c')]);_0x2d0be2[_0xe8c0('0x32')]=_[_0xe8c0('0x31')](_0x583510[_0xe8c0('0x32')]);_0x2d0be2[_0xe8c0('0x33')]=_['intersection'](_0x2d0be2[_0xe8c0('0x30')],_0x2d0be2[_0xe8c0('0x32')]);_0x5dcf92[_0xe8c0('0x34')]=_['intersection'](_0x2d0be2[_0xe8c0('0x30')],qs[_0xe8c0('0x36')](_0x583510[_0xe8c0('0x32')]['fields']));_0x5dcf92[_0xe8c0('0x34')]=_0x5dcf92[_0xe8c0('0x34')][_0xe8c0('0x37')]?_0x5dcf92['attributes']:_0x2d0be2[_0xe8c0('0x30')];if(_0x583510[_0xe8c0('0x32')][_0xe8c0('0x46')]){_0x5dcf92[_0xe8c0('0x41')]=[{'all':!![]}];}_0x5dcf92=_['merge']({},_0x5dcf92,_0x583510['options']);return db[_0xe8c0('0x2b')]['find'](_0x5dcf92)['then'](handleEntityNotFound(_0x2bfe37,null))[_0xe8c0('0x24')](respondWithResult(_0x2bfe37,null))[_0xe8c0('0x47')](handleError(_0x2bfe37,null));};exports[_0xe8c0('0x48')]=function(_0x1db4ec,_0x3b4511){return db[_0xe8c0('0x2b')][_0xe8c0('0x48')](_0x1db4ec[_0xe8c0('0x49')],{})[_0xe8c0('0x24')](respondWithResult(_0x3b4511,0xc9))[_0xe8c0('0x47')](handleError(_0x3b4511,null));};exports['bulkCreate']=function(_0x1b48c6,_0x3d1dd4){return db[_0xe8c0('0x2b')]['bulkCreate'](_0x1b48c6[_0xe8c0('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3d1dd4,0xc9))[_0xe8c0('0x47')](handleError(_0x3d1dd4,null));};exports[_0xe8c0('0x23')]=function(_0xdfec37,_0x2ee64c){if(_0xdfec37[_0xe8c0('0x49')]['id']){delete _0xdfec37[_0xe8c0('0x49')]['id'];}return db[_0xe8c0('0x2b')][_0xe8c0('0x4a')]({'where':{'id':_0xdfec37[_0xe8c0('0x45')]['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x2ee64c,null))['then'](saveUpdates(_0xdfec37[_0xe8c0('0x49')],null))[_0xe8c0('0x24')](respondWithResult(_0x2ee64c,null))[_0xe8c0('0x47')](handleError(_0x2ee64c,null));};exports[_0xe8c0('0x25')]=function(_0x35e381,_0x1c5d9c){return db[_0xe8c0('0x2b')][_0xe8c0('0x4a')]({'where':{'id':_0x35e381[_0xe8c0('0x45')]['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x1c5d9c,null))[_0xe8c0('0x24')](removeEntity(_0x1c5d9c,null))['catch'](handleError(_0x1c5d9c,null));};exports[_0xe8c0('0x4b')]=function(_0x30c6e5,_0x23f304){return db[_0xe8c0('0x2b')][_0xe8c0('0x25')]({'where':{'id':_0x30c6e5[_0xe8c0('0x32')][_0xe8c0('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xe8c0('0x24')](respondWithResult(_0x23f304,0xcc))[_0xe8c0('0x47')](handleError(_0x23f304,null));};exports[_0xe8c0('0x4d')]=function(_0x311ad2,_0x94160e,_0x4b37f8){return db[_0xe8c0('0x4e')][_0xe8c0('0x4f')]({'where':{'id':_0x311ad2['params']['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x94160e,null))['then'](function(_0x2b27d5){if(_0x2b27d5){return db[_0xe8c0('0x50')]['transaction'](function(_0x9ee13b){return db[_0xe8c0('0x2b')][_0xe8c0('0x25')]({'where':{'CustomReportId':_0x311ad2[_0xe8c0('0x45')]['id']},'transaction':_0x9ee13b})[_0xe8c0('0x24')](function(_0x1cf7cc){var _0x1c23c4=_[_0xe8c0('0x2a')](_0x311ad2[_0xe8c0('0x49')],function(_0x3a0ebd){delete _0x3a0ebd['id'];_0x3a0ebd['CustomReportId']=_0x311ad2[_0xe8c0('0x45')]['id'];return _0x3a0ebd;});return db[_0xe8c0('0x2b')][_0xe8c0('0x51')](_0x1c23c4,{'transaction':_0x9ee13b});});})[_0xe8c0('0x24')](function(){return db[_0xe8c0('0x2b')]['findAll']({'where':{'CustomReportId':_0x311ad2[_0xe8c0('0x45')]['id']}});});}})[_0xe8c0('0x24')](respondWithResult(_0x94160e,null))[_0xe8c0('0x47')](handleError(_0x94160e,null));}; \ No newline at end of file +var _0x5e3d=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','then','end','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','pick','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x11622c,_0x1d945a){var _0x51e567=function(_0x8fbeb1){while(--_0x8fbeb1){_0x11622c['push'](_0x11622c['shift']());}};_0x51e567(++_0x1d945a);}(_0x5e3d,0x1c9));var _0xd5e3=function(_0x1eee56,_0x5ebe19){_0x1eee56=_0x1eee56-0x0;var _0x34a182=_0x5e3d[_0x1eee56];return _0x34a182;};'use strict';var emlformat=require(_0xd5e3('0x0'));var rimraf=require(_0xd5e3('0x1'));var zipdir=require(_0xd5e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e3('0x3'));var moment=require(_0xd5e3('0x4'));var BPromise=require(_0xd5e3('0x5'));var Mustache=require('mustache');var util=require(_0xd5e3('0x6'));var path=require(_0xd5e3('0x7'));var sox=require(_0xd5e3('0x8'));var csv=require(_0xd5e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5e3('0xa'));var squel=require('squel');var crypto=require(_0xd5e3('0xb'));var jsforce=require(_0xd5e3('0xc'));var deskjs=require(_0xd5e3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e3('0xe'));var Redis=require(_0xd5e3('0xf'));var authService=require(_0xd5e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd5e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5e3('0x12'))(_0xd5e3('0x13'));var utils=require(_0xd5e3('0x14'));var config=require(_0xd5e3('0x15'));var licenseUtil=require(_0xd5e3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac5c0,_0x45993c){_0x45993c=_0x45993c||0xcc;return function(_0x3dc18c){if(_0x3dc18c){return _0x2ac5c0[_0xd5e3('0x17')](_0x45993c);}return _0x2ac5c0[_0xd5e3('0x18')](_0x45993c)['end']();};}function respondWithResult(_0xc4bb1d,_0x58a208){_0x58a208=_0x58a208||0xc8;return function(_0x45c785){if(_0x45c785){return _0xc4bb1d[_0xd5e3('0x18')](_0x58a208)[_0xd5e3('0x19')](_0x45c785);}};}function respondWithFilteredResult(_0xd1243b,_0x29883e){return function(_0x3f5f8b){if(_0x3f5f8b){var _0x23b034=typeof _0x29883e['offset']===_0xd5e3('0x1a')&&typeof _0x29883e['limit']===_0xd5e3('0x1a');var _0x5a5f35=_0x3f5f8b[_0xd5e3('0x1b')];var _0x2ecffa=_0x23b034?0x0:_0x29883e[_0xd5e3('0x1c')];var _0x5ede63=_0x23b034?_0x3f5f8b[_0xd5e3('0x1b')]:_0x29883e['offset']+_0x29883e[_0xd5e3('0x1d')];var _0x484bd7;if(_0x5ede63>=_0x5a5f35){_0x5ede63=_0x5a5f35;_0x484bd7=0xc8;}else{_0x484bd7=0xce;}_0xd1243b[_0xd5e3('0x18')](_0x484bd7);return _0xd1243b[_0xd5e3('0x1e')](_0xd5e3('0x1f'),_0x2ecffa+'-'+_0x5ede63+'/'+_0x5a5f35)['json'](_0x3f5f8b);}return null;};}function patchUpdates(_0x148704){return function(_0x4d34e2){try{jsonpatch[_0xd5e3('0x20')](_0x4d34e2,_0x148704,!![]);}catch(_0x9e5433){return BPromise['reject'](_0x9e5433);}return _0x4d34e2['save']();};}function saveUpdates(_0x55c090,_0x20941d){return function(_0x1e74d6){if(_0x1e74d6){return _0x1e74d6[_0xd5e3('0x21')](_0x55c090)['then'](function(_0x2a5b15){return _0x2a5b15;});}return null;};}function removeEntity(_0x47e23a,_0x483103){return function(_0x410def){if(_0x410def){return _0x410def[_0xd5e3('0x22')]()[_0xd5e3('0x23')](function(){_0x47e23a[_0xd5e3('0x18')](0xcc)[_0xd5e3('0x24')]();});}};}function handleEntityNotFound(_0x45d58c,_0x3bf220){return function(_0x3bc3e7){if(!_0x3bc3e7){_0x45d58c[_0xd5e3('0x17')](0x194);}return _0x3bc3e7;};}function handleError(_0x2bdfcd,_0x35f99b){_0x35f99b=_0x35f99b||0x1f4;return function(_0x1fe7b1){logger['error'](_0x1fe7b1[_0xd5e3('0x25')]);if(_0x1fe7b1[_0xd5e3('0x26')]){delete _0x1fe7b1[_0xd5e3('0x26')];}_0x2bdfcd[_0xd5e3('0x18')](_0x35f99b)[_0xd5e3('0x27')](_0x1fe7b1);};}exports[_0xd5e3('0x28')]=function(_0x5d5079,_0x1c9476){var _0x1b2f0c={},_0x355088={},_0x337284={'count':0x0,'rows':[]};var _0x231d31=_['map'](db[_0xd5e3('0x29')][_0xd5e3('0x2a')],function(_0x31a211){return{'name':_0x31a211['fieldName'],'type':_0x31a211[_0xd5e3('0x2b')][_0xd5e3('0x2c')]};});_0x355088['model']=_[_0xd5e3('0x2d')](_0x231d31,'name');_0x355088[_0xd5e3('0x2e')]=_[_0xd5e3('0x2f')](_0x5d5079[_0xd5e3('0x2e')]);_0x355088[_0xd5e3('0x30')]=_[_0xd5e3('0x31')](_0x355088['model'],_0x355088[_0xd5e3('0x2e')]);_0x1b2f0c[_0xd5e3('0x32')]=_[_0xd5e3('0x31')](_0x355088[_0xd5e3('0x33')],qs['fields'](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x34')]));_0x1b2f0c[_0xd5e3('0x32')]=_0x1b2f0c[_0xd5e3('0x32')][_0xd5e3('0x35')]?_0x1b2f0c[_0xd5e3('0x32')]:_0x355088['model'];if(!_0x5d5079[_0xd5e3('0x2e')]['hasOwnProperty'](_0xd5e3('0x36'))){_0x1b2f0c[_0xd5e3('0x1d')]=qs[_0xd5e3('0x1d')](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x1d')]);_0x1b2f0c['offset']=qs['offset'](_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x1c')]);}_0x1b2f0c[_0xd5e3('0x37')]=qs['sort'](_0x5d5079[_0xd5e3('0x2e')]['sort']);_0x1b2f0c['where']=qs[_0xd5e3('0x30')](_[_0xd5e3('0x38')](_0x5d5079['query'],_0x355088[_0xd5e3('0x30')]),_0x231d31);if(_0x5d5079['query']['filter']){_0x1b2f0c[_0xd5e3('0x39')]=_[_0xd5e3('0x3a')](_0x1b2f0c[_0xd5e3('0x39')],{'$or':_[_0xd5e3('0x2d')](_0x231d31,function(_0x11bd1e){if(_0x11bd1e['type']!==_0xd5e3('0x3b')){var _0x2922b9={};_0x2922b9[_0x11bd1e[_0xd5e3('0x26')]]={'$like':'%'+_0x5d5079[_0xd5e3('0x2e')]['filter']+'%'};return _0x2922b9;}})});}_0x1b2f0c=_['merge']({},_0x1b2f0c,_0x5d5079[_0xd5e3('0x3c')]);var _0x3fbfe8={'where':_0x1b2f0c[_0xd5e3('0x39')]};return db['AnalyticFieldReport'][_0xd5e3('0x1b')](_0x3fbfe8)[_0xd5e3('0x23')](function(_0x240909){_0x337284[_0xd5e3('0x1b')]=_0x240909;if(_0x5d5079[_0xd5e3('0x2e')][_0xd5e3('0x3d')]){_0x1b2f0c[_0xd5e3('0x3e')]=[{'all':!![]}];}return db[_0xd5e3('0x29')]['findAll'](_0x1b2f0c);})[_0xd5e3('0x23')](function(_0xe93ce1){_0x337284[_0xd5e3('0x3f')]=_0xe93ce1;return _0x337284;})[_0xd5e3('0x23')](respondWithFilteredResult(_0x1c9476,_0x1b2f0c))['catch'](handleError(_0x1c9476,null));};exports[_0xd5e3('0x40')]=function(_0x312047,_0x57dce9){var _0x24da6e={'raw':![],'where':{'id':_0x312047[_0xd5e3('0x41')]['id']}},_0x5d6001={};_0x5d6001['model']=_['keys'](db['AnalyticFieldReport'][_0xd5e3('0x2a')]);_0x5d6001[_0xd5e3('0x2e')]=_['keys'](_0x312047[_0xd5e3('0x2e')]);_0x5d6001[_0xd5e3('0x30')]=_['intersection'](_0x5d6001['model'],_0x5d6001[_0xd5e3('0x2e')]);_0x24da6e[_0xd5e3('0x32')]=_[_0xd5e3('0x31')](_0x5d6001['model'],qs[_0xd5e3('0x34')](_0x312047[_0xd5e3('0x2e')][_0xd5e3('0x34')]));_0x24da6e['attributes']=_0x24da6e[_0xd5e3('0x32')][_0xd5e3('0x35')]?_0x24da6e[_0xd5e3('0x32')]:_0x5d6001[_0xd5e3('0x33')];if(_0x312047['query'][_0xd5e3('0x3d')]){_0x24da6e[_0xd5e3('0x3e')]=[{'all':!![]}];}_0x24da6e=_[_0xd5e3('0x3a')]({},_0x24da6e,_0x312047[_0xd5e3('0x3c')]);return db[_0xd5e3('0x29')][_0xd5e3('0x42')](_0x24da6e)[_0xd5e3('0x23')](handleEntityNotFound(_0x57dce9,null))['then'](respondWithResult(_0x57dce9,null))[_0xd5e3('0x43')](handleError(_0x57dce9,null));};exports['create']=function(_0x3eae7f,_0x2a0a2d){return db[_0xd5e3('0x29')][_0xd5e3('0x44')](_0x3eae7f[_0xd5e3('0x45')],{})['then'](respondWithResult(_0x2a0a2d,0xc9))[_0xd5e3('0x43')](handleError(_0x2a0a2d,null));};exports['bulkCreate']=function(_0x11c4cb,_0x3295cb){return db[_0xd5e3('0x29')][_0xd5e3('0x46')](_0x11c4cb[_0xd5e3('0x45')],{'raw':![],'individualHooks':!![]})[_0xd5e3('0x23')](respondWithResult(_0x3295cb,0xc9))['catch'](handleError(_0x3295cb,null));};exports[_0xd5e3('0x21')]=function(_0x2fd672,_0x1627f5){if(_0x2fd672[_0xd5e3('0x45')]['id']){delete _0x2fd672['body']['id'];}return db['AnalyticFieldReport'][_0xd5e3('0x42')]({'where':{'id':_0x2fd672[_0xd5e3('0x41')]['id']}})[_0xd5e3('0x23')](handleEntityNotFound(_0x1627f5,null))[_0xd5e3('0x23')](saveUpdates(_0x2fd672[_0xd5e3('0x45')],null))[_0xd5e3('0x23')](respondWithResult(_0x1627f5,null))['catch'](handleError(_0x1627f5,null));};exports[_0xd5e3('0x22')]=function(_0x57df68,_0x2868da){return db[_0xd5e3('0x29')][_0xd5e3('0x42')]({'where':{'id':_0x57df68[_0xd5e3('0x41')]['id']}})[_0xd5e3('0x23')](handleEntityNotFound(_0x2868da,null))[_0xd5e3('0x23')](removeEntity(_0x2868da,null))['catch'](handleError(_0x2868da,null));};exports[_0xd5e3('0x47')]=function(_0x46c8a0,_0x3dd69a){return db[_0xd5e3('0x29')][_0xd5e3('0x22')]({'where':{'id':_0x46c8a0[_0xd5e3('0x2e')][_0xd5e3('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3dd69a,0xcc))[_0xd5e3('0x43')](handleError(_0x3dd69a,null));};exports[_0xd5e3('0x49')]=function(_0xf5a1bb,_0x3fbc01,_0x56a3f8){return db[_0xd5e3('0x4a')][_0xd5e3('0x4b')]({'where':{'id':_0xf5a1bb[_0xd5e3('0x41')]['id']}})[_0xd5e3('0x23')](handleEntityNotFound(_0x3fbc01,null))[_0xd5e3('0x23')](function(_0x5117ca){if(_0x5117ca){return db[_0xd5e3('0x4c')][_0xd5e3('0x4d')](function(_0x1a69a2){return db[_0xd5e3('0x29')][_0xd5e3('0x22')]({'where':{'CustomReportId':_0xf5a1bb['params']['id']},'transaction':_0x1a69a2})['then'](function(_0x5dfc42){var _0x4bd53f=_[_0xd5e3('0x2d')](_0xf5a1bb[_0xd5e3('0x45')],function(_0x57a022){delete _0x57a022['id'];_0x57a022[_0xd5e3('0x4e')]=_0xf5a1bb[_0xd5e3('0x41')]['id'];return _0x57a022;});return db[_0xd5e3('0x29')][_0xd5e3('0x46')](_0x4bd53f,{'transaction':_0x1a69a2});});})[_0xd5e3('0x23')](function(){return db['AnalyticFieldReport'][_0xd5e3('0x4f')]({'where':{'CustomReportId':_0xf5a1bb[_0xd5e3('0x41')]['id']}});});}})[_0xd5e3('0x23')](respondWithResult(_0x3fbc01,null))[_0xd5e3('0x43')](handleError(_0x3fbc01,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7d3c60e..78de996 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 _0x7eef=['request-promise','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','api','moment'];(function(_0x758c4c,_0x590551){var _0x59dd93=function(_0x50f870){while(--_0x50f870){_0x758c4c['push'](_0x758c4c['shift']());}};_0x59dd93(++_0x590551);}(_0x7eef,0xba));var _0xf7ee=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x7eef[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xf7ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7ee('0x1'));var moment=require(_0xf7ee('0x2'));var BPromise=require('bluebird');var rp=require(_0xf7ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf7ee('0x4'));var attributes=require(_0xf7ee('0x5'));module[_0xf7ee('0x6')]=function(_0x3089ac,_0x12fac8){return _0x3089ac['define'](_0xf7ee('0x7'),attributes,{'tableName':_0xf7ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2766=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','util','../../config/logger','moment','request-promise'];(function(_0x85f059,_0x27d70e){var _0x3520f7=function(_0x5b7c68){while(--_0x5b7c68){_0x85f059['push'](_0x85f059['shift']());}};_0x3520f7(++_0x27d70e);}(_0x2766,0x1ac));var _0x6276=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x2766[_0x57645b];return _0xe82f00;};'use strict';var _=require('lodash');var util=require(_0x6276('0x0'));var logger=require(_0x6276('0x1'))('api');var moment=require(_0x6276('0x2'));var BPromise=require('bluebird');var rp=require(_0x6276('0x3'));var fs=require('fs');var path=require(_0x6276('0x4'));var rimraf=require(_0x6276('0x5'));var config=require(_0x6276('0x6'));var attributes=require(_0x6276('0x7'));module['exports']=function(_0x1d0a7d,_0x450f12){return _0x1d0a7d[_0x6276('0x8')]('AnalyticFieldReport',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 e240810..c0e00a2 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 _0x7efa=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x49daf3,_0x2f3779){var _0x5dff0a=function(_0x2b567b){while(--_0x2b567b){_0x49daf3['push'](_0x49daf3['shift']());}};_0x5dff0a(++_0x2f3779);}(_0x7efa,0x1cb));var _0xa7ef=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7efa[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var moment=require(_0xa7ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7ef('0x3'));var fs=require('fs');var Redis=require(_0xa7ef('0x4'));var db=require(_0xa7ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7ef('0x6'))('rpc');var config=require(_0xa7ef('0x7'));var jayson=require(_0xa7ef('0x8'));var client=jayson[_0xa7ef('0x9')][_0xa7ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cf8a,_0x242f16,_0x1cb36a){return new BPromise(function(_0x580282,_0xc04145){return client[_0xa7ef('0xb')](_0x4cf8a,_0x1cb36a)[_0xa7ef('0xc')](function(_0x232600){logger[_0xa7ef('0xd')](_0xa7ef('0xe'),_0x242f16,_0xa7ef('0xf'));logger[_0xa7ef('0x10')](_0xa7ef('0x11'),_0x242f16,'request\x20sent',JSON[_0xa7ef('0x12')](_0x232600));if(_0x232600[_0xa7ef('0x13')]){if(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x14')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x242f16,_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);return _0xc04145(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);}logger['error'](_0xa7ef('0xe'),_0x242f16,_0x232600['error']['message']);return _0x580282(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);}else{logger[_0xa7ef('0xd')](_0xa7ef('0xe'),_0x242f16,_0xa7ef('0xf'));_0x580282(_0x232600[_0xa7ef('0x16')][_0xa7ef('0x15')]);}})['catch'](function(_0x40ddc1){logger[_0xa7ef('0x13')](_0xa7ef('0xe'),_0x242f16,_0x40ddc1);_0xc04145(_0x40ddc1);});});} \ No newline at end of file +var _0x6d66=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x44e4f3,_0x27770a){var _0x39b544=function(_0x3ecf81){while(--_0x3ecf81){_0x44e4f3['push'](_0x44e4f3['shift']());}};_0x39b544(++_0x27770a);}(_0x6d66,0x1c4));var _0x66d6=function(_0x4b0ec6,_0x20ca44){_0x4b0ec6=_0x4b0ec6-0x0;var _0x40044a=_0x6d66[_0x4b0ec6];return _0x40044a;};'use strict';var _=require(_0x66d6('0x0'));var util=require('util');var moment=require(_0x66d6('0x1'));var BPromise=require(_0x66d6('0x2'));var rs=require(_0x66d6('0x3'));var fs=require('fs');var Redis=require(_0x66d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66d6('0x5'))('rpc');var config=require(_0x66d6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x66d6('0x7')][_0x66d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f77dd,_0x46677d,_0xbff7e5){return new BPromise(function(_0x413a9b,_0x192356){return client[_0x66d6('0x9')](_0x3f77dd,_0xbff7e5)[_0x66d6('0xa')](function(_0xede20c){logger[_0x66d6('0xb')](_0x66d6('0xc'),_0x46677d,'request\x20sent');logger[_0x66d6('0xd')](_0x66d6('0xe'),_0x46677d,_0x66d6('0xf'),JSON['stringify'](_0xede20c));if(_0xede20c[_0x66d6('0x10')]){if(_0xede20c[_0x66d6('0x10')][_0x66d6('0x11')]===0x1f4){logger[_0x66d6('0x10')](_0x66d6('0xc'),_0x46677d,_0xede20c[_0x66d6('0x10')][_0x66d6('0x12')]);return _0x192356(_0xede20c[_0x66d6('0x10')][_0x66d6('0x12')]);}logger['error'](_0x66d6('0xc'),_0x46677d,_0xede20c[_0x66d6('0x10')][_0x66d6('0x12')]);return _0x413a9b(_0xede20c[_0x66d6('0x10')][_0x66d6('0x12')]);}else{logger[_0x66d6('0xb')](_0x66d6('0xc'),_0x46677d,_0x66d6('0xf'));_0x413a9b(_0xede20c[_0x66d6('0x13')][_0x66d6('0x12')]);}})['catch'](function(_0x2b6e6e){logger[_0x66d6('0x10')](_0x66d6('0xc'),_0x46677d,_0x2b6e6e);_0x192356(_0x2b6e6e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8c8dc27..d71774c 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(_0xb12b49,_0x50c6d6){var _0x592f07=function(_0x63460d){while(--_0x63460d){_0xb12b49['push'](_0xb12b49['shift']());}};_0x592f07(++_0x50c6d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x41e5e6,_0x358ad4){var _0x518d68=function(_0x27d1b2){while(--_0x27d1b2){_0x41e5e6['push'](_0x41e5e6['shift']());}};_0x518d68(++_0x358ad4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index b633b69..aa6531c 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 _0x23a3=['TEXT','STRING','name'];(function(_0x459437,_0x139ded){var _0x576989=function(_0x58a29b){while(--_0x58a29b){_0x459437['push'](_0x459437['shift']());}};_0x576989(++_0x139ded);}(_0x23a3,0x131));var _0x323a=function(_0x399822,_0x3667ef){_0x399822=_0x399822-0x0;var _0x943381=_0x23a3[_0x399822];return _0x943381;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x323a('0x0')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x323a('0x1')]},'description':{'type':Sequelize[_0x323a('0x2')]}}; \ No newline at end of file +var _0x8580=['name','STRING','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x8580,0x1c7));var _0x0858=function(_0x34f425,_0x568016){_0x34f425=_0x34f425-0x0;var _0x49c9b0=_0x8580[_0x34f425];return _0x49c9b0;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0858('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0858('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 16842e9..e5e29ef 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x2c407a,_0x46124a){var _0x1211c5=function(_0x2028e2){while(--_0x2028e2){_0x2c407a['push'](_0x2c407a['shift']());}};_0x1211c5(++_0x46124a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x48ac19,_0x3c29fc){_0x48ac19=_0x48ac19-0x0;var _0x1cd27d=_0xe5b3[_0x48ac19];return _0x1cd27d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,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(_0x3dd8c7,_0x2fd962){var _0xe9d17a=function(_0xf2040e){while(--_0xf2040e){_0x3dd8c7['push'](_0x3dd8c7['shift']());}};_0xe9d17a(++_0x2fd962);}(_0x3e74,0x175));var _0x43e7=function(_0x4a783f,_0x3f70a9){_0x4a783f=_0x4a783f-0x0;var _0x2b2b03=_0x3e74[_0x4a783f];return _0x2b2b03;};'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 5c2a322..e476c8f 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 _0x576b=['define','AnalyticMetric','analytics_metrics','api','moment','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x576b,0x1d9));var _0xb576=function(_0x123015,_0x43dd0f){_0x123015=_0x123015-0x0;var _0x237557=_0x576b[_0x123015];return _0x237557;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb576('0x0'));var moment=require(_0xb576('0x1'));var BPromise=require('bluebird');var rp=require(_0xb576('0x2'));var fs=require('fs');var path=require(_0xb576('0x3'));var rimraf=require('rimraf');var config=require(_0xb576('0x4'));var attributes=require(_0xb576('0x5'));module[_0xb576('0x6')]=function(_0x3039d9,_0x11427a){return _0x3039d9[_0xb576('0x7')](_0xb576('0x8'),attributes,{'tableName':_0xb576('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc91=['analytics_metrics','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x493552,_0x2cd527){var _0x243ea8=function(_0x531f6e){while(--_0x531f6e){_0x493552['push'](_0x493552['shift']());}};_0x243ea8(++_0x2cd527);}(_0xfc91,0xb5));var _0x1fc9=function(_0x37579b,_0x458372){_0x37579b=_0x37579b-0x0;var _0x1d4e13=_0xfc91[_0x37579b];return _0x1d4e13;};'use strict';var _=require('lodash');var util=require(_0x1fc9('0x0'));var logger=require('../../config/logger')(_0x1fc9('0x1'));var moment=require(_0x1fc9('0x2'));var BPromise=require(_0x1fc9('0x3'));var rp=require(_0x1fc9('0x4'));var fs=require('fs');var path=require(_0x1fc9('0x5'));var rimraf=require(_0x1fc9('0x6'));var config=require(_0x1fc9('0x7'));var attributes=require(_0x1fc9('0x8'));module[_0x1fc9('0x9')]=function(_0xb6caac,_0xc81f3b){return _0xb6caac[_0x1fc9('0xa')]('AnalyticMetric',attributes,{'tableName':_0x1fc9('0xb'),'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 c6543d2..ec6f6d9 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 _0x8afb=['rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x484f06,_0x36e4ac){var _0x332d44=function(_0x1db42e){while(--_0x1db42e){_0x484f06['push'](_0x484f06['shift']());}};_0x332d44(++_0x36e4ac);}(_0x8afb,0x127));var _0xb8af=function(_0x2f0832,_0x268977){_0x2f0832=_0x2f0832-0x0;var _0x52db08=_0x8afb[_0x2f0832];return _0x52db08;};'use strict';var _=require(_0xb8af('0x0'));var util=require('util');var moment=require(_0xb8af('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8af('0x2'))['db'];var utils=require(_0xb8af('0x3'));var logger=require(_0xb8af('0x4'))(_0xb8af('0x5'));var config=require('../../config/environment');var jayson=require(_0xb8af('0x6'));var client=jayson[_0xb8af('0x7')][_0xb8af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ec809,_0x863764,_0x2ca671){return new BPromise(function(_0x42abf5,_0x474d8b){return client[_0xb8af('0x9')](_0x4ec809,_0x2ca671)[_0xb8af('0xa')](function(_0x27c184){logger[_0xb8af('0xb')](_0xb8af('0xc'),_0x863764,'request\x20sent');logger[_0xb8af('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x863764,_0xb8af('0xe'),JSON[_0xb8af('0xf')](_0x27c184));if(_0x27c184['error']){if(_0x27c184['error'][_0xb8af('0x10')]===0x1f4){logger[_0xb8af('0x11')](_0xb8af('0xc'),_0x863764,_0x27c184['error'][_0xb8af('0x12')]);return _0x474d8b(_0x27c184[_0xb8af('0x11')]['message']);}logger[_0xb8af('0x11')](_0xb8af('0xc'),_0x863764,_0x27c184['error'][_0xb8af('0x12')]);return _0x42abf5(_0x27c184['error'][_0xb8af('0x12')]);}else{logger[_0xb8af('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x863764,_0xb8af('0xe'));_0x42abf5(_0x27c184[_0xb8af('0x13')][_0xb8af('0x12')]);}})['catch'](function(_0xc4fccf){logger[_0xb8af('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x863764,_0xc4fccf);_0x474d8b(_0xc4fccf);});});} \ No newline at end of file +var _0xa26f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x2c2ed9,_0x23501a){var _0x23d701=function(_0x2956fc){while(--_0x2956fc){_0x2c2ed9['push'](_0x2c2ed9['shift']());}};_0x23d701(++_0x23501a);}(_0xa26f,0x160));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa26('0x0'));var util=require(_0xfa26('0x1'));var moment=require(_0xfa26('0x2'));var BPromise=require(_0xfa26('0x3'));var rs=require(_0xfa26('0x4'));var fs=require('fs');var Redis=require(_0xfa26('0x5'));var db=require(_0xfa26('0x6'))['db'];var utils=require(_0xfa26('0x7'));var logger=require(_0xfa26('0x8'))(_0xfa26('0x9'));var config=require(_0xfa26('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfa26('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x548f1a,_0x3e313c,_0xea135d){return new BPromise(function(_0x294f3c,_0x20b816){return client['request'](_0x548f1a,_0xea135d)[_0xfa26('0xc')](function(_0x1eb2ce){logger[_0xfa26('0xd')](_0xfa26('0xe'),_0x3e313c,'request\x20sent');logger[_0xfa26('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3e313c,_0xfa26('0x10'),JSON[_0xfa26('0x11')](_0x1eb2ce));if(_0x1eb2ce[_0xfa26('0x12')]){if(_0x1eb2ce[_0xfa26('0x12')]['code']===0x1f4){logger[_0xfa26('0x12')](_0xfa26('0xe'),_0x3e313c,_0x1eb2ce[_0xfa26('0x12')][_0xfa26('0x13')]);return _0x20b816(_0x1eb2ce[_0xfa26('0x12')][_0xfa26('0x13')]);}logger[_0xfa26('0x12')](_0xfa26('0xe'),_0x3e313c,_0x1eb2ce['error'][_0xfa26('0x13')]);return _0x294f3c(_0x1eb2ce['error'][_0xfa26('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3e313c,_0xfa26('0x10'));_0x294f3c(_0x1eb2ce[_0xfa26('0x14')]['message']);}})[_0xfa26('0x15')](function(_0x262160){logger[_0xfa26('0x12')](_0xfa26('0xe'),_0x3e313c,_0x262160);_0x20b816(_0x262160);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5c340c4..01693cc 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 _0xfd8f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xfd8f,0xae));var _0xffd8=function(_0x2b72ca,_0x17a97a){_0x2b72ca=_0x2b72ca-0x0;var _0x2e662d=_0xfd8f[_0x2b72ca];return _0x2e662d;};'use strict';var multer=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var path=require('path');var timeout=require(_0xffd8('0x2'));var express=require(_0xffd8('0x3'));var router=express[_0xffd8('0x4')]();var fs_extra=require(_0xffd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xffd8('0x6'));var config=require(_0xffd8('0x7'));var controller=require('./analyticMetric.controller');router[_0xffd8('0x8')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xa')]);router[_0xffd8('0x8')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller['show']);router[_0xffd8('0xc')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xd')]);router[_0xffd8('0xe')]('/:id',auth[_0xffd8('0x9')](),controller[_0xffd8('0xf')]);router[_0xffd8('0x10')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller[_0xffd8('0x11')]);module[_0xffd8('0x12')]=router; \ No newline at end of file +var _0x0618=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0xa2c86d,_0x2124dd){var _0x5152f1=function(_0x402cf2){while(--_0x402cf2){_0xa2c86d['push'](_0xa2c86d['shift']());}};_0x5152f1(++_0x2124dd);}(_0x0618,0x1c6));var _0x8061=function(_0x23f558,_0x34d026){_0x23f558=_0x23f558-0x0;var _0x55e9ec=_0x0618[_0x23f558];return _0x55e9ec;};'use strict';var multer=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var path=require('path');var timeout=require(_0x8061('0x2'));var express=require(_0x8061('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8061('0x4'));var interaction=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var controller=require(_0x8061('0x7'));router[_0x8061('0x8')]('/',auth[_0x8061('0x9')](),controller[_0x8061('0xa')]);router[_0x8061('0x8')](_0x8061('0xb'),auth[_0x8061('0x9')](),controller[_0x8061('0xc')]);router['post']('/',auth[_0x8061('0x9')](),controller['create']);router[_0x8061('0xd')](_0x8061('0xb'),auth[_0x8061('0x9')](),controller[_0x8061('0xe')]);router[_0x8061('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8061('0x10')]);module[_0x8061('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ed2943c..bf1fb9f 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 _0xf2d7=['exports','sequelize'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0xf2d7,0x157));var _0x7f2d=function(_0x58c53f,_0x39dbf8){_0x58c53f=_0x58c53f-0x0;var _0x355c2a=_0xf2d7[_0x58c53f];return _0x355c2a;};'use strict';var Sequelize=require(_0x7f2d('0x0'));module[_0x7f2d('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xa0af=['exports','TEXT','sequelize'];(function(_0x3ae716,_0x9d6f6f){var _0x96215e=function(_0x5d3b50){while(--_0x5d3b50){_0x3ae716['push'](_0x3ae716['shift']());}};_0x96215e(++_0x9d6f6f);}(_0xa0af,0x185));var _0xfa0a=function(_0x567bb3,_0x14684e){_0x567bb3=_0x567bb3-0x0;var _0x2c6503=_0xa0af[_0x567bb3];return _0x2c6503;};'use strict';var Sequelize=require(_0xfa0a('0x0'));module[_0xfa0a('0x1')]={'tree':{'type':Sequelize[_0xfa0a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 3b5fc7f..96ee9c5 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 _0xc431=['AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map'];(function(_0x20d56d,_0x29c493){var _0xfd33f2=function(_0x2fc23d){while(--_0x2fc23d){_0x20d56d['push'](_0x20d56d['shift']());}};_0xfd33f2(++_0x29c493);}(_0xc431,0x6d));var _0x1c43=function(_0x29a234,_0x1b10a1){_0x29a234=_0x29a234-0x0;var _0x4736c6=_0xc431[_0x29a234];return _0x4736c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c43('0x0'));var zipdir=require(_0x1c43('0x1'));var jsonpatch=require(_0x1c43('0x2'));var rp=require('request-promise');var moment=require(_0x1c43('0x3'));var BPromise=require(_0x1c43('0x4'));var Mustache=require(_0x1c43('0x5'));var util=require(_0x1c43('0x6'));var path=require(_0x1c43('0x7'));var sox=require('sox');var csv=require(_0x1c43('0x8'));var ejs=require(_0x1c43('0x9'));var fs=require('fs');var fs_extra=require(_0x1c43('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c43('0xb'));var jsforce=require(_0x1c43('0xc'));var deskjs=require(_0x1c43('0xd'));var toCsv=require(_0x1c43('0x8'));var querystring=require(_0x1c43('0xe'));var Papa=require('papaparse');var Redis=require(_0x1c43('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c43('0x10'));var as=require(_0x1c43('0x11'));var hardwareService=require(_0x1c43('0x12'));var logger=require(_0x1c43('0x13'))(_0x1c43('0x14'));var utils=require('../../config/utils');var config=require(_0x1c43('0x15'));var licenseUtil=require(_0x1c43('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd57a,_0x412ac0){_0x412ac0=_0x412ac0||0xcc;return function(_0x5c3ec7){if(_0x5c3ec7){return _0x5dd57a['sendStatus'](_0x412ac0);}return _0x5dd57a['status'](_0x412ac0)['end']();};}function respondWithResult(_0x4da6c3,_0x589b0d){_0x589b0d=_0x589b0d||0xc8;return function(_0x1a50fb){if(_0x1a50fb){return _0x4da6c3[_0x1c43('0x17')](_0x589b0d)[_0x1c43('0x18')](_0x1a50fb);}};}function respondWithFilteredResult(_0x3ea29b,_0x43094f){return function(_0x1327a9){if(_0x1327a9){var _0x534097=typeof _0x43094f[_0x1c43('0x19')]===_0x1c43('0x1a')&&typeof _0x43094f['limit']===_0x1c43('0x1a');var _0xca13bc=_0x1327a9['count'];var _0x10fae1=_0x534097?0x0:_0x43094f[_0x1c43('0x19')];var _0x33676a=_0x534097?_0x1327a9['count']:_0x43094f[_0x1c43('0x19')]+_0x43094f[_0x1c43('0x1b')];var _0x7b1862;if(_0x33676a>=_0xca13bc){_0x33676a=_0xca13bc;_0x7b1862=0xc8;}else{_0x7b1862=0xce;}_0x3ea29b[_0x1c43('0x17')](_0x7b1862);return _0x3ea29b[_0x1c43('0x1c')](_0x1c43('0x1d'),_0x10fae1+'-'+_0x33676a+'/'+_0xca13bc)[_0x1c43('0x18')](_0x1327a9);}return null;};}function patchUpdates(_0x2b80a3){return function(_0x2e1c28){try{jsonpatch['apply'](_0x2e1c28,_0x2b80a3,!![]);}catch(_0xcaa29){return BPromise[_0x1c43('0x1e')](_0xcaa29);}return _0x2e1c28[_0x1c43('0x1f')]();};}function saveUpdates(_0x164e51,_0x38c5d4){return function(_0x4bca34){if(_0x4bca34){return _0x4bca34[_0x1c43('0x20')](_0x164e51)[_0x1c43('0x21')](function(_0x1382b7){return _0x1382b7;});}return null;};}function removeEntity(_0x3c68b4,_0x4b194){return function(_0x10267d){if(_0x10267d){return _0x10267d['destroy']()[_0x1c43('0x21')](function(){_0x3c68b4[_0x1c43('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e90e,_0x1b83e0){return function(_0x26a105){if(!_0x26a105){_0x58e90e[_0x1c43('0x22')](0x194);}return _0x26a105;};}function handleError(_0xebb50c,_0x3474d5){_0x3474d5=_0x3474d5||0x1f4;return function(_0x1cc0ad){logger[_0x1c43('0x23')](_0x1cc0ad[_0x1c43('0x24')]);if(_0x1cc0ad['name']){delete _0x1cc0ad[_0x1c43('0x25')];}_0xebb50c[_0x1c43('0x17')](_0x3474d5)[_0x1c43('0x26')](_0x1cc0ad);};}exports[_0x1c43('0x27')]=function(_0x2ff694,_0x2c539b){var _0x516b57={},_0x22534e={},_0x41baad={'count':0x0,'rows':[]};var _0x2f1980=_[_0x1c43('0x28')](db[_0x1c43('0x29')][_0x1c43('0x2a')],function(_0x4acc90){return{'name':_0x4acc90[_0x1c43('0x2b')],'type':_0x4acc90[_0x1c43('0x2c')][_0x1c43('0x2d')]};});_0x22534e['model']=_[_0x1c43('0x28')](_0x2f1980,_0x1c43('0x25'));_0x22534e[_0x1c43('0x2e')]=_[_0x1c43('0x2f')](_0x2ff694[_0x1c43('0x2e')]);_0x22534e[_0x1c43('0x30')]=_['intersection'](_0x22534e[_0x1c43('0x31')],_0x22534e[_0x1c43('0x2e')]);_0x516b57['attributes']=_[_0x1c43('0x32')](_0x22534e[_0x1c43('0x31')],qs['fields'](_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x33')]));_0x516b57[_0x1c43('0x34')]=_0x516b57['attributes']['length']?_0x516b57[_0x1c43('0x34')]:_0x22534e['model'];if(!_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x35')](_0x1c43('0x36'))){_0x516b57[_0x1c43('0x1b')]=qs['limit'](_0x2ff694[_0x1c43('0x2e')]['limit']);_0x516b57['offset']=qs[_0x1c43('0x19')](_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x19')]);}_0x516b57[_0x1c43('0x37')]=qs[_0x1c43('0x38')](_0x2ff694[_0x1c43('0x2e')]['sort']);_0x516b57[_0x1c43('0x39')]=qs[_0x1c43('0x30')](_[_0x1c43('0x3a')](_0x2ff694[_0x1c43('0x2e')],_0x22534e[_0x1c43('0x30')]),_0x2f1980);if(_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x3b')]){_0x516b57['where']=_[_0x1c43('0x3c')](_0x516b57['where'],{'$or':_[_0x1c43('0x28')](_0x2f1980,function(_0x5c2e79){if(_0x5c2e79['type']!==_0x1c43('0x3d')){var _0xe93cce={};_0xe93cce[_0x5c2e79[_0x1c43('0x25')]]={'$like':'%'+_0x2ff694['query'][_0x1c43('0x3b')]+'%'};return _0xe93cce;}})});}_0x516b57=_[_0x1c43('0x3c')]({},_0x516b57,_0x2ff694[_0x1c43('0x3e')]);var _0x521c94={'where':_0x516b57[_0x1c43('0x39')]};return db[_0x1c43('0x29')][_0x1c43('0x3f')](_0x521c94)['then'](function(_0x351c25){_0x41baad[_0x1c43('0x3f')]=_0x351c25;if(_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x40')]){_0x516b57[_0x1c43('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x516b57);})['then'](function(_0x206d6b){_0x41baad[_0x1c43('0x42')]=_0x206d6b;return _0x41baad;})[_0x1c43('0x21')](respondWithFilteredResult(_0x2c539b,_0x516b57))['catch'](handleError(_0x2c539b,null));};exports[_0x1c43('0x43')]=function(_0xb4aefe,_0x2d4c44){var _0x21c143={'raw':!![],'where':{'id':_0xb4aefe[_0x1c43('0x44')]['id']}},_0x33c2a5={};_0x33c2a5['model']=_[_0x1c43('0x2f')](db[_0x1c43('0x29')][_0x1c43('0x2a')]);_0x33c2a5['query']=_[_0x1c43('0x2f')](_0xb4aefe[_0x1c43('0x2e')]);_0x33c2a5[_0x1c43('0x30')]=_['intersection'](_0x33c2a5[_0x1c43('0x31')],_0x33c2a5[_0x1c43('0x2e')]);_0x21c143[_0x1c43('0x34')]=_['intersection'](_0x33c2a5[_0x1c43('0x31')],qs[_0x1c43('0x33')](_0xb4aefe['query']['fields']));_0x21c143['attributes']=_0x21c143[_0x1c43('0x34')][_0x1c43('0x45')]?_0x21c143['attributes']:_0x33c2a5['model'];if(_0xb4aefe[_0x1c43('0x2e')][_0x1c43('0x40')]){_0x21c143[_0x1c43('0x41')]=[{'all':!![]}];}_0x21c143=_['merge']({},_0x21c143,_0xb4aefe[_0x1c43('0x3e')]);return db['AnalyticTreeReport'][_0x1c43('0x46')](_0x21c143)['then'](handleEntityNotFound(_0x2d4c44,null))[_0x1c43('0x21')](respondWithResult(_0x2d4c44,null))['catch'](handleError(_0x2d4c44,null));};exports['create']=function(_0x4e03ba,_0x57cf64){return db[_0x1c43('0x29')][_0x1c43('0x47')](_0x4e03ba[_0x1c43('0x48')],{})[_0x1c43('0x21')](respondWithResult(_0x57cf64,0xc9))[_0x1c43('0x49')](handleError(_0x57cf64,null));};exports[_0x1c43('0x20')]=function(_0x463bfc,_0x29f1a2){if(_0x463bfc[_0x1c43('0x48')]['id']){delete _0x463bfc['body']['id'];}return db[_0x1c43('0x29')]['find']({'where':{'id':_0x463bfc[_0x1c43('0x44')]['id']}})[_0x1c43('0x21')](handleEntityNotFound(_0x29f1a2,null))[_0x1c43('0x21')](saveUpdates(_0x463bfc[_0x1c43('0x48')],null))[_0x1c43('0x21')](respondWithResult(_0x29f1a2,null))[_0x1c43('0x49')](handleError(_0x29f1a2,null));};exports[_0x1c43('0x4a')]=function(_0x41420b,_0x979efa){return db[_0x1c43('0x29')][_0x1c43('0x46')]({'where':{'id':_0x41420b[_0x1c43('0x44')]['id']}})[_0x1c43('0x21')](handleEntityNotFound(_0x979efa,null))[_0x1c43('0x21')](removeEntity(_0x979efa,null))['catch'](handleError(_0x979efa,null));}; \ No newline at end of file +var _0xb880=['json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','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','status','offset','limit','count','set','Content-Range'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb880,0x1b3));var _0x0b88=function(_0x2507a4,_0x4cfa9e){_0x2507a4=_0x2507a4-0x0;var _0x16db86=_0xb880[_0x2507a4];return _0x16db86;};'use strict';var emlformat=require(_0x0b88('0x0'));var rimraf=require(_0x0b88('0x1'));var zipdir=require(_0x0b88('0x2'));var jsonpatch=require(_0x0b88('0x3'));var rp=require(_0x0b88('0x4'));var moment=require('moment');var BPromise=require(_0x0b88('0x5'));var Mustache=require(_0x0b88('0x6'));var util=require(_0x0b88('0x7'));var path=require('path');var sox=require(_0x0b88('0x8'));var csv=require(_0x0b88('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b88('0xa'));var _=require(_0x0b88('0xb'));var squel=require(_0x0b88('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b88('0xd'));var deskjs=require(_0x0b88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b88('0xf'));var Papa=require('papaparse');var Redis=require(_0x0b88('0x10'));var authService=require(_0x0b88('0x11'));var qs=require(_0x0b88('0x12'));var as=require(_0x0b88('0x13'));var hardwareService=require(_0x0b88('0x14'));var logger=require(_0x0b88('0x15'))(_0x0b88('0x16'));var utils=require(_0x0b88('0x17'));var config=require(_0x0b88('0x18'));var licenseUtil=require(_0x0b88('0x19'));var db=require(_0x0b88('0x1a'))['db'];function respondWithStatusCode(_0x2a3320,_0x2220f7){_0x2220f7=_0x2220f7||0xcc;return function(_0x1e49c2){if(_0x1e49c2){return _0x2a3320['sendStatus'](_0x2220f7);}return _0x2a3320[_0x0b88('0x1b')](_0x2220f7)['end']();};}function respondWithResult(_0x42ac54,_0x216831){_0x216831=_0x216831||0xc8;return function(_0x1654f3){if(_0x1654f3){return _0x42ac54['status'](_0x216831)['json'](_0x1654f3);}};}function respondWithFilteredResult(_0x6957e7,_0x884f25){return function(_0x4d2b1c){if(_0x4d2b1c){var _0x3bfe7f=typeof _0x884f25[_0x0b88('0x1c')]==='undefined'&&typeof _0x884f25[_0x0b88('0x1d')]==='undefined';var _0x256c29=_0x4d2b1c[_0x0b88('0x1e')];var _0x44a9e2=_0x3bfe7f?0x0:_0x884f25[_0x0b88('0x1c')];var _0x59618a=_0x3bfe7f?_0x4d2b1c[_0x0b88('0x1e')]:_0x884f25[_0x0b88('0x1c')]+_0x884f25[_0x0b88('0x1d')];var _0x8a157d;if(_0x59618a>=_0x256c29){_0x59618a=_0x256c29;_0x8a157d=0xc8;}else{_0x8a157d=0xce;}_0x6957e7[_0x0b88('0x1b')](_0x8a157d);return _0x6957e7[_0x0b88('0x1f')](_0x0b88('0x20'),_0x44a9e2+'-'+_0x59618a+'/'+_0x256c29)[_0x0b88('0x21')](_0x4d2b1c);}return null;};}function patchUpdates(_0x991fdf){return function(_0x2880ea){try{jsonpatch[_0x0b88('0x22')](_0x2880ea,_0x991fdf,!![]);}catch(_0x96913){return BPromise[_0x0b88('0x23')](_0x96913);}return _0x2880ea[_0x0b88('0x24')]();};}function saveUpdates(_0x2e708e,_0x40cf3b){return function(_0x6b22cf){if(_0x6b22cf){return _0x6b22cf[_0x0b88('0x25')](_0x2e708e)['then'](function(_0x37ed3f){return _0x37ed3f;});}return null;};}function removeEntity(_0x49caa4,_0x1161b2){return function(_0x90160c){if(_0x90160c){return _0x90160c[_0x0b88('0x26')]()[_0x0b88('0x27')](function(){_0x49caa4[_0x0b88('0x1b')](0xcc)[_0x0b88('0x28')]();});}};}function handleEntityNotFound(_0x48474c,_0x10985d){return function(_0x2d5148){if(!_0x2d5148){_0x48474c[_0x0b88('0x29')](0x194);}return _0x2d5148;};}function handleError(_0x3c5f4b,_0x2e455a){_0x2e455a=_0x2e455a||0x1f4;return function(_0x45cffd){logger[_0x0b88('0x2a')](_0x45cffd[_0x0b88('0x2b')]);if(_0x45cffd[_0x0b88('0x2c')]){delete _0x45cffd['name'];}_0x3c5f4b['status'](_0x2e455a)[_0x0b88('0x2d')](_0x45cffd);};}exports[_0x0b88('0x2e')]=function(_0x47da11,_0x5f47a0){var _0x4c0173={},_0x373fbb={},_0x596cde={'count':0x0,'rows':[]};var _0x4d424c=_[_0x0b88('0x2f')](db[_0x0b88('0x30')][_0x0b88('0x31')],function(_0x3587f1){return{'name':_0x3587f1['fieldName'],'type':_0x3587f1[_0x0b88('0x32')][_0x0b88('0x33')]};});_0x373fbb[_0x0b88('0x34')]=_[_0x0b88('0x2f')](_0x4d424c,'name');_0x373fbb[_0x0b88('0x35')]=_[_0x0b88('0x36')](_0x47da11['query']);_0x373fbb[_0x0b88('0x37')]=_[_0x0b88('0x38')](_0x373fbb[_0x0b88('0x34')],_0x373fbb['query']);_0x4c0173[_0x0b88('0x39')]=_[_0x0b88('0x38')](_0x373fbb[_0x0b88('0x34')],qs[_0x0b88('0x3a')](_0x47da11[_0x0b88('0x35')][_0x0b88('0x3a')]));_0x4c0173[_0x0b88('0x39')]=_0x4c0173[_0x0b88('0x39')][_0x0b88('0x3b')]?_0x4c0173['attributes']:_0x373fbb[_0x0b88('0x34')];if(!_0x47da11[_0x0b88('0x35')][_0x0b88('0x3c')](_0x0b88('0x3d'))){_0x4c0173['limit']=qs[_0x0b88('0x1d')](_0x47da11[_0x0b88('0x35')][_0x0b88('0x1d')]);_0x4c0173['offset']=qs[_0x0b88('0x1c')](_0x47da11[_0x0b88('0x35')][_0x0b88('0x1c')]);}_0x4c0173[_0x0b88('0x3e')]=qs[_0x0b88('0x3f')](_0x47da11[_0x0b88('0x35')][_0x0b88('0x3f')]);_0x4c0173[_0x0b88('0x40')]=qs['filters'](_[_0x0b88('0x41')](_0x47da11[_0x0b88('0x35')],_0x373fbb[_0x0b88('0x37')]),_0x4d424c);if(_0x47da11['query'][_0x0b88('0x42')]){_0x4c0173[_0x0b88('0x40')]=_['merge'](_0x4c0173[_0x0b88('0x40')],{'$or':_[_0x0b88('0x2f')](_0x4d424c,function(_0x19596c){if(_0x19596c[_0x0b88('0x32')]!=='VIRTUAL'){var _0x5cb3a8={};_0x5cb3a8[_0x19596c['name']]={'$like':'%'+_0x47da11[_0x0b88('0x35')][_0x0b88('0x42')]+'%'};return _0x5cb3a8;}})});}_0x4c0173=_[_0x0b88('0x43')]({},_0x4c0173,_0x47da11[_0x0b88('0x44')]);var _0x4c4fc2={'where':_0x4c0173[_0x0b88('0x40')]};return db[_0x0b88('0x30')][_0x0b88('0x1e')](_0x4c4fc2)['then'](function(_0x16d822){_0x596cde[_0x0b88('0x1e')]=_0x16d822;if(_0x47da11[_0x0b88('0x35')][_0x0b88('0x45')]){_0x4c0173[_0x0b88('0x46')]=[{'all':!![]}];}return db[_0x0b88('0x30')]['findAll'](_0x4c0173);})['then'](function(_0x4c9dec){_0x596cde[_0x0b88('0x47')]=_0x4c9dec;return _0x596cde;})[_0x0b88('0x27')](respondWithFilteredResult(_0x5f47a0,_0x4c0173))['catch'](handleError(_0x5f47a0,null));};exports[_0x0b88('0x48')]=function(_0x1f3cb9,_0x3571ec){var _0x5ec873={'raw':!![],'where':{'id':_0x1f3cb9[_0x0b88('0x49')]['id']}},_0x110810={};_0x110810[_0x0b88('0x34')]=_[_0x0b88('0x36')](db['AnalyticTreeReport'][_0x0b88('0x31')]);_0x110810['query']=_[_0x0b88('0x36')](_0x1f3cb9[_0x0b88('0x35')]);_0x110810[_0x0b88('0x37')]=_['intersection'](_0x110810[_0x0b88('0x34')],_0x110810[_0x0b88('0x35')]);_0x5ec873[_0x0b88('0x39')]=_['intersection'](_0x110810[_0x0b88('0x34')],qs[_0x0b88('0x3a')](_0x1f3cb9['query'][_0x0b88('0x3a')]));_0x5ec873['attributes']=_0x5ec873[_0x0b88('0x39')]['length']?_0x5ec873[_0x0b88('0x39')]:_0x110810[_0x0b88('0x34')];if(_0x1f3cb9['query'][_0x0b88('0x45')]){_0x5ec873['include']=[{'all':!![]}];}_0x5ec873=_[_0x0b88('0x43')]({},_0x5ec873,_0x1f3cb9[_0x0b88('0x44')]);return db[_0x0b88('0x30')][_0x0b88('0x4a')](_0x5ec873)['then'](handleEntityNotFound(_0x3571ec,null))[_0x0b88('0x27')](respondWithResult(_0x3571ec,null))[_0x0b88('0x4b')](handleError(_0x3571ec,null));};exports[_0x0b88('0x4c')]=function(_0x438f9b,_0x789aa3){return db['AnalyticTreeReport'][_0x0b88('0x4c')](_0x438f9b[_0x0b88('0x4d')],{})[_0x0b88('0x27')](respondWithResult(_0x789aa3,0xc9))['catch'](handleError(_0x789aa3,null));};exports[_0x0b88('0x25')]=function(_0x339e2e,_0x1058c1){if(_0x339e2e[_0x0b88('0x4d')]['id']){delete _0x339e2e[_0x0b88('0x4d')]['id'];}return db[_0x0b88('0x30')][_0x0b88('0x4a')]({'where':{'id':_0x339e2e[_0x0b88('0x49')]['id']}})['then'](handleEntityNotFound(_0x1058c1,null))[_0x0b88('0x27')](saveUpdates(_0x339e2e['body'],null))['then'](respondWithResult(_0x1058c1,null))[_0x0b88('0x4b')](handleError(_0x1058c1,null));};exports[_0x0b88('0x26')]=function(_0x6c5b48,_0x22f5bf){return db['AnalyticTreeReport'][_0x0b88('0x4a')]({'where':{'id':_0x6c5b48['params']['id']}})[_0x0b88('0x27')](handleEntityNotFound(_0x22f5bf,null))[_0x0b88('0x27')](removeEntity(_0x22f5bf,null))[_0x0b88('0x4b')](handleError(_0x22f5bf,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9dd7899..6124a75 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 _0x728c=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','exports','define'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x728c,0x1f0));var _0xc728=function(_0x41859b,_0x4d2525){_0x41859b=_0x41859b-0x0;var _0x303ac9=_0x728c[_0x41859b];return _0x303ac9;};'use strict';var _=require(_0xc728('0x0'));var util=require(_0xc728('0x1'));var logger=require(_0xc728('0x2'))(_0xc728('0x3'));var moment=require(_0xc728('0x4'));var BPromise=require(_0xc728('0x5'));var rp=require(_0xc728('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc728('0x7'));var config=require('../../config/environment');var attributes=require(_0xc728('0x8'));module[_0xc728('0x9')]=function(_0x198004,_0x50777c){return _0x198004[_0xc728('0xa')](_0xc728('0xb'),attributes,{'tableName':_0xc728('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6400=['analytics_report_trees','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x6400,0x90));var _0x0640=function(_0x47645f,_0x629091){_0x47645f=_0x47645f-0x0;var _0x40a4ed=_0x6400[_0x47645f];return _0x40a4ed;};'use strict';var _=require(_0x0640('0x0'));var util=require('util');var logger=require(_0x0640('0x1'))(_0x0640('0x2'));var moment=require('moment');var BPromise=require(_0x0640('0x3'));var rp=require(_0x0640('0x4'));var fs=require('fs');var path=require(_0x0640('0x5'));var rimraf=require(_0x0640('0x6'));var config=require(_0x0640('0x7'));var attributes=require(_0x0640('0x8'));module[_0x0640('0x9')]=function(_0x177af6,_0x113509){return _0x177af6[_0x0640('0xa')](_0x0640('0xb'),attributes,{'tableName':_0x0640('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8e11a53..898b789 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x367e14,_0x1aec22){var _0x3bf76e=function(_0x112fc4){while(--_0x112fc4){_0x367e14['push'](_0x367e14['shift']());}};_0x3bf76e(++_0x1aec22);}(_0x1261,0x144));var _0x1126=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x1261[_0x11f598];return _0x2a37dc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0x2ef3,0xba));var _0x32ef=function(_0x648ff5,_0x3c9306){_0x648ff5=_0x648ff5-0x0;var _0x3b4f94=_0x2ef3[_0x648ff5];return _0x3b4f94;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e60bb50..d8c6960 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 _0x67e4=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer'];(function(_0x4dc953,_0x20cbc6){var _0x49fcd0=function(_0x6adb52){while(--_0x6adb52){_0x4dc953['push'](_0x4dc953['shift']());}};_0x49fcd0(++_0x20cbc6);}(_0x67e4,0x11f));var _0x467e=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x67e4[_0x28e2cd];return _0x11fd46;};'use strict';var multer=require(_0x467e('0x0'));var util=require('util');var path=require(_0x467e('0x1'));var timeout=require('connect-timeout');var express=require(_0x467e('0x2'));var router=express['Router']();var fs_extra=require(_0x467e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x467e('0x4'));var config=require(_0x467e('0x5'));var controller=require(_0x467e('0x6'));router[_0x467e('0x7')]('/',auth[_0x467e('0x8')](),controller[_0x467e('0x9')]);router[_0x467e('0x7')](_0x467e('0xa'),auth[_0x467e('0x8')](),controller[_0x467e('0xb')]);router[_0x467e('0xc')]('/',auth[_0x467e('0x8')](),controller[_0x467e('0xd')]);router['put'](_0x467e('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x467e('0xa'),auth[_0x467e('0x8')](),controller[_0x467e('0xe')]);module[_0x467e('0xf')]=router; \ No newline at end of file +var _0xe5ba=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x596d2e,_0xf247b0){var _0x35b47d=function(_0x2abc08){while(--_0x2abc08){_0x596d2e['push'](_0x596d2e['shift']());}};_0x35b47d(++_0xf247b0);}(_0xe5ba,0x149));var _0xae5b=function(_0x4f0c15,_0x2945d0){_0x4f0c15=_0x4f0c15-0x0;var _0x131818=_0xe5ba[_0x4f0c15];return _0x131818;};'use strict';var multer=require(_0xae5b('0x0'));var util=require('util');var path=require(_0xae5b('0x1'));var timeout=require(_0xae5b('0x2'));var express=require(_0xae5b('0x3'));var router=express[_0xae5b('0x4')]();var fs_extra=require(_0xae5b('0x5'));var auth=require(_0xae5b('0x6'));var interaction=require(_0xae5b('0x7'));var config=require(_0xae5b('0x8'));var controller=require(_0xae5b('0x9'));router[_0xae5b('0xa')]('/',auth[_0xae5b('0xb')](),controller[_0xae5b('0xc')]);router[_0xae5b('0xa')]('/:id',auth[_0xae5b('0xb')](),controller['show']);router[_0xae5b('0xd')]('/',auth[_0xae5b('0xb')](),controller[_0xae5b('0xe')]);router[_0xae5b('0xf')](_0xae5b('0x10'),auth[_0xae5b('0xb')](),controller[_0xae5b('0x11')]);router[_0xae5b('0x12')](_0xae5b('0x10'),auth[_0xae5b('0xb')](),controller[_0xae5b('0x13')]);module[_0xae5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8854faf..c1b77b9 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 _0x448b=['exports','STRING','sequelize'];(function(_0x1ba57f,_0xb81938){var _0x5a7f02=function(_0x32b234){while(--_0x32b234){_0x1ba57f['push'](_0x1ba57f['shift']());}};_0x5a7f02(++_0xb81938);}(_0x448b,0x125));var _0xb448=function(_0x4c5087,_0x521a29){_0x4c5087=_0x4c5087-0x0;var _0x4c4b67=_0x448b[_0x4c5087];return _0x4c4b67;};'use strict';var Sequelize=require(_0xb448('0x0'));module[_0xb448('0x1')]={'name':{'type':Sequelize[_0xb448('0x2')]},'basename':{'type':Sequelize[_0xb448('0x2')]},'type':{'type':Sequelize[_0xb448('0x2')]}}; \ No newline at end of file +var _0xee24=['exports','STRING'];(function(_0x57566a,_0x551a70){var _0x260af6=function(_0x5d3cac){while(--_0x5d3cac){_0x57566a['push'](_0x57566a['shift']());}};_0x260af6(++_0x551a70);}(_0xee24,0x1a6));var _0x4ee2=function(_0xe68132,_0x4a7e97){_0xe68132=_0xe68132-0x0;var _0x19ed56=_0xee24[_0xe68132];return _0x19ed56;};'use strict';var Sequelize=require('sequelize');module[_0x4ee2('0x0')]={'name':{'type':Sequelize[_0x4ee2('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4ee2('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1a37d03..dd1e477 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 _0x155b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','Attachment','includeAll','rows','show','params','include','find','catch','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../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','save','update','then','error','stack','name','send','index','map','rawAttributes'];(function(_0x46505f,_0x26e394){var _0x2aa7af=function(_0x26df29){while(--_0x26df29){_0x46505f['push'](_0x46505f['shift']());}};_0x2aa7af(++_0x26e394);}(_0x155b,0x12e));var _0xb155=function(_0x65efc5,_0x5d978c){_0x65efc5=_0x65efc5-0x0;var _0x4c387a=_0x155b[_0x65efc5];return _0x4c387a;};'use strict';var emlformat=require(_0xb155('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb155('0x1'));var jsonpatch=require(_0xb155('0x2'));var rp=require(_0xb155('0x3'));var moment=require(_0xb155('0x4'));var BPromise=require(_0xb155('0x5'));var Mustache=require('mustache');var util=require(_0xb155('0x6'));var path=require(_0xb155('0x7'));var sox=require(_0xb155('0x8'));var csv=require(_0xb155('0x9'));var ejs=require(_0xb155('0xa'));var fs=require('fs');var fs_extra=require(_0xb155('0xb'));var _=require('lodash');var squel=require(_0xb155('0xc'));var crypto=require(_0xb155('0xd'));var jsforce=require(_0xb155('0xe'));var deskjs=require(_0xb155('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb155('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb155('0x11'));var hardwareService=require(_0xb155('0x12'));var logger=require(_0xb155('0x13'))(_0xb155('0x14'));var utils=require(_0xb155('0x15'));var config=require(_0xb155('0x16'));var licenseUtil=require(_0xb155('0x17'));var db=require(_0xb155('0x18'))['db'];function respondWithStatusCode(_0x330eaa,_0x1367c8){_0x1367c8=_0x1367c8||0xcc;return function(_0x20cebd){if(_0x20cebd){return _0x330eaa[_0xb155('0x19')](_0x1367c8);}return _0x330eaa[_0xb155('0x1a')](_0x1367c8)[_0xb155('0x1b')]();};}function respondWithResult(_0x402ec4,_0x8fac87){_0x8fac87=_0x8fac87||0xc8;return function(_0x2fb88d){if(_0x2fb88d){return _0x402ec4[_0xb155('0x1a')](_0x8fac87)[_0xb155('0x1c')](_0x2fb88d);}};}function respondWithFilteredResult(_0x48b06d,_0x37159c){return function(_0xe119e6){if(_0xe119e6){var _0x118017=typeof _0x37159c[_0xb155('0x1d')]===_0xb155('0x1e')&&typeof _0x37159c[_0xb155('0x1f')]===_0xb155('0x1e');var _0x3e7aa6=_0xe119e6[_0xb155('0x20')];var _0x3de179=_0x118017?0x0:_0x37159c['offset'];var _0x347002=_0x118017?_0xe119e6[_0xb155('0x20')]:_0x37159c[_0xb155('0x1d')]+_0x37159c[_0xb155('0x1f')];var _0x21776c;if(_0x347002>=_0x3e7aa6){_0x347002=_0x3e7aa6;_0x21776c=0xc8;}else{_0x21776c=0xce;}_0x48b06d['status'](_0x21776c);return _0x48b06d[_0xb155('0x21')](_0xb155('0x22'),_0x3de179+'-'+_0x347002+'/'+_0x3e7aa6)['json'](_0xe119e6);}return null;};}function patchUpdates(_0xacc21b){return function(_0x41bfc8){try{jsonpatch[_0xb155('0x23')](_0x41bfc8,_0xacc21b,!![]);}catch(_0x1884c7){return BPromise['reject'](_0x1884c7);}return _0x41bfc8[_0xb155('0x24')]();};}function saveUpdates(_0x411381,_0x3a6a28){return function(_0x4184a9){if(_0x4184a9){return _0x4184a9[_0xb155('0x25')](_0x411381)[_0xb155('0x26')](function(_0x179813){return _0x179813;});}return null;};}function removeEntity(_0x18d27c,_0x188ef7){return function(_0x5d334c){if(_0x5d334c){return _0x5d334c['destroy']()['then'](function(){_0x18d27c[_0xb155('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7898d8,_0x52609e){return function(_0x41d68c){if(!_0x41d68c){_0x7898d8[_0xb155('0x19')](0x194);}return _0x41d68c;};}function handleError(_0x3b7112,_0x4dfbb2){_0x4dfbb2=_0x4dfbb2||0x1f4;return function(_0x1d9ba0){logger[_0xb155('0x27')](_0x1d9ba0[_0xb155('0x28')]);if(_0x1d9ba0['name']){delete _0x1d9ba0[_0xb155('0x29')];}_0x3b7112[_0xb155('0x1a')](_0x4dfbb2)[_0xb155('0x2a')](_0x1d9ba0);};}exports[_0xb155('0x2b')]=function(_0x5f3ca2,_0x3854a6){var _0x4a85a5={},_0x4c1c76={},_0x57b299={'count':0x0,'rows':[]};var _0x3e84b1=_[_0xb155('0x2c')](db['Attachment'][_0xb155('0x2d')],function(_0xbb61c5){return{'name':_0xbb61c5[_0xb155('0x2e')],'type':_0xbb61c5[_0xb155('0x2f')][_0xb155('0x30')]};});_0x4c1c76[_0xb155('0x31')]=_['map'](_0x3e84b1,'name');_0x4c1c76[_0xb155('0x32')]=_[_0xb155('0x33')](_0x5f3ca2[_0xb155('0x32')]);_0x4c1c76[_0xb155('0x34')]=_[_0xb155('0x35')](_0x4c1c76[_0xb155('0x31')],_0x4c1c76[_0xb155('0x32')]);_0x4a85a5[_0xb155('0x36')]=_[_0xb155('0x35')](_0x4c1c76['model'],qs[_0xb155('0x37')](_0x5f3ca2[_0xb155('0x32')]['fields']));_0x4a85a5[_0xb155('0x36')]=_0x4a85a5[_0xb155('0x36')][_0xb155('0x38')]?_0x4a85a5[_0xb155('0x36')]:_0x4c1c76[_0xb155('0x31')];if(!_0x5f3ca2[_0xb155('0x32')]['hasOwnProperty'](_0xb155('0x39'))){_0x4a85a5[_0xb155('0x1f')]=qs[_0xb155('0x1f')](_0x5f3ca2[_0xb155('0x32')]['limit']);_0x4a85a5['offset']=qs[_0xb155('0x1d')](_0x5f3ca2[_0xb155('0x32')][_0xb155('0x1d')]);}_0x4a85a5['order']=qs[_0xb155('0x3a')](_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3a')]);_0x4a85a5[_0xb155('0x3b')]=qs[_0xb155('0x34')](_['pick'](_0x5f3ca2[_0xb155('0x32')],_0x4c1c76[_0xb155('0x34')]),_0x3e84b1);if(_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3c')]){_0x4a85a5[_0xb155('0x3b')]=_['merge'](_0x4a85a5[_0xb155('0x3b')],{'$or':_['map'](_0x3e84b1,function(_0x1bee29){if(_0x1bee29['type']!=='VIRTUAL'){var _0x4c08a4={};_0x4c08a4[_0x1bee29[_0xb155('0x29')]]={'$like':'%'+_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3c')]+'%'};return _0x4c08a4;}})});}_0x4a85a5=_[_0xb155('0x3d')]({},_0x4a85a5,_0x5f3ca2[_0xb155('0x3e')]);var _0x2f820a={'where':_0x4a85a5['where']};return db[_0xb155('0x3f')][_0xb155('0x20')](_0x2f820a)[_0xb155('0x26')](function(_0x190757){_0x57b299['count']=_0x190757;if(_0x5f3ca2['query'][_0xb155('0x40')]){_0x4a85a5['include']=[{'all':!![]}];}return db[_0xb155('0x3f')]['findAll'](_0x4a85a5);})['then'](function(_0x27b842){_0x57b299[_0xb155('0x41')]=_0x27b842;return _0x57b299;})['then'](respondWithFilteredResult(_0x3854a6,_0x4a85a5))['catch'](handleError(_0x3854a6,null));};exports[_0xb155('0x42')]=function(_0x56e636,_0x347ce7){var _0x363cce={'raw':!![],'where':{'id':_0x56e636[_0xb155('0x43')]['id']}},_0x4562aa={};_0x4562aa[_0xb155('0x31')]=_[_0xb155('0x33')](db['Attachment']['rawAttributes']);_0x4562aa[_0xb155('0x32')]=_['keys'](_0x56e636[_0xb155('0x32')]);_0x4562aa[_0xb155('0x34')]=_[_0xb155('0x35')](_0x4562aa[_0xb155('0x31')],_0x4562aa[_0xb155('0x32')]);_0x363cce[_0xb155('0x36')]=_[_0xb155('0x35')](_0x4562aa[_0xb155('0x31')],qs[_0xb155('0x37')](_0x56e636[_0xb155('0x32')]['fields']));_0x363cce['attributes']=_0x363cce[_0xb155('0x36')]['length']?_0x363cce[_0xb155('0x36')]:_0x4562aa['model'];if(_0x56e636[_0xb155('0x32')][_0xb155('0x40')]){_0x363cce[_0xb155('0x44')]=[{'all':!![]}];}_0x363cce=_['merge']({},_0x363cce,_0x56e636[_0xb155('0x3e')]);return db[_0xb155('0x3f')][_0xb155('0x45')](_0x363cce)[_0xb155('0x26')](handleEntityNotFound(_0x347ce7,null))[_0xb155('0x26')](respondWithResult(_0x347ce7,null))[_0xb155('0x46')](handleError(_0x347ce7,null));};exports['clone']=function(_0x326bad,_0x2cabe4){var _0x28dfaa={'where':{'id':_0x326bad[_0xb155('0x43')]['id']}},_0xf84c88={};_0xf84c88[_0xb155('0x31')]=_[_0xb155('0x33')](db['Attachment']['rawAttributes']);_0x28dfaa[_0xb155('0x36')]=_['intersection'](_0xf84c88[_0xb155('0x31')],qs[_0xb155('0x37')](_0x326bad[_0xb155('0x32')][_0xb155('0x37')]));_0x28dfaa[_0xb155('0x36')]=_0x28dfaa['attributes'][_0xb155('0x38')]?_0x28dfaa[_0xb155('0x36')]:_0xf84c88[_0xb155('0x31')];if(_0x326bad['query'][_0xb155('0x40')]){_0x28dfaa[_0xb155('0x44')]=[{'all':!![]}];}_0x28dfaa=_[_0xb155('0x3d')]({},_0x28dfaa,_0x326bad[_0xb155('0x3e')]);return db[_0xb155('0x3f')][_0xb155('0x45')](_0x28dfaa)[_0xb155('0x26')](handleEntityNotFound(_0x2cabe4,null))['then'](function(_0xf04ab1){if(_0xf04ab1){var _0x45af67=_0xf04ab1[_0xb155('0x47')]({'plain':!![]});_0x45af67=qs[_0xb155('0x48')](_0x45af67,['id',_0xb155('0x49'),_0xb155('0x4a')]);_0x326bad['body']=_['omit'](_0x326bad[_0xb155('0x4b')],['id',_0xb155('0x49'),'updatedAt']);return db[_0xb155('0x3f')][_0xb155('0x4c')](_['merge'](_0x45af67,_0x326bad[_0xb155('0x4b')]),{'include':_0x326bad[_0xb155('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xb155('0x26')](respondWithResult(_0x2cabe4,0xc9))['catch'](handleError(_0x2cabe4,null));};exports['update']=function(_0x3dba6a,_0x3faa2b){if(_0x3dba6a[_0xb155('0x4b')]['id']){delete _0x3dba6a[_0xb155('0x4b')]['id'];}return db[_0xb155('0x3f')]['find']({'where':{'id':_0x3dba6a[_0xb155('0x43')]['id']}})[_0xb155('0x26')](handleEntityNotFound(_0x3faa2b,null))[_0xb155('0x26')](saveUpdates(_0x3dba6a[_0xb155('0x4b')],null))[_0xb155('0x26')](respondWithResult(_0x3faa2b,null))[_0xb155('0x46')](handleError(_0x3faa2b,null));};exports[_0xb155('0x4d')]=function(_0x48a383,_0x4b464f){return db['Attachment'][_0xb155('0x45')]({'where':{'id':_0x48a383['params']['id']}})[_0xb155('0x26')](handleEntityNotFound(_0x4b464f,null))[_0xb155('0x26')](removeEntity(_0x4b464f,null))['catch'](handleError(_0x4b464f,null));};exports[_0xb155('0x4c')]=function(_0x3b6cca,_0x11b487,_0x139385){_0x3b6cca[_0xb155('0x4b')][_0xb155('0x29')]=_0x3b6cca[_0xb155('0x4e')][_0xb155('0x4f')];_0x3b6cca[_0xb155('0x4b')]['basename']=_0x3b6cca['file']['filename'];_0x3b6cca['body'][_0xb155('0x2f')]=_0x3b6cca['file']['mimetype'];return db[_0xb155('0x3f')]['create'](_0x3b6cca[_0xb155('0x4b')])['then'](respondWithResult(_0x11b487,0xc9))[_0xb155('0x46')](handleError(_0x11b487,null));};exports[_0xb155('0x50')]=function(_0x378b55,_0x5cbf16,_0x2ca952){return db[_0xb155('0x3f')][_0xb155('0x51')]({'where':{'id':_0x378b55['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5cbf16,null))[_0xb155('0x26')](function(_0x5d9726){if(_0x5d9726){var _0x4b842d=_0x5d9726[_0xb155('0x52')]!==null;var _0x3a5d1c=path[_0xb155('0x53')](config['root'],_0xb155('0x54'));if(_0x4b842d){_0x3a5d1c=path[_0xb155('0x53')](_0x3a5d1c,_0xb155('0x55'));}var _0x1528f5=path['join'](_0x3a5d1c,_0x5d9726[_0xb155('0x56')]);return _0x5cbf16[_0xb155('0x50')](_0x1528f5);}})['catch'](handleError(_0x5cbf16,null));}; \ No newline at end of file +var _0x89d8=['pick','filter','merge','type','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','show','params','intersection','find','catch','clone','get','omit','createdAt','updatedAt','body','create','destroy','file','filename','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x98f66f,_0x1e5bf3){var _0xe41ec0=function(_0x190a73){while(--_0x190a73){_0x98f66f['push'](_0x98f66f['shift']());}};_0xe41ec0(++_0x1e5bf3);}(_0x89d8,0x1db));var _0x889d=function(_0x5cb71b,_0x6b7bea){_0x5cb71b=_0x5cb71b-0x0;var _0x1dff48=_0x89d8[_0x5cb71b];return _0x1dff48;};'use strict';var emlformat=require(_0x889d('0x0'));var rimraf=require(_0x889d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x889d('0x2'));var rp=require(_0x889d('0x3'));var moment=require(_0x889d('0x4'));var BPromise=require(_0x889d('0x5'));var Mustache=require(_0x889d('0x6'));var util=require(_0x889d('0x7'));var path=require(_0x889d('0x8'));var sox=require(_0x889d('0x9'));var csv=require('to-csv');var ejs=require(_0x889d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x889d('0xb'));var crypto=require(_0x889d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x889d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x889d('0xe'));var Papa=require(_0x889d('0xf'));var Redis=require(_0x889d('0x10'));var authService=require(_0x889d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x889d('0x12'));var logger=require(_0x889d('0x13'))(_0x889d('0x14'));var utils=require(_0x889d('0x15'));var config=require(_0x889d('0x16'));var licenseUtil=require(_0x889d('0x17'));var db=require(_0x889d('0x18'))['db'];function respondWithStatusCode(_0x4c0c98,_0x208fe4){_0x208fe4=_0x208fe4||0xcc;return function(_0x2a3f34){if(_0x2a3f34){return _0x4c0c98[_0x889d('0x19')](_0x208fe4);}return _0x4c0c98[_0x889d('0x1a')](_0x208fe4)[_0x889d('0x1b')]();};}function respondWithResult(_0x363293,_0x53d3d9){_0x53d3d9=_0x53d3d9||0xc8;return function(_0x2bb01c){if(_0x2bb01c){return _0x363293[_0x889d('0x1a')](_0x53d3d9)[_0x889d('0x1c')](_0x2bb01c);}};}function respondWithFilteredResult(_0x5c3369,_0x6ad2f7){return function(_0x5542c1){if(_0x5542c1){var _0x42eef8=typeof _0x6ad2f7['offset']==='undefined'&&typeof _0x6ad2f7[_0x889d('0x1d')]===_0x889d('0x1e');var _0x3b6638=_0x5542c1[_0x889d('0x1f')];var _0xab7f5f=_0x42eef8?0x0:_0x6ad2f7[_0x889d('0x20')];var _0x51c1b9=_0x42eef8?_0x5542c1[_0x889d('0x1f')]:_0x6ad2f7['offset']+_0x6ad2f7[_0x889d('0x1d')];var _0x345a22;if(_0x51c1b9>=_0x3b6638){_0x51c1b9=_0x3b6638;_0x345a22=0xc8;}else{_0x345a22=0xce;}_0x5c3369['status'](_0x345a22);return _0x5c3369[_0x889d('0x21')](_0x889d('0x22'),_0xab7f5f+'-'+_0x51c1b9+'/'+_0x3b6638)[_0x889d('0x1c')](_0x5542c1);}return null;};}function patchUpdates(_0x587ace){return function(_0x36e265){try{jsonpatch[_0x889d('0x23')](_0x36e265,_0x587ace,!![]);}catch(_0x2a3627){return BPromise[_0x889d('0x24')](_0x2a3627);}return _0x36e265['save']();};}function saveUpdates(_0x291188,_0x72882){return function(_0x145f1a){if(_0x145f1a){return _0x145f1a[_0x889d('0x25')](_0x291188)['then'](function(_0x13a775){return _0x13a775;});}return null;};}function removeEntity(_0x247a1f,_0x3fc72d){return function(_0x3c55e9){if(_0x3c55e9){return _0x3c55e9['destroy']()[_0x889d('0x26')](function(){_0x247a1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43e1d2,_0x3b870b){return function(_0x24cc83){if(!_0x24cc83){_0x43e1d2[_0x889d('0x19')](0x194);}return _0x24cc83;};}function handleError(_0x1c4919,_0x4cca44){_0x4cca44=_0x4cca44||0x1f4;return function(_0x106af5){logger[_0x889d('0x27')](_0x106af5[_0x889d('0x28')]);if(_0x106af5['name']){delete _0x106af5[_0x889d('0x29')];}_0x1c4919[_0x889d('0x1a')](_0x4cca44)['send'](_0x106af5);};}exports[_0x889d('0x2a')]=function(_0x55eba2,_0x26756e){var _0x11499b={},_0x1ac70b={},_0x39deae={'count':0x0,'rows':[]};var _0x519931=_[_0x889d('0x2b')](db['Attachment'][_0x889d('0x2c')],function(_0x112a2f){return{'name':_0x112a2f[_0x889d('0x2d')],'type':_0x112a2f['type'][_0x889d('0x2e')]};});_0x1ac70b[_0x889d('0x2f')]=_[_0x889d('0x2b')](_0x519931,_0x889d('0x29'));_0x1ac70b[_0x889d('0x30')]=_[_0x889d('0x31')](_0x55eba2[_0x889d('0x30')]);_0x1ac70b[_0x889d('0x32')]=_['intersection'](_0x1ac70b[_0x889d('0x2f')],_0x1ac70b['query']);_0x11499b[_0x889d('0x33')]=_['intersection'](_0x1ac70b[_0x889d('0x2f')],qs[_0x889d('0x34')](_0x55eba2[_0x889d('0x30')][_0x889d('0x34')]));_0x11499b[_0x889d('0x33')]=_0x11499b[_0x889d('0x33')][_0x889d('0x35')]?_0x11499b[_0x889d('0x33')]:_0x1ac70b[_0x889d('0x2f')];if(!_0x55eba2[_0x889d('0x30')][_0x889d('0x36')](_0x889d('0x37'))){_0x11499b[_0x889d('0x1d')]=qs[_0x889d('0x1d')](_0x55eba2[_0x889d('0x30')][_0x889d('0x1d')]);_0x11499b[_0x889d('0x20')]=qs[_0x889d('0x20')](_0x55eba2['query']['offset']);}_0x11499b[_0x889d('0x38')]=qs[_0x889d('0x39')](_0x55eba2[_0x889d('0x30')]['sort']);_0x11499b[_0x889d('0x3a')]=qs['filters'](_[_0x889d('0x3b')](_0x55eba2[_0x889d('0x30')],_0x1ac70b[_0x889d('0x32')]),_0x519931);if(_0x55eba2[_0x889d('0x30')][_0x889d('0x3c')]){_0x11499b[_0x889d('0x3a')]=_[_0x889d('0x3d')](_0x11499b['where'],{'$or':_['map'](_0x519931,function(_0x4161f8){if(_0x4161f8[_0x889d('0x3e')]!==_0x889d('0x3f')){var _0x2e56c5={};_0x2e56c5[_0x4161f8[_0x889d('0x29')]]={'$like':'%'+_0x55eba2[_0x889d('0x30')]['filter']+'%'};return _0x2e56c5;}})});}_0x11499b=_[_0x889d('0x3d')]({},_0x11499b,_0x55eba2[_0x889d('0x40')]);var _0x5e1656={'where':_0x11499b[_0x889d('0x3a')]};return db[_0x889d('0x41')][_0x889d('0x1f')](_0x5e1656)[_0x889d('0x26')](function(_0x132611){_0x39deae[_0x889d('0x1f')]=_0x132611;if(_0x55eba2[_0x889d('0x30')][_0x889d('0x42')]){_0x11499b[_0x889d('0x43')]=[{'all':!![]}];}return db[_0x889d('0x41')][_0x889d('0x44')](_0x11499b);})['then'](function(_0x3ac214){_0x39deae[_0x889d('0x45')]=_0x3ac214;return _0x39deae;})['then'](respondWithFilteredResult(_0x26756e,_0x11499b))['catch'](handleError(_0x26756e,null));};exports[_0x889d('0x46')]=function(_0x127af3,_0x2437a8){var _0x2d29ec={'raw':!![],'where':{'id':_0x127af3[_0x889d('0x47')]['id']}},_0x3ee98f={};_0x3ee98f['model']=_[_0x889d('0x31')](db['Attachment']['rawAttributes']);_0x3ee98f[_0x889d('0x30')]=_[_0x889d('0x31')](_0x127af3[_0x889d('0x30')]);_0x3ee98f[_0x889d('0x32')]=_[_0x889d('0x48')](_0x3ee98f['model'],_0x3ee98f[_0x889d('0x30')]);_0x2d29ec[_0x889d('0x33')]=_[_0x889d('0x48')](_0x3ee98f[_0x889d('0x2f')],qs[_0x889d('0x34')](_0x127af3['query'][_0x889d('0x34')]));_0x2d29ec['attributes']=_0x2d29ec[_0x889d('0x33')][_0x889d('0x35')]?_0x2d29ec[_0x889d('0x33')]:_0x3ee98f[_0x889d('0x2f')];if(_0x127af3[_0x889d('0x30')][_0x889d('0x42')]){_0x2d29ec[_0x889d('0x43')]=[{'all':!![]}];}_0x2d29ec=_[_0x889d('0x3d')]({},_0x2d29ec,_0x127af3[_0x889d('0x40')]);return db[_0x889d('0x41')][_0x889d('0x49')](_0x2d29ec)['then'](handleEntityNotFound(_0x2437a8,null))[_0x889d('0x26')](respondWithResult(_0x2437a8,null))[_0x889d('0x4a')](handleError(_0x2437a8,null));};exports[_0x889d('0x4b')]=function(_0xe0b4f3,_0x4f0613){var _0x32443d={'where':{'id':_0xe0b4f3[_0x889d('0x47')]['id']}},_0x2b2292={};_0x2b2292[_0x889d('0x2f')]=_['keys'](db[_0x889d('0x41')][_0x889d('0x2c')]);_0x32443d[_0x889d('0x33')]=_[_0x889d('0x48')](_0x2b2292[_0x889d('0x2f')],qs['fields'](_0xe0b4f3[_0x889d('0x30')]['fields']));_0x32443d['attributes']=_0x32443d[_0x889d('0x33')][_0x889d('0x35')]?_0x32443d[_0x889d('0x33')]:_0x2b2292[_0x889d('0x2f')];if(_0xe0b4f3[_0x889d('0x30')][_0x889d('0x42')]){_0x32443d[_0x889d('0x43')]=[{'all':!![]}];}_0x32443d=_[_0x889d('0x3d')]({},_0x32443d,_0xe0b4f3[_0x889d('0x40')]);return db[_0x889d('0x41')]['find'](_0x32443d)[_0x889d('0x26')](handleEntityNotFound(_0x4f0613,null))[_0x889d('0x26')](function(_0x48a0a6){if(_0x48a0a6){var _0x2001ad=_0x48a0a6[_0x889d('0x4c')]({'plain':!![]});_0x2001ad=qs[_0x889d('0x4d')](_0x2001ad,['id',_0x889d('0x4e'),_0x889d('0x4f')]);_0xe0b4f3[_0x889d('0x50')]=_[_0x889d('0x4d')](_0xe0b4f3['body'],['id',_0x889d('0x4e'),_0x889d('0x4f')]);return db['Attachment'][_0x889d('0x51')](_[_0x889d('0x3d')](_0x2001ad,_0xe0b4f3['body']),{'include':_0xe0b4f3[_0x889d('0x30')][_0x889d('0x42')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4f0613,0xc9))[_0x889d('0x4a')](handleError(_0x4f0613,null));};exports[_0x889d('0x25')]=function(_0x31fcbc,_0x3040cb){if(_0x31fcbc['body']['id']){delete _0x31fcbc[_0x889d('0x50')]['id'];}return db[_0x889d('0x41')][_0x889d('0x49')]({'where':{'id':_0x31fcbc[_0x889d('0x47')]['id']}})[_0x889d('0x26')](handleEntityNotFound(_0x3040cb,null))[_0x889d('0x26')](saveUpdates(_0x31fcbc[_0x889d('0x50')],null))[_0x889d('0x26')](respondWithResult(_0x3040cb,null))[_0x889d('0x4a')](handleError(_0x3040cb,null));};exports[_0x889d('0x52')]=function(_0x19ce61,_0x375728){return db[_0x889d('0x41')][_0x889d('0x49')]({'where':{'id':_0x19ce61['params']['id']}})['then'](handleEntityNotFound(_0x375728,null))['then'](removeEntity(_0x375728,null))[_0x889d('0x4a')](handleError(_0x375728,null));};exports[_0x889d('0x51')]=function(_0x51df7e,_0x4db688,_0x3a5dc4){_0x51df7e[_0x889d('0x50')][_0x889d('0x29')]=_0x51df7e[_0x889d('0x53')]['originalname'];_0x51df7e[_0x889d('0x50')]['basename']=_0x51df7e['file'][_0x889d('0x54')];_0x51df7e[_0x889d('0x50')][_0x889d('0x3e')]=_0x51df7e[_0x889d('0x53')]['mimetype'];return db[_0x889d('0x41')][_0x889d('0x51')](_0x51df7e[_0x889d('0x50')])[_0x889d('0x26')](respondWithResult(_0x4db688,0xc9))[_0x889d('0x4a')](handleError(_0x4db688,null));};exports['download']=function(_0x4db3f3,_0x2df29e,_0x551290){return db[_0x889d('0x41')]['findOne']({'where':{'id':_0x4db3f3[_0x889d('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2df29e,null))[_0x889d('0x26')](function(_0x1a7bdf){if(_0x1a7bdf){var _0x24041d=_0x1a7bdf[_0x889d('0x55')]!==null;var _0x3bf433=path[_0x889d('0x56')](config[_0x889d('0x57')],'server/files/attachments/');if(_0x24041d){_0x3bf433=path['join'](_0x3bf433,_0x889d('0x58'));}var _0x1218ee=path[_0x889d('0x56')](_0x3bf433,_0x1a7bdf['basename']);return _0x2df29e['download'](_0x1218ee);}})[_0x889d('0x4a')](handleError(_0x2df29e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5c750e0..b2e8e5b 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 _0x0095=['./attachment.attributes','define','attachments','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0xe1a01b,_0x2657f7){var _0x2559b1=function(_0x304d72){while(--_0x304d72){_0xe1a01b['push'](_0xe1a01b['shift']());}};_0x2559b1(++_0x2657f7);}(_0x0095,0xf3));var _0x5009=function(_0x1f46c0,_0x1148b0){_0x1f46c0=_0x1f46c0-0x0;var _0x34d79d=_0x0095[_0x1f46c0];return _0x34d79d;};'use strict';var _=require(_0x5009('0x0'));var util=require(_0x5009('0x1'));var logger=require(_0x5009('0x2'))(_0x5009('0x3'));var moment=require('moment');var BPromise=require(_0x5009('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5009('0x5'));var rimraf=require('rimraf');var config=require(_0x5009('0x6'));var attributes=require(_0x5009('0x7'));module['exports']=function(_0x435cef,_0xd44a7a){return _0x435cef[_0x5009('0x8')]('Attachment',attributes,{'tableName':_0x5009('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e46=['define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x23d12f,_0x877e63){var _0x321ec0=function(_0x5c36ff){while(--_0x5c36ff){_0x23d12f['push'](_0x23d12f['shift']());}};_0x321ec0(++_0x877e63);}(_0x0e46,0x17c));var _0x60e4=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0x0e46[_0x235563];return _0x219be0;};'use strict';var _=require(_0x60e4('0x0'));var util=require(_0x60e4('0x1'));var logger=require(_0x60e4('0x2'))(_0x60e4('0x3'));var moment=require('moment');var BPromise=require(_0x60e4('0x4'));var rp=require(_0x60e4('0x5'));var fs=require('fs');var path=require(_0x60e4('0x6'));var rimraf=require(_0x60e4('0x7'));var config=require(_0x60e4('0x8'));var attributes=require('./attachment.attributes');module[_0x60e4('0x9')]=function(_0x578d76,_0x5d6552){return _0x578d76[_0x60e4('0xa')](_0x60e4('0xb'),attributes,{'tableName':_0x60e4('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 3e47a2d..4245d85 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 _0x131e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','Attachment,\x20%s,\x20%s','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x131e,0x1ec));var _0xe131=function(_0x3da04d,_0x1594e0){_0x3da04d=_0x3da04d-0x0;var _0x1f062c=_0x131e[_0x3da04d];return _0x1f062c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});}exports['CreateAttachment']=function(_0x400f6b){var _0x2e2bf8=this;return new Promise(function(_0x3bbca8,_0x1a1e03){return db[_0xe131('0x15')][_0xe131('0x16')](_0x400f6b['body'],{'raw':_0x400f6b[_0xe131('0x17')]?_0x400f6b[_0xe131('0x17')][_0xe131('0x18')]===undefined?!![]:![]:!![]})[_0xe131('0xb')](function(_0x2d6c6b){logger['info']('CreateAttachment',_0x400f6b);logger[_0xe131('0xe')](_0xe131('0x19'),_0x400f6b,JSON['stringify'](_0x2d6c6b));_0x3bbca8(_0x2d6c6b);})[_0xe131('0x14')](function(_0x55b0c5){logger['error'](_0xe131('0x19'),_0x55b0c5[_0xe131('0x12')],_0x400f6b);_0x1a1e03(_0x2e2bf8[_0xe131('0x11')](0x1f4,_0x55b0c5[_0xe131('0x12')]));});});}; \ No newline at end of file +var _0xedd9=['error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x56691a,_0x4e67c1){var _0x112a6d=function(_0x35ea94){while(--_0x35ea94){_0x56691a['push'](_0x56691a['shift']());}};_0x112a6d(++_0x4e67c1);}(_0xedd9,0xfc));var _0x9edd=function(_0x37c56c,_0x4d67fa){_0x37c56c=_0x37c56c-0x0;var _0x4bd3db=_0xedd9[_0x37c56c];return _0x4bd3db;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('Attachment,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}exports[_0x9edd('0x17')]=function(_0x40ba32){var _0x4d8f33=this;return new Promise(function(_0x43dc70,_0x5d879c){return db[_0x9edd('0x18')][_0x9edd('0x19')](_0x40ba32['body'],{'raw':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9edd('0xd')](function(_0x54a03f){logger['info'](_0x9edd('0x17'),_0x40ba32);logger[_0x9edd('0x10')]('CreateAttachment',_0x40ba32,JSON['stringify'](_0x54a03f));_0x43dc70(_0x54a03f);})[_0x9edd('0x16')](function(_0x186186){logger[_0x9edd('0x12')]('CreateAttachment',_0x186186[_0x9edd('0x15')],_0x40ba32);_0x5d879c(_0x4d8f33[_0x9edd('0x12')](0x1f4,_0x186186[_0x9edd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 24aae88..bcead27 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(_0x3e1e5f,_0x3bd21b){var _0x5cddc3=function(_0x311318){while(--_0x311318){_0x3e1e5f['push'](_0x3e1e5f['shift']());}};_0x5cddc3(++_0x3bd21b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1026d2,_0x42fe66){_0x1026d2=_0x1026d2-0x0;var _0x4a6773=_0xb10b[_0x1026d2];return _0x4a6773;};'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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0b0e,0x187));var _0xe0b0=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0x0b0e[_0xafdec6];return _0x372bdb;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index bc8f75e..e42bec6 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 _0x85a7=['domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','online','admin','disabled','add','clearBlockUser','getLicense','catch','status','send','message','ad-login','signToken','json','use','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','baseDN','url'];(function(_0x13d580,_0x53a187){var _0x5e124b=function(_0x5abc88){while(--_0x5abc88){_0x13d580['push'](_0x13d580['shift']());}};_0x5e124b(++_0x53a187);}(_0x85a7,0xa7));var _0x785a=function(_0x1040d1,_0x432965){_0x1040d1=_0x1040d1-0x0;var _0x25607d=_0x85a7[_0x1040d1];return _0x25607d;};'use strict';var passport=require(_0x785a('0x0'));var LocalStrategy=require(_0x785a('0x1'))[_0x785a('0x2')];var moment=require(_0x785a('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x785a('0x4'));var util=require(_0x785a('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x785a('0x6'));var utils=require(_0x785a('0x7'));var config=require(_0x785a('0x8'));var logger=require('../../config/logger')(_0x785a('0x9'));function isActiveDirectoryConfigured(_0x2547d1){var _0xcf33a6=![];if(typeof _0x2547d1[_0x785a('0xa')]!=='undefined'){_0xcf33a6=_0x2547d1[_0x785a('0xa')][_0x785a('0xb')]&&_0x2547d1['activedirectory'][_0x785a('0xc')]&&_0x2547d1[_0x785a('0xa')][_0x785a('0xd')];}return _0xcf33a6;}function adAuthenticate(_0x5af56b,_0x3c6111,_0x1d9350){return new BPromise(function(_0x143a0e,_0x3cf9da){try{var _0x5a0a6f=new ActiveDirectory(_0x5af56b);_0x5a0a6f[_0x785a('0xe')](_0x3c6111,_0x1d9350,function(_0x5016ac,_0x42356e){if(_0x5016ac){logger[_0x785a('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x3c6111,util[_0x785a('0x10')](_0x5016ac,{'showHidden':![],'depth':null}));_0x3cf9da(_0x785a('0x11'));}else if(!_0x42356e){logger[_0x785a('0xf')](_0x785a('0x12'),_0x3c6111);_0x3cf9da(_0x785a('0x11'));}else{_0x143a0e(_0x42356e);}});}catch(_0x88751f){_0x3cf9da(_0x88751f);}});}function ActiveDirectoryAuthenticate(_0x36dfc3,_0x39032c,_0x429d4b,_0xaab5b3){var _0x3fdf8f,_0x7c298c;if(!isActiveDirectoryConfigured(config)){logger[_0x785a('0xf')](_0x785a('0x13'),_0x39032c);return _0xaab5b3(null,![],{'message':_0x785a('0x11')});}return db['Setting'][_0x785a('0x14')]({'where':{'id':0x1},'attributes':[_0x785a('0x15'),_0x785a('0x16')],'raw':!![]})[_0x785a('0x17')](function(_0x1ac834){_0x3fdf8f=_0x1ac834;if(!_0x3fdf8f[_0x785a('0x15')]){logger[_0x785a('0xf')](_0x785a('0x18'),_0x39032c);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x36dfc3[_0x785a('0x14')]({'attributes':['id',_0x785a('0x19'),_0x785a('0x1a'),_0x785a('0x1b'),_0x785a('0x1c'),'disabled',_0x785a('0x1d'),_0x785a('0x1e'),_0x785a('0x1f')],'where':{'name':_0x39032c,'role':{'$or':[_0x785a('0x20'),'user','agent']},'adSsoEnabled':!![]}});})[_0x785a('0x17')](function(_0x3161f7){if(!_0x3161f7||_0x3161f7&&_0x3161f7[_0x785a('0x19')]!==_0x39032c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x7c298c=_0x3161f7;var _0x4aa5bb=_0x7c298c[_0x785a('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x785a('0xa')],_0x4aa5bb,_0x429d4b);})[_0x785a('0x17')](function(_0x5c6005){if(_0x7c298c[_0x785a('0x21')]){throw new Error(_0x785a('0x11'));}if(_0x3fdf8f[_0x785a('0x16')]>0x0){if(_0x7c298c[_0x785a('0x1d')]){if(moment(_0x7c298c[_0x785a('0x1e')])[_0x785a('0x22')](_0x3fdf8f[_0x785a('0x16')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x785a('0x23')](_0x7c298c,0x0,![],null)[_0x785a('0x17')](function(){return utils[_0x785a('0x24')](_0x7c298c);})[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}else{return utils['getLicense'](_0x7c298c)[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}}else{return utils['getLicense'](_0x7c298c)[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}})[_0x785a('0x25')](function(_0x29284c){return _0xaab5b3(null,![],_0x29284c);});}function handleError(_0x574238,_0x31f74b,_0x51c36d){return _0x574238[_0x785a('0x26')](_0x31f74b||0x1f4)[_0x785a('0x27')]({'message':_0x51c36d?_0x51c36d[_0x785a('0x28')]||_0x51c36d:''});}exports['login']=function(_0x333df1,_0x2c6b14,_0xee3958){passport[_0x785a('0xe')](_0x785a('0x29'),function(_0x2e9e51,_0x9cf079,_0x14ce32){var _0x334a40=_0x2e9e51||_0x14ce32;if(_0x334a40){return handleError(_0x2c6b14,0x191,_0x334a40);}if(!_0x9cf079){return handleError(_0x2c6b14,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4f9666={'payload':{'id':_0x9cf079['id'],'role':_0x9cf079[_0x785a('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x785a('0x2a')](_0x4f9666)['then'](function(_0x18cdb1){_0x2c6b14[_0x785a('0x2b')]({'id':_0x9cf079['id'],'token':_0x18cdb1,'statusCall':'','isAlreadyLogged':_0x9cf079[_0x785a('0x1f')]});});}})(_0x333df1,_0x2c6b14,_0xee3958);};passport[_0x785a('0x2c')](_0x785a('0x29'),new LocalStrategy({'usernameField':_0x785a('0x19'),'passwordField':_0x785a('0x1a')},function(_0xfbe339,_0x2cdecb,_0x503a6c){return ActiveDirectoryAuthenticate(db['User'],_0xfbe339,_0x2cdecb,_0x503a6c);})); \ No newline at end of file +var _0x9e91=['adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blocked','online','user','agent','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','name','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne'];(function(_0x1d1a62,_0x580c68){var _0x7fdaaa=function(_0x11bfab){while(--_0x11bfab){_0x1d1a62['push'](_0x1d1a62['shift']());}};_0x7fdaaa(++_0x580c68);}(_0x9e91,0x1ca));var _0x19e9=function(_0xe8854b,_0x344e3b){_0xe8854b=_0xe8854b-0x0;var _0x35e804=_0x9e91[_0xe8854b];return _0x35e804;};'use strict';var passport=require(_0x19e9('0x0'));var LocalStrategy=require(_0x19e9('0x1'))[_0x19e9('0x2')];var moment=require(_0x19e9('0x3'));var ActiveDirectory=require(_0x19e9('0x4'));var BPromise=require(_0x19e9('0x5'));var util=require(_0x19e9('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x19e9('0x7'));var utils=require(_0x19e9('0x8'));var config=require(_0x19e9('0x9'));var logger=require('../../config/logger')(_0x19e9('0xa'));function isActiveDirectoryConfigured(_0x5557d4){var _0x5ba5f2=![];if(typeof _0x5557d4[_0x19e9('0xb')]!==_0x19e9('0xc')){_0x5ba5f2=_0x5557d4[_0x19e9('0xb')]['baseDN']&&_0x5557d4['activedirectory'][_0x19e9('0xd')]&&_0x5557d4[_0x19e9('0xb')][_0x19e9('0xe')];}return _0x5ba5f2;}function adAuthenticate(_0x34708a,_0xdd0fd6,_0x5dfd4f){return new BPromise(function(_0x227715,_0x141c73){try{var _0x2883fb=new ActiveDirectory(_0x34708a);_0x2883fb[_0x19e9('0xf')](_0xdd0fd6,_0x5dfd4f,function(_0x41e11c,_0x479155){if(_0x41e11c){logger['error'](_0x19e9('0x10'),_0xdd0fd6,util['inspect'](_0x41e11c,{'showHidden':![],'depth':null}));_0x141c73(_0x19e9('0x11'));}else if(!_0x479155){logger[_0x19e9('0x12')](_0x19e9('0x13'),_0xdd0fd6);_0x141c73(_0x19e9('0x11'));}else{_0x227715(_0x479155);}});}catch(_0x327fee){_0x141c73(_0x327fee);}});}function ActiveDirectoryAuthenticate(_0x1a2ed4,_0x6fd4b6,_0x42ba5e,_0x3ec1a8){var _0x21bb15,_0x1930be;if(!isActiveDirectoryConfigured(config)){logger[_0x19e9('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x6fd4b6);return _0x3ec1a8(null,![],{'message':_0x19e9('0x11')});}return db[_0x19e9('0x14')][_0x19e9('0x15')]({'where':{'id':0x1},'attributes':[_0x19e9('0x16'),'blockDuration'],'raw':!![]})[_0x19e9('0x17')](function(_0x2c241f){_0x21bb15=_0x2c241f;if(!_0x21bb15[_0x19e9('0x16')]){logger['error'](_0x19e9('0x18'),_0x6fd4b6);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1a2ed4['findOne']({'attributes':['id','name',_0x19e9('0x19'),'salt',_0x19e9('0x1a'),_0x19e9('0x1b'),_0x19e9('0x1c'),'blockedAt',_0x19e9('0x1d')],'where':{'name':_0x6fd4b6,'role':{'$or':['admin',_0x19e9('0x1e'),_0x19e9('0x1f')]},'adSsoEnabled':!![]}});})[_0x19e9('0x17')](function(_0x1918e5){if(!_0x1918e5||_0x1918e5&&_0x1918e5['name']!==_0x6fd4b6){throw new Error(_0x19e9('0x11'));}_0x1930be=_0x1918e5;var _0x518128=_0x1930be['name']+'@'+config[_0x19e9('0xb')][_0x19e9('0xe')];return adAuthenticate(config[_0x19e9('0xb')],_0x518128,_0x42ba5e);})['then'](function(_0x20205c){if(_0x1930be[_0x19e9('0x1b')]){throw new Error(_0x19e9('0x11'));}if(_0x21bb15[_0x19e9('0x20')]>0x0){if(_0x1930be['blocked']){if(moment(_0x1930be[_0x19e9('0x21')])[_0x19e9('0x22')](_0x21bb15[_0x19e9('0x20')],_0x19e9('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x19e9('0x24')](_0x1930be,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1930be);})[_0x19e9('0x17')](function(){return _0x3ec1a8(null,_0x1930be);});}else{return utils['getLicense'](_0x1930be)['then'](function(){return _0x3ec1a8(null,_0x1930be);});}}else{return utils[_0x19e9('0x25')](_0x1930be)['then'](function(){return _0x3ec1a8(null,_0x1930be);});}})[_0x19e9('0x26')](function(_0x5a60d8){return _0x3ec1a8(null,![],_0x5a60d8);});}function handleError(_0x258132,_0x29b72e,_0x3c9e97){return _0x258132[_0x19e9('0x27')](_0x29b72e||0x1f4)['send']({'message':_0x3c9e97?_0x3c9e97[_0x19e9('0x28')]||_0x3c9e97:''});}exports[_0x19e9('0x29')]=function(_0x42587e,_0x12b283,_0x55f0fb){passport[_0x19e9('0xf')](_0x19e9('0x2a'),function(_0x4a2d0e,_0x11bb5d,_0x3184c2){var _0x71268b=_0x4a2d0e||_0x3184c2;if(_0x71268b){return handleError(_0x12b283,0x191,_0x71268b);}if(!_0x11bb5d){return handleError(_0x12b283,0x194,{'message':_0x19e9('0x2b')});}else{var _0x31fdb9={'payload':{'id':_0x11bb5d['id'],'role':_0x11bb5d[_0x19e9('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x19e9('0x2c')](_0x31fdb9)['then'](function(_0x119816){_0x12b283['json']({'id':_0x11bb5d['id'],'token':_0x119816,'statusCall':'','isAlreadyLogged':_0x11bb5d[_0x19e9('0x1d')]});});}})(_0x42587e,_0x12b283,_0x55f0fb);};passport[_0x19e9('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0x19e9('0x2e'),'passwordField':_0x19e9('0x19')},function(_0x5172cc,_0x43ea46,_0x14d03a){return ActiveDirectoryAuthenticate(db[_0x19e9('0x2f')],_0x5172cc,_0x43ea46,_0x14d03a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 2583bad..136ced9 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 _0xd5ad=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x28f0cf,_0x460cda){var _0x5bac1f=function(_0x70e0b8){while(--_0x70e0b8){_0x28f0cf['push'](_0x28f0cf['shift']());}};_0x5bac1f(++_0x460cda);}(_0xd5ad,0x18c));var _0xdd5a=function(_0x1ce859,_0x2ae1f1){_0x1ce859=_0x1ce859-0x0;var _0x5b2df0=_0xd5ad[_0x1ce859];return _0x5b2df0;};'use strict';var express=require(_0xdd5a('0x0'));var router=express[_0xdd5a('0x1')]();var controller=require(_0xdd5a('0x2'));router[_0xdd5a('0x3')]('/',controller['login']);module[_0xdd5a('0x4')]=router; \ No newline at end of file +var _0x28ac=['Router','post','login','exports','express'];(function(_0x4bca0f,_0x38894c){var _0x5d62e4=function(_0x59daaf){while(--_0x59daaf){_0x4bca0f['push'](_0x4bca0f['shift']());}};_0x5d62e4(++_0x38894c);}(_0x28ac,0x10d));var _0xc28a=function(_0x4cfb59,_0x5befdc){_0x4cfb59=_0x4cfb59-0x0;var _0x31a61c=_0x28ac[_0x4cfb59];return _0x31a61c;};'use strict';var express=require(_0xc28a('0x0'));var router=express[_0xc28a('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xc28a('0x2')]('/',controller[_0xc28a('0x3')]);module[_0xc28a('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 6050f1b..ac8cb16 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x7a54,0x106));var _0x47a5=function(_0xce52a9,_0x41cedd){_0xce52a9=_0xce52a9-0x0;var _0x32bd2b=_0x7a54[_0xce52a9];return _0x32bd2b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x2743ca,_0x3d191c){_0x2743ca=_0x2743ca-0x0;var _0x3f094d=_0x7a54[_0x2743ca];return _0x3f094d;};'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 55bc81e..8a2a1ed 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 _0xa220=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','exports','passport'];(function(_0x5036fe,_0x188b6f){var _0x5a76d9=function(_0x3fdd77){while(--_0x3fdd77){_0x5036fe['push'](_0x5036fe['shift']());}};_0x5a76d9(++_0x188b6f);}(_0xa220,0x167));var _0x0a22=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa220[_0x42cae2];return _0x5f256f;};'use strict';var express=require('express');var passport=require(_0x0a22('0x0'));var router=express['Router']();var controller=require(_0x0a22('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x0a22('0x2'));router[_0x0a22('0x3')]('/',controller[_0x0a22('0x4')]);router[_0x0a22('0x3')](_0x0a22('0x5'),controller[_0x0a22('0x6')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x0a22('0x7')]=router; \ No newline at end of file +var _0x75d4=['../user/user.controller.js','../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x75d4,0x93));var _0x475d=function(_0x746e8d,_0x431fd9){_0x746e8d=_0x746e8d-0x0;var _0x5018f4=_0x75d4[_0x746e8d];return _0x5018f4;};'use strict';var express=require(_0x475d('0x0'));var passport=require('passport');var router=express[_0x475d('0x1')]();var controller=require(_0x475d('0x2'));var userController=require(_0x475d('0x3'));var authService=require(_0x475d('0x4'));router[_0x475d('0x5')]('/',controller[_0x475d('0x6')]);router['get']('/callback',controller['callback'],authService[_0x475d('0x7')],userController[_0x475d('0x6')],authService[_0x475d('0x8')]);module[_0x475d('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 2da515b..33d3684 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 _0x7a6b=['Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','password','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','then','getLicense','catch','MailAccount','name','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','Setting','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util'];(function(_0x2c658a,_0x18d39e){var _0x26806e=function(_0x1943f7){while(--_0x1943f7){_0x2c658a['push'](_0x2c658a['shift']());}};_0x26806e(++_0x18d39e);}(_0x7a6b,0xf5));var _0xb7a6=function(_0x13a45f,_0x533e58){_0x13a45f=_0x13a45f-0x0;var _0x145ef3=_0x7a6b[_0x13a45f];return _0x145ef3;};'use strict';var util=require(_0xb7a6('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xb7a6('0x1')];var jayson=require('jayson/promise');var _=require(_0xb7a6('0x2'));var rs=require(_0xb7a6('0x3'));var moment=require(_0xb7a6('0x4'));var db=require(_0xb7a6('0x5'))['db'];var authService=require(_0xb7a6('0x6'));var utils=require(_0xb7a6('0x7'));var client=jayson['client'][_0xb7a6('0x8')]({'port':0x232b});function localAuthenticate(_0xe364a1,_0x2cf874,_0x31cfe2,_0x4d6916){var _0x3b988d,_0x590516;return db['Setting'][_0xb7a6('0x9')]({'where':{'id':0x1},'attributes':[_0xb7a6('0xa'),_0xb7a6('0xb')],'raw':!![]})['then'](function(_0x28b293){_0x3b988d=_0x28b293;return _0xe364a1[_0xb7a6('0x9')]({'attributes':['id','name',_0xb7a6('0xc'),'salt',_0xb7a6('0xd'),_0xb7a6('0xe'),_0xb7a6('0xf'),_0xb7a6('0x10'),_0xb7a6('0x11')],'where':{'name':_0x2cf874,'role':{'$or':['admin',_0xb7a6('0x12'),_0xb7a6('0x13')]}}});})['then'](function(_0x1930b3){if(!_0x1930b3||_0x1930b3&&_0x1930b3['name']!==_0x2cf874){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x590516=_0x1930b3;return _0x590516;}})['then'](function(){_0x590516[_0xb7a6('0x14')](_0x31cfe2,function(_0x389adc,_0x4a5e42){var _0x3959b5=_0x590516[_0xb7a6('0x11')]+0x1;if(_0x389adc){return _0x4d6916(_0x389adc);}else if(!_0x4a5e42){if(_0x590516[_0xb7a6('0xe')]){return _0x4d6916(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b988d[_0xb7a6('0xa')]>0x0){if(_0x590516[_0xb7a6('0xf')]){if(_0x3b988d[_0xb7a6('0xb')]>0x0){if(moment(_0x590516[_0xb7a6('0x10')])[_0xb7a6('0x15')](_0x3b988d[_0xb7a6('0xb')],'minutes')>moment()){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils[_0xb7a6('0x17')](_0x590516,_0x3959b5,![],null)[_0xb7a6('0x18')](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}}else{return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}}else{if(_0x3959b5>=_0x3b988d[_0xb7a6('0xa')]){return utils['clearBlockUser'](_0x590516,0x0,!![],moment())['then'](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}else{return utils['clearBlockUser'](_0x590516,_0x3959b5,![],null)[_0xb7a6('0x18')](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}}}else{return _0x4d6916(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x590516[_0xb7a6('0xe')]){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else if(_0x3b988d[_0xb7a6('0xa')]>0x0){if(_0x590516[_0xb7a6('0xf')]){if(_0x3b988d['blockDuration']>0x0){if(moment(_0x590516['blockedAt'])[_0xb7a6('0x15')](_0x3b988d[_0xb7a6('0xb')],'minutes')>moment()){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils[_0xb7a6('0x17')](_0x590516,0x0,![],null)[_0xb7a6('0x18')](function(){return utils[_0xb7a6('0x19')](_0x590516);})[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);});}}else{return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}}else{return utils[_0xb7a6('0x17')](_0x590516,0x0,![],null)[_0xb7a6('0x18')](function(){return utils[_0xb7a6('0x19')](_0x590516);})[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);})[_0xb7a6('0x1a')](function(_0x432700){return _0x4d6916(null,![],_0x432700);});}}else{if(_0x590516[_0xb7a6('0xf')]){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils['getLicense'](_0x590516)[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);});}}}});})[_0xb7a6('0x1a')](function(_0x4d50cb){return _0x4d6916(null,![],_0x4d50cb);});}function sendServiceMail(_0x510fc8){return db[_0xb7a6('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0xb7a6('0x1c'),_0xb7a6('0x1d')],'include':[{'model':db[_0xb7a6('0x1e')],'as':_0xb7a6('0x1f'),'include':[{'model':db[_0xb7a6('0x20')],'as':_0xb7a6('0x20')}]}]})[_0xb7a6('0x18')](function(_0x2b413c){if(!_0x2b413c){throw new Error(_0xb7a6('0x21'));}var _0x25289c=_0x2b413c['getSmtpOptions']();var _0x32b8b8={'account':_0x25289c,'message':_[_0xb7a6('0x22')]({'from':util[_0xb7a6('0x23')](_0xb7a6('0x24'),_0x2b413c[_0xb7a6('0x1c')],_0x2b413c['email']||_0x2b413c['Smtp'][_0xb7a6('0x12')])},_0x510fc8)};return client['request'](_0xb7a6('0x25'),_0x32b8b8);})['then'](function(_0x4dd876){if(_0x4dd876['error']){throw new Error(util[_0xb7a6('0x23')](_0xb7a6('0x26'),_0x4dd876[_0xb7a6('0x27')]['message']||JSON[_0xb7a6('0x28')](_0x4dd876[_0xb7a6('0x27')])));}return!![];});}function handleError(_0x2f90d7,_0x477062,_0x3a0279){return _0x2f90d7['status'](_0x477062||0x1f4)['send']({'message':_0x3a0279?_0x3a0279[_0xb7a6('0x29')]||_0x3a0279:''});}exports[_0xb7a6('0x2a')]=function(_0x5b8d88,_0x14aadb,_0x863d0a){passport[_0xb7a6('0x14')](_0xb7a6('0x2b'),function(_0x4058d7,_0xdfc794,_0x289064){var _0x4774eb=_0x4058d7||_0x289064;if(_0x4774eb){return handleError(_0x14aadb,0x191,_0x4774eb);}if(!_0xdfc794){return handleError(_0x14aadb,0x194,{'message':_0xb7a6('0x2c')});}else{var _0x43ac32={'payload':{'id':_0xdfc794['id'],'role':_0xdfc794[_0xb7a6('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xb7a6('0x2d')](_0x43ac32)[_0xb7a6('0x18')](function(_0x4e6d1d){_0x14aadb[_0xb7a6('0x2e')]({'id':_0xdfc794['id'],'token':_0x4e6d1d,'statusCall':'','isAlreadyLogged':_0xdfc794[_0xb7a6('0x2f')]});});}})(_0x5b8d88,_0x14aadb,_0x863d0a);};exports[_0xb7a6('0x30')]=function(_0xa867e2,_0x1eb4c6){if(!_0xa867e2['body'][_0xb7a6('0x1d')]){return handleError(_0x1eb4c6,0x1f4,{'message':_0xb7a6('0x31')});}var _0x15da70=rs[_0xb7a6('0x32')]();_0xa867e2[_0xb7a6('0x33')][_0xb7a6('0x1d')]=_0xa867e2[_0xb7a6('0x33')][_0xb7a6('0x1d')][_0xb7a6('0x34')]()['toLowerCase']();var _0x2e615a;return db[_0xb7a6('0x35')][_0xb7a6('0x9')]({'where':{'id':0x1},'attributes':[_0xb7a6('0xa'),_0xb7a6('0xb')],'raw':!![]})[_0xb7a6('0x18')](function(_0x25a2fb){_0x2e615a=_0x25a2fb;return db[_0xb7a6('0x36')][_0xb7a6('0x37')]({'where':{'email':_0xa867e2['body'][_0xb7a6('0x1d')]}});})[_0xb7a6('0x18')](function(_0x43aea2){if(!_0x43aea2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x43aea2[_0xb7a6('0xe')]){throw new Error(_0xb7a6('0x38'));}if(_0x43aea2[_0xb7a6('0xf')]){if(moment(_0x43aea2[_0xb7a6('0x10')])[_0xb7a6('0x15')](_0x2e615a[_0xb7a6('0xb')],_0xb7a6('0x39'))>moment()){throw new Error(_0xb7a6('0x3a'));}else{_0x43aea2['blocked']=![];_0x43aea2[_0xb7a6('0x10')]=null;}}_0x43aea2[_0xb7a6('0x3b')]=_0x15da70;_0x43aea2[_0xb7a6('0x3c')]=Date[_0xb7a6('0x3d')]()+0x36ee80;return _0x43aea2[_0xb7a6('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0xa867e2['body'][_0xb7a6('0x1d')],'subject':_0xb7a6('0x3f'),'text':_0xb7a6('0x40')+_0xb7a6('0x41')+_0xb7a6('0x42')+_0xa867e2[_0xb7a6('0x43')][_0xb7a6('0x44')]+_0xb7a6('0x45')+_0x15da70+'\x0a\x0a'+_0xb7a6('0x46')});})[_0xb7a6('0x18')](function(){_0x1eb4c6['status'](0xc8)[_0xb7a6('0x47')]({'message':_0xb7a6('0x48')});})[_0xb7a6('0x1a')](function(_0x261530){return handleError(_0x1eb4c6,0x1f4,_0x261530);});};exports['reset']=function(_0xde5df1,_0x241e4){return db[_0xb7a6('0x36')][_0xb7a6('0x37')]({'where':{'resetPasswordToken':_0xde5df1['params'][_0xb7a6('0x49')],'resetPasswordExpires':{'$gt':Date[_0xb7a6('0x3d')]()}}})[_0xb7a6('0x18')](function(_0x11d7e3){if(!_0x11d7e3){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xb7a6('0x35')][_0xb7a6('0x9')]({'attributes':['id',_0xb7a6('0x4a'),_0xb7a6('0x4b'),_0xb7a6('0x4c')]})[_0xb7a6('0x18')](function(_0x561a0c){if(_0x561a0c[_0xb7a6('0x4a')])authService[_0xb7a6('0x4d')](_0xde5df1[_0xb7a6('0x33')][_0xb7a6('0xc')]);if(!_0x561a0c[_0xb7a6('0x4b')]||!_0x11d7e3[_0xb7a6('0x4e')])return _0x11d7e3;authService[_0xb7a6('0x4f')](_0xde5df1[_0xb7a6('0x33')][_0xb7a6('0xc')],_0x11d7e3[_0xb7a6('0x4e')],_0x561a0c[_0xb7a6('0x4c')]);return _0x11d7e3;})['then'](function(){_0x11d7e3[_0xb7a6('0xc')]=_0xde5df1['body'][_0xb7a6('0xc')];_0x11d7e3['resetPasswordToken']=null;_0x11d7e3[_0xb7a6('0x3c')]=null;return _0x11d7e3['save']();});})[_0xb7a6('0x18')](function(){_0x241e4['status'](0xc8)[_0xb7a6('0x47')]({'message':_0xb7a6('0x50')});})[_0xb7a6('0x1a')](function(_0x53e426){return handleError(_0x241e4,0x1f4,_0x53e426);});};passport[_0xb7a6('0x51')](_0xb7a6('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x14d22e,_0x24596a,_0x2bdb43){return localAuthenticate(db[_0xb7a6('0x36')],_0x14d22e,_0x24596a,_0x2bdb43);})); \ No newline at end of file +var _0x2867=['minutes','clearBlockUser','blockDuration','getLicense','catch','MailAccount','email','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','Setting','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','resetPasswordToken','resetPasswordExpires','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','then','salt','role','blocked','blockedAt','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add'];(function(_0x355815,_0x19ff33){var _0x59ce65=function(_0x10cbbb){while(--_0x10cbbb){_0x355815['push'](_0x355815['shift']());}};_0x59ce65(++_0x19ff33);}(_0x2867,0x1ae));var _0x7286=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0x2867[_0x28b7ab];return _0x56791b;};'use strict';var util=require('util');var passport=require(_0x7286('0x0'));var LocalStrategy=require(_0x7286('0x1'))[_0x7286('0x2')];var jayson=require(_0x7286('0x3'));var _=require(_0x7286('0x4'));var rs=require(_0x7286('0x5'));var moment=require(_0x7286('0x6'));var db=require(_0x7286('0x7'))['db'];var authService=require(_0x7286('0x8'));var utils=require(_0x7286('0x9'));var client=jayson['client'][_0x7286('0xa')]({'port':0x232b});function localAuthenticate(_0xb332f3,_0x4c0c51,_0x29e862,_0x3a7f05){var _0x35ffff,_0x2e5586;return db['Setting'][_0x7286('0xb')]({'where':{'id':0x1},'attributes':[_0x7286('0xc'),'blockDuration'],'raw':!![]})[_0x7286('0xd')](function(_0x1c6674){_0x35ffff=_0x1c6674;return _0xb332f3[_0x7286('0xb')]({'attributes':['id','name','password',_0x7286('0xe'),_0x7286('0xf'),'disabled',_0x7286('0x10'),_0x7286('0x11'),'loginAttempts'],'where':{'name':_0x4c0c51,'role':{'$or':[_0x7286('0x12'),_0x7286('0x13'),_0x7286('0x14')]}}});})[_0x7286('0xd')](function(_0x4cb406){if(!_0x4cb406||_0x4cb406&&_0x4cb406[_0x7286('0x15')]!==_0x4c0c51){throw new Error(_0x7286('0x16'));}else{_0x2e5586=_0x4cb406;return _0x2e5586;}})[_0x7286('0xd')](function(){_0x2e5586[_0x7286('0x17')](_0x29e862,function(_0x36c6fa,_0x57e767){var _0x3c1363=_0x2e5586['loginAttempts']+0x1;if(_0x36c6fa){return _0x3a7f05(_0x36c6fa);}else if(!_0x57e767){if(_0x2e5586[_0x7286('0x18')]){return _0x3a7f05(null,![],{'message':_0x7286('0x16')});}else if(_0x35ffff[_0x7286('0xc')]>0x0){if(_0x2e5586[_0x7286('0x10')]){if(_0x35ffff['blockDuration']>0x0){if(moment(_0x2e5586[_0x7286('0x11')])[_0x7286('0x19')](_0x35ffff['blockDuration'],_0x7286('0x1a'))>moment()){return _0x3a7f05(null,![],{'message':_0x7286('0x16')});}else{return utils[_0x7286('0x1b')](_0x2e5586,_0x3c1363,![],null)[_0x7286('0xd')](function(){return _0x3a7f05(null,![],{'message':_0x7286('0x16')});});}}else{return _0x3a7f05(null,![],{'message':_0x7286('0x16')});}}else{if(_0x3c1363>=_0x35ffff['allowedLoginAttempts']){return utils[_0x7286('0x1b')](_0x2e5586,0x0,!![],moment())[_0x7286('0xd')](function(){return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x7286('0x1b')](_0x2e5586,_0x3c1363,![],null)[_0x7286('0xd')](function(){return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3a7f05(null,![],{'message':_0x7286('0x16')});}}else{if(_0x2e5586[_0x7286('0x18')]){return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x35ffff['allowedLoginAttempts']>0x0){if(_0x2e5586['blocked']){if(_0x35ffff['blockDuration']>0x0){if(moment(_0x2e5586[_0x7286('0x11')])[_0x7286('0x19')](_0x35ffff[_0x7286('0x1c')],'minutes')>moment()){return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2e5586,0x0,![],null)[_0x7286('0xd')](function(){return utils[_0x7286('0x1d')](_0x2e5586);})[_0x7286('0xd')](function(){return _0x3a7f05(null,_0x2e5586);});}}else{return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7286('0x1b')](_0x2e5586,0x0,![],null)[_0x7286('0xd')](function(){return utils[_0x7286('0x1d')](_0x2e5586);})['then'](function(){return _0x3a7f05(null,_0x2e5586);})['catch'](function(_0x174580){return _0x3a7f05(null,![],_0x174580);});}}else{if(_0x2e5586[_0x7286('0x10')]){return _0x3a7f05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7286('0x1d')](_0x2e5586)[_0x7286('0xd')](function(){return _0x3a7f05(null,_0x2e5586);});}}}});})[_0x7286('0x1e')](function(_0x5ba120){return _0x3a7f05(null,![],_0x5ba120);});}function sendServiceMail(_0x427a69){return db[_0x7286('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x7286('0x15'),_0x7286('0x20')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x7286('0x21')],'as':_0x7286('0x21')}]}]})[_0x7286('0xd')](function(_0x1833d1){if(!_0x1833d1){throw new Error(_0x7286('0x22'));}var _0x4224d2=_0x1833d1[_0x7286('0x23')]();var _0x56dd31={'account':_0x4224d2,'message':_[_0x7286('0x24')]({'from':util[_0x7286('0x25')](_0x7286('0x26'),_0x1833d1[_0x7286('0x15')],_0x1833d1[_0x7286('0x20')]||_0x1833d1[_0x7286('0x27')][_0x7286('0x13')])},_0x427a69)};return client[_0x7286('0x28')]('SendMail',_0x56dd31);})[_0x7286('0xd')](function(_0x1efba0){if(_0x1efba0[_0x7286('0x29')]){throw new Error(util[_0x7286('0x25')](_0x7286('0x2a'),_0x1efba0[_0x7286('0x29')][_0x7286('0x2b')]||JSON['stringify'](_0x1efba0['error'])));}return!![];});}function handleError(_0xb793e2,_0x325c39,_0xe32630){return _0xb793e2[_0x7286('0x2c')](_0x325c39||0x1f4)[_0x7286('0x2d')]({'message':_0xe32630?_0xe32630[_0x7286('0x2b')]||_0xe32630:''});}exports[_0x7286('0x2e')]=function(_0x3892b9,_0x329d86,_0x3c575f){passport[_0x7286('0x17')](_0x7286('0x2f'),function(_0xead2de,_0x20698e,_0x4cd458){var _0x7642e=_0xead2de||_0x4cd458;if(_0x7642e){return handleError(_0x329d86,0x191,_0x7642e);}if(!_0x20698e){return handleError(_0x329d86,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3b2a88={'payload':{'id':_0x20698e['id'],'role':_0x20698e[_0x7286('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3b2a88)[_0x7286('0xd')](function(_0x1fc806){_0x329d86[_0x7286('0x30')]({'id':_0x20698e['id'],'token':_0x1fc806,'statusCall':'','isAlreadyLogged':_0x20698e[_0x7286('0x31')]});});}})(_0x3892b9,_0x329d86,_0x3c575f);};exports['forgot']=function(_0x10c056,_0x3210aa){if(!_0x10c056[_0x7286('0x32')][_0x7286('0x20')]){return handleError(_0x3210aa,0x1f4,{'message':_0x7286('0x33')});}var _0x4cf61e=rs[_0x7286('0x34')]();_0x10c056[_0x7286('0x32')][_0x7286('0x20')]=_0x10c056[_0x7286('0x32')][_0x7286('0x20')][_0x7286('0x35')]()['toLowerCase']();var _0x402f00;return db[_0x7286('0x36')][_0x7286('0xb')]({'where':{'id':0x1},'attributes':[_0x7286('0xc'),'blockDuration'],'raw':!![]})[_0x7286('0xd')](function(_0x3e84ad){_0x402f00=_0x3e84ad;return db[_0x7286('0x37')][_0x7286('0x38')]({'where':{'email':_0x10c056[_0x7286('0x32')][_0x7286('0x20')]}});})[_0x7286('0xd')](function(_0x3cc82a){if(!_0x3cc82a){throw new Error(_0x7286('0x39'));}if(_0x3cc82a[_0x7286('0x18')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3cc82a[_0x7286('0x10')]){if(moment(_0x3cc82a['blockedAt'])[_0x7286('0x19')](_0x402f00['blockDuration'],'minutes')>moment()){throw new Error(_0x7286('0x3a'));}else{_0x3cc82a[_0x7286('0x10')]=![];_0x3cc82a['blockedAt']=null;}}_0x3cc82a['resetPasswordToken']=_0x4cf61e;_0x3cc82a['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x3cc82a[_0x7286('0x3b')]();})[_0x7286('0xd')](function(){return sendServiceMail({'to':_0x10c056[_0x7286('0x32')][_0x7286('0x20')],'subject':_0x7286('0x3c'),'text':_0x7286('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x7286('0x3e')+_0x10c056['headers']['host']+_0x7286('0x3f')+_0x4cf61e+'\x0a\x0a'+_0x7286('0x40')});})['then'](function(){_0x3210aa[_0x7286('0x2c')](0xc8)[_0x7286('0x2d')]({'message':_0x7286('0x41')});})[_0x7286('0x1e')](function(_0x454c53){return handleError(_0x3210aa,0x1f4,_0x454c53);});};exports['reset']=function(_0x582c56,_0x315125){return db[_0x7286('0x37')][_0x7286('0x38')]({'where':{'resetPasswordToken':_0x582c56[_0x7286('0x42')][_0x7286('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7286('0xd')](function(_0x55bf0f){if(!_0x55bf0f){throw new Error(_0x7286('0x44'));}return db[_0x7286('0x36')][_0x7286('0xb')]({'attributes':['id',_0x7286('0x45'),_0x7286('0x46'),_0x7286('0x47')]})[_0x7286('0xd')](function(_0x11f1e9){if(_0x11f1e9[_0x7286('0x45')])authService['validatePasswordPattern'](_0x582c56[_0x7286('0x32')]['password']);if(!_0x11f1e9[_0x7286('0x46')]||!_0x55bf0f['previousPasswords'])return _0x55bf0f;authService['validatePasswordHistory'](_0x582c56[_0x7286('0x32')][_0x7286('0x48')],_0x55bf0f['previousPasswords'],_0x11f1e9[_0x7286('0x47')]);return _0x55bf0f;})[_0x7286('0xd')](function(){_0x55bf0f[_0x7286('0x48')]=_0x582c56[_0x7286('0x32')]['password'];_0x55bf0f[_0x7286('0x49')]=null;_0x55bf0f[_0x7286('0x4a')]=null;return _0x55bf0f[_0x7286('0x3b')]();});})[_0x7286('0xd')](function(){_0x315125[_0x7286('0x2c')](0xc8)[_0x7286('0x2d')]({'message':'Password\x20reset!'});})[_0x7286('0x1e')](function(_0x4f2798){return handleError(_0x315125,0x1f4,_0x4f2798);});};passport[_0x7286('0x4b')]('local-login',new LocalStrategy({'usernameField':_0x7286('0x15'),'passwordField':'password'},function(_0x928d1f,_0x27f32e,_0x1449f3){return localAuthenticate(db[_0x7286('0x37')],_0x928d1f,_0x27f32e,_0x1449f3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fdc2387..3f2c996 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 _0xfd8b=['exports','express','Router','login','post','forgot','/reset/:token','reset'];(function(_0xd0b573,_0x3cbc25){var _0x1d31e0=function(_0x42fa21){while(--_0x42fa21){_0xd0b573['push'](_0xd0b573['shift']());}};_0x1d31e0(++_0x3cbc25);}(_0xfd8b,0x1d9));var _0xbfd8=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0xfd8b[_0x221b8c];return _0x3fab9f;};'use strict';var express=require(_0xbfd8('0x0'));var router=express[_0xbfd8('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xbfd8('0x2')]);router[_0xbfd8('0x3')]('/forgot',controller[_0xbfd8('0x4')]);router['post'](_0xbfd8('0x5'),controller[_0xbfd8('0x6')]);module[_0xbfd8('0x7')]=router; \ No newline at end of file +var _0x0df6=['forgot','/reset/:token','reset','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x1c1803,_0x2af614){var _0x2e8566=function(_0x15b929){while(--_0x15b929){_0x1c1803['push'](_0x1c1803['shift']());}};_0x2e8566(++_0x2af614);}(_0x0df6,0x8a));var _0x60df=function(_0xd57a8d,_0x4632cb){_0xd57a8d=_0xd57a8d-0x0;var _0x5c4582=_0x0df6[_0xd57a8d];return _0x5c4582;};'use strict';var express=require(_0x60df('0x0'));var router=express[_0x60df('0x1')]();var controller=require(_0x60df('0x2'));router[_0x60df('0x3')]('/',controller[_0x60df('0x4')]);router[_0x60df('0x3')](_0x60df('0x5'),controller[_0x60df('0x6')]);router[_0x60df('0x3')](_0x60df('0x7'),controller[_0x60df('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 793f710..ee2730b 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 _0x4129=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x58be00,_0xf98889){var _0x4b9818=function(_0xb574c2){while(--_0xb574c2){_0x58be00['push'](_0x58be00['shift']());}};_0x4b9818(++_0xf98889);}(_0x4129,0xd7));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x9412('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9412('0x1')]},'description':{'type':Sequelize[_0x9412('0x1')]},'status':{'type':Sequelize[_0x9412('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9412('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0eba=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x628e47,_0x350ee4){var _0x368636=function(_0x21c560){while(--_0x21c560){_0x628e47['push'](_0x628e47['shift']());}};_0x368636(++_0x350ee4);}(_0x0eba,0x191));var _0xa0eb=function(_0x290304,_0x5e485f){_0x290304=_0x290304-0x0;var _0x57da47=_0x0eba[_0x290304];return _0x57da47;};'use strict';var Sequelize=require(_0xa0eb('0x0'));module[_0xa0eb('0x1')]={'name':{'type':Sequelize[_0xa0eb('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa0eb('0x2')]},'description':{'type':Sequelize[_0xa0eb('0x2')]},'status':{'type':Sequelize[_0xa0eb('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa0eb('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index eae9ddd..a66981c 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 _0x7552=['update','then','destroy','error','name','map','Automation','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','include','show','params','includeAll','options','catch','create','body','find','addConditions','Condition','omit','ids','findOne','keys','order','pick','getConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x15fdee,_0x3191d1){var _0x57ce2d=function(_0xe2c813){while(--_0xe2c813){_0x15fdee['push'](_0x15fdee['shift']());}};_0x57ce2d(++_0x3191d1);}(_0x7552,0x11c));var _0x2755=function(_0x244881,_0x468437){_0x244881=_0x244881-0x0;var _0xefae95=_0x7552[_0x244881];return _0xefae95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2755('0x0'));var zipdir=require(_0x2755('0x1'));var jsonpatch=require(_0x2755('0x2'));var rp=require(_0x2755('0x3'));var moment=require(_0x2755('0x4'));var BPromise=require(_0x2755('0x5'));var Mustache=require('mustache');var util=require(_0x2755('0x6'));var path=require(_0x2755('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2755('0x8'));var fs=require('fs');var fs_extra=require(_0x2755('0x9'));var _=require(_0x2755('0xa'));var squel=require(_0x2755('0xb'));var crypto=require(_0x2755('0xc'));var jsforce=require(_0x2755('0xd'));var deskjs=require(_0x2755('0xe'));var toCsv=require(_0x2755('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2755('0x10'));var authService=require(_0x2755('0x11'));var qs=require(_0x2755('0x12'));var as=require(_0x2755('0x13'));var hardwareService=require(_0x2755('0x14'));var logger=require(_0x2755('0x15'))(_0x2755('0x16'));var utils=require(_0x2755('0x17'));var config=require(_0x2755('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b2ef,_0x428429){_0x428429=_0x428429||0xcc;return function(_0x4c848d){if(_0x4c848d){return _0x13b2ef[_0x2755('0x19')](_0x428429);}return _0x13b2ef[_0x2755('0x1a')](_0x428429)[_0x2755('0x1b')]();};}function respondWithResult(_0x1d7920,_0x422bb3){_0x422bb3=_0x422bb3||0xc8;return function(_0x1a9c50){if(_0x1a9c50){return _0x1d7920[_0x2755('0x1a')](_0x422bb3)['json'](_0x1a9c50);}};}function respondWithFilteredResult(_0x2ca7bc,_0x5ae116){return function(_0x37e765){if(_0x37e765){var _0x34a314=typeof _0x5ae116[_0x2755('0x1c')]===_0x2755('0x1d')&&typeof _0x5ae116['limit']===_0x2755('0x1d');var _0x28a00f=_0x37e765[_0x2755('0x1e')];var _0x9c524f=_0x34a314?0x0:_0x5ae116[_0x2755('0x1c')];var _0x5839a8=_0x34a314?_0x37e765['count']:_0x5ae116[_0x2755('0x1c')]+_0x5ae116[_0x2755('0x1f')];var _0xb35f91;if(_0x5839a8>=_0x28a00f){_0x5839a8=_0x28a00f;_0xb35f91=0xc8;}else{_0xb35f91=0xce;}_0x2ca7bc['status'](_0xb35f91);return _0x2ca7bc['set'](_0x2755('0x20'),_0x9c524f+'-'+_0x5839a8+'/'+_0x28a00f)['json'](_0x37e765);}return null;};}function patchUpdates(_0x1a4dcd){return function(_0x4b0513){try{jsonpatch[_0x2755('0x21')](_0x4b0513,_0x1a4dcd,!![]);}catch(_0x58db78){return BPromise[_0x2755('0x22')](_0x58db78);}return _0x4b0513[_0x2755('0x23')]();};}function saveUpdates(_0x31cdec,_0xc3d357){return function(_0x4929b7){if(_0x4929b7){return _0x4929b7[_0x2755('0x24')](_0x31cdec)[_0x2755('0x25')](function(_0x5d0391){return _0x5d0391;});}return null;};}function removeEntity(_0x3f0018,_0x529bdd){return function(_0x41dac){if(_0x41dac){return _0x41dac[_0x2755('0x26')]()[_0x2755('0x25')](function(){_0x3f0018[_0x2755('0x1a')](0xcc)[_0x2755('0x1b')]();});}};}function handleEntityNotFound(_0x44124c,_0x27242a){return function(_0x4cc0cf){if(!_0x4cc0cf){_0x44124c[_0x2755('0x19')](0x194);}return _0x4cc0cf;};}function handleError(_0x599249,_0x23b61f){_0x23b61f=_0x23b61f||0x1f4;return function(_0x59e2c5){logger[_0x2755('0x27')](_0x59e2c5['stack']);if(_0x59e2c5[_0x2755('0x28')]){delete _0x59e2c5[_0x2755('0x28')];}_0x599249[_0x2755('0x1a')](_0x23b61f)['send'](_0x59e2c5);};}exports['index']=function(_0x3026c9,_0x31a35f){var _0x401659={},_0xd55771={},_0x35fadb={'count':0x0,'rows':[]};var _0x216b86=_[_0x2755('0x29')](db[_0x2755('0x2a')][_0x2755('0x2b')],function(_0x5381e8){return{'name':_0x5381e8[_0x2755('0x2c')],'type':_0x5381e8[_0x2755('0x2d')][_0x2755('0x2e')]};});_0xd55771[_0x2755('0x2f')]=_[_0x2755('0x29')](_0x216b86,_0x2755('0x28'));_0xd55771['query']=_['keys'](_0x3026c9[_0x2755('0x30')]);_0xd55771['filters']=_[_0x2755('0x31')](_0xd55771['model'],_0xd55771[_0x2755('0x30')]);_0x401659[_0x2755('0x32')]=_['intersection'](_0xd55771[_0x2755('0x2f')],qs['fields'](_0x3026c9[_0x2755('0x30')][_0x2755('0x33')]));_0x401659[_0x2755('0x32')]=_0x401659[_0x2755('0x32')][_0x2755('0x34')]?_0x401659[_0x2755('0x32')]:_0xd55771[_0x2755('0x2f')];if(!_0x3026c9[_0x2755('0x30')][_0x2755('0x35')](_0x2755('0x36'))){_0x401659[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x3026c9['query'][_0x2755('0x1f')]);_0x401659[_0x2755('0x1c')]=qs[_0x2755('0x1c')](_0x3026c9['query']['offset']);}_0x401659['order']=qs[_0x2755('0x37')](_0x3026c9[_0x2755('0x30')][_0x2755('0x37')]);_0x401659[_0x2755('0x38')]=qs[_0x2755('0x39')](_['pick'](_0x3026c9[_0x2755('0x30')],_0xd55771[_0x2755('0x39')]),_0x216b86);if(_0x3026c9[_0x2755('0x30')][_0x2755('0x3a')]){_0x401659[_0x2755('0x38')]=_[_0x2755('0x3b')](_0x401659[_0x2755('0x38')],{'$or':_['map'](_0x216b86,function(_0x438a6d){if(_0x438a6d[_0x2755('0x2d')]!=='VIRTUAL'){var _0x1fc52d={};_0x1fc52d[_0x438a6d[_0x2755('0x28')]]={'$like':'%'+_0x3026c9[_0x2755('0x30')][_0x2755('0x3a')]+'%'};return _0x1fc52d;}})});}_0x401659=_[_0x2755('0x3b')]({},_0x401659,_0x3026c9['options']);var _0x1e8e7d={'where':_0x401659['where']};return db[_0x2755('0x2a')]['count'](_0x1e8e7d)['then'](function(_0x33146d){_0x35fadb[_0x2755('0x1e')]=_0x33146d;if(_0x3026c9[_0x2755('0x30')]['includeAll']){_0x401659[_0x2755('0x3c')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x401659);})['then'](function(_0x5ae143){_0x35fadb['rows']=_0x5ae143;return _0x35fadb;})[_0x2755('0x25')](respondWithFilteredResult(_0x31a35f,_0x401659))['catch'](handleError(_0x31a35f,null));};exports[_0x2755('0x3d')]=function(_0x40f9b4,_0x4b40d8){var _0x1d9635={'raw':![],'where':{'id':_0x40f9b4[_0x2755('0x3e')]['id']}},_0x5f16be={};_0x5f16be[_0x2755('0x2f')]=_['keys'](db[_0x2755('0x2a')][_0x2755('0x2b')]);_0x5f16be[_0x2755('0x30')]=_['keys'](_0x40f9b4['query']);_0x5f16be[_0x2755('0x39')]=_[_0x2755('0x31')](_0x5f16be[_0x2755('0x2f')],_0x5f16be[_0x2755('0x30')]);_0x1d9635[_0x2755('0x32')]=_[_0x2755('0x31')](_0x5f16be[_0x2755('0x2f')],qs['fields'](_0x40f9b4[_0x2755('0x30')][_0x2755('0x33')]));_0x1d9635['attributes']=_0x1d9635[_0x2755('0x32')][_0x2755('0x34')]?_0x1d9635['attributes']:_0x5f16be[_0x2755('0x2f')];if(_0x40f9b4[_0x2755('0x30')][_0x2755('0x3f')]){_0x1d9635[_0x2755('0x3c')]=[{'all':!![]}];}_0x1d9635=_[_0x2755('0x3b')]({},_0x1d9635,_0x40f9b4[_0x2755('0x40')]);return db[_0x2755('0x2a')]['find'](_0x1d9635)[_0x2755('0x25')](handleEntityNotFound(_0x4b40d8,null))[_0x2755('0x25')](respondWithResult(_0x4b40d8,null))[_0x2755('0x41')](handleError(_0x4b40d8,null));};exports['create']=function(_0x5c8c4e,_0x1e4e11){return db[_0x2755('0x2a')][_0x2755('0x42')](_0x5c8c4e[_0x2755('0x43')],{})['then'](respondWithResult(_0x1e4e11,0xc9))[_0x2755('0x41')](handleError(_0x1e4e11,null));};exports[_0x2755('0x24')]=function(_0x4e9644,_0x3fe9da){if(_0x4e9644[_0x2755('0x43')]['id']){delete _0x4e9644[_0x2755('0x43')]['id'];}return db[_0x2755('0x2a')][_0x2755('0x44')]({'where':{'id':_0x4e9644[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x3fe9da,null))[_0x2755('0x25')](saveUpdates(_0x4e9644[_0x2755('0x43')],null))[_0x2755('0x25')](respondWithResult(_0x3fe9da,null))[_0x2755('0x41')](handleError(_0x3fe9da,null));};exports[_0x2755('0x26')]=function(_0x4b1dc0,_0x137247){return db[_0x2755('0x2a')][_0x2755('0x44')]({'where':{'id':_0x4b1dc0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x137247,null))[_0x2755('0x25')](removeEntity(_0x137247,null))[_0x2755('0x41')](handleError(_0x137247,null));};exports[_0x2755('0x45')]=function(_0x8038f9,_0x502497,_0x1e842e){return db[_0x2755('0x46')][_0x2755('0x44')]({'where':{'id':_0x8038f9[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x502497,null))[_0x2755('0x25')](function(_0x23f583){if(_0x23f583){return _0x23f583['addConditions'](_0x8038f9[_0x2755('0x43')]['ids'],_[_0x2755('0x47')](_0x8038f9[_0x2755('0x43')],[_0x2755('0x48'),'id'])||{});}})[_0x2755('0x25')](respondWithResult(_0x502497,null))[_0x2755('0x41')](handleError(_0x502497,null));};exports['getConditions']=function(_0x52ffb0,_0x439a13,_0x118b4f){var _0x1d1701={};var _0x3b3e5a={};var _0x568fb5;var _0x57232e;return db['Automation'][_0x2755('0x49')]({'where':{'id':_0x52ffb0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x439a13,null))[_0x2755('0x25')](function(_0x2ed3d3){if(_0x2ed3d3){_0x568fb5=_0x2ed3d3;_0x3b3e5a[_0x2755('0x2f')]=_[_0x2755('0x4a')](db['Condition'][_0x2755('0x2b')]);_0x3b3e5a[_0x2755('0x30')]=_[_0x2755('0x4a')](_0x52ffb0[_0x2755('0x30')]);_0x3b3e5a[_0x2755('0x39')]=_[_0x2755('0x31')](_0x3b3e5a[_0x2755('0x2f')],_0x3b3e5a[_0x2755('0x30')]);_0x1d1701[_0x2755('0x32')]=_['intersection'](_0x3b3e5a['model'],qs[_0x2755('0x33')](_0x52ffb0[_0x2755('0x30')][_0x2755('0x33')]));_0x1d1701['attributes']=_0x1d1701['attributes'][_0x2755('0x34')]?_0x1d1701['attributes']:_0x3b3e5a[_0x2755('0x2f')];_0x1d1701[_0x2755('0x4b')]=qs[_0x2755('0x37')](_0x52ffb0['query']['sort']);_0x1d1701['where']=qs[_0x2755('0x39')](_[_0x2755('0x4c')](_0x52ffb0[_0x2755('0x30')],_0x3b3e5a['filters']));if(_0x52ffb0[_0x2755('0x30')][_0x2755('0x3a')]){_0x1d1701['where']=_[_0x2755('0x3b')](_0x1d1701['where'],{'$or':_[_0x2755('0x29')](_0x1d1701['attributes'],function(_0x53850a){var _0x50d699={};_0x50d699[_0x53850a]={'$like':'%'+_0x52ffb0[_0x2755('0x30')][_0x2755('0x3a')]+'%'};return _0x50d699;})});}_0x1d1701=_[_0x2755('0x3b')]({},_0x1d1701,_0x52ffb0[_0x2755('0x40')]);return _0x568fb5[_0x2755('0x4d')](_0x1d1701);}})[_0x2755('0x25')](function(_0x2663e5){if(_0x2663e5){_0x57232e=_0x2663e5[_0x2755('0x34')];if(!_0x52ffb0['query']['hasOwnProperty']('nolimit')){_0x1d1701[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x52ffb0['query'][_0x2755('0x1f')]);_0x1d1701[_0x2755('0x1c')]=qs['offset'](_0x52ffb0[_0x2755('0x30')][_0x2755('0x1c')]);}return _0x568fb5[_0x2755('0x4d')](_0x1d1701);}})[_0x2755('0x25')](function(_0x4f3d89){if(_0x4f3d89){return _0x4f3d89?{'count':_0x57232e,'rows':_0x4f3d89}:null;}})[_0x2755('0x25')](respondWithResult(_0x439a13,null))[_0x2755('0x41')](handleError(_0x439a13,null));};exports['addActions']=function(_0x2ec3d0,_0x36ee1b,_0x46eeb3){return db[_0x2755('0x4e')]['find']({'where':{'id':_0x2ec3d0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x36ee1b,null))[_0x2755('0x25')](function(_0x1f034e){if(_0x1f034e){return _0x1f034e['addActions'](_0x2ec3d0[_0x2755('0x43')][_0x2755('0x48')],_[_0x2755('0x47')](_0x2ec3d0['body'],[_0x2755('0x48'),'id'])||{});}})[_0x2755('0x25')](respondWithResult(_0x36ee1b,null))[_0x2755('0x41')](handleError(_0x36ee1b,null));};exports['getActions']=function(_0x4c45b0,_0x2efecd,_0x435a80){var _0x1bbc70={};var _0x46330f={};var _0xf01d64;var _0xd11e88;return db[_0x2755('0x2a')][_0x2755('0x49')]({'where':{'id':_0x4c45b0['params']['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x2efecd,null))[_0x2755('0x25')](function(_0xb2ff38){if(_0xb2ff38){_0xf01d64=_0xb2ff38;_0x46330f[_0x2755('0x2f')]=_[_0x2755('0x4a')](db[_0x2755('0x4e')][_0x2755('0x2b')]);_0x46330f['query']=_[_0x2755('0x4a')](_0x4c45b0[_0x2755('0x30')]);_0x46330f[_0x2755('0x39')]=_[_0x2755('0x31')](_0x46330f[_0x2755('0x2f')],_0x46330f['query']);_0x1bbc70['attributes']=_[_0x2755('0x31')](_0x46330f[_0x2755('0x2f')],qs[_0x2755('0x33')](_0x4c45b0[_0x2755('0x30')][_0x2755('0x33')]));_0x1bbc70[_0x2755('0x32')]=_0x1bbc70[_0x2755('0x32')][_0x2755('0x34')]?_0x1bbc70['attributes']:_0x46330f[_0x2755('0x2f')];_0x1bbc70[_0x2755('0x4b')]=qs['sort'](_0x4c45b0[_0x2755('0x30')][_0x2755('0x37')]);_0x1bbc70['where']=qs[_0x2755('0x39')](_[_0x2755('0x4c')](_0x4c45b0['query'],_0x46330f['filters']));if(_0x4c45b0['query'][_0x2755('0x3a')]){_0x1bbc70[_0x2755('0x38')]=_['merge'](_0x1bbc70['where'],{'$or':_['map'](_0x1bbc70['attributes'],function(_0x2ac0a8){var _0x5967d6={};_0x5967d6[_0x2ac0a8]={'$like':'%'+_0x4c45b0['query'][_0x2755('0x3a')]+'%'};return _0x5967d6;})});}_0x1bbc70=_[_0x2755('0x3b')]({},_0x1bbc70,_0x4c45b0[_0x2755('0x40')]);return _0xf01d64[_0x2755('0x4f')](_0x1bbc70);}})[_0x2755('0x25')](function(_0x3fea2d){if(_0x3fea2d){_0xd11e88=_0x3fea2d[_0x2755('0x34')];if(!_0x4c45b0[_0x2755('0x30')][_0x2755('0x35')](_0x2755('0x36'))){_0x1bbc70[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x4c45b0[_0x2755('0x30')][_0x2755('0x1f')]);_0x1bbc70[_0x2755('0x1c')]=qs['offset'](_0x4c45b0[_0x2755('0x30')][_0x2755('0x1c')]);}return _0xf01d64[_0x2755('0x4f')](_0x1bbc70);}})['then'](function(_0x5ed979){if(_0x5ed979){return _0x5ed979?{'count':_0xd11e88,'rows':_0x5ed979}:null;}})[_0x2755('0x25')](respondWithResult(_0x2efecd,null))[_0x2755('0x41')](handleError(_0x2efecd,null));}; \ No newline at end of file +var _0x0de2=['ids','omit','getConditions','length','addActions','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','show','params','find','catch','create','body','update','destroy','addConditions','Condition'];(function(_0x4ccd40,_0x1892e0){var _0x4c9ecf=function(_0xe17be2){while(--_0xe17be2){_0x4ccd40['push'](_0x4ccd40['shift']());}};_0x4c9ecf(++_0x1892e0);}(_0x0de2,0xac));var _0x20de=function(_0x12df52,_0x4dddf5){_0x12df52=_0x12df52-0x0;var _0x228658=_0x0de2[_0x12df52];return _0x228658;};'use strict';var emlformat=require(_0x20de('0x0'));var rimraf=require(_0x20de('0x1'));var zipdir=require(_0x20de('0x2'));var jsonpatch=require(_0x20de('0x3'));var rp=require(_0x20de('0x4'));var moment=require(_0x20de('0x5'));var BPromise=require(_0x20de('0x6'));var Mustache=require(_0x20de('0x7'));var util=require('util');var path=require(_0x20de('0x8'));var sox=require(_0x20de('0x9'));var csv=require(_0x20de('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20de('0xb'));var squel=require(_0x20de('0xc'));var crypto=require(_0x20de('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20de('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x20de('0xf'));var Redis=require('ioredis');var authService=require(_0x20de('0x10'));var qs=require(_0x20de('0x11'));var as=require(_0x20de('0x12'));var hardwareService=require(_0x20de('0x13'));var logger=require(_0x20de('0x14'))(_0x20de('0x15'));var utils=require(_0x20de('0x16'));var config=require(_0x20de('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x20de('0x18'))['db'];function respondWithStatusCode(_0x557102,_0x57d1e3){_0x57d1e3=_0x57d1e3||0xcc;return function(_0x9c853e){if(_0x9c853e){return _0x557102[_0x20de('0x19')](_0x57d1e3);}return _0x557102['status'](_0x57d1e3)[_0x20de('0x1a')]();};}function respondWithResult(_0x3ba03c,_0x5d17ee){_0x5d17ee=_0x5d17ee||0xc8;return function(_0x53ba8c){if(_0x53ba8c){return _0x3ba03c[_0x20de('0x1b')](_0x5d17ee)[_0x20de('0x1c')](_0x53ba8c);}};}function respondWithFilteredResult(_0x405568,_0x13d61c){return function(_0x2cbd3a){if(_0x2cbd3a){var _0x4ec351=typeof _0x13d61c[_0x20de('0x1d')]===_0x20de('0x1e')&&typeof _0x13d61c[_0x20de('0x1f')]==='undefined';var _0x4c502e=_0x2cbd3a[_0x20de('0x20')];var _0x3cc988=_0x4ec351?0x0:_0x13d61c[_0x20de('0x1d')];var _0x42cbea=_0x4ec351?_0x2cbd3a['count']:_0x13d61c[_0x20de('0x1d')]+_0x13d61c[_0x20de('0x1f')];var _0x432660;if(_0x42cbea>=_0x4c502e){_0x42cbea=_0x4c502e;_0x432660=0xc8;}else{_0x432660=0xce;}_0x405568[_0x20de('0x1b')](_0x432660);return _0x405568['set']('Content-Range',_0x3cc988+'-'+_0x42cbea+'/'+_0x4c502e)[_0x20de('0x1c')](_0x2cbd3a);}return null;};}function patchUpdates(_0x49b3a5){return function(_0xc48417){try{jsonpatch[_0x20de('0x21')](_0xc48417,_0x49b3a5,!![]);}catch(_0x5011d0){return BPromise['reject'](_0x5011d0);}return _0xc48417['save']();};}function saveUpdates(_0x1b17fe,_0x7b9905){return function(_0x80cfa6){if(_0x80cfa6){return _0x80cfa6['update'](_0x1b17fe)['then'](function(_0xadee50){return _0xadee50;});}return null;};}function removeEntity(_0x4adf36,_0x40dbf4){return function(_0x4ed3f5){if(_0x4ed3f5){return _0x4ed3f5['destroy']()['then'](function(){_0x4adf36[_0x20de('0x1b')](0xcc)[_0x20de('0x1a')]();});}};}function handleEntityNotFound(_0x4d1030,_0xf6688c){return function(_0x518b4d){if(!_0x518b4d){_0x4d1030[_0x20de('0x19')](0x194);}return _0x518b4d;};}function handleError(_0x4d24d8,_0x1bf4c6){_0x1bf4c6=_0x1bf4c6||0x1f4;return function(_0xf09a9b){logger[_0x20de('0x22')](_0xf09a9b[_0x20de('0x23')]);if(_0xf09a9b[_0x20de('0x24')]){delete _0xf09a9b[_0x20de('0x24')];}_0x4d24d8[_0x20de('0x1b')](_0x1bf4c6)[_0x20de('0x25')](_0xf09a9b);};}exports[_0x20de('0x26')]=function(_0x597117,_0x450859){var _0x4bb6f3={},_0x4181a4={},_0x289649={'count':0x0,'rows':[]};var _0x4be4f8=_['map'](db[_0x20de('0x27')][_0x20de('0x28')],function(_0x2d4c14){return{'name':_0x2d4c14[_0x20de('0x29')],'type':_0x2d4c14[_0x20de('0x2a')][_0x20de('0x2b')]};});_0x4181a4[_0x20de('0x2c')]=_[_0x20de('0x2d')](_0x4be4f8,_0x20de('0x24'));_0x4181a4[_0x20de('0x2e')]=_[_0x20de('0x2f')](_0x597117[_0x20de('0x2e')]);_0x4181a4[_0x20de('0x30')]=_['intersection'](_0x4181a4[_0x20de('0x2c')],_0x4181a4[_0x20de('0x2e')]);_0x4bb6f3['attributes']=_[_0x20de('0x31')](_0x4181a4[_0x20de('0x2c')],qs[_0x20de('0x32')](_0x597117[_0x20de('0x2e')][_0x20de('0x32')]));_0x4bb6f3[_0x20de('0x33')]=_0x4bb6f3[_0x20de('0x33')]['length']?_0x4bb6f3[_0x20de('0x33')]:_0x4181a4[_0x20de('0x2c')];if(!_0x597117[_0x20de('0x2e')][_0x20de('0x34')]('nolimit')){_0x4bb6f3['limit']=qs[_0x20de('0x1f')](_0x597117['query'][_0x20de('0x1f')]);_0x4bb6f3[_0x20de('0x1d')]=qs[_0x20de('0x1d')](_0x597117[_0x20de('0x2e')][_0x20de('0x1d')]);}_0x4bb6f3[_0x20de('0x35')]=qs[_0x20de('0x36')](_0x597117['query'][_0x20de('0x36')]);_0x4bb6f3[_0x20de('0x37')]=qs[_0x20de('0x30')](_[_0x20de('0x38')](_0x597117[_0x20de('0x2e')],_0x4181a4['filters']),_0x4be4f8);if(_0x597117['query'][_0x20de('0x39')]){_0x4bb6f3[_0x20de('0x37')]=_[_0x20de('0x3a')](_0x4bb6f3['where'],{'$or':_[_0x20de('0x2d')](_0x4be4f8,function(_0x3390fa){if(_0x3390fa[_0x20de('0x2a')]!==_0x20de('0x3b')){var _0x2942ac={};_0x2942ac[_0x3390fa[_0x20de('0x24')]]={'$like':'%'+_0x597117[_0x20de('0x2e')]['filter']+'%'};return _0x2942ac;}})});}_0x4bb6f3=_[_0x20de('0x3a')]({},_0x4bb6f3,_0x597117[_0x20de('0x3c')]);var _0xbdc5f6={'where':_0x4bb6f3[_0x20de('0x37')]};return db[_0x20de('0x27')][_0x20de('0x20')](_0xbdc5f6)[_0x20de('0x3d')](function(_0x346f38){_0x289649[_0x20de('0x20')]=_0x346f38;if(_0x597117[_0x20de('0x2e')][_0x20de('0x3e')]){_0x4bb6f3[_0x20de('0x3f')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x4bb6f3);})[_0x20de('0x3d')](function(_0x24563e){_0x289649['rows']=_0x24563e;return _0x289649;})[_0x20de('0x3d')](respondWithFilteredResult(_0x450859,_0x4bb6f3))['catch'](handleError(_0x450859,null));};exports[_0x20de('0x40')]=function(_0x598f3e,_0x4925f7){var _0x4e426e={'raw':![],'where':{'id':_0x598f3e[_0x20de('0x41')]['id']}},_0x1f34fb={};_0x1f34fb['model']=_[_0x20de('0x2f')](db['Automation']['rawAttributes']);_0x1f34fb['query']=_[_0x20de('0x2f')](_0x598f3e[_0x20de('0x2e')]);_0x1f34fb[_0x20de('0x30')]=_[_0x20de('0x31')](_0x1f34fb[_0x20de('0x2c')],_0x1f34fb['query']);_0x4e426e['attributes']=_[_0x20de('0x31')](_0x1f34fb[_0x20de('0x2c')],qs[_0x20de('0x32')](_0x598f3e[_0x20de('0x2e')]['fields']));_0x4e426e[_0x20de('0x33')]=_0x4e426e[_0x20de('0x33')]['length']?_0x4e426e['attributes']:_0x1f34fb[_0x20de('0x2c')];if(_0x598f3e[_0x20de('0x2e')][_0x20de('0x3e')]){_0x4e426e['include']=[{'all':!![]}];}_0x4e426e=_[_0x20de('0x3a')]({},_0x4e426e,_0x598f3e[_0x20de('0x3c')]);return db[_0x20de('0x27')][_0x20de('0x42')](_0x4e426e)[_0x20de('0x3d')](handleEntityNotFound(_0x4925f7,null))['then'](respondWithResult(_0x4925f7,null))[_0x20de('0x43')](handleError(_0x4925f7,null));};exports['create']=function(_0x46b9f5,_0xedc812){return db[_0x20de('0x27')][_0x20de('0x44')](_0x46b9f5[_0x20de('0x45')],{})[_0x20de('0x3d')](respondWithResult(_0xedc812,0xc9))[_0x20de('0x43')](handleError(_0xedc812,null));};exports[_0x20de('0x46')]=function(_0x41d9e1,_0x270b16){if(_0x41d9e1[_0x20de('0x45')]['id']){delete _0x41d9e1[_0x20de('0x45')]['id'];}return db['Automation'][_0x20de('0x42')]({'where':{'id':_0x41d9e1[_0x20de('0x41')]['id']}})['then'](handleEntityNotFound(_0x270b16,null))[_0x20de('0x3d')](saveUpdates(_0x41d9e1[_0x20de('0x45')],null))['then'](respondWithResult(_0x270b16,null))[_0x20de('0x43')](handleError(_0x270b16,null));};exports[_0x20de('0x47')]=function(_0x7279e3,_0x313839){return db[_0x20de('0x27')][_0x20de('0x42')]({'where':{'id':_0x7279e3[_0x20de('0x41')]['id']}})['then'](handleEntityNotFound(_0x313839,null))[_0x20de('0x3d')](removeEntity(_0x313839,null))[_0x20de('0x43')](handleError(_0x313839,null));};exports[_0x20de('0x48')]=function(_0x5b8e38,_0x3e50dd,_0x21fc6d){return db[_0x20de('0x49')][_0x20de('0x42')]({'where':{'id':_0x5b8e38[_0x20de('0x41')]['id']}})[_0x20de('0x3d')](handleEntityNotFound(_0x3e50dd,null))[_0x20de('0x3d')](function(_0x14e091){if(_0x14e091){return _0x14e091[_0x20de('0x48')](_0x5b8e38['body'][_0x20de('0x4a')],_[_0x20de('0x4b')](_0x5b8e38[_0x20de('0x45')],['ids','id'])||{});}})[_0x20de('0x3d')](respondWithResult(_0x3e50dd,null))[_0x20de('0x43')](handleError(_0x3e50dd,null));};exports[_0x20de('0x4c')]=function(_0x1d648b,_0x9bc4de,_0x637fc6){var _0x1e0deb={};var _0x2e70fc={};var _0x150c5d;var _0x3b7627;return db['Automation']['findOne']({'where':{'id':_0x1d648b['params']['id']}})[_0x20de('0x3d')](handleEntityNotFound(_0x9bc4de,null))['then'](function(_0x1b5bc5){if(_0x1b5bc5){_0x150c5d=_0x1b5bc5;_0x2e70fc[_0x20de('0x2c')]=_[_0x20de('0x2f')](db[_0x20de('0x49')][_0x20de('0x28')]);_0x2e70fc[_0x20de('0x2e')]=_['keys'](_0x1d648b[_0x20de('0x2e')]);_0x2e70fc[_0x20de('0x30')]=_[_0x20de('0x31')](_0x2e70fc[_0x20de('0x2c')],_0x2e70fc['query']);_0x1e0deb[_0x20de('0x33')]=_['intersection'](_0x2e70fc['model'],qs[_0x20de('0x32')](_0x1d648b[_0x20de('0x2e')][_0x20de('0x32')]));_0x1e0deb['attributes']=_0x1e0deb[_0x20de('0x33')][_0x20de('0x4d')]?_0x1e0deb['attributes']:_0x2e70fc[_0x20de('0x2c')];_0x1e0deb[_0x20de('0x35')]=qs[_0x20de('0x36')](_0x1d648b[_0x20de('0x2e')][_0x20de('0x36')]);_0x1e0deb[_0x20de('0x37')]=qs[_0x20de('0x30')](_['pick'](_0x1d648b['query'],_0x2e70fc['filters']));if(_0x1d648b[_0x20de('0x2e')][_0x20de('0x39')]){_0x1e0deb[_0x20de('0x37')]=_[_0x20de('0x3a')](_0x1e0deb[_0x20de('0x37')],{'$or':_['map'](_0x1e0deb[_0x20de('0x33')],function(_0x1fc2ba){var _0x2da60e={};_0x2da60e[_0x1fc2ba]={'$like':'%'+_0x1d648b[_0x20de('0x2e')][_0x20de('0x39')]+'%'};return _0x2da60e;})});}_0x1e0deb=_['merge']({},_0x1e0deb,_0x1d648b['options']);return _0x150c5d[_0x20de('0x4c')](_0x1e0deb);}})[_0x20de('0x3d')](function(_0x436cd7){if(_0x436cd7){_0x3b7627=_0x436cd7[_0x20de('0x4d')];if(!_0x1d648b['query'][_0x20de('0x34')]('nolimit')){_0x1e0deb[_0x20de('0x1f')]=qs[_0x20de('0x1f')](_0x1d648b[_0x20de('0x2e')]['limit']);_0x1e0deb[_0x20de('0x1d')]=qs[_0x20de('0x1d')](_0x1d648b['query']['offset']);}return _0x150c5d[_0x20de('0x4c')](_0x1e0deb);}})[_0x20de('0x3d')](function(_0x1d65a7){if(_0x1d65a7){return _0x1d65a7?{'count':_0x3b7627,'rows':_0x1d65a7}:null;}})['then'](respondWithResult(_0x9bc4de,null))[_0x20de('0x43')](handleError(_0x9bc4de,null));};exports['addActions']=function(_0x40841c,_0x457e88,_0x2d41cc){return db['Action']['find']({'where':{'id':_0x40841c[_0x20de('0x41')]['id']}})[_0x20de('0x3d')](handleEntityNotFound(_0x457e88,null))['then'](function(_0x4263ab){if(_0x4263ab){return _0x4263ab[_0x20de('0x4e')](_0x40841c['body']['ids'],_[_0x20de('0x4b')](_0x40841c[_0x20de('0x45')],[_0x20de('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x457e88,null))['catch'](handleError(_0x457e88,null));};exports[_0x20de('0x4f')]=function(_0x269e5a,_0xe63598,_0x169b83){var _0x538234={};var _0x2b3dae={};var _0x5f46d4;var _0x11cc18;return db[_0x20de('0x27')][_0x20de('0x50')]({'where':{'id':_0x269e5a[_0x20de('0x41')]['id']}})['then'](handleEntityNotFound(_0xe63598,null))['then'](function(_0x357fff){if(_0x357fff){_0x5f46d4=_0x357fff;_0x2b3dae[_0x20de('0x2c')]=_[_0x20de('0x2f')](db[_0x20de('0x51')][_0x20de('0x28')]);_0x2b3dae[_0x20de('0x2e')]=_[_0x20de('0x2f')](_0x269e5a['query']);_0x2b3dae['filters']=_[_0x20de('0x31')](_0x2b3dae[_0x20de('0x2c')],_0x2b3dae['query']);_0x538234[_0x20de('0x33')]=_[_0x20de('0x31')](_0x2b3dae[_0x20de('0x2c')],qs[_0x20de('0x32')](_0x269e5a['query'][_0x20de('0x32')]));_0x538234[_0x20de('0x33')]=_0x538234[_0x20de('0x33')][_0x20de('0x4d')]?_0x538234[_0x20de('0x33')]:_0x2b3dae[_0x20de('0x2c')];_0x538234[_0x20de('0x35')]=qs[_0x20de('0x36')](_0x269e5a[_0x20de('0x2e')][_0x20de('0x36')]);_0x538234[_0x20de('0x37')]=qs[_0x20de('0x30')](_[_0x20de('0x38')](_0x269e5a[_0x20de('0x2e')],_0x2b3dae[_0x20de('0x30')]));if(_0x269e5a['query'][_0x20de('0x39')]){_0x538234[_0x20de('0x37')]=_[_0x20de('0x3a')](_0x538234[_0x20de('0x37')],{'$or':_['map'](_0x538234[_0x20de('0x33')],function(_0x327499){var _0x2139c5={};_0x2139c5[_0x327499]={'$like':'%'+_0x269e5a[_0x20de('0x2e')]['filter']+'%'};return _0x2139c5;})});}_0x538234=_[_0x20de('0x3a')]({},_0x538234,_0x269e5a[_0x20de('0x3c')]);return _0x5f46d4[_0x20de('0x4f')](_0x538234);}})['then'](function(_0x8cc103){if(_0x8cc103){_0x11cc18=_0x8cc103[_0x20de('0x4d')];if(!_0x269e5a[_0x20de('0x2e')][_0x20de('0x34')]('nolimit')){_0x538234[_0x20de('0x1f')]=qs[_0x20de('0x1f')](_0x269e5a[_0x20de('0x2e')][_0x20de('0x1f')]);_0x538234['offset']=qs[_0x20de('0x1d')](_0x269e5a['query'][_0x20de('0x1d')]);}return _0x5f46d4['getActions'](_0x538234);}})[_0x20de('0x3d')](function(_0x14bfd4){if(_0x14bfd4){return _0x14bfd4?{'count':_0x11cc18,'rows':_0x14bfd4}:null;}})[_0x20de('0x3d')](respondWithResult(_0xe63598,null))[_0x20de('0x43')](handleError(_0xe63598,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f2c7cb8..c688717 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 _0x4af9=['api','moment','request-promise','rimraf','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x275621,_0x524302){var _0x2ad056=function(_0x1e962f){while(--_0x1e962f){_0x275621['push'](_0x275621['shift']());}};_0x2ad056(++_0x524302);}(_0x4af9,0xda));var _0x94af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4af9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x94af('0x0'));var util=require('util');var logger=require(_0x94af('0x1'))(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require('bluebird');var rp=require(_0x94af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94af('0x5'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x94af('0x6')]=function(_0x354c4b,_0x222989){return _0x354c4b[_0x94af('0x7')](_0x94af('0x8'),attributes,{'tableName':_0x94af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ff7=['exports','define','tools_automations','../../config/logger','api','moment','bluebird','request-promise','./automation.attributes'];(function(_0x42c761,_0x4c8585){var _0x5af01f=function(_0x2b55fd){while(--_0x2b55fd){_0x42c761['push'](_0x42c761['shift']());}};_0x5af01f(++_0x4c8585);}(_0x9ff7,0x1bc));var _0x79ff=function(_0x3ae8fe,_0x428c4d){_0x3ae8fe=_0x3ae8fe-0x0;var _0x4edfe9=_0x9ff7[_0x3ae8fe];return _0x4edfe9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79ff('0x0'))(_0x79ff('0x1'));var moment=require(_0x79ff('0x2'));var BPromise=require(_0x79ff('0x3'));var rp=require(_0x79ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79ff('0x5'));module[_0x79ff('0x6')]=function(_0x436b06,_0x34f00d){return _0x436b06[_0x79ff('0x7')]('Automation',attributes,{'tableName':_0x79ff('0x8'),'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 ee1218c..da9819b 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 _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x146ebc,_0x1124d0){_0x146ebc=_0x146ebc-0x0;var _0x22c869=_0xb03e[_0x146ebc];return _0x22c869;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('Automation,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file +var _0x29b6=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14df77,_0x46aedb){var _0x3a9e30=function(_0x1e5da2){while(--_0x1e5da2){_0x14df77['push'](_0x14df77['shift']());}};_0x3a9e30(++_0x46aedb);}(_0x29b6,0x17e));var _0x629b=function(_0xee5490,_0x9ae8dc){_0xee5490=_0xee5490-0x0;var _0x50de55=_0x29b6[_0xee5490];return _0x50de55;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var moment=require(_0x629b('0x2'));var BPromise=require(_0x629b('0x3'));var rs=require(_0x629b('0x4'));var fs=require('fs');var Redis=require(_0x629b('0x5'));var db=require(_0x629b('0x6'))['db'];var utils=require(_0x629b('0x7'));var logger=require(_0x629b('0x8'))(_0x629b('0x9'));var config=require('../../config/environment');var jayson=require(_0x629b('0xa'));var client=jayson['client'][_0x629b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acc5a,_0x26e439,_0x398ecb){return new BPromise(function(_0x4e90cd,_0xc44b27){return client[_0x629b('0xc')](_0x4acc5a,_0x398ecb)['then'](function(_0x28c152){logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));logger[_0x629b('0x10')](_0x629b('0x11'),_0x26e439,_0x629b('0xf'),JSON[_0x629b('0x12')](_0x28c152));if(_0x28c152[_0x629b('0x13')]){if(_0x28c152[_0x629b('0x13')]['code']===0x1f4){logger['error'](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);return _0xc44b27(_0x28c152['error'][_0x629b('0x14')]);}logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')]['message']);return _0x4e90cd(_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);}else{logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));_0x4e90cd(_0x28c152['result'][_0x629b('0x14')]);}})['catch'](function(_0x151b93){logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x151b93);_0xc44b27(_0x151b93);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 25e6e75..66ffdea 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 _0x7df1=['/:id/actions','post','/:id/conditions','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','show','getConditions'];(function(_0x3dacef,_0x513c82){var _0x14e9b5=function(_0xb1ba8c){while(--_0xb1ba8c){_0x3dacef['push'](_0x3dacef['shift']());}};_0x14e9b5(++_0x513c82);}(_0x7df1,0xe4));var _0x17df=function(_0x3d8b32,_0x5381e0){_0x3d8b32=_0x3d8b32-0x0;var _0xf081c3=_0x7df1[_0x3d8b32];return _0xf081c3;};'use strict';var multer=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var path=require(_0x17df('0x2'));var timeout=require('connect-timeout');var express=require(_0x17df('0x3'));var router=express[_0x17df('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x17df('0x5'));var config=require(_0x17df('0x6'));var controller=require(_0x17df('0x7'));router['get']('/',auth[_0x17df('0x8')](),controller['index']);router[_0x17df('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x17df('0xa')]);router[_0x17df('0x9')]('/:id/conditions',auth[_0x17df('0x8')](),controller[_0x17df('0xb')]);router[_0x17df('0x9')](_0x17df('0xc'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x17df('0x8')](),controller['create']);router[_0x17df('0xd')](_0x17df('0xe'),auth['isAuthenticated'](),controller['addConditions']);router[_0x17df('0xd')](_0x17df('0xc'),auth[_0x17df('0x8')](),controller['addActions']);router[_0x17df('0xf')](_0x17df('0x10'),auth[_0x17df('0x8')](),controller[_0x17df('0x11')]);router[_0x17df('0x12')](_0x17df('0x10'),auth[_0x17df('0x8')](),controller[_0x17df('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe2cc=['/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x1530a4,_0x5abb24){var _0x53cda2=function(_0x4a42c0){while(--_0x4a42c0){_0x1530a4['push'](_0x1530a4['shift']());}};_0x53cda2(++_0x5abb24);}(_0xe2cc,0x69));var _0xce2c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe2cc[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce2c('0x2'));var router=express[_0xce2c('0x3')]();var fs_extra=require(_0xce2c('0x4'));var auth=require(_0xce2c('0x5'));var interaction=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var controller=require(_0xce2c('0x8'));router[_0xce2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce2c('0x9')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xc')]);router[_0xce2c('0x9')](_0xce2c('0xd'),auth['isAuthenticated'](),controller[_0xce2c('0xe')]);router[_0xce2c('0x9')](_0xce2c('0xf'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x10')]);router[_0xce2c('0x11')]('/',auth[_0xce2c('0xb')](),controller[_0xce2c('0x12')]);router[_0xce2c('0x11')](_0xce2c('0xd'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x13')]);router[_0xce2c('0x11')](_0xce2c('0xf'),auth[_0xce2c('0xb')](),controller['addActions']);router['put'](_0xce2c('0xa'),auth['isAuthenticated'](),controller[_0xce2c('0x14')]);router[_0xce2c('0x15')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller['destroy']);module[_0xce2c('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 73e26ed..43ff91b 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 _0xf9ae=['onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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\x20(min:1,\x20max:999)','exports','name','ENUM','ivr','STRING','BOOLEAN','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,*,*,*','never'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf9ae,0x19b));var _0xef9a=function(_0x5c77b1,_0x180269){_0x5c77b1=_0x5c77b1-0x0;var _0x401464=_0xf9ae[_0x5c77b1];return _0x401464;};'use strict';var Sequelize=require('sequelize');module[_0xef9a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xef9a('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xef9a('0x2')](_0xef9a('0x3')),'allowNull':![],'defaultValue':_0xef9a('0x3')},'description':{'type':Sequelize[_0xef9a('0x4')]},'active':{'type':Sequelize[_0xef9a('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xef9a('0x6')](0x4)[_0xef9a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xef9a('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xef9a('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'comment':_0xef9a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xef9a('0xf')},'dialTimezone':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':_0xef9a('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xef9a('0x2')]('always',_0xef9a('0x11'),_0xef9a('0x12')),'defaultValue':_0xef9a('0x13')},'dialAMDActive':{'type':Sequelize[_0xef9a('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xef9a('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xef9a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xef9a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xef9a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xef9a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xef9a('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xef9a('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xef9a('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xef9a('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xef9a('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xef9a('0x2')]('DESC',_0xef9a('0x1c')),'defaultValue':_0xef9a('0x1d')},'dialPrefix':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xef9a('0x1e')},'dialCutDigit':{'type':Sequelize[_0xef9a('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xf603=['always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen'];(function(_0x48881c,_0x2e5317){var _0x443406=function(_0x5ce5e8){while(--_0x5ce5e8){_0x48881c['push'](_0x48881c['shift']());}};_0x443406(++_0x2e5317);}(_0xf603,0xeb));var _0x3f60=function(_0xd303ff,_0x45dae0){_0xd303ff=_0xd303ff-0x0;var _0x52b270=_0xf603[_0xd303ff];return _0x52b270;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'name':{'type':Sequelize[_0x3f60('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3f60('0x3')](_0x3f60('0x4')),'allowNull':![],'defaultValue':_0x3f60('0x4')},'description':{'type':Sequelize[_0x3f60('0x2')]},'active':{'type':Sequelize[_0x3f60('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x3f60('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3f60('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3f60('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3f60('0x6')](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f60('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3f60('0x6')](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'defaultValue':0x3,'comment':_0x3f60('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f60('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3f60('0xe')},'dialTimezone':{'type':Sequelize[_0x3f60('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3f60('0x2')],'defaultValue':_0x3f60('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x3f60('0x10')),'defaultValue':_0x3f60('0x11')},'dialAMDActive':{'type':Sequelize[_0x3f60('0x5')],'defaultValue':0x0,'comment':_0x3f60('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x3f60('0x6')](0x9)[_0x3f60('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3f60('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x3f60('0x6')](0x9)[_0x3f60('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3f60('0x6')](0x9)[_0x3f60('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3f60('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3f60('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x3f60('0x6')](0x9)[_0x3f60('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3f60('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3f60('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3f60('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3f60('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3f60('0x6')](0x5)[_0x3f60('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3f60('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3f60('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3f60('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3f60('0x3')](_0x3f60('0x19'),_0x3f60('0x1a')),'defaultValue':_0x3f60('0x19')},'dialPrefix':{'type':Sequelize[_0x3f60('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3f60('0x1b')},'dialCutDigit':{'type':Sequelize[_0x3f60('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3f60('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3f60('0x6')](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3f60('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3f60('0x6')](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f60('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f60('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3f60('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f60('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3f60('0x6')](0x3)[_0x3f60('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3f60('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f60('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a75c7a8..3bbf6ec 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 _0x1596=['UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','ListId','field','NOW()','ContactId','toString','from','cm_contacts','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','CmHopper','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','IvrCampaigns','error','name','send','index','map','Campaign','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1596,0x16f));var _0x6159=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1596[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x6159('0x0'));var rimraf=require(_0x6159('0x1'));var zipdir=require(_0x6159('0x2'));var jsonpatch=require(_0x6159('0x3'));var rp=require('request-promise');var moment=require(_0x6159('0x4'));var BPromise=require(_0x6159('0x5'));var Mustache=require(_0x6159('0x6'));var util=require('util');var path=require(_0x6159('0x7'));var sox=require(_0x6159('0x8'));var csv=require(_0x6159('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6159('0xa'));var _=require(_0x6159('0xb'));var squel=require(_0x6159('0xc'));var crypto=require(_0x6159('0xd'));var jsforce=require(_0x6159('0xe'));var deskjs=require(_0x6159('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6159('0x10'));var Papa=require('papaparse');var Redis=require(_0x6159('0x11'));var authService=require(_0x6159('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6159('0x13'));var hardwareService=require(_0x6159('0x14'));var logger=require(_0x6159('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6159('0x16'));var licenseUtil=require(_0x6159('0x17'));var db=require(_0x6159('0x18'))['db'];function respondWithStatusCode(_0x366dda,_0x2864b5){_0x2864b5=_0x2864b5||0xcc;return function(_0x2d2f8b){if(_0x2d2f8b){return _0x366dda[_0x6159('0x19')](_0x2864b5);}return _0x366dda[_0x6159('0x1a')](_0x2864b5)[_0x6159('0x1b')]();};}function respondWithResult(_0x17cb83,_0x2e0cd9){_0x2e0cd9=_0x2e0cd9||0xc8;return function(_0x1c50e5){if(_0x1c50e5){return _0x17cb83[_0x6159('0x1a')](_0x2e0cd9)[_0x6159('0x1c')](_0x1c50e5);}};}function respondWithFilteredResult(_0x3572c0,_0xe3f67d){return function(_0x210fe8){if(_0x210fe8){var _0x35b27c=typeof _0xe3f67d['offset']==='undefined'&&typeof _0xe3f67d[_0x6159('0x1d')]===_0x6159('0x1e');var _0x143c7f=_0x210fe8['count'];var _0x368d1f=_0x35b27c?0x0:_0xe3f67d[_0x6159('0x1f')];var _0x141199=_0x35b27c?_0x210fe8[_0x6159('0x20')]:_0xe3f67d['offset']+_0xe3f67d[_0x6159('0x1d')];var _0x47deee;if(_0x141199>=_0x143c7f){_0x141199=_0x143c7f;_0x47deee=0xc8;}else{_0x47deee=0xce;}_0x3572c0[_0x6159('0x1a')](_0x47deee);return _0x3572c0[_0x6159('0x21')](_0x6159('0x22'),_0x368d1f+'-'+_0x141199+'/'+_0x143c7f)['json'](_0x210fe8);}return null;};}function patchUpdates(_0x54f210){return function(_0x2ece57){try{jsonpatch['apply'](_0x2ece57,_0x54f210,!![]);}catch(_0x31dd68){return BPromise[_0x6159('0x23')](_0x31dd68);}return _0x2ece57[_0x6159('0x24')]();};}function saveUpdates(_0x1f1ec5,_0x4a0863){return function(_0x1fe11d){if(_0x1fe11d){return _0x1fe11d[_0x6159('0x25')](_0x1f1ec5)[_0x6159('0x26')](function(_0x130d73){return _0x130d73;});}return null;};}function removeEntity(_0xba9d9,_0x29024f){return function(_0x5685a7){if(_0x5685a7){return _0x5685a7[_0x6159('0x27')]()['then'](function(){var _0x478722=_0x5685a7['get']({'plain':!![]});var _0x4bf0c1=_0x6159('0x28');return db['UserProfileResource'][_0x6159('0x27')]({'where':{'type':_0x4bf0c1,'resourceId':_0x478722['id']}})['then'](function(){return _0x5685a7;});})[_0x6159('0x26')](function(){_0xba9d9[_0x6159('0x1a')](0xcc)[_0x6159('0x1b')]();});}};}function handleEntityNotFound(_0x4059ef,_0x587247){return function(_0x524354){if(!_0x524354){_0x4059ef[_0x6159('0x19')](0x194);}return _0x524354;};}function handleError(_0x7167b4,_0x26a959){_0x26a959=_0x26a959||0x1f4;return function(_0x4fa594){logger[_0x6159('0x29')](_0x4fa594['stack']);if(_0x4fa594[_0x6159('0x2a')]){delete _0x4fa594[_0x6159('0x2a')];}_0x7167b4[_0x6159('0x1a')](_0x26a959)[_0x6159('0x2b')](_0x4fa594);};}exports[_0x6159('0x2c')]=function(_0x16545b,_0x426411){var _0x351ff2={},_0x142c8c={},_0x843b6b={'count':0x0,'rows':[]};var _0x4cd683=_[_0x6159('0x2d')](db[_0x6159('0x2e')][_0x6159('0x2f')],function(_0x17d2b0){return{'name':_0x17d2b0['fieldName'],'type':_0x17d2b0['type'][_0x6159('0x30')]};});_0x142c8c[_0x6159('0x31')]=_[_0x6159('0x2d')](_0x4cd683,_0x6159('0x2a'));_0x142c8c['query']=_[_0x6159('0x32')](_0x16545b[_0x6159('0x33')]);_0x142c8c[_0x6159('0x34')]=_[_0x6159('0x35')](_0x142c8c['model'],_0x142c8c[_0x6159('0x33')]);_0x351ff2[_0x6159('0x36')]=_[_0x6159('0x35')](_0x142c8c[_0x6159('0x31')],qs[_0x6159('0x37')](_0x16545b[_0x6159('0x33')][_0x6159('0x37')]));_0x351ff2[_0x6159('0x36')]=_0x351ff2[_0x6159('0x36')][_0x6159('0x38')]?_0x351ff2[_0x6159('0x36')]:_0x142c8c[_0x6159('0x31')];if(!_0x16545b[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x351ff2[_0x6159('0x1d')]=qs['limit'](_0x16545b[_0x6159('0x33')][_0x6159('0x1d')]);_0x351ff2[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x16545b[_0x6159('0x33')][_0x6159('0x1f')]);}_0x351ff2[_0x6159('0x3b')]=qs[_0x6159('0x3c')](_0x16545b[_0x6159('0x33')][_0x6159('0x3c')]);_0x351ff2['where']=qs[_0x6159('0x34')](_['pick'](_0x16545b['query'],_0x142c8c[_0x6159('0x34')]),_0x4cd683);if(_0x16545b['query'][_0x6159('0x3d')]){_0x351ff2[_0x6159('0x3e')]=_['merge'](_0x351ff2[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x4cd683,function(_0x5b4420){if(_0x5b4420[_0x6159('0x3f')]!==_0x6159('0x40')){var _0x9e93c4={};_0x9e93c4[_0x5b4420[_0x6159('0x2a')]]={'$like':'%'+_0x16545b['query'][_0x6159('0x3d')]+'%'};return _0x9e93c4;}})});}_0x351ff2=_[_0x6159('0x41')]({},_0x351ff2,_0x16545b[_0x6159('0x42')]);var _0x4e3e2e={'where':_0x351ff2[_0x6159('0x3e')]};return db[_0x6159('0x2e')][_0x6159('0x20')](_0x4e3e2e)[_0x6159('0x26')](function(_0x4f26d3){_0x843b6b['count']=_0x4f26d3;if(_0x16545b[_0x6159('0x33')][_0x6159('0x43')]){_0x351ff2[_0x6159('0x44')]=[{'all':!![]}];}return db[_0x6159('0x2e')][_0x6159('0x45')](_0x351ff2);})['then'](function(_0x6bfa40){_0x843b6b[_0x6159('0x46')]=_0x6bfa40;return _0x843b6b;})[_0x6159('0x26')](respondWithFilteredResult(_0x426411,_0x351ff2))[_0x6159('0x47')](handleError(_0x426411,null));};exports['show']=function(_0x453107,_0x312906){var _0x54a6f4={'raw':![],'where':{'id':_0x453107[_0x6159('0x48')]['id']}},_0x3b9f46={};_0x3b9f46[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x2e')][_0x6159('0x2f')]);_0x3b9f46[_0x6159('0x33')]=_[_0x6159('0x32')](_0x453107[_0x6159('0x33')]);_0x3b9f46[_0x6159('0x34')]=_['intersection'](_0x3b9f46['model'],_0x3b9f46[_0x6159('0x33')]);_0x54a6f4[_0x6159('0x36')]=_[_0x6159('0x35')](_0x3b9f46[_0x6159('0x31')],qs['fields'](_0x453107[_0x6159('0x33')][_0x6159('0x37')]));_0x54a6f4[_0x6159('0x36')]=_0x54a6f4[_0x6159('0x36')][_0x6159('0x38')]?_0x54a6f4[_0x6159('0x36')]:_0x3b9f46[_0x6159('0x31')];if(_0x453107[_0x6159('0x33')][_0x6159('0x43')]){_0x54a6f4[_0x6159('0x44')]=[{'all':!![]}];}_0x54a6f4=_[_0x6159('0x41')]({},_0x54a6f4,_0x453107[_0x6159('0x42')]);return db[_0x6159('0x2e')][_0x6159('0x49')](_0x54a6f4)['then'](handleEntityNotFound(_0x312906,null))[_0x6159('0x26')](respondWithResult(_0x312906,null))['catch'](handleError(_0x312906,null));};exports[_0x6159('0x4a')]=function(_0x4d581f,_0x45e002){return db['Campaign']['create'](_0x4d581f[_0x6159('0x4b')],{})['then'](function(_0x36b3b8){var _0x3ff676=_0x4d581f[_0x6159('0x4c')][_0x6159('0x4d')]({'plain':!![]});if(!_0x3ff676)throw new Error(_0x6159('0x4e'));if(_0x3ff676[_0x6159('0x4f')]===_0x6159('0x4c')){var _0x534864=_0x36b3b8[_0x6159('0x4d')]({'plain':!![]});var _0x7cacb4='IvrCampaigns';return db[_0x6159('0x50')][_0x6159('0x49')]({'where':{'name':_0x7cacb4,'userProfileId':_0x3ff676['userProfileId']},'raw':!![]})['then'](function(_0x49b85d){if(_0x49b85d&&_0x49b85d[_0x6159('0x51')]===0x0){return db[_0x6159('0x52')][_0x6159('0x4a')]({'name':_0x534864[_0x6159('0x2a')],'resourceId':_0x534864['id'],'type':_0x49b85d[_0x6159('0x2a')],'sectionId':_0x49b85d['id']},{})[_0x6159('0x26')](function(){return _0x36b3b8;});}else{return _0x36b3b8;}})['catch'](function(_0x420354){logger['error'](_0x6159('0x53'),_0x420354);throw _0x420354;});}return _0x36b3b8;})[_0x6159('0x26')](respondWithResult(_0x45e002,0xc9))[_0x6159('0x47')](handleError(_0x45e002,null));};exports[_0x6159('0x54')]=function(_0x2140a2,_0x19a73f){var _0x991e46={'where':{'id':_0x2140a2[_0x6159('0x48')]['id']}},_0x773b21={};_0x773b21[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x2e')][_0x6159('0x2f')]);_0x991e46[_0x6159('0x36')]=_[_0x6159('0x35')](_0x773b21[_0x6159('0x31')],qs[_0x6159('0x37')](_0x2140a2[_0x6159('0x33')][_0x6159('0x37')]));_0x991e46[_0x6159('0x36')]=_0x991e46[_0x6159('0x36')][_0x6159('0x38')]?_0x991e46[_0x6159('0x36')]:_0x773b21['model'];if(_0x2140a2[_0x6159('0x33')]['includeAll']){_0x991e46[_0x6159('0x44')]=[{'all':!![]}];}_0x991e46=_['merge']({},_0x991e46,_0x2140a2[_0x6159('0x42')]);return db['Campaign'][_0x6159('0x49')](_0x991e46)[_0x6159('0x26')](handleEntityNotFound(_0x19a73f,null))['then'](function(_0x5bbf0d){if(_0x5bbf0d){var _0x29659c=_0x5bbf0d[_0x6159('0x4d')]({'plain':!![]});_0x29659c=qs[_0x6159('0x55')](_0x29659c,['id',_0x6159('0x56'),_0x6159('0x57')]);_0x2140a2[_0x6159('0x4b')]=_[_0x6159('0x55')](_0x2140a2['body'],['id',_0x6159('0x56'),'updatedAt']);return db[_0x6159('0x2e')][_0x6159('0x4a')](_['merge'](_0x29659c,_0x2140a2['body']),{'include':_0x2140a2['query'][_0x6159('0x43')]?[{'all':!![]}]:undefined})[_0x6159('0x26')](function(_0x41fd1c){var _0x56f1ce=_0x2140a2[_0x6159('0x4c')]['get']({'plain':!![]});if(!_0x56f1ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56f1ce[_0x6159('0x4f')]==='user'){var _0x33d698=_0x41fd1c[_0x6159('0x4d')]({'plain':!![]});var _0x591882=_0x6159('0x28');return db[_0x6159('0x50')]['find']({'where':{'name':_0x591882,'userProfileId':_0x56f1ce[_0x6159('0x58')]},'raw':!![]})['then'](function(_0x2666d1){if(_0x2666d1&&_0x2666d1[_0x6159('0x51')]===0x0){return db[_0x6159('0x52')][_0x6159('0x4a')]({'name':_0x33d698['name'],'resourceId':_0x33d698['id'],'type':_0x2666d1['name'],'sectionId':_0x2666d1['id']},{})['then'](function(){return _0x41fd1c;});}else{return _0x41fd1c;}})[_0x6159('0x47')](function(_0x35857b){logger['error'](_0x6159('0x53'),_0x35857b);throw _0x35857b;});}return _0x41fd1c;});}})[_0x6159('0x26')](respondWithResult(_0x19a73f,0xc9))[_0x6159('0x47')](handleError(_0x19a73f,null));};exports[_0x6159('0x25')]=function(_0x459214,_0x1803c){if(_0x459214['body']['id']){delete _0x459214['body']['id'];}return db[_0x6159('0x2e')][_0x6159('0x49')]({'where':{'id':_0x459214[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x1803c,null))[_0x6159('0x26')](saveUpdates(_0x459214[_0x6159('0x4b')],null))[_0x6159('0x26')](respondWithResult(_0x1803c,null))['catch'](handleError(_0x1803c,null));};exports[_0x6159('0x27')]=function(_0x3e87ef,_0xf6e08e){return db[_0x6159('0x2e')]['find']({'where':{'id':_0x3e87ef[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xf6e08e,null))[_0x6159('0x26')](removeEntity(_0xf6e08e,null))[_0x6159('0x47')](handleError(_0xf6e08e,null));};exports[_0x6159('0x59')]=function(_0x271498,_0x199a36,_0x529fbc){var _0x5cf685={'raw':!![],'where':{}};var _0x317c21={};var _0x4ef7db={'count':0x0,'rows':[]};return db['Campaign'][_0x6159('0x5a')]({'where':{'id':_0x271498[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x199a36,null))[_0x6159('0x26')](function(_0xdbb84e){if(_0xdbb84e){_0x317c21[_0x6159('0x31')]=_[_0x6159('0x32')](db['CmHopper'][_0x6159('0x2f')]);_0x317c21[_0x6159('0x33')]=_[_0x6159('0x32')](_0x271498[_0x6159('0x33')]);_0x317c21[_0x6159('0x34')]=_['intersection'](_0x317c21['model'],_0x317c21[_0x6159('0x33')]);_0x5cf685[_0x6159('0x36')]=_['intersection'](_0x317c21[_0x6159('0x31')],qs[_0x6159('0x37')](_0x271498['query'][_0x6159('0x37')]));_0x5cf685['attributes']=_0x5cf685[_0x6159('0x36')]['length']?_0x5cf685[_0x6159('0x36')]:_0x317c21['model'];if(!_0x271498[_0x6159('0x33')][_0x6159('0x39')]('nolimit')){_0x5cf685[_0x6159('0x1d')]=qs['limit'](_0x271498[_0x6159('0x33')]['limit']);_0x5cf685[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x271498[_0x6159('0x33')][_0x6159('0x1f')]);}_0x5cf685['order']=qs['sort'](_0x271498[_0x6159('0x33')][_0x6159('0x3c')]);_0x5cf685[_0x6159('0x3e')]=qs['filters'](_[_0x6159('0x5b')](_0x271498[_0x6159('0x33')],_0x317c21[_0x6159('0x34')]));_0x5cf685['where'][_0x6159('0x5c')]=_0xdbb84e['id'];if(_0x271498['query'][_0x6159('0x3d')]){_0x5cf685['where']=_[_0x6159('0x41')](_0x5cf685[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x5cf685['attributes'],function(_0x3a8dca){var _0x34fb2f={};_0x34fb2f[_0x3a8dca]={'$like':'%'+_0x271498[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x34fb2f;})});}_0x5cf685=_[_0x6159('0x41')]({},_0x5cf685,_0x271498['options']);return db['CmHopper'][_0x6159('0x20')]({'where':_0x5cf685[_0x6159('0x3e')]})[_0x6159('0x26')](function(_0x25cbca){_0x4ef7db['count']=_0x25cbca;if(_0x271498[_0x6159('0x33')][_0x6159('0x43')]){_0x5cf685[_0x6159('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5cf685);})[_0x6159('0x26')](function(_0x59ebba){_0x4ef7db['rows']=_0x59ebba;return _0x4ef7db;});}})['then'](respondWithFilteredResult(_0x199a36,_0x5cf685))['catch'](handleError(_0x199a36,null));};exports[_0x6159('0x5d')]=function(_0x5f1653,_0x5cda27,_0x2aa0a7){var _0x3d88ce={'raw':!![],'where':{}};var _0x418337={};var _0x1ea80c={'count':0x0,'rows':[]};return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x5f1653[_0x6159('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cda27,null))['then'](function(_0x5536d5){if(_0x5536d5){_0x418337[_0x6159('0x31')]=_['keys'](db[_0x6159('0x5e')]['rawAttributes']);_0x418337[_0x6159('0x33')]=_[_0x6159('0x32')](_0x5f1653['query']);_0x418337[_0x6159('0x34')]=_['intersection'](_0x418337[_0x6159('0x31')],_0x418337[_0x6159('0x33')]);_0x3d88ce['attributes']=_[_0x6159('0x35')](_0x418337[_0x6159('0x31')],qs[_0x6159('0x37')](_0x5f1653['query']['fields']));_0x3d88ce['attributes']=_0x3d88ce[_0x6159('0x36')]['length']?_0x3d88ce['attributes']:_0x418337['model'];if(!_0x5f1653[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x3d88ce[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x5f1653['query'][_0x6159('0x1d')]);_0x3d88ce['offset']=qs[_0x6159('0x1f')](_0x5f1653[_0x6159('0x33')][_0x6159('0x1f')]);}_0x3d88ce['order']=qs[_0x6159('0x3c')](_0x5f1653[_0x6159('0x33')][_0x6159('0x3c')]);_0x3d88ce[_0x6159('0x3e')]=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0x5f1653[_0x6159('0x33')],_0x418337[_0x6159('0x34')]));_0x3d88ce[_0x6159('0x3e')][_0x6159('0x5c')]=_0x5536d5['id'];if(_0x5f1653[_0x6159('0x33')]['filter']){_0x3d88ce[_0x6159('0x3e')]=_[_0x6159('0x41')](_0x3d88ce[_0x6159('0x3e')],{'$or':_['map'](_0x3d88ce['attributes'],function(_0x21059a){var _0x415916={};_0x415916[_0x21059a]={'$like':'%'+_0x5f1653[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x415916;})});}_0x3d88ce=_[_0x6159('0x41')]({},_0x3d88ce,_0x5f1653[_0x6159('0x42')]);return db[_0x6159('0x5e')][_0x6159('0x20')]({'where':_0x3d88ce['where']})[_0x6159('0x26')](function(_0x53fd10){_0x1ea80c[_0x6159('0x20')]=_0x53fd10;if(_0x5f1653[_0x6159('0x33')][_0x6159('0x43')]){_0x3d88ce[_0x6159('0x44')]=[{'all':!![]}];}return db[_0x6159('0x5e')][_0x6159('0x45')](_0x3d88ce);})[_0x6159('0x26')](function(_0x6d39c){_0x1ea80c[_0x6159('0x46')]=_0x6d39c;return _0x1ea80c;});}})[_0x6159('0x26')](respondWithFilteredResult(_0x5cda27,_0x3d88ce))['catch'](handleError(_0x5cda27,null));};exports[_0x6159('0x5f')]=function(_0xcf35ec,_0x31e2c3,_0x4b3ac1){var _0x534df4={'raw':!![],'where':{}};var _0x23e1f3={};var _0xf1665d={'count':0x0,'rows':[]};return db['Campaign'][_0x6159('0x5a')]({'where':{'id':_0xcf35ec[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x31e2c3,null))[_0x6159('0x26')](function(_0x4ee3a3){if(_0x4ee3a3){_0x23e1f3[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x60')][_0x6159('0x2f')]);_0x23e1f3['query']=_[_0x6159('0x32')](_0xcf35ec[_0x6159('0x33')]);_0x23e1f3[_0x6159('0x34')]=_[_0x6159('0x35')](_0x23e1f3['model'],_0x23e1f3[_0x6159('0x33')]);_0x534df4['attributes']=_[_0x6159('0x35')](_0x23e1f3['model'],qs['fields'](_0xcf35ec['query'][_0x6159('0x37')]));_0x534df4['attributes']=_0x534df4[_0x6159('0x36')][_0x6159('0x38')]?_0x534df4[_0x6159('0x36')]:_0x23e1f3[_0x6159('0x31')];if(!_0xcf35ec[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x534df4[_0x6159('0x1d')]=qs['limit'](_0xcf35ec[_0x6159('0x33')][_0x6159('0x1d')]);_0x534df4[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0xcf35ec[_0x6159('0x33')][_0x6159('0x1f')]);}_0x534df4['order']=qs[_0x6159('0x3c')](_0xcf35ec[_0x6159('0x33')][_0x6159('0x3c')]);_0x534df4[_0x6159('0x3e')]=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0xcf35ec[_0x6159('0x33')],_0x23e1f3[_0x6159('0x34')]));_0x534df4[_0x6159('0x3e')]['CampaignId']=_0x4ee3a3['id'];if(_0xcf35ec[_0x6159('0x33')][_0x6159('0x3d')]){_0x534df4[_0x6159('0x3e')]=_[_0x6159('0x41')](_0x534df4[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x534df4[_0x6159('0x36')],function(_0x3f9721){var _0x368526={};_0x368526[_0x3f9721]={'$like':'%'+_0xcf35ec[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x368526;})});}_0x534df4=_[_0x6159('0x41')]({},_0x534df4,_0xcf35ec[_0x6159('0x42')]);return db[_0x6159('0x60')][_0x6159('0x20')]({'where':_0x534df4[_0x6159('0x3e')]})['then'](function(_0x5cd4e2){_0xf1665d[_0x6159('0x20')]=_0x5cd4e2;if(_0xcf35ec[_0x6159('0x33')][_0x6159('0x43')]){_0x534df4[_0x6159('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6159('0x45')](_0x534df4);})['then'](function(_0x3a0d23){_0xf1665d['rows']=_0x3a0d23;return _0xf1665d;});}})[_0x6159('0x26')](respondWithFilteredResult(_0x31e2c3,_0x534df4))[_0x6159('0x47')](handleError(_0x31e2c3,null));};exports[_0x6159('0x61')]=function(_0x3666a1,_0xced867,_0x33000a){var _0x16a2f5={'raw':!![],'where':{}};var _0x132f78={};var _0x1643ea={'count':0x0,'rows':[]};return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x3666a1[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xced867,null))['then'](function(_0x1f52ba){if(_0x1f52ba){_0x132f78[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x62')][_0x6159('0x2f')]);_0x132f78[_0x6159('0x33')]=_[_0x6159('0x32')](_0x3666a1[_0x6159('0x33')]);_0x132f78[_0x6159('0x34')]=_[_0x6159('0x35')](_0x132f78[_0x6159('0x31')],_0x132f78[_0x6159('0x33')]);_0x16a2f5[_0x6159('0x36')]=_[_0x6159('0x35')](_0x132f78[_0x6159('0x31')],qs[_0x6159('0x37')](_0x3666a1[_0x6159('0x33')]['fields']));_0x16a2f5[_0x6159('0x36')]=_0x16a2f5[_0x6159('0x36')]['length']?_0x16a2f5[_0x6159('0x36')]:_0x132f78['model'];if(!_0x3666a1[_0x6159('0x33')][_0x6159('0x39')]('nolimit')){_0x16a2f5['limit']=qs['limit'](_0x3666a1[_0x6159('0x33')]['limit']);_0x16a2f5[_0x6159('0x1f')]=qs['offset'](_0x3666a1[_0x6159('0x33')][_0x6159('0x1f')]);}_0x16a2f5[_0x6159('0x3b')]=qs['sort'](_0x3666a1[_0x6159('0x33')][_0x6159('0x3c')]);_0x16a2f5[_0x6159('0x3e')]=qs[_0x6159('0x34')](_['pick'](_0x3666a1[_0x6159('0x33')],_0x132f78[_0x6159('0x34')]));_0x16a2f5[_0x6159('0x3e')]['CampaignId']=_0x1f52ba['id'];if(_0x3666a1[_0x6159('0x33')][_0x6159('0x3d')]){_0x16a2f5[_0x6159('0x3e')]=_['merge'](_0x16a2f5[_0x6159('0x3e')],{'$or':_['map'](_0x16a2f5[_0x6159('0x36')],function(_0x52ad69){var _0x1c1a85={};_0x1c1a85[_0x52ad69]={'$like':'%'+_0x3666a1[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x1c1a85;})});}_0x16a2f5=_['merge']({},_0x16a2f5,_0x3666a1[_0x6159('0x42')]);return db['CmHopperBlack'][_0x6159('0x20')]({'where':_0x16a2f5['where']})['then'](function(_0x21781c){_0x1643ea[_0x6159('0x20')]=_0x21781c;if(_0x3666a1[_0x6159('0x33')][_0x6159('0x43')]){_0x16a2f5['include']=[{'all':!![]}];}return db[_0x6159('0x62')][_0x6159('0x45')](_0x16a2f5);})[_0x6159('0x26')](function(_0x35f224){_0x1643ea[_0x6159('0x46')]=_0x35f224;return _0x1643ea;});}})[_0x6159('0x26')](respondWithFilteredResult(_0xced867,_0x16a2f5))[_0x6159('0x47')](handleError(_0xced867,null));};exports[_0x6159('0x63')]=function(_0x3662d6,_0x2e53b9,_0x102e79){var _0x574811={};var _0x46dec7={};var _0x3acd55;var _0x4b79b2;return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x3662d6['params']['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x2e53b9,null))[_0x6159('0x26')](function(_0x11467d){if(_0x11467d){_0x3acd55=_0x11467d;_0x46dec7[_0x6159('0x31')]=_['keys'](db[_0x6159('0x64')][_0x6159('0x2f')]);_0x46dec7[_0x6159('0x33')]=_[_0x6159('0x32')](_0x3662d6[_0x6159('0x33')]);_0x46dec7[_0x6159('0x34')]=_[_0x6159('0x35')](_0x46dec7[_0x6159('0x31')],_0x46dec7[_0x6159('0x33')]);_0x574811[_0x6159('0x36')]=_[_0x6159('0x35')](_0x46dec7[_0x6159('0x31')],qs[_0x6159('0x37')](_0x3662d6['query'][_0x6159('0x37')]));_0x574811[_0x6159('0x36')]=_0x574811[_0x6159('0x36')][_0x6159('0x38')]?_0x574811[_0x6159('0x36')]:_0x46dec7[_0x6159('0x31')];_0x574811['order']=qs[_0x6159('0x3c')](_0x3662d6['query']['sort']);_0x574811['where']=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0x3662d6['query'],_0x46dec7[_0x6159('0x34')]));if(_0x3662d6['query'][_0x6159('0x3d')]){_0x574811['where']=_['merge'](_0x574811['where'],{'$or':_[_0x6159('0x2d')](_0x574811[_0x6159('0x36')],function(_0x1f4a8c){var _0x13afaa={};_0x13afaa[_0x1f4a8c]={'$like':'%'+_0x3662d6[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x13afaa;})});}_0x574811=_[_0x6159('0x41')]({},_0x574811,_0x3662d6['options']);return _0x3acd55[_0x6159('0x63')](_0x574811);}})[_0x6159('0x26')](function(_0x1404aa){if(_0x1404aa){_0x4b79b2=_0x1404aa['length'];if(!_0x3662d6['query'][_0x6159('0x39')](_0x6159('0x3a'))){_0x574811[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x3662d6['query'][_0x6159('0x1d')]);_0x574811[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x3662d6[_0x6159('0x33')]['offset']);}return _0x3acd55[_0x6159('0x63')](_0x574811);}})[_0x6159('0x26')](function(_0x199944){if(_0x199944){return _0x199944?{'count':_0x4b79b2,'rows':_0x199944}:null;}})[_0x6159('0x26')](respondWithResult(_0x2e53b9,null))[_0x6159('0x47')](handleError(_0x2e53b9,null));};exports['addLists']=function(_0x2f672d,_0x3d8038,_0x4becd2){var _0x594ce3,_0x5b71c6;var _0x260a0b=[];var _0x3b2d4d=moment()[_0x6159('0x65')](_0x6159('0x66'));return db[_0x6159('0x2e')]['find']({'where':{'id':_0x2f672d[_0x6159('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d8038,null))[_0x6159('0x26')](function(_0x172e73){if(_0x172e73){_0x5b71c6=_0x172e73;return _0x172e73[_0x6159('0x67')](_0x2f672d[_0x6159('0x4b')][_0x6159('0x68')],_[_0x6159('0x55')](_0x2f672d[_0x6159('0x4b')],[_0x6159('0x68'),'id'])||{});}return null;})[_0x6159('0x69')](function(_0x2213de){var _0x4e2b70;var _0x29c03f;_0x594ce3=_0x2213de||[];var _0x5042c9=[];if(_0x2213de){for(var _0x6b7ec4=0x0;_0x6b7ec4<_0x2213de[_0x6159('0x38')];_0x6b7ec4+=0x1){var _0x1bfe66=_0x2213de[_0x6b7ec4][_0x6159('0x4d')]({'plain':!![]});_0x5b71c6['dialCheckDuplicateType']=_0x2f672d[_0x6159('0x4b')][_0x6159('0x6a')]?_0x2f672d[_0x6159('0x4b')][_0x6159('0x6a')]:_0x5b71c6[_0x6159('0x6a')];switch(_0x5b71c6[_0x6159('0x6a')]){case'always':_0x4e2b70=squel[_0x6159('0x6b')]()[_0x6159('0x6c')](_0x6159('0x6d'))['fromQuery']([_0x6159('0x6e'),'scheduledAt','ContactId',_0x6159('0x6f'),'CampaignId',_0x6159('0x56'),'updatedAt'],squel['select']()[_0x6159('0x70')](_0x6159('0x6e'),'phone')['field'](_0x6159('0x71'),'scheduledAt')[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66['CmListId'][_0x6159('0x73')](),_0x6159('0x6f'))['field'](_0x2f672d[_0x6159('0x48')]['id']['toString'](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','updatedAt')[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')]('deletedAt\x20IS\x20NULL')[_0x6159('0x3e')]('ListId\x20=\x20?',_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6159('0x78')]()['field'](_0x6159('0x79'))[_0x6159('0x74')](_0x6159('0x7a'))['where']('CampaignId\x20=\x20?',_0x2f672d[_0x6159('0x48')]['id']['toString']()))[_0x6159('0x3e')](_0x6159('0x7b'),squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x7c'))[_0x6159('0x74')](_0x6159('0x6d'))['where']('CampaignId\x20=\x20?',_0x2f672d['params']['id'][_0x6159('0x73')]())))[_0x6159('0x73')]();break;case'onlyIfOpen':_0x4e2b70=squel[_0x6159('0x6b')]()[_0x6159('0x6c')]('cm_hopper')[_0x6159('0x7d')]([_0x6159('0x6e'),_0x6159('0x7e'),_0x6159('0x72'),'ListId',_0x6159('0x5c'),'createdAt',_0x6159('0x57')],squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x6e'),_0x6159('0x6e'))[_0x6159('0x70')]('NOW()',_0x6159('0x7e'))[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')](),_0x6159('0x6f'))['field'](_0x2f672d[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')](_0x6159('0x7f'))[_0x6159('0x3e')](_0x6159('0x80'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77'))[_0x6159('0x3e')](_0x6159('0x7b'),squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x7c'))[_0x6159('0x74')](_0x6159('0x6d'))[_0x6159('0x3e')](_0x6159('0x81'),_0x2f672d[_0x6159('0x48')]['id']['toString']())))[_0x6159('0x73')]();break;default:_0x4e2b70=squel[_0x6159('0x6b')]()['into'](_0x6159('0x6d'))['fromQuery']([_0x6159('0x6e'),_0x6159('0x7e'),_0x6159('0x72'),'ListId',_0x6159('0x5c'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x6e'),_0x6159('0x6e'))[_0x6159('0x70')]('NOW()','scheduledAt')[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66['CmListId'][_0x6159('0x73')](),'ListId')[_0x6159('0x70')](_0x2f672d[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))['field']('\x27'+_0x3b2d4d+'\x27',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')]('deletedAt\x20IS\x20NULL')[_0x6159('0x3e')](_0x6159('0x80'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x77')))['toString']();}_0x29c03f=squel[_0x6159('0x6b')]()[_0x6159('0x6c')](_0x6159('0x82'))[_0x6159('0x7d')]([_0x6159('0x83'),_0x6159('0x7e'),_0x6159('0x6e'),_0x6159('0x84'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()['field'](_0x6159('0x85'),'id')[_0x6159('0x70')]('NOW()',_0x6159('0x7e'))[_0x6159('0x70')](_0x6159('0x86'),_0x6159('0x6e'))[_0x6159('0x70')](_0x6159('0x87'),_0x6159('0x84'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','createdAt')[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','updatedAt')[_0x6159('0x74')](_0x6159('0x88'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x6159('0x3e')](_0x6159('0x89'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x8a'),_0x2f672d['params']['id'][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x8b'),_0x3b2d4d))[_0x6159('0x73')]();_0x5042c9['push'](db[_0x6159('0x8c')][_0x6159('0x33')](_0x4e2b70));_0x260a0b[_0x6159('0x8d')](db[_0x6159('0x8c')]['query'](_0x29c03f));}return BPromise[_0x6159('0x8e')](_0x5042c9);}})[_0x6159('0x26')](function(){return BPromise[_0x6159('0x8e')](_0x260a0b);})[_0x6159('0x26')](function(){return _0x594ce3;})[_0x6159('0x26')](respondWithResult(_0x3d8038,null))[_0x6159('0x47')](handleError(_0x3d8038,null));};exports[_0x6159('0x8f')]=function(_0x4f5585,_0x166cff,_0x241cc4){return db['Campaign']['find']({'where':{'id':_0x4f5585[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x166cff,null))[_0x6159('0x26')](function(_0x5237f5){if(_0x5237f5){return _0x5237f5[_0x6159('0x8f')](_0x4f5585[_0x6159('0x33')][_0x6159('0x68')]);}})[_0x6159('0x26')](function(_0x1e2c5a){if(_0x1e2c5a){return db[_0x6159('0x90')][_0x6159('0x27')]({'where':{'ListId':_0x4f5585[_0x6159('0x33')]['ids'],'CampaignId':_0x4f5585['params']['id']}})[_0x6159('0x26')](function(){return _0x1e2c5a;});}})[_0x6159('0x26')](respondWithStatusCode(_0x166cff,null))[_0x6159('0x47')](handleError(_0x166cff,null));};exports[_0x6159('0x91')]=function(_0x30f953,_0xd75647,_0x5acb0c){var _0x12d2c4={};var _0x4ed37d={};var _0x2af794;var _0x170d85;return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x30f953[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xd75647,null))[_0x6159('0x26')](function(_0x33f0e6){if(_0x33f0e6){_0x2af794=_0x33f0e6;_0x4ed37d['model']=_[_0x6159('0x32')](db['CmList'][_0x6159('0x2f')]);_0x4ed37d[_0x6159('0x33')]=_['keys'](_0x30f953['query']);_0x4ed37d[_0x6159('0x34')]=_[_0x6159('0x35')](_0x4ed37d[_0x6159('0x31')],_0x4ed37d[_0x6159('0x33')]);_0x12d2c4[_0x6159('0x36')]=_['intersection'](_0x4ed37d[_0x6159('0x31')],qs[_0x6159('0x37')](_0x30f953['query']['fields']));_0x12d2c4[_0x6159('0x36')]=_0x12d2c4[_0x6159('0x36')]['length']?_0x12d2c4[_0x6159('0x36')]:_0x4ed37d['model'];_0x12d2c4[_0x6159('0x3b')]=qs[_0x6159('0x3c')](_0x30f953['query']['sort']);_0x12d2c4[_0x6159('0x3e')]=qs['filters'](_[_0x6159('0x5b')](_0x30f953['query'],_0x4ed37d[_0x6159('0x34')]));if(_0x30f953[_0x6159('0x33')][_0x6159('0x3d')]){_0x12d2c4['where']=_[_0x6159('0x41')](_0x12d2c4['where'],{'$or':_[_0x6159('0x2d')](_0x12d2c4[_0x6159('0x36')],function(_0x5df74f){var _0x46b7ac={};_0x46b7ac[_0x5df74f]={'$like':'%'+_0x30f953[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x46b7ac;})});}_0x12d2c4=_['merge']({},_0x12d2c4,_0x30f953[_0x6159('0x42')]);return _0x2af794[_0x6159('0x91')](_0x12d2c4);}})['then'](function(_0x238110){if(_0x238110){_0x170d85=_0x238110['length'];if(!_0x30f953[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x12d2c4[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x30f953['query'][_0x6159('0x1d')]);_0x12d2c4[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x30f953['query'][_0x6159('0x1f')]);}return _0x2af794[_0x6159('0x91')](_0x12d2c4);}})[_0x6159('0x26')](function(_0x5580b0){if(_0x5580b0){return _0x5580b0?{'count':_0x170d85,'rows':_0x5580b0}:null;}})['then'](respondWithResult(_0xd75647,null))[_0x6159('0x47')](handleError(_0xd75647,null));};exports[_0x6159('0x92')]=function(_0x3e6f5e,_0x1ee452,_0x323e47){var _0x2b477c,_0x4296c8;var _0x2107fc=[];var _0x265ff4=moment()[_0x6159('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x6159('0x49')]({'where':{'id':_0x3e6f5e[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x1ee452,null))[_0x6159('0x26')](function(_0x2c0697){if(_0x2c0697){_0x4296c8=_0x2c0697;return _0x2c0697[_0x6159('0x92')](_0x3e6f5e[_0x6159('0x4b')][_0x6159('0x68')],_[_0x6159('0x55')](_0x3e6f5e['body'],[_0x6159('0x68'),'id'])||{});}return null;})[_0x6159('0x69')](function(_0x173623){var _0x18c33f;var _0x2fe1ef;_0x2b477c=_0x173623||[];var _0x5e0f04=[];if(_0x173623){for(var _0xfff1f8=0x0;_0xfff1f8<_0x173623[_0x6159('0x38')];_0xfff1f8+=0x1){var _0x57f7e1=_0x173623[_0xfff1f8]['get']({'plain':!![]});_0x18c33f=squel[_0x6159('0x6b')]()['into'](_0x6159('0x93'))[_0x6159('0x7d')](['phone',_0x6159('0x72'),_0x6159('0x6f'),_0x6159('0x5c'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()['field'](_0x6159('0x6e'),_0x6159('0x6e'))['field']('id','ContactId')['field'](_0x57f7e1['CmListId']['toString'](),_0x6159('0x6f'))[_0x6159('0x70')](_0x3e6f5e[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')](_0x6159('0x71'),'createdAt')[_0x6159('0x70')]('NOW()',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')](_0x6159('0x7f'))[_0x6159('0x3e')](_0x6159('0x80'),_0x57f7e1[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77')))[_0x6159('0x73')]();_0x5e0f04['push'](db[_0x6159('0x8c')][_0x6159('0x33')](_0x18c33f));}return BPromise[_0x6159('0x8e')](_0x5e0f04);}})[_0x6159('0x26')](function(){return _0x2b477c;})['then'](respondWithResult(_0x1ee452,null))[_0x6159('0x47')](handleError(_0x1ee452,null));};exports[_0x6159('0x94')]=function(_0x15a275,_0x4fe624,_0x104690){return db[_0x6159('0x2e')][_0x6159('0x49')]({'where':{'id':_0x15a275[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x4fe624,null))[_0x6159('0x26')](function(_0x52069a){if(_0x52069a){return _0x52069a[_0x6159('0x94')](_0x15a275[_0x6159('0x33')][_0x6159('0x68')]);}})[_0x6159('0x26')](function(_0x25f393){if(_0x25f393){return db[_0x6159('0x62')][_0x6159('0x27')]({'where':{'ListId':_0x15a275[_0x6159('0x33')][_0x6159('0x68')],'CampaignId':_0x15a275[_0x6159('0x48')]['id']}})[_0x6159('0x26')](function(){return _0x25f393;});}})[_0x6159('0x26')](respondWithStatusCode(_0x4fe624,null))[_0x6159('0x47')](handleError(_0x4fe624,null));}; \ No newline at end of file +var _0xf8ff=['cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','IvrCampaigns','error','stack','name','index','Campaign','fieldName','key','map','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','get','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','getHoppers','findOne','CmHopper','nolimit','CampaignId','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','into','NOW()','CampaignId\x20=\x20?','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf8ff,0x127));var _0xff8f=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xf8ff[_0x8c1005];return _0x175354;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff8f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff8f('0x1'));var moment=require(_0xff8f('0x2'));var BPromise=require(_0xff8f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff8f('0x4'));var sox=require('sox');var csv=require(_0xff8f('0x5'));var ejs=require(_0xff8f('0x6'));var fs=require('fs');var fs_extra=require(_0xff8f('0x7'));var _=require('lodash');var squel=require(_0xff8f('0x8'));var crypto=require(_0xff8f('0x9'));var jsforce=require(_0xff8f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xff8f('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff8f('0xb'));var authService=require(_0xff8f('0xc'));var qs=require(_0xff8f('0xd'));var as=require(_0xff8f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8f('0xf'))(_0xff8f('0x10'));var utils=require(_0xff8f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xff8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8de29e,_0x41b45f){_0x41b45f=_0x41b45f||0xcc;return function(_0x99791b){if(_0x99791b){return _0x8de29e[_0xff8f('0x13')](_0x41b45f);}return _0x8de29e[_0xff8f('0x14')](_0x41b45f)[_0xff8f('0x15')]();};}function respondWithResult(_0x5af7da,_0x27ea91){_0x27ea91=_0x27ea91||0xc8;return function(_0x2b9cd1){if(_0x2b9cd1){return _0x5af7da['status'](_0x27ea91)['json'](_0x2b9cd1);}};}function respondWithFilteredResult(_0xb45836,_0x59e2a8){return function(_0x159441){if(_0x159441){var _0x55d2d3=typeof _0x59e2a8[_0xff8f('0x16')]==='undefined'&&typeof _0x59e2a8[_0xff8f('0x17')]===_0xff8f('0x18');var _0x411cc7=_0x159441[_0xff8f('0x19')];var _0x1aa37b=_0x55d2d3?0x0:_0x59e2a8[_0xff8f('0x16')];var _0x595c44=_0x55d2d3?_0x159441['count']:_0x59e2a8[_0xff8f('0x16')]+_0x59e2a8[_0xff8f('0x17')];var _0xb8bb32;if(_0x595c44>=_0x411cc7){_0x595c44=_0x411cc7;_0xb8bb32=0xc8;}else{_0xb8bb32=0xce;}_0xb45836[_0xff8f('0x14')](_0xb8bb32);return _0xb45836[_0xff8f('0x1a')]('Content-Range',_0x1aa37b+'-'+_0x595c44+'/'+_0x411cc7)['json'](_0x159441);}return null;};}function patchUpdates(_0x3a6c4b){return function(_0x5a58ee){try{jsonpatch[_0xff8f('0x1b')](_0x5a58ee,_0x3a6c4b,!![]);}catch(_0x5ce4be){return BPromise[_0xff8f('0x1c')](_0x5ce4be);}return _0x5a58ee[_0xff8f('0x1d')]();};}function saveUpdates(_0xb0f80a,_0x44fb06){return function(_0xeaf441){if(_0xeaf441){return _0xeaf441[_0xff8f('0x1e')](_0xb0f80a)['then'](function(_0x120a59){return _0x120a59;});}return null;};}function removeEntity(_0x30810d,_0x21058c){return function(_0x20c390){if(_0x20c390){return _0x20c390[_0xff8f('0x1f')]()[_0xff8f('0x20')](function(){var _0x51c599=_0x20c390['get']({'plain':!![]});var _0x59c197=_0xff8f('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x59c197,'resourceId':_0x51c599['id']}})['then'](function(){return _0x20c390;});})['then'](function(){_0x30810d[_0xff8f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45359a,_0x5385fe){return function(_0x271252){if(!_0x271252){_0x45359a[_0xff8f('0x13')](0x194);}return _0x271252;};}function handleError(_0x3519ab,_0xb1ed64){_0xb1ed64=_0xb1ed64||0x1f4;return function(_0x4ea0f2){logger[_0xff8f('0x22')](_0x4ea0f2[_0xff8f('0x23')]);if(_0x4ea0f2[_0xff8f('0x24')]){delete _0x4ea0f2[_0xff8f('0x24')];}_0x3519ab[_0xff8f('0x14')](_0xb1ed64)['send'](_0x4ea0f2);};}exports[_0xff8f('0x25')]=function(_0x21b2ea,_0x2ee06c){var _0x186e21={},_0x575de7={},_0x269390={'count':0x0,'rows':[]};var _0x5e3e71=_['map'](db[_0xff8f('0x26')]['rawAttributes'],function(_0x2fc432){return{'name':_0x2fc432[_0xff8f('0x27')],'type':_0x2fc432['type'][_0xff8f('0x28')]};});_0x575de7['model']=_[_0xff8f('0x29')](_0x5e3e71,_0xff8f('0x24'));_0x575de7[_0xff8f('0x2a')]=_[_0xff8f('0x2b')](_0x21b2ea['query']);_0x575de7['filters']=_[_0xff8f('0x2c')](_0x575de7['model'],_0x575de7['query']);_0x186e21[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x575de7[_0xff8f('0x2e')],qs['fields'](_0x21b2ea['query'][_0xff8f('0x2f')]));_0x186e21[_0xff8f('0x2d')]=_0x186e21['attributes'][_0xff8f('0x30')]?_0x186e21[_0xff8f('0x2d')]:_0x575de7[_0xff8f('0x2e')];if(!_0x21b2ea[_0xff8f('0x2a')]['hasOwnProperty']('nolimit')){_0x186e21['limit']=qs['limit'](_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x186e21[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x16')]);}_0x186e21[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x21b2ea[_0xff8f('0x2a')]['sort']);_0x186e21[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_[_0xff8f('0x35')](_0x21b2ea[_0xff8f('0x2a')],_0x575de7[_0xff8f('0x34')]),_0x5e3e71);if(_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x186e21[_0xff8f('0x33')]=_[_0xff8f('0x37')](_0x186e21['where'],{'$or':_['map'](_0x5e3e71,function(_0x5b9f72){if(_0x5b9f72['type']!==_0xff8f('0x38')){var _0xb51e0e={};_0xb51e0e[_0x5b9f72[_0xff8f('0x24')]]={'$like':'%'+_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0xb51e0e;}})});}_0x186e21=_[_0xff8f('0x37')]({},_0x186e21,_0x21b2ea[_0xff8f('0x39')]);var _0x5c1d62={'where':_0x186e21[_0xff8f('0x33')]};return db[_0xff8f('0x26')]['count'](_0x5c1d62)['then'](function(_0x386685){_0x269390[_0xff8f('0x19')]=_0x386685;if(_0x21b2ea[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x186e21[_0xff8f('0x3b')]=[{'all':!![]}];}return db[_0xff8f('0x26')][_0xff8f('0x3c')](_0x186e21);})[_0xff8f('0x20')](function(_0x583a0f){_0x269390[_0xff8f('0x3d')]=_0x583a0f;return _0x269390;})[_0xff8f('0x20')](respondWithFilteredResult(_0x2ee06c,_0x186e21))[_0xff8f('0x3e')](handleError(_0x2ee06c,null));};exports[_0xff8f('0x3f')]=function(_0x142c78,_0x558968){var _0x1ad922={'raw':![],'where':{'id':_0x142c78[_0xff8f('0x40')]['id']}},_0x2385f4={};_0x2385f4[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db['Campaign'][_0xff8f('0x41')]);_0x2385f4['query']=_[_0xff8f('0x2b')](_0x142c78[_0xff8f('0x2a')]);_0x2385f4[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x2385f4[_0xff8f('0x2e')],_0x2385f4[_0xff8f('0x2a')]);_0x1ad922[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x2385f4[_0xff8f('0x2e')],qs['fields'](_0x142c78[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x1ad922[_0xff8f('0x2d')]=_0x1ad922[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x1ad922[_0xff8f('0x2d')]:_0x2385f4['model'];if(_0x142c78[_0xff8f('0x2a')]['includeAll']){_0x1ad922[_0xff8f('0x3b')]=[{'all':!![]}];}_0x1ad922=_[_0xff8f('0x37')]({},_0x1ad922,_0x142c78[_0xff8f('0x39')]);return db[_0xff8f('0x26')][_0xff8f('0x42')](_0x1ad922)[_0xff8f('0x20')](handleEntityNotFound(_0x558968,null))[_0xff8f('0x20')](respondWithResult(_0x558968,null))[_0xff8f('0x3e')](handleError(_0x558968,null));};exports[_0xff8f('0x43')]=function(_0x16ff6d,_0x3e43b1){return db[_0xff8f('0x26')][_0xff8f('0x43')](_0x16ff6d['body'],{})[_0xff8f('0x20')](function(_0x5bcb6b){var _0xa4ed9e=_0x16ff6d['user'][_0xff8f('0x44')]({'plain':!![]});if(!_0xa4ed9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa4ed9e[_0xff8f('0x45')]===_0xff8f('0x46')){var _0x3ea6aa=_0x5bcb6b[_0xff8f('0x44')]({'plain':!![]});var _0x1a1bdf=_0xff8f('0x21');return db[_0xff8f('0x47')][_0xff8f('0x42')]({'where':{'name':_0x1a1bdf,'userProfileId':_0xa4ed9e['userProfileId']},'raw':!![]})[_0xff8f('0x20')](function(_0x3f27cc){if(_0x3f27cc&&_0x3f27cc[_0xff8f('0x48')]===0x0){return db[_0xff8f('0x49')]['create']({'name':_0x3ea6aa[_0xff8f('0x24')],'resourceId':_0x3ea6aa['id'],'type':_0x3f27cc[_0xff8f('0x24')],'sectionId':_0x3f27cc['id']},{})[_0xff8f('0x20')](function(){return _0x5bcb6b;});}else{return _0x5bcb6b;}})[_0xff8f('0x3e')](function(_0x415e95){logger[_0xff8f('0x22')](_0xff8f('0x4a'),_0x415e95);throw _0x415e95;});}return _0x5bcb6b;})[_0xff8f('0x20')](respondWithResult(_0x3e43b1,0xc9))[_0xff8f('0x3e')](handleError(_0x3e43b1,null));};exports[_0xff8f('0x4b')]=function(_0x6e246e,_0x29c10c){var _0x1ea089={'where':{'id':_0x6e246e[_0xff8f('0x40')]['id']}},_0x5e007e={};_0x5e007e[_0xff8f('0x2e')]=_['keys'](db[_0xff8f('0x26')][_0xff8f('0x41')]);_0x1ea089[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x5e007e[_0xff8f('0x2e')],qs['fields'](_0x6e246e[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x1ea089[_0xff8f('0x2d')]=_0x1ea089['attributes']['length']?_0x1ea089[_0xff8f('0x2d')]:_0x5e007e[_0xff8f('0x2e')];if(_0x6e246e[_0xff8f('0x2a')]['includeAll']){_0x1ea089['include']=[{'all':!![]}];}_0x1ea089=_['merge']({},_0x1ea089,_0x6e246e[_0xff8f('0x39')]);return db[_0xff8f('0x26')][_0xff8f('0x42')](_0x1ea089)['then'](handleEntityNotFound(_0x29c10c,null))[_0xff8f('0x20')](function(_0x6f4d60){if(_0x6f4d60){var _0x349064=_0x6f4d60['get']({'plain':!![]});_0x349064=qs[_0xff8f('0x4c')](_0x349064,['id',_0xff8f('0x4d'),_0xff8f('0x4e')]);_0x6e246e['body']=_[_0xff8f('0x4c')](_0x6e246e[_0xff8f('0x4f')],['id',_0xff8f('0x4d'),'updatedAt']);return db[_0xff8f('0x26')][_0xff8f('0x43')](_[_0xff8f('0x37')](_0x349064,_0x6e246e[_0xff8f('0x4f')]),{'include':_0x6e246e[_0xff8f('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xff8f('0x20')](function(_0x163430){var _0x3e3d27=_0x6e246e[_0xff8f('0x46')][_0xff8f('0x44')]({'plain':!![]});if(!_0x3e3d27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e3d27[_0xff8f('0x45')]==='user'){var _0x3247ec=_0x163430[_0xff8f('0x44')]({'plain':!![]});var _0x33a525='IvrCampaigns';return db[_0xff8f('0x47')][_0xff8f('0x42')]({'where':{'name':_0x33a525,'userProfileId':_0x3e3d27[_0xff8f('0x50')]},'raw':!![]})[_0xff8f('0x20')](function(_0x16ede2){if(_0x16ede2&&_0x16ede2[_0xff8f('0x48')]===0x0){return db[_0xff8f('0x49')]['create']({'name':_0x3247ec[_0xff8f('0x24')],'resourceId':_0x3247ec['id'],'type':_0x16ede2['name'],'sectionId':_0x16ede2['id']},{})[_0xff8f('0x20')](function(){return _0x163430;});}else{return _0x163430;}})[_0xff8f('0x3e')](function(_0x13169d){logger[_0xff8f('0x22')](_0xff8f('0x4a'),_0x13169d);throw _0x13169d;});}return _0x163430;});}})['then'](respondWithResult(_0x29c10c,0xc9))[_0xff8f('0x3e')](handleError(_0x29c10c,null));};exports[_0xff8f('0x1e')]=function(_0x3bcecc,_0x390e85){if(_0x3bcecc[_0xff8f('0x4f')]['id']){delete _0x3bcecc[_0xff8f('0x4f')]['id'];}return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x3bcecc['params']['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x390e85,null))[_0xff8f('0x20')](saveUpdates(_0x3bcecc[_0xff8f('0x4f')],null))[_0xff8f('0x20')](respondWithResult(_0x390e85,null))[_0xff8f('0x3e')](handleError(_0x390e85,null));};exports[_0xff8f('0x1f')]=function(_0x2c724f,_0x22be9c){return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x2c724f[_0xff8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x22be9c,null))[_0xff8f('0x20')](removeEntity(_0x22be9c,null))[_0xff8f('0x3e')](handleError(_0x22be9c,null));};exports[_0xff8f('0x51')]=function(_0x44ac79,_0x119340,_0x2a9b9f){var _0x5e8868={'raw':!![],'where':{}};var _0x374c9f={};var _0x5d8c01={'count':0x0,'rows':[]};return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x44ac79[_0xff8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x119340,null))[_0xff8f('0x20')](function(_0xb7db16){if(_0xb7db16){_0x374c9f[_0xff8f('0x2e')]=_['keys'](db[_0xff8f('0x53')][_0xff8f('0x41')]);_0x374c9f['query']=_[_0xff8f('0x2b')](_0x44ac79[_0xff8f('0x2a')]);_0x374c9f[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x374c9f['model'],_0x374c9f[_0xff8f('0x2a')]);_0x5e8868[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x374c9f[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x5e8868['attributes']=_0x5e8868[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x5e8868[_0xff8f('0x2d')]:_0x374c9f[_0xff8f('0x2e')];if(!_0x44ac79['query']['hasOwnProperty'](_0xff8f('0x54'))){_0x5e8868['limit']=qs[_0xff8f('0x17')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x5e8868[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x44ac79['query'][_0xff8f('0x16')]);}_0x5e8868[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x32')]);_0x5e8868[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_['pick'](_0x44ac79['query'],_0x374c9f[_0xff8f('0x34')]));_0x5e8868['where'][_0xff8f('0x55')]=_0xb7db16['id'];if(_0x44ac79[_0xff8f('0x2a')]['filter']){_0x5e8868['where']=_[_0xff8f('0x37')](_0x5e8868[_0xff8f('0x33')],{'$or':_[_0xff8f('0x29')](_0x5e8868[_0xff8f('0x2d')],function(_0x5f3bfb){var _0x3b4303={};_0x3b4303[_0x5f3bfb]={'$like':'%'+_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0x3b4303;})});}_0x5e8868=_[_0xff8f('0x37')]({},_0x5e8868,_0x44ac79['options']);return db[_0xff8f('0x53')][_0xff8f('0x19')]({'where':_0x5e8868[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x3d9905){_0x5d8c01['count']=_0x3d9905;if(_0x44ac79[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x5e8868[_0xff8f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0xff8f('0x3c')](_0x5e8868);})[_0xff8f('0x20')](function(_0x4f31c4){_0x5d8c01[_0xff8f('0x3d')]=_0x4f31c4;return _0x5d8c01;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0x119340,_0x5e8868))['catch'](handleError(_0x119340,null));};exports['getHopperHistories']=function(_0x176757,_0xa15761,_0x5091a3){var _0x33f18a={'raw':!![],'where':{}};var _0xff5b43={};var _0x75f44c={'count':0x0,'rows':[]};return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x176757[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0xa15761,null))[_0xff8f('0x20')](function(_0x1bb2e4){if(_0x1bb2e4){_0xff5b43[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db[_0xff8f('0x56')][_0xff8f('0x41')]);_0xff5b43[_0xff8f('0x2a')]=_[_0xff8f('0x2b')](_0x176757[_0xff8f('0x2a')]);_0xff5b43[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0xff5b43[_0xff8f('0x2e')],_0xff5b43[_0xff8f('0x2a')]);_0x33f18a['attributes']=_[_0xff8f('0x2c')](_0xff5b43[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x176757['query']['fields']));_0x33f18a[_0xff8f('0x2d')]=_0x33f18a[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x33f18a[_0xff8f('0x2d')]:_0xff5b43['model'];if(!_0x176757['query'][_0xff8f('0x57')]('nolimit')){_0x33f18a[_0xff8f('0x17')]=qs['limit'](_0x176757[_0xff8f('0x2a')]['limit']);_0x33f18a['offset']=qs[_0xff8f('0x16')](_0x176757['query'][_0xff8f('0x16')]);}_0x33f18a['order']=qs[_0xff8f('0x32')](_0x176757['query'][_0xff8f('0x32')]);_0x33f18a[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_['pick'](_0x176757[_0xff8f('0x2a')],_0xff5b43[_0xff8f('0x34')]));_0x33f18a[_0xff8f('0x33')][_0xff8f('0x55')]=_0x1bb2e4['id'];if(_0x176757[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x33f18a[_0xff8f('0x33')]=_[_0xff8f('0x37')](_0x33f18a['where'],{'$or':_[_0xff8f('0x29')](_0x33f18a[_0xff8f('0x2d')],function(_0x508840){var _0xd48ca4={};_0xd48ca4[_0x508840]={'$like':'%'+_0x176757['query'][_0xff8f('0x36')]+'%'};return _0xd48ca4;})});}_0x33f18a=_[_0xff8f('0x37')]({},_0x33f18a,_0x176757[_0xff8f('0x39')]);return db[_0xff8f('0x56')][_0xff8f('0x19')]({'where':_0x33f18a[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x463ac0){_0x75f44c['count']=_0x463ac0;if(_0x176757[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x33f18a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xff8f('0x3c')](_0x33f18a);})[_0xff8f('0x20')](function(_0x2defc0){_0x75f44c[_0xff8f('0x3d')]=_0x2defc0;return _0x75f44c;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0xa15761,_0x33f18a))[_0xff8f('0x3e')](handleError(_0xa15761,null));};exports[_0xff8f('0x58')]=function(_0x539974,_0x269f60,_0x120f12){var _0x3a70b0={'raw':!![],'where':{}};var _0x4b7c3b={};var _0x25c1ec={'count':0x0,'rows':[]};return db[_0xff8f('0x26')]['findOne']({'where':{'id':_0x539974[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x269f60,null))[_0xff8f('0x20')](function(_0x1da75f){if(_0x1da75f){_0x4b7c3b[_0xff8f('0x2e')]=_['keys'](db[_0xff8f('0x59')][_0xff8f('0x41')]);_0x4b7c3b[_0xff8f('0x2a')]=_[_0xff8f('0x2b')](_0x539974[_0xff8f('0x2a')]);_0x4b7c3b[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x4b7c3b['model'],_0x4b7c3b[_0xff8f('0x2a')]);_0x3a70b0[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x4b7c3b[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x539974[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x3a70b0[_0xff8f('0x2d')]=_0x3a70b0[_0xff8f('0x2d')]['length']?_0x3a70b0[_0xff8f('0x2d')]:_0x4b7c3b[_0xff8f('0x2e')];if(!_0x539974[_0xff8f('0x2a')][_0xff8f('0x57')](_0xff8f('0x54'))){_0x3a70b0[_0xff8f('0x17')]=qs[_0xff8f('0x17')](_0x539974[_0xff8f('0x2a')]['limit']);_0x3a70b0[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x539974['query']['offset']);}_0x3a70b0[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x539974['query'][_0xff8f('0x32')]);_0x3a70b0['where']=qs['filters'](_[_0xff8f('0x35')](_0x539974['query'],_0x4b7c3b[_0xff8f('0x34')]));_0x3a70b0[_0xff8f('0x33')]['CampaignId']=_0x1da75f['id'];if(_0x539974[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x3a70b0[_0xff8f('0x33')]=_[_0xff8f('0x37')](_0x3a70b0[_0xff8f('0x33')],{'$or':_['map'](_0x3a70b0['attributes'],function(_0x17af22){var _0x344153={};_0x344153[_0x17af22]={'$like':'%'+_0x539974[_0xff8f('0x2a')]['filter']+'%'};return _0x344153;})});}_0x3a70b0=_[_0xff8f('0x37')]({},_0x3a70b0,_0x539974[_0xff8f('0x39')]);return db[_0xff8f('0x59')][_0xff8f('0x19')]({'where':_0x3a70b0[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x28f3f9){_0x25c1ec['count']=_0x28f3f9;if(_0x539974[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x3a70b0[_0xff8f('0x3b')]=[{'all':!![]}];}return db[_0xff8f('0x59')][_0xff8f('0x3c')](_0x3a70b0);})[_0xff8f('0x20')](function(_0xf6093f){_0x25c1ec['rows']=_0xf6093f;return _0x25c1ec;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0x269f60,_0x3a70b0))['catch'](handleError(_0x269f60,null));};exports[_0xff8f('0x5a')]=function(_0x4e97ba,_0x4ec5df,_0x1de2d8){var _0x41102f={'raw':!![],'where':{}};var _0x47f079={};var _0x5aaae6={'count':0x0,'rows':[]};return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x4e97ba['params']['id']}})['then'](handleEntityNotFound(_0x4ec5df,null))[_0xff8f('0x20')](function(_0x437826){if(_0x437826){_0x47f079[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db['CmHopperBlack'][_0xff8f('0x41')]);_0x47f079['query']=_['keys'](_0x4e97ba[_0xff8f('0x2a')]);_0x47f079[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x47f079['model'],_0x47f079[_0xff8f('0x2a')]);_0x41102f[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x47f079[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x41102f[_0xff8f('0x2d')]=_0x41102f[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x41102f['attributes']:_0x47f079['model'];if(!_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x57')](_0xff8f('0x54'))){_0x41102f[_0xff8f('0x17')]=qs[_0xff8f('0x17')](_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x41102f['offset']=qs[_0xff8f('0x16')](_0x4e97ba[_0xff8f('0x2a')]['offset']);}_0x41102f['order']=qs[_0xff8f('0x32')](_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x32')]);_0x41102f[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_[_0xff8f('0x35')](_0x4e97ba[_0xff8f('0x2a')],_0x47f079['filters']));_0x41102f[_0xff8f('0x33')]['CampaignId']=_0x437826['id'];if(_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x41102f[_0xff8f('0x33')]=_['merge'](_0x41102f['where'],{'$or':_[_0xff8f('0x29')](_0x41102f[_0xff8f('0x2d')],function(_0xc2ee13){var _0x1187cb={};_0x1187cb[_0xc2ee13]={'$like':'%'+_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0x1187cb;})});}_0x41102f=_[_0xff8f('0x37')]({},_0x41102f,_0x4e97ba['options']);return db['CmHopperBlack'][_0xff8f('0x19')]({'where':_0x41102f[_0xff8f('0x33')]})[_0xff8f('0x20')](function(_0x12064f){_0x5aaae6[_0xff8f('0x19')]=_0x12064f;if(_0x4e97ba[_0xff8f('0x2a')][_0xff8f('0x3a')]){_0x41102f[_0xff8f('0x3b')]=[{'all':!![]}];}return db[_0xff8f('0x5b')][_0xff8f('0x3c')](_0x41102f);})[_0xff8f('0x20')](function(_0x3cb736){_0x5aaae6[_0xff8f('0x3d')]=_0x3cb736;return _0x5aaae6;});}})[_0xff8f('0x20')](respondWithFilteredResult(_0x4ec5df,_0x41102f))[_0xff8f('0x3e')](handleError(_0x4ec5df,null));};exports['getLists']=function(_0x533b04,_0x2386e6,_0x174953){var _0x4bbe49={};var _0x31c443={};var _0x2e853a;var _0x2618a9;return db[_0xff8f('0x26')][_0xff8f('0x52')]({'where':{'id':_0x533b04['params']['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x2386e6,null))['then'](function(_0x70caa0){if(_0x70caa0){_0x2e853a=_0x70caa0;_0x31c443[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db[_0xff8f('0x5c')]['rawAttributes']);_0x31c443[_0xff8f('0x2a')]=_['keys'](_0x533b04[_0xff8f('0x2a')]);_0x31c443[_0xff8f('0x34')]=_[_0xff8f('0x2c')](_0x31c443[_0xff8f('0x2e')],_0x31c443[_0xff8f('0x2a')]);_0x4bbe49[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x31c443[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x533b04['query'][_0xff8f('0x2f')]));_0x4bbe49[_0xff8f('0x2d')]=_0x4bbe49[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x4bbe49['attributes']:_0x31c443[_0xff8f('0x2e')];_0x4bbe49[_0xff8f('0x31')]=qs[_0xff8f('0x32')](_0x533b04[_0xff8f('0x2a')][_0xff8f('0x32')]);_0x4bbe49['where']=qs[_0xff8f('0x34')](_[_0xff8f('0x35')](_0x533b04[_0xff8f('0x2a')],_0x31c443['filters']));if(_0x533b04[_0xff8f('0x2a')][_0xff8f('0x36')]){_0x4bbe49['where']=_[_0xff8f('0x37')](_0x4bbe49[_0xff8f('0x33')],{'$or':_[_0xff8f('0x29')](_0x4bbe49[_0xff8f('0x2d')],function(_0x4bdfaa){var _0x280604={};_0x280604[_0x4bdfaa]={'$like':'%'+_0x533b04[_0xff8f('0x2a')][_0xff8f('0x36')]+'%'};return _0x280604;})});}_0x4bbe49=_[_0xff8f('0x37')]({},_0x4bbe49,_0x533b04[_0xff8f('0x39')]);return _0x2e853a[_0xff8f('0x5d')](_0x4bbe49);}})[_0xff8f('0x20')](function(_0x209d57){if(_0x209d57){_0x2618a9=_0x209d57[_0xff8f('0x30')];if(!_0x533b04['query'][_0xff8f('0x57')](_0xff8f('0x54'))){_0x4bbe49['limit']=qs[_0xff8f('0x17')](_0x533b04[_0xff8f('0x2a')][_0xff8f('0x17')]);_0x4bbe49[_0xff8f('0x16')]=qs[_0xff8f('0x16')](_0x533b04[_0xff8f('0x2a')][_0xff8f('0x16')]);}return _0x2e853a['getLists'](_0x4bbe49);}})[_0xff8f('0x20')](function(_0x33746b){if(_0x33746b){return _0x33746b?{'count':_0x2618a9,'rows':_0x33746b}:null;}})['then'](respondWithResult(_0x2386e6,null))[_0xff8f('0x3e')](handleError(_0x2386e6,null));};exports[_0xff8f('0x5e')]=function(_0x2f5ee1,_0x1dbfd4,_0x5f5059){var _0x15c7af,_0x2fd6b4;var _0x1c4bbf=[];var _0x4a9d99=moment()[_0xff8f('0x5f')](_0xff8f('0x60'));return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x2f5ee1[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x1dbfd4,null))[_0xff8f('0x20')](function(_0x548ada){if(_0x548ada){_0x2fd6b4=_0x548ada;return _0x548ada['addLists'](_0x2f5ee1[_0xff8f('0x4f')][_0xff8f('0x61')],_[_0xff8f('0x4c')](_0x2f5ee1[_0xff8f('0x4f')],[_0xff8f('0x61'),'id'])||{});}return null;})[_0xff8f('0x62')](function(_0xd63313){var _0x9257c5;var _0x1baca1;_0x15c7af=_0xd63313||[];var _0x1e1a0a=[];if(_0xd63313){for(var _0x2ef148=0x0;_0x2ef148<_0xd63313[_0xff8f('0x30')];_0x2ef148+=0x1){var _0x45676e=_0xd63313[_0x2ef148]['get']({'plain':!![]});_0x2fd6b4['dialCheckDuplicateType']=_0x2f5ee1[_0xff8f('0x4f')][_0xff8f('0x63')]?_0x2f5ee1[_0xff8f('0x4f')][_0xff8f('0x63')]:_0x2fd6b4[_0xff8f('0x63')];switch(_0x2fd6b4[_0xff8f('0x63')]){case _0xff8f('0x64'):_0x9257c5=squel[_0xff8f('0x65')]()['into'](_0xff8f('0x66'))[_0xff8f('0x67')]([_0xff8f('0x68'),_0xff8f('0x69'),'ContactId',_0xff8f('0x6a'),_0xff8f('0x55'),_0xff8f('0x4d'),'updatedAt'],squel['select']()[_0xff8f('0x6b')](_0xff8f('0x68'),_0xff8f('0x68'))[_0xff8f('0x6b')]('NOW()',_0xff8f('0x69'))[_0xff8f('0x6b')]('id',_0xff8f('0x6c'))[_0xff8f('0x6b')](_0x45676e[_0xff8f('0x6d')][_0xff8f('0x6e')](),_0xff8f('0x6a'))[_0xff8f('0x6b')](_0x2f5ee1[_0xff8f('0x40')]['id'][_0xff8f('0x6e')](),_0xff8f('0x55'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4d'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4e'))[_0xff8f('0x6f')](_0xff8f('0x70'))[_0xff8f('0x33')](_0xff8f('0x71'))['where']('ListId\x20=\x20?',_0x45676e[_0xff8f('0x6d')][_0xff8f('0x6e')]())[_0xff8f('0x33')](_0xff8f('0x72'))[_0xff8f('0x33')](_0xff8f('0x73'),squel[_0xff8f('0x74')]()[_0xff8f('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xff8f('0x6f')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f5ee1['params']['id']['toString']()))[_0xff8f('0x33')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xff8f('0x6b')](_0xff8f('0x75'))[_0xff8f('0x6f')](_0xff8f('0x66'))[_0xff8f('0x33')]('CampaignId\x20=\x20?',_0x2f5ee1[_0xff8f('0x40')]['id'][_0xff8f('0x6e')]())))[_0xff8f('0x6e')]();break;case _0xff8f('0x76'):_0x9257c5=squel[_0xff8f('0x65')]()[_0xff8f('0x77')]('cm_hopper')['fromQuery'](['phone','scheduledAt','ContactId',_0xff8f('0x6a'),'CampaignId',_0xff8f('0x4d'),_0xff8f('0x4e')],squel['select']()['field'](_0xff8f('0x68'),_0xff8f('0x68'))['field'](_0xff8f('0x78'),_0xff8f('0x69'))[_0xff8f('0x6b')]('id',_0xff8f('0x6c'))[_0xff8f('0x6b')](_0x45676e[_0xff8f('0x6d')]['toString'](),'ListId')[_0xff8f('0x6b')](_0x2f5ee1['params']['id'][_0xff8f('0x6e')](),_0xff8f('0x55'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4d'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4e'))[_0xff8f('0x6f')](_0xff8f('0x70'))[_0xff8f('0x33')](_0xff8f('0x71'))['where']('ListId\x20=\x20?',_0x45676e[_0xff8f('0x6d')]['toString']())[_0xff8f('0x33')](_0xff8f('0x72'))[_0xff8f('0x33')](_0xff8f('0x73'),squel[_0xff8f('0x74')]()[_0xff8f('0x6b')](_0xff8f('0x75'))[_0xff8f('0x6f')](_0xff8f('0x66'))[_0xff8f('0x33')](_0xff8f('0x79'),_0x2f5ee1['params']['id'][_0xff8f('0x6e')]())))[_0xff8f('0x6e')]();break;default:_0x9257c5=squel[_0xff8f('0x65')]()[_0xff8f('0x77')]('cm_hopper')[_0xff8f('0x67')]([_0xff8f('0x68'),'scheduledAt',_0xff8f('0x6c'),_0xff8f('0x6a'),_0xff8f('0x55'),_0xff8f('0x4d'),_0xff8f('0x4e')],squel[_0xff8f('0x74')]()['field']('phone',_0xff8f('0x68'))['field'](_0xff8f('0x78'),_0xff8f('0x69'))[_0xff8f('0x6b')]('id',_0xff8f('0x6c'))['field'](_0x45676e['CmListId'][_0xff8f('0x6e')](),_0xff8f('0x6a'))['field'](_0x2f5ee1[_0xff8f('0x40')]['id']['toString'](),_0xff8f('0x55'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4d'))['field']('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4e'))['from']('cm_contacts')['where'](_0xff8f('0x71'))['where'](_0xff8f('0x7a'),_0x45676e['CmListId']['toString']())[_0xff8f('0x33')](_0xff8f('0x72')))[_0xff8f('0x6e')]();}_0x1baca1=squel[_0xff8f('0x65')]()['into'](_0xff8f('0x7b'))['fromQuery']([_0xff8f('0x7c'),_0xff8f('0x69'),_0xff8f('0x68'),_0xff8f('0x7d'),_0xff8f('0x4d'),_0xff8f('0x4e')],squel[_0xff8f('0x74')]()['field']('h.id','id')[_0xff8f('0x6b')](_0xff8f('0x78'),_0xff8f('0x69'))['field'](_0xff8f('0x7e'),_0xff8f('0x68'))[_0xff8f('0x6b')](_0xff8f('0x7f'),_0xff8f('0x7d'))['field']('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4d'))[_0xff8f('0x6b')]('\x27'+_0x4a9d99+'\x27',_0xff8f('0x4e'))['from'](_0xff8f('0x80'),'ci')[_0xff8f('0x81')](_0xff8f('0x66'),'h',_0xff8f('0x82'))[_0xff8f('0x33')](_0xff8f('0x83'),_0x45676e[_0xff8f('0x6d')]['toString']())['where'](_0xff8f('0x84'),_0x2f5ee1[_0xff8f('0x40')]['id'][_0xff8f('0x6e')]())[_0xff8f('0x33')]('h.createdAt\x20=\x20?',_0x4a9d99))[_0xff8f('0x6e')]();_0x1e1a0a['push'](db[_0xff8f('0x85')][_0xff8f('0x2a')](_0x9257c5));_0x1c4bbf[_0xff8f('0x86')](db['sequelize'][_0xff8f('0x2a')](_0x1baca1));}return BPromise[_0xff8f('0x87')](_0x1e1a0a);}})[_0xff8f('0x20')](function(){return BPromise[_0xff8f('0x87')](_0x1c4bbf);})[_0xff8f('0x20')](function(){return _0x15c7af;})[_0xff8f('0x20')](respondWithResult(_0x1dbfd4,null))[_0xff8f('0x3e')](handleError(_0x1dbfd4,null));};exports['removeLists']=function(_0x526824,_0x1037da,_0x1eff31){return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x526824[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x1037da,null))[_0xff8f('0x20')](function(_0x24d720){if(_0x24d720){return _0x24d720[_0xff8f('0x88')](_0x526824['query'][_0xff8f('0x61')]);}})['then'](function(_0x4b45b8){if(_0x4b45b8){return db[_0xff8f('0x53')][_0xff8f('0x1f')]({'where':{'ListId':_0x526824[_0xff8f('0x2a')][_0xff8f('0x61')],'CampaignId':_0x526824['params']['id']}})[_0xff8f('0x20')](function(){return _0x4b45b8;});}})[_0xff8f('0x20')](respondWithStatusCode(_0x1037da,null))[_0xff8f('0x3e')](handleError(_0x1037da,null));};exports['getBlackLists']=function(_0x30783c,_0x59c445,_0xb19f99){var _0x3b65da={};var _0x4aaeb2={};var _0x52348a;var _0x117f44;return db['Campaign'][_0xff8f('0x52')]({'where':{'id':_0x30783c[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x59c445,null))[_0xff8f('0x20')](function(_0x3128f5){if(_0x3128f5){_0x52348a=_0x3128f5;_0x4aaeb2[_0xff8f('0x2e')]=_[_0xff8f('0x2b')](db[_0xff8f('0x5c')][_0xff8f('0x41')]);_0x4aaeb2['query']=_[_0xff8f('0x2b')](_0x30783c[_0xff8f('0x2a')]);_0x4aaeb2['filters']=_[_0xff8f('0x2c')](_0x4aaeb2[_0xff8f('0x2e')],_0x4aaeb2[_0xff8f('0x2a')]);_0x3b65da[_0xff8f('0x2d')]=_[_0xff8f('0x2c')](_0x4aaeb2[_0xff8f('0x2e')],qs[_0xff8f('0x2f')](_0x30783c[_0xff8f('0x2a')][_0xff8f('0x2f')]));_0x3b65da[_0xff8f('0x2d')]=_0x3b65da[_0xff8f('0x2d')][_0xff8f('0x30')]?_0x3b65da[_0xff8f('0x2d')]:_0x4aaeb2[_0xff8f('0x2e')];_0x3b65da['order']=qs[_0xff8f('0x32')](_0x30783c['query']['sort']);_0x3b65da[_0xff8f('0x33')]=qs[_0xff8f('0x34')](_[_0xff8f('0x35')](_0x30783c[_0xff8f('0x2a')],_0x4aaeb2['filters']));if(_0x30783c[_0xff8f('0x2a')]['filter']){_0x3b65da['where']=_['merge'](_0x3b65da[_0xff8f('0x33')],{'$or':_[_0xff8f('0x29')](_0x3b65da[_0xff8f('0x2d')],function(_0x226f03){var _0x1a031e={};_0x1a031e[_0x226f03]={'$like':'%'+_0x30783c['query'][_0xff8f('0x36')]+'%'};return _0x1a031e;})});}_0x3b65da=_['merge']({},_0x3b65da,_0x30783c[_0xff8f('0x39')]);return _0x52348a[_0xff8f('0x89')](_0x3b65da);}})[_0xff8f('0x20')](function(_0x38d220){if(_0x38d220){_0x117f44=_0x38d220['length'];if(!_0x30783c['query'][_0xff8f('0x57')](_0xff8f('0x54'))){_0x3b65da[_0xff8f('0x17')]=qs['limit'](_0x30783c[_0xff8f('0x2a')]['limit']);_0x3b65da[_0xff8f('0x16')]=qs['offset'](_0x30783c[_0xff8f('0x2a')][_0xff8f('0x16')]);}return _0x52348a[_0xff8f('0x89')](_0x3b65da);}})['then'](function(_0x5e81c0){if(_0x5e81c0){return _0x5e81c0?{'count':_0x117f44,'rows':_0x5e81c0}:null;}})[_0xff8f('0x20')](respondWithResult(_0x59c445,null))[_0xff8f('0x3e')](handleError(_0x59c445,null));};exports['addBlackLists']=function(_0x45a312,_0x56ec66,_0x496e37){var _0x328ed2,_0x392a1e;var _0x1b9cfd=[];var _0x99a1b2=moment()[_0xff8f('0x5f')](_0xff8f('0x60'));return db[_0xff8f('0x26')][_0xff8f('0x42')]({'where':{'id':_0x45a312[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x56ec66,null))[_0xff8f('0x20')](function(_0x1162d1){if(_0x1162d1){_0x392a1e=_0x1162d1;return _0x1162d1[_0xff8f('0x8a')](_0x45a312[_0xff8f('0x4f')][_0xff8f('0x61')],_[_0xff8f('0x4c')](_0x45a312[_0xff8f('0x4f')],[_0xff8f('0x61'),'id'])||{});}return null;})['spread'](function(_0x286c33){var _0x4c3e07;var _0x20f0cd;_0x328ed2=_0x286c33||[];var _0x51f1be=[];if(_0x286c33){for(var _0x345ec8=0x0;_0x345ec8<_0x286c33[_0xff8f('0x30')];_0x345ec8+=0x1){var _0x31cc59=_0x286c33[_0x345ec8][_0xff8f('0x44')]({'plain':!![]});_0x4c3e07=squel[_0xff8f('0x65')]()[_0xff8f('0x77')](_0xff8f('0x8b'))[_0xff8f('0x67')]([_0xff8f('0x68'),_0xff8f('0x6c'),_0xff8f('0x6a'),_0xff8f('0x55'),'createdAt','updatedAt'],squel[_0xff8f('0x74')]()[_0xff8f('0x6b')]('phone',_0xff8f('0x68'))[_0xff8f('0x6b')]('id',_0xff8f('0x6c'))[_0xff8f('0x6b')](_0x31cc59['CmListId']['toString'](),'ListId')[_0xff8f('0x6b')](_0x45a312[_0xff8f('0x40')]['id'][_0xff8f('0x6e')](),_0xff8f('0x55'))[_0xff8f('0x6b')](_0xff8f('0x78'),'createdAt')[_0xff8f('0x6b')](_0xff8f('0x78'),'updatedAt')['from'](_0xff8f('0x70'))[_0xff8f('0x33')](_0xff8f('0x71'))[_0xff8f('0x33')](_0xff8f('0x7a'),_0x31cc59[_0xff8f('0x6d')]['toString']())[_0xff8f('0x33')]('phone\x20IS\x20NOT\x20NULL'))[_0xff8f('0x6e')]();_0x51f1be[_0xff8f('0x86')](db[_0xff8f('0x85')]['query'](_0x4c3e07));}return BPromise[_0xff8f('0x87')](_0x51f1be);}})[_0xff8f('0x20')](function(){return _0x328ed2;})['then'](respondWithResult(_0x56ec66,null))[_0xff8f('0x3e')](handleError(_0x56ec66,null));};exports[_0xff8f('0x8c')]=function(_0x416d18,_0x38b920,_0x45dde2){return db['Campaign'][_0xff8f('0x42')]({'where':{'id':_0x416d18[_0xff8f('0x40')]['id']}})[_0xff8f('0x20')](handleEntityNotFound(_0x38b920,null))[_0xff8f('0x20')](function(_0x1fd20d){if(_0x1fd20d){return _0x1fd20d[_0xff8f('0x8c')](_0x416d18[_0xff8f('0x2a')][_0xff8f('0x61')]);}})[_0xff8f('0x20')](function(_0xfe8723){if(_0xfe8723){return db[_0xff8f('0x5b')][_0xff8f('0x1f')]({'where':{'ListId':_0x416d18[_0xff8f('0x2a')]['ids'],'CampaignId':_0x416d18['params']['id']}})[_0xff8f('0x20')](function(){return _0xfe8723;});}})['then'](respondWithStatusCode(_0x38b920,null))[_0xff8f('0x3e')](handleError(_0x38b920,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6b6bebb..d7761bb 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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b6567c0..af58efe 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 _0x4584=['info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x57a699,_0x29e647){var _0x88b917=function(_0x498acc){while(--_0x498acc){_0x57a699['push'](_0x57a699['shift']());}};_0x88b917(++_0x29e647);}(_0x4584,0x1cf));var _0x4458=function(_0x58712a,_0x1d88a9){_0x58712a=_0x58712a-0x0;var _0x342032=_0x4584[_0x58712a];return _0x342032;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var moment=require(_0x4458('0x1'));var BPromise=require(_0x4458('0x2'));var rs=require(_0x4458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4458('0x4'));var logger=require(_0x4458('0x5'))(_0x4458('0x6'));var config=require(_0x4458('0x7'));var jayson=require(_0x4458('0x8'));var client=jayson[_0x4458('0x9')][_0x4458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215b2d,_0x102b5f,_0x51da14){return new BPromise(function(_0x14bb0f,_0x83fb96){return client[_0x4458('0xb')](_0x215b2d,_0x51da14)[_0x4458('0xc')](function(_0x1ab8c3){logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));logger[_0x4458('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x102b5f,_0x4458('0xf'),JSON[_0x4458('0x11')](_0x1ab8c3));if(_0x1ab8c3[_0x4458('0x12')]){if(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x13')]===0x1f4){logger['error'](_0x4458('0xe'),_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x83fb96(_0x1ab8c3['error'][_0x4458('0x14')]);}logger[_0x4458('0x12')]('Campaign,\x20%s,\x20%s',_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x14bb0f(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x14')]);}else{logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));_0x14bb0f(_0x1ab8c3[_0x4458('0x15')][_0x4458('0x14')]);}})['catch'](function(_0x31e500){logger['error'](_0x4458('0xe'),_0x102b5f,_0x31e500);_0x83fb96(_0x31e500);});});}exports[_0x4458('0x16')]=function(_0x130d39){var _0x587cbb=this;return new Promise(function(_0x319247,_0x422e35){return db[_0x4458('0x17')][_0x4458('0x18')]({'raw':_0x130d39[_0x4458('0x19')]?_0x130d39[_0x4458('0x19')][_0x4458('0x1a')]===undefined?!![]:![]:!![],'where':_0x130d39[_0x4458('0x19')]?_0x130d39[_0x4458('0x19')][_0x4458('0x1b')]||null:null,'attributes':_0x130d39['options']?_0x130d39[_0x4458('0x19')][_0x4458('0x1c')]||null:null,'limit':_0x130d39[_0x4458('0x19')]?_0x130d39['options'][_0x4458('0x1d')]||null:null,'include':_0x130d39[_0x4458('0x19')]?_0x130d39['options'][_0x4458('0x1e')]?_[_0x4458('0x1f')](_0x130d39['options'][_0x4458('0x1e')],function(_0x17e482){return{'model':db[_0x17e482[_0x4458('0x20')]],'as':_0x17e482['as'],'attributes':_0x17e482['attributes'],'include':_0x17e482[_0x4458('0x1e')]?_['map'](_0x17e482[_0x4458('0x1e')],function(_0x504a86){return{'model':db[_0x504a86['model']],'as':_0x504a86['as'],'attributes':_0x504a86[_0x4458('0x1c')],'include':_0x504a86[_0x4458('0x1e')]?_[_0x4458('0x1f')](_0x504a86[_0x4458('0x1e')],function(_0x153a98){return{'model':db[_0x153a98[_0x4458('0x20')]],'as':_0x153a98['as'],'attributes':_0x153a98[_0x4458('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4458('0xc')](function(_0x452ec4){logger[_0x4458('0xd')](_0x4458('0x16'),_0x130d39);logger['debug'](_0x4458('0x16'),_0x130d39,JSON['stringify'](_0x452ec4));_0x319247(_0x452ec4);})[_0x4458('0x21')](function(_0x5f22be){logger[_0x4458('0x12')](_0x4458('0x16'),_0x5f22be[_0x4458('0x14')],_0x130d39);_0x422e35(_0x587cbb[_0x4458('0x12')](0x1f4,_0x5f22be[_0x4458('0x14')]));});});}; \ No newline at end of file +var _0x17ba=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Campaign','findAll','options','raw','where','limit','include','model','map','attributes','GetCampaign','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x17ba,0xab));var _0xa17b=function(_0x390c49,_0x39ca85){_0x390c49=_0x390c49-0x0;var _0x4dfc51=_0x17ba[_0x390c49];return _0x4dfc51;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('Campaign,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('Campaign,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});}exports['GetCampaign']=function(_0x36f985){var _0x197237=this;return new Promise(function(_0x53a0f7,_0x2ceafa){return db[_0xa17b('0x18')][_0xa17b('0x19')]({'raw':_0x36f985[_0xa17b('0x1a')]?_0x36f985[_0xa17b('0x1a')][_0xa17b('0x1b')]===undefined?!![]:![]:!![],'where':_0x36f985[_0xa17b('0x1a')]?_0x36f985['options'][_0xa17b('0x1c')]||null:null,'attributes':_0x36f985[_0xa17b('0x1a')]?_0x36f985[_0xa17b('0x1a')]['attributes']||null:null,'limit':_0x36f985[_0xa17b('0x1a')]?_0x36f985[_0xa17b('0x1a')][_0xa17b('0x1d')]||null:null,'include':_0x36f985[_0xa17b('0x1a')]?_0x36f985[_0xa17b('0x1a')][_0xa17b('0x1e')]?_['map'](_0x36f985[_0xa17b('0x1a')]['include'],function(_0xa34739){return{'model':db[_0xa34739[_0xa17b('0x1f')]],'as':_0xa34739['as'],'attributes':_0xa34739['attributes'],'include':_0xa34739['include']?_[_0xa17b('0x20')](_0xa34739[_0xa17b('0x1e')],function(_0x4216ca){return{'model':db[_0x4216ca[_0xa17b('0x1f')]],'as':_0x4216ca['as'],'attributes':_0x4216ca[_0xa17b('0x21')],'include':_0x4216ca[_0xa17b('0x1e')]?_['map'](_0x4216ca['include'],function(_0x5c98fe){return{'model':db[_0x5c98fe['model']],'as':_0x5c98fe['as'],'attributes':_0x5c98fe[_0xa17b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x295e67){logger['info'](_0xa17b('0x22'),_0x36f985);logger[_0xa17b('0x11')](_0xa17b('0x22'),_0x36f985,JSON[_0xa17b('0x13')](_0x295e67));_0x53a0f7(_0x295e67);})[_0xa17b('0x23')](function(_0x3ccdb8){logger[_0xa17b('0x14')](_0xa17b('0x22'),_0x3ccdb8[_0xa17b('0x16')],_0x36f985);_0x2ceafa(_0x197237[_0xa17b('0x14')](0x1f4,_0x3ccdb8[_0xa17b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a383605..f8e7a97 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 _0x7cb9=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0x7cb9,0x160));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x97cb('0x0'));var util=require(_0x97cb('0x1'));var path=require(_0x97cb('0x2'));var timeout=require(_0x97cb('0x3'));var express=require(_0x97cb('0x4'));var router=express[_0x97cb('0x5')]();var fs_extra=require(_0x97cb('0x6'));var auth=require(_0x97cb('0x7'));var interaction=require(_0x97cb('0x8'));var config=require(_0x97cb('0x9'));var controller=require(_0x97cb('0xa'));router[_0x97cb('0xb')]('/',auth[_0x97cb('0xc')](),controller[_0x97cb('0xd')]);router[_0x97cb('0xb')](_0x97cb('0xe'),auth['isAuthenticated'](),controller[_0x97cb('0xf')]);router[_0x97cb('0xb')]('/:id/hoppers',auth[_0x97cb('0xc')](),controller[_0x97cb('0x10')]);router[_0x97cb('0xb')](_0x97cb('0x11'),auth[_0x97cb('0xc')](),controller['getHopperHistories']);router[_0x97cb('0xb')](_0x97cb('0x12'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x13')]);router['get'](_0x97cb('0x14'),auth['isAuthenticated'](),controller[_0x97cb('0x15')]);router[_0x97cb('0xb')](_0x97cb('0x16'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x17')]);router[_0x97cb('0xb')](_0x97cb('0x18'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x19')]);router[_0x97cb('0x1a')]('/',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1b')]);router[_0x97cb('0x1a')]('/:id/clone',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1c')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x97cb('0x1d')]);router[_0x97cb('0x1a')]('/:id/blacklists',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1e')]);router[_0x97cb('0x1f')](_0x97cb('0xe'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x20')]);router[_0x97cb('0x21')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x97cb('0x21')](_0x97cb('0x16'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x22')]);router[_0x97cb('0x21')](_0x97cb('0x18'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x23')]);module[_0x97cb('0x24')]=router; \ No newline at end of file +var _0x79d6=['../../components/auth/service','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','update','destroy','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router'];(function(_0x17615e,_0x483a49){var _0xa4c97e=function(_0x24ecf7){while(--_0x24ecf7){_0x17615e['push'](_0x17615e['shift']());}};_0xa4c97e(++_0x483a49);}(_0x79d6,0x166));var _0x679d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79d6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x679d('0x0'));var path=require(_0x679d('0x1'));var timeout=require(_0x679d('0x2'));var express=require(_0x679d('0x3'));var router=express[_0x679d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x679d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x679d('0x6')]('/',auth[_0x679d('0x7')](),controller[_0x679d('0x8')]);router[_0x679d('0x6')](_0x679d('0x9'),auth[_0x679d('0x7')](),controller[_0x679d('0xa')]);router[_0x679d('0x6')]('/:id/hoppers',auth[_0x679d('0x7')](),controller[_0x679d('0xb')]);router[_0x679d('0x6')](_0x679d('0xc'),auth[_0x679d('0x7')](),controller[_0x679d('0xd')]);router[_0x679d('0x6')](_0x679d('0xe'),auth[_0x679d('0x7')](),controller[_0x679d('0xf')]);router[_0x679d('0x6')](_0x679d('0x10'),auth[_0x679d('0x7')](),controller['getHopperBlacks']);router[_0x679d('0x6')](_0x679d('0x11'),auth[_0x679d('0x7')](),controller[_0x679d('0x12')]);router[_0x679d('0x6')](_0x679d('0x13'),auth[_0x679d('0x7')](),controller[_0x679d('0x14')]);router[_0x679d('0x15')]('/',auth[_0x679d('0x7')](),controller[_0x679d('0x16')]);router['post'](_0x679d('0x17'),auth[_0x679d('0x7')](),controller[_0x679d('0x18')]);router['post']('/:id/lists',auth[_0x679d('0x7')](),controller[_0x679d('0x19')]);router[_0x679d('0x15')](_0x679d('0x13'),auth[_0x679d('0x7')](),controller[_0x679d('0x1a')]);router['put'](_0x679d('0x9'),auth[_0x679d('0x7')](),controller[_0x679d('0x1b')]);router['delete'](_0x679d('0x9'),auth[_0x679d('0x7')](),controller[_0x679d('0x1c')]);router[_0x679d('0x1d')]('/:id/lists',auth[_0x679d('0x7')](),controller[_0x679d('0x1e')]);router[_0x679d('0x1d')](_0x679d('0x13'),auth[_0x679d('0x7')](),controller[_0x679d('0x1f')]);module[_0x679d('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a3dd274..034178b 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 _0xeab6=['key','sequelize','TEXT','medium','STRING','VIRTUAL','getDataValue'];(function(_0x575f22,_0x4413e3){var _0xaf149a=function(_0x493d89){while(--_0x493d89){_0x575f22['push'](_0x575f22['shift']());}};_0xaf149a(++_0x4413e3);}(_0xeab6,0x19e));var _0x6eab=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xeab6[_0xc6b104];return _0x1c6fce;};'use strict';var Sequelize=require(_0x6eab('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6eab('0x1')],'length':_0x6eab('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6eab('0x3')]},'name':{'type':Sequelize[_0x6eab('0x4')],'get':function(){return this[_0x6eab('0x5')](_0x6eab('0x6'));}}}; \ No newline at end of file +var _0x06c6=['VIRTUAL','getDataValue','STRING'];(function(_0x3bf181,_0x217849){var _0x41eb54=function(_0x18fb4e){while(--_0x18fb4e){_0x3bf181['push'](_0x3bf181['shift']());}};_0x41eb54(++_0x217849);}(_0x06c6,0xc5));var _0x606c=function(_0x373a0e,_0x4e6519){_0x373a0e=_0x373a0e-0x0;var _0x219314=_0x06c6[_0x373a0e];return _0x219314;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x606c('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x606c('0x0')]},'name':{'type':Sequelize[_0x606c('0x1')],'get':function(){return this[_0x606c('0x2')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6400540..ba45b22 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 _0xbac9=['set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','include','show','params','keys','CannedAnswer','intersection','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x264530,_0xbfb41){var _0xe1e19e=function(_0x2a501a){while(--_0x2a501a){_0x264530['push'](_0x264530['shift']());}};_0xe1e19e(++_0xbfb41);}(_0xbac9,0x86));var _0x9bac=function(_0x212721,_0x1c0edc){_0x212721=_0x212721-0x0;var _0x369f08=_0xbac9[_0x212721];return _0x369f08;};'use strict';var emlformat=require(_0x9bac('0x0'));var rimraf=require(_0x9bac('0x1'));var zipdir=require(_0x9bac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bac('0x3'));var moment=require(_0x9bac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bac('0x5'));var util=require(_0x9bac('0x6'));var path=require(_0x9bac('0x7'));var sox=require(_0x9bac('0x8'));var csv=require(_0x9bac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bac('0xa'));var squel=require(_0x9bac('0xb'));var crypto=require(_0x9bac('0xc'));var jsforce=require(_0x9bac('0xd'));var deskjs=require(_0x9bac('0xe'));var toCsv=require(_0x9bac('0x9'));var querystring=require(_0x9bac('0xf'));var Papa=require(_0x9bac('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9bac('0x11'));var as=require(_0x9bac('0x12'));var hardwareService=require(_0x9bac('0x13'));var logger=require('../../config/logger')(_0x9bac('0x14'));var utils=require(_0x9bac('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9bac('0x16'))['db'];function respondWithStatusCode(_0x5da6a8,_0xe7561b){_0xe7561b=_0xe7561b||0xcc;return function(_0x372323){if(_0x372323){return _0x5da6a8['sendStatus'](_0xe7561b);}return _0x5da6a8[_0x9bac('0x17')](_0xe7561b)[_0x9bac('0x18')]();};}function respondWithResult(_0x4fb951,_0x245ba9){_0x245ba9=_0x245ba9||0xc8;return function(_0x31ce63){if(_0x31ce63){return _0x4fb951[_0x9bac('0x17')](_0x245ba9)[_0x9bac('0x19')](_0x31ce63);}};}function respondWithFilteredResult(_0x74419f,_0x12f225){return function(_0x19d265){if(_0x19d265){var _0x264270=typeof _0x12f225[_0x9bac('0x1a')]===_0x9bac('0x1b')&&typeof _0x12f225[_0x9bac('0x1c')]===_0x9bac('0x1b');var _0x22930a=_0x19d265['count'];var _0xb808b2=_0x264270?0x0:_0x12f225[_0x9bac('0x1a')];var _0x26fcba=_0x264270?_0x19d265[_0x9bac('0x1d')]:_0x12f225['offset']+_0x12f225[_0x9bac('0x1c')];var _0x3a9d7c;if(_0x26fcba>=_0x22930a){_0x26fcba=_0x22930a;_0x3a9d7c=0xc8;}else{_0x3a9d7c=0xce;}_0x74419f[_0x9bac('0x17')](_0x3a9d7c);return _0x74419f[_0x9bac('0x1e')](_0x9bac('0x1f'),_0xb808b2+'-'+_0x26fcba+'/'+_0x22930a)[_0x9bac('0x19')](_0x19d265);}return null;};}function patchUpdates(_0x242400){return function(_0x530604){try{jsonpatch[_0x9bac('0x20')](_0x530604,_0x242400,!![]);}catch(_0x24e1be){return BPromise[_0x9bac('0x21')](_0x24e1be);}return _0x530604[_0x9bac('0x22')]();};}function saveUpdates(_0x5373cf,_0xc6155b){return function(_0x5a3246){if(_0x5a3246){return _0x5a3246[_0x9bac('0x23')](_0x5373cf)[_0x9bac('0x24')](function(_0x1314c9){return _0x1314c9;});}return null;};}function removeEntity(_0xbb1800,_0x15762a){return function(_0x5ba4df){if(_0x5ba4df){return _0x5ba4df['destroy']()[_0x9bac('0x24')](function(){var _0x23dc19=_0x5ba4df[_0x9bac('0x25')]({'plain':!![]});var _0x47d0b2=_0x9bac('0x26');return db[_0x9bac('0x27')]['destroy']({'where':{'type':_0x47d0b2,'resourceId':_0x23dc19['id']}})[_0x9bac('0x24')](function(){return _0x5ba4df;});})[_0x9bac('0x24')](function(){_0xbb1800[_0x9bac('0x17')](0xcc)[_0x9bac('0x18')]();});}};}function handleEntityNotFound(_0x45525b,_0x3af06e){return function(_0x28f695){if(!_0x28f695){_0x45525b[_0x9bac('0x28')](0x194);}return _0x28f695;};}function handleError(_0x5902cf,_0x346237){_0x346237=_0x346237||0x1f4;return function(_0x26434d){logger['error'](_0x26434d[_0x9bac('0x29')]);if(_0x26434d[_0x9bac('0x2a')]){delete _0x26434d[_0x9bac('0x2a')];}_0x5902cf['status'](_0x346237)[_0x9bac('0x2b')](_0x26434d);};}exports[_0x9bac('0x2c')]=function(_0x429808,_0x3a94ad){var _0x368657={},_0x191ff6={},_0x289077={'count':0x0,'rows':[]};var _0x4aa371=_[_0x9bac('0x2d')](db['CannedAnswer'][_0x9bac('0x2e')],function(_0x462533){return{'name':_0x462533[_0x9bac('0x2f')],'type':_0x462533[_0x9bac('0x30')][_0x9bac('0x31')]};});_0x191ff6[_0x9bac('0x32')]=_[_0x9bac('0x2d')](_0x4aa371,'name');_0x191ff6[_0x9bac('0x33')]=_['keys'](_0x429808['query']);_0x191ff6['filters']=_['intersection'](_0x191ff6[_0x9bac('0x32')],_0x191ff6[_0x9bac('0x33')]);_0x368657[_0x9bac('0x34')]=_['intersection'](_0x191ff6[_0x9bac('0x32')],qs[_0x9bac('0x35')](_0x429808['query'][_0x9bac('0x35')]));_0x368657[_0x9bac('0x34')]=_0x368657['attributes'][_0x9bac('0x36')]?_0x368657[_0x9bac('0x34')]:_0x191ff6[_0x9bac('0x32')];if(!_0x429808[_0x9bac('0x33')][_0x9bac('0x37')](_0x9bac('0x38'))){_0x368657[_0x9bac('0x1c')]=qs['limit'](_0x429808[_0x9bac('0x33')][_0x9bac('0x1c')]);_0x368657[_0x9bac('0x1a')]=qs[_0x9bac('0x1a')](_0x429808['query'][_0x9bac('0x1a')]);}_0x368657['order']=qs['sort'](_0x429808[_0x9bac('0x33')][_0x9bac('0x39')]);_0x368657['where']=qs[_0x9bac('0x3a')](_['pick'](_0x429808[_0x9bac('0x33')],_0x191ff6[_0x9bac('0x3a')]),_0x4aa371);if(_0x429808[_0x9bac('0x33')][_0x9bac('0x3b')]){_0x368657[_0x9bac('0x3c')]=_[_0x9bac('0x3d')](_0x368657[_0x9bac('0x3c')],{'$or':[{'key':{'$like':'%'+_0x429808[_0x9bac('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x429808[_0x9bac('0x33')][_0x9bac('0x3b')]+'%'}}]});}_0x368657=_[_0x9bac('0x3d')]({},_0x368657,_0x429808[_0x9bac('0x3e')]);var _0x1acfe4={'where':_0x368657['where']};return db['CannedAnswer'][_0x9bac('0x1d')](_0x1acfe4)[_0x9bac('0x24')](function(_0x2dd43a){_0x289077[_0x9bac('0x1d')]=_0x2dd43a;if(_0x429808[_0x9bac('0x33')]['includeAll']){_0x368657[_0x9bac('0x3f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x368657);})[_0x9bac('0x24')](function(_0x15bad8){_0x289077['rows']=_0x15bad8;return _0x289077;})['then'](respondWithFilteredResult(_0x3a94ad,_0x368657))['catch'](handleError(_0x3a94ad,null));};exports[_0x9bac('0x40')]=function(_0x46963d,_0x57172f){var _0x3d0881={'raw':!![],'where':{'id':_0x46963d[_0x9bac('0x41')]['id']}},_0x13faa4={};_0x13faa4[_0x9bac('0x32')]=_[_0x9bac('0x42')](db[_0x9bac('0x43')][_0x9bac('0x2e')]);_0x13faa4[_0x9bac('0x33')]=_[_0x9bac('0x42')](_0x46963d['query']);_0x13faa4[_0x9bac('0x3a')]=_[_0x9bac('0x44')](_0x13faa4['model'],_0x13faa4[_0x9bac('0x33')]);_0x3d0881[_0x9bac('0x34')]=_[_0x9bac('0x44')](_0x13faa4[_0x9bac('0x32')],qs[_0x9bac('0x35')](_0x46963d['query']['fields']));_0x3d0881['attributes']=_0x3d0881[_0x9bac('0x34')][_0x9bac('0x36')]?_0x3d0881[_0x9bac('0x34')]:_0x13faa4[_0x9bac('0x32')];if(_0x46963d['query']['includeAll']){_0x3d0881[_0x9bac('0x3f')]=[{'all':!![]}];}_0x3d0881=_[_0x9bac('0x3d')]({},_0x3d0881,_0x46963d[_0x9bac('0x3e')]);return db[_0x9bac('0x43')][_0x9bac('0x45')](_0x3d0881)[_0x9bac('0x24')](handleEntityNotFound(_0x57172f,null))[_0x9bac('0x24')](respondWithResult(_0x57172f,null))['catch'](handleError(_0x57172f,null));};exports[_0x9bac('0x23')]=function(_0x2cae0a,_0x4bb85d){if(_0x2cae0a['body']['id']){delete _0x2cae0a['body']['id'];}return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':{'id':_0x2cae0a[_0x9bac('0x41')]['id']}})[_0x9bac('0x24')](handleEntityNotFound(_0x4bb85d,null))[_0x9bac('0x24')](saveUpdates(_0x2cae0a[_0x9bac('0x46')],null))['then'](respondWithResult(_0x4bb85d,null))[_0x9bac('0x47')](handleError(_0x4bb85d,null));};exports['destroy']=function(_0x391336,_0x5a2e3a){return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':{'id':_0x391336[_0x9bac('0x41')]['id']}})[_0x9bac('0x24')](handleEntityNotFound(_0x5a2e3a,null))[_0x9bac('0x24')](removeEntity(_0x5a2e3a,null))[_0x9bac('0x47')](handleError(_0x5a2e3a,null));};exports[_0x9bac('0x48')]=function(_0x217bd3,_0x5f3aa3){var _0x1df92f={'key':_0x217bd3[_0x9bac('0x46')]['key']};if(_0x217bd3[_0x9bac('0x46')][_0x9bac('0x49')]){_0x1df92f[_0x9bac('0x49')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x49')];}else if(_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4a')]){_0x1df92f[_0x9bac('0x4a')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4a')];}else if(_0x217bd3[_0x9bac('0x46')]['OpenchannelAccountId']){_0x1df92f[_0x9bac('0x4b')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4b')];}else if(_0x217bd3['body'][_0x9bac('0x4c')]){_0x1df92f[_0x9bac('0x4c')]=_0x217bd3[_0x9bac('0x46')]['ChatWebsiteId'];}return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':_0x1df92f})[_0x9bac('0x24')](function(_0x335d2d){if(_0x335d2d){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x9bac('0x43')][_0x9bac('0x48')](_0x217bd3[_0x9bac('0x46')]);})['then'](function(_0x315369){var _0xa5d6ea=_0x217bd3[_0x9bac('0x4d')][_0x9bac('0x25')]({'plain':!![]});if(!_0xa5d6ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa5d6ea[_0x9bac('0x4e')]===_0x9bac('0x4d')){var _0x2ee60e=_0x315369[_0x9bac('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9bac('0x26'),'userProfileId':_0xa5d6ea['userProfileId']},'raw':!![]})['then'](function(_0x2cb933){if(_0x2cb933&&_0x2cb933[_0x9bac('0x4f')]===0x0){return db[_0x9bac('0x27')][_0x9bac('0x48')]({'name':_0x2ee60e['name'],'resourceId':_0x2ee60e['id'],'type':_0x2cb933[_0x9bac('0x2a')],'sectionId':_0x2cb933['id']},{})[_0x9bac('0x24')](function(){return _0x315369;});}else{return _0x315369;}})[_0x9bac('0x47')](function(_0x303e7f){logger[_0x9bac('0x50')](_0x9bac('0x51'),_0x303e7f);throw _0x303e7f;});}return _0x315369;})[_0x9bac('0x24')](respondWithResult(_0x5f3aa3,0xc9))[_0x9bac('0x47')](handleError(_0x5f3aa3,null));}; \ No newline at end of file +var _0xea3b=['name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','CannedAnswers','UserProfileResource','destroy','error','stack'];(function(_0x26389c,_0x761ed6){var _0x432a39=function(_0x571e77){while(--_0x571e77){_0x26389c['push'](_0x26389c['shift']());}};_0x432a39(++_0x761ed6);}(_0xea3b,0x133));var _0xbea3=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xea3b[_0x3b16e1];return _0x311d1b;};'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(_0xbea3('0x0'));var moment=require(_0xbea3('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbea3('0x2'));var util=require(_0xbea3('0x3'));var path=require(_0xbea3('0x4'));var sox=require('sox');var csv=require(_0xbea3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbea3('0x6'));var _=require('lodash');var squel=require(_0xbea3('0x7'));var crypto=require(_0xbea3('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbea3('0x9'));var Papa=require(_0xbea3('0xa'));var Redis=require(_0xbea3('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xbea3('0xc'));var as=require(_0xbea3('0xd'));var hardwareService=require(_0xbea3('0xe'));var logger=require(_0xbea3('0xf'))(_0xbea3('0x10'));var utils=require('../../config/utils');var config=require(_0xbea3('0x11'));var licenseUtil=require(_0xbea3('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db077,_0x13094a){_0x13094a=_0x13094a||0xcc;return function(_0x1d10c1){if(_0x1d10c1){return _0x4db077[_0xbea3('0x13')](_0x13094a);}return _0x4db077[_0xbea3('0x14')](_0x13094a)[_0xbea3('0x15')]();};}function respondWithResult(_0x41bdbc,_0x478ae6){_0x478ae6=_0x478ae6||0xc8;return function(_0x4e6609){if(_0x4e6609){return _0x41bdbc[_0xbea3('0x14')](_0x478ae6)[_0xbea3('0x16')](_0x4e6609);}};}function respondWithFilteredResult(_0x4ff9c6,_0x31dd60){return function(_0x1a4687){if(_0x1a4687){var _0x508dca=typeof _0x31dd60['offset']==='undefined'&&typeof _0x31dd60[_0xbea3('0x17')]===_0xbea3('0x18');var _0x4165e2=_0x1a4687[_0xbea3('0x19')];var _0x12027d=_0x508dca?0x0:_0x31dd60['offset'];var _0x2b03f8=_0x508dca?_0x1a4687[_0xbea3('0x19')]:_0x31dd60[_0xbea3('0x1a')]+_0x31dd60[_0xbea3('0x17')];var _0x524e34;if(_0x2b03f8>=_0x4165e2){_0x2b03f8=_0x4165e2;_0x524e34=0xc8;}else{_0x524e34=0xce;}_0x4ff9c6[_0xbea3('0x14')](_0x524e34);return _0x4ff9c6['set'](_0xbea3('0x1b'),_0x12027d+'-'+_0x2b03f8+'/'+_0x4165e2)['json'](_0x1a4687);}return null;};}function patchUpdates(_0x23e762){return function(_0x565056){try{jsonpatch[_0xbea3('0x1c')](_0x565056,_0x23e762,!![]);}catch(_0x15936b){return BPromise[_0xbea3('0x1d')](_0x15936b);}return _0x565056[_0xbea3('0x1e')]();};}function saveUpdates(_0x4af4be,_0xd90926){return function(_0x40f97f){if(_0x40f97f){return _0x40f97f['update'](_0x4af4be)['then'](function(_0x450d86){return _0x450d86;});}return null;};}function removeEntity(_0x2851ee,_0x556079){return function(_0x47e612){if(_0x47e612){return _0x47e612['destroy']()[_0xbea3('0x1f')](function(){var _0xad4ef1=_0x47e612['get']({'plain':!![]});var _0x34548d=_0xbea3('0x20');return db[_0xbea3('0x21')][_0xbea3('0x22')]({'where':{'type':_0x34548d,'resourceId':_0xad4ef1['id']}})[_0xbea3('0x1f')](function(){return _0x47e612;});})[_0xbea3('0x1f')](function(){_0x2851ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3286,_0x3191d8){return function(_0x328b6d){if(!_0x328b6d){_0x1e3286['sendStatus'](0x194);}return _0x328b6d;};}function handleError(_0x24bee6,_0x2a2201){_0x2a2201=_0x2a2201||0x1f4;return function(_0x3a7a39){logger[_0xbea3('0x23')](_0x3a7a39[_0xbea3('0x24')]);if(_0x3a7a39['name']){delete _0x3a7a39[_0xbea3('0x25')];}_0x24bee6[_0xbea3('0x14')](_0x2a2201)[_0xbea3('0x26')](_0x3a7a39);};}exports[_0xbea3('0x27')]=function(_0x267f2d,_0x3981c7){var _0x40bf44={},_0x4d9bc9={},_0x4d6002={'count':0x0,'rows':[]};var _0x341122=_[_0xbea3('0x28')](db[_0xbea3('0x29')][_0xbea3('0x2a')],function(_0x36da18){return{'name':_0x36da18['fieldName'],'type':_0x36da18[_0xbea3('0x2b')][_0xbea3('0x2c')]};});_0x4d9bc9[_0xbea3('0x2d')]=_[_0xbea3('0x28')](_0x341122,'name');_0x4d9bc9[_0xbea3('0x2e')]=_[_0xbea3('0x2f')](_0x267f2d['query']);_0x4d9bc9[_0xbea3('0x30')]=_['intersection'](_0x4d9bc9['model'],_0x4d9bc9['query']);_0x40bf44[_0xbea3('0x31')]=_[_0xbea3('0x32')](_0x4d9bc9[_0xbea3('0x2d')],qs[_0xbea3('0x33')](_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x33')]));_0x40bf44['attributes']=_0x40bf44['attributes'][_0xbea3('0x34')]?_0x40bf44[_0xbea3('0x31')]:_0x4d9bc9[_0xbea3('0x2d')];if(!_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x35')]('nolimit')){_0x40bf44['limit']=qs['limit'](_0x267f2d[_0xbea3('0x2e')]['limit']);_0x40bf44[_0xbea3('0x1a')]=qs[_0xbea3('0x1a')](_0x267f2d['query']['offset']);}_0x40bf44[_0xbea3('0x36')]=qs[_0xbea3('0x37')](_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x37')]);_0x40bf44['where']=qs[_0xbea3('0x30')](_[_0xbea3('0x38')](_0x267f2d[_0xbea3('0x2e')],_0x4d9bc9['filters']),_0x341122);if(_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x39')]){_0x40bf44[_0xbea3('0x3a')]=_[_0xbea3('0x3b')](_0x40bf44[_0xbea3('0x3a')],{'$or':[{'key':{'$like':'%'+_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x39')]+'%'}},{'value':{'$like':'%'+_0x267f2d['query'][_0xbea3('0x39')]+'%'}}]});}_0x40bf44=_[_0xbea3('0x3b')]({},_0x40bf44,_0x267f2d['options']);var _0x1c52fd={'where':_0x40bf44[_0xbea3('0x3a')]};return db[_0xbea3('0x29')]['count'](_0x1c52fd)[_0xbea3('0x1f')](function(_0x181754){_0x4d6002[_0xbea3('0x19')]=_0x181754;if(_0x267f2d[_0xbea3('0x2e')][_0xbea3('0x3c')]){_0x40bf44[_0xbea3('0x3d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbea3('0x3e')](_0x40bf44);})[_0xbea3('0x1f')](function(_0x2453b1){_0x4d6002[_0xbea3('0x3f')]=_0x2453b1;return _0x4d6002;})[_0xbea3('0x1f')](respondWithFilteredResult(_0x3981c7,_0x40bf44))[_0xbea3('0x40')](handleError(_0x3981c7,null));};exports[_0xbea3('0x41')]=function(_0x1a3481,_0x1ad8b1){var _0x9e40c6={'raw':!![],'where':{'id':_0x1a3481[_0xbea3('0x42')]['id']}},_0x4b9550={};_0x4b9550['model']=_['keys'](db['CannedAnswer'][_0xbea3('0x2a')]);_0x4b9550[_0xbea3('0x2e')]=_['keys'](_0x1a3481[_0xbea3('0x2e')]);_0x4b9550['filters']=_[_0xbea3('0x32')](_0x4b9550[_0xbea3('0x2d')],_0x4b9550[_0xbea3('0x2e')]);_0x9e40c6['attributes']=_[_0xbea3('0x32')](_0x4b9550[_0xbea3('0x2d')],qs[_0xbea3('0x33')](_0x1a3481[_0xbea3('0x2e')]['fields']));_0x9e40c6[_0xbea3('0x31')]=_0x9e40c6['attributes'][_0xbea3('0x34')]?_0x9e40c6[_0xbea3('0x31')]:_0x4b9550[_0xbea3('0x2d')];if(_0x1a3481[_0xbea3('0x2e')][_0xbea3('0x3c')]){_0x9e40c6[_0xbea3('0x3d')]=[{'all':!![]}];}_0x9e40c6=_['merge']({},_0x9e40c6,_0x1a3481[_0xbea3('0x43')]);return db['CannedAnswer'][_0xbea3('0x44')](_0x9e40c6)[_0xbea3('0x1f')](handleEntityNotFound(_0x1ad8b1,null))[_0xbea3('0x1f')](respondWithResult(_0x1ad8b1,null))['catch'](handleError(_0x1ad8b1,null));};exports[_0xbea3('0x45')]=function(_0x5868fe,_0x17b9a0){if(_0x5868fe[_0xbea3('0x46')]['id']){delete _0x5868fe[_0xbea3('0x46')]['id'];}return db['CannedAnswer'][_0xbea3('0x44')]({'where':{'id':_0x5868fe[_0xbea3('0x42')]['id']}})[_0xbea3('0x1f')](handleEntityNotFound(_0x17b9a0,null))[_0xbea3('0x1f')](saveUpdates(_0x5868fe[_0xbea3('0x46')],null))[_0xbea3('0x1f')](respondWithResult(_0x17b9a0,null))[_0xbea3('0x40')](handleError(_0x17b9a0,null));};exports[_0xbea3('0x22')]=function(_0x286873,_0x56913b){return db[_0xbea3('0x29')][_0xbea3('0x44')]({'where':{'id':_0x286873[_0xbea3('0x42')]['id']}})['then'](handleEntityNotFound(_0x56913b,null))[_0xbea3('0x1f')](removeEntity(_0x56913b,null))[_0xbea3('0x40')](handleError(_0x56913b,null));};exports['create']=function(_0x44ea6c,_0x39df5d){var _0x25cf99={'key':_0x44ea6c[_0xbea3('0x46')]['key']};if(_0x44ea6c[_0xbea3('0x46')][_0xbea3('0x47')]){_0x25cf99['MailAccountId']=_0x44ea6c['body']['MailAccountId'];}else if(_0x44ea6c['body']['SmsAccountId']){_0x25cf99[_0xbea3('0x48')]=_0x44ea6c['body'][_0xbea3('0x48')];}else if(_0x44ea6c['body'][_0xbea3('0x49')]){_0x25cf99[_0xbea3('0x49')]=_0x44ea6c['body'][_0xbea3('0x49')];}else if(_0x44ea6c[_0xbea3('0x46')][_0xbea3('0x4a')]){_0x25cf99['ChatWebsiteId']=_0x44ea6c[_0xbea3('0x46')][_0xbea3('0x4a')];}return db[_0xbea3('0x29')][_0xbea3('0x44')]({'where':_0x25cf99})[_0xbea3('0x1f')](function(_0x32f482){if(_0x32f482){throw new db[(_0xbea3('0x4b'))][(_0xbea3('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xbea3('0x29')][_0xbea3('0x4d')](_0x44ea6c['body']);})[_0xbea3('0x1f')](function(_0x3269d7){var _0x4584b8=_0x44ea6c['user'][_0xbea3('0x4e')]({'plain':!![]});if(!_0x4584b8)throw new Error(_0xbea3('0x4f'));if(_0x4584b8[_0xbea3('0x50')]===_0xbea3('0x51')){var _0x40da9f=_0x3269d7[_0xbea3('0x4e')]({'plain':!![]});return db[_0xbea3('0x52')][_0xbea3('0x44')]({'where':{'name':'CannedAnswers','userProfileId':_0x4584b8[_0xbea3('0x53')]},'raw':!![]})[_0xbea3('0x1f')](function(_0x406de6){if(_0x406de6&&_0x406de6[_0xbea3('0x54')]===0x0){return db[_0xbea3('0x21')]['create']({'name':_0x40da9f['name'],'resourceId':_0x40da9f['id'],'type':_0x406de6[_0xbea3('0x25')],'sectionId':_0x406de6['id']},{})[_0xbea3('0x1f')](function(){return _0x3269d7;});}else{return _0x3269d7;}})[_0xbea3('0x40')](function(_0x61c3a0){logger[_0xbea3('0x23')](_0xbea3('0x55'),_0x61c3a0);throw _0x61c3a0;});}return _0x3269d7;})[_0xbea3('0x1f')](respondWithResult(_0x39df5d,0xc9))[_0xbea3('0x40')](handleError(_0x39df5d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0736d51..dbcb3ed 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 _0x3c66=['define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x3c66,0xdc));var _0x63c6=function(_0x588b13,_0x245938){_0x588b13=_0x588b13-0x0;var _0x3861ec=_0x3c66[_0x588b13];return _0x3861ec;};'use strict';var _=require(_0x63c6('0x0'));var util=require(_0x63c6('0x1'));var logger=require('../../config/logger')(_0x63c6('0x2'));var moment=require(_0x63c6('0x3'));var BPromise=require(_0x63c6('0x4'));var rp=require(_0x63c6('0x5'));var fs=require('fs');var path=require(_0x63c6('0x6'));var rimraf=require('rimraf');var config=require(_0x63c6('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0xd79c07,_0x4677cf){return _0xd79c07[_0x63c6('0x8')]('CannedAnswer',attributes,{'tableName':_0x63c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63c6('0xa'),'collate':_0x63c6('0xb')});}; \ No newline at end of file +var _0x874f=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x874f,0x145));var _0xf874=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0x874f[_0x4d03d6];return _0x22752e;};'use strict';var _=require(_0xf874('0x0'));var util=require(_0xf874('0x1'));var logger=require('../../config/logger')(_0xf874('0x2'));var moment=require(_0xf874('0x3'));var BPromise=require('bluebird');var rp=require(_0xf874('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf874('0x5'));var config=require(_0xf874('0x6'));var attributes=require(_0xf874('0x7'));module[_0xf874('0x8')]=function(_0x4d230f,_0x1d8dae){return _0x4d230f[_0xf874('0x9')](_0xf874('0xa'),attributes,{'tableName':_0xf874('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf874('0xc'),'collate':_0xf874('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 58a0c93..fb772a5 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(_0x3b4621,_0x4d2c4d){var _0x5f5120=function(_0x11fcf3){while(--_0x11fcf3){_0x3b4621['push'](_0x3b4621['shift']());}};_0x5f5120(++_0x4d2c4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x49cbed,_0x4eb100){var _0xe30f6=function(_0x2714f2){while(--_0x2714f2){_0x49cbed['push'](_0x49cbed['shift']());}};_0xe30f6(++_0x4eb100);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 7e0a9ac..c011762 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 _0xbd1e=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x2faa2b,_0x1af296){var _0x3d0ec7=function(_0x363f29){while(--_0x363f29){_0x2faa2b['push'](_0x2faa2b['shift']());}};_0x3d0ec7(++_0x1af296);}(_0xbd1e,0x14b));var _0xebd1=function(_0x70bb8,_0x1da278){_0x70bb8=_0x70bb8-0x0;var _0x48ba84=_0xbd1e[_0x70bb8];return _0x48ba84;};'use strict';var multer=require(_0xebd1('0x0'));var util=require(_0xebd1('0x1'));var path=require(_0xebd1('0x2'));var timeout=require('connect-timeout');var express=require(_0xebd1('0x3'));var router=express['Router']();var fs_extra=require(_0xebd1('0x4'));var auth=require(_0xebd1('0x5'));var interaction=require(_0xebd1('0x6'));var config=require(_0xebd1('0x7'));var controller=require(_0xebd1('0x8'));router['get']('/',auth[_0xebd1('0x9')](),controller[_0xebd1('0xa')]);router[_0xebd1('0xb')](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0xd')]);router[_0xebd1('0xe')]('/',auth[_0xebd1('0x9')](),controller[_0xebd1('0xf')]);router[_0xebd1('0x10')](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0x11')]);router['delete'](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0x12')]);module[_0xebd1('0x13')]=router; \ No newline at end of file +var _0xa62b=['get','index','/:id','isAuthenticated','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xa62b,0x129));var _0xba62=function(_0x485d08,_0x428c32){_0x485d08=_0x485d08-0x0;var _0x55c64c=_0xa62b[_0x485d08];return _0x55c64c;};'use strict';var multer=require('multer');var util=require(_0xba62('0x0'));var path=require(_0xba62('0x1'));var timeout=require(_0xba62('0x2'));var express=require(_0xba62('0x3'));var router=express[_0xba62('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba62('0x5'));var interaction=require(_0xba62('0x6'));var config=require(_0xba62('0x7'));var controller=require(_0xba62('0x8'));router[_0xba62('0x9')]('/',auth['isAuthenticated'](),controller[_0xba62('0xa')]);router[_0xba62('0x9')](_0xba62('0xb'),auth[_0xba62('0xc')](),controller['show']);router['post']('/',auth[_0xba62('0xc')](),controller[_0xba62('0xd')]);router[_0xba62('0xe')]('/:id',auth[_0xba62('0xc')](),controller[_0xba62('0xf')]);router[_0xba62('0x10')](_0xba62('0xb'),auth[_0xba62('0xc')](),controller['destroy']);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 dce03da..a5c96c4 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 _0x3b43=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3b43,0x71));var _0x33b4=function(_0x107da1,_0x1de358){_0x107da1=_0x107da1-0x0;var _0x5c4ced=_0x3b43[_0x107da1];return _0x5c4ced;};'use strict';var Sequelize=require(_0x33b4('0x0'));module[_0x33b4('0x1')]={'calldate':{'type':Sequelize[_0x33b4('0x2')],'allowNull':![],'defaultValue':_0x33b4('0x3')},'clid':{'type':Sequelize[_0x33b4('0x4')]},'src':{'type':Sequelize[_0x33b4('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x33b4('0x4')]},'channel':{'type':Sequelize[_0x33b4('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x33b4('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x33b4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x33b4('0x4')]},'amaflags':{'type':Sequelize[_0x33b4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x33b4('0x4')]},'userfield':{'type':Sequelize[_0x33b4('0x4')]},'uniqueid':{'type':Sequelize[_0x33b4('0x4')]},'linkedid':{'type':Sequelize[_0x33b4('0x4')]},'sequence':{'type':Sequelize[_0x33b4('0x4')]},'peeraccount':{'type':Sequelize[_0x33b4('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x33b4('0x4')]}}; \ No newline at end of file +var _0x5bb7=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5d82d9,_0x3d7694){var _0x3dfd86=function(_0x53735e){while(--_0x53735e){_0x5d82d9['push'](_0x5d82d9['shift']());}};_0x3dfd86(++_0x3d7694);}(_0x5bb7,0x104));var _0x75bb=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5bb7[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x75bb('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x75bb('0x1')],'allowNull':![],'defaultValue':_0x75bb('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x75bb('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x75bb('0x3')]},'dstchannel':{'type':Sequelize[_0x75bb('0x3')]},'lastapp':{'type':Sequelize[_0x75bb('0x3')]},'lastdata':{'type':Sequelize[_0x75bb('0x3')]},'duration':{'type':Sequelize[_0x75bb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x75bb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75bb('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x75bb('0x3')]},'userfield':{'type':Sequelize[_0x75bb('0x3')]},'uniqueid':{'type':Sequelize[_0x75bb('0x3')]},'linkedid':{'type':Sequelize[_0x75bb('0x3')]},'sequence':{'type':Sequelize[_0x75bb('0x3')]},'peeraccount':{'type':Sequelize[_0x75bb('0x3')]},'type':{'type':Sequelize[_0x75bb('0x3')]},'tag':{'type':Sequelize[_0x75bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b0ee079..25dd2d8 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 _0xf725=['save','update','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','rawAttributes','length','include','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x483dfa,_0x1942b9){var _0x5ccfee=function(_0x1b8c95){while(--_0x1b8c95){_0x483dfa['push'](_0x483dfa['shift']());}};_0x5ccfee(++_0x1942b9);}(_0xf725,0x7e));var _0x5f72=function(_0x2f20ad,_0x137cfc){_0x2f20ad=_0x2f20ad-0x0;var _0x5dd3ae=_0xf725[_0x2f20ad];return _0x5dd3ae;};'use strict';var emlformat=require(_0x5f72('0x0'));var rimraf=require(_0x5f72('0x1'));var zipdir=require(_0x5f72('0x2'));var jsonpatch=require(_0x5f72('0x3'));var rp=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var BPromise=require(_0x5f72('0x6'));var Mustache=require(_0x5f72('0x7'));var util=require(_0x5f72('0x8'));var path=require(_0x5f72('0x9'));var sox=require('sox');var csv=require(_0x5f72('0xa'));var ejs=require(_0x5f72('0xb'));var fs=require('fs');var fs_extra=require(_0x5f72('0xc'));var _=require(_0x5f72('0xd'));var squel=require(_0x5f72('0xe'));var crypto=require(_0x5f72('0xf'));var jsforce=require(_0x5f72('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f72('0x11'));var Papa=require(_0x5f72('0x12'));var Redis=require('ioredis');var authService=require(_0x5f72('0x13'));var qs=require(_0x5f72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f72('0x15'));var logger=require(_0x5f72('0x16'))(_0x5f72('0x17'));var utils=require(_0x5f72('0x18'));var config=require(_0x5f72('0x19'));var licenseUtil=require(_0x5f72('0x1a'));var db=require(_0x5f72('0x1b'))['db'];function respondWithStatusCode(_0x537d7d,_0x1ac591){_0x1ac591=_0x1ac591||0xcc;return function(_0x3307ed){if(_0x3307ed){return _0x537d7d[_0x5f72('0x1c')](_0x1ac591);}return _0x537d7d[_0x5f72('0x1d')](_0x1ac591)[_0x5f72('0x1e')]();};}function respondWithResult(_0x57007a,_0x43d1fd){_0x43d1fd=_0x43d1fd||0xc8;return function(_0x4f81e9){if(_0x4f81e9){return _0x57007a['status'](_0x43d1fd)[_0x5f72('0x1f')](_0x4f81e9);}};}function respondWithFilteredResult(_0x5a036c,_0x3267a){return function(_0x4adc76){if(_0x4adc76){var _0x317eed=typeof _0x3267a['offset']===_0x5f72('0x20')&&typeof _0x3267a[_0x5f72('0x21')]==='undefined';var _0xea99d5=_0x4adc76[_0x5f72('0x22')];var _0x1497d4=_0x317eed?0x0:_0x3267a['offset'];var _0x490d14=_0x317eed?_0x4adc76['count']:_0x3267a[_0x5f72('0x23')]+_0x3267a[_0x5f72('0x21')];var _0x269dae;if(_0x490d14>=_0xea99d5){_0x490d14=_0xea99d5;_0x269dae=0xc8;}else{_0x269dae=0xce;}_0x5a036c[_0x5f72('0x1d')](_0x269dae);return _0x5a036c[_0x5f72('0x24')](_0x5f72('0x25'),_0x1497d4+'-'+_0x490d14+'/'+_0xea99d5)[_0x5f72('0x1f')](_0x4adc76);}return null;};}function patchUpdates(_0x5859fc){return function(_0x151a67){try{jsonpatch[_0x5f72('0x26')](_0x151a67,_0x5859fc,!![]);}catch(_0xd6dff9){return BPromise[_0x5f72('0x27')](_0xd6dff9);}return _0x151a67[_0x5f72('0x28')]();};}function saveUpdates(_0x2c599a,_0x30235e){return function(_0x367716){if(_0x367716){return _0x367716[_0x5f72('0x29')](_0x2c599a)[_0x5f72('0x2a')](function(_0x21c7d2){return _0x21c7d2;});}return null;};}function removeEntity(_0x530009,_0x433935){return function(_0x21f4a3){if(_0x21f4a3){return _0x21f4a3[_0x5f72('0x2b')]()[_0x5f72('0x2a')](function(){_0x530009['status'](0xcc)[_0x5f72('0x1e')]();});}};}function handleEntityNotFound(_0x3d05bc,_0x5c3325){return function(_0x447019){if(!_0x447019){_0x3d05bc[_0x5f72('0x1c')](0x194);}return _0x447019;};}function handleError(_0x347723,_0x521174){_0x521174=_0x521174||0x1f4;return function(_0x58ff77){logger[_0x5f72('0x2c')](_0x58ff77[_0x5f72('0x2d')]);if(_0x58ff77[_0x5f72('0x2e')]){delete _0x58ff77[_0x5f72('0x2e')];}_0x347723[_0x5f72('0x1d')](_0x521174)[_0x5f72('0x2f')](_0x58ff77);};}exports[_0x5f72('0x30')]=function(_0x59af82,_0x1b12cd){var _0x49eea5={},_0xc8ca5a={},_0x35fa31={'count':0x0,'rows':[]};var _0x7cce31=_[_0x5f72('0x31')](db[_0x5f72('0x32')]['rawAttributes'],function(_0x502057){return{'name':_0x502057[_0x5f72('0x33')],'type':_0x502057[_0x5f72('0x34')][_0x5f72('0x35')]};});_0xc8ca5a[_0x5f72('0x36')]=_[_0x5f72('0x31')](_0x7cce31,_0x5f72('0x2e'));_0xc8ca5a[_0x5f72('0x37')]=_['keys'](_0x59af82[_0x5f72('0x37')]);_0xc8ca5a[_0x5f72('0x38')]=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],_0xc8ca5a[_0x5f72('0x37')]);_0x49eea5['attributes']=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3a')]));_0x49eea5[_0x5f72('0x3b')]=_0x49eea5['attributes']['length']?_0x49eea5[_0x5f72('0x3b')]:_0xc8ca5a[_0x5f72('0x36')];if(!_0x59af82['query'][_0x5f72('0x3c')](_0x5f72('0x3d'))){_0x49eea5[_0x5f72('0x21')]=qs[_0x5f72('0x21')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x21')]);_0x49eea5[_0x5f72('0x23')]=qs[_0x5f72('0x23')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x23')]);}_0x49eea5[_0x5f72('0x3e')]=qs[_0x5f72('0x3f')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3f')]);_0x49eea5['where']=qs[_0x5f72('0x38')](_['pick'](_0x59af82['query'],_0xc8ca5a[_0x5f72('0x38')]),_0x7cce31);if(_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]){_0x49eea5[_0x5f72('0x41')]=_[_0x5f72('0x42')](_0x49eea5[_0x5f72('0x41')],{'$or':_['map'](_0x7cce31,function(_0x1b9692){if(_0x1b9692[_0x5f72('0x34')]!==_0x5f72('0x43')){var _0x40d988={};_0x40d988[_0x1b9692[_0x5f72('0x2e')]]={'$like':'%'+_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]+'%'};return _0x40d988;}})});}_0x49eea5=_[_0x5f72('0x42')]({},_0x49eea5,_0x59af82[_0x5f72('0x44')]);var _0x2b8549={'where':_0x49eea5[_0x5f72('0x41')]};return db[_0x5f72('0x32')][_0x5f72('0x22')](_0x2b8549)[_0x5f72('0x2a')](function(_0xefdf17){_0x35fa31['count']=_0xefdf17;if(_0x59af82['query'][_0x5f72('0x45')]){_0x49eea5['include']=[{'all':!![]}];}return db['Cdr'][_0x5f72('0x46')](_0x49eea5);})[_0x5f72('0x2a')](function(_0x57d320){_0x35fa31[_0x5f72('0x47')]=_0x57d320;return _0x35fa31;})[_0x5f72('0x2a')](respondWithFilteredResult(_0x1b12cd,_0x49eea5))['catch'](handleError(_0x1b12cd,null));};exports[_0x5f72('0x48')]=function(_0x2314ea,_0x4f2d4a){var _0xcfefc5={'raw':!![],'where':{'id':_0x2314ea['params']['id']}},_0x4f57a6={};_0x4f57a6[_0x5f72('0x36')]=_[_0x5f72('0x49')](db[_0x5f72('0x32')][_0x5f72('0x4a')]);_0x4f57a6[_0x5f72('0x37')]=_[_0x5f72('0x49')](_0x2314ea[_0x5f72('0x37')]);_0x4f57a6['filters']=_[_0x5f72('0x39')](_0x4f57a6[_0x5f72('0x36')],_0x4f57a6[_0x5f72('0x37')]);_0xcfefc5[_0x5f72('0x3b')]=_['intersection'](_0x4f57a6[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x2314ea[_0x5f72('0x37')][_0x5f72('0x3a')]));_0xcfefc5['attributes']=_0xcfefc5[_0x5f72('0x3b')][_0x5f72('0x4b')]?_0xcfefc5[_0x5f72('0x3b')]:_0x4f57a6[_0x5f72('0x36')];if(_0x2314ea['query'][_0x5f72('0x45')]){_0xcfefc5[_0x5f72('0x4c')]=[{'all':!![]}];}_0xcfefc5=_['merge']({},_0xcfefc5,_0x2314ea[_0x5f72('0x44')]);return db[_0x5f72('0x32')]['find'](_0xcfefc5)[_0x5f72('0x2a')](handleEntityNotFound(_0x4f2d4a,null))[_0x5f72('0x2a')](respondWithResult(_0x4f2d4a,null))[_0x5f72('0x4d')](handleError(_0x4f2d4a,null));};exports['create']=function(_0xc30598,_0x5efa48){return db[_0x5f72('0x32')][_0x5f72('0x4e')](_0xc30598['body'],{})[_0x5f72('0x2a')](respondWithResult(_0x5efa48,0xc9))[_0x5f72('0x4d')](handleError(_0x5efa48,null));};exports[_0x5f72('0x29')]=function(_0x302fff,_0x506774){if(_0x302fff[_0x5f72('0x4f')]['id']){delete _0x302fff[_0x5f72('0x4f')]['id'];}return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x302fff['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x506774,null))['then'](saveUpdates(_0x302fff[_0x5f72('0x4f')],null))[_0x5f72('0x2a')](respondWithResult(_0x506774,null))[_0x5f72('0x4d')](handleError(_0x506774,null));};exports[_0x5f72('0x2b')]=function(_0x142089,_0x3f071c){return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x142089[_0x5f72('0x51')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x3f071c,null))['then'](removeEntity(_0x3f071c,null))[_0x5f72('0x4d')](handleError(_0x3f071c,null));};exports[_0x5f72('0x52')]=function(_0x5c5d94,_0x30e03){return db[_0x5f72('0x32')]['describe']()[_0x5f72('0x2a')](respondWithResult(_0x30e03,null))[_0x5f72('0x4d')](handleError(_0x30e03,null));}; \ No newline at end of file +var _0xc7a3=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x1ec76d,_0x55096e){var _0x2121d8=function(_0x4be3af){while(--_0x4be3af){_0x1ec76d['push'](_0x1ec76d['shift']());}};_0x2121d8(++_0x55096e);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x2bd458,_0x1d1832){_0x2bd458=_0x2bd458-0x0;var _0x46d991=_0xc7a3[_0x2bd458];return _0x46d991;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c7a('0x0'));var zipdir=require(_0x3c7a('0x1'));var jsonpatch=require(_0x3c7a('0x2'));var rp=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var BPromise=require(_0x3c7a('0x5'));var Mustache=require('mustache');var util=require(_0x3c7a('0x6'));var path=require(_0x3c7a('0x7'));var sox=require('sox');var csv=require(_0x3c7a('0x8'));var ejs=require(_0x3c7a('0x9'));var fs=require('fs');var fs_extra=require(_0x3c7a('0xa'));var _=require('lodash');var squel=require(_0x3c7a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c7a('0x8'));var querystring=require(_0x3c7a('0xd'));var Papa=require(_0x3c7a('0xe'));var Redis=require('ioredis');var authService=require(_0x3c7a('0xf'));var qs=require(_0x3c7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7a('0x11'));var logger=require('../../config/logger')(_0x3c7a('0x12'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x13'));var licenseUtil=require(_0x3c7a('0x14'));var db=require(_0x3c7a('0x15'))['db'];function respondWithStatusCode(_0x16ea63,_0x3d47c3){_0x3d47c3=_0x3d47c3||0xcc;return function(_0x53e5d7){if(_0x53e5d7){return _0x16ea63[_0x3c7a('0x16')](_0x3d47c3);}return _0x16ea63[_0x3c7a('0x17')](_0x3d47c3)[_0x3c7a('0x18')]();};}function respondWithResult(_0x36185c,_0x24d188){_0x24d188=_0x24d188||0xc8;return function(_0x4e6ca5){if(_0x4e6ca5){return _0x36185c[_0x3c7a('0x17')](_0x24d188)[_0x3c7a('0x19')](_0x4e6ca5);}};}function respondWithFilteredResult(_0x5af0a6,_0x539270){return function(_0x3044e6){if(_0x3044e6){var _0xb9201c=typeof _0x539270[_0x3c7a('0x1a')]==='undefined'&&typeof _0x539270[_0x3c7a('0x1b')]==='undefined';var _0x74fd1e=_0x3044e6[_0x3c7a('0x1c')];var _0x36e8c2=_0xb9201c?0x0:_0x539270[_0x3c7a('0x1a')];var _0x3cb5bf=_0xb9201c?_0x3044e6[_0x3c7a('0x1c')]:_0x539270['offset']+_0x539270[_0x3c7a('0x1b')];var _0x2db9df;if(_0x3cb5bf>=_0x74fd1e){_0x3cb5bf=_0x74fd1e;_0x2db9df=0xc8;}else{_0x2db9df=0xce;}_0x5af0a6[_0x3c7a('0x17')](_0x2db9df);return _0x5af0a6[_0x3c7a('0x1d')](_0x3c7a('0x1e'),_0x36e8c2+'-'+_0x3cb5bf+'/'+_0x74fd1e)[_0x3c7a('0x19')](_0x3044e6);}return null;};}function patchUpdates(_0x11a06b){return function(_0x34f4a6){try{jsonpatch[_0x3c7a('0x1f')](_0x34f4a6,_0x11a06b,!![]);}catch(_0x544742){return BPromise[_0x3c7a('0x20')](_0x544742);}return _0x34f4a6['save']();};}function saveUpdates(_0x3c75ff,_0x557518){return function(_0x40d24e){if(_0x40d24e){return _0x40d24e[_0x3c7a('0x21')](_0x3c75ff)[_0x3c7a('0x22')](function(_0x7dbe38){return _0x7dbe38;});}return null;};}function removeEntity(_0x283568,_0x245dde){return function(_0x8251d4){if(_0x8251d4){return _0x8251d4[_0x3c7a('0x23')]()[_0x3c7a('0x22')](function(){_0x283568[_0x3c7a('0x17')](0xcc)[_0x3c7a('0x18')]();});}};}function handleEntityNotFound(_0x317fbd,_0x56539f){return function(_0x3984a1){if(!_0x3984a1){_0x317fbd[_0x3c7a('0x16')](0x194);}return _0x3984a1;};}function handleError(_0x37cc40,_0x3829de){_0x3829de=_0x3829de||0x1f4;return function(_0x9b910c){logger[_0x3c7a('0x24')](_0x9b910c[_0x3c7a('0x25')]);if(_0x9b910c[_0x3c7a('0x26')]){delete _0x9b910c['name'];}_0x37cc40[_0x3c7a('0x17')](_0x3829de)[_0x3c7a('0x27')](_0x9b910c);};}exports[_0x3c7a('0x28')]=function(_0x197012,_0x33065b){var _0x1a96a0={},_0xccf304={},_0x1ff595={'count':0x0,'rows':[]};var _0x508d2e=_[_0x3c7a('0x29')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')],function(_0x18a346){return{'name':_0x18a346[_0x3c7a('0x2c')],'type':_0x18a346[_0x3c7a('0x2d')][_0x3c7a('0x2e')]};});_0xccf304[_0x3c7a('0x2f')]=_[_0x3c7a('0x29')](_0x508d2e,_0x3c7a('0x26'));_0xccf304[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x197012[_0x3c7a('0x30')]);_0xccf304['filters']=_['intersection'](_0xccf304['model'],_0xccf304['query']);_0x1a96a0[_0x3c7a('0x32')]=_[_0x3c7a('0x33')](_0xccf304[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x1a96a0[_0x3c7a('0x32')]=_0x1a96a0[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x1a96a0[_0x3c7a('0x32')]:_0xccf304[_0x3c7a('0x2f')];if(!_0x197012[_0x3c7a('0x30')][_0x3c7a('0x36')](_0x3c7a('0x37'))){_0x1a96a0['limit']=qs[_0x3c7a('0x1b')](_0x197012[_0x3c7a('0x30')]['limit']);_0x1a96a0[_0x3c7a('0x1a')]=qs['offset'](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x1a')]);}_0x1a96a0['order']=qs[_0x3c7a('0x38')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x38')]);_0x1a96a0[_0x3c7a('0x39')]=qs[_0x3c7a('0x3a')](_[_0x3c7a('0x3b')](_0x197012[_0x3c7a('0x30')],_0xccf304[_0x3c7a('0x3a')]),_0x508d2e);if(_0x197012[_0x3c7a('0x30')][_0x3c7a('0x3c')]){_0x1a96a0['where']=_[_0x3c7a('0x3d')](_0x1a96a0[_0x3c7a('0x39')],{'$or':_[_0x3c7a('0x29')](_0x508d2e,function(_0x43c236){if(_0x43c236[_0x3c7a('0x2d')]!==_0x3c7a('0x3e')){var _0x101e5d={};_0x101e5d[_0x43c236[_0x3c7a('0x26')]]={'$like':'%'+_0x197012['query'][_0x3c7a('0x3c')]+'%'};return _0x101e5d;}})});}_0x1a96a0=_[_0x3c7a('0x3d')]({},_0x1a96a0,_0x197012['options']);var _0x442087={'where':_0x1a96a0['where']};return db['Cdr']['count'](_0x442087)['then'](function(_0x44e935){_0x1ff595[_0x3c7a('0x1c')]=_0x44e935;if(_0x197012[_0x3c7a('0x30')]['includeAll']){_0x1a96a0[_0x3c7a('0x3f')]=[{'all':!![]}];}return db[_0x3c7a('0x2a')]['findAll'](_0x1a96a0);})['then'](function(_0x491335){_0x1ff595[_0x3c7a('0x40')]=_0x491335;return _0x1ff595;})[_0x3c7a('0x22')](respondWithFilteredResult(_0x33065b,_0x1a96a0))[_0x3c7a('0x41')](handleError(_0x33065b,null));};exports[_0x3c7a('0x42')]=function(_0x8d805a,_0x3e6a70){var _0x3f6060={'raw':!![],'where':{'id':_0x8d805a[_0x3c7a('0x43')]['id']}},_0x302556={};_0x302556[_0x3c7a('0x2f')]=_[_0x3c7a('0x31')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')]);_0x302556[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x8d805a['query']);_0x302556[_0x3c7a('0x3a')]=_[_0x3c7a('0x33')](_0x302556['model'],_0x302556['query']);_0x3f6060['attributes']=_[_0x3c7a('0x33')](_0x302556[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x8d805a[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x3f6060[_0x3c7a('0x32')]=_0x3f6060[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x3f6060[_0x3c7a('0x32')]:_0x302556[_0x3c7a('0x2f')];if(_0x8d805a[_0x3c7a('0x30')]['includeAll']){_0x3f6060['include']=[{'all':!![]}];}_0x3f6060=_['merge']({},_0x3f6060,_0x8d805a[_0x3c7a('0x44')]);return db[_0x3c7a('0x2a')][_0x3c7a('0x45')](_0x3f6060)[_0x3c7a('0x22')](handleEntityNotFound(_0x3e6a70,null))[_0x3c7a('0x22')](respondWithResult(_0x3e6a70,null))['catch'](handleError(_0x3e6a70,null));};exports[_0x3c7a('0x46')]=function(_0x12b69a,_0x2eb9e2){return db[_0x3c7a('0x2a')][_0x3c7a('0x46')](_0x12b69a[_0x3c7a('0x47')],{})[_0x3c7a('0x22')](respondWithResult(_0x2eb9e2,0xc9))['catch'](handleError(_0x2eb9e2,null));};exports['update']=function(_0x420fa7,_0x350ea7){if(_0x420fa7[_0x3c7a('0x47')]['id']){delete _0x420fa7[_0x3c7a('0x47')]['id'];}return db[_0x3c7a('0x2a')][_0x3c7a('0x45')]({'where':{'id':_0x420fa7['params']['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x350ea7,null))['then'](saveUpdates(_0x420fa7['body'],null))[_0x3c7a('0x22')](respondWithResult(_0x350ea7,null))[_0x3c7a('0x41')](handleError(_0x350ea7,null));};exports[_0x3c7a('0x23')]=function(_0x50b5e4,_0x5759a0){return db['Cdr']['find']({'where':{'id':_0x50b5e4[_0x3c7a('0x43')]['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x5759a0,null))[_0x3c7a('0x22')](removeEntity(_0x5759a0,null))[_0x3c7a('0x41')](handleError(_0x5759a0,null));};exports[_0x3c7a('0x48')]=function(_0x11f7ee,_0x124411){return db[_0x3c7a('0x2a')][_0x3c7a('0x48')]()[_0x3c7a('0x22')](respondWithResult(_0x124411,null))[_0x3c7a('0x41')](handleError(_0x124411,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index de2774d..8e8f4f9 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(_0x3218ca,_0x1f2034){var _0x3a0275=function(_0x43f384){while(--_0x43f384){_0x3218ca['push'](_0x3218ca['shift']());}};_0x3a0275(++_0x1f2034);}(_0x7a54,0x106));var _0x47a5=function(_0x36c0a5,_0x56db03){_0x36c0a5=_0x36c0a5-0x0;var _0x4fab3a=_0x7a54[_0x36c0a5];return _0x4fab3a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4c7808,_0x472d7f){var _0x6d61fb=function(_0x294115){while(--_0x294115){_0x4c7808['push'](_0x4c7808['shift']());}};_0x6d61fb(++_0x472d7f);}(_0x7a54,0x106));var _0x47a5=function(_0x38e784,_0x184fde){_0x38e784=_0x38e784-0x0;var _0x4a47c4=_0x7a54[_0x38e784];return _0x4a47c4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index af9ea7a..225716a 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 _0xebc7=['lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xebc7,0x118));var _0x7ebc=function(_0x2fc28e,_0x53e804){_0x2fc28e=_0x2fc28e-0x0;var _0x3f6923=_0xebc7[_0x2fc28e];return _0x3f6923;};'use strict';var _=require(_0x7ebc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ebc('0x1'));var rs=require(_0x7ebc('0x2'));var fs=require('fs');var Redis=require(_0x7ebc('0x3'));var db=require(_0x7ebc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ebc('0x5'));var config=require(_0x7ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7ebc('0x7')][_0x7ebc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f0ea5,_0x3d33b8,_0x156f80){return new BPromise(function(_0x376683,_0x52e971){return client[_0x7ebc('0x9')](_0x4f0ea5,_0x156f80)['then'](function(_0x45e301){logger['info']('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x7ebc('0xa'));logger[_0x7ebc('0xb')](_0x7ebc('0xc'),_0x3d33b8,'request\x20sent',JSON['stringify'](_0x45e301));if(_0x45e301[_0x7ebc('0xd')]){if(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xe')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);return _0x52e971(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);}logger[_0x7ebc('0xd')](_0x7ebc('0x10'),_0x3d33b8,_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);return _0x376683(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);}else{logger[_0x7ebc('0x11')](_0x7ebc('0x10'),_0x3d33b8,_0x7ebc('0xa'));_0x376683(_0x45e301[_0x7ebc('0x12')][_0x7ebc('0xf')]);}})[_0x7ebc('0x13')](function(_0x257ce4){logger[_0x7ebc('0xd')]('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x257ce4);_0x52e971(_0x257ce4);});});} \ No newline at end of file +var _0x4cb4=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Cdr,\x20%s,\x20%s','lodash','util','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x4cb4,0xc3));var _0x44cb=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0x4cb4[_0x477491];return _0xac6aec;};'use strict';var _=require(_0x44cb('0x0'));var util=require(_0x44cb('0x1'));var moment=require(_0x44cb('0x2'));var BPromise=require(_0x44cb('0x3'));var rs=require(_0x44cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44cb('0x5'))['db'];var utils=require(_0x44cb('0x6'));var logger=require(_0x44cb('0x7'))(_0x44cb('0x8'));var config=require(_0x44cb('0x9'));var jayson=require(_0x44cb('0xa'));var client=jayson['client'][_0x44cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x381370,_0x40e01e,_0x132990){return new BPromise(function(_0x223062,_0x4c331d){return client[_0x44cb('0xc')](_0x381370,_0x132990)[_0x44cb('0xd')](function(_0xb30720){logger[_0x44cb('0xe')]('Cdr,\x20%s,\x20%s',_0x40e01e,_0x44cb('0xf'));logger[_0x44cb('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x40e01e,_0x44cb('0xf'),JSON[_0x44cb('0x11')](_0xb30720));if(_0xb30720[_0x44cb('0x12')]){if(_0xb30720['error'][_0x44cb('0x13')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x40e01e,_0xb30720[_0x44cb('0x12')][_0x44cb('0x14')]);return _0x4c331d(_0xb30720[_0x44cb('0x12')][_0x44cb('0x14')]);}logger[_0x44cb('0x12')](_0x44cb('0x15'),_0x40e01e,_0xb30720['error']['message']);return _0x223062(_0xb30720['error'][_0x44cb('0x14')]);}else{logger[_0x44cb('0xe')]('Cdr,\x20%s,\x20%s',_0x40e01e,_0x44cb('0xf'));_0x223062(_0xb30720['result']['message']);}})['catch'](function(_0x3a989c){logger[_0x44cb('0x12')](_0x44cb('0x15'),_0x40e01e,_0x3a989c);_0x4c331d(_0x3a989c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index bf5826e..1387375 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(_0xb03f9,_0x588391){var _0x3ec30a=function(_0x3ef5e7){while(--_0x3ef5e7){_0xb03f9['push'](_0xb03f9['shift']());}};_0x3ec30a(++_0x588391);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a027eea..3ac4cc4 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 _0xfc18=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x479db7,_0x2e5a83){var _0x4a8fad=function(_0x5c4669){while(--_0x5c4669){_0x479db7['push'](_0x479db7['shift']());}};_0x4a8fad(++_0x2e5a83);}(_0xfc18,0xa2));var _0x8fc1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xfc18[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x8fc1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8fc1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fc1('0x2')},'appdata':{'type':Sequelize[_0x8fc1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8fc1('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x805b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xbb5bce,_0x15a8f2){var _0x38fdad=function(_0x44c123){while(--_0x44c123){_0xbb5bce['push'](_0xbb5bce['shift']());}};_0x38fdad(++_0x15a8f2);}(_0x805b,0x159));var _0xb805=function(_0x122592,_0x14c92b){_0x122592=_0x122592-0x0;var _0x2c1c6f=_0x805b[_0x122592];return _0x2c1c6f;};'use strict';var Sequelize=require(_0xb805('0x0'));module[_0xb805('0x1')]={'priority':{'type':Sequelize[_0xb805('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb805('0x3')],'allowNull':![],'defaultValue':_0xb805('0x4')},'appdata':{'type':Sequelize[_0xb805('0x5')]()},'description':{'type':Sequelize[_0xb805('0x3')]},'interval':{'type':Sequelize[_0xb805('0x3')],'defaultValue':_0xb805('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c7cc166..a86dad8 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 _0x0db9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','show','model','keys','rawAttributes','query','intersection','fields','attributes','includeAll','include','merge','options','catch','body','ChatApplication','find','destroy','params','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x0db9,0xa3));var _0x90db=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x0db9[_0x2cc569];return _0x1bfc2e;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8469,_0x3e3fbd){return function(_0x5b3c09){if(!_0x5b3c09){_0x2f8469[_0x90db('0x19')](0x194);}return _0x5b3c09;};}function handleError(_0xe026cf,_0x1cc660){_0x1cc660=_0x1cc660||0x1f4;return function(_0x94cd84){logger['error'](_0x94cd84[_0x90db('0x26')]);if(_0x94cd84[_0x90db('0x27')]){delete _0x94cd84[_0x90db('0x27')];}_0xe026cf[_0x90db('0x1a')](_0x1cc660)[_0x90db('0x28')](_0x94cd84);};}exports[_0x90db('0x29')]=function(_0x44b5b6,_0x3c7f67){var _0x4c6311={'raw':!![],'where':{'id':_0x44b5b6['params']['id']}},_0x3489d1={};_0x3489d1[_0x90db('0x2a')]=_[_0x90db('0x2b')](db['ChatApplication'][_0x90db('0x2c')]);_0x3489d1[_0x90db('0x2d')]=_[_0x90db('0x2b')](_0x44b5b6[_0x90db('0x2d')]);_0x3489d1['filters']=_[_0x90db('0x2e')](_0x3489d1[_0x90db('0x2a')],_0x3489d1[_0x90db('0x2d')]);_0x4c6311['attributes']=_['intersection'](_0x3489d1[_0x90db('0x2a')],qs[_0x90db('0x2f')](_0x44b5b6[_0x90db('0x2d')]['fields']));_0x4c6311[_0x90db('0x30')]=_0x4c6311[_0x90db('0x30')]['length']?_0x4c6311[_0x90db('0x30')]:_0x3489d1[_0x90db('0x2a')];if(_0x44b5b6['query'][_0x90db('0x31')]){_0x4c6311[_0x90db('0x32')]=[{'all':!![]}];}_0x4c6311=_[_0x90db('0x33')]({},_0x4c6311,_0x44b5b6[_0x90db('0x34')]);return db['ChatApplication']['find'](_0x4c6311)[_0x90db('0x25')](handleEntityNotFound(_0x3c7f67,null))['then'](respondWithResult(_0x3c7f67,null))[_0x90db('0x35')](handleError(_0x3c7f67,null));};exports[_0x90db('0x24')]=function(_0x45cebb,_0x540176){if(_0x45cebb[_0x90db('0x36')]['id']){delete _0x45cebb['body']['id'];}return db[_0x90db('0x37')][_0x90db('0x38')]({'where':{'id':_0x45cebb['params']['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x540176,null))[_0x90db('0x25')](saveUpdates(_0x45cebb[_0x90db('0x36')],null))[_0x90db('0x25')](respondWithResult(_0x540176,null))[_0x90db('0x35')](handleError(_0x540176,null));};exports[_0x90db('0x39')]=function(_0x4de656,_0x88789f){return db[_0x90db('0x37')]['find']({'where':{'id':_0x4de656[_0x90db('0x3a')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x88789f,null))[_0x90db('0x25')](removeEntity(_0x88789f,null))['catch'](handleError(_0x88789f,null));}; \ No newline at end of file +var _0x138d=['filters','intersection','model','fields','attributes','length','includeAll','merge','ChatApplication','find','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','then','destroy','error','name','params','keys','rawAttributes','query'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x138d,0x1ab));var _0xd138=function(_0x5a6cef,_0x1697df){_0x5a6cef=_0x5a6cef-0x0;var _0x37f76f=_0x138d[_0x5a6cef];return _0x37f76f;};'use strict';var emlformat=require(_0xd138('0x0'));var rimraf=require(_0xd138('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd138('0x2'));var rp=require(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var BPromise=require(_0xd138('0x5'));var Mustache=require(_0xd138('0x6'));var util=require(_0xd138('0x7'));var path=require('path');var sox=require(_0xd138('0x8'));var csv=require(_0xd138('0x9'));var ejs=require(_0xd138('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd138('0xb'));var squel=require(_0xd138('0xc'));var crypto=require(_0xd138('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd138('0x9'));var querystring=require(_0xd138('0xe'));var Papa=require(_0xd138('0xf'));var Redis=require('ioredis');var authService=require(_0xd138('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd138('0x11'));var logger=require(_0xd138('0x12'))(_0xd138('0x13'));var utils=require(_0xd138('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd138('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429f16,_0x29e963){_0x29e963=_0x29e963||0xcc;return function(_0x11ed68){if(_0x11ed68){return _0x429f16[_0xd138('0x16')](_0x29e963);}return _0x429f16[_0xd138('0x17')](_0x29e963)[_0xd138('0x18')]();};}function respondWithResult(_0x24f99,_0x297102){_0x297102=_0x297102||0xc8;return function(_0x402d2c){if(_0x402d2c){return _0x24f99[_0xd138('0x17')](_0x297102)[_0xd138('0x19')](_0x402d2c);}};}function respondWithFilteredResult(_0x1f4ac1,_0x5cbee9){return function(_0x1526e9){if(_0x1526e9){var _0x3f8932=typeof _0x5cbee9['offset']==='undefined'&&typeof _0x5cbee9['limit']===_0xd138('0x1a');var _0x3a0d9b=_0x1526e9['count'];var _0x43a67d=_0x3f8932?0x0:_0x5cbee9[_0xd138('0x1b')];var _0x421d25=_0x3f8932?_0x1526e9[_0xd138('0x1c')]:_0x5cbee9['offset']+_0x5cbee9[_0xd138('0x1d')];var _0x36f021;if(_0x421d25>=_0x3a0d9b){_0x421d25=_0x3a0d9b;_0x36f021=0xc8;}else{_0x36f021=0xce;}_0x1f4ac1[_0xd138('0x17')](_0x36f021);return _0x1f4ac1[_0xd138('0x1e')](_0xd138('0x1f'),_0x43a67d+'-'+_0x421d25+'/'+_0x3a0d9b)[_0xd138('0x19')](_0x1526e9);}return null;};}function patchUpdates(_0x1755e5){return function(_0x4bd987){try{jsonpatch[_0xd138('0x20')](_0x4bd987,_0x1755e5,!![]);}catch(_0x2a5bfb){return BPromise['reject'](_0x2a5bfb);}return _0x4bd987['save']();};}function saveUpdates(_0x20c57a,_0x5e0f89){return function(_0x5ef010){if(_0x5ef010){return _0x5ef010['update'](_0x20c57a)[_0xd138('0x21')](function(_0x1bc6ef){return _0x1bc6ef;});}return null;};}function removeEntity(_0x2700ae,_0x4569f5){return function(_0x5bd0eb){if(_0x5bd0eb){return _0x5bd0eb[_0xd138('0x22')]()[_0xd138('0x21')](function(){_0x2700ae[_0xd138('0x17')](0xcc)[_0xd138('0x18')]();});}};}function handleEntityNotFound(_0x425cd8,_0x5b11d0){return function(_0x294757){if(!_0x294757){_0x425cd8[_0xd138('0x16')](0x194);}return _0x294757;};}function handleError(_0x136048,_0x413d5c){_0x413d5c=_0x413d5c||0x1f4;return function(_0x1d45b7){logger[_0xd138('0x23')](_0x1d45b7['stack']);if(_0x1d45b7[_0xd138('0x24')]){delete _0x1d45b7['name'];}_0x136048[_0xd138('0x17')](_0x413d5c)['send'](_0x1d45b7);};}exports['show']=function(_0x5df7c1,_0x15c73e){var _0x46acdf={'raw':!![],'where':{'id':_0x5df7c1[_0xd138('0x25')]['id']}},_0x250da9={};_0x250da9['model']=_[_0xd138('0x26')](db['ChatApplication'][_0xd138('0x27')]);_0x250da9[_0xd138('0x28')]=_[_0xd138('0x26')](_0x5df7c1['query']);_0x250da9[_0xd138('0x29')]=_[_0xd138('0x2a')](_0x250da9['model'],_0x250da9[_0xd138('0x28')]);_0x46acdf['attributes']=_[_0xd138('0x2a')](_0x250da9[_0xd138('0x2b')],qs[_0xd138('0x2c')](_0x5df7c1[_0xd138('0x28')][_0xd138('0x2c')]));_0x46acdf[_0xd138('0x2d')]=_0x46acdf['attributes'][_0xd138('0x2e')]?_0x46acdf[_0xd138('0x2d')]:_0x250da9[_0xd138('0x2b')];if(_0x5df7c1['query'][_0xd138('0x2f')]){_0x46acdf['include']=[{'all':!![]}];}_0x46acdf=_[_0xd138('0x30')]({},_0x46acdf,_0x5df7c1['options']);return db[_0xd138('0x31')][_0xd138('0x32')](_0x46acdf)[_0xd138('0x21')](handleEntityNotFound(_0x15c73e,null))['then'](respondWithResult(_0x15c73e,null))[_0xd138('0x33')](handleError(_0x15c73e,null));};exports['update']=function(_0xb4b855,_0x3b00e7){if(_0xb4b855['body']['id']){delete _0xb4b855['body']['id'];}return db[_0xd138('0x31')]['find']({'where':{'id':_0xb4b855[_0xd138('0x25')]['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x3b00e7,null))['then'](saveUpdates(_0xb4b855['body'],null))['then'](respondWithResult(_0x3b00e7,null))['catch'](handleError(_0x3b00e7,null));};exports[_0xd138('0x22')]=function(_0x539778,_0x1a3c43){return db[_0xd138('0x31')][_0xd138('0x32')]({'where':{'id':_0x539778[_0xd138('0x25')]['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x1a3c43,null))[_0xd138('0x21')](removeEntity(_0x1a3c43,null))[_0xd138('0x33')](handleError(_0x1a3c43,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 18a5810..5c5664c 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 _0xe45c=['../../config/environment','exports','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x484e5c,_0x13f5d2){var _0x5d65ef=function(_0x3bde98){while(--_0x3bde98){_0x484e5c['push'](_0x484e5c['shift']());}};_0x5d65ef(++_0x13f5d2);}(_0xe45c,0xae));var _0xce45=function(_0x570886,_0xda87f0){_0x570886=_0x570886-0x0;var _0x1b7471=_0xe45c[_0x570886];return _0x1b7471;};'use strict';var _=require(_0xce45('0x0'));var util=require(_0xce45('0x1'));var logger=require(_0xce45('0x2'))(_0xce45('0x3'));var moment=require('moment');var BPromise=require(_0xce45('0x4'));var rp=require(_0xce45('0x5'));var fs=require('fs');var path=require(_0xce45('0x6'));var rimraf=require(_0xce45('0x7'));var config=require(_0xce45('0x8'));var attributes=require('./chatApplication.attributes');module[_0xce45('0x9')]=function(_0x1007ee,_0x1abde5){return _0x1007ee['define'](_0xce45('0xa'),attributes,{'tableName':_0xce45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce45('0xc')});}; \ No newline at end of file +var _0x2f07=['request-promise','path','./chatApplication.attributes','exports','define','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f07,0xb0));var _0x72f0=function(_0x29e3d5,_0x3bd486){_0x29e3d5=_0x29e3d5-0x0;var _0x5e3590=_0x2f07[_0x29e3d5];return _0x5e3590;};'use strict';var _=require(_0x72f0('0x0'));var util=require(_0x72f0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x72f0('0x2'));var BPromise=require(_0x72f0('0x3'));var rp=require(_0x72f0('0x4'));var fs=require('fs');var path=require(_0x72f0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x72f0('0x6'));module[_0x72f0('0x7')]=function(_0x502702,_0x52237a){return _0x502702[_0x72f0('0x8')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5f00744..1fb1d74 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 _0xe8e0=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0xe8e0,0x138));var _0x0e8e=function(_0x263e15,_0x5d14f8){_0x263e15=_0x263e15-0x0;var _0x2d2dfb=_0xe8e0[_0x263e15];return _0x2d2dfb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0e8e('0x0'));var rs=require(_0x0e8e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e8e('0x2'));var logger=require(_0x0e8e('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e8e('0x4'));var client=jayson[_0x0e8e('0x5')][_0x0e8e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a27a1,_0x18be5a,_0x1190a2){return new BPromise(function(_0x2958e5,_0x322ce8){return client[_0x0e8e('0x7')](_0x5a27a1,_0x1190a2)['then'](function(_0x416b6b){logger[_0x0e8e('0x8')]('ChatApplication,\x20%s,\x20%s',_0x18be5a,'request\x20sent');logger['debug'](_0x0e8e('0x9'),_0x18be5a,_0x0e8e('0xa'),JSON[_0x0e8e('0xb')](_0x416b6b));if(_0x416b6b[_0x0e8e('0xc')]){if(_0x416b6b[_0x0e8e('0xc')][_0x0e8e('0xd')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x18be5a,_0x416b6b[_0x0e8e('0xc')]['message']);return _0x322ce8(_0x416b6b['error']['message']);}logger[_0x0e8e('0xc')](_0x0e8e('0xe'),_0x18be5a,_0x416b6b[_0x0e8e('0xc')]['message']);return _0x2958e5(_0x416b6b[_0x0e8e('0xc')][_0x0e8e('0xf')]);}else{logger[_0x0e8e('0x8')](_0x0e8e('0xe'),_0x18be5a,'request\x20sent');_0x2958e5(_0x416b6b['result']['message']);}})[_0x0e8e('0x10')](function(_0x4826d4){logger[_0x0e8e('0xc')](_0x0e8e('0xe'),_0x18be5a,_0x4826d4);_0x322ce8(_0x4826d4);});});} \ No newline at end of file +var _0x87c3=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x5053d0,_0x49fa5e){var _0x548d6a=function(_0xf9f9a){while(--_0xf9f9a){_0x5053d0['push'](_0x5053d0['shift']());}};_0x548d6a(++_0x49fa5e);}(_0x87c3,0x178));var _0x387c=function(_0x36d7bb,_0xcff402){_0x36d7bb=_0x36d7bb-0x0;var _0x42ed5a=_0x87c3[_0x36d7bb];return _0x42ed5a;};'use strict';var _=require(_0x387c('0x0'));var util=require(_0x387c('0x1'));var moment=require('moment');var BPromise=require(_0x387c('0x2'));var rs=require(_0x387c('0x3'));var fs=require('fs');var Redis=require(_0x387c('0x4'));var db=require(_0x387c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x387c('0x6'))(_0x387c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x387c('0x8')][_0x387c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5063e9,_0x56b47e,_0x3e3d3c){return new BPromise(function(_0x3f41e6,_0x15d9f1){return client[_0x387c('0xa')](_0x5063e9,_0x3e3d3c)[_0x387c('0xb')](function(_0x52e8cb){logger[_0x387c('0xc')](_0x387c('0xd'),_0x56b47e,_0x387c('0xe'));logger[_0x387c('0xf')](_0x387c('0x10'),_0x56b47e,_0x387c('0xe'),JSON[_0x387c('0x11')](_0x52e8cb));if(_0x52e8cb[_0x387c('0x12')]){if(_0x52e8cb['error'][_0x387c('0x13')]===0x1f4){logger[_0x387c('0x12')](_0x387c('0xd'),_0x56b47e,_0x52e8cb[_0x387c('0x12')]['message']);return _0x15d9f1(_0x52e8cb[_0x387c('0x12')]['message']);}logger[_0x387c('0x12')](_0x387c('0xd'),_0x56b47e,_0x52e8cb['error'][_0x387c('0x14')]);return _0x3f41e6(_0x52e8cb[_0x387c('0x12')][_0x387c('0x14')]);}else{logger[_0x387c('0xc')](_0x387c('0xd'),_0x56b47e,_0x387c('0xe'));_0x3f41e6(_0x52e8cb[_0x387c('0x15')]['message']);}})[_0x387c('0x16')](function(_0x29137b){logger[_0x387c('0x12')](_0x387c('0xd'),_0x56b47e,_0x29137b);_0x15d9f1(_0x29137b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5cefd02..3ffeaf1 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 _0x0302=['multer','util','path','connect-timeout','express','Router','fs-extra','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x281e76,_0x8bde50){var _0x5ecce5=function(_0x2382bc){while(--_0x2382bc){_0x281e76['push'](_0x281e76['shift']());}};_0x5ecce5(++_0x8bde50);}(_0x0302,0x1b0));var _0x2030=function(_0x2ee4a5,_0x3f6f7c){_0x2ee4a5=_0x2ee4a5-0x0;var _0x5590c9=_0x0302[_0x2ee4a5];return _0x5590c9;};'use strict';var multer=require(_0x2030('0x0'));var util=require(_0x2030('0x1'));var path=require(_0x2030('0x2'));var timeout=require(_0x2030('0x3'));var express=require(_0x2030('0x4'));var router=express[_0x2030('0x5')]();var fs_extra=require(_0x2030('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2030('0x7'));router['get'](_0x2030('0x8'),auth[_0x2030('0x9')](),controller[_0x2030('0xa')]);router[_0x2030('0xb')]('/:id',auth[_0x2030('0x9')](),controller[_0x2030('0xc')]);router[_0x2030('0xd')](_0x2030('0x8'),auth[_0x2030('0x9')](),controller[_0x2030('0xe')]);module[_0x2030('0xf')]=router; \ No newline at end of file +var _0x8b86=['put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show'];(function(_0x42f692,_0xcc86b5){var _0x1d25e4=function(_0x5eafd9){while(--_0x5eafd9){_0x42f692['push'](_0x42f692['shift']());}};_0x1d25e4(++_0xcc86b5);}(_0x8b86,0xb9));var _0x68b8=function(_0x4bb5de,_0x1806d9){_0x4bb5de=_0x4bb5de-0x0;var _0x5bb0ff=_0x8b86[_0x4bb5de];return _0x5bb0ff;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x68b8('0x0'));var express=require(_0x68b8('0x1'));var router=express[_0x68b8('0x2')]();var fs_extra=require(_0x68b8('0x3'));var auth=require(_0x68b8('0x4'));var interaction=require(_0x68b8('0x5'));var config=require(_0x68b8('0x6'));var controller=require('./chatApplication.controller');router['get'](_0x68b8('0x7'),auth[_0x68b8('0x8')](),controller[_0x68b8('0x9')]);router[_0x68b8('0xa')](_0x68b8('0x7'),auth[_0x68b8('0x8')](),controller[_0x68b8('0xb')]);router[_0x68b8('0xc')]('/:id',auth[_0x68b8('0x8')](),controller[_0x68b8('0xd')]);module[_0x68b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 8a03756..2fee790 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 _0x6636=['BOOLEAN','sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6636,0x119));var _0x6663=function(_0x4320f9,_0x583285){_0x4320f9=_0x4320f9-0x0;var _0x5c71a9=_0x6636[_0x4320f9];return _0x5c71a9;};'use strict';var Sequelize=require(_0x6663('0x0'));module[_0x6663('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6663('0x2')]},'write':{'type':Sequelize[_0x6663('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbc37=['STRING','BOOLEAN','sequelize','exports'];(function(_0x773a33,_0x1d39fb){var _0x13e4dd=function(_0x520e7a){while(--_0x520e7a){_0x773a33['push'](_0x773a33['shift']());}};_0x13e4dd(++_0x1d39fb);}(_0xbc37,0x11a));var _0x7bc3=function(_0x21405d,_0x49392d){_0x21405d=_0x21405d-0x0;var _0x4a7ba6=_0xbc37[_0x21405d];return _0x4a7ba6;};'use strict';var Sequelize=require(_0x7bc3('0x0'));module[_0x7bc3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7bc3('0x2')]},'write':{'type':Sequelize[_0x7bc3('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 15e5a19..92e3575 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 _0x692f=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','user','addMembers','ids','omit','getMembers','findOne','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x445c46,_0x3cebeb){var _0x26bcf4=function(_0x3f7426){while(--_0x3f7426){_0x445c46['push'](_0x445c46['shift']());}};_0x26bcf4(++_0x3cebeb);}(_0x692f,0x184));var _0xf692=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x692f[_0x480fc2];return _0x540a95;};'use strict';var emlformat=require(_0xf692('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf692('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf692('0x2'));var moment=require(_0xf692('0x3'));var BPromise=require(_0xf692('0x4'));var Mustache=require(_0xf692('0x5'));var util=require(_0xf692('0x6'));var path=require(_0xf692('0x7'));var sox=require(_0xf692('0x8'));var csv=require('to-csv');var ejs=require(_0xf692('0x9'));var fs=require('fs');var fs_extra=require(_0xf692('0xa'));var _=require(_0xf692('0xb'));var squel=require(_0xf692('0xc'));var crypto=require(_0xf692('0xd'));var jsforce=require(_0xf692('0xe'));var deskjs=require(_0xf692('0xf'));var toCsv=require(_0xf692('0x10'));var querystring=require(_0xf692('0x11'));var Papa=require(_0xf692('0x12'));var Redis=require(_0xf692('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf692('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf692('0x15'));var logger=require(_0xf692('0x16'))(_0xf692('0x17'));var utils=require(_0xf692('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf692('0x19'))['db'];config[_0xf692('0x1a')]=_[_0xf692('0x1b')](config[_0xf692('0x1a')],{'host':_0xf692('0x1c'),'port':0x18eb});var socket=require(_0xf692('0x1d'))(new Redis(config[_0xf692('0x1a')]));require('./chatGroup.socket')[_0xf692('0x1e')](socket);function respondWithStatusCode(_0x110183,_0x8064e0){_0x8064e0=_0x8064e0||0xcc;return function(_0x401ff2){if(_0x401ff2){return _0x110183[_0xf692('0x1f')](_0x8064e0);}return _0x110183[_0xf692('0x20')](_0x8064e0)[_0xf692('0x21')]();};}function respondWithResult(_0x327be2,_0x50b6ed){_0x50b6ed=_0x50b6ed||0xc8;return function(_0x893de5){if(_0x893de5){return _0x327be2[_0xf692('0x20')](_0x50b6ed)[_0xf692('0x22')](_0x893de5);}};}function respondWithFilteredResult(_0x5c6ca0,_0x1dddde){return function(_0x45b7be){if(_0x45b7be){var _0x302f8e=typeof _0x1dddde[_0xf692('0x23')]==='undefined'&&typeof _0x1dddde[_0xf692('0x24')]===_0xf692('0x25');var _0x4d3159=_0x45b7be['count'];var _0x1914af=_0x302f8e?0x0:_0x1dddde[_0xf692('0x23')];var _0x235694=_0x302f8e?_0x45b7be[_0xf692('0x26')]:_0x1dddde['offset']+_0x1dddde[_0xf692('0x24')];var _0x15df0c;if(_0x235694>=_0x4d3159){_0x235694=_0x4d3159;_0x15df0c=0xc8;}else{_0x15df0c=0xce;}_0x5c6ca0[_0xf692('0x20')](_0x15df0c);return _0x5c6ca0[_0xf692('0x27')](_0xf692('0x28'),_0x1914af+'-'+_0x235694+'/'+_0x4d3159)[_0xf692('0x22')](_0x45b7be);}return null;};}function patchUpdates(_0x4af974){return function(_0x224174){try{jsonpatch[_0xf692('0x29')](_0x224174,_0x4af974,!![]);}catch(_0x1b7bda){return BPromise[_0xf692('0x2a')](_0x1b7bda);}return _0x224174[_0xf692('0x2b')]();};}function saveUpdates(_0x59cb73,_0x5c1cb8){return function(_0x3d9960){if(_0x3d9960){return _0x3d9960[_0xf692('0x2c')](_0x59cb73)[_0xf692('0x2d')](function(_0x13307d){return _0x13307d;});}return null;};}function removeEntity(_0x5707fb,_0x3b66e8){return function(_0x45e754){if(_0x45e754){return _0x45e754[_0xf692('0x2e')]()[_0xf692('0x2d')](function(){_0x5707fb[_0xf692('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f28c0,_0x421d58){return function(_0x4b8076){if(!_0x4b8076){_0x3f28c0['sendStatus'](0x194);}return _0x4b8076;};}function handleError(_0x1845ba,_0x155631){_0x155631=_0x155631||0x1f4;return function(_0x38660c){logger[_0xf692('0x2f')](_0x38660c[_0xf692('0x30')]);if(_0x38660c[_0xf692('0x31')]){delete _0x38660c[_0xf692('0x31')];}_0x1845ba[_0xf692('0x20')](_0x155631)[_0xf692('0x32')](_0x38660c);};}exports[_0xf692('0x33')]=function(_0x2ba01b,_0x11341e){var _0x395502={},_0x2a744f={},_0x55922b={'count':0x0,'rows':[]};var _0x4fa321=_['map'](db[_0xf692('0x34')]['rawAttributes'],function(_0x39c06a){return{'name':_0x39c06a[_0xf692('0x35')],'type':_0x39c06a[_0xf692('0x36')][_0xf692('0x37')]};});_0x2a744f['model']=_[_0xf692('0x38')](_0x4fa321,'name');_0x2a744f[_0xf692('0x39')]=_[_0xf692('0x3a')](_0x2ba01b[_0xf692('0x39')]);_0x2a744f[_0xf692('0x3b')]=_[_0xf692('0x3c')](_0x2a744f[_0xf692('0x3d')],_0x2a744f[_0xf692('0x39')]);_0x395502[_0xf692('0x3e')]=_[_0xf692('0x3c')](_0x2a744f[_0xf692('0x3d')],qs['fields'](_0x2ba01b[_0xf692('0x39')][_0xf692('0x3f')]));_0x395502[_0xf692('0x3e')]=_0x395502[_0xf692('0x3e')][_0xf692('0x40')]?_0x395502[_0xf692('0x3e')]:_0x2a744f[_0xf692('0x3d')];if(!_0x2ba01b['query'][_0xf692('0x41')](_0xf692('0x42'))){_0x395502[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x2ba01b['query'][_0xf692('0x24')]);_0x395502['offset']=qs[_0xf692('0x23')](_0x2ba01b[_0xf692('0x39')]['offset']);}_0x395502[_0xf692('0x43')]=qs[_0xf692('0x44')](_0x2ba01b[_0xf692('0x39')]['sort']);_0x395502['where']=qs[_0xf692('0x3b')](_['pick'](_0x2ba01b[_0xf692('0x39')],_0x2a744f['filters']),_0x4fa321);if(_0x2ba01b[_0xf692('0x39')][_0xf692('0x45')]){_0x395502[_0xf692('0x46')]=_[_0xf692('0x47')](_0x395502[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x4fa321,function(_0x1e795b){if(_0x1e795b[_0xf692('0x36')]!==_0xf692('0x48')){var _0x4f9b65={};_0x4f9b65[_0x1e795b[_0xf692('0x31')]]={'$like':'%'+_0x2ba01b[_0xf692('0x39')][_0xf692('0x45')]+'%'};return _0x4f9b65;}})});}_0x395502=_[_0xf692('0x47')]({},_0x395502,_0x2ba01b[_0xf692('0x49')]);var _0x5cf399={'where':_0x395502[_0xf692('0x46')]};return db['ChatGroup'][_0xf692('0x26')](_0x5cf399)['then'](function(_0x950929){_0x55922b[_0xf692('0x26')]=_0x950929;if(_0x2ba01b[_0xf692('0x39')][_0xf692('0x4a')]){_0x395502[_0xf692('0x4b')]=[{'all':!![]}];}return db[_0xf692('0x34')][_0xf692('0x4c')](_0x395502);})[_0xf692('0x2d')](function(_0x319605){_0x55922b[_0xf692('0x4d')]=_0x319605;return _0x55922b;})[_0xf692('0x2d')](respondWithFilteredResult(_0x11341e,_0x395502))[_0xf692('0x4e')](handleError(_0x11341e,null));};exports[_0xf692('0x4f')]=function(_0xe37e82,_0xe8bcdf){var _0x3b1d93={'raw':!![],'where':{'id':_0xe37e82[_0xf692('0x50')]['id']}},_0x4ac60b={};_0x4ac60b[_0xf692('0x3d')]=_[_0xf692('0x3a')](db[_0xf692('0x34')][_0xf692('0x51')]);_0x4ac60b[_0xf692('0x39')]=_[_0xf692('0x3a')](_0xe37e82['query']);_0x4ac60b[_0xf692('0x3b')]=_[_0xf692('0x3c')](_0x4ac60b['model'],_0x4ac60b[_0xf692('0x39')]);_0x3b1d93[_0xf692('0x3e')]=_[_0xf692('0x3c')](_0x4ac60b[_0xf692('0x3d')],qs['fields'](_0xe37e82['query'][_0xf692('0x3f')]));_0x3b1d93[_0xf692('0x3e')]=_0x3b1d93[_0xf692('0x3e')][_0xf692('0x40')]?_0x3b1d93[_0xf692('0x3e')]:_0x4ac60b['model'];if(_0xe37e82[_0xf692('0x39')][_0xf692('0x4a')]){_0x3b1d93[_0xf692('0x4b')]=[{'all':!![]}];}_0x3b1d93=_[_0xf692('0x47')]({},_0x3b1d93,_0xe37e82[_0xf692('0x49')]);return db['ChatGroup'][_0xf692('0x52')](_0x3b1d93)[_0xf692('0x2d')](handleEntityNotFound(_0xe8bcdf,null))[_0xf692('0x2d')](respondWithResult(_0xe8bcdf,null))[_0xf692('0x4e')](handleError(_0xe8bcdf,null));};exports[_0xf692('0x53')]=function(_0x198f21,_0x135a93){return db[_0xf692('0x34')][_0xf692('0x53')](_0x198f21[_0xf692('0x54')],{})[_0xf692('0x2d')](respondWithResult(_0x135a93,0xc9))[_0xf692('0x4e')](handleError(_0x135a93,null));};exports['update']=function(_0x1a3eb3,_0x432e52){if(_0x1a3eb3[_0xf692('0x54')]['id']){delete _0x1a3eb3[_0xf692('0x54')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1a3eb3['params']['id']}})['then'](handleEntityNotFound(_0x432e52,null))[_0xf692('0x2d')](saveUpdates(_0x1a3eb3['body'],null))['then'](respondWithResult(_0x432e52,null))[_0xf692('0x4e')](handleError(_0x432e52,null));};exports[_0xf692('0x2e')]=function(_0xb0a5c7,_0x597aef){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0xb0a5c7[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x597aef,null))[_0xf692('0x2d')](removeEntity(_0x597aef,null))[_0xf692('0x4e')](handleError(_0x597aef,null));};exports['describe']=function(_0x827a78,_0x45a316){return db['ChatGroup'][_0xf692('0x55')]()['then'](respondWithResult(_0x45a316,null))['catch'](handleError(_0x45a316,null));};exports['getUnread']=function(_0xf98dd9,_0x47962f,_0x5a01c5){return db['ChatInternalMessage'][_0xf692('0x26')]({'where':{'ChatGroupId':_0xf98dd9[_0xf692('0x50')]['id'],'ToId':_0xf98dd9[_0xf692('0x56')]['id'],'read':![]}})[_0xf692('0x2d')](function(_0x1b61b0){return{'id':_['toInteger'](_0xf98dd9[_0xf692('0x50')]['id']),'count':_0x1b61b0};})[_0xf692('0x2d')](respondWithResult(_0x47962f,null))[_0xf692('0x4e')](handleError(_0x47962f,null));};exports[_0xf692('0x57')]=function(_0x414150,_0x29192e,_0xc33cd2){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x414150[_0xf692('0x50')]['id']}})['then'](handleEntityNotFound(_0x29192e,null))[_0xf692('0x2d')](function(_0x122eb2){if(_0x122eb2){return _0x122eb2[_0xf692('0x57')](_0x414150[_0xf692('0x54')][_0xf692('0x58')],_[_0xf692('0x59')](_0x414150[_0xf692('0x54')],[_0xf692('0x58'),'id'])||{});}})[_0xf692('0x2d')](respondWithResult(_0x29192e,null))['catch'](handleError(_0x29192e,null));};exports[_0xf692('0x5a')]=function(_0x4112b7,_0x342852,_0x3a5e02){var _0x46749f={};var _0x51d7f6={};var _0x49123d;var _0x773874;return db[_0xf692('0x34')][_0xf692('0x5b')]({'where':{'id':_0x4112b7[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x342852,null))[_0xf692('0x2d')](function(_0x11e17f){if(_0x11e17f){_0x49123d=_0x11e17f;_0x51d7f6[_0xf692('0x3d')]=_[_0xf692('0x3a')](db['User'][_0xf692('0x51')]);_0x51d7f6[_0xf692('0x39')]=_[_0xf692('0x3a')](_0x4112b7[_0xf692('0x39')]);_0x51d7f6[_0xf692('0x3b')]=_['intersection'](_0x51d7f6['model'],_0x51d7f6[_0xf692('0x39')]);_0x46749f[_0xf692('0x3e')]=_['intersection'](_0x51d7f6[_0xf692('0x3d')],qs[_0xf692('0x3f')](_0x4112b7[_0xf692('0x39')]['fields']));_0x46749f[_0xf692('0x3e')]=_0x46749f['attributes'][_0xf692('0x40')]?_0x46749f['attributes']:_0x51d7f6['model'];_0x46749f[_0xf692('0x43')]=qs['sort'](_0x4112b7[_0xf692('0x39')][_0xf692('0x44')]);_0x46749f[_0xf692('0x46')]=qs[_0xf692('0x3b')](_[_0xf692('0x5c')](_0x4112b7[_0xf692('0x39')],_0x51d7f6[_0xf692('0x3b')]));if(_0x4112b7[_0xf692('0x39')][_0xf692('0x45')]){_0x46749f[_0xf692('0x46')]=_[_0xf692('0x47')](_0x46749f[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x46749f['attributes'],function(_0x329e65){var _0x4af8be={};_0x4af8be[_0x329e65]={'$like':'%'+_0x4112b7[_0xf692('0x39')]['filter']+'%'};return _0x4af8be;})});}_0x46749f=_[_0xf692('0x47')]({},_0x46749f,_0x4112b7['options']);return _0x49123d[_0xf692('0x5a')](_0x46749f);}})[_0xf692('0x2d')](function(_0x405c11){if(_0x405c11){_0x773874=_0x405c11['length'];if(!_0x4112b7[_0xf692('0x39')][_0xf692('0x41')](_0xf692('0x42'))){_0x46749f[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x4112b7[_0xf692('0x39')][_0xf692('0x24')]);_0x46749f[_0xf692('0x23')]=qs['offset'](_0x4112b7[_0xf692('0x39')]['offset']);}return _0x49123d[_0xf692('0x5a')](_0x46749f);}})[_0xf692('0x2d')](function(_0x4eb826){if(_0x4eb826){return _0x4eb826?{'count':_0x773874,'rows':_0x4eb826}:null;}})[_0xf692('0x2d')](respondWithResult(_0x342852,null))[_0xf692('0x4e')](handleError(_0x342852,null));};exports[_0xf692('0x5d')]=function(_0x9c7a85,_0x378bc7,_0x1aefda){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x9c7a85['params']['id']}})['then'](handleEntityNotFound(_0x378bc7,null))[_0xf692('0x2d')](function(_0x307b93){if(_0x307b93){return _0x307b93[_0xf692('0x5d')](_0x9c7a85[_0xf692('0x39')][_0xf692('0x58')]);}})['then'](respondWithStatusCode(_0x378bc7,null))['catch'](handleError(_0x378bc7,null));};exports[_0xf692('0x5e')]=function(_0x4e5e8e,_0x1f0843,_0x4301fe){if(_0x4e5e8e[_0xf692('0x54')]['id']){delete _0x4e5e8e[_0xf692('0x54')]['id'];}return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x4e5e8e[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x1f0843,null))[_0xf692('0x2d')](function(_0x21d0af){if(_0x21d0af){_0x4e5e8e[_0xf692('0x54')][_0xf692('0x5f')]=_0x21d0af['id'];return db[_0xf692('0x60')]['create'](_0x4e5e8e[_0xf692('0x54')]);}})[_0xf692('0x2d')](respondWithResult(_0x1f0843,null))['catch'](handleError(_0x1f0843,null));};exports[_0xf692('0x61')]=function(_0x30fa08,_0x2c5e04,_0x51cf04){var _0x246cae={};var _0x1c1a43={};var _0x526ca9;var _0x2faf30;return db[_0xf692('0x34')][_0xf692('0x5b')]({'where':{'id':_0x30fa08[_0xf692('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c5e04,null))[_0xf692('0x2d')](function(_0x2eb70d){if(_0x2eb70d){_0x526ca9=_0x2eb70d;_0x1c1a43[_0xf692('0x3d')]=_[_0xf692('0x3a')](db[_0xf692('0x60')]['rawAttributes']);_0x1c1a43[_0xf692('0x39')]=_['keys'](_0x30fa08[_0xf692('0x39')]);_0x1c1a43['filters']=_[_0xf692('0x3c')](_0x1c1a43[_0xf692('0x3d')],_0x1c1a43['query']);_0x246cae[_0xf692('0x3e')]=_['intersection'](_0x1c1a43['model'],qs[_0xf692('0x3f')](_0x30fa08[_0xf692('0x39')][_0xf692('0x3f')]));_0x246cae[_0xf692('0x3e')]=_0x246cae['attributes'][_0xf692('0x40')]?_0x246cae[_0xf692('0x3e')]:_0x1c1a43[_0xf692('0x3d')];_0x246cae[_0xf692('0x43')]=qs['sort'](_0x30fa08[_0xf692('0x39')][_0xf692('0x44')]);_0x246cae[_0xf692('0x46')]=qs[_0xf692('0x3b')](_['pick'](_0x30fa08[_0xf692('0x39')],_0x1c1a43[_0xf692('0x3b')]));if(_0x30fa08[_0xf692('0x39')][_0xf692('0x45')]){_0x246cae['where']=_[_0xf692('0x47')](_0x246cae[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x246cae[_0xf692('0x3e')],function(_0x588ca6){var _0x3cc206={};_0x3cc206[_0x588ca6]={'$like':'%'+_0x30fa08[_0xf692('0x39')]['filter']+'%'};return _0x3cc206;})});}if(_0x30fa08[_0xf692('0x39')][_0xf692('0x62')]){var _0xeae014=_0x30fa08[_0xf692('0x39')]['$gte']['split'](',');var _0x5485d1={};_0x5485d1[_0xeae014[0x0]]={'$gte':moment(_0xeae014[0x1])['format'](_0xf692('0x63'))};_0x246cae['where']=_[_0xf692('0x47')](_0x246cae['where'],_0x5485d1);}_0x246cae=_['merge']({},_0x246cae,_0x30fa08[_0xf692('0x49')]);return _0x526ca9[_0xf692('0x61')](_0x246cae);}})['then'](function(_0x5aed88){if(_0x5aed88){_0x2faf30=_0x5aed88['length'];if(!_0x30fa08[_0xf692('0x39')]['hasOwnProperty']('nolimit')){_0x246cae[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x30fa08[_0xf692('0x39')]['limit']);_0x246cae[_0xf692('0x23')]=qs[_0xf692('0x23')](_0x30fa08[_0xf692('0x39')][_0xf692('0x23')]);}return _0x526ca9[_0xf692('0x61')](_0x246cae);}})['then'](function(_0x2a0854){if(_0x2a0854){return _0x2a0854?{'count':_0x2faf30,'rows':_0x2a0854}:null;}})[_0xf692('0x2d')](respondWithResult(_0x2c5e04,null))[_0xf692('0x4e')](handleError(_0x2c5e04,null));}; \ No newline at end of file +var _0x6ba9=['$gte','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','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','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','options','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','ChatInternalMessage'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6ba9,0x126));var _0x96ba=function(_0x315dd7,_0x5da2e8){_0x315dd7=_0x315dd7-0x0;var _0x1e7dd5=_0x6ba9[_0x315dd7];return _0x1e7dd5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x96ba('0x0'));var jsonpatch=require(_0x96ba('0x1'));var rp=require('request-promise');var moment=require(_0x96ba('0x2'));var BPromise=require(_0x96ba('0x3'));var Mustache=require(_0x96ba('0x4'));var util=require('util');var path=require('path');var sox=require(_0x96ba('0x5'));var csv=require(_0x96ba('0x6'));var ejs=require(_0x96ba('0x7'));var fs=require('fs');var fs_extra=require(_0x96ba('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x96ba('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x96ba('0xa'));var toCsv=require(_0x96ba('0x6'));var querystring=require(_0x96ba('0xb'));var Papa=require(_0x96ba('0xc'));var Redis=require(_0x96ba('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x96ba('0xe'));var as=require(_0x96ba('0xf'));var hardwareService=require(_0x96ba('0x10'));var logger=require(_0x96ba('0x11'))(_0x96ba('0x12'));var utils=require(_0x96ba('0x13'));var config=require(_0x96ba('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x96ba('0x15'))['db'];config[_0x96ba('0x16')]=_[_0x96ba('0x17')](config[_0x96ba('0x16')],{'host':_0x96ba('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96ba('0x16')]));require(_0x96ba('0x19'))[_0x96ba('0x1a')](socket);function respondWithStatusCode(_0x2750d3,_0x3d817b){_0x3d817b=_0x3d817b||0xcc;return function(_0x39d667){if(_0x39d667){return _0x2750d3[_0x96ba('0x1b')](_0x3d817b);}return _0x2750d3[_0x96ba('0x1c')](_0x3d817b)[_0x96ba('0x1d')]();};}function respondWithResult(_0x3a29b8,_0x58a7de){_0x58a7de=_0x58a7de||0xc8;return function(_0x3074ac){if(_0x3074ac){return _0x3a29b8['status'](_0x58a7de)[_0x96ba('0x1e')](_0x3074ac);}};}function respondWithFilteredResult(_0x72ce71,_0x1dec2f){return function(_0x1e5cbf){if(_0x1e5cbf){var _0x46bda1=typeof _0x1dec2f[_0x96ba('0x1f')]===_0x96ba('0x20')&&typeof _0x1dec2f[_0x96ba('0x21')]==='undefined';var _0x4e3c09=_0x1e5cbf[_0x96ba('0x22')];var _0x5de5ff=_0x46bda1?0x0:_0x1dec2f[_0x96ba('0x1f')];var _0x52b055=_0x46bda1?_0x1e5cbf[_0x96ba('0x22')]:_0x1dec2f[_0x96ba('0x1f')]+_0x1dec2f['limit'];var _0x445980;if(_0x52b055>=_0x4e3c09){_0x52b055=_0x4e3c09;_0x445980=0xc8;}else{_0x445980=0xce;}_0x72ce71[_0x96ba('0x1c')](_0x445980);return _0x72ce71[_0x96ba('0x23')](_0x96ba('0x24'),_0x5de5ff+'-'+_0x52b055+'/'+_0x4e3c09)['json'](_0x1e5cbf);}return null;};}function patchUpdates(_0x5e9a9a){return function(_0x3665ef){try{jsonpatch[_0x96ba('0x25')](_0x3665ef,_0x5e9a9a,!![]);}catch(_0x5349c9){return BPromise[_0x96ba('0x26')](_0x5349c9);}return _0x3665ef[_0x96ba('0x27')]();};}function saveUpdates(_0x31fb19,_0x1be60f){return function(_0x425b86){if(_0x425b86){return _0x425b86[_0x96ba('0x28')](_0x31fb19)[_0x96ba('0x29')](function(_0x13d7ee){return _0x13d7ee;});}return null;};}function removeEntity(_0x306821,_0x347889){return function(_0x4d3e7d){if(_0x4d3e7d){return _0x4d3e7d[_0x96ba('0x2a')]()[_0x96ba('0x29')](function(){_0x306821['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f5a7,_0x4ec50c){return function(_0x5a97ae){if(!_0x5a97ae){_0x37f5a7['sendStatus'](0x194);}return _0x5a97ae;};}function handleError(_0x25a97d,_0x33ad3f){_0x33ad3f=_0x33ad3f||0x1f4;return function(_0x299cd4){logger[_0x96ba('0x2b')](_0x299cd4[_0x96ba('0x2c')]);if(_0x299cd4[_0x96ba('0x2d')]){delete _0x299cd4[_0x96ba('0x2d')];}_0x25a97d[_0x96ba('0x1c')](_0x33ad3f)['send'](_0x299cd4);};}exports[_0x96ba('0x2e')]=function(_0x493c6f,_0x101637){var _0x1bcf4b={},_0x4411cf={},_0x488d57={'count':0x0,'rows':[]};var _0x3c57db=_[_0x96ba('0x2f')](db[_0x96ba('0x30')][_0x96ba('0x31')],function(_0x1b6148){return{'name':_0x1b6148[_0x96ba('0x32')],'type':_0x1b6148[_0x96ba('0x33')][_0x96ba('0x34')]};});_0x4411cf[_0x96ba('0x35')]=_[_0x96ba('0x2f')](_0x3c57db,_0x96ba('0x2d'));_0x4411cf[_0x96ba('0x36')]=_[_0x96ba('0x37')](_0x493c6f[_0x96ba('0x36')]);_0x4411cf[_0x96ba('0x38')]=_['intersection'](_0x4411cf[_0x96ba('0x35')],_0x4411cf[_0x96ba('0x36')]);_0x1bcf4b['attributes']=_[_0x96ba('0x39')](_0x4411cf['model'],qs[_0x96ba('0x3a')](_0x493c6f['query']['fields']));_0x1bcf4b[_0x96ba('0x3b')]=_0x1bcf4b[_0x96ba('0x3b')]['length']?_0x1bcf4b['attributes']:_0x4411cf[_0x96ba('0x35')];if(!_0x493c6f['query'][_0x96ba('0x3c')](_0x96ba('0x3d'))){_0x1bcf4b[_0x96ba('0x21')]=qs[_0x96ba('0x21')](_0x493c6f[_0x96ba('0x36')][_0x96ba('0x21')]);_0x1bcf4b[_0x96ba('0x1f')]=qs['offset'](_0x493c6f[_0x96ba('0x36')]['offset']);}_0x1bcf4b[_0x96ba('0x3e')]=qs[_0x96ba('0x3f')](_0x493c6f[_0x96ba('0x36')][_0x96ba('0x3f')]);_0x1bcf4b[_0x96ba('0x40')]=qs[_0x96ba('0x38')](_[_0x96ba('0x41')](_0x493c6f[_0x96ba('0x36')],_0x4411cf[_0x96ba('0x38')]),_0x3c57db);if(_0x493c6f['query'][_0x96ba('0x42')]){_0x1bcf4b['where']=_[_0x96ba('0x43')](_0x1bcf4b[_0x96ba('0x40')],{'$or':_[_0x96ba('0x2f')](_0x3c57db,function(_0x18ee88){if(_0x18ee88['type']!==_0x96ba('0x44')){var _0x539b2b={};_0x539b2b[_0x18ee88[_0x96ba('0x2d')]]={'$like':'%'+_0x493c6f[_0x96ba('0x36')][_0x96ba('0x42')]+'%'};return _0x539b2b;}})});}_0x1bcf4b=_['merge']({},_0x1bcf4b,_0x493c6f['options']);var _0x4e75a5={'where':_0x1bcf4b[_0x96ba('0x40')]};return db[_0x96ba('0x30')]['count'](_0x4e75a5)[_0x96ba('0x29')](function(_0xef889c){_0x488d57[_0x96ba('0x22')]=_0xef889c;if(_0x493c6f['query'][_0x96ba('0x45')]){_0x1bcf4b[_0x96ba('0x46')]=[{'all':!![]}];}return db[_0x96ba('0x30')][_0x96ba('0x47')](_0x1bcf4b);})['then'](function(_0xa4f8e3){_0x488d57['rows']=_0xa4f8e3;return _0x488d57;})[_0x96ba('0x29')](respondWithFilteredResult(_0x101637,_0x1bcf4b))[_0x96ba('0x48')](handleError(_0x101637,null));};exports[_0x96ba('0x49')]=function(_0x29dad9,_0x3b1295){var _0x9f738a={'raw':!![],'where':{'id':_0x29dad9[_0x96ba('0x4a')]['id']}},_0x370ba9={};_0x370ba9['model']=_['keys'](db['ChatGroup'][_0x96ba('0x31')]);_0x370ba9[_0x96ba('0x36')]=_[_0x96ba('0x37')](_0x29dad9[_0x96ba('0x36')]);_0x370ba9[_0x96ba('0x38')]=_[_0x96ba('0x39')](_0x370ba9['model'],_0x370ba9[_0x96ba('0x36')]);_0x9f738a[_0x96ba('0x3b')]=_[_0x96ba('0x39')](_0x370ba9[_0x96ba('0x35')],qs[_0x96ba('0x3a')](_0x29dad9[_0x96ba('0x36')][_0x96ba('0x3a')]));_0x9f738a['attributes']=_0x9f738a[_0x96ba('0x3b')][_0x96ba('0x4b')]?_0x9f738a['attributes']:_0x370ba9[_0x96ba('0x35')];if(_0x29dad9['query'][_0x96ba('0x45')]){_0x9f738a[_0x96ba('0x46')]=[{'all':!![]}];}_0x9f738a=_[_0x96ba('0x43')]({},_0x9f738a,_0x29dad9[_0x96ba('0x4c')]);return db[_0x96ba('0x30')][_0x96ba('0x4d')](_0x9f738a)[_0x96ba('0x29')](handleEntityNotFound(_0x3b1295,null))[_0x96ba('0x29')](respondWithResult(_0x3b1295,null))[_0x96ba('0x48')](handleError(_0x3b1295,null));};exports[_0x96ba('0x4e')]=function(_0x401c00,_0x1886f1){return db[_0x96ba('0x30')]['create'](_0x401c00[_0x96ba('0x4f')],{})[_0x96ba('0x29')](respondWithResult(_0x1886f1,0xc9))['catch'](handleError(_0x1886f1,null));};exports[_0x96ba('0x28')]=function(_0x5f5ac2,_0x1b87b7){if(_0x5f5ac2['body']['id']){delete _0x5f5ac2[_0x96ba('0x4f')]['id'];}return db['ChatGroup'][_0x96ba('0x4d')]({'where':{'id':_0x5f5ac2[_0x96ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b87b7,null))['then'](saveUpdates(_0x5f5ac2[_0x96ba('0x4f')],null))['then'](respondWithResult(_0x1b87b7,null))[_0x96ba('0x48')](handleError(_0x1b87b7,null));};exports[_0x96ba('0x2a')]=function(_0x24cc30,_0x1c718b){return db[_0x96ba('0x30')]['find']({'where':{'id':_0x24cc30['params']['id']}})[_0x96ba('0x29')](handleEntityNotFound(_0x1c718b,null))[_0x96ba('0x29')](removeEntity(_0x1c718b,null))[_0x96ba('0x48')](handleError(_0x1c718b,null));};exports[_0x96ba('0x50')]=function(_0x508bde,_0xe4c8c5){return db[_0x96ba('0x30')][_0x96ba('0x50')]()[_0x96ba('0x29')](respondWithResult(_0xe4c8c5,null))[_0x96ba('0x48')](handleError(_0xe4c8c5,null));};exports[_0x96ba('0x51')]=function(_0x399349,_0x2221c9,_0x29b9a7){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x399349['params']['id'],'ToId':_0x399349[_0x96ba('0x52')]['id'],'read':![]}})[_0x96ba('0x29')](function(_0x2207ff){return{'id':_[_0x96ba('0x53')](_0x399349[_0x96ba('0x4a')]['id']),'count':_0x2207ff};})[_0x96ba('0x29')](respondWithResult(_0x2221c9,null))[_0x96ba('0x48')](handleError(_0x2221c9,null));};exports['addMembers']=function(_0x32d63d,_0x589153,_0x2837de){return db['ChatGroup'][_0x96ba('0x4d')]({'where':{'id':_0x32d63d[_0x96ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x589153,null))[_0x96ba('0x29')](function(_0x476b2d){if(_0x476b2d){return _0x476b2d[_0x96ba('0x54')](_0x32d63d[_0x96ba('0x4f')][_0x96ba('0x55')],_['omit'](_0x32d63d[_0x96ba('0x4f')],['ids','id'])||{});}})[_0x96ba('0x29')](respondWithResult(_0x589153,null))[_0x96ba('0x48')](handleError(_0x589153,null));};exports[_0x96ba('0x56')]=function(_0x160cc5,_0x19552e,_0x4d44b6){var _0x93bbf7={};var _0x46b57b={};var _0xdab875;var _0x186812;return db[_0x96ba('0x30')][_0x96ba('0x57')]({'where':{'id':_0x160cc5[_0x96ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x19552e,null))[_0x96ba('0x29')](function(_0x2826af){if(_0x2826af){_0xdab875=_0x2826af;_0x46b57b['model']=_[_0x96ba('0x37')](db[_0x96ba('0x58')][_0x96ba('0x31')]);_0x46b57b['query']=_['keys'](_0x160cc5[_0x96ba('0x36')]);_0x46b57b[_0x96ba('0x38')]=_[_0x96ba('0x39')](_0x46b57b['model'],_0x46b57b['query']);_0x93bbf7[_0x96ba('0x3b')]=_['intersection'](_0x46b57b['model'],qs['fields'](_0x160cc5[_0x96ba('0x36')][_0x96ba('0x3a')]));_0x93bbf7[_0x96ba('0x3b')]=_0x93bbf7[_0x96ba('0x3b')][_0x96ba('0x4b')]?_0x93bbf7[_0x96ba('0x3b')]:_0x46b57b[_0x96ba('0x35')];_0x93bbf7[_0x96ba('0x3e')]=qs[_0x96ba('0x3f')](_0x160cc5['query'][_0x96ba('0x3f')]);_0x93bbf7['where']=qs[_0x96ba('0x38')](_[_0x96ba('0x41')](_0x160cc5[_0x96ba('0x36')],_0x46b57b['filters']));if(_0x160cc5[_0x96ba('0x36')]['filter']){_0x93bbf7[_0x96ba('0x40')]=_['merge'](_0x93bbf7['where'],{'$or':_['map'](_0x93bbf7['attributes'],function(_0x1f9f85){var _0x37109a={};_0x37109a[_0x1f9f85]={'$like':'%'+_0x160cc5[_0x96ba('0x36')][_0x96ba('0x42')]+'%'};return _0x37109a;})});}_0x93bbf7=_[_0x96ba('0x43')]({},_0x93bbf7,_0x160cc5[_0x96ba('0x4c')]);return _0xdab875[_0x96ba('0x56')](_0x93bbf7);}})['then'](function(_0xc010fc){if(_0xc010fc){_0x186812=_0xc010fc[_0x96ba('0x4b')];if(!_0x160cc5[_0x96ba('0x36')][_0x96ba('0x3c')](_0x96ba('0x3d'))){_0x93bbf7[_0x96ba('0x21')]=qs[_0x96ba('0x21')](_0x160cc5[_0x96ba('0x36')][_0x96ba('0x21')]);_0x93bbf7['offset']=qs['offset'](_0x160cc5[_0x96ba('0x36')][_0x96ba('0x1f')]);}return _0xdab875[_0x96ba('0x56')](_0x93bbf7);}})[_0x96ba('0x29')](function(_0x3d410a){if(_0x3d410a){return _0x3d410a?{'count':_0x186812,'rows':_0x3d410a}:null;}})['then'](respondWithResult(_0x19552e,null))[_0x96ba('0x48')](handleError(_0x19552e,null));};exports['removeMembers']=function(_0xfa599f,_0x113926,_0x44c697){return db[_0x96ba('0x30')][_0x96ba('0x4d')]({'where':{'id':_0xfa599f[_0x96ba('0x4a')]['id']}})[_0x96ba('0x29')](handleEntityNotFound(_0x113926,null))['then'](function(_0x594804){if(_0x594804){return _0x594804[_0x96ba('0x59')](_0xfa599f[_0x96ba('0x36')]['ids']);}})[_0x96ba('0x29')](respondWithStatusCode(_0x113926,null))[_0x96ba('0x48')](handleError(_0x113926,null));};exports[_0x96ba('0x5a')]=function(_0x14f06d,_0x3f834d,_0x579a9e){if(_0x14f06d[_0x96ba('0x4f')]['id']){delete _0x14f06d[_0x96ba('0x4f')]['id'];}return db[_0x96ba('0x30')][_0x96ba('0x4d')]({'where':{'id':_0x14f06d[_0x96ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f834d,null))[_0x96ba('0x29')](function(_0x156ca6){if(_0x156ca6){_0x14f06d[_0x96ba('0x4f')][_0x96ba('0x5b')]=_0x156ca6['id'];return db['ChatInternalMessage'][_0x96ba('0x4e')](_0x14f06d[_0x96ba('0x4f')]);}})[_0x96ba('0x29')](respondWithResult(_0x3f834d,null))[_0x96ba('0x48')](handleError(_0x3f834d,null));};exports[_0x96ba('0x5c')]=function(_0x127dac,_0x5cfbe0,_0x1652c){var _0x19f865={};var _0xf1fca6={};var _0x554329;var _0x4015bc;return db[_0x96ba('0x30')][_0x96ba('0x57')]({'where':{'id':_0x127dac[_0x96ba('0x4a')]['id']}})[_0x96ba('0x29')](handleEntityNotFound(_0x5cfbe0,null))[_0x96ba('0x29')](function(_0x2bd898){if(_0x2bd898){_0x554329=_0x2bd898;_0xf1fca6[_0x96ba('0x35')]=_['keys'](db[_0x96ba('0x5d')][_0x96ba('0x31')]);_0xf1fca6[_0x96ba('0x36')]=_[_0x96ba('0x37')](_0x127dac[_0x96ba('0x36')]);_0xf1fca6[_0x96ba('0x38')]=_[_0x96ba('0x39')](_0xf1fca6[_0x96ba('0x35')],_0xf1fca6['query']);_0x19f865[_0x96ba('0x3b')]=_[_0x96ba('0x39')](_0xf1fca6['model'],qs[_0x96ba('0x3a')](_0x127dac['query'][_0x96ba('0x3a')]));_0x19f865[_0x96ba('0x3b')]=_0x19f865[_0x96ba('0x3b')][_0x96ba('0x4b')]?_0x19f865[_0x96ba('0x3b')]:_0xf1fca6[_0x96ba('0x35')];_0x19f865[_0x96ba('0x3e')]=qs[_0x96ba('0x3f')](_0x127dac[_0x96ba('0x36')][_0x96ba('0x3f')]);_0x19f865[_0x96ba('0x40')]=qs['filters'](_[_0x96ba('0x41')](_0x127dac[_0x96ba('0x36')],_0xf1fca6[_0x96ba('0x38')]));if(_0x127dac[_0x96ba('0x36')][_0x96ba('0x42')]){_0x19f865['where']=_['merge'](_0x19f865[_0x96ba('0x40')],{'$or':_[_0x96ba('0x2f')](_0x19f865['attributes'],function(_0x514960){var _0x2c71c6={};_0x2c71c6[_0x514960]={'$like':'%'+_0x127dac[_0x96ba('0x36')]['filter']+'%'};return _0x2c71c6;})});}if(_0x127dac['query'][_0x96ba('0x5e')]){var _0x59e0a5=_0x127dac['query'][_0x96ba('0x5e')]['split'](',');var _0x3238ca={};_0x3238ca[_0x59e0a5[0x0]]={'$gte':moment(_0x59e0a5[0x1])[_0x96ba('0x5f')](_0x96ba('0x60'))};_0x19f865[_0x96ba('0x40')]=_[_0x96ba('0x43')](_0x19f865[_0x96ba('0x40')],_0x3238ca);}_0x19f865=_[_0x96ba('0x43')]({},_0x19f865,_0x127dac[_0x96ba('0x4c')]);return _0x554329[_0x96ba('0x5c')](_0x19f865);}})[_0x96ba('0x29')](function(_0xc9b6f9){if(_0xc9b6f9){_0x4015bc=_0xc9b6f9[_0x96ba('0x4b')];if(!_0x127dac[_0x96ba('0x36')][_0x96ba('0x3c')](_0x96ba('0x3d'))){_0x19f865['limit']=qs[_0x96ba('0x21')](_0x127dac[_0x96ba('0x36')][_0x96ba('0x21')]);_0x19f865[_0x96ba('0x1f')]=qs[_0x96ba('0x1f')](_0x127dac[_0x96ba('0x36')][_0x96ba('0x1f')]);}return _0x554329[_0x96ba('0x5c')](_0x19f865);}})['then'](function(_0xb5a234){if(_0xb5a234){return _0xb5a234?{'count':_0x4015bc,'rows':_0xb5a234}:null;}})['then'](respondWithResult(_0x5cfbe0,null))['catch'](handleError(_0x5cfbe0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fe93928..7017e37 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 _0x71af=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x71af,0x194));var _0xf71a=function(_0xb0adba,_0x4399a9){_0xb0adba=_0xb0adba-0x0;var _0x2da679=_0x71af[_0xb0adba];return _0x2da679;};'use strict';var EventEmitter=require(_0xf71a('0x0'));var ChatGroup=require(_0xf71a('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf71a('0x2')](0x0);var events={'afterCreate':_0xf71a('0x3'),'afterUpdate':_0xf71a('0x4'),'afterDestroy':_0xf71a('0x5')};function emitEvent(_0x2158ea){return function(_0xee5102,_0x4863d6,_0x580200){ChatGroupEvents[_0xf71a('0x6')](_0x2158ea+':'+_0xee5102['id'],_0xee5102);ChatGroupEvents[_0xf71a('0x6')](_0x2158ea,_0xee5102);_0x580200(null);};}for(var e in events){if(events[_0xf71a('0x7')](e)){var event=events[e];ChatGroup[_0xf71a('0x8')](e,emitEvent(event));}}module[_0xf71a('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xb5bf=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit'];(function(_0x3f6b12,_0x50f264){var _0x37e441=function(_0x4f352a){while(--_0x4f352a){_0x3f6b12['push'](_0x3f6b12['shift']());}};_0x37e441(++_0x50f264);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb5bf[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xfb5b('0x0'));var ChatGroup=require(_0xfb5b('0x1'))['db'][_0xfb5b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb5b('0x3'),'afterUpdate':'update','afterDestroy':_0xfb5b('0x4')};function emitEvent(_0x315c48){return function(_0x2e8dd6,_0x72f94d,_0x23dfaf){ChatGroupEvents[_0xfb5b('0x5')](_0x315c48+':'+_0x2e8dd6['id'],_0x2e8dd6);ChatGroupEvents['emit'](_0x315c48,_0x2e8dd6);_0x23dfaf(null);};}for(var e in events){if(events[_0xfb5b('0x6')](e)){var event=events[e];ChatGroup[_0xfb5b('0x7')](e,emitEvent(event));}}module[_0xfb5b('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index e90ccd6..80e03ab 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 _0xb834=['ChatGroup','chat_groups','../../config/logger','api','moment','path','rimraf','./chatGroup.attributes','exports'];(function(_0x3c17fb,_0x5f20ff){var _0x38e1f6=function(_0x1464ca){while(--_0x1464ca){_0x3c17fb['push'](_0x3c17fb['shift']());}};_0x38e1f6(++_0x5f20ff);}(_0xb834,0xda));var _0x4b83=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0xb834[_0x573c9e];return _0x5d0714;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b83('0x0'))(_0x4b83('0x1'));var moment=require(_0x4b83('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b83('0x3'));var rimraf=require(_0x4b83('0x4'));var config=require('../../config/environment');var attributes=require(_0x4b83('0x5'));module[_0x4b83('0x6')]=function(_0xc4495f,_0x5b3170){return _0xc4495f['define'](_0x4b83('0x7'),attributes,{'tableName':_0x4b83('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa37=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38a28c,_0x49f522){var _0x544ae1=function(_0x289048){while(--_0x289048){_0x38a28c['push'](_0x38a28c['shift']());}};_0x544ae1(++_0x49f522);}(_0xfa37,0x93));var _0x7fa3=function(_0x4e0d9f,_0x43912a){_0x4e0d9f=_0x4e0d9f-0x0;var _0x341952=_0xfa37[_0x4e0d9f];return _0x341952;};'use strict';var _=require(_0x7fa3('0x0'));var util=require(_0x7fa3('0x1'));var logger=require(_0x7fa3('0x2'))(_0x7fa3('0x3'));var moment=require(_0x7fa3('0x4'));var BPromise=require(_0x7fa3('0x5'));var rp=require(_0x7fa3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fa3('0x7'));var config=require(_0x7fa3('0x8'));var attributes=require('./chatGroup.attributes');module[_0x7fa3('0x9')]=function(_0x37f6a8,_0x582e67){return _0x37f6a8[_0x7fa3('0xa')](_0x7fa3('0xb'),attributes,{'tableName':_0x7fa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index d985860..c63189c 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 _0xe009=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','request\x20sent','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x233331,_0x177c38){var _0x3dff68=function(_0x6b3de9){while(--_0x6b3de9){_0x233331['push'](_0x233331['shift']());}};_0x3dff68(++_0x177c38);}(_0xe009,0x122));var _0x9e00=function(_0x2ae91b,_0x16b0f2){_0x2ae91b=_0x2ae91b-0x0;var _0x350099=_0xe009[_0x2ae91b];return _0x350099;};'use strict';var _=require(_0x9e00('0x0'));var util=require(_0x9e00('0x1'));var moment=require(_0x9e00('0x2'));var BPromise=require(_0x9e00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e00('0x5'));var logger=require(_0x9e00('0x6'))(_0x9e00('0x7'));var config=require(_0x9e00('0x8'));var jayson=require(_0x9e00('0x9'));var client=jayson[_0x9e00('0xa')][_0x9e00('0xb')]({'port':0x232a});config[_0x9e00('0xc')]=_[_0x9e00('0xd')](config[_0x9e00('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e00('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x9e00('0xf')](socket);function respondWithRpcPromise(_0x9d62ed,_0x9aa2b6,_0x278208){return new BPromise(function(_0x4a73fc,_0x1fcd0c){return client[_0x9e00('0x10')](_0x9d62ed,_0x278208)[_0x9e00('0x11')](function(_0x484db6){logger[_0x9e00('0x12')]('ChatGroup,\x20%s,\x20%s',_0x9aa2b6,'request\x20sent');logger[_0x9e00('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x9aa2b6,_0x9e00('0x14'),JSON[_0x9e00('0x15')](_0x484db6));if(_0x484db6[_0x9e00('0x16')]){if(_0x484db6[_0x9e00('0x16')][_0x9e00('0x17')]===0x1f4){logger[_0x9e00('0x16')]('ChatGroup,\x20%s,\x20%s',_0x9aa2b6,_0x484db6['error'][_0x9e00('0x18')]);return _0x1fcd0c(_0x484db6['error'][_0x9e00('0x18')]);}logger[_0x9e00('0x16')](_0x9e00('0x19'),_0x9aa2b6,_0x484db6[_0x9e00('0x16')]['message']);return _0x4a73fc(_0x484db6['error']['message']);}else{logger['info'](_0x9e00('0x19'),_0x9aa2b6,'request\x20sent');_0x4a73fc(_0x484db6[_0x9e00('0x1a')][_0x9e00('0x18')]);}})['catch'](function(_0x3113bd){logger[_0x9e00('0x16')](_0x9e00('0x19'),_0x9aa2b6,_0x3113bd);_0x1fcd0c(_0x3113bd);});});} \ No newline at end of file +var _0xa8eb=['jayson/promise','http','defaults','redis','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1f8e6e,_0x3c1296){var _0x4d2d6d=function(_0x9b53d3){while(--_0x9b53d3){_0x1f8e6e['push'](_0x1f8e6e['shift']());}};_0x4d2d6d(++_0x3c1296);}(_0xa8eb,0x179));var _0xba8e=function(_0x17f3ac,_0x167137){_0x17f3ac=_0x17f3ac-0x0;var _0x4ab47e=_0xa8eb[_0x17f3ac];return _0x4ab47e;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var moment=require(_0xba8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xba8e('0x2'));var fs=require('fs');var Redis=require(_0xba8e('0x3'));var db=require(_0xba8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba8e('0x5'))(_0xba8e('0x6'));var config=require('../../config/environment');var jayson=require(_0xba8e('0x7'));var client=jayson['client'][_0xba8e('0x8')]({'port':0x232a});config['redis']=_[_0xba8e('0x9')](config[_0xba8e('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba8e('0xa')]));require(_0xba8e('0xb'))[_0xba8e('0xc')](socket);function respondWithRpcPromise(_0x876db9,_0x441bc3,_0x4c93d9){return new BPromise(function(_0x374d03,_0x2fb45c){return client[_0xba8e('0xd')](_0x876db9,_0x4c93d9)['then'](function(_0x1ee232){logger[_0xba8e('0xe')](_0xba8e('0xf'),_0x441bc3,_0xba8e('0x10'));logger[_0xba8e('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x441bc3,'request\x20sent',JSON[_0xba8e('0x12')](_0x1ee232));if(_0x1ee232[_0xba8e('0x13')]){if(_0x1ee232[_0xba8e('0x13')][_0xba8e('0x14')]===0x1f4){logger[_0xba8e('0x13')](_0xba8e('0xf'),_0x441bc3,_0x1ee232[_0xba8e('0x13')][_0xba8e('0x15')]);return _0x2fb45c(_0x1ee232[_0xba8e('0x13')][_0xba8e('0x15')]);}logger[_0xba8e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x441bc3,_0x1ee232[_0xba8e('0x13')]['message']);return _0x374d03(_0x1ee232[_0xba8e('0x13')][_0xba8e('0x15')]);}else{logger[_0xba8e('0xe')]('ChatGroup,\x20%s,\x20%s',_0x441bc3,_0xba8e('0x10'));_0x374d03(_0x1ee232[_0xba8e('0x16')][_0xba8e('0x15')]);}})[_0xba8e('0x17')](function(_0x1d98c9){logger[_0xba8e('0x13')](_0xba8e('0xf'),_0x441bc3,_0x1d98c9);_0x2fb45c(_0x1d98c9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d55d504..7b7a540 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 _0x683a=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x44379c,_0x63c052){var _0x2254a9=function(_0x5df134){while(--_0x5df134){_0x44379c['push'](_0x44379c['shift']());}};_0x2254a9(++_0x63c052);}(_0x683a,0x189));var _0xa683=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x683a[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0xa683('0x0'));var events=[_0xa683('0x1'),_0xa683('0x2'),_0xa683('0x3')];function createListener(_0x123040,_0x55d636){return function(_0x508d77){_0x55d636[_0xa683('0x4')](_0x123040,_0x508d77);};}function removeListener(_0x57f35a,_0x41af92){return function(){ChatGroupEvents[_0xa683('0x5')](_0x57f35a,_0x41af92);};}exports[_0xa683('0x6')]=function(_0x1dd7ca){for(var _0x1ba059=0x0,_0x45d4e4=events[_0xa683('0x7')];_0x1ba059<_0x45d4e4;_0x1ba059++){var _0x2cb23b=events[_0x1ba059];var _0x1e34c9=createListener(_0xa683('0x8')+_0x2cb23b,_0x1dd7ca);ChatGroupEvents['on'](_0x2cb23b,_0x1e34c9);}}; \ No newline at end of file +var _0xab46=['register','chatGroup:','remove','update'];(function(_0x5f2fea,_0x9fde07){var _0x198a0c=function(_0x2bb11a){while(--_0x2bb11a){_0x5f2fea['push'](_0x5f2fea['shift']());}};_0x198a0c(++_0x9fde07);}(_0xab46,0xfa));var _0x6ab4=function(_0x3f553b,_0x49a9c2){_0x3f553b=_0x3f553b-0x0;var _0x183c4e=_0xab46[_0x3f553b];return _0x183c4e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x6ab4('0x0'),_0x6ab4('0x1')];function createListener(_0xd97eef,_0x2a076e){return function(_0xdaf976){_0x2a076e['emit'](_0xd97eef,_0xdaf976);};}function removeListener(_0x26fa35,_0x40ea2a){return function(){ChatGroupEvents['removeListener'](_0x26fa35,_0x40ea2a);};}exports[_0x6ab4('0x2')]=function(_0x302aef){for(var _0x5a6acc=0x0,_0x5bdcfe=events['length'];_0x5a6acc<_0x5bdcfe;_0x5a6acc++){var _0xcd83c1=events[_0x5a6acc];var _0x1e5a12=createListener(_0x6ab4('0x3')+_0xcd83c1,_0x302aef);ChatGroupEvents['on'](_0xcd83c1,_0x1e5a12);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c264832..fa8b78d 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 _0x6c2e=['addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create'];(function(_0x57a776,_0x260c94){var _0x195520=function(_0x4e4ac3){while(--_0x4e4ac3){_0x57a776['push'](_0x57a776['shift']());}};_0x195520(++_0x260c94);}(_0x6c2e,0xf8));var _0xe6c2=function(_0x33e665,_0x6cbf9e){_0x33e665=_0x33e665-0x0;var _0x5ad37c=_0x6c2e[_0x33e665];return _0x5ad37c;};'use strict';var multer=require(_0xe6c2('0x0'));var util=require(_0xe6c2('0x1'));var path=require('path');var timeout=require(_0xe6c2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe6c2('0x3'));var auth=require(_0xe6c2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6c2('0x5'));var controller=require(_0xe6c2('0x6'));router[_0xe6c2('0x7')]('/',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x9')]);router[_0xe6c2('0x7')](_0xe6c2('0xa'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0xb')]);router[_0xe6c2('0x7')](_0xe6c2('0xc'),auth['isAuthenticated'](),controller[_0xe6c2('0xd')]);router[_0xe6c2('0x7')](_0xe6c2('0xe'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0xf')]);router[_0xe6c2('0x7')](_0xe6c2('0x10'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x11')]);router['get'](_0xe6c2('0x12'),auth['isAuthenticated'](),controller[_0xe6c2('0x13')]);router[_0xe6c2('0x14')]('/',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x15')]);router[_0xe6c2('0x14')](_0xe6c2('0x10'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x16')]);router[_0xe6c2('0x14')](_0xe6c2('0x12'),auth['isAuthenticated'](),controller[_0xe6c2('0x17')]);router[_0xe6c2('0x18')](_0xe6c2('0xc'),auth['isAuthenticated'](),controller[_0xe6c2('0x19')]);router[_0xe6c2('0x1a')]('/:id',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x1b')]);router[_0xe6c2('0x1a')]('/:id/members',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x1c')]);module[_0xe6c2('0x1d')]=router; \ No newline at end of file +var _0x54d6=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','put','update','delete','/:id','destroy','removeMembers','exports','multer','util'];(function(_0x55b745,_0x36e0fa){var _0x1772a7=function(_0x2bf1e3){while(--_0x2bf1e3){_0x55b745['push'](_0x55b745['shift']());}};_0x1772a7(++_0x36e0fa);}(_0x54d6,0x1b1));var _0x654d=function(_0x3eca38,_0x29419d){_0x3eca38=_0x3eca38-0x0;var _0x22a03f=_0x54d6[_0x3eca38];return _0x22a03f;};'use strict';var multer=require(_0x654d('0x0'));var util=require(_0x654d('0x1'));var path=require(_0x654d('0x2'));var timeout=require(_0x654d('0x3'));var express=require('express');var router=express[_0x654d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x654d('0x5'));var config=require(_0x654d('0x6'));var controller=require('./chatGroup.controller');router[_0x654d('0x7')]('/',auth[_0x654d('0x8')](),controller[_0x654d('0x9')]);router[_0x654d('0x7')](_0x654d('0xa'),auth[_0x654d('0x8')](),controller[_0x654d('0xb')]);router[_0x654d('0x7')]('/:id',auth[_0x654d('0x8')](),controller[_0x654d('0xc')]);router[_0x654d('0x7')](_0x654d('0xd'),auth[_0x654d('0x8')](),controller[_0x654d('0xe')]);router['get'](_0x654d('0xf'),auth['isAuthenticated'](),controller[_0x654d('0x10')]);router['get']('/:id/messages',auth[_0x654d('0x8')](),controller[_0x654d('0x11')]);router[_0x654d('0x12')]('/',auth[_0x654d('0x8')](),controller[_0x654d('0x13')]);router[_0x654d('0x12')](_0x654d('0xf'),auth[_0x654d('0x8')](),controller[_0x654d('0x14')]);router['post']('/:id/messages',auth[_0x654d('0x8')](),controller[_0x654d('0x15')]);router[_0x654d('0x16')]('/:id',auth[_0x654d('0x8')](),controller[_0x654d('0x17')]);router[_0x654d('0x18')](_0x654d('0x19'),auth[_0x654d('0x8')](),controller[_0x654d('0x1a')]);router[_0x654d('0x18')](_0x654d('0xf'),auth[_0x654d('0x8')](),controller[_0x654d('0x1b')]);module[_0x654d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 42bfc97..908a81c 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 _0xf760=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0x27da43,_0x12984a){var _0x357d34=function(_0x5e3145){while(--_0x5e3145){_0x27da43['push'](_0x27da43['shift']());}};_0x357d34(++_0x12984a);}(_0xf760,0x1b6));var _0x0f76=function(_0x5335f8,_0x53fdf8){_0x5335f8=_0x5335f8-0x0;var _0x335558=_0xf760[_0x5335f8];return _0x335558;};'use strict';var Sequelize=require(_0x0f76('0x0'));module[_0x0f76('0x1')]={'closed':{'type':Sequelize[_0x0f76('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0f76('0x3')]},'ratingType':{'type':Sequelize[_0x0f76('0x4')](_0x0f76('0x5'),_0x0f76('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x0f76('0x7')]},'pathTranscript':{'type':Sequelize[_0x0f76('0x7')]},'mailTranscript':{'type':Sequelize[_0x0f76('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0f76('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0f76('0x8')]},'thirdDisposition':{'type':Sequelize[_0x0f76('0x8')]},'note':{'type':Sequelize[_0x0f76('0x8')]},'browserName':{'type':Sequelize[_0x0f76('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0f76('0x8')]},'osVersion':{'type':Sequelize[_0x0f76('0x8')]},'deviceModel':{'type':Sequelize[_0x0f76('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0f76('0x7')]},'customerIp':{'type':Sequelize[_0x0f76('0x8')]},'formData':{'type':Sequelize[_0x0f76('0x7')](_0x0f76('0xa'))},'read1stAt':{'type':Sequelize[_0x0f76('0x9')]},'lastMsgAt':{'type':Sequelize[_0x0f76('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x0f76('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0f76('0x8')]},'customerPort':{'type':Sequelize[_0x0f76('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x0f76('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x0f76('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9702=['out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','long','DATE'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9702,0x1c4));var _0x2970=function(_0x4fe5e4,_0xa61696){_0x4fe5e4=_0x4fe5e4-0x0;var _0x527332=_0x9702[_0x4fe5e4];return _0x527332;};'use strict';var Sequelize=require(_0x2970('0x0'));module[_0x2970('0x1')]={'closed':{'type':Sequelize[_0x2970('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2970('0x3')]},'ratingType':{'type':Sequelize[_0x2970('0x4')](_0x2970('0x5'),'thumb'),'defaultValue':_0x2970('0x5')},'ratingMessage':{'type':Sequelize[_0x2970('0x6')]},'pathTranscript':{'type':Sequelize[_0x2970('0x6')]},'mailTranscript':{'type':Sequelize[_0x2970('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2970('0x7')]},'secondDisposition':{'type':Sequelize[_0x2970('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2970('0x7')]},'note':{'type':Sequelize[_0x2970('0x7')]},'browserName':{'type':Sequelize[_0x2970('0x7')]},'browserVersion':{'type':Sequelize[_0x2970('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2970('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x2970('0x7')]},'referer':{'type':Sequelize[_0x2970('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2970('0x6')](_0x2970('0x8'))},'read1stAt':{'type':Sequelize[_0x2970('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2970('0x4')]('in',_0x2970('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2970('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x2970('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2970('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index dd5074d..1324e2d 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 _0x9a2e=['Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','User','ChatWebsite','ContactId','length','Messages','UserId','%s%d','agentAlias','customer','format','agentIdentifier','agent_alias','alias','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','includeAgent','push','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','secret','Account','get','mkdirSync','Chat','Owner','closedAt','osName','customerIp','customerPort','tail','filter','existsSync','createReadStream','createWriteStream','lastName','basename','read','value','downloadInteraction.ejs','transcript-','err','zip-dir','request-promise','bluebird','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','name','send','render','body','agent','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','model','keys','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','update','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','file','originalname','filename','mimetype'];(function(_0x705836,_0x391b3a){var _0x15be6b=function(_0x1b08a7){while(--_0x1b08a7){_0x705836['push'](_0x705836['shift']());}};_0x15be6b(++_0x391b3a);}(_0x9a2e,0x12a));var _0xe9a2=function(_0x27976d,_0x1cc15f){_0x27976d=_0x27976d-0x0;var _0x5d3357=_0x9a2e[_0x27976d];return _0x5d3357;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe9a2('0x0'));var rp=require(_0xe9a2('0x1'));var moment=require('moment');var BPromise=require(_0xe9a2('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9a2('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9a2('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xe9a2('0x5'));var pdf=require(_0xe9a2('0x6'));var logger=require(_0xe9a2('0x7'))(_0xe9a2('0x8'));var config=require(_0xe9a2('0x9'));var db=require(_0xe9a2('0xa'))['db'];config[_0xe9a2('0xb')]=_[_0xe9a2('0xc')](config[_0xe9a2('0xb')],{'host':_0xe9a2('0xd'),'port':0x18eb});var socket=require(_0xe9a2('0xe'))(new Redis(config[_0xe9a2('0xb')]));require(_0xe9a2('0xf'))[_0xe9a2('0x10')](socket);var jayson=require(_0xe9a2('0x11'));var client=jayson[_0xe9a2('0x12')]['http']({'port':0x232b});var client9004=jayson[_0xe9a2('0x12')][_0xe9a2('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x2a09ba,_0x1750f5,_0x42cd88,_0x4b466b){return new BPromise(function(_0x4ce3d2,_0xce919c){var _0x49e2ce=_0x4b466b||client;return _0x49e2ce[_0xe9a2('0x14')](_0x2a09ba,_0x42cd88)[_0xe9a2('0x15')](function(_0x42b2e0){logger[_0xe9a2('0x16')](_0xe9a2('0x17'),_0x1750f5,_0xe9a2('0x18'));logger[_0xe9a2('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1750f5,'request\x20sent',JSON['stringify'](_0x42b2e0));if(_0x42b2e0['error']){if(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1b')]===0x1f4){logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);return _0xce919c(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);}logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);return _0x4ce3d2(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);}else{logger[_0xe9a2('0x16')](_0xe9a2('0x17'),_0x1750f5,_0xe9a2('0x18'));_0x4ce3d2(_0x42b2e0[_0xe9a2('0x1d')]['message']);}})[_0xe9a2('0x1e')](function(_0x2fed32){logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x2fed32);_0xce919c(_0x2fed32);});});}function respondWithStatusCode(_0x11ea3c,_0x135031){_0x135031=_0x135031||0xcc;return function(_0x4e31a6){if(_0x4e31a6){return _0x11ea3c[_0xe9a2('0x1f')](_0x135031);}return _0x11ea3c[_0xe9a2('0x20')](_0x135031)[_0xe9a2('0x21')]();};}function respondWithResult(_0x216f7e,_0xaae22){_0xaae22=_0xaae22||0xc8;return function(_0x10c466){if(_0x10c466){return _0x216f7e['status'](_0xaae22)[_0xe9a2('0x22')](_0x10c466);}};}function respondWithFilteredResult(_0x282b73,_0x5b30d1){return function(_0x4bd54d){if(_0x4bd54d){var _0x23e3c7=typeof _0x5b30d1[_0xe9a2('0x23')]===_0xe9a2('0x24')&&typeof _0x5b30d1[_0xe9a2('0x25')]===_0xe9a2('0x24');var _0x497e6f=_0x4bd54d['count'];var _0x3d5cbd=_0x23e3c7?0x0:_0x5b30d1[_0xe9a2('0x23')];var _0x51e516=_0x23e3c7?_0x4bd54d[_0xe9a2('0x26')]:_0x5b30d1[_0xe9a2('0x23')]+_0x5b30d1[_0xe9a2('0x25')];var _0x39fc87;if(_0x51e516>=_0x497e6f){_0x51e516=_0x497e6f;_0x39fc87=0xc8;}else{_0x39fc87=0xce;}_0x282b73[_0xe9a2('0x20')](_0x39fc87);return _0x282b73[_0xe9a2('0x27')](_0xe9a2('0x28'),_0x3d5cbd+'-'+_0x51e516+'/'+_0x497e6f)[_0xe9a2('0x22')](_0x4bd54d);}return null;};}function saveUpdates(_0x24a424){return function(_0x17c9f3){if(_0x17c9f3){return _0x17c9f3['update'](_0x24a424)[_0xe9a2('0x15')](function(_0x3a1903){return _0x3a1903;});}return null;};}function removeEntity(_0x15213f){return function(_0x419fc9){if(_0x419fc9){return _0x419fc9[_0xe9a2('0x29')]()[_0xe9a2('0x15')](function(){_0x15213f[_0xe9a2('0x20')](0xcc)[_0xe9a2('0x21')]();});}};}function handleEntityNotFound(_0x18ea0a){return function(_0x3ff333){if(!_0x3ff333){_0x18ea0a['sendStatus'](0x194);}return _0x3ff333;};}function handleError(_0x22dbdb,_0x8e2add){_0x8e2add=_0x8e2add||0x1f4;return function(_0x499e86){logger[_0xe9a2('0x1a')](_0x499e86['stack']);if(_0x499e86[_0xe9a2('0x2a')]){delete _0x499e86['name'];}_0x22dbdb['status'](_0x8e2add)[_0xe9a2('0x2b')](_0x499e86);};}function getMustacheRender(_0x10f16f,_0x459df8){return Mustache[_0xe9a2('0x2c')](_0x10f16f,_['merge'](_0x459df8[_0xe9a2('0x2d')],{'contact':_0x459df8['contact'],'message':_0x459df8[_0xe9a2('0x1c')],'agent':_0x459df8[_0xe9a2('0x2e')],'interaction':_0x459df8['interaction'],'account':_0x459df8[_0xe9a2('0x2f')]}))||'';}exports[_0xe9a2('0x30')]=function(_0x135b90,_0x31b203){var _0x445d4c={};var _0x38254a=_[_0xe9a2('0x31')](db[_0xe9a2('0x32')][_0xe9a2('0x33')],function(_0x40785c){return{'name':_0x40785c[_0xe9a2('0x34')],'type':_0x40785c[_0xe9a2('0x35')][_0xe9a2('0x36')]};});_0x445d4c=qs[_0xe9a2('0x37')](_0x38254a,_0x135b90);return interaction[_0xe9a2('0x38')](_0xe9a2('0x39'),_0x135b90['query'],_0x135b90[_0xe9a2('0x3a')],_0x445d4c,_0x38254a)['then'](respondWithFilteredResult(_0x31b203,_0x445d4c))['catch'](handleError(_0x31b203,null));};exports[_0xe9a2('0x3b')]=function(_0x33247b,_0x45240f){var _0x44f4af={'raw':![],'where':{'id':_0x33247b['params']['id']}},_0x1ab33c={};_0x1ab33c[_0xe9a2('0x3c')]=_[_0xe9a2('0x3d')](db[_0xe9a2('0x32')][_0xe9a2('0x33')]);_0x1ab33c[_0xe9a2('0x3e')]=_[_0xe9a2('0x3d')](_0x33247b[_0xe9a2('0x3e')]);_0x1ab33c[_0xe9a2('0x3f')]=_['intersection'](_0x1ab33c[_0xe9a2('0x3c')],_0x1ab33c[_0xe9a2('0x3e')]);_0x44f4af['attributes']=_[_0xe9a2('0x40')](_0x1ab33c[_0xe9a2('0x3c')],qs[_0xe9a2('0x41')](_0x33247b[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x44f4af[_0xe9a2('0x42')]=_0x44f4af['attributes']['length']?_0x44f4af[_0xe9a2('0x42')]:_0x1ab33c[_0xe9a2('0x3c')];if(_0x33247b[_0xe9a2('0x3e')][_0xe9a2('0x43')]){_0x44f4af[_0xe9a2('0x44')]=[{'all':!![]}];}_0x44f4af=_[_0xe9a2('0x45')]({},_0x44f4af,_0x33247b[_0xe9a2('0x46')]);return db[_0xe9a2('0x32')][_0xe9a2('0x47')](_0x44f4af)[_0xe9a2('0x15')](handleEntityNotFound(_0x45240f,null))[_0xe9a2('0x15')](respondWithResult(_0x45240f,null))[_0xe9a2('0x1e')](handleError(_0x45240f,null));};exports['create']=function(_0x259343,_0x59a11e){return db[_0xe9a2('0x32')]['create'](_0x259343[_0xe9a2('0x2d')],{})[_0xe9a2('0x15')](respondWithResult(_0x59a11e,0xc9))[_0xe9a2('0x1e')](handleError(_0x59a11e,null));};exports[_0xe9a2('0x48')]=function(_0xda6ad1,_0x4682ed){if(_0xda6ad1['body']['id']){delete _0xda6ad1[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0xda6ad1['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x4682ed,null))['then'](saveUpdates(_0xda6ad1[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](respondWithResult(_0x4682ed,null))[_0xe9a2('0x1e')](handleError(_0x4682ed,null));};exports[_0xe9a2('0x29')]=function(_0x1ef7a7,_0x5853bc){return db[_0xe9a2('0x32')]['find']({'where':{'id':_0x1ef7a7[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x5853bc,null))[_0xe9a2('0x15')](removeEntity(_0x5853bc,null))[_0xe9a2('0x1e')](handleError(_0x5853bc,null));};exports[_0xe9a2('0x4a')]=function(_0x4c968c,_0x4db074){return db[_0xe9a2('0x32')][_0xe9a2('0x4a')]()[_0xe9a2('0x15')](respondWithResult(_0x4db074,null))['catch'](handleError(_0x4db074,null));};exports[_0xe9a2('0x4b')]=function(_0x27ec84,_0x4c68f4){var _0x5216ca=_0x27ec84[_0xe9a2('0x49')]['id'];var _0x552712;var _0x3cad60;var _0x1722ea;return db['ChatInteraction'][_0xe9a2('0x4c')]({'where':{'id':_0x5216ca}})[_0xe9a2('0x15')](function(_0x146377){_0x552712=_0x146377;return db['ChatWebsite'][_0xe9a2('0x4c')]({'where':{'id':_0x146377['ChatWebsiteId']},'attributes':['id',_0xe9a2('0x4d'),_0xe9a2('0x4e'),'vidaooTopic',_0xe9a2('0x4f'),_0xe9a2('0x50')],'raw':!![]});})[_0xe9a2('0x15')](function(_0x2fd406){if(_0x2fd406&&_0x2fd406[_0xe9a2('0x4d')]&&_0x2fd406[_0xe9a2('0x4e')]){_0x3cad60=_0x2fd406;var _0x4ebaa9={'interaction':{'id':_0x5216ca},'agent':{'id':_0x27ec84['user']['id'],'name':_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x2a')],'fullname':_0x27ec84['user'][_0xe9a2('0x51')],'email':_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x52')]},'contact':_0x27ec84[_0xe9a2('0x2d')][_0xe9a2('0x53')],'account':_0x27ec84['body'][_0xe9a2('0x2f')]};var _0x1d76aa={'rejectUnauthorized':![],'method':_0xe9a2('0x54'),'url':_0xe9a2('0x55'),'headers':{'X-APIKEY':_0x2fd406[_0xe9a2('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x52')]],'buttons':null,'topic':_0x3cad60[_0xe9a2('0x56')],'note':_[_0xe9a2('0x57')](_0x3cad60[_0xe9a2('0x4f')])?null:getMustacheRender(_0x3cad60[_0xe9a2('0x4f')],_0x4ebaa9),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3cad60['vidaooMetadata'])){var _0x2698df=getMustacheRender(_0x3cad60['vidaooMetadata'],_0x4ebaa9);var _0x20a657=JSON[_0xe9a2('0x58')](_0x2698df);_0x1d76aa[_0xe9a2('0x2d')][_0xe9a2('0x59')]=_0x20a657;}}catch(_0x4cca42){throw new db[(_0xe9a2('0x5a'))][(_0xe9a2('0x5b'))](_0xe9a2('0x5c'));}return rp(_0x1d76aa);}else{throw new db[(_0xe9a2('0x5a'))][(_0xe9a2('0x5b'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe9a2('0x15')](function(_0x31e1d8){_0x1722ea=_0x31e1d8;if(_0x1722ea['id']){var _0x379d7f={'body':_0x1722ea[_0xe9a2('0x5d')],'ChatWebsiteId':_0x3cad60['id'],'ChatInteractionId':_0x552712['id'],'direction':_0xe9a2('0x5e'),'UserId':_0x27ec84[_0xe9a2('0x3a')]['id']};return db[_0xe9a2('0x5f')][_0xe9a2('0x60')](_0x379d7f,{});}else{throw new db['Sequelize'][(_0xe9a2('0x5b'))](_0xe9a2('0x61'));}})[_0xe9a2('0x15')](function(){return _0x552712[_0xe9a2('0x62')]({'vidaooSessionId':_0x1722ea['id']});})[_0xe9a2('0x15')](respondWithResult(_0x4c68f4,null))[_0xe9a2('0x1e')](handleError(_0x4c68f4,null));};exports['customUpdate']=function(_0x4301e3,_0x527671){if(_0x4301e3[_0xe9a2('0x2d')]['id']){delete _0x4301e3[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')]['find']({'where':{'id':_0x4301e3[_0xe9a2('0x49')]['id']},'include':[{'model':db[_0xe9a2('0x63')],'as':_0xe9a2('0x64')}]})[_0xe9a2('0x15')](handleEntityNotFound(_0x527671,null))[_0xe9a2('0x15')](saveUpdates(_0x4301e3[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](respondWithResult(_0x527671,null))[_0xe9a2('0x1e')](handleError(_0x527671,null));};exports[_0xe9a2('0x65')]=function(_0x374ef5,_0x376a63){if(_0x374ef5[_0xe9a2('0x2d')]['id']){delete _0x374ef5[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x374ef5[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](function(_0x575cc6){if(!_0x575cc6){logger['error'](_0xe9a2('0x66'),_0xe9a2('0x65'),0x194,_0xe9a2('0x67'));_0x376a63[_0xe9a2('0x1f')](0x194);}else{if(_0x575cc6['UserId']){throw new db['Sequelize'][(_0xe9a2('0x5b'))]('Interaction\x20already\x20assigned');}}return _0x575cc6;})['then'](function(_0x3448f9){if(_0x3448f9){return _0x3448f9[_0xe9a2('0x48')]({'closed':_0x374ef5[_0xe9a2('0x2d')][_0xe9a2('0x68')],'disposition':_0x374ef5['body'][_0xe9a2('0x69')]})[_0xe9a2('0x15')](function(_0x372d3c){return _0x372d3c;});}})[_0xe9a2('0x15')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x374ef5[_0xe9a2('0x2d')],client9004);})[_0xe9a2('0x15')](respondWithResult(_0x376a63,null))[_0xe9a2('0x1e')](handleError(_0x376a63,null));};exports['attachmentUpload']=function(_0x523e57,_0xe0649d){_0x523e57[_0xe9a2('0x2d')][_0xe9a2('0x2a')]=_0x523e57[_0xe9a2('0x6a')][_0xe9a2('0x6b')];_0x523e57[_0xe9a2('0x2d')]['basename']=_0x523e57[_0xe9a2('0x6a')][_0xe9a2('0x6c')];_0x523e57[_0xe9a2('0x2d')]['type']=_0x523e57['file'][_0xe9a2('0x6d')];return db[_0xe9a2('0x6e')]['create'](_0x523e57[_0xe9a2('0x2d')])[_0xe9a2('0x15')](respondWithResult(_0xe0649d,0xc9))[_0xe9a2('0x1e')](handleError(_0xe0649d,null));};exports[_0xe9a2('0x6f')]=function(_0x4152a7,_0x4a806b){return db[_0xe9a2('0x32')][_0xe9a2('0x4c')]({'where':{'id':_0x4152a7[_0xe9a2('0x49')]['id']},'raw':!![]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4a806b,null))[_0xe9a2('0x15')](function(_0x2a2658){if(_0x2a2658){if(_0x2a2658['closed']){return _0x4a806b[_0xe9a2('0x20')](0x193)[_0xe9a2('0x22')]({'status':0x193,'message':_0xe9a2('0x70')});}return db[_0xe9a2('0x6e')][_0xe9a2('0x4c')]({'where':{'id':_0x4152a7[_0xe9a2('0x3e')][_0xe9a2('0x71')]},'raw':!![]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4a806b,null));}})[_0xe9a2('0x15')](function(_0x3e9109){if(_0x3e9109){var _0x3da02e=_0x3e9109[_0xe9a2('0x72')]!==null;var _0x3467fd=path['join'](config[_0xe9a2('0x73')],'server/files/attachments/');if(_0x3da02e){_0x3467fd=path[_0xe9a2('0x74')](_0x3467fd,_0xe9a2('0x75'));}var _0x1f833a=path[_0xe9a2('0x74')](_0x3467fd,_0x3e9109['basename']);return _0x4a806b[_0xe9a2('0x76')](_0x1f833a);}})[_0xe9a2('0x1e')](handleError(_0x4a806b,null));};exports[_0xe9a2('0x77')]=function(_0x414d43,_0x4f34ac){var _0x47ed8b=null;var _0x55c2d5=null;var _0x4fe647=null;if(_0x414d43['body']['id']){delete _0x414d43[_0xe9a2('0x2d')]['id'];}if(_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x78')]){_0x4fe647=path['join'](config[_0xe9a2('0x73')],_0xe9a2('0x79'),util['format'](_0xe9a2('0x7a'),Date['now']()));_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x7b')]=_0x4fe647;}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x414d43[_0xe9a2('0x49')]['id']},'include':[{'model':db[_0xe9a2('0x5f')],'as':'Messages','include':[{'model':db[_0xe9a2('0x7c')],'as':_0xe9a2('0x7c')}]}]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4f34ac,null))[_0xe9a2('0x15')](saveUpdates(_0x414d43[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](function(_0x5a1a10){if(_0x5a1a10){_0x47ed8b=_0x5a1a10;return db[_0xe9a2('0x7d')]['find']({'where':{'id':_0x47ed8b['ChatWebsiteId']}});}})[_0xe9a2('0x15')](function(_0x43e907){if(_0x43e907){_0x55c2d5=_0x43e907;return db[_0xe9a2('0x63')][_0xe9a2('0x47')]({'where':{'id':_0x47ed8b[_0xe9a2('0x7e')]}});}})['then'](function(_0x44c63a){if(_0x44c63a){if(_0x4fe647){var _0x53dec0=null;for(var _0x1e9d57=0x1;_0x1e9d57<_0x47ed8b['Messages'][_0xe9a2('0x7f')];++_0x1e9d57){_0x53dec0=_0x47ed8b[_0xe9a2('0x80')][_0x1e9d57];var _0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?util['format'](_0xe9a2('0x82'),_0x55c2d5[_0xe9a2('0x83')],_0x53dec0[_0xe9a2('0x81')]):'System';var _0x1d9fdf=_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x84')]||util[_0xe9a2('0x85')]('%s%d','Visitor',_0x53dec0[_0xe9a2('0x7e')]);switch(_0x55c2d5[_0xe9a2('0x86')]){case'website_alias':_0x20d0d7=_0x53dec0['UserId']?util['format'](_0xe9a2('0x82'),_0x55c2d5['agentAlias'],_0x53dec0[_0xe9a2('0x81')]):'System';break;case _0xe9a2('0x87'):_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x88')]||_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x51')]:'System';break;case'agent_fullname':_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x51')]:_0xe9a2('0x89');break;default:_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?util[_0xe9a2('0x85')]('%s%d',_0x55c2d5[_0xe9a2('0x83')],_0x53dec0[_0xe9a2('0x81')]):'System';}var _0x2b5057=util[_0xe9a2('0x85')](_0xe9a2('0x8a'),moment(_0x53dec0[_0xe9a2('0x8b')])['format'](_0xe9a2('0x8c')),_0x53dec0[_0xe9a2('0x8d')]==='in'?_0x1d9fdf:_0x20d0d7,_0x53dec0[_0xe9a2('0x2d')]);if(!_0x53dec0['secret']){fs[_0xe9a2('0x8e')](_0x4fe647,_0x2b5057);}}return db[_0xe9a2('0x8f')][_0xe9a2('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xe9a2('0x90')],'as':_0xe9a2('0x91'),'raw':!![],'include':[{'model':db[_0xe9a2('0x92')],'as':_0xe9a2('0x92'),'raw':!![]}]}]});}}})['then'](function(_0x210451){if(!_0x210451||!_0x210451[_0xe9a2('0x91')]||!_0x414d43[_0xe9a2('0x2d')])return _0x47ed8b;var _0x4ed904=_0x210451[_0xe9a2('0x93')]();return respondWithRpcPromise(_0xe9a2('0x94'),'sendMail',{'account':_0x4ed904,'message':{'from':util[_0xe9a2('0x85')]('\x22%s\x22\x20<%s>',_0x210451[_0xe9a2('0x2a')],_0x210451[_0xe9a2('0x52')]||_0x210451[_0xe9a2('0x91')]['user']),'to':_0x414d43['body'][_0xe9a2('0x78')],'subject':_0xe9a2('0x95'),'text':util[_0xe9a2('0x85')](_0xe9a2('0x96'),_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x78')]),'attachments':[{'path':_0x4fe647}]}})[_0xe9a2('0x15')](function(){return _0x47ed8b;})[_0xe9a2('0x1e')](function(_0xb8fc6c){logger[_0xe9a2('0x1a')](_0xb8fc6c);});})[_0xe9a2('0x15')](respondWithStatusCode(_0x4f34ac,0xc8))[_0xe9a2('0x1e')](handleError(_0x4f34ac,null));};exports[_0xe9a2('0x97')]=function(_0x3870fc,_0x58860d){return db[_0xe9a2('0x5f')][_0xe9a2('0x47')]({'where':{'id':_0x3870fc[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x58860d,null))[_0xe9a2('0x15')](function(_0x282fe7){if(_0x282fe7){return _0x282fe7['addMessage'](_0x3870fc[_0xe9a2('0x2d')][_0xe9a2('0x98')],_['omit'](_0x3870fc['body'],[_0xe9a2('0x98'),'id'])||{});}})['then'](respondWithResult(_0x58860d,null))[_0xe9a2('0x1e')](handleError(_0x58860d,null));};exports['getMessages']=function(_0x12abcd,_0x236d8f){var _0x4cd863={'raw':![],'where':{}};var _0x416263={};var _0x3386e9={'count':0x0,'rows':[]};return db[_0xe9a2('0x32')]['findOne']({'where':{'id':_0x12abcd['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x236d8f,null))[_0xe9a2('0x15')](function(_0x57907a){if(_0x57907a){_0x416263['model']=_[_0xe9a2('0x3d')](db[_0xe9a2('0x5f')][_0xe9a2('0x33')]);_0x416263[_0xe9a2('0x3e')]=_[_0xe9a2('0x3d')](_0x12abcd[_0xe9a2('0x3e')]);_0x416263[_0xe9a2('0x3f')]=_[_0xe9a2('0x40')](_0x416263[_0xe9a2('0x3c')],_0x416263['query']);_0x4cd863[_0xe9a2('0x42')]=_[_0xe9a2('0x40')](_0x416263[_0xe9a2('0x3c')],qs[_0xe9a2('0x41')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x4cd863[_0xe9a2('0x42')]=_0x4cd863[_0xe9a2('0x42')]['length']?_0x4cd863['attributes']:_0x416263['model'];if(!_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x99')](_0xe9a2('0x9a'))){_0x4cd863[_0xe9a2('0x25')]=qs[_0xe9a2('0x25')](_0x12abcd['query']['limit']);_0x4cd863[_0xe9a2('0x23')]=qs[_0xe9a2('0x23')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x23')]);}_0x4cd863['order']=qs[_0xe9a2('0x9b')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x9b')]);_0x4cd863[_0xe9a2('0x9c')]=qs[_0xe9a2('0x3f')](_[_0xe9a2('0x9d')](_0x12abcd['query'],_0x416263[_0xe9a2('0x3f')]));_0x4cd863[_0xe9a2('0x9c')][_0xe9a2('0x9e')]=_0x57907a['id'];if(_0x12abcd[_0xe9a2('0x3e')]['filter']){_0x4cd863[_0xe9a2('0x9c')]=_[_0xe9a2('0x45')](_0x4cd863[_0xe9a2('0x9c')],{'$or':_[_0xe9a2('0x31')](_0x4cd863[_0xe9a2('0x42')],function(_0x119ab8){var _0x5bbb84={};_0x5bbb84[_0x119ab8]={'$like':'%'+_0x12abcd[_0xe9a2('0x3e')]['filter']+'%'};return _0x5bbb84;})});}if(_0x12abcd['query'][_0xe9a2('0x9f')]){var _0x393da7=_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x9f')][_0xe9a2('0xa0')](',');var _0x256fd2={};_0x256fd2[_0x393da7[0x0]]={'$gte':moment(_0x393da7[0x1])['format'](_0xe9a2('0xa1'))};_0x4cd863[_0xe9a2('0x9c')]=_[_0xe9a2('0x45')](_0x4cd863['where'],_0x256fd2);}_0x4cd863=_[_0xe9a2('0x45')]({},_0x4cd863,_0x12abcd['options']);return db[_0xe9a2('0x5f')][_0xe9a2('0x26')]({'where':_0x4cd863[_0xe9a2('0x9c')]})['then'](function(_0x2079eb){_0x3386e9[_0xe9a2('0x26')]=_0x2079eb;if(_0x12abcd['query'][_0xe9a2('0x43')]){_0x4cd863[_0xe9a2('0x44')]=[{'all':!![]}];}return db[_0xe9a2('0x5f')][_0xe9a2('0x38')](_0x4cd863);})[_0xe9a2('0x15')](function(_0x49b1a8){_0x3386e9[_0xe9a2('0xa2')]=_0x49b1a8;return _0x3386e9;});}})['then'](respondWithFilteredResult(_0x236d8f,_0x4cd863))[_0xe9a2('0x1e')](handleError(_0x236d8f,null));};exports[_0xe9a2('0xa3')]=function(_0x22bb59,_0x524d2d){var _0x3a398e={'where':{}},_0x39c85c={},_0x136708={'count':0x0,'rows':[]};return db[_0xe9a2('0x32')]['findOne']({'where':{'id':_0x22bb59['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x524d2d,null))[_0xe9a2('0x15')](function(_0x1434a4){if(_0x1434a4){_0x39c85c[_0xe9a2('0x3c')]=_['keys'](db[_0xe9a2('0x5f')]['rawAttributes']);_0x39c85c[_0xe9a2('0x3e')]=_['keys'](_0x22bb59['query']);_0x39c85c[_0xe9a2('0x3f')]=_['intersection'](_0x39c85c['model'],_0x39c85c[_0xe9a2('0x3e')]);_0x3a398e[_0xe9a2('0x42')]=_[_0xe9a2('0x40')](_0x39c85c['model'],qs['fields'](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x3a398e[_0xe9a2('0x42')]=_0x3a398e[_0xe9a2('0x42')]['length']?_0x3a398e[_0xe9a2('0x42')]:_0x39c85c[_0xe9a2('0x3c')];if(!_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x99')](_0xe9a2('0x9a'))){_0x3a398e['limit']=qs[_0xe9a2('0x25')](_0x22bb59[_0xe9a2('0x3e')]['limit']);_0x3a398e['offset']=qs['offset'](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x23')]);}_0x3a398e[_0xe9a2('0xa4')]=qs[_0xe9a2('0x9b')](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x9b')]);_0x3a398e[_0xe9a2('0x9c')]=qs['filters'](_[_0xe9a2('0x9d')](_0x22bb59[_0xe9a2('0x3e')],_0x39c85c[_0xe9a2('0x3f')]));_0x3a398e['where'][_0xe9a2('0x9e')]=_0x1434a4['id'];if(_0x22bb59[_0xe9a2('0x3e')]['filter']){_0x3a398e[_0xe9a2('0x9c')]=_['merge'](_0x3a398e[_0xe9a2('0x9c')],{'$or':_['map'](_0x3a398e[_0xe9a2('0x42')],function(_0x10f800){var _0xf1968d={};_0xf1968d[_0x10f800]={'$like':'%'+_0x22bb59[_0xe9a2('0x3e')]['filter']+'%'};return _0xf1968d;})});}_0x3a398e[_0xe9a2('0x9c')]['secret']=![];if(_0x22bb59['query']['id']){_0x3a398e[_0xe9a2('0x9c')]['id']={'$gt':_0x22bb59[_0xe9a2('0x3e')]['id']};}_0x3a398e=_[_0xe9a2('0x45')]({},_0x3a398e,_0x22bb59[_0xe9a2('0x46')]);return db[_0xe9a2('0x5f')]['count']({'where':_0x3a398e['where']})[_0xe9a2('0x15')](function(_0x590307){_0x136708[_0xe9a2('0x26')]=_0x590307;_0x3a398e['include']=[];if(_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0xa5')]){_0x3a398e[_0xe9a2('0x44')][_0xe9a2('0xa6')]({'model':db[_0xe9a2('0x7c')],'as':_0xe9a2('0x7c'),'attributes':['id',_0xe9a2('0x51'),_0xe9a2('0x88')]});}if(_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x43')]){_0x3a398e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xe9a2('0x38')](_0x3a398e);})[_0xe9a2('0x15')](function(_0x4f492b){_0x136708[_0xe9a2('0xa2')]=_0x4f492b;return _0x136708;});}})[_0xe9a2('0x15')](respondWithFilteredResult(_0x524d2d,_0x3a398e))[_0xe9a2('0x1e')](handleError(_0x524d2d,null));};exports[_0xe9a2('0xa7')]=function(_0x3a8b38,_0x50da38){return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x3a8b38[_0xe9a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x50da38,null))[_0xe9a2('0x15')](function(_0x5ba59e){if(_0x5ba59e){return _0x5ba59e[_0xe9a2('0xa8')](_0x3a8b38[_0xe9a2('0x2d')][_0xe9a2('0x98')],_['omit'](_0x3a8b38['body'],[_0xe9a2('0x98'),'id'])||{})[_0xe9a2('0xa9')](function(){return db[_0xe9a2('0xaa')]['findAll']({'attributes':['id',_0xe9a2('0x2a'),'color'],'where':{'id':_0x3a8b38['body'][_0xe9a2('0x98')]}});})[_0xe9a2('0x15')](function(_0xcc3509){socket[_0xe9a2('0xab')](_0xe9a2('0xac'),{'id':Number(_0x3a8b38[_0xe9a2('0x49')]['id']),'tags':_0xcc3509||[]});return{'id':Number(_0x3a8b38[_0xe9a2('0x49')]['id']),'tags':_0xcc3509||[]};});}})[_0xe9a2('0x15')](respondWithResult(_0x50da38,null))[_0xe9a2('0x1e')](handleError(_0x50da38,null));};exports[_0xe9a2('0xad')]=function(_0x169434,_0x44d67e){return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x169434[_0xe9a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x44d67e,null))[_0xe9a2('0x15')](function(_0x5107f1){if(_0x5107f1){return _0x5107f1[_0xe9a2('0xad')](_0x169434[_0xe9a2('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x44d67e,null))[_0xe9a2('0x1e')](handleError(_0x44d67e,null));};exports[_0xe9a2('0x76')]=function(_0x277e79,_0x4ac3ba){var _0x1a2b83=moment()[_0xe9a2('0xae')]()[_0xe9a2('0xaf')]();var _0x140bd9=path[_0xe9a2('0x74')](config[_0xe9a2('0x73')],_0xe9a2('0xb0'),_0xe9a2('0xb1'),_0xe9a2('0xb2'));var _0x3ebc56=path[_0xe9a2('0x74')](config['root'],'server',_0xe9a2('0xb1'),_0xe9a2('0xb3'));var _0x4e7205=path[_0xe9a2('0x74')](_0x140bd9,_0x1a2b83);var _0x1538c6=util[_0xe9a2('0x85')](_0xe9a2('0xb4'),_0x277e79[_0xe9a2('0x49')]['id'],_0x1a2b83);var _0x2a91bf=path[_0xe9a2('0x74')](_0x140bd9,_0x1538c6);var _0x59853f=[];_0x59853f[_0xe9a2('0xa6')]({'model':db['User'],'as':_0xe9a2('0x7c'),'attributes':['id',_0xe9a2('0x51')],'raw':!![]});_0x59853f['push']({'model':db[_0xe9a2('0x63')],'as':_0xe9a2('0x64'),'attributes':['id',_0xe9a2('0xb5'),'lastName'],'raw':!![]});if(_0x277e79['query'][_0xe9a2('0xb3')]){_0x59853f['push']({'model':db['Attachment'],'as':_0xe9a2('0x6e'),'raw':!![]});}var _0x424e96=[{'model':db[_0xe9a2('0x5f')],'as':_0xe9a2('0x80'),'attributes':['id',_0xe9a2('0x2d'),'createdAt','direction',_0xe9a2('0xb6'),'read'],'include':_0x59853f}];_0x424e96['push']({'model':db[_0xe9a2('0x7d')],'as':_0xe9a2('0xb7'),'attributes':['id',_0xe9a2('0x2a')]});_0x424e96[_0xe9a2('0xa6')]({'model':db[_0xe9a2('0x7c')],'as':'Owner','attributes':['id',_0xe9a2('0x51')]});return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x277e79[_0xe9a2('0x49')]['id']},'include':_0x424e96})[_0xe9a2('0x15')](handleEntityNotFound(_0x4ac3ba,null))[_0xe9a2('0x15')](function(_0x59e64d){if(_0x59e64d){var _0x290fd9=_0x59e64d[_0xe9a2('0xb8')]({'plain':!![]});fs[_0xe9a2('0xb9')](_0x4e7205);var _0x1e08b6={'channel':_0xe9a2('0xba'),'account':_0x290fd9['Account'][_0xe9a2('0x2a')],'agent':_0x290fd9['Owner']?_0x290fd9[_0xe9a2('0xbb')][_0xe9a2('0x51')]:'N.A.','createdAt':moment(_0x290fd9[_0xe9a2('0x8b')])[_0xe9a2('0x85')](_0xe9a2('0xa1'))['toString'](),'closedAt':_0x290fd9[_0xe9a2('0x68')]?moment(_0x290fd9[_0xe9a2('0xbc')])[_0xe9a2('0x85')](_0xe9a2('0xa1'))[_0xe9a2('0xaf')]():'','disposition':_0x290fd9[_0xe9a2('0x69')],'chatInfo':{'browser':_0x290fd9['browserName'],'os':_0x290fd9[_0xe9a2('0xbd')],'referer':_0x290fd9['referer'],'customerIp':_0x290fd9[_0xe9a2('0xbe')],'customerPort':_0x290fd9[_0xe9a2('0xbf')]?_0x290fd9[_0xe9a2('0xbf')]:'N.A.'},'messages':_(_0x290fd9['Messages'])[_0xe9a2('0xc0')]()[_0xe9a2('0xc1')]({'secret':![]})[_0xe9a2('0x31')](function(_0x366888){if(_0x366888[_0xe9a2('0x6e')]){var _0xef6a4c=path[_0xe9a2('0x74')](_0x3ebc56,_0x366888[_0xe9a2('0x6e')]['basename']);if(fs[_0xe9a2('0xc2')](_0xef6a4c)){fs[_0xe9a2('0xc3')](_0xef6a4c)['pipe'](fs[_0xe9a2('0xc4')](path['join'](_0x4e7205,_0x366888[_0xe9a2('0x6e')]['basename'])));}}return{'date':moment(_0x366888[_0xe9a2('0x8b')])['format'](_0xe9a2('0xa1'))[_0xe9a2('0xaf')](),'sender':_0x366888[_0xe9a2('0x8d')]===_0xe9a2('0x5e')?_0x366888['User']?_0x366888['User'][_0xe9a2('0x51')]:_0xe9a2('0x89'):_0x366888[_0xe9a2('0x64')]['firstName']+(_0x366888[_0xe9a2('0x64')][_0xe9a2('0xc5')]?'\x20'+_0x366888[_0xe9a2('0x64')]['lastName']:''),'body':_0x366888[_0xe9a2('0x6e')]?_0x366888[_0xe9a2('0x6e')][_0xe9a2('0xc6')]:_0x366888['body'],'direction':_0x366888[_0xe9a2('0x8d')]===_0xe9a2('0x5e')?'A':'C','secret':_0x366888[_0xe9a2('0xb6')],'read':_0x366888[_0xe9a2('0xc7')],'attachment':_0x366888['Attachment']};})[_0xe9a2('0xc8')]()};return ejs['renderFile'](path[_0xe9a2('0x74')](config[_0xe9a2('0x73')],_0xe9a2('0xb0'),'views',_0xe9a2('0xc9')),{'interaction':_0x1e08b6})[_0xe9a2('0x15')](function(_0x490aad){var _0x17d437=path[_0xe9a2('0x74')](_0x4e7205,_0xe9a2('0xca')+_0x290fd9['id']+'-'+_0x1a2b83+'.pdf');var _0x5dc253={'path':_0x17d437,'channel':_0xe9a2('0xba'),'interactionId':_0x290fd9['id']};return pdf['createPdfFromHTML'](_0x490aad,_0x5dc253);})['then'](function(){return new Promise(function(_0x41f40d,_0x3fb957){zipdir(_0x4e7205,{'saveTo':_0x2a91bf},function(_0x1d4ec8,_0x5a5b05){if(_0x1d4ec8)return _0x3fb957(_0x1d4ec8);return _0x41f40d(_0x5a5b05);});})[_0xe9a2('0x15')](function(){return new BPromise(function(_0x14f8ed,_0x2c9238){rimraf(_0x4e7205,function(_0x745470){if(_0x745470)_0x2c9238(_0x745470);return _0x14f8ed();});});})[_0xe9a2('0x15')](function(){return _0x4ac3ba['download'](_0x2a91bf,_0x1538c6,function(_0x4dc85a){if(_0x4dc85a){logger['error'](_0xe9a2('0xcb'),_0x4dc85a);}else{fs['unlinkSync'](_0x2a91bf);}});});});}else{return _0x4ac3ba[_0xe9a2('0x1f')](0xc8);}})[_0xe9a2('0x1e')](handleError(_0x4ac3ba,null));}; \ No newline at end of file +var _0x5b18=['findAll','query','user','catch','show','params','model','keys','ChatInteraction','rawAttributes','filters','intersection','attributes','length','includeAll','merge','create','find','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','email','isNull','follow','parse','ValidationError','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','System','customer','agentIdentifier','agentAlias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','pick','includeAgent','include','addTags','setTags','spread','Tag','color','chatInteractionTags:save','unix','toString','server','files','tmp','push','firstName','lastName','attachments','createdAt','direction','secret','ChatWebsite','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','Contact','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','stack','name','send','body','contact','agent','interaction','account','index','map','fieldName','getOptions'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x5b18,0x16d));var _0x85b1=function(_0x18307e,_0x1898e8){_0x18307e=_0x18307e-0x0;var _0x24186b=_0x5b18[_0x18307e];return _0x24186b;};'use strict';var rimraf=require(_0x85b1('0x0'));var zipdir=require(_0x85b1('0x1'));var rp=require('request-promise');var moment=require(_0x85b1('0x2'));var BPromise=require(_0x85b1('0x3'));var Mustache=require(_0x85b1('0x4'));var util=require(_0x85b1('0x5'));var path=require(_0x85b1('0x6'));var ejs=require(_0x85b1('0x7'));var fs=require('fs');var _=require(_0x85b1('0x8'));var Redis=require(_0x85b1('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x85b1('0xa'));var pdf=require(_0x85b1('0xb'));var logger=require(_0x85b1('0xc'))(_0x85b1('0xd'));var config=require('../../config/environment');var db=require(_0x85b1('0xe'))['db'];config[_0x85b1('0xf')]=_[_0x85b1('0x10')](config[_0x85b1('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x85b1('0x11'))(new Redis(config[_0x85b1('0xf')]));require(_0x85b1('0x12'))[_0x85b1('0x13')](socket);var jayson=require(_0x85b1('0x14'));var client=jayson[_0x85b1('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x85b1('0x15')][_0x85b1('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x496dd1,_0x3d042e,_0x3ca15e,_0x4a624e){return new BPromise(function(_0x3b5933,_0x3f67cc){var _0x361fdb=_0x4a624e||client;return _0x361fdb[_0x85b1('0x17')](_0x496dd1,_0x3ca15e)[_0x85b1('0x18')](function(_0x1ff66d){logger[_0x85b1('0x19')](_0x85b1('0x1a'),_0x3d042e,_0x85b1('0x1b'));logger[_0x85b1('0x1c')](_0x85b1('0x1d'),_0x3d042e,_0x85b1('0x1b'),JSON[_0x85b1('0x1e')](_0x1ff66d));if(_0x1ff66d[_0x85b1('0x1f')]){if(_0x1ff66d['error']['code']===0x1f4){logger['error'](_0x85b1('0x1a'),_0x3d042e,_0x1ff66d[_0x85b1('0x1f')][_0x85b1('0x20')]);return _0x3f67cc(_0x1ff66d['error'][_0x85b1('0x20')]);}logger['error'](_0x85b1('0x1a'),_0x3d042e,_0x1ff66d[_0x85b1('0x1f')][_0x85b1('0x20')]);return _0x3b5933(_0x1ff66d[_0x85b1('0x1f')][_0x85b1('0x20')]);}else{logger[_0x85b1('0x19')](_0x85b1('0x1a'),_0x3d042e,'request\x20sent');_0x3b5933(_0x1ff66d[_0x85b1('0x21')][_0x85b1('0x20')]);}})['catch'](function(_0x5f4892){logger['error'](_0x85b1('0x1a'),_0x3d042e,_0x5f4892);_0x3f67cc(_0x5f4892);});});}function respondWithStatusCode(_0x57facb,_0x2f63a4){_0x2f63a4=_0x2f63a4||0xcc;return function(_0x50aeed){if(_0x50aeed){return _0x57facb[_0x85b1('0x22')](_0x2f63a4);}return _0x57facb[_0x85b1('0x23')](_0x2f63a4)[_0x85b1('0x24')]();};}function respondWithResult(_0x2bee2e,_0x1524f0){_0x1524f0=_0x1524f0||0xc8;return function(_0x1568d8){if(_0x1568d8){return _0x2bee2e[_0x85b1('0x23')](_0x1524f0)[_0x85b1('0x25')](_0x1568d8);}};}function respondWithFilteredResult(_0xa887ad,_0x654d3d){return function(_0x45ca1c){if(_0x45ca1c){var _0x6d000e=typeof _0x654d3d[_0x85b1('0x26')]===_0x85b1('0x27')&&typeof _0x654d3d[_0x85b1('0x28')]===_0x85b1('0x27');var _0x1ce164=_0x45ca1c[_0x85b1('0x29')];var _0x5486b2=_0x6d000e?0x0:_0x654d3d[_0x85b1('0x26')];var _0x1ca0a8=_0x6d000e?_0x45ca1c['count']:_0x654d3d[_0x85b1('0x26')]+_0x654d3d[_0x85b1('0x28')];var _0x611d0d;if(_0x1ca0a8>=_0x1ce164){_0x1ca0a8=_0x1ce164;_0x611d0d=0xc8;}else{_0x611d0d=0xce;}_0xa887ad[_0x85b1('0x23')](_0x611d0d);return _0xa887ad[_0x85b1('0x2a')](_0x85b1('0x2b'),_0x5486b2+'-'+_0x1ca0a8+'/'+_0x1ce164)[_0x85b1('0x25')](_0x45ca1c);}return null;};}function saveUpdates(_0x2fc2ff){return function(_0xc8f6da){if(_0xc8f6da){return _0xc8f6da[_0x85b1('0x2c')](_0x2fc2ff)['then'](function(_0xdd7689){return _0xdd7689;});}return null;};}function removeEntity(_0x1a37d2){return function(_0x4cd6e0){if(_0x4cd6e0){return _0x4cd6e0['destroy']()[_0x85b1('0x18')](function(){_0x1a37d2[_0x85b1('0x23')](0xcc)[_0x85b1('0x24')]();});}};}function handleEntityNotFound(_0x5716c2){return function(_0x38c327){if(!_0x38c327){_0x5716c2[_0x85b1('0x22')](0x194);}return _0x38c327;};}function handleError(_0x50e888,_0xc604b1){_0xc604b1=_0xc604b1||0x1f4;return function(_0x42ec70){logger[_0x85b1('0x1f')](_0x42ec70[_0x85b1('0x2d')]);if(_0x42ec70[_0x85b1('0x2e')]){delete _0x42ec70[_0x85b1('0x2e')];}_0x50e888['status'](_0xc604b1)[_0x85b1('0x2f')](_0x42ec70);};}function getMustacheRender(_0x52acf1,_0x1a9381){return Mustache['render'](_0x52acf1,_['merge'](_0x1a9381[_0x85b1('0x30')],{'contact':_0x1a9381[_0x85b1('0x31')],'message':_0x1a9381[_0x85b1('0x20')],'agent':_0x1a9381[_0x85b1('0x32')],'interaction':_0x1a9381[_0x85b1('0x33')],'account':_0x1a9381[_0x85b1('0x34')]}))||'';}exports[_0x85b1('0x35')]=function(_0x313711,_0x5b5959){var _0x21ab47={};var _0x350b1f=_[_0x85b1('0x36')](db['ChatInteraction']['rawAttributes'],function(_0x482947){return{'name':_0x482947[_0x85b1('0x37')],'type':_0x482947['type']['key']};});_0x21ab47=qs[_0x85b1('0x38')](_0x350b1f,_0x313711);return interaction[_0x85b1('0x39')]('chat',_0x313711[_0x85b1('0x3a')],_0x313711[_0x85b1('0x3b')],_0x21ab47,_0x350b1f)[_0x85b1('0x18')](respondWithFilteredResult(_0x5b5959,_0x21ab47))[_0x85b1('0x3c')](handleError(_0x5b5959,null));};exports[_0x85b1('0x3d')]=function(_0x2529fb,_0x598f6b){var _0x347b88={'raw':![],'where':{'id':_0x2529fb[_0x85b1('0x3e')]['id']}},_0x367d57={};_0x367d57[_0x85b1('0x3f')]=_[_0x85b1('0x40')](db[_0x85b1('0x41')][_0x85b1('0x42')]);_0x367d57['query']=_[_0x85b1('0x40')](_0x2529fb[_0x85b1('0x3a')]);_0x367d57[_0x85b1('0x43')]=_[_0x85b1('0x44')](_0x367d57[_0x85b1('0x3f')],_0x367d57['query']);_0x347b88['attributes']=_[_0x85b1('0x44')](_0x367d57[_0x85b1('0x3f')],qs['fields'](_0x2529fb[_0x85b1('0x3a')]['fields']));_0x347b88[_0x85b1('0x45')]=_0x347b88[_0x85b1('0x45')][_0x85b1('0x46')]?_0x347b88[_0x85b1('0x45')]:_0x367d57['model'];if(_0x2529fb[_0x85b1('0x3a')][_0x85b1('0x47')]){_0x347b88['include']=[{'all':!![]}];}_0x347b88=_[_0x85b1('0x48')]({},_0x347b88,_0x2529fb['options']);return db[_0x85b1('0x41')]['find'](_0x347b88)[_0x85b1('0x18')](handleEntityNotFound(_0x598f6b,null))[_0x85b1('0x18')](respondWithResult(_0x598f6b,null))[_0x85b1('0x3c')](handleError(_0x598f6b,null));};exports[_0x85b1('0x49')]=function(_0x14354e,_0x4657dc){return db[_0x85b1('0x41')][_0x85b1('0x49')](_0x14354e['body'],{})[_0x85b1('0x18')](respondWithResult(_0x4657dc,0xc9))[_0x85b1('0x3c')](handleError(_0x4657dc,null));};exports[_0x85b1('0x2c')]=function(_0x52cc7f,_0x11ea1d){if(_0x52cc7f[_0x85b1('0x30')]['id']){delete _0x52cc7f[_0x85b1('0x30')]['id'];}return db[_0x85b1('0x41')][_0x85b1('0x4a')]({'where':{'id':_0x52cc7f[_0x85b1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x11ea1d,null))[_0x85b1('0x18')](saveUpdates(_0x52cc7f[_0x85b1('0x30')],null))['then'](respondWithResult(_0x11ea1d,null))[_0x85b1('0x3c')](handleError(_0x11ea1d,null));};exports[_0x85b1('0x4b')]=function(_0x35d0e6,_0x5b005c){return db['ChatInteraction']['find']({'where':{'id':_0x35d0e6[_0x85b1('0x3e')]['id']}})[_0x85b1('0x18')](handleEntityNotFound(_0x5b005c,null))[_0x85b1('0x18')](removeEntity(_0x5b005c,null))[_0x85b1('0x3c')](handleError(_0x5b005c,null));};exports['describe']=function(_0x496a2f,_0x1771ae){return db['ChatInteraction'][_0x85b1('0x4c')]()[_0x85b1('0x18')](respondWithResult(_0x1771ae,null))[_0x85b1('0x3c')](handleError(_0x1771ae,null));};exports[_0x85b1('0x4d')]=function(_0x492bb7,_0x51d382){var _0x44bc17=_0x492bb7[_0x85b1('0x3e')]['id'];var _0x37691c;var _0x29e53d;var _0x155a3f;return db[_0x85b1('0x41')][_0x85b1('0x4e')]({'where':{'id':_0x44bc17}})[_0x85b1('0x18')](function(_0x3dceb1){_0x37691c=_0x3dceb1;return db['ChatWebsite']['findOne']({'where':{'id':_0x3dceb1[_0x85b1('0x4f')]},'attributes':['id',_0x85b1('0x50'),_0x85b1('0x51'),_0x85b1('0x52'),_0x85b1('0x53'),_0x85b1('0x54')],'raw':!![]});})[_0x85b1('0x18')](function(_0x4f8509){if(_0x4f8509&&_0x4f8509[_0x85b1('0x50')]&&_0x4f8509[_0x85b1('0x51')]){_0x29e53d=_0x4f8509;var _0x3d7979={'interaction':{'id':_0x44bc17},'agent':{'id':_0x492bb7[_0x85b1('0x3b')]['id'],'name':_0x492bb7['user'][_0x85b1('0x2e')],'fullname':_0x492bb7[_0x85b1('0x3b')]['fullname'],'email':_0x492bb7[_0x85b1('0x3b')]['email']},'contact':_0x492bb7[_0x85b1('0x30')][_0x85b1('0x31')],'account':_0x492bb7[_0x85b1('0x30')][_0x85b1('0x34')]};var _0x21994c={'rejectUnauthorized':![],'method':_0x85b1('0x55'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x4f8509[_0x85b1('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x492bb7[_0x85b1('0x3b')][_0x85b1('0x56')]],'buttons':null,'topic':_0x29e53d['vidaooTopic'],'note':_[_0x85b1('0x57')](_0x29e53d[_0x85b1('0x53')])?null:getMustacheRender(_0x29e53d[_0x85b1('0x53')],_0x3d7979),'metadata':null},'redirect':_0x85b1('0x58'),'json':!![]};try{if(!_[_0x85b1('0x57')](_0x29e53d[_0x85b1('0x54')])){var _0x3c41b1=getMustacheRender(_0x29e53d['vidaooMetadata'],_0x3d7979);var _0x6e05f7=JSON[_0x85b1('0x59')](_0x3c41b1);_0x21994c[_0x85b1('0x30')]['metadata']=_0x6e05f7;}}catch(_0x55c259){throw new db['Sequelize'][(_0x85b1('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x21994c);}else{throw new db[(_0x85b1('0x5b'))][(_0x85b1('0x5a'))](_0x85b1('0x5c'));}})[_0x85b1('0x18')](function(_0x2bd097){_0x155a3f=_0x2bd097;if(_0x155a3f['id']){var _0x11f13a={'body':_0x155a3f[_0x85b1('0x5d')],'ChatWebsiteId':_0x29e53d['id'],'ChatInteractionId':_0x37691c['id'],'direction':_0x85b1('0x5e'),'UserId':_0x492bb7[_0x85b1('0x3b')]['id']};return db[_0x85b1('0x5f')][_0x85b1('0x49')](_0x11f13a,{});}else{throw new db[(_0x85b1('0x5b'))][(_0x85b1('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x37691c[_0x85b1('0x60')]({'vidaooSessionId':_0x155a3f['id']});})[_0x85b1('0x18')](respondWithResult(_0x51d382,null))[_0x85b1('0x3c')](handleError(_0x51d382,null));};exports['customUpdate']=function(_0x569064,_0x8faa02){if(_0x569064[_0x85b1('0x30')]['id']){delete _0x569064[_0x85b1('0x30')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x569064[_0x85b1('0x3e')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x85b1('0x18')](handleEntityNotFound(_0x8faa02,null))[_0x85b1('0x18')](saveUpdates(_0x569064[_0x85b1('0x30')],null))[_0x85b1('0x18')](respondWithResult(_0x8faa02,null))['catch'](handleError(_0x8faa02,null));};exports['abandon']=function(_0x18cfe8,_0x408c63){if(_0x18cfe8[_0x85b1('0x30')]['id']){delete _0x18cfe8[_0x85b1('0x30')]['id'];}return db['ChatInteraction'][_0x85b1('0x4a')]({'where':{'id':_0x18cfe8[_0x85b1('0x3e')]['id']}})[_0x85b1('0x18')](function(_0x3e023a){if(!_0x3e023a){logger[_0x85b1('0x1f')](_0x85b1('0x61'),_0x85b1('0x62'),0x194,_0x85b1('0x63'));_0x408c63[_0x85b1('0x22')](0x194);}else{if(_0x3e023a[_0x85b1('0x64')]){throw new db[(_0x85b1('0x5b'))][(_0x85b1('0x5a'))](_0x85b1('0x65'));}}return _0x3e023a;})[_0x85b1('0x18')](function(_0x46dba7){if(_0x46dba7){return _0x46dba7[_0x85b1('0x2c')]({'closed':_0x18cfe8[_0x85b1('0x30')][_0x85b1('0x66')],'disposition':_0x18cfe8[_0x85b1('0x30')][_0x85b1('0x67')]})[_0x85b1('0x18')](function(_0x28ca02){return _0x28ca02;});}})[_0x85b1('0x18')](function(){return respondWithRpcPromise(_0x85b1('0x68'),_0x85b1('0x62'),_0x18cfe8[_0x85b1('0x30')],client9004);})[_0x85b1('0x18')](respondWithResult(_0x408c63,null))[_0x85b1('0x3c')](handleError(_0x408c63,null));};exports[_0x85b1('0x69')]=function(_0x53063d,_0x32e93c){_0x53063d[_0x85b1('0x30')]['name']=_0x53063d[_0x85b1('0x6a')][_0x85b1('0x6b')];_0x53063d['body'][_0x85b1('0x6c')]=_0x53063d[_0x85b1('0x6a')][_0x85b1('0x6d')];_0x53063d[_0x85b1('0x30')][_0x85b1('0x6e')]=_0x53063d[_0x85b1('0x6a')][_0x85b1('0x6f')];return db[_0x85b1('0x70')][_0x85b1('0x49')](_0x53063d[_0x85b1('0x30')])[_0x85b1('0x18')](respondWithResult(_0x32e93c,0xc9))[_0x85b1('0x3c')](handleError(_0x32e93c,null));};exports['attachmentDownload']=function(_0x3a4a90,_0x3ead56){return db['ChatInteraction'][_0x85b1('0x4e')]({'where':{'id':_0x3a4a90['params']['id']},'raw':!![]})[_0x85b1('0x18')](handleEntityNotFound(_0x3ead56,null))['then'](function(_0x2bde83){if(_0x2bde83){if(_0x2bde83[_0x85b1('0x66')]){return _0x3ead56[_0x85b1('0x23')](0x193)[_0x85b1('0x25')]({'status':0x193,'message':_0x85b1('0x71')});}return db[_0x85b1('0x70')][_0x85b1('0x4e')]({'where':{'id':_0x3a4a90[_0x85b1('0x3a')][_0x85b1('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x3ead56,null));}})[_0x85b1('0x18')](function(_0x410653){if(_0x410653){var _0x4b8d64=_0x410653[_0x85b1('0x73')]!==null;var _0x14a220=path[_0x85b1('0x74')](config[_0x85b1('0x75')],'server/files/attachments/');if(_0x4b8d64){_0x14a220=path[_0x85b1('0x74')](_0x14a220,_0x85b1('0x76'));}var _0x385c49=path['join'](_0x14a220,_0x410653[_0x85b1('0x6c')]);return _0x3ead56[_0x85b1('0x77')](_0x385c49);}})[_0x85b1('0x3c')](handleError(_0x3ead56,null));};exports[_0x85b1('0x78')]=function(_0x21220d,_0x258eb7){var _0x2e69ce=null;var _0xb140fd=null;var _0x59e0d5=null;if(_0x21220d[_0x85b1('0x30')]['id']){delete _0x21220d['body']['id'];}if(_0x21220d[_0x85b1('0x30')][_0x85b1('0x79')]){_0x59e0d5=path[_0x85b1('0x74')](config[_0x85b1('0x75')],_0x85b1('0x7a'),util[_0x85b1('0x7b')](_0x85b1('0x7c'),Date[_0x85b1('0x7d')]()));_0x21220d[_0x85b1('0x30')][_0x85b1('0x7e')]=_0x59e0d5;}return db[_0x85b1('0x41')][_0x85b1('0x4a')]({'where':{'id':_0x21220d[_0x85b1('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x85b1('0x7f'),'include':[{'model':db[_0x85b1('0x80')],'as':_0x85b1('0x80')}]}]})[_0x85b1('0x18')](handleEntityNotFound(_0x258eb7,null))[_0x85b1('0x18')](saveUpdates(_0x21220d[_0x85b1('0x30')],null))[_0x85b1('0x18')](function(_0x43b762){if(_0x43b762){_0x2e69ce=_0x43b762;return db['ChatWebsite'][_0x85b1('0x4a')]({'where':{'id':_0x2e69ce[_0x85b1('0x4f')]}});}})['then'](function(_0x396027){if(_0x396027){_0xb140fd=_0x396027;return db[_0x85b1('0x81')][_0x85b1('0x4a')]({'where':{'id':_0x2e69ce[_0x85b1('0x82')]}});}})['then'](function(_0x45b639){if(_0x45b639){if(_0x59e0d5){var _0x154fef=null;for(var _0x2b6524=0x1;_0x2b6524<_0x2e69ce[_0x85b1('0x7f')]['length'];++_0x2b6524){_0x154fef=_0x2e69ce['Messages'][_0x2b6524];var _0x26511a=_0x154fef[_0x85b1('0x64')]?util[_0x85b1('0x7b')](_0x85b1('0x83'),_0xb140fd['agentAlias'],_0x154fef[_0x85b1('0x64')]):_0x85b1('0x84');var _0x5702f5=_0x21220d[_0x85b1('0x30')][_0x85b1('0x85')]||util[_0x85b1('0x7b')]('%s%d','Visitor',_0x154fef['ContactId']);switch(_0xb140fd[_0x85b1('0x86')]){case'website_alias':_0x26511a=_0x154fef[_0x85b1('0x64')]?util['format']('%s%d',_0xb140fd[_0x85b1('0x87')],_0x154fef[_0x85b1('0x64')]):'System';break;case'agent_alias':_0x26511a=_0x154fef[_0x85b1('0x64')]?_0x154fef[_0x85b1('0x80')][_0x85b1('0x88')]||_0x154fef[_0x85b1('0x80')][_0x85b1('0x89')]:_0x85b1('0x84');break;case _0x85b1('0x8a'):_0x26511a=_0x154fef['UserId']?_0x154fef[_0x85b1('0x80')][_0x85b1('0x89')]:_0x85b1('0x84');break;default:_0x26511a=_0x154fef['UserId']?util[_0x85b1('0x7b')]('%s%d',_0xb140fd[_0x85b1('0x87')],_0x154fef[_0x85b1('0x64')]):_0x85b1('0x84');}var _0x3c5e67=util[_0x85b1('0x7b')](_0x85b1('0x8b'),moment(_0x154fef['createdAt'])[_0x85b1('0x7b')](_0x85b1('0x8c')),_0x154fef['direction']==='in'?_0x5702f5:_0x26511a,_0x154fef['body']);if(!_0x154fef['secret']){fs[_0x85b1('0x8d')](_0x59e0d5,_0x3c5e67);}}return db[_0x85b1('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x85b1('0x8f'),'raw':!![],'include':[{'model':db[_0x85b1('0x90')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x85b1('0x18')](function(_0x2d884d){if(!_0x2d884d||!_0x2d884d[_0x85b1('0x8f')]||!_0x21220d[_0x85b1('0x30')])return _0x2e69ce;var _0x32260e=_0x2d884d[_0x85b1('0x91')]();return respondWithRpcPromise('SendMail',_0x85b1('0x92'),{'account':_0x32260e,'message':{'from':util['format'](_0x85b1('0x93'),_0x2d884d[_0x85b1('0x2e')],_0x2d884d[_0x85b1('0x56')]||_0x2d884d['Smtp'][_0x85b1('0x3b')]),'to':_0x21220d[_0x85b1('0x30')][_0x85b1('0x79')],'subject':_0x85b1('0x94'),'text':util[_0x85b1('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x21220d[_0x85b1('0x30')][_0x85b1('0x79')]),'attachments':[{'path':_0x59e0d5}]}})[_0x85b1('0x18')](function(){return _0x2e69ce;})[_0x85b1('0x3c')](function(_0x1e5df){logger[_0x85b1('0x1f')](_0x1e5df);});})[_0x85b1('0x18')](respondWithStatusCode(_0x258eb7,0xc8))[_0x85b1('0x3c')](handleError(_0x258eb7,null));};exports['addMessage']=function(_0x498d68,_0x300efc){return db['ChatMessage'][_0x85b1('0x4a')]({'where':{'id':_0x498d68[_0x85b1('0x3e')]['id']}})[_0x85b1('0x18')](handleEntityNotFound(_0x300efc,null))['then'](function(_0x41879d){if(_0x41879d){return _0x41879d[_0x85b1('0x95')](_0x498d68['body'][_0x85b1('0x96')],_[_0x85b1('0x97')](_0x498d68[_0x85b1('0x30')],['ids','id'])||{});}})['then'](respondWithResult(_0x300efc,null))['catch'](handleError(_0x300efc,null));};exports[_0x85b1('0x98')]=function(_0x54443d,_0x52da69){var _0x3898d1={'raw':![],'where':{}};var _0x26e35f={};var _0x2dff04={'count':0x0,'rows':[]};return db[_0x85b1('0x41')][_0x85b1('0x4e')]({'where':{'id':_0x54443d['params']['id']}})[_0x85b1('0x18')](handleEntityNotFound(_0x52da69,null))[_0x85b1('0x18')](function(_0xc03470){if(_0xc03470){_0x26e35f['model']=_[_0x85b1('0x40')](db[_0x85b1('0x5f')][_0x85b1('0x42')]);_0x26e35f[_0x85b1('0x3a')]=_[_0x85b1('0x40')](_0x54443d[_0x85b1('0x3a')]);_0x26e35f[_0x85b1('0x43')]=_[_0x85b1('0x44')](_0x26e35f[_0x85b1('0x3f')],_0x26e35f[_0x85b1('0x3a')]);_0x3898d1['attributes']=_[_0x85b1('0x44')](_0x26e35f[_0x85b1('0x3f')],qs[_0x85b1('0x99')](_0x54443d[_0x85b1('0x3a')][_0x85b1('0x99')]));_0x3898d1[_0x85b1('0x45')]=_0x3898d1[_0x85b1('0x45')][_0x85b1('0x46')]?_0x3898d1[_0x85b1('0x45')]:_0x26e35f[_0x85b1('0x3f')];if(!_0x54443d['query'][_0x85b1('0x9a')](_0x85b1('0x9b'))){_0x3898d1[_0x85b1('0x28')]=qs[_0x85b1('0x28')](_0x54443d[_0x85b1('0x3a')][_0x85b1('0x28')]);_0x3898d1[_0x85b1('0x26')]=qs[_0x85b1('0x26')](_0x54443d['query']['offset']);}_0x3898d1[_0x85b1('0x9c')]=qs[_0x85b1('0x9d')](_0x54443d['query'][_0x85b1('0x9d')]);_0x3898d1['where']=qs[_0x85b1('0x43')](_['pick'](_0x54443d['query'],_0x26e35f['filters']));_0x3898d1[_0x85b1('0x9e')][_0x85b1('0x9f')]=_0xc03470['id'];if(_0x54443d[_0x85b1('0x3a')][_0x85b1('0xa0')]){_0x3898d1[_0x85b1('0x9e')]=_[_0x85b1('0x48')](_0x3898d1[_0x85b1('0x9e')],{'$or':_[_0x85b1('0x36')](_0x3898d1[_0x85b1('0x45')],function(_0x56ea84){var _0x23e4ac={};_0x23e4ac[_0x56ea84]={'$like':'%'+_0x54443d['query'][_0x85b1('0xa0')]+'%'};return _0x23e4ac;})});}if(_0x54443d[_0x85b1('0x3a')][_0x85b1('0xa1')]){var _0x3831db=_0x54443d[_0x85b1('0x3a')][_0x85b1('0xa1')][_0x85b1('0xa2')](',');var _0x5145be={};_0x5145be[_0x3831db[0x0]]={'$gte':moment(_0x3831db[0x1])[_0x85b1('0x7b')](_0x85b1('0xa3'))};_0x3898d1[_0x85b1('0x9e')]=_[_0x85b1('0x48')](_0x3898d1[_0x85b1('0x9e')],_0x5145be);}_0x3898d1=_['merge']({},_0x3898d1,_0x54443d[_0x85b1('0xa4')]);return db[_0x85b1('0x5f')][_0x85b1('0x29')]({'where':_0x3898d1['where']})[_0x85b1('0x18')](function(_0x521750){_0x2dff04['count']=_0x521750;if(_0x54443d[_0x85b1('0x3a')]['includeAll']){_0x3898d1['include']=[{'all':!![]}];}return db[_0x85b1('0x5f')][_0x85b1('0x39')](_0x3898d1);})['then'](function(_0x41cdc7){_0x2dff04[_0x85b1('0xa5')]=_0x41cdc7;return _0x2dff04;});}})[_0x85b1('0x18')](respondWithFilteredResult(_0x52da69,_0x3898d1))[_0x85b1('0x3c')](handleError(_0x52da69,null));};exports[_0x85b1('0xa6')]=function(_0x151fd8,_0x2a1d1d){var _0x8e4627={'where':{}},_0x479d95={},_0xe50cf9={'count':0x0,'rows':[]};return db[_0x85b1('0x41')]['findOne']({'where':{'id':_0x151fd8[_0x85b1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2a1d1d,null))[_0x85b1('0x18')](function(_0x2f0377){if(_0x2f0377){_0x479d95[_0x85b1('0x3f')]=_[_0x85b1('0x40')](db[_0x85b1('0x5f')][_0x85b1('0x42')]);_0x479d95[_0x85b1('0x3a')]=_[_0x85b1('0x40')](_0x151fd8[_0x85b1('0x3a')]);_0x479d95[_0x85b1('0x43')]=_['intersection'](_0x479d95[_0x85b1('0x3f')],_0x479d95[_0x85b1('0x3a')]);_0x8e4627['attributes']=_['intersection'](_0x479d95[_0x85b1('0x3f')],qs['fields'](_0x151fd8[_0x85b1('0x3a')]['fields']));_0x8e4627[_0x85b1('0x45')]=_0x8e4627[_0x85b1('0x45')]['length']?_0x8e4627[_0x85b1('0x45')]:_0x479d95[_0x85b1('0x3f')];if(!_0x151fd8[_0x85b1('0x3a')][_0x85b1('0x9a')](_0x85b1('0x9b'))){_0x8e4627[_0x85b1('0x28')]=qs[_0x85b1('0x28')](_0x151fd8[_0x85b1('0x3a')][_0x85b1('0x28')]);_0x8e4627[_0x85b1('0x26')]=qs['offset'](_0x151fd8[_0x85b1('0x3a')][_0x85b1('0x26')]);}_0x8e4627[_0x85b1('0x9c')]=qs[_0x85b1('0x9d')](_0x151fd8[_0x85b1('0x3a')]['sort']);_0x8e4627[_0x85b1('0x9e')]=qs[_0x85b1('0x43')](_[_0x85b1('0xa7')](_0x151fd8['query'],_0x479d95['filters']));_0x8e4627[_0x85b1('0x9e')][_0x85b1('0x9f')]=_0x2f0377['id'];if(_0x151fd8['query']['filter']){_0x8e4627['where']=_[_0x85b1('0x48')](_0x8e4627[_0x85b1('0x9e')],{'$or':_[_0x85b1('0x36')](_0x8e4627[_0x85b1('0x45')],function(_0x58a1e8){var _0x53db5d={};_0x53db5d[_0x58a1e8]={'$like':'%'+_0x151fd8[_0x85b1('0x3a')][_0x85b1('0xa0')]+'%'};return _0x53db5d;})});}_0x8e4627[_0x85b1('0x9e')]['secret']=![];if(_0x151fd8[_0x85b1('0x3a')]['id']){_0x8e4627[_0x85b1('0x9e')]['id']={'$gt':_0x151fd8[_0x85b1('0x3a')]['id']};}_0x8e4627=_[_0x85b1('0x48')]({},_0x8e4627,_0x151fd8['options']);return db[_0x85b1('0x5f')][_0x85b1('0x29')]({'where':_0x8e4627[_0x85b1('0x9e')]})[_0x85b1('0x18')](function(_0x5cfd72){_0xe50cf9[_0x85b1('0x29')]=_0x5cfd72;_0x8e4627['include']=[];if(_0x151fd8[_0x85b1('0x3a')][_0x85b1('0xa8')]){_0x8e4627[_0x85b1('0xa9')]['push']({'model':db['User'],'as':_0x85b1('0x80'),'attributes':['id',_0x85b1('0x89'),_0x85b1('0x88')]});}if(_0x151fd8[_0x85b1('0x3a')][_0x85b1('0x47')]){_0x8e4627[_0x85b1('0xa9')]=[{'all':!![]}];}return db[_0x85b1('0x5f')][_0x85b1('0x39')](_0x8e4627);})[_0x85b1('0x18')](function(_0x5685d1){_0xe50cf9[_0x85b1('0xa5')]=_0x5685d1;return _0xe50cf9;});}})[_0x85b1('0x18')](respondWithFilteredResult(_0x2a1d1d,_0x8e4627))['catch'](handleError(_0x2a1d1d,null));};exports[_0x85b1('0xaa')]=function(_0x47ebb5,_0x45fff0){return db[_0x85b1('0x41')][_0x85b1('0x4a')]({'where':{'id':_0x47ebb5[_0x85b1('0x3e')]['id']}})[_0x85b1('0x18')](handleEntityNotFound(_0x45fff0,null))[_0x85b1('0x18')](function(_0x253154){if(_0x253154){return _0x253154[_0x85b1('0xab')](_0x47ebb5['body'][_0x85b1('0x96')],_[_0x85b1('0x97')](_0x47ebb5[_0x85b1('0x30')],['ids','id'])||{})[_0x85b1('0xac')](function(){return db[_0x85b1('0xad')][_0x85b1('0x39')]({'attributes':['id','name',_0x85b1('0xae')],'where':{'id':_0x47ebb5[_0x85b1('0x30')]['ids']}});})[_0x85b1('0x18')](function(_0x204fc7){socket['emit'](_0x85b1('0xaf'),{'id':Number(_0x47ebb5[_0x85b1('0x3e')]['id']),'tags':_0x204fc7||[]});return{'id':Number(_0x47ebb5[_0x85b1('0x3e')]['id']),'tags':_0x204fc7||[]};});}})['then'](respondWithResult(_0x45fff0,null))[_0x85b1('0x3c')](handleError(_0x45fff0,null));};exports['removeTags']=function(_0x4deb77,_0x46a3de){return db[_0x85b1('0x41')][_0x85b1('0x4a')]({'where':{'id':_0x4deb77[_0x85b1('0x3e')]['id']}})[_0x85b1('0x18')](handleEntityNotFound(_0x46a3de,null))['then'](function(_0x24f91c){if(_0x24f91c){return _0x24f91c['removeTags'](_0x4deb77['query'][_0x85b1('0x96')]);}})['then'](respondWithStatusCode(_0x46a3de,null))[_0x85b1('0x3c')](handleError(_0x46a3de,null));};exports[_0x85b1('0x77')]=function(_0x582600,_0x3b8246){var _0x101b7e=moment()[_0x85b1('0xb0')]()[_0x85b1('0xb1')]();var _0x583646=path['join'](config[_0x85b1('0x75')],_0x85b1('0xb2'),_0x85b1('0xb3'),_0x85b1('0xb4'));var _0x53baee=path[_0x85b1('0x74')](config[_0x85b1('0x75')],_0x85b1('0xb2'),_0x85b1('0xb3'),'attachments');var _0x4e9b4e=path[_0x85b1('0x74')](_0x583646,_0x101b7e);var _0x562358=util[_0x85b1('0x7b')]('transcript-%d-%s.zip',_0x582600[_0x85b1('0x3e')]['id'],_0x101b7e);var _0x5a7675=path[_0x85b1('0x74')](_0x583646,_0x562358);var _0x7339b=[];_0x7339b[_0x85b1('0xb5')]({'model':db[_0x85b1('0x80')],'as':'User','attributes':['id',_0x85b1('0x89')],'raw':!![]});_0x7339b[_0x85b1('0xb5')]({'model':db[_0x85b1('0x81')],'as':'Contact','attributes':['id',_0x85b1('0xb6'),_0x85b1('0xb7')],'raw':!![]});if(_0x582600['query'][_0x85b1('0xb8')]){_0x7339b['push']({'model':db[_0x85b1('0x70')],'as':'Attachment','raw':!![]});}var _0xce464d=[{'model':db[_0x85b1('0x5f')],'as':'Messages','attributes':['id',_0x85b1('0x30'),_0x85b1('0xb9'),_0x85b1('0xba'),_0x85b1('0xbb'),'read'],'include':_0x7339b}];_0xce464d[_0x85b1('0xb5')]({'model':db[_0x85b1('0xbc')],'as':_0x85b1('0xbd'),'attributes':['id',_0x85b1('0x2e')]});_0xce464d[_0x85b1('0xb5')]({'model':db[_0x85b1('0x80')],'as':_0x85b1('0xbe'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x85b1('0x4a')]({'where':{'id':_0x582600[_0x85b1('0x3e')]['id']},'include':_0xce464d})[_0x85b1('0x18')](handleEntityNotFound(_0x3b8246,null))['then'](function(_0xddb3f3){if(_0xddb3f3){var _0x2d728e=_0xddb3f3[_0x85b1('0xbf')]({'plain':!![]});fs[_0x85b1('0xc0')](_0x4e9b4e);var _0x125262={'channel':_0x85b1('0xc1'),'account':_0x2d728e[_0x85b1('0xbd')][_0x85b1('0x2e')],'agent':_0x2d728e[_0x85b1('0xbe')]?_0x2d728e[_0x85b1('0xbe')][_0x85b1('0x89')]:_0x85b1('0xc2'),'createdAt':moment(_0x2d728e['createdAt'])[_0x85b1('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x85b1('0xb1')](),'closedAt':_0x2d728e[_0x85b1('0x66')]?moment(_0x2d728e['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x85b1('0xb1')]():'','disposition':_0x2d728e['disposition'],'chatInfo':{'browser':_0x2d728e[_0x85b1('0xc3')],'os':_0x2d728e[_0x85b1('0xc4')],'referer':_0x2d728e[_0x85b1('0xc5')],'customerIp':_0x2d728e[_0x85b1('0xc6')],'customerPort':_0x2d728e[_0x85b1('0xc7')]?_0x2d728e[_0x85b1('0xc7')]:_0x85b1('0xc2')},'messages':_(_0x2d728e[_0x85b1('0x7f')])[_0x85b1('0xc8')]()[_0x85b1('0xa0')]({'secret':![]})[_0x85b1('0x36')](function(_0x284b52){if(_0x284b52[_0x85b1('0x70')]){var _0x20dcfa=path[_0x85b1('0x74')](_0x53baee,_0x284b52[_0x85b1('0x70')][_0x85b1('0x6c')]);if(fs['existsSync'](_0x20dcfa)){fs[_0x85b1('0xc9')](_0x20dcfa)['pipe'](fs[_0x85b1('0xca')](path[_0x85b1('0x74')](_0x4e9b4e,_0x284b52[_0x85b1('0x70')][_0x85b1('0x6c')])));}}return{'date':moment(_0x284b52[_0x85b1('0xb9')])[_0x85b1('0x7b')](_0x85b1('0xa3'))['toString'](),'sender':_0x284b52[_0x85b1('0xba')]===_0x85b1('0x5e')?_0x284b52[_0x85b1('0x80')]?_0x284b52[_0x85b1('0x80')][_0x85b1('0x89')]:_0x85b1('0x84'):_0x284b52['Contact']['firstName']+(_0x284b52[_0x85b1('0xcb')]['lastName']?'\x20'+_0x284b52[_0x85b1('0xcb')][_0x85b1('0xb7')]:''),'body':_0x284b52['Attachment']?_0x284b52[_0x85b1('0x70')][_0x85b1('0x6c')]:_0x284b52[_0x85b1('0x30')],'direction':_0x284b52['direction']===_0x85b1('0x5e')?'A':'C','secret':_0x284b52[_0x85b1('0xbb')],'read':_0x284b52['read'],'attachment':_0x284b52['Attachment']};})[_0x85b1('0xcc')]()};return ejs[_0x85b1('0xcd')](path['join'](config[_0x85b1('0x75')],_0x85b1('0xb2'),_0x85b1('0xce'),'downloadInteraction.ejs'),{'interaction':_0x125262})[_0x85b1('0x18')](function(_0x570aed){var _0x4649cd=path['join'](_0x4e9b4e,_0x85b1('0xcf')+_0x2d728e['id']+'-'+_0x101b7e+_0x85b1('0xd0'));var _0x30d4f6={'path':_0x4649cd,'channel':'Chat','interactionId':_0x2d728e['id']};return pdf[_0x85b1('0xd1')](_0x570aed,_0x30d4f6);})['then'](function(){return new Promise(function(_0x54a95c,_0x5ac411){zipdir(_0x4e9b4e,{'saveTo':_0x5a7675},function(_0x12f64b,_0x193a35){if(_0x12f64b)return _0x5ac411(_0x12f64b);return _0x54a95c(_0x193a35);});})[_0x85b1('0x18')](function(){return new BPromise(function(_0x4148b1,_0xc3fdcd){rimraf(_0x4e9b4e,function(_0x7c2255){if(_0x7c2255)_0xc3fdcd(_0x7c2255);return _0x4148b1();});});})[_0x85b1('0x18')](function(){return _0x3b8246[_0x85b1('0x77')](_0x5a7675,_0x562358,function(_0x350515){if(_0x350515){logger[_0x85b1('0x1f')](_0x85b1('0xd2'),_0x350515);}else{fs['unlinkSync'](_0x5a7675);}});});});}else{return _0x3b8246[_0x85b1('0x22')](0xc8);}})['catch'](handleError(_0x3b8246,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 7dffc10..a9e06dc 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 _0xdfe3=['ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','emit','catch','exports','../../mysqldb'];(function(_0x40f64d,_0x3f88fa){var _0x53171c=function(_0x5d4ded){while(--_0x5d4ded){_0x40f64d['push'](_0x40f64d['shift']());}};_0x53171c(++_0x3f88fa);}(_0xdfe3,0x67));var _0x3dfe=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xdfe3[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x3dfe('0x0'))['db'][_0x3dfe('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3dfe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dfe('0x3'),'afterDestroy':_0x3dfe('0x4')};function emitEvent(_0x185da8){return function(_0x4c74a9,_0x806125,_0x1dcdac){_0x4c74a9[_0x3dfe('0x5')]({'attributes':['id'],'raw':!![]})[_0x3dfe('0x6')](function(_0x592770){_0x4c74a9[_0x3dfe('0x7')](_0x3dfe('0x8'),_0x592770['map'](function(_0x40cbcd){return{'id':_0x40cbcd['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4c74a9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f7e81){_0x4c74a9[_0x3dfe('0x7')](_0x3dfe('0x9'),_0x3f7e81['length']);ChatInteractionEvents[_0x3dfe('0xa')](_0x185da8+':'+_0x4c74a9['id'],_0x4c74a9);ChatInteractionEvents[_0x3dfe('0xa')](_0x185da8,_0x4c74a9);_0x1dcdac(null);})[_0x3dfe('0xb')](_0x1dcdac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x3dfe('0xc')]=ChatInteractionEvents; \ No newline at end of file +var _0x0f43=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map'];(function(_0x111ccc,_0x4f5094){var _0x5bd2a5=function(_0x3a31dd){while(--_0x3a31dd){_0x111ccc['push'](_0x111ccc['shift']());}};_0x5bd2a5(++_0x4f5094);}(_0x0f43,0x184));var _0x30f4=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0f43[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0x30f4('0x0'));var ChatInteraction=require(_0x30f4('0x1'))['db'][_0x30f4('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x30f4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x30f4('0x4')](0x0);var events={'afterCreate':_0x30f4('0x5'),'afterUpdate':_0x30f4('0x6'),'afterDestroy':'remove'};function emitEvent(_0x517deb){return function(_0x1bfb22,_0x5a2e05,_0x7a6a7b){_0x1bfb22[_0x30f4('0x7')]({'attributes':['id'],'raw':!![]})[_0x30f4('0x8')](function(_0x1158b3){_0x1bfb22[_0x30f4('0x9')]('Users',_0x1158b3[_0x30f4('0xa')](function(_0x19dd7d){return{'id':_0x19dd7d['id']};}));return ChatMessage[_0x30f4('0xb')]({'where':{'ChatInteractionId':_0x1bfb22['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x23c2f0){_0x1bfb22[_0x30f4('0x9')](_0x30f4('0xc'),_0x23c2f0[_0x30f4('0xd')]);ChatInteractionEvents['emit'](_0x517deb+':'+_0x1bfb22['id'],_0x1bfb22);ChatInteractionEvents[_0x30f4('0xe')](_0x517deb,_0x1bfb22);_0x7a6a7b(null);})[_0x30f4('0xf')](_0x7a6a7b(null));};}for(var e in events){if(events[_0x30f4('0x10')](e)){var event=events[e];ChatInteraction[_0x30f4('0x11')](e,emitEvent(event));}}module[_0x30f4('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index cc28a19..257e224 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 _0xec6e=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatInteraction.attributes','exports','define'];(function(_0x5b19fe,_0x1671fa){var _0x4e2b4d=function(_0x5e2326){while(--_0x5e2326){_0x5b19fe['push'](_0x5b19fe['shift']());}};_0x4e2b4d(++_0x1671fa);}(_0xec6e,0x1aa));var _0xeec6=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0xec6e[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0xeec6('0x0'));var util=require(_0xeec6('0x1'));var logger=require(_0xeec6('0x2'))(_0xeec6('0x3'));var moment=require(_0xeec6('0x4'));var BPromise=require(_0xeec6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeec6('0x6'));var rimraf=require(_0xeec6('0x7'));var config=require('../../config/environment');var attributes=require(_0xeec6('0x8'));module[_0xeec6('0x9')]=function(_0x388d29,_0x1674f2){return _0x388d29[_0xeec6('0xa')](_0xeec6('0xb'),attributes,{'tableName':_0xeec6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19af09,_0x246274,_0x970213){if(_0x19af09[_0xeec6('0xd')](_0xeec6('0xe'))){_0x19af09[_0xeec6('0xf')]=moment()[_0xeec6('0x10')](_0xeec6('0x11'));}_0x970213(null,_0x19af09);}},'charset':'utf8mb4','collate':_0xeec6('0x12')});}; \ No newline at end of file +var _0x777d=['api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x777d,0x140));var _0xd777=function(_0x1c3386,_0x2868c0){_0x1c3386=_0x1c3386-0x0;var _0x2cc8e9=_0x777d[_0x1c3386];return _0x2cc8e9;};'use strict';var _=require(_0xd777('0x0'));var util=require(_0xd777('0x1'));var logger=require(_0xd777('0x2'))(_0xd777('0x3'));var moment=require(_0xd777('0x4'));var BPromise=require('bluebird');var rp=require(_0xd777('0x5'));var fs=require('fs');var path=require(_0xd777('0x6'));var rimraf=require(_0xd777('0x7'));var config=require(_0xd777('0x8'));var attributes=require(_0xd777('0x9'));module['exports']=function(_0x59ff84,_0x2a307b){return _0x59ff84[_0xd777('0xa')](_0xd777('0xb'),attributes,{'tableName':_0xd777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ee61c,_0x22f48c,_0x235d96){if(_0x3ee61c['changed']('closed')){_0x3ee61c[_0xd777('0xd')]=moment()[_0xd777('0xe')](_0xd777('0xf'));}_0x235d96(null,_0x3ee61c);}},'charset':_0xd777('0x10'),'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 f1cbe5a..2d86a02 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 _0xd8bb=['redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x507b5f,_0xc798c8){var _0x30af9d=function(_0x225f1d){while(--_0x225f1d){_0x507b5f['push'](_0x507b5f['shift']());}};_0x30af9d(++_0xc798c8);}(_0xd8bb,0x1cf));var _0xbd8b=function(_0x577398,_0x3da6d7){_0x577398=_0x577398-0x0;var _0x46da2f=_0xd8bb[_0x577398];return _0x46da2f;};'use strict';var _=require('lodash');var util=require(_0xbd8b('0x0'));var moment=require(_0xbd8b('0x1'));var BPromise=require(_0xbd8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd8b('0x3'));var db=require(_0xbd8b('0x4'))['db'];var utils=require(_0xbd8b('0x5'));var logger=require(_0xbd8b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbd8b('0x7'));var client=jayson[_0xbd8b('0x8')][_0xbd8b('0x9')]({'port':0x232a});config[_0xbd8b('0xa')]=_[_0xbd8b('0xb')](config['redis'],{'host':_0xbd8b('0xc'),'port':0x18eb});var socket=require(_0xbd8b('0xd'))(new Redis(config['redis']));require(_0xbd8b('0xe'))[_0xbd8b('0xf')](socket);function respondWithRpcPromise(_0x61bf75,_0x35feeb,_0x397ca9){return new BPromise(function(_0xed869a,_0x3a13a4){return client[_0xbd8b('0x10')](_0x61bf75,_0x397ca9)[_0xbd8b('0x11')](function(_0xc2dccc){logger[_0xbd8b('0x12')](_0xbd8b('0x13'),_0x35feeb,'request\x20sent');logger[_0xbd8b('0x14')](_0xbd8b('0x15'),_0x35feeb,_0xbd8b('0x16'),JSON[_0xbd8b('0x17')](_0xc2dccc));if(_0xc2dccc[_0xbd8b('0x18')]){if(_0xc2dccc['error'][_0xbd8b('0x19')]===0x1f4){logger[_0xbd8b('0x18')](_0xbd8b('0x13'),_0x35feeb,_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);return _0x3a13a4(_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);}logger[_0xbd8b('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x35feeb,_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);return _0xed869a(_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);}else{logger[_0xbd8b('0x12')](_0xbd8b('0x13'),_0x35feeb,'request\x20sent');_0xed869a(_0xc2dccc[_0xbd8b('0x1b')]['message']);}})[_0xbd8b('0x1c')](function(_0x530310){logger[_0xbd8b('0x18')](_0xbd8b('0x13'),_0x35feeb,_0x530310);_0x3a13a4(_0x530310);});});}exports[_0xbd8b('0x1d')]=function(_0x34a4c0){var _0x21ee60=this;return new Promise(function(_0x57b152,_0x174a47){return db['ChatInteraction'][_0xbd8b('0x1e')](_0x34a4c0[_0xbd8b('0x1f')],{'raw':_0x34a4c0[_0xbd8b('0x20')]?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34a4c0[_0xbd8b('0x20')]?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x22')]||null:null,'attributes':_0x34a4c0['options']?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x23')]||null:null,'limit':_0x34a4c0['options']?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x24')]||null:null})[_0xbd8b('0x11')](function(_0x444f97){logger['info'](_0xbd8b('0x1d'),_0x34a4c0);logger[_0xbd8b('0x14')]('UpdateChatInteraction',_0x34a4c0,JSON[_0xbd8b('0x17')](_0x444f97));_0x57b152(_0x444f97);})[_0xbd8b('0x1c')](function(_0x414acc){logger['error'](_0xbd8b('0x1d'),_0x414acc[_0xbd8b('0x1a')],_0x34a4c0);_0x174a47(_0x21ee60[_0xbd8b('0x18')](0x1f4,_0x414acc[_0xbd8b('0x1a')]));});});};exports[_0xbd8b('0x25')]=function(_0x2b0630){return new Promise(function(_0x4e8bdc,_0x686609){return db[_0xbd8b('0x26')][_0xbd8b('0x27')]({'where':_0x2b0630['options']?_0x2b0630[_0xbd8b('0x20')]['where']||null:null})[_0xbd8b('0x11')](function(_0x2b56ba){if(_0x2b56ba){return _0x2b56ba[_0xbd8b('0x28')](_0x2b0630['body'][_0xbd8b('0x29')],_['omit'](_0x2b0630[_0xbd8b('0x1f')],[_0xbd8b('0x29'),'id'])||{});}})['spread'](function(_0x140516){logger[_0xbd8b('0x12')](_0xbd8b('0x2a'),_0x2b0630);logger[_0xbd8b('0x14')](_0xbd8b('0x2a'),_0x2b0630,JSON[_0xbd8b('0x17')](_0x140516));_0x4e8bdc(_0x140516);})[_0xbd8b('0x1c')](function(_0x5c23b9){logger[_0xbd8b('0x18')](_0xbd8b('0x2a'),_0x5c23b9[_0xbd8b('0x1a')],_0x2b0630);_0x686609(_this[_0xbd8b('0x18')](0x1f4,_0x5c23b9[_0xbd8b('0x1a')]));});});}; \ No newline at end of file +var _0xdbfd=['body','options','limit','AddTagsToChatInteraction','find','where','addTags','omit','ids','AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update'];(function(_0x1e5cfb,_0x56d0b5){var _0x35a401=function(_0x5b92a9){while(--_0x5b92a9){_0x1e5cfb['push'](_0x1e5cfb['shift']());}};_0x35a401(++_0x56d0b5);}(_0xdbfd,0x129));var _0xddbf=function(_0x259dbb,_0x213269){_0x259dbb=_0x259dbb-0x0;var _0x4a6371=_0xdbfd[_0x259dbb];return _0x4a6371;};'use strict';var _=require(_0xddbf('0x0'));var util=require(_0xddbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddbf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddbf('0x3'))['db'];var utils=require(_0xddbf('0x4'));var logger=require(_0xddbf('0x5'))(_0xddbf('0x6'));var config=require(_0xddbf('0x7'));var jayson=require(_0xddbf('0x8'));var client=jayson[_0xddbf('0x9')][_0xddbf('0xa')]({'port':0x232a});config[_0xddbf('0xb')]=_['defaults'](config[_0xddbf('0xb')],{'host':_0xddbf('0xc'),'port':0x18eb});var socket=require(_0xddbf('0xd'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xddbf('0xe')](socket);function respondWithRpcPromise(_0x1993b1,_0x779e9,_0x194c40){return new BPromise(function(_0x270192,_0x895557){return client[_0xddbf('0xf')](_0x1993b1,_0x194c40)[_0xddbf('0x10')](function(_0x8262d6){logger[_0xddbf('0x11')](_0xddbf('0x12'),_0x779e9,'request\x20sent');logger[_0xddbf('0x13')](_0xddbf('0x14'),_0x779e9,_0xddbf('0x15'),JSON[_0xddbf('0x16')](_0x8262d6));if(_0x8262d6[_0xddbf('0x17')]){if(_0x8262d6[_0xddbf('0x17')][_0xddbf('0x18')]===0x1f4){logger[_0xddbf('0x17')](_0xddbf('0x12'),_0x779e9,_0x8262d6[_0xddbf('0x17')][_0xddbf('0x19')]);return _0x895557(_0x8262d6[_0xddbf('0x17')][_0xddbf('0x19')]);}logger[_0xddbf('0x17')](_0xddbf('0x12'),_0x779e9,_0x8262d6[_0xddbf('0x17')]['message']);return _0x270192(_0x8262d6[_0xddbf('0x17')]['message']);}else{logger[_0xddbf('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x779e9,'request\x20sent');_0x270192(_0x8262d6[_0xddbf('0x1a')]['message']);}})[_0xddbf('0x1b')](function(_0xec6f75){logger[_0xddbf('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x779e9,_0xec6f75);_0x895557(_0xec6f75);});});}exports[_0xddbf('0x1c')]=function(_0x2ff072){var _0x398724=this;return new Promise(function(_0x55c3f0,_0x1ecb47){return db[_0xddbf('0x1d')][_0xddbf('0x1e')](_0x2ff072[_0xddbf('0x1f')],{'raw':_0x2ff072[_0xddbf('0x20')]?_0x2ff072[_0xddbf('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff072[_0xddbf('0x20')]?_0x2ff072[_0xddbf('0x20')]['where']||null:null,'attributes':_0x2ff072[_0xddbf('0x20')]?_0x2ff072[_0xddbf('0x20')]['attributes']||null:null,'limit':_0x2ff072['options']?_0x2ff072[_0xddbf('0x20')][_0xddbf('0x21')]||null:null})['then'](function(_0x5b749a){logger[_0xddbf('0x11')]('UpdateChatInteraction',_0x2ff072);logger['debug'](_0xddbf('0x1c'),_0x2ff072,JSON[_0xddbf('0x16')](_0x5b749a));_0x55c3f0(_0x5b749a);})['catch'](function(_0x428808){logger[_0xddbf('0x17')](_0xddbf('0x1c'),_0x428808['message'],_0x2ff072);_0x1ecb47(_0x398724['error'](0x1f4,_0x428808[_0xddbf('0x19')]));});});};exports[_0xddbf('0x22')]=function(_0x5f55d3){return new Promise(function(_0x411260,_0x32e4a1){return db[_0xddbf('0x1d')][_0xddbf('0x23')]({'where':_0x5f55d3[_0xddbf('0x20')]?_0x5f55d3['options'][_0xddbf('0x24')]||null:null})[_0xddbf('0x10')](function(_0x174d12){if(_0x174d12){return _0x174d12[_0xddbf('0x25')](_0x5f55d3[_0xddbf('0x1f')]['ids'],_[_0xddbf('0x26')](_0x5f55d3[_0xddbf('0x1f')],[_0xddbf('0x27'),'id'])||{});}})['spread'](function(_0x2ca59d){logger['info']('AddTags',_0x5f55d3);logger[_0xddbf('0x13')]('AddTags',_0x5f55d3,JSON[_0xddbf('0x16')](_0x2ca59d));_0x411260(_0x2ca59d);})['catch'](function(_0x5cde59){logger['error'](_0xddbf('0x28'),_0x5cde59[_0xddbf('0x19')],_0x5f55d3);_0x32e4a1(_this[_0xddbf('0x17')](0x1f4,_0x5cde59[_0xddbf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5c88167..216a524 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 _0xf0e5=['remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x5d36d9,_0x1b7e5e){var _0xb4ed5f=function(_0x50152a){while(--_0x50152a){_0x5d36d9['push'](_0x5d36d9['shift']());}};_0xb4ed5f(++_0x1b7e5e);}(_0xf0e5,0x1e3));var _0x5f0e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf0e5[_0x263a74];return _0x2aa86c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x5f0e('0x0'),_0x5f0e('0x1')];function createListener(_0xb1c2b4,_0x29e869){return function(_0x53f8b8){_0x29e869[_0x5f0e('0x2')](_0xb1c2b4,_0x53f8b8);};}function removeListener(_0x2881e9,_0x7d51ee){return function(){ChatInteractionEvents[_0x5f0e('0x3')](_0x2881e9,_0x7d51ee);};}exports[_0x5f0e('0x4')]=function(_0x24b01d){for(var _0x23ef12=0x0,_0x3aa22b=events[_0x5f0e('0x5')];_0x23ef12<_0x3aa22b;_0x23ef12++){var _0x3c8679=events[_0x23ef12];var _0x305854=createListener(_0x5f0e('0x6')+_0x3c8679,_0x24b01d);ChatInteractionEvents['on'](_0x3c8679,_0x305854);}}; \ No newline at end of file +var _0x1dc2=['./chatInteraction.events','save','remove','update','emit','removeListener','register','chatInteraction:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1dc2,0xb0));var _0x21dc=function(_0x459bea,_0x188d0a){_0x459bea=_0x459bea-0x0;var _0x43fe4d=_0x1dc2[_0x459bea];return _0x43fe4d;};'use strict';var ChatInteractionEvents=require(_0x21dc('0x0'));var events=[_0x21dc('0x1'),_0x21dc('0x2'),_0x21dc('0x3')];function createListener(_0x59b0a1,_0x12b92b){return function(_0x4c8d90){_0x12b92b[_0x21dc('0x4')](_0x59b0a1,_0x4c8d90);};}function removeListener(_0x328896,_0x2353e6){return function(){ChatInteractionEvents[_0x21dc('0x5')](_0x328896,_0x2353e6);};}exports[_0x21dc('0x6')]=function(_0x1de21c){for(var _0x250848=0x0,_0xb19e15=events['length'];_0x250848<_0xb19e15;_0x250848++){var _0x8d620c=events[_0x250848];var _0x2bb9d3=createListener(_0x21dc('0x7')+_0x8d620c,_0x1de21c);ChatInteractionEvents['on'](_0x8d620c,_0x2bb9d3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2675d11..bf8542f 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 _0xcc0d=['/:id/messages','getMessages','/:id/download','post','/:id/vidaoo','root','format','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','/:id','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','attachmentDownload'];(function(_0x30df8d,_0x40b784){var _0x458428=function(_0x5ef49d){while(--_0x5ef49d){_0x30df8d['push'](_0x30df8d['shift']());}};_0x458428(++_0x40b784);}(_0xcc0d,0x187));var _0xdcc0=function(_0x585761,_0x276e8e){_0x585761=_0x585761-0x0;var _0x14a673=_0xcc0d[_0x585761];return _0x14a673;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdcc0('0x0'));var timeout=require(_0xdcc0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdcc0('0x2'));var auth=require(_0xdcc0('0x3'));var interaction=require(_0xdcc0('0x4'));var config=require(_0xdcc0('0x5'));var controller=require(_0xdcc0('0x6'));router[_0xdcc0('0x7')]('/',auth[_0xdcc0('0x8')](),controller[_0xdcc0('0x9')]);router['get'](_0xdcc0('0xa'),auth[_0xdcc0('0x8')](),controller[_0xdcc0('0xb')]);router[_0xdcc0('0x7')]('/:id',auth[_0xdcc0('0xc')](),controller['show']);router[_0xdcc0('0x7')]('/:id/attachment_download',auth[_0xdcc0('0xc')](),controller[_0xdcc0('0xd')]);router[_0xdcc0('0x7')](_0xdcc0('0xe'),auth[_0xdcc0('0x8')](),controller[_0xdcc0('0xf')]);router[_0xdcc0('0x7')]('/:id/my_messages',auth[_0xdcc0('0xc')](),controller['getMyMessages']);router[_0xdcc0('0x7')](_0xdcc0('0x10'),auth['isAuthenticated'](),controller['download']);router[_0xdcc0('0x11')]('/',auth[_0xdcc0('0x8')](),controller['create']);router['post'](_0xdcc0('0x12'),auth[_0xdcc0('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x406269,_0x19b1bf,_0x1f1946){_0x1f1946(null,path['join'](config[_0xdcc0('0x13')],'server/files/attachments/'));},'filename':function(_0x1473c0,_0x55fadc,_0x2179ab){_0x2179ab(null,util[_0xdcc0('0x14')]('%s-%s',Date['now'](),_0x55fadc[_0xdcc0('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xdcc0('0x16'),upload[_0xdcc0('0x17')]('file'),controller[_0xdcc0('0x18')]);router[_0xdcc0('0x11')](_0xdcc0('0xe'),auth[_0xdcc0('0xc')](),controller[_0xdcc0('0x19')]);router[_0xdcc0('0x11')](_0xdcc0('0x1a'),auth[_0xdcc0('0x8')](),interaction['tracked'](_0xdcc0('0x1b'),_0xdcc0('0x1c')),controller[_0xdcc0('0x1d')]);router[_0xdcc0('0x1e')](_0xdcc0('0x1f'),auth[_0xdcc0('0x8')](),interaction[_0xdcc0('0x20')]('chat',_0xdcc0('0x21')),controller[_0xdcc0('0x22')]);router[_0xdcc0('0x1e')](_0xdcc0('0x23'),controller[_0xdcc0('0x24')]);router[_0xdcc0('0x1e')](_0xdcc0('0x25'),auth['isChatInteractionAuthorized'](),controller[_0xdcc0('0x26')]);router[_0xdcc0('0x1e')](_0xdcc0('0x27'),controller[_0xdcc0('0x28')]);router['delete']('/:id',auth[_0xdcc0('0x8')](),interaction[_0xdcc0('0x20')]('chat',_0xdcc0('0x29')),controller[_0xdcc0('0x2a')]);router['delete']('/:id/tags',auth[_0xdcc0('0x8')](),controller[_0xdcc0('0x2b')]);module[_0xdcc0('0x2c')]=router; \ No newline at end of file +var _0x0dfb=['chat','chatinteraction:addtags','chatinteraction:update','customUpdate','/:id/abandon','abandon','put','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked'];(function(_0x5c0a22,_0x3e0eb3){var _0x292d8e=function(_0x28c9e6){while(--_0x28c9e6){_0x5c0a22['push'](_0x5c0a22['shift']());}};_0x292d8e(++_0x3e0eb3);}(_0x0dfb,0xfe));var _0xb0df=function(_0x5df9bf,_0x163e5e){_0x5df9bf=_0x5df9bf-0x0;var _0x4a7c89=_0x0dfb[_0x5df9bf];return _0x4a7c89;};'use strict';var multer=require(_0xb0df('0x0'));var util=require(_0xb0df('0x1'));var path=require(_0xb0df('0x2'));var timeout=require(_0xb0df('0x3'));var express=require(_0xb0df('0x4'));var router=express[_0xb0df('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0df('0x6'));var config=require('../../config/environment');var controller=require(_0xb0df('0x7'));router[_0xb0df('0x8')]('/',auth[_0xb0df('0x9')](),controller[_0xb0df('0xa')]);router[_0xb0df('0x8')]('/describe',auth[_0xb0df('0x9')](),controller['describe']);router['get']('/:id',auth[_0xb0df('0xb')](),controller['show']);router[_0xb0df('0x8')](_0xb0df('0xc'),auth[_0xb0df('0xb')](),controller['attachmentDownload']);router[_0xb0df('0x8')](_0xb0df('0xd'),auth[_0xb0df('0x9')](),controller[_0xb0df('0xe')]);router['get'](_0xb0df('0xf'),auth[_0xb0df('0xb')](),controller[_0xb0df('0x10')]);router[_0xb0df('0x8')](_0xb0df('0x11'),auth[_0xb0df('0x9')](),controller[_0xb0df('0x12')]);router['post']('/',auth[_0xb0df('0x9')](),controller['create']);router[_0xb0df('0x13')](_0xb0df('0x14'),auth[_0xb0df('0x9')](),controller[_0xb0df('0x15')]);var upload=multer({'storage':multer[_0xb0df('0x16')]({'destination':function(_0x4cf29a,_0x2df449,_0x48a67c){_0x48a67c(null,path[_0xb0df('0x17')](config[_0xb0df('0x18')],'server/files/attachments/'));},'filename':function(_0xcd8330,_0x3ef1c5,_0x5b432a){_0x5b432a(null,util[_0xb0df('0x19')]('%s-%s',Date['now'](),_0x3ef1c5['originalname'][_0xb0df('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb0df('0x13')](_0xb0df('0x1b'),upload[_0xb0df('0x1c')](_0xb0df('0x1d')),controller[_0xb0df('0x1e')]);router['post'](_0xb0df('0xd'),auth[_0xb0df('0xb')](),controller[_0xb0df('0x1f')]);router[_0xb0df('0x13')](_0xb0df('0x20'),auth[_0xb0df('0x9')](),interaction[_0xb0df('0x21')](_0xb0df('0x22'),_0xb0df('0x23')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xb0df('0x21')]('chat',_0xb0df('0x24')),controller['update']);router['put']('/:id/custom_update',controller[_0xb0df('0x25')]);router['put'](_0xb0df('0x26'),auth[_0xb0df('0xb')](),controller[_0xb0df('0x27')]);router[_0xb0df('0x28')](_0xb0df('0x29'),controller[_0xb0df('0x2a')]);router[_0xb0df('0x2b')](_0xb0df('0x2c'),auth[_0xb0df('0x9')](),interaction[_0xb0df('0x21')](_0xb0df('0x22'),_0xb0df('0x2d')),controller[_0xb0df('0x2e')]);router[_0xb0df('0x2b')](_0xb0df('0x20'),auth[_0xb0df('0x9')](),controller[_0xb0df('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 58ea7aa..7af8825 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 _0xb7ee=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0x5b5c87,_0x101049){var _0x26605d=function(_0x6f0e0e){while(--_0x6f0e0e){_0x5b5c87['push'](_0x5b5c87['shift']());}};_0x26605d(++_0x101049);}(_0xb7ee,0xff));var _0xeb7e=function(_0x12dfa1,_0x36ff32){_0x12dfa1=_0x12dfa1-0x0;var _0x5db581=_0xb7ee[_0x12dfa1];return _0x5db581;};'use strict';var Sequelize=require(_0xeb7e('0x0'));module[_0xeb7e('0x1')]={'body':{'type':Sequelize[_0xeb7e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeb7e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xeb7e('0x4')]}}; \ No newline at end of file +var _0x2795=['exports','TEXT','medium','sequelize'];(function(_0x44f1ce,_0x243e88){var _0x207173=function(_0x218db1){while(--_0x218db1){_0x44f1ce['push'](_0x44f1ce['shift']());}};_0x207173(++_0x243e88);}(_0x2795,0x123));var _0x5279=function(_0x46e607,_0x590b96){_0x46e607=_0x46e607-0x0;var _0x59602d=_0x2795[_0x46e607];return _0x59602d;};'use strict';var Sequelize=require(_0x5279('0x0'));module[_0x5279('0x1')]={'body':{'type':Sequelize[_0x5279('0x2')](_0x5279('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'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 0fbd080..dcc709b 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 _0x4749=['map','VIRTUAL','options','includeAll','findAll','catch','keys','rawAttributes','include','find','create','body','params','destroy','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','agent','FromId','-createdAt','all','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','ChatInternalMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge'];(function(_0xea23f8,_0x2b76d2){var _0x437658=function(_0x22af97){while(--_0x22af97){_0xea23f8['push'](_0xea23f8['shift']());}};_0x437658(++_0x2b76d2);}(_0x4749,0x1da));var _0x9474=function(_0x258717,_0x3060cc){_0x258717=_0x258717-0x0;var _0x15a6ae=_0x4749[_0x258717];return _0x15a6ae;};'use strict';var emlformat=require(_0x9474('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9474('0x1'));var moment=require('moment');var BPromise=require(_0x9474('0x2'));var Mustache=require(_0x9474('0x3'));var util=require('util');var path=require(_0x9474('0x4'));var sox=require(_0x9474('0x5'));var csv=require(_0x9474('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9474('0x7'));var squel=require(_0x9474('0x8'));var crypto=require('crypto');var jsforce=require(_0x9474('0x9'));var deskjs=require(_0x9474('0xa'));var toCsv=require(_0x9474('0x6'));var querystring=require(_0x9474('0xb'));var Papa=require(_0x9474('0xc'));var Redis=require(_0x9474('0xd'));var authService=require(_0x9474('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9474('0xf'));var hardwareService=require(_0x9474('0x10'));var logger=require(_0x9474('0x11'))(_0x9474('0x12'));var utils=require(_0x9474('0x13'));var config=require(_0x9474('0x14'));var licenseUtil=require(_0x9474('0x15'));var db=require(_0x9474('0x16'))['db'];config[_0x9474('0x17')]=_['defaults'](config[_0x9474('0x17')],{'host':_0x9474('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9474('0x17')]));require(_0x9474('0x19'))[_0x9474('0x1a')](socket);function respondWithStatusCode(_0x2d0d02,_0x4a95ab){_0x4a95ab=_0x4a95ab||0xcc;return function(_0x149065){if(_0x149065){return _0x2d0d02[_0x9474('0x1b')](_0x4a95ab);}return _0x2d0d02[_0x9474('0x1c')](_0x4a95ab)[_0x9474('0x1d')]();};}function respondWithResult(_0x36eac5,_0x544d2d){_0x544d2d=_0x544d2d||0xc8;return function(_0x5bd2f5){if(_0x5bd2f5){return _0x36eac5[_0x9474('0x1c')](_0x544d2d)['json'](_0x5bd2f5);}};}function respondWithFilteredResult(_0x538aaf,_0x55e1b2){return function(_0x19691b){if(_0x19691b){var _0xae8d68=typeof _0x55e1b2[_0x9474('0x1e')]===_0x9474('0x1f')&&typeof _0x55e1b2['limit']===_0x9474('0x1f');var _0x126321=_0x19691b[_0x9474('0x20')];var _0x8c1668=_0xae8d68?0x0:_0x55e1b2['offset'];var _0x34f4c7=_0xae8d68?_0x19691b[_0x9474('0x20')]:_0x55e1b2[_0x9474('0x1e')]+_0x55e1b2[_0x9474('0x21')];var _0x49aa21;if(_0x34f4c7>=_0x126321){_0x34f4c7=_0x126321;_0x49aa21=0xc8;}else{_0x49aa21=0xce;}_0x538aaf[_0x9474('0x1c')](_0x49aa21);return _0x538aaf[_0x9474('0x22')](_0x9474('0x23'),_0x8c1668+'-'+_0x34f4c7+'/'+_0x126321)[_0x9474('0x24')](_0x19691b);}return null;};}function patchUpdates(_0x5cc757){return function(_0x3f2de7){try{jsonpatch['apply'](_0x3f2de7,_0x5cc757,!![]);}catch(_0x1a0377){return BPromise[_0x9474('0x25')](_0x1a0377);}return _0x3f2de7[_0x9474('0x26')]();};}function saveUpdates(_0x1fce66,_0x4b1f12){return function(_0x4f0830){if(_0x4f0830){return _0x4f0830[_0x9474('0x27')](_0x1fce66)[_0x9474('0x28')](function(_0x2f95fd){return _0x2f95fd;});}return null;};}function removeEntity(_0x37dd31,_0x57d0d6){return function(_0x2a967a){if(_0x2a967a){return _0x2a967a['destroy']()['then'](function(){_0x37dd31[_0x9474('0x1c')](0xcc)[_0x9474('0x1d')]();});}};}function handleEntityNotFound(_0x3f10f3,_0x4c1a29){return function(_0x59da74){if(!_0x59da74){_0x3f10f3[_0x9474('0x1b')](0x194);}return _0x59da74;};}function handleError(_0x9f0047,_0x5bb564){_0x5bb564=_0x5bb564||0x1f4;return function(_0x1f50f5){logger[_0x9474('0x29')](_0x1f50f5[_0x9474('0x2a')]);if(_0x1f50f5[_0x9474('0x2b')]){delete _0x1f50f5[_0x9474('0x2b')];}_0x9f0047[_0x9474('0x1c')](_0x5bb564)[_0x9474('0x2c')](_0x1f50f5);};}exports['index']=function(_0x40b5b6,_0x21b347){var _0x4dfd8c={},_0x101f86={},_0x42a3b1={'count':0x0,'rows':[]};var _0x3f65e4=_['map'](db[_0x9474('0x2d')]['rawAttributes'],function(_0x5cf875){return{'name':_0x5cf875[_0x9474('0x2e')],'type':_0x5cf875[_0x9474('0x2f')][_0x9474('0x30')]};});_0x101f86[_0x9474('0x31')]=_['map'](_0x3f65e4,_0x9474('0x2b'));_0x101f86[_0x9474('0x32')]=_['keys'](_0x40b5b6['query']);_0x101f86[_0x9474('0x33')]=_[_0x9474('0x34')](_0x101f86[_0x9474('0x31')],_0x101f86['query']);_0x4dfd8c[_0x9474('0x35')]=_['intersection'](_0x101f86['model'],qs[_0x9474('0x36')](_0x40b5b6[_0x9474('0x32')]['fields']));_0x4dfd8c[_0x9474('0x35')]=_0x4dfd8c[_0x9474('0x35')][_0x9474('0x37')]?_0x4dfd8c[_0x9474('0x35')]:_0x101f86[_0x9474('0x31')];if(!_0x40b5b6[_0x9474('0x32')]['hasOwnProperty'](_0x9474('0x38'))){_0x4dfd8c[_0x9474('0x21')]=qs[_0x9474('0x21')](_0x40b5b6[_0x9474('0x32')]['limit']);_0x4dfd8c[_0x9474('0x1e')]=qs['offset'](_0x40b5b6[_0x9474('0x32')][_0x9474('0x1e')]);}_0x4dfd8c['order']=qs[_0x9474('0x39')](_0x40b5b6['query'][_0x9474('0x39')]);_0x4dfd8c[_0x9474('0x3a')]=qs['filters'](_['pick'](_0x40b5b6[_0x9474('0x32')],_0x101f86[_0x9474('0x33')]),_0x3f65e4);if(_0x40b5b6[_0x9474('0x32')][_0x9474('0x3b')]){_0x4dfd8c[_0x9474('0x3a')]=_[_0x9474('0x3c')](_0x4dfd8c[_0x9474('0x3a')],{'$or':_[_0x9474('0x3d')](_0x3f65e4,function(_0xa49c5){if(_0xa49c5[_0x9474('0x2f')]!==_0x9474('0x3e')){var _0x410d33={};_0x410d33[_0xa49c5[_0x9474('0x2b')]]={'$like':'%'+_0x40b5b6[_0x9474('0x32')]['filter']+'%'};return _0x410d33;}})});}_0x4dfd8c=_[_0x9474('0x3c')]({},_0x4dfd8c,_0x40b5b6[_0x9474('0x3f')]);var _0x455035={'where':_0x4dfd8c[_0x9474('0x3a')]};return db[_0x9474('0x2d')][_0x9474('0x20')](_0x455035)[_0x9474('0x28')](function(_0x47f198){_0x42a3b1[_0x9474('0x20')]=_0x47f198;if(_0x40b5b6[_0x9474('0x32')][_0x9474('0x40')]){_0x4dfd8c['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x9474('0x41')](_0x4dfd8c);})[_0x9474('0x28')](function(_0x1daa8c){_0x42a3b1['rows']=_0x1daa8c;return _0x42a3b1;})[_0x9474('0x28')](respondWithFilteredResult(_0x21b347,_0x4dfd8c))[_0x9474('0x42')](handleError(_0x21b347,null));};exports['show']=function(_0x54c1ad,_0x4892b6){var _0x2542c5={'raw':!![],'where':{'id':_0x54c1ad['params']['id']}},_0x479e4f={};_0x479e4f[_0x9474('0x31')]=_[_0x9474('0x43')](db['ChatInternalMessage'][_0x9474('0x44')]);_0x479e4f[_0x9474('0x32')]=_['keys'](_0x54c1ad[_0x9474('0x32')]);_0x479e4f['filters']=_['intersection'](_0x479e4f[_0x9474('0x31')],_0x479e4f[_0x9474('0x32')]);_0x2542c5[_0x9474('0x35')]=_['intersection'](_0x479e4f[_0x9474('0x31')],qs[_0x9474('0x36')](_0x54c1ad[_0x9474('0x32')][_0x9474('0x36')]));_0x2542c5['attributes']=_0x2542c5[_0x9474('0x35')][_0x9474('0x37')]?_0x2542c5[_0x9474('0x35')]:_0x479e4f['model'];if(_0x54c1ad[_0x9474('0x32')][_0x9474('0x40')]){_0x2542c5[_0x9474('0x45')]=[{'all':!![]}];}_0x2542c5=_['merge']({},_0x2542c5,_0x54c1ad['options']);return db[_0x9474('0x2d')][_0x9474('0x46')](_0x2542c5)[_0x9474('0x28')](handleEntityNotFound(_0x4892b6,null))['then'](respondWithResult(_0x4892b6,null))[_0x9474('0x42')](handleError(_0x4892b6,null));};exports['create']=function(_0xb7037d,_0x13d683){return db[_0x9474('0x2d')][_0x9474('0x47')](_0xb7037d[_0x9474('0x48')],{})['then'](respondWithResult(_0x13d683,0xc9))[_0x9474('0x42')](handleError(_0x13d683,null));};exports[_0x9474('0x27')]=function(_0xd515ca,_0x40f4e4){if(_0xd515ca[_0x9474('0x48')]['id']){delete _0xd515ca[_0x9474('0x48')]['id'];}return db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'id':_0xd515ca[_0x9474('0x49')]['id']}})[_0x9474('0x28')](handleEntityNotFound(_0x40f4e4,null))[_0x9474('0x28')](saveUpdates(_0xd515ca['body'],null))[_0x9474('0x28')](respondWithResult(_0x40f4e4,null))[_0x9474('0x42')](handleError(_0x40f4e4,null));};exports[_0x9474('0x4a')]=function(_0x22cfaa,_0x5a1685){return db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'id':_0x22cfaa[_0x9474('0x49')]['id']}})[_0x9474('0x28')](handleEntityNotFound(_0x5a1685,null))['then'](removeEntity(_0x5a1685,null))['catch'](handleError(_0x5a1685,null));};exports['describe']=function(_0x314719,_0x34949a){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x34949a,null))[_0x9474('0x42')](handleError(_0x34949a,null));};function wrapUser(_0x2a2fb5){return function(_0x172443){var _0x2a1c95=_0x2a2fb5[_0x9474('0x4b')]({'plain':!![]});_0x2a1c95[_0x9474('0x4c')]=[];if(_0x172443){_0x2a1c95[_0x9474('0x4d')]=_0x172443[_0x9474('0x4e')];_0x2a1c95[_0x9474('0x4f')]=_0x172443;}else{_0x2a1c95['lastMessageAt']=moment(0x0)[_0x9474('0x50')](_0x9474('0x51'));_0x2a1c95['lastMessage']={};}return _0x2a1c95;};}exports[_0x9474('0x52')]=function(_0x17a29d,_0x69c4bd,_0x51754c){var _0x1f691c=[];return db['User'][_0x9474('0x41')]({'where':{'role':['agent',_0x9474('0x53'),'user']},'attributes':['id','fullname','name',_0x9474('0x54'),_0x9474('0x55'),_0x9474('0x56'),_0x9474('0x57'),_0x9474('0x58'),_0x9474('0x59'),_0x9474('0x5a')],'order':qs[_0x9474('0x39')](_0x9474('0x5b')),'include':[{'model':db[_0x9474('0x5c')],'as':_0x9474('0x5d'),'attributes':['id',_0x9474('0x2b'),_0x9474('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x1fb122){if(_0x1fb122){var _0x115d92=_0x17a29d[_0x9474('0x5e')][_0x9474('0x4b')]({'plain':!![]});if(!_0x115d92)throw new Error(_0x9474('0x5f'));if(_0x115d92[_0x9474('0x54')]===_0x9474('0x5e')){return db[_0x9474('0x60')][_0x9474('0x46')]({'where':{'name':_0x9474('0x61'),'userProfileId':_0x115d92['userProfileId']},'raw':!![]})[_0x9474('0x28')](function(_0x70afc1){if(_0x70afc1){if(_0x70afc1[_0x9474('0x62')]===0x0){return db[_0x9474('0x63')]['findAll']({'where':{'sectionId':_0x70afc1['id']},'raw':!![]})[_0x9474('0x28')](function(_0xff9fde){var _0x5a7da7=[];if(_[_0x9474('0x64')](_0xff9fde)){_0x5a7da7=_[_0x9474('0x3b')](_0x1fb122,function(_0x61761f){if(_0x61761f[_0x9474('0x54')]!=='agent'){return _0x61761f;}});return _0x5a7da7;}else{for(var _0x386ccd=0x0;_0x386ccd<_0x1fb122['length'];_0x386ccd++){var _0xcc1b5=_0x1fb122[_0x386ccd];if(_0xcc1b5[_0x9474('0x54')]==='agent'){var _0xd99753=_[_0x9474('0x46')](_0xff9fde,function(_0x1d148a){return _0x1d148a[_0x9474('0x65')]===_0xcc1b5['id'];});if(_0xd99753)_0x5a7da7['push'](_0xcc1b5);}else{_0x5a7da7[_0x9474('0x66')](_0xcc1b5);}}return _0x5a7da7;}});}else{return _0x1fb122;}}else{var _0x182806=_[_0x9474('0x3b')](_0x1fb122,function(_0x41b66d){if(_0x41b66d[_0x9474('0x54')]!==_0x9474('0x67')){return _0x41b66d;}});return _0x182806;}});}else{return _0x1fb122;}}})[_0x9474('0x28')](function(_0x2c2f38){var _0x225a3a=[];if(_0x2c2f38){_0x1f691c=_0x2c2f38;for(var _0x519e49=0x0;_0x519e49<_0x2c2f38[_0x9474('0x37')];_0x519e49+=0x1){_0x1f691c[_0x519e49][_0x9474('0x4c')]=[];_0x225a3a[_0x9474('0x66')](db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'FromId':[_0x17a29d[_0x9474('0x5e')]['id'],_0x2c2f38[_0x519e49]['id']],'ToId':[_0x17a29d[_0x9474('0x5e')]['id'],_0x2c2f38[_0x519e49]['id']],'ChatGroupId':null},'attributes':['id',_0x9474('0x4e'),_0x9474('0x68'),'ToId','read','body'],'order':qs[_0x9474('0x39')](_0x9474('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9474('0x28')](wrapUser(_0x2c2f38[_0x519e49])));}return BPromise[_0x9474('0x6a')](_0x225a3a);}return[];})[_0x9474('0x28')](function(_0x7d6234){return{'rows':_0x7d6234,'count':_0x7d6234[_0x9474('0x37')]};})[_0x9474('0x28')](respondWithResult(_0x69c4bd,null))[_0x9474('0x42')](handleError(_0x69c4bd,null));}; \ No newline at end of file +var _0x8f84=['undefined','count','limit','Content-Range','save','destroy','then','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','update','body','describe','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','-createdAt','all','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x8f84,0x18e));var _0x48f8=function(_0x5da74e,_0xf1ba94){_0x5da74e=_0x5da74e-0x0;var _0x3b0d93=_0x8f84[_0x5da74e];return _0x3b0d93;};'use strict';var emlformat=require(_0x48f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x48f8('0x1'));var rp=require('request-promise');var moment=require(_0x48f8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x48f8('0x3'));var util=require('util');var path=require(_0x48f8('0x4'));var sox=require(_0x48f8('0x5'));var csv=require(_0x48f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48f8('0x7'));var _=require(_0x48f8('0x8'));var squel=require(_0x48f8('0x9'));var crypto=require(_0x48f8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x48f8('0xb'));var toCsv=require(_0x48f8('0x6'));var querystring=require(_0x48f8('0xc'));var Papa=require(_0x48f8('0xd'));var Redis=require(_0x48f8('0xe'));var authService=require(_0x48f8('0xf'));var qs=require(_0x48f8('0x10'));var as=require(_0x48f8('0x11'));var hardwareService=require(_0x48f8('0x12'));var logger=require('../../config/logger')(_0x48f8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x48f8('0x14'))['db'];config[_0x48f8('0x15')]=_[_0x48f8('0x16')](config['redis'],{'host':_0x48f8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48f8('0x15')]));require('./chatInternalMessage.socket')[_0x48f8('0x18')](socket);function respondWithStatusCode(_0x29094e,_0x1f9cd7){_0x1f9cd7=_0x1f9cd7||0xcc;return function(_0x10904b){if(_0x10904b){return _0x29094e[_0x48f8('0x19')](_0x1f9cd7);}return _0x29094e[_0x48f8('0x1a')](_0x1f9cd7)[_0x48f8('0x1b')]();};}function respondWithResult(_0xab1ca,_0x1928f0){_0x1928f0=_0x1928f0||0xc8;return function(_0x321400){if(_0x321400){return _0xab1ca[_0x48f8('0x1a')](_0x1928f0)[_0x48f8('0x1c')](_0x321400);}};}function respondWithFilteredResult(_0x3e4659,_0x44112a){return function(_0x4a29df){if(_0x4a29df){var _0xd340d7=typeof _0x44112a[_0x48f8('0x1d')]===_0x48f8('0x1e')&&typeof _0x44112a['limit']===_0x48f8('0x1e');var _0x56b1e1=_0x4a29df[_0x48f8('0x1f')];var _0x5f1d0b=_0xd340d7?0x0:_0x44112a['offset'];var _0x5dc59d=_0xd340d7?_0x4a29df[_0x48f8('0x1f')]:_0x44112a[_0x48f8('0x1d')]+_0x44112a[_0x48f8('0x20')];var _0x101031;if(_0x5dc59d>=_0x56b1e1){_0x5dc59d=_0x56b1e1;_0x101031=0xc8;}else{_0x101031=0xce;}_0x3e4659['status'](_0x101031);return _0x3e4659['set'](_0x48f8('0x21'),_0x5f1d0b+'-'+_0x5dc59d+'/'+_0x56b1e1)['json'](_0x4a29df);}return null;};}function patchUpdates(_0x35e7ed){return function(_0x503ee0){try{jsonpatch['apply'](_0x503ee0,_0x35e7ed,!![]);}catch(_0x2d37c5){return BPromise['reject'](_0x2d37c5);}return _0x503ee0[_0x48f8('0x22')]();};}function saveUpdates(_0x3f5f0e,_0x155313){return function(_0x46a159){if(_0x46a159){return _0x46a159['update'](_0x3f5f0e)['then'](function(_0x271b88){return _0x271b88;});}return null;};}function removeEntity(_0x4156d2,_0x372498){return function(_0x4a4c2b){if(_0x4a4c2b){return _0x4a4c2b[_0x48f8('0x23')]()[_0x48f8('0x24')](function(){_0x4156d2[_0x48f8('0x1a')](0xcc)[_0x48f8('0x1b')]();});}};}function handleEntityNotFound(_0x53f120,_0x455d66){return function(_0x4b9326){if(!_0x4b9326){_0x53f120[_0x48f8('0x19')](0x194);}return _0x4b9326;};}function handleError(_0x2bf134,_0x230f4b){_0x230f4b=_0x230f4b||0x1f4;return function(_0x421d44){logger[_0x48f8('0x25')](_0x421d44[_0x48f8('0x26')]);if(_0x421d44[_0x48f8('0x27')]){delete _0x421d44[_0x48f8('0x27')];}_0x2bf134['status'](_0x230f4b)[_0x48f8('0x28')](_0x421d44);};}exports[_0x48f8('0x29')]=function(_0x5c6b42,_0x372a2b){var _0x26e5c2={},_0x2a9c1e={},_0x1601ca={'count':0x0,'rows':[]};var _0x50a4c0=_['map'](db[_0x48f8('0x2a')][_0x48f8('0x2b')],function(_0x2e009c){return{'name':_0x2e009c[_0x48f8('0x2c')],'type':_0x2e009c[_0x48f8('0x2d')][_0x48f8('0x2e')]};});_0x2a9c1e[_0x48f8('0x2f')]=_['map'](_0x50a4c0,_0x48f8('0x27'));_0x2a9c1e[_0x48f8('0x30')]=_[_0x48f8('0x31')](_0x5c6b42[_0x48f8('0x30')]);_0x2a9c1e['filters']=_[_0x48f8('0x32')](_0x2a9c1e[_0x48f8('0x2f')],_0x2a9c1e[_0x48f8('0x30')]);_0x26e5c2[_0x48f8('0x33')]=_['intersection'](_0x2a9c1e['model'],qs['fields'](_0x5c6b42[_0x48f8('0x30')][_0x48f8('0x34')]));_0x26e5c2[_0x48f8('0x33')]=_0x26e5c2[_0x48f8('0x33')][_0x48f8('0x35')]?_0x26e5c2['attributes']:_0x2a9c1e[_0x48f8('0x2f')];if(!_0x5c6b42[_0x48f8('0x30')][_0x48f8('0x36')]('nolimit')){_0x26e5c2[_0x48f8('0x20')]=qs['limit'](_0x5c6b42[_0x48f8('0x30')][_0x48f8('0x20')]);_0x26e5c2['offset']=qs[_0x48f8('0x1d')](_0x5c6b42[_0x48f8('0x30')]['offset']);}_0x26e5c2[_0x48f8('0x37')]=qs[_0x48f8('0x38')](_0x5c6b42['query']['sort']);_0x26e5c2[_0x48f8('0x39')]=qs[_0x48f8('0x3a')](_[_0x48f8('0x3b')](_0x5c6b42[_0x48f8('0x30')],_0x2a9c1e[_0x48f8('0x3a')]),_0x50a4c0);if(_0x5c6b42[_0x48f8('0x30')][_0x48f8('0x3c')]){_0x26e5c2[_0x48f8('0x39')]=_[_0x48f8('0x3d')](_0x26e5c2[_0x48f8('0x39')],{'$or':_[_0x48f8('0x3e')](_0x50a4c0,function(_0x49189c){if(_0x49189c[_0x48f8('0x2d')]!==_0x48f8('0x3f')){var _0x38b335={};_0x38b335[_0x49189c[_0x48f8('0x27')]]={'$like':'%'+_0x5c6b42['query']['filter']+'%'};return _0x38b335;}})});}_0x26e5c2=_['merge']({},_0x26e5c2,_0x5c6b42[_0x48f8('0x40')]);var _0x3ed600={'where':_0x26e5c2[_0x48f8('0x39')]};return db['ChatInternalMessage'][_0x48f8('0x1f')](_0x3ed600)[_0x48f8('0x24')](function(_0x222525){_0x1601ca['count']=_0x222525;if(_0x5c6b42[_0x48f8('0x30')][_0x48f8('0x41')]){_0x26e5c2[_0x48f8('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x48f8('0x43')](_0x26e5c2);})['then'](function(_0x5d59e4){_0x1601ca[_0x48f8('0x44')]=_0x5d59e4;return _0x1601ca;})['then'](respondWithFilteredResult(_0x372a2b,_0x26e5c2))['catch'](handleError(_0x372a2b,null));};exports[_0x48f8('0x45')]=function(_0x41c93f,_0x5bb84c){var _0x9dc099={'raw':!![],'where':{'id':_0x41c93f[_0x48f8('0x46')]['id']}},_0x42dbd0={};_0x42dbd0['model']=_[_0x48f8('0x31')](db[_0x48f8('0x2a')]['rawAttributes']);_0x42dbd0['query']=_[_0x48f8('0x31')](_0x41c93f[_0x48f8('0x30')]);_0x42dbd0[_0x48f8('0x3a')]=_[_0x48f8('0x32')](_0x42dbd0[_0x48f8('0x2f')],_0x42dbd0[_0x48f8('0x30')]);_0x9dc099['attributes']=_[_0x48f8('0x32')](_0x42dbd0[_0x48f8('0x2f')],qs[_0x48f8('0x34')](_0x41c93f[_0x48f8('0x30')][_0x48f8('0x34')]));_0x9dc099['attributes']=_0x9dc099[_0x48f8('0x33')][_0x48f8('0x35')]?_0x9dc099['attributes']:_0x42dbd0[_0x48f8('0x2f')];if(_0x41c93f[_0x48f8('0x30')][_0x48f8('0x41')]){_0x9dc099[_0x48f8('0x42')]=[{'all':!![]}];}_0x9dc099=_[_0x48f8('0x3d')]({},_0x9dc099,_0x41c93f[_0x48f8('0x40')]);return db['ChatInternalMessage'][_0x48f8('0x47')](_0x9dc099)[_0x48f8('0x24')](handleEntityNotFound(_0x5bb84c,null))[_0x48f8('0x24')](respondWithResult(_0x5bb84c,null))[_0x48f8('0x48')](handleError(_0x5bb84c,null));};exports['create']=function(_0x548fbc,_0x30cfa6){return db[_0x48f8('0x2a')]['create'](_0x548fbc['body'],{})['then'](respondWithResult(_0x30cfa6,0xc9))[_0x48f8('0x48')](handleError(_0x30cfa6,null));};exports[_0x48f8('0x49')]=function(_0x3f7fdb,_0x37d416){if(_0x3f7fdb['body']['id']){delete _0x3f7fdb[_0x48f8('0x4a')]['id'];}return db[_0x48f8('0x2a')]['find']({'where':{'id':_0x3f7fdb['params']['id']}})['then'](handleEntityNotFound(_0x37d416,null))[_0x48f8('0x24')](saveUpdates(_0x3f7fdb['body'],null))[_0x48f8('0x24')](respondWithResult(_0x37d416,null))[_0x48f8('0x48')](handleError(_0x37d416,null));};exports['destroy']=function(_0x370e69,_0x568959){return db[_0x48f8('0x2a')][_0x48f8('0x47')]({'where':{'id':_0x370e69[_0x48f8('0x46')]['id']}})[_0x48f8('0x24')](handleEntityNotFound(_0x568959,null))[_0x48f8('0x24')](removeEntity(_0x568959,null))[_0x48f8('0x48')](handleError(_0x568959,null));};exports[_0x48f8('0x4b')]=function(_0x5c2915,_0x16b26f){return db[_0x48f8('0x2a')][_0x48f8('0x4b')]()[_0x48f8('0x24')](respondWithResult(_0x16b26f,null))[_0x48f8('0x48')](handleError(_0x16b26f,null));};function wrapUser(_0x2e9920){return function(_0x3e516f){var _0x952c38=_0x2e9920['get']({'plain':!![]});_0x952c38[_0x48f8('0x4c')]=[];if(_0x3e516f){_0x952c38['lastMessageAt']=_0x3e516f[_0x48f8('0x4d')];_0x952c38[_0x48f8('0x4e')]=_0x3e516f;}else{_0x952c38[_0x48f8('0x4f')]=moment(0x0)[_0x48f8('0x50')](_0x48f8('0x51'));_0x952c38['lastMessage']={};}return _0x952c38;};}exports[_0x48f8('0x52')]=function(_0x42b8db,_0x1f6b89,_0x4dbac6){var _0x11ff9d=[];return db[_0x48f8('0x53')][_0x48f8('0x43')]({'where':{'role':[_0x48f8('0x54'),_0x48f8('0x55'),'user']},'attributes':['id','fullname',_0x48f8('0x27'),'role','userpic',_0x48f8('0x56'),_0x48f8('0x57'),'lastLoginAt',_0x48f8('0x58'),_0x48f8('0x59')],'order':qs[_0x48f8('0x38')](_0x48f8('0x5a')),'include':[{'model':db[_0x48f8('0x5b')],'as':_0x48f8('0x5c'),'attributes':['id','name',_0x48f8('0x2d')],'through':{'attributes':[]}}]})[_0x48f8('0x24')](function(_0x2b20f2){if(_0x2b20f2){var _0x1d9a85=_0x42b8db[_0x48f8('0x5d')][_0x48f8('0x5e')]({'plain':!![]});if(!_0x1d9a85)throw new Error(_0x48f8('0x5f'));if(_0x1d9a85[_0x48f8('0x60')]===_0x48f8('0x5d')){return db[_0x48f8('0x61')][_0x48f8('0x47')]({'where':{'name':_0x48f8('0x62'),'userProfileId':_0x1d9a85[_0x48f8('0x63')]},'raw':!![]})['then'](function(_0x4c67f6){if(_0x4c67f6){if(_0x4c67f6[_0x48f8('0x64')]===0x0){return db[_0x48f8('0x65')][_0x48f8('0x43')]({'where':{'sectionId':_0x4c67f6['id']},'raw':!![]})['then'](function(_0x219c3f){var _0x5e9d99=[];if(_['isEmpty'](_0x219c3f)){_0x5e9d99=_[_0x48f8('0x3c')](_0x2b20f2,function(_0x53397c){if(_0x53397c['role']!==_0x48f8('0x54')){return _0x53397c;}});return _0x5e9d99;}else{for(var _0x58213f=0x0;_0x58213f<_0x2b20f2['length'];_0x58213f++){var _0x1014e9=_0x2b20f2[_0x58213f];if(_0x1014e9['role']===_0x48f8('0x54')){var _0x28a245=_[_0x48f8('0x47')](_0x219c3f,function(_0x46dbe9){return _0x46dbe9[_0x48f8('0x66')]===_0x1014e9['id'];});if(_0x28a245)_0x5e9d99[_0x48f8('0x67')](_0x1014e9);}else{_0x5e9d99['push'](_0x1014e9);}}return _0x5e9d99;}});}else{return _0x2b20f2;}}else{var _0x4155b9=_[_0x48f8('0x3c')](_0x2b20f2,function(_0x4d203d){if(_0x4d203d[_0x48f8('0x60')]!==_0x48f8('0x54')){return _0x4d203d;}});return _0x4155b9;}});}else{return _0x2b20f2;}}})[_0x48f8('0x24')](function(_0x2c481a){var _0x4d4523=[];if(_0x2c481a){_0x11ff9d=_0x2c481a;for(var _0x47bf77=0x0;_0x47bf77<_0x2c481a['length'];_0x47bf77+=0x1){_0x11ff9d[_0x47bf77][_0x48f8('0x4c')]=[];_0x4d4523[_0x48f8('0x67')](db[_0x48f8('0x2a')][_0x48f8('0x47')]({'where':{'FromId':[_0x42b8db[_0x48f8('0x5d')]['id'],_0x2c481a[_0x47bf77]['id']],'ToId':[_0x42b8db[_0x48f8('0x5d')]['id'],_0x2c481a[_0x47bf77]['id']],'ChatGroupId':null},'attributes':['id',_0x48f8('0x4d'),_0x48f8('0x68'),'ToId','read',_0x48f8('0x4a')],'order':qs['sort'](_0x48f8('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x48f8('0x24')](wrapUser(_0x2c481a[_0x47bf77])));}return BPromise[_0x48f8('0x6a')](_0x4d4523);}return[];})[_0x48f8('0x24')](function(_0x363e4c){return{'rows':_0x363e4c,'count':_0x363e4c[_0x48f8('0x35')]};})['then'](respondWithResult(_0x1f6b89,null))['catch'](handleError(_0x1f6b89,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 756a989..2e45df9 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 _0x93e8=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x392ddc,_0xead658){var _0x220027=function(_0x12b700){while(--_0x12b700){_0x392ddc['push'](_0x392ddc['shift']());}};_0x220027(++_0xead658);}(_0x93e8,0x176));var _0x893e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x93e8[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0x893e('0x0'));var ChatInternalMessage=require(_0x893e('0x1'))['db'][_0x893e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x893e('0x3')](0x0);var events={'afterCreate':_0x893e('0x4'),'afterUpdate':_0x893e('0x5'),'afterDestroy':_0x893e('0x6')};function emitEvent(_0x37f8db){return function(_0x4e8b9a,_0x5c01c0,_0x6d00be){ChatInternalMessageEvents[_0x893e('0x7')](_0x37f8db+':'+_0x4e8b9a['id'],_0x4e8b9a);ChatInternalMessageEvents['emit'](_0x37f8db,_0x4e8b9a);_0x6d00be(null);};}for(var e in events){if(events[_0x893e('0x8')](e)){var event=events[e];ChatInternalMessage[_0x893e('0x9')](e,emitEvent(event));}}module[_0x893e('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x22f0=['emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x4e01da,_0x3d1000){var _0x5bea9a=function(_0x1ade0a){while(--_0x1ade0a){_0x4e01da['push'](_0x4e01da['shift']());}};_0x5bea9a(++_0x3d1000);}(_0x22f0,0x159));var _0x022f=function(_0x15df45,_0x2b7b4d){_0x15df45=_0x15df45-0x0;var _0x256bfd=_0x22f0[_0x15df45];return _0x256bfd;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x022f('0x0'))['db'][_0x022f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x022f('0x2')](0x0);var events={'afterCreate':_0x022f('0x3'),'afterUpdate':_0x022f('0x4'),'afterDestroy':_0x022f('0x5')};function emitEvent(_0x45a936){return function(_0x2baf00,_0x45a6dd,_0x1fb35c){ChatInternalMessageEvents[_0x022f('0x6')](_0x45a936+':'+_0x2baf00['id'],_0x2baf00);ChatInternalMessageEvents['emit'](_0x45a936,_0x2baf00);_0x1fb35c(null);};}for(var e in events){if(events[_0x022f('0x7')](e)){var event=events[e];ChatInternalMessage[_0x022f('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 52f56ec..e8dc257 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 _0x2dd0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2dd0,0x1ba));var _0x02dd=function(_0x476798,_0x4e4bbd){_0x476798=_0x476798-0x0;var _0x4ea9c7=_0x2dd0[_0x476798];return _0x4ea9c7;};'use strict';var _=require(_0x02dd('0x0'));var util=require('util');var logger=require(_0x02dd('0x1'))(_0x02dd('0x2'));var moment=require(_0x02dd('0x3'));var BPromise=require(_0x02dd('0x4'));var rp=require(_0x02dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02dd('0x6'));var config=require(_0x02dd('0x7'));var attributes=require(_0x02dd('0x8'));module[_0x02dd('0x9')]=function(_0x45779d,_0x435617){return _0x45779d['define']('ChatInternalMessage',attributes,{'tableName':_0x02dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x02dd('0xb')});}; \ No newline at end of file +var _0x63d7=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x63d7,0x17e));var _0x763d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x63d7[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x763d('0x0'))(_0x763d('0x1'));var moment=require(_0x763d('0x2'));var BPromise=require(_0x763d('0x3'));var rp=require(_0x763d('0x4'));var fs=require('fs');var path=require(_0x763d('0x5'));var rimraf=require(_0x763d('0x6'));var config=require(_0x763d('0x7'));var attributes=require(_0x763d('0x8'));module[_0x763d('0x9')]=function(_0x17ace9,_0x183a2d){return _0x17ace9[_0x763d('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x763d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x763d('0xc'),'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 d366401..53bf22e 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 _0x3464=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e60b2,_0x5f2d9e){var _0x3514b8=function(_0x5115b1){while(--_0x5115b1){_0x2e60b2['push'](_0x2e60b2['shift']());}};_0x3514b8(++_0x5f2d9e);}(_0x3464,0x16e));var _0x4346=function(_0x25a31f,_0x1cf424){_0x25a31f=_0x25a31f-0x0;var _0x3c03e2=_0x3464[_0x25a31f];return _0x3c03e2;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var moment=require(_0x4346('0x2'));var BPromise=require(_0x4346('0x3'));var rs=require(_0x4346('0x4'));var fs=require('fs');var Redis=require(_0x4346('0x5'));var db=require(_0x4346('0x6'))['db'];var utils=require(_0x4346('0x7'));var logger=require(_0x4346('0x8'))(_0x4346('0x9'));var config=require(_0x4346('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4346('0xb')]['http']({'port':0x232a});config[_0x4346('0xc')]=_[_0x4346('0xd')](config[_0x4346('0xc')],{'host':_0x4346('0xe'),'port':0x18eb});var socket=require(_0x4346('0xf'))(new Redis(config[_0x4346('0xc')]));require(_0x4346('0x10'))[_0x4346('0x11')](socket);function respondWithRpcPromise(_0x195c6d,_0xc6a466,_0x3d0aa0){return new BPromise(function(_0x47d05b,_0x2aac79){return client[_0x4346('0x12')](_0x195c6d,_0x3d0aa0)['then'](function(_0x1b377c){logger[_0x4346('0x13')](_0x4346('0x14'),_0xc6a466,_0x4346('0x15'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc6a466,_0x4346('0x15'),JSON[_0x4346('0x16')](_0x1b377c));if(_0x1b377c[_0x4346('0x17')]){if(_0x1b377c[_0x4346('0x17')][_0x4346('0x18')]===0x1f4){logger[_0x4346('0x17')](_0x4346('0x14'),_0xc6a466,_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);return _0x2aac79(_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);}logger[_0x4346('0x17')](_0x4346('0x14'),_0xc6a466,_0x1b377c['error']['message']);return _0x47d05b(_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);}else{logger[_0x4346('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xc6a466,_0x4346('0x15'));_0x47d05b(_0x1b377c['result'][_0x4346('0x19')]);}})['catch'](function(_0x31abd0){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xc6a466,_0x31abd0);_0x2aac79(_0x31abd0);});});} \ No newline at end of file +var _0x3f47=['request','then','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x313f80,_0x208939){var _0x12ecd4=function(_0x3fa617){while(--_0x3fa617){_0x313f80['push'](_0x313f80['shift']());}};_0x12ecd4(++_0x208939);}(_0x3f47,0x10e));var _0x73f4=function(_0x5b6a14,_0x34c906){_0x5b6a14=_0x5b6a14-0x0;var _0x27b968=_0x3f47[_0x5b6a14];return _0x27b968;};'use strict';var _=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var moment=require('moment');var BPromise=require(_0x73f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73f4('0x3'));var db=require(_0x73f4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73f4('0x5'))(_0x73f4('0x6'));var config=require(_0x73f4('0x7'));var jayson=require(_0x73f4('0x8'));var client=jayson['client'][_0x73f4('0x9')]({'port':0x232a});config[_0x73f4('0xa')]=_[_0x73f4('0xb')](config[_0x73f4('0xa')],{'host':_0x73f4('0xc'),'port':0x18eb});var socket=require(_0x73f4('0xd'))(new Redis(config['redis']));require(_0x73f4('0xe'))[_0x73f4('0xf')](socket);function respondWithRpcPromise(_0xfbf315,_0x41ea92,_0xe22dc5){return new BPromise(function(_0xe25bb4,_0x94e2e4){return client[_0x73f4('0x10')](_0xfbf315,_0xe22dc5)[_0x73f4('0x11')](function(_0xfffe89){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x41ea92,_0x73f4('0x12'));logger['debug'](_0x73f4('0x13'),_0x41ea92,_0x73f4('0x12'),JSON[_0x73f4('0x14')](_0xfffe89));if(_0xfffe89[_0x73f4('0x15')]){if(_0xfffe89[_0x73f4('0x15')]['code']===0x1f4){logger[_0x73f4('0x15')](_0x73f4('0x16'),_0x41ea92,_0xfffe89[_0x73f4('0x15')][_0x73f4('0x17')]);return _0x94e2e4(_0xfffe89[_0x73f4('0x15')][_0x73f4('0x17')]);}logger['error'](_0x73f4('0x16'),_0x41ea92,_0xfffe89['error']['message']);return _0xe25bb4(_0xfffe89[_0x73f4('0x15')][_0x73f4('0x17')]);}else{logger[_0x73f4('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x41ea92,_0x73f4('0x12'));_0xe25bb4(_0xfffe89[_0x73f4('0x19')][_0x73f4('0x17')]);}})['catch'](function(_0x2294c0){logger[_0x73f4('0x15')](_0x73f4('0x16'),_0x41ea92,_0x2294c0);_0x94e2e4(_0x2294c0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 11aca95..b2d38d6 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 _0x535b=['./chatInternalMessage.events','emit','removeListener','length','chatInternalMessage:'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x535b,0x87));var _0xb535=function(_0x51c4b2,_0x512fff){_0x51c4b2=_0x51c4b2-0x0;var _0x35578f=_0x535b[_0x51c4b2];return _0x35578f;};'use strict';var ChatInternalMessageEvents=require(_0xb535('0x0'));var events=['save','remove','update'];function createListener(_0x357e4b,_0x18fce4){return function(_0x8c1312){_0x18fce4[_0xb535('0x1')](_0x357e4b,_0x8c1312);};}function removeListener(_0x293e30,_0x5647d0){return function(){ChatInternalMessageEvents[_0xb535('0x2')](_0x293e30,_0x5647d0);};}exports['register']=function(_0x5e9b43){for(var _0x4a7608=0x0,_0x556969=events[_0xb535('0x3')];_0x4a7608<_0x556969;_0x4a7608++){var _0x515c92=events[_0x4a7608];var _0x1406b0=createListener(_0xb535('0x4')+_0x515c92,_0x5e9b43);ChatInternalMessageEvents['on'](_0x515c92,_0x1406b0);}}; \ No newline at end of file +var _0x19ab=['emit','removeListener','register','./chatInternalMessage.events','save','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x19ab,0x1c5));var _0xb19a=function(_0x9f7468,_0x451d53){_0x9f7468=_0x9f7468-0x0;var _0x2db317=_0x19ab[_0x9f7468];return _0x2db317;};'use strict';var ChatInternalMessageEvents=require(_0xb19a('0x0'));var events=[_0xb19a('0x1'),'remove',_0xb19a('0x2')];function createListener(_0x2178ed,_0x43119e){return function(_0x567114){_0x43119e[_0xb19a('0x3')](_0x2178ed,_0x567114);};}function removeListener(_0x449908,_0x2137bd){return function(){ChatInternalMessageEvents[_0xb19a('0x4')](_0x449908,_0x2137bd);};}exports[_0xb19a('0x5')]=function(_0x31e39f){for(var _0x10ed90=0x0,_0x358632=events['length'];_0x10ed90<_0x358632;_0x10ed90++){var _0x1a5426=events[_0x10ed90];var _0x1877cf=createListener('chatInternalMessage:'+_0x1a5426,_0x31e39f);ChatInternalMessageEvents['on'](_0x1a5426,_0x1877cf);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4f6b1ba..e72e341 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 _0x15ea=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x1e99d7,_0x18fa1f){var _0x3970bf=function(_0x453284){while(--_0x453284){_0x1e99d7['push'](_0x1e99d7['shift']());}};_0x3970bf(++_0x18fa1f);}(_0x15ea,0xfa));var _0xa15e=function(_0x1393cc,_0x3d0294){_0x1393cc=_0x1393cc-0x0;var _0x4fd93f=_0x15ea[_0x1393cc];return _0x4fd93f;};'use strict';var multer=require(_0xa15e('0x0'));var util=require(_0xa15e('0x1'));var path=require('path');var timeout=require(_0xa15e('0x2'));var express=require('express');var router=express[_0xa15e('0x3')]();var fs_extra=require(_0xa15e('0x4'));var auth=require(_0xa15e('0x5'));var interaction=require(_0xa15e('0x6'));var config=require(_0xa15e('0x7'));var controller=require(_0xa15e('0x8'));router[_0xa15e('0x9')]('/',auth['isAuthenticated'](),controller[_0xa15e('0xa')]);router[_0xa15e('0x9')]('/describe',auth[_0xa15e('0xb')](),controller[_0xa15e('0xc')]);router['get'](_0xa15e('0xd'),auth['isAuthenticated'](),controller[_0xa15e('0xe')]);router[_0xa15e('0x9')](_0xa15e('0xf'),auth['isAuthenticated'](),controller[_0xa15e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa15e('0x11')]);router['put'](_0xa15e('0xf'),controller['update']);router[_0xa15e('0x12')](_0xa15e('0xf'),auth[_0xa15e('0xb')](),controller[_0xa15e('0x13')]);module[_0xa15e('0x14')]=router; \ No newline at end of file +var _0xbce8=['/:id','show','post','create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/users','getUsers'];(function(_0x16d3e8,_0x3a026f){var _0x4f0d06=function(_0x448790){while(--_0x448790){_0x16d3e8['push'](_0x16d3e8['shift']());}};_0x4f0d06(++_0x3a026f);}(_0xbce8,0x156));var _0x8bce=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xbce8[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var path=require('path');var timeout=require(_0x8bce('0x2'));var express=require(_0x8bce('0x3'));var router=express[_0x8bce('0x4')]();var fs_extra=require(_0x8bce('0x5'));var auth=require(_0x8bce('0x6'));var interaction=require(_0x8bce('0x7'));var config=require(_0x8bce('0x8'));var controller=require(_0x8bce('0x9'));router[_0x8bce('0xa')]('/',auth[_0x8bce('0xb')](),controller[_0x8bce('0xc')]);router[_0x8bce('0xa')]('/describe',auth[_0x8bce('0xb')](),controller['describe']);router[_0x8bce('0xa')](_0x8bce('0xd'),auth[_0x8bce('0xb')](),controller[_0x8bce('0xe')]);router[_0x8bce('0xa')](_0x8bce('0xf'),auth['isAuthenticated'](),controller[_0x8bce('0x10')]);router[_0x8bce('0x11')]('/',auth[_0x8bce('0xb')](),controller[_0x8bce('0x12')]);router['put'](_0x8bce('0xf'),controller['update']);router['delete'](_0x8bce('0xf'),auth[_0x8bce('0xb')](),controller[_0x8bce('0x13')]);module[_0x8bce('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b81faea..7ba870a 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 _0xfd7b=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x58e5de,_0x2c3cda){var _0x9cac27=function(_0x496095){while(--_0x496095){_0x58e5de['push'](_0x58e5de['shift']());}};_0x9cac27(++_0x2c3cda);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xfd7b[_0x4953da];return _0x2d3780;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'body':{'type':Sequelize[_0xbfd7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfd7('0x4')]('in','out'),'defaultValue':_0xbfd7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfd7('0x6')]},'providerName':{'type':Sequelize[_0xbfd7('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8c7a=['sequelize','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x5ec09a,_0x35b386){var _0x1f3c39=function(_0xe1b250){while(--_0xe1b250){_0x5ec09a['push'](_0x5ec09a['shift']());}};_0x1f3c39(++_0x35b386);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x552000,_0x5c8e4c){_0x552000=_0x552000-0x0;var _0xe210ae=_0x8c7a[_0x552000];return _0xe210ae;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa8c7('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8c7('0x3')]('in',_0xa8c7('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8c7('0x5')]},'providerResponse':{'type':Sequelize[_0xa8c7('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 66616a5..67e2b0e 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 _0x38fd=['util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','ChatMessage','includeAll','include','rows','show','intersection','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x37e23b,_0x9a5f01){var _0x3f1e87=function(_0x15c85e){while(--_0x15c85e){_0x37e23b['push'](_0x37e23b['shift']());}};_0x3f1e87(++_0x9a5f01);}(_0x38fd,0x7e));var _0xd38f=function(_0x5801d8,_0x4ecd3a){_0x5801d8=_0x5801d8-0x0;var _0xb03bfa=_0x38fd[_0x5801d8];return _0xb03bfa;};'use strict';var emlformat=require(_0xd38f('0x0'));var rimraf=require(_0xd38f('0x1'));var zipdir=require(_0xd38f('0x2'));var jsonpatch=require(_0xd38f('0x3'));var rp=require(_0xd38f('0x4'));var moment=require(_0xd38f('0x5'));var BPromise=require(_0xd38f('0x6'));var Mustache=require(_0xd38f('0x7'));var util=require(_0xd38f('0x8'));var path=require(_0xd38f('0x9'));var sox=require(_0xd38f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd38f('0xb'));var _=require('lodash');var squel=require(_0xd38f('0xc'));var crypto=require(_0xd38f('0xd'));var jsforce=require(_0xd38f('0xe'));var deskjs=require(_0xd38f('0xf'));var toCsv=require(_0xd38f('0x10'));var querystring=require('querystring');var Papa=require(_0xd38f('0x11'));var Redis=require('ioredis');var authService=require(_0xd38f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd38f('0x13'));var hardwareService=require(_0xd38f('0x14'));var logger=require(_0xd38f('0x15'))(_0xd38f('0x16'));var utils=require('../../config/utils');var config=require(_0xd38f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd38f('0x18'))['db'];config[_0xd38f('0x19')]=_[_0xd38f('0x1a')](config[_0xd38f('0x19')],{'host':_0xd38f('0x1b'),'port':0x18eb});var socket=require(_0xd38f('0x1c'))(new Redis(config[_0xd38f('0x19')]));require(_0xd38f('0x1d'))['register'](socket);var jayson=require(_0xd38f('0x1e'));var client=jayson['client'][_0xd38f('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd38f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f88,_0x555fc5,_0x47caa0,_0x19fdfb){return new BPromise(function(_0x26b154,_0x5a8cbb){var _0x3b2b65=_0x19fdfb||client;return _0x3b2b65[_0xd38f('0x20')](_0x4b1f88,_0x47caa0)[_0xd38f('0x21')](function(_0x49ac34){logger[_0xd38f('0x22')](_0xd38f('0x23'),_0x555fc5,_0xd38f('0x24'));logger[_0xd38f('0x25')](_0xd38f('0x26'),_0x555fc5,_0xd38f('0x24'),JSON['stringify'](_0x49ac34));if(_0x49ac34['error']){if(_0x49ac34[_0xd38f('0x27')][_0xd38f('0x28')]===0x1f4){logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x49ac34['error'][_0xd38f('0x29')]);return _0x5a8cbb(_0x49ac34[_0xd38f('0x27')][_0xd38f('0x29')]);}logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x49ac34[_0xd38f('0x27')][_0xd38f('0x29')]);return _0x26b154(_0x49ac34[_0xd38f('0x27')]['message']);}else{logger[_0xd38f('0x22')](_0xd38f('0x23'),_0x555fc5,_0xd38f('0x24'));_0x26b154(_0x49ac34[_0xd38f('0x2a')][_0xd38f('0x29')]);}})[_0xd38f('0x2b')](function(_0x3aae32){logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x3aae32);_0x5a8cbb(_0x3aae32);});});}function respondWithStatusCode(_0x2f2347,_0x3fc1bd){_0x3fc1bd=_0x3fc1bd||0xcc;return function(_0x118e5e){if(_0x118e5e){return _0x2f2347[_0xd38f('0x2c')](_0x3fc1bd);}return _0x2f2347[_0xd38f('0x2d')](_0x3fc1bd)[_0xd38f('0x2e')]();};}function respondWithResult(_0x57b69d,_0x59b646){_0x59b646=_0x59b646||0xc8;return function(_0x284254){if(_0x284254){return _0x57b69d[_0xd38f('0x2d')](_0x59b646)['json'](_0x284254);}};}function respondWithFilteredResult(_0x2eae13,_0x1eb358){return function(_0xc3ec69){if(_0xc3ec69){var _0x53f7b1=typeof _0x1eb358[_0xd38f('0x2f')]==='undefined'&&typeof _0x1eb358[_0xd38f('0x30')]===_0xd38f('0x31');var _0xb49d3c=_0xc3ec69[_0xd38f('0x32')];var _0x3bcf5e=_0x53f7b1?0x0:_0x1eb358[_0xd38f('0x2f')];var _0x4d585a=_0x53f7b1?_0xc3ec69[_0xd38f('0x32')]:_0x1eb358[_0xd38f('0x2f')]+_0x1eb358[_0xd38f('0x30')];var _0x4fbc1c;if(_0x4d585a>=_0xb49d3c){_0x4d585a=_0xb49d3c;_0x4fbc1c=0xc8;}else{_0x4fbc1c=0xce;}_0x2eae13[_0xd38f('0x2d')](_0x4fbc1c);return _0x2eae13[_0xd38f('0x33')](_0xd38f('0x34'),_0x3bcf5e+'-'+_0x4d585a+'/'+_0xb49d3c)['json'](_0xc3ec69);}return null;};}function patchUpdates(_0x5cb82b){return function(_0xcc57c9){try{jsonpatch['apply'](_0xcc57c9,_0x5cb82b,!![]);}catch(_0x174a75){return BPromise[_0xd38f('0x35')](_0x174a75);}return _0xcc57c9[_0xd38f('0x36')]();};}function saveUpdates(_0x14a557,_0x487e0b){return function(_0x2fe457){if(_0x2fe457){return _0x2fe457[_0xd38f('0x37')](_0x14a557)['then'](function(_0x617ac0){return _0x617ac0;});}return null;};}function removeEntity(_0x4e5659,_0x37aa10){return function(_0x5ed714){if(_0x5ed714){return _0x5ed714[_0xd38f('0x38')]()[_0xd38f('0x21')](function(){_0x4e5659[_0xd38f('0x2d')](0xcc)[_0xd38f('0x2e')]();});}};}function handleEntityNotFound(_0x3cdcdd,_0x54f207){return function(_0x27aa7f){if(!_0x27aa7f){_0x3cdcdd[_0xd38f('0x2c')](0x194);}return _0x27aa7f;};}function handleError(_0x4fb4c5,_0x6e5b13){_0x6e5b13=_0x6e5b13||0x1f4;return function(_0x5e8e91){logger[_0xd38f('0x27')](_0x5e8e91['stack']);if(_0x5e8e91[_0xd38f('0x39')]){delete _0x5e8e91[_0xd38f('0x39')];}_0x4fb4c5['status'](_0x6e5b13)[_0xd38f('0x3a')](_0x5e8e91);};}exports[_0xd38f('0x3b')]=function(_0x44bb52,_0x1f042a){var _0x4ca695={},_0x442976={},_0x436d84={'count':0x0,'rows':[]};var _0xbe7c4b=_[_0xd38f('0x3c')](db['ChatMessage'][_0xd38f('0x3d')],function(_0x5672dc){return{'name':_0x5672dc[_0xd38f('0x3e')],'type':_0x5672dc[_0xd38f('0x3f')][_0xd38f('0x40')]};});_0x442976[_0xd38f('0x41')]=_[_0xd38f('0x3c')](_0xbe7c4b,_0xd38f('0x39'));_0x442976[_0xd38f('0x42')]=_[_0xd38f('0x43')](_0x44bb52[_0xd38f('0x42')]);_0x442976['filters']=_['intersection'](_0x442976[_0xd38f('0x41')],_0x442976[_0xd38f('0x42')]);_0x4ca695[_0xd38f('0x44')]=_['intersection'](_0x442976['model'],qs[_0xd38f('0x45')](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x45')]));_0x4ca695[_0xd38f('0x44')]=_0x4ca695[_0xd38f('0x44')][_0xd38f('0x46')]?_0x4ca695[_0xd38f('0x44')]:_0x442976[_0xd38f('0x41')];if(!_0x44bb52['query']['hasOwnProperty'](_0xd38f('0x47'))){_0x4ca695[_0xd38f('0x30')]=qs[_0xd38f('0x30')](_0x44bb52[_0xd38f('0x42')]['limit']);_0x4ca695[_0xd38f('0x2f')]=qs['offset'](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x2f')]);}_0x4ca695[_0xd38f('0x48')]=qs[_0xd38f('0x49')](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x49')]);_0x4ca695[_0xd38f('0x4a')]=qs['filters'](_['pick'](_0x44bb52[_0xd38f('0x42')],_0x442976['filters']),_0xbe7c4b);if(_0x44bb52[_0xd38f('0x42')][_0xd38f('0x4b')]){_0x4ca695['where']=_['merge'](_0x4ca695['where'],{'$or':_['map'](_0xbe7c4b,function(_0x58151b){if(_0x58151b['type']!==_0xd38f('0x4c')){var _0x566b6b={};_0x566b6b[_0x58151b[_0xd38f('0x39')]]={'$like':'%'+_0x44bb52[_0xd38f('0x42')][_0xd38f('0x4b')]+'%'};return _0x566b6b;}})});}_0x4ca695=_[_0xd38f('0x4d')]({},_0x4ca695,_0x44bb52[_0xd38f('0x4e')]);var _0x2b25e3={'where':_0x4ca695[_0xd38f('0x4a')]};return db[_0xd38f('0x4f')][_0xd38f('0x32')](_0x2b25e3)[_0xd38f('0x21')](function(_0x2e9f2a){_0x436d84[_0xd38f('0x32')]=_0x2e9f2a;if(_0x44bb52[_0xd38f('0x42')][_0xd38f('0x50')]){_0x4ca695[_0xd38f('0x51')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4ca695);})['then'](function(_0x935881){_0x436d84[_0xd38f('0x52')]=_0x935881;return _0x436d84;})[_0xd38f('0x21')](respondWithFilteredResult(_0x1f042a,_0x4ca695))[_0xd38f('0x2b')](handleError(_0x1f042a,null));};exports[_0xd38f('0x53')]=function(_0x5c8503,_0x38dcb6){var _0x1d9bde={'raw':!![],'where':{'id':_0x5c8503['params']['id']}},_0x3a88d7={};_0x3a88d7['model']=_[_0xd38f('0x43')](db[_0xd38f('0x4f')][_0xd38f('0x3d')]);_0x3a88d7[_0xd38f('0x42')]=_[_0xd38f('0x43')](_0x5c8503[_0xd38f('0x42')]);_0x3a88d7['filters']=_[_0xd38f('0x54')](_0x3a88d7[_0xd38f('0x41')],_0x3a88d7[_0xd38f('0x42')]);_0x1d9bde[_0xd38f('0x44')]=_[_0xd38f('0x54')](_0x3a88d7['model'],qs[_0xd38f('0x45')](_0x5c8503[_0xd38f('0x42')][_0xd38f('0x45')]));_0x1d9bde[_0xd38f('0x44')]=_0x1d9bde[_0xd38f('0x44')][_0xd38f('0x46')]?_0x1d9bde[_0xd38f('0x44')]:_0x3a88d7[_0xd38f('0x41')];if(_0x5c8503['query'][_0xd38f('0x50')]){_0x1d9bde[_0xd38f('0x51')]=[{'all':!![]}];}_0x1d9bde=_['merge']({},_0x1d9bde,_0x5c8503[_0xd38f('0x4e')]);return db[_0xd38f('0x4f')][_0xd38f('0x55')](_0x1d9bde)['then'](handleEntityNotFound(_0x38dcb6,null))[_0xd38f('0x21')](respondWithResult(_0x38dcb6,null))[_0xd38f('0x2b')](handleError(_0x38dcb6,null));};exports[_0xd38f('0x56')]=function(_0x5d1c52,_0x412bca){return db[_0xd38f('0x4f')]['create'](_0x5d1c52[_0xd38f('0x57')],{})[_0xd38f('0x21')](respondWithResult(_0x412bca,0xc9))[_0xd38f('0x2b')](handleError(_0x412bca,null));};exports[_0xd38f('0x37')]=function(_0x5d901e,_0xf36ccc){if(_0x5d901e[_0xd38f('0x57')]['id']){delete _0x5d901e[_0xd38f('0x57')]['id'];}return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x5d901e[_0xd38f('0x58')]['id']}})['then'](handleEntityNotFound(_0xf36ccc,null))['then'](saveUpdates(_0x5d901e[_0xd38f('0x57')],null))['then'](respondWithResult(_0xf36ccc,null))[_0xd38f('0x2b')](handleError(_0xf36ccc,null));};exports[_0xd38f('0x38')]=function(_0x1c5309,_0x38794b){return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x1c5309[_0xd38f('0x58')]['id']}})[_0xd38f('0x21')](handleEntityNotFound(_0x38794b,null))[_0xd38f('0x21')](removeEntity(_0x38794b,null))[_0xd38f('0x2b')](handleError(_0x38794b,null));};exports['describe']=function(_0xd2f302,_0x26d777){return db['ChatMessage'][_0xd38f('0x59')]()['then'](respondWithResult(_0x26d777,null))['catch'](handleError(_0x26d777,null));};var interaction_log=require(_0xd38f('0x15'))(_0xd38f('0x5a'));exports[_0xd38f('0x5b')]=function(_0x5ec94b,_0x4462a9,_0x31c69e){var _0x38dbec={'agent':{},'channel':_0xd38f('0x5c')};if(_0x5ec94b[_0xd38f('0x57')]['id']){delete _0x5ec94b[_0xd38f('0x57')]['id'];}_0x5ec94b['body'][_0xd38f('0x5d')]=!![];_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x5e')]=moment()[_0xd38f('0x5f')](_0xd38f('0x60'));_0x5ec94b['body'][_0xd38f('0x61')]=_0x5ec94b[_0xd38f('0x57')]['UserId']||_0x5ec94b[_0xd38f('0x62')]['id'];_0x38dbec['agent']['id']=_0x5ec94b['body'][_0xd38f('0x61')];return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x5ec94b[_0xd38f('0x58')]['id'],'UserId':null}})[_0xd38f('0x21')](handleEntityNotFound(_0x4462a9,null))[_0xd38f('0x21')](saveUpdates(_0x5ec94b[_0xd38f('0x57')],null))['then'](function(_0x421d9e){if(_0x421d9e){_0x38dbec[_0xd38f('0x29')]=_0x421d9e[_0xd38f('0x63')]({'plain':!![]});return db[_0xd38f('0x64')][_0xd38f('0x55')]({'where':{'id':_0x421d9e[_0xd38f('0x65')]}});}return null;})[_0xd38f('0x21')](handleEntityNotFound(_0x4462a9,null))[_0xd38f('0x21')](function(_0x319e56){if(_0x319e56){return _0x319e56[_0xd38f('0x37')]({'UserId':_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')],'read1stAt':_[_0xd38f('0x66')](_0x319e56[_0xd38f('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd38f('0x21')](function(_0x43f49a){if(_0x43f49a){_0x38dbec[_0xd38f('0x68')]=_0x43f49a[_0xd38f('0x63')]({'plain':!![]});interaction_log[_0xd38f('0x22')](_0xd38f('0x69'),_0x5ec94b[_0xd38f('0x62')]['id'],_0x5ec94b[_0xd38f('0x62')]['name'],_0x5ec94b[_0xd38f('0x62')][_0xd38f('0x6a')],_0x38dbec[_0xd38f('0x68')]['id'],_0x5ec94b[_0xd38f('0x57')]?JSON[_0xd38f('0x6b')](_0x5ec94b[_0xd38f('0x57')]):_0xd38f('0x6c'));return respondWithRpcPromise(_0xd38f('0x6d'),_0xd38f('0x6e'),_0x38dbec);}return null;})['then'](function(_0x4dd755){var _0x474999=_0xd38f('0x6f')+_0x4dd755[_0xd38f('0x29')][_0xd38f('0x70')];return db[_0xd38f('0x71')][_0xd38f('0x42')](_0x474999,{'type':db[_0xd38f('0x72')][_0xd38f('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x385506){return _0x385506;});})[_0xd38f('0x21')](function(_0x2647e8){if(_0x2647e8){_0x38dbec[_0xd38f('0x29')][_0xd38f('0x74')]=_0x2647e8[0x0];if(!_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')])return;return db[_0xd38f('0x75')][_0xd38f('0x55')]({'where':{'id':_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')],'role':_0xd38f('0x76')},'attributes':['id',_0xd38f('0x39'),'fullname',_0xd38f('0x77'),_0xd38f('0x78')],'raw':!![]});}return null;})[_0xd38f('0x21')](function(_0x491535){if(!_0x491535)return null;_0x38dbec[_0xd38f('0x29')][_0xd38f('0x76')]=_0x491535;return _0x38dbec;})[_0xd38f('0x21')](function(_0x25cf48){if(_0x25cf48){if(_0x5ec94b[_0xd38f('0x57')]['manual']){_0x38dbec[_0xd38f('0x29')][_0xd38f('0x79')]=util[_0xd38f('0x5f')](_0xd38f('0x7a'),_0x5ec94b[_0xd38f('0x62')][_0xd38f('0x39')]);_0x38dbec['message'][_0xd38f('0x7b')]=_0x38dbec[_0xd38f('0x7b')];_0x38dbec[_0xd38f('0x29')][_0xd38f('0x7c')]=_0x38dbec[_0xd38f('0x7b')];_0x38dbec[_0xd38f('0x29')][_0xd38f('0x7d')]=_0xd38f('0x5b');return respondWithRpcPromise(_0xd38f('0x7e'),_0xd38f('0x7e'),{'event':_0xd38f('0x7f'),'message':_[_0xd38f('0x4d')](_0x38dbec[_0xd38f('0x29')],JSON['parse'](_0x38dbec[_0xd38f('0x68')]['formData']))},client9002)['then'](function(){return _0x38dbec;});}return _0x38dbec;}return null;})[_0xd38f('0x21')](respondWithResult(_0x4462a9,null))[_0xd38f('0x2b')](handleError(_0x4462a9,null));};var interaction_log=require(_0xd38f('0x15'))(_0xd38f('0x5a'));exports[_0xd38f('0x35')]=function(_0x30e758,_0x471d13,_0x22f25b){var _0x27aa01={'agent':{},'channel':'chat'};if(_0x30e758[_0xd38f('0x57')]['id']){delete _0x30e758[_0xd38f('0x57')]['id'];}_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')]=_0x30e758['body']['UserId']||_0x30e758[_0xd38f('0x62')]['id'];_0x27aa01['agent']['id']=_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')];return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x30e758[_0xd38f('0x58')]['id'],'UserId':null}})[_0xd38f('0x21')](handleEntityNotFound(_0x471d13,null))[_0xd38f('0x21')](function(_0x534b93){if(_0x534b93){_0x27aa01[_0xd38f('0x29')]=_0x534b93[_0xd38f('0x63')]({'plain':!![]});return db[_0xd38f('0x64')]['find']({'where':{'id':_0x534b93[_0xd38f('0x65')]}});}return null;})[_0xd38f('0x21')](handleEntityNotFound(_0x471d13,null))['then'](function(_0x35af27){if(_0x35af27){_0x27aa01[_0xd38f('0x68')]=_0x35af27[_0xd38f('0x63')]({'plain':!![]});interaction_log[_0xd38f('0x22')](_0xd38f('0x80'),_0x30e758[_0xd38f('0x62')]['id'],_0x30e758[_0xd38f('0x62')][_0xd38f('0x39')],_0x30e758[_0xd38f('0x62')][_0xd38f('0x6a')],_0x27aa01[_0xd38f('0x68')]['id'],_0x30e758['body']?JSON[_0xd38f('0x6b')](_0x30e758[_0xd38f('0x57')]):_0xd38f('0x6c'));return respondWithRpcPromise(_0xd38f('0x81'),_0xd38f('0x82'),_0x27aa01);}return null;})[_0xd38f('0x21')](function(_0x4107cb){var _0x4bfb8b=_0xd38f('0x6f')+_0x4107cb[_0xd38f('0x29')][_0xd38f('0x70')];return db[_0xd38f('0x71')][_0xd38f('0x42')](_0x4bfb8b,{'type':db['Sequelize']['QueryTypes'][_0xd38f('0x83')],'raw':!![]})[_0xd38f('0x21')](function(_0x426b65){return _0x426b65;});})[_0xd38f('0x21')](function(_0xd2d303){if(_0xd2d303){_0x27aa01[_0xd38f('0x29')]['contact']=_0xd2d303[0x0];if(!_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')])return;return db[_0xd38f('0x75')][_0xd38f('0x55')]({'where':{'id':_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')],'role':_0xd38f('0x76')},'attributes':['id',_0xd38f('0x39'),'fullname',_0xd38f('0x77'),'internal'],'raw':!![]});}return null;})[_0xd38f('0x21')](function(_0x5abd7a){if(!_0x5abd7a)return null;_0x27aa01[_0xd38f('0x29')][_0xd38f('0x76')]=_0x5abd7a;return _0x27aa01;})['then'](function(_0x595dc1){if(_0x595dc1){_0x595dc1[_0xd38f('0x29')]['interface']=util[_0xd38f('0x5f')](_0xd38f('0x7a'),_0x30e758[_0xd38f('0x62')][_0xd38f('0x39')]);_0x595dc1['message']['channel']=_0x27aa01[_0xd38f('0x7b')];_0x595dc1['message']['motionChannel']=_0x27aa01[_0xd38f('0x7b')];_0x595dc1[_0xd38f('0x29')][_0xd38f('0x7d')]=_0xd38f('0x35');respondWithRpcPromise(_0xd38f('0x7e'),_0xd38f('0x7e'),{'event':_0xd38f('0x84'),'message':_[_0xd38f('0x4d')](_0x27aa01[_0xd38f('0x29')],JSON[_0xd38f('0x85')](_0x27aa01[_0xd38f('0x68')]['formData']))},client9002);return _0x27aa01;}return null;})[_0xd38f('0x21')](respondWithResult(_0x471d13,null))[_0xd38f('0x2b')](handleError(_0x471d13,null));}; \ No newline at end of file +var _0x7795=['send','map','ChatMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','length','options','find','create','update','body','params','destroy','describe','chat-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','QueryTypes','SELECT','fullname','email','manual','format','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','reject','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','internal','interface','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','request\x20sent','debug','stringify','error','code','message','info','ChatMessage,\x20%s,\x20%s','result','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','then','sendStatus','name'];(function(_0x2516d2,_0x4eca45){var _0x3b0a31=function(_0xaee4bd){while(--_0xaee4bd){_0x2516d2['push'](_0x2516d2['shift']());}};_0x3b0a31(++_0x4eca45);}(_0x7795,0x162));var _0x5779=function(_0x475c2e,_0xa1151c){_0x475c2e=_0x475c2e-0x0;var _0x47bb9a=_0x7795[_0x475c2e];return _0x47bb9a;};'use strict';var emlformat=require(_0x5779('0x0'));var rimraf=require(_0x5779('0x1'));var zipdir=require(_0x5779('0x2'));var jsonpatch=require(_0x5779('0x3'));var rp=require(_0x5779('0x4'));var moment=require(_0x5779('0x5'));var BPromise=require(_0x5779('0x6'));var Mustache=require('mustache');var util=require(_0x5779('0x7'));var path=require('path');var sox=require(_0x5779('0x8'));var csv=require(_0x5779('0x9'));var ejs=require(_0x5779('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5779('0xb'));var crypto=require(_0x5779('0xc'));var jsforce=require(_0x5779('0xd'));var deskjs=require(_0x5779('0xe'));var toCsv=require(_0x5779('0x9'));var querystring=require('querystring');var Papa=require(_0x5779('0xf'));var Redis=require(_0x5779('0x10'));var authService=require(_0x5779('0x11'));var qs=require(_0x5779('0x12'));var as=require(_0x5779('0x13'));var hardwareService=require(_0x5779('0x14'));var logger=require(_0x5779('0x15'))(_0x5779('0x16'));var utils=require(_0x5779('0x17'));var config=require(_0x5779('0x18'));var licenseUtil=require(_0x5779('0x19'));var db=require('../../mysqldb')['db'];config[_0x5779('0x1a')]=_[_0x5779('0x1b')](config['redis'],{'host':_0x5779('0x1c'),'port':0x18eb});var socket=require(_0x5779('0x1d'))(new Redis(config[_0x5779('0x1a')]));require(_0x5779('0x1e'))[_0x5779('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5779('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x5779('0x20')][_0x5779('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x598136,_0x52b6f9,_0x244b6a,_0x56ea97){return new BPromise(function(_0xdb2fdf,_0x58aacc){var _0x1b52f7=_0x56ea97||client;return _0x1b52f7[_0x5779('0x22')](_0x598136,_0x244b6a)['then'](function(_0x2a4a2e){logger['info']('ChatMessage,\x20%s,\x20%s',_0x52b6f9,_0x5779('0x23'));logger[_0x5779('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x52b6f9,_0x5779('0x23'),JSON[_0x5779('0x25')](_0x2a4a2e));if(_0x2a4a2e[_0x5779('0x26')]){if(_0x2a4a2e[_0x5779('0x26')][_0x5779('0x27')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x52b6f9,_0x2a4a2e[_0x5779('0x26')][_0x5779('0x28')]);return _0x58aacc(_0x2a4a2e[_0x5779('0x26')][_0x5779('0x28')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x52b6f9,_0x2a4a2e[_0x5779('0x26')]['message']);return _0xdb2fdf(_0x2a4a2e[_0x5779('0x26')]['message']);}else{logger[_0x5779('0x29')](_0x5779('0x2a'),_0x52b6f9,'request\x20sent');_0xdb2fdf(_0x2a4a2e[_0x5779('0x2b')][_0x5779('0x28')]);}})['catch'](function(_0x14db88){logger[_0x5779('0x26')]('ChatMessage,\x20%s,\x20%s',_0x52b6f9,_0x14db88);_0x58aacc(_0x14db88);});});}function respondWithStatusCode(_0x231737,_0x240e1d){_0x240e1d=_0x240e1d||0xcc;return function(_0x21dcec){if(_0x21dcec){return _0x231737['sendStatus'](_0x240e1d);}return _0x231737['status'](_0x240e1d)[_0x5779('0x2c')]();};}function respondWithResult(_0x46779f,_0x16fc9b){_0x16fc9b=_0x16fc9b||0xc8;return function(_0x39aa33){if(_0x39aa33){return _0x46779f[_0x5779('0x2d')](_0x16fc9b)[_0x5779('0x2e')](_0x39aa33);}};}function respondWithFilteredResult(_0x24f1e8,_0x365434){return function(_0x5323f4){if(_0x5323f4){var _0xcf25bb=typeof _0x365434[_0x5779('0x2f')]===_0x5779('0x30')&&typeof _0x365434['limit']==='undefined';var _0x18f53a=_0x5323f4[_0x5779('0x31')];var _0x73ec98=_0xcf25bb?0x0:_0x365434[_0x5779('0x2f')];var _0x2a891a=_0xcf25bb?_0x5323f4[_0x5779('0x31')]:_0x365434[_0x5779('0x2f')]+_0x365434[_0x5779('0x32')];var _0x1bc77e;if(_0x2a891a>=_0x18f53a){_0x2a891a=_0x18f53a;_0x1bc77e=0xc8;}else{_0x1bc77e=0xce;}_0x24f1e8[_0x5779('0x2d')](_0x1bc77e);return _0x24f1e8[_0x5779('0x33')](_0x5779('0x34'),_0x73ec98+'-'+_0x2a891a+'/'+_0x18f53a)['json'](_0x5323f4);}return null;};}function patchUpdates(_0x1ee79d){return function(_0x58d4ef){try{jsonpatch[_0x5779('0x35')](_0x58d4ef,_0x1ee79d,!![]);}catch(_0x498d2b){return BPromise['reject'](_0x498d2b);}return _0x58d4ef['save']();};}function saveUpdates(_0x13a23c,_0x2d6c00){return function(_0x33fd05){if(_0x33fd05){return _0x33fd05['update'](_0x13a23c)[_0x5779('0x36')](function(_0xc5f843){return _0xc5f843;});}return null;};}function removeEntity(_0x5d16c3,_0x51a72d){return function(_0x1f6022){if(_0x1f6022){return _0x1f6022['destroy']()['then'](function(){_0x5d16c3[_0x5779('0x2d')](0xcc)[_0x5779('0x2c')]();});}};}function handleEntityNotFound(_0xe7cc75,_0x5695bd){return function(_0x42c4ca){if(!_0x42c4ca){_0xe7cc75[_0x5779('0x37')](0x194);}return _0x42c4ca;};}function handleError(_0xafe3a2,_0x39e9b6){_0x39e9b6=_0x39e9b6||0x1f4;return function(_0x2a903f){logger[_0x5779('0x26')](_0x2a903f['stack']);if(_0x2a903f[_0x5779('0x38')]){delete _0x2a903f[_0x5779('0x38')];}_0xafe3a2[_0x5779('0x2d')](_0x39e9b6)[_0x5779('0x39')](_0x2a903f);};}exports['index']=function(_0x4f4e5d,_0x57e4b9){var _0x156d8d={},_0x5a3cc0={},_0x497f70={'count':0x0,'rows':[]};var _0x153f95=_[_0x5779('0x3a')](db[_0x5779('0x3b')]['rawAttributes'],function(_0x165826){return{'name':_0x165826[_0x5779('0x3c')],'type':_0x165826[_0x5779('0x3d')][_0x5779('0x3e')]};});_0x5a3cc0[_0x5779('0x3f')]=_[_0x5779('0x3a')](_0x153f95,_0x5779('0x38'));_0x5a3cc0[_0x5779('0x40')]=_[_0x5779('0x41')](_0x4f4e5d[_0x5779('0x40')]);_0x5a3cc0[_0x5779('0x42')]=_['intersection'](_0x5a3cc0[_0x5779('0x3f')],_0x5a3cc0[_0x5779('0x40')]);_0x156d8d[_0x5779('0x43')]=_[_0x5779('0x44')](_0x5a3cc0[_0x5779('0x3f')],qs[_0x5779('0x45')](_0x4f4e5d[_0x5779('0x40')][_0x5779('0x45')]));_0x156d8d[_0x5779('0x43')]=_0x156d8d[_0x5779('0x43')]['length']?_0x156d8d[_0x5779('0x43')]:_0x5a3cc0[_0x5779('0x3f')];if(!_0x4f4e5d[_0x5779('0x40')][_0x5779('0x46')](_0x5779('0x47'))){_0x156d8d[_0x5779('0x32')]=qs['limit'](_0x4f4e5d[_0x5779('0x40')][_0x5779('0x32')]);_0x156d8d['offset']=qs[_0x5779('0x2f')](_0x4f4e5d[_0x5779('0x40')][_0x5779('0x2f')]);}_0x156d8d[_0x5779('0x48')]=qs[_0x5779('0x49')](_0x4f4e5d['query'][_0x5779('0x49')]);_0x156d8d[_0x5779('0x4a')]=qs[_0x5779('0x42')](_[_0x5779('0x4b')](_0x4f4e5d[_0x5779('0x40')],_0x5a3cc0['filters']),_0x153f95);if(_0x4f4e5d[_0x5779('0x40')][_0x5779('0x4c')]){_0x156d8d[_0x5779('0x4a')]=_[_0x5779('0x4d')](_0x156d8d['where'],{'$or':_[_0x5779('0x3a')](_0x153f95,function(_0x44502f){if(_0x44502f[_0x5779('0x3d')]!==_0x5779('0x4e')){var _0x3d94ef={};_0x3d94ef[_0x44502f['name']]={'$like':'%'+_0x4f4e5d[_0x5779('0x40')][_0x5779('0x4c')]+'%'};return _0x3d94ef;}})});}_0x156d8d=_[_0x5779('0x4d')]({},_0x156d8d,_0x4f4e5d['options']);var _0x1e6d17={'where':_0x156d8d[_0x5779('0x4a')]};return db[_0x5779('0x3b')]['count'](_0x1e6d17)[_0x5779('0x36')](function(_0x327c28){_0x497f70[_0x5779('0x31')]=_0x327c28;if(_0x4f4e5d[_0x5779('0x40')][_0x5779('0x4f')]){_0x156d8d[_0x5779('0x50')]=[{'all':!![]}];}return db[_0x5779('0x3b')][_0x5779('0x51')](_0x156d8d);})[_0x5779('0x36')](function(_0x3f2f5a){_0x497f70[_0x5779('0x52')]=_0x3f2f5a;return _0x497f70;})[_0x5779('0x36')](respondWithFilteredResult(_0x57e4b9,_0x156d8d))[_0x5779('0x53')](handleError(_0x57e4b9,null));};exports[_0x5779('0x54')]=function(_0x4a3490,_0x45ab80){var _0x5f0f95={'raw':!![],'where':{'id':_0x4a3490['params']['id']}},_0x3d2c7c={};_0x3d2c7c['model']=_[_0x5779('0x41')](db[_0x5779('0x3b')][_0x5779('0x55')]);_0x3d2c7c[_0x5779('0x40')]=_['keys'](_0x4a3490[_0x5779('0x40')]);_0x3d2c7c[_0x5779('0x42')]=_[_0x5779('0x44')](_0x3d2c7c['model'],_0x3d2c7c[_0x5779('0x40')]);_0x5f0f95[_0x5779('0x43')]=_[_0x5779('0x44')](_0x3d2c7c[_0x5779('0x3f')],qs['fields'](_0x4a3490[_0x5779('0x40')][_0x5779('0x45')]));_0x5f0f95['attributes']=_0x5f0f95[_0x5779('0x43')][_0x5779('0x56')]?_0x5f0f95['attributes']:_0x3d2c7c[_0x5779('0x3f')];if(_0x4a3490[_0x5779('0x40')][_0x5779('0x4f')]){_0x5f0f95[_0x5779('0x50')]=[{'all':!![]}];}_0x5f0f95=_['merge']({},_0x5f0f95,_0x4a3490[_0x5779('0x57')]);return db[_0x5779('0x3b')][_0x5779('0x58')](_0x5f0f95)[_0x5779('0x36')](handleEntityNotFound(_0x45ab80,null))[_0x5779('0x36')](respondWithResult(_0x45ab80,null))[_0x5779('0x53')](handleError(_0x45ab80,null));};exports[_0x5779('0x59')]=function(_0x19c9e9,_0x146116){return db[_0x5779('0x3b')][_0x5779('0x59')](_0x19c9e9['body'],{})[_0x5779('0x36')](respondWithResult(_0x146116,0xc9))['catch'](handleError(_0x146116,null));};exports[_0x5779('0x5a')]=function(_0x281ac4,_0x430369){if(_0x281ac4['body']['id']){delete _0x281ac4[_0x5779('0x5b')]['id'];}return db[_0x5779('0x3b')][_0x5779('0x58')]({'where':{'id':_0x281ac4[_0x5779('0x5c')]['id']}})[_0x5779('0x36')](handleEntityNotFound(_0x430369,null))[_0x5779('0x36')](saveUpdates(_0x281ac4[_0x5779('0x5b')],null))['then'](respondWithResult(_0x430369,null))[_0x5779('0x53')](handleError(_0x430369,null));};exports[_0x5779('0x5d')]=function(_0x1dcfca,_0x5d7621){return db[_0x5779('0x3b')][_0x5779('0x58')]({'where':{'id':_0x1dcfca[_0x5779('0x5c')]['id']}})[_0x5779('0x36')](handleEntityNotFound(_0x5d7621,null))['then'](removeEntity(_0x5d7621,null))[_0x5779('0x53')](handleError(_0x5d7621,null));};exports[_0x5779('0x5e')]=function(_0x1b8ca0,_0x5d5282){return db[_0x5779('0x3b')][_0x5779('0x5e')]()[_0x5779('0x36')](respondWithResult(_0x5d5282,null))[_0x5779('0x53')](handleError(_0x5d5282,null));};var interaction_log=require(_0x5779('0x15'))(_0x5779('0x5f'));exports[_0x5779('0x60')]=function(_0x1e388a,_0x548907,_0x55a6c7){var _0x1637dc={'agent':{},'channel':'chat'};if(_0x1e388a['body']['id']){delete _0x1e388a['body']['id'];}_0x1e388a[_0x5779('0x5b')][_0x5779('0x61')]=!![];_0x1e388a[_0x5779('0x5b')][_0x5779('0x62')]=moment()['format'](_0x5779('0x63'));_0x1e388a[_0x5779('0x5b')][_0x5779('0x64')]=_0x1e388a[_0x5779('0x5b')]['UserId']||_0x1e388a[_0x5779('0x65')]['id'];_0x1637dc['agent']['id']=_0x1e388a[_0x5779('0x5b')][_0x5779('0x64')];return db[_0x5779('0x3b')][_0x5779('0x58')]({'where':{'id':_0x1e388a['params']['id'],'UserId':null}})[_0x5779('0x36')](handleEntityNotFound(_0x548907,null))[_0x5779('0x36')](saveUpdates(_0x1e388a['body'],null))['then'](function(_0x33f906){if(_0x33f906){_0x1637dc[_0x5779('0x28')]=_0x33f906[_0x5779('0x66')]({'plain':!![]});return db[_0x5779('0x67')]['find']({'where':{'id':_0x33f906['ChatInteractionId']}});}return null;})[_0x5779('0x36')](handleEntityNotFound(_0x548907,null))[_0x5779('0x36')](function(_0x1c4133){if(_0x1c4133){return _0x1c4133[_0x5779('0x5a')]({'UserId':_0x1e388a[_0x5779('0x5b')]['UserId'],'read1stAt':_[_0x5779('0x68')](_0x1c4133['read1stAt'])?moment()['format'](_0x5779('0x63')):undefined});}return null;})[_0x5779('0x36')](function(_0x5c0733){if(_0x5c0733){_0x1637dc[_0x5779('0x69')]=_0x5c0733[_0x5779('0x66')]({'plain':!![]});interaction_log[_0x5779('0x29')](_0x5779('0x6a'),_0x1e388a[_0x5779('0x65')]['id'],_0x1e388a[_0x5779('0x65')][_0x5779('0x38')],_0x1e388a[_0x5779('0x65')]['role'],_0x1637dc['interaction']['id'],_0x1e388a['body']?JSON['stringify'](_0x1e388a[_0x5779('0x5b')]):_0x5779('0x6b'));return respondWithRpcPromise(_0x5779('0x6c'),_0x5779('0x6d'),_0x1637dc);}return null;})[_0x5779('0x36')](function(_0x2039ae){var _0x3a3d19='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2039ae[_0x5779('0x28')][_0x5779('0x6e')];return db['sequelize'][_0x5779('0x40')](_0x3a3d19,{'type':db['Sequelize'][_0x5779('0x6f')][_0x5779('0x70')],'raw':!![]})[_0x5779('0x36')](function(_0x9f74c3){return _0x9f74c3;});})[_0x5779('0x36')](function(_0x22841d){if(_0x22841d){_0x1637dc[_0x5779('0x28')]['contact']=_0x22841d[0x0];if(!_0x1e388a['body'][_0x5779('0x64')])return;return db['User'][_0x5779('0x58')]({'where':{'id':_0x1e388a[_0x5779('0x5b')][_0x5779('0x64')],'role':'agent'},'attributes':['id',_0x5779('0x38'),_0x5779('0x71'),_0x5779('0x72'),'internal'],'raw':!![]});}return null;})[_0x5779('0x36')](function(_0x2ac4b0){if(!_0x2ac4b0)return null;_0x1637dc['message']['agent']=_0x2ac4b0;return _0x1637dc;})[_0x5779('0x36')](function(_0x5eb57c){if(_0x5eb57c){if(_0x1e388a[_0x5779('0x5b')][_0x5779('0x73')]){_0x1637dc[_0x5779('0x28')]['interface']=util[_0x5779('0x74')](_0x5779('0x75'),_0x1e388a[_0x5779('0x65')][_0x5779('0x38')]);_0x1637dc[_0x5779('0x28')][_0x5779('0x76')]=_0x1637dc[_0x5779('0x76')];_0x1637dc[_0x5779('0x28')][_0x5779('0x77')]=_0x1637dc['channel'];_0x1637dc[_0x5779('0x28')][_0x5779('0x78')]=_0x5779('0x60');return respondWithRpcPromise(_0x5779('0x79'),_0x5779('0x79'),{'event':'acceptmessage','message':_['merge'](_0x1637dc[_0x5779('0x28')],JSON[_0x5779('0x7a')](_0x1637dc[_0x5779('0x69')][_0x5779('0x7b')]))},client9002)['then'](function(){return _0x1637dc;});}return _0x1637dc;}return null;})['then'](respondWithResult(_0x548907,null))[_0x5779('0x53')](handleError(_0x548907,null));};var interaction_log=require(_0x5779('0x15'))('chat-interactions');exports[_0x5779('0x7c')]=function(_0x38deab,_0x11c70d,_0x4538f0){var _0x13d3ae={'agent':{},'channel':'chat'};if(_0x38deab['body']['id']){delete _0x38deab[_0x5779('0x5b')]['id'];}_0x38deab[_0x5779('0x5b')][_0x5779('0x64')]=_0x38deab[_0x5779('0x5b')][_0x5779('0x64')]||_0x38deab[_0x5779('0x65')]['id'];_0x13d3ae[_0x5779('0x7d')]['id']=_0x38deab[_0x5779('0x5b')][_0x5779('0x64')];return db[_0x5779('0x3b')]['find']({'where':{'id':_0x38deab[_0x5779('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11c70d,null))[_0x5779('0x36')](function(_0x2ede33){if(_0x2ede33){_0x13d3ae[_0x5779('0x28')]=_0x2ede33['get']({'plain':!![]});return db[_0x5779('0x67')]['find']({'where':{'id':_0x2ede33[_0x5779('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x11c70d,null))[_0x5779('0x36')](function(_0x503ed5){if(_0x503ed5){_0x13d3ae[_0x5779('0x69')]=_0x503ed5[_0x5779('0x66')]({'plain':!![]});interaction_log['info'](_0x5779('0x7f'),_0x38deab[_0x5779('0x65')]['id'],_0x38deab[_0x5779('0x65')][_0x5779('0x38')],_0x38deab[_0x5779('0x65')][_0x5779('0x80')],_0x13d3ae[_0x5779('0x69')]['id'],_0x38deab[_0x5779('0x5b')]?JSON[_0x5779('0x25')](_0x38deab[_0x5779('0x5b')]):_0x5779('0x6b'));return respondWithRpcPromise(_0x5779('0x81'),'rejectMessage',_0x13d3ae);}return null;})[_0x5779('0x36')](function(_0x329a3a){var _0x75c15=_0x5779('0x82')+_0x329a3a['message'][_0x5779('0x6e')];return db[_0x5779('0x83')][_0x5779('0x40')](_0x75c15,{'type':db[_0x5779('0x84')]['QueryTypes'][_0x5779('0x70')],'raw':!![]})[_0x5779('0x36')](function(_0x1b8468){return _0x1b8468;});})['then'](function(_0x449e97){if(_0x449e97){_0x13d3ae['message'][_0x5779('0x85')]=_0x449e97[0x0];if(!_0x38deab[_0x5779('0x5b')][_0x5779('0x64')])return;return db[_0x5779('0x86')]['find']({'where':{'id':_0x38deab[_0x5779('0x5b')][_0x5779('0x64')],'role':_0x5779('0x7d')},'attributes':['id',_0x5779('0x38'),_0x5779('0x71'),_0x5779('0x72'),_0x5779('0x87')],'raw':!![]});}return null;})['then'](function(_0x4242e3){if(!_0x4242e3)return null;_0x13d3ae[_0x5779('0x28')]['agent']=_0x4242e3;return _0x13d3ae;})['then'](function(_0x59618d){if(_0x59618d){_0x59618d['message'][_0x5779('0x88')]=util[_0x5779('0x74')](_0x5779('0x75'),_0x38deab[_0x5779('0x65')][_0x5779('0x38')]);_0x59618d[_0x5779('0x28')][_0x5779('0x76')]=_0x13d3ae['channel'];_0x59618d[_0x5779('0x28')]['motionChannel']=_0x13d3ae['channel'];_0x59618d[_0x5779('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0x5779('0x79'),{'event':'rejectmessage','message':_['merge'](_0x13d3ae[_0x5779('0x28')],JSON[_0x5779('0x7a')](_0x13d3ae[_0x5779('0x69')][_0x5779('0x7b')]))},client9002);return _0x13d3ae;}return null;})[_0x5779('0x36')](respondWithResult(_0x11c70d,null))['catch'](handleError(_0x11c70d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index de91402..2a8f89e 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 _0x2d2b=['../../mysqldb','ChatMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x124926,_0x1af73f){var _0x560e76=function(_0x18c60b){while(--_0x18c60b){_0x124926['push'](_0x124926['shift']());}};_0x560e76(++_0x1af73f);}(_0x2d2b,0x10d));var _0xb2d2=function(_0x23d78f,_0x37f247){_0x23d78f=_0x23d78f-0x0;var _0x11f02c=_0x2d2b[_0x23d78f];return _0x11f02c;};'use strict';var EventEmitter=require(_0xb2d2('0x0'));var ChatMessage=require(_0xb2d2('0x1'))['db'][_0xb2d2('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb2d2('0x3')](0x0);var events={'afterCreate':_0xb2d2('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b3705){return function(_0x1787f0,_0x2a2f59,_0x433109){ChatMessageEvents[_0xb2d2('0x5')](_0x1b3705+':'+_0x1787f0['id'],_0x1787f0);ChatMessageEvents[_0xb2d2('0x5')](_0x1b3705,_0x1787f0);_0x433109(null);};}for(var e in events){if(events[_0xb2d2('0x6')](e)){var event=events[e];ChatMessage[_0xb2d2('0x7')](e,emitEvent(event));}}module[_0xb2d2('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x11d2=['emit','hook','exports','../../mysqldb','ChatMessage','save','remove'];(function(_0x23dada,_0x38079a){var _0x47bc23=function(_0x413140){while(--_0x413140){_0x23dada['push'](_0x23dada['shift']());}};_0x47bc23(++_0x38079a);}(_0x11d2,0x1a7));var _0x211d=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x11d2[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x211d('0x0'))['db'][_0x211d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x211d('0x2'),'afterUpdate':'update','afterDestroy':_0x211d('0x3')};function emitEvent(_0x292c96){return function(_0x5b92bc,_0x393ed0,_0x1c16ae){ChatMessageEvents[_0x211d('0x4')](_0x292c96+':'+_0x5b92bc['id'],_0x5b92bc);ChatMessageEvents[_0x211d('0x4')](_0x292c96,_0x5b92bc);_0x1c16ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x211d('0x5')](e,emitEvent(event));}}module[_0x211d('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b1c99cf..2fe2c32 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 _0xfb54=['./chatMessage.attributes','exports','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','ChatInteractionId','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x484156,_0x266ff1){var _0x5a4bef=function(_0x1894e0){while(--_0x1894e0){_0x484156['push'](_0x484156['shift']());}};_0x5a4bef(++_0x266ff1);}(_0xfb54,0x153));var _0x4fb5=function(_0xdc94d5,_0x2dbb36){_0xdc94d5=_0xdc94d5-0x0;var _0x5d9ef2=_0xfb54[_0xdc94d5];return _0x5d9ef2;};'use strict';var _=require(_0x4fb5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4fb5('0x1'));var BPromise=require(_0x4fb5('0x2'));var rp=require(_0x4fb5('0x3'));var fs=require('fs');var path=require(_0x4fb5('0x4'));var rimraf=require('rimraf');var config=require(_0x4fb5('0x5'));var attributes=require(_0x4fb5('0x6'));module[_0x4fb5('0x7')]=function(_0x14c042,_0x55a027){return _0x14c042['define']('ChatMessage',attributes,{'tableName':_0x4fb5('0x8'),'paranoid':![],'indexes':[{'name':_0x4fb5('0x9'),'fields':['body'],'type':_0x4fb5('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2814f6,_0x1c2b80,_0x38d9a5){var _0x1f9567=_0x14c042[_0x4fb5('0xb')];var _0x7eec35=_0x2814f6[_0x4fb5('0xc')]({'plain':!![]});if(_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()==='in'||_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()===_0x4fb5('0xf')&&!_0x7eec35[_0x4fb5('0x10')]&&!_[_0x4fb5('0x11')](_0x7eec35['UserId'])){_0x1f9567['ChatInteraction'][_0x4fb5('0x12')]({'where':{'id':_0x7eec35[_0x4fb5('0x13')]}})['then'](function(_0x36bf40){if(_0x36bf40){_0x36bf40['update']({'lastMsgAt':_0x7eec35[_0x4fb5('0x14')],'lastMsgDirection':_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()});}})['catch'](function(_0x169933){console['error'](_0x169933);});}_0x38d9a5();}},'charset':_0x4fb5('0x15'),'collate':_0x4fb5('0x16')});}; \ No newline at end of file +var _0x0124=['request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2254bd,_0x486271){var _0x8bae47=function(_0x32d998){while(--_0x32d998){_0x2254bd['push'](_0x2254bd['shift']());}};_0x8bae47(++_0x486271);}(_0x0124,0x108));var _0x4012=function(_0x4b2873,_0x368dcc){_0x4b2873=_0x4b2873-0x0;var _0x169a18=_0x0124[_0x4b2873];return _0x169a18;};'use strict';var _=require(_0x4012('0x0'));var util=require(_0x4012('0x1'));var logger=require(_0x4012('0x2'))(_0x4012('0x3'));var moment=require(_0x4012('0x4'));var BPromise=require(_0x4012('0x5'));var rp=require(_0x4012('0x6'));var fs=require('fs');var path=require(_0x4012('0x7'));var rimraf=require('rimraf');var config=require(_0x4012('0x8'));var attributes=require(_0x4012('0x9'));module[_0x4012('0xa')]=function(_0x5e86cb,_0x3643cc){return _0x5e86cb[_0x4012('0xb')](_0x4012('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x4012('0xd'),'fields':[_0x4012('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cbe47,_0x1f2528,_0x3640d5){var _0x4dcc9b=_0x5e86cb['models'];var _0xfc859a=_0x1cbe47[_0x4012('0xf')]({'plain':!![]});if(_0xfc859a[_0x4012('0x10')]['toLowerCase']()==='in'||_0xfc859a[_0x4012('0x10')][_0x4012('0x11')]()==='out'&&!_0xfc859a[_0x4012('0x12')]&&!_['isNil'](_0xfc859a[_0x4012('0x13')])){_0x4dcc9b[_0x4012('0x14')][_0x4012('0x15')]({'where':{'id':_0xfc859a[_0x4012('0x16')]}})[_0x4012('0x17')](function(_0x45122d){if(_0x45122d){_0x45122d['update']({'lastMsgAt':_0xfc859a[_0x4012('0x18')],'lastMsgDirection':_0xfc859a['direction'][_0x4012('0x11')]()});}})[_0x4012('0x19')](function(_0x3f4efb){console['error'](_0x3f4efb);});}_0x3640d5();}},'charset':_0x4012('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d459845..83210e6 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 _0xbc22=['options','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','body'];(function(_0x486341,_0x207631){var _0x5c7706=function(_0x4d8331){while(--_0x4d8331){_0x486341['push'](_0x486341['shift']());}};_0x5c7706(++_0x207631);}(_0xbc22,0x79));var _0x2bc2=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xbc22[_0x4a8bad];return _0x30cf32;};'use strict';var _=require('lodash');var util=require(_0x2bc2('0x0'));var moment=require('moment');var BPromise=require(_0x2bc2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bc2('0x2'));var db=require(_0x2bc2('0x3'))['db'];var utils=require(_0x2bc2('0x4'));var logger=require(_0x2bc2('0x5'))(_0x2bc2('0x6'));var config=require(_0x2bc2('0x7'));var jayson=require(_0x2bc2('0x8'));var client=jayson[_0x2bc2('0x9')]['http']({'port':0x232a});config[_0x2bc2('0xa')]=_[_0x2bc2('0xb')](config[_0x2bc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bc2('0xc'))(new Redis(config[_0x2bc2('0xa')]));require(_0x2bc2('0xd'))[_0x2bc2('0xe')](socket);function respondWithRpcPromise(_0xeb4c0e,_0x31fb07,_0x3af1cf){return new BPromise(function(_0x540a15,_0x3224f4){return client[_0x2bc2('0xf')](_0xeb4c0e,_0x3af1cf)[_0x2bc2('0x10')](function(_0x20629c){logger['info']('ChatMessage,\x20%s,\x20%s',_0x31fb07,_0x2bc2('0x11'));logger[_0x2bc2('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x31fb07,_0x2bc2('0x11'),JSON[_0x2bc2('0x13')](_0x20629c));if(_0x20629c[_0x2bc2('0x14')]){if(_0x20629c[_0x2bc2('0x14')]['code']===0x1f4){logger[_0x2bc2('0x14')](_0x2bc2('0x15'),_0x31fb07,_0x20629c['error'][_0x2bc2('0x16')]);return _0x3224f4(_0x20629c[_0x2bc2('0x14')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x31fb07,_0x20629c['error'][_0x2bc2('0x16')]);return _0x540a15(_0x20629c['error'][_0x2bc2('0x16')]);}else{logger[_0x2bc2('0x17')]('ChatMessage,\x20%s,\x20%s',_0x31fb07,'request\x20sent');_0x540a15(_0x20629c[_0x2bc2('0x18')]['message']);}})[_0x2bc2('0x19')](function(_0x415992){logger[_0x2bc2('0x14')](_0x2bc2('0x15'),_0x31fb07,_0x415992);_0x3224f4(_0x415992);});});}exports[_0x2bc2('0x1a')]=function(_0x406333){var _0x54bb55=this;return new Promise(function(_0x358d22,_0x358065){return db[_0x2bc2('0x1b')]['create'](_0x406333[_0x2bc2('0x1c')],{'raw':_0x406333[_0x2bc2('0x1d')]?_0x406333[_0x2bc2('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x2bc2('0x10')](function(_0x523dc1){logger[_0x2bc2('0x17')](_0x2bc2('0x1a'),_0x406333);logger['debug'](_0x2bc2('0x1a'),_0x406333,JSON['stringify'](_0x523dc1));_0x358d22(_0x523dc1);})['catch'](function(_0x154885){logger['error'](_0x2bc2('0x1a'),_0x154885[_0x2bc2('0x16')],_0x406333);_0x358065(_0x54bb55['error'](0x1f4,_0x154885[_0x2bc2('0x16')]));});});}; \ No newline at end of file +var _0xa34b=['localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','debug','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0xd99cf1,_0x249d57){var _0x18ea78=function(_0x17555f){while(--_0x17555f){_0xd99cf1['push'](_0xd99cf1['shift']());}};_0x18ea78(++_0x249d57);}(_0xa34b,0x6a));var _0xba34=function(_0x22ef44,_0x298742){_0x22ef44=_0x22ef44-0x0;var _0x56b740=_0xa34b[_0x22ef44];return _0x56b740;};'use strict';var _=require('lodash');var util=require(_0xba34('0x0'));var moment=require('moment');var BPromise=require(_0xba34('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba34('0x2'))['db'];var utils=require(_0xba34('0x3'));var logger=require(_0xba34('0x4'))(_0xba34('0x5'));var config=require(_0xba34('0x6'));var jayson=require(_0xba34('0x7'));var client=jayson['client'][_0xba34('0x8')]({'port':0x232a});config[_0xba34('0x9')]=_['defaults'](config[_0xba34('0x9')],{'host':_0xba34('0xa'),'port':0x18eb});var socket=require(_0xba34('0xb'))(new Redis(config[_0xba34('0x9')]));require(_0xba34('0xc'))['register'](socket);function respondWithRpcPromise(_0x341cbf,_0x912231,_0x7561cf){return new BPromise(function(_0x129853,_0x56b49a){return client['request'](_0x341cbf,_0x7561cf)[_0xba34('0xd')](function(_0xc4a874){logger[_0xba34('0xe')](_0xba34('0xf'),_0x912231,_0xba34('0x10'));logger['debug'](_0xba34('0x11'),_0x912231,'request\x20sent',JSON[_0xba34('0x12')](_0xc4a874));if(_0xc4a874['error']){if(_0xc4a874['error']['code']===0x1f4){logger['error'](_0xba34('0xf'),_0x912231,_0xc4a874['error']['message']);return _0x56b49a(_0xc4a874[_0xba34('0x13')][_0xba34('0x14')]);}logger[_0xba34('0x13')](_0xba34('0xf'),_0x912231,_0xc4a874[_0xba34('0x13')][_0xba34('0x14')]);return _0x129853(_0xc4a874['error']['message']);}else{logger[_0xba34('0xe')](_0xba34('0xf'),_0x912231,'request\x20sent');_0x129853(_0xc4a874[_0xba34('0x15')][_0xba34('0x14')]);}})[_0xba34('0x16')](function(_0x1c8391){logger[_0xba34('0x13')](_0xba34('0xf'),_0x912231,_0x1c8391);_0x56b49a(_0x1c8391);});});}exports[_0xba34('0x17')]=function(_0x3c36da){var _0x2bfff9=this;return new Promise(function(_0xc7942,_0x2e969c){return db[_0xba34('0x18')][_0xba34('0x19')](_0x3c36da['body'],{'raw':_0x3c36da[_0xba34('0x1a')]?_0x3c36da[_0xba34('0x1a')][_0xba34('0x1b')]===undefined?!![]:![]:!![]})[_0xba34('0xd')](function(_0x3ca1f5){logger['info']('CreateChatMessage',_0x3c36da);logger[_0xba34('0x1c')](_0xba34('0x17'),_0x3c36da,JSON[_0xba34('0x12')](_0x3ca1f5));_0xc7942(_0x3ca1f5);})[_0xba34('0x16')](function(_0x48d641){logger[_0xba34('0x13')](_0xba34('0x17'),_0x48d641[_0xba34('0x14')],_0x3c36da);_0x2e969c(_0x2bfff9[_0xba34('0x13')](0x1f4,_0x48d641[_0xba34('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 56817d0..f1f86bb 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 _0xcee8=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x4975c5,_0x1ca463){var _0x5ebf72=function(_0x3dfd32){while(--_0x3dfd32){_0x4975c5['push'](_0x4975c5['shift']());}};_0x5ebf72(++_0x1ca463);}(_0xcee8,0xb1));var _0x8cee=function(_0x455792,_0x374066){_0x455792=_0x455792-0x0;var _0x1fc9b2=_0xcee8[_0x455792];return _0x1fc9b2;};'use strict';var ChatMessageEvents=require(_0x8cee('0x0'));var events=[_0x8cee('0x1'),_0x8cee('0x2'),_0x8cee('0x3')];function createListener(_0x1c570c,_0x6608db){return function(_0x5b82bd){_0x6608db[_0x8cee('0x4')](_0x1c570c,_0x5b82bd);};}function removeListener(_0x4e4143,_0xffd42d){return function(){ChatMessageEvents[_0x8cee('0x5')](_0x4e4143,_0xffd42d);};}exports['register']=function(_0x295471){for(var _0xfea4e3=0x0,_0x4f57f1=events['length'];_0xfea4e3<_0x4f57f1;_0xfea4e3++){var _0x341c63=events[_0xfea4e3];var _0x49a070=createListener(_0x8cee('0x6')+_0x341c63,_0x295471);ChatMessageEvents['on'](_0x341c63,_0x49a070);}}; \ No newline at end of file +var _0x1d25=['register','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1d25,0xba));var _0x51d2=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x1d25[_0x4429e0];return _0x51a5b3;};'use strict';var ChatMessageEvents=require(_0x51d2('0x0'));var events=[_0x51d2('0x1'),_0x51d2('0x2'),_0x51d2('0x3')];function createListener(_0x17f896,_0x5aac21){return function(_0x1b276e){_0x5aac21[_0x51d2('0x4')](_0x17f896,_0x1b276e);};}function removeListener(_0x4c93f2,_0x1f9fc8){return function(){ChatMessageEvents[_0x51d2('0x5')](_0x4c93f2,_0x1f9fc8);};}exports[_0x51d2('0x6')]=function(_0x407091){for(var _0x449fec=0x0,_0x2e6956=events['length'];_0x449fec<_0x2e6956;_0x449fec++){var _0x18e8a9=events[_0x449fec];var _0x5a6b5f=createListener(_0x51d2('0x7')+_0x18e8a9,_0x407091);ChatMessageEvents['on'](_0x18e8a9,_0x5a6b5f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c38ca6c..46b2fce 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 _0x12ca=['chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat'];(function(_0x4e680e,_0x5bcf97){var _0x48ee25=function(_0x49eccc){while(--_0x49eccc){_0x4e680e['push'](_0x4e680e['shift']());}};_0x48ee25(++_0x5bcf97);}(_0x12ca,0x134));var _0xa12c=function(_0x2abca8,_0x4c63d3){_0x2abca8=_0x2abca8-0x0;var _0x45d797=_0x12ca[_0x2abca8];return _0x45d797;};'use strict';var multer=require('multer');var util=require(_0xa12c('0x0'));var path=require(_0xa12c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa12c('0x2')]();var fs_extra=require(_0xa12c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa12c('0x4'));var config=require(_0xa12c('0x5'));var controller=require(_0xa12c('0x6'));router[_0xa12c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa12c('0x8')]);router[_0xa12c('0x7')](_0xa12c('0x9'),auth[_0xa12c('0xa')](),controller[_0xa12c('0xb')]);router['get'](_0xa12c('0xc'),auth['isAuthenticated'](),controller[_0xa12c('0xd')]);router[_0xa12c('0xe')]('/',auth[_0xa12c('0xa')](),interaction[_0xa12c('0xf')](_0xa12c('0x10'),_0xa12c('0x11')),controller[_0xa12c('0x12')]);router['put']('/:id',controller[_0xa12c('0x13')]);router[_0xa12c('0x14')](_0xa12c('0x15'),auth[_0xa12c('0xa')](),controller[_0xa12c('0x16')]);router[_0xa12c('0x14')](_0xa12c('0x17'),auth[_0xa12c('0xa')](),controller['reject']);router['delete'](_0xa12c('0xc'),auth[_0xa12c('0xa')](),controller[_0xa12c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe324=['chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked'];(function(_0x5ede26,_0x25019a){var _0x58b7dd=function(_0x51086f){while(--_0x51086f){_0x5ede26['push'](_0x5ede26['shift']());}};_0x58b7dd(++_0x25019a);}(_0xe324,0x184));var _0x4e32=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe324[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require(_0x4e32('0x0'));var path=require(_0x4e32('0x1'));var timeout=require(_0x4e32('0x2'));var express=require(_0x4e32('0x3'));var router=express[_0x4e32('0x4')]();var fs_extra=require(_0x4e32('0x5'));var auth=require(_0x4e32('0x6'));var interaction=require(_0x4e32('0x7'));var config=require(_0x4e32('0x8'));var controller=require(_0x4e32('0x9'));router[_0x4e32('0xa')]('/',auth[_0x4e32('0xb')](),controller['index']);router['get']('/describe',auth[_0x4e32('0xb')](),controller[_0x4e32('0xc')]);router[_0x4e32('0xa')](_0x4e32('0xd'),auth[_0x4e32('0xb')](),controller[_0x4e32('0xe')]);router[_0x4e32('0xf')]('/',auth[_0x4e32('0xb')](),interaction[_0x4e32('0x10')](_0x4e32('0x11'),_0x4e32('0x12')),controller[_0x4e32('0x13')]);router[_0x4e32('0x14')]('/:id',controller[_0x4e32('0x15')]);router[_0x4e32('0x14')](_0x4e32('0x16'),auth[_0x4e32('0xb')](),controller[_0x4e32('0x17')]);router['put'](_0x4e32('0x18'),auth[_0x4e32('0xb')](),controller['reject']);router[_0x4e32('0x19')](_0x4e32('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e32('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index aedda8f..31e3620 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x45e5a3,_0x1c7c77){var _0x5ed3a9=function(_0x2d50b2){while(--_0x2d50b2){_0x45e5a3['push'](_0x45e5a3['shift']());}};_0x5ed3a9(++_0x1c7c77);}(_0xdb28,0x106));var _0x8db2=function(_0x3cd52e,_0x14377e){_0x3cd52e=_0x3cd52e-0x0;var _0x754e56=_0xdb28[_0x3cd52e];return _0x754e56;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x3ecc60,_0x548dfb){var _0x32b53c=function(_0x10935a){while(--_0x10935a){_0x3ecc60['push'](_0x3ecc60['shift']());}};_0x32b53c(++_0x548dfb);}(_0xb10b,0x12a));var _0xbb10=function(_0xabbd65,_0x546d99){_0xabbd65=_0xabbd65-0x0;var _0x1d005a=_0xb10b[_0xabbd65];return _0x1d005a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fdc87be..91a90f7 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x48384c,_0x5e89a4){_0x48384c=_0x48384c-0x0;var _0x2f46e3=_0x7a54[_0x48384c];return _0x2f46e3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x204c63,_0x17fb92){var _0x2f0039=function(_0x4e02d0){while(--_0x4e02d0){_0x204c63['push'](_0x204c63['shift']());}};_0x2f0039(++_0x17fb92);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 641aa12..e851675 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 _0xe899=['hasOwnProperty','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe899,0x1cc));var _0x9e89=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0xe899[_0x3f6e26];return _0x474345;};'use strict';var EventEmitter=require(_0x9e89('0x0'));var ChatOfflineMessage=require(_0x9e89('0x1'))['db'][_0x9e89('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9e89('0x3')](0x0);var events={'afterCreate':_0x9e89('0x4'),'afterUpdate':_0x9e89('0x5'),'afterDestroy':_0x9e89('0x6')};function emitEvent(_0xc2aa22){return function(_0x5d129f,_0x277f6a,_0x1815f3){ChatOfflineMessageEvents['emit'](_0xc2aa22+':'+_0x5d129f['id'],_0x5d129f);ChatOfflineMessageEvents[_0x9e89('0x7')](_0xc2aa22,_0x5d129f);_0x1815f3(null);};}for(var e in events){if(events[_0x9e89('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3c0c=['emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c0c,0x94));var _0xc3c0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3c0c[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xc3c0('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xc3c0('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3c0('0x2'),'afterUpdate':'update','afterDestroy':_0xc3c0('0x3')};function emitEvent(_0x3915fc){return function(_0x315640,_0x83cf54,_0x578f19){ChatOfflineMessageEvents[_0xc3c0('0x4')](_0x3915fc+':'+_0x315640['id'],_0x315640);ChatOfflineMessageEvents['emit'](_0x3915fc,_0x315640);_0x578f19(null);};}for(var e in events){if(events[_0xc3c0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xc3c0('0x6')](e,emitEvent(event));}}module[_0xc3c0('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b7bff3b..d81508b 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 _0x3c49=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x55bbe3,_0x5acd20){var _0x3d5455=function(_0x3a912f){while(--_0x3a912f){_0x55bbe3['push'](_0x55bbe3['shift']());}};_0x3d5455(++_0x5acd20);}(_0x3c49,0x1ed));var _0x93c4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3c49[_0x1facfa];return _0x9ec701;};'use strict';var attributes=require(_0x93c4('0x0'));module[_0x93c4('0x1')]=function(_0x2fc691){return _0x2fc691[_0x93c4('0x2')](_0x93c4('0x3'),attributes,{'tableName':_0x93c4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x93c4('0x5')});}; \ No newline at end of file +var _0x2735=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x16acdd,_0x302f75){var _0x572c4c=function(_0x4071e9){while(--_0x4071e9){_0x16acdd['push'](_0x16acdd['shift']());}};_0x572c4c(++_0x302f75);}(_0x2735,0x12e));var _0x5273=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x2735[_0xc4001c];return _0x49f7bc;};'use strict';var attributes=require(_0x5273('0x0'));module[_0x5273('0x1')]=function(_0x5d4a4d){return _0x5d4a4d[_0x5273('0x2')](_0x5273('0x3'),attributes,{'tableName':_0x5273('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5273('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5780917..5423ec0 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 _0x13c6=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x499608,_0x187e5b){var _0x29eddf=function(_0x47ccfd){while(--_0x47ccfd){_0x499608['push'](_0x499608['shift']());}};_0x29eddf(++_0x187e5b);}(_0x13c6,0x94));var _0x613c=function(_0x179207,_0x3f1af5){_0x179207=_0x179207-0x0;var _0x5585c8=_0x13c6[_0x179207];return _0x5585c8;};'use strict';var _=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var moment=require(_0x613c('0x2'));var BPromise=require(_0x613c('0x3'));var rs=require(_0x613c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x613c('0x5'));var logger=require('../../config/logger')(_0x613c('0x6'));var config=require(_0x613c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411bda,_0x266b12,_0x2d3865){return new BPromise(function(_0x2d99df,_0x3306ec){return client[_0x613c('0x9')](_0x411bda,_0x2d3865)[_0x613c('0xa')](function(_0x1dfa38){logger[_0x613c('0xb')](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));logger[_0x613c('0xe')](_0x613c('0xf'),_0x266b12,'request\x20sent',JSON['stringify'](_0x1dfa38));if(_0x1dfa38['error']){if(_0x1dfa38[_0x613c('0x10')][_0x613c('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x266b12,_0x1dfa38[_0x613c('0x10')]['message']);return _0x3306ec(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);return _0x2d99df(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}else{logger['info'](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));_0x2d99df(_0x1dfa38[_0x613c('0x13')][_0x613c('0x12')]);}})['catch'](function(_0x23e600){logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x23e600);_0x3306ec(_0x23e600);});});} \ No newline at end of file +var _0xbda9=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x7e1acb,_0x5a8b14){var _0x4c3e01=function(_0x362951){while(--_0x362951){_0x7e1acb['push'](_0x7e1acb['shift']());}};_0x4c3e01(++_0x5a8b14);}(_0xbda9,0x101));var _0x9bda=function(_0x13d3ca,_0x4c7214){_0x13d3ca=_0x13d3ca-0x0;var _0x3bd9b7=_0xbda9[_0x13d3ca];return _0x3bd9b7;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require(_0x9bda('0x2'));var BPromise=require(_0x9bda('0x3'));var rs=require(_0x9bda('0x4'));var fs=require('fs');var Redis=require(_0x9bda('0x5'));var db=require(_0x9bda('0x6'))['db'];var utils=require(_0x9bda('0x7'));var logger=require(_0x9bda('0x8'))('rpc');var config=require(_0x9bda('0x9'));var jayson=require(_0x9bda('0xa'));var client=jayson[_0x9bda('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaf199d,_0x537c1e,_0x5c2623){return new BPromise(function(_0x1f0a0d,_0x1933d4){return client['request'](_0xaf199d,_0x5c2623)[_0x9bda('0xc')](function(_0x360573){logger[_0x9bda('0xd')](_0x9bda('0xe'),_0x537c1e,_0x9bda('0xf'));logger[_0x9bda('0x10')](_0x9bda('0x11'),_0x537c1e,'request\x20sent',JSON[_0x9bda('0x12')](_0x360573));if(_0x360573[_0x9bda('0x13')]){if(_0x360573[_0x9bda('0x13')]['code']===0x1f4){logger[_0x9bda('0x13')](_0x9bda('0xe'),_0x537c1e,_0x360573[_0x9bda('0x13')]['message']);return _0x1933d4(_0x360573[_0x9bda('0x13')][_0x9bda('0x14')]);}logger[_0x9bda('0x13')](_0x9bda('0xe'),_0x537c1e,_0x360573[_0x9bda('0x13')][_0x9bda('0x14')]);return _0x1f0a0d(_0x360573[_0x9bda('0x13')][_0x9bda('0x14')]);}else{logger[_0x9bda('0xd')](_0x9bda('0xe'),_0x537c1e,_0x9bda('0xf'));_0x1f0a0d(_0x360573[_0x9bda('0x15')][_0x9bda('0x14')]);}})[_0x9bda('0x16')](function(_0x4cfaa2){logger[_0x9bda('0x13')](_0x9bda('0xe'),_0x537c1e,_0x4cfaa2);_0x1933d4(_0x4cfaa2);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 9fbc502..e568ee8 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 _0x03e0=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','isAuthenticated','describe','/:id','show','update','delete','multer'];(function(_0x217523,_0x5d793a){var _0x43e3e1=function(_0x477f77){while(--_0x477f77){_0x217523['push'](_0x217523['shift']());}};_0x43e3e1(++_0x5d793a);}(_0x03e0,0x1a8));var _0x003e=function(_0x3083d0,_0x4998ef){_0x3083d0=_0x3083d0-0x0;var _0x3abb1c=_0x03e0[_0x3083d0];return _0x3abb1c;};'use strict';var multer=require(_0x003e('0x0'));var util=require('util');var path=require(_0x003e('0x1'));var timeout=require('connect-timeout');var express=require(_0x003e('0x2'));var router=express[_0x003e('0x3')]();var fs_extra=require(_0x003e('0x4'));var auth=require(_0x003e('0x5'));var interaction=require(_0x003e('0x6'));var config=require(_0x003e('0x7'));var controller=require(_0x003e('0x8'));router[_0x003e('0x9')]('/',auth['isAuthenticated'](),controller[_0x003e('0xa')]);router[_0x003e('0x9')]('/describe',auth[_0x003e('0xb')](),controller[_0x003e('0xc')]);router[_0x003e('0x9')](_0x003e('0xd'),auth['isAuthenticated'](),controller[_0x003e('0xe')]);router['post']('/',auth[_0x003e('0xb')](),controller['create']);router['put'](_0x003e('0xd'),auth['isAuthenticated'](),controller[_0x003e('0xf')]);router[_0x003e('0x10')](_0x003e('0xd'),auth[_0x003e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb0db=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','describe','isAuthenticated','post','create','put','update','/:id','destroy','exports','multer','util'];(function(_0x1cac1c,_0x310b72){var _0xefccb=function(_0x40771c){while(--_0x40771c){_0x1cac1c['push'](_0x1cac1c['shift']());}};_0xefccb(++_0x310b72);}(_0xb0db,0x8a));var _0xbb0d=function(_0x1dab8c,_0x2fd0a0){_0x1dab8c=_0x1dab8c-0x0;var _0x44ffab=_0xb0db[_0x1dab8c];return _0x44ffab;};'use strict';var multer=require(_0xbb0d('0x0'));var util=require(_0xbb0d('0x1'));var path=require(_0xbb0d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb0d('0x3')]();var fs_extra=require(_0xbb0d('0x4'));var auth=require(_0xbb0d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb0d('0x6'));var controller=require(_0xbb0d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb0d('0x8')]);router[_0xbb0d('0x9')](_0xbb0d('0xa'),auth['isAuthenticated'](),controller[_0xbb0d('0xb')]);router[_0xbb0d('0x9')]('/:id',auth[_0xbb0d('0xc')](),controller['show']);router[_0xbb0d('0xd')]('/',auth[_0xbb0d('0xc')](),controller[_0xbb0d('0xe')]);router[_0xbb0d('0xf')]('/:id',auth[_0xbb0d('0xc')](),controller[_0xbb0d('0x10')]);router['delete'](_0xbb0d('0x11'),auth[_0xbb0d('0xc')](),controller[_0xbb0d('0x12')]);module[_0xbb0d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3808878..21902a8 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 _0x9a24=['INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x7fb404,_0x35907e){var _0x14d9c1=function(_0x1b0e69){while(--_0x1b0e69){_0x7fb404['push'](_0x7fb404['shift']());}};_0x14d9c1(++_0x35907e);}(_0x9a24,0x1d7));var _0x49a2=function(_0x1f2696,_0x22ea03){_0x1f2696=_0x1f2696-0x0;var _0x73a5fa=_0x9a24[_0x1f2696];return _0x73a5fa;};'use strict';var Sequelize=require('sequelize');module[_0x49a2('0x0')]={'name':{'type':Sequelize[_0x49a2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49a2('0x2')](_0x49a2('0x3'),'timeout'),'defaultValue':_0x49a2('0x3')},'selector':{'type':Sequelize[_0x49a2('0x1')]},'timeout':{'type':Sequelize[_0x49a2('0x4')]}}; \ No newline at end of file +var _0x27c1=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x27c1,0xc7));var _0x127c=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x27c1[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x127c('0x0'));module[_0x127c('0x1')]={'name':{'type':Sequelize[_0x127c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x127c('0x3')](_0x127c('0x4'),'timeout'),'defaultValue':_0x127c('0x4')},'selector':{'type':Sequelize[_0x127c('0x2')]},'timeout':{'type':Sequelize[_0x127c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ee22bc6..6ae8841 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 _0xc3a8=['squel','crypto','desk.js','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','reject','save','update','then','destroy','sendStatus','error','name','show','params','keys','ChatProactiveAction','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x16eb61,_0x43dfa2){_0x16eb61=_0x16eb61-0x0;var _0x46905c=_0xc3a8[_0x16eb61];return _0x46905c;};'use strict';var emlformat=require(_0x8c3a('0x0'));var rimraf=require(_0x8c3a('0x1'));var zipdir=require(_0x8c3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c3a('0x3'));var moment=require('moment');var BPromise=require(_0x8c3a('0x4'));var Mustache=require(_0x8c3a('0x5'));var util=require(_0x8c3a('0x6'));var path=require(_0x8c3a('0x7'));var sox=require('sox');var csv=require(_0x8c3a('0x8'));var ejs=require(_0x8c3a('0x9'));var fs=require('fs');var fs_extra=require(_0x8c3a('0xa'));var _=require(_0x8c3a('0xb'));var squel=require(_0x8c3a('0xc'));var crypto=require(_0x8c3a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c3a('0xe'));var toCsv=require(_0x8c3a('0x8'));var querystring=require(_0x8c3a('0xf'));var Papa=require(_0x8c3a('0x10'));var Redis=require(_0x8c3a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c3a('0x12'));var as=require(_0x8c3a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c3a('0x14'))(_0x8c3a('0x15'));var utils=require(_0x8c3a('0x16'));var config=require(_0x8c3a('0x17'));var licenseUtil=require(_0x8c3a('0x18'));var db=require(_0x8c3a('0x19'))['db'];function respondWithStatusCode(_0x5eb124,_0x99edce){_0x99edce=_0x99edce||0xcc;return function(_0x57e0ec){if(_0x57e0ec){return _0x5eb124['sendStatus'](_0x99edce);}return _0x5eb124[_0x8c3a('0x1a')](_0x99edce)[_0x8c3a('0x1b')]();};}function respondWithResult(_0x271d3d,_0x31f3d4){_0x31f3d4=_0x31f3d4||0xc8;return function(_0x290298){if(_0x290298){return _0x271d3d[_0x8c3a('0x1a')](_0x31f3d4)[_0x8c3a('0x1c')](_0x290298);}};}function respondWithFilteredResult(_0x513e00,_0x43b853){return function(_0x5be4ea){if(_0x5be4ea){var _0x1d8b7b=typeof _0x43b853[_0x8c3a('0x1d')]===_0x8c3a('0x1e')&&typeof _0x43b853[_0x8c3a('0x1f')]===_0x8c3a('0x1e');var _0x54fe05=_0x5be4ea['count'];var _0x51acdb=_0x1d8b7b?0x0:_0x43b853['offset'];var _0x29502b=_0x1d8b7b?_0x5be4ea[_0x8c3a('0x20')]:_0x43b853[_0x8c3a('0x1d')]+_0x43b853[_0x8c3a('0x1f')];var _0x365ab8;if(_0x29502b>=_0x54fe05){_0x29502b=_0x54fe05;_0x365ab8=0xc8;}else{_0x365ab8=0xce;}_0x513e00[_0x8c3a('0x1a')](_0x365ab8);return _0x513e00['set'](_0x8c3a('0x21'),_0x51acdb+'-'+_0x29502b+'/'+_0x54fe05)[_0x8c3a('0x1c')](_0x5be4ea);}return null;};}function patchUpdates(_0x4f77df){return function(_0x1590a7){try{jsonpatch['apply'](_0x1590a7,_0x4f77df,!![]);}catch(_0x3efbc4){return BPromise[_0x8c3a('0x22')](_0x3efbc4);}return _0x1590a7[_0x8c3a('0x23')]();};}function saveUpdates(_0x58ca7a,_0x429ca6){return function(_0xb78cfc){if(_0xb78cfc){return _0xb78cfc[_0x8c3a('0x24')](_0x58ca7a)[_0x8c3a('0x25')](function(_0x718982){return _0x718982;});}return null;};}function removeEntity(_0x3c5f12,_0x427917){return function(_0x5546c3){if(_0x5546c3){return _0x5546c3[_0x8c3a('0x26')]()['then'](function(){_0x3c5f12[_0x8c3a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9f4bf,_0xe50c44){return function(_0x530e9c){if(!_0x530e9c){_0xb9f4bf[_0x8c3a('0x27')](0x194);}return _0x530e9c;};}function handleError(_0x4a1c24,_0x9cc5a8){_0x9cc5a8=_0x9cc5a8||0x1f4;return function(_0x295fb9){logger[_0x8c3a('0x28')](_0x295fb9['stack']);if(_0x295fb9['name']){delete _0x295fb9[_0x8c3a('0x29')];}_0x4a1c24[_0x8c3a('0x1a')](_0x9cc5a8)['send'](_0x295fb9);};}exports[_0x8c3a('0x2a')]=function(_0x2f77b1,_0x4ae1e4){var _0xd5353d={'raw':!![],'where':{'id':_0x2f77b1[_0x8c3a('0x2b')]['id']}},_0x31cad9={};_0x31cad9['model']=_[_0x8c3a('0x2c')](db[_0x8c3a('0x2d')]['rawAttributes']);_0x31cad9[_0x8c3a('0x2e')]=_[_0x8c3a('0x2c')](_0x2f77b1['query']);_0x31cad9[_0x8c3a('0x2f')]=_[_0x8c3a('0x30')](_0x31cad9[_0x8c3a('0x31')],_0x31cad9['query']);_0xd5353d[_0x8c3a('0x32')]=_[_0x8c3a('0x30')](_0x31cad9[_0x8c3a('0x31')],qs[_0x8c3a('0x33')](_0x2f77b1['query']['fields']));_0xd5353d[_0x8c3a('0x32')]=_0xd5353d[_0x8c3a('0x32')][_0x8c3a('0x34')]?_0xd5353d[_0x8c3a('0x32')]:_0x31cad9[_0x8c3a('0x31')];if(_0x2f77b1['query'][_0x8c3a('0x35')]){_0xd5353d[_0x8c3a('0x36')]=[{'all':!![]}];}_0xd5353d=_[_0x8c3a('0x37')]({},_0xd5353d,_0x2f77b1[_0x8c3a('0x38')]);return db[_0x8c3a('0x2d')]['find'](_0xd5353d)[_0x8c3a('0x25')](handleEntityNotFound(_0x4ae1e4,null))['then'](respondWithResult(_0x4ae1e4,null))[_0x8c3a('0x39')](handleError(_0x4ae1e4,null));};exports['create']=function(_0x8170c1,_0x51aa22){return db[_0x8c3a('0x2d')][_0x8c3a('0x3a')](_0x8170c1[_0x8c3a('0x3b')],{})[_0x8c3a('0x25')](respondWithResult(_0x51aa22,0xc9))['catch'](handleError(_0x51aa22,null));};exports[_0x8c3a('0x24')]=function(_0x3bf20b,_0x3586e2){if(_0x3bf20b['body']['id']){delete _0x3bf20b[_0x8c3a('0x3b')]['id'];}return db[_0x8c3a('0x2d')][_0x8c3a('0x3c')]({'where':{'id':_0x3bf20b[_0x8c3a('0x2b')]['id']}})[_0x8c3a('0x25')](handleEntityNotFound(_0x3586e2,null))[_0x8c3a('0x25')](saveUpdates(_0x3bf20b[_0x8c3a('0x3b')],null))[_0x8c3a('0x25')](respondWithResult(_0x3586e2,null))[_0x8c3a('0x39')](handleError(_0x3586e2,null));};exports[_0x8c3a('0x26')]=function(_0x3ae65c,_0x582cdc){return db[_0x8c3a('0x2d')][_0x8c3a('0x3c')]({'where':{'id':_0x3ae65c[_0x8c3a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x582cdc,null))[_0x8c3a('0x25')](removeEntity(_0x582cdc,null))['catch'](handleError(_0x582cdc,null));}; \ No newline at end of file +var _0xb90d=['count','offset','set','apply','reject','update','destroy','then','end','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit'];(function(_0x2eec0b,_0x43753b){var _0x5b86e9=function(_0x2c66e8){while(--_0x2c66e8){_0x2eec0b['push'](_0x2eec0b['shift']());}};_0x5b86e9(++_0x43753b);}(_0xb90d,0x17a));var _0xdb90=function(_0x33539a,_0xab9aa5){_0x33539a=_0x33539a-0x0;var _0x1a99a7=_0xb90d[_0x33539a];return _0x1a99a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb90('0x0'));var zipdir=require(_0xdb90('0x1'));var jsonpatch=require(_0xdb90('0x2'));var rp=require(_0xdb90('0x3'));var moment=require(_0xdb90('0x4'));var BPromise=require(_0xdb90('0x5'));var Mustache=require('mustache');var util=require(_0xdb90('0x6'));var path=require(_0xdb90('0x7'));var sox=require(_0xdb90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb90('0x9'));var _=require(_0xdb90('0xa'));var squel=require(_0xdb90('0xb'));var crypto=require(_0xdb90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb90('0xd'));var toCsv=require(_0xdb90('0xe'));var querystring=require(_0xdb90('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb90('0x10'));var authService=require(_0xdb90('0x11'));var qs=require(_0xdb90('0x12'));var as=require(_0xdb90('0x13'));var hardwareService=require(_0xdb90('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb90('0x15'));var licenseUtil=require(_0xdb90('0x16'));var db=require(_0xdb90('0x17'))['db'];function respondWithStatusCode(_0xb5ea64,_0xdc179e){_0xdc179e=_0xdc179e||0xcc;return function(_0x113659){if(_0x113659){return _0xb5ea64['sendStatus'](_0xdc179e);}return _0xb5ea64['status'](_0xdc179e)['end']();};}function respondWithResult(_0x511592,_0x569d40){_0x569d40=_0x569d40||0xc8;return function(_0x5eb6ef){if(_0x5eb6ef){return _0x511592[_0xdb90('0x18')](_0x569d40)[_0xdb90('0x19')](_0x5eb6ef);}};}function respondWithFilteredResult(_0x5b93b1,_0x19b02e){return function(_0x1cde0d){if(_0x1cde0d){var _0x4db002=typeof _0x19b02e['offset']===_0xdb90('0x1a')&&typeof _0x19b02e[_0xdb90('0x1b')]===_0xdb90('0x1a');var _0x5101e9=_0x1cde0d[_0xdb90('0x1c')];var _0x13f6df=_0x4db002?0x0:_0x19b02e[_0xdb90('0x1d')];var _0x44d4d4=_0x4db002?_0x1cde0d[_0xdb90('0x1c')]:_0x19b02e[_0xdb90('0x1d')]+_0x19b02e[_0xdb90('0x1b')];var _0x1838ed;if(_0x44d4d4>=_0x5101e9){_0x44d4d4=_0x5101e9;_0x1838ed=0xc8;}else{_0x1838ed=0xce;}_0x5b93b1[_0xdb90('0x18')](_0x1838ed);return _0x5b93b1[_0xdb90('0x1e')]('Content-Range',_0x13f6df+'-'+_0x44d4d4+'/'+_0x5101e9)['json'](_0x1cde0d);}return null;};}function patchUpdates(_0x4110c7){return function(_0x1c2dbe){try{jsonpatch[_0xdb90('0x1f')](_0x1c2dbe,_0x4110c7,!![]);}catch(_0x13f84d){return BPromise[_0xdb90('0x20')](_0x13f84d);}return _0x1c2dbe['save']();};}function saveUpdates(_0x31f9df,_0x922395){return function(_0x590e6a){if(_0x590e6a){return _0x590e6a[_0xdb90('0x21')](_0x31f9df)['then'](function(_0x185b08){return _0x185b08;});}return null;};}function removeEntity(_0x2fdb1b,_0x1fe5ab){return function(_0x463199){if(_0x463199){return _0x463199[_0xdb90('0x22')]()[_0xdb90('0x23')](function(){_0x2fdb1b[_0xdb90('0x18')](0xcc)[_0xdb90('0x24')]();});}};}function handleEntityNotFound(_0x1ef44a,_0x1fed39){return function(_0x64268c){if(!_0x64268c){_0x1ef44a['sendStatus'](0x194);}return _0x64268c;};}function handleError(_0x1a27c3,_0xedb1a6){_0xedb1a6=_0xedb1a6||0x1f4;return function(_0x3fcafd){logger['error'](_0x3fcafd['stack']);if(_0x3fcafd[_0xdb90('0x25')]){delete _0x3fcafd[_0xdb90('0x25')];}_0x1a27c3[_0xdb90('0x18')](_0xedb1a6)[_0xdb90('0x26')](_0x3fcafd);};}exports[_0xdb90('0x27')]=function(_0x321efc,_0x46f743){var _0x67aebc={'raw':!![],'where':{'id':_0x321efc[_0xdb90('0x28')]['id']}},_0x554d8f={};_0x554d8f[_0xdb90('0x29')]=_[_0xdb90('0x2a')](db[_0xdb90('0x2b')][_0xdb90('0x2c')]);_0x554d8f[_0xdb90('0x2d')]=_[_0xdb90('0x2a')](_0x321efc[_0xdb90('0x2d')]);_0x554d8f[_0xdb90('0x2e')]=_[_0xdb90('0x2f')](_0x554d8f[_0xdb90('0x29')],_0x554d8f[_0xdb90('0x2d')]);_0x67aebc[_0xdb90('0x30')]=_[_0xdb90('0x2f')](_0x554d8f['model'],qs[_0xdb90('0x31')](_0x321efc[_0xdb90('0x2d')][_0xdb90('0x31')]));_0x67aebc[_0xdb90('0x30')]=_0x67aebc[_0xdb90('0x30')][_0xdb90('0x32')]?_0x67aebc[_0xdb90('0x30')]:_0x554d8f[_0xdb90('0x29')];if(_0x321efc[_0xdb90('0x2d')][_0xdb90('0x33')]){_0x67aebc['include']=[{'all':!![]}];}_0x67aebc=_[_0xdb90('0x34')]({},_0x67aebc,_0x321efc[_0xdb90('0x35')]);return db['ChatProactiveAction'][_0xdb90('0x36')](_0x67aebc)[_0xdb90('0x23')](handleEntityNotFound(_0x46f743,null))[_0xdb90('0x23')](respondWithResult(_0x46f743,null))[_0xdb90('0x37')](handleError(_0x46f743,null));};exports[_0xdb90('0x38')]=function(_0x579279,_0x430c37){return db[_0xdb90('0x2b')][_0xdb90('0x38')](_0x579279['body'],{})[_0xdb90('0x23')](respondWithResult(_0x430c37,0xc9))[_0xdb90('0x37')](handleError(_0x430c37,null));};exports['update']=function(_0x42d6ff,_0x2b2942){if(_0x42d6ff[_0xdb90('0x39')]['id']){delete _0x42d6ff[_0xdb90('0x39')]['id'];}return db['ChatProactiveAction'][_0xdb90('0x36')]({'where':{'id':_0x42d6ff[_0xdb90('0x28')]['id']}})['then'](handleEntityNotFound(_0x2b2942,null))['then'](saveUpdates(_0x42d6ff[_0xdb90('0x39')],null))[_0xdb90('0x23')](respondWithResult(_0x2b2942,null))[_0xdb90('0x37')](handleError(_0x2b2942,null));};exports[_0xdb90('0x22')]=function(_0x49c745,_0x13ae1b){return db['ChatProactiveAction']['find']({'where':{'id':_0x49c745['params']['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x13ae1b,null))[_0xdb90('0x23')](removeEntity(_0x13ae1b,null))[_0xdb90('0x37')](handleError(_0x13ae1b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b55d3cf..bf5793b 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 _0xc5b5=['../../config/logger','moment','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xc5b5,0x1c1));var _0x5c5b=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0xc5b5[_0x490c02];return _0x4604ab;};'use strict';var _=require(_0x5c5b('0x0'));var util=require('util');var logger=require(_0x5c5b('0x1'))('api');var moment=require(_0x5c5b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c5b('0x3'));var rimraf=require(_0x5c5b('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c5b('0x5'));module['exports']=function(_0x570087,_0x49d5ee){return _0x570087[_0x5c5b('0x6')](_0x5c5b('0x7'),attributes,{'tableName':_0x5c5b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7575=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22ca9e,_0x2f6d54){var _0x3cb526=function(_0x3241e9){while(--_0x3241e9){_0x22ca9e['push'](_0x22ca9e['shift']());}};_0x3cb526(++_0x2f6d54);}(_0x7575,0x185));var _0x5757=function(_0x36775c,_0x33e992){_0x36775c=_0x36775c-0x0;var _0x31ff61=_0x7575[_0x36775c];return _0x31ff61;};'use strict';var _=require(_0x5757('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5757('0x1'));var moment=require(_0x5757('0x2'));var BPromise=require(_0x5757('0x3'));var rp=require(_0x5757('0x4'));var fs=require('fs');var path=require(_0x5757('0x5'));var rimraf=require(_0x5757('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x5757('0x7')]=function(_0x494c01,_0x910b2d){return _0x494c01[_0x5757('0x8')](_0x5757('0x9'),attributes,{'tableName':_0x5757('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8e882c3..3f672d8 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 _0xa54f=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xa54f,0x1e9));var _0xfa54=function(_0x27694f,_0x150986){_0x27694f=_0x27694f-0x0;var _0xce032d=_0xa54f[_0x27694f];return _0xce032d;};'use strict';var _=require(_0xfa54('0x0'));var util=require('util');var moment=require(_0xfa54('0x1'));var BPromise=require(_0xfa54('0x2'));var rs=require(_0xfa54('0x3'));var fs=require('fs');var Redis=require(_0xfa54('0x4'));var db=require(_0xfa54('0x5'))['db'];var utils=require(_0xfa54('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa54('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10afa6,_0x4bb498,_0x1a69bf){return new BPromise(function(_0x4befd7,_0x5777bb){return client[_0xfa54('0x9')](_0x10afa6,_0x1a69bf)[_0xfa54('0xa')](function(_0x362544){logger[_0xfa54('0xb')](_0xfa54('0xc'),_0x4bb498,_0xfa54('0xd'));logger[_0xfa54('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4bb498,_0xfa54('0xd'),JSON['stringify'](_0x362544));if(_0x362544[_0xfa54('0xf')]){if(_0x362544[_0xfa54('0xf')][_0xfa54('0x10')]===0x1f4){logger['error'](_0xfa54('0xc'),_0x4bb498,_0x362544['error'][_0xfa54('0x11')]);return _0x5777bb(_0x362544[_0xfa54('0xf')][_0xfa54('0x11')]);}logger[_0xfa54('0xf')](_0xfa54('0xc'),_0x4bb498,_0x362544['error'][_0xfa54('0x11')]);return _0x4befd7(_0x362544['error'][_0xfa54('0x11')]);}else{logger[_0xfa54('0xb')](_0xfa54('0xc'),_0x4bb498,_0xfa54('0xd'));_0x4befd7(_0x362544[_0xfa54('0x12')]['message']);}})['catch'](function(_0x5ef68f){logger[_0xfa54('0xf')](_0xfa54('0xc'),_0x4bb498,_0x5ef68f);_0x5777bb(_0x5ef68f);});});} \ No newline at end of file +var _0x534d=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x534d,0xa4));var _0xd534=function(_0x1c2878,_0x4986a3){_0x1c2878=_0x1c2878-0x0;var _0xa73f7c=_0x534d[_0x1c2878];return _0xa73f7c;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require('bluebird');var rs=require(_0xd534('0x3'));var fs=require('fs');var Redis=require(_0xd534('0x4'));var db=require(_0xd534('0x5'))['db'];var utils=require(_0xd534('0x6'));var logger=require(_0xd534('0x7'))(_0xd534('0x8'));var config=require(_0xd534('0x9'));var jayson=require(_0xd534('0xa'));var client=jayson[_0xd534('0xb')][_0xd534('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51a998,_0x56b8fa,_0x176c2c){return new BPromise(function(_0x2ec633,_0x5c5410){return client['request'](_0x51a998,_0x176c2c)[_0xd534('0xd')](function(_0x33512b){logger[_0xd534('0xe')](_0xd534('0xf'),_0x56b8fa,'request\x20sent');logger['debug'](_0xd534('0x10'),_0x56b8fa,_0xd534('0x11'),JSON['stringify'](_0x33512b));if(_0x33512b[_0xd534('0x12')]){if(_0x33512b[_0xd534('0x12')][_0xd534('0x13')]===0x1f4){logger[_0xd534('0x12')](_0xd534('0xf'),_0x56b8fa,_0x33512b['error'][_0xd534('0x14')]);return _0x5c5410(_0x33512b[_0xd534('0x12')][_0xd534('0x14')]);}logger[_0xd534('0x12')](_0xd534('0xf'),_0x56b8fa,_0x33512b[_0xd534('0x12')][_0xd534('0x14')]);return _0x2ec633(_0x33512b[_0xd534('0x12')][_0xd534('0x14')]);}else{logger[_0xd534('0xe')](_0xd534('0xf'),_0x56b8fa,'request\x20sent');_0x2ec633(_0x33512b[_0xd534('0x15')]['message']);}})[_0xd534('0x16')](function(_0x569dc2){logger[_0xd534('0x12')](_0xd534('0xf'),_0x56b8fa,_0x569dc2);_0x5c5410(_0x569dc2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f6db09f..0ff0799 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 _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x5f031a,_0x3f65cd){var _0x1a777a=function(_0x549230){while(--_0x549230){_0x5f031a['push'](_0x5f031a['shift']());}};_0x1a777a(++_0x3f65cd);}(_0x55ca,0x126));var _0xa55c=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x55ca[_0x1d291d];return _0x44cc4e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file +var _0xee14=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x3e2735,_0x802dae){var _0x31421b=function(_0x115b72){while(--_0x115b72){_0x3e2735['push'](_0x3e2735['shift']());}};_0x31421b(++_0x802dae);}(_0xee14,0x13a));var _0x4ee1=function(_0x547577,_0x2b4c0d){_0x547577=_0x547577-0x0;var _0x5072d0=_0xee14[_0x547577];return _0x5072d0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get'](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xa')]);router[_0x4ee1('0xb')]('/',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0xd')]);router[_0x4ee1('0xe')](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/:id',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 83e1cb0..afe2e62 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 _0x46c8=['sequelize','STRING','name','ENUM','beepall','roundrobin'];(function(_0x16eec5,_0x46b882){var _0x470ec8=function(_0x4592cf){while(--_0x4592cf){_0x16eec5['push'](_0x16eec5['shift']());}};_0x470ec8(++_0x46b882);}(_0x46c8,0x108));var _0x846c=function(_0x223a62,_0xbd9202){_0x223a62=_0x223a62-0x0;var _0x582902=_0x46c8[_0x223a62];return _0x582902;};'use strict';var Sequelize=require(_0x846c('0x0'));module['exports']={'name':{'type':Sequelize[_0x846c('0x1')],'unique':_0x846c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x846c('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x846c('0x3')]('rrmemory',_0x846c('0x4'),_0x846c('0x5'))}}; \ No newline at end of file +var _0x2479=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1b775d,_0x4b3506){var _0x524480=function(_0x1f74f7){while(--_0x1f74f7){_0x1b775d['push'](_0x1b775d['shift']());}};_0x524480(++_0x4b3506);}(_0x2479,0x73));var _0x9247=function(_0x52ca9f,_0x4143eb){_0x52ca9f=_0x52ca9f-0x0;var _0x50e7d4=_0x2479[_0x52ca9f];return _0x50e7d4;};'use strict';var Sequelize=require(_0x9247('0x0'));module[_0x9247('0x1')]={'name':{'type':Sequelize[_0x9247('0x2')],'unique':_0x9247('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9247('0x2')]},'timeout':{'type':Sequelize[_0x9247('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9247('0x5'),_0x9247('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 72b5141..c37c09c 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 _0xede7=['forEach','emit','userChatQueue:save','removeTeams','ids','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','ChatQueues','UserProfileResource','error','name','send','map','key','getOptions','ChatQueue','include','query','findAll','rows','catch','show','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','where','pick','ChatQueueId','filter','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate'];(function(_0x76dd04,_0x3435b2){var _0x169555=function(_0x1319f6){while(--_0x1319f6){_0x76dd04['push'](_0x76dd04['shift']());}};_0x169555(++_0x3435b2);}(_0xede7,0x187));var _0x7ede=function(_0x398bdb,_0x1d0c93){_0x398bdb=_0x398bdb-0x0;var _0x7ec9a4=_0xede7[_0x398bdb];return _0x7ec9a4;};'use strict';var BPromise=require(_0x7ede('0x0'));var util=require('util');var _=require(_0x7ede('0x1'));var squel=require(_0x7ede('0x2'));var Redis=require(_0x7ede('0x3'));var qs=require(_0x7ede('0x4'));var logger=require(_0x7ede('0x5'))(_0x7ede('0x6'));var config=require('../../config/environment');var db=require(_0x7ede('0x7'))['db'];config[_0x7ede('0x8')]=_[_0x7ede('0x9')](config['redis'],{'host':_0x7ede('0xa'),'port':0x18eb});var socket=require(_0x7ede('0xb'))(new Redis(config[_0x7ede('0x8')]));require(_0x7ede('0xc'))[_0x7ede('0xd')](socket);function respondWithStatusCode(_0x944e0b,_0x2ba383){_0x2ba383=_0x2ba383||0xcc;return function(_0xe75dd9){if(_0xe75dd9){return _0x944e0b[_0x7ede('0xe')](_0x2ba383);}return _0x944e0b[_0x7ede('0xf')](_0x2ba383)[_0x7ede('0x10')]();};}function respondWithResult(_0x2ea530,_0x5bc2f9){_0x5bc2f9=_0x5bc2f9||0xc8;return function(_0x2c6517){if(_0x2c6517){return _0x2ea530['status'](_0x5bc2f9)['json'](_0x2c6517);}};}function respondWithFilteredResult(_0x509336,_0x5ed352){return function(_0x1e1676){if(_0x1e1676){var _0x10cc44=typeof _0x5ed352[_0x7ede('0x11')]===_0x7ede('0x12')&&typeof _0x5ed352[_0x7ede('0x13')]===_0x7ede('0x12');var _0x457924=_0x1e1676[_0x7ede('0x14')];var _0x2ce0f1=_0x10cc44?0x0:_0x5ed352[_0x7ede('0x11')];var _0x4f05d0=_0x10cc44?_0x1e1676[_0x7ede('0x14')]:_0x5ed352[_0x7ede('0x11')]+_0x5ed352[_0x7ede('0x13')];var _0x57e7e8;if(_0x4f05d0>=_0x457924){_0x4f05d0=_0x457924;_0x57e7e8=0xc8;}else{_0x57e7e8=0xce;}_0x509336[_0x7ede('0xf')](_0x57e7e8);return _0x509336[_0x7ede('0x15')](_0x7ede('0x16'),_0x2ce0f1+'-'+_0x4f05d0+'/'+_0x457924)[_0x7ede('0x17')](_0x1e1676);}return null;};}function saveUpdates(_0x29f022){return function(_0x4217e5){if(_0x4217e5){return _0x4217e5[_0x7ede('0x18')](_0x29f022)[_0x7ede('0x19')](function(_0x157d4b){return _0x157d4b;});}return null;};}function removeEntity(_0x447d0b){return function(_0x1ed269){if(_0x1ed269){return _0x1ed269[_0x7ede('0x1a')]()['then'](function(){var _0x24a312=_0x1ed269['get']({'plain':!![]});var _0x34a44e=_0x7ede('0x1b');return db[_0x7ede('0x1c')][_0x7ede('0x1a')]({'where':{'type':_0x34a44e,'resourceId':_0x24a312['id']}})[_0x7ede('0x19')](function(){return _0x1ed269;});})['then'](function(){_0x447d0b[_0x7ede('0xf')](0xcc)[_0x7ede('0x10')]();});}};}function handleEntityNotFound(_0x454bc5){return function(_0x3312e4){if(!_0x3312e4){_0x454bc5['sendStatus'](0x194);}return _0x3312e4;};}function handleError(_0x3d8ed6,_0x220d6b){_0x220d6b=_0x220d6b||0x1f4;return function(_0x1209c5){logger[_0x7ede('0x1d')](_0x1209c5['stack']);if(_0x1209c5[_0x7ede('0x1e')]){delete _0x1209c5[_0x7ede('0x1e')];}_0x3d8ed6[_0x7ede('0xf')](_0x220d6b)[_0x7ede('0x1f')](_0x1209c5);};}exports['index']=function(_0x50a03c,_0x5786b1){var _0x3ed927={};var _0x4c4a2a={'count':0x0,'rows':[]};var _0x28f287=_[_0x7ede('0x20')](db['ChatQueue']['rawAttributes'],function(_0x3f44d8){return{'name':_0x3f44d8['fieldName'],'type':_0x3f44d8['type'][_0x7ede('0x21')]};});_0x3ed927=qs[_0x7ede('0x22')](_0x28f287,_0x50a03c);var _0x28d311={'where':_0x3ed927['where']};return db[_0x7ede('0x23')][_0x7ede('0x14')](_0x28d311)[_0x7ede('0x19')](function(_0x285560){_0x4c4a2a['count']=_0x285560;_0x3ed927[_0x7ede('0x24')]=qs['include'](_0x50a03c[_0x7ede('0x25')]);return db[_0x7ede('0x23')][_0x7ede('0x26')](_0x3ed927);})[_0x7ede('0x19')](function(_0x303cc2){_0x4c4a2a[_0x7ede('0x27')]=_0x303cc2;return _0x4c4a2a;})[_0x7ede('0x19')](respondWithFilteredResult(_0x5786b1,_0x3ed927))[_0x7ede('0x28')](handleError(_0x5786b1,null));};exports[_0x7ede('0x29')]=function(_0x29cf9e,_0x4ca287){var _0x233ac4={'raw':!![],'where':{'id':_0x29cf9e['params']['id']}},_0x3a7405={};_0x3a7405[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db['ChatQueue'][_0x7ede('0x2c')]);_0x3a7405[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x29cf9e['query']);_0x3a7405[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x3a7405[_0x7ede('0x2a')],_0x3a7405['query']);_0x233ac4['attributes']=_[_0x7ede('0x2e')](_0x3a7405[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x29cf9e[_0x7ede('0x25')][_0x7ede('0x2f')]));_0x233ac4[_0x7ede('0x30')]=_0x233ac4[_0x7ede('0x30')][_0x7ede('0x31')]?_0x233ac4[_0x7ede('0x30')]:_0x3a7405[_0x7ede('0x2a')];if(_0x29cf9e[_0x7ede('0x25')][_0x7ede('0x32')]){_0x233ac4[_0x7ede('0x24')]=[{'all':!![]}];}_0x233ac4=_[_0x7ede('0x33')]({},_0x233ac4,_0x29cf9e['options']);return db[_0x7ede('0x23')][_0x7ede('0x34')](_0x233ac4)['then'](handleEntityNotFound(_0x4ca287,null))[_0x7ede('0x19')](respondWithResult(_0x4ca287,null))[_0x7ede('0x28')](handleError(_0x4ca287,null));};exports[_0x7ede('0x35')]=function(_0x17eb8,_0x9f498){return db[_0x7ede('0x23')][_0x7ede('0x35')](_0x17eb8[_0x7ede('0x36')],{})[_0x7ede('0x19')](function(_0x4499ff){var _0xa1801b=_0x17eb8[_0x7ede('0x37')][_0x7ede('0x38')]({'plain':!![]});if(!_0xa1801b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1801b[_0x7ede('0x39')]===_0x7ede('0x37')){var _0x298a78=_0x4499ff[_0x7ede('0x38')]({'plain':!![]});var _0x2c7bc3=_0x7ede('0x1b');return db[_0x7ede('0x3a')][_0x7ede('0x34')]({'where':{'name':_0x2c7bc3,'userProfileId':_0xa1801b['userProfileId']},'raw':!![]})[_0x7ede('0x19')](function(_0x599baa){if(_0x599baa&&_0x599baa[_0x7ede('0x3b')]===0x0){return db[_0x7ede('0x1c')][_0x7ede('0x35')]({'name':_0x298a78[_0x7ede('0x1e')],'resourceId':_0x298a78['id'],'type':_0x599baa[_0x7ede('0x1e')],'sectionId':_0x599baa['id']},{})[_0x7ede('0x19')](function(){return _0x4499ff;});}else{return _0x4499ff;}})['catch'](function(_0x243e95){logger[_0x7ede('0x1d')](_0x7ede('0x3c'),_0x243e95);throw _0x243e95;});}return _0x4499ff;})[_0x7ede('0x19')](respondWithResult(_0x9f498,0xc9))[_0x7ede('0x28')](handleError(_0x9f498,null));};exports['update']=function(_0x3649c1,_0x6eba2f){if(_0x3649c1['body']['id']){delete _0x3649c1[_0x7ede('0x36')]['id'];}return db[_0x7ede('0x23')]['find']({'where':{'id':_0x3649c1[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x6eba2f,null))[_0x7ede('0x19')](saveUpdates(_0x3649c1[_0x7ede('0x36')],null))[_0x7ede('0x19')](respondWithResult(_0x6eba2f,null))[_0x7ede('0x28')](handleError(_0x6eba2f,null));};exports['destroy']=function(_0x1deacd,_0x5b6d4b){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x1deacd[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x5b6d4b,null))[_0x7ede('0x19')](removeEntity(_0x5b6d4b,null))[_0x7ede('0x28')](handleError(_0x5b6d4b,null));};exports[_0x7ede('0x3e')]=function(_0x37b070,_0x1236bb){return db[_0x7ede('0x23')][_0x7ede('0x3e')]()[_0x7ede('0x19')](respondWithResult(_0x1236bb,null))['catch'](handleError(_0x1236bb,null));};exports['getMembers']=function(_0x15b3e9,_0x5daf2e){var _0x2a2b5e={'raw':!![],'where':{}},_0x538a6a={},_0x24e009;return db['ChatQueue'][_0x7ede('0x3f')]({'where':{'id':_0x15b3e9[_0x7ede('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5daf2e,null))['then'](function(_0x33a71a){if(_0x33a71a){_0x24e009=_0x33a71a[_0x7ede('0x38')]({'plain':!![]});_0x538a6a[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db[_0x7ede('0x40')][_0x7ede('0x2c')]);_0x538a6a[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x15b3e9[_0x7ede('0x25')]);_0x538a6a[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x538a6a[_0x7ede('0x2a')],_0x538a6a[_0x7ede('0x25')]);_0x2a2b5e[_0x7ede('0x30')]=_[_0x7ede('0x2e')](_0x538a6a['model'],qs['fields'](_0x15b3e9[_0x7ede('0x25')]['fields']));_0x2a2b5e[_0x7ede('0x30')]=_0x2a2b5e[_0x7ede('0x30')]['length']?_0x2a2b5e['attributes']:_0x538a6a[_0x7ede('0x2a')];if(!_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x2a2b5e[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x13')]);_0x2a2b5e[_0x7ede('0x11')]=qs[_0x7ede('0x11')](_0x15b3e9['query'][_0x7ede('0x11')]);}_0x2a2b5e[_0x7ede('0x43')]=qs['sort'](_0x15b3e9['query'][_0x7ede('0x44')]);_0x2a2b5e[_0x7ede('0x45')]=qs[_0x7ede('0x2d')](_[_0x7ede('0x46')](_0x15b3e9[_0x7ede('0x25')],_0x538a6a[_0x7ede('0x2d')]));_0x2a2b5e[_0x7ede('0x45')][_0x7ede('0x47')]=_0x33a71a['id'];if(_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x48')]){_0x2a2b5e['where']=_[_0x7ede('0x33')](_0x2a2b5e[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x2a2b5e[_0x7ede('0x30')],function(_0x3c1de7){var _0x4efbee={};_0x4efbee[_0x3c1de7]={'$like':'%'+_0x15b3e9[_0x7ede('0x25')]['filter']+'%'};return _0x4efbee;})});}_0x2a2b5e=_[_0x7ede('0x33')]({},_0x2a2b5e,_0x15b3e9[_0x7ede('0x49')]);return db[_0x7ede('0x40')]['findAll'](_0x2a2b5e);}})['then'](function(_0x5008f1){if(_0x5008f1){return db[_0x7ede('0x4a')][_0x7ede('0x4b')]({'where':{'id':_[_0x7ede('0x20')](_0x5008f1,_0x7ede('0x4c')),'role':_0x7ede('0x4d')},'attributes':['id',_0x7ede('0x1e'),_0x7ede('0x4e'),_0x7ede('0x4f'),_0x7ede('0x50')]});}})[_0x7ede('0x19')](function(_0x509ba4){if(_0x509ba4){return{'count':_0x509ba4['count'],'rows':_[_0x7ede('0x20')](_0x509ba4[_0x7ede('0x27')],function(_0x102c34){return{'membername':_0x102c34['name'],'UserId':_0x102c34['id'],'queue_name':_0x24e009[_0x7ede('0x1e')],'ChatQueueId':_0x24e009['id'],'interface':util[_0x7ede('0x51')](_0x7ede('0x52'),'SIP',_0x102c34['name']),'penalty':0x0,'paused':_0x102c34['chatPause'],'createdAt':_0x102c34[_0x7ede('0x50')],'updatedAt':_0x102c34['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ede('0x19')](respondWithFilteredResult(_0x5daf2e,_0x2a2b5e))[_0x7ede('0x28')](handleError(_0x5daf2e,null));};exports[_0x7ede('0x53')]=function(_0x1c02d7,_0x2506a6){var _0x16b210={};var _0x3d6129={};var _0x416bcb;var _0x476a0d;return db[_0x7ede('0x23')][_0x7ede('0x3f')]({'where':{'id':_0x1c02d7[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x2506a6,null))[_0x7ede('0x19')](function(_0x3edcfa){if(_0x3edcfa){_0x416bcb=_0x3edcfa;_0x3d6129['model']=_['keys'](db[_0x7ede('0x54')][_0x7ede('0x2c')]);_0x3d6129['query']=_[_0x7ede('0x2b')](_0x1c02d7['query']);_0x3d6129[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x3d6129[_0x7ede('0x2a')],_0x3d6129[_0x7ede('0x25')]);_0x16b210[_0x7ede('0x30')]=_['intersection'](_0x3d6129[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x2f')]));_0x16b210['attributes']=_0x16b210[_0x7ede('0x30')][_0x7ede('0x31')]?_0x16b210[_0x7ede('0x30')]:_0x3d6129['model'];_0x16b210[_0x7ede('0x43')]=qs['sort'](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x44')]);_0x16b210[_0x7ede('0x45')]=qs['filters'](_[_0x7ede('0x46')](_0x1c02d7[_0x7ede('0x25')],_0x3d6129[_0x7ede('0x2d')]));if(_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x48')]){_0x16b210[_0x7ede('0x45')]=_[_0x7ede('0x33')](_0x16b210[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x16b210[_0x7ede('0x30')],function(_0x2d132a){var _0x5162f4={};_0x5162f4[_0x2d132a]={'$like':'%'+_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x48')]+'%'};return _0x5162f4;})});}_0x16b210=_[_0x7ede('0x33')]({},_0x16b210,_0x1c02d7[_0x7ede('0x49')]);return _0x416bcb[_0x7ede('0x53')](_0x16b210);}})['then'](function(_0x5a5dd7){if(_0x5a5dd7){_0x476a0d=_0x5a5dd7[_0x7ede('0x31')];if(!_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x16b210[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x1c02d7['query'][_0x7ede('0x13')]);_0x16b210[_0x7ede('0x11')]=qs[_0x7ede('0x11')](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x11')]);}return _0x416bcb[_0x7ede('0x53')](_0x16b210);}})[_0x7ede('0x19')](function(_0x5227b7){if(_0x5227b7){return _0x5227b7?{'count':_0x476a0d,'rows':_0x5227b7}:null;}})['then'](respondWithResult(_0x2506a6,null))[_0x7ede('0x28')](handleError(_0x2506a6,null));};exports[_0x7ede('0x55')]=function(_0x547ff1,_0x2f81ee){var _0x35f163=_0x547ff1[_0x7ede('0x36')]['ids'];return db[_0x7ede('0x54')][_0x7ede('0x26')]({'where':{'id':_0x35f163},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ede('0x56'),'attributes':['id',_0x7ede('0x1e'),_0x7ede('0x57'),_0x7ede('0x58'),'interface'],'raw':!![]}]})[_0x7ede('0x19')](function(_0x323bfc){if(_0x323bfc){var _0x400b0c=_[_0x7ede('0x59')](_0x323bfc,function(_0x43f81f){var _0x45fc1b=_0x43f81f[_0x7ede('0x38')]({'plain':!![]});return _0x45fc1b[_0x7ede('0x56')];});return db[_0x7ede('0x23')]['find']({'where':{'id':_0x547ff1['params']['id']}})['then'](function(_0x38ced4){return db[_0x7ede('0x5a')][_0x7ede('0x5b')](function(_0x3375f7){return _0x38ced4[_0x7ede('0x55')](_0x35f163,{'transaction':_0x3375f7})['then'](function(){return BPromise['each'](_0x400b0c,function(_0x40eaba){return db[_0x7ede('0x40')][_0x7ede('0x5c')]({'where':{'UserId':_0x40eaba['id'],'ChatQueueId':_0x547ff1[_0x7ede('0x3d')]['id']},'transaction':_0x3375f7});});})[_0x7ede('0x19')](function(){_0x400b0c[_0x7ede('0x5d')](function(_0x1007dd){socket[_0x7ede('0x5e')](_0x7ede('0x5f'),{'UserId':_0x1007dd['id'],'ChatQueueId':_0x38ced4['id']});});});});});}})[_0x7ede('0x19')](respondWithStatusCode(_0x2f81ee,null))[_0x7ede('0x28')](handleError(_0x2f81ee,null));};exports[_0x7ede('0x60')]=function(_0x19edb4,_0x24d3b6){return db['Team'][_0x7ede('0x26')]({'where':{'id':_0x19edb4[_0x7ede('0x25')][_0x7ede('0x61')]},'attributes':['id'],'include':[{'model':db[_0x7ede('0x4a')],'as':_0x7ede('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7ede('0x19')](handleEntityNotFound(_0x24d3b6,null))[_0x7ede('0x19')](function(_0x1b3450){var _0x339126=_[_0x7ede('0x20')](_0x1b3450,'id');var _0x1415af=[];var _0xd6643a=[];var _0xd06d8a=squel['select']();_0xd06d8a[_0x7ede('0x62')](_0x7ede('0x63'))['from'](_0x7ede('0x64'),'tq')[_0x7ede('0x65')](_0x7ede('0x66'),'ut',_0x7ede('0x67'))[_0x7ede('0x45')]('ChatQueueId\x20=\x20?',_0x19edb4[_0x7ede('0x3d')]['id']);for(var _0x212320=0x0;_0x212320<_0x1b3450[_0x7ede('0x31')];_0x212320+=0x1){let _0x1653fd=_0x1b3450[_0x212320];for(var _0x2d584e=0x0;_0x2d584e<_0x1653fd['Agents'][_0x7ede('0x31')];_0x2d584e+=0x1){let _0x50660d=_0x1653fd[_0x7ede('0x56')][_0x2d584e];var _0x3303e1=_0xd06d8a[_0x7ede('0x68')]();_0x3303e1[_0x7ede('0x45')](_0x7ede('0x69'),_0x50660d['id']);_0xd6643a[_0x7ede('0x6a')](db['sequelize'][_0x7ede('0x25')](_0x3303e1['toString'](),{'type':db[_0x7ede('0x5a')]['QueryTypes']['SELECT']})[_0x7ede('0x19')](function(_0x4fb27e){if(_0x4fb27e[_0x7ede('0x31')]===0x1){return _0x50660d['id'];}else{var _0x1203cf=_[_0x7ede('0x6b')](_[_0x7ede('0x20')](_0x4fb27e,_0x7ede('0x6c')),function(_0x24de4b){return _[_0x7ede('0x6d')](_0x339126,_0x24de4b);});if(_0x1203cf){return _0x50660d['id'];}}}));}}return BPromise[_0x7ede('0x6e')](_0xd6643a)[_0x7ede('0x19')](function(_0x78c6e1){_0x1415af=_(_0x1415af)[_0x7ede('0x6f')](_0x78c6e1)['compact']()[_0x7ede('0x70')]();return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x19edb4[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](function(_0xcff138){return db[_0x7ede('0x5a')][_0x7ede('0x5b')](function(_0x58ded8){return _0xcff138[_0x7ede('0x60')](_0x19edb4[_0x7ede('0x25')][_0x7ede('0x61')],{'transaction':_0x58ded8})[_0x7ede('0x19')](function(){if(!_[_0x7ede('0x71')](_0x1415af)){return _0xcff138['removeAgents'](_0x1415af,{'transaction':_0x58ded8});}})[_0x7ede('0x19')](function(){_0x1415af[_0x7ede('0x5d')](function(_0x378f7a){socket['emit'](_0x7ede('0x72'),{'UserId':_0x378f7a,'ChatQueueId':_0xcff138['id']});});});});});});})['then'](respondWithStatusCode(_0x24d3b6,null))[_0x7ede('0x28')](handleError(_0x24d3b6,null));};exports[_0x7ede('0x73')]=function(_0x4f2240,_0x4593c3){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x4f2240[_0x7ede('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4593c3,null))[_0x7ede('0x19')](function(_0x1f2b47){if(_0x1f2b47){return _0x1f2b47['addAgents'](_0x4f2240['body'][_0x7ede('0x61')],_[_0x7ede('0x74')](_0x4f2240[_0x7ede('0x36')],[_0x7ede('0x61'),'id'])||{})[_0x7ede('0x75')](function(_0x5cfc51){for(var _0x261a5c=0x0;_0x261a5c<_0x4f2240[_0x7ede('0x36')][_0x7ede('0x61')]['length'];_0x261a5c+=0x1){socket[_0x7ede('0x5e')](_0x7ede('0x5f'),{'UserId':Number(_0x4f2240[_0x7ede('0x36')][_0x7ede('0x61')][_0x261a5c]),'ChatQueueId':Number(_0x4f2240[_0x7ede('0x3d')]['id'])});}return _0x5cfc51;});}})['then'](respondWithResult(_0x4593c3,null))[_0x7ede('0x28')](handleError(_0x4593c3,null));};exports[_0x7ede('0x76')]=function(_0x3235d0,_0x18f562){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x3235d0['params']['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x18f562,null))['then'](function(_0x1a599e){if(_0x1a599e){return _0x1a599e['removeAgents'](_0x3235d0[_0x7ede('0x25')]['ids'])['then'](function(){if(_[_0x7ede('0x77')](_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')])){for(var _0x4ec037=0x0;_0x4ec037<_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')][_0x7ede('0x31')];_0x4ec037+=0x1){socket[_0x7ede('0x5e')](_0x7ede('0x72'),{'UserId':Number(_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')][_0x4ec037]),'ChatQueueId':Number(_0x3235d0[_0x7ede('0x3d')]['id'])});}}else{socket[_0x7ede('0x5e')](_0x7ede('0x72'),{'UserId':Number(_0x3235d0['query'][_0x7ede('0x61')]),'ChatQueueId':Number(_0x3235d0[_0x7ede('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x18f562,null))[_0x7ede('0x28')](handleError(_0x18f562,null));};exports[_0x7ede('0x78')]=function(_0x31b08a,_0xccb022){var _0x99bd14={};var _0x18effa={};var _0x598513;var _0x461087;return db[_0x7ede('0x23')]['findOne']({'where':{'id':_0x31b08a['params']['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0xccb022,null))[_0x7ede('0x19')](function(_0x560750){if(_0x560750){_0x598513=_0x560750;_0x18effa[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db['User'][_0x7ede('0x2c')]);_0x18effa[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x31b08a[_0x7ede('0x25')]);_0x18effa[_0x7ede('0x2d')]=_['intersection'](_0x18effa[_0x7ede('0x2a')],_0x18effa['query']);_0x99bd14['attributes']=_[_0x7ede('0x2e')](_0x18effa[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x31b08a['query'][_0x7ede('0x2f')]));_0x99bd14['attributes']=_0x99bd14[_0x7ede('0x30')][_0x7ede('0x31')]?_0x99bd14[_0x7ede('0x30')]:_0x18effa[_0x7ede('0x2a')];_0x99bd14['order']=qs['sort'](_0x31b08a[_0x7ede('0x25')][_0x7ede('0x44')]);_0x99bd14[_0x7ede('0x45')]=qs[_0x7ede('0x2d')](_[_0x7ede('0x46')](_0x31b08a[_0x7ede('0x25')],_0x18effa[_0x7ede('0x2d')]));if(_0x31b08a[_0x7ede('0x25')]['filter']){_0x99bd14['where']=_[_0x7ede('0x33')](_0x99bd14[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x99bd14[_0x7ede('0x30')],function(_0x21f4f9){var _0x1968ec={};_0x1968ec[_0x21f4f9]={'$like':'%'+_0x31b08a[_0x7ede('0x25')][_0x7ede('0x48')]+'%'};return _0x1968ec;})});}_0x99bd14=_[_0x7ede('0x33')]({},_0x99bd14,_0x31b08a[_0x7ede('0x49')]);return _0x598513['getAgents'](_0x99bd14);}})['then'](function(_0x4e1ddb){if(_0x4e1ddb){_0x461087=_0x4e1ddb['length'];if(!_0x31b08a[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x99bd14[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x31b08a[_0x7ede('0x25')][_0x7ede('0x13')]);_0x99bd14[_0x7ede('0x11')]=qs['offset'](_0x31b08a['query'][_0x7ede('0x11')]);}return _0x598513[_0x7ede('0x78')](_0x99bd14);}})[_0x7ede('0x19')](function(_0x513714){if(_0x513714){return _0x513714?{'count':_0x461087,'rows':_0x513714}:null;}})['then'](respondWithResult(_0xccb022,null))[_0x7ede('0x28')](handleError(_0xccb022,null));}; \ No newline at end of file +var _0x0d42=['omit','spread','userChatQueue:save','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','get','ChatQueues','destroy','error','stack','name','send','index','map','key','getOptions','where','ChatQueue','include','query','rows','show','params','model','keys','intersection','fields','attributes','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserChatQueue','rawAttributes','filters','length','hasOwnProperty','nolimit','sort','pick','filter','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents'];(function(_0x9faff7,_0x59a564){var _0x4f8043=function(_0x5f060d){while(--_0x5f060d){_0x9faff7['push'](_0x9faff7['shift']());}};_0x4f8043(++_0x59a564);}(_0x0d42,0x1ea));var _0x20d4=function(_0x5e4a9c,_0x2c0d9b){_0x5e4a9c=_0x5e4a9c-0x0;var _0x7f3c28=_0x0d42[_0x5e4a9c];return _0x7f3c28;};'use strict';var BPromise=require(_0x20d4('0x0'));var util=require(_0x20d4('0x1'));var _=require('lodash');var squel=require(_0x20d4('0x2'));var Redis=require(_0x20d4('0x3'));var qs=require(_0x20d4('0x4'));var logger=require(_0x20d4('0x5'))(_0x20d4('0x6'));var config=require(_0x20d4('0x7'));var db=require(_0x20d4('0x8'))['db'];config[_0x20d4('0x9')]=_[_0x20d4('0xa')](config[_0x20d4('0x9')],{'host':_0x20d4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20d4('0x9')]));require('./chatQueue.socket')[_0x20d4('0xc')](socket);function respondWithStatusCode(_0x45291f,_0x24d44d){_0x24d44d=_0x24d44d||0xcc;return function(_0x5684f7){if(_0x5684f7){return _0x45291f[_0x20d4('0xd')](_0x24d44d);}return _0x45291f[_0x20d4('0xe')](_0x24d44d)[_0x20d4('0xf')]();};}function respondWithResult(_0x369574,_0x44dba1){_0x44dba1=_0x44dba1||0xc8;return function(_0x3aa4f7){if(_0x3aa4f7){return _0x369574[_0x20d4('0xe')](_0x44dba1)['json'](_0x3aa4f7);}};}function respondWithFilteredResult(_0x32d120,_0x49234a){return function(_0x57e66b){if(_0x57e66b){var _0x30a5e1=typeof _0x49234a[_0x20d4('0x10')]===_0x20d4('0x11')&&typeof _0x49234a[_0x20d4('0x12')]==='undefined';var _0x31a4cc=_0x57e66b['count'];var _0x2d19a4=_0x30a5e1?0x0:_0x49234a['offset'];var _0xe6e85b=_0x30a5e1?_0x57e66b[_0x20d4('0x13')]:_0x49234a[_0x20d4('0x10')]+_0x49234a[_0x20d4('0x12')];var _0x42ff3d;if(_0xe6e85b>=_0x31a4cc){_0xe6e85b=_0x31a4cc;_0x42ff3d=0xc8;}else{_0x42ff3d=0xce;}_0x32d120[_0x20d4('0xe')](_0x42ff3d);return _0x32d120['set'](_0x20d4('0x14'),_0x2d19a4+'-'+_0xe6e85b+'/'+_0x31a4cc)[_0x20d4('0x15')](_0x57e66b);}return null;};}function saveUpdates(_0x3d721e){return function(_0x23afcc){if(_0x23afcc){return _0x23afcc[_0x20d4('0x16')](_0x3d721e)[_0x20d4('0x17')](function(_0xcdcd82){return _0xcdcd82;});}return null;};}function removeEntity(_0x11a43d){return function(_0x5195dd){if(_0x5195dd){return _0x5195dd['destroy']()['then'](function(){var _0x2162e0=_0x5195dd[_0x20d4('0x18')]({'plain':!![]});var _0x1a9333=_0x20d4('0x19');return db['UserProfileResource'][_0x20d4('0x1a')]({'where':{'type':_0x1a9333,'resourceId':_0x2162e0['id']}})['then'](function(){return _0x5195dd;});})[_0x20d4('0x17')](function(){_0x11a43d[_0x20d4('0xe')](0xcc)[_0x20d4('0xf')]();});}};}function handleEntityNotFound(_0x6640b3){return function(_0x1900eb){if(!_0x1900eb){_0x6640b3[_0x20d4('0xd')](0x194);}return _0x1900eb;};}function handleError(_0x5aa8db,_0x55682c){_0x55682c=_0x55682c||0x1f4;return function(_0x498fd7){logger[_0x20d4('0x1b')](_0x498fd7[_0x20d4('0x1c')]);if(_0x498fd7[_0x20d4('0x1d')]){delete _0x498fd7[_0x20d4('0x1d')];}_0x5aa8db['status'](_0x55682c)[_0x20d4('0x1e')](_0x498fd7);};}exports[_0x20d4('0x1f')]=function(_0x477a82,_0x3b029f){var _0x5bb299={};var _0x45898e={'count':0x0,'rows':[]};var _0x1db65a=_[_0x20d4('0x20')](db['ChatQueue']['rawAttributes'],function(_0x55606d){return{'name':_0x55606d['fieldName'],'type':_0x55606d['type'][_0x20d4('0x21')]};});_0x5bb299=qs[_0x20d4('0x22')](_0x1db65a,_0x477a82);var _0x469738={'where':_0x5bb299[_0x20d4('0x23')]};return db[_0x20d4('0x24')][_0x20d4('0x13')](_0x469738)['then'](function(_0x3e6c00){_0x45898e[_0x20d4('0x13')]=_0x3e6c00;_0x5bb299[_0x20d4('0x25')]=qs[_0x20d4('0x25')](_0x477a82[_0x20d4('0x26')]);return db[_0x20d4('0x24')]['findAll'](_0x5bb299);})[_0x20d4('0x17')](function(_0x343247){_0x45898e[_0x20d4('0x27')]=_0x343247;return _0x45898e;})[_0x20d4('0x17')](respondWithFilteredResult(_0x3b029f,_0x5bb299))['catch'](handleError(_0x3b029f,null));};exports[_0x20d4('0x28')]=function(_0x1bb21e,_0x6a78fa){var _0x58cb11={'raw':!![],'where':{'id':_0x1bb21e[_0x20d4('0x29')]['id']}},_0x3415c9={};_0x3415c9[_0x20d4('0x2a')]=_[_0x20d4('0x2b')](db[_0x20d4('0x24')]['rawAttributes']);_0x3415c9[_0x20d4('0x26')]=_[_0x20d4('0x2b')](_0x1bb21e[_0x20d4('0x26')]);_0x3415c9['filters']=_[_0x20d4('0x2c')](_0x3415c9[_0x20d4('0x2a')],_0x3415c9[_0x20d4('0x26')]);_0x58cb11['attributes']=_[_0x20d4('0x2c')](_0x3415c9['model'],qs[_0x20d4('0x2d')](_0x1bb21e[_0x20d4('0x26')][_0x20d4('0x2d')]));_0x58cb11[_0x20d4('0x2e')]=_0x58cb11[_0x20d4('0x2e')]['length']?_0x58cb11[_0x20d4('0x2e')]:_0x3415c9[_0x20d4('0x2a')];if(_0x1bb21e['query'][_0x20d4('0x2f')]){_0x58cb11[_0x20d4('0x25')]=[{'all':!![]}];}_0x58cb11=_[_0x20d4('0x30')]({},_0x58cb11,_0x1bb21e[_0x20d4('0x31')]);return db[_0x20d4('0x24')]['find'](_0x58cb11)['then'](handleEntityNotFound(_0x6a78fa,null))[_0x20d4('0x17')](respondWithResult(_0x6a78fa,null))['catch'](handleError(_0x6a78fa,null));};exports[_0x20d4('0x32')]=function(_0x5f1812,_0x59e0c7){return db[_0x20d4('0x24')][_0x20d4('0x32')](_0x5f1812[_0x20d4('0x33')],{})[_0x20d4('0x17')](function(_0x490e1f){var _0x3344e3=_0x5f1812[_0x20d4('0x34')][_0x20d4('0x18')]({'plain':!![]});if(!_0x3344e3)throw new Error(_0x20d4('0x35'));if(_0x3344e3[_0x20d4('0x36')]===_0x20d4('0x34')){var _0x455aed=_0x490e1f[_0x20d4('0x18')]({'plain':!![]});var _0x3708dc=_0x20d4('0x19');return db[_0x20d4('0x37')][_0x20d4('0x38')]({'where':{'name':_0x3708dc,'userProfileId':_0x3344e3[_0x20d4('0x39')]},'raw':!![]})[_0x20d4('0x17')](function(_0x346861){if(_0x346861&&_0x346861['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x455aed[_0x20d4('0x1d')],'resourceId':_0x455aed['id'],'type':_0x346861[_0x20d4('0x1d')],'sectionId':_0x346861['id']},{})[_0x20d4('0x17')](function(){return _0x490e1f;});}else{return _0x490e1f;}})[_0x20d4('0x3a')](function(_0x167827){logger[_0x20d4('0x1b')](_0x20d4('0x3b'),_0x167827);throw _0x167827;});}return _0x490e1f;})[_0x20d4('0x17')](respondWithResult(_0x59e0c7,0xc9))[_0x20d4('0x3a')](handleError(_0x59e0c7,null));};exports[_0x20d4('0x16')]=function(_0x5ad163,_0x4b1f93){if(_0x5ad163['body']['id']){delete _0x5ad163['body']['id'];}return db[_0x20d4('0x24')][_0x20d4('0x38')]({'where':{'id':_0x5ad163[_0x20d4('0x29')]['id']}})[_0x20d4('0x17')](handleEntityNotFound(_0x4b1f93,null))[_0x20d4('0x17')](saveUpdates(_0x5ad163['body'],null))[_0x20d4('0x17')](respondWithResult(_0x4b1f93,null))['catch'](handleError(_0x4b1f93,null));};exports[_0x20d4('0x1a')]=function(_0x106c09,_0x59f156){return db[_0x20d4('0x24')][_0x20d4('0x38')]({'where':{'id':_0x106c09[_0x20d4('0x29')]['id']}})['then'](handleEntityNotFound(_0x59f156,null))[_0x20d4('0x17')](removeEntity(_0x59f156,null))['catch'](handleError(_0x59f156,null));};exports['describe']=function(_0x4915ec,_0x5a0697){return db[_0x20d4('0x24')]['describe']()[_0x20d4('0x17')](respondWithResult(_0x5a0697,null))[_0x20d4('0x3a')](handleError(_0x5a0697,null));};exports[_0x20d4('0x3c')]=function(_0x1b621c,_0x2b7bf7){var _0x2a5838={'raw':!![],'where':{}},_0x387595={},_0x3ae3b0;return db[_0x20d4('0x24')][_0x20d4('0x3d')]({'where':{'id':_0x1b621c[_0x20d4('0x29')]['id']}})['then'](handleEntityNotFound(_0x2b7bf7,null))[_0x20d4('0x17')](function(_0x1a3deb){if(_0x1a3deb){_0x3ae3b0=_0x1a3deb[_0x20d4('0x18')]({'plain':!![]});_0x387595[_0x20d4('0x2a')]=_[_0x20d4('0x2b')](db[_0x20d4('0x3e')][_0x20d4('0x3f')]);_0x387595['query']=_[_0x20d4('0x2b')](_0x1b621c[_0x20d4('0x26')]);_0x387595[_0x20d4('0x40')]=_[_0x20d4('0x2c')](_0x387595['model'],_0x387595[_0x20d4('0x26')]);_0x2a5838[_0x20d4('0x2e')]=_[_0x20d4('0x2c')](_0x387595[_0x20d4('0x2a')],qs[_0x20d4('0x2d')](_0x1b621c['query']['fields']));_0x2a5838['attributes']=_0x2a5838[_0x20d4('0x2e')][_0x20d4('0x41')]?_0x2a5838['attributes']:_0x387595[_0x20d4('0x2a')];if(!_0x1b621c[_0x20d4('0x26')][_0x20d4('0x42')](_0x20d4('0x43'))){_0x2a5838[_0x20d4('0x12')]=qs[_0x20d4('0x12')](_0x1b621c[_0x20d4('0x26')][_0x20d4('0x12')]);_0x2a5838[_0x20d4('0x10')]=qs[_0x20d4('0x10')](_0x1b621c[_0x20d4('0x26')][_0x20d4('0x10')]);}_0x2a5838['order']=qs['sort'](_0x1b621c[_0x20d4('0x26')][_0x20d4('0x44')]);_0x2a5838['where']=qs[_0x20d4('0x40')](_[_0x20d4('0x45')](_0x1b621c['query'],_0x387595['filters']));_0x2a5838[_0x20d4('0x23')]['ChatQueueId']=_0x1a3deb['id'];if(_0x1b621c[_0x20d4('0x26')]['filter']){_0x2a5838['where']=_[_0x20d4('0x30')](_0x2a5838['where'],{'$or':_[_0x20d4('0x20')](_0x2a5838[_0x20d4('0x2e')],function(_0x50ae08){var _0x36594f={};_0x36594f[_0x50ae08]={'$like':'%'+_0x1b621c[_0x20d4('0x26')][_0x20d4('0x46')]+'%'};return _0x36594f;})});}_0x2a5838=_['merge']({},_0x2a5838,_0x1b621c[_0x20d4('0x31')]);return db[_0x20d4('0x3e')][_0x20d4('0x47')](_0x2a5838);}})[_0x20d4('0x17')](function(_0x42b4de){if(_0x42b4de){return db[_0x20d4('0x48')][_0x20d4('0x49')]({'where':{'id':_['map'](_0x42b4de,'UserId'),'role':_0x20d4('0x4a')},'attributes':['id','name',_0x20d4('0x4b'),_0x20d4('0x4c'),_0x20d4('0x4d')]});}})[_0x20d4('0x17')](function(_0x59bbed){if(_0x59bbed){return{'count':_0x59bbed[_0x20d4('0x13')],'rows':_[_0x20d4('0x20')](_0x59bbed[_0x20d4('0x27')],function(_0x3d06b9){return{'membername':_0x3d06b9[_0x20d4('0x1d')],'UserId':_0x3d06b9['id'],'queue_name':_0x3ae3b0[_0x20d4('0x1d')],'ChatQueueId':_0x3ae3b0['id'],'interface':util[_0x20d4('0x4e')]('%s/%s','SIP',_0x3d06b9[_0x20d4('0x1d')]),'penalty':0x0,'paused':_0x3d06b9[_0x20d4('0x4b')],'createdAt':_0x3d06b9[_0x20d4('0x4d')],'updatedAt':_0x3d06b9[_0x20d4('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x20d4('0x17')](respondWithFilteredResult(_0x2b7bf7,_0x2a5838))[_0x20d4('0x3a')](handleError(_0x2b7bf7,null));};exports[_0x20d4('0x4f')]=function(_0x33816c,_0x344b7b){var _0x4e6bb6={};var _0x50e2d7={};var _0x1bf85d;var _0x58b53d;return db[_0x20d4('0x24')]['findOne']({'where':{'id':_0x33816c['params']['id']}})[_0x20d4('0x17')](handleEntityNotFound(_0x344b7b,null))[_0x20d4('0x17')](function(_0x1d7ce9){if(_0x1d7ce9){_0x1bf85d=_0x1d7ce9;_0x50e2d7[_0x20d4('0x2a')]=_[_0x20d4('0x2b')](db[_0x20d4('0x50')][_0x20d4('0x3f')]);_0x50e2d7['query']=_['keys'](_0x33816c[_0x20d4('0x26')]);_0x50e2d7[_0x20d4('0x40')]=_[_0x20d4('0x2c')](_0x50e2d7[_0x20d4('0x2a')],_0x50e2d7[_0x20d4('0x26')]);_0x4e6bb6[_0x20d4('0x2e')]=_[_0x20d4('0x2c')](_0x50e2d7[_0x20d4('0x2a')],qs[_0x20d4('0x2d')](_0x33816c[_0x20d4('0x26')][_0x20d4('0x2d')]));_0x4e6bb6[_0x20d4('0x2e')]=_0x4e6bb6[_0x20d4('0x2e')]['length']?_0x4e6bb6['attributes']:_0x50e2d7[_0x20d4('0x2a')];_0x4e6bb6[_0x20d4('0x51')]=qs['sort'](_0x33816c[_0x20d4('0x26')]['sort']);_0x4e6bb6[_0x20d4('0x23')]=qs[_0x20d4('0x40')](_[_0x20d4('0x45')](_0x33816c[_0x20d4('0x26')],_0x50e2d7['filters']));if(_0x33816c[_0x20d4('0x26')][_0x20d4('0x46')]){_0x4e6bb6[_0x20d4('0x23')]=_[_0x20d4('0x30')](_0x4e6bb6[_0x20d4('0x23')],{'$or':_[_0x20d4('0x20')](_0x4e6bb6['attributes'],function(_0x37484d){var _0x2b7903={};_0x2b7903[_0x37484d]={'$like':'%'+_0x33816c['query'][_0x20d4('0x46')]+'%'};return _0x2b7903;})});}_0x4e6bb6=_[_0x20d4('0x30')]({},_0x4e6bb6,_0x33816c['options']);return _0x1bf85d[_0x20d4('0x4f')](_0x4e6bb6);}})[_0x20d4('0x17')](function(_0x4e57a8){if(_0x4e57a8){_0x58b53d=_0x4e57a8['length'];if(!_0x33816c['query'][_0x20d4('0x42')](_0x20d4('0x43'))){_0x4e6bb6[_0x20d4('0x12')]=qs[_0x20d4('0x12')](_0x33816c[_0x20d4('0x26')][_0x20d4('0x12')]);_0x4e6bb6[_0x20d4('0x10')]=qs['offset'](_0x33816c[_0x20d4('0x26')][_0x20d4('0x10')]);}return _0x1bf85d[_0x20d4('0x4f')](_0x4e6bb6);}})['then'](function(_0x54575f){if(_0x54575f){return _0x54575f?{'count':_0x58b53d,'rows':_0x54575f}:null;}})[_0x20d4('0x17')](respondWithResult(_0x344b7b,null))[_0x20d4('0x3a')](handleError(_0x344b7b,null));};exports[_0x20d4('0x52')]=function(_0x1f9d6d,_0x447866){var _0x135c5d=_0x1f9d6d[_0x20d4('0x33')][_0x20d4('0x53')];return db[_0x20d4('0x50')][_0x20d4('0x47')]({'where':{'id':_0x135c5d},'attributes':['id'],'include':[{'model':db[_0x20d4('0x48')],'as':_0x20d4('0x54'),'attributes':['id','name',_0x20d4('0x55'),_0x20d4('0x56'),_0x20d4('0x57')],'raw':!![]}]})[_0x20d4('0x17')](function(_0x445428){if(_0x445428){var _0x259bc3=_[_0x20d4('0x58')](_0x445428,function(_0x480fd7){var _0x4f457c=_0x480fd7[_0x20d4('0x18')]({'plain':!![]});return _0x4f457c[_0x20d4('0x54')];});return db[_0x20d4('0x24')]['find']({'where':{'id':_0x1f9d6d[_0x20d4('0x29')]['id']}})['then'](function(_0x595213){return db[_0x20d4('0x59')][_0x20d4('0x5a')](function(_0x16bdd2){return _0x595213['addTeams'](_0x135c5d,{'transaction':_0x16bdd2})[_0x20d4('0x17')](function(){return BPromise['each'](_0x259bc3,function(_0x31efe1){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x31efe1['id'],'ChatQueueId':_0x1f9d6d[_0x20d4('0x29')]['id']},'transaction':_0x16bdd2});});})[_0x20d4('0x17')](function(){_0x259bc3[_0x20d4('0x5b')](function(_0x4ec9d7){socket[_0x20d4('0x5c')]('userChatQueue:save',{'UserId':_0x4ec9d7['id'],'ChatQueueId':_0x595213['id']});});});});});}})[_0x20d4('0x17')](respondWithStatusCode(_0x447866,null))[_0x20d4('0x3a')](handleError(_0x447866,null));};exports[_0x20d4('0x5d')]=function(_0x3240d2,_0x43bf2d){return db[_0x20d4('0x50')][_0x20d4('0x47')]({'where':{'id':_0x3240d2[_0x20d4('0x26')][_0x20d4('0x53')]},'attributes':['id'],'include':[{'model':db[_0x20d4('0x48')],'as':_0x20d4('0x54'),'attributes':['id'],'raw':!![]}]})[_0x20d4('0x17')](handleEntityNotFound(_0x43bf2d,null))['then'](function(_0x399843){var _0x23fd80=_['map'](_0x399843,'id');var _0x572a29=[];var _0x50a2d9=[];var _0x382795=squel[_0x20d4('0x5e')]();_0x382795[_0x20d4('0x5f')]('tq.TeamId')[_0x20d4('0x60')](_0x20d4('0x61'),'tq')[_0x20d4('0x62')](_0x20d4('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x20d4('0x23')](_0x20d4('0x64'),_0x3240d2[_0x20d4('0x29')]['id']);for(var _0x516b2d=0x0;_0x516b2d<_0x399843['length'];_0x516b2d+=0x1){let _0x3a3f68=_0x399843[_0x516b2d];for(var _0x580ec0=0x0;_0x580ec0<_0x3a3f68[_0x20d4('0x54')][_0x20d4('0x41')];_0x580ec0+=0x1){let _0x5dcb21=_0x3a3f68[_0x20d4('0x54')][_0x580ec0];var _0x10db9a=_0x382795['clone']();_0x10db9a[_0x20d4('0x23')](_0x20d4('0x65'),_0x5dcb21['id']);_0x50a2d9[_0x20d4('0x66')](db[_0x20d4('0x59')][_0x20d4('0x26')](_0x10db9a[_0x20d4('0x67')](),{'type':db['sequelize'][_0x20d4('0x68')][_0x20d4('0x69')]})[_0x20d4('0x17')](function(_0x1d873f){if(_0x1d873f[_0x20d4('0x41')]===0x1){return _0x5dcb21['id'];}else{var _0x388e57=_[_0x20d4('0x6a')](_[_0x20d4('0x20')](_0x1d873f,_0x20d4('0x6b')),function(_0x1d50bb){return _[_0x20d4('0x6c')](_0x23fd80,_0x1d50bb);});if(_0x388e57){return _0x5dcb21['id'];}}}));}}return BPromise[_0x20d4('0x6d')](_0x50a2d9)[_0x20d4('0x17')](function(_0x220f37){_0x572a29=_(_0x572a29)[_0x20d4('0x6e')](_0x220f37)[_0x20d4('0x6f')]()['value']();return db[_0x20d4('0x24')][_0x20d4('0x38')]({'where':{'id':_0x3240d2['params']['id']}})[_0x20d4('0x17')](function(_0x4b60e5){return db[_0x20d4('0x59')][_0x20d4('0x5a')](function(_0x39b3a5){return _0x4b60e5[_0x20d4('0x5d')](_0x3240d2[_0x20d4('0x26')]['ids'],{'transaction':_0x39b3a5})[_0x20d4('0x17')](function(){if(!_[_0x20d4('0x70')](_0x572a29)){return _0x4b60e5[_0x20d4('0x71')](_0x572a29,{'transaction':_0x39b3a5});}})['then'](function(){_0x572a29['forEach'](function(_0x4dd8fa){socket[_0x20d4('0x5c')]('userChatQueue:remove',{'UserId':_0x4dd8fa,'ChatQueueId':_0x4b60e5['id']});});});});});});})[_0x20d4('0x17')](respondWithStatusCode(_0x43bf2d,null))[_0x20d4('0x3a')](handleError(_0x43bf2d,null));};exports[_0x20d4('0x72')]=function(_0x3d26a5,_0x18bb32){return db[_0x20d4('0x24')]['find']({'where':{'id':_0x3d26a5[_0x20d4('0x29')]['id']}})[_0x20d4('0x17')](handleEntityNotFound(_0x18bb32,null))[_0x20d4('0x17')](function(_0x45a998){if(_0x45a998){return _0x45a998['addAgents'](_0x3d26a5['body'][_0x20d4('0x53')],_[_0x20d4('0x73')](_0x3d26a5[_0x20d4('0x33')],[_0x20d4('0x53'),'id'])||{})[_0x20d4('0x74')](function(_0x49756d){for(var _0x2d9dfb=0x0;_0x2d9dfb<_0x3d26a5[_0x20d4('0x33')]['ids'][_0x20d4('0x41')];_0x2d9dfb+=0x1){socket[_0x20d4('0x5c')](_0x20d4('0x75'),{'UserId':Number(_0x3d26a5['body'][_0x20d4('0x53')][_0x2d9dfb]),'ChatQueueId':Number(_0x3d26a5[_0x20d4('0x29')]['id'])});}return _0x49756d;});}})[_0x20d4('0x17')](respondWithResult(_0x18bb32,null))['catch'](handleError(_0x18bb32,null));};exports['removeAgents']=function(_0x35ae49,_0x2db847){return db[_0x20d4('0x24')]['find']({'where':{'id':_0x35ae49[_0x20d4('0x29')]['id']}})[_0x20d4('0x17')](handleEntityNotFound(_0x2db847,null))[_0x20d4('0x17')](function(_0xf0685f){if(_0xf0685f){return _0xf0685f[_0x20d4('0x71')](_0x35ae49[_0x20d4('0x26')]['ids'])[_0x20d4('0x17')](function(){if(_[_0x20d4('0x76')](_0x35ae49['query']['ids'])){for(var _0x5233cf=0x0;_0x5233cf<_0x35ae49[_0x20d4('0x26')][_0x20d4('0x53')][_0x20d4('0x41')];_0x5233cf+=0x1){socket['emit'](_0x20d4('0x77'),{'UserId':Number(_0x35ae49['query'][_0x20d4('0x53')][_0x5233cf]),'ChatQueueId':Number(_0x35ae49[_0x20d4('0x29')]['id'])});}}else{socket['emit'](_0x20d4('0x77'),{'UserId':Number(_0x35ae49[_0x20d4('0x26')][_0x20d4('0x53')]),'ChatQueueId':Number(_0x35ae49[_0x20d4('0x29')]['id'])});}});}})[_0x20d4('0x17')](respondWithStatusCode(_0x2db847,null))[_0x20d4('0x3a')](handleError(_0x2db847,null));};exports[_0x20d4('0x78')]=function(_0x46e200,_0x2ceff9){var _0x3fea7e={};var _0x1d6a2c={};var _0x107ee8;var _0x48fb7b;return db[_0x20d4('0x24')][_0x20d4('0x3d')]({'where':{'id':_0x46e200[_0x20d4('0x29')]['id']}})['then'](handleEntityNotFound(_0x2ceff9,null))[_0x20d4('0x17')](function(_0x19447a){if(_0x19447a){_0x107ee8=_0x19447a;_0x1d6a2c[_0x20d4('0x2a')]=_[_0x20d4('0x2b')](db['User']['rawAttributes']);_0x1d6a2c[_0x20d4('0x26')]=_[_0x20d4('0x2b')](_0x46e200[_0x20d4('0x26')]);_0x1d6a2c['filters']=_[_0x20d4('0x2c')](_0x1d6a2c[_0x20d4('0x2a')],_0x1d6a2c[_0x20d4('0x26')]);_0x3fea7e[_0x20d4('0x2e')]=_[_0x20d4('0x2c')](_0x1d6a2c['model'],qs[_0x20d4('0x2d')](_0x46e200[_0x20d4('0x26')][_0x20d4('0x2d')]));_0x3fea7e['attributes']=_0x3fea7e['attributes'][_0x20d4('0x41')]?_0x3fea7e[_0x20d4('0x2e')]:_0x1d6a2c[_0x20d4('0x2a')];_0x3fea7e[_0x20d4('0x51')]=qs[_0x20d4('0x44')](_0x46e200[_0x20d4('0x26')][_0x20d4('0x44')]);_0x3fea7e['where']=qs['filters'](_['pick'](_0x46e200['query'],_0x1d6a2c['filters']));if(_0x46e200['query']['filter']){_0x3fea7e[_0x20d4('0x23')]=_[_0x20d4('0x30')](_0x3fea7e[_0x20d4('0x23')],{'$or':_['map'](_0x3fea7e[_0x20d4('0x2e')],function(_0x580730){var _0x2a4dce={};_0x2a4dce[_0x580730]={'$like':'%'+_0x46e200[_0x20d4('0x26')][_0x20d4('0x46')]+'%'};return _0x2a4dce;})});}_0x3fea7e=_[_0x20d4('0x30')]({},_0x3fea7e,_0x46e200[_0x20d4('0x31')]);return _0x107ee8['getAgents'](_0x3fea7e);}})[_0x20d4('0x17')](function(_0x406bb9){if(_0x406bb9){_0x48fb7b=_0x406bb9[_0x20d4('0x41')];if(!_0x46e200[_0x20d4('0x26')]['hasOwnProperty'](_0x20d4('0x43'))){_0x3fea7e[_0x20d4('0x12')]=qs[_0x20d4('0x12')](_0x46e200[_0x20d4('0x26')]['limit']);_0x3fea7e['offset']=qs['offset'](_0x46e200[_0x20d4('0x26')]['offset']);}return _0x107ee8[_0x20d4('0x78')](_0x3fea7e);}})['then'](function(_0x5f08ab){if(_0x5f08ab){return _0x5f08ab?{'count':_0x48fb7b,'rows':_0x5f08ab}:null;}})[_0x20d4('0x17')](respondWithResult(_0x2ceff9,null))[_0x20d4('0x3a')](handleError(_0x2ceff9,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 651c59f..102e8da 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 _0x0911=['hasOwnProperty','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x4a130c,_0x4283a4){var _0x2c75e9=function(_0x564252){while(--_0x564252){_0x4a130c['push'](_0x4a130c['shift']());}};_0x2c75e9(++_0x4283a4);}(_0x0911,0xed));var _0x1091=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x0911[_0x5ca5bc];return _0x26ca86;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x1091('0x0'))['db'][_0x1091('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1091('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1091('0x3'),'afterDestroy':_0x1091('0x4')};function emitEvent(_0x4517f9){return function(_0x1202e2,_0x53f2f5,_0x1ab2ed){ChatQueueEvents['emit'](_0x4517f9+':'+_0x1202e2['id'],_0x1202e2);ChatQueueEvents[_0x1091('0x5')](_0x4517f9,_0x1202e2);_0x1ab2ed(null);};}for(var e in events){if(events[_0x1091('0x6')](e)){var event=events[e];ChatQueue[_0x1091('0x7')](e,emitEvent(event));}}module[_0x1091('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x57d4=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x57d4,0x78));var _0x457d=function(_0x1075ac,_0x3a72f7){_0x1075ac=_0x1075ac-0x0;var _0x1146cf=_0x57d4[_0x1075ac];return _0x1146cf;};'use strict';var EventEmitter=require(_0x457d('0x0'));var ChatQueue=require(_0x457d('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x457d('0x2')](0x0);var events={'afterCreate':_0x457d('0x3'),'afterUpdate':_0x457d('0x4'),'afterDestroy':_0x457d('0x5')};function emitEvent(_0x1219e1){return function(_0x3c89b2,_0x3e2239,_0x1f5b4e){ChatQueueEvents[_0x457d('0x6')](_0x1219e1+':'+_0x3c89b2['id'],_0x3c89b2);ChatQueueEvents[_0x457d('0x6')](_0x1219e1,_0x3c89b2);_0x1f5b4e(null);};}for(var e in events){if(events[_0x457d('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x457d('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aca24c9..1e699c4 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 _0xbb76=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x60d09,_0x26cd05){var _0x515079=function(_0x5e951a){while(--_0x5e951a){_0x60d09['push'](_0x60d09['shift']());}};_0x515079(++_0x26cd05);}(_0xbb76,0x14d));var _0x6bb7=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0xbb76[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x6bb7('0x0'));var util=require(_0x6bb7('0x1'));var logger=require(_0x6bb7('0x2'))('api');var moment=require(_0x6bb7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bb7('0x4'));var rimraf=require('rimraf');var config=require(_0x6bb7('0x5'));var attributes=require(_0x6bb7('0x6'));module[_0x6bb7('0x7')]=function(_0x161690,_0x554632){return _0x161690[_0x6bb7('0x8')](_0x6bb7('0x9'),attributes,{'tableName':_0x6bb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22c9=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x4c404f,_0x26dfd){var _0x18a1e5=function(_0x3776e7){while(--_0x3776e7){_0x4c404f['push'](_0x4c404f['shift']());}};_0x18a1e5(++_0x26dfd);}(_0x22c9,0x1ec));var _0x922c=function(_0x41a596,_0x9963c){_0x41a596=_0x41a596-0x0;var _0x48cad1=_0x22c9[_0x41a596];return _0x48cad1;};'use strict';var _=require('lodash');var util=require(_0x922c('0x0'));var logger=require(_0x922c('0x1'))('api');var moment=require(_0x922c('0x2'));var BPromise=require('bluebird');var rp=require(_0x922c('0x3'));var fs=require('fs');var path=require(_0x922c('0x4'));var rimraf=require(_0x922c('0x5'));var config=require(_0x922c('0x6'));var attributes=require(_0x922c('0x7'));module[_0x922c('0x8')]=function(_0x167731,_0x2dee10){return _0x167731[_0x922c('0x9')](_0x922c('0xa'),attributes,{'tableName':_0x922c('0xb'),'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 1486b55..d2ec311 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 _0x4060=['ChatQueue','findAll','options','attributes','limit','include','map','model','catch','ShowChatQueue','find','raw','where','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetChatQueue'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4060,0x89));var _0x0406=function(_0x53a5f2,_0x5e3a35){_0x53a5f2=_0x53a5f2-0x0;var _0x4666ac=_0x4060[_0x53a5f2];return _0x4666ac;};'use strict';var _=require('lodash');var util=require(_0x0406('0x0'));var moment=require('moment');var BPromise=require(_0x0406('0x1'));var rs=require(_0x0406('0x2'));var fs=require('fs');var Redis=require(_0x0406('0x3'));var db=require(_0x0406('0x4'))['db'];var utils=require(_0x0406('0x5'));var logger=require(_0x0406('0x6'))('rpc');var config=require(_0x0406('0x7'));var jayson=require(_0x0406('0x8'));var client=jayson['client'][_0x0406('0x9')]({'port':0x232a});config[_0x0406('0xa')]=_['defaults'](config[_0x0406('0xa')],{'host':_0x0406('0xb'),'port':0x18eb});var socket=require(_0x0406('0xc'))(new Redis(config[_0x0406('0xa')]));require(_0x0406('0xd'))[_0x0406('0xe')](socket);function respondWithRpcPromise(_0x22a46d,_0x397bb5,_0x514b78){return new BPromise(function(_0x93f6da,_0x28bccc){return client[_0x0406('0xf')](_0x22a46d,_0x514b78)[_0x0406('0x10')](function(_0x40af0a){logger[_0x0406('0x11')](_0x0406('0x12'),_0x397bb5,_0x0406('0x13'));logger['debug'](_0x0406('0x14'),_0x397bb5,_0x0406('0x13'),JSON[_0x0406('0x15')](_0x40af0a));if(_0x40af0a['error']){if(_0x40af0a['error'][_0x0406('0x16')]===0x1f4){logger[_0x0406('0x17')](_0x0406('0x12'),_0x397bb5,_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);return _0x28bccc(_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);}logger[_0x0406('0x17')](_0x0406('0x12'),_0x397bb5,_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);return _0x93f6da(_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);}else{logger['info'](_0x0406('0x12'),_0x397bb5,_0x0406('0x13'));_0x93f6da(_0x40af0a[_0x0406('0x19')]['message']);}})['catch'](function(_0x41a8c1){logger['error']('ChatQueue,\x20%s,\x20%s',_0x397bb5,_0x41a8c1);_0x28bccc(_0x41a8c1);});});}exports[_0x0406('0x1a')]=function(_0x5a4914){var _0x462fb8=this;return new Promise(function(_0x21ff6a,_0x3696b3){return db[_0x0406('0x1b')][_0x0406('0x1c')]({'raw':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')]['where']||null:null,'attributes':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')][_0x0406('0x1e')]||null:null,'limit':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')][_0x0406('0x1f')]||null:null,'include':_0x5a4914['options']?_0x5a4914['options'][_0x0406('0x20')]?_[_0x0406('0x21')](_0x5a4914[_0x0406('0x1d')][_0x0406('0x20')],function(_0x56bbe2){return{'model':db[_0x56bbe2[_0x0406('0x22')]],'as':_0x56bbe2['as'],'attributes':_0x56bbe2[_0x0406('0x1e')],'include':_0x56bbe2[_0x0406('0x20')]?_['map'](_0x56bbe2['include'],function(_0x5eb69c){return{'model':db[_0x5eb69c['model']],'as':_0x5eb69c['as'],'attributes':_0x5eb69c['attributes'],'include':_0x5eb69c[_0x0406('0x20')]?_['map'](_0x5eb69c[_0x0406('0x20')],function(_0x59a683){return{'model':db[_0x59a683['model']],'as':_0x59a683['as'],'attributes':_0x59a683[_0x0406('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0406('0x10')](function(_0x134b80){logger[_0x0406('0x11')]('GetChatQueue',_0x5a4914);logger['debug']('GetChatQueue',_0x5a4914,JSON[_0x0406('0x15')](_0x134b80));_0x21ff6a(_0x134b80);})[_0x0406('0x23')](function(_0x2ebed6){logger[_0x0406('0x17')](_0x0406('0x1a'),_0x2ebed6[_0x0406('0x18')],_0x5a4914);_0x3696b3(_0x462fb8[_0x0406('0x17')](0x1f4,_0x2ebed6['message']));});});};exports[_0x0406('0x24')]=function(_0x5357e5){var _0x3cc40b=this;return new Promise(function(_0x391857,_0xf39b71){return db[_0x0406('0x1b')][_0x0406('0x25')]({'raw':_0x5357e5[_0x0406('0x1d')]?_0x5357e5['options'][_0x0406('0x26')]===undefined?!![]:![]:!![],'where':_0x5357e5[_0x0406('0x1d')]?_0x5357e5[_0x0406('0x1d')][_0x0406('0x27')]||null:null,'attributes':_0x5357e5[_0x0406('0x1d')]?_0x5357e5['options'][_0x0406('0x1e')]||null:null,'include':_0x5357e5['options']?_0x5357e5['options']['include']?_['map'](_0x5357e5[_0x0406('0x1d')][_0x0406('0x20')],function(_0x3dbe3e){return{'model':db[_0x3dbe3e[_0x0406('0x22')]],'as':_0x3dbe3e['as'],'attributes':_0x3dbe3e['attributes'],'include':_0x3dbe3e['include']?_[_0x0406('0x21')](_0x3dbe3e[_0x0406('0x20')],function(_0x4e420a){return{'model':db[_0x4e420a[_0x0406('0x22')]],'as':_0x4e420a['as'],'attributes':_0x4e420a['attributes'],'include':_0x4e420a[_0x0406('0x20')]?_[_0x0406('0x21')](_0x4e420a[_0x0406('0x20')],function(_0x29bdb5){return{'model':db[_0x29bdb5[_0x0406('0x22')]],'as':_0x29bdb5['as'],'attributes':_0x29bdb5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0406('0x10')](function(_0x229ab1){logger['info'](_0x0406('0x24'),_0x5357e5);logger[_0x0406('0x28')](_0x0406('0x24'),_0x5357e5,JSON[_0x0406('0x15')](_0x229ab1));_0x391857(_0x229ab1);})['catch'](function(_0x2b6c69){logger[_0x0406('0x17')]('ShowChatQueue',_0x2b6c69[_0x0406('0x18')],_0x5357e5);_0xf39b71(_0x3cc40b[_0x0406('0x17')](0x1f4,_0x2b6c69[_0x0406('0x18')]));});});}; \ No newline at end of file +var _0x3c32=['GetChatQueue','ChatQueue','options','raw','attributes','limit','include','model','map','find','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x356926,_0x3ce0a8){var _0x1969a3=function(_0x3ccb40){while(--_0x3ccb40){_0x356926['push'](_0x356926['shift']());}};_0x1969a3(++_0x3ce0a8);}(_0x3c32,0x161));var _0x23c3=function(_0x4e2f0a,_0x41ad99){_0x4e2f0a=_0x4e2f0a-0x0;var _0x320e0f=_0x3c32[_0x4e2f0a];return _0x320e0f;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var moment=require(_0x23c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require(_0x23c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c3('0x6'))('rpc');var config=require(_0x23c3('0x7'));var jayson=require(_0x23c3('0x8'));var client=jayson[_0x23c3('0x9')][_0x23c3('0xa')]({'port':0x232a});config[_0x23c3('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x23c3('0xc'))(new Redis(config[_0x23c3('0xb')]));require(_0x23c3('0xd'))[_0x23c3('0xe')](socket);function respondWithRpcPromise(_0x277606,_0x1835b0,_0x28abc0){return new BPromise(function(_0x2e774f,_0x2c50a3){return client[_0x23c3('0xf')](_0x277606,_0x28abc0)[_0x23c3('0x10')](function(_0x105b8e){logger[_0x23c3('0x11')](_0x23c3('0x12'),_0x1835b0,_0x23c3('0x13'));logger[_0x23c3('0x14')](_0x23c3('0x15'),_0x1835b0,_0x23c3('0x13'),JSON[_0x23c3('0x16')](_0x105b8e));if(_0x105b8e[_0x23c3('0x17')]){if(_0x105b8e['error']['code']===0x1f4){logger[_0x23c3('0x17')](_0x23c3('0x12'),_0x1835b0,_0x105b8e[_0x23c3('0x17')][_0x23c3('0x18')]);return _0x2c50a3(_0x105b8e[_0x23c3('0x17')][_0x23c3('0x18')]);}logger[_0x23c3('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1835b0,_0x105b8e['error'][_0x23c3('0x18')]);return _0x2e774f(_0x105b8e[_0x23c3('0x17')]['message']);}else{logger[_0x23c3('0x11')](_0x23c3('0x12'),_0x1835b0,_0x23c3('0x13'));_0x2e774f(_0x105b8e[_0x23c3('0x19')][_0x23c3('0x18')]);}})[_0x23c3('0x1a')](function(_0x56cc03){logger[_0x23c3('0x17')](_0x23c3('0x12'),_0x1835b0,_0x56cc03);_0x2c50a3(_0x56cc03);});});}exports[_0x23c3('0x1b')]=function(_0x47abe2){var _0x1b769b=this;return new Promise(function(_0x48a50a,_0x4c8369){return db[_0x23c3('0x1c')]['findAll']({'raw':_0x47abe2['options']?_0x47abe2[_0x23c3('0x1d')][_0x23c3('0x1e')]===undefined?!![]:![]:!![],'where':_0x47abe2[_0x23c3('0x1d')]?_0x47abe2[_0x23c3('0x1d')]['where']||null:null,'attributes':_0x47abe2[_0x23c3('0x1d')]?_0x47abe2['options'][_0x23c3('0x1f')]||null:null,'limit':_0x47abe2[_0x23c3('0x1d')]?_0x47abe2[_0x23c3('0x1d')][_0x23c3('0x20')]||null:null,'include':_0x47abe2['options']?_0x47abe2[_0x23c3('0x1d')][_0x23c3('0x21')]?_['map'](_0x47abe2[_0x23c3('0x1d')][_0x23c3('0x21')],function(_0x2864c6){return{'model':db[_0x2864c6[_0x23c3('0x22')]],'as':_0x2864c6['as'],'attributes':_0x2864c6[_0x23c3('0x1f')],'include':_0x2864c6['include']?_[_0x23c3('0x23')](_0x2864c6[_0x23c3('0x21')],function(_0x2c3a6a){return{'model':db[_0x2c3a6a[_0x23c3('0x22')]],'as':_0x2c3a6a['as'],'attributes':_0x2c3a6a[_0x23c3('0x1f')],'include':_0x2c3a6a[_0x23c3('0x21')]?_[_0x23c3('0x23')](_0x2c3a6a[_0x23c3('0x21')],function(_0x856e72){return{'model':db[_0x856e72[_0x23c3('0x22')]],'as':_0x856e72['as'],'attributes':_0x856e72[_0x23c3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x23c3('0x10')](function(_0x28c59c){logger[_0x23c3('0x11')](_0x23c3('0x1b'),_0x47abe2);logger[_0x23c3('0x14')](_0x23c3('0x1b'),_0x47abe2,JSON[_0x23c3('0x16')](_0x28c59c));_0x48a50a(_0x28c59c);})[_0x23c3('0x1a')](function(_0xd732d7){logger[_0x23c3('0x17')]('GetChatQueue',_0xd732d7['message'],_0x47abe2);_0x4c8369(_0x1b769b['error'](0x1f4,_0xd732d7[_0x23c3('0x18')]));});});};exports['ShowChatQueue']=function(_0x218b84){var _0x4cc578=this;return new Promise(function(_0x25e453,_0x66a50c){return db[_0x23c3('0x1c')][_0x23c3('0x24')]({'raw':_0x218b84[_0x23c3('0x1d')]?_0x218b84[_0x23c3('0x1d')][_0x23c3('0x1e')]===undefined?!![]:![]:!![],'where':_0x218b84['options']?_0x218b84[_0x23c3('0x1d')]['where']||null:null,'attributes':_0x218b84[_0x23c3('0x1d')]?_0x218b84[_0x23c3('0x1d')]['attributes']||null:null,'include':_0x218b84['options']?_0x218b84['options'][_0x23c3('0x21')]?_[_0x23c3('0x23')](_0x218b84[_0x23c3('0x1d')]['include'],function(_0x1201b1){return{'model':db[_0x1201b1[_0x23c3('0x22')]],'as':_0x1201b1['as'],'attributes':_0x1201b1[_0x23c3('0x1f')],'include':_0x1201b1[_0x23c3('0x21')]?_[_0x23c3('0x23')](_0x1201b1['include'],function(_0x1af626){return{'model':db[_0x1af626[_0x23c3('0x22')]],'as':_0x1af626['as'],'attributes':_0x1af626[_0x23c3('0x1f')],'include':_0x1af626['include']?_['map'](_0x1af626[_0x23c3('0x21')],function(_0x46c4cb){return{'model':db[_0x46c4cb[_0x23c3('0x22')]],'as':_0x46c4cb['as'],'attributes':_0x46c4cb[_0x23c3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36ef2d){logger[_0x23c3('0x11')](_0x23c3('0x25'),_0x218b84);logger[_0x23c3('0x14')](_0x23c3('0x25'),_0x218b84,JSON[_0x23c3('0x16')](_0x36ef2d));_0x25e453(_0x36ef2d);})['catch'](function(_0x5876b1){logger[_0x23c3('0x17')]('ShowChatQueue',_0x5876b1[_0x23c3('0x18')],_0x218b84);_0x66a50c(_0x4cc578[_0x23c3('0x17')](0x1f4,_0x5876b1[_0x23c3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index af5b4ed..f28af40 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 _0xd0bb=['chatQueue:','./chatQueue.events','save','remove','emit','register','length'];(function(_0x454024,_0x58ac85){var _0x47b17e=function(_0x1274ae){while(--_0x1274ae){_0x454024['push'](_0x454024['shift']());}};_0x47b17e(++_0x58ac85);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0xd0bb[_0x3d0678];return _0x7f9a43;};'use strict';var ChatQueueEvents=require(_0xbd0b('0x0'));var events=[_0xbd0b('0x1'),_0xbd0b('0x2'),'update'];function createListener(_0x68ea36,_0x4ab08f){return function(_0x39b03a){_0x4ab08f[_0xbd0b('0x3')](_0x68ea36,_0x39b03a);};}function removeListener(_0x53e6ce,_0x432acf){return function(){ChatQueueEvents['removeListener'](_0x53e6ce,_0x432acf);};}exports[_0xbd0b('0x4')]=function(_0x1b2499){for(var _0x158b5c=0x0,_0x37c205=events[_0xbd0b('0x5')];_0x158b5c<_0x37c205;_0x158b5c++){var _0x5eb975=events[_0x158b5c];var _0x2a4075=createListener(_0xbd0b('0x6')+_0x5eb975,_0x1b2499);ChatQueueEvents['on'](_0x5eb975,_0x2a4075);}}; \ No newline at end of file +var _0x8d0e=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x276cc9,_0x17774c){var _0x31ac6b=function(_0x3197da){while(--_0x3197da){_0x276cc9['push'](_0x276cc9['shift']());}};_0x31ac6b(++_0x17774c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x52acab,_0x49b6e8){_0x52acab=_0x52acab-0x0;var _0x5118f1=_0x8d0e[_0x52acab];return _0x5118f1;};'use strict';var ChatQueueEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){ChatQueueEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);ChatQueueEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8c8972f..401189c 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x5fc3[_0x382c73];return _0x1dd0bf;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x5fc3[_0x166742];return _0xb7814a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 460deaa..a3b09bc 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 _0x3827=['STRING','DATE','moment'];(function(_0x97a9a9,_0x301335){var _0x221cc9=function(_0x38efcb){while(--_0x38efcb){_0x97a9a9['push'](_0x97a9a9['shift']());}};_0x221cc9(++_0x301335);}(_0x3827,0x1c4));var _0x7382=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x3827[_0x62c958];return _0x57ec61;};'use strict';var moment=require(_0x7382('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7382('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7382('0x1')]},'joinAt':{'type':Sequelize[_0x7382('0x2')]},'leaveAt':{'type':Sequelize[_0x7382('0x2')]},'acceptAt':{'type':Sequelize[_0x7382('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e84=['moment','sequelize','exports','STRING','DATE'];(function(_0x49aeff,_0xc94346){var _0x2ba529=function(_0x3900c5){while(--_0x3900c5){_0x49aeff['push'](_0x49aeff['shift']());}};_0x2ba529(++_0xc94346);}(_0x3e84,0xaf));var _0x43e8=function(_0x15ad3f,_0x1d6280){_0x15ad3f=_0x15ad3f-0x0;var _0xfb1d10=_0x3e84[_0x15ad3f];return _0xfb1d10;};'use strict';var moment=require(_0x43e8('0x0'));var Sequelize=require(_0x43e8('0x1'));module[_0x43e8('0x2')]={'uniqueid':{'type':Sequelize[_0x43e8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x43e8('0x3')]},'joinAt':{'type':Sequelize[_0x43e8('0x4')]},'leaveAt':{'type':Sequelize[_0x43e8('0x4')]},'acceptAt':{'type':Sequelize[_0x43e8('0x4')]},'exitAt':{'type':Sequelize[_0x43e8('0x4')]},'reason':{'type':Sequelize[_0x43e8('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f22962a..00b61a4 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 _0x9264=['key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4926('0x0'));var rimraf=require(_0x4926('0x1'));var zipdir=require(_0x4926('0x2'));var jsonpatch=require(_0x4926('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4926('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4926('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4926('0x6'));var _=require(_0x4926('0x7'));var squel=require('squel');var crypto=require(_0x4926('0x8'));var jsforce=require(_0x4926('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4926('0xa'));var querystring=require(_0x4926('0xb'));var Papa=require(_0x4926('0xc'));var Redis=require('ioredis');var authService=require(_0x4926('0xd'));var qs=require(_0x4926('0xe'));var as=require(_0x4926('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4926('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4926('0x11'));var licenseUtil=require(_0x4926('0x12'));var db=require(_0x4926('0x13'))['db'];function respondWithStatusCode(_0x5423a3,_0xd3cbc){_0xd3cbc=_0xd3cbc||0xcc;return function(_0x21eae1){if(_0x21eae1){return _0x5423a3[_0x4926('0x14')](_0xd3cbc);}return _0x5423a3[_0x4926('0x15')](_0xd3cbc)[_0x4926('0x16')]();};}function respondWithResult(_0x2a2105,_0x2f466b){_0x2f466b=_0x2f466b||0xc8;return function(_0x1a280b){if(_0x1a280b){return _0x2a2105[_0x4926('0x15')](_0x2f466b)[_0x4926('0x17')](_0x1a280b);}};}function respondWithFilteredResult(_0xac0db7,_0x1fbb5d){return function(_0x3018cb){if(_0x3018cb){var _0x1ac74f=typeof _0x1fbb5d['offset']===_0x4926('0x18')&&typeof _0x1fbb5d[_0x4926('0x19')]===_0x4926('0x18');var _0x5736dd=_0x3018cb['count'];var _0x1dd78e=_0x1ac74f?0x0:_0x1fbb5d['offset'];var _0x214e36=_0x1ac74f?_0x3018cb[_0x4926('0x1a')]:_0x1fbb5d['offset']+_0x1fbb5d[_0x4926('0x19')];var _0x49461e;if(_0x214e36>=_0x5736dd){_0x214e36=_0x5736dd;_0x49461e=0xc8;}else{_0x49461e=0xce;}_0xac0db7[_0x4926('0x15')](_0x49461e);return _0xac0db7[_0x4926('0x1b')](_0x4926('0x1c'),_0x1dd78e+'-'+_0x214e36+'/'+_0x5736dd)[_0x4926('0x17')](_0x3018cb);}return null;};}function patchUpdates(_0x5b7588){return function(_0x59dc6a){try{jsonpatch[_0x4926('0x1d')](_0x59dc6a,_0x5b7588,!![]);}catch(_0x588c7a){return BPromise['reject'](_0x588c7a);}return _0x59dc6a[_0x4926('0x1e')]();};}function saveUpdates(_0x309c71,_0x55d055){return function(_0xfd1095){if(_0xfd1095){return _0xfd1095['update'](_0x309c71)[_0x4926('0x1f')](function(_0x55e459){return _0x55e459;});}return null;};}function removeEntity(_0x10d0b2,_0x34d600){return function(_0x2df18c){if(_0x2df18c){return _0x2df18c[_0x4926('0x20')]()['then'](function(){_0x10d0b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c02e7,_0xbfbe1b){return function(_0x43c077){if(!_0x43c077){_0x1c02e7[_0x4926('0x14')](0x194);}return _0x43c077;};}function handleError(_0x51be4f,_0x508dea){_0x508dea=_0x508dea||0x1f4;return function(_0x55413a){logger[_0x4926('0x21')](_0x55413a[_0x4926('0x22')]);if(_0x55413a[_0x4926('0x23')]){delete _0x55413a['name'];}_0x51be4f['status'](_0x508dea)['send'](_0x55413a);};}exports[_0x4926('0x24')]=function(_0x3f06a3,_0xbfe28d){var _0x4bd08d={},_0x180421={},_0x9d610c={'count':0x0,'rows':[]};var _0x3f4a69=_[_0x4926('0x25')](db[_0x4926('0x26')][_0x4926('0x27')],function(_0x5a44a9){return{'name':_0x5a44a9[_0x4926('0x28')],'type':_0x5a44a9[_0x4926('0x29')][_0x4926('0x2a')]};});_0x180421[_0x4926('0x2b')]=_[_0x4926('0x25')](_0x3f4a69,_0x4926('0x23'));_0x180421[_0x4926('0x2c')]=_['keys'](_0x3f06a3[_0x4926('0x2c')]);_0x180421[_0x4926('0x2d')]=_['intersection'](_0x180421[_0x4926('0x2b')],_0x180421[_0x4926('0x2c')]);_0x4bd08d[_0x4926('0x2e')]=_[_0x4926('0x2f')](_0x180421[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x30')]));_0x4bd08d[_0x4926('0x2e')]=_0x4bd08d[_0x4926('0x2e')][_0x4926('0x31')]?_0x4bd08d[_0x4926('0x2e')]:_0x180421[_0x4926('0x2b')];if(!_0x3f06a3[_0x4926('0x2c')]['hasOwnProperty'](_0x4926('0x32'))){_0x4bd08d[_0x4926('0x19')]=qs[_0x4926('0x19')](_0x3f06a3[_0x4926('0x2c')]['limit']);_0x4bd08d[_0x4926('0x33')]=qs[_0x4926('0x33')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x33')]);}_0x4bd08d[_0x4926('0x34')]=qs['sort'](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x35')]);_0x4bd08d[_0x4926('0x36')]=qs['filters'](_[_0x4926('0x37')](_0x3f06a3[_0x4926('0x2c')],_0x180421[_0x4926('0x2d')]),_0x3f4a69);if(_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]){_0x4bd08d[_0x4926('0x36')]=_['merge'](_0x4bd08d[_0x4926('0x36')],{'$or':_[_0x4926('0x25')](_0x3f4a69,function(_0x3c5595){if(_0x3c5595[_0x4926('0x29')]!==_0x4926('0x39')){var _0x5237f4={};_0x5237f4[_0x3c5595[_0x4926('0x23')]]={'$like':'%'+_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]+'%'};return _0x5237f4;}})});}_0x4bd08d=_[_0x4926('0x3a')]({},_0x4bd08d,_0x3f06a3['options']);var _0x505de3={'where':_0x4bd08d['where']};return db[_0x4926('0x26')][_0x4926('0x1a')](_0x505de3)[_0x4926('0x1f')](function(_0x1d97db){_0x9d610c[_0x4926('0x1a')]=_0x1d97db;if(_0x3f06a3['query']['includeAll']){_0x4bd08d['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x4926('0x3b')](_0x4bd08d);})[_0x4926('0x1f')](function(_0x4380da){_0x9d610c[_0x4926('0x3c')]=_0x4380da;return _0x9d610c;})[_0x4926('0x1f')](respondWithFilteredResult(_0xbfe28d,_0x4bd08d))['catch'](handleError(_0xbfe28d,null));};exports[_0x4926('0x3d')]=function(_0x203f24,_0x218631){var _0x9dc879={'raw':!![],'where':{'id':_0x203f24[_0x4926('0x3e')]['id']}},_0x437800={};_0x437800[_0x4926('0x2b')]=_[_0x4926('0x3f')](db[_0x4926('0x26')][_0x4926('0x27')]);_0x437800['query']=_['keys'](_0x203f24[_0x4926('0x2c')]);_0x437800['filters']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],_0x437800[_0x4926('0x2c')]);_0x9dc879['attributes']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x203f24[_0x4926('0x2c')][_0x4926('0x30')]));_0x9dc879[_0x4926('0x2e')]=_0x9dc879[_0x4926('0x2e')][_0x4926('0x31')]?_0x9dc879[_0x4926('0x2e')]:_0x437800[_0x4926('0x2b')];if(_0x203f24[_0x4926('0x2c')][_0x4926('0x40')]){_0x9dc879[_0x4926('0x41')]=[{'all':!![]}];}_0x9dc879=_[_0x4926('0x3a')]({},_0x9dc879,_0x203f24[_0x4926('0x42')]);return db['ChatQueueReport'][_0x4926('0x43')](_0x9dc879)[_0x4926('0x1f')](handleEntityNotFound(_0x218631,null))['then'](respondWithResult(_0x218631,null))[_0x4926('0x44')](handleError(_0x218631,null));};exports[_0x4926('0x45')]=function(_0x416968,_0x572c91){return db[_0x4926('0x26')][_0x4926('0x45')](_0x416968[_0x4926('0x46')],{})[_0x4926('0x1f')](respondWithResult(_0x572c91,0xc9))[_0x4926('0x44')](handleError(_0x572c91,null));};exports[_0x4926('0x47')]=function(_0x43764f,_0x12a89b){if(_0x43764f['body']['id']){delete _0x43764f[_0x4926('0x46')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x43764f[_0x4926('0x3e')]['id']}})[_0x4926('0x1f')](handleEntityNotFound(_0x12a89b,null))['then'](saveUpdates(_0x43764f[_0x4926('0x46')],null))[_0x4926('0x1f')](respondWithResult(_0x12a89b,null))[_0x4926('0x44')](handleError(_0x12a89b,null));};exports[_0x4926('0x20')]=function(_0x15d338,_0x84f5b0){return db['ChatQueueReport']['find']({'where':{'id':_0x15d338['params']['id']}})['then'](handleEntityNotFound(_0x84f5b0,null))[_0x4926('0x1f')](removeEntity(_0x84f5b0,null))[_0x4926('0x44')](handleError(_0x84f5b0,null));};exports[_0x4926('0x48')]=function(_0x298818,_0x1abcdd){return db[_0x4926('0x26')]['describe']()[_0x4926('0x1f')](respondWithResult(_0x1abcdd,null))[_0x4926('0x44')](handleError(_0x1abcdd,null));}; \ No newline at end of file +var _0x8fcd=['order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','merge','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3bcc49,_0x113059){var _0x6d0f75=function(_0x305a86){while(--_0x305a86){_0x3bcc49['push'](_0x3bcc49['shift']());}};_0x6d0f75(++_0x113059);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x66ff8e,_0x56ecee){_0x66ff8e=_0x66ff8e-0x0;var _0x50a1f3=_0x8fcd[_0x66ff8e];return _0x50a1f3;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require(_0xd8fc('0x1'));var zipdir=require(_0xd8fc('0x2'));var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require(_0xd8fc('0x7'));var sox=require(_0xd8fc('0x8'));var csv=require(_0xd8fc('0x9'));var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x9'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=typeof _0x426e56['offset']===_0xd8fc('0x17')&&typeof _0x426e56[_0xd8fc('0x18')]===_0xd8fc('0x17');var _0x4daf69=_0x233c7e[_0xd8fc('0x19')];var _0x1c744d=_0x57838b?0x0:_0x426e56[_0xd8fc('0x1a')];var _0x1cb0d4=_0x57838b?_0x233c7e[_0xd8fc('0x19')]:_0x426e56[_0xd8fc('0x1a')]+_0x426e56[_0xd8fc('0x18')];var _0x1d7e77;if(_0x1cb0d4>=_0x4daf69){_0x1cb0d4=_0x4daf69;_0x1d7e77=0xc8;}else{_0x1d7e77=0xce;}_0x524bac[_0xd8fc('0x15')](_0x1d7e77);return _0x524bac['set'](_0xd8fc('0x1b'),_0x1c744d+'-'+_0x1cb0d4+'/'+_0x4daf69)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x24001d){return function(_0x3f9d57){try{jsonpatch[_0xd8fc('0x1c')](_0x3f9d57,_0x24001d,!![]);}catch(_0xd24b3f){return BPromise['reject'](_0xd24b3f);}return _0x3f9d57[_0xd8fc('0x1d')]();};}function saveUpdates(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['update'](_0x3f0196)[_0xd8fc('0x1e')](function(_0x370a62){return _0x370a62;});}return null;};}function removeEntity(_0x59b0ef,_0x5c852a){return function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0xd8fc('0x1f')]()[_0xd8fc('0x1e')](function(){_0x59b0ef[_0xd8fc('0x15')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x495bd2,_0x71dcc1){return function(_0x45ac21){if(!_0x45ac21){_0x495bd2['sendStatus'](0x194);}return _0x45ac21;};}function handleError(_0x270204,_0x5e50c4){_0x5e50c4=_0x5e50c4||0x1f4;return function(_0x200a2b){logger[_0xd8fc('0x21')](_0x200a2b[_0xd8fc('0x22')]);if(_0x200a2b[_0xd8fc('0x23')]){delete _0x200a2b['name'];}_0x270204[_0xd8fc('0x15')](_0x5e50c4)['send'](_0x200a2b);};}exports[_0xd8fc('0x24')]=function(_0x1692d0,_0x4e823d){var _0x4a5383={},_0x56a980={},_0x3bec97={'count':0x0,'rows':[]};var _0x2081ca=_[_0xd8fc('0x25')](db[_0xd8fc('0x26')][_0xd8fc('0x27')],function(_0x281559){return{'name':_0x281559[_0xd8fc('0x28')],'type':_0x281559[_0xd8fc('0x29')][_0xd8fc('0x2a')]};});_0x56a980['model']=_[_0xd8fc('0x25')](_0x2081ca,_0xd8fc('0x23'));_0x56a980['query']=_[_0xd8fc('0x2b')](_0x1692d0[_0xd8fc('0x2c')]);_0x56a980[_0xd8fc('0x2d')]=_['intersection'](_0x56a980[_0xd8fc('0x2e')],_0x56a980[_0xd8fc('0x2c')]);_0x4a5383[_0xd8fc('0x2f')]=_['intersection'](_0x56a980['model'],qs['fields'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0x4a5383[_0xd8fc('0x2f')]=_0x4a5383[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0x4a5383[_0xd8fc('0x2f')]:_0x56a980[_0xd8fc('0x2e')];if(!_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x32')](_0xd8fc('0x33'))){_0x4a5383['limit']=qs[_0xd8fc('0x18')](_0x1692d0['query'][_0xd8fc('0x18')]);_0x4a5383['offset']=qs['offset'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x1a')]);}_0x4a5383[_0xd8fc('0x34')]=qs[_0xd8fc('0x35')](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x35')]);_0x4a5383['where']=qs[_0xd8fc('0x2d')](_[_0xd8fc('0x36')](_0x1692d0[_0xd8fc('0x2c')],_0x56a980['filters']),_0x2081ca);if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x37')]){_0x4a5383['where']=_['merge'](_0x4a5383[_0xd8fc('0x38')],{'$or':_['map'](_0x2081ca,function(_0x1ac864){if(_0x1ac864['type']!==_0xd8fc('0x39')){var _0x2cd726={};_0x2cd726[_0x1ac864[_0xd8fc('0x23')]]={'$like':'%'+_0x1692d0['query'][_0xd8fc('0x37')]+'%'};return _0x2cd726;}})});}_0x4a5383=_['merge']({},_0x4a5383,_0x1692d0[_0xd8fc('0x3a')]);var _0x16f411={'where':_0x4a5383['where']};return db[_0xd8fc('0x26')][_0xd8fc('0x19')](_0x16f411)[_0xd8fc('0x1e')](function(_0x17dba2){_0x3bec97['count']=_0x17dba2;if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x3b')]){_0x4a5383[_0xd8fc('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x4a5383);})['then'](function(_0x17ffbb){_0x3bec97[_0xd8fc('0x3d')]=_0x17ffbb;return _0x3bec97;})[_0xd8fc('0x1e')](respondWithFilteredResult(_0x4e823d,_0x4a5383))[_0xd8fc('0x3e')](handleError(_0x4e823d,null));};exports['show']=function(_0x32c555,_0x145f37){var _0xaaa4b2={'raw':!![],'where':{'id':_0x32c555[_0xd8fc('0x3f')]['id']}},_0x126ff4={};_0x126ff4[_0xd8fc('0x2e')]=_[_0xd8fc('0x2b')](db['ChatQueueReport'][_0xd8fc('0x27')]);_0x126ff4[_0xd8fc('0x2c')]=_['keys'](_0x32c555[_0xd8fc('0x2c')]);_0x126ff4[_0xd8fc('0x2d')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],_0x126ff4[_0xd8fc('0x2c')]);_0xaaa4b2[_0xd8fc('0x2f')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],qs[_0xd8fc('0x30')](_0x32c555[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0xaaa4b2[_0xd8fc('0x2f')]=_0xaaa4b2[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0xaaa4b2['attributes']:_0x126ff4['model'];if(_0x32c555['query'][_0xd8fc('0x3b')]){_0xaaa4b2[_0xd8fc('0x3c')]=[{'all':!![]}];}_0xaaa4b2=_[_0xd8fc('0x41')]({},_0xaaa4b2,_0x32c555[_0xd8fc('0x3a')]);return db['ChatQueueReport'][_0xd8fc('0x42')](_0xaaa4b2)[_0xd8fc('0x1e')](handleEntityNotFound(_0x145f37,null))[_0xd8fc('0x1e')](respondWithResult(_0x145f37,null))[_0xd8fc('0x3e')](handleError(_0x145f37,null));};exports[_0xd8fc('0x43')]=function(_0x19b43e,_0xc12ace){return db['ChatQueueReport']['create'](_0x19b43e['body'],{})[_0xd8fc('0x1e')](respondWithResult(_0xc12ace,0xc9))[_0xd8fc('0x3e')](handleError(_0xc12ace,null));};exports[_0xd8fc('0x44')]=function(_0x13cd5d,_0x2dd8e0){if(_0x13cd5d[_0xd8fc('0x45')]['id']){delete _0x13cd5d[_0xd8fc('0x45')]['id'];}return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x13cd5d['params']['id']}})['then'](handleEntityNotFound(_0x2dd8e0,null))[_0xd8fc('0x1e')](saveUpdates(_0x13cd5d['body'],null))[_0xd8fc('0x1e')](respondWithResult(_0x2dd8e0,null))['catch'](handleError(_0x2dd8e0,null));};exports[_0xd8fc('0x1f')]=function(_0x3d913a,_0x57206c){return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x3d913a[_0xd8fc('0x3f')]['id']}})[_0xd8fc('0x1e')](handleEntityNotFound(_0x57206c,null))[_0xd8fc('0x1e')](removeEntity(_0x57206c,null))[_0xd8fc('0x3e')](handleError(_0x57206c,null));};exports[_0xd8fc('0x46')]=function(_0x53b2cb,_0x1d1d40){return db[_0xd8fc('0x26')]['describe']()['then'](respondWithResult(_0x1d1d40,null))[_0xd8fc('0x3e')](handleError(_0x1d1d40,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1149803..791dcc3 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(_0x10cf47,_0x37ecd9){var _0x4c5b51=function(_0x390360){while(--_0x390360){_0x10cf47['push'](_0x10cf47['shift']());}};_0x4c5b51(++_0x37ecd9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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(_0x5ea85d,_0x480513){var _0x4f7237=function(_0x39eac8){while(--_0x39eac8){_0x5ea85d['push'](_0x5ea85d['shift']());}};_0x4f7237(++_0x480513);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'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 d5a25cb..1605a5a 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 _0xdcc1=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xdcc1,0x15f));var _0x1dcc=function(_0x3b8868,_0x582cfd){_0x3b8868=_0x3b8868-0x0;var _0x504818=_0xdcc1[_0x3b8868];return _0x504818;};'use strict';var _=require(_0x1dcc('0x0'));var util=require('util');var moment=require(_0x1dcc('0x1'));var BPromise=require(_0x1dcc('0x2'));var rs=require(_0x1dcc('0x3'));var fs=require('fs');var Redis=require(_0x1dcc('0x4'));var db=require(_0x1dcc('0x5'))['db'];var utils=require(_0x1dcc('0x6'));var logger=require(_0x1dcc('0x7'))(_0x1dcc('0x8'));var config=require(_0x1dcc('0x9'));var jayson=require(_0x1dcc('0xa'));var client=jayson[_0x1dcc('0xb')][_0x1dcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x548fd5,_0x3ac3ad,_0xa00a3){return new BPromise(function(_0x100a9e,_0x362c46){return client[_0x1dcc('0xd')](_0x548fd5,_0xa00a3)[_0x1dcc('0xe')](function(_0x39c716){logger[_0x1dcc('0xf')](_0x1dcc('0x10'),_0x3ac3ad,_0x1dcc('0x11'));logger[_0x1dcc('0x12')](_0x1dcc('0x13'),_0x3ac3ad,_0x1dcc('0x11'),JSON[_0x1dcc('0x14')](_0x39c716));if(_0x39c716[_0x1dcc('0x15')]){if(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x16')]===0x1f4){logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x39c716[_0x1dcc('0x15')]['message']);return _0x362c46(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x17')]);}logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x39c716['error']['message']);return _0x100a9e(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x17')]);}else{logger[_0x1dcc('0xf')](_0x1dcc('0x10'),_0x3ac3ad,'request\x20sent');_0x100a9e(_0x39c716[_0x1dcc('0x18')][_0x1dcc('0x17')]);}})[_0x1dcc('0x19')](function(_0x522406){logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x522406);_0x362c46(_0x522406);});});}exports[_0x1dcc('0x1a')]=function(_0xcc8b18){var _0x23f38f=this;return new Promise(function(_0x132c04,_0x30b0fa){return db[_0x1dcc('0x1b')][_0x1dcc('0x1c')](_0xcc8b18['body'],{'raw':_0xcc8b18[_0x1dcc('0x1d')]?_0xcc8b18['options'][_0x1dcc('0x1e')]===undefined?!![]:![]:!![]})[_0x1dcc('0xe')](function(_0x3cf4cf){logger[_0x1dcc('0xf')]('CreateChatQueueReport',_0xcc8b18);logger[_0x1dcc('0x12')](_0x1dcc('0x1a'),_0xcc8b18,JSON['stringify'](_0x3cf4cf));_0x132c04(_0x3cf4cf);})['catch'](function(_0x5b01d6){logger[_0x1dcc('0x15')](_0x1dcc('0x1a'),_0x5b01d6['message'],_0xcc8b18);_0x30b0fa(_0x23f38f[_0x1dcc('0x15')](0x1f4,_0x5b01d6[_0x1dcc('0x17')]));});});};exports[_0x1dcc('0x1f')]=function(_0x5d4958){var _0x4d3843=this;return new Promise(function(_0x5ce00c,_0x2404a1){return db['ChatQueueReport'][_0x1dcc('0x20')](_0x5d4958[_0x1dcc('0x21')],{'raw':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')][_0x1dcc('0x22')]||null:null,'attributes':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')][_0x1dcc('0x23')]||null:null,'limit':_0x5d4958['options']?_0x5d4958[_0x1dcc('0x1d')]['limit']||null:null})['then'](function(_0xf24d04){logger[_0x1dcc('0xf')](_0x1dcc('0x1f'),_0x5d4958);logger[_0x1dcc('0x12')](_0x1dcc('0x1f'),_0x5d4958,JSON[_0x1dcc('0x14')](_0xf24d04));_0x5ce00c(_0xf24d04);})[_0x1dcc('0x19')](function(_0x416426){logger['error']('UpdateChatQueueReport',_0x416426['message'],_0x5d4958);_0x2404a1(_0x4d3843[_0x1dcc('0x15')](0x1f4,_0x416426['message']));});});}; \ No newline at end of file +var _0x552b=['../../config/environment','jayson/promise','client','http','request','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','body','options','then','CreateChatQueueReport','UpdateChatQueueReport','update','raw','where','limit','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26af6c,_0x13f7ff){var _0x3cb79a=function(_0x203ec8){while(--_0x203ec8){_0x26af6c['push'](_0x26af6c['shift']());}};_0x3cb79a(++_0x13f7ff);}(_0x552b,0x16d));var _0xb552=function(_0x45ecd9,_0x16e7dc){_0x45ecd9=_0x45ecd9-0x0;var _0x513a0c=_0x552b[_0x45ecd9];return _0x513a0c;};'use strict';var _=require(_0xb552('0x0'));var util=require('util');var moment=require(_0xb552('0x1'));var BPromise=require(_0xb552('0x2'));var rs=require(_0xb552('0x3'));var fs=require('fs');var Redis=require(_0xb552('0x4'));var db=require(_0xb552('0x5'))['db'];var utils=require(_0xb552('0x6'));var logger=require(_0xb552('0x7'))(_0xb552('0x8'));var config=require(_0xb552('0x9'));var jayson=require(_0xb552('0xa'));var client=jayson[_0xb552('0xb')][_0xb552('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c07d9,_0x4e1f99,_0x52ef68){return new BPromise(function(_0x1e858f,_0x4aed58){return client[_0xb552('0xd')](_0x3c07d9,_0x52ef68)['then'](function(_0x2f2c7d){logger[_0xb552('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x4e1f99,'request\x20sent');logger[_0xb552('0xf')](_0xb552('0x10'),_0x4e1f99,_0xb552('0x11'),JSON['stringify'](_0x2f2c7d));if(_0x2f2c7d[_0xb552('0x12')]){if(_0x2f2c7d[_0xb552('0x12')]['code']===0x1f4){logger[_0xb552('0x12')](_0xb552('0x13'),_0x4e1f99,_0x2f2c7d[_0xb552('0x12')]['message']);return _0x4aed58(_0x2f2c7d['error'][_0xb552('0x14')]);}logger['error'](_0xb552('0x13'),_0x4e1f99,_0x2f2c7d[_0xb552('0x12')][_0xb552('0x14')]);return _0x1e858f(_0x2f2c7d[_0xb552('0x12')]['message']);}else{logger[_0xb552('0xe')](_0xb552('0x13'),_0x4e1f99,_0xb552('0x11'));_0x1e858f(_0x2f2c7d[_0xb552('0x15')][_0xb552('0x14')]);}})[_0xb552('0x16')](function(_0x44b963){logger[_0xb552('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4e1f99,_0x44b963);_0x4aed58(_0x44b963);});});}exports['CreateChatQueueReport']=function(_0x5418e5){var _0x4c187f=this;return new Promise(function(_0x4e84eb,_0x1de252){return db[_0xb552('0x17')]['create'](_0x5418e5[_0xb552('0x18')],{'raw':_0x5418e5[_0xb552('0x19')]?_0x5418e5[_0xb552('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb552('0x1a')](function(_0x23f5e9){logger[_0xb552('0xe')]('CreateChatQueueReport',_0x5418e5);logger[_0xb552('0xf')]('CreateChatQueueReport',_0x5418e5,JSON['stringify'](_0x23f5e9));_0x4e84eb(_0x23f5e9);})['catch'](function(_0x2c26ad){logger[_0xb552('0x12')](_0xb552('0x1b'),_0x2c26ad[_0xb552('0x14')],_0x5418e5);_0x1de252(_0x4c187f[_0xb552('0x12')](0x1f4,_0x2c26ad['message']));});});};exports[_0xb552('0x1c')]=function(_0xe460fe){var _0x31acc0=this;return new Promise(function(_0x52a65e,_0x27936b){return db['ChatQueueReport'][_0xb552('0x1d')](_0xe460fe[_0xb552('0x18')],{'raw':_0xe460fe[_0xb552('0x19')]?_0xe460fe[_0xb552('0x19')][_0xb552('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe460fe[_0xb552('0x19')]?_0xe460fe[_0xb552('0x19')][_0xb552('0x1f')]||null:null,'attributes':_0xe460fe[_0xb552('0x19')]?_0xe460fe[_0xb552('0x19')]['attributes']||null:null,'limit':_0xe460fe[_0xb552('0x19')]?_0xe460fe[_0xb552('0x19')][_0xb552('0x20')]||null:null})['then'](function(_0x292673){logger[_0xb552('0xe')](_0xb552('0x1c'),_0xe460fe);logger[_0xb552('0xf')]('UpdateChatQueueReport',_0xe460fe,JSON[_0xb552('0x21')](_0x292673));_0x52a65e(_0x292673);})['catch'](function(_0x16a298){logger['error'](_0xb552('0x1c'),_0x16a298[_0xb552('0x14')],_0xe460fe);_0x27936b(_0x31acc0[_0xb552('0x12')](0x1f4,_0x16a298[_0xb552('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6d8062d..d786ce6 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 _0x5545=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4e7544,_0x17891b){var _0x1c20ee=function(_0x2c068b){while(--_0x2c068b){_0x4e7544['push'](_0x4e7544['shift']());}};_0x1c20ee(++_0x17891b);}(_0x5545,0x9e));var _0x5554=function(_0x16906e,_0x4dbb0d){_0x16906e=_0x16906e-0x0;var _0x59c212=_0x5545[_0x16906e];return _0x59c212;};'use strict';var multer=require(_0x5554('0x0'));var util=require(_0x5554('0x1'));var path=require(_0x5554('0x2'));var timeout=require(_0x5554('0x3'));var express=require(_0x5554('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5554('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5554('0x6'));var controller=require(_0x5554('0x7'));router[_0x5554('0x8')]('/',auth[_0x5554('0x9')](),controller['index']);router[_0x5554('0x8')](_0x5554('0xa'),auth['isAuthenticated'](),controller[_0x5554('0xb')]);router[_0x5554('0x8')](_0x5554('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5554('0xd')]('/',auth[_0x5554('0x9')](),controller[_0x5554('0xe')]);router[_0x5554('0xf')](_0x5554('0xc'),auth['isAuthenticated'](),controller[_0x5554('0x10')]);router[_0x5554('0x11')](_0x5554('0xc'),auth['isAuthenticated'](),controller[_0x5554('0x12')]);module['exports']=router; \ No newline at end of file +var _0x849e=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x194a74,_0x30e27e){var _0x247694=function(_0x19963a){while(--_0x19963a){_0x194a74['push'](_0x194a74['shift']());}};_0x247694(++_0x30e27e);}(_0x849e,0x137));var _0xe849=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x849e[_0x1abb11];return _0x149a9f;};'use strict';var multer=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var path=require(_0xe849('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe849('0x3')]();var fs_extra=require(_0xe849('0x4'));var auth=require(_0xe849('0x5'));var interaction=require(_0xe849('0x6'));var config=require(_0xe849('0x7'));var controller=require(_0xe849('0x8'));router[_0xe849('0x9')]('/',auth[_0xe849('0xa')](),controller[_0xe849('0xb')]);router[_0xe849('0x9')](_0xe849('0xc'),auth[_0xe849('0xa')](),controller['describe']);router[_0xe849('0x9')](_0xe849('0xd'),auth[_0xe849('0xa')](),controller[_0xe849('0xe')]);router[_0xe849('0xf')]('/',auth[_0xe849('0xa')](),controller[_0xe849('0x10')]);router[_0xe849('0x11')](_0xe849('0xd'),auth[_0xe849('0xa')](),controller[_0xe849('0x12')]);router[_0xe849('0x13')](_0xe849('0xd'),auth[_0xe849('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 508d3dd..277e9c6 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x26b985,_0xab9d1){var _0x23d808=function(_0x4b264b){while(--_0x4b264b){_0x26b985['push'](_0x26b985['shift']());}};_0x23d808(++_0xab9d1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4184f4,_0x1cf45b){_0x4184f4=_0x4184f4-0x0;var _0x3c0e5c=_0xf4eb[_0x4184f4];return _0x3c0e5c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3b5ad2,_0x1e1558){var _0x584bc9=function(_0x1bfa11){while(--_0x1bfa11){_0x3b5ad2['push'](_0x3b5ad2['shift']());}};_0x584bc9(++_0x1e1558);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xf3cd[_0x45b1ba];return _0x145ddb;};'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 2effe19..2460529 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 _0xaa38=['sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','ChatTransferReport','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0xaa38,0x1da));var _0x8aa3=function(_0x1a2455,_0x578d37){_0x1a2455=_0x1a2455-0x0;var _0x336ea1=_0xaa38[_0x1a2455];return _0x336ea1;};'use strict';var emlformat=require(_0x8aa3('0x0'));var rimraf=require(_0x8aa3('0x1'));var zipdir=require(_0x8aa3('0x2'));var jsonpatch=require(_0x8aa3('0x3'));var rp=require(_0x8aa3('0x4'));var moment=require(_0x8aa3('0x5'));var BPromise=require(_0x8aa3('0x6'));var Mustache=require(_0x8aa3('0x7'));var util=require(_0x8aa3('0x8'));var path=require(_0x8aa3('0x9'));var sox=require(_0x8aa3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa3('0xb'));var _=require(_0x8aa3('0xc'));var squel=require(_0x8aa3('0xd'));var crypto=require(_0x8aa3('0xe'));var jsforce=require(_0x8aa3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8aa3('0x10'));var querystring=require(_0x8aa3('0x11'));var Papa=require(_0x8aa3('0x12'));var Redis=require(_0x8aa3('0x13'));var authService=require(_0x8aa3('0x14'));var qs=require(_0x8aa3('0x15'));var as=require(_0x8aa3('0x16'));var hardwareService=require(_0x8aa3('0x17'));var logger=require(_0x8aa3('0x18'))(_0x8aa3('0x19'));var utils=require(_0x8aa3('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8aa3('0x1b'))['db'];function respondWithStatusCode(_0x3ed657,_0x97e0d6){_0x97e0d6=_0x97e0d6||0xcc;return function(_0x5331e4){if(_0x5331e4){return _0x3ed657[_0x8aa3('0x1c')](_0x97e0d6);}return _0x3ed657[_0x8aa3('0x1d')](_0x97e0d6)[_0x8aa3('0x1e')]();};}function respondWithResult(_0x2ffcfc,_0x2dfad2){_0x2dfad2=_0x2dfad2||0xc8;return function(_0x154b0f){if(_0x154b0f){return _0x2ffcfc['status'](_0x2dfad2)[_0x8aa3('0x1f')](_0x154b0f);}};}function respondWithFilteredResult(_0x82331e,_0x5d8f66){return function(_0x4ea09e){if(_0x4ea09e){var _0x5a6a45=typeof _0x5d8f66[_0x8aa3('0x20')]===_0x8aa3('0x21')&&typeof _0x5d8f66['limit']===_0x8aa3('0x21');var _0x129b8b=_0x4ea09e[_0x8aa3('0x22')];var _0x17ebb7=_0x5a6a45?0x0:_0x5d8f66[_0x8aa3('0x20')];var _0x1317bb=_0x5a6a45?_0x4ea09e[_0x8aa3('0x22')]:_0x5d8f66[_0x8aa3('0x20')]+_0x5d8f66['limit'];var _0x4b9d0a;if(_0x1317bb>=_0x129b8b){_0x1317bb=_0x129b8b;_0x4b9d0a=0xc8;}else{_0x4b9d0a=0xce;}_0x82331e[_0x8aa3('0x1d')](_0x4b9d0a);return _0x82331e['set'](_0x8aa3('0x23'),_0x17ebb7+'-'+_0x1317bb+'/'+_0x129b8b)[_0x8aa3('0x1f')](_0x4ea09e);}return null;};}function patchUpdates(_0x307244){return function(_0x400a19){try{jsonpatch[_0x8aa3('0x24')](_0x400a19,_0x307244,!![]);}catch(_0x369ab2){return BPromise['reject'](_0x369ab2);}return _0x400a19[_0x8aa3('0x25')]();};}function saveUpdates(_0x5d340c,_0x419197){return function(_0x24f4da){if(_0x24f4da){return _0x24f4da[_0x8aa3('0x26')](_0x5d340c)[_0x8aa3('0x27')](function(_0x215b74){return _0x215b74;});}return null;};}function removeEntity(_0x1cede2,_0x1b8a79){return function(_0x2b734b){if(_0x2b734b){return _0x2b734b['destroy']()[_0x8aa3('0x27')](function(){_0x1cede2[_0x8aa3('0x1d')](0xcc)[_0x8aa3('0x1e')]();});}};}function handleEntityNotFound(_0xa1bc81,_0x59ba5e){return function(_0x2e3749){if(!_0x2e3749){_0xa1bc81[_0x8aa3('0x1c')](0x194);}return _0x2e3749;};}function handleError(_0x2f1a7f,_0x21f223){_0x21f223=_0x21f223||0x1f4;return function(_0x273207){logger[_0x8aa3('0x28')](_0x273207[_0x8aa3('0x29')]);if(_0x273207[_0x8aa3('0x2a')]){delete _0x273207[_0x8aa3('0x2a')];}_0x2f1a7f[_0x8aa3('0x1d')](_0x21f223)[_0x8aa3('0x2b')](_0x273207);};}exports[_0x8aa3('0x2c')]=function(_0x55726b,_0x51624a){var _0x4ceae9={},_0x1649b2={},_0x53edab={'count':0x0,'rows':[]};var _0x3c3a14=_['map'](db['ChatTransferReport'][_0x8aa3('0x2d')],function(_0x4cce1d){return{'name':_0x4cce1d[_0x8aa3('0x2e')],'type':_0x4cce1d[_0x8aa3('0x2f')]['key']};});_0x1649b2[_0x8aa3('0x30')]=_[_0x8aa3('0x31')](_0x3c3a14,_0x8aa3('0x2a'));_0x1649b2[_0x8aa3('0x32')]=_[_0x8aa3('0x33')](_0x55726b[_0x8aa3('0x32')]);_0x1649b2[_0x8aa3('0x34')]=_[_0x8aa3('0x35')](_0x1649b2[_0x8aa3('0x30')],_0x1649b2[_0x8aa3('0x32')]);_0x4ceae9[_0x8aa3('0x36')]=_[_0x8aa3('0x35')](_0x1649b2[_0x8aa3('0x30')],qs[_0x8aa3('0x37')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x37')]));_0x4ceae9[_0x8aa3('0x36')]=_0x4ceae9[_0x8aa3('0x36')]['length']?_0x4ceae9[_0x8aa3('0x36')]:_0x1649b2[_0x8aa3('0x30')];if(!_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x38')]('nolimit')){_0x4ceae9[_0x8aa3('0x39')]=qs[_0x8aa3('0x39')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x39')]);_0x4ceae9[_0x8aa3('0x20')]=qs[_0x8aa3('0x20')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x20')]);}_0x4ceae9['order']=qs[_0x8aa3('0x3a')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x3a')]);_0x4ceae9['where']=qs[_0x8aa3('0x34')](_['pick'](_0x55726b[_0x8aa3('0x32')],_0x1649b2['filters']),_0x3c3a14);if(_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x3b')]){_0x4ceae9[_0x8aa3('0x3c')]=_[_0x8aa3('0x3d')](_0x4ceae9['where'],{'$or':_[_0x8aa3('0x31')](_0x3c3a14,function(_0x46c31c){if(_0x46c31c[_0x8aa3('0x2f')]!==_0x8aa3('0x3e')){var _0x21f516={};_0x21f516[_0x46c31c[_0x8aa3('0x2a')]]={'$like':'%'+_0x55726b['query'][_0x8aa3('0x3b')]+'%'};return _0x21f516;}})});}_0x4ceae9=_[_0x8aa3('0x3d')]({},_0x4ceae9,_0x55726b[_0x8aa3('0x3f')]);var _0x781c94={'where':_0x4ceae9[_0x8aa3('0x3c')]};return db['ChatTransferReport']['count'](_0x781c94)[_0x8aa3('0x27')](function(_0x34305d){_0x53edab[_0x8aa3('0x22')]=_0x34305d;if(_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x40')]){_0x4ceae9[_0x8aa3('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4ceae9);})[_0x8aa3('0x27')](function(_0xc46166){_0x53edab['rows']=_0xc46166;return _0x53edab;})[_0x8aa3('0x27')](respondWithFilteredResult(_0x51624a,_0x4ceae9))[_0x8aa3('0x42')](handleError(_0x51624a,null));};exports[_0x8aa3('0x43')]=function(_0x720086,_0x378449){var _0x59c17a={'raw':!![],'where':{'id':_0x720086[_0x8aa3('0x44')]['id']}},_0x38e917={};_0x38e917[_0x8aa3('0x30')]=_[_0x8aa3('0x33')](db['ChatTransferReport'][_0x8aa3('0x2d')]);_0x38e917[_0x8aa3('0x32')]=_[_0x8aa3('0x33')](_0x720086[_0x8aa3('0x32')]);_0x38e917[_0x8aa3('0x34')]=_[_0x8aa3('0x35')](_0x38e917['model'],_0x38e917[_0x8aa3('0x32')]);_0x59c17a['attributes']=_['intersection'](_0x38e917[_0x8aa3('0x30')],qs[_0x8aa3('0x37')](_0x720086[_0x8aa3('0x32')][_0x8aa3('0x37')]));_0x59c17a[_0x8aa3('0x36')]=_0x59c17a[_0x8aa3('0x36')][_0x8aa3('0x45')]?_0x59c17a[_0x8aa3('0x36')]:_0x38e917[_0x8aa3('0x30')];if(_0x720086[_0x8aa3('0x32')][_0x8aa3('0x40')]){_0x59c17a[_0x8aa3('0x41')]=[{'all':!![]}];}_0x59c17a=_['merge']({},_0x59c17a,_0x720086[_0x8aa3('0x3f')]);return db['ChatTransferReport'][_0x8aa3('0x46')](_0x59c17a)[_0x8aa3('0x27')](handleEntityNotFound(_0x378449,null))[_0x8aa3('0x27')](respondWithResult(_0x378449,null))[_0x8aa3('0x42')](handleError(_0x378449,null));};exports[_0x8aa3('0x47')]=function(_0x726e21,_0x577a47){return db[_0x8aa3('0x48')]['create'](_0x726e21['body'],{})[_0x8aa3('0x27')](respondWithResult(_0x577a47,0xc9))[_0x8aa3('0x42')](handleError(_0x577a47,null));};exports[_0x8aa3('0x26')]=function(_0x5b7517,_0x239397){if(_0x5b7517[_0x8aa3('0x49')]['id']){delete _0x5b7517[_0x8aa3('0x49')]['id'];}return db[_0x8aa3('0x48')][_0x8aa3('0x46')]({'where':{'id':_0x5b7517[_0x8aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x239397,null))[_0x8aa3('0x27')](saveUpdates(_0x5b7517['body'],null))[_0x8aa3('0x27')](respondWithResult(_0x239397,null))['catch'](handleError(_0x239397,null));};exports[_0x8aa3('0x4a')]=function(_0x1453ec,_0x31efdc){return db['ChatTransferReport'][_0x8aa3('0x46')]({'where':{'id':_0x1453ec[_0x8aa3('0x44')]['id']}})[_0x8aa3('0x27')](handleEntityNotFound(_0x31efdc,null))[_0x8aa3('0x27')](removeEntity(_0x31efdc,null))[_0x8aa3('0x42')](handleError(_0x31efdc,null));};exports[_0x8aa3('0x4b')]=function(_0x3f27e3,_0x5b09dd){return db[_0x8aa3('0x48')][_0x8aa3('0x4b')]()[_0x8aa3('0x27')](respondWithResult(_0x5b09dd,null))[_0x8aa3('0x42')](handleError(_0x5b09dd,null));}; \ No newline at end of file +var _0x02c1=['params','merge','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show'];(function(_0x460522,_0x1018fe){var _0x3deee0=function(_0xd0a315){while(--_0xd0a315){_0x460522['push'](_0x460522['shift']());}};_0x3deee0(++_0x1018fe);}(_0x02c1,0xdf));var _0x102c=function(_0x180fe2,_0x5bdd03){_0x180fe2=_0x180fe2-0x0;var _0x43af94=_0x02c1[_0x180fe2];return _0x43af94;};'use strict';var emlformat=require(_0x102c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x102c('0x1'));var rp=require(_0x102c('0x2'));var moment=require(_0x102c('0x3'));var BPromise=require(_0x102c('0x4'));var Mustache=require('mustache');var util=require(_0x102c('0x5'));var path=require('path');var sox=require(_0x102c('0x6'));var csv=require(_0x102c('0x7'));var ejs=require(_0x102c('0x8'));var fs=require('fs');var fs_extra=require(_0x102c('0x9'));var _=require(_0x102c('0xa'));var squel=require(_0x102c('0xb'));var crypto=require('crypto');var jsforce=require(_0x102c('0xc'));var deskjs=require(_0x102c('0xd'));var toCsv=require(_0x102c('0x7'));var querystring=require('querystring');var Papa=require(_0x102c('0xe'));var Redis=require(_0x102c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x102c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x102c('0x11'));var logger=require(_0x102c('0x12'))(_0x102c('0x13'));var utils=require(_0x102c('0x14'));var config=require(_0x102c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x86c4fa,_0x6976c7){_0x6976c7=_0x6976c7||0xcc;return function(_0x2f00ba){if(_0x2f00ba){return _0x86c4fa['sendStatus'](_0x6976c7);}return _0x86c4fa[_0x102c('0x16')](_0x6976c7)[_0x102c('0x17')]();};}function respondWithResult(_0xfdb18a,_0x5f5bc2){_0x5f5bc2=_0x5f5bc2||0xc8;return function(_0xb6c190){if(_0xb6c190){return _0xfdb18a[_0x102c('0x16')](_0x5f5bc2)[_0x102c('0x18')](_0xb6c190);}};}function respondWithFilteredResult(_0x202b3c,_0x49b792){return function(_0x29d711){if(_0x29d711){var _0x42ab9b=typeof _0x49b792[_0x102c('0x19')]==='undefined'&&typeof _0x49b792['limit']===_0x102c('0x1a');var _0x39dc98=_0x29d711[_0x102c('0x1b')];var _0x19becf=_0x42ab9b?0x0:_0x49b792[_0x102c('0x19')];var _0x1017da=_0x42ab9b?_0x29d711['count']:_0x49b792[_0x102c('0x19')]+_0x49b792[_0x102c('0x1c')];var _0x1d04c3;if(_0x1017da>=_0x39dc98){_0x1017da=_0x39dc98;_0x1d04c3=0xc8;}else{_0x1d04c3=0xce;}_0x202b3c[_0x102c('0x16')](_0x1d04c3);return _0x202b3c['set'](_0x102c('0x1d'),_0x19becf+'-'+_0x1017da+'/'+_0x39dc98)[_0x102c('0x18')](_0x29d711);}return null;};}function patchUpdates(_0x200630){return function(_0x5bded0){try{jsonpatch[_0x102c('0x1e')](_0x5bded0,_0x200630,!![]);}catch(_0x5d6e52){return BPromise[_0x102c('0x1f')](_0x5d6e52);}return _0x5bded0['save']();};}function saveUpdates(_0x520970,_0xb19974){return function(_0x5e15a9){if(_0x5e15a9){return _0x5e15a9['update'](_0x520970)['then'](function(_0x3d50bc){return _0x3d50bc;});}return null;};}function removeEntity(_0x5d9adf,_0x3aa0f8){return function(_0x4ccc9e){if(_0x4ccc9e){return _0x4ccc9e[_0x102c('0x20')]()[_0x102c('0x21')](function(){_0x5d9adf[_0x102c('0x16')](0xcc)[_0x102c('0x17')]();});}};}function handleEntityNotFound(_0xfeef04,_0x3401c3){return function(_0x2b9e94){if(!_0x2b9e94){_0xfeef04[_0x102c('0x22')](0x194);}return _0x2b9e94;};}function handleError(_0x42e36c,_0x3dbb62){_0x3dbb62=_0x3dbb62||0x1f4;return function(_0x3c2659){logger['error'](_0x3c2659[_0x102c('0x23')]);if(_0x3c2659[_0x102c('0x24')]){delete _0x3c2659[_0x102c('0x24')];}_0x42e36c[_0x102c('0x16')](_0x3dbb62)[_0x102c('0x25')](_0x3c2659);};}exports[_0x102c('0x26')]=function(_0x44fc8d,_0x2c1c9d){var _0x3289ac={},_0x2ce5e7={},_0x27e087={'count':0x0,'rows':[]};var _0x14b26e=_[_0x102c('0x27')](db[_0x102c('0x28')][_0x102c('0x29')],function(_0x119f4c){return{'name':_0x119f4c[_0x102c('0x2a')],'type':_0x119f4c[_0x102c('0x2b')][_0x102c('0x2c')]};});_0x2ce5e7[_0x102c('0x2d')]=_[_0x102c('0x27')](_0x14b26e,_0x102c('0x24'));_0x2ce5e7[_0x102c('0x2e')]=_[_0x102c('0x2f')](_0x44fc8d[_0x102c('0x2e')]);_0x2ce5e7[_0x102c('0x30')]=_[_0x102c('0x31')](_0x2ce5e7[_0x102c('0x2d')],_0x2ce5e7[_0x102c('0x2e')]);_0x3289ac[_0x102c('0x32')]=_[_0x102c('0x31')](_0x2ce5e7[_0x102c('0x2d')],qs[_0x102c('0x33')](_0x44fc8d[_0x102c('0x2e')]['fields']));_0x3289ac[_0x102c('0x32')]=_0x3289ac[_0x102c('0x32')][_0x102c('0x34')]?_0x3289ac[_0x102c('0x32')]:_0x2ce5e7['model'];if(!_0x44fc8d[_0x102c('0x2e')][_0x102c('0x35')](_0x102c('0x36'))){_0x3289ac[_0x102c('0x1c')]=qs[_0x102c('0x1c')](_0x44fc8d['query'][_0x102c('0x1c')]);_0x3289ac[_0x102c('0x19')]=qs[_0x102c('0x19')](_0x44fc8d[_0x102c('0x2e')]['offset']);}_0x3289ac['order']=qs['sort'](_0x44fc8d[_0x102c('0x2e')][_0x102c('0x37')]);_0x3289ac[_0x102c('0x38')]=qs['filters'](_[_0x102c('0x39')](_0x44fc8d[_0x102c('0x2e')],_0x2ce5e7[_0x102c('0x30')]),_0x14b26e);if(_0x44fc8d['query'][_0x102c('0x3a')]){_0x3289ac[_0x102c('0x38')]=_['merge'](_0x3289ac['where'],{'$or':_['map'](_0x14b26e,function(_0xa57a35){if(_0xa57a35[_0x102c('0x2b')]!==_0x102c('0x3b')){var _0x2163df={};_0x2163df[_0xa57a35[_0x102c('0x24')]]={'$like':'%'+_0x44fc8d['query'][_0x102c('0x3a')]+'%'};return _0x2163df;}})});}_0x3289ac=_['merge']({},_0x3289ac,_0x44fc8d[_0x102c('0x3c')]);var _0x51e718={'where':_0x3289ac[_0x102c('0x38')]};return db[_0x102c('0x28')][_0x102c('0x1b')](_0x51e718)['then'](function(_0x29ac0f){_0x27e087[_0x102c('0x1b')]=_0x29ac0f;if(_0x44fc8d[_0x102c('0x2e')]['includeAll']){_0x3289ac[_0x102c('0x3d')]=[{'all':!![]}];}return db[_0x102c('0x28')][_0x102c('0x3e')](_0x3289ac);})['then'](function(_0x2826a3){_0x27e087['rows']=_0x2826a3;return _0x27e087;})['then'](respondWithFilteredResult(_0x2c1c9d,_0x3289ac))[_0x102c('0x3f')](handleError(_0x2c1c9d,null));};exports[_0x102c('0x40')]=function(_0x4dcc64,_0x291bff){var _0x4995da={'raw':!![],'where':{'id':_0x4dcc64[_0x102c('0x41')]['id']}},_0x40e776={};_0x40e776[_0x102c('0x2d')]=_['keys'](db[_0x102c('0x28')]['rawAttributes']);_0x40e776[_0x102c('0x2e')]=_['keys'](_0x4dcc64[_0x102c('0x2e')]);_0x40e776[_0x102c('0x30')]=_[_0x102c('0x31')](_0x40e776[_0x102c('0x2d')],_0x40e776['query']);_0x4995da['attributes']=_['intersection'](_0x40e776[_0x102c('0x2d')],qs[_0x102c('0x33')](_0x4dcc64[_0x102c('0x2e')][_0x102c('0x33')]));_0x4995da[_0x102c('0x32')]=_0x4995da['attributes'][_0x102c('0x34')]?_0x4995da[_0x102c('0x32')]:_0x40e776[_0x102c('0x2d')];if(_0x4dcc64[_0x102c('0x2e')]['includeAll']){_0x4995da['include']=[{'all':!![]}];}_0x4995da=_[_0x102c('0x42')]({},_0x4995da,_0x4dcc64[_0x102c('0x3c')]);return db[_0x102c('0x28')]['find'](_0x4995da)[_0x102c('0x21')](handleEntityNotFound(_0x291bff,null))['then'](respondWithResult(_0x291bff,null))[_0x102c('0x3f')](handleError(_0x291bff,null));};exports[_0x102c('0x43')]=function(_0x12cbd1,_0x29ed7b){return db['ChatTransferReport'][_0x102c('0x43')](_0x12cbd1[_0x102c('0x44')],{})[_0x102c('0x21')](respondWithResult(_0x29ed7b,0xc9))[_0x102c('0x3f')](handleError(_0x29ed7b,null));};exports[_0x102c('0x45')]=function(_0x175c3f,_0x31f4fb){if(_0x175c3f[_0x102c('0x44')]['id']){delete _0x175c3f[_0x102c('0x44')]['id'];}return db[_0x102c('0x28')]['find']({'where':{'id':_0x175c3f[_0x102c('0x41')]['id']}})[_0x102c('0x21')](handleEntityNotFound(_0x31f4fb,null))['then'](saveUpdates(_0x175c3f[_0x102c('0x44')],null))[_0x102c('0x21')](respondWithResult(_0x31f4fb,null))[_0x102c('0x3f')](handleError(_0x31f4fb,null));};exports[_0x102c('0x20')]=function(_0x14ceaf,_0x5c7d7d){return db[_0x102c('0x28')][_0x102c('0x46')]({'where':{'id':_0x14ceaf[_0x102c('0x41')]['id']}})[_0x102c('0x21')](handleEntityNotFound(_0x5c7d7d,null))[_0x102c('0x21')](removeEntity(_0x5c7d7d,null))[_0x102c('0x3f')](handleError(_0x5c7d7d,null));};exports[_0x102c('0x47')]=function(_0x56ca11,_0x37870f){return db[_0x102c('0x28')][_0x102c('0x47')]()[_0x102c('0x21')](respondWithResult(_0x37870f,null))['catch'](handleError(_0x37870f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9350cca..f07dc72 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 _0x4604=['ChatTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x45de85,_0x21c71d){var _0x28146d=function(_0x35d8a8){while(--_0x35d8a8){_0x45de85['push'](_0x45de85['shift']());}};_0x28146d(++_0x21c71d);}(_0x4604,0x152));var _0x4460=function(_0x46415b,_0x513b58){_0x46415b=_0x46415b-0x0;var _0x5bf723=_0x4604[_0x46415b];return _0x5bf723;};'use strict';var _=require(_0x4460('0x0'));var util=require('util');var logger=require(_0x4460('0x1'))('api');var moment=require(_0x4460('0x2'));var BPromise=require(_0x4460('0x3'));var rp=require(_0x4460('0x4'));var fs=require('fs');var path=require(_0x4460('0x5'));var rimraf=require(_0x4460('0x6'));var config=require(_0x4460('0x7'));var attributes=require(_0x4460('0x8'));module[_0x4460('0x9')]=function(_0xf7f02a,_0x1c0d5d){return _0xf7f02a['define'](_0x4460('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4460('0xb'),'fields':[_0x4460('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee12=['util','../../config/logger','api','moment','bluebird','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x440e51,_0x4fc63a){var _0x9be905=function(_0x3e685e){while(--_0x3e685e){_0x440e51['push'](_0x440e51['shift']());}};_0x9be905(++_0x4fc63a);}(_0xee12,0x137));var _0x2ee1=function(_0x32d7ae,_0x3bb40a){_0x32d7ae=_0x32d7ae-0x0;var _0x4572d0=_0xee12[_0x32d7ae];return _0x4572d0;};'use strict';var _=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var logger=require(_0x2ee1('0x2'))(_0x2ee1('0x3'));var moment=require(_0x2ee1('0x4'));var BPromise=require(_0x2ee1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ee1('0x6'));var config=require('../../config/environment');var attributes=require(_0x2ee1('0x7'));module[_0x2ee1('0x8')]=function(_0x46ae02,_0x73ad94){return _0x46ae02[_0x2ee1('0x9')](_0x2ee1('0xa'),attributes,{'tableName':_0x2ee1('0xb'),'paranoid':![],'indexes':[{'name':_0x2ee1('0xc'),'fields':[_0x2ee1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7a82e9e..b1a143e 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 _0xb48a=['error','code','request\x20sent','result','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4561b5,_0x3459cb){var _0x13f689=function(_0x5877b3){while(--_0x5877b3){_0x4561b5['push'](_0x4561b5['shift']());}};_0x13f689(++_0x3459cb);}(_0xb48a,0x17c));var _0xab48=function(_0x3cd46c,_0x48428e){_0x3cd46c=_0x3cd46c-0x0;var _0x3f6ab1=_0xb48a[_0x3cd46c];return _0x3f6ab1;};'use strict';var _=require(_0xab48('0x0'));var util=require(_0xab48('0x1'));var moment=require(_0xab48('0x2'));var BPromise=require('bluebird');var rs=require(_0xab48('0x3'));var fs=require('fs');var Redis=require(_0xab48('0x4'));var db=require(_0xab48('0x5'))['db'];var utils=require(_0xab48('0x6'));var logger=require(_0xab48('0x7'))('rpc');var config=require(_0xab48('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56f73a,_0x1cc165,_0x2fe624){return new BPromise(function(_0x2fdd2c,_0x5c9000){return client['request'](_0x56f73a,_0x2fe624)[_0xab48('0xa')](function(_0x2f3aa9){logger[_0xab48('0xb')](_0xab48('0xc'),_0x1cc165,'request\x20sent');logger[_0xab48('0xd')](_0xab48('0xe'),_0x1cc165,'request\x20sent',JSON[_0xab48('0xf')](_0x2f3aa9));if(_0x2f3aa9['error']){if(_0x2f3aa9[_0xab48('0x10')][_0xab48('0x11')]===0x1f4){logger[_0xab48('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x1cc165,_0x2f3aa9[_0xab48('0x10')]['message']);return _0x5c9000(_0x2f3aa9[_0xab48('0x10')]['message']);}logger[_0xab48('0x10')](_0xab48('0xc'),_0x1cc165,_0x2f3aa9[_0xab48('0x10')]['message']);return _0x2fdd2c(_0x2f3aa9[_0xab48('0x10')]['message']);}else{logger[_0xab48('0xb')](_0xab48('0xc'),_0x1cc165,_0xab48('0x12'));_0x2fdd2c(_0x2f3aa9[_0xab48('0x13')][_0xab48('0x14')]);}})[_0xab48('0x15')](function(_0x54a894){logger['error'](_0xab48('0xc'),_0x1cc165,_0x54a894);_0x5c9000(_0x54a894);});});} \ No newline at end of file +var _0xa084=['error','code','message','ChatTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a1f72,_0x511f42){var _0x76661=function(_0xe7f7b2){while(--_0xe7f7b2){_0x2a1f72['push'](_0x2a1f72['shift']());}};_0x76661(++_0x511f42);}(_0xa084,0x1d1));var _0x4a08=function(_0x1e9581,_0x3df1e0){_0x1e9581=_0x1e9581-0x0;var _0x1bd771=_0xa084[_0x1e9581];return _0x1bd771;};'use strict';var _=require(_0x4a08('0x0'));var util=require(_0x4a08('0x1'));var moment=require('moment');var BPromise=require(_0x4a08('0x2'));var rs=require(_0x4a08('0x3'));var fs=require('fs');var Redis=require(_0x4a08('0x4'));var db=require(_0x4a08('0x5'))['db'];var utils=require(_0x4a08('0x6'));var logger=require(_0x4a08('0x7'))(_0x4a08('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a08('0x9'));var client=jayson[_0x4a08('0xa')][_0x4a08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15b13c,_0x2d9bd4,_0x5460dd){return new BPromise(function(_0x268350,_0x348c6c){return client['request'](_0x15b13c,_0x5460dd)[_0x4a08('0xc')](function(_0x6461c9){logger[_0x4a08('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2d9bd4,_0x4a08('0xe'));logger[_0x4a08('0xf')](_0x4a08('0x10'),_0x2d9bd4,_0x4a08('0xe'),JSON[_0x4a08('0x11')](_0x6461c9));if(_0x6461c9[_0x4a08('0x12')]){if(_0x6461c9[_0x4a08('0x12')][_0x4a08('0x13')]===0x1f4){logger[_0x4a08('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2d9bd4,_0x6461c9[_0x4a08('0x12')][_0x4a08('0x14')]);return _0x348c6c(_0x6461c9[_0x4a08('0x12')][_0x4a08('0x14')]);}logger['error'](_0x4a08('0x15'),_0x2d9bd4,_0x6461c9[_0x4a08('0x12')][_0x4a08('0x14')]);return _0x268350(_0x6461c9[_0x4a08('0x12')]['message']);}else{logger[_0x4a08('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2d9bd4,_0x4a08('0xe'));_0x268350(_0x6461c9[_0x4a08('0x16')][_0x4a08('0x14')]);}})['catch'](function(_0x24e157){logger[_0x4a08('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2d9bd4,_0x24e157);_0x348c6c(_0x24e157);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d7f9c27..7d4ffd5 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 _0xe0be=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','show','post','put','/:id','update','destroy','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xe0be,0x1a0));var _0xee0b=function(_0x5f3e13,_0x5332fb){_0x5f3e13=_0x5f3e13-0x0;var _0x3d95a5=_0xe0be[_0x5f3e13];return _0x3d95a5;};'use strict';var multer=require('multer');var util=require(_0xee0b('0x0'));var path=require('path');var timeout=require(_0xee0b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xee0b('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xee0b('0x3'));var config=require(_0xee0b('0x4'));var controller=require(_0xee0b('0x5'));router[_0xee0b('0x6')]('/',auth[_0xee0b('0x7')](),controller['index']);router[_0xee0b('0x6')]('/describe',auth[_0xee0b('0x7')](),controller[_0xee0b('0x8')]);router[_0xee0b('0x6')]('/:id',auth[_0xee0b('0x7')](),controller[_0xee0b('0x9')]);router[_0xee0b('0xa')]('/',auth[_0xee0b('0x7')](),controller['create']);router[_0xee0b('0xb')](_0xee0b('0xc'),auth[_0xee0b('0x7')](),controller[_0xee0b('0xd')]);router['delete']('/:id',auth[_0xee0b('0x7')](),controller[_0xee0b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8038=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x8038,0x145));var _0x8803=function(_0x90a465,_0x2a3516){_0x90a465=_0x90a465-0x0;var _0x3451ca=_0x8038[_0x90a465];return _0x3451ca;};'use strict';var multer=require(_0x8803('0x0'));var util=require(_0x8803('0x1'));var path=require(_0x8803('0x2'));var timeout=require(_0x8803('0x3'));var express=require(_0x8803('0x4'));var router=express[_0x8803('0x5')]();var fs_extra=require(_0x8803('0x6'));var auth=require(_0x8803('0x7'));var interaction=require(_0x8803('0x8'));var config=require(_0x8803('0x9'));var controller=require(_0x8803('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8803('0xb')](_0x8803('0xc'),auth[_0x8803('0xd')](),controller[_0x8803('0xe')]);router[_0x8803('0xb')](_0x8803('0xf'),auth[_0x8803('0xd')](),controller[_0x8803('0x10')]);router[_0x8803('0x11')]('/',auth[_0x8803('0xd')](),controller[_0x8803('0x12')]);router['put']('/:id',auth[_0x8803('0xd')](),controller['update']);router[_0x8803('0x13')](_0x8803('0xf'),auth[_0x8803('0xd')](),controller[_0x8803('0x14')]);module[_0x8803('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index aebcf13..cd9a780 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 _0x0ab9=['stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb'];(function(_0x5e33d5,_0x967036){var _0x41fcd5=function(_0x49ae20){while(--_0x49ae20){_0x5e33d5['push'](_0x5e33d5['shift']());}};_0x41fcd5(++_0x967036);}(_0x0ab9,0xd7));var _0x90ab=function(_0x185b54,_0x2ff7b4){_0x185b54=_0x185b54-0x0;var _0x225ec9=_0x0ab9[_0x185b54];return _0x225ec9;};'use strict';var Sequelize=require(_0x90ab('0x0'));var rs=require(_0x90ab('0x1'));module['exports']={'name':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'unique':_0x90ab('0x3')},'description':{'type':Sequelize[_0x90ab('0x2')]},'mapKey':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x5')},'customerAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x90ab('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x90ab('0x9')](_0x90ab('0xa'),_0x90ab('0xb')),'defaultValue':_0x90ab('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0xc')},'start_chat_button':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x90ab('0xf')]},'closingQuestion':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x12')},'closingMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x14')},'skipMessageButton':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x15')},'conditionAgreement':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x16')},'ratingType':{'type':Sequelize[_0x90ab('0x9')](_0x90ab('0x17'),_0x90ab('0x18')),'defaultValue':_0x90ab('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return JSON[_0x90ab('0x19')]({'items':[{'type':_0x90ab('0x1a'),'variable':null,'config':{'placeholder':_0x90ab('0x1b'),'type':_0x90ab('0x1c'),'required':!![]},'props':{'title':_0x90ab('0x1b'),'helpText':''}},{'type':_0x90ab('0x1a'),'props':{'title':_0x90ab('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x90ab('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x90ab('0x1d'))?JSON[_0x90ab('0x1e')](this[_0x90ab('0x1f')]('onlineForm')):{};},'set':function(_0xb26300){return this[_0x90ab('0x20')](_0x90ab('0x1d'),JSON[_0x90ab('0x19')](_0xb26300));}},'offlineForm':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return JSON[_0x90ab('0x19')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x90ab('0x4')},'variable':null},{'type':_0x90ab('0x21'),'config':{'placeholder':_0x90ab('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x90ab('0x1f')]('offlineForm')?JSON[_0x90ab('0x1e')](this[_0x90ab('0x1f')]('offlineForm')):{};},'set':function(_0xdb3c09){return this['setDataValue'](_0x90ab('0x23'),JSON[_0x90ab('0x19')](_0xdb3c09));}},'token':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':function(){return rs[_0x90ab('0x24')]();}},'autoclose':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x90ab('0x2')]},'waitingTitle':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x25')},'waitingMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x15')},'sendUnmanaged':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return _0x90ab('0x28');}},'notificationSound':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x2a')},'messagesAlignment':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x90ab('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x90ab('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9004b8){if(!_0x9004b8)this[_0x90ab('0x20')](_0x90ab('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x9004b8);}},'vidaooEscalation':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x90ab('0x2')]},'vidaooTopic':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':function(){return _0x90ab('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x90ab('0xf')]}}; \ No newline at end of file +var _0x1a9f=['Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','INTEGER','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','email','Agent','#011F6A','#ffffff','ENUM','rounded'];(function(_0x15bd08,_0x805ab4){var _0x375cc5=function(_0x28701e){while(--_0x28701e){_0x15bd08['push'](_0x15bd08['shift']());}};_0x375cc5(++_0x805ab4);}(_0x1a9f,0xbb));var _0xf1a9=function(_0x581182,_0x4d140b){_0x581182=_0x581182-0x0;var _0x27eed2=_0x1a9f[_0x581182];return _0x27eed2;};'use strict';var Sequelize=require(_0xf1a9('0x0'));var rs=require('randomstring');module[_0xf1a9('0x1')]={'name':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xf1a9('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0x3')},'key':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x4')},'customerAlias':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':_0xf1a9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':_0xf1a9('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':_0xf1a9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf1a9('0x7')](_0xf1a9('0x8'),'squared'),'defaultValue':_0xf1a9('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x9')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0xa')},'header_offline':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0xb')},'download_transcript':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf1a9('0xe')]},'closingQuestion':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x10')},'noteTitle':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x11')},'placeholderMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x12')},'closingMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x13')},'closingMessageButton':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0x14')},'conditionAgreement':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x15')},'ratingType':{'type':Sequelize[_0xf1a9('0x7')]('star',_0xf1a9('0x16')),'defaultValue':_0xf1a9('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf1a9('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf1a9('0xe')],'defaultValue':function(){return JSON[_0xf1a9('0x19')]({'items':[{'type':_0xf1a9('0x1a'),'variable':null,'config':{'placeholder':_0xf1a9('0x1b'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xf1a9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf1a9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf1a9('0x1c')](_0xf1a9('0x1d'))?JSON[_0xf1a9('0x1e')](this[_0xf1a9('0x1c')]('onlineForm')):{};},'set':function(_0x5717b1){return this[_0xf1a9('0x1f')](_0xf1a9('0x1d'),JSON[_0xf1a9('0x19')](_0x5717b1));}},'offlineForm':{'type':Sequelize[_0xf1a9('0xe')],'defaultValue':function(){return JSON[_0xf1a9('0x19')]({'items':[{'type':_0xf1a9('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf1a9('0x3'),'type':'email'},'variable':null},{'type':_0xf1a9('0x20'),'config':{'placeholder':_0xf1a9('0x21')},'props':{'title':_0xf1a9('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xf1a9('0x1c')](_0xf1a9('0x22'))?JSON[_0xf1a9('0x1e')](this['getDataValue'](_0xf1a9('0x22'))):{};},'set':function(_0x1194dc){return this[_0xf1a9('0x1f')](_0xf1a9('0x22'),JSON['stringify'](_0x1194dc));}},'token':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':function(){return rs[_0xf1a9('0x23')]();}},'autoclose':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf1a9('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0x24')},'waitingMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x14')},'sendUnmanaged':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf1a9('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf1a9('0xe')],'defaultValue':function(){return _0xf1a9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf1a9('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf1a9('0x29')},'verticalAlignment':{'type':Sequelize[_0xf1a9('0x18')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x2a')},'messagesAlignment':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':_0xf1a9('0x2b')},'defaultTitle':{'type':Sequelize[_0xf1a9('0x2')]},'customerAvatar':{'type':Sequelize[_0xf1a9('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf1a9('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':_0xf1a9('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf1a9('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf1a9('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3dafe8){if(!_0x3dafe8)this[_0xf1a9('0x1f')](_0xf1a9('0x2e'),null);this[_0xf1a9('0x1f')]('mandatoryDisposition',_0x3dafe8);}},'vidaooEscalation':{'type':Sequelize[_0xf1a9('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf1a9('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf1a9('0x2')],'allowNull':![],'defaultValue':_0xf1a9('0x2f')},'vidaooNote':{'type':Sequelize[_0xf1a9('0x2')],'defaultValue':function(){return _0xf1a9('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xf1a9('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf1a9('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 71c7df1..b36e756 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 _0x9bde=['query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','ChatWebsite','include','findAll','rows','show','params','keys','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','hasOwnProperty','order','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','updatedAt','includes','createdAt','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','contact','messageId','update','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','omit','includeAll','internal','Tags','tag','getSnippet','interval','getProactiveActions','virtual','increment','server/files/chat/iframe.ejs','utf8','headers','origin','http://localhost:9000','remote','connection','replace','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','bulkCreate','findAndCountAll','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','fromKey','Contact','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','then','get','ChatWebsites','UserProfileResource','destroy','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','model','vendor','format','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bde,0xe1));var _0xe9bd=function(_0x275cbe,_0x5545b5){_0x275cbe=_0x275cbe-0x0;var _0x49144f=_0x9bde[_0x275cbe];return _0x49144f;};'use strict';var Mustache=require('mustache');var util=require(_0xe9bd('0x0'));var path=require('path');var ejs=require(_0xe9bd('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9bd('0x2'));var querystring=require(_0xe9bd('0x3'));var htmlToText=require(_0xe9bd('0x4'));var Redis=require(_0xe9bd('0x5'));var jayson=require(_0xe9bd('0x6'));var qs=require(_0xe9bd('0x7'));var logger=require(_0xe9bd('0x8'))('api');var config=require(_0xe9bd('0x9'));var APIBadRequestError=require(_0xe9bd('0xa'))[_0xe9bd('0xb')];var APINotFoundError=require(_0xe9bd('0xa'))[_0xe9bd('0xc')];var APIOutOfIntervalError=require(_0xe9bd('0xa'))[_0xe9bd('0xd')];var APIHandleError=require(_0xe9bd('0xa'))[_0xe9bd('0xe')];var APIConflictError=require(_0xe9bd('0xa'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xe9bd('0xf'))[_0xe9bd('0x10')];var db=require(_0xe9bd('0x11'))['db'];config['redis']=_[_0xe9bd('0x12')](config[_0xe9bd('0x13')],{'host':_0xe9bd('0x14'),'port':0x18eb});var socket=require(_0xe9bd('0x15'))(new Redis(config['redis']));require(_0xe9bd('0x16'))['register'](socket);var client=jayson[_0xe9bd('0x17')][_0xe9bd('0x18')]({'port':0x232c});var client9002=jayson[_0xe9bd('0x17')]['http']({'port':0x232a});var client9003=jayson['client'][_0xe9bd('0x18')]({'port':0x232b});var client9001=jayson[_0xe9bd('0x17')][_0xe9bd('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x46a59b,_0x3360bd,_0x389e7b,_0x45a9f2){return new Promise(function(_0x573350,_0x1d11a0){var _0x464a1b=_0x45a9f2||client;return _0x464a1b[_0xe9bd('0x19')](_0x46a59b,_0x389e7b)['then'](function(_0x36f03d){logger[_0xe9bd('0x1a')](_0xe9bd('0x1b'),_0x3360bd,_0xe9bd('0x1c'));logger['debug'](_0xe9bd('0x1d'),_0x3360bd,'request\x20sent',JSON[_0xe9bd('0x1e')](_0x36f03d));if(_0x36f03d['error']){if(_0x36f03d[_0xe9bd('0x1f')][_0xe9bd('0x20')]===0x1f4){logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x36f03d[_0xe9bd('0x1f')][_0xe9bd('0x21')]);return _0x1d11a0(_0x36f03d[_0xe9bd('0x1f')]['message']);}logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x36f03d['error'][_0xe9bd('0x21')]);return _0x573350(_0x36f03d['error'][_0xe9bd('0x21')]);}else{logger[_0xe9bd('0x1a')](_0xe9bd('0x1b'),_0x3360bd,_0xe9bd('0x1c'));_0x573350(_0x36f03d['result'][_0xe9bd('0x21')]);}})[_0xe9bd('0x22')](function(_0x2c9a57){logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x2c9a57);_0x1d11a0(_0x2c9a57);});});}function respondWithStatusCode(_0xb52d45,_0x399f3c){_0x399f3c=_0x399f3c||0xcc;return function(_0x43ea90){if(_0x43ea90){return _0xb52d45[_0xe9bd('0x23')](_0x399f3c);}return _0xb52d45['status'](_0x399f3c)[_0xe9bd('0x24')]();};}function respondWithResult(_0x38fdfa,_0x5ba1d6){_0x5ba1d6=_0x5ba1d6||0xc8;return function(_0x3b13b7){if(_0x3b13b7){return _0x38fdfa[_0xe9bd('0x25')](_0x5ba1d6)[_0xe9bd('0x26')](_0x3b13b7);}};}function respondWithFilteredResult(_0x429055,_0x141b95){return function(_0x183601){if(_0x183601){var _0x519f48=typeof _0x141b95['offset']===_0xe9bd('0x27')&&typeof _0x141b95['limit']===_0xe9bd('0x27');var _0x1f2c0e=_0x183601[_0xe9bd('0x28')];var _0x36aa80=_0x519f48?0x0:_0x141b95[_0xe9bd('0x29')];var _0x509e36=_0x519f48?_0x183601['count']:_0x141b95[_0xe9bd('0x29')]+_0x141b95[_0xe9bd('0x2a')];var _0x3f96a0;if(_0x509e36>=_0x1f2c0e){_0x509e36=_0x1f2c0e;_0x3f96a0=0xc8;}else{_0x3f96a0=0xce;}_0x429055[_0xe9bd('0x25')](_0x3f96a0);return _0x429055[_0xe9bd('0x2b')](_0xe9bd('0x2c'),_0x36aa80+'-'+_0x509e36+'/'+_0x1f2c0e)[_0xe9bd('0x26')](_0x183601);}return null;};}function saveUpdates(_0x66213a){return function(_0x45703e){if(_0x45703e){return _0x45703e['update'](_0x66213a)[_0xe9bd('0x2d')](function(_0x81a31f){return _0x81a31f;});}return null;};}function removeEntity(_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x2d')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x2e')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x2f');return db[_0xe9bd('0x30')][_0xe9bd('0x31')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x2d')](function(){return _0x5117bc;});})[_0xe9bd('0x2d')](function(){_0x390a43[_0xe9bd('0x25')](0xcc)[_0xe9bd('0x24')]();});}};}function handleEntityNotFound(_0x549dd1){return function(_0x2ad46e){if(!_0x2ad46e){_0x549dd1[_0xe9bd('0x23')](0x194);}return _0x2ad46e;};}function handleError(_0xc50476,_0x8ff624){_0x8ff624=_0x8ff624||0x1f4;return function(_0x264ba0){logger[_0xe9bd('0x1f')](_0x264ba0['stack']);if(_0x264ba0[_0xe9bd('0x32')]){delete _0x264ba0[_0xe9bd('0x32')];}_0xc50476['status'](_0x8ff624)[_0xe9bd('0x33')](_0x264ba0);};}function createInteractionObject(_0x264c87,_0x4c7d47,_0x4b1da0,_0x2785e6){var _0xdf43b9=require('user-agent-parser');var _0x2d1289=new _0xdf43b9();var _0x3ea705=_0x2d1289[_0xe9bd('0x34')](_0x4b1da0['user-agent'])[_0xe9bd('0x35')]();var _0x4d1945=_0x4c7d47[_0xe9bd('0x36')];if(_0x4b1da0[_0xe9bd('0x37')]){_0x4d1945=_0x4b1da0[_0xe9bd('0x37')];}else if(_0x4b1da0[_0xe9bd('0x38')]){_0x4d1945=_['first'](_0x4b1da0[_0xe9bd('0x38')][_0xe9bd('0x39')](','));}return{'ContactId':_0x2785e6['id'],'ChatWebsiteId':_0x264c87,'from':(_0x2785e6[_0xe9bd('0x3a')]||'')+'\x20'+(_0x2785e6[_0xe9bd('0x3b')]||''),'customerIp':_0x4d1945,'customerPort':_0x4b1da0[_0xe9bd('0x3c')]?_0x4b1da0[_0xe9bd('0x3c')]:null,'referer':_0x4c7d47[_0xe9bd('0x3d')],'browserName':_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x32')]&&_0x3ea705[_0xe9bd('0x3e')]['version']?util['format'](_0xe9bd('0x3f'),_0x3ea705['browser'][_0xe9bd('0x32')],_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x40')]):'unknown','browserVersion':_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x40')]||_0xe9bd('0x41'),'osName':util['format'](_0xe9bd('0x3f'),_0x3ea705['os'][_0xe9bd('0x32')],_0x3ea705['os'][_0xe9bd('0x40')]),'osVersion':_0x3ea705['os'][_0xe9bd('0x40')],'deviceModel':_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x43')]&&_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x44')]?util[_0xe9bd('0x45')](_0xe9bd('0x46'),_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x43')],_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x44')],_0x3ea705[_0xe9bd('0x42')]['type']):null,'deviceVendor':_0x3ea705['device'][_0xe9bd('0x44')],'deviceType':_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x47')],'formData':JSON['stringify'](_0x4c7d47)};}exports['index']=function(_0x43cf7d,_0x3f6f22){var _0x165942={'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]},_0x15da40={},_0x39fb61={'count':0x0,'rows':[]};var _0x512899=_[_0xe9bd('0x4a')](db['ChatWebsite'][_0xe9bd('0x4b')],function(_0x2277f9){return{'name':_0x2277f9[_0xe9bd('0x4c')],'type':_0x2277f9[_0xe9bd('0x47')][_0xe9bd('0x4d')]};});_0x15da40['model']=_[_0xe9bd('0x4a')](_0x512899,_0xe9bd('0x32'));_0x15da40[_0xe9bd('0x4e')]=_['keys'](_0x43cf7d[_0xe9bd('0x4e')]);_0x15da40[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x15da40['model'],_0x15da40[_0xe9bd('0x4e')]);_0x165942[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x15da40[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x43cf7d['query'][_0xe9bd('0x52')]));_0x165942['attributes']=_0x165942[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x165942[_0xe9bd('0x51')]:_0x15da40[_0xe9bd('0x43')];if(!_0x43cf7d[_0xe9bd('0x4e')]['hasOwnProperty'](_0xe9bd('0x54'))){_0x165942['limit']=qs[_0xe9bd('0x2a')](_0x43cf7d[_0xe9bd('0x4e')]['limit']);_0x165942['offset']=qs[_0xe9bd('0x29')](_0x43cf7d['query'][_0xe9bd('0x29')]);}_0x165942['order']=qs[_0xe9bd('0x55')](_0x43cf7d[_0xe9bd('0x4e')]['sort']);_0x165942[_0xe9bd('0x56')]=qs['filters'](_[_0xe9bd('0x57')](_0x43cf7d[_0xe9bd('0x4e')],_0x15da40[_0xe9bd('0x4f')]),_0x512899);if(_0x43cf7d['query'][_0xe9bd('0x58')]){_0x165942[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x165942[_0xe9bd('0x56')],{'$or':_['map'](_0x512899,function(_0x56362e){if(_0x56362e[_0xe9bd('0x47')]!=='VIRTUAL'){var _0x43c83c={};_0x43c83c[_0x56362e[_0xe9bd('0x32')]]={'$like':'%'+_0x43cf7d[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x43c83c;}})});}_0x165942=_[_0xe9bd('0x59')]({},_0x165942,_0x43cf7d[_0xe9bd('0x5a')]);var _0x373057={'where':_0x165942[_0xe9bd('0x56')]};return db[_0xe9bd('0x5b')][_0xe9bd('0x28')](_0x373057)[_0xe9bd('0x2d')](function(_0x78fab0){_0x39fb61['count']=_0x78fab0;if(_0x43cf7d['query']['includeAll']){_0x165942[_0xe9bd('0x5c')]=[{'all':!![]}];}return db['ChatWebsite'][_0xe9bd('0x5d')](_0x165942);})[_0xe9bd('0x2d')](function(_0x90db01){_0x39fb61[_0xe9bd('0x5e')]=_0x90db01;return _0x39fb61;})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x3f6f22,_0x165942))[_0xe9bd('0x22')](handleError(_0x3f6f22,null));};exports[_0xe9bd('0x5f')]=function(_0x46797c,_0x61b691){var _0x57f24e={'raw':![],'where':{'id':_0x46797c[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]},_0x242f9f={};_0x242f9f['model']=_[_0xe9bd('0x61')](db[_0xe9bd('0x5b')][_0xe9bd('0x4b')]);_0x242f9f['query']=_[_0xe9bd('0x61')](_0x46797c[_0xe9bd('0x4e')]);_0x242f9f[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x242f9f['model'],_0x242f9f['query']);_0x57f24e[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x242f9f[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x46797c['query']['fields']));_0x57f24e[_0xe9bd('0x51')]=_0x57f24e[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x57f24e[_0xe9bd('0x51')]:_0x242f9f[_0xe9bd('0x43')];if(_0x46797c[_0xe9bd('0x4e')]['includeAll']){_0x57f24e[_0xe9bd('0x5c')]=[{'all':!![]}];}_0x57f24e=_['merge']({},_0x57f24e,_0x46797c[_0xe9bd('0x5a')]);return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x57f24e)[_0xe9bd('0x2d')](handleEntityNotFound(_0x61b691,null))['then'](respondWithResult(_0x61b691,null))[_0xe9bd('0x22')](handleError(_0x61b691,null));};exports[_0xe9bd('0x63')]=function(_0x3b0190,_0x4f35c4){var _0x20731c=null;_0x3b0190[_0xe9bd('0x64')][_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x66')](_0x16b66c=>{if(_0x16b66c[_0xe9bd('0x67')]()!==''&&!wildcardUtils[_0xe9bd('0x68')](_0x16b66c[_0xe9bd('0x67')]())){_0x20731c=new APIBadRequestError('\x22'+_0x16b66c[_0xe9bd('0x67')]()+_0xe9bd('0x69'));}});if(_0x20731c){return handleError(_0x4f35c4,null)(_0x20731c);}return db[_0xe9bd('0x5b')]['create'](_0x3b0190[_0xe9bd('0x64')],{})[_0xe9bd('0x2d')](function(_0x481368){var _0x2c2d78=_0x3b0190[_0xe9bd('0x6a')]['get']({'plain':!![]});if(!_0x2c2d78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c2d78[_0xe9bd('0x6b')]===_0xe9bd('0x6a')){var _0x4ec6ec=_0x481368['get']({'plain':!![]});var _0x4a6422=_0xe9bd('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x4a6422,'userProfileId':_0x2c2d78['userProfileId']},'raw':!![]})['then'](function(_0x1fc88d){if(_0x1fc88d&&_0x1fc88d[_0xe9bd('0x6c')]===0x0){return db[_0xe9bd('0x30')]['create']({'name':_0x4ec6ec[_0xe9bd('0x32')],'resourceId':_0x4ec6ec['id'],'type':_0x1fc88d[_0xe9bd('0x32')],'sectionId':_0x1fc88d['id']},{})[_0xe9bd('0x2d')](function(){return _0x481368;});}else{return _0x481368;}})[_0xe9bd('0x22')](function(_0x5dc598){logger[_0xe9bd('0x1f')](_0xe9bd('0x6d'),_0x5dc598);throw _0x5dc598;});}return _0x481368;})[_0xe9bd('0x2d')](respondWithResult(_0x4f35c4,0xc9))['catch'](handleError(_0x4f35c4,null));};exports['update']=function(_0x3e68fb,_0x2530e1){var _0x1f41fc=null;_0x3e68fb[_0xe9bd('0x64')][_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x66')](_0x22c5ed=>{if(_0x22c5ed['trim']()!==''&&!wildcardUtils[_0xe9bd('0x68')](_0x22c5ed[_0xe9bd('0x67')]())){_0x1f41fc=new APIBadRequestError('\x22'+_0x22c5ed[_0xe9bd('0x67')]()+_0xe9bd('0x69'));}});if(_0x1f41fc){return handleError(_0x2530e1,null)(_0x1f41fc);}if(_0x3e68fb[_0xe9bd('0x64')]['id']){delete _0x3e68fb['body']['id'];}return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x3e68fb['params']['id']},'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]})['then'](handleEntityNotFound(_0x2530e1,null))[_0xe9bd('0x2d')](saveUpdates(_0x3e68fb[_0xe9bd('0x64')],null))[_0xe9bd('0x2d')](respondWithResult(_0x2530e1,null))[_0xe9bd('0x22')](handleError(_0x2530e1,null));};exports['destroy']=function(_0x3c1ab9,_0x41fb41){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x3c1ab9[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x41fb41,null))[_0xe9bd('0x2d')](removeEntity(_0x41fb41,null))[_0xe9bd('0x22')](handleError(_0x41fb41,null));};exports[_0xe9bd('0x6e')]=function(_0x466a89,_0x5e127b){return db[_0xe9bd('0x5b')][_0xe9bd('0x6e')]()[_0xe9bd('0x2d')](respondWithResult(_0x5e127b,null))[_0xe9bd('0x22')](handleError(_0x5e127b,null));};exports[_0xe9bd('0x6f')]=function(_0x8f51aa,_0x18a387){if(_0x8f51aa[_0xe9bd('0x64')]['id']){delete _0x8f51aa[_0xe9bd('0x64')]['id'];}return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x8f51aa[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x18a387,null))[_0xe9bd('0x2d')](function(_0x383e0c){if(_0x383e0c){_0x8f51aa[_0xe9bd('0x64')][_0xe9bd('0x70')]=_0x383e0c['id'];return db['Disposition'][_0xe9bd('0x63')](_0x8f51aa[_0xe9bd('0x64')]);}})['then'](respondWithResult(_0x18a387,null))[_0xe9bd('0x22')](handleError(_0x18a387,null));};exports[_0xe9bd('0x71')]=function(_0x2d86b6,_0x2083c4){var _0x242110={'raw':![],'where':{}};var _0x332228={};var _0x28331d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2d86b6[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x2083c4,null))[_0xe9bd('0x2d')](function(_0x1b863f){if(_0x1b863f){_0x332228[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0x72')]['rawAttributes']);_0x332228[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x2d86b6[_0xe9bd('0x4e')]);_0x332228[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x332228[_0xe9bd('0x43')],_0x332228[_0xe9bd('0x4e')]);_0x242110['attributes']=_['intersection'](_0x332228['model'],qs[_0xe9bd('0x52')](_0x2d86b6['query']['fields']));_0x242110['attributes']=_0x242110[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x242110[_0xe9bd('0x51')]:_0x332228[_0xe9bd('0x43')];if(!_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x242110[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x2d86b6['query'][_0xe9bd('0x2a')]);_0x242110['offset']=qs[_0xe9bd('0x29')](_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x242110[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x2d86b6['query']['sort']);_0x242110['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x2d86b6['query'],_0x332228[_0xe9bd('0x4f')]));_0x242110[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x1b863f['id'];if(_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x242110['where']=_[_0xe9bd('0x59')](_0x242110[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x242110[_0xe9bd('0x51')],function(_0x399429){var _0x1f9829={};_0x1f9829[_0x399429]={'$like':'%'+_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x1f9829;})});}_0x242110=_[_0xe9bd('0x59')]({},_0x242110,_0x2d86b6[_0xe9bd('0x5a')]);return db['Disposition']['count']({'where':_0x242110['where']})['then'](function(_0x4039c7){_0x28331d[_0xe9bd('0x28')]=_0x4039c7;if(_0x2d86b6[_0xe9bd('0x4e')]['includeAll']){_0x242110[_0xe9bd('0x5c')]=[{'all':!![]}];}return db[_0xe9bd('0x72')]['findAll'](_0x242110);})['then'](function(_0xb607c0){_0x28331d[_0xe9bd('0x5e')]=_0xb607c0;return _0x28331d;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x2083c4,_0x242110))[_0xe9bd('0x22')](handleError(_0x2083c4,null));};exports[_0xe9bd('0x75')]=function(_0x59364c,_0x5bd400){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x59364c[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5bd400,null))[_0xe9bd('0x2d')](function(_0x1880e7){if(_0x1880e7){return _0x1880e7[_0xe9bd('0x75')](_0x59364c[_0xe9bd('0x4e')][_0xe9bd('0x76')]);}})[_0xe9bd('0x2d')](respondWithStatusCode(_0x5bd400,null))[_0xe9bd('0x22')](handleError(_0x5bd400,null));};exports['addAnswer']=function(_0xb1203d,_0x5b8938){if(_0xb1203d[_0xe9bd('0x64')]['id']){delete _0xb1203d['body']['id'];}return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0xb1203d['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5b8938,null))['then'](function(_0x2efc16){if(_0x2efc16){_0xb1203d[_0xe9bd('0x64')][_0xe9bd('0x70')]=_0x2efc16['id'];return db[_0xe9bd('0x77')][_0xe9bd('0x63')](_0xb1203d[_0xe9bd('0x64')]);}})['then'](respondWithResult(_0x5b8938,null))[_0xe9bd('0x22')](handleError(_0x5b8938,null));};exports[_0xe9bd('0x78')]=function(_0x4ee8a3,_0x46461d){var _0x180117={'raw':![],'where':{}};var _0x141fe2={};var _0x59897b={'count':0x0,'rows':[]};return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x4ee8a3[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x46461d,null))[_0xe9bd('0x2d')](function(_0x48d4a2){if(_0x48d4a2){_0x141fe2[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db['CannedAnswer'][_0xe9bd('0x4b')]);_0x141fe2[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x4ee8a3[_0xe9bd('0x4e')]);_0x141fe2['filters']=_[_0xe9bd('0x50')](_0x141fe2[_0xe9bd('0x43')],_0x141fe2[_0xe9bd('0x4e')]);_0x180117[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x141fe2[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x4ee8a3['query'][_0xe9bd('0x52')]));_0x180117['attributes']=_0x180117[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x180117[_0xe9bd('0x51')]:_0x141fe2['model'];if(!_0x4ee8a3[_0xe9bd('0x4e')]['hasOwnProperty'](_0xe9bd('0x54'))){_0x180117[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x180117[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x180117[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x4ee8a3['query'][_0xe9bd('0x55')]);_0x180117[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0x4ee8a3[_0xe9bd('0x4e')],_0x141fe2[_0xe9bd('0x4f')]));_0x180117['where']['ChatWebsiteId']=_0x48d4a2['id'];if(_0x4ee8a3['query']['filter']){_0x180117[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x180117[_0xe9bd('0x56')],{'$or':_['map'](_0x180117[_0xe9bd('0x51')],function(_0x3b72cd){var _0x51fab7={};_0x51fab7[_0x3b72cd]={'$like':'%'+_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x51fab7;})});}_0x180117=_[_0xe9bd('0x59')]({},_0x180117,_0x4ee8a3[_0xe9bd('0x5a')]);return db[_0xe9bd('0x77')]['count']({'where':_0x180117[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x5cc2ff){_0x59897b['count']=_0x5cc2ff;if(_0x4ee8a3['query']['includeAll']){_0x180117[_0xe9bd('0x5c')]=[{'all':!![]}];}return db[_0xe9bd('0x77')][_0xe9bd('0x5d')](_0x180117);})[_0xe9bd('0x2d')](function(_0x4d9cfa){_0x59897b['rows']=_0x4d9cfa;return _0x59897b;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x46461d,_0x180117))[_0xe9bd('0x22')](handleError(_0x46461d,null));};exports[_0xe9bd('0x7a')]=function(_0x4ee46c,_0x220f1f){return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x4ee46c['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x220f1f,null))[_0xe9bd('0x2d')](function(_0x346da7){if(_0x346da7){return _0x346da7[_0xe9bd('0x7a')](_0x4ee46c[_0xe9bd('0x4e')][_0xe9bd('0x76')]);}})[_0xe9bd('0x2d')](respondWithStatusCode(_0x220f1f,null))[_0xe9bd('0x22')](handleError(_0x220f1f,null));};exports[_0xe9bd('0x7b')]=function(_0x47f09c,_0x3484df){_0x47f09c[_0xe9bd('0x64')][_0xe9bd('0x7c')]=_0x47f09c[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x47f09c[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x3484df,null))[_0xe9bd('0x2d')](saveUpdates(_0x47f09c['body'],null))[_0xe9bd('0x2d')](respondWithResult(_0x3484df,null))[_0xe9bd('0x22')](handleError(_0x3484df,null));};exports['addAvatar']=function(_0x343479,_0x2c4665){_0x343479['body'][_0xe9bd('0x7f')]=_0x343479[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x343479[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x2c4665,null))['then'](saveUpdates(_0x343479[_0xe9bd('0x64')],null))[_0xe9bd('0x2d')](respondWithResult(_0x2c4665,null))[_0xe9bd('0x22')](handleError(_0x2c4665,null));};exports['addCustomerAvatar']=function(_0x1454e5,_0x23ee4e){_0x1454e5[_0xe9bd('0x64')][_0xe9bd('0x80')]=_0x1454e5[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x1454e5[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x23ee4e,null))[_0xe9bd('0x2d')](saveUpdates(_0x1454e5['body'],null))[_0xe9bd('0x2d')](respondWithResult(_0x23ee4e,null))['catch'](handleError(_0x23ee4e,null));};exports['addSystemAvatar']=function(_0x4e1eb8,_0x1939ed){_0x4e1eb8['body']['systemAvatar']=_0x4e1eb8[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x4e1eb8[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x1939ed,null))['then'](saveUpdates(_0x4e1eb8[_0xe9bd('0x64')],null))['then'](respondWithResult(_0x1939ed,null))['catch'](handleError(_0x1939ed,null));};exports[_0xe9bd('0x81')]=function(_0x1771b1,_0x3b14dc){var _0x4fa1e1=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x84'));var _0x5ebe24={'where':{'id':_0x1771b1[_0xe9bd('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x573640=![];return require(_0xe9bd('0x85'))[_0xe9bd('0x86')]()[_0xe9bd('0x2d')](function(_0x3d168b){if(_0x3d168b){_0x573640=_0x3d168b[_0xe9bd('0x87')];}})['then'](function(){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x5ebe24);})[_0xe9bd('0x2d')](handleEntityNotFound(_0x3b14dc,null))[_0xe9bd('0x2d')](function(_0x351fcd){if(_0x351fcd){if(!_[_0xe9bd('0x88')](_0x351fcd['sitepic'])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8a'),_0x351fcd[_0xe9bd('0x7c')]))&&_0x573640){_0x4fa1e1=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8a'),_0x351fcd[_0xe9bd('0x7c')]);}}return _0x3b14dc['download'](_0x4fa1e1);}})[_0xe9bd('0x22')](handleError(_0x3b14dc,null));};exports[_0xe9bd('0x8b')]=function(_0x316022,_0x1e63d3){var _0x5befe7=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8c'));var _0xcee066={'where':{'id':_0x316022[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x7f')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0xcee066)[_0xe9bd('0x2d')](handleEntityNotFound(_0x1e63d3,null))['then'](function(_0x2fa992){if(_0x2fa992){if(!_[_0xe9bd('0x88')](_0x2fa992[_0xe9bd('0x7f')])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8d'),_0x2fa992['agentAvatar']))){_0x5befe7=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8d'),_0x2fa992[_0xe9bd('0x7f')]);}}return _0x1e63d3[_0xe9bd('0x8e')](_0x5befe7);}})[_0xe9bd('0x22')](handleError(_0x1e63d3,null));};exports[_0xe9bd('0x8f')]=function(_0x2b8645,_0x5bf65b){var _0x33b1fe=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],'server/files/images/avatars/customer_avatar.png');var _0x457536={'where':{'id':_0x2b8645[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x80'),_0xe9bd('0x90')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x457536)[_0xe9bd('0x2d')](handleEntityNotFound(_0x5bf65b,null))[_0xe9bd('0x2d')](function(_0x20a8ce){if(_0x20a8ce){if(!_[_0xe9bd('0x88')](_0x20a8ce['customerAvatar'])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],'server/files/images/avatars/',_0x20a8ce[_0xe9bd('0x80')]))&&_0x20a8ce[_0xe9bd('0x90')]){_0x33b1fe=path[_0xe9bd('0x82')](config['root'],'server/files/images/avatars/',_0x20a8ce[_0xe9bd('0x80')]);}}return _0x5bf65b[_0xe9bd('0x8e')](_0x33b1fe);}})[_0xe9bd('0x22')](handleError(_0x5bf65b,null));};exports[_0xe9bd('0x91')]=function(_0x25ee5d,_0x464102){var _0xc57d62=path['join'](config[_0xe9bd('0x83')],_0xe9bd('0x92'));var _0x4cdea7={'where':{'id':_0x25ee5d[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x93')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x4cdea7)[_0xe9bd('0x2d')](handleEntityNotFound(_0x464102,null))[_0xe9bd('0x2d')](function(_0x428a2e){if(_0x428a2e){if(!_[_0xe9bd('0x88')](_0x428a2e[_0xe9bd('0x93')])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8d'),_0x428a2e[_0xe9bd('0x93')]))){_0xc57d62=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8d'),_0x428a2e[_0xe9bd('0x93')]);}}return _0x464102[_0xe9bd('0x8e')](_0xc57d62);}})[_0xe9bd('0x22')](handleError(_0x464102,null));};function checkWebsiteInterval(_0x217eff){var _0x552d2a=_0x217eff[_0xe9bd('0x94')];if(!_0x552d2a){return Promise[_0xe9bd('0x95')](_0x217eff);}var _0x1eeb25=_0x217eff[_0xe9bd('0x96')]||undefined;return _0x552d2a[_0xe9bd('0x97')](_0x1eeb25)[_0xe9bd('0x2d')](function(_0x1b40a8){if(!_0x1b40a8){throw new APIOutOfIntervalError();}return _0x217eff;});}exports[_0xe9bd('0x98')]=function(_0x3c1785,_0xab57a8){var _0x2a8861={'body':_0x3c1785[_0xe9bd('0x64')],'channel':_0xe9bd('0x99')};var _0x5953ca=[];var _0x1412ed=[];var _0x3acd14={};var _0x1f6f2e=![];if(_0x3c1785[_0xe9bd('0x64')]['id']){delete _0x3c1785[_0xe9bd('0x64')]['id'];}if(_[_0xe9bd('0x88')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9a')])){throw new APIBadRequestError(_0xe9bd('0x9b'));}if(_[_0xe9bd('0x88')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9c')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xe9bd('0x9d')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x64')])){throw new APIBadRequestError(_0xe9bd('0x9e'));}var _0x1958fa=_0x3c1785['body'][_0xe9bd('0x36')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x3d')];return db['CmContact'][_0xe9bd('0x6e')]()[_0xe9bd('0x2d')](function(_0x496640){if(!_0x496640){throw new Error('No\x20available\x20attributes');}_0x5953ca=Object['keys'](_0x496640)[_0xe9bd('0x58')](function(_0x46017e){return!['createdAt',_0xe9bd('0x9f')][_0xe9bd('0xa0')](_0x46017e);});_0x1412ed=Object[_0xe9bd('0x61')](_0x496640)['filter'](function(_0x15ad87){return![_0xe9bd('0xa1'),_0xe9bd('0x9f'),_0xe9bd('0xa2'),'ListId'][_0xe9bd('0xa0')](_0x15ad87);});if(!_[_0xe9bd('0xa0')](_0x1412ed,_0x3c1785['body'][_0xe9bd('0x9c')])){throw new APIBadRequestError(_0xe9bd('0xa3')+_0x1412ed[_0xe9bd('0x82')](',\x20'));}_0x3acd14[_0x3c1785[_0xe9bd('0x64')]['mapKey']]=_0x3c1785['body']['from'];})[_0xe9bd('0x2d')](function(){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x3c1785[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0xa4')],'as':_0xe9bd('0xa5'),'include':[{'model':db[_0xe9bd('0xa6')],'as':_0xe9bd('0xa7'),'where':_0x3acd14,'limit':0x1,'order':[['updatedAt',_0xe9bd('0xa8')]]}]},{'model':db[_0xe9bd('0xa9')],'as':_0xe9bd('0xaa')},{'model':db[_0xe9bd('0x94')],'as':_0xe9bd('0x94'),'include':[{'model':db[_0xe9bd('0x94')],'as':_0xe9bd('0xab'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xe9bd('0x2d')](function(_0x40abfd){if(!_0x40abfd){throw new APINotFoundError(util[_0xe9bd('0x45')](_0xe9bd('0xac'),_0x3c1785['params']['id']));}if(_0x1958fa){return checkWebsiteInterval(_0x40abfd);}return _0x40abfd;})[_0xe9bd('0x2d')](function(_0x16ff7b){_0x2a8861[_0xe9bd('0xad')]=_0x16ff7b;_0x2a8861[_0xe9bd('0xae')]=_[_0xe9bd('0xaf')](_0x16ff7b[_0xe9bd('0xaa')],[_0xe9bd('0xb0')],[_0xe9bd('0xb1')]);if(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xaa')]){delete _0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xaa')];}_0x2a8861[_0xe9bd('0xb2')]=_0x16ff7b['List']||{'id':_0x16ff7b[_0xe9bd('0xb3')]};if(_0x2a8861[_0xe9bd('0xb2')]&&_0x2a8861['list'][_0xe9bd('0xa7')][_0xe9bd('0x53')]){return _0x2a8861[_0xe9bd('0xb2')]['Contacts'][0x0];}var _0x29d6c9=_[_0xe9bd('0x12')](_0x3c1785[_0xe9bd('0x64')],{'firstName':_0x3c1785[_0xe9bd('0x64')]['from'],'ListId':_0x16ff7b[_0xe9bd('0xb3')]});_0x29d6c9[_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9c')]]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9a')];return db[_0xe9bd('0xa6')]['create'](_0x29d6c9,{'fields':_0x5953ca,'raw':!![]});})[_0xe9bd('0x2d')](function(_0x55d50f){_0x2a8861['contact']=_0x55d50f;var _0x3fc20a=createInteractionObject(_0x3c1785['params']['id'],_0x3c1785[_0xe9bd('0x64')],_0x3c1785['headers'],_0x55d50f);var _0x2febfb={'ChatWebsiteId':_0x3c1785[_0xe9bd('0x60')]['id']};if(_0x3c1785['body'][_0xe9bd('0xb4')]){_0x2febfb[_0xe9bd('0xb4')]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb4')];_0x2febfb[_0xe9bd('0xb5')]=![];return db[_0xe9bd('0xb6')][_0xe9bd('0x62')]({'where':_0x2febfb})['then'](function(_0x23be6d){var _0x1e8c01=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x36')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x3d')];if(_0x23be6d){_0x1f6f2e=!![];return _0x23be6d;}else if(!_0x1e8c01&&_0x23be6d&&_0x23be6d['closed']){throw new APIConflictError(_0xe9bd('0xb7'));}_0x3fc20a[_0xe9bd('0xb4')]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb4')];_0x3fc20a[_0xe9bd('0xb8')]=_0x3c1785['body']['externalUrl'];return db['ChatInteraction'][_0xe9bd('0x63')](_0x3fc20a);});}_0x2febfb['ContactId']=_0x55d50f['id'];if(_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb9')]&&_0x3c1785['body'][_0xe9bd('0xb9')]['id']){_0x2febfb['id']=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb9')]['id'];return db[_0xe9bd('0xb6')][_0xe9bd('0x62')]({'where':_0x2febfb})[_0xe9bd('0x2d')](function(_0x914313){var _0x54eeed=_0x3c1785['body'][_0xe9bd('0x36')]&&_0x3c1785['body']['referer'];if(!_0x54eeed&&_0x914313&&_0x914313[_0xe9bd('0xb5')]){throw new APIConflictError(_0xe9bd('0xb7'));}else if(_0x914313){_0x1f6f2e=!![];return _0x914313;}else{return db[_0xe9bd('0xb6')][_0xe9bd('0x63')](_0x3fc20a);}});}return db[_0xe9bd('0xb6')][_0xe9bd('0x63')](_0x3fc20a);})[_0xe9bd('0x2d')](function(_0x4339cd){if(!_0x1f6f2e){return _0x4339cd;}var _0xe55ad1={'from':(_0x2a8861[_0xe9bd('0xba')][_0xe9bd('0x3a')]||'')+'\x20'+(_0x2a8861['contact'][_0xe9bd('0x3b')]||'')};if(_0x3c1785['body'][_0xe9bd('0xb4')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xbb')]&&_0x3c1785[_0xe9bd('0x64')]['threadId']!=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xbb')]){_0xe55ad1[_0xe9bd('0xb4')]=_0x3c1785['body']['messageId'];}return _0x4339cd[_0xe9bd('0xbc')](_0xe55ad1);})[_0xe9bd('0x2d')](function(_0x6e1fd3){_0x2a8861[_0xe9bd('0xb9')]=_0x6e1fd3[_0xe9bd('0x2e')]({'plain':!![]});_0x2a8861[_0xe9bd('0xb9')]['created']=!_0x1f6f2e;if(_0x2a8861[_0xe9bd('0xb9')][_0xe9bd('0xbd')]){if(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xbe')]){_0x2a8861['applications'][_0xe9bd('0xbf')]({'id':0x0,'priority':_0x2a8861[_0xe9bd('0xae')][_0xe9bd('0x53')]+0x1,'app':'close','appdata':_0xe9bd('0xc0'),'interval':_0xe9bd('0xc1')});}}return db[_0xe9bd('0xc2')][_0xe9bd('0x63')]({'body':_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x64')],'ChatWebsiteId':_0x3c1785[_0xe9bd('0x60')]['id'],'ChatInteractionId':_0x6e1fd3['id'],'direction':'in','ContactId':_0x2a8861['contact']['id'],'AttachmentId':_0x3c1785['body'][_0xe9bd('0xc3')]});})[_0xe9bd('0x2d')](function(_0x1e6b83){_0x2a8861['message']=_0x1e6b83;if(!_0x2a8861['interaction'][_0xe9bd('0xc4')]){return;}return db[_0xe9bd('0xc5')][_0xe9bd('0x62')]({'attributes':['id','name'],'where':{'id':_0x2a8861[_0xe9bd('0xb9')]['UserId']}});})[_0xe9bd('0x2d')](function(_0xe52e79){if(_0xe52e79){_0x2a8861[_0xe9bd('0xae')][_0xe9bd('0xc6')]({'id':0x0,'priority':0x0,'app':_0xe9bd('0xc7'),'appdata':_0xe52e79[_0xe9bd('0x32')]+','+(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xc8')]||0xa),'interval':_0xe9bd('0xc1')});_0x2a8861['forcedOwnership']=!![];}if(!_0x2a8861['interaction'][_0xe9bd('0xc9')]){return;}return db[_0xe9bd('0xca')][_0xe9bd('0x62')]({'attributes':['id',_0xe9bd('0x32')],'where':{'id':_0x2a8861[_0xe9bd('0xb9')][_0xe9bd('0xc9')]}});})[_0xe9bd('0x2d')](function(_0xdfc5ca){if(_0xdfc5ca){_0x2a8861['applications'][_0xe9bd('0xc6')]({'id':0x0,'priority':0x1,'app':_0xe9bd('0xcb'),'appdata':_0xdfc5ca['name']+','+(_0x2a8861[_0xe9bd('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0xe9bd('0xc1')});}return respondWithRpcPromise(_0xe9bd('0xcc'),_0xe9bd('0xcd'),_0x2a8861);})['then'](function(_0x4c7419){respondWithRpcPromise(_0xe9bd('0xce'),'EventManager',{'event':_0xe9bd('0x98'),'message':_0x4c7419},client9002);return _0x4c7419;})[_0xe9bd('0x2d')](respondWithResult(_0xab57a8,null))[_0xe9bd('0x22')](APIHandleError(_0xab57a8));};exports[_0xe9bd('0xcf')]=function(_0x2256c2,_0x4eb22e){var _0x3000a9,_0x2648bd,_0x993518;var _0x2c9342=[];var _0x30c3ed={};var _0x156dfc=_0x2256c2['files']||[];var _0x39e8e5=[];var _0x5a2edb;return db[_0xe9bd('0xa6')]['describe']()[_0xe9bd('0x2d')](function(_0x1ec28e){if(!_0x1ec28e){throw new db['Sequelize'][(_0xe9bd('0xd0'))](_0xe9bd('0xd1'));}_0x2c9342=_['difference'](_[_0xe9bd('0x61')](_0x1ec28e),['createdAt','updatedAt','CompanyId',_0xe9bd('0xb3')]);if(_0x2256c2[_0xe9bd('0x64')]['id']){delete _0x2256c2['body']['id'];}if(_['isNil'](_0x2256c2[_0xe9bd('0x64')]['from'])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db['Sequelize'][(_0xe9bd('0xd0'))](_0xe9bd('0xd2')));}if(_[_0xe9bd('0x88')](_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')])||_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')]===''){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))](_0xe9bd('0xd4')));}if(_[_0xe9bd('0x88')](_0x2256c2['body'][_0xe9bd('0xd5')])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c9342));}if(!_[_0xe9bd('0xa0')](_0x2c9342,_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c9342));}_0x30c3ed[_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')]]=_0x2256c2['body'][_0xe9bd('0x9a')];})[_0xe9bd('0x2d')](function(){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')]({'where':{'id':_0x2256c2[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0xa4')],'as':_0xe9bd('0xa5')},{'model':db[_0xe9bd('0xd6')],'as':'MailAccount'}]});})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4eb22e,null))[_0xe9bd('0x2d')](function(_0x381ad4){if(_0x381ad4&&_0x381ad4['List']){_0x2648bd=_0x381ad4;var _0x351200=_[_0xe9bd('0x12')](_0x2256c2['body'],{'firstName':_0x2256c2['body'][_0xe9bd('0x9a')],'phone':_0x2256c2['body'][_0xe9bd('0x9a')],'ListId':_0x381ad4[_0xe9bd('0xb3')]});_0x351200[_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')]]=_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x9a')];return db[_0xe9bd('0xa6')][_0xe9bd('0xd7')]({'where':_0x30c3ed,'defaults':_0x351200});}})['spread'](function(_0x199b78){if(_0x199b78){_0x993518=_0x199b78;var _0x418136=fs[_0xe9bd('0xd8')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xd9')),'utf8');var _0x29ead4=ejs[_0xe9bd('0xda')](_0x418136,{'body':_[_0xe9bd('0xdb')](_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')]),'bodyTitle':_0x2648bd[_0xe9bd('0xdc')]});return db[_0xe9bd('0xdd')][_0xe9bd('0x63')]({'body':_0x29ead4,'plainBody':htmlToText['fromString'](_0x29ead4),'ContactId':_0x199b78['id'],'ChatWebsiteId':_0x2648bd['id']});}})['then'](function(_0x332b06){_0x5a2edb=_0x332b06;if(_0x156dfc[_0xe9bd('0x53')]){var _0x423da1=_0x156dfc[_0xe9bd('0x4a')](function(_0x2db8f4){return{'name':_0x2db8f4[_0xe9bd('0xde')],'basename':_0x2db8f4[_0xe9bd('0x7e')],'type':_0x2db8f4[_0xe9bd('0xdf')],'ChatOfflineMessageId':_0x332b06['id']};});_0x39e8e5=_0x423da1[_0xe9bd('0x4a')](_0x2301ce=>{var _0x4a781d={'filename':_0x2301ce[_0xe9bd('0x32')],'path':path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xe0'),_0xe9bd('0xe1'),_0xe9bd('0xe2'),_0xe9bd('0xe3'),_0x2301ce['basename'])};return _0x4a781d;});if(!_0x2648bd[_0xe9bd('0xe4')]){return db[_0xe9bd('0xe5')][_0xe9bd('0xe6')](function(_0x23b222){return db[_0xe9bd('0xe7')]['bulkCreate'](_0x423da1,{'transaction':_0x23b222});});}}})[_0xe9bd('0x2d')](function(){if(_0x5a2edb){_0x3000a9=_0x5a2edb;return db[_0xe9bd('0xd6')][_0xe9bd('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0xe9bd('0xe8')],'as':_0xe9bd('0xe9'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe9bd('0xea'),'raw':!![]}]}]});}})['then'](function(_0x34ae3d){if(_0x34ae3d&&_0x34ae3d[_0xe9bd('0xe9')]&&_0x2648bd[_0xe9bd('0xeb')]&&_0x2648bd['forwardOfflineAddress']){var _0x5b3190=_0x34ae3d[_0xe9bd('0xec')]();return respondWithRpcPromise(_0xe9bd('0xed'),_0xe9bd('0xee'),{'account':_0x5b3190,'message':{'from':util['format'](_0xe9bd('0xef'),_0x34ae3d[_0xe9bd('0x32')],_0x34ae3d[_0xe9bd('0xf0')]||_0x34ae3d[_0xe9bd('0xe9')][_0xe9bd('0x6a')]),'to':_0x2648bd[_0xe9bd('0xf1')],'subject':_0x2648bd[_0xe9bd('0xf2')],'html':_0x3000a9[_0xe9bd('0x64')],'attachments':_0x39e8e5}},client9003)[_0xe9bd('0x2d')](function(){return _0x3000a9;})[_0xe9bd('0x22')](function(_0x1bae64){logger[_0xe9bd('0x1f')](_0x1bae64);});}})[_0xe9bd('0x2d')](function(){if(_0x2648bd&&_0x2648bd[_0xe9bd('0xe4')]&&_0x2648bd['MailAccountId']){var _0x3fe9ca=[];if(_0x156dfc[_0xe9bd('0x53')]){_0x3fe9ca=_0x156dfc['map'](function(_0x94a906){return{'name':_0x94a906[_0xe9bd('0xde')],'basename':_0x94a906[_0xe9bd('0x7e')],'type':_0x94a906[_0xe9bd('0xdf')],'ChatOfflineMessageId':_0x5a2edb['id']};});}var _0x52e35a;if(!_[_0xe9bd('0x88')](_0x2648bd[_0xe9bd('0xf3')])){var _0x287fab=_[_0xe9bd('0x4a')](_0x2256c2[_0xe9bd('0x64')],function(_0x4c25cb){return _0x4c25cb;});var _0x3107f0=_['toPairsIn'](_0x287fab)[0x0];var _0xc162df=_[_0xe9bd('0xf4')](_0x3107f0,function(_0x8f8874){return _0x8f8874;});_0x52e35a=_0xc162df[0x1][_0x2648bd[_0xe9bd('0xf3')]];}var _0x240cd0={'from':_0x993518['email'],'firstName':_0x993518[_0xe9bd('0x3a')],'lastName':_0x993518[_0xe9bd('0x3b')],'mapKey':_0xe9bd('0xf0'),'message':{'from':_0x993518[_0xe9bd('0xf0')],'to':_0x2648bd[_0xe9bd('0xd6')][_0xe9bd('0xf0')],'cc':'','subject':_[_0xe9bd('0x88')](_0x52e35a)?_0x2648bd['offlineMessageSubject']:_0x52e35a,'messageId':'','sentAt':new Date(),'attach':_0x3fe9ca[_0xe9bd('0x53')],'attachments':_0x3fe9ca,'originChannel':_0xe9bd('0xf5'),'ChatWebsiteId':_0x2648bd['id'],'ChatOfflineMessageId':_0x3000a9['id'],'originTo':_0x2648bd[_0xe9bd('0xd6')][_0xe9bd('0xf0')]},'body':_0x3000a9[_0xe9bd('0x64')]};var _0x5f3e76={'account':{'id':_0x2648bd[_0xe9bd('0xf6')]},'body':_0x240cd0,'log':_0xe9bd('0xf7')};return respondWithRpcPromise(_0xe9bd('0xf7'),_0xe9bd('0xf8'),_0x5f3e76,client9001)[_0xe9bd('0x2d')](function(){return _0x3000a9;})[_0xe9bd('0x22')](function(_0xe79615){logger[_0xe9bd('0x1f')](_0xe79615);});}return;})[_0xe9bd('0x2d')](function(){if(_0x3000a9){return _0x3000a9;}})[_0xe9bd('0x2d')](respondWithResult(_0x4eb22e,null))[_0xe9bd('0x22')](function(){for(var _0x3a563a of _0x156dfc){var _0x11461a=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xe0'),_0xe9bd('0xe1'),_0xe9bd('0xe2'),_0xe9bd('0xe3'),_0x3a563a[_0xe9bd('0x7e')]);fs_extra['remove'](_0x11461a)[_0xe9bd('0x22')](function(_0x1189fb){logger[_0xe9bd('0x1f')](_0xe9bd('0xf9'),_0x11461a,_0x1189fb);});}});};exports['addInteraction']=function(_0x28756c,_0x5e04d5){return db['ChatInteraction']['find']({'where':{'id':_0x28756c['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5e04d5,null))[_0xe9bd('0x2d')](function(_0x950ca7){if(_0x950ca7){return _0x950ca7['addInteraction'](_0x28756c[_0xe9bd('0x64')]['ids'],_[_0xe9bd('0xfa')](_0x28756c[_0xe9bd('0x64')],['ids','id'])||{});}})[_0xe9bd('0x2d')](respondWithResult(_0x5e04d5,null))['catch'](handleError(_0x5e04d5,null));};exports['getInteractions']=function(_0x237de3,_0x3a1813){var _0x1ae682={'raw':![],'where':{}};var _0x58ca5e={};var _0x2c1177={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe9bd('0x79')]({'where':{'id':_0x237de3['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x3a1813,null))[_0xe9bd('0x2d')](function(_0x38aa10){if(_0x38aa10){_0x58ca5e['model']=_[_0xe9bd('0x61')](db['ChatInteraction'][_0xe9bd('0x4b')]);_0x58ca5e[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x237de3[_0xe9bd('0x4e')]);_0x58ca5e[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x58ca5e[_0xe9bd('0x43')],_0x58ca5e[_0xe9bd('0x4e')]);_0x1ae682[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x58ca5e[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x1ae682[_0xe9bd('0x51')]=_0x1ae682[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x1ae682[_0xe9bd('0x51')]:_0x58ca5e[_0xe9bd('0x43')];if(!_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x73')]('nolimit')){_0x1ae682[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x237de3['query'][_0xe9bd('0x2a')]);_0x1ae682[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x1ae682['order']=qs[_0xe9bd('0x55')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x1ae682[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x237de3[_0xe9bd('0x4e')],_0x58ca5e[_0xe9bd('0x4f')]));_0x1ae682[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x38aa10['id'];if(_0x237de3['query'][_0xe9bd('0x58')]){_0x1ae682[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x1ae682[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x1ae682[_0xe9bd('0x51')],function(_0x46f48b){var _0x44403c={};_0x44403c[_0x46f48b]={'$like':'%'+_0x237de3['query'][_0xe9bd('0x58')]+'%'};return _0x44403c;})});}_0x1ae682=_[_0xe9bd('0x59')]({},_0x1ae682,_0x237de3[_0xe9bd('0x5a')]);return db[_0xe9bd('0xb6')]['count']({'where':_0x1ae682[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x298c03){_0x2c1177[_0xe9bd('0x28')]=_0x298c03;if(_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfb')]){_0x1ae682[_0xe9bd('0x5c')]=[{'model':db[_0xe9bd('0xa6')],'as':'Contact','required':![]},{'model':db[_0xe9bd('0xc5')],'as':'Owner','attributes':['name','fullname',_0xe9bd('0xfc')],'required':![]},{'model':db['Tag'],'as':_0xe9bd('0xfd'),'attributes':['id','name','color'],'where':_0x237de3[_0xe9bd('0x4e')]['tag']?{'id':_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfe')]}:undefined,'required':_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfe')]?!![]:![]}];}return db[_0xe9bd('0xb6')][_0xe9bd('0x5d')](_0x1ae682);})['then'](function(_0x379afa){_0x2c1177[_0xe9bd('0x5e')]=_0x379afa;return _0x2c1177;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x3a1813,_0x1ae682))['catch'](handleError(_0x3a1813,null));};exports[_0xe9bd('0xff')]=function(_0x3c0224,_0x513d7e){var _0x364dc2=0x0;var _0x3da15a=0x0;var _0x44af86=![];var _0x794246;var _0x415fdf;return db['ChatWebsite']['find']({'where':{'id':_0x3c0224[_0xe9bd('0x60')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0xe9bd('0xab'),'attributes':['id',_0xe9bd('0x100')]}]}]})[_0xe9bd('0x2d')](handleEntityNotFound(_0x513d7e,null))[_0xe9bd('0x2d')](function(_0xeb2582){if(_0xeb2582){_0x794246=_0xeb2582;return _0xeb2582[_0xe9bd('0x101')]({'raw':!![]});}})[_0xe9bd('0x2d')](function(_0x49077e){if(_0x794246){if(_0x49077e){_0x415fdf=_0x49077e;}}return require(_0xe9bd('0x85'))[_0xe9bd('0x86')]();})[_0xe9bd('0x2d')](function(_0x5e2013){if(_0x5e2013){_0x3da15a=_0x5e2013[_0xe9bd('0x102')];_0x44af86=_0x5e2013[_0xe9bd('0x87')];}})[_0xe9bd('0x2d')](function(){return db['ChatInteraction'][_0xe9bd('0x28')]({'where':{'closed':![]}});})[_0xe9bd('0x2d')](function(_0xbf887){_0x364dc2=_0xbf887;if(_0x3da15a&&_0xbf887>_0x3da15a){return db['License'][_0xe9bd('0x79')]({'where':{'id':0x1}})[_0xe9bd('0x2d')](function(_0xfe63bf){if(_0xfe63bf){_0xfe63bf[_0xe9bd('0x103')]('chatLicenseExceeded');}});}})[_0xe9bd('0x2d')](function(){var _0x3988df=_0x794246[_0xe9bd('0x94')];var _0x1628d4=_0x794246['timezone']||undefined;return _0x3988df?_0x3988df[_0xe9bd('0x97')](_0x1628d4):!![];})[_0xe9bd('0x2d')](function(_0x3262b5){var _0x13f1d7=fs[_0xe9bd('0xd8')](path['join'](config[_0xe9bd('0x83')],_0xe9bd('0x104')),_0xe9bd('0x105'));var _0x34d333='3.10.1';var _0xc7c9a8=![];var _0x3d7e87,_0x225a35;if(_0x3c0224[_0xe9bd('0x106')]['referer']){_0x3d7e87=new URL(_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x3d')])[_0xe9bd('0x107')];}else if(_0x3c0224[_0xe9bd('0x106')]['origin']){_0x3d7e87=new URL(_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x107')])[_0xe9bd('0x107')];}else{_0x3d7e87=_0xe9bd('0x108');}_0x225a35=typeof _0x794246[_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x62')](function(_0x3f44d9){return wildcardUtils['testWebsiteWithWildcard'](_0x3f44d9,_0x3d7e87);})!==_0xe9bd('0x27');var _0xb835d7={'chatVersion':_0x34d333,'chatWebsiteAddressOrigin':_0x225a35?_0x3d7e87:_0x794246[_0xe9bd('0x65')],'remote':_0x794246[_0xe9bd('0x109')],'query':querystring['stringify'](_[_0xe9bd('0x59')](_0x794246[_0xe9bd('0x2e')]({'plain':!![]}),{'customerIp':_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x38')]||_0x3c0224['headers']['x-real-ip']||_0x3c0224[_0xe9bd('0x10a')]['remoteAddress']||_0x3c0224['ip'],'referer':_0x3c0224['headers'][_0xe9bd('0x3d')],'openedInteractions':_0x364dc2,'maxInteractions':_0x3da15a,'virtual':_0x44af86['virtual'],'online':_0x3262b5,'custom':_0x44af86,'address':_0x225a35?_0x3d7e87:null}))[_0xe9bd('0x10b')](/'/g,'\x5c\x27')};_0x513d7e[_0xe9bd('0x33')](ejs[_0xe9bd('0xda')](Mustache[_0xe9bd('0xda')](_0x13f1d7,_0xb835d7),{'proactiveActions':_0x415fdf,'alignment':_0x794246[_0xe9bd('0x10c')],'verticalAlignment':_0x794246[_0xe9bd('0x10d')],'div_color':_0x794246[_0xe9bd('0x10e')],'labelText':_0x794246[_0xe9bd('0x10f')],'text_color':_0x794246[_0xe9bd('0x110')],'text_button_color':_0x794246[_0xe9bd('0x111')],'button_color':_0x794246[_0xe9bd('0x112')],'background_color':_0x794246[_0xe9bd('0x113')],'hideWhenOffline':_0x794246[_0xe9bd('0x114')],'intervalId':_0x794246[_0xe9bd('0x115')],'isDevelopment':_0xc7c9a8,'chatVersion':_0x34d333}));})[_0xe9bd('0x22')](handleError(_0x513d7e,null));};exports[_0xe9bd('0x116')]=function(_0x52ffd7,_0x38c5d6){var _0x3a801e=_0x52ffd7[_0xe9bd('0x60')]['id'];var _0x367e1f=_0x52ffd7[_0xe9bd('0x64')];var _0x4f9ce9=0xc8;var _0x13076f=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe9bd('0xe5')][_0xe9bd('0x117')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5029a4){return db[_0xe9bd('0x5b')]['findOne']({'where':{'id':_0x3a801e},'transaction':_0x5029a4})['then'](function(_0x22a1fe){if(_0x22a1fe){return db['ChatApplication'][_0xe9bd('0x31')]({'where':{'ChatWebsiteId':_0x3a801e},'transaction':_0x5029a4})[_0xe9bd('0x2d')](function(){var _0x17907b=_[_0xe9bd('0x4a')](_0x367e1f,function(_0x54a544){_0x54a544[_0xe9bd('0x70')]=_0x3a801e;return _0x54a544;});return db[_0xe9bd('0xa9')][_0xe9bd('0x118')](_0x17907b,{'transaction':_0x5029a4});});}else{_0x4f9ce9=0x194;_0x13076f=[];}});})[_0xe9bd('0x2d')](function(){if(_0x4f9ce9!==0x194){return db[_0xe9bd('0xa9')][_0xe9bd('0x119')]({'where':{'ChatWebsiteId':_0x3a801e},'order':_0xe9bd('0xb0')})['then'](function(_0x51801a){_0x13076f=_0x51801a;});}})['catch'](function(_0x57bb20){_0x4f9ce9=0x1f4;logger[_0xe9bd('0x1f')](_0x57bb20[_0xe9bd('0x11a')]);if(_0x57bb20[_0xe9bd('0x32')]){delete _0x57bb20[_0xe9bd('0x32')];}_0x13076f=_0x57bb20;})[_0xe9bd('0x11b')](function(){if(_0x13076f===null){_0x38c5d6[_0xe9bd('0x23')](_0x4f9ce9);}else{if(_0x4f9ce9===0x1f4){_0x38c5d6[_0xe9bd('0x25')](_0x4f9ce9)[_0xe9bd('0x33')](_0x13076f);}else{_0x38c5d6['status'](_0x4f9ce9)[_0xe9bd('0x26')](_0x13076f);}}});};exports[_0xe9bd('0x11c')]=function(_0x2dcbb5,_0x34c059){var _0x16b9ff={};var _0x6fafa8={};var _0x510de3;var _0x1a68ff;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x2dcbb5[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x34c059,null))['then'](function(_0x5344b2){if(_0x5344b2){_0x510de3=_0x5344b2;_0x6fafa8[_0xe9bd('0x43')]=_['keys'](db[_0xe9bd('0xa9')][_0xe9bd('0x4b')]);_0x6fafa8[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x2dcbb5[_0xe9bd('0x4e')]);_0x6fafa8[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x6fafa8[_0xe9bd('0x43')],_0x6fafa8['query']);_0x16b9ff[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x6fafa8[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x16b9ff[_0xe9bd('0x51')]=_0x16b9ff['attributes'][_0xe9bd('0x53')]?_0x16b9ff[_0xe9bd('0x51')]:_0x6fafa8[_0xe9bd('0x43')];_0x16b9ff[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x2dcbb5['query'][_0xe9bd('0x55')]);_0x16b9ff[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0x2dcbb5['query'],_0x6fafa8[_0xe9bd('0x4f')]));if(_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x16b9ff[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x16b9ff['where'],{'$or':_[_0xe9bd('0x4a')](_0x16b9ff[_0xe9bd('0x51')],function(_0x230dc3){var _0x293858={};_0x293858[_0x230dc3]={'$like':'%'+_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x293858;})});}_0x16b9ff=_[_0xe9bd('0x59')]({},_0x16b9ff,_0x2dcbb5[_0xe9bd('0x5a')]);return _0x510de3[_0xe9bd('0x11c')](_0x16b9ff);}})['then'](function(_0x3ebd5d){if(_0x3ebd5d){_0x1a68ff=_0x3ebd5d[_0xe9bd('0x53')];if(!_0x2dcbb5['query'][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x16b9ff[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x2dcbb5['query'][_0xe9bd('0x2a')]);_0x16b9ff['offset']=qs[_0xe9bd('0x29')](_0x2dcbb5[_0xe9bd('0x4e')]['offset']);}return _0x510de3[_0xe9bd('0x11c')](_0x16b9ff);}})[_0xe9bd('0x2d')](function(_0x2eb64d){if(_0x2eb64d){return _0x2eb64d?{'count':_0x1a68ff,'rows':_0x2eb64d}:null;}})['then'](respondWithResult(_0x34c059,null))[_0xe9bd('0x22')](handleError(_0x34c059,null));};exports[_0xe9bd('0x11d')]=function(_0x352484,_0x46f994){return db['chatProactiveAction'][_0xe9bd('0x62')]({'where':{'id':_0x352484[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x46f994,null))[_0xe9bd('0x2d')](function(_0x9ca060){if(_0x9ca060){return _0x9ca060[_0xe9bd('0x11d')](_0x352484[_0xe9bd('0x64')][_0xe9bd('0x76')],_['omit'](_0x352484[_0xe9bd('0x64')],[_0xe9bd('0x76'),'id'])||{});}})[_0xe9bd('0x2d')](respondWithResult(_0x46f994,null))[_0xe9bd('0x22')](handleError(_0x46f994,null));};exports['getProactiveActions']=function(_0xcce209,_0x1b7d5b){var _0x2f0a5d={};var _0x5a1e21={};var _0x4a3260;var _0x11dc0d;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0xcce209[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x1b7d5b,null))['then'](function(_0x5c9f1a){if(_0x5c9f1a){_0x4a3260=_0x5c9f1a;_0x5a1e21[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0x11e')][_0xe9bd('0x4b')]);_0x5a1e21[_0xe9bd('0x4e')]=_['keys'](_0xcce209[_0xe9bd('0x4e')]);_0x5a1e21[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x5a1e21[_0xe9bd('0x43')],_0x5a1e21[_0xe9bd('0x4e')]);_0x2f0a5d['attributes']=_[_0xe9bd('0x50')](_0x5a1e21['model'],qs[_0xe9bd('0x52')](_0xcce209['query']['fields']));_0x2f0a5d['attributes']=_0x2f0a5d[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x2f0a5d[_0xe9bd('0x51')]:_0x5a1e21[_0xe9bd('0x43')];_0x2f0a5d[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x2f0a5d[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0xcce209[_0xe9bd('0x4e')],_0x5a1e21[_0xe9bd('0x4f')]));if(_0xcce209['query'][_0xe9bd('0x58')]){_0x2f0a5d['where']=_['merge'](_0x2f0a5d[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x2f0a5d[_0xe9bd('0x51')],function(_0x5d756a){var _0x5d5a7a={};_0x5d5a7a[_0x5d756a]={'$like':'%'+_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x5d5a7a;})});}_0x2f0a5d=_[_0xe9bd('0x59')]({},_0x2f0a5d,_0xcce209['options']);return _0x4a3260[_0xe9bd('0x101')](_0x2f0a5d);}})[_0xe9bd('0x2d')](function(_0x1096f4){if(_0x1096f4){_0x11dc0d=_0x1096f4['length'];if(!_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x2f0a5d[_0xe9bd('0x2a')]=qs['limit'](_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x2f0a5d[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0xcce209['query'][_0xe9bd('0x29')]);}return _0x4a3260[_0xe9bd('0x101')](_0x2f0a5d);}})[_0xe9bd('0x2d')](function(_0x5eefaf){if(_0x5eefaf){return _0x5eefaf?{'count':_0x11dc0d,'rows':_0x5eefaf}:null;}})[_0xe9bd('0x2d')](respondWithResult(_0x1b7d5b,null))[_0xe9bd('0x22')](handleError(_0x1b7d5b,null));};exports[_0xe9bd('0x11f')]=function(_0x47c137,_0x4ab2e9){var _0x52dc90=_0x47c137['query'][_0xe9bd('0x120')]===_0xe9bd('0x121')?_0xe9bd('0x122'):_0xe9bd('0x123');return db['ChatWebsite']['find']({'attributes':['id',_0x52dc90],'where':{'id':_0x47c137[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4ab2e9,null))['then'](function(_0x24d661){if(_0x24d661){var _0x565b57=_0x24d661[_0x52dc90];var _0x4b0a01=_0x565b57&&_0x565b57['items']?_0x565b57['items']:[];_0x4ab2e9[_0xe9bd('0x33')]({'fromKey':_[_0xe9bd('0x88')](_0x565b57[_0xe9bd('0x124')])?undefined:_0x565b57[_0xe9bd('0x124')],'count':_0x4b0a01[_0xe9bd('0x53')],'rows':_0x4b0a01});}})[_0xe9bd('0x22')](handleError(_0x4ab2e9,null));};exports['getOfflineMessages']=function(_0x5eb33b,_0x15e9a9){var _0x142f33={'raw':![],'where':{}};var _0x17a4c8={};var _0x457c02={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5eb33b['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x15e9a9,null))['then'](function(_0x25f0ef){if(_0x25f0ef){_0x17a4c8[_0xe9bd('0x43')]=_['keys'](db['ChatOfflineMessage'][_0xe9bd('0x4b')]);_0x17a4c8['query']=_[_0xe9bd('0x61')](_0x5eb33b[_0xe9bd('0x4e')]);_0x17a4c8[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x17a4c8[_0xe9bd('0x43')],_0x17a4c8['query']);_0x142f33[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x17a4c8[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x142f33['attributes']=_0x142f33[_0xe9bd('0x51')]['length']?_0x142f33[_0xe9bd('0x51')]:_0x17a4c8[_0xe9bd('0x43')];if(!_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x73')]('nolimit')){_0x142f33[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x142f33['offset']=qs[_0xe9bd('0x29')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x142f33['order']=qs[_0xe9bd('0x55')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x142f33['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x5eb33b[_0xe9bd('0x4e')],_0x17a4c8[_0xe9bd('0x4f')]));_0x142f33[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x25f0ef['id'];if(_0x5eb33b[_0xe9bd('0x4e')]['filter']){_0x142f33['where']=_[_0xe9bd('0x59')](_0x142f33[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x142f33['attributes'],function(_0x5c96f9){var _0x1dc840={};_0x1dc840[_0x5c96f9]={'$like':'%'+_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x1dc840;})});}_0x142f33=_['merge']({},_0x142f33,_0x5eb33b[_0xe9bd('0x5a')]);return db[_0xe9bd('0xdd')][_0xe9bd('0x28')]({'where':_0x142f33[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x476af9){_0x457c02[_0xe9bd('0x28')]=_0x476af9;if(_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0xfb')]){_0x142f33['include']=[{'all':!![]}];}else{_0x142f33['include']=[{'model':db[_0xe9bd('0xa6')],'as':_0xe9bd('0x125'),'required':![]},{'model':db[_0xe9bd('0xe7')],'as':_0xe9bd('0x126'),'required':![]}];}return db['ChatOfflineMessage'][_0xe9bd('0x5d')](_0x142f33);})[_0xe9bd('0x2d')](function(_0x8ec7a3){_0x457c02[_0xe9bd('0x5e')]=_0x8ec7a3;return _0x457c02;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x15e9a9,_0x142f33))['catch'](handleError(_0x15e9a9,null));};exports[_0xe9bd('0x127')]=function(_0x259361,_0x4212f6){return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x259361['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4212f6,null))['then'](function(_0x3e45ba){if(_0x3e45ba){return _0x3e45ba[_0xe9bd('0x127')](_0x259361[_0xe9bd('0x64')][_0xe9bd('0x76')],_[_0xe9bd('0xfa')](_0x259361['body'],['ids','id'])||{})[_0xe9bd('0x128')](function(_0x5690ee){for(var _0x4210c7=0x0;_0x4210c7<_0x259361[_0xe9bd('0x64')]['ids']['length'];_0x4210c7+=0x1){socket[_0xe9bd('0x129')](_0xe9bd('0x12a'),{'UserId':Number(_0x259361[_0xe9bd('0x64')][_0xe9bd('0x76')][_0x4210c7]),'ChatWebsiteId':Number(_0x259361['params']['id'])});}return _0x5690ee;});}})[_0xe9bd('0x2d')](respondWithResult(_0x4212f6,null))[_0xe9bd('0x22')](handleError(_0x4212f6,null));};exports[_0xe9bd('0x12b')]=function(_0x2b7c73,_0xb75604){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')]({'where':{'id':_0x2b7c73['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0xb75604,null))['then'](function(_0x3ccd6f){if(_0x3ccd6f){return _0x3ccd6f[_0xe9bd('0x12b')](_0x2b7c73['query'][_0xe9bd('0x76')])[_0xe9bd('0x2d')](function(){if(_[_0xe9bd('0x12c')](_0x2b7c73[_0xe9bd('0x4e')][_0xe9bd('0x76')])){for(var _0x1ce2e7=0x0;_0x1ce2e7<_0x2b7c73['query'][_0xe9bd('0x76')][_0xe9bd('0x53')];_0x1ce2e7+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2b7c73[_0xe9bd('0x4e')]['ids'][_0x1ce2e7]),'ChatWebsiteId':Number(_0x2b7c73[_0xe9bd('0x60')]['id'])});}}else{socket[_0xe9bd('0x129')](_0xe9bd('0x12d'),{'UserId':Number(_0x2b7c73[_0xe9bd('0x4e')]['ids']),'ChatWebsiteId':Number(_0x2b7c73[_0xe9bd('0x60')]['id'])});}});}})[_0xe9bd('0x2d')](respondWithStatusCode(_0xb75604,null))[_0xe9bd('0x22')](handleError(_0xb75604,null));};exports[_0xe9bd('0x12e')]=function(_0x33c25d,_0x337721){var _0x4703c7={};var _0xc877fd={};var _0x14fcdc;var _0x3f3e29;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x33c25d[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x337721,null))['then'](function(_0x3f929f){if(_0x3f929f){_0x14fcdc=_0x3f929f;_0xc877fd[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0xc5')][_0xe9bd('0x4b')]);_0xc877fd[_0xe9bd('0x4e')]=_['keys'](_0x33c25d[_0xe9bd('0x4e')]);_0xc877fd[_0xe9bd('0x4f')]=_['intersection'](_0xc877fd[_0xe9bd('0x43')],_0xc877fd[_0xe9bd('0x4e')]);_0x4703c7[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0xc877fd[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x4703c7[_0xe9bd('0x51')]=_0x4703c7[_0xe9bd('0x51')]['length']?_0x4703c7[_0xe9bd('0x51')]:_0xc877fd[_0xe9bd('0x43')];_0x4703c7[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x4703c7['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x33c25d[_0xe9bd('0x4e')],_0xc877fd[_0xe9bd('0x4f')]));if(_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x4703c7['where']=_[_0xe9bd('0x59')](_0x4703c7[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x4703c7[_0xe9bd('0x51')],function(_0x43b790){var _0x15485c={};_0x15485c[_0x43b790]={'$like':'%'+_0x33c25d[_0xe9bd('0x4e')]['filter']+'%'};return _0x15485c;})});}_0x4703c7=_[_0xe9bd('0x59')]({},_0x4703c7,_0x33c25d[_0xe9bd('0x5a')]);return _0x14fcdc['getAgents'](_0x4703c7);}})[_0xe9bd('0x2d')](function(_0x1cf9f0){if(_0x1cf9f0){_0x3f3e29=_0x1cf9f0[_0xe9bd('0x53')];if(!_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x4703c7[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x33c25d[_0xe9bd('0x4e')]['limit']);_0x4703c7['offset']=qs['offset'](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}return _0x14fcdc[_0xe9bd('0x12e')](_0x4703c7);}})['then'](function(_0x21ac1f){if(_0x21ac1f){return _0x21ac1f?{'count':_0x3f3e29,'rows':_0x21ac1f}:null;}})[_0xe9bd('0x2d')](respondWithResult(_0x337721,null))[_0xe9bd('0x22')](handleError(_0x337721,null));}; \ No newline at end of file +var _0x98a8=['emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','result','catch','end','status','json','limit','undefined','count','offset','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','then','sendStatus','name','user-agent-parser','setUA','customerIp','x-forwarded-for','first','split','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','params','Pause','rawAttributes','includeAll','find','create','body','forEach','trim','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','address','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','ChatApplication','interval','account','applications','orderBy','Applications','priority','asc','list','List','defaults','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','send','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','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','email','firstName','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','utf8','3.10.1','headers','origin','http://localhost:9000','x-real-ip','verticalAlignment','textButtonColor','color_button','backgroundColor','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x98a8,0x12c));var _0x898a=function(_0x35d80c,_0x1aa9a6){_0x35d80c=_0x35d80c-0x0;var _0x185739=_0x98a8[_0x35d80c];return _0x185739;};'use strict';var Mustache=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var ejs=require(_0x898a('0x3'));var fs=require('fs');var fs_extra=require(_0x898a('0x4'));var _=require(_0x898a('0x5'));var querystring=require(_0x898a('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x898a('0x7'));var jayson=require(_0x898a('0x8'));var qs=require(_0x898a('0x9'));var logger=require(_0x898a('0xa'))(_0x898a('0xb'));var config=require('../../config/environment');var APIBadRequestError=require(_0x898a('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x898a('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x898a('0xc'))[_0x898a('0xd')];var APIHandleError=require(_0x898a('0xc'))[_0x898a('0xe')];var APIConflictError=require(_0x898a('0xc'))[_0x898a('0xf')];var wildcardUtils=require(_0x898a('0x10'));var URL=require(_0x898a('0x11'))[_0x898a('0x12')];var db=require('../../mysqldb')['db'];config[_0x898a('0x13')]=_['defaults'](config[_0x898a('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0x14'))(new Redis(config[_0x898a('0x13')]));require(_0x898a('0x15'))['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x232a});var client9003=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x232b});var client9001=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x506023,_0x47033c,_0x53a4b8,_0x3fec7a){return new Promise(function(_0x5c96a6,_0x303321){var _0x4fb05b=_0x3fec7a||client;return _0x4fb05b[_0x898a('0x18')](_0x506023,_0x53a4b8)['then'](function(_0xee4408){logger[_0x898a('0x19')](_0x898a('0x1a'),_0x47033c,'request\x20sent');logger[_0x898a('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x47033c,'request\x20sent',JSON[_0x898a('0x1c')](_0xee4408));if(_0xee4408[_0x898a('0x1d')]){if(_0xee4408['error']['code']===0x1f4){logger[_0x898a('0x1d')](_0x898a('0x1a'),_0x47033c,_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);return _0x303321(_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);}logger[_0x898a('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x47033c,_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);return _0x5c96a6(_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);}else{logger[_0x898a('0x19')](_0x898a('0x1a'),_0x47033c,'request\x20sent');_0x5c96a6(_0xee4408[_0x898a('0x1f')][_0x898a('0x1e')]);}})[_0x898a('0x20')](function(_0x32eca5){logger[_0x898a('0x1d')](_0x898a('0x1a'),_0x47033c,_0x32eca5);_0x303321(_0x32eca5);});});}function respondWithStatusCode(_0x5b7719,_0x20bde0){_0x20bde0=_0x20bde0||0xcc;return function(_0x51d501){if(_0x51d501){return _0x5b7719['sendStatus'](_0x20bde0);}return _0x5b7719['status'](_0x20bde0)[_0x898a('0x21')]();};}function respondWithResult(_0x1f4d86,_0x420b25){_0x420b25=_0x420b25||0xc8;return function(_0x40b3db){if(_0x40b3db){return _0x1f4d86[_0x898a('0x22')](_0x420b25)[_0x898a('0x23')](_0x40b3db);}};}function respondWithFilteredResult(_0x398e98,_0xac1fc4){return function(_0xd31922){if(_0xd31922){var _0x58149d=typeof _0xac1fc4['offset']==='undefined'&&typeof _0xac1fc4[_0x898a('0x24')]===_0x898a('0x25');var _0x3b7704=_0xd31922[_0x898a('0x26')];var _0x34f447=_0x58149d?0x0:_0xac1fc4[_0x898a('0x27')];var _0xe3c983=_0x58149d?_0xd31922[_0x898a('0x26')]:_0xac1fc4[_0x898a('0x27')]+_0xac1fc4[_0x898a('0x24')];var _0x44c5d2;if(_0xe3c983>=_0x3b7704){_0xe3c983=_0x3b7704;_0x44c5d2=0xc8;}else{_0x44c5d2=0xce;}_0x398e98[_0x898a('0x22')](_0x44c5d2);return _0x398e98['set'](_0x898a('0x28'),_0x34f447+'-'+_0xe3c983+'/'+_0x3b7704)[_0x898a('0x23')](_0xd31922);}return null;};}function saveUpdates(_0x26eead){return function(_0x17a980){if(_0x17a980){return _0x17a980[_0x898a('0x29')](_0x26eead)['then'](function(_0x48cefb){return _0x48cefb;});}return null;};}function removeEntity(_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x2a')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x2b')]({'plain':!![]});var _0x5eafc7=_0x898a('0x2c');return db[_0x898a('0x2d')][_0x898a('0x2a')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x2e')](function(){return _0x1e2fd4;});})[_0x898a('0x2e')](function(){_0x20a3fe['status'](0xcc)[_0x898a('0x21')]();});}};}function handleEntityNotFound(_0x5baf5b){return function(_0x573eb3){if(!_0x573eb3){_0x5baf5b[_0x898a('0x2f')](0x194);}return _0x573eb3;};}function handleError(_0x58d997,_0x3c9588){_0x3c9588=_0x3c9588||0x1f4;return function(_0x4b3aac){logger[_0x898a('0x1d')](_0x4b3aac['stack']);if(_0x4b3aac[_0x898a('0x30')]){delete _0x4b3aac[_0x898a('0x30')];}_0x58d997[_0x898a('0x22')](_0x3c9588)['send'](_0x4b3aac);};}function createInteractionObject(_0x554897,_0x47966e,_0x1575d2,_0x429c32){var _0x5a228f=require(_0x898a('0x31'));var _0x3d3463=new _0x5a228f();var _0xe84f7e=_0x3d3463[_0x898a('0x32')](_0x1575d2['user-agent'])['getResult']();var _0x3aed01=_0x47966e[_0x898a('0x33')];if(_0x1575d2['cf-connecting-ip']){_0x3aed01=_0x1575d2['cf-connecting-ip'];}else if(_0x1575d2[_0x898a('0x34')]){_0x3aed01=_[_0x898a('0x35')](_0x1575d2[_0x898a('0x34')][_0x898a('0x36')](','));}return{'ContactId':_0x429c32['id'],'ChatWebsiteId':_0x554897,'from':(_0x429c32['firstName']||'')+'\x20'+(_0x429c32[_0x898a('0x37')]||''),'customerIp':_0x3aed01,'customerPort':_0x1575d2[_0x898a('0x38')]?_0x1575d2['x-real-port']:null,'referer':_0x47966e['referer'],'browserName':_0xe84f7e['browser'][_0x898a('0x30')]&&_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]?util[_0x898a('0x3b')](_0x898a('0x3c'),_0xe84f7e[_0x898a('0x39')][_0x898a('0x30')],_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]):_0x898a('0x3d'),'browserVersion':_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]||_0x898a('0x3d'),'osName':util[_0x898a('0x3b')](_0x898a('0x3c'),_0xe84f7e['os']['name'],_0xe84f7e['os'][_0x898a('0x3a')]),'osVersion':_0xe84f7e['os'][_0x898a('0x3a')],'deviceModel':_0xe84f7e[_0x898a('0x3e')]['model']&&_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')]?util[_0x898a('0x3b')](_0x898a('0x40'),_0xe84f7e[_0x898a('0x3e')][_0x898a('0x41')],_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')],_0xe84f7e['device'][_0x898a('0x42')]):null,'deviceVendor':_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')],'deviceType':_0xe84f7e[_0x898a('0x3e')]['type'],'formData':JSON[_0x898a('0x1c')](_0x47966e)};}exports[_0x898a('0x43')]=function(_0x5964df,_0x241677){var _0x4ce00e={'include':[{'model':db['Pause'],'as':_0x898a('0x44')}]},_0x56a40c={},_0x5137c4={'count':0x0,'rows':[]};var _0x49e603=_[_0x898a('0x45')](db[_0x898a('0x46')]['rawAttributes'],function(_0x247347){return{'name':_0x247347[_0x898a('0x47')],'type':_0x247347['type'][_0x898a('0x48')]};});_0x56a40c[_0x898a('0x41')]=_[_0x898a('0x45')](_0x49e603,_0x898a('0x30'));_0x56a40c['query']=_[_0x898a('0x49')](_0x5964df[_0x898a('0x4a')]);_0x56a40c['filters']=_[_0x898a('0x4b')](_0x56a40c[_0x898a('0x41')],_0x56a40c['query']);_0x4ce00e[_0x898a('0x4c')]=_['intersection'](_0x56a40c[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x5964df[_0x898a('0x4a')]['fields']));_0x4ce00e[_0x898a('0x4c')]=_0x4ce00e[_0x898a('0x4c')][_0x898a('0x4e')]?_0x4ce00e[_0x898a('0x4c')]:_0x56a40c['model'];if(!_0x5964df[_0x898a('0x4a')]['hasOwnProperty'](_0x898a('0x4f'))){_0x4ce00e[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x5964df['query'][_0x898a('0x24')]);_0x4ce00e[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x5964df['query']['offset']);}_0x4ce00e[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x5964df[_0x898a('0x4a')][_0x898a('0x51')]);_0x4ce00e[_0x898a('0x52')]=qs[_0x898a('0x53')](_[_0x898a('0x54')](_0x5964df[_0x898a('0x4a')],_0x56a40c[_0x898a('0x53')]),_0x49e603);if(_0x5964df[_0x898a('0x4a')][_0x898a('0x55')]){_0x4ce00e['where']=_[_0x898a('0x56')](_0x4ce00e[_0x898a('0x52')],{'$or':_['map'](_0x49e603,function(_0x36d7aa){if(_0x36d7aa['type']!=='VIRTUAL'){var _0x15f11e={};_0x15f11e[_0x36d7aa[_0x898a('0x30')]]={'$like':'%'+_0x5964df[_0x898a('0x4a')]['filter']+'%'};return _0x15f11e;}})});}_0x4ce00e=_['merge']({},_0x4ce00e,_0x5964df[_0x898a('0x57')]);var _0x1f5e4b={'where':_0x4ce00e['where']};return db[_0x898a('0x46')][_0x898a('0x26')](_0x1f5e4b)['then'](function(_0x299a6d){_0x5137c4[_0x898a('0x26')]=_0x299a6d;if(_0x5964df[_0x898a('0x4a')]['includeAll']){_0x4ce00e[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x46')][_0x898a('0x59')](_0x4ce00e);})[_0x898a('0x2e')](function(_0xd37f94){_0x5137c4[_0x898a('0x5a')]=_0xd37f94;return _0x5137c4;})['then'](respondWithFilteredResult(_0x241677,_0x4ce00e))[_0x898a('0x20')](handleError(_0x241677,null));};exports['show']=function(_0x253f51,_0x1dc177){var _0x15b203={'raw':![],'where':{'id':_0x253f51[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0x5c')],'as':_0x898a('0x44')}]},_0x43780e={};_0x43780e[_0x898a('0x41')]=_[_0x898a('0x49')](db['ChatWebsite'][_0x898a('0x5d')]);_0x43780e[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x253f51[_0x898a('0x4a')]);_0x43780e[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x43780e[_0x898a('0x41')],_0x43780e[_0x898a('0x4a')]);_0x15b203[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x43780e[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x253f51[_0x898a('0x4a')][_0x898a('0x4d')]));_0x15b203[_0x898a('0x4c')]=_0x15b203['attributes'][_0x898a('0x4e')]?_0x15b203[_0x898a('0x4c')]:_0x43780e['model'];if(_0x253f51[_0x898a('0x4a')][_0x898a('0x5e')]){_0x15b203['include']=[{'all':!![]}];}_0x15b203=_[_0x898a('0x56')]({},_0x15b203,_0x253f51[_0x898a('0x57')]);return db[_0x898a('0x46')][_0x898a('0x5f')](_0x15b203)['then'](handleEntityNotFound(_0x1dc177,null))[_0x898a('0x2e')](respondWithResult(_0x1dc177,null))[_0x898a('0x20')](handleError(_0x1dc177,null));};exports[_0x898a('0x60')]=function(_0xf86633,_0x5b4e60){var _0x285ec9=null;_0xf86633[_0x898a('0x61')]['address'][_0x898a('0x36')](',')[_0x898a('0x62')](_0x5b7019=>{if(_0x5b7019[_0x898a('0x63')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x5b7019[_0x898a('0x63')]())){_0x285ec9=new APIBadRequestError('\x22'+_0x5b7019['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x285ec9){return handleError(_0x5b4e60,null)(_0x285ec9);}return db['ChatWebsite'][_0x898a('0x60')](_0xf86633[_0x898a('0x61')],{})[_0x898a('0x2e')](function(_0x37c6f6){var _0x5e0535=_0xf86633['user'][_0x898a('0x2b')]({'plain':!![]});if(!_0x5e0535)throw new Error(_0x898a('0x64'));if(_0x5e0535[_0x898a('0x65')]===_0x898a('0x66')){var _0x3d9966=_0x37c6f6[_0x898a('0x2b')]({'plain':!![]});var _0x30051d=_0x898a('0x2c');return db['UserProfileSection'][_0x898a('0x5f')]({'where':{'name':_0x30051d,'userProfileId':_0x5e0535[_0x898a('0x67')]},'raw':!![]})['then'](function(_0x42fda8){if(_0x42fda8&&_0x42fda8[_0x898a('0x68')]===0x0){return db[_0x898a('0x2d')][_0x898a('0x60')]({'name':_0x3d9966[_0x898a('0x30')],'resourceId':_0x3d9966['id'],'type':_0x42fda8[_0x898a('0x30')],'sectionId':_0x42fda8['id']},{})[_0x898a('0x2e')](function(){return _0x37c6f6;});}else{return _0x37c6f6;}})[_0x898a('0x20')](function(_0x16c48d){logger[_0x898a('0x1d')](_0x898a('0x69'),_0x16c48d);throw _0x16c48d;});}return _0x37c6f6;})[_0x898a('0x2e')](respondWithResult(_0x5b4e60,0xc9))[_0x898a('0x20')](handleError(_0x5b4e60,null));};exports['update']=function(_0x2d9a9c,_0x554cb7){var _0x2be3a8=null;_0x2d9a9c[_0x898a('0x61')][_0x898a('0x6a')]['split'](',')[_0x898a('0x62')](_0x3f0d9f=>{if(_0x3f0d9f[_0x898a('0x63')]()!==''&&!wildcardUtils[_0x898a('0x6b')](_0x3f0d9f[_0x898a('0x63')]())){_0x2be3a8=new APIBadRequestError('\x22'+_0x3f0d9f['trim']()+_0x898a('0x6c'));}});if(_0x2be3a8){return handleError(_0x554cb7,null)(_0x2be3a8);}if(_0x2d9a9c[_0x898a('0x61')]['id']){delete _0x2d9a9c[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x2d9a9c['params']['id']},'include':[{'model':db[_0x898a('0x5c')],'as':_0x898a('0x44')}]})[_0x898a('0x2e')](handleEntityNotFound(_0x554cb7,null))[_0x898a('0x2e')](saveUpdates(_0x2d9a9c[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x554cb7,null))[_0x898a('0x20')](handleError(_0x554cb7,null));};exports[_0x898a('0x2a')]=function(_0x51836c,_0x32a207){return db[_0x898a('0x46')]['find']({'where':{'id':_0x51836c[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32a207,null))[_0x898a('0x2e')](removeEntity(_0x32a207,null))['catch'](handleError(_0x32a207,null));};exports[_0x898a('0x6d')]=function(_0x387f2c,_0x3b07dc){return db[_0x898a('0x46')][_0x898a('0x6d')]()[_0x898a('0x2e')](respondWithResult(_0x3b07dc,null))[_0x898a('0x20')](handleError(_0x3b07dc,null));};exports[_0x898a('0x6e')]=function(_0x1f46b5,_0x59073f){if(_0x1f46b5[_0x898a('0x61')]['id']){delete _0x1f46b5[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x1f46b5[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x59073f,null))[_0x898a('0x2e')](function(_0x4bcf85){if(_0x4bcf85){_0x1f46b5[_0x898a('0x61')][_0x898a('0x6f')]=_0x4bcf85['id'];return db['Disposition']['create'](_0x1f46b5[_0x898a('0x61')]);}})[_0x898a('0x2e')](respondWithResult(_0x59073f,null))['catch'](handleError(_0x59073f,null));};exports['getDispositions']=function(_0x34e1f2,_0x4a79a4){var _0x2fdeb5={'raw':![],'where':{}};var _0x41077f={};var _0x5dbe6c={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x34e1f2[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4a79a4,null))[_0x898a('0x2e')](function(_0x2d047a){if(_0x2d047a){_0x41077f[_0x898a('0x41')]=_['keys'](db[_0x898a('0x71')][_0x898a('0x5d')]);_0x41077f[_0x898a('0x4a')]=_['keys'](_0x34e1f2[_0x898a('0x4a')]);_0x41077f[_0x898a('0x53')]=_['intersection'](_0x41077f[_0x898a('0x41')],_0x41077f['query']);_0x2fdeb5['attributes']=_['intersection'](_0x41077f[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x4d')]));_0x2fdeb5[_0x898a('0x4c')]=_0x2fdeb5[_0x898a('0x4c')][_0x898a('0x4e')]?_0x2fdeb5['attributes']:_0x41077f[_0x898a('0x41')];if(!_0x34e1f2['query'][_0x898a('0x72')](_0x898a('0x4f'))){_0x2fdeb5['limit']=qs[_0x898a('0x24')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x24')]);_0x2fdeb5[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x34e1f2['query']['offset']);}_0x2fdeb5['order']=qs[_0x898a('0x51')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x51')]);_0x2fdeb5['where']=qs[_0x898a('0x53')](_['pick'](_0x34e1f2['query'],_0x41077f[_0x898a('0x53')]));_0x2fdeb5[_0x898a('0x52')][_0x898a('0x6f')]=_0x2d047a['id'];if(_0x34e1f2[_0x898a('0x4a')][_0x898a('0x55')]){_0x2fdeb5[_0x898a('0x52')]=_[_0x898a('0x56')](_0x2fdeb5[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x2fdeb5[_0x898a('0x4c')],function(_0x5ce499){var _0x122682={};_0x122682[_0x5ce499]={'$like':'%'+_0x34e1f2[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x122682;})});}_0x2fdeb5=_[_0x898a('0x56')]({},_0x2fdeb5,_0x34e1f2[_0x898a('0x57')]);return db['Disposition'][_0x898a('0x26')]({'where':_0x2fdeb5[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0xc187e7){_0x5dbe6c[_0x898a('0x26')]=_0xc187e7;if(_0x34e1f2[_0x898a('0x4a')][_0x898a('0x5e')]){_0x2fdeb5[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x71')][_0x898a('0x59')](_0x2fdeb5);})[_0x898a('0x2e')](function(_0x381071){_0x5dbe6c['rows']=_0x381071;return _0x5dbe6c;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0x4a79a4,_0x2fdeb5))['catch'](handleError(_0x4a79a4,null));};exports[_0x898a('0x73')]=function(_0x34e463,_0xc510c0){return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x34e463[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc510c0,null))[_0x898a('0x2e')](function(_0x3ebb81){if(_0x3ebb81){return _0x3ebb81[_0x898a('0x73')](_0x34e463[_0x898a('0x4a')][_0x898a('0x74')]);}})[_0x898a('0x2e')](respondWithStatusCode(_0xc510c0,null))['catch'](handleError(_0xc510c0,null));};exports['addAnswer']=function(_0x19b6f4,_0x4b7334){if(_0x19b6f4[_0x898a('0x61')]['id']){delete _0x19b6f4[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x19b6f4[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4b7334,null))['then'](function(_0x4d7431){if(_0x4d7431){_0x19b6f4[_0x898a('0x61')]['ChatWebsiteId']=_0x4d7431['id'];return db[_0x898a('0x75')][_0x898a('0x60')](_0x19b6f4['body']);}})[_0x898a('0x2e')](respondWithResult(_0x4b7334,null))['catch'](handleError(_0x4b7334,null));};exports[_0x898a('0x76')]=function(_0xc8763f,_0xed8829){var _0x5ef14d={'raw':![],'where':{}};var _0x546c80={};var _0x541241={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0xc8763f[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0xed8829,null))[_0x898a('0x2e')](function(_0x1c989f){if(_0x1c989f){_0x546c80['model']=_[_0x898a('0x49')](db[_0x898a('0x75')]['rawAttributes']);_0x546c80['query']=_[_0x898a('0x49')](_0xc8763f[_0x898a('0x4a')]);_0x546c80['filters']=_[_0x898a('0x4b')](_0x546c80['model'],_0x546c80[_0x898a('0x4a')]);_0x5ef14d[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x546c80[_0x898a('0x41')],qs[_0x898a('0x4d')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x4d')]));_0x5ef14d[_0x898a('0x4c')]=_0x5ef14d[_0x898a('0x4c')][_0x898a('0x4e')]?_0x5ef14d[_0x898a('0x4c')]:_0x546c80[_0x898a('0x41')];if(!_0xc8763f[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x5ef14d['limit']=qs['limit'](_0xc8763f['query'][_0x898a('0x24')]);_0x5ef14d['offset']=qs[_0x898a('0x27')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x27')]);}_0x5ef14d[_0x898a('0x50')]=qs[_0x898a('0x51')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x51')]);_0x5ef14d[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0xc8763f['query'],_0x546c80['filters']));_0x5ef14d['where'][_0x898a('0x6f')]=_0x1c989f['id'];if(_0xc8763f['query'][_0x898a('0x55')]){_0x5ef14d[_0x898a('0x52')]=_[_0x898a('0x56')](_0x5ef14d['where'],{'$or':_['map'](_0x5ef14d[_0x898a('0x4c')],function(_0x2f3d65){var _0x3a1bc5={};_0x3a1bc5[_0x2f3d65]={'$like':'%'+_0xc8763f[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x3a1bc5;})});}_0x5ef14d=_[_0x898a('0x56')]({},_0x5ef14d,_0xc8763f[_0x898a('0x57')]);return db[_0x898a('0x75')][_0x898a('0x26')]({'where':_0x5ef14d['where']})[_0x898a('0x2e')](function(_0x21a4f6){_0x541241['count']=_0x21a4f6;if(_0xc8763f[_0x898a('0x4a')][_0x898a('0x5e')]){_0x5ef14d[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x75')][_0x898a('0x59')](_0x5ef14d);})['then'](function(_0xe3fea){_0x541241[_0x898a('0x5a')]=_0xe3fea;return _0x541241;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0xed8829,_0x5ef14d))[_0x898a('0x20')](handleError(_0xed8829,null));};exports['removeAnswers']=function(_0x58f08e,_0x2724e1){return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x58f08e[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x2724e1,null))[_0x898a('0x2e')](function(_0x32cbfa){if(_0x32cbfa){return _0x32cbfa[_0x898a('0x77')](_0x58f08e[_0x898a('0x4a')]['ids']);}})[_0x898a('0x2e')](respondWithStatusCode(_0x2724e1,null))['catch'](handleError(_0x2724e1,null));};exports[_0x898a('0x78')]=function(_0x110a2d,_0x5b8504){_0x110a2d[_0x898a('0x61')][_0x898a('0x79')]=_0x110a2d[_0x898a('0x7a')][_0x898a('0x7b')];return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x110a2d[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b8504,null))[_0x898a('0x2e')](saveUpdates(_0x110a2d[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x5b8504,null))[_0x898a('0x20')](handleError(_0x5b8504,null));};exports[_0x898a('0x7c')]=function(_0x171691,_0x1259f0){_0x171691['body'][_0x898a('0x7d')]=_0x171691[_0x898a('0x7a')]['filename'];return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x171691['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x1259f0,null))[_0x898a('0x2e')](saveUpdates(_0x171691[_0x898a('0x61')],null))['then'](respondWithResult(_0x1259f0,null))[_0x898a('0x20')](handleError(_0x1259f0,null));};exports[_0x898a('0x7e')]=function(_0xdef811,_0x1777a9){_0xdef811[_0x898a('0x61')][_0x898a('0x7f')]=_0xdef811[_0x898a('0x7a')][_0x898a('0x7b')];return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0xdef811['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x1777a9,null))[_0x898a('0x2e')](saveUpdates(_0xdef811[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x1777a9,null))[_0x898a('0x20')](handleError(_0x1777a9,null));};exports[_0x898a('0x80')]=function(_0x31b0d8,_0x4863aa){_0x31b0d8['body'][_0x898a('0x81')]=_0x31b0d8[_0x898a('0x7a')]['filename'];return db[_0x898a('0x46')]['find']({'where':{'id':_0x31b0d8[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4863aa,null))['then'](saveUpdates(_0x31b0d8[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x4863aa,null))[_0x898a('0x20')](handleError(_0x4863aa,null));};exports['getLogo']=function(_0x5b7790,_0x5a0689){var _0x1cabde=path[_0x898a('0x82')](config['root'],_0x898a('0x83'));var _0x4a9c3b={'where':{'id':_0x5b7790[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x79')],'raw':!![]};var _0x210ce7=![];return require(_0x898a('0x84'))[_0x898a('0x85')]()[_0x898a('0x2e')](function(_0x389fda){if(_0x389fda){_0x210ce7=_0x389fda[_0x898a('0x86')];}})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')](_0x4a9c3b);})[_0x898a('0x2e')](handleEntityNotFound(_0x5a0689,null))[_0x898a('0x2e')](function(_0x5e76f2){if(_0x5e76f2){if(!_['isNil'](_0x5e76f2[_0x898a('0x79')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x89'),_0x5e76f2[_0x898a('0x79')]))&&_0x210ce7){_0x1cabde=path[_0x898a('0x82')](config['root'],_0x898a('0x89'),_0x5e76f2[_0x898a('0x79')]);}}return _0x5a0689[_0x898a('0x8a')](_0x1cabde);}})[_0x898a('0x20')](handleError(_0x5a0689,null));};exports['getAvatar']=function(_0x41b9e1,_0x1cbc52){var _0xbadb62=path[_0x898a('0x82')](config['root'],_0x898a('0x8b'));var _0xba9062={'where':{'id':_0x41b9e1[_0x898a('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xba9062)[_0x898a('0x2e')](handleEntityNotFound(_0x1cbc52,null))['then'](function(_0x40b532){if(_0x40b532){if(!_[_0x898a('0x8c')](_0x40b532[_0x898a('0x7d')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config['root'],_0x898a('0x8d'),_0x40b532[_0x898a('0x7d')]))){_0xbadb62=path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x8d'),_0x40b532[_0x898a('0x7d')]);}}return _0x1cbc52[_0x898a('0x8a')](_0xbadb62);}})[_0x898a('0x20')](handleError(_0x1cbc52,null));};exports['getCustomerAvatar']=function(_0x2f1a65,_0x167a4d){var _0x2614e7=path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x8e'));var _0x1779db={'where':{'id':_0x2f1a65[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x7f'),_0x898a('0x8f')],'raw':!![]};return db['ChatWebsite']['find'](_0x1779db)['then'](handleEntityNotFound(_0x167a4d,null))[_0x898a('0x2e')](function(_0x380ae7){if(_0x380ae7){if(!_[_0x898a('0x8c')](_0x380ae7[_0x898a('0x7f')])){if(fs[_0x898a('0x87')](path['join'](config[_0x898a('0x88')],_0x898a('0x8d'),_0x380ae7[_0x898a('0x7f')]))&&_0x380ae7[_0x898a('0x8f')]){_0x2614e7=path['join'](config[_0x898a('0x88')],_0x898a('0x8d'),_0x380ae7[_0x898a('0x7f')]);}}return _0x167a4d[_0x898a('0x8a')](_0x2614e7);}})[_0x898a('0x20')](handleError(_0x167a4d,null));};exports['getSystemAvatar']=function(_0x199a17,_0x4a862e){var _0x5367d5=path[_0x898a('0x82')](config['root'],_0x898a('0x90'));var _0x3359c1={'where':{'id':_0x199a17[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x81')],'raw':!![]};return db[_0x898a('0x46')][_0x898a('0x5f')](_0x3359c1)[_0x898a('0x2e')](handleEntityNotFound(_0x4a862e,null))[_0x898a('0x2e')](function(_0xa1c4a2){if(_0xa1c4a2){if(!_[_0x898a('0x8c')](_0xa1c4a2[_0x898a('0x81')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config['root'],_0x898a('0x8d'),_0xa1c4a2['systemAvatar']))){_0x5367d5=path[_0x898a('0x82')](config[_0x898a('0x88')],'server/files/images/avatars/',_0xa1c4a2[_0x898a('0x81')]);}}return _0x4a862e['download'](_0x5367d5);}})[_0x898a('0x20')](handleError(_0x4a862e,null));};function checkWebsiteInterval(_0x8054b){var _0x5aa358=_0x8054b[_0x898a('0x91')];if(!_0x5aa358){return Promise[_0x898a('0x92')](_0x8054b);}var _0x877820=_0x8054b[_0x898a('0x93')]||undefined;return _0x5aa358[_0x898a('0x94')](_0x877820)['then'](function(_0x285f0e){if(!_0x285f0e){throw new APIOutOfIntervalError();}return _0x8054b;});}exports[_0x898a('0x95')]=function(_0x4e759e,_0x4f1ff1){var _0xb64850={'body':_0x4e759e[_0x898a('0x61')],'channel':'chat'};var _0x51c0c2=[];var _0x1bfbc3=[];var _0x4de42c={};var _0xb1d9c4=![];if(_0x4e759e['body']['id']){delete _0x4e759e[_0x898a('0x61')]['id'];}if(_['isNil'](_0x4e759e['body'][_0x898a('0x96')])){throw new APIBadRequestError(_0x898a('0x97'));}if(_[_0x898a('0x8c')](_0x4e759e[_0x898a('0x61')][_0x898a('0x98')])){throw new APIBadRequestError(_0x898a('0x99'));}if(_[_0x898a('0x9a')](_0x4e759e[_0x898a('0x61')][_0x898a('0x61')])){throw new APIBadRequestError(_0x898a('0x9b'));}var _0x2dd49c=_0x4e759e['body'][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];return db[_0x898a('0x9d')]['describe']()['then'](function(_0x3522d2){if(!_0x3522d2){throw new Error(_0x898a('0x9e'));}_0x51c0c2=Object[_0x898a('0x49')](_0x3522d2)['filter'](function(_0x3f622a){return![_0x898a('0x9f'),_0x898a('0xa0')][_0x898a('0xa1')](_0x3f622a);});_0x1bfbc3=Object[_0x898a('0x49')](_0x3522d2)[_0x898a('0x55')](function(_0x54de91){return![_0x898a('0x9f'),_0x898a('0xa0'),_0x898a('0xa2'),_0x898a('0xa3')][_0x898a('0xa1')](_0x54de91);});if(!_[_0x898a('0xa1')](_0x1bfbc3,_0x4e759e['body'][_0x898a('0x98')])){throw new APIBadRequestError(_0x898a('0xa4')+_0x1bfbc3[_0x898a('0x82')](',\x20'));}_0x4de42c[_0x4e759e[_0x898a('0x61')]['mapKey']]=_0x4e759e[_0x898a('0x61')][_0x898a('0x96')];})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x4e759e['params']['id']},'include':[{'model':db[_0x898a('0xa5')],'as':'List','include':[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xa6'),'where':_0x4de42c,'limit':0x1,'order':[[_0x898a('0xa0'),'DESC']]}]},{'model':db[_0x898a('0xa7')],'as':'Applications'},{'model':db[_0x898a('0x91')],'as':_0x898a('0x91'),'include':[{'model':db[_0x898a('0x91')],'as':'Intervals','attributes':['id',_0x898a('0xa8')],'raw':!![]}]}]});})[_0x898a('0x2e')](function(_0x5a5762){if(!_0x5a5762){throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x4e759e[_0x898a('0x5b')]['id']));}if(_0x2dd49c){return checkWebsiteInterval(_0x5a5762);}return _0x5a5762;})[_0x898a('0x2e')](function(_0x4e5adf){_0xb64850[_0x898a('0xa9')]=_0x4e5adf;_0xb64850[_0x898a('0xaa')]=_[_0x898a('0xab')](_0x4e5adf[_0x898a('0xac')],[_0x898a('0xad')],[_0x898a('0xae')]);if(_0xb64850['account']['Applications']){delete _0xb64850[_0x898a('0xa9')][_0x898a('0xac')];}_0xb64850[_0x898a('0xaf')]=_0x4e5adf[_0x898a('0xb0')]||{'id':_0x4e5adf[_0x898a('0xa3')]};if(_0xb64850[_0x898a('0xaf')]&&_0xb64850[_0x898a('0xaf')][_0x898a('0xa6')][_0x898a('0x4e')]){return _0xb64850[_0x898a('0xaf')][_0x898a('0xa6')][0x0];}var _0x271a04=_[_0x898a('0xb1')](_0x4e759e['body'],{'firstName':_0x4e759e[_0x898a('0x61')]['from'],'ListId':_0x4e5adf[_0x898a('0xa3')]});_0x271a04[_0x4e759e[_0x898a('0x61')]['mapKey']]=_0x4e759e[_0x898a('0x61')][_0x898a('0x96')];return db['CmContact']['create'](_0x271a04,{'fields':_0x51c0c2,'raw':!![]});})[_0x898a('0x2e')](function(_0x4a791f){_0xb64850['contact']=_0x4a791f;var _0x2e0593=createInteractionObject(_0x4e759e[_0x898a('0x5b')]['id'],_0x4e759e[_0x898a('0x61')],_0x4e759e['headers'],_0x4a791f);var _0x2f675e={'ChatWebsiteId':_0x4e759e[_0x898a('0x5b')]['id']};if(_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')]){_0x2f675e[_0x898a('0xb2')]=_0x4e759e['body'][_0x898a('0xb2')];_0x2f675e[_0x898a('0xb3')]=![];return db[_0x898a('0xb4')][_0x898a('0x5f')]({'where':_0x2f675e})[_0x898a('0x2e')](function(_0x539518){var _0x3bd71e=_0x4e759e[_0x898a('0x61')][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];if(_0x539518){_0xb1d9c4=!![];return _0x539518;}else if(!_0x3bd71e&&_0x539518&&_0x539518[_0x898a('0xb3')]){throw new APIConflictError(_0x898a('0xb5'));}_0x2e0593[_0x898a('0xb2')]=_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')];_0x2e0593[_0x898a('0xb6')]=_0x4e759e['body'][_0x898a('0xb6')];return db[_0x898a('0xb4')][_0x898a('0x60')](_0x2e0593);});}_0x2f675e[_0x898a('0xb7')]=_0x4a791f['id'];if(_0x4e759e[_0x898a('0x61')][_0x898a('0xb8')]&&_0x4e759e[_0x898a('0x61')]['interaction']['id']){_0x2f675e['id']=_0x4e759e[_0x898a('0x61')]['interaction']['id'];return db[_0x898a('0xb4')][_0x898a('0x5f')]({'where':_0x2f675e})[_0x898a('0x2e')](function(_0x5acc72){var _0x55b9ca=_0x4e759e[_0x898a('0x61')][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];if(!_0x55b9ca&&_0x5acc72&&_0x5acc72[_0x898a('0xb3')]){throw new APIConflictError(_0x898a('0xb5'));}else if(_0x5acc72){_0xb1d9c4=!![];return _0x5acc72;}else{return db[_0x898a('0xb4')][_0x898a('0x60')](_0x2e0593);}});}return db['ChatInteraction'][_0x898a('0x60')](_0x2e0593);})[_0x898a('0x2e')](function(_0x390503){if(!_0xb1d9c4){return _0x390503;}var _0x237a1c={'from':(_0xb64850['contact']['firstName']||'')+'\x20'+(_0xb64850[_0x898a('0xb9')][_0x898a('0x37')]||'')};if(_0x4e759e[_0x898a('0x61')]['threadId']&&_0x4e759e[_0x898a('0x61')]['messageId']&&_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')]!=_0x4e759e[_0x898a('0x61')][_0x898a('0xba')]){_0x237a1c[_0x898a('0xb2')]=_0x4e759e[_0x898a('0x61')]['messageId'];}return _0x390503[_0x898a('0x29')](_0x237a1c);})[_0x898a('0x2e')](function(_0x1d6dff){_0xb64850['interaction']=_0x1d6dff['get']({'plain':!![]});_0xb64850[_0x898a('0xb8')]['created']=!_0xb1d9c4;if(_0xb64850[_0x898a('0xb8')][_0x898a('0xbb')]){if(_0xb64850[_0x898a('0xa9')][_0x898a('0xbc')]){_0xb64850[_0x898a('0xaa')]['push']({'id':0x0,'priority':_0xb64850[_0x898a('0xaa')][_0x898a('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x898a('0xbd')});}}return db[_0x898a('0xbe')][_0x898a('0x60')]({'body':_0x4e759e[_0x898a('0x61')][_0x898a('0x61')],'ChatWebsiteId':_0x4e759e['params']['id'],'ChatInteractionId':_0x1d6dff['id'],'direction':'in','ContactId':_0xb64850[_0x898a('0xb9')]['id'],'AttachmentId':_0x4e759e[_0x898a('0x61')][_0x898a('0xbf')]});})[_0x898a('0x2e')](function(_0x4b0c1b){_0xb64850[_0x898a('0x1e')]=_0x4b0c1b;if(!_0xb64850[_0x898a('0xb8')][_0x898a('0xc0')]){return;}return db[_0x898a('0xc1')][_0x898a('0x5f')]({'attributes':['id','name'],'where':{'id':_0xb64850['interaction'][_0x898a('0xc0')]}});})[_0x898a('0x2e')](function(_0x24366d){if(_0x24366d){_0xb64850[_0x898a('0xaa')][_0x898a('0xc2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x24366d[_0x898a('0x30')]+','+(_0xb64850[_0x898a('0xa9')][_0x898a('0xc3')]||0xa),'interval':_0x898a('0xbd')});_0xb64850[_0x898a('0xc4')]=!![];}if(!_0xb64850[_0x898a('0xb8')][_0x898a('0xc5')]){return;}return db[_0x898a('0xc6')][_0x898a('0x5f')]({'attributes':['id',_0x898a('0x30')],'where':{'id':_0xb64850[_0x898a('0xb8')][_0x898a('0xc5')]}});})[_0x898a('0x2e')](function(_0x46f2c5){if(_0x46f2c5){_0xb64850['applications'][_0x898a('0xc2')]({'id':0x0,'priority':0x1,'app':_0x898a('0xc7'),'appdata':_0x46f2c5[_0x898a('0x30')]+','+(_0xb64850[_0x898a('0xa9')][_0x898a('0xc8')]||0x12c),'interval':_0x898a('0xbd')});}return respondWithRpcPromise(_0x898a('0xc9'),_0x898a('0xca'),_0xb64850);})['then'](function(_0x2ca7ee){respondWithRpcPromise(_0x898a('0xcb'),_0x898a('0xcb'),{'event':'notify','message':_0x2ca7ee},client9002);return _0x2ca7ee;})[_0x898a('0x2e')](respondWithResult(_0x4f1ff1,null))[_0x898a('0x20')](APIHandleError(_0x4f1ff1));};exports['offline']=function(_0xf8a823,_0x3dc746){var _0x3ed2bf,_0x1def1b,_0x2ffba3;var _0x12ff13=[];var _0x2314a2={};var _0x2c5037=_0xf8a823[_0x898a('0xcc')]||[];var _0x57f3e1=[];var _0x230030;return db[_0x898a('0x9d')][_0x898a('0x6d')]()[_0x898a('0x2e')](function(_0x9a3e8c){if(!_0x9a3e8c){throw new db[(_0x898a('0xcd'))]['ValidationError'](_0x898a('0xce'));}_0x12ff13=_[_0x898a('0xcf')](_[_0x898a('0x49')](_0x9a3e8c),[_0x898a('0x9f'),_0x898a('0xa0'),_0x898a('0xa2'),'ListId']);if(_0xf8a823[_0x898a('0x61')]['id']){delete _0xf8a823[_0x898a('0x61')]['id'];}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0x96')])){throw _0x3dc746['status'](0x1f4)['send'](new db['Sequelize'][(_0x898a('0xd0'))]('from\x20is\x20mandatory'));}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0x61')])||_0xf8a823[_0x898a('0x61')][_0x898a('0x61')]===''){throw _0x3dc746[_0x898a('0x22')](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))][(_0x898a('0xd0'))](_0x898a('0xd2')));}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0xd3')])){throw _0x3dc746['status'](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))]['ValidationError'](_0x898a('0xd4')+_0x12ff13));}if(!_[_0x898a('0xa1')](_0x12ff13,_0xf8a823[_0x898a('0x61')][_0x898a('0xd3')])){throw _0x3dc746[_0x898a('0x22')](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))][(_0x898a('0xd0'))](_0x898a('0xd5')+_0x12ff13));}_0x2314a2[_0xf8a823['body'][_0x898a('0xd3')]]=_0xf8a823[_0x898a('0x61')][_0x898a('0x96')];})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0xf8a823[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0xa5')],'as':_0x898a('0xb0')},{'model':db[_0x898a('0xd6')],'as':_0x898a('0xd6')}]});})[_0x898a('0x2e')](handleEntityNotFound(_0x3dc746,null))[_0x898a('0x2e')](function(_0x3549f6){if(_0x3549f6&&_0x3549f6[_0x898a('0xb0')]){_0x1def1b=_0x3549f6;var _0x95287e=_[_0x898a('0xb1')](_0xf8a823['body'],{'firstName':_0xf8a823['body']['from'],'phone':_0xf8a823[_0x898a('0x61')][_0x898a('0x96')],'ListId':_0x3549f6[_0x898a('0xa3')]});_0x95287e[_0xf8a823[_0x898a('0x61')]['mapKeyOffline']]=_0xf8a823['body'][_0x898a('0x96')];return db[_0x898a('0x9d')][_0x898a('0xd7')]({'where':_0x2314a2,'defaults':_0x95287e});}})[_0x898a('0xd8')](function(_0xaa3b87){if(_0xaa3b87){_0x2ffba3=_0xaa3b87;var _0x1b4b54=fs['readFileSync'](path[_0x898a('0x82')](config['root'],_0x898a('0xd9')),'utf8');var _0x4d1b8b=ejs[_0x898a('0xda')](_0x1b4b54,{'body':_['toPairs'](_0xf8a823[_0x898a('0x61')][_0x898a('0x61')]),'bodyTitle':_0x1def1b[_0x898a('0xdb')]});return db[_0x898a('0xdc')][_0x898a('0x60')]({'body':_0x4d1b8b,'plainBody':htmlToText[_0x898a('0xdd')](_0x4d1b8b),'ContactId':_0xaa3b87['id'],'ChatWebsiteId':_0x1def1b['id']});}})[_0x898a('0x2e')](function(_0x3da4a5){_0x230030=_0x3da4a5;if(_0x2c5037['length']){var _0x194181=_0x2c5037['map'](function(_0x15663d){return{'name':_0x15663d[_0x898a('0xde')],'basename':_0x15663d[_0x898a('0x7b')],'type':_0x15663d[_0x898a('0xdf')],'ChatOfflineMessageId':_0x3da4a5['id']};});_0x57f3e1=_0x194181[_0x898a('0x45')](_0x4da5c9=>{var _0x2ae8b6={'filename':_0x4da5c9[_0x898a('0x30')],'path':path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0xe0'),'files',_0x898a('0xe1'),'offline-chat',_0x4da5c9['basename'])};return _0x2ae8b6;});if(!_0x1def1b[_0x898a('0xe2')]){return db[_0x898a('0xe3')][_0x898a('0xe4')](function(_0x3ab9b6){return db[_0x898a('0xe5')][_0x898a('0xe6')](_0x194181,{'transaction':_0x3ab9b6});});}}})[_0x898a('0x2e')](function(){if(_0x230030){_0x3ed2bf=_0x230030;return db[_0x898a('0xd6')][_0x898a('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x898a('0xe7')],'as':_0x898a('0xe8'),'raw':!![],'include':[{'model':db[_0x898a('0xe9')],'as':_0x898a('0xe9'),'raw':!![]}]}]});}})['then'](function(_0x4b2f30){if(_0x4b2f30&&_0x4b2f30[_0x898a('0xe8')]&&_0x1def1b['forwardOffline']&&_0x1def1b[_0x898a('0xea')]){var _0x216e76=_0x4b2f30['getSmtpOptions']();return respondWithRpcPromise(_0x898a('0xeb'),_0x898a('0xec'),{'account':_0x216e76,'message':{'from':util[_0x898a('0x3b')](_0x898a('0xed'),_0x4b2f30[_0x898a('0x30')],_0x4b2f30['email']||_0x4b2f30[_0x898a('0xe8')][_0x898a('0x66')]),'to':_0x1def1b[_0x898a('0xea')],'subject':_0x1def1b[_0x898a('0xee')],'html':_0x3ed2bf[_0x898a('0x61')],'attachments':_0x57f3e1}},client9003)[_0x898a('0x2e')](function(){return _0x3ed2bf;})[_0x898a('0x20')](function(_0x179513){logger[_0x898a('0x1d')](_0x179513);});}})[_0x898a('0x2e')](function(){if(_0x1def1b&&_0x1def1b[_0x898a('0xe2')]&&_0x1def1b[_0x898a('0xef')]){var _0x3d85b2=[];if(_0x2c5037[_0x898a('0x4e')]){_0x3d85b2=_0x2c5037[_0x898a('0x45')](function(_0x3065a2){return{'name':_0x3065a2[_0x898a('0xde')],'basename':_0x3065a2[_0x898a('0x7b')],'type':_0x3065a2['mimetype'],'ChatOfflineMessageId':_0x230030['id']};});}var _0x4dd1aa;if(!_[_0x898a('0x8c')](_0x1def1b['subjectOffline'])){var _0x46696c=_[_0x898a('0x45')](_0xf8a823[_0x898a('0x61')],function(_0x1fefd0){return _0x1fefd0;});var _0x244b0e=_['toPairsIn'](_0x46696c)[0x0];var _0x2ba5f8=_['mapValues'](_0x244b0e,function(_0x3c46d2){return _0x3c46d2;});_0x4dd1aa=_0x2ba5f8[0x1][_0x1def1b['subjectOffline']];}var _0x44f4c3={'from':_0x2ffba3[_0x898a('0xf0')],'firstName':_0x2ffba3[_0x898a('0xf1')],'lastName':_0x2ffba3[_0x898a('0x37')],'mapKey':_0x898a('0xf0'),'message':{'from':_0x2ffba3[_0x898a('0xf0')],'to':_0x1def1b['MailAccount'][_0x898a('0xf0')],'cc':'','subject':_['isNil'](_0x4dd1aa)?_0x1def1b['offlineMessageSubject']:_0x4dd1aa,'messageId':'','sentAt':new Date(),'attach':_0x3d85b2[_0x898a('0x4e')],'attachments':_0x3d85b2,'originChannel':_0x898a('0xf2'),'ChatWebsiteId':_0x1def1b['id'],'ChatOfflineMessageId':_0x3ed2bf['id'],'originTo':_0x1def1b['MailAccount'][_0x898a('0xf0')]},'body':_0x3ed2bf[_0x898a('0x61')]};var _0x4663fe={'account':{'id':_0x1def1b[_0x898a('0xef')]},'body':_0x44f4c3,'log':_0x898a('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0x898a('0xf4'),_0x4663fe,client9001)[_0x898a('0x2e')](function(){return _0x3ed2bf;})[_0x898a('0x20')](function(_0x456365){logger['error'](_0x456365);});}return;})[_0x898a('0x2e')](function(){if(_0x3ed2bf){return _0x3ed2bf;}})['then'](respondWithResult(_0x3dc746,null))[_0x898a('0x20')](function(){for(var _0x3712b0 of _0x2c5037){var _0x51f314=path['join'](config[_0x898a('0x88')],_0x898a('0xe0'),'files',_0x898a('0xe1'),'offline-chat',_0x3712b0[_0x898a('0x7b')]);fs_extra[_0x898a('0xf5')](_0x51f314)[_0x898a('0x20')](function(_0x4fc478){logger[_0x898a('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x51f314,_0x4fc478);});}});};exports[_0x898a('0xf6')]=function(_0x351def,_0x51ede4){return db[_0x898a('0xb4')]['find']({'where':{'id':_0x351def[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x51ede4,null))[_0x898a('0x2e')](function(_0x2e6706){if(_0x2e6706){return _0x2e6706['addInteraction'](_0x351def[_0x898a('0x61')][_0x898a('0x74')],_[_0x898a('0xf7')](_0x351def[_0x898a('0x61')],[_0x898a('0x74'),'id'])||{});}})[_0x898a('0x2e')](respondWithResult(_0x51ede4,null))[_0x898a('0x20')](handleError(_0x51ede4,null));};exports[_0x898a('0xf8')]=function(_0x19e347,_0x19c8ca){var _0x47a5bf={'raw':![],'where':{}};var _0xcc083a={};var _0x1370aa={'count':0x0,'rows':[]};return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x19e347['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x19c8ca,null))[_0x898a('0x2e')](function(_0x349289){if(_0x349289){_0xcc083a[_0x898a('0x41')]=_['keys'](db['ChatInteraction'][_0x898a('0x5d')]);_0xcc083a[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x19e347[_0x898a('0x4a')]);_0xcc083a['filters']=_[_0x898a('0x4b')](_0xcc083a[_0x898a('0x41')],_0xcc083a[_0x898a('0x4a')]);_0x47a5bf[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0xcc083a['model'],qs[_0x898a('0x4d')](_0x19e347[_0x898a('0x4a')][_0x898a('0x4d')]));_0x47a5bf[_0x898a('0x4c')]=_0x47a5bf[_0x898a('0x4c')]['length']?_0x47a5bf[_0x898a('0x4c')]:_0xcc083a['model'];if(!_0x19e347['query'][_0x898a('0x72')](_0x898a('0x4f'))){_0x47a5bf[_0x898a('0x24')]=qs['limit'](_0x19e347['query'][_0x898a('0x24')]);_0x47a5bf[_0x898a('0x27')]=qs['offset'](_0x19e347[_0x898a('0x4a')][_0x898a('0x27')]);}_0x47a5bf[_0x898a('0x50')]=qs['sort'](_0x19e347[_0x898a('0x4a')][_0x898a('0x51')]);_0x47a5bf[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x19e347[_0x898a('0x4a')],_0xcc083a[_0x898a('0x53')]));_0x47a5bf[_0x898a('0x52')]['ChatWebsiteId']=_0x349289['id'];if(_0x19e347[_0x898a('0x4a')][_0x898a('0x55')]){_0x47a5bf[_0x898a('0x52')]=_['merge'](_0x47a5bf[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x47a5bf[_0x898a('0x4c')],function(_0x9ddbdd){var _0x2f3fba={};_0x2f3fba[_0x9ddbdd]={'$like':'%'+_0x19e347[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x2f3fba;})});}_0x47a5bf=_[_0x898a('0x56')]({},_0x47a5bf,_0x19e347['options']);return db['ChatInteraction']['count']({'where':_0x47a5bf[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0x77571d){_0x1370aa[_0x898a('0x26')]=_0x77571d;if(_0x19e347[_0x898a('0x4a')][_0x898a('0x5e')]){_0x47a5bf[_0x898a('0x58')]=[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xf9'),'required':![]},{'model':db[_0x898a('0xc1')],'as':_0x898a('0xfa'),'attributes':[_0x898a('0x30'),_0x898a('0xfb'),_0x898a('0xfc')],'required':![]},{'model':db[_0x898a('0xfd')],'as':'Tags','attributes':['id',_0x898a('0x30'),_0x898a('0xfe')],'where':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]?{'id':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]}:undefined,'required':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]?!![]:![]}];}return db[_0x898a('0xb4')]['findAll'](_0x47a5bf);})[_0x898a('0x2e')](function(_0x33cf8c){_0x1370aa[_0x898a('0x5a')]=_0x33cf8c;return _0x1370aa;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0x19c8ca,_0x47a5bf))[_0x898a('0x20')](handleError(_0x19c8ca,null));};exports[_0x898a('0x100')]=function(_0x3bdd73,_0x51691a){var _0x4fede7=0x0;var _0x2ee5e0=0x0;var _0x47dece=![];var _0x33ab74;var _0xfc0299;return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x3bdd73[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0x91')],'as':_0x898a('0x91'),'include':[{'model':db[_0x898a('0x91')],'as':_0x898a('0x101'),'attributes':['id',_0x898a('0xa8')]}]}]})['then'](handleEntityNotFound(_0x51691a,null))['then'](function(_0x284113){if(_0x284113){_0x33ab74=_0x284113;return _0x284113[_0x898a('0x102')]({'raw':!![]});}})[_0x898a('0x2e')](function(_0x16e208){if(_0x33ab74){if(_0x16e208){_0xfc0299=_0x16e208;}}return require(_0x898a('0x84'))['getLicense']();})[_0x898a('0x2e')](function(_0x18ac46){if(_0x18ac46){_0x2ee5e0=_0x18ac46[_0x898a('0x103')];_0x47dece=_0x18ac46[_0x898a('0x86')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x898a('0x2e')](function(_0x481584){_0x4fede7=_0x481584;if(_0x2ee5e0&&_0x481584>_0x2ee5e0){return db[_0x898a('0x104')][_0x898a('0x70')]({'where':{'id':0x1}})[_0x898a('0x2e')](function(_0x228aa0){if(_0x228aa0){_0x228aa0[_0x898a('0x105')](_0x898a('0x106'));}});}})['then'](function(){var _0x43ff97=_0x33ab74[_0x898a('0x91')];var _0x1bdfd2=_0x33ab74[_0x898a('0x93')]||undefined;return _0x43ff97?_0x43ff97[_0x898a('0x94')](_0x1bdfd2):!![];})[_0x898a('0x2e')](function(_0x41d16d){var _0x275c04=fs['readFileSync'](path[_0x898a('0x82')](config[_0x898a('0x88')],'server/files/chat/iframe.ejs'),_0x898a('0x107'));var _0x22ebe9=_0x898a('0x108');var _0x355f0c=![];var _0x2b10c4,_0x3d1004;if(_0x3bdd73[_0x898a('0x109')][_0x898a('0x9c')]){_0x2b10c4=new URL(_0x3bdd73['headers'][_0x898a('0x9c')])['origin'];}else if(_0x3bdd73[_0x898a('0x109')][_0x898a('0x10a')]){_0x2b10c4=new URL(_0x3bdd73['headers'][_0x898a('0x10a')])[_0x898a('0x10a')];}else{_0x2b10c4=_0x898a('0x10b');}_0x3d1004=typeof _0x33ab74[_0x898a('0x6a')][_0x898a('0x36')](',')[_0x898a('0x5f')](function(_0x4bbe0d){return wildcardUtils['testWebsiteWithWildcard'](_0x4bbe0d,_0x2b10c4);})!==_0x898a('0x25');var _0x575c4c={'chatVersion':_0x22ebe9,'chatWebsiteAddressOrigin':_0x3d1004?_0x2b10c4:_0x33ab74['address'],'remote':_0x33ab74['remote'],'query':querystring[_0x898a('0x1c')](_[_0x898a('0x56')](_0x33ab74[_0x898a('0x2b')]({'plain':!![]}),{'customerIp':_0x3bdd73[_0x898a('0x109')][_0x898a('0x34')]||_0x3bdd73['headers'][_0x898a('0x10c')]||_0x3bdd73['connection']['remoteAddress']||_0x3bdd73['ip'],'referer':_0x3bdd73[_0x898a('0x109')][_0x898a('0x9c')],'openedInteractions':_0x4fede7,'maxInteractions':_0x2ee5e0,'virtual':_0x47dece['virtual'],'online':_0x41d16d,'custom':_0x47dece,'address':_0x3d1004?_0x2b10c4:null}))['replace'](/'/g,'\x5c\x27')};_0x51691a[_0x898a('0xd1')](ejs[_0x898a('0xda')](Mustache['render'](_0x275c04,_0x575c4c),{'proactiveActions':_0xfc0299,'alignment':_0x33ab74['alignment'],'verticalAlignment':_0x33ab74[_0x898a('0x10d')],'div_color':_0x33ab74['color'],'labelText':_0x33ab74['labelText'],'text_color':_0x33ab74['textColor'],'text_button_color':_0x33ab74[_0x898a('0x10e')],'button_color':_0x33ab74[_0x898a('0x10f')],'background_color':_0x33ab74[_0x898a('0x110')],'hideWhenOffline':_0x33ab74['hideWhenOffline'],'intervalId':_0x33ab74[_0x898a('0x111')],'isDevelopment':_0x355f0c,'chatVersion':_0x22ebe9}));})[_0x898a('0x20')](handleError(_0x51691a,null));};exports['addApplications']=function(_0x4dbc0e,_0x2d4890){var _0x1f1d55=_0x4dbc0e[_0x898a('0x5b')]['id'];var _0x1d1f9c=_0x4dbc0e[_0x898a('0x61')];var _0x358118=0xc8;var _0xd58e7d=null;return db[_0x898a('0xe3')][_0x898a('0xe4')]({'isolationLevel':db[_0x898a('0xe3')]['Transaction'][_0x898a('0x112')][_0x898a('0x113')]},function(_0x4a0e51){return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x1f1d55},'transaction':_0x4a0e51})[_0x898a('0x2e')](function(_0x725e3f){if(_0x725e3f){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x1f1d55},'transaction':_0x4a0e51})['then'](function(){var _0x347450=_[_0x898a('0x45')](_0x1d1f9c,function(_0x343bf3){_0x343bf3[_0x898a('0x6f')]=_0x1f1d55;return _0x343bf3;});return db['ChatApplication']['bulkCreate'](_0x347450,{'transaction':_0x4a0e51});});}else{_0x358118=0x194;_0xd58e7d=[];}});})[_0x898a('0x2e')](function(){if(_0x358118!==0x194){return db[_0x898a('0xa7')][_0x898a('0x114')]({'where':{'ChatWebsiteId':_0x1f1d55},'order':'priority'})['then'](function(_0x8b63e0){_0xd58e7d=_0x8b63e0;});}})[_0x898a('0x20')](function(_0x21a249){_0x358118=0x1f4;logger[_0x898a('0x1d')](_0x21a249[_0x898a('0x115')]);if(_0x21a249[_0x898a('0x30')]){delete _0x21a249[_0x898a('0x30')];}_0xd58e7d=_0x21a249;})[_0x898a('0x116')](function(){if(_0xd58e7d===null){_0x2d4890[_0x898a('0x2f')](_0x358118);}else{if(_0x358118===0x1f4){_0x2d4890[_0x898a('0x22')](_0x358118)['send'](_0xd58e7d);}else{_0x2d4890[_0x898a('0x22')](_0x358118)[_0x898a('0x23')](_0xd58e7d);}}});};exports[_0x898a('0x117')]=function(_0x26bc49,_0x1ed373){var _0x59200f={};var _0x3b84bb={};var _0x1b5e6a;var _0x210f31;return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x26bc49['params']['id']}})['then'](handleEntityNotFound(_0x1ed373,null))[_0x898a('0x2e')](function(_0x1e57a2){if(_0x1e57a2){_0x1b5e6a=_0x1e57a2;_0x3b84bb['model']=_[_0x898a('0x49')](db['ChatApplication'][_0x898a('0x5d')]);_0x3b84bb[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x26bc49['query']);_0x3b84bb[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x3b84bb[_0x898a('0x41')],_0x3b84bb['query']);_0x59200f[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x3b84bb[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x26bc49[_0x898a('0x4a')][_0x898a('0x4d')]));_0x59200f[_0x898a('0x4c')]=_0x59200f[_0x898a('0x4c')][_0x898a('0x4e')]?_0x59200f[_0x898a('0x4c')]:_0x3b84bb[_0x898a('0x41')];_0x59200f[_0x898a('0x50')]=qs['sort'](_0x26bc49[_0x898a('0x4a')]['sort']);_0x59200f[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x26bc49[_0x898a('0x4a')],_0x3b84bb[_0x898a('0x53')]));if(_0x26bc49['query'][_0x898a('0x55')]){_0x59200f[_0x898a('0x52')]=_[_0x898a('0x56')](_0x59200f[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x59200f[_0x898a('0x4c')],function(_0x5db4ae){var _0xa752f6={};_0xa752f6[_0x5db4ae]={'$like':'%'+_0x26bc49[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0xa752f6;})});}_0x59200f=_[_0x898a('0x56')]({},_0x59200f,_0x26bc49[_0x898a('0x57')]);return _0x1b5e6a[_0x898a('0x117')](_0x59200f);}})[_0x898a('0x2e')](function(_0x2caedd){if(_0x2caedd){_0x210f31=_0x2caedd[_0x898a('0x4e')];if(!_0x26bc49['query']['hasOwnProperty']('nolimit')){_0x59200f[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x26bc49[_0x898a('0x4a')][_0x898a('0x24')]);_0x59200f[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x26bc49['query']['offset']);}return _0x1b5e6a['getApplications'](_0x59200f);}})[_0x898a('0x2e')](function(_0x514f08){if(_0x514f08){return _0x514f08?{'count':_0x210f31,'rows':_0x514f08}:null;}})[_0x898a('0x2e')](respondWithResult(_0x1ed373,null))[_0x898a('0x20')](handleError(_0x1ed373,null));};exports[_0x898a('0x118')]=function(_0x3930bd,_0xaa6842){return db[_0x898a('0x119')][_0x898a('0x5f')]({'where':{'id':_0x3930bd[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0xaa6842,null))[_0x898a('0x2e')](function(_0x162efb){if(_0x162efb){return _0x162efb[_0x898a('0x118')](_0x3930bd[_0x898a('0x61')][_0x898a('0x74')],_['omit'](_0x3930bd[_0x898a('0x61')],['ids','id'])||{});}})[_0x898a('0x2e')](respondWithResult(_0xaa6842,null))[_0x898a('0x20')](handleError(_0xaa6842,null));};exports[_0x898a('0x102')]=function(_0x5710fc,_0x3347f0){var _0x4fe5a6={};var _0xf18619={};var _0x59e163;var _0x2c56ff;return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x5710fc[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x3347f0,null))[_0x898a('0x2e')](function(_0x1e2d7a){if(_0x1e2d7a){_0x59e163=_0x1e2d7a;_0xf18619['model']=_['keys'](db['ChatProactiveAction'][_0x898a('0x5d')]);_0xf18619[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x5710fc[_0x898a('0x4a')]);_0xf18619[_0x898a('0x53')]=_[_0x898a('0x4b')](_0xf18619[_0x898a('0x41')],_0xf18619[_0x898a('0x4a')]);_0x4fe5a6[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0xf18619['model'],qs[_0x898a('0x4d')](_0x5710fc['query'][_0x898a('0x4d')]));_0x4fe5a6[_0x898a('0x4c')]=_0x4fe5a6[_0x898a('0x4c')][_0x898a('0x4e')]?_0x4fe5a6[_0x898a('0x4c')]:_0xf18619[_0x898a('0x41')];_0x4fe5a6[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x5710fc[_0x898a('0x4a')][_0x898a('0x51')]);_0x4fe5a6[_0x898a('0x52')]=qs['filters'](_['pick'](_0x5710fc[_0x898a('0x4a')],_0xf18619['filters']));if(_0x5710fc[_0x898a('0x4a')][_0x898a('0x55')]){_0x4fe5a6[_0x898a('0x52')]=_[_0x898a('0x56')](_0x4fe5a6[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x4fe5a6['attributes'],function(_0x360da6){var _0x24bec4={};_0x24bec4[_0x360da6]={'$like':'%'+_0x5710fc[_0x898a('0x4a')]['filter']+'%'};return _0x24bec4;})});}_0x4fe5a6=_[_0x898a('0x56')]({},_0x4fe5a6,_0x5710fc[_0x898a('0x57')]);return _0x59e163[_0x898a('0x102')](_0x4fe5a6);}})[_0x898a('0x2e')](function(_0x26afad){if(_0x26afad){_0x2c56ff=_0x26afad[_0x898a('0x4e')];if(!_0x5710fc[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x4fe5a6['limit']=qs[_0x898a('0x24')](_0x5710fc[_0x898a('0x4a')]['limit']);_0x4fe5a6[_0x898a('0x27')]=qs['offset'](_0x5710fc[_0x898a('0x4a')][_0x898a('0x27')]);}return _0x59e163['getProactiveActions'](_0x4fe5a6);}})[_0x898a('0x2e')](function(_0x2213f4){if(_0x2213f4){return _0x2213f4?{'count':_0x2c56ff,'rows':_0x2213f4}:null;}})[_0x898a('0x2e')](respondWithResult(_0x3347f0,null))[_0x898a('0x20')](handleError(_0x3347f0,null));};exports[_0x898a('0x11a')]=function(_0x526133,_0x555cae){var _0x361eba=_0x526133['query'][_0x898a('0x11b')]==='false'?_0x898a('0x11c'):_0x898a('0x11d');return db[_0x898a('0x46')]['find']({'attributes':['id',_0x361eba],'where':{'id':_0x526133['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x555cae,null))[_0x898a('0x2e')](function(_0x1d430e){if(_0x1d430e){var _0x18c54f=_0x1d430e[_0x361eba];var _0x14c03e=_0x18c54f&&_0x18c54f[_0x898a('0x11e')]?_0x18c54f[_0x898a('0x11e')]:[];_0x555cae[_0x898a('0xd1')]({'fromKey':_[_0x898a('0x8c')](_0x18c54f['fromKey'])?undefined:_0x18c54f[_0x898a('0x11f')],'count':_0x14c03e['length'],'rows':_0x14c03e});}})[_0x898a('0x20')](handleError(_0x555cae,null));};exports[_0x898a('0x120')]=function(_0x545403,_0x546610){var _0x1e4625={'raw':![],'where':{}};var _0x405be4={};var _0x1b1e9a={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x545403[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x546610,null))[_0x898a('0x2e')](function(_0x521d01){if(_0x521d01){_0x405be4[_0x898a('0x41')]=_[_0x898a('0x49')](db[_0x898a('0xdc')]['rawAttributes']);_0x405be4[_0x898a('0x4a')]=_['keys'](_0x545403[_0x898a('0x4a')]);_0x405be4[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x405be4[_0x898a('0x41')],_0x405be4[_0x898a('0x4a')]);_0x1e4625[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x405be4['model'],qs[_0x898a('0x4d')](_0x545403[_0x898a('0x4a')][_0x898a('0x4d')]));_0x1e4625[_0x898a('0x4c')]=_0x1e4625[_0x898a('0x4c')][_0x898a('0x4e')]?_0x1e4625[_0x898a('0x4c')]:_0x405be4[_0x898a('0x41')];if(!_0x545403['query'][_0x898a('0x72')]('nolimit')){_0x1e4625['limit']=qs['limit'](_0x545403[_0x898a('0x4a')][_0x898a('0x24')]);_0x1e4625[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x545403[_0x898a('0x4a')][_0x898a('0x27')]);}_0x1e4625[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x545403['query'][_0x898a('0x51')]);_0x1e4625[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x545403[_0x898a('0x4a')],_0x405be4['filters']));_0x1e4625[_0x898a('0x52')]['ChatWebsiteId']=_0x521d01['id'];if(_0x545403[_0x898a('0x4a')][_0x898a('0x55')]){_0x1e4625[_0x898a('0x52')]=_[_0x898a('0x56')](_0x1e4625['where'],{'$or':_[_0x898a('0x45')](_0x1e4625[_0x898a('0x4c')],function(_0x525d61){var _0x844e5e={};_0x844e5e[_0x525d61]={'$like':'%'+_0x545403[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x844e5e;})});}_0x1e4625=_[_0x898a('0x56')]({},_0x1e4625,_0x545403[_0x898a('0x57')]);return db[_0x898a('0xdc')][_0x898a('0x26')]({'where':_0x1e4625[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0x10be38){_0x1b1e9a[_0x898a('0x26')]=_0x10be38;if(_0x545403[_0x898a('0x4a')][_0x898a('0x5e')]){_0x1e4625['include']=[{'all':!![]}];}else{_0x1e4625[_0x898a('0x58')]=[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xf9'),'required':![]},{'model':db['Attachment'],'as':_0x898a('0x121'),'required':![]}];}return db[_0x898a('0xdc')][_0x898a('0x59')](_0x1e4625);})['then'](function(_0x199be5){_0x1b1e9a[_0x898a('0x5a')]=_0x199be5;return _0x1b1e9a;});}})['then'](respondWithFilteredResult(_0x546610,_0x1e4625))[_0x898a('0x20')](handleError(_0x546610,null));};exports[_0x898a('0x122')]=function(_0x13d875,_0x448fd7){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x13d875['params']['id']}})['then'](handleEntityNotFound(_0x448fd7,null))['then'](function(_0x85aa2d){if(_0x85aa2d){return _0x85aa2d['addAgents'](_0x13d875[_0x898a('0x61')]['ids'],_[_0x898a('0xf7')](_0x13d875[_0x898a('0x61')],[_0x898a('0x74'),'id'])||{})['spread'](function(_0x3d092e){for(var _0x4f4e79=0x0;_0x4f4e79<_0x13d875['body']['ids'][_0x898a('0x4e')];_0x4f4e79+=0x1){socket['emit'](_0x898a('0x123'),{'UserId':Number(_0x13d875[_0x898a('0x61')][_0x898a('0x74')][_0x4f4e79]),'ChatWebsiteId':Number(_0x13d875[_0x898a('0x5b')]['id'])});}return _0x3d092e;});}})[_0x898a('0x2e')](respondWithResult(_0x448fd7,null))['catch'](handleError(_0x448fd7,null));};exports[_0x898a('0x124')]=function(_0x27e060,_0x2eff5c){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x27e060[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x2eff5c,null))[_0x898a('0x2e')](function(_0x31e8fa){if(_0x31e8fa){return _0x31e8fa['removeAgents'](_0x27e060[_0x898a('0x4a')][_0x898a('0x74')])['then'](function(){if(_[_0x898a('0x125')](_0x27e060[_0x898a('0x4a')][_0x898a('0x74')])){for(var _0x224868=0x0;_0x224868<_0x27e060[_0x898a('0x4a')][_0x898a('0x74')]['length'];_0x224868+=0x1){socket[_0x898a('0x126')](_0x898a('0x127'),{'UserId':Number(_0x27e060['query'][_0x898a('0x74')][_0x224868]),'ChatWebsiteId':Number(_0x27e060[_0x898a('0x5b')]['id'])});}}else{socket[_0x898a('0x126')](_0x898a('0x127'),{'UserId':Number(_0x27e060[_0x898a('0x4a')][_0x898a('0x74')]),'ChatWebsiteId':Number(_0x27e060['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2eff5c,null))[_0x898a('0x20')](handleError(_0x2eff5c,null));};exports[_0x898a('0x128')]=function(_0x227787,_0x3acb2f){var _0x35737f={};var _0x21c989={};var _0x1c02c5;var _0x1e93fa;return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x227787['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x3acb2f,null))[_0x898a('0x2e')](function(_0x255766){if(_0x255766){_0x1c02c5=_0x255766;_0x21c989[_0x898a('0x41')]=_[_0x898a('0x49')](db[_0x898a('0xc1')][_0x898a('0x5d')]);_0x21c989[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x227787[_0x898a('0x4a')]);_0x21c989['filters']=_['intersection'](_0x21c989[_0x898a('0x41')],_0x21c989['query']);_0x35737f[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x21c989[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x227787['query'][_0x898a('0x4d')]));_0x35737f[_0x898a('0x4c')]=_0x35737f[_0x898a('0x4c')]['length']?_0x35737f[_0x898a('0x4c')]:_0x21c989[_0x898a('0x41')];_0x35737f['order']=qs[_0x898a('0x51')](_0x227787[_0x898a('0x4a')][_0x898a('0x51')]);_0x35737f[_0x898a('0x52')]=qs[_0x898a('0x53')](_['pick'](_0x227787[_0x898a('0x4a')],_0x21c989['filters']));if(_0x227787['query']['filter']){_0x35737f[_0x898a('0x52')]=_[_0x898a('0x56')](_0x35737f[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x35737f[_0x898a('0x4c')],function(_0x3c57ac){var _0x54d0b2={};_0x54d0b2[_0x3c57ac]={'$like':'%'+_0x227787[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x54d0b2;})});}_0x35737f=_[_0x898a('0x56')]({},_0x35737f,_0x227787[_0x898a('0x57')]);return _0x1c02c5['getAgents'](_0x35737f);}})[_0x898a('0x2e')](function(_0x413331){if(_0x413331){_0x1e93fa=_0x413331[_0x898a('0x4e')];if(!_0x227787[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x35737f[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x227787['query'][_0x898a('0x24')]);_0x35737f[_0x898a('0x27')]=qs['offset'](_0x227787[_0x898a('0x4a')][_0x898a('0x27')]);}return _0x1c02c5[_0x898a('0x128')](_0x35737f);}})[_0x898a('0x2e')](function(_0x183ff5){if(_0x183ff5){return _0x183ff5?{'count':_0x1e93fa,'rows':_0x183ff5}:null;}})[_0x898a('0x2e')](respondWithResult(_0x3acb2f,null))[_0x898a('0x20')](handleError(_0x3acb2f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 200a8f3..9569229 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 _0x2392=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x11bb60,_0x3dc734){var _0x37357e=function(_0x1b6a33){while(--_0x1b6a33){_0x11bb60['push'](_0x11bb60['shift']());}};_0x37357e(++_0x3dc734);}(_0x2392,0xd0));var _0x2239=function(_0x2308f0,_0x3e2ecc){_0x2308f0=_0x2308f0-0x0;var _0x9146b=_0x2392[_0x2308f0];return _0x9146b;};'use strict';var EventEmitter=require(_0x2239('0x0'));var ChatWebsite=require(_0x2239('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2239('0x2')](0x0);var events={'afterCreate':_0x2239('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x277193){return function(_0x420e52,_0x3f3b7c,_0x42dcec){ChatWebsiteEvents[_0x2239('0x4')](_0x277193+':'+_0x420e52['id'],_0x420e52);ChatWebsiteEvents[_0x2239('0x4')](_0x277193,_0x420e52);_0x42dcec(null);};}for(var e in events){if(events[_0x2239('0x5')](e)){var event=events[e];ChatWebsite[_0x2239('0x6')](e,emitEvent(event));}}module[_0x2239('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe0c3=['events','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x5327f0,_0x2b7158){var _0x792bfa=function(_0x4ae9c9){while(--_0x4ae9c9){_0x5327f0['push'](_0x5327f0['shift']());}};_0x792bfa(++_0x2b7158);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3e0c('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x3e0c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3e0c('0x2')](0x0);var events={'afterCreate':_0x3e0c('0x3'),'afterUpdate':_0x3e0c('0x4'),'afterDestroy':_0x3e0c('0x5')};function emitEvent(_0x410ec4){return function(_0x31851c,_0x26c964,_0x1a026f){ChatWebsiteEvents['emit'](_0x410ec4+':'+_0x31851c['id'],_0x31851c);ChatWebsiteEvents['emit'](_0x410ec4,_0x31851c);_0x1a026f(null);};}for(var e in events){if(events[_0x3e0c('0x6')](e)){var event=events[e];ChatWebsite[_0x3e0c('0x7')](e,emitEvent(event));}}module[_0x3e0c('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 07e0fad..4d0d228 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 _0x7503=['define','ChatWebsite','chat_websites','../../config/logger','api','moment','rimraf','../../config/environment','exports'];(function(_0x401ade,_0x465ef6){var _0x24c85e=function(_0x43cbc7){while(--_0x43cbc7){_0x401ade['push'](_0x401ade['shift']());}};_0x24c85e(++_0x465ef6);}(_0x7503,0x1e0));var _0x3750=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x7503[_0x414f67];return _0x338537;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3750('0x0'))(_0x3750('0x1'));var moment=require(_0x3750('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3750('0x3'));var config=require(_0x3750('0x4'));var attributes=require('./chatWebsite.attributes');module[_0x3750('0x5')]=function(_0x1bf8db,_0x5ccbe9){return _0x1bf8db[_0x3750('0x6')](_0x3750('0x7'),attributes,{'tableName':_0x3750('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a0c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x37705e,_0x4cb922){var _0x23dd73=function(_0x367f0a){while(--_0x367f0a){_0x37705e['push'](_0x37705e['shift']());}};_0x23dd73(++_0x4cb922);}(_0x8a0c,0xcf));var _0xc8a0=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8a0c[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xc8a0('0x0'));var util=require(_0xc8a0('0x1'));var logger=require(_0xc8a0('0x2'))(_0xc8a0('0x3'));var moment=require(_0xc8a0('0x4'));var BPromise=require(_0xc8a0('0x5'));var rp=require(_0xc8a0('0x6'));var fs=require('fs');var path=require(_0xc8a0('0x7'));var rimraf=require(_0xc8a0('0x8'));var config=require(_0xc8a0('0x9'));var attributes=require('./chatWebsite.attributes');module[_0xc8a0('0xa')]=function(_0x274739,_0x2c0514){return _0x274739[_0xc8a0('0xb')](_0xc8a0('0xc'),attributes,{'tableName':_0xc8a0('0xd'),'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 b82a349..dab4ea2 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 _0xb49a=['../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x550b54,_0x406a8f){var _0x2e7863=function(_0x1659d8){while(--_0x1659d8){_0x550b54['push'](_0x550b54['shift']());}};_0x2e7863(++_0x406a8f);}(_0xb49a,0x9d));var _0xab49=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0xb49a[_0x6d394d];return _0x1f0621;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab49('0x0'));var BPromise=require(_0xab49('0x1'));var rs=require(_0xab49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab49('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab49('0x5'));var client=jayson[_0xab49('0x6')]['http']({'port':0x232a});config[_0xab49('0x7')]=_[_0xab49('0x8')](config[_0xab49('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xab49('0x9'))(new Redis(config[_0xab49('0x7')]));require(_0xab49('0xa'))['register'](socket);function respondWithRpcPromise(_0x3a79fa,_0x394c52,_0x43117b){return new BPromise(function(_0x1a9e6d,_0xd7cc42){return client[_0xab49('0xb')](_0x3a79fa,_0x43117b)[_0xab49('0xc')](function(_0x2bbfcc){logger[_0xab49('0xd')](_0xab49('0xe'),_0x394c52,_0xab49('0xf'));logger[_0xab49('0x10')](_0xab49('0x11'),_0x394c52,'request\x20sent',JSON[_0xab49('0x12')](_0x2bbfcc));if(_0x2bbfcc[_0xab49('0x13')]){if(_0x2bbfcc[_0xab49('0x13')]['code']===0x1f4){logger[_0xab49('0x13')](_0xab49('0xe'),_0x394c52,_0x2bbfcc['error'][_0xab49('0x14')]);return _0xd7cc42(_0x2bbfcc[_0xab49('0x13')][_0xab49('0x14')]);}logger[_0xab49('0x13')](_0xab49('0xe'),_0x394c52,_0x2bbfcc[_0xab49('0x13')]['message']);return _0x1a9e6d(_0x2bbfcc[_0xab49('0x13')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x394c52,_0xab49('0xf'));_0x1a9e6d(_0x2bbfcc[_0xab49('0x15')][_0xab49('0x14')]);}})[_0xab49('0x16')](function(_0x28cd7b){logger[_0xab49('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x394c52,_0x28cd7b);_0xd7cc42(_0x28cd7b);});});} \ No newline at end of file +var _0xeced=['localhost','socket.io-emitter','redis','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xeced,0x92));var _0xdece=function(_0x4f9a55,_0x27f15d){_0x4f9a55=_0x4f9a55-0x0;var _0x4542ba=_0xeced[_0x4f9a55];return _0x4542ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdece('0x0'));var rs=require(_0xdece('0x1'));var fs=require('fs');var Redis=require(_0xdece('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdece('0x3'));var logger=require(_0xdece('0x4'))('rpc');var config=require(_0xdece('0x5'));var jayson=require(_0xdece('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xdece('0x7')](config['redis'],{'host':_0xdece('0x8'),'port':0x18eb});var socket=require(_0xdece('0x9'))(new Redis(config[_0xdece('0xa')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1114f0,_0x47fb9d,_0x2ed10a){return new BPromise(function(_0x2de7a9,_0x17432c){return client['request'](_0x1114f0,_0x2ed10a)[_0xdece('0xb')](function(_0x4f4654){logger[_0xdece('0xc')](_0xdece('0xd'),_0x47fb9d,_0xdece('0xe'));logger[_0xdece('0xf')](_0xdece('0x10'),_0x47fb9d,_0xdece('0xe'),JSON[_0xdece('0x11')](_0x4f4654));if(_0x4f4654[_0xdece('0x12')]){if(_0x4f4654[_0xdece('0x12')][_0xdece('0x13')]===0x1f4){logger[_0xdece('0x12')](_0xdece('0xd'),_0x47fb9d,_0x4f4654[_0xdece('0x12')][_0xdece('0x14')]);return _0x17432c(_0x4f4654[_0xdece('0x12')][_0xdece('0x14')]);}logger[_0xdece('0x12')](_0xdece('0xd'),_0x47fb9d,_0x4f4654[_0xdece('0x12')][_0xdece('0x14')]);return _0x2de7a9(_0x4f4654[_0xdece('0x12')][_0xdece('0x14')]);}else{logger[_0xdece('0xc')](_0xdece('0xd'),_0x47fb9d,_0xdece('0xe'));_0x2de7a9(_0x4f4654['result'][_0xdece('0x14')]);}})[_0xdece('0x15')](function(_0x274965){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x47fb9d,_0x274965);_0x17432c(_0x274965);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a133cef..ba9e8b1 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 _0xfbef=['length','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xfbef,0x69));var _0xffbe=function(_0x31a69c,_0xf01fa5){_0x31a69c=_0x31a69c-0x0;var _0x129a04=_0xfbef[_0x31a69c];return _0x129a04;};'use strict';var ChatWebsiteEvents=require(_0xffbe('0x0'));var events=[_0xffbe('0x1'),_0xffbe('0x2'),_0xffbe('0x3')];function createListener(_0x4e4b04,_0x5b2039){return function(_0x2d8dd7){_0x5b2039[_0xffbe('0x4')](_0x4e4b04,_0x2d8dd7);};}function removeListener(_0x4103ab,_0x27bfb4){return function(){ChatWebsiteEvents[_0xffbe('0x5')](_0x4103ab,_0x27bfb4);};}exports[_0xffbe('0x6')]=function(_0x111d7a){for(var _0x56018e=0x0,_0x1fb5de=events[_0xffbe('0x7')];_0x56018e<_0x1fb5de;_0x56018e++){var _0x468ebf=events[_0x56018e];var _0x5db5e0=createListener('chatWebsite:'+_0x468ebf,_0x111d7a);ChatWebsiteEvents['on'](_0x468ebf,_0x5db5e0);}}; \ No newline at end of file +var _0x6857=['register','length','./chatWebsite.events','save','emit','removeListener'];(function(_0x35e948,_0x434095){var _0xa0faa6=function(_0x1c890d){while(--_0x1c890d){_0x35e948['push'](_0x35e948['shift']());}};_0xa0faa6(++_0x434095);}(_0x6857,0x12e));var _0x7685=function(_0x5a11ea,_0x385b46){_0x5a11ea=_0x5a11ea-0x0;var _0x266b0f=_0x6857[_0x5a11ea];return _0x266b0f;};'use strict';var ChatWebsiteEvents=require(_0x7685('0x0'));var events=[_0x7685('0x1'),'remove','update'];function createListener(_0x29f57d,_0x4c533b){return function(_0x3cdcbc){_0x4c533b[_0x7685('0x2')](_0x29f57d,_0x3cdcbc);};}function removeListener(_0x5af731,_0x398126){return function(){ChatWebsiteEvents[_0x7685('0x3')](_0x5af731,_0x398126);};}exports[_0x7685('0x4')]=function(_0x2bb4a4){for(var _0x5d51c4=0x0,_0x33cdfb=events[_0x7685('0x5')];_0x5d51c4<_0x33cdfb;_0x5d51c4++){var _0x4ee7d1=events[_0x5d51c4];var _0x4d5533=createListener('chatWebsite:'+_0x4ee7d1,_0x2bb4a4);ChatWebsiteEvents['on'](_0x4ee7d1,_0x4d5533);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index e4aa780..bac1fcf 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4a2=['../../../utils/misc','URL','localhost','test','replace','([\x5cw]+)','exports'];(function(_0x5ed5e4,_0x15d7fc){var _0xcc956a=function(_0x53130a){while(--_0x53130a){_0x5ed5e4['push'](_0x5ed5e4['shift']());}};_0xcc956a(++_0x15d7fc);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2b158b,_0x224c8d){_0x2b158b=_0x2b158b-0x0;var _0x46ba5b=_0xd4a2[_0x2b158b];return _0x46ba5b;};var escapeRegExp=require(_0x2d4a('0x0'))['escapeRegExp'];var URL=require('url')[_0x2d4a('0x1')];function testWildcardValidity(_0x576ffe){var _0x2a8a71=!![];try{new URL(_0x576ffe['replace']('*',_0x2d4a('0x2')));}catch(_0x5d435a){_0x2a8a71=![];}return _0x2a8a71&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2d4a('0x3')](_0x576ffe);}function testWebsiteWithWildcard(_0x40d744,_0x2624b5){var _0x3a88e2;var _0x1ca10b=escapeRegExp(_0x40d744['trim']()[_0x2d4a('0x4')](/\/$/,''))[_0x2d4a('0x4')]('\x5c*',_0x2d4a('0x5'));try{new URL(_0x40d744[_0x2d4a('0x4')]('\x5c*',_0x2d4a('0x2')));_0x3a88e2=new RegExp(_0x1ca10b)[_0x2d4a('0x3')](_0x2624b5);}catch(_0xb9f016){_0x3a88e2=![];}return _0x3a88e2;}module[_0x2d4a('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x16a2=['localhost','test','trim','replace','([\x5cw]+)','../../../utils/misc','escapeRegExp','url','URL'];(function(_0x884913,_0x2ef196){var _0x13e338=function(_0x254a09){while(--_0x254a09){_0x884913['push'](_0x884913['shift']());}};_0x13e338(++_0x2ef196);}(_0x16a2,0x1d0));var _0x216a=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x16a2[_0x5c1345];return _0x1c070d;};var escapeRegExp=require(_0x216a('0x0'))[_0x216a('0x1')];var URL=require(_0x216a('0x2'))[_0x216a('0x3')];function testWildcardValidity(_0x194a77){var _0x4fb28f=!![];try{new URL(_0x194a77['replace']('*',_0x216a('0x4')));}catch(_0x22c4a1){_0x4fb28f=![];}return _0x4fb28f&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x216a('0x5')](_0x194a77);}function testWebsiteWithWildcard(_0x188a8d,_0x5d5f57){var _0x4d97cd;var _0x4456ad=escapeRegExp(_0x188a8d[_0x216a('0x6')]()[_0x216a('0x7')](/\/$/,''))['replace']('\x5c*',_0x216a('0x8'));try{new URL(_0x188a8d[_0x216a('0x7')]('\x5c*',_0x216a('0x4')));_0x4d97cd=new RegExp(_0x4456ad)[_0x216a('0x5')](_0x5d5f57);}catch(_0x4ce00d){_0x4d97cd=![];}return _0x4d97cd;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7dc314f..3d29a41 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 _0xcef5=['root','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','server/files/images/avatars/','now','/:id/avatar','file','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','addInteraction','addApplications','/:id/users','addAgents','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','getAgents','post','create','addDisposition','addAnswer','diskStorage','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcef5,0xec));var _0x5cef=function(_0x5115ad,_0x3e199d){_0x5115ad=_0x5115ad-0x0;var _0xa47006=_0xcef5[_0x5115ad];return _0xa47006;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5cef('0x0'));var express=require(_0x5cef('0x1'));var router=express[_0x5cef('0x2')]();var fs_extra=require(_0x5cef('0x3'));var auth=require(_0x5cef('0x4'));var interaction=require(_0x5cef('0x5'));var config=require(_0x5cef('0x6'));var controller=require(_0x5cef('0x7'));router[_0x5cef('0x8')]('/',auth[_0x5cef('0x9')](),controller[_0x5cef('0xa')]);router[_0x5cef('0x8')](_0x5cef('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x5cef('0x9')](),controller[_0x5cef('0xc')]);router[_0x5cef('0x8')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller[_0x5cef('0xe')]);router['get'](_0x5cef('0xf'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x10')]);router[_0x5cef('0x8')](_0x5cef('0x11'),controller[_0x5cef('0x12')]);router[_0x5cef('0x8')]('/:id/avatar',controller[_0x5cef('0x13')]);router['get'](_0x5cef('0x14'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x5cef('0x15')]);router[_0x5cef('0x8')](_0x5cef('0x16'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x17')]);router['get']('/:id/snippet',controller[_0x5cef('0x18')]);router[_0x5cef('0x8')](_0x5cef('0x19'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5cef('0x8')](_0x5cef('0x1a'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x1b')]);router['get']('/:id/fields',controller[_0x5cef('0x1c')]);router[_0x5cef('0x8')]('/:id/offline_messages',auth[_0x5cef('0x9')](),controller['getOfflineMessages']);router[_0x5cef('0x8')]('/:id/users',auth[_0x5cef('0x9')](),controller[_0x5cef('0x1d')]);router[_0x5cef('0x1e')]('/',auth[_0x5cef('0x9')](),controller[_0x5cef('0x1f')]);router[_0x5cef('0x1e')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x20')]);router['post'](_0x5cef('0xf'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x21')]);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x11fe3f,_0x34e478,_0x9413a0){_0x9413a0(null,path[_0x5cef('0x23')](config[_0x5cef('0x24')],_0x5cef('0x25')));},'filename':function(_0x513dd5,_0x1cee41,_0x3511dd){_0x3511dd(null,util[_0x5cef('0x26')](_0x5cef('0x27'),Date['now'](),_0x1cee41[_0x5cef('0x28')]));}})});router['post']('/:id/logo',upload[_0x5cef('0x29')]('file'),controller[_0x5cef('0x2a')]);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x273fc7,_0x3384ea,_0x32b6a8){_0x32b6a8(null,path[_0x5cef('0x23')](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0x51f3a4,_0x3eae48,_0x3f8166){_0x3f8166(null,util[_0x5cef('0x26')]('%s-%s',Date[_0x5cef('0x2c')](),_0x3eae48[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')](_0x5cef('0x2d'),upload[_0x5cef('0x29')](_0x5cef('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x504378,_0x4a5c6f,_0x1cdcb0){_0x1cdcb0(null,path['join'](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0xb7bcdf,_0x59fb69,_0x29088c){_0x29088c(null,util[_0x5cef('0x26')]('%s-%s',Date['now'](),_0x59fb69[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')]('/:id/customer_avatar',upload['single'](_0x5cef('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x333bcf,_0x484ac3,_0x53b6ab){_0x53b6ab(null,path['join'](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0x57af9d,_0x41154e,_0x4d09ca){_0x4d09ca(null,util[_0x5cef('0x26')](_0x5cef('0x27'),Date[_0x5cef('0x2c')](),_0x41154e[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')](_0x5cef('0x2f'),upload[_0x5cef('0x29')](_0x5cef('0x2e')),controller[_0x5cef('0x30')]);router['post'](_0x5cef('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x3b20ba,_0x5f0e6f,_0x1c5b65){const _0x57f868=path[_0x5cef('0x23')](config['root'],_0x5cef('0x32'),_0x5cef('0x33'),_0x5cef('0x34'));fs_extra[_0x5cef('0x35')](_0x57f868,function(){_0x1c5b65(null,_0x57f868);});},'filename':function(_0x182f61,_0x25c8df,_0x59fbc4){const _0x2a1b9a=_0x25c8df['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xd8ae88=path[_0x5cef('0x36')](_0x2a1b9a);const _0x3f990f=Date[_0x5cef('0x2c')]()+'-'+_0x2a1b9a[_0x5cef('0x37')](_0xd8ae88,'')+_0xd8ae88;_0x59fbc4(null,_0x3f990f);}})});router['post'](_0x5cef('0x38'),offlineUploadMulter[_0x5cef('0x39')](),controller['offline']);router[_0x5cef('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x5cef('0x3a')]);router[_0x5cef('0x1e')](_0x5cef('0x19'),auth['isAuthenticated'](),controller[_0x5cef('0x3b')]);router[_0x5cef('0x1e')](_0x5cef('0x1a'),auth[_0x5cef('0x9')](),controller['addProactiveActions']);router['post'](_0x5cef('0x3c'),auth['isAuthenticated'](),controller[_0x5cef('0x3d')]);router[_0x5cef('0x3e')](_0x5cef('0x3f'),auth['isAuthenticated'](),controller[_0x5cef('0x40')]);router[_0x5cef('0x41')](_0x5cef('0x3f'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x42')]);router[_0x5cef('0x41')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller['removeDispositions']);router[_0x5cef('0x41')](_0x5cef('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x5cef('0x3c'),auth[_0x5cef('0x9')](),controller['removeAgents']);module[_0x5cef('0x43')]=router; \ No newline at end of file +var _0x5a1a=['addLogo','join','root','addAvatar','server/files/images/avatars/','now','/:id/customer_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','server/files/images/logos/','format','%s-%s','originalname','single','file'];(function(_0x41ed8a,_0x5918cb){var _0x37b0c8=function(_0xcd5072){while(--_0xcd5072){_0x41ed8a['push'](_0x41ed8a['shift']());}};_0x37b0c8(++_0x5918cb);}(_0x5a1a,0x1bc));var _0xa5a1=function(_0x1f8921,_0x38bd21){_0x1f8921=_0x1f8921-0x0;var _0x2c2f34=_0x5a1a[_0x1f8921];return _0x2c2f34;};'use strict';var multer=require('multer');var util=require(_0xa5a1('0x0'));var path=require(_0xa5a1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa5a1('0x2')]();var fs_extra=require(_0xa5a1('0x3'));var auth=require(_0xa5a1('0x4'));var interaction=require(_0xa5a1('0x5'));var config=require(_0xa5a1('0x6'));var controller=require('./chatWebsite.controller');router[_0xa5a1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x9')]);router[_0xa5a1('0x7')]('/:id',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xa')]);router['get'](_0xa5a1('0xb'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xc')]);router['get'](_0xa5a1('0xd'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xe')]);router[_0xa5a1('0x7')](_0xa5a1('0xf'),controller['getLogo']);router[_0xa5a1('0x7')](_0xa5a1('0x10'),controller[_0xa5a1('0x11')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xa5a1('0x7')](_0xa5a1('0x12'),controller[_0xa5a1('0x13')]);router[_0xa5a1('0x7')](_0xa5a1('0x14'),auth[_0xa5a1('0x8')](),controller['getInteractions']);router[_0xa5a1('0x7')]('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x15')]);router[_0xa5a1('0x7')](_0xa5a1('0x16'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x17')]);router[_0xa5a1('0x7')]('/:id/fields',controller[_0xa5a1('0x18')]);router['get'](_0xa5a1('0x19'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x1a')]);router[_0xa5a1('0x7')](_0xa5a1('0x1b'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x1c')]);router[_0xa5a1('0x1d')]('/',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x1e')]);router[_0xa5a1('0x1d')]('/:id/dispositions',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x1f')]);router[_0xa5a1('0x1d')](_0xa5a1('0xd'),auth[_0xa5a1('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xa5a1('0x20')]({'destination':function(_0x40c22e,_0x375a86,_0x130a78){_0x130a78(null,path['join'](config['root'],_0xa5a1('0x21')));},'filename':function(_0xa5326e,_0x2cbc26,_0x54db61){_0x54db61(null,util[_0xa5a1('0x22')](_0xa5a1('0x23'),Date['now'](),_0x2cbc26[_0xa5a1('0x24')]));}})});router[_0xa5a1('0x1d')](_0xa5a1('0xf'),upload[_0xa5a1('0x25')](_0xa5a1('0x26')),controller[_0xa5a1('0x27')]);var upload=multer({'storage':multer[_0xa5a1('0x20')]({'destination':function(_0x161dfa,_0x2118aa,_0x2aa6c0){_0x2aa6c0(null,path[_0xa5a1('0x28')](config[_0xa5a1('0x29')],'server/files/images/avatars/'));},'filename':function(_0x4b56b4,_0x48bf0d,_0x57faaa){_0x57faaa(null,util[_0xa5a1('0x22')](_0xa5a1('0x23'),Date['now'](),_0x48bf0d['originalname']));}})});router[_0xa5a1('0x1d')](_0xa5a1('0x10'),upload[_0xa5a1('0x25')](_0xa5a1('0x26')),controller[_0xa5a1('0x2a')]);var upload=multer({'storage':multer[_0xa5a1('0x20')]({'destination':function(_0x52d13c,_0x299d55,_0x1ac714){_0x1ac714(null,path[_0xa5a1('0x28')](config[_0xa5a1('0x29')],_0xa5a1('0x2b')));},'filename':function(_0x2d9b5b,_0x115b77,_0x15956c){_0x15956c(null,util[_0xa5a1('0x22')]('%s-%s',Date[_0xa5a1('0x2c')](),_0x115b77['originalname']));}})});router['post'](_0xa5a1('0x2d'),upload['single'](_0xa5a1('0x26')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2043ba,_0x1bca85,_0x3b3606){_0x3b3606(null,path[_0xa5a1('0x28')](config[_0xa5a1('0x29')],_0xa5a1('0x2b')));},'filename':function(_0xf39581,_0x255fc6,_0x1eafda){_0x1eafda(null,util[_0xa5a1('0x22')](_0xa5a1('0x23'),Date[_0xa5a1('0x2c')](),_0x255fc6[_0xa5a1('0x24')]));}})});router[_0xa5a1('0x1d')](_0xa5a1('0x12'),upload[_0xa5a1('0x25')](_0xa5a1('0x26')),controller[_0xa5a1('0x2e')]);router[_0xa5a1('0x1d')](_0xa5a1('0x2f'),controller[_0xa5a1('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xa5a1('0x20')]({'destination':function(_0x49ac09,_0x529570,_0x8f730){const _0x223fd7=path[_0xa5a1('0x28')](config[_0xa5a1('0x29')],_0xa5a1('0x31'),_0xa5a1('0x32'),_0xa5a1('0x33'));fs_extra[_0xa5a1('0x34')](_0x223fd7,function(){_0x8f730(null,_0x223fd7);});},'filename':function(_0x4cc354,_0x9855a2,_0x249482){const _0x2338a8=_0x9855a2[_0xa5a1('0x24')][_0xa5a1('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x9a6fad=path[_0xa5a1('0x36')](_0x2338a8);const _0x1c8a01=Date[_0xa5a1('0x2c')]()+'-'+_0x2338a8[_0xa5a1('0x35')](_0x9a6fad,'')+_0x9a6fad;_0x249482(null,_0x1c8a01);}})});router[_0xa5a1('0x1d')]('/:id/offline',offlineUploadMulter[_0xa5a1('0x37')](),controller[_0xa5a1('0x38')]);router[_0xa5a1('0x1d')]('/:id/interactions',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x39')]);router[_0xa5a1('0x1d')]('/:id/applications',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x3a')]);router[_0xa5a1('0x1d')](_0xa5a1('0x16'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x3b')]);router[_0xa5a1('0x1d')](_0xa5a1('0x1b'),auth['isAuthenticated'](),controller[_0xa5a1('0x3c')]);router[_0xa5a1('0x3d')](_0xa5a1('0x3e'),auth[_0xa5a1('0x8')](),controller['update']);router[_0xa5a1('0x3f')](_0xa5a1('0x3e'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x40')]);router[_0xa5a1('0x3f')](_0xa5a1('0xb'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x41')]);router[_0xa5a1('0x3f')]('/:id/canned_answers',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x42')]);router[_0xa5a1('0x3f')](_0xa5a1('0x1b'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x43')]);module[_0xa5a1('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 823b697..a589bfe 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 _0x2940=['beaver-logger/server','express','../components/auth/service','../config/environment','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x2940,0xb4));var _0x0294=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x2940[_0x1fafa5];return _0xcf08c9;};var beaverLogger=require(_0x0294('0x0'));var express=require(_0x0294('0x1'));var auth=require(_0x0294('0x2'));var config=require(_0x0294('0x3'));var router=express['Router']();var isProduction=config['env']===_0x0294('0x4')||![];function clientSideLogs(_0x12caab,_0x174db1,_0x18798c){var _0x4002db=_0x12caab['app'][_0x0294('0x5')](_0x0294('0x6'));if(!_0x4002db){throw new Error(_0x0294('0x7'));}return beaverLogger[_0x0294('0x8')]({'uri':_0x0294('0x9'),'logger':_0x4002db,'enableCors':!isProduction})(_0x12caab,_0x174db1,_0x18798c);}router['use'](auth[_0x0294('0xa')](),clientSideLogs);module[_0x0294('0xb')]=router; \ No newline at end of file +var _0x20fe=['env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment'];(function(_0x192cca,_0x2d27c3){var _0x434f47=function(_0x2fae2a){while(--_0x2fae2a){_0x192cca['push'](_0x192cca['shift']());}};_0x434f47(++_0x2d27c3);}(_0x20fe,0xb3));var _0xe20f=function(_0x27a7f0,_0x1f638c){_0x27a7f0=_0x27a7f0-0x0;var _0x3b586a=_0x20fe[_0x27a7f0];return _0x3b586a;};var beaverLogger=require(_0xe20f('0x0'));var express=require(_0xe20f('0x1'));var auth=require('../components/auth/service');var config=require(_0xe20f('0x2'));var router=express['Router']();var isProduction=config[_0xe20f('0x3')]===_0xe20f('0x4')||![];function clientSideLogs(_0x484c5a,_0x5e445a,_0x44d761){var _0x186899=_0x484c5a[_0xe20f('0x5')][_0xe20f('0x6')](_0xe20f('0x7'));if(!_0x186899){throw new Error(_0xe20f('0x8'));}return beaverLogger[_0xe20f('0x9')]({'uri':'/client-logs','logger':_0x186899,'enableCors':!isProduction})(_0x484c5a,_0x5e445a,_0x44d761);}router[_0xe20f('0xa')](auth[_0xe20f('0xb')](),clientSideLogs);module[_0xe20f('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 f449af6..c00b4be 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 _0xfbad=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x3d3ae9,_0x334c52){var _0x31b364=function(_0x6aa61c){while(--_0x6aa61c){_0x3d3ae9['push'](_0x3d3ae9['shift']());}};_0x31b364(++_0x334c52);}(_0xfbad,0x129));var _0xdfba=function(_0xc86286,_0x47ec96){_0xc86286=_0xc86286-0x0;var _0x5df59d=_0xfbad[_0xc86286];return _0x5df59d;};'use strict';var Sequelize=require(_0xdfba('0x0'));module[_0xdfba('0x1')]={'name':{'type':Sequelize[_0xdfba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdfba('0x3')](_0xdfba('0x4'),_0xdfba('0x5'),_0xdfba('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdfba('0x3')](_0xdfba('0x7'),_0xdfba('0x8'))},'data1':{'type':Sequelize[_0xdfba('0x2')],'comment':_0xdfba('0x9')},'data2':{'type':Sequelize[_0xdfba('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xdfba('0x2')],'comment':_0xdfba('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0xdfba('0xb')},'data5':{'type':Sequelize[_0xdfba('0xc')],'comment':_0xdfba('0xd')},'data6':{'type':Sequelize[_0xdfba('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xdfba('0xc')],'comment':_0xdfba('0xe')}}; \ No newline at end of file +var _0xd7b7=['ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x1c9c9b,_0x26e0cf){var _0x3ec604=function(_0x4d2c52){while(--_0x4d2c52){_0x1c9c9b['push'](_0x1c9c9b['shift']());}};_0x3ec604(++_0x26e0cf);}(_0xd7b7,0x135));var _0x7d7b=function(_0x1d5441,_0x5214a9){_0x1d5441=_0x1d5441-0x0;var _0x165157=_0xd7b7[_0x1d5441];return _0x165157;};'use strict';var Sequelize=require(_0x7d7b('0x0'));module[_0x7d7b('0x1')]={'name':{'type':Sequelize[_0x7d7b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7d7b('0x3')]('AmazonAWS','Google',_0x7d7b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7d7b('0x5'),_0x7d7b('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x7d7b('0x7')},'data2':{'type':Sequelize[_0x7d7b('0x2')],'comment':_0x7d7b('0x8')},'data3':{'type':Sequelize[_0x7d7b('0x2')],'comment':_0x7d7b('0x9')},'data4':{'type':Sequelize[_0x7d7b('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x7d7b('0xa')],'comment':_0x7d7b('0xb')},'data6':{'type':Sequelize[_0x7d7b('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x7d7b('0xa')],'comment':_0x7d7b('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2f366d5..b0f23d8 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 _0xe236=['show','params','includeAll','include','find','body','Name\x20parameter\x20not\x20specified','values','includes','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','stack','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','options','service','MicrosoftAzure','decryptString','data3','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe236,0x136));var _0x6e23=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xe236[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require('lodash');var Redis=require(_0x6e23('0x0'));var qs=require(_0x6e23('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x6e23('0x2'))(_0x6e23('0x3'));var db=require(_0x6e23('0x4'))['db'];var oauth=require(_0x6e23('0x5'));config[_0x6e23('0x6')]=_[_0x6e23('0x7')](config[_0x6e23('0x6')],{'host':_0x6e23('0x8'),'port':0x18eb});var socket=require(_0x6e23('0x9'))(new Redis(config[_0x6e23('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5d44f3,_0x3b5538){_0x3b5538=_0x3b5538||0xcc;return function(_0x1c42cc){if(_0x1c42cc){return _0x5d44f3[_0x6e23('0xa')](_0x3b5538);}return _0x5d44f3[_0x6e23('0xb')](_0x3b5538)['end']();};}function respondWithResult(_0xbfe41e,_0x5d6547){_0x5d6547=_0x5d6547||0xc8;return function(_0x51bd18){if(_0x51bd18){return _0xbfe41e[_0x6e23('0xb')](_0x5d6547)['json'](_0x51bd18);}};}function respondWithFilteredResult(_0x9910ea,_0x2adfd6){return function(_0x4eb056){if(_0x4eb056){var _0x3eb104=typeof _0x2adfd6[_0x6e23('0xc')]===_0x6e23('0xd')&&typeof _0x2adfd6['limit']==='undefined';var _0x12e000=_0x4eb056[_0x6e23('0xe')];var _0x576aa3=_0x3eb104?0x0:_0x2adfd6['offset'];var _0x851b76=_0x3eb104?_0x4eb056[_0x6e23('0xe')]:_0x2adfd6['offset']+_0x2adfd6[_0x6e23('0xf')];var _0x3aa387;if(_0x851b76>=_0x12e000){_0x851b76=_0x12e000;_0x3aa387=0xc8;}else{_0x3aa387=0xce;}_0x9910ea[_0x6e23('0xb')](_0x3aa387);return _0x9910ea[_0x6e23('0x10')](_0x6e23('0x11'),_0x576aa3+'-'+_0x851b76+'/'+_0x12e000)[_0x6e23('0x12')](_0x4eb056);}return null;};}function saveUpdates(_0x5691c0){return function(_0x4f0666){if(_0x4f0666){return _0x4f0666[_0x6e23('0x13')](_0x5691c0)[_0x6e23('0x14')](function(_0x2ebaaf){return _0x2ebaaf;});}return null;};}function removeEntity(_0x43807c){return function(_0xe6dace){if(_0xe6dace){return _0xe6dace[_0x6e23('0x15')]()[_0x6e23('0x14')](function(){_0x43807c[_0x6e23('0xb')](0xcc)[_0x6e23('0x16')]();});}};}function handleEntityNotFound(_0x3db11b){return function(_0x4a6300){if(!_0x4a6300){_0x3db11b['sendStatus'](0x194);}return _0x4a6300;};}function handleError(_0x500e3b,_0x1df26d){_0x1df26d=_0x1df26d||0x1f4;return function(_0x38ac20){logger['error'](_0x38ac20[_0x6e23('0x17')]);if(_0x38ac20['name']){delete _0x38ac20[_0x6e23('0x18')];}_0x500e3b[_0x6e23('0xb')](_0x1df26d)['send'](_0x38ac20);};}function maskClientSecret(_0x5f31a9){return _['padEnd'](_0x5f31a9[_0x6e23('0x19')](0x0,0x3),0x14,'*');}exports[_0x6e23('0x1a')]=function(_0x520dce,_0xb8f65f){var _0x1e9f4c={},_0x51667c={},_0x5b4fc9={'count':0x0,'rows':[]};var _0x32b003=_['map'](db[_0x6e23('0x1b')][_0x6e23('0x1c')],function(_0xb0f322){return{'name':_0xb0f322[_0x6e23('0x1d')],'type':_0xb0f322[_0x6e23('0x1e')][_0x6e23('0x1f')]};});_0x51667c[_0x6e23('0x20')]=_['map'](_0x32b003,_0x6e23('0x18'));_0x51667c[_0x6e23('0x21')]=_[_0x6e23('0x22')](_0x520dce['query']);_0x51667c[_0x6e23('0x23')]=_[_0x6e23('0x24')](_0x51667c[_0x6e23('0x20')],_0x51667c['query']);_0x1e9f4c[_0x6e23('0x25')]=_[_0x6e23('0x24')](_0x51667c[_0x6e23('0x20')],qs['fields'](_0x520dce[_0x6e23('0x21')][_0x6e23('0x26')]));_0x1e9f4c['attributes']=_0x1e9f4c[_0x6e23('0x25')][_0x6e23('0x27')]?_0x1e9f4c[_0x6e23('0x25')]:_0x51667c[_0x6e23('0x20')];if(!_0x520dce[_0x6e23('0x21')][_0x6e23('0x28')](_0x6e23('0x29'))){_0x1e9f4c[_0x6e23('0xf')]=qs[_0x6e23('0xf')](_0x520dce['query'][_0x6e23('0xf')]);_0x1e9f4c['offset']=qs[_0x6e23('0xc')](_0x520dce[_0x6e23('0x21')][_0x6e23('0xc')]);}_0x1e9f4c['order']=qs['sort'](_0x520dce[_0x6e23('0x21')][_0x6e23('0x2a')]);_0x1e9f4c[_0x6e23('0x2b')]=qs[_0x6e23('0x23')](_[_0x6e23('0x2c')](_0x520dce[_0x6e23('0x21')],_0x51667c[_0x6e23('0x23')]),_0x32b003);if(_0x520dce['query'][_0x6e23('0x2d')]){_0x1e9f4c[_0x6e23('0x2b')]=_['merge'](_0x1e9f4c['where'],{'$or':_[_0x6e23('0x2e')](_0x32b003,function(_0xe2104d){if(_0xe2104d[_0x6e23('0x1e')]!=='VIRTUAL'){var _0x51b60f={};_0x51b60f[_0xe2104d[_0x6e23('0x18')]]={'$like':'%'+_0x520dce[_0x6e23('0x21')][_0x6e23('0x2d')]+'%'};return _0x51b60f;}})});}_0x1e9f4c=_[_0x6e23('0x2f')]({},_0x1e9f4c,_0x520dce[_0x6e23('0x30')]);var _0x4b9d36={'where':_0x1e9f4c[_0x6e23('0x2b')]};return db[_0x6e23('0x1b')]['count'](_0x4b9d36)[_0x6e23('0x14')](function(_0x171fd7){_0x5b4fc9[_0x6e23('0xe')]=_0x171fd7;if(_0x520dce[_0x6e23('0x21')]['includeAll']){_0x1e9f4c['include']=[{'all':!![]}];}return db[_0x6e23('0x1b')]['findAll'](_0x1e9f4c);})['then'](function(_0x4636a4){_0x5b4fc9['rows']=_['map'](_0x4636a4,function(_0x9ebe90){if(_0x9ebe90[_0x6e23('0x31')]===_0x6e23('0x32')){var _0x553b3d=encryptor[_0x6e23('0x33')](_0x9ebe90['data3']);_0x9ebe90[_0x6e23('0x34')]=maskClientSecret(_0x553b3d);}return _0x9ebe90;});return _0x5b4fc9;})['then'](respondWithFilteredResult(_0xb8f65f,_0x1e9f4c))[_0x6e23('0x35')](handleError(_0xb8f65f,null));};exports[_0x6e23('0x36')]=function(_0x1cfb5c,_0x247135){var _0xb88ec1={'raw':!![],'where':{'id':_0x1cfb5c[_0x6e23('0x37')]['id']}},_0x1a9098={};_0x1a9098['model']=_['keys'](db[_0x6e23('0x1b')]['rawAttributes']);_0x1a9098[_0x6e23('0x21')]=_[_0x6e23('0x22')](_0x1cfb5c['query']);_0x1a9098[_0x6e23('0x23')]=_[_0x6e23('0x24')](_0x1a9098[_0x6e23('0x20')],_0x1a9098['query']);_0xb88ec1[_0x6e23('0x25')]=_[_0x6e23('0x24')](_0x1a9098[_0x6e23('0x20')],qs[_0x6e23('0x26')](_0x1cfb5c[_0x6e23('0x21')]['fields']));_0xb88ec1[_0x6e23('0x25')]=_0xb88ec1[_0x6e23('0x25')][_0x6e23('0x27')]?_0xb88ec1[_0x6e23('0x25')]:_0x1a9098[_0x6e23('0x20')];if(_0x1cfb5c[_0x6e23('0x21')][_0x6e23('0x38')]){_0xb88ec1[_0x6e23('0x39')]=[{'all':!![]}];}_0xb88ec1=_[_0x6e23('0x2f')]({},_0xb88ec1,_0x1cfb5c[_0x6e23('0x30')]);return db[_0x6e23('0x1b')][_0x6e23('0x3a')](_0xb88ec1)[_0x6e23('0x14')](handleEntityNotFound(_0x247135,null))[_0x6e23('0x14')](function(_0x2eecb1){if(_0x2eecb1[_0x6e23('0x31')]===_0x6e23('0x32')){var _0x385956=encryptor[_0x6e23('0x33')](_0x2eecb1[_0x6e23('0x34')]);_0x2eecb1['data3']=maskClientSecret(_0x385956);}return _0x2eecb1;})[_0x6e23('0x14')](respondWithResult(_0x247135,null))[_0x6e23('0x35')](handleError(_0x247135,null));};exports['create']=function(_0x3f616c,_0x169120){if(!_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x18')])throw new Error(_0x6e23('0x3c'));if(!_0x3f616c['body'][_0x6e23('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x2931f0=db[_0x6e23('0x1b')][_0x6e23('0x1c')][_0x6e23('0x31')][_0x6e23('0x3d')];if(!_0x2931f0[_0x6e23('0x3e')](_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x31')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2931f0[_0x6e23('0x3f')](',\x20'));if(_0x3f616c['body'][_0x6e23('0x31')]===_0x6e23('0x32')&&_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]){_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]=encryptor[_0x6e23('0x40')](_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]);}return db['CloudProvider'][_0x6e23('0x41')](_0x3f616c[_0x6e23('0x3b')],{})['then'](respondWithResult(_0x169120,0xc9))[_0x6e23('0x35')](handleError(_0x169120,null));};exports[_0x6e23('0x13')]=function(_0x56a15f,_0x63db8e){if(_0x56a15f[_0x6e23('0x3b')]['id']){delete _0x56a15f[_0x6e23('0x3b')]['id'];}return db[_0x6e23('0x1b')][_0x6e23('0x3a')]({'where':{'id':_0x56a15f[_0x6e23('0x37')]['id']}})[_0x6e23('0x14')](handleEntityNotFound(_0x63db8e,null))[_0x6e23('0x14')](function(_0x485f23){if(_0x485f23[_0x6e23('0x31')]==='MicrosoftAzure'&&_0x56a15f[_0x6e23('0x3b')][_0x6e23('0x34')]){_0x56a15f['body'][_0x6e23('0x34')]=encryptor[_0x6e23('0x40')](_0x56a15f[_0x6e23('0x3b')]['data3']);}return _0x485f23;})[_0x6e23('0x14')](saveUpdates(_0x56a15f['body'],null))['then'](respondWithResult(_0x63db8e,null))[_0x6e23('0x35')](handleError(_0x63db8e,null));};exports[_0x6e23('0x15')]=function(_0x457c4f,_0x54c058){return db['CloudProvider'][_0x6e23('0x3a')]({'where':{'id':_0x457c4f[_0x6e23('0x37')]['id']}})[_0x6e23('0x14')](handleEntityNotFound(_0x54c058,null))[_0x6e23('0x14')](removeEntity(_0x54c058,null))[_0x6e23('0x35')](handleError(_0x54c058,null));};exports[_0x6e23('0x42')]=function(_0x4cef1e,_0xe0539a){return db[_0x6e23('0x1b')][_0x6e23('0x43')]({'where':{'id':_0x4cef1e[_0x6e23('0x37')]['id']},'raw':!![]})['then'](function(_0x1fe5d1){if(!_0x1fe5d1)return _0xe0539a[_0x6e23('0xa')](0x194);return{'url':oauth[_0x6e23('0x44')](_0x1fe5d1,_0x4cef1e[_0x6e23('0x45')]['id'])};})[_0x6e23('0x14')](respondWithResult(_0xe0539a,null))[_0x6e23('0x35')](handleError(_0xe0539a,null));};exports[_0x6e23('0x46')]=function(_0x8e0d89,_0x45f3ef){var _0x59718a=_0x8e0d89[_0x6e23('0x3b')];var _0x536c9f;var _0x243b0b;if(_0x59718a[_0x6e23('0x47')])throw _0x59718a;redis[_0x6e23('0x48')](_0x59718a[_0x6e23('0x49')])[_0x6e23('0x14')](function(_0x46eb44){if(!_0x46eb44)throw new Error(_0x6e23('0x4a'));_0x536c9f=JSON[_0x6e23('0x4b')](_0x46eb44);var _0x378b60=Buffer[_0x6e23('0x4c')](_0x59718a[_0x6e23('0x49')],_0x6e23('0x4d'))['toString']('ascii');_0x243b0b=JSON[_0x6e23('0x4b')](_0x378b60);if(!oauth[_0x6e23('0x4e')](_0x59718a[_0x6e23('0x4f')],_0x536c9f[_0x6e23('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x59718a[_0x6e23('0x49')]);return oauth[_0x6e23('0x51')](_0x59718a['code'],_0x536c9f);})[_0x6e23('0x14')](function(_0x273c3c){_0x536c9f['data5']=_0x273c3c['access_token'];_0x536c9f[_0x6e23('0x52')]=_0x273c3c[_0x6e23('0x53')];return db[_0x6e23('0x1b')][_0x6e23('0x13')]({'data5':_0x536c9f['data5'],'data6':_0x536c9f[_0x6e23('0x52')]},{'where':{'id':_0x536c9f['id']}});})[_0x6e23('0x14')](function(){oauth['startRefreshInterval'](_0x536c9f);socket[_0x6e23('0x54')](_0x6e23('0x55'),{'id':_0x243b0b['id']});return;})[_0x6e23('0x14')](respondWithStatusCode(_0x45f3ef,null))['catch'](function(_0x39076d){if(_0x243b0b){socket[_0x6e23('0x54')](_0x6e23('0x56'),{'id':_0x243b0b['id']});}if(!_0x536c9f){logger[_0x6e23('0x47')](_0x6e23('0x57'),_0x39076d);return _0x45f3ef[_0x6e23('0xb')](0x1f4)['send'](_0x39076d[_0x6e23('0x58')]);}logger[_0x6e23('0x47')](_0x6e23('0x59'),_0x536c9f['id'],JSON[_0x6e23('0x5a')](_0x39076d));});}; \ No newline at end of file +var _0xd695=['set','Content-Range','destroy','error','stack','send','slice','map','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','CloudProvider','then','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','find','Name\x20parameter\x20not\x20specified','body','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','update','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','access_token','refresh_token','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','count'];(function(_0x1d3a5d,_0x17fc32){var _0x257078=function(_0x482f3a){while(--_0x482f3a){_0x1d3a5d['push'](_0x1d3a5d['shift']());}};_0x257078(++_0x17fc32);}(_0xd695,0xad));var _0x5d69=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xd695[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x5d69('0x0'));var Redis=require(_0x5d69('0x1'));var qs=require(_0x5d69('0x2'));var encryptor=require(_0x5d69('0x3'));var config=require(_0x5d69('0x4'));var logger=require(_0x5d69('0x5'))(_0x5d69('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x5d69('0x7'));config[_0x5d69('0x8')]=_['defaults'](config[_0x5d69('0x8')],{'host':_0x5d69('0x9'),'port':0x18eb});var socket=require(_0x5d69('0xa'))(new Redis(config[_0x5d69('0x8')]));var redis=new Redis(config[_0x5d69('0x8')]);function respondWithStatusCode(_0x4f8840,_0x259688){_0x259688=_0x259688||0xcc;return function(_0x40ab60){if(_0x40ab60){return _0x4f8840[_0x5d69('0xb')](_0x259688);}return _0x4f8840[_0x5d69('0xc')](_0x259688)[_0x5d69('0xd')]();};}function respondWithResult(_0x101feb,_0x55d649){_0x55d649=_0x55d649||0xc8;return function(_0x4f8cbe){if(_0x4f8cbe){return _0x101feb['status'](_0x55d649)[_0x5d69('0xe')](_0x4f8cbe);}};}function respondWithFilteredResult(_0x41d642,_0x3405dd){return function(_0x4a671f){if(_0x4a671f){var _0x2e3792=typeof _0x3405dd['offset']==='undefined'&&typeof _0x3405dd['limit']==='undefined';var _0x34c496=_0x4a671f['count'];var _0xb3fb2e=_0x2e3792?0x0:_0x3405dd[_0x5d69('0xf')];var _0xb7c4c3=_0x2e3792?_0x4a671f[_0x5d69('0x10')]:_0x3405dd[_0x5d69('0xf')]+_0x3405dd['limit'];var _0xa5712f;if(_0xb7c4c3>=_0x34c496){_0xb7c4c3=_0x34c496;_0xa5712f=0xc8;}else{_0xa5712f=0xce;}_0x41d642[_0x5d69('0xc')](_0xa5712f);return _0x41d642[_0x5d69('0x11')](_0x5d69('0x12'),_0xb3fb2e+'-'+_0xb7c4c3+'/'+_0x34c496)[_0x5d69('0xe')](_0x4a671f);}return null;};}function saveUpdates(_0x499abb){return function(_0x5638fa){if(_0x5638fa){return _0x5638fa['update'](_0x499abb)['then'](function(_0x2961e3){return _0x2961e3;});}return null;};}function removeEntity(_0x44fc8a){return function(_0x34f7d0){if(_0x34f7d0){return _0x34f7d0[_0x5d69('0x13')]()['then'](function(){_0x44fc8a[_0x5d69('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c59f9){return function(_0x58a46b){if(!_0x58a46b){_0x4c59f9[_0x5d69('0xb')](0x194);}return _0x58a46b;};}function handleError(_0x4026ac,_0x1d6cf4){_0x1d6cf4=_0x1d6cf4||0x1f4;return function(_0x3c5f05){logger[_0x5d69('0x14')](_0x3c5f05[_0x5d69('0x15')]);if(_0x3c5f05['name']){delete _0x3c5f05['name'];}_0x4026ac['status'](_0x1d6cf4)[_0x5d69('0x16')](_0x3c5f05);};}function maskClientSecret(_0x4bb146){return _['padEnd'](_0x4bb146[_0x5d69('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x182c90,_0x492b5b){var _0x14d32a={},_0x2de9ff={},_0x3c21c5={'count':0x0,'rows':[]};var _0x4998a5=_[_0x5d69('0x18')](db['CloudProvider'][_0x5d69('0x19')],function(_0x6ba0f0){return{'name':_0x6ba0f0[_0x5d69('0x1a')],'type':_0x6ba0f0[_0x5d69('0x1b')]['key']};});_0x2de9ff['model']=_[_0x5d69('0x18')](_0x4998a5,_0x5d69('0x1c'));_0x2de9ff[_0x5d69('0x1d')]=_[_0x5d69('0x1e')](_0x182c90[_0x5d69('0x1d')]);_0x2de9ff[_0x5d69('0x1f')]=_[_0x5d69('0x20')](_0x2de9ff[_0x5d69('0x21')],_0x2de9ff['query']);_0x14d32a[_0x5d69('0x22')]=_[_0x5d69('0x20')](_0x2de9ff[_0x5d69('0x21')],qs[_0x5d69('0x23')](_0x182c90[_0x5d69('0x1d')][_0x5d69('0x23')]));_0x14d32a['attributes']=_0x14d32a[_0x5d69('0x22')][_0x5d69('0x24')]?_0x14d32a[_0x5d69('0x22')]:_0x2de9ff[_0x5d69('0x21')];if(!_0x182c90[_0x5d69('0x1d')][_0x5d69('0x25')]('nolimit')){_0x14d32a[_0x5d69('0x26')]=qs['limit'](_0x182c90[_0x5d69('0x1d')][_0x5d69('0x26')]);_0x14d32a[_0x5d69('0xf')]=qs[_0x5d69('0xf')](_0x182c90[_0x5d69('0x1d')][_0x5d69('0xf')]);}_0x14d32a[_0x5d69('0x27')]=qs[_0x5d69('0x28')](_0x182c90[_0x5d69('0x1d')][_0x5d69('0x28')]);_0x14d32a[_0x5d69('0x29')]=qs[_0x5d69('0x1f')](_['pick'](_0x182c90['query'],_0x2de9ff[_0x5d69('0x1f')]),_0x4998a5);if(_0x182c90[_0x5d69('0x1d')][_0x5d69('0x2a')]){_0x14d32a['where']=_[_0x5d69('0x2b')](_0x14d32a[_0x5d69('0x29')],{'$or':_[_0x5d69('0x18')](_0x4998a5,function(_0x152736){if(_0x152736['type']!==_0x5d69('0x2c')){var _0x56a844={};_0x56a844[_0x152736[_0x5d69('0x1c')]]={'$like':'%'+_0x182c90[_0x5d69('0x1d')][_0x5d69('0x2a')]+'%'};return _0x56a844;}})});}_0x14d32a=_[_0x5d69('0x2b')]({},_0x14d32a,_0x182c90[_0x5d69('0x2d')]);var _0x53954e={'where':_0x14d32a[_0x5d69('0x29')]};return db[_0x5d69('0x2e')][_0x5d69('0x10')](_0x53954e)[_0x5d69('0x2f')](function(_0x4a945d){_0x3c21c5[_0x5d69('0x10')]=_0x4a945d;if(_0x182c90[_0x5d69('0x1d')][_0x5d69('0x30')]){_0x14d32a[_0x5d69('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x5d69('0x32')](_0x14d32a);})[_0x5d69('0x2f')](function(_0x4626a6){_0x3c21c5[_0x5d69('0x33')]=_[_0x5d69('0x18')](_0x4626a6,function(_0x10cb40){if(_0x10cb40['service']===_0x5d69('0x34')){var _0x15f506=encryptor[_0x5d69('0x35')](_0x10cb40['data3']);_0x10cb40[_0x5d69('0x36')]=maskClientSecret(_0x15f506);}return _0x10cb40;});return _0x3c21c5;})[_0x5d69('0x2f')](respondWithFilteredResult(_0x492b5b,_0x14d32a))[_0x5d69('0x37')](handleError(_0x492b5b,null));};exports[_0x5d69('0x38')]=function(_0x1f5540,_0x4e190b){var _0x315133={'raw':!![],'where':{'id':_0x1f5540[_0x5d69('0x39')]['id']}},_0x42a13c={};_0x42a13c['model']=_['keys'](db['CloudProvider'][_0x5d69('0x19')]);_0x42a13c['query']=_[_0x5d69('0x1e')](_0x1f5540[_0x5d69('0x1d')]);_0x42a13c[_0x5d69('0x1f')]=_[_0x5d69('0x20')](_0x42a13c[_0x5d69('0x21')],_0x42a13c[_0x5d69('0x1d')]);_0x315133[_0x5d69('0x22')]=_[_0x5d69('0x20')](_0x42a13c[_0x5d69('0x21')],qs['fields'](_0x1f5540[_0x5d69('0x1d')][_0x5d69('0x23')]));_0x315133[_0x5d69('0x22')]=_0x315133[_0x5d69('0x22')][_0x5d69('0x24')]?_0x315133[_0x5d69('0x22')]:_0x42a13c[_0x5d69('0x21')];if(_0x1f5540[_0x5d69('0x1d')][_0x5d69('0x30')]){_0x315133[_0x5d69('0x31')]=[{'all':!![]}];}_0x315133=_['merge']({},_0x315133,_0x1f5540['options']);return db[_0x5d69('0x2e')][_0x5d69('0x3a')](_0x315133)[_0x5d69('0x2f')](handleEntityNotFound(_0x4e190b,null))[_0x5d69('0x2f')](function(_0x3a90aa){if(_0x3a90aa['service']===_0x5d69('0x34')){var _0x43aaa6=encryptor['decryptString'](_0x3a90aa[_0x5d69('0x36')]);_0x3a90aa[_0x5d69('0x36')]=maskClientSecret(_0x43aaa6);}return _0x3a90aa;})['then'](respondWithResult(_0x4e190b,null))[_0x5d69('0x37')](handleError(_0x4e190b,null));};exports['create']=function(_0x5dadf4,_0x2c558e){if(!_0x5dadf4['body'][_0x5d69('0x1c')])throw new Error(_0x5d69('0x3b'));if(!_0x5dadf4[_0x5d69('0x3c')][_0x5d69('0x3d')])throw new Error(_0x5d69('0x3e'));var _0x4bfcbf=db[_0x5d69('0x2e')][_0x5d69('0x19')]['service'][_0x5d69('0x3f')];if(!_0x4bfcbf[_0x5d69('0x40')](_0x5dadf4[_0x5d69('0x3c')]['service']))throw new Error(_0x5d69('0x41')+_0x4bfcbf[_0x5d69('0x42')](',\x20'));if(_0x5dadf4[_0x5d69('0x3c')][_0x5d69('0x3d')]==='MicrosoftAzure'&&_0x5dadf4[_0x5d69('0x3c')]['data3']){_0x5dadf4[_0x5d69('0x3c')]['data3']=encryptor['encryptString'](_0x5dadf4['body'][_0x5d69('0x36')]);}return db['CloudProvider']['create'](_0x5dadf4[_0x5d69('0x3c')],{})[_0x5d69('0x2f')](respondWithResult(_0x2c558e,0xc9))[_0x5d69('0x37')](handleError(_0x2c558e,null));};exports[_0x5d69('0x43')]=function(_0x5c69ed,_0x5cbecb){if(_0x5c69ed[_0x5d69('0x3c')]['id']){delete _0x5c69ed[_0x5d69('0x3c')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x5c69ed[_0x5d69('0x39')]['id']}})[_0x5d69('0x2f')](handleEntityNotFound(_0x5cbecb,null))['then'](function(_0x4e94fc){if(_0x4e94fc[_0x5d69('0x3d')]===_0x5d69('0x34')&&_0x5c69ed[_0x5d69('0x3c')][_0x5d69('0x36')]){_0x5c69ed[_0x5d69('0x3c')][_0x5d69('0x36')]=encryptor[_0x5d69('0x44')](_0x5c69ed[_0x5d69('0x3c')]['data3']);}return _0x4e94fc;})[_0x5d69('0x2f')](saveUpdates(_0x5c69ed['body'],null))['then'](respondWithResult(_0x5cbecb,null))[_0x5d69('0x37')](handleError(_0x5cbecb,null));};exports[_0x5d69('0x13')]=function(_0xe2924c,_0x3accd6){return db[_0x5d69('0x2e')][_0x5d69('0x3a')]({'where':{'id':_0xe2924c['params']['id']}})[_0x5d69('0x2f')](handleEntityNotFound(_0x3accd6,null))[_0x5d69('0x2f')](removeEntity(_0x3accd6,null))[_0x5d69('0x37')](handleError(_0x3accd6,null));};exports[_0x5d69('0x45')]=function(_0x50f459,_0x3a7bb0){return db[_0x5d69('0x2e')][_0x5d69('0x46')]({'where':{'id':_0x50f459[_0x5d69('0x39')]['id']},'raw':!![]})[_0x5d69('0x2f')](function(_0x4c0a76){if(!_0x4c0a76)return _0x3a7bb0['sendStatus'](0x194);return{'url':oauth[_0x5d69('0x47')](_0x4c0a76,_0x50f459['user']['id'])};})[_0x5d69('0x2f')](respondWithResult(_0x3a7bb0,null))[_0x5d69('0x37')](handleError(_0x3a7bb0,null));};exports[_0x5d69('0x48')]=function(_0x159ccf,_0x4982b1){var _0x152a12=_0x159ccf[_0x5d69('0x3c')];var _0x40c9c2;var _0x4e073b;if(_0x152a12[_0x5d69('0x14')])throw _0x152a12;redis['get'](_0x152a12[_0x5d69('0x49')])['then'](function(_0x4a648a){if(!_0x4a648a)throw new Error(_0x5d69('0x4a'));_0x40c9c2=JSON[_0x5d69('0x4b')](_0x4a648a);var _0x46a40c=Buffer[_0x5d69('0x4c')](_0x152a12[_0x5d69('0x49')],_0x5d69('0x4d'))[_0x5d69('0x4e')](_0x5d69('0x4f'));_0x4e073b=JSON['parse'](_0x46a40c);if(!oauth[_0x5d69('0x50')](_0x152a12['id_token'],_0x40c9c2[_0x5d69('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x5d69('0x52')](_0x152a12[_0x5d69('0x49')]);return oauth[_0x5d69('0x53')](_0x152a12['code'],_0x40c9c2);})[_0x5d69('0x2f')](function(_0x685f63){_0x40c9c2['data5']=_0x685f63[_0x5d69('0x54')];_0x40c9c2['data6']=_0x685f63[_0x5d69('0x55')];return db['CloudProvider'][_0x5d69('0x43')]({'data5':_0x40c9c2[_0x5d69('0x56')],'data6':_0x40c9c2[_0x5d69('0x57')]},{'where':{'id':_0x40c9c2['id']}});})[_0x5d69('0x2f')](function(){oauth[_0x5d69('0x58')](_0x40c9c2);socket[_0x5d69('0x59')](_0x5d69('0x5a'),{'id':_0x4e073b['id']});return;})[_0x5d69('0x2f')](respondWithStatusCode(_0x4982b1,null))[_0x5d69('0x37')](function(_0x4b22dd){if(_0x4e073b){socket[_0x5d69('0x59')](_0x5d69('0x5b'),{'id':_0x4e073b['id']});}if(!_0x40c9c2){logger[_0x5d69('0x14')](_0x5d69('0x5c'),_0x4b22dd);return _0x4982b1[_0x5d69('0xc')](0x1f4)[_0x5d69('0x16')](_0x4b22dd[_0x5d69('0x5d')]);}logger[_0x5d69('0x14')](_0x5d69('0x5e'),_0x40c9c2['id'],JSON['stringify'](_0x4b22dd));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6dfa3e5..168851c 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 _0x2964=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x341a17,_0x2a5857){var _0x205e03=function(_0x4054bb){while(--_0x4054bb){_0x341a17['push'](_0x341a17['shift']());}};_0x205e03(++_0x2a5857);}(_0x2964,0x68));var _0x4296=function(_0x2f48cd,_0x34d2b7){_0x2f48cd=_0x2f48cd-0x0;var _0x3ef4b0=_0x2964[_0x2f48cd];return _0x3ef4b0;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var logger=require(_0x4296('0x2'))('api');var moment=require(_0x4296('0x3'));var BPromise=require(_0x4296('0x4'));var rp=require(_0x4296('0x5'));var fs=require('fs');var path=require(_0x4296('0x6'));var rimraf=require(_0x4296('0x7'));var config=require(_0x4296('0x8'));var attributes=require(_0x4296('0x9'));module['exports']=function(_0x284302,_0x113c0){return _0x284302[_0x4296('0xa')](_0x4296('0xb'),attributes,{'tableName':_0x4296('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8230=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider','cloud_providers'];(function(_0x36dca0,_0x9594b1){var _0x20433e=function(_0x47303b){while(--_0x47303b){_0x36dca0['push'](_0x36dca0['shift']());}};_0x20433e(++_0x9594b1);}(_0x8230,0x84));var _0x0823=function(_0x220394,_0x490c8b){_0x220394=_0x220394-0x0;var _0x1dae12=_0x8230[_0x220394];return _0x1dae12;};'use strict';var _=require('lodash');var util=require(_0x0823('0x0'));var logger=require(_0x0823('0x1'))(_0x0823('0x2'));var moment=require(_0x0823('0x3'));var BPromise=require(_0x0823('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0823('0x5'));var rimraf=require(_0x0823('0x6'));var config=require(_0x0823('0x7'));var attributes=require(_0x0823('0x8'));module['exports']=function(_0x1ff994,_0x2b011f){return _0x1ff994['define'](_0x0823('0x9'),attributes,{'tableName':_0x0823('0xa'),'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 11696d5..836b66b 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 _0xad66=['all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','hex','client_id','data1','response_type','join','data4','response_mode','form_post','scope','state','nonce','key','value','oauth2Claims','decode','iss','audience','exp','resolve','CloudProvider','findOne','then','refresh_token','data6','data3','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','bind','intervals','findAll'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0xad66,0xe5));var _0x6ad6=function(_0x5e06f0,_0x12f101){_0x5e06f0=_0x5e06f0-0x0;var _0x57673c=_0xad66[_0x5e06f0];return _0x57673c;};'use strict';var _=require(_0x6ad6('0x0'));var crypto=require(_0x6ad6('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x6ad6('0x2'));var Redis=require(_0x6ad6('0x3'));var rp=require(_0x6ad6('0x4'));var util=require(_0x6ad6('0x5'));var encryptor=require(_0x6ad6('0x6'));var config=require(_0x6ad6('0x7'));var logger=require('../../config/logger')(_0x6ad6('0x8'));var schedule=require(_0x6ad6('0x9'));var db=require(_0x6ad6('0xa'))['db'];config[_0x6ad6('0xb')]=_[_0x6ad6('0xc')](config[_0x6ad6('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x6ad6('0xb')]);var MICROSOFT_AUTH_URL=_0x6ad6('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6ad6('0xe'),_0x6ad6('0xf'),'email','offline_access',_0x6ad6('0x10'),_0x6ad6('0x11'),_0x6ad6('0x12')],'Dynamics365':['openid',_0x6ad6('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x6ad6('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xbf9d22){var _0x5c970e=_[_0x6ad6('0x15')](AZURE_AUTH_SCOPES[_0xbf9d22['type']]);if(_0xbf9d22[_0x6ad6('0x16')]===_0x6ad6('0x17'))_0x5c970e[_0x6ad6('0x18')](_0xbf9d22[_0x6ad6('0x19')]+_0x6ad6('0x1a'));return _0x5c970e['join']('\x20');}function getAccessTokenScope(_0x5c69b2){if(_0x5c69b2[_0x6ad6('0x16')]==='Outlook365')return _0x6ad6('0x10');if(_0x5c69b2['type']===_0x6ad6('0x17'))return _0x5c69b2[_0x6ad6('0x19')]+_0x6ad6('0x1a');}function generateMicrosoftAuthorizationUrl(_0x1796cd,_0x49c889){var _0x277814=MICROSOFT_AUTH_URL[_0x6ad6('0x1b')](_0x6ad6('0x1c'),_0x1796cd[_0x6ad6('0x1d')]);var _0x21f974=[_0x6ad6('0x1e'),_0x6ad6('0x1f')];var _0x1b0ced=Buffer[_0x6ad6('0x20')](JSON['stringify']({'id':_0x49c889}))[_0x6ad6('0x21')](_0x6ad6('0x22'));var _0x518f1f=crypto['randomBytes'](0x10)[_0x6ad6('0x21')](_0x6ad6('0x23'));var _0x5cf3ec=getAuthorizationScopes(_0x1796cd);var _0xef93be=[{'key':_0x6ad6('0x24'),'value':_0x1796cd[_0x6ad6('0x25')]},{'key':_0x6ad6('0x26'),'value':encodeURIComponent(_0x21f974[_0x6ad6('0x27')]('\x20'))},{'key':'redirect_uri','value':_0x1796cd[_0x6ad6('0x28')]},{'key':_0x6ad6('0x29'),'value':_0x6ad6('0x2a')},{'key':_0x6ad6('0x2b'),'value':encodeURIComponent(_0x5cf3ec)},{'key':_0x6ad6('0x2c'),'value':_0x1b0ced},{'key':_0x6ad6('0x2d'),'value':_0x518f1f},{'key':'prompt','value':'login'}];var _0x45111e=_0x277814+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xef93be,function(_0x22efa8){return _0x22efa8[_0x6ad6('0x2e')]+'='+_0x22efa8[_0x6ad6('0x2f')];})[_0x6ad6('0x27')]('&');_0x1796cd[_0x6ad6('0x30')]={'issuer':_0x277814[_0x6ad6('0x1b')]('oauth2/',''),'audience':_0x1796cd['data1'],'state':_0x1b0ced,'nonce':_0x518f1f};redis['set'](_0x1b0ced,JSON['stringify'](_0x1796cd));return _0x45111e;}function isValidIdToken(_0x52c4d2,_0x405dd1){try{var _0x106acc=jwt[_0x6ad6('0x31')](_0x52c4d2,{'complete':!![]});var _0x3eb8ef=_0x106acc['payload'];if(_0x3eb8ef[_0x6ad6('0x32')]!==_0x405dd1['issuer'])return![];if(_0x3eb8ef['aud']!==_0x405dd1[_0x6ad6('0x33')])return![];if(_0x3eb8ef[_0x6ad6('0x2d')]!==_0x405dd1['nonce'])return![];if(moment()['isAfter'](moment['unix'](_0x3eb8ef[_0x6ad6('0x34')])))return![];return!![];}catch(_0x1a8f7a){throw _0x1a8f7a;}}function refreshOauth2MicrosoftAccessToken(_0x329eef){return Promise[_0x6ad6('0x35')]()['then'](function(){if(_0x329eef['data3'])return _0x329eef;return db[_0x6ad6('0x36')][_0x6ad6('0x37')]({'where':{'id':_0x329eef['id']},'raw':!![]});})[_0x6ad6('0x38')](function(_0x4b8392){var _0x93870d={'grant_type':_0x6ad6('0x39'),'refresh_token':_0x4b8392[_0x6ad6('0x3a')],'scope':getAccessTokenScope(_0x4b8392),'redirect_uri':_0x4b8392[_0x6ad6('0x28')],'client_id':_0x4b8392[_0x6ad6('0x25')],'client_secret':encryptor['decryptString'](_0x4b8392[_0x6ad6('0x3b')])};var _0xb6f93a={'method':_0x6ad6('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x6ad6('0x1b')](_0x6ad6('0x1c'),_0x4b8392[_0x6ad6('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x93870d,'json':!![]};return rp(_0xb6f93a);})[_0x6ad6('0x38')](function(_0x34bf15){_0x329eef[_0x6ad6('0x3d')]=_0x34bf15[_0x6ad6('0x3e')];_0x329eef[_0x6ad6('0x3a')]=_0x34bf15[_0x6ad6('0x39')];return db[_0x6ad6('0x36')]['update']({'data5':_0x329eef[_0x6ad6('0x3d')],'data6':_0x329eef['data6']},{'where':{'id':_0x329eef['id']}});})[_0x6ad6('0x38')](function(){return _0x329eef;})[_0x6ad6('0x3f')](function(_0x55b4cb){logger[_0x6ad6('0x40')](_0x6ad6('0x41'),_0x329eef['id'],_0x55b4cb);});}function getOauth2MicrosoftAccessToken(_0x415c99,_0x2d702b){var _0x51a4d8={'grant_type':_0x6ad6('0x42'),'code':_0x415c99,'scope':getAccessTokenScope(_0x2d702b),'redirect_uri':_0x2d702b[_0x6ad6('0x28')],'client_id':_0x2d702b[_0x6ad6('0x25')],'client_secret':encryptor[_0x6ad6('0x43')](_0x2d702b[_0x6ad6('0x3b')])};var _0x233a8d={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x6ad6('0x1c'),_0x2d702b[_0x6ad6('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51a4d8,'json':!![]};return rp(_0x233a8d);}function startRefreshInterval(_0x1353ca){var _0x5a03d1=schedule['intervals'];if(_0x5a03d1[_0x1353ca['id']])clearInterval(_0x5a03d1[_0x1353ca['id']]);_0x5a03d1[_0x1353ca['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6ad6('0x44')](this,{'id':_0x1353ca['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x6ad6('0x45')]=_0x5a03d1;}function startAllRefreshIntervals(){return db[_0x6ad6('0x36')][_0x6ad6('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6ad6('0x38')](function(_0x528198){var _0x5101cc=_0x528198[_0x6ad6('0x15')](function(_0x1344b9){return refreshOauth2MicrosoftAccessToken(_0x1344b9)[_0x6ad6('0x38')](function(_0x492ca8){startRefreshInterval(_0x492ca8);});});return Promise[_0x6ad6('0x47')](_0x5101cc);})[_0x6ad6('0x3f')](function(_0x49d3e8){var _0x56768c=_0x49d3e8?util[_0x6ad6('0x48')](_0x49d3e8,{'showHidden':![],'depth':null}):'';logger[_0x6ad6('0x40')](_0x6ad6('0x49'),_0x56768c);});}module[_0x6ad6('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2f1c=['data7','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','stringify','toString','randomBytes','hex','client_id','response_type','redirect_uri','form_post','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','decode','payload','aud','isAfter','resolve','then','data3','CloudProvider','findOne','data6','data4','data1','decryptString','POST','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','type','push'];(function(_0x3c9d9e,_0x5b9888){var _0xfa1029=function(_0x4c9948){while(--_0x4c9948){_0x3c9d9e['push'](_0x3c9d9e['shift']());}};_0xfa1029(++_0x5b9888);}(_0x2f1c,0xbf));var _0xc2f1=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x2f1c[_0x2e76a7];return _0x454cde;};'use strict';var _=require(_0xc2f1('0x0'));var crypto=require(_0xc2f1('0x1'));var jwt=require(_0xc2f1('0x2'));var moment=require(_0xc2f1('0x3'));var Redis=require(_0xc2f1('0x4'));var rp=require(_0xc2f1('0x5'));var util=require('util');var encryptor=require(_0xc2f1('0x6'));var config=require(_0xc2f1('0x7'));var logger=require('../../config/logger')(_0xc2f1('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc2f1('0x9')](config[_0xc2f1('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xc2f1('0xa')]);var MICROSOFT_AUTH_URL=_0xc2f1('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xc2f1('0xc'),'profile',_0xc2f1('0xd'),_0xc2f1('0xe'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xc2f1('0xf'),_0xc2f1('0x10')],'Dynamics365':[_0xc2f1('0xc'),_0xc2f1('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xb80209){var _0x36b8bf=_['map'](AZURE_AUTH_SCOPES[_0xb80209[_0xc2f1('0x11')]]);if(_0xb80209[_0xc2f1('0x11')]==='Dynamics365')_0x36b8bf[_0xc2f1('0x12')](_0xb80209[_0xc2f1('0x13')]+'/.default');return _0x36b8bf[_0xc2f1('0x14')]('\x20');}function getAccessTokenScope(_0x2c246e){if(_0x2c246e[_0xc2f1('0x11')]===_0xc2f1('0x15'))return _0xc2f1('0x16');if(_0x2c246e[_0xc2f1('0x11')]==='Dynamics365')return _0x2c246e[_0xc2f1('0x13')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x284877,_0x77e471){var _0xae8ba4=MICROSOFT_AUTH_URL[_0xc2f1('0x17')](_0xc2f1('0x18'),_0x284877[_0xc2f1('0x19')]);var _0x137826=['code','id_token'];var _0x3b65d2=Buffer['from'](JSON[_0xc2f1('0x1a')]({'id':_0x77e471}))[_0xc2f1('0x1b')]('base64');var _0x145b16=crypto[_0xc2f1('0x1c')](0x10)[_0xc2f1('0x1b')](_0xc2f1('0x1d'));var _0x147adc=getAuthorizationScopes(_0x284877);var _0x20e09d=[{'key':_0xc2f1('0x1e'),'value':_0x284877['data1']},{'key':_0xc2f1('0x1f'),'value':encodeURIComponent(_0x137826[_0xc2f1('0x14')]('\x20'))},{'key':_0xc2f1('0x20'),'value':_0x284877['data4']},{'key':'response_mode','value':_0xc2f1('0x21')},{'key':_0xc2f1('0x22'),'value':encodeURIComponent(_0x147adc)},{'key':_0xc2f1('0x23'),'value':_0x3b65d2},{'key':_0xc2f1('0x24'),'value':_0x145b16},{'key':_0xc2f1('0x25'),'value':_0xc2f1('0x26')}];var _0x324d7d=_0xae8ba4+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc2f1('0x27')](_0x20e09d,function(_0xa9e6c4){return _0xa9e6c4[_0xc2f1('0x28')]+'='+_0xa9e6c4[_0xc2f1('0x29')];})['join']('&');_0x284877[_0xc2f1('0x2a')]={'issuer':_0xae8ba4[_0xc2f1('0x17')]('oauth2/',''),'audience':_0x284877['data1'],'state':_0x3b65d2,'nonce':_0x145b16};redis['set'](_0x3b65d2,JSON['stringify'](_0x284877));return _0x324d7d;}function isValidIdToken(_0x15edec,_0x25f239){try{var _0x17a376=jwt[_0xc2f1('0x2b')](_0x15edec,{'complete':!![]});var _0x46dc98=_0x17a376[_0xc2f1('0x2c')];if(_0x46dc98['iss']!==_0x25f239['issuer'])return![];if(_0x46dc98[_0xc2f1('0x2d')]!==_0x25f239['audience'])return![];if(_0x46dc98[_0xc2f1('0x24')]!==_0x25f239[_0xc2f1('0x24')])return![];if(moment()[_0xc2f1('0x2e')](moment['unix'](_0x46dc98['exp'])))return![];return!![];}catch(_0x669740){throw _0x669740;}}function refreshOauth2MicrosoftAccessToken(_0x1900f0){return Promise[_0xc2f1('0x2f')]()[_0xc2f1('0x30')](function(){if(_0x1900f0[_0xc2f1('0x31')])return _0x1900f0;return db[_0xc2f1('0x32')][_0xc2f1('0x33')]({'where':{'id':_0x1900f0['id']},'raw':!![]});})[_0xc2f1('0x30')](function(_0x1837fe){var _0x431ff7={'grant_type':'refresh_token','refresh_token':_0x1837fe[_0xc2f1('0x34')],'scope':getAccessTokenScope(_0x1837fe),'redirect_uri':_0x1837fe[_0xc2f1('0x35')],'client_id':_0x1837fe[_0xc2f1('0x36')],'client_secret':encryptor[_0xc2f1('0x37')](_0x1837fe[_0xc2f1('0x31')])};var _0x3a62c9={'method':_0xc2f1('0x38'),'uri':MICROSOFT_AUTH_URL['replace'](_0xc2f1('0x18'),_0x1837fe['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x431ff7,'json':!![]};return rp(_0x3a62c9);})[_0xc2f1('0x30')](function(_0x5882d4){_0x1900f0[_0xc2f1('0x39')]=_0x5882d4[_0xc2f1('0x3a')];_0x1900f0['data6']=_0x5882d4[_0xc2f1('0x3b')];return db['CloudProvider'][_0xc2f1('0x3c')]({'data5':_0x1900f0[_0xc2f1('0x39')],'data6':_0x1900f0[_0xc2f1('0x34')]},{'where':{'id':_0x1900f0['id']}});})[_0xc2f1('0x30')](function(){return _0x1900f0;})[_0xc2f1('0x3d')](function(_0x37e94a){logger[_0xc2f1('0x3e')](_0xc2f1('0x3f'),_0x1900f0['id'],_0x37e94a);});}function getOauth2MicrosoftAccessToken(_0x13ada5,_0x168524){var _0x4b6e2f={'grant_type':_0xc2f1('0x40'),'code':_0x13ada5,'scope':getAccessTokenScope(_0x168524),'redirect_uri':_0x168524[_0xc2f1('0x35')],'client_id':_0x168524[_0xc2f1('0x36')],'client_secret':encryptor['decryptString'](_0x168524['data3'])};var _0x2dad31={'method':_0xc2f1('0x38'),'uri':MICROSOFT_AUTH_URL[_0xc2f1('0x17')]('{TENANT_ID}',_0x168524[_0xc2f1('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4b6e2f,'json':!![]};return rp(_0x2dad31);}function startRefreshInterval(_0x84aa7e){var _0x1287fb=schedule[_0xc2f1('0x41')];if(_0x1287fb[_0x84aa7e['id']])clearInterval(_0x1287fb[_0x84aa7e['id']]);_0x1287fb[_0x84aa7e['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x84aa7e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xc2f1('0x41')]=_0x1287fb;}function startAllRefreshIntervals(){return db[_0xc2f1('0x32')][_0xc2f1('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc2f1('0x30')](function(_0xf1b943){var _0x56da65=_0xf1b943[_0xc2f1('0x27')](function(_0x2bafa9){return refreshOauth2MicrosoftAccessToken(_0x2bafa9)[_0xc2f1('0x30')](function(_0x8259a8){startRefreshInterval(_0x8259a8);});});return Promise[_0xc2f1('0x43')](_0x56da65);})['catch'](function(_0x5de4c1){var _0x27d167=_0x5de4c1?util[_0xc2f1('0x44')](_0x5de4c1,{'showHidden':![],'depth':null}):'';logger[_0xc2f1('0x3e')](_0xc2f1('0x45'),_0x27d167);});}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 cda2b7f..b68c835 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 _0xa329=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','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'];(function(_0x2af2a5,_0x4089fa){var _0x4ef35e=function(_0x5605d7){while(--_0x5605d7){_0x2af2a5['push'](_0x2af2a5['shift']());}};_0x4ef35e(++_0x4089fa);}(_0xa329,0x162));var _0x9a32=function(_0x4212c9,_0x26c526){_0x4212c9=_0x4212c9-0x0;var _0x6b7476=_0xa329[_0x4212c9];return _0x6b7476;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var moment=require('moment');var BPromise=require(_0x9a32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a32('0x3'));var db=require(_0x9a32('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a32('0x5'));var config=require(_0x9a32('0x6'));var jayson=require(_0x9a32('0x7'));var client=jayson[_0x9a32('0x8')][_0x9a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235b92,_0x4a8fba,_0x5b8b5e){return new BPromise(function(_0x4dc7f8,_0x344b35){return client[_0x9a32('0xa')](_0x235b92,_0x5b8b5e)['then'](function(_0x38f6cc){logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));logger[_0x9a32('0xe')](_0x9a32('0xf'),_0x4a8fba,'request\x20sent',JSON[_0x9a32('0x10')](_0x38f6cc));if(_0x38f6cc[_0x9a32('0x11')]){if(_0x38f6cc['error']['code']===0x1f4){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error']['message']);return _0x344b35(_0x38f6cc[_0x9a32('0x11')][_0x9a32('0x12')]);}logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error'][_0x9a32('0x12')]);return _0x4dc7f8(_0x38f6cc[_0x9a32('0x11')]['message']);}else{logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));_0x4dc7f8(_0x38f6cc[_0x9a32('0x13')][_0x9a32('0x12')]);}})[_0x9a32('0x14')](function(_0x4fa645){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x4fa645);_0x344b35(_0x4fa645);});});} \ No newline at end of file +var _0xb016=['error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x454db5,_0x11b082){var _0x5e1f82=function(_0x5f05cb){while(--_0x5f05cb){_0x454db5['push'](_0x454db5['shift']());}};_0x5e1f82(++_0x11b082);}(_0xb016,0x159));var _0x6b01=function(_0x186253,_0x44da6c){_0x186253=_0x186253-0x0;var _0x5896de=_0xb016[_0x186253];return _0x5896de;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d4402e5..85474a9 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(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x1261,0x144));var _0x1126=function(_0x28e0f1,_0xd1bfa0){_0x28e0f1=_0x28e0f1-0x0;var _0x13aedc=_0x1261[_0x28e0f1];return _0x13aedc;};'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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5c27f7,_0x20b0cc){var _0x44ac58=function(_0x345d43){while(--_0x345d43){_0x5c27f7['push'](_0x5c27f7['shift']());}};_0x44ac58(++_0x20b0cc);}(_0x2ef3,0xba));var _0x32ef=function(_0x346f66,_0x1e91e3){_0x346f66=_0x346f66-0x0;var _0x3502b8=_0x2ef3[_0x346f66];return _0x3502b8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 5d55c32..ff31d49 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 _0xa7ac=['STRING','exports','name'];(function(_0x4d4437,_0x196f65){var _0x4a89db=function(_0x597cfc){while(--_0x597cfc){_0x4d4437['push'](_0x4d4437['shift']());}};_0x4a89db(++_0x196f65);}(_0xa7ac,0x14e));var _0xca7a=function(_0x24f927,_0x53d117){_0x24f927=_0x24f927-0x0;var _0x528c44=_0xa7ac[_0x24f927];return _0x528c44;};'use strict';var Sequelize=require('sequelize');module[_0xca7a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xca7a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xca7a('0x2')]},'website':{'type':Sequelize[_0xca7a('0x2')]},'phone':{'type':Sequelize[_0xca7a('0x2')]},'fax':{'type':Sequelize[_0xca7a('0x2')]},'type':{'type':Sequelize[_0xca7a('0x2')]},'street':{'type':Sequelize[_0xca7a('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xca7a('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xca7a('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xca7a('0x2')]},'sCity':{'type':Sequelize[_0xca7a('0x2')]},'sCountry':{'type':Sequelize[_0xca7a('0x2')]},'description':{'type':Sequelize[_0xca7a('0x2')]}}; \ No newline at end of file +var _0x9fe3=['name','sequelize','STRING'];(function(_0x5bbb86,_0x31386a){var _0x41f61d=function(_0x4a29d4){while(--_0x4a29d4){_0x5bbb86['push'](_0x5bbb86['shift']());}};_0x41f61d(++_0x31386a);}(_0x9fe3,0x1b1));var _0x39fe=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x9fe3[_0x4b03c9];return _0x161ba2;};'use strict';var Sequelize=require(_0x39fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x39fe('0x1')],'unique':_0x39fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x39fe('0x1')]},'companyId':{'type':Sequelize[_0x39fe('0x1')]},'website':{'type':Sequelize[_0x39fe('0x1')]},'phone':{'type':Sequelize[_0x39fe('0x1')]},'fax':{'type':Sequelize[_0x39fe('0x1')]},'type':{'type':Sequelize[_0x39fe('0x1')]},'street':{'type':Sequelize[_0x39fe('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x39fe('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x39fe('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x39fe('0x1')]},'sStreet':{'type':Sequelize[_0x39fe('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x39fe('0x1')]},'sCountry':{'type':Sequelize[_0x39fe('0x1')]},'description':{'type':Sequelize[_0x39fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 79b30b7..e0273b5 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 _0xee93=['show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','getContacts','findOne','nolimit','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','map','merge','include','findAll','rows','catch'];(function(_0xf7831f,_0x1c6188){var _0x3f88e7=function(_0x2c6d4e){while(--_0x2c6d4e){_0xf7831f['push'](_0xf7831f['shift']());}};_0x3f88e7(++_0x1c6188);}(_0xee93,0xb7));var _0x3ee9=function(_0x5071e6,_0x2d2133){_0x5071e6=_0x5071e6-0x0;var _0x1d70c0=_0xee93[_0x5071e6];return _0x1d70c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ee9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ee9('0x1'));var rp=require('request-promise');var moment=require(_0x3ee9('0x2'));var BPromise=require(_0x3ee9('0x3'));var Mustache=require('mustache');var util=require(_0x3ee9('0x4'));var path=require(_0x3ee9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ee9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ee9('0x7'));var squel=require(_0x3ee9('0x8'));var crypto=require(_0x3ee9('0x9'));var jsforce=require(_0x3ee9('0xa'));var deskjs=require(_0x3ee9('0xb'));var toCsv=require(_0x3ee9('0xc'));var querystring=require(_0x3ee9('0xd'));var Papa=require(_0x3ee9('0xe'));var Redis=require(_0x3ee9('0xf'));var authService=require(_0x3ee9('0x10'));var qs=require(_0x3ee9('0x11'));var as=require(_0x3ee9('0x12'));var hardwareService=require(_0x3ee9('0x13'));var logger=require(_0x3ee9('0x14'))(_0x3ee9('0x15'));var utils=require(_0x3ee9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ee9('0x17'))['db'];function respondWithStatusCode(_0x6a06c4,_0x34306f){_0x34306f=_0x34306f||0xcc;return function(_0x508e6f){if(_0x508e6f){return _0x6a06c4[_0x3ee9('0x18')](_0x34306f);}return _0x6a06c4[_0x3ee9('0x19')](_0x34306f)[_0x3ee9('0x1a')]();};}function respondWithResult(_0x161493,_0x1232a3){_0x1232a3=_0x1232a3||0xc8;return function(_0x8bb3a2){if(_0x8bb3a2){return _0x161493[_0x3ee9('0x19')](_0x1232a3)[_0x3ee9('0x1b')](_0x8bb3a2);}};}function respondWithFilteredResult(_0x4ffa1e,_0x3904d8){return function(_0x331297){if(_0x331297){var _0x2a6b64=typeof _0x3904d8[_0x3ee9('0x1c')]==='undefined'&&typeof _0x3904d8[_0x3ee9('0x1d')]===_0x3ee9('0x1e');var _0x1a7058=_0x331297[_0x3ee9('0x1f')];var _0x3d34f1=_0x2a6b64?0x0:_0x3904d8[_0x3ee9('0x1c')];var _0x24692a=_0x2a6b64?_0x331297[_0x3ee9('0x1f')]:_0x3904d8['offset']+_0x3904d8[_0x3ee9('0x1d')];var _0x496793;if(_0x24692a>=_0x1a7058){_0x24692a=_0x1a7058;_0x496793=0xc8;}else{_0x496793=0xce;}_0x4ffa1e[_0x3ee9('0x19')](_0x496793);return _0x4ffa1e['set'](_0x3ee9('0x20'),_0x3d34f1+'-'+_0x24692a+'/'+_0x1a7058)[_0x3ee9('0x1b')](_0x331297);}return null;};}function patchUpdates(_0x4cd0e0){return function(_0x2d72b6){try{jsonpatch[_0x3ee9('0x21')](_0x2d72b6,_0x4cd0e0,!![]);}catch(_0x338252){return BPromise[_0x3ee9('0x22')](_0x338252);}return _0x2d72b6[_0x3ee9('0x23')]();};}function saveUpdates(_0x5f331b,_0x1d97fc){return function(_0x327dbc){if(_0x327dbc){return _0x327dbc[_0x3ee9('0x24')](_0x5f331b)[_0x3ee9('0x25')](function(_0x1d395f){return _0x1d395f;});}return null;};}function removeEntity(_0x5f4309,_0x398930){return function(_0x51e0e3){if(_0x51e0e3){return _0x51e0e3['destroy']()[_0x3ee9('0x25')](function(){var _0x49709d=_0x51e0e3[_0x3ee9('0x26')]({'plain':!![]});var _0x340def=_0x3ee9('0x27');return db[_0x3ee9('0x28')][_0x3ee9('0x29')]({'where':{'type':_0x340def,'resourceId':_0x49709d['id']}})[_0x3ee9('0x25')](function(){return _0x51e0e3;});})[_0x3ee9('0x25')](function(){_0x5f4309[_0x3ee9('0x19')](0xcc)[_0x3ee9('0x1a')]();});}};}function handleEntityNotFound(_0x37ae69,_0x3dc86e){return function(_0x37a396){if(!_0x37a396){_0x37ae69[_0x3ee9('0x18')](0x194);}return _0x37a396;};}function handleError(_0x5e22da,_0x204d99){_0x204d99=_0x204d99||0x1f4;return function(_0xb49ff6){logger['error'](_0xb49ff6[_0x3ee9('0x2a')]);if(_0xb49ff6[_0x3ee9('0x2b')]){delete _0xb49ff6[_0x3ee9('0x2b')];}_0x5e22da[_0x3ee9('0x19')](_0x204d99)['send'](_0xb49ff6);};}exports[_0x3ee9('0x2c')]=function(_0x331ab3,_0x20e902){var _0x539bdb={},_0x2ca988={},_0x482ab4={'count':0x0,'rows':[]};return db[_0x3ee9('0x2d')][_0x3ee9('0x2e')]()[_0x3ee9('0x25')](function(_0x3a6463){_0x2ca988[_0x3ee9('0x2f')]=_[_0x3ee9('0x30')](_0x3a6463);_0x2ca988['query']=_['keys'](_0x331ab3[_0x3ee9('0x31')]);_0x2ca988['filters']=_[_0x3ee9('0x32')](_0x2ca988[_0x3ee9('0x2f')],_0x2ca988[_0x3ee9('0x31')]);_0x539bdb[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0x2ca988[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x331ab3[_0x3ee9('0x31')]['fields']));_0x539bdb[_0x3ee9('0x33')]=_0x539bdb['attributes'][_0x3ee9('0x35')]?_0x539bdb[_0x3ee9('0x33')]:_0x2ca988['model'];if(!_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x36')]('nolimit')){_0x539bdb[_0x3ee9('0x1d')]=qs[_0x3ee9('0x1d')](_0x331ab3['query'][_0x3ee9('0x1d')]);_0x539bdb[_0x3ee9('0x1c')]=qs[_0x3ee9('0x1c')](_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x1c')]);}_0x539bdb[_0x3ee9('0x37')]=qs[_0x3ee9('0x38')](_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x38')]);_0x539bdb[_0x3ee9('0x39')]=qs[_0x3ee9('0x3a')](_['pick'](_0x331ab3[_0x3ee9('0x31')],_0x2ca988[_0x3ee9('0x3a')]),_0x3a6463);if(_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x3b')]){_0x539bdb[_0x3ee9('0x39')]=_['merge'](_0x539bdb['where'],{'$or':_[_0x3ee9('0x3c')](_0x539bdb['attributes'],function(_0x1704a6){var _0x26e08d={};_0x26e08d[_0x1704a6]={'$like':'%'+_0x331ab3[_0x3ee9('0x31')]['filter']+'%'};return _0x26e08d;})});}_0x539bdb=_[_0x3ee9('0x3d')]({},_0x539bdb,_0x331ab3['options']);var _0x4c21aa={'where':_0x539bdb['where']};return db[_0x3ee9('0x2d')]['count'](_0x4c21aa)['then'](function(_0x20a4e5){_0x482ab4[_0x3ee9('0x1f')]=_0x20a4e5;if(_0x331ab3[_0x3ee9('0x31')]['includeAll']){_0x539bdb[_0x3ee9('0x3e')]=[{'all':!![]}];}return db[_0x3ee9('0x2d')][_0x3ee9('0x3f')](_0x539bdb);})['then'](function(_0x2dedea){_0x482ab4[_0x3ee9('0x40')]=_0x2dedea;return _0x482ab4;})[_0x3ee9('0x25')](respondWithFilteredResult(_0x20e902,_0x539bdb))[_0x3ee9('0x41')](handleError(_0x20e902,null));})[_0x3ee9('0x41')](handleError(_0x20e902,null));};exports[_0x3ee9('0x42')]=function(_0x321c03,_0x4903e9){var _0x479eb7={'raw':![],'where':{'id':_0x321c03[_0x3ee9('0x43')]['id']}},_0xbe2438={};_0xbe2438[_0x3ee9('0x2f')]=_[_0x3ee9('0x30')](db[_0x3ee9('0x2d')]['rawAttributes']);_0xbe2438[_0x3ee9('0x31')]=_[_0x3ee9('0x30')](_0x321c03['query']);_0xbe2438['filters']=_[_0x3ee9('0x32')](_0xbe2438['model'],_0xbe2438[_0x3ee9('0x31')]);_0x479eb7[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0xbe2438[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x321c03[_0x3ee9('0x31')][_0x3ee9('0x34')]));_0x479eb7[_0x3ee9('0x33')]=_0x479eb7['attributes'][_0x3ee9('0x35')]?_0x479eb7[_0x3ee9('0x33')]:_0xbe2438[_0x3ee9('0x2f')];if(_0x321c03[_0x3ee9('0x31')]['includeAll']){_0x479eb7[_0x3ee9('0x3e')]=[{'all':!![]}];}_0x479eb7=_[_0x3ee9('0x3d')]({},_0x479eb7,_0x321c03[_0x3ee9('0x44')]);return db[_0x3ee9('0x2d')][_0x3ee9('0x45')](_0x479eb7)[_0x3ee9('0x25')](handleEntityNotFound(_0x4903e9,null))[_0x3ee9('0x25')](respondWithResult(_0x4903e9,null))[_0x3ee9('0x41')](handleError(_0x4903e9,null));};exports[_0x3ee9('0x46')]=function(_0x223289,_0x3e7a1e){return db[_0x3ee9('0x2d')]['create'](_0x223289[_0x3ee9('0x47')],{})[_0x3ee9('0x25')](function(_0x19ea60){var _0xae10d=_0x223289['user'][_0x3ee9('0x26')]({'plain':!![]});if(!_0xae10d)throw new Error(_0x3ee9('0x48'));if(_0xae10d[_0x3ee9('0x49')]==='user'){var _0xf7456a=_0x19ea60[_0x3ee9('0x26')]({'plain':!![]});var _0x54073a=_0x3ee9('0x27');return db[_0x3ee9('0x4a')][_0x3ee9('0x45')]({'where':{'name':_0x54073a,'userProfileId':_0xae10d[_0x3ee9('0x4b')]},'raw':!![]})[_0x3ee9('0x25')](function(_0x519049){if(_0x519049&&_0x519049[_0x3ee9('0x4c')]===0x0){return db[_0x3ee9('0x28')][_0x3ee9('0x46')]({'name':_0xf7456a[_0x3ee9('0x2b')],'resourceId':_0xf7456a['id'],'type':_0x519049['name'],'sectionId':_0x519049['id']},{})[_0x3ee9('0x25')](function(){return _0x19ea60;});}else{return _0x19ea60;}})[_0x3ee9('0x41')](function(_0x44616e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44616e);throw _0x44616e;});}return _0x19ea60;})[_0x3ee9('0x25')](respondWithResult(_0x3e7a1e,0xc9))['catch'](handleError(_0x3e7a1e,null));};exports[_0x3ee9('0x24')]=function(_0x58b4ac,_0x3ba862){if(_0x58b4ac[_0x3ee9('0x47')]['id']){delete _0x58b4ac[_0x3ee9('0x47')]['id'];}return db['CmCompany'][_0x3ee9('0x45')]({'where':{'id':_0x58b4ac[_0x3ee9('0x43')]['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x3ba862,null))[_0x3ee9('0x25')](saveUpdates(_0x58b4ac[_0x3ee9('0x47')],null))[_0x3ee9('0x25')](respondWithResult(_0x3ba862,null))[_0x3ee9('0x41')](handleError(_0x3ba862,null));};exports[_0x3ee9('0x29')]=function(_0x1da407,_0x483cbe){return db[_0x3ee9('0x2d')][_0x3ee9('0x45')]({'where':{'id':_0x1da407['params']['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x483cbe,null))[_0x3ee9('0x25')](removeEntity(_0x483cbe,null))[_0x3ee9('0x41')](handleError(_0x483cbe,null));};exports[_0x3ee9('0x2e')]=function(_0x900814,_0x29cefc){return db[_0x3ee9('0x2d')]['describe']()[_0x3ee9('0x25')](respondWithResult(_0x29cefc,null))[_0x3ee9('0x41')](handleError(_0x29cefc,null));};exports[_0x3ee9('0x4d')]=function(_0x401846,_0x58cb8b,_0x37d7ec){return db[_0x3ee9('0x4e')][_0x3ee9('0x45')]({'where':{'id':_0x401846[_0x3ee9('0x43')]['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x58cb8b,null))[_0x3ee9('0x25')](function(_0x3fc687){if(_0x3fc687){return _0x3fc687[_0x3ee9('0x4d')](_0x401846[_0x3ee9('0x47')][_0x3ee9('0x4f')],_['omit'](_0x401846[_0x3ee9('0x47')],[_0x3ee9('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x58cb8b,null))['catch'](handleError(_0x58cb8b,null));};exports[_0x3ee9('0x50')]=function(_0x147eed,_0xcfa16f,_0x4d3bf2){var _0x1d67c0={};var _0x442ff3={};var _0x3c8340;var _0x286600;return db[_0x3ee9('0x2d')][_0x3ee9('0x51')]({'where':{'id':_0x147eed['params']['id']}})['then'](handleEntityNotFound(_0xcfa16f,null))[_0x3ee9('0x25')](function(_0x497f36){if(_0x497f36){_0x3c8340=_0x497f36;_0x442ff3['model']=_[_0x3ee9('0x30')](db[_0x3ee9('0x4e')]['rawAttributes']);_0x442ff3[_0x3ee9('0x31')]=_['keys'](_0x147eed[_0x3ee9('0x31')]);_0x442ff3[_0x3ee9('0x3a')]=_['intersection'](_0x442ff3[_0x3ee9('0x2f')],_0x442ff3[_0x3ee9('0x31')]);_0x1d67c0[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0x442ff3[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x34')]));_0x1d67c0['attributes']=_0x1d67c0[_0x3ee9('0x33')][_0x3ee9('0x35')]?_0x1d67c0['attributes']:_0x442ff3[_0x3ee9('0x2f')];_0x1d67c0[_0x3ee9('0x37')]=qs[_0x3ee9('0x38')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x38')]);_0x1d67c0[_0x3ee9('0x39')]=qs['filters'](_['pick'](_0x147eed[_0x3ee9('0x31')],_0x442ff3[_0x3ee9('0x3a')]));if(_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x3b')]){_0x1d67c0['where']=_['merge'](_0x1d67c0[_0x3ee9('0x39')],{'$or':_[_0x3ee9('0x3c')](_0x1d67c0[_0x3ee9('0x33')],function(_0x1f6d3a){var _0x23a7c5={};_0x23a7c5[_0x1f6d3a]={'$like':'%'+_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x3b')]+'%'};return _0x23a7c5;})});}_0x1d67c0=_['merge']({},_0x1d67c0,_0x147eed[_0x3ee9('0x44')]);return _0x3c8340[_0x3ee9('0x50')](_0x1d67c0);}})[_0x3ee9('0x25')](function(_0x252c2a){if(_0x252c2a){_0x286600=_0x252c2a[_0x3ee9('0x35')];if(!_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x36')](_0x3ee9('0x52'))){_0x1d67c0[_0x3ee9('0x1d')]=qs[_0x3ee9('0x1d')](_0x147eed[_0x3ee9('0x31')]['limit']);_0x1d67c0[_0x3ee9('0x1c')]=qs[_0x3ee9('0x1c')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x1c')]);}return _0x3c8340[_0x3ee9('0x50')](_0x1d67c0);}})[_0x3ee9('0x25')](function(_0x2f260d){if(_0x2f260d){return _0x2f260d?{'count':_0x286600,'rows':_0x2f260d}:null;}})['then'](respondWithResult(_0xcfa16f,null))['catch'](handleError(_0xcfa16f,null));}; \ No newline at end of file +var _0x4b8c=['find','userProfileId','autoAssociation','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','json','apply','then','destroy','get','Companies','end','stack','send','index','CmCompany','describe','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b8c,0x115));var _0xc4b8=function(_0x308b9c,_0x1a840e){_0x308b9c=_0x308b9c-0x0;var _0x8e7288=_0x4b8c[_0x308b9c];return _0x8e7288;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b8('0x1'));var rp=require(_0xc4b8('0x2'));var moment=require(_0xc4b8('0x3'));var BPromise=require(_0xc4b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4b8('0x5'));var sox=require(_0xc4b8('0x6'));var csv=require(_0xc4b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4b8('0x8'));var _=require(_0xc4b8('0x9'));var squel=require(_0xc4b8('0xa'));var crypto=require(_0xc4b8('0xb'));var jsforce=require(_0xc4b8('0xc'));var deskjs=require(_0xc4b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc4b8('0xe'));var Papa=require(_0xc4b8('0xf'));var Redis=require(_0xc4b8('0x10'));var authService=require(_0xc4b8('0x11'));var qs=require(_0xc4b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b8('0x13'));var logger=require(_0xc4b8('0x14'))(_0xc4b8('0x15'));var utils=require(_0xc4b8('0x16'));var config=require(_0xc4b8('0x17'));var licenseUtil=require(_0xc4b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8cdeae,_0xa024f8){_0xa024f8=_0xa024f8||0xcc;return function(_0x1ca666){if(_0x1ca666){return _0x8cdeae[_0xc4b8('0x19')](_0xa024f8);}return _0x8cdeae[_0xc4b8('0x1a')](_0xa024f8)['end']();};}function respondWithResult(_0x53b7d1,_0x5346c6){_0x5346c6=_0x5346c6||0xc8;return function(_0x78a28c){if(_0x78a28c){return _0x53b7d1[_0xc4b8('0x1a')](_0x5346c6)['json'](_0x78a28c);}};}function respondWithFilteredResult(_0x40bd8f,_0x2e3154){return function(_0x309f97){if(_0x309f97){var _0x385b63=typeof _0x2e3154[_0xc4b8('0x1b')]==='undefined'&&typeof _0x2e3154[_0xc4b8('0x1c')]===_0xc4b8('0x1d');var _0x1812a4=_0x309f97[_0xc4b8('0x1e')];var _0x38f3f8=_0x385b63?0x0:_0x2e3154[_0xc4b8('0x1b')];var _0x41ed8a=_0x385b63?_0x309f97['count']:_0x2e3154['offset']+_0x2e3154['limit'];var _0xf2fc72;if(_0x41ed8a>=_0x1812a4){_0x41ed8a=_0x1812a4;_0xf2fc72=0xc8;}else{_0xf2fc72=0xce;}_0x40bd8f[_0xc4b8('0x1a')](_0xf2fc72);return _0x40bd8f['set']('Content-Range',_0x38f3f8+'-'+_0x41ed8a+'/'+_0x1812a4)[_0xc4b8('0x1f')](_0x309f97);}return null;};}function patchUpdates(_0x1d6ff4){return function(_0x32556f){try{jsonpatch[_0xc4b8('0x20')](_0x32556f,_0x1d6ff4,!![]);}catch(_0x385ee5){return BPromise['reject'](_0x385ee5);}return _0x32556f['save']();};}function saveUpdates(_0x4af354,_0x3b02ec){return function(_0x2b405d){if(_0x2b405d){return _0x2b405d['update'](_0x4af354)[_0xc4b8('0x21')](function(_0x3a3f99){return _0x3a3f99;});}return null;};}function removeEntity(_0x508734,_0x54ccd5){return function(_0x5fc905){if(_0x5fc905){return _0x5fc905[_0xc4b8('0x22')]()[_0xc4b8('0x21')](function(){var _0x5ee1ec=_0x5fc905[_0xc4b8('0x23')]({'plain':!![]});var _0x1dc24e=_0xc4b8('0x24');return db['UserProfileResource'][_0xc4b8('0x22')]({'where':{'type':_0x1dc24e,'resourceId':_0x5ee1ec['id']}})[_0xc4b8('0x21')](function(){return _0x5fc905;});})[_0xc4b8('0x21')](function(){_0x508734[_0xc4b8('0x1a')](0xcc)[_0xc4b8('0x25')]();});}};}function handleEntityNotFound(_0x19071b,_0x86cdf5){return function(_0x5a489e){if(!_0x5a489e){_0x19071b['sendStatus'](0x194);}return _0x5a489e;};}function handleError(_0x7682b0,_0x404cc3){_0x404cc3=_0x404cc3||0x1f4;return function(_0x2a7138){logger['error'](_0x2a7138[_0xc4b8('0x26')]);if(_0x2a7138['name']){delete _0x2a7138['name'];}_0x7682b0['status'](_0x404cc3)[_0xc4b8('0x27')](_0x2a7138);};}exports[_0xc4b8('0x28')]=function(_0x39bc74,_0x11ff24){var _0x820b70={},_0x169ae5={},_0x429af9={'count':0x0,'rows':[]};return db[_0xc4b8('0x29')][_0xc4b8('0x2a')]()[_0xc4b8('0x21')](function(_0x2d9c3f){_0x169ae5[_0xc4b8('0x2b')]=_[_0xc4b8('0x2c')](_0x2d9c3f);_0x169ae5[_0xc4b8('0x2d')]=_[_0xc4b8('0x2c')](_0x39bc74[_0xc4b8('0x2d')]);_0x169ae5['filters']=_['intersection'](_0x169ae5['model'],_0x169ae5[_0xc4b8('0x2d')]);_0x820b70['attributes']=_['intersection'](_0x169ae5['model'],qs[_0xc4b8('0x2e')](_0x39bc74[_0xc4b8('0x2d')][_0xc4b8('0x2e')]));_0x820b70[_0xc4b8('0x2f')]=_0x820b70['attributes'][_0xc4b8('0x30')]?_0x820b70[_0xc4b8('0x2f')]:_0x169ae5[_0xc4b8('0x2b')];if(!_0x39bc74['query'][_0xc4b8('0x31')](_0xc4b8('0x32'))){_0x820b70[_0xc4b8('0x1c')]=qs[_0xc4b8('0x1c')](_0x39bc74['query'][_0xc4b8('0x1c')]);_0x820b70['offset']=qs[_0xc4b8('0x1b')](_0x39bc74[_0xc4b8('0x2d')][_0xc4b8('0x1b')]);}_0x820b70[_0xc4b8('0x33')]=qs[_0xc4b8('0x34')](_0x39bc74[_0xc4b8('0x2d')][_0xc4b8('0x34')]);_0x820b70[_0xc4b8('0x35')]=qs['filters'](_[_0xc4b8('0x36')](_0x39bc74[_0xc4b8('0x2d')],_0x169ae5[_0xc4b8('0x37')]),_0x2d9c3f);if(_0x39bc74['query'][_0xc4b8('0x38')]){_0x820b70[_0xc4b8('0x35')]=_[_0xc4b8('0x39')](_0x820b70[_0xc4b8('0x35')],{'$or':_[_0xc4b8('0x3a')](_0x820b70[_0xc4b8('0x2f')],function(_0x3460e4){var _0xe3a3d0={};_0xe3a3d0[_0x3460e4]={'$like':'%'+_0x39bc74[_0xc4b8('0x2d')][_0xc4b8('0x38')]+'%'};return _0xe3a3d0;})});}_0x820b70=_['merge']({},_0x820b70,_0x39bc74[_0xc4b8('0x3b')]);var _0x3d2863={'where':_0x820b70['where']};return db[_0xc4b8('0x29')][_0xc4b8('0x1e')](_0x3d2863)[_0xc4b8('0x21')](function(_0x11088d){_0x429af9[_0xc4b8('0x1e')]=_0x11088d;if(_0x39bc74[_0xc4b8('0x2d')]['includeAll']){_0x820b70[_0xc4b8('0x3c')]=[{'all':!![]}];}return db[_0xc4b8('0x29')][_0xc4b8('0x3d')](_0x820b70);})['then'](function(_0x5859da){_0x429af9[_0xc4b8('0x3e')]=_0x5859da;return _0x429af9;})[_0xc4b8('0x21')](respondWithFilteredResult(_0x11ff24,_0x820b70))['catch'](handleError(_0x11ff24,null));})[_0xc4b8('0x3f')](handleError(_0x11ff24,null));};exports[_0xc4b8('0x40')]=function(_0x61203c,_0x5efd22){var _0x445f0f={'raw':![],'where':{'id':_0x61203c[_0xc4b8('0x41')]['id']}},_0x459875={};_0x459875[_0xc4b8('0x2b')]=_['keys'](db[_0xc4b8('0x29')][_0xc4b8('0x42')]);_0x459875[_0xc4b8('0x2d')]=_[_0xc4b8('0x2c')](_0x61203c[_0xc4b8('0x2d')]);_0x459875[_0xc4b8('0x37')]=_[_0xc4b8('0x43')](_0x459875[_0xc4b8('0x2b')],_0x459875['query']);_0x445f0f[_0xc4b8('0x2f')]=_[_0xc4b8('0x43')](_0x459875[_0xc4b8('0x2b')],qs['fields'](_0x61203c[_0xc4b8('0x2d')][_0xc4b8('0x2e')]));_0x445f0f[_0xc4b8('0x2f')]=_0x445f0f['attributes']['length']?_0x445f0f[_0xc4b8('0x2f')]:_0x459875[_0xc4b8('0x2b')];if(_0x61203c[_0xc4b8('0x2d')][_0xc4b8('0x44')]){_0x445f0f[_0xc4b8('0x3c')]=[{'all':!![]}];}_0x445f0f=_[_0xc4b8('0x39')]({},_0x445f0f,_0x61203c[_0xc4b8('0x3b')]);return db[_0xc4b8('0x29')]['find'](_0x445f0f)[_0xc4b8('0x21')](handleEntityNotFound(_0x5efd22,null))['then'](respondWithResult(_0x5efd22,null))[_0xc4b8('0x3f')](handleError(_0x5efd22,null));};exports[_0xc4b8('0x45')]=function(_0x46a60d,_0x25720a){return db[_0xc4b8('0x29')][_0xc4b8('0x45')](_0x46a60d[_0xc4b8('0x46')],{})[_0xc4b8('0x21')](function(_0x4bd98a){var _0x2f88cc=_0x46a60d['user'][_0xc4b8('0x23')]({'plain':!![]});if(!_0x2f88cc)throw new Error(_0xc4b8('0x47'));if(_0x2f88cc[_0xc4b8('0x48')]===_0xc4b8('0x49')){var _0x54460b=_0x4bd98a[_0xc4b8('0x23')]({'plain':!![]});var _0x301e53='Companies';return db[_0xc4b8('0x4a')][_0xc4b8('0x4b')]({'where':{'name':_0x301e53,'userProfileId':_0x2f88cc[_0xc4b8('0x4c')]},'raw':!![]})[_0xc4b8('0x21')](function(_0x47ebcf){if(_0x47ebcf&&_0x47ebcf[_0xc4b8('0x4d')]===0x0){return db[_0xc4b8('0x4e')]['create']({'name':_0x54460b[_0xc4b8('0x4f')],'resourceId':_0x54460b['id'],'type':_0x47ebcf[_0xc4b8('0x4f')],'sectionId':_0x47ebcf['id']},{})['then'](function(){return _0x4bd98a;});}else{return _0x4bd98a;}})['catch'](function(_0x2b6f03){logger[_0xc4b8('0x50')](_0xc4b8('0x51'),_0x2b6f03);throw _0x2b6f03;});}return _0x4bd98a;})[_0xc4b8('0x21')](respondWithResult(_0x25720a,0xc9))['catch'](handleError(_0x25720a,null));};exports['update']=function(_0x46a711,_0x5c3e8d){if(_0x46a711['body']['id']){delete _0x46a711[_0xc4b8('0x46')]['id'];}return db[_0xc4b8('0x29')][_0xc4b8('0x4b')]({'where':{'id':_0x46a711[_0xc4b8('0x41')]['id']}})[_0xc4b8('0x21')](handleEntityNotFound(_0x5c3e8d,null))['then'](saveUpdates(_0x46a711[_0xc4b8('0x46')],null))[_0xc4b8('0x21')](respondWithResult(_0x5c3e8d,null))[_0xc4b8('0x3f')](handleError(_0x5c3e8d,null));};exports[_0xc4b8('0x22')]=function(_0x471da2,_0x5f1c92){return db[_0xc4b8('0x29')][_0xc4b8('0x4b')]({'where':{'id':_0x471da2[_0xc4b8('0x41')]['id']}})[_0xc4b8('0x21')](handleEntityNotFound(_0x5f1c92,null))[_0xc4b8('0x21')](removeEntity(_0x5f1c92,null))[_0xc4b8('0x3f')](handleError(_0x5f1c92,null));};exports[_0xc4b8('0x2a')]=function(_0x6d23b6,_0x16d001){return db[_0xc4b8('0x29')][_0xc4b8('0x2a')]()[_0xc4b8('0x21')](respondWithResult(_0x16d001,null))[_0xc4b8('0x3f')](handleError(_0x16d001,null));};exports[_0xc4b8('0x52')]=function(_0x58da60,_0x544f1d,_0x17a99e){return db['CmContact']['find']({'where':{'id':_0x58da60[_0xc4b8('0x41')]['id']}})['then'](handleEntityNotFound(_0x544f1d,null))[_0xc4b8('0x21')](function(_0x1a9a32){if(_0x1a9a32){return _0x1a9a32[_0xc4b8('0x52')](_0x58da60[_0xc4b8('0x46')][_0xc4b8('0x53')],_[_0xc4b8('0x54')](_0x58da60[_0xc4b8('0x46')],[_0xc4b8('0x53'),'id'])||{});}})['then'](respondWithResult(_0x544f1d,null))['catch'](handleError(_0x544f1d,null));};exports[_0xc4b8('0x55')]=function(_0xd09a39,_0x487fe8,_0x432267){var _0x4cddc1={};var _0x42a615={};var _0x273241;var _0x5a5a9a;return db[_0xc4b8('0x29')][_0xc4b8('0x56')]({'where':{'id':_0xd09a39[_0xc4b8('0x41')]['id']}})[_0xc4b8('0x21')](handleEntityNotFound(_0x487fe8,null))[_0xc4b8('0x21')](function(_0x4a8709){if(_0x4a8709){_0x273241=_0x4a8709;_0x42a615[_0xc4b8('0x2b')]=_['keys'](db[_0xc4b8('0x57')][_0xc4b8('0x42')]);_0x42a615['query']=_[_0xc4b8('0x2c')](_0xd09a39[_0xc4b8('0x2d')]);_0x42a615[_0xc4b8('0x37')]=_['intersection'](_0x42a615['model'],_0x42a615[_0xc4b8('0x2d')]);_0x4cddc1['attributes']=_[_0xc4b8('0x43')](_0x42a615[_0xc4b8('0x2b')],qs[_0xc4b8('0x2e')](_0xd09a39[_0xc4b8('0x2d')][_0xc4b8('0x2e')]));_0x4cddc1['attributes']=_0x4cddc1[_0xc4b8('0x2f')][_0xc4b8('0x30')]?_0x4cddc1[_0xc4b8('0x2f')]:_0x42a615['model'];_0x4cddc1['order']=qs[_0xc4b8('0x34')](_0xd09a39['query']['sort']);_0x4cddc1[_0xc4b8('0x35')]=qs[_0xc4b8('0x37')](_[_0xc4b8('0x36')](_0xd09a39[_0xc4b8('0x2d')],_0x42a615[_0xc4b8('0x37')]));if(_0xd09a39[_0xc4b8('0x2d')][_0xc4b8('0x38')]){_0x4cddc1[_0xc4b8('0x35')]=_[_0xc4b8('0x39')](_0x4cddc1[_0xc4b8('0x35')],{'$or':_[_0xc4b8('0x3a')](_0x4cddc1['attributes'],function(_0x34c698){var _0x5c624e={};_0x5c624e[_0x34c698]={'$like':'%'+_0xd09a39['query'][_0xc4b8('0x38')]+'%'};return _0x5c624e;})});}_0x4cddc1=_[_0xc4b8('0x39')]({},_0x4cddc1,_0xd09a39[_0xc4b8('0x3b')]);return _0x273241[_0xc4b8('0x55')](_0x4cddc1);}})['then'](function(_0xe74894){if(_0xe74894){_0x5a5a9a=_0xe74894[_0xc4b8('0x30')];if(!_0xd09a39[_0xc4b8('0x2d')][_0xc4b8('0x31')]('nolimit')){_0x4cddc1[_0xc4b8('0x1c')]=qs[_0xc4b8('0x1c')](_0xd09a39[_0xc4b8('0x2d')][_0xc4b8('0x1c')]);_0x4cddc1['offset']=qs[_0xc4b8('0x1b')](_0xd09a39['query'][_0xc4b8('0x1b')]);}return _0x273241[_0xc4b8('0x55')](_0x4cddc1);}})['then'](function(_0x1fb371){if(_0x1fb371){return _0x1fb371?{'count':_0x5a5a9a,'rows':_0x1fb371}:null;}})[_0xc4b8('0x21')](respondWithResult(_0x487fe8,null))[_0xc4b8('0x3f')](handleError(_0x487fe8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 98d578a..5cda857 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 _0x3243=['CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x3243,0x188));var _0x3324=function(_0x125217,_0x1732ba){_0x125217=_0x125217-0x0;var _0x67dfb1=_0x3243[_0x125217];return _0x67dfb1;};'use strict';var _=require('lodash');var util=require(_0x3324('0x0'));var logger=require(_0x3324('0x1'))(_0x3324('0x2'));var moment=require('moment');var BPromise=require(_0x3324('0x3'));var rp=require(_0x3324('0x4'));var fs=require('fs');var path=require(_0x3324('0x5'));var rimraf=require(_0x3324('0x6'));var config=require(_0x3324('0x7'));var attributes=require(_0x3324('0x8'));module[_0x3324('0x9')]=function(_0x3b07f0,_0x27336e){return _0x3b07f0[_0x3324('0xa')](_0x3324('0xb'),attributes,{'tableName':_0x3324('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf18=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api'];(function(_0x23a4dc,_0xe2e6da){var _0x20a866=function(_0x10688a){while(--_0x10688a){_0x23a4dc['push'](_0x23a4dc['shift']());}};_0x20a866(++_0xe2e6da);}(_0xdf18,0xb2));var _0x8df1=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xdf18[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x8df1('0x0'));var util=require(_0x8df1('0x1'));var logger=require(_0x8df1('0x2'))(_0x8df1('0x3'));var moment=require(_0x8df1('0x4'));var BPromise=require(_0x8df1('0x5'));var rp=require(_0x8df1('0x6'));var fs=require('fs');var path=require(_0x8df1('0x7'));var rimraf=require(_0x8df1('0x8'));var config=require(_0x8df1('0x9'));var attributes=require(_0x8df1('0xa'));module[_0x8df1('0xb')]=function(_0x2f0ab4,_0x2c996d){return _0x2f0ab4[_0x8df1('0xc')]('CmCompany',attributes,{'tableName':_0x8df1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 0111047..17222f0 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 _0xd676=['request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x12adc,_0x1bb467){var _0x547ee0=function(_0x31af14){while(--_0x31af14){_0x12adc['push'](_0x12adc['shift']());}};_0x547ee0(++_0x1bb467);}(_0xd676,0x146));var _0x6d67=function(_0x48535c,_0x33c086){_0x48535c=_0x48535c-0x0;var _0x2cf084=_0xd676[_0x48535c];return _0x2cf084;};'use strict';var _=require(_0x6d67('0x0'));var util=require(_0x6d67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d67('0x2'));var fs=require('fs');var Redis=require(_0x6d67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d67('0x4'));var logger=require(_0x6d67('0x5'))(_0x6d67('0x6'));var config=require('../../config/environment');var jayson=require(_0x6d67('0x7'));var client=jayson[_0x6d67('0x8')][_0x6d67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x496481,_0x3baee3,_0x1be523){return new BPromise(function(_0x411a33,_0xe22eac){return client[_0x6d67('0xa')](_0x496481,_0x1be523)[_0x6d67('0xb')](function(_0x5a2245){logger[_0x6d67('0xc')](_0x6d67('0xd'),_0x3baee3,'request\x20sent');logger[_0x6d67('0xe')](_0x6d67('0xf'),_0x3baee3,'request\x20sent',JSON['stringify'](_0x5a2245));if(_0x5a2245[_0x6d67('0x10')]){if(_0x5a2245[_0x6d67('0x10')]['code']===0x1f4){logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);return _0xe22eac(_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);}logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);return _0x411a33(_0x5a2245['error'][_0x6d67('0x11')]);}else{logger['info'](_0x6d67('0xd'),_0x3baee3,_0x6d67('0x12'));_0x411a33(_0x5a2245[_0x6d67('0x13')][_0x6d67('0x11')]);}})[_0x6d67('0x14')](function(_0x521aa3){logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x521aa3);_0xe22eac(_0x521aa3);});});} \ No newline at end of file +var _0xd895=['request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x36a3fc,_0x54b61d){var _0x364501=function(_0x881910){while(--_0x881910){_0x36a3fc['push'](_0x36a3fc['shift']());}};_0x364501(++_0x54b61d);}(_0xd895,0x1e1));var _0x5d89=function(_0x59734f,_0x2c9524){_0x59734f=_0x59734f-0x0;var _0xbc0ede=_0xd895[_0x59734f];return _0xbc0ede;};'use strict';var _=require(_0x5d89('0x0'));var util=require(_0x5d89('0x1'));var moment=require('moment');var BPromise=require(_0x5d89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d89('0x3'));var db=require(_0x5d89('0x4'))['db'];var utils=require(_0x5d89('0x5'));var logger=require(_0x5d89('0x6'))('rpc');var config=require(_0x5d89('0x7'));var jayson=require(_0x5d89('0x8'));var client=jayson['client'][_0x5d89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e2767,_0x560c7e,_0x4bfc7d){return new BPromise(function(_0x523b7c,_0x3e34d0){return client[_0x5d89('0xa')](_0x4e2767,_0x4bfc7d)[_0x5d89('0xb')](function(_0x2f8ada){logger[_0x5d89('0xc')]('CmCompany,\x20%s,\x20%s',_0x560c7e,_0x5d89('0xd'));logger[_0x5d89('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x560c7e,_0x5d89('0xd'),JSON[_0x5d89('0xf')](_0x2f8ada));if(_0x2f8ada[_0x5d89('0x10')]){if(_0x2f8ada['error']['code']===0x1f4){logger[_0x5d89('0x10')](_0x5d89('0x11'),_0x560c7e,_0x2f8ada[_0x5d89('0x10')][_0x5d89('0x12')]);return _0x3e34d0(_0x2f8ada[_0x5d89('0x10')][_0x5d89('0x12')]);}logger['error'](_0x5d89('0x11'),_0x560c7e,_0x2f8ada[_0x5d89('0x10')]['message']);return _0x523b7c(_0x2f8ada[_0x5d89('0x10')][_0x5d89('0x12')]);}else{logger[_0x5d89('0xc')]('CmCompany,\x20%s,\x20%s',_0x560c7e,'request\x20sent');_0x523b7c(_0x2f8ada['result'][_0x5d89('0x12')]);}})['catch'](function(_0x28c8e0){logger[_0x5d89('0x10')](_0x5d89('0x11'),_0x560c7e,_0x28c8e0);_0x3e34d0(_0x28c8e0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 309e6e4..30539cc 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 _0x2f99=['post','create','addContacts','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','/describe','/:id/contacts'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x2f99,0x184));var _0x92f9=function(_0x29dedd,_0x3c7419){_0x29dedd=_0x29dedd-0x0;var _0x4e6d4f=_0x2f99[_0x29dedd];return _0x4e6d4f;};'use strict';var multer=require(_0x92f9('0x0'));var util=require(_0x92f9('0x1'));var path=require(_0x92f9('0x2'));var timeout=require(_0x92f9('0x3'));var express=require(_0x92f9('0x4'));var router=express['Router']();var fs_extra=require(_0x92f9('0x5'));var auth=require(_0x92f9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92f9('0x7'));router[_0x92f9('0x8')]('/',auth[_0x92f9('0x9')](),controller['index']);router['get'](_0x92f9('0xa'),auth[_0x92f9('0x9')](),controller['describe']);router[_0x92f9('0x8')]('/:id',auth[_0x92f9('0x9')](),controller['show']);router[_0x92f9('0x8')](_0x92f9('0xb'),auth['isAuthenticated'](),controller['getContacts']);router[_0x92f9('0xc')]('/',auth['isAuthenticated'](),controller[_0x92f9('0xd')]);router[_0x92f9('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x92f9('0xe')]);router[_0x92f9('0xf')](_0x92f9('0x10'),auth[_0x92f9('0x9')](),controller['update']);router[_0x92f9('0x11')](_0x92f9('0x10'),auth[_0x92f9('0x9')](),controller[_0x92f9('0x12')]);module[_0x92f9('0x13')]=router; \ No newline at end of file +var _0xda21=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','delete','destroy','multer','util'];(function(_0x6e6892,_0x3eda78){var _0x89a9fc=function(_0x339810){while(--_0x339810){_0x6e6892['push'](_0x6e6892['shift']());}};_0x89a9fc(++_0x3eda78);}(_0xda21,0x11c));var _0x1da2=function(_0x379aff,_0x3fb886){_0x379aff=_0x379aff-0x0;var _0x43150b=_0xda21[_0x379aff];return _0x43150b;};'use strict';var multer=require(_0x1da2('0x0'));var util=require(_0x1da2('0x1'));var path=require(_0x1da2('0x2'));var timeout=require(_0x1da2('0x3'));var express=require(_0x1da2('0x4'));var router=express[_0x1da2('0x5')]();var fs_extra=require(_0x1da2('0x6'));var auth=require(_0x1da2('0x7'));var interaction=require(_0x1da2('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x1da2('0x9')]('/',auth[_0x1da2('0xa')](),controller['index']);router['get']('/describe',auth[_0x1da2('0xa')](),controller[_0x1da2('0xb')]);router[_0x1da2('0x9')]('/:id',auth[_0x1da2('0xa')](),controller[_0x1da2('0xc')]);router[_0x1da2('0x9')](_0x1da2('0xd'),auth['isAuthenticated'](),controller[_0x1da2('0xe')]);router[_0x1da2('0xf')]('/',auth['isAuthenticated'](),controller[_0x1da2('0x10')]);router[_0x1da2('0xf')](_0x1da2('0xd'),auth[_0x1da2('0xa')](),controller[_0x1da2('0x11')]);router[_0x1da2('0x12')](_0x1da2('0x13'),auth[_0x1da2('0xa')](),controller['update']);router[_0x1da2('0x14')](_0x1da2('0x13'),auth[_0x1da2('0xa')](),controller[_0x1da2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 60c50ad..2ee4afb 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 _0x0b34=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x1eafee,_0x3f5d73){var _0x356c18=function(_0x3f6514){while(--_0x3f6514){_0x1eafee['push'](_0x1eafee['shift']());}};_0x356c18(++_0x3f5d73);}(_0x0b34,0x6b));var _0x40b3=function(_0x58603b,_0x12e69d){_0x58603b=_0x58603b-0x0;var _0x34048d=_0x0b34[_0x58603b];return _0x34048d;};'use strict';var _=require(_0x40b3('0x0'));var Sequelize=require(_0x40b3('0x1'));module[_0x40b3('0x2')]={'firstName':{'type':Sequelize[_0x40b3('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x40b3('0x3')]},'street':{'type':Sequelize[_0x40b3('0x3')]},'postalCode':{'type':Sequelize[_0x40b3('0x3')]},'city':{'type':Sequelize[_0x40b3('0x3')]},'country':{'type':Sequelize[_0x40b3('0x3')]},'dateOfBirth':{'type':Sequelize[_0x40b3('0x3')]},'description':{'type':Sequelize[_0x40b3('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x40b3('0x3')]},'fax':{'type':Sequelize[_0x40b3('0x3')]},'email':{'type':Sequelize[_0x40b3('0x3')]},'url':{'type':Sequelize[_0x40b3('0x3')]},'facebook':{'type':Sequelize[_0x40b3('0x3')]},'fb_data':{'type':Sequelize[_0x40b3('0x3')]},'twitter':{'type':Sequelize[_0x40b3('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x40b3('0x3')]},'viber':{'type':Sequelize[_0x40b3('0x3')]},'line':{'type':Sequelize[_0x40b3('0x3')]},'wechat':{'type':Sequelize[_0x40b3('0x3')]},'telegram':{'type':Sequelize[_0x40b3('0x3')]},'UserId':{'type':Sequelize[_0x40b3('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x40b3('0x5')](0x2)[_0x40b3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x40b3('0x7')],'defaultValue':Sequelize[_0x40b3('0x8')]},'dialTimezone':{'type':Sequelize[_0x40b3('0x3')]},'utcOffset':{'type':Sequelize[_0x40b3('0x5')]}}; \ No newline at end of file +var _0x3b64=['UNSIGNED','DATE','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3b64,0x1d0));var _0x43b6=function(_0x16c3d6,_0x42b416){_0x16c3d6=_0x16c3d6-0x0;var _0x5a6803=_0x3b64[_0x16c3d6];return _0x5a6803;};'use strict';var _=require(_0x43b6('0x0'));var Sequelize=require(_0x43b6('0x1'));module[_0x43b6('0x2')]={'firstName':{'type':Sequelize[_0x43b6('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x43b6('0x3')]},'street':{'type':Sequelize[_0x43b6('0x3')]},'postalCode':{'type':Sequelize[_0x43b6('0x3')]},'city':{'type':Sequelize[_0x43b6('0x3')]},'country':{'type':Sequelize[_0x43b6('0x3')]},'dateOfBirth':{'type':Sequelize[_0x43b6('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x43b6('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43b6('0x3')]},'email':{'type':Sequelize[_0x43b6('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x43b6('0x3')]},'skype':{'type':Sequelize[_0x43b6('0x3')]},'teams':{'type':Sequelize[_0x43b6('0x3')]},'viber':{'type':Sequelize[_0x43b6('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x43b6('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x43b6('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x43b6('0x4')](0x2)[_0x43b6('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x43b6('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x43b6('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 378796e..e18b100 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 _0x3b19=['name','send','index','describe','getOptions','findAll','query','catch','CmContact','find','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','tags','isArray','join','[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','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','each','duplicates','$or','push','where','ListId','findOrCreate','hasOwnProperty','contact','show','params','Tag','Tags','color','tag','CmContactHasItem','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','getTags','findOne','model','rawAttributes','filters','attributes','fields','sort','pick','filter','options','nolimit','setTags','ids','all','items','item_types','ItemTypeId','OrderBy','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','item','ItemType.OrderBy','bulkCreate','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','intersection','includeAll','rows','ContactId','include','getHopperFinals','getJscriptySessions','order','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','VoiceCallReport','findAndCountAll','fullname','startCase','chat','Website','closed','closedAt','note','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','deviceModel','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','bluebird','util','path','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','sendStatus','error','stack'];(function(_0x26960e,_0x1d9cd3){var _0x19112e=function(_0x295f6e){while(--_0x295f6e){_0x26960e['push'](_0x26960e['shift']());}};_0x19112e(++_0x1d9cd3);}(_0x3b19,0x1e9));var _0x93b1=function(_0x12119e,_0x2c61e6){_0x12119e=_0x12119e-0x0;var _0x42cf30=_0x3b19[_0x12119e];return _0x42cf30;};'use strict';var moment=require('moment');var BPromise=require(_0x93b1('0x0'));var util=require(_0x93b1('0x1'));var path=require(_0x93b1('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93b1('0x3'));var Papa=require(_0x93b1('0x4'));var Redis=require('ioredis');var contacts=require(_0x93b1('0x5'));var qs=require(_0x93b1('0x6'));var logger=require(_0x93b1('0x7'))(_0x93b1('0x8'));var config=require(_0x93b1('0x9'));var shared=require(_0x93b1('0xa'));var db=require(_0x93b1('0xb'))['db'];config[_0x93b1('0xc')]=_[_0x93b1('0xd')](config[_0x93b1('0xc')],{'host':_0x93b1('0xe'),'port':0x18eb});var socket=require(_0x93b1('0xf'))(new Redis(config[_0x93b1('0xc')]));require(_0x93b1('0x10'))['register'](socket);function respondWithResult(_0x806052,_0x5b49dd){_0x5b49dd=_0x5b49dd||0xc8;return function(_0x82db05){if(_0x82db05){return _0x806052[_0x93b1('0x11')](_0x5b49dd)['json'](_0x82db05);}};}function respondWithFilteredResult(_0x5c4728,_0x3244d8){return function(_0x52f65d){if(_0x52f65d){var _0x3d02f7=typeof _0x3244d8[_0x93b1('0x12')]===_0x93b1('0x13')&&typeof _0x3244d8[_0x93b1('0x14')]===_0x93b1('0x13');var _0x3617d7=_0x52f65d[_0x93b1('0x15')];var _0x250646=_0x3d02f7?0x0:_0x3244d8[_0x93b1('0x12')];var _0x436403=_0x3d02f7?_0x52f65d['count']:_0x3244d8[_0x93b1('0x12')]+_0x3244d8[_0x93b1('0x14')];var _0x160a4b;if(_0x436403>=_0x3617d7){_0x436403=_0x3617d7;_0x160a4b=0xc8;}else{_0x160a4b=0xce;}_0x5c4728[_0x93b1('0x11')](_0x160a4b);return _0x5c4728[_0x93b1('0x16')](_0x93b1('0x17'),_0x250646+'-'+_0x436403+'/'+_0x3617d7)[_0x93b1('0x18')](_0x52f65d);}return null;};}function saveUpdates(_0xdf2815){return function(_0x29712b){if(_0x29712b){return _0x29712b['update'](_0xdf2815)[_0x93b1('0x19')](function(_0x325f5e){return _0x325f5e;});}return null;};}function removeEntity(_0x573758){return function(_0x205718){if(_0x205718){return _0x205718[_0x93b1('0x1a')]()[_0x93b1('0x19')](function(){_0x573758[_0x93b1('0x11')](0xcc)[_0x93b1('0x1b')]();});}};}function handleEntityNotFound(_0xa87f8b){return function(_0x417ec5){if(!_0x417ec5){_0xa87f8b[_0x93b1('0x1c')](0x194);}return _0x417ec5;};}function handleError(_0x1f0877,_0x28d5b4){_0x28d5b4=_0x28d5b4||0x1f4;return function(_0x48a401){logger[_0x93b1('0x1d')](_0x48a401[_0x93b1('0x1e')]);if(_0x48a401[_0x93b1('0x1f')]){delete _0x48a401['name'];}_0x1f0877[_0x93b1('0x11')](_0x28d5b4)[_0x93b1('0x20')](_0x48a401);};}exports[_0x93b1('0x21')]=function(_0x22a17c,_0x4fb3a0){var _0x2c8257={};return contacts[_0x93b1('0x22')]()[_0x93b1('0x19')](function(_0x358f00){_0x2c8257=qs[_0x93b1('0x23')](_0x358f00,_0x22a17c);return contacts[_0x93b1('0x24')](_0x22a17c[_0x93b1('0x25')],_0x22a17c['user'],_0x2c8257,_0x358f00);})['then'](respondWithFilteredResult(_0x4fb3a0,_0x2c8257))[_0x93b1('0x26')](handleError(_0x4fb3a0,null));};exports['destroy']=function(_0x32a888,_0x210932){return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x32a888['params']['id']}})['then'](handleEntityNotFound(_0x210932,null))['then'](removeEntity(_0x210932,null))[_0x93b1('0x26')](handleError(_0x210932,null));};exports[_0x93b1('0x22')]=function(_0x3d3724,_0x2f3c0b){return db[_0x93b1('0x27')]['describe']()['then'](function(_0x3b2fc7){delete _0x3b2fc7['tags'];for(var _0xf71b9f=0x0;_0xf71b9f0x0){return new Promise(function(_0x547bbe){var _0x3b7dbf=[];for(var _0x151281=0x0;_0x151281<_0x44a164[_0x93b1('0x2a')];_0x151281++){_0x3b7dbf[_0x93b1('0x63')](insertAdditionalPhones(_0x44a164[_0x151281][_0x93b1('0x68')],_0x44a164[_0x151281][_0x93b1('0x5f')]));}Promise['all'](_0x3b7dbf)[_0x93b1('0x19')](function(){_0x547bbe(0x1);});})[_0x93b1('0x19')](function(){return{'success':_0x282c8c,'failure':_0x558f18,'duplicates':_0x345ed2};});}else{return{'success':_0x282c8c,'failure':_0x558f18,'duplicates':_0x345ed2};}}})[_0x93b1('0x19')](respondWithResult(_0x294109,0xc9))[_0x93b1('0x26')](handleError(_0x294109,null));};exports[_0x93b1('0x69')]=function(_0x1669ce,_0x2da332){var _0x4585e8;return db['CmContact'][_0x93b1('0x22')]()[_0x93b1('0x19')](function(_0x2cc9dd){return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x1669ce[_0x93b1('0x6a')]['id']},'include':[{'model':db[_0x93b1('0x6b')],'as':_0x93b1('0x6c'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0x6d')],'required':_0x1669ce['query'][_0x93b1('0x6e')]?!![]:![]},{'model':db[_0x93b1('0x6f')],'as':'Phones','where':{'CmContactId':_0x1669ce['params']['id']},'required':![],'include':[{'model':db[_0x93b1('0x70')],'as':_0x93b1('0x71')}]}],'order':[db[_0x93b1('0x72')][_0x93b1('0x73')](_0x93b1('0x74'))],'attributes':_[_0x93b1('0x29')](_0x2cc9dd)});})[_0x93b1('0x19')](function(_0x1ffc7a){if(!_[_0x93b1('0x5b')](_0x1ffc7a)){_0x4585e8=_0x1ffc7a[_0x93b1('0x3b')]({'plain':!![]});var _0x14eeae={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ffc7a&&_0x1ffc7a[_0x93b1('0x65')]){if(_0x1ffc7a[_0x93b1('0x65')]){_0x14eeae[_0x93b1('0x64')][_0x93b1('0x75')][_0x93b1('0x63')]({'ListId':{'$ne':_0x1ffc7a[_0x93b1('0x65')]}});}}return db[_0x93b1('0x2f')][_0x93b1('0x24')](_0x14eeae);}})[_0x93b1('0x19')](function(_0x9ff21){if(!_[_0x93b1('0x5b')](_0x9ff21)){return _[_0x93b1('0x76')](_0x4585e8,_[_0x93b1('0x77')](_0x9ff21,function(_0x1e0c7b){return util[_0x93b1('0x78')](_0x93b1('0x79'),_0x1e0c7b['id']);}));}})[_0x93b1('0x19')](handleEntityNotFound(_0x2da332,null))[_0x93b1('0x19')](respondWithResult(_0x2da332,null))[_0x93b1('0x26')](handleError(_0x2da332,null));};exports[_0x93b1('0x47')]=function(_0x3ae233,_0x35c0f1){var _0x2b643e;if(_0x3ae233['body']['id']){delete _0x3ae233[_0x93b1('0x39')]['id'];}if(!_[_0x93b1('0x5b')](_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5c')])){var _0x242cf2=_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5c')];if(!_['isNil'](shared[_0x93b1('0x5e')][_0x242cf2]))_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5d')]=shared['timezones'][_0x242cf2][_0x93b1('0x5d')];}return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x3ae233['params']['id']}})['then'](handleEntityNotFound(_0x35c0f1,null))[_0x93b1('0x19')](saveUpdates(_0x3ae233['body'],null))[_0x93b1('0x19')](function(_0x4dcc7e){_0x2b643e=_0x4dcc7e;var _0x3bf905={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4dcc7e&&_0x4dcc7e[_0x93b1('0x65')]){if(_0x4dcc7e[_0x93b1('0x65')]){_0x3bf905['where'][_0x93b1('0x75')][_0x93b1('0x63')]({'ListId':{'$ne':_0x4dcc7e[_0x93b1('0x65')]}});}}return db[_0x93b1('0x2f')][_0x93b1('0x24')](_0x3bf905);})['then'](function(_0x522c2b){if(_0x522c2b){return _[_0x93b1('0x76')](_[_0x93b1('0x7a')](_0x3ae233[_0x93b1('0x39')],function(_0x3e62f0,_0x420b96){return _['startsWith'](_0x420b96,_0x93b1('0x30'));}),_[_0x93b1('0x77')](_0x522c2b,function(_0x38b1d7){return util[_0x93b1('0x78')]('cf_%d',_0x38b1d7['id']);}));}})[_0x93b1('0x19')](function(_0x373241){if(_0x373241&&!_[_0x93b1('0x7b')](_0x373241)){var _0x5ddbca=squel['update']()[_0x93b1('0x7c')](_0x93b1('0x7d'))[_0x93b1('0x7e')](_0x373241)[_0x93b1('0x64')](_0x93b1('0x7f'),_0x3ae233[_0x93b1('0x6a')]['id'])['toParam']();return db[_0x93b1('0x72')]['query'](_0x5ddbca[_0x93b1('0x80')],{'replacements':_0x5ddbca[_0x93b1('0x34')]});}})[_0x93b1('0x19')](function(){if(_0x3ae233[_0x93b1('0x39')][_0x93b1('0x81')]&&_0x2b643e){return db['CmHopper'][_0x93b1('0x47')]({'phone':_0x3ae233[_0x93b1('0x39')][_0x93b1('0x81')],'OrderBy':0x0},{'where':{'ContactId':_0x2b643e['id']}});}})[_0x93b1('0x19')](function(){return _0x2b643e;})['then'](respondWithResult(_0x35c0f1,null))['catch'](handleError(_0x35c0f1,null));};exports[_0x93b1('0x82')]=function(_0x261e6b,_0x4db787){var _0x5ac867={};var _0x5b6d77={};var _0xdae9e4;var _0x4e3bf3;return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x261e6b[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x4db787,null))[_0x93b1('0x19')](function(_0x13c5f3){if(_0x13c5f3){_0xdae9e4=_0x13c5f3;_0x5b6d77[_0x93b1('0x84')]=_[_0x93b1('0x29')](db[_0x93b1('0x6b')][_0x93b1('0x85')]);_0x5b6d77['query']=_[_0x93b1('0x29')](_0x261e6b[_0x93b1('0x25')]);_0x5b6d77[_0x93b1('0x86')]=_['intersection'](_0x5b6d77[_0x93b1('0x84')],_0x5b6d77['query']);_0x5ac867[_0x93b1('0x87')]=_['intersection'](_0x5b6d77[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x261e6b[_0x93b1('0x25')][_0x93b1('0x88')]));_0x5ac867[_0x93b1('0x87')]=_0x5ac867[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x5ac867[_0x93b1('0x87')]:_0x5b6d77[_0x93b1('0x84')];_0x5ac867['order']=qs['sort'](_0x261e6b[_0x93b1('0x25')][_0x93b1('0x89')]);_0x5ac867[_0x93b1('0x64')]=qs['filters'](_[_0x93b1('0x8a')](_0x261e6b['query'],_0x5b6d77['filters']));if(_0x261e6b[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x5ac867[_0x93b1('0x64')]=_['merge'](_0x5ac867[_0x93b1('0x64')],{'$or':_['map'](_0x5ac867[_0x93b1('0x87')],function(_0xe0b9a){var _0x47e3be={};_0x47e3be[_0xe0b9a]={'$like':'%'+_0x261e6b[_0x93b1('0x25')]['filter']+'%'};return _0x47e3be;})});}_0x5ac867=_[_0x93b1('0x38')]({},_0x5ac867,_0x261e6b[_0x93b1('0x8c')]);return _0xdae9e4[_0x93b1('0x82')](_0x5ac867);}})[_0x93b1('0x19')](function(_0x3bfed9){if(_0x3bfed9){_0x4e3bf3=_0x3bfed9[_0x93b1('0x2a')];if(!_0x261e6b[_0x93b1('0x25')]['hasOwnProperty'](_0x93b1('0x8d'))){_0x5ac867[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x261e6b['query'][_0x93b1('0x14')]);_0x5ac867['offset']=qs[_0x93b1('0x12')](_0x261e6b['query'][_0x93b1('0x12')]);}return _0xdae9e4[_0x93b1('0x82')](_0x5ac867);}})[_0x93b1('0x19')](function(_0x527b60){if(_0x527b60){return _0x527b60?{'count':_0x4e3bf3,'rows':_0x527b60}:null;}})[_0x93b1('0x19')](respondWithResult(_0x4db787,null))['catch'](handleError(_0x4db787,null));};exports[_0x93b1('0x8e')]=function(_0x52a99b,_0x18d76c){if(_0x52a99b[_0x93b1('0x39')]['id']){delete _0x52a99b[_0x93b1('0x39')]['id'];}return db['CmContact'][_0x93b1('0x83')]({'where':{'id':_0x52a99b[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x18d76c,null))[_0x93b1('0x19')](function(_0x2c31f4){if(_0x2c31f4){return _0x2c31f4[_0x93b1('0x8e')](_0x52a99b[_0x93b1('0x39')][_0x93b1('0x8f')]||[]);}return null;})[_0x93b1('0x19')](respondWithResult(_0x18d76c,null))[_0x93b1('0x26')](handleError(_0x18d76c,null));};exports['setAdditionalPhones']=function(_0x427aa2,_0x1a7567){var _0x1865b8=[];_0x1865b8[_0x93b1('0x63')](addAdditionalPhones(_0x427aa2[_0x93b1('0x39')]));Promise[_0x93b1('0x90')](_0x1865b8)[_0x93b1('0x19')](function(){_0x1865b8=[];_0x1865b8[_0x93b1('0x63')](deleteCmHopperPhones(_0x427aa2[_0x93b1('0x39')]['id']));_0x1865b8[_0x93b1('0x63')](addCmHopperPhones(_0x427aa2[_0x93b1('0x39')]['id']));Promise[_0x93b1('0x90')](_0x1865b8)['then'](function(){return[0x1];})['then'](respondWithResult(_0x1a7567,null));});};function addAdditionalPhones(_0x52b32b){var _0x4c0940;return new Promise(function(_0x2c77b1){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x52b32b['id']}})['then'](function(){db[_0x93b1('0x70')][_0x93b1('0x24')]({'raw':!![],'attributes':['id','OrderBy']})[_0x93b1('0x19')](function(_0x524591){var _0x568403=[];for(var _0x14745a=0x0;_0x14745a<_0x52b32b[_0x93b1('0x91')]['length'];_0x14745a++){var _0xcd53b=_0x52b32b[_0x93b1('0x92')]?_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x92')][_0x14745a])?'':_0x52b32b[_0x93b1('0x92')][_0x14745a]:_0x52b32b[_0x93b1('0x91')][_0x14745a]['ItemTypeId']?_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')]:'';var _0x3d39cd=_[_0x93b1('0x5b')](_0x52b32b['items'][_0x14745a]['description'])?'':_0x52b32b[_0x93b1('0x91')][_0x14745a]['description'];var _0x38de1c=_0xcd53b+':'+_0x52b32b[_0x93b1('0x91')][_0x14745a]['phone']+'§'+_0x3d39cd;if(_[_0x93b1('0x5b')](_0x4c0940))_0x4c0940=_0x38de1c;else _0x4c0940+=';'+_0x38de1c;var _0x5afd44=null;var _0x1be878=null;if(_0x52b32b[_0x93b1('0x92')]){if(!_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x92')][_0x14745a])){_0x1be878=_['find'](_0x524591,function(_0x4718b3){return _0x4718b3['id']===_0x52b32b[_0x93b1('0x92')][_0x14745a];});if(!_[_0x93b1('0x5b')](_0x1be878)){_0x5afd44=_0x1be878[_0x93b1('0x94')];}}}else{if(!_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x91')][_0x14745a])){_0x1be878=_[_0x93b1('0x28')](_0x524591,function(_0x5792fa){return _0x5792fa['id']===_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')];});if(!_[_0x93b1('0x5b')](_0x1be878)){_0x5afd44=_0x14745a;}}}if(_['isNil'](_0x5afd44)){_0x5afd44=0x64;}_0x568403['push'](addAdditionalPhone(_0x52b32b['id'],_0x52b32b['items'][_0x14745a][_0x93b1('0x81')],_0x52b32b['item_types']?_[_0x93b1('0x5b')](_0x52b32b['item_types'][_0x14745a])?null:_0x52b32b[_0x93b1('0x92')][_0x14745a]:_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')]?_0x52b32b['items'][_0x14745a][_0x93b1('0x93')]:null,_0x5afd44,_0x3d39cd));}Promise['all'](_0x568403)['then'](function(){db[_0x93b1('0x27')]['update']({'AdditionalPhones':_0x4c0940},{'where':{'id':_0x52b32b['id']}})[_0x93b1('0x19')](function(){_0x2c77b1(0x1);});});});});});}function addAdditionalPhone(_0xcef0ad,_0xd0aeff,_0x33ba7c,_0x38d24d,_0x2abab7){return db[_0x93b1('0x6f')]['find']({'where':{'CmContactId':_0xcef0ad,'item':_0xd0aeff}})[_0x93b1('0x19')](function(_0x17eeca){if(_0x17eeca)logger[_0x93b1('0x35')]('contact\x20phone\x20exists',_0x17eeca);else{db[_0x93b1('0x6f')][_0x93b1('0x45')]({'CmContactId':_0xcef0ad,'item':_0xd0aeff,'ItemTypeId':_0x33ba7c,'OrderBy':_0x38d24d,'ItemClass':_0x93b1('0x95'),'description':_0x2abab7});}});}function deleteCmHopperPhones(_0x33ac47){return new Promise(function(_0x5bb169){return db['CmHopper'][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x33ac47}})[_0x93b1('0x19')](function(_0x3f02d3){db[_0x93b1('0x96')][_0x93b1('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x93b1('0x77')](_0x3f02d3,'id')}}});})[_0x93b1('0x19')](function(){_0x5bb169(0x1);});});}function addCmHopperPhones(_0x465aad){return new Promise(function(_0x7c0f4c){return db[_0x93b1('0x41')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x465aad}})[_0x93b1('0x19')](function(_0x540b23){var _0x46d2a8=[];_[_0x93b1('0x77')](_0x540b23,function(_0x3bac08){_0x46d2a8[_0x93b1('0x63')](createCmHopperPhone(_0x465aad,_0x3bac08['id']));});Promise[_0x93b1('0x90')](_0x46d2a8)['then'](function(){_0x7c0f4c(0x1);});});});}function createCmHopperPhone(_0x2d3d4b,_0x13b5b2){return new Promise(function(_0x375b79){db[_0x93b1('0x6f')][_0x93b1('0x24')]({'raw':!![],'attributes':['item',_0x93b1('0x94')],'where':{'CmContactId':_0x2d3d4b,'ItemClass':_0x93b1('0x95')},'include':[{'model':db['ContactItemType'],'attributes':[_0x93b1('0x94')],'as':_0x93b1('0x71')}],'order':[_0x93b1('0x94'),db[_0x93b1('0x72')][_0x93b1('0x73')](_0x93b1('0x97'))]})[_0x93b1('0x19')](function(_0x2e8f22){var _0x1c97bd=0x1;var _0x53e801=_[_0x93b1('0x77')](_0x2e8f22,function(_0x1c115f){_0x1c115f['CmHopperId']=_0x13b5b2;_0x1c115f[_0x93b1('0x81')]=_0x1c115f[_0x93b1('0x98')];_0x1c115f[_0x93b1('0x94')]=_0x1c97bd;delete _0x1c115f[_0x93b1('0x99')];_0x1c97bd=_0x1c97bd+0x1;return _0x1c115f;});return db[_0x93b1('0x96')][_0x93b1('0x9a')](_0x53e801,{});})[_0x93b1('0x19')](function(){_0x375b79(0x1);});});}function insertAdditionalPhones(_0x1a4b27,_0x2dd626){return new Promise(function(_0x1a7d3d){var _0xbf05d4=[];for(var _0x484033=0x0;_0x484033<_0x2dd626[_0x93b1('0x2a')];_0x484033++){var _0x23e0b0=_0x2dd626[_0x484033];_0xbf05d4['push'](parseContactItemType(_0x23e0b0));}Promise[_0x93b1('0x90')](_0xbf05d4)[_0x93b1('0x19')](function(){var _0xbcc02c={'id':_0x1a4b27['id'],'items':_0x2dd626};return addAdditionalPhones(_0xbcc02c)[_0x93b1('0x19')](function(){return addCmHopperPhones(_0x1a4b27['id']);});})[_0x93b1('0x19')](function(){_0x1a7d3d(_0x1a4b27);});});}function parseContactItemType(_0x484fe1){return new Promise(function(_0x3e5366){if(_0x484fe1[_0x93b1('0x67')](_0x93b1('0x93'))){_0x3e5366(_0x484fe1);}else{return db['ContactItemType'][_0x93b1('0x28')]({'where':{'name':_0x484fe1['ItemType']}})[_0x93b1('0x19')](function(_0x406f20){if(_['isNil'](_0x406f20))_0x484fe1['ItemTypeId']=null;else _0x484fe1['ItemTypeId']=_0x406f20['id'];_0x3e5366(_0x484fe1);});}});}exports['getAdditionalPhones']=function(_0x4c6a07,_0x3ce48c){return db[_0x93b1('0x6f')][_0x93b1('0x24')]({'raw':!![],'where':{'CmContactId':_0x4c6a07[_0x93b1('0x6a')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize'][_0x93b1('0x73')]('`ItemType`.OrderBy')]]})[_0x93b1('0x19')](function(_0xca82c2){return _0xca82c2;})[_0x93b1('0x19')](respondWithResult(_0x3ce48c,null))[_0x93b1('0x26')](handleError(_0x3ce48c,null));};exports[_0x93b1('0x9b')]=function(_0x345da2,_0x13617b){return db[_0x93b1('0x6f')]['findAll']({'raw':!![],'where':{'CmContactId':_0x345da2[_0x93b1('0x39')][_0x93b1('0x9c')]}})[_0x93b1('0x19')](function(_0x4d8020){var _0x204222=_['map'](_0x4d8020,function(_0x44e1b6){_0x44e1b6[_0x93b1('0x9d')]=_0x345da2[_0x93b1('0x39')][_0x93b1('0x9e')];return _0x44e1b6;});return db[_0x93b1('0x6f')]['bulkCreate'](_0x204222,{});})[_0x93b1('0x19')](function(){return addCmHopperPhones(_0x345da2[_0x93b1('0x39')][_0x93b1('0x9e')]);})['then'](function(){return['ok'];})[_0x93b1('0x19')](respondWithResult(_0x13617b,null))[_0x93b1('0x26')](handleError(_0x13617b,null));};exports[_0x93b1('0x9f')]=function(_0x28f657,_0x56612d){var _0x1e1574=[];_0x1e1574[_0x93b1('0x63')](createCmHopperPhone(_0x28f657[_0x93b1('0x39')]['id'],_0x28f657[_0x93b1('0x39')]['hopperId']));Promise[_0x93b1('0x90')](_0x1e1574)[_0x93b1('0x19')](function(){return[0x1];})[_0x93b1('0x19')](respondWithResult(_0x56612d,null));};exports[_0x93b1('0xa0')]=function(_0x5dd16d,_0x10dd9c){var _0x39f0ac={'raw':![],'where':{}};var _0x39a74c={};var _0x3f32e6={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x5dd16d[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x10dd9c,null))[_0x93b1('0x19')](function(_0x311a59){if(_0x311a59){_0x39a74c[_0x93b1('0x84')]=_[_0x93b1('0x29')](db[_0x93b1('0x41')]['rawAttributes']);_0x39a74c[_0x93b1('0x25')]=_[_0x93b1('0x29')](_0x5dd16d[_0x93b1('0x25')]);_0x39a74c[_0x93b1('0x86')]=_['intersection'](_0x39a74c['model'],_0x39a74c[_0x93b1('0x25')]);_0x39f0ac[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x39a74c[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x88')]));_0x39f0ac[_0x93b1('0x87')]=_0x39f0ac[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x39f0ac[_0x93b1('0x87')]:_0x39a74c[_0x93b1('0x84')];if(!_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x39f0ac[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x5dd16d['query'][_0x93b1('0x14')]);_0x39f0ac[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x5dd16d['query'][_0x93b1('0x12')]);}_0x39f0ac['order']=qs[_0x93b1('0x89')](_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x89')]);_0x39f0ac[_0x93b1('0x64')]=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x5dd16d['query'],_0x39a74c[_0x93b1('0x86')]));_0x39f0ac['where']['ContactId']=_0x311a59['id'];if(_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x39f0ac[_0x93b1('0x64')]=_[_0x93b1('0x38')](_0x39f0ac[_0x93b1('0x64')],{'$or':_[_0x93b1('0x77')](_0x39f0ac[_0x93b1('0x87')],function(_0x3c6d9f){var _0x1343ce={};_0x1343ce[_0x3c6d9f]={'$like':'%'+_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x8b')]+'%'};return _0x1343ce;})});}_0x39f0ac=_['merge']({},_0x39f0ac,_0x5dd16d[_0x93b1('0x8c')]);return db[_0x93b1('0x41')][_0x93b1('0x15')]({'where':_0x39f0ac['where']})['then'](function(_0x458bb4){_0x3f32e6[_0x93b1('0x15')]=_0x458bb4;if(_0x5dd16d['query'][_0x93b1('0xa2')]){_0x39f0ac['include']=[{'all':!![]}];}return db[_0x93b1('0x41')][_0x93b1('0x24')](_0x39f0ac);})[_0x93b1('0x19')](function(_0x65d9bf){_0x3f32e6[_0x93b1('0xa3')]=_0x65d9bf;return _0x3f32e6;});}})['then'](respondWithFilteredResult(_0x10dd9c,_0x39f0ac))[_0x93b1('0x26')](handleError(_0x10dd9c,null));};exports['getHopperHistories']=function(_0x54fae1,_0x55200f){var _0x54909e={'raw':!![],'where':{}};var _0x14a67f={};var _0x26444f={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x54fae1[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x55200f,null))[_0x93b1('0x19')](function(_0x9305f9){if(_0x9305f9){_0x14a67f[_0x93b1('0x84')]=_[_0x93b1('0x29')](db['CmHopperHistory'][_0x93b1('0x85')]);_0x14a67f['query']=_[_0x93b1('0x29')](_0x54fae1[_0x93b1('0x25')]);_0x14a67f[_0x93b1('0x86')]=_['intersection'](_0x14a67f['model'],_0x14a67f['query']);_0x54909e['attributes']=_['intersection'](_0x14a67f[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x54fae1['query'][_0x93b1('0x88')]));_0x54909e[_0x93b1('0x87')]=_0x54909e[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x54909e['attributes']:_0x14a67f[_0x93b1('0x84')];if(!_0x54fae1[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x54909e['limit']=qs[_0x93b1('0x14')](_0x54fae1[_0x93b1('0x25')]['limit']);_0x54909e[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x54fae1[_0x93b1('0x25')][_0x93b1('0x12')]);}_0x54909e['order']=qs[_0x93b1('0x89')](_0x54fae1[_0x93b1('0x25')][_0x93b1('0x89')]);_0x54909e[_0x93b1('0x64')]=qs['filters'](_['pick'](_0x54fae1[_0x93b1('0x25')],_0x14a67f['filters']));_0x54909e[_0x93b1('0x64')][_0x93b1('0xa4')]=_0x9305f9['id'];if(_0x54fae1[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x54909e[_0x93b1('0x64')]=_['merge'](_0x54909e['where'],{'$or':_[_0x93b1('0x77')](_0x54909e['attributes'],function(_0x594b76){var _0x58b44d={};_0x58b44d[_0x594b76]={'$like':'%'+_0x54fae1[_0x93b1('0x25')]['filter']+'%'};return _0x58b44d;})});}_0x54909e=_[_0x93b1('0x38')]({},_0x54909e,_0x54fae1[_0x93b1('0x8c')]);return db[_0x93b1('0x50')][_0x93b1('0x15')]({'where':_0x54909e[_0x93b1('0x64')]})['then'](function(_0x4838f4){_0x26444f[_0x93b1('0x15')]=_0x4838f4;if(_0x54fae1[_0x93b1('0x25')][_0x93b1('0xa2')]){_0x54909e[_0x93b1('0xa5')]=[{'all':!![]}];}return db[_0x93b1('0x50')][_0x93b1('0x24')](_0x54909e);})['then'](function(_0x57bfe3){_0x26444f[_0x93b1('0xa3')]=_0x57bfe3;return _0x26444f;});}})['then'](respondWithFilteredResult(_0x55200f,_0x54909e))['catch'](handleError(_0x55200f,null));};exports[_0x93b1('0xa6')]=function(_0x3dde41,_0x50f553){var _0x133527={'raw':!![],'where':{}};var _0x31d190={};var _0x35eafe={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x3dde41[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x50f553,null))[_0x93b1('0x19')](function(_0x44bf2a){if(_0x44bf2a){_0x31d190[_0x93b1('0x84')]=_['keys'](db[_0x93b1('0x4f')][_0x93b1('0x85')]);_0x31d190['query']=_[_0x93b1('0x29')](_0x3dde41[_0x93b1('0x25')]);_0x31d190[_0x93b1('0x86')]=_[_0x93b1('0xa1')](_0x31d190[_0x93b1('0x84')],_0x31d190['query']);_0x133527[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x31d190[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x3dde41[_0x93b1('0x25')]['fields']));_0x133527[_0x93b1('0x87')]=_0x133527['attributes'][_0x93b1('0x2a')]?_0x133527[_0x93b1('0x87')]:_0x31d190[_0x93b1('0x84')];if(!_0x3dde41['query'][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x133527['limit']=qs[_0x93b1('0x14')](_0x3dde41['query'][_0x93b1('0x14')]);_0x133527['offset']=qs[_0x93b1('0x12')](_0x3dde41[_0x93b1('0x25')]['offset']);}_0x133527['order']=qs[_0x93b1('0x89')](_0x3dde41[_0x93b1('0x25')][_0x93b1('0x89')]);_0x133527[_0x93b1('0x64')]=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x3dde41[_0x93b1('0x25')],_0x31d190['filters']));_0x133527[_0x93b1('0x64')]['ContactId']=_0x44bf2a['id'];if(_0x3dde41[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x133527[_0x93b1('0x64')]=_['merge'](_0x133527[_0x93b1('0x64')],{'$or':_[_0x93b1('0x77')](_0x133527['attributes'],function(_0x4bcf9c){var _0x4ee62a={};_0x4ee62a[_0x4bcf9c]={'$like':'%'+_0x3dde41[_0x93b1('0x25')]['filter']+'%'};return _0x4ee62a;})});}_0x133527=_[_0x93b1('0x38')]({},_0x133527,_0x3dde41[_0x93b1('0x8c')]);return db[_0x93b1('0x4f')]['count']({'where':_0x133527[_0x93b1('0x64')]})[_0x93b1('0x19')](function(_0x3b50f8){_0x35eafe['count']=_0x3b50f8;if(_0x3dde41['query'][_0x93b1('0xa2')]){_0x133527[_0x93b1('0xa5')]=[{'all':!![]}];}return db[_0x93b1('0x4f')][_0x93b1('0x24')](_0x133527);})['then'](function(_0x47b8fd){_0x35eafe['rows']=_0x47b8fd;return _0x35eafe;});}})[_0x93b1('0x19')](respondWithFilteredResult(_0x50f553,_0x133527))[_0x93b1('0x26')](handleError(_0x50f553,null));};exports[_0x93b1('0xa7')]=function(_0x59cc0c,_0x2d805a){var _0x9aaf69={'raw':!![],'where':{}};var _0x1ee13b={};var _0x103682={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x59cc0c['params']['id']}})['then'](handleEntityNotFound(_0x2d805a,null))[_0x93b1('0x19')](function(_0x53563c){if(_0x53563c){_0x1ee13b[_0x93b1('0x84')]=_[_0x93b1('0x29')](db['JscriptySessionReport']['rawAttributes']);_0x1ee13b['query']=_[_0x93b1('0x29')](_0x59cc0c[_0x93b1('0x25')]);_0x1ee13b[_0x93b1('0x86')]=_[_0x93b1('0xa1')](_0x1ee13b[_0x93b1('0x84')],_0x1ee13b[_0x93b1('0x25')]);_0x9aaf69[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x1ee13b[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x59cc0c['query'][_0x93b1('0x88')]));_0x9aaf69['attributes']=_0x9aaf69[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x9aaf69[_0x93b1('0x87')]:_0x1ee13b[_0x93b1('0x84')];if(!_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x9aaf69[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x59cc0c['query'][_0x93b1('0x14')]);_0x9aaf69[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x12')]);}_0x9aaf69[_0x93b1('0xa8')]=qs[_0x93b1('0x89')](_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x89')]);_0x9aaf69['where']=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x59cc0c['query'],_0x1ee13b[_0x93b1('0x86')]));_0x9aaf69[_0x93b1('0x64')]['ContactId']=_0x53563c['id'];if(_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x9aaf69[_0x93b1('0x64')]=_['merge'](_0x9aaf69['where'],{'$or':_[_0x93b1('0x77')](_0x9aaf69[_0x93b1('0x87')],function(_0x3af6ad){var _0x3d1925={};_0x3d1925[_0x3af6ad]={'$like':'%'+_0x59cc0c['query'][_0x93b1('0x8b')]+'%'};return _0x3d1925;})});}_0x9aaf69=_[_0x93b1('0x38')]({},_0x9aaf69,_0x59cc0c[_0x93b1('0x8c')]);return db[_0x93b1('0x57')][_0x93b1('0x15')]({'where':_0x9aaf69[_0x93b1('0x64')]})[_0x93b1('0x19')](function(_0x598bf1){_0x103682[_0x93b1('0x15')]=_0x598bf1;if(_0x59cc0c[_0x93b1('0x25')][_0x93b1('0xa2')]){_0x9aaf69['include']=[{'all':!![]}];}return db[_0x93b1('0x57')][_0x93b1('0x24')](_0x9aaf69);})[_0x93b1('0x19')](function(_0x47efa7){_0x103682[_0x93b1('0xa3')]=_0x47efa7;return _0x103682;});}})[_0x93b1('0x19')](respondWithFilteredResult(_0x2d805a,_0x9aaf69))[_0x93b1('0x26')](handleError(_0x2d805a,null));};exports[_0x93b1('0xa9')]=function(_0x1a4192,_0x4cc861){try{if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0x65')]){throw new Error(_0x93b1('0xaa'));}if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0xab')]){throw new Error(_0x93b1('0xac'));}if(!_0x1a4192['body'][_0x93b1('0xad')]){throw new Error(_0x93b1('0xae'));}if(!_0x1a4192[_0x93b1('0x39')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x54f2ec=_0x1a4192[_0x93b1('0x39')]['binding_keys'][_0x93b1('0xaf')](',');var _0x1ad04c=_0x1a4192['body']['binding_values'][_0x93b1('0xaf')](',');if(!_0x54f2ec[_0x93b1('0x2a')]||!_0x1ad04c[_0x93b1('0x2a')]||_0x54f2ec[_0x93b1('0x2a')]!==_0x1ad04c[_0x93b1('0x2a')]){throw new Error(_0x93b1('0xb0'));}_0x1a4192[_0x93b1('0x39')][_0x93b1('0x88')]=_[_0x93b1('0xb1')](_0x54f2ec,_0x1ad04c);if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0x88')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x1a4192['body']['fields'][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}var _0x266504=path['join'](config['root'],_0x93b1('0xb5'),_0x1a4192[_0x93b1('0xb6')]['filename']);fs[_0x93b1('0xb7')](_0x266504,parseInt(_0x93b1('0xb8'),0x8));var _0x1604f7=require(_0x93b1('0xb9'))[_0x93b1('0xba')](path[_0x93b1('0x3f')](__dirname,_0x93b1('0xbb')),[_0x266504,_0x1a4192[_0x93b1('0x39')][_0x93b1('0xab')],_0x1a4192[_0x93b1('0x39')][_0x93b1('0xad')],_0x1a4192[_0x93b1('0x39')]['ListId'],_0x1a4192['body'][_0x93b1('0xbc')],_0x1a4192[_0x93b1('0x39')][_0x93b1('0x61')],_0x1a4192[_0x93b1('0x39')]['socket_timestamp']]);return _0x4cc861[_0x93b1('0x11')](0xc8)[_0x93b1('0x18')]({'message':_0x93b1('0xbd'),'pid':_0x1604f7[_0x93b1('0xbe')]});}catch(_0x38c11a){return _0x4cc861['status'](0x1f4)[_0x93b1('0x20')](_0x38c11a);}};exports['upload']=function(_0x3978a6,_0x5663d5){var _0x6ee2c6=fs[_0x93b1('0xbf')](_0x3978a6['file']['path']);Papa[_0x93b1('0xc0')](_0x6ee2c6,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2ce60e){return _0x5663d5[_0x93b1('0x11')](0xc8)[_0x93b1('0x18')]({'file':_0x3978a6[_0x93b1('0xb6')],'fields':_0x2ce60e[_0x93b1('0xc1')][_0x93b1('0x88')]});}});};exports[_0x93b1('0xc2')]=function(_0x55414c,_0x50109d){return db[_0x93b1('0xc3')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x93b1('0xc4')}})[_0x93b1('0x19')](function(_0x78b4c3){var _0xb6ee5e=![];if(!_0x55414c[_0x93b1('0x39')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x55414c[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x55414c['body'][_0x93b1('0xc5')][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}if(!_0x55414c[_0x93b1('0x39')]['socket_timestamp']){throw new Error(_0x93b1('0xc6'));}var _0x3584a7=require(_0x93b1('0xb9'))[_0x93b1('0xba')](path['join'](__dirname,_0x93b1('0xc7')),[_0x55414c[_0x93b1('0x6a')]['id'],JSON[_0x93b1('0xc8')](_0x55414c[_0x93b1('0x39')]),JSON[_0x93b1('0xc8')](_0x78b4c3)]);_0x3584a7['on'](_0x93b1('0xc9'),function(){_0xb6ee5e=!![];return _0x50109d[_0x93b1('0x11')](0xc8)['json']({'message':_0x93b1('0xca'),'pid':_0x3584a7['pid']});});_0x3584a7['on'](_0x93b1('0xcb'),function(_0x19dcc0){if(_0x19dcc0&&!_0xb6ee5e){return _0x50109d['status'](0x1f4)[_0x93b1('0x18')]({'message':_0x93b1('0xcc'),'pid':_0x3584a7[_0x93b1('0xbe')]});}});})['catch'](handleError(_0x50109d,null));};exports[_0x93b1('0xcd')]=function(_0x51c1f2,_0x634e34){return db[_0x93b1('0xc3')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x93b1('0xc4')}})[_0x93b1('0x19')](function(_0x265111){var _0x1fcb5f=![];if(!_0x51c1f2[_0x93b1('0x39')]['ListId']){throw new Error(_0x93b1('0xaa'));}if(!_0x51c1f2[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x51c1f2[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}if(!_0x51c1f2[_0x93b1('0x39')]['socket_timestamp']){throw new Error(_0x93b1('0xc6'));}var _0x5bb8d7=require('child_process')['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x51c1f2['params']['id'],JSON[_0x93b1('0xc8')](_0x51c1f2[_0x93b1('0x39')]),JSON[_0x93b1('0xc8')](_0x265111)]);_0x5bb8d7['on'](_0x93b1('0xc9'),function(){_0x1fcb5f=!![];return _0x634e34[_0x93b1('0x11')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x5bb8d7[_0x93b1('0xbe')]});});_0x5bb8d7['on'](_0x93b1('0xcb'),function(_0x5ef2ed){if(_0x5ef2ed&&!_0x1fcb5f){return _0x634e34[_0x93b1('0x11')](0x1f4)['json']({'message':_0x93b1('0xcc'),'pid':_0x5bb8d7[_0x93b1('0xbe')]});}});})[_0x93b1('0x26')](handleError(_0x634e34,null));};exports[_0x93b1('0xce')]=function(_0x30fd24,_0x247668){var _0x619033=[_0x93b1('0xcf'),'chat',_0x93b1('0xd0'),_0x93b1('0xd1'),_0x93b1('0xd2'),_0x93b1('0xd3'),_0x93b1('0xd4')];var _0x146d3f={'offset':0x0,'order':qs['sort'](_0x93b1('0xd5'))},_0x1acd98={'count':0x0,'rows':[]};Promise['resolve']()[_0x93b1('0x19')](function(){if(_0x30fd24[_0x93b1('0x25')]['channel']){if(!_[_0x93b1('0xd6')](_0x619033,_0x30fd24['query'][_0x93b1('0xd7')][_0x93b1('0xd8')]())){throw new Error(_0x93b1('0xd9'));}_0x619033=[_0x30fd24[_0x93b1('0x25')]['channel'][_0x93b1('0xd8')]()];}if(_0x30fd24[_0x93b1('0x25')]['range']){try{var _0x397b71=JSON[_0x93b1('0xc0')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]);if(!moment(_0x397b71[_0x93b1('0x3a')])[_0x93b1('0xdb')]()){throw new Error(_0x93b1('0xdc'));}if(!moment(_0x397b71['to'])[_0x93b1('0xdb')]()){throw new Error(_0x93b1('0xdd'));}}catch(_0x21b231){throw new Error(_0x93b1('0xde'));}}if(!_0x30fd24[_0x93b1('0x25')][_0x93b1('0x67')]('nolimit')){_0x146d3f[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0x14')]||0xa);_0x146d3f['offset']=qs[_0x93b1('0x12')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0x12')]);}var _0x446ab2=_0x619033[_0x93b1('0x77')](function(_0x4b0598){if(_0x4b0598==='voice'){var _0x4f5271={'attributes':['id',_0x93b1('0xdf'),'type',_0x93b1('0xe0'),'destination',_0x93b1('0xe1'),_0x93b1('0xe2'),_0x93b1('0xe3'),_0x93b1('0xe4'),'note',_0x93b1('0xe5'),_0x93b1('0xe6'),_0x93b1('0xe7'),_0x93b1('0xe8'),_0x93b1('0xe9')],'where':{'ContactId':_0x30fd24['params']['id']},'include':[{'model':db[_0x93b1('0xc3')],'as':'User','attributes':['id',_0x93b1('0x1f'),'fullname',_0x93b1('0x31')]}],'order':[[_0x93b1('0xe5'),_0x93b1('0xea')]]};if(_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]){_0x4f5271['where'][_0x93b1('0xe5')]={'$gte':_0x397b71['from'],'$lte':_0x397b71['to']};}return db[_0x93b1('0xeb')][_0x93b1('0xec')](_0x4f5271)['then'](function(_0x381492){_0x1acd98[_0x93b1('0x15')]+=_0x381492[_0x93b1('0x15')];return _[_0x93b1('0x77')](_0x381492[_0x93b1('0xa3')],function(_0x81a01b){var _0x4fa092=_0x81a01b[_0x93b1('0x3b')]({'plain':!![]});_0x4fa092[_0x93b1('0xd7')]=_0x4b0598;if(_0x4fa092[_0x93b1('0xc3')]){_0x4fa092[_0x93b1('0xc3')]={'id':_0x4fa092['User']['id'],'name':_0x4fa092[_0x93b1('0xc3')]['name'],'fullname':_0x4fa092['User'][_0x93b1('0xed')],'alias':_0x4fa092[_0x93b1('0xc3')][_0x93b1('0x31')]};}return _0x4fa092;});});}else{var _0x3da461=_[_0x93b1('0xee')](_0x4b0598)+(_0x4b0598===_0x93b1('0xef')?_0x93b1('0xf0'):'Account');var _0xc9a7f={'attributes':['id',_0x93b1('0xf1'),_0x93b1('0xf2'),_0x93b1('0xe5'),_0x93b1('0xf3'),'disposition',_0x93b1('0xf4'),_0x93b1('0xf5'),_0x93b1('0xe9'),_0x3da461+'Id'],'where':{'ContactId':_0x30fd24['params']['id']},'include':[{'model':db[_0x3da461],'as':_0x93b1('0xf6'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0xf7')]},{'model':db['User'],'as':_0x93b1('0xf8'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0xed')]},{'model':db[_0x93b1('0x6b')],'as':_0x93b1('0x6c'),'attributes':['id','name',_0x93b1('0x6d')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]){_0xc9a7f[_0x93b1('0x64')][_0x93b1('0xe5')]={'$gte':_0x397b71[_0x93b1('0x3a')],'$lte':_0x397b71['to']};}switch(_0x4b0598){case _0x93b1('0xef'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')](_0x93b1('0xf9'),_0x93b1('0xfa'),'customerPort',_0x93b1('0xfb'),'osName','ratingMessage','ratingType','ratingValue','referer');break;case _0x93b1('0xcf'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')]('subject',_0x93b1('0xfc'));break;case _0x93b1('0xd1'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')](_0x93b1('0xfd'),_0x93b1('0xfe'));break;}return db[_[_0x93b1('0xee')](_0x4b0598)+_0x93b1('0xff')][_0x93b1('0xec')](_0xc9a7f)[_0x93b1('0x19')](function(_0x3112a5){_0x1acd98[_0x93b1('0x15')]+=_0x3112a5[_0x93b1('0x15')];return _[_0x93b1('0x77')](_0x3112a5['rows'],function(_0x36794f){var _0x384ffe=_0x36794f[_0x93b1('0x3b')]({'plain':!![]});_0x384ffe[_0x93b1('0xd7')]=_0x4b0598;if(_0x384ffe[_0x93b1('0xf8')]){_0x384ffe[_0x93b1('0xf8')]={'id':_0x384ffe['Owner']['id'],'name':_0x384ffe[_0x93b1('0xf8')][_0x93b1('0x1f')],'fullname':_0x384ffe[_0x93b1('0xf8')]['fullname']};}return _0x384ffe;});});}});return Promise[_0x93b1('0x90')](_0x446ab2);})[_0x93b1('0x19')](function(_0x3083c5){return _(_0x3083c5)[_0x93b1('0x100')]()[_0x93b1('0x101')](_0x93b1('0xe5'))[_0x93b1('0x102')]()[_0x93b1('0x103')]();})[_0x93b1('0x19')](function(_0x2bcae3){_0x1acd98[_0x93b1('0xa3')]=_0x146d3f[_0x93b1('0x14')]?_0x2bcae3['slice'](_0x146d3f[_0x93b1('0x12')],_0x146d3f[_0x93b1('0x12')]+_0x146d3f[_0x93b1('0x14')]):_0x2bcae3;return _0x1acd98;})[_0x93b1('0x19')](respondWithFilteredResult(_0x247668,_0x146d3f))['catch'](handleError(_0x247668,null));}; \ No newline at end of file +var _0x8464=['fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','send','upload','path','import','User','agent','binding','child_process','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','No\x20firstName\x20column\x20specified','getJourney','chat','sms','whatsapp','voice','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','createdAt','DESC','findAndCountAll','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','mail','subject','openchannel','externalUrl','Interaction','flatten','sortBy','reverse','value','bluebird','util','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','count','offset','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','describe','findAll','catch','params','CmContact','tags','length','startsWith','cf_','columnName','displayName','query','CmCustomField','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','keys','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','duplicates','where','push','ListId','findOrCreate','spread','all','show','find','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','merge','options','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','literal','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','pick','include','rows','getHopperHistories','ContactId','includeAll','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','chmodSync'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x8464,0x140));var _0x4846=function(_0x556346,_0xc56cc4){_0x556346=_0x556346-0x0;var _0x3ab62c=_0x8464[_0x556346];return _0x3ab62c;};'use strict';var moment=require('moment');var BPromise=require(_0x4846('0x0'));var util=require(_0x4846('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x4846('0x2'));var Papa=require(_0x4846('0x3'));var Redis=require('ioredis');var contacts=require(_0x4846('0x4'));var qs=require(_0x4846('0x5'));var logger=require(_0x4846('0x6'))(_0x4846('0x7'));var config=require(_0x4846('0x8'));var shared=require(_0x4846('0x9'));var db=require(_0x4846('0xa'))['db'];config[_0x4846('0xb')]=_[_0x4846('0xc')](config[_0x4846('0xb')],{'host':_0x4846('0xd'),'port':0x18eb});var socket=require(_0x4846('0xe'))(new Redis(config[_0x4846('0xb')]));require(_0x4846('0xf'))['register'](socket);function respondWithResult(_0x4d5a2d,_0x3ed428){_0x3ed428=_0x3ed428||0xc8;return function(_0x4e8e6a){if(_0x4e8e6a){return _0x4d5a2d[_0x4846('0x10')](_0x3ed428)[_0x4846('0x11')](_0x4e8e6a);}};}function respondWithFilteredResult(_0x2674b6,_0x5d1646){return function(_0x25765d){if(_0x25765d){var _0x584f97=typeof _0x5d1646['offset']==='undefined'&&typeof _0x5d1646['limit']==='undefined';var _0x458095=_0x25765d[_0x4846('0x12')];var _0x49e4a6=_0x584f97?0x0:_0x5d1646[_0x4846('0x13')];var _0xe6696c=_0x584f97?_0x25765d[_0x4846('0x12')]:_0x5d1646[_0x4846('0x13')]+_0x5d1646[_0x4846('0x14')];var _0x4db61b;if(_0xe6696c>=_0x458095){_0xe6696c=_0x458095;_0x4db61b=0xc8;}else{_0x4db61b=0xce;}_0x2674b6[_0x4846('0x10')](_0x4db61b);return _0x2674b6[_0x4846('0x15')](_0x4846('0x16'),_0x49e4a6+'-'+_0xe6696c+'/'+_0x458095)['json'](_0x25765d);}return null;};}function saveUpdates(_0x415dda){return function(_0x714ed9){if(_0x714ed9){return _0x714ed9[_0x4846('0x17')](_0x415dda)[_0x4846('0x18')](function(_0x3cf1ae){return _0x3cf1ae;});}return null;};}function removeEntity(_0x2c0a56){return function(_0x142202){if(_0x142202){return _0x142202[_0x4846('0x19')]()[_0x4846('0x18')](function(){_0x2c0a56[_0x4846('0x10')](0xcc)[_0x4846('0x1a')]();});}};}function handleEntityNotFound(_0x32be41){return function(_0x3006aa){if(!_0x3006aa){_0x32be41[_0x4846('0x1b')](0x194);}return _0x3006aa;};}function handleError(_0x29d51f,_0x2650fd){_0x2650fd=_0x2650fd||0x1f4;return function(_0x46d140){logger[_0x4846('0x1c')](_0x46d140[_0x4846('0x1d')]);if(_0x46d140[_0x4846('0x1e')]){delete _0x46d140[_0x4846('0x1e')];}_0x29d51f[_0x4846('0x10')](_0x2650fd)['send'](_0x46d140);};}exports['index']=function(_0x1f8dee,_0x163cc1){var _0xb6b203={};return contacts[_0x4846('0x1f')]()[_0x4846('0x18')](function(_0x376625){_0xb6b203=qs['getOptions'](_0x376625,_0x1f8dee);return contacts[_0x4846('0x20')](_0x1f8dee['query'],_0x1f8dee['user'],_0xb6b203,_0x376625);})[_0x4846('0x18')](respondWithFilteredResult(_0x163cc1,_0xb6b203))[_0x4846('0x21')](handleError(_0x163cc1,null));};exports[_0x4846('0x19')]=function(_0x303d1d,_0xabe232){return db['CmContact']['find']({'where':{'id':_0x303d1d[_0x4846('0x22')]['id']}})['then'](handleEntityNotFound(_0xabe232,null))[_0x4846('0x18')](removeEntity(_0xabe232,null))[_0x4846('0x21')](handleError(_0xabe232,null));};exports[_0x4846('0x1f')]=function(_0x481959,_0x483e2f){return db[_0x4846('0x23')][_0x4846('0x1f')]()[_0x4846('0x18')](function(_0x47b4e9){delete _0x47b4e9[_0x4846('0x24')];for(var _0x44543c=0x0;_0x44543c0x0){return new Promise(function(_0x322760){var _0x11f8e0=[];for(var _0x53a43a=0x0;_0x53a43a<_0x583489['length'];_0x53a43a++){_0x11f8e0[_0x4846('0x59')](insertAdditionalPhones(_0x583489[_0x53a43a]['contact'],_0x583489[_0x53a43a][_0x4846('0x56')]));}Promise[_0x4846('0x5d')](_0x11f8e0)[_0x4846('0x18')](function(){_0x322760(0x1);});})[_0x4846('0x18')](function(){return{'success':_0x5b76e3,'failure':_0xbc1cde,'duplicates':_0x289302};});}else{return{'success':_0x5b76e3,'failure':_0xbc1cde,'duplicates':_0x289302};}}})[_0x4846('0x18')](respondWithResult(_0x3a11ad,0xc9))['catch'](handleError(_0x3a11ad,null));};exports[_0x4846('0x5e')]=function(_0x38f53b,_0x4b702f){var _0x5ca996;return db['CmContact'][_0x4846('0x1f')]()[_0x4846('0x18')](function(_0x5d0aef){return db[_0x4846('0x23')][_0x4846('0x5f')]({'where':{'id':_0x38f53b['params']['id']},'include':[{'model':db[_0x4846('0x60')],'as':_0x4846('0x61'),'attributes':['id',_0x4846('0x1e'),_0x4846('0x62')],'required':_0x38f53b[_0x4846('0x2a')][_0x4846('0x63')]?!![]:![]},{'model':db[_0x4846('0x64')],'as':_0x4846('0x65'),'where':{'CmContactId':_0x38f53b['params']['id']},'required':![],'include':[{'model':db[_0x4846('0x66')],'as':_0x4846('0x67')}]}],'order':[db[_0x4846('0x68')]['literal'](_0x4846('0x69'))],'attributes':_['keys'](_0x5d0aef)});})['then'](function(_0x432dd4){if(!_[_0x4846('0x52')](_0x432dd4)){_0x5ca996=_0x432dd4[_0x4846('0x37')]({'plain':!![]});var _0x4db7eb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x432dd4&&_0x432dd4[_0x4846('0x5a')]){if(_0x432dd4['ListId']){_0x4db7eb[_0x4846('0x58')][_0x4846('0x6a')][_0x4846('0x59')]({'ListId':{'$ne':_0x432dd4[_0x4846('0x5a')]}});}}return db[_0x4846('0x2b')][_0x4846('0x20')](_0x4db7eb);}})[_0x4846('0x18')](function(_0x5ea727){if(!_[_0x4846('0x52')](_0x5ea727)){return _[_0x4846('0x6b')](_0x5ca996,_['map'](_0x5ea727,function(_0x4dafc7){return util[_0x4846('0x6c')](_0x4846('0x6d'),_0x4dafc7['id']);}));}})['then'](handleEntityNotFound(_0x4b702f,null))[_0x4846('0x18')](respondWithResult(_0x4b702f,null))[_0x4846('0x21')](handleError(_0x4b702f,null));};exports[_0x4846('0x17')]=function(_0x352877,_0x5a9a2e){var _0x50aa17;if(_0x352877[_0x4846('0x35')]['id']){delete _0x352877[_0x4846('0x35')]['id'];}if(!_[_0x4846('0x52')](_0x352877[_0x4846('0x35')][_0x4846('0x53')])){var _0x2872a5=_0x352877[_0x4846('0x35')][_0x4846('0x53')];if(!_['isNil'](shared['timezones'][_0x2872a5]))_0x352877['body'][_0x4846('0x54')]=shared[_0x4846('0x55')][_0x2872a5][_0x4846('0x54')];}return db[_0x4846('0x23')]['find']({'where':{'id':_0x352877[_0x4846('0x22')]['id']}})['then'](handleEntityNotFound(_0x5a9a2e,null))[_0x4846('0x18')](saveUpdates(_0x352877['body'],null))[_0x4846('0x18')](function(_0x834852){_0x50aa17=_0x834852;var _0x1bbf45={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x834852&&_0x834852[_0x4846('0x5a')]){if(_0x834852[_0x4846('0x5a')]){_0x1bbf45['where']['$and'][_0x4846('0x59')]({'ListId':{'$ne':_0x834852[_0x4846('0x5a')]}});}}return db['CmCustomField'][_0x4846('0x20')](_0x1bbf45);})[_0x4846('0x18')](function(_0x5c1a17){if(_0x5c1a17){return _['omit'](_[_0x4846('0x6e')](_0x352877[_0x4846('0x35')],function(_0x146557,_0x160968){return _['startsWith'](_0x160968,'cf_');}),_[_0x4846('0x6f')](_0x5c1a17,function(_0x414c8b){return util[_0x4846('0x6c')](_0x4846('0x6d'),_0x414c8b['id']);}));}})[_0x4846('0x18')](function(_0x3a625d){if(_0x3a625d&&!_[_0x4846('0x70')](_0x3a625d)){var _0x5490df=squel[_0x4846('0x17')]()[_0x4846('0x71')](_0x4846('0x72'))[_0x4846('0x73')](_0x3a625d)[_0x4846('0x58')](_0x4846('0x74'),_0x352877[_0x4846('0x22')]['id'])[_0x4846('0x75')]();return db[_0x4846('0x68')][_0x4846('0x2a')](_0x5490df[_0x4846('0x76')],{'replacements':_0x5490df['values']});}})[_0x4846('0x18')](function(){if(_0x352877[_0x4846('0x35')][_0x4846('0x77')]&&_0x50aa17){return db[_0x4846('0x3c')][_0x4846('0x17')]({'phone':_0x352877[_0x4846('0x35')][_0x4846('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x50aa17['id']}});}})[_0x4846('0x18')](function(){return _0x50aa17;})[_0x4846('0x18')](respondWithResult(_0x5a9a2e,null))['catch'](handleError(_0x5a9a2e,null));};exports[_0x4846('0x78')]=function(_0x1ac7e6,_0x3e84f4){var _0x445ef2={};var _0x4e9b9c={};var _0x120c85;var _0x307492;return db['CmContact'][_0x4846('0x79')]({'where':{'id':_0x1ac7e6[_0x4846('0x22')]['id']}})[_0x4846('0x18')](handleEntityNotFound(_0x3e84f4,null))[_0x4846('0x18')](function(_0x5ebf99){if(_0x5ebf99){_0x120c85=_0x5ebf99;_0x4e9b9c[_0x4846('0x7a')]=_[_0x4846('0x32')](db[_0x4846('0x60')][_0x4846('0x7b')]);_0x4e9b9c[_0x4846('0x2a')]=_['keys'](_0x1ac7e6[_0x4846('0x2a')]);_0x4e9b9c[_0x4846('0x7c')]=_[_0x4846('0x7d')](_0x4e9b9c[_0x4846('0x7a')],_0x4e9b9c[_0x4846('0x2a')]);_0x445ef2[_0x4846('0x7e')]=_[_0x4846('0x7d')](_0x4e9b9c[_0x4846('0x7a')],qs[_0x4846('0x7f')](_0x1ac7e6['query'][_0x4846('0x7f')]));_0x445ef2['attributes']=_0x445ef2[_0x4846('0x7e')]['length']?_0x445ef2[_0x4846('0x7e')]:_0x4e9b9c[_0x4846('0x7a')];_0x445ef2[_0x4846('0x80')]=qs['sort'](_0x1ac7e6[_0x4846('0x2a')][_0x4846('0x81')]);_0x445ef2[_0x4846('0x58')]=qs['filters'](_['pick'](_0x1ac7e6[_0x4846('0x2a')],_0x4e9b9c[_0x4846('0x7c')]));if(_0x1ac7e6['query'][_0x4846('0x82')]){_0x445ef2['where']=_[_0x4846('0x83')](_0x445ef2[_0x4846('0x58')],{'$or':_[_0x4846('0x6f')](_0x445ef2['attributes'],function(_0x1d74b9){var _0x48fe69={};_0x48fe69[_0x1d74b9]={'$like':'%'+_0x1ac7e6['query'][_0x4846('0x82')]+'%'};return _0x48fe69;})});}_0x445ef2=_['merge']({},_0x445ef2,_0x1ac7e6[_0x4846('0x84')]);return _0x120c85[_0x4846('0x78')](_0x445ef2);}})['then'](function(_0x26dcde){if(_0x26dcde){_0x307492=_0x26dcde[_0x4846('0x25')];if(!_0x1ac7e6[_0x4846('0x2a')][_0x4846('0x34')]('nolimit')){_0x445ef2['limit']=qs['limit'](_0x1ac7e6[_0x4846('0x2a')]['limit']);_0x445ef2['offset']=qs['offset'](_0x1ac7e6[_0x4846('0x2a')]['offset']);}return _0x120c85[_0x4846('0x78')](_0x445ef2);}})[_0x4846('0x18')](function(_0x342a28){if(_0x342a28){return _0x342a28?{'count':_0x307492,'rows':_0x342a28}:null;}})[_0x4846('0x18')](respondWithResult(_0x3e84f4,null))[_0x4846('0x21')](handleError(_0x3e84f4,null));};exports['setTags']=function(_0x2aecf4,_0xfd564b){if(_0x2aecf4[_0x4846('0x35')]['id']){delete _0x2aecf4[_0x4846('0x35')]['id'];}return db[_0x4846('0x23')][_0x4846('0x79')]({'where':{'id':_0x2aecf4[_0x4846('0x22')]['id']}})[_0x4846('0x18')](handleEntityNotFound(_0xfd564b,null))['then'](function(_0x415666){if(_0x415666){return _0x415666['setTags'](_0x2aecf4['body']['ids']||[]);}return null;})['then'](respondWithResult(_0xfd564b,null))[_0x4846('0x21')](handleError(_0xfd564b,null));};exports[_0x4846('0x85')]=function(_0x4a4551,_0x5d5b82){var _0x5fcdcc=[];_0x5fcdcc[_0x4846('0x59')](addAdditionalPhones(_0x4a4551[_0x4846('0x35')]));Promise[_0x4846('0x5d')](_0x5fcdcc)['then'](function(){_0x5fcdcc=[];_0x5fcdcc['push'](deleteCmHopperPhones(_0x4a4551[_0x4846('0x35')]['id']));_0x5fcdcc[_0x4846('0x59')](addCmHopperPhones(_0x4a4551[_0x4846('0x35')]['id']));Promise['all'](_0x5fcdcc)[_0x4846('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x5d5b82,null));});};function addAdditionalPhones(_0x4b6bdf){var _0x52ba15;return new Promise(function(_0x283fea){return db[_0x4846('0x64')][_0x4846('0x19')]({'where':{'CmContactId':_0x4b6bdf['id']}})['then'](function(){db[_0x4846('0x66')][_0x4846('0x20')]({'raw':!![],'attributes':['id',_0x4846('0x86')]})[_0x4846('0x18')](function(_0x5cc13d){var _0x2b4fe3=[];for(var _0xc39017=0x0;_0xc39017<_0x4b6bdf[_0x4846('0x87')][_0x4846('0x25')];_0xc39017++){var _0x57cb1f=_0x4b6bdf['item_types']?_[_0x4846('0x52')](_0x4b6bdf[_0x4846('0x88')][_0xc39017])?'':_0x4b6bdf[_0x4846('0x88')][_0xc39017]:_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x89')]?_0x4b6bdf[_0x4846('0x87')][_0xc39017]['ItemTypeId']:'';var _0x1446b2=_[_0x4846('0x52')](_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x8a')])?'':_0x4b6bdf['items'][_0xc39017][_0x4846('0x8a')];var _0x262926=_0x57cb1f+':'+_0x4b6bdf[_0x4846('0x87')][_0xc39017]['phone']+'§'+_0x1446b2;if(_['isNil'](_0x52ba15))_0x52ba15=_0x262926;else _0x52ba15+=';'+_0x262926;var _0x338345=null;var _0xb01a95=null;if(_0x4b6bdf[_0x4846('0x88')]){if(!_[_0x4846('0x52')](_0x4b6bdf[_0x4846('0x88')][_0xc39017])){_0xb01a95=_[_0x4846('0x5f')](_0x5cc13d,function(_0x46cfd3){return _0x46cfd3['id']===_0x4b6bdf[_0x4846('0x88')][_0xc39017];});if(!_[_0x4846('0x52')](_0xb01a95)){_0x338345=_0xb01a95['OrderBy'];}}}else{if(!_[_0x4846('0x52')](_0x4b6bdf[_0x4846('0x87')][_0xc39017])){_0xb01a95=_['find'](_0x5cc13d,function(_0x329d6e){return _0x329d6e['id']===_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x89')];});if(!_['isNil'](_0xb01a95)){_0x338345=_0xc39017;}}}if(_[_0x4846('0x52')](_0x338345)){_0x338345=0x64;}_0x2b4fe3[_0x4846('0x59')](addAdditionalPhone(_0x4b6bdf['id'],_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x77')],_0x4b6bdf['item_types']?_['isNil'](_0x4b6bdf['item_types'][_0xc39017])?null:_0x4b6bdf[_0x4846('0x88')][_0xc39017]:_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x89')]?_0x4b6bdf[_0x4846('0x87')][_0xc39017][_0x4846('0x89')]:null,_0x338345,_0x1446b2));}Promise['all'](_0x2b4fe3)[_0x4846('0x18')](function(){db[_0x4846('0x23')]['update']({'AdditionalPhones':_0x52ba15},{'where':{'id':_0x4b6bdf['id']}})['then'](function(){_0x283fea(0x1);});});});});});}function addAdditionalPhone(_0x401a8b,_0x18fc67,_0x1d3e7c,_0x491be4,_0x356c65){return db[_0x4846('0x64')][_0x4846('0x5f')]({'where':{'CmContactId':_0x401a8b,'item':_0x18fc67}})[_0x4846('0x18')](function(_0x26d725){if(_0x26d725)logger[_0x4846('0x30')](_0x4846('0x8b'),_0x26d725);else{db[_0x4846('0x64')][_0x4846('0x3e')]({'CmContactId':_0x401a8b,'item':_0x18fc67,'ItemTypeId':_0x1d3e7c,'OrderBy':_0x491be4,'ItemClass':'PHONE','description':_0x356c65});}});}function deleteCmHopperPhones(_0xb4a85f){return new Promise(function(_0x12d0ce){return db[_0x4846('0x3c')][_0x4846('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb4a85f}})[_0x4846('0x18')](function(_0x178416){db[_0x4846('0x8c')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x178416,'id')}}});})[_0x4846('0x18')](function(){_0x12d0ce(0x1);});});}function addCmHopperPhones(_0x5f5395){return new Promise(function(_0x5ec4d2){return db[_0x4846('0x3c')][_0x4846('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5f5395}})['then'](function(_0x2ed8ad){var _0x45c9dc=[];_[_0x4846('0x6f')](_0x2ed8ad,function(_0x5ebb06){_0x45c9dc[_0x4846('0x59')](createCmHopperPhone(_0x5f5395,_0x5ebb06['id']));});Promise[_0x4846('0x5d')](_0x45c9dc)['then'](function(){_0x5ec4d2(0x1);});});});}function createCmHopperPhone(_0x408c02,_0x3ffe65){return new Promise(function(_0xba4b5e){db[_0x4846('0x64')][_0x4846('0x20')]({'raw':!![],'attributes':[_0x4846('0x8d'),_0x4846('0x86')],'where':{'CmContactId':_0x408c02,'ItemClass':_0x4846('0x8e')},'include':[{'model':db[_0x4846('0x66')],'attributes':[_0x4846('0x86')],'as':_0x4846('0x67')}],'order':[_0x4846('0x86'),db[_0x4846('0x68')][_0x4846('0x8f')]('`ItemType`.OrderBy')]})[_0x4846('0x18')](function(_0x88e78){var _0x3aad78=0x1;var _0xbd949c=_[_0x4846('0x6f')](_0x88e78,function(_0x202c72){_0x202c72[_0x4846('0x90')]=_0x3ffe65;_0x202c72[_0x4846('0x77')]=_0x202c72['item'];_0x202c72[_0x4846('0x86')]=_0x3aad78;delete _0x202c72[_0x4846('0x91')];_0x3aad78=_0x3aad78+0x1;return _0x202c72;});return db[_0x4846('0x8c')][_0x4846('0x92')](_0xbd949c,{});})[_0x4846('0x18')](function(){_0xba4b5e(0x1);});});}function insertAdditionalPhones(_0x5d1d44,_0x389f26){return new Promise(function(_0x51f5ae){var _0x3be802=[];for(var _0x480548=0x0;_0x480548<_0x389f26[_0x4846('0x25')];_0x480548++){var _0x22c247=_0x389f26[_0x480548];_0x3be802[_0x4846('0x59')](parseContactItemType(_0x22c247));}Promise['all'](_0x3be802)[_0x4846('0x18')](function(){var _0x10aca3={'id':_0x5d1d44['id'],'items':_0x389f26};return addAdditionalPhones(_0x10aca3)[_0x4846('0x18')](function(){return addCmHopperPhones(_0x5d1d44['id']);});})[_0x4846('0x18')](function(){_0x51f5ae(_0x5d1d44);});});}function parseContactItemType(_0xb8e6b0){return new Promise(function(_0x571532){if(_0xb8e6b0[_0x4846('0x34')](_0x4846('0x89'))){_0x571532(_0xb8e6b0);}else{return db[_0x4846('0x66')][_0x4846('0x5f')]({'where':{'name':_0xb8e6b0[_0x4846('0x67')]}})[_0x4846('0x18')](function(_0x298b69){if(_[_0x4846('0x52')](_0x298b69))_0xb8e6b0[_0x4846('0x89')]=null;else _0xb8e6b0[_0x4846('0x89')]=_0x298b69['id'];_0x571532(_0xb8e6b0);});}});}exports[_0x4846('0x93')]=function(_0x2307d6,_0x504047){return db['CmContactHasItem'][_0x4846('0x20')]({'raw':!![],'where':{'CmContactId':_0x2307d6[_0x4846('0x22')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x4846('0x66')],'as':'ItemType'}],'order':[[_0x4846('0x86')],[db['sequelize'][_0x4846('0x8f')]('`ItemType`.OrderBy')]]})[_0x4846('0x18')](function(_0x447240){return _0x447240;})[_0x4846('0x18')](respondWithResult(_0x504047,null))[_0x4846('0x21')](handleError(_0x504047,null));};exports[_0x4846('0x94')]=function(_0x3fc1b6,_0x498bbb){return db[_0x4846('0x64')][_0x4846('0x20')]({'raw':!![],'where':{'CmContactId':_0x3fc1b6['body'][_0x4846('0x95')]}})[_0x4846('0x18')](function(_0x5ec9a4){var _0x1a53c7=_[_0x4846('0x6f')](_0x5ec9a4,function(_0x596fe6){_0x596fe6['CmContactId']=_0x3fc1b6['body'][_0x4846('0x96')];return _0x596fe6;});return db[_0x4846('0x64')]['bulkCreate'](_0x1a53c7,{});})[_0x4846('0x18')](function(){return addCmHopperPhones(_0x3fc1b6[_0x4846('0x35')]['toContactId']);})[_0x4846('0x18')](function(){return['ok'];})[_0x4846('0x18')](respondWithResult(_0x498bbb,null))[_0x4846('0x21')](handleError(_0x498bbb,null));};exports[_0x4846('0x97')]=function(_0x28c1f6,_0xa5a7a0){var _0x1a2086=[];_0x1a2086[_0x4846('0x59')](createCmHopperPhone(_0x28c1f6[_0x4846('0x35')]['id'],_0x28c1f6[_0x4846('0x35')][_0x4846('0x98')]));Promise[_0x4846('0x5d')](_0x1a2086)[_0x4846('0x18')](function(){return[0x1];})[_0x4846('0x18')](respondWithResult(_0xa5a7a0,null));};exports[_0x4846('0x99')]=function(_0x2b47ea,_0x2050c9){var _0xe0ee70={'raw':![],'where':{}};var _0x4b7a45={};var _0x1043d4={'count':0x0,'rows':[]};return db[_0x4846('0x23')][_0x4846('0x79')]({'where':{'id':_0x2b47ea[_0x4846('0x22')]['id']}})[_0x4846('0x18')](handleEntityNotFound(_0x2050c9,null))[_0x4846('0x18')](function(_0x18f76c){if(_0x18f76c){_0x4b7a45[_0x4846('0x7a')]=_[_0x4846('0x32')](db[_0x4846('0x3c')][_0x4846('0x7b')]);_0x4b7a45[_0x4846('0x2a')]=_[_0x4846('0x32')](_0x2b47ea[_0x4846('0x2a')]);_0x4b7a45[_0x4846('0x7c')]=_[_0x4846('0x7d')](_0x4b7a45[_0x4846('0x7a')],_0x4b7a45[_0x4846('0x2a')]);_0xe0ee70[_0x4846('0x7e')]=_['intersection'](_0x4b7a45[_0x4846('0x7a')],qs[_0x4846('0x7f')](_0x2b47ea[_0x4846('0x2a')][_0x4846('0x7f')]));_0xe0ee70[_0x4846('0x7e')]=_0xe0ee70['attributes'][_0x4846('0x25')]?_0xe0ee70[_0x4846('0x7e')]:_0x4b7a45[_0x4846('0x7a')];if(!_0x2b47ea[_0x4846('0x2a')][_0x4846('0x34')](_0x4846('0x9a'))){_0xe0ee70['limit']=qs[_0x4846('0x14')](_0x2b47ea['query'][_0x4846('0x14')]);_0xe0ee70['offset']=qs['offset'](_0x2b47ea[_0x4846('0x2a')][_0x4846('0x13')]);}_0xe0ee70[_0x4846('0x80')]=qs[_0x4846('0x81')](_0x2b47ea[_0x4846('0x2a')][_0x4846('0x81')]);_0xe0ee70[_0x4846('0x58')]=qs[_0x4846('0x7c')](_[_0x4846('0x9b')](_0x2b47ea[_0x4846('0x2a')],_0x4b7a45[_0x4846('0x7c')]));_0xe0ee70[_0x4846('0x58')]['ContactId']=_0x18f76c['id'];if(_0x2b47ea[_0x4846('0x2a')][_0x4846('0x82')]){_0xe0ee70[_0x4846('0x58')]=_['merge'](_0xe0ee70[_0x4846('0x58')],{'$or':_['map'](_0xe0ee70[_0x4846('0x7e')],function(_0x3956a4){var _0x50d9af={};_0x50d9af[_0x3956a4]={'$like':'%'+_0x2b47ea[_0x4846('0x2a')][_0x4846('0x82')]+'%'};return _0x50d9af;})});}_0xe0ee70=_[_0x4846('0x83')]({},_0xe0ee70,_0x2b47ea[_0x4846('0x84')]);return db['CmHopper'][_0x4846('0x12')]({'where':_0xe0ee70[_0x4846('0x58')]})['then'](function(_0x1ab4f4){_0x1043d4[_0x4846('0x12')]=_0x1ab4f4;if(_0x2b47ea[_0x4846('0x2a')]['includeAll']){_0xe0ee70[_0x4846('0x9c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xe0ee70);})[_0x4846('0x18')](function(_0x459ad0){_0x1043d4[_0x4846('0x9d')]=_0x459ad0;return _0x1043d4;});}})[_0x4846('0x18')](respondWithFilteredResult(_0x2050c9,_0xe0ee70))[_0x4846('0x21')](handleError(_0x2050c9,null));};exports[_0x4846('0x9e')]=function(_0x2a3a03,_0x314723){var _0x2913d7={'raw':!![],'where':{}};var _0x18995e={};var _0x22cfa7={'count':0x0,'rows':[]};return db[_0x4846('0x23')][_0x4846('0x79')]({'where':{'id':_0x2a3a03['params']['id']}})['then'](handleEntityNotFound(_0x314723,null))[_0x4846('0x18')](function(_0x3f0f6c){if(_0x3f0f6c){_0x18995e[_0x4846('0x7a')]=_[_0x4846('0x32')](db[_0x4846('0x49')][_0x4846('0x7b')]);_0x18995e[_0x4846('0x2a')]=_['keys'](_0x2a3a03[_0x4846('0x2a')]);_0x18995e[_0x4846('0x7c')]=_[_0x4846('0x7d')](_0x18995e['model'],_0x18995e['query']);_0x2913d7[_0x4846('0x7e')]=_[_0x4846('0x7d')](_0x18995e[_0x4846('0x7a')],qs['fields'](_0x2a3a03[_0x4846('0x2a')][_0x4846('0x7f')]));_0x2913d7['attributes']=_0x2913d7[_0x4846('0x7e')][_0x4846('0x25')]?_0x2913d7[_0x4846('0x7e')]:_0x18995e[_0x4846('0x7a')];if(!_0x2a3a03[_0x4846('0x2a')]['hasOwnProperty'](_0x4846('0x9a'))){_0x2913d7['limit']=qs['limit'](_0x2a3a03['query'][_0x4846('0x14')]);_0x2913d7[_0x4846('0x13')]=qs[_0x4846('0x13')](_0x2a3a03[_0x4846('0x2a')][_0x4846('0x13')]);}_0x2913d7[_0x4846('0x80')]=qs[_0x4846('0x81')](_0x2a3a03[_0x4846('0x2a')][_0x4846('0x81')]);_0x2913d7[_0x4846('0x58')]=qs[_0x4846('0x7c')](_[_0x4846('0x9b')](_0x2a3a03[_0x4846('0x2a')],_0x18995e[_0x4846('0x7c')]));_0x2913d7['where'][_0x4846('0x9f')]=_0x3f0f6c['id'];if(_0x2a3a03[_0x4846('0x2a')][_0x4846('0x82')]){_0x2913d7['where']=_[_0x4846('0x83')](_0x2913d7[_0x4846('0x58')],{'$or':_['map'](_0x2913d7[_0x4846('0x7e')],function(_0x3a135b){var _0xf16428={};_0xf16428[_0x3a135b]={'$like':'%'+_0x2a3a03[_0x4846('0x2a')]['filter']+'%'};return _0xf16428;})});}_0x2913d7=_[_0x4846('0x83')]({},_0x2913d7,_0x2a3a03[_0x4846('0x84')]);return db[_0x4846('0x49')][_0x4846('0x12')]({'where':_0x2913d7[_0x4846('0x58')]})[_0x4846('0x18')](function(_0x3e21e1){_0x22cfa7['count']=_0x3e21e1;if(_0x2a3a03[_0x4846('0x2a')]['includeAll']){_0x2913d7['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4846('0x20')](_0x2913d7);})[_0x4846('0x18')](function(_0x44cae3){_0x22cfa7[_0x4846('0x9d')]=_0x44cae3;return _0x22cfa7;});}})[_0x4846('0x18')](respondWithFilteredResult(_0x314723,_0x2913d7))[_0x4846('0x21')](handleError(_0x314723,null));};exports['getHopperFinals']=function(_0x4bd5ba,_0x1c94c1){var _0x32da58={'raw':!![],'where':{}};var _0x2c6fcd={};var _0x195b8c={'count':0x0,'rows':[]};return db[_0x4846('0x23')][_0x4846('0x79')]({'where':{'id':_0x4bd5ba['params']['id']}})['then'](handleEntityNotFound(_0x1c94c1,null))[_0x4846('0x18')](function(_0x1bf837){if(_0x1bf837){_0x2c6fcd[_0x4846('0x7a')]=_[_0x4846('0x32')](db['CmHopperFinal'][_0x4846('0x7b')]);_0x2c6fcd[_0x4846('0x2a')]=_['keys'](_0x4bd5ba[_0x4846('0x2a')]);_0x2c6fcd[_0x4846('0x7c')]=_[_0x4846('0x7d')](_0x2c6fcd[_0x4846('0x7a')],_0x2c6fcd[_0x4846('0x2a')]);_0x32da58[_0x4846('0x7e')]=_[_0x4846('0x7d')](_0x2c6fcd[_0x4846('0x7a')],qs[_0x4846('0x7f')](_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x7f')]));_0x32da58[_0x4846('0x7e')]=_0x32da58['attributes'][_0x4846('0x25')]?_0x32da58[_0x4846('0x7e')]:_0x2c6fcd[_0x4846('0x7a')];if(!_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x34')](_0x4846('0x9a'))){_0x32da58[_0x4846('0x14')]=qs['limit'](_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x14')]);_0x32da58[_0x4846('0x13')]=qs[_0x4846('0x13')](_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x13')]);}_0x32da58[_0x4846('0x80')]=qs[_0x4846('0x81')](_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x81')]);_0x32da58[_0x4846('0x58')]=qs['filters'](_[_0x4846('0x9b')](_0x4bd5ba[_0x4846('0x2a')],_0x2c6fcd[_0x4846('0x7c')]));_0x32da58['where'][_0x4846('0x9f')]=_0x1bf837['id'];if(_0x4bd5ba['query'][_0x4846('0x82')]){_0x32da58['where']=_[_0x4846('0x83')](_0x32da58[_0x4846('0x58')],{'$or':_[_0x4846('0x6f')](_0x32da58[_0x4846('0x7e')],function(_0x3b1a27){var _0xec209d={};_0xec209d[_0x3b1a27]={'$like':'%'+_0x4bd5ba[_0x4846('0x2a')][_0x4846('0x82')]+'%'};return _0xec209d;})});}_0x32da58=_[_0x4846('0x83')]({},_0x32da58,_0x4bd5ba[_0x4846('0x84')]);return db[_0x4846('0x48')][_0x4846('0x12')]({'where':_0x32da58[_0x4846('0x58')]})[_0x4846('0x18')](function(_0x5d624a){_0x195b8c['count']=_0x5d624a;if(_0x4bd5ba['query'][_0x4846('0xa0')]){_0x32da58[_0x4846('0x9c')]=[{'all':!![]}];}return db[_0x4846('0x48')][_0x4846('0x20')](_0x32da58);})[_0x4846('0x18')](function(_0x389896){_0x195b8c[_0x4846('0x9d')]=_0x389896;return _0x195b8c;});}})[_0x4846('0x18')](respondWithFilteredResult(_0x1c94c1,_0x32da58))[_0x4846('0x21')](handleError(_0x1c94c1,null));};exports['getJscriptySessions']=function(_0x2adeb9,_0x3d44f0){var _0x526ff2={'raw':!![],'where':{}};var _0x317f3b={};var _0x1fc262={'count':0x0,'rows':[]};return db[_0x4846('0x23')][_0x4846('0x79')]({'where':{'id':_0x2adeb9['params']['id']}})[_0x4846('0x18')](handleEntityNotFound(_0x3d44f0,null))[_0x4846('0x18')](function(_0x3e91b5){if(_0x3e91b5){_0x317f3b[_0x4846('0x7a')]=_[_0x4846('0x32')](db[_0x4846('0xa1')][_0x4846('0x7b')]);_0x317f3b[_0x4846('0x2a')]=_[_0x4846('0x32')](_0x2adeb9[_0x4846('0x2a')]);_0x317f3b[_0x4846('0x7c')]=_['intersection'](_0x317f3b[_0x4846('0x7a')],_0x317f3b['query']);_0x526ff2['attributes']=_[_0x4846('0x7d')](_0x317f3b['model'],qs[_0x4846('0x7f')](_0x2adeb9[_0x4846('0x2a')][_0x4846('0x7f')]));_0x526ff2[_0x4846('0x7e')]=_0x526ff2[_0x4846('0x7e')][_0x4846('0x25')]?_0x526ff2[_0x4846('0x7e')]:_0x317f3b[_0x4846('0x7a')];if(!_0x2adeb9['query'][_0x4846('0x34')](_0x4846('0x9a'))){_0x526ff2[_0x4846('0x14')]=qs[_0x4846('0x14')](_0x2adeb9['query'][_0x4846('0x14')]);_0x526ff2[_0x4846('0x13')]=qs[_0x4846('0x13')](_0x2adeb9[_0x4846('0x2a')]['offset']);}_0x526ff2[_0x4846('0x80')]=qs[_0x4846('0x81')](_0x2adeb9[_0x4846('0x2a')]['sort']);_0x526ff2[_0x4846('0x58')]=qs[_0x4846('0x7c')](_[_0x4846('0x9b')](_0x2adeb9[_0x4846('0x2a')],_0x317f3b['filters']));_0x526ff2[_0x4846('0x58')]['ContactId']=_0x3e91b5['id'];if(_0x2adeb9[_0x4846('0x2a')][_0x4846('0x82')]){_0x526ff2['where']=_[_0x4846('0x83')](_0x526ff2['where'],{'$or':_[_0x4846('0x6f')](_0x526ff2[_0x4846('0x7e')],function(_0x5dfaa3){var _0x5caa1f={};_0x5caa1f[_0x5dfaa3]={'$like':'%'+_0x2adeb9[_0x4846('0x2a')][_0x4846('0x82')]+'%'};return _0x5caa1f;})});}_0x526ff2=_['merge']({},_0x526ff2,_0x2adeb9['options']);return db[_0x4846('0xa1')][_0x4846('0x12')]({'where':_0x526ff2[_0x4846('0x58')]})[_0x4846('0x18')](function(_0x47e0af){_0x1fc262[_0x4846('0x12')]=_0x47e0af;if(_0x2adeb9['query'][_0x4846('0xa0')]){_0x526ff2[_0x4846('0x9c')]=[{'all':!![]}];}return db[_0x4846('0xa1')]['findAll'](_0x526ff2);})[_0x4846('0x18')](function(_0x239d5a){_0x1fc262['rows']=_0x239d5a;return _0x1fc262;});}})[_0x4846('0x18')](respondWithFilteredResult(_0x3d44f0,_0x526ff2))[_0x4846('0x21')](handleError(_0x3d44f0,null));};exports[_0x4846('0xa2')]=function(_0x4e2ac6,_0x577935){try{if(!_0x4e2ac6[_0x4846('0x35')][_0x4846('0x5a')]){throw new Error(_0x4846('0xa3'));}if(!_0x4e2ac6[_0x4846('0x35')][_0x4846('0xa4')]){throw new Error(_0x4846('0xa5'));}if(!_0x4e2ac6['body']['binding_values']){throw new Error(_0x4846('0xa6'));}if(!_0x4e2ac6['body'][_0x4846('0xa7')]){throw new Error(_0x4846('0xa8'));}var _0x58bdc1=_0x4e2ac6['body']['binding_keys'][_0x4846('0xa9')](',');var _0xc58be4=_0x4e2ac6[_0x4846('0x35')][_0x4846('0xaa')][_0x4846('0xa9')](',');if(!_0x58bdc1[_0x4846('0x25')]||!_0xc58be4['length']||_0x58bdc1['length']!==_0xc58be4[_0x4846('0x25')]){throw new Error(_0x4846('0xab'));}_0x4e2ac6[_0x4846('0x35')][_0x4846('0x7f')]=_['zipObject'](_0x58bdc1,_0xc58be4);if(!_0x4e2ac6[_0x4846('0x35')]['fields'][_0x4846('0x77')]){throw new Error(_0x4846('0xac'));}if(!_0x4e2ac6[_0x4846('0x35')]['fields'][_0x4846('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x584aea=path[_0x4846('0x3a')](config[_0x4846('0xae')],_0x4846('0xaf'),_0x4e2ac6[_0x4846('0xb0')]['filename']);fs[_0x4846('0xb1')](_0x584aea,parseInt('0777',0x8));var _0x352c67=require('child_process')[_0x4846('0xb2')](path['join'](__dirname,_0x4846('0xb3')),[_0x584aea,_0x4e2ac6[_0x4846('0x35')][_0x4846('0xa4')],_0x4e2ac6[_0x4846('0x35')][_0x4846('0xaa')],_0x4e2ac6['body'][_0x4846('0x5a')],_0x4e2ac6[_0x4846('0x35')]['CompanyId'],_0x4e2ac6[_0x4846('0x35')][_0x4846('0x57')],_0x4e2ac6[_0x4846('0x35')][_0x4846('0xa7')]]);return _0x577935['status'](0xc8)[_0x4846('0x11')]({'message':_0x4846('0xb4'),'pid':_0x352c67[_0x4846('0xb5')]});}catch(_0x425cbc){return _0x577935[_0x4846('0x10')](0x1f4)[_0x4846('0xb6')](_0x425cbc);}};exports[_0x4846('0xb7')]=function(_0x19d4ce,_0x3248ec){var _0x3c19c4=fs['createReadStream'](_0x19d4ce['file'][_0x4846('0xb8')]);Papa['parse'](_0x3c19c4,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x908f19){return _0x3248ec[_0x4846('0x10')](0xc8)[_0x4846('0x11')]({'file':_0x19d4ce['file'],'fields':_0x908f19['meta'][_0x4846('0x7f')]});}});};exports[_0x4846('0xb9')]=function(_0x27fbf7,_0x2a1a77){return db[_0x4846('0xba')][_0x4846('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x4846('0xbb')}})[_0x4846('0x18')](function(_0x1c17b2){var _0x2f528b=![];if(!_0x27fbf7[_0x4846('0x35')][_0x4846('0x5a')]){throw new Error(_0x4846('0xa3'));}if(!_0x27fbf7[_0x4846('0x35')][_0x4846('0xbc')][_0x4846('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x27fbf7[_0x4846('0x35')][_0x4846('0xbc')][_0x4846('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x27fbf7[_0x4846('0x35')][_0x4846('0xa7')]){throw new Error(_0x4846('0xa8'));}var _0x167806=require(_0x4846('0xbd'))['fork'](path[_0x4846('0x3a')](__dirname,'../../components/import/cm/csv2'),[_0x27fbf7['params']['id'],JSON['stringify'](_0x27fbf7[_0x4846('0x35')]),JSON[_0x4846('0xbe')](_0x1c17b2)]);_0x167806['on'](_0x4846('0xbf'),function(){_0x2f528b=!![];return _0x2a1a77[_0x4846('0x10')](0xc8)[_0x4846('0x11')]({'message':_0x4846('0xc0'),'pid':_0x167806[_0x4846('0xb5')]});});_0x167806['on']('exit',function(_0x58ff4e){if(_0x58ff4e&&!_0x2f528b){return _0x2a1a77[_0x4846('0x10')](0x1f4)['json']({'message':_0x4846('0xc1'),'pid':_0x167806[_0x4846('0xb5')]});}});})['catch'](handleError(_0x2a1a77,null));};exports['importUpdates']=function(_0x5dec48,_0x2e20c5){return db[_0x4846('0xba')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x4846('0xbb')}})['then'](function(_0x29e076){var _0x3a70bd=![];if(!_0x5dec48[_0x4846('0x35')][_0x4846('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5dec48[_0x4846('0x35')][_0x4846('0xbc')][_0x4846('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5dec48[_0x4846('0x35')]['binding'][_0x4846('0xad')]){throw new Error(_0x4846('0xc2'));}if(!_0x5dec48[_0x4846('0x35')][_0x4846('0xa7')]){throw new Error(_0x4846('0xa8'));}var _0x268464=require(_0x4846('0xbd'))[_0x4846('0xb2')](path[_0x4846('0x3a')](__dirname,'../../components/import/cm/csvUpdates'),[_0x5dec48['params']['id'],JSON[_0x4846('0xbe')](_0x5dec48[_0x4846('0x35')]),JSON[_0x4846('0xbe')](_0x29e076)]);_0x268464['on'](_0x4846('0xbf'),function(){_0x3a70bd=!![];return _0x2e20c5['status'](0xc8)[_0x4846('0x11')]({'message':_0x4846('0xc0'),'pid':_0x268464[_0x4846('0xb5')]});});_0x268464['on']('exit',function(_0x51445d){if(_0x51445d&&!_0x3a70bd){return _0x2e20c5[_0x4846('0x10')](0x1f4)[_0x4846('0x11')]({'message':_0x4846('0xc1'),'pid':_0x268464[_0x4846('0xb5')]});}});})[_0x4846('0x21')](handleError(_0x2e20c5,null));};exports[_0x4846('0xc3')]=function(_0x450f7e,_0x58aeec){var _0x26d3eb=['mail',_0x4846('0xc4'),_0x4846('0xc5'),'openchannel','fax',_0x4846('0xc6'),_0x4846('0xc7')];var _0x559cde={'offset':0x0,'order':qs[_0x4846('0x81')]('-createdAt')},_0x2b63ed={'count':0x0,'rows':[]};Promise[_0x4846('0xc8')]()[_0x4846('0x18')](function(){if(_0x450f7e[_0x4846('0x2a')][_0x4846('0xc9')]){if(!_[_0x4846('0xca')](_0x26d3eb,_0x450f7e[_0x4846('0x2a')][_0x4846('0xc9')]['toLowerCase']())){throw new Error(_0x4846('0xcb'));}_0x26d3eb=[_0x450f7e[_0x4846('0x2a')][_0x4846('0xc9')][_0x4846('0xcc')]()];}if(_0x450f7e[_0x4846('0x2a')][_0x4846('0xcd')]){try{var _0x512496=JSON['parse'](_0x450f7e['query']['range']);if(!moment(_0x512496['from'])[_0x4846('0xce')]()){throw new Error(_0x4846('0xcf'));}if(!moment(_0x512496['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x247c59){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x450f7e[_0x4846('0x2a')][_0x4846('0x34')](_0x4846('0x9a'))){_0x559cde['limit']=qs[_0x4846('0x14')](_0x450f7e[_0x4846('0x2a')][_0x4846('0x14')]||0xa);_0x559cde['offset']=qs[_0x4846('0x13')](_0x450f7e['query'][_0x4846('0x13')]);}var _0x1190da=_0x26d3eb[_0x4846('0x6f')](function(_0x53edb6){if(_0x53edb6===_0x4846('0xc7')){var _0x2a1d43={'attributes':['id',_0x4846('0xd0'),_0x4846('0x2e'),_0x4846('0xd1'),'destination',_0x4846('0xd2'),_0x4846('0xd3'),_0x4846('0xd4'),_0x4846('0xd5'),_0x4846('0xd6'),'createdAt',_0x4846('0xd7'),_0x4846('0xd8'),_0x4846('0xd9'),'UserId'],'where':{'ContactId':_0x450f7e[_0x4846('0x22')]['id']},'include':[{'model':db[_0x4846('0xba')],'as':'User','attributes':['id',_0x4846('0x1e'),_0x4846('0xda'),_0x4846('0x2c')]}],'order':[[_0x4846('0xdb'),_0x4846('0xdc')]]};if(_0x450f7e[_0x4846('0x2a')][_0x4846('0xcd')]){_0x2a1d43['where'][_0x4846('0xdb')]={'$gte':_0x512496[_0x4846('0x36')],'$lte':_0x512496['to']};}return db[_0x4846('0x4a')][_0x4846('0xdd')](_0x2a1d43)[_0x4846('0x18')](function(_0x5b07dd){_0x2b63ed[_0x4846('0x12')]+=_0x5b07dd[_0x4846('0x12')];return _[_0x4846('0x6f')](_0x5b07dd[_0x4846('0x9d')],function(_0x967d3d){var _0xb8a23b=_0x967d3d[_0x4846('0x37')]({'plain':!![]});_0xb8a23b['channel']=_0x53edb6;if(_0xb8a23b[_0x4846('0xba')]){_0xb8a23b[_0x4846('0xba')]={'id':_0xb8a23b[_0x4846('0xba')]['id'],'name':_0xb8a23b[_0x4846('0xba')]['name'],'fullname':_0xb8a23b[_0x4846('0xba')][_0x4846('0xda')],'alias':_0xb8a23b[_0x4846('0xba')][_0x4846('0x2c')]};}return _0xb8a23b;});});}else{var _0x632030=_['startCase'](_0x53edb6)+(_0x53edb6===_0x4846('0xc4')?_0x4846('0xde'):_0x4846('0xdf'));var _0x48546f={'attributes':['id',_0x4846('0xe0'),_0x4846('0xe1'),_0x4846('0xdb'),'note',_0x4846('0xe2'),_0x4846('0xe3'),_0x4846('0xe4'),_0x4846('0xe5'),_0x632030+'Id'],'where':{'ContactId':_0x450f7e[_0x4846('0x22')]['id']},'include':[{'model':db[_0x632030],'as':_0x4846('0xdf'),'attributes':['id','name',_0x4846('0xe6')]},{'model':db[_0x4846('0xba')],'as':_0x4846('0xe7'),'attributes':['id',_0x4846('0x1e'),_0x4846('0xda')]},{'model':db[_0x4846('0x60')],'as':_0x4846('0x61'),'attributes':['id',_0x4846('0x1e'),_0x4846('0x62')],'through':{'attributes':[]}}],'order':[[_0x4846('0xdb'),_0x4846('0xdc')]]};if(_0x450f7e['query'][_0x4846('0xcd')]){_0x48546f[_0x4846('0x58')][_0x4846('0xdb')]={'$gte':_0x512496['from'],'$lte':_0x512496['to']};}switch(_0x53edb6){case _0x4846('0xc4'):_0x48546f[_0x4846('0x7e')][_0x4846('0x59')](_0x4846('0xe8'),_0x4846('0xe9'),_0x4846('0xea'),_0x4846('0xeb'),_0x4846('0xec'),'ratingMessage',_0x4846('0xed'),_0x4846('0xee'),_0x4846('0xef'));break;case _0x4846('0xf0'):_0x48546f[_0x4846('0x7e')][_0x4846('0x59')](_0x4846('0xf1'),'substatus');break;case _0x4846('0xf2'):_0x48546f['attributes']['push'](_0x4846('0xf3'),'threadId');break;}return db[_['startCase'](_0x53edb6)+_0x4846('0xf4')][_0x4846('0xdd')](_0x48546f)[_0x4846('0x18')](function(_0x1e9a3b){_0x2b63ed['count']+=_0x1e9a3b['count'];return _['map'](_0x1e9a3b['rows'],function(_0x1890f7){var _0x386c66=_0x1890f7['get']({'plain':!![]});_0x386c66['channel']=_0x53edb6;if(_0x386c66[_0x4846('0xe7')]){_0x386c66['Owner']={'id':_0x386c66[_0x4846('0xe7')]['id'],'name':_0x386c66[_0x4846('0xe7')][_0x4846('0x1e')],'fullname':_0x386c66[_0x4846('0xe7')][_0x4846('0xda')]};}return _0x386c66;});});}});return Promise[_0x4846('0x5d')](_0x1190da);})[_0x4846('0x18')](function(_0x348382){return _(_0x348382)[_0x4846('0xf5')]()[_0x4846('0xf6')](_0x4846('0xdb'))[_0x4846('0xf7')]()[_0x4846('0xf8')]();})['then'](function(_0x8c1cfb){_0x2b63ed[_0x4846('0x9d')]=_0x559cde[_0x4846('0x14')]?_0x8c1cfb['slice'](_0x559cde['offset'],_0x559cde[_0x4846('0x13')]+_0x559cde[_0x4846('0x14')]):_0x8c1cfb;return _0x2b63ed;})['then'](respondWithFilteredResult(_0x58aeec,_0x559cde))[_0x4846('0x21')](handleError(_0x58aeec,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e83dfdc..6306639 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 _0xb8bd=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x23b5be,_0x3f488a){var _0x414f5a=function(_0x4bad4e){while(--_0x4bad4e){_0x23b5be['push'](_0x23b5be['shift']());}};_0x414f5a(++_0x3f488a);}(_0xb8bd,0x100));var _0xdb8b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xb8bd[_0x19b3f9];return _0x18c3f6;};'use strict';var EventEmitter=require(_0xdb8b('0x0'));var CmContact=require(_0xdb8b('0x1'))['db'][_0xdb8b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xdb8b('0x3')](0x0);var events={'afterCreate':_0xdb8b('0x4'),'afterUpdate':_0xdb8b('0x5'),'afterDestroy':_0xdb8b('0x6')};function emitEvent(_0x896e16){return function(_0x555ee5,_0x4b6c92,_0x4b183a){CmContactEvents['emit'](_0x896e16+':'+_0x555ee5['id'],_0x555ee5);CmContactEvents[_0xdb8b('0x7')](_0x896e16,_0x555ee5);_0x4b183a(null);};}for(var e in events){if(events[_0xdb8b('0x8')](e)){var event=events[e];CmContact[_0xdb8b('0x9')](e,emitEvent(event));}}module[_0xdb8b('0xa')]=CmContactEvents; \ No newline at end of file +var _0x2fc3=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x19cbde,_0x4f8b31){var _0x1da364=function(_0x26c4dd){while(--_0x26c4dd){_0x19cbde['push'](_0x19cbde['shift']());}};_0x1da364(++_0x4f8b31);}(_0x2fc3,0x66));var _0x32fc=function(_0x32d3d4,_0x28931d){_0x32d3d4=_0x32d3d4-0x0;var _0x2ec6be=_0x2fc3[_0x32d3d4];return _0x2ec6be;};'use strict';var EventEmitter=require(_0x32fc('0x0'));var CmContact=require(_0x32fc('0x1'))['db'][_0x32fc('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x32fc('0x3')](0x0);var events={'afterCreate':_0x32fc('0x4'),'afterUpdate':_0x32fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x221292){return function(_0x376e88,_0x226577,_0x3a6861){CmContactEvents['emit'](_0x221292+':'+_0x376e88['id'],_0x376e88);CmContactEvents[_0x32fc('0x6')](_0x221292,_0x376e88);_0x3a6861(null);};}for(var e in events){if(events[_0x32fc('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x32fc('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 303e7cb..7e95e7b 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 _0x3882=['cm_contacts','fti_cm_contacts','mobile','fax','email','FULLTEXT','utf8mb4','models','error','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','ListId','priority','callbackUniqueid','assign','CmHopper','phone','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','\x20in\x20Campaign\x20with\x20id\x20','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','dialCheckDuplicateType','CmHopperBlack','all','exports','define','CmContact'];(function(_0x395e3c,_0x2e9e9f){var _0xc08d78=function(_0x29a5d3){while(--_0x29a5d3){_0x395e3c['push'](_0x395e3c['shift']());}};_0xc08d78(++_0x2e9e9f);}(_0x3882,0x155));var _0x2388=function(_0x3f9e8c,_0x4f6caf){_0x3f9e8c=_0x3f9e8c-0x0;var _0x590945=_0x3882[_0x3f9e8c];return _0x590945;};'use strict';var _=require(_0x2388('0x0'));var util=require('util');var logger=require(_0x2388('0x1'))(_0x2388('0x2'));var moment=require(_0x2388('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x2388('0x4'));function getTimezoneCallbackAt(_0x1836ce,_0x1ce9f4,_0x5e93fa,_0x570065){var _0x200d71=_0x570065?_0x2388('0x5'):_0x2388('0x6');var _0x2c3df4=_0x5e93fa['scheduledat']?_0x5e93fa[_0x2388('0x7')]:moment()[_0x2388('0x8')](_0x2388('0x9'));if(_[_0x2388('0xa')](_0x5e93fa[_0x2388('0xb')])){return Promise[_0x2388('0xc')](_0x2c3df4);}return _0x1836ce[_0x200d71][_0x2388('0xd')]({'where':{'id':_0x1ce9f4}})[_0x2388('0xe')](function(_0x2a4767){if(_['isNil'](_0x2a4767)||_['isNil'](_0x2a4767[_0x2388('0xb')])){return Promise[_0x2388('0xc')](_0x2c3df4);}var _0x21f228=shared[_0x2388('0xf')];var _0x17d6cd=_0x21f228[_0x2a4767['dialTimezone']];var _0x4f985d=_0x21f228[_0x5e93fa[_0x2388('0xb')]];if(_[_0x2388('0xa')](_0x17d6cd)&&_[_0x2388('0xa')](_0x4f985d)){return Promise[_0x2388('0xc')](_0x2c3df4);}var _0x44b61d=_0x17d6cd[_0x2388('0x10')]-_0x4f985d[_0x2388('0x10')];var _0x4211fd=_0x5e93fa[_0x2388('0x7')]?_0x5e93fa[_0x2388('0x7')]:moment();_0x2c3df4=moment(_0x4211fd)['add'](_0x44b61d,_0x2388('0x11'))[_0x2388('0x8')](_0x2388('0x9'));return Promise[_0x2388('0xc')](_0x2c3df4);});}function getNewHopperPayload(_0x35b004){return{'phone':_0x35b004['phone'],'ContactId':_0x35b004['id'],'ListId':_0x35b004[_0x2388('0x12')],'scheduledat':_0x35b004['scheduledat']?_0x35b004[_0x2388('0x7')]:moment()[_0x2388('0x8')](_0x2388('0x9')),'priority':_0x35b004['priority']?_0x35b004[_0x2388('0x13')]:0x2,'callback':_0x35b004[_0x2388('0x14')]?!![]:![],'callbackuniqueid':_0x35b004['callbackUniqueid']?_0x35b004['callbackUniqueid']:undefined,'callbackat':_0x35b004[_0x2388('0x14')]?moment()[_0x2388('0x8')](_0x2388('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x21c05a,_0x25468f,_0x360e8f,_0x4c0704){var _0x546d7c={'phone':_0x360e8f['phone']};var _0x44c2c9={'calleridnum':_0x360e8f['phone']};if(_0x4c0704){Object[_0x2388('0x15')](_0x546d7c,{'CampaignId':_0x25468f['id']});Object[_0x2388('0x15')](_0x44c2c9,{'CampaignId':_0x25468f['id']});}else{Object[_0x2388('0x15')](_0x546d7c,{'VoiceQueueId':_0x25468f['id']});Object[_0x2388('0x15')](_0x44c2c9,{'VoiceQueueId':_0x25468f['id']});}return _0x21c05a[_0x2388('0x16')][_0x2388('0xd')]({'where':_0x546d7c})[_0x2388('0xe')](function(_0x30b719){if(_0x30b719){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x360e8f[_0x2388('0x17')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x25468f['id']);}return _0x21c05a[_0x2388('0x18')][_0x2388('0xd')]({'where':_0x44c2c9});})[_0x2388('0xe')](function(_0xeebbb0){if(_0xeebbb0){throw new Error(_0x2388('0x19')+_0x360e8f[_0x2388('0x17')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x25468f['id']);}var _0x3bc7f0=getNewHopperPayload(_0x360e8f);if(_0x4c0704){_0x3bc7f0[_0x2388('0x1a')]=_0x25468f['id'];}else{_0x3bc7f0[_0x2388('0x1b')]=_0x25468f['id'];}return _0x21c05a[_0x2388('0x16')][_0x2388('0x1c')](_0x3bc7f0);});}function handleOnlyIfOpenCheckDuplicate(_0xc53b17,_0x4af570,_0x457101,_0x3b9c1a){var _0x5e5677={'phone':_0x457101[_0x2388('0x17')]};if(_0x3b9c1a){Object[_0x2388('0x15')](_0x5e5677,{'CampaignId':_0x4af570['id']});}else{Object[_0x2388('0x15')](_0x5e5677,{'VoiceQueueId':_0x4af570['id']});}return _0xc53b17[_0x2388('0x16')][_0x2388('0xd')]({'where':_0x5e5677})[_0x2388('0xe')](function(_0x33f9fd){if(_0x33f9fd){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x457101[_0x2388('0x17')]+_0x2388('0x1d')+_0x4af570['id']);}var _0x26c16e=getNewHopperPayload(_0x457101);if(_0x3b9c1a){_0x26c16e[_0x2388('0x1a')]=_0x4af570['id'];}else{_0x26c16e['VoiceQueueId']=_0x4af570['id'];}return _0xc53b17['CmHopper'][_0x2388('0x1c')](_0x26c16e);});}function handleNeverCheckDuplicate(_0x3bdd25,_0x1a8b45,_0x2a046b){var _0x57d7ac=getNewHopperPayload(_0x2a046b);_0x57d7ac['VoiceQueueId']=_0x1a8b45['id'];return _0x3bdd25[_0x2388('0x16')]['create'](_0x57d7ac);}function handleCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4){return getTimezoneCallbackAt(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4)[_0x2388('0xe')](function(_0x59133f){_0x4d2fd2[_0x2388('0x7')]=_0x59133f;switch(_0x766ea3['dialCheckDuplicateType']){case _0x2388('0x1e'):return handleAlwaysCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4);case _0x2388('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4);default:return handleNeverCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2);}});}function createHopperForVoiceQueues(_0x3845f2,_0x2da6c7){return _0x3845f2[_0x2388('0x6')][_0x2388('0x20')]({'where':{'type':_0x2388('0x21')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x3845f2[_0x2388('0x22')],'as':_0x2388('0x23'),'where':{'id':_0x2da6c7[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x4a17ee){var _0xcd04dd=_0x4a17ee[_0x2388('0x24')](function(_0x3c077b){return handleCheckDuplicate(_0x3845f2,_0x3c077b,_0x2da6c7,![]);});return Promise['all'](_0xcd04dd);});}function createHopperForCampaigns(_0x48596c,_0x4130db){return _0x48596c[_0x2388('0x5')][_0x2388('0x20')]({'attributes':['id',_0x2388('0x25'),_0x2388('0xb')],'include':[{'model':_0x48596c[_0x2388('0x22')],'as':_0x2388('0x23'),'where':{'id':_0x4130db[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x5c3b24){var _0x23f0e6=_0x5c3b24['map'](function(_0x2f0a5b){return handleCheckDuplicate(_0x48596c,_0x2f0a5b,_0x4130db,!![]);});return Promise['all'](_0x23f0e6);});}function createHopperBlackForVoiceQueues(_0xacce48,_0x1c16c1){return _0xacce48[_0x2388('0x6')][_0x2388('0x20')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xacce48[_0x2388('0x22')],'as':'BlackLists','where':{'id':_0x1c16c1[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0xf6f397){var _0x167a7f=_0xf6f397[_0x2388('0x24')](function(_0x3ddb5e){return _0xacce48[_0x2388('0x26')][_0x2388('0x1c')]({'phone':_0x1c16c1['phone'],'ContactId':_0x1c16c1['id'],'ListId':_0x1c16c1['ListId'],'VoiceQueueId':_0x3ddb5e['id']});});return Promise[_0x2388('0x27')](_0x167a7f);});}function createHopperBlackForCampaigns(_0x4021f7,_0x377272){return _0x4021f7[_0x2388('0x5')]['findAll']({'attributes':['id'],'include':[{'model':_0x4021f7[_0x2388('0x22')],'as':'BlackLists','where':{'id':_0x377272[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x120e6e){var _0x595d37=_0x120e6e[_0x2388('0x24')](function(_0x2e1327){return _0x4021f7[_0x2388('0x26')][_0x2388('0x1c')]({'phone':_0x377272['phone'],'ContactId':_0x377272['id'],'ListId':_0x377272[_0x2388('0x12')],'CampaignId':_0x2e1327['id']});});return Promise[_0x2388('0x27')](_0x595d37);});}module[_0x2388('0x28')]=function(_0x890551){return _0x890551[_0x2388('0x29')](_0x2388('0x2a'),attributes,{'tableName':_0x2388('0x2b'),'paranoid':!![],'indexes':[{'name':_0x2388('0x17'),'fields':['phone']},{'name':_0x2388('0x2c'),'fields':['firstName','lastName','phone',_0x2388('0x2d'),_0x2388('0x2e'),_0x2388('0x2f')],'type':_0x2388('0x30')}],'timestamps':!![],'charset':_0x2388('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4e5dc1,_0xe37289,_0x2b1378){var _0x483d03=_0x890551[_0x2388('0x32')];var _0x3f0b9f=_0x4e5dc1['get']({'plain':!![]});if(!_0x3f0b9f[_0x2388('0x12')]){logger[_0x2388('0x33')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x3f0b9f['id']);return _0x2b1378();}if(!_0x3f0b9f[_0x2388('0x17')]){return _0x2b1378();}return createHopperForVoiceQueues(_0x483d03,_0x3f0b9f)['then'](function(){return createHopperBlackForVoiceQueues(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return createHopperForCampaigns(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return createHopperBlackForCampaigns(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return _0x2b1378();})[_0x2388('0x34')](function(_0x2082cb){logger['error'](_0x2388('0x35'),_0x2082cb[_0x2388('0x36')]);_0x2b1378();});},'afterDestroy':function(_0x5c820e,_0x220f04,_0xe2a93){var _0x2e20f9=_0x890551['models'];var _0x590d88=_0x5c820e['get']({'plain':!![]});return _0x2e20f9[_0x2388('0x16')][_0x2388('0x20')]({'raw':!![],'where':{'ListId':_0x590d88[_0x2388('0x12')],'ContactId':_0x590d88['id']}})[_0x2388('0xe')](function(_0x4ca58b){if(!_[_0x2388('0x37')](_0x4ca58b)){var _0x249061=[];for(var _0x44d270=0x0;_0x44d270<_0x4ca58b[_0x2388('0x38')];_0x44d270+=0x1){var _0x3889c9=_0x2e20f9['CmHopper'][_0x2388('0x39')]({'where':{'ListId':_0x4ca58b[_0x44d270][_0x2388('0x12')],'ContactId':_0x4ca58b[_0x44d270][_0x2388('0x3a')],'VoiceQueueId':_0x4ca58b[_0x44d270]['VoiceQueueId'],'CampaignId':_0x4ca58b[_0x44d270][_0x2388('0x1a')]}});_0x249061[_0x2388('0x3b')](_0x3889c9);}return Promise['all'](_0x249061);}})[_0x2388('0xe')](function(_0x4c9bce){logger[_0x2388('0x3c')](_0x2388('0x3d'),util['inspect'](_0x4c9bce,{'showHidden':![],'depth':null}));_0xe2a93();})[_0x2388('0x34')](function(_0x461adb){logger[_0x2388('0x33')](_0x2388('0x3e'),util[_0x2388('0x3f')](_0x461adb,{'showHidden':![],'depth':null}));_0xe2a93(_0x461adb);});}}});}; \ No newline at end of file +var _0xca66=['assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','CmHopper','create','always','onlyIfOpen','findAll','outbound','CmList','Lists','ListId','map','all','dialCheckDuplicateType','CmHopperBlack','BlackLists','define','cm_contacts','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','destroy','ContactId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','../../config/environment/shared','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','phone','priority','callbackUniqueid'];(function(_0x54e55,_0x2a90a6){var _0x29477a=function(_0x4d2841){while(--_0x4d2841){_0x54e55['push'](_0x54e55['shift']());}};_0x29477a(++_0x2a90a6);}(_0xca66,0x1f1));var _0x6ca6=function(_0x3cb8ef,_0x1d72bd){_0x3cb8ef=_0x3cb8ef-0x0;var _0x39781d=_0xca66[_0x3cb8ef];return _0x39781d;};'use strict';var _=require(_0x6ca6('0x0'));var util=require(_0x6ca6('0x1'));var logger=require(_0x6ca6('0x2'))(_0x6ca6('0x3'));var moment=require(_0x6ca6('0x4'));var shared=require(_0x6ca6('0x5'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x241927,_0xa00b3d,_0x35a80b,_0x5142fc){var _0x259de4=_0x5142fc?_0x6ca6('0x6'):_0x6ca6('0x7');var _0x1410f5=_0x35a80b[_0x6ca6('0x8')]?_0x35a80b[_0x6ca6('0x8')]:moment()[_0x6ca6('0x9')](_0x6ca6('0xa'));if(_[_0x6ca6('0xb')](_0x35a80b[_0x6ca6('0xc')])){return Promise[_0x6ca6('0xd')](_0x1410f5);}return _0x241927[_0x259de4][_0x6ca6('0xe')]({'where':{'id':_0xa00b3d}})[_0x6ca6('0xf')](function(_0x313a9f){if(_[_0x6ca6('0xb')](_0x313a9f)||_[_0x6ca6('0xb')](_0x313a9f[_0x6ca6('0xc')])){return Promise[_0x6ca6('0xd')](_0x1410f5);}var _0x2bb52e=shared[_0x6ca6('0x10')];var _0x34124c=_0x2bb52e[_0x313a9f['dialTimezone']];var _0x495e5a=_0x2bb52e[_0x35a80b[_0x6ca6('0xc')]];if(_['isNil'](_0x34124c)&&_[_0x6ca6('0xb')](_0x495e5a)){return Promise['resolve'](_0x1410f5);}var _0x23c522=_0x34124c[_0x6ca6('0x11')]-_0x495e5a[_0x6ca6('0x11')];var _0x3e4d6c=_0x35a80b[_0x6ca6('0x8')]?_0x35a80b['scheduledat']:moment();_0x1410f5=moment(_0x3e4d6c)[_0x6ca6('0x12')](_0x23c522,_0x6ca6('0x13'))[_0x6ca6('0x9')](_0x6ca6('0xa'));return Promise[_0x6ca6('0xd')](_0x1410f5);});}function getNewHopperPayload(_0x3b6f8c){return{'phone':_0x3b6f8c[_0x6ca6('0x14')],'ContactId':_0x3b6f8c['id'],'ListId':_0x3b6f8c['ListId'],'scheduledat':_0x3b6f8c[_0x6ca6('0x8')]?_0x3b6f8c[_0x6ca6('0x8')]:moment()[_0x6ca6('0x9')](_0x6ca6('0xa')),'priority':_0x3b6f8c['priority']?_0x3b6f8c[_0x6ca6('0x15')]:0x2,'callback':_0x3b6f8c[_0x6ca6('0x16')]?!![]:![],'callbackuniqueid':_0x3b6f8c[_0x6ca6('0x16')]?_0x3b6f8c['callbackUniqueid']:undefined,'callbackat':_0x3b6f8c[_0x6ca6('0x16')]?moment()[_0x6ca6('0x9')](_0x6ca6('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0xd576f8,_0x59df5f,_0x7dc5ae,_0xa41e9c){var _0x2751ba={'phone':_0x7dc5ae[_0x6ca6('0x14')]};var _0x3c65e7={'calleridnum':_0x7dc5ae[_0x6ca6('0x14')]};if(_0xa41e9c){Object[_0x6ca6('0x17')](_0x2751ba,{'CampaignId':_0x59df5f['id']});Object[_0x6ca6('0x17')](_0x3c65e7,{'CampaignId':_0x59df5f['id']});}else{Object[_0x6ca6('0x17')](_0x2751ba,{'VoiceQueueId':_0x59df5f['id']});Object[_0x6ca6('0x17')](_0x3c65e7,{'VoiceQueueId':_0x59df5f['id']});}return _0xd576f8['CmHopper']['findOne']({'where':_0x2751ba})[_0x6ca6('0xf')](function(_0x40d5ea){if(_0x40d5ea){throw new Error(_0x6ca6('0x18')+_0x7dc5ae[_0x6ca6('0x14')]+_0x6ca6('0x19')+_0x59df5f['id']);}return _0xd576f8[_0x6ca6('0x1a')]['findOne']({'where':_0x3c65e7});})[_0x6ca6('0xf')](function(_0x135115){if(_0x135115){throw new Error(_0x6ca6('0x1b')+_0x7dc5ae[_0x6ca6('0x14')]+_0x6ca6('0x19')+_0x59df5f['id']);}var _0x3b4591=getNewHopperPayload(_0x7dc5ae);if(_0xa41e9c){_0x3b4591['CampaignId']=_0x59df5f['id'];}else{_0x3b4591['VoiceQueueId']=_0x59df5f['id'];}return _0xd576f8['CmHopper']['create'](_0x3b4591);});}function handleOnlyIfOpenCheckDuplicate(_0x49067b,_0x79d79c,_0x35258c,_0x4f338d){var _0x1be30f={'phone':_0x35258c['phone']};if(_0x4f338d){Object[_0x6ca6('0x17')](_0x1be30f,{'CampaignId':_0x79d79c['id']});}else{Object[_0x6ca6('0x17')](_0x1be30f,{'VoiceQueueId':_0x79d79c['id']});}return _0x49067b['CmHopper'][_0x6ca6('0xe')]({'where':_0x1be30f})['then'](function(_0x258310){if(_0x258310){throw new Error(_0x6ca6('0x1c')+_0x35258c[_0x6ca6('0x14')]+_0x6ca6('0x19')+_0x79d79c['id']);}var _0x34c7cc=getNewHopperPayload(_0x35258c);if(_0x4f338d){_0x34c7cc['CampaignId']=_0x79d79c['id'];}else{_0x34c7cc[_0x6ca6('0x1d')]=_0x79d79c['id'];}return _0x49067b[_0x6ca6('0x1e')][_0x6ca6('0x1f')](_0x34c7cc);});}function handleNeverCheckDuplicate(_0x2b98f9,_0x1c10ec,_0x4b3140){var _0x562ca5=getNewHopperPayload(_0x4b3140);_0x562ca5[_0x6ca6('0x1d')]=_0x1c10ec['id'];return _0x2b98f9[_0x6ca6('0x1e')]['create'](_0x562ca5);}function handleCheckDuplicate(_0x514316,_0x330da5,_0x4d8f92,_0xd7a90c){return getTimezoneCallbackAt(_0x514316,_0x330da5,_0x4d8f92,_0xd7a90c)[_0x6ca6('0xf')](function(_0x22dc78){_0x4d8f92[_0x6ca6('0x8')]=_0x22dc78;switch(_0x330da5['dialCheckDuplicateType']){case _0x6ca6('0x20'):return handleAlwaysCheckDuplicate(_0x514316,_0x330da5,_0x4d8f92,_0xd7a90c);case _0x6ca6('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x514316,_0x330da5,_0x4d8f92,_0xd7a90c);default:return handleNeverCheckDuplicate(_0x514316,_0x330da5,_0x4d8f92);}});}function createHopperForVoiceQueues(_0x3921e9,_0x33c8c2){return _0x3921e9[_0x6ca6('0x7')][_0x6ca6('0x22')]({'where':{'type':_0x6ca6('0x23')},'attributes':['id','dialCheckDuplicateType',_0x6ca6('0xc')],'include':[{'model':_0x3921e9[_0x6ca6('0x24')],'as':_0x6ca6('0x25'),'where':{'id':_0x33c8c2[_0x6ca6('0x26')]}}],'raw':!![]})['then'](function(_0x5df9d3){var _0x15db3b=_0x5df9d3[_0x6ca6('0x27')](function(_0x573069){return handleCheckDuplicate(_0x3921e9,_0x573069,_0x33c8c2,![]);});return Promise[_0x6ca6('0x28')](_0x15db3b);});}function createHopperForCampaigns(_0x49df44,_0x3fbf02){return _0x49df44[_0x6ca6('0x6')][_0x6ca6('0x22')]({'attributes':['id',_0x6ca6('0x29'),_0x6ca6('0xc')],'include':[{'model':_0x49df44['CmList'],'as':_0x6ca6('0x25'),'where':{'id':_0x3fbf02[_0x6ca6('0x26')]}}],'raw':!![]})[_0x6ca6('0xf')](function(_0x4cd91f){var _0x3382e3=_0x4cd91f[_0x6ca6('0x27')](function(_0x397689){return handleCheckDuplicate(_0x49df44,_0x397689,_0x3fbf02,!![]);});return Promise[_0x6ca6('0x28')](_0x3382e3);});}function createHopperBlackForVoiceQueues(_0x2afc44,_0x26cac4){return _0x2afc44[_0x6ca6('0x7')][_0x6ca6('0x22')]({'where':{'type':_0x6ca6('0x23')},'attributes':['id'],'include':[{'model':_0x2afc44[_0x6ca6('0x24')],'as':'BlackLists','where':{'id':_0x26cac4['ListId']}}],'raw':!![]})['then'](function(_0x232f60){var _0x55da37=_0x232f60[_0x6ca6('0x27')](function(_0x1ad81f){return _0x2afc44[_0x6ca6('0x2a')]['create']({'phone':_0x26cac4[_0x6ca6('0x14')],'ContactId':_0x26cac4['id'],'ListId':_0x26cac4[_0x6ca6('0x26')],'VoiceQueueId':_0x1ad81f['id']});});return Promise[_0x6ca6('0x28')](_0x55da37);});}function createHopperBlackForCampaigns(_0x183c3e,_0x1f3ede){return _0x183c3e[_0x6ca6('0x6')][_0x6ca6('0x22')]({'attributes':['id'],'include':[{'model':_0x183c3e[_0x6ca6('0x24')],'as':_0x6ca6('0x2b'),'where':{'id':_0x1f3ede[_0x6ca6('0x26')]}}],'raw':!![]})['then'](function(_0x5e2456){var _0x1385a7=_0x5e2456[_0x6ca6('0x27')](function(_0x11fe38){return _0x183c3e[_0x6ca6('0x2a')][_0x6ca6('0x1f')]({'phone':_0x1f3ede[_0x6ca6('0x14')],'ContactId':_0x1f3ede['id'],'ListId':_0x1f3ede[_0x6ca6('0x26')],'CampaignId':_0x11fe38['id']});});return Promise[_0x6ca6('0x28')](_0x1385a7);});}module['exports']=function(_0x1ac1fe){return _0x1ac1fe[_0x6ca6('0x2c')]('CmContact',attributes,{'tableName':_0x6ca6('0x2d'),'paranoid':!![],'indexes':[{'name':_0x6ca6('0x14'),'fields':[_0x6ca6('0x14')]},{'name':'fti_cm_contacts','fields':[_0x6ca6('0x2e'),_0x6ca6('0x2f'),_0x6ca6('0x14'),'mobile',_0x6ca6('0x30'),'email'],'type':_0x6ca6('0x31')}],'timestamps':!![],'charset':_0x6ca6('0x32'),'collate':_0x6ca6('0x33'),'hooks':{'afterCreate':function(_0x45b2e8,_0x57e227,_0x5905b8){var _0x186902=_0x1ac1fe[_0x6ca6('0x34')];var _0x2a46e4=_0x45b2e8[_0x6ca6('0x35')]({'plain':!![]});if(!_0x2a46e4[_0x6ca6('0x26')]){logger[_0x6ca6('0x36')](_0x6ca6('0x37')+_0x2a46e4['id']);return _0x5905b8();}if(!_0x2a46e4[_0x6ca6('0x14')]){return _0x5905b8();}return createHopperForVoiceQueues(_0x186902,_0x2a46e4)[_0x6ca6('0xf')](function(){return createHopperBlackForVoiceQueues(_0x186902,_0x2a46e4);})[_0x6ca6('0xf')](function(){return createHopperForCampaigns(_0x186902,_0x2a46e4);})[_0x6ca6('0xf')](function(){return createHopperBlackForCampaigns(_0x186902,_0x2a46e4);})['then'](function(){return _0x5905b8();})[_0x6ca6('0x38')](function(_0x26e91f){logger[_0x6ca6('0x36')]('[cmContact][afterCreate]',_0x26e91f[_0x6ca6('0x39')]);_0x5905b8();});},'afterDestroy':function(_0x229666,_0x42aced,_0x9af835){var _0x1eb52c=_0x1ac1fe[_0x6ca6('0x34')];var _0x958119=_0x229666[_0x6ca6('0x35')]({'plain':!![]});return _0x1eb52c[_0x6ca6('0x1e')]['findAll']({'raw':!![],'where':{'ListId':_0x958119[_0x6ca6('0x26')],'ContactId':_0x958119['id']}})[_0x6ca6('0xf')](function(_0x57043d){if(!_['isEmpty'](_0x57043d)){var _0x4b3ef4=[];for(var _0x2580b0=0x0;_0x2580b0<_0x57043d['length'];_0x2580b0+=0x1){var _0x327fcb=_0x1eb52c['CmHopper'][_0x6ca6('0x3a')]({'where':{'ListId':_0x57043d[_0x2580b0][_0x6ca6('0x26')],'ContactId':_0x57043d[_0x2580b0][_0x6ca6('0x3b')],'VoiceQueueId':_0x57043d[_0x2580b0]['VoiceQueueId'],'CampaignId':_0x57043d[_0x2580b0][_0x6ca6('0x3c')]}});_0x4b3ef4['push'](_0x327fcb);}return Promise[_0x6ca6('0x28')](_0x4b3ef4);}})['then'](function(_0x5a5ef8){logger[_0x6ca6('0x3d')](_0x6ca6('0x3e'),util[_0x6ca6('0x3f')](_0x5a5ef8,{'showHidden':![],'depth':null}));_0x9af835();})[_0x6ca6('0x38')](function(_0x627dd8){logger[_0x6ca6('0x36')](_0x6ca6('0x40'),util[_0x6ca6('0x3f')](_0x627dd8,{'showHidden':![],'depth':null}));_0x9af835(_0x627dd8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 10d94a1..84a1674 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x210d8a,_0x2461dd){var _0x1bf124=function(_0x3d19a6){while(--_0x3d19a6){_0x210d8a['push'](_0x210d8a['shift']());}};_0x1bf124(++_0x2461dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 1f85dee..c511028 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 _0xc737=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0xd2f8f2,_0x496932){var _0x217eb5=function(_0x56d270){while(--_0x56d270){_0xd2f8f2['push'](_0xd2f8f2['shift']());}};_0x217eb5(++_0x496932);}(_0xc737,0x154));var _0x7c73=function(_0x1e0ea8,_0x793b6b){_0x1e0ea8=_0x1e0ea8-0x0;var _0x34ad3c=_0xc737[_0x1e0ea8];return _0x34ad3c;};'use strict';var Sequelize=require(_0x7c73('0x0'));module[_0x7c73('0x1')]={'CmContactId':{'type':Sequelize[_0x7c73('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c73('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c73('0x3')],'defaultValue':_0x7c73('0x4')},'OrderBy':{'type':Sequelize[_0x7c73('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x757f=['STRING','PHONE','sequelize','INTEGER'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x757f,0xee));var _0xf757=function(_0xdbbdc2,_0x16a3be){_0xdbbdc2=_0xdbbdc2-0x0;var _0x20f387=_0x757f[_0xdbbdc2];return _0x20f387;};'use strict';var Sequelize=require(_0xf757('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xf757('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xf757('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf757('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf757('0x2')],'defaultValue':_0xf757('0x3')},'OrderBy':{'type':Sequelize[_0xf757('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xf757('0x2')],'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 94b32d9..51d454f 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 _0x4804=['error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','CmContactHasItem','findAll','rows','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation'];(function(_0x3ee99e,_0x4affec){var _0x1b56e1=function(_0x3857a2){while(--_0x3857a2){_0x3ee99e['push'](_0x3ee99e['shift']());}};_0x1b56e1(++_0x4affec);}(_0x4804,0xa7));var _0x4480=function(_0x1052c7,_0x2c115d){_0x1052c7=_0x1052c7-0x0;var _0xedd819=_0x4804[_0x1052c7];return _0xedd819;};'use strict';var emlformat=require(_0x4480('0x0'));var rimraf=require(_0x4480('0x1'));var zipdir=require(_0x4480('0x2'));var jsonpatch=require(_0x4480('0x3'));var rp=require(_0x4480('0x4'));var moment=require('moment');var BPromise=require(_0x4480('0x5'));var Mustache=require(_0x4480('0x6'));var util=require(_0x4480('0x7'));var path=require(_0x4480('0x8'));var sox=require('sox');var csv=require(_0x4480('0x9'));var ejs=require(_0x4480('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4480('0xb'));var crypto=require(_0x4480('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4480('0xd'));var toCsv=require(_0x4480('0x9'));var querystring=require(_0x4480('0xe'));var Papa=require('papaparse');var Redis=require(_0x4480('0xf'));var authService=require(_0x4480('0x10'));var qs=require(_0x4480('0x11'));var as=require(_0x4480('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4480('0x13'))(_0x4480('0x14'));var utils=require('../../config/utils');var config=require(_0x4480('0x15'));var licenseUtil=require(_0x4480('0x16'));var db=require(_0x4480('0x17'))['db'];function respondWithStatusCode(_0x5e9840,_0x39e9b0){_0x39e9b0=_0x39e9b0||0xcc;return function(_0x31b2d3){if(_0x31b2d3){return _0x5e9840[_0x4480('0x18')](_0x39e9b0);}return _0x5e9840[_0x4480('0x19')](_0x39e9b0)[_0x4480('0x1a')]();};}function respondWithResult(_0xc7ecc1,_0x2e056e){_0x2e056e=_0x2e056e||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0xc7ecc1['status'](_0x2e056e)['json'](_0x14e5db);}};}function respondWithFilteredResult(_0x4bc638,_0x3836a6){return function(_0x475423){if(_0x475423){var _0x34385a=typeof _0x3836a6['offset']===_0x4480('0x1b')&&typeof _0x3836a6[_0x4480('0x1c')]===_0x4480('0x1b');var _0xa75f53=_0x475423[_0x4480('0x1d')];var _0x4feac0=_0x34385a?0x0:_0x3836a6[_0x4480('0x1e')];var _0x5d5c6f=_0x34385a?_0x475423[_0x4480('0x1d')]:_0x3836a6[_0x4480('0x1e')]+_0x3836a6[_0x4480('0x1c')];var _0x45cbe1;if(_0x5d5c6f>=_0xa75f53){_0x5d5c6f=_0xa75f53;_0x45cbe1=0xc8;}else{_0x45cbe1=0xce;}_0x4bc638['status'](_0x45cbe1);return _0x4bc638[_0x4480('0x1f')](_0x4480('0x20'),_0x4feac0+'-'+_0x5d5c6f+'/'+_0xa75f53)[_0x4480('0x21')](_0x475423);}return null;};}function patchUpdates(_0x4d8183){return function(_0x770a63){try{jsonpatch[_0x4480('0x22')](_0x770a63,_0x4d8183,!![]);}catch(_0x3cf069){return BPromise[_0x4480('0x23')](_0x3cf069);}return _0x770a63[_0x4480('0x24')]();};}function saveUpdates(_0x26054f,_0x2fc74d){return function(_0x3f4d26){if(_0x3f4d26){return _0x3f4d26[_0x4480('0x25')](_0x26054f)[_0x4480('0x26')](function(_0xa38f27){return _0xa38f27;});}return null;};}function removeEntity(_0x1e97d6,_0x54b27c){return function(_0x43e17a){if(_0x43e17a){return _0x43e17a['destroy']()[_0x4480('0x26')](function(){var _0x4244de=_0x43e17a[_0x4480('0x27')]({'plain':!![]});var _0x38f9bb=_0x4480('0x28');return db[_0x4480('0x29')][_0x4480('0x2a')]({'where':{'type':_0x38f9bb,'resourceId':_0x4244de['id']}})[_0x4480('0x26')](function(){return _0x43e17a;});})[_0x4480('0x26')](function(){_0x1e97d6[_0x4480('0x19')](0xcc)[_0x4480('0x1a')]();});}};}function handleEntityNotFound(_0x37416a,_0x215ca7){return function(_0x3497b0){if(!_0x3497b0){_0x37416a[_0x4480('0x18')](0x194);}return _0x3497b0;};}function handleError(_0x35f1f8,_0x279922){_0x279922=_0x279922||0x1f4;return function(_0x265b4f){logger['error'](_0x265b4f[_0x4480('0x2b')]);if(_0x265b4f[_0x4480('0x2c')]){delete _0x265b4f[_0x4480('0x2c')];}_0x35f1f8[_0x4480('0x19')](_0x279922)[_0x4480('0x2d')](_0x265b4f);};}exports[_0x4480('0x2e')]=function(_0x455113,_0x9f407b){var _0x53bb60={},_0x761e6f={},_0x537d52={'count':0x0,'rows':[]};var _0x46b13a=_['map'](db['CmContactHasItem'][_0x4480('0x2f')],function(_0x2bad1e){return{'name':_0x2bad1e[_0x4480('0x30')],'type':_0x2bad1e[_0x4480('0x31')]['key']};});_0x761e6f[_0x4480('0x32')]=_[_0x4480('0x33')](_0x46b13a,_0x4480('0x2c'));_0x761e6f['query']=_['keys'](_0x455113['query']);_0x761e6f['filters']=_[_0x4480('0x34')](_0x761e6f[_0x4480('0x32')],_0x761e6f[_0x4480('0x35')]);_0x53bb60['attributes']=_[_0x4480('0x34')](_0x761e6f[_0x4480('0x32')],qs[_0x4480('0x36')](_0x455113[_0x4480('0x35')][_0x4480('0x36')]));_0x53bb60[_0x4480('0x37')]=_0x53bb60[_0x4480('0x37')]['length']?_0x53bb60[_0x4480('0x37')]:_0x761e6f['model'];if(!_0x455113[_0x4480('0x35')][_0x4480('0x38')](_0x4480('0x39'))){_0x53bb60['limit']=qs[_0x4480('0x1c')](_0x455113[_0x4480('0x35')]['limit']);_0x53bb60[_0x4480('0x1e')]=qs[_0x4480('0x1e')](_0x455113[_0x4480('0x35')][_0x4480('0x1e')]);}_0x53bb60[_0x4480('0x3a')]=qs[_0x4480('0x3b')](_0x455113[_0x4480('0x35')][_0x4480('0x3b')]);_0x53bb60[_0x4480('0x3c')]=qs[_0x4480('0x3d')](_[_0x4480('0x3e')](_0x455113[_0x4480('0x35')],_0x761e6f[_0x4480('0x3d')]),_0x46b13a);if(_0x455113['query'][_0x4480('0x3f')]){_0x53bb60[_0x4480('0x3c')]=_[_0x4480('0x40')](_0x53bb60['where'],{'$or':_[_0x4480('0x33')](_0x46b13a,function(_0x1d8d8b){if(_0x1d8d8b[_0x4480('0x31')]!==_0x4480('0x41')){var _0xac751e={};_0xac751e[_0x1d8d8b[_0x4480('0x2c')]]={'$like':'%'+_0x455113[_0x4480('0x35')]['filter']+'%'};return _0xac751e;}})});}_0x53bb60=_[_0x4480('0x40')]({},_0x53bb60,_0x455113['options']);var _0x24e992={'where':_0x53bb60[_0x4480('0x3c')]};return db[_0x4480('0x42')]['count'](_0x24e992)[_0x4480('0x26')](function(_0x18a14a){_0x537d52[_0x4480('0x1d')]=_0x18a14a;if(_0x455113[_0x4480('0x35')]['includeAll']){_0x53bb60['include']=[{'all':!![]}];}return db[_0x4480('0x42')][_0x4480('0x43')](_0x53bb60);})[_0x4480('0x26')](function(_0x2d34c2){_0x537d52[_0x4480('0x44')]=_0x2d34c2;return _0x537d52;})[_0x4480('0x26')](respondWithFilteredResult(_0x9f407b,_0x53bb60))['catch'](handleError(_0x9f407b,null));};exports[_0x4480('0x45')]=function(_0x3a07b2,_0x956a42){var _0x5e2cc3={'raw':!![],'where':{'id':_0x3a07b2[_0x4480('0x46')]['id']}},_0x18a3e8={};_0x18a3e8[_0x4480('0x32')]=_[_0x4480('0x47')](db[_0x4480('0x42')]['rawAttributes']);_0x18a3e8[_0x4480('0x35')]=_['keys'](_0x3a07b2[_0x4480('0x35')]);_0x18a3e8[_0x4480('0x3d')]=_['intersection'](_0x18a3e8[_0x4480('0x32')],_0x18a3e8[_0x4480('0x35')]);_0x5e2cc3['attributes']=_['intersection'](_0x18a3e8[_0x4480('0x32')],qs['fields'](_0x3a07b2[_0x4480('0x35')][_0x4480('0x36')]));_0x5e2cc3[_0x4480('0x37')]=_0x5e2cc3['attributes'][_0x4480('0x48')]?_0x5e2cc3[_0x4480('0x37')]:_0x18a3e8['model'];if(_0x3a07b2[_0x4480('0x35')]['includeAll']){_0x5e2cc3['include']=[{'all':!![]}];}_0x5e2cc3=_['merge']({},_0x5e2cc3,_0x3a07b2[_0x4480('0x49')]);return db[_0x4480('0x42')][_0x4480('0x4a')](_0x5e2cc3)[_0x4480('0x26')](handleEntityNotFound(_0x956a42,null))['then'](respondWithResult(_0x956a42,null))[_0x4480('0x4b')](handleError(_0x956a42,null));};exports['create']=function(_0x1c853d,_0x4acede){return db[_0x4480('0x42')][_0x4480('0x4c')](_0x1c853d[_0x4480('0x4d')],{})[_0x4480('0x26')](function(_0x4d4be6){var _0x5b4e7f=_0x1c853d[_0x4480('0x4e')][_0x4480('0x27')]({'plain':!![]});if(!_0x5b4e7f)throw new Error(_0x4480('0x4f'));if(_0x5b4e7f['role']===_0x4480('0x4e')){var _0xe75c41=_0x4d4be6['get']({'plain':!![]});var _0x28cd32=_0x4480('0x28');return db['UserProfileSection'][_0x4480('0x4a')]({'where':{'name':_0x28cd32,'userProfileId':_0x5b4e7f[_0x4480('0x50')]},'raw':!![]})[_0x4480('0x26')](function(_0x5fd6b8){if(_0x5fd6b8&&_0x5fd6b8[_0x4480('0x51')]===0x0){return db[_0x4480('0x29')][_0x4480('0x4c')]({'name':_0xe75c41[_0x4480('0x2c')],'resourceId':_0xe75c41['id'],'type':_0x5fd6b8[_0x4480('0x2c')],'sectionId':_0x5fd6b8['id']},{})['then'](function(){return _0x4d4be6;});}else{return _0x4d4be6;}})[_0x4480('0x4b')](function(_0x563e56){logger[_0x4480('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x563e56);throw _0x563e56;});}return _0x4d4be6;})[_0x4480('0x26')](respondWithResult(_0x4acede,0xc9))[_0x4480('0x4b')](handleError(_0x4acede,null));};exports[_0x4480('0x25')]=function(_0x534a80,_0x5a0c55){if(_0x534a80['body']['id']){delete _0x534a80[_0x4480('0x4d')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x534a80[_0x4480('0x46')]['id']}})[_0x4480('0x26')](handleEntityNotFound(_0x5a0c55,null))[_0x4480('0x26')](saveUpdates(_0x534a80[_0x4480('0x4d')],null))[_0x4480('0x26')](respondWithResult(_0x5a0c55,null))[_0x4480('0x4b')](handleError(_0x5a0c55,null));};exports['destroy']=function(_0xfcb62d,_0x22d912){return db[_0x4480('0x42')][_0x4480('0x4a')]({'where':{'id':_0xfcb62d['params']['id']}})[_0x4480('0x26')](handleEntityNotFound(_0x22d912,null))[_0x4480('0x26')](removeEntity(_0x22d912,null))['catch'](handleError(_0x22d912,null));}; \ No newline at end of file +var _0x4aa6=['attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','get','CmContactHasItems','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x3a20ae,_0x3233b1){var _0x4a012d=function(_0x2450c5){while(--_0x2450c5){_0x3a20ae['push'](_0x3a20ae['shift']());}};_0x4a012d(++_0x3233b1);}(_0x4aa6,0x1ae));var _0x64aa=function(_0x164ab6,_0x3caebc){_0x164ab6=_0x164ab6-0x0;var _0x1b7024=_0x4aa6[_0x164ab6];return _0x1b7024;};'use strict';var emlformat=require(_0x64aa('0x0'));var rimraf=require(_0x64aa('0x1'));var zipdir=require(_0x64aa('0x2'));var jsonpatch=require(_0x64aa('0x3'));var rp=require(_0x64aa('0x4'));var moment=require(_0x64aa('0x5'));var BPromise=require(_0x64aa('0x6'));var Mustache=require(_0x64aa('0x7'));var util=require(_0x64aa('0x8'));var path=require(_0x64aa('0x9'));var sox=require('sox');var csv=require(_0x64aa('0xa'));var ejs=require(_0x64aa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x64aa('0xc'));var crypto=require(_0x64aa('0xd'));var jsforce=require(_0x64aa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x64aa('0xa'));var querystring=require(_0x64aa('0xf'));var Papa=require(_0x64aa('0x10'));var Redis=require(_0x64aa('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64aa('0x12'));var hardwareService=require(_0x64aa('0x13'));var logger=require(_0x64aa('0x14'))(_0x64aa('0x15'));var utils=require(_0x64aa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x64aa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363ff3,_0x5871aa){_0x5871aa=_0x5871aa||0xcc;return function(_0x5e50d8){if(_0x5e50d8){return _0x363ff3[_0x64aa('0x18')](_0x5871aa);}return _0x363ff3[_0x64aa('0x19')](_0x5871aa)['end']();};}function respondWithResult(_0x27c44a,_0x2f7766){_0x2f7766=_0x2f7766||0xc8;return function(_0x107ddc){if(_0x107ddc){return _0x27c44a[_0x64aa('0x19')](_0x2f7766)[_0x64aa('0x1a')](_0x107ddc);}};}function respondWithFilteredResult(_0x4ee44b,_0x1f6b4e){return function(_0xae47c8){if(_0xae47c8){var _0x35a954=typeof _0x1f6b4e[_0x64aa('0x1b')]===_0x64aa('0x1c')&&typeof _0x1f6b4e[_0x64aa('0x1d')]===_0x64aa('0x1c');var _0x55c789=_0xae47c8[_0x64aa('0x1e')];var _0x5dbc6a=_0x35a954?0x0:_0x1f6b4e[_0x64aa('0x1b')];var _0x45f5c8=_0x35a954?_0xae47c8['count']:_0x1f6b4e[_0x64aa('0x1b')]+_0x1f6b4e['limit'];var _0x4c323b;if(_0x45f5c8>=_0x55c789){_0x45f5c8=_0x55c789;_0x4c323b=0xc8;}else{_0x4c323b=0xce;}_0x4ee44b[_0x64aa('0x19')](_0x4c323b);return _0x4ee44b['set'](_0x64aa('0x1f'),_0x5dbc6a+'-'+_0x45f5c8+'/'+_0x55c789)['json'](_0xae47c8);}return null;};}function patchUpdates(_0x13f8b6){return function(_0x3217f7){try{jsonpatch[_0x64aa('0x20')](_0x3217f7,_0x13f8b6,!![]);}catch(_0x14abad){return BPromise[_0x64aa('0x21')](_0x14abad);}return _0x3217f7['save']();};}function saveUpdates(_0x1bbf76,_0x28f672){return function(_0x2c1acd){if(_0x2c1acd){return _0x2c1acd['update'](_0x1bbf76)[_0x64aa('0x22')](function(_0x516a82){return _0x516a82;});}return null;};}function removeEntity(_0x49b0a9,_0x2c7fdc){return function(_0x23fdda){if(_0x23fdda){return _0x23fdda['destroy']()['then'](function(){var _0x1e0341=_0x23fdda[_0x64aa('0x23')]({'plain':!![]});var _0x3764e5=_0x64aa('0x24');return db[_0x64aa('0x25')][_0x64aa('0x26')]({'where':{'type':_0x3764e5,'resourceId':_0x1e0341['id']}})[_0x64aa('0x22')](function(){return _0x23fdda;});})[_0x64aa('0x22')](function(){_0x49b0a9[_0x64aa('0x19')](0xcc)[_0x64aa('0x27')]();});}};}function handleEntityNotFound(_0x254505,_0x3da1cc){return function(_0x24fc12){if(!_0x24fc12){_0x254505['sendStatus'](0x194);}return _0x24fc12;};}function handleError(_0x48513e,_0x1fb850){_0x1fb850=_0x1fb850||0x1f4;return function(_0x56b8d9){logger[_0x64aa('0x28')](_0x56b8d9[_0x64aa('0x29')]);if(_0x56b8d9[_0x64aa('0x2a')]){delete _0x56b8d9[_0x64aa('0x2a')];}_0x48513e['status'](_0x1fb850)[_0x64aa('0x2b')](_0x56b8d9);};}exports[_0x64aa('0x2c')]=function(_0x271422,_0x465dcf){var _0x29bd8f={},_0x141551={},_0x4d7e86={'count':0x0,'rows':[]};var _0xe0f90c=_[_0x64aa('0x2d')](db[_0x64aa('0x2e')][_0x64aa('0x2f')],function(_0x3c87b6){return{'name':_0x3c87b6[_0x64aa('0x30')],'type':_0x3c87b6[_0x64aa('0x31')][_0x64aa('0x32')]};});_0x141551[_0x64aa('0x33')]=_[_0x64aa('0x2d')](_0xe0f90c,'name');_0x141551[_0x64aa('0x34')]=_[_0x64aa('0x35')](_0x271422['query']);_0x141551[_0x64aa('0x36')]=_[_0x64aa('0x37')](_0x141551[_0x64aa('0x33')],_0x141551['query']);_0x29bd8f[_0x64aa('0x38')]=_[_0x64aa('0x37')](_0x141551[_0x64aa('0x33')],qs[_0x64aa('0x39')](_0x271422[_0x64aa('0x34')]['fields']));_0x29bd8f[_0x64aa('0x38')]=_0x29bd8f[_0x64aa('0x38')][_0x64aa('0x3a')]?_0x29bd8f[_0x64aa('0x38')]:_0x141551['model'];if(!_0x271422[_0x64aa('0x34')][_0x64aa('0x3b')]('nolimit')){_0x29bd8f[_0x64aa('0x1d')]=qs[_0x64aa('0x1d')](_0x271422[_0x64aa('0x34')][_0x64aa('0x1d')]);_0x29bd8f[_0x64aa('0x1b')]=qs[_0x64aa('0x1b')](_0x271422[_0x64aa('0x34')][_0x64aa('0x1b')]);}_0x29bd8f[_0x64aa('0x3c')]=qs[_0x64aa('0x3d')](_0x271422['query'][_0x64aa('0x3d')]);_0x29bd8f[_0x64aa('0x3e')]=qs[_0x64aa('0x36')](_['pick'](_0x271422[_0x64aa('0x34')],_0x141551['filters']),_0xe0f90c);if(_0x271422['query'][_0x64aa('0x3f')]){_0x29bd8f[_0x64aa('0x3e')]=_[_0x64aa('0x40')](_0x29bd8f[_0x64aa('0x3e')],{'$or':_['map'](_0xe0f90c,function(_0x4e594d){if(_0x4e594d[_0x64aa('0x31')]!=='VIRTUAL'){var _0x3ea469={};_0x3ea469[_0x4e594d[_0x64aa('0x2a')]]={'$like':'%'+_0x271422[_0x64aa('0x34')]['filter']+'%'};return _0x3ea469;}})});}_0x29bd8f=_[_0x64aa('0x40')]({},_0x29bd8f,_0x271422[_0x64aa('0x41')]);var _0x3b3a59={'where':_0x29bd8f[_0x64aa('0x3e')]};return db['CmContactHasItem']['count'](_0x3b3a59)[_0x64aa('0x22')](function(_0x44cef3){_0x4d7e86[_0x64aa('0x1e')]=_0x44cef3;if(_0x271422[_0x64aa('0x34')]['includeAll']){_0x29bd8f[_0x64aa('0x42')]=[{'all':!![]}];}return db[_0x64aa('0x2e')][_0x64aa('0x43')](_0x29bd8f);})[_0x64aa('0x22')](function(_0x4422aa){_0x4d7e86['rows']=_0x4422aa;return _0x4d7e86;})[_0x64aa('0x22')](respondWithFilteredResult(_0x465dcf,_0x29bd8f))['catch'](handleError(_0x465dcf,null));};exports[_0x64aa('0x44')]=function(_0x1d9274,_0x47d7a){var _0x3ec324={'raw':!![],'where':{'id':_0x1d9274['params']['id']}},_0x111063={};_0x111063['model']=_[_0x64aa('0x35')](db[_0x64aa('0x2e')]['rawAttributes']);_0x111063[_0x64aa('0x34')]=_[_0x64aa('0x35')](_0x1d9274['query']);_0x111063[_0x64aa('0x36')]=_[_0x64aa('0x37')](_0x111063[_0x64aa('0x33')],_0x111063[_0x64aa('0x34')]);_0x3ec324[_0x64aa('0x38')]=_[_0x64aa('0x37')](_0x111063['model'],qs['fields'](_0x1d9274['query']['fields']));_0x3ec324[_0x64aa('0x38')]=_0x3ec324['attributes'][_0x64aa('0x3a')]?_0x3ec324[_0x64aa('0x38')]:_0x111063['model'];if(_0x1d9274[_0x64aa('0x34')]['includeAll']){_0x3ec324[_0x64aa('0x42')]=[{'all':!![]}];}_0x3ec324=_['merge']({},_0x3ec324,_0x1d9274[_0x64aa('0x41')]);return db['CmContactHasItem'][_0x64aa('0x45')](_0x3ec324)[_0x64aa('0x22')](handleEntityNotFound(_0x47d7a,null))[_0x64aa('0x22')](respondWithResult(_0x47d7a,null))['catch'](handleError(_0x47d7a,null));};exports[_0x64aa('0x46')]=function(_0x18305b,_0x10de82){return db[_0x64aa('0x2e')][_0x64aa('0x46')](_0x18305b['body'],{})['then'](function(_0x2223d2){var _0x54b722=_0x18305b['user'][_0x64aa('0x23')]({'plain':!![]});if(!_0x54b722)throw new Error(_0x64aa('0x47'));if(_0x54b722[_0x64aa('0x48')]==='user'){var _0x47ead0=_0x2223d2[_0x64aa('0x23')]({'plain':!![]});var _0x490682=_0x64aa('0x24');return db[_0x64aa('0x49')][_0x64aa('0x45')]({'where':{'name':_0x490682,'userProfileId':_0x54b722[_0x64aa('0x4a')]},'raw':!![]})['then'](function(_0x59c2f6){if(_0x59c2f6&&_0x59c2f6[_0x64aa('0x4b')]===0x0){return db[_0x64aa('0x25')]['create']({'name':_0x47ead0['name'],'resourceId':_0x47ead0['id'],'type':_0x59c2f6[_0x64aa('0x2a')],'sectionId':_0x59c2f6['id']},{})[_0x64aa('0x22')](function(){return _0x2223d2;});}else{return _0x2223d2;}})['catch'](function(_0x279306){logger['error'](_0x64aa('0x4c'),_0x279306);throw _0x279306;});}return _0x2223d2;})[_0x64aa('0x22')](respondWithResult(_0x10de82,0xc9))['catch'](handleError(_0x10de82,null));};exports[_0x64aa('0x4d')]=function(_0xb456b6,_0x26289f){if(_0xb456b6[_0x64aa('0x4e')]['id']){delete _0xb456b6[_0x64aa('0x4e')]['id'];}return db['CmContactHasItem'][_0x64aa('0x45')]({'where':{'id':_0xb456b6[_0x64aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x26289f,null))[_0x64aa('0x22')](saveUpdates(_0xb456b6[_0x64aa('0x4e')],null))[_0x64aa('0x22')](respondWithResult(_0x26289f,null))[_0x64aa('0x50')](handleError(_0x26289f,null));};exports[_0x64aa('0x26')]=function(_0x43933b,_0x50c180){return db[_0x64aa('0x2e')][_0x64aa('0x45')]({'where':{'id':_0x43933b[_0x64aa('0x4f')]['id']}})[_0x64aa('0x22')](handleEntityNotFound(_0x50c180,null))[_0x64aa('0x22')](removeEntity(_0x50c180,null))[_0x64aa('0x50')](handleError(_0x50c180,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2378fec..fcaae22 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 _0xc6bb=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x1ea04a,_0x47533d){var _0xcb93c0=function(_0x1fd97e){while(--_0x1fd97e){_0x1ea04a['push'](_0x1ea04a['shift']());}};_0xcb93c0(++_0x47533d);}(_0xc6bb,0xf4));var _0xbc6b=function(_0x3ab1a7,_0x5e6c94){_0x3ab1a7=_0x3ab1a7-0x0;var _0x732e65=_0xc6bb[_0x3ab1a7];return _0x732e65;};'use strict';var _=require(_0xbc6b('0x0'));var util=require(_0xbc6b('0x1'));var logger=require(_0xbc6b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbc6b('0x3'));var rp=require(_0xbc6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc6b('0x5'));var config=require(_0xbc6b('0x6'));var attributes=require(_0xbc6b('0x7'));module[_0xbc6b('0x8')]=function(_0x4a23d0,_0x5f0c56){return _0x4a23d0[_0xbc6b('0x9')](_0xbc6b('0xa'),attributes,{'tableName':_0xbc6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95d9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x95d9,0xa4));var _0x995d=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x95d9[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var logger=require(_0x995d('0x2'))(_0x995d('0x3'));var moment=require(_0x995d('0x4'));var BPromise=require(_0x995d('0x5'));var rp=require(_0x995d('0x6'));var fs=require('fs');var path=require(_0x995d('0x7'));var rimraf=require(_0x995d('0x8'));var config=require(_0x995d('0x9'));var attributes=require(_0x995d('0xa'));module[_0x995d('0xb')]=function(_0x10b5e1,_0x4a1c12){return _0x10b5e1['define'](_0x995d('0xc'),attributes,{'tableName':_0x995d('0xd'),'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 b8c27f1..0c52fff 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 _0x0a4e=['debug','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a4e,0xfd));var _0xe0a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a4e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0a4('0x0'));var BPromise=require(_0xe0a4('0x1'));var rs=require(_0xe0a4('0x2'));var fs=require('fs');var Redis=require(_0xe0a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0a4('0x4'));var logger=require(_0xe0a4('0x5'))(_0xe0a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0a4('0x7'));var client=jayson[_0xe0a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbbee2e,_0xecb378,_0x1bdc5d){return new BPromise(function(_0x313ddb,_0x5b3db2){return client[_0xe0a4('0x9')](_0xbbee2e,_0x1bdc5d)[_0xe0a4('0xa')](function(_0x38b773){logger['info'](_0xe0a4('0xb'),_0xecb378,_0xe0a4('0xc'));logger[_0xe0a4('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0xecb378,_0xe0a4('0xc'),JSON[_0xe0a4('0xe')](_0x38b773));if(_0x38b773[_0xe0a4('0xf')]){if(_0x38b773['error'][_0xe0a4('0x10')]===0x1f4){logger[_0xe0a4('0xf')](_0xe0a4('0xb'),_0xecb378,_0x38b773[_0xe0a4('0xf')]['message']);return _0x5b3db2(_0x38b773['error'][_0xe0a4('0x11')]);}logger[_0xe0a4('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0xecb378,_0x38b773['error']['message']);return _0x313ddb(_0x38b773[_0xe0a4('0xf')][_0xe0a4('0x11')]);}else{logger['info'](_0xe0a4('0xb'),_0xecb378,'request\x20sent');_0x313ddb(_0x38b773[_0xe0a4('0x12')][_0xe0a4('0x11')]);}})['catch'](function(_0x22fbd8){logger[_0xe0a4('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0xecb378,_0x22fbd8);_0x5b3db2(_0x22fbd8);});});} \ No newline at end of file +var _0xbd94=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd94,0x16e));var _0x4bd9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbd94[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4bd9('0x0'));var util=require(_0x4bd9('0x1'));var moment=require(_0x4bd9('0x2'));var BPromise=require(_0x4bd9('0x3'));var rs=require(_0x4bd9('0x4'));var fs=require('fs');var Redis=require(_0x4bd9('0x5'));var db=require(_0x4bd9('0x6'))['db'];var utils=require(_0x4bd9('0x7'));var logger=require('../../config/logger')(_0x4bd9('0x8'));var config=require(_0x4bd9('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5257,_0xee656f,_0x3bc146){return new BPromise(function(_0x322171,_0x19bfd0){return client['request'](_0x3d5257,_0x3bc146)[_0x4bd9('0xa')](function(_0x2b081d){logger[_0x4bd9('0xb')](_0x4bd9('0xc'),_0xee656f,_0x4bd9('0xd'));logger[_0x4bd9('0xe')](_0x4bd9('0xf'),_0xee656f,_0x4bd9('0xd'),JSON['stringify'](_0x2b081d));if(_0x2b081d[_0x4bd9('0x10')]){if(_0x2b081d[_0x4bd9('0x10')][_0x4bd9('0x11')]===0x1f4){logger[_0x4bd9('0x10')](_0x4bd9('0xc'),_0xee656f,_0x2b081d[_0x4bd9('0x10')]['message']);return _0x19bfd0(_0x2b081d['error']['message']);}logger[_0x4bd9('0x10')](_0x4bd9('0xc'),_0xee656f,_0x2b081d[_0x4bd9('0x10')][_0x4bd9('0x12')]);return _0x322171(_0x2b081d[_0x4bd9('0x10')][_0x4bd9('0x12')]);}else{logger[_0x4bd9('0xb')](_0x4bd9('0xc'),_0xee656f,'request\x20sent');_0x322171(_0x2b081d[_0x4bd9('0x13')]['message']);}})[_0x4bd9('0x14')](function(_0x39e0b3){logger['error'](_0x4bd9('0xc'),_0xee656f,_0x39e0b3);_0x19bfd0(_0x39e0b3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index df5f6a5..5e10531 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 _0x655c=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x655c,0x15e));var _0xc655=function(_0x301d19,_0x2cf9e0){_0x301d19=_0x301d19-0x0;var _0x3659bc=_0x655c[_0x301d19];return _0x3659bc;};'use strict';var multer=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var path=require('path');var timeout=require(_0xc655('0x2'));var express=require(_0xc655('0x3'));var router=express[_0xc655('0x4')]();var fs_extra=require(_0xc655('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc655('0x6'));var config=require(_0xc655('0x7'));var controller=require(_0xc655('0x8'));router[_0xc655('0x9')]('/',auth[_0xc655('0xa')](),controller[_0xc655('0xb')]);router[_0xc655('0x9')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller[_0xc655('0xd')]);router[_0xc655('0xe')]('/',auth[_0xc655('0xa')](),controller[_0xc655('0xf')]);router[_0xc655('0x10')]('/:id',auth[_0xc655('0xa')](),controller[_0xc655('0x11')]);router[_0xc655('0x12')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller[_0xc655('0x13')]);module[_0xc655('0x14')]=router; \ No newline at end of file +var _0x756e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5d1c81,_0x5523e4){var _0x2a1d39=function(_0x268339){while(--_0x268339){_0x5d1c81['push'](_0x5d1c81['shift']());}};_0x2a1d39(++_0x5523e4);}(_0x756e,0x18d));var _0xe756=function(_0x41346d,_0xc99680){_0x41346d=_0x41346d-0x0;var _0x508af8=_0x756e[_0x41346d];return _0x508af8;};'use strict';var multer=require('multer');var util=require(_0xe756('0x0'));var path=require('path');var timeout=require(_0xe756('0x1'));var express=require(_0xe756('0x2'));var router=express[_0xe756('0x3')]();var fs_extra=require(_0xe756('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe756('0x5'));var config=require(_0xe756('0x6'));var controller=require(_0xe756('0x7'));router[_0xe756('0x8')]('/',auth[_0xe756('0x9')](),controller[_0xe756('0xa')]);router[_0xe756('0x8')](_0xe756('0xb'),auth[_0xe756('0x9')](),controller[_0xe756('0xc')]);router[_0xe756('0xd')]('/',auth[_0xe756('0x9')](),controller['create']);router[_0xe756('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe756('0xf')]);router[_0xe756('0x10')]('/:id',auth[_0xe756('0x9')](),controller[_0xe756('0x11')]);module[_0xe756('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f63273e..473d502 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 _0xc797=['setDataValue','values','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','TEXT','type','select','parse','isArray'];(function(_0x28a35e,_0x1b865c){var _0x7b5084=function(_0x4ef31c){while(--_0x4ef31c){_0x28a35e['push'](_0x28a35e['shift']());}};_0x7b5084(++_0x1b865c);}(_0xc797,0x148));var _0x7c79=function(_0x1be1a6,_0x4d898b){_0x1be1a6=_0x1be1a6-0x0;var _0x133af4=_0xc797[_0x1be1a6];return _0x133af4;};'use strict';var Sequelize=require(_0x7c79('0x0'));var _=require(_0x7c79('0x1'));module[_0x7c79('0x2')]={'name':{'type':Sequelize[_0x7c79('0x3')],'get':function(_0x4f85be){return this[_0x7c79('0x4')]('alias');}},'alias':{'type':Sequelize[_0x7c79('0x5')],'allowNull':![],'set':function(_0x3bec24){this['setDataValue']('alias',_0x3bec24?_0x3bec24:this[_0x7c79('0x4')](_0x7c79('0x6')));}},'type':{'type':Sequelize[_0x7c79('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x7c79('0x7')]('long'),'get':function(){if(this[_0x7c79('0x4')](_0x7c79('0x8'))===_0x7c79('0x9')){return JSON[_0x7c79('0xa')](this['getDataValue']('values'));}else{return this['getDataValue']('values');}},'set':function(_0x4730c9){if(Array[_0x7c79('0xb')](_0x4730c9)){this[_0x7c79('0xc')](_0x7c79('0xd'),JSON[_0x7c79('0xe')](_0x4730c9));}else{this[_0x7c79('0xc')](_0x7c79('0xd'),_0x4730c9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7c79('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7c79('0x10')]('voice')}}; \ No newline at end of file +var _0x388c=['values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','name','TEXT','long','type','parse','getDataValue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x388c,0x1f2));var _0xc388=function(_0x5c2bb8,_0xf8a9b0){_0x5c2bb8=_0x5c2bb8-0x0;var _0xfddb2e=_0x388c[_0x5c2bb8];return _0xfddb2e;};'use strict';var Sequelize=require(_0xc388('0x0'));var _=require(_0xc388('0x1'));module[_0xc388('0x2')]={'name':{'type':Sequelize[_0xc388('0x3')],'get':function(_0x23de7c){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xc388('0x4')],'allowNull':![],'set':function(_0x4e7bc9){this[_0xc388('0x5')]('alias',_0x4e7bc9?_0x4e7bc9:this['getDataValue'](_0xc388('0x6')));}},'type':{'type':Sequelize[_0xc388('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xc388('0x7')](_0xc388('0x8')),'get':function(){if(this['getDataValue'](_0xc388('0x9'))==='select'){return JSON[_0xc388('0xa')](this[_0xc388('0xb')](_0xc388('0xc')));}else{return this[_0xc388('0xb')](_0xc388('0xc'));}},'set':function(_0x39a8e5){if(Array['isArray'](_0x39a8e5)){this[_0xc388('0x5')](_0xc388('0xc'),JSON[_0xc388('0xd')](_0x39a8e5));}else{this[_0xc388('0x5')]('values',_0x39a8e5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc388('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc388('0xf')](_0xc388('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index be81997..a5a71ba 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 _0x249b=['include','findAll','rows','catch','show','fields','length','merge','options','find','params','body','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','VIRTUAL','includeAll'];(function(_0x2bdca0,_0x549b10){var _0x15699e=function(_0x2b18ec){while(--_0x2b18ec){_0x2bdca0['push'](_0x2bdca0['shift']());}};_0x15699e(++_0x549b10);}(_0x249b,0x16a));var _0xb249=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x249b[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xb249('0x0'));var rimraf=require(_0xb249('0x1'));var zipdir=require(_0xb249('0x2'));var jsonpatch=require(_0xb249('0x3'));var rp=require(_0xb249('0x4'));var moment=require(_0xb249('0x5'));var BPromise=require(_0xb249('0x6'));var Mustache=require(_0xb249('0x7'));var util=require(_0xb249('0x8'));var path=require('path');var sox=require(_0xb249('0x9'));var csv=require(_0xb249('0xa'));var ejs=require(_0xb249('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb249('0xc'));var squel=require(_0xb249('0xd'));var crypto=require(_0xb249('0xe'));var jsforce=require(_0xb249('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb249('0xa'));var querystring=require(_0xb249('0x10'));var Papa=require(_0xb249('0x11'));var Redis=require(_0xb249('0x12'));var authService=require(_0xb249('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb249('0x14'));var hardwareService=require(_0xb249('0x15'));var logger=require(_0xb249('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb249('0x17'));var db=require(_0xb249('0x18'))['db'];function respondWithStatusCode(_0x5245ee,_0x26aded){_0x26aded=_0x26aded||0xcc;return function(_0x2f275a){if(_0x2f275a){return _0x5245ee[_0xb249('0x19')](_0x26aded);}return _0x5245ee[_0xb249('0x1a')](_0x26aded)[_0xb249('0x1b')]();};}function respondWithResult(_0x312afb,_0x560970){_0x560970=_0x560970||0xc8;return function(_0x2d9b8f){if(_0x2d9b8f){return _0x312afb[_0xb249('0x1a')](_0x560970)[_0xb249('0x1c')](_0x2d9b8f);}};}function respondWithFilteredResult(_0xf6023d,_0x1e6da8){return function(_0x3e1576){if(_0x3e1576){var _0xa46493=typeof _0x1e6da8['offset']===_0xb249('0x1d')&&typeof _0x1e6da8['limit']===_0xb249('0x1d');var _0x187541=_0x3e1576['count'];var _0x4f98fb=_0xa46493?0x0:_0x1e6da8[_0xb249('0x1e')];var _0x4698cd=_0xa46493?_0x3e1576[_0xb249('0x1f')]:_0x1e6da8[_0xb249('0x1e')]+_0x1e6da8[_0xb249('0x20')];var _0x2201e7;if(_0x4698cd>=_0x187541){_0x4698cd=_0x187541;_0x2201e7=0xc8;}else{_0x2201e7=0xce;}_0xf6023d[_0xb249('0x1a')](_0x2201e7);return _0xf6023d[_0xb249('0x21')]('Content-Range',_0x4f98fb+'-'+_0x4698cd+'/'+_0x187541)['json'](_0x3e1576);}return null;};}function patchUpdates(_0x243cf6){return function(_0x181d7e){try{jsonpatch[_0xb249('0x22')](_0x181d7e,_0x243cf6,!![]);}catch(_0x1b18ad){return BPromise[_0xb249('0x23')](_0x1b18ad);}return _0x181d7e[_0xb249('0x24')]();};}function saveUpdates(_0x2e1b82,_0x1c021e){return function(_0x53be45){if(_0x53be45){return _0x53be45[_0xb249('0x25')](_0x2e1b82)[_0xb249('0x26')](function(_0x4a217a){return _0x4a217a;});}return null;};}function removeEntity(_0x781287,_0x16cc0d){return function(_0x16a324){if(_0x16a324){return _0x16a324[_0xb249('0x27')]()[_0xb249('0x26')](function(){_0x781287[_0xb249('0x1a')](0xcc)[_0xb249('0x1b')]();});}};}function handleEntityNotFound(_0x4ad345,_0x1eed84){return function(_0x345d02){if(!_0x345d02){_0x4ad345['sendStatus'](0x194);}return _0x345d02;};}function handleError(_0x228eed,_0x3b8c22){_0x3b8c22=_0x3b8c22||0x1f4;return function(_0x13ebaa){logger[_0xb249('0x28')](_0x13ebaa[_0xb249('0x29')]);if(_0x13ebaa[_0xb249('0x2a')]){delete _0x13ebaa['name'];}_0x228eed[_0xb249('0x1a')](_0x3b8c22)[_0xb249('0x2b')](_0x13ebaa);};}exports[_0xb249('0x2c')]=function(_0x36e22c,_0x473d5d){var _0x3f7590={},_0x2756ad={},_0x14a27e={'count':0x0,'rows':[]};var _0x5bb3a0=_[_0xb249('0x2d')](db[_0xb249('0x2e')][_0xb249('0x2f')],function(_0x1b78d4){return{'name':_0x1b78d4[_0xb249('0x30')],'type':_0x1b78d4[_0xb249('0x31')][_0xb249('0x32')]};});_0x2756ad[_0xb249('0x33')]=_['differenceBy'](_['map'](_0x5bb3a0,_0xb249('0x2a')),[_0xb249('0x2a')]);_0x2756ad[_0xb249('0x34')]=_[_0xb249('0x35')](_0x36e22c[_0xb249('0x34')]);_0x2756ad['filters']=_['intersection'](_0x2756ad['model'],_0x2756ad[_0xb249('0x34')]);_0x3f7590['attributes']=_[_0xb249('0x36')](_0x2756ad['model'],qs['fields'](_0x36e22c['query']['fields']));_0x3f7590[_0xb249('0x37')]=_0x3f7590[_0xb249('0x37')]['length']?_0x3f7590[_0xb249('0x37')]:_0x2756ad[_0xb249('0x33')];if(!_0x36e22c[_0xb249('0x34')]['hasOwnProperty'](_0xb249('0x38'))){_0x3f7590['limit']=qs[_0xb249('0x20')](_0x36e22c[_0xb249('0x34')][_0xb249('0x20')]);_0x3f7590[_0xb249('0x1e')]=qs['offset'](_0x36e22c[_0xb249('0x34')][_0xb249('0x1e')]);}_0x3f7590['order']=qs[_0xb249('0x39')](_0x36e22c['query'][_0xb249('0x39')]);_0x3f7590[_0xb249('0x3a')]=qs[_0xb249('0x3b')](_['pick'](_0x36e22c['query'],_0x2756ad[_0xb249('0x3b')]),_0x5bb3a0);if(_0x36e22c[_0xb249('0x34')][_0xb249('0x3c')]){_0x3f7590[_0xb249('0x3a')]=_['merge'](_0x3f7590[_0xb249('0x3a')],{'$or':_[_0xb249('0x2d')](_0x5bb3a0,function(_0x49249f){if(_0x49249f[_0xb249('0x31')]!==_0xb249('0x3d')){var _0x4346d9={};_0x4346d9[_0x49249f['name']]={'$like':'%'+_0x36e22c[_0xb249('0x34')][_0xb249('0x3c')]+'%'};return _0x4346d9;}})});}_0x3f7590=_['merge']({},_0x3f7590,_0x36e22c['options']);var _0x540dc8={'where':_0x3f7590[_0xb249('0x3a')]};return db['CmCustomField'][_0xb249('0x1f')](_0x540dc8)[_0xb249('0x26')](function(_0x12a1b0){_0x14a27e[_0xb249('0x1f')]=_0x12a1b0;if(_0x36e22c['query'][_0xb249('0x3e')]){_0x3f7590[_0xb249('0x3f')]=[{'all':!![]}];}return db[_0xb249('0x2e')][_0xb249('0x40')](_0x3f7590);})[_0xb249('0x26')](function(_0x319f70){_0x14a27e[_0xb249('0x41')]=_0x319f70;return _0x14a27e;})['then'](respondWithFilteredResult(_0x473d5d,_0x3f7590))[_0xb249('0x42')](handleError(_0x473d5d,null));};exports[_0xb249('0x43')]=function(_0x4c2179,_0x32db1c){var _0x45e9f7={'raw':!![],'where':{'id':_0x4c2179['params']['id']}},_0x4b3c7b={};_0x4b3c7b[_0xb249('0x33')]=_['keys'](db[_0xb249('0x2e')][_0xb249('0x2f')]);_0x4b3c7b[_0xb249('0x34')]=_['keys'](_0x4c2179[_0xb249('0x34')]);_0x4b3c7b[_0xb249('0x3b')]=_[_0xb249('0x36')](_0x4b3c7b['model'],_0x4b3c7b[_0xb249('0x34')]);_0x45e9f7[_0xb249('0x37')]=_['intersection'](_0x4b3c7b['model'],qs['fields'](_0x4c2179[_0xb249('0x34')][_0xb249('0x44')]));_0x45e9f7['attributes']=_0x45e9f7[_0xb249('0x37')][_0xb249('0x45')]?_0x45e9f7[_0xb249('0x37')]:_0x4b3c7b[_0xb249('0x33')];if(_0x4c2179[_0xb249('0x34')][_0xb249('0x3e')]){_0x45e9f7['include']=[{'all':!![]}];}_0x45e9f7=_[_0xb249('0x46')]({},_0x45e9f7,_0x4c2179[_0xb249('0x47')]);return db[_0xb249('0x2e')]['find'](_0x45e9f7)[_0xb249('0x26')](handleEntityNotFound(_0x32db1c,null))['then'](respondWithResult(_0x32db1c,null))[_0xb249('0x42')](handleError(_0x32db1c,null));};exports[_0xb249('0x25')]=function(_0x283710,_0x1ae336){if(_0x283710['body']['id']){delete _0x283710['body']['id'];}return db[_0xb249('0x2e')][_0xb249('0x48')]({'where':{'id':_0x283710[_0xb249('0x49')]['id']}})[_0xb249('0x26')](handleEntityNotFound(_0x1ae336,null))['then'](saveUpdates(_0x283710[_0xb249('0x4a')],null))[_0xb249('0x26')](respondWithResult(_0x1ae336,null))[_0xb249('0x42')](handleError(_0x1ae336,null));};exports['destroy']=function(_0x38dfbf,_0x3b1b8f){return db[_0xb249('0x2e')][_0xb249('0x48')]({'where':{'id':_0x38dfbf[_0xb249('0x49')]['id']}})[_0xb249('0x26')](handleEntityNotFound(_0x3b1b8f,null))[_0xb249('0x26')](removeEntity(_0x3b1b8f,null))[_0xb249('0x42')](handleError(_0x3b1b8f,null));};exports[_0xb249('0x4b')]=function(_0x1c82b7,_0x5b4091){var _0x40ec81;return db['sequelize']['transaction'](function(_0x393e8f){return db[_0xb249('0x2e')]['create'](_0x1c82b7['body'],{'transaction':_0x393e8f})[_0xb249('0x26')](function(_0x32bbf3){_0x40ec81=_0x32bbf3;var _0x330898={'type':db[_0xb249('0x4c')]['TEXT'],'transaction':_0x393e8f};switch(_0x1c82b7[_0xb249('0x4a')][_0xb249('0x31')]){case'text':_0x330898[_0xb249('0x31')]=db[_0xb249('0x4c')][_0xb249('0x4d')];break;case _0xb249('0x4e'):_0x330898[_0xb249('0x31')]=db['Sequelize'][_0xb249('0x4f')];break;case _0xb249('0x50'):_0x330898['type']=db[_0xb249('0x4c')][_0xb249('0x51')];_0x330898[_0xb249('0x52')]=![];break;default:}return db['sequelize'][_0xb249('0x53')]['addColumn']('cm_contacts',util['format'](_0xb249('0x54'),_0x40ec81['id']),_0x330898);})[_0xb249('0x26')](function(){return _0x40ec81;});})['then'](respondWithResult(_0x5b4091,0xc9))[_0xb249('0x42')](handleError(_0x5b4091,null));}; \ No newline at end of file +var _0x8663=['offset','undefined','count','limit','set','apply','reject','save','then','error','stack','name','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','rows','catch','params','include','find','update','body','destroy','sequelize','create','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8663,0x131));var _0x3866=function(_0x5360b5,_0x465b80){_0x5360b5=_0x5360b5-0x0;var _0x482af5=_0x8663[_0x5360b5];return _0x482af5;};'use strict';var emlformat=require(_0x3866('0x0'));var rimraf=require(_0x3866('0x1'));var zipdir=require(_0x3866('0x2'));var jsonpatch=require(_0x3866('0x3'));var rp=require(_0x3866('0x4'));var moment=require(_0x3866('0x5'));var BPromise=require(_0x3866('0x6'));var Mustache=require('mustache');var util=require(_0x3866('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3866('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3866('0x9'));var _=require(_0x3866('0xa'));var squel=require(_0x3866('0xb'));var crypto=require(_0x3866('0xc'));var jsforce=require(_0x3866('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3866('0xe'));var Redis=require('ioredis');var authService=require(_0x3866('0xf'));var qs=require(_0x3866('0x10'));var as=require(_0x3866('0x11'));var hardwareService=require(_0x3866('0x12'));var logger=require(_0x3866('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3866('0x14'));var licenseUtil=require(_0x3866('0x15'));var db=require(_0x3866('0x16'))['db'];function respondWithStatusCode(_0x111a55,_0x5a9751){_0x5a9751=_0x5a9751||0xcc;return function(_0x5845c5){if(_0x5845c5){return _0x111a55[_0x3866('0x17')](_0x5a9751);}return _0x111a55['status'](_0x5a9751)[_0x3866('0x18')]();};}function respondWithResult(_0x1474a1,_0x5aa42d){_0x5aa42d=_0x5aa42d||0xc8;return function(_0x3ddf86){if(_0x3ddf86){return _0x1474a1[_0x3866('0x19')](_0x5aa42d)[_0x3866('0x1a')](_0x3ddf86);}};}function respondWithFilteredResult(_0x2cff78,_0x244bc2){return function(_0x5cb262){if(_0x5cb262){var _0x5b454e=typeof _0x244bc2[_0x3866('0x1b')]===_0x3866('0x1c')&&typeof _0x244bc2['limit']===_0x3866('0x1c');var _0x4434f7=_0x5cb262[_0x3866('0x1d')];var _0x2c4496=_0x5b454e?0x0:_0x244bc2[_0x3866('0x1b')];var _0xaab410=_0x5b454e?_0x5cb262[_0x3866('0x1d')]:_0x244bc2[_0x3866('0x1b')]+_0x244bc2[_0x3866('0x1e')];var _0x3b2c6e;if(_0xaab410>=_0x4434f7){_0xaab410=_0x4434f7;_0x3b2c6e=0xc8;}else{_0x3b2c6e=0xce;}_0x2cff78[_0x3866('0x19')](_0x3b2c6e);return _0x2cff78[_0x3866('0x1f')]('Content-Range',_0x2c4496+'-'+_0xaab410+'/'+_0x4434f7)[_0x3866('0x1a')](_0x5cb262);}return null;};}function patchUpdates(_0x3ab814){return function(_0x857a9c){try{jsonpatch[_0x3866('0x20')](_0x857a9c,_0x3ab814,!![]);}catch(_0x1873cd){return BPromise[_0x3866('0x21')](_0x1873cd);}return _0x857a9c[_0x3866('0x22')]();};}function saveUpdates(_0x50be43,_0xa7a04b){return function(_0x5d47b6){if(_0x5d47b6){return _0x5d47b6['update'](_0x50be43)[_0x3866('0x23')](function(_0x563ab2){return _0x563ab2;});}return null;};}function removeEntity(_0x45b1ae,_0x4e308c){return function(_0x3c895c){if(_0x3c895c){return _0x3c895c['destroy']()[_0x3866('0x23')](function(){_0x45b1ae[_0x3866('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397dd6,_0x3756f9){return function(_0x1d971d){if(!_0x1d971d){_0x397dd6[_0x3866('0x17')](0x194);}return _0x1d971d;};}function handleError(_0x2567b4,_0x2289eb){_0x2289eb=_0x2289eb||0x1f4;return function(_0x2377d0){logger[_0x3866('0x24')](_0x2377d0[_0x3866('0x25')]);if(_0x2377d0['name']){delete _0x2377d0[_0x3866('0x26')];}_0x2567b4['status'](_0x2289eb)['send'](_0x2377d0);};}exports['index']=function(_0x6e5b1d,_0x5b8a5d){var _0x3218cf={},_0x3cb2bd={},_0x1d3786={'count':0x0,'rows':[]};var _0x2e29bc=_['map'](db[_0x3866('0x27')][_0x3866('0x28')],function(_0x39f4b0){return{'name':_0x39f4b0[_0x3866('0x29')],'type':_0x39f4b0[_0x3866('0x2a')]['key']};});_0x3cb2bd[_0x3866('0x2b')]=_[_0x3866('0x2c')](_['map'](_0x2e29bc,'name'),[_0x3866('0x26')]);_0x3cb2bd[_0x3866('0x2d')]=_[_0x3866('0x2e')](_0x6e5b1d[_0x3866('0x2d')]);_0x3cb2bd[_0x3866('0x2f')]=_[_0x3866('0x30')](_0x3cb2bd[_0x3866('0x2b')],_0x3cb2bd[_0x3866('0x2d')]);_0x3218cf[_0x3866('0x31')]=_[_0x3866('0x30')](_0x3cb2bd[_0x3866('0x2b')],qs['fields'](_0x6e5b1d[_0x3866('0x2d')][_0x3866('0x32')]));_0x3218cf['attributes']=_0x3218cf['attributes']['length']?_0x3218cf['attributes']:_0x3cb2bd[_0x3866('0x2b')];if(!_0x6e5b1d[_0x3866('0x2d')][_0x3866('0x33')]('nolimit')){_0x3218cf[_0x3866('0x1e')]=qs[_0x3866('0x1e')](_0x6e5b1d[_0x3866('0x2d')][_0x3866('0x1e')]);_0x3218cf[_0x3866('0x1b')]=qs[_0x3866('0x1b')](_0x6e5b1d[_0x3866('0x2d')]['offset']);}_0x3218cf[_0x3866('0x34')]=qs['sort'](_0x6e5b1d[_0x3866('0x2d')][_0x3866('0x35')]);_0x3218cf[_0x3866('0x36')]=qs['filters'](_[_0x3866('0x37')](_0x6e5b1d[_0x3866('0x2d')],_0x3cb2bd[_0x3866('0x2f')]),_0x2e29bc);if(_0x6e5b1d['query'][_0x3866('0x38')]){_0x3218cf[_0x3866('0x36')]=_[_0x3866('0x39')](_0x3218cf['where'],{'$or':_[_0x3866('0x3a')](_0x2e29bc,function(_0x5616d1){if(_0x5616d1[_0x3866('0x2a')]!=='VIRTUAL'){var _0x2fbeb0={};_0x2fbeb0[_0x5616d1['name']]={'$like':'%'+_0x6e5b1d[_0x3866('0x2d')][_0x3866('0x38')]+'%'};return _0x2fbeb0;}})});}_0x3218cf=_[_0x3866('0x39')]({},_0x3218cf,_0x6e5b1d[_0x3866('0x3b')]);var _0x4b420c={'where':_0x3218cf[_0x3866('0x36')]};return db[_0x3866('0x27')][_0x3866('0x1d')](_0x4b420c)['then'](function(_0x1b889e){_0x1d3786[_0x3866('0x1d')]=_0x1b889e;if(_0x6e5b1d['query'][_0x3866('0x3c')]){_0x3218cf['include']=[{'all':!![]}];}return db[_0x3866('0x27')][_0x3866('0x3d')](_0x3218cf);})[_0x3866('0x23')](function(_0x3a8ff2){_0x1d3786[_0x3866('0x3e')]=_0x3a8ff2;return _0x1d3786;})['then'](respondWithFilteredResult(_0x5b8a5d,_0x3218cf))[_0x3866('0x3f')](handleError(_0x5b8a5d,null));};exports['show']=function(_0x154f82,_0x58a8e6){var _0x20588b={'raw':!![],'where':{'id':_0x154f82[_0x3866('0x40')]['id']}},_0x4af3c5={};_0x4af3c5[_0x3866('0x2b')]=_[_0x3866('0x2e')](db[_0x3866('0x27')][_0x3866('0x28')]);_0x4af3c5['query']=_[_0x3866('0x2e')](_0x154f82[_0x3866('0x2d')]);_0x4af3c5[_0x3866('0x2f')]=_[_0x3866('0x30')](_0x4af3c5[_0x3866('0x2b')],_0x4af3c5['query']);_0x20588b['attributes']=_['intersection'](_0x4af3c5[_0x3866('0x2b')],qs['fields'](_0x154f82['query'][_0x3866('0x32')]));_0x20588b[_0x3866('0x31')]=_0x20588b[_0x3866('0x31')]['length']?_0x20588b[_0x3866('0x31')]:_0x4af3c5[_0x3866('0x2b')];if(_0x154f82[_0x3866('0x2d')][_0x3866('0x3c')]){_0x20588b[_0x3866('0x41')]=[{'all':!![]}];}_0x20588b=_['merge']({},_0x20588b,_0x154f82['options']);return db[_0x3866('0x27')][_0x3866('0x42')](_0x20588b)[_0x3866('0x23')](handleEntityNotFound(_0x58a8e6,null))['then'](respondWithResult(_0x58a8e6,null))[_0x3866('0x3f')](handleError(_0x58a8e6,null));};exports[_0x3866('0x43')]=function(_0x5610c1,_0x59bdea){if(_0x5610c1[_0x3866('0x44')]['id']){delete _0x5610c1['body']['id'];}return db[_0x3866('0x27')][_0x3866('0x42')]({'where':{'id':_0x5610c1[_0x3866('0x40')]['id']}})[_0x3866('0x23')](handleEntityNotFound(_0x59bdea,null))['then'](saveUpdates(_0x5610c1[_0x3866('0x44')],null))['then'](respondWithResult(_0x59bdea,null))['catch'](handleError(_0x59bdea,null));};exports[_0x3866('0x45')]=function(_0x29819c,_0x1ffce6){return db[_0x3866('0x27')][_0x3866('0x42')]({'where':{'id':_0x29819c[_0x3866('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ffce6,null))[_0x3866('0x23')](removeEntity(_0x1ffce6,null))['catch'](handleError(_0x1ffce6,null));};exports['create']=function(_0x4db8fb,_0x3819cb){var _0x48d513;return db[_0x3866('0x46')]['transaction'](function(_0xd25f36){return db[_0x3866('0x27')][_0x3866('0x47')](_0x4db8fb[_0x3866('0x44')],{'transaction':_0xd25f36})[_0x3866('0x23')](function(_0x14a077){_0x48d513=_0x14a077;var _0x522f0b={'type':db[_0x3866('0x48')]['TEXT'],'transaction':_0xd25f36};switch(_0x4db8fb[_0x3866('0x44')][_0x3866('0x2a')]){case _0x3866('0x49'):_0x522f0b[_0x3866('0x2a')]=db[_0x3866('0x48')][_0x3866('0x4a')];break;case _0x3866('0x4b'):_0x522f0b[_0x3866('0x2a')]=db['Sequelize'][_0x3866('0x4c')];break;case _0x3866('0x4d'):_0x522f0b[_0x3866('0x2a')]=db[_0x3866('0x48')][_0x3866('0x4e')];_0x522f0b['defaultValue']=![];break;default:}return db[_0x3866('0x46')]['queryInterface'][_0x3866('0x4f')](_0x3866('0x50'),util[_0x3866('0x51')](_0x3866('0x52'),_0x48d513['id']),_0x522f0b);})[_0x3866('0x23')](function(){return _0x48d513;});})['then'](respondWithResult(_0x3819cb,0xc9))['catch'](handleError(_0x3819cb,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 695618b..21fa9a6 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 _0xd79f=['exports','define','CmCustomField','cm_custom_fields','util','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd79f,0x1e1));var _0xfd79=function(_0x37bf8e,_0xb7dc10){_0x37bf8e=_0x37bf8e-0x0;var _0x55596f=_0xd79f[_0x37bf8e];return _0x55596f;};'use strict';var _=require('lodash');var util=require(_0xfd79('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd79('0x1'));var fs=require('fs');var path=require(_0xfd79('0x2'));var rimraf=require(_0xfd79('0x3'));var config=require(_0xfd79('0x4'));var attributes=require('./cmCustomField.attributes');module[_0xfd79('0x5')]=function(_0x137b80,_0x2fcc8b){return _0x137b80[_0xfd79('0x6')](_0xfd79('0x7'),attributes,{'tableName':_0xfd79('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dc4=['define','CmCustomField','cm_custom_fields','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x9dc4,0xcf));var _0x49dc=function(_0x4fad90,_0x1b6fee){_0x4fad90=_0x4fad90-0x0;var _0x4036be=_0x9dc4[_0x4fad90];return _0x4036be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49dc('0x0'))(_0x49dc('0x1'));var moment=require('moment');var BPromise=require(_0x49dc('0x2'));var rp=require(_0x49dc('0x3'));var fs=require('fs');var path=require(_0x49dc('0x4'));var rimraf=require(_0x49dc('0x5'));var config=require(_0x49dc('0x6'));var attributes=require(_0x49dc('0x7'));module[_0x49dc('0x8')]=function(_0x338e89,_0x3fa352){return _0x338e89[_0x49dc('0x9')](_0x49dc('0xa'),attributes,{'tableName':_0x49dc('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 82079b0..367ebb7 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 _0xe490=['CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe490,0x7b));var _0x0e49=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe490[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0e49('0x0'));var util=require(_0x0e49('0x1'));var moment=require(_0x0e49('0x2'));var BPromise=require(_0x0e49('0x3'));var rs=require(_0x0e49('0x4'));var fs=require('fs');var Redis=require(_0x0e49('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e49('0x6'))(_0x0e49('0x7'));var config=require(_0x0e49('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0e49('0x9')][_0x0e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56cce3,_0x4dddd8,_0xc8e972){return new BPromise(function(_0x3ec524,_0x41a561){return client[_0x0e49('0xb')](_0x56cce3,_0xc8e972)[_0x0e49('0xc')](function(_0x5df156){logger['info'](_0x0e49('0xd'),_0x4dddd8,'request\x20sent');logger[_0x0e49('0xe')](_0x0e49('0xf'),_0x4dddd8,_0x0e49('0x10'),JSON[_0x0e49('0x11')](_0x5df156));if(_0x5df156[_0x0e49('0x12')]){if(_0x5df156[_0x0e49('0x12')]['code']===0x1f4){logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x5df156[_0x0e49('0x12')]['message']);return _0x41a561(_0x5df156['error'][_0x0e49('0x13')]);}logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x5df156[_0x0e49('0x12')]['message']);return _0x3ec524(_0x5df156['error'][_0x0e49('0x13')]);}else{logger[_0x0e49('0x14')](_0x0e49('0xd'),_0x4dddd8,_0x0e49('0x10'));_0x3ec524(_0x5df156[_0x0e49('0x15')][_0x0e49('0x13')]);}})[_0x0e49('0x16')](function(_0x178360){logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x178360);_0x41a561(_0x178360);});});} \ No newline at end of file +var _0x0a53=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x3951ff,_0x4a06e0){var _0x487314=function(_0xc20496){while(--_0xc20496){_0x3951ff['push'](_0x3951ff['shift']());}};_0x487314(++_0x4a06e0);}(_0x0a53,0x189));var _0x30a5=function(_0xc37c8,_0x182df1){_0xc37c8=_0xc37c8-0x0;var _0x77188f=_0x0a53[_0xc37c8];return _0x77188f;};'use strict';var _=require(_0x30a5('0x0'));var util=require(_0x30a5('0x1'));var moment=require('moment');var BPromise=require(_0x30a5('0x2'));var rs=require(_0x30a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30a5('0x4'))['db'];var utils=require(_0x30a5('0x5'));var logger=require(_0x30a5('0x6'))(_0x30a5('0x7'));var config=require(_0x30a5('0x8'));var jayson=require(_0x30a5('0x9'));var client=jayson[_0x30a5('0xa')][_0x30a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x703347,_0x49014a,_0x355f6c){return new BPromise(function(_0xd8b20c,_0x3721d4){return client['request'](_0x703347,_0x355f6c)[_0x30a5('0xc')](function(_0x2b1f21){logger['info'](_0x30a5('0xd'),_0x49014a,'request\x20sent');logger[_0x30a5('0xe')](_0x30a5('0xf'),_0x49014a,'request\x20sent',JSON[_0x30a5('0x10')](_0x2b1f21));if(_0x2b1f21[_0x30a5('0x11')]){if(_0x2b1f21[_0x30a5('0x11')][_0x30a5('0x12')]===0x1f4){logger[_0x30a5('0x11')](_0x30a5('0xd'),_0x49014a,_0x2b1f21[_0x30a5('0x11')][_0x30a5('0x13')]);return _0x3721d4(_0x2b1f21[_0x30a5('0x11')][_0x30a5('0x13')]);}logger['error'](_0x30a5('0xd'),_0x49014a,_0x2b1f21[_0x30a5('0x11')]['message']);return _0xd8b20c(_0x2b1f21[_0x30a5('0x11')]['message']);}else{logger[_0x30a5('0x14')]('CmCustomField,\x20%s,\x20%s',_0x49014a,_0x30a5('0x15'));_0xd8b20c(_0x2b1f21[_0x30a5('0x16')][_0x30a5('0x13')]);}})[_0x30a5('0x17')](function(_0x43e308){logger[_0x30a5('0x11')]('CmCustomField,\x20%s,\x20%s',_0x49014a,_0x43e308);_0x3721d4(_0x43e308);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 26b0669..6905708 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 _0x106f=['express','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x3f29df,_0x211940){var _0x17a91b=function(_0xebc4dd){while(--_0xebc4dd){_0x3f29df['push'](_0x3f29df['shift']());}};_0x17a91b(++_0x211940);}(_0x106f,0x162));var _0xf106=function(_0x39ac2d,_0x22848f){_0x39ac2d=_0x39ac2d-0x0;var _0x2c1be0=_0x106f[_0x39ac2d];return _0x2c1be0;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var fs_extra=require(_0xf106('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var controller=require(_0xf106('0x7'));router[_0xf106('0x8')]('/',auth[_0xf106('0x9')](),controller[_0xf106('0xa')]);router[_0xf106('0x8')]('/:id',auth[_0xf106('0x9')](),controller[_0xf106('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf106('0x9')](),controller[_0xf106('0xc')]);router[_0xf106('0xd')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0xf')]);module[_0xf106('0x10')]=router; \ No newline at end of file +var _0x5b7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x2ba0aa,_0xdff044){_0x2ba0aa=_0x2ba0aa-0x0;var _0x8de7fd=_0x5b7f[_0x2ba0aa];return _0x8de7fd;};'use strict';var multer=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var path=require(_0xf5b7('0x2'));var timeout=require(_0xf5b7('0x3'));var express=require(_0xf5b7('0x4'));var router=express[_0xf5b7('0x5')]();var fs_extra=require(_0xf5b7('0x6'));var auth=require(_0xf5b7('0x7'));var interaction=require(_0xf5b7('0x8'));var config=require(_0xf5b7('0x9'));var controller=require(_0xf5b7('0xa'));router[_0xf5b7('0xb')]('/',auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xd')]);router[_0xf5b7('0xb')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf5b7('0x10')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x11')]);router[_0xf5b7('0x12')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x13')]);module[_0xf5b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 13eb53b..78695a8 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 _0xee96=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e53f8,_0x1c6895){var _0x49f0db=function(_0x3031eb){while(--_0x3031eb){_0x3e53f8['push'](_0x3e53f8['shift']());}};_0x49f0db(++_0x1c6895);}(_0xee96,0xc9));var _0x6ee9=function(_0x5908d7,_0x22cb37){_0x5908d7=_0x5908d7-0x0;var _0x4585c4=_0xee96[_0x5908d7];return _0x4585c4;};'use strict';var moment=require(_0x6ee9('0x0'));var Sequelize=require(_0x6ee9('0x1'));module[_0x6ee9('0x2')]={'phone':{'type':Sequelize[_0x6ee9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6ee9('0x5')],'defaultValue':moment()[_0x6ee9('0x6')](_0x6ee9('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6ee9('0x5')]},'priority':{'type':Sequelize[_0x6ee9('0x8')](0x2)[_0x6ee9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6ee9('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6ee9('0x8')],'unique':_0x6ee9('0xa')},'UserId':{'type':Sequelize[_0x6ee9('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x6ee9('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x6ee9('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6ee9('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6ee9('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8cbf=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x1606c9,_0x2663d2){var _0x5b4043=function(_0x4433b6){while(--_0x4433b6){_0x1606c9['push'](_0x1606c9['shift']());}};_0x5b4043(++_0x2663d2);}(_0x8cbf,0x17e));var _0xf8cb=function(_0x1d9532,_0x5d076c){_0x1d9532=_0x1d9532-0x0;var _0xef0eef=_0x8cbf[_0x1d9532];return _0xef0eef;};'use strict';var moment=require(_0xf8cb('0x0'));var Sequelize=require(_0xf8cb('0x1'));module[_0xf8cb('0x2')]={'phone':{'type':Sequelize[_0xf8cb('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf8cb('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf8cb('0x5')],'defaultValue':moment()['format'](_0xf8cb('0x6'))},'countbusyretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xf8cb('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf8cb('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf8cb('0x7')],'unique':_0xf8cb('0x8')},'ListId':{'type':Sequelize[_0xf8cb('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xf8cb('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xf8cb('0x7')],'unique':_0xf8cb('0x8')},'CampaignId':{'type':Sequelize[_0xf8cb('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8cb('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf8cb('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8cb('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf8cb('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 35d5fef..e61adc3 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 _0x0bde=['moment','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','map','value','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','findOne','LOCK','CmCompany','CmList','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xe0bd('0x0'));var _=require('lodash');var qs=require(_0xe0bd('0x1'));var logger=require(_0xe0bd('0x2'))('api');var shared=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];function respondWithResult(_0x2294a7,_0x595deb){_0x595deb=_0x595deb||0xc8;return function(_0x95dfde){if(_0x95dfde){return _0x2294a7[_0xe0bd('0x5')](_0x595deb)[_0xe0bd('0x6')](_0x95dfde);}};}function respondWithFilteredResult(_0x3a3cd2,_0x37289f){return function(_0x1c8892){if(_0x1c8892){var _0x29faee=typeof _0x37289f[_0xe0bd('0x7')]===_0xe0bd('0x8')&&typeof _0x37289f[_0xe0bd('0x9')]===_0xe0bd('0x8');var _0x3c2ee1=_0x1c8892[_0xe0bd('0xa')];var _0x589149=_0x29faee?0x0:_0x37289f[_0xe0bd('0x7')];var _0x235122=_0x29faee?_0x1c8892['count']:_0x37289f[_0xe0bd('0x7')]+_0x37289f['limit'];var _0x175f8a;if(_0x235122>=_0x3c2ee1){_0x235122=_0x3c2ee1;_0x175f8a=0xc8;}else{_0x175f8a=0xce;}_0x3a3cd2[_0xe0bd('0x5')](_0x175f8a);return _0x3a3cd2[_0xe0bd('0xb')](_0xe0bd('0xc'),_0x589149+'-'+_0x235122+'/'+_0x3c2ee1)[_0xe0bd('0x6')](_0x1c8892);}return null;};}function saveUpdates(_0x16c3a9,_0x1905b2){return function(_0x500a9e){if(_0x500a9e){return _0x500a9e[_0xe0bd('0xd')](_0x16c3a9)[_0xe0bd('0xe')](function(_0x3dfc72){return _0x3dfc72;});}return null;};}function handleEntityNotFound(_0x5c76f1,_0x479438){return function(_0x48afde){if(!_0x48afde){_0x5c76f1[_0xe0bd('0xf')](0x194);}return _0x48afde;};}function handleError(_0x234c34,_0x3f5ef7){_0x3f5ef7=_0x3f5ef7||0x1f4;return function(_0x3042e1){logger[_0xe0bd('0x10')](_0x3042e1[_0xe0bd('0x11')]);if(_0x3042e1[_0xe0bd('0x12')]){delete _0x3042e1[_0xe0bd('0x12')];}_0x234c34['status'](_0x3f5ef7)['send'](_0x3042e1);};}exports[_0xe0bd('0x13')]=function(_0xd8746d,_0x1c4533){var _0x100b8f={},_0xa6be32={},_0x2a015c={'count':0x0,'rows':[]};var _0x5b23de=_['map'](db[_0xe0bd('0x14')][_0xe0bd('0x15')],function(_0x1187cf){return{'name':_0x1187cf[_0xe0bd('0x16')],'type':_0x1187cf[_0xe0bd('0x17')][_0xe0bd('0x18')]};});_0xa6be32[_0xe0bd('0x19')]=_['map'](_0x5b23de,'name');_0xa6be32[_0xe0bd('0x1a')]=_[_0xe0bd('0x1b')](_0xd8746d[_0xe0bd('0x1a')]);_0xa6be32[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0xa6be32['model'],_0xa6be32[_0xe0bd('0x1a')]);_0xa6be32['filters']=_[_0xe0bd('0x1e')](_0xa6be32[_0xe0bd('0x1c')],[_0xe0bd('0x1f'),'$or',_0xe0bd('0x20'),_0xe0bd('0x21'),'$lt',_0xe0bd('0x22'),'$ne',_0xe0bd('0x23'),'$not',_0xe0bd('0x24'),_0xe0bd('0x25'),_0xe0bd('0x26'),'$notIn',_0xe0bd('0x27'),'$notLike',_0xe0bd('0x28'),_0xe0bd('0x29'),'$like','$overlap',_0xe0bd('0x2a'),_0xe0bd('0x2b'),_0xe0bd('0x2c')]);_0x100b8f[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0xa6be32[_0xe0bd('0x19')],qs[_0xe0bd('0x2e')](_0xd8746d['query'][_0xe0bd('0x2e')]));_0x100b8f[_0xe0bd('0x2d')]=_0x100b8f[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x100b8f[_0xe0bd('0x2d')]:_0xa6be32[_0xe0bd('0x19')];if(!_0xd8746d['query'][_0xe0bd('0x30')](_0xe0bd('0x31'))){_0x100b8f[_0xe0bd('0x9')]=qs[_0xe0bd('0x9')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x9')]);_0x100b8f[_0xe0bd('0x7')]=qs[_0xe0bd('0x7')](_0xd8746d['query']['offset']);}_0x100b8f[_0xe0bd('0x32')]=qs[_0xe0bd('0x33')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x33')]);_0x100b8f[_0xe0bd('0x34')]=qs['filters'](_['pick'](_0xd8746d['query'],_0xa6be32[_0xe0bd('0x1c')]),_0x5b23de);if(_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x35')]){_0x100b8f[_0xe0bd('0x34')]=_[_0xe0bd('0x36')](_0x100b8f[_0xe0bd('0x34')],{'$or':_['map'](_0x5b23de,function(_0x1304d2){if(_0x1304d2[_0xe0bd('0x17')]!==_0xe0bd('0x37')){var _0x4e9272={};_0x4e9272[_0x1304d2[_0xe0bd('0x12')]]={'$like':'%'+_0xd8746d[_0xe0bd('0x1a')]['filter']+'%'};return _0x4e9272;}})});}_0x100b8f=_[_0xe0bd('0x36')]({},_0x100b8f,_0xd8746d[_0xe0bd('0x38')]);var _0x406b41={'where':_0x100b8f['where']};return db[_0xe0bd('0x14')]['count'](_0x406b41)[_0xe0bd('0xe')](function(_0x37a8b9){_0x2a015c[_0xe0bd('0xa')]=_0x37a8b9;if(_0xd8746d[_0xe0bd('0x1a')]['includeAll']){_0x100b8f[_0xe0bd('0x39')]=[{'all':!![]}];}return db[_0xe0bd('0x14')][_0xe0bd('0x3a')](_0x100b8f);})['then'](function(_0x54170b){_0x2a015c[_0xe0bd('0x3b')]=_0x54170b;return _0x2a015c;})[_0xe0bd('0xe')](respondWithFilteredResult(_0x1c4533,_0x100b8f))[_0xe0bd('0x3c')](handleError(_0x1c4533,null));};exports['show']=function(_0x5cc98d,_0x42a725){var _0x383b08={'raw':!![],'where':{'id':_0x5cc98d[_0xe0bd('0x3d')]['id']}},_0x324bb2={};_0x324bb2['model']=_[_0xe0bd('0x1b')](db[_0xe0bd('0x14')][_0xe0bd('0x15')]);_0x324bb2['query']=_['keys'](_0x5cc98d[_0xe0bd('0x1a')]);_0x324bb2[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],_0x324bb2['query']);_0x383b08[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],qs['fields'](_0x5cc98d['query'][_0xe0bd('0x2e')]));_0x383b08['attributes']=_0x383b08[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x383b08['attributes']:_0x324bb2[_0xe0bd('0x19')];if(_0x5cc98d[_0xe0bd('0x1a')][_0xe0bd('0x3e')]){_0x383b08['include']=[{'all':!![]}];}_0x383b08=_[_0xe0bd('0x36')]({},_0x383b08,_0x5cc98d[_0xe0bd('0x38')]);return db[_0xe0bd('0x14')][_0xe0bd('0x3f')](_0x383b08)[_0xe0bd('0xe')](handleEntityNotFound(_0x42a725,null))[_0xe0bd('0xe')](respondWithResult(_0x42a725,null))[_0xe0bd('0x3c')](handleError(_0x42a725,null));};exports[_0xe0bd('0x40')]=function(_0x5a02f9,_0x9505be){return db[_0xe0bd('0x14')][_0xe0bd('0x40')](_0x5a02f9[_0xe0bd('0x41')],{})[_0xe0bd('0xe')](respondWithResult(_0x9505be,0xc9))[_0xe0bd('0x3c')](handleError(_0x9505be,null));};exports[_0xe0bd('0xd')]=function(_0x5399b3,_0x59d38a){if(_0x5399b3[_0xe0bd('0x41')]['id']){delete _0x5399b3[_0xe0bd('0x41')]['id'];}return db[_0xe0bd('0x14')][_0xe0bd('0x3f')]({'where':{'id':_0x5399b3[_0xe0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59d38a,null))[_0xe0bd('0xe')](saveUpdates(_0x5399b3['body'],null))['then'](respondWithResult(_0x59d38a,null))['catch'](handleError(_0x59d38a,null));};exports[_0xe0bd('0x42')]=function(_0x55dd83,_0x545cfb){return db[_0xe0bd('0x14')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](respondWithResult(_0x545cfb,null))[_0xe0bd('0x3c')](handleError(_0x545cfb,null));};exports[_0xe0bd('0x43')]=function(_0x220147,_0xe2b989){var _0x1c4464;var _0x137bed=_0x220147[_0xe0bd('0x3d')]['id'];return db['CmHopper'][_0xe0bd('0x3f')]({'where':{'id':_0x220147['params']['id']}})['then'](handleEntityNotFound(_0xe2b989,null))[_0xe0bd('0xe')](function(_0x292296){if(_0x292296){return _0x292296[_0xe0bd('0x43')]()['then'](function(_0x281a60){return _0x281a60;});}})[_0xe0bd('0xe')](function(_0x2ace8e){_0x1c4464=_0x2ace8e;if(_0x2ace8e){if(_0x2ace8e[_0xe0bd('0x44')]||_0x2ace8e[_0xe0bd('0x45')]){return db[_0x2ace8e[_0xe0bd('0x44')]?_0xe0bd('0x46'):_0xe0bd('0x47')][_0xe0bd('0x3f')]({'where':{'id':_0x2ace8e[_0xe0bd('0x44')]?_0x2ace8e[_0xe0bd('0x44')]:_0x2ace8e[_0xe0bd('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0xe0bd('0xe')](function(_0xa761ae){var _0x530338={};if(_0xa761ae){_['merge'](_0x530338,_['omit'](_0x1c4464[_0xe0bd('0x48')],['createdAt','updatedAt','id']));_0x530338['state']=0x15;_0x530338[_0xe0bd('0x49')]=_0xe0bd('0x4a');_0x530338[_0xe0bd('0x4b')]=_0xa761ae[_0xe0bd('0x12')];_0x530338['membername']=_0x220147[_0xe0bd('0x4c')]['name'];_0x530338[_0xe0bd('0x4d')]=_0x220147[_0xe0bd('0x4c')]['id'];_0x530338[_0xe0bd('0x4a')]=!![];_0x530338[_0xe0bd('0x4e')]=moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'));_0x530338[_0xe0bd('0x51')]=_0x1c4464[_0xe0bd('0x52')];_0x530338[_0xe0bd('0x53')]=_0x1c4464[_0xe0bd('0x44')]?_0xe0bd('0x54'):_0xe0bd('0x55');return db[_0xe0bd('0x56')]['find']({'where':{'id':_0x530338[_0xe0bd('0x57')]},'attributes':['firstName',_0xe0bd('0x58')]})[_0xe0bd('0xe')](function(_0x302bae){if(!_[_0xe0bd('0x59')](_0xe2b989)&&!_[_0xe0bd('0x59')](_0x302bae[_0xe0bd('0x5a')])){_0x530338[_0xe0bd('0x5b')]=_0x302bae[_0xe0bd('0x5a')];if(!_[_0xe0bd('0x59')](_0x302bae['lastName'])){_0x530338['calleridname']+='\x20'+_0x302bae['lastName'];}}})[_0xe0bd('0x5c')](function(){return db[_0xe0bd('0x5d')][_0xe0bd('0x40')](_0x530338);});}})[_0xe0bd('0xe')](function(_0x3c12a2){return db[_0xe0bd('0x5e')][_0xe0bd('0x43')]({'where':{'CmHopperId':_0x137bed}});})[_0xe0bd('0xe')](function(){return _0xe2b989[_0xe0bd('0x5')](0xcc)['end']();})[_0xe0bd('0x3c')](handleError(_0xe2b989,null));};exports['getPreview']=function(_0x5f0226,_0x36fb12){var _0x38dfae=[];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x36f315){_0x38dfae=_[_0xe0bd('0x1b')](_0x36f315);return _0x5f0226['user'][_0xe0bd('0x5f')]({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id','dialOrderByScheduledAt',_0xe0bd('0x62')],'raw':!![]});})[_0xe0bd('0xe')](function(_0x593e24){if(_0x593e24&&_0x593e24[_0xe0bd('0x2f')]){return db[_0xe0bd('0x63')][_0xe0bd('0x64')](function(_0x26d6fc){var _0x5a43e0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x593e24,'id')},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x20a619={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x593e24)[_0xe0bd('0x35')]([_0xe0bd('0x62'),0x0])[_0xe0bd('0x65')]('id')[_0xe0bd('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x2ddfd4={'$or':[_0x5a43e0,_0x20a619]};var _0xcd835d=[];if(_0x5f0226['body'][_0xe0bd('0x67')]&&_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x67')]===_0xe0bd('0x68')){if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')])){_0x2ddfd4['id']={'$in':_0x5f0226['body'][_0xe0bd('0x6a')]};}_0xcd835d=[['priority',_0xe0bd('0x6b')],['scheduledAt',_0x593e24[0x0][_0xe0bd('0x6c')]===_0xe0bd('0x6b')?_0xe0bd('0x6d'):_0xe0bd('0x6b')],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x6f')),['id',_0xe0bd('0x6d')]];}else{if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')]['hopperIds'])){_0x2ddfd4['id']={'$notIn':_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')]};}_0xcd835d=[[_0xe0bd('0x70'),_0xe0bd('0x6d')],[_0xe0bd('0x71'),_0x593e24[0x0][_0xe0bd('0x6c')]],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x72')),['id',_0xe0bd('0x6b')]];}return db[_0xe0bd('0x14')]['findOne']({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x52'),_0xe0bd('0x74')],'where':_0x2ddfd4,'order':_0xcd835d,'transaction':_0x26d6fc,'lock':_0x26d6fc['LOCK'][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x38dfae,'include':[{'model':db['CmCompany'],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db['CmList'],'as':_0xe0bd('0x78'),'attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':_0xe0bd('0x79'),'attributes':['id','name','dialActive']}]})[_0xe0bd('0xe')](function(_0x4f2941){if(_0x4f2941){return _0x4f2941[_0xe0bd('0xd')]({'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']},{'transaction':_0x26d6fc});}});});}})[_0xe0bd('0xe')](handleEntityNotFound(_0x36fb12,null))[_0xe0bd('0xe')](respondWithResult(_0x36fb12,null))[_0xe0bd('0x3c')](handleError(_0x36fb12,null));};exports[_0xe0bd('0x7a')]=function(_0xcd7424,_0x4b0bd7,_0xa3b019){var _0x1b982d=[];var _0x379195=_0xcd7424['params']['id'];var _0x5be09e=_0xcd7424['user']['id'];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x12dd0c){_0x1b982d=_[_0xe0bd('0x1b')](_0x12dd0c);return db[_0xe0bd('0x63')]['transaction'](function(_0x7bd607){const _0x47a2d8={'id':_0x379195};return db['CmHopper'][_0xe0bd('0x7b')]({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x74')],'where':_0x47a2d8,'transaction':_0x7bd607,'lock':_0x7bd607[_0xe0bd('0x7c')][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x1b982d,'include':[{'model':db[_0xe0bd('0x7d')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db[_0xe0bd('0x7e')],'as':'List','attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':'Queue','attributes':['id',_0xe0bd('0x12'),_0xe0bd('0x7f')]}]})['then'](function(_0x536021){if(_0x536021){return _0x536021[_0xe0bd('0xd')]({'UserId':_0x5be09e},{'transaction':_0x7bd607});}});});})[_0xe0bd('0xe')](handleEntityNotFound(_0x4b0bd7,null))[_0xe0bd('0xe')](respondWithResult(_0x4b0bd7,null))['catch'](handleError(_0x4b0bd7,null));};exports['getOpenContacts']=function(_0x4e2b01,_0x4b8928){return _0x4e2b01[_0xe0bd('0x4c')]['getVoiceQueues']({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x3a8d82){if(_0x3a8d82&&_0x3a8d82[_0xe0bd('0x2f')]){return db[_0xe0bd('0x14')][_0xe0bd('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x3a8d82,'id')},'$or':[{'UserId':null},{'UserId':_0x4e2b01[_0xe0bd('0x4c')]['id']}]}});}return 0x0;})[_0xe0bd('0xe')](function(_0xa1342d){if(!_['isNil'](_0xa1342d)&&_[_0xe0bd('0x80')](_0xa1342d)){return _0x4b8928[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'contacts':_0xa1342d});}else{logger['error'](_0xe0bd('0x81'),_0xe0bd('0x82'),0x194,_0xe0bd('0x83'));_0x4b8928['sendStatus'](0x194);}})[_0xe0bd('0x3c')](handleError(_0x4b8928,null));};exports[_0xe0bd('0x84')]=function(_0x4d611a,_0x458846){var _0xe90d7e=shared[_0xe0bd('0x85')];var _0xbec78a=[];_[_0xe0bd('0x65')](_0xe90d7e,function(_0x9ce5a8){_0xbec78a['push']({'id':_0x9ce5a8[_0xe0bd('0x12')],'name':_0x9ce5a8[_0xe0bd('0x12')],'utcOffset':_0x9ce5a8[_0xe0bd('0x86')]});});return _0x458846[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'tz':_0xbec78a});};exports[_0xe0bd('0x87')]=function(_0x51b263,_0x4394c7){var _0x59e087=shared[_0xe0bd('0x85')];var _0x43fea2={};if(!_['isNil'](_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']]))_0x43fea2=_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']];return _0x4394c7[_0xe0bd('0x5')](0xc8)['json'](_0x43fea2);}; \ No newline at end of file +var _0x8819=['dialActive','getPreviewRecall','transaction','findOne','CmCompany','List','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','sendStatus','stack','name','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','$and','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','body','update','describe','destroy','params','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','create','CmHopperAdditionalPhone','getPreview','CmContact','getVoiceQueues','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList'];(function(_0x29184b,_0xb55b72){var _0x2fefd9=function(_0x598549){while(--_0x598549){_0x29184b['push'](_0x29184b['shift']());}};_0x2fefd9(++_0xb55b72);}(_0x8819,0x94));var _0x9881=function(_0x38771b,_0x44d099){_0x38771b=_0x38771b-0x0;var _0x11ce53=_0x8819[_0x38771b];return _0x11ce53;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x9881('0x0'));var logger=require(_0x9881('0x1'))(_0x9881('0x2'));var shared=require(_0x9881('0x3'));var db=require(_0x9881('0x4'))['db'];function respondWithResult(_0x5e52c5,_0x333d6f){_0x333d6f=_0x333d6f||0xc8;return function(_0x446deb){if(_0x446deb){return _0x5e52c5[_0x9881('0x5')](_0x333d6f)[_0x9881('0x6')](_0x446deb);}};}function respondWithFilteredResult(_0x1791fd,_0x2a3664){return function(_0x5f1d45){if(_0x5f1d45){var _0x353966=typeof _0x2a3664['offset']==='undefined'&&typeof _0x2a3664[_0x9881('0x7')]==='undefined';var _0x5c2c0f=_0x5f1d45[_0x9881('0x8')];var _0x4adf62=_0x353966?0x0:_0x2a3664[_0x9881('0x9')];var _0x39122e=_0x353966?_0x5f1d45[_0x9881('0x8')]:_0x2a3664['offset']+_0x2a3664[_0x9881('0x7')];var _0x1327e8;if(_0x39122e>=_0x5c2c0f){_0x39122e=_0x5c2c0f;_0x1327e8=0xc8;}else{_0x1327e8=0xce;}_0x1791fd[_0x9881('0x5')](_0x1327e8);return _0x1791fd[_0x9881('0xa')]('Content-Range',_0x4adf62+'-'+_0x39122e+'/'+_0x5c2c0f)[_0x9881('0x6')](_0x5f1d45);}return null;};}function saveUpdates(_0x26ee3f,_0x5c6d2d){return function(_0x42850e){if(_0x42850e){return _0x42850e['update'](_0x26ee3f)['then'](function(_0x48cfe1){return _0x48cfe1;});}return null;};}function handleEntityNotFound(_0x58f526,_0x12794f){return function(_0x3178d7){if(!_0x3178d7){_0x58f526[_0x9881('0xb')](0x194);}return _0x3178d7;};}function handleError(_0x1947e8,_0x39d127){_0x39d127=_0x39d127||0x1f4;return function(_0x1d57ea){logger['error'](_0x1d57ea[_0x9881('0xc')]);if(_0x1d57ea[_0x9881('0xd')]){delete _0x1d57ea[_0x9881('0xd')];}_0x1947e8['status'](_0x39d127)['send'](_0x1d57ea);};}exports['index']=function(_0x280ea2,_0x4c3493){var _0x620a9a={},_0x5a9848={},_0x59ff56={'count':0x0,'rows':[]};var _0x1f6e20=_[_0x9881('0xe')](db[_0x9881('0xf')][_0x9881('0x10')],function(_0x43f8a2){return{'name':_0x43f8a2[_0x9881('0x11')],'type':_0x43f8a2[_0x9881('0x12')][_0x9881('0x13')]};});_0x5a9848[_0x9881('0x14')]=_[_0x9881('0xe')](_0x1f6e20,_0x9881('0xd'));_0x5a9848[_0x9881('0x15')]=_[_0x9881('0x16')](_0x280ea2[_0x9881('0x15')]);_0x5a9848[_0x9881('0x17')]=_['intersection'](_0x5a9848['model'],_0x5a9848[_0x9881('0x15')]);_0x5a9848['filters']=_['concat'](_0x5a9848[_0x9881('0x17')],[_0x9881('0x18'),'$or','$gt',_0x9881('0x19'),'$lt',_0x9881('0x1a'),_0x9881('0x1b'),_0x9881('0x1c'),_0x9881('0x1d'),_0x9881('0x1e'),_0x9881('0x1f'),_0x9881('0x20'),_0x9881('0x21'),_0x9881('0x22'),_0x9881('0x23'),_0x9881('0x24'),_0x9881('0x25'),_0x9881('0x22'),'$overlap',_0x9881('0x26'),_0x9881('0x27'),'$any']);_0x620a9a[_0x9881('0x28')]=_[_0x9881('0x29')](_0x5a9848['model'],qs[_0x9881('0x2a')](_0x280ea2[_0x9881('0x15')][_0x9881('0x2a')]));_0x620a9a[_0x9881('0x28')]=_0x620a9a[_0x9881('0x28')][_0x9881('0x2b')]?_0x620a9a[_0x9881('0x28')]:_0x5a9848[_0x9881('0x14')];if(!_0x280ea2['query'][_0x9881('0x2c')](_0x9881('0x2d'))){_0x620a9a[_0x9881('0x7')]=qs[_0x9881('0x7')](_0x280ea2[_0x9881('0x15')][_0x9881('0x7')]);_0x620a9a['offset']=qs[_0x9881('0x9')](_0x280ea2[_0x9881('0x15')]['offset']);}_0x620a9a[_0x9881('0x2e')]=qs[_0x9881('0x2f')](_0x280ea2[_0x9881('0x15')][_0x9881('0x2f')]);_0x620a9a[_0x9881('0x30')]=qs['filters'](_[_0x9881('0x31')](_0x280ea2[_0x9881('0x15')],_0x5a9848[_0x9881('0x17')]),_0x1f6e20);if(_0x280ea2[_0x9881('0x15')][_0x9881('0x32')]){_0x620a9a[_0x9881('0x30')]=_[_0x9881('0x33')](_0x620a9a[_0x9881('0x30')],{'$or':_[_0x9881('0xe')](_0x1f6e20,function(_0x26c829){if(_0x26c829[_0x9881('0x12')]!==_0x9881('0x34')){var _0xfff6a5={};_0xfff6a5[_0x26c829[_0x9881('0xd')]]={'$like':'%'+_0x280ea2[_0x9881('0x15')][_0x9881('0x32')]+'%'};return _0xfff6a5;}})});}_0x620a9a=_['merge']({},_0x620a9a,_0x280ea2[_0x9881('0x35')]);var _0x5f14d5={'where':_0x620a9a[_0x9881('0x30')]};return db['CmHopper'][_0x9881('0x8')](_0x5f14d5)[_0x9881('0x36')](function(_0x4c865e){_0x59ff56[_0x9881('0x8')]=_0x4c865e;if(_0x280ea2['query'][_0x9881('0x37')]){_0x620a9a[_0x9881('0x38')]=[{'all':!![]}];}return db[_0x9881('0xf')][_0x9881('0x39')](_0x620a9a);})['then'](function(_0x2b2a0b){_0x59ff56[_0x9881('0x3a')]=_0x2b2a0b;return _0x59ff56;})[_0x9881('0x36')](respondWithFilteredResult(_0x4c3493,_0x620a9a))[_0x9881('0x3b')](handleError(_0x4c3493,null));};exports[_0x9881('0x3c')]=function(_0x201dcd,_0x100139){var _0x4feb70={'raw':!![],'where':{'id':_0x201dcd['params']['id']}},_0x3f25db={};_0x3f25db[_0x9881('0x14')]=_[_0x9881('0x16')](db[_0x9881('0xf')]['rawAttributes']);_0x3f25db[_0x9881('0x15')]=_[_0x9881('0x16')](_0x201dcd[_0x9881('0x15')]);_0x3f25db['filters']=_[_0x9881('0x29')](_0x3f25db[_0x9881('0x14')],_0x3f25db['query']);_0x4feb70[_0x9881('0x28')]=_[_0x9881('0x29')](_0x3f25db[_0x9881('0x14')],qs[_0x9881('0x2a')](_0x201dcd[_0x9881('0x15')][_0x9881('0x2a')]));_0x4feb70[_0x9881('0x28')]=_0x4feb70[_0x9881('0x28')][_0x9881('0x2b')]?_0x4feb70[_0x9881('0x28')]:_0x3f25db['model'];if(_0x201dcd[_0x9881('0x15')][_0x9881('0x37')]){_0x4feb70[_0x9881('0x38')]=[{'all':!![]}];}_0x4feb70=_[_0x9881('0x33')]({},_0x4feb70,_0x201dcd[_0x9881('0x35')]);return db['CmHopper'][_0x9881('0x3d')](_0x4feb70)[_0x9881('0x36')](handleEntityNotFound(_0x100139,null))[_0x9881('0x36')](respondWithResult(_0x100139,null))[_0x9881('0x3b')](handleError(_0x100139,null));};exports['create']=function(_0x28f0c0,_0xc9713c){return db[_0x9881('0xf')]['create'](_0x28f0c0[_0x9881('0x3e')],{})[_0x9881('0x36')](respondWithResult(_0xc9713c,0xc9))[_0x9881('0x3b')](handleError(_0xc9713c,null));};exports[_0x9881('0x3f')]=function(_0x193c45,_0x391777){if(_0x193c45[_0x9881('0x3e')]['id']){delete _0x193c45[_0x9881('0x3e')]['id'];}return db[_0x9881('0xf')][_0x9881('0x3d')]({'where':{'id':_0x193c45['params']['id']}})[_0x9881('0x36')](handleEntityNotFound(_0x391777,null))[_0x9881('0x36')](saveUpdates(_0x193c45[_0x9881('0x3e')],null))['then'](respondWithResult(_0x391777,null))[_0x9881('0x3b')](handleError(_0x391777,null));};exports[_0x9881('0x40')]=function(_0x1e1f0f,_0x573b4f){return db['CmHopper'][_0x9881('0x40')]()[_0x9881('0x36')](respondWithResult(_0x573b4f,null))[_0x9881('0x3b')](handleError(_0x573b4f,null));};exports[_0x9881('0x41')]=function(_0x49c478,_0x514263){var _0x3689d7;var _0x355357=_0x49c478[_0x9881('0x42')]['id'];return db['CmHopper'][_0x9881('0x3d')]({'where':{'id':_0x49c478[_0x9881('0x42')]['id']}})['then'](handleEntityNotFound(_0x514263,null))[_0x9881('0x36')](function(_0x262b8b){if(_0x262b8b){return _0x262b8b[_0x9881('0x41')]()[_0x9881('0x36')](function(_0x21720a){return _0x21720a;});}})[_0x9881('0x36')](function(_0x43f17d){_0x3689d7=_0x43f17d;if(_0x43f17d){if(_0x43f17d['VoiceQueueId']||_0x43f17d[_0x9881('0x43')]){return db[_0x43f17d['VoiceQueueId']?_0x9881('0x44'):_0x9881('0x45')][_0x9881('0x3d')]({'where':{'id':_0x43f17d[_0x9881('0x46')]?_0x43f17d['VoiceQueueId']:_0x43f17d['CampaignId']},'attributes':['id',_0x9881('0xd')],'raw':!![]});}}})[_0x9881('0x36')](function(_0x2fdba2){var _0x49d8b6={};if(_0x2fdba2){_[_0x9881('0x33')](_0x49d8b6,_[_0x9881('0x47')](_0x3689d7[_0x9881('0x48')],[_0x9881('0x49'),_0x9881('0x4a'),'id']));_0x49d8b6[_0x9881('0x4b')]=0x15;_0x49d8b6['statedesc']=_0x9881('0x4c');_0x49d8b6[_0x9881('0x4d')]=_0x2fdba2[_0x9881('0xd')];_0x49d8b6[_0x9881('0x4e')]=_0x49c478[_0x9881('0x4f')]['name'];_0x49d8b6['UserId']=_0x49c478['user']['id'];_0x49d8b6[_0x9881('0x4c')]=!![];_0x49d8b6[_0x9881('0x50')]=moment()[_0x9881('0x51')](_0x9881('0x52'));_0x49d8b6[_0x9881('0x53')]=_0x3689d7[_0x9881('0x54')];_0x49d8b6['campaigntype']=_0x3689d7['VoiceQueueId']?_0x9881('0x55'):_0x9881('0x56');return db['CmContact'][_0x9881('0x3d')]({'where':{'id':_0x49d8b6[_0x9881('0x57')]},'attributes':[_0x9881('0x58'),_0x9881('0x59')]})['then'](function(_0x3efda3){if(!_['isNil'](_0x514263)&&!_[_0x9881('0x5a')](_0x3efda3[_0x9881('0x58')])){_0x49d8b6[_0x9881('0x5b')]=_0x3efda3['firstName'];if(!_['isNil'](_0x3efda3['lastName'])){_0x49d8b6[_0x9881('0x5b')]+='\x20'+_0x3efda3[_0x9881('0x59')];}}})['finally'](function(){return db[_0x9881('0x5c')][_0x9881('0x5d')](_0x49d8b6);});}})[_0x9881('0x36')](function(_0x165274){return db[_0x9881('0x5e')][_0x9881('0x41')]({'where':{'CmHopperId':_0x355357}});})[_0x9881('0x36')](function(){return _0x514263[_0x9881('0x5')](0xcc)['end']();})['catch'](handleError(_0x514263,null));};exports[_0x9881('0x5f')]=function(_0x4012d9,_0xb9d0ac){var _0x12f6eb=[];return db[_0x9881('0x60')][_0x9881('0x40')]()['then'](function(_0x438a14){_0x12f6eb=_[_0x9881('0x16')](_0x438a14);return _0x4012d9[_0x9881('0x4f')][_0x9881('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x9881('0x62')},'attributes':['id','dialOrderByScheduledAt',_0x9881('0x63')],'raw':!![]});})[_0x9881('0x36')](function(_0xc1fd9b){if(_0xc1fd9b&&_0xc1fd9b[_0x9881('0x2b')]){return db['sequelize']['transaction'](function(_0x23f6cf){var _0x5d218e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9881('0x52'))},'VoiceQueueId':{'$in':_[_0x9881('0xe')](_0xc1fd9b,'id')},'$or':[{'UserId':null},{'UserId':_0x4012d9[_0x9881('0x4f')]['id']}]};var _0x4b5491={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xc1fd9b)[_0x9881('0x32')]([_0x9881('0x63'),0x0])['map']('id')[_0x9881('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x4012d9[_0x9881('0x4f')]['id']}]};var _0x4d5ea0={'$or':[_0x5d218e,_0x4b5491]};var _0x21503c=[];if(_0x4012d9['body'][_0x9881('0x65')]&&_0x4012d9[_0x9881('0x3e')][_0x9881('0x65')]===_0x9881('0x66')){if(!_[_0x9881('0x67')](_0x4012d9[_0x9881('0x3e')]['hopperIds'])){_0x4d5ea0['id']={'$in':_0x4012d9[_0x9881('0x3e')][_0x9881('0x68')]};}_0x21503c=[[_0x9881('0x69'),_0x9881('0x6a')],[_0x9881('0x6b'),_0xc1fd9b[0x0][_0x9881('0x6c')]===_0x9881('0x6a')?_0x9881('0x6d'):_0x9881('0x6a')],db[_0x9881('0x6e')][_0x9881('0x6f')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x9881('0x6d')]];}else{if(!_[_0x9881('0x67')](_0x4012d9['body'][_0x9881('0x68')])){_0x4d5ea0['id']={'$notIn':_0x4012d9[_0x9881('0x3e')]['hopperIds']};}_0x21503c=[[_0x9881('0x69'),_0x9881('0x6d')],[_0x9881('0x6b'),_0xc1fd9b[0x0][_0x9881('0x6c')]],db[_0x9881('0x6e')]['literal'](_0x9881('0x70')),['id',_0x9881('0x6a')]];}return db[_0x9881('0xf')]['findOne']({'attributes':['id',_0x9881('0x71'),_0x9881('0x54'),_0x9881('0x72')],'where':_0x4d5ea0,'order':_0x21503c,'transaction':_0x23f6cf,'lock':_0x23f6cf[_0x9881('0x73')][_0x9881('0x74')],'include':[{'model':db['CmContact'],'as':_0x9881('0x75'),'attributes':_0x12f6eb,'include':[{'model':db['CmCompany'],'as':_0x9881('0x76'),'attributes':['id',_0x9881('0xd')]}]},{'model':db[_0x9881('0x77')],'as':'List','attributes':['id',_0x9881('0xd')]},{'model':db[_0x9881('0x44')],'as':'Queue','attributes':['id',_0x9881('0xd'),_0x9881('0x78')]}]})[_0x9881('0x36')](function(_0x4263ac){if(_0x4263ac){return _0x4263ac[_0x9881('0x3f')]({'UserId':_0x4012d9[_0x9881('0x4f')]['id']},{'transaction':_0x23f6cf});}});});}})['then'](handleEntityNotFound(_0xb9d0ac,null))[_0x9881('0x36')](respondWithResult(_0xb9d0ac,null))[_0x9881('0x3b')](handleError(_0xb9d0ac,null));};exports[_0x9881('0x79')]=function(_0x15f887,_0x578ac5,_0x1489cf){var _0x30bd50=[];var _0x5125c1=_0x15f887[_0x9881('0x42')]['id'];var _0x30a343=_0x15f887[_0x9881('0x4f')]['id'];return db['CmContact']['describe']()['then'](function(_0x57c931){_0x30bd50=_[_0x9881('0x16')](_0x57c931);return db[_0x9881('0x6e')][_0x9881('0x7a')](function(_0x237757){const _0x47739f={'id':_0x5125c1};return db[_0x9881('0xf')][_0x9881('0x7b')]({'attributes':['id',_0x9881('0x71'),'recallme'],'where':_0x47739f,'transaction':_0x237757,'lock':_0x237757[_0x9881('0x73')][_0x9881('0x74')],'include':[{'model':db[_0x9881('0x60')],'as':'Contact','attributes':_0x30bd50,'include':[{'model':db[_0x9881('0x7c')],'as':_0x9881('0x76'),'attributes':['id',_0x9881('0xd')]}]},{'model':db[_0x9881('0x77')],'as':_0x9881('0x7d'),'attributes':['id',_0x9881('0xd')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x9881('0xd'),_0x9881('0x78')]}]})[_0x9881('0x36')](function(_0x54af49){if(_0x54af49){return _0x54af49[_0x9881('0x3f')]({'UserId':_0x30a343},{'transaction':_0x237757});}});});})[_0x9881('0x36')](handleEntityNotFound(_0x578ac5,null))[_0x9881('0x36')](respondWithResult(_0x578ac5,null))['catch'](handleError(_0x578ac5,null));};exports[_0x9881('0x7e')]=function(_0x13dc4d,_0x2f654f){return _0x13dc4d[_0x9881('0x4f')][_0x9881('0x61')]({'where':{'type':_0x9881('0x7f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x21bc73){if(_0x21bc73&&_0x21bc73[_0x9881('0x2b')]){return db['CmHopper'][_0x9881('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9881('0x51')](_0x9881('0x52'))},'VoiceQueueId':{'$in':_[_0x9881('0xe')](_0x21bc73,'id')},'$or':[{'UserId':null},{'UserId':_0x13dc4d['user']['id']}]}});}return 0x0;})[_0x9881('0x36')](function(_0x569561){if(!_[_0x9881('0x5a')](_0x569561)&&_[_0x9881('0x80')](_0x569561)){return _0x2f654f[_0x9881('0x5')](0xc8)['json']({'contacts':_0x569561});}else{logger['error'](_0x9881('0x81'),_0x9881('0x7e'),0x194,_0x9881('0x82'));_0x2f654f['sendStatus'](0x194);}})[_0x9881('0x3b')](handleError(_0x2f654f,null));};exports[_0x9881('0x83')]=function(_0x942159,_0x1c8218){var _0x19937d=shared[_0x9881('0x84')];var _0x5f26da=[];_[_0x9881('0xe')](_0x19937d,function(_0x487668){_0x5f26da['push']({'id':_0x487668[_0x9881('0xd')],'name':_0x487668[_0x9881('0xd')],'utcOffset':_0x487668['utcOffset']});});return _0x1c8218[_0x9881('0x5')](0xc8)['json']({'tz':_0x5f26da});};exports[_0x9881('0x85')]=function(_0x21a524,_0x2d598b){var _0x5e8c3a=shared[_0x9881('0x84')];var _0x49ea3d={};if(!_[_0x9881('0x5a')](_0x5e8c3a[_0x21a524[_0x9881('0x3e')]['id']]))_0x49ea3d=_0x5e8c3a[_0x21a524[_0x9881('0x3e')]['id']];return _0x2d598b[_0x9881('0x5')](0xc8)[_0x9881('0x6')](_0x49ea3d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 94d21a5..1ad7fd0 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 _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x82c31a,_0x15c638){var _0xccb997=function(_0x2ec860){while(--_0x2ec860){_0x82c31a['push'](_0x82c31a['shift']());}};_0xccb997(++_0x15c638);}(_0xacf4,0xe7));var _0x4acf=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xacf4[_0x25701b];return _0x3a8a2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0xc27aef,_0x5bd885){var _0x20c546=function(_0x416ec4){while(--_0x416ec4){_0xc27aef['push'](_0xc27aef['shift']());}};_0x20c546(++_0x5bd885);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2a7adf,_0x1f9b0e){_0x2a7adf=_0x2a7adf-0x0;var _0x168d12=_0xd8fb[_0x2a7adf];return _0x168d12;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 65a2c35..8a8773f 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 _0x8b00=['order','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','LOCK','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe'];(function(_0x52b2ea,_0x29442f){var _0x452c6e=function(_0x1f0f3c){while(--_0x1f0f3c){_0x52b2ea['push'](_0x52b2ea['shift']());}};_0x452c6e(++_0x29442f);}(_0x8b00,0x100));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x08b0('0x0'));var moment=require(_0x08b0('0x1'));var BPromise=require(_0x08b0('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x08b0('0x3'))(_0x08b0('0x4'));exports[_0x08b0('0x5')]=function(_0x5bae3c){var _0x418ef0=this;return new Promise(function(_0x48ea10,_0x4e9f32){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'raw':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c['options'][_0x08b0('0xa')]||null:null,'attributes':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'include':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xd')]?_['map'](_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xd')],function(_0x33f1c3){return{'model':db[_0x33f1c3[_0x08b0('0xe')]],'as':_0x33f1c3['as'],'attributes':_0x33f1c3['attributes'],'include':_0x33f1c3[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x33f1c3[_0x08b0('0xd')],function(_0x1f6b5f){return{'model':db[_0x1f6b5f[_0x08b0('0xe')]],'as':_0x1f6b5f['as'],'attributes':_0x1f6b5f[_0x08b0('0xb')],'include':_0x1f6b5f['include']?_['map'](_0x1f6b5f[_0x08b0('0xd')],function(_0x5b8de9){return{'model':db[_0x5b8de9[_0x08b0('0xe')]],'as':_0x5b8de9['as'],'attributes':_0x5b8de9[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x1fc578){logger[_0x08b0('0x11')](_0x08b0('0x5'),_0x5bae3c);logger[_0x08b0('0x12')](_0x08b0('0x5'),_0x5bae3c,JSON[_0x08b0('0x13')](_0x1fc578));_0x48ea10(_0x1fc578);})[_0x08b0('0x14')](function(_0x3bbed7){logger['error'](_0x08b0('0x5'),_0x3bbed7[_0x08b0('0x15')],_0x5bae3c);_0x4e9f32(_0x418ef0[_0x08b0('0x16')](0x1f4,_0x3bbed7[_0x08b0('0x15')]));});});};exports[_0x08b0('0x17')]=function(_0xe68c88){var _0x2c96c8=this;return new Promise(function(_0x19f6be,_0x27b43a){return db[_0x08b0('0x6')][_0x08b0('0x18')]({'raw':_0xe68c88[_0x08b0('0x8')]?_0xe68c88['options'][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0xe68c88[_0x08b0('0x8')]?_0xe68c88['options']['where']||null:null,'attributes':_0xe68c88[_0x08b0('0x8')]?_0xe68c88[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'include':_0xe68c88['options']?_0xe68c88[_0x08b0('0x8')][_0x08b0('0xd')]?_[_0x08b0('0xf')](_0xe68c88[_0x08b0('0x8')]['include'],function(_0x20fbe2){return{'model':db[_0x20fbe2[_0x08b0('0xe')]],'as':_0x20fbe2['as'],'attributes':_0x20fbe2[_0x08b0('0xb')],'include':_0x20fbe2[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x20fbe2[_0x08b0('0xd')],function(_0x14df7a){return{'model':db[_0x14df7a[_0x08b0('0xe')]],'as':_0x14df7a['as'],'attributes':_0x14df7a[_0x08b0('0xb')],'include':_0x14df7a[_0x08b0('0xd')]?_['map'](_0x14df7a['include'],function(_0xf3508b){return{'model':db[_0xf3508b['model']],'as':_0xf3508b['as'],'attributes':_0xf3508b[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x4fcfb0){logger[_0x08b0('0x11')](_0x08b0('0x17'),_0xe68c88);logger[_0x08b0('0x12')](_0x08b0('0x17'),_0xe68c88,JSON[_0x08b0('0x13')](_0x4fcfb0));_0x19f6be(_0x4fcfb0);})['catch'](function(_0x134ec8){logger[_0x08b0('0x16')](_0x08b0('0x17'),_0x134ec8[_0x08b0('0x15')],_0xe68c88);_0x27b43a(_0x2c96c8[_0x08b0('0x16')](0x1f4,_0x134ec8['message']));});});};exports[_0x08b0('0x19')]=function(_0x20892d){var _0xad8561=this;return new Promise(function(_0x4df42c,_0x3d63de){return db[_0x08b0('0x6')]['create'](_0x20892d[_0x08b0('0x1a')],{'raw':_0x20892d[_0x08b0('0x8')]?_0x20892d[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x49da7f){logger[_0x08b0('0x11')](_0x08b0('0x19'),_0x20892d);logger[_0x08b0('0x12')](_0x08b0('0x19'),_0x20892d,JSON['stringify'](_0x49da7f));_0x4df42c(_0x49da7f);})[_0x08b0('0x14')](function(_0x1dbda9){logger['error'](_0x08b0('0x19'),_0x1dbda9[_0x08b0('0x15')],_0x20892d);_0x3d63de(_0xad8561[_0x08b0('0x16')](0x1f4,_0x1dbda9[_0x08b0('0x15')]));});});};exports['UpdateCmHopper']=function(_0x1b6b27){var _0x447aca=this;return new Promise(function(_0x2771d8,_0xc41a41){return db[_0x08b0('0x6')][_0x08b0('0x1b')](_0x1b6b27[_0x08b0('0x1a')],{'raw':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b6b27['options']?_0x1b6b27['options'][_0x08b0('0xa')]||null:null,'attributes':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')]['attributes']||null:null,'limit':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')][_0x08b0('0xc')]||null:null})[_0x08b0('0x10')](function(_0x3bfd58){logger[_0x08b0('0x11')](_0x08b0('0x1c'),_0x1b6b27);logger[_0x08b0('0x11')](_0x08b0('0x1d'),JSON['stringify'](_0x1b6b27[_0x08b0('0x8')][_0x08b0('0xa')]),_0x1b6b27['body'][_0x08b0('0x1e')]);logger[_0x08b0('0x12')](_0x08b0('0x1c'),_0x1b6b27,JSON[_0x08b0('0x13')](_0x3bfd58));_0x2771d8(_0x3bfd58);})[_0x08b0('0x14')](function(_0x4d83de){logger[_0x08b0('0x16')]('UpdateCmHopper',_0x4d83de['message'],_0x1b6b27);_0xc41a41(_0x447aca[_0x08b0('0x16')](0x1f4,_0x4d83de['message']));});});};exports[_0x08b0('0x1f')]=function(_0x47e3b5){var _0x15e56f=this;return new Promise(function(_0x58e021,_0x2333fe){return db['CmHopper'][_0x08b0('0x20')]({'where':_0x47e3b5[_0x08b0('0x8')]?_0x47e3b5['options'][_0x08b0('0xa')]||null:null})[_0x08b0('0x10')](function(_0xf400c8){logger[_0x08b0('0x11')]('DestroyCmHopper',_0x47e3b5);logger[_0x08b0('0x12')]('DestroyCmHopper',_0x47e3b5,JSON[_0x08b0('0x13')](_0xf400c8));_0x58e021(_0xf400c8);})[_0x08b0('0x14')](function(_0x22e9d3){logger[_0x08b0('0x16')]('DestroyCmHopper',_0x22e9d3[_0x08b0('0x15')],_0x47e3b5);_0x2333fe(_0x15e56f['error'](0x1f4,_0x22e9d3[_0x08b0('0x15')]));});});};exports['GetContactDialer']=function(_0x5bcfd8){var _0x5e0cb0=this;return new Promise(function(_0x3fbac1,_0x1e2911){return db[_0x08b0('0x21')][_0x08b0('0x22')]()[_0x08b0('0x10')](function(_0x30acdd){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x513251){return db['CmHopper']['findAll']({'where':_0x5bcfd8[_0x08b0('0x8')]?_0x5bcfd8[_0x08b0('0x8')]['where']||null:null,'attributes':_0x5bcfd8[_0x08b0('0x8')]?_0x5bcfd8[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x5bcfd8['options']?_0x5bcfd8[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'order':_0x5bcfd8['options']?_0x5bcfd8[_0x08b0('0x8')]['order']||null:null,'transaction':_0x513251,'lock':_0x513251[_0x08b0('0x25')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x08b0('0x26'),'attributes':_[_0x08b0('0x27')](_0x30acdd)},{'model':db[_0x08b0('0x28')],'as':_0x08b0('0x29'),'attributes':['id',_0x08b0('0x2a'),_0x08b0('0x2b')]}]})[_0x08b0('0x10')](function(_0x28f4b1){var _0x4b756f=[];var _0x263aeb=[];for(var _0x56bb4a=0x0;_0x56bb4a<_0x28f4b1['length'];_0x56bb4a+=0x1){var _0x3ca2fd=_0x28f4b1[_0x56bb4a][_0x08b0('0x2c')];if(_0x3ca2fd===null){_0x4b756f[_0x08b0('0x2d')](_0x28f4b1[_0x56bb4a][_0x08b0('0x1b')](_0x5bcfd8[_0x08b0('0x1a')],{'transaction':_0x513251}));}else if(!_0x263aeb[_0x08b0('0x2e')](_0x3ca2fd)){_0x263aeb[_0x08b0('0x2d')](_0x3ca2fd);_0x4b756f[_0x08b0('0x2d')](_0x28f4b1[_0x56bb4a][_0x08b0('0x1b')](_0x5bcfd8[_0x08b0('0x1a')],{'transaction':_0x513251}));}}return BPromise[_0x08b0('0x2f')](_0x4b756f);});})[_0x08b0('0x10')](function(_0xa39839){logger[_0x08b0('0x11')](_0x08b0('0x30'),_0x5bcfd8);if(_0xa39839[_0x08b0('0x31')]>0x0){logger[_0x08b0('0x11')](_0x08b0('0x32'),_0xa39839[0x0][_0x08b0('0x33')]['id'],_0xa39839[0x0][_0x08b0('0x33')][_0x08b0('0x34')],_0xa39839[0x0][_0x08b0('0x33')][_0x08b0('0x1e')]);}logger[_0x08b0('0x12')]('GetContactDialer',_0x5bcfd8,JSON[_0x08b0('0x13')](_0xa39839));_0x3fbac1(_0xa39839);})[_0x08b0('0x14')](function(_0xc2026f){logger['error'](_0x08b0('0x30'),_0xc2026f[_0x08b0('0x15')],_0x5bcfd8);_0x1e2911(_0x5e0cb0[_0x08b0('0x16')](0x1f4,_0xc2026f[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x35')]=function(_0x56e62c){var _0x190a7b=this;return new Promise(function(_0x361bbe,_0x1c25da){return db[_0x08b0('0x23')]['transaction'](function(_0x363166){return db[_0x08b0('0x36')][_0x08b0('0x37')](_0x56e62c['body'],{'raw':_0x56e62c[_0x08b0('0x8')]?_0x56e62c[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x363166})[_0x08b0('0x10')](function(){logger[_0x08b0('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x08b0('0x13')](_0x56e62c[_0x08b0('0x8')][_0x08b0('0xa')]),_0x56e62c['options'][_0x08b0('0xa')][_0x08b0('0x1e')]);return db[_0x08b0('0x6')][_0x08b0('0x20')]({'where':_0x56e62c['options']?_0x56e62c[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'transaction':_0x363166});});})[_0x08b0('0x10')](function(_0x51ed4e){logger['info'](_0x08b0('0x35'),_0x56e62c);logger[_0x08b0('0x12')](_0x08b0('0x35'),_0x56e62c,JSON['stringify'](_0x51ed4e));_0x361bbe(_0x51ed4e);})[_0x08b0('0x14')](function(_0x26d348){logger[_0x08b0('0x16')](_0x08b0('0x35'),_0x26d348['message'],_0x56e62c);_0x1c25da(_0x190a7b[_0x08b0('0x16')](0x1f4,_0x26d348[_0x08b0('0x15')]));});});};exports['CountReScheduled']=function(_0x195194){var _0x5f220e=this;return new Promise(function(_0x47db85,_0xa362f){return db[_0x08b0('0x6')]['findAll']({'raw':_0x195194[_0x08b0('0x8')]?_0x195194[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x195194['options']?_0x195194[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':[[db[_0x08b0('0x23')]['fn'](_0x08b0('0x38'),db[_0x08b0('0x23')]['fn']('IF',db[_0x08b0('0x23')][_0x08b0('0x39')](_0x08b0('0x3a')+util[_0x08b0('0x3b')](_0x08b0('0x3c'),moment()[_0x08b0('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x08b0('0x3d')))),'contactsRescheduled']]})[_0x08b0('0x10')](function(_0x2e45b8){logger[_0x08b0('0x11')](_0x08b0('0x3e'),_0x195194);logger['debug'](_0x08b0('0x3e'),_0x195194,JSON[_0x08b0('0x13')](_0x2e45b8));_0x47db85(_0x2e45b8);})[_0x08b0('0x14')](function(_0x455a03){logger['error'](_0x08b0('0x3e'),_0x455a03[_0x08b0('0x15')],_0x195194);_0xa362f(_0x5f220e['error'](0x1f4,_0x455a03['message']));});});};exports[_0x08b0('0x3f')]=function(_0x450211){var _0x29e39e=this;return new Promise(function(_0x4db0c6,_0x224f56){return db['CmContact'][_0x08b0('0x22')]()[_0x08b0('0x10')](function(){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x322474){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'where':_0x450211[_0x08b0('0x8')]?_0x450211[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':_0x450211['options']?_0x450211[_0x08b0('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x450211[_0x08b0('0x8')]?_0x450211['options'][_0x08b0('0x40')]||null:null,'group':db[_0x08b0('0x6')][_0x08b0('0x2c')],'transaction':_0x322474,'lock':_0x322474[_0x08b0('0x25')][_0x08b0('0x41')],'include':_0x450211[_0x08b0('0x8')]?_0x450211['options'][_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x450211[_0x08b0('0x8')]['include'],function(_0x2fa2f7){return{'model':db[_0x2fa2f7[_0x08b0('0xe')]],'as':_0x2fa2f7['as'],'attributes':_0x2fa2f7['attributes'],'include':_0x2fa2f7[_0x08b0('0xd')]?_['map'](_0x2fa2f7[_0x08b0('0xd')],function(_0x1a8b60){return{'model':db[_0x1a8b60[_0x08b0('0xe')]],'as':_0x1a8b60['as'],'attributes':_0x1a8b60['attributes'],'include':_0x1a8b60[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x1a8b60[_0x08b0('0xd')],function(_0x36b928){return{'model':db[_0x36b928[_0x08b0('0xe')]],'as':_0x36b928['as'],'attributes':_0x36b928[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x215e2b){var _0x15364f=[];for(var _0x5e3204=0x0;_0x5e3204<_0x215e2b['length'];_0x5e3204+=0x1){_0x15364f[_0x08b0('0x2d')](_0x215e2b[_0x5e3204]['update'](_0x450211[_0x08b0('0x1a')],{'transaction':_0x322474}));}return BPromise[_0x08b0('0x2f')](_0x15364f);});})[_0x08b0('0x10')](function(_0x566172){logger[_0x08b0('0x11')](_0x08b0('0x3f'),_0x450211);logger[_0x08b0('0x12')](_0x08b0('0x3f'),_0x450211,JSON[_0x08b0('0x13')](_0x566172));_0x4db0c6(_0x566172);})['catch'](function(_0x3866f1){logger[_0x08b0('0x16')]('GetContactRecallMe',_0x3866f1[_0x08b0('0x15')],_0x450211);_0x224f56(_0x29e39e[_0x08b0('0x16')](0x1f4,_0x3866f1[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x42')]=function(_0x10a87b){var _0x2aec93=this;return new Promise(function(_0x352b6f,_0x3f34c7){db['CmContact'][_0x08b0('0x22')]()[_0x08b0('0x10')](function(_0x3f1935){return db[_0x08b0('0x6')]['findAll']({'raw':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x10a87b['options']?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'include':_0x10a87b['options']?_0x10a87b[_0x08b0('0x8')]['include']?_['map'](_0x10a87b[_0x08b0('0x8')][_0x08b0('0xd')],function(_0x318e1e){return{'model':db[_0x318e1e[_0x08b0('0xe')]],'as':_0x318e1e['as'],'attributes':_0x318e1e['as']===_0x08b0('0x26')?_[_0x08b0('0x27')](_0x3f1935):_0x318e1e[_0x08b0('0xb')],'include':_0x318e1e['include']?_[_0x08b0('0xf')](_0x318e1e[_0x08b0('0xd')],function(_0x2578f0){return{'model':db[_0x2578f0[_0x08b0('0xe')]],'as':_0x2578f0['as'],'attributes':_0x2578f0['attributes'],'include':_0x2578f0[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x2578f0[_0x08b0('0xd')],function(_0x212d55){return{'model':db[_0x212d55['model']],'as':_0x212d55['as'],'attributes':_0x212d55['attributes']};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x104597){logger[_0x08b0('0x11')](_0x08b0('0x5'),_0x10a87b);logger[_0x08b0('0x12')](_0x08b0('0x5'),_0x10a87b,JSON[_0x08b0('0x13')](_0x104597));_0x352b6f(_0x104597);})[_0x08b0('0x14')](function(_0xe276d2){logger['error'](_0x08b0('0x5'),_0xe276d2[_0x08b0('0x15')],_0x10a87b);_0x3f34c7(_0x2aec93['error'](0x1f4,_0xe276d2[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x43')]=function(_0x4fa25c){var _0x29bd33=this;return new Promise(function(_0x355edf,_0x460091){return db[_0x08b0('0x21')][_0x08b0('0x44')]({'raw':!![],'where':{'phone':_0x4fa25c[_0x08b0('0x8')]['where']['phone']},'attributes':['id',_0x08b0('0x45')],'order':[['id',_0x08b0('0x46')]]})[_0x08b0('0x10')](function(_0x1aa8a0){logger[_0x08b0('0x11')](_0x08b0('0x47'),_0x4fa25c);logger['debug'](_0x08b0('0x47'),_0x4fa25c,JSON[_0x08b0('0x13')](_0x1aa8a0));_0x355edf(_0x1aa8a0);})['catch'](function(_0x214613){logger['error'](_0x08b0('0x47'),_0x214613[_0x08b0('0x15')],_0x4fa25c);_0x460091(_0x29bd33['error'](0x1f4,_0x214613[_0x08b0('0x15')]));});});};exports[_0x08b0('0x48')]=function(_0x1a776f){var _0x4db70a=this;return new Promise(function(_0x45d88f,_0x406fa4){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x4b01d9){var _0x5eb392=_0x1a776f[_0x08b0('0x8')]&&_0x1a776f[_0x08b0('0x8')][_0x08b0('0xa')]?_0x1a776f[_0x08b0('0x8')][_0x08b0('0xa')]:{};return db[_0x08b0('0x6')][_0x08b0('0x1b')](_0x1a776f['body'],{'where':_0x5eb392,'transaction':_0x4b01d9})[_0x08b0('0x10')](function(_0x204041){logger['info']('ResetActiveCalls',_0x1a776f);logger[_0x08b0('0x12')]('ResetActiveCalls',_0x1a776f,JSON['stringify'](_0x204041));_0x45d88f(_0x204041);})['catch'](function(_0x449b2e){logger[_0x08b0('0x16')](_0x08b0('0x48'),_0x449b2e[_0x08b0('0x15')],_0x1a776f);_0x406fa4(_0x4db70a[_0x08b0('0x16')](0x1f4,_0x449b2e['message']));});});});};exports[_0x08b0('0x49')]=function(_0x76bac1){var _0x23ba45=this;var _0x5e8bc2=_0x76bac1[_0x08b0('0x1a')][_0x08b0('0xa')][_0x08b0('0x4a')];var _0x1ad82e=_0x76bac1[_0x08b0('0x1a')][_0x08b0('0xa')]['interval'];var _0x2f8ebf=_0x76bac1[_0x08b0('0x1a')]['where'][_0x08b0('0x4b')];return new Promise(function(_0x4f9da8,_0x5557d1){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'where':{'voiceQueueId':{'$in':_0x5e8bc2},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x08b0('0x23')]['literal'](_0x08b0('0x4c')+_0x1ad82e+_0x08b0('0x4d')),'$gt':db[_0x08b0('0x23')][_0x08b0('0x39')](_0x08b0('0x4e'))}},'UserId':{'$in':_0x2f8ebf}},'include':[{'model':db['CmContact'],'as':_0x08b0('0x26')},{'model':db[_0x08b0('0x28')],'as':_0x08b0('0x29'),'attributes':['id',_0x08b0('0x2a'),_0x08b0('0x2b')]},{'model':db[_0x08b0('0x4f')],'as':'List'}]})['then'](function(_0x106089){if(_0x106089['length']>0x0){return db['sequelize'][_0x08b0('0x24')](function(_0x5de735){return db[_0x08b0('0x6')]['update']({'recallmeNotifiedDate':db[_0x08b0('0x23')][_0x08b0('0x39')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x106089,'id')}},'transaction':_0x5de735})[_0x08b0('0x10')](function(){_0x4f9da8(_0x106089);})[_0x08b0('0x14')](function(_0x487a25){logger['error'](_0x08b0('0x49'),_0x487a25[_0x08b0('0x15')],_0x76bac1);_0x5557d1(_0x23ba45['error'](0x1f4,_0x487a25[_0x08b0('0x15')]));});})[_0x08b0('0x14')](function(_0x1d8873){logger[_0x08b0('0x16')](_0x08b0('0x49'),_0x1d8873[_0x08b0('0x15')],_0x76bac1);_0x5557d1(_0x23ba45[_0x08b0('0x16')](0x1f4,_0x1d8873[_0x08b0('0x15')]));});}else{_0x4f9da8(_0x106089);}});});}; \ No newline at end of file +var _0x4503=['DestroyCmHopper','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','Agent','voicePause','UserId','push','includes','all','length','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','describe','keys','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','User','name','CmList','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','findAll','options','raw','limit','include','map','model','attributes','then','info','debug','stringify','catch','error','message','CmHopper','find','where','ShowCmHopper','create','CreateCmHopper','UpdateCmHopper','update','body','destroy'];(function(_0x3af6d3,_0xd6ff2e){var _0xf0c5a8=function(_0x392c56){while(--_0x392c56){_0x3af6d3['push'](_0x3af6d3['shift']());}};_0xf0c5a8(++_0xd6ff2e);}(_0x4503,0x111));var _0x3450=function(_0x109f3b,_0x406594){_0x109f3b=_0x109f3b-0x0;var _0x524e11=_0x4503[_0x109f3b];return _0x524e11;};'use strict';var _=require('lodash');var util=require(_0x3450('0x0'));var moment=require(_0x3450('0x1'));var BPromise=require(_0x3450('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x3450('0x3'))(_0x3450('0x4'));exports[_0x3450('0x5')]=function(_0x5e7d24){var _0x47627f=this;return new Promise(function(_0x109c43,_0x16741e){return db['CmHopper'][_0x3450('0x6')]({'raw':_0x5e7d24[_0x3450('0x7')]?_0x5e7d24[_0x3450('0x7')][_0x3450('0x8')]===undefined?!![]:![]:!![],'where':_0x5e7d24['options']?_0x5e7d24[_0x3450('0x7')]['where']||null:null,'attributes':_0x5e7d24[_0x3450('0x7')]?_0x5e7d24[_0x3450('0x7')]['attributes']||null:null,'limit':_0x5e7d24[_0x3450('0x7')]?_0x5e7d24[_0x3450('0x7')][_0x3450('0x9')]||null:null,'include':_0x5e7d24[_0x3450('0x7')]?_0x5e7d24['options'][_0x3450('0xa')]?_[_0x3450('0xb')](_0x5e7d24['options'][_0x3450('0xa')],function(_0x1b6c9e){return{'model':db[_0x1b6c9e[_0x3450('0xc')]],'as':_0x1b6c9e['as'],'attributes':_0x1b6c9e[_0x3450('0xd')],'include':_0x1b6c9e[_0x3450('0xa')]?_['map'](_0x1b6c9e[_0x3450('0xa')],function(_0x4e1a46){return{'model':db[_0x4e1a46[_0x3450('0xc')]],'as':_0x4e1a46['as'],'attributes':_0x4e1a46[_0x3450('0xd')],'include':_0x4e1a46[_0x3450('0xa')]?_[_0x3450('0xb')](_0x4e1a46['include'],function(_0x1d9918){return{'model':db[_0x1d9918[_0x3450('0xc')]],'as':_0x1d9918['as'],'attributes':_0x1d9918[_0x3450('0xd')]};}):[]};}):[]};}):[]:[]})[_0x3450('0xe')](function(_0x528414){logger[_0x3450('0xf')](_0x3450('0x5'),_0x5e7d24);logger[_0x3450('0x10')](_0x3450('0x5'),_0x5e7d24,JSON[_0x3450('0x11')](_0x528414));_0x109c43(_0x528414);})[_0x3450('0x12')](function(_0x4eb490){logger['error'](_0x3450('0x5'),_0x4eb490['message'],_0x5e7d24);_0x16741e(_0x47627f[_0x3450('0x13')](0x1f4,_0x4eb490[_0x3450('0x14')]));});});};exports['ShowCmHopper']=function(_0x3b8fbf){var _0x59ae7f=this;return new Promise(function(_0x263154,_0x483f04){return db[_0x3450('0x15')][_0x3450('0x16')]({'raw':_0x3b8fbf['options']?_0x3b8fbf[_0x3450('0x7')][_0x3450('0x8')]===undefined?!![]:![]:!![],'where':_0x3b8fbf[_0x3450('0x7')]?_0x3b8fbf['options'][_0x3450('0x17')]||null:null,'attributes':_0x3b8fbf[_0x3450('0x7')]?_0x3b8fbf[_0x3450('0x7')][_0x3450('0xd')]||null:null,'include':_0x3b8fbf[_0x3450('0x7')]?_0x3b8fbf[_0x3450('0x7')][_0x3450('0xa')]?_['map'](_0x3b8fbf[_0x3450('0x7')]['include'],function(_0x447f05){return{'model':db[_0x447f05[_0x3450('0xc')]],'as':_0x447f05['as'],'attributes':_0x447f05[_0x3450('0xd')],'include':_0x447f05[_0x3450('0xa')]?_[_0x3450('0xb')](_0x447f05['include'],function(_0x474edc){return{'model':db[_0x474edc[_0x3450('0xc')]],'as':_0x474edc['as'],'attributes':_0x474edc[_0x3450('0xd')],'include':_0x474edc[_0x3450('0xa')]?_[_0x3450('0xb')](_0x474edc[_0x3450('0xa')],function(_0x494cf5){return{'model':db[_0x494cf5[_0x3450('0xc')]],'as':_0x494cf5['as'],'attributes':_0x494cf5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3450('0xe')](function(_0xd738a7){logger[_0x3450('0xf')](_0x3450('0x18'),_0x3b8fbf);logger[_0x3450('0x10')](_0x3450('0x18'),_0x3b8fbf,JSON[_0x3450('0x11')](_0xd738a7));_0x263154(_0xd738a7);})[_0x3450('0x12')](function(_0x29fe16){logger[_0x3450('0x13')](_0x3450('0x18'),_0x29fe16[_0x3450('0x14')],_0x3b8fbf);_0x483f04(_0x59ae7f[_0x3450('0x13')](0x1f4,_0x29fe16[_0x3450('0x14')]));});});};exports['CreateCmHopper']=function(_0x16630e){var _0xbc8a4c=this;return new Promise(function(_0x504a7d,_0x1a8bce){return db[_0x3450('0x15')][_0x3450('0x19')](_0x16630e['body'],{'raw':_0x16630e[_0x3450('0x7')]?_0x16630e[_0x3450('0x7')]['raw']===undefined?!![]:![]:!![]})[_0x3450('0xe')](function(_0x772c21){logger['info']('CreateCmHopper',_0x16630e);logger[_0x3450('0x10')](_0x3450('0x1a'),_0x16630e,JSON['stringify'](_0x772c21));_0x504a7d(_0x772c21);})[_0x3450('0x12')](function(_0x11dbe8){logger[_0x3450('0x13')](_0x3450('0x1a'),_0x11dbe8[_0x3450('0x14')],_0x16630e);_0x1a8bce(_0xbc8a4c[_0x3450('0x13')](0x1f4,_0x11dbe8[_0x3450('0x14')]));});});};exports[_0x3450('0x1b')]=function(_0x52b3df){var _0x3b22cc=this;return new Promise(function(_0x540d2b,_0x4ca329){return db['CmHopper'][_0x3450('0x1c')](_0x52b3df[_0x3450('0x1d')],{'raw':_0x52b3df[_0x3450('0x7')]?_0x52b3df[_0x3450('0x7')][_0x3450('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52b3df['options']?_0x52b3df[_0x3450('0x7')][_0x3450('0x17')]||null:null,'attributes':_0x52b3df[_0x3450('0x7')]?_0x52b3df[_0x3450('0x7')][_0x3450('0xd')]||null:null,'limit':_0x52b3df['options']?_0x52b3df['options'][_0x3450('0x9')]||null:null})[_0x3450('0xe')](function(_0x5b101e){logger[_0x3450('0xf')](_0x3450('0x1b'),_0x52b3df);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x3450('0x11')](_0x52b3df['options']['where']),_0x52b3df['body']['active']);logger['debug'](_0x3450('0x1b'),_0x52b3df,JSON['stringify'](_0x5b101e));_0x540d2b(_0x5b101e);})[_0x3450('0x12')](function(_0x496697){logger['error'](_0x3450('0x1b'),_0x496697[_0x3450('0x14')],_0x52b3df);_0x4ca329(_0x3b22cc[_0x3450('0x13')](0x1f4,_0x496697[_0x3450('0x14')]));});});};exports['DestroyCmHopper']=function(_0x3ea5cb){var _0x50f86f=this;return new Promise(function(_0xd78635,_0xd6e909){return db[_0x3450('0x15')][_0x3450('0x1e')]({'where':_0x3ea5cb[_0x3450('0x7')]?_0x3ea5cb[_0x3450('0x7')][_0x3450('0x17')]||null:null})[_0x3450('0xe')](function(_0x599a3f){logger[_0x3450('0xf')](_0x3450('0x1f'),_0x3ea5cb);logger[_0x3450('0x10')](_0x3450('0x1f'),_0x3ea5cb,JSON[_0x3450('0x11')](_0x599a3f));_0xd78635(_0x599a3f);})[_0x3450('0x12')](function(_0x48af83){logger[_0x3450('0x13')](_0x3450('0x1f'),_0x48af83['message'],_0x3ea5cb);_0xd6e909(_0x50f86f[_0x3450('0x13')](0x1f4,_0x48af83[_0x3450('0x14')]));});});};exports['GetContactDialer']=function(_0x3941b0){var _0x329a79=this;return new Promise(function(_0x1c0e21,_0x3ed3d2){return db[_0x3450('0x20')]['describe']()[_0x3450('0xe')](function(_0x1b5292){return db[_0x3450('0x21')][_0x3450('0x22')](function(_0x2834f6){return db[_0x3450('0x15')][_0x3450('0x6')]({'where':_0x3941b0['options']?_0x3941b0[_0x3450('0x7')]['where']||null:null,'attributes':_0x3941b0[_0x3450('0x7')]?_0x3941b0[_0x3450('0x7')]['attributes']||null:null,'limit':_0x3941b0[_0x3450('0x7')]?_0x3941b0[_0x3450('0x7')]['limit']||null:null,'order':_0x3941b0[_0x3450('0x7')]?_0x3941b0[_0x3450('0x7')][_0x3450('0x23')]||null:null,'transaction':_0x2834f6,'lock':_0x2834f6[_0x3450('0x24')][_0x3450('0x25')],'include':[{'model':db[_0x3450('0x20')],'as':_0x3450('0x26'),'attributes':_['keys'](_0x1b5292)},{'model':db['User'],'as':_0x3450('0x27'),'attributes':['id','name',_0x3450('0x28')]}]})['then'](function(_0x673151){var _0x422040=[];var _0x57bcde=[];for(var _0x1ffac7=0x0;_0x1ffac7<_0x673151['length'];_0x1ffac7+=0x1){var _0x152cd8=_0x673151[_0x1ffac7][_0x3450('0x29')];if(_0x152cd8===null){_0x422040[_0x3450('0x2a')](_0x673151[_0x1ffac7][_0x3450('0x1c')](_0x3941b0[_0x3450('0x1d')],{'transaction':_0x2834f6}));}else if(!_0x57bcde[_0x3450('0x2b')](_0x152cd8)){_0x57bcde[_0x3450('0x2a')](_0x152cd8);_0x422040['push'](_0x673151[_0x1ffac7][_0x3450('0x1c')](_0x3941b0[_0x3450('0x1d')],{'transaction':_0x2834f6}));}}return BPromise[_0x3450('0x2c')](_0x422040);});})['then'](function(_0x310f5b){logger[_0x3450('0xf')]('GetContactDialer',_0x3941b0);if(_0x310f5b[_0x3450('0x2d')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x310f5b[0x0][_0x3450('0x2e')]['id'],_0x310f5b[0x0][_0x3450('0x2e')][_0x3450('0x2f')],_0x310f5b[0x0][_0x3450('0x2e')][_0x3450('0x30')]);}logger['debug'](_0x3450('0x31'),_0x3941b0,JSON[_0x3450('0x11')](_0x310f5b));_0x1c0e21(_0x310f5b);})[_0x3450('0x12')](function(_0x597aab){logger[_0x3450('0x13')](_0x3450('0x31'),_0x597aab[_0x3450('0x14')],_0x3941b0);_0x3ed3d2(_0x329a79[_0x3450('0x13')](0x1f4,_0x597aab[_0x3450('0x14')]));});});});};exports[_0x3450('0x32')]=function(_0x10f7e4){var _0x16ed8b=this;return new Promise(function(_0x9ebb5a,_0x6d73b6){return db[_0x3450('0x21')][_0x3450('0x22')](function(_0x2843ae){return db['CmHopperFinal'][_0x3450('0x19')](_0x10f7e4[_0x3450('0x1d')],{'raw':_0x10f7e4[_0x3450('0x7')]?_0x10f7e4['options'][_0x3450('0x8')]===undefined?!![]:![]:!![],'transaction':_0x2843ae})[_0x3450('0xe')](function(){logger[_0x3450('0xf')](_0x3450('0x33'),JSON[_0x3450('0x11')](_0x10f7e4[_0x3450('0x7')][_0x3450('0x17')]),_0x10f7e4[_0x3450('0x7')][_0x3450('0x17')][_0x3450('0x30')]);return db[_0x3450('0x15')][_0x3450('0x1e')]({'where':_0x10f7e4[_0x3450('0x7')]?_0x10f7e4[_0x3450('0x7')][_0x3450('0x17')]||null:null,'transaction':_0x2843ae});});})[_0x3450('0xe')](function(_0x40d05d){logger[_0x3450('0xf')](_0x3450('0x32'),_0x10f7e4);logger[_0x3450('0x10')]('MoveContactManagedDialer',_0x10f7e4,JSON['stringify'](_0x40d05d));_0x9ebb5a(_0x40d05d);})[_0x3450('0x12')](function(_0x2debc4){logger[_0x3450('0x13')]('MoveContactManagedDialer',_0x2debc4['message'],_0x10f7e4);_0x6d73b6(_0x16ed8b[_0x3450('0x13')](0x1f4,_0x2debc4[_0x3450('0x14')]));});});};exports[_0x3450('0x34')]=function(_0x4545fe){var _0x3e7877=this;return new Promise(function(_0x565437,_0x3922a3){return db[_0x3450('0x15')][_0x3450('0x6')]({'raw':_0x4545fe[_0x3450('0x7')]?_0x4545fe[_0x3450('0x7')][_0x3450('0x8')]===undefined?!![]:![]:!![],'where':_0x4545fe[_0x3450('0x7')]?_0x4545fe[_0x3450('0x7')][_0x3450('0x17')]||null:null,'attributes':[[db[_0x3450('0x21')]['fn']('COUNT',db[_0x3450('0x21')]['fn']('IF',db['sequelize'][_0x3450('0x35')]('`scheduledat`\x20>=\x20'+util[_0x3450('0x36')](_0x3450('0x37'),moment()[_0x3450('0x36')](_0x3450('0x38')))+_0x3450('0x39')))),_0x3450('0x3a')]]})[_0x3450('0xe')](function(_0x199151){logger['info'](_0x3450('0x34'),_0x4545fe);logger['debug'](_0x3450('0x34'),_0x4545fe,JSON[_0x3450('0x11')](_0x199151));_0x565437(_0x199151);})[_0x3450('0x12')](function(_0xf7a793){logger[_0x3450('0x13')](_0x3450('0x34'),_0xf7a793[_0x3450('0x14')],_0x4545fe);_0x3922a3(_0x3e7877[_0x3450('0x13')](0x1f4,_0xf7a793[_0x3450('0x14')]));});});};exports[_0x3450('0x3b')]=function(_0x5eb821){var _0x54325e=this;return new Promise(function(_0x3b0714,_0x11c122){return db[_0x3450('0x20')]['describe']()['then'](function(){return db[_0x3450('0x21')][_0x3450('0x22')](function(_0x335ad9){return db[_0x3450('0x15')][_0x3450('0x6')]({'where':_0x5eb821['options']?_0x5eb821['options'][_0x3450('0x17')]||null:null,'attributes':_0x5eb821['options']?_0x5eb821['options']['attributes']||null:null,'limit':0x1,'order':_0x5eb821[_0x3450('0x7')]?_0x5eb821[_0x3450('0x7')]['order']||null:null,'group':db['CmHopper'][_0x3450('0x29')],'transaction':_0x335ad9,'lock':_0x335ad9['LOCK'][_0x3450('0x25')],'include':_0x5eb821['options']?_0x5eb821['options'][_0x3450('0xa')]?_[_0x3450('0xb')](_0x5eb821[_0x3450('0x7')][_0x3450('0xa')],function(_0xa10888){return{'model':db[_0xa10888[_0x3450('0xc')]],'as':_0xa10888['as'],'attributes':_0xa10888[_0x3450('0xd')],'include':_0xa10888[_0x3450('0xa')]?_['map'](_0xa10888['include'],function(_0x1fe4e6){return{'model':db[_0x1fe4e6[_0x3450('0xc')]],'as':_0x1fe4e6['as'],'attributes':_0x1fe4e6[_0x3450('0xd')],'include':_0x1fe4e6[_0x3450('0xa')]?_[_0x3450('0xb')](_0x1fe4e6[_0x3450('0xa')],function(_0x1ebcf0){return{'model':db[_0x1ebcf0[_0x3450('0xc')]],'as':_0x1ebcf0['as'],'attributes':_0x1ebcf0[_0x3450('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30844c){var _0x145e94=[];for(var _0x33e5eb=0x0;_0x33e5eb<_0x30844c[_0x3450('0x2d')];_0x33e5eb+=0x1){_0x145e94[_0x3450('0x2a')](_0x30844c[_0x33e5eb][_0x3450('0x1c')](_0x5eb821[_0x3450('0x1d')],{'transaction':_0x335ad9}));}return BPromise['all'](_0x145e94);});})[_0x3450('0xe')](function(_0x227cf8){logger['info']('GetContactRecallMe',_0x5eb821);logger[_0x3450('0x10')]('GetContactRecallMe',_0x5eb821,JSON[_0x3450('0x11')](_0x227cf8));_0x3b0714(_0x227cf8);})['catch'](function(_0x1849de){logger[_0x3450('0x13')]('GetContactRecallMe',_0x1849de[_0x3450('0x14')],_0x5eb821);_0x11c122(_0x54325e['error'](0x1f4,_0x1849de[_0x3450('0x14')]));});});});};exports[_0x3450('0x3c')]=function(_0x352cc2){var _0x27f407=this;return new Promise(function(_0x2742c2,_0x11a4e2){db[_0x3450('0x20')][_0x3450('0x3d')]()['then'](function(_0x2a08d4){return db[_0x3450('0x15')][_0x3450('0x6')]({'raw':_0x352cc2['options']?_0x352cc2[_0x3450('0x7')][_0x3450('0x8')]===undefined?!![]:![]:!![],'where':_0x352cc2[_0x3450('0x7')]?_0x352cc2[_0x3450('0x7')]['where']||null:null,'attributes':_0x352cc2[_0x3450('0x7')]?_0x352cc2[_0x3450('0x7')][_0x3450('0xd')]||null:null,'limit':_0x352cc2[_0x3450('0x7')]?_0x352cc2[_0x3450('0x7')][_0x3450('0x9')]||null:null,'include':_0x352cc2[_0x3450('0x7')]?_0x352cc2[_0x3450('0x7')][_0x3450('0xa')]?_[_0x3450('0xb')](_0x352cc2['options'][_0x3450('0xa')],function(_0x57de5d){return{'model':db[_0x57de5d['model']],'as':_0x57de5d['as'],'attributes':_0x57de5d['as']==='Contact'?_[_0x3450('0x3e')](_0x2a08d4):_0x57de5d[_0x3450('0xd')],'include':_0x57de5d[_0x3450('0xa')]?_[_0x3450('0xb')](_0x57de5d[_0x3450('0xa')],function(_0x4e15fc){return{'model':db[_0x4e15fc['model']],'as':_0x4e15fc['as'],'attributes':_0x4e15fc['attributes'],'include':_0x4e15fc['include']?_['map'](_0x4e15fc['include'],function(_0x31bc4b){return{'model':db[_0x31bc4b['model']],'as':_0x31bc4b['as'],'attributes':_0x31bc4b[_0x3450('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf1050c){logger[_0x3450('0xf')](_0x3450('0x5'),_0x352cc2);logger[_0x3450('0x10')]('GetCmHopper',_0x352cc2,JSON[_0x3450('0x11')](_0xf1050c));_0x2742c2(_0xf1050c);})['catch'](function(_0x52c90c){logger[_0x3450('0x13')](_0x3450('0x5'),_0x52c90c[_0x3450('0x14')],_0x352cc2);_0x11a4e2(_0x27f407[_0x3450('0x13')](0x1f4,_0x52c90c['message']));});});});};exports['GetContactByPhone']=function(_0x17745b){var _0x150c22=this;return new Promise(function(_0x93bd86,_0xfbccfd){return db['CmContact'][_0x3450('0x3f')]({'raw':!![],'where':{'phone':_0x17745b[_0x3450('0x7')]['where'][_0x3450('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0x3450('0x41')]]})[_0x3450('0xe')](function(_0x3dcc49){logger[_0x3450('0xf')](_0x3450('0x42'),_0x17745b);logger['debug'](_0x3450('0x42'),_0x17745b,JSON[_0x3450('0x11')](_0x3dcc49));_0x93bd86(_0x3dcc49);})[_0x3450('0x12')](function(_0x5c0ffc){logger[_0x3450('0x13')]('getContactByPhone',_0x5c0ffc['message'],_0x17745b);_0xfbccfd(_0x150c22[_0x3450('0x13')](0x1f4,_0x5c0ffc['message']));});});};exports['ResetActiveCalls']=function(_0x3d32ed){var _0x84213b=this;return new Promise(function(_0x439762,_0x1687ff){return db[_0x3450('0x21')][_0x3450('0x22')](function(_0x41c044){var _0x3cfa35=_0x3d32ed[_0x3450('0x7')]&&_0x3d32ed[_0x3450('0x7')]['where']?_0x3d32ed[_0x3450('0x7')]['where']:{};return db[_0x3450('0x15')]['update'](_0x3d32ed[_0x3450('0x1d')],{'where':_0x3cfa35,'transaction':_0x41c044})['then'](function(_0x593a2f){logger[_0x3450('0xf')](_0x3450('0x43'),_0x3d32ed);logger['debug'](_0x3450('0x43'),_0x3d32ed,JSON[_0x3450('0x11')](_0x593a2f));_0x439762(_0x593a2f);})[_0x3450('0x12')](function(_0x7e6a93){logger[_0x3450('0x13')](_0x3450('0x43'),_0x7e6a93[_0x3450('0x14')],_0x3d32ed);_0x1687ff(_0x84213b[_0x3450('0x13')](0x1f4,_0x7e6a93[_0x3450('0x14')]));});});});};exports[_0x3450('0x44')]=function(_0x3acd56){var _0x1bfa8e=this;var _0x508d01=_0x3acd56[_0x3450('0x1d')]['where']['voiceQueueIds'];var _0x4a7fd7=_0x3acd56[_0x3450('0x1d')][_0x3450('0x17')][_0x3450('0x45')];var _0xabbb13=_0x3acd56[_0x3450('0x1d')][_0x3450('0x17')][_0x3450('0x46')];return new Promise(function(_0x322639,_0x670423){return db[_0x3450('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x508d01},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3450('0x21')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4a7fd7+_0x3450('0x47')),'$gt':db[_0x3450('0x21')][_0x3450('0x35')](_0x3450('0x48'))}},'UserId':{'$in':_0xabbb13}},'include':[{'model':db[_0x3450('0x20')],'as':_0x3450('0x26')},{'model':db[_0x3450('0x49')],'as':_0x3450('0x27'),'attributes':['id',_0x3450('0x4a'),'voicePause']},{'model':db[_0x3450('0x4b')],'as':'List'}]})[_0x3450('0xe')](function(_0x5f44ac){if(_0x5f44ac[_0x3450('0x2d')]>0x0){return db[_0x3450('0x21')]['transaction'](function(_0x4cdf49){return db['CmHopper'][_0x3450('0x1c')]({'recallmeNotifiedDate':db[_0x3450('0x21')]['literal'](_0x3450('0x48'))},{'where':{'id':{'$in':_[_0x3450('0xb')](_0x5f44ac,'id')}},'transaction':_0x4cdf49})[_0x3450('0xe')](function(){_0x322639(_0x5f44ac);})[_0x3450('0x12')](function(_0x929e43){logger[_0x3450('0x13')](_0x3450('0x44'),_0x929e43[_0x3450('0x14')],_0x3acd56);_0x670423(_0x1bfa8e[_0x3450('0x13')](0x1f4,_0x929e43[_0x3450('0x14')]));});})[_0x3450('0x12')](function(_0x1237f1){logger[_0x3450('0x13')](_0x3450('0x44'),_0x1237f1[_0x3450('0x14')],_0x3acd56);_0x670423(_0x1bfa8e[_0x3450('0x13')](0x1f4,_0x1237f1['message']));});}else{_0x322639(_0x5f44ac);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index e5e662e..e37f04a 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 _0x941b=['delete','exports','express','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','getPreview','/timezone','getTimezone','update'];(function(_0x5b91dd,_0x2dfc38){var _0xf4117a=function(_0x5cb686){while(--_0x5cb686){_0x5b91dd['push'](_0x5b91dd['shift']());}};_0xf4117a(++_0x2dfc38);}(_0x941b,0x8e));var _0xb941=function(_0x2019d2,_0x5ec7d5){_0x2019d2=_0x2019d2-0x0;var _0x477b92=_0x941b[_0x2019d2];return _0x477b92;};'use strict';var express=require(_0xb941('0x0'));var router=express['Router']();var auth=require(_0xb941('0x1'));var controller=require(_0xb941('0x2'));router[_0xb941('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb941('0x3')](_0xb941('0x4'),auth[_0xb941('0x5')](),controller[_0xb941('0x6')]);router[_0xb941('0x3')](_0xb941('0x7'),auth[_0xb941('0x5')](),controller['getOpenContacts']);router[_0xb941('0x3')](_0xb941('0x8'),auth[_0xb941('0x5')](),controller[_0xb941('0x9')]);router['get'](_0xb941('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb941('0xb'),auth[_0xb941('0x5')](),controller[_0xb941('0xc')]);router[_0xb941('0xd')]('/',auth[_0xb941('0x5')](),controller['create']);router[_0xb941('0xd')]('/preview',auth[_0xb941('0x5')](),controller[_0xb941('0xe')]);router[_0xb941('0xd')](_0xb941('0xf'),auth['isAuthenticated'](),controller[_0xb941('0x10')]);router['put']('/:id',auth[_0xb941('0x5')](),controller[_0xb941('0x11')]);router[_0xb941('0x12')]('/:id',auth[_0xb941('0x5')](),controller['destroy']);module[_0xb941('0x13')]=router; \ No newline at end of file +var _0x56f3=['getTimezone','put','update','delete','exports','express','Router','./cmHopper.controller','index','get','/describe','isAuthenticated','describe','/opencontacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone'];(function(_0x2181ab,_0xd969dc){var _0x2c38ab=function(_0x12f0b2){while(--_0x12f0b2){_0x2181ab['push'](_0x2181ab['shift']());}};_0x2c38ab(++_0xd969dc);}(_0x56f3,0x78));var _0x356f=function(_0x49e511,_0x42b172){_0x49e511=_0x49e511-0x0;var _0x5b9853=_0x56f3[_0x49e511];return _0x5b9853;};'use strict';var express=require(_0x356f('0x0'));var router=express[_0x356f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x356f('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x356f('0x3')]);router[_0x356f('0x4')](_0x356f('0x5'),auth[_0x356f('0x6')](),controller[_0x356f('0x7')]);router[_0x356f('0x4')](_0x356f('0x8'),auth[_0x356f('0x6')](),controller['getOpenContacts']);router[_0x356f('0x4')]('/timezones',auth[_0x356f('0x6')](),controller[_0x356f('0x9')]);router['get'](_0x356f('0xa'),auth[_0x356f('0x6')](),controller[_0x356f('0xb')]);router[_0x356f('0x4')](_0x356f('0xc'),auth[_0x356f('0x6')](),controller[_0x356f('0xd')]);router[_0x356f('0xe')]('/',auth[_0x356f('0x6')](),controller['create']);router[_0x356f('0xe')](_0x356f('0xf'),auth[_0x356f('0x6')](),controller[_0x356f('0x10')]);router[_0x356f('0xe')](_0x356f('0x11'),auth[_0x356f('0x6')](),controller[_0x356f('0x12')]);router[_0x356f('0x13')](_0x356f('0xa'),auth[_0x356f('0x6')](),controller[_0x356f('0x14')]);router[_0x356f('0x15')](_0x356f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x356f('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8967134..7dd2a2b 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 _0x1ce6=['sequelize','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x54d24b,_0x4c07ba){var _0xe89b42=function(_0x17631b){while(--_0x17631b){_0x54d24b['push'](_0x54d24b['shift']());}};_0xe89b42(++_0x4c07ba);}(_0x1ce6,0x65));var _0x61ce=function(_0x278b72,_0xeb5c14){_0x278b72=_0x278b72-0x0;var _0x422d25=_0x1ce6[_0x278b72];return _0x422d25;};'use strict';var moment=require(_0x61ce('0x0'));var Sequelize=require(_0x61ce('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x61ce('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x61ce('0x3')],'defaultValue':moment()[_0x61ce('0x4')](_0x61ce('0x5'))},'countbusyretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5bf9=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER','DATE','format'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5bf9,0x181));var _0x95bf=function(_0x44279e,_0xe0f8fd){_0x44279e=_0x44279e-0x0;var _0x63c0c8=_0x5bf9[_0x44279e];return _0x63c0c8;};'use strict';var moment=require(_0x95bf('0x0'));var Sequelize=require(_0x95bf('0x1'));module[_0x95bf('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x95bf('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x95bf('0x5')],'defaultValue':moment()[_0x95bf('0x6')](_0x95bf('0x7'))},'countbusyretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x95bf('0x4')],'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 f4deabf..f2afc2f 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 _0xda20=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','CmHopperAdditionalPhones','destroy','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5dc129,_0x190ca0){var _0x4820e9=function(_0x35f227){while(--_0x35f227){_0x5dc129['push'](_0x5dc129['shift']());}};_0x4820e9(++_0x190ca0);}(_0xda20,0x18c));var _0x0da2=function(_0x8cb7ee,_0x10a869){_0x8cb7ee=_0x8cb7ee-0x0;var _0x3203ce=_0xda20[_0x8cb7ee];return _0x3203ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0da2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0da2('0x1'));var rp=require(_0x0da2('0x2'));var moment=require(_0x0da2('0x3'));var BPromise=require(_0x0da2('0x4'));var Mustache=require(_0x0da2('0x5'));var util=require(_0x0da2('0x6'));var path=require(_0x0da2('0x7'));var sox=require(_0x0da2('0x8'));var csv=require(_0x0da2('0x9'));var ejs=require(_0x0da2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0da2('0xb'));var squel=require(_0x0da2('0xc'));var crypto=require(_0x0da2('0xd'));var jsforce=require(_0x0da2('0xe'));var deskjs=require(_0x0da2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0da2('0x10'));var Papa=require(_0x0da2('0x11'));var Redis=require(_0x0da2('0x12'));var authService=require(_0x0da2('0x13'));var qs=require(_0x0da2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0da2('0x15'))(_0x0da2('0x16'));var utils=require(_0x0da2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0da2('0x18'));var db=require(_0x0da2('0x19'))['db'];function respondWithStatusCode(_0x31e0ce,_0x3e6503){_0x3e6503=_0x3e6503||0xcc;return function(_0xe46861){if(_0xe46861){return _0x31e0ce[_0x0da2('0x1a')](_0x3e6503);}return _0x31e0ce[_0x0da2('0x1b')](_0x3e6503)[_0x0da2('0x1c')]();};}function respondWithResult(_0x468c1c,_0x23a90f){_0x23a90f=_0x23a90f||0xc8;return function(_0x5f3b9b){if(_0x5f3b9b){return _0x468c1c['status'](_0x23a90f)['json'](_0x5f3b9b);}};}function respondWithFilteredResult(_0x386b99,_0x4c1d38){return function(_0x44e150){if(_0x44e150){var _0x26e352=typeof _0x4c1d38[_0x0da2('0x1d')]===_0x0da2('0x1e')&&typeof _0x4c1d38[_0x0da2('0x1f')]===_0x0da2('0x1e');var _0x215a1c=_0x44e150[_0x0da2('0x20')];var _0xf522c4=_0x26e352?0x0:_0x4c1d38[_0x0da2('0x1d')];var _0x7aa20e=_0x26e352?_0x44e150['count']:_0x4c1d38[_0x0da2('0x1d')]+_0x4c1d38[_0x0da2('0x1f')];var _0x34e94f;if(_0x7aa20e>=_0x215a1c){_0x7aa20e=_0x215a1c;_0x34e94f=0xc8;}else{_0x34e94f=0xce;}_0x386b99[_0x0da2('0x1b')](_0x34e94f);return _0x386b99[_0x0da2('0x21')](_0x0da2('0x22'),_0xf522c4+'-'+_0x7aa20e+'/'+_0x215a1c)[_0x0da2('0x23')](_0x44e150);}return null;};}function patchUpdates(_0xd3b168){return function(_0x4151a3){try{jsonpatch[_0x0da2('0x24')](_0x4151a3,_0xd3b168,!![]);}catch(_0x6c2d39){return BPromise[_0x0da2('0x25')](_0x6c2d39);}return _0x4151a3[_0x0da2('0x26')]();};}function saveUpdates(_0x1e6ad7,_0x552d62){return function(_0x5c509a){if(_0x5c509a){return _0x5c509a[_0x0da2('0x27')](_0x1e6ad7)[_0x0da2('0x28')](function(_0x240b55){return _0x240b55;});}return null;};}function removeEntity(_0xcff850,_0x238591){return function(_0x5d0beb){if(_0x5d0beb){return _0x5d0beb['destroy']()['then'](function(){var _0x518a9e=_0x5d0beb['get']({'plain':!![]});var _0x5441ad=_0x0da2('0x29');return db['UserProfileResource'][_0x0da2('0x2a')]({'where':{'type':_0x5441ad,'resourceId':_0x518a9e['id']}})[_0x0da2('0x28')](function(){return _0x5d0beb;});})[_0x0da2('0x28')](function(){_0xcff850[_0x0da2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa588d5,_0x257d04){return function(_0x5035c4){if(!_0x5035c4){_0xa588d5['sendStatus'](0x194);}return _0x5035c4;};}function handleError(_0x965916,_0x359bf0){_0x359bf0=_0x359bf0||0x1f4;return function(_0x4eef6e){logger[_0x0da2('0x2b')](_0x4eef6e['stack']);if(_0x4eef6e[_0x0da2('0x2c')]){delete _0x4eef6e['name'];}_0x965916['status'](_0x359bf0)['send'](_0x4eef6e);};}exports[_0x0da2('0x2d')]=function(_0xdcc642,_0x487064){var _0x1adfcc={},_0x382e4e={},_0x4677bd={'count':0x0,'rows':[]};var _0x37614d=_[_0x0da2('0x2e')](db[_0x0da2('0x2f')][_0x0da2('0x30')],function(_0x290006){return{'name':_0x290006[_0x0da2('0x31')],'type':_0x290006[_0x0da2('0x32')][_0x0da2('0x33')]};});_0x382e4e[_0x0da2('0x34')]=_[_0x0da2('0x2e')](_0x37614d,_0x0da2('0x2c'));_0x382e4e[_0x0da2('0x35')]=_[_0x0da2('0x36')](_0xdcc642[_0x0da2('0x35')]);_0x382e4e[_0x0da2('0x37')]=_[_0x0da2('0x38')](_0x382e4e[_0x0da2('0x34')],_0x382e4e['query']);_0x1adfcc[_0x0da2('0x39')]=_[_0x0da2('0x38')](_0x382e4e[_0x0da2('0x34')],qs[_0x0da2('0x3a')](_0xdcc642[_0x0da2('0x35')]['fields']));_0x1adfcc[_0x0da2('0x39')]=_0x1adfcc[_0x0da2('0x39')]['length']?_0x1adfcc[_0x0da2('0x39')]:_0x382e4e[_0x0da2('0x34')];if(!_0xdcc642[_0x0da2('0x35')]['hasOwnProperty'](_0x0da2('0x3b'))){_0x1adfcc[_0x0da2('0x1f')]=qs[_0x0da2('0x1f')](_0xdcc642['query'][_0x0da2('0x1f')]);_0x1adfcc[_0x0da2('0x1d')]=qs[_0x0da2('0x1d')](_0xdcc642['query'][_0x0da2('0x1d')]);}_0x1adfcc[_0x0da2('0x3c')]=qs[_0x0da2('0x3d')](_0xdcc642[_0x0da2('0x35')][_0x0da2('0x3d')]);_0x1adfcc[_0x0da2('0x3e')]=qs[_0x0da2('0x37')](_[_0x0da2('0x3f')](_0xdcc642[_0x0da2('0x35')],_0x382e4e[_0x0da2('0x37')]),_0x37614d);if(_0xdcc642['query']['filter']){_0x1adfcc[_0x0da2('0x3e')]=_[_0x0da2('0x40')](_0x1adfcc[_0x0da2('0x3e')],{'$or':_[_0x0da2('0x2e')](_0x37614d,function(_0x16cd62){if(_0x16cd62[_0x0da2('0x32')]!==_0x0da2('0x41')){var _0x4eedb6={};_0x4eedb6[_0x16cd62[_0x0da2('0x2c')]]={'$like':'%'+_0xdcc642[_0x0da2('0x35')]['filter']+'%'};return _0x4eedb6;}})});}_0x1adfcc=_[_0x0da2('0x40')]({},_0x1adfcc,_0xdcc642[_0x0da2('0x42')]);var _0x5456aa={'where':_0x1adfcc[_0x0da2('0x3e')]};return db[_0x0da2('0x2f')][_0x0da2('0x20')](_0x5456aa)[_0x0da2('0x28')](function(_0x162413){_0x4677bd[_0x0da2('0x20')]=_0x162413;if(_0xdcc642[_0x0da2('0x35')][_0x0da2('0x43')]){_0x1adfcc[_0x0da2('0x44')]=[{'all':!![]}];}return db[_0x0da2('0x2f')]['findAll'](_0x1adfcc);})[_0x0da2('0x28')](function(_0x5252b6){_0x4677bd['rows']=_0x5252b6;return _0x4677bd;})[_0x0da2('0x28')](respondWithFilteredResult(_0x487064,_0x1adfcc))['catch'](handleError(_0x487064,null));};exports[_0x0da2('0x45')]=function(_0x3ed35b,_0x115782){var _0x14626a={'raw':!![],'where':{'id':_0x3ed35b[_0x0da2('0x46')]['id']}},_0x33be7d={};_0x33be7d[_0x0da2('0x34')]=_[_0x0da2('0x36')](db[_0x0da2('0x2f')][_0x0da2('0x30')]);_0x33be7d[_0x0da2('0x35')]=_[_0x0da2('0x36')](_0x3ed35b['query']);_0x33be7d[_0x0da2('0x37')]=_['intersection'](_0x33be7d['model'],_0x33be7d['query']);_0x14626a['attributes']=_[_0x0da2('0x38')](_0x33be7d[_0x0da2('0x34')],qs[_0x0da2('0x3a')](_0x3ed35b['query'][_0x0da2('0x3a')]));_0x14626a['attributes']=_0x14626a['attributes'][_0x0da2('0x47')]?_0x14626a[_0x0da2('0x39')]:_0x33be7d[_0x0da2('0x34')];if(_0x3ed35b[_0x0da2('0x35')][_0x0da2('0x43')]){_0x14626a[_0x0da2('0x44')]=[{'all':!![]}];}_0x14626a=_[_0x0da2('0x40')]({},_0x14626a,_0x3ed35b[_0x0da2('0x42')]);return db[_0x0da2('0x2f')][_0x0da2('0x48')](_0x14626a)[_0x0da2('0x28')](handleEntityNotFound(_0x115782,null))[_0x0da2('0x28')](respondWithResult(_0x115782,null))['catch'](handleError(_0x115782,null));};exports['create']=function(_0x51563b,_0x14d91c){return db[_0x0da2('0x2f')][_0x0da2('0x49')](_0x51563b[_0x0da2('0x4a')],{})[_0x0da2('0x28')](function(_0x137620){var _0x574b6c=_0x51563b[_0x0da2('0x4b')][_0x0da2('0x4c')]({'plain':!![]});if(!_0x574b6c)throw new Error(_0x0da2('0x4d'));if(_0x574b6c['role']===_0x0da2('0x4b')){var _0x4df44d=_0x137620[_0x0da2('0x4c')]({'plain':!![]});var _0x5a7dfd='CmHopperAdditionalPhones';return db[_0x0da2('0x4e')][_0x0da2('0x48')]({'where':{'name':_0x5a7dfd,'userProfileId':_0x574b6c[_0x0da2('0x4f')]},'raw':!![]})[_0x0da2('0x28')](function(_0x50779b){if(_0x50779b&&_0x50779b[_0x0da2('0x50')]===0x0){return db[_0x0da2('0x51')]['create']({'name':_0x4df44d[_0x0da2('0x2c')],'resourceId':_0x4df44d['id'],'type':_0x50779b[_0x0da2('0x2c')],'sectionId':_0x50779b['id']},{})[_0x0da2('0x28')](function(){return _0x137620;});}else{return _0x137620;}})['catch'](function(_0x14ad90){logger[_0x0da2('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14ad90);throw _0x14ad90;});}return _0x137620;})[_0x0da2('0x28')](respondWithResult(_0x14d91c,0xc9))[_0x0da2('0x52')](handleError(_0x14d91c,null));};exports['update']=function(_0x39cc4f,_0x3181cb){if(_0x39cc4f['body']['id']){delete _0x39cc4f[_0x0da2('0x4a')]['id'];}return db[_0x0da2('0x2f')][_0x0da2('0x48')]({'where':{'id':_0x39cc4f['params']['id']}})[_0x0da2('0x28')](handleEntityNotFound(_0x3181cb,null))[_0x0da2('0x28')](saveUpdates(_0x39cc4f[_0x0da2('0x4a')],null))[_0x0da2('0x28')](respondWithResult(_0x3181cb,null))['catch'](handleError(_0x3181cb,null));};exports[_0x0da2('0x2a')]=function(_0x3f337e,_0x157a30){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x3f337e[_0x0da2('0x46')]['id']}})[_0x0da2('0x28')](handleEntityNotFound(_0x157a30,null))[_0x0da2('0x28')](removeEntity(_0x157a30,null))[_0x0da2('0x52')](handleError(_0x157a30,null));}; \ No newline at end of file +var _0x5809=['options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x5d9c3d,_0x394b71){var _0x379cce=function(_0x6354a6){while(--_0x6354a6){_0x5d9c3d['push'](_0x5d9c3d['shift']());}};_0x379cce(++_0x394b71);}(_0x5809,0x192));var _0x9580=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5809[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9580('0x0'));var zipdir=require(_0x9580('0x1'));var jsonpatch=require(_0x9580('0x2'));var rp=require(_0x9580('0x3'));var moment=require(_0x9580('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9580('0x5'));var util=require('util');var path=require(_0x9580('0x6'));var sox=require(_0x9580('0x7'));var csv=require(_0x9580('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9580('0x9'));var _=require('lodash');var squel=require(_0x9580('0xa'));var crypto=require('crypto');var jsforce=require(_0x9580('0xb'));var deskjs=require(_0x9580('0xc'));var toCsv=require(_0x9580('0x8'));var querystring=require(_0x9580('0xd'));var Papa=require(_0x9580('0xe'));var Redis=require(_0x9580('0xf'));var authService=require(_0x9580('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9580('0x11'));var hardwareService=require(_0x9580('0x12'));var logger=require(_0x9580('0x13'))('api');var utils=require(_0x9580('0x14'));var config=require(_0x9580('0x15'));var licenseUtil=require(_0x9580('0x16'));var db=require(_0x9580('0x17'))['db'];function respondWithStatusCode(_0xf4a003,_0x4076f7){_0x4076f7=_0x4076f7||0xcc;return function(_0x2684fa){if(_0x2684fa){return _0xf4a003['sendStatus'](_0x4076f7);}return _0xf4a003[_0x9580('0x18')](_0x4076f7)[_0x9580('0x19')]();};}function respondWithResult(_0x102c2a,_0xed2a69){_0xed2a69=_0xed2a69||0xc8;return function(_0x476238){if(_0x476238){return _0x102c2a[_0x9580('0x18')](_0xed2a69)[_0x9580('0x1a')](_0x476238);}};}function respondWithFilteredResult(_0x5119f3,_0x4b1fdf){return function(_0x27ac01){if(_0x27ac01){var _0x40877a=typeof _0x4b1fdf[_0x9580('0x1b')]===_0x9580('0x1c')&&typeof _0x4b1fdf[_0x9580('0x1d')]===_0x9580('0x1c');var _0x56c8e3=_0x27ac01[_0x9580('0x1e')];var _0xb355c1=_0x40877a?0x0:_0x4b1fdf[_0x9580('0x1b')];var _0xc53761=_0x40877a?_0x27ac01[_0x9580('0x1e')]:_0x4b1fdf[_0x9580('0x1b')]+_0x4b1fdf[_0x9580('0x1d')];var _0x603508;if(_0xc53761>=_0x56c8e3){_0xc53761=_0x56c8e3;_0x603508=0xc8;}else{_0x603508=0xce;}_0x5119f3[_0x9580('0x18')](_0x603508);return _0x5119f3[_0x9580('0x1f')](_0x9580('0x20'),_0xb355c1+'-'+_0xc53761+'/'+_0x56c8e3)[_0x9580('0x1a')](_0x27ac01);}return null;};}function patchUpdates(_0x3d2668){return function(_0x3a0de8){try{jsonpatch[_0x9580('0x21')](_0x3a0de8,_0x3d2668,!![]);}catch(_0x5b8387){return BPromise[_0x9580('0x22')](_0x5b8387);}return _0x3a0de8['save']();};}function saveUpdates(_0x2c3c26,_0x38cfe0){return function(_0x273b45){if(_0x273b45){return _0x273b45['update'](_0x2c3c26)['then'](function(_0x289fbe){return _0x289fbe;});}return null;};}function removeEntity(_0x930089,_0x13fc79){return function(_0x5bc813){if(_0x5bc813){return _0x5bc813[_0x9580('0x23')]()[_0x9580('0x24')](function(){var _0x3071e4=_0x5bc813[_0x9580('0x25')]({'plain':!![]});var _0xae701a='CmHopperAdditionalPhones';return db[_0x9580('0x26')][_0x9580('0x23')]({'where':{'type':_0xae701a,'resourceId':_0x3071e4['id']}})[_0x9580('0x24')](function(){return _0x5bc813;});})['then'](function(){_0x930089['status'](0xcc)[_0x9580('0x19')]();});}};}function handleEntityNotFound(_0x32c580,_0x1dd210){return function(_0xd063c2){if(!_0xd063c2){_0x32c580['sendStatus'](0x194);}return _0xd063c2;};}function handleError(_0x3e2d22,_0x28ae61){_0x28ae61=_0x28ae61||0x1f4;return function(_0x338fc8){logger[_0x9580('0x27')](_0x338fc8[_0x9580('0x28')]);if(_0x338fc8[_0x9580('0x29')]){delete _0x338fc8[_0x9580('0x29')];}_0x3e2d22[_0x9580('0x18')](_0x28ae61)[_0x9580('0x2a')](_0x338fc8);};}exports['index']=function(_0x43f8f2,_0x5cfcd0){var _0x324a3a={},_0x5b7e26={},_0x15306a={'count':0x0,'rows':[]};var _0x5b3b5f=_[_0x9580('0x2b')](db[_0x9580('0x2c')][_0x9580('0x2d')],function(_0x2c1e04){return{'name':_0x2c1e04['fieldName'],'type':_0x2c1e04[_0x9580('0x2e')]['key']};});_0x5b7e26[_0x9580('0x2f')]=_['map'](_0x5b3b5f,_0x9580('0x29'));_0x5b7e26[_0x9580('0x30')]=_[_0x9580('0x31')](_0x43f8f2[_0x9580('0x30')]);_0x5b7e26[_0x9580('0x32')]=_[_0x9580('0x33')](_0x5b7e26[_0x9580('0x2f')],_0x5b7e26[_0x9580('0x30')]);_0x324a3a[_0x9580('0x34')]=_[_0x9580('0x33')](_0x5b7e26[_0x9580('0x2f')],qs[_0x9580('0x35')](_0x43f8f2['query'][_0x9580('0x35')]));_0x324a3a[_0x9580('0x34')]=_0x324a3a[_0x9580('0x34')][_0x9580('0x36')]?_0x324a3a[_0x9580('0x34')]:_0x5b7e26['model'];if(!_0x43f8f2['query'][_0x9580('0x37')](_0x9580('0x38'))){_0x324a3a['limit']=qs[_0x9580('0x1d')](_0x43f8f2[_0x9580('0x30')][_0x9580('0x1d')]);_0x324a3a[_0x9580('0x1b')]=qs[_0x9580('0x1b')](_0x43f8f2['query']['offset']);}_0x324a3a['order']=qs['sort'](_0x43f8f2[_0x9580('0x30')][_0x9580('0x39')]);_0x324a3a[_0x9580('0x3a')]=qs['filters'](_['pick'](_0x43f8f2[_0x9580('0x30')],_0x5b7e26[_0x9580('0x32')]),_0x5b3b5f);if(_0x43f8f2[_0x9580('0x30')][_0x9580('0x3b')]){_0x324a3a['where']=_['merge'](_0x324a3a[_0x9580('0x3a')],{'$or':_['map'](_0x5b3b5f,function(_0x4be17c){if(_0x4be17c['type']!=='VIRTUAL'){var _0x5d4d5c={};_0x5d4d5c[_0x4be17c[_0x9580('0x29')]]={'$like':'%'+_0x43f8f2[_0x9580('0x30')]['filter']+'%'};return _0x5d4d5c;}})});}_0x324a3a=_['merge']({},_0x324a3a,_0x43f8f2[_0x9580('0x3c')]);var _0x5df9ae={'where':_0x324a3a[_0x9580('0x3a')]};return db[_0x9580('0x2c')]['count'](_0x5df9ae)[_0x9580('0x24')](function(_0x4c0f48){_0x15306a[_0x9580('0x1e')]=_0x4c0f48;if(_0x43f8f2[_0x9580('0x30')][_0x9580('0x3d')]){_0x324a3a[_0x9580('0x3e')]=[{'all':!![]}];}return db[_0x9580('0x2c')]['findAll'](_0x324a3a);})[_0x9580('0x24')](function(_0x46fd03){_0x15306a[_0x9580('0x3f')]=_0x46fd03;return _0x15306a;})['then'](respondWithFilteredResult(_0x5cfcd0,_0x324a3a))['catch'](handleError(_0x5cfcd0,null));};exports[_0x9580('0x40')]=function(_0x5abb9d,_0x159b06){var _0x2fb57b={'raw':!![],'where':{'id':_0x5abb9d[_0x9580('0x41')]['id']}},_0x177fa6={};_0x177fa6[_0x9580('0x2f')]=_[_0x9580('0x31')](db['CmHopperAdditionalPhone'][_0x9580('0x2d')]);_0x177fa6[_0x9580('0x30')]=_[_0x9580('0x31')](_0x5abb9d['query']);_0x177fa6['filters']=_[_0x9580('0x33')](_0x177fa6['model'],_0x177fa6[_0x9580('0x30')]);_0x2fb57b['attributes']=_[_0x9580('0x33')](_0x177fa6[_0x9580('0x2f')],qs['fields'](_0x5abb9d['query'][_0x9580('0x35')]));_0x2fb57b['attributes']=_0x2fb57b[_0x9580('0x34')][_0x9580('0x36')]?_0x2fb57b[_0x9580('0x34')]:_0x177fa6[_0x9580('0x2f')];if(_0x5abb9d['query']['includeAll']){_0x2fb57b['include']=[{'all':!![]}];}_0x2fb57b=_['merge']({},_0x2fb57b,_0x5abb9d[_0x9580('0x3c')]);return db[_0x9580('0x2c')][_0x9580('0x42')](_0x2fb57b)[_0x9580('0x24')](handleEntityNotFound(_0x159b06,null))[_0x9580('0x24')](respondWithResult(_0x159b06,null))[_0x9580('0x43')](handleError(_0x159b06,null));};exports[_0x9580('0x44')]=function(_0x37cebc,_0xc6e774){return db['CmHopperAdditionalPhone'][_0x9580('0x44')](_0x37cebc[_0x9580('0x45')],{})[_0x9580('0x24')](function(_0x1d1528){var _0x1473fb=_0x37cebc[_0x9580('0x46')][_0x9580('0x25')]({'plain':!![]});if(!_0x1473fb)throw new Error(_0x9580('0x47'));if(_0x1473fb[_0x9580('0x48')]===_0x9580('0x46')){var _0x55d0fa=_0x1d1528[_0x9580('0x25')]({'plain':!![]});var _0x5e7df7=_0x9580('0x49');return db[_0x9580('0x4a')][_0x9580('0x42')]({'where':{'name':_0x5e7df7,'userProfileId':_0x1473fb[_0x9580('0x4b')]},'raw':!![]})[_0x9580('0x24')](function(_0x5956f7){if(_0x5956f7&&_0x5956f7[_0x9580('0x4c')]===0x0){return db[_0x9580('0x26')][_0x9580('0x44')]({'name':_0x55d0fa[_0x9580('0x29')],'resourceId':_0x55d0fa['id'],'type':_0x5956f7['name'],'sectionId':_0x5956f7['id']},{})[_0x9580('0x24')](function(){return _0x1d1528;});}else{return _0x1d1528;}})[_0x9580('0x43')](function(_0x3181e4){logger[_0x9580('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3181e4);throw _0x3181e4;});}return _0x1d1528;})[_0x9580('0x24')](respondWithResult(_0xc6e774,0xc9))[_0x9580('0x43')](handleError(_0xc6e774,null));};exports['update']=function(_0x4c7314,_0x26c5a0){if(_0x4c7314['body']['id']){delete _0x4c7314[_0x9580('0x45')]['id'];}return db['CmHopperAdditionalPhone'][_0x9580('0x42')]({'where':{'id':_0x4c7314[_0x9580('0x41')]['id']}})[_0x9580('0x24')](handleEntityNotFound(_0x26c5a0,null))[_0x9580('0x24')](saveUpdates(_0x4c7314[_0x9580('0x45')],null))['then'](respondWithResult(_0x26c5a0,null))[_0x9580('0x43')](handleError(_0x26c5a0,null));};exports[_0x9580('0x23')]=function(_0xbc92e8,_0x765377){return db[_0x9580('0x2c')]['find']({'where':{'id':_0xbc92e8['params']['id']}})['then'](handleEntityNotFound(_0x765377,null))[_0x9580('0x24')](removeEntity(_0x765377,null))[_0x9580('0x43')](handleError(_0x765377,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d7c80fd..172dd29 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 _0xa230=['util','api','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xa230,0xbe));var _0x0a23=function(_0x5026c6,_0xc32c74){_0x5026c6=_0x5026c6-0x0;var _0xaf240f=_0xa230[_0x5026c6];return _0xaf240f;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));var logger=require('../../config/logger')(_0x0a23('0x1'));var moment=require('moment');var BPromise=require(_0x0a23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a23('0x3'));var config=require(_0x0a23('0x4'));var attributes=require(_0x0a23('0x5'));module[_0x0a23('0x6')]=function(_0x2f8668,_0x295c08){return _0x2f8668[_0x0a23('0x7')](_0x0a23('0x8'),attributes,{'tableName':_0x0a23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a8=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x91c2d3,_0xe8eb80){var _0x2e060c=function(_0x704723){while(--_0x704723){_0x91c2d3['push'](_0x91c2d3['shift']());}};_0x2e060c(++_0xe8eb80);}(_0xc9a8,0x143));var _0x8c9a=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0xc9a8[_0xa4f636];return _0x37e02a;};'use strict';var _=require(_0x8c9a('0x0'));var util=require('util');var logger=require(_0x8c9a('0x1'))(_0x8c9a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c9a('0x3'));var fs=require('fs');var path=require(_0x8c9a('0x4'));var rimraf=require(_0x8c9a('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x8c9a('0x6')]=function(_0x49bf78,_0x319753){return _0x49bf78[_0x8c9a('0x7')](_0x8c9a('0x8'),attributes,{'tableName':_0x8c9a('0x9'),'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 ad670e3..e69a7ff 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 _0xc007=['CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countmachineretry','updatedAt','countcongestionretry','createdAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4c075b,_0x56c2e7){var _0x228448=function(_0x37c25c){while(--_0x37c25c){_0x4c075b['push'](_0x4c075b['shift']());}};_0x228448(++_0x56c2e7);}(_0xc007,0x183));var _0x7c00=function(_0x8a8a47,_0x2e7105){_0x8a8a47=_0x8a8a47-0x0;var _0x45a1c0=_0xc007[_0x8a8a47];return _0x45a1c0;};'use strict';var _=require(_0x7c00('0x0'));var util=require('util');var moment=require(_0x7c00('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c00('0x3'));var logger=require(_0x7c00('0x4'))(_0x7c00('0x5'));var config=require(_0x7c00('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c00('0x7')][_0x7c00('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39df74,_0x15037b,_0x423fc8){return new BPromise(function(_0x53d7bf,_0x232ff6){return client[_0x7c00('0x9')](_0x39df74,_0x423fc8)[_0x7c00('0xa')](function(_0x5b9e62){logger[_0x7c00('0xb')](_0x7c00('0xc'),_0x15037b,'request\x20sent');logger[_0x7c00('0xd')](_0x7c00('0xe'),_0x15037b,_0x7c00('0xf'),JSON[_0x7c00('0x10')](_0x5b9e62));if(_0x5b9e62[_0x7c00('0x11')]){if(_0x5b9e62['error'][_0x7c00('0x12')]===0x1f4){logger[_0x7c00('0x11')](_0x7c00('0xc'),_0x15037b,_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);return _0x232ff6(_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);}logger[_0x7c00('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x15037b,_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);return _0x53d7bf(_0x5b9e62[_0x7c00('0x11')]['message']);}else{logger[_0x7c00('0xb')](_0x7c00('0xc'),_0x15037b,_0x7c00('0xf'));_0x53d7bf(_0x5b9e62[_0x7c00('0x14')][_0x7c00('0x13')]);}})[_0x7c00('0x15')](function(_0x1950da){logger[_0x7c00('0x11')](_0x7c00('0xc'),_0x15037b,_0x1950da);_0x232ff6(_0x1950da);});});}exports[_0x7c00('0x16')]=function(_0x23794a){var _0x262576=this;return new Promise(function(_0x10819f,_0x5a985c){return db[_0x7c00('0x17')][_0x7c00('0x18')]({'raw':!![],'where':{'ContactId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1a')],'ListId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1b')],'VoiceQueueId':_0x23794a[_0x7c00('0x19')]['VoiceQueueId']===undefined?null:_0x23794a[_0x7c00('0x19')][_0x7c00('0x1c')],'CampaignId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1d')]===undefined?null:_0x23794a[_0x7c00('0x19')][_0x7c00('0x1d')]}})[_0x7c00('0xa')](function(_0x13beda){if(_0x13beda!=null){return db[_0x7c00('0x1e')][_0x7c00('0x18')]({'raw':!![],'where':{'CmHopperId':_0x13beda['id'],'OrderBy':{'$gt':_0x13beda[_0x7c00('0x1f')]}},'order':[['OrderBy',_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x26e02d){var _0xca9d6a=0x0;if(_0x26e02d){if(_0x26e02d[_0x7c00('0x21')]+_0x26e02d['countcongestionretry']+_0x26e02d[_0x7c00('0x22')]+_0x26e02d['countnosuchnumberretry']+_0x26e02d[_0x7c00('0x23')]+_0x26e02d[_0x7c00('0x24')]+_0x26e02d['countmachineretry']+_0x26e02d[_0x7c00('0x25')]<_0x23794a[_0x7c00('0x26')][_0x7c00('0x27')])_0xca9d6a=0x1;_0x10819f({'additional':_0xca9d6a});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x13beda['id']},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x4669cb){var _0x297465=0x0;if(_0x4669cb){if(_0x4669cb['countbusyretry']+_0x4669cb['countcongestionretry']+_0x4669cb[_0x7c00('0x22')]+_0x4669cb[_0x7c00('0x28')]+_0x4669cb['countdropretry']+_0x4669cb[_0x7c00('0x24')]+_0x4669cb['countmachineretry']+_0x4669cb['countagentrejectretry']<_0x23794a[_0x7c00('0x26')]['dialGlobalMaxRetry'])_0x297465=0x1;_0x10819f({'additional':_0x297465});}else{_0x10819f({'additional':0x0});}})[_0x7c00('0x15')](function(_0x2bfdec){logger[_0x7c00('0x11')](_0x7c00('0x16'),_0x2bfdec[_0x7c00('0x13')]);_0x5a985c(_0x262576['error'](0x1f4,_0x2bfdec[_0x7c00('0x13')]));});}})[_0x7c00('0x15')](function(_0x5e0034){logger['error'](_0x7c00('0x16'),_0x5e0034[_0x7c00('0x13')]);_0x5a985c(_0x262576[_0x7c00('0x11')](0x1f4,_0x5e0034[_0x7c00('0x13')]));});}else _0x10819f({'additional':0x0});});});};exports[_0x7c00('0x29')]=function(_0x5ae6e2){var _0x5e6f5=this;return new Promise(function(_0xfb8fc9,_0x5250e3){return db[_0x7c00('0x17')][_0x7c00('0x18')]({'raw':!![],'where':{'ContactId':_0x5ae6e2[_0x7c00('0x19')]['ContactId'],'ListId':_0x5ae6e2[_0x7c00('0x19')]['ListId'],'VoiceQueueId':_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1c')]===undefined?null:_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1c')],'CampaignId':_0x5ae6e2['body']['CampaignId']===undefined?null:_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1d')]}})[_0x7c00('0xa')](function(_0x2e79ae){if(_0x2e79ae!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2e79ae['id'],'OrderBy':{'$gte':_0x2e79ae[_0x7c00('0x1f')]}},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})['then'](function(_0x4f1b53){if(_0x4f1b53)return activateAdditionalPhone(_0x2e79ae,_0x5ae6e2[_0x7c00('0x19')],_0x4f1b53,_0x5ae6e2[_0x7c00('0x2a')],_0x5ae6e2[_0x7c00('0x2b')])[_0x7c00('0xa')](function(_0x5b6c4b){_0xfb8fc9(_0x5b6c4b);});else{return db['CmHopperAdditionalPhone'][_0x7c00('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2e79ae['id']},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x40a086){if(_0x40a086)return activateAdditionalPhone(_0x2e79ae,_0x5ae6e2[_0x7c00('0x19')],_0x40a086,_0x5ae6e2[_0x7c00('0x2a')],_0x5ae6e2[_0x7c00('0x2b')])['then'](function(_0x53e58f){_0xfb8fc9(_0x53e58f);});else{_0xfb8fc9({'id':_0x2e79ae['id'],'phone':''});}})['catch'](function(_0x341b68){logger[_0x7c00('0x11')](_0x7c00('0x16'),_0x341b68[_0x7c00('0x13')]);_0x5250e3(_0x5e6f5[_0x7c00('0x11')](0x1f4,_0x341b68[_0x7c00('0x13')]));});}})['catch'](function(_0xc1da47){logger[_0x7c00('0x11')]('VerifyAdditionalPhones',_0xc1da47[_0x7c00('0x13')]);_0x5250e3(_0x5e6f5[_0x7c00('0x11')](0x1f4,_0xc1da47['message']));});}else _0xfb8fc9(0x1);});});};function activateAdditionalPhone(_0x3ad245,_0x437696,_0xc3d551,_0x52c035,_0x8dd1bc){return new Promise(function(_0x42da4e,_0x5ecc15){var _0x11e81f;if(_['isNil'](_0xc3d551[_0x7c00('0x2c')])){_0xc3d551[_0x7c00('0x2c')]=moment();}if(moment()>moment(_0xc3d551['scheduledat'])){_0x11e81f=moment()[_0x7c00('0x2d')](_0x8dd1bc||0x3,_0x7c00('0x2e'));}else{if(_0xc3d551[_0x7c00('0x1f')]==0x0){_0x11e81f=moment(_0xc3d551[_0x7c00('0x2c')]);}else{_0x11e81f=moment()[_0x7c00('0x2d')](_0x8dd1bc||0x3,_0x7c00('0x2e'));}}if(_[_0x7c00('0x2f')](_0x11e81f)){_0x11e81f=moment()['add'](_0x8dd1bc||0x3,_0x7c00('0x2e'));}var _0x38bccb={'phone':_0x3ad245[_0x7c00('0x30')],'active':0x0,'OrderBy':_[_0x7c00('0x2f')](_0x3ad245[_0x7c00('0x1f')])?0x0:_0x3ad245[_0x7c00('0x1f')],'scheduledat':moment()[_0x7c00('0x2d')](_0x52c035||0x1,_0x7c00('0x2e')),'countbusyretry':_0x437696[_0x7c00('0x21')],'countcongestionretry':_0x437696['countcongestionretry'],'countnoanswerretry':_0x437696[_0x7c00('0x22')],'countnosuchnumberretry':_0x437696[_0x7c00('0x28')],'countdropretry':_0x437696[_0x7c00('0x23')],'countabandonedretry':_0x437696[_0x7c00('0x24')],'countmachineretry':_0x437696[_0x7c00('0x31')],'countagentrejectretry':_0x437696[_0x7c00('0x25')],'createdAt':_0x437696['createdAt'],'updatedAt':_0x437696[_0x7c00('0x32')]};var _0x3848b4={'CmHopperId':_0x3ad245['id'],'phone':_0xc3d551[_0x7c00('0x30')],'active':0x0,'OrderBy':_[_0x7c00('0x2f')](_0xc3d551[_0x7c00('0x1f')])?0x0:_0xc3d551[_0x7c00('0x1f')],'scheduledat':_0x11e81f,'countbusyretry':_0xc3d551[_0x7c00('0x21')],'countcongestionretry':_0xc3d551[_0x7c00('0x33')],'countnoanswerretry':_0xc3d551[_0x7c00('0x22')],'countnosuchnumberretry':_0xc3d551[_0x7c00('0x28')],'countdropretry':_0xc3d551['countdropretry'],'countabandonedretry':_0xc3d551[_0x7c00('0x24')],'countmachineretry':_0xc3d551[_0x7c00('0x31')],'countagentrejectretry':_0xc3d551[_0x7c00('0x25')],'createdAt':_0xc3d551[_0x7c00('0x34')],'updatedAt':_0xc3d551['updatedAt']};return db[_0x7c00('0x35')][_0x7c00('0x36')](function(_0x33df00){return db[_0x7c00('0x1e')]['update'](_0x38bccb,{'where':{'id':_0xc3d551['id']}},{'transaction':_0x33df00})[_0x7c00('0xa')](function(){return db['CmHopper'][_0x7c00('0x37')](_0x3848b4,{'where':{'id':_0x3ad245['id']}},{'transaction':_0x33df00});});})['then'](function(_0x3a995d){_0x42da4e({'id':_0x3ad245['id'],'phone':_0xc3d551[_0x7c00('0x30')]});})[_0x7c00('0x15')](function(_0x52c66a){logger[_0x7c00('0x11')]('activateAdditionalPhone',_0x52c66a[_0x7c00('0x13')]);_0x5ecc15({'error':_0x52c66a[_0x7c00('0x13')]});});});}exports[_0x7c00('0x38')]=function(_0x5c60f7){var _0x2b85e2=this;return new Promise(function(_0x1940e4,_0x1bea7b){return db[_0x7c00('0x17')]['update'](_0x5c60f7[_0x7c00('0x19')]['field'],{'where':{'id':_0x5c60f7['body']['id']}})[_0x7c00('0xa')](function(_0x25de78){_0x1940e4(_0x25de78);})[_0x7c00('0x15')](function(_0x1af7ee){logger['error'](_0x7c00('0x38'),_0x1af7ee['message']);_0x1bea7b(_0x2b85e2[_0x7c00('0x11')](0x1f4,_0x1af7ee[_0x7c00('0x13')]));});});}; \ No newline at end of file +var _0x79c7=['ContactId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countmachineretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body'];(function(_0x2e73df,_0x244109){var _0x6dea09=function(_0xd4fa08){while(--_0xd4fa08){_0x2e73df['push'](_0x2e73df['shift']());}};_0x6dea09(++_0x244109);}(_0x79c7,0xcd));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require('util');var moment=require(_0x779c('0x1'));var BPromise=require(_0x779c('0x2'));var rs=require(_0x779c('0x3'));var fs=require('fs');var Redis=require(_0x779c('0x4'));var db=require(_0x779c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x779c('0x6'))(_0x779c('0x7'));var config=require('../../config/environment');var jayson=require(_0x779c('0x8'));var client=jayson[_0x779c('0x9')][_0x779c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x540aa0,_0x5b09b7,_0x331660){return new BPromise(function(_0x371e6c,_0xeb09e7){return client[_0x779c('0xb')](_0x540aa0,_0x331660)[_0x779c('0xc')](function(_0x2be3b7){logger[_0x779c('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b09b7,_0x779c('0xe'));logger[_0x779c('0xf')](_0x779c('0x10'),_0x5b09b7,_0x779c('0xe'),JSON[_0x779c('0x11')](_0x2be3b7));if(_0x2be3b7['error']){if(_0x2be3b7[_0x779c('0x12')][_0x779c('0x13')]===0x1f4){logger[_0x779c('0x12')](_0x779c('0x14'),_0x5b09b7,_0x2be3b7[_0x779c('0x12')][_0x779c('0x15')]);return _0xeb09e7(_0x2be3b7['error'][_0x779c('0x15')]);}logger[_0x779c('0x12')](_0x779c('0x14'),_0x5b09b7,_0x2be3b7[_0x779c('0x12')][_0x779c('0x15')]);return _0x371e6c(_0x2be3b7['error']['message']);}else{logger[_0x779c('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b09b7,_0x779c('0xe'));_0x371e6c(_0x2be3b7['result'][_0x779c('0x15')]);}})[_0x779c('0x16')](function(_0x39696d){logger['error'](_0x779c('0x14'),_0x5b09b7,_0x39696d);_0xeb09e7(_0x39696d);});});}exports[_0x779c('0x17')]=function(_0xf9b4c4){var _0x48a61e=this;return new Promise(function(_0x48663a,_0x301f93){return db[_0x779c('0x18')][_0x779c('0x19')]({'raw':!![],'where':{'ContactId':_0xf9b4c4[_0x779c('0x1a')][_0x779c('0x1b')],'ListId':_0xf9b4c4[_0x779c('0x1a')]['ListId'],'VoiceQueueId':_0xf9b4c4['body'][_0x779c('0x1c')]===undefined?null:_0xf9b4c4[_0x779c('0x1a')][_0x779c('0x1c')],'CampaignId':_0xf9b4c4[_0x779c('0x1a')][_0x779c('0x1d')]===undefined?null:_0xf9b4c4[_0x779c('0x1a')][_0x779c('0x1d')]}})[_0x779c('0xc')](function(_0x5af73f){if(_0x5af73f!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5af73f['id'],'OrderBy':{'$gt':_0x5af73f['OrderBy']}},'order':[[_0x779c('0x1e'),_0x779c('0x1f')]]})['then'](function(_0x307f6d){var _0xc4ec5d=0x0;if(_0x307f6d){if(_0x307f6d[_0x779c('0x20')]+_0x307f6d[_0x779c('0x21')]+_0x307f6d[_0x779c('0x22')]+_0x307f6d[_0x779c('0x23')]+_0x307f6d[_0x779c('0x24')]+_0x307f6d[_0x779c('0x25')]+_0x307f6d['countmachineretry']+_0x307f6d[_0x779c('0x26')]<_0xf9b4c4[_0x779c('0x27')][_0x779c('0x28')])_0xc4ec5d=0x1;_0x48663a({'additional':_0xc4ec5d});}else{return db[_0x779c('0x29')][_0x779c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5af73f['id']},'order':[[_0x779c('0x1e'),_0x779c('0x1f')]]})[_0x779c('0xc')](function(_0x51e13f){var _0x4ec3e1=0x0;if(_0x51e13f){if(_0x51e13f[_0x779c('0x20')]+_0x51e13f[_0x779c('0x21')]+_0x51e13f['countnoanswerretry']+_0x51e13f['countnosuchnumberretry']+_0x51e13f[_0x779c('0x24')]+_0x51e13f['countabandonedretry']+_0x51e13f[_0x779c('0x2a')]+_0x51e13f[_0x779c('0x26')]<_0xf9b4c4[_0x779c('0x27')]['dialGlobalMaxRetry'])_0x4ec3e1=0x1;_0x48663a({'additional':_0x4ec3e1});}else{_0x48663a({'additional':0x0});}})[_0x779c('0x16')](function(_0x422e9a){logger['error']('VerifyAdditionalPhones',_0x422e9a[_0x779c('0x15')]);_0x301f93(_0x48a61e[_0x779c('0x12')](0x1f4,_0x422e9a[_0x779c('0x15')]));});}})[_0x779c('0x16')](function(_0x2c32ea){logger[_0x779c('0x12')]('VerifyAdditionalPhones',_0x2c32ea[_0x779c('0x15')]);_0x301f93(_0x48a61e[_0x779c('0x12')](0x1f4,_0x2c32ea[_0x779c('0x15')]));});}else _0x48663a({'additional':0x0});});});};exports[_0x779c('0x2b')]=function(_0x3abc52){var _0x100127=this;return new Promise(function(_0x42f29c,_0x2b3b0e){return db['CmHopper'][_0x779c('0x19')]({'raw':!![],'where':{'ContactId':_0x3abc52[_0x779c('0x1a')][_0x779c('0x1b')],'ListId':_0x3abc52[_0x779c('0x1a')]['ListId'],'VoiceQueueId':_0x3abc52[_0x779c('0x1a')][_0x779c('0x1c')]===undefined?null:_0x3abc52[_0x779c('0x1a')][_0x779c('0x1c')],'CampaignId':_0x3abc52['body'][_0x779c('0x1d')]===undefined?null:_0x3abc52['body'][_0x779c('0x1d')]}})['then'](function(_0x59cb77){if(_0x59cb77!=null){return db['CmHopperAdditionalPhone'][_0x779c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x59cb77['id'],'OrderBy':{'$gte':_0x59cb77[_0x779c('0x1e')]}},'order':[['OrderBy',_0x779c('0x1f')]]})[_0x779c('0xc')](function(_0x1778cb){if(_0x1778cb)return activateAdditionalPhone(_0x59cb77,_0x3abc52[_0x779c('0x1a')],_0x1778cb,_0x3abc52[_0x779c('0x2c')],_0x3abc52[_0x779c('0x2d')])['then'](function(_0xb130fe){_0x42f29c(_0xb130fe);});else{return db[_0x779c('0x29')][_0x779c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x59cb77['id']},'order':[[_0x779c('0x1e'),_0x779c('0x1f')]]})[_0x779c('0xc')](function(_0x25de45){if(_0x25de45)return activateAdditionalPhone(_0x59cb77,_0x3abc52[_0x779c('0x1a')],_0x25de45,_0x3abc52[_0x779c('0x2c')],_0x3abc52[_0x779c('0x2d')])['then'](function(_0x481be6){_0x42f29c(_0x481be6);});else{_0x42f29c({'id':_0x59cb77['id'],'phone':''});}})[_0x779c('0x16')](function(_0x111b98){logger[_0x779c('0x12')](_0x779c('0x17'),_0x111b98[_0x779c('0x15')]);_0x2b3b0e(_0x100127[_0x779c('0x12')](0x1f4,_0x111b98[_0x779c('0x15')]));});}})[_0x779c('0x16')](function(_0x2696c9){logger[_0x779c('0x12')](_0x779c('0x17'),_0x2696c9['message']);_0x2b3b0e(_0x100127[_0x779c('0x12')](0x1f4,_0x2696c9[_0x779c('0x15')]));});}else _0x42f29c(0x1);});});};function activateAdditionalPhone(_0x230515,_0x47d972,_0x4812df,_0x2f00f3,_0x19bf10){return new Promise(function(_0x1ed74a,_0x40662c){var _0x46589a;if(_[_0x779c('0x2e')](_0x4812df['scheduledat'])){_0x4812df[_0x779c('0x2f')]=moment();}if(moment()>moment(_0x4812df[_0x779c('0x2f')])){_0x46589a=moment()[_0x779c('0x30')](_0x19bf10||0x3,_0x779c('0x31'));}else{if(_0x4812df[_0x779c('0x1e')]==0x0){_0x46589a=moment(_0x4812df[_0x779c('0x2f')]);}else{_0x46589a=moment()[_0x779c('0x30')](_0x19bf10||0x3,_0x779c('0x31'));}}if(_['isNil'](_0x46589a)){_0x46589a=moment()[_0x779c('0x30')](_0x19bf10||0x3,'minutes');}var _0x4f6932={'phone':_0x230515[_0x779c('0x32')],'active':0x0,'OrderBy':_[_0x779c('0x2e')](_0x230515[_0x779c('0x1e')])?0x0:_0x230515['OrderBy'],'scheduledat':moment()[_0x779c('0x30')](_0x2f00f3||0x1,_0x779c('0x31')),'countbusyretry':_0x47d972[_0x779c('0x20')],'countcongestionretry':_0x47d972[_0x779c('0x21')],'countnoanswerretry':_0x47d972['countnoanswerretry'],'countnosuchnumberretry':_0x47d972[_0x779c('0x23')],'countdropretry':_0x47d972[_0x779c('0x24')],'countabandonedretry':_0x47d972[_0x779c('0x25')],'countmachineretry':_0x47d972[_0x779c('0x2a')],'countagentrejectretry':_0x47d972['countagentrejectretry'],'createdAt':_0x47d972['createdAt'],'updatedAt':_0x47d972[_0x779c('0x33')]};var _0x1b1731={'CmHopperId':_0x230515['id'],'phone':_0x4812df[_0x779c('0x32')],'active':0x0,'OrderBy':_[_0x779c('0x2e')](_0x4812df[_0x779c('0x1e')])?0x0:_0x4812df['OrderBy'],'scheduledat':_0x46589a,'countbusyretry':_0x4812df[_0x779c('0x20')],'countcongestionretry':_0x4812df[_0x779c('0x21')],'countnoanswerretry':_0x4812df[_0x779c('0x22')],'countnosuchnumberretry':_0x4812df[_0x779c('0x23')],'countdropretry':_0x4812df['countdropretry'],'countabandonedretry':_0x4812df[_0x779c('0x25')],'countmachineretry':_0x4812df[_0x779c('0x2a')],'countagentrejectretry':_0x4812df['countagentrejectretry'],'createdAt':_0x4812df[_0x779c('0x34')],'updatedAt':_0x4812df[_0x779c('0x33')]};return db[_0x779c('0x35')][_0x779c('0x36')](function(_0x2af53d){return db[_0x779c('0x29')]['update'](_0x4f6932,{'where':{'id':_0x4812df['id']}},{'transaction':_0x2af53d})[_0x779c('0xc')](function(){return db['CmHopper'][_0x779c('0x37')](_0x1b1731,{'where':{'id':_0x230515['id']}},{'transaction':_0x2af53d});});})[_0x779c('0xc')](function(_0x4b1e90){_0x1ed74a({'id':_0x230515['id'],'phone':_0x4812df[_0x779c('0x32')]});})[_0x779c('0x16')](function(_0x58999d){logger['error'](_0x779c('0x38'),_0x58999d[_0x779c('0x15')]);_0x40662c({'error':_0x58999d['message']});});});}exports[_0x779c('0x39')]=function(_0x229087){var _0x5ed4d3=this;return new Promise(function(_0x2c2f76,_0x465929){return db[_0x779c('0x18')][_0x779c('0x37')](_0x229087['body']['field'],{'where':{'id':_0x229087[_0x779c('0x1a')]['id']}})[_0x779c('0xc')](function(_0x3d3eb0){_0x2c2f76(_0x3d3eb0);})[_0x779c('0x16')](function(_0x4abf83){logger['error']('IncrementPreviewCounters',_0x4abf83[_0x779c('0x15')]);_0x465929(_0x5ed4d3[_0x779c('0x12')](0x1f4,_0x4abf83['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4cae30c..bd48496 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 _0x83e4=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x83e4,0x137));var _0x483e=function(_0x31c66c,_0x10ec18){_0x31c66c=_0x31c66c-0x0;var _0x44158d=_0x83e4[_0x31c66c];return _0x44158d;};'use strict';var multer=require(_0x483e('0x0'));var util=require(_0x483e('0x1'));var path=require('path');var timeout=require(_0x483e('0x2'));var express=require(_0x483e('0x3'));var router=express[_0x483e('0x4')]();var fs_extra=require(_0x483e('0x5'));var auth=require(_0x483e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x483e('0x7'));var controller=require(_0x483e('0x8'));router['get']('/',auth[_0x483e('0x9')](),controller[_0x483e('0xa')]);router[_0x483e('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x483e('0xc')](_0x483e('0xd'),auth['isAuthenticated'](),controller[_0x483e('0xe')]);router['delete'](_0x483e('0xd'),auth[_0x483e('0x9')](),controller[_0x483e('0xf')]);module[_0x483e('0x10')]=router; \ No newline at end of file +var _0xccac=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','update','delete'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xccac,0x1cb));var _0xccca=function(_0x137a70,_0x423af8){_0x137a70=_0x137a70-0x0;var _0x147937=_0xccac[_0x137a70];return _0x147937;};'use strict';var multer=require(_0xccca('0x0'));var util=require(_0xccca('0x1'));var path=require(_0xccca('0x2'));var timeout=require(_0xccca('0x3'));var express=require(_0xccca('0x4'));var router=express[_0xccca('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xccca('0x6'));var config=require('../../config/environment');var controller=require(_0xccca('0x7'));router[_0xccca('0x8')]('/',auth[_0xccca('0x9')](),controller[_0xccca('0xa')]);router[_0xccca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xccca('0xb')]);router[_0xccca('0xc')]('/',auth[_0xccca('0x9')](),controller[_0xccca('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xccca('0xe')]);router[_0xccca('0xf')](_0xccca('0x10'),auth[_0xccca('0x9')](),controller[_0xccca('0x11')]);module[_0xccca('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 057050a..1f7869f 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 _0x3432=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x298717,_0x34befe){var _0x599ca2=function(_0x399e96){while(--_0x399e96){_0x298717['push'](_0x298717['shift']());}};_0x599ca2(++_0x34befe);}(_0x3432,0x182));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x2343('0x0'));var Sequelize=require(_0x2343('0x1'));module[_0x2343('0x2')]={'phone':{'type':Sequelize[_0x2343('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2343('0x4')],'unique':_0x2343('0x5')},'ListId':{'type':Sequelize[_0x2343('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x2343('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x7181=['sequelize','contactListQueue','INTEGER','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7181,0x1ef));var _0x1718=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x7181[_0x54d5ba];return _0x6a592e;};'use strict';var moment=require(_0x1718('0x0'));var Sequelize=require(_0x1718('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1718('0x2')},'ListId':{'type':Sequelize[_0x1718('0x3')],'unique':_0x1718('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1718('0x3')],'unique':_0x1718('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c38f153..9dbfa14 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 _0x9689=['sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','CmHopperBlack','count','includeAll','findAll','rows','catch','show','include','update','find','params','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x1ba95c,_0x5c21cf){var _0x1677b8=function(_0xbca31d){while(--_0xbca31d){_0x1ba95c['push'](_0x1ba95c['shift']());}};_0x1677b8(++_0x5c21cf);}(_0x9689,0xd4));var _0x9968=function(_0x2d5a81,_0x333908){_0x2d5a81=_0x2d5a81-0x0;var _0x2d5e86=_0x9689[_0x2d5a81];return _0x2d5e86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9968('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9968('0x1'));var rp=require(_0x9968('0x2'));var moment=require(_0x9968('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9968('0x4'));var util=require(_0x9968('0x5'));var path=require(_0x9968('0x6'));var sox=require(_0x9968('0x7'));var csv=require('to-csv');var ejs=require(_0x9968('0x8'));var fs=require('fs');var fs_extra=require(_0x9968('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9968('0xa'));var jsforce=require(_0x9968('0xb'));var deskjs=require(_0x9968('0xc'));var toCsv=require(_0x9968('0xd'));var querystring=require(_0x9968('0xe'));var Papa=require(_0x9968('0xf'));var Redis=require(_0x9968('0x10'));var authService=require(_0x9968('0x11'));var qs=require(_0x9968('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9968('0x13'));var logger=require('../../config/logger')(_0x9968('0x14'));var utils=require(_0x9968('0x15'));var config=require(_0x9968('0x16'));var licenseUtil=require(_0x9968('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45167d,_0x560aa5){_0x560aa5=_0x560aa5||0xcc;return function(_0x3ca0a2){if(_0x3ca0a2){return _0x45167d[_0x9968('0x18')](_0x560aa5);}return _0x45167d[_0x9968('0x19')](_0x560aa5)['end']();};}function respondWithResult(_0x2c0ac2,_0x44fd3c){_0x44fd3c=_0x44fd3c||0xc8;return function(_0x3cc909){if(_0x3cc909){return _0x2c0ac2[_0x9968('0x19')](_0x44fd3c)[_0x9968('0x1a')](_0x3cc909);}};}function respondWithFilteredResult(_0x54b5a1,_0x36a6c2){return function(_0x3607e1){if(_0x3607e1){var _0x3ff642=typeof _0x36a6c2['offset']==='undefined'&&typeof _0x36a6c2[_0x9968('0x1b')]===_0x9968('0x1c');var _0x446507=_0x3607e1['count'];var _0x4a59ba=_0x3ff642?0x0:_0x36a6c2[_0x9968('0x1d')];var _0x41d91a=_0x3ff642?_0x3607e1['count']:_0x36a6c2[_0x9968('0x1d')]+_0x36a6c2[_0x9968('0x1b')];var _0x44ecae;if(_0x41d91a>=_0x446507){_0x41d91a=_0x446507;_0x44ecae=0xc8;}else{_0x44ecae=0xce;}_0x54b5a1[_0x9968('0x19')](_0x44ecae);return _0x54b5a1[_0x9968('0x1e')](_0x9968('0x1f'),_0x4a59ba+'-'+_0x41d91a+'/'+_0x446507)[_0x9968('0x1a')](_0x3607e1);}return null;};}function patchUpdates(_0x25bf69){return function(_0x126fcb){try{jsonpatch[_0x9968('0x20')](_0x126fcb,_0x25bf69,!![]);}catch(_0x5f1551){return BPromise[_0x9968('0x21')](_0x5f1551);}return _0x126fcb[_0x9968('0x22')]();};}function saveUpdates(_0x55c7bd,_0x159ff2){return function(_0x57199c){if(_0x57199c){return _0x57199c['update'](_0x55c7bd)[_0x9968('0x23')](function(_0xdb7bc9){return _0xdb7bc9;});}return null;};}function removeEntity(_0x26346b,_0x2474d0){return function(_0x61254f){if(_0x61254f){return _0x61254f[_0x9968('0x24')]()[_0x9968('0x23')](function(){_0x26346b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x331c72,_0x523182){return function(_0x4604a0){if(!_0x4604a0){_0x331c72[_0x9968('0x18')](0x194);}return _0x4604a0;};}function handleError(_0x56e240,_0x1d0fdc){_0x1d0fdc=_0x1d0fdc||0x1f4;return function(_0x3ebb80){logger['error'](_0x3ebb80[_0x9968('0x25')]);if(_0x3ebb80['name']){delete _0x3ebb80[_0x9968('0x26')];}_0x56e240[_0x9968('0x19')](_0x1d0fdc)['send'](_0x3ebb80);};}exports[_0x9968('0x27')]=function(_0x1da2f8,_0x5a8817){var _0x41343e={},_0x7af923={},_0x34fec9={'count':0x0,'rows':[]};var _0x54cb26=_[_0x9968('0x28')](db['CmHopperBlack'][_0x9968('0x29')],function(_0x3d4d8d){return{'name':_0x3d4d8d[_0x9968('0x2a')],'type':_0x3d4d8d[_0x9968('0x2b')]['key']};});_0x7af923['model']=_[_0x9968('0x28')](_0x54cb26,_0x9968('0x26'));_0x7af923[_0x9968('0x2c')]=_[_0x9968('0x2d')](_0x1da2f8[_0x9968('0x2c')]);_0x7af923[_0x9968('0x2e')]=_[_0x9968('0x2f')](_0x7af923[_0x9968('0x30')],_0x7af923[_0x9968('0x2c')]);_0x41343e[_0x9968('0x31')]=_['intersection'](_0x7af923['model'],qs[_0x9968('0x32')](_0x1da2f8[_0x9968('0x2c')]['fields']));_0x41343e[_0x9968('0x31')]=_0x41343e['attributes'][_0x9968('0x33')]?_0x41343e[_0x9968('0x31')]:_0x7af923[_0x9968('0x30')];if(!_0x1da2f8['query'][_0x9968('0x34')]('nolimit')){_0x41343e[_0x9968('0x1b')]=qs['limit'](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x1b')]);_0x41343e[_0x9968('0x1d')]=qs[_0x9968('0x1d')](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x1d')]);}_0x41343e[_0x9968('0x35')]=qs[_0x9968('0x36')](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x36')]);_0x41343e['where']=qs['filters'](_['pick'](_0x1da2f8[_0x9968('0x2c')],_0x7af923[_0x9968('0x2e')]),_0x54cb26);if(_0x1da2f8['query'][_0x9968('0x37')]){_0x41343e[_0x9968('0x38')]=_[_0x9968('0x39')](_0x41343e['where'],{'$or':_[_0x9968('0x28')](_0x54cb26,function(_0x42453a){if(_0x42453a[_0x9968('0x2b')]!==_0x9968('0x3a')){var _0x42dd9e={};_0x42dd9e[_0x42453a[_0x9968('0x26')]]={'$like':'%'+_0x1da2f8['query'][_0x9968('0x37')]+'%'};return _0x42dd9e;}})});}_0x41343e=_['merge']({},_0x41343e,_0x1da2f8[_0x9968('0x3b')]);var _0x107b7c={'where':_0x41343e[_0x9968('0x38')]};return db[_0x9968('0x3c')][_0x9968('0x3d')](_0x107b7c)[_0x9968('0x23')](function(_0xe6eb4f){_0x34fec9[_0x9968('0x3d')]=_0xe6eb4f;if(_0x1da2f8['query'][_0x9968('0x3e')]){_0x41343e['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x9968('0x3f')](_0x41343e);})['then'](function(_0x35c943){_0x34fec9[_0x9968('0x40')]=_0x35c943;return _0x34fec9;})[_0x9968('0x23')](respondWithFilteredResult(_0x5a8817,_0x41343e))[_0x9968('0x41')](handleError(_0x5a8817,null));};exports[_0x9968('0x42')]=function(_0x4c7f97,_0x12152c){var _0x8c903={'raw':!![],'where':{'id':_0x4c7f97['params']['id']}},_0x47a53b={};_0x47a53b[_0x9968('0x30')]=_['keys'](db['CmHopperBlack'][_0x9968('0x29')]);_0x47a53b[_0x9968('0x2c')]=_[_0x9968('0x2d')](_0x4c7f97[_0x9968('0x2c')]);_0x47a53b['filters']=_[_0x9968('0x2f')](_0x47a53b['model'],_0x47a53b[_0x9968('0x2c')]);_0x8c903[_0x9968('0x31')]=_['intersection'](_0x47a53b[_0x9968('0x30')],qs[_0x9968('0x32')](_0x4c7f97[_0x9968('0x2c')]['fields']));_0x8c903['attributes']=_0x8c903[_0x9968('0x31')][_0x9968('0x33')]?_0x8c903[_0x9968('0x31')]:_0x47a53b[_0x9968('0x30')];if(_0x4c7f97['query'][_0x9968('0x3e')]){_0x8c903[_0x9968('0x43')]=[{'all':!![]}];}_0x8c903=_[_0x9968('0x39')]({},_0x8c903,_0x4c7f97[_0x9968('0x3b')]);return db[_0x9968('0x3c')]['find'](_0x8c903)[_0x9968('0x23')](handleEntityNotFound(_0x12152c,null))['then'](respondWithResult(_0x12152c,null))['catch'](handleError(_0x12152c,null));};exports[_0x9968('0x44')]=function(_0x5d862f,_0x43b4e0){if(_0x5d862f['body']['id']){delete _0x5d862f['body']['id'];}return db[_0x9968('0x3c')][_0x9968('0x45')]({'where':{'id':_0x5d862f[_0x9968('0x46')]['id']}})[_0x9968('0x23')](handleEntityNotFound(_0x43b4e0,null))[_0x9968('0x23')](saveUpdates(_0x5d862f[_0x9968('0x47')],null))[_0x9968('0x23')](respondWithResult(_0x43b4e0,null))[_0x9968('0x41')](handleError(_0x43b4e0,null));};exports[_0x9968('0x24')]=function(_0x50b912,_0xe20a2b){return db[_0x9968('0x3c')][_0x9968('0x45')]({'where':{'id':_0x50b912['params']['id']}})[_0x9968('0x23')](handleEntityNotFound(_0xe20a2b,null))[_0x9968('0x23')](removeEntity(_0xe20a2b,null))[_0x9968('0x41')](handleError(_0xe20a2b,null));};exports[_0x9968('0x48')]=function(_0x28e634,_0x304233){return db['CmHopperBlack']['describe']()[_0x9968('0x23')](respondWithResult(_0x304233,null))[_0x9968('0x41')](handleError(_0x304233,null));}; \ No newline at end of file +var _0xbe9b=['name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','rows','catch','show','include','body','params','describe','eml-format','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error'];(function(_0xa41fac,_0x4f564c){var _0x3d6832=function(_0x3cc63b){while(--_0x3cc63b){_0xa41fac['push'](_0xa41fac['shift']());}};_0x3d6832(++_0x4f564c);}(_0xbe9b,0x1be));var _0xbbe9=function(_0x1460db,_0xd72e8d){_0x1460db=_0x1460db-0x0;var _0x26d013=_0xbe9b[_0x1460db];return _0x26d013;};'use strict';var emlformat=require(_0xbbe9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbe9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbe9('0x2'));var util=require(_0xbbe9('0x3'));var path=require('path');var sox=require(_0xbbe9('0x4'));var csv=require(_0xbbe9('0x5'));var ejs=require(_0xbbe9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbe9('0x7'));var squel=require(_0xbbe9('0x8'));var crypto=require(_0xbbe9('0x9'));var jsforce=require(_0xbbe9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbbe9('0xb'));var Papa=require('papaparse');var Redis=require(_0xbbe9('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbbe9('0xd'));var hardwareService=require(_0xbbe9('0xe'));var logger=require(_0xbbe9('0xf'))(_0xbbe9('0x10'));var utils=require(_0xbbe9('0x11'));var config=require(_0xbbe9('0x12'));var licenseUtil=require(_0xbbe9('0x13'));var db=require(_0xbbe9('0x14'))['db'];function respondWithStatusCode(_0x2b483f,_0x259b21){_0x259b21=_0x259b21||0xcc;return function(_0x597f84){if(_0x597f84){return _0x2b483f['sendStatus'](_0x259b21);}return _0x2b483f[_0xbbe9('0x15')](_0x259b21)[_0xbbe9('0x16')]();};}function respondWithResult(_0x1b282b,_0x2e146c){_0x2e146c=_0x2e146c||0xc8;return function(_0x5b8541){if(_0x5b8541){return _0x1b282b['status'](_0x2e146c)[_0xbbe9('0x17')](_0x5b8541);}};}function respondWithFilteredResult(_0x598661,_0xc24ed3){return function(_0x306edd){if(_0x306edd){var _0x17fe5f=typeof _0xc24ed3['offset']===_0xbbe9('0x18')&&typeof _0xc24ed3[_0xbbe9('0x19')]===_0xbbe9('0x18');var _0x3ed3a3=_0x306edd[_0xbbe9('0x1a')];var _0xe8705d=_0x17fe5f?0x0:_0xc24ed3[_0xbbe9('0x1b')];var _0x158fff=_0x17fe5f?_0x306edd[_0xbbe9('0x1a')]:_0xc24ed3[_0xbbe9('0x1b')]+_0xc24ed3[_0xbbe9('0x19')];var _0x48c0ad;if(_0x158fff>=_0x3ed3a3){_0x158fff=_0x3ed3a3;_0x48c0ad=0xc8;}else{_0x48c0ad=0xce;}_0x598661['status'](_0x48c0ad);return _0x598661[_0xbbe9('0x1c')](_0xbbe9('0x1d'),_0xe8705d+'-'+_0x158fff+'/'+_0x3ed3a3)['json'](_0x306edd);}return null;};}function patchUpdates(_0x15cb38){return function(_0x2894cd){try{jsonpatch[_0xbbe9('0x1e')](_0x2894cd,_0x15cb38,!![]);}catch(_0x17d287){return BPromise['reject'](_0x17d287);}return _0x2894cd[_0xbbe9('0x1f')]();};}function saveUpdates(_0x3aabb2,_0x4cc0c1){return function(_0x98c53d){if(_0x98c53d){return _0x98c53d[_0xbbe9('0x20')](_0x3aabb2)[_0xbbe9('0x21')](function(_0x314c5f){return _0x314c5f;});}return null;};}function removeEntity(_0xe1df45,_0x36bd2c){return function(_0x515744){if(_0x515744){return _0x515744[_0xbbe9('0x22')]()['then'](function(){_0xe1df45[_0xbbe9('0x15')](0xcc)[_0xbbe9('0x16')]();});}};}function handleEntityNotFound(_0xef5d7c,_0x5ad0a5){return function(_0x3411e5){if(!_0x3411e5){_0xef5d7c[_0xbbe9('0x23')](0x194);}return _0x3411e5;};}function handleError(_0x332282,_0x3c9c1c){_0x3c9c1c=_0x3c9c1c||0x1f4;return function(_0x5d2427){logger[_0xbbe9('0x24')](_0x5d2427['stack']);if(_0x5d2427['name']){delete _0x5d2427[_0xbbe9('0x25')];}_0x332282['status'](_0x3c9c1c)['send'](_0x5d2427);};}exports[_0xbbe9('0x26')]=function(_0x895d8,_0x3f83f6){var _0x1887a4={},_0x22bfa8={},_0x4655ae={'count':0x0,'rows':[]};var _0x32cb67=_[_0xbbe9('0x27')](db['CmHopperBlack'][_0xbbe9('0x28')],function(_0x269f1d){return{'name':_0x269f1d[_0xbbe9('0x29')],'type':_0x269f1d[_0xbbe9('0x2a')]['key']};});_0x22bfa8[_0xbbe9('0x2b')]=_['map'](_0x32cb67,'name');_0x22bfa8[_0xbbe9('0x2c')]=_[_0xbbe9('0x2d')](_0x895d8[_0xbbe9('0x2c')]);_0x22bfa8[_0xbbe9('0x2e')]=_[_0xbbe9('0x2f')](_0x22bfa8[_0xbbe9('0x2b')],_0x22bfa8[_0xbbe9('0x2c')]);_0x1887a4[_0xbbe9('0x30')]=_[_0xbbe9('0x2f')](_0x22bfa8[_0xbbe9('0x2b')],qs[_0xbbe9('0x31')](_0x895d8[_0xbbe9('0x2c')][_0xbbe9('0x31')]));_0x1887a4[_0xbbe9('0x30')]=_0x1887a4['attributes'][_0xbbe9('0x32')]?_0x1887a4[_0xbbe9('0x30')]:_0x22bfa8['model'];if(!_0x895d8['query'][_0xbbe9('0x33')]('nolimit')){_0x1887a4['limit']=qs[_0xbbe9('0x19')](_0x895d8['query'][_0xbbe9('0x19')]);_0x1887a4[_0xbbe9('0x1b')]=qs[_0xbbe9('0x1b')](_0x895d8[_0xbbe9('0x2c')][_0xbbe9('0x1b')]);}_0x1887a4[_0xbbe9('0x34')]=qs[_0xbbe9('0x35')](_0x895d8[_0xbbe9('0x2c')]['sort']);_0x1887a4[_0xbbe9('0x36')]=qs[_0xbbe9('0x2e')](_[_0xbbe9('0x37')](_0x895d8[_0xbbe9('0x2c')],_0x22bfa8[_0xbbe9('0x2e')]),_0x32cb67);if(_0x895d8[_0xbbe9('0x2c')][_0xbbe9('0x38')]){_0x1887a4[_0xbbe9('0x36')]=_[_0xbbe9('0x39')](_0x1887a4[_0xbbe9('0x36')],{'$or':_[_0xbbe9('0x27')](_0x32cb67,function(_0x2fcaef){if(_0x2fcaef[_0xbbe9('0x2a')]!==_0xbbe9('0x3a')){var _0x1bc6a6={};_0x1bc6a6[_0x2fcaef['name']]={'$like':'%'+_0x895d8[_0xbbe9('0x2c')][_0xbbe9('0x38')]+'%'};return _0x1bc6a6;}})});}_0x1887a4=_[_0xbbe9('0x39')]({},_0x1887a4,_0x895d8[_0xbbe9('0x3b')]);var _0x59d515={'where':_0x1887a4[_0xbbe9('0x36')]};return db[_0xbbe9('0x3c')][_0xbbe9('0x1a')](_0x59d515)[_0xbbe9('0x21')](function(_0x50ecce){_0x4655ae[_0xbbe9('0x1a')]=_0x50ecce;if(_0x895d8['query'][_0xbbe9('0x3d')]){_0x1887a4['include']=[{'all':!![]}];}return db[_0xbbe9('0x3c')]['findAll'](_0x1887a4);})[_0xbbe9('0x21')](function(_0x955593){_0x4655ae[_0xbbe9('0x3e')]=_0x955593;return _0x4655ae;})[_0xbbe9('0x21')](respondWithFilteredResult(_0x3f83f6,_0x1887a4))[_0xbbe9('0x3f')](handleError(_0x3f83f6,null));};exports[_0xbbe9('0x40')]=function(_0x13f57c,_0x2866c1){var _0x1ac7f8={'raw':!![],'where':{'id':_0x13f57c['params']['id']}},_0x1c8666={};_0x1c8666[_0xbbe9('0x2b')]=_['keys'](db[_0xbbe9('0x3c')][_0xbbe9('0x28')]);_0x1c8666[_0xbbe9('0x2c')]=_[_0xbbe9('0x2d')](_0x13f57c['query']);_0x1c8666['filters']=_[_0xbbe9('0x2f')](_0x1c8666[_0xbbe9('0x2b')],_0x1c8666['query']);_0x1ac7f8['attributes']=_[_0xbbe9('0x2f')](_0x1c8666[_0xbbe9('0x2b')],qs[_0xbbe9('0x31')](_0x13f57c[_0xbbe9('0x2c')]['fields']));_0x1ac7f8[_0xbbe9('0x30')]=_0x1ac7f8[_0xbbe9('0x30')]['length']?_0x1ac7f8[_0xbbe9('0x30')]:_0x1c8666[_0xbbe9('0x2b')];if(_0x13f57c['query'][_0xbbe9('0x3d')]){_0x1ac7f8[_0xbbe9('0x41')]=[{'all':!![]}];}_0x1ac7f8=_[_0xbbe9('0x39')]({},_0x1ac7f8,_0x13f57c['options']);return db[_0xbbe9('0x3c')]['find'](_0x1ac7f8)[_0xbbe9('0x21')](handleEntityNotFound(_0x2866c1,null))[_0xbbe9('0x21')](respondWithResult(_0x2866c1,null))[_0xbbe9('0x3f')](handleError(_0x2866c1,null));};exports[_0xbbe9('0x20')]=function(_0x47ec27,_0x38d2be){if(_0x47ec27[_0xbbe9('0x42')]['id']){delete _0x47ec27[_0xbbe9('0x42')]['id'];}return db[_0xbbe9('0x3c')]['find']({'where':{'id':_0x47ec27[_0xbbe9('0x43')]['id']}})[_0xbbe9('0x21')](handleEntityNotFound(_0x38d2be,null))[_0xbbe9('0x21')](saveUpdates(_0x47ec27[_0xbbe9('0x42')],null))[_0xbbe9('0x21')](respondWithResult(_0x38d2be,null))['catch'](handleError(_0x38d2be,null));};exports['destroy']=function(_0x307ce4,_0x1a02fc){return db['CmHopperBlack']['find']({'where':{'id':_0x307ce4[_0xbbe9('0x43')]['id']}})[_0xbbe9('0x21')](handleEntityNotFound(_0x1a02fc,null))[_0xbbe9('0x21')](removeEntity(_0x1a02fc,null))[_0xbbe9('0x3f')](handleError(_0x1a02fc,null));};exports['describe']=function(_0x3ed50e,_0xe5421c){return db['CmHopperBlack'][_0xbbe9('0x44')]()[_0xbbe9('0x21')](respondWithResult(_0xe5421c,null))[_0xbbe9('0x3f')](handleError(_0xe5421c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index de82908..b46d08d 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 _0xe546=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x3fa4fc,_0x4a3bf7){var _0x231594=function(_0x432485){while(--_0x432485){_0x3fa4fc['push'](_0x3fa4fc['shift']());}};_0x231594(++_0x4a3bf7);}(_0xe546,0x95));var _0x6e54=function(_0x22b466,_0x38498f){_0x22b466=_0x22b466-0x0;var _0x24c459=_0xe546[_0x22b466];return _0x24c459;};'use strict';var _=require(_0x6e54('0x0'));var util=require(_0x6e54('0x1'));var logger=require(_0x6e54('0x2'))(_0x6e54('0x3'));var moment=require(_0x6e54('0x4'));var BPromise=require(_0x6e54('0x5'));var rp=require(_0x6e54('0x6'));var fs=require('fs');var path=require(_0x6e54('0x7'));var rimraf=require('rimraf');var config=require(_0x6e54('0x8'));var attributes=require(_0x6e54('0x9'));module[_0x6e54('0xa')]=function(_0x26dda0,_0x2fa138){return _0x26dda0[_0x6e54('0xb')](_0x6e54('0xc'),attributes,{'tableName':_0x6e54('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb01f=['rimraf','./cmHopperBlack.attributes','exports','cm_hopper_black','util','moment','request-promise','path'];(function(_0x2b4201,_0x383749){var _0x3887f5=function(_0x2cfd0f){while(--_0x2cfd0f){_0x2b4201['push'](_0x2b4201['shift']());}};_0x3887f5(++_0x383749);}(_0xb01f,0x13c));var _0xfb01=function(_0x5e4d9b,_0x37f225){_0x5e4d9b=_0x5e4d9b-0x0;var _0x4d53ea=_0xb01f[_0x5e4d9b];return _0x4d53ea;};'use strict';var _=require('lodash');var util=require(_0xfb01('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfb01('0x1'));var BPromise=require('bluebird');var rp=require(_0xfb01('0x2'));var fs=require('fs');var path=require(_0xfb01('0x3'));var rimraf=require(_0xfb01('0x4'));var config=require('../../config/environment');var attributes=require(_0xfb01('0x5'));module[_0xfb01('0x6')]=function(_0x404566,_0x5026d4){return _0x404566['define']('CmHopperBlack',attributes,{'tableName':_0xfb01('0x7'),'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 4f8aa8e..db0c199 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 _0x64ea=['UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','stringify','catch'];(function(_0x32bdbf,_0x11689b){var _0x4bc887=function(_0x47d481){while(--_0x47d481){_0x32bdbf['push'](_0x32bdbf['shift']());}};_0x4bc887(++_0x11689b);}(_0x64ea,0x95));var _0xa64e=function(_0xe6e3e2,_0x2b01da){_0xe6e3e2=_0xe6e3e2-0x0;var _0x126571=_0x64ea[_0xe6e3e2];return _0x126571;};'use strict';var _=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var moment=require(_0xa64e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa64e('0x3'));var fs=require('fs');var Redis=require(_0xa64e('0x4'));var db=require(_0xa64e('0x5'))['db'];var utils=require(_0xa64e('0x6'));var logger=require(_0xa64e('0x7'))('rpc');var config=require(_0xa64e('0x8'));var jayson=require(_0xa64e('0x9'));var client=jayson[_0xa64e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a599d,_0x9080f8,_0x24344b){return new BPromise(function(_0x1d433a,_0x5a5ba8){return client['request'](_0x1a599d,_0x24344b)[_0xa64e('0xb')](function(_0x47ca78){logger[_0xa64e('0xc')](_0xa64e('0xd'),_0x9080f8,_0xa64e('0xe'));logger[_0xa64e('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x9080f8,_0xa64e('0xe'),JSON['stringify'](_0x47ca78));if(_0x47ca78[_0xa64e('0x10')]){if(_0x47ca78['error']['code']===0x1f4){logger[_0xa64e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);return _0x5a5ba8(_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);}logger[_0xa64e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);return _0x1d433a(_0x47ca78[_0xa64e('0x10')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0xa64e('0xe'));_0x1d433a(_0x47ca78[_0xa64e('0x12')]['message']);}})['catch'](function(_0xec660){logger[_0xa64e('0x10')](_0xa64e('0xd'),_0x9080f8,_0xec660);_0x5a5ba8(_0xec660);});});}exports[_0xa64e('0x13')]=function(_0x2dbb2e){var _0x198fef=this;return new Promise(function(_0x4dcb18,_0x31cb1f){return db[_0xa64e('0x14')][_0xa64e('0x15')]({'raw':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e[_0xa64e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e['options'][_0xa64e('0x17')]||null:null,'attributes':_0x2dbb2e['options']?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x18')]||null:null,'limit':_0x2dbb2e['options']?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x19')]||null:null,'include':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x1a')]?_['map'](_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x1a')],function(_0x288fed){return{'model':db[_0x288fed[_0xa64e('0x1b')]],'as':_0x288fed['as'],'attributes':_0x288fed['attributes'],'include':_0x288fed[_0xa64e('0x1a')]?_[_0xa64e('0x1c')](_0x288fed[_0xa64e('0x1a')],function(_0x2241db){return{'model':db[_0x2241db[_0xa64e('0x1b')]],'as':_0x2241db['as'],'attributes':_0x2241db[_0xa64e('0x18')],'include':_0x2241db[_0xa64e('0x1a')]?_[_0xa64e('0x1c')](_0x2241db['include'],function(_0x367506){return{'model':db[_0x367506[_0xa64e('0x1b')]],'as':_0x367506['as'],'attributes':_0x367506[_0xa64e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa64e('0xb')](function(_0x5be4b0){logger[_0xa64e('0xc')]('GetCmHopperBlack',_0x2dbb2e);logger['debug']('GetCmHopperBlack',_0x2dbb2e,JSON[_0xa64e('0x1d')](_0x5be4b0));_0x4dcb18(_0x5be4b0);})[_0xa64e('0x1e')](function(_0x2a9eb8){logger[_0xa64e('0x10')](_0xa64e('0x13'),_0x2a9eb8[_0xa64e('0x11')],_0x2dbb2e);_0x31cb1f(_0x198fef[_0xa64e('0x10')](0x1f4,_0x2a9eb8['message']));});});};exports[_0xa64e('0x1f')]=function(_0xd38d29){var _0x377682=this;return new Promise(function(_0x399d07,_0x19d3ca){return db[_0xa64e('0x14')][_0xa64e('0x20')](_0xd38d29[_0xa64e('0x21')],{'raw':_0xd38d29['options']?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x17')]||null:null,'attributes':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x18')]||null:null,'limit':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')]['limit']||null:null})[_0xa64e('0xb')](function(_0x532e5e){logger[_0xa64e('0xc')](_0xa64e('0x1f'),_0xd38d29);logger[_0xa64e('0xf')](_0xa64e('0x1f'),_0xd38d29,JSON[_0xa64e('0x1d')](_0x532e5e));_0x399d07(_0x532e5e);})[_0xa64e('0x1e')](function(_0x20dbe9){logger[_0xa64e('0x10')](_0xa64e('0x1f'),_0x20dbe9[_0xa64e('0x11')],_0xd38d29);_0x19d3ca(_0x377682['error'](0x1f4,_0x20dbe9[_0xa64e('0x11')]));});});};exports[_0xa64e('0x23')]=function(_0x3d88d0){var _0x5210f6=this;return new Promise(function(_0x4e839f,_0x3fa1b0){return db[_0xa64e('0x14')]['destroy']({'where':_0x3d88d0[_0xa64e('0x16')]?_0x3d88d0['options'][_0xa64e('0x17')]||null:null})[_0xa64e('0xb')](function(_0x2c0337){logger[_0xa64e('0xc')](_0xa64e('0x23'),_0x3d88d0);logger[_0xa64e('0xf')](_0xa64e('0x23'),_0x3d88d0,JSON[_0xa64e('0x1d')](_0x2c0337));_0x4e839f(_0x2c0337);})['catch'](function(_0x31a751){logger[_0xa64e('0x10')](_0xa64e('0x23'),_0x31a751[_0xa64e('0x11')],_0x3d88d0);_0x3fa1b0(_0x5210f6[_0xa64e('0x10')](0x1f4,_0x31a751['message']));});});}; \ No newline at end of file +var _0xa20d=['jayson/promise','http','request','then','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','update','body','catch','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x178d5c,_0x445b11){var _0xf54567=function(_0x5cd0de){while(--_0x5cd0de){_0x178d5c['push'](_0x178d5c['shift']());}};_0xf54567(++_0x445b11);}(_0xa20d,0xd2));var _0xda20=function(_0x143f09,_0x383aaf){_0x143f09=_0x143f09-0x0;var _0x16bd4c=_0xa20d[_0x143f09];return _0x16bd4c;};'use strict';var _=require(_0xda20('0x0'));var util=require(_0xda20('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xda20('0x2'));var fs=require('fs');var Redis=require(_0xda20('0x3'));var db=require(_0xda20('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xda20('0x5'));var jayson=require(_0xda20('0x6'));var client=jayson['client'][_0xda20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17ded8,_0x4af18e,_0x49ea02){return new BPromise(function(_0x54c8a2,_0x368c28){return client[_0xda20('0x8')](_0x17ded8,_0x49ea02)[_0xda20('0x9')](function(_0x4149e4){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4af18e,'request\x20sent');logger[_0xda20('0xa')](_0xda20('0xb'),_0x4af18e,'request\x20sent',JSON[_0xda20('0xc')](_0x4149e4));if(_0x4149e4['error']){if(_0x4149e4[_0xda20('0xd')]['code']===0x1f4){logger[_0xda20('0xd')](_0xda20('0xe'),_0x4af18e,_0x4149e4[_0xda20('0xd')][_0xda20('0xf')]);return _0x368c28(_0x4149e4['error']['message']);}logger[_0xda20('0xd')](_0xda20('0xe'),_0x4af18e,_0x4149e4[_0xda20('0xd')][_0xda20('0xf')]);return _0x54c8a2(_0x4149e4[_0xda20('0xd')]['message']);}else{logger[_0xda20('0x10')](_0xda20('0xe'),_0x4af18e,_0xda20('0x11'));_0x54c8a2(_0x4149e4[_0xda20('0x12')]['message']);}})['catch'](function(_0x32c353){logger[_0xda20('0xd')](_0xda20('0xe'),_0x4af18e,_0x32c353);_0x368c28(_0x32c353);});});}exports[_0xda20('0x13')]=function(_0x25b3eb){var _0x535dbb=this;return new Promise(function(_0x31ec51,_0x4dec78){return db[_0xda20('0x14')][_0xda20('0x15')]({'raw':_0x25b3eb[_0xda20('0x16')]?_0x25b3eb[_0xda20('0x16')][_0xda20('0x17')]===undefined?!![]:![]:!![],'where':_0x25b3eb['options']?_0x25b3eb['options'][_0xda20('0x18')]||null:null,'attributes':_0x25b3eb[_0xda20('0x16')]?_0x25b3eb['options'][_0xda20('0x19')]||null:null,'limit':_0x25b3eb['options']?_0x25b3eb[_0xda20('0x16')][_0xda20('0x1a')]||null:null,'include':_0x25b3eb[_0xda20('0x16')]?_0x25b3eb[_0xda20('0x16')]['include']?_[_0xda20('0x1b')](_0x25b3eb['options'][_0xda20('0x1c')],function(_0x2a4790){return{'model':db[_0x2a4790['model']],'as':_0x2a4790['as'],'attributes':_0x2a4790[_0xda20('0x19')],'include':_0x2a4790[_0xda20('0x1c')]?_[_0xda20('0x1b')](_0x2a4790[_0xda20('0x1c')],function(_0xbb330c){return{'model':db[_0xbb330c[_0xda20('0x1d')]],'as':_0xbb330c['as'],'attributes':_0xbb330c['attributes'],'include':_0xbb330c[_0xda20('0x1c')]?_['map'](_0xbb330c[_0xda20('0x1c')],function(_0x380599){return{'model':db[_0x380599[_0xda20('0x1d')]],'as':_0x380599['as'],'attributes':_0x380599[_0xda20('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52817a){logger['info']('GetCmHopperBlack',_0x25b3eb);logger['debug'](_0xda20('0x13'),_0x25b3eb,JSON['stringify'](_0x52817a));_0x31ec51(_0x52817a);})['catch'](function(_0xe58e92){logger[_0xda20('0xd')]('GetCmHopperBlack',_0xe58e92[_0xda20('0xf')],_0x25b3eb);_0x4dec78(_0x535dbb['error'](0x1f4,_0xe58e92[_0xda20('0xf')]));});});};exports[_0xda20('0x1e')]=function(_0x41d878){var _0x582fb7=this;return new Promise(function(_0x4000c2,_0x4ba2dd){return db[_0xda20('0x14')][_0xda20('0x1f')](_0x41d878[_0xda20('0x20')],{'raw':_0x41d878[_0xda20('0x16')]?_0x41d878[_0xda20('0x16')][_0xda20('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d878[_0xda20('0x16')]?_0x41d878[_0xda20('0x16')][_0xda20('0x18')]||null:null,'attributes':_0x41d878[_0xda20('0x16')]?_0x41d878[_0xda20('0x16')][_0xda20('0x19')]||null:null,'limit':_0x41d878[_0xda20('0x16')]?_0x41d878[_0xda20('0x16')][_0xda20('0x1a')]||null:null})[_0xda20('0x9')](function(_0x2ca784){logger[_0xda20('0x10')](_0xda20('0x1e'),_0x41d878);logger[_0xda20('0xa')]('UpdateCmHopperBlack',_0x41d878,JSON[_0xda20('0xc')](_0x2ca784));_0x4000c2(_0x2ca784);})[_0xda20('0x21')](function(_0x5199c5){logger[_0xda20('0xd')](_0xda20('0x1e'),_0x5199c5[_0xda20('0xf')],_0x41d878);_0x4ba2dd(_0x582fb7['error'](0x1f4,_0x5199c5[_0xda20('0xf')]));});});};exports[_0xda20('0x22')]=function(_0x1a5a1e){var _0x2a8917=this;return new Promise(function(_0xa7420,_0x66d193){return db[_0xda20('0x14')][_0xda20('0x23')]({'where':_0x1a5a1e[_0xda20('0x16')]?_0x1a5a1e[_0xda20('0x16')]['where']||null:null})[_0xda20('0x9')](function(_0x32f0f1){logger[_0xda20('0x10')](_0xda20('0x22'),_0x1a5a1e);logger['debug'](_0xda20('0x22'),_0x1a5a1e,JSON['stringify'](_0x32f0f1));_0xa7420(_0x32f0f1);})[_0xda20('0x21')](function(_0x3deec7){logger[_0xda20('0xd')](_0xda20('0x22'),_0x3deec7[_0xda20('0xf')],_0x1a5a1e);_0x66d193(_0x2a8917[_0xda20('0xd')](0x1f4,_0x3deec7['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d8a23b1..7e63903 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','exports','multer','express','Router'];(function(_0x5ca22f,_0x25f406){var _0x58357d=function(_0x5938d0){while(--_0x5938d0){_0x5ca22f['push'](_0x5ca22f['shift']());}};_0x58357d(++_0x25f406);}(_0x2675,0x75));var _0x5267=function(_0x232bdd,_0x51e3f7){_0x232bdd=_0x232bdd-0x0;var _0x429ce9=_0x2675[_0x232bdd];return _0x429ce9;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0xb')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x7')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0xafb9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','show','put','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x128fb0,_0x3c9cdc){var _0x3716e3=function(_0x3a7591){while(--_0x3a7591){_0x128fb0['push'](_0x128fb0['shift']());}};_0x3716e3(++_0x3c9cdc);}(_0xafb9,0x68));var _0x9afb=function(_0x210d24,_0xd08d2f){_0x210d24=_0x210d24-0x0;var _0x4d081c=_0xafb9[_0x210d24];return _0x4d081c;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/describe',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0xe')](_0x9afb('0xf'),auth[_0x9afb('0xb')](),controller['update']);router['delete'](_0x9afb('0xf'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);module[_0x9afb('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6fd476e..b73ef49 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 _0xf8c8=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0x2cff83,_0x53fad8){var _0x434ce5=function(_0x335409){while(--_0x335409){_0x2cff83['push'](_0x2cff83['shift']());}};_0x434ce5(++_0x53fad8);}(_0xf8c8,0xcc));var _0x8f8c=function(_0x3e1cf2,_0x43c83f){_0x3e1cf2=_0x3e1cf2-0x0;var _0x58bae5=_0xf8c8[_0x3e1cf2];return _0x58bae5;};'use strict';var Sequelize=require(_0x8f8c('0x0'));var moment=require('moment');module[_0x8f8c('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8f8c('0x2')]},'countbusyretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8f8c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8f8c('0x4')]},'calleridnum':{'type':Sequelize[_0x8f8c('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8f8c('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8f8c('0x2')]},'droptime':{'type':Sequelize[_0x8f8c('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8f8c('0x4')]},'campaign':{'type':Sequelize[_0x8f8c('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8f8c('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8f8c('0x4')]},'secondDisposition':{'type':Sequelize[_0x8f8c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8f8c('0x4')]},'dispositionat':{'type':Sequelize[_0x8f8c('0x2')],'set':function(_0x649b85){var _0x1d077c=this[_0x8f8c('0x5')](_0x8f8c('0x6'));if(_0x1d077c&&_0x649b85){this[_0x8f8c('0x7')](_0x8f8c('0x8'),moment(_0x649b85)[_0x8f8c('0x9')](moment(_0x1d077c),'seconds'));}}},'amd':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8f8c('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f8c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8f8c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8f8c('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8f8c('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e4=['DATE','getDataValue','endtime','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x5b5907,_0x3b8995){var _0x3ea86d=function(_0x2c45fd){while(--_0x2c45fd){_0x5b5907['push'](_0x5b5907['shift']());}};_0x3ea86d(++_0x3b8995);}(_0x34e4,0xef));var _0x434e=function(_0x59f199,_0x29274a){_0x59f199=_0x59f199-0x0;var _0x56cbf5=_0x34e4[_0x59f199];return _0x56cbf5;};'use strict';var Sequelize=require(_0x434e('0x0'));var moment=require(_0x434e('0x1'));module['exports']={'state':{'type':Sequelize[_0x434e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x434e('0x3')]},'scheduledat':{'type':Sequelize[_0x434e('0x4')]},'countbusyretry':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x434e('0x3')]},'originatecalleridname':{'type':Sequelize[_0x434e('0x3')]},'calleridnum':{'type':Sequelize[_0x434e('0x3')]},'calleridname':{'type':Sequelize[_0x434e('0x3')]},'starttime':{'type':Sequelize[_0x434e('0x4')]},'responsetime':{'type':Sequelize[_0x434e('0x4')]},'answertime':{'type':Sequelize[_0x434e('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x434e('0x4')]},'ringtime':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x434e('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x434e('0x3')]},'reason':{'type':Sequelize[_0x434e('0x3')]},'disposition':{'type':Sequelize[_0x434e('0x3')]},'secondDisposition':{'type':Sequelize[_0x434e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x434e('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x2094f2){var _0x2aed49=this[_0x434e('0x5')](_0x434e('0x6'));if(_0x2aed49&&_0x2094f2){this['setDataValue']('followuptime',moment(_0x2094f2)['diff'](moment(_0x2aed49),_0x434e('0x7')));}}},'amd':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x434e('0x4')]},'callback':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x434e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x434e('0x4')]},'deleted':{'type':Sequelize[_0x434e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x434e('0x4')]},'recallme':{'type':Sequelize[_0x434e('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x434e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x434e('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 73a4985..98dd7d6 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 _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x17a598,_0x2ccd8f){var _0x543be=function(_0x31b80c){while(--_0x31b80c){_0x17a598['push'](_0x17a598['shift']());}};_0x543be(++_0x2ccd8f);}(_0x5496,0x175));var _0x6549=function(_0x418193,_0x5e5620){_0x418193=_0x418193-0x0;var _0x657c52=_0x5496[_0x418193];return _0x657c52;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x814b,0x1a2));var _0xb814=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x814b[_0x36b037];return _0x409194;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 52f9ae2..9c18f1c 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 _0xc915=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2add72,_0x25f4f3){var _0x246b81=function(_0x5e3c64){while(--_0x5e3c64){_0x2add72['push'](_0x2add72['shift']());}};_0x246b81(++_0x25f4f3);}(_0xc915,0xe8));var _0x5c91=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc915[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5c91('0x0'));var util=require(_0x5c91('0x1'));var logger=require(_0x5c91('0x2'))(_0x5c91('0x3'));var moment=require(_0x5c91('0x4'));var BPromise=require(_0x5c91('0x5'));var rp=require(_0x5c91('0x6'));var fs=require('fs');var path=require(_0x5c91('0x7'));var rimraf=require(_0x5c91('0x8'));var config=require(_0x5c91('0x9'));var attributes=require(_0x5c91('0xa'));module[_0x5c91('0xb')]=function(_0x4bc276,_0x598935){return _0x4bc276['define'](_0x5c91('0xc'),attributes,{'tableName':_0x5c91('0xd'),'paranoid':![],'indexes':[{'name':_0x5c91('0xe'),'fields':[_0x5c91('0xe')]},{'name':'uniqueid','fields':[_0x5c91('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb004=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x409502,_0xabcca1){var _0x45c724=function(_0x32d414){while(--_0x32d414){_0x409502['push'](_0x409502['shift']());}};_0x45c724(++_0xabcca1);}(_0xb004,0x11b));var _0x4b00=function(_0x3b4341,_0x442f65){_0x3b4341=_0x3b4341-0x0;var _0x173557=_0xb004[_0x3b4341];return _0x173557;};'use strict';var _=require(_0x4b00('0x0'));var util=require(_0x4b00('0x1'));var logger=require(_0x4b00('0x2'))('api');var moment=require(_0x4b00('0x3'));var BPromise=require(_0x4b00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b00('0x5'));var rimraf=require(_0x4b00('0x6'));var config=require(_0x4b00('0x7'));var attributes=require(_0x4b00('0x8'));module['exports']=function(_0xaad873,_0x5c3e83){return _0xaad873['define'](_0x4b00('0x9'),attributes,{'tableName':_0x4b00('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x4b00('0xb')]},{'name':'uniqueid','fields':[_0x4b00('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index bd2ed0f..7b3ccc1 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(_0x2607b8,_0x7c741b){var _0x284f5c=function(_0x2231b0){while(--_0x2231b0){_0x2607b8['push'](_0x2607b8['shift']());}};_0x284f5c(++_0x7c741b);}(_0xb10b,0x12a));var _0xbb10=function(_0x11280c,_0x4e8f92){_0x11280c=_0x11280c-0x0;var _0x5999ac=_0xb10b[_0x11280c];return _0x5999ac;};'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(_0x5bac08,_0x1f1d3d){var _0x1e55ea=function(_0xae59a2){while(--_0xae59a2){_0x5bac08['push'](_0x5bac08['shift']());}};_0x1e55ea(++_0x1f1d3d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ecff9,_0x473070){_0x5ecff9=_0x5ecff9-0x0;var _0x5e1415=_0xb10b[_0x5ecff9];return _0x5e1415;};'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 db75c2c..f80ab15 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 _0xfefc=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show'];(function(_0x4948d6,_0x5f43e9){var _0x467067=function(_0x27e611){while(--_0x27e611){_0x4948d6['push'](_0x4948d6['shift']());}};_0x467067(++_0x5f43e9);}(_0xfefc,0xfa));var _0xcfef=function(_0x4e7904,_0xb5d01e){_0x4e7904=_0x4e7904-0x0;var _0x4f23e5=_0xfefc[_0x4e7904];return _0x4f23e5;};'use strict';var multer=require(_0xcfef('0x0'));var util=require(_0xcfef('0x1'));var path=require(_0xcfef('0x2'));var timeout=require(_0xcfef('0x3'));var express=require(_0xcfef('0x4'));var router=express['Router']();var fs_extra=require(_0xcfef('0x5'));var auth=require(_0xcfef('0x6'));var interaction=require(_0xcfef('0x7'));var config=require(_0xcfef('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xcfef('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfef('0xa')]);router[_0xcfef('0x9')]('/describe',auth[_0xcfef('0xb')](),controller['describe']);router['get'](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xd')]);router[_0xcfef('0x9')](_0xcfef('0xe'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xcfef('0xb')](),controller[_0xcfef('0x10')]);router[_0xcfef('0x11')](_0xcfef('0x12'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xcfef('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xcfef('0x14'),auth['isAuthenticated'](),controller[_0xcfef('0x15')]);router[_0xcfef('0x16')](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x17')]);module['exports']=router; \ No newline at end of file +var _0x275c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','show','get','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x275c,0x70));var _0xc275=function(_0x17ca45,_0x1a6289){_0x17ca45=_0x17ca45-0x0;var _0x3d4bc2=_0x275c[_0x17ca45];return _0x3d4bc2;};'use strict';var multer=require(_0xc275('0x0'));var util=require(_0xc275('0x1'));var path=require(_0xc275('0x2'));var timeout=require(_0xc275('0x3'));var express=require(_0xc275('0x4'));var router=express[_0xc275('0x5')]();var fs_extra=require(_0xc275('0x6'));var auth=require(_0xc275('0x7'));var interaction=require(_0xc275('0x8'));var config=require('../../config/environment');var controller=require(_0xc275('0x9'));router['get']('/',auth[_0xc275('0xa')](),controller[_0xc275('0xb')]);router['get'](_0xc275('0xc'),auth[_0xc275('0xa')](),controller[_0xc275('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc275('0xe')]);router[_0xc275('0xf')](_0xc275('0x10'),auth[_0xc275('0xa')](),controller[_0xc275('0x11')]);router['get'](_0xc275('0x12'),auth[_0xc275('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc275('0x13')](_0xc275('0x14'),auth[_0xc275('0xa')](),controller[_0xc275('0x15')]);router['post'](_0xc275('0x16'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xc275('0x13')](_0xc275('0x17'),auth[_0xc275('0xa')](),controller[_0xc275('0x18')]);router[_0xc275('0x19')](_0xc275('0x1a'),auth['isAuthenticated'](),controller[_0xc275('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index beb732a..5c801e1 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 _0x7f7e=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f7e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe7f7('0x0'));module['exports']={'state':{'type':Sequelize[_0xe7f7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe7f7('0x2')]},'scheduledat':{'type':Sequelize[_0xe7f7('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe7f7('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe7f7('0x2')]},'calleridname':{'type':Sequelize[_0xe7f7('0x2')]},'starttime':{'type':Sequelize[_0xe7f7('0x3')]},'responsetime':{'type':Sequelize[_0xe7f7('0x3')]},'answertime':{'type':Sequelize[_0xe7f7('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe7f7('0x3')]},'ringtime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe7f7('0x2')]},'campaign':{'type':Sequelize[_0xe7f7('0x2')]},'campaigntype':{'type':Sequelize[_0xe7f7('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe7f7('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe7f7('0x2')]}}; \ No newline at end of file +var _0x22d2=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x404c35,_0xedfe89){var _0x28c900=function(_0x2dc0ab){while(--_0x2dc0ab){_0x404c35['push'](_0x404c35['shift']());}};_0x28c900(++_0xedfe89);}(_0x22d2,0x92));var _0x222d=function(_0x40def5,_0x12b03a){_0x40def5=_0x40def5-0x0;var _0x30cdd1=_0x22d2[_0x40def5];return _0x30cdd1;};'use strict';var Sequelize=require(_0x222d('0x0'));module['exports']={'state':{'type':Sequelize[_0x222d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x222d('0x2')]},'scheduledat':{'type':Sequelize[_0x222d('0x3')]},'countbusyretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x222d('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x222d('0x2')]},'originatecalleridname':{'type':Sequelize[_0x222d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x222d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x222d('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x222d('0x3')]},'ringtime':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x222d('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x222d('0x2')]},'reason':{'type':Sequelize[_0x222d('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x222d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x222d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x222d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x222d('0x3')]},'recallme':{'type':Sequelize[_0x222d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x222d('0x3')]},'edited':{'type':Sequelize[_0x222d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x222d('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x222d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 6550b3b..24e7c0e 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 _0x5c39=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x50e4d0,_0x2496dc){var _0x350ef7=function(_0x7c9085){while(--_0x7c9085){_0x50e4d0['push'](_0x50e4d0['shift']());}};_0x350ef7(++_0x2496dc);}(_0x5c39,0x19b));var _0x95c3=function(_0x462d5d,_0xc6995f){_0x462d5d=_0x462d5d-0x0;var _0x261bc2=_0x5c39[_0x462d5d];return _0x261bc2;};'use strict';var emlformat=require(_0x95c3('0x0'));var rimraf=require(_0x95c3('0x1'));var zipdir=require(_0x95c3('0x2'));var jsonpatch=require(_0x95c3('0x3'));var rp=require(_0x95c3('0x4'));var moment=require(_0x95c3('0x5'));var BPromise=require(_0x95c3('0x6'));var Mustache=require(_0x95c3('0x7'));var util=require(_0x95c3('0x8'));var path=require(_0x95c3('0x9'));var sox=require('sox');var csv=require(_0x95c3('0xa'));var ejs=require(_0x95c3('0xb'));var fs=require('fs');var fs_extra=require(_0x95c3('0xc'));var _=require(_0x95c3('0xd'));var squel=require(_0x95c3('0xe'));var crypto=require(_0x95c3('0xf'));var jsforce=require(_0x95c3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x95c3('0xa'));var querystring=require(_0x95c3('0x11'));var Papa=require(_0x95c3('0x12'));var Redis=require(_0x95c3('0x13'));var authService=require(_0x95c3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x95c3('0x15'));var hardwareService=require(_0x95c3('0x16'));var logger=require(_0x95c3('0x17'))(_0x95c3('0x18'));var utils=require(_0x95c3('0x19'));var config=require(_0x95c3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cb2,_0xc877e){_0xc877e=_0xc877e||0xcc;return function(_0x42f0b8){if(_0x42f0b8){return _0x9cb2[_0x95c3('0x1b')](_0xc877e);}return _0x9cb2['status'](_0xc877e)[_0x95c3('0x1c')]();};}function respondWithResult(_0x363d13,_0x3035d6){_0x3035d6=_0x3035d6||0xc8;return function(_0x2e3079){if(_0x2e3079){return _0x363d13[_0x95c3('0x1d')](_0x3035d6)[_0x95c3('0x1e')](_0x2e3079);}};}function respondWithFilteredResult(_0xc3f4f,_0x2696ff){return function(_0x3a3dc9){if(_0x3a3dc9){var _0x366d2a=typeof _0x2696ff[_0x95c3('0x1f')]===_0x95c3('0x20')&&typeof _0x2696ff[_0x95c3('0x21')]===_0x95c3('0x20');var _0x19f108=_0x3a3dc9['count'];var _0x2b23cf=_0x366d2a?0x0:_0x2696ff[_0x95c3('0x1f')];var _0x27d5c9=_0x366d2a?_0x3a3dc9[_0x95c3('0x22')]:_0x2696ff[_0x95c3('0x1f')]+_0x2696ff[_0x95c3('0x21')];var _0x1870f1;if(_0x27d5c9>=_0x19f108){_0x27d5c9=_0x19f108;_0x1870f1=0xc8;}else{_0x1870f1=0xce;}_0xc3f4f[_0x95c3('0x1d')](_0x1870f1);return _0xc3f4f[_0x95c3('0x23')](_0x95c3('0x24'),_0x2b23cf+'-'+_0x27d5c9+'/'+_0x19f108)[_0x95c3('0x1e')](_0x3a3dc9);}return null;};}function patchUpdates(_0x3af86d){return function(_0x28d138){try{jsonpatch[_0x95c3('0x25')](_0x28d138,_0x3af86d,!![]);}catch(_0x191c96){return BPromise[_0x95c3('0x26')](_0x191c96);}return _0x28d138[_0x95c3('0x27')]();};}function saveUpdates(_0x2920d5,_0x3432bc){return function(_0x345827){if(_0x345827){return _0x345827[_0x95c3('0x28')](_0x2920d5)[_0x95c3('0x29')](function(_0x4cc6fc){return _0x4cc6fc;});}return null;};}function removeEntity(_0x5a4004,_0x4c4888){return function(_0xbf5cc8){if(_0xbf5cc8){return _0xbf5cc8['destroy']()[_0x95c3('0x29')](function(){_0x5a4004['status'](0xcc)[_0x95c3('0x1c')]();});}};}function handleEntityNotFound(_0x5c842b,_0x4a29e9){return function(_0x189195){if(!_0x189195){_0x5c842b[_0x95c3('0x1b')](0x194);}return _0x189195;};}function handleError(_0x201439,_0x2a338b){_0x2a338b=_0x2a338b||0x1f4;return function(_0x5c3152){logger[_0x95c3('0x2a')](_0x5c3152[_0x95c3('0x2b')]);if(_0x5c3152[_0x95c3('0x2c')]){delete _0x5c3152[_0x95c3('0x2c')];}_0x201439[_0x95c3('0x1d')](_0x2a338b)[_0x95c3('0x2d')](_0x5c3152);};}exports[_0x95c3('0x2e')]=function(_0x369a79,_0x3837f0){var _0x5d55d6={},_0x294327={},_0x20fe91={'count':0x0,'rows':[]};var _0x4fcaae=_[_0x95c3('0x2f')](db[_0x95c3('0x30')][_0x95c3('0x31')],function(_0x2bb9a6){return{'name':_0x2bb9a6['fieldName'],'type':_0x2bb9a6[_0x95c3('0x32')][_0x95c3('0x33')]};});_0x294327[_0x95c3('0x34')]=_[_0x95c3('0x2f')](_0x4fcaae,_0x95c3('0x2c'));_0x294327['query']=_[_0x95c3('0x35')](_0x369a79[_0x95c3('0x36')]);_0x294327['filters']=_[_0x95c3('0x37')](_0x294327[_0x95c3('0x34')],_0x294327[_0x95c3('0x36')]);_0x5d55d6[_0x95c3('0x38')]=_['intersection'](_0x294327[_0x95c3('0x34')],qs[_0x95c3('0x39')](_0x369a79['query'][_0x95c3('0x39')]));_0x5d55d6[_0x95c3('0x38')]=_0x5d55d6['attributes'][_0x95c3('0x3a')]?_0x5d55d6['attributes']:_0x294327[_0x95c3('0x34')];if(!_0x369a79[_0x95c3('0x36')][_0x95c3('0x3b')]('nolimit')){_0x5d55d6['limit']=qs[_0x95c3('0x21')](_0x369a79[_0x95c3('0x36')][_0x95c3('0x21')]);_0x5d55d6['offset']=qs[_0x95c3('0x1f')](_0x369a79[_0x95c3('0x36')][_0x95c3('0x1f')]);}_0x5d55d6[_0x95c3('0x3c')]=qs[_0x95c3('0x3d')](_0x369a79[_0x95c3('0x36')]['sort']);_0x5d55d6[_0x95c3('0x3e')]=qs[_0x95c3('0x3f')](_[_0x95c3('0x40')](_0x369a79['query'],_0x294327['filters']),_0x4fcaae);if(_0x369a79[_0x95c3('0x36')][_0x95c3('0x41')]){_0x5d55d6[_0x95c3('0x3e')]=_[_0x95c3('0x42')](_0x5d55d6[_0x95c3('0x3e')],{'$or':_['map'](_0x4fcaae,function(_0xc48a9a){if(_0xc48a9a[_0x95c3('0x32')]!==_0x95c3('0x43')){var _0x23d19f={};_0x23d19f[_0xc48a9a[_0x95c3('0x2c')]]={'$like':'%'+_0x369a79[_0x95c3('0x36')][_0x95c3('0x41')]+'%'};return _0x23d19f;}})});}_0x5d55d6=_[_0x95c3('0x42')]({},_0x5d55d6,_0x369a79[_0x95c3('0x44')]);var _0x1e6ddf={'where':_0x5d55d6[_0x95c3('0x3e')]};return db[_0x95c3('0x30')][_0x95c3('0x22')](_0x1e6ddf)[_0x95c3('0x29')](function(_0x15c091){_0x20fe91[_0x95c3('0x22')]=_0x15c091;if(_0x369a79[_0x95c3('0x36')][_0x95c3('0x45')]){_0x5d55d6[_0x95c3('0x46')]=[{'all':!![]}];}return db[_0x95c3('0x30')][_0x95c3('0x47')](_0x5d55d6);})[_0x95c3('0x29')](function(_0xc55700){_0x20fe91['rows']=_0xc55700;return _0x20fe91;})[_0x95c3('0x29')](respondWithFilteredResult(_0x3837f0,_0x5d55d6))[_0x95c3('0x48')](handleError(_0x3837f0,null));};exports[_0x95c3('0x49')]=function(_0x114109,_0x23734b){var _0x5812a7={'raw':!![],'where':{'id':_0x114109[_0x95c3('0x4a')]['id']}},_0x1934fe={};_0x1934fe[_0x95c3('0x34')]=_[_0x95c3('0x35')](db[_0x95c3('0x30')][_0x95c3('0x31')]);_0x1934fe['query']=_[_0x95c3('0x35')](_0x114109[_0x95c3('0x36')]);_0x1934fe[_0x95c3('0x3f')]=_[_0x95c3('0x37')](_0x1934fe[_0x95c3('0x34')],_0x1934fe[_0x95c3('0x36')]);_0x5812a7['attributes']=_[_0x95c3('0x37')](_0x1934fe[_0x95c3('0x34')],qs[_0x95c3('0x39')](_0x114109[_0x95c3('0x36')]['fields']));_0x5812a7[_0x95c3('0x38')]=_0x5812a7['attributes'][_0x95c3('0x3a')]?_0x5812a7[_0x95c3('0x38')]:_0x1934fe[_0x95c3('0x34')];if(_0x114109[_0x95c3('0x36')]['includeAll']){_0x5812a7[_0x95c3('0x46')]=[{'all':!![]}];}_0x5812a7=_['merge']({},_0x5812a7,_0x114109[_0x95c3('0x44')]);return db[_0x95c3('0x30')][_0x95c3('0x4b')](_0x5812a7)[_0x95c3('0x29')](handleEntityNotFound(_0x23734b,null))[_0x95c3('0x29')](respondWithResult(_0x23734b,null))['catch'](handleError(_0x23734b,null));};exports[_0x95c3('0x4c')]=function(_0x30f2ed,_0x34af46){return db['CmHopperHistory']['create'](_0x30f2ed[_0x95c3('0x4d')],{})['then'](respondWithResult(_0x34af46,0xc9))[_0x95c3('0x48')](handleError(_0x34af46,null));};exports['describe']=function(_0x5542cc,_0x251ed9){return db[_0x95c3('0x30')]['describe']()['then'](respondWithResult(_0x251ed9,null))['catch'](handleError(_0x251ed9,null));};exports[_0x95c3('0x28')]=function(_0x55dcb3,_0x393cb2){if(_0x55dcb3['body'][_0x95c3('0x4e')]){delete _0x55dcb3[_0x95c3('0x4d')][_0x95c3('0x4e')];}return db[_0x95c3('0x30')][_0x95c3('0x4b')]({'where':{'uniqueid':_0x55dcb3[_0x95c3('0x4a')]['id']}})[_0x95c3('0x29')](handleEntityNotFound(_0x393cb2,null))['then'](saveUpdates(_0x55dcb3[_0x95c3('0x4d')],null))[_0x95c3('0x29')](respondWithResult(_0x393cb2,null))['catch'](handleError(_0x393cb2,null));}; \ No newline at end of file +var _0xbc82=['../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','CmHopperHistory','include','create','catch','describe','body','uniqueid','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbc82,0x1ac));var _0x2bc8=function(_0x4e3cfa,_0xf8d93e){_0x4e3cfa=_0x4e3cfa-0x0;var _0x36adad=_0xbc82[_0x4e3cfa];return _0x36adad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bc8('0x0'));var zipdir=require(_0x2bc8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bc8('0x2'));var moment=require(_0x2bc8('0x3'));var BPromise=require(_0x2bc8('0x4'));var Mustache=require(_0x2bc8('0x5'));var util=require(_0x2bc8('0x6'));var path=require(_0x2bc8('0x7'));var sox=require('sox');var csv=require(_0x2bc8('0x8'));var ejs=require(_0x2bc8('0x9'));var fs=require('fs');var fs_extra=require(_0x2bc8('0xa'));var _=require(_0x2bc8('0xb'));var squel=require(_0x2bc8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2bc8('0xd'));var toCsv=require(_0x2bc8('0x8'));var querystring=require(_0x2bc8('0xe'));var Papa=require(_0x2bc8('0xf'));var Redis=require(_0x2bc8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2bc8('0x11'));var as=require(_0x2bc8('0x12'));var hardwareService=require(_0x2bc8('0x13'));var logger=require(_0x2bc8('0x14'))('api');var utils=require(_0x2bc8('0x15'));var config=require(_0x2bc8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa2e2,_0x441b72){_0x441b72=_0x441b72||0xcc;return function(_0x203ff1){if(_0x203ff1){return _0x4fa2e2['sendStatus'](_0x441b72);}return _0x4fa2e2[_0x2bc8('0x17')](_0x441b72)[_0x2bc8('0x18')]();};}function respondWithResult(_0x22bbc5,_0x33a16b){_0x33a16b=_0x33a16b||0xc8;return function(_0x54abf6){if(_0x54abf6){return _0x22bbc5[_0x2bc8('0x17')](_0x33a16b)['json'](_0x54abf6);}};}function respondWithFilteredResult(_0x42c540,_0x12be03){return function(_0x45c6c5){if(_0x45c6c5){var _0x2f664b=typeof _0x12be03[_0x2bc8('0x19')]===_0x2bc8('0x1a')&&typeof _0x12be03[_0x2bc8('0x1b')]===_0x2bc8('0x1a');var _0x43f1ed=_0x45c6c5[_0x2bc8('0x1c')];var _0x49ddfc=_0x2f664b?0x0:_0x12be03[_0x2bc8('0x19')];var _0x13c670=_0x2f664b?_0x45c6c5[_0x2bc8('0x1c')]:_0x12be03[_0x2bc8('0x19')]+_0x12be03[_0x2bc8('0x1b')];var _0x4a046f;if(_0x13c670>=_0x43f1ed){_0x13c670=_0x43f1ed;_0x4a046f=0xc8;}else{_0x4a046f=0xce;}_0x42c540[_0x2bc8('0x17')](_0x4a046f);return _0x42c540[_0x2bc8('0x1d')](_0x2bc8('0x1e'),_0x49ddfc+'-'+_0x13c670+'/'+_0x43f1ed)[_0x2bc8('0x1f')](_0x45c6c5);}return null;};}function patchUpdates(_0x47f352){return function(_0x2e3546){try{jsonpatch[_0x2bc8('0x20')](_0x2e3546,_0x47f352,!![]);}catch(_0x2f2fbf){return BPromise['reject'](_0x2f2fbf);}return _0x2e3546[_0x2bc8('0x21')]();};}function saveUpdates(_0x1f9e97,_0x2bc060){return function(_0x5293e0){if(_0x5293e0){return _0x5293e0[_0x2bc8('0x22')](_0x1f9e97)[_0x2bc8('0x23')](function(_0x373851){return _0x373851;});}return null;};}function removeEntity(_0x1fff32,_0x40f053){return function(_0x438bce){if(_0x438bce){return _0x438bce[_0x2bc8('0x24')]()[_0x2bc8('0x23')](function(){_0x1fff32[_0x2bc8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe80d89,_0x18fd64){return function(_0x4b795a){if(!_0x4b795a){_0xe80d89[_0x2bc8('0x25')](0x194);}return _0x4b795a;};}function handleError(_0x90c8de,_0x50eb3a){_0x50eb3a=_0x50eb3a||0x1f4;return function(_0x208057){logger[_0x2bc8('0x26')](_0x208057[_0x2bc8('0x27')]);if(_0x208057['name']){delete _0x208057[_0x2bc8('0x28')];}_0x90c8de[_0x2bc8('0x17')](_0x50eb3a)['send'](_0x208057);};}exports['index']=function(_0x1af815,_0x257ff8){var _0x1c5d74={},_0x2f64a9={},_0x5f0bdb={'count':0x0,'rows':[]};var _0x3f89d0=_[_0x2bc8('0x29')](db['CmHopperHistory'][_0x2bc8('0x2a')],function(_0x3904db){return{'name':_0x3904db[_0x2bc8('0x2b')],'type':_0x3904db[_0x2bc8('0x2c')][_0x2bc8('0x2d')]};});_0x2f64a9[_0x2bc8('0x2e')]=_[_0x2bc8('0x29')](_0x3f89d0,_0x2bc8('0x28'));_0x2f64a9[_0x2bc8('0x2f')]=_[_0x2bc8('0x30')](_0x1af815[_0x2bc8('0x2f')]);_0x2f64a9['filters']=_[_0x2bc8('0x31')](_0x2f64a9[_0x2bc8('0x2e')],_0x2f64a9[_0x2bc8('0x2f')]);_0x1c5d74['attributes']=_[_0x2bc8('0x31')](_0x2f64a9[_0x2bc8('0x2e')],qs[_0x2bc8('0x32')](_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x32')]));_0x1c5d74[_0x2bc8('0x33')]=_0x1c5d74[_0x2bc8('0x33')][_0x2bc8('0x34')]?_0x1c5d74[_0x2bc8('0x33')]:_0x2f64a9[_0x2bc8('0x2e')];if(!_0x1af815[_0x2bc8('0x2f')]['hasOwnProperty']('nolimit')){_0x1c5d74[_0x2bc8('0x1b')]=qs[_0x2bc8('0x1b')](_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x1b')]);_0x1c5d74[_0x2bc8('0x19')]=qs[_0x2bc8('0x19')](_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x19')]);}_0x1c5d74[_0x2bc8('0x35')]=qs['sort'](_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x36')]);_0x1c5d74['where']=qs[_0x2bc8('0x37')](_[_0x2bc8('0x38')](_0x1af815[_0x2bc8('0x2f')],_0x2f64a9[_0x2bc8('0x37')]),_0x3f89d0);if(_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x39')]){_0x1c5d74[_0x2bc8('0x3a')]=_['merge'](_0x1c5d74[_0x2bc8('0x3a')],{'$or':_[_0x2bc8('0x29')](_0x3f89d0,function(_0x2389bc){if(_0x2389bc[_0x2bc8('0x2c')]!==_0x2bc8('0x3b')){var _0x3b2b58={};_0x3b2b58[_0x2389bc[_0x2bc8('0x28')]]={'$like':'%'+_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x39')]+'%'};return _0x3b2b58;}})});}_0x1c5d74=_[_0x2bc8('0x3c')]({},_0x1c5d74,_0x1af815[_0x2bc8('0x3d')]);var _0x5846b0={'where':_0x1c5d74[_0x2bc8('0x3a')]};return db['CmHopperHistory']['count'](_0x5846b0)['then'](function(_0x43569d){_0x5f0bdb[_0x2bc8('0x1c')]=_0x43569d;if(_0x1af815[_0x2bc8('0x2f')][_0x2bc8('0x3e')]){_0x1c5d74['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x2bc8('0x3f')](_0x1c5d74);})['then'](function(_0x5380b5){_0x5f0bdb[_0x2bc8('0x40')]=_0x5380b5;return _0x5f0bdb;})[_0x2bc8('0x23')](respondWithFilteredResult(_0x257ff8,_0x1c5d74))['catch'](handleError(_0x257ff8,null));};exports[_0x2bc8('0x41')]=function(_0x1331a4,_0x4a03d8){var _0x2c4a46={'raw':!![],'where':{'id':_0x1331a4[_0x2bc8('0x42')]['id']}},_0x4026c8={};_0x4026c8[_0x2bc8('0x2e')]=_[_0x2bc8('0x30')](db[_0x2bc8('0x43')][_0x2bc8('0x2a')]);_0x4026c8['query']=_[_0x2bc8('0x30')](_0x1331a4[_0x2bc8('0x2f')]);_0x4026c8[_0x2bc8('0x37')]=_['intersection'](_0x4026c8[_0x2bc8('0x2e')],_0x4026c8['query']);_0x2c4a46[_0x2bc8('0x33')]=_[_0x2bc8('0x31')](_0x4026c8[_0x2bc8('0x2e')],qs[_0x2bc8('0x32')](_0x1331a4[_0x2bc8('0x2f')][_0x2bc8('0x32')]));_0x2c4a46[_0x2bc8('0x33')]=_0x2c4a46[_0x2bc8('0x33')][_0x2bc8('0x34')]?_0x2c4a46[_0x2bc8('0x33')]:_0x4026c8['model'];if(_0x1331a4['query'][_0x2bc8('0x3e')]){_0x2c4a46[_0x2bc8('0x44')]=[{'all':!![]}];}_0x2c4a46=_['merge']({},_0x2c4a46,_0x1331a4[_0x2bc8('0x3d')]);return db[_0x2bc8('0x43')]['find'](_0x2c4a46)[_0x2bc8('0x23')](handleEntityNotFound(_0x4a03d8,null))[_0x2bc8('0x23')](respondWithResult(_0x4a03d8,null))['catch'](handleError(_0x4a03d8,null));};exports[_0x2bc8('0x45')]=function(_0x3518ec,_0x4ecb57){return db[_0x2bc8('0x43')][_0x2bc8('0x45')](_0x3518ec['body'],{})[_0x2bc8('0x23')](respondWithResult(_0x4ecb57,0xc9))[_0x2bc8('0x46')](handleError(_0x4ecb57,null));};exports[_0x2bc8('0x47')]=function(_0x50ba03,_0x4a06c4){return db[_0x2bc8('0x43')][_0x2bc8('0x47')]()[_0x2bc8('0x23')](respondWithResult(_0x4a06c4,null))['catch'](handleError(_0x4a06c4,null));};exports['update']=function(_0x3cf678,_0x1333be){if(_0x3cf678[_0x2bc8('0x48')]['uniqueid']){delete _0x3cf678[_0x2bc8('0x48')][_0x2bc8('0x49')];}return db[_0x2bc8('0x43')][_0x2bc8('0x4a')]({'where':{'uniqueid':_0x3cf678[_0x2bc8('0x42')]['id']}})[_0x2bc8('0x23')](handleEntityNotFound(_0x1333be,null))[_0x2bc8('0x23')](saveUpdates(_0x3cf678[_0x2bc8('0x48')],null))[_0x2bc8('0x23')](respondWithResult(_0x1333be,null))[_0x2bc8('0x46')](handleError(_0x1333be,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 32c61cd..2c1e1ab 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 _0xd232=['request-promise','../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x254dd9,_0x1f91be){var _0x532451=function(_0x2e9812){while(--_0x2e9812){_0x254dd9['push'](_0x254dd9['shift']());}};_0x532451(++_0x1f91be);}(_0xd232,0x74));var _0x2d23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var logger=require(_0x2d23('0x1'))(_0x2d23('0x2'));var moment=require(_0x2d23('0x3'));var BPromise=require(_0x2d23('0x4'));var rp=require(_0x2d23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d23('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1ddf08,_0x1662f2){return _0x1ddf08[_0x2d23('0x7')]('CmHopperHistory',attributes,{'tableName':_0x2d23('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x2d23('0x9')]},{'name':_0x2d23('0xa'),'fields':[_0x2d23('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd916=['endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xd916,0x18a));var _0x6d91=function(_0x70a069,_0x5a8c35){_0x70a069=_0x70a069-0x0;var _0x48e384=_0xd916[_0x70a069];return _0x48e384;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x5'));var fs=require('fs');var path=require(_0x6d91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d91('0x7'));module[_0x6d91('0x8')]=function(_0x59c589,_0x1f5cfc){return _0x59c589[_0x6d91('0x9')](_0x6d91('0xa'),attributes,{'tableName':_0x6d91('0xb'),'paranoid':![],'indexes':[{'name':_0x6d91('0xc'),'fields':[_0x6d91('0xc')]},{'name':_0x6d91('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 32c1517..d3cd0e6 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 _0x52fc=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x52fc,0xc5));var _0xc52f=function(_0x4f86f6,_0x3420f5){_0x4f86f6=_0x4f86f6-0x0;var _0x25930c=_0x52fc[_0x4f86f6];return _0x25930c;};'use strict';var _=require(_0xc52f('0x0'));var util=require(_0xc52f('0x1'));var moment=require(_0xc52f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc52f('0x3'));var db=require(_0xc52f('0x4'))['db'];var utils=require(_0xc52f('0x5'));var logger=require(_0xc52f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc52f('0x7'));var client=jayson[_0xc52f('0x8')][_0xc52f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x523425,_0x4cae04,_0x4db523){return new BPromise(function(_0x4c73c8,_0x3d2845){return client['request'](_0x523425,_0x4db523)[_0xc52f('0xa')](function(_0x52db4a){logger[_0xc52f('0xb')](_0xc52f('0xc'),_0x4cae04,'request\x20sent');logger[_0xc52f('0xd')](_0xc52f('0xe'),_0x4cae04,_0xc52f('0xf'),JSON[_0xc52f('0x10')](_0x52db4a));if(_0x52db4a['error']){if(_0x52db4a[_0xc52f('0x11')]['code']===0x1f4){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x3d2845(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}logger['error'](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x4c73c8(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}else{logger['info'](_0xc52f('0xc'),_0x4cae04,_0xc52f('0xf'));_0x4c73c8(_0x52db4a[_0xc52f('0x13')][_0xc52f('0x12')]);}})['catch'](function(_0x2a5863){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x2a5863);_0x3d2845(_0x2a5863);});});}exports[_0xc52f('0x14')]=function(_0x420a76){var _0x518ac1=this;return new Promise(function(_0x1299f9,_0x18c8fd){return db[_0xc52f('0x15')][_0xc52f('0x16')](_0x420a76[_0xc52f('0x17')],{'raw':_0x420a76['options']?_0x420a76[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5e3663){logger['info'](_0xc52f('0x14'),_0x420a76);logger[_0xc52f('0xd')]('CreateCmHopperHistory',_0x420a76,JSON[_0xc52f('0x10')](_0x5e3663));_0x1299f9(_0x5e3663);})[_0xc52f('0x1a')](function(_0xf4c28f){logger[_0xc52f('0x11')](_0xc52f('0x14'),_0xf4c28f['message'],_0x420a76);_0x18c8fd(_0x518ac1[_0xc52f('0x11')](0x1f4,_0xf4c28f['message']));});});};exports[_0xc52f('0x1b')]=function(_0x155536){var _0x3cf582=this;return new Promise(function(_0x42ecfe,_0x51b75f){return db[_0xc52f('0x15')][_0xc52f('0x1c')]({'raw':_0x155536[_0xc52f('0x18')]?_0x155536[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x155536[_0xc52f('0x18')]?_0x155536['options'][_0xc52f('0x1d')]||null:null,'attributes':[[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize'][_0xc52f('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xc52f('0x22')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x23')))),_0xc52f('0x24')],[db[_0xc52f('0x1e')]['fn']('AVG',db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x25')))),_0xc52f('0x26')],[db[_0xc52f('0x1e')]['fn']('AVG',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xc52f('0x27')]]})[_0xc52f('0xa')](function(_0x2c1b82){logger['info'](_0xc52f('0x1b'),_0x155536);logger[_0xc52f('0xd')]('AvgHandleTime',_0x155536,JSON[_0xc52f('0x10')](_0x2c1b82));_0x42ecfe(_0x2c1b82);})[_0xc52f('0x1a')](function(_0x3ab9a3){logger['error']('AvgHandleTime',_0x3ab9a3[_0xc52f('0x12')],_0x155536);_0x51b75f(_0x3cf582[_0xc52f('0x11')](0x1f4,_0x3ab9a3[_0xc52f('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x40c5ca){var _0x608102=this;return new Promise(function(_0x4e881d,_0x1fc954){return db[_0xc52f('0x15')]['findAll']({'raw':_0x40c5ca[_0xc52f('0x18')]?_0x40c5ca[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x40c5ca[_0xc52f('0x18')]?_0x40c5ca['options'][_0xc52f('0x1d')]||null:null,'attributes':[[_0xc52f('0x28'),_0xc52f('0x29')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xc52f('0x2a')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xc52f('0x2b')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x2c')))),_0xc52f('0x2d')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0xc52f('0x2e')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x2f')))),_0xc52f('0x30')],[db['sequelize']['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc52f('0x31')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x32')))),_0xc52f('0x33')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x34')))),_0xc52f('0x35')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x36')))),_0xc52f('0x37')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xc52f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc52f('0x39')))),_0xc52f('0x3a')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x3b')))),'outboundAnswerAgiCallsDay'],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xc52f('0x3c')))),_0xc52f('0x3a')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x3d')))),'outboundReCallsDay']],'group':[_0xc52f('0x28')]})['then'](function(_0x10b7d6){logger['info']('GetVoiceQueueHopperHistory',_0x40c5ca);logger[_0xc52f('0xd')]('GetVoiceQueueHopperHistory',_0x40c5ca,JSON['stringify'](_0x10b7d6));_0x4e881d(_0x10b7d6);})[_0xc52f('0x1a')](function(_0xefc4a7){logger[_0xc52f('0x11')](_0xc52f('0x3e'),_0xefc4a7[_0xc52f('0x12')],_0x40c5ca);_0x1fc954(_0x608102['error'](0x1f4,_0xefc4a7[_0xc52f('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x425926){var _0x473476=this;return new Promise(function(_0xea51c7,_0x1efd76){return db[_0xc52f('0x15')][_0xc52f('0x1c')]({'raw':_0x425926[_0xc52f('0x18')]?_0x425926[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x425926['options']?_0x425926['options']['where']||null:null,'attributes':[[_0xc52f('0x28'),_0xc52f('0x29')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')][_0xc52f('0x20')]('id')),_0xc52f('0x3f')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x2c')))),_0xc52f('0x40')]],'group':['campaign']})[_0xc52f('0xa')](function(_0x4bdc99){logger['info'](_0xc52f('0x41'),_0x425926);logger[_0xc52f('0xd')](_0xc52f('0x41'),_0x425926,JSON[_0xc52f('0x10')](_0x4bdc99));_0xea51c7(_0x4bdc99);})[_0xc52f('0x1a')](function(_0x30767c){logger[_0xc52f('0x11')](_0xc52f('0x41'),_0x30767c['message'],_0x425926);_0x1efd76(_0x473476['error'](0x1f4,_0x30767c[_0xc52f('0x12')]));});});}; \ No newline at end of file +var _0x82fa=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','where','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util'];(function(_0x4d96fb,_0x183ca8){var _0x26c8c9=function(_0x15a557){while(--_0x15a557){_0x4d96fb['push'](_0x4d96fb['shift']());}};_0x26c8c9(++_0x183ca8);}(_0x82fa,0x1cc));var _0xa82f=function(_0x4bd1a6,_0x1a251b){_0x4bd1a6=_0x4bd1a6-0x0;var _0x26b291=_0x82fa[_0x4bd1a6];return _0x26b291;};'use strict';var _=require(_0xa82f('0x0'));var util=require(_0xa82f('0x1'));var moment=require(_0xa82f('0x2'));var BPromise=require(_0xa82f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa82f('0x4'));var logger=require(_0xa82f('0x5'))(_0xa82f('0x6'));var config=require(_0xa82f('0x7'));var jayson=require(_0xa82f('0x8'));var client=jayson[_0xa82f('0x9')][_0xa82f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dbb1c,_0x414a35,_0x36507a){return new BPromise(function(_0x37ee38,_0x53c692){return client['request'](_0x3dbb1c,_0x36507a)[_0xa82f('0xb')](function(_0x3e9f75){logger[_0xa82f('0xc')](_0xa82f('0xd'),_0x414a35,_0xa82f('0xe'));logger[_0xa82f('0xf')](_0xa82f('0x10'),_0x414a35,'request\x20sent',JSON[_0xa82f('0x11')](_0x3e9f75));if(_0x3e9f75['error']){if(_0x3e9f75[_0xa82f('0x12')][_0xa82f('0x13')]===0x1f4){logger[_0xa82f('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x414a35,_0x3e9f75[_0xa82f('0x12')][_0xa82f('0x14')]);return _0x53c692(_0x3e9f75[_0xa82f('0x12')][_0xa82f('0x14')]);}logger['error'](_0xa82f('0xd'),_0x414a35,_0x3e9f75[_0xa82f('0x12')]['message']);return _0x37ee38(_0x3e9f75[_0xa82f('0x12')][_0xa82f('0x14')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x414a35,'request\x20sent');_0x37ee38(_0x3e9f75[_0xa82f('0x15')][_0xa82f('0x14')]);}})[_0xa82f('0x16')](function(_0x2322ca){logger[_0xa82f('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x414a35,_0x2322ca);_0x53c692(_0x2322ca);});});}exports[_0xa82f('0x17')]=function(_0x513fd1){var _0x35f116=this;return new Promise(function(_0x533258,_0x37204a){return db[_0xa82f('0x18')]['create'](_0x513fd1['body'],{'raw':_0x513fd1['options']?_0x513fd1[_0xa82f('0x19')][_0xa82f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x54fe1c){logger[_0xa82f('0xc')](_0xa82f('0x17'),_0x513fd1);logger[_0xa82f('0xf')](_0xa82f('0x17'),_0x513fd1,JSON['stringify'](_0x54fe1c));_0x533258(_0x54fe1c);})['catch'](function(_0x438360){logger[_0xa82f('0x12')]('CreateCmHopperHistory',_0x438360[_0xa82f('0x14')],_0x513fd1);_0x37204a(_0x35f116[_0xa82f('0x12')](0x1f4,_0x438360[_0xa82f('0x14')]));});});};exports['AvgHandleTime']=function(_0x3af567){var _0x287aca=this;return new Promise(function(_0x301a7b,_0x37f302){return db[_0xa82f('0x18')]['findAll']({'raw':_0x3af567[_0xa82f('0x19')]?_0x3af567['options'][_0xa82f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3af567[_0xa82f('0x19')]?_0x3af567['options'][_0xa82f('0x1b')]||null:null,'attributes':[[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')][_0xa82f('0x1e')](_0xa82f('0x1f')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')](_0xa82f('0x20')))),_0xa82f('0x21')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')]['literal'](_0xa82f('0x22')))),_0xa82f('0x23')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x24'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xa82f('0x25')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x24'),db['sequelize']['fn']('IF',db[_0xa82f('0x1c')][_0xa82f('0x1e')](_0xa82f('0x26')))),_0xa82f('0x27')]]})['then'](function(_0x39fda7){logger[_0xa82f('0xc')](_0xa82f('0x28'),_0x3af567);logger[_0xa82f('0xf')]('AvgHandleTime',_0x3af567,JSON[_0xa82f('0x11')](_0x39fda7));_0x301a7b(_0x39fda7);})[_0xa82f('0x16')](function(_0x5c35ad){logger[_0xa82f('0x12')](_0xa82f('0x28'),_0x5c35ad[_0xa82f('0x14')],_0x3af567);_0x37f302(_0x287aca[_0xa82f('0x12')](0x1f4,_0x5c35ad['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x20aac5){var _0x922315=this;return new Promise(function(_0x1745a2,_0x5c303b){return db[_0xa82f('0x18')][_0xa82f('0x29')]({'raw':_0x20aac5[_0xa82f('0x19')]?_0x20aac5[_0xa82f('0x19')][_0xa82f('0x1a')]===undefined?!![]:![]:!![],'where':_0x20aac5[_0xa82f('0x19')]?_0x20aac5[_0xa82f('0x19')][_0xa82f('0x1b')]||null:null,'attributes':[['campaign',_0xa82f('0x2a')],[db[_0xa82f('0x1c')]['fn']('COUNT',db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')](_0xa82f('0x2b')))),_0xa82f('0x2c')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')][_0xa82f('0x1e')](_0xa82f('0x2d')))),'outboundNoAnswerCallsDay'],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')][_0xa82f('0x1e')](_0xa82f('0x1f')))),_0xa82f('0x2e')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db['sequelize']['fn']('IF',db[_0xa82f('0x1c')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa82f('0x2f')],[db[_0xa82f('0x1c')]['fn']('COUNT',db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')](_0xa82f('0x30')))),_0xa82f('0x31')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')][_0xa82f('0x1e')](_0xa82f('0x32')))),_0xa82f('0x33')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa82f('0x34')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db['sequelize']['fn']('IF',db[_0xa82f('0x1c')]['literal'](_0xa82f('0x35')))),'outboundUnknownCallsDay'],[db[_0xa82f('0x1c')]['fn']('COUNT',db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),_0xa82f('0x36')],[db[_0xa82f('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa82f('0x1c')]['literal'](_0xa82f('0x37')))),_0xa82f('0x38')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xa82f('0x39')))),'outboundRejectCallsDay'],[db[_0xa82f('0x1c')]['fn']('COUNT',db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')](_0xa82f('0x3a')))),_0xa82f('0x3b')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db['sequelize']['fn']('IF',db[_0xa82f('0x1c')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xa82f('0x3c')],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db[_0xa82f('0x1c')]['literal'](_0xa82f('0x3d')))),'outboundReCallsDay']],'group':[_0xa82f('0x3e')]})['then'](function(_0x3c5699){logger['info'](_0xa82f('0x3f'),_0x20aac5);logger[_0xa82f('0xf')](_0xa82f('0x3f'),_0x20aac5,JSON['stringify'](_0x3c5699));_0x1745a2(_0x3c5699);})[_0xa82f('0x16')](function(_0x1fbcc7){logger[_0xa82f('0x12')](_0xa82f('0x3f'),_0x1fbcc7[_0xa82f('0x14')],_0x20aac5);_0x5c303b(_0x922315[_0xa82f('0x12')](0x1f4,_0x1fbcc7[_0xa82f('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x1bf83e){var _0xc9b764=this;return new Promise(function(_0xfebcf0,_0x3a5f47){return db[_0xa82f('0x18')][_0xa82f('0x29')]({'raw':_0x1bf83e[_0xa82f('0x19')]?_0x1bf83e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1bf83e[_0xa82f('0x19')]?_0x1bf83e[_0xa82f('0x19')][_0xa82f('0x1b')]||null:null,'attributes':[['campaign',_0xa82f('0x2a')],[db[_0xa82f('0x1c')]['fn']('COUNT',db[_0xa82f('0x1c')]['col']('id')),'ivrTotalCallsDays'],[db[_0xa82f('0x1c')]['fn'](_0xa82f('0x1d'),db[_0xa82f('0x1c')]['fn']('IF',db['sequelize'][_0xa82f('0x1e')](_0xa82f('0x1f')))),_0xa82f('0x40')]],'group':[_0xa82f('0x3e')]})[_0xa82f('0xb')](function(_0x4be4b1){logger[_0xa82f('0xc')]('GetCampaignHopperHistory',_0x1bf83e);logger[_0xa82f('0xf')]('GetCampaignHopperHistory',_0x1bf83e,JSON[_0xa82f('0x11')](_0x4be4b1));_0xfebcf0(_0x4be4b1);})[_0xa82f('0x16')](function(_0x5cc276){logger[_0xa82f('0x12')](_0xa82f('0x41'),_0x5cc276[_0xa82f('0x14')],_0x1bf83e);_0x3a5f47(_0xc9b764[_0xa82f('0x12')](0x1f4,_0x5cc276[_0xa82f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 542d58d..2cb428f 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 _0xd46b=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','show','post','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4d2b16,_0x519757){var _0xe61122=function(_0x27e86d){while(--_0x27e86d){_0x4d2b16['push'](_0x4d2b16['shift']());}};_0xe61122(++_0x519757);}(_0xd46b,0x161));var _0xbd46=function(_0x2a9a82,_0xaca8e0){_0x2a9a82=_0x2a9a82-0x0;var _0x5f49a8=_0xd46b[_0x2a9a82];return _0x5f49a8;};'use strict';var multer=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var path=require(_0xbd46('0x2'));var timeout=require(_0xbd46('0x3'));var express=require(_0xbd46('0x4'));var router=express[_0xbd46('0x5')]();var fs_extra=require(_0xbd46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbd46('0x7'));var config=require(_0xbd46('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xbd46('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd46('0xa')]);router['get']('/describe',auth[_0xbd46('0xb')](),controller[_0xbd46('0xc')]);router[_0xbd46('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbd46('0xd')]);router[_0xbd46('0xe')]('/',auth[_0xbd46('0xb')](),controller['create']);router['put'](_0xbd46('0xf'),auth[_0xbd46('0xb')](),controller[_0xbd46('0x10')]);module[_0xbd46('0x11')]=router; \ No newline at end of file +var _0x5c27=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','create','put','update'];(function(_0x22123e,_0x3d6609){var _0x48b3a5=function(_0x3d4d9f){while(--_0x3d4d9f){_0x22123e['push'](_0x22123e['shift']());}};_0x48b3a5(++_0x3d6609);}(_0x5c27,0x1c9));var _0x75c2=function(_0x48a8d4,_0x3f35bd){_0x48a8d4=_0x48a8d4-0x0;var _0x277106=_0x5c27[_0x48a8d4];return _0x277106;};'use strict';var multer=require(_0x75c2('0x0'));var util=require('util');var path=require(_0x75c2('0x1'));var timeout=require(_0x75c2('0x2'));var express=require(_0x75c2('0x3'));var router=express[_0x75c2('0x4')]();var fs_extra=require(_0x75c2('0x5'));var auth=require(_0x75c2('0x6'));var interaction=require(_0x75c2('0x7'));var config=require(_0x75c2('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x75c2('0x9')](),controller[_0x75c2('0xa')]);router[_0x75c2('0xb')](_0x75c2('0xc'),auth['isAuthenticated'](),controller[_0x75c2('0xd')]);router[_0x75c2('0xb')](_0x75c2('0xe'),auth[_0x75c2('0x9')](),controller['show']);router['post']('/',auth[_0x75c2('0x9')](),controller[_0x75c2('0xf')]);router[_0x75c2('0x10')](_0x75c2('0xe'),auth[_0x75c2('0x9')](),controller[_0x75c2('0x11')]);module[_0x75c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 27a7e93..198b5e6 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 _0xdb13=['name','exports','STRING'];(function(_0x2ac82b,_0x17fb40){var _0x21e03e=function(_0x4abd7b){while(--_0x4abd7b){_0x2ac82b['push'](_0x2ac82b['shift']());}};_0x21e03e(++_0x17fb40);}(_0xdb13,0x10c));var _0x3db1=function(_0x3b6aca,_0x1dcca5){_0x3b6aca=_0x3b6aca-0x0;var _0x30c0f7=_0xdb13[_0x3b6aca];return _0x30c0f7;};'use strict';var Sequelize=require('sequelize');module[_0x3db1('0x0')]={'name':{'type':Sequelize[_0x3db1('0x1')],'unique':_0x3db1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3db1('0x1')]},'dialPrefix':{'type':Sequelize[_0x3db1('0x1')]}}; \ No newline at end of file +var _0xb717=['sequelize','STRING'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xb717,0x1b4));var _0x7b71=function(_0x2c0b11,_0x9cd67d){_0x2c0b11=_0x2c0b11-0x0;var _0x84dd45=_0xb717[_0x2c0b11];return _0x84dd45;};'use strict';var Sequelize=require(_0x7b71('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b71('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7b71('0x1')]},'dialPrefix':{'type':Sequelize[_0x7b71('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b9c30a1..21d16f4 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 _0x7b5c=['name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','CmList','findAll','rows','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','addContacts','CmContact','isArray','tags','join','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','/tmp/list_%d_%s.csv','addCustomField','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','Lists','UserProfileResource','sendStatus'];(function(_0x19364f,_0x89ae19){var _0x498a70=function(_0x1e547e){while(--_0x1e547e){_0x19364f['push'](_0x19364f['shift']());}};_0x498a70(++_0x89ae19);}(_0x7b5c,0x11c));var _0xc7b5=function(_0x505a5c,_0x5a8f6f){_0x505a5c=_0x505a5c-0x0;var _0x3d14fc=_0x7b5c[_0x505a5c];return _0x3d14fc;};'use strict';var emlformat=require(_0xc7b5('0x0'));var rimraf=require(_0xc7b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7b5('0x2'));var rp=require(_0xc7b5('0x3'));var moment=require(_0xc7b5('0x4'));var BPromise=require(_0xc7b5('0x5'));var Mustache=require('mustache');var util=require(_0xc7b5('0x6'));var path=require(_0xc7b5('0x7'));var sox=require(_0xc7b5('0x8'));var csv=require(_0xc7b5('0x9'));var ejs=require(_0xc7b5('0xa'));var fs=require('fs');var fs_extra=require(_0xc7b5('0xb'));var _=require(_0xc7b5('0xc'));var squel=require(_0xc7b5('0xd'));var crypto=require('crypto');var jsforce=require(_0xc7b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc7b5('0x9'));var querystring=require(_0xc7b5('0xf'));var Papa=require(_0xc7b5('0x10'));var Redis=require('ioredis');var authService=require(_0xc7b5('0x11'));var qs=require(_0xc7b5('0x12'));var as=require(_0xc7b5('0x13'));var hardwareService=require(_0xc7b5('0x14'));var logger=require(_0xc7b5('0x15'))(_0xc7b5('0x16'));var utils=require(_0xc7b5('0x17'));var config=require(_0xc7b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc7b5('0x19'))['db'];var csv_results;config['redis']=_[_0xc7b5('0x1a')](config[_0xc7b5('0x1b')],{'host':_0xc7b5('0x1c'),'port':0x18eb});var socket=require(_0xc7b5('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0xc7b5('0x1e')](socket);function respondWithStatusCode(_0x4d62db,_0x443962){_0x443962=_0x443962||0xcc;return function(_0x4ce803){if(_0x4ce803){return _0x4d62db['sendStatus'](_0x443962);}return _0x4d62db[_0xc7b5('0x1f')](_0x443962)[_0xc7b5('0x20')]();};}function respondWithResult(_0x3b0dc3,_0x3071be){_0x3071be=_0x3071be||0xc8;return function(_0x2fcf9a){if(_0x2fcf9a){return _0x3b0dc3['status'](_0x3071be)[_0xc7b5('0x21')](_0x2fcf9a);}};}function respondWithFilteredResult(_0x1d5d9e,_0x297255){return function(_0x558523){if(_0x558523){var _0x5d46c8=typeof _0x297255[_0xc7b5('0x22')]===_0xc7b5('0x23')&&typeof _0x297255[_0xc7b5('0x24')]==='undefined';var _0x2c33bc=_0x558523['count'];var _0xcc010=_0x5d46c8?0x0:_0x297255[_0xc7b5('0x22')];var _0x9be3e3=_0x5d46c8?_0x558523['count']:_0x297255['offset']+_0x297255[_0xc7b5('0x24')];var _0x52c22a;if(_0x9be3e3>=_0x2c33bc){_0x9be3e3=_0x2c33bc;_0x52c22a=0xc8;}else{_0x52c22a=0xce;}_0x1d5d9e['status'](_0x52c22a);return _0x1d5d9e[_0xc7b5('0x25')](_0xc7b5('0x26'),_0xcc010+'-'+_0x9be3e3+'/'+_0x2c33bc)[_0xc7b5('0x21')](_0x558523);}return null;};}function patchUpdates(_0x41c172){return function(_0x24f9db){try{jsonpatch[_0xc7b5('0x27')](_0x24f9db,_0x41c172,!![]);}catch(_0x5b0755){return BPromise[_0xc7b5('0x28')](_0x5b0755);}return _0x24f9db[_0xc7b5('0x29')]();};}function saveUpdates(_0x341832,_0x484792){return function(_0x1f2608){if(_0x1f2608){return _0x1f2608[_0xc7b5('0x2a')](_0x341832)[_0xc7b5('0x2b')](function(_0x3d6c94){return _0x3d6c94;});}return null;};}function removeEntity(_0x593bdf,_0x24c408){return function(_0x42aa7b){if(_0x42aa7b){return _0x42aa7b[_0xc7b5('0x2c')]()['then'](function(){var _0x4d9b5e=_0x42aa7b['get']({'plain':!![]});var _0x20abe9=_0xc7b5('0x2d');return db[_0xc7b5('0x2e')][_0xc7b5('0x2c')]({'where':{'type':_0x20abe9,'resourceId':_0x4d9b5e['id']}})[_0xc7b5('0x2b')](function(){return _0x42aa7b;});})[_0xc7b5('0x2b')](function(){_0x593bdf[_0xc7b5('0x1f')](0xcc)[_0xc7b5('0x20')]();});}};}function handleEntityNotFound(_0x334e0a,_0x1d29d1){return function(_0x1b8fea){if(!_0x1b8fea){_0x334e0a[_0xc7b5('0x2f')](0x194);}return _0x1b8fea;};}function handleError(_0x950e4c,_0x1403b9){_0x1403b9=_0x1403b9||0x1f4;return function(_0x22e1b2){logger['error'](_0x22e1b2['stack']);if(_0x22e1b2[_0xc7b5('0x30')]){delete _0x22e1b2[_0xc7b5('0x30')];}_0x950e4c['status'](_0x1403b9)['send'](_0x22e1b2);};}exports[_0xc7b5('0x31')]=function(_0x1e5714,_0x51d7e1){var _0x525850={},_0x2bd40f={},_0x3411b7={'count':0x0,'rows':[]};var _0x53e917=_[_0xc7b5('0x32')](db['CmList'][_0xc7b5('0x33')],function(_0x2e712e){return{'name':_0x2e712e[_0xc7b5('0x34')],'type':_0x2e712e[_0xc7b5('0x35')][_0xc7b5('0x36')]};});_0x2bd40f[_0xc7b5('0x37')]=_[_0xc7b5('0x32')](_0x53e917,'name');_0x2bd40f[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x1e5714[_0xc7b5('0x38')]);_0x2bd40f[_0xc7b5('0x3a')]=_['intersection'](_0x2bd40f[_0xc7b5('0x37')],_0x2bd40f['query']);_0x525850['attributes']=_[_0xc7b5('0x3b')](_0x2bd40f[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x1e5714['query'][_0xc7b5('0x3c')]));_0x525850[_0xc7b5('0x3d')]=_0x525850['attributes'][_0xc7b5('0x3e')]?_0x525850[_0xc7b5('0x3d')]:_0x2bd40f[_0xc7b5('0x37')];if(!_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x3f')](_0xc7b5('0x40'))){_0x525850[_0xc7b5('0x24')]=qs['limit'](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x24')]);_0x525850[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x525850[_0xc7b5('0x41')]=qs[_0xc7b5('0x42')](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x525850[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x1e5714[_0xc7b5('0x38')],_0x2bd40f['filters']),_0x53e917);if(_0x1e5714[_0xc7b5('0x38')]['filter']){_0x525850[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x525850[_0xc7b5('0x43')],{'$or':_['map'](_0x53e917,function(_0x577301){if(_0x577301[_0xc7b5('0x35')]!==_0xc7b5('0x46')){var _0x5516f6={};_0x5516f6[_0x577301[_0xc7b5('0x30')]]={'$like':'%'+_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x5516f6;}})});}_0x525850=_['merge']({},_0x525850,_0x1e5714[_0xc7b5('0x48')]);var _0x4ec432={'where':_0x525850[_0xc7b5('0x43')]};return db['CmList']['count'](_0x4ec432)[_0xc7b5('0x2b')](function(_0x3fc202){_0x3411b7[_0xc7b5('0x49')]=_0x3fc202;if(_0x1e5714['query']['includeAll']){_0x525850[_0xc7b5('0x4a')]=[{'all':!![]}];}return db[_0xc7b5('0x4b')][_0xc7b5('0x4c')](_0x525850);})[_0xc7b5('0x2b')](function(_0x4cd319){_0x3411b7[_0xc7b5('0x4d')]=_0x4cd319;return _0x3411b7;})[_0xc7b5('0x2b')](respondWithFilteredResult(_0x51d7e1,_0x525850))[_0xc7b5('0x4e')](handleError(_0x51d7e1,null));};exports['show']=function(_0x43cf6c,_0xd8d7a4){var _0x178536={'raw':![],'where':{'id':_0x43cf6c[_0xc7b5('0x4f')]['id']}},_0x2e3aae={};_0x2e3aae['model']=_[_0xc7b5('0x39')](db[_0xc7b5('0x4b')][_0xc7b5('0x33')]);_0x2e3aae['query']=_[_0xc7b5('0x39')](_0x43cf6c[_0xc7b5('0x38')]);_0x2e3aae[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x2e3aae[_0xc7b5('0x37')],_0x2e3aae[_0xc7b5('0x38')]);_0x178536[_0xc7b5('0x3d')]=_[_0xc7b5('0x3b')](_0x2e3aae[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x43cf6c[_0xc7b5('0x38')][_0xc7b5('0x3c')]));_0x178536['attributes']=_0x178536[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x178536[_0xc7b5('0x3d')]:_0x2e3aae[_0xc7b5('0x37')];if(_0x43cf6c[_0xc7b5('0x38')][_0xc7b5('0x50')]){_0x178536[_0xc7b5('0x4a')]=[{'all':!![]}];}_0x178536=_[_0xc7b5('0x45')]({},_0x178536,_0x43cf6c['options']);return db[_0xc7b5('0x4b')][_0xc7b5('0x51')](_0x178536)[_0xc7b5('0x2b')](handleEntityNotFound(_0xd8d7a4,null))[_0xc7b5('0x2b')](respondWithResult(_0xd8d7a4,null))[_0xc7b5('0x4e')](handleError(_0xd8d7a4,null));};exports[_0xc7b5('0x52')]=function(_0x117dda,_0x3300da){return db[_0xc7b5('0x4b')][_0xc7b5('0x52')](_0x117dda[_0xc7b5('0x53')],{})[_0xc7b5('0x2b')](function(_0x2179f9){var _0xfdfd70=_0x117dda[_0xc7b5('0x54')][_0xc7b5('0x55')]({'plain':!![]});if(!_0xfdfd70)throw new Error(_0xc7b5('0x56'));if(_0xfdfd70['role']===_0xc7b5('0x54')){var _0x4c454=_0x2179f9['get']({'plain':!![]});var _0x2e401e=_0xc7b5('0x2d');return db[_0xc7b5('0x57')][_0xc7b5('0x51')]({'where':{'name':_0x2e401e,'userProfileId':_0xfdfd70['userProfileId']},'raw':!![]})[_0xc7b5('0x2b')](function(_0x1cfe77){if(_0x1cfe77&&_0x1cfe77[_0xc7b5('0x58')]===0x0){return db[_0xc7b5('0x2e')][_0xc7b5('0x52')]({'name':_0x4c454[_0xc7b5('0x30')],'resourceId':_0x4c454['id'],'type':_0x1cfe77[_0xc7b5('0x30')],'sectionId':_0x1cfe77['id']},{})[_0xc7b5('0x2b')](function(){return _0x2179f9;});}else{return _0x2179f9;}})[_0xc7b5('0x4e')](function(_0x4da7af){logger[_0xc7b5('0x59')](_0xc7b5('0x5a'),_0x4da7af);throw _0x4da7af;});}return _0x2179f9;})[_0xc7b5('0x2b')](respondWithResult(_0x3300da,0xc9))[_0xc7b5('0x4e')](handleError(_0x3300da,null));};exports['update']=function(_0x1d0be9,_0x285ce5){if(_0x1d0be9[_0xc7b5('0x53')]['id']){delete _0x1d0be9[_0xc7b5('0x53')]['id'];}return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x1d0be9[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x285ce5,null))[_0xc7b5('0x2b')](saveUpdates(_0x1d0be9[_0xc7b5('0x53')],null))[_0xc7b5('0x2b')](respondWithResult(_0x285ce5,null))[_0xc7b5('0x4e')](handleError(_0x285ce5,null));};exports['destroy']=function(_0x235afa,_0x3eb07e){return db[_0xc7b5('0x4b')]['find']({'where':{'id':_0x235afa[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x3eb07e,null))['then'](removeEntity(_0x3eb07e,null))[_0xc7b5('0x4e')](handleError(_0x3eb07e,null));};exports[_0xc7b5('0x5b')]=function(_0x3d3c0e,_0x2b3f07){return db[_0xc7b5('0x4b')][_0xc7b5('0x5b')]()['then'](respondWithResult(_0x2b3f07,null))[_0xc7b5('0x4e')](handleError(_0x2b3f07,null));};exports[_0xc7b5('0x5c')]=function(_0x28cec,_0x590121,_0x1d7f0e){if(_0x28cec['body']['id']){delete _0x28cec[_0xc7b5('0x53')]['id'];}return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x28cec[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x590121,null))[_0xc7b5('0x2b')](function(_0xc348e2){if(_0xc348e2){_0x28cec[_0xc7b5('0x53')][_0xc7b5('0x5d')]=_0xc348e2['id'];return db['Disposition'][_0xc7b5('0x52')](_0x28cec[_0xc7b5('0x53')]);}})[_0xc7b5('0x2b')](respondWithResult(_0x590121,null))[_0xc7b5('0x4e')](handleError(_0x590121,null));};exports[_0xc7b5('0x5e')]=function(_0x918a60,_0x25efeb,_0x11754f){var _0x5be4cb={'raw':![],'where':{}};var _0x5a4872={};var _0x1b3c9b={'count':0x0,'rows':[]};return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x918a60[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x25efeb,null))[_0xc7b5('0x2b')](function(_0x4ded13){if(_0x4ded13){_0x5a4872[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db['Disposition'][_0xc7b5('0x33')]);_0x5a4872[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x918a60['query']);_0x5a4872[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x5a4872[_0xc7b5('0x37')],_0x5a4872['query']);_0x5be4cb[_0xc7b5('0x3d')]=_['intersection'](_0x5a4872['model'],qs[_0xc7b5('0x3c')](_0x918a60[_0xc7b5('0x38')]['fields']));_0x5be4cb['attributes']=_0x5be4cb[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x5be4cb[_0xc7b5('0x3d')]:_0x5a4872[_0xc7b5('0x37')];if(!_0x918a60[_0xc7b5('0x38')]['hasOwnProperty'](_0xc7b5('0x40'))){_0x5be4cb[_0xc7b5('0x24')]=qs[_0xc7b5('0x24')](_0x918a60[_0xc7b5('0x38')]['limit']);_0x5be4cb[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x5be4cb[_0xc7b5('0x41')]=qs['sort'](_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x5be4cb['where']=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x918a60[_0xc7b5('0x38')],_0x5a4872['filters']));_0x5be4cb[_0xc7b5('0x43')]['ListId']=_0x4ded13['id'];if(_0x918a60[_0xc7b5('0x38')]['filter']){_0x5be4cb['where']=_[_0xc7b5('0x45')](_0x5be4cb[_0xc7b5('0x43')],{'$or':_[_0xc7b5('0x32')](_0x5be4cb['attributes'],function(_0x3fed15){var _0x37be0e={};_0x37be0e[_0x3fed15]={'$like':'%'+_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x37be0e;})});}_0x5be4cb=_[_0xc7b5('0x45')]({},_0x5be4cb,_0x918a60[_0xc7b5('0x48')]);return db[_0xc7b5('0x60')][_0xc7b5('0x49')]({'where':_0x5be4cb['where']})['then'](function(_0x2df419){_0x1b3c9b['count']=_0x2df419;if(_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x50')]){_0x5be4cb['include']=[{'all':!![]}];}return db[_0xc7b5('0x60')]['findAll'](_0x5be4cb);})[_0xc7b5('0x2b')](function(_0x41174e){_0x1b3c9b[_0xc7b5('0x4d')]=_0x41174e;return _0x1b3c9b;});}})['then'](respondWithFilteredResult(_0x25efeb,_0x5be4cb))[_0xc7b5('0x4e')](handleError(_0x25efeb,null));};exports[_0xc7b5('0x61')]=function(_0x183779,_0x5acb43,_0x50a2ab){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x183779[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x5acb43,null))[_0xc7b5('0x2b')](function(_0x34093b){if(_0x34093b){return _0x34093b[_0xc7b5('0x61')](_0x183779[_0xc7b5('0x38')]['ids']);}})[_0xc7b5('0x2b')](respondWithStatusCode(_0x5acb43,null))[_0xc7b5('0x4e')](handleError(_0x5acb43,null));};exports[_0xc7b5('0x62')]=function(_0x2c20d1,_0x51131f,_0x3d1d9a){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x2c20d1[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x51131f,null))['then'](function(_0x567e1d){if(_0x567e1d){var _0x30fa6b=[];var _0x2d4437={'success':[],'errors':[]};return db[_0xc7b5('0x63')][_0xc7b5('0x5b')]()['then'](function(_0x588047){if(_0x2c20d1['body']['tags']&&_[_0xc7b5('0x64')](_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')])){if(_0x2c20d1[_0xc7b5('0x53')]['tags'][_0xc7b5('0x3e')]){_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')]=_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')][_0xc7b5('0x66')](';')+';';}else{_0x2c20d1['body'][_0xc7b5('0x65')]=null;}}else{_0x2c20d1[_0xc7b5('0x53')]['tags']=null;}if(_0x2c20d1[_0xc7b5('0x53')]&&_[_0xc7b5('0x64')](_0x2c20d1[_0xc7b5('0x53')])){for(var _0x59ef0c=0x0;_0x59ef0c<_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x3e')];_0x59ef0c+=0x1){_0x2c20d1[_0xc7b5('0x53')][_0x59ef0c][_0xc7b5('0x5d')]=_0x2c20d1[_0xc7b5('0x4f')]['id'];_0x30fa6b[_0xc7b5('0x67')](_0x2c20d1[_0xc7b5('0x53')][_0x59ef0c]);}return BPromise[_0xc7b5('0x68')](_0x30fa6b,function(_0x906e7f){return db['CmContact']['create'](_[_0xc7b5('0x69')](_0x906e7f,[_0xc7b5('0x6a'),'id'])||{},{'fields':_['keys'](_0x588047),'raw':!![]})[_0xc7b5('0x2b')](function(_0x24546f){_0x2d4437[_0xc7b5('0x6b')][_0xc7b5('0x67')](_0x24546f[_0xc7b5('0x6c')]);})['catch'](function(_0x2f323d){_0x2d4437[_0xc7b5('0x6d')][_0xc7b5('0x67')]({'data':_0x906e7f,'error':_0x2f323d[_0xc7b5('0x6e')]});});})[_0xc7b5('0x2b')](function(_0x5168ed){return _0x2d4437;})[_0xc7b5('0x4e')](function(_0xc6dce){return _0xc6dce;});}else{_0x51131f[_0xc7b5('0x1f')](0x190)[_0xc7b5('0x21')]({'message':_0xc7b5('0x6f')});}});}})[_0xc7b5('0x2b')](respondWithResult(_0x51131f,null))['catch'](handleError(_0x51131f,null));};exports['getContacts']=function(_0x288a13,_0x1f8fc4,_0x196e9a){var _0x5de625;return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x288a13[_0xc7b5('0x4f')]['id']},'include':[{'model':db[_0xc7b5('0x70')],'as':_0xc7b5('0x71')}]})['then'](handleEntityNotFound(_0x1f8fc4,null))['then'](function(_0x319274){if(_0x319274){_0x5de625=_0x319274;return db[_0xc7b5('0x63')][_0xc7b5('0x33')];}})[_0xc7b5('0x2b')](function(_0x392ef9){if(_0x392ef9){var _0x247ddc={};var _0x232c47={};_0x232c47[_0xc7b5('0x37')]=_[_0xc7b5('0x72')](_[_0xc7b5('0x39')](_0x392ef9),_[_0xc7b5('0x32')](_0x5de625[_0xc7b5('0x71')],function(_0x57a92b){return util[_0xc7b5('0x73')]('cf_%d',_0x57a92b['id']);}));_0x232c47[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x288a13[_0xc7b5('0x38')]);_0x232c47[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x232c47['model'],_0x232c47[_0xc7b5('0x38')]);_0x247ddc[_0xc7b5('0x3d')]=_['intersection'](_0x232c47['model'],qs['fields'](_0x288a13['query']['fields']));_0x247ddc[_0xc7b5('0x3d')]=_0x247ddc[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x247ddc[_0xc7b5('0x3d')]:_0x232c47[_0xc7b5('0x37')];if(!_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x3f')]('nolimit')){_0x247ddc['limit']=qs[_0xc7b5('0x24')](_0x288a13['query'][_0xc7b5('0x24')]);_0x247ddc[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x247ddc['order']=qs[_0xc7b5('0x42')](_0x288a13['query'][_0xc7b5('0x42')]);_0x247ddc[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_['pick'](_0x288a13[_0xc7b5('0x38')],_0x232c47[_0xc7b5('0x3a')]));_0x247ddc['raw']=!![];if(_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x247ddc[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x247ddc[_0xc7b5('0x43')],{'$or':_['map'](_0x247ddc[_0xc7b5('0x3d')],function(_0x53c471){var _0x4e2786={};_0x4e2786[_0x53c471]={'$like':'%'+_0x288a13['query'][_0xc7b5('0x47')]+'%'};return _0x4e2786;})});}_0x247ddc=_[_0xc7b5('0x45')]({},_0x247ddc,_0x288a13[_0xc7b5('0x48')]);return _0x5de625['getContacts'](_0x247ddc);}})[_0xc7b5('0x2b')](respondWithResult(_0x1f8fc4,null))['catch'](handleError(_0x1f8fc4,null));};exports[_0xc7b5('0x74')]=function(_0x1d2d74,_0x2aeffe,_0x40d6d7){var _0x19df80;var _0x1b0d61;var _0x3fa865;var _0x30aefc=_0x1d2d74[_0xc7b5('0x4f')]['id'];csv_results=[];return db[_0xc7b5('0x75')][_0xc7b5('0x4c')]({'attributes':['id',_0xc7b5('0x30')],'raw':!![],'order':[_0xc7b5('0x76')]})[_0xc7b5('0x2b')](function(_0x38cc33){_0x19df80=_0x38cc33;var _0x5dc280=_[_0xc7b5('0x39')](db[_0xc7b5('0x63')][_0xc7b5('0x33')]);return db['CmCustomField'][_0xc7b5('0x4c')]({'raw':!![],'attributes':['id',_0xc7b5('0x77')]})[_0xc7b5('0x2b')](function(_0x3d0080){_0x1b0d61=_0x3d0080;var _0x9629f8=squel[_0xc7b5('0x78')]()[_0xc7b5('0x3c')](_0x5dc280)['from'](_0xc7b5('0x79'),'c')['where'](_0xc7b5('0x7a'),_0x30aefc)[_0xc7b5('0x43')]('c.deletedAt\x20is\x20null')[_0xc7b5('0x7b')]();for(var _0x5f5387=0x0;_0x5f5387<_0x1b0d61[_0xc7b5('0x3e')];_0x5f5387++){_0x9629f8[_0xc7b5('0x7c')](_0xc7b5('0x7d')+_0x1b0d61[_0x5f5387]['id'],_0xc7b5('0x7e')+_0x1b0d61[_0x5f5387][_0xc7b5('0x77')]);}for(var _0x5f5387=0x0;_0x5f5387<_0x19df80[_0xc7b5('0x3e')];_0x5f5387++){_0x9629f8['field'](squel[_0xc7b5('0x78')]()['field'](_0xc7b5('0x7f'))[_0xc7b5('0x80')](_0xc7b5('0x81'))[_0xc7b5('0x43')](_0xc7b5('0x82'),_0x19df80[_0x5f5387]['id'])[_0xc7b5('0x43')](_0xc7b5('0x83')),_0xc7b5('0x84')+_0x19df80[_0x5f5387][_0xc7b5('0x30')]);_0x9629f8[_0xc7b5('0x7c')](squel[_0xc7b5('0x78')]()[_0xc7b5('0x7c')](_0xc7b5('0x85'))['from'](_0xc7b5('0x81'))['where'](_0xc7b5('0x82'),_0x19df80[_0x5f5387]['id'])[_0xc7b5('0x43')](_0xc7b5('0x83')),'description_additionalPhone_'+_0x19df80[_0x5f5387][_0xc7b5('0x30')]);}var _0x38ce42=[];_0x38ce42[_0xc7b5('0x67')](_0x9629f8['toString']());BPromise['each'](_0x38ce42,handleQuery)[_0xc7b5('0x2b')](function(_0x2117fa){handleQuery(_0x9629f8['toString']());var _0x40f541=csv_results[0x0];if(!_[_0xc7b5('0x86')](_0x40f541)){var _0xeabbdb=toCsv(_0x40f541);var _0x3fdf18=Date[_0xc7b5('0x87')]();fs[_0xc7b5('0x88')](util[_0xc7b5('0x73')]('/tmp/list_%d_%s.csv',_0x30aefc,_0x3fdf18),_0xeabbdb);_0x2aeffe[_0xc7b5('0x89')](_0xc7b5('0x8a'),_0xc7b5('0x8b')+util[_0xc7b5('0x73')](_0xc7b5('0x8c'),_0x30aefc,_0x3fdf18));_0x2aeffe[_0xc7b5('0x89')]('Content-type',_0xc7b5('0x8d'));return _0x2aeffe['download'](util[_0xc7b5('0x73')](_0xc7b5('0x8e'),_0x30aefc,_0x3fdf18));}else{return _0x2aeffe[_0xc7b5('0x2f')](0xcc);}});});});};exports[_0xc7b5('0x8f')]=function(_0x38d0cc,_0x43d98b,_0x37eb80){var _0x381acc;delete _0x38d0cc[_0xc7b5('0x53')]['id'];return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x38d0cc[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x43d98b,null))[_0xc7b5('0x2b')](function(_0x54050c){if(_0x54050c){return db['sequelize']['transaction'](function(_0x47987d){return db[_0xc7b5('0x70')][_0xc7b5('0x52')](_0x38d0cc[_0xc7b5('0x53')],{'transaction':_0x47987d})['then'](function(_0x2cd357){_0x381acc=_0x2cd357;return _0x54050c[_0xc7b5('0x90')](_0x2cd357,{'transaction':_0x47987d});})[_0xc7b5('0x2b')](function(){var _0x131ea4={'type':db['Sequelize'][_0xc7b5('0x91')],'transaction':_0x47987d};switch(_0x38d0cc[_0xc7b5('0x53')][_0xc7b5('0x35')]){case _0xc7b5('0x92'):_0x131ea4[_0xc7b5('0x35')]=db['Sequelize'][_0xc7b5('0x91')];break;case'number':_0x131ea4['type']=db[_0xc7b5('0x93')][_0xc7b5('0x94')];break;case _0xc7b5('0x95'):_0x131ea4[_0xc7b5('0x35')]=db[_0xc7b5('0x93')][_0xc7b5('0x96')];_0x131ea4[_0xc7b5('0x97')]=![];break;default:}return db[_0xc7b5('0x98')][_0xc7b5('0x99')]['addColumn']('cm_contacts',util[_0xc7b5('0x73')](_0xc7b5('0x9a'),_0x381acc['id']),_0x131ea4);})['then'](function(){return _0x381acc;});});}})[_0xc7b5('0x2b')](respondWithResult(_0x43d98b,null))[_0xc7b5('0x4e')](handleError(_0x43d98b,null));};exports[_0xc7b5('0x9b')]=function(_0x303e54,_0xeb5f57,_0x33912f){var _0x359d35={};var _0x17bfe6={};var _0x485fef;var _0x3d2911;return db[_0xc7b5('0x4b')]['findOne']({'where':{'id':_0x303e54[_0xc7b5('0x4f')]['id']}})['then'](handleEntityNotFound(_0xeb5f57,null))['then'](function(_0x1b9d84){if(_0x1b9d84){_0x485fef=_0x1b9d84;_0x17bfe6[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db[_0xc7b5('0x70')]['rawAttributes']);_0x17bfe6['query']=_[_0xc7b5('0x39')](_0x303e54[_0xc7b5('0x38')]);_0x17bfe6[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x17bfe6[_0xc7b5('0x37')],_0x17bfe6[_0xc7b5('0x38')]);_0x359d35['attributes']=_[_0xc7b5('0x3b')](_0x17bfe6[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x303e54[_0xc7b5('0x38')]['fields']));_0x359d35[_0xc7b5('0x3d')]=_0x359d35['attributes'][_0xc7b5('0x3e')]?_0x359d35[_0xc7b5('0x3d')]:_0x17bfe6['model'];_0x359d35[_0xc7b5('0x41')]=qs['sort'](_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x359d35[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x303e54['query'],_0x17bfe6[_0xc7b5('0x3a')]));_0x359d35[_0xc7b5('0x43')]=_['merge'](_0x359d35[_0xc7b5('0x43')],{'$or':[{'ListId':_0x1b9d84['id']},{'ListId':null}]});if(_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x359d35[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x359d35[_0xc7b5('0x43')],{'$or':_['map'](_0x359d35['attributes'],function(_0x93353a){var _0x2c1421={};_0x2c1421[_0x93353a]={'$like':'%'+_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x2c1421;})});}_0x359d35=_[_0xc7b5('0x45')]({},_0x359d35,_0x303e54[_0xc7b5('0x48')]);return db[_0xc7b5('0x70')][_0xc7b5('0x9c')](_0x359d35);}})['then'](respondWithResult(_0xeb5f57,null))[_0xc7b5('0x4e')](handleError(_0xeb5f57,null));};exports[_0xc7b5('0x9d')]=function(_0x4d5bf1,_0x1412e4){return db[_0xc7b5('0x70')][_0xc7b5('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1412e4,null))[_0xc7b5('0x2b')](function(_0x4ccdc6){return _0x4ccdc6;})[_0xc7b5('0x2b')](respondWithResult(_0x1412e4,null))[_0xc7b5('0x4e')](handleError(_0x1412e4,null));};exports[_0xc7b5('0x9e')]=function(_0x1e6eda,_0x362ce3,_0x17ae67){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x1e6eda['params']['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x362ce3,null))[_0xc7b5('0x2b')](function(_0x1bdaf7){if(_0x1bdaf7){return _0x1bdaf7[_0xc7b5('0x9e')](_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')],_['omit'](_0x1e6eda[_0xc7b5('0x53')],[_0xc7b5('0x6a'),'id'])||{})[_0xc7b5('0x9f')](function(_0x184484){for(var _0x517364=0x0;_0x517364<_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')]['length'];_0x517364+=0x1){socket[_0xc7b5('0xa0')](_0xc7b5('0xa1'),{'UserId':Number(_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')][_0x517364]),'CmListId':Number(_0x1e6eda[_0xc7b5('0x4f')]['id'])});}return _0x184484;});}})[_0xc7b5('0x2b')](respondWithResult(_0x362ce3,null))['catch'](handleError(_0x362ce3,null));};exports['removeAgents']=function(_0x102563,_0x1563a1,_0x78258c){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x102563[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x1563a1,null))['then'](function(_0x4b65b7){if(_0x4b65b7){return _0x4b65b7[_0xc7b5('0xa2')](_0x102563['query'][_0xc7b5('0x6a')])[_0xc7b5('0x2b')](function(){if(_[_0xc7b5('0x64')](_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')])){for(var _0x3b5374=0x0;_0x3b5374<_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')][_0xc7b5('0x3e')];_0x3b5374+=0x1){socket[_0xc7b5('0xa0')](_0xc7b5('0xa3'),{'UserId':Number(_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')][_0x3b5374]),'CmListId':Number(_0x102563[_0xc7b5('0x4f')]['id'])});}}else{socket[_0xc7b5('0xa0')](_0xc7b5('0xa3'),{'UserId':Number(_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')]),'CmListId':Number(_0x102563[_0xc7b5('0x4f')]['id'])});}});}})[_0xc7b5('0x2b')](respondWithStatusCode(_0x1563a1,null))[_0xc7b5('0x4e')](handleError(_0x1563a1,null));};exports['getAgents']=function(_0x5eaf67,_0x461101,_0x1b82aa){var _0x4c0ffc={};var _0x46cf29={};var _0x6c0a10;var _0xa9a938;return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x5eaf67[_0xc7b5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x461101,null))['then'](function(_0x29d379){if(_0x29d379){_0x6c0a10=_0x29d379;_0x46cf29[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db['User'][_0xc7b5('0x33')]);_0x46cf29[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x5eaf67[_0xc7b5('0x38')]);_0x46cf29[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x46cf29['model'],_0x46cf29['query']);_0x4c0ffc[_0xc7b5('0x3d')]=_[_0xc7b5('0x3b')](_0x46cf29['model'],qs[_0xc7b5('0x3c')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x3c')]));_0x4c0ffc['attributes']=_0x4c0ffc[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x4c0ffc[_0xc7b5('0x3d')]:_0x46cf29[_0xc7b5('0x37')];_0x4c0ffc[_0xc7b5('0x41')]=qs['sort'](_0x5eaf67['query'][_0xc7b5('0x42')]);_0x4c0ffc['where']=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x5eaf67[_0xc7b5('0x38')],_0x46cf29['filters']));if(_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x4c0ffc[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x4c0ffc['where'],{'$or':_[_0xc7b5('0x32')](_0x4c0ffc[_0xc7b5('0x3d')],function(_0x404f41){var _0x2dd810={};_0x2dd810[_0x404f41]={'$like':'%'+_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x2dd810;})});}_0x4c0ffc=_[_0xc7b5('0x45')]({},_0x4c0ffc,_0x5eaf67[_0xc7b5('0x48')]);return _0x6c0a10[_0xc7b5('0xa4')](_0x4c0ffc);}})[_0xc7b5('0x2b')](function(_0xe2e125){if(_0xe2e125){_0xa9a938=_0xe2e125[_0xc7b5('0x3e')];if(!_0x5eaf67['query'][_0xc7b5('0x3f')](_0xc7b5('0x40'))){_0x4c0ffc[_0xc7b5('0x24')]=qs[_0xc7b5('0x24')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x24')]);_0x4c0ffc['offset']=qs[_0xc7b5('0x22')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x22')]);}return _0x6c0a10[_0xc7b5('0xa4')](_0x4c0ffc);}})[_0xc7b5('0x2b')](function(_0x595e96){if(_0x595e96){return _0x595e96?{'count':_0xa9a938,'rows':_0x595e96}:null;}})[_0xc7b5('0x2b')](respondWithResult(_0x461101,null))['catch'](handleError(_0x461101,null));};function handleQuery(_0x39758c){logger[_0xc7b5('0xa5')](_0x39758c);return db[_0xc7b5('0x98')][_0xc7b5('0x38')](_0x39758c)[_0xc7b5('0x9f')](function(_0x45e7d2){csv_results['push'](_0x45e7d2);})['catch'](function(_0x2587f1){logger[_0xc7b5('0x59')](_0x2587f1[_0xc7b5('0x6e')]);});} \ No newline at end of file +var _0x20b4=['filter','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','alias','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','sequelize','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','name','send','map','CmList','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x20b4,0xeb));var _0x420b=function(_0x2c065a,_0x44e071){_0x2c065a=_0x2c065a-0x0;var _0x16dcf0=_0x20b4[_0x2c065a];return _0x16dcf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x420b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x420b('0x1'));var rp=require(_0x420b('0x2'));var moment=require(_0x420b('0x3'));var BPromise=require(_0x420b('0x4'));var Mustache=require(_0x420b('0x5'));var util=require('util');var path=require(_0x420b('0x6'));var sox=require(_0x420b('0x7'));var csv=require(_0x420b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x420b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x420b('0xa'));var jsforce=require(_0x420b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x420b('0xc'));var Papa=require(_0x420b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x420b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x420b('0xf'));var logger=require(_0x420b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x420b('0x11'));var licenseUtil=require(_0x420b('0x12'));var db=require(_0x420b('0x13'))['db'];var csv_results;config[_0x420b('0x14')]=_[_0x420b('0x15')](config[_0x420b('0x14')],{'host':_0x420b('0x16'),'port':0x18eb});var socket=require(_0x420b('0x17'))(new Redis(config['redis']));require(_0x420b('0x18'))[_0x420b('0x19')](socket);function respondWithStatusCode(_0x457c45,_0x300870){_0x300870=_0x300870||0xcc;return function(_0x2cd41d){if(_0x2cd41d){return _0x457c45[_0x420b('0x1a')](_0x300870);}return _0x457c45[_0x420b('0x1b')](_0x300870)[_0x420b('0x1c')]();};}function respondWithResult(_0x26cbda,_0x5e70b1){_0x5e70b1=_0x5e70b1||0xc8;return function(_0x341ad4){if(_0x341ad4){return _0x26cbda['status'](_0x5e70b1)[_0x420b('0x1d')](_0x341ad4);}};}function respondWithFilteredResult(_0x59f7e0,_0x5592da){return function(_0x3a7ed0){if(_0x3a7ed0){var _0x54add6=typeof _0x5592da['offset']===_0x420b('0x1e')&&typeof _0x5592da[_0x420b('0x1f')]===_0x420b('0x1e');var _0x356067=_0x3a7ed0[_0x420b('0x20')];var _0x40b930=_0x54add6?0x0:_0x5592da[_0x420b('0x21')];var _0x15de20=_0x54add6?_0x3a7ed0[_0x420b('0x20')]:_0x5592da[_0x420b('0x21')]+_0x5592da['limit'];var _0x1ccc83;if(_0x15de20>=_0x356067){_0x15de20=_0x356067;_0x1ccc83=0xc8;}else{_0x1ccc83=0xce;}_0x59f7e0[_0x420b('0x1b')](_0x1ccc83);return _0x59f7e0[_0x420b('0x22')](_0x420b('0x23'),_0x40b930+'-'+_0x15de20+'/'+_0x356067)[_0x420b('0x1d')](_0x3a7ed0);}return null;};}function patchUpdates(_0x40c0dd){return function(_0x2959d6){try{jsonpatch[_0x420b('0x24')](_0x2959d6,_0x40c0dd,!![]);}catch(_0x11c37c){return BPromise[_0x420b('0x25')](_0x11c37c);}return _0x2959d6[_0x420b('0x26')]();};}function saveUpdates(_0x85cc27,_0x1473cd){return function(_0xaa49b2){if(_0xaa49b2){return _0xaa49b2['update'](_0x85cc27)[_0x420b('0x27')](function(_0x2d8cda){return _0x2d8cda;});}return null;};}function removeEntity(_0x41f6b2,_0x3fb019){return function(_0x4d96f8){if(_0x4d96f8){return _0x4d96f8[_0x420b('0x28')]()[_0x420b('0x27')](function(){var _0x220234=_0x4d96f8[_0x420b('0x29')]({'plain':!![]});var _0x129635=_0x420b('0x2a');return db[_0x420b('0x2b')][_0x420b('0x28')]({'where':{'type':_0x129635,'resourceId':_0x220234['id']}})['then'](function(){return _0x4d96f8;});})[_0x420b('0x27')](function(){_0x41f6b2[_0x420b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa579bc,_0x295429){return function(_0xcb7853){if(!_0xcb7853){_0xa579bc[_0x420b('0x1a')](0x194);}return _0xcb7853;};}function handleError(_0x30b8bf,_0x43992e){_0x43992e=_0x43992e||0x1f4;return function(_0x3bf4c9){logger[_0x420b('0x2c')](_0x3bf4c9['stack']);if(_0x3bf4c9[_0x420b('0x2d')]){delete _0x3bf4c9['name'];}_0x30b8bf[_0x420b('0x1b')](_0x43992e)[_0x420b('0x2e')](_0x3bf4c9);};}exports['index']=function(_0x4bbb1d,_0x37e698){var _0x1b3bce={},_0x52cd05={},_0x4c06e0={'count':0x0,'rows':[]};var _0x25a5ab=_[_0x420b('0x2f')](db[_0x420b('0x30')]['rawAttributes'],function(_0x182c1a){return{'name':_0x182c1a[_0x420b('0x31')],'type':_0x182c1a['type']['key']};});_0x52cd05[_0x420b('0x32')]=_[_0x420b('0x2f')](_0x25a5ab,_0x420b('0x2d'));_0x52cd05['query']=_[_0x420b('0x33')](_0x4bbb1d[_0x420b('0x34')]);_0x52cd05[_0x420b('0x35')]=_[_0x420b('0x36')](_0x52cd05[_0x420b('0x32')],_0x52cd05['query']);_0x1b3bce[_0x420b('0x37')]=_[_0x420b('0x36')](_0x52cd05[_0x420b('0x32')],qs[_0x420b('0x38')](_0x4bbb1d[_0x420b('0x34')][_0x420b('0x38')]));_0x1b3bce[_0x420b('0x37')]=_0x1b3bce[_0x420b('0x37')][_0x420b('0x39')]?_0x1b3bce[_0x420b('0x37')]:_0x52cd05[_0x420b('0x32')];if(!_0x4bbb1d[_0x420b('0x34')]['hasOwnProperty']('nolimit')){_0x1b3bce['limit']=qs[_0x420b('0x1f')](_0x4bbb1d[_0x420b('0x34')]['limit']);_0x1b3bce[_0x420b('0x21')]=qs[_0x420b('0x21')](_0x4bbb1d[_0x420b('0x34')][_0x420b('0x21')]);}_0x1b3bce[_0x420b('0x3a')]=qs['sort'](_0x4bbb1d[_0x420b('0x34')][_0x420b('0x3b')]);_0x1b3bce[_0x420b('0x3c')]=qs[_0x420b('0x35')](_[_0x420b('0x3d')](_0x4bbb1d[_0x420b('0x34')],_0x52cd05[_0x420b('0x35')]),_0x25a5ab);if(_0x4bbb1d[_0x420b('0x34')]['filter']){_0x1b3bce[_0x420b('0x3c')]=_[_0x420b('0x3e')](_0x1b3bce[_0x420b('0x3c')],{'$or':_[_0x420b('0x2f')](_0x25a5ab,function(_0x201518){if(_0x201518[_0x420b('0x3f')]!=='VIRTUAL'){var _0x6c7036={};_0x6c7036[_0x201518['name']]={'$like':'%'+_0x4bbb1d[_0x420b('0x34')]['filter']+'%'};return _0x6c7036;}})});}_0x1b3bce=_[_0x420b('0x3e')]({},_0x1b3bce,_0x4bbb1d[_0x420b('0x40')]);var _0x395824={'where':_0x1b3bce['where']};return db[_0x420b('0x30')][_0x420b('0x20')](_0x395824)[_0x420b('0x27')](function(_0xc4cab7){_0x4c06e0[_0x420b('0x20')]=_0xc4cab7;if(_0x4bbb1d[_0x420b('0x34')][_0x420b('0x41')]){_0x1b3bce[_0x420b('0x42')]=[{'all':!![]}];}return db[_0x420b('0x30')][_0x420b('0x43')](_0x1b3bce);})[_0x420b('0x27')](function(_0x42fa39){_0x4c06e0[_0x420b('0x44')]=_0x42fa39;return _0x4c06e0;})[_0x420b('0x27')](respondWithFilteredResult(_0x37e698,_0x1b3bce))[_0x420b('0x45')](handleError(_0x37e698,null));};exports[_0x420b('0x46')]=function(_0x18e546,_0xe0c952){var _0x446239={'raw':![],'where':{'id':_0x18e546[_0x420b('0x47')]['id']}},_0xbff1d5={};_0xbff1d5[_0x420b('0x32')]=_[_0x420b('0x33')](db[_0x420b('0x30')][_0x420b('0x48')]);_0xbff1d5['query']=_[_0x420b('0x33')](_0x18e546[_0x420b('0x34')]);_0xbff1d5['filters']=_[_0x420b('0x36')](_0xbff1d5[_0x420b('0x32')],_0xbff1d5['query']);_0x446239['attributes']=_[_0x420b('0x36')](_0xbff1d5[_0x420b('0x32')],qs[_0x420b('0x38')](_0x18e546[_0x420b('0x34')]['fields']));_0x446239[_0x420b('0x37')]=_0x446239['attributes'][_0x420b('0x39')]?_0x446239[_0x420b('0x37')]:_0xbff1d5['model'];if(_0x18e546['query']['includeAll']){_0x446239['include']=[{'all':!![]}];}_0x446239=_[_0x420b('0x3e')]({},_0x446239,_0x18e546[_0x420b('0x40')]);return db[_0x420b('0x30')][_0x420b('0x49')](_0x446239)[_0x420b('0x27')](handleEntityNotFound(_0xe0c952,null))[_0x420b('0x27')](respondWithResult(_0xe0c952,null))[_0x420b('0x45')](handleError(_0xe0c952,null));};exports[_0x420b('0x4a')]=function(_0xe59d62,_0x47262e){return db[_0x420b('0x30')][_0x420b('0x4a')](_0xe59d62[_0x420b('0x4b')],{})[_0x420b('0x27')](function(_0x53fc9a){var _0x35586f=_0xe59d62[_0x420b('0x4c')][_0x420b('0x29')]({'plain':!![]});if(!_0x35586f)throw new Error(_0x420b('0x4d'));if(_0x35586f[_0x420b('0x4e')]===_0x420b('0x4c')){var _0x38c4c5=_0x53fc9a[_0x420b('0x29')]({'plain':!![]});var _0x411c49='Lists';return db[_0x420b('0x4f')][_0x420b('0x49')]({'where':{'name':_0x411c49,'userProfileId':_0x35586f[_0x420b('0x50')]},'raw':!![]})[_0x420b('0x27')](function(_0x148895){if(_0x148895&&_0x148895['autoAssociation']===0x0){return db['UserProfileResource'][_0x420b('0x4a')]({'name':_0x38c4c5[_0x420b('0x2d')],'resourceId':_0x38c4c5['id'],'type':_0x148895[_0x420b('0x2d')],'sectionId':_0x148895['id']},{})['then'](function(){return _0x53fc9a;});}else{return _0x53fc9a;}})['catch'](function(_0x27d16e){logger[_0x420b('0x2c')](_0x420b('0x51'),_0x27d16e);throw _0x27d16e;});}return _0x53fc9a;})['then'](respondWithResult(_0x47262e,0xc9))[_0x420b('0x45')](handleError(_0x47262e,null));};exports[_0x420b('0x52')]=function(_0x3bcaee,_0x26dac9){if(_0x3bcaee[_0x420b('0x4b')]['id']){delete _0x3bcaee[_0x420b('0x4b')]['id'];}return db[_0x420b('0x30')][_0x420b('0x49')]({'where':{'id':_0x3bcaee[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x26dac9,null))[_0x420b('0x27')](saveUpdates(_0x3bcaee[_0x420b('0x4b')],null))[_0x420b('0x27')](respondWithResult(_0x26dac9,null))[_0x420b('0x45')](handleError(_0x26dac9,null));};exports['destroy']=function(_0x2d926c,_0x4c91a5){return db['CmList'][_0x420b('0x49')]({'where':{'id':_0x2d926c[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x4c91a5,null))['then'](removeEntity(_0x4c91a5,null))['catch'](handleError(_0x4c91a5,null));};exports[_0x420b('0x53')]=function(_0xb24308,_0x4ba63b){return db[_0x420b('0x30')][_0x420b('0x53')]()['then'](respondWithResult(_0x4ba63b,null))[_0x420b('0x45')](handleError(_0x4ba63b,null));};exports[_0x420b('0x54')]=function(_0x478df9,_0x1dda49,_0xd7489c){if(_0x478df9[_0x420b('0x4b')]['id']){delete _0x478df9[_0x420b('0x4b')]['id'];}return db['CmList'][_0x420b('0x49')]({'where':{'id':_0x478df9[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x1dda49,null))[_0x420b('0x27')](function(_0x329c81){if(_0x329c81){_0x478df9['body'][_0x420b('0x55')]=_0x329c81['id'];return db['Disposition']['create'](_0x478df9['body']);}})[_0x420b('0x27')](respondWithResult(_0x1dda49,null))['catch'](handleError(_0x1dda49,null));};exports[_0x420b('0x56')]=function(_0x4fea9b,_0x421f61,_0x50745e){var _0x222456={'raw':![],'where':{}};var _0x22095c={};var _0xfcd36={'count':0x0,'rows':[]};return db[_0x420b('0x30')][_0x420b('0x57')]({'where':{'id':_0x4fea9b[_0x420b('0x47')]['id']}})['then'](handleEntityNotFound(_0x421f61,null))[_0x420b('0x27')](function(_0x1fbaab){if(_0x1fbaab){_0x22095c[_0x420b('0x32')]=_[_0x420b('0x33')](db[_0x420b('0x58')][_0x420b('0x48')]);_0x22095c['query']=_['keys'](_0x4fea9b[_0x420b('0x34')]);_0x22095c['filters']=_[_0x420b('0x36')](_0x22095c[_0x420b('0x32')],_0x22095c[_0x420b('0x34')]);_0x222456[_0x420b('0x37')]=_['intersection'](_0x22095c['model'],qs[_0x420b('0x38')](_0x4fea9b[_0x420b('0x34')]['fields']));_0x222456[_0x420b('0x37')]=_0x222456[_0x420b('0x37')][_0x420b('0x39')]?_0x222456[_0x420b('0x37')]:_0x22095c[_0x420b('0x32')];if(!_0x4fea9b[_0x420b('0x34')][_0x420b('0x59')](_0x420b('0x5a'))){_0x222456['limit']=qs[_0x420b('0x1f')](_0x4fea9b[_0x420b('0x34')][_0x420b('0x1f')]);_0x222456[_0x420b('0x21')]=qs['offset'](_0x4fea9b[_0x420b('0x34')]['offset']);}_0x222456[_0x420b('0x3a')]=qs[_0x420b('0x3b')](_0x4fea9b[_0x420b('0x34')][_0x420b('0x3b')]);_0x222456[_0x420b('0x3c')]=qs[_0x420b('0x35')](_['pick'](_0x4fea9b[_0x420b('0x34')],_0x22095c[_0x420b('0x35')]));_0x222456['where'][_0x420b('0x55')]=_0x1fbaab['id'];if(_0x4fea9b['query'][_0x420b('0x5b')]){_0x222456[_0x420b('0x3c')]=_['merge'](_0x222456[_0x420b('0x3c')],{'$or':_['map'](_0x222456['attributes'],function(_0xe4767e){var _0x3325be={};_0x3325be[_0xe4767e]={'$like':'%'+_0x4fea9b['query']['filter']+'%'};return _0x3325be;})});}_0x222456=_[_0x420b('0x3e')]({},_0x222456,_0x4fea9b[_0x420b('0x40')]);return db[_0x420b('0x58')][_0x420b('0x20')]({'where':_0x222456[_0x420b('0x3c')]})[_0x420b('0x27')](function(_0x88f52e){_0xfcd36[_0x420b('0x20')]=_0x88f52e;if(_0x4fea9b['query'][_0x420b('0x41')]){_0x222456[_0x420b('0x42')]=[{'all':!![]}];}return db[_0x420b('0x58')][_0x420b('0x43')](_0x222456);})[_0x420b('0x27')](function(_0x15db17){_0xfcd36[_0x420b('0x44')]=_0x15db17;return _0xfcd36;});}})['then'](respondWithFilteredResult(_0x421f61,_0x222456))[_0x420b('0x45')](handleError(_0x421f61,null));};exports['removeDispositions']=function(_0x421b18,_0x4a5e7c,_0x20a7ca){return db[_0x420b('0x30')][_0x420b('0x49')]({'where':{'id':_0x421b18['params']['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x4a5e7c,null))[_0x420b('0x27')](function(_0x2f7bdd){if(_0x2f7bdd){return _0x2f7bdd[_0x420b('0x5c')](_0x421b18[_0x420b('0x34')][_0x420b('0x5d')]);}})[_0x420b('0x27')](respondWithStatusCode(_0x4a5e7c,null))[_0x420b('0x45')](handleError(_0x4a5e7c,null));};exports[_0x420b('0x5e')]=function(_0x5eded6,_0x88230a,_0x590b73){return db[_0x420b('0x30')][_0x420b('0x49')]({'where':{'id':_0x5eded6[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x88230a,null))[_0x420b('0x27')](function(_0x40db09){if(_0x40db09){var _0x19573d=[];var _0x561fd0={'success':[],'errors':[]};return db[_0x420b('0x5f')]['describe']()['then'](function(_0x5ef537){if(_0x5eded6[_0x420b('0x4b')][_0x420b('0x60')]&&_[_0x420b('0x61')](_0x5eded6['body'][_0x420b('0x60')])){if(_0x5eded6[_0x420b('0x4b')][_0x420b('0x60')]['length']){_0x5eded6[_0x420b('0x4b')][_0x420b('0x60')]=_0x5eded6[_0x420b('0x4b')][_0x420b('0x60')][_0x420b('0x62')](';')+';';}else{_0x5eded6['body'][_0x420b('0x60')]=null;}}else{_0x5eded6[_0x420b('0x4b')][_0x420b('0x60')]=null;}if(_0x5eded6[_0x420b('0x4b')]&&_[_0x420b('0x61')](_0x5eded6['body'])){for(var _0xd3ded0=0x0;_0xd3ded0<_0x5eded6['body'][_0x420b('0x39')];_0xd3ded0+=0x1){_0x5eded6[_0x420b('0x4b')][_0xd3ded0][_0x420b('0x55')]=_0x5eded6[_0x420b('0x47')]['id'];_0x19573d[_0x420b('0x63')](_0x5eded6['body'][_0xd3ded0]);}return BPromise[_0x420b('0x64')](_0x19573d,function(_0x15a982){return db[_0x420b('0x5f')][_0x420b('0x4a')](_['omit'](_0x15a982,[_0x420b('0x5d'),'id'])||{},{'fields':_['keys'](_0x5ef537),'raw':!![]})['then'](function(_0x1b40c0){_0x561fd0['success'][_0x420b('0x63')](_0x1b40c0[_0x420b('0x65')]);})[_0x420b('0x45')](function(_0x131fbc){_0x561fd0[_0x420b('0x66')]['push']({'data':_0x15a982,'error':_0x131fbc[_0x420b('0x67')]});});})['then'](function(_0x40cb2d){return _0x561fd0;})[_0x420b('0x45')](function(_0x394c6b){return _0x394c6b;});}else{_0x88230a[_0x420b('0x1b')](0x190)[_0x420b('0x1d')]({'message':_0x420b('0x68')});}});}})['then'](respondWithResult(_0x88230a,null))[_0x420b('0x45')](handleError(_0x88230a,null));};exports[_0x420b('0x69')]=function(_0x11ff98,_0x4f8a59,_0x188d85){var _0x25e0a0;return db[_0x420b('0x30')][_0x420b('0x49')]({'where':{'id':_0x11ff98[_0x420b('0x47')]['id']},'include':[{'model':db[_0x420b('0x6a')],'as':_0x420b('0x6b')}]})[_0x420b('0x27')](handleEntityNotFound(_0x4f8a59,null))[_0x420b('0x27')](function(_0x2bf4a0){if(_0x2bf4a0){_0x25e0a0=_0x2bf4a0;return db[_0x420b('0x5f')]['rawAttributes'];}})[_0x420b('0x27')](function(_0x4c0f96){if(_0x4c0f96){var _0x18f56c={};var _0x316bd5={};_0x316bd5['model']=_['concat'](_[_0x420b('0x33')](_0x4c0f96),_[_0x420b('0x2f')](_0x25e0a0[_0x420b('0x6b')],function(_0x25f296){return util[_0x420b('0x6c')](_0x420b('0x6d'),_0x25f296['id']);}));_0x316bd5[_0x420b('0x34')]=_['keys'](_0x11ff98['query']);_0x316bd5['filters']=_[_0x420b('0x36')](_0x316bd5[_0x420b('0x32')],_0x316bd5[_0x420b('0x34')]);_0x18f56c[_0x420b('0x37')]=_[_0x420b('0x36')](_0x316bd5[_0x420b('0x32')],qs['fields'](_0x11ff98['query'][_0x420b('0x38')]));_0x18f56c['attributes']=_0x18f56c['attributes'][_0x420b('0x39')]?_0x18f56c[_0x420b('0x37')]:_0x316bd5['model'];if(!_0x11ff98[_0x420b('0x34')][_0x420b('0x59')](_0x420b('0x5a'))){_0x18f56c[_0x420b('0x1f')]=qs['limit'](_0x11ff98['query'][_0x420b('0x1f')]);_0x18f56c['offset']=qs[_0x420b('0x21')](_0x11ff98[_0x420b('0x34')]['offset']);}_0x18f56c[_0x420b('0x3a')]=qs[_0x420b('0x3b')](_0x11ff98[_0x420b('0x34')][_0x420b('0x3b')]);_0x18f56c[_0x420b('0x3c')]=qs[_0x420b('0x35')](_[_0x420b('0x3d')](_0x11ff98[_0x420b('0x34')],_0x316bd5[_0x420b('0x35')]));_0x18f56c[_0x420b('0x6e')]=!![];if(_0x11ff98['query'][_0x420b('0x5b')]){_0x18f56c['where']=_[_0x420b('0x3e')](_0x18f56c[_0x420b('0x3c')],{'$or':_['map'](_0x18f56c['attributes'],function(_0x3395a3){var _0x3a4397={};_0x3a4397[_0x3395a3]={'$like':'%'+_0x11ff98[_0x420b('0x34')][_0x420b('0x5b')]+'%'};return _0x3a4397;})});}_0x18f56c=_[_0x420b('0x3e')]({},_0x18f56c,_0x11ff98['options']);return _0x25e0a0[_0x420b('0x69')](_0x18f56c);}})['then'](respondWithResult(_0x4f8a59,null))['catch'](handleError(_0x4f8a59,null));};exports[_0x420b('0x6f')]=function(_0x1edac1,_0x5dfdc9,_0x56b149){var _0x21a16a;var _0x4f4c9f;var _0x52cb3e;var _0x213f2d=_0x1edac1['params']['id'];csv_results=[];return db[_0x420b('0x70')][_0x420b('0x43')]({'attributes':['id',_0x420b('0x2d')],'raw':!![],'order':[_0x420b('0x71')]})[_0x420b('0x27')](function(_0x4af51b){_0x21a16a=_0x4af51b;var _0xebbba6=_[_0x420b('0x33')](db[_0x420b('0x5f')]['rawAttributes']);return db[_0x420b('0x6a')][_0x420b('0x43')]({'raw':!![],'attributes':['id','alias']})[_0x420b('0x27')](function(_0x51a941){_0x4f4c9f=_0x51a941;var _0x30b634=squel[_0x420b('0x72')]()[_0x420b('0x38')](_0xebbba6)['from'](_0x420b('0x73'),'c')[_0x420b('0x3c')](_0x420b('0x74'),_0x213f2d)['where'](_0x420b('0x75'))[_0x420b('0x76')]();for(var _0x43bca5=0x0;_0x43bca5<_0x4f4c9f[_0x420b('0x39')];_0x43bca5++){_0x30b634[_0x420b('0x77')]('c.cf_'+_0x4f4c9f[_0x43bca5]['id'],'customField_'+_0x4f4c9f[_0x43bca5][_0x420b('0x78')]);}for(var _0x43bca5=0x0;_0x43bca5<_0x21a16a[_0x420b('0x39')];_0x43bca5++){_0x30b634[_0x420b('0x77')](squel['select']()[_0x420b('0x77')](_0x420b('0x79'))[_0x420b('0x7a')](_0x420b('0x7b'))[_0x420b('0x3c')](_0x420b('0x7c'),_0x21a16a[_0x43bca5]['id'])[_0x420b('0x3c')]('CmContactId\x20=\x20c.id'),_0x420b('0x7d')+_0x21a16a[_0x43bca5][_0x420b('0x2d')]);_0x30b634['field'](squel['select']()[_0x420b('0x77')](_0x420b('0x7e'))[_0x420b('0x7a')](_0x420b('0x7b'))[_0x420b('0x3c')]('ItemTypeId\x20=\x20?',_0x21a16a[_0x43bca5]['id'])[_0x420b('0x3c')](_0x420b('0x7f')),'description_additionalPhone_'+_0x21a16a[_0x43bca5][_0x420b('0x2d')]);}var _0x1a4598=[];_0x1a4598[_0x420b('0x63')](_0x30b634[_0x420b('0x80')]());BPromise[_0x420b('0x64')](_0x1a4598,handleQuery)['then'](function(_0x15b480){handleQuery(_0x30b634[_0x420b('0x80')]());var _0x5c3f15=csv_results[0x0];if(!_['isEmpty'](_0x5c3f15)){var _0x2a614d=toCsv(_0x5c3f15);var _0x381a5d=Date[_0x420b('0x81')]();fs[_0x420b('0x82')](util[_0x420b('0x6c')](_0x420b('0x83'),_0x213f2d,_0x381a5d),_0x2a614d);_0x5dfdc9[_0x420b('0x84')](_0x420b('0x85'),_0x420b('0x86')+util[_0x420b('0x6c')]('list_%d_%s.csv',_0x213f2d,_0x381a5d));_0x5dfdc9[_0x420b('0x84')](_0x420b('0x87'),_0x420b('0x88'));return _0x5dfdc9[_0x420b('0x89')](util[_0x420b('0x6c')](_0x420b('0x83'),_0x213f2d,_0x381a5d));}else{return _0x5dfdc9['sendStatus'](0xcc);}});});});};exports[_0x420b('0x8a')]=function(_0x38d657,_0x4e793c,_0x581140){var _0x2fc5ba;delete _0x38d657[_0x420b('0x4b')]['id'];return db[_0x420b('0x30')]['findOne']({'where':{'id':_0x38d657['params']['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x4e793c,null))[_0x420b('0x27')](function(_0x22415b){if(_0x22415b){return db['sequelize']['transaction'](function(_0x56c513){return db['CmCustomField'][_0x420b('0x4a')](_0x38d657['body'],{'transaction':_0x56c513})[_0x420b('0x27')](function(_0x1ff4a9){_0x2fc5ba=_0x1ff4a9;return _0x22415b[_0x420b('0x8b')](_0x1ff4a9,{'transaction':_0x56c513});})[_0x420b('0x27')](function(){var _0xc514e1={'type':db[_0x420b('0x8c')][_0x420b('0x8d')],'transaction':_0x56c513};switch(_0x38d657[_0x420b('0x4b')][_0x420b('0x3f')]){case _0x420b('0x8e'):_0xc514e1[_0x420b('0x3f')]=db['Sequelize']['TEXT'];break;case _0x420b('0x8f'):_0xc514e1['type']=db[_0x420b('0x8c')][_0x420b('0x90')];break;case _0x420b('0x91'):_0xc514e1[_0x420b('0x3f')]=db[_0x420b('0x8c')][_0x420b('0x92')];_0xc514e1[_0x420b('0x93')]=![];break;default:}return db['sequelize'][_0x420b('0x94')]['addColumn'](_0x420b('0x73'),util[_0x420b('0x6c')](_0x420b('0x95'),_0x2fc5ba['id']),_0xc514e1);})[_0x420b('0x27')](function(){return _0x2fc5ba;});});}})[_0x420b('0x27')](respondWithResult(_0x4e793c,null))['catch'](handleError(_0x4e793c,null));};exports['getCustomFields']=function(_0x2175be,_0x387f24,_0x407ffa){var _0x5dee72={};var _0x283418={};var _0x2ab30d;var _0x23751b;return db[_0x420b('0x30')][_0x420b('0x57')]({'where':{'id':_0x2175be[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x387f24,null))[_0x420b('0x27')](function(_0x478ab2){if(_0x478ab2){_0x2ab30d=_0x478ab2;_0x283418['model']=_[_0x420b('0x33')](db[_0x420b('0x6a')][_0x420b('0x48')]);_0x283418[_0x420b('0x34')]=_[_0x420b('0x33')](_0x2175be[_0x420b('0x34')]);_0x283418[_0x420b('0x35')]=_[_0x420b('0x36')](_0x283418[_0x420b('0x32')],_0x283418[_0x420b('0x34')]);_0x5dee72[_0x420b('0x37')]=_[_0x420b('0x36')](_0x283418[_0x420b('0x32')],qs[_0x420b('0x38')](_0x2175be[_0x420b('0x34')][_0x420b('0x38')]));_0x5dee72[_0x420b('0x37')]=_0x5dee72[_0x420b('0x37')][_0x420b('0x39')]?_0x5dee72[_0x420b('0x37')]:_0x283418[_0x420b('0x32')];_0x5dee72[_0x420b('0x3a')]=qs[_0x420b('0x3b')](_0x2175be[_0x420b('0x34')][_0x420b('0x3b')]);_0x5dee72[_0x420b('0x3c')]=qs[_0x420b('0x35')](_['pick'](_0x2175be[_0x420b('0x34')],_0x283418[_0x420b('0x35')]));_0x5dee72['where']=_[_0x420b('0x3e')](_0x5dee72[_0x420b('0x3c')],{'$or':[{'ListId':_0x478ab2['id']},{'ListId':null}]});if(_0x2175be[_0x420b('0x34')][_0x420b('0x5b')]){_0x5dee72[_0x420b('0x3c')]=_['merge'](_0x5dee72[_0x420b('0x3c')],{'$or':_[_0x420b('0x2f')](_0x5dee72[_0x420b('0x37')],function(_0x2940d8){var _0x28dab3={};_0x28dab3[_0x2940d8]={'$like':'%'+_0x2175be[_0x420b('0x34')][_0x420b('0x5b')]+'%'};return _0x28dab3;})});}_0x5dee72=_[_0x420b('0x3e')]({},_0x5dee72,_0x2175be['options']);return db[_0x420b('0x6a')][_0x420b('0x96')](_0x5dee72);}})[_0x420b('0x27')](respondWithResult(_0x387f24,null))[_0x420b('0x45')](handleError(_0x387f24,null));};exports[_0x420b('0x97')]=function(_0x2bdab0,_0x287173){return db[_0x420b('0x6a')]['findAndCountAll']({'where':{'ListId':null}})[_0x420b('0x27')](handleEntityNotFound(_0x287173,null))[_0x420b('0x27')](function(_0x1d9add){return _0x1d9add;})[_0x420b('0x27')](respondWithResult(_0x287173,null))[_0x420b('0x45')](handleError(_0x287173,null));};exports[_0x420b('0x98')]=function(_0x5e8188,_0x3adea5,_0x55bac0){return db[_0x420b('0x30')][_0x420b('0x49')]({'where':{'id':_0x5e8188['params']['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x3adea5,null))['then'](function(_0xc97f64){if(_0xc97f64){return _0xc97f64['addAgents'](_0x5e8188[_0x420b('0x4b')][_0x420b('0x5d')],_[_0x420b('0x99')](_0x5e8188[_0x420b('0x4b')],[_0x420b('0x5d'),'id'])||{})[_0x420b('0x9a')](function(_0x5a42cf){for(var _0x432091=0x0;_0x432091<_0x5e8188[_0x420b('0x4b')]['ids']['length'];_0x432091+=0x1){socket[_0x420b('0x9b')](_0x420b('0x9c'),{'UserId':Number(_0x5e8188[_0x420b('0x4b')]['ids'][_0x432091]),'CmListId':Number(_0x5e8188[_0x420b('0x47')]['id'])});}return _0x5a42cf;});}})[_0x420b('0x27')](respondWithResult(_0x3adea5,null))[_0x420b('0x45')](handleError(_0x3adea5,null));};exports[_0x420b('0x9d')]=function(_0x33959f,_0x5ba93b,_0x3249e3){return db[_0x420b('0x30')]['find']({'where':{'id':_0x33959f[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x5ba93b,null))[_0x420b('0x27')](function(_0x400b01){if(_0x400b01){return _0x400b01[_0x420b('0x9d')](_0x33959f[_0x420b('0x34')][_0x420b('0x5d')])[_0x420b('0x27')](function(){if(_[_0x420b('0x61')](_0x33959f[_0x420b('0x34')][_0x420b('0x5d')])){for(var _0x395317=0x0;_0x395317<_0x33959f[_0x420b('0x34')][_0x420b('0x5d')][_0x420b('0x39')];_0x395317+=0x1){socket[_0x420b('0x9b')](_0x420b('0x9e'),{'UserId':Number(_0x33959f[_0x420b('0x34')]['ids'][_0x395317]),'CmListId':Number(_0x33959f[_0x420b('0x47')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x33959f['query'][_0x420b('0x5d')]),'CmListId':Number(_0x33959f[_0x420b('0x47')]['id'])});}});}})[_0x420b('0x27')](respondWithStatusCode(_0x5ba93b,null))[_0x420b('0x45')](handleError(_0x5ba93b,null));};exports[_0x420b('0x9f')]=function(_0x248e11,_0x542e7a,_0x194a7f){var _0x222158={};var _0x177a44={};var _0x43879e;var _0x291962;return db['CmList'][_0x420b('0x57')]({'where':{'id':_0x248e11[_0x420b('0x47')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x542e7a,null))[_0x420b('0x27')](function(_0x1d1bc7){if(_0x1d1bc7){_0x43879e=_0x1d1bc7;_0x177a44[_0x420b('0x32')]=_[_0x420b('0x33')](db[_0x420b('0xa0')][_0x420b('0x48')]);_0x177a44[_0x420b('0x34')]=_[_0x420b('0x33')](_0x248e11[_0x420b('0x34')]);_0x177a44[_0x420b('0x35')]=_[_0x420b('0x36')](_0x177a44['model'],_0x177a44[_0x420b('0x34')]);_0x222158['attributes']=_[_0x420b('0x36')](_0x177a44[_0x420b('0x32')],qs[_0x420b('0x38')](_0x248e11[_0x420b('0x34')]['fields']));_0x222158[_0x420b('0x37')]=_0x222158['attributes']['length']?_0x222158[_0x420b('0x37')]:_0x177a44[_0x420b('0x32')];_0x222158['order']=qs['sort'](_0x248e11[_0x420b('0x34')]['sort']);_0x222158[_0x420b('0x3c')]=qs['filters'](_[_0x420b('0x3d')](_0x248e11[_0x420b('0x34')],_0x177a44[_0x420b('0x35')]));if(_0x248e11[_0x420b('0x34')][_0x420b('0x5b')]){_0x222158[_0x420b('0x3c')]=_[_0x420b('0x3e')](_0x222158[_0x420b('0x3c')],{'$or':_[_0x420b('0x2f')](_0x222158[_0x420b('0x37')],function(_0x150f8b){var _0x28d8d6={};_0x28d8d6[_0x150f8b]={'$like':'%'+_0x248e11[_0x420b('0x34')][_0x420b('0x5b')]+'%'};return _0x28d8d6;})});}_0x222158=_[_0x420b('0x3e')]({},_0x222158,_0x248e11['options']);return _0x43879e[_0x420b('0x9f')](_0x222158);}})['then'](function(_0x462a6e){if(_0x462a6e){_0x291962=_0x462a6e[_0x420b('0x39')];if(!_0x248e11[_0x420b('0x34')][_0x420b('0x59')](_0x420b('0x5a'))){_0x222158[_0x420b('0x1f')]=qs['limit'](_0x248e11[_0x420b('0x34')][_0x420b('0x1f')]);_0x222158[_0x420b('0x21')]=qs[_0x420b('0x21')](_0x248e11['query']['offset']);}return _0x43879e[_0x420b('0x9f')](_0x222158);}})[_0x420b('0x27')](function(_0x38de37){if(_0x38de37){return _0x38de37?{'count':_0x291962,'rows':_0x38de37}:null;}})[_0x420b('0x27')](respondWithResult(_0x542e7a,null))[_0x420b('0x45')](handleError(_0x542e7a,null));};function handleQuery(_0x34367e){logger[_0x420b('0xa1')](_0x34367e);return db[_0x420b('0xa2')]['query'](_0x34367e)['spread'](function(_0x1e93b7){csv_results[_0x420b('0x63')](_0x1e93b7);})['catch'](function(_0x4fc560){logger[_0x420b('0x2c')](_0x4fc560[_0x420b('0x67')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 269102f..cc68f66 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x35af53,_0x5966b1){var _0x6bbbce=function(_0x3a79c0){while(--_0x3a79c0){_0x35af53['push'](_0x35af53['shift']());}};_0x6bbbce(++_0x5966b1);}(_0x814b,0x1a2));var _0xb814=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x814b[_0x546aaf];return _0x1cbf6d;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x74d12d,_0x1970a1){var _0x325250=function(_0x126e57){while(--_0x126e57){_0x74d12d['push'](_0x74d12d['shift']());}};_0x325250(++_0x1970a1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6bd3a94..ba25275 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 _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x9d3994,_0x29640e){var _0x11a55e=function(_0x2dd184){while(--_0x2dd184){_0x9d3994['push'](_0x9d3994['shift']());}};_0x11a55e(++_0x29640e);}(_0x5ff3,0x17d));var _0x35ff=function(_0xa9f5ff,_0x3f8807){_0xa9f5ff=_0xa9f5ff-0x0;var _0x2998a2=_0x5ff3[_0xa9f5ff];return _0x2998a2;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x545d24,_0x2525f5){var _0x4626d0=function(_0x2bd92b){while(--_0x2bd92b){_0x545d24['push'](_0x545d24['shift']());}};_0x4626d0(++_0x2525f5);}(_0x22fb,0x192));var _0xb22f=function(_0x51cf1e,_0x42c486){_0x51cf1e=_0x51cf1e-0x0;var _0x96ea90=_0x22fb[_0x51cf1e];return _0x96ea90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4f84cb2..a36c49d 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 _0xe35d=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2865fd,_0x3fce5e){var _0x2e6712=function(_0x239a35){while(--_0x239a35){_0x2865fd['push'](_0x2865fd['shift']());}};_0x2e6712(++_0x3fce5e);}(_0xe35d,0x105));var _0xde35=function(_0x51dc77,_0x456f7e){_0x51dc77=_0x51dc77-0x0;var _0x21a864=_0xe35d[_0x51dc77];return _0x21a864;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require(_0xde35('0x2'));var BPromise=require(_0xde35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde35('0x4'));var db=require(_0xde35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xde35('0xb'),'port':0x18eb});var socket=require(_0xde35('0xc'))(new Redis(config[_0xde35('0xd')]));require('./cmList.socket')[_0xde35('0xe')](socket);function respondWithRpcPromise(_0x5af2cf,_0x499ecb,_0x155da6){return new BPromise(function(_0x258bef,_0x32e75f){return client[_0xde35('0xf')](_0x5af2cf,_0x155da6)[_0xde35('0x10')](function(_0x55bd63){logger['info'](_0xde35('0x11'),_0x499ecb,_0xde35('0x12'));logger['debug'](_0xde35('0x13'),_0x499ecb,'request\x20sent',JSON[_0xde35('0x14')](_0x55bd63));if(_0x55bd63[_0xde35('0x15')]){if(_0x55bd63[_0xde35('0x15')][_0xde35('0x16')]===0x1f4){logger[_0xde35('0x15')]('CmList,\x20%s,\x20%s',_0x499ecb,_0x55bd63[_0xde35('0x15')][_0xde35('0x17')]);return _0x32e75f(_0x55bd63[_0xde35('0x15')]['message']);}logger[_0xde35('0x15')](_0xde35('0x11'),_0x499ecb,_0x55bd63[_0xde35('0x15')]['message']);return _0x258bef(_0x55bd63[_0xde35('0x15')][_0xde35('0x17')]);}else{logger[_0xde35('0x18')](_0xde35('0x11'),_0x499ecb,_0xde35('0x12'));_0x258bef(_0x55bd63[_0xde35('0x19')]['message']);}})['catch'](function(_0x471bd7){logger[_0xde35('0x15')](_0xde35('0x11'),_0x499ecb,_0x471bd7);_0x32e75f(_0x471bd7);});});} \ No newline at end of file +var _0x4f2f=['defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0x4f2f,0x1ef));var _0xf4f2=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x4f2f[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xf4f2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf4f2('0x1'));var rs=require(_0xf4f2('0x2'));var fs=require('fs');var Redis=require(_0xf4f2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4f2('0x4'));var logger=require('../../config/logger')(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var jayson=require(_0xf4f2('0x7'));var client=jayson['client'][_0xf4f2('0x8')]({'port':0x232a});config['redis']=_[_0xf4f2('0x9')](config[_0xf4f2('0xa')],{'host':_0xf4f2('0xb'),'port':0x18eb});var socket=require(_0xf4f2('0xc'))(new Redis(config['redis']));require('./cmList.socket')[_0xf4f2('0xd')](socket);function respondWithRpcPromise(_0x35bb8b,_0x297b9e,_0x58b17d){return new BPromise(function(_0x16f13f,_0x432c49){return client['request'](_0x35bb8b,_0x58b17d)[_0xf4f2('0xe')](function(_0xe31449){logger[_0xf4f2('0xf')]('CmList,\x20%s,\x20%s',_0x297b9e,_0xf4f2('0x10'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x297b9e,_0xf4f2('0x10'),JSON[_0xf4f2('0x11')](_0xe31449));if(_0xe31449[_0xf4f2('0x12')]){if(_0xe31449['error'][_0xf4f2('0x13')]===0x1f4){logger[_0xf4f2('0x12')]('CmList,\x20%s,\x20%s',_0x297b9e,_0xe31449[_0xf4f2('0x12')][_0xf4f2('0x14')]);return _0x432c49(_0xe31449[_0xf4f2('0x12')]['message']);}logger[_0xf4f2('0x12')]('CmList,\x20%s,\x20%s',_0x297b9e,_0xe31449[_0xf4f2('0x12')]['message']);return _0x16f13f(_0xe31449[_0xf4f2('0x12')][_0xf4f2('0x14')]);}else{logger[_0xf4f2('0xf')](_0xf4f2('0x15'),_0x297b9e,'request\x20sent');_0x16f13f(_0xe31449[_0xf4f2('0x16')][_0xf4f2('0x14')]);}})[_0xf4f2('0x17')](function(_0x561f80){logger[_0xf4f2('0x12')]('CmList,\x20%s,\x20%s',_0x297b9e,_0x561f80);_0x432c49(_0x561f80);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b0920af..d727996 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 _0x1ed5=['cmList:','./cmList.events','save','remove','emit','removeListener','register','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1ed5,0xf1));var _0x51ed=function(_0x3d6ac0,_0x1c52e2){_0x3d6ac0=_0x3d6ac0-0x0;var _0x359130=_0x1ed5[_0x3d6ac0];return _0x359130;};'use strict';var CmListEvents=require(_0x51ed('0x0'));var events=[_0x51ed('0x1'),_0x51ed('0x2'),'update'];function createListener(_0x5ce2fc,_0x51133c){return function(_0x462efe){_0x51133c[_0x51ed('0x3')](_0x5ce2fc,_0x462efe);};}function removeListener(_0x1c88b5,_0x5eb6dd){return function(){CmListEvents[_0x51ed('0x4')](_0x1c88b5,_0x5eb6dd);};}exports[_0x51ed('0x5')]=function(_0x430097){for(var _0x331361=0x0,_0x5a9715=events[_0x51ed('0x6')];_0x331361<_0x5a9715;_0x331361++){var _0x2f1e04=events[_0x331361];var _0x577254=createListener(_0x51ed('0x7')+_0x2f1e04,_0x430097);CmListEvents['on'](_0x2f1e04,_0x577254);}}; \ No newline at end of file +var _0xf369=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0xf369,0x104));var _0x9f36=function(_0x41b32e,_0x193627){_0x41b32e=_0x41b32e-0x0;var _0xa5e454=_0xf369[_0x41b32e];return _0xa5e454;};'use strict';var CmListEvents=require(_0x9f36('0x0'));var events=[_0x9f36('0x1'),_0x9f36('0x2'),_0x9f36('0x3')];function createListener(_0x73625b,_0x2e2706){return function(_0xd24d53){_0x2e2706[_0x9f36('0x4')](_0x73625b,_0xd24d53);};}function removeListener(_0x5594ad,_0x4832af){return function(){CmListEvents[_0x9f36('0x5')](_0x5594ad,_0x4832af);};}exports[_0x9f36('0x6')]=function(_0x2f86fc){for(var _0x5469ca=0x0,_0x166e66=events[_0x9f36('0x7')];_0x5469ca<_0x166e66;_0x5469ca++){var _0x1c4a42=events[_0x5469ca];var _0x424c52=createListener(_0x9f36('0x8')+_0x1c4a42,_0x2f86fc);CmListEvents['on'](_0x1c4a42,_0x424c52);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6651a53..9d75afd 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 _0xe85c=['isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','getContacts','getContactsCsv','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require('util');var path=require(_0xce85('0x1'));var timeout=require(_0xce85('0x2'));var express=require(_0xce85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce85('0x4'));var interaction=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xce85('0x7')]);router[_0xce85('0x8')](_0xce85('0x9'),auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x8')](_0xce85('0xc'),auth['isAuthenticated'](),controller[_0xce85('0xd')]);router['get'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0xf')]);router[_0xce85('0x8')]('/:id/dispositions',auth[_0xce85('0xa')](),controller[_0xce85('0x10')]);router[_0xce85('0x8')]('/:id/contacts',auth[_0xce85('0xa')](),controller[_0xce85('0x11')]);router[_0xce85('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xce85('0x12')]);router[_0xce85('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xce85('0x13')]);router[_0xce85('0x8')](_0xce85('0x14'),auth[_0xce85('0xa')](),controller['getAgents']);router[_0xce85('0x15')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0x16')]);router[_0xce85('0x15')](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x18')]);router['post'](_0xce85('0x19'),auth[_0xce85('0xa')](),controller[_0xce85('0x1a')]);router[_0xce85('0x15')](_0xce85('0x1b'),auth[_0xce85('0xa')](),controller[_0xce85('0x1c')]);router[_0xce85('0x15')](_0xce85('0x14'),auth[_0xce85('0xa')](),controller['addAgents']);router[_0xce85('0x1d')](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0x1e')]);router[_0xce85('0x1f')](_0xce85('0xe'),auth['isAuthenticated'](),controller[_0xce85('0x20')]);router['delete'](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x21')]);router['delete']('/:id/users',auth[_0xce85('0xa')](),controller[_0xce85('0x22')]);module[_0xce85('0x23')]=router; \ No newline at end of file +var _0x1bb2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','create','post','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','util','path','connect-timeout','fs-extra'];(function(_0x319c4f,_0x1573ff){var _0x4ae9ff=function(_0x12e9e6){while(--_0x12e9e6){_0x319c4f['push'](_0x319c4f['shift']());}};_0x4ae9ff(++_0x1573ff);}(_0x1bb2,0x152));var _0x21bb=function(_0x5ac3d3,_0x3dbabc){_0x5ac3d3=_0x5ac3d3-0x0;var _0x3a89d3=_0x1bb2[_0x5ac3d3];return _0x3a89d3;};'use strict';var multer=require('multer');var util=require(_0x21bb('0x0'));var path=require(_0x21bb('0x1'));var timeout=require(_0x21bb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x21bb('0x3'));var auth=require(_0x21bb('0x4'));var interaction=require(_0x21bb('0x5'));var config=require(_0x21bb('0x6'));var controller=require(_0x21bb('0x7'));router[_0x21bb('0x8')]('/',auth[_0x21bb('0x9')](),controller[_0x21bb('0xa')]);router[_0x21bb('0x8')](_0x21bb('0xb'),auth[_0x21bb('0x9')](),controller[_0x21bb('0xc')]);router['get'](_0x21bb('0xd'),auth['isAuthenticated'](),controller[_0x21bb('0xe')]);router['get']('/:id',auth[_0x21bb('0x9')](),controller[_0x21bb('0xf')]);router[_0x21bb('0x8')](_0x21bb('0x10'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x11')]);router[_0x21bb('0x8')](_0x21bb('0x12'),auth['isAuthenticated'](),controller[_0x21bb('0x13')]);router[_0x21bb('0x8')]('/:id/contacts/csv',auth[_0x21bb('0x9')](),controller[_0x21bb('0x14')]);router['get'](_0x21bb('0x15'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x16')]);router[_0x21bb('0x8')]('/:id/users',auth[_0x21bb('0x9')](),controller['getAgents']);router['post']('/',auth[_0x21bb('0x9')](),controller[_0x21bb('0x17')]);router[_0x21bb('0x18')](_0x21bb('0x10'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x19')]);router[_0x21bb('0x18')](_0x21bb('0x12'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x1a')]);router[_0x21bb('0x18')]('/:id/fields',auth[_0x21bb('0x9')](),controller[_0x21bb('0x1b')]);router[_0x21bb('0x18')]('/:id/users',auth[_0x21bb('0x9')](),controller[_0x21bb('0x1c')]);router[_0x21bb('0x1d')](_0x21bb('0x1e'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x1f')]);router[_0x21bb('0x20')](_0x21bb('0x1e'),auth[_0x21bb('0x9')](),controller[_0x21bb('0x21')]);router[_0x21bb('0x20')](_0x21bb('0x10'),auth['isAuthenticated'](),controller[_0x21bb('0x22')]);router[_0x21bb('0x20')](_0x21bb('0x23'),auth['isAuthenticated'](),controller[_0x21bb('0x24')]);module[_0x21bb('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7073a99..d2a9cd6 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 _0xfa39=['sequelize','exports','getDataValue','field','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa39,0x145));var _0x9fa3=function(_0x52740f,_0x343961){_0x52740f=_0x52740f-0x0;var _0x1cbe11=_0xfa39[_0x52740f];return _0x1cbe11;};'use strict';var Sequelize=require(_0x9fa3('0x0'));module[_0x9fa3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x32e6b7){return this[_0x9fa3('0x2')](_0x9fa3('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x9fa3('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3e36=['STRING','sequelize','VIRTUAL'];(function(_0x1a428e,_0x11fd95){var _0x1cc1c6=function(_0x1b78f4){while(--_0x1b78f4){_0x1a428e['push'](_0x1a428e['shift']());}};_0x1cc1c6(++_0x11fd95);}(_0x3e36,0xa3));var _0x63e3=function(_0x407312,_0xa86681){_0x407312=_0x407312-0x0;var _0x44c673=_0x3e36[_0x407312];return _0x44c673;};'use strict';var Sequelize=require(_0x63e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x63e3('0x1')],'get':function(_0x48fb48){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x63e3('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x63e3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 56f1ffa..e231ce5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x24c737,_0x10d8b3){var _0x1b95ad=function(_0x29c3c5){while(--_0x29c3c5){_0x24c737['push'](_0x24c737['shift']());}};_0x1b95ad(++_0x10d8b3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x969be3,_0x3f3889){var _0x1e5e5e=function(_0x230680){while(--_0x230680){_0x969be3['push'](_0x969be3['shift']());}};_0x1e5e5e(++_0x3f3889);}(_0x7a54,0x106));var _0x47a5=function(_0x48692d,_0xa86239){_0x48692d=_0x48692d-0x0;var _0x1055a1=_0x7a54[_0x48692d];return _0x1055a1;};'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 d2bb11a..0fce44c 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 _0xdca9=['tools_conditions','lodash','api','moment','rimraf','../../config/environment','exports','define'];(function(_0x4c117d,_0xf11d85){var _0x1d1319=function(_0x486ef0){while(--_0x486ef0){_0x4c117d['push'](_0x4c117d['shift']());}};_0x1d1319(++_0xf11d85);}(_0xdca9,0x151));var _0x9dca=function(_0x5e633a,_0x23f23e){_0x5e633a=_0x5e633a-0x0;var _0x2a7452=_0xdca9[_0x5e633a];return _0x2a7452;};'use strict';var _=require(_0x9dca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9dca('0x1'));var moment=require(_0x9dca('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9dca('0x3'));var config=require(_0x9dca('0x4'));var attributes=require('./condition.attributes');module[_0x9dca('0x5')]=function(_0x290e56,_0x3ff9af){return _0x290e56[_0x9dca('0x6')]('Condition',attributes,{'tableName':_0x9dca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66be=['bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment'];(function(_0x263664,_0x4779c9){var _0x44e79a=function(_0x456ff5){while(--_0x456ff5){_0x263664['push'](_0x263664['shift']());}};_0x44e79a(++_0x4779c9);}(_0x66be,0x175));var _0xe66b=function(_0x376f02,_0x4e2f02){_0x376f02=_0x376f02-0x0;var _0x2cb744=_0x66be[_0x376f02];return _0x2cb744;};'use strict';var _=require('lodash');var util=require(_0xe66b('0x0'));var logger=require(_0xe66b('0x1'))(_0xe66b('0x2'));var moment=require(_0xe66b('0x3'));var BPromise=require(_0xe66b('0x4'));var rp=require(_0xe66b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe66b('0x6'));var config=require(_0xe66b('0x7'));var attributes=require(_0xe66b('0x8'));module[_0xe66b('0x9')]=function(_0x7afa90,_0xa705bf){return _0x7afa90[_0xe66b('0xa')](_0xe66b('0xb'),attributes,{'tableName':_0xe66b('0xc'),'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 2b69177..0342a93 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 _0xc3b5=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59c7ba,_0x146833){var _0x36e1b2=function(_0x164237){while(--_0x164237){_0x59c7ba['push'](_0x59c7ba['shift']());}};_0x36e1b2(++_0x146833);}(_0xc3b5,0x77));var _0x5c3b=function(_0x5db7bd,_0x3bcdda){_0x5db7bd=_0x5db7bd-0x0;var _0x2d1477=_0xc3b5[_0x5db7bd];return _0x2d1477;};'use strict';var _=require(_0x5c3b('0x0'));var util=require('util');var moment=require(_0x5c3b('0x1'));var BPromise=require(_0x5c3b('0x2'));var rs=require(_0x5c3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e037b,_0xa2f1ac,_0x3c4d05){return new BPromise(function(_0x2858e4,_0x52b0a4){return client[_0x5c3b('0xa')](_0x4e037b,_0x3c4d05)[_0x5c3b('0xb')](function(_0x34187e){logger[_0x5c3b('0xc')](_0x5c3b('0xd'),_0xa2f1ac,_0x5c3b('0xe'));logger[_0x5c3b('0xf')](_0x5c3b('0x10'),_0xa2f1ac,_0x5c3b('0xe'),JSON[_0x5c3b('0x11')](_0x34187e));if(_0x34187e[_0x5c3b('0x12')]){if(_0x34187e['error'][_0x5c3b('0x13')]===0x1f4){logger['error'](_0x5c3b('0xd'),_0xa2f1ac,_0x34187e[_0x5c3b('0x12')][_0x5c3b('0x14')]);return _0x52b0a4(_0x34187e['error'][_0x5c3b('0x14')]);}logger['error'](_0x5c3b('0xd'),_0xa2f1ac,_0x34187e[_0x5c3b('0x12')][_0x5c3b('0x14')]);return _0x2858e4(_0x34187e[_0x5c3b('0x12')]['message']);}else{logger[_0x5c3b('0xc')](_0x5c3b('0xd'),_0xa2f1ac,_0x5c3b('0xe'));_0x2858e4(_0x34187e[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x58ed42){logger[_0x5c3b('0x12')]('Condition,\x20%s,\x20%s',_0xa2f1ac,_0x58ed42);_0x52b0a4(_0x58ed42);});});} \ No newline at end of file +var _0xfdd1=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a10ec,_0x4f3e9f){var _0x559652=function(_0x1fe873){while(--_0x1fe873){_0x1a10ec['push'](_0x1a10ec['shift']());}};_0x559652(++_0x4f3e9f);}(_0xfdd1,0xa7));var _0x1fdd=function(_0x2e8802,_0x59ad8c){_0x2e8802=_0x2e8802-0x0;var _0x4617aa=_0xfdd1[_0x2e8802];return _0x4617aa;};'use strict';var _=require('lodash');var util=require(_0x1fdd('0x0'));var moment=require(_0x1fdd('0x1'));var BPromise=require(_0x1fdd('0x2'));var rs=require(_0x1fdd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fdd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdd('0x5'))(_0x1fdd('0x6'));var config=require(_0x1fdd('0x7'));var jayson=require(_0x1fdd('0x8'));var client=jayson['client'][_0x1fdd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f772,_0x358697,_0x4fa799){return new BPromise(function(_0x4b0d50,_0x3f0ae7){return client[_0x1fdd('0xa')](_0x11f772,_0x4fa799)[_0x1fdd('0xb')](function(_0x78b161){logger['info'](_0x1fdd('0xc'),_0x358697,_0x1fdd('0xd'));logger[_0x1fdd('0xe')](_0x1fdd('0xf'),_0x358697,_0x1fdd('0xd'),JSON[_0x1fdd('0x10')](_0x78b161));if(_0x78b161[_0x1fdd('0x11')]){if(_0x78b161['error'][_0x1fdd('0x12')]===0x1f4){logger[_0x1fdd('0x11')](_0x1fdd('0xc'),_0x358697,_0x78b161['error'][_0x1fdd('0x13')]);return _0x3f0ae7(_0x78b161[_0x1fdd('0x11')][_0x1fdd('0x13')]);}logger[_0x1fdd('0x11')]('Condition,\x20%s,\x20%s',_0x358697,_0x78b161[_0x1fdd('0x11')][_0x1fdd('0x13')]);return _0x4b0d50(_0x78b161[_0x1fdd('0x11')][_0x1fdd('0x13')]);}else{logger[_0x1fdd('0x14')]('Condition,\x20%s,\x20%s',_0x358697,_0x1fdd('0xd'));_0x4b0d50(_0x78b161[_0x1fdd('0x15')][_0x1fdd('0x13')]);}})[_0x1fdd('0x16')](function(_0x25208a){logger[_0x1fdd('0x11')](_0x1fdd('0xc'),_0x358697,_0x25208a);_0x3f0ae7(_0x25208a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 99be771..cd86df3 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 _0xa294=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x44bcb6,_0x16e9a3){var _0x49ac0f=function(_0x418622){while(--_0x418622){_0x44bcb6['push'](_0x44bcb6['shift']());}};_0x49ac0f(++_0x16e9a3);}(_0xa294,0xaf));var _0x4a29=function(_0x49f0ba,_0x1b9f7e){_0x49f0ba=_0x49f0ba-0x0;var _0x4f579f=_0xa294[_0x49f0ba];return _0x4f579f;};'use strict';var multer=require(_0x4a29('0x0'));var util=require(_0x4a29('0x1'));var path=require(_0x4a29('0x2'));var timeout=require(_0x4a29('0x3'));var express=require(_0x4a29('0x4'));var router=express[_0x4a29('0x5')]();var fs_extra=require(_0x4a29('0x6'));var auth=require(_0x4a29('0x7'));var interaction=require(_0x4a29('0x8'));var config=require(_0x4a29('0x9'));var controller=require(_0x4a29('0xa'));router[_0x4a29('0xb')](_0x4a29('0xc'),auth[_0x4a29('0xd')](),controller[_0x4a29('0xe')]);router[_0x4a29('0xf')]('/:id',auth[_0x4a29('0xd')](),controller[_0x4a29('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3b33=['/:id','update','isAuthenticated','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x1fef8c,_0x337373){var _0x33ba2a=function(_0x44490f){while(--_0x44490f){_0x1fef8c['push'](_0x1fef8c['shift']());}};_0x33ba2a(++_0x337373);}(_0x3b33,0x13c));var _0x33b3=function(_0x168192,_0x2938b8){_0x168192=_0x168192-0x0;var _0x1b7832=_0x3b33[_0x168192];return _0x1b7832;};'use strict';var multer=require(_0x33b3('0x0'));var util=require(_0x33b3('0x1'));var path=require(_0x33b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x33b3('0x3'));var router=express[_0x33b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x33b3('0x5'));var interaction=require(_0x33b3('0x6'));var config=require('../../config/environment');var controller=require(_0x33b3('0x7'));router[_0x33b3('0x8')](_0x33b3('0x9'),auth['isAuthenticated'](),controller[_0x33b3('0xa')]);router['delete'](_0x33b3('0x9'),auth[_0x33b3('0xb')](),controller['destroy']);module[_0x33b3('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 7a33d82..e52702f 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 _0xc73a=['sequelize','exports','STRING','name','INTEGER'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xc73a,0x1ae));var _0xac73=function(_0x509636,_0x44dab4){_0x509636=_0x509636-0x0;var _0x3453e8=_0xc73a[_0x509636];return _0x3453e8;};'use strict';var Sequelize=require(_0xac73('0x0'));module[_0xac73('0x1')]={'name':{'type':Sequelize[_0xac73('0x2')],'allowNull':![],'unique':_0xac73('0x3')},'OrderBy':{'type':Sequelize[_0xac73('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2c86=['name','sequelize','exports','STRING'];(function(_0x4c405d,_0x1c2d77){var _0x225a66=function(_0x4638da){while(--_0x4638da){_0x4c405d['push'](_0x4c405d['shift']());}};_0x225a66(++_0x1c2d77);}(_0x2c86,0x139));var _0x62c8=function(_0x22c880,_0x32ce7c){_0x22c880=_0x22c880-0x0;var _0x362b31=_0x2c86[_0x22c880];return _0x362b31;};'use strict';var Sequelize=require(_0x62c8('0x0'));module[_0x62c8('0x1')]={'name':{'type':Sequelize[_0x62c8('0x2')],'allowNull':![],'unique':_0x62c8('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x62c8('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1a1df91..bda4b17 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 _0x57ca=['sort','pick','filter','where','merge','VIRTUAL','rows','params','rawAttributes','fields','length','includeAll','include','options','find','create','user','role','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','ContactItemType','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','nolimit','order'];(function(_0x286443,_0x8a8c1b){var _0x3d7a05=function(_0x14b699){while(--_0x14b699){_0x286443['push'](_0x286443['shift']());}};_0x3d7a05(++_0x8a8c1b);}(_0x57ca,0x108));var _0xa57c=function(_0x52f3fa,_0x19b92a){_0x52f3fa=_0x52f3fa-0x0;var _0x11a24c=_0x57ca[_0x52f3fa];return _0x11a24c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){var _0x241dcc=_0xdf65dd[_0xa57c('0x23')]({'plain':!![]});var _0x431bec='ContactItemTypes';return db[_0xa57c('0x24')][_0xa57c('0x22')]({'where':{'type':_0x431bec,'resourceId':_0x241dcc['id']}})[_0xa57c('0x21')](function(){return _0xdf65dd;});})[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x25')]();});}};}function handleEntityNotFound(_0x8ee1c0,_0xe50fb8){return function(_0x337f97){if(!_0x337f97){_0x8ee1c0[_0xa57c('0x26')](0x194);}return _0x337f97;};}function handleError(_0x57ebe0,_0x3b7364){_0x3b7364=_0x3b7364||0x1f4;return function(_0x4c1478){logger['error'](_0x4c1478[_0xa57c('0x27')]);if(_0x4c1478[_0xa57c('0x28')]){delete _0x4c1478['name'];}_0x57ebe0[_0xa57c('0x17')](_0x3b7364)[_0xa57c('0x29')](_0x4c1478);};}exports[_0xa57c('0x2a')]=function(_0x57565b,_0xd779f1){var _0x58d46f={},_0xf5f70c={},_0x5464f2={'count':0x0,'rows':[]};var _0x2a3bbe=_['map'](db[_0xa57c('0x2b')]['rawAttributes'],function(_0x9e02bb){return{'name':_0x9e02bb[_0xa57c('0x2c')],'type':_0x9e02bb[_0xa57c('0x2d')][_0xa57c('0x2e')]};});_0xf5f70c[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x2a3bbe,_0xa57c('0x28'));_0xf5f70c['query']=_[_0xa57c('0x31')](_0x57565b['query']);_0xf5f70c[_0xa57c('0x32')]=_[_0xa57c('0x33')](_0xf5f70c[_0xa57c('0x2f')],_0xf5f70c['query']);_0x58d46f[_0xa57c('0x34')]=_['intersection'](_0xf5f70c[_0xa57c('0x2f')],qs['fields'](_0x57565b[_0xa57c('0x35')]['fields']));_0x58d46f[_0xa57c('0x34')]=_0x58d46f[_0xa57c('0x34')]['length']?_0x58d46f[_0xa57c('0x34')]:_0xf5f70c['model'];if(!_0x57565b[_0xa57c('0x35')]['hasOwnProperty'](_0xa57c('0x36'))){_0x58d46f[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x57565b[_0xa57c('0x35')][_0xa57c('0x1c')]);_0x58d46f[_0xa57c('0x19')]=qs['offset'](_0x57565b['query'][_0xa57c('0x19')]);}_0x58d46f[_0xa57c('0x37')]=qs[_0xa57c('0x38')](_0x57565b['query'][_0xa57c('0x38')]);_0x58d46f['where']=qs[_0xa57c('0x32')](_[_0xa57c('0x39')](_0x57565b['query'],_0xf5f70c['filters']),_0x2a3bbe);if(_0x57565b['query'][_0xa57c('0x3a')]){_0x58d46f[_0xa57c('0x3b')]=_[_0xa57c('0x3c')](_0x58d46f[_0xa57c('0x3b')],{'$or':_[_0xa57c('0x30')](_0x2a3bbe,function(_0x1b98a0){if(_0x1b98a0['type']!==_0xa57c('0x3d')){var _0x1d4d2e={};_0x1d4d2e[_0x1b98a0['name']]={'$like':'%'+_0x57565b['query'][_0xa57c('0x3a')]+'%'};return _0x1d4d2e;}})});}_0x58d46f=_[_0xa57c('0x3c')]({},_0x58d46f,_0x57565b['options']);var _0x24459a={'where':_0x58d46f[_0xa57c('0x3b')]};return db[_0xa57c('0x2b')][_0xa57c('0x1b')](_0x24459a)[_0xa57c('0x21')](function(_0x43c1d7){_0x5464f2['count']=_0x43c1d7;if(_0x57565b[_0xa57c('0x35')]['includeAll']){_0x58d46f['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x58d46f);})['then'](function(_0x39b20f){_0x5464f2[_0xa57c('0x3e')]=_0x39b20f;return _0x5464f2;})[_0xa57c('0x21')](respondWithFilteredResult(_0xd779f1,_0x58d46f))['catch'](handleError(_0xd779f1,null));};exports['show']=function(_0x49e072,_0x44f1e8){var _0x2755bc={'raw':!![],'where':{'id':_0x49e072[_0xa57c('0x3f')]['id']}},_0x44e38f={};_0x44e38f[_0xa57c('0x2f')]=_[_0xa57c('0x31')](db['ContactItemType'][_0xa57c('0x40')]);_0x44e38f[_0xa57c('0x35')]=_[_0xa57c('0x31')](_0x49e072[_0xa57c('0x35')]);_0x44e38f[_0xa57c('0x32')]=_[_0xa57c('0x33')](_0x44e38f['model'],_0x44e38f[_0xa57c('0x35')]);_0x2755bc[_0xa57c('0x34')]=_[_0xa57c('0x33')](_0x44e38f[_0xa57c('0x2f')],qs[_0xa57c('0x41')](_0x49e072['query'][_0xa57c('0x41')]));_0x2755bc[_0xa57c('0x34')]=_0x2755bc[_0xa57c('0x34')][_0xa57c('0x42')]?_0x2755bc[_0xa57c('0x34')]:_0x44e38f[_0xa57c('0x2f')];if(_0x49e072['query'][_0xa57c('0x43')]){_0x2755bc[_0xa57c('0x44')]=[{'all':!![]}];}_0x2755bc=_[_0xa57c('0x3c')]({},_0x2755bc,_0x49e072[_0xa57c('0x45')]);return db[_0xa57c('0x2b')][_0xa57c('0x46')](_0x2755bc)['then'](handleEntityNotFound(_0x44f1e8,null))['then'](respondWithResult(_0x44f1e8,null))['catch'](handleError(_0x44f1e8,null));};exports['create']=function(_0x232675,_0x49492f){return db[_0xa57c('0x2b')][_0xa57c('0x47')](_0x232675['body'],{})[_0xa57c('0x21')](function(_0x320a5c){var _0x368e87=_0x232675[_0xa57c('0x48')][_0xa57c('0x23')]({'plain':!![]});if(!_0x368e87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x368e87[_0xa57c('0x49')]===_0xa57c('0x48')){var _0x4584e8=_0x320a5c[_0xa57c('0x23')]({'plain':!![]});var _0x2e4b84='ContactItemTypes';return db[_0xa57c('0x4a')]['find']({'where':{'name':_0x2e4b84,'userProfileId':_0x368e87['userProfileId']},'raw':!![]})[_0xa57c('0x21')](function(_0x2c706f){if(_0x2c706f&&_0x2c706f[_0xa57c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x4584e8[_0xa57c('0x28')],'resourceId':_0x4584e8['id'],'type':_0x2c706f[_0xa57c('0x28')],'sectionId':_0x2c706f['id']},{})[_0xa57c('0x21')](function(){return _0x320a5c;});}else{return _0x320a5c;}})[_0xa57c('0x4c')](function(_0x4d2899){logger[_0xa57c('0x4d')](_0xa57c('0x4e'),_0x4d2899);throw _0x4d2899;});}return _0x320a5c;})[_0xa57c('0x21')](respondWithResult(_0x49492f,0xc9))['catch'](handleError(_0x49492f,null));};exports['update']=function(_0xbe70a6,_0x25fc6b){if(_0xbe70a6['body']['id']){delete _0xbe70a6[_0xa57c('0x4f')]['id'];}return db[_0xa57c('0x2b')][_0xa57c('0x46')]({'where':{'id':_0xbe70a6[_0xa57c('0x3f')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x25fc6b,null))[_0xa57c('0x21')](saveUpdates(_0xbe70a6[_0xa57c('0x4f')],null))['then'](respondWithResult(_0x25fc6b,null))['catch'](handleError(_0x25fc6b,null));};exports[_0xa57c('0x22')]=function(_0x14f3d6,_0x2fd759){return db[_0xa57c('0x2b')][_0xa57c('0x46')]({'where':{'id':_0x14f3d6[_0xa57c('0x3f')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2fd759,null))[_0xa57c('0x21')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x14f3d6[_0xa57c('0x3f')]['id']}}))['then'](removeEntity(_0x2fd759,null))[_0xa57c('0x4c')](handleError(_0x2fd759,null));}; \ No newline at end of file +var _0x0424=['rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x2e3503,_0x3f854b){var _0x4a33c6=function(_0x18ca4e){while(--_0x18ca4e){_0x2e3503['push'](_0x2e3503['shift']());}};_0x4a33c6(++_0x3f854b);}(_0x0424,0x159));var _0x4042=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0x0424[_0x1baa84];return _0x18523b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){var _0x2c5fcf=_0x1daee8[_0x4042('0x25')]({'plain':!![]});var _0x5d5c6d=_0x4042('0x26');return db[_0x4042('0x27')][_0x4042('0x28')]({'where':{'type':_0x5d5c6d,'resourceId':_0x2c5fcf['id']}})[_0x4042('0x24')](function(){return _0x1daee8;});})[_0x4042('0x24')](function(){_0x6d12a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8d48,_0x1acdf2){return function(_0x26542c){if(!_0x26542c){_0x1d8d48[_0x4042('0x17')](0x194);}return _0x26542c;};}function handleError(_0x332fe3,_0x473a0d){_0x473a0d=_0x473a0d||0x1f4;return function(_0x5eb84b){logger[_0x4042('0x29')](_0x5eb84b[_0x4042('0x2a')]);if(_0x5eb84b['name']){delete _0x5eb84b[_0x4042('0x2b')];}_0x332fe3[_0x4042('0x18')](_0x473a0d)[_0x4042('0x2c')](_0x5eb84b);};}exports['index']=function(_0x56d49a,_0x3d1f48){var _0x43bd1c={},_0x59773f={},_0x3e9304={'count':0x0,'rows':[]};var _0xc42d70=_[_0x4042('0x2d')](db[_0x4042('0x2e')][_0x4042('0x2f')],function(_0x349c74){return{'name':_0x349c74[_0x4042('0x30')],'type':_0x349c74[_0x4042('0x31')][_0x4042('0x32')]};});_0x59773f['model']=_[_0x4042('0x2d')](_0xc42d70,_0x4042('0x2b'));_0x59773f['query']=_[_0x4042('0x33')](_0x56d49a[_0x4042('0x34')]);_0x59773f['filters']=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],_0x59773f[_0x4042('0x34')]);_0x43bd1c[_0x4042('0x37')]=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],qs[_0x4042('0x38')](_0x56d49a[_0x4042('0x34')][_0x4042('0x38')]));_0x43bd1c[_0x4042('0x37')]=_0x43bd1c[_0x4042('0x37')][_0x4042('0x39')]?_0x43bd1c[_0x4042('0x37')]:_0x59773f[_0x4042('0x36')];if(!_0x56d49a[_0x4042('0x34')][_0x4042('0x3a')](_0x4042('0x3b'))){_0x43bd1c[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1d')]);_0x43bd1c['offset']=qs[_0x4042('0x1b')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1b')]);}_0x43bd1c[_0x4042('0x3c')]=qs['sort'](_0x56d49a[_0x4042('0x34')][_0x4042('0x3d')]);_0x43bd1c[_0x4042('0x3e')]=qs[_0x4042('0x3f')](_[_0x4042('0x40')](_0x56d49a[_0x4042('0x34')],_0x59773f[_0x4042('0x3f')]),_0xc42d70);if(_0x56d49a[_0x4042('0x34')][_0x4042('0x41')]){_0x43bd1c[_0x4042('0x3e')]=_['merge'](_0x43bd1c[_0x4042('0x3e')],{'$or':_[_0x4042('0x2d')](_0xc42d70,function(_0x2f07d8){if(_0x2f07d8[_0x4042('0x31')]!==_0x4042('0x42')){var _0x112e88={};_0x112e88[_0x2f07d8[_0x4042('0x2b')]]={'$like':'%'+_0x56d49a[_0x4042('0x34')]['filter']+'%'};return _0x112e88;}})});}_0x43bd1c=_['merge']({},_0x43bd1c,_0x56d49a[_0x4042('0x43')]);var _0x16468f={'where':_0x43bd1c[_0x4042('0x3e')]};return db[_0x4042('0x2e')][_0x4042('0x1e')](_0x16468f)[_0x4042('0x24')](function(_0xdfb5cb){_0x3e9304[_0x4042('0x1e')]=_0xdfb5cb;if(_0x56d49a[_0x4042('0x34')][_0x4042('0x44')]){_0x43bd1c[_0x4042('0x45')]=[{'all':!![]}];}return db[_0x4042('0x2e')]['findAll'](_0x43bd1c);})['then'](function(_0x929884){_0x3e9304[_0x4042('0x46')]=_0x929884;return _0x3e9304;})['then'](respondWithFilteredResult(_0x3d1f48,_0x43bd1c))[_0x4042('0x47')](handleError(_0x3d1f48,null));};exports['show']=function(_0x25c516,_0x411354){var _0x32ba6f={'raw':!![],'where':{'id':_0x25c516[_0x4042('0x48')]['id']}},_0x4ece0d={};_0x4ece0d[_0x4042('0x36')]=_['keys'](db[_0x4042('0x2e')][_0x4042('0x2f')]);_0x4ece0d[_0x4042('0x34')]=_[_0x4042('0x33')](_0x25c516[_0x4042('0x34')]);_0x4ece0d['filters']=_['intersection'](_0x4ece0d['model'],_0x4ece0d[_0x4042('0x34')]);_0x32ba6f[_0x4042('0x37')]=_['intersection'](_0x4ece0d['model'],qs['fields'](_0x25c516[_0x4042('0x34')]['fields']));_0x32ba6f['attributes']=_0x32ba6f[_0x4042('0x37')][_0x4042('0x39')]?_0x32ba6f[_0x4042('0x37')]:_0x4ece0d[_0x4042('0x36')];if(_0x25c516[_0x4042('0x34')][_0x4042('0x44')]){_0x32ba6f[_0x4042('0x45')]=[{'all':!![]}];}_0x32ba6f=_[_0x4042('0x49')]({},_0x32ba6f,_0x25c516[_0x4042('0x43')]);return db['ContactItemType']['find'](_0x32ba6f)['then'](handleEntityNotFound(_0x411354,null))['then'](respondWithResult(_0x411354,null))[_0x4042('0x47')](handleError(_0x411354,null));};exports[_0x4042('0x4a')]=function(_0xd898ea,_0x250434){return db[_0x4042('0x2e')][_0x4042('0x4a')](_0xd898ea[_0x4042('0x4b')],{})[_0x4042('0x24')](function(_0x4a14bd){var _0x24071a=_0xd898ea[_0x4042('0x4c')][_0x4042('0x25')]({'plain':!![]});if(!_0x24071a)throw new Error(_0x4042('0x4d'));if(_0x24071a[_0x4042('0x4e')]===_0x4042('0x4c')){var _0xf5f38a=_0x4a14bd['get']({'plain':!![]});var _0x5ed001='ContactItemTypes';return db[_0x4042('0x4f')][_0x4042('0x50')]({'where':{'name':_0x5ed001,'userProfileId':_0x24071a['userProfileId']},'raw':!![]})[_0x4042('0x24')](function(_0xa5323d){if(_0xa5323d&&_0xa5323d['autoAssociation']===0x0){return db['UserProfileResource'][_0x4042('0x4a')]({'name':_0xf5f38a[_0x4042('0x2b')],'resourceId':_0xf5f38a['id'],'type':_0xa5323d[_0x4042('0x2b')],'sectionId':_0xa5323d['id']},{})[_0x4042('0x24')](function(){return _0x4a14bd;});}else{return _0x4a14bd;}})[_0x4042('0x47')](function(_0x478645){logger[_0x4042('0x29')](_0x4042('0x51'),_0x478645);throw _0x478645;});}return _0x4a14bd;})[_0x4042('0x24')](respondWithResult(_0x250434,0xc9))[_0x4042('0x47')](handleError(_0x250434,null));};exports[_0x4042('0x23')]=function(_0xfdd409,_0x3876ce){if(_0xfdd409['body']['id']){delete _0xfdd409['body']['id'];}return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0xfdd409[_0x4042('0x48')]['id']}})['then'](handleEntityNotFound(_0x3876ce,null))[_0x4042('0x24')](saveUpdates(_0xfdd409['body'],null))[_0x4042('0x24')](respondWithResult(_0x3876ce,null))['catch'](handleError(_0x3876ce,null));};exports[_0x4042('0x28')]=function(_0x1cba67,_0x22b633){return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0x1cba67[_0x4042('0x48')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x22b633,null))[_0x4042('0x24')](db[_0x4042('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1cba67[_0x4042('0x48')]['id']}}))[_0x4042('0x24')](removeEntity(_0x22b633,null))[_0x4042('0x47')](handleError(_0x22b633,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 606b117..a5425ca 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 _0x22a0=['bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x22a0,0x105));var _0x022a=function(_0x1c05be,_0x546923){_0x1c05be=_0x1c05be-0x0;var _0x48677c=_0x22a0[_0x1c05be];return _0x48677c;};'use strict';var _=require(_0x022a('0x0'));var util=require(_0x022a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x022a('0x2'));var BPromise=require(_0x022a('0x3'));var rp=require(_0x022a('0x4'));var fs=require('fs');var path=require(_0x022a('0x5'));var rimraf=require(_0x022a('0x6'));var config=require(_0x022a('0x7'));var attributes=require(_0x022a('0x8'));module[_0x022a('0x9')]=function(_0x284924,_0x420288){return _0x284924['define']('ContactItemType',attributes,{'tableName':_0x022a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c7c=['path','rimraf','define','ContactItemType','lodash','util','moment','bluebird'];(function(_0x53f095,_0x3e63e8){var _0x528a10=function(_0x5bdc89){while(--_0x5bdc89){_0x53f095['push'](_0x53f095['shift']());}};_0x528a10(++_0x3e63e8);}(_0x0c7c,0xcc));var _0xc0c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c7c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c7('0x0'));var util=require(_0xc0c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc0c7('0x2'));var BPromise=require(_0xc0c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0c7('0x4'));var rimraf=require(_0xc0c7('0x5'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x17d14,_0x452a5b){return _0x17d14[_0xc0c7('0x6')](_0xc0c7('0x7'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index f10bc2e..fa87c37 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 _0x0e9e=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x0e9e,0x19a));var _0xe0e9=function(_0x5c3be5,_0x1511a2){_0x5c3be5=_0x5c3be5-0x0;var _0x2bc75f=_0x0e9e[_0x5c3be5];return _0x2bc75f;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var moment=require(_0xe0e9('0x2'));var BPromise=require(_0xe0e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0e9('0x4'));var db=require(_0xe0e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0e9('0x6'))('rpc');var config=require(_0xe0e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0e9('0x8')][_0xe0e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23d73d,_0x1ffe4b,_0x2f8bd4){return new BPromise(function(_0x2c63ae,_0x3b5d04){return client[_0xe0e9('0xa')](_0x23d73d,_0x2f8bd4)[_0xe0e9('0xb')](function(_0x43fb81){logger[_0xe0e9('0xc')](_0xe0e9('0xd'),_0x1ffe4b,_0xe0e9('0xe'));logger[_0xe0e9('0xf')](_0xe0e9('0x10'),_0x1ffe4b,_0xe0e9('0xe'),JSON[_0xe0e9('0x11')](_0x43fb81));if(_0x43fb81[_0xe0e9('0x12')]){if(_0x43fb81[_0xe0e9('0x12')]['code']===0x1f4){logger[_0xe0e9('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1ffe4b,_0x43fb81[_0xe0e9('0x12')]['message']);return _0x3b5d04(_0x43fb81['error'][_0xe0e9('0x13')]);}logger[_0xe0e9('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1ffe4b,_0x43fb81[_0xe0e9('0x12')][_0xe0e9('0x13')]);return _0x2c63ae(_0x43fb81['error'][_0xe0e9('0x13')]);}else{logger['info'](_0xe0e9('0xd'),_0x1ffe4b,'request\x20sent');_0x2c63ae(_0x43fb81[_0xe0e9('0x14')]['message']);}})[_0xe0e9('0x15')](function(_0x1a1d65){logger[_0xe0e9('0x12')](_0xe0e9('0xd'),_0x1ffe4b,_0x1a1d65);_0x3b5d04(_0x1a1d65);});});} \ No newline at end of file +var _0xe82c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','ContactItemType,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe82c,0x1dd));var _0xce82=function(_0x58b21c,_0x9b112){_0x58b21c=_0x58b21c-0x0;var _0x3b75f8=_0xe82c[_0x58b21c];return _0x3b75f8;};'use strict';var _=require(_0xce82('0x0'));var util=require(_0xce82('0x1'));var moment=require(_0xce82('0x2'));var BPromise=require('bluebird');var rs=require(_0xce82('0x3'));var fs=require('fs');var Redis=require(_0xce82('0x4'));var db=require(_0xce82('0x5'))['db'];var utils=require(_0xce82('0x6'));var logger=require(_0xce82('0x7'))('rpc');var config=require(_0xce82('0x8'));var jayson=require(_0xce82('0x9'));var client=jayson[_0xce82('0xa')][_0xce82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8af1,_0x398289,_0xba3899){return new BPromise(function(_0x18c897,_0xa24b65){return client[_0xce82('0xc')](_0x4d8af1,_0xba3899)['then'](function(_0xe80878){logger[_0xce82('0xd')]('ContactItemType,\x20%s,\x20%s',_0x398289,_0xce82('0xe'));logger[_0xce82('0xf')](_0xce82('0x10'),_0x398289,'request\x20sent',JSON[_0xce82('0x11')](_0xe80878));if(_0xe80878['error']){if(_0xe80878[_0xce82('0x12')]['code']===0x1f4){logger[_0xce82('0x12')]('ContactItemType,\x20%s,\x20%s',_0x398289,_0xe80878[_0xce82('0x12')][_0xce82('0x13')]);return _0xa24b65(_0xe80878[_0xce82('0x12')][_0xce82('0x13')]);}logger[_0xce82('0x12')]('ContactItemType,\x20%s,\x20%s',_0x398289,_0xe80878[_0xce82('0x12')]['message']);return _0x18c897(_0xe80878[_0xce82('0x12')]['message']);}else{logger[_0xce82('0xd')](_0xce82('0x14'),_0x398289,_0xce82('0xe'));_0x18c897(_0xe80878[_0xce82('0x15')][_0xce82('0x13')]);}})[_0xce82('0x16')](function(_0x2c8f40){logger[_0xce82('0x12')](_0xce82('0x14'),_0x398289,_0x2c8f40);_0xa24b65(_0x2c8f40);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1e3c63e..46d6f2f 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 _0x7573=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x263261,_0x41e607){var _0x2fdbca=function(_0x208b12){while(--_0x208b12){_0x263261['push'](_0x263261['shift']());}};_0x2fdbca(++_0x41e607);}(_0x7573,0x72));var _0x3757=function(_0x210d0c,_0x298e92){_0x210d0c=_0x210d0c-0x0;var _0x2023a2=_0x7573[_0x210d0c];return _0x2023a2;};'use strict';var multer=require(_0x3757('0x0'));var util=require(_0x3757('0x1'));var path=require(_0x3757('0x2'));var timeout=require(_0x3757('0x3'));var express=require(_0x3757('0x4'));var router=express[_0x3757('0x5')]();var fs_extra=require(_0x3757('0x6'));var auth=require(_0x3757('0x7'));var interaction=require(_0x3757('0x8'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x3757('0x9')]('/',auth['isAuthenticated'](),controller[_0x3757('0xa')]);router['get'](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0xd')]);router[_0x3757('0xe')]('/',auth[_0x3757('0xc')](),controller[_0x3757('0xf')]);router[_0x3757('0x10')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x11')]);router[_0x3757('0x12')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x13')]);module[_0x3757('0x14')]=router; \ No newline at end of file +var _0x692c=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show'];(function(_0x32e05c,_0x175583){var _0x860538=function(_0x3d66d3){while(--_0x3d66d3){_0x32e05c['push'](_0x32e05c['shift']());}};_0x860538(++_0x175583);}(_0x692c,0x6a));var _0xc692=function(_0x1f0088,_0x18af75){_0x1f0088=_0x1f0088-0x0;var _0x3bccb5=_0x692c[_0x1f0088];return _0x3bccb5;};'use strict';var multer=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var path=require(_0xc692('0x2'));var timeout=require(_0xc692('0x3'));var express=require(_0xc692('0x4'));var router=express[_0xc692('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc692('0x6'));var interaction=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var controller=require(_0xc692('0x9'));router[_0xc692('0xa')]('/',auth[_0xc692('0xb')](),controller['index']);router['get'](_0xc692('0xc'),auth[_0xc692('0xb')](),controller[_0xc692('0xd')]);router[_0xc692('0xe')]('/',auth[_0xc692('0xb')](),controller[_0xc692('0xf')]);router[_0xc692('0x10')]('/:id',auth[_0xc692('0xb')](),controller[_0xc692('0x11')]);router[_0xc692('0x12')](_0xc692('0xc'),auth[_0xc692('0xb')](),controller['destroy']);module[_0xc692('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 991e41d..c4cf9a3 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 _0xd8b0=['exports','sequelize'];(function(_0x5470be,_0x5e0551){var _0x37500c=function(_0x519642){while(--_0x519642){_0x5470be['push'](_0x5470be['shift']());}};_0x37500c(++_0x5e0551);}(_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 _0x2032=['name','exports','STRING'];(function(_0x328399,_0x425986){var _0x9923f8=function(_0x685273){while(--_0x685273){_0x328399['push'](_0x328399['shift']());}};_0x9923f8(++_0x425986);}(_0x2032,0xd9));var _0x2203=function(_0x919304,_0x230c20){_0x919304=_0x919304-0x0;var _0x13f2de=_0x2032[_0x919304];return _0x13f2de;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a9926d6..9cc614a 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 _0xa980=['socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Dashboard','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','role','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xa980,0x16d));var _0x0a98=function(_0x182d80,_0xfd0969){_0x182d80=_0x182d80-0x0;var _0x1e8dff=_0xa980[_0x182d80];return _0x1e8dff;};'use strict';var emlformat=require(_0x0a98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a98('0x1'));var jsonpatch=require(_0x0a98('0x2'));var rp=require(_0x0a98('0x3'));var moment=require(_0x0a98('0x4'));var BPromise=require(_0x0a98('0x5'));var Mustache=require(_0x0a98('0x6'));var util=require('util');var path=require(_0x0a98('0x7'));var sox=require(_0x0a98('0x8'));var csv=require(_0x0a98('0x9'));var ejs=require(_0x0a98('0xa'));var fs=require('fs');var fs_extra=require(_0x0a98('0xb'));var _=require(_0x0a98('0xc'));var squel=require(_0x0a98('0xd'));var crypto=require(_0x0a98('0xe'));var jsforce=require(_0x0a98('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0a98('0x9'));var querystring=require(_0x0a98('0x10'));var Papa=require(_0x0a98('0x11'));var Redis=require(_0x0a98('0x12'));var authService=require(_0x0a98('0x13'));var qs=require(_0x0a98('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a98('0x15'));var logger=require(_0x0a98('0x16'))(_0x0a98('0x17'));var utils=require(_0x0a98('0x18'));var config=require(_0x0a98('0x19'));var licenseUtil=require(_0x0a98('0x1a'));var db=require(_0x0a98('0x1b'))['db'];config[_0x0a98('0x1c')]=_[_0x0a98('0x1d')](config[_0x0a98('0x1c')],{'host':_0x0a98('0x1e'),'port':0x18eb});var socket=require(_0x0a98('0x1f'))(new Redis(config['redis']));require(_0x0a98('0x20'))[_0x0a98('0x21')](socket);function respondWithStatusCode(_0x21ff75,_0x599755){_0x599755=_0x599755||0xcc;return function(_0x4e4999){if(_0x4e4999){return _0x21ff75[_0x0a98('0x22')](_0x599755);}return _0x21ff75[_0x0a98('0x23')](_0x599755)['end']();};}function respondWithResult(_0xe6c514,_0x5cc349){_0x5cc349=_0x5cc349||0xc8;return function(_0x9141d4){if(_0x9141d4){return _0xe6c514[_0x0a98('0x23')](_0x5cc349)[_0x0a98('0x24')](_0x9141d4);}};}function respondWithFilteredResult(_0x2dc7ad,_0x280199){return function(_0x1608ea){if(_0x1608ea){var _0x2282c7=typeof _0x280199[_0x0a98('0x25')]===_0x0a98('0x26')&&typeof _0x280199[_0x0a98('0x27')]===_0x0a98('0x26');var _0x4c9232=_0x1608ea['count'];var _0x346eb6=_0x2282c7?0x0:_0x280199[_0x0a98('0x25')];var _0x2c3fea=_0x2282c7?_0x1608ea[_0x0a98('0x28')]:_0x280199['offset']+_0x280199['limit'];var _0x1d391b;if(_0x2c3fea>=_0x4c9232){_0x2c3fea=_0x4c9232;_0x1d391b=0xc8;}else{_0x1d391b=0xce;}_0x2dc7ad[_0x0a98('0x23')](_0x1d391b);return _0x2dc7ad['set'](_0x0a98('0x29'),_0x346eb6+'-'+_0x2c3fea+'/'+_0x4c9232)[_0x0a98('0x24')](_0x1608ea);}return null;};}function patchUpdates(_0x5e88b0){return function(_0xd6d9e){try{jsonpatch[_0x0a98('0x2a')](_0xd6d9e,_0x5e88b0,!![]);}catch(_0x573a75){return BPromise[_0x0a98('0x2b')](_0x573a75);}return _0xd6d9e[_0x0a98('0x2c')]();};}function saveUpdates(_0x331c28,_0x50fd6d){return function(_0x16e824){if(_0x16e824){return _0x16e824['update'](_0x331c28)[_0x0a98('0x2d')](function(_0x467c39){return _0x467c39;});}return null;};}function removeEntity(_0x45bf1e,_0x2391a5){return function(_0x569b71){if(_0x569b71){return _0x569b71[_0x0a98('0x2e')]()['then'](function(){var _0x3eed93=_0x569b71[_0x0a98('0x2f')]({'plain':!![]});var _0xee43c6='CustomDashboards';return db['UserProfileResource'][_0x0a98('0x2e')]({'where':{'type':_0xee43c6,'resourceId':_0x3eed93['id']}})['then'](function(){return _0x569b71;});})['then'](function(){_0x45bf1e[_0x0a98('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe1834,_0x421de1){return function(_0x43fd4d){if(!_0x43fd4d){_0xbe1834['sendStatus'](0x194);}return _0x43fd4d;};}function handleError(_0x35893c,_0x404e54){_0x404e54=_0x404e54||0x1f4;return function(_0x8c0257){logger['error'](_0x8c0257[_0x0a98('0x30')]);if(_0x8c0257[_0x0a98('0x31')]){delete _0x8c0257[_0x0a98('0x31')];}_0x35893c['status'](_0x404e54)[_0x0a98('0x32')](_0x8c0257);};}exports['index']=function(_0x201e2c,_0x23fd3b){var _0x55df8f={},_0x4ef8ae={},_0x439572={'count':0x0,'rows':[]};var _0x2301f5=_[_0x0a98('0x33')](db['Dashboard']['rawAttributes'],function(_0x9c026c){return{'name':_0x9c026c['fieldName'],'type':_0x9c026c[_0x0a98('0x34')][_0x0a98('0x35')]};});_0x4ef8ae[_0x0a98('0x36')]=_[_0x0a98('0x33')](_0x2301f5,_0x0a98('0x31'));_0x4ef8ae[_0x0a98('0x37')]=_[_0x0a98('0x38')](_0x201e2c[_0x0a98('0x37')]);_0x4ef8ae[_0x0a98('0x39')]=_[_0x0a98('0x3a')](_0x4ef8ae[_0x0a98('0x36')],_0x4ef8ae['query']);_0x55df8f[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x4ef8ae[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x3c')]));_0x55df8f['attributes']=_0x55df8f[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x55df8f[_0x0a98('0x3b')]:_0x4ef8ae[_0x0a98('0x36')];if(!_0x201e2c[_0x0a98('0x37')][_0x0a98('0x3e')](_0x0a98('0x3f'))){_0x55df8f['limit']=qs[_0x0a98('0x27')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x27')]);_0x55df8f['offset']=qs['offset'](_0x201e2c['query']['offset']);}_0x55df8f[_0x0a98('0x40')]=qs[_0x0a98('0x41')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x41')]);_0x55df8f['where']=qs['filters'](_[_0x0a98('0x42')](_0x201e2c[_0x0a98('0x37')],_0x4ef8ae[_0x0a98('0x39')]),_0x2301f5);if(_0x201e2c[_0x0a98('0x37')][_0x0a98('0x43')]){_0x55df8f[_0x0a98('0x44')]=_[_0x0a98('0x45')](_0x55df8f[_0x0a98('0x44')],{'$or':_['map'](_0x2301f5,function(_0x5ede10){if(_0x5ede10[_0x0a98('0x34')]!==_0x0a98('0x46')){var _0x41cb35={};_0x41cb35[_0x5ede10[_0x0a98('0x31')]]={'$like':'%'+_0x201e2c[_0x0a98('0x37')]['filter']+'%'};return _0x41cb35;}})});}_0x55df8f=_[_0x0a98('0x45')]({},_0x55df8f,_0x201e2c[_0x0a98('0x47')]);var _0x2ab73f={'where':_0x55df8f[_0x0a98('0x44')]};return db[_0x0a98('0x48')]['count'](_0x2ab73f)[_0x0a98('0x2d')](function(_0x83813f){_0x439572['count']=_0x83813f;if(_0x201e2c['query']['includeAll']){_0x55df8f[_0x0a98('0x49')]=[{'all':!![]}];}return db[_0x0a98('0x48')]['findAll'](_0x55df8f);})[_0x0a98('0x2d')](function(_0x558cf1){_0x439572[_0x0a98('0x4a')]=_0x558cf1;return _0x439572;})[_0x0a98('0x2d')](respondWithFilteredResult(_0x23fd3b,_0x55df8f))[_0x0a98('0x4b')](handleError(_0x23fd3b,null));};exports[_0x0a98('0x4c')]=function(_0x9e5511,_0x11cfee){var _0x5dbbfa={'raw':![],'where':{'id':_0x9e5511[_0x0a98('0x4d')]['id']}},_0x541766={};_0x541766[_0x0a98('0x36')]=_[_0x0a98('0x38')](db['Dashboard'][_0x0a98('0x4e')]);_0x541766[_0x0a98('0x37')]=_[_0x0a98('0x38')](_0x9e5511[_0x0a98('0x37')]);_0x541766[_0x0a98('0x39')]=_['intersection'](_0x541766[_0x0a98('0x36')],_0x541766[_0x0a98('0x37')]);_0x5dbbfa[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x541766[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x9e5511['query'][_0x0a98('0x3c')]));_0x5dbbfa[_0x0a98('0x3b')]=_0x5dbbfa[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x5dbbfa[_0x0a98('0x3b')]:_0x541766[_0x0a98('0x36')];if(_0x9e5511[_0x0a98('0x37')][_0x0a98('0x4f')]){_0x5dbbfa[_0x0a98('0x49')]=[{'all':!![]}];}_0x5dbbfa=_[_0x0a98('0x45')]({},_0x5dbbfa,_0x9e5511['options']);return db[_0x0a98('0x48')][_0x0a98('0x50')](_0x5dbbfa)[_0x0a98('0x2d')](handleEntityNotFound(_0x11cfee,null))[_0x0a98('0x2d')](respondWithResult(_0x11cfee,null))[_0x0a98('0x4b')](handleError(_0x11cfee,null));};exports[_0x0a98('0x51')]=function(_0x5e76f5,_0x4df194){return db[_0x0a98('0x48')][_0x0a98('0x51')](_0x5e76f5[_0x0a98('0x52')],{})['then'](function(_0x3dea73){var _0x202177=_0x5e76f5['user'][_0x0a98('0x2f')]({'plain':!![]});if(!_0x202177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x202177[_0x0a98('0x53')]==='user'){var _0x114a01=_0x3dea73['get']({'plain':!![]});var _0x3fcde5=_0x0a98('0x54');return db[_0x0a98('0x55')][_0x0a98('0x50')]({'where':{'name':_0x3fcde5,'userProfileId':_0x202177[_0x0a98('0x56')]},'raw':!![]})[_0x0a98('0x2d')](function(_0x4780d2){if(_0x4780d2&&_0x4780d2['autoAssociation']===0x0){return db[_0x0a98('0x57')]['create']({'name':_0x114a01[_0x0a98('0x31')],'resourceId':_0x114a01['id'],'type':_0x4780d2[_0x0a98('0x31')],'sectionId':_0x4780d2['id']},{})[_0x0a98('0x2d')](function(){return _0x3dea73;});}else{return _0x3dea73;}})[_0x0a98('0x4b')](function(_0x34ca17){logger[_0x0a98('0x58')](_0x0a98('0x59'),_0x34ca17);throw _0x34ca17;});}return _0x3dea73;})[_0x0a98('0x2d')](respondWithResult(_0x4df194,0xc9))[_0x0a98('0x4b')](handleError(_0x4df194,null));};exports[_0x0a98('0x5a')]=function(_0x2eaa6b,_0x579f7b){var _0xdb08cc={'where':{'id':_0x2eaa6b[_0x0a98('0x4d')]['id']}},_0x6448={};_0x6448[_0x0a98('0x36')]=_['keys'](db[_0x0a98('0x48')][_0x0a98('0x4e')]);_0xdb08cc[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x6448[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x2eaa6b[_0x0a98('0x37')]['fields']));_0xdb08cc[_0x0a98('0x3b')]=_0xdb08cc[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0xdb08cc['attributes']:_0x6448[_0x0a98('0x36')];if(_0x2eaa6b[_0x0a98('0x37')][_0x0a98('0x4f')]){_0xdb08cc[_0x0a98('0x49')]=[{'all':!![]}];}_0xdb08cc=_[_0x0a98('0x45')]({},_0xdb08cc,_0x2eaa6b[_0x0a98('0x47')]);return db[_0x0a98('0x48')][_0x0a98('0x50')](_0xdb08cc)[_0x0a98('0x2d')](handleEntityNotFound(_0x579f7b,null))['then'](function(_0x529689){if(_0x529689){var _0x2a1135=_0x529689[_0x0a98('0x2f')]({'plain':!![]});_0x2a1135=qs['omit'](_0x2a1135,['id',_0x0a98('0x5b'),_0x0a98('0x5c')]);_0x2eaa6b[_0x0a98('0x52')]=_['omit'](_0x2eaa6b[_0x0a98('0x52')],['id','createdAt',_0x0a98('0x5c')]);return db[_0x0a98('0x48')][_0x0a98('0x51')](_[_0x0a98('0x45')](_0x2a1135,_0x2eaa6b[_0x0a98('0x52')]),{'include':_0x2eaa6b[_0x0a98('0x37')][_0x0a98('0x4f')]?[{'all':!![]}]:undefined})[_0x0a98('0x2d')](function(_0xbc8ce1){var _0x172190=_0x2eaa6b[_0x0a98('0x5d')][_0x0a98('0x2f')]({'plain':!![]});if(!_0x172190)throw new Error(_0x0a98('0x5e'));if(_0x172190[_0x0a98('0x53')]===_0x0a98('0x5d')){var _0x116193=_0xbc8ce1['get']({'plain':!![]});var _0x3639f7=_0x0a98('0x54');return db[_0x0a98('0x55')][_0x0a98('0x50')]({'where':{'name':_0x3639f7,'userProfileId':_0x172190[_0x0a98('0x56')]},'raw':!![]})[_0x0a98('0x2d')](function(_0x44915e){if(_0x44915e&&_0x44915e['autoAssociation']===0x0){return db[_0x0a98('0x57')][_0x0a98('0x51')]({'name':_0x116193['name'],'resourceId':_0x116193['id'],'type':_0x44915e['name'],'sectionId':_0x44915e['id']},{})[_0x0a98('0x2d')](function(){return _0xbc8ce1;});}else{return _0xbc8ce1;}})[_0x0a98('0x4b')](function(_0x21b0cb){logger[_0x0a98('0x58')](_0x0a98('0x59'),_0x21b0cb);throw _0x21b0cb;});}return _0xbc8ce1;});}})[_0x0a98('0x2d')](respondWithResult(_0x579f7b,0xc9))[_0x0a98('0x4b')](handleError(_0x579f7b,null));};exports[_0x0a98('0x5f')]=function(_0x239d6b,_0x5e78f7){if(_0x239d6b['body']['id']){delete _0x239d6b[_0x0a98('0x52')]['id'];}return db[_0x0a98('0x48')][_0x0a98('0x50')]({'where':{'id':_0x239d6b[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x5e78f7,null))[_0x0a98('0x2d')](saveUpdates(_0x239d6b[_0x0a98('0x52')],null))['then'](respondWithResult(_0x5e78f7,null))['catch'](handleError(_0x5e78f7,null));};exports[_0x0a98('0x2e')]=function(_0x5281b3,_0x46cc81){return db[_0x0a98('0x48')][_0x0a98('0x50')]({'where':{'id':_0x5281b3[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x46cc81,null))[_0x0a98('0x2d')](removeEntity(_0x46cc81,null))[_0x0a98('0x4b')](handleError(_0x46cc81,null));};function widgetAttributes(_0x42d850){try{switch(_0x42d850[_0x0a98('0x34')]){case _0x0a98('0x60'):return[{'name':_0x0a98('0x61'),'value':_0x42d850[_0x0a98('0x61')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||_0x0a98('0x64')}];case _0x0a98('0x65'):return[{'name':_0x0a98('0x66'),'value':_0x42d850[_0x0a98('0x66')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||''}];case _0x0a98('0x67'):return[{'name':_0x0a98('0x68'),'value':_0x42d850[_0x0a98('0x68')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||_0x0a98('0x69')},{'name':'attrTimezone','value':_0x42d850['attrTimezone']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1][_0x0a98('0x63')]:undefined)||_0x0a98('0x6a')},{'name':'attrFontSize','value':_0x42d850[_0x0a98('0x6b')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850[_0x0a98('0x62')][0x2][_0x0a98('0x63')]:undefined)||0xc}];case'counter':return[{'name':_0x0a98('0x6c'),'value':_0x42d850[_0x0a98('0x6c')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||_0x0a98('0x6d')},{'name':_0x0a98('0x6e'),'value':_0x42d850[_0x0a98('0x6e')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1][_0x0a98('0x63')]:undefined)||[]},{'name':_0x0a98('0x6b'),'value':_0x42d850[_0x0a98('0x6b')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850[_0x0a98('0x62')][0x2][_0x0a98('0x63')]:undefined)||0x14},{'name':_0x0a98('0x6f'),'value':_0x42d850[_0x0a98('0x6f')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x3]?_0x42d850['attrs'][0x3][_0x0a98('0x63')]:undefined)||_0x0a98('0x70')},{'name':_0x0a98('0x71'),'value':_0x42d850[_0x0a98('0x71')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x4]?_0x42d850[_0x0a98('0x62')][0x4][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x72'),'value':_0x42d850[_0x0a98('0x72')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x5]?_0x42d850[_0x0a98('0x62')][0x5][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x73'),'value':_0x42d850['attrSmsAccounts']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x6]?_0x42d850['attrs'][0x6][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x74'),'value':_0x42d850[_0x0a98('0x74')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x7]?_0x42d850[_0x0a98('0x62')][0x7]['value']:undefined)||''},{'name':_0x0a98('0x75'),'value':_0x42d850[_0x0a98('0x75')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x8]?_0x42d850[_0x0a98('0x62')][0x8]['value']:undefined)||''},{'name':_0x0a98('0x76'),'value':_0x42d850[_0x0a98('0x76')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x9]?_0x42d850['attrs'][0x9][_0x0a98('0x63')]:undefined)||''}];case'multibar-chart':case _0x0a98('0x77'):return[{'name':_0x0a98('0x78'),'value':_0x42d850[_0x0a98('0x78')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||_0x0a98('0x6d')},{'name':_0x0a98('0x79'),'value':_0x42d850[_0x0a98('0x79')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x1]?_0x42d850[_0x0a98('0x62')][0x1]['value']:undefined)||null},{'name':_0x0a98('0x7a'),'value':_0x42d850[_0x0a98('0x7a')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850['attrs'][0x2]['value']:undefined)||null},{'name':_0x0a98('0x6e'),'value':_0x42d850[_0x0a98('0x6e')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x3]?_0x42d850[_0x0a98('0x62')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x42d850['attrChannel']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x4]?_0x42d850[_0x0a98('0x62')][0x4][_0x0a98('0x63')]:undefined)||_0x0a98('0x70')},{'name':_0x0a98('0x71'),'value':_0x42d850[_0x0a98('0x71')]||(_0x42d850['attrs']&&_0x42d850['attrs'][0x5]?_0x42d850[_0x0a98('0x62')][0x5][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x72'),'value':_0x42d850[_0x0a98('0x72')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x6]?_0x42d850[_0x0a98('0x62')][0x6][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x73'),'value':_0x42d850['attrSmsAccounts']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x7]?_0x42d850[_0x0a98('0x62')][0x7]['value']:undefined)||''},{'name':_0x0a98('0x74'),'value':_0x42d850[_0x0a98('0x74')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x8]?_0x42d850[_0x0a98('0x62')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x42d850[_0x0a98('0x75')]||(_0x42d850['attrs']&&_0x42d850['attrs'][0x9]?_0x42d850['attrs'][0x9][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x76'),'value':_0x42d850[_0x0a98('0x76')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0xa]?_0x42d850[_0x0a98('0x62')][0xa][_0x0a98('0x63')]:undefined)||''}];case _0x0a98('0x7b'):return[{'name':'attrReport','type':_0x42d850['reportType']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850['attrs'][0x0][_0x0a98('0x34')]:undefined)||null,'value':_0x42d850[_0x0a98('0x7c')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||null},{'name':_0x0a98('0x7d'),'value':_0x42d850[_0x0a98('0x7d')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4c2c87){logger[_0x0a98('0x58')](_0x0a98('0x7e'),JSON['stringify'](_0x4c2c87));return[];}}exports[_0x0a98('0x7f')]=function(_0xb8ed54,_0x3905f3,_0x3cf86f){if(_0xb8ed54[_0x0a98('0x52')]['id']){delete _0xb8ed54[_0x0a98('0x52')]['id'];}return db[_0x0a98('0x48')]['find']({'where':{'id':_0xb8ed54[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x3905f3,null))[_0x0a98('0x2d')](function(_0x27853e){if(_0x27853e){_0xb8ed54[_0x0a98('0x52')][_0x0a98('0x80')]=_0x27853e['id'];_0xb8ed54[_0x0a98('0x52')][_0x0a98('0x62')]=widgetAttributes(_0xb8ed54[_0x0a98('0x52')]);return db[_0x0a98('0x81')][_0x0a98('0x51')](_0xb8ed54['body']);}})[_0x0a98('0x2d')](respondWithResult(_0x3905f3,null))[_0x0a98('0x4b')](handleError(_0x3905f3,null));};exports[_0x0a98('0x82')]=function(_0x2bea19,_0x14a781,_0xa94c6){var _0x2bc482={};var _0x15f5d5={};var _0x2addae;var _0x6f83b4;return db[_0x0a98('0x48')][_0x0a98('0x83')]({'where':{'id':_0x2bea19[_0x0a98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14a781,null))[_0x0a98('0x2d')](function(_0x2be251){if(_0x2be251){_0x2addae=_0x2be251;_0x15f5d5['model']=_[_0x0a98('0x38')](db[_0x0a98('0x81')][_0x0a98('0x4e')]);_0x15f5d5[_0x0a98('0x37')]=_['keys'](_0x2bea19[_0x0a98('0x37')]);_0x15f5d5['filters']=_[_0x0a98('0x3a')](_0x15f5d5['model'],_0x15f5d5['query']);_0x2bc482[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x15f5d5['model'],qs[_0x0a98('0x3c')](_0x2bea19[_0x0a98('0x37')]['fields']));_0x2bc482['attributes']=_0x2bc482[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x2bc482[_0x0a98('0x3b')]:_0x15f5d5[_0x0a98('0x36')];_0x2bc482[_0x0a98('0x40')]=qs[_0x0a98('0x41')](_0x2bea19[_0x0a98('0x37')]['sort']);_0x2bc482[_0x0a98('0x44')]=qs[_0x0a98('0x39')](_[_0x0a98('0x42')](_0x2bea19[_0x0a98('0x37')],_0x15f5d5[_0x0a98('0x39')]));if(_0x2bea19[_0x0a98('0x37')]['filter']){_0x2bc482[_0x0a98('0x44')]=_[_0x0a98('0x45')](_0x2bc482['where'],{'$or':_[_0x0a98('0x33')](_0x2bc482[_0x0a98('0x3b')],function(_0x1b0f01){var _0x13c180={};_0x13c180[_0x1b0f01]={'$like':'%'+_0x2bea19[_0x0a98('0x37')]['filter']+'%'};return _0x13c180;})});}_0x2bc482=_[_0x0a98('0x45')]({},_0x2bc482,_0x2bea19[_0x0a98('0x47')]);return _0x2addae[_0x0a98('0x82')](_0x2bc482);}})[_0x0a98('0x2d')](function(_0x3f6a5c){if(_0x3f6a5c){_0x6f83b4=_0x3f6a5c[_0x0a98('0x3d')];if(!_0x2bea19[_0x0a98('0x37')][_0x0a98('0x3e')](_0x0a98('0x3f'))){_0x2bc482[_0x0a98('0x27')]=qs[_0x0a98('0x27')](_0x2bea19[_0x0a98('0x37')][_0x0a98('0x27')]);_0x2bc482[_0x0a98('0x25')]=qs[_0x0a98('0x25')](_0x2bea19[_0x0a98('0x37')][_0x0a98('0x25')]);}return _0x2addae[_0x0a98('0x82')](_0x2bc482);}})[_0x0a98('0x2d')](function(_0x123f39){if(_0x123f39){return _0x123f39?{'count':_0x6f83b4,'rows':_0x123f39}:null;}})[_0x0a98('0x2d')](respondWithResult(_0x14a781,null))[_0x0a98('0x4b')](handleError(_0x14a781,null));}; \ No newline at end of file +var _0x49d0=['socket.io-emitter','./dashboard.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','name','send','index','map','Dashboard','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','role','user','UserProfileSection','userProfileId','catch','error','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x49d0,0x6c));var _0x049d=function(_0x1ec208,_0x4041b9){_0x1ec208=_0x1ec208-0x0;var _0x3c0164=_0x49d0[_0x1ec208];return _0x3c0164;};'use strict';var emlformat=require(_0x049d('0x0'));var rimraf=require(_0x049d('0x1'));var zipdir=require(_0x049d('0x2'));var jsonpatch=require(_0x049d('0x3'));var rp=require('request-promise');var moment=require(_0x049d('0x4'));var BPromise=require(_0x049d('0x5'));var Mustache=require('mustache');var util=require(_0x049d('0x6'));var path=require(_0x049d('0x7'));var sox=require(_0x049d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x049d('0x9'));var squel=require(_0x049d('0xa'));var crypto=require(_0x049d('0xb'));var jsforce=require(_0x049d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x049d('0xd'));var querystring=require(_0x049d('0xe'));var Papa=require('papaparse');var Redis=require(_0x049d('0xf'));var authService=require(_0x049d('0x10'));var qs=require(_0x049d('0x11'));var as=require(_0x049d('0x12'));var hardwareService=require(_0x049d('0x13'));var logger=require('../../config/logger')(_0x049d('0x14'));var utils=require(_0x049d('0x15'));var config=require(_0x049d('0x16'));var licenseUtil=require(_0x049d('0x17'));var db=require('../../mysqldb')['db'];config[_0x049d('0x18')]=_[_0x049d('0x19')](config[_0x049d('0x18')],{'host':_0x049d('0x1a'),'port':0x18eb});var socket=require(_0x049d('0x1b'))(new Redis(config[_0x049d('0x18')]));require(_0x049d('0x1c'))[_0x049d('0x1d')](socket);function respondWithStatusCode(_0x2fb5a7,_0x57c0e4){_0x57c0e4=_0x57c0e4||0xcc;return function(_0xfcbdfa){if(_0xfcbdfa){return _0x2fb5a7['sendStatus'](_0x57c0e4);}return _0x2fb5a7[_0x049d('0x1e')](_0x57c0e4)['end']();};}function respondWithResult(_0x20be02,_0x5c9cff){_0x5c9cff=_0x5c9cff||0xc8;return function(_0x177e20){if(_0x177e20){return _0x20be02[_0x049d('0x1e')](_0x5c9cff)[_0x049d('0x1f')](_0x177e20);}};}function respondWithFilteredResult(_0x595251,_0xc9ee03){return function(_0x3355d3){if(_0x3355d3){var _0x348efe=typeof _0xc9ee03[_0x049d('0x20')]===_0x049d('0x21')&&typeof _0xc9ee03[_0x049d('0x22')]===_0x049d('0x21');var _0x39d6c4=_0x3355d3[_0x049d('0x23')];var _0x5b54b6=_0x348efe?0x0:_0xc9ee03['offset'];var _0x222738=_0x348efe?_0x3355d3['count']:_0xc9ee03[_0x049d('0x20')]+_0xc9ee03[_0x049d('0x22')];var _0x162488;if(_0x222738>=_0x39d6c4){_0x222738=_0x39d6c4;_0x162488=0xc8;}else{_0x162488=0xce;}_0x595251['status'](_0x162488);return _0x595251[_0x049d('0x24')](_0x049d('0x25'),_0x5b54b6+'-'+_0x222738+'/'+_0x39d6c4)[_0x049d('0x1f')](_0x3355d3);}return null;};}function patchUpdates(_0x1c0beb){return function(_0x458ed8){try{jsonpatch[_0x049d('0x26')](_0x458ed8,_0x1c0beb,!![]);}catch(_0x182d1f){return BPromise[_0x049d('0x27')](_0x182d1f);}return _0x458ed8[_0x049d('0x28')]();};}function saveUpdates(_0x4834c6,_0x17d395){return function(_0x542be5){if(_0x542be5){return _0x542be5[_0x049d('0x29')](_0x4834c6)[_0x049d('0x2a')](function(_0x19e8c3){return _0x19e8c3;});}return null;};}function removeEntity(_0x9871d6,_0x24d046){return function(_0x2ea43a){if(_0x2ea43a){return _0x2ea43a[_0x049d('0x2b')]()[_0x049d('0x2a')](function(){var _0x4b2dd2=_0x2ea43a[_0x049d('0x2c')]({'plain':!![]});var _0x464dbe=_0x049d('0x2d');return db[_0x049d('0x2e')]['destroy']({'where':{'type':_0x464dbe,'resourceId':_0x4b2dd2['id']}})['then'](function(){return _0x2ea43a;});})[_0x049d('0x2a')](function(){_0x9871d6['status'](0xcc)[_0x049d('0x2f')]();});}};}function handleEntityNotFound(_0x2b1780,_0x58676b){return function(_0x56abb1){if(!_0x56abb1){_0x2b1780['sendStatus'](0x194);}return _0x56abb1;};}function handleError(_0x7ef499,_0x1aeb96){_0x1aeb96=_0x1aeb96||0x1f4;return function(_0x5808f6){logger['error'](_0x5808f6['stack']);if(_0x5808f6[_0x049d('0x30')]){delete _0x5808f6['name'];}_0x7ef499[_0x049d('0x1e')](_0x1aeb96)[_0x049d('0x31')](_0x5808f6);};}exports[_0x049d('0x32')]=function(_0x4fddee,_0x358a33){var _0xb7e912={},_0x1a6e9d={},_0x569762={'count':0x0,'rows':[]};var _0x73a0d6=_[_0x049d('0x33')](db[_0x049d('0x34')][_0x049d('0x35')],function(_0xca6886){return{'name':_0xca6886[_0x049d('0x36')],'type':_0xca6886['type']['key']};});_0x1a6e9d[_0x049d('0x37')]=_[_0x049d('0x33')](_0x73a0d6,_0x049d('0x30'));_0x1a6e9d['query']=_['keys'](_0x4fddee[_0x049d('0x38')]);_0x1a6e9d[_0x049d('0x39')]=_[_0x049d('0x3a')](_0x1a6e9d['model'],_0x1a6e9d[_0x049d('0x38')]);_0xb7e912['attributes']=_[_0x049d('0x3a')](_0x1a6e9d[_0x049d('0x37')],qs[_0x049d('0x3b')](_0x4fddee[_0x049d('0x38')][_0x049d('0x3b')]));_0xb7e912['attributes']=_0xb7e912[_0x049d('0x3c')][_0x049d('0x3d')]?_0xb7e912['attributes']:_0x1a6e9d[_0x049d('0x37')];if(!_0x4fddee[_0x049d('0x38')][_0x049d('0x3e')]('nolimit')){_0xb7e912[_0x049d('0x22')]=qs[_0x049d('0x22')](_0x4fddee[_0x049d('0x38')][_0x049d('0x22')]);_0xb7e912[_0x049d('0x20')]=qs[_0x049d('0x20')](_0x4fddee[_0x049d('0x38')][_0x049d('0x20')]);}_0xb7e912[_0x049d('0x3f')]=qs[_0x049d('0x40')](_0x4fddee[_0x049d('0x38')]['sort']);_0xb7e912[_0x049d('0x41')]=qs[_0x049d('0x39')](_[_0x049d('0x42')](_0x4fddee['query'],_0x1a6e9d[_0x049d('0x39')]),_0x73a0d6);if(_0x4fddee['query'][_0x049d('0x43')]){_0xb7e912[_0x049d('0x41')]=_['merge'](_0xb7e912[_0x049d('0x41')],{'$or':_[_0x049d('0x33')](_0x73a0d6,function(_0x58ecca){if(_0x58ecca[_0x049d('0x44')]!==_0x049d('0x45')){var _0x2e7640={};_0x2e7640[_0x58ecca['name']]={'$like':'%'+_0x4fddee[_0x049d('0x38')][_0x049d('0x43')]+'%'};return _0x2e7640;}})});}_0xb7e912=_[_0x049d('0x46')]({},_0xb7e912,_0x4fddee[_0x049d('0x47')]);var _0x7bc2ed={'where':_0xb7e912[_0x049d('0x41')]};return db['Dashboard']['count'](_0x7bc2ed)[_0x049d('0x2a')](function(_0x2e8630){_0x569762['count']=_0x2e8630;if(_0x4fddee['query'][_0x049d('0x48')]){_0xb7e912['include']=[{'all':!![]}];}return db[_0x049d('0x34')][_0x049d('0x49')](_0xb7e912);})['then'](function(_0x50f87d){_0x569762[_0x049d('0x4a')]=_0x50f87d;return _0x569762;})[_0x049d('0x2a')](respondWithFilteredResult(_0x358a33,_0xb7e912))['catch'](handleError(_0x358a33,null));};exports[_0x049d('0x4b')]=function(_0x5101ed,_0x467ed0){var _0x544f40={'raw':![],'where':{'id':_0x5101ed[_0x049d('0x4c')]['id']}},_0x3db3c8={};_0x3db3c8[_0x049d('0x37')]=_[_0x049d('0x4d')](db[_0x049d('0x34')][_0x049d('0x35')]);_0x3db3c8[_0x049d('0x38')]=_[_0x049d('0x4d')](_0x5101ed[_0x049d('0x38')]);_0x3db3c8[_0x049d('0x39')]=_[_0x049d('0x3a')](_0x3db3c8['model'],_0x3db3c8[_0x049d('0x38')]);_0x544f40[_0x049d('0x3c')]=_[_0x049d('0x3a')](_0x3db3c8[_0x049d('0x37')],qs[_0x049d('0x3b')](_0x5101ed[_0x049d('0x38')][_0x049d('0x3b')]));_0x544f40[_0x049d('0x3c')]=_0x544f40[_0x049d('0x3c')][_0x049d('0x3d')]?_0x544f40[_0x049d('0x3c')]:_0x3db3c8['model'];if(_0x5101ed[_0x049d('0x38')][_0x049d('0x48')]){_0x544f40[_0x049d('0x4e')]=[{'all':!![]}];}_0x544f40=_[_0x049d('0x46')]({},_0x544f40,_0x5101ed[_0x049d('0x47')]);return db[_0x049d('0x34')][_0x049d('0x4f')](_0x544f40)[_0x049d('0x2a')](handleEntityNotFound(_0x467ed0,null))[_0x049d('0x2a')](respondWithResult(_0x467ed0,null))['catch'](handleError(_0x467ed0,null));};exports[_0x049d('0x50')]=function(_0x1528db,_0x332333){return db[_0x049d('0x34')][_0x049d('0x50')](_0x1528db[_0x049d('0x51')],{})[_0x049d('0x2a')](function(_0x28003d){var _0x14fcef=_0x1528db['user'][_0x049d('0x2c')]({'plain':!![]});if(!_0x14fcef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14fcef[_0x049d('0x52')]===_0x049d('0x53')){var _0x4414f0=_0x28003d[_0x049d('0x2c')]({'plain':!![]});var _0x56eab9=_0x049d('0x2d');return db[_0x049d('0x54')][_0x049d('0x4f')]({'where':{'name':_0x56eab9,'userProfileId':_0x14fcef[_0x049d('0x55')]},'raw':!![]})[_0x049d('0x2a')](function(_0x13bb8b){if(_0x13bb8b&&_0x13bb8b['autoAssociation']===0x0){return db['UserProfileResource'][_0x049d('0x50')]({'name':_0x4414f0[_0x049d('0x30')],'resourceId':_0x4414f0['id'],'type':_0x13bb8b['name'],'sectionId':_0x13bb8b['id']},{})[_0x049d('0x2a')](function(){return _0x28003d;});}else{return _0x28003d;}})[_0x049d('0x56')](function(_0x1cbc10){logger[_0x049d('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cbc10);throw _0x1cbc10;});}return _0x28003d;})['then'](respondWithResult(_0x332333,0xc9))['catch'](handleError(_0x332333,null));};exports[_0x049d('0x58')]=function(_0x16ede,_0x42c137){var _0x63af14={'where':{'id':_0x16ede[_0x049d('0x4c')]['id']}},_0x55f13d={};_0x55f13d[_0x049d('0x37')]=_[_0x049d('0x4d')](db[_0x049d('0x34')]['rawAttributes']);_0x63af14[_0x049d('0x3c')]=_[_0x049d('0x3a')](_0x55f13d[_0x049d('0x37')],qs[_0x049d('0x3b')](_0x16ede[_0x049d('0x38')][_0x049d('0x3b')]));_0x63af14[_0x049d('0x3c')]=_0x63af14[_0x049d('0x3c')][_0x049d('0x3d')]?_0x63af14[_0x049d('0x3c')]:_0x55f13d[_0x049d('0x37')];if(_0x16ede['query'][_0x049d('0x48')]){_0x63af14[_0x049d('0x4e')]=[{'all':!![]}];}_0x63af14=_[_0x049d('0x46')]({},_0x63af14,_0x16ede[_0x049d('0x47')]);return db[_0x049d('0x34')][_0x049d('0x4f')](_0x63af14)[_0x049d('0x2a')](handleEntityNotFound(_0x42c137,null))[_0x049d('0x2a')](function(_0x5580cb){if(_0x5580cb){var _0x37a78c=_0x5580cb[_0x049d('0x2c')]({'plain':!![]});_0x37a78c=qs[_0x049d('0x59')](_0x37a78c,['id',_0x049d('0x5a'),_0x049d('0x5b')]);_0x16ede[_0x049d('0x51')]=_[_0x049d('0x59')](_0x16ede[_0x049d('0x51')],['id',_0x049d('0x5a'),_0x049d('0x5b')]);return db['Dashboard']['create'](_[_0x049d('0x46')](_0x37a78c,_0x16ede[_0x049d('0x51')]),{'include':_0x16ede[_0x049d('0x38')][_0x049d('0x48')]?[{'all':!![]}]:undefined})[_0x049d('0x2a')](function(_0x2919ec){var _0x23db11=_0x16ede['user'][_0x049d('0x2c')]({'plain':!![]});if(!_0x23db11)throw new Error(_0x049d('0x5c'));if(_0x23db11[_0x049d('0x52')]===_0x049d('0x53')){var _0xcc5d33=_0x2919ec[_0x049d('0x2c')]({'plain':!![]});var _0x5b16e4=_0x049d('0x2d');return db[_0x049d('0x54')][_0x049d('0x4f')]({'where':{'name':_0x5b16e4,'userProfileId':_0x23db11['userProfileId']},'raw':!![]})['then'](function(_0x5725e6){if(_0x5725e6&&_0x5725e6[_0x049d('0x5d')]===0x0){return db['UserProfileResource'][_0x049d('0x50')]({'name':_0xcc5d33['name'],'resourceId':_0xcc5d33['id'],'type':_0x5725e6['name'],'sectionId':_0x5725e6['id']},{})[_0x049d('0x2a')](function(){return _0x2919ec;});}else{return _0x2919ec;}})[_0x049d('0x56')](function(_0x320d22){logger[_0x049d('0x57')](_0x049d('0x5e'),_0x320d22);throw _0x320d22;});}return _0x2919ec;});}})[_0x049d('0x2a')](respondWithResult(_0x42c137,0xc9))[_0x049d('0x56')](handleError(_0x42c137,null));};exports['update']=function(_0x4004c7,_0x370432){if(_0x4004c7[_0x049d('0x51')]['id']){delete _0x4004c7['body']['id'];}return db[_0x049d('0x34')][_0x049d('0x4f')]({'where':{'id':_0x4004c7[_0x049d('0x4c')]['id']}})[_0x049d('0x2a')](handleEntityNotFound(_0x370432,null))[_0x049d('0x2a')](saveUpdates(_0x4004c7[_0x049d('0x51')],null))[_0x049d('0x2a')](respondWithResult(_0x370432,null))[_0x049d('0x56')](handleError(_0x370432,null));};exports[_0x049d('0x2b')]=function(_0x490647,_0x369aa6){return db[_0x049d('0x34')][_0x049d('0x4f')]({'where':{'id':_0x490647[_0x049d('0x4c')]['id']}})[_0x049d('0x2a')](handleEntityNotFound(_0x369aa6,null))[_0x049d('0x2a')](removeEntity(_0x369aa6,null))[_0x049d('0x56')](handleError(_0x369aa6,null));};function widgetAttributes(_0x40e783){try{switch(_0x40e783[_0x049d('0x44')]){case _0x049d('0x5f'):return[{'name':_0x049d('0x60'),'value':_0x40e783[_0x049d('0x60')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x62')]:undefined)||_0x049d('0x63')}];case _0x049d('0x64'):return[{'name':_0x049d('0x65'),'value':_0x40e783[_0x049d('0x65')]||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783['attrs'][0x0]['value']:undefined)||''}];case _0x049d('0x66'):return[{'name':_0x049d('0x67'),'value':_0x40e783[_0x049d('0x67')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x62')]:undefined)||_0x049d('0x68')},{'name':_0x049d('0x69'),'value':_0x40e783[_0x049d('0x69')]||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0x1]?_0x40e783[_0x049d('0x61')][0x1][_0x049d('0x62')]:undefined)||_0x049d('0x6a')},{'name':_0x049d('0x6b'),'value':_0x40e783[_0x049d('0x6b')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x2]?_0x40e783[_0x049d('0x61')][0x2][_0x049d('0x62')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x40e783[_0x049d('0x6c')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x62')]:undefined)||_0x049d('0x6d')},{'name':_0x049d('0x6e'),'value':_0x40e783[_0x049d('0x6e')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x1]?_0x40e783[_0x049d('0x61')][0x1]['value']:undefined)||[]},{'name':_0x049d('0x6b'),'value':_0x40e783[_0x049d('0x6b')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x2]?_0x40e783[_0x049d('0x61')][0x2][_0x049d('0x62')]:undefined)||0x14},{'name':_0x049d('0x6f'),'value':_0x40e783[_0x049d('0x6f')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x3]?_0x40e783[_0x049d('0x61')][0x3][_0x049d('0x62')]:undefined)||_0x049d('0x70')},{'name':'attrEmailAccounts','value':_0x40e783[_0x049d('0x71')]||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0x4]?_0x40e783[_0x049d('0x61')][0x4][_0x049d('0x62')]:undefined)||''},{'name':_0x049d('0x72'),'value':_0x40e783['attrFaxAccounts']||(_0x40e783['attrs']&&_0x40e783['attrs'][0x5]?_0x40e783[_0x049d('0x61')][0x5][_0x049d('0x62')]:undefined)||''},{'name':_0x049d('0x73'),'value':_0x40e783['attrSmsAccounts']||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0x6]?_0x40e783['attrs'][0x6]['value']:undefined)||''},{'name':_0x049d('0x74'),'value':_0x40e783['attrOpenchannelAccounts']||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x7]?_0x40e783['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x40e783[_0x049d('0x75')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x8]?_0x40e783[_0x049d('0x61')][0x8][_0x049d('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x40e783[_0x049d('0x76')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x9]?_0x40e783[_0x049d('0x61')][0x9][_0x049d('0x62')]:undefined)||''}];case _0x049d('0x77'):case _0x049d('0x78'):return[{'name':_0x049d('0x79'),'value':_0x40e783['attrSerie1']||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x62')]:undefined)||'total'},{'name':'attrSerie2','value':_0x40e783['attrSerie2']||(_0x40e783['attrs']&&_0x40e783['attrs'][0x1]?_0x40e783[_0x049d('0x61')][0x1][_0x049d('0x62')]:undefined)||null},{'name':_0x049d('0x7a'),'value':_0x40e783[_0x049d('0x7a')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783['attrs'][0x2]?_0x40e783[_0x049d('0x61')][0x2][_0x049d('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x40e783['attrVoiceQueues']||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x3]?_0x40e783[_0x049d('0x61')][0x3][_0x049d('0x62')]:undefined)||[]},{'name':_0x049d('0x6f'),'value':_0x40e783[_0x049d('0x6f')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x4]?_0x40e783['attrs'][0x4][_0x049d('0x62')]:undefined)||_0x049d('0x70')},{'name':_0x049d('0x71'),'value':_0x40e783[_0x049d('0x71')]||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0x5]?_0x40e783['attrs'][0x5][_0x049d('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x40e783[_0x049d('0x72')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x6]?_0x40e783[_0x049d('0x61')][0x6][_0x049d('0x62')]:undefined)||''},{'name':_0x049d('0x73'),'value':_0x40e783['attrSmsAccounts']||(_0x40e783[_0x049d('0x61')]&&_0x40e783['attrs'][0x7]?_0x40e783['attrs'][0x7][_0x049d('0x62')]:undefined)||''},{'name':_0x049d('0x74'),'value':_0x40e783[_0x049d('0x74')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x8]?_0x40e783['attrs'][0x8][_0x049d('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x40e783[_0x049d('0x75')]||(_0x40e783['attrs']&&_0x40e783['attrs'][0x9]?_0x40e783['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x40e783['attrChatWebsites']||(_0x40e783['attrs']&&_0x40e783[_0x049d('0x61')][0xa]?_0x40e783[_0x049d('0x61')][0xa]['value']:undefined)||''}];case _0x049d('0x7b'):return[{'name':_0x049d('0x7c'),'type':_0x40e783[_0x049d('0x7d')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x44')]:undefined)||null,'value':_0x40e783[_0x049d('0x7c')]||(_0x40e783[_0x049d('0x61')]&&_0x40e783['attrs'][0x0]?_0x40e783[_0x049d('0x61')][0x0][_0x049d('0x62')]:undefined)||null},{'name':_0x049d('0x7e'),'value':_0x40e783['attrRefresh']||(_0x40e783[_0x049d('0x61')]&&_0x40e783[_0x049d('0x61')][0x1]?_0x40e783[_0x049d('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x19dc9c){logger[_0x049d('0x57')](_0x049d('0x7f'),JSON[_0x049d('0x80')](_0x19dc9c));return[];}}exports[_0x049d('0x81')]=function(_0x2789fc,_0x42dff4,_0x352d08){if(_0x2789fc[_0x049d('0x51')]['id']){delete _0x2789fc['body']['id'];}return db[_0x049d('0x34')][_0x049d('0x4f')]({'where':{'id':_0x2789fc[_0x049d('0x4c')]['id']}})[_0x049d('0x2a')](handleEntityNotFound(_0x42dff4,null))[_0x049d('0x2a')](function(_0x57b60a){if(_0x57b60a){_0x2789fc[_0x049d('0x51')][_0x049d('0x82')]=_0x57b60a['id'];_0x2789fc[_0x049d('0x51')][_0x049d('0x61')]=widgetAttributes(_0x2789fc[_0x049d('0x51')]);return db[_0x049d('0x83')][_0x049d('0x50')](_0x2789fc[_0x049d('0x51')]);}})[_0x049d('0x2a')](respondWithResult(_0x42dff4,null))['catch'](handleError(_0x42dff4,null));};exports[_0x049d('0x84')]=function(_0x434b87,_0x3aa34d,_0x812144){var _0x40886a={};var _0x3e455b={};var _0x3900ac;var _0x1fd1d2;return db[_0x049d('0x34')][_0x049d('0x85')]({'where':{'id':_0x434b87['params']['id']}})[_0x049d('0x2a')](handleEntityNotFound(_0x3aa34d,null))[_0x049d('0x2a')](function(_0x3f2f63){if(_0x3f2f63){_0x3900ac=_0x3f2f63;_0x3e455b['model']=_[_0x049d('0x4d')](db[_0x049d('0x83')][_0x049d('0x35')]);_0x3e455b['query']=_[_0x049d('0x4d')](_0x434b87[_0x049d('0x38')]);_0x3e455b['filters']=_[_0x049d('0x3a')](_0x3e455b[_0x049d('0x37')],_0x3e455b[_0x049d('0x38')]);_0x40886a[_0x049d('0x3c')]=_[_0x049d('0x3a')](_0x3e455b[_0x049d('0x37')],qs['fields'](_0x434b87[_0x049d('0x38')][_0x049d('0x3b')]));_0x40886a[_0x049d('0x3c')]=_0x40886a[_0x049d('0x3c')]['length']?_0x40886a[_0x049d('0x3c')]:_0x3e455b[_0x049d('0x37')];_0x40886a[_0x049d('0x3f')]=qs[_0x049d('0x40')](_0x434b87[_0x049d('0x38')][_0x049d('0x40')]);_0x40886a[_0x049d('0x41')]=qs[_0x049d('0x39')](_[_0x049d('0x42')](_0x434b87[_0x049d('0x38')],_0x3e455b[_0x049d('0x39')]));if(_0x434b87[_0x049d('0x38')][_0x049d('0x43')]){_0x40886a[_0x049d('0x41')]=_[_0x049d('0x46')](_0x40886a[_0x049d('0x41')],{'$or':_[_0x049d('0x33')](_0x40886a[_0x049d('0x3c')],function(_0x26b643){var _0x2b5d1c={};_0x2b5d1c[_0x26b643]={'$like':'%'+_0x434b87[_0x049d('0x38')][_0x049d('0x43')]+'%'};return _0x2b5d1c;})});}_0x40886a=_['merge']({},_0x40886a,_0x434b87[_0x049d('0x47')]);return _0x3900ac['getItems'](_0x40886a);}})['then'](function(_0x5f22c0){if(_0x5f22c0){_0x1fd1d2=_0x5f22c0['length'];if(!_0x434b87[_0x049d('0x38')]['hasOwnProperty'](_0x049d('0x86'))){_0x40886a[_0x049d('0x22')]=qs[_0x049d('0x22')](_0x434b87[_0x049d('0x38')][_0x049d('0x22')]);_0x40886a[_0x049d('0x20')]=qs[_0x049d('0x20')](_0x434b87['query']['offset']);}return _0x3900ac[_0x049d('0x84')](_0x40886a);}})['then'](function(_0x28b220){if(_0x28b220){return _0x28b220?{'count':_0x1fd1d2,'rows':_0x28b220}:null;}})['then'](respondWithResult(_0x3aa34d,null))[_0x049d('0x56')](handleError(_0x3aa34d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 694c656..d59b2d2 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 _0x527b=['emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x527b,0xb7));var _0xb527=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x527b[_0x429948];return _0x35d5d1;};'use strict';var EventEmitter=require(_0xb527('0x0'));var Dashboard=require(_0xb527('0x1'))['db'][_0xb527('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb527('0x3')](0x0);var events={'afterCreate':_0xb527('0x4'),'afterUpdate':_0xb527('0x5'),'afterDestroy':_0xb527('0x6')};function emitEvent(_0x44c9d1){return function(_0x4672da,_0x441392,_0x55c289){DashboardEvents[_0xb527('0x7')](_0x44c9d1+':'+_0x4672da['id'],_0x4672da);DashboardEvents['emit'](_0x44c9d1,_0x4672da);_0x55c289(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb527('0x8')](e,emitEvent(event));}}module[_0xb527('0x9')]=DashboardEvents; \ No newline at end of file +var _0xa94b=['events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','exports'];(function(_0x1ea50a,_0x2a2199){var _0x5459d7=function(_0x39453b){while(--_0x39453b){_0x1ea50a['push'](_0x1ea50a['shift']());}};_0x5459d7(++_0x2a2199);}(_0xa94b,0x130));var _0xba94=function(_0x2ba3ee,_0x34a4a1){_0x2ba3ee=_0x2ba3ee-0x0;var _0x572417=_0xa94b[_0x2ba3ee];return _0x572417;};'use strict';var EventEmitter=require(_0xba94('0x0'));var Dashboard=require(_0xba94('0x1'))['db'][_0xba94('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xba94('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xba94('0x4'),'afterDestroy':_0xba94('0x5')};function emitEvent(_0x26f209){return function(_0x4497b2,_0x1434e3,_0x5cfe59){DashboardEvents[_0xba94('0x6')](_0x26f209+':'+_0x4497b2['id'],_0x4497b2);DashboardEvents[_0xba94('0x6')](_0x26f209,_0x4497b2);_0x5cfe59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xba94('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 41134c7..69d755e 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 _0x3d28=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15fdd6,_0x31810a){var _0xc7d9d1=function(_0x2e3af4){while(--_0x2e3af4){_0x15fdd6['push'](_0x15fdd6['shift']());}};_0xc7d9d1(++_0x31810a);}(_0x3d28,0x150));var _0x83d2=function(_0x41a9c0,_0x34d8fb){_0x41a9c0=_0x41a9c0-0x0;var _0x5e7cf6=_0x3d28[_0x41a9c0];return _0x5e7cf6;};'use strict';var _=require(_0x83d2('0x0'));var util=require(_0x83d2('0x1'));var logger=require(_0x83d2('0x2'))(_0x83d2('0x3'));var moment=require(_0x83d2('0x4'));var BPromise=require(_0x83d2('0x5'));var rp=require(_0x83d2('0x6'));var fs=require('fs');var path=require(_0x83d2('0x7'));var rimraf=require(_0x83d2('0x8'));var config=require(_0x83d2('0x9'));var attributes=require(_0x83d2('0xa'));module[_0x83d2('0xb')]=function(_0x1a9502,_0xfb8aee){return _0x1a9502[_0x83d2('0xc')](_0x83d2('0xd'),attributes,{'tableName':_0x83d2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe613=['bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','lodash','../../config/logger','api','moment'];(function(_0x380d0b,_0x174cea){var _0x1c0a4e=function(_0x28dd25){while(--_0x28dd25){_0x380d0b['push'](_0x380d0b['shift']());}};_0x1c0a4e(++_0x174cea);}(_0xe613,0x128));var _0x3e61=function(_0x24ab81,_0x46ab16){_0x24ab81=_0x24ab81-0x0;var _0xb0dc26=_0xe613[_0x24ab81];return _0xb0dc26;};'use strict';var _=require(_0x3e61('0x0'));var util=require('util');var logger=require(_0x3e61('0x1'))(_0x3e61('0x2'));var moment=require(_0x3e61('0x3'));var BPromise=require(_0x3e61('0x4'));var rp=require(_0x3e61('0x5'));var fs=require('fs');var path=require(_0x3e61('0x6'));var rimraf=require(_0x3e61('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e61('0x8'));module[_0x3e61('0x9')]=function(_0x5cb627,_0x2cd559){return _0x5cb627[_0x3e61('0xa')](_0x3e61('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index a754c90..676e742 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 _0x3ba0=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ba0,0xab));var _0x03ba=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ba0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x03ba('0x0'));var util=require(_0x03ba('0x1'));var moment=require(_0x03ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x03ba('0x3'));var fs=require('fs');var Redis=require(_0x03ba('0x4'));var db=require(_0x03ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03ba('0x6'))('rpc');var config=require(_0x03ba('0x7'));var jayson=require(_0x03ba('0x8'));var client=jayson[_0x03ba('0x9')][_0x03ba('0xa')]({'port':0x232a});config[_0x03ba('0xb')]=_['defaults'](config[_0x03ba('0xb')],{'host':_0x03ba('0xc'),'port':0x18eb});var socket=require(_0x03ba('0xd'))(new Redis(config[_0x03ba('0xb')]));require(_0x03ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x498f2a,_0xeedc16,_0x119459){return new BPromise(function(_0x299a7a,_0x4e4d5e){return client[_0x03ba('0xf')](_0x498f2a,_0x119459)['then'](function(_0x33c6fb){logger['info'](_0x03ba('0x10'),_0xeedc16,_0x03ba('0x11'));logger[_0x03ba('0x12')](_0x03ba('0x13'),_0xeedc16,_0x03ba('0x11'),JSON[_0x03ba('0x14')](_0x33c6fb));if(_0x33c6fb[_0x03ba('0x15')]){if(_0x33c6fb[_0x03ba('0x15')][_0x03ba('0x16')]===0x1f4){logger[_0x03ba('0x15')]('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x33c6fb[_0x03ba('0x15')]['message']);return _0x4e4d5e(_0x33c6fb['error'][_0x03ba('0x17')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x33c6fb[_0x03ba('0x15')][_0x03ba('0x17')]);return _0x299a7a(_0x33c6fb['error'][_0x03ba('0x17')]);}else{logger[_0x03ba('0x18')]('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x03ba('0x11'));_0x299a7a(_0x33c6fb[_0x03ba('0x19')][_0x03ba('0x17')]);}})[_0x03ba('0x1a')](function(_0x1a0a7b){logger[_0x03ba('0x15')](_0x03ba('0x10'),_0xeedc16,_0x1a0a7b);_0x4e4d5e(_0x1a0a7b);});});} \ No newline at end of file +var _0xf550=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x4e1d9d,_0x492d58){var _0x5b702b=function(_0x29ce40){while(--_0x29ce40){_0x4e1d9d['push'](_0x4e1d9d['shift']());}};_0x5b702b(++_0x492d58);}(_0xf550,0x1f3));var _0x0f55=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xf550[_0x146a85];return _0x1b59bf;};'use strict';var _=require('lodash');var util=require(_0x0f55('0x0'));var moment=require(_0x0f55('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f55('0x2'));var fs=require('fs');var Redis=require(_0x0f55('0x3'));var db=require(_0x0f55('0x4'))['db'];var utils=require(_0x0f55('0x5'));var logger=require(_0x0f55('0x6'))(_0x0f55('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f55('0x8'));var client=jayson[_0x0f55('0x9')][_0x0f55('0xa')]({'port':0x232a});config['redis']=_[_0x0f55('0xb')](config[_0x0f55('0xc')],{'host':_0x0f55('0xd'),'port':0x18eb});var socket=require(_0x0f55('0xe'))(new Redis(config[_0x0f55('0xc')]));require('./dashboard.socket')[_0x0f55('0xf')](socket);function respondWithRpcPromise(_0x390dc4,_0x4d7d13,_0x1b1039){return new BPromise(function(_0x528ac1,_0x5bd1d9){return client[_0x0f55('0x10')](_0x390dc4,_0x1b1039)[_0x0f55('0x11')](function(_0xe523d4){logger[_0x0f55('0x12')](_0x0f55('0x13'),_0x4d7d13,_0x0f55('0x14'));logger[_0x0f55('0x15')](_0x0f55('0x16'),_0x4d7d13,'request\x20sent',JSON[_0x0f55('0x17')](_0xe523d4));if(_0xe523d4[_0x0f55('0x18')]){if(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x19')]===0x1f4){logger['error'](_0x0f55('0x13'),_0x4d7d13,_0xe523d4[_0x0f55('0x18')]['message']);return _0x5bd1d9(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);}logger[_0x0f55('0x18')](_0x0f55('0x13'),_0x4d7d13,_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);return _0x528ac1(_0xe523d4[_0x0f55('0x18')][_0x0f55('0x1a')]);}else{logger[_0x0f55('0x12')](_0x0f55('0x13'),_0x4d7d13,_0x0f55('0x14'));_0x528ac1(_0xe523d4[_0x0f55('0x1b')][_0x0f55('0x1a')]);}})[_0x0f55('0x1c')](function(_0x18cb19){logger['error'](_0x0f55('0x13'),_0x4d7d13,_0x18cb19);_0x5bd1d9(_0x18cb19);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4b9eac9..b4f673b 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 _0x7461=['register','length','dashboard:','./dashboard.events','save','remove','update','removeListener'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x7461,0xdb));var _0x1746=function(_0xec722a,_0x354472){_0xec722a=_0xec722a-0x0;var _0xbb0f9e=_0x7461[_0xec722a];return _0xbb0f9e;};'use strict';var DashboardEvents=require(_0x1746('0x0'));var events=[_0x1746('0x1'),_0x1746('0x2'),_0x1746('0x3')];function createListener(_0x2fc60c,_0x5b396e){return function(_0x4c93cb){_0x5b396e['emit'](_0x2fc60c,_0x4c93cb);};}function removeListener(_0x4aa336,_0x89a445){return function(){DashboardEvents[_0x1746('0x4')](_0x4aa336,_0x89a445);};}exports[_0x1746('0x5')]=function(_0x3c5416){for(var _0x2313d7=0x0,_0x165636=events[_0x1746('0x6')];_0x2313d7<_0x165636;_0x2313d7++){var _0x35946e=events[_0x2313d7];var _0x177aa8=createListener(_0x1746('0x7')+_0x35946e,_0x3c5416);DashboardEvents['on'](_0x35946e,_0x177aa8);}}; \ No newline at end of file +var _0xe496=['register','length','dashboard:','./dashboard.events','update','emit','removeListener'];(function(_0x3ea67b,_0x164dc1){var _0x20da49=function(_0x1a0bf0){while(--_0x1a0bf0){_0x3ea67b['push'](_0x3ea67b['shift']());}};_0x20da49(++_0x164dc1);}(_0xe496,0x8f));var _0x6e49=function(_0x2f9db9,_0x492fba){_0x2f9db9=_0x2f9db9-0x0;var _0x1fac99=_0xe496[_0x2f9db9];return _0x1fac99;};'use strict';var DashboardEvents=require(_0x6e49('0x0'));var events=['save','remove',_0x6e49('0x1')];function createListener(_0x1610f8,_0x3d79f6){return function(_0x1d9c74){_0x3d79f6[_0x6e49('0x2')](_0x1610f8,_0x1d9c74);};}function removeListener(_0x19ee41,_0x53fa82){return function(){DashboardEvents[_0x6e49('0x3')](_0x19ee41,_0x53fa82);};}exports[_0x6e49('0x4')]=function(_0x5d5765){for(var _0x570c94=0x0,_0x301483=events[_0x6e49('0x5')];_0x570c94<_0x301483;_0x570c94++){var _0x2c6581=events[_0x570c94];var _0x4443eb=createListener(_0x6e49('0x6')+_0x2c6581,_0x5d5765);DashboardEvents['on'](_0x2c6581,_0x4443eb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1707c67..f245ff1 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 _0xeeea=['getItems','create','/:id/clone','clone','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items'];(function(_0x464416,_0x5e0681){var _0x10f38b=function(_0x543ea6){while(--_0x543ea6){_0x464416['push'](_0x464416['shift']());}};_0x10f38b(++_0x5e0681);}(_0xeeea,0xac));var _0xaeee=function(_0x30c18f,_0x3751e4){_0x30c18f=_0x30c18f-0x0;var _0x52ba0e=_0xeeea[_0x30c18f];return _0x52ba0e;};'use strict';var multer=require(_0xaeee('0x0'));var util=require(_0xaeee('0x1'));var path=require(_0xaeee('0x2'));var timeout=require(_0xaeee('0x3'));var express=require(_0xaeee('0x4'));var router=express[_0xaeee('0x5')]();var fs_extra=require(_0xaeee('0x6'));var auth=require(_0xaeee('0x7'));var interaction=require(_0xaeee('0x8'));var config=require(_0xaeee('0x9'));var controller=require(_0xaeee('0xa'));router[_0xaeee('0xb')]('/',auth[_0xaeee('0xc')](),controller[_0xaeee('0xd')]);router['get'](_0xaeee('0xe'),auth[_0xaeee('0xc')](),controller[_0xaeee('0xf')]);router[_0xaeee('0xb')](_0xaeee('0x10'),auth[_0xaeee('0xc')](),controller[_0xaeee('0x11')]);router['post']('/',auth[_0xaeee('0xc')](),controller[_0xaeee('0x12')]);router['post'](_0xaeee('0x13'),auth[_0xaeee('0xc')](),controller[_0xaeee('0x14')]);router[_0xaeee('0x15')](_0xaeee('0x10'),auth[_0xaeee('0xc')](),controller['addItem']);router[_0xaeee('0x16')]('/:id',auth[_0xaeee('0xc')](),controller[_0xaeee('0x17')]);router[_0xaeee('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xaeee('0x19')]);module[_0xaeee('0x1a')]=router; \ No newline at end of file +var _0x50dd=['clone','/:id/items','addItem','put','update','destroy','multer','connect-timeout','Router','../../components/auth/service','./dashboard.controller','get','index','/:id','isAuthenticated','create','post','/:id/clone'];(function(_0x20c20f,_0x1a5356){var _0x351462=function(_0x4b197f){while(--_0x4b197f){_0x20c20f['push'](_0x20c20f['shift']());}};_0x351462(++_0x1a5356);}(_0x50dd,0x102));var _0xd50d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50dd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd50d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd50d('0x1'));var express=require('express');var router=express[_0xd50d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd50d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd50d('0x4'));router[_0xd50d('0x5')]('/',auth['isAuthenticated'](),controller[_0xd50d('0x6')]);router[_0xd50d('0x5')](_0xd50d('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xd50d('0x5')]('/:id/items',auth['isAuthenticated'](),controller['getItems']);router['post']('/',auth[_0xd50d('0x8')](),controller[_0xd50d('0x9')]);router[_0xd50d('0xa')](_0xd50d('0xb'),auth['isAuthenticated'](),controller[_0xd50d('0xc')]);router[_0xd50d('0xa')](_0xd50d('0xd'),auth['isAuthenticated'](),controller[_0xd50d('0xe')]);router[_0xd50d('0xf')](_0xd50d('0x7'),auth[_0xd50d('0x8')](),controller[_0xd50d('0x10')]);router['delete'](_0xd50d('0x7'),auth['isAuthenticated'](),controller[_0xd50d('0x11')]);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 1f17101..39afac0 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 _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xabce[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0xba34,0x119));var _0x4ba3=function(_0x4b2464,_0x1a6302){_0x4b2464=_0x4b2464-0x0;var _0x2b3fdc=_0xba34[_0x4b2464];return _0x2b3fdc;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index d4d80d2..c5f33c3 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 _0x095b=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart'];(function(_0x52d8dc,_0x41e3d9){var _0x2fa6bd=function(_0x4c8f14){while(--_0x4c8f14){_0x52d8dc['push'](_0x52d8dc['shift']());}};_0x2fa6bd(++_0x41e3d9);}(_0x095b,0x6e));var _0xb095=function(_0x28bdd6,_0x3794d1){_0x28bdd6=_0x28bdd6-0x0;var _0x45919b=_0x095b[_0x28bdd6];return _0x45919b;};'use strict';var emlformat=require(_0xb095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb095('0x1'));var jsonpatch=require(_0xb095('0x2'));var rp=require(_0xb095('0x3'));var moment=require(_0xb095('0x4'));var BPromise=require(_0xb095('0x5'));var Mustache=require('mustache');var util=require(_0xb095('0x6'));var path=require(_0xb095('0x7'));var sox=require(_0xb095('0x8'));var csv=require(_0xb095('0x9'));var ejs=require(_0xb095('0xa'));var fs=require('fs');var fs_extra=require(_0xb095('0xb'));var _=require(_0xb095('0xc'));var squel=require(_0xb095('0xd'));var crypto=require(_0xb095('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb095('0xf'));var toCsv=require(_0xb095('0x9'));var querystring=require(_0xb095('0x10'));var Papa=require(_0xb095('0x11'));var Redis=require(_0xb095('0x12'));var authService=require(_0xb095('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb095('0x14'));var logger=require(_0xb095('0x15'))('api');var utils=require(_0xb095('0x16'));var config=require(_0xb095('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb095('0x18'))['db'];config['redis']=_[_0xb095('0x19')](config[_0xb095('0x1a')],{'host':_0xb095('0x1b'),'port':0x18eb});var socket=require(_0xb095('0x1c'))(new Redis(config[_0xb095('0x1a')]));require(_0xb095('0x1d'))[_0xb095('0x1e')](socket);function respondWithStatusCode(_0x4afb4d,_0x2d6e3b){_0x2d6e3b=_0x2d6e3b||0xcc;return function(_0x3a77f1){if(_0x3a77f1){return _0x4afb4d[_0xb095('0x1f')](_0x2d6e3b);}return _0x4afb4d[_0xb095('0x20')](_0x2d6e3b)[_0xb095('0x21')]();};}function respondWithResult(_0x2568f8,_0x5809b8){_0x5809b8=_0x5809b8||0xc8;return function(_0x52b48a){if(_0x52b48a){return _0x2568f8['status'](_0x5809b8)[_0xb095('0x22')](_0x52b48a);}};}function respondWithFilteredResult(_0x2c4e86,_0x1c509b){return function(_0x54d06){if(_0x54d06){var _0x44039f=typeof _0x1c509b[_0xb095('0x23')]==='undefined'&&typeof _0x1c509b[_0xb095('0x24')]===_0xb095('0x25');var _0x27e1d0=_0x54d06[_0xb095('0x26')];var _0x5c2674=_0x44039f?0x0:_0x1c509b[_0xb095('0x23')];var _0x212c53=_0x44039f?_0x54d06[_0xb095('0x26')]:_0x1c509b[_0xb095('0x23')]+_0x1c509b[_0xb095('0x24')];var _0x2af120;if(_0x212c53>=_0x27e1d0){_0x212c53=_0x27e1d0;_0x2af120=0xc8;}else{_0x2af120=0xce;}_0x2c4e86['status'](_0x2af120);return _0x2c4e86[_0xb095('0x27')]('Content-Range',_0x5c2674+'-'+_0x212c53+'/'+_0x27e1d0)['json'](_0x54d06);}return null;};}function patchUpdates(_0x4ef4a9){return function(_0x1dc3cd){try{jsonpatch['apply'](_0x1dc3cd,_0x4ef4a9,!![]);}catch(_0x39f9de){return BPromise[_0xb095('0x28')](_0x39f9de);}return _0x1dc3cd[_0xb095('0x29')]();};}function saveUpdates(_0x32d1e6,_0x4913f6){return function(_0x5bfe24){if(_0x5bfe24){return _0x5bfe24[_0xb095('0x2a')](_0x32d1e6)['then'](function(_0x3c6488){return _0x3c6488;});}return null;};}function removeEntity(_0x1bbe29,_0x1f1206){return function(_0x5a35db){if(_0x5a35db){return _0x5a35db[_0xb095('0x2b')]()[_0xb095('0x2c')](function(){_0x1bbe29[_0xb095('0x20')](0xcc)[_0xb095('0x21')]();});}};}function handleEntityNotFound(_0x2dcb77,_0xea61bd){return function(_0x183815){if(!_0x183815){_0x2dcb77[_0xb095('0x1f')](0x194);}return _0x183815;};}function handleError(_0x5ed6f7,_0x55233e){_0x55233e=_0x55233e||0x1f4;return function(_0xd6426c){logger[_0xb095('0x2d')](_0xd6426c['stack']);if(_0xd6426c[_0xb095('0x2e')]){delete _0xd6426c[_0xb095('0x2e')];}_0x5ed6f7[_0xb095('0x20')](_0x55233e)[_0xb095('0x2f')](_0xd6426c);};}exports[_0xb095('0x30')]=function(_0x2a06f5,_0xafd194){var _0x4d5a6d={'raw':![],'where':{'id':_0x2a06f5[_0xb095('0x31')]['id']}},_0x14760d={};_0x14760d[_0xb095('0x32')]=_[_0xb095('0x33')](db[_0xb095('0x34')][_0xb095('0x35')]);_0x14760d[_0xb095('0x36')]=_['keys'](_0x2a06f5['query']);_0x14760d['filters']=_['intersection'](_0x14760d['model'],_0x14760d[_0xb095('0x36')]);_0x4d5a6d[_0xb095('0x37')]=_[_0xb095('0x38')](_0x14760d[_0xb095('0x32')],qs[_0xb095('0x39')](_0x2a06f5[_0xb095('0x36')][_0xb095('0x39')]));_0x4d5a6d[_0xb095('0x37')]=_0x4d5a6d[_0xb095('0x37')][_0xb095('0x3a')]?_0x4d5a6d[_0xb095('0x37')]:_0x14760d['model'];if(_0x2a06f5[_0xb095('0x36')][_0xb095('0x3b')]){_0x4d5a6d[_0xb095('0x3c')]=[{'all':!![]}];}_0x4d5a6d=_['merge']({},_0x4d5a6d,_0x2a06f5['options']);return db[_0xb095('0x34')][_0xb095('0x3d')](_0x4d5a6d)[_0xb095('0x2c')](handleEntityNotFound(_0xafd194,null))[_0xb095('0x2c')](respondWithResult(_0xafd194,null))['catch'](handleError(_0xafd194,null));};exports['destroy']=function(_0x2e6214,_0x574994){return db[_0xb095('0x34')][_0xb095('0x3d')]({'where':{'id':_0x2e6214['params']['id']}})[_0xb095('0x2c')](handleEntityNotFound(_0x574994,null))[_0xb095('0x2c')](removeEntity(_0x574994,null))[_0xb095('0x3e')](handleError(_0x574994,null));};function widgetAttributes(_0x5d6bfa){try{switch(_0x5d6bfa[_0xb095('0x3f')]){case _0xb095('0x40'):return[{'name':'attrUrl','value':_0x5d6bfa[_0xb095('0x41')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x44')}];case _0xb095('0x45'):return[{'name':_0xb095('0x46'),'value':_0x5d6bfa['attrPath']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||''}];case _0xb095('0x47'):return[{'name':_0xb095('0x48'),'value':_0x5d6bfa[_0xb095('0x48')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x49')},{'name':_0xb095('0x4a'),'value':_0x5d6bfa[_0xb095('0x4a')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x1]?_0x5d6bfa['attrs'][0x1][_0xb095('0x43')]:undefined)||_0xb095('0x4b')},{'name':'attrFontSize','value':_0x5d6bfa[_0xb095('0x4c')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa[_0xb095('0x42')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb095('0x4d'),'value':_0x5d6bfa[_0xb095('0x4d')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x0]?_0x5d6bfa['attrs'][0x0]['value']:undefined)||_0xb095('0x4e')},{'name':'attrVoiceQueues','value':_0x5d6bfa[_0xb095('0x4f')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa['attrs'][0x1][_0xb095('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d6bfa['attrFontSize']||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa['attrs'][0x2][_0xb095('0x43')]:undefined)||0x14},{'name':'attrChannel','value':_0x5d6bfa[_0xb095('0x50')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x3]?_0x5d6bfa[_0xb095('0x42')][0x3][_0xb095('0x43')]:undefined)||'voice'},{'name':_0xb095('0x51'),'value':_0x5d6bfa[_0xb095('0x51')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x4]?_0x5d6bfa[_0xb095('0x42')][0x4]['value']:undefined)||''},{'name':_0xb095('0x52'),'value':_0x5d6bfa[_0xb095('0x52')]||(_0x5d6bfa['attrs']&&_0x5d6bfa['attrs'][0x5]?_0x5d6bfa[_0xb095('0x42')][0x5]['value']:undefined)||''},{'name':_0xb095('0x53'),'value':_0x5d6bfa[_0xb095('0x53')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x6]?_0x5d6bfa[_0xb095('0x42')][0x6][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x54'),'value':_0x5d6bfa[_0xb095('0x54')]||(_0x5d6bfa['attrs']&&_0x5d6bfa['attrs'][0x7]?_0x5d6bfa[_0xb095('0x42')][0x7][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x55'),'value':_0x5d6bfa['attrWhatsappAccounts']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x8]?_0x5d6bfa[_0xb095('0x42')][0x8][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x56'),'value':_0x5d6bfa[_0xb095('0x56')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x9]?_0x5d6bfa[_0xb095('0x42')][0x9][_0xb095('0x43')]:undefined)||''}];case _0xb095('0x57'):case _0xb095('0x58'):return[{'name':_0xb095('0x59'),'value':_0x5d6bfa['attrSerie1']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x4e')},{'name':_0xb095('0x5a'),'value':_0x5d6bfa[_0xb095('0x5a')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa[_0xb095('0x42')][0x1][_0xb095('0x43')]:undefined)||null},{'name':_0xb095('0x5b'),'value':_0x5d6bfa[_0xb095('0x5b')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa[_0xb095('0x42')][0x2]['value']:undefined)||null},{'name':_0xb095('0x4f'),'value':_0x5d6bfa[_0xb095('0x4f')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x3]?_0x5d6bfa['attrs'][0x3][_0xb095('0x43')]:undefined)||[]},{'name':_0xb095('0x50'),'value':_0x5d6bfa[_0xb095('0x50')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x4]?_0x5d6bfa[_0xb095('0x42')][0x4][_0xb095('0x43')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5d6bfa[_0xb095('0x51')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x5]?_0x5d6bfa['attrs'][0x5][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x52'),'value':_0x5d6bfa[_0xb095('0x52')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x6]?_0x5d6bfa[_0xb095('0x42')][0x6][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x53'),'value':_0x5d6bfa['attrSmsAccounts']||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x7]?_0x5d6bfa['attrs'][0x7][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x54'),'value':_0x5d6bfa[_0xb095('0x54')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x8]?_0x5d6bfa['attrs'][0x8][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x55'),'value':_0x5d6bfa[_0xb095('0x55')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x9]?_0x5d6bfa['attrs'][0x9][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x56'),'value':_0x5d6bfa[_0xb095('0x56')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0xa]?_0x5d6bfa[_0xb095('0x42')][0xa]['value']:undefined)||''}];case _0xb095('0x5c'):return[{'name':_0xb095('0x5d'),'type':_0x5d6bfa[_0xb095('0x5e')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0]['type']:undefined)||null,'value':_0x5d6bfa[_0xb095('0x5d')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0]['value']:undefined)||null},{'name':_0xb095('0x5f'),'value':_0x5d6bfa[_0xb095('0x5f')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa[_0xb095('0x42')][0x1][_0xb095('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x3ba018){logger[_0xb095('0x2d')]('widgetAttributes:\x20%s',JSON[_0xb095('0x60')](_0x3ba018));return[];}}exports[_0xb095('0x61')]=function(_0x7a67f3,_0x39e26b){if(_0x7a67f3['body']){_0x7a67f3['body']['attrs']=widgetAttributes(_0x7a67f3[_0xb095('0x62')]);}return db['DashboardItem']['create'](_0x7a67f3[_0xb095('0x62')],{})['then'](respondWithResult(_0x39e26b,0xc9))[_0xb095('0x3e')](handleError(_0x39e26b,null));};exports[_0xb095('0x2a')]=function(_0x2c81b4,_0x43dbbe){if(_0x2c81b4[_0xb095('0x62')]['id']){delete _0x2c81b4[_0xb095('0x62')]['id'];}_0x2c81b4['body'][_0xb095('0x42')]=widgetAttributes(_0x2c81b4['body']);return db['DashboardItem'][_0xb095('0x3d')]({'where':{'id':_0x2c81b4['params']['id']}})[_0xb095('0x2c')](handleEntityNotFound(_0x43dbbe,null))[_0xb095('0x2c')](saveUpdates(_0x2c81b4['body'],null))[_0xb095('0x2c')](respondWithResult(_0x43dbbe,null))[_0xb095('0x3e')](handleError(_0x43dbbe,null));}; \ No newline at end of file +var _0x0f9f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','find','catch','destroy','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','reportType','type','attrRefresh','widgetAttributes:\x20%s','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x30aff0,_0x2cd94c){var _0x28b901=function(_0x52acc3){while(--_0x52acc3){_0x30aff0['push'](_0x30aff0['shift']());}};_0x28b901(++_0x2cd94c);}(_0x0f9f,0xae));var _0xf0f9=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x0f9f[_0x42d1f8];return _0x40d234;};'use strict';var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require(_0xf0f9('0x2'));var jsonpatch=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var moment=require(_0xf0f9('0x5'));var BPromise=require(_0xf0f9('0x6'));var Mustache=require(_0xf0f9('0x7'));var util=require(_0xf0f9('0x8'));var path=require(_0xf0f9('0x9'));var sox=require(_0xf0f9('0xa'));var csv=require('to-csv');var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xc'));var _=require('lodash');var squel=require(_0xf0f9('0xd'));var crypto=require(_0xf0f9('0xe'));var jsforce=require(_0xf0f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x10'));var querystring=require(_0xf0f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0f9('0x12'));var authService=require(_0xf0f9('0x13'));var qs=require(_0xf0f9('0x14'));var as=require(_0xf0f9('0x15'));var hardwareService=require(_0xf0f9('0x16'));var logger=require(_0xf0f9('0x17'))(_0xf0f9('0x18'));var utils=require(_0xf0f9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f9('0x1a'));var db=require(_0xf0f9('0x1b'))['db'];config[_0xf0f9('0x1c')]=_[_0xf0f9('0x1d')](config['redis'],{'host':_0xf0f9('0x1e'),'port':0x18eb});var socket=require(_0xf0f9('0x1f'))(new Redis(config['redis']));require(_0xf0f9('0x20'))['register'](socket);function respondWithStatusCode(_0x538864,_0x2c832a){_0x2c832a=_0x2c832a||0xcc;return function(_0x536143){if(_0x536143){return _0x538864[_0xf0f9('0x21')](_0x2c832a);}return _0x538864['status'](_0x2c832a)[_0xf0f9('0x22')]();};}function respondWithResult(_0x336483,_0x1a3a82){_0x1a3a82=_0x1a3a82||0xc8;return function(_0xf4d805){if(_0xf4d805){return _0x336483[_0xf0f9('0x23')](_0x1a3a82)[_0xf0f9('0x24')](_0xf4d805);}};}function respondWithFilteredResult(_0x10dae6,_0x50d462){return function(_0x44d248){if(_0x44d248){var _0x26b5be=typeof _0x50d462[_0xf0f9('0x25')]===_0xf0f9('0x26')&&typeof _0x50d462[_0xf0f9('0x27')]===_0xf0f9('0x26');var _0x1765ad=_0x44d248[_0xf0f9('0x28')];var _0x5ebbe9=_0x26b5be?0x0:_0x50d462[_0xf0f9('0x25')];var _0x5c2ce0=_0x26b5be?_0x44d248[_0xf0f9('0x28')]:_0x50d462['offset']+_0x50d462[_0xf0f9('0x27')];var _0x1d5965;if(_0x5c2ce0>=_0x1765ad){_0x5c2ce0=_0x1765ad;_0x1d5965=0xc8;}else{_0x1d5965=0xce;}_0x10dae6[_0xf0f9('0x23')](_0x1d5965);return _0x10dae6[_0xf0f9('0x29')](_0xf0f9('0x2a'),_0x5ebbe9+'-'+_0x5c2ce0+'/'+_0x1765ad)[_0xf0f9('0x24')](_0x44d248);}return null;};}function patchUpdates(_0x49bddc){return function(_0x39733c){try{jsonpatch['apply'](_0x39733c,_0x49bddc,!![]);}catch(_0x2cb8f8){return BPromise[_0xf0f9('0x2b')](_0x2cb8f8);}return _0x39733c['save']();};}function saveUpdates(_0x217a15,_0x20b5dc){return function(_0x552f70){if(_0x552f70){return _0x552f70[_0xf0f9('0x2c')](_0x217a15)[_0xf0f9('0x2d')](function(_0xa0b46e){return _0xa0b46e;});}return null;};}function removeEntity(_0x27defc,_0x3ce34a){return function(_0x2c8a79){if(_0x2c8a79){return _0x2c8a79['destroy']()[_0xf0f9('0x2d')](function(){_0x27defc['status'](0xcc)[_0xf0f9('0x22')]();});}};}function handleEntityNotFound(_0x2e3fbc,_0x2e3c96){return function(_0x14e40f){if(!_0x14e40f){_0x2e3fbc['sendStatus'](0x194);}return _0x14e40f;};}function handleError(_0x100543,_0x423d89){_0x423d89=_0x423d89||0x1f4;return function(_0x477eb0){logger['error'](_0x477eb0[_0xf0f9('0x2e')]);if(_0x477eb0[_0xf0f9('0x2f')]){delete _0x477eb0['name'];}_0x100543[_0xf0f9('0x23')](_0x423d89)['send'](_0x477eb0);};}exports[_0xf0f9('0x30')]=function(_0xe6cc2d,_0x280681){var _0x32003e={'raw':![],'where':{'id':_0xe6cc2d[_0xf0f9('0x31')]['id']}},_0x1f0c1f={};_0x1f0c1f[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](db[_0xf0f9('0x34')][_0xf0f9('0x35')]);_0x1f0c1f['query']=_[_0xf0f9('0x33')](_0xe6cc2d[_0xf0f9('0x36')]);_0x1f0c1f['filters']=_['intersection'](_0x1f0c1f[_0xf0f9('0x32')],_0x1f0c1f[_0xf0f9('0x36')]);_0x32003e[_0xf0f9('0x37')]=_[_0xf0f9('0x38')](_0x1f0c1f[_0xf0f9('0x32')],qs[_0xf0f9('0x39')](_0xe6cc2d[_0xf0f9('0x36')]['fields']));_0x32003e[_0xf0f9('0x37')]=_0x32003e['attributes'][_0xf0f9('0x3a')]?_0x32003e[_0xf0f9('0x37')]:_0x1f0c1f[_0xf0f9('0x32')];if(_0xe6cc2d['query'][_0xf0f9('0x3b')]){_0x32003e['include']=[{'all':!![]}];}_0x32003e=_[_0xf0f9('0x3c')]({},_0x32003e,_0xe6cc2d['options']);return db['DashboardItem'][_0xf0f9('0x3d')](_0x32003e)[_0xf0f9('0x2d')](handleEntityNotFound(_0x280681,null))[_0xf0f9('0x2d')](respondWithResult(_0x280681,null))[_0xf0f9('0x3e')](handleError(_0x280681,null));};exports[_0xf0f9('0x3f')]=function(_0x15901a,_0x5c1fcc){return db['DashboardItem'][_0xf0f9('0x3d')]({'where':{'id':_0x15901a[_0xf0f9('0x31')]['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x5c1fcc,null))['then'](removeEntity(_0x5c1fcc,null))['catch'](handleError(_0x5c1fcc,null));};function widgetAttributes(_0x221cd0){try{switch(_0x221cd0['type']){case _0xf0f9('0x40'):return[{'name':_0xf0f9('0x41'),'value':_0x221cd0[_0xf0f9('0x41')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0][_0xf0f9('0x43')]:undefined)||_0xf0f9('0x44')}];case _0xf0f9('0x45'):return[{'name':'attrPath','value':_0x221cd0['attrPath']||(_0x221cd0['attrs']&&_0x221cd0[_0xf0f9('0x42')][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0][_0xf0f9('0x43')]:undefined)||''}];case _0xf0f9('0x46'):return[{'name':_0xf0f9('0x47'),'value':_0x221cd0[_0xf0f9('0x47')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0][_0xf0f9('0x43')]:undefined)||_0xf0f9('0x48')},{'name':_0xf0f9('0x49'),'value':_0x221cd0[_0xf0f9('0x49')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x1]?_0x221cd0[_0xf0f9('0x42')][0x1]['value']:undefined)||_0xf0f9('0x4a')},{'name':_0xf0f9('0x4b'),'value':_0x221cd0[_0xf0f9('0x4b')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x2]?_0x221cd0['attrs'][0x2][_0xf0f9('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0xf0f9('0x4c'),'value':_0x221cd0[_0xf0f9('0x4c')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0][_0xf0f9('0x43')]:undefined)||'total'},{'name':_0xf0f9('0x4d'),'value':_0x221cd0[_0xf0f9('0x4d')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x1]?_0x221cd0[_0xf0f9('0x42')][0x1]['value']:undefined)||[]},{'name':_0xf0f9('0x4b'),'value':_0x221cd0['attrFontSize']||(_0x221cd0['attrs']&&_0x221cd0['attrs'][0x2]?_0x221cd0['attrs'][0x2][_0xf0f9('0x43')]:undefined)||0x14},{'name':'attrChannel','value':_0x221cd0[_0xf0f9('0x4e')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x3]?_0x221cd0[_0xf0f9('0x42')][0x3][_0xf0f9('0x43')]:undefined)||_0xf0f9('0x4f')},{'name':_0xf0f9('0x50'),'value':_0x221cd0[_0xf0f9('0x50')]||(_0x221cd0['attrs']&&_0x221cd0[_0xf0f9('0x42')][0x4]?_0x221cd0[_0xf0f9('0x42')][0x4][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x51'),'value':_0x221cd0['attrFaxAccounts']||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x5]?_0x221cd0[_0xf0f9('0x42')][0x5][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x52'),'value':_0x221cd0[_0xf0f9('0x52')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x6]?_0x221cd0[_0xf0f9('0x42')][0x6][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x53'),'value':_0x221cd0[_0xf0f9('0x53')]||(_0x221cd0['attrs']&&_0x221cd0[_0xf0f9('0x42')][0x7]?_0x221cd0[_0xf0f9('0x42')][0x7][_0xf0f9('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x221cd0[_0xf0f9('0x54')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x8]?_0x221cd0[_0xf0f9('0x42')][0x8][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x55'),'value':_0x221cd0[_0xf0f9('0x55')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x9]?_0x221cd0[_0xf0f9('0x42')][0x9][_0xf0f9('0x43')]:undefined)||''}];case'multibar-chart':case _0xf0f9('0x56'):return[{'name':_0xf0f9('0x57'),'value':_0x221cd0[_0xf0f9('0x57')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0][_0xf0f9('0x43')]:undefined)||_0xf0f9('0x58')},{'name':'attrSerie2','value':_0x221cd0[_0xf0f9('0x59')]||(_0x221cd0['attrs']&&_0x221cd0[_0xf0f9('0x42')][0x1]?_0x221cd0[_0xf0f9('0x42')][0x1][_0xf0f9('0x43')]:undefined)||null},{'name':_0xf0f9('0x5a'),'value':_0x221cd0[_0xf0f9('0x5a')]||(_0x221cd0['attrs']&&_0x221cd0[_0xf0f9('0x42')][0x2]?_0x221cd0[_0xf0f9('0x42')][0x2][_0xf0f9('0x43')]:undefined)||null},{'name':_0xf0f9('0x4d'),'value':_0x221cd0[_0xf0f9('0x4d')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x3]?_0x221cd0[_0xf0f9('0x42')][0x3][_0xf0f9('0x43')]:undefined)||[]},{'name':_0xf0f9('0x4e'),'value':_0x221cd0['attrChannel']||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x4]?_0x221cd0[_0xf0f9('0x42')][0x4][_0xf0f9('0x43')]:undefined)||_0xf0f9('0x4f')},{'name':'attrEmailAccounts','value':_0x221cd0[_0xf0f9('0x50')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x5]?_0x221cd0[_0xf0f9('0x42')][0x5][_0xf0f9('0x43')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x221cd0[_0xf0f9('0x51')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x6]?_0x221cd0[_0xf0f9('0x42')][0x6]['value']:undefined)||''},{'name':_0xf0f9('0x52'),'value':_0x221cd0[_0xf0f9('0x52')]||(_0x221cd0['attrs']&&_0x221cd0['attrs'][0x7]?_0x221cd0[_0xf0f9('0x42')][0x7][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x53'),'value':_0x221cd0['attrOpenchannelAccounts']||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x8]?_0x221cd0[_0xf0f9('0x42')][0x8][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x54'),'value':_0x221cd0[_0xf0f9('0x54')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x9]?_0x221cd0[_0xf0f9('0x42')][0x9][_0xf0f9('0x43')]:undefined)||''},{'name':_0xf0f9('0x55'),'value':_0x221cd0[_0xf0f9('0x55')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0xa]?_0x221cd0[_0xf0f9('0x42')][0xa][_0xf0f9('0x43')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x221cd0[_0xf0f9('0x5b')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0['attrs'][0x0]?_0x221cd0['attrs'][0x0][_0xf0f9('0x5c')]:undefined)||null,'value':_0x221cd0['attrReport']||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x0]?_0x221cd0[_0xf0f9('0x42')][0x0]['value']:undefined)||null},{'name':_0xf0f9('0x5d'),'value':_0x221cd0[_0xf0f9('0x5d')]||(_0x221cd0[_0xf0f9('0x42')]&&_0x221cd0[_0xf0f9('0x42')][0x1]?_0x221cd0[_0xf0f9('0x42')][0x1][_0xf0f9('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x3700e0){logger['error'](_0xf0f9('0x5e'),JSON['stringify'](_0x3700e0));return[];}}exports['create']=function(_0x26bfc1,_0x3e3159){if(_0x26bfc1[_0xf0f9('0x5f')]){_0x26bfc1['body'][_0xf0f9('0x42')]=widgetAttributes(_0x26bfc1['body']);}return db[_0xf0f9('0x34')][_0xf0f9('0x60')](_0x26bfc1[_0xf0f9('0x5f')],{})[_0xf0f9('0x2d')](respondWithResult(_0x3e3159,0xc9))['catch'](handleError(_0x3e3159,null));};exports[_0xf0f9('0x2c')]=function(_0x526298,_0x2c4f24){if(_0x526298[_0xf0f9('0x5f')]['id']){delete _0x526298[_0xf0f9('0x5f')]['id'];}_0x526298[_0xf0f9('0x5f')][_0xf0f9('0x42')]=widgetAttributes(_0x526298[_0xf0f9('0x5f')]);return db[_0xf0f9('0x34')]['find']({'where':{'id':_0x526298['params']['id']}})[_0xf0f9('0x2d')](handleEntityNotFound(_0x2c4f24,null))[_0xf0f9('0x2d')](saveUpdates(_0x526298['body'],null))['then'](respondWithResult(_0x2c4f24,null))['catch'](handleError(_0x2c4f24,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 17e6834..328ed7a 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 _0x0037=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x15fa0c,_0x21eb62){var _0x3642d1=function(_0x3d8d8e){while(--_0x3d8d8e){_0x15fa0c['push'](_0x15fa0c['shift']());}};_0x3642d1(++_0x21eb62);}(_0x0037,0x127));var _0x7003=function(_0x2dca92,_0x352d9c){_0x2dca92=_0x2dca92-0x0;var _0x2503ab=_0x0037[_0x2dca92];return _0x2503ab;};'use strict';var EventEmitter=require(_0x7003('0x0'));var DashboardItem=require(_0x7003('0x1'))['db'][_0x7003('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7003('0x3')](0x0);var events={'afterCreate':_0x7003('0x4'),'afterUpdate':_0x7003('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5384a6){return function(_0x402081,_0x44f911,_0x35a820){DashboardItemEvents[_0x7003('0x6')](_0x5384a6+':'+_0x402081['id'],_0x402081);DashboardItemEvents[_0x7003('0x6')](_0x5384a6,_0x402081);_0x35a820(null);};}for(var e in events){if(events[_0x7003('0x7')](e)){var event=events[e];DashboardItem[_0x7003('0x8')](e,emitEvent(event));}}module[_0x7003('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x6a48=['../../mysqldb','DashboardItem','setMaxListeners','save','emit','exports','events'];(function(_0x41ce6f,_0x535964){var _0x807aa1=function(_0x123bfa){while(--_0x123bfa){_0x41ce6f['push'](_0x41ce6f['shift']());}};_0x807aa1(++_0x535964);}(_0x6a48,0x19c));var _0x86a4=function(_0x22df1f,_0x279f45){_0x22df1f=_0x22df1f-0x0;var _0xf47d13=_0x6a48[_0x22df1f];return _0xf47d13;};'use strict';var EventEmitter=require(_0x86a4('0x0'));var DashboardItem=require(_0x86a4('0x1'))['db'][_0x86a4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x86a4('0x3')](0x0);var events={'afterCreate':_0x86a4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18f7b1){return function(_0x4480b7,_0x48120f,_0x5ecd07){DashboardItemEvents[_0x86a4('0x5')](_0x18f7b1+':'+_0x4480b7['id'],_0x4480b7);DashboardItemEvents[_0x86a4('0x5')](_0x18f7b1,_0x4480b7);_0x5ecd07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x86a4('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 709bf26..83199ef 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 _0x252b=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x5c9600,_0x710564){var _0x2eec81=function(_0x264230){while(--_0x264230){_0x5c9600['push'](_0x5c9600['shift']());}};_0x2eec81(++_0x710564);}(_0x252b,0x117));var _0xb252=function(_0x27dd27,_0x397f9e){_0x27dd27=_0x27dd27-0x0;var _0x116fed=_0x252b[_0x27dd27];return _0x116fed;};'use strict';var _=require(_0xb252('0x0'));var util=require(_0xb252('0x1'));var logger=require(_0xb252('0x2'))('api');var moment=require(_0xb252('0x3'));var BPromise=require(_0xb252('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb252('0x5'));var rimraf=require(_0xb252('0x6'));var config=require(_0xb252('0x7'));var attributes=require(_0xb252('0x8'));module['exports']=function(_0x5e1afb,_0x292101){return _0x5e1afb[_0xb252('0x9')](_0xb252('0xa'),attributes,{'tableName':_0xb252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x090e=['moment','bluebird','request-promise','../../config/environment','exports','define','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x459b06,_0x4cf62e){var _0x3df869=function(_0x379885){while(--_0x379885){_0x459b06['push'](_0x459b06['shift']());}};_0x3df869(++_0x4cf62e);}(_0x090e,0x104));var _0xe090=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x090e[_0x5b13c3];return _0x3d6780;};'use strict';var _=require(_0xe090('0x0'));var util=require(_0xe090('0x1'));var logger=require(_0xe090('0x2'))(_0xe090('0x3'));var moment=require(_0xe090('0x4'));var BPromise=require(_0xe090('0x5'));var rp=require(_0xe090('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe090('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xe090('0x8')]=function(_0x4bf57d,_0x17b4fc){return _0x4bf57d[_0xe090('0x9')](_0xe090('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index d7a3f81..7b97bc9 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 _0x466e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x466e,0x121));var _0xe466=function(_0x208e96,_0x3d52c6){_0x208e96=_0x208e96-0x0;var _0x42344f=_0x466e[_0x208e96];return _0x42344f;};'use strict';var _=require(_0xe466('0x0'));var util=require(_0xe466('0x1'));var moment=require(_0xe466('0x2'));var BPromise=require(_0xe466('0x3'));var rs=require(_0xe466('0x4'));var fs=require('fs');var Redis=require(_0xe466('0x5'));var db=require(_0xe466('0x6'))['db'];var utils=require(_0xe466('0x7'));var logger=require(_0xe466('0x8'))(_0xe466('0x9'));var config=require(_0xe466('0xa'));var jayson=require(_0xe466('0xb'));var client=jayson[_0xe466('0xc')][_0xe466('0xd')]({'port':0x232a});config[_0xe466('0xe')]=_[_0xe466('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe466('0x10'))(new Redis(config[_0xe466('0xe')]));require(_0xe466('0x11'))['register'](socket);function respondWithRpcPromise(_0x43f259,_0x28b3c0,_0x305e16){return new BPromise(function(_0x1f031d,_0x1ba537){return client[_0xe466('0x12')](_0x43f259,_0x305e16)['then'](function(_0x521d79){logger[_0xe466('0x13')](_0xe466('0x14'),_0x28b3c0,'request\x20sent');logger[_0xe466('0x15')](_0xe466('0x16'),_0x28b3c0,_0xe466('0x17'),JSON['stringify'](_0x521d79));if(_0x521d79[_0xe466('0x18')]){if(_0x521d79[_0xe466('0x18')][_0xe466('0x19')]===0x1f4){logger[_0xe466('0x18')](_0xe466('0x14'),_0x28b3c0,_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);return _0x1ba537(_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);}logger[_0xe466('0x18')]('DashboardItem,\x20%s,\x20%s',_0x28b3c0,_0x521d79['error'][_0xe466('0x1a')]);return _0x1f031d(_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);}else{logger[_0xe466('0x13')](_0xe466('0x14'),_0x28b3c0,'request\x20sent');_0x1f031d(_0x521d79[_0xe466('0x1b')][_0xe466('0x1a')]);}})[_0xe466('0x1c')](function(_0x17177e){logger[_0xe466('0x18')](_0xe466('0x14'),_0x28b3c0,_0x17177e);_0x1ba537(_0x17177e);});});} \ No newline at end of file +var _0x1dbc=['register','request','then','info','debug','request\x20sent','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x557acb,_0x2505a6){var _0x2c572b=function(_0x51e04c){while(--_0x51e04c){_0x557acb['push'](_0x557acb['shift']());}};_0x2c572b(++_0x2505a6);}(_0x1dbc,0x151));var _0xc1db=function(_0x4c4b3a,_0xdffe34){_0x4c4b3a=_0x4c4b3a-0x0;var _0x18bd63=_0x1dbc[_0x4c4b3a];return _0x18bd63;};'use strict';var _=require('lodash');var util=require(_0xc1db('0x0'));var moment=require(_0xc1db('0x1'));var BPromise=require(_0xc1db('0x2'));var rs=require(_0xc1db('0x3'));var fs=require('fs');var Redis=require(_0xc1db('0x4'));var db=require(_0xc1db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1db('0x6'))('rpc');var config=require(_0xc1db('0x7'));var jayson=require(_0xc1db('0x8'));var client=jayson[_0xc1db('0x9')][_0xc1db('0xa')]({'port':0x232a});config[_0xc1db('0xb')]=_['defaults'](config[_0xc1db('0xb')],{'host':_0xc1db('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1db('0xb')]));require('./dashboardItem.socket')[_0xc1db('0xd')](socket);function respondWithRpcPromise(_0x2e40ca,_0x302159,_0x434ec0){return new BPromise(function(_0x583bfc,_0xdec59f){return client[_0xc1db('0xe')](_0x2e40ca,_0x434ec0)[_0xc1db('0xf')](function(_0x2c554){logger[_0xc1db('0x10')]('DashboardItem,\x20%s,\x20%s',_0x302159,'request\x20sent');logger[_0xc1db('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x302159,_0xc1db('0x12'),JSON[_0xc1db('0x13')](_0x2c554));if(_0x2c554[_0xc1db('0x14')]){if(_0x2c554[_0xc1db('0x14')]['code']===0x1f4){logger[_0xc1db('0x14')](_0xc1db('0x15'),_0x302159,_0x2c554[_0xc1db('0x14')][_0xc1db('0x16')]);return _0xdec59f(_0x2c554[_0xc1db('0x14')][_0xc1db('0x16')]);}logger[_0xc1db('0x14')]('DashboardItem,\x20%s,\x20%s',_0x302159,_0x2c554[_0xc1db('0x14')]['message']);return _0x583bfc(_0x2c554['error'][_0xc1db('0x16')]);}else{logger['info'](_0xc1db('0x15'),_0x302159,'request\x20sent');_0x583bfc(_0x2c554[_0xc1db('0x17')]['message']);}})[_0xc1db('0x18')](function(_0xe39dab){logger[_0xc1db('0x14')]('DashboardItem,\x20%s,\x20%s',_0x302159,_0xe39dab);_0xdec59f(_0xe39dab);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a6d4643..f8bad98 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 _0xbfa4=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x55ccf1,_0x47e4ef){var _0x5bb102=function(_0x46496a){while(--_0x46496a){_0x55ccf1['push'](_0x55ccf1['shift']());}};_0x5bb102(++_0x47e4ef);}(_0xbfa4,0xa2));var _0x4bfa=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xbfa4[_0x55e08b];return _0xd1a7ff;};'use strict';var DashboardItemEvents=require(_0x4bfa('0x0'));var events=[_0x4bfa('0x1'),_0x4bfa('0x2'),'update'];function createListener(_0x53feb0,_0x581a85){return function(_0x34076a){_0x581a85[_0x4bfa('0x3')](_0x53feb0,_0x34076a);};}function removeListener(_0x39bc15,_0x17dda3){return function(){DashboardItemEvents[_0x4bfa('0x4')](_0x39bc15,_0x17dda3);};}exports[_0x4bfa('0x5')]=function(_0x3de507){for(var _0x57da00=0x0,_0x295f87=events['length'];_0x57da00<_0x295f87;_0x57da00++){var _0xd3aa82=events[_0x57da00];var _0x486585=createListener(_0x4bfa('0x6')+_0xd3aa82,_0x3de507);DashboardItemEvents['on'](_0xd3aa82,_0x486585);}}; \ No newline at end of file +var _0xd81a=['removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd81a,0x74));var _0xad81=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd81a[_0xa464c9];return _0x3d73c4;};'use strict';var DashboardItemEvents=require(_0xad81('0x0'));var events=['save',_0xad81('0x1'),_0xad81('0x2')];function createListener(_0xc50fc4,_0x223e71){return function(_0xd05f2f){_0x223e71['emit'](_0xc50fc4,_0xd05f2f);};}function removeListener(_0xbe619b,_0x456b0c){return function(){DashboardItemEvents[_0xad81('0x3')](_0xbe619b,_0x456b0c);};}exports[_0xad81('0x4')]=function(_0x118759){for(var _0x4d1c21=0x0,_0x31242e=events[_0xad81('0x5')];_0x4d1c21<_0x31242e;_0x4d1c21++){var _0x28d924=events[_0x4d1c21];var _0x4403d4=createListener(_0xad81('0x6')+_0x28d924,_0x118759);DashboardItemEvents['on'](_0x28d924,_0x4403d4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 682d5b0..a671601 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 _0x5c0a=['isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','show','post'];(function(_0x22f775,_0x4c0e62){var _0x40eb51=function(_0x523ec0){while(--_0x523ec0){_0x22f775['push'](_0x22f775['shift']());}};_0x40eb51(++_0x4c0e62);}(_0x5c0a,0x11f));var _0xa5c0=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0x5c0a[_0x2ee974];return _0x20c5fb;};'use strict';var multer=require(_0xa5c0('0x0'));var util=require(_0xa5c0('0x1'));var path=require(_0xa5c0('0x2'));var timeout=require(_0xa5c0('0x3'));var express=require(_0xa5c0('0x4'));var router=express[_0xa5c0('0x5')]();var fs_extra=require(_0xa5c0('0x6'));var auth=require(_0xa5c0('0x7'));var interaction=require(_0xa5c0('0x8'));var config=require('../../config/environment');var controller=require(_0xa5c0('0x9'));router[_0xa5c0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa5c0('0xb')]);router[_0xa5c0('0xc')]('/',auth[_0xa5c0('0xd')](),controller[_0xa5c0('0xe')]);router[_0xa5c0('0xf')](_0xa5c0('0x10'),auth[_0xa5c0('0xd')](),controller['update']);router[_0xa5c0('0x11')](_0xa5c0('0x10'),auth['isAuthenticated'](),controller[_0xa5c0('0x12')]);module[_0xa5c0('0x13')]=router; \ No newline at end of file +var _0x496e=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0xc3beb6,_0x39c989){var _0x5458c5=function(_0x584916){while(--_0x584916){_0xc3beb6['push'](_0xc3beb6['shift']());}};_0x5458c5(++_0x39c989);}(_0x496e,0xe2));var _0xe496=function(_0x15f18a,_0x10dcfb){_0x15f18a=_0x15f18a-0x0;var _0x4f1554=_0x496e[_0x15f18a];return _0x4f1554;};'use strict';var multer=require(_0xe496('0x0'));var util=require(_0xe496('0x1'));var path=require(_0xe496('0x2'));var timeout=require(_0xe496('0x3'));var express=require('express');var router=express[_0xe496('0x4')]();var fs_extra=require(_0xe496('0x5'));var auth=require(_0xe496('0x6'));var interaction=require(_0xe496('0x7'));var config=require('../../config/environment');var controller=require(_0xe496('0x8'));router[_0xe496('0x9')](_0xe496('0xa'),auth[_0xe496('0xb')](),controller[_0xe496('0xc')]);router[_0xe496('0xd')]('/',auth['isAuthenticated'](),controller[_0xe496('0xe')]);router[_0xe496('0xf')](_0xe496('0xa'),auth[_0xe496('0xb')](),controller[_0xe496('0x10')]);router[_0xe496('0x11')]('/:id',auth[_0xe496('0xb')](),controller[_0xe496('0x12')]);module[_0xe496('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e5ade4c..e1e30a3 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 _0xdaaa=['exports','first','second','third','STRING','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdaaa,0xcb));var _0xadaa=function(_0x3c3246,_0x2b3c4c){_0x3c3246=_0x3c3246-0x0;var _0x5436f1=_0xdaaa[_0x3c3246];return _0x5436f1;};'use strict';var Sequelize=require(_0xadaa('0x0'));module[_0xadaa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xadaa('0x2'),_0xadaa('0x3'),_0xadaa('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xadaa('0x5')]}}; \ No newline at end of file +var _0x6d55=['first','second','third','STRING','exports','ENUM'];(function(_0x2f9e01,_0x335d01){var _0xef769a=function(_0x377c85){while(--_0x377c85){_0x2f9e01['push'](_0x2f9e01['shift']());}};_0xef769a(++_0x335d01);}(_0x6d55,0xee));var _0x56d5=function(_0x272282,_0x2e94a0){_0x272282=_0x272282-0x0;var _0xedf511=_0x6d55[_0x272282];return _0xedf511;};'use strict';var Sequelize=require('sequelize');module[_0x56d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x56d5('0x1')](_0x56d5('0x2'),_0x56d5('0x3'),_0x56d5('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x56d5('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 04f1f5c..0cb9e98 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 _0x2645=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','end','error','name','send','map','Disposition','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch'];(function(_0x59458c,_0x4b7a30){var _0x1026fd=function(_0x502e46){while(--_0x502e46){_0x59458c['push'](_0x59458c['shift']());}};_0x1026fd(++_0x4b7a30);}(_0x2645,0xb0));var _0x5264=function(_0x2d932e,_0x52175f){_0x2d932e=_0x2d932e-0x0;var _0x308748=_0x2645[_0x2d932e];return _0x308748;};'use strict';var emlformat=require(_0x5264('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5264('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5264('0x2'));var moment=require(_0x5264('0x3'));var BPromise=require(_0x5264('0x4'));var Mustache=require(_0x5264('0x5'));var util=require(_0x5264('0x6'));var path=require(_0x5264('0x7'));var sox=require(_0x5264('0x8'));var csv=require(_0x5264('0x9'));var ejs=require(_0x5264('0xa'));var fs=require('fs');var fs_extra=require(_0x5264('0xb'));var _=require(_0x5264('0xc'));var squel=require(_0x5264('0xd'));var crypto=require(_0x5264('0xe'));var jsforce=require(_0x5264('0xf'));var deskjs=require(_0x5264('0x10'));var toCsv=require(_0x5264('0x9'));var querystring=require(_0x5264('0x11'));var Papa=require('papaparse');var Redis=require(_0x5264('0x12'));var authService=require(_0x5264('0x13'));var qs=require(_0x5264('0x14'));var as=require(_0x5264('0x15'));var hardwareService=require(_0x5264('0x16'));var logger=require('../../config/logger')(_0x5264('0x17'));var utils=require('../../config/utils');var config=require(_0x5264('0x18'));var licenseUtil=require(_0x5264('0x19'));var db=require(_0x5264('0x1a'))['db'];function respondWithStatusCode(_0x1a8172,_0x1c79ea){_0x1c79ea=_0x1c79ea||0xcc;return function(_0x4c78c2){if(_0x4c78c2){return _0x1a8172[_0x5264('0x1b')](_0x1c79ea);}return _0x1a8172[_0x5264('0x1c')](_0x1c79ea)['end']();};}function respondWithResult(_0x483dce,_0x472b8b){_0x472b8b=_0x472b8b||0xc8;return function(_0x3c6781){if(_0x3c6781){return _0x483dce[_0x5264('0x1c')](_0x472b8b)[_0x5264('0x1d')](_0x3c6781);}};}function respondWithFilteredResult(_0x5e4285,_0x6356d6){return function(_0x5313fc){if(_0x5313fc){var _0x52fee1=typeof _0x6356d6['offset']===_0x5264('0x1e')&&typeof _0x6356d6[_0x5264('0x1f')]==='undefined';var _0x208fb1=_0x5313fc[_0x5264('0x20')];var _0x2a5084=_0x52fee1?0x0:_0x6356d6[_0x5264('0x21')];var _0x2801fd=_0x52fee1?_0x5313fc[_0x5264('0x20')]:_0x6356d6[_0x5264('0x21')]+_0x6356d6[_0x5264('0x1f')];var _0x150efb;if(_0x2801fd>=_0x208fb1){_0x2801fd=_0x208fb1;_0x150efb=0xc8;}else{_0x150efb=0xce;}_0x5e4285[_0x5264('0x1c')](_0x150efb);return _0x5e4285[_0x5264('0x22')](_0x5264('0x23'),_0x2a5084+'-'+_0x2801fd+'/'+_0x208fb1)['json'](_0x5313fc);}return null;};}function patchUpdates(_0x22226d){return function(_0x38ac1a){try{jsonpatch['apply'](_0x38ac1a,_0x22226d,!![]);}catch(_0x2cec5d){return BPromise['reject'](_0x2cec5d);}return _0x38ac1a[_0x5264('0x24')]();};}function saveUpdates(_0x3edd29,_0x41fdbd){return function(_0x372263){if(_0x372263){return _0x372263[_0x5264('0x25')](_0x3edd29)[_0x5264('0x26')](function(_0x3585ff){return _0x3585ff;});}return null;};}function removeEntity(_0x54b4ae,_0x1fbd9a){return function(_0x40e994){if(_0x40e994){return _0x40e994[_0x5264('0x27')]()[_0x5264('0x26')](function(){var _0x3f07d0=_0x40e994[_0x5264('0x28')]({'plain':!![]});var _0x1b1a44=_0x5264('0x29');return db['UserProfileResource'][_0x5264('0x27')]({'where':{'type':_0x1b1a44,'resourceId':_0x3f07d0['id']}})[_0x5264('0x26')](function(){return _0x40e994;});})[_0x5264('0x26')](function(){_0x54b4ae[_0x5264('0x1c')](0xcc)[_0x5264('0x2a')]();});}};}function handleEntityNotFound(_0x2074c8,_0x1cef70){return function(_0x3b3517){if(!_0x3b3517){_0x2074c8[_0x5264('0x1b')](0x194);}return _0x3b3517;};}function handleError(_0xe74305,_0x14d748){_0x14d748=_0x14d748||0x1f4;return function(_0x30e52b){logger[_0x5264('0x2b')](_0x30e52b['stack']);if(_0x30e52b[_0x5264('0x2c')]){delete _0x30e52b[_0x5264('0x2c')];}_0xe74305[_0x5264('0x1c')](_0x14d748)[_0x5264('0x2d')](_0x30e52b);};}exports['index']=function(_0x34a7f1,_0x63514e){var _0x3fcef1={},_0x548c11={},_0x4b00b1={'count':0x0,'rows':[]};var _0x4e05e9=_[_0x5264('0x2e')](db[_0x5264('0x2f')]['rawAttributes'],function(_0x43f112){return{'name':_0x43f112[_0x5264('0x30')],'type':_0x43f112['type'][_0x5264('0x31')]};});_0x548c11[_0x5264('0x32')]=_['map'](_0x4e05e9,_0x5264('0x2c'));_0x548c11['query']=_['keys'](_0x34a7f1[_0x5264('0x33')]);_0x548c11[_0x5264('0x34')]=_[_0x5264('0x35')](_0x548c11['model'],_0x548c11[_0x5264('0x33')]);_0x3fcef1['attributes']=_[_0x5264('0x35')](_0x548c11[_0x5264('0x32')],qs[_0x5264('0x36')](_0x34a7f1[_0x5264('0x33')]['fields']));_0x3fcef1[_0x5264('0x37')]=_0x3fcef1[_0x5264('0x37')][_0x5264('0x38')]?_0x3fcef1['attributes']:_0x548c11['model'];if(!_0x34a7f1['query'][_0x5264('0x39')](_0x5264('0x3a'))){_0x3fcef1['limit']=qs['limit'](_0x34a7f1[_0x5264('0x33')][_0x5264('0x1f')]);_0x3fcef1[_0x5264('0x21')]=qs['offset'](_0x34a7f1[_0x5264('0x33')]['offset']);}_0x3fcef1[_0x5264('0x3b')]=qs[_0x5264('0x3c')](_0x34a7f1[_0x5264('0x33')][_0x5264('0x3c')]);_0x3fcef1['where']=qs[_0x5264('0x34')](_[_0x5264('0x3d')](_0x34a7f1['query'],_0x548c11[_0x5264('0x34')]),_0x4e05e9);if(_0x34a7f1['query'][_0x5264('0x3e')]){_0x3fcef1[_0x5264('0x3f')]=_[_0x5264('0x40')](_0x3fcef1[_0x5264('0x3f')],{'$or':_[_0x5264('0x2e')](_0x4e05e9,function(_0x533bbb){if(_0x533bbb['type']!==_0x5264('0x41')){var _0x3f399a={};_0x3f399a[_0x533bbb['name']]={'$like':'%'+_0x34a7f1['query'][_0x5264('0x3e')]+'%'};return _0x3f399a;}})});}_0x3fcef1=_[_0x5264('0x40')]({},_0x3fcef1,_0x34a7f1[_0x5264('0x42')]);var _0x19e789={'where':_0x3fcef1[_0x5264('0x3f')]};return db[_0x5264('0x2f')][_0x5264('0x20')](_0x19e789)[_0x5264('0x26')](function(_0x529ca5){_0x4b00b1[_0x5264('0x20')]=_0x529ca5;if(_0x34a7f1['query'][_0x5264('0x43')]){_0x3fcef1[_0x5264('0x44')]=[{'all':!![]}];}return db[_0x5264('0x2f')]['findAll'](_0x3fcef1);})['then'](function(_0x5180b3){_0x4b00b1[_0x5264('0x45')]=_0x5180b3;return _0x4b00b1;})[_0x5264('0x26')](respondWithFilteredResult(_0x63514e,_0x3fcef1))['catch'](handleError(_0x63514e,null));};exports[_0x5264('0x46')]=function(_0x282b20,_0x41f2e1){var _0x164b16={'raw':!![],'where':{'id':_0x282b20[_0x5264('0x47')]['id']}},_0x2000a7={};_0x2000a7[_0x5264('0x32')]=_['keys'](db[_0x5264('0x2f')]['rawAttributes']);_0x2000a7[_0x5264('0x33')]=_['keys'](_0x282b20['query']);_0x2000a7['filters']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],_0x2000a7[_0x5264('0x33')]);_0x164b16['attributes']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],qs[_0x5264('0x36')](_0x282b20[_0x5264('0x33')]['fields']));_0x164b16[_0x5264('0x37')]=_0x164b16[_0x5264('0x37')][_0x5264('0x38')]?_0x164b16['attributes']:_0x2000a7[_0x5264('0x32')];if(_0x282b20[_0x5264('0x33')]['includeAll']){_0x164b16[_0x5264('0x44')]=[{'all':!![]}];}_0x164b16=_[_0x5264('0x40')]({},_0x164b16,_0x282b20[_0x5264('0x42')]);return db['Disposition']['find'](_0x164b16)['then'](handleEntityNotFound(_0x41f2e1,null))[_0x5264('0x26')](respondWithResult(_0x41f2e1,null))[_0x5264('0x48')](handleError(_0x41f2e1,null));};exports[_0x5264('0x49')]=function(_0x5259a5,_0x1f9602){return db['Disposition'][_0x5264('0x49')](_0x5259a5[_0x5264('0x4a')],{})[_0x5264('0x26')](function(_0x4e3236){var _0x1f862f=_0x5259a5[_0x5264('0x4b')][_0x5264('0x28')]({'plain':!![]});if(!_0x1f862f)throw new Error(_0x5264('0x4c'));if(_0x1f862f[_0x5264('0x4d')]==='user'){var _0x1b659a=_0x4e3236['get']({'plain':!![]});var _0x1c4c2b='Dispositions';return db[_0x5264('0x4e')]['find']({'where':{'name':_0x1c4c2b,'userProfileId':_0x1f862f[_0x5264('0x4f')]},'raw':!![]})[_0x5264('0x26')](function(_0x51e171){if(_0x51e171&&_0x51e171[_0x5264('0x50')]===0x0){return db[_0x5264('0x51')]['create']({'name':_0x1b659a[_0x5264('0x2c')],'resourceId':_0x1b659a['id'],'type':_0x51e171[_0x5264('0x2c')],'sectionId':_0x51e171['id']},{})[_0x5264('0x26')](function(){return _0x4e3236;});}else{return _0x4e3236;}})[_0x5264('0x48')](function(_0x29172c){logger[_0x5264('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29172c);throw _0x29172c;});}return _0x4e3236;})[_0x5264('0x26')](respondWithResult(_0x1f9602,0xc9))['catch'](handleError(_0x1f9602,null));};exports[_0x5264('0x25')]=function(_0xf9ab47,_0x215858){if(_0xf9ab47['body']['id']){delete _0xf9ab47[_0x5264('0x4a')]['id'];}return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0xf9ab47[_0x5264('0x47')]['id']}})[_0x5264('0x26')](handleEntityNotFound(_0x215858,null))[_0x5264('0x26')](saveUpdates(_0xf9ab47[_0x5264('0x4a')],null))['then'](respondWithResult(_0x215858,null))[_0x5264('0x48')](handleError(_0x215858,null));};exports[_0x5264('0x27')]=function(_0x24b7dd,_0xf70d43){return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0x24b7dd[_0x5264('0x47')]['id']}})['then'](handleEntityNotFound(_0xf70d43,null))[_0x5264('0x26')](removeEntity(_0xf70d43,null))[_0x5264('0x48')](handleError(_0xf70d43,null));}; \ No newline at end of file +var _0xbdba=['query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','VIRTUAL','filter','merge','options','include','findAll','catch','params','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys'];(function(_0x39a165,_0x3ae2e2){var _0x5e56ce=function(_0x472819){while(--_0x472819){_0x39a165['push'](_0x39a165['shift']());}};_0x5e56ce(++_0x3ae2e2);}(_0xbdba,0x107));var _0xabdb=function(_0x4441cf,_0x2a68e7){_0x4441cf=_0x4441cf-0x0;var _0x2f60bf=_0xbdba[_0x4441cf];return _0x2f60bf;};'use strict';var emlformat=require(_0xabdb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabdb('0x1'));var jsonpatch=require(_0xabdb('0x2'));var rp=require(_0xabdb('0x3'));var moment=require(_0xabdb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xabdb('0x5'));var util=require(_0xabdb('0x6'));var path=require('path');var sox=require(_0xabdb('0x7'));var csv=require(_0xabdb('0x8'));var ejs=require(_0xabdb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabdb('0xa'));var squel=require(_0xabdb('0xb'));var crypto=require(_0xabdb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabdb('0xd'));var toCsv=require(_0xabdb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabdb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xabdb('0xf'));var as=require(_0xabdb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xabdb('0x11'));var config=require(_0xabdb('0x12'));var licenseUtil=require(_0xabdb('0x13'));var db=require(_0xabdb('0x14'))['db'];function respondWithStatusCode(_0x2f2e5c,_0x5eabe3){_0x5eabe3=_0x5eabe3||0xcc;return function(_0x5be748){if(_0x5be748){return _0x2f2e5c[_0xabdb('0x15')](_0x5eabe3);}return _0x2f2e5c[_0xabdb('0x16')](_0x5eabe3)[_0xabdb('0x17')]();};}function respondWithResult(_0x48ba51,_0x3c0f31){_0x3c0f31=_0x3c0f31||0xc8;return function(_0x54ef8e){if(_0x54ef8e){return _0x48ba51[_0xabdb('0x16')](_0x3c0f31)['json'](_0x54ef8e);}};}function respondWithFilteredResult(_0xed6ae0,_0x42671f){return function(_0x21c0d7){if(_0x21c0d7){var _0x5c89bf=typeof _0x42671f['offset']===_0xabdb('0x18')&&typeof _0x42671f[_0xabdb('0x19')]===_0xabdb('0x18');var _0x177895=_0x21c0d7['count'];var _0x55e8bd=_0x5c89bf?0x0:_0x42671f['offset'];var _0x5e9d0e=_0x5c89bf?_0x21c0d7[_0xabdb('0x1a')]:_0x42671f[_0xabdb('0x1b')]+_0x42671f[_0xabdb('0x19')];var _0x237550;if(_0x5e9d0e>=_0x177895){_0x5e9d0e=_0x177895;_0x237550=0xc8;}else{_0x237550=0xce;}_0xed6ae0[_0xabdb('0x16')](_0x237550);return _0xed6ae0['set'](_0xabdb('0x1c'),_0x55e8bd+'-'+_0x5e9d0e+'/'+_0x177895)[_0xabdb('0x1d')](_0x21c0d7);}return null;};}function patchUpdates(_0x147d7b){return function(_0x1a016e){try{jsonpatch[_0xabdb('0x1e')](_0x1a016e,_0x147d7b,!![]);}catch(_0x52bc04){return BPromise[_0xabdb('0x1f')](_0x52bc04);}return _0x1a016e[_0xabdb('0x20')]();};}function saveUpdates(_0x31d2ab,_0x415b12){return function(_0x48631f){if(_0x48631f){return _0x48631f['update'](_0x31d2ab)['then'](function(_0x234ff5){return _0x234ff5;});}return null;};}function removeEntity(_0x286361,_0x277e42){return function(_0x5e4ebb){if(_0x5e4ebb){return _0x5e4ebb[_0xabdb('0x21')]()[_0xabdb('0x22')](function(){var _0x4cd168=_0x5e4ebb[_0xabdb('0x23')]({'plain':!![]});var _0x42961d='Dispositions';return db[_0xabdb('0x24')]['destroy']({'where':{'type':_0x42961d,'resourceId':_0x4cd168['id']}})[_0xabdb('0x22')](function(){return _0x5e4ebb;});})['then'](function(){_0x286361[_0xabdb('0x16')](0xcc)[_0xabdb('0x17')]();});}};}function handleEntityNotFound(_0x15f7cc,_0x228d40){return function(_0x1835d8){if(!_0x1835d8){_0x15f7cc['sendStatus'](0x194);}return _0x1835d8;};}function handleError(_0x1dc92a,_0x2a618f){_0x2a618f=_0x2a618f||0x1f4;return function(_0xdce1db){logger[_0xabdb('0x25')](_0xdce1db['stack']);if(_0xdce1db[_0xabdb('0x26')]){delete _0xdce1db['name'];}_0x1dc92a['status'](_0x2a618f)[_0xabdb('0x27')](_0xdce1db);};}exports[_0xabdb('0x28')]=function(_0x1629ee,_0x467098){var _0x21d16b={},_0x47705b={},_0x41dab3={'count':0x0,'rows':[]};var _0xa9710d=_[_0xabdb('0x29')](db[_0xabdb('0x2a')][_0xabdb('0x2b')],function(_0xfbdfd8){return{'name':_0xfbdfd8[_0xabdb('0x2c')],'type':_0xfbdfd8[_0xabdb('0x2d')][_0xabdb('0x2e')]};});_0x47705b[_0xabdb('0x2f')]=_[_0xabdb('0x29')](_0xa9710d,'name');_0x47705b['query']=_[_0xabdb('0x30')](_0x1629ee[_0xabdb('0x31')]);_0x47705b['filters']=_[_0xabdb('0x32')](_0x47705b[_0xabdb('0x2f')],_0x47705b[_0xabdb('0x31')]);_0x21d16b['attributes']=_[_0xabdb('0x32')](_0x47705b['model'],qs['fields'](_0x1629ee[_0xabdb('0x31')][_0xabdb('0x33')]));_0x21d16b['attributes']=_0x21d16b[_0xabdb('0x34')]['length']?_0x21d16b['attributes']:_0x47705b[_0xabdb('0x2f')];if(!_0x1629ee[_0xabdb('0x31')][_0xabdb('0x35')](_0xabdb('0x36'))){_0x21d16b[_0xabdb('0x19')]=qs[_0xabdb('0x19')](_0x1629ee[_0xabdb('0x31')][_0xabdb('0x19')]);_0x21d16b[_0xabdb('0x1b')]=qs[_0xabdb('0x1b')](_0x1629ee[_0xabdb('0x31')][_0xabdb('0x1b')]);}_0x21d16b[_0xabdb('0x37')]=qs[_0xabdb('0x38')](_0x1629ee[_0xabdb('0x31')][_0xabdb('0x38')]);_0x21d16b['where']=qs[_0xabdb('0x39')](_[_0xabdb('0x3a')](_0x1629ee[_0xabdb('0x31')],_0x47705b[_0xabdb('0x39')]),_0xa9710d);if(_0x1629ee['query']['filter']){_0x21d16b['where']=_['merge'](_0x21d16b['where'],{'$or':_[_0xabdb('0x29')](_0xa9710d,function(_0x16c637){if(_0x16c637[_0xabdb('0x2d')]!==_0xabdb('0x3b')){var _0x216d5e={};_0x216d5e[_0x16c637[_0xabdb('0x26')]]={'$like':'%'+_0x1629ee[_0xabdb('0x31')][_0xabdb('0x3c')]+'%'};return _0x216d5e;}})});}_0x21d16b=_[_0xabdb('0x3d')]({},_0x21d16b,_0x1629ee[_0xabdb('0x3e')]);var _0x312e8b={'where':_0x21d16b['where']};return db[_0xabdb('0x2a')][_0xabdb('0x1a')](_0x312e8b)[_0xabdb('0x22')](function(_0x7401fb){_0x41dab3['count']=_0x7401fb;if(_0x1629ee[_0xabdb('0x31')]['includeAll']){_0x21d16b[_0xabdb('0x3f')]=[{'all':!![]}];}return db[_0xabdb('0x2a')][_0xabdb('0x40')](_0x21d16b);})[_0xabdb('0x22')](function(_0x5be710){_0x41dab3['rows']=_0x5be710;return _0x41dab3;})['then'](respondWithFilteredResult(_0x467098,_0x21d16b))[_0xabdb('0x41')](handleError(_0x467098,null));};exports['show']=function(_0x3025eb,_0x37e4c5){var _0x6c6bbd={'raw':!![],'where':{'id':_0x3025eb[_0xabdb('0x42')]['id']}},_0x48d1ce={};_0x48d1ce[_0xabdb('0x2f')]=_[_0xabdb('0x30')](db[_0xabdb('0x2a')][_0xabdb('0x2b')]);_0x48d1ce[_0xabdb('0x31')]=_[_0xabdb('0x30')](_0x3025eb['query']);_0x48d1ce[_0xabdb('0x39')]=_[_0xabdb('0x32')](_0x48d1ce[_0xabdb('0x2f')],_0x48d1ce[_0xabdb('0x31')]);_0x6c6bbd[_0xabdb('0x34')]=_[_0xabdb('0x32')](_0x48d1ce['model'],qs[_0xabdb('0x33')](_0x3025eb[_0xabdb('0x31')]['fields']));_0x6c6bbd['attributes']=_0x6c6bbd['attributes'][_0xabdb('0x43')]?_0x6c6bbd[_0xabdb('0x34')]:_0x48d1ce[_0xabdb('0x2f')];if(_0x3025eb[_0xabdb('0x31')][_0xabdb('0x44')]){_0x6c6bbd['include']=[{'all':!![]}];}_0x6c6bbd=_[_0xabdb('0x3d')]({},_0x6c6bbd,_0x3025eb[_0xabdb('0x3e')]);return db[_0xabdb('0x2a')]['find'](_0x6c6bbd)[_0xabdb('0x22')](handleEntityNotFound(_0x37e4c5,null))[_0xabdb('0x22')](respondWithResult(_0x37e4c5,null))[_0xabdb('0x41')](handleError(_0x37e4c5,null));};exports[_0xabdb('0x45')]=function(_0x24363f,_0x58153e){return db[_0xabdb('0x2a')]['create'](_0x24363f['body'],{})[_0xabdb('0x22')](function(_0x37b094){var _0x3e7ea3=_0x24363f[_0xabdb('0x46')][_0xabdb('0x23')]({'plain':!![]});if(!_0x3e7ea3)throw new Error(_0xabdb('0x47'));if(_0x3e7ea3['role']==='user'){var _0x2f47da=_0x37b094[_0xabdb('0x23')]({'plain':!![]});var _0x290ec6=_0xabdb('0x48');return db[_0xabdb('0x49')]['find']({'where':{'name':_0x290ec6,'userProfileId':_0x3e7ea3['userProfileId']},'raw':!![]})['then'](function(_0x19a02b){if(_0x19a02b&&_0x19a02b[_0xabdb('0x4a')]===0x0){return db[_0xabdb('0x24')][_0xabdb('0x45')]({'name':_0x2f47da[_0xabdb('0x26')],'resourceId':_0x2f47da['id'],'type':_0x19a02b['name'],'sectionId':_0x19a02b['id']},{})[_0xabdb('0x22')](function(){return _0x37b094;});}else{return _0x37b094;}})[_0xabdb('0x41')](function(_0x5aef47){logger['error'](_0xabdb('0x4b'),_0x5aef47);throw _0x5aef47;});}return _0x37b094;})['then'](respondWithResult(_0x58153e,0xc9))[_0xabdb('0x41')](handleError(_0x58153e,null));};exports['update']=function(_0x2df8e4,_0x4695e5){if(_0x2df8e4[_0xabdb('0x4c')]['id']){delete _0x2df8e4['body']['id'];}return db[_0xabdb('0x2a')][_0xabdb('0x4d')]({'where':{'id':_0x2df8e4['params']['id']}})[_0xabdb('0x22')](handleEntityNotFound(_0x4695e5,null))['then'](saveUpdates(_0x2df8e4['body'],null))[_0xabdb('0x22')](respondWithResult(_0x4695e5,null))[_0xabdb('0x41')](handleError(_0x4695e5,null));};exports[_0xabdb('0x21')]=function(_0x835f31,_0x5d5d4f){return db[_0xabdb('0x2a')][_0xabdb('0x4d')]({'where':{'id':_0x835f31[_0xabdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d5d4f,null))[_0xabdb('0x22')](removeEntity(_0x5d5d4f,null))['catch'](handleError(_0x5d5d4f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 809642b..d7ef50d 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 _0x92dd=['define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x4c0dd,_0x72eeba){var _0x1134a9=function(_0x5ed1ef){while(--_0x5ed1ef){_0x4c0dd['push'](_0x4c0dd['shift']());}};_0x1134a9(++_0x72eeba);}(_0x92dd,0xae));var _0xd92d=function(_0x54182c,_0x380843){_0x54182c=_0x54182c-0x0;var _0x25d0ad=_0x92dd[_0x54182c];return _0x25d0ad;};'use strict';var _=require(_0xd92d('0x0'));var util=require(_0xd92d('0x1'));var logger=require(_0xd92d('0x2'))(_0xd92d('0x3'));var moment=require(_0xd92d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd92d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd92d('0x6'));var config=require(_0xd92d('0x7'));var attributes=require(_0xd92d('0x8'));module[_0xd92d('0x9')]=function(_0x3919e4,_0x23474d){return _0x3919e4[_0xd92d('0xa')](_0xd92d('0xb'),attributes,{'tableName':_0xd92d('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd92d('0xd'),'fields':[_0xd92d('0xe'),_0xd92d('0xf')]},{'unique':!![],'name':_0xd92d('0x10'),'fields':[_0xd92d('0xe'),_0xd92d('0x11')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0xd92d('0x12'),'fields':[_0xd92d('0xe'),_0xd92d('0x13')]},{'unique':!![],'name':_0xd92d('0x14'),'fields':[_0xd92d('0xe'),_0xd92d('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xd92d('0xe'),_0xd92d('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xd92d('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc4c=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','name_voice','name','ListId'];(function(_0x48b2fe,_0x3cda09){var _0x1697e9=function(_0x123e0f){while(--_0x123e0f){_0x48b2fe['push'](_0x48b2fe['shift']());}};_0x1697e9(++_0x3cda09);}(_0xbc4c,0xe2));var _0xcbc4=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xbc4c[_0x5179a5];return _0x15c8ce;};'use strict';var _=require('lodash');var util=require(_0xcbc4('0x0'));var logger=require(_0xcbc4('0x1'))(_0xcbc4('0x2'));var moment=require(_0xcbc4('0x3'));var BPromise=require(_0xcbc4('0x4'));var rp=require(_0xcbc4('0x5'));var fs=require('fs');var path=require(_0xcbc4('0x6'));var rimraf=require('rimraf');var config=require(_0xcbc4('0x7'));var attributes=require(_0xcbc4('0x8'));module[_0xcbc4('0x9')]=function(_0x29b21a,_0x5e6d66){return _0x29b21a[_0xcbc4('0xa')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xcbc4('0xb'),'fields':[_0xcbc4('0xc'),_0xcbc4('0xd')]},{'unique':!![],'name':_0xcbc4('0xe'),'fields':[_0xcbc4('0xc'),_0xcbc4('0xf')]},{'unique':!![],'name':_0xcbc4('0x10'),'fields':[_0xcbc4('0xc'),_0xcbc4('0x11')]},{'unique':!![],'name':_0xcbc4('0x12'),'fields':[_0xcbc4('0xc'),_0xcbc4('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0xcbc4('0xc'),_0xcbc4('0x14')]},{'unique':!![],'name':_0xcbc4('0x15'),'fields':[_0xcbc4('0xc'),_0xcbc4('0x16')]},{'unique':!![],'name':_0xcbc4('0x17'),'fields':[_0xcbc4('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 405d360..5b65a1e 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(_0x57d8e5,_0x3fa755){var _0x2c478d=function(_0x463b46){while(--_0x463b46){_0x57d8e5['push'](_0x57d8e5['shift']());}};_0x2c478d(++_0x3fa755);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x56faa7,_0x4de427){var _0x4360c8=function(_0x32175d){while(--_0x32175d){_0x56faa7['push'](_0x56faa7['shift']());}};_0x4360c8(++_0x4de427);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2983061..5a3158d 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 _0x7243=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0x7243,0xfe));var _0x3724=function(_0x485425,_0xe7d6c){_0x485425=_0x485425-0x0;var _0x434276=_0x7243[_0x485425];return _0x434276;};'use strict';var multer=require(_0x3724('0x0'));var util=require(_0x3724('0x1'));var path=require(_0x3724('0x2'));var timeout=require(_0x3724('0x3'));var express=require(_0x3724('0x4'));var router=express['Router']();var fs_extra=require(_0x3724('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3724('0x6'));var config=require(_0x3724('0x7'));var controller=require(_0x3724('0x8'));router[_0x3724('0x9')]('/',auth[_0x3724('0xa')](),controller[_0x3724('0xb')]);router[_0x3724('0x9')](_0x3724('0xc'),auth[_0x3724('0xa')](),controller[_0x3724('0xd')]);router[_0x3724('0xe')]('/',auth[_0x3724('0xa')](),controller[_0x3724('0xf')]);router[_0x3724('0x10')](_0x3724('0xc'),auth[_0x3724('0xa')](),controller[_0x3724('0x11')]);router[_0x3724('0x12')](_0x3724('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3724('0x13')]=router; \ No newline at end of file +var _0x973b=['fs-extra','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x973b,0x19d));var _0xb973=function(_0x234e7e,_0xf82c84){_0x234e7e=_0x234e7e-0x0;var _0x23319a=_0x973b[_0x234e7e];return _0x23319a;};'use strict';var multer=require('multer');var util=require(_0xb973('0x0'));var path=require(_0xb973('0x1'));var timeout=require(_0xb973('0x2'));var express=require(_0xb973('0x3'));var router=express[_0xb973('0x4')]();var fs_extra=require(_0xb973('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb973('0x6'));var controller=require(_0xb973('0x7'));router['get']('/',auth[_0xb973('0x8')](),controller[_0xb973('0x9')]);router[_0xb973('0xa')](_0xb973('0xb'),auth[_0xb973('0x8')](),controller[_0xb973('0xc')]);router[_0xb973('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb973('0xe')](_0xb973('0xb'),auth['isAuthenticated'](),controller[_0xb973('0xf')]);router[_0xb973('0x10')](_0xb973('0xb'),auth[_0xb973('0x8')](),controller[_0xb973('0x11')]);module[_0xb973('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ced4d31..4a58713 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 _0xd046=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','14400','9600','v17,v27,v29','ENUM','SIP','IAX','DADHI','KHOMP'];(function(_0x50c065,_0x54782d){var _0x488307=function(_0x2f525c){while(--_0x2f525c){_0x50c065['push'](_0x50c065['shift']());}};_0x488307(++_0x54782d);}(_0xd046,0x129));var _0x6d04=function(_0x2f6094,_0x2e1b19){_0x2f6094=_0x2f6094-0x0;var _0x16c30c=_0xd046[_0x2f6094];return _0x16c30c;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6d04('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x6d04('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6d04('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6d04('0x4')},'minrate':{'type':Sequelize['ENUM']('2400',_0x6d04('0x5'),_0x6d04('0x6'),'9600','12000',_0x6d04('0x7')),'defaultValue':_0x6d04('0x5')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x6d04('0x5'),'7200',_0x6d04('0x8'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':_0x6d04('0x9')},'gateway':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6d04('0xa')](_0x6d04('0xb'),_0x6d04('0xc'),_0x6d04('0xd'),_0x6d04('0xe')),'defaultValue':_0x6d04('0xb')},'key':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6d04('0xf')],'defaultValue':function(){return _0x6d04('0x10');}},'notificationSound':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d04('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x6d04('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![],'comment':_0x6d04('0x14'),'set':function(_0x41dc21){if(!_0x41dc21)this[_0x6d04('0x15')](_0x6d04('0x16'),null);this['setDataValue'](_0x6d04('0x17'),_0x41dc21);}}}; \ No newline at end of file +var _0xd9fb=['7200','12000','14400','9600','IAX','DADHI','KHOMP','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','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xd9fb,0x189));var _0xbd9f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd9fb[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0xbd9f('0x0'));module[_0xbd9f('0x1')]={'name':{'type':Sequelize[_0xbd9f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbd9f('0x2')]},'ecm':{'type':Sequelize[_0xbd9f('0x3')](_0xbd9f('0x4'),'no'),'defaultValue':_0xbd9f('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xbd9f('0x5')},'localstationid':{'type':Sequelize[_0xbd9f('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xbd9f('0x3')]('2400',_0xbd9f('0x6'),_0xbd9f('0x7'),'9600',_0xbd9f('0x8'),_0xbd9f('0x9')),'defaultValue':_0xbd9f('0x6')},'maxrate':{'type':Sequelize[_0xbd9f('0x3')]('2400',_0xbd9f('0x6'),_0xbd9f('0x7'),_0xbd9f('0xa'),_0xbd9f('0x8'),_0xbd9f('0x9')),'defaultValue':_0xbd9f('0x9')},'modem':{'type':Sequelize[_0xbd9f('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbd9f('0x3')]('SIP',_0xbd9f('0xb'),_0xbd9f('0xc'),_0xbd9f('0xd')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xbd9f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbd9f('0xe');}},'notificationSound':{'type':Sequelize[_0xbd9f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd9f('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd9f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbd9f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd9f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd9f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd9f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd9f('0x10')],'allowNull':!![],'defaultValue':null,'comment':_0xbd9f('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xbd9f('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x49a818){if(!_0x49a818)this[_0xbd9f('0x12')]('mandatoryDispositionPauseId',null);this[_0xbd9f('0x12')](_0xbd9f('0x13'),_0x49a818);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ad0fc36..3744ab5 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 _0x04f4=['addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','FaxAccount','findAll','rows','show','params','intersection','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','FaxAccountId','Disposition','includeAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','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','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','findById','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x04f4,0x18e));var _0x404f=function(_0x26bf1d,_0x1ff663){_0x26bf1d=_0x26bf1d-0x0;var _0xd2c50c=_0x04f4[_0x26bf1d];return _0xd2c50c;};'use strict';var emlformat=require(_0x404f('0x0'));var rimraf=require(_0x404f('0x1'));var zipdir=require(_0x404f('0x2'));var jsonpatch=require(_0x404f('0x3'));var rp=require(_0x404f('0x4'));var moment=require(_0x404f('0x5'));var BPromise=require(_0x404f('0x6'));var Mustache=require(_0x404f('0x7'));var util=require(_0x404f('0x8'));var path=require(_0x404f('0x9'));var sox=require(_0x404f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x404f('0xb'));var _=require(_0x404f('0xc'));var squel=require(_0x404f('0xd'));var crypto=require(_0x404f('0xe'));var jsforce=require(_0x404f('0xf'));var deskjs=require(_0x404f('0x10'));var toCsv=require(_0x404f('0x11'));var querystring=require(_0x404f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x404f('0x13'));var as=require(_0x404f('0x14'));var hardwareService=require(_0x404f('0x15'));var logger=require(_0x404f('0x16'))('api');var utils=require(_0x404f('0x17'));var config=require(_0x404f('0x18'));var licenseUtil=require(_0x404f('0x19'));var db=require(_0x404f('0x1a'))['db'];config[_0x404f('0x1b')]=_['defaults'](config[_0x404f('0x1b')],{'host':_0x404f('0x1c'),'port':0x18eb});var socket=require(_0x404f('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x404f('0x1e')](socket);var jayson=require(_0x404f('0x1f'));var client=jayson[_0x404f('0x20')][_0x404f('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x404f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x15a93d,_0x23676b,_0xaea59,_0x5a996e){return new BPromise(function(_0x46e85b,_0x38d950){var _0x1ed75b=_0x5a996e||client;return _0x1ed75b[_0x404f('0x22')](_0x15a93d,_0xaea59)[_0x404f('0x23')](function(_0x35fd18){logger[_0x404f('0x24')](_0x404f('0x25'),_0x23676b,'request\x20sent');logger[_0x404f('0x26')](_0x404f('0x27'),_0x23676b,_0x404f('0x28'),JSON['stringify'](_0x35fd18));if(_0x35fd18[_0x404f('0x29')]){if(_0x35fd18[_0x404f('0x29')][_0x404f('0x2a')]===0x1f4){logger[_0x404f('0x29')]('FaxAccount,\x20%s,\x20%s',_0x23676b,_0x35fd18[_0x404f('0x29')]['message']);return _0x38d950(_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);}logger[_0x404f('0x29')]('FaxAccount,\x20%s,\x20%s',_0x23676b,_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);return _0x46e85b(_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);}else{logger[_0x404f('0x24')](_0x404f('0x25'),_0x23676b,_0x404f('0x28'));_0x46e85b(_0x35fd18[_0x404f('0x2c')][_0x404f('0x2b')]);}})[_0x404f('0x2d')](function(_0x34cb7a){logger[_0x404f('0x29')](_0x404f('0x25'),_0x23676b,_0x34cb7a);_0x38d950(_0x34cb7a);});});}function respondWithStatusCode(_0xac53be,_0x4b3b3a){_0x4b3b3a=_0x4b3b3a||0xcc;return function(_0x24ee1c){if(_0x24ee1c){return _0xac53be[_0x404f('0x2e')](_0x4b3b3a);}return _0xac53be[_0x404f('0x2f')](_0x4b3b3a)[_0x404f('0x30')]();};}function respondWithResult(_0x50bfb9,_0x338495){_0x338495=_0x338495||0xc8;return function(_0x3bb55d){if(_0x3bb55d){return _0x50bfb9[_0x404f('0x2f')](_0x338495)[_0x404f('0x31')](_0x3bb55d);}};}function respondWithFilteredResult(_0x3f328e,_0x48d4df){return function(_0x11723f){if(_0x11723f){var _0x51961f=typeof _0x48d4df[_0x404f('0x32')]===_0x404f('0x33')&&typeof _0x48d4df[_0x404f('0x34')]===_0x404f('0x33');var _0x56529b=_0x11723f[_0x404f('0x35')];var _0x5d9087=_0x51961f?0x0:_0x48d4df[_0x404f('0x32')];var _0x401cab=_0x51961f?_0x11723f[_0x404f('0x35')]:_0x48d4df['offset']+_0x48d4df[_0x404f('0x34')];var _0x3e53bb;if(_0x401cab>=_0x56529b){_0x401cab=_0x56529b;_0x3e53bb=0xc8;}else{_0x3e53bb=0xce;}_0x3f328e[_0x404f('0x2f')](_0x3e53bb);return _0x3f328e['set'](_0x404f('0x36'),_0x5d9087+'-'+_0x401cab+'/'+_0x56529b)['json'](_0x11723f);}return null;};}function patchUpdates(_0x39268f){return function(_0x4fcdea){try{jsonpatch['apply'](_0x4fcdea,_0x39268f,!![]);}catch(_0x7326a8){return BPromise[_0x404f('0x37')](_0x7326a8);}return _0x4fcdea[_0x404f('0x38')]();};}function saveUpdates(_0x491ae2,_0x5f5129){return function(_0x3242dc){if(_0x3242dc){return _0x3242dc['update'](_0x491ae2)[_0x404f('0x23')](function(_0x34e406){return _0x34e406;});}return null;};}function removeEntity(_0x180f67,_0x181f59){return function(_0x19e5cb){if(_0x19e5cb){return _0x19e5cb[_0x404f('0x39')]()[_0x404f('0x23')](function(){var _0x2202b2=_0x19e5cb[_0x404f('0x3a')]({'plain':!![]});var _0x4fac17=_0x404f('0x3b');return db[_0x404f('0x3c')][_0x404f('0x39')]({'where':{'type':_0x4fac17,'resourceId':_0x2202b2['id']}})['then'](function(){return _0x19e5cb;});})['then'](function(){_0x180f67[_0x404f('0x2f')](0xcc)[_0x404f('0x30')]();});}};}function handleEntityNotFound(_0x173a32,_0x16cca0){return function(_0x263de8){if(!_0x263de8){_0x173a32[_0x404f('0x2e')](0x194);}return _0x263de8;};}function handleError(_0x5014a5,_0x539d43){_0x539d43=_0x539d43||0x1f4;return function(_0x46b9f2){logger[_0x404f('0x29')](_0x46b9f2[_0x404f('0x3d')]);if(_0x46b9f2['name']){delete _0x46b9f2[_0x404f('0x3e')];}_0x5014a5[_0x404f('0x2f')](_0x539d43)[_0x404f('0x3f')](_0x46b9f2);};}exports['index']=function(_0x5f0273,_0x56e6e6){var _0x3b85dc={'include':[{'model':db[_0x404f('0x40')],'as':_0x404f('0x41')}]},_0xe199e7={},_0xd7e0f={'count':0x0,'rows':[]};var _0x318b69=_[_0x404f('0x42')](db['FaxAccount'][_0x404f('0x43')],function(_0x501afc){return{'name':_0x501afc[_0x404f('0x44')],'type':_0x501afc[_0x404f('0x45')][_0x404f('0x46')]};});_0xe199e7[_0x404f('0x47')]=_[_0x404f('0x42')](_0x318b69,_0x404f('0x3e'));_0xe199e7[_0x404f('0x48')]=_[_0x404f('0x49')](_0x5f0273[_0x404f('0x48')]);_0xe199e7['filters']=_['intersection'](_0xe199e7[_0x404f('0x47')],_0xe199e7[_0x404f('0x48')]);_0x3b85dc[_0x404f('0x4a')]=_['intersection'](_0xe199e7['model'],qs[_0x404f('0x4b')](_0x5f0273[_0x404f('0x48')][_0x404f('0x4b')]));_0x3b85dc['attributes']=_0x3b85dc[_0x404f('0x4a')][_0x404f('0x4c')]?_0x3b85dc[_0x404f('0x4a')]:_0xe199e7[_0x404f('0x47')];if(!_0x5f0273[_0x404f('0x48')]['hasOwnProperty'](_0x404f('0x4d'))){_0x3b85dc[_0x404f('0x34')]=qs['limit'](_0x5f0273[_0x404f('0x48')][_0x404f('0x34')]);_0x3b85dc[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x5f0273[_0x404f('0x48')][_0x404f('0x32')]);}_0x3b85dc[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x5f0273['query'][_0x404f('0x4f')]);_0x3b85dc[_0x404f('0x50')]=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5f0273[_0x404f('0x48')],_0xe199e7[_0x404f('0x51')]),_0x318b69);if(_0x5f0273[_0x404f('0x48')][_0x404f('0x53')]){_0x3b85dc['where']=_[_0x404f('0x54')](_0x3b85dc[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x318b69,function(_0x157b99){if(_0x157b99[_0x404f('0x45')]!==_0x404f('0x55')){var _0x43f700={};_0x43f700[_0x157b99[_0x404f('0x3e')]]={'$like':'%'+_0x5f0273[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x43f700;}})});}_0x3b85dc=_[_0x404f('0x54')]({},_0x3b85dc,_0x5f0273[_0x404f('0x56')]);var _0x2f8063={'where':_0x3b85dc[_0x404f('0x50')]};return db['FaxAccount']['count'](_0x2f8063)['then'](function(_0x4cf501){_0xd7e0f[_0x404f('0x35')]=_0x4cf501;if(_0x5f0273['query']['includeAll']){_0x3b85dc[_0x404f('0x57')]=[{'all':!![]}];}return db[_0x404f('0x58')][_0x404f('0x59')](_0x3b85dc);})[_0x404f('0x23')](function(_0x4addf9){_0xd7e0f[_0x404f('0x5a')]=_0x4addf9;return _0xd7e0f;})[_0x404f('0x23')](respondWithFilteredResult(_0x56e6e6,_0x3b85dc))[_0x404f('0x2d')](handleError(_0x56e6e6,null));};exports[_0x404f('0x5b')]=function(_0x2c42a7,_0xe3d85b){var _0x1556f3={'raw':![],'where':{'id':_0x2c42a7[_0x404f('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x404f('0x41')}]},_0x17176f={};_0x17176f[_0x404f('0x47')]=_[_0x404f('0x49')](db[_0x404f('0x58')][_0x404f('0x43')]);_0x17176f[_0x404f('0x48')]=_[_0x404f('0x49')](_0x2c42a7[_0x404f('0x48')]);_0x17176f[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x17176f[_0x404f('0x47')],_0x17176f['query']);_0x1556f3[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x17176f[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x2c42a7['query']['fields']));_0x1556f3[_0x404f('0x4a')]=_0x1556f3[_0x404f('0x4a')][_0x404f('0x4c')]?_0x1556f3[_0x404f('0x4a')]:_0x17176f[_0x404f('0x47')];if(_0x2c42a7[_0x404f('0x48')]['includeAll']){_0x1556f3[_0x404f('0x57')]=[{'all':!![]}];}_0x1556f3=_[_0x404f('0x54')]({},_0x1556f3,_0x2c42a7[_0x404f('0x56')]);return db[_0x404f('0x58')]['find'](_0x1556f3)['then'](handleEntityNotFound(_0xe3d85b,null))[_0x404f('0x23')](respondWithResult(_0xe3d85b,null))[_0x404f('0x2d')](handleError(_0xe3d85b,null));};exports[_0x404f('0x5e')]=function(_0x3fdc37,_0xcebea2){return db['FaxAccount'][_0x404f('0x5e')](_0x3fdc37[_0x404f('0x5f')],{})[_0x404f('0x23')](function(_0x59b9be){var _0x9987ff=_0x3fdc37[_0x404f('0x60')][_0x404f('0x3a')]({'plain':!![]});if(!_0x9987ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9987ff[_0x404f('0x61')]==='user'){var _0x2133ec=_0x59b9be['get']({'plain':!![]});var _0x56af32=_0x404f('0x3b');return db[_0x404f('0x62')]['find']({'where':{'name':_0x56af32,'userProfileId':_0x9987ff[_0x404f('0x63')]},'raw':!![]})[_0x404f('0x23')](function(_0x1356a6){if(_0x1356a6&&_0x1356a6[_0x404f('0x64')]===0x0){return db[_0x404f('0x3c')]['create']({'name':_0x2133ec[_0x404f('0x3e')],'resourceId':_0x2133ec['id'],'type':_0x1356a6[_0x404f('0x3e')],'sectionId':_0x1356a6['id']},{})['then'](function(){return _0x59b9be;});}else{return _0x59b9be;}})['catch'](function(_0x56c206){logger[_0x404f('0x29')](_0x404f('0x65'),_0x56c206);throw _0x56c206;});}return _0x59b9be;})['then'](respondWithResult(_0xcebea2,0xc9))[_0x404f('0x2d')](handleError(_0xcebea2,null));};exports[_0x404f('0x66')]=function(_0x454512,_0x4a0a29){if(_0x454512['body']['id']){delete _0x454512[_0x404f('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x454512['params']['id']},'include':[{'model':db[_0x404f('0x40')],'as':_0x404f('0x41')}]})[_0x404f('0x23')](handleEntityNotFound(_0x4a0a29,null))[_0x404f('0x23')](saveUpdates(_0x454512[_0x404f('0x5f')],null))[_0x404f('0x23')](respondWithResult(_0x4a0a29,null))[_0x404f('0x2d')](handleError(_0x4a0a29,null));};exports[_0x404f('0x39')]=function(_0x3047f0,_0x113e13){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x3047f0[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x113e13,null))[_0x404f('0x23')](removeEntity(_0x113e13,null))['catch'](handleError(_0x113e13,null));};exports[_0x404f('0x68')]=function(_0x4f2da4,_0x23a105){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x23a105,null))[_0x404f('0x2d')](handleError(_0x23a105,null));};exports[_0x404f('0x69')]=function(_0x5e41fc,_0x24accd,_0x531469){if(_0x5e41fc[_0x404f('0x5f')]['id']){delete _0x5e41fc[_0x404f('0x5f')]['id'];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x5e41fc[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x24accd,null))[_0x404f('0x23')](function(_0x5ba06b){if(_0x5ba06b){_0x5e41fc[_0x404f('0x5f')]['FaxAccountId']=_0x5ba06b['id'];return db['Disposition']['create'](_0x5e41fc[_0x404f('0x5f')]);}})['then'](respondWithResult(_0x24accd,null))['catch'](handleError(_0x24accd,null));};exports['getDispositions']=function(_0x5aed29,_0x5cf9dd,_0x54a0a7){var _0x3108d0={'raw':![],'where':{}};var _0x4a0570={};var _0x183995={'count':0x0,'rows':[]};return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x5aed29['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x5cf9dd,null))['then'](function(_0x1977a5){if(_0x1977a5){_0x4a0570[_0x404f('0x47')]=_[_0x404f('0x49')](db['Disposition'][_0x404f('0x43')]);_0x4a0570[_0x404f('0x48')]=_[_0x404f('0x49')](_0x5aed29['query']);_0x4a0570[_0x404f('0x51')]=_['intersection'](_0x4a0570['model'],_0x4a0570[_0x404f('0x48')]);_0x3108d0[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x4a0570[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x5aed29[_0x404f('0x48')][_0x404f('0x4b')]));_0x3108d0[_0x404f('0x4a')]=_0x3108d0[_0x404f('0x4a')][_0x404f('0x4c')]?_0x3108d0[_0x404f('0x4a')]:_0x4a0570[_0x404f('0x47')];if(!_0x5aed29['query']['hasOwnProperty']('nolimit')){_0x3108d0[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x5aed29['query'][_0x404f('0x34')]);_0x3108d0['offset']=qs['offset'](_0x5aed29[_0x404f('0x48')]['offset']);}_0x3108d0[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x5aed29[_0x404f('0x48')][_0x404f('0x4f')]);_0x3108d0['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5aed29['query'],_0x4a0570[_0x404f('0x51')]));_0x3108d0[_0x404f('0x50')][_0x404f('0x6a')]=_0x1977a5['id'];if(_0x5aed29[_0x404f('0x48')]['filter']){_0x3108d0[_0x404f('0x50')]=_[_0x404f('0x54')](_0x3108d0[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x3108d0['attributes'],function(_0x2dbae6){var _0x235e51={};_0x235e51[_0x2dbae6]={'$like':'%'+_0x5aed29[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x235e51;})});}_0x3108d0=_['merge']({},_0x3108d0,_0x5aed29[_0x404f('0x56')]);return db[_0x404f('0x6b')]['count']({'where':_0x3108d0[_0x404f('0x50')]})[_0x404f('0x23')](function(_0x862a2){_0x183995[_0x404f('0x35')]=_0x862a2;if(_0x5aed29[_0x404f('0x48')][_0x404f('0x6c')]){_0x3108d0['include']=[{'all':!![]}];}return db[_0x404f('0x6b')]['findAll'](_0x3108d0);})[_0x404f('0x23')](function(_0x55f413){_0x183995[_0x404f('0x5a')]=_0x55f413;return _0x183995;});}})['then'](respondWithFilteredResult(_0x5cf9dd,_0x3108d0))['catch'](handleError(_0x5cf9dd,null));};exports[_0x404f('0x6d')]=function(_0x1b68f5,_0x2d6649,_0x490d5d){return db[_0x404f('0x58')]['find']({'where':{'id':_0x1b68f5[_0x404f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d6649,null))[_0x404f('0x23')](function(_0x1b34c6){if(_0x1b34c6){return _0x1b34c6[_0x404f('0x6d')](_0x1b68f5['query'][_0x404f('0x6e')]);}})[_0x404f('0x23')](respondWithStatusCode(_0x2d6649,null))['catch'](handleError(_0x2d6649,null));};exports['addAnswer']=function(_0x2548fc,_0x4fddda,_0x5a4ec3){if(_0x2548fc[_0x404f('0x5f')]['id']){delete _0x2548fc['body']['id'];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x2548fc['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x4fddda,null))[_0x404f('0x23')](function(_0x217400){if(_0x217400){_0x2548fc[_0x404f('0x5f')][_0x404f('0x6a')]=_0x217400['id'];return db['CannedAnswer'][_0x404f('0x5e')](_0x2548fc['body']);}})[_0x404f('0x23')](respondWithResult(_0x4fddda,null))['catch'](handleError(_0x4fddda,null));};exports[_0x404f('0x6f')]=function(_0x21b247,_0x23f6b4,_0x1b14a7){var _0x2e8051={'raw':![],'where':{}};var _0xc71687={};var _0xad30f6={'count':0x0,'rows':[]};return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x21b247['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x23f6b4,null))[_0x404f('0x23')](function(_0x3f5421){if(_0x3f5421){_0xc71687['model']=_[_0x404f('0x49')](db[_0x404f('0x71')]['rawAttributes']);_0xc71687['query']=_['keys'](_0x21b247[_0x404f('0x48')]);_0xc71687['filters']=_[_0x404f('0x5d')](_0xc71687[_0x404f('0x47')],_0xc71687[_0x404f('0x48')]);_0x2e8051['attributes']=_[_0x404f('0x5d')](_0xc71687[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x21b247['query'][_0x404f('0x4b')]));_0x2e8051['attributes']=_0x2e8051[_0x404f('0x4a')]['length']?_0x2e8051[_0x404f('0x4a')]:_0xc71687[_0x404f('0x47')];if(!_0x21b247[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x2e8051[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x21b247[_0x404f('0x48')]['limit']);_0x2e8051[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x21b247[_0x404f('0x48')][_0x404f('0x32')]);}_0x2e8051[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x21b247[_0x404f('0x48')]['sort']);_0x2e8051[_0x404f('0x50')]=qs[_0x404f('0x51')](_['pick'](_0x21b247[_0x404f('0x48')],_0xc71687[_0x404f('0x51')]));_0x2e8051[_0x404f('0x50')][_0x404f('0x6a')]=_0x3f5421['id'];if(_0x21b247[_0x404f('0x48')][_0x404f('0x53')]){_0x2e8051[_0x404f('0x50')]=_[_0x404f('0x54')](_0x2e8051[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x2e8051[_0x404f('0x4a')],function(_0x16321c){var _0x42ec61={};_0x42ec61[_0x16321c]={'$like':'%'+_0x21b247[_0x404f('0x48')]['filter']+'%'};return _0x42ec61;})});}_0x2e8051=_[_0x404f('0x54')]({},_0x2e8051,_0x21b247[_0x404f('0x56')]);return db[_0x404f('0x71')]['count']({'where':_0x2e8051['where']})[_0x404f('0x23')](function(_0x4b02b7){_0xad30f6[_0x404f('0x35')]=_0x4b02b7;if(_0x21b247['query'][_0x404f('0x6c')]){_0x2e8051[_0x404f('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x404f('0x59')](_0x2e8051);})[_0x404f('0x23')](function(_0x46e7de){_0xad30f6[_0x404f('0x5a')]=_0x46e7de;return _0xad30f6;});}})[_0x404f('0x23')](respondWithFilteredResult(_0x23f6b4,_0x2e8051))['catch'](handleError(_0x23f6b4,null));};exports[_0x404f('0x73')]=function(_0x1cf395,_0x509622,_0x9fa404){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x1cf395[_0x404f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x509622,null))['then'](function(_0x1c7076){if(_0x1c7076){return _0x1c7076[_0x404f('0x73')](_0x1cf395['query'][_0x404f('0x6e')]);}})[_0x404f('0x23')](respondWithStatusCode(_0x509622,null))[_0x404f('0x2d')](handleError(_0x509622,null));};exports[_0x404f('0x74')]=function(_0x20e861,_0x396233,_0x4b3012){return db['FaxInteraction'][_0x404f('0x67')]({'where':{'id':_0x20e861[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x396233,null))[_0x404f('0x23')](function(_0x15f71b){if(_0x15f71b){return _0x15f71b[_0x404f('0x74')](_0x20e861['body'][_0x404f('0x6e')],_[_0x404f('0x75')](_0x20e861[_0x404f('0x5f')],[_0x404f('0x6e'),'id'])||{});}})[_0x404f('0x23')](respondWithResult(_0x396233,null))[_0x404f('0x2d')](handleError(_0x396233,null));};exports[_0x404f('0x76')]=function(_0x3b705b,_0x16df9e,_0x3f6bed){var _0x278322={'raw':![],'where':{}};var _0x18f6d1={};var _0x29a4b3={'count':0x0,'rows':[]};return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x3b705b[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x16df9e,null))['then'](function(_0x31e6f6){if(_0x31e6f6){_0x18f6d1['model']=_['keys'](db[_0x404f('0x77')]['rawAttributes']);_0x18f6d1['query']=_['keys'](_0x3b705b[_0x404f('0x48')]);_0x18f6d1[_0x404f('0x51')]=_['intersection'](_0x18f6d1['model'],_0x18f6d1[_0x404f('0x48')]);_0x278322['attributes']=_[_0x404f('0x5d')](_0x18f6d1[_0x404f('0x47')],qs['fields'](_0x3b705b[_0x404f('0x48')][_0x404f('0x4b')]));_0x278322[_0x404f('0x4a')]=_0x278322[_0x404f('0x4a')]['length']?_0x278322[_0x404f('0x4a')]:_0x18f6d1['model'];if(!_0x3b705b[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x278322[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x3b705b['query']['limit']);_0x278322[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x3b705b['query']['offset']);}_0x278322['order']=qs[_0x404f('0x4f')](_0x3b705b['query'][_0x404f('0x4f')]);_0x278322['where']=qs['filters'](_['pick'](_0x3b705b[_0x404f('0x48')],_0x18f6d1[_0x404f('0x51')]));_0x278322[_0x404f('0x50')]['FaxAccountId']=_0x31e6f6['id'];if(_0x3b705b[_0x404f('0x48')][_0x404f('0x53')]){_0x278322[_0x404f('0x50')]=_['merge'](_0x278322[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x278322['attributes'],function(_0x16cd88){var _0x1ee127={};_0x1ee127[_0x16cd88]={'$like':'%'+_0x3b705b[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x1ee127;})});}_0x278322=_[_0x404f('0x54')]({},_0x278322,_0x3b705b[_0x404f('0x56')]);return db['FaxInteraction'][_0x404f('0x35')]({'where':_0x278322[_0x404f('0x50')]})[_0x404f('0x23')](function(_0xa1a8b4){_0x29a4b3[_0x404f('0x35')]=_0xa1a8b4;if(_0x3b705b['query'][_0x404f('0x6c')]){_0x278322[_0x404f('0x57')]=[{'model':db['CmContact'],'as':_0x404f('0x78'),'required':![]},{'model':db[_0x404f('0x79')],'as':'Owner','attributes':[_0x404f('0x3e'),_0x404f('0x7a'),_0x404f('0x7b')],'required':![]},{'model':db[_0x404f('0x7c')],'as':'Tags','attributes':['id',_0x404f('0x3e'),_0x404f('0x7d')],'where':_0x3b705b[_0x404f('0x48')]['tag']?{'id':_0x3b705b['query'][_0x404f('0x7e')]}:undefined,'required':_0x3b705b[_0x404f('0x48')][_0x404f('0x7e')]?!![]:![]}];}return db['FaxInteraction'][_0x404f('0x59')](_0x278322);})['then'](function(_0x1fbfdb){_0x29a4b3['rows']=_0x1fbfdb;return _0x29a4b3;});}})[_0x404f('0x23')](respondWithFilteredResult(_0x16df9e,_0x278322))[_0x404f('0x2d')](handleError(_0x16df9e,null));};exports[_0x404f('0x7f')]=function(_0x405d55,_0x208524){var _0x5e7188=_0x405d55[_0x404f('0x5c')]['id'];var _0x14f1fc=_0x405d55[_0x404f('0x5f')];var _0x2383ce=0xc8;var _0x4b4d60=null;return db[_0x404f('0x80')][_0x404f('0x81')]({'isolationLevel':db[_0x404f('0x80')][_0x404f('0x82')][_0x404f('0x83')][_0x404f('0x84')]},function(_0x14fa2b){return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x5e7188},'transaction':_0x14fa2b})['then'](function(_0xb45e4){if(_0xb45e4){return db[_0x404f('0x85')][_0x404f('0x39')]({'where':{'FaxAccountId':_0x5e7188},'transaction':_0x14fa2b})[_0x404f('0x23')](function(){var _0x5dd41d=_['map'](_0x14f1fc,function(_0x169114){_0x169114[_0x404f('0x6a')]=_0x5e7188;return _0x169114;});return db[_0x404f('0x85')]['bulkCreate'](_0x5dd41d,{'transaction':_0x14fa2b});});}else{_0x2383ce=0x194;_0x4b4d60=[];}});})[_0x404f('0x23')](function(){if(_0x2383ce!==0x194){return db[_0x404f('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x5e7188},'order':'priority'})[_0x404f('0x23')](function(_0xb911f7){_0x4b4d60=_0xb911f7;});}})[_0x404f('0x2d')](function(_0x33f233){_0x2383ce=0x1f4;logger[_0x404f('0x29')](_0x33f233[_0x404f('0x3d')]);if(_0x33f233[_0x404f('0x3e')]){delete _0x33f233[_0x404f('0x3e')];}_0x4b4d60=_0x33f233;})[_0x404f('0x86')](function(){if(_0x4b4d60===null){_0x208524[_0x404f('0x2e')](_0x2383ce);}else{if(_0x2383ce===0x1f4){_0x208524[_0x404f('0x2f')](_0x2383ce)[_0x404f('0x3f')](_0x4b4d60);}else{_0x208524[_0x404f('0x2f')](_0x2383ce)['json'](_0x4b4d60);}}});};exports[_0x404f('0x87')]=function(_0x32cc6e,_0x338cf2,_0x3a123e){var _0x20be50={};var _0x6f2aff={};var _0x223752;var _0x5f00c9;return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x32cc6e[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x338cf2,null))[_0x404f('0x23')](function(_0x381c29){if(_0x381c29){_0x223752=_0x381c29;_0x6f2aff[_0x404f('0x47')]=_[_0x404f('0x49')](db['FaxApplication'][_0x404f('0x43')]);_0x6f2aff[_0x404f('0x48')]=_[_0x404f('0x49')](_0x32cc6e[_0x404f('0x48')]);_0x6f2aff[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x6f2aff[_0x404f('0x47')],_0x6f2aff[_0x404f('0x48')]);_0x20be50[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x6f2aff[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x32cc6e[_0x404f('0x48')]['fields']));_0x20be50[_0x404f('0x4a')]=_0x20be50['attributes'][_0x404f('0x4c')]?_0x20be50[_0x404f('0x4a')]:_0x6f2aff[_0x404f('0x47')];_0x20be50[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x32cc6e[_0x404f('0x48')][_0x404f('0x4f')]);_0x20be50[_0x404f('0x50')]=qs[_0x404f('0x51')](_['pick'](_0x32cc6e[_0x404f('0x48')],_0x6f2aff['filters']));if(_0x32cc6e[_0x404f('0x48')]['filter']){_0x20be50['where']=_[_0x404f('0x54')](_0x20be50[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x20be50[_0x404f('0x4a')],function(_0x542ac9){var _0x56821d={};_0x56821d[_0x542ac9]={'$like':'%'+_0x32cc6e[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x56821d;})});}_0x20be50=_[_0x404f('0x54')]({},_0x20be50,_0x32cc6e[_0x404f('0x56')]);return _0x223752[_0x404f('0x87')](_0x20be50);}})['then'](function(_0x26b5e0){if(_0x26b5e0){_0x5f00c9=_0x26b5e0['length'];if(!_0x32cc6e['query']['hasOwnProperty']('nolimit')){_0x20be50['limit']=qs['limit'](_0x32cc6e['query'][_0x404f('0x34')]);_0x20be50[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x32cc6e[_0x404f('0x48')]['offset']);}return _0x223752[_0x404f('0x87')](_0x20be50);}})[_0x404f('0x23')](function(_0x17ea68){if(_0x17ea68){return _0x17ea68?{'count':_0x5f00c9,'rows':_0x17ea68}:null;}})[_0x404f('0x23')](respondWithResult(_0x338cf2,null))['catch'](handleError(_0x338cf2,null));};function Extension(_0x4e5614,_0x4220fc,_0x4ff1f8,_0xadbde2){this[_0x404f('0x88')]=_0x404f('0x89');this[_0x404f('0x8a')]=_0x4e5614[_0x404f('0x8b')];this[_0x404f('0x8c')]=_0xadbde2;this['type']='system';this[_0x404f('0x8d')]='Fax\x20Extension';this[_0x404f('0x6a')]=_0x4e5614['id'];this['priority']=_0x4220fc;this['appdata']=_0x4ff1f8;}function createExtensionsReciveFax(_0x347115){var _0x4b91a7=0x1;var _0x61b440=[];_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'','Answer'));_0x4b91a7+=0x1;_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,_0x404f('0x8f'),_0x404f('0x90')));_0x4b91a7+=0x1;for(var _0x14ae38 in _0x347115){if(_0x347115[_0x404f('0x72')](_0x14ae38)&&(_0x14ae38===_0x404f('0x91')||_0x14ae38===_0x404f('0x8b')||_0x14ae38===_0x404f('0x92')||_0x14ae38===_0x404f('0x93')||_0x14ae38===_0x404f('0x94')||_0x14ae38==='maxrate'||_0x14ae38===_0x404f('0x95')||_0x14ae38==='modem'||_0x14ae38===_0x404f('0x96'))){_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'FAXOPT('+_0x14ae38+')='+_0x347115[_0x14ae38],'Set'));_0x4b91a7+=0x1;}}_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'6',_0x404f('0x97')));_0x4b91a7+=0x1;_0x61b440['push'](new Extension(_0x347115,_0x4b91a7,_0x404f('0x98'),'ReceiveFax'));_0x4b91a7=0x0;return _0x61b440;}exports[_0x404f('0x99')]=function(_0x5361f8,_0x4a8c09,_0x1eedeb){var _0x314643;return db[_0x404f('0x80')][_0x404f('0x81')](function(_0x30d8c6){return db[_0x404f('0x58')][_0x404f('0x5e')](_0x5361f8[_0x404f('0x5f')],{'transaction':_0x30d8c6})[_0x404f('0x23')](function(_0xaf2faf){_0x314643=_0xaf2faf[_0x404f('0x3a')]({'plain':!![]});return db['VoiceExtension'][_0x404f('0x9a')](createExtensionsReciveFax(_0x314643),{'transaction':_0x30d8c6});});})[_0x404f('0x23')](function(){return _0x314643;})['then'](respondWithResult(_0x4a8c09,null))[_0x404f('0x2d')](handleError(_0x4a8c09,null));};exports[_0x404f('0x9b')]=function(_0x273529,_0x332bd8,_0x379dae){var _0x1bd28a;return db[_0x404f('0x80')][_0x404f('0x81')](function(_0x46ad4b){return db[_0x404f('0x58')][_0x404f('0x66')](_0x273529[_0x404f('0x5f')],{'where':{'id':_0x273529[_0x404f('0x5f')]['id']},'transaction':_0x46ad4b})[_0x404f('0x23')](function(_0x77f1db){return db[_0x404f('0x9c')][_0x404f('0x39')]({'where':{'FaxAccountId':_0x273529['body']['id']},'transaction':_0x46ad4b})[_0x404f('0x23')](function(_0x3cee1d){return db['VoiceExtension'][_0x404f('0x9a')](createExtensionsReciveFax(_[_0x404f('0x75')](_0x273529[_0x404f('0x5f')],[_0x404f('0x9d'),_0x404f('0x46'),_0x404f('0x9e'),'updatedAt',_0x404f('0x9f'),'ListId'])),{'transaction':_0x46ad4b});});});})[_0x404f('0x23')](function(){return db[_0x404f('0x58')][_0x404f('0xa0')](_0x273529[_0x404f('0x5f')]['id']);})['then'](respondWithResult(_0x332bd8,null))[_0x404f('0x2d')](handleError(_0x332bd8,null));};exports['getMessages']=function(_0x5e3d0b,_0x1ae28c,_0x777ec5){var _0x81437c={'raw':!![],'where':{}};var _0x56f206={};var _0x29a0f8={'count':0x0,'rows':[]};return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x5e3d0b['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x1ae28c,null))[_0x404f('0x23')](function(_0x1d336e){if(_0x1d336e){_0x56f206[_0x404f('0x47')]=_[_0x404f('0x49')](db[_0x404f('0xa1')]['rawAttributes']);_0x56f206['query']=_[_0x404f('0x49')](_0x5e3d0b[_0x404f('0x48')]);_0x56f206[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x56f206[_0x404f('0x47')],_0x56f206[_0x404f('0x48')]);_0x81437c['attributes']=_[_0x404f('0x5d')](_0x56f206[_0x404f('0x47')],qs['fields'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x4b')]));_0x81437c[_0x404f('0x4a')]=_0x81437c['attributes'][_0x404f('0x4c')]?_0x81437c[_0x404f('0x4a')]:_0x56f206[_0x404f('0x47')];if(!_0x5e3d0b[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x81437c[_0x404f('0x34')]=qs['limit'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x34')]);_0x81437c['offset']=qs['offset'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x32')]);}_0x81437c[_0x404f('0x4e')]=qs['sort'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x4f')]);_0x81437c['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5e3d0b['query'],_0x56f206[_0x404f('0x51')]));_0x81437c[_0x404f('0x50')][_0x404f('0x6a')]=_0x1d336e['id'];if(_0x5e3d0b['query'][_0x404f('0x53')]){_0x81437c[_0x404f('0x50')]=_[_0x404f('0x54')](_0x81437c[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x81437c[_0x404f('0x4a')],function(_0x45035e){var _0x4e5bb6={};_0x4e5bb6[_0x45035e]={'$like':'%'+_0x5e3d0b[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x4e5bb6;})});}if(_0x5e3d0b[_0x404f('0x48')][_0x404f('0xa2')]){var _0x271210=_0x5e3d0b['query'][_0x404f('0xa2')][_0x404f('0xa3')](',');var _0x54c40e={};_0x54c40e[_0x271210[0x0]]={'$gte':moment(_0x271210[0x1])[_0x404f('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x81437c[_0x404f('0x50')]=_[_0x404f('0x54')](_0x81437c[_0x404f('0x50')],_0x54c40e);}_0x81437c=_[_0x404f('0x54')]({},_0x81437c,_0x5e3d0b[_0x404f('0x56')]);return db[_0x404f('0xa1')][_0x404f('0x35')]({'where':_0x81437c[_0x404f('0x50')]})[_0x404f('0x23')](function(_0x180736){_0x29a0f8[_0x404f('0x35')]=_0x180736;if(_0x5e3d0b[_0x404f('0x48')]['includeAll']){_0x81437c[_0x404f('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x404f('0x59')](_0x81437c);})[_0x404f('0x23')](function(_0x32fed6){_0x29a0f8[_0x404f('0x5a')]=_0x32fed6;return _0x29a0f8;});}})['then'](respondWithFilteredResult(_0x1ae28c,_0x81437c))[_0x404f('0x2d')](handleError(_0x1ae28c,null));};exports[_0x404f('0x3f')]=function(_0x1635b0,_0x12ee8f,_0x49282a){var _0x4815ee,_0x113f9e={},_0x26a79b;if(_0x1635b0[_0x404f('0x5f')]['to']){_0x26a79b=_0x1635b0[_0x404f('0x5f')]['to'][0x0];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x1635b0[_0x404f('0x5c')]['id']},'include':[{'model':db[_0x404f('0xa5')],'as':_0x404f('0xa6'),'include':[{'model':db[_0x404f('0xa7')],'as':_0x404f('0xa8'),'where':{'fax':_0x26a79b},'limit':0x1,'order':[[_0x404f('0xa9'),_0x404f('0xaa')]]}]}]})[_0x404f('0x23')](handleEntityNotFound(_0x12ee8f,null))[_0x404f('0x23')](function(_0x295c0c){_0x4815ee=_0x295c0c;if(_0x1635b0[_0x404f('0x5f')]['attachments']&&_0x1635b0['body'][_0x404f('0xab')][_0x404f('0x4c')]){for(var _0x1deb63=0x0;_0x1deb63<_0x1635b0['body'][_0x404f('0xab')][_0x404f('0x4c')];_0x1deb63+=0x1){_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][_0x1deb63]={'filename':_0x1635b0['body'][_0x404f('0xab')][_0x1deb63]['name'],'id':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][_0x1deb63]['id'],'path':path[_0x404f('0xac')](config[_0x404f('0xad')],_0x404f('0xae'),_0x1635b0['body']['attachments'][_0x1deb63][_0x404f('0xaf')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x404f('0xb0')](_0x1635b0['params']['id'])?undefined:_0x1635b0[_0x404f('0x5c')]['id'],'path':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')])?undefined:_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')],'fax':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')]['to'][0x0])?undefined:_0x1635b0[_0x404f('0x5f')]['to'][0x0]},client9002);})[_0x404f('0x23')](function(){if(_0x4815ee){if(_['isNil'](_0x1635b0[_0x404f('0x5f')][_0x404f('0xb1')])){_0x1635b0[_0x404f('0x5f')][_0x404f('0xb1')]=util[_0x404f('0xa4')](_0x404f('0xb2'),_0x4815ee['name'],_0x4815ee[_0x404f('0xb3')]);}if(_0x4815ee[_0x404f('0xa6')]){if(_0x4815ee['List']['Contacts'][_0x404f('0x4c')]){return _0x4815ee[_0x404f('0xa6')][_0x404f('0xa8')][0x0];}else{return db[_0x404f('0xa7')][_0x404f('0x5e')](_['defaults'](_0x1635b0[_0x404f('0x5f')],{'firstName':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'phone':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'fax':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'ListId':_0x4815ee['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x404f('0x23')](function(_0x4b1b3b){if(_0x4b1b3b){return db['FaxInteraction'][_0x404f('0x67')]({'where':{'ContactId':_0x4b1b3b['id'],'closed':![],'FaxAccountId':_0x4815ee['id']}})[_0x404f('0x23')](function(_0xaebfd7){if(_0xaebfd7){return[_0xaebfd7,![]];}return db[_0x404f('0x77')][_0x404f('0x5e')]({'UserId':_0x1635b0[_0x404f('0x60')]['id'],'ContactId':_0x4b1b3b['id'],'FaxAccountId':_0x4815ee['id'],'fax':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x404f('0x54')](_0x1635b0['body'],{'read':![],'body':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0xb4')],'FaxAccountId':_0x4815ee['id'],'UserId':_0x1635b0[_0x404f('0x60')]['id'],'ContactId':_0x4b1b3b['id'],'AttachmentId':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x404f('0xa1')],'as':'Messages'}]})[_0x404f('0x23')](function(_0x59883b){return[_0x59883b,!![]];});});}else{throw new Error(_0x404f('0xb5'));}})['spread'](function(_0x589545,_0x14573a){if(_0x14573a){return _0x589545;}return db[_0x404f('0xa1')][_0x404f('0x5e')]({'direction':'out','read':![],'body':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0xb4')],'FaxAccountId':_0x4815ee['id'],'FaxInteractionId':_0x589545['id'],'UserId':_0x1635b0['user']['id'],'ContactId':_0x589545[_0x404f('0xb6')],'AttachmentId':_0x1635b0['body'][_0x404f('0xab')][0x0]['id']})['then'](function(_0xf1be5c){_0x589545[_0x404f('0xb7')][_0x404f('0xb8')]=[];_0x589545[_0x404f('0xb7')][_0x404f('0xb8')][_0x404f('0x8e')](_0xf1be5c[_0x404f('0xb7')]);return _0x589545;});})[_0x404f('0x23')](function(_0x119afe){respondWithRpcPromise(_0x404f('0xb9'),_0x404f('0xb9'),{'FaxAccountId':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5c')]['id'])?undefined:_0x1635b0[_0x404f('0x5c')]['id'],'path':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')])?undefined:_0x1635b0[_0x404f('0x5f')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x1635b0['body']['to'][0x0])?undefined:_0x1635b0['body']['to'][0x0],'AttachmentId':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0]['id']},client9002)[_0x404f('0x23')](function(_0x5dd662){logger[_0x404f('0x24')]('SendFaxRpc,\x20%s',_0x5dd662);})['catch'](function(_0x1f7c07){logger[_0x404f('0x24')](_0x404f('0xba'),_0x1f7c07);});return _0x119afe;})['then'](respondWithResult(_0x12ee8f,null))[_0x404f('0x2d')](handleError(_0x12ee8f,null));};exports[_0x404f('0xbb')]=function(_0x4d9b44,_0x4a25dd,_0xfa37e1){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x4d9b44['params']['id']}})['then'](handleEntityNotFound(_0x4a25dd,null))['then'](function(_0xe2e5e6){if(_0xe2e5e6){return _0xe2e5e6[_0x404f('0xbb')](_0x4d9b44['body'][_0x404f('0x6e')],_[_0x404f('0x75')](_0x4d9b44[_0x404f('0x5f')],[_0x404f('0x6e'),'id'])||{})[_0x404f('0xbc')](function(_0x5b905e){for(var _0xebf22d=0x0;_0xebf22d<_0x4d9b44[_0x404f('0x5f')][_0x404f('0x6e')][_0x404f('0x4c')];_0xebf22d+=0x1){socket[_0x404f('0xbd')](_0x404f('0xbe'),{'UserId':Number(_0x4d9b44[_0x404f('0x5f')][_0x404f('0x6e')][_0xebf22d]),'FaxAccountId':Number(_0x4d9b44[_0x404f('0x5c')]['id'])});}return _0x5b905e;});}})[_0x404f('0x23')](respondWithResult(_0x4a25dd,null))[_0x404f('0x2d')](handleError(_0x4a25dd,null));};exports[_0x404f('0xbf')]=function(_0x5986df,_0x2e3491,_0x369e45){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x5986df[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x2e3491,null))['then'](function(_0x343e89){if(_0x343e89){return _0x343e89[_0x404f('0xbf')](_0x5986df[_0x404f('0x48')][_0x404f('0x6e')])[_0x404f('0x23')](function(){if(_[_0x404f('0xc0')](_0x5986df[_0x404f('0x48')][_0x404f('0x6e')])){for(var _0x552f68=0x0;_0x552f68<_0x5986df[_0x404f('0x48')][_0x404f('0x6e')]['length'];_0x552f68+=0x1){socket[_0x404f('0xbd')](_0x404f('0xc1'),{'UserId':Number(_0x5986df[_0x404f('0x48')][_0x404f('0x6e')][_0x552f68]),'FaxAccountId':Number(_0x5986df[_0x404f('0x5c')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5986df[_0x404f('0x48')][_0x404f('0x6e')]),'FaxAccountId':Number(_0x5986df[_0x404f('0x5c')]['id'])});}});}})[_0x404f('0x23')](respondWithStatusCode(_0x2e3491,null))[_0x404f('0x2d')](handleError(_0x2e3491,null));};exports[_0x404f('0xc2')]=function(_0x161163,_0x59f461,_0x4b6eca){var _0x4f50e7={};var _0x11488c={};var _0x4c1240;var _0x1cb4e3;return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x161163[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x59f461,null))[_0x404f('0x23')](function(_0xa05a7d){if(_0xa05a7d){_0x4c1240=_0xa05a7d;_0x11488c[_0x404f('0x47')]=_['keys'](db[_0x404f('0x79')][_0x404f('0x43')]);_0x11488c['query']=_[_0x404f('0x49')](_0x161163[_0x404f('0x48')]);_0x11488c['filters']=_[_0x404f('0x5d')](_0x11488c['model'],_0x11488c[_0x404f('0x48')]);_0x4f50e7['attributes']=_[_0x404f('0x5d')](_0x11488c[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x161163[_0x404f('0x48')]['fields']));_0x4f50e7[_0x404f('0x4a')]=_0x4f50e7['attributes']['length']?_0x4f50e7[_0x404f('0x4a')]:_0x11488c[_0x404f('0x47')];_0x4f50e7[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x161163[_0x404f('0x48')][_0x404f('0x4f')]);_0x4f50e7['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x161163[_0x404f('0x48')],_0x11488c[_0x404f('0x51')]));if(_0x161163[_0x404f('0x48')][_0x404f('0x53')]){_0x4f50e7['where']=_[_0x404f('0x54')](_0x4f50e7[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x4f50e7['attributes'],function(_0xef2a14){var _0x288f7c={};_0x288f7c[_0xef2a14]={'$like':'%'+_0x161163[_0x404f('0x48')]['filter']+'%'};return _0x288f7c;})});}_0x4f50e7=_[_0x404f('0x54')]({},_0x4f50e7,_0x161163[_0x404f('0x56')]);return _0x4c1240[_0x404f('0xc2')](_0x4f50e7);}})[_0x404f('0x23')](function(_0x511b55){if(_0x511b55){_0x1cb4e3=_0x511b55['length'];if(!_0x161163[_0x404f('0x48')][_0x404f('0x72')]('nolimit')){_0x4f50e7[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x161163[_0x404f('0x48')]['limit']);_0x4f50e7[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x161163[_0x404f('0x48')]['offset']);}return _0x4c1240[_0x404f('0xc2')](_0x4f50e7);}})[_0x404f('0x23')](function(_0x25479e){if(_0x25479e){return _0x25479e?{'count':_0x1cb4e3,'rows':_0x25479e}:null;}})[_0x404f('0x23')](respondWithResult(_0x59f461,null))[_0x404f('0x2d')](handleError(_0x59f461,null));}; \ No newline at end of file +var _0x878f=['exten','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','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','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','get','FaxAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','addAnswer','CannedAnswer','rawAttributes','removeAnswers','ids','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider'];(function(_0x255119,_0x42c1e5){var _0xf5ac85=function(_0x48b017){while(--_0x48b017){_0x255119['push'](_0x255119['shift']());}};_0xf5ac85(++_0x42c1e5);}(_0x878f,0x1c0));var _0xf878=function(_0x51f6c5,_0x846849){_0x51f6c5=_0x51f6c5-0x0;var _0x562c8c=_0x878f[_0x51f6c5];return _0x562c8c;};'use strict';var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require('path');var sox=require(_0xf878('0x8'));var csv=require(_0xf878('0x9'));var ejs=require(_0xf878('0xa'));var fs=require('fs');var fs_extra=require(_0xf878('0xb'));var _=require('lodash');var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf878('0xd'));var toCsv=require(_0xf878('0x9'));var querystring=require('querystring');var Papa=require(_0xf878('0xe'));var Redis=require(_0xf878('0xf'));var authService=require(_0xf878('0x10'));var qs=require(_0xf878('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x12'));var logger=require('../../config/logger')(_0xf878('0x13'));var utils=require(_0xf878('0x14'));var config=require(_0xf878('0x15'));var licenseUtil=require(_0xf878('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf878('0x17'),'port':0x18eb});var socket=require(_0xf878('0x18'))(new Redis(config[_0xf878('0x19')]));require(_0xf878('0x1a'))[_0xf878('0x1b')](socket);var jayson=require(_0xf878('0x1c'));var client=jayson[_0xf878('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf878('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x52ad44,_0x3e045a,_0x510871,_0x57319c){return new BPromise(function(_0xf9177a,_0x5d28e9){var _0x62a0b0=_0x57319c||client;return _0x62a0b0[_0xf878('0x1f')](_0x52ad44,_0x510871)[_0xf878('0x20')](function(_0x4656a8){logger[_0xf878('0x21')](_0xf878('0x22'),_0x3e045a,_0xf878('0x23'));logger[_0xf878('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3e045a,_0xf878('0x23'),JSON['stringify'](_0x4656a8));if(_0x4656a8[_0xf878('0x25')]){if(_0x4656a8[_0xf878('0x25')]['code']===0x1f4){logger[_0xf878('0x25')](_0xf878('0x22'),_0x3e045a,_0x4656a8['error'][_0xf878('0x26')]);return _0x5d28e9(_0x4656a8[_0xf878('0x25')]['message']);}logger[_0xf878('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3e045a,_0x4656a8[_0xf878('0x25')][_0xf878('0x26')]);return _0xf9177a(_0x4656a8[_0xf878('0x25')]['message']);}else{logger[_0xf878('0x21')](_0xf878('0x22'),_0x3e045a,_0xf878('0x23'));_0xf9177a(_0x4656a8['result']['message']);}})[_0xf878('0x27')](function(_0x1a997c){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3e045a,_0x1a997c);_0x5d28e9(_0x1a997c);});});}function respondWithStatusCode(_0x5cd358,_0xb938bb){_0xb938bb=_0xb938bb||0xcc;return function(_0x3d1bd9){if(_0x3d1bd9){return _0x5cd358[_0xf878('0x28')](_0xb938bb);}return _0x5cd358['status'](_0xb938bb)['end']();};}function respondWithResult(_0x9a23f5,_0x2df0ce){_0x2df0ce=_0x2df0ce||0xc8;return function(_0x2f931e){if(_0x2f931e){return _0x9a23f5[_0xf878('0x29')](_0x2df0ce)[_0xf878('0x2a')](_0x2f931e);}};}function respondWithFilteredResult(_0x2f01e7,_0x35aa02){return function(_0x477308){if(_0x477308){var _0x39b41f=typeof _0x35aa02[_0xf878('0x2b')]===_0xf878('0x2c')&&typeof _0x35aa02[_0xf878('0x2d')]===_0xf878('0x2c');var _0xda5422=_0x477308['count'];var _0x3c34b2=_0x39b41f?0x0:_0x35aa02[_0xf878('0x2b')];var _0x28d26e=_0x39b41f?_0x477308[_0xf878('0x2e')]:_0x35aa02[_0xf878('0x2b')]+_0x35aa02['limit'];var _0x5e5fc8;if(_0x28d26e>=_0xda5422){_0x28d26e=_0xda5422;_0x5e5fc8=0xc8;}else{_0x5e5fc8=0xce;}_0x2f01e7[_0xf878('0x29')](_0x5e5fc8);return _0x2f01e7['set'](_0xf878('0x2f'),_0x3c34b2+'-'+_0x28d26e+'/'+_0xda5422)[_0xf878('0x2a')](_0x477308);}return null;};}function patchUpdates(_0x5c26b2){return function(_0x1dd264){try{jsonpatch['apply'](_0x1dd264,_0x5c26b2,!![]);}catch(_0x3a58d8){return BPromise[_0xf878('0x30')](_0x3a58d8);}return _0x1dd264['save']();};}function saveUpdates(_0x13f89a,_0x5de99f){return function(_0x252704){if(_0x252704){return _0x252704[_0xf878('0x31')](_0x13f89a)[_0xf878('0x20')](function(_0x202d1f){return _0x202d1f;});}return null;};}function removeEntity(_0x20fea6,_0x530c0){return function(_0x362570){if(_0x362570){return _0x362570[_0xf878('0x32')]()[_0xf878('0x20')](function(){var _0x3247bb=_0x362570[_0xf878('0x33')]({'plain':!![]});var _0x41e936=_0xf878('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x41e936,'resourceId':_0x3247bb['id']}})[_0xf878('0x20')](function(){return _0x362570;});})[_0xf878('0x20')](function(){_0x20fea6[_0xf878('0x29')](0xcc)[_0xf878('0x35')]();});}};}function handleEntityNotFound(_0x880d74,_0x1f32c1){return function(_0x4bc82d){if(!_0x4bc82d){_0x880d74[_0xf878('0x28')](0x194);}return _0x4bc82d;};}function handleError(_0x14de9a,_0xb9720a){_0xb9720a=_0xb9720a||0x1f4;return function(_0x2bde38){logger[_0xf878('0x25')](_0x2bde38[_0xf878('0x36')]);if(_0x2bde38[_0xf878('0x37')]){delete _0x2bde38['name'];}_0x14de9a['status'](_0xb9720a)[_0xf878('0x38')](_0x2bde38);};}exports[_0xf878('0x39')]=function(_0x17e908,_0x43a1fd){var _0x55c51d={'include':[{'model':db[_0xf878('0x3a')],'as':_0xf878('0x3b')}]},_0x572d00={},_0xae79eb={'count':0x0,'rows':[]};var _0x2ea35e=_[_0xf878('0x3c')](db[_0xf878('0x3d')]['rawAttributes'],function(_0x41e07f){return{'name':_0x41e07f[_0xf878('0x3e')],'type':_0x41e07f[_0xf878('0x3f')][_0xf878('0x40')]};});_0x572d00[_0xf878('0x41')]=_[_0xf878('0x3c')](_0x2ea35e,_0xf878('0x37'));_0x572d00[_0xf878('0x42')]=_['keys'](_0x17e908[_0xf878('0x42')]);_0x572d00[_0xf878('0x43')]=_[_0xf878('0x44')](_0x572d00[_0xf878('0x41')],_0x572d00[_0xf878('0x42')]);_0x55c51d[_0xf878('0x45')]=_[_0xf878('0x44')](_0x572d00[_0xf878('0x41')],qs[_0xf878('0x46')](_0x17e908['query'][_0xf878('0x46')]));_0x55c51d[_0xf878('0x45')]=_0x55c51d[_0xf878('0x45')][_0xf878('0x47')]?_0x55c51d[_0xf878('0x45')]:_0x572d00[_0xf878('0x41')];if(!_0x17e908[_0xf878('0x42')][_0xf878('0x48')]('nolimit')){_0x55c51d[_0xf878('0x2d')]=qs[_0xf878('0x2d')](_0x17e908[_0xf878('0x42')][_0xf878('0x2d')]);_0x55c51d[_0xf878('0x2b')]=qs['offset'](_0x17e908[_0xf878('0x42')][_0xf878('0x2b')]);}_0x55c51d[_0xf878('0x49')]=qs['sort'](_0x17e908[_0xf878('0x42')][_0xf878('0x4a')]);_0x55c51d[_0xf878('0x4b')]=qs[_0xf878('0x43')](_['pick'](_0x17e908['query'],_0x572d00[_0xf878('0x43')]),_0x2ea35e);if(_0x17e908[_0xf878('0x42')][_0xf878('0x4c')]){_0x55c51d['where']=_[_0xf878('0x4d')](_0x55c51d[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x2ea35e,function(_0x140dc7){if(_0x140dc7[_0xf878('0x3f')]!==_0xf878('0x4e')){var _0x34c177={};_0x34c177[_0x140dc7['name']]={'$like':'%'+_0x17e908[_0xf878('0x42')][_0xf878('0x4c')]+'%'};return _0x34c177;}})});}_0x55c51d=_[_0xf878('0x4d')]({},_0x55c51d,_0x17e908[_0xf878('0x4f')]);var _0x21679f={'where':_0x55c51d[_0xf878('0x4b')]};return db[_0xf878('0x3d')][_0xf878('0x2e')](_0x21679f)[_0xf878('0x20')](function(_0x5a0421){_0xae79eb[_0xf878('0x2e')]=_0x5a0421;if(_0x17e908[_0xf878('0x42')][_0xf878('0x50')]){_0x55c51d[_0xf878('0x51')]=[{'all':!![]}];}return db['FaxAccount'][_0xf878('0x52')](_0x55c51d);})['then'](function(_0x355dc9){_0xae79eb[_0xf878('0x53')]=_0x355dc9;return _0xae79eb;})['then'](respondWithFilteredResult(_0x43a1fd,_0x55c51d))['catch'](handleError(_0x43a1fd,null));};exports['show']=function(_0x5cfd43,_0x5c3cd3){var _0x921e66={'raw':![],'where':{'id':_0x5cfd43[_0xf878('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xf878('0x3b')}]},_0x235d13={};_0x235d13['model']=_[_0xf878('0x55')](db[_0xf878('0x3d')]['rawAttributes']);_0x235d13['query']=_['keys'](_0x5cfd43['query']);_0x235d13[_0xf878('0x43')]=_[_0xf878('0x44')](_0x235d13[_0xf878('0x41')],_0x235d13['query']);_0x921e66[_0xf878('0x45')]=_[_0xf878('0x44')](_0x235d13[_0xf878('0x41')],qs[_0xf878('0x46')](_0x5cfd43[_0xf878('0x42')]['fields']));_0x921e66[_0xf878('0x45')]=_0x921e66[_0xf878('0x45')][_0xf878('0x47')]?_0x921e66[_0xf878('0x45')]:_0x235d13['model'];if(_0x5cfd43[_0xf878('0x42')]['includeAll']){_0x921e66[_0xf878('0x51')]=[{'all':!![]}];}_0x921e66=_[_0xf878('0x4d')]({},_0x921e66,_0x5cfd43[_0xf878('0x4f')]);return db[_0xf878('0x3d')]['find'](_0x921e66)[_0xf878('0x20')](handleEntityNotFound(_0x5c3cd3,null))[_0xf878('0x20')](respondWithResult(_0x5c3cd3,null))[_0xf878('0x27')](handleError(_0x5c3cd3,null));};exports[_0xf878('0x56')]=function(_0x4b9ddb,_0x35317e){return db['FaxAccount'][_0xf878('0x56')](_0x4b9ddb[_0xf878('0x57')],{})[_0xf878('0x20')](function(_0x53e220){var _0x8836f2=_0x4b9ddb[_0xf878('0x58')][_0xf878('0x33')]({'plain':!![]});if(!_0x8836f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8836f2[_0xf878('0x59')]==='user'){var _0x531740=_0x53e220[_0xf878('0x33')]({'plain':!![]});var _0x231abc=_0xf878('0x34');return db[_0xf878('0x5a')][_0xf878('0x5b')]({'where':{'name':_0x231abc,'userProfileId':_0x8836f2[_0xf878('0x5c')]},'raw':!![]})['then'](function(_0x4ff6ff){if(_0x4ff6ff&&_0x4ff6ff[_0xf878('0x5d')]===0x0){return db[_0xf878('0x5e')][_0xf878('0x56')]({'name':_0x531740[_0xf878('0x37')],'resourceId':_0x531740['id'],'type':_0x4ff6ff['name'],'sectionId':_0x4ff6ff['id']},{})[_0xf878('0x20')](function(){return _0x53e220;});}else{return _0x53e220;}})['catch'](function(_0x133f62){logger[_0xf878('0x25')](_0xf878('0x5f'),_0x133f62);throw _0x133f62;});}return _0x53e220;})[_0xf878('0x20')](respondWithResult(_0x35317e,0xc9))[_0xf878('0x27')](handleError(_0x35317e,null));};exports[_0xf878('0x31')]=function(_0x2c7a76,_0x21dca1){if(_0x2c7a76['body']['id']){delete _0x2c7a76['body']['id'];}return db[_0xf878('0x3d')][_0xf878('0x5b')]({'where':{'id':_0x2c7a76[_0xf878('0x54')]['id']},'include':[{'model':db[_0xf878('0x3a')],'as':_0xf878('0x3b')}]})[_0xf878('0x20')](handleEntityNotFound(_0x21dca1,null))[_0xf878('0x20')](saveUpdates(_0x2c7a76[_0xf878('0x57')],null))[_0xf878('0x20')](respondWithResult(_0x21dca1,null))[_0xf878('0x27')](handleError(_0x21dca1,null));};exports[_0xf878('0x32')]=function(_0x51927d,_0x5ed81e){return db['FaxAccount'][_0xf878('0x5b')]({'where':{'id':_0x51927d[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x5ed81e,null))[_0xf878('0x20')](removeEntity(_0x5ed81e,null))['catch'](handleError(_0x5ed81e,null));};exports[_0xf878('0x60')]=function(_0x4d0bf0,_0x59170e){return db[_0xf878('0x3d')]['describe']()['then'](respondWithResult(_0x59170e,null))['catch'](handleError(_0x59170e,null));};exports[_0xf878('0x61')]=function(_0x50a982,_0x3093b4,_0x3aeb69){if(_0x50a982[_0xf878('0x57')]['id']){delete _0x50a982['body']['id'];}return db[_0xf878('0x3d')]['find']({'where':{'id':_0x50a982['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x3093b4,null))[_0xf878('0x20')](function(_0x45158d){if(_0x45158d){_0x50a982['body'][_0xf878('0x62')]=_0x45158d['id'];return db[_0xf878('0x63')][_0xf878('0x56')](_0x50a982['body']);}})[_0xf878('0x20')](respondWithResult(_0x3093b4,null))['catch'](handleError(_0x3093b4,null));};exports[_0xf878('0x64')]=function(_0x1175bc,_0x5c6f87,_0x1086c2){var _0x14ea74={'raw':![],'where':{}};var _0x4dd15b={};var _0x70b78f={'count':0x0,'rows':[]};return db[_0xf878('0x3d')][_0xf878('0x65')]({'where':{'id':_0x1175bc[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x5c6f87,null))[_0xf878('0x20')](function(_0x1e7af6){if(_0x1e7af6){_0x4dd15b[_0xf878('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x4dd15b[_0xf878('0x42')]=_[_0xf878('0x55')](_0x1175bc[_0xf878('0x42')]);_0x4dd15b[_0xf878('0x43')]=_['intersection'](_0x4dd15b['model'],_0x4dd15b[_0xf878('0x42')]);_0x14ea74['attributes']=_['intersection'](_0x4dd15b[_0xf878('0x41')],qs[_0xf878('0x46')](_0x1175bc[_0xf878('0x42')][_0xf878('0x46')]));_0x14ea74[_0xf878('0x45')]=_0x14ea74[_0xf878('0x45')][_0xf878('0x47')]?_0x14ea74[_0xf878('0x45')]:_0x4dd15b[_0xf878('0x41')];if(!_0x1175bc[_0xf878('0x42')][_0xf878('0x48')](_0xf878('0x66'))){_0x14ea74[_0xf878('0x2d')]=qs['limit'](_0x1175bc[_0xf878('0x42')][_0xf878('0x2d')]);_0x14ea74[_0xf878('0x2b')]=qs[_0xf878('0x2b')](_0x1175bc[_0xf878('0x42')][_0xf878('0x2b')]);}_0x14ea74['order']=qs[_0xf878('0x4a')](_0x1175bc[_0xf878('0x42')][_0xf878('0x4a')]);_0x14ea74[_0xf878('0x4b')]=qs[_0xf878('0x43')](_[_0xf878('0x67')](_0x1175bc[_0xf878('0x42')],_0x4dd15b['filters']));_0x14ea74[_0xf878('0x4b')][_0xf878('0x62')]=_0x1e7af6['id'];if(_0x1175bc['query']['filter']){_0x14ea74[_0xf878('0x4b')]=_[_0xf878('0x4d')](_0x14ea74[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x14ea74[_0xf878('0x45')],function(_0x57fca4){var _0x4fab8a={};_0x4fab8a[_0x57fca4]={'$like':'%'+_0x1175bc[_0xf878('0x42')][_0xf878('0x4c')]+'%'};return _0x4fab8a;})});}_0x14ea74=_['merge']({},_0x14ea74,_0x1175bc[_0xf878('0x4f')]);return db['Disposition'][_0xf878('0x2e')]({'where':_0x14ea74['where']})[_0xf878('0x20')](function(_0x3053e2){_0x70b78f[_0xf878('0x2e')]=_0x3053e2;if(_0x1175bc[_0xf878('0x42')][_0xf878('0x50')]){_0x14ea74[_0xf878('0x51')]=[{'all':!![]}];}return db[_0xf878('0x63')][_0xf878('0x52')](_0x14ea74);})[_0xf878('0x20')](function(_0xf4adf5){_0x70b78f[_0xf878('0x53')]=_0xf4adf5;return _0x70b78f;});}})[_0xf878('0x20')](respondWithFilteredResult(_0x5c6f87,_0x14ea74))[_0xf878('0x27')](handleError(_0x5c6f87,null));};exports[_0xf878('0x68')]=function(_0x414f93,_0xbc6ded,_0xd2f07c){return db[_0xf878('0x3d')][_0xf878('0x5b')]({'where':{'id':_0x414f93[_0xf878('0x54')]['id']}})['then'](handleEntityNotFound(_0xbc6ded,null))[_0xf878('0x20')](function(_0x1c3da1){if(_0x1c3da1){return _0x1c3da1[_0xf878('0x68')](_0x414f93[_0xf878('0x42')]['ids']);}})[_0xf878('0x20')](respondWithStatusCode(_0xbc6ded,null))[_0xf878('0x27')](handleError(_0xbc6ded,null));};exports[_0xf878('0x69')]=function(_0x2114fa,_0x3c5f85,_0x4721dd){if(_0x2114fa[_0xf878('0x57')]['id']){delete _0x2114fa['body']['id'];}return db['FaxAccount'][_0xf878('0x5b')]({'where':{'id':_0x2114fa[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x3c5f85,null))['then'](function(_0x3c7412){if(_0x3c7412){_0x2114fa[_0xf878('0x57')][_0xf878('0x62')]=_0x3c7412['id'];return db['CannedAnswer'][_0xf878('0x56')](_0x2114fa[_0xf878('0x57')]);}})[_0xf878('0x20')](respondWithResult(_0x3c5f85,null))[_0xf878('0x27')](handleError(_0x3c5f85,null));};exports['getAnswers']=function(_0x56b77e,_0x5d84b5,_0x114f8f){var _0x5682c8={'raw':![],'where':{}};var _0x4ea858={};var _0x4b891d={'count':0x0,'rows':[]};return db[_0xf878('0x3d')]['findOne']({'where':{'id':_0x56b77e[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x5d84b5,null))[_0xf878('0x20')](function(_0x49708b){if(_0x49708b){_0x4ea858[_0xf878('0x41')]=_['keys'](db[_0xf878('0x6a')][_0xf878('0x6b')]);_0x4ea858[_0xf878('0x42')]=_[_0xf878('0x55')](_0x56b77e['query']);_0x4ea858[_0xf878('0x43')]=_[_0xf878('0x44')](_0x4ea858[_0xf878('0x41')],_0x4ea858['query']);_0x5682c8[_0xf878('0x45')]=_[_0xf878('0x44')](_0x4ea858[_0xf878('0x41')],qs[_0xf878('0x46')](_0x56b77e[_0xf878('0x42')][_0xf878('0x46')]));_0x5682c8[_0xf878('0x45')]=_0x5682c8[_0xf878('0x45')][_0xf878('0x47')]?_0x5682c8[_0xf878('0x45')]:_0x4ea858[_0xf878('0x41')];if(!_0x56b77e[_0xf878('0x42')][_0xf878('0x48')]('nolimit')){_0x5682c8[_0xf878('0x2d')]=qs[_0xf878('0x2d')](_0x56b77e[_0xf878('0x42')][_0xf878('0x2d')]);_0x5682c8[_0xf878('0x2b')]=qs['offset'](_0x56b77e[_0xf878('0x42')][_0xf878('0x2b')]);}_0x5682c8[_0xf878('0x49')]=qs['sort'](_0x56b77e['query'][_0xf878('0x4a')]);_0x5682c8[_0xf878('0x4b')]=qs['filters'](_[_0xf878('0x67')](_0x56b77e[_0xf878('0x42')],_0x4ea858['filters']));_0x5682c8[_0xf878('0x4b')][_0xf878('0x62')]=_0x49708b['id'];if(_0x56b77e[_0xf878('0x42')][_0xf878('0x4c')]){_0x5682c8[_0xf878('0x4b')]=_[_0xf878('0x4d')](_0x5682c8[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x5682c8[_0xf878('0x45')],function(_0x390dac){var _0x3d14eb={};_0x3d14eb[_0x390dac]={'$like':'%'+_0x56b77e['query'][_0xf878('0x4c')]+'%'};return _0x3d14eb;})});}_0x5682c8=_['merge']({},_0x5682c8,_0x56b77e[_0xf878('0x4f')]);return db[_0xf878('0x6a')][_0xf878('0x2e')]({'where':_0x5682c8[_0xf878('0x4b')]})[_0xf878('0x20')](function(_0xc27728){_0x4b891d[_0xf878('0x2e')]=_0xc27728;if(_0x56b77e[_0xf878('0x42')][_0xf878('0x50')]){_0x5682c8[_0xf878('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf878('0x52')](_0x5682c8);})[_0xf878('0x20')](function(_0x44b1ca){_0x4b891d[_0xf878('0x53')]=_0x44b1ca;return _0x4b891d;});}})[_0xf878('0x20')](respondWithFilteredResult(_0x5d84b5,_0x5682c8))[_0xf878('0x27')](handleError(_0x5d84b5,null));};exports['removeAnswers']=function(_0x54f34b,_0x5cc188,_0x2820c9){return db[_0xf878('0x3d')][_0xf878('0x5b')]({'where':{'id':_0x54f34b[_0xf878('0x54')]['id']}})['then'](handleEntityNotFound(_0x5cc188,null))[_0xf878('0x20')](function(_0x16920e){if(_0x16920e){return _0x16920e[_0xf878('0x6c')](_0x54f34b[_0xf878('0x42')][_0xf878('0x6d')]);}})['then'](respondWithStatusCode(_0x5cc188,null))[_0xf878('0x27')](handleError(_0x5cc188,null));};exports[_0xf878('0x6e')]=function(_0x32dce6,_0x17362e,_0x7198fd){return db['FaxInteraction']['find']({'where':{'id':_0x32dce6['params']['id']}})['then'](handleEntityNotFound(_0x17362e,null))[_0xf878('0x20')](function(_0x115b52){if(_0x115b52){return _0x115b52['addInteraction'](_0x32dce6['body'][_0xf878('0x6d')],_[_0xf878('0x6f')](_0x32dce6[_0xf878('0x57')],['ids','id'])||{});}})['then'](respondWithResult(_0x17362e,null))[_0xf878('0x27')](handleError(_0x17362e,null));};exports['getInteractions']=function(_0x494747,_0xf922a,_0x51c4b7){var _0x4ccc74={'raw':![],'where':{}};var _0x43e627={};var _0x45bb95={'count':0x0,'rows':[]};return db[_0xf878('0x3d')][_0xf878('0x65')]({'where':{'id':_0x494747[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0xf922a,null))['then'](function(_0x543a76){if(_0x543a76){_0x43e627[_0xf878('0x41')]=_['keys'](db['FaxInteraction'][_0xf878('0x6b')]);_0x43e627[_0xf878('0x42')]=_[_0xf878('0x55')](_0x494747[_0xf878('0x42')]);_0x43e627[_0xf878('0x43')]=_[_0xf878('0x44')](_0x43e627['model'],_0x43e627['query']);_0x4ccc74[_0xf878('0x45')]=_[_0xf878('0x44')](_0x43e627[_0xf878('0x41')],qs[_0xf878('0x46')](_0x494747[_0xf878('0x42')][_0xf878('0x46')]));_0x4ccc74[_0xf878('0x45')]=_0x4ccc74['attributes']['length']?_0x4ccc74[_0xf878('0x45')]:_0x43e627[_0xf878('0x41')];if(!_0x494747[_0xf878('0x42')][_0xf878('0x48')](_0xf878('0x66'))){_0x4ccc74[_0xf878('0x2d')]=qs[_0xf878('0x2d')](_0x494747['query'][_0xf878('0x2d')]);_0x4ccc74[_0xf878('0x2b')]=qs[_0xf878('0x2b')](_0x494747['query'][_0xf878('0x2b')]);}_0x4ccc74[_0xf878('0x49')]=qs[_0xf878('0x4a')](_0x494747[_0xf878('0x42')][_0xf878('0x4a')]);_0x4ccc74[_0xf878('0x4b')]=qs[_0xf878('0x43')](_[_0xf878('0x67')](_0x494747[_0xf878('0x42')],_0x43e627['filters']));_0x4ccc74[_0xf878('0x4b')][_0xf878('0x62')]=_0x543a76['id'];if(_0x494747['query'][_0xf878('0x4c')]){_0x4ccc74[_0xf878('0x4b')]=_['merge'](_0x4ccc74[_0xf878('0x4b')],{'$or':_['map'](_0x4ccc74[_0xf878('0x45')],function(_0xc927ac){var _0x1d3cc7={};_0x1d3cc7[_0xc927ac]={'$like':'%'+_0x494747['query'][_0xf878('0x4c')]+'%'};return _0x1d3cc7;})});}_0x4ccc74=_[_0xf878('0x4d')]({},_0x4ccc74,_0x494747[_0xf878('0x4f')]);return db[_0xf878('0x70')][_0xf878('0x2e')]({'where':_0x4ccc74[_0xf878('0x4b')]})[_0xf878('0x20')](function(_0x4a9743){_0x45bb95[_0xf878('0x2e')]=_0x4a9743;if(_0x494747[_0xf878('0x42')][_0xf878('0x50')]){_0x4ccc74[_0xf878('0x51')]=[{'model':db[_0xf878('0x71')],'as':_0xf878('0x72'),'required':![]},{'model':db[_0xf878('0x73')],'as':_0xf878('0x74'),'attributes':['name',_0xf878('0x75'),'internal'],'required':![]},{'model':db[_0xf878('0x76')],'as':_0xf878('0x77'),'attributes':['id',_0xf878('0x37'),_0xf878('0x78')],'where':_0x494747[_0xf878('0x42')][_0xf878('0x79')]?{'id':_0x494747['query'][_0xf878('0x79')]}:undefined,'required':_0x494747[_0xf878('0x42')][_0xf878('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xf878('0x52')](_0x4ccc74);})[_0xf878('0x20')](function(_0x525fa5){_0x45bb95[_0xf878('0x53')]=_0x525fa5;return _0x45bb95;});}})[_0xf878('0x20')](respondWithFilteredResult(_0xf922a,_0x4ccc74))[_0xf878('0x27')](handleError(_0xf922a,null));};exports['addApplications']=function(_0x38327a,_0x28a0dd){var _0x2aac50=_0x38327a[_0xf878('0x54')]['id'];var _0xc79f96=_0x38327a[_0xf878('0x57')];var _0x4eca29=0xc8;var _0x5a8633=null;return db[_0xf878('0x7a')][_0xf878('0x7b')]({'isolationLevel':db[_0xf878('0x7a')]['Transaction'][_0xf878('0x7c')][_0xf878('0x7d')]},function(_0x1cf775){return db[_0xf878('0x3d')]['findOne']({'where':{'id':_0x2aac50},'transaction':_0x1cf775})[_0xf878('0x20')](function(_0x315a32){if(_0x315a32){return db[_0xf878('0x7e')]['destroy']({'where':{'FaxAccountId':_0x2aac50},'transaction':_0x1cf775})[_0xf878('0x20')](function(){var _0xff4d0a=_[_0xf878('0x3c')](_0xc79f96,function(_0x41d1dd){_0x41d1dd['FaxAccountId']=_0x2aac50;return _0x41d1dd;});return db[_0xf878('0x7e')][_0xf878('0x7f')](_0xff4d0a,{'transaction':_0x1cf775});});}else{_0x4eca29=0x194;_0x5a8633=[];}});})[_0xf878('0x20')](function(){if(_0x4eca29!==0x194){return db[_0xf878('0x7e')][_0xf878('0x80')]({'where':{'FaxAccountId':_0x2aac50},'order':_0xf878('0x81')})['then'](function(_0x105d0c){_0x5a8633=_0x105d0c;});}})[_0xf878('0x27')](function(_0x23ae40){_0x4eca29=0x1f4;logger['error'](_0x23ae40[_0xf878('0x36')]);if(_0x23ae40[_0xf878('0x37')]){delete _0x23ae40['name'];}_0x5a8633=_0x23ae40;})[_0xf878('0x82')](function(){if(_0x5a8633===null){_0x28a0dd[_0xf878('0x28')](_0x4eca29);}else{if(_0x4eca29===0x1f4){_0x28a0dd[_0xf878('0x29')](_0x4eca29)[_0xf878('0x38')](_0x5a8633);}else{_0x28a0dd['status'](_0x4eca29)['json'](_0x5a8633);}}});};exports[_0xf878('0x83')]=function(_0x34967d,_0x14330f,_0x52fe02){var _0x22a9ca={};var _0x30d8e9={};var _0x10ab30;var _0x4d59da;return db['FaxAccount'][_0xf878('0x65')]({'where':{'id':_0x34967d[_0xf878('0x54')]['id']}})['then'](handleEntityNotFound(_0x14330f,null))[_0xf878('0x20')](function(_0x242c32){if(_0x242c32){_0x10ab30=_0x242c32;_0x30d8e9[_0xf878('0x41')]=_[_0xf878('0x55')](db[_0xf878('0x7e')][_0xf878('0x6b')]);_0x30d8e9[_0xf878('0x42')]=_[_0xf878('0x55')](_0x34967d[_0xf878('0x42')]);_0x30d8e9[_0xf878('0x43')]=_[_0xf878('0x44')](_0x30d8e9[_0xf878('0x41')],_0x30d8e9[_0xf878('0x42')]);_0x22a9ca[_0xf878('0x45')]=_[_0xf878('0x44')](_0x30d8e9['model'],qs[_0xf878('0x46')](_0x34967d[_0xf878('0x42')]['fields']));_0x22a9ca[_0xf878('0x45')]=_0x22a9ca[_0xf878('0x45')][_0xf878('0x47')]?_0x22a9ca[_0xf878('0x45')]:_0x30d8e9['model'];_0x22a9ca['order']=qs[_0xf878('0x4a')](_0x34967d[_0xf878('0x42')][_0xf878('0x4a')]);_0x22a9ca[_0xf878('0x4b')]=qs['filters'](_[_0xf878('0x67')](_0x34967d[_0xf878('0x42')],_0x30d8e9[_0xf878('0x43')]));if(_0x34967d['query'][_0xf878('0x4c')]){_0x22a9ca['where']=_[_0xf878('0x4d')](_0x22a9ca[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x22a9ca[_0xf878('0x45')],function(_0x5b0779){var _0x52f244={};_0x52f244[_0x5b0779]={'$like':'%'+_0x34967d[_0xf878('0x42')][_0xf878('0x4c')]+'%'};return _0x52f244;})});}_0x22a9ca=_[_0xf878('0x4d')]({},_0x22a9ca,_0x34967d[_0xf878('0x4f')]);return _0x10ab30[_0xf878('0x83')](_0x22a9ca);}})['then'](function(_0x2f825a){if(_0x2f825a){_0x4d59da=_0x2f825a[_0xf878('0x47')];if(!_0x34967d[_0xf878('0x42')][_0xf878('0x48')](_0xf878('0x66'))){_0x22a9ca[_0xf878('0x2d')]=qs['limit'](_0x34967d[_0xf878('0x42')][_0xf878('0x2d')]);_0x22a9ca[_0xf878('0x2b')]=qs['offset'](_0x34967d['query'][_0xf878('0x2b')]);}return _0x10ab30[_0xf878('0x83')](_0x22a9ca);}})['then'](function(_0x2b6d06){if(_0x2b6d06){return _0x2b6d06?{'count':_0x4d59da,'rows':_0x2b6d06}:null;}})[_0xf878('0x20')](respondWithResult(_0x14330f,null))[_0xf878('0x27')](handleError(_0x14330f,null));};function Extension(_0xfc66b8,_0x1f2a8,_0x5044ae,_0x1b8c18){this[_0xf878('0x84')]=_0xf878('0x85');this[_0xf878('0x86')]=_0xfc66b8['localstationid'];this['app']=_0x1b8c18;this[_0xf878('0x3f')]=_0xf878('0x87');this['description']=_0xf878('0x88');this[_0xf878('0x62')]=_0xfc66b8['id'];this[_0xf878('0x81')]=_0x1f2a8;this[_0xf878('0x89')]=_0x5044ae;}function createExtensionsReciveFax(_0x4c1fd2){var _0x44c14a=0x1;var _0x1a50fd=[];_0x1a50fd[_0xf878('0x8a')](new Extension(_0x4c1fd2,_0x44c14a,'',_0xf878('0x8b')));_0x44c14a+=0x1;_0x1a50fd['push'](new Extension(_0x4c1fd2,_0x44c14a,_0xf878('0x8c'),_0xf878('0x8d')));_0x44c14a+=0x1;for(var _0x48e795 in _0x4c1fd2){if(_0x4c1fd2[_0xf878('0x48')](_0x48e795)&&(_0x48e795===_0xf878('0x8e')||_0x48e795===_0xf878('0x8f')||_0x48e795===_0xf878('0x90')||_0x48e795===_0xf878('0x91')||_0x48e795===_0xf878('0x92')||_0x48e795===_0xf878('0x93')||_0x48e795==='minrate'||_0x48e795==='modem'||_0x48e795==='t38timeout')){_0x1a50fd[_0xf878('0x8a')](new Extension(_0x4c1fd2,_0x44c14a,'FAXOPT('+_0x48e795+')='+_0x4c1fd2[_0x48e795],_0xf878('0x8d')));_0x44c14a+=0x1;}}_0x1a50fd[_0xf878('0x8a')](new Extension(_0x4c1fd2,_0x44c14a,'6',_0xf878('0x94')));_0x44c14a+=0x1;_0x1a50fd['push'](new Extension(_0x4c1fd2,_0x44c14a,_0xf878('0x95'),_0xf878('0x96')));_0x44c14a=0x0;return _0x1a50fd;}exports['addAccountApplications']=function(_0x329c00,_0x1ee1a1,_0x4deca4){var _0x188923;return db[_0xf878('0x7a')][_0xf878('0x7b')](function(_0x31659b){return db['FaxAccount']['create'](_0x329c00[_0xf878('0x57')],{'transaction':_0x31659b})['then'](function(_0x1638f9){_0x188923=_0x1638f9[_0xf878('0x33')]({'plain':!![]});return db[_0xf878('0x97')][_0xf878('0x7f')](createExtensionsReciveFax(_0x188923),{'transaction':_0x31659b});});})[_0xf878('0x20')](function(){return _0x188923;})['then'](respondWithResult(_0x1ee1a1,null))['catch'](handleError(_0x1ee1a1,null));};exports[_0xf878('0x98')]=function(_0x5450f1,_0x426ae6,_0x3d3c48){var _0x32c58e;return db[_0xf878('0x7a')][_0xf878('0x7b')](function(_0x3f5efa){return db[_0xf878('0x3d')][_0xf878('0x31')](_0x5450f1['body'],{'where':{'id':_0x5450f1['body']['id']},'transaction':_0x3f5efa})['then'](function(_0x4994b4){return db[_0xf878('0x97')][_0xf878('0x32')]({'where':{'FaxAccountId':_0x5450f1[_0xf878('0x57')]['id']},'transaction':_0x3f5efa})['then'](function(_0x44e27b){return db['VoiceExtension'][_0xf878('0x7f')](createExtensionsReciveFax(_['omit'](_0x5450f1[_0xf878('0x57')],[_0xf878('0x99'),'key',_0xf878('0x9a'),_0xf878('0x9b'),_0xf878('0x9c'),'ListId'])),{'transaction':_0x3f5efa});});});})[_0xf878('0x20')](function(){return db[_0xf878('0x3d')][_0xf878('0x9d')](_0x5450f1[_0xf878('0x57')]['id']);})[_0xf878('0x20')](respondWithResult(_0x426ae6,null))[_0xf878('0x27')](handleError(_0x426ae6,null));};exports[_0xf878('0x9e')]=function(_0x115870,_0x3fad2d,_0x261fe7){var _0x5914c9={'raw':!![],'where':{}};var _0x412e9f={};var _0x4ca4a0={'count':0x0,'rows':[]};return db[_0xf878('0x3d')][_0xf878('0x65')]({'where':{'id':_0x115870['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x3fad2d,null))[_0xf878('0x20')](function(_0x5e7850){if(_0x5e7850){_0x412e9f[_0xf878('0x41')]=_[_0xf878('0x55')](db[_0xf878('0x9f')]['rawAttributes']);_0x412e9f['query']=_[_0xf878('0x55')](_0x115870[_0xf878('0x42')]);_0x412e9f[_0xf878('0x43')]=_[_0xf878('0x44')](_0x412e9f[_0xf878('0x41')],_0x412e9f[_0xf878('0x42')]);_0x5914c9[_0xf878('0x45')]=_[_0xf878('0x44')](_0x412e9f[_0xf878('0x41')],qs[_0xf878('0x46')](_0x115870[_0xf878('0x42')][_0xf878('0x46')]));_0x5914c9[_0xf878('0x45')]=_0x5914c9[_0xf878('0x45')]['length']?_0x5914c9[_0xf878('0x45')]:_0x412e9f['model'];if(!_0x115870[_0xf878('0x42')][_0xf878('0x48')](_0xf878('0x66'))){_0x5914c9[_0xf878('0x2d')]=qs[_0xf878('0x2d')](_0x115870[_0xf878('0x42')][_0xf878('0x2d')]);_0x5914c9[_0xf878('0x2b')]=qs[_0xf878('0x2b')](_0x115870[_0xf878('0x42')][_0xf878('0x2b')]);}_0x5914c9['order']=qs[_0xf878('0x4a')](_0x115870[_0xf878('0x42')][_0xf878('0x4a')]);_0x5914c9[_0xf878('0x4b')]=qs['filters'](_[_0xf878('0x67')](_0x115870[_0xf878('0x42')],_0x412e9f[_0xf878('0x43')]));_0x5914c9['where']['FaxAccountId']=_0x5e7850['id'];if(_0x115870[_0xf878('0x42')][_0xf878('0x4c')]){_0x5914c9[_0xf878('0x4b')]=_['merge'](_0x5914c9[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x5914c9['attributes'],function(_0x386874){var _0x357348={};_0x357348[_0x386874]={'$like':'%'+_0x115870[_0xf878('0x42')][_0xf878('0x4c')]+'%'};return _0x357348;})});}if(_0x115870[_0xf878('0x42')][_0xf878('0xa0')]){var _0x10fd7d=_0x115870[_0xf878('0x42')][_0xf878('0xa0')]['split'](',');var _0x1e9f41={};_0x1e9f41[_0x10fd7d[0x0]]={'$gte':moment(_0x10fd7d[0x1])[_0xf878('0xa1')](_0xf878('0xa2'))};_0x5914c9[_0xf878('0x4b')]=_[_0xf878('0x4d')](_0x5914c9[_0xf878('0x4b')],_0x1e9f41);}_0x5914c9=_[_0xf878('0x4d')]({},_0x5914c9,_0x115870[_0xf878('0x4f')]);return db[_0xf878('0x9f')][_0xf878('0x2e')]({'where':_0x5914c9[_0xf878('0x4b')]})['then'](function(_0x1a5edc){_0x4ca4a0['count']=_0x1a5edc;if(_0x115870[_0xf878('0x42')][_0xf878('0x50')]){_0x5914c9['include']=[{'all':!![]}];}return db[_0xf878('0x9f')][_0xf878('0x52')](_0x5914c9);})[_0xf878('0x20')](function(_0x5bf13e){_0x4ca4a0[_0xf878('0x53')]=_0x5bf13e;return _0x4ca4a0;});}})[_0xf878('0x20')](respondWithFilteredResult(_0x3fad2d,_0x5914c9))[_0xf878('0x27')](handleError(_0x3fad2d,null));};exports[_0xf878('0x38')]=function(_0x109c88,_0x485f0d,_0x4fb0a0){var _0x5a3d62,_0x53cd44={},_0x2550fc;if(_0x109c88['body']['to']){_0x2550fc=_0x109c88[_0xf878('0x57')]['to'][0x0];}return db[_0xf878('0x3d')]['find']({'where':{'id':_0x109c88[_0xf878('0x54')]['id']},'include':[{'model':db[_0xf878('0xa3')],'as':_0xf878('0xa4'),'include':[{'model':db[_0xf878('0x71')],'as':'Contacts','where':{'fax':_0x2550fc},'limit':0x1,'order':[[_0xf878('0x9b'),_0xf878('0xa5')]]}]}]})[_0xf878('0x20')](handleEntityNotFound(_0x485f0d,null))['then'](function(_0x13480f){_0x5a3d62=_0x13480f;if(_0x109c88[_0xf878('0x57')][_0xf878('0xa6')]&&_0x109c88['body']['attachments'][_0xf878('0x47')]){for(var _0x338880=0x0;_0x338880<_0x109c88[_0xf878('0x57')]['attachments'][_0xf878('0x47')];_0x338880+=0x1){_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][_0x338880]={'filename':_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][_0x338880]['name'],'id':_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][_0x338880]['id'],'path':path['join'](config[_0xf878('0xa7')],_0xf878('0xa8'),_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][_0x338880][_0xf878('0xa9')])};}}return respondWithRpcPromise(_0xf878('0xaa'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x109c88[_0xf878('0x54')]['id'])?undefined:_0x109c88['params']['id'],'path':_[_0xf878('0xab')](_0x109c88[_0xf878('0x57')]['attachments'][0x0][_0xf878('0xac')])?undefined:_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][0x0][_0xf878('0xac')],'fax':_[_0xf878('0xab')](_0x109c88[_0xf878('0x57')]['to'][0x0])?undefined:_0x109c88[_0xf878('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0x5a3d62){if(_['isNil'](_0x109c88[_0xf878('0x57')][_0xf878('0xad')])){_0x109c88[_0xf878('0x57')][_0xf878('0xad')]=util[_0xf878('0xa1')]('\x22%s\x22\x20<%s>',_0x5a3d62['name'],_0x5a3d62[_0xf878('0xae')]);}if(_0x5a3d62['List']){if(_0x5a3d62[_0xf878('0xa4')][_0xf878('0xaf')][_0xf878('0x47')]){return _0x5a3d62['List'][_0xf878('0xaf')][0x0];}else{return db[_0xf878('0x71')][_0xf878('0x56')](_[_0xf878('0xb0')](_0x109c88[_0xf878('0x57')],{'firstName':_0x109c88[_0xf878('0x57')]['to'][0x0],'phone':_0x109c88['body']['to'][0x0],'fax':_0x109c88['body']['to'][0x0],'ListId':_0x5a3d62['ListId']}));}}else{throw new Error(_0xf878('0xb1'));}}else{throw new Error(_0xf878('0xb2'));}})['then'](function(_0x410fd5){if(_0x410fd5){return db['FaxInteraction'][_0xf878('0x5b')]({'where':{'ContactId':_0x410fd5['id'],'closed':![],'FaxAccountId':_0x5a3d62['id']}})[_0xf878('0x20')](function(_0x3bc746){if(_0x3bc746){return[_0x3bc746,![]];}return db['FaxInteraction'][_0xf878('0x56')]({'UserId':_0x109c88[_0xf878('0x58')]['id'],'ContactId':_0x410fd5['id'],'FaxAccountId':_0x5a3d62['id'],'fax':_0x109c88[_0xf878('0x57')]['to'][0x0],'firstMsgDirection':_0xf878('0xb3'),'Messages':[_[_0xf878('0x4d')](_0x109c88[_0xf878('0x57')],{'read':![],'body':_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][0x0][_0xf878('0xb4')],'FaxAccountId':_0x5a3d62['id'],'UserId':_0x109c88['user']['id'],'ContactId':_0x410fd5['id'],'AttachmentId':_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xf878('0xb5')}]})[_0xf878('0x20')](function(_0x38ac00){return[_0x38ac00,!![]];});});}else{throw new Error(_0xf878('0xb6'));}})['spread'](function(_0x52e9ea,_0x31b4ff){if(_0x31b4ff){return _0x52e9ea;}return db[_0xf878('0x9f')][_0xf878('0x56')]({'direction':'out','read':![],'body':_0x109c88[_0xf878('0x57')]['attachments'][0x0][_0xf878('0xb4')],'FaxAccountId':_0x5a3d62['id'],'FaxInteractionId':_0x52e9ea['id'],'UserId':_0x109c88['user']['id'],'ContactId':_0x52e9ea[_0xf878('0xb7')],'AttachmentId':_0x109c88['body'][_0xf878('0xa6')][0x0]['id']})[_0xf878('0x20')](function(_0x5cf210){_0x52e9ea['dataValues'][_0xf878('0xb5')]=[];_0x52e9ea[_0xf878('0xb8')]['Messages'][_0xf878('0x8a')](_0x5cf210[_0xf878('0xb8')]);return _0x52e9ea;});})[_0xf878('0x20')](function(_0x46c3ce){respondWithRpcPromise(_0xf878('0xb9'),_0xf878('0xb9'),{'FaxAccountId':_[_0xf878('0xab')](_0x109c88[_0xf878('0x54')]['id'])?undefined:_0x109c88[_0xf878('0x54')]['id'],'path':_[_0xf878('0xab')](_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][0x0]['path'])?undefined:_0x109c88[_0xf878('0x57')][_0xf878('0xa6')][0x0][_0xf878('0xac')],'fax':_[_0xf878('0xab')](_0x109c88[_0xf878('0x57')]['to'][0x0])?undefined:_0x109c88['body']['to'][0x0],'AttachmentId':_0x109c88['body'][_0xf878('0xa6')][0x0]['id']},client9002)[_0xf878('0x20')](function(_0x34d41b){logger[_0xf878('0x21')](_0xf878('0xba'),_0x34d41b);})[_0xf878('0x27')](function(_0x453d69){logger[_0xf878('0x21')](_0xf878('0xba'),_0x453d69);});return _0x46c3ce;})['then'](respondWithResult(_0x485f0d,null))[_0xf878('0x27')](handleError(_0x485f0d,null));};exports[_0xf878('0xbb')]=function(_0x505ef8,_0x2dbec7,_0x1ccb3f){return db['FaxAccount'][_0xf878('0x5b')]({'where':{'id':_0x505ef8[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x2dbec7,null))[_0xf878('0x20')](function(_0x33e519){if(_0x33e519){return _0x33e519[_0xf878('0xbb')](_0x505ef8[_0xf878('0x57')][_0xf878('0x6d')],_[_0xf878('0x6f')](_0x505ef8[_0xf878('0x57')],['ids','id'])||{})[_0xf878('0xbc')](function(_0x25d22f){for(var _0x569ae0=0x0;_0x569ae0<_0x505ef8[_0xf878('0x57')]['ids'][_0xf878('0x47')];_0x569ae0+=0x1){socket[_0xf878('0xbd')](_0xf878('0xbe'),{'UserId':Number(_0x505ef8[_0xf878('0x57')]['ids'][_0x569ae0]),'FaxAccountId':Number(_0x505ef8[_0xf878('0x54')]['id'])});}return _0x25d22f;});}})[_0xf878('0x20')](respondWithResult(_0x2dbec7,null))[_0xf878('0x27')](handleError(_0x2dbec7,null));};exports[_0xf878('0xbf')]=function(_0xae2f83,_0x141738,_0x2e5271){return db[_0xf878('0x3d')]['find']({'where':{'id':_0xae2f83[_0xf878('0x54')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x141738,null))[_0xf878('0x20')](function(_0x3e345c){if(_0x3e345c){return _0x3e345c['removeAgents'](_0xae2f83['query'][_0xf878('0x6d')])[_0xf878('0x20')](function(){if(_['isArray'](_0xae2f83[_0xf878('0x42')]['ids'])){for(var _0x4d810f=0x0;_0x4d810f<_0xae2f83[_0xf878('0x42')]['ids']['length'];_0x4d810f+=0x1){socket[_0xf878('0xbd')](_0xf878('0xc0'),{'UserId':Number(_0xae2f83[_0xf878('0x42')][_0xf878('0x6d')][_0x4d810f]),'FaxAccountId':Number(_0xae2f83[_0xf878('0x54')]['id'])});}}else{socket[_0xf878('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0xae2f83['query']['ids']),'FaxAccountId':Number(_0xae2f83[_0xf878('0x54')]['id'])});}});}})[_0xf878('0x20')](respondWithStatusCode(_0x141738,null))['catch'](handleError(_0x141738,null));};exports[_0xf878('0xc1')]=function(_0x269e05,_0x100082,_0x28adef){var _0x1c05e9={};var _0x1455e9={};var _0x3bf2bf;var _0x1c122d;return db[_0xf878('0x3d')][_0xf878('0x65')]({'where':{'id':_0x269e05['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x100082,null))[_0xf878('0x20')](function(_0x17d587){if(_0x17d587){_0x3bf2bf=_0x17d587;_0x1455e9['model']=_[_0xf878('0x55')](db[_0xf878('0x73')]['rawAttributes']);_0x1455e9[_0xf878('0x42')]=_[_0xf878('0x55')](_0x269e05['query']);_0x1455e9[_0xf878('0x43')]=_[_0xf878('0x44')](_0x1455e9[_0xf878('0x41')],_0x1455e9['query']);_0x1c05e9[_0xf878('0x45')]=_[_0xf878('0x44')](_0x1455e9[_0xf878('0x41')],qs[_0xf878('0x46')](_0x269e05[_0xf878('0x42')]['fields']));_0x1c05e9[_0xf878('0x45')]=_0x1c05e9[_0xf878('0x45')][_0xf878('0x47')]?_0x1c05e9[_0xf878('0x45')]:_0x1455e9['model'];_0x1c05e9[_0xf878('0x49')]=qs['sort'](_0x269e05['query'][_0xf878('0x4a')]);_0x1c05e9[_0xf878('0x4b')]=qs[_0xf878('0x43')](_[_0xf878('0x67')](_0x269e05[_0xf878('0x42')],_0x1455e9['filters']));if(_0x269e05[_0xf878('0x42')]['filter']){_0x1c05e9[_0xf878('0x4b')]=_[_0xf878('0x4d')](_0x1c05e9[_0xf878('0x4b')],{'$or':_[_0xf878('0x3c')](_0x1c05e9[_0xf878('0x45')],function(_0x1eb546){var _0x14aec5={};_0x14aec5[_0x1eb546]={'$like':'%'+_0x269e05[_0xf878('0x42')][_0xf878('0x4c')]+'%'};return _0x14aec5;})});}_0x1c05e9=_[_0xf878('0x4d')]({},_0x1c05e9,_0x269e05[_0xf878('0x4f')]);return _0x3bf2bf[_0xf878('0xc1')](_0x1c05e9);}})[_0xf878('0x20')](function(_0x2b0718){if(_0x2b0718){_0x1c122d=_0x2b0718[_0xf878('0x47')];if(!_0x269e05[_0xf878('0x42')][_0xf878('0x48')](_0xf878('0x66'))){_0x1c05e9[_0xf878('0x2d')]=qs[_0xf878('0x2d')](_0x269e05[_0xf878('0x42')]['limit']);_0x1c05e9[_0xf878('0x2b')]=qs['offset'](_0x269e05[_0xf878('0x42')][_0xf878('0x2b')]);}return _0x3bf2bf[_0xf878('0xc1')](_0x1c05e9);}})[_0xf878('0x20')](function(_0x37182a){if(_0x37182a){return _0x37182a?{'count':_0x1c122d,'rows':_0x37182a}:null;}})[_0xf878('0x20')](respondWithResult(_0x100082,null))[_0xf878('0x27')](handleError(_0x100082,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 72a1e2e..3767314 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 _0xdc84=['remove','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners'];(function(_0x6ec1c9,_0xfafd07){var _0x5a51d4=function(_0x8d8bdc){while(--_0x8d8bdc){_0x6ec1c9['push'](_0x6ec1c9['shift']());}};_0x5a51d4(++_0xfafd07);}(_0xdc84,0x1ad));var _0x4dc8=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0xdc84[_0x23292a];return _0x4564f2;};'use strict';var EventEmitter=require(_0x4dc8('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x4dc8('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4dc8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4dc8('0x3')};function emitEvent(_0xa1a37b){return function(_0x3dd167,_0x2d61fb,_0x29b46e){FaxAccountEvents[_0x4dc8('0x4')](_0xa1a37b+':'+_0x3dd167['id'],_0x3dd167);FaxAccountEvents[_0x4dc8('0x4')](_0xa1a37b,_0x3dd167);_0x29b46e(null);};}for(var e in events){if(events[_0x4dc8('0x5')](e)){var event=events[e];FaxAccount[_0x4dc8('0x6')](e,emitEvent(event));}}module[_0x4dc8('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x1fd7=['hook','exports','../../mysqldb','FaxAccount','setMaxListeners','remove'];(function(_0x5b7711,_0x4bd810){var _0x16e558=function(_0x43992d){while(--_0x43992d){_0x5b7711['push'](_0x5b7711['shift']());}};_0x16e558(++_0x4bd810);}(_0x1fd7,0x12e));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x71fd('0x0'))['db'][_0x71fd('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x71fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x71fd('0x3')};function emitEvent(_0x3d1c37){return function(_0x5c7f5c,_0x466274,_0x3a2493){FaxAccountEvents['emit'](_0x3d1c37+':'+_0x5c7f5c['id'],_0x5c7f5c);FaxAccountEvents['emit'](_0x3d1c37,_0x5c7f5c);_0x3a2493(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x71fd('0x4')](e,emitEvent(event));}}module[_0x71fd('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 62f6873..b46b754 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 _0x1b19=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x1b19,0x144));var _0x91b1=function(_0xecb62f,_0x23338a){_0xecb62f=_0xecb62f-0x0;var _0x5df9ba=_0x1b19[_0xecb62f];return _0x5df9ba;};'use strict';var _=require(_0x91b1('0x0'));var util=require(_0x91b1('0x1'));var logger=require(_0x91b1('0x2'))(_0x91b1('0x3'));var moment=require(_0x91b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x91b1('0x5'));var fs=require('fs');var path=require(_0x91b1('0x6'));var rimraf=require(_0x91b1('0x7'));var config=require(_0x91b1('0x8'));var attributes=require(_0x91b1('0x9'));module[_0x91b1('0xa')]=function(_0x33ab65,_0x141d0e){return _0x33ab65[_0x91b1('0xb')](_0x91b1('0xc'),attributes,{'tableName':_0x91b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8baf=['util','../../config/logger','api','bluebird','path','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts'];(function(_0x347328,_0x25ccbc){var _0x170d2d=function(_0x30ce86){while(--_0x30ce86){_0x347328['push'](_0x347328['shift']());}};_0x170d2d(++_0x25ccbc);}(_0x8baf,0x1e0));var _0xf8ba=function(_0x1d3b9d,_0xdd459c){_0x1d3b9d=_0x1d3b9d-0x0;var _0x5caef6=_0x8baf[_0x1d3b9d];return _0x5caef6;};'use strict';var _=require('lodash');var util=require(_0xf8ba('0x0'));var logger=require(_0xf8ba('0x1'))(_0xf8ba('0x2'));var moment=require('moment');var BPromise=require(_0xf8ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8ba('0x4'));var rimraf=require('rimraf');var config=require(_0xf8ba('0x5'));var attributes=require(_0xf8ba('0x6'));module['exports']=function(_0x287869,_0x3ef311){return _0x287869[_0xf8ba('0x7')](_0xf8ba('0x8'),attributes,{'tableName':_0xf8ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 0d8005d..1ffcec0 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 _0xe94b=['spread','autoclose','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','CmContact','create','FaxInteraction','Contact\x20not\x20found'];(function(_0x183bc5,_0x53b410){var _0x3fa5c9=function(_0x1b1c2b){while(--_0x1b1c2b){_0x183bc5['push'](_0x183bc5['shift']());}};_0x3fa5c9(++_0x53b410);}(_0xe94b,0x127));var _0xbe94=function(_0x431c8e,_0x129e49){_0x431c8e=_0x431c8e-0x0;var _0x33c2a2=_0xe94b[_0x431c8e];return _0x33c2a2;};'use strict';var _=require(_0xbe94('0x0'));var util=require(_0xbe94('0x1'));var moment=require(_0xbe94('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe94('0x3'));var db=require(_0xbe94('0x4'))['db'];var utils=require(_0xbe94('0x5'));var logger=require(_0xbe94('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe94('0x7')][_0xbe94('0x8')]({'port':0x232c});config[_0xbe94('0x9')]=_[_0xbe94('0xa')](config[_0xbe94('0x9')],{'host':_0xbe94('0xb'),'port':0x18eb});var socket=require(_0xbe94('0xc'))(new Redis(config[_0xbe94('0x9')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x324ba5,_0x526fc3,_0x119c21){return new BPromise(function(_0x2dc572,_0x4da3f4){return client[_0xbe94('0xd')](_0x324ba5,_0x119c21)[_0xbe94('0xe')](function(_0xc739dd){logger[_0xbe94('0xf')](_0xbe94('0x10'),_0x526fc3,'request\x20sent');logger[_0xbe94('0x11')](_0xbe94('0x12'),_0x526fc3,'request\x20sent',JSON[_0xbe94('0x13')](_0xc739dd));if(_0xc739dd[_0xbe94('0x14')]){if(_0xc739dd['error'][_0xbe94('0x15')]===0x1f4){logger['error'](_0xbe94('0x10'),_0x526fc3,_0xc739dd[_0xbe94('0x14')]['message']);return _0x4da3f4(_0xc739dd['error'][_0xbe94('0x16')]);}logger['error'](_0xbe94('0x10'),_0x526fc3,_0xc739dd[_0xbe94('0x14')][_0xbe94('0x16')]);return _0x2dc572(_0xc739dd[_0xbe94('0x14')]['message']);}else{logger[_0xbe94('0xf')](_0xbe94('0x10'),_0x526fc3,_0xbe94('0x17'));_0x2dc572(_0xc739dd['result'][_0xbe94('0x16')]);}})['catch'](function(_0x2922fb){logger['error']('FaxAccount,\x20%s,\x20%s',_0x526fc3,_0x2922fb);_0x4da3f4(_0x2922fb);});});}exports[_0xbe94('0x18')]=function(_0xfa0438){var _0x40ee8e=this;return new Promise(function(_0x48d3af,_0x44206b){return db[_0xbe94('0x19')][_0xbe94('0x1a')]({'raw':_0xfa0438['options']?_0xfa0438['options'][_0xbe94('0x1b')]===undefined?!![]:![]:!![],'where':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1d')]||null:null,'attributes':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1e')]||null:null,'limit':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1f')]||null:null,'include':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438['options'][_0xbe94('0x20')]?_[_0xbe94('0x21')](_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x20')],function(_0x273ff9){return{'model':db[_0x273ff9[_0xbe94('0x22')]],'as':_0x273ff9['as'],'attributes':_0x273ff9['attributes'],'include':_0x273ff9[_0xbe94('0x20')]?_[_0xbe94('0x21')](_0x273ff9[_0xbe94('0x20')],function(_0x4544b5){return{'model':db[_0x4544b5['model']],'as':_0x4544b5['as'],'attributes':_0x4544b5[_0xbe94('0x1e')],'include':_0x4544b5['include']?_[_0xbe94('0x21')](_0x4544b5[_0xbe94('0x20')],function(_0x2de05b){return{'model':db[_0x2de05b[_0xbe94('0x22')]],'as':_0x2de05b['as'],'attributes':_0x2de05b[_0xbe94('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbe94('0xe')](function(_0x330082){logger['info'](_0xbe94('0x18'),_0xfa0438);logger[_0xbe94('0x11')]('GetFaxAccount',_0xfa0438,JSON[_0xbe94('0x13')](_0x330082));_0x48d3af(_0x330082);})[_0xbe94('0x23')](function(_0x2e5da6){logger['error'](_0xbe94('0x18'),_0x2e5da6[_0xbe94('0x16')],_0xfa0438);_0x44206b(_0x40ee8e[_0xbe94('0x14')](0x1f4,_0x2e5da6[_0xbe94('0x16')]));});});};exports[_0xbe94('0x24')]=function(_0x1b306c,_0x1d76f2,_0x13c52a){var _0x459bc0=this;return new Promise(function(_0x2668d8,_0x3a0ba8){var _0x160390={'body':_0x1b306c[_0xbe94('0x25')],'channel':'fax'};var _0x4e6f45=[];var _0x370f4a=[];var _0x464277={};return db['CmContact']['describe']()[_0xbe94('0xe')](function(_0x335f8a){if(!_0x335f8a){throw new db['Sequelize']['ValidationError'](_0xbe94('0x26'));}_0x4e6f45=_[_0xbe94('0x27')](_[_0xbe94('0x28')](_0x335f8a),[_0xbe94('0x29'),_0xbe94('0x2a')]);_0x370f4a=_[_0xbe94('0x27')](_[_0xbe94('0x28')](_0x335f8a),[_0xbe94('0x29'),_0xbe94('0x2a'),_0xbe94('0x2b'),_0xbe94('0x2c')]);if(_0x1b306c[_0xbe94('0x25')]['id']){delete _0x1b306c['body']['id'];}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')])){throw new db['Sequelize'][(_0xbe94('0x2f'))](_0xbe94('0x30'));}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')]['body'])||_0x1b306c['body'][_0xbe94('0x25')]===''){throw new db[(_0xbe94('0x31'))][(_0xbe94('0x2f'))](_0xbe94('0x32'));}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')][_0xbe94('0x33')])){throw new db['Sequelize'][(_0xbe94('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x370f4a);}if(!_['includes'](_0x370f4a,_0x1b306c[_0xbe94('0x25')]['mapKey'])){throw new db[(_0xbe94('0x31'))][(_0xbe94('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x370f4a);}_0x464277[_0x1b306c[_0xbe94('0x25')]['mapKey']]=_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')];})['then'](function(){return db[_0xbe94('0x19')][_0xbe94('0x34')]({'where':{'id':_0x1b306c[_0xbe94('0x35')]['id']},'include':[{'model':db[_0xbe94('0x36')],'as':_0xbe94('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x464277,'limit':0x1,'order':[[_0xbe94('0x2a'),_0xbe94('0x38')]]}]},{'model':db[_0xbe94('0x39')],'as':_0xbe94('0x3a')}]});})[_0xbe94('0xe')](function(_0x4cb28a){if(_0x4cb28a&&_0x4cb28a[_0xbe94('0x37')]){var _0x4aee52=_0x4cb28a[_0xbe94('0x3b')]({'plain':!![]});_0x160390[_0xbe94('0x35')]=_0x4aee52;_0x160390[_0xbe94('0x3c')]=_0x4aee52[_0xbe94('0x3a')];_0x160390[_0xbe94('0x3d')]=_0x4aee52[_0xbe94('0x37')];_0x160390['applications']=_[_0xbe94('0x3e')](_0x160390[_0xbe94('0x3c')],['priority'],[_0xbe94('0x3f')]);if(_0x160390[_0xbe94('0x35')][_0xbe94('0x3a')]){delete _0x160390['account'][_0xbe94('0x3a')];}if(_0x160390[_0xbe94('0x35')][_0xbe94('0x37')]&&_0x160390[_0xbe94('0x35')]['List'][_0xbe94('0x40')]['length']){return _0x160390[_0xbe94('0x35')]['List']['Contacts'][0x0];}var _0x57bf34=_[_0xbe94('0xa')](_0x1b306c[_0xbe94('0x25')],{'firstName':_0x1b306c['body'][_0xbe94('0x2e')],'ListId':_0x4aee52['ListId']});_0x57bf34[_0x1b306c[_0xbe94('0x25')]['mapKey']]=_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')];return db[_0xbe94('0x41')][_0xbe94('0x42')](_0x57bf34,{'fields':_0x4e6f45,'raw':!![]});}})[_0xbe94('0xe')](function(_0x359bd3){_0x160390['contact']=_0x359bd3;if(_0x359bd3){var _0x373160={'ContactId':_0x359bd3['id'],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id'],'fax':_0x359bd3['fax']};return db[_0xbe94('0x43')][_0xbe94('0x34')]({'where':{'ContactId':_0x359bd3['id'],'closed':![],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id']}})[_0xbe94('0xe')](function(_0x5850f2){if(_0x5850f2){return[_0x5850f2,![]];}return db[_0xbe94('0x43')][_0xbe94('0x42')](_0x373160)[_0xbe94('0xe')](function(_0x183f2e){return[_0x183f2e,!![]];});});}else{throw new Error(_0xbe94('0x44'));}})[_0xbe94('0x45')](function(_0x3d175d,_0x5a3861){var _0x314e4e=_0x3d175d[_0xbe94('0x3b')]({'plain':!![]});if(_0x5a3861){if(_0x160390[_0xbe94('0x35')][_0xbe94('0x46')]){_0x160390[_0xbe94('0x3c')][_0xbe94('0x47')]({'id':0x0,'priority':_0x160390[_0xbe94('0x3c')][_0xbe94('0x48')]+0x1,'app':_0xbe94('0x49'),'appdata':_0xbe94('0x4a'),'interval':'*,*,*,*'});}_0x314e4e[_0xbe94('0x4b')]=!![];}else{_0x314e4e[_0xbe94('0x4b')]=![];}_0x160390[_0xbe94('0x4c')]=_0x314e4e;return db[_0xbe94('0x4d')][_0xbe94('0x42')]({'body':_0x1b306c[_0xbe94('0x25')][_0xbe94('0x25')],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id'],'FaxInteractionId':_0x3d175d['id'],'direction':'in','ContactId':_0x3d175d[_0xbe94('0x4e')],'AttachmentId':_0x1b306c[_0xbe94('0x25')][_0xbe94('0x4f')]});})['then'](function(_0x52870c){_0x160390[_0xbe94('0x16')]=_0x52870c;if(!_0x160390['interaction'][_0xbe94('0x50')])return;return db[_0xbe94('0x51')][_0xbe94('0x34')]({'attributes':['id',_0xbe94('0x52')],'where':{'id':_0x160390[_0xbe94('0x4c')][_0xbe94('0x50')]}});})[_0xbe94('0xe')](function(_0x33a8e5){if(_0x33a8e5){_0x160390[_0xbe94('0x3c')][_0xbe94('0x53')]({'id':0x0,'priority':0x0,'app':_0xbe94('0x54'),'appdata':_0x33a8e5[_0xbe94('0x52')]+','+(_0x160390[_0xbe94('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe94('0x55')});}if(!_0x160390[_0xbe94('0x4c')][_0xbe94('0x56')])return;return db[_0xbe94('0x57')][_0xbe94('0x34')]({'attributes':['id',_0xbe94('0x52')],'where':{'id':_0x160390['interaction']['queueId']}});})['then'](function(_0x47cdb6){if(_0x47cdb6){_0x160390['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xbe94('0x58'),'appdata':_0x47cdb6[_0xbe94('0x52')]+','+(_0x160390['account'][_0xbe94('0x59')]||0x12c),'interval':_0xbe94('0x55')});}return respondWithRpcPromise('Start',_0xbe94('0x5a'),_0x160390);})['then'](function(_0x3f54db){_0x2668d8(_0x3f54db);})[_0xbe94('0x23')](function(_0x328f03){_0x3a0ba8(_0x459bc0[_0xbe94('0x14')](0x1f4,_0x328f03['message']));});});}; \ No newline at end of file +var _0xdd04=['Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','List','Contacts','updatedAt','DESC','FaxApplication','Applications','applications','list','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','options','raw','where','attributes','limit','map','include','model','stringify','NotifyFaxAccount','body','fax','CmContact','describe'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xdd04,0x157));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4dd0('0x0'));var util=require(_0x4dd0('0x1'));var moment=require(_0x4dd0('0x2'));var BPromise=require(_0x4dd0('0x3'));var rs=require(_0x4dd0('0x4'));var fs=require('fs');var Redis=require(_0x4dd0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4dd0('0x6'));var logger=require(_0x4dd0('0x7'))('rpc');var config=require(_0x4dd0('0x8'));var jayson=require(_0x4dd0('0x9'));var client=jayson[_0x4dd0('0xa')][_0x4dd0('0xb')]({'port':0x232c});config['redis']=_[_0x4dd0('0xc')](config[_0x4dd0('0xd')],{'host':_0x4dd0('0xe'),'port':0x18eb});var socket=require(_0x4dd0('0xf'))(new Redis(config[_0x4dd0('0xd')]));require(_0x4dd0('0x10'))[_0x4dd0('0x11')](socket);function respondWithRpcPromise(_0x3d4498,_0x26e4dc,_0x59ae93){return new BPromise(function(_0xc9a9fd,_0x4fda9e){return client[_0x4dd0('0x12')](_0x3d4498,_0x59ae93)[_0x4dd0('0x13')](function(_0xdd606c){logger[_0x4dd0('0x14')](_0x4dd0('0x15'),_0x26e4dc,_0x4dd0('0x16'));logger[_0x4dd0('0x17')](_0x4dd0('0x18'),_0x26e4dc,'request\x20sent',JSON['stringify'](_0xdd606c));if(_0xdd606c[_0x4dd0('0x19')]){if(_0xdd606c['error'][_0x4dd0('0x1a')]===0x1f4){logger['error'](_0x4dd0('0x15'),_0x26e4dc,_0xdd606c['error'][_0x4dd0('0x1b')]);return _0x4fda9e(_0xdd606c[_0x4dd0('0x19')][_0x4dd0('0x1b')]);}logger['error'](_0x4dd0('0x15'),_0x26e4dc,_0xdd606c[_0x4dd0('0x19')][_0x4dd0('0x1b')]);return _0xc9a9fd(_0xdd606c[_0x4dd0('0x19')][_0x4dd0('0x1b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x26e4dc,'request\x20sent');_0xc9a9fd(_0xdd606c[_0x4dd0('0x1c')][_0x4dd0('0x1b')]);}})[_0x4dd0('0x1d')](function(_0x671bd3){logger[_0x4dd0('0x19')](_0x4dd0('0x15'),_0x26e4dc,_0x671bd3);_0x4fda9e(_0x671bd3);});});}exports[_0x4dd0('0x1e')]=function(_0x388d15){var _0x5c678e=this;return new Promise(function(_0x1596a0,_0x2d44f6){return db['FaxAccount']['findAll']({'raw':_0x388d15[_0x4dd0('0x1f')]?_0x388d15['options'][_0x4dd0('0x20')]===undefined?!![]:![]:!![],'where':_0x388d15[_0x4dd0('0x1f')]?_0x388d15[_0x4dd0('0x1f')][_0x4dd0('0x21')]||null:null,'attributes':_0x388d15[_0x4dd0('0x1f')]?_0x388d15[_0x4dd0('0x1f')][_0x4dd0('0x22')]||null:null,'limit':_0x388d15[_0x4dd0('0x1f')]?_0x388d15[_0x4dd0('0x1f')][_0x4dd0('0x23')]||null:null,'include':_0x388d15[_0x4dd0('0x1f')]?_0x388d15['options']['include']?_[_0x4dd0('0x24')](_0x388d15[_0x4dd0('0x1f')][_0x4dd0('0x25')],function(_0x285e5b){return{'model':db[_0x285e5b[_0x4dd0('0x26')]],'as':_0x285e5b['as'],'attributes':_0x285e5b[_0x4dd0('0x22')],'include':_0x285e5b['include']?_[_0x4dd0('0x24')](_0x285e5b[_0x4dd0('0x25')],function(_0xcf28eb){return{'model':db[_0xcf28eb[_0x4dd0('0x26')]],'as':_0xcf28eb['as'],'attributes':_0xcf28eb[_0x4dd0('0x22')],'include':_0xcf28eb[_0x4dd0('0x25')]?_[_0x4dd0('0x24')](_0xcf28eb[_0x4dd0('0x25')],function(_0x5c6d73){return{'model':db[_0x5c6d73[_0x4dd0('0x26')]],'as':_0x5c6d73['as'],'attributes':_0x5c6d73[_0x4dd0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4dd0('0x13')](function(_0x3d6f51){logger[_0x4dd0('0x14')]('GetFaxAccount',_0x388d15);logger[_0x4dd0('0x17')](_0x4dd0('0x1e'),_0x388d15,JSON[_0x4dd0('0x27')](_0x3d6f51));_0x1596a0(_0x3d6f51);})['catch'](function(_0x37ab51){logger[_0x4dd0('0x19')]('GetFaxAccount',_0x37ab51['message'],_0x388d15);_0x2d44f6(_0x5c678e['error'](0x1f4,_0x37ab51[_0x4dd0('0x1b')]));});});};exports[_0x4dd0('0x28')]=function(_0x567d32,_0xdc8e4,_0x5c25b1){var _0x142b53=this;return new Promise(function(_0x4b42a1,_0x42397c){var _0x19ea79={'body':_0x567d32[_0x4dd0('0x29')],'channel':_0x4dd0('0x2a')};var _0x50e3ad=[];var _0x2539e1=[];var _0x821fe1={};return db[_0x4dd0('0x2b')][_0x4dd0('0x2c')]()[_0x4dd0('0x13')](function(_0x2af104){if(!_0x2af104){throw new db[(_0x4dd0('0x2d'))][(_0x4dd0('0x2e'))](_0x4dd0('0x2f'));}_0x50e3ad=_[_0x4dd0('0x30')](_[_0x4dd0('0x31')](_0x2af104),[_0x4dd0('0x32'),'updatedAt']);_0x2539e1=_['difference'](_[_0x4dd0('0x31')](_0x2af104),[_0x4dd0('0x32'),'updatedAt',_0x4dd0('0x33'),_0x4dd0('0x34')]);if(_0x567d32[_0x4dd0('0x29')]['id']){delete _0x567d32[_0x4dd0('0x29')]['id'];}if(_[_0x4dd0('0x35')](_0x567d32[_0x4dd0('0x29')][_0x4dd0('0x36')])){throw new db['Sequelize']['ValidationError'](_0x4dd0('0x37'));}if(_['isNil'](_0x567d32['body'][_0x4dd0('0x29')])||_0x567d32['body'][_0x4dd0('0x29')]===''){throw new db[(_0x4dd0('0x2d'))][(_0x4dd0('0x2e'))](_0x4dd0('0x38'));}if(_['isNil'](_0x567d32[_0x4dd0('0x29')][_0x4dd0('0x39')])){throw new db[(_0x4dd0('0x2d'))][(_0x4dd0('0x2e'))](_0x4dd0('0x3a')+_0x2539e1);}if(!_[_0x4dd0('0x3b')](_0x2539e1,_0x567d32[_0x4dd0('0x29')][_0x4dd0('0x39')])){throw new db[(_0x4dd0('0x2d'))][(_0x4dd0('0x2e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2539e1);}_0x821fe1[_0x567d32[_0x4dd0('0x29')]['mapKey']]=_0x567d32['body'][_0x4dd0('0x36')];})[_0x4dd0('0x13')](function(){return db[_0x4dd0('0x3c')][_0x4dd0('0x3d')]({'where':{'id':_0x567d32[_0x4dd0('0x3e')]['id']},'include':[{'model':db['CmList'],'as':_0x4dd0('0x3f'),'include':[{'model':db[_0x4dd0('0x2b')],'as':_0x4dd0('0x40'),'where':_0x821fe1,'limit':0x1,'order':[[_0x4dd0('0x41'),_0x4dd0('0x42')]]}]},{'model':db[_0x4dd0('0x43')],'as':_0x4dd0('0x44')}]});})[_0x4dd0('0x13')](function(_0x233384){if(_0x233384&&_0x233384[_0x4dd0('0x3f')]){var _0x781e62=_0x233384['get']({'plain':!![]});_0x19ea79['account']=_0x781e62;_0x19ea79[_0x4dd0('0x45')]=_0x781e62[_0x4dd0('0x44')];_0x19ea79[_0x4dd0('0x46')]=_0x781e62[_0x4dd0('0x3f')];_0x19ea79[_0x4dd0('0x45')]=_['orderBy'](_0x19ea79[_0x4dd0('0x45')],[_0x4dd0('0x47')],[_0x4dd0('0x48')]);if(_0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x44')]){delete _0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x44')];}if(_0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x3f')]&&_0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x3f')][_0x4dd0('0x40')][_0x4dd0('0x49')]){return _0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x3f')][_0x4dd0('0x40')][0x0];}var _0x36f987=_[_0x4dd0('0xc')](_0x567d32['body'],{'firstName':_0x567d32[_0x4dd0('0x29')]['from'],'ListId':_0x781e62[_0x4dd0('0x34')]});_0x36f987[_0x567d32['body'][_0x4dd0('0x39')]]=_0x567d32[_0x4dd0('0x29')][_0x4dd0('0x36')];return db['CmContact'][_0x4dd0('0x4a')](_0x36f987,{'fields':_0x50e3ad,'raw':!![]});}})[_0x4dd0('0x13')](function(_0x19d243){_0x19ea79[_0x4dd0('0x4b')]=_0x19d243;if(_0x19d243){var _0x5ad08f={'ContactId':_0x19d243['id'],'FaxAccountId':_0x567d32['account']['id'],'fax':_0x19d243[_0x4dd0('0x2a')]};return db[_0x4dd0('0x4c')][_0x4dd0('0x3d')]({'where':{'ContactId':_0x19d243['id'],'closed':![],'FaxAccountId':_0x567d32[_0x4dd0('0x3e')]['id']}})[_0x4dd0('0x13')](function(_0x18ae38){if(_0x18ae38){return[_0x18ae38,![]];}return db[_0x4dd0('0x4c')][_0x4dd0('0x4a')](_0x5ad08f)[_0x4dd0('0x13')](function(_0x571670){return[_0x571670,!![]];});});}else{throw new Error(_0x4dd0('0x4d'));}})['spread'](function(_0x44da6f,_0x39e02f){var _0x11bc40=_0x44da6f[_0x4dd0('0x4e')]({'plain':!![]});if(_0x39e02f){if(_0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x4f')]){_0x19ea79[_0x4dd0('0x45')][_0x4dd0('0x50')]({'id':0x0,'priority':_0x19ea79[_0x4dd0('0x45')][_0x4dd0('0x49')]+0x1,'app':'close','appdata':_0x4dd0('0x51'),'interval':_0x4dd0('0x52')});}_0x11bc40[_0x4dd0('0x53')]=!![];}else{_0x11bc40['created']=![];}_0x19ea79[_0x4dd0('0x54')]=_0x11bc40;return db[_0x4dd0('0x55')][_0x4dd0('0x4a')]({'body':_0x567d32['body']['body'],'FaxAccountId':_0x567d32[_0x4dd0('0x3e')]['id'],'FaxInteractionId':_0x44da6f['id'],'direction':'in','ContactId':_0x44da6f[_0x4dd0('0x56')],'AttachmentId':_0x567d32[_0x4dd0('0x29')][_0x4dd0('0x57')]});})[_0x4dd0('0x13')](function(_0x45dc88){_0x19ea79[_0x4dd0('0x1b')]=_0x45dc88;if(!_0x19ea79['interaction'][_0x4dd0('0x58')])return;return db['User'][_0x4dd0('0x3d')]({'attributes':['id',_0x4dd0('0x59')],'where':{'id':_0x19ea79[_0x4dd0('0x54')]['UserId']}});})[_0x4dd0('0x13')](function(_0x16b2d3){if(_0x16b2d3){_0x19ea79[_0x4dd0('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4dd0('0x5a'),'appdata':_0x16b2d3[_0x4dd0('0x59')]+','+(_0x19ea79['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x19ea79[_0x4dd0('0x54')][_0x4dd0('0x5b')])return;return db[_0x4dd0('0x5c')][_0x4dd0('0x3d')]({'attributes':['id',_0x4dd0('0x59')],'where':{'id':_0x19ea79[_0x4dd0('0x54')]['queueId']}});})[_0x4dd0('0x13')](function(_0x53b400){if(_0x53b400){_0x19ea79[_0x4dd0('0x45')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4dd0('0x5d'),'appdata':_0x53b400[_0x4dd0('0x59')]+','+(_0x19ea79[_0x4dd0('0x3e')][_0x4dd0('0x5e')]||0x12c),'interval':_0x4dd0('0x52')});}return respondWithRpcPromise(_0x4dd0('0x5f'),_0x4dd0('0x60'),_0x19ea79);})[_0x4dd0('0x13')](function(_0x5ba7b6){_0x4b42a1(_0x5ba7b6);})[_0x4dd0('0x1d')](function(_0x3b1dd7){_0x42397c(_0x142b53[_0x4dd0('0x19')](0x1f4,_0x3b1dd7[_0x4dd0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0cc7435..a5669b3 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 _0xac44=['length','faxAccount:','./faxAccount.events','update','emit','removeListener'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac44,0x18e));var _0x4ac4=function(_0x358939,_0x4bc62e){_0x358939=_0x358939-0x0;var _0x5b8181=_0xac44[_0x358939];return _0x5b8181;};'use strict';var FaxAccountEvents=require(_0x4ac4('0x0'));var events=['save','remove',_0x4ac4('0x1')];function createListener(_0x2a02ad,_0x20229c){return function(_0x1aba32){_0x20229c[_0x4ac4('0x2')](_0x2a02ad,_0x1aba32);};}function removeListener(_0x13f8a9,_0xea9b09){return function(){FaxAccountEvents[_0x4ac4('0x3')](_0x13f8a9,_0xea9b09);};}exports['register']=function(_0x2c8f53){for(var _0x1997f0=0x0,_0x4cf3bc=events[_0x4ac4('0x4')];_0x1997f0<_0x4cf3bc;_0x1997f0++){var _0x17ca34=events[_0x1997f0];var _0x140eae=createListener(_0x4ac4('0x5')+_0x17ca34,_0x2c8f53);FaxAccountEvents['on'](_0x17ca34,_0x140eae);}}; \ No newline at end of file +var _0x7b72=['update','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x295fe9,_0x345828){var _0x3b80df=function(_0x85b4dc){while(--_0x85b4dc){_0x295fe9['push'](_0x295fe9['shift']());}};_0x3b80df(++_0x345828);}(_0x7b72,0x17d));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x27b7('0x0'));var events=[_0x27b7('0x1'),_0x27b7('0x2'),_0x27b7('0x3')];function createListener(_0x4a071e,_0x559fd2){return function(_0x482642){_0x559fd2['emit'](_0x4a071e,_0x482642);};}function removeListener(_0x28b719,_0x57c081){return function(){FaxAccountEvents[_0x27b7('0x4')](_0x28b719,_0x57c081);};}exports[_0x27b7('0x5')]=function(_0x29c73b){for(var _0x41cb56=0x0,_0x4eb51b=events[_0x27b7('0x6')];_0x41cb56<_0x4eb51b;_0x41cb56++){var _0x235dfb=events[_0x41cb56];var _0x1a00ae=createListener(_0x27b7('0x7')+_0x235dfb,_0x29c73b);FaxAccountEvents['on'](_0x235dfb,_0x1a00ae);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index bc8ec43..2af4572 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 _0xa9b6=['send','/:id/users','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','describe','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send'];(function(_0x67d4ca,_0x455f15){var _0xc53c24=function(_0x3645e4){while(--_0x3645e4){_0x67d4ca['push'](_0x67d4ca['shift']());}};_0xc53c24(++_0x455f15);}(_0xa9b6,0x1c2));var _0x6a9b=function(_0x554f4a,_0x12998b){_0x554f4a=_0x554f4a-0x0;var _0x1a5eec=_0xa9b6[_0x554f4a];return _0x1a5eec;};'use strict';var multer=require(_0x6a9b('0x0'));var util=require(_0x6a9b('0x1'));var path=require(_0x6a9b('0x2'));var timeout=require(_0x6a9b('0x3'));var express=require(_0x6a9b('0x4'));var router=express[_0x6a9b('0x5')]();var fs_extra=require(_0x6a9b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6a9b('0x7'));var config=require(_0x6a9b('0x8'));var controller=require('./faxAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6a9b('0x9')]);router[_0x6a9b('0xa')](_0x6a9b('0xb'),auth['isAuthenticated'](),controller[_0x6a9b('0xc')]);router[_0x6a9b('0xa')]('/:id',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0xe')]);router[_0x6a9b('0xa')](_0x6a9b('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x6a9b('0xa')](_0x6a9b('0x10'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x11')]);router[_0x6a9b('0xa')](_0x6a9b('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6a9b('0xa')](_0x6a9b('0x13'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x14')]);router[_0x6a9b('0xa')](_0x6a9b('0x15'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x16')]);router[_0x6a9b('0xa')]('/:id/users',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x17')]);router[_0x6a9b('0x18')]('/',auth['isAuthenticated'](),controller[_0x6a9b('0x19')]);router[_0x6a9b('0x18')]('/:id/dispositions',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1a')]);router[_0x6a9b('0x18')]('/:id/canned_answers',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1b')]);router['post'](_0x6a9b('0x12'),auth['isAuthenticated'](),controller[_0x6a9b('0x1c')]);router[_0x6a9b('0x18')](_0x6a9b('0x13'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1d')]);router[_0x6a9b('0x18')](_0x6a9b('0x1e'),auth[_0x6a9b('0xd')](),controller['addAccountApplications']);router['post'](_0x6a9b('0x1f'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x20')]);router[_0x6a9b('0x18')](_0x6a9b('0x21'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x22')]);router['post'](_0x6a9b('0x23'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x24')]);router['put'](_0x6a9b('0x25'),auth['isAuthenticated'](),controller[_0x6a9b('0x26')]);router[_0x6a9b('0x27')]('/:id',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x28')]);router[_0x6a9b('0x27')](_0x6a9b('0xf'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x29')]);router[_0x6a9b('0x27')](_0x6a9b('0x10'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x2a')]);router[_0x6a9b('0x27')]('/:id/users',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xc0bd=['/:id/canned_answers','getAnswers','getInteractions','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x7e8d1a,_0x1e345d){var _0x3fded8=function(_0x4301d8){while(--_0x4301d8){_0x7e8d1a['push'](_0x7e8d1a['shift']());}};_0x3fded8(++_0x1e345d);}(_0xc0bd,0x95));var _0xdc0b=function(_0x31665f,_0x2bb3a0){_0x31665f=_0x31665f-0x0;var _0x333953=_0xc0bd[_0x31665f];return _0x333953;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc0b('0x0'));var timeout=require(_0xdc0b('0x1'));var express=require('express');var router=express[_0xdc0b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdc0b('0x3'));var interaction=require(_0xdc0b('0x4'));var config=require(_0xdc0b('0x5'));var controller=require('./faxAccount.controller');router[_0xdc0b('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc0b('0x7')]);router['get'](_0xdc0b('0x8'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0xa')]);router['get'](_0xdc0b('0xb'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0xc')]);router['get'](_0xdc0b('0xd'),auth['isAuthenticated'](),controller[_0xdc0b('0xe')]);router[_0xdc0b('0x6')](_0xdc0b('0xf'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x10')]);router[_0xdc0b('0x6')]('/:id/interactions',auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x11')]);router[_0xdc0b('0x6')]('/:id/applications',auth[_0xdc0b('0x9')](),controller['getApplications']);router[_0xdc0b('0x6')](_0xdc0b('0x12'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x13')]);router['get'](_0xdc0b('0x14'),auth[_0xdc0b('0x9')](),controller['getAgents']);router[_0xdc0b('0x15')]('/',auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x16')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdc0b('0x17')]);router[_0xdc0b('0x15')]('/:id/canned_answers',auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x18')]);router[_0xdc0b('0x15')]('/:id/interactions',auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x19')]);router['post'](_0xdc0b('0x1a'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x1b')]);router[_0xdc0b('0x15')](_0xdc0b('0x1c'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x1d')]);router['post'](_0xdc0b('0x1e'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0xdc0b('0x1f'),auth['isAuthenticated'](),controller[_0xdc0b('0x20')]);router['post'](_0xdc0b('0x14'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x21')]);router[_0xdc0b('0x22')]('/:id',auth[_0xdc0b('0x9')](),controller['update']);router[_0xdc0b('0x23')](_0xdc0b('0xb'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x24')]);router[_0xdc0b('0x23')]('/:id/dispositions',auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x25')]);router[_0xdc0b('0x23')](_0xdc0b('0xf'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x26')]);router[_0xdc0b('0x23')](_0xdc0b('0x14'),auth[_0xdc0b('0x9')](),controller[_0xdc0b('0x27')]);module[_0xdc0b('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c91666b..b1bea15 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 _0xb33a=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5767af,_0x30c2a0){var _0x192700=function(_0x209457){while(--_0x209457){_0x5767af['push'](_0x5767af['shift']());}};_0x192700(++_0x30c2a0);}(_0xb33a,0xdb));var _0xab33=function(_0x2bcaaa,_0x56fde6){_0x2bcaaa=_0x2bcaaa-0x0;var _0x11928e=_0xb33a[_0x2bcaaa];return _0x11928e;};'use strict';var Sequelize=require(_0xab33('0x0'));module[_0xab33('0x1')]={'priority':{'type':Sequelize[_0xab33('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xab33('0x3')],'allowNull':![],'defaultValue':_0xab33('0x4')},'appdata':{'type':Sequelize[_0xab33('0x5')]()},'description':{'type':Sequelize[_0xab33('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xab33('0x6')}}; \ No newline at end of file +var _0x3a8f=['sequelize','noop','TEXT','STRING','*,*,*,*'];(function(_0x52a86d,_0x4f8ee4){var _0x968463=function(_0x242a8d){while(--_0x242a8d){_0x52a86d['push'](_0x52a86d['shift']());}};_0x968463(++_0x4f8ee4);}(_0x3a8f,0xe6));var _0xf3a8=function(_0x447f64,_0x332417){_0x447f64=_0x447f64-0x0;var _0x29b30f=_0x3a8f[_0x447f64];return _0x29b30f;};'use strict';var Sequelize=require(_0xf3a8('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf3a8('0x1')},'appdata':{'type':Sequelize[_0xf3a8('0x2')]()},'description':{'type':Sequelize[_0xf3a8('0x3')]},'interval':{'type':Sequelize[_0xf3a8('0x3')],'defaultValue':_0xf3a8('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 477c0d0..5595952 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 _0x96ef=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','fieldName','type','key','query','filters','intersection'];(function(_0x550500,_0x8dd443){var _0x113660=function(_0x4d97d3){while(--_0x4d97d3){_0x550500['push'](_0x550500['shift']());}};_0x113660(++_0x8dd443);}(_0x96ef,0x17c));var _0xf96e=function(_0x43e1b4,_0x25d2fe){_0x43e1b4=_0x43e1b4-0x0;var _0x58c279=_0x96ef[_0x43e1b4];return _0x58c279;};'use strict';var emlformat=require(_0xf96e('0x0'));var rimraf=require(_0xf96e('0x1'));var zipdir=require(_0xf96e('0x2'));var jsonpatch=require(_0xf96e('0x3'));var rp=require('request-promise');var moment=require(_0xf96e('0x4'));var BPromise=require(_0xf96e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf96e('0x6'));var csv=require(_0xf96e('0x7'));var ejs=require(_0xf96e('0x8'));var fs=require('fs');var fs_extra=require(_0xf96e('0x9'));var _=require(_0xf96e('0xa'));var squel=require(_0xf96e('0xb'));var crypto=require(_0xf96e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf96e('0x7'));var querystring=require(_0xf96e('0xd'));var Papa=require(_0xf96e('0xe'));var Redis=require('ioredis');var authService=require(_0xf96e('0xf'));var qs=require(_0xf96e('0x10'));var as=require(_0xf96e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf96e('0x12'))('api');var utils=require(_0xf96e('0x13'));var config=require(_0xf96e('0x14'));var licenseUtil=require(_0xf96e('0x15'));var db=require(_0xf96e('0x16'))['db'];function respondWithStatusCode(_0x216244,_0x4bc5dc){_0x4bc5dc=_0x4bc5dc||0xcc;return function(_0x4326dd){if(_0x4326dd){return _0x216244['sendStatus'](_0x4bc5dc);}return _0x216244[_0xf96e('0x17')](_0x4bc5dc)['end']();};}function respondWithResult(_0x193d87,_0xb848d8){_0xb848d8=_0xb848d8||0xc8;return function(_0x5d00ae){if(_0x5d00ae){return _0x193d87[_0xf96e('0x17')](_0xb848d8)[_0xf96e('0x18')](_0x5d00ae);}};}function respondWithFilteredResult(_0x264500,_0x1561a4){return function(_0x3195b2){if(_0x3195b2){var _0x164054=typeof _0x1561a4[_0xf96e('0x19')]==='undefined'&&typeof _0x1561a4[_0xf96e('0x1a')]==='undefined';var _0x3c57e5=_0x3195b2[_0xf96e('0x1b')];var _0x1409c8=_0x164054?0x0:_0x1561a4[_0xf96e('0x19')];var _0x2905b8=_0x164054?_0x3195b2[_0xf96e('0x1b')]:_0x1561a4[_0xf96e('0x19')]+_0x1561a4[_0xf96e('0x1a')];var _0x3ed218;if(_0x2905b8>=_0x3c57e5){_0x2905b8=_0x3c57e5;_0x3ed218=0xc8;}else{_0x3ed218=0xce;}_0x264500[_0xf96e('0x17')](_0x3ed218);return _0x264500['set'](_0xf96e('0x1c'),_0x1409c8+'-'+_0x2905b8+'/'+_0x3c57e5)['json'](_0x3195b2);}return null;};}function patchUpdates(_0x1af16e){return function(_0x3d621b){try{jsonpatch[_0xf96e('0x1d')](_0x3d621b,_0x1af16e,!![]);}catch(_0xd5535f){return BPromise[_0xf96e('0x1e')](_0xd5535f);}return _0x3d621b[_0xf96e('0x1f')]();};}function saveUpdates(_0x50ce4f,_0x514f8e){return function(_0x448214){if(_0x448214){return _0x448214[_0xf96e('0x20')](_0x50ce4f)['then'](function(_0x6020e3){return _0x6020e3;});}return null;};}function removeEntity(_0x5909da,_0x5eb66b){return function(_0x3c69c4){if(_0x3c69c4){return _0x3c69c4[_0xf96e('0x21')]()[_0xf96e('0x22')](function(){_0x5909da[_0xf96e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13eefa,_0x26fb35){return function(_0x52d0e6){if(!_0x52d0e6){_0x13eefa[_0xf96e('0x23')](0x194);}return _0x52d0e6;};}function handleError(_0x830e17,_0x5487dc){_0x5487dc=_0x5487dc||0x1f4;return function(_0x25c557){logger['error'](_0x25c557[_0xf96e('0x24')]);if(_0x25c557[_0xf96e('0x25')]){delete _0x25c557[_0xf96e('0x25')];}_0x830e17[_0xf96e('0x17')](_0x5487dc)[_0xf96e('0x26')](_0x25c557);};}exports['index']=function(_0x4a3c63,_0x3747bf){var _0x17fbc9={},_0x4d8433={},_0x28c614={'count':0x0,'rows':[]};var _0x566215=_[_0xf96e('0x27')](db['FaxApplication']['rawAttributes'],function(_0x4b7df3){return{'name':_0x4b7df3[_0xf96e('0x28')],'type':_0x4b7df3[_0xf96e('0x29')][_0xf96e('0x2a')]};});_0x4d8433['model']=_[_0xf96e('0x27')](_0x566215,'name');_0x4d8433['query']=_['keys'](_0x4a3c63[_0xf96e('0x2b')]);_0x4d8433[_0xf96e('0x2c')]=_[_0xf96e('0x2d')](_0x4d8433[_0xf96e('0x2e')],_0x4d8433[_0xf96e('0x2b')]);_0x17fbc9[_0xf96e('0x2f')]=_[_0xf96e('0x2d')](_0x4d8433['model'],qs[_0xf96e('0x30')](_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x30')]));_0x17fbc9[_0xf96e('0x2f')]=_0x17fbc9[_0xf96e('0x2f')][_0xf96e('0x31')]?_0x17fbc9[_0xf96e('0x2f')]:_0x4d8433[_0xf96e('0x2e')];if(!_0x4a3c63[_0xf96e('0x2b')]['hasOwnProperty'](_0xf96e('0x32'))){_0x17fbc9[_0xf96e('0x1a')]=qs['limit'](_0x4a3c63['query']['limit']);_0x17fbc9[_0xf96e('0x19')]=qs[_0xf96e('0x19')](_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x19')]);}_0x17fbc9[_0xf96e('0x33')]=qs['sort'](_0x4a3c63['query'][_0xf96e('0x34')]);_0x17fbc9[_0xf96e('0x35')]=qs[_0xf96e('0x2c')](_[_0xf96e('0x36')](_0x4a3c63[_0xf96e('0x2b')],_0x4d8433[_0xf96e('0x2c')]),_0x566215);if(_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x37')]){_0x17fbc9[_0xf96e('0x35')]=_[_0xf96e('0x38')](_0x17fbc9[_0xf96e('0x35')],{'$or':_[_0xf96e('0x27')](_0x566215,function(_0x35c0cf){if(_0x35c0cf[_0xf96e('0x29')]!==_0xf96e('0x39')){var _0x30c271={};_0x30c271[_0x35c0cf['name']]={'$like':'%'+_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x37')]+'%'};return _0x30c271;}})});}_0x17fbc9=_[_0xf96e('0x38')]({},_0x17fbc9,_0x4a3c63[_0xf96e('0x3a')]);var _0x2dd567={'where':_0x17fbc9[_0xf96e('0x35')]};return db[_0xf96e('0x3b')][_0xf96e('0x1b')](_0x2dd567)[_0xf96e('0x22')](function(_0x2edda9){_0x28c614['count']=_0x2edda9;if(_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x3c')]){_0x17fbc9[_0xf96e('0x3d')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x17fbc9);})[_0xf96e('0x22')](function(_0x457335){_0x28c614[_0xf96e('0x3e')]=_0x457335;return _0x28c614;})[_0xf96e('0x22')](respondWithFilteredResult(_0x3747bf,_0x17fbc9))[_0xf96e('0x3f')](handleError(_0x3747bf,null));};exports[_0xf96e('0x40')]=function(_0x2df83a,_0x567dd4){var _0x31a1b4={'raw':!![],'where':{'id':_0x2df83a[_0xf96e('0x41')]['id']}},_0x5bc72={};_0x5bc72[_0xf96e('0x2e')]=_[_0xf96e('0x42')](db[_0xf96e('0x3b')][_0xf96e('0x43')]);_0x5bc72[_0xf96e('0x2b')]=_['keys'](_0x2df83a['query']);_0x5bc72['filters']=_[_0xf96e('0x2d')](_0x5bc72[_0xf96e('0x2e')],_0x5bc72[_0xf96e('0x2b')]);_0x31a1b4[_0xf96e('0x2f')]=_['intersection'](_0x5bc72[_0xf96e('0x2e')],qs[_0xf96e('0x30')](_0x2df83a['query'][_0xf96e('0x30')]));_0x31a1b4[_0xf96e('0x2f')]=_0x31a1b4['attributes'][_0xf96e('0x31')]?_0x31a1b4[_0xf96e('0x2f')]:_0x5bc72[_0xf96e('0x2e')];if(_0x2df83a['query'][_0xf96e('0x3c')]){_0x31a1b4[_0xf96e('0x3d')]=[{'all':!![]}];}_0x31a1b4=_[_0xf96e('0x38')]({},_0x31a1b4,_0x2df83a[_0xf96e('0x3a')]);return db['FaxApplication'][_0xf96e('0x44')](_0x31a1b4)['then'](handleEntityNotFound(_0x567dd4,null))[_0xf96e('0x22')](respondWithResult(_0x567dd4,null))[_0xf96e('0x3f')](handleError(_0x567dd4,null));};exports['create']=function(_0x255e5c,_0x32ace3){return db['FaxApplication'][_0xf96e('0x45')](_0x255e5c[_0xf96e('0x46')],{})[_0xf96e('0x22')](respondWithResult(_0x32ace3,0xc9))['catch'](handleError(_0x32ace3,null));};exports[_0xf96e('0x20')]=function(_0x37ac50,_0x401120){if(_0x37ac50[_0xf96e('0x46')]['id']){delete _0x37ac50[_0xf96e('0x46')]['id'];}return db[_0xf96e('0x3b')]['find']({'where':{'id':_0x37ac50[_0xf96e('0x41')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x401120,null))[_0xf96e('0x22')](saveUpdates(_0x37ac50['body'],null))[_0xf96e('0x22')](respondWithResult(_0x401120,null))[_0xf96e('0x3f')](handleError(_0x401120,null));};exports[_0xf96e('0x21')]=function(_0x2e1014,_0x5f4563){return db[_0xf96e('0x3b')][_0xf96e('0x44')]({'where':{'id':_0x2e1014[_0xf96e('0x41')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x5f4563,null))[_0xf96e('0x22')](removeEntity(_0x5f4563,null))[_0xf96e('0x3f')](handleError(_0x5f4563,null));}; \ No newline at end of file +var _0xd5de=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','FaxApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','type','include','catch','show','length','includeAll','options','find','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xd5de,0xc7));var _0xed5d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd5de[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xed5d('0x0'));var rimraf=require(_0xed5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed5d('0x2'));var rp=require('request-promise');var moment=require(_0xed5d('0x3'));var BPromise=require(_0xed5d('0x4'));var Mustache=require('mustache');var util=require(_0xed5d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xed5d('0x6'));var ejs=require(_0xed5d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed5d('0x8'));var squel=require(_0xed5d('0x9'));var crypto=require(_0xed5d('0xa'));var jsforce=require(_0xed5d('0xb'));var deskjs=require(_0xed5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed5d('0xd'));var Papa=require('papaparse');var Redis=require(_0xed5d('0xe'));var authService=require(_0xed5d('0xf'));var qs=require(_0xed5d('0x10'));var as=require(_0xed5d('0x11'));var hardwareService=require(_0xed5d('0x12'));var logger=require(_0xed5d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xed5d('0x14'));var licenseUtil=require(_0xed5d('0x15'));var db=require(_0xed5d('0x16'))['db'];function respondWithStatusCode(_0x1ed5d6,_0x55fe59){_0x55fe59=_0x55fe59||0xcc;return function(_0x36df3b){if(_0x36df3b){return _0x1ed5d6['sendStatus'](_0x55fe59);}return _0x1ed5d6[_0xed5d('0x17')](_0x55fe59)[_0xed5d('0x18')]();};}function respondWithResult(_0x4c151f,_0x17871e){_0x17871e=_0x17871e||0xc8;return function(_0x17519f){if(_0x17519f){return _0x4c151f[_0xed5d('0x17')](_0x17871e)[_0xed5d('0x19')](_0x17519f);}};}function respondWithFilteredResult(_0x5bd629,_0x197dc0){return function(_0x46dfd3){if(_0x46dfd3){var _0x73eab=typeof _0x197dc0[_0xed5d('0x1a')]===_0xed5d('0x1b')&&typeof _0x197dc0[_0xed5d('0x1c')]===_0xed5d('0x1b');var _0xa13bd2=_0x46dfd3[_0xed5d('0x1d')];var _0x42c851=_0x73eab?0x0:_0x197dc0[_0xed5d('0x1a')];var _0x5d1975=_0x73eab?_0x46dfd3[_0xed5d('0x1d')]:_0x197dc0[_0xed5d('0x1a')]+_0x197dc0[_0xed5d('0x1c')];var _0x5639de;if(_0x5d1975>=_0xa13bd2){_0x5d1975=_0xa13bd2;_0x5639de=0xc8;}else{_0x5639de=0xce;}_0x5bd629[_0xed5d('0x17')](_0x5639de);return _0x5bd629['set'](_0xed5d('0x1e'),_0x42c851+'-'+_0x5d1975+'/'+_0xa13bd2)['json'](_0x46dfd3);}return null;};}function patchUpdates(_0x5ef10b){return function(_0x3b3037){try{jsonpatch[_0xed5d('0x1f')](_0x3b3037,_0x5ef10b,!![]);}catch(_0x1baa0b){return BPromise[_0xed5d('0x20')](_0x1baa0b);}return _0x3b3037[_0xed5d('0x21')]();};}function saveUpdates(_0x342118,_0x5410b2){return function(_0x21eb87){if(_0x21eb87){return _0x21eb87[_0xed5d('0x22')](_0x342118)[_0xed5d('0x23')](function(_0x15ee96){return _0x15ee96;});}return null;};}function removeEntity(_0x249d3f,_0x2ac4ac){return function(_0x435613){if(_0x435613){return _0x435613[_0xed5d('0x24')]()['then'](function(){_0x249d3f[_0xed5d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ada6,_0x5abebd){return function(_0x3a83cc){if(!_0x3a83cc){_0x26ada6[_0xed5d('0x25')](0x194);}return _0x3a83cc;};}function handleError(_0x17c8b7,_0x4b6ec6){_0x4b6ec6=_0x4b6ec6||0x1f4;return function(_0x1adb9e){logger[_0xed5d('0x26')](_0x1adb9e[_0xed5d('0x27')]);if(_0x1adb9e[_0xed5d('0x28')]){delete _0x1adb9e[_0xed5d('0x28')];}_0x17c8b7[_0xed5d('0x17')](_0x4b6ec6)[_0xed5d('0x29')](_0x1adb9e);};}exports['index']=function(_0x1c5f2d,_0x349751){var _0x2e3bf2={},_0x514f79={},_0x3de1de={'count':0x0,'rows':[]};var _0x15d915=_['map'](db[_0xed5d('0x2a')][_0xed5d('0x2b')],function(_0x1cc2f1){return{'name':_0x1cc2f1[_0xed5d('0x2c')],'type':_0x1cc2f1['type'][_0xed5d('0x2d')]};});_0x514f79['model']=_['map'](_0x15d915,_0xed5d('0x28'));_0x514f79[_0xed5d('0x2e')]=_[_0xed5d('0x2f')](_0x1c5f2d['query']);_0x514f79[_0xed5d('0x30')]=_[_0xed5d('0x31')](_0x514f79[_0xed5d('0x32')],_0x514f79[_0xed5d('0x2e')]);_0x2e3bf2[_0xed5d('0x33')]=_['intersection'](_0x514f79[_0xed5d('0x32')],qs[_0xed5d('0x34')](_0x1c5f2d[_0xed5d('0x2e')][_0xed5d('0x34')]));_0x2e3bf2['attributes']=_0x2e3bf2['attributes']['length']?_0x2e3bf2[_0xed5d('0x33')]:_0x514f79[_0xed5d('0x32')];if(!_0x1c5f2d[_0xed5d('0x2e')]['hasOwnProperty'](_0xed5d('0x35'))){_0x2e3bf2[_0xed5d('0x1c')]=qs[_0xed5d('0x1c')](_0x1c5f2d[_0xed5d('0x2e')][_0xed5d('0x1c')]);_0x2e3bf2['offset']=qs[_0xed5d('0x1a')](_0x1c5f2d['query'][_0xed5d('0x1a')]);}_0x2e3bf2[_0xed5d('0x36')]=qs[_0xed5d('0x37')](_0x1c5f2d[_0xed5d('0x2e')][_0xed5d('0x37')]);_0x2e3bf2[_0xed5d('0x38')]=qs['filters'](_[_0xed5d('0x39')](_0x1c5f2d['query'],_0x514f79[_0xed5d('0x30')]),_0x15d915);if(_0x1c5f2d[_0xed5d('0x2e')][_0xed5d('0x3a')]){_0x2e3bf2[_0xed5d('0x38')]=_[_0xed5d('0x3b')](_0x2e3bf2['where'],{'$or':_[_0xed5d('0x3c')](_0x15d915,function(_0x2f8d73){if(_0x2f8d73[_0xed5d('0x3d')]!=='VIRTUAL'){var _0x30fb4e={};_0x30fb4e[_0x2f8d73[_0xed5d('0x28')]]={'$like':'%'+_0x1c5f2d['query'][_0xed5d('0x3a')]+'%'};return _0x30fb4e;}})});}_0x2e3bf2=_[_0xed5d('0x3b')]({},_0x2e3bf2,_0x1c5f2d['options']);var _0x543989={'where':_0x2e3bf2['where']};return db['FaxApplication'][_0xed5d('0x1d')](_0x543989)[_0xed5d('0x23')](function(_0x1ed16c){_0x3de1de['count']=_0x1ed16c;if(_0x1c5f2d[_0xed5d('0x2e')]['includeAll']){_0x2e3bf2[_0xed5d('0x3e')]=[{'all':!![]}];}return db[_0xed5d('0x2a')]['findAll'](_0x2e3bf2);})[_0xed5d('0x23')](function(_0x1de025){_0x3de1de['rows']=_0x1de025;return _0x3de1de;})['then'](respondWithFilteredResult(_0x349751,_0x2e3bf2))[_0xed5d('0x3f')](handleError(_0x349751,null));};exports[_0xed5d('0x40')]=function(_0xc4f9c7,_0x25e1b4){var _0x5deb1e={'raw':!![],'where':{'id':_0xc4f9c7['params']['id']}},_0x4ab0fb={};_0x4ab0fb[_0xed5d('0x32')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x4ab0fb[_0xed5d('0x2e')]=_[_0xed5d('0x2f')](_0xc4f9c7['query']);_0x4ab0fb[_0xed5d('0x30')]=_[_0xed5d('0x31')](_0x4ab0fb[_0xed5d('0x32')],_0x4ab0fb[_0xed5d('0x2e')]);_0x5deb1e[_0xed5d('0x33')]=_['intersection'](_0x4ab0fb[_0xed5d('0x32')],qs[_0xed5d('0x34')](_0xc4f9c7[_0xed5d('0x2e')][_0xed5d('0x34')]));_0x5deb1e['attributes']=_0x5deb1e[_0xed5d('0x33')][_0xed5d('0x41')]?_0x5deb1e[_0xed5d('0x33')]:_0x4ab0fb[_0xed5d('0x32')];if(_0xc4f9c7[_0xed5d('0x2e')][_0xed5d('0x42')]){_0x5deb1e[_0xed5d('0x3e')]=[{'all':!![]}];}_0x5deb1e=_['merge']({},_0x5deb1e,_0xc4f9c7[_0xed5d('0x43')]);return db[_0xed5d('0x2a')][_0xed5d('0x44')](_0x5deb1e)['then'](handleEntityNotFound(_0x25e1b4,null))[_0xed5d('0x23')](respondWithResult(_0x25e1b4,null))[_0xed5d('0x3f')](handleError(_0x25e1b4,null));};exports['create']=function(_0x1ef1a1,_0x5d9aeb){return db[_0xed5d('0x2a')][_0xed5d('0x45')](_0x1ef1a1[_0xed5d('0x46')],{})[_0xed5d('0x23')](respondWithResult(_0x5d9aeb,0xc9))['catch'](handleError(_0x5d9aeb,null));};exports['update']=function(_0xca8d27,_0x137e98){if(_0xca8d27[_0xed5d('0x46')]['id']){delete _0xca8d27[_0xed5d('0x46')]['id'];}return db['FaxApplication'][_0xed5d('0x44')]({'where':{'id':_0xca8d27[_0xed5d('0x47')]['id']}})[_0xed5d('0x23')](handleEntityNotFound(_0x137e98,null))[_0xed5d('0x23')](saveUpdates(_0xca8d27['body'],null))[_0xed5d('0x23')](respondWithResult(_0x137e98,null))[_0xed5d('0x3f')](handleError(_0x137e98,null));};exports[_0xed5d('0x24')]=function(_0x40cc7e,_0x101fd2){return db[_0xed5d('0x2a')]['find']({'where':{'id':_0x40cc7e['params']['id']}})[_0xed5d('0x23')](handleEntityNotFound(_0x101fd2,null))[_0xed5d('0x23')](removeEntity(_0x101fd2,null))[_0xed5d('0x3f')](handleError(_0x101fd2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 08840b9..260725a 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 _0xcf27=['request-promise','path','rimraf','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xcf27,0x108));var _0x7cf2=function(_0x5d6014,_0x3d91e0){_0x5d6014=_0x5d6014-0x0;var _0x20ea66=_0xcf27[_0x5d6014];return _0x20ea66;};'use strict';var _=require(_0x7cf2('0x0'));var util=require(_0x7cf2('0x1'));var logger=require(_0x7cf2('0x2'))(_0x7cf2('0x3'));var moment=require(_0x7cf2('0x4'));var BPromise=require(_0x7cf2('0x5'));var rp=require(_0x7cf2('0x6'));var fs=require('fs');var path=require(_0x7cf2('0x7'));var rimraf=require(_0x7cf2('0x8'));var config=require('../../config/environment');var attributes=require(_0x7cf2('0x9'));module['exports']=function(_0x143909,_0x2ef843){return _0x143909[_0x7cf2('0xa')](_0x7cf2('0xb'),attributes,{'tableName':_0x7cf2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cf2('0xd'),'collate':_0x7cf2('0xe')});}; \ No newline at end of file +var _0x7ffa=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x7ffa,0xfc));var _0xa7ff=function(_0x1cb8a7,_0xaf607e){_0x1cb8a7=_0x1cb8a7-0x0;var _0x14a3e1=_0x7ffa[_0x1cb8a7];return _0x14a3e1;};'use strict';var _=require(_0xa7ff('0x0'));var util=require(_0xa7ff('0x1'));var logger=require('../../config/logger')(_0xa7ff('0x2'));var moment=require(_0xa7ff('0x3'));var BPromise=require(_0xa7ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7ff('0x5'));var rimraf=require('rimraf');var config=require(_0xa7ff('0x6'));var attributes=require('./faxApplication.attributes');module[_0xa7ff('0x7')]=function(_0x5cf864,_0xd1f720){return _0x5cf864[_0xa7ff('0x8')](_0xa7ff('0x9'),attributes,{'tableName':_0xa7ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7ff('0xb'),'collate':_0xa7ff('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 173d2a8..671f138 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 _0xd07b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','then','debug','lodash','util','moment','bluebird'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xd07b,0xfc));var _0xbd07=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd07b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var moment=require(_0xbd07('0x2'));var BPromise=require(_0xbd07('0x3'));var rs=require(_0xbd07('0x4'));var fs=require('fs');var Redis=require(_0xbd07('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd07('0x6'));var logger=require('../../config/logger')(_0xbd07('0x7'));var config=require(_0xbd07('0x8'));var jayson=require(_0xbd07('0x9'));var client=jayson[_0xbd07('0xa')][_0xbd07('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e8f9c,_0x244e61,_0x1de79b){return new BPromise(function(_0x5caa9b,_0x53e573){return client[_0xbd07('0xc')](_0x1e8f9c,_0x1de79b)['then'](function(_0x4744bd){logger['info'](_0xbd07('0xd'),_0x244e61,'request\x20sent');logger['debug'](_0xbd07('0xe'),_0x244e61,_0xbd07('0xf'),JSON['stringify'](_0x4744bd));if(_0x4744bd[_0xbd07('0x10')]){if(_0x4744bd['error'][_0xbd07('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x244e61,_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);return _0x53e573(_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);}logger[_0xbd07('0x10')](_0xbd07('0xd'),_0x244e61,_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);return _0x5caa9b(_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);}else{logger[_0xbd07('0x13')](_0xbd07('0xd'),_0x244e61,_0xbd07('0xf'));_0x5caa9b(_0x4744bd[_0xbd07('0x14')][_0xbd07('0x12')]);}})[_0xbd07('0x15')](function(_0x3fefd6){logger[_0xbd07('0x10')]('FaxApplication,\x20%s,\x20%s',_0x244e61,_0x3fefd6);_0x53e573(_0x3fefd6);});});}exports[_0xbd07('0x16')]=function(_0x4e35bf){var _0x5e40df=this;return new Promise(function(_0x26317a,_0x275c17){return db[_0xbd07('0x17')][_0xbd07('0x18')](_0x4e35bf[_0xbd07('0x19')],{'raw':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1b')]||null:null,'attributes':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1c')]||null:null,'limit':_0x4e35bf['options']?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1d')]||null:null})[_0xbd07('0x1e')](function(_0x5dec3d){logger[_0xbd07('0x13')](_0xbd07('0x16'),_0x4e35bf);logger[_0xbd07('0x1f')](_0xbd07('0x16'),_0x4e35bf,JSON['stringify'](_0x5dec3d));_0x26317a(_0x5dec3d);})['catch'](function(_0x445c3d){logger['error'](_0xbd07('0x16'),_0x445c3d[_0xbd07('0x12')],_0x4e35bf);_0x275c17(_0x5e40df[_0xbd07('0x10')](0x1f4,_0x445c3d['message']));});});}; \ No newline at end of file +var _0x6cb0=['code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6cb0,0x1bf));var _0x06cb=function(_0x154f21,_0x3c7f37){_0x154f21=_0x154f21-0x0;var _0x5ae16f=_0x6cb0[_0x154f21];return _0x5ae16f;};'use strict';var _=require(_0x06cb('0x0'));var util=require('util');var moment=require(_0x06cb('0x1'));var BPromise=require(_0x06cb('0x2'));var rs=require(_0x06cb('0x3'));var fs=require('fs');var Redis=require(_0x06cb('0x4'));var db=require(_0x06cb('0x5'))['db'];var utils=require(_0x06cb('0x6'));var logger=require(_0x06cb('0x7'))(_0x06cb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x06cb('0x9')][_0x06cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df2d4,_0x32577d,_0x2ecdb0){return new BPromise(function(_0x174874,_0x33ff76){return client[_0x06cb('0xb')](_0x2df2d4,_0x2ecdb0)[_0x06cb('0xc')](function(_0x2b5887){logger[_0x06cb('0xd')]('FaxApplication,\x20%s,\x20%s',_0x32577d,_0x06cb('0xe'));logger[_0x06cb('0xf')](_0x06cb('0x10'),_0x32577d,_0x06cb('0xe'),JSON['stringify'](_0x2b5887));if(_0x2b5887[_0x06cb('0x11')]){if(_0x2b5887[_0x06cb('0x11')][_0x06cb('0x12')]===0x1f4){logger[_0x06cb('0x11')](_0x06cb('0x13'),_0x32577d,_0x2b5887['error'][_0x06cb('0x14')]);return _0x33ff76(_0x2b5887[_0x06cb('0x11')]['message']);}logger[_0x06cb('0x11')](_0x06cb('0x13'),_0x32577d,_0x2b5887['error'][_0x06cb('0x14')]);return _0x174874(_0x2b5887[_0x06cb('0x11')][_0x06cb('0x14')]);}else{logger[_0x06cb('0xd')]('FaxApplication,\x20%s,\x20%s',_0x32577d,_0x06cb('0xe'));_0x174874(_0x2b5887[_0x06cb('0x15')][_0x06cb('0x14')]);}})[_0x06cb('0x16')](function(_0x432d05){logger[_0x06cb('0x11')](_0x06cb('0x13'),_0x32577d,_0x432d05);_0x33ff76(_0x432d05);});});}exports[_0x06cb('0x17')]=function(_0x315199){var _0x2c3607=this;return new Promise(function(_0x1427c0,_0x2549ef){return db['FaxApplication'][_0x06cb('0x18')](_0x315199[_0x06cb('0x19')],{'raw':_0x315199[_0x06cb('0x1a')]?_0x315199[_0x06cb('0x1a')][_0x06cb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x315199[_0x06cb('0x1a')]?_0x315199[_0x06cb('0x1a')][_0x06cb('0x1c')]||null:null,'attributes':_0x315199[_0x06cb('0x1a')]?_0x315199[_0x06cb('0x1a')][_0x06cb('0x1d')]||null:null,'limit':_0x315199[_0x06cb('0x1a')]?_0x315199[_0x06cb('0x1a')][_0x06cb('0x1e')]||null:null})['then'](function(_0x326275){logger[_0x06cb('0xd')](_0x06cb('0x17'),_0x315199);logger['debug'](_0x06cb('0x17'),_0x315199,JSON['stringify'](_0x326275));_0x1427c0(_0x326275);})[_0x06cb('0x16')](function(_0x1c89a4){logger[_0x06cb('0x11')](_0x06cb('0x17'),_0x1c89a4[_0x06cb('0x14')],_0x315199);_0x2549ef(_0x2c3607[_0x06cb('0x11')](0x1f4,_0x1c89a4[_0x06cb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e3c9078..d5e49fd 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 _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xf7b4,0x152));var _0x4f7b=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0xf7b4[_0x490c02];return _0x4604ab;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea28,0x13a));var _0x8ea2=function(_0xf58256,_0x4d603a){_0xf58256=_0xf58256-0x0;var _0x1f7316=_0xea28[_0xf58256];return _0x1f7316;};'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('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 3b800d6..e960ffd 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 _0x47c5=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x27dce9,_0x10d2f8){var _0x1fec31=function(_0x6e3a9a){while(--_0x6e3a9a){_0x27dce9['push'](_0x27dce9['shift']());}};_0x1fec31(++_0x10d2f8);}(_0x47c5,0x165));var _0x547c=function(_0x5025f4,_0x4c575c){_0x5025f4=_0x5025f4-0x0;var _0x5b540e=_0x47c5[_0x5025f4];return _0x5b540e;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'closed':{'type':Sequelize[_0x547c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x547c('0x3')]},'disposition':{'type':Sequelize[_0x547c('0x4')]},'secondDisposition':{'type':Sequelize[_0x547c('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x547c('0x4')]},'read1stAt':{'type':Sequelize[_0x547c('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x547c('0x5')]('in',_0x547c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x547c('0x5')]('in',_0x547c('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x547c('0x7')]}}; \ No newline at end of file +var _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x1b9adc,_0x3e7274){var _0x1a7906=function(_0x273527){while(--_0x273527){_0x1b9adc['push'](_0x1b9adc['shift']());}};_0x1a7906(++_0x3e7274);}(_0xcaf2,0x8a));var _0x2caf=function(_0x406b98,_0x3dea6d){_0x406b98=_0x406b98-0x0;var _0x10545f=_0xcaf2[_0x406b98];return _0x10545f;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index d988c22..f159aff 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 _0x8f85=['lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./faxInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','length','include','options','find','create','body','describe','FaxMessage','addMessage','findOne','hasOwnProperty','sort','where','pick','FaxInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','faxInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','resolve','download','log','err','unlinkSync','rimraf','bluebird','path'];(function(_0x328825,_0x2e7366){var _0x4aac3a=function(_0x2c7a8d){while(--_0x2c7a8d){_0x328825['push'](_0x328825['shift']());}};_0x4aac3a(++_0x2e7366);}(_0x8f85,0x64));var _0x58f8=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8f85[_0x342baa];return _0x1208f3;};'use strict';var rimraf=require(_0x58f8('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x58f8('0x1'));var util=require('util');var path=require(_0x58f8('0x2'));var fs=require('fs');var _=require(_0x58f8('0x3'));var Redis=require(_0x58f8('0x4'));var interaction=require(_0x58f8('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x58f8('0x6'))(_0x58f8('0x7'));var config=require(_0x58f8('0x8'));var db=require(_0x58f8('0x9'))['db'];config[_0x58f8('0xa')]=_[_0x58f8('0xb')](config[_0x58f8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58f8('0xa')]));require(_0x58f8('0xc'))[_0x58f8('0xd')](socket);function respondWithStatusCode(_0x2ea80a,_0x3aec92){_0x3aec92=_0x3aec92||0xcc;return function(_0x34365b){if(_0x34365b){return _0x2ea80a['sendStatus'](_0x3aec92);}return _0x2ea80a['status'](_0x3aec92)[_0x58f8('0xe')]();};}function respondWithResult(_0x29763a,_0x311fda){_0x311fda=_0x311fda||0xc8;return function(_0x542604){if(_0x542604){return _0x29763a[_0x58f8('0xf')](_0x311fda)[_0x58f8('0x10')](_0x542604);}};}function respondWithFilteredResult(_0x7a93a2,_0x561c3e){return function(_0x5e3954){if(_0x5e3954){var _0x39af74=typeof _0x561c3e[_0x58f8('0x11')]===_0x58f8('0x12')&&typeof _0x561c3e[_0x58f8('0x13')]==='undefined';var _0x2d6083=_0x5e3954[_0x58f8('0x14')];var _0x5cfd72=_0x39af74?0x0:_0x561c3e[_0x58f8('0x11')];var _0x445074=_0x39af74?_0x5e3954[_0x58f8('0x14')]:_0x561c3e['offset']+_0x561c3e[_0x58f8('0x13')];var _0x591da8;if(_0x445074>=_0x2d6083){_0x445074=_0x2d6083;_0x591da8=0xc8;}else{_0x591da8=0xce;}_0x7a93a2['status'](_0x591da8);return _0x7a93a2[_0x58f8('0x15')]('Content-Range',_0x5cfd72+'-'+_0x445074+'/'+_0x2d6083)[_0x58f8('0x10')](_0x5e3954);}return null;};}function saveUpdates(_0x57804b){return function(_0x5eee2e){if(_0x5eee2e){return _0x5eee2e[_0x58f8('0x16')](_0x57804b)[_0x58f8('0x17')](function(_0x4d2f52){return _0x4d2f52;});}return null;};}function removeEntity(_0x1df0bb){return function(_0x4f276d){if(_0x4f276d){return _0x4f276d[_0x58f8('0x18')]()[_0x58f8('0x17')](function(){_0x1df0bb[_0x58f8('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9323){return function(_0x2dad2f){if(!_0x2dad2f){_0x4e9323[_0x58f8('0x19')](0x194);}return _0x2dad2f;};}function handleError(_0x290067,_0x407347){_0x407347=_0x407347||0x1f4;return function(_0x82a183){logger['error'](_0x82a183[_0x58f8('0x1a')]);if(_0x82a183[_0x58f8('0x1b')]){delete _0x82a183[_0x58f8('0x1b')];}_0x290067['status'](_0x407347)[_0x58f8('0x1c')](_0x82a183);};}exports[_0x58f8('0x1d')]=function(_0x37b6d5,_0x4043f6){var _0xbbb0aa={};var _0x1842c3=_[_0x58f8('0x1e')](db[_0x58f8('0x1f')]['rawAttributes'],function(_0x5e6c3d){return{'name':_0x5e6c3d[_0x58f8('0x20')],'type':_0x5e6c3d[_0x58f8('0x21')][_0x58f8('0x22')]};});_0xbbb0aa=qs[_0x58f8('0x23')](_0x1842c3,_0x37b6d5);return interaction[_0x58f8('0x24')](_0x58f8('0x25'),_0x37b6d5[_0x58f8('0x26')],_0x37b6d5[_0x58f8('0x27')],_0xbbb0aa,_0x1842c3)[_0x58f8('0x17')](respondWithFilteredResult(_0x4043f6,_0xbbb0aa))[_0x58f8('0x28')](handleError(_0x4043f6,null));};exports[_0x58f8('0x29')]=function(_0xdf960a,_0x25bb8a){var _0x4dab88={'raw':![],'where':{'id':_0xdf960a[_0x58f8('0x2a')]['id']}},_0x32ff34={};_0x32ff34['model']=_[_0x58f8('0x2b')](db[_0x58f8('0x1f')][_0x58f8('0x2c')]);_0x32ff34[_0x58f8('0x26')]=_['keys'](_0xdf960a['query']);_0x32ff34[_0x58f8('0x2d')]=_[_0x58f8('0x2e')](_0x32ff34[_0x58f8('0x2f')],_0x32ff34[_0x58f8('0x26')]);_0x4dab88[_0x58f8('0x30')]=_[_0x58f8('0x2e')](_0x32ff34[_0x58f8('0x2f')],qs[_0x58f8('0x31')](_0xdf960a[_0x58f8('0x26')][_0x58f8('0x31')]));_0x4dab88[_0x58f8('0x30')]=_0x4dab88[_0x58f8('0x30')][_0x58f8('0x32')]?_0x4dab88[_0x58f8('0x30')]:_0x32ff34[_0x58f8('0x2f')];if(_0xdf960a[_0x58f8('0x26')]['includeAll']){_0x4dab88[_0x58f8('0x33')]=[{'all':!![]}];}_0x4dab88=_['merge']({},_0x4dab88,_0xdf960a[_0x58f8('0x34')]);return db[_0x58f8('0x1f')][_0x58f8('0x35')](_0x4dab88)[_0x58f8('0x17')](handleEntityNotFound(_0x25bb8a,null))['then'](respondWithResult(_0x25bb8a,null))[_0x58f8('0x28')](handleError(_0x25bb8a,null));};exports[_0x58f8('0x36')]=function(_0x402504,_0x5ecd66){return db['FaxInteraction'][_0x58f8('0x36')](_0x402504[_0x58f8('0x37')],{})[_0x58f8('0x17')](respondWithResult(_0x5ecd66,0xc9))[_0x58f8('0x28')](handleError(_0x5ecd66,null));};exports['update']=function(_0x542071,_0x4c70ca){if(_0x542071[_0x58f8('0x37')]['id']){delete _0x542071[_0x58f8('0x37')]['id'];}return db[_0x58f8('0x1f')][_0x58f8('0x35')]({'where':{'id':_0x542071[_0x58f8('0x2a')]['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x4c70ca,null))[_0x58f8('0x17')](saveUpdates(_0x542071[_0x58f8('0x37')],null))[_0x58f8('0x17')](respondWithResult(_0x4c70ca,null))[_0x58f8('0x28')](handleError(_0x4c70ca,null));};exports[_0x58f8('0x18')]=function(_0x4ecc28,_0x2a3c28){return db['FaxInteraction'][_0x58f8('0x35')]({'where':{'id':_0x4ecc28[_0x58f8('0x2a')]['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x2a3c28,null))[_0x58f8('0x17')](removeEntity(_0x2a3c28,null))[_0x58f8('0x28')](handleError(_0x2a3c28,null));};exports['describe']=function(_0x180fe1,_0x21da7d){return db[_0x58f8('0x1f')][_0x58f8('0x38')]()['then'](respondWithResult(_0x21da7d,null))[_0x58f8('0x28')](handleError(_0x21da7d,null));};exports['addMessage']=function(_0x3ca656,_0x2f6ae6){return db[_0x58f8('0x39')][_0x58f8('0x35')]({'where':{'id':_0x3ca656[_0x58f8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2f6ae6,null))[_0x58f8('0x17')](function(_0x317a14){if(_0x317a14){return _0x317a14[_0x58f8('0x3a')](_0x3ca656[_0x58f8('0x37')]['ids'],_['omit'](_0x3ca656['body'],['ids','id'])||{});}})[_0x58f8('0x17')](respondWithResult(_0x2f6ae6,null))[_0x58f8('0x28')](handleError(_0x2f6ae6,null));};exports['getMessages']=function(_0xa3aa3f,_0x45a879){var _0x16022d={'raw':![],'where':{}};var _0x4fae9c={};var _0x17dc26={'count':0x0,'rows':[]};return db[_0x58f8('0x1f')][_0x58f8('0x3b')]({'where':{'id':_0xa3aa3f['params']['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x45a879,null))[_0x58f8('0x17')](function(_0x2a627e){if(_0x2a627e){_0x4fae9c[_0x58f8('0x2f')]=_[_0x58f8('0x2b')](db['FaxMessage']['rawAttributes']);_0x4fae9c[_0x58f8('0x26')]=_['keys'](_0xa3aa3f['query']);_0x4fae9c[_0x58f8('0x2d')]=_[_0x58f8('0x2e')](_0x4fae9c[_0x58f8('0x2f')],_0x4fae9c[_0x58f8('0x26')]);_0x16022d['attributes']=_[_0x58f8('0x2e')](_0x4fae9c[_0x58f8('0x2f')],qs[_0x58f8('0x31')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x31')]));_0x16022d[_0x58f8('0x30')]=_0x16022d[_0x58f8('0x30')][_0x58f8('0x32')]?_0x16022d[_0x58f8('0x30')]:_0x4fae9c[_0x58f8('0x2f')];if(!_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x3c')]('nolimit')){_0x16022d[_0x58f8('0x13')]=qs[_0x58f8('0x13')](_0xa3aa3f[_0x58f8('0x26')]['limit']);_0x16022d[_0x58f8('0x11')]=qs[_0x58f8('0x11')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x11')]);}_0x16022d['order']=qs[_0x58f8('0x3d')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x3d')]);_0x16022d[_0x58f8('0x3e')]=qs[_0x58f8('0x2d')](_[_0x58f8('0x3f')](_0xa3aa3f['query'],_0x4fae9c[_0x58f8('0x2d')]));_0x16022d[_0x58f8('0x3e')][_0x58f8('0x40')]=_0x2a627e['id'];if(_0xa3aa3f[_0x58f8('0x26')]['filter']){_0x16022d[_0x58f8('0x3e')]=_[_0x58f8('0x41')](_0x16022d['where'],{'$or':_[_0x58f8('0x1e')](_0x16022d['attributes'],function(_0x37f99a){var _0x34d578={};_0x34d578[_0x37f99a]={'$like':'%'+_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x42')]+'%'};return _0x34d578;})});}if(_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x43')]){var _0x4332b7=_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x43')][_0x58f8('0x44')](',');var _0x3ad35a={};_0x3ad35a[_0x4332b7[0x0]]={'$gte':moment(_0x4332b7[0x1])[_0x58f8('0x45')](_0x58f8('0x46'))};_0x16022d[_0x58f8('0x3e')]=_['merge'](_0x16022d[_0x58f8('0x3e')],_0x3ad35a);}_0x16022d=_[_0x58f8('0x41')]({},_0x16022d,_0xa3aa3f['options']);return db[_0x58f8('0x39')][_0x58f8('0x14')]({'where':_0x16022d[_0x58f8('0x3e')]})[_0x58f8('0x17')](function(_0x2f9000){_0x17dc26[_0x58f8('0x14')]=_0x2f9000;if(_0xa3aa3f['query'][_0x58f8('0x47')]){_0x16022d[_0x58f8('0x33')]=[{'all':!![]}];}return db[_0x58f8('0x39')][_0x58f8('0x24')](_0x16022d);})[_0x58f8('0x17')](function(_0x513fa9){_0x17dc26[_0x58f8('0x48')]=_0x513fa9;return _0x17dc26;});}})[_0x58f8('0x17')](respondWithFilteredResult(_0x45a879,_0x16022d))['catch'](handleError(_0x45a879,null));};exports[_0x58f8('0x49')]=function(_0x4cda7d,_0x127bca){return db['FaxInteraction']['find']({'where':{'id':_0x4cda7d[_0x58f8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x127bca,null))[_0x58f8('0x17')](function(_0x3bd9fb){if(_0x3bd9fb){return _0x3bd9fb[_0x58f8('0x4a')](_0x4cda7d[_0x58f8('0x37')][_0x58f8('0x4b')],_['omit'](_0x4cda7d['body'],['ids','id'])||{})[_0x58f8('0x4c')](function(){return db[_0x58f8('0x4d')][_0x58f8('0x24')]({'attributes':['id',_0x58f8('0x1b'),_0x58f8('0x4e')],'where':{'id':_0x4cda7d[_0x58f8('0x37')][_0x58f8('0x4b')]}});})[_0x58f8('0x17')](function(_0x2aa1e7){socket[_0x58f8('0x4f')](_0x58f8('0x50'),{'id':Number(_0x4cda7d[_0x58f8('0x2a')]['id']),'tags':_0x2aa1e7||[]});return{'id':Number(_0x4cda7d[_0x58f8('0x2a')]['id']),'tags':_0x2aa1e7||[]};});}})[_0x58f8('0x17')](respondWithResult(_0x127bca,null))[_0x58f8('0x28')](handleError(_0x127bca,null));};exports[_0x58f8('0x51')]=function(_0xa0dbb2,_0x3c4f19){return db['FaxInteraction'][_0x58f8('0x35')]({'where':{'id':_0xa0dbb2['params']['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x3c4f19,null))[_0x58f8('0x17')](function(_0x372540){if(_0x372540){return _0x372540[_0x58f8('0x51')](_0xa0dbb2[_0x58f8('0x26')][_0x58f8('0x4b')]);}})[_0x58f8('0x17')](respondWithStatusCode(_0x3c4f19,null))[_0x58f8('0x28')](handleError(_0x3c4f19,null));};exports['download']=function(_0x3736ce,_0x379314){var _0xcab93d=moment()['unix']()['toString']();var _0x195d71=path[_0x58f8('0x52')](config[_0x58f8('0x53')],_0x58f8('0x54'),_0x58f8('0x55'),_0x58f8('0x56'));var _0x455e11=path[_0x58f8('0x52')](config[_0x58f8('0x53')],_0x58f8('0x54'),_0x58f8('0x55'),_0x58f8('0x57'));var _0x666059=path['join'](_0x195d71,_0xcab93d);var _0x2f8a0b=util[_0x58f8('0x45')](_0x58f8('0x58'),_0x3736ce[_0x58f8('0x2a')]['id'],_0xcab93d);var _0x16e175=path[_0x58f8('0x52')](_0x195d71,_0x2f8a0b);var _0x16fd08=[];_0x16fd08[_0x58f8('0x59')]({'model':db[_0x58f8('0x5a')],'as':_0x58f8('0x5a'),'raw':!![]});var _0xac825c=[{'model':db[_0x58f8('0x39')],'as':_0x58f8('0x5b'),'attributes':['id',_0x58f8('0x37'),_0x58f8('0x5c')],'include':_0x16fd08}];return db[_0x58f8('0x1f')][_0x58f8('0x35')]({'where':{'id':_0x3736ce[_0x58f8('0x2a')]['id']},'include':_0xac825c})[_0x58f8('0x17')](handleEntityNotFound(_0x379314,null))['then'](function(_0x925ce7){if(_0x925ce7&&_0x925ce7['Messages']){var _0x1397f3=_0x925ce7[_0x58f8('0x5d')]({'plain':!![]});fs[_0x58f8('0x5e')](_0x666059);for(var _0xb4b54e=0x0;_0xb4b54e<_0x1397f3['Messages'][_0x58f8('0x32')];_0xb4b54e++){var _0x184abf=_0x1397f3[_0x58f8('0x5b')][_0xb4b54e][_0x58f8('0x5a')];if(_0x184abf){var _0x531329=path['join'](_0x455e11,_0x184abf[_0x58f8('0x5f')]);if(fs[_0x58f8('0x60')](_0x531329)){fs['createReadStream'](_0x531329)[_0x58f8('0x61')](fs['createWriteStream'](path['join'](_0x666059,_0x184abf[_0x58f8('0x5f')])));}}}return BPromise[_0x58f8('0x62')]()[_0x58f8('0x17')](function(){return new BPromise(function(_0x383b9e,_0x754033){zipdir(_0x666059,{'saveTo':_0x16e175},function(_0x334e26,_0x139532){if(_0x334e26)return _0x754033(_0x334e26);return _0x383b9e(_0x139532);});})[_0x58f8('0x17')](function(){return new BPromise(function(_0x4a7711,_0x1b7bc9){rimraf(_0x666059,function(_0x483aa5){if(_0x483aa5)_0x1b7bc9(_0x483aa5);return _0x4a7711();});});})[_0x58f8('0x17')](function(){return _0x379314[_0x58f8('0x63')](_0x16e175,_0x2f8a0b,function(_0x235c0e){if(_0x235c0e){console[_0x58f8('0x64')](_0x58f8('0x65'),_0x235c0e);}else{fs[_0x58f8('0x66')](_0x16e175);}});});});}else{return _0x379314[_0x58f8('0x19')](0xc8);}})['catch'](handleError(_0x379314,null));}; \ No newline at end of file +var _0x8e87=['filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','Tag','color','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','params','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId'];(function(_0x86b162,_0x39a293){var _0x12c31b=function(_0xdc16b9){while(--_0xdc16b9){_0x86b162['push'](_0x86b162['shift']());}};_0x12c31b(++_0x39a293);}(_0x8e87,0xf2));var _0x78e8=function(_0x3534cc,_0x1bfdec){_0x3534cc=_0x3534cc-0x0;var _0xe92f9a=_0x8e87[_0x3534cc];return _0xe92f9a;};'use strict';var rimraf=require(_0x78e8('0x0'));var zipdir=require(_0x78e8('0x1'));var moment=require('moment');var BPromise=require(_0x78e8('0x2'));var util=require('util');var path=require(_0x78e8('0x3'));var fs=require('fs');var _=require(_0x78e8('0x4'));var Redis=require(_0x78e8('0x5'));var interaction=require(_0x78e8('0x6'));var qs=require(_0x78e8('0x7'));var logger=require(_0x78e8('0x8'))(_0x78e8('0x9'));var config=require(_0x78e8('0xa'));var db=require(_0x78e8('0xb'))['db'];config[_0x78e8('0xc')]=_['defaults'](config[_0x78e8('0xc')],{'host':_0x78e8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78e8('0xc')]));require(_0x78e8('0xe'))['register'](socket);function respondWithStatusCode(_0x41917b,_0xaf15e2){_0xaf15e2=_0xaf15e2||0xcc;return function(_0x4371f8){if(_0x4371f8){return _0x41917b[_0x78e8('0xf')](_0xaf15e2);}return _0x41917b[_0x78e8('0x10')](_0xaf15e2)['end']();};}function respondWithResult(_0x47e84f,_0x44be9d){_0x44be9d=_0x44be9d||0xc8;return function(_0xdbadf3){if(_0xdbadf3){return _0x47e84f[_0x78e8('0x10')](_0x44be9d)['json'](_0xdbadf3);}};}function respondWithFilteredResult(_0x241a2a,_0x521f34){return function(_0x121a78){if(_0x121a78){var _0x1e7d00=typeof _0x521f34[_0x78e8('0x11')]===_0x78e8('0x12')&&typeof _0x521f34['limit']===_0x78e8('0x12');var _0x5923ab=_0x121a78[_0x78e8('0x13')];var _0x402b93=_0x1e7d00?0x0:_0x521f34[_0x78e8('0x11')];var _0x129e30=_0x1e7d00?_0x121a78['count']:_0x521f34[_0x78e8('0x11')]+_0x521f34[_0x78e8('0x14')];var _0x341dc4;if(_0x129e30>=_0x5923ab){_0x129e30=_0x5923ab;_0x341dc4=0xc8;}else{_0x341dc4=0xce;}_0x241a2a[_0x78e8('0x10')](_0x341dc4);return _0x241a2a[_0x78e8('0x15')](_0x78e8('0x16'),_0x402b93+'-'+_0x129e30+'/'+_0x5923ab)[_0x78e8('0x17')](_0x121a78);}return null;};}function saveUpdates(_0xe757ee){return function(_0x462d1c){if(_0x462d1c){return _0x462d1c[_0x78e8('0x18')](_0xe757ee)[_0x78e8('0x19')](function(_0x46d56a){return _0x46d56a;});}return null;};}function removeEntity(_0x398c13){return function(_0x332381){if(_0x332381){return _0x332381[_0x78e8('0x1a')]()[_0x78e8('0x19')](function(){_0x398c13[_0x78e8('0x10')](0xcc)[_0x78e8('0x1b')]();});}};}function handleEntityNotFound(_0x14492c){return function(_0x1ccaf6){if(!_0x1ccaf6){_0x14492c[_0x78e8('0xf')](0x194);}return _0x1ccaf6;};}function handleError(_0x27de57,_0x52ab9d){_0x52ab9d=_0x52ab9d||0x1f4;return function(_0x4b682d){logger['error'](_0x4b682d[_0x78e8('0x1c')]);if(_0x4b682d[_0x78e8('0x1d')]){delete _0x4b682d[_0x78e8('0x1d')];}_0x27de57[_0x78e8('0x10')](_0x52ab9d)[_0x78e8('0x1e')](_0x4b682d);};}exports[_0x78e8('0x1f')]=function(_0x2918a3,_0xe270c2){var _0x58e5cb={};var _0x31c038=_[_0x78e8('0x20')](db[_0x78e8('0x21')][_0x78e8('0x22')],function(_0xa23879){return{'name':_0xa23879[_0x78e8('0x23')],'type':_0xa23879[_0x78e8('0x24')][_0x78e8('0x25')]};});_0x58e5cb=qs['getOptions'](_0x31c038,_0x2918a3);return interaction[_0x78e8('0x26')](_0x78e8('0x27'),_0x2918a3[_0x78e8('0x28')],_0x2918a3[_0x78e8('0x29')],_0x58e5cb,_0x31c038)['then'](respondWithFilteredResult(_0xe270c2,_0x58e5cb))[_0x78e8('0x2a')](handleError(_0xe270c2,null));};exports[_0x78e8('0x2b')]=function(_0x24ad55,_0x36181b){var _0x42bfa6={'raw':![],'where':{'id':_0x24ad55['params']['id']}},_0x438eab={};_0x438eab[_0x78e8('0x2c')]=_['keys'](db[_0x78e8('0x21')][_0x78e8('0x22')]);_0x438eab[_0x78e8('0x28')]=_[_0x78e8('0x2d')](_0x24ad55[_0x78e8('0x28')]);_0x438eab[_0x78e8('0x2e')]=_[_0x78e8('0x2f')](_0x438eab[_0x78e8('0x2c')],_0x438eab[_0x78e8('0x28')]);_0x42bfa6[_0x78e8('0x30')]=_[_0x78e8('0x2f')](_0x438eab['model'],qs['fields'](_0x24ad55[_0x78e8('0x28')][_0x78e8('0x31')]));_0x42bfa6[_0x78e8('0x30')]=_0x42bfa6[_0x78e8('0x30')][_0x78e8('0x32')]?_0x42bfa6[_0x78e8('0x30')]:_0x438eab[_0x78e8('0x2c')];if(_0x24ad55[_0x78e8('0x28')][_0x78e8('0x33')]){_0x42bfa6[_0x78e8('0x34')]=[{'all':!![]}];}_0x42bfa6=_[_0x78e8('0x35')]({},_0x42bfa6,_0x24ad55['options']);return db[_0x78e8('0x21')][_0x78e8('0x36')](_0x42bfa6)[_0x78e8('0x19')](handleEntityNotFound(_0x36181b,null))[_0x78e8('0x19')](respondWithResult(_0x36181b,null))[_0x78e8('0x2a')](handleError(_0x36181b,null));};exports[_0x78e8('0x37')]=function(_0x347926,_0x41880b){return db[_0x78e8('0x21')][_0x78e8('0x37')](_0x347926[_0x78e8('0x38')],{})[_0x78e8('0x19')](respondWithResult(_0x41880b,0xc9))['catch'](handleError(_0x41880b,null));};exports[_0x78e8('0x18')]=function(_0x28c6cb,_0x10bb15){if(_0x28c6cb[_0x78e8('0x38')]['id']){delete _0x28c6cb[_0x78e8('0x38')]['id'];}return db[_0x78e8('0x21')][_0x78e8('0x36')]({'where':{'id':_0x28c6cb[_0x78e8('0x39')]['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x10bb15,null))[_0x78e8('0x19')](saveUpdates(_0x28c6cb[_0x78e8('0x38')],null))[_0x78e8('0x19')](respondWithResult(_0x10bb15,null))['catch'](handleError(_0x10bb15,null));};exports[_0x78e8('0x1a')]=function(_0x241176,_0x4647cd){return db[_0x78e8('0x21')]['find']({'where':{'id':_0x241176['params']['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x4647cd,null))[_0x78e8('0x19')](removeEntity(_0x4647cd,null))[_0x78e8('0x2a')](handleError(_0x4647cd,null));};exports['describe']=function(_0x5e92e9,_0x28152c){return db[_0x78e8('0x21')]['describe']()[_0x78e8('0x19')](respondWithResult(_0x28152c,null))['catch'](handleError(_0x28152c,null));};exports[_0x78e8('0x3a')]=function(_0x1be7f3,_0x30c71c){return db[_0x78e8('0x3b')][_0x78e8('0x36')]({'where':{'id':_0x1be7f3[_0x78e8('0x39')]['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x30c71c,null))[_0x78e8('0x19')](function(_0x44e68b){if(_0x44e68b){return _0x44e68b[_0x78e8('0x3a')](_0x1be7f3[_0x78e8('0x38')][_0x78e8('0x3c')],_['omit'](_0x1be7f3[_0x78e8('0x38')],['ids','id'])||{});}})['then'](respondWithResult(_0x30c71c,null))[_0x78e8('0x2a')](handleError(_0x30c71c,null));};exports[_0x78e8('0x3d')]=function(_0x208e9c,_0x2a1db2){var _0x7c9d79={'raw':![],'where':{}};var _0x222cf0={};var _0x1a091f={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x78e8('0x3e')]({'where':{'id':_0x208e9c[_0x78e8('0x39')]['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x2a1db2,null))[_0x78e8('0x19')](function(_0x2c17c1){if(_0x2c17c1){_0x222cf0[_0x78e8('0x2c')]=_['keys'](db['FaxMessage'][_0x78e8('0x22')]);_0x222cf0['query']=_[_0x78e8('0x2d')](_0x208e9c[_0x78e8('0x28')]);_0x222cf0[_0x78e8('0x2e')]=_['intersection'](_0x222cf0[_0x78e8('0x2c')],_0x222cf0[_0x78e8('0x28')]);_0x7c9d79[_0x78e8('0x30')]=_[_0x78e8('0x2f')](_0x222cf0[_0x78e8('0x2c')],qs['fields'](_0x208e9c[_0x78e8('0x28')][_0x78e8('0x31')]));_0x7c9d79[_0x78e8('0x30')]=_0x7c9d79['attributes'][_0x78e8('0x32')]?_0x7c9d79[_0x78e8('0x30')]:_0x222cf0[_0x78e8('0x2c')];if(!_0x208e9c[_0x78e8('0x28')][_0x78e8('0x3f')](_0x78e8('0x40'))){_0x7c9d79[_0x78e8('0x14')]=qs[_0x78e8('0x14')](_0x208e9c[_0x78e8('0x28')]['limit']);_0x7c9d79[_0x78e8('0x11')]=qs[_0x78e8('0x11')](_0x208e9c[_0x78e8('0x28')]['offset']);}_0x7c9d79[_0x78e8('0x41')]=qs[_0x78e8('0x42')](_0x208e9c[_0x78e8('0x28')][_0x78e8('0x42')]);_0x7c9d79[_0x78e8('0x43')]=qs['filters'](_[_0x78e8('0x44')](_0x208e9c[_0x78e8('0x28')],_0x222cf0[_0x78e8('0x2e')]));_0x7c9d79[_0x78e8('0x43')][_0x78e8('0x45')]=_0x2c17c1['id'];if(_0x208e9c['query']['filter']){_0x7c9d79[_0x78e8('0x43')]=_['merge'](_0x7c9d79['where'],{'$or':_[_0x78e8('0x20')](_0x7c9d79[_0x78e8('0x30')],function(_0x157afd){var _0x33b2b1={};_0x33b2b1[_0x157afd]={'$like':'%'+_0x208e9c[_0x78e8('0x28')][_0x78e8('0x46')]+'%'};return _0x33b2b1;})});}if(_0x208e9c['query'][_0x78e8('0x47')]){var _0x405e4b=_0x208e9c['query']['$gte']['split'](',');var _0x3e3dd6={};_0x3e3dd6[_0x405e4b[0x0]]={'$gte':moment(_0x405e4b[0x1])[_0x78e8('0x48')](_0x78e8('0x49'))};_0x7c9d79['where']=_[_0x78e8('0x35')](_0x7c9d79[_0x78e8('0x43')],_0x3e3dd6);}_0x7c9d79=_[_0x78e8('0x35')]({},_0x7c9d79,_0x208e9c[_0x78e8('0x4a')]);return db[_0x78e8('0x3b')][_0x78e8('0x13')]({'where':_0x7c9d79['where']})[_0x78e8('0x19')](function(_0x657437){_0x1a091f[_0x78e8('0x13')]=_0x657437;if(_0x208e9c[_0x78e8('0x28')]['includeAll']){_0x7c9d79['include']=[{'all':!![]}];}return db[_0x78e8('0x3b')]['findAll'](_0x7c9d79);})['then'](function(_0x17f282){_0x1a091f['rows']=_0x17f282;return _0x1a091f;});}})[_0x78e8('0x19')](respondWithFilteredResult(_0x2a1db2,_0x7c9d79))[_0x78e8('0x2a')](handleError(_0x2a1db2,null));};exports[_0x78e8('0x4b')]=function(_0x4b3fc6,_0x37cd35){return db['FaxInteraction'][_0x78e8('0x36')]({'where':{'id':_0x4b3fc6[_0x78e8('0x39')]['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x37cd35,null))[_0x78e8('0x19')](function(_0x3e5318){if(_0x3e5318){return _0x3e5318[_0x78e8('0x4c')](_0x4b3fc6[_0x78e8('0x38')][_0x78e8('0x3c')],_['omit'](_0x4b3fc6[_0x78e8('0x38')],[_0x78e8('0x3c'),'id'])||{})[_0x78e8('0x4d')](function(){return db[_0x78e8('0x4e')]['findAll']({'attributes':['id','name',_0x78e8('0x4f')],'where':{'id':_0x4b3fc6['body'][_0x78e8('0x3c')]}});})[_0x78e8('0x19')](function(_0x1e8968){socket['emit']('faxInteractionTags:save',{'id':Number(_0x4b3fc6['params']['id']),'tags':_0x1e8968||[]});return{'id':Number(_0x4b3fc6[_0x78e8('0x39')]['id']),'tags':_0x1e8968||[]};});}})[_0x78e8('0x19')](respondWithResult(_0x37cd35,null))[_0x78e8('0x2a')](handleError(_0x37cd35,null));};exports['removeTags']=function(_0x16172b,_0x38ac3b){return db['FaxInteraction'][_0x78e8('0x36')]({'where':{'id':_0x16172b[_0x78e8('0x39')]['id']}})[_0x78e8('0x19')](handleEntityNotFound(_0x38ac3b,null))['then'](function(_0x286452){if(_0x286452){return _0x286452[_0x78e8('0x50')](_0x16172b[_0x78e8('0x28')][_0x78e8('0x3c')]);}})[_0x78e8('0x19')](respondWithStatusCode(_0x38ac3b,null))[_0x78e8('0x2a')](handleError(_0x38ac3b,null));};exports[_0x78e8('0x51')]=function(_0x3ad620,_0x11d5b1){var _0x330319=moment()[_0x78e8('0x52')]()['toString']();var _0x1373ed=path[_0x78e8('0x53')](config['root'],_0x78e8('0x54'),_0x78e8('0x55'),_0x78e8('0x56'));var _0x311a63=path[_0x78e8('0x53')](config[_0x78e8('0x57')],_0x78e8('0x54'),_0x78e8('0x55'),_0x78e8('0x58'));var _0x195663=path[_0x78e8('0x53')](_0x1373ed,_0x330319);var _0x5f834=util[_0x78e8('0x48')](_0x78e8('0x59'),_0x3ad620[_0x78e8('0x39')]['id'],_0x330319);var _0x148c84=path[_0x78e8('0x53')](_0x1373ed,_0x5f834);var _0xd6bd0=[];_0xd6bd0[_0x78e8('0x5a')]({'model':db[_0x78e8('0x5b')],'as':_0x78e8('0x5b'),'raw':!![]});var _0x3e3436=[{'model':db[_0x78e8('0x3b')],'as':_0x78e8('0x5c'),'attributes':['id',_0x78e8('0x38'),_0x78e8('0x5d')],'include':_0xd6bd0}];return db[_0x78e8('0x21')][_0x78e8('0x36')]({'where':{'id':_0x3ad620['params']['id']},'include':_0x3e3436})[_0x78e8('0x19')](handleEntityNotFound(_0x11d5b1,null))[_0x78e8('0x19')](function(_0x9c258c){if(_0x9c258c&&_0x9c258c['Messages']){var _0xff5016=_0x9c258c[_0x78e8('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x195663);for(var _0x197e2e=0x0;_0x197e2e<_0xff5016[_0x78e8('0x5c')][_0x78e8('0x32')];_0x197e2e++){var _0x1b9f9a=_0xff5016[_0x78e8('0x5c')][_0x197e2e][_0x78e8('0x5b')];if(_0x1b9f9a){var _0x48fcc4=path[_0x78e8('0x53')](_0x311a63,_0x1b9f9a[_0x78e8('0x5f')]);if(fs[_0x78e8('0x60')](_0x48fcc4)){fs[_0x78e8('0x61')](_0x48fcc4)[_0x78e8('0x62')](fs[_0x78e8('0x63')](path[_0x78e8('0x53')](_0x195663,_0x1b9f9a[_0x78e8('0x5f')])));}}}return BPromise[_0x78e8('0x64')]()[_0x78e8('0x19')](function(){return new BPromise(function(_0x2741c0,_0x12698c){zipdir(_0x195663,{'saveTo':_0x148c84},function(_0x3a617d,_0x579cca){if(_0x3a617d)return _0x12698c(_0x3a617d);return _0x2741c0(_0x579cca);});})['then'](function(){return new BPromise(function(_0x5b8e0a,_0x3f8f0c){rimraf(_0x195663,function(_0x593593){if(_0x593593)_0x3f8f0c(_0x593593);return _0x5b8e0a();});});})[_0x78e8('0x19')](function(){return _0x11d5b1[_0x78e8('0x51')](_0x148c84,_0x5f834,function(_0x528b4b){if(_0x528b4b){console[_0x78e8('0x65')](_0x78e8('0x66'),_0x528b4b);}else{fs[_0x78e8('0x67')](_0x148c84);}});});});}else{return _0x11d5b1['sendStatus'](0xc8);}})['catch'](handleError(_0x11d5b1,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 21eae10..fda6604 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 _0xddc4=['hook','exports','../../mysqldb','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x61e9ec,_0x80b3a7){var _0x5849d2=function(_0x2684b6){while(--_0x2684b6){_0x61e9ec['push'](_0x61e9ec['shift']());}};_0x5849d2(++_0x80b3a7);}(_0xddc4,0xe2));var _0x4ddc=function(_0x4802f5,_0x435971){_0x4802f5=_0x4802f5-0x0;var _0x2c99ba=_0xddc4[_0x4802f5];return _0x2c99ba;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x4ddc('0x0'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ddc('0x1'),'afterDestroy':'remove'};function emitEvent(_0x110637){return function(_0x18609a,_0x5ecbb1,_0x3c61f4){_0x18609a[_0x4ddc('0x2')]({'attributes':['id'],'raw':!![]})[_0x4ddc('0x3')](function(_0x33c046){_0x18609a[_0x4ddc('0x4')](_0x4ddc('0x5'),_0x33c046[_0x4ddc('0x6')](function(_0x2e59bb){return{'id':_0x2e59bb['id']};}));return FaxMessage[_0x4ddc('0x7')]({'where':{'FaxInteractionId':_0x18609a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4ddc('0x3')](function(_0x17e40e){_0x18609a['setDataValue'](_0x4ddc('0x8'),_0x17e40e['length']);FaxInteractionEvents[_0x4ddc('0x9')](_0x110637+':'+_0x18609a['id'],_0x18609a);FaxInteractionEvents[_0x4ddc('0x9')](_0x110637,_0x18609a);_0x3c61f4(null);})[_0x4ddc('0xa')](_0x3c61f4(null));};}for(var e in events){if(events[_0x4ddc('0xb')](e)){var event=events[e];FaxInteraction[_0x4ddc('0xc')](e,emitEvent(event));}}module[_0x4ddc('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x81e1=['Users','map','then','length','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue'];(function(_0x5c7d4b,_0x305110){var _0x422e90=function(_0x23153f){while(--_0x23153f){_0x5c7d4b['push'](_0x5c7d4b['shift']());}};_0x422e90(++_0x305110);}(_0x81e1,0xa6));var _0x181e=function(_0x2ec209,_0x347d93){_0x2ec209=_0x2ec209-0x0;var _0xfec69a=_0x81e1[_0x2ec209];return _0xfec69a;};'use strict';var EventEmitter=require(_0x181e('0x0'));var FaxInteraction=require(_0x181e('0x1'))['db'][_0x181e('0x2')];var FaxMessage=require(_0x181e('0x1'))['db'][_0x181e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x181e('0x4')](0x0);var events={'afterCreate':_0x181e('0x5'),'afterUpdate':_0x181e('0x6'),'afterDestroy':_0x181e('0x7')};function emitEvent(_0x383f40){return function(_0x517c47,_0x4bb703,_0x16711c){_0x517c47[_0x181e('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ba87a){_0x517c47[_0x181e('0x9')](_0x181e('0xa'),_0x3ba87a[_0x181e('0xb')](function(_0x4e47c7){return{'id':_0x4e47c7['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x517c47['id'],'direction':'in','read':![]},'raw':!![]});})[_0x181e('0xc')](function(_0x3c810d){_0x517c47[_0x181e('0x9')]('unreadMessages',_0x3c810d[_0x181e('0xd')]);FaxInteractionEvents['emit'](_0x383f40+':'+_0x517c47['id'],_0x517c47);FaxInteractionEvents['emit'](_0x383f40,_0x517c47);_0x16711c(null);})['catch'](_0x16711c(null));};}for(var e in events){if(events[_0x181e('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x181e('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7730325..980e1fc 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 _0xdfc5=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird'];(function(_0x4dc212,_0x14a01d){var _0x34d4bb=function(_0x5181e4){while(--_0x5181e4){_0x4dc212['push'](_0x4dc212['shift']());}};_0x34d4bb(++_0x14a01d);}(_0xdfc5,0x13d));var _0x5dfc=function(_0xf169c5,_0x1ef3d3){_0xf169c5=_0xf169c5-0x0;var _0x17bc66=_0xdfc5[_0xf169c5];return _0x17bc66;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5dfc('0x0'));var moment=require(_0x5dfc('0x1'));var BPromise=require(_0x5dfc('0x2'));var rp=require(_0x5dfc('0x3'));var fs=require('fs');var path=require(_0x5dfc('0x4'));var rimraf=require(_0x5dfc('0x5'));var config=require(_0x5dfc('0x6'));var attributes=require(_0x5dfc('0x7'));module[_0x5dfc('0x8')]=function(_0x3b8246,_0x9011b5){return _0x3b8246[_0x5dfc('0x9')](_0x5dfc('0xa'),attributes,{'tableName':_0x5dfc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x576ebf,_0x45e89a,_0x117540){if(_0x576ebf[_0x5dfc('0xc')](_0x5dfc('0xd'))){_0x576ebf['closedAt']=moment()[_0x5dfc('0xe')](_0x5dfc('0xf'));}_0x117540(null,_0x576ebf);}}});}; \ No newline at end of file +var _0x9a44=['closedAt','format','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','changed'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9a44,0xc2));var _0x49a4=function(_0x1ca6dc,_0x924886){_0x1ca6dc=_0x1ca6dc-0x0;var _0x20aabd=_0x9a44[_0x1ca6dc];return _0x20aabd;};'use strict';var _=require(_0x49a4('0x0'));var util=require(_0x49a4('0x1'));var logger=require(_0x49a4('0x2'))(_0x49a4('0x3'));var moment=require('moment');var BPromise=require(_0x49a4('0x4'));var rp=require(_0x49a4('0x5'));var fs=require('fs');var path=require(_0x49a4('0x6'));var rimraf=require('rimraf');var config=require(_0x49a4('0x7'));var attributes=require(_0x49a4('0x8'));module['exports']=function(_0x27e545,_0x168e47){return _0x27e545['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x857713,_0x316238,_0x181d4d){if(_0x857713[_0x49a4('0x9')]('closed')){_0x857713[_0x49a4('0xa')]=moment()[_0x49a4('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x181d4d(null,_0x857713);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e8ecec6..dd2d8cf 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 _0x68ee=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','then','catch','AddTagsToFaxInteraction','find','addTags','ids'];(function(_0xdc7a97,_0x1a098e){var _0x9a3b9a=function(_0x370c48){while(--_0x370c48){_0xdc7a97['push'](_0xdc7a97['shift']());}};_0x9a3b9a(++_0x1a098e);}(_0x68ee,0x7f));var _0xe68e=function(_0x3e4138,_0x140f9b){_0x3e4138=_0x3e4138-0x0;var _0x3c93cf=_0x68ee[_0x3e4138];return _0x3c93cf;};'use strict';var _=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var moment=require(_0xe68e('0x2'));var BPromise=require(_0xe68e('0x3'));var rs=require(_0xe68e('0x4'));var fs=require('fs');var Redis=require(_0xe68e('0x5'));var db=require(_0xe68e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe68e('0x7'))(_0xe68e('0x8'));var config=require(_0xe68e('0x9'));var jayson=require(_0xe68e('0xa'));var client=jayson[_0xe68e('0xb')]['http']({'port':0x232a});config[_0xe68e('0xc')]=_[_0xe68e('0xd')](config[_0xe68e('0xc')],{'host':_0xe68e('0xe'),'port':0x18eb});var socket=require(_0xe68e('0xf'))(new Redis(config[_0xe68e('0xc')]));require(_0xe68e('0x10'))[_0xe68e('0x11')](socket);function respondWithRpcPromise(_0x10ed05,_0x238998,_0x1eaf18){return new BPromise(function(_0x17c1f9,_0x133214){return client[_0xe68e('0x12')](_0x10ed05,_0x1eaf18)['then'](function(_0x7b1aad){logger[_0xe68e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x238998,_0xe68e('0x14'));logger[_0xe68e('0x15')](_0xe68e('0x16'),_0x238998,_0xe68e('0x14'),JSON[_0xe68e('0x17')](_0x7b1aad));if(_0x7b1aad[_0xe68e('0x18')]){if(_0x7b1aad[_0xe68e('0x18')][_0xe68e('0x19')]===0x1f4){logger[_0xe68e('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x238998,_0x7b1aad[_0xe68e('0x18')]['message']);return _0x133214(_0x7b1aad['error']['message']);}logger[_0xe68e('0x18')](_0xe68e('0x1a'),_0x238998,_0x7b1aad['error'][_0xe68e('0x1b')]);return _0x17c1f9(_0x7b1aad[_0xe68e('0x18')]['message']);}else{logger[_0xe68e('0x13')](_0xe68e('0x1a'),_0x238998,_0xe68e('0x14'));_0x17c1f9(_0x7b1aad['result'][_0xe68e('0x1b')]);}})['catch'](function(_0x964288){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x238998,_0x964288);_0x133214(_0x964288);});});}exports[_0xe68e('0x1c')]=function(_0x51b4a6){var _0xf36977=this;return new Promise(function(_0x3a1051,_0x55e773){return db[_0xe68e('0x1d')][_0xe68e('0x1e')](_0x51b4a6[_0xe68e('0x1f')],{'raw':_0x51b4a6['options']?_0x51b4a6[_0xe68e('0x20')][_0xe68e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')][_0xe68e('0x22')]||null:null,'attributes':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')]['attributes']||null:null,'limit':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')]['limit']||null:null})[_0xe68e('0x23')](function(_0x1d4f1f){logger['info']('UpdateFaxInteraction',_0x51b4a6);logger[_0xe68e('0x15')](_0xe68e('0x1c'),_0x51b4a6,JSON[_0xe68e('0x17')](_0x1d4f1f));_0x3a1051(_0x1d4f1f);})[_0xe68e('0x24')](function(_0x280174){logger[_0xe68e('0x18')]('UpdateFaxInteraction',_0x280174['message'],_0x51b4a6);_0x55e773(_0xf36977[_0xe68e('0x18')](0x1f4,_0x280174[_0xe68e('0x1b')]));});});};exports[_0xe68e('0x25')]=function(_0x469489){return new Promise(function(_0x279182,_0xf04e80){return db[_0xe68e('0x1d')][_0xe68e('0x26')]({'where':_0x469489['options']?_0x469489['options'][_0xe68e('0x22')]||null:null})['then'](function(_0x295d4d){if(_0x295d4d){return _0x295d4d[_0xe68e('0x27')](_0x469489[_0xe68e('0x1f')][_0xe68e('0x28')],_['omit'](_0x469489[_0xe68e('0x1f')],[_0xe68e('0x28'),'id'])||{});}})['spread'](function(_0x146dfd){logger['info'](_0xe68e('0x29'),_0x469489);logger[_0xe68e('0x15')](_0xe68e('0x29'),_0x469489,JSON[_0xe68e('0x17')](_0x146dfd));_0x279182(_0x146dfd);})['catch'](function(_0x35b961){logger[_0xe68e('0x18')](_0xe68e('0x29'),_0x35b961[_0xe68e('0x1b')],_0x469489);_0xf04e80(_this[_0xe68e('0x18')](0x1f4,_0x35b961[_0xe68e('0x1b')]));});});}; \ No newline at end of file +var _0xe04a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','moment','randomstring'];(function(_0x12547d,_0x54171d){var _0x17406c=function(_0x331248){while(--_0x331248){_0x12547d['push'](_0x12547d['shift']());}};_0x17406c(++_0x54171d);}(_0xe04a,0x10e));var _0xae04=function(_0x25c639,_0x318d75){_0x25c639=_0x25c639-0x0;var _0x33254a=_0xe04a[_0x25c639];return _0x33254a;};'use strict';var _=require('lodash');var util=require(_0xae04('0x0'));var moment=require(_0xae04('0x1'));var BPromise=require('bluebird');var rs=require(_0xae04('0x2'));var fs=require('fs');var Redis=require(_0xae04('0x3'));var db=require(_0xae04('0x4'))['db'];var utils=require(_0xae04('0x5'));var logger=require(_0xae04('0x6'))('rpc');var config=require(_0xae04('0x7'));var jayson=require(_0xae04('0x8'));var client=jayson[_0xae04('0x9')]['http']({'port':0x232a});config['redis']=_[_0xae04('0xa')](config['redis'],{'host':_0xae04('0xb'),'port':0x18eb});var socket=require(_0xae04('0xc'))(new Redis(config['redis']));require(_0xae04('0xd'))['register'](socket);function respondWithRpcPromise(_0x453155,_0x317286,_0x4ef0d3){return new BPromise(function(_0x3ae9e3,_0x4c6002){return client[_0xae04('0xe')](_0x453155,_0x4ef0d3)[_0xae04('0xf')](function(_0x2dbdac){logger['info'](_0xae04('0x10'),_0x317286,'request\x20sent');logger[_0xae04('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x317286,'request\x20sent',JSON[_0xae04('0x12')](_0x2dbdac));if(_0x2dbdac[_0xae04('0x13')]){if(_0x2dbdac['error'][_0xae04('0x14')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x317286,_0x2dbdac[_0xae04('0x13')][_0xae04('0x15')]);return _0x4c6002(_0x2dbdac[_0xae04('0x13')][_0xae04('0x15')]);}logger[_0xae04('0x13')](_0xae04('0x10'),_0x317286,_0x2dbdac[_0xae04('0x13')]['message']);return _0x3ae9e3(_0x2dbdac['error']['message']);}else{logger[_0xae04('0x16')](_0xae04('0x10'),_0x317286,_0xae04('0x17'));_0x3ae9e3(_0x2dbdac['result']['message']);}})[_0xae04('0x18')](function(_0x406fa0){logger['error'](_0xae04('0x10'),_0x317286,_0x406fa0);_0x4c6002(_0x406fa0);});});}exports['UpdateFaxInteraction']=function(_0x12955c){var _0x2ec4b0=this;return new Promise(function(_0x23a369,_0x27c4d9){return db[_0xae04('0x19')][_0xae04('0x1a')](_0x12955c[_0xae04('0x1b')],{'raw':_0x12955c[_0xae04('0x1c')]?_0x12955c[_0xae04('0x1c')][_0xae04('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12955c[_0xae04('0x1c')]?_0x12955c['options']['where']||null:null,'attributes':_0x12955c[_0xae04('0x1c')]?_0x12955c[_0xae04('0x1c')][_0xae04('0x1e')]||null:null,'limit':_0x12955c[_0xae04('0x1c')]?_0x12955c[_0xae04('0x1c')][_0xae04('0x1f')]||null:null})['then'](function(_0x40d1ca){logger[_0xae04('0x16')](_0xae04('0x20'),_0x12955c);logger[_0xae04('0x11')](_0xae04('0x20'),_0x12955c,JSON['stringify'](_0x40d1ca));_0x23a369(_0x40d1ca);})[_0xae04('0x18')](function(_0x4eb276){logger[_0xae04('0x13')](_0xae04('0x20'),_0x4eb276[_0xae04('0x15')],_0x12955c);_0x27c4d9(_0x2ec4b0[_0xae04('0x13')](0x1f4,_0x4eb276['message']));});});};exports[_0xae04('0x21')]=function(_0x24c51a){return new Promise(function(_0xdd3b0a,_0x2d57aa){return db['FaxInteraction'][_0xae04('0x22')]({'where':_0x24c51a[_0xae04('0x1c')]?_0x24c51a['options']['where']||null:null})[_0xae04('0xf')](function(_0x52ceca){if(_0x52ceca){return _0x52ceca[_0xae04('0x23')](_0x24c51a[_0xae04('0x1b')][_0xae04('0x24')],_['omit'](_0x24c51a['body'],[_0xae04('0x24'),'id'])||{});}})[_0xae04('0x25')](function(_0x1b49f1){logger[_0xae04('0x16')]('AddTags',_0x24c51a);logger['debug']('AddTags',_0x24c51a,JSON['stringify'](_0x1b49f1));_0xdd3b0a(_0x1b49f1);})[_0xae04('0x18')](function(_0x544780){logger['error'](_0xae04('0x26'),_0x544780[_0xae04('0x15')],_0x24c51a);_0x2d57aa(_this[_0xae04('0x13')](0x1f4,_0x544780[_0xae04('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 92ef2cd..b1d8680 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 _0x2a48=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x40dc85,_0x14e2b5){var _0x5e9047=function(_0x3381ae){while(--_0x3381ae){_0x40dc85['push'](_0x40dc85['shift']());}};_0x5e9047(++_0x14e2b5);}(_0x2a48,0x1ec));var _0x82a4=function(_0x8e1179,_0x3c45e9){_0x8e1179=_0x8e1179-0x0;var _0x3fb2bc=_0x2a48[_0x8e1179];return _0x3fb2bc;};'use strict';var FaxInteractionEvents=require(_0x82a4('0x0'));var events=[_0x82a4('0x1'),_0x82a4('0x2'),_0x82a4('0x3')];function createListener(_0x14d0e6,_0x22be7f){return function(_0x15a550){_0x22be7f['emit'](_0x14d0e6,_0x15a550);};}function removeListener(_0xf56ba7,_0x18ed9a){return function(){FaxInteractionEvents[_0x82a4('0x4')](_0xf56ba7,_0x18ed9a);};}exports[_0x82a4('0x5')]=function(_0x56ba6f){for(var _0x52d356=0x0,_0x5ad3b5=events[_0x82a4('0x6')];_0x52d356<_0x5ad3b5;_0x52d356++){var _0xdb3035=events[_0x52d356];var _0x381c93=createListener(_0x82a4('0x7')+_0xdb3035,_0x56ba6f);FaxInteractionEvents['on'](_0xdb3035,_0x381c93);}}; \ No newline at end of file +var _0xf034=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x1a5ce2,_0x3b751a){var _0x731ca6=function(_0x402247){while(--_0x402247){_0x1a5ce2['push'](_0x1a5ce2['shift']());}};_0x731ca6(++_0x3b751a);}(_0xf034,0x104));var _0x4f03=function(_0x2b49c7,_0xccca2a){_0x2b49c7=_0x2b49c7-0x0;var _0x2ecef8=_0xf034[_0x2b49c7];return _0x2ecef8;};'use strict';var FaxInteractionEvents=require(_0x4f03('0x0'));var events=[_0x4f03('0x1'),_0x4f03('0x2'),'update'];function createListener(_0x5e6c8f,_0x2bcdb9){return function(_0x37f63c){_0x2bcdb9[_0x4f03('0x3')](_0x5e6c8f,_0x37f63c);};}function removeListener(_0x32ac50,_0x18d023){return function(){FaxInteractionEvents[_0x4f03('0x4')](_0x32ac50,_0x18d023);};}exports[_0x4f03('0x5')]=function(_0x1ce7b7){for(var _0x5cf65b=0x0,_0x1b64bb=events[_0x4f03('0x6')];_0x5cf65b<_0x1b64bb;_0x5cf65b++){var _0x36c831=events[_0x5cf65b];var _0x27467d=createListener(_0x4f03('0x7')+_0x36c831,_0x1ce7b7);FaxInteractionEvents['on'](_0x36c831,_0x27467d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 077f7b4..a7e86e6 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 _0x25c6=['/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','exports','multer','util','path','express','Router','../../config/environment','./faxInteraction.controller','get','index','/describe','/:id'];(function(_0x248795,_0x43099b){var _0x2e9e7f=function(_0x4cf1f3){while(--_0x4cf1f3){_0x248795['push'](_0x248795['shift']());}};_0x2e9e7f(++_0x43099b);}(_0x25c6,0x15d));var _0x625c=function(_0x2b1b8d,_0x24ed2f){_0x2b1b8d=_0x2b1b8d-0x0;var _0x51f032=_0x25c6[_0x2b1b8d];return _0x51f032;};'use strict';var multer=require(_0x625c('0x0'));var util=require(_0x625c('0x1'));var path=require(_0x625c('0x2'));var timeout=require('connect-timeout');var express=require(_0x625c('0x3'));var router=express[_0x625c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x625c('0x5'));var controller=require(_0x625c('0x6'));router[_0x625c('0x7')]('/',auth['isAuthenticated'](),controller[_0x625c('0x8')]);router[_0x625c('0x7')](_0x625c('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x625c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x625c('0x7')](_0x625c('0xb'),auth[_0x625c('0xc')](),controller[_0x625c('0xd')]);router[_0x625c('0x7')](_0x625c('0xe'),auth[_0x625c('0xc')](),controller[_0x625c('0xf')]);router[_0x625c('0x10')]('/',auth[_0x625c('0xc')](),controller[_0x625c('0x11')]);router['post']('/:id/messages',auth[_0x625c('0xc')](),controller[_0x625c('0x12')]);router['post'](_0x625c('0x13'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')]('fax',_0x625c('0x15')),controller[_0x625c('0x16')]);router[_0x625c('0x17')](_0x625c('0xa'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')](_0x625c('0x18'),_0x625c('0x19')),controller[_0x625c('0x1a')]);router[_0x625c('0x1b')](_0x625c('0xa'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')](_0x625c('0x18'),_0x625c('0x1c')),controller['destroy']);router['delete'](_0x625c('0x13'),auth[_0x625c('0xc')](),controller['removeTags']);module[_0x625c('0x1d')]=router; \ No newline at end of file +var _0x6dc0=['put','faxinteraction:update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','download','post','addMessage','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x1313c5,_0x20808d){var _0x2442e1=function(_0x375e60){while(--_0x375e60){_0x1313c5['push'](_0x1313c5['shift']());}};_0x2442e1(++_0x20808d);}(_0x6dc0,0x18c));var _0x06dc=function(_0x24f4e9,_0x630d52){_0x24f4e9=_0x24f4e9-0x0;var _0xe613a9=_0x6dc0[_0x24f4e9];return _0xe613a9;};'use strict';var multer=require(_0x06dc('0x0'));var util=require('util');var path=require(_0x06dc('0x1'));var timeout=require(_0x06dc('0x2'));var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var fs_extra=require(_0x06dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06dc('0x6'));var controller=require(_0x06dc('0x7'));router['get']('/',auth[_0x06dc('0x8')](),controller[_0x06dc('0x9')]);router['get'](_0x06dc('0xa'),auth['isAuthenticated'](),controller[_0x06dc('0xb')]);router[_0x06dc('0xc')](_0x06dc('0xd'),auth[_0x06dc('0x8')](),controller[_0x06dc('0xe')]);router['get'](_0x06dc('0xf'),auth['isAuthenticated'](),controller[_0x06dc('0x10')]);router[_0x06dc('0xc')]('/:id/download',auth[_0x06dc('0x8')](),controller[_0x06dc('0x11')]);router[_0x06dc('0x12')]('/',auth[_0x06dc('0x8')](),controller['create']);router[_0x06dc('0x12')](_0x06dc('0xf'),auth[_0x06dc('0x8')](),controller[_0x06dc('0x13')]);router[_0x06dc('0x12')]('/:id/tags',auth[_0x06dc('0x8')](),interaction[_0x06dc('0x14')](_0x06dc('0x15'),_0x06dc('0x16')),controller[_0x06dc('0x17')]);router[_0x06dc('0x18')](_0x06dc('0xd'),auth['isAuthenticated'](),interaction[_0x06dc('0x14')](_0x06dc('0x15'),_0x06dc('0x19')),controller['update']);router[_0x06dc('0x1a')](_0x06dc('0xd'),auth[_0x06dc('0x8')](),interaction[_0x06dc('0x14')](_0x06dc('0x15'),_0x06dc('0x1b')),controller[_0x06dc('0x1c')]);router[_0x06dc('0x1a')]('/:id/tags',auth[_0x06dc('0x8')](),controller['removeTags']);module[_0x06dc('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 22fa6fe..3d686ab 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 _0x50a6=['exports','BOOLEAN','out','TEXT','sequelize'];(function(_0x24d658,_0x196939){var _0x4b34dc=function(_0x5e396a){while(--_0x5e396a){_0x24d658['push'](_0x24d658['shift']());}};_0x4b34dc(++_0x196939);}(_0x50a6,0xa4));var _0x650a=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x50a6[_0x25a45a];return _0x237f87;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x650a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x650a('0x3')),'defaultValue':_0x650a('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x650a('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb332=['DATE','sequelize','TEXT','medium','ENUM','out'];(function(_0x578a2e,_0x5180de){var _0x39ee09=function(_0x22f196){while(--_0x22f196){_0x578a2e['push'](_0x578a2e['shift']());}};_0x39ee09(++_0x5180de);}(_0xb332,0xd9));var _0x2b33=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0xb332[_0x56608c];return _0x3c7fb0;};'use strict';var Sequelize=require(_0x2b33('0x0'));module['exports']={'body':{'type':Sequelize[_0x2b33('0x1')](_0x2b33('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2b33('0x3')]('in','out'),'defaultValue':_0x2b33('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x2b33('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0cbddaf..9e18287 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 _0xd68f=['redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','body','fax-interactions','accept','fax','read','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','email','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4c4d6d,_0x10ac62){var _0x4eacef=function(_0x589133){while(--_0x589133){_0x4c4d6d['push'](_0x4c4d6d['shift']());}};_0x4eacef(++_0x10ac62);}(_0xd68f,0x7d));var _0xfd68=function(_0x47c03f,_0x2928c3){_0x47c03f=_0x47c03f-0x0;var _0x6a92b6=_0xd68f[_0x47c03f];return _0x6a92b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd68('0x0'));var zipdir=require(_0xfd68('0x1'));var jsonpatch=require(_0xfd68('0x2'));var rp=require(_0xfd68('0x3'));var moment=require(_0xfd68('0x4'));var BPromise=require(_0xfd68('0x5'));var Mustache=require(_0xfd68('0x6'));var util=require('util');var path=require(_0xfd68('0x7'));var sox=require(_0xfd68('0x8'));var csv=require(_0xfd68('0x9'));var ejs=require(_0xfd68('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfd68('0xb'));var crypto=require(_0xfd68('0xc'));var jsforce=require(_0xfd68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfd68('0x9'));var querystring=require(_0xfd68('0xe'));var Papa=require(_0xfd68('0xf'));var Redis=require(_0xfd68('0x10'));var authService=require(_0xfd68('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd68('0x12'));var hardwareService=require(_0xfd68('0x13'));var logger=require(_0xfd68('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfd68('0x15')]=_[_0xfd68('0x16')](config[_0xfd68('0x15')],{'host':_0xfd68('0x17'),'port':0x18eb});var socket=require(_0xfd68('0x18'))(new Redis(config['redis']));require(_0xfd68('0x19'))[_0xfd68('0x1a')](socket);var jayson=require(_0xfd68('0x1b'));var client=jayson[_0xfd68('0x1c')][_0xfd68('0x1d')]({'port':0x232c});var client9002=jayson[_0xfd68('0x1c')][_0xfd68('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5e822a,_0x1903d8,_0x289cfe,_0x39a48d){return new BPromise(function(_0x30c05f,_0x1d486f){var _0x3a7c88=_0x39a48d||client;return _0x3a7c88[_0xfd68('0x1e')](_0x5e822a,_0x289cfe)[_0xfd68('0x1f')](function(_0x5b3f4d){logger[_0xfd68('0x20')](_0xfd68('0x21'),_0x1903d8,_0xfd68('0x22'));logger[_0xfd68('0x23')](_0xfd68('0x24'),_0x1903d8,_0xfd68('0x22'),JSON[_0xfd68('0x25')](_0x5b3f4d));if(_0x5b3f4d[_0xfd68('0x26')]){if(_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x27')]===0x1f4){logger[_0xfd68('0x26')](_0xfd68('0x21'),_0x1903d8,_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x28')]);return _0x1d486f(_0x5b3f4d['error'][_0xfd68('0x28')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x1903d8,_0x5b3f4d['error']['message']);return _0x30c05f(_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x28')]);}else{logger[_0xfd68('0x20')](_0xfd68('0x21'),_0x1903d8,'request\x20sent');_0x30c05f(_0x5b3f4d[_0xfd68('0x29')][_0xfd68('0x28')]);}})['catch'](function(_0x305eb2){logger[_0xfd68('0x26')](_0xfd68('0x21'),_0x1903d8,_0x305eb2);_0x1d486f(_0x305eb2);});});}function respondWithStatusCode(_0x2c44a0,_0x156bf8){_0x156bf8=_0x156bf8||0xcc;return function(_0x5dcdf0){if(_0x5dcdf0){return _0x2c44a0[_0xfd68('0x2a')](_0x156bf8);}return _0x2c44a0[_0xfd68('0x2b')](_0x156bf8)[_0xfd68('0x2c')]();};}function respondWithResult(_0x1fae13,_0x390c55){_0x390c55=_0x390c55||0xc8;return function(_0x4d1732){if(_0x4d1732){return _0x1fae13[_0xfd68('0x2b')](_0x390c55)['json'](_0x4d1732);}};}function respondWithFilteredResult(_0x43e9ba,_0x81f0b9){return function(_0x1227c8){if(_0x1227c8){var _0x29192d=typeof _0x81f0b9[_0xfd68('0x2d')]===_0xfd68('0x2e')&&typeof _0x81f0b9[_0xfd68('0x2f')]===_0xfd68('0x2e');var _0x207b7f=_0x1227c8[_0xfd68('0x30')];var _0x3ca4c0=_0x29192d?0x0:_0x81f0b9['offset'];var _0x4d0834=_0x29192d?_0x1227c8[_0xfd68('0x30')]:_0x81f0b9[_0xfd68('0x2d')]+_0x81f0b9['limit'];var _0x437418;if(_0x4d0834>=_0x207b7f){_0x4d0834=_0x207b7f;_0x437418=0xc8;}else{_0x437418=0xce;}_0x43e9ba[_0xfd68('0x2b')](_0x437418);return _0x43e9ba[_0xfd68('0x31')](_0xfd68('0x32'),_0x3ca4c0+'-'+_0x4d0834+'/'+_0x207b7f)[_0xfd68('0x33')](_0x1227c8);}return null;};}function patchUpdates(_0x223fef){return function(_0x180a6b){try{jsonpatch[_0xfd68('0x34')](_0x180a6b,_0x223fef,!![]);}catch(_0x8e045e){return BPromise[_0xfd68('0x35')](_0x8e045e);}return _0x180a6b[_0xfd68('0x36')]();};}function saveUpdates(_0x4c7e48,_0x1daafe){return function(_0x34faa7){if(_0x34faa7){return _0x34faa7[_0xfd68('0x37')](_0x4c7e48)[_0xfd68('0x1f')](function(_0x43dc25){return _0x43dc25;});}return null;};}function removeEntity(_0x4fcba6,_0x41f3c6){return function(_0x4a6f50){if(_0x4a6f50){return _0x4a6f50[_0xfd68('0x38')]()['then'](function(){_0x4fcba6[_0xfd68('0x2b')](0xcc)[_0xfd68('0x2c')]();});}};}function handleEntityNotFound(_0x1c465d,_0x4a96f6){return function(_0x51e60a){if(!_0x51e60a){_0x1c465d[_0xfd68('0x2a')](0x194);}return _0x51e60a;};}function handleError(_0x5a59fa,_0x765651){_0x765651=_0x765651||0x1f4;return function(_0x59663d){logger[_0xfd68('0x26')](_0x59663d[_0xfd68('0x39')]);if(_0x59663d[_0xfd68('0x3a')]){delete _0x59663d['name'];}_0x5a59fa[_0xfd68('0x2b')](_0x765651)[_0xfd68('0x3b')](_0x59663d);};}exports[_0xfd68('0x3c')]=function(_0x3b1d42,_0x2c5d66){var _0x1db121={},_0x5c0300={},_0x36c893={'count':0x0,'rows':[]};var _0x25e8ea=_['map'](db[_0xfd68('0x3d')]['rawAttributes'],function(_0x103de0){return{'name':_0x103de0[_0xfd68('0x3e')],'type':_0x103de0[_0xfd68('0x3f')]['key']};});_0x5c0300['model']=_[_0xfd68('0x40')](_0x25e8ea,_0xfd68('0x3a'));_0x5c0300['query']=_[_0xfd68('0x41')](_0x3b1d42[_0xfd68('0x42')]);_0x5c0300[_0xfd68('0x43')]=_[_0xfd68('0x44')](_0x5c0300[_0xfd68('0x45')],_0x5c0300[_0xfd68('0x42')]);_0x1db121['attributes']=_[_0xfd68('0x44')](_0x5c0300[_0xfd68('0x45')],qs[_0xfd68('0x46')](_0x3b1d42[_0xfd68('0x42')]['fields']));_0x1db121[_0xfd68('0x47')]=_0x1db121[_0xfd68('0x47')]['length']?_0x1db121['attributes']:_0x5c0300[_0xfd68('0x45')];if(!_0x3b1d42[_0xfd68('0x42')]['hasOwnProperty'](_0xfd68('0x48'))){_0x1db121[_0xfd68('0x2f')]=qs[_0xfd68('0x2f')](_0x3b1d42['query'][_0xfd68('0x2f')]);_0x1db121['offset']=qs[_0xfd68('0x2d')](_0x3b1d42['query'][_0xfd68('0x2d')]);}_0x1db121['order']=qs[_0xfd68('0x49')](_0x3b1d42[_0xfd68('0x42')][_0xfd68('0x49')]);_0x1db121[_0xfd68('0x4a')]=qs['filters'](_[_0xfd68('0x4b')](_0x3b1d42['query'],_0x5c0300[_0xfd68('0x43')]),_0x25e8ea);if(_0x3b1d42['query']['filter']){_0x1db121['where']=_[_0xfd68('0x4c')](_0x1db121[_0xfd68('0x4a')],{'$or':_['map'](_0x25e8ea,function(_0x1301d3){if(_0x1301d3[_0xfd68('0x3f')]!==_0xfd68('0x4d')){var _0x341699={};_0x341699[_0x1301d3[_0xfd68('0x3a')]]={'$like':'%'+_0x3b1d42['query'][_0xfd68('0x4e')]+'%'};return _0x341699;}})});}_0x1db121=_[_0xfd68('0x4c')]({},_0x1db121,_0x3b1d42[_0xfd68('0x4f')]);var _0x1d8d8d={'where':_0x1db121[_0xfd68('0x4a')]};return db[_0xfd68('0x3d')][_0xfd68('0x30')](_0x1d8d8d)[_0xfd68('0x1f')](function(_0x2198cf){_0x36c893['count']=_0x2198cf;if(_0x3b1d42['query'][_0xfd68('0x50')]){_0x1db121['include']=[{'all':!![]}];}return db[_0xfd68('0x3d')][_0xfd68('0x51')](_0x1db121);})[_0xfd68('0x1f')](function(_0x4a6a2f){_0x36c893[_0xfd68('0x52')]=_0x4a6a2f;return _0x36c893;})['then'](respondWithFilteredResult(_0x2c5d66,_0x1db121))['catch'](handleError(_0x2c5d66,null));};exports[_0xfd68('0x53')]=function(_0x22b314,_0x5d4d3b){var _0x1b7cb3={'raw':!![],'where':{'id':_0x22b314[_0xfd68('0x54')]['id']}},_0x303bb9={};_0x303bb9['model']=_[_0xfd68('0x41')](db[_0xfd68('0x3d')][_0xfd68('0x55')]);_0x303bb9['query']=_[_0xfd68('0x41')](_0x22b314[_0xfd68('0x42')]);_0x303bb9[_0xfd68('0x43')]=_[_0xfd68('0x44')](_0x303bb9[_0xfd68('0x45')],_0x303bb9[_0xfd68('0x42')]);_0x1b7cb3[_0xfd68('0x47')]=_['intersection'](_0x303bb9[_0xfd68('0x45')],qs[_0xfd68('0x46')](_0x22b314[_0xfd68('0x42')][_0xfd68('0x46')]));_0x1b7cb3['attributes']=_0x1b7cb3[_0xfd68('0x47')][_0xfd68('0x56')]?_0x1b7cb3[_0xfd68('0x47')]:_0x303bb9[_0xfd68('0x45')];if(_0x22b314[_0xfd68('0x42')][_0xfd68('0x50')]){_0x1b7cb3[_0xfd68('0x57')]=[{'all':!![]}];}_0x1b7cb3=_[_0xfd68('0x4c')]({},_0x1b7cb3,_0x22b314['options']);return db[_0xfd68('0x3d')][_0xfd68('0x58')](_0x1b7cb3)[_0xfd68('0x1f')](handleEntityNotFound(_0x5d4d3b,null))[_0xfd68('0x1f')](respondWithResult(_0x5d4d3b,null))[_0xfd68('0x59')](handleError(_0x5d4d3b,null));};exports[_0xfd68('0x37')]=function(_0x59883b,_0x52d09b){if(_0x59883b[_0xfd68('0x5a')]['id']){delete _0x59883b[_0xfd68('0x5a')]['id'];}return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x59883b[_0xfd68('0x54')]['id']}})[_0xfd68('0x1f')](handleEntityNotFound(_0x52d09b,null))[_0xfd68('0x1f')](saveUpdates(_0x59883b[_0xfd68('0x5a')],null))[_0xfd68('0x1f')](respondWithResult(_0x52d09b,null))[_0xfd68('0x59')](handleError(_0x52d09b,null));};exports[_0xfd68('0x38')]=function(_0x313c37,_0x4127cc){return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x313c37[_0xfd68('0x54')]['id']}})['then'](handleEntityNotFound(_0x4127cc,null))[_0xfd68('0x1f')](removeEntity(_0x4127cc,null))[_0xfd68('0x59')](handleError(_0x4127cc,null));};exports['describe']=function(_0x14e664,_0x5e8e81){return db['FaxMessage']['describe']()[_0xfd68('0x1f')](respondWithResult(_0x5e8e81,null))['catch'](handleError(_0x5e8e81,null));};var interaction_log=require('../../config/logger')(_0xfd68('0x5b'));exports[_0xfd68('0x5c')]=function(_0x323fea,_0x293fd2,_0x476d26){var _0x54b023={'agent':{},'channel':_0xfd68('0x5d')};if(_0x323fea[_0xfd68('0x5a')]['id']){delete _0x323fea[_0xfd68('0x5a')]['id'];}_0x323fea[_0xfd68('0x5a')][_0xfd68('0x5e')]=!![];_0x323fea[_0xfd68('0x5a')]['readAt']=moment()[_0xfd68('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x323fea['body']['UserId']=_0x323fea[_0xfd68('0x5a')][_0xfd68('0x60')]||_0x323fea[_0xfd68('0x61')]['id'];_0x54b023[_0xfd68('0x62')]['id']=_0x323fea[_0xfd68('0x5a')][_0xfd68('0x60')];return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x323fea[_0xfd68('0x54')]['id'],'UserId':null}})[_0xfd68('0x1f')](handleEntityNotFound(_0x293fd2,null))[_0xfd68('0x1f')](saveUpdates(_0x323fea[_0xfd68('0x5a')],null))[_0xfd68('0x1f')](function(_0x469bf7){if(_0x469bf7){_0x54b023[_0xfd68('0x28')]=_0x469bf7[_0xfd68('0x63')]({'plain':!![]});return db[_0xfd68('0x64')][_0xfd68('0x58')]({'where':{'id':_0x469bf7[_0xfd68('0x65')]}});}return null;})[_0xfd68('0x1f')](handleEntityNotFound(_0x293fd2,null))['then'](function(_0x11ae34){if(_0x11ae34){return _0x11ae34[_0xfd68('0x37')]({'UserId':_0x323fea['body']['UserId'],'read1stAt':_[_0xfd68('0x66')](_0x11ae34['read1stAt'])?moment()[_0xfd68('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x490663){if(_0x490663){_0x54b023[_0xfd68('0x67')]=_0x490663[_0xfd68('0x63')]({'plain':!![]});interaction_log[_0xfd68('0x20')](_0xfd68('0x68'),_0x323fea['user']['id'],_0x323fea[_0xfd68('0x61')][_0xfd68('0x3a')],_0x323fea['user'][_0xfd68('0x69')],_0x54b023[_0xfd68('0x67')]['id'],_0x323fea[_0xfd68('0x5a')]?JSON[_0xfd68('0x25')](_0x323fea[_0xfd68('0x5a')]):_0xfd68('0x6a'));return respondWithRpcPromise(_0xfd68('0x6b'),_0xfd68('0x6c'),_0x54b023);}return null;})[_0xfd68('0x1f')](function(_0x9242dd){var _0x11f45b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9242dd[_0xfd68('0x28')]['ContactId'];return db[_0xfd68('0x6d')][_0xfd68('0x42')](_0x11f45b,{'type':db[_0xfd68('0x6e')][_0xfd68('0x6f')][_0xfd68('0x70')],'raw':!![]})[_0xfd68('0x1f')](function(_0x1c4f77){return _0x1c4f77;});})[_0xfd68('0x1f')](function(_0x269040){if(_0x269040){_0x54b023[_0xfd68('0x28')][_0xfd68('0x71')]=_0x269040[0x0];if(!_0x323fea['body'][_0xfd68('0x60')])return;return db[_0xfd68('0x72')][_0xfd68('0x58')]({'where':{'id':_0x323fea[_0xfd68('0x5a')]['UserId'],'role':_0xfd68('0x62')},'attributes':['id',_0xfd68('0x3a'),_0xfd68('0x73'),'email',_0xfd68('0x74')],'raw':!![]});}return null;})[_0xfd68('0x1f')](function(_0x10e66c){if(!_0x10e66c)return null;_0x54b023[_0xfd68('0x28')][_0xfd68('0x62')]=_0x10e66c;return _0x54b023;})[_0xfd68('0x1f')](function(_0x15c25e){if(_0x15c25e){if(_0x323fea[_0xfd68('0x5a')][_0xfd68('0x75')]){_0x54b023[_0xfd68('0x28')][_0xfd68('0x76')]=util[_0xfd68('0x5f')](_0xfd68('0x77'),_0x323fea[_0xfd68('0x61')][_0xfd68('0x3a')]);_0x54b023['message'][_0xfd68('0x78')]=_0x54b023[_0xfd68('0x78')];_0x54b023[_0xfd68('0x28')][_0xfd68('0x79')]=_0x54b023[_0xfd68('0x78')];_0x54b023['message'][_0xfd68('0x7a')]='accept';return respondWithRpcPromise(_0xfd68('0x7b'),_0xfd68('0x7b'),{'event':'acceptmessage','message':_0x54b023[_0xfd68('0x28')]},client9002)[_0xfd68('0x1f')](function(){return _0x54b023;});}return _0x54b023;}return null;})['then'](respondWithResult(_0x293fd2,null))[_0xfd68('0x59')](handleError(_0x293fd2,null));};var interaction_log=require('../../config/logger')(_0xfd68('0x5b'));exports[_0xfd68('0x35')]=function(_0x580958,_0x4b26c3,_0xbde818){var _0x1bfa66={'agent':{},'channel':'fax'};if(_0x580958[_0xfd68('0x5a')]['id']){delete _0x580958[_0xfd68('0x5a')]['id'];}_0x580958['body'][_0xfd68('0x60')]=_0x580958[_0xfd68('0x5a')]['UserId']||_0x580958[_0xfd68('0x61')]['id'];_0x1bfa66[_0xfd68('0x62')]['id']=_0x580958['body'][_0xfd68('0x60')];return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x580958['params']['id'],'UserId':null}})[_0xfd68('0x1f')](handleEntityNotFound(_0x4b26c3,null))[_0xfd68('0x1f')](function(_0x3da332){if(_0x3da332){_0x1bfa66[_0xfd68('0x28')]=_0x3da332[_0xfd68('0x63')]({'plain':!![]});return db['FaxInteraction'][_0xfd68('0x58')]({'where':{'id':_0x3da332['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b26c3,null))[_0xfd68('0x1f')](function(_0x54f2c1){if(_0x54f2c1){_0x1bfa66[_0xfd68('0x67')]=_0x54f2c1['get']({'plain':!![]});interaction_log[_0xfd68('0x20')](_0xfd68('0x7c'),_0x580958[_0xfd68('0x61')]['id'],_0x580958[_0xfd68('0x61')][_0xfd68('0x3a')],_0x580958['user']['role'],_0x1bfa66[_0xfd68('0x67')]['id'],_0x580958[_0xfd68('0x5a')]?JSON[_0xfd68('0x25')](_0x580958[_0xfd68('0x5a')]):_0xfd68('0x6a'));return respondWithRpcPromise(_0xfd68('0x7d'),_0xfd68('0x7e'),_0x1bfa66);}return null;})[_0xfd68('0x1f')](function(_0x1a6b79){var _0x13d55c=_0xfd68('0x7f')+_0x1a6b79[_0xfd68('0x28')][_0xfd68('0x80')];return db[_0xfd68('0x6d')][_0xfd68('0x42')](_0x13d55c,{'type':db['Sequelize'][_0xfd68('0x6f')][_0xfd68('0x70')],'raw':!![]})[_0xfd68('0x1f')](function(_0x29277a){return _0x29277a;});})[_0xfd68('0x1f')](function(_0x3d28f5){if(_0x3d28f5){_0x1bfa66['message']['contact']=_0x3d28f5[0x0];if(!_0x580958[_0xfd68('0x5a')][_0xfd68('0x60')])return;return db[_0xfd68('0x72')][_0xfd68('0x58')]({'where':{'id':_0x580958[_0xfd68('0x5a')]['UserId'],'role':_0xfd68('0x62')},'attributes':['id','name',_0xfd68('0x73'),_0xfd68('0x81'),'internal'],'raw':!![]});}return null;})[_0xfd68('0x1f')](function(_0x18277d){if(!_0x18277d)return null;_0x1bfa66['message'][_0xfd68('0x62')]=_0x18277d;return _0x1bfa66;})[_0xfd68('0x1f')](function(_0x3fa60d){if(_0x3fa60d){_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x76')]=util['format'](_0xfd68('0x77'),_0x580958['user'][_0xfd68('0x3a')]);_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x78')]=_0x1bfa66[_0xfd68('0x78')];_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x79')]=_0x1bfa66[_0xfd68('0x78')];_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x7a')]=_0xfd68('0x35');respondWithRpcPromise(_0xfd68('0x7b'),_0xfd68('0x7b'),{'event':_0xfd68('0x82'),'message':_0x3fa60d['message']},client9002);return _0x1bfa66;}return null;})[_0xfd68('0x1f')](respondWithResult(_0x4b26c3,null))[_0xfd68('0x59')](handleError(_0x4b26c3,null));};exports[_0xfd68('0x83')]=function(_0x57d02f,_0x3607d5){var _0x26d29c;return db[_0xfd68('0x3d')][_0xfd68('0x83')](_0x57d02f[_0xfd68('0x5a')],{})[_0xfd68('0x1f')](function(_0x227b23){_0x26d29c=_0x227b23;return db[_0xfd68('0x84')][_0xfd68('0x85')]({'where':{'id':_0x26d29c[_0xfd68('0x80')]}});})[_0xfd68('0x1f')](function(_0x3ec834){if(_[_0xfd68('0x66')](_0x3ec834)){return;}else{_0x26d29c['fax']=_0x3ec834[_0xfd68('0x5d')];return db[_0xfd68('0x86')][_0xfd68('0x85')]({'where':{'id':_0x26d29c['AttachmentId']}});}})[_0xfd68('0x1f')](function(_0x5a740c){return respondWithRpcPromise(_0xfd68('0x87'),_0xfd68('0x87'),{'FaxAccountId':_[_0xfd68('0x66')](_0x57d02f[_0xfd68('0x5a')])?undefined:_0x57d02f[_0xfd68('0x5a')][_0xfd68('0x88')],'path':_['isNil'](_0x5a740c)?undefined:util['format'](_0xfd68('0x89'),_0x5a740c[_0xfd68('0x8a')]),'fax':_['isNil'](_0x26d29c[_0xfd68('0x5d')])?undefined:_0x26d29c['fax'],'AttachmentId':_0x26d29c[_0xfd68('0x8b')]},client9002);})['then'](respondWithResult(_0x3607d5,0xc9))[_0xfd68('0x59')](handleError(_0x3607d5,null));};exports[_0xfd68('0x8c')]=function(_0x2a6b11,_0x3b186c){var _0x54d422=path[_0xfd68('0x8d')](config[_0xfd68('0x8e')],_0xfd68('0x8f'),_0xfd68('0x90'),_0xfd68('0x91'));return db['FaxMessage'][_0xfd68('0x58')]({'where':{'id':_0x2a6b11[_0xfd68('0x54')]['id']},'include':[{'model':db[_0xfd68('0x86')],'as':_0xfd68('0x86')}]})[_0xfd68('0x1f')](handleEntityNotFound(_0x3b186c,null))[_0xfd68('0x1f')](function(_0x1faf4e){if(_0x1faf4e){return _0x3b186c[_0xfd68('0x8c')](path['join'](_0x54d422,_0x1faf4e[_0xfd68('0x86')][_0xfd68('0x8a')]));}})[_0xfd68('0x59')](handleError(_0x3b186c,null));}; \ No newline at end of file +var _0x96cf=['limit','count','set','json','apply','reject','save','update','stack','name','send','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','show','find','body','params','describe','fax-interactions','fax','read','format','UserId','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','agent','manual','interface','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','SIP/%s','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','AttachmentId','download','root','server','files','attachments','join','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','undefined'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x96cf,0x162));var _0xf96c=function(_0x539188,_0x56edd2){_0x539188=_0x539188-0x0;var _0x2f4bc5=_0x96cf[_0x539188];return _0x2f4bc5;};'use strict';var emlformat=require(_0xf96c('0x0'));var rimraf=require(_0xf96c('0x1'));var zipdir=require(_0xf96c('0x2'));var jsonpatch=require(_0xf96c('0x3'));var rp=require('request-promise');var moment=require(_0xf96c('0x4'));var BPromise=require(_0xf96c('0x5'));var Mustache=require(_0xf96c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf96c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf96c('0x8'));var squel=require(_0xf96c('0x9'));var crypto=require(_0xf96c('0xa'));var jsforce=require(_0xf96c('0xb'));var deskjs=require(_0xf96c('0xc'));var toCsv=require(_0xf96c('0xd'));var querystring=require(_0xf96c('0xe'));var Papa=require(_0xf96c('0xf'));var Redis=require(_0xf96c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf96c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf96c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf96c('0x13'));var licenseUtil=require(_0xf96c('0x14'));var db=require(_0xf96c('0x15'))['db'];config[_0xf96c('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf96c('0x17'))(new Redis(config['redis']));require(_0xf96c('0x18'))[_0xf96c('0x19')](socket);var jayson=require(_0xf96c('0x1a'));var client=jayson[_0xf96c('0x1b')][_0xf96c('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xf96c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5666af,_0x2226b9,_0x3f90c6,_0x3f3b63){return new BPromise(function(_0x11e0b3,_0x453c73){var _0x2d7098=_0x3f3b63||client;return _0x2d7098[_0xf96c('0x1d')](_0x5666af,_0x3f90c6)[_0xf96c('0x1e')](function(_0x2c6239){logger[_0xf96c('0x1f')](_0xf96c('0x20'),_0x2226b9,_0xf96c('0x21'));logger[_0xf96c('0x22')](_0xf96c('0x23'),_0x2226b9,'request\x20sent',JSON[_0xf96c('0x24')](_0x2c6239));if(_0x2c6239['error']){if(_0x2c6239[_0xf96c('0x25')]['code']===0x1f4){logger[_0xf96c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x2226b9,_0x2c6239[_0xf96c('0x25')][_0xf96c('0x26')]);return _0x453c73(_0x2c6239[_0xf96c('0x25')]['message']);}logger[_0xf96c('0x25')](_0xf96c('0x20'),_0x2226b9,_0x2c6239[_0xf96c('0x25')][_0xf96c('0x26')]);return _0x11e0b3(_0x2c6239['error'][_0xf96c('0x26')]);}else{logger['info'](_0xf96c('0x20'),_0x2226b9,'request\x20sent');_0x11e0b3(_0x2c6239['result']['message']);}})[_0xf96c('0x27')](function(_0x3785b2){logger[_0xf96c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x2226b9,_0x3785b2);_0x453c73(_0x3785b2);});});}function respondWithStatusCode(_0x2a41e1,_0x169d12){_0x169d12=_0x169d12||0xcc;return function(_0x1d5fab){if(_0x1d5fab){return _0x2a41e1[_0xf96c('0x28')](_0x169d12);}return _0x2a41e1[_0xf96c('0x29')](_0x169d12)[_0xf96c('0x2a')]();};}function respondWithResult(_0x4fe0c8,_0x584bb4){_0x584bb4=_0x584bb4||0xc8;return function(_0x880096){if(_0x880096){return _0x4fe0c8[_0xf96c('0x29')](_0x584bb4)['json'](_0x880096);}};}function respondWithFilteredResult(_0x43399a,_0x39d14f){return function(_0x280b70){if(_0x280b70){var _0x44c648=typeof _0x39d14f[_0xf96c('0x2b')]===_0xf96c('0x2c')&&typeof _0x39d14f[_0xf96c('0x2d')]===_0xf96c('0x2c');var _0x1ae6b2=_0x280b70[_0xf96c('0x2e')];var _0x5f445a=_0x44c648?0x0:_0x39d14f[_0xf96c('0x2b')];var _0x432fc6=_0x44c648?_0x280b70[_0xf96c('0x2e')]:_0x39d14f[_0xf96c('0x2b')]+_0x39d14f[_0xf96c('0x2d')];var _0x1abe50;if(_0x432fc6>=_0x1ae6b2){_0x432fc6=_0x1ae6b2;_0x1abe50=0xc8;}else{_0x1abe50=0xce;}_0x43399a[_0xf96c('0x29')](_0x1abe50);return _0x43399a[_0xf96c('0x2f')]('Content-Range',_0x5f445a+'-'+_0x432fc6+'/'+_0x1ae6b2)[_0xf96c('0x30')](_0x280b70);}return null;};}function patchUpdates(_0x3b2925){return function(_0x26f565){try{jsonpatch[_0xf96c('0x31')](_0x26f565,_0x3b2925,!![]);}catch(_0xb50d83){return BPromise[_0xf96c('0x32')](_0xb50d83);}return _0x26f565[_0xf96c('0x33')]();};}function saveUpdates(_0x3700a1,_0x2a9415){return function(_0x3be0b5){if(_0x3be0b5){return _0x3be0b5[_0xf96c('0x34')](_0x3700a1)['then'](function(_0x268281){return _0x268281;});}return null;};}function removeEntity(_0x5b12b1,_0x5b6af0){return function(_0x387508){if(_0x387508){return _0x387508['destroy']()[_0xf96c('0x1e')](function(){_0x5b12b1['status'](0xcc)[_0xf96c('0x2a')]();});}};}function handleEntityNotFound(_0x447ce7,_0x2b7d6a){return function(_0x3dbc5f){if(!_0x3dbc5f){_0x447ce7[_0xf96c('0x28')](0x194);}return _0x3dbc5f;};}function handleError(_0x3b7e17,_0x5ce6bb){_0x5ce6bb=_0x5ce6bb||0x1f4;return function(_0x4ffa6b){logger['error'](_0x4ffa6b[_0xf96c('0x35')]);if(_0x4ffa6b[_0xf96c('0x36')]){delete _0x4ffa6b[_0xf96c('0x36')];}_0x3b7e17[_0xf96c('0x29')](_0x5ce6bb)[_0xf96c('0x37')](_0x4ffa6b);};}exports['index']=function(_0x369650,_0x504f6f){var _0x4ed038={},_0x416355={},_0xc21a7d={'count':0x0,'rows':[]};var _0x55ba4a=_['map'](db[_0xf96c('0x38')][_0xf96c('0x39')],function(_0x5c4722){return{'name':_0x5c4722['fieldName'],'type':_0x5c4722[_0xf96c('0x3a')][_0xf96c('0x3b')]};});_0x416355[_0xf96c('0x3c')]=_[_0xf96c('0x3d')](_0x55ba4a,_0xf96c('0x36'));_0x416355[_0xf96c('0x3e')]=_[_0xf96c('0x3f')](_0x369650['query']);_0x416355[_0xf96c('0x40')]=_[_0xf96c('0x41')](_0x416355['model'],_0x416355['query']);_0x4ed038[_0xf96c('0x42')]=_[_0xf96c('0x41')](_0x416355[_0xf96c('0x3c')],qs[_0xf96c('0x43')](_0x369650['query'][_0xf96c('0x43')]));_0x4ed038['attributes']=_0x4ed038[_0xf96c('0x42')][_0xf96c('0x44')]?_0x4ed038[_0xf96c('0x42')]:_0x416355[_0xf96c('0x3c')];if(!_0x369650[_0xf96c('0x3e')]['hasOwnProperty'](_0xf96c('0x45'))){_0x4ed038[_0xf96c('0x2d')]=qs[_0xf96c('0x2d')](_0x369650[_0xf96c('0x3e')][_0xf96c('0x2d')]);_0x4ed038['offset']=qs[_0xf96c('0x2b')](_0x369650[_0xf96c('0x3e')][_0xf96c('0x2b')]);}_0x4ed038['order']=qs['sort'](_0x369650[_0xf96c('0x3e')][_0xf96c('0x46')]);_0x4ed038[_0xf96c('0x47')]=qs['filters'](_['pick'](_0x369650[_0xf96c('0x3e')],_0x416355[_0xf96c('0x40')]),_0x55ba4a);if(_0x369650['query'][_0xf96c('0x48')]){_0x4ed038[_0xf96c('0x47')]=_[_0xf96c('0x49')](_0x4ed038[_0xf96c('0x47')],{'$or':_[_0xf96c('0x3d')](_0x55ba4a,function(_0x365023){if(_0x365023[_0xf96c('0x3a')]!=='VIRTUAL'){var _0x247ac1={};_0x247ac1[_0x365023['name']]={'$like':'%'+_0x369650[_0xf96c('0x3e')][_0xf96c('0x48')]+'%'};return _0x247ac1;}})});}_0x4ed038=_[_0xf96c('0x49')]({},_0x4ed038,_0x369650[_0xf96c('0x4a')]);var _0x2d2ec7={'where':_0x4ed038[_0xf96c('0x47')]};return db[_0xf96c('0x38')][_0xf96c('0x2e')](_0x2d2ec7)[_0xf96c('0x1e')](function(_0x2b6974){_0xc21a7d[_0xf96c('0x2e')]=_0x2b6974;if(_0x369650[_0xf96c('0x3e')][_0xf96c('0x4b')]){_0x4ed038['include']=[{'all':!![]}];}return db[_0xf96c('0x38')]['findAll'](_0x4ed038);})['then'](function(_0x3778a6){_0xc21a7d['rows']=_0x3778a6;return _0xc21a7d;})[_0xf96c('0x1e')](respondWithFilteredResult(_0x504f6f,_0x4ed038))[_0xf96c('0x27')](handleError(_0x504f6f,null));};exports[_0xf96c('0x4c')]=function(_0x139b77,_0x2fdaed){var _0x5a4caa={'raw':!![],'where':{'id':_0x139b77['params']['id']}},_0x4c7c21={};_0x4c7c21[_0xf96c('0x3c')]=_[_0xf96c('0x3f')](db[_0xf96c('0x38')]['rawAttributes']);_0x4c7c21['query']=_[_0xf96c('0x3f')](_0x139b77[_0xf96c('0x3e')]);_0x4c7c21[_0xf96c('0x40')]=_['intersection'](_0x4c7c21[_0xf96c('0x3c')],_0x4c7c21[_0xf96c('0x3e')]);_0x5a4caa['attributes']=_[_0xf96c('0x41')](_0x4c7c21[_0xf96c('0x3c')],qs[_0xf96c('0x43')](_0x139b77[_0xf96c('0x3e')][_0xf96c('0x43')]));_0x5a4caa[_0xf96c('0x42')]=_0x5a4caa[_0xf96c('0x42')][_0xf96c('0x44')]?_0x5a4caa['attributes']:_0x4c7c21[_0xf96c('0x3c')];if(_0x139b77[_0xf96c('0x3e')]['includeAll']){_0x5a4caa['include']=[{'all':!![]}];}_0x5a4caa=_['merge']({},_0x5a4caa,_0x139b77['options']);return db[_0xf96c('0x38')][_0xf96c('0x4d')](_0x5a4caa)[_0xf96c('0x1e')](handleEntityNotFound(_0x2fdaed,null))[_0xf96c('0x1e')](respondWithResult(_0x2fdaed,null))[_0xf96c('0x27')](handleError(_0x2fdaed,null));};exports[_0xf96c('0x34')]=function(_0xe49dbb,_0x11cee6){if(_0xe49dbb[_0xf96c('0x4e')]['id']){delete _0xe49dbb[_0xf96c('0x4e')]['id'];}return db['FaxMessage'][_0xf96c('0x4d')]({'where':{'id':_0xe49dbb[_0xf96c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x11cee6,null))['then'](saveUpdates(_0xe49dbb['body'],null))[_0xf96c('0x1e')](respondWithResult(_0x11cee6,null))['catch'](handleError(_0x11cee6,null));};exports['destroy']=function(_0x16bf1e,_0x4e1864){return db[_0xf96c('0x38')]['find']({'where':{'id':_0x16bf1e[_0xf96c('0x4f')]['id']}})[_0xf96c('0x1e')](handleEntityNotFound(_0x4e1864,null))[_0xf96c('0x1e')](removeEntity(_0x4e1864,null))[_0xf96c('0x27')](handleError(_0x4e1864,null));};exports[_0xf96c('0x50')]=function(_0x49dc40,_0x2720f2){return db[_0xf96c('0x38')][_0xf96c('0x50')]()[_0xf96c('0x1e')](respondWithResult(_0x2720f2,null))['catch'](handleError(_0x2720f2,null));};var interaction_log=require(_0xf96c('0x12'))(_0xf96c('0x51'));exports['accept']=function(_0x1184fe,_0x76eba4,_0x44a67){var _0x58f666={'agent':{},'channel':_0xf96c('0x52')};if(_0x1184fe[_0xf96c('0x4e')]['id']){delete _0x1184fe[_0xf96c('0x4e')]['id'];}_0x1184fe['body'][_0xf96c('0x53')]=!![];_0x1184fe['body']['readAt']=moment()[_0xf96c('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x1184fe['body'][_0xf96c('0x55')]=_0x1184fe[_0xf96c('0x4e')]['UserId']||_0x1184fe['user']['id'];_0x58f666['agent']['id']=_0x1184fe[_0xf96c('0x4e')][_0xf96c('0x55')];return db[_0xf96c('0x38')]['find']({'where':{'id':_0x1184fe['params']['id'],'UserId':null}})[_0xf96c('0x1e')](handleEntityNotFound(_0x76eba4,null))['then'](saveUpdates(_0x1184fe[_0xf96c('0x4e')],null))[_0xf96c('0x1e')](function(_0x7ea914){if(_0x7ea914){_0x58f666[_0xf96c('0x26')]=_0x7ea914[_0xf96c('0x56')]({'plain':!![]});return db[_0xf96c('0x57')][_0xf96c('0x4d')]({'where':{'id':_0x7ea914['FaxInteractionId']}});}return null;})[_0xf96c('0x1e')](handleEntityNotFound(_0x76eba4,null))[_0xf96c('0x1e')](function(_0x2ab1cc){if(_0x2ab1cc){return _0x2ab1cc[_0xf96c('0x34')]({'UserId':_0x1184fe[_0xf96c('0x4e')]['UserId'],'read1stAt':_[_0xf96c('0x58')](_0x2ab1cc[_0xf96c('0x59')])?moment()[_0xf96c('0x54')](_0xf96c('0x5a')):undefined});}return null;})['then'](function(_0x44f8b9){if(_0x44f8b9){_0x58f666[_0xf96c('0x5b')]=_0x44f8b9['get']({'plain':!![]});interaction_log['info'](_0xf96c('0x5c'),_0x1184fe[_0xf96c('0x5d')]['id'],_0x1184fe[_0xf96c('0x5d')][_0xf96c('0x36')],_0x1184fe['user'][_0xf96c('0x5e')],_0x58f666['interaction']['id'],_0x1184fe[_0xf96c('0x4e')]?JSON[_0xf96c('0x24')](_0x1184fe['body']):_0xf96c('0x5f'));return respondWithRpcPromise(_0xf96c('0x60'),'acceptMessage',_0x58f666);}return null;})[_0xf96c('0x1e')](function(_0x103326){var _0x43e852=_0xf96c('0x61')+_0x103326[_0xf96c('0x26')][_0xf96c('0x62')];return db[_0xf96c('0x63')][_0xf96c('0x3e')](_0x43e852,{'type':db[_0xf96c('0x64')][_0xf96c('0x65')]['SELECT'],'raw':!![]})[_0xf96c('0x1e')](function(_0x569562){return _0x569562;});})[_0xf96c('0x1e')](function(_0x57ddf5){if(_0x57ddf5){_0x58f666[_0xf96c('0x26')][_0xf96c('0x66')]=_0x57ddf5[0x0];if(!_0x1184fe[_0xf96c('0x4e')][_0xf96c('0x55')])return;return db['User'][_0xf96c('0x4d')]({'where':{'id':_0x1184fe[_0xf96c('0x4e')][_0xf96c('0x55')],'role':'agent'},'attributes':['id','name','fullname',_0xf96c('0x67'),_0xf96c('0x68')],'raw':!![]});}return null;})[_0xf96c('0x1e')](function(_0x5e1878){if(!_0x5e1878)return null;_0x58f666[_0xf96c('0x26')][_0xf96c('0x69')]=_0x5e1878;return _0x58f666;})[_0xf96c('0x1e')](function(_0x4ede8d){if(_0x4ede8d){if(_0x1184fe[_0xf96c('0x4e')][_0xf96c('0x6a')]){_0x58f666[_0xf96c('0x26')][_0xf96c('0x6b')]=util[_0xf96c('0x54')]('SIP/%s',_0x1184fe[_0xf96c('0x5d')][_0xf96c('0x36')]);_0x58f666[_0xf96c('0x26')][_0xf96c('0x6c')]=_0x58f666[_0xf96c('0x6c')];_0x58f666['message']['motionChannel']=_0x58f666[_0xf96c('0x6c')];_0x58f666['message'][_0xf96c('0x6d')]='accept';return respondWithRpcPromise(_0xf96c('0x6e'),_0xf96c('0x6e'),{'event':'acceptmessage','message':_0x58f666['message']},client9002)[_0xf96c('0x1e')](function(){return _0x58f666;});}return _0x58f666;}return null;})[_0xf96c('0x1e')](respondWithResult(_0x76eba4,null))['catch'](handleError(_0x76eba4,null));};var interaction_log=require(_0xf96c('0x12'))(_0xf96c('0x51'));exports[_0xf96c('0x32')]=function(_0x2996d0,_0x8f6316,_0x4894d3){var _0x51160a={'agent':{},'channel':_0xf96c('0x52')};if(_0x2996d0[_0xf96c('0x4e')]['id']){delete _0x2996d0['body']['id'];}_0x2996d0['body']['UserId']=_0x2996d0[_0xf96c('0x4e')][_0xf96c('0x55')]||_0x2996d0[_0xf96c('0x5d')]['id'];_0x51160a[_0xf96c('0x69')]['id']=_0x2996d0[_0xf96c('0x4e')][_0xf96c('0x55')];return db[_0xf96c('0x38')][_0xf96c('0x4d')]({'where':{'id':_0x2996d0[_0xf96c('0x4f')]['id'],'UserId':null}})[_0xf96c('0x1e')](handleEntityNotFound(_0x8f6316,null))[_0xf96c('0x1e')](function(_0x421f54){if(_0x421f54){_0x51160a[_0xf96c('0x26')]=_0x421f54[_0xf96c('0x56')]({'plain':!![]});return db[_0xf96c('0x57')][_0xf96c('0x4d')]({'where':{'id':_0x421f54['FaxInteractionId']}});}return null;})[_0xf96c('0x1e')](handleEntityNotFound(_0x8f6316,null))[_0xf96c('0x1e')](function(_0x2885ee){if(_0x2885ee){_0x51160a[_0xf96c('0x5b')]=_0x2885ee[_0xf96c('0x56')]({'plain':!![]});interaction_log[_0xf96c('0x1f')](_0xf96c('0x6f'),_0x2996d0[_0xf96c('0x5d')]['id'],_0x2996d0['user'][_0xf96c('0x36')],_0x2996d0[_0xf96c('0x5d')][_0xf96c('0x5e')],_0x51160a[_0xf96c('0x5b')]['id'],_0x2996d0['body']?JSON[_0xf96c('0x24')](_0x2996d0[_0xf96c('0x4e')]):_0xf96c('0x5f'));return respondWithRpcPromise(_0xf96c('0x70'),_0xf96c('0x71'),_0x51160a);}return null;})[_0xf96c('0x1e')](function(_0x2c4fd0){var _0x119238=_0xf96c('0x61')+_0x2c4fd0['message'][_0xf96c('0x62')];return db['sequelize'][_0xf96c('0x3e')](_0x119238,{'type':db[_0xf96c('0x64')][_0xf96c('0x65')][_0xf96c('0x72')],'raw':!![]})[_0xf96c('0x1e')](function(_0x22d0e7){return _0x22d0e7;});})['then'](function(_0x44da10){if(_0x44da10){_0x51160a[_0xf96c('0x26')]['contact']=_0x44da10[0x0];if(!_0x2996d0[_0xf96c('0x4e')][_0xf96c('0x55')])return;return db[_0xf96c('0x73')][_0xf96c('0x4d')]({'where':{'id':_0x2996d0[_0xf96c('0x4e')][_0xf96c('0x55')],'role':_0xf96c('0x69')},'attributes':['id',_0xf96c('0x36'),'fullname',_0xf96c('0x67'),_0xf96c('0x68')],'raw':!![]});}return null;})[_0xf96c('0x1e')](function(_0x234e0c){if(!_0x234e0c)return null;_0x51160a[_0xf96c('0x26')][_0xf96c('0x69')]=_0x234e0c;return _0x51160a;})[_0xf96c('0x1e')](function(_0x54f073){if(_0x54f073){_0x54f073[_0xf96c('0x26')][_0xf96c('0x6b')]=util[_0xf96c('0x54')](_0xf96c('0x74'),_0x2996d0[_0xf96c('0x5d')]['name']);_0x54f073['message']['channel']=_0x51160a[_0xf96c('0x6c')];_0x54f073[_0xf96c('0x26')][_0xf96c('0x75')]=_0x51160a[_0xf96c('0x6c')];_0x54f073[_0xf96c('0x26')][_0xf96c('0x6d')]=_0xf96c('0x32');respondWithRpcPromise(_0xf96c('0x6e'),_0xf96c('0x6e'),{'event':_0xf96c('0x76'),'message':_0x54f073['message']},client9002);return _0x51160a;}return null;})[_0xf96c('0x1e')](respondWithResult(_0x8f6316,null))[_0xf96c('0x27')](handleError(_0x8f6316,null));};exports[_0xf96c('0x77')]=function(_0x4e96f2,_0x4d89f1){var _0x252791;return db['FaxMessage']['create'](_0x4e96f2['body'],{})[_0xf96c('0x1e')](function(_0x11ea6a){_0x252791=_0x11ea6a;return db[_0xf96c('0x78')][_0xf96c('0x79')]({'where':{'id':_0x252791['ContactId']}});})[_0xf96c('0x1e')](function(_0x2b66a9){if(_[_0xf96c('0x58')](_0x2b66a9)){return;}else{_0x252791[_0xf96c('0x52')]=_0x2b66a9[_0xf96c('0x52')];return db[_0xf96c('0x7a')][_0xf96c('0x79')]({'where':{'id':_0x252791['AttachmentId']}});}})[_0xf96c('0x1e')](function(_0x1e9b8e){return respondWithRpcPromise(_0xf96c('0x7b'),_0xf96c('0x7b'),{'FaxAccountId':_['isNil'](_0x4e96f2[_0xf96c('0x4e')])?undefined:_0x4e96f2[_0xf96c('0x4e')][_0xf96c('0x7c')],'path':_[_0xf96c('0x58')](_0x1e9b8e)?undefined:util[_0xf96c('0x54')]('/var/opt/motion2/server/files/attachments/%s',_0x1e9b8e['basename']),'fax':_[_0xf96c('0x58')](_0x252791[_0xf96c('0x52')])?undefined:_0x252791['fax'],'AttachmentId':_0x252791[_0xf96c('0x7d')]},client9002);})[_0xf96c('0x1e')](respondWithResult(_0x4d89f1,0xc9))[_0xf96c('0x27')](handleError(_0x4d89f1,null));};exports[_0xf96c('0x7e')]=function(_0x2aa3c0,_0x51e640){var _0x236fa1=path['join'](config[_0xf96c('0x7f')],_0xf96c('0x80'),_0xf96c('0x81'),_0xf96c('0x82'));return db[_0xf96c('0x38')]['find']({'where':{'id':_0x2aa3c0['params']['id']},'include':[{'model':db['Attachment'],'as':_0xf96c('0x7a')}]})[_0xf96c('0x1e')](handleEntityNotFound(_0x51e640,null))['then'](function(_0x46fd4a){if(_0x46fd4a){return _0x51e640['download'](path[_0xf96c('0x83')](_0x236fa1,_0x46fd4a[_0xf96c('0x7a')][_0xf96c('0x84')]));}})['catch'](handleError(_0x51e640,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 344a49e..063abf2 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 _0xb90a=['setMaxListeners','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x13ce90,_0xdf634d){var _0x59ce8c=function(_0x3652d1){while(--_0x3652d1){_0x13ce90['push'](_0x13ce90['shift']());}};_0x59ce8c(++_0xdf634d);}(_0xb90a,0x12a));var _0xab90=function(_0x1c5ca3,_0x18dcc2){_0x1c5ca3=_0x1c5ca3-0x0;var _0x5db079=_0xb90a[_0x1c5ca3];return _0x5db079;};'use strict';var EventEmitter=require(_0xab90('0x0'));var FaxMessage=require(_0xab90('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xab90('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5eaa1d){return function(_0x57672e,_0x3912db,_0x178509){FaxMessageEvents['emit'](_0x5eaa1d+':'+_0x57672e['id'],_0x57672e);FaxMessageEvents['emit'](_0x5eaa1d,_0x57672e);_0x178509(null);};}for(var e in events){if(events[_0xab90('0x3')](e)){var event=events[e];FaxMessage[_0xab90('0x4')](e,emitEvent(event));}}module[_0xab90('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0x6eed=['emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x36e2d9,_0x5a0bde){var _0x4beee2=function(_0x36a4e0){while(--_0x36a4e0){_0x36e2d9['push'](_0x36e2d9['shift']());}};_0x4beee2(++_0x5a0bde);}(_0x6eed,0xff));var _0xd6ee=function(_0x2eefad,_0x378913){_0x2eefad=_0x2eefad-0x0;var _0x431c35=_0x6eed[_0x2eefad];return _0x431c35;};'use strict';var EventEmitter=require(_0xd6ee('0x0'));var FaxMessage=require(_0xd6ee('0x1'))['db'][_0xd6ee('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd6ee('0x3')](0x0);var events={'afterCreate':_0xd6ee('0x4'),'afterUpdate':'update','afterDestroy':_0xd6ee('0x5')};function emitEvent(_0x315fdb){return function(_0x588715,_0x53cce9,_0x1d3312){FaxMessageEvents[_0xd6ee('0x6')](_0x315fdb+':'+_0x588715['id'],_0x588715);FaxMessageEvents[_0xd6ee('0x6')](_0x315fdb,_0x588715);_0x1d3312(null);};}for(var e in events){if(events[_0xd6ee('0x7')](e)){var event=events[e];FaxMessage[_0xd6ee('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0873727..7f99a4c 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 _0xe93c=['error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0xe93c,0xea));var _0xce93=function(_0x254f2b,_0x203e5f){_0x254f2b=_0x254f2b-0x0;var _0x2c5488=_0xe93c[_0x254f2b];return _0x2c5488;};'use strict';var _=require(_0xce93('0x0'));var util=require(_0xce93('0x1'));var logger=require(_0xce93('0x2'))(_0xce93('0x3'));var moment=require(_0xce93('0x4'));var BPromise=require(_0xce93('0x5'));var rp=require(_0xce93('0x6'));var fs=require('fs');var path=require(_0xce93('0x7'));var rimraf=require('rimraf');var config=require(_0xce93('0x8'));var attributes=require(_0xce93('0x9'));module[_0xce93('0xa')]=function(_0x4372b8,_0xba9816){return _0x4372b8[_0xce93('0xb')]('FaxMessage',attributes,{'tableName':_0xce93('0xc'),'paranoid':![],'indexes':[{'name':_0xce93('0xd'),'fields':[_0xce93('0xe')],'type':_0xce93('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11233e,_0x38a859,_0x1d31af){var _0x42723b=_0x4372b8[_0xce93('0x10')];var _0x21dfcc=_0x11233e[_0xce93('0x11')]({'plain':!![]});if(_0x21dfcc[_0xce93('0x12')][_0xce93('0x13')]()==='in'||_0x21dfcc[_0xce93('0x12')][_0xce93('0x13')]()===_0xce93('0x14')&&!_0x21dfcc['secret']&&!_['isNil'](_0x21dfcc[_0xce93('0x15')])){_0x42723b[_0xce93('0x16')][_0xce93('0x17')]({'where':{'id':_0x21dfcc[_0xce93('0x18')]}})[_0xce93('0x19')](function(_0x4e009f){if(_0x4e009f){_0x4e009f['update']({'lastMsgAt':_0x21dfcc['createdAt'],'lastMsgDirection':_0x21dfcc['direction'][_0xce93('0x13')]()});}})[_0xce93('0x1a')](function(_0x40c306){console[_0xce93('0x1b')](_0x40c306);});}_0x1d31af();}},'charset':_0xce93('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf023=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x771012,_0x81cd9d){var _0x417f60=function(_0x32ff3e){while(--_0x32ff3e){_0x771012['push'](_0x771012['shift']());}};_0x417f60(++_0x81cd9d);}(_0xf023,0x160));var _0x3f02=function(_0xe2ce80,_0x19bbc0){_0xe2ce80=_0xe2ce80-0x0;var _0x46a0ec=_0xf023[_0xe2ce80];return _0x46a0ec;};'use strict';var _=require(_0x3f02('0x0'));var util=require(_0x3f02('0x1'));var logger=require(_0x3f02('0x2'))(_0x3f02('0x3'));var moment=require(_0x3f02('0x4'));var BPromise=require(_0x3f02('0x5'));var rp=require(_0x3f02('0x6'));var fs=require('fs');var path=require(_0x3f02('0x7'));var rimraf=require(_0x3f02('0x8'));var config=require('../../config/environment');var attributes=require(_0x3f02('0x9'));module[_0x3f02('0xa')]=function(_0x4e7d21,_0x595c7f){return _0x4e7d21[_0x3f02('0xb')](_0x3f02('0xc'),attributes,{'tableName':_0x3f02('0xd'),'paranoid':![],'indexes':[{'name':_0x3f02('0xe'),'fields':['body'],'type':_0x3f02('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cb7be,_0x731f93,_0x27f0a7){var _0x25c7c3=_0x4e7d21['models'];var _0x463577=_0x5cb7be[_0x3f02('0x10')]({'plain':!![]});if(_0x463577[_0x3f02('0x11')][_0x3f02('0x12')]()==='in'||_0x463577[_0x3f02('0x11')][_0x3f02('0x12')]()===_0x3f02('0x13')&&!_0x463577[_0x3f02('0x14')]&&!_[_0x3f02('0x15')](_0x463577[_0x3f02('0x16')])){_0x25c7c3[_0x3f02('0x17')]['findOne']({'where':{'id':_0x463577[_0x3f02('0x18')]}})[_0x3f02('0x19')](function(_0x5ab021){if(_0x5ab021){_0x5ab021[_0x3f02('0x1a')]({'lastMsgAt':_0x463577[_0x3f02('0x1b')],'lastMsgDirection':_0x463577[_0x3f02('0x11')][_0x3f02('0x12')]()});}})[_0x3f02('0x1c')](function(_0x3bdb93){console[_0x3f02('0x1d')](_0x3bdb93);});}_0x27f0a7();}},'charset':_0x3f02('0x1e'),'collate':_0x3f02('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index efa3c5f..7906c85 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x554665,_0x522dee){var _0x32f946=function(_0x12270b){while(--_0x12270b){_0x554665['push'](_0x554665['shift']());}};_0x32f946(++_0x522dee);}(_0xe14d,0x1ee));var _0xde14=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xe14d[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5867a6f..4cd06e4 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 _0xc0ce=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xc0ce,0x1b5));var _0xec0c=function(_0x22cc95,_0x31808f){_0x22cc95=_0x22cc95-0x0;var _0x2959d=_0xc0ce[_0x22cc95];return _0x2959d;};'use strict';var FaxMessageEvents=require(_0xec0c('0x0'));var events=[_0xec0c('0x1'),_0xec0c('0x2'),_0xec0c('0x3')];function createListener(_0x56a738,_0x58407f){return function(_0x44e652){_0x58407f[_0xec0c('0x4')](_0x56a738,_0x44e652);};}function removeListener(_0x358141,_0x4566f8){return function(){FaxMessageEvents[_0xec0c('0x5')](_0x358141,_0x4566f8);};}exports[_0xec0c('0x6')]=function(_0x1796ad){for(var _0x952184=0x0,_0x3893c0=events[_0xec0c('0x7')];_0x952184<_0x3893c0;_0x952184++){var _0x2b0da0=events[_0x952184];var _0xdddcee=createListener(_0xec0c('0x8')+_0x2b0da0,_0x1796ad);FaxMessageEvents['on'](_0x2b0da0,_0xdddcee);}}; \ No newline at end of file +var _0xce02=['emit','removeListener','length','./faxMessage.events','save','remove','update'];(function(_0x5e1a50,_0x2fa259){var _0x6158e7=function(_0x232232){while(--_0x232232){_0x5e1a50['push'](_0x5e1a50['shift']());}};_0x6158e7(++_0x2fa259);}(_0xce02,0xd5));var _0x2ce0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xce02[_0x167cc1];return _0x10bc4b;};'use strict';var FaxMessageEvents=require(_0x2ce0('0x0'));var events=[_0x2ce0('0x1'),_0x2ce0('0x2'),_0x2ce0('0x3')];function createListener(_0x5b6b39,_0x286375){return function(_0x49bc0b){_0x286375[_0x2ce0('0x4')](_0x5b6b39,_0x49bc0b);};}function removeListener(_0x1ef8f4,_0x14617f){return function(){FaxMessageEvents[_0x2ce0('0x5')](_0x1ef8f4,_0x14617f);};}exports['register']=function(_0x39e810){for(var _0x50a10a=0x0,_0x257670=events[_0x2ce0('0x6')];_0x50a10a<_0x257670;_0x50a10a++){var _0x13022b=events[_0x50a10a];var _0x256377=createListener('faxMessage:'+_0x13022b,_0x39e810);FaxMessageEvents['on'](_0x13022b,_0x256377);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ae7cf29..24599f0 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 _0xf4eb=['/:id/accept','accept','/:id/reject','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put'];(function(_0xe3025,_0x686182){var _0x592d0b=function(_0x4d249f){while(--_0x4d249f){_0xe3025['push'](_0xe3025['shift']());}};_0x592d0b(++_0x686182);}(_0xf4eb,0xec));var _0xbf4e=function(_0x313b62,_0x323e6f){_0x313b62=_0x313b62-0x0;var _0x3b316c=_0xf4eb[_0x313b62];return _0x3b316c;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xbf4e('0xc')]('fax',_0xbf4e('0xd')),controller[_0xbf4e('0xe')]);router['put'](_0xbf4e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);router[_0xbf4e('0xf')](_0xbf4e('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xbf4e('0x13')](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x14')]=router; \ No newline at end of file +var _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xc368,0x7b));var _0x8c36=function(_0x38b071,_0x53d793){_0x38b071=_0x38b071-0x0;var _0x5f076b=_0xc368[_0x38b071];return _0x5f076b;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d66143e..9c68917 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 _0x83fc=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2bea8d,_0x5a4fb3){var _0x5537e8=function(_0x51872d){while(--_0x51872d){_0x2bea8d['push'](_0x2bea8d['shift']());}};_0x5537e8(++_0x5a4fb3);}(_0x83fc,0x181));var _0xc83f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x83fc[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xc83f('0x0'));module[_0xc83f('0x1')]={'name':{'type':Sequelize[_0xc83f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc83f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc83f('0x4')](_0xc83f('0x5'),_0xc83f('0x6'),_0xc83f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc83f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2ed=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xb2ed,0x86));var _0xdb2e=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xb2ed[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xdb2e('0x0'));module[_0xdb2e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdb2e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb2e('0x3')]},'timeout':{'type':Sequelize[_0xdb2e('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb2e('0x5')](_0xdb2e('0x6'),_0xdb2e('0x7'),_0xdb2e('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdb2e('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 67907eb..7c0cc32 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 _0xa46e=['field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','undefined','limit','offset','count','set','then','FaxQueues','UserProfileResource','destroy','error','name','send','rawAttributes','type','getOptions','where','FaxQueue','include','query','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','pick','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','filter','map','hasOwnProperty','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','forEach','userFaxQueue:save','removeTeams'];(function(_0x202c3d,_0x3264ea){var _0x48b8e9=function(_0x5debd4){while(--_0x5debd4){_0x202c3d['push'](_0x202c3d['shift']());}};_0x48b8e9(++_0x3264ea);}(_0xa46e,0x8a));var _0xea46=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa46e[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var _=require('lodash');var squel=require(_0xea46('0x2'));var Redis=require(_0xea46('0x3'));var qs=require(_0xea46('0x4'));var logger=require('../../config/logger')(_0xea46('0x5'));var config=require('../../config/environment');var db=require(_0xea46('0x6'))['db'];config['redis']=_[_0xea46('0x7')](config['redis'],{'host':_0xea46('0x8'),'port':0x18eb});var socket=require(_0xea46('0x9'))(new Redis(config['redis']));require(_0xea46('0xa'))[_0xea46('0xb')](socket);function respondWithStatusCode(_0xe7d428,_0x3db7a2){_0x3db7a2=_0x3db7a2||0xcc;return function(_0x468322){if(_0x468322){return _0xe7d428['sendStatus'](_0x3db7a2);}return _0xe7d428['status'](_0x3db7a2)['end']();};}function respondWithResult(_0x2c82e,_0x45550a){_0x45550a=_0x45550a||0xc8;return function(_0x5ae8f9){if(_0x5ae8f9){return _0x2c82e[_0xea46('0xc')](_0x45550a)[_0xea46('0xd')](_0x5ae8f9);}};}function respondWithFilteredResult(_0x4560b1,_0x594694){return function(_0xa6d289){if(_0xa6d289){var _0x38e83b=typeof _0x594694['offset']===_0xea46('0xe')&&typeof _0x594694[_0xea46('0xf')]==='undefined';var _0x20955e=_0xa6d289['count'];var _0x3024af=_0x38e83b?0x0:_0x594694[_0xea46('0x10')];var _0x6c4bc4=_0x38e83b?_0xa6d289[_0xea46('0x11')]:_0x594694[_0xea46('0x10')]+_0x594694[_0xea46('0xf')];var _0x81ee45;if(_0x6c4bc4>=_0x20955e){_0x6c4bc4=_0x20955e;_0x81ee45=0xc8;}else{_0x81ee45=0xce;}_0x4560b1[_0xea46('0xc')](_0x81ee45);return _0x4560b1[_0xea46('0x12')]('Content-Range',_0x3024af+'-'+_0x6c4bc4+'/'+_0x20955e)[_0xea46('0xd')](_0xa6d289);}return null;};}function saveUpdates(_0xbf225e){return function(_0x3926cf){if(_0x3926cf){return _0x3926cf['update'](_0xbf225e)['then'](function(_0x19d5c1){return _0x19d5c1;});}return null;};}function removeEntity(_0x3f463d){return function(_0x5cf5dd){if(_0x5cf5dd){return _0x5cf5dd['destroy']()[_0xea46('0x13')](function(){var _0x9b7d04=_0x5cf5dd['get']({'plain':!![]});var _0x40316b=_0xea46('0x14');return db[_0xea46('0x15')][_0xea46('0x16')]({'where':{'type':_0x40316b,'resourceId':_0x9b7d04['id']}})['then'](function(){return _0x5cf5dd;});})[_0xea46('0x13')](function(){_0x3f463d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc43e){return function(_0x59e431){if(!_0x59e431){_0x1bc43e['sendStatus'](0x194);}return _0x59e431;};}function handleError(_0x5064d8,_0x3b25fe){_0x3b25fe=_0x3b25fe||0x1f4;return function(_0x36f982){logger[_0xea46('0x17')](_0x36f982['stack']);if(_0x36f982[_0xea46('0x18')]){delete _0x36f982['name'];}_0x5064d8[_0xea46('0xc')](_0x3b25fe)[_0xea46('0x19')](_0x36f982);};}exports['index']=function(_0xac33c3,_0x5480eb){var _0x2b3a8f={};var _0x114bf9={'count':0x0,'rows':[]};var _0xd4cf78=_['map'](db['FaxQueue'][_0xea46('0x1a')],function(_0x38ac07){return{'name':_0x38ac07['fieldName'],'type':_0x38ac07[_0xea46('0x1b')]['key']};});_0x2b3a8f=qs[_0xea46('0x1c')](_0xd4cf78,_0xac33c3);var _0x51ca27={'where':_0x2b3a8f[_0xea46('0x1d')]};return db[_0xea46('0x1e')][_0xea46('0x11')](_0x51ca27)[_0xea46('0x13')](function(_0x146995){_0x114bf9[_0xea46('0x11')]=_0x146995;_0x2b3a8f['include']=qs[_0xea46('0x1f')](_0xac33c3[_0xea46('0x20')]);return db[_0xea46('0x1e')]['findAll'](_0x2b3a8f);})[_0xea46('0x13')](function(_0x3cdf96){_0x114bf9[_0xea46('0x21')]=_0x3cdf96;return _0x114bf9;})['then'](respondWithFilteredResult(_0x5480eb,_0x2b3a8f))['catch'](handleError(_0x5480eb,null));};exports['show']=function(_0x64e2d0,_0x16f730){var _0x167ee9={'raw':!![],'where':{'id':_0x64e2d0[_0xea46('0x22')]['id']}},_0x17f101={};_0x17f101[_0xea46('0x23')]=_[_0xea46('0x24')](db[_0xea46('0x1e')][_0xea46('0x1a')]);_0x17f101[_0xea46('0x20')]=_[_0xea46('0x24')](_0x64e2d0['query']);_0x17f101[_0xea46('0x25')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],_0x17f101[_0xea46('0x20')]);_0x167ee9[_0xea46('0x27')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],qs['fields'](_0x64e2d0[_0xea46('0x20')][_0xea46('0x28')]));_0x167ee9[_0xea46('0x27')]=_0x167ee9[_0xea46('0x27')][_0xea46('0x29')]?_0x167ee9['attributes']:_0x17f101['model'];if(_0x64e2d0[_0xea46('0x20')][_0xea46('0x2a')]){_0x167ee9['include']=[{'all':!![]}];}_0x167ee9=_[_0xea46('0x2b')]({},_0x167ee9,_0x64e2d0[_0xea46('0x2c')]);return db[_0xea46('0x1e')][_0xea46('0x2d')](_0x167ee9)['then'](handleEntityNotFound(_0x16f730,null))['then'](respondWithResult(_0x16f730,null))[_0xea46('0x2e')](handleError(_0x16f730,null));};exports['create']=function(_0x7c34ce,_0xdec374){return db['FaxQueue'][_0xea46('0x2f')](_0x7c34ce[_0xea46('0x30')],{})['then'](function(_0xb90644){var _0xefad3e=_0x7c34ce['user'][_0xea46('0x31')]({'plain':!![]});if(!_0xefad3e)throw new Error(_0xea46('0x32'));if(_0xefad3e[_0xea46('0x33')]===_0xea46('0x34')){var _0x4a0287=_0xb90644[_0xea46('0x31')]({'plain':!![]});var _0x48c2be=_0xea46('0x14');return db[_0xea46('0x35')][_0xea46('0x2d')]({'where':{'name':_0x48c2be,'userProfileId':_0xefad3e['userProfileId']},'raw':!![]})[_0xea46('0x13')](function(_0xdb2e11){if(_0xdb2e11&&_0xdb2e11['autoAssociation']===0x0){return db[_0xea46('0x15')][_0xea46('0x2f')]({'name':_0x4a0287[_0xea46('0x18')],'resourceId':_0x4a0287['id'],'type':_0xdb2e11[_0xea46('0x18')],'sectionId':_0xdb2e11['id']},{})['then'](function(){return _0xb90644;});}else{return _0xb90644;}})[_0xea46('0x2e')](function(_0x1cc8f8){logger[_0xea46('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc8f8);throw _0x1cc8f8;});}return _0xb90644;})[_0xea46('0x13')](respondWithResult(_0xdec374,0xc9))[_0xea46('0x2e')](handleError(_0xdec374,null));};exports[_0xea46('0x36')]=function(_0x32c81c,_0x3164c5){if(_0x32c81c[_0xea46('0x30')]['id']){delete _0x32c81c[_0xea46('0x30')]['id'];}return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x32c81c[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x3164c5,null))[_0xea46('0x13')](saveUpdates(_0x32c81c[_0xea46('0x30')],null))[_0xea46('0x13')](respondWithResult(_0x3164c5,null))[_0xea46('0x2e')](handleError(_0x3164c5,null));};exports['destroy']=function(_0x4798d1,_0x2299bb){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x4798d1[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x2299bb,null))['then'](removeEntity(_0x2299bb,null))['catch'](handleError(_0x2299bb,null));};exports[_0xea46('0x37')]=function(_0x709bd3,_0x53a4d9){return db[_0xea46('0x1e')][_0xea46('0x37')]()[_0xea46('0x13')](respondWithResult(_0x53a4d9,null))[_0xea46('0x2e')](handleError(_0x53a4d9,null));};exports[_0xea46('0x38')]=function(_0x5c5eed,_0x172db7){var _0x4bd3f2={'raw':!![],'where':{}},_0x22d9a2={},_0x18bcbf;return db[_0xea46('0x1e')][_0xea46('0x39')]({'where':{'id':_0x5c5eed[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x172db7,null))[_0xea46('0x13')](function(_0x52f134){if(_0x52f134){_0x18bcbf=_0x52f134[_0xea46('0x31')]({'plain':!![]});_0x22d9a2[_0xea46('0x23')]=_['keys'](db[_0xea46('0x3a')][_0xea46('0x1a')]);_0x22d9a2[_0xea46('0x20')]=_['keys'](_0x5c5eed['query']);_0x22d9a2[_0xea46('0x25')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],_0x22d9a2[_0xea46('0x20')]);_0x4bd3f2[_0xea46('0x27')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],qs[_0xea46('0x28')](_0x5c5eed[_0xea46('0x20')][_0xea46('0x28')]));_0x4bd3f2['attributes']=_0x4bd3f2[_0xea46('0x27')]['length']?_0x4bd3f2[_0xea46('0x27')]:_0x22d9a2[_0xea46('0x23')];if(!_0x5c5eed[_0xea46('0x20')]['hasOwnProperty'](_0xea46('0x3b'))){_0x4bd3f2[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x5c5eed[_0xea46('0x20')]['limit']);_0x4bd3f2['offset']=qs[_0xea46('0x10')](_0x5c5eed[_0xea46('0x20')]['offset']);}_0x4bd3f2[_0xea46('0x3c')]=qs['sort'](_0x5c5eed[_0xea46('0x20')][_0xea46('0x3d')]);_0x4bd3f2[_0xea46('0x1d')]=qs[_0xea46('0x25')](_[_0xea46('0x3e')](_0x5c5eed[_0xea46('0x20')],_0x22d9a2[_0xea46('0x25')]));_0x4bd3f2['where']['FaxQueueId']=_0x52f134['id'];if(_0x5c5eed[_0xea46('0x20')]['filter']){_0x4bd3f2[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x4bd3f2[_0xea46('0x1d')],{'$or':_['map'](_0x4bd3f2[_0xea46('0x27')],function(_0x4fcd7b){var _0xc12018={};_0xc12018[_0x4fcd7b]={'$like':'%'+_0x5c5eed[_0xea46('0x20')]['filter']+'%'};return _0xc12018;})});}_0x4bd3f2=_['merge']({},_0x4bd3f2,_0x5c5eed[_0xea46('0x2c')]);return db[_0xea46('0x3a')][_0xea46('0x3f')](_0x4bd3f2);}})['then'](function(_0x287a41){if(_0x287a41){return db['User'][_0xea46('0x40')]({'where':{'id':_['map'](_0x287a41,_0xea46('0x41')),'role':_0xea46('0x42')},'attributes':['id',_0xea46('0x18'),_0xea46('0x43'),_0xea46('0x44'),'createdAt']});}})[_0xea46('0x13')](function(_0x2659bd){if(_0x2659bd){return{'count':_0x2659bd[_0xea46('0x11')],'rows':_['map'](_0x2659bd['rows'],function(_0x3f6a07){return{'membername':_0x3f6a07[_0xea46('0x18')],'UserId':_0x3f6a07['id'],'queue_name':_0x18bcbf[_0xea46('0x18')],'FaxQueueId':_0x18bcbf['id'],'interface':util[_0xea46('0x45')](_0xea46('0x46'),_0xea46('0x47'),_0x3f6a07[_0xea46('0x18')]),'penalty':0x0,'paused':_0x3f6a07[_0xea46('0x43')],'createdAt':_0x3f6a07[_0xea46('0x48')],'updatedAt':_0x3f6a07[_0xea46('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea46('0x13')](respondWithFilteredResult(_0x172db7,_0x4bd3f2))[_0xea46('0x2e')](handleError(_0x172db7,null));};exports[_0xea46('0x49')]=function(_0x219776,_0x38f80e){var _0x487b4e={};var _0x375875={};var _0x2c248c;var _0x397e98;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x219776[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x38f80e,null))['then'](function(_0x17b3ab){if(_0x17b3ab){_0x2c248c=_0x17b3ab;_0x375875[_0xea46('0x23')]=_['keys'](db[_0xea46('0x4a')][_0xea46('0x1a')]);_0x375875[_0xea46('0x20')]=_['keys'](_0x219776[_0xea46('0x20')]);_0x375875[_0xea46('0x25')]=_[_0xea46('0x26')](_0x375875['model'],_0x375875['query']);_0x487b4e['attributes']=_[_0xea46('0x26')](_0x375875[_0xea46('0x23')],qs[_0xea46('0x28')](_0x219776[_0xea46('0x20')][_0xea46('0x28')]));_0x487b4e['attributes']=_0x487b4e[_0xea46('0x27')]['length']?_0x487b4e[_0xea46('0x27')]:_0x375875[_0xea46('0x23')];_0x487b4e[_0xea46('0x3c')]=qs['sort'](_0x219776['query'][_0xea46('0x3d')]);_0x487b4e[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x219776[_0xea46('0x20')],_0x375875[_0xea46('0x25')]));if(_0x219776[_0xea46('0x20')][_0xea46('0x4b')]){_0x487b4e['where']=_[_0xea46('0x2b')](_0x487b4e[_0xea46('0x1d')],{'$or':_[_0xea46('0x4c')](_0x487b4e[_0xea46('0x27')],function(_0x2b85ee){var _0xd13bb7={};_0xd13bb7[_0x2b85ee]={'$like':'%'+_0x219776[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0xd13bb7;})});}_0x487b4e=_['merge']({},_0x487b4e,_0x219776[_0xea46('0x2c')]);return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x7f99b2){if(_0x7f99b2){_0x397e98=_0x7f99b2[_0xea46('0x29')];if(!_0x219776[_0xea46('0x20')][_0xea46('0x4d')]('nolimit')){_0x487b4e['limit']=qs[_0xea46('0xf')](_0x219776[_0xea46('0x20')][_0xea46('0xf')]);_0x487b4e[_0xea46('0x10')]=qs[_0xea46('0x10')](_0x219776[_0xea46('0x20')][_0xea46('0x10')]);}return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x4edb04){if(_0x4edb04){return _0x4edb04?{'count':_0x397e98,'rows':_0x4edb04}:null;}})[_0xea46('0x13')](respondWithResult(_0x38f80e,null))['catch'](handleError(_0x38f80e,null));};exports[_0xea46('0x4e')]=function(_0x7fbb17,_0x2f36a1){var _0x3a4709=_0x7fbb17['body'][_0xea46('0x4f')];return db[_0xea46('0x4a')][_0xea46('0x3f')]({'where':{'id':_0x3a4709},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id',_0xea46('0x18'),_0xea46('0x51'),_0xea46('0x52'),_0xea46('0x53')],'raw':!![]}]})['then'](function(_0x427f12){if(_0x427f12){var _0x137bf5=_['flatMap'](_0x427f12,function(_0x574f62){var _0x32a9da=_0x574f62[_0xea46('0x31')]({'plain':!![]});return _0x32a9da[_0xea46('0x54')];});return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x7fbb17[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0xd62207){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0xbafd55){return _0xd62207[_0xea46('0x4e')](_0x3a4709,{'transaction':_0xbafd55})[_0xea46('0x13')](function(){return BPromise['each'](_0x137bf5,function(_0x5fe06e){return db[_0xea46('0x3a')]['findOrCreate']({'where':{'UserId':_0x5fe06e['id'],'FaxQueueId':_0x7fbb17[_0xea46('0x22')]['id']},'transaction':_0xbafd55});});})[_0xea46('0x13')](function(){_0x137bf5[_0xea46('0x57')](function(_0x407f59){socket['emit'](_0xea46('0x58'),{'UserId':_0x407f59['id'],'FaxQueueId':_0xd62207['id']});});});});});}})['then'](respondWithStatusCode(_0x2f36a1,null))[_0xea46('0x2e')](handleError(_0x2f36a1,null));};exports[_0xea46('0x59')]=function(_0x2091aa,_0x199c97){return db['Team'][_0xea46('0x3f')]({'where':{'id':_0x2091aa['query'][_0xea46('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea46('0x13')](handleEntityNotFound(_0x199c97,null))[_0xea46('0x13')](function(_0x523a2a){var _0xfb75fb=_[_0xea46('0x4c')](_0x523a2a,'id');var _0x5303f2=[];var _0x5e7a2c=[];var _0x47c40b=squel['select']();_0x47c40b[_0xea46('0x5a')](_0xea46('0x5b'))[_0xea46('0x5c')](_0xea46('0x5d'),'tq')[_0xea46('0x5e')](_0xea46('0x5f'),'ut',_0xea46('0x60'))[_0xea46('0x1d')]('FaxQueueId\x20=\x20?',_0x2091aa[_0xea46('0x22')]['id']);for(var _0x3e9151=0x0;_0x3e9151<_0x523a2a[_0xea46('0x29')];_0x3e9151+=0x1){let _0x182cc9=_0x523a2a[_0x3e9151];for(var _0x20875f=0x0;_0x20875f<_0x182cc9['Agents']['length'];_0x20875f+=0x1){let _0x29136d=_0x182cc9[_0xea46('0x54')][_0x20875f];var _0x3b4b90=_0x47c40b[_0xea46('0x61')]();_0x3b4b90[_0xea46('0x1d')]('ut.UserId\x20=\x20?',_0x29136d['id']);_0x5e7a2c[_0xea46('0x62')](db[_0xea46('0x55')]['query'](_0x3b4b90['toString'](),{'type':db[_0xea46('0x55')][_0xea46('0x63')][_0xea46('0x64')]})[_0xea46('0x13')](function(_0x354ff5){if(_0x354ff5['length']===0x1){return _0x29136d['id'];}else{var _0x299a48=_['every'](_[_0xea46('0x4c')](_0x354ff5,_0xea46('0x65')),function(_0x867af8){return _[_0xea46('0x66')](_0xfb75fb,_0x867af8);});if(_0x299a48){return _0x29136d['id'];}}}));}}return BPromise['all'](_0x5e7a2c)[_0xea46('0x13')](function(_0x35e967){_0x5303f2=_(_0x5303f2)[_0xea46('0x67')](_0x35e967)[_0xea46('0x68')]()[_0xea46('0x69')]();return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x2091aa[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0x59b475){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0x4ea522){return _0x59b475[_0xea46('0x59')](_0x2091aa[_0xea46('0x20')][_0xea46('0x4f')],{'transaction':_0x4ea522})[_0xea46('0x13')](function(){if(!_['isEmpty'](_0x5303f2)){return _0x59b475[_0xea46('0x6a')](_0x5303f2,{'transaction':_0x4ea522});}})[_0xea46('0x13')](function(){_0x5303f2['forEach'](function(_0x5e477d){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':_0x5e477d,'FaxQueueId':_0x59b475['id']});});});});});});})[_0xea46('0x13')](respondWithStatusCode(_0x199c97,null))[_0xea46('0x2e')](handleError(_0x199c97,null));};exports[_0xea46('0x6d')]=function(_0x4799fe,_0x218253){return db[_0xea46('0x1e')]['find']({'where':{'id':_0x4799fe[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x218253,null))[_0xea46('0x13')](function(_0x4e2c45){if(_0x4e2c45){return _0x4e2c45[_0xea46('0x6d')](_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')],_[_0xea46('0x6e')](_0x4799fe['body'],[_0xea46('0x4f'),'id'])||{})[_0xea46('0x6f')](function(_0x2aaf72){for(var _0x20c8a3=0x0;_0x20c8a3<_0x4799fe['body'][_0xea46('0x4f')]['length'];_0x20c8a3+=0x1){socket[_0xea46('0x6b')](_0xea46('0x58'),{'UserId':Number(_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')][_0x20c8a3]),'FaxQueueId':Number(_0x4799fe[_0xea46('0x22')]['id'])});}return _0x2aaf72;});}})[_0xea46('0x13')](respondWithResult(_0x218253,null))[_0xea46('0x2e')](handleError(_0x218253,null));};exports['removeAgents']=function(_0x33f5a3,_0x45a97d){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x33f5a3['params']['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x45a97d,null))['then'](function(_0x20b4bf){if(_0x20b4bf){return _0x20b4bf['removeAgents'](_0x33f5a3['query'][_0xea46('0x4f')])[_0xea46('0x13')](function(){if(_[_0xea46('0x70')](_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')])){for(var _0x4db97e=0x0;_0x4db97e<_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')][_0xea46('0x29')];_0x4db97e+=0x1){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids'][_0x4db97e]),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}}else{socket[_0xea46('0x6b')]('userFaxQueue:remove',{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids']),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}});}})[_0xea46('0x13')](respondWithStatusCode(_0x45a97d,null))[_0xea46('0x2e')](handleError(_0x45a97d,null));};exports[_0xea46('0x71')]=function(_0x3a8e83,_0x39c6ae){var _0x5e4e96={};var _0x5f0cbc={};var _0x4c5c79;var _0x548ca1;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x3a8e83[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x39c6ae,null))[_0xea46('0x13')](function(_0x38e1ef){if(_0x38e1ef){_0x4c5c79=_0x38e1ef;_0x5f0cbc['model']=_[_0xea46('0x24')](db[_0xea46('0x50')]['rawAttributes']);_0x5f0cbc[_0xea46('0x20')]=_[_0xea46('0x24')](_0x3a8e83[_0xea46('0x20')]);_0x5f0cbc[_0xea46('0x25')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],_0x5f0cbc[_0xea46('0x20')]);_0x5e4e96[_0xea46('0x27')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],qs[_0xea46('0x28')](_0x3a8e83['query']['fields']));_0x5e4e96[_0xea46('0x27')]=_0x5e4e96[_0xea46('0x27')]['length']?_0x5e4e96['attributes']:_0x5f0cbc['model'];_0x5e4e96['order']=qs[_0xea46('0x3d')](_0x3a8e83[_0xea46('0x20')][_0xea46('0x3d')]);_0x5e4e96[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x3a8e83[_0xea46('0x20')],_0x5f0cbc[_0xea46('0x25')]));if(_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]){_0x5e4e96[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x5e4e96[_0xea46('0x1d')],{'$or':_['map'](_0x5e4e96[_0xea46('0x27')],function(_0xe92069){var _0x3b4067={};_0x3b4067[_0xe92069]={'$like':'%'+_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0x3b4067;})});}_0x5e4e96=_[_0xea46('0x2b')]({},_0x5e4e96,_0x3a8e83[_0xea46('0x2c')]);return _0x4c5c79[_0xea46('0x71')](_0x5e4e96);}})[_0xea46('0x13')](function(_0x2cebac){if(_0x2cebac){_0x548ca1=_0x2cebac['length'];if(!_0x3a8e83[_0xea46('0x20')][_0xea46('0x4d')](_0xea46('0x3b'))){_0x5e4e96[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x3a8e83[_0xea46('0x20')][_0xea46('0xf')]);_0x5e4e96[_0xea46('0x10')]=qs['offset'](_0x3a8e83[_0xea46('0x20')][_0xea46('0x10')]);}return _0x4c5c79['getAgents'](_0x5e4e96);}})[_0xea46('0x13')](function(_0x4df90c){if(_0x4df90c){return _0x4df90c?{'count':_0x548ca1,'rows':_0x4df90c}:null;}})[_0xea46('0x13')](respondWithResult(_0x39c6ae,null))['catch'](handleError(_0x39c6ae,null));}; \ No newline at end of file +var _0x8f9d=['forEach','emit','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','UserProfileResource','end','error','name','send','index','map','FaxQueue','rawAttributes','type','key','getOptions','include','query','findAll','catch','params','model','keys','attributes','intersection','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','merge','options','User','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','Team','length','filter','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate'];(function(_0x82226b,_0x404c63){var _0x2a94b5=function(_0x2a2602){while(--_0x2a2602){_0x82226b['push'](_0x82226b['shift']());}};_0x2a94b5(++_0x404c63);}(_0x8f9d,0x93));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require(_0xd8f9('0x0'));var util=require('util');var _=require(_0xd8f9('0x1'));var squel=require('squel');var Redis=require(_0xd8f9('0x2'));var qs=require(_0xd8f9('0x3'));var logger=require(_0xd8f9('0x4'))(_0xd8f9('0x5'));var config=require(_0xd8f9('0x6'));var db=require(_0xd8f9('0x7'))['db'];config[_0xd8f9('0x8')]=_['defaults'](config[_0xd8f9('0x8')],{'host':_0xd8f9('0x9'),'port':0x18eb});var socket=require(_0xd8f9('0xa'))(new Redis(config[_0xd8f9('0x8')]));require(_0xd8f9('0xb'))['register'](socket);function respondWithStatusCode(_0x46babd,_0x6691e){_0x6691e=_0x6691e||0xcc;return function(_0x4957ae){if(_0x4957ae){return _0x46babd[_0xd8f9('0xc')](_0x6691e);}return _0x46babd['status'](_0x6691e)['end']();};}function respondWithResult(_0x421aca,_0x3d0bea){_0x3d0bea=_0x3d0bea||0xc8;return function(_0x32b880){if(_0x32b880){return _0x421aca[_0xd8f9('0xd')](_0x3d0bea)[_0xd8f9('0xe')](_0x32b880);}};}function respondWithFilteredResult(_0x3a1db8,_0x14c630){return function(_0x4bd11c){if(_0x4bd11c){var _0x3a214b=typeof _0x14c630['offset']===_0xd8f9('0xf')&&typeof _0x14c630[_0xd8f9('0x10')]===_0xd8f9('0xf');var _0x5b01ce=_0x4bd11c[_0xd8f9('0x11')];var _0x3df6d2=_0x3a214b?0x0:_0x14c630[_0xd8f9('0x12')];var _0x223f10=_0x3a214b?_0x4bd11c['count']:_0x14c630[_0xd8f9('0x12')]+_0x14c630[_0xd8f9('0x10')];var _0x234901;if(_0x223f10>=_0x5b01ce){_0x223f10=_0x5b01ce;_0x234901=0xc8;}else{_0x234901=0xce;}_0x3a1db8[_0xd8f9('0xd')](_0x234901);return _0x3a1db8[_0xd8f9('0x13')](_0xd8f9('0x14'),_0x3df6d2+'-'+_0x223f10+'/'+_0x5b01ce)[_0xd8f9('0xe')](_0x4bd11c);}return null;};}function saveUpdates(_0x505500){return function(_0x5cb08e){if(_0x5cb08e){return _0x5cb08e[_0xd8f9('0x15')](_0x505500)[_0xd8f9('0x16')](function(_0x4d5b8d){return _0x4d5b8d;});}return null;};}function removeEntity(_0x35943f){return function(_0x47bdea){if(_0x47bdea){return _0x47bdea[_0xd8f9('0x17')]()['then'](function(){var _0x4cf93a=_0x47bdea['get']({'plain':!![]});var _0xa3b0cd='FaxQueues';return db[_0xd8f9('0x18')][_0xd8f9('0x17')]({'where':{'type':_0xa3b0cd,'resourceId':_0x4cf93a['id']}})[_0xd8f9('0x16')](function(){return _0x47bdea;});})[_0xd8f9('0x16')](function(){_0x35943f[_0xd8f9('0xd')](0xcc)[_0xd8f9('0x19')]();});}};}function handleEntityNotFound(_0x5863ad){return function(_0x1de3cc){if(!_0x1de3cc){_0x5863ad[_0xd8f9('0xc')](0x194);}return _0x1de3cc;};}function handleError(_0x164bf6,_0x36d740){_0x36d740=_0x36d740||0x1f4;return function(_0x1bf210){logger[_0xd8f9('0x1a')](_0x1bf210['stack']);if(_0x1bf210[_0xd8f9('0x1b')]){delete _0x1bf210[_0xd8f9('0x1b')];}_0x164bf6[_0xd8f9('0xd')](_0x36d740)[_0xd8f9('0x1c')](_0x1bf210);};}exports[_0xd8f9('0x1d')]=function(_0x4c0002,_0xcc9b18){var _0x1d6796={};var _0x28854a={'count':0x0,'rows':[]};var _0xd15475=_[_0xd8f9('0x1e')](db[_0xd8f9('0x1f')][_0xd8f9('0x20')],function(_0x461880){return{'name':_0x461880['fieldName'],'type':_0x461880[_0xd8f9('0x21')][_0xd8f9('0x22')]};});_0x1d6796=qs[_0xd8f9('0x23')](_0xd15475,_0x4c0002);var _0x58a3ca={'where':_0x1d6796['where']};return db['FaxQueue'][_0xd8f9('0x11')](_0x58a3ca)[_0xd8f9('0x16')](function(_0x5050a4){_0x28854a[_0xd8f9('0x11')]=_0x5050a4;_0x1d6796[_0xd8f9('0x24')]=qs['include'](_0x4c0002[_0xd8f9('0x25')]);return db[_0xd8f9('0x1f')][_0xd8f9('0x26')](_0x1d6796);})['then'](function(_0xda1b6d){_0x28854a['rows']=_0xda1b6d;return _0x28854a;})[_0xd8f9('0x16')](respondWithFilteredResult(_0xcc9b18,_0x1d6796))[_0xd8f9('0x27')](handleError(_0xcc9b18,null));};exports['show']=function(_0x19d639,_0x54b8c1){var _0x340f0a={'raw':!![],'where':{'id':_0x19d639[_0xd8f9('0x28')]['id']}},_0x45f8bf={};_0x45f8bf[_0xd8f9('0x29')]=_[_0xd8f9('0x2a')](db[_0xd8f9('0x1f')][_0xd8f9('0x20')]);_0x45f8bf['query']=_[_0xd8f9('0x2a')](_0x19d639['query']);_0x45f8bf['filters']=_['intersection'](_0x45f8bf['model'],_0x45f8bf[_0xd8f9('0x25')]);_0x340f0a[_0xd8f9('0x2b')]=_[_0xd8f9('0x2c')](_0x45f8bf[_0xd8f9('0x29')],qs[_0xd8f9('0x2d')](_0x19d639['query']['fields']));_0x340f0a[_0xd8f9('0x2b')]=_0x340f0a[_0xd8f9('0x2b')]['length']?_0x340f0a[_0xd8f9('0x2b')]:_0x45f8bf[_0xd8f9('0x29')];if(_0x19d639[_0xd8f9('0x25')]['includeAll']){_0x340f0a['include']=[{'all':!![]}];}_0x340f0a=_['merge']({},_0x340f0a,_0x19d639['options']);return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')](_0x340f0a)[_0xd8f9('0x16')](handleEntityNotFound(_0x54b8c1,null))[_0xd8f9('0x16')](respondWithResult(_0x54b8c1,null))[_0xd8f9('0x27')](handleError(_0x54b8c1,null));};exports['create']=function(_0x3333ea,_0x2bc390){return db[_0xd8f9('0x1f')][_0xd8f9('0x2f')](_0x3333ea[_0xd8f9('0x30')],{})[_0xd8f9('0x16')](function(_0x37b3cc){var _0x262e7c=_0x3333ea[_0xd8f9('0x31')][_0xd8f9('0x32')]({'plain':!![]});if(!_0x262e7c)throw new Error(_0xd8f9('0x33'));if(_0x262e7c['role']===_0xd8f9('0x31')){var _0x3cfd69=_0x37b3cc[_0xd8f9('0x32')]({'plain':!![]});var _0x45f13d='FaxQueues';return db[_0xd8f9('0x34')][_0xd8f9('0x2e')]({'where':{'name':_0x45f13d,'userProfileId':_0x262e7c[_0xd8f9('0x35')]},'raw':!![]})[_0xd8f9('0x16')](function(_0x1ab301){if(_0x1ab301&&_0x1ab301[_0xd8f9('0x36')]===0x0){return db['UserProfileResource']['create']({'name':_0x3cfd69['name'],'resourceId':_0x3cfd69['id'],'type':_0x1ab301[_0xd8f9('0x1b')],'sectionId':_0x1ab301['id']},{})[_0xd8f9('0x16')](function(){return _0x37b3cc;});}else{return _0x37b3cc;}})[_0xd8f9('0x27')](function(_0x1d8e5d){logger[_0xd8f9('0x1a')](_0xd8f9('0x37'),_0x1d8e5d);throw _0x1d8e5d;});}return _0x37b3cc;})[_0xd8f9('0x16')](respondWithResult(_0x2bc390,0xc9))[_0xd8f9('0x27')](handleError(_0x2bc390,null));};exports[_0xd8f9('0x15')]=function(_0x5ed1b7,_0x4aabbe){if(_0x5ed1b7[_0xd8f9('0x30')]['id']){delete _0x5ed1b7[_0xd8f9('0x30')]['id'];}return db[_0xd8f9('0x1f')]['find']({'where':{'id':_0x5ed1b7['params']['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x4aabbe,null))[_0xd8f9('0x16')](saveUpdates(_0x5ed1b7[_0xd8f9('0x30')],null))['then'](respondWithResult(_0x4aabbe,null))[_0xd8f9('0x27')](handleError(_0x4aabbe,null));};exports[_0xd8f9('0x17')]=function(_0x153260,_0x32f108){return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')]({'where':{'id':_0x153260[_0xd8f9('0x28')]['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x32f108,null))[_0xd8f9('0x16')](removeEntity(_0x32f108,null))['catch'](handleError(_0x32f108,null));};exports['describe']=function(_0x492781,_0x1ba90a){return db[_0xd8f9('0x1f')][_0xd8f9('0x38')]()[_0xd8f9('0x16')](respondWithResult(_0x1ba90a,null))[_0xd8f9('0x27')](handleError(_0x1ba90a,null));};exports[_0xd8f9('0x39')]=function(_0x1b1782,_0x26b892){var _0x26527c={'raw':!![],'where':{}},_0x521b07={},_0x35f7a6;return db[_0xd8f9('0x1f')][_0xd8f9('0x3a')]({'where':{'id':_0x1b1782['params']['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x26b892,null))[_0xd8f9('0x16')](function(_0x417be0){if(_0x417be0){_0x35f7a6=_0x417be0[_0xd8f9('0x32')]({'plain':!![]});_0x521b07['model']=_[_0xd8f9('0x2a')](db['UserFaxQueue']['rawAttributes']);_0x521b07[_0xd8f9('0x25')]=_[_0xd8f9('0x2a')](_0x1b1782[_0xd8f9('0x25')]);_0x521b07[_0xd8f9('0x3b')]=_[_0xd8f9('0x2c')](_0x521b07[_0xd8f9('0x29')],_0x521b07[_0xd8f9('0x25')]);_0x26527c[_0xd8f9('0x2b')]=_[_0xd8f9('0x2c')](_0x521b07[_0xd8f9('0x29')],qs['fields'](_0x1b1782['query']['fields']));_0x26527c[_0xd8f9('0x2b')]=_0x26527c[_0xd8f9('0x2b')]['length']?_0x26527c[_0xd8f9('0x2b')]:_0x521b07[_0xd8f9('0x29')];if(!_0x1b1782[_0xd8f9('0x25')][_0xd8f9('0x3c')](_0xd8f9('0x3d'))){_0x26527c[_0xd8f9('0x10')]=qs[_0xd8f9('0x10')](_0x1b1782[_0xd8f9('0x25')]['limit']);_0x26527c[_0xd8f9('0x12')]=qs[_0xd8f9('0x12')](_0x1b1782[_0xd8f9('0x25')][_0xd8f9('0x12')]);}_0x26527c[_0xd8f9('0x3e')]=qs[_0xd8f9('0x3f')](_0x1b1782[_0xd8f9('0x25')][_0xd8f9('0x3f')]);_0x26527c[_0xd8f9('0x40')]=qs[_0xd8f9('0x3b')](_[_0xd8f9('0x41')](_0x1b1782['query'],_0x521b07[_0xd8f9('0x3b')]));_0x26527c[_0xd8f9('0x40')][_0xd8f9('0x42')]=_0x417be0['id'];if(_0x1b1782[_0xd8f9('0x25')]['filter']){_0x26527c[_0xd8f9('0x40')]=_[_0xd8f9('0x43')](_0x26527c[_0xd8f9('0x40')],{'$or':_['map'](_0x26527c[_0xd8f9('0x2b')],function(_0x195a46){var _0x2218da={};_0x2218da[_0x195a46]={'$like':'%'+_0x1b1782[_0xd8f9('0x25')]['filter']+'%'};return _0x2218da;})});}_0x26527c=_[_0xd8f9('0x43')]({},_0x26527c,_0x1b1782[_0xd8f9('0x44')]);return db['UserFaxQueue']['findAll'](_0x26527c);}})[_0xd8f9('0x16')](function(_0x5eec41){if(_0x5eec41){return db[_0xd8f9('0x45')]['findAndCountAll']({'where':{'id':_[_0xd8f9('0x1e')](_0x5eec41,'UserId'),'role':_0xd8f9('0x46')},'attributes':['id','name',_0xd8f9('0x47'),_0xd8f9('0x48'),_0xd8f9('0x49')]});}})[_0xd8f9('0x16')](function(_0x5d3dec){if(_0x5d3dec){return{'count':_0x5d3dec[_0xd8f9('0x11')],'rows':_[_0xd8f9('0x1e')](_0x5d3dec[_0xd8f9('0x4a')],function(_0xe2e546){return{'membername':_0xe2e546[_0xd8f9('0x1b')],'UserId':_0xe2e546['id'],'queue_name':_0x35f7a6[_0xd8f9('0x1b')],'FaxQueueId':_0x35f7a6['id'],'interface':util[_0xd8f9('0x4b')](_0xd8f9('0x4c'),'SIP',_0xe2e546[_0xd8f9('0x1b')]),'penalty':0x0,'paused':_0xe2e546[_0xd8f9('0x47')],'createdAt':_0xe2e546[_0xd8f9('0x49')],'updatedAt':_0xe2e546[_0xd8f9('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8f9('0x16')](respondWithFilteredResult(_0x26b892,_0x26527c))['catch'](handleError(_0x26b892,null));};exports['getTeams']=function(_0x4f542b,_0x12d4eb){var _0x3fecfc={};var _0x5e5c3b={};var _0x5aa4d0;var _0x3133b4;return db[_0xd8f9('0x1f')][_0xd8f9('0x3a')]({'where':{'id':_0x4f542b[_0xd8f9('0x28')]['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x12d4eb,null))[_0xd8f9('0x16')](function(_0x5964d8){if(_0x5964d8){_0x5aa4d0=_0x5964d8;_0x5e5c3b[_0xd8f9('0x29')]=_[_0xd8f9('0x2a')](db[_0xd8f9('0x4d')][_0xd8f9('0x20')]);_0x5e5c3b['query']=_[_0xd8f9('0x2a')](_0x4f542b[_0xd8f9('0x25')]);_0x5e5c3b[_0xd8f9('0x3b')]=_[_0xd8f9('0x2c')](_0x5e5c3b[_0xd8f9('0x29')],_0x5e5c3b[_0xd8f9('0x25')]);_0x3fecfc[_0xd8f9('0x2b')]=_[_0xd8f9('0x2c')](_0x5e5c3b[_0xd8f9('0x29')],qs['fields'](_0x4f542b['query']['fields']));_0x3fecfc[_0xd8f9('0x2b')]=_0x3fecfc[_0xd8f9('0x2b')][_0xd8f9('0x4e')]?_0x3fecfc[_0xd8f9('0x2b')]:_0x5e5c3b[_0xd8f9('0x29')];_0x3fecfc[_0xd8f9('0x3e')]=qs[_0xd8f9('0x3f')](_0x4f542b[_0xd8f9('0x25')]['sort']);_0x3fecfc[_0xd8f9('0x40')]=qs['filters'](_[_0xd8f9('0x41')](_0x4f542b[_0xd8f9('0x25')],_0x5e5c3b[_0xd8f9('0x3b')]));if(_0x4f542b[_0xd8f9('0x25')][_0xd8f9('0x4f')]){_0x3fecfc[_0xd8f9('0x40')]=_[_0xd8f9('0x43')](_0x3fecfc[_0xd8f9('0x40')],{'$or':_['map'](_0x3fecfc[_0xd8f9('0x2b')],function(_0x573049){var _0x3fba0c={};_0x3fba0c[_0x573049]={'$like':'%'+_0x4f542b['query']['filter']+'%'};return _0x3fba0c;})});}_0x3fecfc=_[_0xd8f9('0x43')]({},_0x3fecfc,_0x4f542b['options']);return _0x5aa4d0['getTeams'](_0x3fecfc);}})[_0xd8f9('0x16')](function(_0x43294b){if(_0x43294b){_0x3133b4=_0x43294b[_0xd8f9('0x4e')];if(!_0x4f542b[_0xd8f9('0x25')][_0xd8f9('0x3c')]('nolimit')){_0x3fecfc[_0xd8f9('0x10')]=qs[_0xd8f9('0x10')](_0x4f542b['query'][_0xd8f9('0x10')]);_0x3fecfc[_0xd8f9('0x12')]=qs[_0xd8f9('0x12')](_0x4f542b[_0xd8f9('0x25')]['offset']);}return _0x5aa4d0[_0xd8f9('0x50')](_0x3fecfc);}})['then'](function(_0x26b5fe){if(_0x26b5fe){return _0x26b5fe?{'count':_0x3133b4,'rows':_0x26b5fe}:null;}})[_0xd8f9('0x16')](respondWithResult(_0x12d4eb,null))[_0xd8f9('0x27')](handleError(_0x12d4eb,null));};exports[_0xd8f9('0x51')]=function(_0x1a782b,_0x41d80e){var _0x1f0891=_0x1a782b[_0xd8f9('0x30')][_0xd8f9('0x52')];return db[_0xd8f9('0x4d')][_0xd8f9('0x26')]({'where':{'id':_0x1f0891},'attributes':['id'],'include':[{'model':db[_0xd8f9('0x45')],'as':_0xd8f9('0x53'),'attributes':['id',_0xd8f9('0x1b'),_0xd8f9('0x54'),_0xd8f9('0x55'),_0xd8f9('0x56')],'raw':!![]}]})[_0xd8f9('0x16')](function(_0x5e8548){if(_0x5e8548){var _0x3fb837=_[_0xd8f9('0x57')](_0x5e8548,function(_0x516957){var _0x2a494c=_0x516957[_0xd8f9('0x32')]({'plain':!![]});return _0x2a494c[_0xd8f9('0x53')];});return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')]({'where':{'id':_0x1a782b['params']['id']}})[_0xd8f9('0x16')](function(_0x52d3e1){return db[_0xd8f9('0x58')]['transaction'](function(_0x39705b){return _0x52d3e1[_0xd8f9('0x51')](_0x1f0891,{'transaction':_0x39705b})['then'](function(){return BPromise[_0xd8f9('0x59')](_0x3fb837,function(_0x5aeae1){return db['UserFaxQueue'][_0xd8f9('0x5a')]({'where':{'UserId':_0x5aeae1['id'],'FaxQueueId':_0x1a782b['params']['id']},'transaction':_0x39705b});});})['then'](function(){_0x3fb837[_0xd8f9('0x5b')](function(_0x4ce332){socket[_0xd8f9('0x5c')]('userFaxQueue:save',{'UserId':_0x4ce332['id'],'FaxQueueId':_0x52d3e1['id']});});});});});}})[_0xd8f9('0x16')](respondWithStatusCode(_0x41d80e,null))[_0xd8f9('0x27')](handleError(_0x41d80e,null));};exports['removeTeams']=function(_0x724f4b,_0x1a27bd){return db[_0xd8f9('0x4d')][_0xd8f9('0x26')]({'where':{'id':_0x724f4b['query'][_0xd8f9('0x52')]},'attributes':['id'],'include':[{'model':db[_0xd8f9('0x45')],'as':_0xd8f9('0x53'),'attributes':['id'],'raw':!![]}]})[_0xd8f9('0x16')](handleEntityNotFound(_0x1a27bd,null))[_0xd8f9('0x16')](function(_0xe3c3){var _0x1bc562=_[_0xd8f9('0x1e')](_0xe3c3,'id');var _0x56e4b0=[];var _0xb23727=[];var _0x3c0966=squel['select']();_0x3c0966['field']('tq.TeamId')[_0xd8f9('0x5d')](_0xd8f9('0x5e'),'tq')[_0xd8f9('0x5f')](_0xd8f9('0x60'),'ut',_0xd8f9('0x61'))['where'](_0xd8f9('0x62'),_0x724f4b[_0xd8f9('0x28')]['id']);for(var _0x305b5c=0x0;_0x305b5c<_0xe3c3[_0xd8f9('0x4e')];_0x305b5c+=0x1){let _0x11cdf2=_0xe3c3[_0x305b5c];for(var _0x4f07ed=0x0;_0x4f07ed<_0x11cdf2[_0xd8f9('0x53')]['length'];_0x4f07ed+=0x1){let _0x7d2deb=_0x11cdf2['Agents'][_0x4f07ed];var _0x41cf7e=_0x3c0966['clone']();_0x41cf7e[_0xd8f9('0x40')](_0xd8f9('0x63'),_0x7d2deb['id']);_0xb23727[_0xd8f9('0x64')](db['sequelize'][_0xd8f9('0x25')](_0x41cf7e['toString'](),{'type':db[_0xd8f9('0x58')][_0xd8f9('0x65')][_0xd8f9('0x66')]})[_0xd8f9('0x16')](function(_0x3bfd8e){if(_0x3bfd8e[_0xd8f9('0x4e')]===0x1){return _0x7d2deb['id'];}else{var _0x5abbba=_[_0xd8f9('0x67')](_[_0xd8f9('0x1e')](_0x3bfd8e,_0xd8f9('0x68')),function(_0x4530c0){return _[_0xd8f9('0x69')](_0x1bc562,_0x4530c0);});if(_0x5abbba){return _0x7d2deb['id'];}}}));}}return BPromise[_0xd8f9('0x6a')](_0xb23727)[_0xd8f9('0x16')](function(_0x54bf5f){_0x56e4b0=_(_0x56e4b0)[_0xd8f9('0x6b')](_0x54bf5f)['compact']()[_0xd8f9('0x6c')]();return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')]({'where':{'id':_0x724f4b['params']['id']}})['then'](function(_0x430c13){return db[_0xd8f9('0x58')]['transaction'](function(_0x5bb866){return _0x430c13[_0xd8f9('0x6d')](_0x724f4b[_0xd8f9('0x25')][_0xd8f9('0x52')],{'transaction':_0x5bb866})[_0xd8f9('0x16')](function(){if(!_[_0xd8f9('0x6e')](_0x56e4b0)){return _0x430c13[_0xd8f9('0x6f')](_0x56e4b0,{'transaction':_0x5bb866});}})['then'](function(){_0x56e4b0[_0xd8f9('0x5b')](function(_0x5a5917){socket[_0xd8f9('0x5c')](_0xd8f9('0x70'),{'UserId':_0x5a5917,'FaxQueueId':_0x430c13['id']});});});});});});})[_0xd8f9('0x16')](respondWithStatusCode(_0x1a27bd,null))['catch'](handleError(_0x1a27bd,null));};exports[_0xd8f9('0x71')]=function(_0x47aed5,_0x450a2a){return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')]({'where':{'id':_0x47aed5['params']['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x450a2a,null))[_0xd8f9('0x16')](function(_0x29ef71){if(_0x29ef71){return _0x29ef71[_0xd8f9('0x71')](_0x47aed5[_0xd8f9('0x30')][_0xd8f9('0x52')],_[_0xd8f9('0x72')](_0x47aed5[_0xd8f9('0x30')],[_0xd8f9('0x52'),'id'])||{})[_0xd8f9('0x73')](function(_0x4d74d8){for(var _0x2b2bfc=0x0;_0x2b2bfc<_0x47aed5[_0xd8f9('0x30')]['ids'][_0xd8f9('0x4e')];_0x2b2bfc+=0x1){socket['emit'](_0xd8f9('0x74'),{'UserId':Number(_0x47aed5[_0xd8f9('0x30')][_0xd8f9('0x52')][_0x2b2bfc]),'FaxQueueId':Number(_0x47aed5[_0xd8f9('0x28')]['id'])});}return _0x4d74d8;});}})[_0xd8f9('0x16')](respondWithResult(_0x450a2a,null))['catch'](handleError(_0x450a2a,null));};exports[_0xd8f9('0x6f')]=function(_0x2d59d4,_0x2f402a){return db[_0xd8f9('0x1f')][_0xd8f9('0x2e')]({'where':{'id':_0x2d59d4[_0xd8f9('0x28')]['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x2f402a,null))[_0xd8f9('0x16')](function(_0xf61375){if(_0xf61375){return _0xf61375[_0xd8f9('0x6f')](_0x2d59d4[_0xd8f9('0x25')][_0xd8f9('0x52')])[_0xd8f9('0x16')](function(){if(_[_0xd8f9('0x75')](_0x2d59d4[_0xd8f9('0x25')][_0xd8f9('0x52')])){for(var _0x1b4565=0x0;_0x1b4565<_0x2d59d4[_0xd8f9('0x25')]['ids'][_0xd8f9('0x4e')];_0x1b4565+=0x1){socket[_0xd8f9('0x5c')](_0xd8f9('0x70'),{'UserId':Number(_0x2d59d4[_0xd8f9('0x25')][_0xd8f9('0x52')][_0x1b4565]),'FaxQueueId':Number(_0x2d59d4[_0xd8f9('0x28')]['id'])});}}else{socket[_0xd8f9('0x5c')]('userFaxQueue:remove',{'UserId':Number(_0x2d59d4['query'][_0xd8f9('0x52')]),'FaxQueueId':Number(_0x2d59d4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2f402a,null))[_0xd8f9('0x27')](handleError(_0x2f402a,null));};exports['getAgents']=function(_0x426179,_0x15eebe){var _0x3859c7={};var _0x156f7c={};var _0x15b9f2;var _0x1b571d;return db[_0xd8f9('0x1f')]['findOne']({'where':{'id':_0x426179[_0xd8f9('0x28')]['id']}})[_0xd8f9('0x16')](handleEntityNotFound(_0x15eebe,null))[_0xd8f9('0x16')](function(_0x5f46e1){if(_0x5f46e1){_0x15b9f2=_0x5f46e1;_0x156f7c['model']=_[_0xd8f9('0x2a')](db[_0xd8f9('0x45')][_0xd8f9('0x20')]);_0x156f7c['query']=_['keys'](_0x426179['query']);_0x156f7c[_0xd8f9('0x3b')]=_[_0xd8f9('0x2c')](_0x156f7c['model'],_0x156f7c[_0xd8f9('0x25')]);_0x3859c7['attributes']=_['intersection'](_0x156f7c[_0xd8f9('0x29')],qs[_0xd8f9('0x2d')](_0x426179[_0xd8f9('0x25')][_0xd8f9('0x2d')]));_0x3859c7['attributes']=_0x3859c7[_0xd8f9('0x2b')][_0xd8f9('0x4e')]?_0x3859c7[_0xd8f9('0x2b')]:_0x156f7c[_0xd8f9('0x29')];_0x3859c7[_0xd8f9('0x3e')]=qs[_0xd8f9('0x3f')](_0x426179[_0xd8f9('0x25')]['sort']);_0x3859c7[_0xd8f9('0x40')]=qs[_0xd8f9('0x3b')](_['pick'](_0x426179['query'],_0x156f7c[_0xd8f9('0x3b')]));if(_0x426179[_0xd8f9('0x25')][_0xd8f9('0x4f')]){_0x3859c7[_0xd8f9('0x40')]=_[_0xd8f9('0x43')](_0x3859c7[_0xd8f9('0x40')],{'$or':_[_0xd8f9('0x1e')](_0x3859c7[_0xd8f9('0x2b')],function(_0x575871){var _0xbb8e1d={};_0xbb8e1d[_0x575871]={'$like':'%'+_0x426179[_0xd8f9('0x25')]['filter']+'%'};return _0xbb8e1d;})});}_0x3859c7=_[_0xd8f9('0x43')]({},_0x3859c7,_0x426179[_0xd8f9('0x44')]);return _0x15b9f2['getAgents'](_0x3859c7);}})[_0xd8f9('0x16')](function(_0x386930){if(_0x386930){_0x1b571d=_0x386930['length'];if(!_0x426179[_0xd8f9('0x25')][_0xd8f9('0x3c')](_0xd8f9('0x3d'))){_0x3859c7[_0xd8f9('0x10')]=qs['limit'](_0x426179[_0xd8f9('0x25')][_0xd8f9('0x10')]);_0x3859c7[_0xd8f9('0x12')]=qs[_0xd8f9('0x12')](_0x426179[_0xd8f9('0x25')][_0xd8f9('0x12')]);}return _0x15b9f2[_0xd8f9('0x76')](_0x3859c7);}})['then'](function(_0xa3d6b){if(_0xa3d6b){return _0xa3d6b?{'count':_0x1b571d,'rows':_0xa3d6b}:null;}})[_0xd8f9('0x16')](respondWithResult(_0x15eebe,null))[_0xd8f9('0x27')](handleError(_0x15eebe,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6cffa39..930addb 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 _0xa39b=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x419953,_0x37374c){var _0x176a18=function(_0x656d3f){while(--_0x656d3f){_0x419953['push'](_0x419953['shift']());}};_0x176a18(++_0x37374c);}(_0xa39b,0x18b));var _0xba39=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa39b[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xba39('0x0'));var FaxQueue=require(_0xba39('0x1'))['db'][_0xba39('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xba39('0x3')](0x0);var events={'afterCreate':_0xba39('0x4'),'afterUpdate':_0xba39('0x5'),'afterDestroy':_0xba39('0x6')};function emitEvent(_0x2fbe49){return function(_0x2ccee1,_0x53c270,_0x4ccd94){FaxQueueEvents[_0xba39('0x7')](_0x2fbe49+':'+_0x2ccee1['id'],_0x2ccee1);FaxQueueEvents[_0xba39('0x7')](_0x2fbe49,_0x2ccee1);_0x4ccd94(null);};}for(var e in events){if(events[_0xba39('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xba39('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x233b=['save','update','emit','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x53cbbd,_0x1f1d7a){var _0x45b7a4=function(_0x7a5384){while(--_0x7a5384){_0x53cbbd['push'](_0x53cbbd['shift']());}};_0x45b7a4(++_0x1f1d7a);}(_0x233b,0x1bd));var _0xb233=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x233b[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0xb233('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb233('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb233('0x2')](0x0);var events={'afterCreate':_0xb233('0x3'),'afterUpdate':_0xb233('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1cc39f){return function(_0x25f9cf,_0x198395,_0x104784){FaxQueueEvents[_0xb233('0x5')](_0x1cc39f+':'+_0x25f9cf['id'],_0x25f9cf);FaxQueueEvents[_0xb233('0x5')](_0x1cc39f,_0x25f9cf);_0x104784(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xb233('0x6')](e,emitEvent(event));}}module[_0xb233('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 52cfd62..947b5d4 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 _0x98c7=['fax_queues','lodash','util','../../config/logger','api','moment','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x34efa6,_0x343fe2){var _0x469490=function(_0xc1d725){while(--_0xc1d725){_0x34efa6['push'](_0x34efa6['shift']());}};_0x469490(++_0x343fe2);}(_0x98c7,0x15f));var _0x798c=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x98c7[_0x4e0b8c];return _0x633ecc;};'use strict';var _=require(_0x798c('0x0'));var util=require(_0x798c('0x1'));var logger=require(_0x798c('0x2'))(_0x798c('0x3'));var moment=require(_0x798c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x798c('0x5'));var config=require('../../config/environment');var attributes=require(_0x798c('0x6'));module['exports']=function(_0x2879b6,_0x32ee1d){return _0x2879b6[_0x798c('0x7')](_0x798c('0x8'),attributes,{'tableName':_0x798c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20af=['../../config/environment','./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x20af,0x1e4));var _0xf20a=function(_0x50eaa9,_0x35811b){_0x50eaa9=_0x50eaa9-0x0;var _0x4f03cb=_0x20af[_0x50eaa9];return _0x4f03cb;};'use strict';var _=require(_0xf20a('0x0'));var util=require(_0xf20a('0x1'));var logger=require(_0xf20a('0x2'))(_0xf20a('0x3'));var moment=require(_0xf20a('0x4'));var BPromise=require(_0xf20a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf20a('0x6'));var rimraf=require(_0xf20a('0x7'));var config=require(_0xf20a('0x8'));var attributes=require(_0xf20a('0x9'));module['exports']=function(_0x17efa0,_0x569228){return _0x17efa0['define'](_0xf20a('0xa'),attributes,{'tableName':_0xf20a('0xb'),'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 7744fbc..be68f57 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 _0x752d=['rpc','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes','include','map','model','debug','where','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x752d,0xfc));var _0xd752=function(_0x5da40d,_0x37e67f){_0x5da40d=_0x5da40d-0x0;var _0x568a5a=_0x752d[_0x5da40d];return _0x568a5a;};'use strict';var _=require(_0xd752('0x0'));var util=require(_0xd752('0x1'));var moment=require(_0xd752('0x2'));var BPromise=require(_0xd752('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd752('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd752('0x5'));var logger=require(_0xd752('0x6'))(_0xd752('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd752('0x8')][_0xd752('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd752('0xa')],{'host':_0xd752('0xb'),'port':0x18eb});var socket=require(_0xd752('0xc'))(new Redis(config[_0xd752('0xa')]));require(_0xd752('0xd'))[_0xd752('0xe')](socket);function respondWithRpcPromise(_0x28d169,_0x5b146e,_0x3f935e){return new BPromise(function(_0xae8b9,_0x1e23f1){return client[_0xd752('0xf')](_0x28d169,_0x3f935e)[_0xd752('0x10')](function(_0x1b201a){logger['info'](_0xd752('0x11'),_0x5b146e,_0xd752('0x12'));logger['debug'](_0xd752('0x13'),_0x5b146e,_0xd752('0x12'),JSON[_0xd752('0x14')](_0x1b201a));if(_0x1b201a['error']){if(_0x1b201a[_0xd752('0x15')]['code']===0x1f4){logger[_0xd752('0x15')](_0xd752('0x11'),_0x5b146e,_0x1b201a[_0xd752('0x15')][_0xd752('0x16')]);return _0x1e23f1(_0x1b201a[_0xd752('0x15')]['message']);}logger['error'](_0xd752('0x11'),_0x5b146e,_0x1b201a[_0xd752('0x15')]['message']);return _0xae8b9(_0x1b201a[_0xd752('0x15')][_0xd752('0x16')]);}else{logger[_0xd752('0x17')]('FaxQueue,\x20%s,\x20%s',_0x5b146e,'request\x20sent');_0xae8b9(_0x1b201a[_0xd752('0x18')][_0xd752('0x16')]);}})[_0xd752('0x19')](function(_0x35500a){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5b146e,_0x35500a);_0x1e23f1(_0x35500a);});});}exports[_0xd752('0x1a')]=function(_0x20f24f){var _0x59e13e=this;return new Promise(function(_0x28b26b,_0x1e4911){return db[_0xd752('0x1b')]['findAll']({'raw':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1d')]===undefined?!![]:![]:!![],'where':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')]['where']||null:null,'attributes':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1e')]||null:null,'limit':_0x20f24f['options']?_0x20f24f[_0xd752('0x1c')]['limit']||null:null,'include':_0x20f24f['options']?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1f')]?_[_0xd752('0x20')](_0x20f24f[_0xd752('0x1c')]['include'],function(_0x30c200){return{'model':db[_0x30c200[_0xd752('0x21')]],'as':_0x30c200['as'],'attributes':_0x30c200['attributes'],'include':_0x30c200[_0xd752('0x1f')]?_['map'](_0x30c200[_0xd752('0x1f')],function(_0x570070){return{'model':db[_0x570070[_0xd752('0x21')]],'as':_0x570070['as'],'attributes':_0x570070[_0xd752('0x1e')],'include':_0x570070['include']?_[_0xd752('0x20')](_0x570070[_0xd752('0x1f')],function(_0x260fbb){return{'model':db[_0x260fbb[_0xd752('0x21')]],'as':_0x260fbb['as'],'attributes':_0x260fbb[_0xd752('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd752('0x10')](function(_0x5cdc24){logger[_0xd752('0x17')](_0xd752('0x1a'),_0x20f24f);logger[_0xd752('0x22')](_0xd752('0x1a'),_0x20f24f,JSON[_0xd752('0x14')](_0x5cdc24));_0x28b26b(_0x5cdc24);})['catch'](function(_0x315369){logger['error'](_0xd752('0x1a'),_0x315369['message'],_0x20f24f);_0x1e4911(_0x59e13e[_0xd752('0x15')](0x1f4,_0x315369[_0xd752('0x16')]));});});};exports['ShowFaxQueue']=function(_0x2eca90){var _0x3da0fa=this;return new Promise(function(_0x4c4cf6,_0x1ff764){return db[_0xd752('0x1b')]['find']({'raw':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1d')]===undefined?!![]:![]:!![],'where':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x23')]||null:null,'attributes':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1e')]||null:null,'include':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1f')]?_[_0xd752('0x20')](_0x2eca90[_0xd752('0x1c')]['include'],function(_0x3eaa3f){return{'model':db[_0x3eaa3f[_0xd752('0x21')]],'as':_0x3eaa3f['as'],'attributes':_0x3eaa3f[_0xd752('0x1e')],'include':_0x3eaa3f[_0xd752('0x1f')]?_[_0xd752('0x20')](_0x3eaa3f['include'],function(_0x3b1a62){return{'model':db[_0x3b1a62[_0xd752('0x21')]],'as':_0x3b1a62['as'],'attributes':_0x3b1a62[_0xd752('0x1e')],'include':_0x3b1a62['include']?_[_0xd752('0x20')](_0x3b1a62[_0xd752('0x1f')],function(_0x150a38){return{'model':db[_0x150a38['model']],'as':_0x150a38['as'],'attributes':_0x150a38[_0xd752('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd752('0x10')](function(_0xfaedd6){logger[_0xd752('0x17')]('ShowFaxQueue',_0x2eca90);logger[_0xd752('0x22')](_0xd752('0x24'),_0x2eca90,JSON[_0xd752('0x14')](_0xfaedd6));_0x4c4cf6(_0xfaedd6);})[_0xd752('0x19')](function(_0x3d3694){logger[_0xd752('0x15')](_0xd752('0x24'),_0x3d3694[_0xd752('0x16')],_0x2eca90);_0x1ff764(_0x3da0fa[_0xd752('0x15')](0x1f4,_0x3d3694[_0xd752('0x16')]));});});}; \ No newline at end of file +var _0x9c7b=['where','attributes','limit','include','map','model','GetFaxQueue','debug','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','raw'];(function(_0x4c04d5,_0x27149f){var _0x5cb8f3=function(_0x3f789c){while(--_0x3f789c){_0x4c04d5['push'](_0x4c04d5['shift']());}};_0x5cb8f3(++_0x27149f);}(_0x9c7b,0x1c6));var _0xb9c7=function(_0x54ab77,_0x1f1b2a){_0x54ab77=_0x54ab77-0x0;var _0x37e586=_0x9c7b[_0x54ab77];return _0x37e586;};'use strict';var _=require(_0xb9c7('0x0'));var util=require(_0xb9c7('0x1'));var moment=require(_0xb9c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9c7('0x3'));var fs=require('fs');var Redis=require(_0xb9c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb9c7('0x5'))(_0xb9c7('0x6'));var config=require(_0xb9c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9c7('0x8')][_0xb9c7('0x9')]({'port':0x232a});config['redis']=_[_0xb9c7('0xa')](config['redis'],{'host':_0xb9c7('0xb'),'port':0x18eb});var socket=require(_0xb9c7('0xc'))(new Redis(config[_0xb9c7('0xd')]));require(_0xb9c7('0xe'))['register'](socket);function respondWithRpcPromise(_0x361fd2,_0x5c0273,_0x22febd){return new BPromise(function(_0x35b445,_0x965cdc){return client['request'](_0x361fd2,_0x22febd)[_0xb9c7('0xf')](function(_0x2d6ecd){logger[_0xb9c7('0x10')](_0xb9c7('0x11'),_0x5c0273,'request\x20sent');logger['debug'](_0xb9c7('0x12'),_0x5c0273,_0xb9c7('0x13'),JSON[_0xb9c7('0x14')](_0x2d6ecd));if(_0x2d6ecd[_0xb9c7('0x15')]){if(_0x2d6ecd[_0xb9c7('0x15')][_0xb9c7('0x16')]===0x1f4){logger[_0xb9c7('0x15')]('FaxQueue,\x20%s,\x20%s',_0x5c0273,_0x2d6ecd['error'][_0xb9c7('0x17')]);return _0x965cdc(_0x2d6ecd[_0xb9c7('0x15')]['message']);}logger[_0xb9c7('0x15')]('FaxQueue,\x20%s,\x20%s',_0x5c0273,_0x2d6ecd[_0xb9c7('0x15')]['message']);return _0x35b445(_0x2d6ecd['error'][_0xb9c7('0x17')]);}else{logger[_0xb9c7('0x10')](_0xb9c7('0x11'),_0x5c0273,_0xb9c7('0x13'));_0x35b445(_0x2d6ecd['result']['message']);}})[_0xb9c7('0x18')](function(_0x5935e4){logger['error'](_0xb9c7('0x11'),_0x5c0273,_0x5935e4);_0x965cdc(_0x5935e4);});});}exports['GetFaxQueue']=function(_0x3dcf5c){var _0x158983=this;return new Promise(function(_0x227ba1,_0x244840){return db['FaxQueue']['findAll']({'raw':_0x3dcf5c['options']?_0x3dcf5c[_0xb9c7('0x19')][_0xb9c7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dcf5c[_0xb9c7('0x19')]?_0x3dcf5c[_0xb9c7('0x19')][_0xb9c7('0x1b')]||null:null,'attributes':_0x3dcf5c[_0xb9c7('0x19')]?_0x3dcf5c[_0xb9c7('0x19')][_0xb9c7('0x1c')]||null:null,'limit':_0x3dcf5c[_0xb9c7('0x19')]?_0x3dcf5c['options'][_0xb9c7('0x1d')]||null:null,'include':_0x3dcf5c[_0xb9c7('0x19')]?_0x3dcf5c[_0xb9c7('0x19')][_0xb9c7('0x1e')]?_[_0xb9c7('0x1f')](_0x3dcf5c[_0xb9c7('0x19')]['include'],function(_0x7de397){return{'model':db[_0x7de397['model']],'as':_0x7de397['as'],'attributes':_0x7de397[_0xb9c7('0x1c')],'include':_0x7de397[_0xb9c7('0x1e')]?_['map'](_0x7de397[_0xb9c7('0x1e')],function(_0x472aaf){return{'model':db[_0x472aaf[_0xb9c7('0x20')]],'as':_0x472aaf['as'],'attributes':_0x472aaf[_0xb9c7('0x1c')],'include':_0x472aaf[_0xb9c7('0x1e')]?_['map'](_0x472aaf['include'],function(_0x9e26e6){return{'model':db[_0x9e26e6[_0xb9c7('0x20')]],'as':_0x9e26e6['as'],'attributes':_0x9e26e6[_0xb9c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb9c7('0xf')](function(_0x5804fb){logger['info'](_0xb9c7('0x21'),_0x3dcf5c);logger[_0xb9c7('0x22')]('GetFaxQueue',_0x3dcf5c,JSON[_0xb9c7('0x14')](_0x5804fb));_0x227ba1(_0x5804fb);})[_0xb9c7('0x18')](function(_0x79ebed){logger[_0xb9c7('0x15')](_0xb9c7('0x21'),_0x79ebed[_0xb9c7('0x17')],_0x3dcf5c);_0x244840(_0x158983[_0xb9c7('0x15')](0x1f4,_0x79ebed[_0xb9c7('0x17')]));});});};exports[_0xb9c7('0x23')]=function(_0x4f990f){var _0x1216d3=this;return new Promise(function(_0x4d9bfb,_0x59ec26){return db['FaxQueue'][_0xb9c7('0x24')]({'raw':_0x4f990f[_0xb9c7('0x19')]?_0x4f990f['options'][_0xb9c7('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f990f[_0xb9c7('0x19')]?_0x4f990f[_0xb9c7('0x19')][_0xb9c7('0x1b')]||null:null,'attributes':_0x4f990f[_0xb9c7('0x19')]?_0x4f990f[_0xb9c7('0x19')]['attributes']||null:null,'include':_0x4f990f[_0xb9c7('0x19')]?_0x4f990f[_0xb9c7('0x19')][_0xb9c7('0x1e')]?_['map'](_0x4f990f['options'][_0xb9c7('0x1e')],function(_0x50785b){return{'model':db[_0x50785b['model']],'as':_0x50785b['as'],'attributes':_0x50785b[_0xb9c7('0x1c')],'include':_0x50785b[_0xb9c7('0x1e')]?_[_0xb9c7('0x1f')](_0x50785b[_0xb9c7('0x1e')],function(_0x5442f6){return{'model':db[_0x5442f6[_0xb9c7('0x20')]],'as':_0x5442f6['as'],'attributes':_0x5442f6['attributes'],'include':_0x5442f6[_0xb9c7('0x1e')]?_[_0xb9c7('0x1f')](_0x5442f6['include'],function(_0x2ae783){return{'model':db[_0x2ae783[_0xb9c7('0x20')]],'as':_0x2ae783['as'],'attributes':_0x2ae783[_0xb9c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb9c7('0xf')](function(_0x256c8b){logger[_0xb9c7('0x10')](_0xb9c7('0x23'),_0x4f990f);logger[_0xb9c7('0x22')](_0xb9c7('0x23'),_0x4f990f,JSON['stringify'](_0x256c8b));_0x4d9bfb(_0x256c8b);})[_0xb9c7('0x18')](function(_0x40de13){logger[_0xb9c7('0x15')]('ShowFaxQueue',_0x40de13[_0xb9c7('0x17')],_0x4f990f);_0x59ec26(_0x1216d3['error'](0x1f4,_0x40de13[_0xb9c7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1874124..c2a753d 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 _0x1641=['register','length','faxQueue:','./faxQueue.events','save','remove','emit','removeListener'];(function(_0x5b4d27,_0x6145a4){var _0x5f429b=function(_0x16fbe6){while(--_0x16fbe6){_0x5b4d27['push'](_0x5b4d27['shift']());}};_0x5f429b(++_0x6145a4);}(_0x1641,0x153));var _0x1164=function(_0x50f177,_0x36c061){_0x50f177=_0x50f177-0x0;var _0x16da60=_0x1641[_0x50f177];return _0x16da60;};'use strict';var FaxQueueEvents=require(_0x1164('0x0'));var events=[_0x1164('0x1'),_0x1164('0x2'),'update'];function createListener(_0x9fcffe,_0x2ffaf6){return function(_0x1b8a72){_0x2ffaf6[_0x1164('0x3')](_0x9fcffe,_0x1b8a72);};}function removeListener(_0x27e41e,_0x281ac1){return function(){FaxQueueEvents[_0x1164('0x4')](_0x27e41e,_0x281ac1);};}exports[_0x1164('0x5')]=function(_0x3ad2f9){for(var _0x2b616c=0x0,_0x1f69d3=events[_0x1164('0x6')];_0x2b616c<_0x1f69d3;_0x2b616c++){var _0x3ab2b9=events[_0x2b616c];var _0xe3c4ec=createListener(_0x1164('0x7')+_0x3ab2b9,_0x3ad2f9);FaxQueueEvents['on'](_0x3ab2b9,_0xe3c4ec);}}; \ No newline at end of file +var _0xf3aa=['emit','length','./faxQueue.events','remove','update'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xf3aa,0x16a));var _0xaf3a=function(_0x20aae1,_0x51efd4){_0x20aae1=_0x20aae1-0x0;var _0x510601=_0xf3aa[_0x20aae1];return _0x510601;};'use strict';var FaxQueueEvents=require(_0xaf3a('0x0'));var events=['save',_0xaf3a('0x1'),_0xaf3a('0x2')];function createListener(_0x2c415f,_0x439b8f){return function(_0x2021b3){_0x439b8f[_0xaf3a('0x3')](_0x2c415f,_0x2021b3);};}function removeListener(_0x4184a1,_0x584ac4){return function(){FaxQueueEvents['removeListener'](_0x4184a1,_0x584ac4);};}exports['register']=function(_0x199f0f){for(var _0x3a4daa=0x0,_0x3789f6=events[_0xaf3a('0x4')];_0x3a4daa<_0x3789f6;_0x3a4daa++){var _0x5553d7=events[_0x3a4daa];var _0x4c3b60=createListener('faxQueue:'+_0x5553d7,_0x199f0f);FaxQueueEvents['on'](_0x5553d7,_0x4c3b60);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 383e09c..4eb88d4 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 _0x6c45=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout'];(function(_0xad3674,_0x4f92a6){var _0x4bb610=function(_0x3af295){while(--_0x3af295){_0xad3674['push'](_0xad3674['shift']());}};_0x4bb610(++_0x4f92a6);}(_0x6c45,0xb1));var _0x56c4=function(_0x4b14b7,_0x290d16){_0x4b14b7=_0x4b14b7-0x0;var _0x412314=_0x6c45[_0x4b14b7];return _0x412314;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var fs_extra=require(_0x56c4('0x5'));var auth=require(_0x56c4('0x6'));var interaction=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var controller=require(_0x56c4('0x9'));router[_0x56c4('0xa')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0xc')]);router[_0x56c4('0xa')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0xe')]);router[_0x56c4('0xa')](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x10')]);router[_0x56c4('0xa')]('/:id/members',auth[_0x56c4('0xb')](),controller[_0x56c4('0x11')]);router[_0x56c4('0xa')](_0x56c4('0x12'),auth['isAuthenticated'](),controller[_0x56c4('0x13')]);router[_0x56c4('0xa')](_0x56c4('0x14'),auth[_0x56c4('0xb')](),controller['getAgents']);router[_0x56c4('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x56c4('0x15')](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x16')]);router[_0x56c4('0x15')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x17')]);router['put'](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x18')]);router[_0x56c4('0x19')]('/:id',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1a')]);router['delete'](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x1b')]);router[_0x56c4('0x19')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1c')]);module[_0x56c4('0x1d')]=router; \ No newline at end of file +var _0x6365=['../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','getTeams','/:id/users','getAgents','create','/:id/teams','addAgents','put','/:id','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xffedaf,_0x3f8f0d){var _0x31dc47=function(_0x271f49){while(--_0x271f49){_0xffedaf['push'](_0xffedaf['shift']());}};_0x31dc47(++_0x3f8f0d);}(_0x6365,0x148));var _0x5636=function(_0x831580,_0x417134){_0x831580=_0x831580-0x0;var _0x98bdac=_0x6365[_0x831580];return _0x98bdac;};'use strict';var multer=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var path=require(_0x5636('0x2'));var timeout=require(_0x5636('0x3'));var express=require('express');var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var controller=require('./faxQueue.controller');router[_0x5636('0x9')]('/',auth[_0x5636('0xa')](),controller[_0x5636('0xb')]);router[_0x5636('0x9')]('/describe',auth[_0x5636('0xa')](),controller[_0x5636('0xc')]);router['get']('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0xd')]);router[_0x5636('0x9')](_0x5636('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x5636('0x9')]('/:id/teams',auth[_0x5636('0xa')](),controller[_0x5636('0xf')]);router[_0x5636('0x9')](_0x5636('0x10'),auth[_0x5636('0xa')](),controller[_0x5636('0x11')]);router['post']('/',auth[_0x5636('0xa')](),controller[_0x5636('0x12')]);router['post'](_0x5636('0x13'),auth[_0x5636('0xa')](),controller['addTeams']);router['post'](_0x5636('0x10'),auth[_0x5636('0xa')](),controller[_0x5636('0x14')]);router[_0x5636('0x15')](_0x5636('0x16'),auth['isAuthenticated'](),controller[_0x5636('0x17')]);router['delete']('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0x18')]);router[_0x5636('0x19')](_0x5636('0x13'),auth[_0x5636('0xa')](),controller[_0x5636('0x1a')]);router[_0x5636('0x19')](_0x5636('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5636('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1783da4..6154154 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 _0x2888=['exports','STRING','DATE','moment','sequelize'];(function(_0x3b28a0,_0x12b276){var _0x3de84a=function(_0x17a826){while(--_0x17a826){_0x3b28a0['push'](_0x3b28a0['shift']());}};_0x3de84a(++_0x12b276);}(_0x2888,0x102));var _0x8288=function(_0x18b1d1,_0x47d888){_0x18b1d1=_0x18b1d1-0x0;var _0x5c5ba5=_0x2888[_0x18b1d1];return _0x5c5ba5;};'use strict';var moment=require(_0x8288('0x0'));var Sequelize=require(_0x8288('0x1'));module[_0x8288('0x2')]={'uniqueid':{'type':Sequelize[_0x8288('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8288('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8288('0x4')]},'acceptAt':{'type':Sequelize[_0x8288('0x4')]},'exitAt':{'type':Sequelize[_0x8288('0x4')]},'reason':{'type':Sequelize[_0x8288('0x3')]}}; \ No newline at end of file +var _0x1e92=['exports','DATE','STRING','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1e92,0x1df));var _0x21e9=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x1e92[_0x5608a3];return _0x1ed50a;};'use strict';var moment=require(_0x21e9('0x0'));var Sequelize=require('sequelize');module[_0x21e9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x21e9('0x2')]},'leaveAt':{'type':Sequelize[_0x21e9('0x2')]},'acceptAt':{'type':Sequelize[_0x21e9('0x2')]},'exitAt':{'type':Sequelize[_0x21e9('0x2')]},'reason':{'type':Sequelize[_0x21e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 69b3a7c..2dfe44d 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 _0x3f59=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','find','create','body','catch','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x3f59,0x1b0));var _0x93f5=function(_0x595044,_0x983086){_0x595044=_0x595044-0x0;var _0x55f0be=_0x3f59[_0x595044];return _0x55f0be;};'use strict';var emlformat=require(_0x93f5('0x0'));var rimraf=require(_0x93f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93f5('0x2'));var rp=require(_0x93f5('0x3'));var moment=require(_0x93f5('0x4'));var BPromise=require(_0x93f5('0x5'));var Mustache=require(_0x93f5('0x6'));var util=require(_0x93f5('0x7'));var path=require(_0x93f5('0x8'));var sox=require(_0x93f5('0x9'));var csv=require(_0x93f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93f5('0xb'));var squel=require(_0x93f5('0xc'));var crypto=require(_0x93f5('0xd'));var jsforce=require(_0x93f5('0xe'));var deskjs=require(_0x93f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f5('0x14'));var config=require(_0x93f5('0x15'));var licenseUtil=require(_0x93f5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x789645,_0x4ea7b4){_0x4ea7b4=_0x4ea7b4||0xcc;return function(_0x3e7e84){if(_0x3e7e84){return _0x789645[_0x93f5('0x17')](_0x4ea7b4);}return _0x789645[_0x93f5('0x18')](_0x4ea7b4)[_0x93f5('0x19')]();};}function respondWithResult(_0x3d85da,_0x45a275){_0x45a275=_0x45a275||0xc8;return function(_0x5d6001){if(_0x5d6001){return _0x3d85da[_0x93f5('0x18')](_0x45a275)[_0x93f5('0x1a')](_0x5d6001);}};}function respondWithFilteredResult(_0xe145df,_0x2ab5ce){return function(_0x316fb2){if(_0x316fb2){var _0x22bcd7=typeof _0x2ab5ce[_0x93f5('0x1b')]===_0x93f5('0x1c')&&typeof _0x2ab5ce[_0x93f5('0x1d')]===_0x93f5('0x1c');var _0x46a05d=_0x316fb2[_0x93f5('0x1e')];var _0x4df4ec=_0x22bcd7?0x0:_0x2ab5ce[_0x93f5('0x1b')];var _0x3180f2=_0x22bcd7?_0x316fb2[_0x93f5('0x1e')]:_0x2ab5ce[_0x93f5('0x1b')]+_0x2ab5ce[_0x93f5('0x1d')];var _0x569c0c;if(_0x3180f2>=_0x46a05d){_0x3180f2=_0x46a05d;_0x569c0c=0xc8;}else{_0x569c0c=0xce;}_0xe145df[_0x93f5('0x18')](_0x569c0c);return _0xe145df[_0x93f5('0x1f')](_0x93f5('0x20'),_0x4df4ec+'-'+_0x3180f2+'/'+_0x46a05d)[_0x93f5('0x1a')](_0x316fb2);}return null;};}function patchUpdates(_0x3fc4ab){return function(_0xb44720){try{jsonpatch[_0x93f5('0x21')](_0xb44720,_0x3fc4ab,!![]);}catch(_0x257aa8){return BPromise[_0x93f5('0x22')](_0x257aa8);}return _0xb44720[_0x93f5('0x23')]();};}function saveUpdates(_0x2ef296,_0xb59065){return function(_0x330869){if(_0x330869){return _0x330869['update'](_0x2ef296)[_0x93f5('0x24')](function(_0x27bde4){return _0x27bde4;});}return null;};}function removeEntity(_0x34f8ce,_0x3ffe51){return function(_0x365afd){if(_0x365afd){return _0x365afd[_0x93f5('0x25')]()['then'](function(){_0x34f8ce[_0x93f5('0x18')](0xcc)[_0x93f5('0x19')]();});}};}function handleEntityNotFound(_0x54955f,_0x107d91){return function(_0x43fad9){if(!_0x43fad9){_0x54955f['sendStatus'](0x194);}return _0x43fad9;};}function handleError(_0x5bb7d3,_0x403b45){_0x403b45=_0x403b45||0x1f4;return function(_0x11e86c){logger[_0x93f5('0x26')](_0x11e86c[_0x93f5('0x27')]);if(_0x11e86c['name']){delete _0x11e86c[_0x93f5('0x28')];}_0x5bb7d3['status'](_0x403b45)[_0x93f5('0x29')](_0x11e86c);};}exports[_0x93f5('0x2a')]=function(_0x56d867,_0x36d579){var _0x95e47e={},_0x136dc4={},_0x5e5cb5={'count':0x0,'rows':[]};var _0x3090a9=_['map'](db[_0x93f5('0x2b')]['rawAttributes'],function(_0x448b5a){return{'name':_0x448b5a[_0x93f5('0x2c')],'type':_0x448b5a['type'][_0x93f5('0x2d')]};});_0x136dc4[_0x93f5('0x2e')]=_[_0x93f5('0x2f')](_0x3090a9,_0x93f5('0x28'));_0x136dc4['query']=_[_0x93f5('0x30')](_0x56d867['query']);_0x136dc4[_0x93f5('0x31')]=_['intersection'](_0x136dc4[_0x93f5('0x2e')],_0x136dc4[_0x93f5('0x32')]);_0x95e47e[_0x93f5('0x33')]=_[_0x93f5('0x34')](_0x136dc4['model'],qs[_0x93f5('0x35')](_0x56d867[_0x93f5('0x32')][_0x93f5('0x35')]));_0x95e47e[_0x93f5('0x33')]=_0x95e47e['attributes'][_0x93f5('0x36')]?_0x95e47e['attributes']:_0x136dc4[_0x93f5('0x2e')];if(!_0x56d867[_0x93f5('0x32')][_0x93f5('0x37')](_0x93f5('0x38'))){_0x95e47e['limit']=qs[_0x93f5('0x1d')](_0x56d867['query'][_0x93f5('0x1d')]);_0x95e47e['offset']=qs['offset'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x1b')]);}_0x95e47e[_0x93f5('0x39')]=qs['sort'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x3a')]);_0x95e47e['where']=qs[_0x93f5('0x31')](_['pick'](_0x56d867[_0x93f5('0x32')],_0x136dc4['filters']),_0x3090a9);if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x3b')]){_0x95e47e[_0x93f5('0x3c')]=_[_0x93f5('0x3d')](_0x95e47e[_0x93f5('0x3c')],{'$or':_['map'](_0x3090a9,function(_0x246f8e){if(_0x246f8e[_0x93f5('0x3e')]!==_0x93f5('0x3f')){var _0x2c7e9b={};_0x2c7e9b[_0x246f8e[_0x93f5('0x28')]]={'$like':'%'+_0x56d867[_0x93f5('0x32')]['filter']+'%'};return _0x2c7e9b;}})});}_0x95e47e=_[_0x93f5('0x3d')]({},_0x95e47e,_0x56d867[_0x93f5('0x40')]);var _0x421a4f={'where':_0x95e47e[_0x93f5('0x3c')]};return db[_0x93f5('0x2b')][_0x93f5('0x1e')](_0x421a4f)['then'](function(_0x2e86bd){_0x5e5cb5['count']=_0x2e86bd;if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x41')]){_0x95e47e['include']=[{'all':!![]}];}return db[_0x93f5('0x2b')][_0x93f5('0x42')](_0x95e47e);})[_0x93f5('0x24')](function(_0x136e51){_0x5e5cb5['rows']=_0x136e51;return _0x5e5cb5;})[_0x93f5('0x24')](respondWithFilteredResult(_0x36d579,_0x95e47e))['catch'](handleError(_0x36d579,null));};exports[_0x93f5('0x43')]=function(_0x465fd4,_0x283261){var _0x24d2dc={'raw':!![],'where':{'id':_0x465fd4[_0x93f5('0x44')]['id']}},_0xd4d915={};_0xd4d915[_0x93f5('0x2e')]=_['keys'](db[_0x93f5('0x2b')][_0x93f5('0x45')]);_0xd4d915[_0x93f5('0x32')]=_[_0x93f5('0x30')](_0x465fd4[_0x93f5('0x32')]);_0xd4d915[_0x93f5('0x31')]=_[_0x93f5('0x34')](_0xd4d915[_0x93f5('0x2e')],_0xd4d915['query']);_0x24d2dc['attributes']=_[_0x93f5('0x34')](_0xd4d915['model'],qs[_0x93f5('0x35')](_0x465fd4['query'][_0x93f5('0x35')]));_0x24d2dc[_0x93f5('0x33')]=_0x24d2dc['attributes']['length']?_0x24d2dc[_0x93f5('0x33')]:_0xd4d915['model'];if(_0x465fd4[_0x93f5('0x32')][_0x93f5('0x41')]){_0x24d2dc['include']=[{'all':!![]}];}_0x24d2dc=_[_0x93f5('0x3d')]({},_0x24d2dc,_0x465fd4[_0x93f5('0x40')]);return db[_0x93f5('0x2b')][_0x93f5('0x46')](_0x24d2dc)['then'](handleEntityNotFound(_0x283261,null))[_0x93f5('0x24')](respondWithResult(_0x283261,null))['catch'](handleError(_0x283261,null));};exports[_0x93f5('0x47')]=function(_0x1af1c1,_0x548ee2){return db['FaxQueueReport'][_0x93f5('0x47')](_0x1af1c1[_0x93f5('0x48')],{})['then'](respondWithResult(_0x548ee2,0xc9))[_0x93f5('0x49')](handleError(_0x548ee2,null));};exports[_0x93f5('0x4a')]=function(_0xad4687,_0x576500){if(_0xad4687['body']['id']){delete _0xad4687[_0x93f5('0x48')]['id'];}return db[_0x93f5('0x2b')]['find']({'where':{'id':_0xad4687[_0x93f5('0x44')]['id']}})['then'](handleEntityNotFound(_0x576500,null))[_0x93f5('0x24')](saveUpdates(_0xad4687[_0x93f5('0x48')],null))[_0x93f5('0x24')](respondWithResult(_0x576500,null))[_0x93f5('0x49')](handleError(_0x576500,null));};exports[_0x93f5('0x25')]=function(_0x2e5524,_0x970bcf){return db[_0x93f5('0x2b')][_0x93f5('0x46')]({'where':{'id':_0x2e5524[_0x93f5('0x44')]['id']}})[_0x93f5('0x24')](handleEntityNotFound(_0x970bcf,null))[_0x93f5('0x24')](removeEntity(_0x970bcf,null))[_0x93f5('0x49')](handleError(_0x970bcf,null));};exports[_0x93f5('0x4b')]=function(_0x24b55b,_0xd2d30a){return db[_0x93f5('0x2b')][_0x93f5('0x4b')]()[_0x93f5('0x24')](respondWithResult(_0xd2d30a,null))['catch'](handleError(_0xd2d30a,null));}; \ No newline at end of file +var _0xa1b9=['update','then','destroy','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save'];(function(_0x2201b3,_0x1fc757){var _0x4951e7=function(_0x8da7bd){while(--_0x8da7bd){_0x2201b3['push'](_0x2201b3['shift']());}};_0x4951e7(++_0x1fc757);}(_0xa1b9,0x71));var _0x9a1b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa1b9[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){_0x37971c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0ff3,_0x52fce9){return function(_0x17704b){if(!_0x17704b){_0x3b0ff3['sendStatus'](0x194);}return _0x17704b;};}function handleError(_0x5e65ce,_0x48e736){_0x48e736=_0x48e736||0x1f4;return function(_0x432a3d){logger['error'](_0x432a3d[_0x9a1b('0x28')]);if(_0x432a3d[_0x9a1b('0x29')]){delete _0x432a3d[_0x9a1b('0x29')];}_0x5e65ce[_0x9a1b('0x1b')](_0x48e736)[_0x9a1b('0x2a')](_0x432a3d);};}exports[_0x9a1b('0x2b')]=function(_0x1c13d6,_0x1453c4){var _0x4070aa={},_0x2d9ca8={},_0x56f3e8={'count':0x0,'rows':[]};var _0x5735a4=_[_0x9a1b('0x2c')](db[_0x9a1b('0x2d')]['rawAttributes'],function(_0x14ea6b){return{'name':_0x14ea6b[_0x9a1b('0x2e')],'type':_0x14ea6b[_0x9a1b('0x2f')][_0x9a1b('0x30')]};});_0x2d9ca8[_0x9a1b('0x31')]=_[_0x9a1b('0x2c')](_0x5735a4,_0x9a1b('0x29'));_0x2d9ca8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x1c13d6['query']);_0x2d9ca8[_0x9a1b('0x34')]=_['intersection'](_0x2d9ca8[_0x9a1b('0x31')],_0x2d9ca8[_0x9a1b('0x32')]);_0x4070aa[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x2d9ca8['model'],qs[_0x9a1b('0x37')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x37')]));_0x4070aa[_0x9a1b('0x35')]=_0x4070aa[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x4070aa[_0x9a1b('0x35')]:_0x2d9ca8[_0x9a1b('0x31')];if(!_0x1c13d6[_0x9a1b('0x32')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x4070aa[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x1f')]);_0x4070aa[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x1c13d6['query'][_0x9a1b('0x21')]);}_0x4070aa[_0x9a1b('0x3a')]=qs[_0x9a1b('0x3b')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3b')]);_0x4070aa[_0x9a1b('0x3c')]=qs[_0x9a1b('0x34')](_[_0x9a1b('0x3d')](_0x1c13d6[_0x9a1b('0x32')],_0x2d9ca8['filters']),_0x5735a4);if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]){_0x4070aa['where']=_[_0x9a1b('0x3f')](_0x4070aa[_0x9a1b('0x3c')],{'$or':_['map'](_0x5735a4,function(_0x47bf8e){if(_0x47bf8e['type']!==_0x9a1b('0x40')){var _0x2adbb9={};_0x2adbb9[_0x47bf8e[_0x9a1b('0x29')]]={'$like':'%'+_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]+'%'};return _0x2adbb9;}})});}_0x4070aa=_['merge']({},_0x4070aa,_0x1c13d6[_0x9a1b('0x41')]);var _0xfa7f44={'where':_0x4070aa[_0x9a1b('0x3c')]};return db[_0x9a1b('0x2d')][_0x9a1b('0x20')](_0xfa7f44)[_0x9a1b('0x26')](function(_0x2faeeb){_0x56f3e8['count']=_0x2faeeb;if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x42')]){_0x4070aa['include']=[{'all':!![]}];}return db[_0x9a1b('0x2d')][_0x9a1b('0x43')](_0x4070aa);})[_0x9a1b('0x26')](function(_0x69c499){_0x56f3e8['rows']=_0x69c499;return _0x56f3e8;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x1453c4,_0x4070aa))[_0x9a1b('0x44')](handleError(_0x1453c4,null));};exports[_0x9a1b('0x45')]=function(_0x3ddcf6,_0x1863d8){var _0x18a606={'raw':!![],'where':{'id':_0x3ddcf6[_0x9a1b('0x46')]['id']}},_0x515bb8={};_0x515bb8[_0x9a1b('0x31')]=_[_0x9a1b('0x33')](db['FaxQueueReport'][_0x9a1b('0x47')]);_0x515bb8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x3ddcf6[_0x9a1b('0x32')]);_0x515bb8[_0x9a1b('0x34')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],_0x515bb8['query']);_0x18a606[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],qs[_0x9a1b('0x37')](_0x3ddcf6['query'][_0x9a1b('0x37')]));_0x18a606[_0x9a1b('0x35')]=_0x18a606[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x18a606[_0x9a1b('0x35')]:_0x515bb8[_0x9a1b('0x31')];if(_0x3ddcf6[_0x9a1b('0x32')]['includeAll']){_0x18a606['include']=[{'all':!![]}];}_0x18a606=_[_0x9a1b('0x3f')]({},_0x18a606,_0x3ddcf6[_0x9a1b('0x41')]);return db['FaxQueueReport'][_0x9a1b('0x48')](_0x18a606)[_0x9a1b('0x26')](handleEntityNotFound(_0x1863d8,null))[_0x9a1b('0x26')](respondWithResult(_0x1863d8,null))['catch'](handleError(_0x1863d8,null));};exports['create']=function(_0x4a98c1,_0x31b879){return db[_0x9a1b('0x2d')]['create'](_0x4a98c1[_0x9a1b('0x49')],{})[_0x9a1b('0x26')](respondWithResult(_0x31b879,0xc9))['catch'](handleError(_0x31b879,null));};exports['update']=function(_0x23e3b8,_0x2ff4b5){if(_0x23e3b8['body']['id']){delete _0x23e3b8[_0x9a1b('0x49')]['id'];}return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x23e3b8[_0x9a1b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ff4b5,null))['then'](saveUpdates(_0x23e3b8['body'],null))[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,null))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x27')]=function(_0x3f9c17,_0x1a608a){return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x3f9c17[_0x9a1b('0x46')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x1a608a,null))[_0x9a1b('0x26')](removeEntity(_0x1a608a,null))[_0x9a1b('0x44')](handleError(_0x1a608a,null));};exports[_0x9a1b('0x4a')]=function(_0x719389,_0x2bc22a){return db['FaxQueueReport']['describe']()[_0x9a1b('0x26')](respondWithResult(_0x2bc22a,null))[_0x9a1b('0x44')](handleError(_0x2bc22a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9ee1071..cf3fdbd 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x39e0c7,_0x260935){var _0x5c0c22=function(_0xfc4fae){while(--_0xfc4fae){_0x39e0c7['push'](_0x39e0c7['shift']());}};_0x5c0c22(++_0x260935);}(_0x1261,0x144));var _0x1126=function(_0x161f85,_0x1b1968){_0x161f85=_0x161f85-0x0;var _0x3f98ad=_0x1261[_0x161f85];return _0x3f98ad;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x2d05b,_0x128281){var _0x17d14c=function(_0x1fe495){while(--_0x1fe495){_0x2d05b['push'](_0x2d05b['shift']());}};_0x17d14c(++_0x128281);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2a5718c..5337c84 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 _0x0998=['jayson/promise','http','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','update','where','attributes','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e31d9,_0x296191){var _0x29f4ca=function(_0x4f2668){while(--_0x4f2668){_0x1e31d9['push'](_0x1e31d9['shift']());}};_0x29f4ca(++_0x296191);}(_0x0998,0x1b8));var _0x8099=function(_0x4d4d5d,_0xe3af6e){_0x4d4d5d=_0x4d4d5d-0x0;var _0x6e3b96=_0x0998[_0x4d4d5d];return _0x6e3b96;};'use strict';var _=require(_0x8099('0x0'));var util=require('util');var moment=require(_0x8099('0x1'));var BPromise=require(_0x8099('0x2'));var rs=require(_0x8099('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8099('0x4'))['db'];var utils=require(_0x8099('0x5'));var logger=require(_0x8099('0x6'))(_0x8099('0x7'));var config=require('../../config/environment');var jayson=require(_0x8099('0x8'));var client=jayson['client'][_0x8099('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ee5e,_0x3e5eb9,_0x499e31){return new BPromise(function(_0x37801c,_0x32fd92){return client['request'](_0x23ee5e,_0x499e31)['then'](function(_0x21feb2){logger[_0x8099('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x8099('0xb'));logger[_0x8099('0xc')](_0x8099('0xd'),_0x3e5eb9,_0x8099('0xb'),JSON[_0x8099('0xe')](_0x21feb2));if(_0x21feb2[_0x8099('0xf')]){if(_0x21feb2['error'][_0x8099('0x10')]===0x1f4){logger[_0x8099('0xf')](_0x8099('0x11'),_0x3e5eb9,_0x21feb2['error'][_0x8099('0x12')]);return _0x32fd92(_0x21feb2[_0x8099('0xf')]['message']);}logger[_0x8099('0xf')](_0x8099('0x11'),_0x3e5eb9,_0x21feb2[_0x8099('0xf')][_0x8099('0x12')]);return _0x37801c(_0x21feb2[_0x8099('0xf')]['message']);}else{logger[_0x8099('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x8099('0xb'));_0x37801c(_0x21feb2[_0x8099('0x13')]['message']);}})[_0x8099('0x14')](function(_0x38070b){logger[_0x8099('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x38070b);_0x32fd92(_0x38070b);});});}exports['CreateFaxQueueReport']=function(_0x3c9f7a){var _0x5b3c79=this;return new Promise(function(_0x58c234,_0x32a48b){return db[_0x8099('0x15')][_0x8099('0x16')](_0x3c9f7a[_0x8099('0x17')],{'raw':_0x3c9f7a[_0x8099('0x18')]?_0x3c9f7a['options'][_0x8099('0x19')]===undefined?!![]:![]:!![]})[_0x8099('0x1a')](function(_0x53984a){logger[_0x8099('0xa')](_0x8099('0x1b'),_0x3c9f7a);logger[_0x8099('0xc')]('CreateFaxQueueReport',_0x3c9f7a,JSON['stringify'](_0x53984a));_0x58c234(_0x53984a);})['catch'](function(_0x1c5195){logger[_0x8099('0xf')](_0x8099('0x1b'),_0x1c5195['message'],_0x3c9f7a);_0x32a48b(_0x5b3c79[_0x8099('0xf')](0x1f4,_0x1c5195['message']));});});};exports['UpdateFaxQueueReport']=function(_0x48d325){var _0x3a64af=this;return new Promise(function(_0x34bff3,_0x4ea3a1){return db[_0x8099('0x15')][_0x8099('0x1c')](_0x48d325[_0x8099('0x17')],{'raw':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x1d')]||null:null,'attributes':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x1e')]||null:null,'limit':_0x48d325['options']?_0x48d325['options']['limit']||null:null})[_0x8099('0x1a')](function(_0x5e6650){logger['info'](_0x8099('0x1f'),_0x48d325);logger[_0x8099('0xc')](_0x8099('0x1f'),_0x48d325,JSON['stringify'](_0x5e6650));_0x34bff3(_0x5e6650);})['catch'](function(_0x5deac9){logger[_0x8099('0xf')]('UpdateFaxQueueReport',_0x5deac9[_0x8099('0x12')],_0x48d325);_0x4ea3a1(_0x3a64af['error'](0x1f4,_0x5deac9[_0x8099('0x12')]));});});}; \ No newline at end of file +var _0xa706=['limit','UpdateFaxQueueReport','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','FaxQueueReport','body','options','raw','CreateFaxQueueReport','update','where'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa706,0xc6));var _0x6a70=function(_0x4f480c,_0xd2e33){_0x4f480c=_0x4f480c-0x0;var _0x202d7d=_0xa706[_0x4f480c];return _0x202d7d;};'use strict';var _=require(_0x6a70('0x0'));var util=require('util');var moment=require(_0x6a70('0x1'));var BPromise=require(_0x6a70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a70('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a70('0x4'));var logger=require(_0x6a70('0x5'))(_0x6a70('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a70('0x7'));var client=jayson[_0x6a70('0x8')][_0x6a70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ff972,_0x1fac23,_0x458f56){return new BPromise(function(_0x4896ee,_0x91fff){return client['request'](_0x3ff972,_0x458f56)[_0x6a70('0xa')](function(_0x53130f){logger[_0x6a70('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1fac23,_0x6a70('0xc'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1fac23,_0x6a70('0xc'),JSON[_0x6a70('0xd')](_0x53130f));if(_0x53130f[_0x6a70('0xe')]){if(_0x53130f[_0x6a70('0xe')][_0x6a70('0xf')]===0x1f4){logger[_0x6a70('0xe')](_0x6a70('0x10'),_0x1fac23,_0x53130f[_0x6a70('0xe')][_0x6a70('0x11')]);return _0x91fff(_0x53130f[_0x6a70('0xe')][_0x6a70('0x11')]);}logger[_0x6a70('0xe')](_0x6a70('0x10'),_0x1fac23,_0x53130f[_0x6a70('0xe')][_0x6a70('0x11')]);return _0x4896ee(_0x53130f[_0x6a70('0xe')]['message']);}else{logger[_0x6a70('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1fac23,'request\x20sent');_0x4896ee(_0x53130f[_0x6a70('0x12')][_0x6a70('0x11')]);}})['catch'](function(_0xba5536){logger['error'](_0x6a70('0x10'),_0x1fac23,_0xba5536);_0x91fff(_0xba5536);});});}exports['CreateFaxQueueReport']=function(_0x2c13af){var _0x19d5b3=this;return new Promise(function(_0x446976,_0x4f3219){return db[_0x6a70('0x13')]['create'](_0x2c13af[_0x6a70('0x14')],{'raw':_0x2c13af[_0x6a70('0x15')]?_0x2c13af['options'][_0x6a70('0x16')]===undefined?!![]:![]:!![]})[_0x6a70('0xa')](function(_0x4c37e7){logger[_0x6a70('0xb')](_0x6a70('0x17'),_0x2c13af);logger['debug']('CreateFaxQueueReport',_0x2c13af,JSON[_0x6a70('0xd')](_0x4c37e7));_0x446976(_0x4c37e7);})['catch'](function(_0x324259){logger[_0x6a70('0xe')]('CreateFaxQueueReport',_0x324259[_0x6a70('0x11')],_0x2c13af);_0x4f3219(_0x19d5b3[_0x6a70('0xe')](0x1f4,_0x324259[_0x6a70('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x2d4f28){var _0x5bcb33=this;return new Promise(function(_0x1a61be,_0x5eb952){return db[_0x6a70('0x13')][_0x6a70('0x18')](_0x2d4f28[_0x6a70('0x14')],{'raw':_0x2d4f28[_0x6a70('0x15')]?_0x2d4f28['options'][_0x6a70('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d4f28[_0x6a70('0x15')]?_0x2d4f28['options'][_0x6a70('0x19')]||null:null,'attributes':_0x2d4f28[_0x6a70('0x15')]?_0x2d4f28['options']['attributes']||null:null,'limit':_0x2d4f28[_0x6a70('0x15')]?_0x2d4f28[_0x6a70('0x15')][_0x6a70('0x1a')]||null:null})[_0x6a70('0xa')](function(_0x73f917){logger['info'](_0x6a70('0x1b'),_0x2d4f28);logger['debug'](_0x6a70('0x1b'),_0x2d4f28,JSON[_0x6a70('0xd')](_0x73f917));_0x1a61be(_0x73f917);})['catch'](function(_0x10295a){logger[_0x6a70('0xe')](_0x6a70('0x1b'),_0x10295a[_0x6a70('0x11')],_0x2d4f28);_0x5eb952(_0x5bcb33['error'](0x1f4,_0x10295a[_0x6a70('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f75d104..4751c29 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 _0x81c8=['update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x38e49b,_0x155520){var _0xfce9e0=function(_0x4e2eaa){while(--_0x4e2eaa){_0x38e49b['push'](_0x38e49b['shift']());}};_0xfce9e0(++_0x155520);}(_0x81c8,0x17f));var _0x881c=function(_0x30c169,_0x27e104){_0x30c169=_0x30c169-0x0;var _0x24bbc5=_0x81c8[_0x30c169];return _0x24bbc5;};'use strict';var multer=require(_0x881c('0x0'));var util=require('util');var path=require(_0x881c('0x1'));var timeout=require(_0x881c('0x2'));var express=require('express');var router=express[_0x881c('0x3')]();var fs_extra=require(_0x881c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x881c('0x5'));var config=require(_0x881c('0x6'));var controller=require(_0x881c('0x7'));router[_0x881c('0x8')]('/',auth[_0x881c('0x9')](),controller['index']);router[_0x881c('0x8')](_0x881c('0xa'),auth['isAuthenticated'](),controller[_0x881c('0xb')]);router['get'](_0x881c('0xc'),auth[_0x881c('0x9')](),controller[_0x881c('0xd')]);router[_0x881c('0xe')]('/',auth[_0x881c('0x9')](),controller[_0x881c('0xf')]);router[_0x881c('0x10')](_0x881c('0xc'),auth[_0x881c('0x9')](),controller[_0x881c('0x11')]);router[_0x881c('0x12')](_0x881c('0xc'),auth[_0x881c('0x9')](),controller['destroy']);module[_0x881c('0x13')]=router; \ No newline at end of file +var _0x1ec6=['index','describe','/:id','show','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1b85bc,_0x508e82){var _0x43c63d=function(_0xd1b911){while(--_0xd1b911){_0x1b85bc['push'](_0x1b85bc['shift']());}};_0x43c63d(++_0x508e82);}(_0x1ec6,0x171));var _0x61ec=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x1ec6[_0x5805d7];return _0x170fe4;};'use strict';var multer=require('multer');var util=require(_0x61ec('0x0'));var path=require(_0x61ec('0x1'));var timeout=require(_0x61ec('0x2'));var express=require(_0x61ec('0x3'));var router=express[_0x61ec('0x4')]();var fs_extra=require(_0x61ec('0x5'));var auth=require(_0x61ec('0x6'));var interaction=require(_0x61ec('0x7'));var config=require(_0x61ec('0x8'));var controller=require('./faxQueueReport.controller');router[_0x61ec('0x9')]('/',auth[_0x61ec('0xa')](),controller[_0x61ec('0xb')]);router[_0x61ec('0x9')]('/describe',auth[_0x61ec('0xa')](),controller[_0x61ec('0xc')]);router[_0x61ec('0x9')](_0x61ec('0xd'),auth[_0x61ec('0xa')](),controller[_0x61ec('0xe')]);router['post']('/',auth[_0x61ec('0xa')](),controller[_0x61ec('0xf')]);router['put'](_0x61ec('0xd'),auth[_0x61ec('0xa')](),controller[_0x61ec('0x10')]);router['delete'](_0x61ec('0xd'),auth[_0x61ec('0xa')](),controller[_0x61ec('0x11')]);module[_0x61ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 76fa19f..502e4b8 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ac43f,_0x34794a){var _0x55531c=function(_0x4c2fe1){while(--_0x4c2fe1){_0x2ac43f['push'](_0x2ac43f['shift']());}};_0x55531c(++_0x34794a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x26adda,_0x5415e9){var _0x3fc8ea=function(_0x504602){while(--_0x504602){_0x26adda['push'](_0x26adda['shift']());}};_0x3fc8ea(++_0x5415e9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x15577b,_0x314223){_0x15577b=_0x15577b-0x0;var _0x384743=_0xf4eb[_0x15577b];return _0x384743;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 435d92b..94df21c 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 _0x670c=['error','stack','name','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','FaxTransferReport','include','findAll','rows','show','params','rawAttributes','length','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x25fcf7,_0x306546){var _0x29f3fd=function(_0x2ebc61){while(--_0x2ebc61){_0x25fcf7['push'](_0x25fcf7['shift']());}};_0x29f3fd(++_0x306546);}(_0x670c,0x1a2));var _0xc670=function(_0x311f87,_0x35a0e0){_0x311f87=_0x311f87-0x0;var _0x23eccb=_0x670c[_0x311f87];return _0x23eccb;};'use strict';var emlformat=require(_0xc670('0x0'));var rimraf=require(_0xc670('0x1'));var zipdir=require(_0xc670('0x2'));var jsonpatch=require(_0xc670('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc670('0x4'));var Mustache=require('mustache');var util=require(_0xc670('0x5'));var path=require('path');var sox=require(_0xc670('0x6'));var csv=require(_0xc670('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc670('0x8'));var _=require('lodash');var squel=require(_0xc670('0x9'));var crypto=require(_0xc670('0xa'));var jsforce=require(_0xc670('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc670('0x7'));var querystring=require(_0xc670('0xc'));var Papa=require('papaparse');var Redis=require(_0xc670('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc670('0xe'));var as=require(_0xc670('0xf'));var hardwareService=require(_0xc670('0x10'));var logger=require(_0xc670('0x11'))(_0xc670('0x12'));var utils=require('../../config/utils');var config=require(_0xc670('0x13'));var licenseUtil=require(_0xc670('0x14'));var db=require(_0xc670('0x15'))['db'];function respondWithStatusCode(_0x4266f1,_0x26442b){_0x26442b=_0x26442b||0xcc;return function(_0x30faaa){if(_0x30faaa){return _0x4266f1[_0xc670('0x16')](_0x26442b);}return _0x4266f1[_0xc670('0x17')](_0x26442b)[_0xc670('0x18')]();};}function respondWithResult(_0x4c755f,_0x24330b){_0x24330b=_0x24330b||0xc8;return function(_0x160c81){if(_0x160c81){return _0x4c755f[_0xc670('0x17')](_0x24330b)[_0xc670('0x19')](_0x160c81);}};}function respondWithFilteredResult(_0x3df6ef,_0x9ea5ac){return function(_0x8e0ed8){if(_0x8e0ed8){var _0x5b8ed4=typeof _0x9ea5ac[_0xc670('0x1a')]==='undefined'&&typeof _0x9ea5ac[_0xc670('0x1b')]===_0xc670('0x1c');var _0x47a428=_0x8e0ed8[_0xc670('0x1d')];var _0x3d71ae=_0x5b8ed4?0x0:_0x9ea5ac[_0xc670('0x1a')];var _0x948716=_0x5b8ed4?_0x8e0ed8['count']:_0x9ea5ac['offset']+_0x9ea5ac[_0xc670('0x1b')];var _0x181304;if(_0x948716>=_0x47a428){_0x948716=_0x47a428;_0x181304=0xc8;}else{_0x181304=0xce;}_0x3df6ef[_0xc670('0x17')](_0x181304);return _0x3df6ef[_0xc670('0x1e')](_0xc670('0x1f'),_0x3d71ae+'-'+_0x948716+'/'+_0x47a428)[_0xc670('0x19')](_0x8e0ed8);}return null;};}function patchUpdates(_0x344659){return function(_0x5aa8aa){try{jsonpatch[_0xc670('0x20')](_0x5aa8aa,_0x344659,!![]);}catch(_0x5010b2){return BPromise[_0xc670('0x21')](_0x5010b2);}return _0x5aa8aa[_0xc670('0x22')]();};}function saveUpdates(_0x435a98,_0xec7f75){return function(_0x4aed99){if(_0x4aed99){return _0x4aed99[_0xc670('0x23')](_0x435a98)[_0xc670('0x24')](function(_0x49dcbf){return _0x49dcbf;});}return null;};}function removeEntity(_0x1e5bef,_0x82d412){return function(_0x29d9e9){if(_0x29d9e9){return _0x29d9e9[_0xc670('0x25')]()[_0xc670('0x24')](function(){_0x1e5bef[_0xc670('0x17')](0xcc)[_0xc670('0x18')]();});}};}function handleEntityNotFound(_0x339395,_0x27d6db){return function(_0x14ae27){if(!_0x14ae27){_0x339395['sendStatus'](0x194);}return _0x14ae27;};}function handleError(_0x271ed3,_0x5ca8d2){_0x5ca8d2=_0x5ca8d2||0x1f4;return function(_0x283384){logger[_0xc670('0x26')](_0x283384[_0xc670('0x27')]);if(_0x283384[_0xc670('0x28')]){delete _0x283384[_0xc670('0x28')];}_0x271ed3[_0xc670('0x17')](_0x5ca8d2)[_0xc670('0x29')](_0x283384);};}exports[_0xc670('0x2a')]=function(_0x27739e,_0x481daa){var _0x1ce34e={},_0x1ae0a4={},_0x2ccf93={'count':0x0,'rows':[]};var _0xde84c5=_[_0xc670('0x2b')](db['FaxTransferReport']['rawAttributes'],function(_0x344138){return{'name':_0x344138[_0xc670('0x2c')],'type':_0x344138[_0xc670('0x2d')]['key']};});_0x1ae0a4[_0xc670('0x2e')]=_[_0xc670('0x2b')](_0xde84c5,'name');_0x1ae0a4['query']=_[_0xc670('0x2f')](_0x27739e[_0xc670('0x30')]);_0x1ae0a4['filters']=_[_0xc670('0x31')](_0x1ae0a4['model'],_0x1ae0a4['query']);_0x1ce34e[_0xc670('0x32')]=_[_0xc670('0x31')](_0x1ae0a4['model'],qs[_0xc670('0x33')](_0x27739e[_0xc670('0x30')][_0xc670('0x33')]));_0x1ce34e[_0xc670('0x32')]=_0x1ce34e['attributes']['length']?_0x1ce34e['attributes']:_0x1ae0a4['model'];if(!_0x27739e['query']['hasOwnProperty'](_0xc670('0x34'))){_0x1ce34e['limit']=qs[_0xc670('0x1b')](_0x27739e[_0xc670('0x30')][_0xc670('0x1b')]);_0x1ce34e[_0xc670('0x1a')]=qs[_0xc670('0x1a')](_0x27739e[_0xc670('0x30')][_0xc670('0x1a')]);}_0x1ce34e[_0xc670('0x35')]=qs[_0xc670('0x36')](_0x27739e[_0xc670('0x30')]['sort']);_0x1ce34e[_0xc670('0x37')]=qs['filters'](_[_0xc670('0x38')](_0x27739e[_0xc670('0x30')],_0x1ae0a4[_0xc670('0x39')]),_0xde84c5);if(_0x27739e[_0xc670('0x30')][_0xc670('0x3a')]){_0x1ce34e[_0xc670('0x37')]=_['merge'](_0x1ce34e['where'],{'$or':_[_0xc670('0x2b')](_0xde84c5,function(_0x1aadc8){if(_0x1aadc8[_0xc670('0x2d')]!==_0xc670('0x3b')){var _0x421681={};_0x421681[_0x1aadc8[_0xc670('0x28')]]={'$like':'%'+_0x27739e[_0xc670('0x30')]['filter']+'%'};return _0x421681;}})});}_0x1ce34e=_[_0xc670('0x3c')]({},_0x1ce34e,_0x27739e[_0xc670('0x3d')]);var _0x57e6e6={'where':_0x1ce34e['where']};return db[_0xc670('0x3e')][_0xc670('0x1d')](_0x57e6e6)[_0xc670('0x24')](function(_0x452a7b){_0x2ccf93['count']=_0x452a7b;if(_0x27739e[_0xc670('0x30')]['includeAll']){_0x1ce34e[_0xc670('0x3f')]=[{'all':!![]}];}return db[_0xc670('0x3e')][_0xc670('0x40')](_0x1ce34e);})['then'](function(_0x3a4227){_0x2ccf93[_0xc670('0x41')]=_0x3a4227;return _0x2ccf93;})[_0xc670('0x24')](respondWithFilteredResult(_0x481daa,_0x1ce34e))['catch'](handleError(_0x481daa,null));};exports[_0xc670('0x42')]=function(_0x5e16c6,_0x4af128){var _0x53972f={'raw':!![],'where':{'id':_0x5e16c6[_0xc670('0x43')]['id']}},_0xbd5c59={};_0xbd5c59['model']=_[_0xc670('0x2f')](db['FaxTransferReport'][_0xc670('0x44')]);_0xbd5c59[_0xc670('0x30')]=_[_0xc670('0x2f')](_0x5e16c6[_0xc670('0x30')]);_0xbd5c59[_0xc670('0x39')]=_['intersection'](_0xbd5c59[_0xc670('0x2e')],_0xbd5c59['query']);_0x53972f['attributes']=_['intersection'](_0xbd5c59['model'],qs[_0xc670('0x33')](_0x5e16c6[_0xc670('0x30')][_0xc670('0x33')]));_0x53972f[_0xc670('0x32')]=_0x53972f[_0xc670('0x32')][_0xc670('0x45')]?_0x53972f[_0xc670('0x32')]:_0xbd5c59[_0xc670('0x2e')];if(_0x5e16c6[_0xc670('0x30')][_0xc670('0x46')]){_0x53972f[_0xc670('0x3f')]=[{'all':!![]}];}_0x53972f=_[_0xc670('0x3c')]({},_0x53972f,_0x5e16c6[_0xc670('0x3d')]);return db['FaxTransferReport']['find'](_0x53972f)[_0xc670('0x24')](handleEntityNotFound(_0x4af128,null))[_0xc670('0x24')](respondWithResult(_0x4af128,null))[_0xc670('0x47')](handleError(_0x4af128,null));};exports[_0xc670('0x48')]=function(_0x5110eb,_0x43979d){return db[_0xc670('0x3e')][_0xc670('0x48')](_0x5110eb[_0xc670('0x49')],{})[_0xc670('0x24')](respondWithResult(_0x43979d,0xc9))[_0xc670('0x47')](handleError(_0x43979d,null));};exports['update']=function(_0x54f977,_0x1d4652){if(_0x54f977['body']['id']){delete _0x54f977[_0xc670('0x49')]['id'];}return db[_0xc670('0x3e')][_0xc670('0x4a')]({'where':{'id':_0x54f977[_0xc670('0x43')]['id']}})[_0xc670('0x24')](handleEntityNotFound(_0x1d4652,null))[_0xc670('0x24')](saveUpdates(_0x54f977[_0xc670('0x49')],null))[_0xc670('0x24')](respondWithResult(_0x1d4652,null))[_0xc670('0x47')](handleError(_0x1d4652,null));};exports[_0xc670('0x25')]=function(_0x4d903d,_0x3f8819){return db[_0xc670('0x3e')][_0xc670('0x4a')]({'where':{'id':_0x4d903d[_0xc670('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f8819,null))[_0xc670('0x24')](removeEntity(_0x3f8819,null))[_0xc670('0x47')](handleError(_0x3f8819,null));};exports[_0xc670('0x4b')]=function(_0x1c1f17,_0x574ded){return db['FaxTransferReport']['describe']()[_0xc670('0x24')](respondWithResult(_0x574ded,null))[_0xc670('0x47')](handleError(_0x574ded,null));}; \ No newline at end of file +var _0x9926=['count','set','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','limit','undefined'];(function(_0x46ce21,_0x254327){var _0x4901ba=function(_0x528f1c){while(--_0x528f1c){_0x46ce21['push'](_0x46ce21['shift']());}};_0x4901ba(++_0x254327);}(_0x9926,0x70));var _0x6992=function(_0x399657,_0x242da7){_0x399657=_0x399657-0x0;var _0x377892=_0x9926[_0x399657];return _0x377892;};'use strict';var emlformat=require(_0x6992('0x0'));var rimraf=require(_0x6992('0x1'));var zipdir=require(_0x6992('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6992('0x3'));var moment=require(_0x6992('0x4'));var BPromise=require(_0x6992('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6992('0x6'));var sox=require('sox');var csv=require(_0x6992('0x7'));var ejs=require(_0x6992('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6992('0x9'));var squel=require(_0x6992('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6992('0xb'));var Papa=require(_0x6992('0xc'));var Redis=require(_0x6992('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6992('0xe'));var as=require(_0x6992('0xf'));var hardwareService=require(_0x6992('0x10'));var logger=require(_0x6992('0x11'))(_0x6992('0x12'));var utils=require(_0x6992('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6992('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260479,_0x1a5cb6){_0x1a5cb6=_0x1a5cb6||0xcc;return function(_0x4f10e0){if(_0x4f10e0){return _0x260479['sendStatus'](_0x1a5cb6);}return _0x260479[_0x6992('0x15')](_0x1a5cb6)['end']();};}function respondWithResult(_0x24fef4,_0x55e70f){_0x55e70f=_0x55e70f||0xc8;return function(_0x291b8d){if(_0x291b8d){return _0x24fef4[_0x6992('0x15')](_0x55e70f)[_0x6992('0x16')](_0x291b8d);}};}function respondWithFilteredResult(_0x22ca2d,_0x73ddab){return function(_0x49813b){if(_0x49813b){var _0x4d12a4=typeof _0x73ddab[_0x6992('0x17')]==='undefined'&&typeof _0x73ddab[_0x6992('0x18')]===_0x6992('0x19');var _0x2e6a83=_0x49813b[_0x6992('0x1a')];var _0x59ffcb=_0x4d12a4?0x0:_0x73ddab[_0x6992('0x17')];var _0x13e4fd=_0x4d12a4?_0x49813b[_0x6992('0x1a')]:_0x73ddab[_0x6992('0x17')]+_0x73ddab[_0x6992('0x18')];var _0x259a92;if(_0x13e4fd>=_0x2e6a83){_0x13e4fd=_0x2e6a83;_0x259a92=0xc8;}else{_0x259a92=0xce;}_0x22ca2d[_0x6992('0x15')](_0x259a92);return _0x22ca2d[_0x6992('0x1b')]('Content-Range',_0x59ffcb+'-'+_0x13e4fd+'/'+_0x2e6a83)['json'](_0x49813b);}return null;};}function patchUpdates(_0x5ad574){return function(_0x41943d){try{jsonpatch['apply'](_0x41943d,_0x5ad574,!![]);}catch(_0xcaa12){return BPromise[_0x6992('0x1c')](_0xcaa12);}return _0x41943d['save']();};}function saveUpdates(_0x1d94a9,_0x47992f){return function(_0xfe5692){if(_0xfe5692){return _0xfe5692[_0x6992('0x1d')](_0x1d94a9)[_0x6992('0x1e')](function(_0x3a9b46){return _0x3a9b46;});}return null;};}function removeEntity(_0x48acae,_0x412551){return function(_0x1c2078){if(_0x1c2078){return _0x1c2078[_0x6992('0x1f')]()['then'](function(){_0x48acae[_0x6992('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a22be,_0x46e6c1){return function(_0x4a54f5){if(!_0x4a54f5){_0x1a22be[_0x6992('0x20')](0x194);}return _0x4a54f5;};}function handleError(_0x54907f,_0x513eb3){_0x513eb3=_0x513eb3||0x1f4;return function(_0x49cc95){logger[_0x6992('0x21')](_0x49cc95[_0x6992('0x22')]);if(_0x49cc95[_0x6992('0x23')]){delete _0x49cc95['name'];}_0x54907f[_0x6992('0x15')](_0x513eb3)[_0x6992('0x24')](_0x49cc95);};}exports[_0x6992('0x25')]=function(_0x336072,_0x12442e){var _0x316cd5={},_0x3f33ed={},_0x304ef9={'count':0x0,'rows':[]};var _0x3ce8dc=_[_0x6992('0x26')](db[_0x6992('0x27')][_0x6992('0x28')],function(_0x2ffe8e){return{'name':_0x2ffe8e[_0x6992('0x29')],'type':_0x2ffe8e[_0x6992('0x2a')][_0x6992('0x2b')]};});_0x3f33ed[_0x6992('0x2c')]=_[_0x6992('0x26')](_0x3ce8dc,_0x6992('0x23'));_0x3f33ed[_0x6992('0x2d')]=_[_0x6992('0x2e')](_0x336072[_0x6992('0x2d')]);_0x3f33ed[_0x6992('0x2f')]=_[_0x6992('0x30')](_0x3f33ed[_0x6992('0x2c')],_0x3f33ed[_0x6992('0x2d')]);_0x316cd5[_0x6992('0x31')]=_['intersection'](_0x3f33ed[_0x6992('0x2c')],qs[_0x6992('0x32')](_0x336072[_0x6992('0x2d')][_0x6992('0x32')]));_0x316cd5[_0x6992('0x31')]=_0x316cd5[_0x6992('0x31')][_0x6992('0x33')]?_0x316cd5[_0x6992('0x31')]:_0x3f33ed[_0x6992('0x2c')];if(!_0x336072[_0x6992('0x2d')]['hasOwnProperty'](_0x6992('0x34'))){_0x316cd5[_0x6992('0x18')]=qs[_0x6992('0x18')](_0x336072[_0x6992('0x2d')][_0x6992('0x18')]);_0x316cd5['offset']=qs['offset'](_0x336072[_0x6992('0x2d')][_0x6992('0x17')]);}_0x316cd5['order']=qs[_0x6992('0x35')](_0x336072[_0x6992('0x2d')][_0x6992('0x35')]);_0x316cd5[_0x6992('0x36')]=qs['filters'](_[_0x6992('0x37')](_0x336072[_0x6992('0x2d')],_0x3f33ed['filters']),_0x3ce8dc);if(_0x336072[_0x6992('0x2d')][_0x6992('0x38')]){_0x316cd5['where']=_['merge'](_0x316cd5[_0x6992('0x36')],{'$or':_['map'](_0x3ce8dc,function(_0x1dcc8e){if(_0x1dcc8e[_0x6992('0x2a')]!==_0x6992('0x39')){var _0x5aedfa={};_0x5aedfa[_0x1dcc8e[_0x6992('0x23')]]={'$like':'%'+_0x336072[_0x6992('0x2d')][_0x6992('0x38')]+'%'};return _0x5aedfa;}})});}_0x316cd5=_['merge']({},_0x316cd5,_0x336072['options']);var _0x1390f0={'where':_0x316cd5[_0x6992('0x36')]};return db[_0x6992('0x27')]['count'](_0x1390f0)[_0x6992('0x1e')](function(_0x6daa7a){_0x304ef9[_0x6992('0x1a')]=_0x6daa7a;if(_0x336072[_0x6992('0x2d')][_0x6992('0x3a')]){_0x316cd5[_0x6992('0x3b')]=[{'all':!![]}];}return db[_0x6992('0x27')]['findAll'](_0x316cd5);})['then'](function(_0x2ff986){_0x304ef9[_0x6992('0x3c')]=_0x2ff986;return _0x304ef9;})[_0x6992('0x1e')](respondWithFilteredResult(_0x12442e,_0x316cd5))[_0x6992('0x3d')](handleError(_0x12442e,null));};exports[_0x6992('0x3e')]=function(_0x891b71,_0x6990e0){var _0x2d19a5={'raw':!![],'where':{'id':_0x891b71[_0x6992('0x3f')]['id']}},_0x448ca3={};_0x448ca3[_0x6992('0x2c')]=_[_0x6992('0x2e')](db[_0x6992('0x27')][_0x6992('0x28')]);_0x448ca3[_0x6992('0x2d')]=_[_0x6992('0x2e')](_0x891b71[_0x6992('0x2d')]);_0x448ca3[_0x6992('0x2f')]=_[_0x6992('0x30')](_0x448ca3[_0x6992('0x2c')],_0x448ca3[_0x6992('0x2d')]);_0x2d19a5['attributes']=_[_0x6992('0x30')](_0x448ca3['model'],qs[_0x6992('0x32')](_0x891b71[_0x6992('0x2d')][_0x6992('0x32')]));_0x2d19a5[_0x6992('0x31')]=_0x2d19a5[_0x6992('0x31')][_0x6992('0x33')]?_0x2d19a5[_0x6992('0x31')]:_0x448ca3['model'];if(_0x891b71[_0x6992('0x2d')]['includeAll']){_0x2d19a5['include']=[{'all':!![]}];}_0x2d19a5=_[_0x6992('0x40')]({},_0x2d19a5,_0x891b71['options']);return db[_0x6992('0x27')][_0x6992('0x41')](_0x2d19a5)[_0x6992('0x1e')](handleEntityNotFound(_0x6990e0,null))['then'](respondWithResult(_0x6990e0,null))[_0x6992('0x3d')](handleError(_0x6990e0,null));};exports['create']=function(_0x54f84a,_0x5e49c6){return db[_0x6992('0x27')][_0x6992('0x42')](_0x54f84a[_0x6992('0x43')],{})[_0x6992('0x1e')](respondWithResult(_0x5e49c6,0xc9))[_0x6992('0x3d')](handleError(_0x5e49c6,null));};exports['update']=function(_0x539371,_0x577930){if(_0x539371[_0x6992('0x43')]['id']){delete _0x539371['body']['id'];}return db['FaxTransferReport'][_0x6992('0x41')]({'where':{'id':_0x539371['params']['id']}})[_0x6992('0x1e')](handleEntityNotFound(_0x577930,null))[_0x6992('0x1e')](saveUpdates(_0x539371['body'],null))[_0x6992('0x1e')](respondWithResult(_0x577930,null))[_0x6992('0x3d')](handleError(_0x577930,null));};exports['destroy']=function(_0xd0aa7c,_0x561584){return db[_0x6992('0x27')][_0x6992('0x41')]({'where':{'id':_0xd0aa7c[_0x6992('0x3f')]['id']}})[_0x6992('0x1e')](handleEntityNotFound(_0x561584,null))['then'](removeEntity(_0x561584,null))['catch'](handleError(_0x561584,null));};exports[_0x6992('0x44')]=function(_0x2eb6ee,_0x209498){return db[_0x6992('0x27')][_0x6992('0x44')]()[_0x6992('0x1e')](respondWithResult(_0x209498,null))[_0x6992('0x3d')](handleError(_0x209498,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7832f23..1755a2f 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 _0x7dff=['bluebird','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x3109e6,_0x4f9a6d){var _0x4f5bf1=function(_0x783d4b){while(--_0x783d4b){_0x3109e6['push'](_0x3109e6['shift']());}};_0x4f5bf1(++_0x4f9a6d);}(_0x7dff,0x75));var _0xf7df=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7dff[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xf7df('0x0'));var util=require('util');var logger=require(_0xf7df('0x1'))('api');var moment=require(_0xf7df('0x2'));var BPromise=require(_0xf7df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7df('0x4'));var rimraf=require(_0xf7df('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7df('0x6'));module[_0xf7df('0x7')]=function(_0x1a49b7,_0x45b1b8){return _0x1a49b7[_0xf7df('0x8')](_0xf7df('0x9'),attributes,{'tableName':_0xf7df('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf7df('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e5a=['util','../../config/logger','api','moment','request-promise','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x55cf0a,_0x547793){var _0x367227=function(_0xf06910){while(--_0xf06910){_0x55cf0a['push'](_0x55cf0a['shift']());}};_0x367227(++_0x547793);}(_0x1e5a,0xb5));var _0xa1e5=function(_0x58f8a7,_0xbd36a7){_0x58f8a7=_0x58f8a7-0x0;var _0x149b97=_0x1e5a[_0x58f8a7];return _0x149b97;};'use strict';var _=require(_0xa1e5('0x0'));var util=require(_0xa1e5('0x1'));var logger=require(_0xa1e5('0x2'))(_0xa1e5('0x3'));var moment=require(_0xa1e5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1e5('0x5'));var fs=require('fs');var path=require(_0xa1e5('0x6'));var rimraf=require(_0xa1e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1e5('0x8'));module['exports']=function(_0x40845b,_0x41236a){return _0x40845b[_0xa1e5('0x9')](_0xa1e5('0xa'),attributes,{'tableName':_0xa1e5('0xb'),'paranoid':![],'indexes':[{'name':_0xa1e5('0xc'),'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 c8fa9bf..e3c8241 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 _0x0fd6=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4aedbc,_0x301199){var _0x24d4dc=function(_0x46e939){while(--_0x46e939){_0x4aedbc['push'](_0x4aedbc['shift']());}};_0x24d4dc(++_0x301199);}(_0x0fd6,0xc7));var _0x60fd=function(_0x4fbd07,_0x385ad4){_0x4fbd07=_0x4fbd07-0x0;var _0x307836=_0x0fd6[_0x4fbd07];return _0x307836;};'use strict';var _=require(_0x60fd('0x0'));var util=require(_0x60fd('0x1'));var moment=require('moment');var BPromise=require(_0x60fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60fd('0x3'))['db'];var utils=require(_0x60fd('0x4'));var logger=require(_0x60fd('0x5'))('rpc');var config=require(_0x60fd('0x6'));var jayson=require(_0x60fd('0x7'));var client=jayson['client'][_0x60fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b8952,_0x566322,_0x33cbc9){return new BPromise(function(_0x3e4ada,_0x56084c){return client[_0x60fd('0x9')](_0x2b8952,_0x33cbc9)['then'](function(_0x46f05b){logger[_0x60fd('0xa')](_0x60fd('0xb'),_0x566322,_0x60fd('0xc'));logger['debug'](_0x60fd('0xd'),_0x566322,_0x60fd('0xc'),JSON[_0x60fd('0xe')](_0x46f05b));if(_0x46f05b[_0x60fd('0xf')]){if(_0x46f05b[_0x60fd('0xf')][_0x60fd('0x10')]===0x1f4){logger[_0x60fd('0xf')](_0x60fd('0xb'),_0x566322,_0x46f05b[_0x60fd('0xf')][_0x60fd('0x11')]);return _0x56084c(_0x46f05b[_0x60fd('0xf')][_0x60fd('0x11')]);}logger[_0x60fd('0xf')](_0x60fd('0xb'),_0x566322,_0x46f05b['error'][_0x60fd('0x11')]);return _0x3e4ada(_0x46f05b['error'][_0x60fd('0x11')]);}else{logger[_0x60fd('0xa')](_0x60fd('0xb'),_0x566322,_0x60fd('0xc'));_0x3e4ada(_0x46f05b[_0x60fd('0x12')][_0x60fd('0x11')]);}})[_0x60fd('0x13')](function(_0x206c96){logger['error'](_0x60fd('0xb'),_0x566322,_0x206c96);_0x56084c(_0x206c96);});});} \ No newline at end of file +var _0x22fc=['request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40672d,_0x316df5){var _0x731e51=function(_0x103e27){while(--_0x103e27){_0x40672d['push'](_0x40672d['shift']());}};_0x731e51(++_0x316df5);}(_0x22fc,0x11b));var _0xc22f=function(_0x2a8d37,_0x550125){_0x2a8d37=_0x2a8d37-0x0;var _0x93e390=_0x22fc[_0x2a8d37];return _0x93e390;};'use strict';var _=require('lodash');var util=require(_0xc22f('0x0'));var moment=require(_0xc22f('0x1'));var BPromise=require('bluebird');var rs=require(_0xc22f('0x2'));var fs=require('fs');var Redis=require(_0xc22f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc22f('0x4'))(_0xc22f('0x5'));var config=require(_0xc22f('0x6'));var jayson=require(_0xc22f('0x7'));var client=jayson[_0xc22f('0x8')][_0xc22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14de66,_0xeaa461,_0xbbe57e){return new BPromise(function(_0x467e4e,_0x43bfd3){return client[_0xc22f('0xa')](_0x14de66,_0xbbe57e)['then'](function(_0x43005f){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xeaa461,_0xc22f('0xb'));logger['debug'](_0xc22f('0xc'),_0xeaa461,'request\x20sent',JSON[_0xc22f('0xd')](_0x43005f));if(_0x43005f[_0xc22f('0xe')]){if(_0x43005f[_0xc22f('0xe')][_0xc22f('0xf')]===0x1f4){logger[_0xc22f('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0xeaa461,_0x43005f['error']['message']);return _0x43bfd3(_0x43005f[_0xc22f('0xe')]['message']);}logger[_0xc22f('0xe')](_0xc22f('0x10'),_0xeaa461,_0x43005f[_0xc22f('0xe')][_0xc22f('0x11')]);return _0x467e4e(_0x43005f[_0xc22f('0xe')][_0xc22f('0x11')]);}else{logger[_0xc22f('0x12')](_0xc22f('0x10'),_0xeaa461,_0xc22f('0xb'));_0x467e4e(_0x43005f[_0xc22f('0x13')]['message']);}})[_0xc22f('0x14')](function(_0x47f858){logger[_0xc22f('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0xeaa461,_0x47f858);_0x43bfd3(_0x47f858);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index edc6bbe..507404e 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 _0x8aa0=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x333d32,_0x3562f8){var _0x128f4f=function(_0x580ca3){while(--_0x580ca3){_0x333d32['push'](_0x333d32['shift']());}};_0x128f4f(++_0x3562f8);}(_0x8aa0,0x9c));var _0x08aa=function(_0x115ccf,_0x38a146){_0x115ccf=_0x115ccf-0x0;var _0x489567=_0x8aa0[_0x115ccf];return _0x489567;};'use strict';var multer=require(_0x08aa('0x0'));var util=require(_0x08aa('0x1'));var path=require('path');var timeout=require(_0x08aa('0x2'));var express=require(_0x08aa('0x3'));var router=express['Router']();var fs_extra=require(_0x08aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08aa('0x5'));var config=require(_0x08aa('0x6'));var controller=require('./faxTransferReport.controller');router[_0x08aa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x08aa('0x8'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xa')]);router[_0x08aa('0x7')](_0x08aa('0xb'),auth[_0x08aa('0x9')](),controller['show']);router[_0x08aa('0xc')]('/',auth[_0x08aa('0x9')](),controller[_0x08aa('0xd')]);router[_0x08aa('0xe')](_0x08aa('0xb'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xf')]);router[_0x08aa('0x10')]('/:id',auth[_0x08aa('0x9')](),controller[_0x08aa('0x11')]);module[_0x08aa('0x12')]=router; \ No newline at end of file +var _0x5833=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x5833,0x8b));var _0x3583=function(_0x4a38f7,_0x5e20ed){_0x4a38f7=_0x4a38f7-0x0;var _0x1e441d=_0x5833[_0x4a38f7];return _0x1e441d;};'use strict';var multer=require(_0x3583('0x0'));var util=require(_0x3583('0x1'));var path=require(_0x3583('0x2'));var timeout=require(_0x3583('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3583('0x4'));var auth=require(_0x3583('0x5'));var interaction=require(_0x3583('0x6'));var config=require(_0x3583('0x7'));var controller=require(_0x3583('0x8'));router['get']('/',auth[_0x3583('0x9')](),controller[_0x3583('0xa')]);router[_0x3583('0xb')](_0x3583('0xc'),auth[_0x3583('0x9')](),controller[_0x3583('0xd')]);router[_0x3583('0xb')](_0x3583('0xe'),auth['isAuthenticated'](),controller[_0x3583('0xf')]);router['post']('/',auth[_0x3583('0x9')](),controller[_0x3583('0x10')]);router[_0x3583('0x11')]('/:id',auth[_0x3583('0x9')](),controller[_0x3583('0x12')]);router[_0x3583('0x13')](_0x3583('0xe'),auth[_0x3583('0x9')](),controller[_0x3583('0x14')]);module[_0x3583('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 74a01a9..b131cdb 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 _0x5ae7=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x5ae7,0x13c));var _0x75ae=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ae7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x75ae('0x0'));var util=require('util');var path=require(_0x75ae('0x1'));var timeout=require(_0x75ae('0x2'));var express=require(_0x75ae('0x3'));var router=express[_0x75ae('0x4')]();var fs_extra=require(_0x75ae('0x5'));var auth=require(_0x75ae('0x6'));var interaction=require(_0x75ae('0x7'));var config=require(_0x75ae('0x8'));var controller=require('./intDeskAccount.controller');router[_0x75ae('0x9')]('/',auth[_0x75ae('0xa')](),controller[_0x75ae('0xb')]);router[_0x75ae('0x9')](_0x75ae('0xc'),auth[_0x75ae('0xa')](),controller[_0x75ae('0xd')]);router[_0x75ae('0x9')](_0x75ae('0xe'),auth[_0x75ae('0xa')](),controller['getConfigurations']);router[_0x75ae('0x9')](_0x75ae('0xf'),auth[_0x75ae('0xa')](),controller[_0x75ae('0x10')]);router[_0x75ae('0x11')]('/',auth[_0x75ae('0xa')](),controller[_0x75ae('0x12')]);router[_0x75ae('0x11')](_0x75ae('0xe'),auth[_0x75ae('0xa')](),controller[_0x75ae('0x13')]);router[_0x75ae('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x75ae('0x15')]);router[_0x75ae('0x16')](_0x75ae('0xc'),auth['isAuthenticated'](),controller[_0x75ae('0x17')]);module[_0x75ae('0x18')]=router; \ No newline at end of file +var _0x0801=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','/:id','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x0801,0x1c2));var _0x1080=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0801[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x1080('0x0'));var util=require(_0x1080('0x1'));var path=require(_0x1080('0x2'));var timeout=require('connect-timeout');var express=require(_0x1080('0x3'));var router=express['Router']();var fs_extra=require(_0x1080('0x4'));var auth=require(_0x1080('0x5'));var interaction=require(_0x1080('0x6'));var config=require(_0x1080('0x7'));var controller=require(_0x1080('0x8'));router[_0x1080('0x9')]('/',auth[_0x1080('0xa')](),controller[_0x1080('0xb')]);router[_0x1080('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1080('0xc')]);router['get'](_0x1080('0xd'),auth[_0x1080('0xa')](),controller[_0x1080('0xe')]);router[_0x1080('0x9')](_0x1080('0xf'),auth[_0x1080('0xa')](),controller[_0x1080('0x10')]);router[_0x1080('0x11')]('/',auth[_0x1080('0xa')](),controller[_0x1080('0x12')]);router[_0x1080('0x11')](_0x1080('0xd'),auth[_0x1080('0xa')](),controller['addConfiguration']);router['put'](_0x1080('0x13'),auth[_0x1080('0xa')](),controller['update']);router[_0x1080('0x14')](_0x1080('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x1080('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 118beec..a516390 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 _0xef63=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x57cf77,_0x184f21){var _0x4e6cfc=function(_0x56c542){while(--_0x56c542){_0x57cf77['push'](_0x57cf77['shift']());}};_0x4e6cfc(++_0x184f21);}(_0xef63,0x181));var _0x3ef6=function(_0x497494,_0x4eaf15){_0x497494=_0x497494-0x0;var _0x130954=_0xef63[_0x497494];return _0x130954;};'use strict';var Sequelize=require(_0x3ef6('0x0'));module[_0x3ef6('0x1')]={'name':{'type':Sequelize[_0x3ef6('0x2')]},'description':{'type':Sequelize[_0x3ef6('0x2')]},'username':{'type':Sequelize[_0x3ef6('0x2')]},'remoteUri':{'type':Sequelize[_0x3ef6('0x2')]},'authType':{'type':Sequelize[_0x3ef6('0x3')]('basic'),'defaultValue':_0x3ef6('0x4')},'password':{'type':Sequelize[_0x3ef6('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3ef6('0x2')]},'token':{'type':Sequelize[_0x3ef6('0x2')]},'tokenSecret':{'type':Sequelize[_0x3ef6('0x2')]},'serverUrl':{'type':Sequelize[_0x3ef6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3ef6('0x3')](_0x3ef6('0x5'),'newTab'),'defaultValue':_0x3ef6('0x5')}}; \ No newline at end of file +var _0x7ebd=['STRING','basic','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x426fb3,_0x443e58){var _0x7bfe41=function(_0x57aa89){while(--_0x57aa89){_0x426fb3['push'](_0x426fb3['shift']());}};_0x7bfe41(++_0x443e58);}(_0x7ebd,0x1a9));var _0xd7eb=function(_0xe52f9c,_0x42d87a){_0xe52f9c=_0xe52f9c-0x0;var _0x5115a9=_0x7ebd[_0xe52f9c];return _0x5115a9;};'use strict';var Sequelize=require(_0xd7eb('0x0'));module[_0xd7eb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7eb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd7eb('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xd7eb('0x3')),'defaultValue':_0xd7eb('0x3')},'password':{'type':Sequelize[_0xd7eb('0x2')]},'consumerKey':{'type':Sequelize[_0xd7eb('0x2')]},'consumerSecret':{'type':Sequelize[_0xd7eb('0x2')]},'token':{'type':Sequelize[_0xd7eb('0x2')]},'tokenSecret':{'type':Sequelize[_0xd7eb('0x2')]},'serverUrl':{'type':Sequelize[_0xd7eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd7eb('0x4')](_0xd7eb('0x5'),_0xd7eb('0x6')),'defaultValue':_0xd7eb('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index cad4034..df82505 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 _0x02dd=['status','end','json','offset','limit','count','apply','reject','save','destroy','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','authType','headers','Authorization','%s:%s','toString','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x5449ec,_0x5a408d){var _0x14cc1d=function(_0x596506){while(--_0x596506){_0x5449ec['push'](_0x5449ec['shift']());}};_0x14cc1d(++_0x5a408d);}(_0x02dd,0x1a4));var _0xd02d=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x02dd[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xd02d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd02d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd02d('0x2'));var moment=require(_0xd02d('0x3'));var BPromise=require(_0xd02d('0x4'));var Mustache=require(_0xd02d('0x5'));var util=require(_0xd02d('0x6'));var path=require('path');var sox=require(_0xd02d('0x7'));var csv=require(_0xd02d('0x8'));var ejs=require(_0xd02d('0x9'));var fs=require('fs');var fs_extra=require(_0xd02d('0xa'));var _=require(_0xd02d('0xb'));var squel=require(_0xd02d('0xc'));var crypto=require(_0xd02d('0xd'));var jsforce=require(_0xd02d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd02d('0x8'));var querystring=require(_0xd02d('0xf'));var Papa=require(_0xd02d('0x10'));var Redis=require(_0xd02d('0x11'));var authService=require(_0xd02d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd02d('0x13'));var hardwareService=require(_0xd02d('0x14'));var logger=require('../../config/logger')(_0xd02d('0x15'));var utils=require(_0xd02d('0x16'));var config=require(_0xd02d('0x17'));var licenseUtil=require(_0xd02d('0x18'));var db=require(_0xd02d('0x19'))['db'];var integrations=require(_0xd02d('0x1a'));function respondWithStatusCode(_0x3b0037,_0x2acc8a){_0x2acc8a=_0x2acc8a||0xcc;return function(_0x5d774d){if(_0x5d774d){return _0x3b0037[_0xd02d('0x1b')](_0x2acc8a);}return _0x3b0037[_0xd02d('0x1c')](_0x2acc8a)[_0xd02d('0x1d')]();};}function respondWithResult(_0x41a663,_0x28a2ad){_0x28a2ad=_0x28a2ad||0xc8;return function(_0x3ad8a7){if(_0x3ad8a7){return _0x41a663['status'](_0x28a2ad)[_0xd02d('0x1e')](_0x3ad8a7);}};}function respondWithFilteredResult(_0xb1db57,_0x3a2503){return function(_0x9e9ef4){if(_0x9e9ef4){var _0x176f0a=typeof _0x3a2503[_0xd02d('0x1f')]==='undefined'&&typeof _0x3a2503[_0xd02d('0x20')]==='undefined';var _0x2a5e11=_0x9e9ef4[_0xd02d('0x21')];var _0x5beded=_0x176f0a?0x0:_0x3a2503['offset'];var _0x4e3c16=_0x176f0a?_0x9e9ef4['count']:_0x3a2503[_0xd02d('0x1f')]+_0x3a2503[_0xd02d('0x20')];var _0x278fe8;if(_0x4e3c16>=_0x2a5e11){_0x4e3c16=_0x2a5e11;_0x278fe8=0xc8;}else{_0x278fe8=0xce;}_0xb1db57[_0xd02d('0x1c')](_0x278fe8);return _0xb1db57['set']('Content-Range',_0x5beded+'-'+_0x4e3c16+'/'+_0x2a5e11)[_0xd02d('0x1e')](_0x9e9ef4);}return null;};}function patchUpdates(_0x5134c4){return function(_0x5753b0){try{jsonpatch[_0xd02d('0x22')](_0x5753b0,_0x5134c4,!![]);}catch(_0x3a5e1a){return BPromise[_0xd02d('0x23')](_0x3a5e1a);}return _0x5753b0[_0xd02d('0x24')]();};}function saveUpdates(_0x3e942c,_0x1de9e4){return function(_0x1c98dd){if(_0x1c98dd){return _0x1c98dd['update'](_0x3e942c)['then'](function(_0x1a893c){return _0x1a893c;});}return null;};}function removeEntity(_0x363ff0,_0x2f9e78){return function(_0x78a3fb){if(_0x78a3fb){return _0x78a3fb[_0xd02d('0x25')]()[_0xd02d('0x26')](function(){_0x363ff0[_0xd02d('0x1c')](0xcc)[_0xd02d('0x1d')]();});}};}function handleEntityNotFound(_0x5f71d9,_0x3cdad2){return function(_0x267fb9){if(!_0x267fb9){_0x5f71d9[_0xd02d('0x1b')](0x194);}return _0x267fb9;};}function handleError(_0x3c7197,_0x3e78a0){_0x3e78a0=_0x3e78a0||0x1f4;return function(_0x2d3fb3){logger[_0xd02d('0x27')](_0x2d3fb3[_0xd02d('0x28')]);if(_0x2d3fb3['name']){delete _0x2d3fb3[_0xd02d('0x29')];}_0x3c7197['status'](_0x3e78a0)[_0xd02d('0x2a')](_0x2d3fb3);};}exports['index']=function(_0x30d433,_0x49a1cd){var _0x583fbf={},_0x362029={},_0x497291={'count':0x0,'rows':[]};var _0x235dea=_[_0xd02d('0x2b')](db[_0xd02d('0x2c')][_0xd02d('0x2d')],function(_0x37b062){return{'name':_0x37b062[_0xd02d('0x2e')],'type':_0x37b062[_0xd02d('0x2f')][_0xd02d('0x30')]};});_0x362029[_0xd02d('0x31')]=_[_0xd02d('0x2b')](_0x235dea,_0xd02d('0x29'));_0x362029['query']=_['keys'](_0x30d433[_0xd02d('0x32')]);_0x362029[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x362029[_0xd02d('0x31')],_0x362029[_0xd02d('0x32')]);_0x583fbf[_0xd02d('0x35')]=_[_0xd02d('0x34')](_0x362029[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x36')]));_0x583fbf['attributes']=_0x583fbf[_0xd02d('0x35')][_0xd02d('0x37')]?_0x583fbf[_0xd02d('0x35')]:_0x362029[_0xd02d('0x31')];if(!_0x30d433[_0xd02d('0x32')]['hasOwnProperty'](_0xd02d('0x38'))){_0x583fbf[_0xd02d('0x20')]=qs[_0xd02d('0x20')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x20')]);_0x583fbf[_0xd02d('0x1f')]=qs[_0xd02d('0x1f')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x1f')]);}_0x583fbf[_0xd02d('0x39')]=qs['sort'](_0x30d433[_0xd02d('0x32')][_0xd02d('0x3a')]);_0x583fbf[_0xd02d('0x3b')]=qs[_0xd02d('0x33')](_[_0xd02d('0x3c')](_0x30d433[_0xd02d('0x32')],_0x362029[_0xd02d('0x33')]),_0x235dea);if(_0x30d433[_0xd02d('0x32')][_0xd02d('0x3d')]){_0x583fbf['where']=_[_0xd02d('0x3e')](_0x583fbf[_0xd02d('0x3b')],{'$or':_[_0xd02d('0x2b')](_0x235dea,function(_0x41959f){if(_0x41959f[_0xd02d('0x2f')]!=='VIRTUAL'){var _0xaa5f06={};_0xaa5f06[_0x41959f[_0xd02d('0x29')]]={'$like':'%'+_0x30d433[_0xd02d('0x32')]['filter']+'%'};return _0xaa5f06;}})});}_0x583fbf=_[_0xd02d('0x3e')]({},_0x583fbf,_0x30d433[_0xd02d('0x3f')]);var _0x27890a={'where':_0x583fbf[_0xd02d('0x3b')]};return db[_0xd02d('0x2c')][_0xd02d('0x21')](_0x27890a)[_0xd02d('0x26')](function(_0x349783){_0x497291[_0xd02d('0x21')]=_0x349783;if(_0x30d433[_0xd02d('0x32')][_0xd02d('0x40')]){_0x583fbf[_0xd02d('0x41')]=[{'all':!![]}];}return db[_0xd02d('0x2c')][_0xd02d('0x42')](_0x583fbf);})[_0xd02d('0x26')](function(_0x578937){_0x497291[_0xd02d('0x43')]=_0x578937;return _0x497291;})[_0xd02d('0x26')](respondWithFilteredResult(_0x49a1cd,_0x583fbf))[_0xd02d('0x44')](handleError(_0x49a1cd,null));};exports[_0xd02d('0x45')]=function(_0x26e1ee,_0xc44e32){var _0x25a072={'raw':![],'where':{'id':_0x26e1ee['params']['id']}},_0x535b32={};_0x535b32[_0xd02d('0x31')]=_[_0xd02d('0x46')](db[_0xd02d('0x2c')]['rawAttributes']);_0x535b32[_0xd02d('0x32')]=_['keys'](_0x26e1ee[_0xd02d('0x32')]);_0x535b32[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x535b32[_0xd02d('0x31')],_0x535b32[_0xd02d('0x32')]);_0x25a072['attributes']=_[_0xd02d('0x34')](_0x535b32[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x26e1ee['query'][_0xd02d('0x36')]));_0x25a072[_0xd02d('0x35')]=_0x25a072['attributes'][_0xd02d('0x37')]?_0x25a072[_0xd02d('0x35')]:_0x535b32[_0xd02d('0x31')];if(_0x26e1ee[_0xd02d('0x32')]['includeAll']){_0x25a072[_0xd02d('0x41')]=[{'all':!![]}];}_0x25a072=_[_0xd02d('0x3e')]({},_0x25a072,_0x26e1ee[_0xd02d('0x3f')]);return db[_0xd02d('0x2c')][_0xd02d('0x47')](_0x25a072)[_0xd02d('0x26')](handleEntityNotFound(_0xc44e32,null))[_0xd02d('0x26')](respondWithResult(_0xc44e32,null))[_0xd02d('0x44')](handleError(_0xc44e32,null));};exports[_0xd02d('0x48')]=function(_0x3f4c3e,_0x96130e){return db[_0xd02d('0x2c')]['create'](_0x3f4c3e[_0xd02d('0x49')],{})[_0xd02d('0x26')](respondWithResult(_0x96130e,0xc9))[_0xd02d('0x44')](handleError(_0x96130e,null));};exports[_0xd02d('0x4a')]=function(_0x40cbf5,_0x28c096){if(_0x40cbf5['body']['id']){delete _0x40cbf5[_0xd02d('0x49')]['id'];}return db['DeskAccount'][_0xd02d('0x47')]({'where':{'id':_0x40cbf5[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x28c096,null))[_0xd02d('0x26')](saveUpdates(_0x40cbf5['body'],null))[_0xd02d('0x26')](respondWithResult(_0x28c096,null))[_0xd02d('0x44')](handleError(_0x28c096,null));};exports[_0xd02d('0x25')]=function(_0x49c9bc,_0x3eec2e){return db[_0xd02d('0x2c')]['find']({'where':{'id':_0x49c9bc[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x3eec2e,null))[_0xd02d('0x26')](removeEntity(_0x3eec2e,null))[_0xd02d('0x44')](handleError(_0x3eec2e,null));};exports[_0xd02d('0x4c')]=function(_0x2c8cd0,_0x1452c0,_0x44a2b0){var _0x50c27b={};var _0x230d58={};var _0x53483e;var _0x7651d8;return db['DeskAccount'][_0xd02d('0x4d')]({'where':{'id':_0x2c8cd0[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x1452c0,null))[_0xd02d('0x26')](function(_0x1f7f37){if(_0x1f7f37){_0x53483e=_0x1f7f37;_0x230d58[_0xd02d('0x31')]=_['keys'](db['DeskConfiguration'][_0xd02d('0x2d')]);_0x230d58[_0xd02d('0x32')]=_[_0xd02d('0x46')](_0x2c8cd0['query']);_0x230d58[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x230d58[_0xd02d('0x31')],_0x230d58[_0xd02d('0x32')]);_0x50c27b[_0xd02d('0x35')]=_[_0xd02d('0x34')](_0x230d58[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x2c8cd0[_0xd02d('0x32')]['fields']));_0x50c27b['attributes']=_0x50c27b[_0xd02d('0x35')][_0xd02d('0x37')]?_0x50c27b[_0xd02d('0x35')]:_0x230d58['model'];_0x50c27b[_0xd02d('0x39')]=qs[_0xd02d('0x3a')](_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x3a')]);_0x50c27b[_0xd02d('0x3b')]=qs[_0xd02d('0x33')](_[_0xd02d('0x3c')](_0x2c8cd0[_0xd02d('0x32')],_0x230d58[_0xd02d('0x33')]));if(_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x3d')]){_0x50c27b[_0xd02d('0x3b')]=_['merge'](_0x50c27b[_0xd02d('0x3b')],{'$or':_[_0xd02d('0x2b')](_0x50c27b[_0xd02d('0x35')],function(_0x1deb49){var _0x1d1757={};_0x1d1757[_0x1deb49]={'$like':'%'+_0x2c8cd0['query'][_0xd02d('0x3d')]+'%'};return _0x1d1757;})});}_0x50c27b=_['merge']({},_0x50c27b,_0x2c8cd0[_0xd02d('0x3f')]);return _0x53483e['getConfigurations'](_0x50c27b);}})[_0xd02d('0x26')](function(_0x120039){if(_0x120039){_0x7651d8=_0x120039['length'];if(!_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x4e')](_0xd02d('0x38'))){_0x50c27b[_0xd02d('0x20')]=qs['limit'](_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x20')]);_0x50c27b[_0xd02d('0x1f')]=qs[_0xd02d('0x1f')](_0x2c8cd0['query'][_0xd02d('0x1f')]);}return _0x53483e[_0xd02d('0x4c')](_0x50c27b);}})[_0xd02d('0x26')](function(_0x32de45){if(_0x32de45){return _0x32de45?{'count':_0x7651d8,'rows':_0x32de45}:null;}})[_0xd02d('0x26')](respondWithResult(_0x1452c0,null))[_0xd02d('0x44')](handleError(_0x1452c0,null));};exports[_0xd02d('0x4f')]=function(_0x335754,_0x4af829,_0x2cb78e){if(_0x335754[_0xd02d('0x49')]['id']){delete _0x335754[_0xd02d('0x49')]['id'];}return db[_0xd02d('0x2c')][_0xd02d('0x4d')]({'where':{'id':_0x335754[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x4af829,null))[_0xd02d('0x26')](function(_0x4cddaa){if(_0x4cddaa){_0x335754[_0xd02d('0x49')]['AccountId']=_0x4cddaa['id'];_0x335754[_0xd02d('0x49')]['Subjects']=integrations[_0xd02d('0x50')](_0x335754[_0xd02d('0x49')][_0xd02d('0x51')],_0x335754[_0xd02d('0x49')][_0xd02d('0x2f')]);_0x335754['body'][_0xd02d('0x52')]=integrations[_0xd02d('0x53')](_0x335754['body'][_0xd02d('0x51')],_0x335754[_0xd02d('0x49')][_0xd02d('0x2f')]);return db[_0xd02d('0x54')][_0xd02d('0x48')](_0x335754['body'],{'include':[{'model':db[_0xd02d('0x55')],'as':_0xd02d('0x56')},{'model':db['DeskField'],'as':_0xd02d('0x52')}]});}return null;})['then'](respondWithResult(_0x4af829,null))[_0xd02d('0x44')](handleError(_0x4af829,null));};exports[_0xd02d('0x57')]=function(_0x457608,_0x2cd232,_0x4833ca){var _0x31762e=[{'name':_0xd02d('0x58'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x34ce2f='';return db[_0xd02d('0x2c')][_0xd02d('0x4d')]({'where':{'id':_0x457608[_0xd02d('0x4b')]['id']},'attributes':['id',_0xd02d('0x59'),'authType',_0xd02d('0x5a'),_0xd02d('0x5b'),_0xd02d('0x5c'),_0xd02d('0x5d'),'token',_0xd02d('0x5e')]})[_0xd02d('0x26')](handleEntityNotFound(_0x2cd232,null))[_0xd02d('0x26')](function(_0x3996cd){if(_0x3996cd){_0x34ce2f=_0x3996cd[_0xd02d('0x59')];var _0x4b6d43=_0x34ce2f[_0xd02d('0x5f')](-0x1);if(_0x4b6d43==='/'){_0x34ce2f=_0x34ce2f[_0xd02d('0x60')](0x0,_0x34ce2f[_0xd02d('0x61')](_0x4b6d43));}var _0x9c267a={'method':_0xd02d('0x62'),'uri':util[_0xd02d('0x63')]('%s/custom_fields',_0x34ce2f),'headers':{'Content-Type':_0xd02d('0x64'),'Accept':_0xd02d('0x64')},'json':!![]};if(_0x3996cd[_0xd02d('0x65')]==='basic'){_0x9c267a[_0xd02d('0x66')][_0xd02d('0x67')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0xd02d('0x68'),_0x3996cd[_0xd02d('0x5a')],_0x3996cd['password']))[_0xd02d('0x69')]('base64'));}return rp(_0x9c267a)['then'](function(_0x4ce2aa){return _0x31762e[_0xd02d('0x6a')](_['map'](_0x4ce2aa['_embedded'][_0xd02d('0x6b')],function(_0x1d1cb8){return{'id':_0x1d1cb8[_0xd02d('0x29')],'name':_0x1d1cb8[_0xd02d('0x29')],'type':_0x1d1cb8[_0xd02d('0x2f')],'active':_0x1d1cb8['active'],'label':_0x1d1cb8[_0xd02d('0x6c')],'custom':!![]};}));});}})['then'](function(_0x441f4f){return{'count':_0x441f4f[_0xd02d('0x37')],'rows':_0x441f4f};})[_0xd02d('0x26')](respondWithResult(_0x2cd232,null))[_0xd02d('0x44')](function(_0x4127de){var _0x5db9cd=_0x457608[_0xd02d('0x32')]['test']?0x1f4:_0x4127de[_0xd02d('0x6d')]||0x1f4;logger['error'](_0xd02d('0x6e'),_0xd02d('0x57'),_0x5db9cd,JSON['stringify'](_0x4127de));delete _0x4127de['name'];if(_0x5db9cd===0x191){_0x5db9cd=0x190;}_0x2cd232['status'](_0x5db9cd)[_0xd02d('0x2a')](_0x457608[_0xd02d('0x32')][_0xd02d('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4127de[_0xd02d('0x6d')]}:_0x4127de);});}; \ No newline at end of file +var _0xa1e5=['update','then','error','stack','name','send','index','map','DeskAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','merge','catch','create','body','find','destroy','findOne','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','username','toString','base64','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save'];(function(_0x208223,_0x46acfd){var _0x3856a=function(_0xc9c58c){while(--_0xc9c58c){_0x208223['push'](_0x208223['shift']());}};_0x3856a(++_0x46acfd);}(_0xa1e5,0x1a7));var _0x5a1e=function(_0xd85245,_0x5d63a5){_0xd85245=_0xd85245-0x0;var _0x441ef4=_0xa1e5[_0xd85245];return _0x441ef4;};'use strict';var emlformat=require(_0x5a1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a1e('0x1'));var jsonpatch=require(_0x5a1e('0x2'));var rp=require(_0x5a1e('0x3'));var moment=require(_0x5a1e('0x4'));var BPromise=require(_0x5a1e('0x5'));var Mustache=require(_0x5a1e('0x6'));var util=require(_0x5a1e('0x7'));var path=require(_0x5a1e('0x8'));var sox=require('sox');var csv=require(_0x5a1e('0x9'));var ejs=require(_0x5a1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a1e('0xb'));var squel=require(_0x5a1e('0xc'));var crypto=require('crypto');var jsforce=require(_0x5a1e('0xd'));var deskjs=require(_0x5a1e('0xe'));var toCsv=require(_0x5a1e('0x9'));var querystring=require(_0x5a1e('0xf'));var Papa=require(_0x5a1e('0x10'));var Redis=require(_0x5a1e('0x11'));var authService=require(_0x5a1e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5a1e('0x13'));var hardwareService=require(_0x5a1e('0x14'));var logger=require(_0x5a1e('0x15'))('api');var utils=require(_0x5a1e('0x16'));var config=require(_0x5a1e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a1e('0x18'))['db'];var integrations=require(_0x5a1e('0x19'));function respondWithStatusCode(_0x1fff34,_0x14a89f){_0x14a89f=_0x14a89f||0xcc;return function(_0x2b6a06){if(_0x2b6a06){return _0x1fff34[_0x5a1e('0x1a')](_0x14a89f);}return _0x1fff34[_0x5a1e('0x1b')](_0x14a89f)[_0x5a1e('0x1c')]();};}function respondWithResult(_0x6b18fe,_0x263938){_0x263938=_0x263938||0xc8;return function(_0x444893){if(_0x444893){return _0x6b18fe['status'](_0x263938)[_0x5a1e('0x1d')](_0x444893);}};}function respondWithFilteredResult(_0x11d4a8,_0x1c4e5f){return function(_0x4be2e5){if(_0x4be2e5){var _0x4f6111=typeof _0x1c4e5f[_0x5a1e('0x1e')]==='undefined'&&typeof _0x1c4e5f['limit']==='undefined';var _0x500a13=_0x4be2e5[_0x5a1e('0x1f')];var _0x454405=_0x4f6111?0x0:_0x1c4e5f[_0x5a1e('0x1e')];var _0x3d25f1=_0x4f6111?_0x4be2e5[_0x5a1e('0x1f')]:_0x1c4e5f['offset']+_0x1c4e5f[_0x5a1e('0x20')];var _0x5b021f;if(_0x3d25f1>=_0x500a13){_0x3d25f1=_0x500a13;_0x5b021f=0xc8;}else{_0x5b021f=0xce;}_0x11d4a8[_0x5a1e('0x1b')](_0x5b021f);return _0x11d4a8[_0x5a1e('0x21')](_0x5a1e('0x22'),_0x454405+'-'+_0x3d25f1+'/'+_0x500a13)[_0x5a1e('0x1d')](_0x4be2e5);}return null;};}function patchUpdates(_0x8b6272){return function(_0x1a0511){try{jsonpatch['apply'](_0x1a0511,_0x8b6272,!![]);}catch(_0x8c77f3){return BPromise[_0x5a1e('0x23')](_0x8c77f3);}return _0x1a0511[_0x5a1e('0x24')]();};}function saveUpdates(_0x6fda44,_0x43eb67){return function(_0x261809){if(_0x261809){return _0x261809[_0x5a1e('0x25')](_0x6fda44)[_0x5a1e('0x26')](function(_0x1d5a06){return _0x1d5a06;});}return null;};}function removeEntity(_0x41564f,_0x28c4d3){return function(_0x50d261){if(_0x50d261){return _0x50d261['destroy']()['then'](function(){_0x41564f['status'](0xcc)[_0x5a1e('0x1c')]();});}};}function handleEntityNotFound(_0x44d25e,_0x281c56){return function(_0x4d2017){if(!_0x4d2017){_0x44d25e[_0x5a1e('0x1a')](0x194);}return _0x4d2017;};}function handleError(_0xc91993,_0x10fe30){_0x10fe30=_0x10fe30||0x1f4;return function(_0x43b579){logger[_0x5a1e('0x27')](_0x43b579[_0x5a1e('0x28')]);if(_0x43b579[_0x5a1e('0x29')]){delete _0x43b579[_0x5a1e('0x29')];}_0xc91993['status'](_0x10fe30)[_0x5a1e('0x2a')](_0x43b579);};}exports[_0x5a1e('0x2b')]=function(_0x2c781b,_0x3a8b06){var _0x11f730={},_0x14c8c2={},_0x310ba9={'count':0x0,'rows':[]};var _0x56a68f=_[_0x5a1e('0x2c')](db[_0x5a1e('0x2d')]['rawAttributes'],function(_0xe81925){return{'name':_0xe81925[_0x5a1e('0x2e')],'type':_0xe81925[_0x5a1e('0x2f')]['key']};});_0x14c8c2[_0x5a1e('0x30')]=_[_0x5a1e('0x2c')](_0x56a68f,_0x5a1e('0x29'));_0x14c8c2[_0x5a1e('0x31')]=_[_0x5a1e('0x32')](_0x2c781b[_0x5a1e('0x31')]);_0x14c8c2[_0x5a1e('0x33')]=_[_0x5a1e('0x34')](_0x14c8c2[_0x5a1e('0x30')],_0x14c8c2[_0x5a1e('0x31')]);_0x11f730[_0x5a1e('0x35')]=_['intersection'](_0x14c8c2[_0x5a1e('0x30')],qs['fields'](_0x2c781b[_0x5a1e('0x31')][_0x5a1e('0x36')]));_0x11f730['attributes']=_0x11f730[_0x5a1e('0x35')][_0x5a1e('0x37')]?_0x11f730[_0x5a1e('0x35')]:_0x14c8c2[_0x5a1e('0x30')];if(!_0x2c781b['query']['hasOwnProperty']('nolimit')){_0x11f730[_0x5a1e('0x20')]=qs[_0x5a1e('0x20')](_0x2c781b[_0x5a1e('0x31')]['limit']);_0x11f730[_0x5a1e('0x1e')]=qs[_0x5a1e('0x1e')](_0x2c781b[_0x5a1e('0x31')]['offset']);}_0x11f730[_0x5a1e('0x38')]=qs['sort'](_0x2c781b[_0x5a1e('0x31')][_0x5a1e('0x39')]);_0x11f730[_0x5a1e('0x3a')]=qs[_0x5a1e('0x33')](_[_0x5a1e('0x3b')](_0x2c781b[_0x5a1e('0x31')],_0x14c8c2[_0x5a1e('0x33')]),_0x56a68f);if(_0x2c781b[_0x5a1e('0x31')][_0x5a1e('0x3c')]){_0x11f730[_0x5a1e('0x3a')]=_['merge'](_0x11f730[_0x5a1e('0x3a')],{'$or':_['map'](_0x56a68f,function(_0x3be143){if(_0x3be143[_0x5a1e('0x2f')]!==_0x5a1e('0x3d')){var _0x2a3a10={};_0x2a3a10[_0x3be143[_0x5a1e('0x29')]]={'$like':'%'+_0x2c781b[_0x5a1e('0x31')]['filter']+'%'};return _0x2a3a10;}})});}_0x11f730=_['merge']({},_0x11f730,_0x2c781b[_0x5a1e('0x3e')]);var _0x433c01={'where':_0x11f730['where']};return db[_0x5a1e('0x2d')][_0x5a1e('0x1f')](_0x433c01)[_0x5a1e('0x26')](function(_0x2aa5c8){_0x310ba9[_0x5a1e('0x1f')]=_0x2aa5c8;if(_0x2c781b['query'][_0x5a1e('0x3f')]){_0x11f730[_0x5a1e('0x40')]=[{'all':!![]}];}return db[_0x5a1e('0x2d')][_0x5a1e('0x41')](_0x11f730);})[_0x5a1e('0x26')](function(_0x5285a9){_0x310ba9[_0x5a1e('0x42')]=_0x5285a9;return _0x310ba9;})[_0x5a1e('0x26')](respondWithFilteredResult(_0x3a8b06,_0x11f730))['catch'](handleError(_0x3a8b06,null));};exports['show']=function(_0x21c68f,_0x228b5e){var _0x2d60d8={'raw':![],'where':{'id':_0x21c68f[_0x5a1e('0x43')]['id']}},_0x507d9d={};_0x507d9d[_0x5a1e('0x30')]=_[_0x5a1e('0x32')](db[_0x5a1e('0x2d')][_0x5a1e('0x44')]);_0x507d9d[_0x5a1e('0x31')]=_['keys'](_0x21c68f[_0x5a1e('0x31')]);_0x507d9d[_0x5a1e('0x33')]=_[_0x5a1e('0x34')](_0x507d9d[_0x5a1e('0x30')],_0x507d9d['query']);_0x2d60d8['attributes']=_[_0x5a1e('0x34')](_0x507d9d[_0x5a1e('0x30')],qs[_0x5a1e('0x36')](_0x21c68f[_0x5a1e('0x31')][_0x5a1e('0x36')]));_0x2d60d8['attributes']=_0x2d60d8[_0x5a1e('0x35')]['length']?_0x2d60d8[_0x5a1e('0x35')]:_0x507d9d[_0x5a1e('0x30')];if(_0x21c68f[_0x5a1e('0x31')][_0x5a1e('0x3f')]){_0x2d60d8['include']=[{'all':!![]}];}_0x2d60d8=_[_0x5a1e('0x45')]({},_0x2d60d8,_0x21c68f[_0x5a1e('0x3e')]);return db[_0x5a1e('0x2d')]['find'](_0x2d60d8)[_0x5a1e('0x26')](handleEntityNotFound(_0x228b5e,null))[_0x5a1e('0x26')](respondWithResult(_0x228b5e,null))[_0x5a1e('0x46')](handleError(_0x228b5e,null));};exports[_0x5a1e('0x47')]=function(_0x25c682,_0x2373e4){return db[_0x5a1e('0x2d')]['create'](_0x25c682[_0x5a1e('0x48')],{})[_0x5a1e('0x26')](respondWithResult(_0x2373e4,0xc9))[_0x5a1e('0x46')](handleError(_0x2373e4,null));};exports['update']=function(_0x3d031f,_0x27a142){if(_0x3d031f[_0x5a1e('0x48')]['id']){delete _0x3d031f['body']['id'];}return db['DeskAccount'][_0x5a1e('0x49')]({'where':{'id':_0x3d031f[_0x5a1e('0x43')]['id']}})[_0x5a1e('0x26')](handleEntityNotFound(_0x27a142,null))[_0x5a1e('0x26')](saveUpdates(_0x3d031f[_0x5a1e('0x48')],null))[_0x5a1e('0x26')](respondWithResult(_0x27a142,null))[_0x5a1e('0x46')](handleError(_0x27a142,null));};exports[_0x5a1e('0x4a')]=function(_0x38c5b3,_0x4b4523){return db[_0x5a1e('0x2d')][_0x5a1e('0x49')]({'where':{'id':_0x38c5b3[_0x5a1e('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b4523,null))['then'](removeEntity(_0x4b4523,null))[_0x5a1e('0x46')](handleError(_0x4b4523,null));};exports['getConfigurations']=function(_0xc6629a,_0x56299b,_0xdf930){var _0x315dc7={};var _0x1230f4={};var _0x3f6a6f;var _0xa8adce;return db[_0x5a1e('0x2d')][_0x5a1e('0x4b')]({'where':{'id':_0xc6629a[_0x5a1e('0x43')]['id']}})[_0x5a1e('0x26')](handleEntityNotFound(_0x56299b,null))[_0x5a1e('0x26')](function(_0x455898){if(_0x455898){_0x3f6a6f=_0x455898;_0x1230f4[_0x5a1e('0x30')]=_[_0x5a1e('0x32')](db[_0x5a1e('0x4c')][_0x5a1e('0x44')]);_0x1230f4[_0x5a1e('0x31')]=_['keys'](_0xc6629a['query']);_0x1230f4[_0x5a1e('0x33')]=_[_0x5a1e('0x34')](_0x1230f4[_0x5a1e('0x30')],_0x1230f4[_0x5a1e('0x31')]);_0x315dc7[_0x5a1e('0x35')]=_[_0x5a1e('0x34')](_0x1230f4[_0x5a1e('0x30')],qs['fields'](_0xc6629a[_0x5a1e('0x31')]['fields']));_0x315dc7[_0x5a1e('0x35')]=_0x315dc7[_0x5a1e('0x35')][_0x5a1e('0x37')]?_0x315dc7[_0x5a1e('0x35')]:_0x1230f4['model'];_0x315dc7[_0x5a1e('0x38')]=qs[_0x5a1e('0x39')](_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x39')]);_0x315dc7[_0x5a1e('0x3a')]=qs['filters'](_[_0x5a1e('0x3b')](_0xc6629a[_0x5a1e('0x31')],_0x1230f4[_0x5a1e('0x33')]));if(_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x3c')]){_0x315dc7['where']=_[_0x5a1e('0x45')](_0x315dc7[_0x5a1e('0x3a')],{'$or':_[_0x5a1e('0x2c')](_0x315dc7['attributes'],function(_0x342d04){var _0x2e5976={};_0x2e5976[_0x342d04]={'$like':'%'+_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x3c')]+'%'};return _0x2e5976;})});}_0x315dc7=_[_0x5a1e('0x45')]({},_0x315dc7,_0xc6629a['options']);return _0x3f6a6f['getConfigurations'](_0x315dc7);}})['then'](function(_0x4153f5){if(_0x4153f5){_0xa8adce=_0x4153f5['length'];if(!_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x4d')](_0x5a1e('0x4e'))){_0x315dc7['limit']=qs[_0x5a1e('0x20')](_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x20')]);_0x315dc7['offset']=qs[_0x5a1e('0x1e')](_0xc6629a[_0x5a1e('0x31')][_0x5a1e('0x1e')]);}return _0x3f6a6f['getConfigurations'](_0x315dc7);}})['then'](function(_0x2d1275){if(_0x2d1275){return _0x2d1275?{'count':_0xa8adce,'rows':_0x2d1275}:null;}})['then'](respondWithResult(_0x56299b,null))[_0x5a1e('0x46')](handleError(_0x56299b,null));};exports[_0x5a1e('0x4f')]=function(_0x304a99,_0x2ecc87,_0x26b8b4){if(_0x304a99[_0x5a1e('0x48')]['id']){delete _0x304a99[_0x5a1e('0x48')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x304a99[_0x5a1e('0x43')]['id']}})[_0x5a1e('0x26')](handleEntityNotFound(_0x2ecc87,null))[_0x5a1e('0x26')](function(_0x89ddde){if(_0x89ddde){_0x304a99['body'][_0x5a1e('0x50')]=_0x89ddde['id'];_0x304a99[_0x5a1e('0x48')][_0x5a1e('0x51')]=integrations['getSubjects'](_0x304a99[_0x5a1e('0x48')][_0x5a1e('0x52')],_0x304a99[_0x5a1e('0x48')][_0x5a1e('0x2f')]);_0x304a99[_0x5a1e('0x48')]['Descriptions']=integrations[_0x5a1e('0x53')](_0x304a99['body']['channel'],_0x304a99[_0x5a1e('0x48')][_0x5a1e('0x2f')]);return db[_0x5a1e('0x4c')][_0x5a1e('0x47')](_0x304a99['body'],{'include':[{'model':db['DeskField'],'as':_0x5a1e('0x51')},{'model':db[_0x5a1e('0x54')],'as':_0x5a1e('0x55')}]});}return null;})[_0x5a1e('0x26')](respondWithResult(_0x2ecc87,null))['catch'](handleError(_0x2ecc87,null));};exports[_0x5a1e('0x56')]=function(_0x1e21ad,_0x590649,_0x18217b){var _0x500092=[{'name':_0x5a1e('0x57'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x19772b='';return db[_0x5a1e('0x2d')][_0x5a1e('0x4b')]({'where':{'id':_0x1e21ad['params']['id']},'attributes':['id',_0x5a1e('0x58'),_0x5a1e('0x59'),'username','password',_0x5a1e('0x5a'),'consumerSecret',_0x5a1e('0x5b'),_0x5a1e('0x5c')]})[_0x5a1e('0x26')](handleEntityNotFound(_0x590649,null))[_0x5a1e('0x26')](function(_0x17d3e6){if(_0x17d3e6){_0x19772b=_0x17d3e6['remoteUri'];var _0xe1e12d=_0x19772b['slice'](-0x1);if(_0xe1e12d==='/'){_0x19772b=_0x19772b[_0x5a1e('0x5d')](0x0,_0x19772b[_0x5a1e('0x5e')](_0xe1e12d));}var _0x4ffa80={'method':_0x5a1e('0x5f'),'uri':util['format'](_0x5a1e('0x60'),_0x19772b),'headers':{'Content-Type':_0x5a1e('0x61'),'Accept':_0x5a1e('0x61')},'json':!![]};if(_0x17d3e6[_0x5a1e('0x59')]===_0x5a1e('0x62')){_0x4ffa80[_0x5a1e('0x63')][_0x5a1e('0x64')]=util[_0x5a1e('0x65')](_0x5a1e('0x66'),new Buffer(util[_0x5a1e('0x65')](_0x5a1e('0x67'),_0x17d3e6[_0x5a1e('0x68')],_0x17d3e6['password']))[_0x5a1e('0x69')](_0x5a1e('0x6a')));}return rp(_0x4ffa80)['then'](function(_0x53b9ed){return _0x500092['concat'](_[_0x5a1e('0x2c')](_0x53b9ed[_0x5a1e('0x6b')]['entries'],function(_0x56be62){return{'id':_0x56be62[_0x5a1e('0x29')],'name':_0x56be62[_0x5a1e('0x29')],'type':_0x56be62[_0x5a1e('0x2f')],'active':_0x56be62[_0x5a1e('0x6c')],'label':_0x56be62[_0x5a1e('0x6d')],'custom':!![]};}));});}})[_0x5a1e('0x26')](function(_0x51b765){return{'count':_0x51b765[_0x5a1e('0x37')],'rows':_0x51b765};})[_0x5a1e('0x26')](respondWithResult(_0x590649,null))['catch'](function(_0x2e2c6e){var _0x312ce1=_0x1e21ad[_0x5a1e('0x31')][_0x5a1e('0x6e')]?0x1f4:_0x2e2c6e[_0x5a1e('0x6f')]||0x1f4;logger[_0x5a1e('0x27')](_0x5a1e('0x70'),_0x5a1e('0x56'),_0x312ce1,JSON[_0x5a1e('0x71')](_0x2e2c6e));delete _0x2e2c6e[_0x5a1e('0x29')];if(_0x312ce1===0x191){_0x312ce1=0x190;}_0x590649[_0x5a1e('0x1b')](_0x312ce1)['send'](_0x1e21ad['query']['test']?{'message':_0x5a1e('0x72'),'statusCode':_0x2e2c6e[_0x5a1e('0x6f')]}:_0x2e2c6e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6555b40..feecfc8 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 _0x3fbc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0x1a656f,_0x42eeda){var _0x523fa6=function(_0x1afd3c){while(--_0x1afd3c){_0x1a656f['push'](_0x1a656f['shift']());}};_0x523fa6(++_0x42eeda);}(_0x3fbc,0xe8));var _0xc3fb=function(_0xc4bb1f,_0x2405c9){_0xc4bb1f=_0xc4bb1f-0x0;var _0x4b3759=_0x3fbc[_0xc4bb1f];return _0x4b3759;};'use strict';var _=require('lodash');var util=require(_0xc3fb('0x0'));var logger=require(_0xc3fb('0x1'))(_0xc3fb('0x2'));var moment=require(_0xc3fb('0x3'));var BPromise=require(_0xc3fb('0x4'));var rp=require(_0xc3fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3fb('0x6'));var config=require(_0xc3fb('0x7'));var attributes=require(_0xc3fb('0x8'));var integrations=require(_0xc3fb('0x9'));module['exports']=function(_0x31dee2,_0x52d6b4){return _0x31dee2[_0xc3fb('0xa')](_0xc3fb('0xb'),attributes,{'tableName':_0xc3fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14d3=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12c6b8,_0x48ffe3){var _0x41f1c4=function(_0x2cbbfb){while(--_0x2cbbfb){_0x12c6b8['push'](_0x12c6b8['shift']());}};_0x41f1c4(++_0x48ffe3);}(_0x14d3,0x165));var _0x314d=function(_0x1ae15f,_0x22ad20){_0x1ae15f=_0x1ae15f-0x0;var _0x3b30b6=_0x14d3[_0x1ae15f];return _0x3b30b6;};'use strict';var _=require(_0x314d('0x0'));var util=require(_0x314d('0x1'));var logger=require(_0x314d('0x2'))(_0x314d('0x3'));var moment=require(_0x314d('0x4'));var BPromise=require(_0x314d('0x5'));var rp=require(_0x314d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x314d('0x7'));var config=require(_0x314d('0x8'));var attributes=require(_0x314d('0x9'));var integrations=require(_0x314d('0xa'));module['exports']=function(_0x25f1c7,_0x201e74){return _0x25f1c7[_0x314d('0xb')]('DeskAccount',attributes,{'tableName':_0x314d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ee5272c..1dd42c9 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 _0x869c=['debug','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x28e911,_0x541615){var _0xc09e2a=function(_0x1379f6){while(--_0x1379f6){_0x28e911['push'](_0x28e911['shift']());}};_0xc09e2a(++_0x541615);}(_0x869c,0x150));var _0xc869=function(_0x4090e2,_0x3c77ee){_0x4090e2=_0x4090e2-0x0;var _0x44b887=_0x869c[_0x4090e2];return _0x44b887;};'use strict';var _=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var moment=require(_0xc869('0x2'));var BPromise=require(_0xc869('0x3'));var rs=require(_0xc869('0x4'));var fs=require('fs');var Redis=require(_0xc869('0x5'));var db=require(_0xc869('0x6'))['db'];var utils=require(_0xc869('0x7'));var logger=require('../../config/logger')(_0xc869('0x8'));var config=require(_0xc869('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc869('0xa')][_0xc869('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578827,_0x3f62f5,_0x53e280){return new BPromise(function(_0x23cad3,_0x559bf4){return client[_0xc869('0xc')](_0x578827,_0x53e280)[_0xc869('0xd')](function(_0x3dce50){logger[_0xc869('0xe')](_0xc869('0xf'),_0x3f62f5,'request\x20sent');logger['debug'](_0xc869('0x10'),_0x3f62f5,_0xc869('0x11'),JSON['stringify'](_0x3dce50));if(_0x3dce50[_0xc869('0x12')]){if(_0x3dce50[_0xc869('0x12')][_0xc869('0x13')]===0x1f4){logger['error'](_0xc869('0xf'),_0x3f62f5,_0x3dce50[_0xc869('0x12')]['message']);return _0x559bf4(_0x3dce50[_0xc869('0x12')][_0xc869('0x14')]);}logger[_0xc869('0x12')](_0xc869('0xf'),_0x3f62f5,_0x3dce50['error']['message']);return _0x23cad3(_0x3dce50[_0xc869('0x12')]['message']);}else{logger['info'](_0xc869('0xf'),_0x3f62f5,_0xc869('0x11'));_0x23cad3(_0x3dce50[_0xc869('0x15')][_0xc869('0x14')]);}})[_0xc869('0x16')](function(_0x489a60){logger['error'](_0xc869('0xf'),_0x3f62f5,_0x489a60);_0x559bf4(_0x489a60);});});}exports[_0xc869('0x17')]=function(_0x326111){var _0x5d1cae=this;return new Promise(function(_0x40a6a7,_0x4cd585){return db[_0xc869('0x18')][_0xc869('0x19')]({'raw':_0x326111[_0xc869('0x1a')]?_0x326111[_0xc869('0x1a')][_0xc869('0x1b')]===undefined?!![]:![]:!![],'where':_0x326111['options']?_0x326111['options'][_0xc869('0x1c')]||null:null,'attributes':_0x326111['options']?_0x326111['options'][_0xc869('0x1d')]||null:null,'limit':_0x326111['options']?_0x326111[_0xc869('0x1a')][_0xc869('0x1e')]||null:null,'include':_0x326111[_0xc869('0x1a')]?_0x326111['options'][_0xc869('0x1f')]?_[_0xc869('0x20')](_0x326111[_0xc869('0x1a')]['include'],function(_0x3f48f4){return{'model':db[_0x3f48f4['model']],'as':_0x3f48f4['as'],'attributes':_0x3f48f4[_0xc869('0x1d')],'include':_0x3f48f4['include']?_[_0xc869('0x20')](_0x3f48f4[_0xc869('0x1f')],function(_0x4a7c19){return{'model':db[_0x4a7c19[_0xc869('0x21')]],'as':_0x4a7c19['as'],'attributes':_0x4a7c19[_0xc869('0x1d')],'include':_0x4a7c19[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x4a7c19['include'],function(_0x190369){return{'model':db[_0x190369[_0xc869('0x21')]],'as':_0x190369['as'],'attributes':_0x190369[_0xc869('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b725d){logger[_0xc869('0xe')]('GetDeskAccount',_0x326111);logger[_0xc869('0x22')](_0xc869('0x17'),_0x326111,JSON['stringify'](_0x5b725d));_0x40a6a7(_0x5b725d);})[_0xc869('0x16')](function(_0x43fdf7){logger[_0xc869('0x12')](_0xc869('0x17'),_0x43fdf7[_0xc869('0x14')],_0x326111);_0x4cd585(_0x5d1cae[_0xc869('0x12')](0x1f4,_0x43fdf7[_0xc869('0x14')]));});});};exports['ShowDeskAccount']=function(_0x181c0f){var _0x28458b=this;return new Promise(function(_0x4201e0,_0x2c320c){return db[_0xc869('0x18')][_0xc869('0x23')]({'raw':_0x181c0f['options']?_0x181c0f[_0xc869('0x1a')][_0xc869('0x1b')]===undefined?!![]:![]:!![],'where':_0x181c0f['options']?_0x181c0f['options'][_0xc869('0x1c')]||null:null,'attributes':_0x181c0f[_0xc869('0x1a')]?_0x181c0f[_0xc869('0x1a')][_0xc869('0x1d')]||null:null,'include':_0x181c0f['options']?_0x181c0f['options'][_0xc869('0x1f')]?_['map'](_0x181c0f['options'][_0xc869('0x1f')],function(_0x18ef52){return{'model':db[_0x18ef52[_0xc869('0x21')]],'as':_0x18ef52['as'],'attributes':_0x18ef52[_0xc869('0x1d')],'include':_0x18ef52[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x18ef52[_0xc869('0x1f')],function(_0x16b101){return{'model':db[_0x16b101[_0xc869('0x21')]],'as':_0x16b101['as'],'attributes':_0x16b101[_0xc869('0x1d')],'include':_0x16b101[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x16b101[_0xc869('0x1f')],function(_0x1cad33){return{'model':db[_0x1cad33[_0xc869('0x21')]],'as':_0x1cad33['as'],'attributes':_0x1cad33[_0xc869('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x223e0d){logger['info']('ShowDeskAccount',_0x181c0f);logger[_0xc869('0x22')]('ShowDeskAccount',_0x181c0f,JSON[_0xc869('0x24')](_0x223e0d));_0x4201e0(_0x223e0d);})[_0xc869('0x16')](function(_0x271ed2){logger[_0xc869('0x12')]('ShowDeskAccount',_0x271ed2['message'],_0x181c0f);_0x2c320c(_0x28458b[_0xc869('0x12')](0x1f4,_0x271ed2['message']));});});}; \ No newline at end of file +var _0xd2e7=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','GetDeskAccount','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','util'];(function(_0xd1da52,_0x296da7){var _0x5cc9b6=function(_0x428ff5){while(--_0x428ff5){_0xd1da52['push'](_0xd1da52['shift']());}};_0x5cc9b6(++_0x296da7);}(_0xd2e7,0xef));var _0x7d2e=function(_0x3447b0,_0x263d63){_0x3447b0=_0x3447b0-0x0;var _0x1f8e79=_0xd2e7[_0x3447b0];return _0x1f8e79;};'use strict';var _=require('lodash');var util=require(_0x7d2e('0x0'));var moment=require('moment');var BPromise=require(_0x7d2e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d2e('0x2'))['db'];var utils=require(_0x7d2e('0x3'));var logger=require(_0x7d2e('0x4'))(_0x7d2e('0x5'));var config=require(_0x7d2e('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d8ef1,_0x3eb5c9,_0x45da7b){return new BPromise(function(_0x8b538,_0x3def9e){return client[_0x7d2e('0x7')](_0x3d8ef1,_0x45da7b)[_0x7d2e('0x8')](function(_0x365446){logger[_0x7d2e('0x9')](_0x7d2e('0xa'),_0x3eb5c9,_0x7d2e('0xb'));logger[_0x7d2e('0xc')](_0x7d2e('0xd'),_0x3eb5c9,'request\x20sent',JSON[_0x7d2e('0xe')](_0x365446));if(_0x365446['error']){if(_0x365446['error'][_0x7d2e('0xf')]===0x1f4){logger['error'](_0x7d2e('0xa'),_0x3eb5c9,_0x365446['error'][_0x7d2e('0x10')]);return _0x3def9e(_0x365446[_0x7d2e('0x11')][_0x7d2e('0x10')]);}logger[_0x7d2e('0x11')](_0x7d2e('0xa'),_0x3eb5c9,_0x365446[_0x7d2e('0x11')][_0x7d2e('0x10')]);return _0x8b538(_0x365446['error'][_0x7d2e('0x10')]);}else{logger[_0x7d2e('0x9')]('DeskAccount,\x20%s,\x20%s',_0x3eb5c9,_0x7d2e('0xb'));_0x8b538(_0x365446[_0x7d2e('0x12')][_0x7d2e('0x10')]);}})[_0x7d2e('0x13')](function(_0x4f4852){logger[_0x7d2e('0x11')](_0x7d2e('0xa'),_0x3eb5c9,_0x4f4852);_0x3def9e(_0x4f4852);});});}exports[_0x7d2e('0x14')]=function(_0x196c8e){var _0x1d4561=this;return new Promise(function(_0x315568,_0x5ee9b0){return db['DeskAccount']['findAll']({'raw':_0x196c8e[_0x7d2e('0x15')]?_0x196c8e[_0x7d2e('0x15')][_0x7d2e('0x16')]===undefined?!![]:![]:!![],'where':_0x196c8e[_0x7d2e('0x15')]?_0x196c8e[_0x7d2e('0x15')][_0x7d2e('0x17')]||null:null,'attributes':_0x196c8e['options']?_0x196c8e['options']['attributes']||null:null,'limit':_0x196c8e[_0x7d2e('0x15')]?_0x196c8e[_0x7d2e('0x15')][_0x7d2e('0x18')]||null:null,'include':_0x196c8e[_0x7d2e('0x15')]?_0x196c8e['options'][_0x7d2e('0x19')]?_[_0x7d2e('0x1a')](_0x196c8e[_0x7d2e('0x15')]['include'],function(_0x131f6c){return{'model':db[_0x131f6c[_0x7d2e('0x1b')]],'as':_0x131f6c['as'],'attributes':_0x131f6c[_0x7d2e('0x1c')],'include':_0x131f6c[_0x7d2e('0x19')]?_[_0x7d2e('0x1a')](_0x131f6c['include'],function(_0x589607){return{'model':db[_0x589607[_0x7d2e('0x1b')]],'as':_0x589607['as'],'attributes':_0x589607[_0x7d2e('0x1c')],'include':_0x589607[_0x7d2e('0x19')]?_['map'](_0x589607[_0x7d2e('0x19')],function(_0x316458){return{'model':db[_0x316458['model']],'as':_0x316458['as'],'attributes':_0x316458['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d2e('0x8')](function(_0x43aff1){logger[_0x7d2e('0x9')]('GetDeskAccount',_0x196c8e);logger['debug']('GetDeskAccount',_0x196c8e,JSON['stringify'](_0x43aff1));_0x315568(_0x43aff1);})[_0x7d2e('0x13')](function(_0x51bd57){logger[_0x7d2e('0x11')]('GetDeskAccount',_0x51bd57[_0x7d2e('0x10')],_0x196c8e);_0x5ee9b0(_0x1d4561['error'](0x1f4,_0x51bd57['message']));});});};exports[_0x7d2e('0x1d')]=function(_0x2593c5){var _0x393833=this;return new Promise(function(_0x5290ff,_0x450f28){return db['DeskAccount']['find']({'raw':_0x2593c5[_0x7d2e('0x15')]?_0x2593c5[_0x7d2e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2593c5[_0x7d2e('0x15')]?_0x2593c5['options'][_0x7d2e('0x17')]||null:null,'attributes':_0x2593c5[_0x7d2e('0x15')]?_0x2593c5[_0x7d2e('0x15')][_0x7d2e('0x1c')]||null:null,'include':_0x2593c5[_0x7d2e('0x15')]?_0x2593c5[_0x7d2e('0x15')][_0x7d2e('0x19')]?_[_0x7d2e('0x1a')](_0x2593c5[_0x7d2e('0x15')][_0x7d2e('0x19')],function(_0x258cbb){return{'model':db[_0x258cbb['model']],'as':_0x258cbb['as'],'attributes':_0x258cbb[_0x7d2e('0x1c')],'include':_0x258cbb['include']?_[_0x7d2e('0x1a')](_0x258cbb[_0x7d2e('0x19')],function(_0x1c7b11){return{'model':db[_0x1c7b11[_0x7d2e('0x1b')]],'as':_0x1c7b11['as'],'attributes':_0x1c7b11[_0x7d2e('0x1c')],'include':_0x1c7b11[_0x7d2e('0x19')]?_[_0x7d2e('0x1a')](_0x1c7b11[_0x7d2e('0x19')],function(_0x534883){return{'model':db[_0x534883[_0x7d2e('0x1b')]],'as':_0x534883['as'],'attributes':_0x534883[_0x7d2e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x222cef){logger[_0x7d2e('0x9')](_0x7d2e('0x1d'),_0x2593c5);logger[_0x7d2e('0xc')](_0x7d2e('0x1d'),_0x2593c5,JSON[_0x7d2e('0xe')](_0x222cef));_0x5290ff(_0x222cef);})[_0x7d2e('0x13')](function(_0x2958c5){logger[_0x7d2e('0x11')](_0x7d2e('0x1d'),_0x2958c5[_0x7d2e('0x10')],_0x2593c5);_0x450f28(_0x393833[_0x7d2e('0x11')](0x1f4,_0x2958c5[_0x7d2e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cacd7d5..436d29b 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(_0x4db07d,_0x41b038){var _0xd4ec5a=function(_0x5f3cf0){while(--_0x5f3cf0){_0x4db07d['push'](_0x4db07d['shift']());}};_0xd4ec5a(++_0x41b038);}(_0xedd9,0xfc));var _0x9edd=function(_0x341978,_0x444c42){_0x341978=_0x341978-0x0;var _0x223840=_0xedd9[_0x341978];return _0x223840;};'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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x55ca,0x126));var _0xa55c=function(_0x2dfe07,_0x2b663f){_0x2dfe07=_0x2dfe07-0x0;var _0x30aee0=_0x55ca[_0x2dfe07];return _0x30aee0;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1293883..ec19727 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 _0x2d38=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d38,0x145));var _0x82d3=function(_0x500a1f,_0x14745f){_0x500a1f=_0x500a1f-0x0;var _0x2f5bd7=_0x2d38[_0x500a1f];return _0x2f5bd7;};'use strict';var Sequelize=require(_0x82d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x82d3('0x1')]},'description':{'type':Sequelize[_0x82d3('0x1')]}}; \ No newline at end of file +var _0x56c3=['STRING','sequelize','exports'];(function(_0x5341d2,_0x2da6d6){var _0x3a4d6a=function(_0x254688){while(--_0x254688){_0x5341d2['push'](_0x5341d2['shift']());}};_0x3a4d6a(++_0x2da6d6);}(_0x56c3,0x106));var _0x356c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x356c('0x0'));module[_0x356c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x356c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index deeb9fa..87edf37 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 _0xc056=['sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','catch','create','body','find','getFields','findOne','DeskField','order','pick','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x825c1,_0x4dc284){var _0x25944=function(_0x285d9d){while(--_0x285d9d){_0x825c1['push'](_0x825c1['shift']());}};_0x25944(++_0x4dc284);}(_0xc056,0x1a2));var _0x6c05=function(_0x1b61ee,_0x50ab35){_0x1b61ee=_0x1b61ee-0x0;var _0x471dc6=_0xc056[_0x1b61ee];return _0x471dc6;};'use strict';var emlformat=require(_0x6c05('0x0'));var rimraf=require(_0x6c05('0x1'));var zipdir=require(_0x6c05('0x2'));var jsonpatch=require(_0x6c05('0x3'));var rp=require('request-promise');var moment=require(_0x6c05('0x4'));var BPromise=require(_0x6c05('0x5'));var Mustache=require(_0x6c05('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c05('0x7'));var csv=require(_0x6c05('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c05('0x9'));var _=require('lodash');var squel=require(_0x6c05('0xa'));var crypto=require(_0x6c05('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c05('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c05('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c05('0xe'));var authService=require(_0x6c05('0xf'));var qs=require(_0x6c05('0x10'));var as=require(_0x6c05('0x11'));var hardwareService=require(_0x6c05('0x12'));var logger=require(_0x6c05('0x13'))(_0x6c05('0x14'));var utils=require(_0x6c05('0x15'));var config=require(_0x6c05('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f794,_0x2063aa){_0x2063aa=_0x2063aa||0xcc;return function(_0x11dec6){if(_0x11dec6){return _0x48f794['sendStatus'](_0x2063aa);}return _0x48f794[_0x6c05('0x17')](_0x2063aa)[_0x6c05('0x18')]();};}function respondWithResult(_0x4637cb,_0x21063e){_0x21063e=_0x21063e||0xc8;return function(_0x223d6a){if(_0x223d6a){return _0x4637cb[_0x6c05('0x17')](_0x21063e)[_0x6c05('0x19')](_0x223d6a);}};}function respondWithFilteredResult(_0x2b9b9b,_0x515fbf){return function(_0xf2c406){if(_0xf2c406){var _0x430a5a=typeof _0x515fbf['offset']===_0x6c05('0x1a')&&typeof _0x515fbf[_0x6c05('0x1b')]==='undefined';var _0x4aa44f=_0xf2c406[_0x6c05('0x1c')];var _0x4bb613=_0x430a5a?0x0:_0x515fbf[_0x6c05('0x1d')];var _0xfe6e8b=_0x430a5a?_0xf2c406['count']:_0x515fbf[_0x6c05('0x1d')]+_0x515fbf['limit'];var _0x436de5;if(_0xfe6e8b>=_0x4aa44f){_0xfe6e8b=_0x4aa44f;_0x436de5=0xc8;}else{_0x436de5=0xce;}_0x2b9b9b[_0x6c05('0x17')](_0x436de5);return _0x2b9b9b['set'](_0x6c05('0x1e'),_0x4bb613+'-'+_0xfe6e8b+'/'+_0x4aa44f)[_0x6c05('0x19')](_0xf2c406);}return null;};}function patchUpdates(_0x22b434){return function(_0x47a2c8){try{jsonpatch[_0x6c05('0x1f')](_0x47a2c8,_0x22b434,!![]);}catch(_0xb72b1){return BPromise['reject'](_0xb72b1);}return _0x47a2c8[_0x6c05('0x20')]();};}function saveUpdates(_0x562ea1,_0x3867a9){return function(_0x111064){if(_0x111064){return _0x111064[_0x6c05('0x21')](_0x562ea1)[_0x6c05('0x22')](function(_0x5f138b){return _0x5f138b;});}return null;};}function removeEntity(_0x5e97e4,_0x3e7bd5){return function(_0x3703e7){if(_0x3703e7){return _0x3703e7[_0x6c05('0x23')]()['then'](function(){_0x5e97e4[_0x6c05('0x17')](0xcc)[_0x6c05('0x18')]();});}};}function handleEntityNotFound(_0x20afb7,_0x5da324){return function(_0x45a511){if(!_0x45a511){_0x20afb7[_0x6c05('0x24')](0x194);}return _0x45a511;};}function handleError(_0x2b16c8,_0x27a562){_0x27a562=_0x27a562||0x1f4;return function(_0x4ab7ef){logger[_0x6c05('0x25')](_0x4ab7ef[_0x6c05('0x26')]);if(_0x4ab7ef[_0x6c05('0x27')]){delete _0x4ab7ef[_0x6c05('0x27')];}_0x2b16c8[_0x6c05('0x17')](_0x27a562)[_0x6c05('0x28')](_0x4ab7ef);};}exports[_0x6c05('0x29')]=function(_0x9b196a,_0x4c672e){var _0x4a0bbf={},_0x2ec0e0={},_0x454b9f={'count':0x0,'rows':[]};var _0x24cb87=_[_0x6c05('0x2a')](db[_0x6c05('0x2b')][_0x6c05('0x2c')],function(_0x4def96){return{'name':_0x4def96[_0x6c05('0x2d')],'type':_0x4def96[_0x6c05('0x2e')][_0x6c05('0x2f')]};});_0x2ec0e0['model']=_[_0x6c05('0x2a')](_0x24cb87,_0x6c05('0x27'));_0x2ec0e0[_0x6c05('0x30')]=_['keys'](_0x9b196a[_0x6c05('0x30')]);_0x2ec0e0[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x2ec0e0['model'],_0x2ec0e0[_0x6c05('0x30')]);_0x4a0bbf[_0x6c05('0x33')]=_['intersection'](_0x2ec0e0['model'],qs[_0x6c05('0x34')](_0x9b196a[_0x6c05('0x30')][_0x6c05('0x34')]));_0x4a0bbf[_0x6c05('0x33')]=_0x4a0bbf[_0x6c05('0x33')]['length']?_0x4a0bbf['attributes']:_0x2ec0e0[_0x6c05('0x35')];if(!_0x9b196a[_0x6c05('0x30')]['hasOwnProperty'](_0x6c05('0x36'))){_0x4a0bbf[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x9b196a[_0x6c05('0x30')]['limit']);_0x4a0bbf[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x9b196a[_0x6c05('0x30')]['offset']);}_0x4a0bbf['order']=qs[_0x6c05('0x37')](_0x9b196a[_0x6c05('0x30')][_0x6c05('0x37')]);_0x4a0bbf[_0x6c05('0x38')]=qs[_0x6c05('0x31')](_['pick'](_0x9b196a[_0x6c05('0x30')],_0x2ec0e0[_0x6c05('0x31')]),_0x24cb87);if(_0x9b196a[_0x6c05('0x30')][_0x6c05('0x39')]){_0x4a0bbf[_0x6c05('0x38')]=_[_0x6c05('0x3a')](_0x4a0bbf[_0x6c05('0x38')],{'$or':_[_0x6c05('0x2a')](_0x24cb87,function(_0x516a69){if(_0x516a69['type']!==_0x6c05('0x3b')){var _0x1678f8={};_0x1678f8[_0x516a69[_0x6c05('0x27')]]={'$like':'%'+_0x9b196a[_0x6c05('0x30')][_0x6c05('0x39')]+'%'};return _0x1678f8;}})});}_0x4a0bbf=_[_0x6c05('0x3a')]({},_0x4a0bbf,_0x9b196a[_0x6c05('0x3c')]);var _0x493896={'where':_0x4a0bbf[_0x6c05('0x38')]};return db[_0x6c05('0x2b')][_0x6c05('0x1c')](_0x493896)['then'](function(_0x21b910){_0x454b9f['count']=_0x21b910;if(_0x9b196a[_0x6c05('0x30')]['includeAll']){_0x4a0bbf[_0x6c05('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x6c05('0x3e')](_0x4a0bbf);})[_0x6c05('0x22')](function(_0x2b1453){_0x454b9f[_0x6c05('0x3f')]=_0x2b1453;return _0x454b9f;})['then'](respondWithFilteredResult(_0x4c672e,_0x4a0bbf))['catch'](handleError(_0x4c672e,null));};exports[_0x6c05('0x40')]=function(_0x61eae,_0x5276ec){var _0x2fdfd1={'raw':![],'where':{'id':_0x61eae[_0x6c05('0x41')]['id']}},_0x26f739={};_0x26f739['model']=_[_0x6c05('0x42')](db[_0x6c05('0x2b')][_0x6c05('0x2c')]);_0x26f739[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x61eae[_0x6c05('0x30')]);_0x26f739[_0x6c05('0x31')]=_['intersection'](_0x26f739['model'],_0x26f739[_0x6c05('0x30')]);_0x2fdfd1[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x26f739[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x61eae['query'][_0x6c05('0x34')]));_0x2fdfd1[_0x6c05('0x33')]=_0x2fdfd1[_0x6c05('0x33')][_0x6c05('0x43')]?_0x2fdfd1['attributes']:_0x26f739['model'];if(_0x61eae[_0x6c05('0x30')][_0x6c05('0x44')]){_0x2fdfd1[_0x6c05('0x3d')]=[{'all':!![]}];}_0x2fdfd1=_[_0x6c05('0x3a')]({},_0x2fdfd1,_0x61eae[_0x6c05('0x3c')]);return db['DeskConfiguration']['find'](_0x2fdfd1)[_0x6c05('0x22')](handleEntityNotFound(_0x5276ec,null))[_0x6c05('0x22')](respondWithResult(_0x5276ec,null))[_0x6c05('0x45')](handleError(_0x5276ec,null));};exports[_0x6c05('0x46')]=function(_0x14d5e5,_0x59d1d9){return db[_0x6c05('0x2b')]['create'](_0x14d5e5[_0x6c05('0x47')],{})[_0x6c05('0x22')](respondWithResult(_0x59d1d9,0xc9))['catch'](handleError(_0x59d1d9,null));};exports[_0x6c05('0x21')]=function(_0x334230,_0x429efe){if(_0x334230['body']['id']){delete _0x334230[_0x6c05('0x47')]['id'];}return db[_0x6c05('0x2b')][_0x6c05('0x48')]({'where':{'id':_0x334230['params']['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x429efe,null))['then'](saveUpdates(_0x334230['body'],null))[_0x6c05('0x22')](respondWithResult(_0x429efe,null))[_0x6c05('0x45')](handleError(_0x429efe,null));};exports[_0x6c05('0x23')]=function(_0x1d58b9,_0xd6d10f){return db[_0x6c05('0x2b')][_0x6c05('0x48')]({'where':{'id':_0x1d58b9[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0xd6d10f,null))['then'](removeEntity(_0xd6d10f,null))[_0x6c05('0x45')](handleError(_0xd6d10f,null));};exports[_0x6c05('0x49')]=function(_0xf30876,_0x54b9f6,_0x3b21ba){var _0x227c91={};var _0x49335e={};var _0x5ed2f9;var _0x50be11;return db[_0x6c05('0x2b')][_0x6c05('0x4a')]({'where':{'id':_0xf30876[_0x6c05('0x41')]['id']}})['then'](handleEntityNotFound(_0x54b9f6,null))[_0x6c05('0x22')](function(_0x1ce1ca){if(_0x1ce1ca){_0x5ed2f9=_0x1ce1ca;_0x49335e[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x49335e[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0xf30876['query']);_0x49335e[_0x6c05('0x31')]=_['intersection'](_0x49335e[_0x6c05('0x35')],_0x49335e['query']);_0x227c91[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x49335e[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0xf30876[_0x6c05('0x30')]['fields']));_0x227c91[_0x6c05('0x33')]=_0x227c91[_0x6c05('0x33')][_0x6c05('0x43')]?_0x227c91[_0x6c05('0x33')]:_0x49335e[_0x6c05('0x35')];_0x227c91[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0xf30876[_0x6c05('0x30')][_0x6c05('0x37')]);_0x227c91['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0xf30876[_0x6c05('0x30')],_0x49335e['filters']));if(_0xf30876[_0x6c05('0x30')][_0x6c05('0x39')]){_0x227c91['where']=_[_0x6c05('0x3a')](_0x227c91['where'],{'$or':_['map'](_0x227c91[_0x6c05('0x33')],function(_0x390962){var _0x3a2755={};_0x3a2755[_0x390962]={'$like':'%'+_0xf30876['query'][_0x6c05('0x39')]+'%'};return _0x3a2755;})});}_0x227c91=_[_0x6c05('0x3a')]({},_0x227c91,_0xf30876[_0x6c05('0x3c')]);return _0x5ed2f9['getFields'](_0x227c91);}})['then'](function(_0x18d133){if(_0x18d133){_0x50be11=_0x18d133[_0x6c05('0x43')];if(!_0xf30876[_0x6c05('0x30')][_0x6c05('0x4e')]('nolimit')){_0x227c91[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0xf30876['query'][_0x6c05('0x1b')]);_0x227c91[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0xf30876['query']['offset']);}return _0x5ed2f9['getFields'](_0x227c91);}})[_0x6c05('0x22')](function(_0x3ad8c9){if(_0x3ad8c9){return _0x3ad8c9?{'count':_0x50be11,'rows':_0x3ad8c9}:null;}})[_0x6c05('0x22')](respondWithResult(_0x54b9f6,null))[_0x6c05('0x45')](handleError(_0x54b9f6,null));};exports['getSubjects']=function(_0x58fda0,_0x53d023,_0x489eb3){var _0x313e4d={};var _0x2e8f55={};var _0x5c5d78;var _0x15f8eb;return db['DeskConfiguration'][_0x6c05('0x4a')]({'where':{'id':_0x58fda0[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x53d023,null))[_0x6c05('0x22')](function(_0x501326){if(_0x501326){_0x5c5d78=_0x501326;_0x2e8f55['model']=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x2e8f55[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x58fda0[_0x6c05('0x30')]);_0x2e8f55[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x2e8f55[_0x6c05('0x35')],_0x2e8f55[_0x6c05('0x30')]);_0x313e4d['attributes']=_['intersection'](_0x2e8f55[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x58fda0['query'][_0x6c05('0x34')]));_0x313e4d[_0x6c05('0x33')]=_0x313e4d[_0x6c05('0x33')][_0x6c05('0x43')]?_0x313e4d['attributes']:_0x2e8f55[_0x6c05('0x35')];_0x313e4d[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0x58fda0[_0x6c05('0x30')][_0x6c05('0x37')]);_0x313e4d['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0x58fda0[_0x6c05('0x30')],_0x2e8f55['filters']));if(_0x58fda0[_0x6c05('0x30')]['filter']){_0x313e4d['where']=_[_0x6c05('0x3a')](_0x313e4d[_0x6c05('0x38')],{'$or':_[_0x6c05('0x2a')](_0x313e4d[_0x6c05('0x33')],function(_0x8a6895){var _0x56c0c4={};_0x56c0c4[_0x8a6895]={'$like':'%'+_0x58fda0[_0x6c05('0x30')]['filter']+'%'};return _0x56c0c4;})});}_0x313e4d=_[_0x6c05('0x3a')]({},_0x313e4d,_0x58fda0[_0x6c05('0x3c')]);return _0x5c5d78[_0x6c05('0x4f')](_0x313e4d);}})[_0x6c05('0x22')](function(_0x428024){if(_0x428024){_0x15f8eb=_0x428024[_0x6c05('0x43')];if(!_0x58fda0[_0x6c05('0x30')]['hasOwnProperty'](_0x6c05('0x36'))){_0x313e4d[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x58fda0['query']['limit']);_0x313e4d[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x58fda0[_0x6c05('0x30')][_0x6c05('0x1d')]);}return _0x5c5d78[_0x6c05('0x4f')](_0x313e4d);}})['then'](function(_0x413340){if(_0x413340){return _0x413340?{'count':_0x15f8eb,'rows':_0x413340}:null;}})['then'](respondWithResult(_0x53d023,null))[_0x6c05('0x45')](handleError(_0x53d023,null));};exports[_0x6c05('0x50')]=function(_0x3d18dc,_0x22443d,_0x9de535){var _0x25f76c={};var _0x189b39={};var _0x4da18b;var _0x4af4f9;return db['DeskConfiguration'][_0x6c05('0x4a')]({'where':{'id':_0x3d18dc[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x22443d,null))[_0x6c05('0x22')](function(_0x147401){if(_0x147401){_0x4da18b=_0x147401;_0x189b39[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x189b39[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x3d18dc[_0x6c05('0x30')]);_0x189b39[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x189b39[_0x6c05('0x35')],_0x189b39[_0x6c05('0x30')]);_0x25f76c[_0x6c05('0x33')]=_['intersection'](_0x189b39[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x3d18dc['query'][_0x6c05('0x34')]));_0x25f76c[_0x6c05('0x33')]=_0x25f76c[_0x6c05('0x33')][_0x6c05('0x43')]?_0x25f76c[_0x6c05('0x33')]:_0x189b39[_0x6c05('0x35')];_0x25f76c[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x37')]);_0x25f76c[_0x6c05('0x38')]=qs[_0x6c05('0x31')](_['pick'](_0x3d18dc[_0x6c05('0x30')],_0x189b39[_0x6c05('0x31')]));if(_0x3d18dc['query'][_0x6c05('0x39')]){_0x25f76c[_0x6c05('0x38')]=_['merge'](_0x25f76c[_0x6c05('0x38')],{'$or':_['map'](_0x25f76c[_0x6c05('0x33')],function(_0x1cc117){var _0x5090f5={};_0x5090f5[_0x1cc117]={'$like':'%'+_0x3d18dc['query'][_0x6c05('0x39')]+'%'};return _0x5090f5;})});}_0x25f76c=_[_0x6c05('0x3a')]({},_0x25f76c,_0x3d18dc[_0x6c05('0x3c')]);return _0x4da18b[_0x6c05('0x50')](_0x25f76c);}})[_0x6c05('0x22')](function(_0xdfa78f){if(_0xdfa78f){_0x4af4f9=_0xdfa78f[_0x6c05('0x43')];if(!_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x4e')](_0x6c05('0x36'))){_0x25f76c[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x1b')]);_0x25f76c['offset']=qs['offset'](_0x3d18dc[_0x6c05('0x30')]['offset']);}return _0x4da18b[_0x6c05('0x50')](_0x25f76c);}})[_0x6c05('0x22')](function(_0x10d433){if(_0x10d433){return _0x10d433?{'count':_0x4af4f9,'rows':_0x10d433}:null;}})[_0x6c05('0x22')](respondWithResult(_0x22443d,null))[_0x6c05('0x45')](handleError(_0x22443d,null));};exports['getTags']=function(_0x2f653f,_0x199480,_0x562cbb){var _0x328f09={};var _0x40c46f={};var _0x22a08a;var _0x52f813;return db[_0x6c05('0x2b')][_0x6c05('0x4a')]({'where':{'id':_0x2f653f['params']['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x199480,null))[_0x6c05('0x22')](function(_0x53405e){if(_0x53405e){_0x22a08a=_0x53405e;_0x40c46f[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x51')]['rawAttributes']);_0x40c46f[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x2f653f['query']);_0x40c46f[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x40c46f['model'],_0x40c46f['query']);_0x328f09[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x40c46f[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x34')]));_0x328f09[_0x6c05('0x33')]=_0x328f09[_0x6c05('0x33')][_0x6c05('0x43')]?_0x328f09[_0x6c05('0x33')]:_0x40c46f[_0x6c05('0x35')];_0x328f09['order']=qs[_0x6c05('0x37')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x37')]);_0x328f09['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0x2f653f['query'],_0x40c46f[_0x6c05('0x31')]));if(_0x2f653f['query']['filter']){_0x328f09['where']=_[_0x6c05('0x3a')](_0x328f09['where'],{'$or':_['map'](_0x328f09[_0x6c05('0x33')],function(_0x4ce1cd){var _0x1eb652={};_0x1eb652[_0x4ce1cd]={'$like':'%'+_0x2f653f[_0x6c05('0x30')][_0x6c05('0x39')]+'%'};return _0x1eb652;})});}_0x328f09=_['merge']({},_0x328f09,_0x2f653f[_0x6c05('0x3c')]);return _0x22a08a[_0x6c05('0x52')](_0x328f09);}})[_0x6c05('0x22')](function(_0x40b32d){if(_0x40b32d){_0x52f813=_0x40b32d['length'];if(!_0x2f653f[_0x6c05('0x30')][_0x6c05('0x4e')](_0x6c05('0x36'))){_0x328f09['limit']=qs[_0x6c05('0x1b')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x1b')]);_0x328f09[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x1d')]);}return _0x22a08a['getTags'](_0x328f09);}})['then'](function(_0x50e5ff){if(_0x50e5ff){return _0x50e5ff?{'count':_0x52f813,'rows':_0x50e5ff}:null;}})[_0x6c05('0x22')](respondWithResult(_0x199480,null))['catch'](handleError(_0x199480,null));};exports[_0x6c05('0x53')]=function(_0x12c679,_0xc0ee9a,_0x2c762c){if(_0x12c679[_0x6c05('0x47')]['id']){delete _0x12c679[_0x6c05('0x47')]['id'];}return db[_0x6c05('0x2b')]['findOne']({'where':{'id':_0x12c679[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0xc0ee9a,null))[_0x6c05('0x22')](function(_0x1f5d5b){if(_0x1f5d5b){return _0x1f5d5b[_0x6c05('0x53')](_0x12c679[_0x6c05('0x47')][_0x6c05('0x54')]||[]);}return null;})[_0x6c05('0x22')](respondWithResult(_0xc0ee9a,null))[_0x6c05('0x45')](handleError(_0xc0ee9a,null));}; \ No newline at end of file +var _0x61a8=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','destroy','findOne','keys','DeskField','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','set','Content-Range','json','save','then','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','offset','order'];(function(_0x593d2b,_0x16f9c1){var _0x2a8e16=function(_0x416625){while(--_0x416625){_0x593d2b['push'](_0x593d2b['shift']());}};_0x2a8e16(++_0x16f9c1);}(_0x61a8,0x1ad));var _0x861a=function(_0x789179,_0x455e5f){_0x789179=_0x789179-0x0;var _0x10878f=_0x61a8[_0x789179];return _0x10878f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x861a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x861a('0x1'));var moment=require('moment');var BPromise=require(_0x861a('0x2'));var Mustache=require(_0x861a('0x3'));var util=require('util');var path=require(_0x861a('0x4'));var sox=require('sox');var csv=require(_0x861a('0x5'));var ejs=require(_0x861a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x861a('0x7'));var squel=require(_0x861a('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x861a('0x9'));var Papa=require(_0x861a('0xa'));var Redis=require(_0x861a('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x861a('0xc'));var as=require(_0x861a('0xd'));var hardwareService=require(_0x861a('0xe'));var logger=require(_0x861a('0xf'))(_0x861a('0x10'));var utils=require('../../config/utils');var config=require(_0x861a('0x11'));var licenseUtil=require(_0x861a('0x12'));var db=require(_0x861a('0x13'))['db'];function respondWithStatusCode(_0x11953a,_0x2f11b1){_0x2f11b1=_0x2f11b1||0xcc;return function(_0x539110){if(_0x539110){return _0x11953a[_0x861a('0x14')](_0x2f11b1);}return _0x11953a[_0x861a('0x15')](_0x2f11b1)[_0x861a('0x16')]();};}function respondWithResult(_0x4cae0a,_0x199ab1){_0x199ab1=_0x199ab1||0xc8;return function(_0x52d6d5){if(_0x52d6d5){return _0x4cae0a['status'](_0x199ab1)['json'](_0x52d6d5);}};}function respondWithFilteredResult(_0x1a7655,_0x5ab7d6){return function(_0x196269){if(_0x196269){var _0x10dbe4=typeof _0x5ab7d6['offset']===_0x861a('0x17')&&typeof _0x5ab7d6['limit']==='undefined';var _0x47ecca=_0x196269[_0x861a('0x18')];var _0x2edc36=_0x10dbe4?0x0:_0x5ab7d6['offset'];var _0x1d62fd=_0x10dbe4?_0x196269[_0x861a('0x18')]:_0x5ab7d6['offset']+_0x5ab7d6['limit'];var _0x55b738;if(_0x1d62fd>=_0x47ecca){_0x1d62fd=_0x47ecca;_0x55b738=0xc8;}else{_0x55b738=0xce;}_0x1a7655[_0x861a('0x15')](_0x55b738);return _0x1a7655[_0x861a('0x19')](_0x861a('0x1a'),_0x2edc36+'-'+_0x1d62fd+'/'+_0x47ecca)[_0x861a('0x1b')](_0x196269);}return null;};}function patchUpdates(_0x156ec1){return function(_0x489f43){try{jsonpatch['apply'](_0x489f43,_0x156ec1,!![]);}catch(_0x11b7f2){return BPromise['reject'](_0x11b7f2);}return _0x489f43[_0x861a('0x1c')]();};}function saveUpdates(_0x40897d,_0x23099f){return function(_0x4cac2f){if(_0x4cac2f){return _0x4cac2f['update'](_0x40897d)[_0x861a('0x1d')](function(_0x466778){return _0x466778;});}return null;};}function removeEntity(_0x26c9c7,_0x2424e9){return function(_0x317708){if(_0x317708){return _0x317708['destroy']()[_0x861a('0x1d')](function(){_0x26c9c7[_0x861a('0x15')](0xcc)[_0x861a('0x16')]();});}};}function handleEntityNotFound(_0x553b99,_0x977cd8){return function(_0x13e192){if(!_0x13e192){_0x553b99['sendStatus'](0x194);}return _0x13e192;};}function handleError(_0x12cfd5,_0x50267e){_0x50267e=_0x50267e||0x1f4;return function(_0x73d191){logger['error'](_0x73d191[_0x861a('0x1e')]);if(_0x73d191[_0x861a('0x1f')]){delete _0x73d191['name'];}_0x12cfd5['status'](_0x50267e)[_0x861a('0x20')](_0x73d191);};}exports[_0x861a('0x21')]=function(_0x84a61f,_0x1462a0){var _0x5f2edb={},_0x3e6734={},_0x31938f={'count':0x0,'rows':[]};var _0x49d263=_['map'](db[_0x861a('0x22')][_0x861a('0x23')],function(_0xb8e69e){return{'name':_0xb8e69e[_0x861a('0x24')],'type':_0xb8e69e[_0x861a('0x25')][_0x861a('0x26')]};});_0x3e6734['model']=_[_0x861a('0x27')](_0x49d263,_0x861a('0x1f'));_0x3e6734[_0x861a('0x28')]=_['keys'](_0x84a61f['query']);_0x3e6734[_0x861a('0x29')]=_[_0x861a('0x2a')](_0x3e6734[_0x861a('0x2b')],_0x3e6734[_0x861a('0x28')]);_0x5f2edb['attributes']=_[_0x861a('0x2a')](_0x3e6734['model'],qs[_0x861a('0x2c')](_0x84a61f[_0x861a('0x28')]['fields']));_0x5f2edb[_0x861a('0x2d')]=_0x5f2edb[_0x861a('0x2d')][_0x861a('0x2e')]?_0x5f2edb[_0x861a('0x2d')]:_0x3e6734[_0x861a('0x2b')];if(!_0x84a61f[_0x861a('0x28')][_0x861a('0x2f')]('nolimit')){_0x5f2edb[_0x861a('0x30')]=qs[_0x861a('0x30')](_0x84a61f[_0x861a('0x28')][_0x861a('0x30')]);_0x5f2edb[_0x861a('0x31')]=qs[_0x861a('0x31')](_0x84a61f[_0x861a('0x28')][_0x861a('0x31')]);}_0x5f2edb[_0x861a('0x32')]=qs[_0x861a('0x33')](_0x84a61f[_0x861a('0x28')][_0x861a('0x33')]);_0x5f2edb[_0x861a('0x34')]=qs['filters'](_[_0x861a('0x35')](_0x84a61f['query'],_0x3e6734[_0x861a('0x29')]),_0x49d263);if(_0x84a61f[_0x861a('0x28')][_0x861a('0x36')]){_0x5f2edb['where']=_[_0x861a('0x37')](_0x5f2edb[_0x861a('0x34')],{'$or':_[_0x861a('0x27')](_0x49d263,function(_0x43790c){if(_0x43790c[_0x861a('0x25')]!==_0x861a('0x38')){var _0xeedf92={};_0xeedf92[_0x43790c[_0x861a('0x1f')]]={'$like':'%'+_0x84a61f[_0x861a('0x28')][_0x861a('0x36')]+'%'};return _0xeedf92;}})});}_0x5f2edb=_[_0x861a('0x37')]({},_0x5f2edb,_0x84a61f[_0x861a('0x39')]);var _0x2bc34d={'where':_0x5f2edb[_0x861a('0x34')]};return db[_0x861a('0x22')][_0x861a('0x18')](_0x2bc34d)[_0x861a('0x1d')](function(_0x1cbcb2){_0x31938f['count']=_0x1cbcb2;if(_0x84a61f['query'][_0x861a('0x3a')]){_0x5f2edb[_0x861a('0x3b')]=[{'all':!![]}];}return db[_0x861a('0x22')][_0x861a('0x3c')](_0x5f2edb);})[_0x861a('0x1d')](function(_0x4de32c){_0x31938f['rows']=_0x4de32c;return _0x31938f;})[_0x861a('0x1d')](respondWithFilteredResult(_0x1462a0,_0x5f2edb))[_0x861a('0x3d')](handleError(_0x1462a0,null));};exports[_0x861a('0x3e')]=function(_0x179d16,_0x1c97d8){var _0xcbaf68={'raw':![],'where':{'id':_0x179d16[_0x861a('0x3f')]['id']}},_0x36e2d8={};_0x36e2d8['model']=_['keys'](db[_0x861a('0x22')][_0x861a('0x23')]);_0x36e2d8['query']=_['keys'](_0x179d16[_0x861a('0x28')]);_0x36e2d8[_0x861a('0x29')]=_[_0x861a('0x2a')](_0x36e2d8[_0x861a('0x2b')],_0x36e2d8[_0x861a('0x28')]);_0xcbaf68['attributes']=_[_0x861a('0x2a')](_0x36e2d8['model'],qs['fields'](_0x179d16[_0x861a('0x28')][_0x861a('0x2c')]));_0xcbaf68[_0x861a('0x2d')]=_0xcbaf68[_0x861a('0x2d')][_0x861a('0x2e')]?_0xcbaf68[_0x861a('0x2d')]:_0x36e2d8[_0x861a('0x2b')];if(_0x179d16[_0x861a('0x28')][_0x861a('0x3a')]){_0xcbaf68[_0x861a('0x3b')]=[{'all':!![]}];}_0xcbaf68=_['merge']({},_0xcbaf68,_0x179d16[_0x861a('0x39')]);return db[_0x861a('0x22')][_0x861a('0x40')](_0xcbaf68)['then'](handleEntityNotFound(_0x1c97d8,null))[_0x861a('0x1d')](respondWithResult(_0x1c97d8,null))[_0x861a('0x3d')](handleError(_0x1c97d8,null));};exports[_0x861a('0x41')]=function(_0x4fcee8,_0x1c2b40){return db['DeskConfiguration'][_0x861a('0x41')](_0x4fcee8['body'],{})['then'](respondWithResult(_0x1c2b40,0xc9))[_0x861a('0x3d')](handleError(_0x1c2b40,null));};exports[_0x861a('0x42')]=function(_0x1a68fd,_0x5990cd){if(_0x1a68fd[_0x861a('0x43')]['id']){delete _0x1a68fd[_0x861a('0x43')]['id'];}return db['DeskConfiguration'][_0x861a('0x40')]({'where':{'id':_0x1a68fd[_0x861a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5990cd,null))[_0x861a('0x1d')](saveUpdates(_0x1a68fd['body'],null))[_0x861a('0x1d')](respondWithResult(_0x5990cd,null))['catch'](handleError(_0x5990cd,null));};exports[_0x861a('0x44')]=function(_0x57b50f,_0x276711){return db[_0x861a('0x22')]['find']({'where':{'id':_0x57b50f[_0x861a('0x3f')]['id']}})[_0x861a('0x1d')](handleEntityNotFound(_0x276711,null))[_0x861a('0x1d')](removeEntity(_0x276711,null))[_0x861a('0x3d')](handleError(_0x276711,null));};exports['getFields']=function(_0x433e27,_0xdf1a77,_0x2088c9){var _0x16680b={};var _0x211b74={};var _0x14b08c;var _0x5cd2fe;return db[_0x861a('0x22')][_0x861a('0x45')]({'where':{'id':_0x433e27['params']['id']}})[_0x861a('0x1d')](handleEntityNotFound(_0xdf1a77,null))[_0x861a('0x1d')](function(_0x2701d9){if(_0x2701d9){_0x14b08c=_0x2701d9;_0x211b74[_0x861a('0x2b')]=_[_0x861a('0x46')](db[_0x861a('0x47')][_0x861a('0x23')]);_0x211b74[_0x861a('0x28')]=_[_0x861a('0x46')](_0x433e27[_0x861a('0x28')]);_0x211b74[_0x861a('0x29')]=_[_0x861a('0x2a')](_0x211b74['model'],_0x211b74['query']);_0x16680b[_0x861a('0x2d')]=_[_0x861a('0x2a')](_0x211b74['model'],qs[_0x861a('0x2c')](_0x433e27[_0x861a('0x28')][_0x861a('0x2c')]));_0x16680b[_0x861a('0x2d')]=_0x16680b[_0x861a('0x2d')][_0x861a('0x2e')]?_0x16680b[_0x861a('0x2d')]:_0x211b74[_0x861a('0x2b')];_0x16680b['order']=qs[_0x861a('0x33')](_0x433e27[_0x861a('0x28')][_0x861a('0x33')]);_0x16680b['where']=qs[_0x861a('0x29')](_[_0x861a('0x35')](_0x433e27[_0x861a('0x28')],_0x211b74['filters']));if(_0x433e27[_0x861a('0x28')][_0x861a('0x36')]){_0x16680b[_0x861a('0x34')]=_[_0x861a('0x37')](_0x16680b['where'],{'$or':_[_0x861a('0x27')](_0x16680b['attributes'],function(_0xbf36e6){var _0xabcb={};_0xabcb[_0xbf36e6]={'$like':'%'+_0x433e27[_0x861a('0x28')][_0x861a('0x36')]+'%'};return _0xabcb;})});}_0x16680b=_['merge']({},_0x16680b,_0x433e27[_0x861a('0x39')]);return _0x14b08c[_0x861a('0x48')](_0x16680b);}})['then'](function(_0x350c92){if(_0x350c92){_0x5cd2fe=_0x350c92['length'];if(!_0x433e27['query'][_0x861a('0x2f')](_0x861a('0x49'))){_0x16680b['limit']=qs[_0x861a('0x30')](_0x433e27[_0x861a('0x28')][_0x861a('0x30')]);_0x16680b[_0x861a('0x31')]=qs[_0x861a('0x31')](_0x433e27[_0x861a('0x28')][_0x861a('0x31')]);}return _0x14b08c[_0x861a('0x48')](_0x16680b);}})[_0x861a('0x1d')](function(_0x1c1105){if(_0x1c1105){return _0x1c1105?{'count':_0x5cd2fe,'rows':_0x1c1105}:null;}})[_0x861a('0x1d')](respondWithResult(_0xdf1a77,null))[_0x861a('0x3d')](handleError(_0xdf1a77,null));};exports['getSubjects']=function(_0x2d53e4,_0x4124ed,_0x131d70){var _0x5aff94={};var _0x1c0c78={};var _0x3ee353;var _0x32891e;return db[_0x861a('0x22')][_0x861a('0x45')]({'where':{'id':_0x2d53e4[_0x861a('0x3f')]['id']}})[_0x861a('0x1d')](handleEntityNotFound(_0x4124ed,null))[_0x861a('0x1d')](function(_0x1c0af0){if(_0x1c0af0){_0x3ee353=_0x1c0af0;_0x1c0c78['model']=_[_0x861a('0x46')](db['DeskField'][_0x861a('0x23')]);_0x1c0c78[_0x861a('0x28')]=_[_0x861a('0x46')](_0x2d53e4[_0x861a('0x28')]);_0x1c0c78[_0x861a('0x29')]=_[_0x861a('0x2a')](_0x1c0c78['model'],_0x1c0c78['query']);_0x5aff94[_0x861a('0x2d')]=_['intersection'](_0x1c0c78[_0x861a('0x2b')],qs['fields'](_0x2d53e4[_0x861a('0x28')][_0x861a('0x2c')]));_0x5aff94[_0x861a('0x2d')]=_0x5aff94['attributes'][_0x861a('0x2e')]?_0x5aff94[_0x861a('0x2d')]:_0x1c0c78[_0x861a('0x2b')];_0x5aff94['order']=qs[_0x861a('0x33')](_0x2d53e4[_0x861a('0x28')][_0x861a('0x33')]);_0x5aff94[_0x861a('0x34')]=qs[_0x861a('0x29')](_[_0x861a('0x35')](_0x2d53e4[_0x861a('0x28')],_0x1c0c78[_0x861a('0x29')]));if(_0x2d53e4[_0x861a('0x28')][_0x861a('0x36')]){_0x5aff94[_0x861a('0x34')]=_[_0x861a('0x37')](_0x5aff94[_0x861a('0x34')],{'$or':_[_0x861a('0x27')](_0x5aff94[_0x861a('0x2d')],function(_0x5d764a){var _0x43bc0c={};_0x43bc0c[_0x5d764a]={'$like':'%'+_0x2d53e4['query'][_0x861a('0x36')]+'%'};return _0x43bc0c;})});}_0x5aff94=_[_0x861a('0x37')]({},_0x5aff94,_0x2d53e4['options']);return _0x3ee353[_0x861a('0x4a')](_0x5aff94);}})[_0x861a('0x1d')](function(_0x575c5e){if(_0x575c5e){_0x32891e=_0x575c5e[_0x861a('0x2e')];if(!_0x2d53e4[_0x861a('0x28')][_0x861a('0x2f')](_0x861a('0x49'))){_0x5aff94[_0x861a('0x30')]=qs[_0x861a('0x30')](_0x2d53e4[_0x861a('0x28')][_0x861a('0x30')]);_0x5aff94[_0x861a('0x31')]=qs[_0x861a('0x31')](_0x2d53e4[_0x861a('0x28')][_0x861a('0x31')]);}return _0x3ee353[_0x861a('0x4a')](_0x5aff94);}})[_0x861a('0x1d')](function(_0x312072){if(_0x312072){return _0x312072?{'count':_0x32891e,'rows':_0x312072}:null;}})[_0x861a('0x1d')](respondWithResult(_0x4124ed,null))['catch'](handleError(_0x4124ed,null));};exports[_0x861a('0x4b')]=function(_0x47d9ee,_0x5456c5,_0x28cde1){var _0x4a28dc={};var _0x5690ce={};var _0x354cb2;var _0x166121;return db[_0x861a('0x22')][_0x861a('0x45')]({'where':{'id':_0x47d9ee['params']['id']}})[_0x861a('0x1d')](handleEntityNotFound(_0x5456c5,null))[_0x861a('0x1d')](function(_0x4d898c){if(_0x4d898c){_0x354cb2=_0x4d898c;_0x5690ce['model']=_[_0x861a('0x46')](db[_0x861a('0x47')][_0x861a('0x23')]);_0x5690ce[_0x861a('0x28')]=_['keys'](_0x47d9ee[_0x861a('0x28')]);_0x5690ce['filters']=_[_0x861a('0x2a')](_0x5690ce['model'],_0x5690ce[_0x861a('0x28')]);_0x4a28dc['attributes']=_['intersection'](_0x5690ce['model'],qs[_0x861a('0x2c')](_0x47d9ee[_0x861a('0x28')]['fields']));_0x4a28dc[_0x861a('0x2d')]=_0x4a28dc[_0x861a('0x2d')][_0x861a('0x2e')]?_0x4a28dc[_0x861a('0x2d')]:_0x5690ce[_0x861a('0x2b')];_0x4a28dc[_0x861a('0x32')]=qs[_0x861a('0x33')](_0x47d9ee[_0x861a('0x28')]['sort']);_0x4a28dc['where']=qs[_0x861a('0x29')](_['pick'](_0x47d9ee[_0x861a('0x28')],_0x5690ce[_0x861a('0x29')]));if(_0x47d9ee['query'][_0x861a('0x36')]){_0x4a28dc['where']=_[_0x861a('0x37')](_0x4a28dc[_0x861a('0x34')],{'$or':_[_0x861a('0x27')](_0x4a28dc[_0x861a('0x2d')],function(_0xd7acd4){var _0x47669c={};_0x47669c[_0xd7acd4]={'$like':'%'+_0x47d9ee[_0x861a('0x28')]['filter']+'%'};return _0x47669c;})});}_0x4a28dc=_[_0x861a('0x37')]({},_0x4a28dc,_0x47d9ee[_0x861a('0x39')]);return _0x354cb2['getDescriptions'](_0x4a28dc);}})[_0x861a('0x1d')](function(_0x4d47ba){if(_0x4d47ba){_0x166121=_0x4d47ba[_0x861a('0x2e')];if(!_0x47d9ee['query']['hasOwnProperty']('nolimit')){_0x4a28dc[_0x861a('0x30')]=qs[_0x861a('0x30')](_0x47d9ee[_0x861a('0x28')][_0x861a('0x30')]);_0x4a28dc['offset']=qs['offset'](_0x47d9ee[_0x861a('0x28')][_0x861a('0x31')]);}return _0x354cb2[_0x861a('0x4b')](_0x4a28dc);}})[_0x861a('0x1d')](function(_0x3680e5){if(_0x3680e5){return _0x3680e5?{'count':_0x166121,'rows':_0x3680e5}:null;}})[_0x861a('0x1d')](respondWithResult(_0x5456c5,null))['catch'](handleError(_0x5456c5,null));};exports[_0x861a('0x4c')]=function(_0x8d28cf,_0x582b4a,_0x2ee3ea){var _0x1a8d16={};var _0x431dd3={};var _0x4d3196;var _0x5b7971;return db['DeskConfiguration'][_0x861a('0x45')]({'where':{'id':_0x8d28cf[_0x861a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x582b4a,null))['then'](function(_0x41e34e){if(_0x41e34e){_0x4d3196=_0x41e34e;_0x431dd3['model']=_['keys'](db[_0x861a('0x4d')][_0x861a('0x23')]);_0x431dd3[_0x861a('0x28')]=_[_0x861a('0x46')](_0x8d28cf['query']);_0x431dd3[_0x861a('0x29')]=_['intersection'](_0x431dd3['model'],_0x431dd3[_0x861a('0x28')]);_0x1a8d16[_0x861a('0x2d')]=_[_0x861a('0x2a')](_0x431dd3[_0x861a('0x2b')],qs['fields'](_0x8d28cf[_0x861a('0x28')][_0x861a('0x2c')]));_0x1a8d16[_0x861a('0x2d')]=_0x1a8d16[_0x861a('0x2d')]['length']?_0x1a8d16['attributes']:_0x431dd3[_0x861a('0x2b')];_0x1a8d16['order']=qs[_0x861a('0x33')](_0x8d28cf[_0x861a('0x28')][_0x861a('0x33')]);_0x1a8d16[_0x861a('0x34')]=qs[_0x861a('0x29')](_['pick'](_0x8d28cf[_0x861a('0x28')],_0x431dd3[_0x861a('0x29')]));if(_0x8d28cf[_0x861a('0x28')][_0x861a('0x36')]){_0x1a8d16[_0x861a('0x34')]=_[_0x861a('0x37')](_0x1a8d16[_0x861a('0x34')],{'$or':_[_0x861a('0x27')](_0x1a8d16['attributes'],function(_0x5416d5){var _0x1ccb7e={};_0x1ccb7e[_0x5416d5]={'$like':'%'+_0x8d28cf['query'][_0x861a('0x36')]+'%'};return _0x1ccb7e;})});}_0x1a8d16=_['merge']({},_0x1a8d16,_0x8d28cf[_0x861a('0x39')]);return _0x4d3196[_0x861a('0x4c')](_0x1a8d16);}})[_0x861a('0x1d')](function(_0x5dc1a6){if(_0x5dc1a6){_0x5b7971=_0x5dc1a6[_0x861a('0x2e')];if(!_0x8d28cf[_0x861a('0x28')][_0x861a('0x2f')](_0x861a('0x49'))){_0x1a8d16[_0x861a('0x30')]=qs[_0x861a('0x30')](_0x8d28cf[_0x861a('0x28')][_0x861a('0x30')]);_0x1a8d16[_0x861a('0x31')]=qs[_0x861a('0x31')](_0x8d28cf[_0x861a('0x28')][_0x861a('0x31')]);}return _0x4d3196[_0x861a('0x4c')](_0x1a8d16);}})[_0x861a('0x1d')](function(_0x5ba745){if(_0x5ba745){return _0x5ba745?{'count':_0x5b7971,'rows':_0x5ba745}:null;}})[_0x861a('0x1d')](respondWithResult(_0x582b4a,null))[_0x861a('0x3d')](handleError(_0x582b4a,null));};exports[_0x861a('0x4e')]=function(_0x19a310,_0x4dba39,_0x4ab45c){if(_0x19a310[_0x861a('0x43')]['id']){delete _0x19a310[_0x861a('0x43')]['id'];}return db['DeskConfiguration'][_0x861a('0x45')]({'where':{'id':_0x19a310[_0x861a('0x3f')]['id']}})[_0x861a('0x1d')](handleEntityNotFound(_0x4dba39,null))[_0x861a('0x1d')](function(_0x2e91f9){if(_0x2e91f9){return _0x2e91f9[_0x861a('0x4e')](_0x19a310[_0x861a('0x43')][_0x861a('0x4f')]||[]);}return null;})[_0x861a('0x1d')](respondWithResult(_0x4dba39,null))['catch'](handleError(_0x4dba39,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 933e932..6a971ad 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 _0x48ef=['exports','define','DeskConfiguration','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x149105,_0x43dded){var _0x327a27=function(_0x3911b0){while(--_0x3911b0){_0x149105['push'](_0x149105['shift']());}};_0x327a27(++_0x43dded);}(_0x48ef,0x9d));var _0xf48e=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0x48ef[_0x57d671];return _0x450dfe;};'use strict';var _=require(_0xf48e('0x0'));var util=require(_0xf48e('0x1'));var logger=require('../../config/logger')(_0xf48e('0x2'));var moment=require(_0xf48e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf48e('0x4'));var fs=require('fs');var path=require(_0xf48e('0x5'));var rimraf=require(_0xf48e('0x6'));var config=require(_0xf48e('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xf48e('0x8')]=function(_0x3bb169,_0x19c6ad){return _0x3bb169[_0xf48e('0x9')](_0xf48e('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf478=['exports','define','DeskConfiguration','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1f0c12,_0x4a54ed){var _0x4289d2=function(_0x2ea045){while(--_0x2ea045){_0x1f0c12['push'](_0x1f0c12['shift']());}};_0x4289d2(++_0x4a54ed);}(_0xf478,0x1f2));var _0x8f47=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf478[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x8f47('0x0'));var util=require(_0x8f47('0x1'));var logger=require(_0x8f47('0x2'))(_0x8f47('0x3'));var moment=require('moment');var BPromise=require(_0x8f47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f47('0x5'));var rimraf=require('rimraf');var config=require(_0x8f47('0x6'));var attributes=require(_0x8f47('0x7'));module[_0x8f47('0x8')]=function(_0x68c9d5,_0x2a5162){return _0x68c9d5[_0x8f47('0x9')](_0x8f47('0xa'),attributes,{'tableName':'int_desk_configurations','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 9d62a9d..c4edd83 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 _0x2eba=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2eba,0xc7));var _0xa2eb=function(_0x5da100,_0x1bc2dd){_0x5da100=_0x5da100-0x0;var _0x18dd66=_0x2eba[_0x5da100];return _0x18dd66;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var moment=require(_0xa2eb('0x1'));var BPromise=require(_0xa2eb('0x2'));var rs=require(_0xa2eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2eb('0x4'));var logger=require('../../config/logger')(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var jayson=require(_0xa2eb('0x7'));var client=jayson[_0xa2eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545db3,_0x56b33a,_0x4ed534){return new BPromise(function(_0x550a3c,_0x56408f){return client[_0xa2eb('0x9')](_0x545db3,_0x4ed534)[_0xa2eb('0xa')](function(_0x5480a1){logger['info'](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));logger[_0xa2eb('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56b33a,_0xa2eb('0xc'),JSON[_0xa2eb('0xe')](_0x5480a1));if(_0x5480a1['error']){if(_0x5480a1[_0xa2eb('0xf')]['code']===0x1f4){logger[_0xa2eb('0xf')](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x56408f(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}logger['error'](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x550a3c(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}else{logger[_0xa2eb('0x11')](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));_0x550a3c(_0x5480a1[_0xa2eb('0x12')][_0xa2eb('0x10')]);}})[_0xa2eb('0x13')](function(_0x3a02d5){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x56b33a,_0x3a02d5);_0x56408f(_0x3a02d5);});});} \ No newline at end of file +var _0x1e9c=['http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x1e9c,0x1d9));var _0xc1e9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x1e9c[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xc1e9('0x0'));var util=require(_0xc1e9('0x1'));var moment=require(_0xc1e9('0x2'));var BPromise=require(_0xc1e9('0x3'));var rs=require(_0xc1e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1e9('0x5'));var logger=require(_0xc1e9('0x6'))(_0xc1e9('0x7'));var config=require(_0xc1e9('0x8'));var jayson=require(_0xc1e9('0x9'));var client=jayson[_0xc1e9('0xa')][_0xc1e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31b19b,_0x3bc857,_0x3b0e0e){return new BPromise(function(_0x32a7d7,_0x2d5428){return client['request'](_0x31b19b,_0x3b0e0e)[_0xc1e9('0xc')](function(_0x584283){logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x3bc857,'request\x20sent');logger[_0xc1e9('0xf')](_0xc1e9('0x10'),_0x3bc857,_0xc1e9('0x11'),JSON[_0xc1e9('0x12')](_0x584283));if(_0x584283[_0xc1e9('0x13')]){if(_0x584283['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3bc857,_0x584283[_0xc1e9('0x13')][_0xc1e9('0x14')]);return _0x2d5428(_0x584283[_0xc1e9('0x13')][_0xc1e9('0x14')]);}logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x3bc857,_0x584283['error'][_0xc1e9('0x14')]);return _0x32a7d7(_0x584283[_0xc1e9('0x13')]['message']);}else{logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x3bc857,'request\x20sent');_0x32a7d7(_0x584283[_0xc1e9('0x15')]['message']);}})['catch'](function(_0x49c70d){logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x3bc857,_0x49c70d);_0x2d5428(_0x49c70d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 99f980e..8e126c4 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 _0xa0a3=['put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','create'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x471bef,_0x5d881d){_0x471bef=_0x471bef-0x0;var _0x12de86=_0xa0a3[_0x471bef];return _0x12de86;};'use strict';var multer=require('multer');var util=require(_0x3a0a('0x0'));var path=require(_0x3a0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a0a('0x2'));var router=express[_0x3a0a('0x3')]();var fs_extra=require(_0x3a0a('0x4'));var auth=require(_0x3a0a('0x5'));var interaction=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var controller=require(_0x3a0a('0x8'));router[_0x3a0a('0x9')]('/',auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xb')]);router[_0x3a0a('0x9')](_0x3a0a('0xc'),auth[_0x3a0a('0xa')](),controller['show']);router['post']('/',auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xd')]);router[_0x3a0a('0xe')](_0x3a0a('0xc'),auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xf')]);router[_0x3a0a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3a0a('0x11')]);module[_0x3a0a('0x12')]=router; \ No newline at end of file +var _0x8b5c=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0xef34c5,_0xd17a9d){var _0x1de207=function(_0x3e8169){while(--_0x3e8169){_0xef34c5['push'](_0xef34c5['shift']());}};_0x1de207(++_0xd17a9d);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x1ac977,_0x35f941){_0x1ac977=_0x1ac977-0x0;var _0x5a0607=_0x8b5c[_0x1ac977];return _0x5a0607;};'use strict';var multer=require('multer');var util=require(_0xc8b5('0x0'));var path=require('path');var timeout=require(_0xc8b5('0x1'));var express=require(_0xc8b5('0x2'));var router=express['Router']();var fs_extra=require(_0xc8b5('0x3'));var auth=require(_0xc8b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b5('0x5'));var controller=require('./intDeskField.controller');router[_0xc8b5('0x6')]('/',auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x8')]);router[_0xc8b5('0x6')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xa')]);router[_0xc8b5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc8b5('0xc')]);router[_0xc8b5('0xd')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xe')]);router[_0xc8b5('0xf')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x10')]);module[_0xc8b5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1e28b12..9d2e2cf 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 _0x9ca4=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x9ca4,0x143));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ca('0x0'));module[_0x49ca('0x1')]={'type':{'type':Sequelize[_0x49ca('0x2')](_0x49ca('0x3'),_0x49ca('0x4'),_0x49ca('0x5'),_0x49ca('0x6'),_0x49ca('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49ca('0x8')]},'keyType':{'type':Sequelize[_0x49ca('0x2')](_0x49ca('0x3'),_0x49ca('0x4'),_0x49ca('0x5'))},'keyContent':{'type':Sequelize[_0x49ca('0x8')]},'idField':{'type':Sequelize[_0x49ca('0x8')]},'nameField':{'type':Sequelize[_0x49ca('0x8')]},'customField':{'type':Sequelize[_0x49ca('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49ca('0x8')]}}; \ No newline at end of file +var _0xfab2=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0xfab2,0x154));var _0x2fab=function(_0x4e42fd,_0x2af501){_0x4e42fd=_0x4e42fd-0x0;var _0x56024e=_0xfab2[_0x4e42fd];return _0x56024e;};'use strict';var Sequelize=require(_0x2fab('0x0'));module[_0x2fab('0x1')]={'type':{'type':Sequelize[_0x2fab('0x2')]('string',_0x2fab('0x3'),_0x2fab('0x4'),_0x2fab('0x5'),_0x2fab('0x6')),'defaultValue':_0x2fab('0x7')},'content':{'type':Sequelize[_0x2fab('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2fab('0x2')]('string',_0x2fab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2fab('0x8')]},'idField':{'type':Sequelize[_0x2fab('0x8')]},'nameField':{'type':Sequelize[_0x2fab('0x8')]},'customField':{'type':Sequelize[_0x2fab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2fab('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 73a45e5..18b529e 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 _0x4e86=['stack','send','map','DeskField','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','VIRTUAL','name','where','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','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','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','sendStatus','error'];(function(_0x283217,_0x286dc9){var _0x2efe89=function(_0x43ca65){while(--_0x43ca65){_0x283217['push'](_0x283217['shift']());}};_0x2efe89(++_0x286dc9);}(_0x4e86,0xf3));var _0x64e8=function(_0x51ade4,_0x190d60){_0x51ade4=_0x51ade4-0x0;var _0x13ac0d=_0x4e86[_0x51ade4];return _0x13ac0d;};'use strict';var emlformat=require(_0x64e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64e8('0x1'));var jsonpatch=require(_0x64e8('0x2'));var rp=require('request-promise');var moment=require(_0x64e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64e8('0x4'));var path=require('path');var sox=require(_0x64e8('0x5'));var csv=require(_0x64e8('0x6'));var ejs=require(_0x64e8('0x7'));var fs=require('fs');var fs_extra=require(_0x64e8('0x8'));var _=require(_0x64e8('0x9'));var squel=require(_0x64e8('0xa'));var crypto=require(_0x64e8('0xb'));var jsforce=require(_0x64e8('0xc'));var deskjs=require(_0x64e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64e8('0xe'));var Papa=require('papaparse');var Redis=require(_0x64e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x64e8('0x10'));var as=require(_0x64e8('0x11'));var hardwareService=require(_0x64e8('0x12'));var logger=require(_0x64e8('0x13'))(_0x64e8('0x14'));var utils=require(_0x64e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64e8('0x16'))['db'];function respondWithStatusCode(_0x398eb5,_0x454bec){_0x454bec=_0x454bec||0xcc;return function(_0x1545a5){if(_0x1545a5){return _0x398eb5['sendStatus'](_0x454bec);}return _0x398eb5[_0x64e8('0x17')](_0x454bec)['end']();};}function respondWithResult(_0x6618b8,_0x4b4c32){_0x4b4c32=_0x4b4c32||0xc8;return function(_0x13e9fa){if(_0x13e9fa){return _0x6618b8[_0x64e8('0x17')](_0x4b4c32)[_0x64e8('0x18')](_0x13e9fa);}};}function respondWithFilteredResult(_0x5c0c13,_0x9c3e78){return function(_0x2b89f4){if(_0x2b89f4){var _0x43a515=typeof _0x9c3e78[_0x64e8('0x19')]===_0x64e8('0x1a')&&typeof _0x9c3e78[_0x64e8('0x1b')]===_0x64e8('0x1a');var _0x2d923b=_0x2b89f4['count'];var _0x4a1638=_0x43a515?0x0:_0x9c3e78['offset'];var _0x3cbd68=_0x43a515?_0x2b89f4[_0x64e8('0x1c')]:_0x9c3e78[_0x64e8('0x19')]+_0x9c3e78[_0x64e8('0x1b')];var _0x47015d;if(_0x3cbd68>=_0x2d923b){_0x3cbd68=_0x2d923b;_0x47015d=0xc8;}else{_0x47015d=0xce;}_0x5c0c13[_0x64e8('0x17')](_0x47015d);return _0x5c0c13['set']('Content-Range',_0x4a1638+'-'+_0x3cbd68+'/'+_0x2d923b)[_0x64e8('0x18')](_0x2b89f4);}return null;};}function patchUpdates(_0x2b6e56){return function(_0x2e9898){try{jsonpatch[_0x64e8('0x1d')](_0x2e9898,_0x2b6e56,!![]);}catch(_0x32be33){return BPromise['reject'](_0x32be33);}return _0x2e9898[_0x64e8('0x1e')]();};}function saveUpdates(_0x5e5466,_0x45056e){return function(_0x1a44cc){if(_0x1a44cc){return _0x1a44cc[_0x64e8('0x1f')](_0x5e5466)[_0x64e8('0x20')](function(_0x22e4f5){return _0x22e4f5;});}return null;};}function removeEntity(_0x5cb4a2,_0x14b8b4){return function(_0x4f66af){if(_0x4f66af){return _0x4f66af[_0x64e8('0x21')]()['then'](function(){_0x5cb4a2[_0x64e8('0x17')](0xcc)[_0x64e8('0x22')]();});}};}function handleEntityNotFound(_0x45656c,_0xfa29eb){return function(_0x23b7d4){if(!_0x23b7d4){_0x45656c[_0x64e8('0x23')](0x194);}return _0x23b7d4;};}function handleError(_0x2b6b57,_0x4e175f){_0x4e175f=_0x4e175f||0x1f4;return function(_0x4e5cfa){logger[_0x64e8('0x24')](_0x4e5cfa[_0x64e8('0x25')]);if(_0x4e5cfa['name']){delete _0x4e5cfa['name'];}_0x2b6b57[_0x64e8('0x17')](_0x4e175f)[_0x64e8('0x26')](_0x4e5cfa);};}exports['index']=function(_0x3915fe,_0x6976e5){var _0x5726e4={},_0xd5fd87={},_0x128880={'count':0x0,'rows':[]};var _0x5cdd18=_[_0x64e8('0x27')](db[_0x64e8('0x28')][_0x64e8('0x29')],function(_0x169e00){return{'name':_0x169e00['fieldName'],'type':_0x169e00[_0x64e8('0x2a')]['key']};});_0xd5fd87[_0x64e8('0x2b')]=_['map'](_0x5cdd18,'name');_0xd5fd87['query']=_[_0x64e8('0x2c')](_0x3915fe[_0x64e8('0x2d')]);_0xd5fd87[_0x64e8('0x2e')]=_[_0x64e8('0x2f')](_0xd5fd87[_0x64e8('0x2b')],_0xd5fd87[_0x64e8('0x2d')]);_0x5726e4[_0x64e8('0x30')]=_[_0x64e8('0x2f')](_0xd5fd87['model'],qs[_0x64e8('0x31')](_0x3915fe['query']['fields']));_0x5726e4[_0x64e8('0x30')]=_0x5726e4[_0x64e8('0x30')][_0x64e8('0x32')]?_0x5726e4['attributes']:_0xd5fd87[_0x64e8('0x2b')];if(!_0x3915fe['query']['hasOwnProperty'](_0x64e8('0x33'))){_0x5726e4[_0x64e8('0x1b')]=qs[_0x64e8('0x1b')](_0x3915fe['query']['limit']);_0x5726e4[_0x64e8('0x19')]=qs[_0x64e8('0x19')](_0x3915fe['query'][_0x64e8('0x19')]);}_0x5726e4['order']=qs[_0x64e8('0x34')](_0x3915fe[_0x64e8('0x2d')]['sort']);_0x5726e4['where']=qs[_0x64e8('0x2e')](_[_0x64e8('0x35')](_0x3915fe[_0x64e8('0x2d')],_0xd5fd87[_0x64e8('0x2e')]),_0x5cdd18);if(_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x36')]){_0x5726e4['where']=_[_0x64e8('0x37')](_0x5726e4['where'],{'$or':_['map'](_0x5cdd18,function(_0x30881c){if(_0x30881c['type']!==_0x64e8('0x38')){var _0x4fb785={};_0x4fb785[_0x30881c[_0x64e8('0x39')]]={'$like':'%'+_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x36')]+'%'};return _0x4fb785;}})});}_0x5726e4=_['merge']({},_0x5726e4,_0x3915fe['options']);var _0x105500={'where':_0x5726e4[_0x64e8('0x3a')]};return db[_0x64e8('0x28')]['count'](_0x105500)['then'](function(_0x39286f){_0x128880[_0x64e8('0x1c')]=_0x39286f;if(_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x3b')]){_0x5726e4[_0x64e8('0x3c')]=[{'all':!![]}];}return db[_0x64e8('0x28')][_0x64e8('0x3d')](_0x5726e4);})[_0x64e8('0x20')](function(_0x59fb21){_0x128880[_0x64e8('0x3e')]=_0x59fb21;return _0x128880;})['then'](respondWithFilteredResult(_0x6976e5,_0x5726e4))[_0x64e8('0x3f')](handleError(_0x6976e5,null));};exports[_0x64e8('0x40')]=function(_0x32fcd9,_0x12a98){var _0x269244={'raw':!![],'where':{'id':_0x32fcd9[_0x64e8('0x41')]['id']}},_0x1b745d={};_0x1b745d[_0x64e8('0x2b')]=_['keys'](db[_0x64e8('0x28')]['rawAttributes']);_0x1b745d[_0x64e8('0x2d')]=_[_0x64e8('0x2c')](_0x32fcd9[_0x64e8('0x2d')]);_0x1b745d[_0x64e8('0x2e')]=_[_0x64e8('0x2f')](_0x1b745d[_0x64e8('0x2b')],_0x1b745d[_0x64e8('0x2d')]);_0x269244[_0x64e8('0x30')]=_[_0x64e8('0x2f')](_0x1b745d['model'],qs[_0x64e8('0x31')](_0x32fcd9[_0x64e8('0x2d')]['fields']));_0x269244[_0x64e8('0x30')]=_0x269244[_0x64e8('0x30')]['length']?_0x269244['attributes']:_0x1b745d[_0x64e8('0x2b')];if(_0x32fcd9[_0x64e8('0x2d')][_0x64e8('0x3b')]){_0x269244[_0x64e8('0x3c')]=[{'all':!![]}];}_0x269244=_[_0x64e8('0x37')]({},_0x269244,_0x32fcd9[_0x64e8('0x42')]);return db['DeskField']['find'](_0x269244)[_0x64e8('0x20')](handleEntityNotFound(_0x12a98,null))[_0x64e8('0x20')](respondWithResult(_0x12a98,null))['catch'](handleError(_0x12a98,null));};exports['create']=function(_0x4522eb,_0x21954a){return db[_0x64e8('0x28')][_0x64e8('0x43')](_0x4522eb[_0x64e8('0x44')],{})[_0x64e8('0x20')](respondWithResult(_0x21954a,0xc9))[_0x64e8('0x3f')](handleError(_0x21954a,null));};exports[_0x64e8('0x1f')]=function(_0xc966a7,_0x526bce){if(_0xc966a7['body']['id']){delete _0xc966a7[_0x64e8('0x44')]['id'];}return db[_0x64e8('0x28')][_0x64e8('0x45')]({'where':{'id':_0xc966a7[_0x64e8('0x41')]['id']}})[_0x64e8('0x20')](handleEntityNotFound(_0x526bce,null))[_0x64e8('0x20')](saveUpdates(_0xc966a7[_0x64e8('0x44')],null))['then'](respondWithResult(_0x526bce,null))[_0x64e8('0x3f')](handleError(_0x526bce,null));};exports[_0x64e8('0x21')]=function(_0x568798,_0x2a7e83){return db[_0x64e8('0x28')][_0x64e8('0x45')]({'where':{'id':_0x568798[_0x64e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a7e83,null))[_0x64e8('0x20')](removeEntity(_0x2a7e83,null))[_0x64e8('0x3f')](handleError(_0x2a7e83,null));}; \ No newline at end of file +var _0xda2d=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','find','create','body','params','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','name','index','map','rawAttributes','fieldName'];(function(_0x86527a,_0x2787c6){var _0x2f14b6=function(_0x4f1613){while(--_0x4f1613){_0x86527a['push'](_0x86527a['shift']());}};_0x2f14b6(++_0x2787c6);}(_0xda2d,0xb3));var _0xdda2=function(_0x122d8f,_0x3603c9){_0x122d8f=_0x122d8f-0x0;var _0x415bd1=_0xda2d[_0x122d8f];return _0x415bd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdda2('0x2'));var moment=require('moment');var BPromise=require(_0xdda2('0x3'));var Mustache=require('mustache');var util=require(_0xdda2('0x4'));var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdda2('0x9'));var squel=require(_0xdda2('0xa'));var crypto=require(_0xdda2('0xb'));var jsforce=require(_0xdda2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdda2('0xd'));var Papa=require(_0xdda2('0xe'));var Redis=require(_0xdda2('0xf'));var authService=require(_0xdda2('0x10'));var qs=require(_0xdda2('0x11'));var as=require(_0xdda2('0x12'));var hardwareService=require(_0xdda2('0x13'));var logger=require(_0xdda2('0x14'))(_0xdda2('0x15'));var utils=require('../../config/utils');var config=require(_0xdda2('0x16'));var licenseUtil=require(_0xdda2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef13b,_0x360081){_0x360081=_0x360081||0xcc;return function(_0x2307cc){if(_0x2307cc){return _0x2ef13b[_0xdda2('0x18')](_0x360081);}return _0x2ef13b[_0xdda2('0x19')](_0x360081)[_0xdda2('0x1a')]();};}function respondWithResult(_0xee483c,_0x5efc88){_0x5efc88=_0x5efc88||0xc8;return function(_0x407cdc){if(_0x407cdc){return _0xee483c[_0xdda2('0x19')](_0x5efc88)['json'](_0x407cdc);}};}function respondWithFilteredResult(_0x31bfd1,_0x245185){return function(_0x16cc0f){if(_0x16cc0f){var _0x3e5b4e=typeof _0x245185[_0xdda2('0x1b')]===_0xdda2('0x1c')&&typeof _0x245185[_0xdda2('0x1d')]===_0xdda2('0x1c');var _0x526c01=_0x16cc0f[_0xdda2('0x1e')];var _0x4e0bf9=_0x3e5b4e?0x0:_0x245185[_0xdda2('0x1b')];var _0x4ae329=_0x3e5b4e?_0x16cc0f[_0xdda2('0x1e')]:_0x245185[_0xdda2('0x1b')]+_0x245185[_0xdda2('0x1d')];var _0x27e00d;if(_0x4ae329>=_0x526c01){_0x4ae329=_0x526c01;_0x27e00d=0xc8;}else{_0x27e00d=0xce;}_0x31bfd1[_0xdda2('0x19')](_0x27e00d);return _0x31bfd1['set'](_0xdda2('0x1f'),_0x4e0bf9+'-'+_0x4ae329+'/'+_0x526c01)['json'](_0x16cc0f);}return null;};}function patchUpdates(_0x41d3af){return function(_0x2d6297){try{jsonpatch[_0xdda2('0x20')](_0x2d6297,_0x41d3af,!![]);}catch(_0x48cabb){return BPromise['reject'](_0x48cabb);}return _0x2d6297[_0xdda2('0x21')]();};}function saveUpdates(_0x31357c,_0x4832b0){return function(_0x281270){if(_0x281270){return _0x281270[_0xdda2('0x22')](_0x31357c)['then'](function(_0x5ee52a){return _0x5ee52a;});}return null;};}function removeEntity(_0x5452cd,_0x3c9e8d){return function(_0x2d8d3a){if(_0x2d8d3a){return _0x2d8d3a[_0xdda2('0x23')]()[_0xdda2('0x24')](function(){_0x5452cd[_0xdda2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10117d,_0x552f57){return function(_0x455b65){if(!_0x455b65){_0x10117d[_0xdda2('0x18')](0x194);}return _0x455b65;};}function handleError(_0x4582a7,_0x24d4a7){_0x24d4a7=_0x24d4a7||0x1f4;return function(_0x179068){logger[_0xdda2('0x25')](_0x179068['stack']);if(_0x179068[_0xdda2('0x26')]){delete _0x179068[_0xdda2('0x26')];}_0x4582a7[_0xdda2('0x19')](_0x24d4a7)['send'](_0x179068);};}exports[_0xdda2('0x27')]=function(_0x4bf290,_0x552f8c){var _0x17cb89={},_0x30aafa={},_0xd94f91={'count':0x0,'rows':[]};var _0x2748b6=_[_0xdda2('0x28')](db['DeskField'][_0xdda2('0x29')],function(_0x40a4c9){return{'name':_0x40a4c9[_0xdda2('0x2a')],'type':_0x40a4c9[_0xdda2('0x2b')][_0xdda2('0x2c')]};});_0x30aafa[_0xdda2('0x2d')]=_[_0xdda2('0x28')](_0x2748b6,_0xdda2('0x26'));_0x30aafa[_0xdda2('0x2e')]=_[_0xdda2('0x2f')](_0x4bf290['query']);_0x30aafa[_0xdda2('0x30')]=_[_0xdda2('0x31')](_0x30aafa['model'],_0x30aafa[_0xdda2('0x2e')]);_0x17cb89[_0xdda2('0x32')]=_[_0xdda2('0x31')](_0x30aafa[_0xdda2('0x2d')],qs['fields'](_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x33')]));_0x17cb89[_0xdda2('0x32')]=_0x17cb89['attributes'][_0xdda2('0x34')]?_0x17cb89['attributes']:_0x30aafa[_0xdda2('0x2d')];if(!_0x4bf290['query'][_0xdda2('0x35')](_0xdda2('0x36'))){_0x17cb89['limit']=qs['limit'](_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x1d')]);_0x17cb89['offset']=qs[_0xdda2('0x1b')](_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x1b')]);}_0x17cb89[_0xdda2('0x37')]=qs[_0xdda2('0x38')](_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x38')]);_0x17cb89[_0xdda2('0x39')]=qs['filters'](_[_0xdda2('0x3a')](_0x4bf290[_0xdda2('0x2e')],_0x30aafa[_0xdda2('0x30')]),_0x2748b6);if(_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x3b')]){_0x17cb89[_0xdda2('0x39')]=_[_0xdda2('0x3c')](_0x17cb89[_0xdda2('0x39')],{'$or':_[_0xdda2('0x28')](_0x2748b6,function(_0x41c82b){if(_0x41c82b[_0xdda2('0x2b')]!==_0xdda2('0x3d')){var _0x4a796a={};_0x4a796a[_0x41c82b[_0xdda2('0x26')]]={'$like':'%'+_0x4bf290['query'][_0xdda2('0x3b')]+'%'};return _0x4a796a;}})});}_0x17cb89=_[_0xdda2('0x3c')]({},_0x17cb89,_0x4bf290[_0xdda2('0x3e')]);var _0x45ce1a={'where':_0x17cb89[_0xdda2('0x39')]};return db[_0xdda2('0x3f')][_0xdda2('0x1e')](_0x45ce1a)[_0xdda2('0x24')](function(_0x34c460){_0xd94f91['count']=_0x34c460;if(_0x4bf290[_0xdda2('0x2e')][_0xdda2('0x40')]){_0x17cb89[_0xdda2('0x41')]=[{'all':!![]}];}return db[_0xdda2('0x3f')][_0xdda2('0x42')](_0x17cb89);})[_0xdda2('0x24')](function(_0xfd8d1){_0xd94f91[_0xdda2('0x43')]=_0xfd8d1;return _0xd94f91;})['then'](respondWithFilteredResult(_0x552f8c,_0x17cb89))[_0xdda2('0x44')](handleError(_0x552f8c,null));};exports[_0xdda2('0x45')]=function(_0x323c51,_0x444df2){var _0x21eb88={'raw':!![],'where':{'id':_0x323c51['params']['id']}},_0x198bb1={};_0x198bb1['model']=_[_0xdda2('0x2f')](db['DeskField']['rawAttributes']);_0x198bb1[_0xdda2('0x2e')]=_['keys'](_0x323c51[_0xdda2('0x2e')]);_0x198bb1[_0xdda2('0x30')]=_[_0xdda2('0x31')](_0x198bb1[_0xdda2('0x2d')],_0x198bb1[_0xdda2('0x2e')]);_0x21eb88[_0xdda2('0x32')]=_[_0xdda2('0x31')](_0x198bb1[_0xdda2('0x2d')],qs['fields'](_0x323c51[_0xdda2('0x2e')][_0xdda2('0x33')]));_0x21eb88[_0xdda2('0x32')]=_0x21eb88['attributes'][_0xdda2('0x34')]?_0x21eb88[_0xdda2('0x32')]:_0x198bb1[_0xdda2('0x2d')];if(_0x323c51[_0xdda2('0x2e')]['includeAll']){_0x21eb88[_0xdda2('0x41')]=[{'all':!![]}];}_0x21eb88=_[_0xdda2('0x3c')]({},_0x21eb88,_0x323c51['options']);return db['DeskField'][_0xdda2('0x46')](_0x21eb88)[_0xdda2('0x24')](handleEntityNotFound(_0x444df2,null))[_0xdda2('0x24')](respondWithResult(_0x444df2,null))[_0xdda2('0x44')](handleError(_0x444df2,null));};exports[_0xdda2('0x47')]=function(_0x1166ed,_0x2e3087){return db[_0xdda2('0x3f')][_0xdda2('0x47')](_0x1166ed[_0xdda2('0x48')],{})[_0xdda2('0x24')](respondWithResult(_0x2e3087,0xc9))[_0xdda2('0x44')](handleError(_0x2e3087,null));};exports[_0xdda2('0x22')]=function(_0x2c8bc9,_0x513fcd){if(_0x2c8bc9[_0xdda2('0x48')]['id']){delete _0x2c8bc9[_0xdda2('0x48')]['id'];}return db['DeskField']['find']({'where':{'id':_0x2c8bc9[_0xdda2('0x49')]['id']}})[_0xdda2('0x24')](handleEntityNotFound(_0x513fcd,null))['then'](saveUpdates(_0x2c8bc9[_0xdda2('0x48')],null))[_0xdda2('0x24')](respondWithResult(_0x513fcd,null))[_0xdda2('0x44')](handleError(_0x513fcd,null));};exports[_0xdda2('0x23')]=function(_0x57b3ca,_0x424d3a){return db[_0xdda2('0x3f')][_0xdda2('0x46')]({'where':{'id':_0x57b3ca['params']['id']}})['then'](handleEntityNotFound(_0x424d3a,null))['then'](removeEntity(_0x424d3a,null))[_0xdda2('0x44')](handleError(_0x424d3a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 82744cd..e92a262 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 _0x3620=['FieldId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index'];(function(_0x32bdd4,_0x143a69){var _0x4b54d3=function(_0x5c38d6){while(--_0x5c38d6){_0x32bdd4['push'](_0x32bdd4['shift']());}};_0x4b54d3(++_0x143a69);}(_0x3620,0x181));var _0x0362=function(_0x56e9bc,_0x15a8e1){_0x56e9bc=_0x56e9bc-0x0;var _0x6d7561=_0x3620[_0x56e9bc];return _0x6d7561;};'use strict';var _=require(_0x0362('0x0'));var util=require(_0x0362('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0362('0x2'));var BPromise=require(_0x0362('0x3'));var rp=require(_0x0362('0x4'));var fs=require('fs');var path=require(_0x0362('0x5'));var rimraf=require('rimraf');var config=require(_0x0362('0x6'));var attributes=require(_0x0362('0x7'));module[_0x0362('0x8')]=function(_0x2c4be5,_0x11a75b){return _0x2c4be5['define'](_0x0362('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x0362('0xa'),'fields':['idField',_0x0362('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc219=['define','DeskField','int_desk_fields','desk_unique_index','idField','../../config/logger','api','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x274a03,_0xa661ae){var _0x53b6dc=function(_0x29a5df){while(--_0x29a5df){_0x274a03['push'](_0x274a03['shift']());}};_0x53b6dc(++_0xa661ae);}(_0xc219,0x10d));var _0x9c21=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xc219[_0x22e47a];return _0x15a12a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9c21('0x0'))(_0x9c21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c21('0x2'));var rimraf=require(_0x9c21('0x3'));var config=require(_0x9c21('0x4'));var attributes=require(_0x9c21('0x5'));module['exports']=function(_0x3d146d,_0x3cf6e9){return _0x3d146d[_0x9c21('0x6')](_0x9c21('0x7'),attributes,{'tableName':_0x9c21('0x8'),'paranoid':![],'indexes':[{'name':_0x9c21('0x9'),'fields':[_0x9c21('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 370876f..de80c2d 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 _0x8983=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3b1c0c,_0x3d8063){var _0x5120bc=function(_0x2fce52){while(--_0x2fce52){_0x3b1c0c['push'](_0x3b1c0c['shift']());}};_0x5120bc(++_0x3d8063);}(_0x8983,0xf6));var _0x3898=function(_0x5e728b,_0x12269f){_0x5e728b=_0x5e728b-0x0;var _0x1620ca=_0x8983[_0x5e728b];return _0x1620ca;};'use strict';var _=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var moment=require(_0x3898('0x2'));var BPromise=require('bluebird');var rs=require(_0x3898('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3898('0x4'))['db'];var utils=require(_0x3898('0x5'));var logger=require(_0x3898('0x6'))(_0x3898('0x7'));var config=require(_0x3898('0x8'));var jayson=require(_0x3898('0x9'));var client=jayson[_0x3898('0xa')][_0x3898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370d07,_0x72c58c,_0xafcef0){return new BPromise(function(_0x280f59,_0x55caa2){return client[_0x3898('0xc')](_0x370d07,_0xafcef0)[_0x3898('0xd')](function(_0x3e24ef){logger[_0x3898('0xe')](_0x3898('0xf'),_0x72c58c,_0x3898('0x10'));logger['debug'](_0x3898('0x11'),_0x72c58c,'request\x20sent',JSON[_0x3898('0x12')](_0x3e24ef));if(_0x3e24ef[_0x3898('0x13')]){if(_0x3e24ef['error'][_0x3898('0x14')]===0x1f4){logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x3e24ef[_0x3898('0x13')]['message']);return _0x55caa2(_0x3e24ef[_0x3898('0x13')][_0x3898('0x15')]);}logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x3e24ef[_0x3898('0x13')]['message']);return _0x280f59(_0x3e24ef[_0x3898('0x13')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x72c58c,_0x3898('0x10'));_0x280f59(_0x3e24ef[_0x3898('0x16')][_0x3898('0x15')]);}})[_0x3898('0x17')](function(_0x1196de){logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x1196de);_0x55caa2(_0x1196de);});});} \ No newline at end of file +var _0xd5b9=['code','DeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xd6e70b,_0x386eaf){var _0x153b47=function(_0x4a18f9){while(--_0x4a18f9){_0xd6e70b['push'](_0xd6e70b['shift']());}};_0x153b47(++_0x386eaf);}(_0xd5b9,0xcb));var _0x9d5b=function(_0x2fce38,_0x46600b){_0x2fce38=_0x2fce38-0x0;var _0x5f40c0=_0xd5b9[_0x2fce38];return _0x5f40c0;};'use strict';var _=require('lodash');var util=require(_0x9d5b('0x0'));var moment=require(_0x9d5b('0x1'));var BPromise=require(_0x9d5b('0x2'));var rs=require(_0x9d5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d5b('0x5'))('rpc');var config=require(_0x9d5b('0x6'));var jayson=require(_0x9d5b('0x7'));var client=jayson[_0x9d5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b363b,_0x1ade89,_0x438291){return new BPromise(function(_0x321784,_0x167222){return client[_0x9d5b('0x9')](_0x2b363b,_0x438291)[_0x9d5b('0xa')](function(_0x5cd294){logger[_0x9d5b('0xb')]('DeskField,\x20%s,\x20%s',_0x1ade89,_0x9d5b('0xc'));logger[_0x9d5b('0xd')](_0x9d5b('0xe'),_0x1ade89,_0x9d5b('0xc'),JSON[_0x9d5b('0xf')](_0x5cd294));if(_0x5cd294[_0x9d5b('0x10')]){if(_0x5cd294[_0x9d5b('0x10')][_0x9d5b('0x11')]===0x1f4){logger['error'](_0x9d5b('0x12'),_0x1ade89,_0x5cd294[_0x9d5b('0x10')][_0x9d5b('0x13')]);return _0x167222(_0x5cd294[_0x9d5b('0x10')][_0x9d5b('0x13')]);}logger['error'](_0x9d5b('0x12'),_0x1ade89,_0x5cd294[_0x9d5b('0x10')][_0x9d5b('0x13')]);return _0x321784(_0x5cd294[_0x9d5b('0x10')][_0x9d5b('0x13')]);}else{logger[_0x9d5b('0xb')](_0x9d5b('0x12'),_0x1ade89,_0x9d5b('0xc'));_0x321784(_0x5cd294[_0x9d5b('0x14')]['message']);}})[_0x9d5b('0x15')](function(_0x78da89){logger[_0x9d5b('0x10')](_0x9d5b('0x12'),_0x1ade89,_0x78da89);_0x167222(_0x78da89);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b915554..b418418 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 _0x6ea4=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x6ea4,0x160));var _0x46ea=function(_0x5a4a1f,_0x3f90b6){_0x5a4a1f=_0x5a4a1f-0x0;var _0x43db26=_0x6ea4[_0x5a4a1f];return _0x43db26;};'use strict';var multer=require('multer');var util=require(_0x46ea('0x0'));var path=require(_0x46ea('0x1'));var timeout=require(_0x46ea('0x2'));var express=require('express');var router=express[_0x46ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x46ea('0x4'));var interaction=require(_0x46ea('0x5'));var config=require(_0x46ea('0x6'));var controller=require(_0x46ea('0x7'));router[_0x46ea('0x8')]('/',auth[_0x46ea('0x9')](),controller[_0x46ea('0xa')]);router[_0x46ea('0x8')](_0x46ea('0xb'),auth[_0x46ea('0x9')](),controller[_0x46ea('0xc')]);router[_0x46ea('0x8')](_0x46ea('0xd'),auth['isAuthenticated'](),controller[_0x46ea('0xe')]);router['get'](_0x46ea('0xf'),auth[_0x46ea('0x9')](),controller[_0x46ea('0x10')]);router['post']('/',auth[_0x46ea('0x9')](),controller[_0x46ea('0x11')]);router[_0x46ea('0x12')](_0x46ea('0xd'),auth[_0x46ea('0x9')](),controller[_0x46ea('0x13')]);router[_0x46ea('0x14')]('/:id',auth[_0x46ea('0x9')](),controller['update']);router[_0x46ea('0x15')]('/:id',auth[_0x46ea('0x9')](),controller[_0x46ea('0x16')]);module[_0x46ea('0x17')]=router; \ No newline at end of file +var _0x6499=['/:id/fields','getFields','post','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6499,0x1b7));var _0x9649=function(_0x218d37,_0x48d6cd){_0x218d37=_0x218d37-0x0;var _0x568c5d=_0x6499[_0x218d37];return _0x568c5d;};'use strict';var multer=require(_0x9649('0x0'));var util=require(_0x9649('0x1'));var path=require(_0x9649('0x2'));var timeout=require(_0x9649('0x3'));var express=require(_0x9649('0x4'));var router=express[_0x9649('0x5')]();var fs_extra=require(_0x9649('0x6'));var auth=require(_0x9649('0x7'));var interaction=require(_0x9649('0x8'));var config=require(_0x9649('0x9'));var controller=require(_0x9649('0xa'));router[_0x9649('0xb')]('/',auth[_0x9649('0xc')](),controller[_0x9649('0xd')]);router[_0x9649('0xb')](_0x9649('0xe'),auth[_0x9649('0xc')](),controller[_0x9649('0xf')]);router[_0x9649('0xb')](_0x9649('0x10'),auth[_0x9649('0xc')](),controller['getConfigurations']);router['get'](_0x9649('0x11'),auth[_0x9649('0xc')](),controller[_0x9649('0x12')]);router[_0x9649('0x13')]('/',auth[_0x9649('0xc')](),controller['create']);router[_0x9649('0x13')](_0x9649('0x10'),auth['isAuthenticated'](),controller[_0x9649('0x14')]);router[_0x9649('0x15')](_0x9649('0xe'),auth[_0x9649('0xc')](),controller[_0x9649('0x16')]);router[_0x9649('0x17')](_0x9649('0xe'),auth[_0x9649('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ef5c5ba..50a2a0a 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 _0x7d10=['exports','STRING','BOOLEAN'];(function(_0x4b97d7,_0x1c9b1a){var _0x4a19c5=function(_0x1b73fb){while(--_0x1b73fb){_0x4b97d7['push'](_0x4b97d7['shift']());}};_0x4a19c5(++_0x1c9b1a);}(_0x7d10,0x1ce));var _0x07d1=function(_0x4dfda7,_0x5d71eb){_0x4dfda7=_0x4dfda7-0x0;var _0x2a95da=_0x7d10[_0x4dfda7];return _0x2a95da;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'name':{'type':Sequelize[_0x07d1('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x07d1('0x1')]},'remoteUri':{'type':Sequelize[_0x07d1('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x07d1('0x1')]},'clientSecret':{'type':Sequelize[_0x07d1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x07d1('0x1')]},'modernAuthentication':{'type':Sequelize[_0x07d1('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x18af=['BOOLEAN','sequelize','STRING'];(function(_0x3bc588,_0x185430){var _0xe67723=function(_0x419f54){while(--_0x419f54){_0x3bc588['push'](_0x3bc588['shift']());}};_0xe67723(++_0x185430);}(_0x18af,0x8b));var _0xf18a=function(_0x264eab,_0x596471){_0x264eab=_0x264eab-0x0;var _0x497ebe=_0x18af[_0x264eab];return _0x497ebe;};'use strict';var Sequelize=require(_0xf18a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf18a('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf18a('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf18a('0x1')]},'serverUrl':{'type':Sequelize[_0xf18a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf18a('0x1')]},'modernAuthentication':{'type':Sequelize[_0xf18a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bffbfae..073dec9 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 _0x62ed=['all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','send','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','Content-Range','then','destroy','end','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','catch','create','update','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','clientSecret','GET','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','BooleanAttributeMetadata'];(function(_0x1a424b,_0x3d344d){var _0x775933=function(_0x16482c){while(--_0x16482c){_0x1a424b['push'](_0x1a424b['shift']());}};_0x775933(++_0x3d344d);}(_0x62ed,0x18e));var _0xd62e=function(_0x5ad11f,_0x11fb2f){_0x5ad11f=_0x5ad11f-0x0;var _0x46b06f=_0x62ed[_0x5ad11f];return _0x46b06f;};'use strict';var rp=require('request-promise');var util=require(_0xd62e('0x0'));var _=require(_0xd62e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd62e('0x2'))(_0xd62e('0x3'));var db=require(_0xd62e('0x4'))['db'];var integrations=require(_0xd62e('0x5'));function respondWithResult(_0x2c395c,_0x53f931){_0x53f931=_0x53f931||0xc8;return function(_0x563313){if(_0x563313){return _0x2c395c[_0xd62e('0x6')](_0x53f931)[_0xd62e('0x7')](_0x563313);}};}function respondWithFilteredResult(_0x80162e,_0xb590b7){return function(_0x1dfe81){if(_0x1dfe81){var _0x4f9b92=typeof _0xb590b7['offset']===_0xd62e('0x8')&&typeof _0xb590b7[_0xd62e('0x9')]===_0xd62e('0x8');var _0x55d9ce=_0x1dfe81[_0xd62e('0xa')];var _0x589db1=_0x4f9b92?0x0:_0xb590b7[_0xd62e('0xb')];var _0x1e4071=_0x4f9b92?_0x1dfe81['count']:_0xb590b7[_0xd62e('0xb')]+_0xb590b7[_0xd62e('0x9')];var _0x585a34;if(_0x1e4071>=_0x55d9ce){_0x1e4071=_0x55d9ce;_0x585a34=0xc8;}else{_0x585a34=0xce;}_0x80162e[_0xd62e('0x6')](_0x585a34);return _0x80162e['set'](_0xd62e('0xc'),_0x589db1+'-'+_0x1e4071+'/'+_0x55d9ce)[_0xd62e('0x7')](_0x1dfe81);}return null;};}function saveUpdates(_0x4c4b0d){return function(_0x6a6125){if(_0x6a6125){return _0x6a6125['update'](_0x4c4b0d)[_0xd62e('0xd')](function(_0x149148){return _0x149148;});}return null;};}function removeEntity(_0x5bf8fd){return function(_0x4b3d23){if(_0x4b3d23){return _0x4b3d23[_0xd62e('0xe')]()['then'](function(){_0x5bf8fd['status'](0xcc)[_0xd62e('0xf')]();});}};}function handleEntityNotFound(_0xc3f675){return function(_0x26ba16){if(!_0x26ba16){_0xc3f675[_0xd62e('0x10')](0x194);}return _0x26ba16;};}function handleError(_0x4c7a39,_0x4adec4){_0x4adec4=_0x4adec4||0x1f4;return function(_0x13951b){logger['error'](_0x13951b[_0xd62e('0x11')]);if(_0x13951b[_0xd62e('0x12')]){delete _0x13951b[_0xd62e('0x12')];}_0x4c7a39['status'](_0x4adec4)['send'](_0x13951b);};}exports[_0xd62e('0x13')]=function(_0x4a37ab,_0x3434ef){var _0x288f16={},_0x143aad={},_0x4bd0da={'count':0x0,'rows':[]};var _0x4630c3=_[_0xd62e('0x14')](db[_0xd62e('0x15')][_0xd62e('0x16')],function(_0x37a040){return{'name':_0x37a040[_0xd62e('0x17')],'type':_0x37a040[_0xd62e('0x18')]['key']};});_0x143aad['model']=_[_0xd62e('0x14')](_0x4630c3,_0xd62e('0x12'));_0x143aad['query']=_[_0xd62e('0x19')](_0x4a37ab[_0xd62e('0x1a')]);_0x143aad[_0xd62e('0x1b')]=_[_0xd62e('0x1c')](_0x143aad[_0xd62e('0x1d')],_0x143aad[_0xd62e('0x1a')]);_0x288f16[_0xd62e('0x1e')]=_['intersection'](_0x143aad[_0xd62e('0x1d')],qs[_0xd62e('0x1f')](_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x1f')]));_0x288f16[_0xd62e('0x1e')]=_0x288f16[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x288f16[_0xd62e('0x1e')]:_0x143aad[_0xd62e('0x1d')];if(!_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x21')]('nolimit')){_0x288f16[_0xd62e('0x9')]=qs[_0xd62e('0x9')](_0x4a37ab[_0xd62e('0x1a')]['limit']);_0x288f16[_0xd62e('0xb')]=qs['offset'](_0x4a37ab['query']['offset']);}_0x288f16[_0xd62e('0x22')]=qs[_0xd62e('0x23')](_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x23')]);_0x288f16[_0xd62e('0x24')]=qs[_0xd62e('0x1b')](_[_0xd62e('0x25')](_0x4a37ab[_0xd62e('0x1a')],_0x143aad['filters']),_0x4630c3);if(_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x26')]){_0x288f16[_0xd62e('0x24')]=_[_0xd62e('0x27')](_0x288f16[_0xd62e('0x24')],{'$or':_['map'](_0x4630c3,function(_0x279c4f){if(_0x279c4f['type']!==_0xd62e('0x28')){var _0x50b9fd={};_0x50b9fd[_0x279c4f[_0xd62e('0x12')]]={'$like':'%'+_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x26')]+'%'};return _0x50b9fd;}})});}_0x288f16=_['merge']({},_0x288f16,_0x4a37ab['options']);var _0x770c79={'where':_0x288f16[_0xd62e('0x24')]};return db[_0xd62e('0x15')][_0xd62e('0xa')](_0x770c79)['then'](function(_0x3d7caa){_0x4bd0da['count']=_0x3d7caa;if(_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x29')]){_0x288f16[_0xd62e('0x2a')]=[{'all':!![]}];}return db[_0xd62e('0x15')]['findAll'](_0x288f16);})[_0xd62e('0xd')](function(_0x355fb4){_0x4bd0da[_0xd62e('0x2b')]=_0x355fb4;return _0x4bd0da;})['then'](respondWithFilteredResult(_0x3434ef,_0x288f16))['catch'](handleError(_0x3434ef,null));};exports[_0xd62e('0x2c')]=function(_0x3f189e,_0x42028f){var _0x2eef35={'raw':![],'where':{'id':_0x3f189e[_0xd62e('0x2d')]['id']}},_0x541b48={};_0x541b48[_0xd62e('0x1d')]=_[_0xd62e('0x19')](db['Dynamics365Account'][_0xd62e('0x16')]);_0x541b48[_0xd62e('0x1a')]=_[_0xd62e('0x19')](_0x3f189e['query']);_0x541b48['filters']=_[_0xd62e('0x1c')](_0x541b48[_0xd62e('0x1d')],_0x541b48[_0xd62e('0x1a')]);_0x2eef35[_0xd62e('0x1e')]=_[_0xd62e('0x1c')](_0x541b48['model'],qs[_0xd62e('0x1f')](_0x3f189e['query']['fields']));_0x2eef35[_0xd62e('0x1e')]=_0x2eef35[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x2eef35['attributes']:_0x541b48[_0xd62e('0x1d')];if(_0x3f189e[_0xd62e('0x1a')][_0xd62e('0x29')]){_0x2eef35['include']=[{'all':!![]}];}_0x2eef35=_[_0xd62e('0x27')]({},_0x2eef35,_0x3f189e['options']);return db[_0xd62e('0x15')]['find'](_0x2eef35)[_0xd62e('0xd')](handleEntityNotFound(_0x42028f,null))[_0xd62e('0xd')](respondWithResult(_0x42028f,null))[_0xd62e('0x2e')](handleError(_0x42028f,null));};exports['create']=function(_0xe77a68,_0x4d2731){return db['Dynamics365Account'][_0xd62e('0x2f')](_0xe77a68['body'],{})[_0xd62e('0xd')](respondWithResult(_0x4d2731,0xc9))[_0xd62e('0x2e')](handleError(_0x4d2731,null));};exports[_0xd62e('0x30')]=function(_0x2050d1,_0x426933){if(_0x2050d1[_0xd62e('0x31')]['id']){delete _0x2050d1[_0xd62e('0x31')]['id'];}return db[_0xd62e('0x15')][_0xd62e('0x32')]({'where':{'id':_0x2050d1[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x426933,null))[_0xd62e('0xd')](saveUpdates(_0x2050d1['body'],null))[_0xd62e('0xd')](respondWithResult(_0x426933,null))[_0xd62e('0x2e')](handleError(_0x426933,null));};exports[_0xd62e('0xe')]=function(_0x5730b7,_0x490911){return db['Dynamics365Account']['find']({'where':{'id':_0x5730b7[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x490911,null))[_0xd62e('0xd')](removeEntity(_0x490911,null))[_0xd62e('0x2e')](handleError(_0x490911,null));};exports[_0xd62e('0x33')]=function(_0x391659,_0x5b453c){var _0x5225a5={};var _0x409efc={};var _0x1b3153;var _0x3f23b1;return db[_0xd62e('0x15')][_0xd62e('0x34')]({'where':{'id':_0x391659[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x5b453c,null))['then'](function(_0x59bee3){if(_0x59bee3){_0x1b3153=_0x59bee3;_0x409efc[_0xd62e('0x1d')]=_[_0xd62e('0x19')](db[_0xd62e('0x35')][_0xd62e('0x16')]);_0x409efc['query']=_['keys'](_0x391659[_0xd62e('0x1a')]);_0x409efc[_0xd62e('0x1b')]=_['intersection'](_0x409efc[_0xd62e('0x1d')],_0x409efc['query']);_0x5225a5[_0xd62e('0x1e')]=_[_0xd62e('0x1c')](_0x409efc[_0xd62e('0x1d')],qs[_0xd62e('0x1f')](_0x391659[_0xd62e('0x1a')][_0xd62e('0x1f')]));_0x5225a5[_0xd62e('0x1e')]=_0x5225a5[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x5225a5[_0xd62e('0x1e')]:_0x409efc['model'];_0x5225a5[_0xd62e('0x22')]=qs[_0xd62e('0x23')](_0x391659[_0xd62e('0x1a')]['sort']);_0x5225a5[_0xd62e('0x24')]=qs[_0xd62e('0x1b')](_[_0xd62e('0x25')](_0x391659[_0xd62e('0x1a')],_0x409efc['filters']));if(_0x391659['query']['filter']){_0x5225a5[_0xd62e('0x24')]=_[_0xd62e('0x27')](_0x5225a5[_0xd62e('0x24')],{'$or':_[_0xd62e('0x14')](_0x5225a5['attributes'],function(_0xeddf3c){var _0x103af8={};_0x103af8[_0xeddf3c]={'$like':'%'+_0x391659['query'][_0xd62e('0x26')]+'%'};return _0x103af8;})});}_0x5225a5=_[_0xd62e('0x27')]({},_0x5225a5,_0x391659['options']);return _0x1b3153[_0xd62e('0x33')](_0x5225a5);}})['then'](function(_0x286599){if(_0x286599){_0x3f23b1=_0x286599[_0xd62e('0x20')];if(!_0x391659[_0xd62e('0x1a')][_0xd62e('0x21')](_0xd62e('0x36'))){_0x5225a5[_0xd62e('0x9')]=qs[_0xd62e('0x9')](_0x391659['query'][_0xd62e('0x9')]);_0x5225a5['offset']=qs['offset'](_0x391659[_0xd62e('0x1a')][_0xd62e('0xb')]);}return _0x1b3153[_0xd62e('0x33')](_0x5225a5);}})[_0xd62e('0xd')](function(_0x5599a4){if(_0x5599a4){return _0x5599a4?{'count':_0x3f23b1,'rows':_0x5599a4}:null;}})[_0xd62e('0xd')](respondWithResult(_0x5b453c,null))[_0xd62e('0x2e')](handleError(_0x5b453c,null));};exports[_0xd62e('0x37')]=function(_0x17790c,_0x423222){if(_0x17790c[_0xd62e('0x31')]['id']){delete _0x17790c[_0xd62e('0x31')]['id'];}return db[_0xd62e('0x15')]['findOne']({'where':{'id':_0x17790c['params']['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x423222,null))[_0xd62e('0xd')](function(_0x1b6080){if(_0x1b6080){_0x17790c[_0xd62e('0x31')]['AccountId']=_0x1b6080['id'];_0x17790c[_0xd62e('0x31')][_0xd62e('0x38')]=integrations[_0xd62e('0x39')](_0x17790c[_0xd62e('0x31')][_0xd62e('0x3a')],_0x17790c[_0xd62e('0x31')][_0xd62e('0x18')]);_0x17790c[_0xd62e('0x31')][_0xd62e('0x3b')]=integrations[_0xd62e('0x3c')](_0x17790c['body'][_0xd62e('0x3a')],_0x17790c[_0xd62e('0x31')][_0xd62e('0x18')]);return db[_0xd62e('0x35')]['create'](_0x17790c[_0xd62e('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':_0xd62e('0x38')},{'model':db[_0xd62e('0x3d')],'as':'Descriptions'}]});}return null;})[_0xd62e('0xd')](respondWithResult(_0x423222,null))['catch'](handleError(_0x423222,null));};function sanitizeRemoteUri(_0x5f335a){var _0x55c427=_0x5f335a[_0xd62e('0x3e')](-0x1);if(_0x55c427==='/')return _0x5f335a[_0xd62e('0x3f')](0x0,_0x5f335a[_0xd62e('0x40')](_0x55c427));return _0x5f335a;}function getWebApiUrl(_0xdfbf16){return util[_0xd62e('0x41')]('%s/api/data/v9.0/',_0xdfbf16);}exports[_0xd62e('0x42')]=function(_0x43bc31,_0x16407d){var _0x586873=_0x43bc31[_0xd62e('0x1a')][_0xd62e('0x43')];var _0x39cd6d=_0x586873===_0xd62e('0x44')?_0xd62e('0x45'):_0xd62e('0x46');var _0x234be8='';var _0xc9508e='';var _0x24ceba='';var _0x28f200='';var _0x376a70='';var _0x66b88='';var _0x3d6f37='';var _0x2f35f8='';var _0x132c59=[_0xd62e('0x47'),_0xd62e('0x48'),'customerid',_0xd62e('0x49'),'caseorigincode',_0xd62e('0x4a'),_0xd62e('0x4b'),_0xd62e('0x4c'),_0xd62e('0x4d'),_0xd62e('0x4e')];var _0x574305=[_0xd62e('0x4f'),'accountidyominame',_0xd62e('0x50'),_0xd62e('0x51'),_0xd62e('0x52'),'contactidyominame','contractdetailidname',_0xd62e('0x53'),_0xd62e('0x54'),_0xd62e('0x55'),'createdbyname',_0xd62e('0x56'),_0xd62e('0x57'),'createdonbehalfbyname',_0xd62e('0x58'),_0xd62e('0x59'),_0xd62e('0x5a'),_0xd62e('0x5b'),'emailaddress',_0xd62e('0x5c'),_0xd62e('0x5d'),_0xd62e('0x5e'),'escalatedon',_0xd62e('0x5f'),_0xd62e('0x60'),_0xd62e('0x61'),_0xd62e('0x62'),_0xd62e('0x63'),_0xd62e('0x64'),_0xd62e('0x65'),_0xd62e('0x66'),_0xd62e('0x67'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xd62e('0x68'),_0xd62e('0x69'),_0xd62e('0x6a'),'modifiedonbehalfbyyominame',_0xd62e('0x6b'),_0xd62e('0x6c'),_0xd62e('0x6d'),'onholdtime',_0xd62e('0x6e'),'owneridname',_0xd62e('0x6f'),'owneridyominame',_0xd62e('0x70'),_0xd62e('0x71'),_0xd62e('0x72'),'prioritycodename',_0xd62e('0x73'),_0xd62e('0x74'),'resolveby','resolvebykpiidname','responseby',_0xd62e('0x75'),'responsiblecontactidyominame',_0xd62e('0x76'),_0xd62e('0x77'),_0xd62e('0x78'),_0xd62e('0x79'),_0xd62e('0x7a'),_0xd62e('0x7b'),'subjectidname',_0xd62e('0x7c'),_0xd62e('0x7d'),_0xd62e('0x7e'),_0xd62e('0x7f'),_0xd62e('0x80'),_0xd62e('0x81')];var _0x279439=_0x132c59[_0xd62e('0x82')](_0x574305);return db[_0xd62e('0x15')][_0xd62e('0x34')]({'where':{'id':_0x43bc31['params']['id']},'attributes':['id',_0xd62e('0x83'),'password',_0xd62e('0x84'),'tenantId',_0xd62e('0x85'),'clientSecret',_0xd62e('0x86')],'include':[{'model':db[_0xd62e('0x87')],'as':_0xd62e('0x87'),'attributes':['id',_0xd62e('0x88'),_0xd62e('0x89')]}]})[_0xd62e('0xd')](handleEntityNotFound(_0x16407d,null))['then'](function(_0x18d38b){if(_0x18d38b){if(_0x18d38b[_0xd62e('0x86')]){_0x18d38b[_0xd62e('0x8a')]=_0x18d38b[_0xd62e('0x87')][_0xd62e('0x88')];_0x2f35f8=sanitizeRemoteUri(_0x18d38b['CloudProvider'][_0xd62e('0x89')]);_0x3d6f37=getWebApiUrl(_0x2f35f8);return _0x18d38b;}_0x2f35f8=sanitizeRemoteUri(_0x18d38b[_0xd62e('0x84')]);_0x3d6f37=getWebApiUrl(_0x2f35f8);var _0x2a1e06={'method':_0xd62e('0x8b'),'uri':_0xd62e('0x8c')+_0x18d38b[_0xd62e('0x8d')]+_0xd62e('0x8e'),'form':{'client_id':_0x18d38b['clientId'],'resource':_0x2f35f8,'username':_0x18d38b[_0xd62e('0x83')],'password':_0x18d38b[_0xd62e('0x8f')],'grant_type':_0xd62e('0x8f'),'client_secret':_0x18d38b[_0xd62e('0x90')]},'json':!![]};return rp(_0x2a1e06);}})[_0xd62e('0xd')](function(_0x1e0a6e){_0x66b88=_0x1e0a6e[_0xd62e('0x8a')];var _0x1bb343={'method':_0xd62e('0x91'),'uri':encodeURI(_0x3d6f37+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x39cd6d+'\x27'),'headers':{'Authorization':_0xd62e('0x92')+_0x66b88,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x1bb343);})[_0xd62e('0xd')](function(_0xbdd3b){var _0x2f1816=_0xbdd3b['value'][0x0];var _0x545e80=_0x2f1816['MetadataId'];var _0x4dd823={'method':_0xd62e('0x91'),'uri':_0x3d6f37+_0xd62e('0x94')+_0x545e80+_0xd62e('0x95'),'headers':{'Authorization':_0xd62e('0x92')+_0x66b88,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x4dd823);})['then'](function(_0x242659){_0x234be8=_0x242659;_0xc9508e=_0x234be8[_0xd62e('0x96')];_0xc9508e=_[_0xd62e('0x97')](_0xc9508e,function(_0x462719){return!_0x279439[_0xd62e('0x98')](_0x462719[_0xd62e('0x99')]);});var _0x28cc0d=[];var _0x14d57e=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5dcf0){if(_0x5dcf0[_0xd62e('0x9b')]){var _0x34948a=_0x5dcf0[_0xd62e('0x9b')][_0xd62e('0x3f')](_0x5dcf0[_0xd62e('0x9b')][_0xd62e('0x40')]('.')+0x1);if(_0x34948a===_0xd62e('0x9c')){_0x28cc0d[_0xd62e('0x9d')](getSelectList(_0x3d6f37,_0x586873,_0x14d57e,_0x234be8[_0xd62e('0x9e')],_0x5dcf0['MetadataId'],_0x66b88));}}});return Promise['all'](_0x28cc0d);})[_0xd62e('0xd')](function(_0x27f5fb){_0x24ceba=_0x27f5fb[0x0];var _0x288c00=[];var _0x163142=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5bc7ea){if(!_['isNil'](_0x5bc7ea['@odata.type'])){var _0x28350b=_0x5bc7ea[_0xd62e('0x9b')][_0xd62e('0x3f')](_0x5bc7ea['@odata.type'][_0xd62e('0x40')]('.')+0x1);if(_0x28350b===_0xd62e('0x9f')){_0x288c00['push'](getBooleanList(_0x3d6f37,_0x586873,_0x163142,_0x234be8[_0xd62e('0x9e')],_0x5bc7ea['MetadataId'],_0x66b88));}}});return Promise[_0xd62e('0xa0')](_0x288c00);})[_0xd62e('0xd')](function(_0x5b04fc){_0x28f200=_0x5b04fc[0x0];var _0x1bd1c8=[];var _0x46a72c=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5a359d){if(_0x5a359d[_0xd62e('0x9b')]){var _0x290ec6=_0x5a359d['@odata.type'][_0xd62e('0x3f')](_0x5a359d[_0xd62e('0x9b')][_0xd62e('0x40')]('.')+0x1);if(_0x290ec6===_0xd62e('0xa1')||_0x290ec6===_0xd62e('0xa2')||_0x290ec6===_0xd62e('0xa3')||_0x290ec6===_0xd62e('0xa4')||_0x290ec6==='MemoAttributeMetadata'||_0x290ec6===_0xd62e('0xa5')||_0x290ec6===_0xd62e('0xa6')||_0x290ec6===_0xd62e('0xa7')||_0x290ec6===_0xd62e('0xa8')||_0x290ec6==='DecimalAttributeMetadata'){_0x1bd1c8[_0xd62e('0x9d')](getInputList(_0x3d6f37,_0x586873,_0x290ec6,_0x46a72c,_0x234be8[_0xd62e('0x9e')],_0x5a359d[_0xd62e('0x9e')],_0x66b88));}}});return Promise[_0xd62e('0xa0')](_0x1bd1c8);})[_0xd62e('0xd')](function(_0x3a2eb9){_0x376a70=_0x3a2eb9[0x0];var _0x5094ba=_0x24ceba[_0xd62e('0x82')](_0x28f200)[_0xd62e('0x82')](_0x376a70);var _0x47bc74={'count':_0x5094ba[_0xd62e('0x20')],'rows':_0x5094ba};return _0x47bc74;})[_0xd62e('0xd')](respondWithResult(_0x16407d,null))['catch'](function(_0x56c1da){var _0x10e3e1=_0x43bc31['query']['test']?0x1f4:_0x56c1da[_0xd62e('0xa9')]||0x1f4;logger['error'](_0x56c1da[_0xd62e('0x11')]);delete _0x56c1da[_0xd62e('0x12')];if(_0x10e3e1===0x191){_0x10e3e1=0x190;}_0x16407d[_0xd62e('0x6')](_0x10e3e1)[_0xd62e('0xaa')](_0x43bc31[_0xd62e('0x1a')][_0xd62e('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x56c1da[_0xd62e('0xa9')]}:_0x56c1da);});};function getSelectList(_0x550206,_0x3c569e,_0xfae86f,_0x3d7749,_0x414f22,_0x12427e){var _0x54b567={'method':_0xd62e('0x91'),'uri':_0x550206+_0xd62e('0x94')+_0x3d7749+')/Attributes('+_0x414f22+_0xd62e('0xac')+_0xd62e('0xad'),'headers':{'Authorization':_0xd62e('0x92')+_0x12427e,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x54b567)['then'](function(_0x53982b){var _0x1142da=[];var _0x345dc6=_0x53982b['OptionSet'][_0xd62e('0xae')];_0x345dc6[_0xd62e('0x9a')](function(_0x5da52a){_0x1142da['push']({'name':_0x5da52a[_0xd62e('0xaf')][_0xd62e('0xb0')]['Label'],'value':String(_0x5da52a[_0xd62e('0xb1')])});});var _0x8e2c6a={'id':_0x3c569e+'_'+_0x53982b[_0xd62e('0x99')],'name':_0x53982b[_0xd62e('0xb2')][_0xd62e('0xb0')]['Label'],'custom':![],'options':_0x1142da};_0xfae86f['push'](_0x8e2c6a);return _0xfae86f;});}function getBooleanList(_0x16750a,_0x17b26e,_0x1be131,_0x51b8af,_0x712cf9,_0x327a2e){var _0x167d51={'method':_0xd62e('0x91'),'uri':_0x16750a+_0xd62e('0x94')+_0x51b8af+')/Attributes('+_0x712cf9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd62e('0x92')+_0x327a2e,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x167d51)[_0xd62e('0xd')](function(_0x2d36c8){var _0x52f6d6=[];_0x52f6d6[_0xd62e('0x9d')]({'name':_0x2d36c8[_0xd62e('0xb3')][_0xd62e('0xb4')][_0xd62e('0xaf')][_0xd62e('0xb0')][_0xd62e('0xaf')],'value':_0xd62e('0xb5')},{'name':_0x2d36c8[_0xd62e('0xb3')][_0xd62e('0xb6')][_0xd62e('0xaf')][_0xd62e('0xb0')][_0xd62e('0xaf')],'value':_0xd62e('0xb7')});var _0x40a8cf={'id':_0x17b26e+'_'+_0x2d36c8['LogicalName'],'name':_0x2d36c8[_0xd62e('0xb2')][_0xd62e('0xb0')]['Label'],'custom':![],'options':_0x52f6d6};_0x1be131[_0xd62e('0x9d')](_0x40a8cf);return _0x1be131;});}function getInputList(_0x195a11,_0x1c92ef,_0x2f8d1c,_0x560372,_0x243581,_0x349eab,_0x24383d){var _0x282dcc={'method':_0xd62e('0x91'),'uri':_0x195a11+'EntityDefinitions('+_0x243581+')/Attributes('+_0x349eab+_0xd62e('0xb8')+_0x2f8d1c+_0xd62e('0xb9'),'headers':{'Authorization':_0xd62e('0x92')+_0x24383d,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x282dcc)[_0xd62e('0xd')](function(_0xaa186d){var _0x15e530={'id':_0x1c92ef+'_'+_0xaa186d[_0xd62e('0x99')],'name':_0xaa186d['DisplayName'][_0xd62e('0xb0')]?_0xaa186d['DisplayName']['UserLocalizedLabel'][_0xd62e('0xaf')]:_0xaa186d[_0xd62e('0x99')],'custom':![],'options':[]};_0x560372[_0xd62e('0x9d')](_0x15e530);return _0x560372;});} \ No newline at end of file +var _0x57e4=['PhoneCall','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','all','BigIntAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident'];(function(_0xc02eed,_0x31244a){var _0x347241=function(_0xf6e0c5){while(--_0xf6e0c5){_0xc02eed['push'](_0xc02eed['shift']());}};_0x347241(++_0x31244a);}(_0x57e4,0x1e5));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var rp=require(_0x457e('0x0'));var util=require('util');var _=require(_0x457e('0x1'));var qs=require(_0x457e('0x2'));var logger=require('../../config/logger')(_0x457e('0x3'));var db=require(_0x457e('0x4'))['db'];var integrations=require(_0x457e('0x5'));function respondWithResult(_0x572329,_0x45173e){_0x45173e=_0x45173e||0xc8;return function(_0x46393f){if(_0x46393f){return _0x572329[_0x457e('0x6')](_0x45173e)[_0x457e('0x7')](_0x46393f);}};}function respondWithFilteredResult(_0x2a21f1,_0x40c09b){return function(_0x1e9979){if(_0x1e9979){var _0x1886db=typeof _0x40c09b[_0x457e('0x8')]===_0x457e('0x9')&&typeof _0x40c09b['limit']==='undefined';var _0x53e916=_0x1e9979[_0x457e('0xa')];var _0x101425=_0x1886db?0x0:_0x40c09b[_0x457e('0x8')];var _0x54fe0f=_0x1886db?_0x1e9979[_0x457e('0xa')]:_0x40c09b['offset']+_0x40c09b[_0x457e('0xb')];var _0x4388d5;if(_0x54fe0f>=_0x53e916){_0x54fe0f=_0x53e916;_0x4388d5=0xc8;}else{_0x4388d5=0xce;}_0x2a21f1['status'](_0x4388d5);return _0x2a21f1['set']('Content-Range',_0x101425+'-'+_0x54fe0f+'/'+_0x53e916)[_0x457e('0x7')](_0x1e9979);}return null;};}function saveUpdates(_0x5e8c62){return function(_0x9408b3){if(_0x9408b3){return _0x9408b3[_0x457e('0xc')](_0x5e8c62)[_0x457e('0xd')](function(_0x3de097){return _0x3de097;});}return null;};}function removeEntity(_0x3548da){return function(_0x4532e5){if(_0x4532e5){return _0x4532e5[_0x457e('0xe')]()[_0x457e('0xd')](function(){_0x3548da['status'](0xcc)[_0x457e('0xf')]();});}};}function handleEntityNotFound(_0x281c24){return function(_0x10d412){if(!_0x10d412){_0x281c24['sendStatus'](0x194);}return _0x10d412;};}function handleError(_0x580b2f,_0x1598cd){_0x1598cd=_0x1598cd||0x1f4;return function(_0x59ce2f){logger[_0x457e('0x10')](_0x59ce2f[_0x457e('0x11')]);if(_0x59ce2f[_0x457e('0x12')]){delete _0x59ce2f[_0x457e('0x12')];}_0x580b2f[_0x457e('0x6')](_0x1598cd)[_0x457e('0x13')](_0x59ce2f);};}exports[_0x457e('0x14')]=function(_0x2bd03c,_0xf2db7){var _0x41c2ce={},_0x36b745={},_0x2bc89f={'count':0x0,'rows':[]};var _0x596ec1=_[_0x457e('0x15')](db['Dynamics365Account'][_0x457e('0x16')],function(_0x3b9272){return{'name':_0x3b9272[_0x457e('0x17')],'type':_0x3b9272[_0x457e('0x18')][_0x457e('0x19')]};});_0x36b745['model']=_[_0x457e('0x15')](_0x596ec1,_0x457e('0x12'));_0x36b745[_0x457e('0x1a')]=_[_0x457e('0x1b')](_0x2bd03c[_0x457e('0x1a')]);_0x36b745[_0x457e('0x1c')]=_['intersection'](_0x36b745['model'],_0x36b745['query']);_0x41c2ce[_0x457e('0x1d')]=_[_0x457e('0x1e')](_0x36b745[_0x457e('0x1f')],qs[_0x457e('0x20')](_0x2bd03c[_0x457e('0x1a')]['fields']));_0x41c2ce[_0x457e('0x1d')]=_0x41c2ce[_0x457e('0x1d')][_0x457e('0x21')]?_0x41c2ce['attributes']:_0x36b745['model'];if(!_0x2bd03c[_0x457e('0x1a')][_0x457e('0x22')](_0x457e('0x23'))){_0x41c2ce['limit']=qs['limit'](_0x2bd03c[_0x457e('0x1a')]['limit']);_0x41c2ce[_0x457e('0x8')]=qs[_0x457e('0x8')](_0x2bd03c[_0x457e('0x1a')][_0x457e('0x8')]);}_0x41c2ce[_0x457e('0x24')]=qs[_0x457e('0x25')](_0x2bd03c[_0x457e('0x1a')]['sort']);_0x41c2ce[_0x457e('0x26')]=qs[_0x457e('0x1c')](_[_0x457e('0x27')](_0x2bd03c[_0x457e('0x1a')],_0x36b745[_0x457e('0x1c')]),_0x596ec1);if(_0x2bd03c[_0x457e('0x1a')][_0x457e('0x28')]){_0x41c2ce['where']=_[_0x457e('0x29')](_0x41c2ce[_0x457e('0x26')],{'$or':_[_0x457e('0x15')](_0x596ec1,function(_0x4d47f8){if(_0x4d47f8[_0x457e('0x18')]!==_0x457e('0x2a')){var _0x5aafd4={};_0x5aafd4[_0x4d47f8[_0x457e('0x12')]]={'$like':'%'+_0x2bd03c[_0x457e('0x1a')][_0x457e('0x28')]+'%'};return _0x5aafd4;}})});}_0x41c2ce=_['merge']({},_0x41c2ce,_0x2bd03c[_0x457e('0x2b')]);var _0x42499e={'where':_0x41c2ce[_0x457e('0x26')]};return db[_0x457e('0x2c')][_0x457e('0xa')](_0x42499e)[_0x457e('0xd')](function(_0x5c9016){_0x2bc89f[_0x457e('0xa')]=_0x5c9016;if(_0x2bd03c[_0x457e('0x1a')][_0x457e('0x2d')]){_0x41c2ce[_0x457e('0x2e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x457e('0x2f')](_0x41c2ce);})[_0x457e('0xd')](function(_0x293f77){_0x2bc89f[_0x457e('0x30')]=_0x293f77;return _0x2bc89f;})['then'](respondWithFilteredResult(_0xf2db7,_0x41c2ce))[_0x457e('0x31')](handleError(_0xf2db7,null));};exports[_0x457e('0x32')]=function(_0x2db49b,_0x925c08){var _0x10f55a={'raw':![],'where':{'id':_0x2db49b[_0x457e('0x33')]['id']}},_0x31ab22={};_0x31ab22[_0x457e('0x1f')]=_[_0x457e('0x1b')](db[_0x457e('0x2c')][_0x457e('0x16')]);_0x31ab22[_0x457e('0x1a')]=_[_0x457e('0x1b')](_0x2db49b[_0x457e('0x1a')]);_0x31ab22[_0x457e('0x1c')]=_[_0x457e('0x1e')](_0x31ab22[_0x457e('0x1f')],_0x31ab22[_0x457e('0x1a')]);_0x10f55a[_0x457e('0x1d')]=_[_0x457e('0x1e')](_0x31ab22[_0x457e('0x1f')],qs[_0x457e('0x20')](_0x2db49b['query']['fields']));_0x10f55a[_0x457e('0x1d')]=_0x10f55a[_0x457e('0x1d')][_0x457e('0x21')]?_0x10f55a[_0x457e('0x1d')]:_0x31ab22[_0x457e('0x1f')];if(_0x2db49b['query'][_0x457e('0x2d')]){_0x10f55a[_0x457e('0x2e')]=[{'all':!![]}];}_0x10f55a=_[_0x457e('0x29')]({},_0x10f55a,_0x2db49b[_0x457e('0x2b')]);return db[_0x457e('0x2c')][_0x457e('0x34')](_0x10f55a)['then'](handleEntityNotFound(_0x925c08,null))['then'](respondWithResult(_0x925c08,null))['catch'](handleError(_0x925c08,null));};exports[_0x457e('0x35')]=function(_0x1cf18f,_0x1eb536){return db['Dynamics365Account'][_0x457e('0x35')](_0x1cf18f[_0x457e('0x36')],{})['then'](respondWithResult(_0x1eb536,0xc9))['catch'](handleError(_0x1eb536,null));};exports[_0x457e('0xc')]=function(_0x5d5384,_0x535360){if(_0x5d5384[_0x457e('0x36')]['id']){delete _0x5d5384[_0x457e('0x36')]['id'];}return db['Dynamics365Account'][_0x457e('0x34')]({'where':{'id':_0x5d5384[_0x457e('0x33')]['id']}})[_0x457e('0xd')](handleEntityNotFound(_0x535360,null))[_0x457e('0xd')](saveUpdates(_0x5d5384[_0x457e('0x36')],null))[_0x457e('0xd')](respondWithResult(_0x535360,null))[_0x457e('0x31')](handleError(_0x535360,null));};exports[_0x457e('0xe')]=function(_0x47c71f,_0xaadc1e){return db[_0x457e('0x2c')][_0x457e('0x34')]({'where':{'id':_0x47c71f[_0x457e('0x33')]['id']}})[_0x457e('0xd')](handleEntityNotFound(_0xaadc1e,null))[_0x457e('0xd')](removeEntity(_0xaadc1e,null))[_0x457e('0x31')](handleError(_0xaadc1e,null));};exports[_0x457e('0x37')]=function(_0x3c6c37,_0x39a7de){var _0x176244={};var _0x13768e={};var _0x4da947;var _0x38d06f;return db[_0x457e('0x2c')][_0x457e('0x38')]({'where':{'id':_0x3c6c37['params']['id']}})[_0x457e('0xd')](handleEntityNotFound(_0x39a7de,null))[_0x457e('0xd')](function(_0x4bf0cd){if(_0x4bf0cd){_0x4da947=_0x4bf0cd;_0x13768e[_0x457e('0x1f')]=_[_0x457e('0x1b')](db[_0x457e('0x39')]['rawAttributes']);_0x13768e[_0x457e('0x1a')]=_[_0x457e('0x1b')](_0x3c6c37[_0x457e('0x1a')]);_0x13768e['filters']=_[_0x457e('0x1e')](_0x13768e[_0x457e('0x1f')],_0x13768e['query']);_0x176244['attributes']=_[_0x457e('0x1e')](_0x13768e['model'],qs[_0x457e('0x20')](_0x3c6c37[_0x457e('0x1a')][_0x457e('0x20')]));_0x176244[_0x457e('0x1d')]=_0x176244[_0x457e('0x1d')][_0x457e('0x21')]?_0x176244[_0x457e('0x1d')]:_0x13768e[_0x457e('0x1f')];_0x176244[_0x457e('0x24')]=qs[_0x457e('0x25')](_0x3c6c37['query']['sort']);_0x176244[_0x457e('0x26')]=qs[_0x457e('0x1c')](_[_0x457e('0x27')](_0x3c6c37['query'],_0x13768e[_0x457e('0x1c')]));if(_0x3c6c37[_0x457e('0x1a')]['filter']){_0x176244[_0x457e('0x26')]=_[_0x457e('0x29')](_0x176244[_0x457e('0x26')],{'$or':_[_0x457e('0x15')](_0x176244['attributes'],function(_0x35fa4b){var _0x2b67bd={};_0x2b67bd[_0x35fa4b]={'$like':'%'+_0x3c6c37[_0x457e('0x1a')][_0x457e('0x28')]+'%'};return _0x2b67bd;})});}_0x176244=_[_0x457e('0x29')]({},_0x176244,_0x3c6c37[_0x457e('0x2b')]);return _0x4da947[_0x457e('0x37')](_0x176244);}})['then'](function(_0x1f03a0){if(_0x1f03a0){_0x38d06f=_0x1f03a0[_0x457e('0x21')];if(!_0x3c6c37[_0x457e('0x1a')][_0x457e('0x22')](_0x457e('0x23'))){_0x176244[_0x457e('0xb')]=qs[_0x457e('0xb')](_0x3c6c37[_0x457e('0x1a')][_0x457e('0xb')]);_0x176244[_0x457e('0x8')]=qs['offset'](_0x3c6c37[_0x457e('0x1a')][_0x457e('0x8')]);}return _0x4da947[_0x457e('0x37')](_0x176244);}})[_0x457e('0xd')](function(_0xafd21){if(_0xafd21){return _0xafd21?{'count':_0x38d06f,'rows':_0xafd21}:null;}})[_0x457e('0xd')](respondWithResult(_0x39a7de,null))[_0x457e('0x31')](handleError(_0x39a7de,null));};exports[_0x457e('0x3a')]=function(_0x3973b2,_0xb17461){if(_0x3973b2[_0x457e('0x36')]['id']){delete _0x3973b2[_0x457e('0x36')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x3973b2[_0x457e('0x33')]['id']}})['then'](handleEntityNotFound(_0xb17461,null))[_0x457e('0xd')](function(_0x114add){if(_0x114add){_0x3973b2['body'][_0x457e('0x3b')]=_0x114add['id'];_0x3973b2[_0x457e('0x36')]['Subjects']=integrations[_0x457e('0x3c')](_0x3973b2[_0x457e('0x36')][_0x457e('0x3d')],_0x3973b2[_0x457e('0x36')]['type']);_0x3973b2[_0x457e('0x36')]['Descriptions']=integrations[_0x457e('0x3e')](_0x3973b2[_0x457e('0x36')][_0x457e('0x3d')],_0x3973b2['body'][_0x457e('0x18')]);return db[_0x457e('0x39')][_0x457e('0x35')](_0x3973b2['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x457e('0x3f')},{'model':db['Dynamics365Field'],'as':_0x457e('0x40')}]});}return null;})['then'](respondWithResult(_0xb17461,null))['catch'](handleError(_0xb17461,null));};function sanitizeRemoteUri(_0x1f0011){var _0x6cddd5=_0x1f0011[_0x457e('0x41')](-0x1);if(_0x6cddd5==='/')return _0x1f0011[_0x457e('0x42')](0x0,_0x1f0011[_0x457e('0x43')](_0x6cddd5));return _0x1f0011;}function getWebApiUrl(_0x1cef63){return util[_0x457e('0x44')](_0x457e('0x45'),_0x1cef63);}exports[_0x457e('0x46')]=function(_0x273e54,_0x343b7d){var _0x448d65=_0x273e54[_0x457e('0x1a')][_0x457e('0x47')];var _0x303468=_0x448d65==='incident'?_0x457e('0x48'):_0x457e('0x49');var _0x216dd9='';var _0x53cfa9='';var _0x28701c='';var _0x2504a8='';var _0x2afa6d='';var _0xf78d48='';var _0x5af4aa='';var _0x25c48a='';var _0x4661ef=['title','description',_0x457e('0x4a'),_0x457e('0x4b'),'caseorigincode',_0x457e('0x4c'),_0x457e('0x4d'),_0x457e('0x4e'),_0x457e('0x4f'),'phonecall_activity_parties'];var _0x19cb7f=[_0x457e('0x50'),_0x457e('0x51'),'actualserviceunits',_0x457e('0x52'),_0x457e('0x53'),'contactidyominame',_0x457e('0x54'),_0x457e('0x55'),_0x457e('0x56'),_0x457e('0x57'),_0x457e('0x58'),'createdbyyominame',_0x457e('0x59'),_0x457e('0x5a'),_0x457e('0x5b'),'customeridname',_0x457e('0x5c'),'customeridyominame',_0x457e('0x5d'),_0x457e('0x5e'),_0x457e('0x5f'),_0x457e('0x60'),_0x457e('0x61'),_0x457e('0x62'),_0x457e('0x63'),_0x457e('0x64'),_0x457e('0x65'),'influencescore',_0x457e('0x66'),_0x457e('0x67'),_0x457e('0x68'),_0x457e('0x69'),_0x457e('0x6a'),_0x457e('0x6b'),'modifiedbyyominame',_0x457e('0x6c'),_0x457e('0x6d'),_0x457e('0x6e'),_0x457e('0x6f'),_0x457e('0x70'),_0x457e('0x71'),'onholdtime',_0x457e('0x72'),_0x457e('0x73'),'owneridtype','owneridyominame','parentcaseidname','primarycontactidname',_0x457e('0x74'),_0x457e('0x75'),_0x457e('0x76'),_0x457e('0x77'),_0x457e('0x78'),_0x457e('0x79'),_0x457e('0x7a'),_0x457e('0x7b'),_0x457e('0x7c'),_0x457e('0x7d'),_0x457e('0x7e'),_0x457e('0x7f'),_0x457e('0x80'),_0x457e('0x81'),_0x457e('0x82'),'subjectidname',_0x457e('0x83'),'timezoneruleversionnumber',_0x457e('0x84'),_0x457e('0x85'),'utcconversiontimezonecode',_0x457e('0x86')];var _0x8b310c=_0x4661ef['concat'](_0x19cb7f);return db[_0x457e('0x2c')][_0x457e('0x38')]({'where':{'id':_0x273e54[_0x457e('0x33')]['id']},'attributes':['id',_0x457e('0x87'),_0x457e('0x88'),_0x457e('0x89'),_0x457e('0x8a'),_0x457e('0x8b'),'clientSecret',_0x457e('0x8c')],'include':[{'model':db[_0x457e('0x8d')],'as':_0x457e('0x8d'),'attributes':['id',_0x457e('0x8e'),_0x457e('0x8f')]}]})[_0x457e('0xd')](handleEntityNotFound(_0x343b7d,null))[_0x457e('0xd')](function(_0x5d9f81){if(_0x5d9f81){if(_0x5d9f81[_0x457e('0x8c')]){_0x5d9f81[_0x457e('0x90')]=_0x5d9f81['CloudProvider']['data5'];_0x25c48a=sanitizeRemoteUri(_0x5d9f81[_0x457e('0x8d')]['data7']);_0x5af4aa=getWebApiUrl(_0x25c48a);return _0x5d9f81;}_0x25c48a=sanitizeRemoteUri(_0x5d9f81[_0x457e('0x89')]);_0x5af4aa=getWebApiUrl(_0x25c48a);var _0x2b2127={'method':_0x457e('0x91'),'uri':_0x457e('0x92')+_0x5d9f81[_0x457e('0x8a')]+_0x457e('0x93'),'form':{'client_id':_0x5d9f81[_0x457e('0x8b')],'resource':_0x25c48a,'username':_0x5d9f81[_0x457e('0x87')],'password':_0x5d9f81[_0x457e('0x88')],'grant_type':'password','client_secret':_0x5d9f81[_0x457e('0x94')]},'json':!![]};return rp(_0x2b2127);}})[_0x457e('0xd')](function(_0x823dba){_0xf78d48=_0x823dba[_0x457e('0x90')];var _0x5e85f6={'method':_0x457e('0x95'),'uri':encodeURI(_0x5af4aa+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x303468+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xf78d48,'If-None-Match':null,'OData-Version':_0x457e('0x96')},'json':!![]};return rp(_0x5e85f6);})[_0x457e('0xd')](function(_0x2c6d79){var _0x5b5c87=_0x2c6d79[_0x457e('0x97')][0x0];var _0x51a653=_0x5b5c87[_0x457e('0x98')];var _0x4da3da={'method':_0x457e('0x95'),'uri':_0x5af4aa+_0x457e('0x99')+_0x51a653+_0x457e('0x9a'),'headers':{'Authorization':_0x457e('0x9b')+_0xf78d48,'If-None-Match':null,'OData-Version':_0x457e('0x96')},'json':!![]};return rp(_0x4da3da);})[_0x457e('0xd')](function(_0x3f44f5){_0x216dd9=_0x3f44f5;_0x53cfa9=_0x216dd9[_0x457e('0x9c')];_0x53cfa9=_[_0x457e('0x9d')](_0x53cfa9,function(_0x5131a6){return!_0x8b310c['includes'](_0x5131a6[_0x457e('0x9e')]);});var _0x3c7bc6=[];var _0x40b471=[];_0x53cfa9['forEach'](function(_0x4611a3){if(_0x4611a3[_0x457e('0x9f')]){var _0x65af46=_0x4611a3[_0x457e('0x9f')]['substring'](_0x4611a3[_0x457e('0x9f')][_0x457e('0x43')]('.')+0x1);if(_0x65af46===_0x457e('0xa0')){_0x3c7bc6[_0x457e('0xa1')](getSelectList(_0x5af4aa,_0x448d65,_0x40b471,_0x216dd9['MetadataId'],_0x4611a3[_0x457e('0x98')],_0xf78d48));}}});return Promise['all'](_0x3c7bc6);})['then'](function(_0x211ba8){_0x28701c=_0x211ba8[0x0];var _0x3c9966=[];var _0x5e4f22=[];_0x53cfa9[_0x457e('0xa2')](function(_0x44a1e6){if(!_[_0x457e('0xa3')](_0x44a1e6[_0x457e('0x9f')])){var _0x3e66e5=_0x44a1e6[_0x457e('0x9f')][_0x457e('0x42')](_0x44a1e6[_0x457e('0x9f')][_0x457e('0x43')]('.')+0x1);if(_0x3e66e5===_0x457e('0xa4')){_0x3c9966[_0x457e('0xa1')](getBooleanList(_0x5af4aa,_0x448d65,_0x5e4f22,_0x216dd9[_0x457e('0x98')],_0x44a1e6[_0x457e('0x98')],_0xf78d48));}}});return Promise[_0x457e('0xa5')](_0x3c9966);})[_0x457e('0xd')](function(_0x3ed4b3){_0x2504a8=_0x3ed4b3[0x0];var _0x1b2631=[];var _0x156950=[];_0x53cfa9[_0x457e('0xa2')](function(_0x258a06){if(_0x258a06[_0x457e('0x9f')]){var _0xe80a16=_0x258a06['@odata.type'][_0x457e('0x42')](_0x258a06[_0x457e('0x9f')][_0x457e('0x43')]('.')+0x1);if(_0xe80a16==='StringAttributeMetadata'||_0xe80a16==='DoubleAttributeMetadata'||_0xe80a16===_0x457e('0xa6')||_0xe80a16==='IntegerAttributeMetadata'||_0xe80a16===_0x457e('0xa7')||_0xe80a16==='DateTimeAttributeMetadata'||_0xe80a16==='StatusAttributeMetadata'||_0xe80a16===_0x457e('0xa8')||_0xe80a16==='StateAttributeMetadata'||_0xe80a16==='DecimalAttributeMetadata'){_0x1b2631[_0x457e('0xa1')](getInputList(_0x5af4aa,_0x448d65,_0xe80a16,_0x156950,_0x216dd9['MetadataId'],_0x258a06[_0x457e('0x98')],_0xf78d48));}}});return Promise[_0x457e('0xa5')](_0x1b2631);})[_0x457e('0xd')](function(_0x47ab70){_0x2afa6d=_0x47ab70[0x0];var _0x27f650=_0x28701c[_0x457e('0xa9')](_0x2504a8)[_0x457e('0xa9')](_0x2afa6d);var _0x266d0a={'count':_0x27f650[_0x457e('0x21')],'rows':_0x27f650};return _0x266d0a;})[_0x457e('0xd')](respondWithResult(_0x343b7d,null))[_0x457e('0x31')](function(_0x5652d5){var _0x4a0e9e=_0x273e54['query'][_0x457e('0xaa')]?0x1f4:_0x5652d5[_0x457e('0xab')]||0x1f4;logger[_0x457e('0x10')](_0x5652d5[_0x457e('0x11')]);delete _0x5652d5[_0x457e('0x12')];if(_0x4a0e9e===0x191){_0x4a0e9e=0x190;}_0x343b7d[_0x457e('0x6')](_0x4a0e9e)[_0x457e('0x13')](_0x273e54[_0x457e('0x1a')][_0x457e('0xaa')]?{'message':_0x457e('0xac'),'statusCode':_0x5652d5[_0x457e('0xab')]}:_0x5652d5);});};function getSelectList(_0x58206c,_0x20c937,_0x1101b1,_0x4e8455,_0x4c6540,_0x2bdf31){var _0x519009={'method':_0x457e('0x95'),'uri':_0x58206c+'EntityDefinitions('+_0x4e8455+_0x457e('0xad')+_0x4c6540+_0x457e('0xae')+_0x457e('0xaf'),'headers':{'Authorization':'Bearer\x20'+_0x2bdf31,'If-None-Match':null,'OData-Version':_0x457e('0x96')},'json':!![]};return rp(_0x519009)[_0x457e('0xd')](function(_0x233773){var _0x3b9603=[];var _0x256ae9=_0x233773[_0x457e('0xb0')][_0x457e('0xb1')];_0x256ae9[_0x457e('0xa2')](function(_0x2ae3a6){_0x3b9603[_0x457e('0xa1')]({'name':_0x2ae3a6['Label'][_0x457e('0xb2')][_0x457e('0xb3')],'value':String(_0x2ae3a6['Value'])});});var _0x282e0c={'id':_0x20c937+'_'+_0x233773['LogicalName'],'name':_0x233773[_0x457e('0xb4')][_0x457e('0xb2')]['Label'],'custom':![],'options':_0x3b9603};_0x1101b1['push'](_0x282e0c);return _0x1101b1;});}function getBooleanList(_0x2b2fff,_0x407b61,_0x3a79ae,_0x318538,_0xd0c37f,_0x148183){var _0x17b0ef={'method':'GET','uri':_0x2b2fff+_0x457e('0x99')+_0x318538+')/Attributes('+_0xd0c37f+_0x457e('0xb5'),'headers':{'Authorization':_0x457e('0x9b')+_0x148183,'If-None-Match':null,'OData-Version':_0x457e('0x96')},'json':!![]};return rp(_0x17b0ef)['then'](function(_0x58fe33){var _0x1ccb65=[];_0x1ccb65[_0x457e('0xa1')]({'name':_0x58fe33['OptionSet'][_0x457e('0xb6')][_0x457e('0xb3')]['UserLocalizedLabel'][_0x457e('0xb3')],'value':_0x457e('0xb7')},{'name':_0x58fe33[_0x457e('0xb0')]['FalseOption'][_0x457e('0xb3')][_0x457e('0xb2')][_0x457e('0xb3')],'value':_0x457e('0xb8')});var _0x8bb3ac={'id':_0x407b61+'_'+_0x58fe33[_0x457e('0x9e')],'name':_0x58fe33['DisplayName'][_0x457e('0xb2')]['Label'],'custom':![],'options':_0x1ccb65};_0x3a79ae[_0x457e('0xa1')](_0x8bb3ac);return _0x3a79ae;});}function getInputList(_0x5b6f10,_0x342fcc,_0x20710c,_0x46a6c3,_0x17fcdc,_0x8ac518,_0x9b9f73){var _0x3458fc={'method':'GET','uri':_0x5b6f10+'EntityDefinitions('+_0x17fcdc+')/Attributes('+_0x8ac518+')/Microsoft.Dynamics.CRM.'+_0x20710c+_0x457e('0xb9'),'headers':{'Authorization':_0x457e('0x9b')+_0x9b9f73,'If-None-Match':null,'OData-Version':_0x457e('0x96')},'json':!![]};return rp(_0x3458fc)['then'](function(_0x462123){var _0x10ad12={'id':_0x342fcc+'_'+_0x462123[_0x457e('0x9e')],'name':_0x462123['DisplayName']['UserLocalizedLabel']?_0x462123[_0x457e('0xb4')]['UserLocalizedLabel'][_0x457e('0xb3')]:_0x462123[_0x457e('0x9e')],'custom':![],'options':[]};_0x46a6c3[_0x457e('0xa1')](_0x10ad12);return _0x46a6c3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 80e8942..13eb541 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(_0x231bc8,_0x147fe2){var _0x136927=function(_0x3246a6){while(--_0x3246a6){_0x231bc8['push'](_0x231bc8['shift']());}};_0x136927(++_0x147fe2);}(_0x757a,0xde));var _0xa757=function(_0x175532,_0x19acec){_0x175532=_0x175532-0x0;var _0x43a059=_0x757a[_0x175532];return _0x43a059;};'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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x147e78,_0xc7ac92){var _0x4fae7f=function(_0x32baf8){while(--_0x32baf8){_0x147e78['push'](_0x147e78['shift']());}};_0x4fae7f(++_0xc7ac92);}(_0x757a,0xde));var _0xa757=function(_0x12152e,_0x550827){_0x12152e=_0x12152e-0x0;var _0x272f91=_0x757a[_0x12152e];return _0x272f91;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 216c3f8..0cf220f 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 _0xd1fe=['jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','attributes','model','ShowDynamics365Account','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f4613,_0x234c4f){var _0x3bb842=function(_0x278897){while(--_0x278897){_0x2f4613['push'](_0x2f4613['shift']());}};_0x3bb842(++_0x234c4f);}(_0xd1fe,0x145));var _0xed1f=function(_0xbbee58,_0x239bfa){_0xbbee58=_0xbbee58-0x0;var _0x56d11b=_0xd1fe[_0xbbee58];return _0x56d11b;};'use strict';var _=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var moment=require(_0xed1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xed1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed1f('0x4'));var logger=require(_0xed1f('0x5'))(_0xed1f('0x6'));var config=require(_0xed1f('0x7'));var jayson=require(_0xed1f('0x8'));var client=jayson[_0xed1f('0x9')][_0xed1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda3607,_0x1143bd,_0xf5038d){return new BPromise(function(_0x2e4392,_0x3fe2c9){return client[_0xed1f('0xb')](_0xda3607,_0xf5038d)[_0xed1f('0xc')](function(_0x4bd78c){logger[_0xed1f('0xd')](_0xed1f('0xe'),_0x1143bd,'request\x20sent');logger[_0xed1f('0xf')](_0xed1f('0x10'),_0x1143bd,_0xed1f('0x11'),JSON[_0xed1f('0x12')](_0x4bd78c));if(_0x4bd78c[_0xed1f('0x13')]){if(_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x14')]===0x1f4){logger[_0xed1f('0x13')](_0xed1f('0xe'),_0x1143bd,_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x15')]);return _0x3fe2c9(_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x15')]);}logger[_0xed1f('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x1143bd,_0x4bd78c['error']['message']);return _0x2e4392(_0x4bd78c[_0xed1f('0x13')]['message']);}else{logger[_0xed1f('0xd')](_0xed1f('0xe'),_0x1143bd,_0xed1f('0x11'));_0x2e4392(_0x4bd78c[_0xed1f('0x16')][_0xed1f('0x15')]);}})[_0xed1f('0x17')](function(_0x436b41){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1143bd,_0x436b41);_0x3fe2c9(_0x436b41);});});}exports[_0xed1f('0x18')]=function(_0x581ea6){var _0x3c280c=this;return new Promise(function(_0x5f4c0d,_0x1e756d){return db[_0xed1f('0x19')][_0xed1f('0x1a')]({'raw':_0x581ea6['options']?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1d')]||null:null,'attributes':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')]['attributes']||null:null,'limit':_0x581ea6['options']?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1e')]||null:null,'include':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1f')],function(_0x6716e5){return{'model':db[_0x6716e5['model']],'as':_0x6716e5['as'],'attributes':_0x6716e5[_0xed1f('0x21')],'include':_0x6716e5[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x6716e5[_0xed1f('0x1f')],function(_0x1ab460){return{'model':db[_0x1ab460[_0xed1f('0x22')]],'as':_0x1ab460['as'],'attributes':_0x1ab460[_0xed1f('0x21')],'include':_0x1ab460[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x1ab460[_0xed1f('0x1f')],function(_0x6e7e2f){return{'model':db[_0x6e7e2f[_0xed1f('0x22')]],'as':_0x6e7e2f['as'],'attributes':_0x6e7e2f[_0xed1f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed1f('0xc')](function(_0x22eb49){logger[_0xed1f('0xd')](_0xed1f('0x18'),_0x581ea6);logger[_0xed1f('0xf')](_0xed1f('0x18'),_0x581ea6,JSON['stringify'](_0x22eb49));_0x5f4c0d(_0x22eb49);})[_0xed1f('0x17')](function(_0x11a7ca){logger['error'](_0xed1f('0x18'),_0x11a7ca[_0xed1f('0x15')],_0x581ea6);_0x1e756d(_0x3c280c[_0xed1f('0x13')](0x1f4,_0x11a7ca[_0xed1f('0x15')]));});});};exports[_0xed1f('0x23')]=function(_0x541e46){var _0xd3b497=this;return new Promise(function(_0x4420f3,_0x924921){return db[_0xed1f('0x19')][_0xed1f('0x24')]({'raw':_0x541e46['options']?_0x541e46[_0xed1f('0x1b')][_0xed1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x541e46[_0xed1f('0x1b')]?_0x541e46['options'][_0xed1f('0x1d')]||null:null,'attributes':_0x541e46[_0xed1f('0x1b')]?_0x541e46['options'][_0xed1f('0x21')]||null:null,'include':_0x541e46[_0xed1f('0x1b')]?_0x541e46[_0xed1f('0x1b')][_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x541e46[_0xed1f('0x1b')]['include'],function(_0x4a771b){return{'model':db[_0x4a771b[_0xed1f('0x22')]],'as':_0x4a771b['as'],'attributes':_0x4a771b['attributes'],'include':_0x4a771b[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x4a771b[_0xed1f('0x1f')],function(_0x211c51){return{'model':db[_0x211c51[_0xed1f('0x22')]],'as':_0x211c51['as'],'attributes':_0x211c51[_0xed1f('0x21')],'include':_0x211c51[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x211c51[_0xed1f('0x1f')],function(_0x10b2f2){return{'model':db[_0x10b2f2[_0xed1f('0x22')]],'as':_0x10b2f2['as'],'attributes':_0x10b2f2[_0xed1f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed1f('0xc')](function(_0x37a1ad){logger[_0xed1f('0xd')](_0xed1f('0x23'),_0x541e46);logger[_0xed1f('0xf')](_0xed1f('0x23'),_0x541e46,JSON[_0xed1f('0x12')](_0x37a1ad));_0x4420f3(_0x37a1ad);})['catch'](function(_0x1fa3a6){logger['error'](_0xed1f('0x23'),_0x1fa3a6[_0xed1f('0x15')],_0x541e46);_0x924921(_0xd3b497[_0xed1f('0x13')](0x1f4,_0x1fa3a6['message']));});});}; \ No newline at end of file +var _0xfac1=['message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x37a03a,_0x4828b4){var _0x317b23=function(_0x46df2d){while(--_0x46df2d){_0x37a03a['push'](_0x37a03a['shift']());}};_0x317b23(++_0x4828b4);}(_0xfac1,0xa4));var _0x1fac=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0xfac1[_0x47a491];return _0x3b176b;};'use strict';var _=require(_0x1fac('0x0'));var util=require(_0x1fac('0x1'));var moment=require(_0x1fac('0x2'));var BPromise=require(_0x1fac('0x3'));var rs=require(_0x1fac('0x4'));var fs=require('fs');var Redis=require(_0x1fac('0x5'));var db=require(_0x1fac('0x6'))['db'];var utils=require(_0x1fac('0x7'));var logger=require(_0x1fac('0x8'))('rpc');var config=require(_0x1fac('0x9'));var jayson=require(_0x1fac('0xa'));var client=jayson[_0x1fac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf01d50,_0x111815,_0x336ae7){return new BPromise(function(_0x516d6e,_0x3bda36){return client[_0x1fac('0xc')](_0xf01d50,_0x336ae7)[_0x1fac('0xd')](function(_0x405ee1){logger[_0x1fac('0xe')](_0x1fac('0xf'),_0x111815,'request\x20sent');logger[_0x1fac('0x10')](_0x1fac('0x11'),_0x111815,_0x1fac('0x12'),JSON['stringify'](_0x405ee1));if(_0x405ee1[_0x1fac('0x13')]){if(_0x405ee1[_0x1fac('0x13')][_0x1fac('0x14')]===0x1f4){logger[_0x1fac('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x111815,_0x405ee1[_0x1fac('0x13')][_0x1fac('0x15')]);return _0x3bda36(_0x405ee1[_0x1fac('0x13')][_0x1fac('0x15')]);}logger[_0x1fac('0x13')](_0x1fac('0xf'),_0x111815,_0x405ee1[_0x1fac('0x13')]['message']);return _0x516d6e(_0x405ee1[_0x1fac('0x13')]['message']);}else{logger[_0x1fac('0xe')](_0x1fac('0xf'),_0x111815,'request\x20sent');_0x516d6e(_0x405ee1[_0x1fac('0x16')][_0x1fac('0x15')]);}})[_0x1fac('0x17')](function(_0x1ab1d2){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x111815,_0x1ab1d2);_0x3bda36(_0x1ab1d2);});});}exports[_0x1fac('0x18')]=function(_0x51df8f){var _0x2d7d63=this;return new Promise(function(_0x382089,_0x12aa3c){return db[_0x1fac('0x19')][_0x1fac('0x1a')]({'raw':_0x51df8f[_0x1fac('0x1b')]?_0x51df8f[_0x1fac('0x1b')][_0x1fac('0x1c')]===undefined?!![]:![]:!![],'where':_0x51df8f[_0x1fac('0x1b')]?_0x51df8f[_0x1fac('0x1b')][_0x1fac('0x1d')]||null:null,'attributes':_0x51df8f[_0x1fac('0x1b')]?_0x51df8f[_0x1fac('0x1b')]['attributes']||null:null,'limit':_0x51df8f[_0x1fac('0x1b')]?_0x51df8f[_0x1fac('0x1b')]['limit']||null:null,'include':_0x51df8f[_0x1fac('0x1b')]?_0x51df8f['options'][_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x51df8f[_0x1fac('0x1b')][_0x1fac('0x1e')],function(_0x2ff7fe){return{'model':db[_0x2ff7fe[_0x1fac('0x20')]],'as':_0x2ff7fe['as'],'attributes':_0x2ff7fe[_0x1fac('0x21')],'include':_0x2ff7fe[_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x2ff7fe[_0x1fac('0x1e')],function(_0x39805e){return{'model':db[_0x39805e[_0x1fac('0x20')]],'as':_0x39805e['as'],'attributes':_0x39805e[_0x1fac('0x21')],'include':_0x39805e[_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x39805e[_0x1fac('0x1e')],function(_0x2be3c2){return{'model':db[_0x2be3c2[_0x1fac('0x20')]],'as':_0x2be3c2['as'],'attributes':_0x2be3c2[_0x1fac('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1fac('0xd')](function(_0x5743f6){logger[_0x1fac('0xe')](_0x1fac('0x18'),_0x51df8f);logger[_0x1fac('0x10')]('GetDynamics365Account',_0x51df8f,JSON[_0x1fac('0x22')](_0x5743f6));_0x382089(_0x5743f6);})[_0x1fac('0x17')](function(_0x544d95){logger[_0x1fac('0x13')](_0x1fac('0x18'),_0x544d95[_0x1fac('0x15')],_0x51df8f);_0x12aa3c(_0x2d7d63[_0x1fac('0x13')](0x1f4,_0x544d95[_0x1fac('0x15')]));});});};exports[_0x1fac('0x23')]=function(_0x1ea47e){var _0x1ca76f=this;return new Promise(function(_0x58c1f9,_0x3775b7){return db[_0x1fac('0x19')][_0x1fac('0x24')]({'raw':_0x1ea47e[_0x1fac('0x1b')]?_0x1ea47e['options'][_0x1fac('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ea47e['options']?_0x1ea47e[_0x1fac('0x1b')][_0x1fac('0x1d')]||null:null,'attributes':_0x1ea47e[_0x1fac('0x1b')]?_0x1ea47e['options']['attributes']||null:null,'include':_0x1ea47e[_0x1fac('0x1b')]?_0x1ea47e[_0x1fac('0x1b')][_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x1ea47e['options'][_0x1fac('0x1e')],function(_0x24a3d3){return{'model':db[_0x24a3d3['model']],'as':_0x24a3d3['as'],'attributes':_0x24a3d3[_0x1fac('0x21')],'include':_0x24a3d3[_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x24a3d3['include'],function(_0x26718c){return{'model':db[_0x26718c[_0x1fac('0x20')]],'as':_0x26718c['as'],'attributes':_0x26718c[_0x1fac('0x21')],'include':_0x26718c[_0x1fac('0x1e')]?_[_0x1fac('0x1f')](_0x26718c['include'],function(_0x434362){return{'model':db[_0x434362[_0x1fac('0x20')]],'as':_0x434362['as'],'attributes':_0x434362[_0x1fac('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f2490){logger[_0x1fac('0xe')](_0x1fac('0x23'),_0x1ea47e);logger['debug'](_0x1fac('0x23'),_0x1ea47e,JSON[_0x1fac('0x22')](_0x2f2490));_0x58c1f9(_0x2f2490);})['catch'](function(_0x27f5f3){logger[_0x1fac('0x13')](_0x1fac('0x23'),_0x27f5f3['message'],_0x1ea47e);_0x3775b7(_0x1ca76f[_0x1fac('0x13')](0x1f4,_0x27f5f3[_0x1fac('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4eb7c7d..37ade61 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 _0x225b=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x225b,0xb1));var _0xb225=function(_0x126489,_0x1fa25b){_0x126489=_0x126489-0x0;var _0x29e58b=_0x225b[_0x126489];return _0x29e58b;};'use strict';var multer=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var path=require('path');var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var fs_extra=require(_0xb225('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb225('0x5'));var config=require('../../config/environment');var controller=require(_0xb225('0x6'));router[_0xb225('0x7')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0x9')]);router[_0xb225('0x7')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller['show']);router[_0xb225('0x7')](_0xb225('0xb'),auth[_0xb225('0x8')](),controller[_0xb225('0xc')]);router['get'](_0xb225('0xd'),auth[_0xb225('0x8')](),controller[_0xb225('0xe')]);router['get'](_0xb225('0xf'),auth[_0xb225('0x8')](),controller[_0xb225('0x10')]);router[_0xb225('0x11')]('/',auth[_0xb225('0x8')](),controller['create']);router[_0xb225('0x12')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller[_0xb225('0x13')]);router[_0xb225('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb225('0x15')]);module[_0xb225('0x16')]=router; \ No newline at end of file +var _0x6f24=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x240451,_0x2a7f2c){var _0x5710f7=function(_0x23d081){while(--_0x23d081){_0x240451['push'](_0x240451['shift']());}};_0x5710f7(++_0x2a7f2c);}(_0x6f24,0x76));var _0x46f2=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x6f24[_0x3825a8];return _0xabc9bc;};'use strict';var multer=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var path=require('path');var timeout=require(_0x46f2('0x2'));var express=require(_0x46f2('0x3'));var router=express[_0x46f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x46f2('0x6'));var controller=require(_0x46f2('0x7'));router[_0x46f2('0x8')]('/',auth[_0x46f2('0x9')](),controller[_0x46f2('0xa')]);router['get'](_0x46f2('0xb'),auth[_0x46f2('0x9')](),controller[_0x46f2('0xc')]);router['get'](_0x46f2('0xd'),auth[_0x46f2('0x9')](),controller[_0x46f2('0xe')]);router[_0x46f2('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x46f2('0xf')]);router[_0x46f2('0x8')](_0x46f2('0x10'),auth[_0x46f2('0x9')](),controller['getDescriptions']);router[_0x46f2('0x11')]('/',auth[_0x46f2('0x9')](),controller[_0x46f2('0x12')]);router[_0x46f2('0x13')]('/:id',auth[_0x46f2('0x9')](),controller[_0x46f2('0x14')]);router[_0x46f2('0x15')](_0x46f2('0xb'),auth[_0x46f2('0x9')](),controller[_0x46f2('0x16')]);module[_0x46f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index abc2a4d..0d99ca7 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 _0x2b56=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact','nothing'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x2b56,0x109));var _0x62b5=function(_0x3e42ee,_0x11abfc){_0x3e42ee=_0x3e42ee-0x0;var _0x310f87=_0x2b56[_0x3e42ee];return _0x310f87;};'use strict';var Sequelize=require(_0x62b5('0x0'));module[_0x62b5('0x1')]={'name':{'type':Sequelize[_0x62b5('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x62b5('0x3')](_0x62b5('0x4'),'phonecall'),'defaultValue':_0x62b5('0x4')},'moduleCreate':{'type':Sequelize[_0x62b5('0x3')](_0x62b5('0x5'),_0x62b5('0x6')),'defaultValue':_0x62b5('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x62b5('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x62b5('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x444a=['BOOLEAN','exports','STRING','ENUM','phonecall','incident','nothing'];(function(_0x31860e,_0x2e8f1c){var _0x2d9c18=function(_0x5b6aa4){while(--_0x5b6aa4){_0x31860e['push'](_0x31860e['shift']());}};_0x2d9c18(++_0x2e8f1c);}(_0x444a,0x7f));var _0xa444=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x444a[_0x326d35];return _0xd3f8f3;};'use strict';var Sequelize=require('sequelize');module[_0xa444('0x0')]={'name':{'type':Sequelize[_0xa444('0x1')]},'description':{'type':Sequelize[_0xa444('0x1')]},'ticketType':{'type':Sequelize[_0xa444('0x2')]('incident',_0xa444('0x3')),'defaultValue':_0xa444('0x4')},'moduleCreate':{'type':Sequelize[_0xa444('0x2')]('contact',_0xa444('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa444('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa444('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c8fe150..cacf66d 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 _0x7ebb=['sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x58fac8,_0x5ec989){var _0x4a560e=function(_0x1edf34){while(--_0x1edf34){_0x58fac8['push'](_0x58fac8['shift']());}};_0x4a560e(++_0x5ec989);}(_0x7ebb,0x13a));var _0xb7eb=function(_0x5e9c3a,_0x13acc2){_0x5e9c3a=_0x5e9c3a-0x0;var _0x12ccb4=_0x7ebb[_0x5e9c3a];return _0x12ccb4;};'use strict';var emlformat=require(_0xb7eb('0x0'));var rimraf=require(_0xb7eb('0x1'));var zipdir=require(_0xb7eb('0x2'));var jsonpatch=require(_0xb7eb('0x3'));var rp=require(_0xb7eb('0x4'));var moment=require(_0xb7eb('0x5'));var BPromise=require(_0xb7eb('0x6'));var Mustache=require(_0xb7eb('0x7'));var util=require(_0xb7eb('0x8'));var path=require(_0xb7eb('0x9'));var sox=require(_0xb7eb('0xa'));var csv=require(_0xb7eb('0xb'));var ejs=require(_0xb7eb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7eb('0xd'));var squel=require(_0xb7eb('0xe'));var crypto=require(_0xb7eb('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7eb('0xb'));var querystring=require(_0xb7eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb7eb('0x11'));var qs=require(_0xb7eb('0x12'));var as=require(_0xb7eb('0x13'));var hardwareService=require(_0xb7eb('0x14'));var logger=require(_0xb7eb('0x15'))(_0xb7eb('0x16'));var utils=require(_0xb7eb('0x17'));var config=require(_0xb7eb('0x18'));var licenseUtil=require(_0xb7eb('0x19'));var db=require(_0xb7eb('0x1a'))['db'];function respondWithStatusCode(_0x46a5ce,_0x374e19){_0x374e19=_0x374e19||0xcc;return function(_0x158069){if(_0x158069){return _0x46a5ce[_0xb7eb('0x1b')](_0x374e19);}return _0x46a5ce[_0xb7eb('0x1c')](_0x374e19)[_0xb7eb('0x1d')]();};}function respondWithResult(_0xb5b9ae,_0x5e5133){_0x5e5133=_0x5e5133||0xc8;return function(_0x483e15){if(_0x483e15){return _0xb5b9ae[_0xb7eb('0x1c')](_0x5e5133)['json'](_0x483e15);}};}function respondWithFilteredResult(_0x227634,_0x4094a2){return function(_0x3a723d){if(_0x3a723d){var _0x46943d=typeof _0x4094a2[_0xb7eb('0x1e')]===_0xb7eb('0x1f')&&typeof _0x4094a2[_0xb7eb('0x20')]==='undefined';var _0x1685c8=_0x3a723d[_0xb7eb('0x21')];var _0x376e3c=_0x46943d?0x0:_0x4094a2[_0xb7eb('0x1e')];var _0x4afb5c=_0x46943d?_0x3a723d[_0xb7eb('0x21')]:_0x4094a2['offset']+_0x4094a2['limit'];var _0x4e5ec4;if(_0x4afb5c>=_0x1685c8){_0x4afb5c=_0x1685c8;_0x4e5ec4=0xc8;}else{_0x4e5ec4=0xce;}_0x227634[_0xb7eb('0x1c')](_0x4e5ec4);return _0x227634[_0xb7eb('0x22')](_0xb7eb('0x23'),_0x376e3c+'-'+_0x4afb5c+'/'+_0x1685c8)[_0xb7eb('0x24')](_0x3a723d);}return null;};}function patchUpdates(_0x44cec7){return function(_0x5bf011){try{jsonpatch['apply'](_0x5bf011,_0x44cec7,!![]);}catch(_0xfb473c){return BPromise[_0xb7eb('0x25')](_0xfb473c);}return _0x5bf011[_0xb7eb('0x26')]();};}function saveUpdates(_0x4c8bd0,_0x200823){return function(_0x243392){if(_0x243392){return _0x243392[_0xb7eb('0x27')](_0x4c8bd0)[_0xb7eb('0x28')](function(_0x1b9e3b){return _0x1b9e3b;});}return null;};}function removeEntity(_0x5a5729,_0x2698ae){return function(_0x263593){if(_0x263593){return _0x263593[_0xb7eb('0x29')]()['then'](function(){_0x5a5729[_0xb7eb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1170ba,_0x5871c8){return function(_0x271b15){if(!_0x271b15){_0x1170ba['sendStatus'](0x194);}return _0x271b15;};}function handleError(_0xae1231,_0x16cd4a){_0x16cd4a=_0x16cd4a||0x1f4;return function(_0x1d81ad){logger['error'](_0x1d81ad[_0xb7eb('0x2a')]);if(_0x1d81ad[_0xb7eb('0x2b')]){delete _0x1d81ad[_0xb7eb('0x2b')];}_0xae1231['status'](_0x16cd4a)['send'](_0x1d81ad);};}exports[_0xb7eb('0x2c')]=function(_0x3026d8,_0x23b35d){var _0x1fbb60={},_0x20c44c={},_0x5e657e={'count':0x0,'rows':[]};var _0xa69664=_[_0xb7eb('0x2d')](db[_0xb7eb('0x2e')][_0xb7eb('0x2f')],function(_0x564de0){return{'name':_0x564de0['fieldName'],'type':_0x564de0[_0xb7eb('0x30')]['key']};});_0x20c44c['model']=_[_0xb7eb('0x2d')](_0xa69664,'name');_0x20c44c['query']=_[_0xb7eb('0x31')](_0x3026d8[_0xb7eb('0x32')]);_0x20c44c[_0xb7eb('0x33')]=_['intersection'](_0x20c44c[_0xb7eb('0x34')],_0x20c44c['query']);_0x1fbb60[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x20c44c[_0xb7eb('0x34')],qs[_0xb7eb('0x37')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x1fbb60[_0xb7eb('0x35')]=_0x1fbb60[_0xb7eb('0x35')][_0xb7eb('0x38')]?_0x1fbb60[_0xb7eb('0x35')]:_0x20c44c[_0xb7eb('0x34')];if(!_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x39')]('nolimit')){_0x1fbb60[_0xb7eb('0x20')]=qs[_0xb7eb('0x20')](_0x3026d8['query']['limit']);_0x1fbb60[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x1e')]);}_0x1fbb60[_0xb7eb('0x3a')]=qs[_0xb7eb('0x3b')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3b')]);_0x1fbb60[_0xb7eb('0x3c')]=qs[_0xb7eb('0x33')](_[_0xb7eb('0x3d')](_0x3026d8[_0xb7eb('0x32')],_0x20c44c[_0xb7eb('0x33')]),_0xa69664);if(_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x1fbb60[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x1fbb60['where'],{'$or':_[_0xb7eb('0x2d')](_0xa69664,function(_0x23f41f){if(_0x23f41f[_0xb7eb('0x30')]!==_0xb7eb('0x40')){var _0x246870={};_0x246870[_0x23f41f['name']]={'$like':'%'+_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x246870;}})});}_0x1fbb60=_[_0xb7eb('0x3f')]({},_0x1fbb60,_0x3026d8[_0xb7eb('0x41')]);var _0x13a82a={'where':_0x1fbb60[_0xb7eb('0x3c')]};return db[_0xb7eb('0x2e')][_0xb7eb('0x21')](_0x13a82a)['then'](function(_0x4e8c10){_0x5e657e[_0xb7eb('0x21')]=_0x4e8c10;if(_0x3026d8[_0xb7eb('0x32')]['includeAll']){_0x1fbb60[_0xb7eb('0x42')]=[{'all':!![]}];}return db[_0xb7eb('0x2e')]['findAll'](_0x1fbb60);})[_0xb7eb('0x28')](function(_0x2fbffe){_0x5e657e[_0xb7eb('0x43')]=_0x2fbffe;return _0x5e657e;})[_0xb7eb('0x28')](respondWithFilteredResult(_0x23b35d,_0x1fbb60))[_0xb7eb('0x44')](handleError(_0x23b35d,null));};exports[_0xb7eb('0x45')]=function(_0x25e74c,_0x1c6346){var _0x472880={'raw':![],'where':{'id':_0x25e74c[_0xb7eb('0x46')]['id']}},_0x45010e={};_0x45010e['model']=_[_0xb7eb('0x31')](db[_0xb7eb('0x2e')][_0xb7eb('0x2f')]);_0x45010e[_0xb7eb('0x32')]=_[_0xb7eb('0x31')](_0x25e74c[_0xb7eb('0x32')]);_0x45010e[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x45010e['model'],_0x45010e[_0xb7eb('0x32')]);_0x472880[_0xb7eb('0x35')]=_['intersection'](_0x45010e[_0xb7eb('0x34')],qs['fields'](_0x25e74c['query'][_0xb7eb('0x37')]));_0x472880[_0xb7eb('0x35')]=_0x472880['attributes'][_0xb7eb('0x38')]?_0x472880[_0xb7eb('0x35')]:_0x45010e[_0xb7eb('0x34')];if(_0x25e74c[_0xb7eb('0x32')][_0xb7eb('0x47')]){_0x472880[_0xb7eb('0x42')]=[{'all':!![]}];}_0x472880=_[_0xb7eb('0x3f')]({},_0x472880,_0x25e74c[_0xb7eb('0x41')]);return db[_0xb7eb('0x2e')][_0xb7eb('0x48')](_0x472880)[_0xb7eb('0x28')](handleEntityNotFound(_0x1c6346,null))[_0xb7eb('0x28')](respondWithResult(_0x1c6346,null))[_0xb7eb('0x44')](handleError(_0x1c6346,null));};exports[_0xb7eb('0x49')]=function(_0x16f1f2,_0x5d930e){return db[_0xb7eb('0x2e')][_0xb7eb('0x49')](_0x16f1f2[_0xb7eb('0x4a')],{})[_0xb7eb('0x28')](respondWithResult(_0x5d930e,0xc9))[_0xb7eb('0x44')](handleError(_0x5d930e,null));};exports[_0xb7eb('0x27')]=function(_0x4e7372,_0x70abe7){if(_0x4e7372[_0xb7eb('0x4a')]['id']){delete _0x4e7372[_0xb7eb('0x4a')]['id'];}return db[_0xb7eb('0x2e')][_0xb7eb('0x48')]({'where':{'id':_0x4e7372[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x70abe7,null))[_0xb7eb('0x28')](saveUpdates(_0x4e7372['body'],null))[_0xb7eb('0x28')](respondWithResult(_0x70abe7,null))['catch'](handleError(_0x70abe7,null));};exports['destroy']=function(_0x430f4f,_0x1a92f7){return db[_0xb7eb('0x2e')][_0xb7eb('0x48')]({'where':{'id':_0x430f4f[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x1a92f7,null))[_0xb7eb('0x28')](removeEntity(_0x1a92f7,null))[_0xb7eb('0x44')](handleError(_0x1a92f7,null));};exports[_0xb7eb('0x4b')]=function(_0x345f5e,_0x334237,_0x4d06fe){var _0x3c83af={};var _0x5e3f17={};var _0x4f0fb0;var _0x23deb1;return db[_0xb7eb('0x2e')][_0xb7eb('0x4c')]({'where':{'id':_0x345f5e[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x334237,null))[_0xb7eb('0x28')](function(_0x3e500f){if(_0x3e500f){_0x4f0fb0=_0x3e500f;_0x5e3f17['model']=_[_0xb7eb('0x31')](db[_0xb7eb('0x4d')][_0xb7eb('0x2f')]);_0x5e3f17[_0xb7eb('0x32')]=_[_0xb7eb('0x31')](_0x345f5e[_0xb7eb('0x32')]);_0x5e3f17[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x5e3f17[_0xb7eb('0x34')],_0x5e3f17['query']);_0x3c83af[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x5e3f17[_0xb7eb('0x34')],qs['fields'](_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x3c83af[_0xb7eb('0x35')]=_0x3c83af[_0xb7eb('0x35')][_0xb7eb('0x38')]?_0x3c83af['attributes']:_0x5e3f17[_0xb7eb('0x34')];_0x3c83af[_0xb7eb('0x3a')]=qs[_0xb7eb('0x3b')](_0x345f5e['query'][_0xb7eb('0x3b')]);_0x3c83af[_0xb7eb('0x3c')]=qs['filters'](_[_0xb7eb('0x3d')](_0x345f5e[_0xb7eb('0x32')],_0x5e3f17[_0xb7eb('0x33')]));if(_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x3c83af[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x3c83af[_0xb7eb('0x3c')],{'$or':_[_0xb7eb('0x2d')](_0x3c83af['attributes'],function(_0x337344){var _0x3068e3={};_0x3068e3[_0x337344]={'$like':'%'+_0x345f5e[_0xb7eb('0x32')]['filter']+'%'};return _0x3068e3;})});}_0x3c83af=_[_0xb7eb('0x3f')]({},_0x3c83af,_0x345f5e[_0xb7eb('0x41')]);return _0x4f0fb0[_0xb7eb('0x4b')](_0x3c83af);}})[_0xb7eb('0x28')](function(_0x555353){if(_0x555353){_0x23deb1=_0x555353[_0xb7eb('0x38')];if(!_0x345f5e['query'][_0xb7eb('0x39')]('nolimit')){_0x3c83af[_0xb7eb('0x20')]=qs[_0xb7eb('0x20')](_0x345f5e[_0xb7eb('0x32')]['limit']);_0x3c83af['offset']=qs[_0xb7eb('0x1e')](_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x1e')]);}return _0x4f0fb0[_0xb7eb('0x4b')](_0x3c83af);}})['then'](function(_0x28f5a9){if(_0x28f5a9){return _0x28f5a9?{'count':_0x23deb1,'rows':_0x28f5a9}:null;}})['then'](respondWithResult(_0x334237,null))[_0xb7eb('0x44')](handleError(_0x334237,null));};exports[_0xb7eb('0x4e')]=function(_0x17e526,_0x214a4c,_0x3e2b36){var _0x581170={};var _0x3938c5={};var _0x4d65a5;var _0x35ff21;return db[_0xb7eb('0x2e')]['findOne']({'where':{'id':_0x17e526[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x214a4c,null))[_0xb7eb('0x28')](function(_0x3c1237){if(_0x3c1237){_0x4d65a5=_0x3c1237;_0x3938c5[_0xb7eb('0x34')]=_['keys'](db[_0xb7eb('0x4d')]['rawAttributes']);_0x3938c5['query']=_[_0xb7eb('0x31')](_0x17e526[_0xb7eb('0x32')]);_0x3938c5[_0xb7eb('0x33')]=_['intersection'](_0x3938c5[_0xb7eb('0x34')],_0x3938c5[_0xb7eb('0x32')]);_0x581170[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x3938c5['model'],qs['fields'](_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x581170[_0xb7eb('0x35')]=_0x581170[_0xb7eb('0x35')]['length']?_0x581170[_0xb7eb('0x35')]:_0x3938c5['model'];_0x581170[_0xb7eb('0x3a')]=qs['sort'](_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3b')]);_0x581170[_0xb7eb('0x3c')]=qs[_0xb7eb('0x33')](_['pick'](_0x17e526['query'],_0x3938c5[_0xb7eb('0x33')]));if(_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x581170[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x581170['where'],{'$or':_[_0xb7eb('0x2d')](_0x581170[_0xb7eb('0x35')],function(_0x36c8bb){var _0x1ffeab={};_0x1ffeab[_0x36c8bb]={'$like':'%'+_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x1ffeab;})});}_0x581170=_[_0xb7eb('0x3f')]({},_0x581170,_0x17e526[_0xb7eb('0x41')]);return _0x4d65a5[_0xb7eb('0x4e')](_0x581170);}})[_0xb7eb('0x28')](function(_0x3d5976){if(_0x3d5976){_0x35ff21=_0x3d5976[_0xb7eb('0x38')];if(!_0x17e526[_0xb7eb('0x32')]['hasOwnProperty'](_0xb7eb('0x4f'))){_0x581170['limit']=qs['limit'](_0x17e526['query'][_0xb7eb('0x20')]);_0x581170[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x17e526['query'][_0xb7eb('0x1e')]);}return _0x4d65a5[_0xb7eb('0x4e')](_0x581170);}})[_0xb7eb('0x28')](function(_0x11ba04){if(_0x11ba04){return _0x11ba04?{'count':_0x35ff21,'rows':_0x11ba04}:null;}})['then'](respondWithResult(_0x214a4c,null))[_0xb7eb('0x44')](handleError(_0x214a4c,null));};exports[_0xb7eb('0x50')]=function(_0x4a9ec0,_0x40cecc,_0x472f44){var _0x16d9f3={};var _0x46c47d={};var _0x4e3f5f;var _0x7e5633;return db[_0xb7eb('0x2e')][_0xb7eb('0x4c')]({'where':{'id':_0x4a9ec0[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x40cecc,null))[_0xb7eb('0x28')](function(_0x2a3144){if(_0x2a3144){_0x4e3f5f=_0x2a3144;_0x46c47d[_0xb7eb('0x34')]=_['keys'](db[_0xb7eb('0x4d')][_0xb7eb('0x2f')]);_0x46c47d['query']=_['keys'](_0x4a9ec0[_0xb7eb('0x32')]);_0x46c47d[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x46c47d[_0xb7eb('0x34')],_0x46c47d[_0xb7eb('0x32')]);_0x16d9f3[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x46c47d[_0xb7eb('0x34')],qs['fields'](_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x16d9f3[_0xb7eb('0x35')]=_0x16d9f3['attributes'][_0xb7eb('0x38')]?_0x16d9f3[_0xb7eb('0x35')]:_0x46c47d[_0xb7eb('0x34')];_0x16d9f3[_0xb7eb('0x3a')]=qs['sort'](_0x4a9ec0[_0xb7eb('0x32')]['sort']);_0x16d9f3['where']=qs[_0xb7eb('0x33')](_[_0xb7eb('0x3d')](_0x4a9ec0[_0xb7eb('0x32')],_0x46c47d['filters']));if(_0x4a9ec0['query'][_0xb7eb('0x3e')]){_0x16d9f3[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x16d9f3[_0xb7eb('0x3c')],{'$or':_[_0xb7eb('0x2d')](_0x16d9f3[_0xb7eb('0x35')],function(_0x1e9b50){var _0x4f4cc4={};_0x4f4cc4[_0x1e9b50]={'$like':'%'+_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x4f4cc4;})});}_0x16d9f3=_['merge']({},_0x16d9f3,_0x4a9ec0['options']);return _0x4e3f5f[_0xb7eb('0x50')](_0x16d9f3);}})[_0xb7eb('0x28')](function(_0x59a3be){if(_0x59a3be){_0x7e5633=_0x59a3be[_0xb7eb('0x38')];if(!_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x39')](_0xb7eb('0x4f'))){_0x16d9f3[_0xb7eb('0x20')]=qs['limit'](_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x20')]);_0x16d9f3[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x4a9ec0['query'][_0xb7eb('0x1e')]);}return _0x4e3f5f[_0xb7eb('0x50')](_0x16d9f3);}})[_0xb7eb('0x28')](function(_0x1ce567){if(_0x1ce567){return _0x1ce567?{'count':_0x7e5633,'rows':_0x1ce567}:null;}})['then'](respondWithResult(_0x40cecc,null))[_0xb7eb('0x44')](handleError(_0x40cecc,null));}; \ No newline at end of file +var _0xc446=['attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','destroy','getFields','findOne','length','getSubjects','hasOwnProperty','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','undefined','count','json','apply','reject','save','update','then','error','stack','name','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields'];(function(_0x1f0879,_0x541e39){var _0x2ce3d4=function(_0x2ae3c7){while(--_0x2ae3c7){_0x1f0879['push'](_0x1f0879['shift']());}};_0x2ce3d4(++_0x541e39);}(_0xc446,0xb9));var _0x6c44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc446[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6c44('0x0'));var rimraf=require(_0x6c44('0x1'));var zipdir=require(_0x6c44('0x2'));var jsonpatch=require(_0x6c44('0x3'));var rp=require('request-promise');var moment=require(_0x6c44('0x4'));var BPromise=require(_0x6c44('0x5'));var Mustache=require(_0x6c44('0x6'));var util=require(_0x6c44('0x7'));var path=require(_0x6c44('0x8'));var sox=require('sox');var csv=require(_0x6c44('0x9'));var ejs=require(_0x6c44('0xa'));var fs=require('fs');var fs_extra=require(_0x6c44('0xb'));var _=require(_0x6c44('0xc'));var squel=require(_0x6c44('0xd'));var crypto=require(_0x6c44('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c44('0xf'));var Papa=require(_0x6c44('0x10'));var Redis=require(_0x6c44('0x11'));var authService=require(_0x6c44('0x12'));var qs=require(_0x6c44('0x13'));var as=require(_0x6c44('0x14'));var hardwareService=require(_0x6c44('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6c44('0x16'));var licenseUtil=require(_0x6c44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x181acd,_0x857793){_0x857793=_0x857793||0xcc;return function(_0x28a686){if(_0x28a686){return _0x181acd[_0x6c44('0x18')](_0x857793);}return _0x181acd['status'](_0x857793)[_0x6c44('0x19')]();};}function respondWithResult(_0xb10c1f,_0x2bbe4a){_0x2bbe4a=_0x2bbe4a||0xc8;return function(_0x4abe81){if(_0x4abe81){return _0xb10c1f[_0x6c44('0x1a')](_0x2bbe4a)['json'](_0x4abe81);}};}function respondWithFilteredResult(_0x5bf7f5,_0x1882be){return function(_0x2ac3ed){if(_0x2ac3ed){var _0x21ea1f=typeof _0x1882be[_0x6c44('0x1b')]==='undefined'&&typeof _0x1882be[_0x6c44('0x1c')]===_0x6c44('0x1d');var _0x3056c2=_0x2ac3ed[_0x6c44('0x1e')];var _0xacea69=_0x21ea1f?0x0:_0x1882be[_0x6c44('0x1b')];var _0x4eeb3c=_0x21ea1f?_0x2ac3ed[_0x6c44('0x1e')]:_0x1882be[_0x6c44('0x1b')]+_0x1882be[_0x6c44('0x1c')];var _0x833df8;if(_0x4eeb3c>=_0x3056c2){_0x4eeb3c=_0x3056c2;_0x833df8=0xc8;}else{_0x833df8=0xce;}_0x5bf7f5[_0x6c44('0x1a')](_0x833df8);return _0x5bf7f5['set']('Content-Range',_0xacea69+'-'+_0x4eeb3c+'/'+_0x3056c2)[_0x6c44('0x1f')](_0x2ac3ed);}return null;};}function patchUpdates(_0x324aa5){return function(_0x1ba019){try{jsonpatch[_0x6c44('0x20')](_0x1ba019,_0x324aa5,!![]);}catch(_0x4891e9){return BPromise[_0x6c44('0x21')](_0x4891e9);}return _0x1ba019[_0x6c44('0x22')]();};}function saveUpdates(_0x4ce5a6,_0x58c2e2){return function(_0x5e89a2){if(_0x5e89a2){return _0x5e89a2[_0x6c44('0x23')](_0x4ce5a6)[_0x6c44('0x24')](function(_0x55f682){return _0x55f682;});}return null;};}function removeEntity(_0x32aec9,_0x142090){return function(_0x293e66){if(_0x293e66){return _0x293e66['destroy']()[_0x6c44('0x24')](function(){_0x32aec9[_0x6c44('0x1a')](0xcc)[_0x6c44('0x19')]();});}};}function handleEntityNotFound(_0x1ec9b0,_0x4116cd){return function(_0xf7f1f2){if(!_0xf7f1f2){_0x1ec9b0[_0x6c44('0x18')](0x194);}return _0xf7f1f2;};}function handleError(_0x11c259,_0x2eaf4b){_0x2eaf4b=_0x2eaf4b||0x1f4;return function(_0x142d28){logger[_0x6c44('0x25')](_0x142d28[_0x6c44('0x26')]);if(_0x142d28[_0x6c44('0x27')]){delete _0x142d28['name'];}_0x11c259['status'](_0x2eaf4b)['send'](_0x142d28);};}exports['index']=function(_0x573a37,_0x393277){var _0x2516b8={},_0x57fa0c={},_0x42cf9a={'count':0x0,'rows':[]};var _0x14676b=_[_0x6c44('0x28')](db[_0x6c44('0x29')][_0x6c44('0x2a')],function(_0x38af01){return{'name':_0x38af01[_0x6c44('0x2b')],'type':_0x38af01[_0x6c44('0x2c')][_0x6c44('0x2d')]};});_0x57fa0c[_0x6c44('0x2e')]=_[_0x6c44('0x28')](_0x14676b,_0x6c44('0x27'));_0x57fa0c['query']=_[_0x6c44('0x2f')](_0x573a37[_0x6c44('0x30')]);_0x57fa0c[_0x6c44('0x31')]=_[_0x6c44('0x32')](_0x57fa0c['model'],_0x57fa0c[_0x6c44('0x30')]);_0x2516b8['attributes']=_[_0x6c44('0x32')](_0x57fa0c['model'],qs[_0x6c44('0x33')](_0x573a37[_0x6c44('0x30')][_0x6c44('0x33')]));_0x2516b8['attributes']=_0x2516b8[_0x6c44('0x34')]['length']?_0x2516b8[_0x6c44('0x34')]:_0x57fa0c[_0x6c44('0x2e')];if(!_0x573a37[_0x6c44('0x30')]['hasOwnProperty'](_0x6c44('0x35'))){_0x2516b8[_0x6c44('0x1c')]=qs[_0x6c44('0x1c')](_0x573a37['query']['limit']);_0x2516b8[_0x6c44('0x1b')]=qs[_0x6c44('0x1b')](_0x573a37['query'][_0x6c44('0x1b')]);}_0x2516b8[_0x6c44('0x36')]=qs['sort'](_0x573a37[_0x6c44('0x30')][_0x6c44('0x37')]);_0x2516b8[_0x6c44('0x38')]=qs['filters'](_[_0x6c44('0x39')](_0x573a37['query'],_0x57fa0c[_0x6c44('0x31')]),_0x14676b);if(_0x573a37[_0x6c44('0x30')][_0x6c44('0x3a')]){_0x2516b8[_0x6c44('0x38')]=_[_0x6c44('0x3b')](_0x2516b8[_0x6c44('0x38')],{'$or':_[_0x6c44('0x28')](_0x14676b,function(_0x594231){if(_0x594231[_0x6c44('0x2c')]!==_0x6c44('0x3c')){var _0x3ae8ec={};_0x3ae8ec[_0x594231['name']]={'$like':'%'+_0x573a37['query'][_0x6c44('0x3a')]+'%'};return _0x3ae8ec;}})});}_0x2516b8=_['merge']({},_0x2516b8,_0x573a37[_0x6c44('0x3d')]);var _0x49163d={'where':_0x2516b8[_0x6c44('0x38')]};return db[_0x6c44('0x29')]['count'](_0x49163d)['then'](function(_0x232436){_0x42cf9a[_0x6c44('0x1e')]=_0x232436;if(_0x573a37['query']['includeAll']){_0x2516b8['include']=[{'all':!![]}];}return db[_0x6c44('0x29')]['findAll'](_0x2516b8);})[_0x6c44('0x24')](function(_0x10c774){_0x42cf9a[_0x6c44('0x3e')]=_0x10c774;return _0x42cf9a;})['then'](respondWithFilteredResult(_0x393277,_0x2516b8))[_0x6c44('0x3f')](handleError(_0x393277,null));};exports[_0x6c44('0x40')]=function(_0x2dabdf,_0xb0622){var _0x14f28b={'raw':![],'where':{'id':_0x2dabdf[_0x6c44('0x41')]['id']}},_0x3d12e2={};_0x3d12e2[_0x6c44('0x2e')]=_[_0x6c44('0x2f')](db[_0x6c44('0x29')][_0x6c44('0x2a')]);_0x3d12e2[_0x6c44('0x30')]=_[_0x6c44('0x2f')](_0x2dabdf[_0x6c44('0x30')]);_0x3d12e2[_0x6c44('0x31')]=_[_0x6c44('0x32')](_0x3d12e2[_0x6c44('0x2e')],_0x3d12e2['query']);_0x14f28b[_0x6c44('0x34')]=_[_0x6c44('0x32')](_0x3d12e2[_0x6c44('0x2e')],qs[_0x6c44('0x33')](_0x2dabdf[_0x6c44('0x30')][_0x6c44('0x33')]));_0x14f28b[_0x6c44('0x34')]=_0x14f28b['attributes']['length']?_0x14f28b['attributes']:_0x3d12e2[_0x6c44('0x2e')];if(_0x2dabdf[_0x6c44('0x30')][_0x6c44('0x42')]){_0x14f28b[_0x6c44('0x43')]=[{'all':!![]}];}_0x14f28b=_[_0x6c44('0x3b')]({},_0x14f28b,_0x2dabdf[_0x6c44('0x3d')]);return db['Dynamics365Configuration'][_0x6c44('0x44')](_0x14f28b)[_0x6c44('0x24')](handleEntityNotFound(_0xb0622,null))['then'](respondWithResult(_0xb0622,null))[_0x6c44('0x3f')](handleError(_0xb0622,null));};exports[_0x6c44('0x45')]=function(_0x24886c,_0x3b14d1){return db[_0x6c44('0x29')][_0x6c44('0x45')](_0x24886c[_0x6c44('0x46')],{})[_0x6c44('0x24')](respondWithResult(_0x3b14d1,0xc9))['catch'](handleError(_0x3b14d1,null));};exports['update']=function(_0x1d7dfe,_0x139316){if(_0x1d7dfe[_0x6c44('0x46')]['id']){delete _0x1d7dfe[_0x6c44('0x46')]['id'];}return db[_0x6c44('0x29')][_0x6c44('0x44')]({'where':{'id':_0x1d7dfe['params']['id']}})['then'](handleEntityNotFound(_0x139316,null))[_0x6c44('0x24')](saveUpdates(_0x1d7dfe[_0x6c44('0x46')],null))[_0x6c44('0x24')](respondWithResult(_0x139316,null))[_0x6c44('0x3f')](handleError(_0x139316,null));};exports[_0x6c44('0x47')]=function(_0x5972ff,_0x10efcf){return db[_0x6c44('0x29')][_0x6c44('0x44')]({'where':{'id':_0x5972ff[_0x6c44('0x41')]['id']}})[_0x6c44('0x24')](handleEntityNotFound(_0x10efcf,null))['then'](removeEntity(_0x10efcf,null))[_0x6c44('0x3f')](handleError(_0x10efcf,null));};exports[_0x6c44('0x48')]=function(_0x24857e,_0x77bf90,_0x296a25){var _0x5a35a2={};var _0x592343={};var _0x1c90d9;var _0x41156a;return db[_0x6c44('0x29')][_0x6c44('0x49')]({'where':{'id':_0x24857e[_0x6c44('0x41')]['id']}})['then'](handleEntityNotFound(_0x77bf90,null))[_0x6c44('0x24')](function(_0x29db1d){if(_0x29db1d){_0x1c90d9=_0x29db1d;_0x592343[_0x6c44('0x2e')]=_[_0x6c44('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x592343[_0x6c44('0x30')]=_['keys'](_0x24857e[_0x6c44('0x30')]);_0x592343[_0x6c44('0x31')]=_[_0x6c44('0x32')](_0x592343[_0x6c44('0x2e')],_0x592343[_0x6c44('0x30')]);_0x5a35a2[_0x6c44('0x34')]=_[_0x6c44('0x32')](_0x592343['model'],qs[_0x6c44('0x33')](_0x24857e[_0x6c44('0x30')][_0x6c44('0x33')]));_0x5a35a2['attributes']=_0x5a35a2[_0x6c44('0x34')][_0x6c44('0x4a')]?_0x5a35a2[_0x6c44('0x34')]:_0x592343['model'];_0x5a35a2[_0x6c44('0x36')]=qs[_0x6c44('0x37')](_0x24857e[_0x6c44('0x30')][_0x6c44('0x37')]);_0x5a35a2[_0x6c44('0x38')]=qs[_0x6c44('0x31')](_[_0x6c44('0x39')](_0x24857e[_0x6c44('0x30')],_0x592343[_0x6c44('0x31')]));if(_0x24857e[_0x6c44('0x30')][_0x6c44('0x3a')]){_0x5a35a2['where']=_['merge'](_0x5a35a2['where'],{'$or':_['map'](_0x5a35a2['attributes'],function(_0x5990d6){var _0x70a2c9={};_0x70a2c9[_0x5990d6]={'$like':'%'+_0x24857e['query'][_0x6c44('0x3a')]+'%'};return _0x70a2c9;})});}_0x5a35a2=_[_0x6c44('0x3b')]({},_0x5a35a2,_0x24857e[_0x6c44('0x3d')]);return _0x1c90d9[_0x6c44('0x48')](_0x5a35a2);}})[_0x6c44('0x24')](function(_0x108552){if(_0x108552){_0x41156a=_0x108552[_0x6c44('0x4a')];if(!_0x24857e[_0x6c44('0x30')]['hasOwnProperty'](_0x6c44('0x35'))){_0x5a35a2[_0x6c44('0x1c')]=qs[_0x6c44('0x1c')](_0x24857e[_0x6c44('0x30')][_0x6c44('0x1c')]);_0x5a35a2[_0x6c44('0x1b')]=qs[_0x6c44('0x1b')](_0x24857e['query'][_0x6c44('0x1b')]);}return _0x1c90d9[_0x6c44('0x48')](_0x5a35a2);}})[_0x6c44('0x24')](function(_0x339219){if(_0x339219){return _0x339219?{'count':_0x41156a,'rows':_0x339219}:null;}})[_0x6c44('0x24')](respondWithResult(_0x77bf90,null))['catch'](handleError(_0x77bf90,null));};exports[_0x6c44('0x4b')]=function(_0x55a095,_0x3f133d,_0x3b638c){var _0x3f018a={};var _0x23a8cb={};var _0x2a2357;var _0x5d6f93;return db[_0x6c44('0x29')][_0x6c44('0x49')]({'where':{'id':_0x55a095[_0x6c44('0x41')]['id']}})[_0x6c44('0x24')](handleEntityNotFound(_0x3f133d,null))[_0x6c44('0x24')](function(_0x29a0f7){if(_0x29a0f7){_0x2a2357=_0x29a0f7;_0x23a8cb[_0x6c44('0x2e')]=_['keys'](db['Dynamics365Field'][_0x6c44('0x2a')]);_0x23a8cb[_0x6c44('0x30')]=_[_0x6c44('0x2f')](_0x55a095['query']);_0x23a8cb[_0x6c44('0x31')]=_[_0x6c44('0x32')](_0x23a8cb[_0x6c44('0x2e')],_0x23a8cb[_0x6c44('0x30')]);_0x3f018a['attributes']=_['intersection'](_0x23a8cb[_0x6c44('0x2e')],qs['fields'](_0x55a095[_0x6c44('0x30')][_0x6c44('0x33')]));_0x3f018a[_0x6c44('0x34')]=_0x3f018a[_0x6c44('0x34')][_0x6c44('0x4a')]?_0x3f018a[_0x6c44('0x34')]:_0x23a8cb[_0x6c44('0x2e')];_0x3f018a[_0x6c44('0x36')]=qs[_0x6c44('0x37')](_0x55a095[_0x6c44('0x30')][_0x6c44('0x37')]);_0x3f018a[_0x6c44('0x38')]=qs['filters'](_[_0x6c44('0x39')](_0x55a095[_0x6c44('0x30')],_0x23a8cb[_0x6c44('0x31')]));if(_0x55a095['query']['filter']){_0x3f018a['where']=_[_0x6c44('0x3b')](_0x3f018a['where'],{'$or':_[_0x6c44('0x28')](_0x3f018a[_0x6c44('0x34')],function(_0x456317){var _0x3109d1={};_0x3109d1[_0x456317]={'$like':'%'+_0x55a095[_0x6c44('0x30')][_0x6c44('0x3a')]+'%'};return _0x3109d1;})});}_0x3f018a=_['merge']({},_0x3f018a,_0x55a095['options']);return _0x2a2357['getSubjects'](_0x3f018a);}})[_0x6c44('0x24')](function(_0x5ef40f){if(_0x5ef40f){_0x5d6f93=_0x5ef40f[_0x6c44('0x4a')];if(!_0x55a095[_0x6c44('0x30')][_0x6c44('0x4c')](_0x6c44('0x35'))){_0x3f018a[_0x6c44('0x1c')]=qs[_0x6c44('0x1c')](_0x55a095[_0x6c44('0x30')][_0x6c44('0x1c')]);_0x3f018a[_0x6c44('0x1b')]=qs[_0x6c44('0x1b')](_0x55a095[_0x6c44('0x30')][_0x6c44('0x1b')]);}return _0x2a2357[_0x6c44('0x4b')](_0x3f018a);}})[_0x6c44('0x24')](function(_0x36f2f7){if(_0x36f2f7){return _0x36f2f7?{'count':_0x5d6f93,'rows':_0x36f2f7}:null;}})['then'](respondWithResult(_0x3f133d,null))[_0x6c44('0x3f')](handleError(_0x3f133d,null));};exports[_0x6c44('0x4d')]=function(_0x411b2a,_0x5067e6,_0x6330eb){var _0x1a1277={};var _0x5cc77e={};var _0x371360;var _0x4509ac;return db[_0x6c44('0x29')][_0x6c44('0x49')]({'where':{'id':_0x411b2a[_0x6c44('0x41')]['id']}})[_0x6c44('0x24')](handleEntityNotFound(_0x5067e6,null))['then'](function(_0x3a5cc3){if(_0x3a5cc3){_0x371360=_0x3a5cc3;_0x5cc77e[_0x6c44('0x2e')]=_['keys'](db[_0x6c44('0x4e')]['rawAttributes']);_0x5cc77e[_0x6c44('0x30')]=_[_0x6c44('0x2f')](_0x411b2a['query']);_0x5cc77e[_0x6c44('0x31')]=_[_0x6c44('0x32')](_0x5cc77e[_0x6c44('0x2e')],_0x5cc77e[_0x6c44('0x30')]);_0x1a1277[_0x6c44('0x34')]=_[_0x6c44('0x32')](_0x5cc77e[_0x6c44('0x2e')],qs['fields'](_0x411b2a[_0x6c44('0x30')][_0x6c44('0x33')]));_0x1a1277[_0x6c44('0x34')]=_0x1a1277[_0x6c44('0x34')][_0x6c44('0x4a')]?_0x1a1277[_0x6c44('0x34')]:_0x5cc77e[_0x6c44('0x2e')];_0x1a1277['order']=qs[_0x6c44('0x37')](_0x411b2a[_0x6c44('0x30')][_0x6c44('0x37')]);_0x1a1277[_0x6c44('0x38')]=qs[_0x6c44('0x31')](_[_0x6c44('0x39')](_0x411b2a['query'],_0x5cc77e[_0x6c44('0x31')]));if(_0x411b2a[_0x6c44('0x30')][_0x6c44('0x3a')]){_0x1a1277[_0x6c44('0x38')]=_['merge'](_0x1a1277[_0x6c44('0x38')],{'$or':_[_0x6c44('0x28')](_0x1a1277[_0x6c44('0x34')],function(_0x5ca517){var _0x1e8ecf={};_0x1e8ecf[_0x5ca517]={'$like':'%'+_0x411b2a[_0x6c44('0x30')][_0x6c44('0x3a')]+'%'};return _0x1e8ecf;})});}_0x1a1277=_['merge']({},_0x1a1277,_0x411b2a['options']);return _0x371360[_0x6c44('0x4d')](_0x1a1277);}})[_0x6c44('0x24')](function(_0x2c3b82){if(_0x2c3b82){_0x4509ac=_0x2c3b82['length'];if(!_0x411b2a['query'][_0x6c44('0x4c')](_0x6c44('0x35'))){_0x1a1277[_0x6c44('0x1c')]=qs[_0x6c44('0x1c')](_0x411b2a[_0x6c44('0x30')][_0x6c44('0x1c')]);_0x1a1277[_0x6c44('0x1b')]=qs[_0x6c44('0x1b')](_0x411b2a[_0x6c44('0x30')][_0x6c44('0x1b')]);}return _0x371360[_0x6c44('0x4d')](_0x1a1277);}})[_0x6c44('0x24')](function(_0x43d535){if(_0x43d535){return _0x43d535?{'count':_0x4509ac,'rows':_0x43d535}:null;}})[_0x6c44('0x24')](respondWithResult(_0x5067e6,null))[_0x6c44('0x3f')](handleError(_0x5067e6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fd78ef6..4e6ea45 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e9a2b,_0x7ec646){var _0xf3697d=function(_0x442769){while(--_0x442769){_0x1e9a2b['push'](_0x1e9a2b['shift']());}};_0xf3697d(++_0x7ec646);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0xb4e6[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x2f1353,_0x580811){var _0x34f492=function(_0x4c85a1){while(--_0x4c85a1){_0x2f1353['push'](_0x2f1353['shift']());}};_0x34f492(++_0x580811);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5ee943,_0x4f8617){_0x5ee943=_0x5ee943-0x0;var _0x5ce0e2=_0x8d0e[_0x5ee943];return _0x5ce0e2;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 77ab930..835b41c 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 _0x4728=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f349f,_0x50dca8){var _0xe6e53=function(_0x3d94f1){while(--_0x3d94f1){_0x1f349f['push'](_0x1f349f['shift']());}};_0xe6e53(++_0x50dca8);}(_0x4728,0xd1));var _0x8472=function(_0x3a5dd1,_0x5ed411){_0x3a5dd1=_0x3a5dd1-0x0;var _0x40878b=_0x4728[_0x3a5dd1];return _0x40878b;};'use strict';var _=require(_0x8472('0x0'));var util=require('util');var moment=require(_0x8472('0x1'));var BPromise=require(_0x8472('0x2'));var rs=require(_0x8472('0x3'));var fs=require('fs');var Redis=require(_0x8472('0x4'));var db=require(_0x8472('0x5'))['db'];var utils=require(_0x8472('0x6'));var logger=require(_0x8472('0x7'))(_0x8472('0x8'));var config=require('../../config/environment');var jayson=require(_0x8472('0x9'));var client=jayson['client'][_0x8472('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f65e,_0x485c95,_0xb9a77d){return new BPromise(function(_0x27710f,_0x32f2e8){return client[_0x8472('0xb')](_0x27f65e,_0xb9a77d)[_0x8472('0xc')](function(_0x40f214){logger[_0x8472('0xd')](_0x8472('0xe'),_0x485c95,_0x8472('0xf'));logger[_0x8472('0x10')](_0x8472('0x11'),_0x485c95,_0x8472('0xf'),JSON[_0x8472('0x12')](_0x40f214));if(_0x40f214['error']){if(_0x40f214[_0x8472('0x13')][_0x8472('0x14')]===0x1f4){logger[_0x8472('0x13')](_0x8472('0xe'),_0x485c95,_0x40f214[_0x8472('0x13')][_0x8472('0x15')]);return _0x32f2e8(_0x40f214['error']['message']);}logger['error'](_0x8472('0xe'),_0x485c95,_0x40f214[_0x8472('0x13')]['message']);return _0x27710f(_0x40f214[_0x8472('0x13')][_0x8472('0x15')]);}else{logger[_0x8472('0xd')](_0x8472('0xe'),_0x485c95,_0x8472('0xf'));_0x27710f(_0x40f214[_0x8472('0x16')][_0x8472('0x15')]);}})['catch'](function(_0x4daba0){logger[_0x8472('0x13')](_0x8472('0xe'),_0x485c95,_0x4daba0);_0x32f2e8(_0x4daba0);});});} \ No newline at end of file +var _0x8dde=['debug','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x7ad31c,_0xcc2fd9){var _0x114799=function(_0x5517bd){while(--_0x5517bd){_0x7ad31c['push'](_0x7ad31c['shift']());}};_0x114799(++_0xcc2fd9);}(_0x8dde,0x1be));var _0xe8dd=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x8dde[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0xe8dd('0x0'));var util=require(_0xe8dd('0x1'));var moment=require('moment');var BPromise=require(_0xe8dd('0x2'));var rs=require(_0xe8dd('0x3'));var fs=require('fs');var Redis=require(_0xe8dd('0x4'));var db=require(_0xe8dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8dd('0x6'))(_0xe8dd('0x7'));var config=require(_0xe8dd('0x8'));var jayson=require(_0xe8dd('0x9'));var client=jayson[_0xe8dd('0xa')][_0xe8dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x168f49,_0x244fff,_0x152836){return new BPromise(function(_0x599ee3,_0x21afd9){return client[_0xe8dd('0xc')](_0x168f49,_0x152836)['then'](function(_0x3bd186){logger[_0xe8dd('0xd')](_0xe8dd('0xe'),_0x244fff,_0xe8dd('0xf'));logger[_0xe8dd('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x244fff,_0xe8dd('0xf'),JSON[_0xe8dd('0x11')](_0x3bd186));if(_0x3bd186['error']){if(_0x3bd186['error'][_0xe8dd('0x12')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x244fff,_0x3bd186[_0xe8dd('0x13')]['message']);return _0x21afd9(_0x3bd186[_0xe8dd('0x13')]['message']);}logger[_0xe8dd('0x13')](_0xe8dd('0xe'),_0x244fff,_0x3bd186[_0xe8dd('0x13')][_0xe8dd('0x14')]);return _0x599ee3(_0x3bd186[_0xe8dd('0x13')][_0xe8dd('0x14')]);}else{logger[_0xe8dd('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x244fff,_0xe8dd('0xf'));_0x599ee3(_0x3bd186['result'][_0xe8dd('0x14')]);}})[_0xe8dd('0x15')](function(_0x200e7a){logger[_0xe8dd('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x244fff,_0x200e7a);_0x21afd9(_0x200e7a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 1d2509f..9f7a6c1 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 _0x2448=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','post','put','/:id','destroy','exports','multer'];(function(_0x194867,_0x3a36a8){var _0x222dac=function(_0x417f20){while(--_0x417f20){_0x194867['push'](_0x194867['shift']());}};_0x222dac(++_0x3a36a8);}(_0x2448,0x11c));var _0x8244=function(_0x40bb55,_0x507f65){_0x40bb55=_0x40bb55-0x0;var _0x28d0e6=_0x2448[_0x40bb55];return _0x28d0e6;};'use strict';var multer=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var path=require(_0x8244('0x2'));var timeout=require(_0x8244('0x3'));var express=require(_0x8244('0x4'));var router=express[_0x8244('0x5')]();var fs_extra=require(_0x8244('0x6'));var auth=require(_0x8244('0x7'));var interaction=require(_0x8244('0x8'));var config=require(_0x8244('0x9'));var controller=require(_0x8244('0xa'));router[_0x8244('0xb')]('/',auth[_0x8244('0xc')](),controller[_0x8244('0xd')]);router[_0x8244('0xb')]('/:id',auth[_0x8244('0xc')](),controller['show']);router[_0x8244('0xe')]('/',auth[_0x8244('0xc')](),controller['create']);router[_0x8244('0xf')](_0x8244('0x10'),auth[_0x8244('0xc')](),controller['update']);router['delete'](_0x8244('0x10'),auth['isAuthenticated'](),controller[_0x8244('0x11')]);module[_0x8244('0x12')]=router; \ No newline at end of file +var _0x44e7=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','create','put'];(function(_0x26ec5d,_0x5aff47){var _0x58f5f1=function(_0x26f8b9){while(--_0x26f8b9){_0x26ec5d['push'](_0x26ec5d['shift']());}};_0x58f5f1(++_0x5aff47);}(_0x44e7,0x1b4));var _0x744e=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x44e7[_0x121886];return _0x20ca01;};'use strict';var multer=require(_0x744e('0x0'));var util=require(_0x744e('0x1'));var path=require(_0x744e('0x2'));var timeout=require(_0x744e('0x3'));var express=require('express');var router=express[_0x744e('0x4')]();var fs_extra=require(_0x744e('0x5'));var auth=require(_0x744e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x744e('0x7'));router[_0x744e('0x8')]('/',auth[_0x744e('0x9')](),controller['index']);router[_0x744e('0x8')](_0x744e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x744e('0xb')]('/',auth['isAuthenticated'](),controller[_0x744e('0xc')]);router[_0x744e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x744e('0xe')]);router[_0x744e('0xf')]('/:id',auth[_0x744e('0x9')](),controller[_0x744e('0x10')]);module[_0x744e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 4467e9a..01a74b9 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 _0x8f89=['keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM','variable'];(function(_0x2fa03c,_0x474599){var _0x4ee622=function(_0x34e31d){while(--_0x34e31d){_0x2fa03c['push'](_0x2fa03c['shift']());}};_0x4ee622(++_0x474599);}(_0x8f89,0x171));var _0x98f8=function(_0x499541,_0x49a73e){_0x499541=_0x499541-0x0;var _0x563c05=_0x8f89[_0x499541];return _0x563c05;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x98f8('0x0')]('string',_0x98f8('0x1'),'customVariable',_0x98f8('0x2'),_0x98f8('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x98f8('0x4')]},'key':{'type':Sequelize[_0x98f8('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x98f8('0x1'),_0x98f8('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x98f8('0x4')]},'nameField':{'type':Sequelize[_0x98f8('0x4')]},'customField':{'type':Sequelize[_0x98f8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe978=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x409ff8,_0x113593){var _0x9a56e1=function(_0x132761){while(--_0x132761){_0x409ff8['push'](_0x409ff8['shift']());}};_0x9a56e1(++_0x113593);}(_0xe978,0x68));var _0x8e97=function(_0x35c47d,_0x21a7a2){_0x35c47d=_0x35c47d-0x0;var _0x42c4e6=_0xe978[_0x35c47d];return _0x42c4e6;};'use strict';var Sequelize=require(_0x8e97('0x0'));module['exports']={'type':{'type':Sequelize[_0x8e97('0x1')](_0x8e97('0x2'),_0x8e97('0x3'),_0x8e97('0x4'),_0x8e97('0x5'),'picklist'),'defaultValue':_0x8e97('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e97('0x6')]},'keyType':{'type':Sequelize[_0x8e97('0x1')](_0x8e97('0x2'),_0x8e97('0x3'),_0x8e97('0x4'))},'keyContent':{'type':Sequelize[_0x8e97('0x6')]},'idField':{'type':Sequelize[_0x8e97('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8e97('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8e97('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e62fa1d..6a9c49f 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 _0xf714=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','create','body','find','destroy','params','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf714,0x1f4));var _0x4f71=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0xf714[_0x2980de];return _0x81a4ca;};'use strict';var emlformat=require(_0x4f71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f71('0x1'));var rp=require(_0x4f71('0x2'));var moment=require('moment');var BPromise=require(_0x4f71('0x3'));var Mustache=require('mustache');var util=require(_0x4f71('0x4'));var path=require(_0x4f71('0x5'));var sox=require(_0x4f71('0x6'));var csv=require(_0x4f71('0x7'));var ejs=require(_0x4f71('0x8'));var fs=require('fs');var fs_extra=require(_0x4f71('0x9'));var _=require(_0x4f71('0xa'));var squel=require(_0x4f71('0xb'));var crypto=require(_0x4f71('0xc'));var jsforce=require(_0x4f71('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f71('0x7'));var querystring=require(_0x4f71('0xe'));var Papa=require(_0x4f71('0xf'));var Redis=require(_0x4f71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f71('0x11'));var as=require(_0x4f71('0x12'));var hardwareService=require(_0x4f71('0x13'));var logger=require(_0x4f71('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4f71('0x15'));var licenseUtil=require(_0x4f71('0x16'));var db=require(_0x4f71('0x17'))['db'];function respondWithStatusCode(_0x3cd596,_0x367cc2){_0x367cc2=_0x367cc2||0xcc;return function(_0x360a39){if(_0x360a39){return _0x3cd596['sendStatus'](_0x367cc2);}return _0x3cd596[_0x4f71('0x18')](_0x367cc2)['end']();};}function respondWithResult(_0x3693ba,_0xf2d765){_0xf2d765=_0xf2d765||0xc8;return function(_0x3f4e5f){if(_0x3f4e5f){return _0x3693ba[_0x4f71('0x18')](_0xf2d765)[_0x4f71('0x19')](_0x3f4e5f);}};}function respondWithFilteredResult(_0x5009cc,_0x45042e){return function(_0x1f621b){if(_0x1f621b){var _0x4a492b=typeof _0x45042e[_0x4f71('0x1a')]==='undefined'&&typeof _0x45042e[_0x4f71('0x1b')]===_0x4f71('0x1c');var _0x26b3ed=_0x1f621b[_0x4f71('0x1d')];var _0x56fab2=_0x4a492b?0x0:_0x45042e['offset'];var _0x2b4771=_0x4a492b?_0x1f621b[_0x4f71('0x1d')]:_0x45042e['offset']+_0x45042e[_0x4f71('0x1b')];var _0x248e1e;if(_0x2b4771>=_0x26b3ed){_0x2b4771=_0x26b3ed;_0x248e1e=0xc8;}else{_0x248e1e=0xce;}_0x5009cc['status'](_0x248e1e);return _0x5009cc[_0x4f71('0x1e')](_0x4f71('0x1f'),_0x56fab2+'-'+_0x2b4771+'/'+_0x26b3ed)[_0x4f71('0x19')](_0x1f621b);}return null;};}function patchUpdates(_0x105651){return function(_0x40682a){try{jsonpatch[_0x4f71('0x20')](_0x40682a,_0x105651,!![]);}catch(_0xe04367){return BPromise[_0x4f71('0x21')](_0xe04367);}return _0x40682a[_0x4f71('0x22')]();};}function saveUpdates(_0x1f09b2,_0x9b80aa){return function(_0x2504c9){if(_0x2504c9){return _0x2504c9[_0x4f71('0x23')](_0x1f09b2)['then'](function(_0xa66849){return _0xa66849;});}return null;};}function removeEntity(_0x43d37f,_0x2af998){return function(_0x4a571a){if(_0x4a571a){return _0x4a571a['destroy']()[_0x4f71('0x24')](function(){_0x43d37f[_0x4f71('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dac9,_0x4bad8e){return function(_0x4eb956){if(!_0x4eb956){_0x25dac9['sendStatus'](0x194);}return _0x4eb956;};}function handleError(_0x3511be,_0xb9681e){_0xb9681e=_0xb9681e||0x1f4;return function(_0x5a85da){logger[_0x4f71('0x25')](_0x5a85da[_0x4f71('0x26')]);if(_0x5a85da[_0x4f71('0x27')]){delete _0x5a85da['name'];}_0x3511be[_0x4f71('0x18')](_0xb9681e)[_0x4f71('0x28')](_0x5a85da);};}exports[_0x4f71('0x29')]=function(_0x58a883,_0x34b14a){var _0x24de30={},_0x43d9a2={},_0x1bb612={'count':0x0,'rows':[]};var _0x1ea68b=_[_0x4f71('0x2a')](db[_0x4f71('0x2b')][_0x4f71('0x2c')],function(_0x5ae9d4){return{'name':_0x5ae9d4[_0x4f71('0x2d')],'type':_0x5ae9d4['type'][_0x4f71('0x2e')]};});_0x43d9a2[_0x4f71('0x2f')]=_['map'](_0x1ea68b,_0x4f71('0x27'));_0x43d9a2[_0x4f71('0x30')]=_[_0x4f71('0x31')](_0x58a883[_0x4f71('0x30')]);_0x43d9a2[_0x4f71('0x32')]=_['intersection'](_0x43d9a2[_0x4f71('0x2f')],_0x43d9a2[_0x4f71('0x30')]);_0x24de30[_0x4f71('0x33')]=_[_0x4f71('0x34')](_0x43d9a2[_0x4f71('0x2f')],qs[_0x4f71('0x35')](_0x58a883[_0x4f71('0x30')][_0x4f71('0x35')]));_0x24de30[_0x4f71('0x33')]=_0x24de30[_0x4f71('0x33')][_0x4f71('0x36')]?_0x24de30['attributes']:_0x43d9a2[_0x4f71('0x2f')];if(!_0x58a883['query'][_0x4f71('0x37')]('nolimit')){_0x24de30[_0x4f71('0x1b')]=qs['limit'](_0x58a883[_0x4f71('0x30')]['limit']);_0x24de30['offset']=qs[_0x4f71('0x1a')](_0x58a883['query'][_0x4f71('0x1a')]);}_0x24de30[_0x4f71('0x38')]=qs['sort'](_0x58a883[_0x4f71('0x30')]['sort']);_0x24de30[_0x4f71('0x39')]=qs[_0x4f71('0x32')](_[_0x4f71('0x3a')](_0x58a883[_0x4f71('0x30')],_0x43d9a2['filters']),_0x1ea68b);if(_0x58a883['query'][_0x4f71('0x3b')]){_0x24de30[_0x4f71('0x39')]=_[_0x4f71('0x3c')](_0x24de30[_0x4f71('0x39')],{'$or':_['map'](_0x1ea68b,function(_0x2f2796){if(_0x2f2796['type']!==_0x4f71('0x3d')){var _0x5ae5f9={};_0x5ae5f9[_0x2f2796[_0x4f71('0x27')]]={'$like':'%'+_0x58a883[_0x4f71('0x30')][_0x4f71('0x3b')]+'%'};return _0x5ae5f9;}})});}_0x24de30=_[_0x4f71('0x3c')]({},_0x24de30,_0x58a883['options']);var _0x18975b={'where':_0x24de30[_0x4f71('0x39')]};return db[_0x4f71('0x2b')][_0x4f71('0x1d')](_0x18975b)[_0x4f71('0x24')](function(_0x3789eb){_0x1bb612[_0x4f71('0x1d')]=_0x3789eb;if(_0x58a883[_0x4f71('0x30')][_0x4f71('0x3e')]){_0x24de30['include']=[{'all':!![]}];}return db[_0x4f71('0x2b')][_0x4f71('0x3f')](_0x24de30);})[_0x4f71('0x24')](function(_0x319a1e){_0x1bb612[_0x4f71('0x40')]=_0x319a1e;return _0x1bb612;})[_0x4f71('0x24')](respondWithFilteredResult(_0x34b14a,_0x24de30))[_0x4f71('0x41')](handleError(_0x34b14a,null));};exports[_0x4f71('0x42')]=function(_0x1edb5c,_0x418b09){var _0x2a3eb2={'raw':!![],'where':{'id':_0x1edb5c['params']['id']}},_0x1c95ae={};_0x1c95ae['model']=_[_0x4f71('0x31')](db[_0x4f71('0x2b')][_0x4f71('0x2c')]);_0x1c95ae[_0x4f71('0x30')]=_['keys'](_0x1edb5c[_0x4f71('0x30')]);_0x1c95ae['filters']=_[_0x4f71('0x34')](_0x1c95ae[_0x4f71('0x2f')],_0x1c95ae[_0x4f71('0x30')]);_0x2a3eb2[_0x4f71('0x33')]=_[_0x4f71('0x34')](_0x1c95ae[_0x4f71('0x2f')],qs[_0x4f71('0x35')](_0x1edb5c[_0x4f71('0x30')][_0x4f71('0x35')]));_0x2a3eb2[_0x4f71('0x33')]=_0x2a3eb2[_0x4f71('0x33')][_0x4f71('0x36')]?_0x2a3eb2[_0x4f71('0x33')]:_0x1c95ae[_0x4f71('0x2f')];if(_0x1edb5c[_0x4f71('0x30')][_0x4f71('0x3e')]){_0x2a3eb2[_0x4f71('0x43')]=[{'all':!![]}];}_0x2a3eb2=_[_0x4f71('0x3c')]({},_0x2a3eb2,_0x1edb5c[_0x4f71('0x44')]);return db[_0x4f71('0x2b')]['find'](_0x2a3eb2)[_0x4f71('0x24')](handleEntityNotFound(_0x418b09,null))[_0x4f71('0x24')](respondWithResult(_0x418b09,null))[_0x4f71('0x41')](handleError(_0x418b09,null));};exports['create']=function(_0x167570,_0x4e3760){return db[_0x4f71('0x2b')][_0x4f71('0x45')](_0x167570[_0x4f71('0x46')],{})[_0x4f71('0x24')](respondWithResult(_0x4e3760,0xc9))[_0x4f71('0x41')](handleError(_0x4e3760,null));};exports['update']=function(_0x49a2ee,_0x22f800){if(_0x49a2ee[_0x4f71('0x46')]['id']){delete _0x49a2ee[_0x4f71('0x46')]['id'];}return db[_0x4f71('0x2b')][_0x4f71('0x47')]({'where':{'id':_0x49a2ee['params']['id']}})[_0x4f71('0x24')](handleEntityNotFound(_0x22f800,null))[_0x4f71('0x24')](saveUpdates(_0x49a2ee['body'],null))[_0x4f71('0x24')](respondWithResult(_0x22f800,null))[_0x4f71('0x41')](handleError(_0x22f800,null));};exports[_0x4f71('0x48')]=function(_0x121b79,_0x2efdae){return db['Dynamics365Field'][_0x4f71('0x47')]({'where':{'id':_0x121b79[_0x4f71('0x49')]['id']}})[_0x4f71('0x24')](handleEntityNotFound(_0x2efdae,null))[_0x4f71('0x24')](removeEntity(_0x2efdae,null))[_0x4f71('0x41')](handleError(_0x2efdae,null));}; \ No newline at end of file +var _0xe107=['map','query','keys','filters','intersection','fields','attributes','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','params','Dynamics365Field','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe107,0x9c));var _0x7e10=function(_0x2a642b,_0x3b57f5){_0x2a642b=_0x2a642b-0x0;var _0x37fa4a=_0xe107[_0x2a642b];return _0x37fa4a;};'use strict';var emlformat=require(_0x7e10('0x0'));var rimraf=require(_0x7e10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e10('0x2'));var rp=require(_0x7e10('0x3'));var moment=require(_0x7e10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e10('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7e10('0x6'));var csv=require(_0x7e10('0x7'));var ejs=require(_0x7e10('0x8'));var fs=require('fs');var fs_extra=require(_0x7e10('0x9'));var _=require(_0x7e10('0xa'));var squel=require(_0x7e10('0xb'));var crypto=require(_0x7e10('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7e10('0xd'));var toCsv=require(_0x7e10('0x7'));var querystring=require(_0x7e10('0xe'));var Papa=require(_0x7e10('0xf'));var Redis=require(_0x7e10('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e10('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e10('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e10('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46f889,_0x20b7d4){_0x20b7d4=_0x20b7d4||0xcc;return function(_0x33ff80){if(_0x33ff80){return _0x46f889[_0x7e10('0x14')](_0x20b7d4);}return _0x46f889['status'](_0x20b7d4)[_0x7e10('0x15')]();};}function respondWithResult(_0x5d7245,_0x40a4d7){_0x40a4d7=_0x40a4d7||0xc8;return function(_0x4ee420){if(_0x4ee420){return _0x5d7245[_0x7e10('0x16')](_0x40a4d7)['json'](_0x4ee420);}};}function respondWithFilteredResult(_0x377605,_0x45b9e2){return function(_0x37921d){if(_0x37921d){var _0x4d51fd=typeof _0x45b9e2['offset']===_0x7e10('0x17')&&typeof _0x45b9e2['limit']===_0x7e10('0x17');var _0x18849d=_0x37921d['count'];var _0xe87e1d=_0x4d51fd?0x0:_0x45b9e2[_0x7e10('0x18')];var _0x46b988=_0x4d51fd?_0x37921d[_0x7e10('0x19')]:_0x45b9e2['offset']+_0x45b9e2[_0x7e10('0x1a')];var _0x2a4434;if(_0x46b988>=_0x18849d){_0x46b988=_0x18849d;_0x2a4434=0xc8;}else{_0x2a4434=0xce;}_0x377605[_0x7e10('0x16')](_0x2a4434);return _0x377605[_0x7e10('0x1b')](_0x7e10('0x1c'),_0xe87e1d+'-'+_0x46b988+'/'+_0x18849d)['json'](_0x37921d);}return null;};}function patchUpdates(_0x1ba692){return function(_0x2978b3){try{jsonpatch[_0x7e10('0x1d')](_0x2978b3,_0x1ba692,!![]);}catch(_0x53b4e3){return BPromise[_0x7e10('0x1e')](_0x53b4e3);}return _0x2978b3['save']();};}function saveUpdates(_0x25ae94,_0x46f303){return function(_0x5e37c0){if(_0x5e37c0){return _0x5e37c0['update'](_0x25ae94)[_0x7e10('0x1f')](function(_0x2f3d06){return _0x2f3d06;});}return null;};}function removeEntity(_0x36a273,_0x2182ed){return function(_0x434c3c){if(_0x434c3c){return _0x434c3c[_0x7e10('0x20')]()[_0x7e10('0x1f')](function(){_0x36a273[_0x7e10('0x16')](0xcc)[_0x7e10('0x15')]();});}};}function handleEntityNotFound(_0x3eb549,_0x1da29e){return function(_0x292a4c){if(!_0x292a4c){_0x3eb549[_0x7e10('0x14')](0x194);}return _0x292a4c;};}function handleError(_0x4c4b17,_0x22b354){_0x22b354=_0x22b354||0x1f4;return function(_0x540e1b){logger[_0x7e10('0x21')](_0x540e1b['stack']);if(_0x540e1b[_0x7e10('0x22')]){delete _0x540e1b[_0x7e10('0x22')];}_0x4c4b17[_0x7e10('0x16')](_0x22b354)[_0x7e10('0x23')](_0x540e1b);};}exports[_0x7e10('0x24')]=function(_0x30f2c4,_0x552a8d){var _0x22aeaa={},_0x498a5d={},_0x2105ee={'count':0x0,'rows':[]};var _0x3423c2=_['map'](db['Dynamics365Field'][_0x7e10('0x25')],function(_0x2042b8){return{'name':_0x2042b8[_0x7e10('0x26')],'type':_0x2042b8[_0x7e10('0x27')][_0x7e10('0x28')]};});_0x498a5d[_0x7e10('0x29')]=_[_0x7e10('0x2a')](_0x3423c2,'name');_0x498a5d[_0x7e10('0x2b')]=_[_0x7e10('0x2c')](_0x30f2c4[_0x7e10('0x2b')]);_0x498a5d[_0x7e10('0x2d')]=_[_0x7e10('0x2e')](_0x498a5d[_0x7e10('0x29')],_0x498a5d[_0x7e10('0x2b')]);_0x22aeaa['attributes']=_[_0x7e10('0x2e')](_0x498a5d['model'],qs[_0x7e10('0x2f')](_0x30f2c4[_0x7e10('0x2b')]['fields']));_0x22aeaa['attributes']=_0x22aeaa['attributes']['length']?_0x22aeaa[_0x7e10('0x30')]:_0x498a5d[_0x7e10('0x29')];if(!_0x30f2c4[_0x7e10('0x2b')]['hasOwnProperty']('nolimit')){_0x22aeaa[_0x7e10('0x1a')]=qs['limit'](_0x30f2c4[_0x7e10('0x2b')][_0x7e10('0x1a')]);_0x22aeaa[_0x7e10('0x18')]=qs['offset'](_0x30f2c4[_0x7e10('0x2b')][_0x7e10('0x18')]);}_0x22aeaa[_0x7e10('0x31')]=qs[_0x7e10('0x32')](_0x30f2c4[_0x7e10('0x2b')][_0x7e10('0x32')]);_0x22aeaa['where']=qs[_0x7e10('0x2d')](_['pick'](_0x30f2c4[_0x7e10('0x2b')],_0x498a5d[_0x7e10('0x2d')]),_0x3423c2);if(_0x30f2c4[_0x7e10('0x2b')]['filter']){_0x22aeaa[_0x7e10('0x33')]=_[_0x7e10('0x34')](_0x22aeaa[_0x7e10('0x33')],{'$or':_[_0x7e10('0x2a')](_0x3423c2,function(_0x1c49e9){if(_0x1c49e9[_0x7e10('0x27')]!=='VIRTUAL'){var _0x457d3a={};_0x457d3a[_0x1c49e9[_0x7e10('0x22')]]={'$like':'%'+_0x30f2c4[_0x7e10('0x2b')][_0x7e10('0x35')]+'%'};return _0x457d3a;}})});}_0x22aeaa=_[_0x7e10('0x34')]({},_0x22aeaa,_0x30f2c4[_0x7e10('0x36')]);var _0x436a70={'where':_0x22aeaa[_0x7e10('0x33')]};return db['Dynamics365Field'][_0x7e10('0x19')](_0x436a70)[_0x7e10('0x1f')](function(_0x399c47){_0x2105ee['count']=_0x399c47;if(_0x30f2c4['query'][_0x7e10('0x37')]){_0x22aeaa[_0x7e10('0x38')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7e10('0x39')](_0x22aeaa);})[_0x7e10('0x1f')](function(_0x478830){_0x2105ee['rows']=_0x478830;return _0x2105ee;})['then'](respondWithFilteredResult(_0x552a8d,_0x22aeaa))[_0x7e10('0x3a')](handleError(_0x552a8d,null));};exports['show']=function(_0x2b956c,_0x579bce){var _0x49c49f={'raw':!![],'where':{'id':_0x2b956c[_0x7e10('0x3b')]['id']}},_0x4effe0={};_0x4effe0[_0x7e10('0x29')]=_[_0x7e10('0x2c')](db[_0x7e10('0x3c')][_0x7e10('0x25')]);_0x4effe0[_0x7e10('0x2b')]=_['keys'](_0x2b956c['query']);_0x4effe0[_0x7e10('0x2d')]=_[_0x7e10('0x2e')](_0x4effe0[_0x7e10('0x29')],_0x4effe0[_0x7e10('0x2b')]);_0x49c49f[_0x7e10('0x30')]=_[_0x7e10('0x2e')](_0x4effe0[_0x7e10('0x29')],qs[_0x7e10('0x2f')](_0x2b956c['query'][_0x7e10('0x2f')]));_0x49c49f[_0x7e10('0x30')]=_0x49c49f['attributes'][_0x7e10('0x3d')]?_0x49c49f[_0x7e10('0x30')]:_0x4effe0['model'];if(_0x2b956c[_0x7e10('0x2b')]['includeAll']){_0x49c49f[_0x7e10('0x38')]=[{'all':!![]}];}_0x49c49f=_['merge']({},_0x49c49f,_0x2b956c['options']);return db[_0x7e10('0x3c')][_0x7e10('0x3e')](_0x49c49f)[_0x7e10('0x1f')](handleEntityNotFound(_0x579bce,null))[_0x7e10('0x1f')](respondWithResult(_0x579bce,null))['catch'](handleError(_0x579bce,null));};exports[_0x7e10('0x3f')]=function(_0x5845a0,_0x36f81e){return db[_0x7e10('0x3c')][_0x7e10('0x3f')](_0x5845a0[_0x7e10('0x40')],{})[_0x7e10('0x1f')](respondWithResult(_0x36f81e,0xc9))['catch'](handleError(_0x36f81e,null));};exports[_0x7e10('0x41')]=function(_0x3448e5,_0x29be41){if(_0x3448e5[_0x7e10('0x40')]['id']){delete _0x3448e5[_0x7e10('0x40')]['id'];}return db['Dynamics365Field'][_0x7e10('0x3e')]({'where':{'id':_0x3448e5[_0x7e10('0x3b')]['id']}})[_0x7e10('0x1f')](handleEntityNotFound(_0x29be41,null))[_0x7e10('0x1f')](saveUpdates(_0x3448e5[_0x7e10('0x40')],null))[_0x7e10('0x1f')](respondWithResult(_0x29be41,null))[_0x7e10('0x3a')](handleError(_0x29be41,null));};exports[_0x7e10('0x20')]=function(_0x21c8a8,_0x5cec7a){return db[_0x7e10('0x3c')]['find']({'where':{'id':_0x21c8a8[_0x7e10('0x3b')]['id']}})[_0x7e10('0x1f')](handleEntityNotFound(_0x5cec7a,null))['then'](removeEntity(_0x5cec7a,null))['catch'](handleError(_0x5cec7a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fe3592a..6bd2f95 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 _0x607b=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','../../config/logger','api','bluebird'];(function(_0x113273,_0x24a297){var _0x5d4d87=function(_0x153b17){while(--_0x153b17){_0x113273['push'](_0x113273['shift']());}};_0x5d4d87(++_0x24a297);}(_0x607b,0x1f4));var _0xb607=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x607b[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xb607('0x0'));var util=require('util');var logger=require(_0xb607('0x1'))(_0xb607('0x2'));var moment=require('moment');var BPromise=require(_0xb607('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb607('0x4'));var config=require(_0xb607('0x5'));var attributes=require(_0xb607('0x6'));module[_0xb607('0x7')]=function(_0x42505a,_0x1c104e){return _0x42505a[_0xb607('0x8')](_0xb607('0x9'),attributes,{'tableName':_0xb607('0xa'),'paranoid':![],'indexes':[{'name':_0xb607('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa67f=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x33cfb7,_0x3d968b){var _0x274006=function(_0xb18a9f){while(--_0xb18a9f){_0x33cfb7['push'](_0x33cfb7['shift']());}};_0x274006(++_0x3d968b);}(_0xa67f,0xe9));var _0xfa67=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa67f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfa67('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfa67('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa67('0x2'));var rimraf=require(_0xfa67('0x3'));var config=require(_0xfa67('0x4'));var attributes=require(_0xfa67('0x5'));module[_0xfa67('0x6')]=function(_0xe551d7,_0x221ec1){return _0xe551d7[_0xfa67('0x7')](_0xfa67('0x8'),attributes,{'tableName':_0xfa67('0x9'),'paranoid':![],'indexes':[{'name':_0xfa67('0xa'),'fields':['idField',_0xfa67('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 0b85436..438499a 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 _0xb1aa=['../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x279262,_0xa15cd5){var _0x2e41bb=function(_0x317132){while(--_0x317132){_0x279262['push'](_0x279262['shift']());}};_0x2e41bb(++_0xa15cd5);}(_0xb1aa,0xcc));var _0xab1a=function(_0x5ee236,_0x3ed8e4){_0x5ee236=_0x5ee236-0x0;var _0x1563b6=_0xb1aa[_0x5ee236];return _0x1563b6;};'use strict';var _=require(_0xab1a('0x0'));var util=require('util');var moment=require(_0xab1a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab1a('0x2'))['db'];var utils=require(_0xab1a('0x3'));var logger=require(_0xab1a('0x4'))(_0xab1a('0x5'));var config=require(_0xab1a('0x6'));var jayson=require(_0xab1a('0x7'));var client=jayson[_0xab1a('0x8')][_0xab1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555cf7,_0x5bb063,_0x4babdc){return new BPromise(function(_0x5eaf96,_0x34ae4b){return client[_0xab1a('0xa')](_0x555cf7,_0x4babdc)[_0xab1a('0xb')](function(_0x5df8ce){logger['info'](_0xab1a('0xc'),_0x5bb063,_0xab1a('0xd'));logger[_0xab1a('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5bb063,_0xab1a('0xd'),JSON['stringify'](_0x5df8ce));if(_0x5df8ce[_0xab1a('0xf')]){if(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x10')]===0x1f4){logger[_0xab1a('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x5bb063,_0x5df8ce['error'][_0xab1a('0x11')]);return _0x34ae4b(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x11')]);}logger['error'](_0xab1a('0xc'),_0x5bb063,_0x5df8ce['error'][_0xab1a('0x11')]);return _0x5eaf96(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x11')]);}else{logger[_0xab1a('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5bb063,_0xab1a('0xd'));_0x5eaf96(_0x5df8ce[_0xab1a('0x13')]['message']);}})[_0xab1a('0x14')](function(_0xac0e96){logger[_0xab1a('0xf')](_0xab1a('0xc'),_0x5bb063,_0xac0e96);_0x34ae4b(_0xac0e96);});});} \ No newline at end of file +var _0x1755=['request\x20sent','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x1850e1,_0x1cdbaa){var _0x2fe61d=function(_0x436b0d){while(--_0x436b0d){_0x1850e1['push'](_0x1850e1['shift']());}};_0x2fe61d(++_0x1cdbaa);}(_0x1755,0x126));var _0x5175=function(_0x2defb8,_0x30ea45){_0x2defb8=_0x2defb8-0x0;var _0xa01976=_0x1755[_0x2defb8];return _0xa01976;};'use strict';var _=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var moment=require(_0x5175('0x2'));var BPromise=require(_0x5175('0x3'));var rs=require(_0x5175('0x4'));var fs=require('fs');var Redis=require(_0x5175('0x5'));var db=require(_0x5175('0x6'))['db'];var utils=require(_0x5175('0x7'));var logger=require(_0x5175('0x8'))(_0x5175('0x9'));var config=require(_0x5175('0xa'));var jayson=require(_0x5175('0xb'));var client=jayson['client'][_0x5175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x502e2a,_0x2a1a7f,_0x308946){return new BPromise(function(_0x5719cd,_0x4a8055){return client[_0x5175('0xd')](_0x502e2a,_0x308946)[_0x5175('0xe')](function(_0x2c8dc7){logger[_0x5175('0xf')](_0x5175('0x10'),_0x2a1a7f,'request\x20sent');logger['debug'](_0x5175('0x11'),_0x2a1a7f,_0x5175('0x12'),JSON[_0x5175('0x13')](_0x2c8dc7));if(_0x2c8dc7['error']){if(_0x2c8dc7['error'][_0x5175('0x14')]===0x1f4){logger[_0x5175('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x2a1a7f,_0x2c8dc7[_0x5175('0x15')][_0x5175('0x16')]);return _0x4a8055(_0x2c8dc7[_0x5175('0x15')]['message']);}logger['error'](_0x5175('0x10'),_0x2a1a7f,_0x2c8dc7[_0x5175('0x15')][_0x5175('0x16')]);return _0x5719cd(_0x2c8dc7[_0x5175('0x15')][_0x5175('0x16')]);}else{logger[_0x5175('0xf')](_0x5175('0x10'),_0x2a1a7f,_0x5175('0x12'));_0x5719cd(_0x2c8dc7[_0x5175('0x17')][_0x5175('0x16')]);}})['catch'](function(_0xe68f0c){logger['error'](_0x5175('0x10'),_0x2a1a7f,_0xe68f0c);_0x4a8055(_0xe68f0c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fac1047..a55c5f5 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 _0xc92b=['isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x2d18c1,_0x441187){var _0x5db21b=function(_0x5d00fa){while(--_0x5d00fa){_0x2d18c1['push'](_0x2d18c1['shift']());}};_0x5db21b(++_0x441187);}(_0xc92b,0xed));var _0xbc92=function(_0x7539e8,_0x2feed0){_0x7539e8=_0x7539e8-0x0;var _0x10223d=_0xc92b[_0x7539e8];return _0x10223d;};'use strict';var multer=require(_0xbc92('0x0'));var util=require(_0xbc92('0x1'));var path=require(_0xbc92('0x2'));var timeout=require(_0xbc92('0x3'));var express=require('express');var router=express[_0xbc92('0x4')]();var fs_extra=require(_0xbc92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc92('0x6'));var config=require(_0xbc92('0x7'));var controller=require(_0xbc92('0x8'));router[_0xbc92('0x9')]('/',auth[_0xbc92('0xa')](),controller['index']);router[_0xbc92('0x9')](_0xbc92('0xb'),auth[_0xbc92('0xa')](),controller[_0xbc92('0xc')]);router[_0xbc92('0x9')]('/:id/configurations',auth[_0xbc92('0xa')](),controller[_0xbc92('0xd')]);router[_0xbc92('0x9')](_0xbc92('0xe'),auth['isAuthenticated'](),controller[_0xbc92('0xf')]);router['post']('/',auth[_0xbc92('0xa')](),controller[_0xbc92('0x10')]);router[_0xbc92('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xbc92('0xb'),auth[_0xbc92('0xa')](),controller['update']);router['delete'](_0xbc92('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc92('0x12')]=router; \ No newline at end of file +var _0xcd99=['addConfiguration','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x59fafd,_0x178c4a){var _0x570054=function(_0x342363){while(--_0x342363){_0x59fafd['push'](_0x59fafd['shift']());}};_0x570054(++_0x178c4a);}(_0xcd99,0x1e0));var _0x9cd9=function(_0x384af9,_0x88396){_0x384af9=_0x384af9-0x0;var _0x13c412=_0xcd99[_0x384af9];return _0x13c412;};'use strict';var multer=require(_0x9cd9('0x0'));var util=require(_0x9cd9('0x1'));var path=require(_0x9cd9('0x2'));var timeout=require(_0x9cd9('0x3'));var express=require(_0x9cd9('0x4'));var router=express[_0x9cd9('0x5')]();var fs_extra=require(_0x9cd9('0x6'));var auth=require(_0x9cd9('0x7'));var interaction=require(_0x9cd9('0x8'));var config=require(_0x9cd9('0x9'));var controller=require(_0x9cd9('0xa'));router[_0x9cd9('0xb')]('/',auth[_0x9cd9('0xc')](),controller[_0x9cd9('0xd')]);router[_0x9cd9('0xb')]('/:id',auth[_0x9cd9('0xc')](),controller[_0x9cd9('0xe')]);router['get'](_0x9cd9('0xf'),auth[_0x9cd9('0xc')](),controller[_0x9cd9('0x10')]);router[_0x9cd9('0xb')](_0x9cd9('0x11'),auth[_0x9cd9('0xc')](),controller['getFields']);router[_0x9cd9('0x12')]('/',auth['isAuthenticated'](),controller[_0x9cd9('0x13')]);router[_0x9cd9('0x12')](_0x9cd9('0xf'),auth[_0x9cd9('0xc')](),controller[_0x9cd9('0x14')]);router['put']('/:id',auth[_0x9cd9('0xc')](),controller[_0x9cd9('0x15')]);router['delete'](_0x9cd9('0x16'),auth[_0x9cd9('0xc')](),controller[_0x9cd9('0x17')]);module[_0x9cd9('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 b6cf674..652d7ef 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 _0x68b3=['sequelize','exports','STRING','remoteUri'];(function(_0x542ce8,_0x475277){var _0x2409eb=function(_0x1c1e37){while(--_0x1c1e37){_0x542ce8['push'](_0x542ce8['shift']());}};_0x2409eb(++_0x475277);}(_0x68b3,0x1d8));var _0x368b=function(_0x287f51,_0x1295aa){_0x287f51=_0x287f51-0x0;var _0x5e04c4=_0x68b3[_0x287f51];return _0x5e04c4;};'use strict';var Sequelize=require(_0x368b('0x0'));module[_0x368b('0x1')]={'name':{'type':Sequelize[_0x368b('0x2')]},'description':{'type':Sequelize[_0x368b('0x2')]},'username':{'type':Sequelize[_0x368b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x368b('0x2')]},'remoteUri':{'type':Sequelize[_0x368b('0x2')],'unique':_0x368b('0x3')},'serverUrl':{'type':Sequelize[_0x368b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6a55=['STRING','sequelize'];(function(_0x418869,_0x59bdf5){var _0xdc14ce=function(_0x198264){while(--_0x198264){_0x418869['push'](_0x418869['shift']());}};_0xdc14ce(++_0x59bdf5);}(_0x6a55,0xdb));var _0x56a5=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x6a55[_0x74892f];return _0x10ee61;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 44572f4..f2149d7 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 _0x590a=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_dropdown','map','default','capitalize','test'];(function(_0x26fca8,_0x45356c){var _0x1e43df=function(_0x2fb827){while(--_0x2fb827){_0x26fca8['push'](_0x26fca8['shift']());}};_0x1e43df(++_0x45356c);}(_0x590a,0x159));var _0xa590=function(_0x56a1cb,_0x144273){_0x56a1cb=_0x56a1cb-0x0;var _0x690753=_0x590a[_0x56a1cb];return _0x690753;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa590('0x0'));var zipdir=require(_0xa590('0x1'));var jsonpatch=require(_0xa590('0x2'));var rp=require(_0xa590('0x3'));var moment=require(_0xa590('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa590('0x5'));var path=require(_0xa590('0x6'));var sox=require(_0xa590('0x7'));var csv=require('to-csv');var ejs=require(_0xa590('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa590('0x9'));var squel=require(_0xa590('0xa'));var crypto=require(_0xa590('0xb'));var jsforce=require(_0xa590('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa590('0xd'));var Papa=require('papaparse');var Redis=require(_0xa590('0xe'));var authService=require(_0xa590('0xf'));var qs=require(_0xa590('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa590('0x11'));var logger=require(_0xa590('0x12'))(_0xa590('0x13'));var utils=require(_0xa590('0x14'));var config=require(_0xa590('0x15'));var licenseUtil=require(_0xa590('0x16'));var db=require(_0xa590('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5bc467,_0x252e2b){_0x252e2b=_0x252e2b||0xcc;return function(_0xb67661){if(_0xb67661){return _0x5bc467[_0xa590('0x18')](_0x252e2b);}return _0x5bc467[_0xa590('0x19')](_0x252e2b)['end']();};}function respondWithResult(_0xdf68af,_0x3c1fee){_0x3c1fee=_0x3c1fee||0xc8;return function(_0x5d914f){if(_0x5d914f){return _0xdf68af['status'](_0x3c1fee)[_0xa590('0x1a')](_0x5d914f);}};}function respondWithFilteredResult(_0x5ec6e2,_0x165b81){return function(_0x6ca5c8){if(_0x6ca5c8){var _0x1d218c=typeof _0x165b81[_0xa590('0x1b')]===_0xa590('0x1c')&&typeof _0x165b81[_0xa590('0x1d')]===_0xa590('0x1c');var _0x458a80=_0x6ca5c8[_0xa590('0x1e')];var _0xc1f37a=_0x1d218c?0x0:_0x165b81[_0xa590('0x1b')];var _0x360a1e=_0x1d218c?_0x6ca5c8[_0xa590('0x1e')]:_0x165b81[_0xa590('0x1b')]+_0x165b81[_0xa590('0x1d')];var _0x219d01;if(_0x360a1e>=_0x458a80){_0x360a1e=_0x458a80;_0x219d01=0xc8;}else{_0x219d01=0xce;}_0x5ec6e2[_0xa590('0x19')](_0x219d01);return _0x5ec6e2[_0xa590('0x1f')](_0xa590('0x20'),_0xc1f37a+'-'+_0x360a1e+'/'+_0x458a80)[_0xa590('0x1a')](_0x6ca5c8);}return null;};}function patchUpdates(_0x23381b){return function(_0x378e4e){try{jsonpatch['apply'](_0x378e4e,_0x23381b,!![]);}catch(_0x1fb3fd){return BPromise[_0xa590('0x21')](_0x1fb3fd);}return _0x378e4e['save']();};}function saveUpdates(_0x489a13,_0x2ccb4e){return function(_0x16113c){if(_0x16113c){return _0x16113c[_0xa590('0x22')](_0x489a13)[_0xa590('0x23')](function(_0x24d901){return _0x24d901;});}return null;};}function removeEntity(_0x4d63e2,_0x1805d8){return function(_0x35596f){if(_0x35596f){return _0x35596f[_0xa590('0x24')]()[_0xa590('0x23')](function(){_0x4d63e2[_0xa590('0x19')](0xcc)[_0xa590('0x25')]();});}};}function handleEntityNotFound(_0x5a1396,_0x3a9c51){return function(_0x4fdc6e){if(!_0x4fdc6e){_0x5a1396[_0xa590('0x18')](0x194);}return _0x4fdc6e;};}function handleError(_0x41bd71,_0x46f7dd){_0x46f7dd=_0x46f7dd||0x1f4;return function(_0x4dac12){logger[_0xa590('0x26')](_0x4dac12[_0xa590('0x27')]);if(_0x4dac12[_0xa590('0x28')]){delete _0x4dac12[_0xa590('0x28')];}_0x41bd71['status'](_0x46f7dd)['send'](_0x4dac12);};}exports[_0xa590('0x29')]=function(_0x391f8c,_0x6928e4){var _0x115e45={},_0x3b47f1={},_0x35a179={'count':0x0,'rows':[]};var _0x2aa769=_['map'](db[_0xa590('0x2a')][_0xa590('0x2b')],function(_0x1a0f9a){return{'name':_0x1a0f9a[_0xa590('0x2c')],'type':_0x1a0f9a[_0xa590('0x2d')][_0xa590('0x2e')]};});_0x3b47f1['model']=_['map'](_0x2aa769,'name');_0x3b47f1[_0xa590('0x2f')]=_['keys'](_0x391f8c['query']);_0x3b47f1[_0xa590('0x30')]=_[_0xa590('0x31')](_0x3b47f1[_0xa590('0x32')],_0x3b47f1[_0xa590('0x2f')]);_0x115e45['attributes']=_[_0xa590('0x31')](_0x3b47f1[_0xa590('0x32')],qs['fields'](_0x391f8c[_0xa590('0x2f')][_0xa590('0x33')]));_0x115e45[_0xa590('0x34')]=_0x115e45[_0xa590('0x34')][_0xa590('0x35')]?_0x115e45['attributes']:_0x3b47f1[_0xa590('0x32')];if(!_0x391f8c['query'][_0xa590('0x36')](_0xa590('0x37'))){_0x115e45[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x391f8c['query'][_0xa590('0x1d')]);_0x115e45[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x391f8c[_0xa590('0x2f')][_0xa590('0x1b')]);}_0x115e45[_0xa590('0x38')]=qs['sort'](_0x391f8c[_0xa590('0x2f')][_0xa590('0x39')]);_0x115e45[_0xa590('0x3a')]=qs[_0xa590('0x30')](_[_0xa590('0x3b')](_0x391f8c[_0xa590('0x2f')],_0x3b47f1[_0xa590('0x30')]),_0x2aa769);if(_0x391f8c[_0xa590('0x2f')][_0xa590('0x3c')]){_0x115e45[_0xa590('0x3a')]=_[_0xa590('0x3d')](_0x115e45['where'],{'$or':_['map'](_0x2aa769,function(_0x4997e3){if(_0x4997e3[_0xa590('0x2d')]!==_0xa590('0x3e')){var _0x283e03={};_0x283e03[_0x4997e3[_0xa590('0x28')]]={'$like':'%'+_0x391f8c[_0xa590('0x2f')][_0xa590('0x3c')]+'%'};return _0x283e03;}})});}_0x115e45=_['merge']({},_0x115e45,_0x391f8c[_0xa590('0x3f')]);var _0x41835f={'where':_0x115e45[_0xa590('0x3a')]};return db[_0xa590('0x2a')][_0xa590('0x1e')](_0x41835f)[_0xa590('0x23')](function(_0xf858d4){_0x35a179['count']=_0xf858d4;if(_0x391f8c[_0xa590('0x2f')]['includeAll']){_0x115e45[_0xa590('0x40')]=[{'all':!![]}];}return db[_0xa590('0x2a')][_0xa590('0x41')](_0x115e45);})[_0xa590('0x23')](function(_0x2895d4){_0x35a179[_0xa590('0x42')]=_0x2895d4;return _0x35a179;})[_0xa590('0x23')](respondWithFilteredResult(_0x6928e4,_0x115e45))[_0xa590('0x43')](handleError(_0x6928e4,null));};exports[_0xa590('0x44')]=function(_0x3f637c,_0x2e9e38){var _0x5408f4={'raw':![],'where':{'id':_0x3f637c[_0xa590('0x45')]['id']}},_0x16431f={};_0x16431f[_0xa590('0x32')]=_[_0xa590('0x46')](db[_0xa590('0x2a')]['rawAttributes']);_0x16431f['query']=_[_0xa590('0x46')](_0x3f637c[_0xa590('0x2f')]);_0x16431f[_0xa590('0x30')]=_[_0xa590('0x31')](_0x16431f['model'],_0x16431f[_0xa590('0x2f')]);_0x5408f4['attributes']=_[_0xa590('0x31')](_0x16431f['model'],qs[_0xa590('0x33')](_0x3f637c['query'][_0xa590('0x33')]));_0x5408f4['attributes']=_0x5408f4['attributes'][_0xa590('0x35')]?_0x5408f4[_0xa590('0x34')]:_0x16431f[_0xa590('0x32')];if(_0x3f637c[_0xa590('0x2f')][_0xa590('0x47')]){_0x5408f4[_0xa590('0x40')]=[{'all':!![]}];}_0x5408f4=_['merge']({},_0x5408f4,_0x3f637c['options']);return db[_0xa590('0x2a')]['find'](_0x5408f4)[_0xa590('0x23')](handleEntityNotFound(_0x2e9e38,null))[_0xa590('0x23')](respondWithResult(_0x2e9e38,null))[_0xa590('0x43')](handleError(_0x2e9e38,null));};exports[_0xa590('0x48')]=function(_0x3bc106,_0x48f82f){return db['FreshdeskAccount'][_0xa590('0x48')](_0x3bc106[_0xa590('0x49')],{})[_0xa590('0x23')](respondWithResult(_0x48f82f,0xc9))['catch'](handleError(_0x48f82f,null));};exports[_0xa590('0x22')]=function(_0x513486,_0x196b84){if(_0x513486[_0xa590('0x49')]['id']){delete _0x513486[_0xa590('0x49')]['id'];}return db[_0xa590('0x2a')]['find']({'where':{'id':_0x513486[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x196b84,null))['then'](saveUpdates(_0x513486['body'],null))[_0xa590('0x23')](respondWithResult(_0x196b84,null))[_0xa590('0x43')](handleError(_0x196b84,null));};exports[_0xa590('0x24')]=function(_0x7daa1b,_0x515088){return db[_0xa590('0x2a')]['find']({'where':{'id':_0x7daa1b[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x515088,null))[_0xa590('0x23')](removeEntity(_0x515088,null))['catch'](handleError(_0x515088,null));};exports[_0xa590('0x4a')]=function(_0x2f5ace,_0x2b53ce,_0x11b99f){var _0x22c2a5={};var _0x13900e={};var _0x20e879;var _0xf3f60e;return db[_0xa590('0x2a')]['findOne']({'where':{'id':_0x2f5ace[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x2b53ce,null))[_0xa590('0x23')](function(_0x4c9d59){if(_0x4c9d59){_0x20e879=_0x4c9d59;_0x13900e['model']=_['keys'](db[_0xa590('0x4b')][_0xa590('0x2b')]);_0x13900e[_0xa590('0x2f')]=_[_0xa590('0x46')](_0x2f5ace[_0xa590('0x2f')]);_0x13900e['filters']=_['intersection'](_0x13900e[_0xa590('0x32')],_0x13900e[_0xa590('0x2f')]);_0x22c2a5[_0xa590('0x34')]=_['intersection'](_0x13900e[_0xa590('0x32')],qs[_0xa590('0x33')](_0x2f5ace['query']['fields']));_0x22c2a5[_0xa590('0x34')]=_0x22c2a5[_0xa590('0x34')][_0xa590('0x35')]?_0x22c2a5[_0xa590('0x34')]:_0x13900e[_0xa590('0x32')];_0x22c2a5['order']=qs[_0xa590('0x39')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x39')]);_0x22c2a5[_0xa590('0x3a')]=qs[_0xa590('0x30')](_[_0xa590('0x3b')](_0x2f5ace[_0xa590('0x2f')],_0x13900e[_0xa590('0x30')]));if(_0x2f5ace[_0xa590('0x2f')]['filter']){_0x22c2a5[_0xa590('0x3a')]=_['merge'](_0x22c2a5[_0xa590('0x3a')],{'$or':_['map'](_0x22c2a5[_0xa590('0x34')],function(_0x46727a){var _0x3e3ec8={};_0x3e3ec8[_0x46727a]={'$like':'%'+_0x2f5ace['query']['filter']+'%'};return _0x3e3ec8;})});}_0x22c2a5=_[_0xa590('0x3d')]({},_0x22c2a5,_0x2f5ace['options']);return _0x20e879[_0xa590('0x4a')](_0x22c2a5);}})['then'](function(_0x46890a){if(_0x46890a){_0xf3f60e=_0x46890a['length'];if(!_0x2f5ace[_0xa590('0x2f')]['hasOwnProperty']('nolimit')){_0x22c2a5[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x1d')]);_0x22c2a5['offset']=qs[_0xa590('0x1b')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x1b')]);}return _0x20e879[_0xa590('0x4a')](_0x22c2a5);}})[_0xa590('0x23')](function(_0xcb7399){if(_0xcb7399){return _0xcb7399?{'count':_0xf3f60e,'rows':_0xcb7399}:null;}})['then'](respondWithResult(_0x2b53ce,null))[_0xa590('0x43')](handleError(_0x2b53ce,null));};exports[_0xa590('0x4c')]=function(_0x552bcd,_0x9583c,_0x4e9d74){if(_0x552bcd[_0xa590('0x49')]['id']){delete _0x552bcd[_0xa590('0x49')]['id'];}return db[_0xa590('0x2a')][_0xa590('0x4d')]({'where':{'id':_0x552bcd[_0xa590('0x45')]['id']}})['then'](handleEntityNotFound(_0x9583c,null))[_0xa590('0x23')](function(_0x524a3f){if(_0x524a3f){_0x552bcd[_0xa590('0x49')][_0xa590('0x4e')]=_0x524a3f['id'];_0x552bcd[_0xa590('0x49')][_0xa590('0x4f')]=integrations[_0xa590('0x50')](_0x552bcd[_0xa590('0x49')]['channel'],_0x552bcd[_0xa590('0x49')]['type']);_0x552bcd[_0xa590('0x49')][_0xa590('0x51')]=integrations['getDescriptions'](_0x552bcd[_0xa590('0x49')][_0xa590('0x52')],_0x552bcd[_0xa590('0x49')][_0xa590('0x2d')]);return db[_0xa590('0x4b')]['create'](_0x552bcd[_0xa590('0x49')],{'include':[{'model':db[_0xa590('0x53')],'as':_0xa590('0x4f')},{'model':db[_0xa590('0x53')],'as':_0xa590('0x51')}]});}return null;})['then'](respondWithResult(_0x9583c,null))[_0xa590('0x43')](handleError(_0x9583c,null));};exports['getFields']=function(_0x203d3e,_0x300f55,_0x223b48){var _0x3ef2f1='';return db[_0xa590('0x2a')][_0xa590('0x4d')]({'where':{'id':_0x203d3e[_0xa590('0x45')]['id']},'attributes':['id',_0xa590('0x54'),_0xa590('0x55')]})[_0xa590('0x23')](handleEntityNotFound(_0x300f55,null))[_0xa590('0x23')](function(_0x3af4b6){if(_0x3af4b6){_0x3ef2f1=_0x3af4b6[_0xa590('0x54')];var _0x5b65eb=_0x3ef2f1['slice'](-0x1);if(_0x5b65eb==='/'){_0x3ef2f1=_0x3ef2f1[_0xa590('0x56')](0x0,_0x3ef2f1[_0xa590('0x57')](_0x5b65eb));}return rp({'method':'GET','uri':util[_0xa590('0x58')](_0xa590('0x59'),_0x3ef2f1,_0xa590('0x5a')),'headers':{'Authorization':util[_0xa590('0x58')](_0xa590('0x5b'),new Buffer(util['format'](_0xa590('0x5c'),_0x3af4b6[_0xa590('0x55')]))['toString']('base64'))},'json':!![]});}})[_0xa590('0x23')](function(_0x2b195a){if(_0x2b195a){var _0x5b4083=[_0xa590('0x5d'),'subject',_0xa590('0x5e'),_0xa590('0x5f'),'status',_0xa590('0x60'),_0xa590('0x61'),_0xa590('0x62'),_0xa590('0x63'),'group','company'];_[_0xa590('0x64')](_0x2b195a,function(_0x1c75f6){return _0x5b4083[_0xa590('0x65')](_0x1c75f6['name'])||!_0x1c75f6['default']&&_0x1c75f6['type']!=='custom_text'&&_0x1c75f6['type']!==_0xa590('0x66');});return{'count':_0x2b195a[_0xa590('0x35')],'rows':_[_0xa590('0x67')](_0x2b195a,function(_0x361909){return{'id':_0x361909[_0xa590('0x28')],'name':_0x361909['label'],'custom':!_0x361909[_0xa590('0x68')],'options':_0x361909['choices']?_[_0xa590('0x67')](_0x361909['choices'],function(_0x408e0c){return{'name':_[_0xa590('0x69')](_0x408e0c),'value':_0x408e0c};}):[]};})};}})[_0xa590('0x23')](respondWithResult(_0x300f55,null))['catch'](function(_0x3dd7d3){var _0x53e4e0=_0x203d3e[_0xa590('0x2f')][_0xa590('0x6a')]?0x1f4:_0x3dd7d3[_0xa590('0x6b')]||0x1f4;logger['error'](_0xa590('0x6c'),_0xa590('0x6d'),_0x53e4e0,JSON[_0xa590('0x6e')](_0x3dd7d3));delete _0x3dd7d3[_0xa590('0x28')];if(_0x53e4e0===0x191){_0x53e4e0=0x190;}_0x300f55['status'](_0x53e4e0)[_0xa590('0x6f')](_0x203d3e[_0xa590('0x2f')]['test']?{'message':_0xa590('0x70'),'statusCode':_0x3dd7d3['statusCode']}:_0x3dd7d3);});}; \ No newline at end of file +var _0xcce8=['count','set','json','apply','reject','update','destroy','end','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','getSubjects','channel','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','format','Basic\x20%s','%s:X','toString','requester','agent','description','priority','group','source','company','remove','includes','default','custom_text','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit'];(function(_0xc8a692,_0x579320){var _0x5055d8=function(_0x528459){while(--_0x528459){_0xc8a692['push'](_0xc8a692['shift']());}};_0x5055d8(++_0x579320);}(_0xcce8,0x1a5));var _0x8cce=function(_0x10f102,_0x5be523){_0x10f102=_0x10f102-0x0;var _0x107b93=_0xcce8[_0x10f102];return _0x107b93;};'use strict';var emlformat=require(_0x8cce('0x0'));var rimraf=require(_0x8cce('0x1'));var zipdir=require(_0x8cce('0x2'));var jsonpatch=require(_0x8cce('0x3'));var rp=require(_0x8cce('0x4'));var moment=require(_0x8cce('0x5'));var BPromise=require(_0x8cce('0x6'));var Mustache=require(_0x8cce('0x7'));var util=require(_0x8cce('0x8'));var path=require(_0x8cce('0x9'));var sox=require('sox');var csv=require(_0x8cce('0xa'));var ejs=require(_0x8cce('0xb'));var fs=require('fs');var fs_extra=require(_0x8cce('0xc'));var _=require(_0x8cce('0xd'));var squel=require(_0x8cce('0xe'));var crypto=require(_0x8cce('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cce('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cce('0x11'));var qs=require(_0x8cce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cce('0x13'));var logger=require(_0x8cce('0x14'))(_0x8cce('0x15'));var utils=require('../../config/utils');var config=require(_0x8cce('0x16'));var licenseUtil=require(_0x8cce('0x17'));var db=require(_0x8cce('0x18'))['db'];var integrations=require(_0x8cce('0x19'));function respondWithStatusCode(_0x54f76c,_0x2e1eeb){_0x2e1eeb=_0x2e1eeb||0xcc;return function(_0x3daa3d){if(_0x3daa3d){return _0x54f76c[_0x8cce('0x1a')](_0x2e1eeb);}return _0x54f76c[_0x8cce('0x1b')](_0x2e1eeb)['end']();};}function respondWithResult(_0x2ebd26,_0x59b900){_0x59b900=_0x59b900||0xc8;return function(_0x4d41c0){if(_0x4d41c0){return _0x2ebd26[_0x8cce('0x1b')](_0x59b900)['json'](_0x4d41c0);}};}function respondWithFilteredResult(_0x4548a1,_0x3e13e5){return function(_0x13fa21){if(_0x13fa21){var _0x17706c=typeof _0x3e13e5[_0x8cce('0x1c')]===_0x8cce('0x1d')&&typeof _0x3e13e5[_0x8cce('0x1e')]===_0x8cce('0x1d');var _0x30eb60=_0x13fa21[_0x8cce('0x1f')];var _0x4f017b=_0x17706c?0x0:_0x3e13e5[_0x8cce('0x1c')];var _0x3a32e3=_0x17706c?_0x13fa21['count']:_0x3e13e5[_0x8cce('0x1c')]+_0x3e13e5[_0x8cce('0x1e')];var _0x28179b;if(_0x3a32e3>=_0x30eb60){_0x3a32e3=_0x30eb60;_0x28179b=0xc8;}else{_0x28179b=0xce;}_0x4548a1[_0x8cce('0x1b')](_0x28179b);return _0x4548a1[_0x8cce('0x20')]('Content-Range',_0x4f017b+'-'+_0x3a32e3+'/'+_0x30eb60)[_0x8cce('0x21')](_0x13fa21);}return null;};}function patchUpdates(_0x221fe2){return function(_0x397181){try{jsonpatch[_0x8cce('0x22')](_0x397181,_0x221fe2,!![]);}catch(_0x491e3d){return BPromise[_0x8cce('0x23')](_0x491e3d);}return _0x397181['save']();};}function saveUpdates(_0x38a5a5,_0x2aa625){return function(_0x2e7601){if(_0x2e7601){return _0x2e7601[_0x8cce('0x24')](_0x38a5a5)['then'](function(_0x1b064c){return _0x1b064c;});}return null;};}function removeEntity(_0x20bedb,_0x244bb7){return function(_0x246122){if(_0x246122){return _0x246122[_0x8cce('0x25')]()['then'](function(){_0x20bedb[_0x8cce('0x1b')](0xcc)[_0x8cce('0x26')]();});}};}function handleEntityNotFound(_0xfd5aae,_0x53f7d5){return function(_0x4d3260){if(!_0x4d3260){_0xfd5aae[_0x8cce('0x1a')](0x194);}return _0x4d3260;};}function handleError(_0x592e11,_0x57dca4){_0x57dca4=_0x57dca4||0x1f4;return function(_0x38b026){logger[_0x8cce('0x27')](_0x38b026[_0x8cce('0x28')]);if(_0x38b026[_0x8cce('0x29')]){delete _0x38b026[_0x8cce('0x29')];}_0x592e11[_0x8cce('0x1b')](_0x57dca4)[_0x8cce('0x2a')](_0x38b026);};}exports[_0x8cce('0x2b')]=function(_0x28d61b,_0x3b1c49){var _0x4cb528={},_0x41eb3c={},_0x18afd0={'count':0x0,'rows':[]};var _0x445918=_[_0x8cce('0x2c')](db[_0x8cce('0x2d')]['rawAttributes'],function(_0x248a5c){return{'name':_0x248a5c[_0x8cce('0x2e')],'type':_0x248a5c[_0x8cce('0x2f')][_0x8cce('0x30')]};});_0x41eb3c[_0x8cce('0x31')]=_[_0x8cce('0x2c')](_0x445918,_0x8cce('0x29'));_0x41eb3c[_0x8cce('0x32')]=_[_0x8cce('0x33')](_0x28d61b[_0x8cce('0x32')]);_0x41eb3c['filters']=_[_0x8cce('0x34')](_0x41eb3c[_0x8cce('0x31')],_0x41eb3c['query']);_0x4cb528[_0x8cce('0x35')]=_[_0x8cce('0x34')](_0x41eb3c[_0x8cce('0x31')],qs[_0x8cce('0x36')](_0x28d61b[_0x8cce('0x32')][_0x8cce('0x36')]));_0x4cb528[_0x8cce('0x35')]=_0x4cb528[_0x8cce('0x35')][_0x8cce('0x37')]?_0x4cb528[_0x8cce('0x35')]:_0x41eb3c['model'];if(!_0x28d61b[_0x8cce('0x32')][_0x8cce('0x38')](_0x8cce('0x39'))){_0x4cb528['limit']=qs[_0x8cce('0x1e')](_0x28d61b['query'][_0x8cce('0x1e')]);_0x4cb528[_0x8cce('0x1c')]=qs[_0x8cce('0x1c')](_0x28d61b['query'][_0x8cce('0x1c')]);}_0x4cb528[_0x8cce('0x3a')]=qs[_0x8cce('0x3b')](_0x28d61b[_0x8cce('0x32')]['sort']);_0x4cb528['where']=qs[_0x8cce('0x3c')](_[_0x8cce('0x3d')](_0x28d61b[_0x8cce('0x32')],_0x41eb3c[_0x8cce('0x3c')]),_0x445918);if(_0x28d61b[_0x8cce('0x32')][_0x8cce('0x3e')]){_0x4cb528[_0x8cce('0x3f')]=_[_0x8cce('0x40')](_0x4cb528[_0x8cce('0x3f')],{'$or':_[_0x8cce('0x2c')](_0x445918,function(_0x2893a8){if(_0x2893a8[_0x8cce('0x2f')]!=='VIRTUAL'){var _0x48f965={};_0x48f965[_0x2893a8[_0x8cce('0x29')]]={'$like':'%'+_0x28d61b['query']['filter']+'%'};return _0x48f965;}})});}_0x4cb528=_[_0x8cce('0x40')]({},_0x4cb528,_0x28d61b[_0x8cce('0x41')]);var _0x4ee788={'where':_0x4cb528[_0x8cce('0x3f')]};return db['FreshdeskAccount'][_0x8cce('0x1f')](_0x4ee788)[_0x8cce('0x42')](function(_0x5717fe){_0x18afd0[_0x8cce('0x1f')]=_0x5717fe;if(_0x28d61b[_0x8cce('0x32')][_0x8cce('0x43')]){_0x4cb528[_0x8cce('0x44')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x8cce('0x45')](_0x4cb528);})[_0x8cce('0x42')](function(_0x3942cf){_0x18afd0[_0x8cce('0x46')]=_0x3942cf;return _0x18afd0;})[_0x8cce('0x42')](respondWithFilteredResult(_0x3b1c49,_0x4cb528))[_0x8cce('0x47')](handleError(_0x3b1c49,null));};exports[_0x8cce('0x48')]=function(_0x4a5351,_0x5165d9){var _0x56fb0a={'raw':![],'where':{'id':_0x4a5351[_0x8cce('0x49')]['id']}},_0x1d6166={};_0x1d6166[_0x8cce('0x31')]=_[_0x8cce('0x33')](db[_0x8cce('0x2d')][_0x8cce('0x4a')]);_0x1d6166[_0x8cce('0x32')]=_[_0x8cce('0x33')](_0x4a5351[_0x8cce('0x32')]);_0x1d6166[_0x8cce('0x3c')]=_[_0x8cce('0x34')](_0x1d6166[_0x8cce('0x31')],_0x1d6166[_0x8cce('0x32')]);_0x56fb0a[_0x8cce('0x35')]=_['intersection'](_0x1d6166[_0x8cce('0x31')],qs[_0x8cce('0x36')](_0x4a5351[_0x8cce('0x32')]['fields']));_0x56fb0a[_0x8cce('0x35')]=_0x56fb0a[_0x8cce('0x35')][_0x8cce('0x37')]?_0x56fb0a[_0x8cce('0x35')]:_0x1d6166[_0x8cce('0x31')];if(_0x4a5351[_0x8cce('0x32')][_0x8cce('0x43')]){_0x56fb0a[_0x8cce('0x44')]=[{'all':!![]}];}_0x56fb0a=_['merge']({},_0x56fb0a,_0x4a5351[_0x8cce('0x41')]);return db[_0x8cce('0x2d')]['find'](_0x56fb0a)[_0x8cce('0x42')](handleEntityNotFound(_0x5165d9,null))['then'](respondWithResult(_0x5165d9,null))['catch'](handleError(_0x5165d9,null));};exports[_0x8cce('0x4b')]=function(_0x400212,_0x48beff){return db[_0x8cce('0x2d')][_0x8cce('0x4b')](_0x400212[_0x8cce('0x4c')],{})[_0x8cce('0x42')](respondWithResult(_0x48beff,0xc9))[_0x8cce('0x47')](handleError(_0x48beff,null));};exports[_0x8cce('0x24')]=function(_0x3a0505,_0x36aaa8){if(_0x3a0505[_0x8cce('0x4c')]['id']){delete _0x3a0505['body']['id'];}return db[_0x8cce('0x2d')][_0x8cce('0x4d')]({'where':{'id':_0x3a0505['params']['id']}})[_0x8cce('0x42')](handleEntityNotFound(_0x36aaa8,null))[_0x8cce('0x42')](saveUpdates(_0x3a0505[_0x8cce('0x4c')],null))[_0x8cce('0x42')](respondWithResult(_0x36aaa8,null))[_0x8cce('0x47')](handleError(_0x36aaa8,null));};exports[_0x8cce('0x25')]=function(_0x16f8cb,_0x45dcbe){return db[_0x8cce('0x2d')]['find']({'where':{'id':_0x16f8cb[_0x8cce('0x49')]['id']}})[_0x8cce('0x42')](handleEntityNotFound(_0x45dcbe,null))['then'](removeEntity(_0x45dcbe,null))['catch'](handleError(_0x45dcbe,null));};exports[_0x8cce('0x4e')]=function(_0x2f9e1d,_0x506f84,_0x97ea6e){var _0x5d2b47={};var _0x6ad35f={};var _0x38a5ff;var _0x127069;return db[_0x8cce('0x2d')][_0x8cce('0x4f')]({'where':{'id':_0x2f9e1d['params']['id']}})[_0x8cce('0x42')](handleEntityNotFound(_0x506f84,null))[_0x8cce('0x42')](function(_0x2d4612){if(_0x2d4612){_0x38a5ff=_0x2d4612;_0x6ad35f[_0x8cce('0x31')]=_[_0x8cce('0x33')](db[_0x8cce('0x50')][_0x8cce('0x4a')]);_0x6ad35f['query']=_[_0x8cce('0x33')](_0x2f9e1d[_0x8cce('0x32')]);_0x6ad35f[_0x8cce('0x3c')]=_[_0x8cce('0x34')](_0x6ad35f[_0x8cce('0x31')],_0x6ad35f['query']);_0x5d2b47[_0x8cce('0x35')]=_[_0x8cce('0x34')](_0x6ad35f['model'],qs[_0x8cce('0x36')](_0x2f9e1d['query'][_0x8cce('0x36')]));_0x5d2b47[_0x8cce('0x35')]=_0x5d2b47['attributes'][_0x8cce('0x37')]?_0x5d2b47['attributes']:_0x6ad35f['model'];_0x5d2b47[_0x8cce('0x3a')]=qs['sort'](_0x2f9e1d[_0x8cce('0x32')]['sort']);_0x5d2b47['where']=qs[_0x8cce('0x3c')](_['pick'](_0x2f9e1d['query'],_0x6ad35f['filters']));if(_0x2f9e1d['query'][_0x8cce('0x3e')]){_0x5d2b47[_0x8cce('0x3f')]=_[_0x8cce('0x40')](_0x5d2b47[_0x8cce('0x3f')],{'$or':_[_0x8cce('0x2c')](_0x5d2b47[_0x8cce('0x35')],function(_0x39840d){var _0xa7693a={};_0xa7693a[_0x39840d]={'$like':'%'+_0x2f9e1d[_0x8cce('0x32')]['filter']+'%'};return _0xa7693a;})});}_0x5d2b47=_['merge']({},_0x5d2b47,_0x2f9e1d[_0x8cce('0x41')]);return _0x38a5ff[_0x8cce('0x4e')](_0x5d2b47);}})[_0x8cce('0x42')](function(_0x540e25){if(_0x540e25){_0x127069=_0x540e25['length'];if(!_0x2f9e1d[_0x8cce('0x32')][_0x8cce('0x38')](_0x8cce('0x39'))){_0x5d2b47[_0x8cce('0x1e')]=qs['limit'](_0x2f9e1d[_0x8cce('0x32')][_0x8cce('0x1e')]);_0x5d2b47[_0x8cce('0x1c')]=qs['offset'](_0x2f9e1d[_0x8cce('0x32')][_0x8cce('0x1c')]);}return _0x38a5ff[_0x8cce('0x4e')](_0x5d2b47);}})[_0x8cce('0x42')](function(_0x38a65b){if(_0x38a65b){return _0x38a65b?{'count':_0x127069,'rows':_0x38a65b}:null;}})[_0x8cce('0x42')](respondWithResult(_0x506f84,null))[_0x8cce('0x47')](handleError(_0x506f84,null));};exports[_0x8cce('0x51')]=function(_0x4585e2,_0x1be776,_0x724038){if(_0x4585e2['body']['id']){delete _0x4585e2[_0x8cce('0x4c')]['id'];}return db[_0x8cce('0x2d')]['findOne']({'where':{'id':_0x4585e2[_0x8cce('0x49')]['id']}})[_0x8cce('0x42')](handleEntityNotFound(_0x1be776,null))['then'](function(_0x43e61d){if(_0x43e61d){_0x4585e2[_0x8cce('0x4c')]['AccountId']=_0x43e61d['id'];_0x4585e2[_0x8cce('0x4c')]['Subjects']=integrations[_0x8cce('0x52')](_0x4585e2[_0x8cce('0x4c')][_0x8cce('0x53')],_0x4585e2[_0x8cce('0x4c')][_0x8cce('0x2f')]);_0x4585e2[_0x8cce('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x4585e2['body'][_0x8cce('0x53')],_0x4585e2[_0x8cce('0x4c')][_0x8cce('0x2f')]);return db[_0x8cce('0x50')][_0x8cce('0x4b')](_0x4585e2['body'],{'include':[{'model':db[_0x8cce('0x54')],'as':_0x8cce('0x55')},{'model':db[_0x8cce('0x54')],'as':_0x8cce('0x56')}]});}return null;})[_0x8cce('0x42')](respondWithResult(_0x1be776,null))[_0x8cce('0x47')](handleError(_0x1be776,null));};exports[_0x8cce('0x57')]=function(_0x1242a4,_0x2130a5,_0x3943ce){var _0x337e84='';return db[_0x8cce('0x2d')][_0x8cce('0x4f')]({'where':{'id':_0x1242a4[_0x8cce('0x49')]['id']},'attributes':['id',_0x8cce('0x58'),_0x8cce('0x59')]})[_0x8cce('0x42')](handleEntityNotFound(_0x2130a5,null))[_0x8cce('0x42')](function(_0x5f26ed){if(_0x5f26ed){_0x337e84=_0x5f26ed[_0x8cce('0x58')];var _0xe22d42=_0x337e84[_0x8cce('0x5a')](-0x1);if(_0xe22d42==='/'){_0x337e84=_0x337e84['substring'](0x0,_0x337e84[_0x8cce('0x5b')](_0xe22d42));}return rp({'method':'GET','uri':util[_0x8cce('0x5c')]('%s/%s',_0x337e84,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x8cce('0x5c')](_0x8cce('0x5d'),new Buffer(util[_0x8cce('0x5c')](_0x8cce('0x5e'),_0x5f26ed[_0x8cce('0x59')]))[_0x8cce('0x5f')]('base64'))},'json':!![]});}})[_0x8cce('0x42')](function(_0x2787fa){if(_0x2787fa){var _0x48ca19=[_0x8cce('0x60'),'subject',_0x8cce('0x61'),_0x8cce('0x62'),'status',_0x8cce('0x63'),_0x8cce('0x64'),_0x8cce('0x65'),'ticket_type',_0x8cce('0x64'),_0x8cce('0x66')];_[_0x8cce('0x67')](_0x2787fa,function(_0x22e7f3){return _0x48ca19[_0x8cce('0x68')](_0x22e7f3['name'])||!_0x22e7f3[_0x8cce('0x69')]&&_0x22e7f3['type']!==_0x8cce('0x6a')&&_0x22e7f3[_0x8cce('0x2f')]!=='custom_dropdown';});return{'count':_0x2787fa[_0x8cce('0x37')],'rows':_['map'](_0x2787fa,function(_0x57cd87){return{'id':_0x57cd87[_0x8cce('0x29')],'name':_0x57cd87[_0x8cce('0x6b')],'custom':!_0x57cd87[_0x8cce('0x69')],'options':_0x57cd87[_0x8cce('0x6c')]?_['map'](_0x57cd87[_0x8cce('0x6c')],function(_0xd09267){return{'name':_['capitalize'](_0xd09267),'value':_0xd09267};}):[]};})};}})[_0x8cce('0x42')](respondWithResult(_0x2130a5,null))['catch'](function(_0x20c53a){var _0x50a9c=_0x1242a4['query']['test']?0x1f4:_0x20c53a[_0x8cce('0x6d')]||0x1f4;logger[_0x8cce('0x27')](_0x8cce('0x6e'),_0x8cce('0x57'),_0x50a9c,JSON[_0x8cce('0x6f')](_0x20c53a));delete _0x20c53a['name'];if(_0x50a9c===0x191){_0x50a9c=0x190;}_0x2130a5[_0x8cce('0x1b')](_0x50a9c)['send'](_0x1242a4[_0x8cce('0x32')]['test']?{'message':_0x8cce('0x70'),'statusCode':_0x20c53a[_0x8cce('0x6d')]}:_0x20c53a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 72ebac9..749a3a2 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 _0x5aea=['../../components/integrations/configuration','exports','define','moment','request-promise','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3fec16,_0x22dbe3){var _0xe89ab9=function(_0x5c2f84){while(--_0x5c2f84){_0x3fec16['push'](_0x3fec16['shift']());}};_0xe89ab9(++_0x22dbe3);}(_0x5aea,0xe3));var _0xa5ae=function(_0x4e74cc,_0x4e8643){_0x4e74cc=_0x4e74cc-0x0;var _0x12cc5a=_0x5aea[_0x4e74cc];return _0x12cc5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa5ae('0x0'));var BPromise=require('bluebird');var rp=require(_0xa5ae('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa5ae('0x2'));var attributes=require(_0xa5ae('0x3'));var integrations=require(_0xa5ae('0x4'));module[_0xa5ae('0x5')]=function(_0x2eb41e,_0x55b4d8){return _0x2eb41e[_0xa5ae('0x6')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac0b=['FreshdeskAccount','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xac0b,0xa2));var _0xbac0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xac0b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbac0('0x0'));var BPromise=require(_0xbac0('0x1'));var rp=require(_0xbac0('0x2'));var fs=require('fs');var path=require(_0xbac0('0x3'));var rimraf=require('rimraf');var config=require(_0xbac0('0x4'));var attributes=require(_0xbac0('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5d14d5,_0x19bbe1){return _0x5d14d5['define'](_0xbac0('0x6'),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 a6f4d0b..f2dbda5 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 _0x25ca=['rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','include','map','attributes','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25ca,0xf0));var _0xa25c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x25ca[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xa25c('0x0'));var util=require(_0xa25c('0x1'));var moment=require(_0xa25c('0x2'));var BPromise=require(_0xa25c('0x3'));var rs=require(_0xa25c('0x4'));var fs=require('fs');var Redis=require(_0xa25c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa25c('0x6'));var logger=require(_0xa25c('0x7'))(_0xa25c('0x8'));var config=require(_0xa25c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa25c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5804e5,_0x1055d7,_0x5c219d){return new BPromise(function(_0x3d3ba9,_0x3513fa){return client[_0xa25c('0xb')](_0x5804e5,_0x5c219d)[_0xa25c('0xc')](function(_0x4598fd){logger[_0xa25c('0xd')](_0xa25c('0xe'),_0x1055d7,_0xa25c('0xf'));logger[_0xa25c('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1055d7,_0xa25c('0xf'),JSON[_0xa25c('0x11')](_0x4598fd));if(_0x4598fd[_0xa25c('0x12')]){if(_0x4598fd[_0xa25c('0x12')]['code']===0x1f4){logger['error'](_0xa25c('0xe'),_0x1055d7,_0x4598fd[_0xa25c('0x12')]['message']);return _0x3513fa(_0x4598fd[_0xa25c('0x12')][_0xa25c('0x13')]);}logger[_0xa25c('0x12')](_0xa25c('0xe'),_0x1055d7,_0x4598fd['error'][_0xa25c('0x13')]);return _0x3d3ba9(_0x4598fd[_0xa25c('0x12')]['message']);}else{logger[_0xa25c('0xd')](_0xa25c('0xe'),_0x1055d7,_0xa25c('0xf'));_0x3d3ba9(_0x4598fd[_0xa25c('0x14')][_0xa25c('0x13')]);}})[_0xa25c('0x15')](function(_0x33b726){logger['error'](_0xa25c('0xe'),_0x1055d7,_0x33b726);_0x3513fa(_0x33b726);});});}exports[_0xa25c('0x16')]=function(_0x216638){var _0x3cee14=this;return new Promise(function(_0x507a2c,_0x1b37aa){return db[_0xa25c('0x17')]['findAll']({'raw':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')][_0xa25c('0x19')]||null:null,'attributes':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['attributes']||null:null,'limit':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['limit']||null:null,'include':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')][_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x216638[_0xa25c('0x18')][_0xa25c('0x1a')],function(_0x37912e){return{'model':db[_0x37912e['model']],'as':_0x37912e['as'],'attributes':_0x37912e[_0xa25c('0x1c')],'include':_0x37912e[_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x37912e[_0xa25c('0x1a')],function(_0x1f8915){return{'model':db[_0x1f8915[_0xa25c('0x1d')]],'as':_0x1f8915['as'],'attributes':_0x1f8915['attributes'],'include':_0x1f8915[_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x1f8915[_0xa25c('0x1a')],function(_0x586a71){return{'model':db[_0x586a71[_0xa25c('0x1d')]],'as':_0x586a71['as'],'attributes':_0x586a71[_0xa25c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa25c('0xc')](function(_0x32321a){logger['info'](_0xa25c('0x16'),_0x216638);logger[_0xa25c('0x10')](_0xa25c('0x16'),_0x216638,JSON[_0xa25c('0x11')](_0x32321a));_0x507a2c(_0x32321a);})['catch'](function(_0x35069e){logger['error'](_0xa25c('0x16'),_0x35069e[_0xa25c('0x13')],_0x216638);_0x1b37aa(_0x3cee14['error'](0x1f4,_0x35069e[_0xa25c('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x3879ba){var _0x1367fa=this;return new Promise(function(_0x547bc5,_0xed8ba2){return db[_0xa25c('0x17')]['find']({'raw':_0x3879ba[_0xa25c('0x18')]?_0x3879ba[_0xa25c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3879ba[_0xa25c('0x18')]?_0x3879ba['options'][_0xa25c('0x19')]||null:null,'attributes':_0x3879ba[_0xa25c('0x18')]?_0x3879ba[_0xa25c('0x18')][_0xa25c('0x1c')]||null:null,'include':_0x3879ba['options']?_0x3879ba[_0xa25c('0x18')][_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x3879ba['options'][_0xa25c('0x1a')],function(_0x7accc3){return{'model':db[_0x7accc3[_0xa25c('0x1d')]],'as':_0x7accc3['as'],'attributes':_0x7accc3[_0xa25c('0x1c')],'include':_0x7accc3['include']?_[_0xa25c('0x1b')](_0x7accc3[_0xa25c('0x1a')],function(_0x20ae43){return{'model':db[_0x20ae43[_0xa25c('0x1d')]],'as':_0x20ae43['as'],'attributes':_0x20ae43[_0xa25c('0x1c')],'include':_0x20ae43['include']?_[_0xa25c('0x1b')](_0x20ae43[_0xa25c('0x1a')],function(_0x380cf2){return{'model':db[_0x380cf2[_0xa25c('0x1d')]],'as':_0x380cf2['as'],'attributes':_0x380cf2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa25c('0xc')](function(_0x58e823){logger[_0xa25c('0xd')]('ShowFreshdeskAccount',_0x3879ba);logger[_0xa25c('0x10')](_0xa25c('0x1e'),_0x3879ba,JSON['stringify'](_0x58e823));_0x547bc5(_0x58e823);})[_0xa25c('0x15')](function(_0x14d42f){logger[_0xa25c('0x12')](_0xa25c('0x1e'),_0x14d42f[_0xa25c('0x13')],_0x3879ba);_0xed8ba2(_0x1367fa[_0xa25c('0x12')](0x1f4,_0x14d42f[_0xa25c('0x13')]));});});}; \ No newline at end of file +var _0x8120=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FreshdeskAccount','options','raw','where','attributes','include','map','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','lodash','util'];(function(_0x262fc5,_0x153239){var _0x5f0535=function(_0x40ab30){while(--_0x40ab30){_0x262fc5['push'](_0x262fc5['shift']());}};_0x5f0535(++_0x153239);}(_0x8120,0x152));var _0x0812=function(_0x34663e,_0x46d4fd){_0x34663e=_0x34663e-0x0;var _0x57f235=_0x8120[_0x34663e];return _0x57f235;};'use strict';var _=require(_0x0812('0x0'));var util=require(_0x0812('0x1'));var moment=require(_0x0812('0x2'));var BPromise=require('bluebird');var rs=require(_0x0812('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0812('0x4'))['db'];var utils=require(_0x0812('0x5'));var logger=require(_0x0812('0x6'))(_0x0812('0x7'));var config=require(_0x0812('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0812('0x9')][_0x0812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fbf,_0x5f5467,_0x1ae5a4){return new BPromise(function(_0x360fc8,_0x553ae0){return client[_0x0812('0xb')](_0x5f2fbf,_0x1ae5a4)[_0x0812('0xc')](function(_0x289ecb){logger[_0x0812('0xd')](_0x0812('0xe'),_0x5f5467,_0x0812('0xf'));logger[_0x0812('0x10')](_0x0812('0x11'),_0x5f5467,_0x0812('0xf'),JSON[_0x0812('0x12')](_0x289ecb));if(_0x289ecb['error']){if(_0x289ecb[_0x0812('0x13')][_0x0812('0x14')]===0x1f4){logger[_0x0812('0x13')](_0x0812('0xe'),_0x5f5467,_0x289ecb[_0x0812('0x13')][_0x0812('0x15')]);return _0x553ae0(_0x289ecb[_0x0812('0x13')][_0x0812('0x15')]);}logger[_0x0812('0x13')](_0x0812('0xe'),_0x5f5467,_0x289ecb['error'][_0x0812('0x15')]);return _0x360fc8(_0x289ecb[_0x0812('0x13')][_0x0812('0x15')]);}else{logger['info'](_0x0812('0xe'),_0x5f5467,_0x0812('0xf'));_0x360fc8(_0x289ecb[_0x0812('0x16')][_0x0812('0x15')]);}})['catch'](function(_0x5ac313){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x5f5467,_0x5ac313);_0x553ae0(_0x5ac313);});});}exports['GetFreshdeskAccount']=function(_0x13d1e){var _0x4ce4b0=this;return new Promise(function(_0x56fffc,_0x8a67e){return db[_0x0812('0x17')]['findAll']({'raw':_0x13d1e[_0x0812('0x18')]?_0x13d1e[_0x0812('0x18')][_0x0812('0x19')]===undefined?!![]:![]:!![],'where':_0x13d1e[_0x0812('0x18')]?_0x13d1e[_0x0812('0x18')][_0x0812('0x1a')]||null:null,'attributes':_0x13d1e[_0x0812('0x18')]?_0x13d1e['options'][_0x0812('0x1b')]||null:null,'limit':_0x13d1e[_0x0812('0x18')]?_0x13d1e[_0x0812('0x18')]['limit']||null:null,'include':_0x13d1e[_0x0812('0x18')]?_0x13d1e[_0x0812('0x18')][_0x0812('0x1c')]?_[_0x0812('0x1d')](_0x13d1e['options'][_0x0812('0x1c')],function(_0x1689f1){return{'model':db[_0x1689f1[_0x0812('0x1e')]],'as':_0x1689f1['as'],'attributes':_0x1689f1['attributes'],'include':_0x1689f1[_0x0812('0x1c')]?_['map'](_0x1689f1[_0x0812('0x1c')],function(_0xf20862){return{'model':db[_0xf20862['model']],'as':_0xf20862['as'],'attributes':_0xf20862['attributes'],'include':_0xf20862[_0x0812('0x1c')]?_[_0x0812('0x1d')](_0xf20862[_0x0812('0x1c')],function(_0x5f00f3){return{'model':db[_0x5f00f3[_0x0812('0x1e')]],'as':_0x5f00f3['as'],'attributes':_0x5f00f3[_0x0812('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0812('0xc')](function(_0x97d2c8){logger[_0x0812('0xd')]('GetFreshdeskAccount',_0x13d1e);logger[_0x0812('0x10')](_0x0812('0x1f'),_0x13d1e,JSON[_0x0812('0x12')](_0x97d2c8));_0x56fffc(_0x97d2c8);})[_0x0812('0x20')](function(_0x317127){logger['error'](_0x0812('0x1f'),_0x317127[_0x0812('0x15')],_0x13d1e);_0x8a67e(_0x4ce4b0[_0x0812('0x13')](0x1f4,_0x317127[_0x0812('0x15')]));});});};exports[_0x0812('0x21')]=function(_0x4940c8){var _0x51cb97=this;return new Promise(function(_0x3c08f4,_0x385dcb){return db[_0x0812('0x17')]['find']({'raw':_0x4940c8[_0x0812('0x18')]?_0x4940c8[_0x0812('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4940c8[_0x0812('0x18')]?_0x4940c8[_0x0812('0x18')][_0x0812('0x1a')]||null:null,'attributes':_0x4940c8[_0x0812('0x18')]?_0x4940c8[_0x0812('0x18')][_0x0812('0x1b')]||null:null,'include':_0x4940c8[_0x0812('0x18')]?_0x4940c8[_0x0812('0x18')]['include']?_[_0x0812('0x1d')](_0x4940c8[_0x0812('0x18')][_0x0812('0x1c')],function(_0x2f214d){return{'model':db[_0x2f214d['model']],'as':_0x2f214d['as'],'attributes':_0x2f214d[_0x0812('0x1b')],'include':_0x2f214d[_0x0812('0x1c')]?_['map'](_0x2f214d[_0x0812('0x1c')],function(_0x5cedc6){return{'model':db[_0x5cedc6[_0x0812('0x1e')]],'as':_0x5cedc6['as'],'attributes':_0x5cedc6[_0x0812('0x1b')],'include':_0x5cedc6[_0x0812('0x1c')]?_[_0x0812('0x1d')](_0x5cedc6[_0x0812('0x1c')],function(_0x795f93){return{'model':db[_0x795f93[_0x0812('0x1e')]],'as':_0x795f93['as'],'attributes':_0x795f93[_0x0812('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0812('0xc')](function(_0x5c6871){logger[_0x0812('0xd')](_0x0812('0x21'),_0x4940c8);logger[_0x0812('0x10')](_0x0812('0x21'),_0x4940c8,JSON['stringify'](_0x5c6871));_0x3c08f4(_0x5c6871);})[_0x0812('0x20')](function(_0x13275a){logger[_0x0812('0x13')](_0x0812('0x21'),_0x13275a['message'],_0x4940c8);_0x385dcb(_0x51cb97['error'](0x1f4,_0x13275a[_0x0812('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index becf6bb..eee0560 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 _0x4d35=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0x4d35,0x66));var _0x54d3=function(_0x2e0e04,_0x232842){_0x2e0e04=_0x2e0e04-0x0;var _0x19dfad=_0x4d35[_0x2e0e04];return _0x19dfad;};'use strict';var multer=require(_0x54d3('0x0'));var util=require(_0x54d3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x54d3('0x2'));var router=express[_0x54d3('0x3')]();var fs_extra=require(_0x54d3('0x4'));var auth=require(_0x54d3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x54d3('0x6')]('/',auth[_0x54d3('0x7')](),controller[_0x54d3('0x8')]);router[_0x54d3('0x6')](_0x54d3('0x9'),auth[_0x54d3('0x7')](),controller['show']);router['get'](_0x54d3('0xa'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xb')]);router[_0x54d3('0x6')](_0x54d3('0xc'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xd')]);router['get'](_0x54d3('0xe'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xf')]);router[_0x54d3('0x6')]('/:id/tags',auth[_0x54d3('0x7')](),controller[_0x54d3('0x10')]);router[_0x54d3('0x11')]('/',auth[_0x54d3('0x7')](),controller[_0x54d3('0x12')]);router[_0x54d3('0x11')](_0x54d3('0x13'),auth[_0x54d3('0x7')](),controller['setTags']);router[_0x54d3('0x14')](_0x54d3('0x9'),auth[_0x54d3('0x7')](),controller[_0x54d3('0x15')]);router[_0x54d3('0x16')]('/:id',auth[_0x54d3('0x7')](),controller[_0x54d3('0x17')]);module[_0x54d3('0x18')]=router; \ No newline at end of file +var _0x0a16=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated'];(function(_0x2c98f5,_0x3505bd){var _0x1d5794=function(_0x4b511b){while(--_0x4b511b){_0x2c98f5['push'](_0x2c98f5['shift']());}};_0x1d5794(++_0x3505bd);}(_0x0a16,0x1cf));var _0x60a1=function(_0x356cb9,_0x3a34c6){_0x356cb9=_0x356cb9-0x0;var _0x301c66=_0x0a16[_0x356cb9];return _0x301c66;};'use strict';var multer=require(_0x60a1('0x0'));var util=require('util');var path=require(_0x60a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x60a1('0x2'));var router=express['Router']();var fs_extra=require(_0x60a1('0x3'));var auth=require(_0x60a1('0x4'));var interaction=require(_0x60a1('0x5'));var config=require(_0x60a1('0x6'));var controller=require(_0x60a1('0x7'));router[_0x60a1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x60a1('0x8')](_0x60a1('0x9'),auth['isAuthenticated'](),controller[_0x60a1('0xa')]);router[_0x60a1('0x8')](_0x60a1('0xb'),auth[_0x60a1('0xc')](),controller[_0x60a1('0xd')]);router[_0x60a1('0x8')](_0x60a1('0xe'),auth[_0x60a1('0xc')](),controller[_0x60a1('0xf')]);router[_0x60a1('0x8')](_0x60a1('0x10'),auth['isAuthenticated'](),controller[_0x60a1('0x11')]);router['get'](_0x60a1('0x12'),auth[_0x60a1('0xc')](),controller[_0x60a1('0x13')]);router[_0x60a1('0x14')]('/',auth[_0x60a1('0xc')](),controller[_0x60a1('0x15')]);router[_0x60a1('0x14')]('/:id/tags',auth[_0x60a1('0xc')](),controller[_0x60a1('0x16')]);router[_0x60a1('0x17')](_0x60a1('0x9'),auth[_0x60a1('0xc')](),controller[_0x60a1('0x18')]);router[_0x60a1('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x60a1('0x1a')]);module[_0x60a1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d4bb2ce..66b5369 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 _0xed6c=['STRING','sequelize','exports'];(function(_0x2e7a77,_0x11f7d8){var _0x331f44=function(_0x5577df){while(--_0x5577df){_0x2e7a77['push'](_0x2e7a77['shift']());}};_0x331f44(++_0x11f7d8);}(_0xed6c,0x106));var _0xced6=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xed6c[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0xced6('0x0'));module[_0xced6('0x1')]={'name':{'type':Sequelize[_0xced6('0x2')]},'description':{'type':Sequelize[_0xced6('0x2')]}}; \ No newline at end of file +var _0xbc97=['sequelize','exports','STRING'];(function(_0x31b92e,_0x9c9784){var _0x445d60=function(_0xb957dc){while(--_0xb957dc){_0x31b92e['push'](_0x31b92e['shift']());}};_0x445d60(++_0x9c9784);}(_0xbc97,0xf9));var _0x7bc9=function(_0x27e930,_0x4097f6){_0x27e930=_0x27e930-0x0;var _0x539c6e=_0xbc97[_0x27e930];return _0x539c6e;};'use strict';var Sequelize=require(_0x7bc9('0x0'));module[_0x7bc9('0x1')]={'name':{'type':Sequelize[_0x7bc9('0x2')]},'description':{'type':Sequelize[_0x7bc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 32db871..22e91a8 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 _0xed1a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','FreshdeskField','pick','nolimit','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis'];(function(_0x3f219e,_0x26be85){var _0xa486f7=function(_0x4e73ad){while(--_0x4e73ad){_0x3f219e['push'](_0x3f219e['shift']());}};_0xa486f7(++_0x26be85);}(_0xed1a,0x91));var _0xaed1=function(_0x1e6773,_0x138124){_0x1e6773=_0x1e6773-0x0;var _0x4c81a0=_0xed1a[_0x1e6773];return _0x4c81a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaed1('0x0'));var zipdir=require(_0xaed1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaed1('0x2'));var moment=require(_0xaed1('0x3'));var BPromise=require(_0xaed1('0x4'));var Mustache=require(_0xaed1('0x5'));var util=require(_0xaed1('0x6'));var path=require('path');var sox=require(_0xaed1('0x7'));var csv=require(_0xaed1('0x8'));var ejs=require(_0xaed1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaed1('0xa'));var squel=require(_0xaed1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaed1('0xc'));var toCsv=require(_0xaed1('0x8'));var querystring=require(_0xaed1('0xd'));var Papa=require('papaparse');var Redis=require(_0xaed1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaed1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaed1('0x10'));var logger=require(_0xaed1('0x11'))(_0xaed1('0x12'));var utils=require(_0xaed1('0x13'));var config=require(_0xaed1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52ff62,_0x121b34){_0x121b34=_0x121b34||0xcc;return function(_0x518174){if(_0x518174){return _0x52ff62[_0xaed1('0x15')](_0x121b34);}return _0x52ff62[_0xaed1('0x16')](_0x121b34)[_0xaed1('0x17')]();};}function respondWithResult(_0x560936,_0x210948){_0x210948=_0x210948||0xc8;return function(_0x57aefc){if(_0x57aefc){return _0x560936['status'](_0x210948)[_0xaed1('0x18')](_0x57aefc);}};}function respondWithFilteredResult(_0x28eaaf,_0x41d3b7){return function(_0x1bfe4e){if(_0x1bfe4e){var _0x284762=typeof _0x41d3b7[_0xaed1('0x19')]==='undefined'&&typeof _0x41d3b7[_0xaed1('0x1a')]==='undefined';var _0x20097b=_0x1bfe4e[_0xaed1('0x1b')];var _0xdb1308=_0x284762?0x0:_0x41d3b7[_0xaed1('0x19')];var _0x26fe50=_0x284762?_0x1bfe4e[_0xaed1('0x1b')]:_0x41d3b7['offset']+_0x41d3b7[_0xaed1('0x1a')];var _0x4903ba;if(_0x26fe50>=_0x20097b){_0x26fe50=_0x20097b;_0x4903ba=0xc8;}else{_0x4903ba=0xce;}_0x28eaaf[_0xaed1('0x16')](_0x4903ba);return _0x28eaaf[_0xaed1('0x1c')](_0xaed1('0x1d'),_0xdb1308+'-'+_0x26fe50+'/'+_0x20097b)[_0xaed1('0x18')](_0x1bfe4e);}return null;};}function patchUpdates(_0xe561b9){return function(_0x34a1f6){try{jsonpatch[_0xaed1('0x1e')](_0x34a1f6,_0xe561b9,!![]);}catch(_0x4e0b9b){return BPromise['reject'](_0x4e0b9b);}return _0x34a1f6['save']();};}function saveUpdates(_0x35a9bd,_0x385467){return function(_0x244bb3){if(_0x244bb3){return _0x244bb3[_0xaed1('0x1f')](_0x35a9bd)[_0xaed1('0x20')](function(_0x5a6e0b){return _0x5a6e0b;});}return null;};}function removeEntity(_0x22bac8,_0x22ba25){return function(_0x5168d3){if(_0x5168d3){return _0x5168d3[_0xaed1('0x21')]()['then'](function(){_0x22bac8[_0xaed1('0x16')](0xcc)[_0xaed1('0x17')]();});}};}function handleEntityNotFound(_0x2c31b9,_0x44c75f){return function(_0x4d6f63){if(!_0x4d6f63){_0x2c31b9['sendStatus'](0x194);}return _0x4d6f63;};}function handleError(_0xa13460,_0x171f8d){_0x171f8d=_0x171f8d||0x1f4;return function(_0x367c2c){logger[_0xaed1('0x22')](_0x367c2c['stack']);if(_0x367c2c['name']){delete _0x367c2c[_0xaed1('0x23')];}_0xa13460['status'](_0x171f8d)[_0xaed1('0x24')](_0x367c2c);};}exports[_0xaed1('0x25')]=function(_0x4b15be,_0x588e62){var _0x3151a7={},_0x34a383={},_0x1f3190={'count':0x0,'rows':[]};var _0x41c268=_[_0xaed1('0x26')](db[_0xaed1('0x27')][_0xaed1('0x28')],function(_0x475d13){return{'name':_0x475d13[_0xaed1('0x29')],'type':_0x475d13[_0xaed1('0x2a')][_0xaed1('0x2b')]};});_0x34a383[_0xaed1('0x2c')]=_['map'](_0x41c268,_0xaed1('0x23'));_0x34a383[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x4b15be[_0xaed1('0x2d')]);_0x34a383[_0xaed1('0x2f')]=_['intersection'](_0x34a383[_0xaed1('0x2c')],_0x34a383['query']);_0x3151a7[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x34a383[_0xaed1('0x2c')],qs['fields'](_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x3151a7[_0xaed1('0x30')]=_0x3151a7[_0xaed1('0x30')]['length']?_0x3151a7[_0xaed1('0x30')]:_0x34a383[_0xaed1('0x2c')];if(!_0x4b15be['query']['hasOwnProperty']('nolimit')){_0x3151a7[_0xaed1('0x1a')]=qs['limit'](_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x3151a7[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x4b15be['query'][_0xaed1('0x19')]);}_0x3151a7[_0xaed1('0x33')]=qs[_0xaed1('0x34')](_0x4b15be['query'][_0xaed1('0x34')]);_0x3151a7[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_['pick'](_0x4b15be['query'],_0x34a383[_0xaed1('0x2f')]),_0x41c268);if(_0x4b15be[_0xaed1('0x2d')]['filter']){_0x3151a7['where']=_[_0xaed1('0x36')](_0x3151a7[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x41c268,function(_0x35d00e){if(_0x35d00e[_0xaed1('0x2a')]!==_0xaed1('0x37')){var _0x16dc5f={};_0x16dc5f[_0x35d00e[_0xaed1('0x23')]]={'$like':'%'+_0x4b15be['query'][_0xaed1('0x38')]+'%'};return _0x16dc5f;}})});}_0x3151a7=_[_0xaed1('0x36')]({},_0x3151a7,_0x4b15be[_0xaed1('0x39')]);var _0x568c22={'where':_0x3151a7[_0xaed1('0x35')]};return db[_0xaed1('0x27')]['count'](_0x568c22)[_0xaed1('0x20')](function(_0x30f15d){_0x1f3190['count']=_0x30f15d;if(_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x3a')]){_0x3151a7[_0xaed1('0x3b')]=[{'all':!![]}];}return db[_0xaed1('0x27')][_0xaed1('0x3c')](_0x3151a7);})[_0xaed1('0x20')](function(_0x35f5b8){_0x1f3190['rows']=_0x35f5b8;return _0x1f3190;})['then'](respondWithFilteredResult(_0x588e62,_0x3151a7))[_0xaed1('0x3d')](handleError(_0x588e62,null));};exports[_0xaed1('0x3e')]=function(_0x571576,_0x11f038){var _0x549e6a={'raw':![],'where':{'id':_0x571576[_0xaed1('0x3f')]['id']}},_0x5da5ba={};_0x5da5ba[_0xaed1('0x2c')]=_[_0xaed1('0x2e')](db[_0xaed1('0x27')]['rawAttributes']);_0x5da5ba[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x571576[_0xaed1('0x2d')]);_0x5da5ba[_0xaed1('0x2f')]=_[_0xaed1('0x31')](_0x5da5ba['model'],_0x5da5ba[_0xaed1('0x2d')]);_0x549e6a[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x5da5ba[_0xaed1('0x2c')],qs['fields'](_0x571576[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x549e6a[_0xaed1('0x30')]=_0x549e6a['attributes'][_0xaed1('0x40')]?_0x549e6a[_0xaed1('0x30')]:_0x5da5ba['model'];if(_0x571576[_0xaed1('0x2d')]['includeAll']){_0x549e6a['include']=[{'all':!![]}];}_0x549e6a=_['merge']({},_0x549e6a,_0x571576[_0xaed1('0x39')]);return db[_0xaed1('0x27')]['find'](_0x549e6a)[_0xaed1('0x20')](handleEntityNotFound(_0x11f038,null))[_0xaed1('0x20')](respondWithResult(_0x11f038,null))['catch'](handleError(_0x11f038,null));};exports[_0xaed1('0x41')]=function(_0x51133f,_0x6f9386){return db[_0xaed1('0x27')]['create'](_0x51133f[_0xaed1('0x42')],{})[_0xaed1('0x20')](respondWithResult(_0x6f9386,0xc9))[_0xaed1('0x3d')](handleError(_0x6f9386,null));};exports[_0xaed1('0x1f')]=function(_0x12fb4a,_0x5b897b){if(_0x12fb4a[_0xaed1('0x42')]['id']){delete _0x12fb4a[_0xaed1('0x42')]['id'];}return db[_0xaed1('0x27')]['find']({'where':{'id':_0x12fb4a['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x5b897b,null))[_0xaed1('0x20')](saveUpdates(_0x12fb4a[_0xaed1('0x42')],null))['then'](respondWithResult(_0x5b897b,null))[_0xaed1('0x3d')](handleError(_0x5b897b,null));};exports[_0xaed1('0x21')]=function(_0x130e39,_0x3fd6a5){return db['FreshdeskConfiguration'][_0xaed1('0x43')]({'where':{'id':_0x130e39[_0xaed1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3fd6a5,null))[_0xaed1('0x20')](removeEntity(_0x3fd6a5,null))[_0xaed1('0x3d')](handleError(_0x3fd6a5,null));};exports[_0xaed1('0x44')]=function(_0x687d26,_0x445bcf,_0xeb9154){var _0x3aae93={};var _0x47d945={};var _0x17d2a2;var _0x384979;return db['FreshdeskConfiguration'][_0xaed1('0x45')]({'where':{'id':_0x687d26['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x445bcf,null))[_0xaed1('0x20')](function(_0x15d986){if(_0x15d986){_0x17d2a2=_0x15d986;_0x47d945[_0xaed1('0x2c')]=_['keys'](db['FreshdeskField'][_0xaed1('0x28')]);_0x47d945[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x687d26[_0xaed1('0x2d')]);_0x47d945['filters']=_[_0xaed1('0x31')](_0x47d945['model'],_0x47d945[_0xaed1('0x2d')]);_0x3aae93['attributes']=_[_0xaed1('0x31')](_0x47d945[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x687d26[_0xaed1('0x2d')]['fields']));_0x3aae93['attributes']=_0x3aae93['attributes'][_0xaed1('0x40')]?_0x3aae93[_0xaed1('0x30')]:_0x47d945[_0xaed1('0x2c')];_0x3aae93[_0xaed1('0x33')]=qs['sort'](_0x687d26[_0xaed1('0x2d')][_0xaed1('0x34')]);_0x3aae93[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_['pick'](_0x687d26[_0xaed1('0x2d')],_0x47d945[_0xaed1('0x2f')]));if(_0x687d26[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x3aae93[_0xaed1('0x35')]=_[_0xaed1('0x36')](_0x3aae93[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x3aae93[_0xaed1('0x30')],function(_0x5153f2){var _0x5707d8={};_0x5707d8[_0x5153f2]={'$like':'%'+_0x687d26[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x5707d8;})});}_0x3aae93=_['merge']({},_0x3aae93,_0x687d26[_0xaed1('0x39')]);return _0x17d2a2['getFields'](_0x3aae93);}})[_0xaed1('0x20')](function(_0x435d0e){if(_0x435d0e){_0x384979=_0x435d0e['length'];if(!_0x687d26[_0xaed1('0x2d')][_0xaed1('0x46')]('nolimit')){_0x3aae93[_0xaed1('0x1a')]=qs[_0xaed1('0x1a')](_0x687d26[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x3aae93[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x687d26['query'][_0xaed1('0x19')]);}return _0x17d2a2[_0xaed1('0x44')](_0x3aae93);}})[_0xaed1('0x20')](function(_0xafc980){if(_0xafc980){return _0xafc980?{'count':_0x384979,'rows':_0xafc980}:null;}})[_0xaed1('0x20')](respondWithResult(_0x445bcf,null))[_0xaed1('0x3d')](handleError(_0x445bcf,null));};exports[_0xaed1('0x47')]=function(_0x2bc779,_0x55d79,_0x2c9f66){var _0x44ad79={};var _0x5cd0d6={};var _0x3220ea;var _0x4e477b;return db[_0xaed1('0x27')][_0xaed1('0x45')]({'where':{'id':_0x2bc779[_0xaed1('0x3f')]['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x55d79,null))[_0xaed1('0x20')](function(_0x3ac395){if(_0x3ac395){_0x3220ea=_0x3ac395;_0x5cd0d6[_0xaed1('0x2c')]=_[_0xaed1('0x2e')](db[_0xaed1('0x48')][_0xaed1('0x28')]);_0x5cd0d6[_0xaed1('0x2d')]=_['keys'](_0x2bc779[_0xaed1('0x2d')]);_0x5cd0d6[_0xaed1('0x2f')]=_['intersection'](_0x5cd0d6[_0xaed1('0x2c')],_0x5cd0d6['query']);_0x44ad79[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x5cd0d6[_0xaed1('0x2c')],qs['fields'](_0x2bc779[_0xaed1('0x2d')]['fields']));_0x44ad79['attributes']=_0x44ad79[_0xaed1('0x30')][_0xaed1('0x40')]?_0x44ad79[_0xaed1('0x30')]:_0x5cd0d6[_0xaed1('0x2c')];_0x44ad79['order']=qs[_0xaed1('0x34')](_0x2bc779[_0xaed1('0x2d')]['sort']);_0x44ad79[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_[_0xaed1('0x49')](_0x2bc779[_0xaed1('0x2d')],_0x5cd0d6[_0xaed1('0x2f')]));if(_0x2bc779['query']['filter']){_0x44ad79[_0xaed1('0x35')]=_[_0xaed1('0x36')](_0x44ad79[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x44ad79[_0xaed1('0x30')],function(_0x22d8d3){var _0x139cfb={};_0x139cfb[_0x22d8d3]={'$like':'%'+_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x139cfb;})});}_0x44ad79=_[_0xaed1('0x36')]({},_0x44ad79,_0x2bc779[_0xaed1('0x39')]);return _0x3220ea['getSubjects'](_0x44ad79);}})[_0xaed1('0x20')](function(_0x328475){if(_0x328475){_0x4e477b=_0x328475[_0xaed1('0x40')];if(!_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x44ad79[_0xaed1('0x1a')]=qs['limit'](_0x2bc779[_0xaed1('0x2d')]['limit']);_0x44ad79[_0xaed1('0x19')]=qs['offset'](_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x19')]);}return _0x3220ea[_0xaed1('0x47')](_0x44ad79);}})[_0xaed1('0x20')](function(_0x30282f){if(_0x30282f){return _0x30282f?{'count':_0x4e477b,'rows':_0x30282f}:null;}})[_0xaed1('0x20')](respondWithResult(_0x55d79,null))['catch'](handleError(_0x55d79,null));};exports[_0xaed1('0x4b')]=function(_0x2ef006,_0x518da9,_0x4e39bb){var _0x548fcc={};var _0x54a251={};var _0x25c2d7;var _0x21338a;return db[_0xaed1('0x27')]['findOne']({'where':{'id':_0x2ef006['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x518da9,null))[_0xaed1('0x20')](function(_0x781da1){if(_0x781da1){_0x25c2d7=_0x781da1;_0x54a251[_0xaed1('0x2c')]=_['keys'](db[_0xaed1('0x48')]['rawAttributes']);_0x54a251['query']=_[_0xaed1('0x2e')](_0x2ef006[_0xaed1('0x2d')]);_0x54a251['filters']=_[_0xaed1('0x31')](_0x54a251['model'],_0x54a251['query']);_0x548fcc[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x54a251[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x2ef006[_0xaed1('0x2d')]['fields']));_0x548fcc['attributes']=_0x548fcc[_0xaed1('0x30')]['length']?_0x548fcc['attributes']:_0x54a251[_0xaed1('0x2c')];_0x548fcc[_0xaed1('0x33')]=qs[_0xaed1('0x34')](_0x2ef006['query'][_0xaed1('0x34')]);_0x548fcc[_0xaed1('0x35')]=qs['filters'](_[_0xaed1('0x49')](_0x2ef006[_0xaed1('0x2d')],_0x54a251[_0xaed1('0x2f')]));if(_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x548fcc[_0xaed1('0x35')]=_['merge'](_0x548fcc['where'],{'$or':_[_0xaed1('0x26')](_0x548fcc[_0xaed1('0x30')],function(_0x9e01fe){var _0x6ff006={};_0x6ff006[_0x9e01fe]={'$like':'%'+_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x6ff006;})});}_0x548fcc=_['merge']({},_0x548fcc,_0x2ef006[_0xaed1('0x39')]);return _0x25c2d7[_0xaed1('0x4b')](_0x548fcc);}})['then'](function(_0x117095){if(_0x117095){_0x21338a=_0x117095['length'];if(!_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x548fcc[_0xaed1('0x1a')]=qs['limit'](_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x548fcc[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x2ef006['query']['offset']);}return _0x25c2d7[_0xaed1('0x4b')](_0x548fcc);}})[_0xaed1('0x20')](function(_0x22bfd1){if(_0x22bfd1){return _0x22bfd1?{'count':_0x21338a,'rows':_0x22bfd1}:null;}})[_0xaed1('0x20')](respondWithResult(_0x518da9,null))[_0xaed1('0x3d')](handleError(_0x518da9,null));};exports[_0xaed1('0x4c')]=function(_0x2b6332,_0x43534b,_0x53316a){var _0x370055={};var _0xca32dd={};var _0x1c579e;var _0x850c9;return db['FreshdeskConfiguration'][_0xaed1('0x45')]({'where':{'id':_0x2b6332['params']['id']}})['then'](handleEntityNotFound(_0x43534b,null))[_0xaed1('0x20')](function(_0x272784){if(_0x272784){_0x1c579e=_0x272784;_0xca32dd['model']=_[_0xaed1('0x2e')](db[_0xaed1('0x4d')][_0xaed1('0x28')]);_0xca32dd['query']=_[_0xaed1('0x2e')](_0x2b6332[_0xaed1('0x2d')]);_0xca32dd[_0xaed1('0x2f')]=_[_0xaed1('0x31')](_0xca32dd[_0xaed1('0x2c')],_0xca32dd['query']);_0x370055[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0xca32dd[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x370055[_0xaed1('0x30')]=_0x370055[_0xaed1('0x30')][_0xaed1('0x40')]?_0x370055[_0xaed1('0x30')]:_0xca32dd[_0xaed1('0x2c')];_0x370055['order']=qs['sort'](_0x2b6332[_0xaed1('0x2d')]['sort']);_0x370055[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_[_0xaed1('0x49')](_0x2b6332[_0xaed1('0x2d')],_0xca32dd[_0xaed1('0x2f')]));if(_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x370055['where']=_[_0xaed1('0x36')](_0x370055[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x370055[_0xaed1('0x30')],function(_0x422219){var _0x3cdd38={};_0x3cdd38[_0x422219]={'$like':'%'+_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x3cdd38;})});}_0x370055=_[_0xaed1('0x36')]({},_0x370055,_0x2b6332[_0xaed1('0x39')]);return _0x1c579e['getTags'](_0x370055);}})['then'](function(_0x4bf66a){if(_0x4bf66a){_0x850c9=_0x4bf66a[_0xaed1('0x40')];if(!_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x370055[_0xaed1('0x1a')]=qs[_0xaed1('0x1a')](_0x2b6332['query'][_0xaed1('0x1a')]);_0x370055[_0xaed1('0x19')]=qs['offset'](_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x19')]);}return _0x1c579e['getTags'](_0x370055);}})['then'](function(_0x4f879a){if(_0x4f879a){return _0x4f879a?{'count':_0x850c9,'rows':_0x4f879a}:null;}})[_0xaed1('0x20')](respondWithResult(_0x43534b,null))[_0xaed1('0x3d')](handleError(_0x43534b,null));};exports[_0xaed1('0x4e')]=function(_0x173f71,_0x12bf84,_0x3a40e5){if(_0x173f71['body']['id']){delete _0x173f71[_0xaed1('0x42')]['id'];}return db[_0xaed1('0x27')][_0xaed1('0x45')]({'where':{'id':_0x173f71[_0xaed1('0x3f')]['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x12bf84,null))[_0xaed1('0x20')](function(_0x2f467c){if(_0x2f467c){return _0x2f467c[_0xaed1('0x4e')](_0x173f71['body'][_0xaed1('0x4f')]||[]);}return null;})[_0xaed1('0x20')](respondWithResult(_0x12bf84,null))[_0xaed1('0x3d')](handleError(_0x12bf84,null));}; \ No newline at end of file +var _0x1750=['include','merge','create','body','find','findOne','FreshdeskField','order','filter','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','options','FreshdeskConfiguration','includeAll','findAll','catch','show','params','intersection'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1750,0xb6));var _0x0175=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x1750[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require(_0x0175('0x0'));var rimraf=require(_0x0175('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0175('0x2'));var rp=require('request-promise');var moment=require(_0x0175('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0175('0x4'));var util=require(_0x0175('0x5'));var path=require('path');var sox=require(_0x0175('0x6'));var csv=require(_0x0175('0x7'));var ejs=require(_0x0175('0x8'));var fs=require('fs');var fs_extra=require(_0x0175('0x9'));var _=require(_0x0175('0xa'));var squel=require('squel');var crypto=require(_0x0175('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0175('0xc'));var toCsv=require(_0x0175('0x7'));var querystring=require(_0x0175('0xd'));var Papa=require(_0x0175('0xe'));var Redis=require(_0x0175('0xf'));var authService=require(_0x0175('0x10'));var qs=require(_0x0175('0x11'));var as=require(_0x0175('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0175('0x13'))(_0x0175('0x14'));var utils=require(_0x0175('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0175('0x16'));var db=require(_0x0175('0x17'))['db'];function respondWithStatusCode(_0x109d39,_0x5674f3){_0x5674f3=_0x5674f3||0xcc;return function(_0x5e4376){if(_0x5e4376){return _0x109d39['sendStatus'](_0x5674f3);}return _0x109d39[_0x0175('0x18')](_0x5674f3)[_0x0175('0x19')]();};}function respondWithResult(_0x22c4e3,_0x35193b){_0x35193b=_0x35193b||0xc8;return function(_0x55f60b){if(_0x55f60b){return _0x22c4e3[_0x0175('0x18')](_0x35193b)[_0x0175('0x1a')](_0x55f60b);}};}function respondWithFilteredResult(_0x492807,_0x4148c8){return function(_0x74e553){if(_0x74e553){var _0x32436d=typeof _0x4148c8[_0x0175('0x1b')]==='undefined'&&typeof _0x4148c8['limit']==='undefined';var _0x10b8e0=_0x74e553[_0x0175('0x1c')];var _0x5e305a=_0x32436d?0x0:_0x4148c8[_0x0175('0x1b')];var _0xaa5013=_0x32436d?_0x74e553[_0x0175('0x1c')]:_0x4148c8[_0x0175('0x1b')]+_0x4148c8[_0x0175('0x1d')];var _0x4215e5;if(_0xaa5013>=_0x10b8e0){_0xaa5013=_0x10b8e0;_0x4215e5=0xc8;}else{_0x4215e5=0xce;}_0x492807['status'](_0x4215e5);return _0x492807[_0x0175('0x1e')](_0x0175('0x1f'),_0x5e305a+'-'+_0xaa5013+'/'+_0x10b8e0)[_0x0175('0x1a')](_0x74e553);}return null;};}function patchUpdates(_0x29d960){return function(_0x524071){try{jsonpatch[_0x0175('0x20')](_0x524071,_0x29d960,!![]);}catch(_0x5f6f63){return BPromise['reject'](_0x5f6f63);}return _0x524071['save']();};}function saveUpdates(_0x46c502,_0x2e83e0){return function(_0x4d45ce){if(_0x4d45ce){return _0x4d45ce[_0x0175('0x21')](_0x46c502)['then'](function(_0x5e1b89){return _0x5e1b89;});}return null;};}function removeEntity(_0x5591ee,_0x2e6848){return function(_0x25a7a9){if(_0x25a7a9){return _0x25a7a9[_0x0175('0x22')]()[_0x0175('0x23')](function(){_0x5591ee[_0x0175('0x18')](0xcc)[_0x0175('0x19')]();});}};}function handleEntityNotFound(_0x246c74,_0x3382c9){return function(_0x2894f4){if(!_0x2894f4){_0x246c74[_0x0175('0x24')](0x194);}return _0x2894f4;};}function handleError(_0x3fc897,_0x546575){_0x546575=_0x546575||0x1f4;return function(_0x3060a9){logger[_0x0175('0x25')](_0x3060a9[_0x0175('0x26')]);if(_0x3060a9[_0x0175('0x27')]){delete _0x3060a9[_0x0175('0x27')];}_0x3fc897[_0x0175('0x18')](_0x546575)[_0x0175('0x28')](_0x3060a9);};}exports[_0x0175('0x29')]=function(_0x21b407,_0x319c2c){var _0x584f2b={},_0x14ff28={},_0xb2253={'count':0x0,'rows':[]};var _0x2cf7c9=_['map'](db['FreshdeskConfiguration'][_0x0175('0x2a')],function(_0x5f3e57){return{'name':_0x5f3e57['fieldName'],'type':_0x5f3e57[_0x0175('0x2b')][_0x0175('0x2c')]};});_0x14ff28[_0x0175('0x2d')]=_[_0x0175('0x2e')](_0x2cf7c9,_0x0175('0x27'));_0x14ff28['query']=_[_0x0175('0x2f')](_0x21b407[_0x0175('0x30')]);_0x14ff28[_0x0175('0x31')]=_['intersection'](_0x14ff28['model'],_0x14ff28[_0x0175('0x30')]);_0x584f2b[_0x0175('0x32')]=_['intersection'](_0x14ff28[_0x0175('0x2d')],qs[_0x0175('0x33')](_0x21b407[_0x0175('0x30')][_0x0175('0x33')]));_0x584f2b[_0x0175('0x32')]=_0x584f2b[_0x0175('0x32')][_0x0175('0x34')]?_0x584f2b[_0x0175('0x32')]:_0x14ff28[_0x0175('0x2d')];if(!_0x21b407[_0x0175('0x30')][_0x0175('0x35')](_0x0175('0x36'))){_0x584f2b[_0x0175('0x1d')]=qs[_0x0175('0x1d')](_0x21b407[_0x0175('0x30')][_0x0175('0x1d')]);_0x584f2b['offset']=qs[_0x0175('0x1b')](_0x21b407[_0x0175('0x30')][_0x0175('0x1b')]);}_0x584f2b['order']=qs[_0x0175('0x37')](_0x21b407['query']['sort']);_0x584f2b[_0x0175('0x38')]=qs['filters'](_[_0x0175('0x39')](_0x21b407[_0x0175('0x30')],_0x14ff28[_0x0175('0x31')]),_0x2cf7c9);if(_0x21b407['query']['filter']){_0x584f2b[_0x0175('0x38')]=_['merge'](_0x584f2b[_0x0175('0x38')],{'$or':_['map'](_0x2cf7c9,function(_0x1be0b6){if(_0x1be0b6[_0x0175('0x2b')]!==_0x0175('0x3a')){var _0x236cfe={};_0x236cfe[_0x1be0b6['name']]={'$like':'%'+_0x21b407[_0x0175('0x30')]['filter']+'%'};return _0x236cfe;}})});}_0x584f2b=_['merge']({},_0x584f2b,_0x21b407[_0x0175('0x3b')]);var _0x12074a={'where':_0x584f2b['where']};return db[_0x0175('0x3c')][_0x0175('0x1c')](_0x12074a)[_0x0175('0x23')](function(_0x5f57f7){_0xb2253['count']=_0x5f57f7;if(_0x21b407[_0x0175('0x30')][_0x0175('0x3d')]){_0x584f2b['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0175('0x3e')](_0x584f2b);})[_0x0175('0x23')](function(_0x57f1c7){_0xb2253['rows']=_0x57f1c7;return _0xb2253;})[_0x0175('0x23')](respondWithFilteredResult(_0x319c2c,_0x584f2b))[_0x0175('0x3f')](handleError(_0x319c2c,null));};exports[_0x0175('0x40')]=function(_0x5253ae,_0x510b94){var _0x3b9806={'raw':![],'where':{'id':_0x5253ae[_0x0175('0x41')]['id']}},_0x4bdf7c={};_0x4bdf7c['model']=_[_0x0175('0x2f')](db[_0x0175('0x3c')]['rawAttributes']);_0x4bdf7c['query']=_[_0x0175('0x2f')](_0x5253ae[_0x0175('0x30')]);_0x4bdf7c[_0x0175('0x31')]=_['intersection'](_0x4bdf7c['model'],_0x4bdf7c[_0x0175('0x30')]);_0x3b9806[_0x0175('0x32')]=_[_0x0175('0x42')](_0x4bdf7c[_0x0175('0x2d')],qs[_0x0175('0x33')](_0x5253ae['query'][_0x0175('0x33')]));_0x3b9806['attributes']=_0x3b9806[_0x0175('0x32')][_0x0175('0x34')]?_0x3b9806[_0x0175('0x32')]:_0x4bdf7c[_0x0175('0x2d')];if(_0x5253ae[_0x0175('0x30')]['includeAll']){_0x3b9806[_0x0175('0x43')]=[{'all':!![]}];}_0x3b9806=_[_0x0175('0x44')]({},_0x3b9806,_0x5253ae[_0x0175('0x3b')]);return db[_0x0175('0x3c')]['find'](_0x3b9806)[_0x0175('0x23')](handleEntityNotFound(_0x510b94,null))[_0x0175('0x23')](respondWithResult(_0x510b94,null))[_0x0175('0x3f')](handleError(_0x510b94,null));};exports[_0x0175('0x45')]=function(_0x3544af,_0x51ed91){return db[_0x0175('0x3c')]['create'](_0x3544af['body'],{})[_0x0175('0x23')](respondWithResult(_0x51ed91,0xc9))['catch'](handleError(_0x51ed91,null));};exports[_0x0175('0x21')]=function(_0x1e47ee,_0x55e455){if(_0x1e47ee[_0x0175('0x46')]['id']){delete _0x1e47ee[_0x0175('0x46')]['id'];}return db[_0x0175('0x3c')][_0x0175('0x47')]({'where':{'id':_0x1e47ee['params']['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x55e455,null))[_0x0175('0x23')](saveUpdates(_0x1e47ee[_0x0175('0x46')],null))['then'](respondWithResult(_0x55e455,null))[_0x0175('0x3f')](handleError(_0x55e455,null));};exports['destroy']=function(_0x34e045,_0x4d79c0){return db[_0x0175('0x3c')]['find']({'where':{'id':_0x34e045[_0x0175('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d79c0,null))[_0x0175('0x23')](removeEntity(_0x4d79c0,null))[_0x0175('0x3f')](handleError(_0x4d79c0,null));};exports['getFields']=function(_0x862eb9,_0x18d086,_0x4ada31){var _0x12d07e={};var _0x4f4b2d={};var _0x21f860;var _0x67231e;return db[_0x0175('0x3c')][_0x0175('0x48')]({'where':{'id':_0x862eb9[_0x0175('0x41')]['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x18d086,null))['then'](function(_0x2c55b3){if(_0x2c55b3){_0x21f860=_0x2c55b3;_0x4f4b2d[_0x0175('0x2d')]=_['keys'](db[_0x0175('0x49')]['rawAttributes']);_0x4f4b2d['query']=_[_0x0175('0x2f')](_0x862eb9[_0x0175('0x30')]);_0x4f4b2d[_0x0175('0x31')]=_[_0x0175('0x42')](_0x4f4b2d[_0x0175('0x2d')],_0x4f4b2d[_0x0175('0x30')]);_0x12d07e['attributes']=_[_0x0175('0x42')](_0x4f4b2d['model'],qs[_0x0175('0x33')](_0x862eb9[_0x0175('0x30')][_0x0175('0x33')]));_0x12d07e[_0x0175('0x32')]=_0x12d07e[_0x0175('0x32')][_0x0175('0x34')]?_0x12d07e['attributes']:_0x4f4b2d[_0x0175('0x2d')];_0x12d07e[_0x0175('0x4a')]=qs['sort'](_0x862eb9['query'][_0x0175('0x37')]);_0x12d07e[_0x0175('0x38')]=qs[_0x0175('0x31')](_[_0x0175('0x39')](_0x862eb9[_0x0175('0x30')],_0x4f4b2d[_0x0175('0x31')]));if(_0x862eb9[_0x0175('0x30')][_0x0175('0x4b')]){_0x12d07e[_0x0175('0x38')]=_[_0x0175('0x44')](_0x12d07e[_0x0175('0x38')],{'$or':_['map'](_0x12d07e[_0x0175('0x32')],function(_0xa4490e){var _0x50de01={};_0x50de01[_0xa4490e]={'$like':'%'+_0x862eb9['query'][_0x0175('0x4b')]+'%'};return _0x50de01;})});}_0x12d07e=_[_0x0175('0x44')]({},_0x12d07e,_0x862eb9[_0x0175('0x3b')]);return _0x21f860[_0x0175('0x4c')](_0x12d07e);}})['then'](function(_0x960880){if(_0x960880){_0x67231e=_0x960880['length'];if(!_0x862eb9[_0x0175('0x30')][_0x0175('0x35')](_0x0175('0x36'))){_0x12d07e['limit']=qs[_0x0175('0x1d')](_0x862eb9['query'][_0x0175('0x1d')]);_0x12d07e['offset']=qs[_0x0175('0x1b')](_0x862eb9[_0x0175('0x30')][_0x0175('0x1b')]);}return _0x21f860['getFields'](_0x12d07e);}})[_0x0175('0x23')](function(_0x2c10cf){if(_0x2c10cf){return _0x2c10cf?{'count':_0x67231e,'rows':_0x2c10cf}:null;}})[_0x0175('0x23')](respondWithResult(_0x18d086,null))[_0x0175('0x3f')](handleError(_0x18d086,null));};exports['getSubjects']=function(_0x581db6,_0x329107,_0x267e89){var _0x2cae30={};var _0x5ae63a={};var _0xe6996d;var _0x1ac56e;return db[_0x0175('0x3c')][_0x0175('0x48')]({'where':{'id':_0x581db6['params']['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x329107,null))['then'](function(_0x1ff5ab){if(_0x1ff5ab){_0xe6996d=_0x1ff5ab;_0x5ae63a[_0x0175('0x2d')]=_[_0x0175('0x2f')](db[_0x0175('0x49')][_0x0175('0x2a')]);_0x5ae63a[_0x0175('0x30')]=_[_0x0175('0x2f')](_0x581db6[_0x0175('0x30')]);_0x5ae63a[_0x0175('0x31')]=_[_0x0175('0x42')](_0x5ae63a[_0x0175('0x2d')],_0x5ae63a[_0x0175('0x30')]);_0x2cae30[_0x0175('0x32')]=_[_0x0175('0x42')](_0x5ae63a['model'],qs[_0x0175('0x33')](_0x581db6[_0x0175('0x30')][_0x0175('0x33')]));_0x2cae30['attributes']=_0x2cae30[_0x0175('0x32')][_0x0175('0x34')]?_0x2cae30[_0x0175('0x32')]:_0x5ae63a['model'];_0x2cae30[_0x0175('0x4a')]=qs[_0x0175('0x37')](_0x581db6['query'][_0x0175('0x37')]);_0x2cae30[_0x0175('0x38')]=qs[_0x0175('0x31')](_['pick'](_0x581db6[_0x0175('0x30')],_0x5ae63a['filters']));if(_0x581db6[_0x0175('0x30')]['filter']){_0x2cae30['where']=_[_0x0175('0x44')](_0x2cae30[_0x0175('0x38')],{'$or':_['map'](_0x2cae30[_0x0175('0x32')],function(_0x332a84){var _0xb60b76={};_0xb60b76[_0x332a84]={'$like':'%'+_0x581db6[_0x0175('0x30')][_0x0175('0x4b')]+'%'};return _0xb60b76;})});}_0x2cae30=_[_0x0175('0x44')]({},_0x2cae30,_0x581db6[_0x0175('0x3b')]);return _0xe6996d['getSubjects'](_0x2cae30);}})['then'](function(_0x947151){if(_0x947151){_0x1ac56e=_0x947151[_0x0175('0x34')];if(!_0x581db6[_0x0175('0x30')]['hasOwnProperty']('nolimit')){_0x2cae30[_0x0175('0x1d')]=qs['limit'](_0x581db6[_0x0175('0x30')]['limit']);_0x2cae30['offset']=qs[_0x0175('0x1b')](_0x581db6[_0x0175('0x30')]['offset']);}return _0xe6996d[_0x0175('0x4d')](_0x2cae30);}})[_0x0175('0x23')](function(_0xdb5c5c){if(_0xdb5c5c){return _0xdb5c5c?{'count':_0x1ac56e,'rows':_0xdb5c5c}:null;}})[_0x0175('0x23')](respondWithResult(_0x329107,null))[_0x0175('0x3f')](handleError(_0x329107,null));};exports[_0x0175('0x4e')]=function(_0x4515d0,_0x5898bc,_0x58f6a2){var _0x2c5f74={};var _0x3ac858={};var _0x130772;var _0x59eba3;return db[_0x0175('0x3c')][_0x0175('0x48')]({'where':{'id':_0x4515d0[_0x0175('0x41')]['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x5898bc,null))[_0x0175('0x23')](function(_0x1dd33e){if(_0x1dd33e){_0x130772=_0x1dd33e;_0x3ac858['model']=_[_0x0175('0x2f')](db[_0x0175('0x49')][_0x0175('0x2a')]);_0x3ac858['query']=_[_0x0175('0x2f')](_0x4515d0[_0x0175('0x30')]);_0x3ac858[_0x0175('0x31')]=_[_0x0175('0x42')](_0x3ac858['model'],_0x3ac858['query']);_0x2c5f74[_0x0175('0x32')]=_[_0x0175('0x42')](_0x3ac858[_0x0175('0x2d')],qs[_0x0175('0x33')](_0x4515d0[_0x0175('0x30')]['fields']));_0x2c5f74[_0x0175('0x32')]=_0x2c5f74['attributes'][_0x0175('0x34')]?_0x2c5f74['attributes']:_0x3ac858['model'];_0x2c5f74[_0x0175('0x4a')]=qs[_0x0175('0x37')](_0x4515d0['query'][_0x0175('0x37')]);_0x2c5f74['where']=qs[_0x0175('0x31')](_['pick'](_0x4515d0[_0x0175('0x30')],_0x3ac858[_0x0175('0x31')]));if(_0x4515d0[_0x0175('0x30')][_0x0175('0x4b')]){_0x2c5f74[_0x0175('0x38')]=_[_0x0175('0x44')](_0x2c5f74[_0x0175('0x38')],{'$or':_['map'](_0x2c5f74[_0x0175('0x32')],function(_0x5b53f5){var _0x2040dd={};_0x2040dd[_0x5b53f5]={'$like':'%'+_0x4515d0['query']['filter']+'%'};return _0x2040dd;})});}_0x2c5f74=_[_0x0175('0x44')]({},_0x2c5f74,_0x4515d0[_0x0175('0x3b')]);return _0x130772[_0x0175('0x4e')](_0x2c5f74);}})[_0x0175('0x23')](function(_0x16c5a7){if(_0x16c5a7){_0x59eba3=_0x16c5a7['length'];if(!_0x4515d0['query'][_0x0175('0x35')]('nolimit')){_0x2c5f74[_0x0175('0x1d')]=qs[_0x0175('0x1d')](_0x4515d0[_0x0175('0x30')][_0x0175('0x1d')]);_0x2c5f74['offset']=qs['offset'](_0x4515d0[_0x0175('0x30')][_0x0175('0x1b')]);}return _0x130772['getDescriptions'](_0x2c5f74);}})[_0x0175('0x23')](function(_0xe68686){if(_0xe68686){return _0xe68686?{'count':_0x59eba3,'rows':_0xe68686}:null;}})[_0x0175('0x23')](respondWithResult(_0x5898bc,null))[_0x0175('0x3f')](handleError(_0x5898bc,null));};exports[_0x0175('0x4f')]=function(_0x3fe851,_0x23e8c7,_0x23e1a2){var _0x5392a9={};var _0x4024a6={};var _0x5a023b;var _0x164d3;return db[_0x0175('0x3c')]['findOne']({'where':{'id':_0x3fe851['params']['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x23e8c7,null))[_0x0175('0x23')](function(_0xecc189){if(_0xecc189){_0x5a023b=_0xecc189;_0x4024a6[_0x0175('0x2d')]=_[_0x0175('0x2f')](db[_0x0175('0x50')][_0x0175('0x2a')]);_0x4024a6[_0x0175('0x30')]=_[_0x0175('0x2f')](_0x3fe851['query']);_0x4024a6['filters']=_[_0x0175('0x42')](_0x4024a6['model'],_0x4024a6[_0x0175('0x30')]);_0x5392a9[_0x0175('0x32')]=_[_0x0175('0x42')](_0x4024a6[_0x0175('0x2d')],qs[_0x0175('0x33')](_0x3fe851[_0x0175('0x30')][_0x0175('0x33')]));_0x5392a9[_0x0175('0x32')]=_0x5392a9[_0x0175('0x32')][_0x0175('0x34')]?_0x5392a9[_0x0175('0x32')]:_0x4024a6[_0x0175('0x2d')];_0x5392a9[_0x0175('0x4a')]=qs[_0x0175('0x37')](_0x3fe851['query'][_0x0175('0x37')]);_0x5392a9[_0x0175('0x38')]=qs[_0x0175('0x31')](_[_0x0175('0x39')](_0x3fe851[_0x0175('0x30')],_0x4024a6[_0x0175('0x31')]));if(_0x3fe851[_0x0175('0x30')][_0x0175('0x4b')]){_0x5392a9[_0x0175('0x38')]=_[_0x0175('0x44')](_0x5392a9[_0x0175('0x38')],{'$or':_[_0x0175('0x2e')](_0x5392a9['attributes'],function(_0x750653){var _0x1b5530={};_0x1b5530[_0x750653]={'$like':'%'+_0x3fe851[_0x0175('0x30')][_0x0175('0x4b')]+'%'};return _0x1b5530;})});}_0x5392a9=_['merge']({},_0x5392a9,_0x3fe851['options']);return _0x5a023b[_0x0175('0x4f')](_0x5392a9);}})[_0x0175('0x23')](function(_0x1ff29e){if(_0x1ff29e){_0x164d3=_0x1ff29e['length'];if(!_0x3fe851[_0x0175('0x30')][_0x0175('0x35')](_0x0175('0x36'))){_0x5392a9[_0x0175('0x1d')]=qs[_0x0175('0x1d')](_0x3fe851[_0x0175('0x30')][_0x0175('0x1d')]);_0x5392a9[_0x0175('0x1b')]=qs[_0x0175('0x1b')](_0x3fe851[_0x0175('0x30')][_0x0175('0x1b')]);}return _0x5a023b['getTags'](_0x5392a9);}})[_0x0175('0x23')](function(_0x5dad58){if(_0x5dad58){return _0x5dad58?{'count':_0x164d3,'rows':_0x5dad58}:null;}})[_0x0175('0x23')](respondWithResult(_0x23e8c7,null))[_0x0175('0x3f')](handleError(_0x23e8c7,null));};exports[_0x0175('0x51')]=function(_0x831263,_0x3533ba,_0x44384e){if(_0x831263['body']['id']){delete _0x831263['body']['id'];}return db[_0x0175('0x3c')][_0x0175('0x48')]({'where':{'id':_0x831263[_0x0175('0x41')]['id']}})[_0x0175('0x23')](handleEntityNotFound(_0x3533ba,null))['then'](function(_0x5926d4){if(_0x5926d4){return _0x5926d4['setTags'](_0x831263[_0x0175('0x46')][_0x0175('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3533ba,null))[_0x0175('0x3f')](handleError(_0x3533ba,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0a6d9ff..51ae1f5 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 _0x1980=['../../config/environment','exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1980,0xd5));var _0x0198=function(_0x240a4c,_0x46ec17){_0x240a4c=_0x240a4c-0x0;var _0xf57ea4=_0x1980[_0x240a4c];return _0xf57ea4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0198('0x0'))(_0x0198('0x1'));var moment=require(_0x0198('0x2'));var BPromise=require(_0x0198('0x3'));var rp=require(_0x0198('0x4'));var fs=require('fs');var path=require(_0x0198('0x5'));var rimraf=require(_0x0198('0x6'));var config=require(_0x0198('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0198('0x8')]=function(_0x4f9c84,_0x353c0c){return _0x4f9c84[_0x0198('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe2a=['exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfe2a,0xae));var _0xafe2=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0xfe2a[_0xd8a8af];return _0x5b7278;};'use strict';var _=require(_0xafe2('0x0'));var util=require('util');var logger=require(_0xafe2('0x1'))(_0xafe2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xafe2('0x3'));var fs=require('fs');var path=require(_0xafe2('0x4'));var rimraf=require('rimraf');var config=require(_0xafe2('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xafe2('0x6')]=function(_0x1ea0e3,_0x270c89){return _0x1ea0e3[_0xafe2('0x7')]('FreshdeskConfiguration',attributes,{'tableName':_0xafe2('0x8'),'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 0acb1f1..b121e77 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 _0x8bca=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x404fa0,_0xf828f7){var _0x1d7c6b=function(_0x40b247){while(--_0x40b247){_0x404fa0['push'](_0x404fa0['shift']());}};_0x1d7c6b(++_0xf828f7);}(_0x8bca,0x7b));var _0xa8bc=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x8bca[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xa8bc('0x0'));var util=require(_0xa8bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8bc('0x3'))['db'];var utils=require(_0xa8bc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8bc('0x5'));var jayson=require(_0xa8bc('0x6'));var client=jayson[_0xa8bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97e309,_0x5ca4da,_0x439846){return new BPromise(function(_0x4b061b,_0x323382){return client[_0xa8bc('0x8')](_0x97e309,_0x439846)[_0xa8bc('0x9')](function(_0xa548d8){logger[_0xa8bc('0xa')](_0xa8bc('0xb'),_0x5ca4da,'request\x20sent');logger[_0xa8bc('0xc')](_0xa8bc('0xd'),_0x5ca4da,_0xa8bc('0xe'),JSON[_0xa8bc('0xf')](_0xa548d8));if(_0xa548d8[_0xa8bc('0x10')]){if(_0xa548d8['error']['code']===0x1f4){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0xa548d8[_0xa8bc('0x10')]['message']);return _0x323382(_0xa548d8['error']['message']);}logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0xa548d8[_0xa8bc('0x10')][_0xa8bc('0x11')]);return _0x4b061b(_0xa548d8['error'][_0xa8bc('0x11')]);}else{logger['info'](_0xa8bc('0xb'),_0x5ca4da,'request\x20sent');_0x4b061b(_0xa548d8[_0xa8bc('0x12')][_0xa8bc('0x11')]);}})['catch'](function(_0x1fec7f){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0x1fec7f);_0x323382(_0x1fec7f);});});} \ No newline at end of file +var _0x8043=['request','then','info','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34d353,_0x1b0225){var _0x47edfc=function(_0x3eaa9a){while(--_0x3eaa9a){_0x34d353['push'](_0x34d353['shift']());}};_0x47edfc(++_0x1b0225);}(_0x8043,0xa1));var _0x3804=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x8043[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x3804('0x0'));var util=require(_0x3804('0x1'));var moment=require(_0x3804('0x2'));var BPromise=require(_0x3804('0x3'));var rs=require(_0x3804('0x4'));var fs=require('fs');var Redis=require(_0x3804('0x5'));var db=require(_0x3804('0x6'))['db'];var utils=require(_0x3804('0x7'));var logger=require(_0x3804('0x8'))(_0x3804('0x9'));var config=require(_0x3804('0xa'));var jayson=require(_0x3804('0xb'));var client=jayson[_0x3804('0xc')][_0x3804('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ccba2,_0x432fdd,_0x543b0d){return new BPromise(function(_0x16b3e2,_0x2ecf7a){return client[_0x3804('0xe')](_0x3ccba2,_0x543b0d)[_0x3804('0xf')](function(_0x2c957b){logger[_0x3804('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x432fdd,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x432fdd,'request\x20sent',JSON[_0x3804('0x11')](_0x2c957b));if(_0x2c957b[_0x3804('0x12')]){if(_0x2c957b[_0x3804('0x12')][_0x3804('0x13')]===0x1f4){logger[_0x3804('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x432fdd,_0x2c957b[_0x3804('0x12')][_0x3804('0x14')]);return _0x2ecf7a(_0x2c957b[_0x3804('0x12')][_0x3804('0x14')]);}logger[_0x3804('0x12')](_0x3804('0x15'),_0x432fdd,_0x2c957b[_0x3804('0x12')][_0x3804('0x14')]);return _0x16b3e2(_0x2c957b[_0x3804('0x12')][_0x3804('0x14')]);}else{logger[_0x3804('0x10')](_0x3804('0x15'),_0x432fdd,_0x3804('0x16'));_0x16b3e2(_0x2c957b[_0x3804('0x17')]['message']);}})[_0x3804('0x18')](function(_0x937c09){logger[_0x3804('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x432fdd,_0x937c09);_0x2ecf7a(_0x937c09);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7bb2871..c15b4ff 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 _0xf452=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0x1745b1,_0x2e6a46){var _0x25bf24=function(_0x6270){while(--_0x6270){_0x1745b1['push'](_0x1745b1['shift']());}};_0x25bf24(++_0x2e6a46);}(_0xf452,0x7e));var _0x2f45=function(_0x3a220e,_0x519fac){_0x3a220e=_0x3a220e-0x0;var _0x344a65=_0xf452[_0x3a220e];return _0x344a65;};'use strict';var multer=require(_0x2f45('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2f45('0x1'));var express=require(_0x2f45('0x2'));var router=express[_0x2f45('0x3')]();var fs_extra=require(_0x2f45('0x4'));var auth=require(_0x2f45('0x5'));var interaction=require(_0x2f45('0x6'));var config=require(_0x2f45('0x7'));var controller=require(_0x2f45('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xb')]);router[_0x2f45('0xc')]('/',auth[_0x2f45('0xa')](),controller[_0x2f45('0xd')]);router[_0x2f45('0xe')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xf')]);router[_0x2f45('0x10')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller['destroy']);module[_0x2f45('0x11')]=router; \ No newline at end of file +var _0xb84a=['isAuthenticated','create','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','show'];(function(_0x1357fc,_0x4a6698){var _0x4be143=function(_0x312ca5){while(--_0x312ca5){_0x1357fc['push'](_0x1357fc['shift']());}};_0x4be143(++_0x4a6698);}(_0xb84a,0xef));var _0xab84=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb84a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xab84('0x0'));var util=require(_0xab84('0x1'));var path=require(_0xab84('0x2'));var timeout=require(_0xab84('0x3'));var express=require('express');var router=express[_0xab84('0x4')]();var fs_extra=require(_0xab84('0x5'));var auth=require(_0xab84('0x6'));var interaction=require(_0xab84('0x7'));var config=require(_0xab84('0x8'));var controller=require(_0xab84('0x9'));router[_0xab84('0xa')]('/',auth['isAuthenticated'](),controller[_0xab84('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xab84('0xc')]);router['post']('/',auth[_0xab84('0xd')](),controller[_0xab84('0xe')]);router['put'](_0xab84('0xf'),auth['isAuthenticated'](),controller[_0xab84('0x10')]);router['delete'](_0xab84('0xf'),auth[_0xab84('0xd')](),controller[_0xab84('0x11')]);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 aa0fd4f..e88426b 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 _0x7728=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x4fc145,_0x119cf2){var _0x1b0be2=function(_0x5ab1a3){while(--_0x5ab1a3){_0x4fc145['push'](_0x4fc145['shift']());}};_0x1b0be2(++_0x119cf2);}(_0x7728,0x19b));var _0x8772=function(_0x36acb3,_0x204e94){_0x36acb3=_0x36acb3-0x0;var _0x13976c=_0x7728[_0x36acb3];return _0x13976c;};'use strict';var Sequelize=require(_0x8772('0x0'));module[_0x8772('0x1')]={'type':{'type':Sequelize[_0x8772('0x2')]('string',_0x8772('0x3'),_0x8772('0x4'),_0x8772('0x5'),_0x8772('0x6')),'defaultValue':_0x8772('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8772('0x8')]},'keyType':{'type':Sequelize[_0x8772('0x2')](_0x8772('0x7'),'variable',_0x8772('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8772('0x8')]},'nameField':{'type':Sequelize[_0x8772('0x8')]},'customField':{'type':Sequelize[_0x8772('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbb7=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdbb7,0x105));var _0x7dbb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdbb7[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x7dbb('0x0')]={'type':{'type':Sequelize[_0x7dbb('0x1')](_0x7dbb('0x2'),_0x7dbb('0x3'),_0x7dbb('0x4'),_0x7dbb('0x5'),_0x7dbb('0x6')),'defaultValue':_0x7dbb('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7dbb('0x7')]},'keyType':{'type':Sequelize[_0x7dbb('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7dbb('0x7')]},'nameField':{'type':Sequelize[_0x7dbb('0x7')]},'customField':{'type':Sequelize[_0x7dbb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7dbb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ad43f2a..9af4f6b 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 _0x1b32=['lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','show','params','fields','length','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x1b32,0x85));var _0x21b3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1b32[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x26')]();});}};}function handleEntityNotFound(_0x2e3221,_0x58822d){return function(_0x5b752c){if(!_0x5b752c){_0x2e3221['sendStatus'](0x194);}return _0x5b752c;};}function handleError(_0x3ca89d,_0x2e3758){_0x2e3758=_0x2e3758||0x1f4;return function(_0x3c1a3b){logger[_0x21b3('0x27')](_0x3c1a3b[_0x21b3('0x28')]);if(_0x3c1a3b['name']){delete _0x3c1a3b[_0x21b3('0x29')];}_0x3ca89d['status'](_0x2e3758)[_0x21b3('0x2a')](_0x3c1a3b);};}exports['index']=function(_0x469e42,_0xf48fc7){var _0x81ee7e={},_0x4f6432={},_0x291e52={'count':0x0,'rows':[]};var _0x300977=_[_0x21b3('0x2b')](db[_0x21b3('0x2c')][_0x21b3('0x2d')],function(_0x210c49){return{'name':_0x210c49[_0x21b3('0x2e')],'type':_0x210c49['type']['key']};});_0x4f6432[_0x21b3('0x2f')]=_[_0x21b3('0x2b')](_0x300977,'name');_0x4f6432[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x469e42[_0x21b3('0x30')]);_0x4f6432[_0x21b3('0x32')]=_[_0x21b3('0x33')](_0x4f6432[_0x21b3('0x2f')],_0x4f6432[_0x21b3('0x30')]);_0x81ee7e[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x4f6432['model'],qs['fields'](_0x469e42[_0x21b3('0x30')]['fields']));_0x81ee7e[_0x21b3('0x34')]=_0x81ee7e[_0x21b3('0x34')]['length']?_0x81ee7e[_0x21b3('0x34')]:_0x4f6432[_0x21b3('0x2f')];if(!_0x469e42[_0x21b3('0x30')][_0x21b3('0x35')]('nolimit')){_0x81ee7e[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x1e')]);_0x81ee7e['offset']=qs[_0x21b3('0x1c')](_0x469e42['query'][_0x21b3('0x1c')]);}_0x81ee7e[_0x21b3('0x36')]=qs[_0x21b3('0x37')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x37')]);_0x81ee7e[_0x21b3('0x38')]=qs[_0x21b3('0x32')](_['pick'](_0x469e42['query'],_0x4f6432[_0x21b3('0x32')]),_0x300977);if(_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]){_0x81ee7e[_0x21b3('0x38')]=_['merge'](_0x81ee7e[_0x21b3('0x38')],{'$or':_[_0x21b3('0x2b')](_0x300977,function(_0x128564){if(_0x128564[_0x21b3('0x3a')]!==_0x21b3('0x3b')){var _0xb028ca={};_0xb028ca[_0x128564[_0x21b3('0x29')]]={'$like':'%'+_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]+'%'};return _0xb028ca;}})});}_0x81ee7e=_[_0x21b3('0x3c')]({},_0x81ee7e,_0x469e42[_0x21b3('0x3d')]);var _0x4facfc={'where':_0x81ee7e[_0x21b3('0x38')]};return db[_0x21b3('0x2c')]['count'](_0x4facfc)[_0x21b3('0x24')](function(_0x5f2623){_0x291e52[_0x21b3('0x1f')]=_0x5f2623;if(_0x469e42[_0x21b3('0x30')]['includeAll']){_0x81ee7e['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x21b3('0x3e')](_0x81ee7e);})[_0x21b3('0x24')](function(_0x3e6501){_0x291e52[_0x21b3('0x3f')]=_0x3e6501;return _0x291e52;})['then'](respondWithFilteredResult(_0xf48fc7,_0x81ee7e))['catch'](handleError(_0xf48fc7,null));};exports[_0x21b3('0x40')]=function(_0x492eaf,_0x1c97e7){var _0x28adbc={'raw':!![],'where':{'id':_0x492eaf[_0x21b3('0x41')]['id']}},_0x306bf2={};_0x306bf2[_0x21b3('0x2f')]=_['keys'](db[_0x21b3('0x2c')][_0x21b3('0x2d')]);_0x306bf2[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x492eaf[_0x21b3('0x30')]);_0x306bf2[_0x21b3('0x32')]=_['intersection'](_0x306bf2['model'],_0x306bf2[_0x21b3('0x30')]);_0x28adbc[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x306bf2['model'],qs[_0x21b3('0x42')](_0x492eaf[_0x21b3('0x30')][_0x21b3('0x42')]));_0x28adbc[_0x21b3('0x34')]=_0x28adbc[_0x21b3('0x34')][_0x21b3('0x43')]?_0x28adbc['attributes']:_0x306bf2[_0x21b3('0x2f')];if(_0x492eaf[_0x21b3('0x30')][_0x21b3('0x44')]){_0x28adbc['include']=[{'all':!![]}];}_0x28adbc=_['merge']({},_0x28adbc,_0x492eaf['options']);return db[_0x21b3('0x2c')][_0x21b3('0x45')](_0x28adbc)[_0x21b3('0x24')](handleEntityNotFound(_0x1c97e7,null))[_0x21b3('0x24')](respondWithResult(_0x1c97e7,null))[_0x21b3('0x46')](handleError(_0x1c97e7,null));};exports[_0x21b3('0x47')]=function(_0xc51c1d,_0x30d48b){return db[_0x21b3('0x2c')]['create'](_0xc51c1d['body'],{})['then'](respondWithResult(_0x30d48b,0xc9))[_0x21b3('0x46')](handleError(_0x30d48b,null));};exports[_0x21b3('0x23')]=function(_0x4046cd,_0x2e4add){if(_0x4046cd[_0x21b3('0x48')]['id']){delete _0x4046cd[_0x21b3('0x48')]['id'];}return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x4046cd[_0x21b3('0x41')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x2e4add,null))['then'](saveUpdates(_0x4046cd[_0x21b3('0x48')],null))[_0x21b3('0x24')](respondWithResult(_0x2e4add,null))[_0x21b3('0x46')](handleError(_0x2e4add,null));};exports[_0x21b3('0x25')]=function(_0x34509e,_0x2c7019){return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x34509e[_0x21b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c7019,null))[_0x21b3('0x24')](removeEntity(_0x2c7019,null))[_0x21b3('0x46')](handleError(_0x2c7019,null));}; \ No newline at end of file +var _0x6b24=['rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','merge','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FreshdeskField'];(function(_0x295369,_0xaaf74a){var _0x1e1772=function(_0x7a956f){while(--_0x7a956f){_0x295369['push'](_0x295369['shift']());}};_0x1e1772(++_0xaaf74a);}(_0x6b24,0x1ce));var _0x46b2=function(_0x53e55c,_0x40898b){_0x53e55c=_0x53e55c-0x0;var _0x451802=_0x6b24[_0x53e55c];return _0x451802;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];function respondWithStatusCode(_0x5343fc,_0x468ae9){_0x468ae9=_0x468ae9||0xcc;return function(_0x886e41){if(_0x886e41){return _0x5343fc[_0x46b2('0x16')](_0x468ae9);}return _0x5343fc[_0x46b2('0x17')](_0x468ae9)[_0x46b2('0x18')]();};}function respondWithResult(_0x1cf0f0,_0x3ff25d){_0x3ff25d=_0x3ff25d||0xc8;return function(_0x228261){if(_0x228261){return _0x1cf0f0[_0x46b2('0x17')](_0x3ff25d)[_0x46b2('0x19')](_0x228261);}};}function respondWithFilteredResult(_0x563b05,_0x43e0d9){return function(_0x5b49da){if(_0x5b49da){var _0x49479c=typeof _0x43e0d9[_0x46b2('0x1a')]===_0x46b2('0x1b')&&typeof _0x43e0d9[_0x46b2('0x1c')]===_0x46b2('0x1b');var _0x373c49=_0x5b49da[_0x46b2('0x1d')];var _0x226ab5=_0x49479c?0x0:_0x43e0d9['offset'];var _0x316c39=_0x49479c?_0x5b49da['count']:_0x43e0d9[_0x46b2('0x1a')]+_0x43e0d9[_0x46b2('0x1c')];var _0x9b4723;if(_0x316c39>=_0x373c49){_0x316c39=_0x373c49;_0x9b4723=0xc8;}else{_0x9b4723=0xce;}_0x563b05['status'](_0x9b4723);return _0x563b05[_0x46b2('0x1e')](_0x46b2('0x1f'),_0x226ab5+'-'+_0x316c39+'/'+_0x373c49)[_0x46b2('0x19')](_0x5b49da);}return null;};}function patchUpdates(_0x1e5c35){return function(_0x350f85){try{jsonpatch[_0x46b2('0x20')](_0x350f85,_0x1e5c35,!![]);}catch(_0x3a0ea5){return BPromise[_0x46b2('0x21')](_0x3a0ea5);}return _0x350f85[_0x46b2('0x22')]();};}function saveUpdates(_0x259f2f,_0x29ade9){return function(_0x1b5fbe){if(_0x1b5fbe){return _0x1b5fbe[_0x46b2('0x23')](_0x259f2f)[_0x46b2('0x24')](function(_0x1caa77){return _0x1caa77;});}return null;};}function removeEntity(_0x50011b,_0x209519){return function(_0x4c2983){if(_0x4c2983){return _0x4c2983['destroy']()[_0x46b2('0x24')](function(){_0x50011b[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x134526,_0x16f646){return function(_0x58069e){if(!_0x58069e){_0x134526[_0x46b2('0x16')](0x194);}return _0x58069e;};}function handleError(_0x138f6c,_0x5ca1c7){_0x5ca1c7=_0x5ca1c7||0x1f4;return function(_0x3c5997){logger['error'](_0x3c5997[_0x46b2('0x25')]);if(_0x3c5997[_0x46b2('0x26')]){delete _0x3c5997[_0x46b2('0x26')];}_0x138f6c[_0x46b2('0x17')](_0x5ca1c7)[_0x46b2('0x27')](_0x3c5997);};}exports[_0x46b2('0x28')]=function(_0x74615,_0x1a6caf){var _0x429496={},_0x20ccb2={},_0x5421d9={'count':0x0,'rows':[]};var _0x4e2a9b=_['map'](db[_0x46b2('0x29')][_0x46b2('0x2a')],function(_0x2a2f8d){return{'name':_0x2a2f8d['fieldName'],'type':_0x2a2f8d[_0x46b2('0x2b')][_0x46b2('0x2c')]};});_0x20ccb2['model']=_[_0x46b2('0x2d')](_0x4e2a9b,_0x46b2('0x26'));_0x20ccb2[_0x46b2('0x2e')]=_[_0x46b2('0x2f')](_0x74615[_0x46b2('0x2e')]);_0x20ccb2[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],_0x20ccb2[_0x46b2('0x2e')]);_0x429496['attributes']=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],qs[_0x46b2('0x33')](_0x74615['query'][_0x46b2('0x33')]));_0x429496[_0x46b2('0x34')]=_0x429496[_0x46b2('0x34')][_0x46b2('0x35')]?_0x429496['attributes']:_0x20ccb2[_0x46b2('0x32')];if(!_0x74615['query'][_0x46b2('0x36')](_0x46b2('0x37'))){_0x429496[_0x46b2('0x1c')]=qs[_0x46b2('0x1c')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1c')]);_0x429496[_0x46b2('0x1a')]=qs['offset'](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1a')]);}_0x429496[_0x46b2('0x38')]=qs[_0x46b2('0x39')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x39')]);_0x429496[_0x46b2('0x3a')]=qs['filters'](_['pick'](_0x74615['query'],_0x20ccb2[_0x46b2('0x30')]),_0x4e2a9b);if(_0x74615[_0x46b2('0x2e')]['filter']){_0x429496[_0x46b2('0x3a')]=_['merge'](_0x429496['where'],{'$or':_[_0x46b2('0x2d')](_0x4e2a9b,function(_0x1716a3){if(_0x1716a3[_0x46b2('0x2b')]!==_0x46b2('0x3b')){var _0x4dcd03={};_0x4dcd03[_0x1716a3[_0x46b2('0x26')]]={'$like':'%'+_0x74615['query']['filter']+'%'};return _0x4dcd03;}})});}_0x429496=_['merge']({},_0x429496,_0x74615[_0x46b2('0x3c')]);var _0x1599fa={'where':_0x429496[_0x46b2('0x3a')]};return db['FreshdeskField'][_0x46b2('0x1d')](_0x1599fa)['then'](function(_0x30afdb){_0x5421d9[_0x46b2('0x1d')]=_0x30afdb;if(_0x74615['query'][_0x46b2('0x3d')]){_0x429496['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x46b2('0x3e')](_0x429496);})['then'](function(_0x22c896){_0x5421d9[_0x46b2('0x3f')]=_0x22c896;return _0x5421d9;})[_0x46b2('0x24')](respondWithFilteredResult(_0x1a6caf,_0x429496))[_0x46b2('0x40')](handleError(_0x1a6caf,null));};exports['show']=function(_0x15451a,_0x13343e){var _0x205027={'raw':!![],'where':{'id':_0x15451a['params']['id']}},_0x4fdfeb={};_0x4fdfeb[_0x46b2('0x32')]=_[_0x46b2('0x2f')](db[_0x46b2('0x29')][_0x46b2('0x2a')]);_0x4fdfeb['query']=_['keys'](_0x15451a[_0x46b2('0x2e')]);_0x4fdfeb[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x4fdfeb[_0x46b2('0x32')],_0x4fdfeb[_0x46b2('0x2e')]);_0x205027[_0x46b2('0x34')]=_['intersection'](_0x4fdfeb['model'],qs[_0x46b2('0x33')](_0x15451a[_0x46b2('0x2e')][_0x46b2('0x33')]));_0x205027[_0x46b2('0x34')]=_0x205027['attributes'][_0x46b2('0x35')]?_0x205027[_0x46b2('0x34')]:_0x4fdfeb[_0x46b2('0x32')];if(_0x15451a[_0x46b2('0x2e')]['includeAll']){_0x205027[_0x46b2('0x41')]=[{'all':!![]}];}_0x205027=_[_0x46b2('0x42')]({},_0x205027,_0x15451a[_0x46b2('0x3c')]);return db[_0x46b2('0x29')][_0x46b2('0x43')](_0x205027)[_0x46b2('0x24')](handleEntityNotFound(_0x13343e,null))[_0x46b2('0x24')](respondWithResult(_0x13343e,null))['catch'](handleError(_0x13343e,null));};exports[_0x46b2('0x44')]=function(_0x14cdc9,_0x55c0aa){return db[_0x46b2('0x29')]['create'](_0x14cdc9[_0x46b2('0x45')],{})['then'](respondWithResult(_0x55c0aa,0xc9))[_0x46b2('0x40')](handleError(_0x55c0aa,null));};exports[_0x46b2('0x23')]=function(_0x4f8bd6,_0x301c64){if(_0x4f8bd6[_0x46b2('0x45')]['id']){delete _0x4f8bd6['body']['id'];}return db['FreshdeskField'][_0x46b2('0x43')]({'where':{'id':_0x4f8bd6['params']['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x301c64,null))['then'](saveUpdates(_0x4f8bd6[_0x46b2('0x45')],null))[_0x46b2('0x24')](respondWithResult(_0x301c64,null))[_0x46b2('0x40')](handleError(_0x301c64,null));};exports[_0x46b2('0x46')]=function(_0x27a9cf,_0x251c28){return db[_0x46b2('0x29')][_0x46b2('0x43')]({'where':{'id':_0x27a9cf[_0x46b2('0x47')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x251c28,null))[_0x46b2('0x24')](removeEntity(_0x251c28,null))[_0x46b2('0x40')](handleError(_0x251c28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 829e133..c7c1919 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 _0x525e=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x525e,0x78));var _0xe525=function(_0x50f6fc,_0x197e4d){_0x50f6fc=_0x50f6fc-0x0;var _0x161ddb=_0x525e[_0x50f6fc];return _0x161ddb;};'use strict';var _=require(_0xe525('0x0'));var util=require(_0xe525('0x1'));var logger=require(_0xe525('0x2'))(_0xe525('0x3'));var moment=require(_0xe525('0x4'));var BPromise=require(_0xe525('0x5'));var rp=require(_0xe525('0x6'));var fs=require('fs');var path=require(_0xe525('0x7'));var rimraf=require('rimraf');var config=require(_0xe525('0x8'));var attributes=require(_0xe525('0x9'));module[_0xe525('0xa')]=function(_0x59a6b6,_0x4c68a3){return _0x59a6b6[_0xe525('0xb')]('FreshdeskField',attributes,{'tableName':_0xe525('0xc'),'paranoid':![],'indexes':[{'name':_0xe525('0xd'),'fields':[_0xe525('0xe'),_0xe525('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc913=['freshdesk_unique_index','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x233d74,_0x828092){var _0x4172a6=function(_0x554d83){while(--_0x554d83){_0x233d74['push'](_0x233d74['shift']());}};_0x4172a6(++_0x828092);}(_0xc913,0xd9));var _0x3c91=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0xc913[_0x4c6cf0];return _0x108145;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c91('0x0'))(_0x3c91('0x1'));var moment=require(_0x3c91('0x2'));var BPromise=require(_0x3c91('0x3'));var rp=require(_0x3c91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c91('0x5'));var config=require(_0x3c91('0x6'));var attributes=require(_0x3c91('0x7'));module[_0x3c91('0x8')]=function(_0x340d56,_0x9b69d){return _0x340d56['define'](_0x3c91('0x9'),attributes,{'tableName':_0x3c91('0xa'),'paranoid':![],'indexes':[{'name':_0x3c91('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 88bf2e2..ec8dc40 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 _0x5c91=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4443f6,_0x256b10){var _0x4885de=function(_0x2a51c5){while(--_0x2a51c5){_0x4443f6['push'](_0x4443f6['shift']());}};_0x4885de(++_0x256b10);}(_0x5c91,0x1df));var _0x15c9=function(_0x4e5ee2,_0x46666d){_0x4e5ee2=_0x4e5ee2-0x0;var _0x151961=_0x5c91[_0x4e5ee2];return _0x151961;};'use strict';var _=require('lodash');var util=require(_0x15c9('0x0'));var moment=require('moment');var BPromise=require(_0x15c9('0x1'));var rs=require(_0x15c9('0x2'));var fs=require('fs');var Redis=require(_0x15c9('0x3'));var db=require(_0x15c9('0x4'))['db'];var utils=require(_0x15c9('0x5'));var logger=require(_0x15c9('0x6'))(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31515e,_0x454cac,_0x412329){return new BPromise(function(_0x16bc56,_0x269dc6){return client[_0x15c9('0xc')](_0x31515e,_0x412329)[_0x15c9('0xd')](function(_0x5bc3aa){logger[_0x15c9('0xe')](_0x15c9('0xf'),_0x454cac,_0x15c9('0x10'));logger['debug'](_0x15c9('0x11'),_0x454cac,_0x15c9('0x10'),JSON['stringify'](_0x5bc3aa));if(_0x5bc3aa[_0x15c9('0x12')]){if(_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x13')]===0x1f4){logger[_0x15c9('0x12')](_0x15c9('0xf'),_0x454cac,_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);return _0x269dc6(_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);}logger['error'](_0x15c9('0xf'),_0x454cac,_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);return _0x16bc56(_0x5bc3aa[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x454cac,_0x15c9('0x10'));_0x16bc56(_0x5bc3aa[_0x15c9('0x15')]['message']);}})['catch'](function(_0x248577){logger[_0x15c9('0x12')](_0x15c9('0xf'),_0x454cac,_0x248577);_0x269dc6(_0x248577);});});} \ No newline at end of file +var _0xbc69=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x47da86,_0x3daf34){var _0x5d0d44=function(_0x5eb249){while(--_0x5eb249){_0x47da86['push'](_0x47da86['shift']());}};_0x5d0d44(++_0x3daf34);}(_0xbc69,0xe9));var _0x9bc6=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xbc69[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x9bc6('0x0'));var util=require(_0x9bc6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bc6('0x2'));var fs=require('fs');var Redis=require(_0x9bc6('0x3'));var db=require(_0x9bc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bc6('0x5'))(_0x9bc6('0x6'));var config=require('../../config/environment');var jayson=require(_0x9bc6('0x7'));var client=jayson[_0x9bc6('0x8')][_0x9bc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e97e,_0x541d70,_0x35b093){return new BPromise(function(_0x26ad7a,_0x3ee360){return client[_0x9bc6('0xa')](_0x16e97e,_0x35b093)['then'](function(_0x89b9ab){logger[_0x9bc6('0xb')](_0x9bc6('0xc'),_0x541d70,_0x9bc6('0xd'));logger[_0x9bc6('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x541d70,_0x9bc6('0xd'),JSON[_0x9bc6('0xf')](_0x89b9ab));if(_0x89b9ab[_0x9bc6('0x10')]){if(_0x89b9ab[_0x9bc6('0x10')][_0x9bc6('0x11')]===0x1f4){logger[_0x9bc6('0x10')](_0x9bc6('0xc'),_0x541d70,_0x89b9ab['error'][_0x9bc6('0x12')]);return _0x3ee360(_0x89b9ab[_0x9bc6('0x10')][_0x9bc6('0x12')]);}logger[_0x9bc6('0x10')](_0x9bc6('0xc'),_0x541d70,_0x89b9ab['error'][_0x9bc6('0x12')]);return _0x26ad7a(_0x89b9ab[_0x9bc6('0x10')]['message']);}else{logger[_0x9bc6('0xb')](_0x9bc6('0xc'),_0x541d70,_0x9bc6('0xd'));_0x26ad7a(_0x89b9ab[_0x9bc6('0x13')][_0x9bc6('0x12')]);}})[_0x9bc6('0x14')](function(_0x637186){logger[_0x9bc6('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x541d70,_0x637186);_0x3ee360(_0x637186);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9276417..cbeff54 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 _0x1d2d=['multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports'];(function(_0x44c0a9,_0xa5507b){var _0x5dcc53=function(_0x4a8848){while(--_0x4a8848){_0x44c0a9['push'](_0x44c0a9['shift']());}};_0x5dcc53(++_0xa5507b);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5333c1,_0xbeccbd){_0x5333c1=_0x5333c1-0x0;var _0x3c4155=_0x1d2d[_0x5333c1];return _0x3c4155;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/:id',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x11')]);router['post'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x12')]);router[_0xd1d2('0x13')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x16')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller['destroy']);module[_0xd1d2('0x17')]=router; \ No newline at end of file +var _0x757a=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','/:id','delete'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x757a,0xde));var _0xa757=function(_0x37777c,_0xcd45c4){_0x37777c=_0x37777c-0x0;var _0x133787=_0x757a[_0x37777c];return _0x133787;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getConfigurations']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa757('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa757('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa757('0x12')]);module[_0xa757('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e69dd48..4a6e48a 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 _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2c0e46,_0x428bbf){var _0x50b247=function(_0x13d93b){while(--_0x13d93b){_0x2c0e46['push'](_0x2c0e46['shift']());}};_0x50b247(++_0x428bbf);}(_0x2ef3,0xba));var _0x32ef=function(_0x404686,_0x152e7a){_0x404686=_0x404686-0x0;var _0x596ee3=_0x2ef3[_0x404686];return _0x596ee3;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6d11=['exports','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6d11,0xbf));var _0x16d1=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0x6d11[_0x7ad6cb];return _0x22a0ba;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 68404cd..22ee6c5 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 _0x1e5a=['sendStatus','error','stack','name','send','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','findAll','rows','show','params','fields','find','catch','create','body','FreshsalesConfiguration','order','pick','nolimit','getConfigurations','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','jsforce','desk.js','../../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','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x1e5a,0x164));var _0xa1e5=function(_0x1b7d9c,_0x59b000){_0x1b7d9c=_0x1b7d9c-0x0;var _0x439e9d=_0x1e5a[_0x1b7d9c];return _0x439e9d;};'use strict';var emlformat=require(_0xa1e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1e5('0x1'));var jsonpatch=require(_0xa1e5('0x2'));var rp=require(_0xa1e5('0x3'));var moment=require(_0xa1e5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1e5('0x5'));var path=require(_0xa1e5('0x6'));var sox=require('sox');var csv=require(_0xa1e5('0x7'));var ejs=require(_0xa1e5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa1e5('0x9'));var crypto=require('crypto');var jsforce=require(_0xa1e5('0xa'));var deskjs=require(_0xa1e5('0xb'));var toCsv=require(_0xa1e5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa1e5('0xc'));var qs=require(_0xa1e5('0xd'));var as=require(_0xa1e5('0xe'));var hardwareService=require(_0xa1e5('0xf'));var logger=require(_0xa1e5('0x10'))(_0xa1e5('0x11'));var utils=require(_0xa1e5('0x12'));var config=require(_0xa1e5('0x13'));var licenseUtil=require(_0xa1e5('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1e5('0x15'));function respondWithStatusCode(_0x3b7829,_0x4bd4f8){_0x4bd4f8=_0x4bd4f8||0xcc;return function(_0x355b60){if(_0x355b60){return _0x3b7829['sendStatus'](_0x4bd4f8);}return _0x3b7829[_0xa1e5('0x16')](_0x4bd4f8)[_0xa1e5('0x17')]();};}function respondWithResult(_0x34dee3,_0x282ab5){_0x282ab5=_0x282ab5||0xc8;return function(_0x1243d5){if(_0x1243d5){return _0x34dee3[_0xa1e5('0x16')](_0x282ab5)['json'](_0x1243d5);}};}function respondWithFilteredResult(_0x1739f2,_0x2c53bd){return function(_0x5f4fad){if(_0x5f4fad){var _0x3997db=typeof _0x2c53bd[_0xa1e5('0x18')]===_0xa1e5('0x19')&&typeof _0x2c53bd['limit']===_0xa1e5('0x19');var _0x5a5e4e=_0x5f4fad[_0xa1e5('0x1a')];var _0x5e4b76=_0x3997db?0x0:_0x2c53bd['offset'];var _0x3658ee=_0x3997db?_0x5f4fad[_0xa1e5('0x1a')]:_0x2c53bd[_0xa1e5('0x18')]+_0x2c53bd[_0xa1e5('0x1b')];var _0x1961ba;if(_0x3658ee>=_0x5a5e4e){_0x3658ee=_0x5a5e4e;_0x1961ba=0xc8;}else{_0x1961ba=0xce;}_0x1739f2[_0xa1e5('0x16')](_0x1961ba);return _0x1739f2[_0xa1e5('0x1c')]('Content-Range',_0x5e4b76+'-'+_0x3658ee+'/'+_0x5a5e4e)[_0xa1e5('0x1d')](_0x5f4fad);}return null;};}function patchUpdates(_0x3cdcd3){return function(_0x5cb823){try{jsonpatch[_0xa1e5('0x1e')](_0x5cb823,_0x3cdcd3,!![]);}catch(_0x5d8a14){return BPromise[_0xa1e5('0x1f')](_0x5d8a14);}return _0x5cb823[_0xa1e5('0x20')]();};}function saveUpdates(_0x23131a,_0x33ef68){return function(_0x2047f2){if(_0x2047f2){return _0x2047f2[_0xa1e5('0x21')](_0x23131a)[_0xa1e5('0x22')](function(_0x3b7015){return _0x3b7015;});}return null;};}function removeEntity(_0x55166a,_0x57c76e){return function(_0x5dd49c){if(_0x5dd49c){return _0x5dd49c[_0xa1e5('0x23')]()[_0xa1e5('0x22')](function(){_0x55166a[_0xa1e5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5903bb,_0x2bd1cb){return function(_0x44582e){if(!_0x44582e){_0x5903bb[_0xa1e5('0x24')](0x194);}return _0x44582e;};}function handleError(_0x39ed62,_0x1c2df5){_0x1c2df5=_0x1c2df5||0x1f4;return function(_0x4d1601){logger[_0xa1e5('0x25')](_0x4d1601[_0xa1e5('0x26')]);if(_0x4d1601[_0xa1e5('0x27')]){delete _0x4d1601[_0xa1e5('0x27')];}_0x39ed62[_0xa1e5('0x16')](_0x1c2df5)[_0xa1e5('0x28')](_0x4d1601);};}exports['index']=function(_0x3d8f97,_0x19c4a5){var _0xa7d783={},_0x183355={},_0x5ddfd9={'count':0x0,'rows':[]};var _0x43d9f3=_['map'](db[_0xa1e5('0x29')][_0xa1e5('0x2a')],function(_0x4e39f6){return{'name':_0x4e39f6['fieldName'],'type':_0x4e39f6[_0xa1e5('0x2b')][_0xa1e5('0x2c')]};});_0x183355['model']=_['map'](_0x43d9f3,_0xa1e5('0x27'));_0x183355[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x3d8f97['query']);_0x183355[_0xa1e5('0x2f')]=_[_0xa1e5('0x30')](_0x183355[_0xa1e5('0x31')],_0x183355['query']);_0xa7d783['attributes']=_[_0xa1e5('0x30')](_0x183355[_0xa1e5('0x31')],qs['fields'](_0x3d8f97[_0xa1e5('0x2d')]['fields']));_0xa7d783[_0xa1e5('0x32')]=_0xa7d783['attributes'][_0xa1e5('0x33')]?_0xa7d783[_0xa1e5('0x32')]:_0x183355['model'];if(!_0x3d8f97['query'][_0xa1e5('0x34')]('nolimit')){_0xa7d783[_0xa1e5('0x1b')]=qs[_0xa1e5('0x1b')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x1b')]);_0xa7d783['offset']=qs[_0xa1e5('0x18')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x18')]);}_0xa7d783['order']=qs[_0xa1e5('0x35')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x35')]);_0xa7d783[_0xa1e5('0x36')]=qs[_0xa1e5('0x2f')](_['pick'](_0x3d8f97['query'],_0x183355[_0xa1e5('0x2f')]),_0x43d9f3);if(_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x37')]){_0xa7d783[_0xa1e5('0x36')]=_['merge'](_0xa7d783[_0xa1e5('0x36')],{'$or':_[_0xa1e5('0x38')](_0x43d9f3,function(_0x344741){if(_0x344741[_0xa1e5('0x2b')]!==_0xa1e5('0x39')){var _0x2e5178={};_0x2e5178[_0x344741[_0xa1e5('0x27')]]={'$like':'%'+_0x3d8f97['query'][_0xa1e5('0x37')]+'%'};return _0x2e5178;}})});}_0xa7d783=_[_0xa1e5('0x3a')]({},_0xa7d783,_0x3d8f97[_0xa1e5('0x3b')]);var _0x6d2749={'where':_0xa7d783['where']};return db['FreshsalesAccount'][_0xa1e5('0x1a')](_0x6d2749)[_0xa1e5('0x22')](function(_0x4c08f0){_0x5ddfd9['count']=_0x4c08f0;if(_0x3d8f97['query']['includeAll']){_0xa7d783['include']=[{'all':!![]}];}return db[_0xa1e5('0x29')][_0xa1e5('0x3c')](_0xa7d783);})[_0xa1e5('0x22')](function(_0x30349c){_0x5ddfd9[_0xa1e5('0x3d')]=_0x30349c;return _0x5ddfd9;})[_0xa1e5('0x22')](respondWithFilteredResult(_0x19c4a5,_0xa7d783))['catch'](handleError(_0x19c4a5,null));};exports[_0xa1e5('0x3e')]=function(_0x5b64e,_0x3efe07){var _0x119f28={'raw':![],'where':{'id':_0x5b64e[_0xa1e5('0x3f')]['id']}},_0x3a72f6={};_0x3a72f6[_0xa1e5('0x31')]=_[_0xa1e5('0x2e')](db[_0xa1e5('0x29')][_0xa1e5('0x2a')]);_0x3a72f6[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x5b64e[_0xa1e5('0x2d')]);_0x3a72f6[_0xa1e5('0x2f')]=_['intersection'](_0x3a72f6[_0xa1e5('0x31')],_0x3a72f6[_0xa1e5('0x2d')]);_0x119f28[_0xa1e5('0x32')]=_['intersection'](_0x3a72f6[_0xa1e5('0x31')],qs[_0xa1e5('0x40')](_0x5b64e[_0xa1e5('0x2d')][_0xa1e5('0x40')]));_0x119f28[_0xa1e5('0x32')]=_0x119f28[_0xa1e5('0x32')][_0xa1e5('0x33')]?_0x119f28['attributes']:_0x3a72f6[_0xa1e5('0x31')];if(_0x5b64e[_0xa1e5('0x2d')]['includeAll']){_0x119f28['include']=[{'all':!![]}];}_0x119f28=_[_0xa1e5('0x3a')]({},_0x119f28,_0x5b64e['options']);return db[_0xa1e5('0x29')][_0xa1e5('0x41')](_0x119f28)['then'](handleEntityNotFound(_0x3efe07,null))[_0xa1e5('0x22')](respondWithResult(_0x3efe07,null))[_0xa1e5('0x42')](handleError(_0x3efe07,null));};exports[_0xa1e5('0x43')]=function(_0x16d6f8,_0x25079a){return db[_0xa1e5('0x29')][_0xa1e5('0x43')](_0x16d6f8[_0xa1e5('0x44')],{})[_0xa1e5('0x22')](respondWithResult(_0x25079a,0xc9))[_0xa1e5('0x42')](handleError(_0x25079a,null));};exports[_0xa1e5('0x21')]=function(_0x3a4a58,_0x4d3a10){if(_0x3a4a58[_0xa1e5('0x44')]['id']){delete _0x3a4a58['body']['id'];}return db['FreshsalesAccount'][_0xa1e5('0x41')]({'where':{'id':_0x3a4a58[_0xa1e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d3a10,null))[_0xa1e5('0x22')](saveUpdates(_0x3a4a58['body'],null))[_0xa1e5('0x22')](respondWithResult(_0x4d3a10,null))[_0xa1e5('0x42')](handleError(_0x4d3a10,null));};exports['destroy']=function(_0x19492a,_0x5f0cef){return db[_0xa1e5('0x29')][_0xa1e5('0x41')]({'where':{'id':_0x19492a[_0xa1e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5f0cef,null))[_0xa1e5('0x22')](removeEntity(_0x5f0cef,null))[_0xa1e5('0x42')](handleError(_0x5f0cef,null));};exports['getConfigurations']=function(_0x243add,_0x14991e,_0x4e4038){var _0x1566ba={};var _0x1c237f={};var _0x5f0c97;var _0x3317b2;return db[_0xa1e5('0x29')]['findOne']({'where':{'id':_0x243add['params']['id']}})[_0xa1e5('0x22')](handleEntityNotFound(_0x14991e,null))[_0xa1e5('0x22')](function(_0x40780a){if(_0x40780a){_0x5f0c97=_0x40780a;_0x1c237f[_0xa1e5('0x31')]=_[_0xa1e5('0x2e')](db[_0xa1e5('0x45')]['rawAttributes']);_0x1c237f[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x243add[_0xa1e5('0x2d')]);_0x1c237f[_0xa1e5('0x2f')]=_[_0xa1e5('0x30')](_0x1c237f[_0xa1e5('0x31')],_0x1c237f[_0xa1e5('0x2d')]);_0x1566ba[_0xa1e5('0x32')]=_[_0xa1e5('0x30')](_0x1c237f[_0xa1e5('0x31')],qs[_0xa1e5('0x40')](_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x40')]));_0x1566ba[_0xa1e5('0x32')]=_0x1566ba[_0xa1e5('0x32')][_0xa1e5('0x33')]?_0x1566ba[_0xa1e5('0x32')]:_0x1c237f[_0xa1e5('0x31')];_0x1566ba[_0xa1e5('0x46')]=qs[_0xa1e5('0x35')](_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x35')]);_0x1566ba[_0xa1e5('0x36')]=qs['filters'](_[_0xa1e5('0x47')](_0x243add['query'],_0x1c237f['filters']));if(_0x243add['query'][_0xa1e5('0x37')]){_0x1566ba[_0xa1e5('0x36')]=_[_0xa1e5('0x3a')](_0x1566ba['where'],{'$or':_[_0xa1e5('0x38')](_0x1566ba[_0xa1e5('0x32')],function(_0x2ef3df){var _0x536962={};_0x536962[_0x2ef3df]={'$like':'%'+_0x243add['query']['filter']+'%'};return _0x536962;})});}_0x1566ba=_[_0xa1e5('0x3a')]({},_0x1566ba,_0x243add['options']);return _0x5f0c97['getConfigurations'](_0x1566ba);}})[_0xa1e5('0x22')](function(_0x10eeed){if(_0x10eeed){_0x3317b2=_0x10eeed['length'];if(!_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x34')](_0xa1e5('0x48'))){_0x1566ba['limit']=qs[_0xa1e5('0x1b')](_0x243add[_0xa1e5('0x2d')]['limit']);_0x1566ba[_0xa1e5('0x18')]=qs['offset'](_0x243add['query'][_0xa1e5('0x18')]);}return _0x5f0c97[_0xa1e5('0x49')](_0x1566ba);}})[_0xa1e5('0x22')](function(_0x170462){if(_0x170462){return _0x170462?{'count':_0x3317b2,'rows':_0x170462}:null;}})[_0xa1e5('0x22')](respondWithResult(_0x14991e,null))['catch'](handleError(_0x14991e,null));};exports['addConfiguration']=function(_0x87b9f4,_0x27fe6d,_0x980ffa){if(_0x87b9f4[_0xa1e5('0x44')]['id']){delete _0x87b9f4[_0xa1e5('0x44')]['id'];}return db['FreshsalesAccount'][_0xa1e5('0x4a')]({'where':{'id':_0x87b9f4['params']['id']}})[_0xa1e5('0x22')](handleEntityNotFound(_0x27fe6d,null))[_0xa1e5('0x22')](function(_0x34b65b){if(_0x34b65b){_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x4b')]=_0x34b65b['id'];_0x87b9f4['body']['Subjects']=integrations[_0xa1e5('0x4c')](_0x87b9f4[_0xa1e5('0x44')]['channel'],_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x2b')]);_0x87b9f4['body'][_0xa1e5('0x4d')]=integrations[_0xa1e5('0x4e')](_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x4f')],_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x2b')]);return db[_0xa1e5('0x45')][_0xa1e5('0x43')](_0x87b9f4[_0xa1e5('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0xa1e5('0x50')},{'model':db[_0xa1e5('0x51')],'as':'Descriptions'}]});}return null;})[_0xa1e5('0x22')](respondWithResult(_0x27fe6d,null))['catch'](handleError(_0x27fe6d,null));};exports[_0xa1e5('0x52')]=function(_0x15af1d,_0x67df10,_0x2f8d1a){var _0x426f54='';var _0x29a509='';return db[_0xa1e5('0x29')][_0xa1e5('0x4a')]({'where':{'id':_0x15af1d[_0xa1e5('0x3f')]['id']},'attributes':['id',_0xa1e5('0x53'),'remoteUri','apiKey']})[_0xa1e5('0x22')](handleEntityNotFound(_0x67df10,null))['then'](function(_0x36ed6c){if(_0x36ed6c){_0x29a509=_0x36ed6c[_0xa1e5('0x53')];_0x426f54=_0x36ed6c['remoteUri'];var _0x22a2ce=_0x36ed6c[_0xa1e5('0x54')][_0xa1e5('0x55')](-0x1);if(_0x22a2ce==='/'){_0x426f54=_0x426f54[_0xa1e5('0x56')](0x0,_0x426f54[_0xa1e5('0x57')](_0x22a2ce));}return rp({'method':_0xa1e5('0x58'),'uri':util[_0xa1e5('0x59')]('%s%s',_0x426f54,_0xa1e5('0x5a')),'headers':{'Authorization':_0xa1e5('0x5b')+_0x36ed6c['apiKey']},'json':!![]});}})[_0xa1e5('0x22')](function(_0x15b6bb){if(_0x15b6bb){var _0x2aa511=_0x15b6bb[_0xa1e5('0x5c')];var _0x3626d5=![];var _0x1b4b0f=null;for(_0x1b4b0f=0x0;_0x1b4b0f<_0x2aa511[_0xa1e5('0x33')];_0x1b4b0f++){if(_0x2aa511[_0x1b4b0f][_0xa1e5('0x5d')]===_0x29a509){_0x3626d5=!![];}}if(_0x3626d5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xa1e5('0x22')](respondWithResult(_0x67df10,null))[_0xa1e5('0x42')](function(_0x4da82e){var _0x1d9471=_0x15af1d['query'][_0xa1e5('0x5e')]?0x1f4:_0x4da82e['statusCode']||0x1f4;logger['error'](_0xa1e5('0x5f'),_0xa1e5('0x52'),_0x1d9471,JSON['stringify'](_0x4da82e));delete _0x4da82e[_0xa1e5('0x27')];if(_0x1d9471===0x191){_0x1d9471=0x190;}_0x67df10['status'](_0x1d9471)[_0xa1e5('0x28')](_0x15af1d[_0xa1e5('0x2d')]['test']?{'message':_0xa1e5('0x60'),'statusCode':_0x4da82e[_0xa1e5('0x61')]}:_0x4da82e);});}; \ No newline at end of file +var _0x9002=['body','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','username','lastIndexOf','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create'];(function(_0x58fdfd,_0x46f063){var _0x3a4613=function(_0x4b6a77){while(--_0x4b6a77){_0x58fdfd['push'](_0x58fdfd['shift']());}};_0x3a4613(++_0x46f063);}(_0x9002,0x1b3));var _0x2900=function(_0x40bc3c,_0xffb79){_0x40bc3c=_0x40bc3c-0x0;var _0x3e69b1=_0x9002[_0x40bc3c];return _0x3e69b1;};'use strict';var emlformat=require(_0x2900('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2900('0x1'));var moment=require(_0x2900('0x2'));var BPromise=require(_0x2900('0x3'));var Mustache=require(_0x2900('0x4'));var util=require(_0x2900('0x5'));var path=require(_0x2900('0x6'));var sox=require(_0x2900('0x7'));var csv=require(_0x2900('0x8'));var ejs=require(_0x2900('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2900('0xa'));var squel=require(_0x2900('0xb'));var crypto=require('crypto');var jsforce=require(_0x2900('0xc'));var deskjs=require(_0x2900('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2900('0xe'));var Papa=require(_0x2900('0xf'));var Redis=require(_0x2900('0x10'));var authService=require(_0x2900('0x11'));var qs=require(_0x2900('0x12'));var as=require(_0x2900('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2900('0x14'))(_0x2900('0x15'));var utils=require(_0x2900('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2900('0x17'));var db=require(_0x2900('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4435ea,_0x58ca34){_0x58ca34=_0x58ca34||0xcc;return function(_0x382299){if(_0x382299){return _0x4435ea[_0x2900('0x19')](_0x58ca34);}return _0x4435ea['status'](_0x58ca34)[_0x2900('0x1a')]();};}function respondWithResult(_0x35eb39,_0x268430){_0x268430=_0x268430||0xc8;return function(_0x19ed6f){if(_0x19ed6f){return _0x35eb39[_0x2900('0x1b')](_0x268430)[_0x2900('0x1c')](_0x19ed6f);}};}function respondWithFilteredResult(_0x368bb1,_0x1962a9){return function(_0x1b0b0){if(_0x1b0b0){var _0x871333=typeof _0x1962a9[_0x2900('0x1d')]===_0x2900('0x1e')&&typeof _0x1962a9['limit']==='undefined';var _0x26b67a=_0x1b0b0[_0x2900('0x1f')];var _0xf7ce03=_0x871333?0x0:_0x1962a9[_0x2900('0x1d')];var _0x59cc58=_0x871333?_0x1b0b0['count']:_0x1962a9[_0x2900('0x1d')]+_0x1962a9[_0x2900('0x20')];var _0xb6b5c6;if(_0x59cc58>=_0x26b67a){_0x59cc58=_0x26b67a;_0xb6b5c6=0xc8;}else{_0xb6b5c6=0xce;}_0x368bb1[_0x2900('0x1b')](_0xb6b5c6);return _0x368bb1[_0x2900('0x21')](_0x2900('0x22'),_0xf7ce03+'-'+_0x59cc58+'/'+_0x26b67a)[_0x2900('0x1c')](_0x1b0b0);}return null;};}function patchUpdates(_0x451dd3){return function(_0x5167f7){try{jsonpatch[_0x2900('0x23')](_0x5167f7,_0x451dd3,!![]);}catch(_0x4745e0){return BPromise['reject'](_0x4745e0);}return _0x5167f7[_0x2900('0x24')]();};}function saveUpdates(_0x42bb5f,_0x555804){return function(_0x36b302){if(_0x36b302){return _0x36b302[_0x2900('0x25')](_0x42bb5f)[_0x2900('0x26')](function(_0x578faf){return _0x578faf;});}return null;};}function removeEntity(_0x4b7d9b,_0x3abb8a){return function(_0x462783){if(_0x462783){return _0x462783[_0x2900('0x27')]()[_0x2900('0x26')](function(){_0x4b7d9b[_0x2900('0x1b')](0xcc)[_0x2900('0x1a')]();});}};}function handleEntityNotFound(_0x234d1f,_0x357465){return function(_0x1f5808){if(!_0x1f5808){_0x234d1f['sendStatus'](0x194);}return _0x1f5808;};}function handleError(_0x1f53ba,_0x477423){_0x477423=_0x477423||0x1f4;return function(_0x48b042){logger[_0x2900('0x28')](_0x48b042[_0x2900('0x29')]);if(_0x48b042[_0x2900('0x2a')]){delete _0x48b042[_0x2900('0x2a')];}_0x1f53ba[_0x2900('0x1b')](_0x477423)[_0x2900('0x2b')](_0x48b042);};}exports[_0x2900('0x2c')]=function(_0x3e5f83,_0x5d8bfe){var _0x4f75c1={},_0x33c699={},_0x2a7d46={'count':0x0,'rows':[]};var _0x2fbf15=_[_0x2900('0x2d')](db[_0x2900('0x2e')]['rawAttributes'],function(_0x3f1769){return{'name':_0x3f1769['fieldName'],'type':_0x3f1769[_0x2900('0x2f')][_0x2900('0x30')]};});_0x33c699[_0x2900('0x31')]=_[_0x2900('0x2d')](_0x2fbf15,_0x2900('0x2a'));_0x33c699[_0x2900('0x32')]=_[_0x2900('0x33')](_0x3e5f83[_0x2900('0x32')]);_0x33c699['filters']=_[_0x2900('0x34')](_0x33c699[_0x2900('0x31')],_0x33c699[_0x2900('0x32')]);_0x4f75c1[_0x2900('0x35')]=_[_0x2900('0x34')](_0x33c699[_0x2900('0x31')],qs[_0x2900('0x36')](_0x3e5f83[_0x2900('0x32')][_0x2900('0x36')]));_0x4f75c1[_0x2900('0x35')]=_0x4f75c1['attributes'][_0x2900('0x37')]?_0x4f75c1[_0x2900('0x35')]:_0x33c699[_0x2900('0x31')];if(!_0x3e5f83['query'][_0x2900('0x38')](_0x2900('0x39'))){_0x4f75c1[_0x2900('0x20')]=qs[_0x2900('0x20')](_0x3e5f83['query'][_0x2900('0x20')]);_0x4f75c1[_0x2900('0x1d')]=qs[_0x2900('0x1d')](_0x3e5f83['query']['offset']);}_0x4f75c1[_0x2900('0x3a')]=qs['sort'](_0x3e5f83[_0x2900('0x32')][_0x2900('0x3b')]);_0x4f75c1[_0x2900('0x3c')]=qs[_0x2900('0x3d')](_['pick'](_0x3e5f83[_0x2900('0x32')],_0x33c699[_0x2900('0x3d')]),_0x2fbf15);if(_0x3e5f83[_0x2900('0x32')][_0x2900('0x3e')]){_0x4f75c1[_0x2900('0x3c')]=_[_0x2900('0x3f')](_0x4f75c1[_0x2900('0x3c')],{'$or':_[_0x2900('0x2d')](_0x2fbf15,function(_0x13a507){if(_0x13a507['type']!==_0x2900('0x40')){var _0x4db583={};_0x4db583[_0x13a507[_0x2900('0x2a')]]={'$like':'%'+_0x3e5f83[_0x2900('0x32')][_0x2900('0x3e')]+'%'};return _0x4db583;}})});}_0x4f75c1=_[_0x2900('0x3f')]({},_0x4f75c1,_0x3e5f83[_0x2900('0x41')]);var _0x50d901={'where':_0x4f75c1[_0x2900('0x3c')]};return db['FreshsalesAccount'][_0x2900('0x1f')](_0x50d901)[_0x2900('0x26')](function(_0x85f8f6){_0x2a7d46['count']=_0x85f8f6;if(_0x3e5f83[_0x2900('0x32')]['includeAll']){_0x4f75c1[_0x2900('0x42')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x2900('0x43')](_0x4f75c1);})['then'](function(_0x36150d){_0x2a7d46[_0x2900('0x44')]=_0x36150d;return _0x2a7d46;})[_0x2900('0x26')](respondWithFilteredResult(_0x5d8bfe,_0x4f75c1))[_0x2900('0x45')](handleError(_0x5d8bfe,null));};exports['show']=function(_0x23dbb7,_0x565d8b){var _0x439119={'raw':![],'where':{'id':_0x23dbb7[_0x2900('0x46')]['id']}},_0x1250e3={};_0x1250e3[_0x2900('0x31')]=_[_0x2900('0x33')](db[_0x2900('0x2e')][_0x2900('0x47')]);_0x1250e3[_0x2900('0x32')]=_[_0x2900('0x33')](_0x23dbb7[_0x2900('0x32')]);_0x1250e3[_0x2900('0x3d')]=_[_0x2900('0x34')](_0x1250e3['model'],_0x1250e3['query']);_0x439119[_0x2900('0x35')]=_[_0x2900('0x34')](_0x1250e3[_0x2900('0x31')],qs['fields'](_0x23dbb7['query']['fields']));_0x439119[_0x2900('0x35')]=_0x439119[_0x2900('0x35')][_0x2900('0x37')]?_0x439119[_0x2900('0x35')]:_0x1250e3['model'];if(_0x23dbb7[_0x2900('0x32')][_0x2900('0x48')]){_0x439119[_0x2900('0x42')]=[{'all':!![]}];}_0x439119=_['merge']({},_0x439119,_0x23dbb7['options']);return db['FreshsalesAccount'][_0x2900('0x49')](_0x439119)[_0x2900('0x26')](handleEntityNotFound(_0x565d8b,null))[_0x2900('0x26')](respondWithResult(_0x565d8b,null))[_0x2900('0x45')](handleError(_0x565d8b,null));};exports['create']=function(_0x40e215,_0x1e5c6f){return db[_0x2900('0x2e')][_0x2900('0x4a')](_0x40e215[_0x2900('0x4b')],{})['then'](respondWithResult(_0x1e5c6f,0xc9))[_0x2900('0x45')](handleError(_0x1e5c6f,null));};exports[_0x2900('0x25')]=function(_0x4ddd33,_0x3ffefd){if(_0x4ddd33['body']['id']){delete _0x4ddd33['body']['id'];}return db[_0x2900('0x2e')][_0x2900('0x49')]({'where':{'id':_0x4ddd33['params']['id']}})[_0x2900('0x26')](handleEntityNotFound(_0x3ffefd,null))[_0x2900('0x26')](saveUpdates(_0x4ddd33['body'],null))['then'](respondWithResult(_0x3ffefd,null))['catch'](handleError(_0x3ffefd,null));};exports[_0x2900('0x27')]=function(_0x4ad0f8,_0x4bb309){return db[_0x2900('0x2e')][_0x2900('0x49')]({'where':{'id':_0x4ad0f8[_0x2900('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bb309,null))[_0x2900('0x26')](removeEntity(_0x4bb309,null))[_0x2900('0x45')](handleError(_0x4bb309,null));};exports[_0x2900('0x4c')]=function(_0x4debe4,_0x126f4a,_0x4751aa){var _0x1ffbde={};var _0x304323={};var _0x34cd4a;var _0x55555e;return db['FreshsalesAccount'][_0x2900('0x4d')]({'where':{'id':_0x4debe4[_0x2900('0x46')]['id']}})[_0x2900('0x26')](handleEntityNotFound(_0x126f4a,null))[_0x2900('0x26')](function(_0x40fc48){if(_0x40fc48){_0x34cd4a=_0x40fc48;_0x304323['model']=_[_0x2900('0x33')](db['FreshsalesConfiguration'][_0x2900('0x47')]);_0x304323[_0x2900('0x32')]=_['keys'](_0x4debe4[_0x2900('0x32')]);_0x304323[_0x2900('0x3d')]=_[_0x2900('0x34')](_0x304323[_0x2900('0x31')],_0x304323[_0x2900('0x32')]);_0x1ffbde[_0x2900('0x35')]=_['intersection'](_0x304323['model'],qs[_0x2900('0x36')](_0x4debe4[_0x2900('0x32')][_0x2900('0x36')]));_0x1ffbde[_0x2900('0x35')]=_0x1ffbde[_0x2900('0x35')][_0x2900('0x37')]?_0x1ffbde[_0x2900('0x35')]:_0x304323[_0x2900('0x31')];_0x1ffbde[_0x2900('0x3a')]=qs[_0x2900('0x3b')](_0x4debe4['query']['sort']);_0x1ffbde[_0x2900('0x3c')]=qs['filters'](_[_0x2900('0x4e')](_0x4debe4[_0x2900('0x32')],_0x304323[_0x2900('0x3d')]));if(_0x4debe4[_0x2900('0x32')][_0x2900('0x3e')]){_0x1ffbde[_0x2900('0x3c')]=_[_0x2900('0x3f')](_0x1ffbde['where'],{'$or':_[_0x2900('0x2d')](_0x1ffbde[_0x2900('0x35')],function(_0x32b5e6){var _0x1c9699={};_0x1c9699[_0x32b5e6]={'$like':'%'+_0x4debe4[_0x2900('0x32')]['filter']+'%'};return _0x1c9699;})});}_0x1ffbde=_[_0x2900('0x3f')]({},_0x1ffbde,_0x4debe4[_0x2900('0x41')]);return _0x34cd4a[_0x2900('0x4c')](_0x1ffbde);}})[_0x2900('0x26')](function(_0x507743){if(_0x507743){_0x55555e=_0x507743['length'];if(!_0x4debe4[_0x2900('0x32')][_0x2900('0x38')](_0x2900('0x39'))){_0x1ffbde[_0x2900('0x20')]=qs[_0x2900('0x20')](_0x4debe4[_0x2900('0x32')][_0x2900('0x20')]);_0x1ffbde['offset']=qs[_0x2900('0x1d')](_0x4debe4[_0x2900('0x32')]['offset']);}return _0x34cd4a[_0x2900('0x4c')](_0x1ffbde);}})[_0x2900('0x26')](function(_0x3307bd){if(_0x3307bd){return _0x3307bd?{'count':_0x55555e,'rows':_0x3307bd}:null;}})['then'](respondWithResult(_0x126f4a,null))[_0x2900('0x45')](handleError(_0x126f4a,null));};exports['addConfiguration']=function(_0x1a8e9a,_0x598726,_0x435b1e){if(_0x1a8e9a[_0x2900('0x4b')]['id']){delete _0x1a8e9a[_0x2900('0x4b')]['id'];}return db[_0x2900('0x2e')][_0x2900('0x4d')]({'where':{'id':_0x1a8e9a[_0x2900('0x46')]['id']}})[_0x2900('0x26')](handleEntityNotFound(_0x598726,null))['then'](function(_0x210182){if(_0x210182){_0x1a8e9a[_0x2900('0x4b')][_0x2900('0x4f')]=_0x210182['id'];_0x1a8e9a[_0x2900('0x4b')][_0x2900('0x50')]=integrations[_0x2900('0x51')](_0x1a8e9a['body'][_0x2900('0x52')],_0x1a8e9a[_0x2900('0x4b')][_0x2900('0x2f')]);_0x1a8e9a['body'][_0x2900('0x53')]=integrations['getDescriptions'](_0x1a8e9a[_0x2900('0x4b')][_0x2900('0x52')],_0x1a8e9a[_0x2900('0x4b')][_0x2900('0x2f')]);return db[_0x2900('0x54')]['create'](_0x1a8e9a[_0x2900('0x4b')],{'include':[{'model':db[_0x2900('0x55')],'as':_0x2900('0x50')},{'model':db[_0x2900('0x55')],'as':'Descriptions'}]});}return null;})[_0x2900('0x26')](respondWithResult(_0x598726,null))[_0x2900('0x45')](handleError(_0x598726,null));};exports[_0x2900('0x56')]=function(_0x19b2be,_0x11b450,_0x5be508){var _0x4da6f3='';var _0x5e1c46='';return db[_0x2900('0x2e')][_0x2900('0x4d')]({'where':{'id':_0x19b2be['params']['id']},'attributes':['id','username',_0x2900('0x57'),'apiKey']})[_0x2900('0x26')](handleEntityNotFound(_0x11b450,null))[_0x2900('0x26')](function(_0x5f265f){if(_0x5f265f){_0x5e1c46=_0x5f265f[_0x2900('0x58')];_0x4da6f3=_0x5f265f[_0x2900('0x57')];var _0x3010f3=_0x5f265f[_0x2900('0x57')]['slice'](-0x1);if(_0x3010f3==='/'){_0x4da6f3=_0x4da6f3['substring'](0x0,_0x4da6f3[_0x2900('0x59')](_0x3010f3));}return rp({'method':'GET','uri':util[_0x2900('0x5a')](_0x2900('0x5b'),_0x4da6f3,_0x2900('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x5f265f[_0x2900('0x5d')]},'json':!![]});}})[_0x2900('0x26')](function(_0x5e7467){if(_0x5e7467){var _0x36e3cf=_0x5e7467[_0x2900('0x5e')];var _0x14c1af=![];var _0x93d1d3=null;for(_0x93d1d3=0x0;_0x93d1d3<_0x36e3cf[_0x2900('0x37')];_0x93d1d3++){if(_0x36e3cf[_0x93d1d3][_0x2900('0x5f')]===_0x5e1c46){_0x14c1af=!![];}}if(_0x14c1af){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2900('0x60')});}}})[_0x2900('0x26')](respondWithResult(_0x11b450,null))['catch'](function(_0xc99772){var _0x5eee4a=_0x19b2be[_0x2900('0x32')][_0x2900('0x61')]?0x1f4:_0xc99772[_0x2900('0x62')]||0x1f4;logger[_0x2900('0x28')](_0x2900('0x63'),_0x2900('0x56'),_0x5eee4a,JSON[_0x2900('0x64')](_0xc99772));delete _0xc99772[_0x2900('0x2a')];if(_0x5eee4a===0x191){_0x5eee4a=0x190;}_0x11b450[_0x2900('0x1b')](_0x5eee4a)[_0x2900('0x2b')](_0x19b2be['query'][_0x2900('0x61')]?{'message':_0x2900('0x65'),'statusCode':_0xc99772[_0x2900('0x62')]}:_0xc99772);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f219c8b..6f1c1ff 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 _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x2e3f40,_0x47410c){var _0x28abc1=function(_0x472028){while(--_0x472028){_0x2e3f40['push'](_0x2e3f40['shift']());}};_0x28abc1(++_0x47410c);}(_0xdb28,0x106));var _0x8db2=function(_0x273ee3,_0x2dd4d5){_0x273ee3=_0x273ee3-0x0;var _0x2dc76a=_0xdb28[_0x273ee3];return _0x2dc76a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x8db2('0x9'));module[_0x8db2('0xa')]=function(_0x5f42ee,_0x494b40){return _0x5f42ee[_0x8db2('0xb')](_0x8db2('0xc'),attributes,{'tableName':_0x8db2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['../../components/integrations/configuration','exports','define','../../config/logger','api','rimraf','../../config/environment'];(function(_0x1de62e,_0x262431){var _0x583722=function(_0x266094){while(--_0x266094){_0x1de62e['push'](_0x1de62e['shift']());}};_0x583722(++_0x262431);}(_0x6343,0x168));var _0x3634=function(_0x97285c,_0x4adab1){_0x97285c=_0x97285c-0x0;var _0x5ebc7d=_0x6343[_0x97285c];return _0x5ebc7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x3634('0x4'));module[_0x3634('0x5')]=function(_0x4bb496,_0x302828){return _0x4bb496[_0x3634('0x6')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 31dfa97..ddee03c 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 _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1668a9,_0x478d00){_0x1668a9=_0x1668a9-0x0;var _0x4d8dc2=_0x0a6b[_0x1668a9];return _0x4d8dc2;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file +var _0x5430=['map','model','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include'];(function(_0x24f411,_0x538bff){var _0x4616ca=function(_0x43cefc){while(--_0x43cefc){_0x24f411['push'](_0x24f411['shift']());}};_0x4616ca(++_0x538bff);}(_0x5430,0x10c));var _0x0543=function(_0x5e791b,_0x131282){_0x5e791b=_0x5e791b-0x0;var _0x4b4201=_0x5430[_0x5e791b];return _0x4b4201;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['findAll']({'raw':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x20b396[_0x0543('0x17')]?_0x20b396['options'][_0x0543('0x19')]||null:null,'attributes':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'limit':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1b')]||null:null,'include':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x20b396['options']['include'],function(_0x59f1b2){return{'model':db[_0x59f1b2[_0x0543('0x1e')]],'as':_0x59f1b2['as'],'attributes':_0x59f1b2[_0x0543('0x1a')],'include':_0x59f1b2[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x59f1b2[_0x0543('0x1c')],function(_0x26e500){return{'model':db[_0x26e500[_0x0543('0x1e')]],'as':_0x26e500['as'],'attributes':_0x26e500[_0x0543('0x1a')],'include':_0x26e500[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x26e500[_0x0543('0x1c')],function(_0x21fc63){return{'model':db[_0x21fc63['model']],'as':_0x21fc63['as'],'attributes':_0x21fc63[_0x0543('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x30ad9e){logger['info'](_0x0543('0x15'),_0x20b396);logger[_0x0543('0xe')](_0x0543('0x15'),_0x20b396,JSON[_0x0543('0xf')](_0x30ad9e));_0x577cf0(_0x30ad9e);})['catch'](function(_0x1732be){logger[_0x0543('0x10')]('GetFreshsalesAccount',_0x1732be['message'],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x1732be[_0x0543('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x3b879b){var _0x2e03d1=this;return new Promise(function(_0x931ccc,_0x2bd6ce){return db[_0x0543('0x16')][_0x0543('0x1f')]({'raw':_0x3b879b[_0x0543('0x17')]?_0x3b879b['options'][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')][_0x0543('0x19')]||null:null,'attributes':_0x3b879b[_0x0543('0x17')]?_0x3b879b[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'include':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')]['include']?_[_0x0543('0x1d')](_0x3b879b[_0x0543('0x17')][_0x0543('0x1c')],function(_0x327027){return{'model':db[_0x327027['model']],'as':_0x327027['as'],'attributes':_0x327027[_0x0543('0x1a')],'include':_0x327027['include']?_[_0x0543('0x1d')](_0x327027[_0x0543('0x1c')],function(_0x3fbf5f){return{'model':db[_0x3fbf5f[_0x0543('0x1e')]],'as':_0x3fbf5f['as'],'attributes':_0x3fbf5f[_0x0543('0x1a')],'include':_0x3fbf5f[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x3fbf5f[_0x0543('0x1c')],function(_0x8ef4d4){return{'model':db[_0x8ef4d4[_0x0543('0x1e')]],'as':_0x8ef4d4['as'],'attributes':_0x8ef4d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x2d76d6){logger['info'](_0x0543('0x20'),_0x3b879b);logger['debug'](_0x0543('0x20'),_0x3b879b,JSON[_0x0543('0xf')](_0x2d76d6));_0x931ccc(_0x2d76d6);})['catch'](function(_0x5e8800){logger[_0x0543('0x10')](_0x0543('0x20'),_0x5e8800['message'],_0x3b879b);_0x2bd6ce(_0x2e03d1[_0x0543('0x10')](0x1f4,_0x5e8800[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5394268..43ca6be 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 _0x49d2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x4339df,_0x568b7d){var _0x38c44c=function(_0x41983d){while(--_0x41983d){_0x4339df['push'](_0x4339df['shift']());}};_0x38c44c(++_0x568b7d);}(_0x49d2,0x67));var _0x249d=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x49d2[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x249d('0x0'));var util=require(_0x249d('0x1'));var path=require(_0x249d('0x2'));var timeout=require(_0x249d('0x3'));var express=require('express');var router=express[_0x249d('0x4')]();var fs_extra=require(_0x249d('0x5'));var auth=require(_0x249d('0x6'));var interaction=require(_0x249d('0x7'));var config=require(_0x249d('0x8'));var controller=require(_0x249d('0x9'));router[_0x249d('0xa')]('/',auth[_0x249d('0xb')](),controller[_0x249d('0xc')]);router[_0x249d('0xa')](_0x249d('0xd'),auth[_0x249d('0xb')](),controller[_0x249d('0xe')]);router[_0x249d('0xa')](_0x249d('0xf'),auth[_0x249d('0xb')](),controller[_0x249d('0x10')]);router[_0x249d('0xa')](_0x249d('0x11'),auth[_0x249d('0xb')](),controller[_0x249d('0x12')]);router['get'](_0x249d('0x13'),auth[_0x249d('0xb')](),controller['getFields']);router[_0x249d('0x14')]('/',auth[_0x249d('0xb')](),controller[_0x249d('0x15')]);router[_0x249d('0x16')](_0x249d('0xd'),auth[_0x249d('0xb')](),controller[_0x249d('0x17')]);router[_0x249d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x249d('0x19')]);module[_0x249d('0x1a')]=router; \ No newline at end of file +var _0x31be=['getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects'];(function(_0x2fcd37,_0x4b0f21){var _0x165efe=function(_0x336a4c){while(--_0x336a4c){_0x2fcd37['push'](_0x2fcd37['shift']());}};_0x165efe(++_0x4b0f21);}(_0x31be,0x111));var _0xe31b=function(_0x3be48,_0x2c4fd0){_0x3be48=_0x3be48-0x0;var _0x343cce=_0x31be[_0x3be48];return _0x343cce;};'use strict';var multer=require('multer');var util=require(_0xe31b('0x0'));var path=require(_0xe31b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe31b('0x2'));var router=express[_0xe31b('0x3')]();var fs_extra=require(_0xe31b('0x4'));var auth=require(_0xe31b('0x5'));var interaction=require(_0xe31b('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xe31b('0x7')]('/',auth[_0xe31b('0x8')](),controller[_0xe31b('0x9')]);router[_0xe31b('0x7')](_0xe31b('0xa'),auth[_0xe31b('0x8')](),controller['show']);router['get'](_0xe31b('0xb'),auth[_0xe31b('0x8')](),controller[_0xe31b('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe31b('0xd')]);router[_0xe31b('0x7')](_0xe31b('0xe'),auth['isAuthenticated'](),controller[_0xe31b('0xf')]);router[_0xe31b('0x10')]('/',auth[_0xe31b('0x8')](),controller[_0xe31b('0x11')]);router[_0xe31b('0x12')](_0xe31b('0xa'),auth[_0xe31b('0x8')](),controller[_0xe31b('0x13')]);router['delete'](_0xe31b('0xa'),auth['isAuthenticated'](),controller[_0xe31b('0x14')]);module[_0xe31b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 86bc7f2..8243673 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 _0xddbb=['sequelize','exports','STRING'];(function(_0x5e1aae,_0xbc39f3){var _0x5078ff=function(_0x5072f9){while(--_0x5072f9){_0x5e1aae['push'](_0x5e1aae['shift']());}};_0x5078ff(++_0xbc39f3);}(_0xddbb,0x1a7));var _0xbddb=function(_0x5bf517,_0x470378){_0x5bf517=_0x5bf517-0x0;var _0x3bde4f=_0xddbb[_0x5bf517];return _0x3bde4f;};'use strict';var Sequelize=require(_0xbddb('0x0'));module[_0xbddb('0x1')]={'name':{'type':Sequelize[_0xbddb('0x2')]},'description':{'type':Sequelize[_0xbddb('0x2')]}}; \ No newline at end of file +var _0x5aa0=['exports','STRING','sequelize'];(function(_0x3d13bf,_0x3694db){var _0x5b6bbc=function(_0x5e0241){while(--_0x5e0241){_0x3d13bf['push'](_0x3d13bf['shift']());}};_0x5b6bbc(++_0x3694db);}(_0x5aa0,0x131));var _0x05aa=function(_0x4426fb,_0x356729){_0x4426fb=_0x4426fb-0x0;var _0x56841e=_0x5aa0[_0x4426fb];return _0x56841e;};'use strict';var Sequelize=require(_0x05aa('0x0'));module[_0x05aa('0x1')]={'name':{'type':Sequelize[_0x05aa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5177361..b34471f 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 _0x7089=['undefined','limit','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getSubjects','FreshsalesField','order','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x469190,_0x1f69f3){var _0x3e3a56=function(_0x5913b5){while(--_0x5913b5){_0x469190['push'](_0x469190['shift']());}};_0x3e3a56(++_0x1f69f3);}(_0x7089,0xd8));var _0x9708=function(_0x52f463,_0x3dee60){_0x52f463=_0x52f463-0x0;var _0x55e932=_0x7089[_0x52f463];return _0x55e932;};'use strict';var emlformat=require(_0x9708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9708('0x1'));var jsonpatch=require(_0x9708('0x2'));var rp=require('request-promise');var moment=require(_0x9708('0x3'));var BPromise=require(_0x9708('0x4'));var Mustache=require(_0x9708('0x5'));var util=require('util');var path=require(_0x9708('0x6'));var sox=require(_0x9708('0x7'));var csv=require('to-csv');var ejs=require(_0x9708('0x8'));var fs=require('fs');var fs_extra=require(_0x9708('0x9'));var _=require(_0x9708('0xa'));var squel=require('squel');var crypto=require(_0x9708('0xb'));var jsforce=require(_0x9708('0xc'));var deskjs=require(_0x9708('0xd'));var toCsv=require(_0x9708('0xe'));var querystring=require('querystring');var Papa=require(_0x9708('0xf'));var Redis=require(_0x9708('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9708('0x11'));var logger=require(_0x9708('0x12'))(_0x9708('0x13'));var utils=require(_0x9708('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9708('0x15'))['db'];function respondWithStatusCode(_0xa548fa,_0x3f6bab){_0x3f6bab=_0x3f6bab||0xcc;return function(_0x577fb7){if(_0x577fb7){return _0xa548fa[_0x9708('0x16')](_0x3f6bab);}return _0xa548fa['status'](_0x3f6bab)[_0x9708('0x17')]();};}function respondWithResult(_0x31397f,_0x138a65){_0x138a65=_0x138a65||0xc8;return function(_0x1c5d95){if(_0x1c5d95){return _0x31397f[_0x9708('0x18')](_0x138a65)[_0x9708('0x19')](_0x1c5d95);}};}function respondWithFilteredResult(_0x1eddc0,_0x3bcae4){return function(_0x980735){if(_0x980735){var _0x154a6a=typeof _0x3bcae4[_0x9708('0x1a')]===_0x9708('0x1b')&&typeof _0x3bcae4[_0x9708('0x1c')]===_0x9708('0x1b');var _0xbe3004=_0x980735[_0x9708('0x1d')];var _0x453835=_0x154a6a?0x0:_0x3bcae4[_0x9708('0x1a')];var _0x5935fd=_0x154a6a?_0x980735[_0x9708('0x1d')]:_0x3bcae4['offset']+_0x3bcae4[_0x9708('0x1c')];var _0x5e41d7;if(_0x5935fd>=_0xbe3004){_0x5935fd=_0xbe3004;_0x5e41d7=0xc8;}else{_0x5e41d7=0xce;}_0x1eddc0[_0x9708('0x18')](_0x5e41d7);return _0x1eddc0[_0x9708('0x1e')](_0x9708('0x1f'),_0x453835+'-'+_0x5935fd+'/'+_0xbe3004)[_0x9708('0x19')](_0x980735);}return null;};}function patchUpdates(_0x2ee0b1){return function(_0x3cd803){try{jsonpatch[_0x9708('0x20')](_0x3cd803,_0x2ee0b1,!![]);}catch(_0x117ce2){return BPromise[_0x9708('0x21')](_0x117ce2);}return _0x3cd803[_0x9708('0x22')]();};}function saveUpdates(_0x3bea52,_0x5055ba){return function(_0x2186c8){if(_0x2186c8){return _0x2186c8[_0x9708('0x23')](_0x3bea52)['then'](function(_0x59a10c){return _0x59a10c;});}return null;};}function removeEntity(_0x152c6e,_0x554af6){return function(_0x2eb3eb){if(_0x2eb3eb){return _0x2eb3eb['destroy']()['then'](function(){_0x152c6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bbbf,_0x4bc5c5){return function(_0x51145e){if(!_0x51145e){_0x29bbbf[_0x9708('0x16')](0x194);}return _0x51145e;};}function handleError(_0x22f944,_0x224eb7){_0x224eb7=_0x224eb7||0x1f4;return function(_0x4fd3cd){logger[_0x9708('0x24')](_0x4fd3cd['stack']);if(_0x4fd3cd[_0x9708('0x25')]){delete _0x4fd3cd[_0x9708('0x25')];}_0x22f944[_0x9708('0x18')](_0x224eb7)[_0x9708('0x26')](_0x4fd3cd);};}exports[_0x9708('0x27')]=function(_0x4c079d,_0x59398b){var _0x4643cb={},_0x193c84={},_0x361fd2={'count':0x0,'rows':[]};var _0x227fe5=_[_0x9708('0x28')](db[_0x9708('0x29')][_0x9708('0x2a')],function(_0x2a77a7){return{'name':_0x2a77a7[_0x9708('0x2b')],'type':_0x2a77a7['type'][_0x9708('0x2c')]};});_0x193c84[_0x9708('0x2d')]=_['map'](_0x227fe5,_0x9708('0x25'));_0x193c84[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x4c079d[_0x9708('0x2e')]);_0x193c84[_0x9708('0x30')]=_[_0x9708('0x31')](_0x193c84['model'],_0x193c84[_0x9708('0x2e')]);_0x4643cb[_0x9708('0x32')]=_[_0x9708('0x31')](_0x193c84[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x4c079d[_0x9708('0x2e')][_0x9708('0x33')]));_0x4643cb['attributes']=_0x4643cb[_0x9708('0x32')][_0x9708('0x34')]?_0x4643cb['attributes']:_0x193c84['model'];if(!_0x4c079d[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x4643cb[_0x9708('0x1c')]=qs['limit'](_0x4c079d[_0x9708('0x2e')]['limit']);_0x4643cb[_0x9708('0x1a')]=qs['offset'](_0x4c079d[_0x9708('0x2e')][_0x9708('0x1a')]);}_0x4643cb['order']=qs[_0x9708('0x37')](_0x4c079d[_0x9708('0x2e')]['sort']);_0x4643cb[_0x9708('0x38')]=qs[_0x9708('0x30')](_[_0x9708('0x39')](_0x4c079d[_0x9708('0x2e')],_0x193c84['filters']),_0x227fe5);if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]){_0x4643cb['where']=_[_0x9708('0x3b')](_0x4643cb[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x227fe5,function(_0x304bd2){if(_0x304bd2[_0x9708('0x3c')]!==_0x9708('0x3d')){var _0x42f2d0={};_0x42f2d0[_0x304bd2['name']]={'$like':'%'+_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x42f2d0;}})});}_0x4643cb=_[_0x9708('0x3b')]({},_0x4643cb,_0x4c079d[_0x9708('0x3e')]);var _0x50b3f3={'where':_0x4643cb[_0x9708('0x38')]};return db['FreshsalesConfiguration'][_0x9708('0x1d')](_0x50b3f3)[_0x9708('0x3f')](function(_0x2b6175){_0x361fd2[_0x9708('0x1d')]=_0x2b6175;if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x40')]){_0x4643cb['include']=[{'all':!![]}];}return db[_0x9708('0x29')][_0x9708('0x41')](_0x4643cb);})[_0x9708('0x3f')](function(_0x11f406){_0x361fd2[_0x9708('0x42')]=_0x11f406;return _0x361fd2;})[_0x9708('0x3f')](respondWithFilteredResult(_0x59398b,_0x4643cb))[_0x9708('0x43')](handleError(_0x59398b,null));};exports[_0x9708('0x44')]=function(_0x1b770a,_0x294451){var _0x339b6e={'raw':![],'where':{'id':_0x1b770a[_0x9708('0x45')]['id']}},_0x2bd19f={};_0x2bd19f[_0x9708('0x2d')]=_[_0x9708('0x2f')](db['FreshsalesConfiguration'][_0x9708('0x2a')]);_0x2bd19f[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x1b770a[_0x9708('0x2e')]);_0x2bd19f[_0x9708('0x30')]=_['intersection'](_0x2bd19f[_0x9708('0x2d')],_0x2bd19f['query']);_0x339b6e[_0x9708('0x32')]=_[_0x9708('0x31')](_0x2bd19f['model'],qs[_0x9708('0x33')](_0x1b770a[_0x9708('0x2e')][_0x9708('0x33')]));_0x339b6e['attributes']=_0x339b6e[_0x9708('0x32')]['length']?_0x339b6e[_0x9708('0x32')]:_0x2bd19f[_0x9708('0x2d')];if(_0x1b770a['query']['includeAll']){_0x339b6e[_0x9708('0x46')]=[{'all':!![]}];}_0x339b6e=_[_0x9708('0x3b')]({},_0x339b6e,_0x1b770a[_0x9708('0x3e')]);return db[_0x9708('0x29')][_0x9708('0x47')](_0x339b6e)['then'](handleEntityNotFound(_0x294451,null))['then'](respondWithResult(_0x294451,null))['catch'](handleError(_0x294451,null));};exports['create']=function(_0x36f1e5,_0x3d045b){return db[_0x9708('0x29')][_0x9708('0x48')](_0x36f1e5[_0x9708('0x49')],{})[_0x9708('0x3f')](respondWithResult(_0x3d045b,0xc9))[_0x9708('0x43')](handleError(_0x3d045b,null));};exports[_0x9708('0x23')]=function(_0x13cf6a,_0x505da8){if(_0x13cf6a[_0x9708('0x49')]['id']){delete _0x13cf6a['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x13cf6a['params']['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x505da8,null))[_0x9708('0x3f')](saveUpdates(_0x13cf6a['body'],null))[_0x9708('0x3f')](respondWithResult(_0x505da8,null))[_0x9708('0x43')](handleError(_0x505da8,null));};exports[_0x9708('0x4a')]=function(_0x44b577,_0x5a59b6){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x44b577[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x5a59b6,null))[_0x9708('0x3f')](removeEntity(_0x5a59b6,null))['catch'](handleError(_0x5a59b6,null));};exports[_0x9708('0x4b')]=function(_0x165e20,_0x41bf46,_0x27863e){var _0x28e39e={};var _0x5ae18c={};var _0x323487;var _0x2e471f;return db[_0x9708('0x29')]['findOne']({'where':{'id':_0x165e20[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x41bf46,null))[_0x9708('0x3f')](function(_0x27ca8c){if(_0x27ca8c){_0x323487=_0x27ca8c;_0x5ae18c[_0x9708('0x2d')]=_[_0x9708('0x2f')](db[_0x9708('0x4c')]['rawAttributes']);_0x5ae18c[_0x9708('0x2e')]=_['keys'](_0x165e20[_0x9708('0x2e')]);_0x5ae18c[_0x9708('0x30')]=_[_0x9708('0x31')](_0x5ae18c[_0x9708('0x2d')],_0x5ae18c[_0x9708('0x2e')]);_0x28e39e['attributes']=_[_0x9708('0x31')](_0x5ae18c[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x165e20[_0x9708('0x2e')][_0x9708('0x33')]));_0x28e39e[_0x9708('0x32')]=_0x28e39e[_0x9708('0x32')][_0x9708('0x34')]?_0x28e39e[_0x9708('0x32')]:_0x5ae18c[_0x9708('0x2d')];_0x28e39e[_0x9708('0x4d')]=qs[_0x9708('0x37')](_0x165e20[_0x9708('0x2e')][_0x9708('0x37')]);_0x28e39e['where']=qs[_0x9708('0x30')](_['pick'](_0x165e20[_0x9708('0x2e')],_0x5ae18c[_0x9708('0x30')]));if(_0x165e20[_0x9708('0x2e')][_0x9708('0x3a')]){_0x28e39e[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x28e39e[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x28e39e[_0x9708('0x32')],function(_0x1a02f8){var _0x156995={};_0x156995[_0x1a02f8]={'$like':'%'+_0x165e20[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x156995;})});}_0x28e39e=_[_0x9708('0x3b')]({},_0x28e39e,_0x165e20['options']);return _0x323487[_0x9708('0x4b')](_0x28e39e);}})['then'](function(_0x45b333){if(_0x45b333){_0x2e471f=_0x45b333[_0x9708('0x34')];if(!_0x165e20[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x28e39e[_0x9708('0x1c')]=qs[_0x9708('0x1c')](_0x165e20[_0x9708('0x2e')][_0x9708('0x1c')]);_0x28e39e['offset']=qs[_0x9708('0x1a')](_0x165e20[_0x9708('0x2e')][_0x9708('0x1a')]);}return _0x323487[_0x9708('0x4b')](_0x28e39e);}})[_0x9708('0x3f')](function(_0x21b718){if(_0x21b718){return _0x21b718?{'count':_0x2e471f,'rows':_0x21b718}:null;}})[_0x9708('0x3f')](respondWithResult(_0x41bf46,null))[_0x9708('0x43')](handleError(_0x41bf46,null));};exports[_0x9708('0x4e')]=function(_0x5e5bb8,_0x21ecbf,_0x5ae09c){var _0x38cb2b={};var _0x4e1784={};var _0x1d39df;var _0x5f33b5;return db[_0x9708('0x29')][_0x9708('0x4f')]({'where':{'id':_0x5e5bb8[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x21ecbf,null))[_0x9708('0x3f')](function(_0x5e4a9a){if(_0x5e4a9a){_0x1d39df=_0x5e4a9a;_0x4e1784[_0x9708('0x2d')]=_['keys'](db[_0x9708('0x4c')][_0x9708('0x2a')]);_0x4e1784[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x5e5bb8[_0x9708('0x2e')]);_0x4e1784[_0x9708('0x30')]=_[_0x9708('0x31')](_0x4e1784[_0x9708('0x2d')],_0x4e1784[_0x9708('0x2e')]);_0x38cb2b[_0x9708('0x32')]=_[_0x9708('0x31')](_0x4e1784[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x5e5bb8['query']['fields']));_0x38cb2b[_0x9708('0x32')]=_0x38cb2b[_0x9708('0x32')]['length']?_0x38cb2b['attributes']:_0x4e1784[_0x9708('0x2d')];_0x38cb2b[_0x9708('0x4d')]=qs[_0x9708('0x37')](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x37')]);_0x38cb2b[_0x9708('0x38')]=qs['filters'](_[_0x9708('0x39')](_0x5e5bb8[_0x9708('0x2e')],_0x4e1784[_0x9708('0x30')]));if(_0x5e5bb8['query'][_0x9708('0x3a')]){_0x38cb2b[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x38cb2b[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x38cb2b['attributes'],function(_0x5096f1){var _0x32e4d6={};_0x32e4d6[_0x5096f1]={'$like':'%'+_0x5e5bb8['query'][_0x9708('0x3a')]+'%'};return _0x32e4d6;})});}_0x38cb2b=_[_0x9708('0x3b')]({},_0x38cb2b,_0x5e5bb8[_0x9708('0x3e')]);return _0x1d39df['getDescriptions'](_0x38cb2b);}})[_0x9708('0x3f')](function(_0x190807){if(_0x190807){_0x5f33b5=_0x190807[_0x9708('0x34')];if(!_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x38cb2b['limit']=qs[_0x9708('0x1c')](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x1c')]);_0x38cb2b[_0x9708('0x1a')]=qs['offset'](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x1a')]);}return _0x1d39df['getDescriptions'](_0x38cb2b);}})[_0x9708('0x3f')](function(_0x2eb536){if(_0x2eb536){return _0x2eb536?{'count':_0x5f33b5,'rows':_0x2eb536}:null;}})['then'](respondWithResult(_0x21ecbf,null))[_0x9708('0x43')](handleError(_0x21ecbf,null));};exports['getFields']=function(_0x536639,_0x2834bf,_0x326807){var _0x5d8c57={};var _0x2e9328={};var _0x5b2f0f;var _0x682578;return db[_0x9708('0x29')]['findOne']({'where':{'id':_0x536639['params']['id']}})['then'](handleEntityNotFound(_0x2834bf,null))[_0x9708('0x3f')](function(_0x34dfe4){if(_0x34dfe4){_0x5b2f0f=_0x34dfe4;_0x2e9328[_0x9708('0x2d')]=_['keys'](db['FreshsalesField'][_0x9708('0x2a')]);_0x2e9328['query']=_['keys'](_0x536639['query']);_0x2e9328[_0x9708('0x30')]=_['intersection'](_0x2e9328['model'],_0x2e9328[_0x9708('0x2e')]);_0x5d8c57['attributes']=_['intersection'](_0x2e9328[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x536639[_0x9708('0x2e')][_0x9708('0x33')]));_0x5d8c57['attributes']=_0x5d8c57[_0x9708('0x32')][_0x9708('0x34')]?_0x5d8c57[_0x9708('0x32')]:_0x2e9328[_0x9708('0x2d')];_0x5d8c57[_0x9708('0x4d')]=qs['sort'](_0x536639[_0x9708('0x2e')][_0x9708('0x37')]);_0x5d8c57[_0x9708('0x38')]=qs[_0x9708('0x30')](_['pick'](_0x536639[_0x9708('0x2e')],_0x2e9328[_0x9708('0x30')]));if(_0x536639[_0x9708('0x2e')][_0x9708('0x3a')]){_0x5d8c57[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x5d8c57['where'],{'$or':_['map'](_0x5d8c57['attributes'],function(_0x33e17f){var _0x14be86={};_0x14be86[_0x33e17f]={'$like':'%'+_0x536639[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x14be86;})});}_0x5d8c57=_[_0x9708('0x3b')]({},_0x5d8c57,_0x536639[_0x9708('0x3e')]);return _0x5b2f0f['getFields'](_0x5d8c57);}})[_0x9708('0x3f')](function(_0x35d6fc){if(_0x35d6fc){_0x682578=_0x35d6fc['length'];if(!_0x536639[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x5d8c57['limit']=qs[_0x9708('0x1c')](_0x536639[_0x9708('0x2e')][_0x9708('0x1c')]);_0x5d8c57['offset']=qs[_0x9708('0x1a')](_0x536639[_0x9708('0x2e')]['offset']);}return _0x5b2f0f[_0x9708('0x50')](_0x5d8c57);}})[_0x9708('0x3f')](function(_0x529bfa){if(_0x529bfa){return _0x529bfa?{'count':_0x682578,'rows':_0x529bfa}:null;}})['then'](respondWithResult(_0x2834bf,null))[_0x9708('0x43')](handleError(_0x2834bf,null));}; \ No newline at end of file +var _0x1bbe=['includeAll','include','options','find','catch','create','body','destroy','findOne','FreshsalesField','rawAttributes','getSubjects','order','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','merge','findAll','rows','show','params'];(function(_0x22f4ea,_0x34db55){var _0x22908e=function(_0x3666f2){while(--_0x3666f2){_0x22f4ea['push'](_0x22f4ea['shift']());}};_0x22908e(++_0x34db55);}(_0x1bbe,0x105));var _0xe1bb=function(_0x42d57b,_0x4e962d){_0x42d57b=_0x42d57b-0x0;var _0x43ec08=_0x1bbe[_0x42d57b];return _0x43ec08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1bb('0x0'));var zipdir=require(_0xe1bb('0x1'));var jsonpatch=require(_0xe1bb('0x2'));var rp=require(_0xe1bb('0x3'));var moment=require(_0xe1bb('0x4'));var BPromise=require(_0xe1bb('0x5'));var Mustache=require('mustache');var util=require(_0xe1bb('0x6'));var path=require(_0xe1bb('0x7'));var sox=require(_0xe1bb('0x8'));var csv=require(_0xe1bb('0x9'));var ejs=require(_0xe1bb('0xa'));var fs=require('fs');var fs_extra=require(_0xe1bb('0xb'));var _=require(_0xe1bb('0xc'));var squel=require(_0xe1bb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe1bb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe1bb('0xf'));var Papa=require(_0xe1bb('0x10'));var Redis=require(_0xe1bb('0x11'));var authService=require(_0xe1bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe1bb('0x13'));var hardwareService=require(_0xe1bb('0x14'));var logger=require(_0xe1bb('0x15'))(_0xe1bb('0x16'));var utils=require(_0xe1bb('0x17'));var config=require(_0xe1bb('0x18'));var licenseUtil=require(_0xe1bb('0x19'));var db=require(_0xe1bb('0x1a'))['db'];function respondWithStatusCode(_0x1f4bc4,_0x1512e8){_0x1512e8=_0x1512e8||0xcc;return function(_0x410449){if(_0x410449){return _0x1f4bc4[_0xe1bb('0x1b')](_0x1512e8);}return _0x1f4bc4[_0xe1bb('0x1c')](_0x1512e8)[_0xe1bb('0x1d')]();};}function respondWithResult(_0x3b9d01,_0x23f709){_0x23f709=_0x23f709||0xc8;return function(_0x138800){if(_0x138800){return _0x3b9d01[_0xe1bb('0x1c')](_0x23f709)[_0xe1bb('0x1e')](_0x138800);}};}function respondWithFilteredResult(_0x1c5abe,_0x5a7d2f){return function(_0x4309a4){if(_0x4309a4){var _0x1c0234=typeof _0x5a7d2f['offset']===_0xe1bb('0x1f')&&typeof _0x5a7d2f['limit']==='undefined';var _0x21dbfa=_0x4309a4['count'];var _0x1ea749=_0x1c0234?0x0:_0x5a7d2f[_0xe1bb('0x20')];var _0x3021ea=_0x1c0234?_0x4309a4[_0xe1bb('0x21')]:_0x5a7d2f['offset']+_0x5a7d2f['limit'];var _0x36b1d4;if(_0x3021ea>=_0x21dbfa){_0x3021ea=_0x21dbfa;_0x36b1d4=0xc8;}else{_0x36b1d4=0xce;}_0x1c5abe['status'](_0x36b1d4);return _0x1c5abe['set']('Content-Range',_0x1ea749+'-'+_0x3021ea+'/'+_0x21dbfa)[_0xe1bb('0x1e')](_0x4309a4);}return null;};}function patchUpdates(_0x13638f){return function(_0x2f004d){try{jsonpatch['apply'](_0x2f004d,_0x13638f,!![]);}catch(_0x2edd84){return BPromise['reject'](_0x2edd84);}return _0x2f004d[_0xe1bb('0x22')]();};}function saveUpdates(_0x1b4312,_0x2bd8d0){return function(_0x2a374b){if(_0x2a374b){return _0x2a374b[_0xe1bb('0x23')](_0x1b4312)[_0xe1bb('0x24')](function(_0x4a1d7a){return _0x4a1d7a;});}return null;};}function removeEntity(_0x15a17f,_0x2f701d){return function(_0x45b5dc){if(_0x45b5dc){return _0x45b5dc['destroy']()[_0xe1bb('0x24')](function(){_0x15a17f['status'](0xcc)[_0xe1bb('0x1d')]();});}};}function handleEntityNotFound(_0x1d26cd,_0x5ae9d8){return function(_0x2c6b41){if(!_0x2c6b41){_0x1d26cd[_0xe1bb('0x1b')](0x194);}return _0x2c6b41;};}function handleError(_0x39909b,_0x2e5a43){_0x2e5a43=_0x2e5a43||0x1f4;return function(_0x3374bd){logger[_0xe1bb('0x25')](_0x3374bd[_0xe1bb('0x26')]);if(_0x3374bd[_0xe1bb('0x27')]){delete _0x3374bd[_0xe1bb('0x27')];}_0x39909b[_0xe1bb('0x1c')](_0x2e5a43)[_0xe1bb('0x28')](_0x3374bd);};}exports[_0xe1bb('0x29')]=function(_0xd748f8,_0x5e6ba9){var _0x508050={},_0x55b68f={},_0xe73624={'count':0x0,'rows':[]};var _0x3e5eb0=_[_0xe1bb('0x2a')](db[_0xe1bb('0x2b')]['rawAttributes'],function(_0x4cafd8){return{'name':_0x4cafd8[_0xe1bb('0x2c')],'type':_0x4cafd8['type'][_0xe1bb('0x2d')]};});_0x55b68f[_0xe1bb('0x2e')]=_['map'](_0x3e5eb0,_0xe1bb('0x27'));_0x55b68f[_0xe1bb('0x2f')]=_[_0xe1bb('0x30')](_0xd748f8[_0xe1bb('0x2f')]);_0x55b68f[_0xe1bb('0x31')]=_[_0xe1bb('0x32')](_0x55b68f['model'],_0x55b68f[_0xe1bb('0x2f')]);_0x508050[_0xe1bb('0x33')]=_[_0xe1bb('0x32')](_0x55b68f[_0xe1bb('0x2e')],qs[_0xe1bb('0x34')](_0xd748f8[_0xe1bb('0x2f')]['fields']));_0x508050[_0xe1bb('0x33')]=_0x508050['attributes'][_0xe1bb('0x35')]?_0x508050['attributes']:_0x55b68f[_0xe1bb('0x2e')];if(!_0xd748f8[_0xe1bb('0x2f')][_0xe1bb('0x36')](_0xe1bb('0x37'))){_0x508050[_0xe1bb('0x38')]=qs[_0xe1bb('0x38')](_0xd748f8[_0xe1bb('0x2f')][_0xe1bb('0x38')]);_0x508050[_0xe1bb('0x20')]=qs[_0xe1bb('0x20')](_0xd748f8['query'][_0xe1bb('0x20')]);}_0x508050['order']=qs[_0xe1bb('0x39')](_0xd748f8[_0xe1bb('0x2f')][_0xe1bb('0x39')]);_0x508050[_0xe1bb('0x3a')]=qs[_0xe1bb('0x31')](_[_0xe1bb('0x3b')](_0xd748f8[_0xe1bb('0x2f')],_0x55b68f[_0xe1bb('0x31')]),_0x3e5eb0);if(_0xd748f8[_0xe1bb('0x2f')][_0xe1bb('0x3c')]){_0x508050[_0xe1bb('0x3a')]=_['merge'](_0x508050[_0xe1bb('0x3a')],{'$or':_[_0xe1bb('0x2a')](_0x3e5eb0,function(_0x25ec2b){if(_0x25ec2b[_0xe1bb('0x3d')]!=='VIRTUAL'){var _0x2f0d2={};_0x2f0d2[_0x25ec2b['name']]={'$like':'%'+_0xd748f8['query'][_0xe1bb('0x3c')]+'%'};return _0x2f0d2;}})});}_0x508050=_[_0xe1bb('0x3e')]({},_0x508050,_0xd748f8['options']);var _0x2ac83f={'where':_0x508050[_0xe1bb('0x3a')]};return db[_0xe1bb('0x2b')][_0xe1bb('0x21')](_0x2ac83f)['then'](function(_0x77a9c){_0xe73624[_0xe1bb('0x21')]=_0x77a9c;if(_0xd748f8[_0xe1bb('0x2f')]['includeAll']){_0x508050['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xe1bb('0x3f')](_0x508050);})[_0xe1bb('0x24')](function(_0x40f299){_0xe73624[_0xe1bb('0x40')]=_0x40f299;return _0xe73624;})[_0xe1bb('0x24')](respondWithFilteredResult(_0x5e6ba9,_0x508050))['catch'](handleError(_0x5e6ba9,null));};exports[_0xe1bb('0x41')]=function(_0x1c36ca,_0x319313){var _0x3edd48={'raw':![],'where':{'id':_0x1c36ca[_0xe1bb('0x42')]['id']}},_0x216215={};_0x216215['model']=_[_0xe1bb('0x30')](db[_0xe1bb('0x2b')]['rawAttributes']);_0x216215['query']=_[_0xe1bb('0x30')](_0x1c36ca[_0xe1bb('0x2f')]);_0x216215[_0xe1bb('0x31')]=_[_0xe1bb('0x32')](_0x216215[_0xe1bb('0x2e')],_0x216215[_0xe1bb('0x2f')]);_0x3edd48[_0xe1bb('0x33')]=_['intersection'](_0x216215[_0xe1bb('0x2e')],qs['fields'](_0x1c36ca[_0xe1bb('0x2f')][_0xe1bb('0x34')]));_0x3edd48[_0xe1bb('0x33')]=_0x3edd48[_0xe1bb('0x33')]['length']?_0x3edd48[_0xe1bb('0x33')]:_0x216215[_0xe1bb('0x2e')];if(_0x1c36ca[_0xe1bb('0x2f')][_0xe1bb('0x43')]){_0x3edd48[_0xe1bb('0x44')]=[{'all':!![]}];}_0x3edd48=_[_0xe1bb('0x3e')]({},_0x3edd48,_0x1c36ca[_0xe1bb('0x45')]);return db[_0xe1bb('0x2b')][_0xe1bb('0x46')](_0x3edd48)[_0xe1bb('0x24')](handleEntityNotFound(_0x319313,null))['then'](respondWithResult(_0x319313,null))[_0xe1bb('0x47')](handleError(_0x319313,null));};exports['create']=function(_0x1533e4,_0x5cd382){return db[_0xe1bb('0x2b')][_0xe1bb('0x48')](_0x1533e4[_0xe1bb('0x49')],{})[_0xe1bb('0x24')](respondWithResult(_0x5cd382,0xc9))[_0xe1bb('0x47')](handleError(_0x5cd382,null));};exports[_0xe1bb('0x23')]=function(_0xcde72b,_0x5837b3){if(_0xcde72b[_0xe1bb('0x49')]['id']){delete _0xcde72b['body']['id'];}return db[_0xe1bb('0x2b')][_0xe1bb('0x46')]({'where':{'id':_0xcde72b[_0xe1bb('0x42')]['id']}})[_0xe1bb('0x24')](handleEntityNotFound(_0x5837b3,null))[_0xe1bb('0x24')](saveUpdates(_0xcde72b[_0xe1bb('0x49')],null))[_0xe1bb('0x24')](respondWithResult(_0x5837b3,null))[_0xe1bb('0x47')](handleError(_0x5837b3,null));};exports[_0xe1bb('0x4a')]=function(_0x48cfa3,_0x2e329b){return db['FreshsalesConfiguration'][_0xe1bb('0x46')]({'where':{'id':_0x48cfa3['params']['id']}})[_0xe1bb('0x24')](handleEntityNotFound(_0x2e329b,null))[_0xe1bb('0x24')](removeEntity(_0x2e329b,null))[_0xe1bb('0x47')](handleError(_0x2e329b,null));};exports['getSubjects']=function(_0x42a717,_0x41db80,_0x1de7e6){var _0x44982b={};var _0x1706cb={};var _0xffc8a6;var _0x27148f;return db[_0xe1bb('0x2b')][_0xe1bb('0x4b')]({'where':{'id':_0x42a717[_0xe1bb('0x42')]['id']}})[_0xe1bb('0x24')](handleEntityNotFound(_0x41db80,null))[_0xe1bb('0x24')](function(_0x24b9f9){if(_0x24b9f9){_0xffc8a6=_0x24b9f9;_0x1706cb[_0xe1bb('0x2e')]=_[_0xe1bb('0x30')](db[_0xe1bb('0x4c')][_0xe1bb('0x4d')]);_0x1706cb[_0xe1bb('0x2f')]=_[_0xe1bb('0x30')](_0x42a717[_0xe1bb('0x2f')]);_0x1706cb[_0xe1bb('0x31')]=_[_0xe1bb('0x32')](_0x1706cb['model'],_0x1706cb[_0xe1bb('0x2f')]);_0x44982b['attributes']=_[_0xe1bb('0x32')](_0x1706cb[_0xe1bb('0x2e')],qs[_0xe1bb('0x34')](_0x42a717[_0xe1bb('0x2f')][_0xe1bb('0x34')]));_0x44982b['attributes']=_0x44982b[_0xe1bb('0x33')]['length']?_0x44982b[_0xe1bb('0x33')]:_0x1706cb[_0xe1bb('0x2e')];_0x44982b['order']=qs[_0xe1bb('0x39')](_0x42a717[_0xe1bb('0x2f')]['sort']);_0x44982b[_0xe1bb('0x3a')]=qs[_0xe1bb('0x31')](_[_0xe1bb('0x3b')](_0x42a717[_0xe1bb('0x2f')],_0x1706cb[_0xe1bb('0x31')]));if(_0x42a717['query']['filter']){_0x44982b[_0xe1bb('0x3a')]=_[_0xe1bb('0x3e')](_0x44982b[_0xe1bb('0x3a')],{'$or':_[_0xe1bb('0x2a')](_0x44982b[_0xe1bb('0x33')],function(_0x8da934){var _0x6eb356={};_0x6eb356[_0x8da934]={'$like':'%'+_0x42a717[_0xe1bb('0x2f')][_0xe1bb('0x3c')]+'%'};return _0x6eb356;})});}_0x44982b=_[_0xe1bb('0x3e')]({},_0x44982b,_0x42a717[_0xe1bb('0x45')]);return _0xffc8a6[_0xe1bb('0x4e')](_0x44982b);}})['then'](function(_0x16133a){if(_0x16133a){_0x27148f=_0x16133a[_0xe1bb('0x35')];if(!_0x42a717[_0xe1bb('0x2f')][_0xe1bb('0x36')](_0xe1bb('0x37'))){_0x44982b[_0xe1bb('0x38')]=qs['limit'](_0x42a717[_0xe1bb('0x2f')][_0xe1bb('0x38')]);_0x44982b[_0xe1bb('0x20')]=qs[_0xe1bb('0x20')](_0x42a717[_0xe1bb('0x2f')]['offset']);}return _0xffc8a6[_0xe1bb('0x4e')](_0x44982b);}})[_0xe1bb('0x24')](function(_0x4d55ad){if(_0x4d55ad){return _0x4d55ad?{'count':_0x27148f,'rows':_0x4d55ad}:null;}})['then'](respondWithResult(_0x41db80,null))[_0xe1bb('0x47')](handleError(_0x41db80,null));};exports['getDescriptions']=function(_0xb301b5,_0x1e023d,_0x235ab8){var _0x2ddc22={};var _0x12ccc3={};var _0x41612f;var _0x1266c2;return db[_0xe1bb('0x2b')][_0xe1bb('0x4b')]({'where':{'id':_0xb301b5[_0xe1bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e023d,null))[_0xe1bb('0x24')](function(_0x4cc507){if(_0x4cc507){_0x41612f=_0x4cc507;_0x12ccc3[_0xe1bb('0x2e')]=_[_0xe1bb('0x30')](db[_0xe1bb('0x4c')][_0xe1bb('0x4d')]);_0x12ccc3[_0xe1bb('0x2f')]=_['keys'](_0xb301b5[_0xe1bb('0x2f')]);_0x12ccc3[_0xe1bb('0x31')]=_[_0xe1bb('0x32')](_0x12ccc3[_0xe1bb('0x2e')],_0x12ccc3[_0xe1bb('0x2f')]);_0x2ddc22[_0xe1bb('0x33')]=_[_0xe1bb('0x32')](_0x12ccc3['model'],qs[_0xe1bb('0x34')](_0xb301b5[_0xe1bb('0x2f')]['fields']));_0x2ddc22[_0xe1bb('0x33')]=_0x2ddc22[_0xe1bb('0x33')]['length']?_0x2ddc22[_0xe1bb('0x33')]:_0x12ccc3[_0xe1bb('0x2e')];_0x2ddc22[_0xe1bb('0x4f')]=qs[_0xe1bb('0x39')](_0xb301b5['query'][_0xe1bb('0x39')]);_0x2ddc22[_0xe1bb('0x3a')]=qs[_0xe1bb('0x31')](_[_0xe1bb('0x3b')](_0xb301b5[_0xe1bb('0x2f')],_0x12ccc3[_0xe1bb('0x31')]));if(_0xb301b5[_0xe1bb('0x2f')]['filter']){_0x2ddc22[_0xe1bb('0x3a')]=_[_0xe1bb('0x3e')](_0x2ddc22[_0xe1bb('0x3a')],{'$or':_[_0xe1bb('0x2a')](_0x2ddc22[_0xe1bb('0x33')],function(_0x124f5d){var _0x5bc690={};_0x5bc690[_0x124f5d]={'$like':'%'+_0xb301b5[_0xe1bb('0x2f')][_0xe1bb('0x3c')]+'%'};return _0x5bc690;})});}_0x2ddc22=_[_0xe1bb('0x3e')]({},_0x2ddc22,_0xb301b5[_0xe1bb('0x45')]);return _0x41612f[_0xe1bb('0x50')](_0x2ddc22);}})['then'](function(_0x1143fe){if(_0x1143fe){_0x1266c2=_0x1143fe['length'];if(!_0xb301b5[_0xe1bb('0x2f')][_0xe1bb('0x36')](_0xe1bb('0x37'))){_0x2ddc22[_0xe1bb('0x38')]=qs[_0xe1bb('0x38')](_0xb301b5['query'][_0xe1bb('0x38')]);_0x2ddc22[_0xe1bb('0x20')]=qs['offset'](_0xb301b5[_0xe1bb('0x2f')][_0xe1bb('0x20')]);}return _0x41612f[_0xe1bb('0x50')](_0x2ddc22);}})[_0xe1bb('0x24')](function(_0x489b14){if(_0x489b14){return _0x489b14?{'count':_0x1266c2,'rows':_0x489b14}:null;}})[_0xe1bb('0x24')](respondWithResult(_0x1e023d,null))['catch'](handleError(_0x1e023d,null));};exports['getFields']=function(_0x91b102,_0x198c6a,_0x4dd0d9){var _0x2d8dca={};var _0x2b8d17={};var _0x40acf9;var _0x33fb00;return db[_0xe1bb('0x2b')]['findOne']({'where':{'id':_0x91b102[_0xe1bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x198c6a,null))[_0xe1bb('0x24')](function(_0x2eb01b){if(_0x2eb01b){_0x40acf9=_0x2eb01b;_0x2b8d17[_0xe1bb('0x2e')]=_[_0xe1bb('0x30')](db[_0xe1bb('0x4c')]['rawAttributes']);_0x2b8d17[_0xe1bb('0x2f')]=_[_0xe1bb('0x30')](_0x91b102['query']);_0x2b8d17[_0xe1bb('0x31')]=_['intersection'](_0x2b8d17[_0xe1bb('0x2e')],_0x2b8d17['query']);_0x2d8dca[_0xe1bb('0x33')]=_[_0xe1bb('0x32')](_0x2b8d17[_0xe1bb('0x2e')],qs[_0xe1bb('0x34')](_0x91b102['query'][_0xe1bb('0x34')]));_0x2d8dca[_0xe1bb('0x33')]=_0x2d8dca[_0xe1bb('0x33')]['length']?_0x2d8dca['attributes']:_0x2b8d17[_0xe1bb('0x2e')];_0x2d8dca[_0xe1bb('0x4f')]=qs[_0xe1bb('0x39')](_0x91b102['query'][_0xe1bb('0x39')]);_0x2d8dca[_0xe1bb('0x3a')]=qs[_0xe1bb('0x31')](_['pick'](_0x91b102[_0xe1bb('0x2f')],_0x2b8d17[_0xe1bb('0x31')]));if(_0x91b102[_0xe1bb('0x2f')]['filter']){_0x2d8dca[_0xe1bb('0x3a')]=_['merge'](_0x2d8dca[_0xe1bb('0x3a')],{'$or':_['map'](_0x2d8dca[_0xe1bb('0x33')],function(_0xccae9f){var _0x15385f={};_0x15385f[_0xccae9f]={'$like':'%'+_0x91b102[_0xe1bb('0x2f')][_0xe1bb('0x3c')]+'%'};return _0x15385f;})});}_0x2d8dca=_[_0xe1bb('0x3e')]({},_0x2d8dca,_0x91b102['options']);return _0x40acf9[_0xe1bb('0x51')](_0x2d8dca);}})['then'](function(_0x48a6ff){if(_0x48a6ff){_0x33fb00=_0x48a6ff['length'];if(!_0x91b102[_0xe1bb('0x2f')][_0xe1bb('0x36')](_0xe1bb('0x37'))){_0x2d8dca[_0xe1bb('0x38')]=qs['limit'](_0x91b102[_0xe1bb('0x2f')][_0xe1bb('0x38')]);_0x2d8dca[_0xe1bb('0x20')]=qs[_0xe1bb('0x20')](_0x91b102[_0xe1bb('0x2f')][_0xe1bb('0x20')]);}return _0x40acf9['getFields'](_0x2d8dca);}})[_0xe1bb('0x24')](function(_0x7b2010){if(_0x7b2010){return _0x7b2010?{'count':_0x33fb00,'rows':_0x7b2010}:null;}})[_0xe1bb('0x24')](respondWithResult(_0x198c6a,null))[_0xe1bb('0x47')](handleError(_0x198c6a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ccfa962..5a822bb 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 _0x6de0=['../../config/logger','api','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','util'];(function(_0x4c209c,_0x7b9730){var _0x10b718=function(_0x42c934){while(--_0x42c934){_0x4c209c['push'](_0x4c209c['shift']());}};_0x10b718(++_0x7b9730);}(_0x6de0,0xce));var _0x06de=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6de0[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0x06de('0x0'));var logger=require(_0x06de('0x1'))(_0x06de('0x2'));var moment=require('moment');var BPromise=require(_0x06de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x06de('0x4'));var config=require(_0x06de('0x5'));var attributes=require(_0x06de('0x6'));module[_0x06de('0x7')]=function(_0x1c15ba,_0x34e462){return _0x1c15ba['define']('FreshsalesConfiguration',attributes,{'tableName':_0x06de('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa91e=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa91e,0xe1));var _0xea91=function(_0x2f63d5,_0x35df3a){_0x2f63d5=_0x2f63d5-0x0;var _0x28971f=_0xa91e[_0x2f63d5];return _0x28971f;};'use strict';var _=require(_0xea91('0x0'));var util=require(_0xea91('0x1'));var logger=require(_0xea91('0x2'))(_0xea91('0x3'));var moment=require(_0xea91('0x4'));var BPromise=require('bluebird');var rp=require(_0xea91('0x5'));var fs=require('fs');var path=require(_0xea91('0x6'));var rimraf=require(_0xea91('0x7'));var config=require('../../config/environment');var attributes=require(_0xea91('0x8'));module[_0xea91('0x9')]=function(_0x27a6fe,_0x42eb95){return _0x27a6fe[_0xea91('0xa')](_0xea91('0xb'),attributes,{'tableName':_0xea91('0xc'),'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 b7d9f52..49a4006 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 _0xc9f8=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc9f8,0x1c3));var _0x8c9f=function(_0x5a4d99,_0x4a1a69){_0x5a4d99=_0x5a4d99-0x0;var _0x4f9907=_0xc9f8[_0x5a4d99];return _0x4f9907;};'use strict';var _=require(_0x8c9f('0x0'));var util=require(_0x8c9f('0x1'));var moment=require(_0x8c9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c9f('0x3'));var fs=require('fs');var Redis=require(_0x8c9f('0x4'));var db=require(_0x8c9f('0x5'))['db'];var utils=require(_0x8c9f('0x6'));var logger=require(_0x8c9f('0x7'))(_0x8c9f('0x8'));var config=require(_0x8c9f('0x9'));var jayson=require(_0x8c9f('0xa'));var client=jayson['client'][_0x8c9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535e11,_0xa3a25c,_0x58487d){return new BPromise(function(_0x1f5c81,_0x3ce71a){return client[_0x8c9f('0xc')](_0x535e11,_0x58487d)[_0x8c9f('0xd')](function(_0x17e7ae){logger['info'](_0x8c9f('0xe'),_0xa3a25c,_0x8c9f('0xf'));logger[_0x8c9f('0x10')](_0x8c9f('0x11'),_0xa3a25c,_0x8c9f('0xf'),JSON[_0x8c9f('0x12')](_0x17e7ae));if(_0x17e7ae[_0x8c9f('0x13')]){if(_0x17e7ae['error'][_0x8c9f('0x14')]===0x1f4){logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);return _0x3ce71a(_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);}logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);return _0x1f5c81(_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);}else{logger[_0x8c9f('0x16')](_0x8c9f('0xe'),_0xa3a25c,_0x8c9f('0xf'));_0x1f5c81(_0x17e7ae[_0x8c9f('0x17')][_0x8c9f('0x15')]);}})[_0x8c9f('0x18')](function(_0x57e44d){logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x57e44d);_0x3ce71a(_0x57e44d);});});} \ No newline at end of file +var _0x1a89=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a89,0x1e4));var _0x91a8=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x1a89[_0xa8883];return _0x479426;};'use strict';var _=require(_0x91a8('0x0'));var util=require(_0x91a8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91a8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x91a8('0x3'))(_0x91a8('0x4'));var config=require('../../config/environment');var jayson=require(_0x91a8('0x5'));var client=jayson[_0x91a8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a673,_0x5d11a7,_0x53f1ee){return new BPromise(function(_0x13162d,_0x396b63){return client[_0x91a8('0x7')](_0x25a673,_0x53f1ee)[_0x91a8('0x8')](function(_0x870e6c){logger['info'](_0x91a8('0x9'),_0x5d11a7,_0x91a8('0xa'));logger['debug'](_0x91a8('0xb'),_0x5d11a7,_0x91a8('0xa'),JSON[_0x91a8('0xc')](_0x870e6c));if(_0x870e6c[_0x91a8('0xd')]){if(_0x870e6c[_0x91a8('0xd')][_0x91a8('0xe')]===0x1f4){logger['error'](_0x91a8('0x9'),_0x5d11a7,_0x870e6c[_0x91a8('0xd')][_0x91a8('0xf')]);return _0x396b63(_0x870e6c['error'][_0x91a8('0xf')]);}logger[_0x91a8('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5d11a7,_0x870e6c[_0x91a8('0xd')]['message']);return _0x13162d(_0x870e6c['error'][_0x91a8('0xf')]);}else{logger['info'](_0x91a8('0x9'),_0x5d11a7,_0x91a8('0xa'));_0x13162d(_0x870e6c[_0x91a8('0x10')][_0x91a8('0xf')]);}})[_0x91a8('0x11')](function(_0x4a234b){logger[_0x91a8('0xd')](_0x91a8('0x9'),_0x5d11a7,_0x4a234b);_0x396b63(_0x4a234b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 83bd1a3..8535d3c 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 _0x1094=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1094,0x143));var _0x4109=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x1094[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var path=require('path');var timeout=require(_0x4109('0x2'));var express=require('express');var router=express[_0x4109('0x3')]();var fs_extra=require(_0x4109('0x4'));var auth=require(_0x4109('0x5'));var interaction=require(_0x4109('0x6'));var config=require(_0x4109('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4109('0x8')]('/',auth[_0x4109('0x9')](),controller[_0x4109('0xa')]);router[_0x4109('0x8')](_0x4109('0xb'),auth[_0x4109('0x9')](),controller['show']);router[_0x4109('0xc')]('/',auth[_0x4109('0x9')](),controller[_0x4109('0xd')]);router[_0x4109('0xe')](_0x4109('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4109('0xf')]('/:id',auth[_0x4109('0x9')](),controller[_0x4109('0x10')]);module[_0x4109('0x11')]=router; \ No newline at end of file +var _0x0d6a=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x0d6a,0xc9));var _0xa0d6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0d6a[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var fs_extra=require(_0xa0d6('0x5'));var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller['index']);router[_0xa0d6('0xa')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0d6('0xf')]);router['put'](_0xa0d6('0xc'),auth['isAuthenticated'](),controller[_0xa0d6('0x10')]);router['delete'](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x11')]);module[_0xa0d6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6a29898..f68db74 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 _0x19e9=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x155e04,_0x28cd61){var _0x4590d0=function(_0x3f685b){while(--_0x3f685b){_0x155e04['push'](_0x155e04['shift']());}};_0x4590d0(++_0x28cd61);}(_0x19e9,0xe4));var _0x919e=function(_0x2f844d,_0x179122){_0x2f844d=_0x2f844d-0x0;var _0x57e229=_0x19e9[_0x2f844d];return _0x57e229;};'use strict';var Sequelize=require('sequelize');module[_0x919e('0x0')]={'type':{'type':Sequelize[_0x919e('0x1')](_0x919e('0x2'),_0x919e('0x3'),_0x919e('0x4'),_0x919e('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x919e('0x6')]},'key':{'type':Sequelize[_0x919e('0x6')]},'keyType':{'type':Sequelize[_0x919e('0x1')](_0x919e('0x2'),_0x919e('0x3'),_0x919e('0x4'))},'keyContent':{'type':Sequelize[_0x919e('0x6')]},'idField':{'type':Sequelize[_0x919e('0x6')]},'nameField':{'type':Sequelize[_0x919e('0x6')]},'customField':{'type':Sequelize[_0x919e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x919e('0x6')]}}; \ No newline at end of file +var _0xc54e=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x1aa181,_0x41210f){var _0x52d5ac=function(_0xb6bdd0){while(--_0xb6bdd0){_0x1aa181['push'](_0x1aa181['shift']());}};_0x52d5ac(++_0x41210f);}(_0xc54e,0x140));var _0xec54=function(_0xf74372,_0x51fe82){_0xf74372=_0xf74372-0x0;var _0x36bb65=_0xc54e[_0xf74372];return _0x36bb65;};'use strict';var Sequelize=require(_0xec54('0x0'));module[_0xec54('0x1')]={'type':{'type':Sequelize[_0xec54('0x2')](_0xec54('0x3'),_0xec54('0x4'),_0xec54('0x5'),_0xec54('0x6'),_0xec54('0x7')),'defaultValue':_0xec54('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec54('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xec54('0x3'),_0xec54('0x4'),_0xec54('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xec54('0x8')]},'nameField':{'type':Sequelize[_0xec54('0x8')]},'customField':{'type':Sequelize[_0xec54('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec54('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 50ccd2a..a601a70 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 _0x9d9c=['intersection','model','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x1e5b77,_0x339462){var _0x353508=function(_0x228a95){while(--_0x228a95){_0x1e5b77['push'](_0x1e5b77['shift']());}};_0x353508(++_0x339462);}(_0x9d9c,0xa6));var _0xc9d9=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x9d9c[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0xc9d9('0x0'));var rimraf=require(_0xc9d9('0x1'));var zipdir=require(_0xc9d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9d9('0x3'));var moment=require(_0xc9d9('0x4'));var BPromise=require(_0xc9d9('0x5'));var Mustache=require('mustache');var util=require(_0xc9d9('0x6'));var path=require(_0xc9d9('0x7'));var sox=require(_0xc9d9('0x8'));var csv=require(_0xc9d9('0x9'));var ejs=require(_0xc9d9('0xa'));var fs=require('fs');var fs_extra=require(_0xc9d9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9d9('0xc'));var jsforce=require(_0xc9d9('0xd'));var deskjs=require(_0xc9d9('0xe'));var toCsv=require(_0xc9d9('0x9'));var querystring=require('querystring');var Papa=require(_0xc9d9('0xf'));var Redis=require(_0xc9d9('0x10'));var authService=require(_0xc9d9('0x11'));var qs=require(_0xc9d9('0x12'));var as=require(_0xc9d9('0x13'));var hardwareService=require(_0xc9d9('0x14'));var logger=require(_0xc9d9('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc9d9('0x16'));var licenseUtil=require(_0xc9d9('0x17'));var db=require(_0xc9d9('0x18'))['db'];function respondWithStatusCode(_0x31dd9a,_0x4da1e9){_0x4da1e9=_0x4da1e9||0xcc;return function(_0x41506a){if(_0x41506a){return _0x31dd9a[_0xc9d9('0x19')](_0x4da1e9);}return _0x31dd9a[_0xc9d9('0x1a')](_0x4da1e9)[_0xc9d9('0x1b')]();};}function respondWithResult(_0x442cc9,_0x12e892){_0x12e892=_0x12e892||0xc8;return function(_0x5559af){if(_0x5559af){return _0x442cc9[_0xc9d9('0x1a')](_0x12e892)[_0xc9d9('0x1c')](_0x5559af);}};}function respondWithFilteredResult(_0x113ff8,_0x1bd349){return function(_0x4b12ae){if(_0x4b12ae){var _0x1ad43d=typeof _0x1bd349[_0xc9d9('0x1d')]===_0xc9d9('0x1e')&&typeof _0x1bd349['limit']==='undefined';var _0x1eaa3d=_0x4b12ae[_0xc9d9('0x1f')];var _0x2eadb3=_0x1ad43d?0x0:_0x1bd349[_0xc9d9('0x1d')];var _0x1c870b=_0x1ad43d?_0x4b12ae[_0xc9d9('0x1f')]:_0x1bd349[_0xc9d9('0x1d')]+_0x1bd349[_0xc9d9('0x20')];var _0x523118;if(_0x1c870b>=_0x1eaa3d){_0x1c870b=_0x1eaa3d;_0x523118=0xc8;}else{_0x523118=0xce;}_0x113ff8['status'](_0x523118);return _0x113ff8[_0xc9d9('0x21')](_0xc9d9('0x22'),_0x2eadb3+'-'+_0x1c870b+'/'+_0x1eaa3d)[_0xc9d9('0x1c')](_0x4b12ae);}return null;};}function patchUpdates(_0xc71aad){return function(_0xf3bcaa){try{jsonpatch[_0xc9d9('0x23')](_0xf3bcaa,_0xc71aad,!![]);}catch(_0x4d5eef){return BPromise['reject'](_0x4d5eef);}return _0xf3bcaa[_0xc9d9('0x24')]();};}function saveUpdates(_0xb8d94a,_0x7e380c){return function(_0x1deb2e){if(_0x1deb2e){return _0x1deb2e[_0xc9d9('0x25')](_0xb8d94a)[_0xc9d9('0x26')](function(_0x5983ef){return _0x5983ef;});}return null;};}function removeEntity(_0x290be7,_0x354d6a){return function(_0x4c0f2e){if(_0x4c0f2e){return _0x4c0f2e[_0xc9d9('0x27')]()[_0xc9d9('0x26')](function(){_0x290be7[_0xc9d9('0x1a')](0xcc)[_0xc9d9('0x1b')]();});}};}function handleEntityNotFound(_0x1d338e,_0x1ea6db){return function(_0x43d32c){if(!_0x43d32c){_0x1d338e[_0xc9d9('0x19')](0x194);}return _0x43d32c;};}function handleError(_0x1354a9,_0x1daf6f){_0x1daf6f=_0x1daf6f||0x1f4;return function(_0x286884){logger['error'](_0x286884['stack']);if(_0x286884[_0xc9d9('0x28')]){delete _0x286884['name'];}_0x1354a9['status'](_0x1daf6f)[_0xc9d9('0x29')](_0x286884);};}exports[_0xc9d9('0x2a')]=function(_0x53c526,_0x43ed44){var _0x52bac2={},_0x5bb56f={},_0x352084={'count':0x0,'rows':[]};var _0x4824ed=_[_0xc9d9('0x2b')](db['FreshsalesField'][_0xc9d9('0x2c')],function(_0x4d4bb8){return{'name':_0x4d4bb8[_0xc9d9('0x2d')],'type':_0x4d4bb8['type'][_0xc9d9('0x2e')]};});_0x5bb56f['model']=_[_0xc9d9('0x2b')](_0x4824ed,'name');_0x5bb56f[_0xc9d9('0x2f')]=_[_0xc9d9('0x30')](_0x53c526['query']);_0x5bb56f[_0xc9d9('0x31')]=_[_0xc9d9('0x32')](_0x5bb56f[_0xc9d9('0x33')],_0x5bb56f[_0xc9d9('0x2f')]);_0x52bac2[_0xc9d9('0x34')]=_[_0xc9d9('0x32')](_0x5bb56f['model'],qs['fields'](_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x35')]));_0x52bac2[_0xc9d9('0x34')]=_0x52bac2['attributes'][_0xc9d9('0x36')]?_0x52bac2[_0xc9d9('0x34')]:_0x5bb56f[_0xc9d9('0x33')];if(!_0x53c526[_0xc9d9('0x2f')]['hasOwnProperty']('nolimit')){_0x52bac2[_0xc9d9('0x20')]=qs[_0xc9d9('0x20')](_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x20')]);_0x52bac2[_0xc9d9('0x1d')]=qs[_0xc9d9('0x1d')](_0x53c526['query']['offset']);}_0x52bac2[_0xc9d9('0x37')]=qs['sort'](_0x53c526[_0xc9d9('0x2f')]['sort']);_0x52bac2[_0xc9d9('0x38')]=qs[_0xc9d9('0x31')](_[_0xc9d9('0x39')](_0x53c526[_0xc9d9('0x2f')],_0x5bb56f[_0xc9d9('0x31')]),_0x4824ed);if(_0x53c526['query'][_0xc9d9('0x3a')]){_0x52bac2['where']=_[_0xc9d9('0x3b')](_0x52bac2['where'],{'$or':_[_0xc9d9('0x2b')](_0x4824ed,function(_0x4db9c1){if(_0x4db9c1['type']!==_0xc9d9('0x3c')){var _0xbcb05b={};_0xbcb05b[_0x4db9c1[_0xc9d9('0x28')]]={'$like':'%'+_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x3a')]+'%'};return _0xbcb05b;}})});}_0x52bac2=_[_0xc9d9('0x3b')]({},_0x52bac2,_0x53c526[_0xc9d9('0x3d')]);var _0x1e5201={'where':_0x52bac2[_0xc9d9('0x38')]};return db[_0xc9d9('0x3e')]['count'](_0x1e5201)[_0xc9d9('0x26')](function(_0xea607d){_0x352084[_0xc9d9('0x1f')]=_0xea607d;if(_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x3f')]){_0x52bac2[_0xc9d9('0x40')]=[{'all':!![]}];}return db[_0xc9d9('0x3e')][_0xc9d9('0x41')](_0x52bac2);})['then'](function(_0x35aa2d){_0x352084['rows']=_0x35aa2d;return _0x352084;})[_0xc9d9('0x26')](respondWithFilteredResult(_0x43ed44,_0x52bac2))[_0xc9d9('0x42')](handleError(_0x43ed44,null));};exports[_0xc9d9('0x43')]=function(_0x53a36c,_0x1a5b52){var _0x9d33c1={'raw':!![],'where':{'id':_0x53a36c[_0xc9d9('0x44')]['id']}},_0x5203aa={};_0x5203aa[_0xc9d9('0x33')]=_[_0xc9d9('0x30')](db[_0xc9d9('0x3e')]['rawAttributes']);_0x5203aa[_0xc9d9('0x2f')]=_[_0xc9d9('0x30')](_0x53a36c[_0xc9d9('0x2f')]);_0x5203aa['filters']=_[_0xc9d9('0x32')](_0x5203aa[_0xc9d9('0x33')],_0x5203aa[_0xc9d9('0x2f')]);_0x9d33c1[_0xc9d9('0x34')]=_[_0xc9d9('0x32')](_0x5203aa[_0xc9d9('0x33')],qs['fields'](_0x53a36c['query']['fields']));_0x9d33c1[_0xc9d9('0x34')]=_0x9d33c1[_0xc9d9('0x34')][_0xc9d9('0x36')]?_0x9d33c1[_0xc9d9('0x34')]:_0x5203aa[_0xc9d9('0x33')];if(_0x53a36c[_0xc9d9('0x2f')][_0xc9d9('0x3f')]){_0x9d33c1[_0xc9d9('0x40')]=[{'all':!![]}];}_0x9d33c1=_['merge']({},_0x9d33c1,_0x53a36c['options']);return db[_0xc9d9('0x3e')]['find'](_0x9d33c1)[_0xc9d9('0x26')](handleEntityNotFound(_0x1a5b52,null))['then'](respondWithResult(_0x1a5b52,null))[_0xc9d9('0x42')](handleError(_0x1a5b52,null));};exports[_0xc9d9('0x45')]=function(_0x5f5113,_0x39259b){return db[_0xc9d9('0x3e')][_0xc9d9('0x45')](_0x5f5113[_0xc9d9('0x46')],{})[_0xc9d9('0x26')](respondWithResult(_0x39259b,0xc9))[_0xc9d9('0x42')](handleError(_0x39259b,null));};exports[_0xc9d9('0x25')]=function(_0x3a37a8,_0x119837){if(_0x3a37a8['body']['id']){delete _0x3a37a8['body']['id'];}return db[_0xc9d9('0x3e')][_0xc9d9('0x47')]({'where':{'id':_0x3a37a8[_0xc9d9('0x44')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x119837,null))[_0xc9d9('0x26')](saveUpdates(_0x3a37a8[_0xc9d9('0x46')],null))['then'](respondWithResult(_0x119837,null))[_0xc9d9('0x42')](handleError(_0x119837,null));};exports[_0xc9d9('0x27')]=function(_0x5b11e1,_0x5a9ab6){return db[_0xc9d9('0x3e')][_0xc9d9('0x47')]({'where':{'id':_0x5b11e1['params']['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x5a9ab6,null))[_0xc9d9('0x26')](removeEntity(_0x5a9ab6,null))[_0xc9d9('0x42')](handleError(_0x5a9ab6,null));}; \ No newline at end of file +var _0xb803=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x19de9c,_0x202df2){var _0x33a126=function(_0x3ce371){while(--_0x3ce371){_0x19de9c['push'](_0x19de9c['shift']());}};_0x33a126(++_0x202df2);}(_0xb803,0x88));var _0x3b80=function(_0x50459a,_0x15221e){_0x50459a=_0x50459a-0x0;var _0xe69844=_0xb803[_0x50459a];return _0xe69844;};'use strict';var emlformat=require(_0x3b80('0x0'));var rimraf=require(_0x3b80('0x1'));var zipdir=require(_0x3b80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b80('0x3'));var moment=require(_0x3b80('0x4'));var BPromise=require(_0x3b80('0x5'));var Mustache=require(_0x3b80('0x6'));var util=require(_0x3b80('0x7'));var path=require(_0x3b80('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b80('0x9'));var fs=require('fs');var fs_extra=require(_0x3b80('0xa'));var _=require(_0x3b80('0xb'));var squel=require(_0x3b80('0xc'));var crypto=require(_0x3b80('0xd'));var jsforce=require(_0x3b80('0xe'));var deskjs=require(_0x3b80('0xf'));var toCsv=require(_0x3b80('0x10'));var querystring=require('querystring');var Papa=require(_0x3b80('0x11'));var Redis=require(_0x3b80('0x12'));var authService=require(_0x3b80('0x13'));var qs=require(_0x3b80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b80('0x15'));var logger=require('../../config/logger')(_0x3b80('0x16'));var utils=require(_0x3b80('0x17'));var config=require(_0x3b80('0x18'));var licenseUtil=require(_0x3b80('0x19'));var db=require(_0x3b80('0x1a'))['db'];function respondWithStatusCode(_0x34fc11,_0x5e34c1){_0x5e34c1=_0x5e34c1||0xcc;return function(_0x472bd6){if(_0x472bd6){return _0x34fc11['sendStatus'](_0x5e34c1);}return _0x34fc11[_0x3b80('0x1b')](_0x5e34c1)[_0x3b80('0x1c')]();};}function respondWithResult(_0x3f6e10,_0x190a0b){_0x190a0b=_0x190a0b||0xc8;return function(_0x321ca4){if(_0x321ca4){return _0x3f6e10[_0x3b80('0x1b')](_0x190a0b)['json'](_0x321ca4);}};}function respondWithFilteredResult(_0x496260,_0x32ad97){return function(_0x5a7f1e){if(_0x5a7f1e){var _0x3f0807=typeof _0x32ad97[_0x3b80('0x1d')]===_0x3b80('0x1e')&&typeof _0x32ad97[_0x3b80('0x1f')]==='undefined';var _0x55c35c=_0x5a7f1e[_0x3b80('0x20')];var _0x23ef5f=_0x3f0807?0x0:_0x32ad97['offset'];var _0x145da0=_0x3f0807?_0x5a7f1e['count']:_0x32ad97[_0x3b80('0x1d')]+_0x32ad97[_0x3b80('0x1f')];var _0x282c8a;if(_0x145da0>=_0x55c35c){_0x145da0=_0x55c35c;_0x282c8a=0xc8;}else{_0x282c8a=0xce;}_0x496260['status'](_0x282c8a);return _0x496260[_0x3b80('0x21')](_0x3b80('0x22'),_0x23ef5f+'-'+_0x145da0+'/'+_0x55c35c)[_0x3b80('0x23')](_0x5a7f1e);}return null;};}function patchUpdates(_0x5ae247){return function(_0x3429d3){try{jsonpatch[_0x3b80('0x24')](_0x3429d3,_0x5ae247,!![]);}catch(_0x262a42){return BPromise[_0x3b80('0x25')](_0x262a42);}return _0x3429d3[_0x3b80('0x26')]();};}function saveUpdates(_0x310c2c,_0x3c30aa){return function(_0x213d76){if(_0x213d76){return _0x213d76[_0x3b80('0x27')](_0x310c2c)[_0x3b80('0x28')](function(_0x294dd1){return _0x294dd1;});}return null;};}function removeEntity(_0xbad2bc,_0x17bb8f){return function(_0x1a3121){if(_0x1a3121){return _0x1a3121[_0x3b80('0x29')]()[_0x3b80('0x28')](function(){_0xbad2bc[_0x3b80('0x1b')](0xcc)[_0x3b80('0x1c')]();});}};}function handleEntityNotFound(_0x3b44ad,_0x52244f){return function(_0x3d5849){if(!_0x3d5849){_0x3b44ad['sendStatus'](0x194);}return _0x3d5849;};}function handleError(_0x39b2a9,_0x4cb733){_0x4cb733=_0x4cb733||0x1f4;return function(_0x1f409b){logger['error'](_0x1f409b['stack']);if(_0x1f409b[_0x3b80('0x2a')]){delete _0x1f409b['name'];}_0x39b2a9['status'](_0x4cb733)[_0x3b80('0x2b')](_0x1f409b);};}exports[_0x3b80('0x2c')]=function(_0x18a4e9,_0x140115){var _0x4abf08={},_0x6c555e={},_0x4dbae6={'count':0x0,'rows':[]};var _0x445254=_['map'](db[_0x3b80('0x2d')][_0x3b80('0x2e')],function(_0x1899b6){return{'name':_0x1899b6[_0x3b80('0x2f')],'type':_0x1899b6[_0x3b80('0x30')][_0x3b80('0x31')]};});_0x6c555e[_0x3b80('0x32')]=_[_0x3b80('0x33')](_0x445254,_0x3b80('0x2a'));_0x6c555e['query']=_[_0x3b80('0x34')](_0x18a4e9[_0x3b80('0x35')]);_0x6c555e[_0x3b80('0x36')]=_[_0x3b80('0x37')](_0x6c555e[_0x3b80('0x32')],_0x6c555e[_0x3b80('0x35')]);_0x4abf08[_0x3b80('0x38')]=_[_0x3b80('0x37')](_0x6c555e[_0x3b80('0x32')],qs[_0x3b80('0x39')](_0x18a4e9[_0x3b80('0x35')][_0x3b80('0x39')]));_0x4abf08[_0x3b80('0x38')]=_0x4abf08[_0x3b80('0x38')]['length']?_0x4abf08['attributes']:_0x6c555e['model'];if(!_0x18a4e9['query'][_0x3b80('0x3a')](_0x3b80('0x3b'))){_0x4abf08[_0x3b80('0x1f')]=qs[_0x3b80('0x1f')](_0x18a4e9[_0x3b80('0x35')][_0x3b80('0x1f')]);_0x4abf08[_0x3b80('0x1d')]=qs[_0x3b80('0x1d')](_0x18a4e9[_0x3b80('0x35')][_0x3b80('0x1d')]);}_0x4abf08[_0x3b80('0x3c')]=qs[_0x3b80('0x3d')](_0x18a4e9['query'][_0x3b80('0x3d')]);_0x4abf08[_0x3b80('0x3e')]=qs[_0x3b80('0x36')](_['pick'](_0x18a4e9[_0x3b80('0x35')],_0x6c555e[_0x3b80('0x36')]),_0x445254);if(_0x18a4e9[_0x3b80('0x35')]['filter']){_0x4abf08[_0x3b80('0x3e')]=_[_0x3b80('0x3f')](_0x4abf08[_0x3b80('0x3e')],{'$or':_[_0x3b80('0x33')](_0x445254,function(_0x2e66a8){if(_0x2e66a8[_0x3b80('0x30')]!==_0x3b80('0x40')){var _0x534e3a={};_0x534e3a[_0x2e66a8[_0x3b80('0x2a')]]={'$like':'%'+_0x18a4e9[_0x3b80('0x35')][_0x3b80('0x41')]+'%'};return _0x534e3a;}})});}_0x4abf08=_['merge']({},_0x4abf08,_0x18a4e9[_0x3b80('0x42')]);var _0x2dad7d={'where':_0x4abf08[_0x3b80('0x3e')]};return db['FreshsalesField'][_0x3b80('0x20')](_0x2dad7d)[_0x3b80('0x28')](function(_0x2589e9){_0x4dbae6['count']=_0x2589e9;if(_0x18a4e9[_0x3b80('0x35')][_0x3b80('0x43')]){_0x4abf08[_0x3b80('0x44')]=[{'all':!![]}];}return db[_0x3b80('0x2d')][_0x3b80('0x45')](_0x4abf08);})[_0x3b80('0x28')](function(_0x114d0d){_0x4dbae6['rows']=_0x114d0d;return _0x4dbae6;})['then'](respondWithFilteredResult(_0x140115,_0x4abf08))[_0x3b80('0x46')](handleError(_0x140115,null));};exports['show']=function(_0x18577b,_0xe63079){var _0x93be61={'raw':!![],'where':{'id':_0x18577b['params']['id']}},_0x1fe57c={};_0x1fe57c['model']=_['keys'](db[_0x3b80('0x2d')]['rawAttributes']);_0x1fe57c[_0x3b80('0x35')]=_[_0x3b80('0x34')](_0x18577b[_0x3b80('0x35')]);_0x1fe57c['filters']=_[_0x3b80('0x37')](_0x1fe57c[_0x3b80('0x32')],_0x1fe57c[_0x3b80('0x35')]);_0x93be61[_0x3b80('0x38')]=_[_0x3b80('0x37')](_0x1fe57c[_0x3b80('0x32')],qs[_0x3b80('0x39')](_0x18577b[_0x3b80('0x35')][_0x3b80('0x39')]));_0x93be61[_0x3b80('0x38')]=_0x93be61['attributes'][_0x3b80('0x47')]?_0x93be61[_0x3b80('0x38')]:_0x1fe57c[_0x3b80('0x32')];if(_0x18577b[_0x3b80('0x35')][_0x3b80('0x43')]){_0x93be61['include']=[{'all':!![]}];}_0x93be61=_[_0x3b80('0x3f')]({},_0x93be61,_0x18577b['options']);return db['FreshsalesField'][_0x3b80('0x48')](_0x93be61)[_0x3b80('0x28')](handleEntityNotFound(_0xe63079,null))['then'](respondWithResult(_0xe63079,null))['catch'](handleError(_0xe63079,null));};exports[_0x3b80('0x49')]=function(_0x2292c0,_0x479d8a){return db[_0x3b80('0x2d')][_0x3b80('0x49')](_0x2292c0['body'],{})[_0x3b80('0x28')](respondWithResult(_0x479d8a,0xc9))[_0x3b80('0x46')](handleError(_0x479d8a,null));};exports[_0x3b80('0x27')]=function(_0x4162ee,_0x44e2bd){if(_0x4162ee[_0x3b80('0x4a')]['id']){delete _0x4162ee[_0x3b80('0x4a')]['id'];}return db[_0x3b80('0x2d')][_0x3b80('0x48')]({'where':{'id':_0x4162ee['params']['id']}})[_0x3b80('0x28')](handleEntityNotFound(_0x44e2bd,null))[_0x3b80('0x28')](saveUpdates(_0x4162ee[_0x3b80('0x4a')],null))[_0x3b80('0x28')](respondWithResult(_0x44e2bd,null))[_0x3b80('0x46')](handleError(_0x44e2bd,null));};exports[_0x3b80('0x29')]=function(_0x5ac11a,_0x372d96){return db[_0x3b80('0x2d')][_0x3b80('0x48')]({'where':{'id':_0x5ac11a[_0x3b80('0x4b')]['id']}})[_0x3b80('0x28')](handleEntityNotFound(_0x372d96,null))[_0x3b80('0x28')](removeEntity(_0x372d96,null))['catch'](handleError(_0x372d96,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1828309..aaac298 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 _0xcaef=['FieldId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','freshsales_unique_index','idField'];(function(_0x5c903c,_0x28e697){var _0x270557=function(_0x72a425){while(--_0x72a425){_0x5c903c['push'](_0x5c903c['shift']());}};_0x270557(++_0x28e697);}(_0xcaef,0x1c9));var _0xfcae=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xcaef[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xfcae('0x9'),'fields':[_0xfcae('0xa'),_0xfcae('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3611=['lodash','api','request-promise','path','rimraf','../../config/environment','exports','define','int_freshsales_fields','FieldId'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x3611,0x136));var _0x1361=function(_0x200fe8,_0x18c189){_0x200fe8=_0x200fe8-0x0;var _0x3dd77d=_0x3611[_0x200fe8];return _0x3dd77d;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('FreshsalesField',attributes,{'tableName':_0x1361('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x1361('0x9')],'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 c1be457..afb5753 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 _0x6f47=['request\x20sent','debug','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x6f47,0xc7));var _0x76f4=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6f47[_0x16d10f];return _0x50c823;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0x687b,0x14a));var _0xb687=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x687b[_0x55ff3e];return _0x2709eb;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c45450d..de6b7b2 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(_0xf8886b,_0x504891){var _0x321bd5=function(_0x3c116b){while(--_0x3c116b){_0xf8886b['push'](_0xf8886b['shift']());}};_0x321bd5(++_0x504891);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3efe87,_0x111ac2){var _0x38a341=function(_0x4a594e){while(--_0x4a594e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x38a341(++_0x111ac2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4990fa1..8d4f626 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 _0x38b2=['sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x3b34a5,_0x4ae1a2){var _0x46cc4a=function(_0x1f1e61){while(--_0x1f1e61){_0x3b34a5['push'](_0x3b34a5['shift']());}};_0x46cc4a(++_0x4ae1a2);}(_0x38b2,0xf6));var _0x238b=function(_0x474cd3,_0x2401f8){_0x474cd3=_0x474cd3-0x0;var _0xa4a9e3=_0x38b2[_0x474cd3];return _0xa4a9e3;};'use strict';var Sequelize=require(_0x238b('0x0'));module[_0x238b('0x1')]={'name':{'type':Sequelize[_0x238b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x238b('0x3')},'remoteUri':{'type':Sequelize[_0x238b('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x238b('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x238b('0x2')]},'serverUrl':{'type':Sequelize[_0x238b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x238b('0x4')](_0x238b('0x5'),'newTab'),'defaultValue':_0x238b('0x5')}}; \ No newline at end of file +var _0xbcff=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x28dc47,_0x5b49fb){var _0x41f308=function(_0x165d3e){while(--_0x165d3e){_0x28dc47['push'](_0x28dc47['shift']());}};_0x41f308(++_0x5b49fb);}(_0xbcff,0xbb));var _0xfbcf=function(_0x4db017,_0x5d769b){_0x4db017=_0x4db017-0x0;var _0x5d5374=_0xbcff[_0x4db017];return _0x5d5374;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbcf('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfbcf('0x1')],'unique':_0xfbcf('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xfbcf('0x1')]},'clientSecret':{'type':Sequelize[_0xfbcf('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfbcf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfbcf('0x3')](_0xfbcf('0x4'),_0xfbcf('0x5')),'defaultValue':_0xfbcf('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index fe3608b..f091dad 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 _0x8509=['fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','rows','catch','params','length','options','find','body','destroy','findOne','keys','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','clientSecret','username','password','securityToken','slice','substring','clientId','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes'];(function(_0x4a3d88,_0x3b7912){var _0x56b4ed=function(_0x5c05d9){while(--_0x5c05d9){_0x4a3d88['push'](_0x4a3d88['shift']());}};_0x56b4ed(++_0x3b7912);}(_0x8509,0x1c1));var _0x9850=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x8509[_0x50e7e0];return _0x1a0307;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9850('0x0'));var zipdir=require(_0x9850('0x1'));var jsonpatch=require(_0x9850('0x2'));var rp=require(_0x9850('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9850('0x4'));var util=require(_0x9850('0x5'));var path=require(_0x9850('0x6'));var sox=require('sox');var csv=require(_0x9850('0x7'));var ejs=require(_0x9850('0x8'));var fs=require('fs');var fs_extra=require(_0x9850('0x9'));var _=require(_0x9850('0xa'));var squel=require(_0x9850('0xb'));var crypto=require(_0x9850('0xc'));var jsforce=require(_0x9850('0xd'));var deskjs=require(_0x9850('0xe'));var toCsv=require(_0x9850('0x7'));var querystring=require('querystring');var Papa=require(_0x9850('0xf'));var Redis=require(_0x9850('0x10'));var authService=require(_0x9850('0x11'));var qs=require(_0x9850('0x12'));var as=require(_0x9850('0x13'));var hardwareService=require(_0x9850('0x14'));var logger=require(_0x9850('0x15'))(_0x9850('0x16'));var utils=require('../../config/utils');var config=require(_0x9850('0x17'));var licenseUtil=require(_0x9850('0x18'));var db=require(_0x9850('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31ee79,_0x3864c1){_0x3864c1=_0x3864c1||0xcc;return function(_0xf4ff4e){if(_0xf4ff4e){return _0x31ee79[_0x9850('0x1a')](_0x3864c1);}return _0x31ee79[_0x9850('0x1b')](_0x3864c1)['end']();};}function respondWithResult(_0xb15ba8,_0x4e95e3){_0x4e95e3=_0x4e95e3||0xc8;return function(_0x3717e1){if(_0x3717e1){return _0xb15ba8[_0x9850('0x1b')](_0x4e95e3)[_0x9850('0x1c')](_0x3717e1);}};}function respondWithFilteredResult(_0x3f337b,_0x174c32){return function(_0x33d73d){if(_0x33d73d){var _0x1bba31=typeof _0x174c32[_0x9850('0x1d')]===_0x9850('0x1e')&&typeof _0x174c32[_0x9850('0x1f')]===_0x9850('0x1e');var _0x543c4d=_0x33d73d['count'];var _0x4291be=_0x1bba31?0x0:_0x174c32['offset'];var _0x25e505=_0x1bba31?_0x33d73d['count']:_0x174c32['offset']+_0x174c32[_0x9850('0x1f')];var _0x500903;if(_0x25e505>=_0x543c4d){_0x25e505=_0x543c4d;_0x500903=0xc8;}else{_0x500903=0xce;}_0x3f337b[_0x9850('0x1b')](_0x500903);return _0x3f337b[_0x9850('0x20')](_0x9850('0x21'),_0x4291be+'-'+_0x25e505+'/'+_0x543c4d)[_0x9850('0x1c')](_0x33d73d);}return null;};}function patchUpdates(_0x5beb12){return function(_0x58b511){try{jsonpatch[_0x9850('0x22')](_0x58b511,_0x5beb12,!![]);}catch(_0x5c7aa4){return BPromise[_0x9850('0x23')](_0x5c7aa4);}return _0x58b511[_0x9850('0x24')]();};}function saveUpdates(_0x278cda,_0x2f9c36){return function(_0x1cb8bd){if(_0x1cb8bd){return _0x1cb8bd[_0x9850('0x25')](_0x278cda)[_0x9850('0x26')](function(_0xfb10c9){return _0xfb10c9;});}return null;};}function removeEntity(_0xa0f27a,_0x359e0c){return function(_0xc87d29){if(_0xc87d29){return _0xc87d29['destroy']()[_0x9850('0x26')](function(){_0xa0f27a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b7de,_0x15fac5){return function(_0x589fa8){if(!_0x589fa8){_0x19b7de[_0x9850('0x1a')](0x194);}return _0x589fa8;};}function handleError(_0x25e30b,_0x49bf76){_0x49bf76=_0x49bf76||0x1f4;return function(_0x368273){logger[_0x9850('0x27')](_0x368273[_0x9850('0x28')]);if(_0x368273[_0x9850('0x29')]){delete _0x368273[_0x9850('0x29')];}_0x25e30b['status'](_0x49bf76)[_0x9850('0x2a')](_0x368273);};}exports[_0x9850('0x2b')]=function(_0x310eac,_0x3e596a){var _0x14dc6b={},_0x332581={},_0x439ad3={'count':0x0,'rows':[]};var _0x4e618c=_[_0x9850('0x2c')](db[_0x9850('0x2d')][_0x9850('0x2e')],function(_0x175ea7){return{'name':_0x175ea7[_0x9850('0x2f')],'type':_0x175ea7[_0x9850('0x30')][_0x9850('0x31')]};});_0x332581['model']=_[_0x9850('0x2c')](_0x4e618c,_0x9850('0x29'));_0x332581[_0x9850('0x32')]=_['keys'](_0x310eac[_0x9850('0x32')]);_0x332581[_0x9850('0x33')]=_[_0x9850('0x34')](_0x332581[_0x9850('0x35')],_0x332581[_0x9850('0x32')]);_0x14dc6b['attributes']=_[_0x9850('0x34')](_0x332581['model'],qs[_0x9850('0x36')](_0x310eac[_0x9850('0x32')][_0x9850('0x36')]));_0x14dc6b[_0x9850('0x37')]=_0x14dc6b[_0x9850('0x37')]['length']?_0x14dc6b[_0x9850('0x37')]:_0x332581[_0x9850('0x35')];if(!_0x310eac[_0x9850('0x32')][_0x9850('0x38')](_0x9850('0x39'))){_0x14dc6b[_0x9850('0x1f')]=qs[_0x9850('0x1f')](_0x310eac[_0x9850('0x32')][_0x9850('0x1f')]);_0x14dc6b[_0x9850('0x1d')]=qs[_0x9850('0x1d')](_0x310eac[_0x9850('0x32')]['offset']);}_0x14dc6b[_0x9850('0x3a')]=qs[_0x9850('0x3b')](_0x310eac[_0x9850('0x32')][_0x9850('0x3b')]);_0x14dc6b['where']=qs['filters'](_[_0x9850('0x3c')](_0x310eac['query'],_0x332581[_0x9850('0x33')]),_0x4e618c);if(_0x310eac[_0x9850('0x32')][_0x9850('0x3d')]){_0x14dc6b['where']=_[_0x9850('0x3e')](_0x14dc6b[_0x9850('0x3f')],{'$or':_[_0x9850('0x2c')](_0x4e618c,function(_0x21c2e1){if(_0x21c2e1[_0x9850('0x30')]!==_0x9850('0x40')){var _0x726323={};_0x726323[_0x21c2e1[_0x9850('0x29')]]={'$like':'%'+_0x310eac[_0x9850('0x32')][_0x9850('0x3d')]+'%'};return _0x726323;}})});}_0x14dc6b=_[_0x9850('0x3e')]({},_0x14dc6b,_0x310eac['options']);var _0x2db111={'where':_0x14dc6b[_0x9850('0x3f')]};return db['SalesforceAccount'][_0x9850('0x41')](_0x2db111)[_0x9850('0x26')](function(_0x3ac383){_0x439ad3['count']=_0x3ac383;if(_0x310eac['query'][_0x9850('0x42')]){_0x14dc6b[_0x9850('0x43')]=[{'all':!![]}];}return db[_0x9850('0x2d')]['findAll'](_0x14dc6b);})[_0x9850('0x26')](function(_0xbdc710){_0x439ad3[_0x9850('0x44')]=_0xbdc710;return _0x439ad3;})[_0x9850('0x26')](respondWithFilteredResult(_0x3e596a,_0x14dc6b))[_0x9850('0x45')](handleError(_0x3e596a,null));};exports['show']=function(_0x1532b5,_0x332b66){var _0x17e9f5={'raw':![],'where':{'id':_0x1532b5[_0x9850('0x46')]['id']}},_0x16c007={};_0x16c007[_0x9850('0x35')]=_['keys'](db[_0x9850('0x2d')]['rawAttributes']);_0x16c007['query']=_['keys'](_0x1532b5[_0x9850('0x32')]);_0x16c007[_0x9850('0x33')]=_[_0x9850('0x34')](_0x16c007[_0x9850('0x35')],_0x16c007['query']);_0x17e9f5[_0x9850('0x37')]=_[_0x9850('0x34')](_0x16c007[_0x9850('0x35')],qs[_0x9850('0x36')](_0x1532b5[_0x9850('0x32')][_0x9850('0x36')]));_0x17e9f5[_0x9850('0x37')]=_0x17e9f5[_0x9850('0x37')][_0x9850('0x47')]?_0x17e9f5[_0x9850('0x37')]:_0x16c007[_0x9850('0x35')];if(_0x1532b5[_0x9850('0x32')][_0x9850('0x42')]){_0x17e9f5[_0x9850('0x43')]=[{'all':!![]}];}_0x17e9f5=_[_0x9850('0x3e')]({},_0x17e9f5,_0x1532b5[_0x9850('0x48')]);return db[_0x9850('0x2d')][_0x9850('0x49')](_0x17e9f5)[_0x9850('0x26')](handleEntityNotFound(_0x332b66,null))[_0x9850('0x26')](respondWithResult(_0x332b66,null))[_0x9850('0x45')](handleError(_0x332b66,null));};exports['create']=function(_0x106d72,_0x7a7d0b){return db['SalesforceAccount']['create'](_0x106d72[_0x9850('0x4a')],{})[_0x9850('0x26')](respondWithResult(_0x7a7d0b,0xc9))[_0x9850('0x45')](handleError(_0x7a7d0b,null));};exports[_0x9850('0x25')]=function(_0x43790d,_0xb28e3b){if(_0x43790d[_0x9850('0x4a')]['id']){delete _0x43790d[_0x9850('0x4a')]['id'];}return db[_0x9850('0x2d')]['find']({'where':{'id':_0x43790d[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0xb28e3b,null))[_0x9850('0x26')](saveUpdates(_0x43790d[_0x9850('0x4a')],null))[_0x9850('0x26')](respondWithResult(_0xb28e3b,null))[_0x9850('0x45')](handleError(_0xb28e3b,null));};exports[_0x9850('0x4b')]=function(_0x638379,_0x4aff41){return db[_0x9850('0x2d')]['find']({'where':{'id':_0x638379[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x4aff41,null))[_0x9850('0x26')](removeEntity(_0x4aff41,null))[_0x9850('0x45')](handleError(_0x4aff41,null));};exports['getConfigurations']=function(_0x31ce5c,_0x15ba9b,_0x5d88f){var _0x35087c={};var _0x496043={};var _0x282210;var _0x2e8538;return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x31ce5c[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x15ba9b,null))[_0x9850('0x26')](function(_0x459336){if(_0x459336){_0x282210=_0x459336;_0x496043[_0x9850('0x35')]=_[_0x9850('0x4d')](db[_0x9850('0x4e')][_0x9850('0x2e')]);_0x496043[_0x9850('0x32')]=_[_0x9850('0x4d')](_0x31ce5c['query']);_0x496043[_0x9850('0x33')]=_[_0x9850('0x34')](_0x496043[_0x9850('0x35')],_0x496043[_0x9850('0x32')]);_0x35087c[_0x9850('0x37')]=_[_0x9850('0x34')](_0x496043[_0x9850('0x35')],qs[_0x9850('0x36')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x36')]));_0x35087c['attributes']=_0x35087c[_0x9850('0x37')][_0x9850('0x47')]?_0x35087c['attributes']:_0x496043['model'];_0x35087c['order']=qs[_0x9850('0x3b')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x3b')]);_0x35087c['where']=qs[_0x9850('0x33')](_[_0x9850('0x3c')](_0x31ce5c['query'],_0x496043[_0x9850('0x33')]));if(_0x31ce5c[_0x9850('0x32')]['filter']){_0x35087c[_0x9850('0x3f')]=_[_0x9850('0x3e')](_0x35087c[_0x9850('0x3f')],{'$or':_[_0x9850('0x2c')](_0x35087c['attributes'],function(_0x38d92f){var _0x50ebc5={};_0x50ebc5[_0x38d92f]={'$like':'%'+_0x31ce5c[_0x9850('0x32')][_0x9850('0x3d')]+'%'};return _0x50ebc5;})});}_0x35087c=_[_0x9850('0x3e')]({},_0x35087c,_0x31ce5c[_0x9850('0x48')]);return _0x282210[_0x9850('0x4f')](_0x35087c);}})['then'](function(_0x115c82){if(_0x115c82){_0x2e8538=_0x115c82[_0x9850('0x47')];if(!_0x31ce5c[_0x9850('0x32')][_0x9850('0x38')](_0x9850('0x39'))){_0x35087c[_0x9850('0x1f')]=qs[_0x9850('0x1f')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x1f')]);_0x35087c[_0x9850('0x1d')]=qs['offset'](_0x31ce5c[_0x9850('0x32')][_0x9850('0x1d')]);}return _0x282210[_0x9850('0x4f')](_0x35087c);}})['then'](function(_0x4b0310){if(_0x4b0310){return _0x4b0310?{'count':_0x2e8538,'rows':_0x4b0310}:null;}})[_0x9850('0x26')](respondWithResult(_0x15ba9b,null))[_0x9850('0x45')](handleError(_0x15ba9b,null));};exports[_0x9850('0x50')]=function(_0x24414a,_0x22dca1,_0x28efa2){if(_0x24414a['body']['id']){delete _0x24414a[_0x9850('0x4a')]['id'];}return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x24414a[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x22dca1,null))[_0x9850('0x26')](function(_0x93eb2d){if(_0x93eb2d){_0x24414a['body'][_0x9850('0x51')]=_0x93eb2d['id'];_0x24414a['body'][_0x9850('0x52')]=integrations[_0x9850('0x53')](_0x24414a[_0x9850('0x4a')][_0x9850('0x54')],_0x24414a[_0x9850('0x4a')][_0x9850('0x30')]);_0x24414a[_0x9850('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x24414a[_0x9850('0x4a')]['channel'],_0x24414a[_0x9850('0x4a')][_0x9850('0x30')]);return db['SalesforceConfiguration']['create'](_0x24414a[_0x9850('0x4a')],{'include':[{'model':db[_0x9850('0x55')],'as':_0x9850('0x52')},{'model':db[_0x9850('0x55')],'as':_0x9850('0x56')}]});}return null;})[_0x9850('0x26')](respondWithResult(_0x22dca1,null))[_0x9850('0x45')](handleError(_0x22dca1,null));};exports[_0x9850('0x57')]=function(_0x3c5879,_0x3a9e46,_0x266c34){var _0x32b4fd;var _0x23789e='';var _0x49ed94='Task';return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x3c5879[_0x9850('0x46')]['id']},'attributes':['id',_0x9850('0x58'),'clientId',_0x9850('0x59'),_0x9850('0x5a'),_0x9850('0x5b'),_0x9850('0x5c')]})[_0x9850('0x26')](handleEntityNotFound(_0x3a9e46,null))[_0x9850('0x26')](function(_0x48da2f){if(_0x48da2f){_0x23789e=_0x48da2f[_0x9850('0x58')];var _0x5bd581=_0x23789e[_0x9850('0x5d')](-0x1);if(_0x5bd581==='/'){_0x23789e=_0x23789e[_0x9850('0x5e')](0x0,_0x23789e['lastIndexOf'](_0x5bd581));}_0x32b4fd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x23789e,'clientId':_0x48da2f[_0x9850('0x5f')],'clientSecret':_0x48da2f['clientSecret']}});return _0x32b4fd[_0x9850('0x60')](_0x48da2f[_0x9850('0x5a')],_0x48da2f['password'][_0x9850('0x61')](_0x48da2f[_0x9850('0x5c')]));}})[_0x9850('0x26')](function(_0x17de0a){if(_0x17de0a){if(!_['isNil'](_0x3c5879[_0x9850('0x32')]['ticketType'])){_0x49ed94=_0x3c5879[_0x9850('0x32')][_0x9850('0x62')];}return _0x32b4fd[_0x9850('0x63')](_0x49ed94)[_0x9850('0x64')]();}})['then'](function(_0x4f4517){var _0x5f1e63=[_0x9850('0x65'),_0x9850('0x66'),_0x9850('0x67'),'IsRecurrence',_0x9850('0x68'),_0x9850('0x69')];var _0x54f973=[_0x9850('0x6a'),_0x9850('0x6b'),_0x9850('0x6c'),_0x9850('0x6d'),_0x9850('0x6e'),'textarea',_0x9850('0x6f')];if(_0x4f4517){_[_0x9850('0x70')](_0x4f4517[_0x9850('0x36')],function(_0x2491c4){return _0x5f1e63[_0x9850('0x71')](_0x2491c4[_0x9850('0x29')])||!_0x54f973[_0x9850('0x71')](_0x2491c4[_0x9850('0x30')]);});return{'count':_0x4f4517[_0x9850('0x36')]['length'],'rows':_[_0x9850('0x2c')](_0x4f4517[_0x9850('0x36')],function(_0x227049){return{'id':_0x227049[_0x9850('0x29')],'name':_0x227049[_0x9850('0x72')],'custom':_0x227049[_0x9850('0x73')],'options':_0x227049[_0x9850('0x74')]['length']>0x0?_[_0x9850('0x2c')](_0x227049[_0x9850('0x74')],function(_0x98eaea){return{'name':_0x98eaea[_0x9850('0x72')],'value':_0x98eaea[_0x9850('0x75')]};}):_0x227049[_0x9850('0x30')]==_0x9850('0x6d')?[{'name':_0x9850('0x76'),'value':_0x9850('0x77')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x3a9e46,null))[_0x9850('0x45')](function(_0x239e13){var _0x33dcad=_0x3c5879[_0x9850('0x32')][_0x9850('0x78')]?0x1f4:_0x239e13[_0x9850('0x79')]||0x1f4;logger[_0x9850('0x27')](_0x9850('0x7a'),_0x9850('0x57'),_0x33dcad,JSON[_0x9850('0x7b')](_0x239e13));delete _0x239e13[_0x9850('0x29')];if(_0x33dcad===0x191){_0x33dcad=0x190;}_0x3a9e46[_0x9850('0x1b')](_0x33dcad)['send'](_0x3c5879[_0x9850('0x32')][_0x9850('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x239e13[_0x9850('0x79')]}:_0x239e13);});}; \ No newline at end of file +var _0xd65d=['statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','limit','undefined','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','username','concat','securityToken','ticketType','OwnerId','IsReminderSet','Subject','Description','picklist','boolean','email','textarea','includes','label','custom','picklistValues','value','true','False','false'];(function(_0x11421d,_0x257261){var _0x46b17b=function(_0x3bc9c9){while(--_0x3bc9c9){_0x11421d['push'](_0x11421d['shift']());}};_0x46b17b(++_0x257261);}(_0xd65d,0x171));var _0xdd65=function(_0x350d12,_0x5c2841){_0x350d12=_0x350d12-0x0;var _0x137d46=_0xd65d[_0x350d12];return _0x137d46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd65('0x0'));var zipdir=require(_0xdd65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd65('0x2'));var moment=require(_0xdd65('0x3'));var BPromise=require(_0xdd65('0x4'));var Mustache=require(_0xdd65('0x5'));var util=require(_0xdd65('0x6'));var path=require(_0xdd65('0x7'));var sox=require(_0xdd65('0x8'));var csv=require(_0xdd65('0x9'));var ejs=require(_0xdd65('0xa'));var fs=require('fs');var fs_extra=require(_0xdd65('0xb'));var _=require('lodash');var squel=require(_0xdd65('0xc'));var crypto=require(_0xdd65('0xd'));var jsforce=require(_0xdd65('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdd65('0xf'));var Redis=require(_0xdd65('0x10'));var authService=require(_0xdd65('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdd65('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd65('0x13'))(_0xdd65('0x14'));var utils=require(_0xdd65('0x15'));var config=require(_0xdd65('0x16'));var licenseUtil=require(_0xdd65('0x17'));var db=require(_0xdd65('0x18'))['db'];var integrations=require(_0xdd65('0x19'));function respondWithStatusCode(_0x1bf6b3,_0x4e426f){_0x4e426f=_0x4e426f||0xcc;return function(_0x55c3c6){if(_0x55c3c6){return _0x1bf6b3['sendStatus'](_0x4e426f);}return _0x1bf6b3[_0xdd65('0x1a')](_0x4e426f)[_0xdd65('0x1b')]();};}function respondWithResult(_0x34bd40,_0x5fab1b){_0x5fab1b=_0x5fab1b||0xc8;return function(_0x1958f2){if(_0x1958f2){return _0x34bd40['status'](_0x5fab1b)['json'](_0x1958f2);}};}function respondWithFilteredResult(_0x3cea93,_0x59e80){return function(_0x3e38c0){if(_0x3e38c0){var _0x4da5a6=typeof _0x59e80[_0xdd65('0x1c')]==='undefined'&&typeof _0x59e80[_0xdd65('0x1d')]===_0xdd65('0x1e');var _0x4c76f3=_0x3e38c0['count'];var _0xf4125=_0x4da5a6?0x0:_0x59e80[_0xdd65('0x1c')];var _0x249523=_0x4da5a6?_0x3e38c0['count']:_0x59e80[_0xdd65('0x1c')]+_0x59e80['limit'];var _0x143bd6;if(_0x249523>=_0x4c76f3){_0x249523=_0x4c76f3;_0x143bd6=0xc8;}else{_0x143bd6=0xce;}_0x3cea93[_0xdd65('0x1a')](_0x143bd6);return _0x3cea93['set'](_0xdd65('0x1f'),_0xf4125+'-'+_0x249523+'/'+_0x4c76f3)[_0xdd65('0x20')](_0x3e38c0);}return null;};}function patchUpdates(_0x510f8a){return function(_0x1f4053){try{jsonpatch[_0xdd65('0x21')](_0x1f4053,_0x510f8a,!![]);}catch(_0x34c0bf){return BPromise[_0xdd65('0x22')](_0x34c0bf);}return _0x1f4053['save']();};}function saveUpdates(_0x4fdd29,_0x30cd0a){return function(_0x3163a1){if(_0x3163a1){return _0x3163a1[_0xdd65('0x23')](_0x4fdd29)[_0xdd65('0x24')](function(_0x394662){return _0x394662;});}return null;};}function removeEntity(_0x4ebf2c,_0x5ccb21){return function(_0x3896eb){if(_0x3896eb){return _0x3896eb[_0xdd65('0x25')]()[_0xdd65('0x24')](function(){_0x4ebf2c['status'](0xcc)[_0xdd65('0x1b')]();});}};}function handleEntityNotFound(_0x24b93b,_0x2426e8){return function(_0x595fbd){if(!_0x595fbd){_0x24b93b['sendStatus'](0x194);}return _0x595fbd;};}function handleError(_0x1c3378,_0x300df4){_0x300df4=_0x300df4||0x1f4;return function(_0x214b74){logger[_0xdd65('0x26')](_0x214b74['stack']);if(_0x214b74[_0xdd65('0x27')]){delete _0x214b74[_0xdd65('0x27')];}_0x1c3378[_0xdd65('0x1a')](_0x300df4)['send'](_0x214b74);};}exports[_0xdd65('0x28')]=function(_0x50b963,_0x242e44){var _0x464262={},_0x52096d={},_0x4a30b7={'count':0x0,'rows':[]};var _0x158427=_[_0xdd65('0x29')](db[_0xdd65('0x2a')][_0xdd65('0x2b')],function(_0x58b9ed){return{'name':_0x58b9ed[_0xdd65('0x2c')],'type':_0x58b9ed[_0xdd65('0x2d')][_0xdd65('0x2e')]};});_0x52096d[_0xdd65('0x2f')]=_[_0xdd65('0x29')](_0x158427,_0xdd65('0x27'));_0x52096d[_0xdd65('0x30')]=_[_0xdd65('0x31')](_0x50b963[_0xdd65('0x30')]);_0x52096d[_0xdd65('0x32')]=_[_0xdd65('0x33')](_0x52096d['model'],_0x52096d[_0xdd65('0x30')]);_0x464262[_0xdd65('0x34')]=_['intersection'](_0x52096d[_0xdd65('0x2f')],qs[_0xdd65('0x35')](_0x50b963[_0xdd65('0x30')][_0xdd65('0x35')]));_0x464262['attributes']=_0x464262['attributes'][_0xdd65('0x36')]?_0x464262[_0xdd65('0x34')]:_0x52096d[_0xdd65('0x2f')];if(!_0x50b963[_0xdd65('0x30')]['hasOwnProperty']('nolimit')){_0x464262[_0xdd65('0x1d')]=qs[_0xdd65('0x1d')](_0x50b963[_0xdd65('0x30')][_0xdd65('0x1d')]);_0x464262[_0xdd65('0x1c')]=qs[_0xdd65('0x1c')](_0x50b963['query']['offset']);}_0x464262[_0xdd65('0x37')]=qs[_0xdd65('0x38')](_0x50b963[_0xdd65('0x30')][_0xdd65('0x38')]);_0x464262[_0xdd65('0x39')]=qs[_0xdd65('0x32')](_[_0xdd65('0x3a')](_0x50b963[_0xdd65('0x30')],_0x52096d['filters']),_0x158427);if(_0x50b963[_0xdd65('0x30')][_0xdd65('0x3b')]){_0x464262[_0xdd65('0x39')]=_[_0xdd65('0x3c')](_0x464262[_0xdd65('0x39')],{'$or':_[_0xdd65('0x29')](_0x158427,function(_0x272834){if(_0x272834[_0xdd65('0x2d')]!==_0xdd65('0x3d')){var _0x290621={};_0x290621[_0x272834[_0xdd65('0x27')]]={'$like':'%'+_0x50b963[_0xdd65('0x30')][_0xdd65('0x3b')]+'%'};return _0x290621;}})});}_0x464262=_['merge']({},_0x464262,_0x50b963['options']);var _0x178d9d={'where':_0x464262[_0xdd65('0x39')]};return db[_0xdd65('0x2a')][_0xdd65('0x3e')](_0x178d9d)[_0xdd65('0x24')](function(_0x67d964){_0x4a30b7['count']=_0x67d964;if(_0x50b963['query'][_0xdd65('0x3f')]){_0x464262[_0xdd65('0x40')]=[{'all':!![]}];}return db[_0xdd65('0x2a')][_0xdd65('0x41')](_0x464262);})[_0xdd65('0x24')](function(_0x441072){_0x4a30b7[_0xdd65('0x42')]=_0x441072;return _0x4a30b7;})[_0xdd65('0x24')](respondWithFilteredResult(_0x242e44,_0x464262))[_0xdd65('0x43')](handleError(_0x242e44,null));};exports[_0xdd65('0x44')]=function(_0x16ede4,_0x235d9c){var _0xa16e69={'raw':![],'where':{'id':_0x16ede4[_0xdd65('0x45')]['id']}},_0x26e740={};_0x26e740[_0xdd65('0x2f')]=_['keys'](db[_0xdd65('0x2a')][_0xdd65('0x2b')]);_0x26e740['query']=_[_0xdd65('0x31')](_0x16ede4[_0xdd65('0x30')]);_0x26e740[_0xdd65('0x32')]=_['intersection'](_0x26e740[_0xdd65('0x2f')],_0x26e740[_0xdd65('0x30')]);_0xa16e69[_0xdd65('0x34')]=_[_0xdd65('0x33')](_0x26e740[_0xdd65('0x2f')],qs[_0xdd65('0x35')](_0x16ede4[_0xdd65('0x30')][_0xdd65('0x35')]));_0xa16e69[_0xdd65('0x34')]=_0xa16e69[_0xdd65('0x34')][_0xdd65('0x36')]?_0xa16e69[_0xdd65('0x34')]:_0x26e740[_0xdd65('0x2f')];if(_0x16ede4[_0xdd65('0x30')][_0xdd65('0x3f')]){_0xa16e69[_0xdd65('0x40')]=[{'all':!![]}];}_0xa16e69=_['merge']({},_0xa16e69,_0x16ede4['options']);return db[_0xdd65('0x2a')][_0xdd65('0x46')](_0xa16e69)[_0xdd65('0x24')](handleEntityNotFound(_0x235d9c,null))['then'](respondWithResult(_0x235d9c,null))['catch'](handleError(_0x235d9c,null));};exports['create']=function(_0xc8f9b6,_0x5899cb){return db[_0xdd65('0x2a')][_0xdd65('0x47')](_0xc8f9b6[_0xdd65('0x48')],{})[_0xdd65('0x24')](respondWithResult(_0x5899cb,0xc9))['catch'](handleError(_0x5899cb,null));};exports[_0xdd65('0x23')]=function(_0x1a1973,_0x9dc660){if(_0x1a1973['body']['id']){delete _0x1a1973['body']['id'];}return db['SalesforceAccount'][_0xdd65('0x46')]({'where':{'id':_0x1a1973[_0xdd65('0x45')]['id']}})[_0xdd65('0x24')](handleEntityNotFound(_0x9dc660,null))['then'](saveUpdates(_0x1a1973[_0xdd65('0x48')],null))['then'](respondWithResult(_0x9dc660,null))[_0xdd65('0x43')](handleError(_0x9dc660,null));};exports[_0xdd65('0x25')]=function(_0x2c4511,_0x41d96b){return db[_0xdd65('0x2a')][_0xdd65('0x46')]({'where':{'id':_0x2c4511['params']['id']}})[_0xdd65('0x24')](handleEntityNotFound(_0x41d96b,null))[_0xdd65('0x24')](removeEntity(_0x41d96b,null))['catch'](handleError(_0x41d96b,null));};exports[_0xdd65('0x49')]=function(_0x5500bd,_0x453a21,_0x45c2ca){var _0x127cb2={};var _0x4f7824={};var _0x561c51;var _0x41f486;return db['SalesforceAccount'][_0xdd65('0x4a')]({'where':{'id':_0x5500bd[_0xdd65('0x45')]['id']}})['then'](handleEntityNotFound(_0x453a21,null))[_0xdd65('0x24')](function(_0x10b635){if(_0x10b635){_0x561c51=_0x10b635;_0x4f7824[_0xdd65('0x2f')]=_[_0xdd65('0x31')](db['SalesforceConfiguration'][_0xdd65('0x2b')]);_0x4f7824[_0xdd65('0x30')]=_[_0xdd65('0x31')](_0x5500bd['query']);_0x4f7824[_0xdd65('0x32')]=_[_0xdd65('0x33')](_0x4f7824[_0xdd65('0x2f')],_0x4f7824[_0xdd65('0x30')]);_0x127cb2[_0xdd65('0x34')]=_[_0xdd65('0x33')](_0x4f7824[_0xdd65('0x2f')],qs['fields'](_0x5500bd[_0xdd65('0x30')][_0xdd65('0x35')]));_0x127cb2['attributes']=_0x127cb2['attributes'][_0xdd65('0x36')]?_0x127cb2['attributes']:_0x4f7824[_0xdd65('0x2f')];_0x127cb2['order']=qs[_0xdd65('0x38')](_0x5500bd[_0xdd65('0x30')][_0xdd65('0x38')]);_0x127cb2[_0xdd65('0x39')]=qs[_0xdd65('0x32')](_[_0xdd65('0x3a')](_0x5500bd[_0xdd65('0x30')],_0x4f7824[_0xdd65('0x32')]));if(_0x5500bd['query'][_0xdd65('0x3b')]){_0x127cb2[_0xdd65('0x39')]=_[_0xdd65('0x3c')](_0x127cb2[_0xdd65('0x39')],{'$or':_[_0xdd65('0x29')](_0x127cb2[_0xdd65('0x34')],function(_0x53191d){var _0x2cc98b={};_0x2cc98b[_0x53191d]={'$like':'%'+_0x5500bd[_0xdd65('0x30')][_0xdd65('0x3b')]+'%'};return _0x2cc98b;})});}_0x127cb2=_[_0xdd65('0x3c')]({},_0x127cb2,_0x5500bd[_0xdd65('0x4b')]);return _0x561c51[_0xdd65('0x49')](_0x127cb2);}})[_0xdd65('0x24')](function(_0x4bdf7f){if(_0x4bdf7f){_0x41f486=_0x4bdf7f[_0xdd65('0x36')];if(!_0x5500bd[_0xdd65('0x30')]['hasOwnProperty'](_0xdd65('0x4c'))){_0x127cb2['limit']=qs[_0xdd65('0x1d')](_0x5500bd[_0xdd65('0x30')]['limit']);_0x127cb2[_0xdd65('0x1c')]=qs[_0xdd65('0x1c')](_0x5500bd['query'][_0xdd65('0x1c')]);}return _0x561c51[_0xdd65('0x49')](_0x127cb2);}})[_0xdd65('0x24')](function(_0x98fd77){if(_0x98fd77){return _0x98fd77?{'count':_0x41f486,'rows':_0x98fd77}:null;}})[_0xdd65('0x24')](respondWithResult(_0x453a21,null))[_0xdd65('0x43')](handleError(_0x453a21,null));};exports[_0xdd65('0x4d')]=function(_0x2966ed,_0x100222,_0x396e1a){if(_0x2966ed[_0xdd65('0x48')]['id']){delete _0x2966ed[_0xdd65('0x48')]['id'];}return db['SalesforceAccount'][_0xdd65('0x4a')]({'where':{'id':_0x2966ed[_0xdd65('0x45')]['id']}})[_0xdd65('0x24')](handleEntityNotFound(_0x100222,null))[_0xdd65('0x24')](function(_0x4a041e){if(_0x4a041e){_0x2966ed['body'][_0xdd65('0x4e')]=_0x4a041e['id'];_0x2966ed[_0xdd65('0x48')][_0xdd65('0x4f')]=integrations[_0xdd65('0x50')](_0x2966ed[_0xdd65('0x48')][_0xdd65('0x51')],_0x2966ed[_0xdd65('0x48')][_0xdd65('0x2d')]);_0x2966ed[_0xdd65('0x48')][_0xdd65('0x52')]=integrations[_0xdd65('0x53')](_0x2966ed[_0xdd65('0x48')][_0xdd65('0x51')],_0x2966ed[_0xdd65('0x48')]['type']);return db[_0xdd65('0x54')][_0xdd65('0x47')](_0x2966ed['body'],{'include':[{'model':db[_0xdd65('0x55')],'as':_0xdd65('0x4f')},{'model':db[_0xdd65('0x55')],'as':_0xdd65('0x52')}]});}return null;})['then'](respondWithResult(_0x100222,null))[_0xdd65('0x43')](handleError(_0x100222,null));};exports[_0xdd65('0x56')]=function(_0x30f4aa,_0x566d9e,_0x435c11){var _0x13b0a2;var _0x46817f='';var _0x1a5dcd=_0xdd65('0x57');return db['SalesforceAccount'][_0xdd65('0x4a')]({'where':{'id':_0x30f4aa[_0xdd65('0x45')]['id']},'attributes':['id',_0xdd65('0x58'),_0xdd65('0x59'),_0xdd65('0x5a'),'username',_0xdd65('0x5b'),'securityToken']})[_0xdd65('0x24')](handleEntityNotFound(_0x566d9e,null))[_0xdd65('0x24')](function(_0x5c6ca8){if(_0x5c6ca8){_0x46817f=_0x5c6ca8[_0xdd65('0x58')];var _0x3ad0bb=_0x46817f[_0xdd65('0x5c')](-0x1);if(_0x3ad0bb==='/'){_0x46817f=_0x46817f[_0xdd65('0x5d')](0x0,_0x46817f[_0xdd65('0x5e')](_0x3ad0bb));}_0x13b0a2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x46817f,'clientId':_0x5c6ca8[_0xdd65('0x59')],'clientSecret':_0x5c6ca8[_0xdd65('0x5a')]}});return _0x13b0a2['login'](_0x5c6ca8[_0xdd65('0x5f')],_0x5c6ca8[_0xdd65('0x5b')][_0xdd65('0x60')](_0x5c6ca8[_0xdd65('0x61')]));}})[_0xdd65('0x24')](function(_0x31ac64){if(_0x31ac64){if(!_['isNil'](_0x30f4aa[_0xdd65('0x30')][_0xdd65('0x62')])){_0x1a5dcd=_0x30f4aa[_0xdd65('0x30')]['ticketType'];}return _0x13b0a2['sobject'](_0x1a5dcd)['describe']();}})[_0xdd65('0x24')](function(_0xaf36b5){var _0x400d4e=[_0xdd65('0x63'),'ActivityDate',_0xdd65('0x64'),'IsRecurrence',_0xdd65('0x65'),_0xdd65('0x66')];var _0x2e9b8a=['string','int',_0xdd65('0x67'),_0xdd65('0x68'),_0xdd65('0x69'),_0xdd65('0x6a'),'phone'];if(_0xaf36b5){_['remove'](_0xaf36b5[_0xdd65('0x35')],function(_0x353988){return _0x400d4e[_0xdd65('0x6b')](_0x353988[_0xdd65('0x27')])||!_0x2e9b8a[_0xdd65('0x6b')](_0x353988[_0xdd65('0x2d')]);});return{'count':_0xaf36b5[_0xdd65('0x35')][_0xdd65('0x36')],'rows':_[_0xdd65('0x29')](_0xaf36b5['fields'],function(_0x19f8e5){return{'id':_0x19f8e5[_0xdd65('0x27')],'name':_0x19f8e5[_0xdd65('0x6c')],'custom':_0x19f8e5[_0xdd65('0x6d')],'options':_0x19f8e5[_0xdd65('0x6e')][_0xdd65('0x36')]>0x0?_[_0xdd65('0x29')](_0x19f8e5['picklistValues'],function(_0xf15d2a){return{'name':_0xf15d2a[_0xdd65('0x6c')],'value':_0xf15d2a[_0xdd65('0x6f')]};}):_0x19f8e5[_0xdd65('0x2d')]==_0xdd65('0x68')?[{'name':'True','value':_0xdd65('0x70')},{'name':_0xdd65('0x71'),'value':_0xdd65('0x72')}]:[]};})};}})['then'](respondWithResult(_0x566d9e,null))[_0xdd65('0x43')](function(_0x401a97){var _0x46d72a=_0x30f4aa[_0xdd65('0x30')]['test']?0x1f4:_0x401a97[_0xdd65('0x73')]||0x1f4;logger['error'](_0xdd65('0x74'),_0xdd65('0x56'),_0x46d72a,JSON[_0xdd65('0x75')](_0x401a97));delete _0x401a97['name'];if(_0x46d72a===0x191){_0x46d72a=0x190;}_0x566d9e[_0xdd65('0x1a')](_0x46d72a)[_0xdd65('0x76')](_0x30f4aa[_0xdd65('0x30')][_0xdd65('0x77')]?{'message':_0xdd65('0x78'),'statusCode':_0x401a97['statusCode']}:_0x401a97);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ec0ec8f..386dd93 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 _0x1502=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x56acec,_0x1ce4e7){var _0x276a57=function(_0x5701dd){while(--_0x5701dd){_0x56acec['push'](_0x56acec['shift']());}};_0x276a57(++_0x1ce4e7);}(_0x1502,0x1c3));var _0x2150=function(_0x520f75,_0xf2b40b){_0x520f75=_0x520f75-0x0;var _0x21be4e=_0x1502[_0x520f75];return _0x21be4e;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x2150('0xa')]=function(_0x38dbdf,_0x4fd1ed){return _0x38dbdf[_0x2150('0xb')](_0x2150('0xc'),attributes,{'tableName':_0x2150('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82b0=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1c8968,_0x94439d){var _0x29622d=function(_0x451675){while(--_0x451675){_0x1c8968['push'](_0x1c8968['shift']());}};_0x29622d(++_0x94439d);}(_0x82b0,0x81));var _0x082b=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0x82b0[_0x489250];return _0x1283e5;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var logger=require(_0x082b('0x2'))('api');var moment=require(_0x082b('0x3'));var BPromise=require(_0x082b('0x4'));var rp=require(_0x082b('0x5'));var fs=require('fs');var path=require(_0x082b('0x6'));var rimraf=require('rimraf');var config=require(_0x082b('0x7'));var attributes=require(_0x082b('0x8'));var integrations=require(_0x082b('0x9'));module[_0x082b('0xa')]=function(_0x2dafd0,_0x5e8485){return _0x2dafd0[_0x082b('0xb')](_0x082b('0xc'),attributes,{'tableName':_0x082b('0xd'),'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 dea3675..f8d74b8 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 _0xa263=['stringify','ShowSalesforceAccount','find','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSalesforceAccount'];(function(_0x3b6218,_0x4fe859){var _0x19a90e=function(_0x29c16d){while(--_0x29c16d){_0x3b6218['push'](_0x3b6218['shift']());}};_0x19a90e(++_0x4fe859);}(_0xa263,0x135));var _0x3a26=function(_0x1d2d8c,_0x444dc0){_0x1d2d8c=_0x1d2d8c-0x0;var _0x20d515=_0xa263[_0x1d2d8c];return _0x20d515;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a26('0x0'));var fs=require('fs');var Redis=require(_0x3a26('0x1'));var db=require(_0x3a26('0x2'))['db'];var utils=require(_0x3a26('0x3'));var logger=require(_0x3a26('0x4'))(_0x3a26('0x5'));var config=require(_0x3a26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a26('0x7')][_0x3a26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47940f,_0x1fbd4d,_0x1d2aa1){return new BPromise(function(_0x348f15,_0x5b4953){return client[_0x3a26('0x9')](_0x47940f,_0x1d2aa1)[_0x3a26('0xa')](function(_0xba3047){logger[_0x3a26('0xb')](_0x3a26('0xc'),_0x1fbd4d,_0x3a26('0xd'));logger[_0x3a26('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1fbd4d,_0x3a26('0xd'),JSON['stringify'](_0xba3047));if(_0xba3047[_0x3a26('0xf')]){if(_0xba3047['error'][_0x3a26('0x10')]===0x1f4){logger[_0x3a26('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1fbd4d,_0xba3047[_0x3a26('0xf')]['message']);return _0x5b4953(_0xba3047['error']['message']);}logger[_0x3a26('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1fbd4d,_0xba3047[_0x3a26('0xf')][_0x3a26('0x11')]);return _0x348f15(_0xba3047[_0x3a26('0xf')][_0x3a26('0x11')]);}else{logger[_0x3a26('0xb')](_0x3a26('0xc'),_0x1fbd4d,'request\x20sent');_0x348f15(_0xba3047[_0x3a26('0x12')][_0x3a26('0x11')]);}})[_0x3a26('0x13')](function(_0x10d2d6){logger[_0x3a26('0xf')](_0x3a26('0xc'),_0x1fbd4d,_0x10d2d6);_0x5b4953(_0x10d2d6);});});}exports['GetSalesforceAccount']=function(_0x2ba338){var _0x2091ac=this;return new Promise(function(_0x2d59c7,_0x5e3a19){return db[_0x3a26('0x14')][_0x3a26('0x15')]({'raw':_0x2ba338[_0x3a26('0x16')]?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x17')]===undefined?!![]:![]:!![],'where':_0x2ba338['options']?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x18')]||null:null,'attributes':_0x2ba338['options']?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x19')]||null:null,'limit':_0x2ba338[_0x3a26('0x16')]?_0x2ba338['options'][_0x3a26('0x1a')]||null:null,'include':_0x2ba338[_0x3a26('0x16')]?_0x2ba338['options']['include']?_['map'](_0x2ba338[_0x3a26('0x16')][_0x3a26('0x1b')],function(_0x41c27e){return{'model':db[_0x41c27e[_0x3a26('0x1c')]],'as':_0x41c27e['as'],'attributes':_0x41c27e[_0x3a26('0x19')],'include':_0x41c27e[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x41c27e[_0x3a26('0x1b')],function(_0x3f697c){return{'model':db[_0x3f697c[_0x3a26('0x1c')]],'as':_0x3f697c['as'],'attributes':_0x3f697c['attributes'],'include':_0x3f697c[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x3f697c[_0x3a26('0x1b')],function(_0x240acb){return{'model':db[_0x240acb[_0x3a26('0x1c')]],'as':_0x240acb['as'],'attributes':_0x240acb[_0x3a26('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161045){logger['info'](_0x3a26('0x1e'),_0x2ba338);logger[_0x3a26('0xe')](_0x3a26('0x1e'),_0x2ba338,JSON[_0x3a26('0x1f')](_0x161045));_0x2d59c7(_0x161045);})['catch'](function(_0x15e41a){logger[_0x3a26('0xf')](_0x3a26('0x1e'),_0x15e41a[_0x3a26('0x11')],_0x2ba338);_0x5e3a19(_0x2091ac['error'](0x1f4,_0x15e41a['message']));});});};exports[_0x3a26('0x20')]=function(_0x2227ca){var _0x589e92=this;return new Promise(function(_0x3c1acb,_0x557957){return db['SalesforceAccount'][_0x3a26('0x21')]({'raw':_0x2227ca['options']?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x17')]===undefined?!![]:![]:!![],'where':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x18')]||null:null,'attributes':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x19')]||null:null,'include':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x2227ca['options'][_0x3a26('0x1b')],function(_0x60435){return{'model':db[_0x60435[_0x3a26('0x1c')]],'as':_0x60435['as'],'attributes':_0x60435[_0x3a26('0x19')],'include':_0x60435[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x60435[_0x3a26('0x1b')],function(_0x397617){return{'model':db[_0x397617[_0x3a26('0x1c')]],'as':_0x397617['as'],'attributes':_0x397617[_0x3a26('0x19')],'include':_0x397617[_0x3a26('0x1b')]?_['map'](_0x397617[_0x3a26('0x1b')],function(_0x3a3107){return{'model':db[_0x3a3107[_0x3a26('0x1c')]],'as':_0x3a3107['as'],'attributes':_0x3a3107[_0x3a26('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df3f1){logger[_0x3a26('0xb')](_0x3a26('0x20'),_0x2227ca);logger[_0x3a26('0xe')](_0x3a26('0x20'),_0x2227ca,JSON['stringify'](_0x4df3f1));_0x3c1acb(_0x4df3f1);})[_0x3a26('0x13')](function(_0x7ee01a){logger[_0x3a26('0xf')](_0x3a26('0x20'),_0x7ee01a[_0x3a26('0x11')],_0x2227ca);_0x557957(_0x589e92[_0x3a26('0xf')](0x1f4,_0x7ee01a[_0x3a26('0x11')]));});});}; \ No newline at end of file +var _0xef0d=['SalesforceAccount','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','options','raw','attributes','include','map','model','catch','ShowSalesforceAccount'];(function(_0x2764af,_0x926715){var _0x5ea345=function(_0x1016c1){while(--_0x1016c1){_0x2764af['push'](_0x2764af['shift']());}};_0x5ea345(++_0x926715);}(_0xef0d,0xdc));var _0xdef0=function(_0x42cbe0,_0x4ff425){_0x42cbe0=_0x42cbe0-0x0;var _0x585d73=_0xef0d[_0x42cbe0];return _0x585d73;};'use strict';var _=require(_0xdef0('0x0'));var util=require('util');var moment=require(_0xdef0('0x1'));var BPromise=require(_0xdef0('0x2'));var rs=require(_0xdef0('0x3'));var fs=require('fs');var Redis=require(_0xdef0('0x4'));var db=require(_0xdef0('0x5'))['db'];var utils=require(_0xdef0('0x6'));var logger=require(_0xdef0('0x7'))(_0xdef0('0x8'));var config=require(_0xdef0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdef0('0xa')][_0xdef0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c00,_0x246435,_0x8227dd){return new BPromise(function(_0x2ff6e5,_0x26b271){return client[_0xdef0('0xc')](_0x2b4c00,_0x8227dd)['then'](function(_0x10b1bf){logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));logger[_0xdef0('0x10')](_0xdef0('0x11'),_0x246435,'request\x20sent',JSON[_0xdef0('0x12')](_0x10b1bf));if(_0x10b1bf[_0xdef0('0x13')]){if(_0x10b1bf['error'][_0xdef0('0x14')]===0x1f4){logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf['error'][_0xdef0('0x15')]);return _0x26b271(_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);}logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);return _0x2ff6e5(_0x10b1bf['error'][_0xdef0('0x15')]);}else{logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));_0x2ff6e5(_0x10b1bf[_0xdef0('0x16')]['message']);}})['catch'](function(_0x1a2ce3){logger['error'](_0xdef0('0xe'),_0x246435,_0x1a2ce3);_0x26b271(_0x1a2ce3);});});}exports[_0xdef0('0x17')]=function(_0x254a8c){var _0x1ea829=this;return new Promise(function(_0x5961fa,_0x31faf7){return db['SalesforceAccount']['findAll']({'raw':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x254a8c[_0xdef0('0x18')]?_0x254a8c['options']['where']||null:null,'attributes':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1a')]||null:null,'limit':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')]['limit']||null:null,'include':_0x254a8c['options']?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x254a8c['options'][_0xdef0('0x1b')],function(_0x4bde65){return{'model':db[_0x4bde65[_0xdef0('0x1d')]],'as':_0x4bde65['as'],'attributes':_0x4bde65[_0xdef0('0x1a')],'include':_0x4bde65['include']?_[_0xdef0('0x1c')](_0x4bde65[_0xdef0('0x1b')],function(_0x3be142){return{'model':db[_0x3be142['model']],'as':_0x3be142['as'],'attributes':_0x3be142[_0xdef0('0x1a')],'include':_0x3be142['include']?_[_0xdef0('0x1c')](_0x3be142[_0xdef0('0x1b')],function(_0xbea465){return{'model':db[_0xbea465[_0xdef0('0x1d')]],'as':_0xbea465['as'],'attributes':_0xbea465[_0xdef0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x521a79){logger[_0xdef0('0xd')]('GetSalesforceAccount',_0x254a8c);logger[_0xdef0('0x10')](_0xdef0('0x17'),_0x254a8c,JSON[_0xdef0('0x12')](_0x521a79));_0x5961fa(_0x521a79);})[_0xdef0('0x1e')](function(_0x19bf8b){logger[_0xdef0('0x13')](_0xdef0('0x17'),_0x19bf8b[_0xdef0('0x15')],_0x254a8c);_0x31faf7(_0x1ea829[_0xdef0('0x13')](0x1f4,_0x19bf8b[_0xdef0('0x15')]));});});};exports[_0xdef0('0x1f')]=function(_0x21c7b6){var _0x496bdd=this;return new Promise(function(_0x41a3b2,_0x1cd2b6){return db[_0xdef0('0x20')][_0xdef0('0x21')]({'raw':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x22')]||null:null,'attributes':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')]['attributes']||null:null,'include':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x1b')]?_['map'](_0x21c7b6[_0xdef0('0x18')]['include'],function(_0x319c1d){return{'model':db[_0x319c1d[_0xdef0('0x1d')]],'as':_0x319c1d['as'],'attributes':_0x319c1d[_0xdef0('0x1a')],'include':_0x319c1d[_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x319c1d[_0xdef0('0x1b')],function(_0x7fd792){return{'model':db[_0x7fd792[_0xdef0('0x1d')]],'as':_0x7fd792['as'],'attributes':_0x7fd792[_0xdef0('0x1a')],'include':_0x7fd792['include']?_['map'](_0x7fd792['include'],function(_0x2ee65a){return{'model':db[_0x2ee65a[_0xdef0('0x1d')]],'as':_0x2ee65a['as'],'attributes':_0x2ee65a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef0('0x23')](function(_0x3824aa){logger[_0xdef0('0xd')](_0xdef0('0x1f'),_0x21c7b6);logger[_0xdef0('0x10')]('ShowSalesforceAccount',_0x21c7b6,JSON['stringify'](_0x3824aa));_0x41a3b2(_0x3824aa);})[_0xdef0('0x1e')](function(_0xcf025e){logger['error']('ShowSalesforceAccount',_0xcf025e[_0xdef0('0x15')],_0x21c7b6);_0x1cd2b6(_0x496bdd['error'](0x1f4,_0xcf025e[_0xdef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6f0f87c..74cbe3e 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x5653ac,_0x279def){var _0x59ccc2=function(_0x9cf453){while(--_0x9cf453){_0x5653ac['push'](_0x5653ac['shift']());}};_0x59ccc2(++_0x279def);}(_0xadb5,0xad));var _0x5adb=function(_0x235457,_0x35cff2){_0x235457=_0x235457-0x0;var _0x34eb5d=_0xadb5[_0x235457];return _0x34eb5d;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x3d0d39,_0x24d3d5){var _0x8383c5=function(_0x44ebaf){while(--_0x44ebaf){_0x3d0d39['push'](_0x3d0d39['shift']());}};_0x8383c5(++_0x24d3d5);}(_0x2ef3,0xba));var _0x32ef=function(_0x18ac03,_0x1aa928){_0x18ac03=_0x18ac03-0x0;var _0x38d110=_0x2ef3[_0x18ac03];return _0x38d110;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b0da2e3..cb15ae8 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 _0x1044=['contact_lead','contact','lead','account_contact_lead','account','ENUM','nothing','sequelize','exports','STRING','Case','Task'];(function(_0x42b601,_0xba39fd){var _0xa11432=function(_0x662055){while(--_0x662055){_0x42b601['push'](_0x42b601['shift']());}};_0xa11432(++_0xba39fd);}(_0x1044,0x16f));var _0x4104=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1044[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x4104('0x0'));module[_0x4104('0x1')]={'name':{'type':Sequelize[_0x4104('0x2')]},'description':{'type':Sequelize[_0x4104('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x4104('0x3')),'defaultValue':_0x4104('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4104('0x5'),_0x4104('0x6'),_0x4104('0x7'),_0x4104('0x8'),_0x4104('0x9')),'defaultValue':_0x4104('0x5')},'moduleCreate':{'type':Sequelize[_0x4104('0xa')](_0x4104('0xb'),'contact','lead',_0x4104('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x4104('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4104('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4104('0x2')]}}; \ No newline at end of file +var _0xa8cc=['ENUM','Task','Case','contact','lead','contact_lead','nothing','account','exports','STRING'];(function(_0x57127b,_0x359e14){var _0x4e1dfc=function(_0x5e6866){while(--_0x5e6866){_0x57127b['push'](_0x57127b['shift']());}};_0x4e1dfc(++_0x359e14);}(_0xa8cc,0xf8));var _0xca8c=function(_0xf477d5,_0x3c69f2){_0xf477d5=_0xf477d5-0x0;var _0x2d6c17=_0xa8cc[_0xf477d5];return _0x2d6c17;};'use strict';var Sequelize=require('sequelize');module[_0xca8c('0x0')]={'name':{'type':Sequelize[_0xca8c('0x1')]},'description':{'type':Sequelize[_0xca8c('0x1')]},'ticketType':{'type':Sequelize[_0xca8c('0x2')](_0xca8c('0x3'),_0xca8c('0x4')),'defaultValue':_0xca8c('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xca8c('0x5'),_0xca8c('0x6'),'account_contact_lead','account'),'defaultValue':_0xca8c('0x7')},'moduleCreate':{'type':Sequelize[_0xca8c('0x2')](_0xca8c('0x8'),_0xca8c('0x5'),_0xca8c('0x6'),_0xca8c('0x9')),'defaultValue':_0xca8c('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xca8c('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xca8c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xca8c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 17fcfcc..dca2c82 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 _0xe36e=['stack','name','index','map','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','include','rows','params','rawAttributes','intersection','find','body','catch','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x994f25,_0x586fe8){var _0x2e1cf6=function(_0x13deb3){while(--_0x13deb3){_0x994f25['push'](_0x994f25['shift']());}};_0x2e1cf6(++_0x586fe8);}(_0xe36e,0xbb));var _0xee36=function(_0x538ad7,_0x47a6be){_0x538ad7=_0x538ad7-0x0;var _0x214503=_0xe36e[_0x538ad7];return _0x214503;};'use strict';var emlformat=require(_0xee36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee36('0x1'));var jsonpatch=require(_0xee36('0x2'));var rp=require(_0xee36('0x3'));var moment=require(_0xee36('0x4'));var BPromise=require(_0xee36('0x5'));var Mustache=require(_0xee36('0x6'));var util=require(_0xee36('0x7'));var path=require(_0xee36('0x8'));var sox=require(_0xee36('0x9'));var csv=require('to-csv');var ejs=require(_0xee36('0xa'));var fs=require('fs');var fs_extra=require(_0xee36('0xb'));var _=require(_0xee36('0xc'));var squel=require(_0xee36('0xd'));var crypto=require(_0xee36('0xe'));var jsforce=require(_0xee36('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xee36('0x10'));var querystring=require('querystring');var Papa=require(_0xee36('0x11'));var Redis=require(_0xee36('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xee36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee36('0x14'));var logger=require(_0xee36('0x15'))(_0xee36('0x16'));var utils=require(_0xee36('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xee36('0x18'));var db=require(_0xee36('0x19'))['db'];function respondWithStatusCode(_0x589404,_0x509009){_0x509009=_0x509009||0xcc;return function(_0x5edab8){if(_0x5edab8){return _0x589404[_0xee36('0x1a')](_0x509009);}return _0x589404[_0xee36('0x1b')](_0x509009)[_0xee36('0x1c')]();};}function respondWithResult(_0x58088f,_0x53eae1){_0x53eae1=_0x53eae1||0xc8;return function(_0x5619e8){if(_0x5619e8){return _0x58088f[_0xee36('0x1b')](_0x53eae1)[_0xee36('0x1d')](_0x5619e8);}};}function respondWithFilteredResult(_0x47c48e,_0x3231a4){return function(_0x526ad7){if(_0x526ad7){var _0x267320=typeof _0x3231a4['offset']===_0xee36('0x1e')&&typeof _0x3231a4[_0xee36('0x1f')]==='undefined';var _0x4fb3ec=_0x526ad7[_0xee36('0x20')];var _0x14c1ea=_0x267320?0x0:_0x3231a4[_0xee36('0x21')];var _0x5c3d7f=_0x267320?_0x526ad7[_0xee36('0x20')]:_0x3231a4['offset']+_0x3231a4[_0xee36('0x1f')];var _0x5ba085;if(_0x5c3d7f>=_0x4fb3ec){_0x5c3d7f=_0x4fb3ec;_0x5ba085=0xc8;}else{_0x5ba085=0xce;}_0x47c48e[_0xee36('0x1b')](_0x5ba085);return _0x47c48e['set'](_0xee36('0x22'),_0x14c1ea+'-'+_0x5c3d7f+'/'+_0x4fb3ec)[_0xee36('0x1d')](_0x526ad7);}return null;};}function patchUpdates(_0x526401){return function(_0x55e4e5){try{jsonpatch[_0xee36('0x23')](_0x55e4e5,_0x526401,!![]);}catch(_0x456fd1){return BPromise[_0xee36('0x24')](_0x456fd1);}return _0x55e4e5['save']();};}function saveUpdates(_0x22e7d0,_0x2d878f){return function(_0x4ad25f){if(_0x4ad25f){return _0x4ad25f[_0xee36('0x25')](_0x22e7d0)['then'](function(_0x448de9){return _0x448de9;});}return null;};}function removeEntity(_0x2a841f,_0x31cdcc){return function(_0x3d2721){if(_0x3d2721){return _0x3d2721[_0xee36('0x26')]()[_0xee36('0x27')](function(){_0x2a841f[_0xee36('0x1b')](0xcc)[_0xee36('0x1c')]();});}};}function handleEntityNotFound(_0x560bcc,_0x1182dc){return function(_0x5a88aa){if(!_0x5a88aa){_0x560bcc['sendStatus'](0x194);}return _0x5a88aa;};}function handleError(_0x17b54e,_0x548632){_0x548632=_0x548632||0x1f4;return function(_0x88f313){logger[_0xee36('0x28')](_0x88f313[_0xee36('0x29')]);if(_0x88f313[_0xee36('0x2a')]){delete _0x88f313['name'];}_0x17b54e['status'](_0x548632)['send'](_0x88f313);};}exports[_0xee36('0x2b')]=function(_0x3dfafb,_0x591c8c){var _0x460710={},_0x59f37c={},_0x2d9617={'count':0x0,'rows':[]};var _0x55fce2=_[_0xee36('0x2c')](db['SalesforceConfiguration']['rawAttributes'],function(_0x57807b){return{'name':_0x57807b['fieldName'],'type':_0x57807b['type']['key']};});_0x59f37c[_0xee36('0x2d')]=_[_0xee36('0x2c')](_0x55fce2,_0xee36('0x2a'));_0x59f37c[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x3dfafb[_0xee36('0x2e')]);_0x59f37c[_0xee36('0x30')]=_['intersection'](_0x59f37c['model'],_0x59f37c['query']);_0x460710[_0xee36('0x31')]=_['intersection'](_0x59f37c[_0xee36('0x2d')],qs[_0xee36('0x32')](_0x3dfafb[_0xee36('0x2e')][_0xee36('0x32')]));_0x460710[_0xee36('0x31')]=_0x460710[_0xee36('0x31')][_0xee36('0x33')]?_0x460710[_0xee36('0x31')]:_0x59f37c[_0xee36('0x2d')];if(!_0x3dfafb[_0xee36('0x2e')]['hasOwnProperty'](_0xee36('0x34'))){_0x460710[_0xee36('0x1f')]=qs[_0xee36('0x1f')](_0x3dfafb['query'][_0xee36('0x1f')]);_0x460710[_0xee36('0x21')]=qs['offset'](_0x3dfafb['query']['offset']);}_0x460710['order']=qs['sort'](_0x3dfafb[_0xee36('0x2e')][_0xee36('0x35')]);_0x460710[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x3dfafb['query'],_0x59f37c[_0xee36('0x30')]),_0x55fce2);if(_0x3dfafb[_0xee36('0x2e')][_0xee36('0x38')]){_0x460710['where']=_[_0xee36('0x39')](_0x460710[_0xee36('0x36')],{'$or':_[_0xee36('0x2c')](_0x55fce2,function(_0x3ea5cd){if(_0x3ea5cd['type']!==_0xee36('0x3a')){var _0x245a42={};_0x245a42[_0x3ea5cd[_0xee36('0x2a')]]={'$like':'%'+_0x3dfafb[_0xee36('0x2e')][_0xee36('0x38')]+'%'};return _0x245a42;}})});}_0x460710=_[_0xee36('0x39')]({},_0x460710,_0x3dfafb[_0xee36('0x3b')]);var _0x4cbd6e={'where':_0x460710[_0xee36('0x36')]};return db[_0xee36('0x3c')][_0xee36('0x20')](_0x4cbd6e)[_0xee36('0x27')](function(_0x4cc008){_0x2d9617[_0xee36('0x20')]=_0x4cc008;if(_0x3dfafb[_0xee36('0x2e')]['includeAll']){_0x460710[_0xee36('0x3d')]=[{'all':!![]}];}return db[_0xee36('0x3c')]['findAll'](_0x460710);})['then'](function(_0x2fa64c){_0x2d9617[_0xee36('0x3e')]=_0x2fa64c;return _0x2d9617;})[_0xee36('0x27')](respondWithFilteredResult(_0x591c8c,_0x460710))['catch'](handleError(_0x591c8c,null));};exports['show']=function(_0x3f2250,_0x5bd413){var _0x2831e9={'raw':![],'where':{'id':_0x3f2250[_0xee36('0x3f')]['id']}},_0x59f53c={};_0x59f53c['model']=_['keys'](db[_0xee36('0x3c')][_0xee36('0x40')]);_0x59f53c[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x3f2250[_0xee36('0x2e')]);_0x59f53c['filters']=_['intersection'](_0x59f53c[_0xee36('0x2d')],_0x59f53c[_0xee36('0x2e')]);_0x2831e9[_0xee36('0x31')]=_[_0xee36('0x41')](_0x59f53c['model'],qs[_0xee36('0x32')](_0x3f2250[_0xee36('0x2e')]['fields']));_0x2831e9['attributes']=_0x2831e9[_0xee36('0x31')][_0xee36('0x33')]?_0x2831e9[_0xee36('0x31')]:_0x59f53c[_0xee36('0x2d')];if(_0x3f2250[_0xee36('0x2e')]['includeAll']){_0x2831e9[_0xee36('0x3d')]=[{'all':!![]}];}_0x2831e9=_['merge']({},_0x2831e9,_0x3f2250[_0xee36('0x3b')]);return db[_0xee36('0x3c')][_0xee36('0x42')](_0x2831e9)['then'](handleEntityNotFound(_0x5bd413,null))[_0xee36('0x27')](respondWithResult(_0x5bd413,null))['catch'](handleError(_0x5bd413,null));};exports['create']=function(_0x4eeb76,_0x45f95b){return db[_0xee36('0x3c')]['create'](_0x4eeb76[_0xee36('0x43')],{})[_0xee36('0x27')](respondWithResult(_0x45f95b,0xc9))['catch'](handleError(_0x45f95b,null));};exports[_0xee36('0x25')]=function(_0x45d1d9,_0x279b98){if(_0x45d1d9['body']['id']){delete _0x45d1d9['body']['id'];}return db['SalesforceConfiguration'][_0xee36('0x42')]({'where':{'id':_0x45d1d9[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x279b98,null))[_0xee36('0x27')](saveUpdates(_0x45d1d9['body'],null))[_0xee36('0x27')](respondWithResult(_0x279b98,null))[_0xee36('0x44')](handleError(_0x279b98,null));};exports['destroy']=function(_0x34c9bd,_0x4e76df){return db[_0xee36('0x3c')]['find']({'where':{'id':_0x34c9bd[_0xee36('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e76df,null))[_0xee36('0x27')](removeEntity(_0x4e76df,null))[_0xee36('0x44')](handleError(_0x4e76df,null));};exports[_0xee36('0x45')]=function(_0x39127b,_0x4c94f7,_0x5c64bb){var _0x2ca5d3={};var _0x3c719f={};var _0x38bad1;var _0x810efe;return db[_0xee36('0x3c')][_0xee36('0x46')]({'where':{'id':_0x39127b[_0xee36('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c94f7,null))['then'](function(_0x1d2212){if(_0x1d2212){_0x38bad1=_0x1d2212;_0x3c719f[_0xee36('0x2d')]=_[_0xee36('0x2f')](db['SalesforceField'][_0xee36('0x40')]);_0x3c719f[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x39127b['query']);_0x3c719f[_0xee36('0x30')]=_[_0xee36('0x41')](_0x3c719f['model'],_0x3c719f[_0xee36('0x2e')]);_0x2ca5d3['attributes']=_[_0xee36('0x41')](_0x3c719f[_0xee36('0x2d')],qs['fields'](_0x39127b[_0xee36('0x2e')][_0xee36('0x32')]));_0x2ca5d3['attributes']=_0x2ca5d3['attributes'][_0xee36('0x33')]?_0x2ca5d3[_0xee36('0x31')]:_0x3c719f[_0xee36('0x2d')];_0x2ca5d3['order']=qs[_0xee36('0x35')](_0x39127b['query']['sort']);_0x2ca5d3['where']=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x39127b[_0xee36('0x2e')],_0x3c719f[_0xee36('0x30')]));if(_0x39127b[_0xee36('0x2e')][_0xee36('0x38')]){_0x2ca5d3['where']=_[_0xee36('0x39')](_0x2ca5d3[_0xee36('0x36')],{'$or':_[_0xee36('0x2c')](_0x2ca5d3[_0xee36('0x31')],function(_0x1d776a){var _0x3f4b27={};_0x3f4b27[_0x1d776a]={'$like':'%'+_0x39127b[_0xee36('0x2e')]['filter']+'%'};return _0x3f4b27;})});}_0x2ca5d3=_[_0xee36('0x39')]({},_0x2ca5d3,_0x39127b['options']);return _0x38bad1[_0xee36('0x45')](_0x2ca5d3);}})[_0xee36('0x27')](function(_0x4304c2){if(_0x4304c2){_0x810efe=_0x4304c2['length'];if(!_0x39127b['query'][_0xee36('0x47')](_0xee36('0x34'))){_0x2ca5d3['limit']=qs[_0xee36('0x1f')](_0x39127b['query'][_0xee36('0x1f')]);_0x2ca5d3[_0xee36('0x21')]=qs[_0xee36('0x21')](_0x39127b['query'][_0xee36('0x21')]);}return _0x38bad1[_0xee36('0x45')](_0x2ca5d3);}})[_0xee36('0x27')](function(_0x4a99e1){if(_0x4a99e1){return _0x4a99e1?{'count':_0x810efe,'rows':_0x4a99e1}:null;}})['then'](respondWithResult(_0x4c94f7,null))[_0xee36('0x44')](handleError(_0x4c94f7,null));};exports[_0xee36('0x48')]=function(_0xf3fd30,_0x19e8ef,_0x4fb353){var _0x6cb7e={};var _0x59bd7b={};var _0x4da745;var _0x5872dd;return db['SalesforceConfiguration'][_0xee36('0x46')]({'where':{'id':_0xf3fd30[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x19e8ef,null))[_0xee36('0x27')](function(_0x20efd1){if(_0x20efd1){_0x4da745=_0x20efd1;_0x59bd7b[_0xee36('0x2d')]=_[_0xee36('0x2f')](db[_0xee36('0x49')]['rawAttributes']);_0x59bd7b[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0xf3fd30[_0xee36('0x2e')]);_0x59bd7b[_0xee36('0x30')]=_[_0xee36('0x41')](_0x59bd7b['model'],_0x59bd7b[_0xee36('0x2e')]);_0x6cb7e[_0xee36('0x31')]=_[_0xee36('0x41')](_0x59bd7b[_0xee36('0x2d')],qs['fields'](_0xf3fd30[_0xee36('0x2e')]['fields']));_0x6cb7e[_0xee36('0x31')]=_0x6cb7e[_0xee36('0x31')]['length']?_0x6cb7e[_0xee36('0x31')]:_0x59bd7b[_0xee36('0x2d')];_0x6cb7e[_0xee36('0x4a')]=qs[_0xee36('0x35')](_0xf3fd30['query'][_0xee36('0x35')]);_0x6cb7e[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0xf3fd30[_0xee36('0x2e')],_0x59bd7b[_0xee36('0x30')]));if(_0xf3fd30[_0xee36('0x2e')][_0xee36('0x38')]){_0x6cb7e['where']=_[_0xee36('0x39')](_0x6cb7e[_0xee36('0x36')],{'$or':_['map'](_0x6cb7e['attributes'],function(_0x2dd7ee){var _0x1904f8={};_0x1904f8[_0x2dd7ee]={'$like':'%'+_0xf3fd30[_0xee36('0x2e')][_0xee36('0x38')]+'%'};return _0x1904f8;})});}_0x6cb7e=_[_0xee36('0x39')]({},_0x6cb7e,_0xf3fd30[_0xee36('0x3b')]);return _0x4da745['getSubjects'](_0x6cb7e);}})[_0xee36('0x27')](function(_0x2d61b4){if(_0x2d61b4){_0x5872dd=_0x2d61b4[_0xee36('0x33')];if(!_0xf3fd30[_0xee36('0x2e')]['hasOwnProperty'](_0xee36('0x34'))){_0x6cb7e[_0xee36('0x1f')]=qs[_0xee36('0x1f')](_0xf3fd30[_0xee36('0x2e')][_0xee36('0x1f')]);_0x6cb7e[_0xee36('0x21')]=qs[_0xee36('0x21')](_0xf3fd30[_0xee36('0x2e')]['offset']);}return _0x4da745[_0xee36('0x48')](_0x6cb7e);}})[_0xee36('0x27')](function(_0x1e80f2){if(_0x1e80f2){return _0x1e80f2?{'count':_0x5872dd,'rows':_0x1e80f2}:null;}})['then'](respondWithResult(_0x19e8ef,null))[_0xee36('0x44')](handleError(_0x19e8ef,null));};exports[_0xee36('0x4b')]=function(_0x40deae,_0x235e27,_0x5981a7){var _0x202c63={};var _0x541223={};var _0x23df06;var _0x2c08b4;return db[_0xee36('0x3c')]['findOne']({'where':{'id':_0x40deae[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x235e27,null))[_0xee36('0x27')](function(_0x45bba0){if(_0x45bba0){_0x23df06=_0x45bba0;_0x541223[_0xee36('0x2d')]=_[_0xee36('0x2f')](db['SalesforceField']['rawAttributes']);_0x541223[_0xee36('0x2e')]=_['keys'](_0x40deae[_0xee36('0x2e')]);_0x541223[_0xee36('0x30')]=_[_0xee36('0x41')](_0x541223[_0xee36('0x2d')],_0x541223[_0xee36('0x2e')]);_0x202c63['attributes']=_[_0xee36('0x41')](_0x541223[_0xee36('0x2d')],qs[_0xee36('0x32')](_0x40deae[_0xee36('0x2e')][_0xee36('0x32')]));_0x202c63['attributes']=_0x202c63[_0xee36('0x31')][_0xee36('0x33')]?_0x202c63['attributes']:_0x541223[_0xee36('0x2d')];_0x202c63[_0xee36('0x4a')]=qs[_0xee36('0x35')](_0x40deae['query']['sort']);_0x202c63[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x40deae[_0xee36('0x2e')],_0x541223[_0xee36('0x30')]));if(_0x40deae[_0xee36('0x2e')][_0xee36('0x38')]){_0x202c63[_0xee36('0x36')]=_[_0xee36('0x39')](_0x202c63[_0xee36('0x36')],{'$or':_['map'](_0x202c63['attributes'],function(_0x3cec01){var _0x980a27={};_0x980a27[_0x3cec01]={'$like':'%'+_0x40deae['query'][_0xee36('0x38')]+'%'};return _0x980a27;})});}_0x202c63=_['merge']({},_0x202c63,_0x40deae[_0xee36('0x3b')]);return _0x23df06[_0xee36('0x4b')](_0x202c63);}})['then'](function(_0x478499){if(_0x478499){_0x2c08b4=_0x478499[_0xee36('0x33')];if(!_0x40deae[_0xee36('0x2e')][_0xee36('0x47')](_0xee36('0x34'))){_0x202c63['limit']=qs[_0xee36('0x1f')](_0x40deae['query'][_0xee36('0x1f')]);_0x202c63[_0xee36('0x21')]=qs[_0xee36('0x21')](_0x40deae[_0xee36('0x2e')][_0xee36('0x21')]);}return _0x23df06[_0xee36('0x4b')](_0x202c63);}})[_0xee36('0x27')](function(_0x111c34){if(_0x111c34){return _0x111c34?{'count':_0x2c08b4,'rows':_0x111c34}:null;}})['then'](respondWithResult(_0x235e27,null))['catch'](handleError(_0x235e27,null));}; \ No newline at end of file +var _0xfef9=['../../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','destroy','then','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','find','catch','body','update','getFields','SalesforceField','order','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xfef9,0x92));var _0x9fef=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0xfef9[_0x1460f6];return _0x46ce94;};'use strict';var emlformat=require(_0x9fef('0x0'));var rimraf=require(_0x9fef('0x1'));var zipdir=require(_0x9fef('0x2'));var jsonpatch=require(_0x9fef('0x3'));var rp=require(_0x9fef('0x4'));var moment=require(_0x9fef('0x5'));var BPromise=require(_0x9fef('0x6'));var Mustache=require(_0x9fef('0x7'));var util=require(_0x9fef('0x8'));var path=require(_0x9fef('0x9'));var sox=require(_0x9fef('0xa'));var csv=require(_0x9fef('0xb'));var ejs=require(_0x9fef('0xc'));var fs=require('fs');var fs_extra=require(_0x9fef('0xd'));var _=require(_0x9fef('0xe'));var squel=require(_0x9fef('0xf'));var crypto=require(_0x9fef('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x9fef('0x11'));var toCsv=require(_0x9fef('0xb'));var querystring=require(_0x9fef('0x12'));var Papa=require(_0x9fef('0x13'));var Redis=require(_0x9fef('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fef('0x15'));var logger=require(_0x9fef('0x16'))(_0x9fef('0x17'));var utils=require(_0x9fef('0x18'));var config=require(_0x9fef('0x19'));var licenseUtil=require(_0x9fef('0x1a'));var db=require(_0x9fef('0x1b'))['db'];function respondWithStatusCode(_0xc39bac,_0x4bd016){_0x4bd016=_0x4bd016||0xcc;return function(_0x17efdb){if(_0x17efdb){return _0xc39bac[_0x9fef('0x1c')](_0x4bd016);}return _0xc39bac[_0x9fef('0x1d')](_0x4bd016)[_0x9fef('0x1e')]();};}function respondWithResult(_0x298a90,_0x4e3ea7){_0x4e3ea7=_0x4e3ea7||0xc8;return function(_0x5b352d){if(_0x5b352d){return _0x298a90[_0x9fef('0x1d')](_0x4e3ea7)[_0x9fef('0x1f')](_0x5b352d);}};}function respondWithFilteredResult(_0x39196c,_0x4b68ba){return function(_0x1f5678){if(_0x1f5678){var _0x957431=typeof _0x4b68ba[_0x9fef('0x20')]===_0x9fef('0x21')&&typeof _0x4b68ba[_0x9fef('0x22')]==='undefined';var _0x430ce3=_0x1f5678[_0x9fef('0x23')];var _0x231cd1=_0x957431?0x0:_0x4b68ba[_0x9fef('0x20')];var _0x50c088=_0x957431?_0x1f5678[_0x9fef('0x23')]:_0x4b68ba[_0x9fef('0x20')]+_0x4b68ba[_0x9fef('0x22')];var _0x19e8ba;if(_0x50c088>=_0x430ce3){_0x50c088=_0x430ce3;_0x19e8ba=0xc8;}else{_0x19e8ba=0xce;}_0x39196c['status'](_0x19e8ba);return _0x39196c[_0x9fef('0x24')](_0x9fef('0x25'),_0x231cd1+'-'+_0x50c088+'/'+_0x430ce3)['json'](_0x1f5678);}return null;};}function patchUpdates(_0x11eccb){return function(_0x3bbfe9){try{jsonpatch[_0x9fef('0x26')](_0x3bbfe9,_0x11eccb,!![]);}catch(_0x4c7e86){return BPromise[_0x9fef('0x27')](_0x4c7e86);}return _0x3bbfe9[_0x9fef('0x28')]();};}function saveUpdates(_0x36501e,_0x4efced){return function(_0x5c0433){if(_0x5c0433){return _0x5c0433['update'](_0x36501e)['then'](function(_0x177664){return _0x177664;});}return null;};}function removeEntity(_0x264134,_0x38884d){return function(_0x165990){if(_0x165990){return _0x165990[_0x9fef('0x29')]()[_0x9fef('0x2a')](function(){_0x264134[_0x9fef('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf5024,_0xcdc94c){return function(_0x4ebcaa){if(!_0x4ebcaa){_0xdf5024[_0x9fef('0x1c')](0x194);}return _0x4ebcaa;};}function handleError(_0x189284,_0x37bb39){_0x37bb39=_0x37bb39||0x1f4;return function(_0x2136fe){logger[_0x9fef('0x2b')](_0x2136fe['stack']);if(_0x2136fe['name']){delete _0x2136fe[_0x9fef('0x2c')];}_0x189284[_0x9fef('0x1d')](_0x37bb39)[_0x9fef('0x2d')](_0x2136fe);};}exports[_0x9fef('0x2e')]=function(_0x509760,_0x365bd3){var _0x529386={},_0x881c29={},_0x2881b6={'count':0x0,'rows':[]};var _0x3bed69=_[_0x9fef('0x2f')](db[_0x9fef('0x30')][_0x9fef('0x31')],function(_0x373b78){return{'name':_0x373b78[_0x9fef('0x32')],'type':_0x373b78[_0x9fef('0x33')][_0x9fef('0x34')]};});_0x881c29['model']=_[_0x9fef('0x2f')](_0x3bed69,_0x9fef('0x2c'));_0x881c29[_0x9fef('0x35')]=_['keys'](_0x509760[_0x9fef('0x35')]);_0x881c29[_0x9fef('0x36')]=_['intersection'](_0x881c29['model'],_0x881c29[_0x9fef('0x35')]);_0x529386[_0x9fef('0x37')]=_[_0x9fef('0x38')](_0x881c29[_0x9fef('0x39')],qs['fields'](_0x509760[_0x9fef('0x35')][_0x9fef('0x3a')]));_0x529386[_0x9fef('0x37')]=_0x529386['attributes'][_0x9fef('0x3b')]?_0x529386['attributes']:_0x881c29[_0x9fef('0x39')];if(!_0x509760[_0x9fef('0x35')][_0x9fef('0x3c')]('nolimit')){_0x529386['limit']=qs['limit'](_0x509760[_0x9fef('0x35')][_0x9fef('0x22')]);_0x529386[_0x9fef('0x20')]=qs['offset'](_0x509760[_0x9fef('0x35')]['offset']);}_0x529386['order']=qs[_0x9fef('0x3d')](_0x509760['query'][_0x9fef('0x3d')]);_0x529386[_0x9fef('0x3e')]=qs[_0x9fef('0x36')](_[_0x9fef('0x3f')](_0x509760[_0x9fef('0x35')],_0x881c29['filters']),_0x3bed69);if(_0x509760['query'][_0x9fef('0x40')]){_0x529386[_0x9fef('0x3e')]=_[_0x9fef('0x41')](_0x529386[_0x9fef('0x3e')],{'$or':_['map'](_0x3bed69,function(_0x50ad98){if(_0x50ad98[_0x9fef('0x33')]!==_0x9fef('0x42')){var _0x320b6c={};_0x320b6c[_0x50ad98[_0x9fef('0x2c')]]={'$like':'%'+_0x509760[_0x9fef('0x35')][_0x9fef('0x40')]+'%'};return _0x320b6c;}})});}_0x529386=_['merge']({},_0x529386,_0x509760[_0x9fef('0x43')]);var _0x8978a7={'where':_0x529386['where']};return db[_0x9fef('0x30')]['count'](_0x8978a7)[_0x9fef('0x2a')](function(_0x530dba){_0x2881b6[_0x9fef('0x23')]=_0x530dba;if(_0x509760[_0x9fef('0x35')][_0x9fef('0x44')]){_0x529386['include']=[{'all':!![]}];}return db[_0x9fef('0x30')][_0x9fef('0x45')](_0x529386);})[_0x9fef('0x2a')](function(_0x7bc7c8){_0x2881b6[_0x9fef('0x46')]=_0x7bc7c8;return _0x2881b6;})[_0x9fef('0x2a')](respondWithFilteredResult(_0x365bd3,_0x529386))['catch'](handleError(_0x365bd3,null));};exports['show']=function(_0x388b64,_0x8f90f9){var _0x1fc180={'raw':![],'where':{'id':_0x388b64[_0x9fef('0x47')]['id']}},_0x2184c1={};_0x2184c1['model']=_[_0x9fef('0x48')](db['SalesforceConfiguration']['rawAttributes']);_0x2184c1[_0x9fef('0x35')]=_[_0x9fef('0x48')](_0x388b64[_0x9fef('0x35')]);_0x2184c1['filters']=_[_0x9fef('0x38')](_0x2184c1[_0x9fef('0x39')],_0x2184c1[_0x9fef('0x35')]);_0x1fc180[_0x9fef('0x37')]=_[_0x9fef('0x38')](_0x2184c1[_0x9fef('0x39')],qs[_0x9fef('0x3a')](_0x388b64[_0x9fef('0x35')][_0x9fef('0x3a')]));_0x1fc180[_0x9fef('0x37')]=_0x1fc180[_0x9fef('0x37')][_0x9fef('0x3b')]?_0x1fc180[_0x9fef('0x37')]:_0x2184c1[_0x9fef('0x39')];if(_0x388b64[_0x9fef('0x35')][_0x9fef('0x44')]){_0x1fc180['include']=[{'all':!![]}];}_0x1fc180=_[_0x9fef('0x41')]({},_0x1fc180,_0x388b64[_0x9fef('0x43')]);return db[_0x9fef('0x30')][_0x9fef('0x49')](_0x1fc180)[_0x9fef('0x2a')](handleEntityNotFound(_0x8f90f9,null))[_0x9fef('0x2a')](respondWithResult(_0x8f90f9,null))[_0x9fef('0x4a')](handleError(_0x8f90f9,null));};exports['create']=function(_0x3353a2,_0x1f4820){return db[_0x9fef('0x30')]['create'](_0x3353a2[_0x9fef('0x4b')],{})[_0x9fef('0x2a')](respondWithResult(_0x1f4820,0xc9))[_0x9fef('0x4a')](handleError(_0x1f4820,null));};exports[_0x9fef('0x4c')]=function(_0x492c80,_0xfbb40b){if(_0x492c80[_0x9fef('0x4b')]['id']){delete _0x492c80[_0x9fef('0x4b')]['id'];}return db[_0x9fef('0x30')][_0x9fef('0x49')]({'where':{'id':_0x492c80['params']['id']}})[_0x9fef('0x2a')](handleEntityNotFound(_0xfbb40b,null))[_0x9fef('0x2a')](saveUpdates(_0x492c80[_0x9fef('0x4b')],null))['then'](respondWithResult(_0xfbb40b,null))[_0x9fef('0x4a')](handleError(_0xfbb40b,null));};exports['destroy']=function(_0x43d501,_0x5f1264){return db['SalesforceConfiguration'][_0x9fef('0x49')]({'where':{'id':_0x43d501[_0x9fef('0x47')]['id']}})[_0x9fef('0x2a')](handleEntityNotFound(_0x5f1264,null))['then'](removeEntity(_0x5f1264,null))[_0x9fef('0x4a')](handleError(_0x5f1264,null));};exports[_0x9fef('0x4d')]=function(_0x15796e,_0x42681f,_0x1b3ff5){var _0x810755={};var _0x54dc4b={};var _0x2be43b;var _0x342e2e;return db[_0x9fef('0x30')]['findOne']({'where':{'id':_0x15796e[_0x9fef('0x47')]['id']}})[_0x9fef('0x2a')](handleEntityNotFound(_0x42681f,null))[_0x9fef('0x2a')](function(_0x22f362){if(_0x22f362){_0x2be43b=_0x22f362;_0x54dc4b[_0x9fef('0x39')]=_[_0x9fef('0x48')](db[_0x9fef('0x4e')]['rawAttributes']);_0x54dc4b['query']=_['keys'](_0x15796e[_0x9fef('0x35')]);_0x54dc4b[_0x9fef('0x36')]=_[_0x9fef('0x38')](_0x54dc4b[_0x9fef('0x39')],_0x54dc4b[_0x9fef('0x35')]);_0x810755[_0x9fef('0x37')]=_[_0x9fef('0x38')](_0x54dc4b[_0x9fef('0x39')],qs['fields'](_0x15796e[_0x9fef('0x35')][_0x9fef('0x3a')]));_0x810755[_0x9fef('0x37')]=_0x810755[_0x9fef('0x37')][_0x9fef('0x3b')]?_0x810755[_0x9fef('0x37')]:_0x54dc4b[_0x9fef('0x39')];_0x810755[_0x9fef('0x4f')]=qs[_0x9fef('0x3d')](_0x15796e['query'][_0x9fef('0x3d')]);_0x810755[_0x9fef('0x3e')]=qs[_0x9fef('0x36')](_[_0x9fef('0x3f')](_0x15796e[_0x9fef('0x35')],_0x54dc4b[_0x9fef('0x36')]));if(_0x15796e[_0x9fef('0x35')][_0x9fef('0x40')]){_0x810755['where']=_[_0x9fef('0x41')](_0x810755['where'],{'$or':_['map'](_0x810755[_0x9fef('0x37')],function(_0x5aace7){var _0x59243e={};_0x59243e[_0x5aace7]={'$like':'%'+_0x15796e[_0x9fef('0x35')][_0x9fef('0x40')]+'%'};return _0x59243e;})});}_0x810755=_[_0x9fef('0x41')]({},_0x810755,_0x15796e[_0x9fef('0x43')]);return _0x2be43b['getFields'](_0x810755);}})[_0x9fef('0x2a')](function(_0x51ff6d){if(_0x51ff6d){_0x342e2e=_0x51ff6d[_0x9fef('0x3b')];if(!_0x15796e[_0x9fef('0x35')][_0x9fef('0x3c')](_0x9fef('0x50'))){_0x810755[_0x9fef('0x22')]=qs[_0x9fef('0x22')](_0x15796e[_0x9fef('0x35')][_0x9fef('0x22')]);_0x810755['offset']=qs[_0x9fef('0x20')](_0x15796e[_0x9fef('0x35')][_0x9fef('0x20')]);}return _0x2be43b[_0x9fef('0x4d')](_0x810755);}})[_0x9fef('0x2a')](function(_0x410fb1){if(_0x410fb1){return _0x410fb1?{'count':_0x342e2e,'rows':_0x410fb1}:null;}})[_0x9fef('0x2a')](respondWithResult(_0x42681f,null))[_0x9fef('0x4a')](handleError(_0x42681f,null));};exports[_0x9fef('0x51')]=function(_0x50b1a7,_0x459a86,_0x4f309a){var _0x576347={};var _0x4d8d66={};var _0x1e8985;var _0x579118;return db[_0x9fef('0x30')]['findOne']({'where':{'id':_0x50b1a7[_0x9fef('0x47')]['id']}})[_0x9fef('0x2a')](handleEntityNotFound(_0x459a86,null))[_0x9fef('0x2a')](function(_0x4a9ca9){if(_0x4a9ca9){_0x1e8985=_0x4a9ca9;_0x4d8d66[_0x9fef('0x39')]=_[_0x9fef('0x48')](db[_0x9fef('0x4e')][_0x9fef('0x31')]);_0x4d8d66[_0x9fef('0x35')]=_[_0x9fef('0x48')](_0x50b1a7[_0x9fef('0x35')]);_0x4d8d66[_0x9fef('0x36')]=_[_0x9fef('0x38')](_0x4d8d66[_0x9fef('0x39')],_0x4d8d66[_0x9fef('0x35')]);_0x576347['attributes']=_['intersection'](_0x4d8d66[_0x9fef('0x39')],qs[_0x9fef('0x3a')](_0x50b1a7['query'][_0x9fef('0x3a')]));_0x576347[_0x9fef('0x37')]=_0x576347[_0x9fef('0x37')]['length']?_0x576347['attributes']:_0x4d8d66[_0x9fef('0x39')];_0x576347[_0x9fef('0x4f')]=qs['sort'](_0x50b1a7[_0x9fef('0x35')]['sort']);_0x576347[_0x9fef('0x3e')]=qs['filters'](_[_0x9fef('0x3f')](_0x50b1a7[_0x9fef('0x35')],_0x4d8d66[_0x9fef('0x36')]));if(_0x50b1a7[_0x9fef('0x35')][_0x9fef('0x40')]){_0x576347[_0x9fef('0x3e')]=_['merge'](_0x576347['where'],{'$or':_['map'](_0x576347['attributes'],function(_0x365209){var _0x474e26={};_0x474e26[_0x365209]={'$like':'%'+_0x50b1a7[_0x9fef('0x35')][_0x9fef('0x40')]+'%'};return _0x474e26;})});}_0x576347=_[_0x9fef('0x41')]({},_0x576347,_0x50b1a7[_0x9fef('0x43')]);return _0x1e8985[_0x9fef('0x51')](_0x576347);}})[_0x9fef('0x2a')](function(_0x4fe2c1){if(_0x4fe2c1){_0x579118=_0x4fe2c1[_0x9fef('0x3b')];if(!_0x50b1a7[_0x9fef('0x35')][_0x9fef('0x3c')](_0x9fef('0x50'))){_0x576347[_0x9fef('0x22')]=qs[_0x9fef('0x22')](_0x50b1a7[_0x9fef('0x35')][_0x9fef('0x22')]);_0x576347[_0x9fef('0x20')]=qs[_0x9fef('0x20')](_0x50b1a7[_0x9fef('0x35')]['offset']);}return _0x1e8985[_0x9fef('0x51')](_0x576347);}})[_0x9fef('0x2a')](function(_0x2b18e8){if(_0x2b18e8){return _0x2b18e8?{'count':_0x579118,'rows':_0x2b18e8}:null;}})[_0x9fef('0x2a')](respondWithResult(_0x459a86,null))[_0x9fef('0x4a')](handleError(_0x459a86,null));};exports[_0x9fef('0x52')]=function(_0x26ce7c,_0x5c1944,_0x2783b9){var _0x47e791={};var _0x424872={};var _0x3ad14b;var _0x39350a;return db[_0x9fef('0x30')][_0x9fef('0x53')]({'where':{'id':_0x26ce7c[_0x9fef('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c1944,null))[_0x9fef('0x2a')](function(_0x5bceaf){if(_0x5bceaf){_0x3ad14b=_0x5bceaf;_0x424872[_0x9fef('0x39')]=_[_0x9fef('0x48')](db['SalesforceField'][_0x9fef('0x31')]);_0x424872[_0x9fef('0x35')]=_[_0x9fef('0x48')](_0x26ce7c[_0x9fef('0x35')]);_0x424872[_0x9fef('0x36')]=_[_0x9fef('0x38')](_0x424872[_0x9fef('0x39')],_0x424872[_0x9fef('0x35')]);_0x47e791[_0x9fef('0x37')]=_['intersection'](_0x424872[_0x9fef('0x39')],qs[_0x9fef('0x3a')](_0x26ce7c[_0x9fef('0x35')][_0x9fef('0x3a')]));_0x47e791[_0x9fef('0x37')]=_0x47e791['attributes']['length']?_0x47e791[_0x9fef('0x37')]:_0x424872['model'];_0x47e791[_0x9fef('0x4f')]=qs[_0x9fef('0x3d')](_0x26ce7c[_0x9fef('0x35')][_0x9fef('0x3d')]);_0x47e791['where']=qs[_0x9fef('0x36')](_['pick'](_0x26ce7c[_0x9fef('0x35')],_0x424872[_0x9fef('0x36')]));if(_0x26ce7c['query'][_0x9fef('0x40')]){_0x47e791[_0x9fef('0x3e')]=_[_0x9fef('0x41')](_0x47e791['where'],{'$or':_[_0x9fef('0x2f')](_0x47e791[_0x9fef('0x37')],function(_0x2cb142){var _0x4faa1d={};_0x4faa1d[_0x2cb142]={'$like':'%'+_0x26ce7c[_0x9fef('0x35')][_0x9fef('0x40')]+'%'};return _0x4faa1d;})});}_0x47e791=_[_0x9fef('0x41')]({},_0x47e791,_0x26ce7c[_0x9fef('0x43')]);return _0x3ad14b[_0x9fef('0x52')](_0x47e791);}})[_0x9fef('0x2a')](function(_0x230ecf){if(_0x230ecf){_0x39350a=_0x230ecf[_0x9fef('0x3b')];if(!_0x26ce7c[_0x9fef('0x35')]['hasOwnProperty']('nolimit')){_0x47e791[_0x9fef('0x22')]=qs[_0x9fef('0x22')](_0x26ce7c[_0x9fef('0x35')][_0x9fef('0x22')]);_0x47e791[_0x9fef('0x20')]=qs[_0x9fef('0x20')](_0x26ce7c[_0x9fef('0x35')]['offset']);}return _0x3ad14b['getDescriptions'](_0x47e791);}})['then'](function(_0x1e0415){if(_0x1e0415){return _0x1e0415?{'count':_0x39350a,'rows':_0x1e0415}:null;}})[_0x9fef('0x2a')](respondWithResult(_0x5c1944,null))[_0x9fef('0x4a')](handleError(_0x5c1944,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0c76078..fb15b28 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 _0xa804=['int_salesforce_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x3fed55,_0x370c16){var _0x1cc539=function(_0x4a39b6){while(--_0x4a39b6){_0x3fed55['push'](_0x3fed55['shift']());}};_0x1cc539(++_0x370c16);}(_0xa804,0xde));var _0x4a80=function(_0x92394c,_0x5096e1){_0x92394c=_0x92394c-0x0;var _0x1dac92=_0xa804[_0x92394c];return _0x1dac92;};'use strict';var _=require(_0x4a80('0x0'));var util=require(_0x4a80('0x1'));var logger=require('../../config/logger')(_0x4a80('0x2'));var moment=require('moment');var BPromise=require(_0x4a80('0x3'));var rp=require(_0x4a80('0x4'));var fs=require('fs');var path=require(_0x4a80('0x5'));var rimraf=require(_0x4a80('0x6'));var config=require(_0x4a80('0x7'));var attributes=require(_0x4a80('0x8'));module[_0x4a80('0x9')]=function(_0x3a9756,_0x2a8d85){return _0x3a9756[_0x4a80('0xa')](_0x4a80('0xb'),attributes,{'tableName':_0x4a80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dbd=['moment','bluebird','request-promise','../../config/environment','exports','define','SalesforceConfiguration','lodash','../../config/logger','api'];(function(_0x5e61be,_0x5408bf){var _0x34ba94=function(_0x1f1769){while(--_0x1f1769){_0x5e61be['push'](_0x5e61be['shift']());}};_0x34ba94(++_0x5408bf);}(_0x3dbd,0x1e7));var _0xd3db=function(_0x32c22e,_0x3beffd){_0x32c22e=_0x32c22e-0x0;var _0x32cfc6=_0x3dbd[_0x32c22e];return _0x32cfc6;};'use strict';var _=require(_0xd3db('0x0'));var util=require('util');var logger=require(_0xd3db('0x1'))(_0xd3db('0x2'));var moment=require(_0xd3db('0x3'));var BPromise=require(_0xd3db('0x4'));var rp=require(_0xd3db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3db('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd3db('0x7')]=function(_0x24ea50,_0x451fad){return _0x24ea50[_0xd3db('0x8')](_0xd3db('0x9'),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 54d36ed..1d06af2 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 _0x8a89=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8a89,0xa5));var _0x98a8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8a89[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x98a8('0x0'));var util=require(_0x98a8('0x1'));var moment=require(_0x98a8('0x2'));var BPromise=require(_0x98a8('0x3'));var rs=require(_0x98a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98a8('0x5'))['db'];var utils=require(_0x98a8('0x6'));var logger=require(_0x98a8('0x7'))(_0x98a8('0x8'));var config=require(_0x98a8('0x9'));var jayson=require(_0x98a8('0xa'));var client=jayson[_0x98a8('0xb')][_0x98a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x398d57,_0x4ab492,_0x47603d){return new BPromise(function(_0x179fb3,_0x2a70ec){return client[_0x98a8('0xd')](_0x398d57,_0x47603d)[_0x98a8('0xe')](function(_0x17a29b){logger[_0x98a8('0xf')](_0x98a8('0x10'),_0x4ab492,_0x98a8('0x11'));logger['debug'](_0x98a8('0x12'),_0x4ab492,_0x98a8('0x11'),JSON[_0x98a8('0x13')](_0x17a29b));if(_0x17a29b['error']){if(_0x17a29b[_0x98a8('0x14')]['code']===0x1f4){logger[_0x98a8('0x14')](_0x98a8('0x10'),_0x4ab492,_0x17a29b[_0x98a8('0x14')]['message']);return _0x2a70ec(_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);}logger[_0x98a8('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ab492,_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);return _0x179fb3(_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);}else{logger[_0x98a8('0xf')](_0x98a8('0x10'),_0x4ab492,_0x98a8('0x11'));_0x179fb3(_0x17a29b[_0x98a8('0x16')]['message']);}})[_0x98a8('0x17')](function(_0x18c7eb){logger['error'](_0x98a8('0x10'),_0x4ab492,_0x18c7eb);_0x2a70ec(_0x18c7eb);});});} \ No newline at end of file +var _0x51cb=['message','SalesforceConfiguration,\x20%s,\x20%s','info','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x51cb,0x1b4));var _0xb51c=function(_0x5da906,_0xea3b2c){_0x5da906=_0x5da906-0x0;var _0x4bc8bd=_0x51cb[_0x5da906];return _0x4bc8bd;};'use strict';var _=require(_0xb51c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb51c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb51c('0x2'))['db'];var utils=require(_0xb51c('0x3'));var logger=require(_0xb51c('0x4'))(_0xb51c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb51c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369676,_0x2c3042,_0x167bdd){return new BPromise(function(_0x5247f2,_0x54972a){return client['request'](_0x369676,_0x167bdd)[_0xb51c('0x7')](function(_0x400429){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2c3042,_0xb51c('0x8'));logger[_0xb51c('0x9')](_0xb51c('0xa'),_0x2c3042,_0xb51c('0x8'),JSON['stringify'](_0x400429));if(_0x400429['error']){if(_0x400429['error']['code']===0x1f4){logger[_0xb51c('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2c3042,_0x400429['error'][_0xb51c('0xc')]);return _0x54972a(_0x400429[_0xb51c('0xb')][_0xb51c('0xc')]);}logger[_0xb51c('0xb')](_0xb51c('0xd'),_0x2c3042,_0x400429['error'][_0xb51c('0xc')]);return _0x5247f2(_0x400429[_0xb51c('0xb')][_0xb51c('0xc')]);}else{logger[_0xb51c('0xe')](_0xb51c('0xd'),_0x2c3042,_0xb51c('0x8'));_0x5247f2(_0x400429[_0xb51c('0xf')]['message']);}})['catch'](function(_0x66311d){logger[_0xb51c('0xb')](_0xb51c('0xd'),_0x2c3042,_0x66311d);_0x54972a(_0x66311d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d8e37c7..ee2a7fb 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 _0xbcab=['connect-timeout','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','post','create','update','delete','/:id','destroy','exports','util','path'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xbcab,0xfe));var _0xbbca=function(_0x3f5b9a,_0x45f043){_0x3f5b9a=_0x3f5b9a-0x0;var _0x33fbf9=_0xbcab[_0x3f5b9a];return _0x33fbf9;};'use strict';var multer=require('multer');var util=require(_0xbbca('0x0'));var path=require(_0xbbca('0x1'));var timeout=require(_0xbbca('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbbca('0x3'));var auth=require(_0xbbca('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbbca('0x5'));router[_0xbbca('0x6')]('/',auth[_0xbbca('0x7')](),controller[_0xbbca('0x8')]);router[_0xbbca('0x6')]('/:id',auth[_0xbbca('0x7')](),controller['show']);router[_0xbbca('0x9')]('/',auth[_0xbbca('0x7')](),controller[_0xbbca('0xa')]);router['put']('/:id',auth[_0xbbca('0x7')](),controller[_0xbbca('0xb')]);router[_0xbbca('0xc')](_0xbbca('0xd'),auth['isAuthenticated'](),controller[_0xbbca('0xe')]);module[_0xbbca('0xf')]=router; \ No newline at end of file +var _0x9123=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9123,0x76));var _0x3912=function(_0x25f262,_0x7be0bb){_0x25f262=_0x25f262-0x0;var _0x116ec1=_0x9123[_0x25f262];return _0x116ec1;};'use strict';var multer=require(_0x3912('0x0'));var util=require(_0x3912('0x1'));var path=require(_0x3912('0x2'));var timeout=require(_0x3912('0x3'));var express=require(_0x3912('0x4'));var router=express['Router']();var fs_extra=require(_0x3912('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3912('0x6'));var config=require('../../config/environment');var controller=require(_0x3912('0x7'));router[_0x3912('0x8')]('/',auth[_0x3912('0x9')](),controller[_0x3912('0xa')]);router['get'](_0x3912('0xb'),auth[_0x3912('0x9')](),controller[_0x3912('0xc')]);router[_0x3912('0xd')]('/',auth[_0x3912('0x9')](),controller[_0x3912('0xe')]);router[_0x3912('0xf')](_0x3912('0xb'),auth[_0x3912('0x9')](),controller[_0x3912('0x10')]);router[_0x3912('0x11')](_0x3912('0xb'),auth[_0x3912('0x9')](),controller['destroy']);module[_0x3912('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0d08881..4c370af 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 _0x3a66=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x469407,_0xd3d477){var _0x2d391a=function(_0x1e3b07){while(--_0x1e3b07){_0x469407['push'](_0x469407['shift']());}};_0x2d391a(++_0xd3d477);}(_0x3a66,0x7e));var _0x63a6=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x3a66[_0x5d72da];return _0x43ebe7;};'use strict';var Sequelize=require(_0x63a6('0x0'));module[_0x63a6('0x1')]={'type':{'type':Sequelize[_0x63a6('0x2')](_0x63a6('0x3'),_0x63a6('0x4'),'customVariable',_0x63a6('0x5'),_0x63a6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x63a6('0x7')]},'key':{'type':Sequelize[_0x63a6('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x63a6('0x4'),_0x63a6('0x8'))},'keyContent':{'type':Sequelize[_0x63a6('0x7')]},'idField':{'type':Sequelize[_0x63a6('0x7')]},'variableName':{'type':Sequelize[_0x63a6('0x7')]}}; \ No newline at end of file +var _0x4b97=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x438ae7,_0x1cd249){var _0x1990cb=function(_0x332af8){while(--_0x332af8){_0x438ae7['push'](_0x438ae7['shift']());}};_0x1990cb(++_0x1cd249);}(_0x4b97,0x11d));var _0x74b9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4b97[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x74b9('0x0'));module['exports']={'type':{'type':Sequelize[_0x74b9('0x1')](_0x74b9('0x2'),_0x74b9('0x3'),_0x74b9('0x4'),_0x74b9('0x5'),_0x74b9('0x6')),'defaultValue':_0x74b9('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x74b9('0x1')](_0x74b9('0x2'),_0x74b9('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x74b9('0x7')]},'variableName':{'type':Sequelize[_0x74b9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c849529..492d237 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 _0x1269=['VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','apply','save','update','then','error','stack','name','send','index','map','SalesforceField','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x1269,0xd0));var _0x9126=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x1269[_0x33975c];return _0x1c15ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9126('0x0'));var zipdir=require(_0x9126('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9126('0x2'));var moment=require(_0x9126('0x3'));var BPromise=require(_0x9126('0x4'));var Mustache=require(_0x9126('0x5'));var util=require('util');var path=require(_0x9126('0x6'));var sox=require('sox');var csv=require(_0x9126('0x7'));var ejs=require(_0x9126('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9126('0x9'));var crypto=require(_0x9126('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9126('0xb'));var toCsv=require(_0x9126('0x7'));var querystring=require(_0x9126('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9126('0xd'));var config=require(_0x9126('0xe'));var licenseUtil=require(_0x9126('0xf'));var db=require(_0x9126('0x10'))['db'];function respondWithStatusCode(_0x6ed350,_0x3b72b0){_0x3b72b0=_0x3b72b0||0xcc;return function(_0x4ca233){if(_0x4ca233){return _0x6ed350['sendStatus'](_0x3b72b0);}return _0x6ed350['status'](_0x3b72b0)[_0x9126('0x11')]();};}function respondWithResult(_0x3b3a1f,_0x551bce){_0x551bce=_0x551bce||0xc8;return function(_0x6466d3){if(_0x6466d3){return _0x3b3a1f[_0x9126('0x12')](_0x551bce)[_0x9126('0x13')](_0x6466d3);}};}function respondWithFilteredResult(_0x111080,_0x2d4ff2){return function(_0x4a018d){if(_0x4a018d){var _0x294300=typeof _0x2d4ff2[_0x9126('0x14')]===_0x9126('0x15')&&typeof _0x2d4ff2['limit']===_0x9126('0x15');var _0x4945e7=_0x4a018d['count'];var _0x4c4eb1=_0x294300?0x0:_0x2d4ff2[_0x9126('0x14')];var _0x315cdf=_0x294300?_0x4a018d['count']:_0x2d4ff2[_0x9126('0x14')]+_0x2d4ff2[_0x9126('0x16')];var _0x2ebcc5;if(_0x315cdf>=_0x4945e7){_0x315cdf=_0x4945e7;_0x2ebcc5=0xc8;}else{_0x2ebcc5=0xce;}_0x111080[_0x9126('0x12')](_0x2ebcc5);return _0x111080[_0x9126('0x17')]('Content-Range',_0x4c4eb1+'-'+_0x315cdf+'/'+_0x4945e7)[_0x9126('0x13')](_0x4a018d);}return null;};}function patchUpdates(_0x34f787){return function(_0x3d6c47){try{jsonpatch[_0x9126('0x18')](_0x3d6c47,_0x34f787,!![]);}catch(_0x54645a){return BPromise['reject'](_0x54645a);}return _0x3d6c47[_0x9126('0x19')]();};}function saveUpdates(_0x5e5fbb,_0x10db21){return function(_0x304d00){if(_0x304d00){return _0x304d00[_0x9126('0x1a')](_0x5e5fbb)['then'](function(_0x4f24ef){return _0x4f24ef;});}return null;};}function removeEntity(_0xa7b35f,_0x36dc09){return function(_0x3d3484){if(_0x3d3484){return _0x3d3484['destroy']()[_0x9126('0x1b')](function(){_0xa7b35f[_0x9126('0x12')](0xcc)[_0x9126('0x11')]();});}};}function handleEntityNotFound(_0x3273ca,_0x14f27d){return function(_0x51015d){if(!_0x51015d){_0x3273ca['sendStatus'](0x194);}return _0x51015d;};}function handleError(_0xe06d5c,_0x58cb85){_0x58cb85=_0x58cb85||0x1f4;return function(_0x3a3a92){logger[_0x9126('0x1c')](_0x3a3a92[_0x9126('0x1d')]);if(_0x3a3a92[_0x9126('0x1e')]){delete _0x3a3a92[_0x9126('0x1e')];}_0xe06d5c[_0x9126('0x12')](_0x58cb85)[_0x9126('0x1f')](_0x3a3a92);};}exports[_0x9126('0x20')]=function(_0x3be67c,_0xf844b2){var _0x1d92c5={},_0x160a48={},_0x45441f={'count':0x0,'rows':[]};var _0x49ace9=_[_0x9126('0x21')](db[_0x9126('0x22')]['rawAttributes'],function(_0x56d0ec){return{'name':_0x56d0ec[_0x9126('0x23')],'type':_0x56d0ec[_0x9126('0x24')]['key']};});_0x160a48[_0x9126('0x25')]=_['map'](_0x49ace9,'name');_0x160a48['query']=_[_0x9126('0x26')](_0x3be67c[_0x9126('0x27')]);_0x160a48[_0x9126('0x28')]=_[_0x9126('0x29')](_0x160a48[_0x9126('0x25')],_0x160a48[_0x9126('0x27')]);_0x1d92c5[_0x9126('0x2a')]=_[_0x9126('0x29')](_0x160a48['model'],qs[_0x9126('0x2b')](_0x3be67c['query'][_0x9126('0x2b')]));_0x1d92c5[_0x9126('0x2a')]=_0x1d92c5['attributes']['length']?_0x1d92c5[_0x9126('0x2a')]:_0x160a48[_0x9126('0x25')];if(!_0x3be67c['query'][_0x9126('0x2c')](_0x9126('0x2d'))){_0x1d92c5[_0x9126('0x16')]=qs[_0x9126('0x16')](_0x3be67c[_0x9126('0x27')][_0x9126('0x16')]);_0x1d92c5[_0x9126('0x14')]=qs[_0x9126('0x14')](_0x3be67c[_0x9126('0x27')]['offset']);}_0x1d92c5[_0x9126('0x2e')]=qs['sort'](_0x3be67c[_0x9126('0x27')][_0x9126('0x2f')]);_0x1d92c5[_0x9126('0x30')]=qs[_0x9126('0x28')](_[_0x9126('0x31')](_0x3be67c['query'],_0x160a48[_0x9126('0x28')]),_0x49ace9);if(_0x3be67c['query'][_0x9126('0x32')]){_0x1d92c5[_0x9126('0x30')]=_[_0x9126('0x33')](_0x1d92c5['where'],{'$or':_[_0x9126('0x21')](_0x49ace9,function(_0x160807){if(_0x160807[_0x9126('0x24')]!==_0x9126('0x34')){var _0x58097f={};_0x58097f[_0x160807['name']]={'$like':'%'+_0x3be67c[_0x9126('0x27')][_0x9126('0x32')]+'%'};return _0x58097f;}})});}_0x1d92c5=_['merge']({},_0x1d92c5,_0x3be67c[_0x9126('0x35')]);var _0x2508b1={'where':_0x1d92c5[_0x9126('0x30')]};return db[_0x9126('0x22')]['count'](_0x2508b1)[_0x9126('0x1b')](function(_0x1e35d2){_0x45441f['count']=_0x1e35d2;if(_0x3be67c[_0x9126('0x27')][_0x9126('0x36')]){_0x1d92c5['include']=[{'all':!![]}];}return db[_0x9126('0x22')]['findAll'](_0x1d92c5);})[_0x9126('0x1b')](function(_0x5c43af){_0x45441f[_0x9126('0x37')]=_0x5c43af;return _0x45441f;})[_0x9126('0x1b')](respondWithFilteredResult(_0xf844b2,_0x1d92c5))[_0x9126('0x38')](handleError(_0xf844b2,null));};exports[_0x9126('0x39')]=function(_0x3a7a70,_0x195e3e){var _0x2a6d8e={'raw':!![],'where':{'id':_0x3a7a70['params']['id']}},_0x2bec24={};_0x2bec24[_0x9126('0x25')]=_['keys'](db['SalesforceField'][_0x9126('0x3a')]);_0x2bec24[_0x9126('0x27')]=_[_0x9126('0x26')](_0x3a7a70[_0x9126('0x27')]);_0x2bec24['filters']=_[_0x9126('0x29')](_0x2bec24['model'],_0x2bec24['query']);_0x2a6d8e[_0x9126('0x2a')]=_['intersection'](_0x2bec24[_0x9126('0x25')],qs[_0x9126('0x2b')](_0x3a7a70[_0x9126('0x27')]['fields']));_0x2a6d8e[_0x9126('0x2a')]=_0x2a6d8e[_0x9126('0x2a')]['length']?_0x2a6d8e[_0x9126('0x2a')]:_0x2bec24[_0x9126('0x25')];if(_0x3a7a70['query'][_0x9126('0x36')]){_0x2a6d8e[_0x9126('0x3b')]=[{'all':!![]}];}_0x2a6d8e=_['merge']({},_0x2a6d8e,_0x3a7a70[_0x9126('0x35')]);return db[_0x9126('0x22')][_0x9126('0x3c')](_0x2a6d8e)[_0x9126('0x1b')](handleEntityNotFound(_0x195e3e,null))[_0x9126('0x1b')](respondWithResult(_0x195e3e,null))[_0x9126('0x38')](handleError(_0x195e3e,null));};exports[_0x9126('0x3d')]=function(_0x125181,_0x46c60e){return db[_0x9126('0x22')][_0x9126('0x3d')](_0x125181[_0x9126('0x3e')],{})['then'](respondWithResult(_0x46c60e,0xc9))[_0x9126('0x38')](handleError(_0x46c60e,null));};exports[_0x9126('0x1a')]=function(_0x484b90,_0x4f3cf6){if(_0x484b90['body']['id']){delete _0x484b90['body']['id'];}return db['SalesforceField'][_0x9126('0x3c')]({'where':{'id':_0x484b90[_0x9126('0x3f')]['id']}})[_0x9126('0x1b')](handleEntityNotFound(_0x4f3cf6,null))[_0x9126('0x1b')](saveUpdates(_0x484b90[_0x9126('0x3e')],null))[_0x9126('0x1b')](respondWithResult(_0x4f3cf6,null))[_0x9126('0x38')](handleError(_0x4f3cf6,null));};exports[_0x9126('0x40')]=function(_0x2a68a4,_0xda9588){return db[_0x9126('0x22')][_0x9126('0x3c')]({'where':{'id':_0x2a68a4[_0x9126('0x3f')]['id']}})[_0x9126('0x1b')](handleEntityNotFound(_0xda9588,null))['then'](removeEntity(_0xda9588,null))[_0x9126('0x38')](handleError(_0xda9588,null));}; \ No newline at end of file +var _0xcb99=['save','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x4f91d1,_0x1a2451){var _0x382379=function(_0x3da173){while(--_0x3da173){_0x4f91d1['push'](_0x4f91d1['shift']());}};_0x382379(++_0x1a2451);}(_0xcb99,0x1e7));var _0x9cb9=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0xcb99[_0x48e86c];return _0x54fa11;};'use strict';var emlformat=require(_0x9cb9('0x0'));var rimraf=require(_0x9cb9('0x1'));var zipdir=require(_0x9cb9('0x2'));var jsonpatch=require(_0x9cb9('0x3'));var rp=require(_0x9cb9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9cb9('0x5'));var sox=require(_0x9cb9('0x6'));var csv=require('to-csv');var ejs=require(_0x9cb9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cb9('0x8'));var squel=require(_0x9cb9('0x9'));var crypto=require(_0x9cb9('0xa'));var jsforce=require(_0x9cb9('0xb'));var deskjs=require(_0x9cb9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9cb9('0xd'));var Papa=require(_0x9cb9('0xe'));var Redis=require('ioredis');var authService=require(_0x9cb9('0xf'));var qs=require(_0x9cb9('0x10'));var as=require(_0x9cb9('0x11'));var hardwareService=require(_0x9cb9('0x12'));var logger=require(_0x9cb9('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cb9('0x14'))['db'];function respondWithStatusCode(_0x7de729,_0x2ef535){_0x2ef535=_0x2ef535||0xcc;return function(_0x531b85){if(_0x531b85){return _0x7de729['sendStatus'](_0x2ef535);}return _0x7de729[_0x9cb9('0x15')](_0x2ef535)[_0x9cb9('0x16')]();};}function respondWithResult(_0x15558b,_0x40fb8d){_0x40fb8d=_0x40fb8d||0xc8;return function(_0xdff32a){if(_0xdff32a){return _0x15558b[_0x9cb9('0x15')](_0x40fb8d)['json'](_0xdff32a);}};}function respondWithFilteredResult(_0xa16ef5,_0x222f5d){return function(_0x503903){if(_0x503903){var _0x59a841=typeof _0x222f5d[_0x9cb9('0x17')]===_0x9cb9('0x18')&&typeof _0x222f5d[_0x9cb9('0x19')]===_0x9cb9('0x18');var _0x78b9c7=_0x503903['count'];var _0x43d1c0=_0x59a841?0x0:_0x222f5d[_0x9cb9('0x17')];var _0x4897af=_0x59a841?_0x503903[_0x9cb9('0x1a')]:_0x222f5d['offset']+_0x222f5d[_0x9cb9('0x19')];var _0x26afcd;if(_0x4897af>=_0x78b9c7){_0x4897af=_0x78b9c7;_0x26afcd=0xc8;}else{_0x26afcd=0xce;}_0xa16ef5['status'](_0x26afcd);return _0xa16ef5[_0x9cb9('0x1b')]('Content-Range',_0x43d1c0+'-'+_0x4897af+'/'+_0x78b9c7)[_0x9cb9('0x1c')](_0x503903);}return null;};}function patchUpdates(_0x353191){return function(_0x338733){try{jsonpatch[_0x9cb9('0x1d')](_0x338733,_0x353191,!![]);}catch(_0x37b30f){return BPromise[_0x9cb9('0x1e')](_0x37b30f);}return _0x338733[_0x9cb9('0x1f')]();};}function saveUpdates(_0x28fed0,_0x23ff73){return function(_0xe27cb6){if(_0xe27cb6){return _0xe27cb6[_0x9cb9('0x20')](_0x28fed0)[_0x9cb9('0x21')](function(_0xdedbde){return _0xdedbde;});}return null;};}function removeEntity(_0x5d030d,_0x55b798){return function(_0x124fea){if(_0x124fea){return _0x124fea[_0x9cb9('0x22')]()[_0x9cb9('0x21')](function(){_0x5d030d['status'](0xcc)[_0x9cb9('0x16')]();});}};}function handleEntityNotFound(_0x783131,_0x34dcd5){return function(_0x28bbcc){if(!_0x28bbcc){_0x783131['sendStatus'](0x194);}return _0x28bbcc;};}function handleError(_0x38fc6e,_0x512356){_0x512356=_0x512356||0x1f4;return function(_0x120252){logger[_0x9cb9('0x23')](_0x120252[_0x9cb9('0x24')]);if(_0x120252[_0x9cb9('0x25')]){delete _0x120252['name'];}_0x38fc6e[_0x9cb9('0x15')](_0x512356)[_0x9cb9('0x26')](_0x120252);};}exports[_0x9cb9('0x27')]=function(_0x1e0fbf,_0x262be5){var _0x3847ca={},_0x3e89e1={},_0xd8ae24={'count':0x0,'rows':[]};var _0xbe735c=_[_0x9cb9('0x28')](db[_0x9cb9('0x29')][_0x9cb9('0x2a')],function(_0x2838dd){return{'name':_0x2838dd[_0x9cb9('0x2b')],'type':_0x2838dd[_0x9cb9('0x2c')][_0x9cb9('0x2d')]};});_0x3e89e1[_0x9cb9('0x2e')]=_[_0x9cb9('0x28')](_0xbe735c,_0x9cb9('0x25'));_0x3e89e1['query']=_[_0x9cb9('0x2f')](_0x1e0fbf[_0x9cb9('0x30')]);_0x3e89e1[_0x9cb9('0x31')]=_[_0x9cb9('0x32')](_0x3e89e1['model'],_0x3e89e1[_0x9cb9('0x30')]);_0x3847ca['attributes']=_[_0x9cb9('0x32')](_0x3e89e1[_0x9cb9('0x2e')],qs[_0x9cb9('0x33')](_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x33')]));_0x3847ca['attributes']=_0x3847ca[_0x9cb9('0x34')][_0x9cb9('0x35')]?_0x3847ca[_0x9cb9('0x34')]:_0x3e89e1[_0x9cb9('0x2e')];if(!_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x36')](_0x9cb9('0x37'))){_0x3847ca['limit']=qs[_0x9cb9('0x19')](_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x19')]);_0x3847ca[_0x9cb9('0x17')]=qs[_0x9cb9('0x17')](_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x17')]);}_0x3847ca[_0x9cb9('0x38')]=qs[_0x9cb9('0x39')](_0x1e0fbf['query'][_0x9cb9('0x39')]);_0x3847ca['where']=qs['filters'](_[_0x9cb9('0x3a')](_0x1e0fbf[_0x9cb9('0x30')],_0x3e89e1[_0x9cb9('0x31')]),_0xbe735c);if(_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x3b')]){_0x3847ca[_0x9cb9('0x3c')]=_['merge'](_0x3847ca[_0x9cb9('0x3c')],{'$or':_[_0x9cb9('0x28')](_0xbe735c,function(_0x56c7dd){if(_0x56c7dd[_0x9cb9('0x2c')]!==_0x9cb9('0x3d')){var _0x295414={};_0x295414[_0x56c7dd[_0x9cb9('0x25')]]={'$like':'%'+_0x1e0fbf[_0x9cb9('0x30')][_0x9cb9('0x3b')]+'%'};return _0x295414;}})});}_0x3847ca=_[_0x9cb9('0x3e')]({},_0x3847ca,_0x1e0fbf[_0x9cb9('0x3f')]);var _0x5b1683={'where':_0x3847ca['where']};return db[_0x9cb9('0x29')][_0x9cb9('0x1a')](_0x5b1683)['then'](function(_0x278ff0){_0xd8ae24[_0x9cb9('0x1a')]=_0x278ff0;if(_0x1e0fbf['query'][_0x9cb9('0x40')]){_0x3847ca[_0x9cb9('0x41')]=[{'all':!![]}];}return db[_0x9cb9('0x29')][_0x9cb9('0x42')](_0x3847ca);})[_0x9cb9('0x21')](function(_0x5f429e){_0xd8ae24[_0x9cb9('0x43')]=_0x5f429e;return _0xd8ae24;})[_0x9cb9('0x21')](respondWithFilteredResult(_0x262be5,_0x3847ca))[_0x9cb9('0x44')](handleError(_0x262be5,null));};exports[_0x9cb9('0x45')]=function(_0x3ed6a1,_0x22b05e){var _0x29e061={'raw':!![],'where':{'id':_0x3ed6a1[_0x9cb9('0x46')]['id']}},_0x4fb3a6={};_0x4fb3a6[_0x9cb9('0x2e')]=_[_0x9cb9('0x2f')](db['SalesforceField'][_0x9cb9('0x2a')]);_0x4fb3a6[_0x9cb9('0x30')]=_[_0x9cb9('0x2f')](_0x3ed6a1['query']);_0x4fb3a6['filters']=_[_0x9cb9('0x32')](_0x4fb3a6['model'],_0x4fb3a6[_0x9cb9('0x30')]);_0x29e061[_0x9cb9('0x34')]=_[_0x9cb9('0x32')](_0x4fb3a6[_0x9cb9('0x2e')],qs['fields'](_0x3ed6a1[_0x9cb9('0x30')][_0x9cb9('0x33')]));_0x29e061['attributes']=_0x29e061[_0x9cb9('0x34')][_0x9cb9('0x35')]?_0x29e061['attributes']:_0x4fb3a6['model'];if(_0x3ed6a1[_0x9cb9('0x30')][_0x9cb9('0x40')]){_0x29e061[_0x9cb9('0x41')]=[{'all':!![]}];}_0x29e061=_[_0x9cb9('0x3e')]({},_0x29e061,_0x3ed6a1[_0x9cb9('0x3f')]);return db[_0x9cb9('0x29')][_0x9cb9('0x47')](_0x29e061)['then'](handleEntityNotFound(_0x22b05e,null))[_0x9cb9('0x21')](respondWithResult(_0x22b05e,null))[_0x9cb9('0x44')](handleError(_0x22b05e,null));};exports[_0x9cb9('0x48')]=function(_0x204b06,_0x531428){return db[_0x9cb9('0x29')][_0x9cb9('0x48')](_0x204b06[_0x9cb9('0x49')],{})[_0x9cb9('0x21')](respondWithResult(_0x531428,0xc9))[_0x9cb9('0x44')](handleError(_0x531428,null));};exports[_0x9cb9('0x20')]=function(_0x5b1c8e,_0x6636bf){if(_0x5b1c8e[_0x9cb9('0x49')]['id']){delete _0x5b1c8e[_0x9cb9('0x49')]['id'];}return db[_0x9cb9('0x29')][_0x9cb9('0x47')]({'where':{'id':_0x5b1c8e['params']['id']}})[_0x9cb9('0x21')](handleEntityNotFound(_0x6636bf,null))[_0x9cb9('0x21')](saveUpdates(_0x5b1c8e[_0x9cb9('0x49')],null))[_0x9cb9('0x21')](respondWithResult(_0x6636bf,null))[_0x9cb9('0x44')](handleError(_0x6636bf,null));};exports[_0x9cb9('0x22')]=function(_0x230a38,_0x29a919){return db[_0x9cb9('0x29')]['find']({'where':{'id':_0x230a38[_0x9cb9('0x46')]['id']}})[_0x9cb9('0x21')](handleEntityNotFound(_0x29a919,null))[_0x9cb9('0x21')](removeEntity(_0x29a919,null))[_0x9cb9('0x44')](handleError(_0x29a919,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0c50469..4f3dead 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 _0x33be=['int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField'];(function(_0x59f6c9,_0x50271d){var _0x52ed6a=function(_0x2c008d){while(--_0x2c008d){_0x59f6c9['push'](_0x59f6c9['shift']());}};_0x52ed6a(++_0x50271d);}(_0x33be,0x16f));var _0xe33b=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x33be[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xe33b('0x0'));var util=require('util');var logger=require(_0xe33b('0x1'))('api');var moment=require(_0xe33b('0x2'));var BPromise=require(_0xe33b('0x3'));var rp=require(_0xe33b('0x4'));var fs=require('fs');var path=require(_0xe33b('0x5'));var rimraf=require(_0xe33b('0x6'));var config=require(_0xe33b('0x7'));var attributes=require(_0xe33b('0x8'));module['exports']=function(_0x479e79,_0xc6f5f3){return _0x479e79[_0xe33b('0x9')](_0xe33b('0xa'),attributes,{'tableName':_0xe33b('0xb'),'paranoid':![],'indexes':[{'name':_0xe33b('0xc'),'fields':['idField',_0xe33b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d8b=['FieldId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','salesforce_unique_index','idField'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3d8b,0x83));var _0xb3d8=function(_0x2b23fc,_0x3a36a9){_0x2b23fc=_0x2b23fc-0x0;var _0x5975d8=_0x3d8b[_0x2b23fc];return _0x5975d8;};'use strict';var _=require(_0xb3d8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb3d8('0x1'));var BPromise=require(_0xb3d8('0x2'));var rp=require(_0xb3d8('0x3'));var fs=require('fs');var path=require(_0xb3d8('0x4'));var rimraf=require(_0xb3d8('0x5'));var config=require(_0xb3d8('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xb3d8('0x7')]=function(_0x53de6a,_0x9d05fa){return _0x53de6a[_0xb3d8('0x8')](_0xb3d8('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xb3d8('0xa'),'fields':[_0xb3d8('0xb'),_0xb3d8('0xc')],'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 fdddcb7..b92001f 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 _0x088e=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5d5ad9,_0x9fe65c){var _0x461f64=function(_0x97c064){while(--_0x97c064){_0x5d5ad9['push'](_0x5d5ad9['shift']());}};_0x461f64(++_0x9fe65c);}(_0x088e,0x1d3));var _0xe088=function(_0x2d5805,_0x21954e){_0x2d5805=_0x2d5805-0x0;var _0x1cae4f=_0x088e[_0x2d5805];return _0x1cae4f;};'use strict';var _=require(_0xe088('0x0'));var util=require(_0xe088('0x1'));var moment=require(_0xe088('0x2'));var BPromise=require('bluebird');var rs=require(_0xe088('0x3'));var fs=require('fs');var Redis=require(_0xe088('0x4'));var db=require(_0xe088('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe088('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe088('0x7'));var client=jayson['client'][_0xe088('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x568e6f,_0x1f1661,_0x603d3d){return new BPromise(function(_0x258e5c,_0x255fef){return client[_0xe088('0x9')](_0x568e6f,_0x603d3d)[_0xe088('0xa')](function(_0x4e4af4){logger[_0xe088('0xb')](_0xe088('0xc'),_0x1f1661,_0xe088('0xd'));logger[_0xe088('0xe')](_0xe088('0xf'),_0x1f1661,_0xe088('0xd'),JSON[_0xe088('0x10')](_0x4e4af4));if(_0x4e4af4['error']){if(_0x4e4af4['error'][_0xe088('0x11')]===0x1f4){logger[_0xe088('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1f1661,_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);return _0x255fef(_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);}logger[_0xe088('0x12')](_0xe088('0xc'),_0x1f1661,_0x4e4af4['error']['message']);return _0x258e5c(_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);}else{logger[_0xe088('0xb')](_0xe088('0xc'),_0x1f1661,'request\x20sent');_0x258e5c(_0x4e4af4['result'][_0xe088('0x13')]);}})[_0xe088('0x14')](function(_0x218a7d){logger[_0xe088('0x12')](_0xe088('0xc'),_0x1f1661,_0x218a7d);_0x255fef(_0x218a7d);});});} \ No newline at end of file +var _0xd22e=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd22e,0x98));var _0xed22=function(_0x3ba6f5,_0x530846){_0x3ba6f5=_0x3ba6f5-0x0;var _0xcbff07=_0xd22e[_0x3ba6f5];return _0xcbff07;};'use strict';var _=require(_0xed22('0x0'));var util=require(_0xed22('0x1'));var moment=require('moment');var BPromise=require(_0xed22('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed22('0x3'));var db=require(_0xed22('0x4'))['db'];var utils=require(_0xed22('0x5'));var logger=require('../../config/logger')(_0xed22('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed22('0x7')][_0xed22('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e236c,_0x563cee,_0x8526a4){return new BPromise(function(_0x5e9d38,_0x1223bd){return client['request'](_0x4e236c,_0x8526a4)[_0xed22('0x9')](function(_0xcb2312){logger[_0xed22('0xa')](_0xed22('0xb'),_0x563cee,_0xed22('0xc'));logger[_0xed22('0xd')](_0xed22('0xe'),_0x563cee,'request\x20sent',JSON['stringify'](_0xcb2312));if(_0xcb2312[_0xed22('0xf')]){if(_0xcb2312['error'][_0xed22('0x10')]===0x1f4){logger[_0xed22('0xf')]('SalesforceField,\x20%s,\x20%s',_0x563cee,_0xcb2312[_0xed22('0xf')][_0xed22('0x11')]);return _0x1223bd(_0xcb2312[_0xed22('0xf')]['message']);}logger[_0xed22('0xf')](_0xed22('0xb'),_0x563cee,_0xcb2312['error'][_0xed22('0x11')]);return _0x5e9d38(_0xcb2312[_0xed22('0xf')][_0xed22('0x11')]);}else{logger[_0xed22('0xa')](_0xed22('0xb'),_0x563cee,_0xed22('0xc'));_0x5e9d38(_0xcb2312[_0xed22('0x12')][_0xed22('0x11')]);}})['catch'](function(_0x1012f4){logger[_0xed22('0xf')](_0xed22('0xb'),_0x563cee,_0x1012f4);_0x1223bd(_0x1012f4);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 29a77e8..976e17b 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 _0x831c=['index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x831c,0x112));var _0xc831=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x831c[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var path=require(_0xc831('0x2'));var timeout=require(_0xc831('0x3'));var express=require(_0xc831('0x4'));var router=express[_0xc831('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc831('0x6'));var interaction=require(_0xc831('0x7'));var config=require(_0xc831('0x8'));var controller=require(_0xc831('0x9'));router[_0xc831('0xa')]('/',auth[_0xc831('0xb')](),controller[_0xc831('0xc')]);router['get'](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0xe')]);router['get'](_0xc831('0xf'),auth[_0xc831('0xb')](),controller['getConfigurations']);router['get'](_0xc831('0x10'),auth[_0xc831('0xb')](),controller[_0xc831('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc831('0x12')]);router[_0xc831('0x13')](_0xc831('0xf'),auth['isAuthenticated'](),controller[_0xc831('0x14')]);router[_0xc831('0x15')](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0x16')]);router[_0xc831('0x17')](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0x18')]);module[_0xc831('0x19')]=router; \ No newline at end of file +var _0xaaf7=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x4b8f4f,_0x266d93){var _0x574fb7=function(_0x23af7a){while(--_0x23af7a){_0x4b8f4f['push'](_0x4b8f4f['shift']());}};_0x574fb7(++_0x266d93);}(_0xaaf7,0x79));var _0x7aaf=function(_0x511933,_0x1d9966){_0x511933=_0x511933-0x0;var _0x3e063d=_0xaaf7[_0x511933];return _0x3e063d;};'use strict';var multer=require(_0x7aaf('0x0'));var util=require(_0x7aaf('0x1'));var path=require(_0x7aaf('0x2'));var timeout=require(_0x7aaf('0x3'));var express=require(_0x7aaf('0x4'));var router=express[_0x7aaf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7aaf('0x6'));var interaction=require(_0x7aaf('0x7'));var config=require('../../config/environment');var controller=require(_0x7aaf('0x8'));router[_0x7aaf('0x9')]('/',auth[_0x7aaf('0xa')](),controller[_0x7aaf('0xb')]);router[_0x7aaf('0x9')](_0x7aaf('0xc'),auth[_0x7aaf('0xa')](),controller[_0x7aaf('0xd')]);router[_0x7aaf('0x9')](_0x7aaf('0xe'),auth[_0x7aaf('0xa')](),controller['getConfigurations']);router[_0x7aaf('0x9')](_0x7aaf('0xf'),auth[_0x7aaf('0xa')](),controller[_0x7aaf('0x10')]);router[_0x7aaf('0x11')]('/',auth[_0x7aaf('0xa')](),controller[_0x7aaf('0x12')]);router[_0x7aaf('0x11')](_0x7aaf('0xe'),auth[_0x7aaf('0xa')](),controller['addConfiguration']);router[_0x7aaf('0x13')](_0x7aaf('0xc'),auth[_0x7aaf('0xa')](),controller[_0x7aaf('0x14')]);router[_0x7aaf('0x15')](_0x7aaf('0xc'),auth[_0x7aaf('0xa')](),controller[_0x7aaf('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c4dce30..896455c 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 _0x7d79=['exports','STRING','username','remoteUri','sequelize'];(function(_0x45f4bd,_0x1f69c4){var _0x352abe=function(_0x5a53a0){while(--_0x5a53a0){_0x45f4bd['push'](_0x45f4bd['shift']());}};_0x352abe(++_0x1f69c4);}(_0x7d79,0xb3));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x97d7('0x0'));module[_0x97d7('0x1')]={'name':{'type':Sequelize[_0x97d7('0x2')]},'description':{'type':Sequelize[_0x97d7('0x2')]},'username':{'type':Sequelize[_0x97d7('0x2')],'unique':_0x97d7('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x97d7('0x2')]},'remoteUri':{'type':Sequelize[_0x97d7('0x2')],'unique':_0x97d7('0x4')},'serverUrl':{'type':Sequelize[_0x97d7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x424c=['sequelize','exports','STRING','username'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x424c,0xdc));var _0xc424=function(_0x48319b,_0x2672bb){_0x48319b=_0x48319b-0x0;var _0xdbc3be=_0x424c[_0x48319b];return _0xdbc3be;};'use strict';var Sequelize=require(_0xc424('0x0'));module[_0xc424('0x1')]={'name':{'type':Sequelize[_0xc424('0x2')]},'description':{'type':Sequelize[_0xc424('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc424('0x3')},'password':{'type':Sequelize[_0xc424('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc424('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc424('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 2a2b388..b9c864a 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 _0xb4b8=['work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','reopen_count','sys_tags','escalation','correlation_id','location','username','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','concat','ServiceNow\x20error:\x20','test','statusCode','send','options','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','ServicenowAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getConfigurations','findOne','ServicenowConfiguration','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','close_code','notify','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task'];(function(_0x4f433e,_0x16bac7){var _0x46c877=function(_0x3b8577){while(--_0x3b8577){_0x4f433e['push'](_0x4f433e['shift']());}};_0x46c877(++_0x16bac7);}(_0xb4b8,0xed));var _0x8b4b=function(_0x55ea34,_0x1afb20){_0x55ea34=_0x55ea34-0x0;var _0x4ff604=_0xb4b8[_0x55ea34];return _0x4ff604;};'use strict';var emlformat=require(_0x8b4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b4b('0x2'));var moment=require('moment');var BPromise=require(_0x8b4b('0x3'));var Mustache=require(_0x8b4b('0x4'));var util=require('util');var path=require(_0x8b4b('0x5'));var sox=require(_0x8b4b('0x6'));var csv=require(_0x8b4b('0x7'));var ejs=require(_0x8b4b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b4b('0x9'));var squel=require('squel');var crypto=require(_0x8b4b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8b4b('0xb'));var toCsv=require(_0x8b4b('0x7'));var querystring=require(_0x8b4b('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b4b('0xd'));var qs=require(_0x8b4b('0xe'));var as=require(_0x8b4b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b4b('0x10'));var utils=require(_0x8b4b('0x11'));var config=require(_0x8b4b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b4b('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50b61e,_0x10b5e0){_0x10b5e0=_0x10b5e0||0xcc;return function(_0x42fb93){if(_0x42fb93){return _0x50b61e[_0x8b4b('0x14')](_0x10b5e0);}return _0x50b61e[_0x8b4b('0x15')](_0x10b5e0)[_0x8b4b('0x16')]();};}function respondWithResult(_0x39b9c,_0x29073f){_0x29073f=_0x29073f||0xc8;return function(_0x10a96d){if(_0x10a96d){return _0x39b9c['status'](_0x29073f)[_0x8b4b('0x17')](_0x10a96d);}};}function respondWithFilteredResult(_0x361cf8,_0x36e949){return function(_0x5c3010){if(_0x5c3010){var _0x1dff78=typeof _0x36e949[_0x8b4b('0x18')]===_0x8b4b('0x19')&&typeof _0x36e949['limit']==='undefined';var _0x366e29=_0x5c3010[_0x8b4b('0x1a')];var _0x58e108=_0x1dff78?0x0:_0x36e949[_0x8b4b('0x18')];var _0x5686d0=_0x1dff78?_0x5c3010[_0x8b4b('0x1a')]:_0x36e949[_0x8b4b('0x18')]+_0x36e949[_0x8b4b('0x1b')];var _0x503748;if(_0x5686d0>=_0x366e29){_0x5686d0=_0x366e29;_0x503748=0xc8;}else{_0x503748=0xce;}_0x361cf8[_0x8b4b('0x15')](_0x503748);return _0x361cf8[_0x8b4b('0x1c')](_0x8b4b('0x1d'),_0x58e108+'-'+_0x5686d0+'/'+_0x366e29)[_0x8b4b('0x17')](_0x5c3010);}return null;};}function patchUpdates(_0x1eed89){return function(_0x2be9b1){try{jsonpatch[_0x8b4b('0x1e')](_0x2be9b1,_0x1eed89,!![]);}catch(_0x2454db){return BPromise[_0x8b4b('0x1f')](_0x2454db);}return _0x2be9b1[_0x8b4b('0x20')]();};}function saveUpdates(_0x5d3580,_0x4bd728){return function(_0x2dd301){if(_0x2dd301){return _0x2dd301['update'](_0x5d3580)['then'](function(_0x9e7764){return _0x9e7764;});}return null;};}function removeEntity(_0x427e79,_0x2be5f5){return function(_0xe36aee){if(_0xe36aee){return _0xe36aee[_0x8b4b('0x21')]()[_0x8b4b('0x22')](function(){_0x427e79['status'](0xcc)[_0x8b4b('0x16')]();});}};}function handleEntityNotFound(_0x572c05,_0x53c814){return function(_0x8df076){if(!_0x8df076){_0x572c05[_0x8b4b('0x14')](0x194);}return _0x8df076;};}function handleError(_0x7e17e,_0x3b424b){_0x3b424b=_0x3b424b||0x1f4;return function(_0x2417b1){logger[_0x8b4b('0x23')](_0x2417b1[_0x8b4b('0x24')]);if(_0x2417b1[_0x8b4b('0x25')]){delete _0x2417b1[_0x8b4b('0x25')];}_0x7e17e[_0x8b4b('0x15')](_0x3b424b)['send'](_0x2417b1);};}exports[_0x8b4b('0x26')]=function(_0x1c1495,_0x219974){var _0x5f213b={},_0x2a96de={},_0x3ce646={'count':0x0,'rows':[]};var _0x101516=_['map'](db[_0x8b4b('0x27')]['rawAttributes'],function(_0x376e2c){return{'name':_0x376e2c[_0x8b4b('0x28')],'type':_0x376e2c[_0x8b4b('0x29')][_0x8b4b('0x2a')]};});_0x2a96de[_0x8b4b('0x2b')]=_[_0x8b4b('0x2c')](_0x101516,_0x8b4b('0x25'));_0x2a96de[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x1c1495['query']);_0x2a96de[_0x8b4b('0x2f')]=_[_0x8b4b('0x30')](_0x2a96de[_0x8b4b('0x2b')],_0x2a96de[_0x8b4b('0x2d')]);_0x5f213b[_0x8b4b('0x31')]=_[_0x8b4b('0x30')](_0x2a96de[_0x8b4b('0x2b')],qs[_0x8b4b('0x32')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x32')]));_0x5f213b[_0x8b4b('0x31')]=_0x5f213b[_0x8b4b('0x31')]['length']?_0x5f213b[_0x8b4b('0x31')]:_0x2a96de[_0x8b4b('0x2b')];if(!_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x33')](_0x8b4b('0x34'))){_0x5f213b[_0x8b4b('0x1b')]=qs[_0x8b4b('0x1b')](_0x1c1495['query'][_0x8b4b('0x1b')]);_0x5f213b[_0x8b4b('0x18')]=qs[_0x8b4b('0x18')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x18')]);}_0x5f213b[_0x8b4b('0x35')]=qs[_0x8b4b('0x36')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x36')]);_0x5f213b[_0x8b4b('0x37')]=qs[_0x8b4b('0x2f')](_['pick'](_0x1c1495[_0x8b4b('0x2d')],_0x2a96de[_0x8b4b('0x2f')]),_0x101516);if(_0x1c1495['query'][_0x8b4b('0x38')]){_0x5f213b[_0x8b4b('0x37')]=_[_0x8b4b('0x39')](_0x5f213b[_0x8b4b('0x37')],{'$or':_[_0x8b4b('0x2c')](_0x101516,function(_0x19e0f8){if(_0x19e0f8['type']!==_0x8b4b('0x3a')){var _0x4d62d5={};_0x4d62d5[_0x19e0f8[_0x8b4b('0x25')]]={'$like':'%'+_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x38')]+'%'};return _0x4d62d5;}})});}_0x5f213b=_[_0x8b4b('0x39')]({},_0x5f213b,_0x1c1495['options']);var _0x28c61e={'where':_0x5f213b[_0x8b4b('0x37')]};return db[_0x8b4b('0x27')][_0x8b4b('0x1a')](_0x28c61e)[_0x8b4b('0x22')](function(_0x50d681){_0x3ce646[_0x8b4b('0x1a')]=_0x50d681;if(_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x3b')]){_0x5f213b[_0x8b4b('0x3c')]=[{'all':!![]}];}return db[_0x8b4b('0x27')][_0x8b4b('0x3d')](_0x5f213b);})[_0x8b4b('0x22')](function(_0x1941bb){_0x3ce646[_0x8b4b('0x3e')]=_0x1941bb;return _0x3ce646;})[_0x8b4b('0x22')](respondWithFilteredResult(_0x219974,_0x5f213b))[_0x8b4b('0x3f')](handleError(_0x219974,null));};exports[_0x8b4b('0x40')]=function(_0x2fbce3,_0x5c3e06){var _0x36eeed={'raw':![],'where':{'id':_0x2fbce3[_0x8b4b('0x41')]['id']}},_0x1a4936={};_0x1a4936[_0x8b4b('0x2b')]=_[_0x8b4b('0x2e')](db[_0x8b4b('0x27')][_0x8b4b('0x42')]);_0x1a4936[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x2fbce3[_0x8b4b('0x2d')]);_0x1a4936['filters']=_[_0x8b4b('0x30')](_0x1a4936[_0x8b4b('0x2b')],_0x1a4936[_0x8b4b('0x2d')]);_0x36eeed[_0x8b4b('0x31')]=_['intersection'](_0x1a4936[_0x8b4b('0x2b')],qs['fields'](_0x2fbce3[_0x8b4b('0x2d')]['fields']));_0x36eeed[_0x8b4b('0x31')]=_0x36eeed[_0x8b4b('0x31')]['length']?_0x36eeed['attributes']:_0x1a4936[_0x8b4b('0x2b')];if(_0x2fbce3['query']['includeAll']){_0x36eeed['include']=[{'all':!![]}];}_0x36eeed=_[_0x8b4b('0x39')]({},_0x36eeed,_0x2fbce3['options']);return db[_0x8b4b('0x27')][_0x8b4b('0x43')](_0x36eeed)['then'](handleEntityNotFound(_0x5c3e06,null))['then'](respondWithResult(_0x5c3e06,null))[_0x8b4b('0x3f')](handleError(_0x5c3e06,null));};exports[_0x8b4b('0x44')]=function(_0x3302ec,_0x37b511){return db[_0x8b4b('0x27')]['create'](_0x3302ec['body'],{})[_0x8b4b('0x22')](respondWithResult(_0x37b511,0xc9))[_0x8b4b('0x3f')](handleError(_0x37b511,null));};exports[_0x8b4b('0x45')]=function(_0x36c413,_0x24e6a6){if(_0x36c413[_0x8b4b('0x46')]['id']){delete _0x36c413['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x36c413[_0x8b4b('0x41')]['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x24e6a6,null))[_0x8b4b('0x22')](saveUpdates(_0x36c413[_0x8b4b('0x46')],null))[_0x8b4b('0x22')](respondWithResult(_0x24e6a6,null))[_0x8b4b('0x3f')](handleError(_0x24e6a6,null));};exports['destroy']=function(_0x1aab90,_0x2cd0d8){return db['ServicenowAccount'][_0x8b4b('0x43')]({'where':{'id':_0x1aab90['params']['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x2cd0d8,null))[_0x8b4b('0x22')](removeEntity(_0x2cd0d8,null))[_0x8b4b('0x3f')](handleError(_0x2cd0d8,null));};exports[_0x8b4b('0x47')]=function(_0x2a4301,_0x3260bd,_0x366c16){var _0x4a4ae5={};var _0x34ca26={};var _0x53336b;var _0x10702f;return db[_0x8b4b('0x27')][_0x8b4b('0x48')]({'where':{'id':_0x2a4301[_0x8b4b('0x41')]['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x3260bd,null))['then'](function(_0x4bbfa9){if(_0x4bbfa9){_0x53336b=_0x4bbfa9;_0x34ca26['model']=_[_0x8b4b('0x2e')](db[_0x8b4b('0x49')][_0x8b4b('0x42')]);_0x34ca26[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x2a4301[_0x8b4b('0x2d')]);_0x34ca26[_0x8b4b('0x2f')]=_[_0x8b4b('0x30')](_0x34ca26[_0x8b4b('0x2b')],_0x34ca26[_0x8b4b('0x2d')]);_0x4a4ae5['attributes']=_[_0x8b4b('0x30')](_0x34ca26[_0x8b4b('0x2b')],qs[_0x8b4b('0x32')](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x32')]));_0x4a4ae5['attributes']=_0x4a4ae5['attributes'][_0x8b4b('0x4a')]?_0x4a4ae5['attributes']:_0x34ca26[_0x8b4b('0x2b')];_0x4a4ae5[_0x8b4b('0x35')]=qs[_0x8b4b('0x36')](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x36')]);_0x4a4ae5['where']=qs[_0x8b4b('0x2f')](_[_0x8b4b('0x4b')](_0x2a4301[_0x8b4b('0x2d')],_0x34ca26['filters']));if(_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x38')]){_0x4a4ae5[_0x8b4b('0x37')]=_[_0x8b4b('0x39')](_0x4a4ae5['where'],{'$or':_['map'](_0x4a4ae5['attributes'],function(_0x540801){var _0x3f25a3={};_0x3f25a3[_0x540801]={'$like':'%'+_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x38')]+'%'};return _0x3f25a3;})});}_0x4a4ae5=_[_0x8b4b('0x39')]({},_0x4a4ae5,_0x2a4301['options']);return _0x53336b[_0x8b4b('0x47')](_0x4a4ae5);}})[_0x8b4b('0x22')](function(_0x30eaf9){if(_0x30eaf9){_0x10702f=_0x30eaf9[_0x8b4b('0x4a')];if(!_0x2a4301['query']['hasOwnProperty'](_0x8b4b('0x34'))){_0x4a4ae5['limit']=qs['limit'](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x1b')]);_0x4a4ae5['offset']=qs[_0x8b4b('0x18')](_0x2a4301['query'][_0x8b4b('0x18')]);}return _0x53336b[_0x8b4b('0x47')](_0x4a4ae5);}})[_0x8b4b('0x22')](function(_0x3210af){if(_0x3210af){return _0x3210af?{'count':_0x10702f,'rows':_0x3210af}:null;}})[_0x8b4b('0x22')](respondWithResult(_0x3260bd,null))['catch'](handleError(_0x3260bd,null));};exports[_0x8b4b('0x4c')]=function(_0x36982a,_0x536619,_0x1f5dfd){if(_0x36982a['body']['id']){delete _0x36982a['body']['id'];}return db[_0x8b4b('0x27')][_0x8b4b('0x48')]({'where':{'id':_0x36982a['params']['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x536619,null))['then'](function(_0x21088f){if(_0x21088f){_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x4d')]=_0x21088f['id'];_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x4e')]=integrations[_0x8b4b('0x4f')](_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x50')],_0x36982a['body'][_0x8b4b('0x29')]);_0x36982a['body']['Descriptions']=integrations['getDescriptions'](_0x36982a['body']['channel'],_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x29')]);return db[_0x8b4b('0x49')][_0x8b4b('0x44')](_0x36982a['body'],{'include':[{'model':db['ServicenowField'],'as':_0x8b4b('0x4e')},{'model':db[_0x8b4b('0x51')],'as':_0x8b4b('0x52')}]});}return null;})[_0x8b4b('0x22')](respondWithResult(_0x536619,null))[_0x8b4b('0x3f')](handleError(_0x536619,null));};exports['getFields']=function(_0x12f285,_0x4bb3ee,_0x433d03){var _0x2a186c=[_0x8b4b('0x53'),_0x8b4b('0x54'),_0x8b4b('0x55'),'subcategory',_0x8b4b('0x56'),_0x8b4b('0x57'),'incident_state',_0x8b4b('0x58'),'category'];var _0x314d38=[_0x8b4b('0x59'),'made_sla',_0x8b4b('0x5a'),'watch_list',_0x8b4b('0x5b'),_0x8b4b('0x5c'),_0x8b4b('0x5d'),_0x8b4b('0x54'),_0x8b4b('0x5e'),'number',_0x8b4b('0x5f'),_0x8b4b('0x60'),_0x8b4b('0x61'),'user_input',_0x8b4b('0x62'),_0x8b4b('0x63'),'state',_0x8b4b('0x64'),_0x8b4b('0x55'),_0x8b4b('0x35'),_0x8b4b('0x65'),_0x8b4b('0x66'),_0x8b4b('0x67'),_0x8b4b('0x68'),_0x8b4b('0x69'),_0x8b4b('0x6a'),'work_notes_list',_0x8b4b('0x6b'),'priority',_0x8b4b('0x6c'),_0x8b4b('0x6d'),_0x8b4b('0x6e'),_0x8b4b('0x6f'),_0x8b4b('0x70'),_0x8b4b('0x71'),'group_list',_0x8b4b('0x72'),_0x8b4b('0x73'),'resolved_at',_0x8b4b('0x74'),_0x8b4b('0x75'),_0x8b4b('0x76'),_0x8b4b('0x77'),_0x8b4b('0x78'),_0x8b4b('0x56'),_0x8b4b('0x79'),_0x8b4b('0x7a'),_0x8b4b('0x7b'),_0x8b4b('0x7c'),_0x8b4b('0x7d'),_0x8b4b('0x7e'),_0x8b4b('0x7f'),'calendar_duration','notify',_0x8b4b('0x80'),'close_notes',_0x8b4b('0x81'),_0x8b4b('0x82'),_0x8b4b('0x83'),_0x8b4b('0x84'),_0x8b4b('0x85'),_0x8b4b('0x86'),_0x8b4b('0x87'),_0x8b4b('0x88'),_0x8b4b('0x89'),_0x8b4b('0x8a'),_0x8b4b('0x8b'),_0x8b4b('0x8c'),_0x8b4b('0x8d'),_0x8b4b('0x58'),_0x8b4b('0x8e'),_0x8b4b('0x8f'),'approval','comments_and_work_notes','due_date','sys_mod_count',_0x8b4b('0x90'),_0x8b4b('0x91'),_0x8b4b('0x92'),'upon_approval',_0x8b4b('0x93'),_0x8b4b('0x94'),'category'];var _0x45f41f='';var _0x5a0390='';var _0x24e465=[];var _0x5917f9='';var _0xb1fe2='';var _0x358cda=[];var _0x179260='';var _0xb5bcbf='';var _0x17039b={};var _0x52aa15='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x12f285[_0x8b4b('0x41')]['id']},'attributes':['id',_0x8b4b('0x95'),'password','email',_0x8b4b('0x96'),'serverUrl']})[_0x8b4b('0x22')](handleEntityNotFound(_0x4bb3ee,null))[_0x8b4b('0x22')](function(_0x3e79c8){if(_0x3e79c8){_0x52aa15=_0x3e79c8['remoteUri'];var _0x2a3ba2=_0x52aa15[_0x8b4b('0x97')](-0x1);if(_0x2a3ba2==='/'){_0x52aa15=_0x52aa15['substring'](0x0,_0x52aa15[_0x8b4b('0x98')](_0x2a3ba2));}_0xb5bcbf=util[_0x8b4b('0x99')](_0x8b4b('0x9a'),_0x52aa15);_0x179260=util[_0x8b4b('0x99')]('%s/api/now/table/',_0x52aa15);_0x17039b={'user':_0x3e79c8[_0x8b4b('0x95')],'pass':_0x3e79c8[_0x8b4b('0x9b')]};var _0x4cf137={'method':_0x8b4b('0x9c'),'uri':_0xb5bcbf+_0x8b4b('0x9d'),'auth':_0x17039b,'json':!![]};return rp(_0x4cf137);}})[_0x8b4b('0x22')](function(_0x1e6378){if(_0x1e6378[_0x8b4b('0x9e')][_0x8b4b('0x4a')]>0x0){_0x45f41f=_0x1e6378[_0x8b4b('0x9e')];}console['log'](_0x8b4b('0x9f'),_0x45f41f);_0x358cda=[];_0x5a0390=Object[_0x8b4b('0xa0')]([],_0x45f41f);_[_0x8b4b('0xa1')](_0x5a0390,function(_0x46eaa5){return!_0x2a186c[_0x8b4b('0xa2')](_0x46eaa5[_0x8b4b('0x25')]);});_0x5a0390[_0x8b4b('0xa3')](function(_0x58f97b){var _0xd2c2f5=createFieldObject(_0x179260,_0x17039b,_0x58f97b[_0x8b4b('0xa4')],_0x58f97b[_0x8b4b('0x25')],_0x58f97b[_0x8b4b('0xa5')],![]);_0x358cda['push'](_0xd2c2f5);});return Promise[_0x8b4b('0xa6')](_0x358cda);})['then'](function(_0x4f749d){_0x24e465=_0x4f749d;_0x5917f9=Object[_0x8b4b('0xa0')]([],_0x45f41f);console['log'](_0x8b4b('0xa7'),_0x45f41f);_[_0x8b4b('0xa1')](_0x5917f9,function(_0xc89ddd){return _0x314d38[_0x8b4b('0xa2')](_0xc89ddd['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5917f9);_0x358cda=[];_0x5917f9[_0x8b4b('0xa3')](function(_0x3ad5c8){var _0x165af6=createFieldObject(_0x179260,_0x17039b,_0x3ad5c8[_0x8b4b('0xa4')],_0x3ad5c8[_0x8b4b('0x25')],_0x3ad5c8[_0x8b4b('0xa5')],!![]);_0x358cda[_0x8b4b('0xa8')](_0x165af6);});return Promise[_0x8b4b('0xa6')](_0x358cda);})[_0x8b4b('0x22')](function(_0x239bb7){_0xb1fe2=_0x239bb7;var _0x54234d=_0x24e465[_0x8b4b('0xa9')](_0xb1fe2);return{'count':_0x54234d['length'],'rows':_0x54234d};})[_0x8b4b('0x22')](respondWithResult(_0x4bb3ee,null))[_0x8b4b('0x3f')](function(_0x1c0d95){console['log'](_0x8b4b('0xaa')+_0x1c0d95);var _0x10836a=_0x12f285[_0x8b4b('0x2d')][_0x8b4b('0xab')]?0x1f4:_0x1c0d95[_0x8b4b('0xac')]||0x1f4;logger[_0x8b4b('0x23')](_0x1c0d95[_0x8b4b('0x24')]);delete _0x1c0d95['name'];if(_0x10836a===0x191){_0x10836a=0x190;}_0x4bb3ee['status'](_0x10836a)[_0x8b4b('0xad')](_0x12f285[_0x8b4b('0x2d')][_0x8b4b('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x1c0d95[_0x8b4b('0xac')]}:_0x1c0d95);});};function createFieldObject(_0x24e288,_0x1650e4,_0x519330,_0x22d2e3,_0x4397f0,_0x5103f7){return new Promise(function(_0x4972b9,_0x40b5fc){var _0x31f2f0={'id':_0x22d2e3,'name':_0x4397f0,'custom':_0x5103f7};if(_0x519330==='boolean'){_0x31f2f0[_0x8b4b('0xae')]=[{'name':_0x8b4b('0xaf'),'value':'true'},{'name':_0x8b4b('0xb0'),'value':_0x8b4b('0xb1')}];_0x4972b9(_0x31f2f0);}else{var _0x3586ee={'method':_0x8b4b('0x9c'),'uri':_0x24e288+_0x8b4b('0xb2')+_0x22d2e3,'auth':_0x1650e4,'json':!![]};return rp(_0x3586ee)['then'](function(_0x4ab3ba){var _0x13adea=[];if(_0x4ab3ba['result']['length']>0x0){_0x4ab3ba[_0x8b4b('0x9e')][_0x8b4b('0xa3')](function(_0x35c27a){if(_0x35c27a[_0x8b4b('0xb3')]===_0x8b4b('0xb1')){var _0x3cb5ce={'name':_0x35c27a[_0x8b4b('0xa5')],'value':_0x35c27a['value']};_0x13adea[_0x8b4b('0xa8')](_0x3cb5ce);}});}_0x31f2f0['options']=_0x13adea;if(_0x31f2f0[_0x8b4b('0xae')][_0x8b4b('0x4a')]>0x0){_0x4972b9(_0x31f2f0);}else{if(_0x5103f7==![]){_0x4972b9();}else{_0x4972b9(_0x31f2f0);}}});}});} \ No newline at end of file +var _0x6ea3=['%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','forEach','internalType','label','all','concat','ServiceNow\x20error:\x20','Wrong\x20credentials','statusCode','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','value','push','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','index','ServicenowAccount','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','catch','body','destroy','getConfigurations','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','subcategory','work_notes','close_code','work_start','business_stc','description','close_notes','follow_up','parent_incident','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','correlation_id','location','findOne','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x6ea3,0x17f));var _0x36ea=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x6ea3[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36ea('0x0'));var rp=require(_0x36ea('0x1'));var moment=require(_0x36ea('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x36ea('0x3'));var util=require(_0x36ea('0x4'));var path=require(_0x36ea('0x5'));var sox=require(_0x36ea('0x6'));var csv=require(_0x36ea('0x7'));var ejs=require(_0x36ea('0x8'));var fs=require('fs');var fs_extra=require(_0x36ea('0x9'));var _=require(_0x36ea('0xa'));var squel=require('squel');var crypto=require(_0x36ea('0xb'));var jsforce=require(_0x36ea('0xc'));var deskjs=require(_0x36ea('0xd'));var toCsv=require(_0x36ea('0x7'));var querystring=require(_0x36ea('0xe'));var Papa=require(_0x36ea('0xf'));var Redis=require(_0x36ea('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x36ea('0x11'));var hardwareService=require(_0x36ea('0x12'));var logger=require(_0x36ea('0x13'))(_0x36ea('0x14'));var utils=require(_0x36ea('0x15'));var config=require(_0x36ea('0x16'));var licenseUtil=require(_0x36ea('0x17'));var db=require(_0x36ea('0x18'))['db'];var integrations=require(_0x36ea('0x19'));function respondWithStatusCode(_0x41f465,_0x421503){_0x421503=_0x421503||0xcc;return function(_0x49c85e){if(_0x49c85e){return _0x41f465[_0x36ea('0x1a')](_0x421503);}return _0x41f465[_0x36ea('0x1b')](_0x421503)[_0x36ea('0x1c')]();};}function respondWithResult(_0x3d0548,_0x22a688){_0x22a688=_0x22a688||0xc8;return function(_0x1973a6){if(_0x1973a6){return _0x3d0548[_0x36ea('0x1b')](_0x22a688)[_0x36ea('0x1d')](_0x1973a6);}};}function respondWithFilteredResult(_0x1138ec,_0x40f3be){return function(_0x221d8c){if(_0x221d8c){var _0x56f174=typeof _0x40f3be['offset']===_0x36ea('0x1e')&&typeof _0x40f3be[_0x36ea('0x1f')]===_0x36ea('0x1e');var _0x480c48=_0x221d8c[_0x36ea('0x20')];var _0x5363a6=_0x56f174?0x0:_0x40f3be[_0x36ea('0x21')];var _0x595163=_0x56f174?_0x221d8c['count']:_0x40f3be[_0x36ea('0x21')]+_0x40f3be[_0x36ea('0x1f')];var _0x2a7b17;if(_0x595163>=_0x480c48){_0x595163=_0x480c48;_0x2a7b17=0xc8;}else{_0x2a7b17=0xce;}_0x1138ec['status'](_0x2a7b17);return _0x1138ec[_0x36ea('0x22')](_0x36ea('0x23'),_0x5363a6+'-'+_0x595163+'/'+_0x480c48)[_0x36ea('0x1d')](_0x221d8c);}return null;};}function patchUpdates(_0x5695f0){return function(_0x2e551c){try{jsonpatch['apply'](_0x2e551c,_0x5695f0,!![]);}catch(_0x47e8ca){return BPromise[_0x36ea('0x24')](_0x47e8ca);}return _0x2e551c['save']();};}function saveUpdates(_0x1390c6,_0x40cb44){return function(_0x5ed89c){if(_0x5ed89c){return _0x5ed89c[_0x36ea('0x25')](_0x1390c6)[_0x36ea('0x26')](function(_0x2bac03){return _0x2bac03;});}return null;};}function removeEntity(_0x48afbf,_0x4ff060){return function(_0x4367c1){if(_0x4367c1){return _0x4367c1['destroy']()[_0x36ea('0x26')](function(){_0x48afbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f8c0,_0x11a1c2){return function(_0x2a1926){if(!_0x2a1926){_0x44f8c0['sendStatus'](0x194);}return _0x2a1926;};}function handleError(_0x189467,_0x5e36fd){_0x5e36fd=_0x5e36fd||0x1f4;return function(_0x224a1c){logger[_0x36ea('0x27')](_0x224a1c[_0x36ea('0x28')]);if(_0x224a1c['name']){delete _0x224a1c[_0x36ea('0x29')];}_0x189467[_0x36ea('0x1b')](_0x5e36fd)[_0x36ea('0x2a')](_0x224a1c);};}exports[_0x36ea('0x2b')]=function(_0x71fb11,_0x2099bb){var _0x2be951={},_0x4a1590={},_0x2882a4={'count':0x0,'rows':[]};var _0x5d8f3c=_['map'](db[_0x36ea('0x2c')]['rawAttributes'],function(_0x2dfb9f){return{'name':_0x2dfb9f[_0x36ea('0x2d')],'type':_0x2dfb9f['type']['key']};});_0x4a1590[_0x36ea('0x2e')]=_[_0x36ea('0x2f')](_0x5d8f3c,_0x36ea('0x29'));_0x4a1590[_0x36ea('0x30')]=_[_0x36ea('0x31')](_0x71fb11['query']);_0x4a1590[_0x36ea('0x32')]=_[_0x36ea('0x33')](_0x4a1590['model'],_0x4a1590[_0x36ea('0x30')]);_0x2be951[_0x36ea('0x34')]=_[_0x36ea('0x33')](_0x4a1590[_0x36ea('0x2e')],qs[_0x36ea('0x35')](_0x71fb11[_0x36ea('0x30')][_0x36ea('0x35')]));_0x2be951[_0x36ea('0x34')]=_0x2be951[_0x36ea('0x34')][_0x36ea('0x36')]?_0x2be951[_0x36ea('0x34')]:_0x4a1590[_0x36ea('0x2e')];if(!_0x71fb11[_0x36ea('0x30')][_0x36ea('0x37')](_0x36ea('0x38'))){_0x2be951[_0x36ea('0x1f')]=qs[_0x36ea('0x1f')](_0x71fb11['query'][_0x36ea('0x1f')]);_0x2be951['offset']=qs[_0x36ea('0x21')](_0x71fb11[_0x36ea('0x30')][_0x36ea('0x21')]);}_0x2be951[_0x36ea('0x39')]=qs['sort'](_0x71fb11[_0x36ea('0x30')][_0x36ea('0x3a')]);_0x2be951[_0x36ea('0x3b')]=qs[_0x36ea('0x32')](_['pick'](_0x71fb11[_0x36ea('0x30')],_0x4a1590[_0x36ea('0x32')]),_0x5d8f3c);if(_0x71fb11['query'][_0x36ea('0x3c')]){_0x2be951[_0x36ea('0x3b')]=_[_0x36ea('0x3d')](_0x2be951['where'],{'$or':_['map'](_0x5d8f3c,function(_0xff13f8){if(_0xff13f8[_0x36ea('0x3e')]!==_0x36ea('0x3f')){var _0x2d6e4c={};_0x2d6e4c[_0xff13f8[_0x36ea('0x29')]]={'$like':'%'+_0x71fb11[_0x36ea('0x30')][_0x36ea('0x3c')]+'%'};return _0x2d6e4c;}})});}_0x2be951=_[_0x36ea('0x3d')]({},_0x2be951,_0x71fb11[_0x36ea('0x40')]);var _0x35fae7={'where':_0x2be951[_0x36ea('0x3b')]};return db[_0x36ea('0x2c')][_0x36ea('0x20')](_0x35fae7)['then'](function(_0x3b7e26){_0x2882a4[_0x36ea('0x20')]=_0x3b7e26;if(_0x71fb11[_0x36ea('0x30')][_0x36ea('0x41')]){_0x2be951[_0x36ea('0x42')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x36ea('0x43')](_0x2be951);})[_0x36ea('0x26')](function(_0x3f80e0){_0x2882a4[_0x36ea('0x44')]=_0x3f80e0;return _0x2882a4;})[_0x36ea('0x26')](respondWithFilteredResult(_0x2099bb,_0x2be951))['catch'](handleError(_0x2099bb,null));};exports[_0x36ea('0x45')]=function(_0x51784b,_0x2224a3){var _0x5e000e={'raw':![],'where':{'id':_0x51784b[_0x36ea('0x46')]['id']}},_0x37a7a1={};_0x37a7a1[_0x36ea('0x2e')]=_['keys'](db[_0x36ea('0x2c')][_0x36ea('0x47')]);_0x37a7a1[_0x36ea('0x30')]=_[_0x36ea('0x31')](_0x51784b[_0x36ea('0x30')]);_0x37a7a1[_0x36ea('0x32')]=_[_0x36ea('0x33')](_0x37a7a1[_0x36ea('0x2e')],_0x37a7a1[_0x36ea('0x30')]);_0x5e000e[_0x36ea('0x34')]=_[_0x36ea('0x33')](_0x37a7a1['model'],qs[_0x36ea('0x35')](_0x51784b[_0x36ea('0x30')]['fields']));_0x5e000e['attributes']=_0x5e000e[_0x36ea('0x34')][_0x36ea('0x36')]?_0x5e000e[_0x36ea('0x34')]:_0x37a7a1[_0x36ea('0x2e')];if(_0x51784b['query'][_0x36ea('0x41')]){_0x5e000e['include']=[{'all':!![]}];}_0x5e000e=_[_0x36ea('0x3d')]({},_0x5e000e,_0x51784b['options']);return db[_0x36ea('0x2c')][_0x36ea('0x48')](_0x5e000e)[_0x36ea('0x26')](handleEntityNotFound(_0x2224a3,null))[_0x36ea('0x26')](respondWithResult(_0x2224a3,null))['catch'](handleError(_0x2224a3,null));};exports[_0x36ea('0x49')]=function(_0x400e63,_0x13eab7){return db[_0x36ea('0x2c')][_0x36ea('0x49')](_0x400e63['body'],{})[_0x36ea('0x26')](respondWithResult(_0x13eab7,0xc9))[_0x36ea('0x4a')](handleError(_0x13eab7,null));};exports[_0x36ea('0x25')]=function(_0x4d7d8b,_0x19f559){if(_0x4d7d8b[_0x36ea('0x4b')]['id']){delete _0x4d7d8b[_0x36ea('0x4b')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x4d7d8b[_0x36ea('0x46')]['id']}})[_0x36ea('0x26')](handleEntityNotFound(_0x19f559,null))['then'](saveUpdates(_0x4d7d8b[_0x36ea('0x4b')],null))['then'](respondWithResult(_0x19f559,null))[_0x36ea('0x4a')](handleError(_0x19f559,null));};exports[_0x36ea('0x4c')]=function(_0x2625ec,_0x20b719){return db['ServicenowAccount'][_0x36ea('0x48')]({'where':{'id':_0x2625ec['params']['id']}})[_0x36ea('0x26')](handleEntityNotFound(_0x20b719,null))[_0x36ea('0x26')](removeEntity(_0x20b719,null))['catch'](handleError(_0x20b719,null));};exports[_0x36ea('0x4d')]=function(_0x5b9bb4,_0xf3b9e1,_0x46daf1){var _0x1c8a63={};var _0x5a45f5={};var _0x261db4;var _0x2d9719;return db[_0x36ea('0x2c')]['findOne']({'where':{'id':_0x5b9bb4[_0x36ea('0x46')]['id']}})['then'](handleEntityNotFound(_0xf3b9e1,null))['then'](function(_0x1f017e){if(_0x1f017e){_0x261db4=_0x1f017e;_0x5a45f5[_0x36ea('0x2e')]=_[_0x36ea('0x31')](db[_0x36ea('0x4e')]['rawAttributes']);_0x5a45f5[_0x36ea('0x30')]=_['keys'](_0x5b9bb4['query']);_0x5a45f5[_0x36ea('0x32')]=_[_0x36ea('0x33')](_0x5a45f5[_0x36ea('0x2e')],_0x5a45f5['query']);_0x1c8a63['attributes']=_['intersection'](_0x5a45f5[_0x36ea('0x2e')],qs[_0x36ea('0x35')](_0x5b9bb4[_0x36ea('0x30')][_0x36ea('0x35')]));_0x1c8a63[_0x36ea('0x34')]=_0x1c8a63['attributes'][_0x36ea('0x36')]?_0x1c8a63[_0x36ea('0x34')]:_0x5a45f5[_0x36ea('0x2e')];_0x1c8a63[_0x36ea('0x39')]=qs[_0x36ea('0x3a')](_0x5b9bb4[_0x36ea('0x30')]['sort']);_0x1c8a63[_0x36ea('0x3b')]=qs[_0x36ea('0x32')](_['pick'](_0x5b9bb4['query'],_0x5a45f5[_0x36ea('0x32')]));if(_0x5b9bb4[_0x36ea('0x30')][_0x36ea('0x3c')]){_0x1c8a63[_0x36ea('0x3b')]=_[_0x36ea('0x3d')](_0x1c8a63[_0x36ea('0x3b')],{'$or':_[_0x36ea('0x2f')](_0x1c8a63['attributes'],function(_0x21f065){var _0x384257={};_0x384257[_0x21f065]={'$like':'%'+_0x5b9bb4[_0x36ea('0x30')][_0x36ea('0x3c')]+'%'};return _0x384257;})});}_0x1c8a63=_[_0x36ea('0x3d')]({},_0x1c8a63,_0x5b9bb4[_0x36ea('0x40')]);return _0x261db4['getConfigurations'](_0x1c8a63);}})[_0x36ea('0x26')](function(_0x476ff2){if(_0x476ff2){_0x2d9719=_0x476ff2[_0x36ea('0x36')];if(!_0x5b9bb4[_0x36ea('0x30')][_0x36ea('0x37')](_0x36ea('0x38'))){_0x1c8a63[_0x36ea('0x1f')]=qs['limit'](_0x5b9bb4[_0x36ea('0x30')][_0x36ea('0x1f')]);_0x1c8a63[_0x36ea('0x21')]=qs[_0x36ea('0x21')](_0x5b9bb4[_0x36ea('0x30')]['offset']);}return _0x261db4[_0x36ea('0x4d')](_0x1c8a63);}})[_0x36ea('0x26')](function(_0x515319){if(_0x515319){return _0x515319?{'count':_0x2d9719,'rows':_0x515319}:null;}})['then'](respondWithResult(_0xf3b9e1,null))[_0x36ea('0x4a')](handleError(_0xf3b9e1,null));};exports[_0x36ea('0x4f')]=function(_0x234207,_0x2f4e40,_0x5e45b8){if(_0x234207[_0x36ea('0x4b')]['id']){delete _0x234207[_0x36ea('0x4b')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x234207[_0x36ea('0x46')]['id']}})[_0x36ea('0x26')](handleEntityNotFound(_0x2f4e40,null))[_0x36ea('0x26')](function(_0x5219ad){if(_0x5219ad){_0x234207[_0x36ea('0x4b')][_0x36ea('0x50')]=_0x5219ad['id'];_0x234207[_0x36ea('0x4b')]['Subjects']=integrations[_0x36ea('0x51')](_0x234207['body'][_0x36ea('0x52')],_0x234207[_0x36ea('0x4b')][_0x36ea('0x3e')]);_0x234207['body'][_0x36ea('0x53')]=integrations[_0x36ea('0x54')](_0x234207[_0x36ea('0x4b')][_0x36ea('0x52')],_0x234207[_0x36ea('0x4b')][_0x36ea('0x3e')]);return db['ServicenowConfiguration'][_0x36ea('0x49')](_0x234207[_0x36ea('0x4b')],{'include':[{'model':db['ServicenowField'],'as':_0x36ea('0x55')},{'model':db[_0x36ea('0x56')],'as':_0x36ea('0x53')}]});}return null;})[_0x36ea('0x26')](respondWithResult(_0x2f4e40,null))[_0x36ea('0x4a')](handleError(_0x2f4e40,null));};exports[_0x36ea('0x57')]=function(_0x3f85d7,_0x4a2f45,_0x17eba5){var _0x5ec4ad=[_0x36ea('0x58'),_0x36ea('0x59'),_0x36ea('0x5a'),'subcategory','close_code',_0x36ea('0x5b'),_0x36ea('0x5c'),_0x36ea('0x5d'),_0x36ea('0x5e')];var _0x321064=[_0x36ea('0x5f'),_0x36ea('0x58'),_0x36ea('0x60'),_0x36ea('0x61'),'upon_reject',_0x36ea('0x62'),_0x36ea('0x63'),'hold_reason',_0x36ea('0x64'),_0x36ea('0x65'),_0x36ea('0x66'),_0x36ea('0x67'),_0x36ea('0x68'),_0x36ea('0x69'),'sys_created_on',_0x36ea('0x6a'),_0x36ea('0x6b'),_0x36ea('0x6c'),'knowledge',_0x36ea('0x39'),_0x36ea('0x6d'),_0x36ea('0x6e'),_0x36ea('0x6f'),'delivery_plan',_0x36ea('0x70'),_0x36ea('0x71'),'work_notes_list',_0x36ea('0x72'),_0x36ea('0x73'),_0x36ea('0x74'),_0x36ea('0x75'),_0x36ea('0x76'),'expected_start','opened_at',_0x36ea('0x77'),_0x36ea('0x78'),_0x36ea('0x79'),'reopened_time',_0x36ea('0x7a'),_0x36ea('0x7b'),_0x36ea('0x7c'),_0x36ea('0x7d'),_0x36ea('0x7e'),'short_description',_0x36ea('0x7f'),'correlation_display','delivery_task',_0x36ea('0x80'),'assignment_group',_0x36ea('0x81'),'additional_assignee_list',_0x36ea('0x82'),'calendar_duration',_0x36ea('0x5b'),'sys_class_name',_0x36ea('0x83'),'closed_by',_0x36ea('0x84'),_0x36ea('0x85'),'sys_id',_0x36ea('0x86'),_0x36ea('0x87'),'incident_state','urgency',_0x36ea('0x88'),_0x36ea('0x89'),_0x36ea('0x8a'),_0x36ea('0x8b'),_0x36ea('0x8c'),_0x36ea('0x5d'),_0x36ea('0x8d'),_0x36ea('0x8e'),_0x36ea('0x8f'),_0x36ea('0x90'),'due_date','sys_mod_count',_0x36ea('0x91'),_0x36ea('0x92'),_0x36ea('0x93'),'upon_approval',_0x36ea('0x94'),_0x36ea('0x95'),_0x36ea('0x5e')];var _0x540176='';var _0x209f92='';var _0xb79382=[];var _0x24e036='';var _0x32aaef='';var _0x2d4dce=[];var _0x19bb85='';var _0xc86a3d='';var _0x279177={};var _0x32c4e0='';return db[_0x36ea('0x2c')][_0x36ea('0x96')]({'where':{'id':_0x3f85d7[_0x36ea('0x46')]['id']},'attributes':['id',_0x36ea('0x97'),_0x36ea('0x98'),_0x36ea('0x99'),_0x36ea('0x9a'),_0x36ea('0x9b')]})[_0x36ea('0x26')](handleEntityNotFound(_0x4a2f45,null))[_0x36ea('0x26')](function(_0x3f4c08){if(_0x3f4c08){_0x32c4e0=_0x3f4c08[_0x36ea('0x9a')];var _0x2eb589=_0x32c4e0['slice'](-0x1);if(_0x2eb589==='/'){_0x32c4e0=_0x32c4e0[_0x36ea('0x9c')](0x0,_0x32c4e0[_0x36ea('0x9d')](_0x2eb589));}_0xc86a3d=util[_0x36ea('0x9e')](_0x36ea('0x9f'),_0x32c4e0);_0x19bb85=util[_0x36ea('0x9e')](_0x36ea('0xa0'),_0x32c4e0);_0x279177={'user':_0x3f4c08[_0x36ea('0x97')],'pass':_0x3f4c08[_0x36ea('0x98')]};var _0x11d6c8={'method':_0x36ea('0xa1'),'uri':_0xc86a3d+_0x36ea('0xa2'),'auth':_0x279177,'json':!![]};return rp(_0x11d6c8);}})[_0x36ea('0x26')](function(_0x1c1f2f){if(_0x1c1f2f[_0x36ea('0xa3')]['length']>0x0){_0x540176=_0x1c1f2f[_0x36ea('0xa3')];}console[_0x36ea('0xa4')]('incident\x20table\x20objects',_0x540176);_0x2d4dce=[];_0x209f92=Object[_0x36ea('0xa5')]([],_0x540176);_[_0x36ea('0xa6')](_0x209f92,function(_0x32fa4a){return!_0x5ec4ad['includes'](_0x32fa4a[_0x36ea('0x29')]);});_0x209f92[_0x36ea('0xa7')](function(_0x2c08dc){var _0x2f6e8b=createFieldObject(_0x19bb85,_0x279177,_0x2c08dc[_0x36ea('0xa8')],_0x2c08dc[_0x36ea('0x29')],_0x2c08dc[_0x36ea('0xa9')],![]);_0x2d4dce['push'](_0x2f6e8b);});return Promise['all'](_0x2d4dce);})[_0x36ea('0x26')](function(_0x3b18b9){_0xb79382=_0x3b18b9;_0x24e036=Object[_0x36ea('0xa5')]([],_0x540176);console['log']('TCL:\x20_object',_0x540176);_[_0x36ea('0xa6')](_0x24e036,function(_0x10cf78){return _0x321064['includes'](_0x10cf78['name']);});console[_0x36ea('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x24e036);_0x2d4dce=[];_0x24e036[_0x36ea('0xa7')](function(_0x3fed71){var _0x1d4279=createFieldObject(_0x19bb85,_0x279177,_0x3fed71[_0x36ea('0xa8')],_0x3fed71[_0x36ea('0x29')],_0x3fed71['label'],!![]);_0x2d4dce['push'](_0x1d4279);});return Promise[_0x36ea('0xaa')](_0x2d4dce);})[_0x36ea('0x26')](function(_0x1bf0b1){_0x32aaef=_0x1bf0b1;var _0x41fdb6=_0xb79382[_0x36ea('0xab')](_0x32aaef);return{'count':_0x41fdb6['length'],'rows':_0x41fdb6};})[_0x36ea('0x26')](respondWithResult(_0x4a2f45,null))[_0x36ea('0x4a')](function(_0x112ab5){console['log'](_0x36ea('0xac')+_0x112ab5);var _0x44584c=_0x3f85d7[_0x36ea('0x30')]['test']?0x1f4:_0x112ab5['statusCode']||0x1f4;logger[_0x36ea('0x27')](_0x112ab5[_0x36ea('0x28')]);delete _0x112ab5[_0x36ea('0x29')];if(_0x44584c===0x191){_0x44584c=0x190;}_0x4a2f45[_0x36ea('0x1b')](_0x44584c)[_0x36ea('0x2a')](_0x3f85d7[_0x36ea('0x30')]['test']?{'message':_0x36ea('0xad'),'statusCode':_0x112ab5[_0x36ea('0xae')]}:_0x112ab5);});};function createFieldObject(_0x4cc9a0,_0x542eb7,_0x3f9bb1,_0x11e2e4,_0x4bfc8e,_0x1b5401){return new Promise(function(_0x55fab5,_0x87f821){var _0x4d4876={'id':_0x11e2e4,'name':_0x4bfc8e,'custom':_0x1b5401};if(_0x3f9bb1===_0x36ea('0xaf')){_0x4d4876[_0x36ea('0x40')]=[{'name':'True','value':_0x36ea('0xb0')},{'name':_0x36ea('0xb1'),'value':'false'}];_0x55fab5(_0x4d4876);}else{var _0x2c1603={'method':'GET','uri':_0x4cc9a0+_0x36ea('0xb2')+_0x11e2e4,'auth':_0x542eb7,'json':!![]};return rp(_0x2c1603)[_0x36ea('0x26')](function(_0x8f8e8a){var _0x6d1944=[];if(_0x8f8e8a['result'][_0x36ea('0x36')]>0x0){_0x8f8e8a[_0x36ea('0xa3')][_0x36ea('0xa7')](function(_0x9a15a6){if(_0x9a15a6['inactive']==='false'){var _0x3d5186={'name':_0x9a15a6[_0x36ea('0xa9')],'value':_0x9a15a6[_0x36ea('0xb3')]};_0x6d1944[_0x36ea('0xb4')](_0x3d5186);}});}_0x4d4876['options']=_0x6d1944;if(_0x4d4876[_0x36ea('0x40')]['length']>0x0){_0x55fab5(_0x4d4876);}else{if(_0x1b5401==![]){_0x55fab5();}else{_0x55fab5(_0x4d4876);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c71501a..d8da9d4 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x598934,_0x145b5d){var _0x14e442=function(_0x320c14){while(--_0x320c14){_0x598934['push'](_0x598934['shift']());}};_0x14e442(++_0x145b5d);}(_0x4819,0xcd));var _0x9481=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0x4819[_0x3f99a8];return _0x25c907;};'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 +var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','util'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x6f47,0xc7));var _0x76f4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6f47[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));var integrations=require(_0x76f4('0x7'));module['exports']=function(_0x35602f,_0xfc2405){return _0x35602f[_0x76f4('0x8')]('ServicenowAccount',attributes,{'tableName':_0x76f4('0x9'),'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 94c6c7b..2df1301 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 _0xfa33=['include','model','info','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','map'];(function(_0x4351ef,_0x178920){var _0x41a551=function(_0x337381){while(--_0x337381){_0x4351ef['push'](_0x4351ef['shift']());}};_0x41a551(++_0x178920);}(_0xfa33,0x1d3));var _0x3fa3=function(_0x1da46b,_0x109ac4){_0x1da46b=_0x1da46b-0x0;var _0x3a94ef=_0xfa33[_0x1da46b];return _0x3a94ef;};'use strict';var _=require(_0x3fa3('0x0'));var util=require(_0x3fa3('0x1'));var moment=require(_0x3fa3('0x2'));var BPromise=require(_0x3fa3('0x3'));var rs=require(_0x3fa3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fa3('0x5'))['db'];var utils=require(_0x3fa3('0x6'));var logger=require(_0x3fa3('0x7'))('rpc');var config=require(_0x3fa3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fa3('0x9')][_0x3fa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b70d,_0x1babda,_0x1269b5){return new BPromise(function(_0x335aea,_0x3c431e){return client['request'](_0x50b70d,_0x1269b5)[_0x3fa3('0xb')](function(_0x198f6e){logger['info'](_0x3fa3('0xc'),_0x1babda,_0x3fa3('0xd'));logger[_0x3fa3('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1babda,_0x3fa3('0xd'),JSON[_0x3fa3('0xf')](_0x198f6e));if(_0x198f6e[_0x3fa3('0x10')]){if(_0x198f6e[_0x3fa3('0x10')]['code']===0x1f4){logger[_0x3fa3('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x1babda,_0x198f6e[_0x3fa3('0x10')][_0x3fa3('0x11')]);return _0x3c431e(_0x198f6e['error']['message']);}logger['error'](_0x3fa3('0xc'),_0x1babda,_0x198f6e['error']['message']);return _0x335aea(_0x198f6e[_0x3fa3('0x10')]['message']);}else{logger['info'](_0x3fa3('0xc'),_0x1babda,_0x3fa3('0xd'));_0x335aea(_0x198f6e[_0x3fa3('0x12')][_0x3fa3('0x11')]);}})[_0x3fa3('0x13')](function(_0xddb607){logger['error'](_0x3fa3('0xc'),_0x1babda,_0xddb607);_0x3c431e(_0xddb607);});});}exports[_0x3fa3('0x14')]=function(_0x59eb94){var _0x1a0772=this;return new Promise(function(_0x49408f,_0x3c5aef){return db[_0x3fa3('0x15')]['findAll']({'raw':_0x59eb94['options']?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x17')]===undefined?!![]:![]:!![],'where':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94['options'][_0x3fa3('0x18')]||null:null,'attributes':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x19')]||null:null,'limit':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x1a')]||null:null,'include':_0x59eb94['options']?_0x59eb94['options']['include']?_[_0x3fa3('0x1b')](_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x1c')],function(_0x3a17a3){return{'model':db[_0x3a17a3[_0x3fa3('0x1d')]],'as':_0x3a17a3['as'],'attributes':_0x3a17a3['attributes'],'include':_0x3a17a3[_0x3fa3('0x1c')]?_['map'](_0x3a17a3[_0x3fa3('0x1c')],function(_0x5c4826){return{'model':db[_0x5c4826[_0x3fa3('0x1d')]],'as':_0x5c4826['as'],'attributes':_0x5c4826['attributes'],'include':_0x5c4826[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x5c4826[_0x3fa3('0x1c')],function(_0x5b208f){return{'model':db[_0x5b208f[_0x3fa3('0x1d')]],'as':_0x5b208f['as'],'attributes':_0x5b208f[_0x3fa3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fa3('0xb')](function(_0x46cad2){logger[_0x3fa3('0x1e')](_0x3fa3('0x14'),_0x59eb94);logger[_0x3fa3('0xe')](_0x3fa3('0x14'),_0x59eb94,JSON[_0x3fa3('0xf')](_0x46cad2));_0x49408f(_0x46cad2);})['catch'](function(_0x322ff1){logger['error']('GetServicenowAccount',_0x322ff1['message'],_0x59eb94);_0x3c5aef(_0x1a0772[_0x3fa3('0x10')](0x1f4,_0x322ff1['message']));});});};exports[_0x3fa3('0x1f')]=function(_0x51aef5){var _0xd4884f=this;return new Promise(function(_0x437081,_0xf74ca2){return db[_0x3fa3('0x15')][_0x3fa3('0x20')]({'raw':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x17')]===undefined?!![]:![]:!![],'where':_0x51aef5['options']?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x18')]||null:null,'attributes':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5['options'][_0x3fa3('0x19')]||null:null,'include':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x51aef5['options']['include'],function(_0x3faf47){return{'model':db[_0x3faf47[_0x3fa3('0x1d')]],'as':_0x3faf47['as'],'attributes':_0x3faf47[_0x3fa3('0x19')],'include':_0x3faf47[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x3faf47[_0x3fa3('0x1c')],function(_0x43a477){return{'model':db[_0x43a477['model']],'as':_0x43a477['as'],'attributes':_0x43a477[_0x3fa3('0x19')],'include':_0x43a477[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x43a477[_0x3fa3('0x1c')],function(_0x97d60c){return{'model':db[_0x97d60c[_0x3fa3('0x1d')]],'as':_0x97d60c['as'],'attributes':_0x97d60c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fa3('0xb')](function(_0x25ed19){logger[_0x3fa3('0x1e')](_0x3fa3('0x1f'),_0x51aef5);logger[_0x3fa3('0xe')]('ShowServicenowAccount',_0x51aef5,JSON[_0x3fa3('0xf')](_0x25ed19));_0x437081(_0x25ed19);})[_0x3fa3('0x13')](function(_0x465113){logger['error'](_0x3fa3('0x1f'),_0x465113[_0x3fa3('0x11')],_0x51aef5);_0xf74ca2(_0xd4884f[_0x3fa3('0x10')](0x1f4,_0x465113['message']));});});}; \ No newline at end of file +var _0x2893=['info','debug','ShowServicenowAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','attributes','map','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2893,0x1f2));var _0x3289=function(_0x19b351,_0x547358){_0x19b351=_0x19b351-0x0;var _0x104803=_0x2893[_0x19b351];return _0x104803;};'use strict';var _=require(_0x3289('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3289('0x1'));var rs=require(_0x3289('0x2'));var fs=require('fs');var Redis=require(_0x3289('0x3'));var db=require(_0x3289('0x4'))['db'];var utils=require(_0x3289('0x5'));var logger=require(_0x3289('0x6'))(_0x3289('0x7'));var config=require(_0x3289('0x8'));var jayson=require(_0x3289('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30edf1,_0x4d2edf,_0x3c9d87){return new BPromise(function(_0x270d29,_0x77fae4){return client[_0x3289('0xa')](_0x30edf1,_0x3c9d87)[_0x3289('0xb')](function(_0x47f84b){logger['info'](_0x3289('0xc'),_0x4d2edf,'request\x20sent');logger['debug'](_0x3289('0xd'),_0x4d2edf,_0x3289('0xe'),JSON[_0x3289('0xf')](_0x47f84b));if(_0x47f84b[_0x3289('0x10')]){if(_0x47f84b[_0x3289('0x10')]['code']===0x1f4){logger[_0x3289('0x10')](_0x3289('0xc'),_0x4d2edf,_0x47f84b['error'][_0x3289('0x11')]);return _0x77fae4(_0x47f84b[_0x3289('0x10')][_0x3289('0x11')]);}logger['error'](_0x3289('0xc'),_0x4d2edf,_0x47f84b['error'][_0x3289('0x11')]);return _0x270d29(_0x47f84b[_0x3289('0x10')]['message']);}else{logger['info'](_0x3289('0xc'),_0x4d2edf,_0x3289('0xe'));_0x270d29(_0x47f84b[_0x3289('0x12')][_0x3289('0x11')]);}})[_0x3289('0x13')](function(_0x4b0b90){logger[_0x3289('0x10')](_0x3289('0xc'),_0x4d2edf,_0x4b0b90);_0x77fae4(_0x4b0b90);});});}exports[_0x3289('0x14')]=function(_0x25e685){var _0x51ca28=this;return new Promise(function(_0x45b363,_0xc9aaa5){return db[_0x3289('0x15')]['findAll']({'raw':_0x25e685['options']?_0x25e685[_0x3289('0x16')][_0x3289('0x17')]===undefined?!![]:![]:!![],'where':_0x25e685[_0x3289('0x16')]?_0x25e685[_0x3289('0x16')][_0x3289('0x18')]||null:null,'attributes':_0x25e685['options']?_0x25e685[_0x3289('0x16')]['attributes']||null:null,'limit':_0x25e685[_0x3289('0x16')]?_0x25e685[_0x3289('0x16')][_0x3289('0x19')]||null:null,'include':_0x25e685[_0x3289('0x16')]?_0x25e685[_0x3289('0x16')]['include']?_['map'](_0x25e685[_0x3289('0x16')][_0x3289('0x1a')],function(_0x5ac105){return{'model':db[_0x5ac105['model']],'as':_0x5ac105['as'],'attributes':_0x5ac105[_0x3289('0x1b')],'include':_0x5ac105[_0x3289('0x1a')]?_[_0x3289('0x1c')](_0x5ac105[_0x3289('0x1a')],function(_0x16452a){return{'model':db[_0x16452a[_0x3289('0x1d')]],'as':_0x16452a['as'],'attributes':_0x16452a[_0x3289('0x1b')],'include':_0x16452a[_0x3289('0x1a')]?_[_0x3289('0x1c')](_0x16452a[_0x3289('0x1a')],function(_0x151367){return{'model':db[_0x151367[_0x3289('0x1d')]],'as':_0x151367['as'],'attributes':_0x151367[_0x3289('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18afc1){logger[_0x3289('0x1e')](_0x3289('0x14'),_0x25e685);logger[_0x3289('0x1f')]('GetServicenowAccount',_0x25e685,JSON[_0x3289('0xf')](_0x18afc1));_0x45b363(_0x18afc1);})['catch'](function(_0x4a7ffb){logger[_0x3289('0x10')](_0x3289('0x14'),_0x4a7ffb['message'],_0x25e685);_0xc9aaa5(_0x51ca28[_0x3289('0x10')](0x1f4,_0x4a7ffb['message']));});});};exports[_0x3289('0x20')]=function(_0x45a9fe){var _0x8f4822=this;return new Promise(function(_0x1a8cc4,_0x3a5f73){return db['ServicenowAccount']['find']({'raw':_0x45a9fe['options']?_0x45a9fe[_0x3289('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x45a9fe[_0x3289('0x16')]?_0x45a9fe[_0x3289('0x16')][_0x3289('0x18')]||null:null,'attributes':_0x45a9fe[_0x3289('0x16')]?_0x45a9fe[_0x3289('0x16')][_0x3289('0x1b')]||null:null,'include':_0x45a9fe['options']?_0x45a9fe[_0x3289('0x16')][_0x3289('0x1a')]?_[_0x3289('0x1c')](_0x45a9fe['options'][_0x3289('0x1a')],function(_0xd7ca75){return{'model':db[_0xd7ca75['model']],'as':_0xd7ca75['as'],'attributes':_0xd7ca75[_0x3289('0x1b')],'include':_0xd7ca75[_0x3289('0x1a')]?_[_0x3289('0x1c')](_0xd7ca75[_0x3289('0x1a')],function(_0x128048){return{'model':db[_0x128048['model']],'as':_0x128048['as'],'attributes':_0x128048[_0x3289('0x1b')],'include':_0x128048[_0x3289('0x1a')]?_[_0x3289('0x1c')](_0x128048[_0x3289('0x1a')],function(_0x4634a3){return{'model':db[_0x4634a3['model']],'as':_0x4634a3['as'],'attributes':_0x4634a3[_0x3289('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3289('0xb')](function(_0x1538ab){logger['info'](_0x3289('0x20'),_0x45a9fe);logger[_0x3289('0x1f')](_0x3289('0x20'),_0x45a9fe,JSON[_0x3289('0xf')](_0x1538ab));_0x1a8cc4(_0x1538ab);})[_0x3289('0x13')](function(_0x29609f){logger[_0x3289('0x10')]('ShowServicenowAccount',_0x29609f[_0x3289('0x11')],_0x45a9fe);_0x3a5f73(_0x8f4822['error'](0x1f4,_0x29609f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3143131..20a277a 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 _0x1b02=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x34ebd3,_0x613554){var _0x219c7e=function(_0x40a982){while(--_0x40a982){_0x34ebd3['push'](_0x34ebd3['shift']());}};_0x219c7e(++_0x613554);}(_0x1b02,0x151));var _0x21b0=function(_0x31cc6e,_0x4da430){_0x31cc6e=_0x31cc6e-0x0;var _0x39a234=_0x1b02[_0x31cc6e];return _0x39a234;};'use strict';var multer=require(_0x21b0('0x0'));var util=require(_0x21b0('0x1'));var path=require('path');var timeout=require(_0x21b0('0x2'));var express=require(_0x21b0('0x3'));var router=express['Router']();var fs_extra=require(_0x21b0('0x4'));var auth=require(_0x21b0('0x5'));var interaction=require(_0x21b0('0x6'));var config=require(_0x21b0('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x21b0('0x8')]('/',auth[_0x21b0('0x9')](),controller['index']);router[_0x21b0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x21b0('0xa')]);router[_0x21b0('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x21b0('0xb')]);router['get']('/:id/subjects',auth[_0x21b0('0x9')](),controller['getSubjects']);router[_0x21b0('0x8')](_0x21b0('0xc'),auth['isAuthenticated'](),controller[_0x21b0('0xd')]);router[_0x21b0('0xe')]('/',auth[_0x21b0('0x9')](),controller[_0x21b0('0xf')]);router[_0x21b0('0x10')](_0x21b0('0x11'),auth[_0x21b0('0x9')](),controller[_0x21b0('0x12')]);router[_0x21b0('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x21b0('0x14')]);module[_0x21b0('0x15')]=router; \ No newline at end of file +var _0x2528=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1e3ec1,_0x5388ea){var _0x2eb03a=function(_0x387840){while(--_0x387840){_0x1e3ec1['push'](_0x1e3ec1['shift']());}};_0x2eb03a(++_0x5388ea);}(_0x2528,0xe5));var _0x8252=function(_0x722bf9,_0x727bbc){_0x722bf9=_0x722bf9-0x0;var _0x416f0f=_0x2528[_0x722bf9];return _0x416f0f;};'use strict';var multer=require(_0x8252('0x0'));var util=require(_0x8252('0x1'));var path=require(_0x8252('0x2'));var timeout=require(_0x8252('0x3'));var express=require(_0x8252('0x4'));var router=express[_0x8252('0x5')]();var fs_extra=require(_0x8252('0x6'));var auth=require(_0x8252('0x7'));var interaction=require(_0x8252('0x8'));var config=require(_0x8252('0x9'));var controller=require('./intServicenowConfiguration.controller');router[_0x8252('0xa')]('/',auth['isAuthenticated'](),controller[_0x8252('0xb')]);router[_0x8252('0xa')](_0x8252('0xc'),auth[_0x8252('0xd')](),controller[_0x8252('0xe')]);router[_0x8252('0xa')](_0x8252('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x8252('0xa')](_0x8252('0x10'),auth[_0x8252('0xd')](),controller[_0x8252('0x11')]);router[_0x8252('0xa')](_0x8252('0x12'),auth[_0x8252('0xd')](),controller[_0x8252('0x13')]);router[_0x8252('0x14')]('/',auth[_0x8252('0xd')](),controller[_0x8252('0x15')]);router['put'](_0x8252('0xc'),auth[_0x8252('0xd')](),controller[_0x8252('0x16')]);router[_0x8252('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x8252('0x18')]);module[_0x8252('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7a7d651..52965fb 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 _0x5fce=['exports','STRING','sequelize'];(function(_0x53a8b3,_0x14570f){var _0x808b8c=function(_0x35922f){while(--_0x35922f){_0x53a8b3['push'](_0x53a8b3['shift']());}};_0x808b8c(++_0x14570f);}(_0x5fce,0x155));var _0xe5fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5fce[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xe5fc('0x0'));module[_0xe5fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5fc('0x2')]}}; \ No newline at end of file +var _0x85c5=['exports','STRING','sequelize'];(function(_0x23fcec,_0x48ec4c){var _0x447567=function(_0x4781bb){while(--_0x4781bb){_0x23fcec['push'](_0x23fcec['shift']());}};_0x447567(++_0x48ec4c);}(_0x85c5,0x131));var _0x585c=function(_0x1cb635,_0x3e43f0){_0x1cb635=_0x1cb635-0x0;var _0x415914=_0x85c5[_0x1cb635];return _0x415914;};'use strict';var Sequelize=require(_0x585c('0x0'));module[_0x585c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x585c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1a35da7..f3a158e 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 _0xe75c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','offset','limit','set','reject','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','merge','count','include','rows','catch','show','params','rawAttributes','includeAll','options','create','update','body','find','getFields','hasOwnProperty','getSubjects','findOne','ServicenowField','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x2f79e6,_0x585c3f){var _0x1e1789=function(_0x361f3b){while(--_0x361f3b){_0x2f79e6['push'](_0x2f79e6['shift']());}};_0x1e1789(++_0x585c3f);}(_0xe75c,0xd3));var _0xce75=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe75c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xce75('0x0'));var rimraf=require(_0xce75('0x1'));var zipdir=require(_0xce75('0x2'));var jsonpatch=require(_0xce75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce75('0x4'));var Mustache=require('mustache');var util=require(_0xce75('0x5'));var path=require(_0xce75('0x6'));var sox=require(_0xce75('0x7'));var csv=require('to-csv');var ejs=require(_0xce75('0x8'));var fs=require('fs');var fs_extra=require(_0xce75('0x9'));var _=require(_0xce75('0xa'));var squel=require(_0xce75('0xb'));var crypto=require(_0xce75('0xc'));var jsforce=require(_0xce75('0xd'));var deskjs=require(_0xce75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce75('0xf'));var Redis=require('ioredis');var authService=require(_0xce75('0x10'));var qs=require(_0xce75('0x11'));var as=require(_0xce75('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce75('0x13'))('api');var utils=require(_0xce75('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xce75('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588dda,_0xd86f4a){_0xd86f4a=_0xd86f4a||0xcc;return function(_0xdcac8){if(_0xdcac8){return _0x588dda['sendStatus'](_0xd86f4a);}return _0x588dda['status'](_0xd86f4a)[_0xce75('0x16')]();};}function respondWithResult(_0x45c5ff,_0x21e396){_0x21e396=_0x21e396||0xc8;return function(_0x1f8134){if(_0x1f8134){return _0x45c5ff[_0xce75('0x17')](_0x21e396)[_0xce75('0x18')](_0x1f8134);}};}function respondWithFilteredResult(_0x14f4d7,_0x139b2a){return function(_0x13bc7a){if(_0x13bc7a){var _0x33f5ab=typeof _0x139b2a['offset']===_0xce75('0x19')&&typeof _0x139b2a['limit']===_0xce75('0x19');var _0x5aaeaf=_0x13bc7a['count'];var _0x342fd8=_0x33f5ab?0x0:_0x139b2a['offset'];var _0xd72dfd=_0x33f5ab?_0x13bc7a['count']:_0x139b2a[_0xce75('0x1a')]+_0x139b2a[_0xce75('0x1b')];var _0x42ef7b;if(_0xd72dfd>=_0x5aaeaf){_0xd72dfd=_0x5aaeaf;_0x42ef7b=0xc8;}else{_0x42ef7b=0xce;}_0x14f4d7[_0xce75('0x17')](_0x42ef7b);return _0x14f4d7[_0xce75('0x1c')]('Content-Range',_0x342fd8+'-'+_0xd72dfd+'/'+_0x5aaeaf)['json'](_0x13bc7a);}return null;};}function patchUpdates(_0x5db794){return function(_0x17ebcf){try{jsonpatch['apply'](_0x17ebcf,_0x5db794,!![]);}catch(_0x16dbf1){return BPromise[_0xce75('0x1d')](_0x16dbf1);}return _0x17ebcf['save']();};}function saveUpdates(_0x506701,_0x5a0813){return function(_0x2b49f1){if(_0x2b49f1){return _0x2b49f1['update'](_0x506701)[_0xce75('0x1e')](function(_0x5400da){return _0x5400da;});}return null;};}function removeEntity(_0x131019,_0x19775c){return function(_0x424b1d){if(_0x424b1d){return _0x424b1d[_0xce75('0x1f')]()[_0xce75('0x1e')](function(){_0x131019[_0xce75('0x17')](0xcc)[_0xce75('0x16')]();});}};}function handleEntityNotFound(_0x578575,_0x50ca17){return function(_0x1dada1){if(!_0x1dada1){_0x578575[_0xce75('0x20')](0x194);}return _0x1dada1;};}function handleError(_0x50f1d6,_0x125961){_0x125961=_0x125961||0x1f4;return function(_0x5ee1ea){logger[_0xce75('0x21')](_0x5ee1ea['stack']);if(_0x5ee1ea['name']){delete _0x5ee1ea[_0xce75('0x22')];}_0x50f1d6['status'](_0x125961)[_0xce75('0x23')](_0x5ee1ea);};}exports[_0xce75('0x24')]=function(_0x52cc33,_0xe81b26){var _0x2b8223={},_0x268bc3={},_0x3d5467={'count':0x0,'rows':[]};var _0x415471=_[_0xce75('0x25')](db[_0xce75('0x26')]['rawAttributes'],function(_0x542188){return{'name':_0x542188[_0xce75('0x27')],'type':_0x542188['type'][_0xce75('0x28')]};});_0x268bc3[_0xce75('0x29')]=_['map'](_0x415471,'name');_0x268bc3[_0xce75('0x2a')]=_[_0xce75('0x2b')](_0x52cc33[_0xce75('0x2a')]);_0x268bc3[_0xce75('0x2c')]=_[_0xce75('0x2d')](_0x268bc3[_0xce75('0x29')],_0x268bc3['query']);_0x2b8223[_0xce75('0x2e')]=_['intersection'](_0x268bc3[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x52cc33['query'][_0xce75('0x2f')]));_0x2b8223['attributes']=_0x2b8223[_0xce75('0x2e')][_0xce75('0x30')]?_0x2b8223[_0xce75('0x2e')]:_0x268bc3[_0xce75('0x29')];if(!_0x52cc33[_0xce75('0x2a')]['hasOwnProperty'](_0xce75('0x31'))){_0x2b8223[_0xce75('0x1b')]=qs['limit'](_0x52cc33[_0xce75('0x2a')][_0xce75('0x1b')]);_0x2b8223[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x52cc33['query'][_0xce75('0x1a')]);}_0x2b8223['order']=qs[_0xce75('0x32')](_0x52cc33[_0xce75('0x2a')][_0xce75('0x32')]);_0x2b8223[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x52cc33['query'],_0x268bc3[_0xce75('0x2c')]),_0x415471);if(_0x52cc33[_0xce75('0x2a')][_0xce75('0x35')]){_0x2b8223['where']=_['merge'](_0x2b8223[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x415471,function(_0x58e914){if(_0x58e914[_0xce75('0x36')]!=='VIRTUAL'){var _0x7a181e={};_0x7a181e[_0x58e914[_0xce75('0x22')]]={'$like':'%'+_0x52cc33[_0xce75('0x2a')]['filter']+'%'};return _0x7a181e;}})});}_0x2b8223=_[_0xce75('0x37')]({},_0x2b8223,_0x52cc33['options']);var _0x5e51bb={'where':_0x2b8223[_0xce75('0x33')]};return db['ServicenowConfiguration'][_0xce75('0x38')](_0x5e51bb)['then'](function(_0x235067){_0x3d5467['count']=_0x235067;if(_0x52cc33[_0xce75('0x2a')]['includeAll']){_0x2b8223[_0xce75('0x39')]=[{'all':!![]}];}return db[_0xce75('0x26')]['findAll'](_0x2b8223);})[_0xce75('0x1e')](function(_0x556680){_0x3d5467[_0xce75('0x3a')]=_0x556680;return _0x3d5467;})[_0xce75('0x1e')](respondWithFilteredResult(_0xe81b26,_0x2b8223))[_0xce75('0x3b')](handleError(_0xe81b26,null));};exports[_0xce75('0x3c')]=function(_0x5e8d0d,_0x5177d7){var _0x10a24d={'raw':![],'where':{'id':_0x5e8d0d[_0xce75('0x3d')]['id']}},_0x29b3b3={};_0x29b3b3[_0xce75('0x29')]=_[_0xce75('0x2b')](db[_0xce75('0x26')][_0xce75('0x3e')]);_0x29b3b3[_0xce75('0x2a')]=_[_0xce75('0x2b')](_0x5e8d0d[_0xce75('0x2a')]);_0x29b3b3[_0xce75('0x2c')]=_['intersection'](_0x29b3b3[_0xce75('0x29')],_0x29b3b3[_0xce75('0x2a')]);_0x10a24d['attributes']=_[_0xce75('0x2d')](_0x29b3b3['model'],qs['fields'](_0x5e8d0d['query']['fields']));_0x10a24d['attributes']=_0x10a24d[_0xce75('0x2e')]['length']?_0x10a24d[_0xce75('0x2e')]:_0x29b3b3['model'];if(_0x5e8d0d[_0xce75('0x2a')][_0xce75('0x3f')]){_0x10a24d[_0xce75('0x39')]=[{'all':!![]}];}_0x10a24d=_['merge']({},_0x10a24d,_0x5e8d0d[_0xce75('0x40')]);return db[_0xce75('0x26')]['find'](_0x10a24d)[_0xce75('0x1e')](handleEntityNotFound(_0x5177d7,null))['then'](respondWithResult(_0x5177d7,null))[_0xce75('0x3b')](handleError(_0x5177d7,null));};exports[_0xce75('0x41')]=function(_0x47aea1,_0x15a49){return db[_0xce75('0x26')][_0xce75('0x41')](_0x47aea1['body'],{})[_0xce75('0x1e')](respondWithResult(_0x15a49,0xc9))['catch'](handleError(_0x15a49,null));};exports[_0xce75('0x42')]=function(_0xd71cd7,_0x3f94ee){if(_0xd71cd7['body']['id']){delete _0xd71cd7[_0xce75('0x43')]['id'];}return db[_0xce75('0x26')][_0xce75('0x44')]({'where':{'id':_0xd71cd7[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x3f94ee,null))[_0xce75('0x1e')](saveUpdates(_0xd71cd7[_0xce75('0x43')],null))[_0xce75('0x1e')](respondWithResult(_0x3f94ee,null))[_0xce75('0x3b')](handleError(_0x3f94ee,null));};exports[_0xce75('0x1f')]=function(_0x4ebba3,_0x9f1d81){return db[_0xce75('0x26')][_0xce75('0x44')]({'where':{'id':_0x4ebba3[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x9f1d81,null))[_0xce75('0x1e')](removeEntity(_0x9f1d81,null))['catch'](handleError(_0x9f1d81,null));};exports[_0xce75('0x45')]=function(_0x1c1757,_0xa86aac,_0x339415){var _0x3cc737={};var _0x18c528={};var _0x31d66a;var _0x5eb9cf;return db[_0xce75('0x26')]['findOne']({'where':{'id':_0x1c1757[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0xa86aac,null))[_0xce75('0x1e')](function(_0x204826){if(_0x204826){_0x31d66a=_0x204826;_0x18c528[_0xce75('0x29')]=_['keys'](db['ServicenowField'][_0xce75('0x3e')]);_0x18c528[_0xce75('0x2a')]=_['keys'](_0x1c1757['query']);_0x18c528['filters']=_[_0xce75('0x2d')](_0x18c528[_0xce75('0x29')],_0x18c528['query']);_0x3cc737[_0xce75('0x2e')]=_[_0xce75('0x2d')](_0x18c528[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x2f')]));_0x3cc737[_0xce75('0x2e')]=_0x3cc737[_0xce75('0x2e')][_0xce75('0x30')]?_0x3cc737[_0xce75('0x2e')]:_0x18c528[_0xce75('0x29')];_0x3cc737['order']=qs[_0xce75('0x32')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x32')]);_0x3cc737[_0xce75('0x33')]=qs['filters'](_[_0xce75('0x34')](_0x1c1757[_0xce75('0x2a')],_0x18c528[_0xce75('0x2c')]));if(_0x1c1757[_0xce75('0x2a')][_0xce75('0x35')]){_0x3cc737['where']=_[_0xce75('0x37')](_0x3cc737[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x3cc737[_0xce75('0x2e')],function(_0x17b39e){var _0x1e9f50={};_0x1e9f50[_0x17b39e]={'$like':'%'+_0x1c1757['query'][_0xce75('0x35')]+'%'};return _0x1e9f50;})});}_0x3cc737=_[_0xce75('0x37')]({},_0x3cc737,_0x1c1757[_0xce75('0x40')]);return _0x31d66a['getFields'](_0x3cc737);}})['then'](function(_0x4e83d4){if(_0x4e83d4){_0x5eb9cf=_0x4e83d4[_0xce75('0x30')];if(!_0x1c1757[_0xce75('0x2a')][_0xce75('0x46')](_0xce75('0x31'))){_0x3cc737[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x1b')]);_0x3cc737['offset']=qs[_0xce75('0x1a')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x1a')]);}return _0x31d66a[_0xce75('0x45')](_0x3cc737);}})[_0xce75('0x1e')](function(_0x59c187){if(_0x59c187){return _0x59c187?{'count':_0x5eb9cf,'rows':_0x59c187}:null;}})[_0xce75('0x1e')](respondWithResult(_0xa86aac,null))[_0xce75('0x3b')](handleError(_0xa86aac,null));};exports[_0xce75('0x47')]=function(_0x1de46a,_0x809049,_0x3073cb){var _0x4c7125={};var _0x149013={};var _0x525da7;var _0x1c83f5;return db[_0xce75('0x26')][_0xce75('0x48')]({'where':{'id':_0x1de46a[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x809049,null))[_0xce75('0x1e')](function(_0x5783c7){if(_0x5783c7){_0x525da7=_0x5783c7;_0x149013[_0xce75('0x29')]=_[_0xce75('0x2b')](db[_0xce75('0x49')][_0xce75('0x3e')]);_0x149013['query']=_[_0xce75('0x2b')](_0x1de46a[_0xce75('0x2a')]);_0x149013['filters']=_[_0xce75('0x2d')](_0x149013[_0xce75('0x29')],_0x149013['query']);_0x4c7125[_0xce75('0x2e')]=_[_0xce75('0x2d')](_0x149013[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x1de46a['query'][_0xce75('0x2f')]));_0x4c7125[_0xce75('0x2e')]=_0x4c7125[_0xce75('0x2e')][_0xce75('0x30')]?_0x4c7125['attributes']:_0x149013['model'];_0x4c7125[_0xce75('0x4a')]=qs[_0xce75('0x32')](_0x1de46a[_0xce75('0x2a')][_0xce75('0x32')]);_0x4c7125[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x1de46a[_0xce75('0x2a')],_0x149013['filters']));if(_0x1de46a['query'][_0xce75('0x35')]){_0x4c7125[_0xce75('0x33')]=_[_0xce75('0x37')](_0x4c7125[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x4c7125[_0xce75('0x2e')],function(_0x1ceb21){var _0x2d2d36={};_0x2d2d36[_0x1ceb21]={'$like':'%'+_0x1de46a[_0xce75('0x2a')]['filter']+'%'};return _0x2d2d36;})});}_0x4c7125=_[_0xce75('0x37')]({},_0x4c7125,_0x1de46a[_0xce75('0x40')]);return _0x525da7[_0xce75('0x47')](_0x4c7125);}})[_0xce75('0x1e')](function(_0x422af9){if(_0x422af9){_0x1c83f5=_0x422af9[_0xce75('0x30')];if(!_0x1de46a[_0xce75('0x2a')][_0xce75('0x46')](_0xce75('0x31'))){_0x4c7125[_0xce75('0x1b')]=qs['limit'](_0x1de46a[_0xce75('0x2a')][_0xce75('0x1b')]);_0x4c7125[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x1de46a[_0xce75('0x2a')][_0xce75('0x1a')]);}return _0x525da7['getSubjects'](_0x4c7125);}})[_0xce75('0x1e')](function(_0x25878c){if(_0x25878c){return _0x25878c?{'count':_0x1c83f5,'rows':_0x25878c}:null;}})[_0xce75('0x1e')](respondWithResult(_0x809049,null))[_0xce75('0x3b')](handleError(_0x809049,null));};exports['getDescriptions']=function(_0x54dc2e,_0x5c0d8a,_0x2a6a06){var _0x5a9690={};var _0x1958e3={};var _0x4111a5;var _0x1c9cae;return db[_0xce75('0x26')][_0xce75('0x48')]({'where':{'id':_0x54dc2e[_0xce75('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5c0d8a,null))[_0xce75('0x1e')](function(_0x597aed){if(_0x597aed){_0x4111a5=_0x597aed;_0x1958e3['model']=_['keys'](db[_0xce75('0x49')][_0xce75('0x3e')]);_0x1958e3[_0xce75('0x2a')]=_['keys'](_0x54dc2e[_0xce75('0x2a')]);_0x1958e3[_0xce75('0x2c')]=_[_0xce75('0x2d')](_0x1958e3['model'],_0x1958e3[_0xce75('0x2a')]);_0x5a9690['attributes']=_[_0xce75('0x2d')](_0x1958e3[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x54dc2e[_0xce75('0x2a')]['fields']));_0x5a9690[_0xce75('0x2e')]=_0x5a9690[_0xce75('0x2e')][_0xce75('0x30')]?_0x5a9690[_0xce75('0x2e')]:_0x1958e3[_0xce75('0x29')];_0x5a9690[_0xce75('0x4a')]=qs['sort'](_0x54dc2e[_0xce75('0x2a')][_0xce75('0x32')]);_0x5a9690[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x54dc2e[_0xce75('0x2a')],_0x1958e3[_0xce75('0x2c')]));if(_0x54dc2e['query']['filter']){_0x5a9690['where']=_[_0xce75('0x37')](_0x5a9690['where'],{'$or':_[_0xce75('0x25')](_0x5a9690[_0xce75('0x2e')],function(_0x484ca2){var _0x2062cf={};_0x2062cf[_0x484ca2]={'$like':'%'+_0x54dc2e['query'][_0xce75('0x35')]+'%'};return _0x2062cf;})});}_0x5a9690=_[_0xce75('0x37')]({},_0x5a9690,_0x54dc2e[_0xce75('0x40')]);return _0x4111a5[_0xce75('0x4b')](_0x5a9690);}})[_0xce75('0x1e')](function(_0x4cdb00){if(_0x4cdb00){_0x1c9cae=_0x4cdb00['length'];if(!_0x54dc2e[_0xce75('0x2a')]['hasOwnProperty'](_0xce75('0x31'))){_0x5a9690[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x54dc2e[_0xce75('0x2a')]['limit']);_0x5a9690[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x54dc2e[_0xce75('0x2a')]['offset']);}return _0x4111a5[_0xce75('0x4b')](_0x5a9690);}})[_0xce75('0x1e')](function(_0x76408e){if(_0x76408e){return _0x76408e?{'count':_0x1c9cae,'rows':_0x76408e}:null;}})[_0xce75('0x1e')](respondWithResult(_0x5c0d8a,null))[_0xce75('0x3b')](handleError(_0x5c0d8a,null));}; \ No newline at end of file +var _0xd6f5=['count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','ServicenowConfiguration','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','create','body','catch','find','params','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x3c895c,_0x3430f2){var _0x50b7b3=function(_0x2f6437){while(--_0x2f6437){_0x3c895c['push'](_0x3c895c['shift']());}};_0x50b7b3(++_0x3430f2);}(_0xd6f5,0x83));var _0x5d6f=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xd6f5[_0x25e109];return _0xc0f7d6;};'use strict';var emlformat=require(_0x5d6f('0x0'));var rimraf=require(_0x5d6f('0x1'));var zipdir=require(_0x5d6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5d6f('0x3'));var BPromise=require(_0x5d6f('0x4'));var Mustache=require(_0x5d6f('0x5'));var util=require('util');var path=require(_0x5d6f('0x6'));var sox=require(_0x5d6f('0x7'));var csv=require(_0x5d6f('0x8'));var ejs=require(_0x5d6f('0x9'));var fs=require('fs');var fs_extra=require(_0x5d6f('0xa'));var _=require(_0x5d6f('0xb'));var squel=require(_0x5d6f('0xc'));var crypto=require(_0x5d6f('0xd'));var jsforce=require(_0x5d6f('0xe'));var deskjs=require(_0x5d6f('0xf'));var toCsv=require(_0x5d6f('0x8'));var querystring=require(_0x5d6f('0x10'));var Papa=require('papaparse');var Redis=require(_0x5d6f('0x11'));var authService=require(_0x5d6f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5d6f('0x13'));var hardwareService=require(_0x5d6f('0x14'));var logger=require('../../config/logger')(_0x5d6f('0x15'));var utils=require(_0x5d6f('0x16'));var config=require(_0x5d6f('0x17'));var licenseUtil=require(_0x5d6f('0x18'));var db=require(_0x5d6f('0x19'))['db'];function respondWithStatusCode(_0x4d166b,_0x9072fc){_0x9072fc=_0x9072fc||0xcc;return function(_0x47f029){if(_0x47f029){return _0x4d166b[_0x5d6f('0x1a')](_0x9072fc);}return _0x4d166b[_0x5d6f('0x1b')](_0x9072fc)['end']();};}function respondWithResult(_0x4bef56,_0x143e20){_0x143e20=_0x143e20||0xc8;return function(_0x5c1c27){if(_0x5c1c27){return _0x4bef56[_0x5d6f('0x1b')](_0x143e20)['json'](_0x5c1c27);}};}function respondWithFilteredResult(_0x4f4e30,_0x326ddd){return function(_0x5d5979){if(_0x5d5979){var _0x5098ce=typeof _0x326ddd[_0x5d6f('0x1c')]===_0x5d6f('0x1d')&&typeof _0x326ddd[_0x5d6f('0x1e')]===_0x5d6f('0x1d');var _0x1cf848=_0x5d5979[_0x5d6f('0x1f')];var _0x841cd3=_0x5098ce?0x0:_0x326ddd[_0x5d6f('0x1c')];var _0x14a9a3=_0x5098ce?_0x5d5979[_0x5d6f('0x1f')]:_0x326ddd[_0x5d6f('0x1c')]+_0x326ddd['limit'];var _0x1d88de;if(_0x14a9a3>=_0x1cf848){_0x14a9a3=_0x1cf848;_0x1d88de=0xc8;}else{_0x1d88de=0xce;}_0x4f4e30[_0x5d6f('0x1b')](_0x1d88de);return _0x4f4e30[_0x5d6f('0x20')](_0x5d6f('0x21'),_0x841cd3+'-'+_0x14a9a3+'/'+_0x1cf848)['json'](_0x5d5979);}return null;};}function patchUpdates(_0x5ebe5c){return function(_0x5bd08c){try{jsonpatch['apply'](_0x5bd08c,_0x5ebe5c,!![]);}catch(_0x27c3bc){return BPromise[_0x5d6f('0x22')](_0x27c3bc);}return _0x5bd08c[_0x5d6f('0x23')]();};}function saveUpdates(_0x1f4a93,_0x8084d8){return function(_0xdd074f){if(_0xdd074f){return _0xdd074f[_0x5d6f('0x24')](_0x1f4a93)[_0x5d6f('0x25')](function(_0x150c4c){return _0x150c4c;});}return null;};}function removeEntity(_0xb49228,_0x45d107){return function(_0x5d2e21){if(_0x5d2e21){return _0x5d2e21[_0x5d6f('0x26')]()['then'](function(){_0xb49228['status'](0xcc)[_0x5d6f('0x27')]();});}};}function handleEntityNotFound(_0x18db6c,_0x27242a){return function(_0x371b69){if(!_0x371b69){_0x18db6c[_0x5d6f('0x1a')](0x194);}return _0x371b69;};}function handleError(_0x51ddd9,_0x4fb194){_0x4fb194=_0x4fb194||0x1f4;return function(_0x475274){logger[_0x5d6f('0x28')](_0x475274[_0x5d6f('0x29')]);if(_0x475274[_0x5d6f('0x2a')]){delete _0x475274[_0x5d6f('0x2a')];}_0x51ddd9[_0x5d6f('0x1b')](_0x4fb194)['send'](_0x475274);};}exports[_0x5d6f('0x2b')]=function(_0x4f9492,_0x5148bc){var _0x9bbcfe={},_0x150bf8={},_0xc46834={'count':0x0,'rows':[]};var _0x566850=_['map'](db[_0x5d6f('0x2c')][_0x5d6f('0x2d')],function(_0x26ee18){return{'name':_0x26ee18['fieldName'],'type':_0x26ee18[_0x5d6f('0x2e')]['key']};});_0x150bf8[_0x5d6f('0x2f')]=_['map'](_0x566850,_0x5d6f('0x2a'));_0x150bf8['query']=_['keys'](_0x4f9492[_0x5d6f('0x30')]);_0x150bf8[_0x5d6f('0x31')]=_[_0x5d6f('0x32')](_0x150bf8['model'],_0x150bf8[_0x5d6f('0x30')]);_0x9bbcfe[_0x5d6f('0x33')]=_[_0x5d6f('0x32')](_0x150bf8[_0x5d6f('0x2f')],qs[_0x5d6f('0x34')](_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x34')]));_0x9bbcfe[_0x5d6f('0x33')]=_0x9bbcfe[_0x5d6f('0x33')][_0x5d6f('0x35')]?_0x9bbcfe[_0x5d6f('0x33')]:_0x150bf8[_0x5d6f('0x2f')];if(!_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x36')]('nolimit')){_0x9bbcfe[_0x5d6f('0x1e')]=qs[_0x5d6f('0x1e')](_0x4f9492[_0x5d6f('0x30')]['limit']);_0x9bbcfe['offset']=qs[_0x5d6f('0x1c')](_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x1c')]);}_0x9bbcfe[_0x5d6f('0x37')]=qs['sort'](_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x38')]);_0x9bbcfe['where']=qs[_0x5d6f('0x31')](_[_0x5d6f('0x39')](_0x4f9492[_0x5d6f('0x30')],_0x150bf8['filters']),_0x566850);if(_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x3a')]){_0x9bbcfe[_0x5d6f('0x3b')]=_[_0x5d6f('0x3c')](_0x9bbcfe['where'],{'$or':_[_0x5d6f('0x3d')](_0x566850,function(_0x5289af){if(_0x5289af[_0x5d6f('0x2e')]!==_0x5d6f('0x3e')){var _0x5a66b3={};_0x5a66b3[_0x5289af[_0x5d6f('0x2a')]]={'$like':'%'+_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x3a')]+'%'};return _0x5a66b3;}})});}_0x9bbcfe=_[_0x5d6f('0x3c')]({},_0x9bbcfe,_0x4f9492[_0x5d6f('0x3f')]);var _0x5901e9={'where':_0x9bbcfe[_0x5d6f('0x3b')]};return db[_0x5d6f('0x2c')][_0x5d6f('0x1f')](_0x5901e9)[_0x5d6f('0x25')](function(_0x359c38){_0xc46834[_0x5d6f('0x1f')]=_0x359c38;if(_0x4f9492[_0x5d6f('0x30')][_0x5d6f('0x40')]){_0x9bbcfe[_0x5d6f('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x5d6f('0x42')](_0x9bbcfe);})['then'](function(_0x20bba9){_0xc46834[_0x5d6f('0x43')]=_0x20bba9;return _0xc46834;})['then'](respondWithFilteredResult(_0x5148bc,_0x9bbcfe))['catch'](handleError(_0x5148bc,null));};exports[_0x5d6f('0x44')]=function(_0x4935cd,_0x433876){var _0x2719d0={'raw':![],'where':{'id':_0x4935cd['params']['id']}},_0xbc8df7={};_0xbc8df7[_0x5d6f('0x2f')]=_[_0x5d6f('0x45')](db[_0x5d6f('0x2c')]['rawAttributes']);_0xbc8df7[_0x5d6f('0x30')]=_[_0x5d6f('0x45')](_0x4935cd[_0x5d6f('0x30')]);_0xbc8df7[_0x5d6f('0x31')]=_[_0x5d6f('0x32')](_0xbc8df7[_0x5d6f('0x2f')],_0xbc8df7[_0x5d6f('0x30')]);_0x2719d0['attributes']=_['intersection'](_0xbc8df7[_0x5d6f('0x2f')],qs[_0x5d6f('0x34')](_0x4935cd[_0x5d6f('0x30')][_0x5d6f('0x34')]));_0x2719d0[_0x5d6f('0x33')]=_0x2719d0[_0x5d6f('0x33')][_0x5d6f('0x35')]?_0x2719d0['attributes']:_0xbc8df7['model'];if(_0x4935cd[_0x5d6f('0x30')]['includeAll']){_0x2719d0[_0x5d6f('0x41')]=[{'all':!![]}];}_0x2719d0=_[_0x5d6f('0x3c')]({},_0x2719d0,_0x4935cd[_0x5d6f('0x3f')]);return db['ServicenowConfiguration']['find'](_0x2719d0)['then'](handleEntityNotFound(_0x433876,null))[_0x5d6f('0x25')](respondWithResult(_0x433876,null))['catch'](handleError(_0x433876,null));};exports['create']=function(_0x41f011,_0x370694){return db[_0x5d6f('0x2c')][_0x5d6f('0x46')](_0x41f011[_0x5d6f('0x47')],{})[_0x5d6f('0x25')](respondWithResult(_0x370694,0xc9))[_0x5d6f('0x48')](handleError(_0x370694,null));};exports[_0x5d6f('0x24')]=function(_0x13956e,_0x1f5aca){if(_0x13956e['body']['id']){delete _0x13956e[_0x5d6f('0x47')]['id'];}return db['ServicenowConfiguration'][_0x5d6f('0x49')]({'where':{'id':_0x13956e[_0x5d6f('0x4a')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x1f5aca,null))[_0x5d6f('0x25')](saveUpdates(_0x13956e[_0x5d6f('0x47')],null))[_0x5d6f('0x25')](respondWithResult(_0x1f5aca,null))[_0x5d6f('0x48')](handleError(_0x1f5aca,null));};exports[_0x5d6f('0x26')]=function(_0x410aa5,_0x14187b){return db['ServicenowConfiguration']['find']({'where':{'id':_0x410aa5[_0x5d6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14187b,null))[_0x5d6f('0x25')](removeEntity(_0x14187b,null))[_0x5d6f('0x48')](handleError(_0x14187b,null));};exports[_0x5d6f('0x4b')]=function(_0x3906c3,_0x16fc04,_0x2dba9b){var _0x2a276f={};var _0x380e4c={};var _0x2b98db;var _0x1f8d46;return db[_0x5d6f('0x2c')][_0x5d6f('0x4c')]({'where':{'id':_0x3906c3[_0x5d6f('0x4a')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x16fc04,null))[_0x5d6f('0x25')](function(_0x1df710){if(_0x1df710){_0x2b98db=_0x1df710;_0x380e4c[_0x5d6f('0x2f')]=_['keys'](db[_0x5d6f('0x4d')]['rawAttributes']);_0x380e4c['query']=_[_0x5d6f('0x45')](_0x3906c3[_0x5d6f('0x30')]);_0x380e4c[_0x5d6f('0x31')]=_[_0x5d6f('0x32')](_0x380e4c[_0x5d6f('0x2f')],_0x380e4c['query']);_0x2a276f[_0x5d6f('0x33')]=_[_0x5d6f('0x32')](_0x380e4c[_0x5d6f('0x2f')],qs[_0x5d6f('0x34')](_0x3906c3[_0x5d6f('0x30')][_0x5d6f('0x34')]));_0x2a276f[_0x5d6f('0x33')]=_0x2a276f[_0x5d6f('0x33')]['length']?_0x2a276f[_0x5d6f('0x33')]:_0x380e4c['model'];_0x2a276f[_0x5d6f('0x37')]=qs[_0x5d6f('0x38')](_0x3906c3[_0x5d6f('0x30')][_0x5d6f('0x38')]);_0x2a276f[_0x5d6f('0x3b')]=qs[_0x5d6f('0x31')](_['pick'](_0x3906c3[_0x5d6f('0x30')],_0x380e4c[_0x5d6f('0x31')]));if(_0x3906c3[_0x5d6f('0x30')][_0x5d6f('0x3a')]){_0x2a276f['where']=_[_0x5d6f('0x3c')](_0x2a276f[_0x5d6f('0x3b')],{'$or':_[_0x5d6f('0x3d')](_0x2a276f[_0x5d6f('0x33')],function(_0x3f6275){var _0x57a120={};_0x57a120[_0x3f6275]={'$like':'%'+_0x3906c3[_0x5d6f('0x30')][_0x5d6f('0x3a')]+'%'};return _0x57a120;})});}_0x2a276f=_[_0x5d6f('0x3c')]({},_0x2a276f,_0x3906c3[_0x5d6f('0x3f')]);return _0x2b98db[_0x5d6f('0x4b')](_0x2a276f);}})[_0x5d6f('0x25')](function(_0x4909c3){if(_0x4909c3){_0x1f8d46=_0x4909c3['length'];if(!_0x3906c3['query'][_0x5d6f('0x36')](_0x5d6f('0x4e'))){_0x2a276f['limit']=qs['limit'](_0x3906c3[_0x5d6f('0x30')][_0x5d6f('0x1e')]);_0x2a276f[_0x5d6f('0x1c')]=qs['offset'](_0x3906c3[_0x5d6f('0x30')]['offset']);}return _0x2b98db[_0x5d6f('0x4b')](_0x2a276f);}})[_0x5d6f('0x25')](function(_0x20f48f){if(_0x20f48f){return _0x20f48f?{'count':_0x1f8d46,'rows':_0x20f48f}:null;}})[_0x5d6f('0x25')](respondWithResult(_0x16fc04,null))[_0x5d6f('0x48')](handleError(_0x16fc04,null));};exports[_0x5d6f('0x4f')]=function(_0x4e3e00,_0x25b857,_0x1a68a7){var _0x500e08={};var _0x22348e={};var _0x5826cd;var _0x1a9d98;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x4e3e00[_0x5d6f('0x4a')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x25b857,null))['then'](function(_0x339c53){if(_0x339c53){_0x5826cd=_0x339c53;_0x22348e[_0x5d6f('0x2f')]=_['keys'](db[_0x5d6f('0x4d')]['rawAttributes']);_0x22348e[_0x5d6f('0x30')]=_['keys'](_0x4e3e00['query']);_0x22348e[_0x5d6f('0x31')]=_[_0x5d6f('0x32')](_0x22348e['model'],_0x22348e[_0x5d6f('0x30')]);_0x500e08['attributes']=_['intersection'](_0x22348e['model'],qs[_0x5d6f('0x34')](_0x4e3e00['query']['fields']));_0x500e08[_0x5d6f('0x33')]=_0x500e08[_0x5d6f('0x33')][_0x5d6f('0x35')]?_0x500e08[_0x5d6f('0x33')]:_0x22348e[_0x5d6f('0x2f')];_0x500e08['order']=qs['sort'](_0x4e3e00['query']['sort']);_0x500e08[_0x5d6f('0x3b')]=qs['filters'](_[_0x5d6f('0x39')](_0x4e3e00[_0x5d6f('0x30')],_0x22348e[_0x5d6f('0x31')]));if(_0x4e3e00[_0x5d6f('0x30')]['filter']){_0x500e08[_0x5d6f('0x3b')]=_[_0x5d6f('0x3c')](_0x500e08[_0x5d6f('0x3b')],{'$or':_[_0x5d6f('0x3d')](_0x500e08[_0x5d6f('0x33')],function(_0x54b07a){var _0x3b6dc2={};_0x3b6dc2[_0x54b07a]={'$like':'%'+_0x4e3e00['query'][_0x5d6f('0x3a')]+'%'};return _0x3b6dc2;})});}_0x500e08=_[_0x5d6f('0x3c')]({},_0x500e08,_0x4e3e00['options']);return _0x5826cd[_0x5d6f('0x4f')](_0x500e08);}})[_0x5d6f('0x25')](function(_0x519ea4){if(_0x519ea4){_0x1a9d98=_0x519ea4[_0x5d6f('0x35')];if(!_0x4e3e00[_0x5d6f('0x30')]['hasOwnProperty'](_0x5d6f('0x4e'))){_0x500e08[_0x5d6f('0x1e')]=qs[_0x5d6f('0x1e')](_0x4e3e00[_0x5d6f('0x30')][_0x5d6f('0x1e')]);_0x500e08[_0x5d6f('0x1c')]=qs[_0x5d6f('0x1c')](_0x4e3e00['query'][_0x5d6f('0x1c')]);}return _0x5826cd['getSubjects'](_0x500e08);}})[_0x5d6f('0x25')](function(_0x304c91){if(_0x304c91){return _0x304c91?{'count':_0x1a9d98,'rows':_0x304c91}:null;}})[_0x5d6f('0x25')](respondWithResult(_0x25b857,null))[_0x5d6f('0x48')](handleError(_0x25b857,null));};exports[_0x5d6f('0x50')]=function(_0x94591,_0x175563,_0xc315d3){var _0x50b570={};var _0x1c03b0={};var _0xfca08c;var _0x26d54c;return db[_0x5d6f('0x2c')][_0x5d6f('0x4c')]({'where':{'id':_0x94591[_0x5d6f('0x4a')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x175563,null))[_0x5d6f('0x25')](function(_0x2e69d2){if(_0x2e69d2){_0xfca08c=_0x2e69d2;_0x1c03b0[_0x5d6f('0x2f')]=_['keys'](db[_0x5d6f('0x4d')][_0x5d6f('0x2d')]);_0x1c03b0[_0x5d6f('0x30')]=_[_0x5d6f('0x45')](_0x94591['query']);_0x1c03b0['filters']=_[_0x5d6f('0x32')](_0x1c03b0[_0x5d6f('0x2f')],_0x1c03b0[_0x5d6f('0x30')]);_0x50b570[_0x5d6f('0x33')]=_[_0x5d6f('0x32')](_0x1c03b0[_0x5d6f('0x2f')],qs[_0x5d6f('0x34')](_0x94591['query'][_0x5d6f('0x34')]));_0x50b570[_0x5d6f('0x33')]=_0x50b570[_0x5d6f('0x33')][_0x5d6f('0x35')]?_0x50b570[_0x5d6f('0x33')]:_0x1c03b0[_0x5d6f('0x2f')];_0x50b570[_0x5d6f('0x37')]=qs[_0x5d6f('0x38')](_0x94591[_0x5d6f('0x30')][_0x5d6f('0x38')]);_0x50b570['where']=qs[_0x5d6f('0x31')](_[_0x5d6f('0x39')](_0x94591[_0x5d6f('0x30')],_0x1c03b0['filters']));if(_0x94591[_0x5d6f('0x30')]['filter']){_0x50b570[_0x5d6f('0x3b')]=_[_0x5d6f('0x3c')](_0x50b570[_0x5d6f('0x3b')],{'$or':_['map'](_0x50b570[_0x5d6f('0x33')],function(_0x15e7f4){var _0xe1a4aa={};_0xe1a4aa[_0x15e7f4]={'$like':'%'+_0x94591[_0x5d6f('0x30')][_0x5d6f('0x3a')]+'%'};return _0xe1a4aa;})});}_0x50b570=_[_0x5d6f('0x3c')]({},_0x50b570,_0x94591[_0x5d6f('0x3f')]);return _0xfca08c[_0x5d6f('0x50')](_0x50b570);}})[_0x5d6f('0x25')](function(_0x184621){if(_0x184621){_0x26d54c=_0x184621['length'];if(!_0x94591[_0x5d6f('0x30')][_0x5d6f('0x36')](_0x5d6f('0x4e'))){_0x50b570['limit']=qs['limit'](_0x94591['query']['limit']);_0x50b570['offset']=qs[_0x5d6f('0x1c')](_0x94591[_0x5d6f('0x30')][_0x5d6f('0x1c')]);}return _0xfca08c[_0x5d6f('0x50')](_0x50b570);}})[_0x5d6f('0x25')](function(_0x32f53c){if(_0x32f53c){return _0x32f53c?{'count':_0x26d54c,'rows':_0x32f53c}:null;}})[_0x5d6f('0x25')](respondWithResult(_0x175563,null))['catch'](handleError(_0x175563,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1ce452a..f86b406 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 _0xc2da=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x11fef9,_0x47c98e){var _0x1012c7=function(_0x523c03){while(--_0x523c03){_0x11fef9['push'](_0x11fef9['shift']());}};_0x1012c7(++_0x47c98e);}(_0xc2da,0x124));var _0xac2d=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0xc2da[_0x1785e8];return _0x5e6021;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var logger=require(_0xac2d('0x1'))('api');var moment=require(_0xac2d('0x2'));var BPromise=require('bluebird');var rp=require(_0xac2d('0x3'));var fs=require('fs');var path=require(_0xac2d('0x4'));var rimraf=require(_0xac2d('0x5'));var config=require(_0xac2d('0x6'));var attributes=require(_0xac2d('0x7'));module[_0xac2d('0x8')]=function(_0x3db400,_0x133e22){return _0x3db400[_0xac2d('0x9')](_0xac2d('0xa'),attributes,{'tableName':_0xac2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x0a6b,0x120));var _0xb0a6=function(_0x284f22,_0x45e825){_0x284f22=_0x284f22-0x0;var _0x287180=_0x0a6b[_0x284f22];return _0x287180;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'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 70026c4..d2503bd 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 _0x8124=['then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1fc2ce,_0x2eeaf9){var _0x4eae69=function(_0xb3de9c){while(--_0xb3de9c){_0x1fc2ce['push'](_0x1fc2ce['shift']());}};_0x4eae69(++_0x2eeaf9);}(_0x8124,0x79));var _0x4812=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x8124[_0x213f3d];return _0x238251;};'use strict';var _=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var moment=require('moment');var BPromise=require(_0x4812('0x2'));var rs=require(_0x4812('0x3'));var fs=require('fs');var Redis=require(_0x4812('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4812('0x5'));var logger=require('../../config/logger')(_0x4812('0x6'));var config=require(_0x4812('0x7'));var jayson=require(_0x4812('0x8'));var client=jayson[_0x4812('0x9')][_0x4812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aa561,_0x2adac1,_0x15579a){return new BPromise(function(_0x1d545b,_0x5061ae){return client['request'](_0x3aa561,_0x15579a)[_0x4812('0xb')](function(_0x13a707){logger[_0x4812('0xc')](_0x4812('0xd'),_0x2adac1,'request\x20sent');logger[_0x4812('0xe')](_0x4812('0xf'),_0x2adac1,_0x4812('0x10'),JSON[_0x4812('0x11')](_0x13a707));if(_0x13a707[_0x4812('0x12')]){if(_0x13a707['error'][_0x4812('0x13')]===0x1f4){logger[_0x4812('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);return _0x5061ae(_0x13a707['error'][_0x4812('0x14')]);}logger[_0x4812('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);return _0x1d545b(_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);}else{logger[_0x4812('0xc')](_0x4812('0xd'),_0x2adac1,_0x4812('0x10'));_0x1d545b(_0x13a707[_0x4812('0x15')][_0x4812('0x14')]);}})['catch'](function(_0x861e04){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x861e04);_0x5061ae(_0x861e04);});});} \ No newline at end of file +var _0x8b02=['rpc','../../config/environment','jayson/promise','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x8b02,0x94));var _0x28b0=function(_0x1ba85d,_0x1b6b11){_0x1ba85d=_0x1ba85d-0x0;var _0x8ae172=_0x8b02[_0x1ba85d];return _0x8ae172;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28b0('0x0'));var BPromise=require('bluebird');var rs=require(_0x28b0('0x1'));var fs=require('fs');var Redis=require(_0x28b0('0x2'));var db=require(_0x28b0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28b0('0x4'));var config=require(_0x28b0('0x5'));var jayson=require(_0x28b0('0x6'));var client=jayson['client'][_0x28b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a053c,_0x169a90,_0x3c8a91){return new BPromise(function(_0x138684,_0x2e83f3){return client['request'](_0x1a053c,_0x3c8a91)[_0x28b0('0x8')](function(_0x163f1d){logger['info'](_0x28b0('0x9'),_0x169a90,'request\x20sent');logger[_0x28b0('0xa')](_0x28b0('0xb'),_0x169a90,_0x28b0('0xc'),JSON[_0x28b0('0xd')](_0x163f1d));if(_0x163f1d[_0x28b0('0xe')]){if(_0x163f1d[_0x28b0('0xe')][_0x28b0('0xf')]===0x1f4){logger[_0x28b0('0xe')](_0x28b0('0x9'),_0x169a90,_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);return _0x2e83f3(_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);}logger[_0x28b0('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x169a90,_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);return _0x138684(_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);}else{logger[_0x28b0('0x11')](_0x28b0('0x9'),_0x169a90,_0x28b0('0xc'));_0x138684(_0x163f1d['result'][_0x28b0('0x10')]);}})[_0x28b0('0x12')](function(_0xe1750){logger[_0x28b0('0xe')](_0x28b0('0x9'),_0x169a90,_0xe1750);_0x2e83f3(_0xe1750);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2c0ec42..964ff49 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 _0x3d77=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','/:id','show','put','update','delete','exports'];(function(_0xeb7786,_0x53a053){var _0x120bbc=function(_0x291f05){while(--_0x291f05){_0xeb7786['push'](_0xeb7786['shift']());}};_0x120bbc(++_0x53a053);}(_0x3d77,0xc6));var _0x73d7=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x3d77[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x73d7('0x0'));var util=require(_0x73d7('0x1'));var path=require(_0x73d7('0x2'));var timeout=require(_0x73d7('0x3'));var express=require(_0x73d7('0x4'));var router=express[_0x73d7('0x5')]();var fs_extra=require(_0x73d7('0x6'));var auth=require(_0x73d7('0x7'));var interaction=require(_0x73d7('0x8'));var config=require(_0x73d7('0x9'));var controller=require(_0x73d7('0xa'));router['get']('/',auth[_0x73d7('0xb')](),controller['index']);router['get'](_0x73d7('0xc'),auth[_0x73d7('0xb')](),controller[_0x73d7('0xd')]);router['post']('/',auth[_0x73d7('0xb')](),controller['create']);router[_0x73d7('0xe')](_0x73d7('0xc'),auth[_0x73d7('0xb')](),controller[_0x73d7('0xf')]);router[_0x73d7('0x10')](_0x73d7('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x73d7('0x11')]=router; \ No newline at end of file +var _0xf26a=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x5b514d,_0x3df153){var _0x9df041=function(_0x32d8c3){while(--_0x32d8c3){_0x5b514d['push'](_0x5b514d['shift']());}};_0x9df041(++_0x3df153);}(_0xf26a,0x105));var _0xaf26=function(_0x67e90,_0x30ecf3){_0x67e90=_0x67e90-0x0;var _0x6635b0=_0xf26a[_0x67e90];return _0x6635b0;};'use strict';var multer=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var path=require(_0xaf26('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf26('0x3')]();var fs_extra=require(_0xaf26('0x4'));var auth=require(_0xaf26('0x5'));var interaction=require(_0xaf26('0x6'));var config=require(_0xaf26('0x7'));var controller=require(_0xaf26('0x8'));router[_0xaf26('0x9')]('/',auth[_0xaf26('0xa')](),controller[_0xaf26('0xb')]);router[_0xaf26('0x9')](_0xaf26('0xc'),auth[_0xaf26('0xa')](),controller[_0xaf26('0xd')]);router[_0xaf26('0xe')]('/',auth[_0xaf26('0xa')](),controller[_0xaf26('0xf')]);router[_0xaf26('0x10')](_0xaf26('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xaf26('0x11')](_0xaf26('0xc'),auth[_0xaf26('0xa')](),controller[_0xaf26('0x12')]);module[_0xaf26('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6d47ee6..20771a7 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 _0xd979=['ENUM','string','variable','picklist','STRING','customVariable','sequelize','exports'];(function(_0x15e0ce,_0xa61306){var _0x495ba4=function(_0x48ab8e){while(--_0x48ab8e){_0x15e0ce['push'](_0x15e0ce['shift']());}};_0x495ba4(++_0xa61306);}(_0xd979,0x1be));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d97('0x0'));module[_0x9d97('0x1')]={'type':{'type':Sequelize[_0x9d97('0x2')](_0x9d97('0x3'),_0x9d97('0x4'),'customVariable','keyValue',_0x9d97('0x5')),'defaultValue':_0x9d97('0x3')},'content':{'type':Sequelize[_0x9d97('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d97('0x2')]('string',_0x9d97('0x4'),_0x9d97('0x7'))},'keyContent':{'type':Sequelize[_0x9d97('0x6')]},'idField':{'type':Sequelize[_0x9d97('0x6')]},'nameField':{'type':Sequelize[_0x9d97('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d97('0x6')]}}; \ No newline at end of file +var _0xbdec=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0xea583c,_0x2a89cc){var _0x13dc09=function(_0x13d269){while(--_0x13d269){_0xea583c['push'](_0xea583c['shift']());}};_0x13dc09(++_0x2a89cc);}(_0xbdec,0x150));var _0xcbde=function(_0x8c866a,_0x2112df){_0x8c866a=_0x8c866a-0x0;var _0x5ed909=_0xbdec[_0x8c866a];return _0x5ed909;};'use strict';var Sequelize=require(_0xcbde('0x0'));module[_0xcbde('0x1')]={'type':{'type':Sequelize[_0xcbde('0x2')](_0xcbde('0x3'),'variable',_0xcbde('0x4'),_0xcbde('0x5'),_0xcbde('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcbde('0x7')]},'key':{'type':Sequelize[_0xcbde('0x7')]},'keyType':{'type':Sequelize[_0xcbde('0x2')]('string',_0xcbde('0x8'),_0xcbde('0x4'))},'keyContent':{'type':Sequelize[_0xcbde('0x7')]},'idField':{'type':Sequelize[_0xcbde('0x7')]},'nameField':{'type':Sequelize[_0xcbde('0x7')]},'customField':{'type':Sequelize[_0xcbde('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbde('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5671afa..fdb839d 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 _0x477a=['fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x15b52d,_0x1ce25a){var _0x1fdd32=function(_0x2ab1da){while(--_0x2ab1da){_0x15b52d['push'](_0x15b52d['shift']());}};_0x1fdd32(++_0x1ce25a);}(_0x477a,0x16b));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require(_0xa477('0x1'));var zipdir=require(_0xa477('0x2'));var jsonpatch=require(_0xa477('0x3'));var rp=require(_0xa477('0x4'));var moment=require(_0xa477('0x5'));var BPromise=require(_0xa477('0x6'));var Mustache=require(_0xa477('0x7'));var util=require(_0xa477('0x8'));var path=require('path');var sox=require(_0xa477('0x9'));var csv=require(_0xa477('0xa'));var ejs=require(_0xa477('0xb'));var fs=require('fs');var fs_extra=require(_0xa477('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa477('0xd'));var jsforce=require(_0xa477('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa477('0xa'));var querystring=require(_0xa477('0xf'));var Papa=require(_0xa477('0x10'));var Redis=require(_0xa477('0x11'));var authService=require(_0xa477('0x12'));var qs=require(_0xa477('0x13'));var as=require(_0xa477('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa477('0x15'))(_0xa477('0x16'));var utils=require(_0xa477('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa477('0x18'))['db'];function respondWithStatusCode(_0x4cf6ec,_0xe6c4be){_0xe6c4be=_0xe6c4be||0xcc;return function(_0xf39cc4){if(_0xf39cc4){return _0x4cf6ec[_0xa477('0x19')](_0xe6c4be);}return _0x4cf6ec[_0xa477('0x1a')](_0xe6c4be)['end']();};}function respondWithResult(_0x5ba6ab,_0x504160){_0x504160=_0x504160||0xc8;return function(_0x2f56b7){if(_0x2f56b7){return _0x5ba6ab['status'](_0x504160)[_0xa477('0x1b')](_0x2f56b7);}};}function respondWithFilteredResult(_0x52d10e,_0x3cfd39){return function(_0x27084a){if(_0x27084a){var _0x476ac1=typeof _0x3cfd39[_0xa477('0x1c')]===_0xa477('0x1d')&&typeof _0x3cfd39[_0xa477('0x1e')]===_0xa477('0x1d');var _0x4371ff=_0x27084a[_0xa477('0x1f')];var _0x4df90f=_0x476ac1?0x0:_0x3cfd39['offset'];var _0x105b0b=_0x476ac1?_0x27084a[_0xa477('0x1f')]:_0x3cfd39['offset']+_0x3cfd39['limit'];var _0x442d81;if(_0x105b0b>=_0x4371ff){_0x105b0b=_0x4371ff;_0x442d81=0xc8;}else{_0x442d81=0xce;}_0x52d10e[_0xa477('0x1a')](_0x442d81);return _0x52d10e[_0xa477('0x20')](_0xa477('0x21'),_0x4df90f+'-'+_0x105b0b+'/'+_0x4371ff)[_0xa477('0x1b')](_0x27084a);}return null;};}function patchUpdates(_0x463fca){return function(_0x4d2bfd){try{jsonpatch['apply'](_0x4d2bfd,_0x463fca,!![]);}catch(_0x5e741c){return BPromise[_0xa477('0x22')](_0x5e741c);}return _0x4d2bfd[_0xa477('0x23')]();};}function saveUpdates(_0x12177f,_0xa96b36){return function(_0x388d51){if(_0x388d51){return _0x388d51[_0xa477('0x24')](_0x12177f)['then'](function(_0x2804d7){return _0x2804d7;});}return null;};}function removeEntity(_0x3ccf88,_0x2c5776){return function(_0x534775){if(_0x534775){return _0x534775[_0xa477('0x25')]()[_0xa477('0x26')](function(){_0x3ccf88[_0xa477('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2abd5c,_0x4655e4){return function(_0x1da44f){if(!_0x1da44f){_0x2abd5c['sendStatus'](0x194);}return _0x1da44f;};}function handleError(_0x17e736,_0x1fd706){_0x1fd706=_0x1fd706||0x1f4;return function(_0x22f721){logger[_0xa477('0x27')](_0x22f721['stack']);if(_0x22f721['name']){delete _0x22f721[_0xa477('0x28')];}_0x17e736[_0xa477('0x1a')](_0x1fd706)[_0xa477('0x29')](_0x22f721);};}exports[_0xa477('0x2a')]=function(_0x58920,_0x8bcaf){var _0x4037a0={},_0x496726={},_0x5c652a={'count':0x0,'rows':[]};var _0x4ef868=_[_0xa477('0x2b')](db[_0xa477('0x2c')]['rawAttributes'],function(_0x5102ae){return{'name':_0x5102ae[_0xa477('0x2d')],'type':_0x5102ae[_0xa477('0x2e')][_0xa477('0x2f')]};});_0x496726[_0xa477('0x30')]=_[_0xa477('0x2b')](_0x4ef868,_0xa477('0x28'));_0x496726['query']=_[_0xa477('0x31')](_0x58920[_0xa477('0x32')]);_0x496726[_0xa477('0x33')]=_['intersection'](_0x496726[_0xa477('0x30')],_0x496726[_0xa477('0x32')]);_0x4037a0['attributes']=_[_0xa477('0x34')](_0x496726[_0xa477('0x30')],qs[_0xa477('0x35')](_0x58920[_0xa477('0x32')]['fields']));_0x4037a0[_0xa477('0x36')]=_0x4037a0[_0xa477('0x36')][_0xa477('0x37')]?_0x4037a0[_0xa477('0x36')]:_0x496726['model'];if(!_0x58920[_0xa477('0x32')][_0xa477('0x38')](_0xa477('0x39'))){_0x4037a0['limit']=qs['limit'](_0x58920[_0xa477('0x32')]['limit']);_0x4037a0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x58920[_0xa477('0x32')]['offset']);}_0x4037a0['order']=qs[_0xa477('0x3a')](_0x58920[_0xa477('0x32')]['sort']);_0x4037a0[_0xa477('0x3b')]=qs[_0xa477('0x33')](_[_0xa477('0x3c')](_0x58920[_0xa477('0x32')],_0x496726[_0xa477('0x33')]),_0x4ef868);if(_0x58920['query'][_0xa477('0x3d')]){_0x4037a0[_0xa477('0x3b')]=_['merge'](_0x4037a0[_0xa477('0x3b')],{'$or':_[_0xa477('0x2b')](_0x4ef868,function(_0x505847){if(_0x505847[_0xa477('0x2e')]!==_0xa477('0x3e')){var _0x5e505b={};_0x5e505b[_0x505847[_0xa477('0x28')]]={'$like':'%'+_0x58920[_0xa477('0x32')][_0xa477('0x3d')]+'%'};return _0x5e505b;}})});}_0x4037a0=_[_0xa477('0x3f')]({},_0x4037a0,_0x58920['options']);var _0x4ea6e1={'where':_0x4037a0[_0xa477('0x3b')]};return db['ServicenowField'][_0xa477('0x1f')](_0x4ea6e1)[_0xa477('0x26')](function(_0x4371f0){_0x5c652a[_0xa477('0x1f')]=_0x4371f0;if(_0x58920[_0xa477('0x32')][_0xa477('0x40')]){_0x4037a0[_0xa477('0x41')]=[{'all':!![]}];}return db[_0xa477('0x2c')][_0xa477('0x42')](_0x4037a0);})['then'](function(_0x3f1ab6){_0x5c652a[_0xa477('0x43')]=_0x3f1ab6;return _0x5c652a;})['then'](respondWithFilteredResult(_0x8bcaf,_0x4037a0))[_0xa477('0x44')](handleError(_0x8bcaf,null));};exports[_0xa477('0x45')]=function(_0xe5de8b,_0xa9d2f3){var _0x1d685b={'raw':!![],'where':{'id':_0xe5de8b[_0xa477('0x46')]['id']}},_0x18f8b4={};_0x18f8b4[_0xa477('0x30')]=_[_0xa477('0x31')](db[_0xa477('0x2c')][_0xa477('0x47')]);_0x18f8b4[_0xa477('0x32')]=_[_0xa477('0x31')](_0xe5de8b[_0xa477('0x32')]);_0x18f8b4['filters']=_[_0xa477('0x34')](_0x18f8b4['model'],_0x18f8b4[_0xa477('0x32')]);_0x1d685b[_0xa477('0x36')]=_[_0xa477('0x34')](_0x18f8b4[_0xa477('0x30')],qs['fields'](_0xe5de8b[_0xa477('0x32')][_0xa477('0x35')]));_0x1d685b[_0xa477('0x36')]=_0x1d685b['attributes'][_0xa477('0x37')]?_0x1d685b[_0xa477('0x36')]:_0x18f8b4[_0xa477('0x30')];if(_0xe5de8b[_0xa477('0x32')][_0xa477('0x40')]){_0x1d685b[_0xa477('0x41')]=[{'all':!![]}];}_0x1d685b=_['merge']({},_0x1d685b,_0xe5de8b['options']);return db['ServicenowField'][_0xa477('0x48')](_0x1d685b)['then'](handleEntityNotFound(_0xa9d2f3,null))[_0xa477('0x26')](respondWithResult(_0xa9d2f3,null))['catch'](handleError(_0xa9d2f3,null));};exports[_0xa477('0x49')]=function(_0x24a089,_0x43feeb){return db[_0xa477('0x2c')]['create'](_0x24a089[_0xa477('0x4a')],{})[_0xa477('0x26')](respondWithResult(_0x43feeb,0xc9))['catch'](handleError(_0x43feeb,null));};exports[_0xa477('0x24')]=function(_0x4bb7fb,_0x1fb4d8){if(_0x4bb7fb[_0xa477('0x4a')]['id']){delete _0x4bb7fb['body']['id'];}return db[_0xa477('0x2c')]['find']({'where':{'id':_0x4bb7fb['params']['id']}})[_0xa477('0x26')](handleEntityNotFound(_0x1fb4d8,null))[_0xa477('0x26')](saveUpdates(_0x4bb7fb['body'],null))[_0xa477('0x26')](respondWithResult(_0x1fb4d8,null))[_0xa477('0x44')](handleError(_0x1fb4d8,null));};exports[_0xa477('0x25')]=function(_0x632c0b,_0x2089e6){return db['ServicenowField'][_0xa477('0x48')]({'where':{'id':_0x632c0b[_0xa477('0x46')]['id']}})[_0xa477('0x26')](handleEntityNotFound(_0x2089e6,null))[_0xa477('0x26')](removeEntity(_0x2089e6,null))[_0xa477('0x44')](handleError(_0x2089e6,null));}; \ No newline at end of file +var _0xbbd6=['util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','update','then','destroy','error','stack','name','map','ServicenowField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x2a318a,_0x3f8006){var _0x346cf3=function(_0x314595){while(--_0x314595){_0x2a318a['push'](_0x2a318a['shift']());}};_0x346cf3(++_0x3f8006);}(_0xbbd6,0x15e));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bbd('0x0'));var zipdir=require(_0x6bbd('0x1'));var jsonpatch=require(_0x6bbd('0x2'));var rp=require(_0x6bbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6bbd('0x4'));var util=require(_0x6bbd('0x5'));var path=require(_0x6bbd('0x6'));var sox=require(_0x6bbd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bbd('0x8'));var _=require(_0x6bbd('0x9'));var squel=require('squel');var crypto=require(_0x6bbd('0xa'));var jsforce=require(_0x6bbd('0xb'));var deskjs=require(_0x6bbd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6bbd('0xd'));var Papa=require('papaparse');var Redis=require(_0x6bbd('0xe'));var authService=require(_0x6bbd('0xf'));var qs=require(_0x6bbd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bbd('0x11'));var logger=require('../../config/logger')(_0x6bbd('0x12'));var utils=require(_0x6bbd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6bbd('0x14'));var db=require(_0x6bbd('0x15'))['db'];function respondWithStatusCode(_0x319701,_0x2249ef){_0x2249ef=_0x2249ef||0xcc;return function(_0x5ad012){if(_0x5ad012){return _0x319701[_0x6bbd('0x16')](_0x2249ef);}return _0x319701['status'](_0x2249ef)[_0x6bbd('0x17')]();};}function respondWithResult(_0x5a4b8c,_0x3c2b03){_0x3c2b03=_0x3c2b03||0xc8;return function(_0x1f66d9){if(_0x1f66d9){return _0x5a4b8c[_0x6bbd('0x18')](_0x3c2b03)[_0x6bbd('0x19')](_0x1f66d9);}};}function respondWithFilteredResult(_0x14d85d,_0xabcac0){return function(_0x523525){if(_0x523525){var _0x10a727=typeof _0xabcac0['offset']===_0x6bbd('0x1a')&&typeof _0xabcac0[_0x6bbd('0x1b')]===_0x6bbd('0x1a');var _0x2ca17c=_0x523525['count'];var _0x4f6f3d=_0x10a727?0x0:_0xabcac0[_0x6bbd('0x1c')];var _0x330eb2=_0x10a727?_0x523525[_0x6bbd('0x1d')]:_0xabcac0['offset']+_0xabcac0['limit'];var _0x1db0f8;if(_0x330eb2>=_0x2ca17c){_0x330eb2=_0x2ca17c;_0x1db0f8=0xc8;}else{_0x1db0f8=0xce;}_0x14d85d[_0x6bbd('0x18')](_0x1db0f8);return _0x14d85d[_0x6bbd('0x1e')]('Content-Range',_0x4f6f3d+'-'+_0x330eb2+'/'+_0x2ca17c)['json'](_0x523525);}return null;};}function patchUpdates(_0x220f10){return function(_0x4e1834){try{jsonpatch[_0x6bbd('0x1f')](_0x4e1834,_0x220f10,!![]);}catch(_0x252cba){return BPromise[_0x6bbd('0x20')](_0x252cba);}return _0x4e1834['save']();};}function saveUpdates(_0x565aa,_0x5f21bf){return function(_0x512ba0){if(_0x512ba0){return _0x512ba0[_0x6bbd('0x21')](_0x565aa)[_0x6bbd('0x22')](function(_0x1652ae){return _0x1652ae;});}return null;};}function removeEntity(_0x5241bb,_0x4a0e50){return function(_0x5bccaf){if(_0x5bccaf){return _0x5bccaf[_0x6bbd('0x23')]()[_0x6bbd('0x22')](function(){_0x5241bb[_0x6bbd('0x18')](0xcc)[_0x6bbd('0x17')]();});}};}function handleEntityNotFound(_0x134265,_0x567582){return function(_0x5951dc){if(!_0x5951dc){_0x134265[_0x6bbd('0x16')](0x194);}return _0x5951dc;};}function handleError(_0xfde8c3,_0x2906ad){_0x2906ad=_0x2906ad||0x1f4;return function(_0x158ef2){logger[_0x6bbd('0x24')](_0x158ef2[_0x6bbd('0x25')]);if(_0x158ef2[_0x6bbd('0x26')]){delete _0x158ef2[_0x6bbd('0x26')];}_0xfde8c3[_0x6bbd('0x18')](_0x2906ad)['send'](_0x158ef2);};}exports['index']=function(_0xe6bf4c,_0x4ea543){var _0x6150dc={},_0x3e2dd6={},_0x506fc5={'count':0x0,'rows':[]};var _0x4974d9=_[_0x6bbd('0x27')](db[_0x6bbd('0x28')][_0x6bbd('0x29')],function(_0x217702){return{'name':_0x217702[_0x6bbd('0x2a')],'type':_0x217702['type']['key']};});_0x3e2dd6[_0x6bbd('0x2b')]=_['map'](_0x4974d9,_0x6bbd('0x26'));_0x3e2dd6[_0x6bbd('0x2c')]=_[_0x6bbd('0x2d')](_0xe6bf4c['query']);_0x3e2dd6[_0x6bbd('0x2e')]=_[_0x6bbd('0x2f')](_0x3e2dd6[_0x6bbd('0x2b')],_0x3e2dd6[_0x6bbd('0x2c')]);_0x6150dc['attributes']=_['intersection'](_0x3e2dd6[_0x6bbd('0x2b')],qs[_0x6bbd('0x30')](_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x30')]));_0x6150dc[_0x6bbd('0x31')]=_0x6150dc[_0x6bbd('0x31')]['length']?_0x6150dc[_0x6bbd('0x31')]:_0x3e2dd6[_0x6bbd('0x2b')];if(!_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x32')](_0x6bbd('0x33'))){_0x6150dc[_0x6bbd('0x1b')]=qs['limit'](_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x1b')]);_0x6150dc[_0x6bbd('0x1c')]=qs[_0x6bbd('0x1c')](_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x1c')]);}_0x6150dc['order']=qs[_0x6bbd('0x34')](_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x34')]);_0x6150dc['where']=qs[_0x6bbd('0x2e')](_[_0x6bbd('0x35')](_0xe6bf4c[_0x6bbd('0x2c')],_0x3e2dd6[_0x6bbd('0x2e')]),_0x4974d9);if(_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x36')]){_0x6150dc[_0x6bbd('0x37')]=_[_0x6bbd('0x38')](_0x6150dc['where'],{'$or':_[_0x6bbd('0x27')](_0x4974d9,function(_0x123cbe){if(_0x123cbe[_0x6bbd('0x39')]!==_0x6bbd('0x3a')){var _0x341a2f={};_0x341a2f[_0x123cbe[_0x6bbd('0x26')]]={'$like':'%'+_0xe6bf4c[_0x6bbd('0x2c')]['filter']+'%'};return _0x341a2f;}})});}_0x6150dc=_[_0x6bbd('0x38')]({},_0x6150dc,_0xe6bf4c[_0x6bbd('0x3b')]);var _0x11250f={'where':_0x6150dc[_0x6bbd('0x37')]};return db[_0x6bbd('0x28')][_0x6bbd('0x1d')](_0x11250f)['then'](function(_0x5d0d4d){_0x506fc5[_0x6bbd('0x1d')]=_0x5d0d4d;if(_0xe6bf4c[_0x6bbd('0x2c')][_0x6bbd('0x3c')]){_0x6150dc['include']=[{'all':!![]}];}return db['ServicenowField'][_0x6bbd('0x3d')](_0x6150dc);})[_0x6bbd('0x22')](function(_0x2b499e){_0x506fc5[_0x6bbd('0x3e')]=_0x2b499e;return _0x506fc5;})[_0x6bbd('0x22')](respondWithFilteredResult(_0x4ea543,_0x6150dc))[_0x6bbd('0x3f')](handleError(_0x4ea543,null));};exports[_0x6bbd('0x40')]=function(_0x541e62,_0x55b7ec){var _0x353ece={'raw':!![],'where':{'id':_0x541e62['params']['id']}},_0x5db103={};_0x5db103['model']=_[_0x6bbd('0x2d')](db[_0x6bbd('0x28')][_0x6bbd('0x29')]);_0x5db103['query']=_[_0x6bbd('0x2d')](_0x541e62[_0x6bbd('0x2c')]);_0x5db103[_0x6bbd('0x2e')]=_['intersection'](_0x5db103['model'],_0x5db103[_0x6bbd('0x2c')]);_0x353ece[_0x6bbd('0x31')]=_[_0x6bbd('0x2f')](_0x5db103['model'],qs[_0x6bbd('0x30')](_0x541e62[_0x6bbd('0x2c')]['fields']));_0x353ece[_0x6bbd('0x31')]=_0x353ece[_0x6bbd('0x31')][_0x6bbd('0x41')]?_0x353ece[_0x6bbd('0x31')]:_0x5db103[_0x6bbd('0x2b')];if(_0x541e62['query'][_0x6bbd('0x3c')]){_0x353ece[_0x6bbd('0x42')]=[{'all':!![]}];}_0x353ece=_[_0x6bbd('0x38')]({},_0x353ece,_0x541e62[_0x6bbd('0x3b')]);return db[_0x6bbd('0x28')]['find'](_0x353ece)[_0x6bbd('0x22')](handleEntityNotFound(_0x55b7ec,null))[_0x6bbd('0x22')](respondWithResult(_0x55b7ec,null))[_0x6bbd('0x3f')](handleError(_0x55b7ec,null));};exports['create']=function(_0x462368,_0x580ba7){return db[_0x6bbd('0x28')][_0x6bbd('0x43')](_0x462368[_0x6bbd('0x44')],{})[_0x6bbd('0x22')](respondWithResult(_0x580ba7,0xc9))[_0x6bbd('0x3f')](handleError(_0x580ba7,null));};exports[_0x6bbd('0x21')]=function(_0x54bf98,_0x20abe4){if(_0x54bf98[_0x6bbd('0x44')]['id']){delete _0x54bf98[_0x6bbd('0x44')]['id'];}return db[_0x6bbd('0x28')][_0x6bbd('0x45')]({'where':{'id':_0x54bf98['params']['id']}})[_0x6bbd('0x22')](handleEntityNotFound(_0x20abe4,null))[_0x6bbd('0x22')](saveUpdates(_0x54bf98['body'],null))[_0x6bbd('0x22')](respondWithResult(_0x20abe4,null))[_0x6bbd('0x3f')](handleError(_0x20abe4,null));};exports[_0x6bbd('0x23')]=function(_0x21789a,_0x458238){return db[_0x6bbd('0x28')][_0x6bbd('0x45')]({'where':{'id':_0x21789a[_0x6bbd('0x46')]['id']}})['then'](handleEntityNotFound(_0x458238,null))[_0x6bbd('0x22')](removeEntity(_0x458238,null))[_0x6bbd('0x3f')](handleError(_0x458238,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 93128c0..70ea746 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 _0x484b=['api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','int_servicenow_fields','idField','lodash','util','../../config/logger'];(function(_0x56c852,_0x62d64f){var _0x3baa00=function(_0xf753b2){while(--_0xf753b2){_0x56c852['push'](_0x56c852['shift']());}};_0x3baa00(++_0x62d64f);}(_0x484b,0x75));var _0xb484=function(_0x2f8e9e,_0x47e70a){_0x2f8e9e=_0x2f8e9e-0x0;var _0x2d4e96=_0x484b[_0x2f8e9e];return _0x2d4e96;};'use strict';var _=require(_0xb484('0x0'));var util=require(_0xb484('0x1'));var logger=require(_0xb484('0x2'))(_0xb484('0x3'));var moment=require(_0xb484('0x4'));var BPromise=require(_0xb484('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb484('0x6'));var rimraf=require(_0xb484('0x7'));var config=require(_0xb484('0x8'));var attributes=require(_0xb484('0x9'));module['exports']=function(_0x385397,_0x5aeb32){return _0x385397['define']('ServicenowField',attributes,{'tableName':_0xb484('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb484('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7482=['moment','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x56ffcf,_0x38eb1f){var _0x3cc524=function(_0x2e650c){while(--_0x2e650c){_0x56ffcf['push'](_0x56ffcf['shift']());}};_0x3cc524(++_0x38eb1f);}(_0x7482,0x169));var _0x2748=function(_0x1b3bef,_0xcb09d1){_0x1b3bef=_0x1b3bef-0x0;var _0x2e78a3=_0x7482[_0x1b3bef];return _0x2e78a3;};'use strict';var _=require(_0x2748('0x0'));var util=require('util');var logger=require(_0x2748('0x1'))(_0x2748('0x2'));var moment=require(_0x2748('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2748('0x4'));var rimraf=require(_0x2748('0x5'));var config=require(_0x2748('0x6'));var attributes=require(_0x2748('0x7'));module[_0x2748('0x8')]=function(_0x5ad80d,_0x25199a){return _0x5ad80d[_0x2748('0x9')](_0x2748('0xa'),attributes,{'tableName':_0x2748('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x2748('0xc'),_0x2748('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 17f58d0..b6ac9b1 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e8883,_0x204625){var _0x330d66=function(_0x181542){while(--_0x181542){_0x2e8883['push'](_0x2e8883['shift']());}};_0x330d66(++_0x204625);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7650,_0x458946){_0x3a7650=_0x3a7650-0x0;var _0x136de7=_0xe706[_0x3a7650];return _0x136de7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xda3f,0xec));var _0xfda3=function(_0xe0d8f6,_0x31ec25){_0xe0d8f6=_0xe0d8f6-0x0;var _0x445b64=_0xda3f[_0xe0d8f6];return _0x445b64;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4130cbb..beb6917 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36c997,_0x5d67e0){var _0x2be027=function(_0x2c3024){while(--_0x2c3024){_0x36c997['push'](_0x36c997['shift']());}};_0x2be027(++_0x5d67e0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 11a9719..ae7434f 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(_0x3ac048,_0x14d666){var _0x325d08=function(_0x1014a7){while(--_0x1014a7){_0x3ac048['push'](_0x3ac048['shift']());}};_0x325d08(++_0x14d666);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x1bd786,_0x534d74){var _0x5ad218=function(_0x89661d){while(--_0x89661d){_0x1bd786['push'](_0x1bd786['shift']());}};_0x5ad218(++_0x534d74);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 355a3e1..52e7189 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 _0xfb2f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','sort','pick','where','merge','options','SugarcrmAccount','then','includeAll','include','rows','catch','show','find','create','body','update','params','getConfigurations','findOne','order','filter','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','username','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','stringify','Calls','values','module_fields','remove','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x5cc885,_0x48635a){var _0x400d9a=function(_0xecb0cd){while(--_0xecb0cd){_0x5cc885['push'](_0x5cc885['shift']());}};_0x400d9a(++_0x48635a);}(_0xfb2f,0x1f0));var _0xffb2=function(_0x490f5b,_0x5aec79){_0x490f5b=_0x490f5b-0x0;var _0x31770a=_0xfb2f[_0x490f5b];return _0x31770a;};'use strict';var emlformat=require(_0xffb2('0x0'));var rimraf=require(_0xffb2('0x1'));var zipdir=require(_0xffb2('0x2'));var jsonpatch=require(_0xffb2('0x3'));var rp=require(_0xffb2('0x4'));var moment=require(_0xffb2('0x5'));var BPromise=require(_0xffb2('0x6'));var Mustache=require(_0xffb2('0x7'));var util=require('util');var path=require(_0xffb2('0x8'));var sox=require('sox');var csv=require(_0xffb2('0x9'));var ejs=require(_0xffb2('0xa'));var fs=require('fs');var fs_extra=require(_0xffb2('0xb'));var _=require(_0xffb2('0xc'));var squel=require(_0xffb2('0xd'));var crypto=require(_0xffb2('0xe'));var jsforce=require(_0xffb2('0xf'));var deskjs=require(_0xffb2('0x10'));var toCsv=require(_0xffb2('0x9'));var querystring=require(_0xffb2('0x11'));var Papa=require(_0xffb2('0x12'));var Redis=require(_0xffb2('0x13'));var authService=require(_0xffb2('0x14'));var qs=require(_0xffb2('0x15'));var as=require(_0xffb2('0x16'));var hardwareService=require(_0xffb2('0x17'));var logger=require(_0xffb2('0x18'))(_0xffb2('0x19'));var utils=require(_0xffb2('0x1a'));var config=require(_0xffb2('0x1b'));var licenseUtil=require(_0xffb2('0x1c'));var db=require(_0xffb2('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b46c5,_0x2e2825){_0x2e2825=_0x2e2825||0xcc;return function(_0x170534){if(_0x170534){return _0x5b46c5['sendStatus'](_0x2e2825);}return _0x5b46c5[_0xffb2('0x1e')](_0x2e2825)['end']();};}function respondWithResult(_0x557dfa,_0x5202f7){_0x5202f7=_0x5202f7||0xc8;return function(_0x21c1bd){if(_0x21c1bd){return _0x557dfa[_0xffb2('0x1e')](_0x5202f7)[_0xffb2('0x1f')](_0x21c1bd);}};}function respondWithFilteredResult(_0x5801eb,_0x471df2){return function(_0x4cc02d){if(_0x4cc02d){var _0x2125b3=typeof _0x471df2['offset']===_0xffb2('0x20')&&typeof _0x471df2['limit']===_0xffb2('0x20');var _0x4e1452=_0x4cc02d[_0xffb2('0x21')];var _0x195e3b=_0x2125b3?0x0:_0x471df2[_0xffb2('0x22')];var _0x3c05a7=_0x2125b3?_0x4cc02d[_0xffb2('0x21')]:_0x471df2['offset']+_0x471df2[_0xffb2('0x23')];var _0x334864;if(_0x3c05a7>=_0x4e1452){_0x3c05a7=_0x4e1452;_0x334864=0xc8;}else{_0x334864=0xce;}_0x5801eb['status'](_0x334864);return _0x5801eb[_0xffb2('0x24')](_0xffb2('0x25'),_0x195e3b+'-'+_0x3c05a7+'/'+_0x4e1452)[_0xffb2('0x1f')](_0x4cc02d);}return null;};}function patchUpdates(_0x1195d4){return function(_0x1499fd){try{jsonpatch[_0xffb2('0x26')](_0x1499fd,_0x1195d4,!![]);}catch(_0x55ecd3){return BPromise[_0xffb2('0x27')](_0x55ecd3);}return _0x1499fd[_0xffb2('0x28')]();};}function saveUpdates(_0x111e62,_0x3857a5){return function(_0x21963d){if(_0x21963d){return _0x21963d['update'](_0x111e62)['then'](function(_0x5474da){return _0x5474da;});}return null;};}function removeEntity(_0x3da25f,_0x266547){return function(_0x259e85){if(_0x259e85){return _0x259e85[_0xffb2('0x29')]()['then'](function(){_0x3da25f[_0xffb2('0x1e')](0xcc)[_0xffb2('0x2a')]();});}};}function handleEntityNotFound(_0xd431d0,_0x577510){return function(_0x75b4c4){if(!_0x75b4c4){_0xd431d0[_0xffb2('0x2b')](0x194);}return _0x75b4c4;};}function handleError(_0x336b23,_0x57f210){_0x57f210=_0x57f210||0x1f4;return function(_0x10d145){logger[_0xffb2('0x2c')](_0x10d145[_0xffb2('0x2d')]);if(_0x10d145[_0xffb2('0x2e')]){delete _0x10d145[_0xffb2('0x2e')];}_0x336b23['status'](_0x57f210)[_0xffb2('0x2f')](_0x10d145);};}exports[_0xffb2('0x30')]=function(_0x266d9d,_0x53561b){var _0x1051d4={},_0x25b5e8={},_0xcae620={'count':0x0,'rows':[]};var _0x16d370=_[_0xffb2('0x31')](db['SugarcrmAccount'][_0xffb2('0x32')],function(_0xed9134){return{'name':_0xed9134[_0xffb2('0x33')],'type':_0xed9134[_0xffb2('0x34')][_0xffb2('0x35')]};});_0x25b5e8['model']=_[_0xffb2('0x31')](_0x16d370,'name');_0x25b5e8[_0xffb2('0x36')]=_[_0xffb2('0x37')](_0x266d9d[_0xffb2('0x36')]);_0x25b5e8[_0xffb2('0x38')]=_[_0xffb2('0x39')](_0x25b5e8['model'],_0x25b5e8[_0xffb2('0x36')]);_0x1051d4['attributes']=_[_0xffb2('0x39')](_0x25b5e8['model'],qs[_0xffb2('0x3a')](_0x266d9d[_0xffb2('0x36')]['fields']));_0x1051d4['attributes']=_0x1051d4[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x1051d4[_0xffb2('0x3b')]:_0x25b5e8[_0xffb2('0x3d')];if(!_0x266d9d[_0xffb2('0x36')]['hasOwnProperty'](_0xffb2('0x3e'))){_0x1051d4['limit']=qs[_0xffb2('0x23')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x23')]);_0x1051d4['offset']=qs[_0xffb2('0x22')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x22')]);}_0x1051d4['order']=qs[_0xffb2('0x3f')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x3f')]);_0x1051d4['where']=qs[_0xffb2('0x38')](_[_0xffb2('0x40')](_0x266d9d[_0xffb2('0x36')],_0x25b5e8[_0xffb2('0x38')]),_0x16d370);if(_0x266d9d[_0xffb2('0x36')]['filter']){_0x1051d4[_0xffb2('0x41')]=_[_0xffb2('0x42')](_0x1051d4[_0xffb2('0x41')],{'$or':_[_0xffb2('0x31')](_0x16d370,function(_0xbafdd0){if(_0xbafdd0[_0xffb2('0x34')]!=='VIRTUAL'){var _0x20632c={};_0x20632c[_0xbafdd0[_0xffb2('0x2e')]]={'$like':'%'+_0x266d9d[_0xffb2('0x36')]['filter']+'%'};return _0x20632c;}})});}_0x1051d4=_[_0xffb2('0x42')]({},_0x1051d4,_0x266d9d[_0xffb2('0x43')]);var _0x226b20={'where':_0x1051d4[_0xffb2('0x41')]};return db[_0xffb2('0x44')][_0xffb2('0x21')](_0x226b20)[_0xffb2('0x45')](function(_0x556e6d){_0xcae620['count']=_0x556e6d;if(_0x266d9d['query'][_0xffb2('0x46')]){_0x1051d4[_0xffb2('0x47')]=[{'all':!![]}];}return db[_0xffb2('0x44')]['findAll'](_0x1051d4);})[_0xffb2('0x45')](function(_0x4a9a70){_0xcae620[_0xffb2('0x48')]=_0x4a9a70;return _0xcae620;})[_0xffb2('0x45')](respondWithFilteredResult(_0x53561b,_0x1051d4))[_0xffb2('0x49')](handleError(_0x53561b,null));};exports[_0xffb2('0x4a')]=function(_0x104e87,_0x536333){var _0x4b930e={'raw':![],'where':{'id':_0x104e87['params']['id']}},_0x13720d={};_0x13720d[_0xffb2('0x3d')]=_['keys'](db[_0xffb2('0x44')]['rawAttributes']);_0x13720d[_0xffb2('0x36')]=_[_0xffb2('0x37')](_0x104e87['query']);_0x13720d[_0xffb2('0x38')]=_[_0xffb2('0x39')](_0x13720d[_0xffb2('0x3d')],_0x13720d[_0xffb2('0x36')]);_0x4b930e[_0xffb2('0x3b')]=_[_0xffb2('0x39')](_0x13720d[_0xffb2('0x3d')],qs['fields'](_0x104e87[_0xffb2('0x36')]['fields']));_0x4b930e[_0xffb2('0x3b')]=_0x4b930e[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x4b930e['attributes']:_0x13720d[_0xffb2('0x3d')];if(_0x104e87[_0xffb2('0x36')][_0xffb2('0x46')]){_0x4b930e[_0xffb2('0x47')]=[{'all':!![]}];}_0x4b930e=_[_0xffb2('0x42')]({},_0x4b930e,_0x104e87[_0xffb2('0x43')]);return db[_0xffb2('0x44')][_0xffb2('0x4b')](_0x4b930e)[_0xffb2('0x45')](handleEntityNotFound(_0x536333,null))[_0xffb2('0x45')](respondWithResult(_0x536333,null))[_0xffb2('0x49')](handleError(_0x536333,null));};exports[_0xffb2('0x4c')]=function(_0x4e0c3a,_0x4ec913){return db[_0xffb2('0x44')]['create'](_0x4e0c3a[_0xffb2('0x4d')],{})[_0xffb2('0x45')](respondWithResult(_0x4ec913,0xc9))['catch'](handleError(_0x4ec913,null));};exports[_0xffb2('0x4e')]=function(_0x3fd925,_0xd544a6){if(_0x3fd925['body']['id']){delete _0x3fd925[_0xffb2('0x4d')]['id'];}return db[_0xffb2('0x44')]['find']({'where':{'id':_0x3fd925[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0xd544a6,null))[_0xffb2('0x45')](saveUpdates(_0x3fd925['body'],null))[_0xffb2('0x45')](respondWithResult(_0xd544a6,null))[_0xffb2('0x49')](handleError(_0xd544a6,null));};exports[_0xffb2('0x29')]=function(_0x122f8b,_0x1f6bbb){return db[_0xffb2('0x44')][_0xffb2('0x4b')]({'where':{'id':_0x122f8b[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x1f6bbb,null))['then'](removeEntity(_0x1f6bbb,null))[_0xffb2('0x49')](handleError(_0x1f6bbb,null));};exports[_0xffb2('0x50')]=function(_0x259dae,_0x50e60b,_0x4b1a70){var _0x499a82={};var _0x5b506e={};var _0x119c10;var _0x55c9eb;return db['SugarcrmAccount'][_0xffb2('0x51')]({'where':{'id':_0x259dae[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x50e60b,null))['then'](function(_0x5c71f7){if(_0x5c71f7){_0x119c10=_0x5c71f7;_0x5b506e['model']=_[_0xffb2('0x37')](db['SugarcrmConfiguration']['rawAttributes']);_0x5b506e['query']=_['keys'](_0x259dae[_0xffb2('0x36')]);_0x5b506e[_0xffb2('0x38')]=_['intersection'](_0x5b506e[_0xffb2('0x3d')],_0x5b506e['query']);_0x499a82['attributes']=_['intersection'](_0x5b506e['model'],qs[_0xffb2('0x3a')](_0x259dae['query'][_0xffb2('0x3a')]));_0x499a82[_0xffb2('0x3b')]=_0x499a82[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x499a82[_0xffb2('0x3b')]:_0x5b506e['model'];_0x499a82[_0xffb2('0x52')]=qs[_0xffb2('0x3f')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x3f')]);_0x499a82['where']=qs[_0xffb2('0x38')](_[_0xffb2('0x40')](_0x259dae['query'],_0x5b506e[_0xffb2('0x38')]));if(_0x259dae['query']['filter']){_0x499a82[_0xffb2('0x41')]=_[_0xffb2('0x42')](_0x499a82[_0xffb2('0x41')],{'$or':_[_0xffb2('0x31')](_0x499a82[_0xffb2('0x3b')],function(_0x3b253f){var _0x12a6c0={};_0x12a6c0[_0x3b253f]={'$like':'%'+_0x259dae['query'][_0xffb2('0x53')]+'%'};return _0x12a6c0;})});}_0x499a82=_[_0xffb2('0x42')]({},_0x499a82,_0x259dae['options']);return _0x119c10[_0xffb2('0x50')](_0x499a82);}})[_0xffb2('0x45')](function(_0x34ecd4){if(_0x34ecd4){_0x55c9eb=_0x34ecd4[_0xffb2('0x3c')];if(!_0x259dae[_0xffb2('0x36')][_0xffb2('0x54')](_0xffb2('0x3e'))){_0x499a82[_0xffb2('0x23')]=qs[_0xffb2('0x23')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x23')]);_0x499a82['offset']=qs[_0xffb2('0x22')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x22')]);}return _0x119c10['getConfigurations'](_0x499a82);}})[_0xffb2('0x45')](function(_0x584b37){if(_0x584b37){return _0x584b37?{'count':_0x55c9eb,'rows':_0x584b37}:null;}})[_0xffb2('0x45')](respondWithResult(_0x50e60b,null))[_0xffb2('0x49')](handleError(_0x50e60b,null));};exports[_0xffb2('0x55')]=function(_0x22a110,_0x1c62d2,_0xe1ed7){if(_0x22a110['body']['id']){delete _0x22a110[_0xffb2('0x4d')]['id'];}return db[_0xffb2('0x44')][_0xffb2('0x51')]({'where':{'id':_0x22a110[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x1c62d2,null))[_0xffb2('0x45')](function(_0x469317){if(_0x469317){_0x22a110[_0xffb2('0x4d')][_0xffb2('0x56')]=_0x469317['id'];_0x22a110[_0xffb2('0x4d')]['Subjects']=integrations[_0xffb2('0x57')](_0x22a110[_0xffb2('0x4d')][_0xffb2('0x58')],_0x22a110['body'][_0xffb2('0x34')]);_0x22a110['body'][_0xffb2('0x59')]=integrations[_0xffb2('0x5a')](_0x22a110[_0xffb2('0x4d')]['channel'],_0x22a110[_0xffb2('0x4d')][_0xffb2('0x34')]);return db[_0xffb2('0x5b')][_0xffb2('0x4c')](_0x22a110[_0xffb2('0x4d')],{'include':[{'model':db[_0xffb2('0x5c')],'as':'Subjects'},{'model':db[_0xffb2('0x5c')],'as':_0xffb2('0x59')}]});}return null;})['then'](respondWithResult(_0x1c62d2,null))['catch'](handleError(_0x1c62d2,null));};exports[_0xffb2('0x5d')]=function(_0x145c49,_0x542a3d,_0x3ecef0){var _0x4c81e8='';var _0x1fc10e=['id','name',_0xffb2('0x5e'),_0xffb2('0x5f'),_0xffb2('0x60'),'date_start',_0xffb2('0x61'),_0xffb2('0x62'),'parent_id',_0xffb2('0x63'),'parent_name',_0xffb2('0x64')];return db[_0xffb2('0x44')]['findOne']({'where':{'id':_0x145c49[_0xffb2('0x4f')]['id']},'attributes':['id','username',_0xffb2('0x65'),_0xffb2('0x66')]})[_0xffb2('0x45')](handleEntityNotFound(_0x542a3d,null))[_0xffb2('0x45')](function(_0xfe14e0){if(_0xfe14e0){_0x4c81e8=_0xfe14e0[_0xffb2('0x66')];var _0x33122d=_0x4c81e8[_0xffb2('0x67')](-0x1);if(_0x33122d==='/'){_0x4c81e8=_0x4c81e8[_0xffb2('0x68')](0x0,_0x4c81e8[_0xffb2('0x69')](_0x33122d));}return rp({'method':_0xffb2('0x6a'),'uri':util['format'](_0xffb2('0x6b'),_0x4c81e8,_0xffb2('0x6c')),'json':!![],'form':{'method':'login','input_type':_0xffb2('0x6d'),'response_type':_0xffb2('0x6d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xfe14e0[_0xffb2('0x6e')],'password':_0xfe14e0[_0xffb2('0x65')],'encryption':'PLAIN'},'application':_0xffb2('0x6f')})}});}})[_0xffb2('0x45')](function(_0x23db6a){if(_0x23db6a&&_0x23db6a['name']!=='Invalid\x20Login'&&_0x23db6a[_0xffb2('0x2e')]!==_0xffb2('0x70')){return rp({'method':_0xffb2('0x6a'),'uri':util[_0xffb2('0x71')](_0xffb2('0x6b'),_0x4c81e8,_0xffb2('0x6c')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xffb2('0x6d'),'rest_data':JSON[_0xffb2('0x72')]({'session':_0x23db6a['id'],'module_name':_0xffb2('0x73')})}})[_0xffb2('0x45')](function(_0x20e280){if(_0x20e280){var _0x53e7e7=_[_0xffb2('0x74')](_0x20e280[_0xffb2('0x75')]);_[_0xffb2('0x76')](_0x53e7e7,function(_0x2e16f2){return _0x1fc10e['includes'](_0x2e16f2[_0xffb2('0x2e')]);});return{'count':_0x53e7e7[_0xffb2('0x3c')],'rows':_[_0xffb2('0x31')](_0x53e7e7,function(_0x26342a){return{'id':_0x26342a[_0xffb2('0x2e')],'name':_0x26342a[_0xffb2('0x77')],'custom':_[_0xffb2('0x78')](_0x26342a[_0xffb2('0x2e')],'_c')?!![]:![],'options':_0x26342a['options']?_[_0xffb2('0x31')](_[_0xffb2('0x74')](_0x26342a[_0xffb2('0x43')]),function(_0x1d6c67){return{'name':_0x1d6c67['value'],'value':_0x1d6c67[_0xffb2('0x2e')]};}):[]};})};}})[_0xffb2('0x45')](respondWithResult(_0x542a3d,null))[_0xffb2('0x49')](function(_0x23c403){var _0x272d6d=_0x145c49[_0xffb2('0x36')]['test']?0x1f4:_0x23c403['statusCode']||0x1f4;logger[_0xffb2('0x2c')](_0xffb2('0x79'),_0xffb2('0x5d'),_0x272d6d,JSON[_0xffb2('0x72')](_0x23c403));delete _0x23c403[_0xffb2('0x2e')];if(_0x272d6d===0x191){_0x272d6d=0x190;}_0x542a3d[_0xffb2('0x1e')](_0x272d6d)['send'](_0x145c49['query'][_0xffb2('0x7a')]?{'message':_0xffb2('0x7b'),'statusCode':_0x23c403['statusCode']}:_0x23c403);});}else{var _0x2aabe2=0x1f4;_0x542a3d[_0xffb2('0x1e')](_0x2aabe2)[_0xffb2('0x2f')]({'message':_0xffb2('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd71e=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','password','Invalid\x20Login','POST','%s%s','get_module_fields','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key'];(function(_0x336a92,_0x3a3a2b){var _0x454e08=function(_0x1f0604){while(--_0x1f0604){_0x336a92['push'](_0x336a92['shift']());}};_0x454e08(++_0x3a3a2b);}(_0xd71e,0x12e));var _0xed71=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xd71e[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0xed71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed71('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xed71('0x2'));var Mustache=require(_0xed71('0x3'));var util=require(_0xed71('0x4'));var path=require(_0xed71('0x5'));var sox=require(_0xed71('0x6'));var csv=require('to-csv');var ejs=require(_0xed71('0x7'));var fs=require('fs');var fs_extra=require(_0xed71('0x8'));var _=require(_0xed71('0x9'));var squel=require(_0xed71('0xa'));var crypto=require(_0xed71('0xb'));var jsforce=require(_0xed71('0xc'));var deskjs=require(_0xed71('0xd'));var toCsv=require(_0xed71('0xe'));var querystring=require('querystring');var Papa=require(_0xed71('0xf'));var Redis=require(_0xed71('0x10'));var authService=require(_0xed71('0x11'));var qs=require(_0xed71('0x12'));var as=require(_0xed71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed71('0x14'));var utils=require(_0xed71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed71('0x16'));var db=require(_0xed71('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2dc65b,_0x26d4ea){_0x26d4ea=_0x26d4ea||0xcc;return function(_0x89c719){if(_0x89c719){return _0x2dc65b['sendStatus'](_0x26d4ea);}return _0x2dc65b[_0xed71('0x18')](_0x26d4ea)[_0xed71('0x19')]();};}function respondWithResult(_0x32920b,_0x17852f){_0x17852f=_0x17852f||0xc8;return function(_0x3a5ca2){if(_0x3a5ca2){return _0x32920b[_0xed71('0x18')](_0x17852f)[_0xed71('0x1a')](_0x3a5ca2);}};}function respondWithFilteredResult(_0x366369,_0x1bf275){return function(_0x3c50a7){if(_0x3c50a7){var _0x5831de=typeof _0x1bf275[_0xed71('0x1b')]===_0xed71('0x1c')&&typeof _0x1bf275['limit']===_0xed71('0x1c');var _0x182b0e=_0x3c50a7[_0xed71('0x1d')];var _0x45cdd5=_0x5831de?0x0:_0x1bf275[_0xed71('0x1b')];var _0x5c179b=_0x5831de?_0x3c50a7[_0xed71('0x1d')]:_0x1bf275[_0xed71('0x1b')]+_0x1bf275[_0xed71('0x1e')];var _0x1e7c3d;if(_0x5c179b>=_0x182b0e){_0x5c179b=_0x182b0e;_0x1e7c3d=0xc8;}else{_0x1e7c3d=0xce;}_0x366369['status'](_0x1e7c3d);return _0x366369[_0xed71('0x1f')](_0xed71('0x20'),_0x45cdd5+'-'+_0x5c179b+'/'+_0x182b0e)[_0xed71('0x1a')](_0x3c50a7);}return null;};}function patchUpdates(_0x7e13f2){return function(_0x3a49a2){try{jsonpatch['apply'](_0x3a49a2,_0x7e13f2,!![]);}catch(_0xe79e21){return BPromise[_0xed71('0x21')](_0xe79e21);}return _0x3a49a2['save']();};}function saveUpdates(_0x3a6ba4,_0x1fd20e){return function(_0x385354){if(_0x385354){return _0x385354[_0xed71('0x22')](_0x3a6ba4)[_0xed71('0x23')](function(_0x1d4092){return _0x1d4092;});}return null;};}function removeEntity(_0x5df3b9,_0x1d25c5){return function(_0xee613c){if(_0xee613c){return _0xee613c[_0xed71('0x24')]()[_0xed71('0x23')](function(){_0x5df3b9[_0xed71('0x18')](0xcc)[_0xed71('0x19')]();});}};}function handleEntityNotFound(_0x3d77a6,_0x3f8a6e){return function(_0x37efd4){if(!_0x37efd4){_0x3d77a6[_0xed71('0x25')](0x194);}return _0x37efd4;};}function handleError(_0xe6e615,_0x3d7e6f){_0x3d7e6f=_0x3d7e6f||0x1f4;return function(_0x5ed539){logger[_0xed71('0x26')](_0x5ed539[_0xed71('0x27')]);if(_0x5ed539[_0xed71('0x28')]){delete _0x5ed539['name'];}_0xe6e615[_0xed71('0x18')](_0x3d7e6f)[_0xed71('0x29')](_0x5ed539);};}exports[_0xed71('0x2a')]=function(_0x6a3c9a,_0x305df7){var _0x2065bd={},_0x4f2529={},_0x240517={'count':0x0,'rows':[]};var _0x3d09eb=_[_0xed71('0x2b')](db[_0xed71('0x2c')][_0xed71('0x2d')],function(_0x1df07b){return{'name':_0x1df07b[_0xed71('0x2e')],'type':_0x1df07b[_0xed71('0x2f')][_0xed71('0x30')]};});_0x4f2529[_0xed71('0x31')]=_[_0xed71('0x2b')](_0x3d09eb,_0xed71('0x28'));_0x4f2529['query']=_[_0xed71('0x32')](_0x6a3c9a[_0xed71('0x33')]);_0x4f2529['filters']=_[_0xed71('0x34')](_0x4f2529[_0xed71('0x31')],_0x4f2529['query']);_0x2065bd[_0xed71('0x35')]=_[_0xed71('0x34')](_0x4f2529[_0xed71('0x31')],qs[_0xed71('0x36')](_0x6a3c9a[_0xed71('0x33')]['fields']));_0x2065bd[_0xed71('0x35')]=_0x2065bd[_0xed71('0x35')][_0xed71('0x37')]?_0x2065bd[_0xed71('0x35')]:_0x4f2529[_0xed71('0x31')];if(!_0x6a3c9a['query'][_0xed71('0x38')](_0xed71('0x39'))){_0x2065bd[_0xed71('0x1e')]=qs['limit'](_0x6a3c9a[_0xed71('0x33')][_0xed71('0x1e')]);_0x2065bd[_0xed71('0x1b')]=qs['offset'](_0x6a3c9a[_0xed71('0x33')][_0xed71('0x1b')]);}_0x2065bd[_0xed71('0x3a')]=qs[_0xed71('0x3b')](_0x6a3c9a[_0xed71('0x33')][_0xed71('0x3b')]);_0x2065bd[_0xed71('0x3c')]=qs[_0xed71('0x3d')](_['pick'](_0x6a3c9a[_0xed71('0x33')],_0x4f2529[_0xed71('0x3d')]),_0x3d09eb);if(_0x6a3c9a[_0xed71('0x33')][_0xed71('0x3e')]){_0x2065bd[_0xed71('0x3c')]=_[_0xed71('0x3f')](_0x2065bd['where'],{'$or':_[_0xed71('0x2b')](_0x3d09eb,function(_0x143ac8){if(_0x143ac8[_0xed71('0x2f')]!==_0xed71('0x40')){var _0x412a85={};_0x412a85[_0x143ac8['name']]={'$like':'%'+_0x6a3c9a[_0xed71('0x33')][_0xed71('0x3e')]+'%'};return _0x412a85;}})});}_0x2065bd=_[_0xed71('0x3f')]({},_0x2065bd,_0x6a3c9a[_0xed71('0x41')]);var _0x5af580={'where':_0x2065bd[_0xed71('0x3c')]};return db[_0xed71('0x2c')][_0xed71('0x1d')](_0x5af580)[_0xed71('0x23')](function(_0x230913){_0x240517[_0xed71('0x1d')]=_0x230913;if(_0x6a3c9a[_0xed71('0x33')][_0xed71('0x42')]){_0x2065bd[_0xed71('0x43')]=[{'all':!![]}];}return db[_0xed71('0x2c')][_0xed71('0x44')](_0x2065bd);})[_0xed71('0x23')](function(_0x1dc555){_0x240517['rows']=_0x1dc555;return _0x240517;})[_0xed71('0x23')](respondWithFilteredResult(_0x305df7,_0x2065bd))[_0xed71('0x45')](handleError(_0x305df7,null));};exports['show']=function(_0x1b68ba,_0x2fcf00){var _0x547360={'raw':![],'where':{'id':_0x1b68ba[_0xed71('0x46')]['id']}},_0x1f9b37={};_0x1f9b37['model']=_[_0xed71('0x32')](db[_0xed71('0x2c')][_0xed71('0x2d')]);_0x1f9b37[_0xed71('0x33')]=_['keys'](_0x1b68ba['query']);_0x1f9b37[_0xed71('0x3d')]=_[_0xed71('0x34')](_0x1f9b37[_0xed71('0x31')],_0x1f9b37[_0xed71('0x33')]);_0x547360[_0xed71('0x35')]=_[_0xed71('0x34')](_0x1f9b37[_0xed71('0x31')],qs[_0xed71('0x36')](_0x1b68ba[_0xed71('0x33')][_0xed71('0x36')]));_0x547360['attributes']=_0x547360[_0xed71('0x35')][_0xed71('0x37')]?_0x547360[_0xed71('0x35')]:_0x1f9b37[_0xed71('0x31')];if(_0x1b68ba[_0xed71('0x33')][_0xed71('0x42')]){_0x547360['include']=[{'all':!![]}];}_0x547360=_[_0xed71('0x3f')]({},_0x547360,_0x1b68ba[_0xed71('0x41')]);return db['SugarcrmAccount'][_0xed71('0x47')](_0x547360)[_0xed71('0x23')](handleEntityNotFound(_0x2fcf00,null))[_0xed71('0x23')](respondWithResult(_0x2fcf00,null))[_0xed71('0x45')](handleError(_0x2fcf00,null));};exports[_0xed71('0x48')]=function(_0x22b6b4,_0xf7c171){return db['SugarcrmAccount'][_0xed71('0x48')](_0x22b6b4[_0xed71('0x49')],{})[_0xed71('0x23')](respondWithResult(_0xf7c171,0xc9))[_0xed71('0x45')](handleError(_0xf7c171,null));};exports['update']=function(_0x5ac679,_0x5b2c93){if(_0x5ac679[_0xed71('0x49')]['id']){delete _0x5ac679[_0xed71('0x49')]['id'];}return db[_0xed71('0x2c')]['find']({'where':{'id':_0x5ac679['params']['id']}})[_0xed71('0x23')](handleEntityNotFound(_0x5b2c93,null))[_0xed71('0x23')](saveUpdates(_0x5ac679[_0xed71('0x49')],null))['then'](respondWithResult(_0x5b2c93,null))['catch'](handleError(_0x5b2c93,null));};exports[_0xed71('0x24')]=function(_0x48a654,_0x1cb9be){return db['SugarcrmAccount'][_0xed71('0x47')]({'where':{'id':_0x48a654['params']['id']}})[_0xed71('0x23')](handleEntityNotFound(_0x1cb9be,null))[_0xed71('0x23')](removeEntity(_0x1cb9be,null))[_0xed71('0x45')](handleError(_0x1cb9be,null));};exports[_0xed71('0x4a')]=function(_0x543454,_0x902650,_0xb202c9){var _0x22e649={};var _0xcfbe5f={};var _0x443f9b;var _0x37e34b;return db['SugarcrmAccount'][_0xed71('0x4b')]({'where':{'id':_0x543454['params']['id']}})[_0xed71('0x23')](handleEntityNotFound(_0x902650,null))[_0xed71('0x23')](function(_0x1f86df){if(_0x1f86df){_0x443f9b=_0x1f86df;_0xcfbe5f[_0xed71('0x31')]=_[_0xed71('0x32')](db[_0xed71('0x4c')]['rawAttributes']);_0xcfbe5f[_0xed71('0x33')]=_[_0xed71('0x32')](_0x543454[_0xed71('0x33')]);_0xcfbe5f[_0xed71('0x3d')]=_[_0xed71('0x34')](_0xcfbe5f[_0xed71('0x31')],_0xcfbe5f[_0xed71('0x33')]);_0x22e649[_0xed71('0x35')]=_[_0xed71('0x34')](_0xcfbe5f[_0xed71('0x31')],qs[_0xed71('0x36')](_0x543454[_0xed71('0x33')][_0xed71('0x36')]));_0x22e649[_0xed71('0x35')]=_0x22e649[_0xed71('0x35')][_0xed71('0x37')]?_0x22e649[_0xed71('0x35')]:_0xcfbe5f['model'];_0x22e649['order']=qs[_0xed71('0x3b')](_0x543454['query']['sort']);_0x22e649['where']=qs[_0xed71('0x3d')](_['pick'](_0x543454[_0xed71('0x33')],_0xcfbe5f['filters']));if(_0x543454['query']['filter']){_0x22e649['where']=_[_0xed71('0x3f')](_0x22e649[_0xed71('0x3c')],{'$or':_[_0xed71('0x2b')](_0x22e649[_0xed71('0x35')],function(_0x1c1ba9){var _0x54cb4d={};_0x54cb4d[_0x1c1ba9]={'$like':'%'+_0x543454[_0xed71('0x33')]['filter']+'%'};return _0x54cb4d;})});}_0x22e649=_[_0xed71('0x3f')]({},_0x22e649,_0x543454['options']);return _0x443f9b[_0xed71('0x4a')](_0x22e649);}})[_0xed71('0x23')](function(_0x3d0464){if(_0x3d0464){_0x37e34b=_0x3d0464['length'];if(!_0x543454['query'][_0xed71('0x38')](_0xed71('0x39'))){_0x22e649[_0xed71('0x1e')]=qs[_0xed71('0x1e')](_0x543454['query'][_0xed71('0x1e')]);_0x22e649[_0xed71('0x1b')]=qs[_0xed71('0x1b')](_0x543454[_0xed71('0x33')][_0xed71('0x1b')]);}return _0x443f9b[_0xed71('0x4a')](_0x22e649);}})[_0xed71('0x23')](function(_0x1a0ab3){if(_0x1a0ab3){return _0x1a0ab3?{'count':_0x37e34b,'rows':_0x1a0ab3}:null;}})[_0xed71('0x23')](respondWithResult(_0x902650,null))[_0xed71('0x45')](handleError(_0x902650,null));};exports[_0xed71('0x4d')]=function(_0xbbfe74,_0x3bb682,_0x3e5598){if(_0xbbfe74[_0xed71('0x49')]['id']){delete _0xbbfe74[_0xed71('0x49')]['id'];}return db[_0xed71('0x2c')][_0xed71('0x4b')]({'where':{'id':_0xbbfe74[_0xed71('0x46')]['id']}})[_0xed71('0x23')](handleEntityNotFound(_0x3bb682,null))[_0xed71('0x23')](function(_0x4dfa75){if(_0x4dfa75){_0xbbfe74[_0xed71('0x49')]['AccountId']=_0x4dfa75['id'];_0xbbfe74[_0xed71('0x49')][_0xed71('0x4e')]=integrations[_0xed71('0x4f')](_0xbbfe74[_0xed71('0x49')][_0xed71('0x50')],_0xbbfe74[_0xed71('0x49')]['type']);_0xbbfe74[_0xed71('0x49')]['Descriptions']=integrations[_0xed71('0x51')](_0xbbfe74[_0xed71('0x49')][_0xed71('0x50')],_0xbbfe74[_0xed71('0x49')]['type']);return db[_0xed71('0x4c')]['create'](_0xbbfe74['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xed71('0x4e')},{'model':db['SugarcrmField'],'as':_0xed71('0x52')}]});}return null;})[_0xed71('0x23')](respondWithResult(_0x3bb682,null))[_0xed71('0x45')](handleError(_0x3bb682,null));};exports[_0xed71('0x53')]=function(_0x298cd5,_0x2229a9,_0x176a7c){var _0x59287e='';var _0x5d16b1=['id',_0xed71('0x28'),_0xed71('0x54'),_0xed71('0x55'),'description',_0xed71('0x56'),_0xed71('0x57'),_0xed71('0x58'),_0xed71('0x59'),_0xed71('0x5a'),_0xed71('0x5b'),_0xed71('0x5c')];return db[_0xed71('0x2c')]['findOne']({'where':{'id':_0x298cd5[_0xed71('0x46')]['id']},'attributes':['id',_0xed71('0x5d'),'password',_0xed71('0x5e')]})[_0xed71('0x23')](handleEntityNotFound(_0x2229a9,null))[_0xed71('0x23')](function(_0x5c533b){if(_0x5c533b){_0x59287e=_0x5c533b[_0xed71('0x5e')];var _0x3dcacc=_0x59287e[_0xed71('0x5f')](-0x1);if(_0x3dcacc==='/'){_0x59287e=_0x59287e[_0xed71('0x60')](0x0,_0x59287e[_0xed71('0x61')](_0x3dcacc));}return rp({'method':'POST','uri':util[_0xed71('0x62')]('%s%s',_0x59287e,_0xed71('0x63')),'json':!![],'form':{'method':_0xed71('0x64'),'input_type':'JSON','response_type':_0xed71('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5c533b[_0xed71('0x5d')],'password':_0x5c533b[_0xed71('0x66')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x3ede61){if(_0x3ede61&&_0x3ede61[_0xed71('0x28')]!==_0xed71('0x67')&&_0x3ede61['name']!=='Password\x20Expired'){return rp({'method':_0xed71('0x68'),'uri':util[_0xed71('0x62')](_0xed71('0x69'),_0x59287e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xed71('0x6a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3ede61['id'],'module_name':'Calls'})}})[_0xed71('0x23')](function(_0x2a260f){if(_0x2a260f){var _0x4acf66=_[_0xed71('0x6b')](_0x2a260f[_0xed71('0x6c')]);_[_0xed71('0x6d')](_0x4acf66,function(_0x1c815b){return _0x5d16b1[_0xed71('0x6e')](_0x1c815b['name']);});return{'count':_0x4acf66['length'],'rows':_[_0xed71('0x2b')](_0x4acf66,function(_0x30506c){return{'id':_0x30506c[_0xed71('0x28')],'name':_0x30506c[_0xed71('0x6f')],'custom':_[_0xed71('0x70')](_0x30506c[_0xed71('0x28')],'_c')?!![]:![],'options':_0x30506c[_0xed71('0x41')]?_[_0xed71('0x2b')](_[_0xed71('0x6b')](_0x30506c[_0xed71('0x41')]),function(_0x5d73eb){return{'name':_0x5d73eb['value'],'value':_0x5d73eb[_0xed71('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x2229a9,null))['catch'](function(_0x5235a2){var _0x5206e1=_0x298cd5[_0xed71('0x33')][_0xed71('0x71')]?0x1f4:_0x5235a2[_0xed71('0x72')]||0x1f4;logger[_0xed71('0x26')](_0xed71('0x73'),'getFields',_0x5206e1,JSON['stringify'](_0x5235a2));delete _0x5235a2['name'];if(_0x5206e1===0x191){_0x5206e1=0x190;}_0x2229a9[_0xed71('0x18')](_0x5206e1)[_0xed71('0x29')](_0x298cd5[_0xed71('0x33')][_0xed71('0x71')]?{'message':_0xed71('0x74'),'statusCode':_0x5235a2[_0xed71('0x72')]}:_0x5235a2);});}else{var _0x207a87=0x1f4;_0x2229a9['status'](_0x207a87)[_0xed71('0x29')]({'message':_0xed71('0x74'),'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 528f8c1..773a518 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 _0xfda8=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0x424a38,_0x4b82f0){var _0x928447=function(_0xdbafbf){while(--_0xdbafbf){_0x424a38['push'](_0x424a38['shift']());}};_0x928447(++_0x4b82f0);}(_0xfda8,0x118));var _0x8fda=function(_0x3ac578,_0x5cf8d8){_0x3ac578=_0x3ac578-0x0;var _0x149517=_0xfda8[_0x3ac578];return _0x149517;};'use strict';var _=require('lodash');var util=require(_0x8fda('0x0'));var logger=require(_0x8fda('0x1'))(_0x8fda('0x2'));var moment=require(_0x8fda('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fda('0x4'));var rimraf=require(_0x8fda('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fda('0x6'));var integrations=require(_0x8fda('0x7'));module[_0x8fda('0x8')]=function(_0x46b196,_0x181c37){return _0x46b196['define'](_0x8fda('0x9'),attributes,{'tableName':_0x8fda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1775=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x329a5d,_0x4a886d){var _0x56d83d=function(_0x310cbc){while(--_0x310cbc){_0x329a5d['push'](_0x329a5d['shift']());}};_0x56d83d(++_0x4a886d);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));var integrations=require(_0x5177('0xa'));module[_0x5177('0xb')]=function(_0x153c1a,_0x2ac1c6){return _0x153c1a[_0x5177('0xc')](_0x5177('0xd'),attributes,{'tableName':_0x5177('0xe'),'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 d4b9fe2..62a43d6 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 _0x65af=['model','attributes','then','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','options','where','limit','include','map'];(function(_0x5df8bb,_0x2d6841){var _0x369f4a=function(_0x717689){while(--_0x717689){_0x5df8bb['push'](_0x5df8bb['shift']());}};_0x369f4a(++_0x2d6841);}(_0x65af,0x104));var _0xf65a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x65af[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0xf65a('0x0'));var moment=require(_0xf65a('0x1'));var BPromise=require(_0xf65a('0x2'));var rs=require(_0xf65a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf65a('0x4'))['db'];var utils=require(_0xf65a('0x5'));var logger=require(_0xf65a('0x6'))('rpc');var config=require(_0xf65a('0x7'));var jayson=require(_0xf65a('0x8'));var client=jayson[_0xf65a('0x9')][_0xf65a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e7a0f,_0x15e448,_0x1e0867){return new BPromise(function(_0x1e77e8,_0x338c36){return client[_0xf65a('0xb')](_0x5e7a0f,_0x1e0867)['then'](function(_0x3d1118){logger[_0xf65a('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x15e448,_0xf65a('0xd'));logger[_0xf65a('0xe')](_0xf65a('0xf'),_0x15e448,_0xf65a('0xd'),JSON['stringify'](_0x3d1118));if(_0x3d1118[_0xf65a('0x10')]){if(_0x3d1118[_0xf65a('0x10')][_0xf65a('0x11')]===0x1f4){logger['error'](_0xf65a('0x12'),_0x15e448,_0x3d1118[_0xf65a('0x10')][_0xf65a('0x13')]);return _0x338c36(_0x3d1118['error']['message']);}logger['error'](_0xf65a('0x12'),_0x15e448,_0x3d1118['error'][_0xf65a('0x13')]);return _0x1e77e8(_0x3d1118[_0xf65a('0x10')][_0xf65a('0x13')]);}else{logger[_0xf65a('0xc')](_0xf65a('0x12'),_0x15e448,_0xf65a('0xd'));_0x1e77e8(_0x3d1118[_0xf65a('0x14')][_0xf65a('0x13')]);}})[_0xf65a('0x15')](function(_0x72c3cf){logger[_0xf65a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x15e448,_0x72c3cf);_0x338c36(_0x72c3cf);});});}exports[_0xf65a('0x16')]=function(_0x45e044){var _0x222180=this;return new Promise(function(_0x2602c2,_0x3c9b1b){return db['SugarcrmAccount']['findAll']({'raw':_0x45e044[_0xf65a('0x17')]?_0x45e044['options']['raw']===undefined?!![]:![]:!![],'where':_0x45e044['options']?_0x45e044[_0xf65a('0x17')][_0xf65a('0x18')]||null:null,'attributes':_0x45e044['options']?_0x45e044[_0xf65a('0x17')]['attributes']||null:null,'limit':_0x45e044[_0xf65a('0x17')]?_0x45e044[_0xf65a('0x17')][_0xf65a('0x19')]||null:null,'include':_0x45e044['options']?_0x45e044[_0xf65a('0x17')][_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x45e044['options'][_0xf65a('0x1a')],function(_0x4ed955){return{'model':db[_0x4ed955[_0xf65a('0x1c')]],'as':_0x4ed955['as'],'attributes':_0x4ed955[_0xf65a('0x1d')],'include':_0x4ed955[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x4ed955[_0xf65a('0x1a')],function(_0x510f18){return{'model':db[_0x510f18[_0xf65a('0x1c')]],'as':_0x510f18['as'],'attributes':_0x510f18['attributes'],'include':_0x510f18[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x510f18[_0xf65a('0x1a')],function(_0x2384f3){return{'model':db[_0x2384f3[_0xf65a('0x1c')]],'as':_0x2384f3['as'],'attributes':_0x2384f3[_0xf65a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf65a('0x1e')](function(_0x4cc61a){logger[_0xf65a('0xc')](_0xf65a('0x16'),_0x45e044);logger['debug'](_0xf65a('0x16'),_0x45e044,JSON[_0xf65a('0x1f')](_0x4cc61a));_0x2602c2(_0x4cc61a);})[_0xf65a('0x15')](function(_0xa46af8){logger['error'](_0xf65a('0x16'),_0xa46af8['message'],_0x45e044);_0x3c9b1b(_0x222180['error'](0x1f4,_0xa46af8['message']));});});};exports[_0xf65a('0x20')]=function(_0x556680){var _0x2f7406=this;return new Promise(function(_0x3380b0,_0x1b271b){return db[_0xf65a('0x21')][_0xf65a('0x22')]({'raw':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')][_0xf65a('0x23')]===undefined?!![]:![]:!![],'where':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')]['where']||null:null,'attributes':_0x556680[_0xf65a('0x17')]?_0x556680['options'][_0xf65a('0x1d')]||null:null,'include':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')][_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x556680[_0xf65a('0x17')]['include'],function(_0x812a60){return{'model':db[_0x812a60[_0xf65a('0x1c')]],'as':_0x812a60['as'],'attributes':_0x812a60['attributes'],'include':_0x812a60[_0xf65a('0x1a')]?_['map'](_0x812a60[_0xf65a('0x1a')],function(_0x58a9da){return{'model':db[_0x58a9da[_0xf65a('0x1c')]],'as':_0x58a9da['as'],'attributes':_0x58a9da[_0xf65a('0x1d')],'include':_0x58a9da[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x58a9da[_0xf65a('0x1a')],function(_0xd6aef1){return{'model':db[_0xd6aef1['model']],'as':_0xd6aef1['as'],'attributes':_0xd6aef1[_0xf65a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf65a('0x1e')](function(_0xd8c8a){logger[_0xf65a('0xc')](_0xf65a('0x20'),_0x556680);logger['debug'](_0xf65a('0x20'),_0x556680,JSON[_0xf65a('0x1f')](_0xd8c8a));_0x3380b0(_0xd8c8a);})[_0xf65a('0x15')](function(_0x22b26b){logger[_0xf65a('0x10')]('ShowSugarcrmAccount',_0x22b26b['message'],_0x556680);_0x1b271b(_0x2f7406[_0xf65a('0x10')](0x1f4,_0x22b26b[_0xf65a('0x13')]));});});}; \ No newline at end of file +var _0x8c19=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','attributes','model','find','ShowSugarcrmAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x42d33b,_0x107611){var _0x304c5c=function(_0x8381f7){while(--_0x8381f7){_0x42d33b['push'](_0x42d33b['shift']());}};_0x304c5c(++_0x107611);}(_0x8c19,0xb3));var _0x98c1=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x8c19[_0x411add];return _0x238242;};'use strict';var _=require(_0x98c1('0x0'));var util=require(_0x98c1('0x1'));var moment=require(_0x98c1('0x2'));var BPromise=require(_0x98c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98c1('0x4'));var db=require(_0x98c1('0x5'))['db'];var utils=require(_0x98c1('0x6'));var logger=require(_0x98c1('0x7'))(_0x98c1('0x8'));var config=require(_0x98c1('0x9'));var jayson=require(_0x98c1('0xa'));var client=jayson[_0x98c1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee44a6,_0x1aca8a,_0x22d054){return new BPromise(function(_0x306342,_0x3d7221){return client[_0x98c1('0xc')](_0xee44a6,_0x22d054)[_0x98c1('0xd')](function(_0x5819be){logger['info'](_0x98c1('0xe'),_0x1aca8a,_0x98c1('0xf'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1aca8a,'request\x20sent',JSON[_0x98c1('0x10')](_0x5819be));if(_0x5819be['error']){if(_0x5819be['error'][_0x98c1('0x11')]===0x1f4){logger[_0x98c1('0x12')](_0x98c1('0xe'),_0x1aca8a,_0x5819be[_0x98c1('0x12')]['message']);return _0x3d7221(_0x5819be[_0x98c1('0x12')][_0x98c1('0x13')]);}logger[_0x98c1('0x12')](_0x98c1('0xe'),_0x1aca8a,_0x5819be[_0x98c1('0x12')][_0x98c1('0x13')]);return _0x306342(_0x5819be[_0x98c1('0x12')][_0x98c1('0x13')]);}else{logger[_0x98c1('0x14')](_0x98c1('0xe'),_0x1aca8a,'request\x20sent');_0x306342(_0x5819be[_0x98c1('0x15')][_0x98c1('0x13')]);}})[_0x98c1('0x16')](function(_0x48831c){logger[_0x98c1('0x12')](_0x98c1('0xe'),_0x1aca8a,_0x48831c);_0x3d7221(_0x48831c);});});}exports[_0x98c1('0x17')]=function(_0x8fbfee){var _0xb755a0=this;return new Promise(function(_0x88b94f,_0x139f07){return db[_0x98c1('0x18')][_0x98c1('0x19')]({'raw':_0x8fbfee[_0x98c1('0x1a')]?_0x8fbfee[_0x98c1('0x1a')][_0x98c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x8fbfee['options']?_0x8fbfee['options'][_0x98c1('0x1c')]||null:null,'attributes':_0x8fbfee[_0x98c1('0x1a')]?_0x8fbfee['options']['attributes']||null:null,'limit':_0x8fbfee[_0x98c1('0x1a')]?_0x8fbfee[_0x98c1('0x1a')][_0x98c1('0x1d')]||null:null,'include':_0x8fbfee[_0x98c1('0x1a')]?_0x8fbfee[_0x98c1('0x1a')][_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0x8fbfee['options'][_0x98c1('0x1e')],function(_0xc7e5fc){return{'model':db[_0xc7e5fc['model']],'as':_0xc7e5fc['as'],'attributes':_0xc7e5fc[_0x98c1('0x20')],'include':_0xc7e5fc[_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0xc7e5fc[_0x98c1('0x1e')],function(_0x2bc58c){return{'model':db[_0x2bc58c[_0x98c1('0x21')]],'as':_0x2bc58c['as'],'attributes':_0x2bc58c[_0x98c1('0x20')],'include':_0x2bc58c[_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0x2bc58c[_0x98c1('0x1e')],function(_0x1822dd){return{'model':db[_0x1822dd[_0x98c1('0x21')]],'as':_0x1822dd['as'],'attributes':_0x1822dd[_0x98c1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x98c1('0xd')](function(_0x1f81d0){logger[_0x98c1('0x14')](_0x98c1('0x17'),_0x8fbfee);logger['debug']('GetSugarcrmAccount',_0x8fbfee,JSON[_0x98c1('0x10')](_0x1f81d0));_0x88b94f(_0x1f81d0);})[_0x98c1('0x16')](function(_0xb2c12e){logger[_0x98c1('0x12')](_0x98c1('0x17'),_0xb2c12e[_0x98c1('0x13')],_0x8fbfee);_0x139f07(_0xb755a0[_0x98c1('0x12')](0x1f4,_0xb2c12e[_0x98c1('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x3432a5){var _0x19c895=this;return new Promise(function(_0x3b58a6,_0x339371){return db['SugarcrmAccount'][_0x98c1('0x22')]({'raw':_0x3432a5[_0x98c1('0x1a')]?_0x3432a5[_0x98c1('0x1a')][_0x98c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x3432a5[_0x98c1('0x1a')]?_0x3432a5[_0x98c1('0x1a')][_0x98c1('0x1c')]||null:null,'attributes':_0x3432a5[_0x98c1('0x1a')]?_0x3432a5[_0x98c1('0x1a')][_0x98c1('0x20')]||null:null,'include':_0x3432a5[_0x98c1('0x1a')]?_0x3432a5[_0x98c1('0x1a')][_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0x3432a5[_0x98c1('0x1a')]['include'],function(_0x5478f4){return{'model':db[_0x5478f4[_0x98c1('0x21')]],'as':_0x5478f4['as'],'attributes':_0x5478f4[_0x98c1('0x20')],'include':_0x5478f4[_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0x5478f4['include'],function(_0x18eaf5){return{'model':db[_0x18eaf5[_0x98c1('0x21')]],'as':_0x18eaf5['as'],'attributes':_0x18eaf5['attributes'],'include':_0x18eaf5[_0x98c1('0x1e')]?_[_0x98c1('0x1f')](_0x18eaf5[_0x98c1('0x1e')],function(_0x614736){return{'model':db[_0x614736[_0x98c1('0x21')]],'as':_0x614736['as'],'attributes':_0x614736['attributes']};}):[]};}):[]};}):[]:[]})[_0x98c1('0xd')](function(_0x1363a2){logger[_0x98c1('0x14')](_0x98c1('0x23'),_0x3432a5);logger[_0x98c1('0x24')](_0x98c1('0x23'),_0x3432a5,JSON[_0x98c1('0x10')](_0x1363a2));_0x3b58a6(_0x1363a2);})[_0x98c1('0x16')](function(_0x23d082){logger[_0x98c1('0x12')](_0x98c1('0x23'),_0x23d082['message'],_0x3432a5);_0x339371(_0x19c895[_0x98c1('0x12')](0x1f4,_0x23d082['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8a9d658..4b59190 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 _0x30dd=['index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x5956e3,_0x337aad){var _0x5c68e2=function(_0x513690){while(--_0x513690){_0x5956e3['push'](_0x5956e3['shift']());}};_0x5c68e2(++_0x337aad);}(_0x30dd,0xee));var _0xd30d=function(_0x51ef40,_0x48a870){_0x51ef40=_0x51ef40-0x0;var _0x3ff060=_0x30dd[_0x51ef40];return _0x3ff060;};'use strict';var multer=require(_0xd30d('0x0'));var util=require('util');var path=require(_0xd30d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd30d('0x2')]();var fs_extra=require(_0xd30d('0x3'));var auth=require(_0xd30d('0x4'));var interaction=require(_0xd30d('0x5'));var config=require(_0xd30d('0x6'));var controller=require(_0xd30d('0x7'));router[_0xd30d('0x8')]('/',auth['isAuthenticated'](),controller[_0xd30d('0x9')]);router[_0xd30d('0x8')](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller[_0xd30d('0xc')]);router[_0xd30d('0x8')](_0xd30d('0xd'),auth[_0xd30d('0xb')](),controller[_0xd30d('0xe')]);router[_0xd30d('0x8')](_0xd30d('0xf'),auth[_0xd30d('0xb')](),controller['getSubjects']);router[_0xd30d('0x8')](_0xd30d('0x10'),auth[_0xd30d('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xd30d('0xb')](),controller[_0xd30d('0x11')]);router['put'](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller['update']);router['delete'](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller[_0xd30d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5a18=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x5a18,0x7e));var _0x85a1=function(_0x935907,_0x43a468){_0x935907=_0x935907-0x0;var _0x40b072=_0x5a18[_0x935907];return _0x40b072;};'use strict';var multer=require(_0x85a1('0x0'));var util=require('util');var path=require(_0x85a1('0x1'));var timeout=require(_0x85a1('0x2'));var express=require('express');var router=express[_0x85a1('0x3')]();var fs_extra=require(_0x85a1('0x4'));var auth=require(_0x85a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85a1('0x6'));var controller=require(_0x85a1('0x7'));router[_0x85a1('0x8')]('/',auth[_0x85a1('0x9')](),controller[_0x85a1('0xa')]);router['get'](_0x85a1('0xb'),auth[_0x85a1('0x9')](),controller['show']);router[_0x85a1('0x8')](_0x85a1('0xc'),auth[_0x85a1('0x9')](),controller[_0x85a1('0xd')]);router[_0x85a1('0x8')](_0x85a1('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x85a1('0x8')](_0x85a1('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x85a1('0x10')]('/',auth[_0x85a1('0x9')](),controller[_0x85a1('0x11')]);router[_0x85a1('0x12')](_0x85a1('0xb'),auth['isAuthenticated'](),controller[_0x85a1('0x13')]);router[_0x85a1('0x14')](_0x85a1('0xb'),auth[_0x85a1('0x9')](),controller[_0x85a1('0x15')]);module[_0x85a1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index eb4765d..1a98e5f 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 _0x376b=['exports','STRING','sequelize'];(function(_0x1f9b94,_0x53302b){var _0xd6ef4d=function(_0x411776){while(--_0x411776){_0x1f9b94['push'](_0x1f9b94['shift']());}};_0xd6ef4d(++_0x53302b);}(_0x376b,0xe0));var _0xb376=function(_0x17d1ba,_0x4f2f33){_0x17d1ba=_0x17d1ba-0x0;var _0x57b2c1=_0x376b[_0x17d1ba];return _0x57b2c1;};'use strict';var Sequelize=require(_0xb376('0x0'));module[_0xb376('0x1')]={'name':{'type':Sequelize[_0xb376('0x2')]},'description':{'type':Sequelize[_0xb376('0x2')]}}; \ No newline at end of file +var _0x63dd=['exports','STRING'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x63dd,0x14a));var _0xd63d=function(_0x30a385,_0x242ecd){_0x30a385=_0x30a385-0x0;var _0x27df00=_0x63dd[_0x30a385];return _0x27df00;};'use strict';var Sequelize=require('sequelize');module[_0xd63d('0x0')]={'name':{'type':Sequelize[_0xd63d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d1e3ee6..4f47c2a 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 _0x1ec0=['find','catch','create','params','body','getFields','SugarcrmField','options','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','keys','intersection'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x1ec0,0xf2));var _0x01ec=function(_0x589d2f,_0xc49372){_0x589d2f=_0x589d2f-0x0;var _0x1db27c=_0x1ec0[_0x589d2f];return _0x1db27c;};'use strict';var emlformat=require(_0x01ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01ec('0x2'));var moment=require(_0x01ec('0x3'));var BPromise=require(_0x01ec('0x4'));var Mustache=require('mustache');var util=require(_0x01ec('0x5'));var path=require(_0x01ec('0x6'));var sox=require('sox');var csv=require(_0x01ec('0x7'));var ejs=require(_0x01ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01ec('0x9'));var squel=require(_0x01ec('0xa'));var crypto=require(_0x01ec('0xb'));var jsforce=require(_0x01ec('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x01ec('0x7'));var querystring=require(_0x01ec('0xd'));var Papa=require('papaparse');var Redis=require(_0x01ec('0xe'));var authService=require(_0x01ec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x01ec('0x10'));var hardwareService=require(_0x01ec('0x11'));var logger=require(_0x01ec('0x12'))('api');var utils=require(_0x01ec('0x13'));var config=require(_0x01ec('0x14'));var licenseUtil=require(_0x01ec('0x15'));var db=require(_0x01ec('0x16'))['db'];function respondWithStatusCode(_0x44dd11,_0x460463){_0x460463=_0x460463||0xcc;return function(_0x351f89){if(_0x351f89){return _0x44dd11[_0x01ec('0x17')](_0x460463);}return _0x44dd11['status'](_0x460463)[_0x01ec('0x18')]();};}function respondWithResult(_0x574cdd,_0x2350a4){_0x2350a4=_0x2350a4||0xc8;return function(_0x41b5ba){if(_0x41b5ba){return _0x574cdd['status'](_0x2350a4)[_0x01ec('0x19')](_0x41b5ba);}};}function respondWithFilteredResult(_0x2da33a,_0x493ed1){return function(_0x4a3eb3){if(_0x4a3eb3){var _0x54a41f=typeof _0x493ed1[_0x01ec('0x1a')]===_0x01ec('0x1b')&&typeof _0x493ed1[_0x01ec('0x1c')]===_0x01ec('0x1b');var _0x17c9c8=_0x4a3eb3[_0x01ec('0x1d')];var _0x5adc41=_0x54a41f?0x0:_0x493ed1['offset'];var _0x18e175=_0x54a41f?_0x4a3eb3[_0x01ec('0x1d')]:_0x493ed1[_0x01ec('0x1a')]+_0x493ed1[_0x01ec('0x1c')];var _0x5cc636;if(_0x18e175>=_0x17c9c8){_0x18e175=_0x17c9c8;_0x5cc636=0xc8;}else{_0x5cc636=0xce;}_0x2da33a[_0x01ec('0x1e')](_0x5cc636);return _0x2da33a[_0x01ec('0x1f')](_0x01ec('0x20'),_0x5adc41+'-'+_0x18e175+'/'+_0x17c9c8)[_0x01ec('0x19')](_0x4a3eb3);}return null;};}function patchUpdates(_0x31efb0){return function(_0x15e4e5){try{jsonpatch['apply'](_0x15e4e5,_0x31efb0,!![]);}catch(_0x4f1427){return BPromise[_0x01ec('0x21')](_0x4f1427);}return _0x15e4e5[_0x01ec('0x22')]();};}function saveUpdates(_0xa3927d,_0x38c200){return function(_0x4f690c){if(_0x4f690c){return _0x4f690c[_0x01ec('0x23')](_0xa3927d)['then'](function(_0x15539f){return _0x15539f;});}return null;};}function removeEntity(_0x391bae,_0x4424f7){return function(_0x94732a){if(_0x94732a){return _0x94732a[_0x01ec('0x24')]()[_0x01ec('0x25')](function(){_0x391bae['status'](0xcc)[_0x01ec('0x18')]();});}};}function handleEntityNotFound(_0x15364b,_0x2394b1){return function(_0x2276a2){if(!_0x2276a2){_0x15364b[_0x01ec('0x17')](0x194);}return _0x2276a2;};}function handleError(_0x3aa7d8,_0xe01589){_0xe01589=_0xe01589||0x1f4;return function(_0x1a30a1){logger['error'](_0x1a30a1['stack']);if(_0x1a30a1[_0x01ec('0x26')]){delete _0x1a30a1['name'];}_0x3aa7d8[_0x01ec('0x1e')](_0xe01589)['send'](_0x1a30a1);};}exports['index']=function(_0x236b2f,_0x71fcde){var _0x31cc86={},_0x3a7f26={},_0x5e808f={'count':0x0,'rows':[]};var _0x42c260=_[_0x01ec('0x27')](db[_0x01ec('0x28')][_0x01ec('0x29')],function(_0x45cf6e){return{'name':_0x45cf6e[_0x01ec('0x2a')],'type':_0x45cf6e[_0x01ec('0x2b')][_0x01ec('0x2c')]};});_0x3a7f26[_0x01ec('0x2d')]=_['map'](_0x42c260,_0x01ec('0x26'));_0x3a7f26[_0x01ec('0x2e')]=_['keys'](_0x236b2f[_0x01ec('0x2e')]);_0x3a7f26[_0x01ec('0x2f')]=_['intersection'](_0x3a7f26[_0x01ec('0x2d')],_0x3a7f26['query']);_0x31cc86[_0x01ec('0x30')]=_['intersection'](_0x3a7f26[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x31')]));_0x31cc86[_0x01ec('0x30')]=_0x31cc86[_0x01ec('0x30')][_0x01ec('0x32')]?_0x31cc86[_0x01ec('0x30')]:_0x3a7f26[_0x01ec('0x2d')];if(!_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x31cc86[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x236b2f['query'][_0x01ec('0x1c')]);_0x31cc86['offset']=qs[_0x01ec('0x1a')](_0x236b2f[_0x01ec('0x2e')]['offset']);}_0x31cc86[_0x01ec('0x35')]=qs[_0x01ec('0x36')](_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x36')]);_0x31cc86[_0x01ec('0x37')]=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x236b2f[_0x01ec('0x2e')],_0x3a7f26['filters']),_0x42c260);if(_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x39')]){_0x31cc86[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x31cc86['where'],{'$or':_[_0x01ec('0x27')](_0x42c260,function(_0x1fc30b){if(_0x1fc30b['type']!==_0x01ec('0x3b')){var _0x2bccbe={};_0x2bccbe[_0x1fc30b[_0x01ec('0x26')]]={'$like':'%'+_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x39')]+'%'};return _0x2bccbe;}})});}_0x31cc86=_[_0x01ec('0x3a')]({},_0x31cc86,_0x236b2f['options']);var _0x3022f6={'where':_0x31cc86[_0x01ec('0x37')]};return db[_0x01ec('0x28')][_0x01ec('0x1d')](_0x3022f6)[_0x01ec('0x25')](function(_0x303b70){_0x5e808f[_0x01ec('0x1d')]=_0x303b70;if(_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x3c')]){_0x31cc86[_0x01ec('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x31cc86);})[_0x01ec('0x25')](function(_0x38f53d){_0x5e808f[_0x01ec('0x3e')]=_0x38f53d;return _0x5e808f;})[_0x01ec('0x25')](respondWithFilteredResult(_0x71fcde,_0x31cc86))['catch'](handleError(_0x71fcde,null));};exports[_0x01ec('0x3f')]=function(_0x523221,_0x52f7df){var _0x55abc2={'raw':![],'where':{'id':_0x523221['params']['id']}},_0x43b5d0={};_0x43b5d0[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x28')][_0x01ec('0x29')]);_0x43b5d0[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x523221[_0x01ec('0x2e')]);_0x43b5d0[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x43b5d0['model'],_0x43b5d0[_0x01ec('0x2e')]);_0x55abc2[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0x43b5d0[_0x01ec('0x2d')],qs['fields'](_0x523221[_0x01ec('0x2e')][_0x01ec('0x31')]));_0x55abc2['attributes']=_0x55abc2[_0x01ec('0x30')][_0x01ec('0x32')]?_0x55abc2[_0x01ec('0x30')]:_0x43b5d0[_0x01ec('0x2d')];if(_0x523221[_0x01ec('0x2e')][_0x01ec('0x3c')]){_0x55abc2[_0x01ec('0x3d')]=[{'all':!![]}];}_0x55abc2=_['merge']({},_0x55abc2,_0x523221['options']);return db[_0x01ec('0x28')][_0x01ec('0x42')](_0x55abc2)[_0x01ec('0x25')](handleEntityNotFound(_0x52f7df,null))[_0x01ec('0x25')](respondWithResult(_0x52f7df,null))[_0x01ec('0x43')](handleError(_0x52f7df,null));};exports['create']=function(_0x10fd49,_0x2bab8b){return db[_0x01ec('0x28')][_0x01ec('0x44')](_0x10fd49['body'],{})['then'](respondWithResult(_0x2bab8b,0xc9))['catch'](handleError(_0x2bab8b,null));};exports[_0x01ec('0x23')]=function(_0x19d67b,_0x36ae97){if(_0x19d67b['body']['id']){delete _0x19d67b['body']['id'];}return db[_0x01ec('0x28')][_0x01ec('0x42')]({'where':{'id':_0x19d67b[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x36ae97,null))[_0x01ec('0x25')](saveUpdates(_0x19d67b[_0x01ec('0x46')],null))[_0x01ec('0x25')](respondWithResult(_0x36ae97,null))[_0x01ec('0x43')](handleError(_0x36ae97,null));};exports[_0x01ec('0x24')]=function(_0x174cb2,_0x34b88f){return db[_0x01ec('0x28')][_0x01ec('0x42')]({'where':{'id':_0x174cb2['params']['id']}})[_0x01ec('0x25')](handleEntityNotFound(_0x34b88f,null))[_0x01ec('0x25')](removeEntity(_0x34b88f,null))[_0x01ec('0x43')](handleError(_0x34b88f,null));};exports[_0x01ec('0x47')]=function(_0x2ebeaa,_0x41400b,_0x33ad3f){var _0x2a02dd={};var _0xea122c={};var _0x59ee64;var _0x4ae4cd;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2ebeaa[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x41400b,null))['then'](function(_0x19277b){if(_0x19277b){_0x59ee64=_0x19277b;_0xea122c[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0xea122c[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x2ebeaa[_0x01ec('0x2e')]);_0xea122c[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0xea122c[_0x01ec('0x2d')],_0xea122c[_0x01ec('0x2e')]);_0x2a02dd[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0xea122c[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x2ebeaa['query'][_0x01ec('0x31')]));_0x2a02dd[_0x01ec('0x30')]=_0x2a02dd[_0x01ec('0x30')][_0x01ec('0x32')]?_0x2a02dd[_0x01ec('0x30')]:_0xea122c[_0x01ec('0x2d')];_0x2a02dd['order']=qs['sort'](_0x2ebeaa['query']['sort']);_0x2a02dd[_0x01ec('0x37')]=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x2ebeaa[_0x01ec('0x2e')],_0xea122c['filters']));if(_0x2ebeaa[_0x01ec('0x2e')]['filter']){_0x2a02dd[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x2a02dd[_0x01ec('0x37')],{'$or':_['map'](_0x2a02dd[_0x01ec('0x30')],function(_0x43689d){var _0x41f36a={};_0x41f36a[_0x43689d]={'$like':'%'+_0x2ebeaa['query'][_0x01ec('0x39')]+'%'};return _0x41f36a;})});}_0x2a02dd=_[_0x01ec('0x3a')]({},_0x2a02dd,_0x2ebeaa[_0x01ec('0x49')]);return _0x59ee64[_0x01ec('0x47')](_0x2a02dd);}})[_0x01ec('0x25')](function(_0xec50b2){if(_0xec50b2){_0x4ae4cd=_0xec50b2[_0x01ec('0x32')];if(!_0x2ebeaa[_0x01ec('0x2e')]['hasOwnProperty'](_0x01ec('0x34'))){_0x2a02dd[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x2ebeaa['query'][_0x01ec('0x1c')]);_0x2a02dd[_0x01ec('0x1a')]=qs['offset'](_0x2ebeaa[_0x01ec('0x2e')][_0x01ec('0x1a')]);}return _0x59ee64[_0x01ec('0x47')](_0x2a02dd);}})[_0x01ec('0x25')](function(_0xa77bb5){if(_0xa77bb5){return _0xa77bb5?{'count':_0x4ae4cd,'rows':_0xa77bb5}:null;}})[_0x01ec('0x25')](respondWithResult(_0x41400b,null))[_0x01ec('0x43')](handleError(_0x41400b,null));};exports[_0x01ec('0x4a')]=function(_0x1bc51f,_0x3af7a6,_0x1d7250){var _0x1159fb={};var _0x40361d={};var _0x59b19b;var _0x2f690c;return db[_0x01ec('0x28')][_0x01ec('0x4b')]({'where':{'id':_0x1bc51f['params']['id']}})[_0x01ec('0x25')](handleEntityNotFound(_0x3af7a6,null))[_0x01ec('0x25')](function(_0x5ec0ff){if(_0x5ec0ff){_0x59b19b=_0x5ec0ff;_0x40361d[_0x01ec('0x2d')]=_['keys'](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0x40361d[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x1bc51f['query']);_0x40361d[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x40361d[_0x01ec('0x2d')],_0x40361d['query']);_0x1159fb[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0x40361d[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x1bc51f['query'][_0x01ec('0x31')]));_0x1159fb[_0x01ec('0x30')]=_0x1159fb['attributes']['length']?_0x1159fb[_0x01ec('0x30')]:_0x40361d[_0x01ec('0x2d')];_0x1159fb[_0x01ec('0x35')]=qs[_0x01ec('0x36')](_0x1bc51f['query'][_0x01ec('0x36')]);_0x1159fb['where']=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x1bc51f[_0x01ec('0x2e')],_0x40361d[_0x01ec('0x2f')]));if(_0x1bc51f['query']['filter']){_0x1159fb[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x1159fb['where'],{'$or':_[_0x01ec('0x27')](_0x1159fb[_0x01ec('0x30')],function(_0x3360e3){var _0x3fe5f2={};_0x3fe5f2[_0x3360e3]={'$like':'%'+_0x1bc51f['query']['filter']+'%'};return _0x3fe5f2;})});}_0x1159fb=_[_0x01ec('0x3a')]({},_0x1159fb,_0x1bc51f[_0x01ec('0x49')]);return _0x59b19b['getSubjects'](_0x1159fb);}})['then'](function(_0x5ce114){if(_0x5ce114){_0x2f690c=_0x5ce114[_0x01ec('0x32')];if(!_0x1bc51f[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x1159fb[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x1bc51f['query'][_0x01ec('0x1c')]);_0x1159fb[_0x01ec('0x1a')]=qs[_0x01ec('0x1a')](_0x1bc51f[_0x01ec('0x2e')][_0x01ec('0x1a')]);}return _0x59b19b[_0x01ec('0x4a')](_0x1159fb);}})['then'](function(_0x254f36){if(_0x254f36){return _0x254f36?{'count':_0x2f690c,'rows':_0x254f36}:null;}})[_0x01ec('0x25')](respondWithResult(_0x3af7a6,null))[_0x01ec('0x43')](handleError(_0x3af7a6,null));};exports[_0x01ec('0x4c')]=function(_0x1d30d0,_0x544585,_0x109aa1){var _0x2dc22e={};var _0x4dca0e={};var _0x53cfe5;var _0x1b5202;return db[_0x01ec('0x28')]['findOne']({'where':{'id':_0x1d30d0[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x544585,null))[_0x01ec('0x25')](function(_0x14a4fe){if(_0x14a4fe){_0x53cfe5=_0x14a4fe;_0x4dca0e[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0x4dca0e[_0x01ec('0x2e')]=_['keys'](_0x1d30d0['query']);_0x4dca0e[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x4dca0e[_0x01ec('0x2d')],_0x4dca0e['query']);_0x2dc22e[_0x01ec('0x30')]=_['intersection'](_0x4dca0e[_0x01ec('0x2d')],qs['fields'](_0x1d30d0['query'][_0x01ec('0x31')]));_0x2dc22e['attributes']=_0x2dc22e[_0x01ec('0x30')][_0x01ec('0x32')]?_0x2dc22e['attributes']:_0x4dca0e[_0x01ec('0x2d')];_0x2dc22e['order']=qs[_0x01ec('0x36')](_0x1d30d0['query'][_0x01ec('0x36')]);_0x2dc22e['where']=qs[_0x01ec('0x2f')](_['pick'](_0x1d30d0['query'],_0x4dca0e[_0x01ec('0x2f')]));if(_0x1d30d0['query'][_0x01ec('0x39')]){_0x2dc22e[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x2dc22e['where'],{'$or':_[_0x01ec('0x27')](_0x2dc22e[_0x01ec('0x30')],function(_0x45ce82){var _0x59c91e={};_0x59c91e[_0x45ce82]={'$like':'%'+_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x39')]+'%'};return _0x59c91e;})});}_0x2dc22e=_['merge']({},_0x2dc22e,_0x1d30d0[_0x01ec('0x49')]);return _0x53cfe5[_0x01ec('0x4c')](_0x2dc22e);}})[_0x01ec('0x25')](function(_0xeaf9ab){if(_0xeaf9ab){_0x1b5202=_0xeaf9ab[_0x01ec('0x32')];if(!_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x2dc22e[_0x01ec('0x1c')]=qs['limit'](_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x1c')]);_0x2dc22e[_0x01ec('0x1a')]=qs[_0x01ec('0x1a')](_0x1d30d0['query'][_0x01ec('0x1a')]);}return _0x53cfe5[_0x01ec('0x4c')](_0x2dc22e);}})[_0x01ec('0x25')](function(_0x47a359){if(_0x47a359){return _0x47a359?{'count':_0x1b5202,'rows':_0x47a359}:null;}})[_0x01ec('0x25')](respondWithResult(_0x544585,null))['catch'](handleError(_0x544585,null));}; \ No newline at end of file +var _0xc367=['end','error','stack','name','SugarcrmConfiguration','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','getFields','findOne','SugarcrmField','map','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','path','sox','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then'];(function(_0x33adcb,_0x40bb80){var _0x498cdb=function(_0x4f5bf0){while(--_0x4f5bf0){_0x33adcb['push'](_0x33adcb['shift']());}};_0x498cdb(++_0x40bb80);}(_0xc367,0x156));var _0x7c36=function(_0x40bf50,_0x274dda){_0x40bf50=_0x40bf50-0x0;var _0x1b909c=_0xc367[_0x40bf50];return _0x1b909c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c36('0x0'));var zipdir=require(_0x7c36('0x1'));var jsonpatch=require(_0x7c36('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7c36('0x3'));var util=require('util');var path=require(_0x7c36('0x4'));var sox=require(_0x7c36('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c36('0x6'));var squel=require('squel');var crypto=require(_0x7c36('0x7'));var jsforce=require(_0x7c36('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x7c36('0x9'));var querystring=require(_0x7c36('0xa'));var Papa=require('papaparse');var Redis=require(_0x7c36('0xb'));var authService=require(_0x7c36('0xc'));var qs=require(_0x7c36('0xd'));var as=require(_0x7c36('0xe'));var hardwareService=require(_0x7c36('0xf'));var logger=require(_0x7c36('0x10'))(_0x7c36('0x11'));var utils=require(_0x7c36('0x12'));var config=require(_0x7c36('0x13'));var licenseUtil=require(_0x7c36('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2db1d8,_0x3d8db2){_0x3d8db2=_0x3d8db2||0xcc;return function(_0x2eb119){if(_0x2eb119){return _0x2db1d8[_0x7c36('0x15')](_0x3d8db2);}return _0x2db1d8[_0x7c36('0x16')](_0x3d8db2)['end']();};}function respondWithResult(_0x3622fa,_0xa247dd){_0xa247dd=_0xa247dd||0xc8;return function(_0x15d321){if(_0x15d321){return _0x3622fa[_0x7c36('0x16')](_0xa247dd)[_0x7c36('0x17')](_0x15d321);}};}function respondWithFilteredResult(_0x436a23,_0x44ecc4){return function(_0x108b52){if(_0x108b52){var _0x41edeb=typeof _0x44ecc4[_0x7c36('0x18')]===_0x7c36('0x19')&&typeof _0x44ecc4[_0x7c36('0x1a')]===_0x7c36('0x19');var _0x4f6c7d=_0x108b52[_0x7c36('0x1b')];var _0x557a83=_0x41edeb?0x0:_0x44ecc4[_0x7c36('0x18')];var _0x4201d9=_0x41edeb?_0x108b52[_0x7c36('0x1b')]:_0x44ecc4[_0x7c36('0x18')]+_0x44ecc4['limit'];var _0x3d29a8;if(_0x4201d9>=_0x4f6c7d){_0x4201d9=_0x4f6c7d;_0x3d29a8=0xc8;}else{_0x3d29a8=0xce;}_0x436a23['status'](_0x3d29a8);return _0x436a23[_0x7c36('0x1c')](_0x7c36('0x1d'),_0x557a83+'-'+_0x4201d9+'/'+_0x4f6c7d)[_0x7c36('0x17')](_0x108b52);}return null;};}function patchUpdates(_0x5f444f){return function(_0x244b92){try{jsonpatch['apply'](_0x244b92,_0x5f444f,!![]);}catch(_0x2fa2fd){return BPromise[_0x7c36('0x1e')](_0x2fa2fd);}return _0x244b92['save']();};}function saveUpdates(_0xa2b598,_0x4e3cf4){return function(_0x22ec18){if(_0x22ec18){return _0x22ec18[_0x7c36('0x1f')](_0xa2b598)['then'](function(_0x988cda){return _0x988cda;});}return null;};}function removeEntity(_0x161028,_0x4fee4b){return function(_0x152976){if(_0x152976){return _0x152976['destroy']()[_0x7c36('0x20')](function(){_0x161028[_0x7c36('0x16')](0xcc)[_0x7c36('0x21')]();});}};}function handleEntityNotFound(_0x4a55ca,_0x5acb01){return function(_0x23e9dc){if(!_0x23e9dc){_0x4a55ca[_0x7c36('0x15')](0x194);}return _0x23e9dc;};}function handleError(_0x3d0082,_0x5346c3){_0x5346c3=_0x5346c3||0x1f4;return function(_0x405524){logger[_0x7c36('0x22')](_0x405524[_0x7c36('0x23')]);if(_0x405524[_0x7c36('0x24')]){delete _0x405524[_0x7c36('0x24')];}_0x3d0082['status'](_0x5346c3)['send'](_0x405524);};}exports['index']=function(_0x5f3a4c,_0x3c1b37){var _0x2c9fbd={},_0xf60ef7={},_0x53fecd={'count':0x0,'rows':[]};var _0x48fe3a=_['map'](db[_0x7c36('0x25')]['rawAttributes'],function(_0x4b9f73){return{'name':_0x4b9f73['fieldName'],'type':_0x4b9f73['type'][_0x7c36('0x26')]};});_0xf60ef7[_0x7c36('0x27')]=_['map'](_0x48fe3a,_0x7c36('0x24'));_0xf60ef7['query']=_[_0x7c36('0x28')](_0x5f3a4c[_0x7c36('0x29')]);_0xf60ef7[_0x7c36('0x2a')]=_[_0x7c36('0x2b')](_0xf60ef7['model'],_0xf60ef7[_0x7c36('0x29')]);_0x2c9fbd[_0x7c36('0x2c')]=_[_0x7c36('0x2b')](_0xf60ef7[_0x7c36('0x27')],qs[_0x7c36('0x2d')](_0x5f3a4c['query'][_0x7c36('0x2d')]));_0x2c9fbd['attributes']=_0x2c9fbd[_0x7c36('0x2c')][_0x7c36('0x2e')]?_0x2c9fbd['attributes']:_0xf60ef7[_0x7c36('0x27')];if(!_0x5f3a4c[_0x7c36('0x29')][_0x7c36('0x2f')]('nolimit')){_0x2c9fbd[_0x7c36('0x1a')]=qs['limit'](_0x5f3a4c[_0x7c36('0x29')]['limit']);_0x2c9fbd[_0x7c36('0x18')]=qs['offset'](_0x5f3a4c[_0x7c36('0x29')]['offset']);}_0x2c9fbd[_0x7c36('0x30')]=qs[_0x7c36('0x31')](_0x5f3a4c[_0x7c36('0x29')]['sort']);_0x2c9fbd[_0x7c36('0x32')]=qs[_0x7c36('0x2a')](_[_0x7c36('0x33')](_0x5f3a4c[_0x7c36('0x29')],_0xf60ef7['filters']),_0x48fe3a);if(_0x5f3a4c[_0x7c36('0x29')][_0x7c36('0x34')]){_0x2c9fbd[_0x7c36('0x32')]=_[_0x7c36('0x35')](_0x2c9fbd[_0x7c36('0x32')],{'$or':_['map'](_0x48fe3a,function(_0x5b460f){if(_0x5b460f[_0x7c36('0x36')]!=='VIRTUAL'){var _0x59e566={};_0x59e566[_0x5b460f['name']]={'$like':'%'+_0x5f3a4c[_0x7c36('0x29')][_0x7c36('0x34')]+'%'};return _0x59e566;}})});}_0x2c9fbd=_[_0x7c36('0x35')]({},_0x2c9fbd,_0x5f3a4c['options']);var _0x42178b={'where':_0x2c9fbd[_0x7c36('0x32')]};return db[_0x7c36('0x25')][_0x7c36('0x1b')](_0x42178b)[_0x7c36('0x20')](function(_0x1730bc){_0x53fecd[_0x7c36('0x1b')]=_0x1730bc;if(_0x5f3a4c[_0x7c36('0x29')][_0x7c36('0x37')]){_0x2c9fbd[_0x7c36('0x38')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x7c36('0x39')](_0x2c9fbd);})[_0x7c36('0x20')](function(_0x5abe3a){_0x53fecd[_0x7c36('0x3a')]=_0x5abe3a;return _0x53fecd;})[_0x7c36('0x20')](respondWithFilteredResult(_0x3c1b37,_0x2c9fbd))[_0x7c36('0x3b')](handleError(_0x3c1b37,null));};exports[_0x7c36('0x3c')]=function(_0x6d1d76,_0x410a87){var _0x4d3aae={'raw':![],'where':{'id':_0x6d1d76[_0x7c36('0x3d')]['id']}},_0x5f296a={};_0x5f296a[_0x7c36('0x27')]=_[_0x7c36('0x28')](db[_0x7c36('0x25')][_0x7c36('0x3e')]);_0x5f296a['query']=_['keys'](_0x6d1d76[_0x7c36('0x29')]);_0x5f296a[_0x7c36('0x2a')]=_[_0x7c36('0x2b')](_0x5f296a[_0x7c36('0x27')],_0x5f296a[_0x7c36('0x29')]);_0x4d3aae[_0x7c36('0x2c')]=_[_0x7c36('0x2b')](_0x5f296a[_0x7c36('0x27')],qs[_0x7c36('0x2d')](_0x6d1d76[_0x7c36('0x29')][_0x7c36('0x2d')]));_0x4d3aae['attributes']=_0x4d3aae[_0x7c36('0x2c')][_0x7c36('0x2e')]?_0x4d3aae[_0x7c36('0x2c')]:_0x5f296a[_0x7c36('0x27')];if(_0x6d1d76[_0x7c36('0x29')][_0x7c36('0x37')]){_0x4d3aae[_0x7c36('0x38')]=[{'all':!![]}];}_0x4d3aae=_[_0x7c36('0x35')]({},_0x4d3aae,_0x6d1d76[_0x7c36('0x3f')]);return db[_0x7c36('0x25')][_0x7c36('0x40')](_0x4d3aae)['then'](handleEntityNotFound(_0x410a87,null))[_0x7c36('0x20')](respondWithResult(_0x410a87,null))[_0x7c36('0x3b')](handleError(_0x410a87,null));};exports['create']=function(_0x5a159f,_0x2dd463){return db[_0x7c36('0x25')][_0x7c36('0x41')](_0x5a159f[_0x7c36('0x42')],{})['then'](respondWithResult(_0x2dd463,0xc9))[_0x7c36('0x3b')](handleError(_0x2dd463,null));};exports[_0x7c36('0x1f')]=function(_0x582775,_0x8e8d20){if(_0x582775[_0x7c36('0x42')]['id']){delete _0x582775['body']['id'];}return db[_0x7c36('0x25')][_0x7c36('0x40')]({'where':{'id':_0x582775[_0x7c36('0x3d')]['id']}})[_0x7c36('0x20')](handleEntityNotFound(_0x8e8d20,null))['then'](saveUpdates(_0x582775['body'],null))[_0x7c36('0x20')](respondWithResult(_0x8e8d20,null))[_0x7c36('0x3b')](handleError(_0x8e8d20,null));};exports[_0x7c36('0x43')]=function(_0x30cb4d,_0x281931){return db[_0x7c36('0x25')]['find']({'where':{'id':_0x30cb4d[_0x7c36('0x3d')]['id']}})[_0x7c36('0x20')](handleEntityNotFound(_0x281931,null))[_0x7c36('0x20')](removeEntity(_0x281931,null))[_0x7c36('0x3b')](handleError(_0x281931,null));};exports[_0x7c36('0x44')]=function(_0x17978c,_0x208c10,_0x106610){var _0x3e4883={};var _0x115b93={};var _0x1509b0;var _0x5358b1;return db[_0x7c36('0x25')][_0x7c36('0x45')]({'where':{'id':_0x17978c[_0x7c36('0x3d')]['id']}})[_0x7c36('0x20')](handleEntityNotFound(_0x208c10,null))[_0x7c36('0x20')](function(_0x20d05a){if(_0x20d05a){_0x1509b0=_0x20d05a;_0x115b93[_0x7c36('0x27')]=_['keys'](db[_0x7c36('0x46')][_0x7c36('0x3e')]);_0x115b93[_0x7c36('0x29')]=_[_0x7c36('0x28')](_0x17978c[_0x7c36('0x29')]);_0x115b93['filters']=_['intersection'](_0x115b93[_0x7c36('0x27')],_0x115b93['query']);_0x3e4883[_0x7c36('0x2c')]=_['intersection'](_0x115b93[_0x7c36('0x27')],qs[_0x7c36('0x2d')](_0x17978c[_0x7c36('0x29')][_0x7c36('0x2d')]));_0x3e4883['attributes']=_0x3e4883['attributes'][_0x7c36('0x2e')]?_0x3e4883[_0x7c36('0x2c')]:_0x115b93[_0x7c36('0x27')];_0x3e4883[_0x7c36('0x30')]=qs[_0x7c36('0x31')](_0x17978c['query'][_0x7c36('0x31')]);_0x3e4883['where']=qs[_0x7c36('0x2a')](_[_0x7c36('0x33')](_0x17978c[_0x7c36('0x29')],_0x115b93['filters']));if(_0x17978c[_0x7c36('0x29')][_0x7c36('0x34')]){_0x3e4883[_0x7c36('0x32')]=_['merge'](_0x3e4883[_0x7c36('0x32')],{'$or':_[_0x7c36('0x47')](_0x3e4883[_0x7c36('0x2c')],function(_0x116236){var _0x3f6ee5={};_0x3f6ee5[_0x116236]={'$like':'%'+_0x17978c['query'][_0x7c36('0x34')]+'%'};return _0x3f6ee5;})});}_0x3e4883=_['merge']({},_0x3e4883,_0x17978c[_0x7c36('0x3f')]);return _0x1509b0[_0x7c36('0x44')](_0x3e4883);}})[_0x7c36('0x20')](function(_0x37c243){if(_0x37c243){_0x5358b1=_0x37c243[_0x7c36('0x2e')];if(!_0x17978c[_0x7c36('0x29')][_0x7c36('0x2f')](_0x7c36('0x48'))){_0x3e4883[_0x7c36('0x1a')]=qs[_0x7c36('0x1a')](_0x17978c[_0x7c36('0x29')][_0x7c36('0x1a')]);_0x3e4883['offset']=qs[_0x7c36('0x18')](_0x17978c[_0x7c36('0x29')][_0x7c36('0x18')]);}return _0x1509b0['getFields'](_0x3e4883);}})[_0x7c36('0x20')](function(_0x5bdff2){if(_0x5bdff2){return _0x5bdff2?{'count':_0x5358b1,'rows':_0x5bdff2}:null;}})[_0x7c36('0x20')](respondWithResult(_0x208c10,null))[_0x7c36('0x3b')](handleError(_0x208c10,null));};exports[_0x7c36('0x49')]=function(_0x12641b,_0x126ac3,_0x517d9e){var _0xecac67={};var _0x327ba2={};var _0x1044e6;var _0x5bb3df;return db[_0x7c36('0x25')]['findOne']({'where':{'id':_0x12641b[_0x7c36('0x3d')]['id']}})[_0x7c36('0x20')](handleEntityNotFound(_0x126ac3,null))['then'](function(_0x3e7642){if(_0x3e7642){_0x1044e6=_0x3e7642;_0x327ba2[_0x7c36('0x27')]=_[_0x7c36('0x28')](db[_0x7c36('0x46')][_0x7c36('0x3e')]);_0x327ba2[_0x7c36('0x29')]=_[_0x7c36('0x28')](_0x12641b[_0x7c36('0x29')]);_0x327ba2[_0x7c36('0x2a')]=_[_0x7c36('0x2b')](_0x327ba2[_0x7c36('0x27')],_0x327ba2[_0x7c36('0x29')]);_0xecac67[_0x7c36('0x2c')]=_['intersection'](_0x327ba2['model'],qs[_0x7c36('0x2d')](_0x12641b['query']['fields']));_0xecac67[_0x7c36('0x2c')]=_0xecac67['attributes'][_0x7c36('0x2e')]?_0xecac67[_0x7c36('0x2c')]:_0x327ba2[_0x7c36('0x27')];_0xecac67[_0x7c36('0x30')]=qs['sort'](_0x12641b['query'][_0x7c36('0x31')]);_0xecac67[_0x7c36('0x32')]=qs['filters'](_[_0x7c36('0x33')](_0x12641b[_0x7c36('0x29')],_0x327ba2['filters']));if(_0x12641b['query'][_0x7c36('0x34')]){_0xecac67['where']=_[_0x7c36('0x35')](_0xecac67[_0x7c36('0x32')],{'$or':_[_0x7c36('0x47')](_0xecac67[_0x7c36('0x2c')],function(_0x2fada9){var _0xe52f21={};_0xe52f21[_0x2fada9]={'$like':'%'+_0x12641b[_0x7c36('0x29')][_0x7c36('0x34')]+'%'};return _0xe52f21;})});}_0xecac67=_[_0x7c36('0x35')]({},_0xecac67,_0x12641b[_0x7c36('0x3f')]);return _0x1044e6['getSubjects'](_0xecac67);}})[_0x7c36('0x20')](function(_0x99055f){if(_0x99055f){_0x5bb3df=_0x99055f[_0x7c36('0x2e')];if(!_0x12641b[_0x7c36('0x29')][_0x7c36('0x2f')](_0x7c36('0x48'))){_0xecac67[_0x7c36('0x1a')]=qs[_0x7c36('0x1a')](_0x12641b[_0x7c36('0x29')][_0x7c36('0x1a')]);_0xecac67[_0x7c36('0x18')]=qs[_0x7c36('0x18')](_0x12641b[_0x7c36('0x29')][_0x7c36('0x18')]);}return _0x1044e6[_0x7c36('0x49')](_0xecac67);}})['then'](function(_0x36729b){if(_0x36729b){return _0x36729b?{'count':_0x5bb3df,'rows':_0x36729b}:null;}})[_0x7c36('0x20')](respondWithResult(_0x126ac3,null))[_0x7c36('0x3b')](handleError(_0x126ac3,null));};exports[_0x7c36('0x4a')]=function(_0x462fd4,_0x28ea89,_0x450680){var _0x4c77e8={};var _0x245cc8={};var _0x4bd5b0;var _0x105130;return db[_0x7c36('0x25')][_0x7c36('0x45')]({'where':{'id':_0x462fd4[_0x7c36('0x3d')]['id']}})[_0x7c36('0x20')](handleEntityNotFound(_0x28ea89,null))[_0x7c36('0x20')](function(_0x3e657e){if(_0x3e657e){_0x4bd5b0=_0x3e657e;_0x245cc8['model']=_[_0x7c36('0x28')](db[_0x7c36('0x46')][_0x7c36('0x3e')]);_0x245cc8[_0x7c36('0x29')]=_['keys'](_0x462fd4[_0x7c36('0x29')]);_0x245cc8[_0x7c36('0x2a')]=_['intersection'](_0x245cc8[_0x7c36('0x27')],_0x245cc8[_0x7c36('0x29')]);_0x4c77e8[_0x7c36('0x2c')]=_[_0x7c36('0x2b')](_0x245cc8[_0x7c36('0x27')],qs['fields'](_0x462fd4[_0x7c36('0x29')][_0x7c36('0x2d')]));_0x4c77e8['attributes']=_0x4c77e8[_0x7c36('0x2c')][_0x7c36('0x2e')]?_0x4c77e8[_0x7c36('0x2c')]:_0x245cc8['model'];_0x4c77e8[_0x7c36('0x30')]=qs[_0x7c36('0x31')](_0x462fd4[_0x7c36('0x29')][_0x7c36('0x31')]);_0x4c77e8[_0x7c36('0x32')]=qs[_0x7c36('0x2a')](_[_0x7c36('0x33')](_0x462fd4[_0x7c36('0x29')],_0x245cc8[_0x7c36('0x2a')]));if(_0x462fd4[_0x7c36('0x29')][_0x7c36('0x34')]){_0x4c77e8[_0x7c36('0x32')]=_[_0x7c36('0x35')](_0x4c77e8['where'],{'$or':_[_0x7c36('0x47')](_0x4c77e8[_0x7c36('0x2c')],function(_0xfe66e9){var _0xc5989a={};_0xc5989a[_0xfe66e9]={'$like':'%'+_0x462fd4[_0x7c36('0x29')]['filter']+'%'};return _0xc5989a;})});}_0x4c77e8=_[_0x7c36('0x35')]({},_0x4c77e8,_0x462fd4['options']);return _0x4bd5b0['getDescriptions'](_0x4c77e8);}})[_0x7c36('0x20')](function(_0x333adf){if(_0x333adf){_0x105130=_0x333adf[_0x7c36('0x2e')];if(!_0x462fd4[_0x7c36('0x29')]['hasOwnProperty']('nolimit')){_0x4c77e8[_0x7c36('0x1a')]=qs[_0x7c36('0x1a')](_0x462fd4['query']['limit']);_0x4c77e8[_0x7c36('0x18')]=qs[_0x7c36('0x18')](_0x462fd4['query'][_0x7c36('0x18')]);}return _0x4bd5b0[_0x7c36('0x4a')](_0x4c77e8);}})[_0x7c36('0x20')](function(_0x13ccd1){if(_0x13ccd1){return _0x13ccd1?{'count':_0x105130,'rows':_0x13ccd1}:null;}})[_0x7c36('0x20')](respondWithResult(_0x28ea89,null))[_0x7c36('0x3b')](handleError(_0x28ea89,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a53d222..475b467 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 _0x8978=['moment','bluebird','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8978,0x180));var _0x8897=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8978[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8897('0x0'));var util=require(_0x8897('0x1'));var logger=require(_0x8897('0x2'))('api');var moment=require(_0x8897('0x3'));var BPromise=require(_0x8897('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8897('0x5'));var rimraf=require(_0x8897('0x6'));var config=require(_0x8897('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8897('0x8')]=function(_0xacd23c,_0x560e6b){return _0xacd23c['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07ff=['exports','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x6a7b51,_0xea1d2e){var _0xd69478=function(_0x5cb1b9){while(--_0x5cb1b9){_0x6a7b51['push'](_0x6a7b51['shift']());}};_0xd69478(++_0xea1d2e);}(_0x07ff,0xe7));var _0xf07f=function(_0x450e9d,_0x33fd47){_0x450e9d=_0x450e9d-0x0;var _0x245356=_0x07ff[_0x450e9d];return _0x245356;};'use strict';var _=require(_0xf07f('0x0'));var util=require(_0xf07f('0x1'));var logger=require(_0xf07f('0x2'))(_0xf07f('0x3'));var moment=require(_0xf07f('0x4'));var BPromise=require(_0xf07f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf07f('0x6'));var rimraf=require('rimraf');var config=require(_0xf07f('0x7'));var attributes=require(_0xf07f('0x8'));module[_0xf07f('0x9')]=function(_0x55b8a5,_0x21b6eb){return _0x55b8a5['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d1c7779..ef69419 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 _0xc330=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5cd6ba,_0x5c2f92){var _0x2fd575=function(_0x207402){while(--_0x207402){_0x5cd6ba['push'](_0x5cd6ba['shift']());}};_0x2fd575(++_0x5c2f92);}(_0xc330,0x1d9));var _0x0c33=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc330[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0c33('0x0'));var util=require('util');var moment=require(_0x0c33('0x1'));var BPromise=require(_0x0c33('0x2'));var rs=require(_0x0c33('0x3'));var fs=require('fs');var Redis=require(_0x0c33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c33('0x5'));var logger=require(_0x0c33('0x6'))(_0x0c33('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c33('0x8'));var client=jayson[_0x0c33('0x9')][_0x0c33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2732a2,_0x573d52,_0x2c8060){return new BPromise(function(_0x725631,_0x3c1f73){return client[_0x0c33('0xb')](_0x2732a2,_0x2c8060)[_0x0c33('0xc')](function(_0x4f0525){logger[_0x0c33('0xd')](_0x0c33('0xe'),_0x573d52,_0x0c33('0xf'));logger[_0x0c33('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x573d52,_0x0c33('0xf'),JSON['stringify'](_0x4f0525));if(_0x4f0525[_0x0c33('0x11')]){if(_0x4f0525[_0x0c33('0x11')]['code']===0x1f4){logger[_0x0c33('0x11')](_0x0c33('0xe'),_0x573d52,_0x4f0525[_0x0c33('0x11')]['message']);return _0x3c1f73(_0x4f0525[_0x0c33('0x11')][_0x0c33('0x12')]);}logger['error'](_0x0c33('0xe'),_0x573d52,_0x4f0525['error'][_0x0c33('0x12')]);return _0x725631(_0x4f0525[_0x0c33('0x11')]['message']);}else{logger['info'](_0x0c33('0xe'),_0x573d52,_0x0c33('0xf'));_0x725631(_0x4f0525[_0x0c33('0x13')][_0x0c33('0x12')]);}})[_0x0c33('0x14')](function(_0x56e8fb){logger[_0x0c33('0x11')](_0x0c33('0xe'),_0x573d52,_0x56e8fb);_0x3c1f73(_0x56e8fb);});});} \ No newline at end of file +var _0x5f42=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x4a914f,_0x247258){var _0x4a88fc=function(_0x3fa243){while(--_0x3fa243){_0x4a914f['push'](_0x4a914f['shift']());}};_0x4a88fc(++_0x247258);}(_0x5f42,0xa5));var _0x25f4=function(_0x49d850,_0xcd8d1){_0x49d850=_0x49d850-0x0;var _0x3fdb28=_0x5f42[_0x49d850];return _0x3fdb28;};'use strict';var _=require(_0x25f4('0x0'));var util=require(_0x25f4('0x1'));var moment=require(_0x25f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x25f4('0x3'));var fs=require('fs');var Redis=require(_0x25f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25f4('0x5'));var logger=require(_0x25f4('0x6'))(_0x25f4('0x7'));var config=require('../../config/environment');var jayson=require(_0x25f4('0x8'));var client=jayson[_0x25f4('0x9')][_0x25f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514900,_0x223615,_0x347f7a){return new BPromise(function(_0x164d45,_0x5c1718){return client[_0x25f4('0xb')](_0x514900,_0x347f7a)[_0x25f4('0xc')](function(_0x3f3540){logger['info'](_0x25f4('0xd'),_0x223615,_0x25f4('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x223615,_0x25f4('0xe'),JSON['stringify'](_0x3f3540));if(_0x3f3540[_0x25f4('0xf')]){if(_0x3f3540['error'][_0x25f4('0x10')]===0x1f4){logger[_0x25f4('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x223615,_0x3f3540[_0x25f4('0xf')][_0x25f4('0x11')]);return _0x5c1718(_0x3f3540[_0x25f4('0xf')][_0x25f4('0x11')]);}logger[_0x25f4('0xf')](_0x25f4('0xd'),_0x223615,_0x3f3540[_0x25f4('0xf')][_0x25f4('0x11')]);return _0x164d45(_0x3f3540[_0x25f4('0xf')][_0x25f4('0x11')]);}else{logger[_0x25f4('0x12')](_0x25f4('0xd'),_0x223615,_0x25f4('0xe'));_0x164d45(_0x3f3540[_0x25f4('0x13')][_0x25f4('0x11')]);}})[_0x25f4('0x14')](function(_0x5a28df){logger[_0x25f4('0xf')](_0x25f4('0xd'),_0x223615,_0x5a28df);_0x5c1718(_0x5a28df);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 720b731..de4953e 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 _0xbb34=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4e2cdd,_0x2a6e7e){var _0x248ec7=function(_0x152847){while(--_0x152847){_0x4e2cdd['push'](_0x4e2cdd['shift']());}};_0x248ec7(++_0x2a6e7e);}(_0xbb34,0x99));var _0x4bb3=function(_0xbed58e,_0x3a1272){_0xbed58e=_0xbed58e-0x0;var _0x295e44=_0xbb34[_0xbed58e];return _0x295e44;};'use strict';var multer=require('multer');var util=require(_0x4bb3('0x0'));var path=require(_0x4bb3('0x1'));var timeout=require(_0x4bb3('0x2'));var express=require(_0x4bb3('0x3'));var router=express[_0x4bb3('0x4')]();var fs_extra=require(_0x4bb3('0x5'));var auth=require(_0x4bb3('0x6'));var interaction=require(_0x4bb3('0x7'));var config=require(_0x4bb3('0x8'));var controller=require(_0x4bb3('0x9'));router[_0x4bb3('0xa')]('/',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0xc')]);router[_0x4bb3('0xa')](_0x4bb3('0xd'),auth[_0x4bb3('0xb')](),controller['show']);router[_0x4bb3('0xe')]('/',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0xf')]);router[_0x4bb3('0x10')](_0x4bb3('0xd'),auth[_0x4bb3('0xb')](),controller[_0x4bb3('0x11')]);router[_0x4bb3('0x12')]('/:id',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0x13')]);module[_0x4bb3('0x14')]=router; \ No newline at end of file +var _0xfa73=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x4ba95c,_0x3b2118){var _0x4800c8=function(_0x303c35){while(--_0x303c35){_0x4ba95c['push'](_0x4ba95c['shift']());}};_0x4800c8(++_0x3b2118);}(_0xfa73,0x184));var _0x3fa7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfa73[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x3fa7('0x0'));var util=require(_0x3fa7('0x1'));var path=require(_0x3fa7('0x2'));var timeout=require(_0x3fa7('0x3'));var express=require(_0x3fa7('0x4'));var router=express[_0x3fa7('0x5')]();var fs_extra=require(_0x3fa7('0x6'));var auth=require(_0x3fa7('0x7'));var interaction=require(_0x3fa7('0x8'));var config=require(_0x3fa7('0x9'));var controller=require(_0x3fa7('0xa'));router['get']('/',auth[_0x3fa7('0xb')](),controller[_0x3fa7('0xc')]);router[_0x3fa7('0xd')](_0x3fa7('0xe'),auth['isAuthenticated'](),controller[_0x3fa7('0xf')]);router[_0x3fa7('0x10')]('/',auth['isAuthenticated'](),controller[_0x3fa7('0x11')]);router[_0x3fa7('0x12')]('/:id',auth[_0x3fa7('0xb')](),controller[_0x3fa7('0x13')]);router['delete'](_0x3fa7('0xe'),auth[_0x3fa7('0xb')](),controller[_0x3fa7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 56a5a8b..c913ed5 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 _0x48e4=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48e4,0x19a));var _0x448e=function(_0x1356ee,_0x2cb831){_0x1356ee=_0x1356ee-0x0;var _0x551796=_0x48e4[_0x1356ee];return _0x551796;};'use strict';var Sequelize=require(_0x448e('0x0'));module[_0x448e('0x1')]={'type':{'type':Sequelize[_0x448e('0x2')](_0x448e('0x3'),_0x448e('0x4'),_0x448e('0x5'),_0x448e('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x448e('0x7')]},'keyType':{'type':Sequelize[_0x448e('0x2')]('string',_0x448e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x448e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x448e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd96=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2b5783,_0x20e365){var _0x1c04e0=function(_0x4ac1ee){while(--_0x4ac1ee){_0x2b5783['push'](_0x2b5783['shift']());}};_0x1c04e0(++_0x20e365);}(_0xbd96,0x1c9));var _0x6bd9=function(_0x93da6c,_0x448776){_0x93da6c=_0x93da6c-0x0;var _0x35dff0=_0xbd96[_0x93da6c];return _0x35dff0;};'use strict';var Sequelize=require(_0x6bd9('0x0'));module[_0x6bd9('0x1')]={'type':{'type':Sequelize[_0x6bd9('0x2')](_0x6bd9('0x3'),_0x6bd9('0x4'),_0x6bd9('0x5'),_0x6bd9('0x6'),_0x6bd9('0x7')),'defaultValue':_0x6bd9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6bd9('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6bd9('0x4'),_0x6bd9('0x5'))},'keyContent':{'type':Sequelize[_0x6bd9('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6bd9('0x8')]},'customField':{'type':Sequelize[_0x6bd9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6bd9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3e8456c..1049a18 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 _0x78ce=['apply','reject','save','then','error','stack','send','index','SugarcrmField','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','include','findAll','params','keys','includeAll','find','catch','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x78ce,0x17f));var _0xe78c=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0x78ce[_0x90e575];return _0x1aae60;};'use strict';var emlformat=require(_0xe78c('0x0'));var rimraf=require(_0xe78c('0x1'));var zipdir=require(_0xe78c('0x2'));var jsonpatch=require(_0xe78c('0x3'));var rp=require(_0xe78c('0x4'));var moment=require(_0xe78c('0x5'));var BPromise=require(_0xe78c('0x6'));var Mustache=require(_0xe78c('0x7'));var util=require(_0xe78c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe78c('0x9'));var ejs=require(_0xe78c('0xa'));var fs=require('fs');var fs_extra=require(_0xe78c('0xb'));var _=require(_0xe78c('0xc'));var squel=require(_0xe78c('0xd'));var crypto=require('crypto');var jsforce=require(_0xe78c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe78c('0xf'));var Papa=require(_0xe78c('0x10'));var Redis=require(_0xe78c('0x11'));var authService=require(_0xe78c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe78c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe78c('0x14'));var config=require(_0xe78c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f987,_0x4b931c){_0x4b931c=_0x4b931c||0xcc;return function(_0x48e1be){if(_0x48e1be){return _0x37f987[_0xe78c('0x16')](_0x4b931c);}return _0x37f987[_0xe78c('0x17')](_0x4b931c)[_0xe78c('0x18')]();};}function respondWithResult(_0x4f1ff7,_0x1baac9){_0x1baac9=_0x1baac9||0xc8;return function(_0x29a7ab){if(_0x29a7ab){return _0x4f1ff7[_0xe78c('0x17')](_0x1baac9)[_0xe78c('0x19')](_0x29a7ab);}};}function respondWithFilteredResult(_0x590371,_0x4090fb){return function(_0x3747cd){if(_0x3747cd){var _0x4adda0=typeof _0x4090fb[_0xe78c('0x1a')]===_0xe78c('0x1b')&&typeof _0x4090fb[_0xe78c('0x1c')]===_0xe78c('0x1b');var _0x1c765a=_0x3747cd[_0xe78c('0x1d')];var _0x3f07a0=_0x4adda0?0x0:_0x4090fb[_0xe78c('0x1a')];var _0x44868a=_0x4adda0?_0x3747cd['count']:_0x4090fb['offset']+_0x4090fb['limit'];var _0x25d88e;if(_0x44868a>=_0x1c765a){_0x44868a=_0x1c765a;_0x25d88e=0xc8;}else{_0x25d88e=0xce;}_0x590371[_0xe78c('0x17')](_0x25d88e);return _0x590371['set'](_0xe78c('0x1e'),_0x3f07a0+'-'+_0x44868a+'/'+_0x1c765a)[_0xe78c('0x19')](_0x3747cd);}return null;};}function patchUpdates(_0x3818c4){return function(_0x409c22){try{jsonpatch[_0xe78c('0x1f')](_0x409c22,_0x3818c4,!![]);}catch(_0x562887){return BPromise[_0xe78c('0x20')](_0x562887);}return _0x409c22[_0xe78c('0x21')]();};}function saveUpdates(_0x4844d8,_0x3062ed){return function(_0x11def3){if(_0x11def3){return _0x11def3['update'](_0x4844d8)[_0xe78c('0x22')](function(_0x3359d6){return _0x3359d6;});}return null;};}function removeEntity(_0xac4b51,_0x4e2957){return function(_0x497aa1){if(_0x497aa1){return _0x497aa1['destroy']()[_0xe78c('0x22')](function(){_0xac4b51['status'](0xcc)[_0xe78c('0x18')]();});}};}function handleEntityNotFound(_0x39431e,_0x3f916b){return function(_0x252cd9){if(!_0x252cd9){_0x39431e[_0xe78c('0x16')](0x194);}return _0x252cd9;};}function handleError(_0x49fa47,_0x3e8c2e){_0x3e8c2e=_0x3e8c2e||0x1f4;return function(_0x171237){logger[_0xe78c('0x23')](_0x171237[_0xe78c('0x24')]);if(_0x171237['name']){delete _0x171237['name'];}_0x49fa47[_0xe78c('0x17')](_0x3e8c2e)[_0xe78c('0x25')](_0x171237);};}exports[_0xe78c('0x26')]=function(_0x12ce52,_0xd971ba){var _0x4edf1b={},_0x33acd2={},_0x2e2e74={'count':0x0,'rows':[]};var _0x18122b=_['map'](db[_0xe78c('0x27')][_0xe78c('0x28')],function(_0xdcc1a0){return{'name':_0xdcc1a0['fieldName'],'type':_0xdcc1a0[_0xe78c('0x29')][_0xe78c('0x2a')]};});_0x33acd2[_0xe78c('0x2b')]=_[_0xe78c('0x2c')](_0x18122b,_0xe78c('0x2d'));_0x33acd2[_0xe78c('0x2e')]=_['keys'](_0x12ce52[_0xe78c('0x2e')]);_0x33acd2[_0xe78c('0x2f')]=_['intersection'](_0x33acd2[_0xe78c('0x2b')],_0x33acd2[_0xe78c('0x2e')]);_0x4edf1b[_0xe78c('0x30')]=_[_0xe78c('0x31')](_0x33acd2[_0xe78c('0x2b')],qs[_0xe78c('0x32')](_0x12ce52[_0xe78c('0x2e')][_0xe78c('0x32')]));_0x4edf1b['attributes']=_0x4edf1b['attributes'][_0xe78c('0x33')]?_0x4edf1b['attributes']:_0x33acd2[_0xe78c('0x2b')];if(!_0x12ce52[_0xe78c('0x2e')][_0xe78c('0x34')](_0xe78c('0x35'))){_0x4edf1b['limit']=qs['limit'](_0x12ce52['query'][_0xe78c('0x1c')]);_0x4edf1b['offset']=qs[_0xe78c('0x1a')](_0x12ce52['query'][_0xe78c('0x1a')]);}_0x4edf1b[_0xe78c('0x36')]=qs['sort'](_0x12ce52[_0xe78c('0x2e')]['sort']);_0x4edf1b['where']=qs[_0xe78c('0x2f')](_[_0xe78c('0x37')](_0x12ce52[_0xe78c('0x2e')],_0x33acd2[_0xe78c('0x2f')]),_0x18122b);if(_0x12ce52['query'][_0xe78c('0x38')]){_0x4edf1b['where']=_['merge'](_0x4edf1b[_0xe78c('0x39')],{'$or':_[_0xe78c('0x2c')](_0x18122b,function(_0x109fb7){if(_0x109fb7[_0xe78c('0x29')]!==_0xe78c('0x3a')){var _0xa79628={};_0xa79628[_0x109fb7['name']]={'$like':'%'+_0x12ce52['query'][_0xe78c('0x38')]+'%'};return _0xa79628;}})});}_0x4edf1b=_[_0xe78c('0x3b')]({},_0x4edf1b,_0x12ce52['options']);var _0x37e1b7={'where':_0x4edf1b[_0xe78c('0x39')]};return db[_0xe78c('0x27')][_0xe78c('0x1d')](_0x37e1b7)['then'](function(_0x26f610){_0x2e2e74['count']=_0x26f610;if(_0x12ce52['query']['includeAll']){_0x4edf1b[_0xe78c('0x3c')]=[{'all':!![]}];}return db[_0xe78c('0x27')][_0xe78c('0x3d')](_0x4edf1b);})[_0xe78c('0x22')](function(_0x1f513c){_0x2e2e74['rows']=_0x1f513c;return _0x2e2e74;})[_0xe78c('0x22')](respondWithFilteredResult(_0xd971ba,_0x4edf1b))['catch'](handleError(_0xd971ba,null));};exports['show']=function(_0x55ab39,_0x54b213){var _0x3ef298={'raw':!![],'where':{'id':_0x55ab39[_0xe78c('0x3e')]['id']}},_0x212378={};_0x212378[_0xe78c('0x2b')]=_[_0xe78c('0x3f')](db[_0xe78c('0x27')][_0xe78c('0x28')]);_0x212378[_0xe78c('0x2e')]=_[_0xe78c('0x3f')](_0x55ab39[_0xe78c('0x2e')]);_0x212378[_0xe78c('0x2f')]=_[_0xe78c('0x31')](_0x212378[_0xe78c('0x2b')],_0x212378[_0xe78c('0x2e')]);_0x3ef298[_0xe78c('0x30')]=_[_0xe78c('0x31')](_0x212378[_0xe78c('0x2b')],qs['fields'](_0x55ab39['query'][_0xe78c('0x32')]));_0x3ef298[_0xe78c('0x30')]=_0x3ef298[_0xe78c('0x30')][_0xe78c('0x33')]?_0x3ef298['attributes']:_0x212378['model'];if(_0x55ab39[_0xe78c('0x2e')][_0xe78c('0x40')]){_0x3ef298[_0xe78c('0x3c')]=[{'all':!![]}];}_0x3ef298=_[_0xe78c('0x3b')]({},_0x3ef298,_0x55ab39['options']);return db['SugarcrmField'][_0xe78c('0x41')](_0x3ef298)[_0xe78c('0x22')](handleEntityNotFound(_0x54b213,null))[_0xe78c('0x22')](respondWithResult(_0x54b213,null))[_0xe78c('0x42')](handleError(_0x54b213,null));};exports['create']=function(_0xc863bc,_0x331c10){return db['SugarcrmField']['create'](_0xc863bc[_0xe78c('0x43')],{})[_0xe78c('0x22')](respondWithResult(_0x331c10,0xc9))[_0xe78c('0x42')](handleError(_0x331c10,null));};exports[_0xe78c('0x44')]=function(_0x3943e9,_0x157601){if(_0x3943e9[_0xe78c('0x43')]['id']){delete _0x3943e9['body']['id'];}return db[_0xe78c('0x27')]['find']({'where':{'id':_0x3943e9[_0xe78c('0x3e')]['id']}})[_0xe78c('0x22')](handleEntityNotFound(_0x157601,null))[_0xe78c('0x22')](saveUpdates(_0x3943e9['body'],null))[_0xe78c('0x22')](respondWithResult(_0x157601,null))[_0xe78c('0x42')](handleError(_0x157601,null));};exports['destroy']=function(_0x2e6c80,_0x352571){return db[_0xe78c('0x27')][_0xe78c('0x41')]({'where':{'id':_0x2e6c80[_0xe78c('0x3e')]['id']}})[_0xe78c('0x22')](handleEntityNotFound(_0x352571,null))[_0xe78c('0x22')](removeEntity(_0x352571,null))['catch'](handleError(_0x352571,null));}; \ No newline at end of file +var _0xbdae=['includeAll','include','findAll','rows','show','params','length','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','send','index','map','SugarcrmField','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x58b096,_0x4fc94b){var _0x5c28ab=function(_0x2385ca){while(--_0x2385ca){_0x58b096['push'](_0x58b096['shift']());}};_0x5c28ab(++_0x4fc94b);}(_0xbdae,0x96));var _0xebda=function(_0x489eb4,_0x1f2c87){_0x489eb4=_0x489eb4-0x0;var _0x5a1a18=_0xbdae[_0x489eb4];return _0x5a1a18;};'use strict';var emlformat=require(_0xebda('0x0'));var rimraf=require(_0xebda('0x1'));var zipdir=require(_0xebda('0x2'));var jsonpatch=require(_0xebda('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebda('0x4'));var util=require(_0xebda('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebda('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebda('0x7'));var squel=require('squel');var crypto=require(_0xebda('0x8'));var jsforce=require(_0xebda('0x9'));var deskjs=require(_0xebda('0xa'));var toCsv=require(_0xebda('0xb'));var querystring=require(_0xebda('0xc'));var Papa=require(_0xebda('0xd'));var Redis=require('ioredis');var authService=require(_0xebda('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xebda('0xf'));var hardwareService=require(_0xebda('0x10'));var logger=require(_0xebda('0x11'))(_0xebda('0x12'));var utils=require(_0xebda('0x13'));var config=require(_0xebda('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xebda('0x15'))['db'];function respondWithStatusCode(_0x3860be,_0x4321c4){_0x4321c4=_0x4321c4||0xcc;return function(_0x37f01a){if(_0x37f01a){return _0x3860be[_0xebda('0x16')](_0x4321c4);}return _0x3860be[_0xebda('0x17')](_0x4321c4)[_0xebda('0x18')]();};}function respondWithResult(_0x2aabdd,_0xb4916a){_0xb4916a=_0xb4916a||0xc8;return function(_0x4e413b){if(_0x4e413b){return _0x2aabdd[_0xebda('0x17')](_0xb4916a)['json'](_0x4e413b);}};}function respondWithFilteredResult(_0x2bc433,_0xc2ad96){return function(_0x112825){if(_0x112825){var _0xfe7e7f=typeof _0xc2ad96[_0xebda('0x19')]===_0xebda('0x1a')&&typeof _0xc2ad96[_0xebda('0x1b')]===_0xebda('0x1a');var _0x5e5b99=_0x112825[_0xebda('0x1c')];var _0x3446d6=_0xfe7e7f?0x0:_0xc2ad96[_0xebda('0x19')];var _0x452649=_0xfe7e7f?_0x112825[_0xebda('0x1c')]:_0xc2ad96[_0xebda('0x19')]+_0xc2ad96[_0xebda('0x1b')];var _0x49f7dd;if(_0x452649>=_0x5e5b99){_0x452649=_0x5e5b99;_0x49f7dd=0xc8;}else{_0x49f7dd=0xce;}_0x2bc433[_0xebda('0x17')](_0x49f7dd);return _0x2bc433[_0xebda('0x1d')](_0xebda('0x1e'),_0x3446d6+'-'+_0x452649+'/'+_0x5e5b99)[_0xebda('0x1f')](_0x112825);}return null;};}function patchUpdates(_0x4d5564){return function(_0x125d76){try{jsonpatch['apply'](_0x125d76,_0x4d5564,!![]);}catch(_0x860696){return BPromise['reject'](_0x860696);}return _0x125d76[_0xebda('0x20')]();};}function saveUpdates(_0x29c7fc,_0x1bbde6){return function(_0x3806a6){if(_0x3806a6){return _0x3806a6[_0xebda('0x21')](_0x29c7fc)[_0xebda('0x22')](function(_0x12ab49){return _0x12ab49;});}return null;};}function removeEntity(_0x30d033,_0x41e596){return function(_0x3b9473){if(_0x3b9473){return _0x3b9473['destroy']()['then'](function(){_0x30d033[_0xebda('0x17')](0xcc)[_0xebda('0x18')]();});}};}function handleEntityNotFound(_0x1865bc,_0x14fd37){return function(_0xa089b4){if(!_0xa089b4){_0x1865bc[_0xebda('0x16')](0x194);}return _0xa089b4;};}function handleError(_0x314595,_0x3ae895){_0x3ae895=_0x3ae895||0x1f4;return function(_0x4bb0f1){logger['error'](_0x4bb0f1['stack']);if(_0x4bb0f1['name']){delete _0x4bb0f1['name'];}_0x314595[_0xebda('0x17')](_0x3ae895)[_0xebda('0x23')](_0x4bb0f1);};}exports[_0xebda('0x24')]=function(_0x1ab9a8,_0x5c925e){var _0x297b48={},_0x525a2a={},_0x45217c={'count':0x0,'rows':[]};var _0x15f298=_[_0xebda('0x25')](db[_0xebda('0x26')][_0xebda('0x27')],function(_0x263442){return{'name':_0x263442['fieldName'],'type':_0x263442[_0xebda('0x28')][_0xebda('0x29')]};});_0x525a2a[_0xebda('0x2a')]=_[_0xebda('0x25')](_0x15f298,_0xebda('0x2b'));_0x525a2a[_0xebda('0x2c')]=_[_0xebda('0x2d')](_0x1ab9a8[_0xebda('0x2c')]);_0x525a2a[_0xebda('0x2e')]=_[_0xebda('0x2f')](_0x525a2a[_0xebda('0x2a')],_0x525a2a[_0xebda('0x2c')]);_0x297b48[_0xebda('0x30')]=_[_0xebda('0x2f')](_0x525a2a[_0xebda('0x2a')],qs[_0xebda('0x31')](_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x31')]));_0x297b48[_0xebda('0x30')]=_0x297b48[_0xebda('0x30')]['length']?_0x297b48[_0xebda('0x30')]:_0x525a2a[_0xebda('0x2a')];if(!_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x32')](_0xebda('0x33'))){_0x297b48['limit']=qs['limit'](_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x1b')]);_0x297b48[_0xebda('0x19')]=qs[_0xebda('0x19')](_0x1ab9a8['query']['offset']);}_0x297b48[_0xebda('0x34')]=qs[_0xebda('0x35')](_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x35')]);_0x297b48[_0xebda('0x36')]=qs['filters'](_[_0xebda('0x37')](_0x1ab9a8[_0xebda('0x2c')],_0x525a2a[_0xebda('0x2e')]),_0x15f298);if(_0x1ab9a8['query'][_0xebda('0x38')]){_0x297b48[_0xebda('0x36')]=_[_0xebda('0x39')](_0x297b48[_0xebda('0x36')],{'$or':_[_0xebda('0x25')](_0x15f298,function(_0x1d02de){if(_0x1d02de[_0xebda('0x28')]!==_0xebda('0x3a')){var _0x3ef4b2={};_0x3ef4b2[_0x1d02de['name']]={'$like':'%'+_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x38')]+'%'};return _0x3ef4b2;}})});}_0x297b48=_[_0xebda('0x39')]({},_0x297b48,_0x1ab9a8[_0xebda('0x3b')]);var _0x284660={'where':_0x297b48['where']};return db[_0xebda('0x26')][_0xebda('0x1c')](_0x284660)[_0xebda('0x22')](function(_0x4b1ea1){_0x45217c[_0xebda('0x1c')]=_0x4b1ea1;if(_0x1ab9a8[_0xebda('0x2c')][_0xebda('0x3c')]){_0x297b48[_0xebda('0x3d')]=[{'all':!![]}];}return db[_0xebda('0x26')][_0xebda('0x3e')](_0x297b48);})['then'](function(_0x8a4ccb){_0x45217c[_0xebda('0x3f')]=_0x8a4ccb;return _0x45217c;})[_0xebda('0x22')](respondWithFilteredResult(_0x5c925e,_0x297b48))['catch'](handleError(_0x5c925e,null));};exports[_0xebda('0x40')]=function(_0x2b043f,_0x34c5b6){var _0x41bda2={'raw':!![],'where':{'id':_0x2b043f[_0xebda('0x41')]['id']}},_0x32734e={};_0x32734e['model']=_['keys'](db[_0xebda('0x26')][_0xebda('0x27')]);_0x32734e[_0xebda('0x2c')]=_['keys'](_0x2b043f[_0xebda('0x2c')]);_0x32734e['filters']=_[_0xebda('0x2f')](_0x32734e[_0xebda('0x2a')],_0x32734e[_0xebda('0x2c')]);_0x41bda2[_0xebda('0x30')]=_['intersection'](_0x32734e['model'],qs[_0xebda('0x31')](_0x2b043f[_0xebda('0x2c')][_0xebda('0x31')]));_0x41bda2[_0xebda('0x30')]=_0x41bda2[_0xebda('0x30')][_0xebda('0x42')]?_0x41bda2[_0xebda('0x30')]:_0x32734e[_0xebda('0x2a')];if(_0x2b043f[_0xebda('0x2c')][_0xebda('0x3c')]){_0x41bda2[_0xebda('0x3d')]=[{'all':!![]}];}_0x41bda2=_[_0xebda('0x39')]({},_0x41bda2,_0x2b043f[_0xebda('0x3b')]);return db[_0xebda('0x26')][_0xebda('0x43')](_0x41bda2)[_0xebda('0x22')](handleEntityNotFound(_0x34c5b6,null))['then'](respondWithResult(_0x34c5b6,null))[_0xebda('0x44')](handleError(_0x34c5b6,null));};exports['create']=function(_0x57ec3d,_0x351733){return db[_0xebda('0x26')]['create'](_0x57ec3d[_0xebda('0x45')],{})['then'](respondWithResult(_0x351733,0xc9))[_0xebda('0x44')](handleError(_0x351733,null));};exports[_0xebda('0x21')]=function(_0x339a4a,_0x4af7c2){if(_0x339a4a[_0xebda('0x45')]['id']){delete _0x339a4a[_0xebda('0x45')]['id'];}return db[_0xebda('0x26')][_0xebda('0x43')]({'where':{'id':_0x339a4a[_0xebda('0x41')]['id']}})['then'](handleEntityNotFound(_0x4af7c2,null))['then'](saveUpdates(_0x339a4a[_0xebda('0x45')],null))[_0xebda('0x22')](respondWithResult(_0x4af7c2,null))[_0xebda('0x44')](handleError(_0x4af7c2,null));};exports['destroy']=function(_0x5f26af,_0x5bb428){return db['SugarcrmField'][_0xebda('0x43')]({'where':{'id':_0x5f26af['params']['id']}})[_0xebda('0x22')](handleEntityNotFound(_0x5bb428,null))[_0xebda('0x22')](removeEntity(_0x5bb428,null))[_0xebda('0x44')](handleError(_0x5bb428,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a67679b..d34f4f6 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 _0x9dab=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9dab,0x1eb));var _0xb9da=function(_0x581c2b,_0xa6d0cb){_0x581c2b=_0x581c2b-0x0;var _0x403750=_0x9dab[_0x581c2b];return _0x403750;};'use strict';var _=require(_0xb9da('0x0'));var util=require(_0xb9da('0x1'));var logger=require(_0xb9da('0x2'))(_0xb9da('0x3'));var moment=require(_0xb9da('0x4'));var BPromise=require(_0xb9da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9da('0x6'));var rimraf=require(_0xb9da('0x7'));var config=require(_0xb9da('0x8'));var attributes=require(_0xb9da('0x9'));module[_0xb9da('0xa')]=function(_0x4695d3,_0x5ac475){return _0x4695d3[_0xb9da('0xb')](_0xb9da('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xb9da('0xd'),'fields':['idField',_0xb9da('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2993=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x26ab93,_0x4cb43c){var _0x1fdae6=function(_0x1e9b0e){while(--_0x1e9b0e){_0x26ab93['push'](_0x26ab93['shift']());}};_0x1fdae6(++_0x4cb43c);}(_0x2993,0xaa));var _0x3299=function(_0x57206c,_0x91f0c8){_0x57206c=_0x57206c-0x0;var _0x1101c0=_0x2993[_0x57206c];return _0x1101c0;};'use strict';var _=require(_0x3299('0x0'));var util=require(_0x3299('0x1'));var logger=require('../../config/logger')(_0x3299('0x2'));var moment=require(_0x3299('0x3'));var BPromise=require(_0x3299('0x4'));var rp=require(_0x3299('0x5'));var fs=require('fs');var path=require(_0x3299('0x6'));var rimraf=require('rimraf');var config=require(_0x3299('0x7'));var attributes=require(_0x3299('0x8'));module[_0x3299('0x9')]=function(_0x3f2ba8,_0x5c4134){return _0x3f2ba8[_0x3299('0xa')]('SugarcrmField',attributes,{'tableName':_0x3299('0xb'),'paranoid':![],'indexes':[{'name':_0x3299('0xc'),'fields':[_0x3299('0xd'),_0x3299('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 6e8d3b3..bb701bf 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 _0xee1d=['debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x43029e,_0x2a0207){var _0xd8bab0=function(_0x3fd8eb){while(--_0x3fd8eb){_0x43029e['push'](_0x43029e['shift']());}};_0xd8bab0(++_0x2a0207);}(_0xee1d,0x134));var _0xdee1=function(_0x5b6a0f,_0x1f03ca){_0x5b6a0f=_0x5b6a0f-0x0;var _0xa38065=_0xee1d[_0x5b6a0f];return _0xa38065;};'use strict';var _=require('lodash');var util=require(_0xdee1('0x0'));var moment=require(_0xdee1('0x1'));var BPromise=require(_0xdee1('0x2'));var rs=require(_0xdee1('0x3'));var fs=require('fs');var Redis=require(_0xdee1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdee1('0x5'));var logger=require(_0xdee1('0x6'))(_0xdee1('0x7'));var config=require(_0xdee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdee1('0x9')][_0xdee1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3544c8,_0x460563,_0x3b02ee){return new BPromise(function(_0x180303,_0x34a2c4){return client[_0xdee1('0xb')](_0x3544c8,_0x3b02ee)[_0xdee1('0xc')](function(_0x40725b){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x460563,_0xdee1('0xd'));logger[_0xdee1('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x460563,_0xdee1('0xd'),JSON[_0xdee1('0xf')](_0x40725b));if(_0x40725b[_0xdee1('0x10')]){if(_0x40725b[_0xdee1('0x10')][_0xdee1('0x11')]===0x1f4){logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x40725b[_0xdee1('0x10')][_0xdee1('0x13')]);return _0x34a2c4(_0x40725b['error'][_0xdee1('0x13')]);}logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x40725b['error'][_0xdee1('0x13')]);return _0x180303(_0x40725b['error']['message']);}else{logger[_0xdee1('0x14')](_0xdee1('0x12'),_0x460563,_0xdee1('0xd'));_0x180303(_0x40725b[_0xdee1('0x15')][_0xdee1('0x13')]);}})[_0xdee1('0x16')](function(_0x5bb872){logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x5bb872);_0x34a2c4(_0x5bb872);});});} \ No newline at end of file +var _0x7dd3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x7dd3,0x1df));var _0x37dd=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0x7dd3[_0x12e6e5];return _0x4ef6ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x37dd('0x0'));var rs=require(_0x37dd('0x1'));var fs=require('fs');var Redis=require(_0x37dd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x37dd('0x3'));var logger=require(_0x37dd('0x4'))(_0x37dd('0x5'));var config=require(_0x37dd('0x6'));var jayson=require(_0x37dd('0x7'));var client=jayson[_0x37dd('0x8')][_0x37dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57be32,_0x5e8452,_0x3101a3){return new BPromise(function(_0x106d7d,_0x4007f6){return client['request'](_0x57be32,_0x3101a3)[_0x37dd('0xa')](function(_0x3124b2){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x5e8452,'request\x20sent');logger[_0x37dd('0xb')](_0x37dd('0xc'),_0x5e8452,_0x37dd('0xd'),JSON[_0x37dd('0xe')](_0x3124b2));if(_0x3124b2['error']){if(_0x3124b2[_0x37dd('0xf')][_0x37dd('0x10')]===0x1f4){logger[_0x37dd('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x5e8452,_0x3124b2[_0x37dd('0xf')]['message']);return _0x4007f6(_0x3124b2[_0x37dd('0xf')][_0x37dd('0x11')]);}logger[_0x37dd('0xf')](_0x37dd('0x12'),_0x5e8452,_0x3124b2[_0x37dd('0xf')][_0x37dd('0x11')]);return _0x106d7d(_0x3124b2['error'][_0x37dd('0x11')]);}else{logger['info'](_0x37dd('0x12'),_0x5e8452,'request\x20sent');_0x106d7d(_0x3124b2[_0x37dd('0x13')]['message']);}})[_0x37dd('0x14')](function(_0x52669f){logger['error'](_0x37dd('0x12'),_0x5e8452,_0x52669f);_0x4007f6(_0x52669f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f3c4539..ff1e041 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 _0x2bbb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x26d9bc,_0x596175){var _0x1305df=function(_0x53529d){while(--_0x53529d){_0x26d9bc['push'](_0x26d9bc['shift']());}};_0x1305df(++_0x596175);}(_0x2bbb,0x85));var _0xb2bb=function(_0x594a88,_0x61bc31){_0x594a88=_0x594a88-0x0;var _0xe2a24d=_0x2bbb[_0x594a88];return _0xe2a24d;};'use strict';var multer=require('multer');var util=require(_0xb2bb('0x0'));var path=require(_0xb2bb('0x1'));var timeout=require(_0xb2bb('0x2'));var express=require('express');var router=express[_0xb2bb('0x3')]();var fs_extra=require(_0xb2bb('0x4'));var auth=require(_0xb2bb('0x5'));var interaction=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var controller=require(_0xb2bb('0x8'));router['get']('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xa')]);router['get'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xc')]);router[_0xb2bb('0xd')]('/:id/configurations',auth[_0xb2bb('0x9')](),controller['getConfigurations']);router[_0xb2bb('0xd')](_0xb2bb('0xe'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xf')]);router[_0xb2bb('0x10')]('/',auth['isAuthenticated'](),controller[_0xb2bb('0x11')]);router['post'](_0xb2bb('0x12'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x13')]);router[_0xb2bb('0x14')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller['update']);router[_0xb2bb('0x15')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe148=['post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x547f8d,_0x3462bb){var _0x1c21ee=function(_0x56026a){while(--_0x56026a){_0x547f8d['push'](_0x547f8d['shift']());}};_0x1c21ee(++_0x3462bb);}(_0xe148,0x109));var _0x8e14=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0xe148[_0x45d5ef];return _0x474d19;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require(_0x8e14('0x2'));var timeout=require(_0x8e14('0x3'));var express=require(_0x8e14('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require(_0x8e14('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8e14('0x9')](_0x8e14('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8e14('0x9')]('/:id/configurations',auth[_0x8e14('0xb')](),controller[_0x8e14('0xc')]);router[_0x8e14('0x9')](_0x8e14('0xd'),auth[_0x8e14('0xb')](),controller[_0x8e14('0xe')]);router[_0x8e14('0xf')]('/',auth[_0x8e14('0xb')](),controller['create']);router[_0x8e14('0xf')]('/:id/configurations',auth[_0x8e14('0xb')](),controller[_0x8e14('0x10')]);router[_0x8e14('0x11')](_0x8e14('0xa'),auth[_0x8e14('0xb')](),controller['update']);router[_0x8e14('0x12')](_0x8e14('0xa'),auth[_0x8e14('0xb')](),controller[_0x8e14('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e77a1ae..62401f5 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 _0x9eb7=['exports','STRING','HelpDesk'];(function(_0xf2dc4b,_0x1079ce){var _0x313f8c=function(_0x5110a2){while(--_0x5110a2){_0xf2dc4b['push'](_0xf2dc4b['shift']());}};_0x313f8c(++_0x1079ce);}(_0x9eb7,0x1c5));var _0x79eb=function(_0xcbca77,_0x2cd7ce){_0xcbca77=_0xcbca77-0x0;var _0x409f23=_0x9eb7[_0xcbca77];return _0x409f23;};'use strict';var Sequelize=require('sequelize');module[_0x79eb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x79eb('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x79eb('0x2')},'remoteUri':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2a11=['HelpDesk','sequelize','exports','STRING'];(function(_0x223536,_0x557f7d){var _0x25b182=function(_0x2ae6e6){while(--_0x2ae6e6){_0x223536['push'](_0x223536['shift']());}};_0x25b182(++_0x557f7d);}(_0x2a11,0x69));var _0x12a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a11[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x12a1('0x0'));module[_0x12a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x12a1('0x2')]},'username':{'type':Sequelize[_0x12a1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x12a1('0x3')},'remoteUri':{'type':Sequelize[_0x12a1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x12a1('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x12a1('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 33c9611..e672601 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 _0xd5f2=['rows','catch','params','keys','rawAttributes','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','findOne','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3f6a82,_0x1f0bf8){var _0x225f97=function(_0x486a16){while(--_0x486a16){_0x3f6a82['push'](_0x3f6a82['shift']());}};_0x225f97(++_0x1f0bf8);}(_0xd5f2,0x1b0));var _0x2d5f=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd5f2[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0x2d5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d5f('0x1'));var jsonpatch=require(_0x2d5f('0x2'));var rp=require(_0x2d5f('0x3'));var moment=require('moment');var BPromise=require(_0x2d5f('0x4'));var Mustache=require(_0x2d5f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2d5f('0x6'));var csv=require(_0x2d5f('0x7'));var ejs=require(_0x2d5f('0x8'));var fs=require('fs');var fs_extra=require(_0x2d5f('0x9'));var _=require('lodash');var squel=require(_0x2d5f('0xa'));var crypto=require(_0x2d5f('0xb'));var jsforce=require(_0x2d5f('0xc'));var deskjs=require(_0x2d5f('0xd'));var toCsv=require(_0x2d5f('0x7'));var querystring=require(_0x2d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d5f('0xf'));var authService=require(_0x2d5f('0x10'));var qs=require(_0x2d5f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d5f('0x12'));var logger=require(_0x2d5f('0x13'))(_0x2d5f('0x14'));var utils=require('../../config/utils');var config=require(_0x2d5f('0x15'));var licenseUtil=require(_0x2d5f('0x16'));var db=require(_0x2d5f('0x17'))['db'];var integrations=require(_0x2d5f('0x18'));function respondWithStatusCode(_0x6a1701,_0x5d2dbd){_0x5d2dbd=_0x5d2dbd||0xcc;return function(_0x389f40){if(_0x389f40){return _0x6a1701[_0x2d5f('0x19')](_0x5d2dbd);}return _0x6a1701['status'](_0x5d2dbd)[_0x2d5f('0x1a')]();};}function respondWithResult(_0x277312,_0x5f582e){_0x5f582e=_0x5f582e||0xc8;return function(_0x524514){if(_0x524514){return _0x277312[_0x2d5f('0x1b')](_0x5f582e)[_0x2d5f('0x1c')](_0x524514);}};}function respondWithFilteredResult(_0x2dac9b,_0x2fbd94){return function(_0x44eab3){if(_0x44eab3){var _0xc38d8f=typeof _0x2fbd94[_0x2d5f('0x1d')]===_0x2d5f('0x1e')&&typeof _0x2fbd94[_0x2d5f('0x1f')]===_0x2d5f('0x1e');var _0x145e47=_0x44eab3[_0x2d5f('0x20')];var _0x38d2e0=_0xc38d8f?0x0:_0x2fbd94[_0x2d5f('0x1d')];var _0x143b5c=_0xc38d8f?_0x44eab3['count']:_0x2fbd94[_0x2d5f('0x1d')]+_0x2fbd94['limit'];var _0x466e1a;if(_0x143b5c>=_0x145e47){_0x143b5c=_0x145e47;_0x466e1a=0xc8;}else{_0x466e1a=0xce;}_0x2dac9b[_0x2d5f('0x1b')](_0x466e1a);return _0x2dac9b[_0x2d5f('0x21')](_0x2d5f('0x22'),_0x38d2e0+'-'+_0x143b5c+'/'+_0x145e47)[_0x2d5f('0x1c')](_0x44eab3);}return null;};}function patchUpdates(_0x4912bb){return function(_0x2821c8){try{jsonpatch[_0x2d5f('0x23')](_0x2821c8,_0x4912bb,!![]);}catch(_0x443c03){return BPromise['reject'](_0x443c03);}return _0x2821c8['save']();};}function saveUpdates(_0x275ae4,_0x9bf9a3){return function(_0x2e2cd6){if(_0x2e2cd6){return _0x2e2cd6[_0x2d5f('0x24')](_0x275ae4)[_0x2d5f('0x25')](function(_0x142d21){return _0x142d21;});}return null;};}function removeEntity(_0x1b081d,_0x103664){return function(_0x1f00b2){if(_0x1f00b2){return _0x1f00b2[_0x2d5f('0x26')]()[_0x2d5f('0x25')](function(){_0x1b081d[_0x2d5f('0x1b')](0xcc)[_0x2d5f('0x1a')]();});}};}function handleEntityNotFound(_0xddc9e3,_0x386d94){return function(_0x39f282){if(!_0x39f282){_0xddc9e3['sendStatus'](0x194);}return _0x39f282;};}function handleError(_0x7558e9,_0x4bd158){_0x4bd158=_0x4bd158||0x1f4;return function(_0x3c39a3){logger[_0x2d5f('0x27')](_0x3c39a3[_0x2d5f('0x28')]);if(_0x3c39a3[_0x2d5f('0x29')]){delete _0x3c39a3[_0x2d5f('0x29')];}_0x7558e9[_0x2d5f('0x1b')](_0x4bd158)[_0x2d5f('0x2a')](_0x3c39a3);};}exports[_0x2d5f('0x2b')]=function(_0x4566f6,_0x48781d){var _0x2cc4c0={},_0x1503f8={},_0x5d9471={'count':0x0,'rows':[]};var _0x1d667f=_[_0x2d5f('0x2c')](db[_0x2d5f('0x2d')]['rawAttributes'],function(_0x305331){return{'name':_0x305331[_0x2d5f('0x2e')],'type':_0x305331[_0x2d5f('0x2f')]['key']};});_0x1503f8[_0x2d5f('0x30')]=_[_0x2d5f('0x2c')](_0x1d667f,_0x2d5f('0x29'));_0x1503f8[_0x2d5f('0x31')]=_['keys'](_0x4566f6[_0x2d5f('0x31')]);_0x1503f8[_0x2d5f('0x32')]=_[_0x2d5f('0x33')](_0x1503f8[_0x2d5f('0x30')],_0x1503f8[_0x2d5f('0x31')]);_0x2cc4c0['attributes']=_[_0x2d5f('0x33')](_0x1503f8[_0x2d5f('0x30')],qs[_0x2d5f('0x34')](_0x4566f6[_0x2d5f('0x31')]['fields']));_0x2cc4c0[_0x2d5f('0x35')]=_0x2cc4c0[_0x2d5f('0x35')][_0x2d5f('0x36')]?_0x2cc4c0[_0x2d5f('0x35')]:_0x1503f8[_0x2d5f('0x30')];if(!_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x37')](_0x2d5f('0x38'))){_0x2cc4c0[_0x2d5f('0x1f')]=qs[_0x2d5f('0x1f')](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x1f')]);_0x2cc4c0[_0x2d5f('0x1d')]=qs[_0x2d5f('0x1d')](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x1d')]);}_0x2cc4c0[_0x2d5f('0x39')]=qs['sort'](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3a')]);_0x2cc4c0[_0x2d5f('0x3b')]=qs[_0x2d5f('0x32')](_[_0x2d5f('0x3c')](_0x4566f6[_0x2d5f('0x31')],_0x1503f8['filters']),_0x1d667f);if(_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3d')]){_0x2cc4c0['where']=_['merge'](_0x2cc4c0['where'],{'$or':_[_0x2d5f('0x2c')](_0x1d667f,function(_0x32c748){if(_0x32c748['type']!==_0x2d5f('0x3e')){var _0x278111={};_0x278111[_0x32c748['name']]={'$like':'%'+_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3d')]+'%'};return _0x278111;}})});}_0x2cc4c0=_[_0x2d5f('0x3f')]({},_0x2cc4c0,_0x4566f6[_0x2d5f('0x40')]);var _0x203772={'where':_0x2cc4c0[_0x2d5f('0x3b')]};return db[_0x2d5f('0x2d')][_0x2d5f('0x20')](_0x203772)[_0x2d5f('0x25')](function(_0x1ea157){_0x5d9471[_0x2d5f('0x20')]=_0x1ea157;if(_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x41')]){_0x2cc4c0[_0x2d5f('0x42')]=[{'all':!![]}];}return db[_0x2d5f('0x2d')][_0x2d5f('0x43')](_0x2cc4c0);})[_0x2d5f('0x25')](function(_0x352a09){_0x5d9471[_0x2d5f('0x44')]=_0x352a09;return _0x5d9471;})['then'](respondWithFilteredResult(_0x48781d,_0x2cc4c0))[_0x2d5f('0x45')](handleError(_0x48781d,null));};exports['show']=function(_0x1a39ef,_0x1952f4){var _0x12756a={'raw':![],'where':{'id':_0x1a39ef[_0x2d5f('0x46')]['id']}},_0x11c0ca={};_0x11c0ca['model']=_[_0x2d5f('0x47')](db['VtigerAccount'][_0x2d5f('0x48')]);_0x11c0ca[_0x2d5f('0x31')]=_[_0x2d5f('0x47')](_0x1a39ef[_0x2d5f('0x31')]);_0x11c0ca['filters']=_['intersection'](_0x11c0ca[_0x2d5f('0x30')],_0x11c0ca['query']);_0x12756a[_0x2d5f('0x35')]=_[_0x2d5f('0x33')](_0x11c0ca[_0x2d5f('0x30')],qs['fields'](_0x1a39ef[_0x2d5f('0x31')][_0x2d5f('0x34')]));_0x12756a['attributes']=_0x12756a[_0x2d5f('0x35')][_0x2d5f('0x36')]?_0x12756a[_0x2d5f('0x35')]:_0x11c0ca[_0x2d5f('0x30')];if(_0x1a39ef[_0x2d5f('0x31')][_0x2d5f('0x41')]){_0x12756a[_0x2d5f('0x42')]=[{'all':!![]}];}_0x12756a=_[_0x2d5f('0x3f')]({},_0x12756a,_0x1a39ef[_0x2d5f('0x40')]);return db['VtigerAccount'][_0x2d5f('0x49')](_0x12756a)[_0x2d5f('0x25')](handleEntityNotFound(_0x1952f4,null))[_0x2d5f('0x25')](respondWithResult(_0x1952f4,null))[_0x2d5f('0x45')](handleError(_0x1952f4,null));};exports[_0x2d5f('0x4a')]=function(_0x4d2989,_0x1fc304){return db[_0x2d5f('0x2d')][_0x2d5f('0x4a')](_0x4d2989[_0x2d5f('0x4b')],{})[_0x2d5f('0x25')](respondWithResult(_0x1fc304,0xc9))['catch'](handleError(_0x1fc304,null));};exports[_0x2d5f('0x24')]=function(_0x3a567f,_0x2abb88){if(_0x3a567f[_0x2d5f('0x4b')]['id']){delete _0x3a567f['body']['id'];}return db['VtigerAccount'][_0x2d5f('0x49')]({'where':{'id':_0x3a567f[_0x2d5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2abb88,null))[_0x2d5f('0x25')](saveUpdates(_0x3a567f[_0x2d5f('0x4b')],null))[_0x2d5f('0x25')](respondWithResult(_0x2abb88,null))[_0x2d5f('0x45')](handleError(_0x2abb88,null));};exports[_0x2d5f('0x26')]=function(_0x5344d5,_0x5816c){return db['VtigerAccount'][_0x2d5f('0x49')]({'where':{'id':_0x5344d5[_0x2d5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5816c,null))[_0x2d5f('0x25')](removeEntity(_0x5816c,null))[_0x2d5f('0x45')](handleError(_0x5816c,null));};exports[_0x2d5f('0x4c')]=function(_0x4ca9b5,_0x3d6b5e,_0x5107f4){var _0x1f0d88={};var _0xb3c5b7={};var _0x50c95b;var _0x16bfe2;return db['VtigerAccount']['findOne']({'where':{'id':_0x4ca9b5[_0x2d5f('0x46')]['id']}})[_0x2d5f('0x25')](handleEntityNotFound(_0x3d6b5e,null))[_0x2d5f('0x25')](function(_0x6dcbaf){if(_0x6dcbaf){_0x50c95b=_0x6dcbaf;_0xb3c5b7[_0x2d5f('0x30')]=_[_0x2d5f('0x47')](db[_0x2d5f('0x4d')][_0x2d5f('0x48')]);_0xb3c5b7[_0x2d5f('0x31')]=_['keys'](_0x4ca9b5[_0x2d5f('0x31')]);_0xb3c5b7[_0x2d5f('0x32')]=_['intersection'](_0xb3c5b7[_0x2d5f('0x30')],_0xb3c5b7[_0x2d5f('0x31')]);_0x1f0d88['attributes']=_[_0x2d5f('0x33')](_0xb3c5b7[_0x2d5f('0x30')],qs[_0x2d5f('0x34')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x34')]));_0x1f0d88[_0x2d5f('0x35')]=_0x1f0d88['attributes'][_0x2d5f('0x36')]?_0x1f0d88['attributes']:_0xb3c5b7[_0x2d5f('0x30')];_0x1f0d88[_0x2d5f('0x39')]=qs[_0x2d5f('0x3a')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x3a')]);_0x1f0d88[_0x2d5f('0x3b')]=qs[_0x2d5f('0x32')](_[_0x2d5f('0x3c')](_0x4ca9b5['query'],_0xb3c5b7[_0x2d5f('0x32')]));if(_0x4ca9b5[_0x2d5f('0x31')]['filter']){_0x1f0d88[_0x2d5f('0x3b')]=_[_0x2d5f('0x3f')](_0x1f0d88[_0x2d5f('0x3b')],{'$or':_[_0x2d5f('0x2c')](_0x1f0d88['attributes'],function(_0x4e62a2){var _0x8929c3={};_0x8929c3[_0x4e62a2]={'$like':'%'+_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x3d')]+'%'};return _0x8929c3;})});}_0x1f0d88=_[_0x2d5f('0x3f')]({},_0x1f0d88,_0x4ca9b5[_0x2d5f('0x40')]);return _0x50c95b[_0x2d5f('0x4c')](_0x1f0d88);}})['then'](function(_0x9ef8d2){if(_0x9ef8d2){_0x16bfe2=_0x9ef8d2['length'];if(!_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x37')](_0x2d5f('0x38'))){_0x1f0d88[_0x2d5f('0x1f')]=qs[_0x2d5f('0x1f')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x1f')]);_0x1f0d88[_0x2d5f('0x1d')]=qs[_0x2d5f('0x1d')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x1d')]);}return _0x50c95b[_0x2d5f('0x4c')](_0x1f0d88);}})[_0x2d5f('0x25')](function(_0x3b385e){if(_0x3b385e){return _0x3b385e?{'count':_0x16bfe2,'rows':_0x3b385e}:null;}})[_0x2d5f('0x25')](respondWithResult(_0x3d6b5e,null))[_0x2d5f('0x45')](handleError(_0x3d6b5e,null));};exports[_0x2d5f('0x4e')]=function(_0x10674d,_0x8646dc,_0x29e870){if(_0x10674d[_0x2d5f('0x4b')]['id']){delete _0x10674d['body']['id'];}return db[_0x2d5f('0x2d')]['findOne']({'where':{'id':_0x10674d[_0x2d5f('0x46')]['id']}})[_0x2d5f('0x25')](handleEntityNotFound(_0x8646dc,null))[_0x2d5f('0x25')](function(_0x464eec){if(_0x464eec){_0x10674d['body'][_0x2d5f('0x4f')]=_0x464eec['id'];_0x10674d['body']['Subjects']=integrations[_0x2d5f('0x50')](_0x10674d['body'][_0x2d5f('0x51')],_0x10674d[_0x2d5f('0x4b')][_0x2d5f('0x2f')]);_0x10674d['body'][_0x2d5f('0x52')]=integrations[_0x2d5f('0x53')](_0x10674d['body'][_0x2d5f('0x51')],_0x10674d[_0x2d5f('0x4b')][_0x2d5f('0x2f')]);return db[_0x2d5f('0x4d')][_0x2d5f('0x4a')](_0x10674d[_0x2d5f('0x4b')],{'include':[{'model':db[_0x2d5f('0x54')],'as':_0x2d5f('0x55')},{'model':db[_0x2d5f('0x54')],'as':_0x2d5f('0x52')}]});}return null;})[_0x2d5f('0x25')](respondWithResult(_0x8646dc,null))['catch'](handleError(_0x8646dc,null));};var md5=require(_0x2d5f('0x56'));exports[_0x2d5f('0x57')]=function(_0x2d5580,_0x3908be,_0x578c03){var _0x1b76a2=null;var _0x3c8171=null;var _0x3114e9=null;var _0x513ffe=null;var _0x4ebca9='';return db['VtigerAccount'][_0x2d5f('0x58')]({'where':{'id':_0x2d5580['params']['id']},'attributes':['id',_0x2d5f('0x29'),'username',_0x2d5f('0x59'),_0x2d5f('0x5a'),_0x2d5f('0x5b'),_0x2d5f('0x5c'),_0x2d5f('0x5d')]})[_0x2d5f('0x25')](handleEntityNotFound(_0x3908be,null))['then'](function(_0x182a8f){if(_0x182a8f){_0x1b76a2=_0x182a8f['username'];_0x3c8171=_0x182a8f[_0x2d5f('0x5d')];_0x3114e9=_0x182a8f[_0x2d5f('0x5a')];_0x4ebca9=_0x182a8f[_0x2d5f('0x5b')];var _0x550570=_0x4ebca9[_0x2d5f('0x5e')](-0x1);if(_0x550570==='/'){_0x4ebca9=_0x4ebca9[_0x2d5f('0x5f')](0x0,_0x4ebca9[_0x2d5f('0x60')](_0x550570));}_0x513ffe=util[_0x2d5f('0x61')](_0x2d5f('0x62'),_0x4ebca9);var _0x5db3ed={'method':_0x2d5f('0x63'),'uri':_0x513ffe,'qs':{'operation':_0x2d5f('0x64'),'username':_0x182a8f['username']},'json':!![]};return rp(_0x5db3ed);}})['then'](function(_0x390ae3){if(_0x390ae3[_0x2d5f('0x65')]){var _0xefc085={'method':'POST','uri':_0x513ffe,'form':{'operation':_0x2d5f('0x66'),'username':_0x1b76a2,'accessKey':md5(_0x390ae3[_0x2d5f('0x67')][_0x2d5f('0x68')]+_0x3c8171)},'json':!![]};return rp(_0xefc085);}})[_0x2d5f('0x25')](function(_0x242145){if(_0x242145[_0x2d5f('0x65')]){var _0x5571ca={'method':_0x2d5f('0x63'),'uri':_0x513ffe,'qs':{'operation':_0x2d5f('0x69'),'username':_0x1b76a2,'sessionName':_0x242145['result'][_0x2d5f('0x6a')],'elementType':_0x3114e9},'json':!![]};return rp(_0x5571ca);}})[_0x2d5f('0x25')](function(_0x401a90){if(_0x401a90['success']){var _0x22a702=[_0x2d5f('0x6b'),_0x2d5f('0x6c'),_0x2d5f('0x6d')];_[_0x2d5f('0x6e')](_0x401a90[_0x2d5f('0x67')]['fields'],function(_0x49f704){return _0x22a702[_0x2d5f('0x6f')](_0x49f704[_0x2d5f('0x2f')]['name']);});_[_0x2d5f('0x6e')](_0x401a90[_0x2d5f('0x67')][_0x2d5f('0x34')],function(_0x319c79){return _0x319c79[_0x2d5f('0x70')]===_0x2d5f('0x71');});return{'count':_0x401a90['result'][_0x2d5f('0x34')]['length'],'rows':_['map'](_0x401a90[_0x2d5f('0x67')]['fields'],function(_0x502a94){return{'id':_0x502a94[_0x2d5f('0x29')],'name':_0x502a94[_0x2d5f('0x72')],'custom':_[_0x2d5f('0x73')](_0x502a94['name'],_0x2d5f('0x74'))?!![]:![],'options':_0x502a94['type'][_0x2d5f('0x29')]===_0x2d5f('0x75')&&_0x502a94[_0x2d5f('0x2f')][_0x2d5f('0x76')]['length']>0x0?_[_0x2d5f('0x2c')](_0x502a94[_0x2d5f('0x2f')][_0x2d5f('0x76')],function(_0x27d256){return{'name':_0x27d256[_0x2d5f('0x72')],'value':_0x27d256[_0x2d5f('0x77')]};}):[]};})};}})[_0x2d5f('0x25')](respondWithResult(_0x3908be,null))[_0x2d5f('0x45')](function(_0x393dfe){console[_0x2d5f('0x78')]('vTiger\x20error:\x20'+_0x393dfe);var _0x3a8145=_0x2d5580[_0x2d5f('0x31')]['test']?0x1f4:_0x393dfe['statusCode']||0x1f4;logger['error'](_0x2d5f('0x79'),'getFields',_0x3a8145,JSON[_0x2d5f('0x7a')](_0x393dfe));delete _0x393dfe[_0x2d5f('0x29')];if(_0x3a8145===0x191){_0x3a8145=0x190;}_0x3908be[_0x2d5f('0x1b')](_0x3a8145)[_0x2d5f('0x2a')](_0x2d5580['query'][_0x2d5f('0x7b')]?{'message':_0x2d5f('0x7c'),'statusCode':_0x393dfe['statusCode']}:_0x393dfe);});}; \ No newline at end of file +var _0x76ac=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VtigerAccount','include','findAll','catch','show','keys','includeAll','options','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','rawAttributes','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','autogenerated','remove','editable','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x76ac,0x156));var _0xc76a=function(_0x30bd32,_0x2a97d3){_0x30bd32=_0x30bd32-0x0;var _0x2226a4=_0x76ac[_0x30bd32];return _0x2226a4;};'use strict';var emlformat=require(_0xc76a('0x0'));var rimraf=require(_0xc76a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc76a('0x2'));var rp=require('request-promise');var moment=require(_0xc76a('0x3'));var BPromise=require(_0xc76a('0x4'));var Mustache=require('mustache');var util=require(_0xc76a('0x5'));var path=require(_0xc76a('0x6'));var sox=require(_0xc76a('0x7'));var csv=require(_0xc76a('0x8'));var ejs=require(_0xc76a('0x9'));var fs=require('fs');var fs_extra=require(_0xc76a('0xa'));var _=require(_0xc76a('0xb'));var squel=require(_0xc76a('0xc'));var crypto=require(_0xc76a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc76a('0xe'));var toCsv=require(_0xc76a('0x8'));var querystring=require(_0xc76a('0xf'));var Papa=require(_0xc76a('0x10'));var Redis=require(_0xc76a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc76a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc76a('0x13'))(_0xc76a('0x14'));var utils=require(_0xc76a('0x15'));var config=require(_0xc76a('0x16'));var licenseUtil=require(_0xc76a('0x17'));var db=require(_0xc76a('0x18'))['db'];var integrations=require(_0xc76a('0x19'));function respondWithStatusCode(_0x38dff4,_0x404dad){_0x404dad=_0x404dad||0xcc;return function(_0x538ca9){if(_0x538ca9){return _0x38dff4['sendStatus'](_0x404dad);}return _0x38dff4[_0xc76a('0x1a')](_0x404dad)[_0xc76a('0x1b')]();};}function respondWithResult(_0x53e231,_0x2cc22f){_0x2cc22f=_0x2cc22f||0xc8;return function(_0x2d2670){if(_0x2d2670){return _0x53e231['status'](_0x2cc22f)[_0xc76a('0x1c')](_0x2d2670);}};}function respondWithFilteredResult(_0x990c5d,_0x16078f){return function(_0x5688ff){if(_0x5688ff){var _0x1dbdf1=typeof _0x16078f[_0xc76a('0x1d')]===_0xc76a('0x1e')&&typeof _0x16078f[_0xc76a('0x1f')]===_0xc76a('0x1e');var _0x38dca9=_0x5688ff[_0xc76a('0x20')];var _0x1ff821=_0x1dbdf1?0x0:_0x16078f[_0xc76a('0x1d')];var _0x5a7f46=_0x1dbdf1?_0x5688ff[_0xc76a('0x20')]:_0x16078f[_0xc76a('0x1d')]+_0x16078f['limit'];var _0x264cb4;if(_0x5a7f46>=_0x38dca9){_0x5a7f46=_0x38dca9;_0x264cb4=0xc8;}else{_0x264cb4=0xce;}_0x990c5d[_0xc76a('0x1a')](_0x264cb4);return _0x990c5d['set']('Content-Range',_0x1ff821+'-'+_0x5a7f46+'/'+_0x38dca9)[_0xc76a('0x1c')](_0x5688ff);}return null;};}function patchUpdates(_0x195fab){return function(_0x3cedd5){try{jsonpatch['apply'](_0x3cedd5,_0x195fab,!![]);}catch(_0x261bcb){return BPromise[_0xc76a('0x21')](_0x261bcb);}return _0x3cedd5[_0xc76a('0x22')]();};}function saveUpdates(_0x1f0176,_0x2462d3){return function(_0x41962e){if(_0x41962e){return _0x41962e[_0xc76a('0x23')](_0x1f0176)[_0xc76a('0x24')](function(_0x1847ef){return _0x1847ef;});}return null;};}function removeEntity(_0x5ed220,_0x9283c3){return function(_0x284367){if(_0x284367){return _0x284367[_0xc76a('0x25')]()[_0xc76a('0x24')](function(){_0x5ed220[_0xc76a('0x1a')](0xcc)[_0xc76a('0x1b')]();});}};}function handleEntityNotFound(_0xb5112e,_0x478c27){return function(_0x48b576){if(!_0x48b576){_0xb5112e['sendStatus'](0x194);}return _0x48b576;};}function handleError(_0x3de8ec,_0x53ac24){_0x53ac24=_0x53ac24||0x1f4;return function(_0x3f1997){logger['error'](_0x3f1997['stack']);if(_0x3f1997[_0xc76a('0x26')]){delete _0x3f1997['name'];}_0x3de8ec[_0xc76a('0x1a')](_0x53ac24)[_0xc76a('0x27')](_0x3f1997);};}exports[_0xc76a('0x28')]=function(_0x211e80,_0x2c3737){var _0x324ccd={},_0x588bad={},_0x2669b9={'count':0x0,'rows':[]};var _0x469da3=_[_0xc76a('0x29')](db['VtigerAccount']['rawAttributes'],function(_0x399fef){return{'name':_0x399fef[_0xc76a('0x2a')],'type':_0x399fef[_0xc76a('0x2b')][_0xc76a('0x2c')]};});_0x588bad[_0xc76a('0x2d')]=_[_0xc76a('0x29')](_0x469da3,_0xc76a('0x26'));_0x588bad[_0xc76a('0x2e')]=_['keys'](_0x211e80[_0xc76a('0x2e')]);_0x588bad[_0xc76a('0x2f')]=_[_0xc76a('0x30')](_0x588bad[_0xc76a('0x2d')],_0x588bad[_0xc76a('0x2e')]);_0x324ccd[_0xc76a('0x31')]=_[_0xc76a('0x30')](_0x588bad[_0xc76a('0x2d')],qs['fields'](_0x211e80[_0xc76a('0x2e')][_0xc76a('0x32')]));_0x324ccd[_0xc76a('0x31')]=_0x324ccd[_0xc76a('0x31')][_0xc76a('0x33')]?_0x324ccd[_0xc76a('0x31')]:_0x588bad[_0xc76a('0x2d')];if(!_0x211e80[_0xc76a('0x2e')]['hasOwnProperty'](_0xc76a('0x34'))){_0x324ccd[_0xc76a('0x1f')]=qs[_0xc76a('0x1f')](_0x211e80[_0xc76a('0x2e')][_0xc76a('0x1f')]);_0x324ccd['offset']=qs[_0xc76a('0x1d')](_0x211e80[_0xc76a('0x2e')][_0xc76a('0x1d')]);}_0x324ccd[_0xc76a('0x35')]=qs['sort'](_0x211e80['query'][_0xc76a('0x36')]);_0x324ccd[_0xc76a('0x37')]=qs[_0xc76a('0x2f')](_[_0xc76a('0x38')](_0x211e80[_0xc76a('0x2e')],_0x588bad[_0xc76a('0x2f')]),_0x469da3);if(_0x211e80[_0xc76a('0x2e')][_0xc76a('0x39')]){_0x324ccd['where']=_['merge'](_0x324ccd['where'],{'$or':_[_0xc76a('0x29')](_0x469da3,function(_0x3ba802){if(_0x3ba802['type']!=='VIRTUAL'){var _0x520ab5={};_0x520ab5[_0x3ba802['name']]={'$like':'%'+_0x211e80[_0xc76a('0x2e')][_0xc76a('0x39')]+'%'};return _0x520ab5;}})});}_0x324ccd=_[_0xc76a('0x3a')]({},_0x324ccd,_0x211e80['options']);var _0x1a3534={'where':_0x324ccd[_0xc76a('0x37')]};return db[_0xc76a('0x3b')][_0xc76a('0x20')](_0x1a3534)[_0xc76a('0x24')](function(_0x527175){_0x2669b9[_0xc76a('0x20')]=_0x527175;if(_0x211e80[_0xc76a('0x2e')]['includeAll']){_0x324ccd[_0xc76a('0x3c')]=[{'all':!![]}];}return db[_0xc76a('0x3b')][_0xc76a('0x3d')](_0x324ccd);})['then'](function(_0x43c308){_0x2669b9['rows']=_0x43c308;return _0x2669b9;})[_0xc76a('0x24')](respondWithFilteredResult(_0x2c3737,_0x324ccd))[_0xc76a('0x3e')](handleError(_0x2c3737,null));};exports[_0xc76a('0x3f')]=function(_0x14cab2,_0x439989){var _0x4eb55e={'raw':![],'where':{'id':_0x14cab2['params']['id']}},_0x416135={};_0x416135[_0xc76a('0x2d')]=_[_0xc76a('0x40')](db[_0xc76a('0x3b')]['rawAttributes']);_0x416135[_0xc76a('0x2e')]=_[_0xc76a('0x40')](_0x14cab2['query']);_0x416135['filters']=_[_0xc76a('0x30')](_0x416135[_0xc76a('0x2d')],_0x416135['query']);_0x4eb55e[_0xc76a('0x31')]=_['intersection'](_0x416135['model'],qs['fields'](_0x14cab2['query']['fields']));_0x4eb55e['attributes']=_0x4eb55e[_0xc76a('0x31')][_0xc76a('0x33')]?_0x4eb55e['attributes']:_0x416135[_0xc76a('0x2d')];if(_0x14cab2[_0xc76a('0x2e')][_0xc76a('0x41')]){_0x4eb55e[_0xc76a('0x3c')]=[{'all':!![]}];}_0x4eb55e=_[_0xc76a('0x3a')]({},_0x4eb55e,_0x14cab2[_0xc76a('0x42')]);return db[_0xc76a('0x3b')][_0xc76a('0x43')](_0x4eb55e)[_0xc76a('0x24')](handleEntityNotFound(_0x439989,null))[_0xc76a('0x24')](respondWithResult(_0x439989,null))[_0xc76a('0x3e')](handleError(_0x439989,null));};exports[_0xc76a('0x44')]=function(_0x3659e5,_0x27051d){return db[_0xc76a('0x3b')][_0xc76a('0x44')](_0x3659e5[_0xc76a('0x45')],{})[_0xc76a('0x24')](respondWithResult(_0x27051d,0xc9))['catch'](handleError(_0x27051d,null));};exports[_0xc76a('0x23')]=function(_0x463c33,_0xbc5fa1){if(_0x463c33[_0xc76a('0x45')]['id']){delete _0x463c33[_0xc76a('0x45')]['id'];}return db[_0xc76a('0x3b')][_0xc76a('0x43')]({'where':{'id':_0x463c33[_0xc76a('0x46')]['id']}})[_0xc76a('0x24')](handleEntityNotFound(_0xbc5fa1,null))[_0xc76a('0x24')](saveUpdates(_0x463c33['body'],null))[_0xc76a('0x24')](respondWithResult(_0xbc5fa1,null))['catch'](handleError(_0xbc5fa1,null));};exports['destroy']=function(_0x2f6e24,_0x51d8d4){return db[_0xc76a('0x3b')]['find']({'where':{'id':_0x2f6e24[_0xc76a('0x46')]['id']}})[_0xc76a('0x24')](handleEntityNotFound(_0x51d8d4,null))[_0xc76a('0x24')](removeEntity(_0x51d8d4,null))['catch'](handleError(_0x51d8d4,null));};exports[_0xc76a('0x47')]=function(_0x29ce5c,_0x3fb01c,_0x3d30d9){var _0xd754e7={};var _0x417b08={};var _0x1e55f3;var _0x24f7a5;return db[_0xc76a('0x3b')][_0xc76a('0x48')]({'where':{'id':_0x29ce5c[_0xc76a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fb01c,null))[_0xc76a('0x24')](function(_0x1f3a83){if(_0x1f3a83){_0x1e55f3=_0x1f3a83;_0x417b08[_0xc76a('0x2d')]=_[_0xc76a('0x40')](db[_0xc76a('0x49')][_0xc76a('0x4a')]);_0x417b08[_0xc76a('0x2e')]=_[_0xc76a('0x40')](_0x29ce5c[_0xc76a('0x2e')]);_0x417b08[_0xc76a('0x2f')]=_[_0xc76a('0x30')](_0x417b08['model'],_0x417b08['query']);_0xd754e7[_0xc76a('0x31')]=_['intersection'](_0x417b08['model'],qs['fields'](_0x29ce5c[_0xc76a('0x2e')]['fields']));_0xd754e7[_0xc76a('0x31')]=_0xd754e7[_0xc76a('0x31')][_0xc76a('0x33')]?_0xd754e7[_0xc76a('0x31')]:_0x417b08[_0xc76a('0x2d')];_0xd754e7[_0xc76a('0x35')]=qs[_0xc76a('0x36')](_0x29ce5c['query'][_0xc76a('0x36')]);_0xd754e7[_0xc76a('0x37')]=qs[_0xc76a('0x2f')](_[_0xc76a('0x38')](_0x29ce5c['query'],_0x417b08[_0xc76a('0x2f')]));if(_0x29ce5c[_0xc76a('0x2e')]['filter']){_0xd754e7['where']=_['merge'](_0xd754e7[_0xc76a('0x37')],{'$or':_['map'](_0xd754e7[_0xc76a('0x31')],function(_0x5297c8){var _0x13dcd7={};_0x13dcd7[_0x5297c8]={'$like':'%'+_0x29ce5c['query'][_0xc76a('0x39')]+'%'};return _0x13dcd7;})});}_0xd754e7=_['merge']({},_0xd754e7,_0x29ce5c[_0xc76a('0x42')]);return _0x1e55f3[_0xc76a('0x47')](_0xd754e7);}})[_0xc76a('0x24')](function(_0xf8a35e){if(_0xf8a35e){_0x24f7a5=_0xf8a35e[_0xc76a('0x33')];if(!_0x29ce5c[_0xc76a('0x2e')][_0xc76a('0x4b')](_0xc76a('0x34'))){_0xd754e7[_0xc76a('0x1f')]=qs[_0xc76a('0x1f')](_0x29ce5c['query']['limit']);_0xd754e7['offset']=qs[_0xc76a('0x1d')](_0x29ce5c[_0xc76a('0x2e')]['offset']);}return _0x1e55f3['getConfigurations'](_0xd754e7);}})[_0xc76a('0x24')](function(_0x5aeab8){if(_0x5aeab8){return _0x5aeab8?{'count':_0x24f7a5,'rows':_0x5aeab8}:null;}})[_0xc76a('0x24')](respondWithResult(_0x3fb01c,null))[_0xc76a('0x3e')](handleError(_0x3fb01c,null));};exports[_0xc76a('0x4c')]=function(_0x1e38ef,_0x33eb8b,_0x5b226c){if(_0x1e38ef[_0xc76a('0x45')]['id']){delete _0x1e38ef[_0xc76a('0x45')]['id'];}return db[_0xc76a('0x3b')]['findOne']({'where':{'id':_0x1e38ef[_0xc76a('0x46')]['id']}})[_0xc76a('0x24')](handleEntityNotFound(_0x33eb8b,null))[_0xc76a('0x24')](function(_0x50d00f){if(_0x50d00f){_0x1e38ef[_0xc76a('0x45')]['AccountId']=_0x50d00f['id'];_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x4d')]=integrations[_0xc76a('0x4e')](_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x4f')],_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x2b')]);_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x50')]=integrations[_0xc76a('0x51')](_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x4f')],_0x1e38ef[_0xc76a('0x45')][_0xc76a('0x2b')]);return db[_0xc76a('0x49')]['create'](_0x1e38ef[_0xc76a('0x45')],{'include':[{'model':db[_0xc76a('0x52')],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x33eb8b,null))[_0xc76a('0x3e')](handleError(_0x33eb8b,null));};var md5=require(_0xc76a('0x53'));exports[_0xc76a('0x54')]=function(_0xdc398b,_0x57388e,_0x2a19ae){var _0x50b6dc=null;var _0x37ff70=null;var _0x4c97eb=null;var _0x1aa0f8=null;var _0x51ef8c='';return db[_0xc76a('0x3b')][_0xc76a('0x48')]({'where':{'id':_0xdc398b[_0xc76a('0x46')]['id']},'attributes':['id',_0xc76a('0x26'),_0xc76a('0x55'),_0xc76a('0x56'),_0xc76a('0x57'),_0xc76a('0x58'),_0xc76a('0x59'),'accessKey']})[_0xc76a('0x24')](handleEntityNotFound(_0x57388e,null))[_0xc76a('0x24')](function(_0x24478b){if(_0x24478b){_0x50b6dc=_0x24478b[_0xc76a('0x55')];_0x37ff70=_0x24478b['accessKey'];_0x4c97eb=_0x24478b[_0xc76a('0x57')];_0x51ef8c=_0x24478b[_0xc76a('0x58')];var _0x3cb713=_0x51ef8c[_0xc76a('0x5a')](-0x1);if(_0x3cb713==='/'){_0x51ef8c=_0x51ef8c[_0xc76a('0x5b')](0x0,_0x51ef8c[_0xc76a('0x5c')](_0x3cb713));}_0x1aa0f8=util[_0xc76a('0x5d')](_0xc76a('0x5e'),_0x51ef8c);var _0x2c0220={'method':_0xc76a('0x5f'),'uri':_0x1aa0f8,'qs':{'operation':_0xc76a('0x60'),'username':_0x24478b[_0xc76a('0x55')]},'json':!![]};return rp(_0x2c0220);}})[_0xc76a('0x24')](function(_0x279772){if(_0x279772['success']){var _0x102655={'method':_0xc76a('0x61'),'uri':_0x1aa0f8,'form':{'operation':_0xc76a('0x62'),'username':_0x50b6dc,'accessKey':md5(_0x279772[_0xc76a('0x63')][_0xc76a('0x64')]+_0x37ff70)},'json':!![]};return rp(_0x102655);}})[_0xc76a('0x24')](function(_0x423883){if(_0x423883[_0xc76a('0x65')]){var _0x32cb41={'method':_0xc76a('0x5f'),'uri':_0x1aa0f8,'qs':{'operation':_0xc76a('0x66'),'username':_0x50b6dc,'sessionName':_0x423883[_0xc76a('0x63')]['sessionName'],'elementType':_0x4c97eb},'json':!![]};return rp(_0x32cb41);}})[_0xc76a('0x24')](function(_0x3c894a){if(_0x3c894a[_0xc76a('0x65')]){var _0x5f52a4=[_0xc76a('0x67'),'reference','owner'];_[_0xc76a('0x68')](_0x3c894a[_0xc76a('0x63')][_0xc76a('0x32')],function(_0x59ecc0){return _0x5f52a4['includes'](_0x59ecc0['type'][_0xc76a('0x26')]);});_[_0xc76a('0x68')](_0x3c894a['result'][_0xc76a('0x32')],function(_0x1c29fe){return _0x1c29fe[_0xc76a('0x69')]===_0xc76a('0x6a');});return{'count':_0x3c894a['result'][_0xc76a('0x32')]['length'],'rows':_['map'](_0x3c894a[_0xc76a('0x63')]['fields'],function(_0x14efdb){return{'id':_0x14efdb[_0xc76a('0x26')],'name':_0x14efdb[_0xc76a('0x6b')],'custom':_[_0xc76a('0x6c')](_0x14efdb['name'],'cf_')?!![]:![],'options':_0x14efdb[_0xc76a('0x2b')][_0xc76a('0x26')]==='picklist'&&_0x14efdb[_0xc76a('0x2b')][_0xc76a('0x6d')][_0xc76a('0x33')]>0x0?_[_0xc76a('0x29')](_0x14efdb['type']['picklistValues'],function(_0x17e3db){return{'name':_0x17e3db[_0xc76a('0x6b')],'value':_0x17e3db[_0xc76a('0x6e')]};}):[]};})};}})[_0xc76a('0x24')](respondWithResult(_0x57388e,null))['catch'](function(_0x2fa9ee){console[_0xc76a('0x6f')](_0xc76a('0x70')+_0x2fa9ee);var _0x40f6d7=_0xdc398b[_0xc76a('0x2e')][_0xc76a('0x71')]?0x1f4:_0x2fa9ee[_0xc76a('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc76a('0x54'),_0x40f6d7,JSON['stringify'](_0x2fa9ee));delete _0x2fa9ee[_0xc76a('0x26')];if(_0x40f6d7===0x191){_0x40f6d7=0x190;}_0x57388e[_0xc76a('0x1a')](_0x40f6d7)['send'](_0xdc398b[_0xc76a('0x2e')][_0xc76a('0x71')]?{'message':_0xc76a('0x73'),'statusCode':_0x2fa9ee['statusCode']}:_0x2fa9ee);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0848969..e01074f 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 _0x6912=['exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3632d1,_0x5359e6){var _0x13a16a=function(_0x272d97){while(--_0x272d97){_0x3632d1['push'](_0x3632d1['shift']());}};_0x13a16a(++_0x5359e6);}(_0x6912,0x1c3));var _0x2691=function(_0x201a0f,_0x22991b){_0x201a0f=_0x201a0f-0x0;var _0x36bce3=_0x6912[_0x201a0f];return _0x36bce3;};'use strict';var _=require(_0x2691('0x0'));var util=require(_0x2691('0x1'));var logger=require(_0x2691('0x2'))(_0x2691('0x3'));var moment=require(_0x2691('0x4'));var BPromise=require(_0x2691('0x5'));var rp=require(_0x2691('0x6'));var fs=require('fs');var path=require(_0x2691('0x7'));var rimraf=require(_0x2691('0x8'));var config=require(_0x2691('0x9'));var attributes=require(_0x2691('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x2691('0xb')]=function(_0x422aad,_0x4755a9){return _0x422aad['define'](_0x2691('0xc'),attributes,{'tableName':_0x2691('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5f=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x210db0,_0x10b27b){var _0x1b9d0c=function(_0x52fca2){while(--_0x52fca2){_0x210db0['push'](_0x210db0['shift']());}};_0x1b9d0c(++_0x10b27b);}(_0xee5f,0x93));var _0xfee5=function(_0x1c3841,_0xfcd9e5){_0x1c3841=_0x1c3841-0x0;var _0x13e7e1=_0xee5f[_0x1c3841];return _0x13e7e1;};'use strict';var _=require(_0xfee5('0x0'));var util=require(_0xfee5('0x1'));var logger=require(_0xfee5('0x2'))('api');var moment=require(_0xfee5('0x3'));var BPromise=require('bluebird');var rp=require(_0xfee5('0x4'));var fs=require('fs');var path=require(_0xfee5('0x5'));var rimraf=require('rimraf');var config=require(_0xfee5('0x6'));var attributes=require(_0xfee5('0x7'));var integrations=require(_0xfee5('0x8'));module[_0xfee5('0x9')]=function(_0x30d9e3,_0x4c9901){return _0x30d9e3[_0xfee5('0xa')](_0xfee5('0xb'),attributes,{'tableName':_0xfee5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 5b8752a..007fb11 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 _0x7d25=['raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','then','ShowVtigerAccount','find'];(function(_0x2c3201,_0x1f76ff){var _0x564fc4=function(_0x424493){while(--_0x424493){_0x2c3201['push'](_0x2c3201['shift']());}};_0x564fc4(++_0x1f76ff);}(_0x7d25,0x8a));var _0x57d2=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7d25[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')]({'raw':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['where']||null:null,'attributes':_0x7d4cf1['options']?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x18')]||null:null,'limit':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x19')]||null:null,'include':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')],function(_0x456fe1){return{'model':db[_0x456fe1[_0x57d2('0x1c')]],'as':_0x456fe1['as'],'attributes':_0x456fe1[_0x57d2('0x18')],'include':_0x456fe1['include']?_[_0x57d2('0x1b')](_0x456fe1[_0x57d2('0x1a')],function(_0x3c7de8){return{'model':db[_0x3c7de8[_0x57d2('0x1c')]],'as':_0x3c7de8['as'],'attributes':_0x3c7de8[_0x57d2('0x18')],'include':_0x3c7de8['include']?_[_0x57d2('0x1b')](_0x3c7de8[_0x57d2('0x1a')],function(_0x995928){return{'model':db[_0x995928[_0x57d2('0x1c')]],'as':_0x995928['as'],'attributes':_0x995928[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0x1d')](function(_0x9bdb11){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x9bdb11));_0x4a94e3(_0x9bdb11);})[_0x57d2('0x13')](function(_0x7c33f3){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x7c33f3[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x7c33f3['message']));});});};exports[_0x57d2('0x1e')]=function(_0x3da926){var _0x26e052=this;return new Promise(function(_0x3e017c,_0x484597){return db[_0x57d2('0x15')][_0x57d2('0x1f')]({'raw':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x20')]===undefined?!![]:![]:!![],'where':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x21')]||null:null,'attributes':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x18')]||null:null,'include':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x3da926['options'][_0x57d2('0x1a')],function(_0x1c4ea5){return{'model':db[_0x1c4ea5[_0x57d2('0x1c')]],'as':_0x1c4ea5['as'],'attributes':_0x1c4ea5[_0x57d2('0x18')],'include':_0x1c4ea5[_0x57d2('0x1a')]?_['map'](_0x1c4ea5['include'],function(_0x581ebc){return{'model':db[_0x581ebc['model']],'as':_0x581ebc['as'],'attributes':_0x581ebc[_0x57d2('0x18')],'include':_0x581ebc[_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x581ebc[_0x57d2('0x1a')],function(_0x13beac){return{'model':db[_0x13beac['model']],'as':_0x13beac['as'],'attributes':_0x13beac[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3378a6){logger[_0x57d2('0x9')](_0x57d2('0x1e'),_0x3da926);logger['debug'](_0x57d2('0x1e'),_0x3da926,JSON[_0x57d2('0xe')](_0x3378a6));_0x3e017c(_0x3378a6);})['catch'](function(_0xb33455){logger[_0x57d2('0xf')](_0x57d2('0x1e'),_0xb33455[_0x57d2('0x11')],_0x3da926);_0x484597(_0x26e052[_0x57d2('0xf')](0x1f4,_0xb33455[_0x57d2('0x11')]));});});}; \ No newline at end of file +var _0xbfcc=['findAll','options','raw','where','attributes','limit','map','model','include','then','GetVtigerAccount','catch','ShowVtigerAccount','VtigerAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xbfcc[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});}exports['GetVtigerAccount']=function(_0x5b078f){var _0x33f731=this;return new Promise(function(_0x99b59d,_0x344510){return db['VtigerAccount'][_0xcbfc('0x12')]({'raw':_0x5b078f['options']?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x15')]||null:null,'attributes':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x16')]||null:null,'limit':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x17')]||null:null,'include':_0x5b078f['options']?_0x5b078f['options']['include']?_[_0xcbfc('0x18')](_0x5b078f['options']['include'],function(_0x1b3e42){return{'model':db[_0x1b3e42[_0xcbfc('0x19')]],'as':_0x1b3e42['as'],'attributes':_0x1b3e42[_0xcbfc('0x16')],'include':_0x1b3e42[_0xcbfc('0x1a')]?_['map'](_0x1b3e42[_0xcbfc('0x1a')],function(_0x51284a){return{'model':db[_0x51284a[_0xcbfc('0x19')]],'as':_0x51284a['as'],'attributes':_0x51284a[_0xcbfc('0x16')],'include':_0x51284a['include']?_[_0xcbfc('0x18')](_0x51284a[_0xcbfc('0x1a')],function(_0x4ab48e){return{'model':db[_0x4ab48e[_0xcbfc('0x19')]],'as':_0x4ab48e['as'],'attributes':_0x4ab48e[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x41f3b8){logger['info'](_0xcbfc('0x1c'),_0x5b078f);logger[_0xcbfc('0xb')]('GetVtigerAccount',_0x5b078f,JSON[_0xcbfc('0xd')](_0x41f3b8));_0x99b59d(_0x41f3b8);})[_0xcbfc('0x1d')](function(_0x7cbdfa){logger[_0xcbfc('0xe')](_0xcbfc('0x1c'),_0x7cbdfa[_0xcbfc('0x10')],_0x5b078f);_0x344510(_0x33f731[_0xcbfc('0xe')](0x1f4,_0x7cbdfa['message']));});});};exports[_0xcbfc('0x1e')]=function(_0x433300){var _0x3f9d20=this;return new Promise(function(_0x20a378,_0x500a0b){return db[_0xcbfc('0x1f')][_0xcbfc('0x20')]({'raw':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['where']||null:null,'attributes':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['attributes']||null:null,'include':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x1a')]?_['map'](_0x433300['options']['include'],function(_0x3c6d04){return{'model':db[_0x3c6d04[_0xcbfc('0x19')]],'as':_0x3c6d04['as'],'attributes':_0x3c6d04[_0xcbfc('0x16')],'include':_0x3c6d04[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x3c6d04[_0xcbfc('0x1a')],function(_0x856e83){return{'model':db[_0x856e83[_0xcbfc('0x19')]],'as':_0x856e83['as'],'attributes':_0x856e83['attributes'],'include':_0x856e83[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x856e83['include'],function(_0x3093b5){return{'model':db[_0x3093b5['model']],'as':_0x3093b5['as'],'attributes':_0x3093b5[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x43121e){logger['info'](_0xcbfc('0x1e'),_0x433300);logger['debug']('ShowVtigerAccount',_0x433300,JSON[_0xcbfc('0xd')](_0x43121e));_0x20a378(_0x43121e);})[_0xcbfc('0x1d')](function(_0x382d8b){logger[_0xcbfc('0xe')](_0xcbfc('0x1e'),_0x382d8b[_0xcbfc('0x10')],_0x433300);_0x500a0b(_0x3f9d20[_0xcbfc('0xe')](0x1f4,_0x382d8b[_0xcbfc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c702a71..0c4fdd6 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 _0xf729=['post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show','get','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x107950,_0x57ae8a){var _0x281a29=function(_0x48b11e){while(--_0x48b11e){_0x107950['push'](_0x107950['shift']());}};_0x281a29(++_0x57ae8a);}(_0xf729,0x1bc));var _0x9f72=function(_0xd5c4d6,_0x38fd23){_0xd5c4d6=_0xd5c4d6-0x0;var _0x3dfed1=_0xf729[_0xd5c4d6];return _0x3dfed1;};'use strict';var multer=require('multer');var util=require(_0x9f72('0x0'));var path=require(_0x9f72('0x1'));var timeout=require(_0x9f72('0x2'));var express=require(_0x9f72('0x3'));var router=express[_0x9f72('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f72('0x5'));var interaction=require(_0x9f72('0x6'));var config=require(_0x9f72('0x7'));var controller=require(_0x9f72('0x8'));router['get']('/',auth[_0x9f72('0x9')](),controller[_0x9f72('0xa')]);router['get']('/:id',auth[_0x9f72('0x9')](),controller[_0x9f72('0xb')]);router[_0x9f72('0xc')]('/:id/fields',auth[_0x9f72('0x9')](),controller['getFields']);router[_0x9f72('0xc')](_0x9f72('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9f72('0xc')](_0x9f72('0xe'),auth[_0x9f72('0x9')](),controller[_0x9f72('0xf')]);router[_0x9f72('0x10')]('/',auth[_0x9f72('0x9')](),controller[_0x9f72('0x11')]);router[_0x9f72('0x12')](_0x9f72('0x13'),auth[_0x9f72('0x9')](),controller[_0x9f72('0x14')]);router[_0x9f72('0x15')](_0x9f72('0x13'),auth[_0x9f72('0x9')](),controller['destroy']);module[_0x9f72('0x16')]=router; \ No newline at end of file +var _0x4e91=['get','isAuthenticated','index','/:id','show','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0xfdf0a2,_0x10af2){var _0x26152d=function(_0x19f3a6){while(--_0x19f3a6){_0xfdf0a2['push'](_0xfdf0a2['shift']());}};_0x26152d(++_0x10af2);}(_0x4e91,0x116));var _0x14e9=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x4e91[_0x4536a4];return _0x4fd1c1;};'use strict';var multer=require(_0x14e9('0x0'));var util=require(_0x14e9('0x1'));var path=require(_0x14e9('0x2'));var timeout=require(_0x14e9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x14e9('0x4'));var config=require(_0x14e9('0x5'));var controller=require(_0x14e9('0x6'));router[_0x14e9('0x7')]('/',auth[_0x14e9('0x8')](),controller[_0x14e9('0x9')]);router[_0x14e9('0x7')](_0x14e9('0xa'),auth[_0x14e9('0x8')](),controller[_0x14e9('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x14e9('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x14e9('0x7')]('/:id/descriptions',auth[_0x14e9('0x8')](),controller[_0x14e9('0xc')]);router[_0x14e9('0xd')]('/',auth[_0x14e9('0x8')](),controller[_0x14e9('0xe')]);router[_0x14e9('0xf')]('/:id',auth[_0x14e9('0x8')](),controller[_0x14e9('0x10')]);router[_0x14e9('0x11')]('/:id',auth[_0x14e9('0x8')](),controller['destroy']);module[_0x14e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 637f15d..bd64d02 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 _0x26db=['sequelize','STRING'];(function(_0x1f22aa,_0xa4d394){var _0x2cb500=function(_0x2d6426){while(--_0x2d6426){_0x1f22aa['push'](_0x1f22aa['shift']());}};_0x2cb500(++_0xa4d394);}(_0x26db,0x15e));var _0xb26d=function(_0x4bcfac,_0x48f4bb){_0x4bcfac=_0x4bcfac-0x0;var _0x253e20=_0x26db[_0x4bcfac];return _0x253e20;};'use strict';var Sequelize=require(_0xb26d('0x0'));module['exports']={'name':{'type':Sequelize[_0xb26d('0x1')]},'description':{'type':Sequelize[_0xb26d('0x1')]}}; \ No newline at end of file +var _0xe56d=['STRING','sequelize','exports'];(function(_0x328718,_0x26e2c2){var _0x2d8f14=function(_0x389f90){while(--_0x389f90){_0x328718['push'](_0x328718['shift']());}};_0x2d8f14(++_0x26e2c2);}(_0xe56d,0xc4));var _0xde56=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0xe56d[_0x180ac2];return _0xfcaede;};'use strict';var Sequelize=require(_0xde56('0x0'));module[_0xde56('0x1')]={'name':{'type':Sequelize[_0xde56('0x2')]},'description':{'type':Sequelize[_0xde56('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fcc53d1..c226964 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 _0xe008=['name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','update','find','findOne','VtigerField','length','getFields','getSubjects','getDescriptions','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack'];(function(_0x2d15aa,_0x16966c){var _0x3509aa=function(_0x4306a5){while(--_0x4306a5){_0x2d15aa['push'](_0x2d15aa['shift']());}};_0x3509aa(++_0x16966c);}(_0xe008,0xcc));var _0x8e00=function(_0x5a8b0f,_0x1804e0){_0x5a8b0f=_0x5a8b0f-0x0;var _0x20aec9=_0xe008[_0x5a8b0f];return _0x20aec9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e00('0x0'));var jsonpatch=require(_0x8e00('0x1'));var rp=require(_0x8e00('0x2'));var moment=require(_0x8e00('0x3'));var BPromise=require(_0x8e00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e00('0x5'));var sox=require(_0x8e00('0x6'));var csv=require(_0x8e00('0x7'));var ejs=require(_0x8e00('0x8'));var fs=require('fs');var fs_extra=require(_0x8e00('0x9'));var _=require(_0x8e00('0xa'));var squel=require(_0x8e00('0xb'));var crypto=require(_0x8e00('0xc'));var jsforce=require(_0x8e00('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e00('0x7'));var querystring=require(_0x8e00('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e00('0xf'));var qs=require(_0x8e00('0x10'));var as=require(_0x8e00('0x11'));var hardwareService=require(_0x8e00('0x12'));var logger=require('../../config/logger')(_0x8e00('0x13'));var utils=require(_0x8e00('0x14'));var config=require(_0x8e00('0x15'));var licenseUtil=require(_0x8e00('0x16'));var db=require(_0x8e00('0x17'))['db'];function respondWithStatusCode(_0x54a265,_0x484cf6){_0x484cf6=_0x484cf6||0xcc;return function(_0x4d038f){if(_0x4d038f){return _0x54a265[_0x8e00('0x18')](_0x484cf6);}return _0x54a265[_0x8e00('0x19')](_0x484cf6)['end']();};}function respondWithResult(_0x325f32,_0x1d0353){_0x1d0353=_0x1d0353||0xc8;return function(_0x10ec78){if(_0x10ec78){return _0x325f32[_0x8e00('0x19')](_0x1d0353)[_0x8e00('0x1a')](_0x10ec78);}};}function respondWithFilteredResult(_0x20f43f,_0x238bc6){return function(_0x580737){if(_0x580737){var _0x47942f=typeof _0x238bc6['offset']===_0x8e00('0x1b')&&typeof _0x238bc6['limit']===_0x8e00('0x1b');var _0x315152=_0x580737[_0x8e00('0x1c')];var _0x252fc9=_0x47942f?0x0:_0x238bc6[_0x8e00('0x1d')];var _0x3fdc92=_0x47942f?_0x580737['count']:_0x238bc6[_0x8e00('0x1d')]+_0x238bc6[_0x8e00('0x1e')];var _0x136d7b;if(_0x3fdc92>=_0x315152){_0x3fdc92=_0x315152;_0x136d7b=0xc8;}else{_0x136d7b=0xce;}_0x20f43f[_0x8e00('0x19')](_0x136d7b);return _0x20f43f[_0x8e00('0x1f')](_0x8e00('0x20'),_0x252fc9+'-'+_0x3fdc92+'/'+_0x315152)[_0x8e00('0x1a')](_0x580737);}return null;};}function patchUpdates(_0x5c354e){return function(_0x304a48){try{jsonpatch[_0x8e00('0x21')](_0x304a48,_0x5c354e,!![]);}catch(_0x1e551e){return BPromise['reject'](_0x1e551e);}return _0x304a48[_0x8e00('0x22')]();};}function saveUpdates(_0x306d9f,_0x2b3a0e){return function(_0xca0dba){if(_0xca0dba){return _0xca0dba['update'](_0x306d9f)[_0x8e00('0x23')](function(_0x246b53){return _0x246b53;});}return null;};}function removeEntity(_0xb1d1ec,_0x1cfe0a){return function(_0x1747c2){if(_0x1747c2){return _0x1747c2[_0x8e00('0x24')]()['then'](function(){_0xb1d1ec[_0x8e00('0x19')](0xcc)[_0x8e00('0x25')]();});}};}function handleEntityNotFound(_0x1c936d,_0x1ca291){return function(_0x324207){if(!_0x324207){_0x1c936d[_0x8e00('0x18')](0x194);}return _0x324207;};}function handleError(_0x15ced4,_0x3a5768){_0x3a5768=_0x3a5768||0x1f4;return function(_0x254cb6){logger['error'](_0x254cb6[_0x8e00('0x26')]);if(_0x254cb6['name']){delete _0x254cb6[_0x8e00('0x27')];}_0x15ced4[_0x8e00('0x19')](_0x3a5768)[_0x8e00('0x28')](_0x254cb6);};}exports[_0x8e00('0x29')]=function(_0x49ce91,_0xda78b4){var _0xed7bd2={},_0x3e1a8f={},_0x3d85d3={'count':0x0,'rows':[]};var _0x2a620e=_[_0x8e00('0x2a')](db[_0x8e00('0x2b')]['rawAttributes'],function(_0x18161a){return{'name':_0x18161a[_0x8e00('0x2c')],'type':_0x18161a[_0x8e00('0x2d')][_0x8e00('0x2e')]};});_0x3e1a8f[_0x8e00('0x2f')]=_[_0x8e00('0x2a')](_0x2a620e,_0x8e00('0x27'));_0x3e1a8f[_0x8e00('0x30')]=_['keys'](_0x49ce91[_0x8e00('0x30')]);_0x3e1a8f[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x3e1a8f['model'],_0x3e1a8f[_0x8e00('0x30')]);_0xed7bd2['attributes']=_[_0x8e00('0x32')](_0x3e1a8f[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0x49ce91[_0x8e00('0x30')][_0x8e00('0x33')]));_0xed7bd2['attributes']=_0xed7bd2[_0x8e00('0x34')]['length']?_0xed7bd2[_0x8e00('0x34')]:_0x3e1a8f[_0x8e00('0x2f')];if(!_0x49ce91['query'][_0x8e00('0x35')]('nolimit')){_0xed7bd2[_0x8e00('0x1e')]=qs['limit'](_0x49ce91[_0x8e00('0x30')][_0x8e00('0x1e')]);_0xed7bd2['offset']=qs[_0x8e00('0x1d')](_0x49ce91[_0x8e00('0x30')]['offset']);}_0xed7bd2[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0x49ce91['query']['sort']);_0xed7bd2['where']=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0x49ce91['query'],_0x3e1a8f['filters']),_0x2a620e);if(_0x49ce91[_0x8e00('0x30')][_0x8e00('0x39')]){_0xed7bd2['where']=_[_0x8e00('0x3a')](_0xed7bd2[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x2a620e,function(_0x3b994e){if(_0x3b994e['type']!==_0x8e00('0x3c')){var _0x40c012={};_0x40c012[_0x3b994e[_0x8e00('0x27')]]={'$like':'%'+_0x49ce91[_0x8e00('0x30')]['filter']+'%'};return _0x40c012;}})});}_0xed7bd2=_[_0x8e00('0x3a')]({},_0xed7bd2,_0x49ce91[_0x8e00('0x3d')]);var _0x3abd2b={'where':_0xed7bd2[_0x8e00('0x3b')]};return db[_0x8e00('0x2b')][_0x8e00('0x1c')](_0x3abd2b)[_0x8e00('0x23')](function(_0x17232b){_0x3d85d3[_0x8e00('0x1c')]=_0x17232b;if(_0x49ce91['query'][_0x8e00('0x3e')]){_0xed7bd2[_0x8e00('0x3f')]=[{'all':!![]}];}return db[_0x8e00('0x2b')]['findAll'](_0xed7bd2);})['then'](function(_0x15f745){_0x3d85d3[_0x8e00('0x40')]=_0x15f745;return _0x3d85d3;})[_0x8e00('0x23')](respondWithFilteredResult(_0xda78b4,_0xed7bd2))[_0x8e00('0x41')](handleError(_0xda78b4,null));};exports[_0x8e00('0x42')]=function(_0x32af47,_0x2512ef){var _0x23d813={'raw':![],'where':{'id':_0x32af47[_0x8e00('0x43')]['id']}},_0x2decef={};_0x2decef[_0x8e00('0x2f')]=_[_0x8e00('0x44')](db[_0x8e00('0x2b')][_0x8e00('0x45')]);_0x2decef[_0x8e00('0x30')]=_['keys'](_0x32af47[_0x8e00('0x30')]);_0x2decef['filters']=_[_0x8e00('0x32')](_0x2decef[_0x8e00('0x2f')],_0x2decef['query']);_0x23d813[_0x8e00('0x34')]=_['intersection'](_0x2decef[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0x32af47[_0x8e00('0x30')][_0x8e00('0x33')]));_0x23d813[_0x8e00('0x34')]=_0x23d813[_0x8e00('0x34')]['length']?_0x23d813[_0x8e00('0x34')]:_0x2decef[_0x8e00('0x2f')];if(_0x32af47[_0x8e00('0x30')]['includeAll']){_0x23d813['include']=[{'all':!![]}];}_0x23d813=_[_0x8e00('0x3a')]({},_0x23d813,_0x32af47['options']);return db[_0x8e00('0x2b')]['find'](_0x23d813)['then'](handleEntityNotFound(_0x2512ef,null))['then'](respondWithResult(_0x2512ef,null))[_0x8e00('0x41')](handleError(_0x2512ef,null));};exports[_0x8e00('0x46')]=function(_0x4034c4,_0x15c57c){return db[_0x8e00('0x2b')]['create'](_0x4034c4[_0x8e00('0x47')],{})[_0x8e00('0x23')](respondWithResult(_0x15c57c,0xc9))[_0x8e00('0x41')](handleError(_0x15c57c,null));};exports[_0x8e00('0x48')]=function(_0x7745a9,_0x38c16a){if(_0x7745a9[_0x8e00('0x47')]['id']){delete _0x7745a9[_0x8e00('0x47')]['id'];}return db['VtigerConfiguration'][_0x8e00('0x49')]({'where':{'id':_0x7745a9[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x38c16a,null))[_0x8e00('0x23')](saveUpdates(_0x7745a9['body'],null))[_0x8e00('0x23')](respondWithResult(_0x38c16a,null))['catch'](handleError(_0x38c16a,null));};exports[_0x8e00('0x24')]=function(_0x6319d9,_0x19b41a){return db[_0x8e00('0x2b')]['find']({'where':{'id':_0x6319d9[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x19b41a,null))[_0x8e00('0x23')](removeEntity(_0x19b41a,null))[_0x8e00('0x41')](handleError(_0x19b41a,null));};exports['getFields']=function(_0x2bce8a,_0x506ac0,_0x4be94d){var _0x41bf91={};var _0x16b91d={};var _0x52cb33;var _0x27eb59;return db[_0x8e00('0x2b')][_0x8e00('0x4a')]({'where':{'id':_0x2bce8a[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x506ac0,null))[_0x8e00('0x23')](function(_0x3e87de){if(_0x3e87de){_0x52cb33=_0x3e87de;_0x16b91d[_0x8e00('0x2f')]=_[_0x8e00('0x44')](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x16b91d[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0x2bce8a[_0x8e00('0x30')]);_0x16b91d[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x16b91d['model'],_0x16b91d[_0x8e00('0x30')]);_0x41bf91[_0x8e00('0x34')]=_['intersection'](_0x16b91d['model'],qs[_0x8e00('0x33')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x33')]));_0x41bf91[_0x8e00('0x34')]=_0x41bf91['attributes'][_0x8e00('0x4c')]?_0x41bf91[_0x8e00('0x34')]:_0x16b91d[_0x8e00('0x2f')];_0x41bf91[_0x8e00('0x36')]=qs['sort'](_0x2bce8a['query'][_0x8e00('0x37')]);_0x41bf91['where']=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0x2bce8a['query'],_0x16b91d[_0x8e00('0x31')]));if(_0x2bce8a['query'][_0x8e00('0x39')]){_0x41bf91[_0x8e00('0x3b')]=_[_0x8e00('0x3a')](_0x41bf91[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x41bf91[_0x8e00('0x34')],function(_0x1f838b){var _0x103d10={};_0x103d10[_0x1f838b]={'$like':'%'+_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x39')]+'%'};return _0x103d10;})});}_0x41bf91=_[_0x8e00('0x3a')]({},_0x41bf91,_0x2bce8a[_0x8e00('0x3d')]);return _0x52cb33[_0x8e00('0x4d')](_0x41bf91);}})[_0x8e00('0x23')](function(_0x353228){if(_0x353228){_0x27eb59=_0x353228[_0x8e00('0x4c')];if(!_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x35')]('nolimit')){_0x41bf91[_0x8e00('0x1e')]=qs[_0x8e00('0x1e')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x1e')]);_0x41bf91[_0x8e00('0x1d')]=qs[_0x8e00('0x1d')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x52cb33[_0x8e00('0x4d')](_0x41bf91);}})[_0x8e00('0x23')](function(_0x35ecab){if(_0x35ecab){return _0x35ecab?{'count':_0x27eb59,'rows':_0x35ecab}:null;}})['then'](respondWithResult(_0x506ac0,null))['catch'](handleError(_0x506ac0,null));};exports[_0x8e00('0x4e')]=function(_0xe4adc0,_0x256493,_0xf40817){var _0x171c9c={};var _0x1b107f={};var _0x36c914;var _0x580f02;return db[_0x8e00('0x2b')][_0x8e00('0x4a')]({'where':{'id':_0xe4adc0['params']['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x256493,null))[_0x8e00('0x23')](function(_0x1296e2){if(_0x1296e2){_0x36c914=_0x1296e2;_0x1b107f['model']=_['keys'](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x1b107f[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0xe4adc0[_0x8e00('0x30')]);_0x1b107f[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x1b107f[_0x8e00('0x2f')],_0x1b107f[_0x8e00('0x30')]);_0x171c9c['attributes']=_[_0x8e00('0x32')](_0x1b107f[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x33')]));_0x171c9c['attributes']=_0x171c9c[_0x8e00('0x34')]['length']?_0x171c9c['attributes']:_0x1b107f[_0x8e00('0x2f')];_0x171c9c[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x37')]);_0x171c9c[_0x8e00('0x3b')]=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0xe4adc0[_0x8e00('0x30')],_0x1b107f[_0x8e00('0x31')]));if(_0xe4adc0['query'][_0x8e00('0x39')]){_0x171c9c[_0x8e00('0x3b')]=_['merge'](_0x171c9c[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x171c9c[_0x8e00('0x34')],function(_0x197abe){var _0x5c9306={};_0x5c9306[_0x197abe]={'$like':'%'+_0xe4adc0['query'][_0x8e00('0x39')]+'%'};return _0x5c9306;})});}_0x171c9c=_[_0x8e00('0x3a')]({},_0x171c9c,_0xe4adc0[_0x8e00('0x3d')]);return _0x36c914[_0x8e00('0x4e')](_0x171c9c);}})[_0x8e00('0x23')](function(_0x2c4e31){if(_0x2c4e31){_0x580f02=_0x2c4e31['length'];if(!_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x35')]('nolimit')){_0x171c9c[_0x8e00('0x1e')]=qs[_0x8e00('0x1e')](_0xe4adc0['query'][_0x8e00('0x1e')]);_0x171c9c[_0x8e00('0x1d')]=qs[_0x8e00('0x1d')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x36c914[_0x8e00('0x4e')](_0x171c9c);}})[_0x8e00('0x23')](function(_0x233874){if(_0x233874){return _0x233874?{'count':_0x580f02,'rows':_0x233874}:null;}})['then'](respondWithResult(_0x256493,null))[_0x8e00('0x41')](handleError(_0x256493,null));};exports['getDescriptions']=function(_0x49920b,_0x2ffe5c,_0x10e3f9){var _0x18276a={};var _0x2a3258={};var _0x42e733;var _0xe2e5bc;return db[_0x8e00('0x2b')]['findOne']({'where':{'id':_0x49920b[_0x8e00('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ffe5c,null))[_0x8e00('0x23')](function(_0x2a9631){if(_0x2a9631){_0x42e733=_0x2a9631;_0x2a3258['model']=_['keys'](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x2a3258[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0x49920b[_0x8e00('0x30')]);_0x2a3258['filters']=_[_0x8e00('0x32')](_0x2a3258[_0x8e00('0x2f')],_0x2a3258[_0x8e00('0x30')]);_0x18276a[_0x8e00('0x34')]=_['intersection'](_0x2a3258[_0x8e00('0x2f')],qs['fields'](_0x49920b[_0x8e00('0x30')][_0x8e00('0x33')]));_0x18276a['attributes']=_0x18276a[_0x8e00('0x34')]['length']?_0x18276a[_0x8e00('0x34')]:_0x2a3258[_0x8e00('0x2f')];_0x18276a[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0x49920b[_0x8e00('0x30')][_0x8e00('0x37')]);_0x18276a[_0x8e00('0x3b')]=qs['filters'](_[_0x8e00('0x38')](_0x49920b['query'],_0x2a3258[_0x8e00('0x31')]));if(_0x49920b['query'][_0x8e00('0x39')]){_0x18276a[_0x8e00('0x3b')]=_[_0x8e00('0x3a')](_0x18276a[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x18276a[_0x8e00('0x34')],function(_0x35e6ec){var _0x54fc20={};_0x54fc20[_0x35e6ec]={'$like':'%'+_0x49920b[_0x8e00('0x30')][_0x8e00('0x39')]+'%'};return _0x54fc20;})});}_0x18276a=_['merge']({},_0x18276a,_0x49920b['options']);return _0x42e733[_0x8e00('0x4f')](_0x18276a);}})[_0x8e00('0x23')](function(_0x437d5e){if(_0x437d5e){_0xe2e5bc=_0x437d5e[_0x8e00('0x4c')];if(!_0x49920b[_0x8e00('0x30')]['hasOwnProperty'](_0x8e00('0x50'))){_0x18276a['limit']=qs[_0x8e00('0x1e')](_0x49920b[_0x8e00('0x30')]['limit']);_0x18276a[_0x8e00('0x1d')]=qs['offset'](_0x49920b[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x42e733[_0x8e00('0x4f')](_0x18276a);}})[_0x8e00('0x23')](function(_0x3a2ba5){if(_0x3a2ba5){return _0x3a2ba5?{'count':_0xe2e5bc,'rows':_0x3a2ba5}:null;}})['then'](respondWithResult(_0x2ffe5c,null))[_0x8e00('0x41')](handleError(_0x2ffe5c,null));}; \ No newline at end of file +var _0x8e63=['Content-Range','save','update','then','destroy','end','error','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','VtigerField','getSubjects','order','getDescriptions','findOne','rimraf','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4c983e,_0x307dd6){var _0x5612de=function(_0x4d0368){while(--_0x4d0368){_0x4c983e['push'](_0x4c983e['shift']());}};_0x5612de(++_0x307dd6);}(_0x8e63,0x7c));var _0x38e6=function(_0x1ad3ea,_0x465c73){_0x1ad3ea=_0x1ad3ea-0x0;var _0x5a7669=_0x8e63[_0x1ad3ea];return _0x5a7669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38e6('0x1'));var moment=require(_0x38e6('0x2'));var BPromise=require(_0x38e6('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38e6('0x4'));var sox=require(_0x38e6('0x5'));var csv=require(_0x38e6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38e6('0x7'));var _=require(_0x38e6('0x8'));var squel=require(_0x38e6('0x9'));var crypto=require(_0x38e6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38e6('0x6'));var querystring=require(_0x38e6('0xb'));var Papa=require(_0x38e6('0xc'));var Redis=require(_0x38e6('0xd'));var authService=require(_0x38e6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38e6('0xf'));var logger=require('../../config/logger')(_0x38e6('0x10'));var utils=require('../../config/utils');var config=require(_0x38e6('0x11'));var licenseUtil=require(_0x38e6('0x12'));var db=require(_0x38e6('0x13'))['db'];function respondWithStatusCode(_0x14d2cf,_0x2e2585){_0x2e2585=_0x2e2585||0xcc;return function(_0x57c207){if(_0x57c207){return _0x14d2cf[_0x38e6('0x14')](_0x2e2585);}return _0x14d2cf[_0x38e6('0x15')](_0x2e2585)['end']();};}function respondWithResult(_0x1fcdeb,_0xfd7f2){_0xfd7f2=_0xfd7f2||0xc8;return function(_0x229f18){if(_0x229f18){return _0x1fcdeb[_0x38e6('0x15')](_0xfd7f2)[_0x38e6('0x16')](_0x229f18);}};}function respondWithFilteredResult(_0x46b525,_0x55208f){return function(_0x279688){if(_0x279688){var _0x36a263=typeof _0x55208f[_0x38e6('0x17')]===_0x38e6('0x18')&&typeof _0x55208f[_0x38e6('0x19')]==='undefined';var _0x91997a=_0x279688['count'];var _0x800418=_0x36a263?0x0:_0x55208f[_0x38e6('0x17')];var _0x57ded4=_0x36a263?_0x279688[_0x38e6('0x1a')]:_0x55208f['offset']+_0x55208f[_0x38e6('0x19')];var _0x521453;if(_0x57ded4>=_0x91997a){_0x57ded4=_0x91997a;_0x521453=0xc8;}else{_0x521453=0xce;}_0x46b525[_0x38e6('0x15')](_0x521453);return _0x46b525[_0x38e6('0x1b')](_0x38e6('0x1c'),_0x800418+'-'+_0x57ded4+'/'+_0x91997a)[_0x38e6('0x16')](_0x279688);}return null;};}function patchUpdates(_0x3f1d54){return function(_0x41bb24){try{jsonpatch['apply'](_0x41bb24,_0x3f1d54,!![]);}catch(_0x5f3f67){return BPromise['reject'](_0x5f3f67);}return _0x41bb24[_0x38e6('0x1d')]();};}function saveUpdates(_0x58dc63,_0x4a82f6){return function(_0x2d995f){if(_0x2d995f){return _0x2d995f[_0x38e6('0x1e')](_0x58dc63)[_0x38e6('0x1f')](function(_0x2a8a11){return _0x2a8a11;});}return null;};}function removeEntity(_0x5f5ab2,_0x140fc3){return function(_0x4530a7){if(_0x4530a7){return _0x4530a7[_0x38e6('0x20')]()['then'](function(){_0x5f5ab2[_0x38e6('0x15')](0xcc)[_0x38e6('0x21')]();});}};}function handleEntityNotFound(_0x24e3d6,_0x9bc0b0){return function(_0x106424){if(!_0x106424){_0x24e3d6[_0x38e6('0x14')](0x194);}return _0x106424;};}function handleError(_0x179145,_0x167b28){_0x167b28=_0x167b28||0x1f4;return function(_0x4a261a){logger[_0x38e6('0x22')](_0x4a261a['stack']);if(_0x4a261a[_0x38e6('0x23')]){delete _0x4a261a[_0x38e6('0x23')];}_0x179145[_0x38e6('0x15')](_0x167b28)[_0x38e6('0x24')](_0x4a261a);};}exports[_0x38e6('0x25')]=function(_0x1afc04,_0x1d4a1b){var _0x5a4912={},_0xe93f18={},_0x1980a4={'count':0x0,'rows':[]};var _0x48f5a2=_[_0x38e6('0x26')](db[_0x38e6('0x27')]['rawAttributes'],function(_0x468310){return{'name':_0x468310[_0x38e6('0x28')],'type':_0x468310[_0x38e6('0x29')][_0x38e6('0x2a')]};});_0xe93f18[_0x38e6('0x2b')]=_[_0x38e6('0x26')](_0x48f5a2,_0x38e6('0x23'));_0xe93f18['query']=_[_0x38e6('0x2c')](_0x1afc04[_0x38e6('0x2d')]);_0xe93f18[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](_0xe93f18[_0x38e6('0x2b')],_0xe93f18[_0x38e6('0x2d')]);_0x5a4912[_0x38e6('0x30')]=_['intersection'](_0xe93f18[_0x38e6('0x2b')],qs[_0x38e6('0x31')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x31')]));_0x5a4912[_0x38e6('0x30')]=_0x5a4912[_0x38e6('0x30')][_0x38e6('0x32')]?_0x5a4912['attributes']:_0xe93f18[_0x38e6('0x2b')];if(!_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x33')](_0x38e6('0x34'))){_0x5a4912['limit']=qs[_0x38e6('0x19')](_0x1afc04[_0x38e6('0x2d')]['limit']);_0x5a4912[_0x38e6('0x17')]=qs[_0x38e6('0x17')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x17')]);}_0x5a4912['order']=qs[_0x38e6('0x35')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x35')]);_0x5a4912[_0x38e6('0x36')]=qs['filters'](_[_0x38e6('0x37')](_0x1afc04[_0x38e6('0x2d')],_0xe93f18[_0x38e6('0x2e')]),_0x48f5a2);if(_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x38')]){_0x5a4912[_0x38e6('0x36')]=_[_0x38e6('0x39')](_0x5a4912['where'],{'$or':_[_0x38e6('0x26')](_0x48f5a2,function(_0x3ac91f){if(_0x3ac91f['type']!=='VIRTUAL'){var _0x3b1eb9={};_0x3b1eb9[_0x3ac91f[_0x38e6('0x23')]]={'$like':'%'+_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x38')]+'%'};return _0x3b1eb9;}})});}_0x5a4912=_[_0x38e6('0x39')]({},_0x5a4912,_0x1afc04[_0x38e6('0x3a')]);var _0x1c80eb={'where':_0x5a4912[_0x38e6('0x36')]};return db[_0x38e6('0x27')][_0x38e6('0x1a')](_0x1c80eb)['then'](function(_0x1e2e3f){_0x1980a4[_0x38e6('0x1a')]=_0x1e2e3f;if(_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x3b')]){_0x5a4912[_0x38e6('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x38e6('0x3d')](_0x5a4912);})['then'](function(_0x7a8077){_0x1980a4[_0x38e6('0x3e')]=_0x7a8077;return _0x1980a4;})[_0x38e6('0x1f')](respondWithFilteredResult(_0x1d4a1b,_0x5a4912))[_0x38e6('0x3f')](handleError(_0x1d4a1b,null));};exports[_0x38e6('0x40')]=function(_0x557a25,_0x44e6af){var _0x3166fb={'raw':![],'where':{'id':_0x557a25[_0x38e6('0x41')]['id']}},_0x5f4ae3={};_0x5f4ae3[_0x38e6('0x2b')]=_[_0x38e6('0x2c')](db['VtigerConfiguration'][_0x38e6('0x42')]);_0x5f4ae3[_0x38e6('0x2d')]=_['keys'](_0x557a25[_0x38e6('0x2d')]);_0x5f4ae3[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](_0x5f4ae3[_0x38e6('0x2b')],_0x5f4ae3[_0x38e6('0x2d')]);_0x3166fb['attributes']=_[_0x38e6('0x2f')](_0x5f4ae3['model'],qs[_0x38e6('0x31')](_0x557a25[_0x38e6('0x2d')]['fields']));_0x3166fb[_0x38e6('0x30')]=_0x3166fb[_0x38e6('0x30')]['length']?_0x3166fb[_0x38e6('0x30')]:_0x5f4ae3[_0x38e6('0x2b')];if(_0x557a25[_0x38e6('0x2d')]['includeAll']){_0x3166fb[_0x38e6('0x3c')]=[{'all':!![]}];}_0x3166fb=_[_0x38e6('0x39')]({},_0x3166fb,_0x557a25[_0x38e6('0x3a')]);return db['VtigerConfiguration']['find'](_0x3166fb)[_0x38e6('0x1f')](handleEntityNotFound(_0x44e6af,null))[_0x38e6('0x1f')](respondWithResult(_0x44e6af,null))['catch'](handleError(_0x44e6af,null));};exports[_0x38e6('0x43')]=function(_0x191de3,_0x2eadb4){return db[_0x38e6('0x27')][_0x38e6('0x43')](_0x191de3[_0x38e6('0x44')],{})[_0x38e6('0x1f')](respondWithResult(_0x2eadb4,0xc9))['catch'](handleError(_0x2eadb4,null));};exports['update']=function(_0x447808,_0x5d1e7b){if(_0x447808[_0x38e6('0x44')]['id']){delete _0x447808[_0x38e6('0x44')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x447808[_0x38e6('0x41')]['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x5d1e7b,null))['then'](saveUpdates(_0x447808[_0x38e6('0x44')],null))['then'](respondWithResult(_0x5d1e7b,null))['catch'](handleError(_0x5d1e7b,null));};exports[_0x38e6('0x20')]=function(_0x432179,_0x385de7){return db[_0x38e6('0x27')][_0x38e6('0x45')]({'where':{'id':_0x432179['params']['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x385de7,null))[_0x38e6('0x1f')](removeEntity(_0x385de7,null))[_0x38e6('0x3f')](handleError(_0x385de7,null));};exports[_0x38e6('0x46')]=function(_0x15f2c1,_0x361ff6,_0x138800){var _0x4bd79d={};var _0x55bbe4={};var _0x487485;var _0x32e8dc;return db[_0x38e6('0x27')]['findOne']({'where':{'id':_0x15f2c1[_0x38e6('0x41')]['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x361ff6,null))[_0x38e6('0x1f')](function(_0x43a2d6){if(_0x43a2d6){_0x487485=_0x43a2d6;_0x55bbe4[_0x38e6('0x2b')]=_[_0x38e6('0x2c')](db[_0x38e6('0x47')][_0x38e6('0x42')]);_0x55bbe4[_0x38e6('0x2d')]=_[_0x38e6('0x2c')](_0x15f2c1['query']);_0x55bbe4[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](_0x55bbe4[_0x38e6('0x2b')],_0x55bbe4[_0x38e6('0x2d')]);_0x4bd79d[_0x38e6('0x30')]=_[_0x38e6('0x2f')](_0x55bbe4[_0x38e6('0x2b')],qs['fields'](_0x15f2c1[_0x38e6('0x2d')][_0x38e6('0x31')]));_0x4bd79d[_0x38e6('0x30')]=_0x4bd79d[_0x38e6('0x30')]['length']?_0x4bd79d['attributes']:_0x55bbe4['model'];_0x4bd79d['order']=qs[_0x38e6('0x35')](_0x15f2c1[_0x38e6('0x2d')][_0x38e6('0x35')]);_0x4bd79d['where']=qs[_0x38e6('0x2e')](_[_0x38e6('0x37')](_0x15f2c1['query'],_0x55bbe4[_0x38e6('0x2e')]));if(_0x15f2c1['query'][_0x38e6('0x38')]){_0x4bd79d[_0x38e6('0x36')]=_[_0x38e6('0x39')](_0x4bd79d['where'],{'$or':_[_0x38e6('0x26')](_0x4bd79d['attributes'],function(_0x679daa){var _0x54a0bc={};_0x54a0bc[_0x679daa]={'$like':'%'+_0x15f2c1[_0x38e6('0x2d')][_0x38e6('0x38')]+'%'};return _0x54a0bc;})});}_0x4bd79d=_['merge']({},_0x4bd79d,_0x15f2c1[_0x38e6('0x3a')]);return _0x487485[_0x38e6('0x46')](_0x4bd79d);}})['then'](function(_0x50e688){if(_0x50e688){_0x32e8dc=_0x50e688[_0x38e6('0x32')];if(!_0x15f2c1[_0x38e6('0x2d')][_0x38e6('0x33')](_0x38e6('0x34'))){_0x4bd79d[_0x38e6('0x19')]=qs[_0x38e6('0x19')](_0x15f2c1[_0x38e6('0x2d')]['limit']);_0x4bd79d[_0x38e6('0x17')]=qs[_0x38e6('0x17')](_0x15f2c1[_0x38e6('0x2d')][_0x38e6('0x17')]);}return _0x487485['getFields'](_0x4bd79d);}})[_0x38e6('0x1f')](function(_0x2cfb2a){if(_0x2cfb2a){return _0x2cfb2a?{'count':_0x32e8dc,'rows':_0x2cfb2a}:null;}})[_0x38e6('0x1f')](respondWithResult(_0x361ff6,null))[_0x38e6('0x3f')](handleError(_0x361ff6,null));};exports[_0x38e6('0x48')]=function(_0x449713,_0x46a495,_0x4dfae1){var _0x169ba9={};var _0x1e7c25={};var _0x5c4c75;var _0x33ec2c;return db[_0x38e6('0x27')]['findOne']({'where':{'id':_0x449713[_0x38e6('0x41')]['id']}})['then'](handleEntityNotFound(_0x46a495,null))[_0x38e6('0x1f')](function(_0x58780e){if(_0x58780e){_0x5c4c75=_0x58780e;_0x1e7c25['model']=_[_0x38e6('0x2c')](db['VtigerField'][_0x38e6('0x42')]);_0x1e7c25[_0x38e6('0x2d')]=_[_0x38e6('0x2c')](_0x449713['query']);_0x1e7c25['filters']=_[_0x38e6('0x2f')](_0x1e7c25[_0x38e6('0x2b')],_0x1e7c25[_0x38e6('0x2d')]);_0x169ba9[_0x38e6('0x30')]=_[_0x38e6('0x2f')](_0x1e7c25[_0x38e6('0x2b')],qs['fields'](_0x449713['query'][_0x38e6('0x31')]));_0x169ba9[_0x38e6('0x30')]=_0x169ba9[_0x38e6('0x30')][_0x38e6('0x32')]?_0x169ba9[_0x38e6('0x30')]:_0x1e7c25[_0x38e6('0x2b')];_0x169ba9[_0x38e6('0x49')]=qs[_0x38e6('0x35')](_0x449713[_0x38e6('0x2d')][_0x38e6('0x35')]);_0x169ba9[_0x38e6('0x36')]=qs[_0x38e6('0x2e')](_['pick'](_0x449713[_0x38e6('0x2d')],_0x1e7c25[_0x38e6('0x2e')]));if(_0x449713[_0x38e6('0x2d')][_0x38e6('0x38')]){_0x169ba9['where']=_[_0x38e6('0x39')](_0x169ba9[_0x38e6('0x36')],{'$or':_[_0x38e6('0x26')](_0x169ba9[_0x38e6('0x30')],function(_0x23a79e){var _0x592512={};_0x592512[_0x23a79e]={'$like':'%'+_0x449713[_0x38e6('0x2d')][_0x38e6('0x38')]+'%'};return _0x592512;})});}_0x169ba9=_[_0x38e6('0x39')]({},_0x169ba9,_0x449713[_0x38e6('0x3a')]);return _0x5c4c75[_0x38e6('0x48')](_0x169ba9);}})['then'](function(_0x26f37a){if(_0x26f37a){_0x33ec2c=_0x26f37a[_0x38e6('0x32')];if(!_0x449713['query']['hasOwnProperty'](_0x38e6('0x34'))){_0x169ba9[_0x38e6('0x19')]=qs[_0x38e6('0x19')](_0x449713[_0x38e6('0x2d')]['limit']);_0x169ba9[_0x38e6('0x17')]=qs['offset'](_0x449713[_0x38e6('0x2d')][_0x38e6('0x17')]);}return _0x5c4c75[_0x38e6('0x48')](_0x169ba9);}})[_0x38e6('0x1f')](function(_0x16c617){if(_0x16c617){return _0x16c617?{'count':_0x33ec2c,'rows':_0x16c617}:null;}})['then'](respondWithResult(_0x46a495,null))[_0x38e6('0x3f')](handleError(_0x46a495,null));};exports[_0x38e6('0x4a')]=function(_0x3f5470,_0x4043d6,_0x39df3c){var _0x45a4da={};var _0xc130e7={};var _0x2cc851;var _0x235ca3;return db[_0x38e6('0x27')][_0x38e6('0x4b')]({'where':{'id':_0x3f5470[_0x38e6('0x41')]['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x4043d6,null))['then'](function(_0x12d1eb){if(_0x12d1eb){_0x2cc851=_0x12d1eb;_0xc130e7[_0x38e6('0x2b')]=_[_0x38e6('0x2c')](db['VtigerField'][_0x38e6('0x42')]);_0xc130e7['query']=_['keys'](_0x3f5470[_0x38e6('0x2d')]);_0xc130e7[_0x38e6('0x2e')]=_['intersection'](_0xc130e7[_0x38e6('0x2b')],_0xc130e7[_0x38e6('0x2d')]);_0x45a4da[_0x38e6('0x30')]=_[_0x38e6('0x2f')](_0xc130e7[_0x38e6('0x2b')],qs[_0x38e6('0x31')](_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x31')]));_0x45a4da[_0x38e6('0x30')]=_0x45a4da[_0x38e6('0x30')][_0x38e6('0x32')]?_0x45a4da[_0x38e6('0x30')]:_0xc130e7['model'];_0x45a4da['order']=qs[_0x38e6('0x35')](_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x35')]);_0x45a4da[_0x38e6('0x36')]=qs[_0x38e6('0x2e')](_[_0x38e6('0x37')](_0x3f5470[_0x38e6('0x2d')],_0xc130e7[_0x38e6('0x2e')]));if(_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x38')]){_0x45a4da['where']=_[_0x38e6('0x39')](_0x45a4da[_0x38e6('0x36')],{'$or':_[_0x38e6('0x26')](_0x45a4da['attributes'],function(_0x409811){var _0x11430f={};_0x11430f[_0x409811]={'$like':'%'+_0x3f5470[_0x38e6('0x2d')]['filter']+'%'};return _0x11430f;})});}_0x45a4da=_[_0x38e6('0x39')]({},_0x45a4da,_0x3f5470[_0x38e6('0x3a')]);return _0x2cc851[_0x38e6('0x4a')](_0x45a4da);}})[_0x38e6('0x1f')](function(_0x5367af){if(_0x5367af){_0x235ca3=_0x5367af[_0x38e6('0x32')];if(!_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x33')]('nolimit')){_0x45a4da[_0x38e6('0x19')]=qs['limit'](_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x19')]);_0x45a4da[_0x38e6('0x17')]=qs[_0x38e6('0x17')](_0x3f5470[_0x38e6('0x2d')][_0x38e6('0x17')]);}return _0x2cc851[_0x38e6('0x4a')](_0x45a4da);}})[_0x38e6('0x1f')](function(_0x36c623){if(_0x36c623){return _0x36c623?{'count':_0x235ca3,'rows':_0x36c623}:null;}})['then'](respondWithResult(_0x4043d6,null))[_0x38e6('0x3f')](handleError(_0x4043d6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 47842fc..f2fb47a 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 _0x1012=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1012,0x1bb));var _0x2101=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x1012[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x2101('0x0'));var util=require(_0x2101('0x1'));var logger=require(_0x2101('0x2'))(_0x2101('0x3'));var moment=require(_0x2101('0x4'));var BPromise=require(_0x2101('0x5'));var rp=require(_0x2101('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2101('0x7'));var config=require('../../config/environment');var attributes=require(_0x2101('0x8'));module[_0x2101('0x9')]=function(_0xfcb47d,_0x35e5ff){return _0xfcb47d[_0x2101('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x2101('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b1e=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x2482cb,_0x40e166){var _0x2807a4=function(_0x18b2cb){while(--_0x18b2cb){_0x2482cb['push'](_0x2482cb['shift']());}};_0x2807a4(++_0x40e166);}(_0x5b1e,0x1f3));var _0xe5b1=function(_0x347c22,_0xfc130c){_0x347c22=_0x347c22-0x0;var _0x49ce84=_0x5b1e[_0x347c22];return _0x49ce84;};'use strict';var _=require(_0xe5b1('0x0'));var util=require(_0xe5b1('0x1'));var logger=require(_0xe5b1('0x2'))(_0xe5b1('0x3'));var moment=require('moment');var BPromise=require(_0xe5b1('0x4'));var rp=require(_0xe5b1('0x5'));var fs=require('fs');var path=require(_0xe5b1('0x6'));var rimraf=require(_0xe5b1('0x7'));var config=require('../../config/environment');var attributes=require(_0xe5b1('0x8'));module[_0xe5b1('0x9')]=function(_0x124ec9,_0x34f0a2){return _0x124ec9[_0xe5b1('0xa')]('VtigerConfiguration',attributes,{'tableName':_0xe5b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 3d0fd04..7db4505 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 _0xee04=['error','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xee04,0x165));var _0x4ee0=function(_0x4f9a24,_0xa0378c){_0x4f9a24=_0x4f9a24-0x0;var _0x3461c8=_0xee04[_0x4f9a24];return _0x3461c8;};'use strict';var _=require(_0x4ee0('0x0'));var util=require(_0x4ee0('0x1'));var moment=require('moment');var BPromise=require(_0x4ee0('0x2'));var rs=require(_0x4ee0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ee0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ee0('0x5'))(_0x4ee0('0x6'));var config=require('../../config/environment');var jayson=require(_0x4ee0('0x7'));var client=jayson[_0x4ee0('0x8')][_0x4ee0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526d6f,_0x1a7af4,_0x245af1){return new BPromise(function(_0x24c62e,_0xe027a3){return client[_0x4ee0('0xa')](_0x526d6f,_0x245af1)[_0x4ee0('0xb')](function(_0x5da739){logger[_0x4ee0('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x1a7af4,_0x4ee0('0xd'));logger[_0x4ee0('0xe')](_0x4ee0('0xf'),_0x1a7af4,_0x4ee0('0xd'),JSON[_0x4ee0('0x10')](_0x5da739));if(_0x5da739[_0x4ee0('0x11')]){if(_0x5da739[_0x4ee0('0x11')]['code']===0x1f4){logger[_0x4ee0('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x1a7af4,_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);return _0xe027a3(_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);}logger[_0x4ee0('0x11')](_0x4ee0('0x13'),_0x1a7af4,_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);return _0x24c62e(_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);}else{logger['info'](_0x4ee0('0x13'),_0x1a7af4,_0x4ee0('0xd'));_0x24c62e(_0x5da739[_0x4ee0('0x14')][_0x4ee0('0x12')]);}})[_0x4ee0('0x15')](function(_0x25c248){logger['error'](_0x4ee0('0x13'),_0x1a7af4,_0x25c248);_0xe027a3(_0x25c248);});});} \ No newline at end of file +var _0xff86=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xff86,0xfb));var _0x6ff8=function(_0x1918e1,_0x586042){_0x1918e1=_0x1918e1-0x0;var _0x3c957c=_0xff86[_0x1918e1];return _0x3c957c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ff8('0x0'));var BPromise=require(_0x6ff8('0x1'));var rs=require(_0x6ff8('0x2'));var fs=require('fs');var Redis=require(_0x6ff8('0x3'));var db=require(_0x6ff8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ff8('0x5'))(_0x6ff8('0x6'));var config=require(_0x6ff8('0x7'));var jayson=require(_0x6ff8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x452c82,_0x7f2965,_0x32da61){return new BPromise(function(_0x21c6f8,_0x531988){return client[_0x6ff8('0x9')](_0x452c82,_0x32da61)['then'](function(_0x5ab8fa){logger[_0x6ff8('0xa')](_0x6ff8('0xb'),_0x7f2965,_0x6ff8('0xc'));logger[_0x6ff8('0xd')](_0x6ff8('0xe'),_0x7f2965,_0x6ff8('0xc'),JSON[_0x6ff8('0xf')](_0x5ab8fa));if(_0x5ab8fa[_0x6ff8('0x10')]){if(_0x5ab8fa['error'][_0x6ff8('0x11')]===0x1f4){logger['error'](_0x6ff8('0xb'),_0x7f2965,_0x5ab8fa[_0x6ff8('0x10')][_0x6ff8('0x12')]);return _0x531988(_0x5ab8fa[_0x6ff8('0x10')][_0x6ff8('0x12')]);}logger['error'](_0x6ff8('0xb'),_0x7f2965,_0x5ab8fa[_0x6ff8('0x10')]['message']);return _0x21c6f8(_0x5ab8fa[_0x6ff8('0x10')][_0x6ff8('0x12')]);}else{logger[_0x6ff8('0xa')](_0x6ff8('0xb'),_0x7f2965,_0x6ff8('0xc'));_0x21c6f8(_0x5ab8fa[_0x6ff8('0x13')][_0x6ff8('0x12')]);}})[_0x6ff8('0x14')](function(_0x55bc88){logger[_0x6ff8('0x10')](_0x6ff8('0xb'),_0x7f2965,_0x55bc88);_0x531988(_0x55bc88);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a51272a..cca74be 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 _0x013e=['get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0x013e,0x1c2));var _0xe013=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x013e[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xe013('0x0'));var util=require(_0xe013('0x1'));var path=require(_0xe013('0x2'));var timeout=require(_0xe013('0x3'));var express=require('express');var router=express[_0xe013('0x4')]();var fs_extra=require(_0xe013('0x5'));var auth=require(_0xe013('0x6'));var interaction=require(_0xe013('0x7'));var config=require(_0xe013('0x8'));var controller=require(_0xe013('0x9'));router[_0xe013('0xa')]('/',auth[_0xe013('0xb')](),controller[_0xe013('0xc')]);router[_0xe013('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe013('0xd')]);router[_0xe013('0xe')]('/',auth[_0xe013('0xb')](),controller['create']);router[_0xe013('0xf')](_0xe013('0x10'),auth[_0xe013('0xb')](),controller[_0xe013('0x11')]);router[_0xe013('0x12')](_0xe013('0x10'),auth[_0xe013('0xb')](),controller['destroy']);module[_0xe013('0x13')]=router; \ No newline at end of file +var _0x7e23=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x195865,_0x567647){var _0x460116=function(_0x26a76c){while(--_0x26a76c){_0x195865['push'](_0x195865['shift']());}};_0x460116(++_0x567647);}(_0x7e23,0x13d));var _0x37e2=function(_0x17153f,_0x50f7e7){_0x17153f=_0x17153f-0x0;var _0x13c250=_0x7e23[_0x17153f];return _0x13c250;};'use strict';var multer=require('multer');var util=require(_0x37e2('0x0'));var path=require(_0x37e2('0x1'));var timeout=require(_0x37e2('0x2'));var express=require(_0x37e2('0x3'));var router=express[_0x37e2('0x4')]();var fs_extra=require(_0x37e2('0x5'));var auth=require(_0x37e2('0x6'));var interaction=require(_0x37e2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x37e2('0x8')]('/',auth[_0x37e2('0x9')](),controller[_0x37e2('0xa')]);router[_0x37e2('0x8')](_0x37e2('0xb'),auth[_0x37e2('0x9')](),controller[_0x37e2('0xc')]);router[_0x37e2('0xd')]('/',auth['isAuthenticated'](),controller[_0x37e2('0xe')]);router['put'](_0x37e2('0xb'),auth[_0x37e2('0x9')](),controller['update']);router['delete'](_0x37e2('0xb'),auth[_0x37e2('0x9')](),controller[_0x37e2('0xf')]);module[_0x37e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3e337f4..02ecb82 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 _0x75d3=['ENUM','customVariable','sequelize','exports','string','variable','picklist','STRING'];(function(_0x5b28b5,_0xbeb1eb){var _0x418cd9=function(_0x4afdbe){while(--_0x4afdbe){_0x5b28b5['push'](_0x5b28b5['shift']());}};_0x418cd9(++_0xbeb1eb);}(_0x75d3,0x1ea));var _0x375d=function(_0x481756,_0x5c4756){_0x481756=_0x481756-0x0;var _0x74c86f=_0x75d3[_0x481756];return _0x74c86f;};'use strict';var Sequelize=require(_0x375d('0x0'));module[_0x375d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x375d('0x2'),_0x375d('0x3'),'customVariable','keyValue',_0x375d('0x4')),'defaultValue':_0x375d('0x2')},'content':{'type':Sequelize[_0x375d('0x5')]},'key':{'type':Sequelize[_0x375d('0x5')]},'keyType':{'type':Sequelize[_0x375d('0x6')]('string','variable',_0x375d('0x7'))},'keyContent':{'type':Sequelize[_0x375d('0x5')]},'idField':{'type':Sequelize[_0x375d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x375d('0x5')]}}; \ No newline at end of file +var _0x12a9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x1ea3e2,_0x2f9834){var _0x59d72c=function(_0x4d9a52){while(--_0x4d9a52){_0x1ea3e2['push'](_0x1ea3e2['shift']());}};_0x59d72c(++_0x2f9834);}(_0x12a9,0x153));var _0x912a=function(_0x5009d5,_0x45edf3){_0x5009d5=_0x5009d5-0x0;var _0x998a07=_0x12a9[_0x5009d5];return _0x998a07;};'use strict';var Sequelize=require(_0x912a('0x0'));module[_0x912a('0x1')]={'type':{'type':Sequelize[_0x912a('0x2')](_0x912a('0x3'),_0x912a('0x4'),_0x912a('0x5'),_0x912a('0x6'),_0x912a('0x7')),'defaultValue':_0x912a('0x3')},'content':{'type':Sequelize[_0x912a('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x912a('0x2')](_0x912a('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x912a('0x8')]},'idField':{'type':Sequelize[_0x912a('0x8')]},'nameField':{'type':Sequelize[_0x912a('0x8')]},'customField':{'type':Sequelize[_0x912a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b7cba4b..486ca7f 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 _0xf23b=['reject','save','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x38cf2f,_0x4424da){var _0xdf2c17=function(_0x20c971){while(--_0x20c971){_0x38cf2f['push'](_0x38cf2f['shift']());}};_0xdf2c17(++_0x4424da);}(_0xf23b,0x1d9));var _0xbf23=function(_0x395931,_0x5ef24c){_0x395931=_0x395931-0x0;var _0x38d06d=_0xf23b[_0x395931];return _0x38d06d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf23('0x0'));var rp=require(_0xbf23('0x1'));var moment=require('moment');var BPromise=require(_0xbf23('0x2'));var Mustache=require(_0xbf23('0x3'));var util=require(_0xbf23('0x4'));var path=require('path');var sox=require(_0xbf23('0x5'));var csv=require(_0xbf23('0x6'));var ejs=require(_0xbf23('0x7'));var fs=require('fs');var fs_extra=require(_0xbf23('0x8'));var _=require(_0xbf23('0x9'));var squel=require('squel');var crypto=require(_0xbf23('0xa'));var jsforce=require(_0xbf23('0xb'));var deskjs=require(_0xbf23('0xc'));var toCsv=require(_0xbf23('0x6'));var querystring=require(_0xbf23('0xd'));var Papa=require(_0xbf23('0xe'));var Redis=require('ioredis');var authService=require(_0xbf23('0xf'));var qs=require(_0xbf23('0x10'));var as=require(_0xbf23('0x11'));var hardwareService=require(_0xbf23('0x12'));var logger=require(_0xbf23('0x13'))(_0xbf23('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf23('0x15'))['db'];function respondWithStatusCode(_0x44ea6a,_0x3f9c06){_0x3f9c06=_0x3f9c06||0xcc;return function(_0x9e6eec){if(_0x9e6eec){return _0x44ea6a[_0xbf23('0x16')](_0x3f9c06);}return _0x44ea6a[_0xbf23('0x17')](_0x3f9c06)[_0xbf23('0x18')]();};}function respondWithResult(_0x28bc37,_0x4c0ebc){_0x4c0ebc=_0x4c0ebc||0xc8;return function(_0x26eaae){if(_0x26eaae){return _0x28bc37[_0xbf23('0x17')](_0x4c0ebc)[_0xbf23('0x19')](_0x26eaae);}};}function respondWithFilteredResult(_0x496884,_0x1c3692){return function(_0x362572){if(_0x362572){var _0x262f2b=typeof _0x1c3692[_0xbf23('0x1a')]==='undefined'&&typeof _0x1c3692['limit']===_0xbf23('0x1b');var _0xac4a50=_0x362572[_0xbf23('0x1c')];var _0x545c6b=_0x262f2b?0x0:_0x1c3692[_0xbf23('0x1a')];var _0x346bb7=_0x262f2b?_0x362572[_0xbf23('0x1c')]:_0x1c3692[_0xbf23('0x1a')]+_0x1c3692[_0xbf23('0x1d')];var _0x1fa642;if(_0x346bb7>=_0xac4a50){_0x346bb7=_0xac4a50;_0x1fa642=0xc8;}else{_0x1fa642=0xce;}_0x496884[_0xbf23('0x17')](_0x1fa642);return _0x496884[_0xbf23('0x1e')]('Content-Range',_0x545c6b+'-'+_0x346bb7+'/'+_0xac4a50)[_0xbf23('0x19')](_0x362572);}return null;};}function patchUpdates(_0x1ad61f){return function(_0x5685ae){try{jsonpatch['apply'](_0x5685ae,_0x1ad61f,!![]);}catch(_0x3d4f12){return BPromise[_0xbf23('0x1f')](_0x3d4f12);}return _0x5685ae[_0xbf23('0x20')]();};}function saveUpdates(_0x49f467,_0x545cee){return function(_0x5ee85c){if(_0x5ee85c){return _0x5ee85c[_0xbf23('0x21')](_0x49f467)['then'](function(_0x49c2a4){return _0x49c2a4;});}return null;};}function removeEntity(_0x14b445,_0x1bf888){return function(_0x184d59){if(_0x184d59){return _0x184d59[_0xbf23('0x22')]()[_0xbf23('0x23')](function(){_0x14b445[_0xbf23('0x17')](0xcc)[_0xbf23('0x18')]();});}};}function handleEntityNotFound(_0x13f6f2,_0x53990b){return function(_0x715739){if(!_0x715739){_0x13f6f2['sendStatus'](0x194);}return _0x715739;};}function handleError(_0x5b5c12,_0x5217de){_0x5217de=_0x5217de||0x1f4;return function(_0x33269){logger[_0xbf23('0x24')](_0x33269[_0xbf23('0x25')]);if(_0x33269['name']){delete _0x33269[_0xbf23('0x26')];}_0x5b5c12[_0xbf23('0x17')](_0x5217de)[_0xbf23('0x27')](_0x33269);};}exports[_0xbf23('0x28')]=function(_0xda1bcd,_0x4a2cbb){var _0x355d7f={},_0x46a2fa={},_0x31588d={'count':0x0,'rows':[]};var _0x224cc0=_[_0xbf23('0x29')](db[_0xbf23('0x2a')][_0xbf23('0x2b')],function(_0x1b3a8e){return{'name':_0x1b3a8e['fieldName'],'type':_0x1b3a8e['type'][_0xbf23('0x2c')]};});_0x46a2fa['model']=_[_0xbf23('0x29')](_0x224cc0,_0xbf23('0x26'));_0x46a2fa[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0xda1bcd[_0xbf23('0x2d')]);_0x46a2fa[_0xbf23('0x2f')]=_[_0xbf23('0x30')](_0x46a2fa[_0xbf23('0x31')],_0x46a2fa[_0xbf23('0x2d')]);_0x355d7f[_0xbf23('0x32')]=_[_0xbf23('0x30')](_0x46a2fa[_0xbf23('0x31')],qs[_0xbf23('0x33')](_0xda1bcd[_0xbf23('0x2d')]['fields']));_0x355d7f['attributes']=_0x355d7f[_0xbf23('0x32')][_0xbf23('0x34')]?_0x355d7f['attributes']:_0x46a2fa[_0xbf23('0x31')];if(!_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x35')](_0xbf23('0x36'))){_0x355d7f[_0xbf23('0x1d')]=qs[_0xbf23('0x1d')](_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x1d')]);_0x355d7f[_0xbf23('0x1a')]=qs[_0xbf23('0x1a')](_0xda1bcd[_0xbf23('0x2d')]['offset']);}_0x355d7f['order']=qs[_0xbf23('0x37')](_0xda1bcd[_0xbf23('0x2d')]['sort']);_0x355d7f[_0xbf23('0x38')]=qs[_0xbf23('0x2f')](_[_0xbf23('0x39')](_0xda1bcd[_0xbf23('0x2d')],_0x46a2fa[_0xbf23('0x2f')]),_0x224cc0);if(_0xda1bcd['query'][_0xbf23('0x3a')]){_0x355d7f[_0xbf23('0x38')]=_['merge'](_0x355d7f[_0xbf23('0x38')],{'$or':_[_0xbf23('0x29')](_0x224cc0,function(_0x29cd22){if(_0x29cd22[_0xbf23('0x3b')]!=='VIRTUAL'){var _0x492075={};_0x492075[_0x29cd22['name']]={'$like':'%'+_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x3a')]+'%'};return _0x492075;}})});}_0x355d7f=_[_0xbf23('0x3c')]({},_0x355d7f,_0xda1bcd[_0xbf23('0x3d')]);var _0x53e83d={'where':_0x355d7f[_0xbf23('0x38')]};return db[_0xbf23('0x2a')][_0xbf23('0x1c')](_0x53e83d)['then'](function(_0x176d4e){_0x31588d[_0xbf23('0x1c')]=_0x176d4e;if(_0xda1bcd['query']['includeAll']){_0x355d7f[_0xbf23('0x3e')]=[{'all':!![]}];}return db[_0xbf23('0x2a')][_0xbf23('0x3f')](_0x355d7f);})['then'](function(_0xe26eec){_0x31588d[_0xbf23('0x40')]=_0xe26eec;return _0x31588d;})['then'](respondWithFilteredResult(_0x4a2cbb,_0x355d7f))[_0xbf23('0x41')](handleError(_0x4a2cbb,null));};exports[_0xbf23('0x42')]=function(_0x1728b9,_0x3edec8){var _0x37316c={'raw':!![],'where':{'id':_0x1728b9[_0xbf23('0x43')]['id']}},_0x152115={};_0x152115[_0xbf23('0x31')]=_[_0xbf23('0x2e')](db['VtigerField'][_0xbf23('0x2b')]);_0x152115['query']=_[_0xbf23('0x2e')](_0x1728b9['query']);_0x152115[_0xbf23('0x2f')]=_[_0xbf23('0x30')](_0x152115['model'],_0x152115[_0xbf23('0x2d')]);_0x37316c[_0xbf23('0x32')]=_['intersection'](_0x152115[_0xbf23('0x31')],qs[_0xbf23('0x33')](_0x1728b9[_0xbf23('0x2d')][_0xbf23('0x33')]));_0x37316c[_0xbf23('0x32')]=_0x37316c[_0xbf23('0x32')][_0xbf23('0x34')]?_0x37316c['attributes']:_0x152115['model'];if(_0x1728b9[_0xbf23('0x2d')][_0xbf23('0x44')]){_0x37316c[_0xbf23('0x3e')]=[{'all':!![]}];}_0x37316c=_[_0xbf23('0x3c')]({},_0x37316c,_0x1728b9['options']);return db[_0xbf23('0x2a')]['find'](_0x37316c)[_0xbf23('0x23')](handleEntityNotFound(_0x3edec8,null))[_0xbf23('0x23')](respondWithResult(_0x3edec8,null))[_0xbf23('0x41')](handleError(_0x3edec8,null));};exports[_0xbf23('0x45')]=function(_0x1c02c9,_0x49f8d2){return db['VtigerField'][_0xbf23('0x45')](_0x1c02c9[_0xbf23('0x46')],{})[_0xbf23('0x23')](respondWithResult(_0x49f8d2,0xc9))['catch'](handleError(_0x49f8d2,null));};exports[_0xbf23('0x21')]=function(_0x3990f4,_0xd6a43d){if(_0x3990f4[_0xbf23('0x46')]['id']){delete _0x3990f4['body']['id'];}return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x3990f4[_0xbf23('0x43')]['id']}})[_0xbf23('0x23')](handleEntityNotFound(_0xd6a43d,null))[_0xbf23('0x23')](saveUpdates(_0x3990f4[_0xbf23('0x46')],null))['then'](respondWithResult(_0xd6a43d,null))[_0xbf23('0x41')](handleError(_0xd6a43d,null));};exports['destroy']=function(_0x4c58b9,_0x468929){return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x4c58b9[_0xbf23('0x43')]['id']}})[_0xbf23('0x23')](handleEntityNotFound(_0x468929,null))[_0xbf23('0x23')](removeEntity(_0x468929,null))[_0xbf23('0x41')](handleError(_0x468929,null));}; \ No newline at end of file +var _0x0bc6=['merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x0bc6,0x13f));var _0x60bc=function(_0x335da3,_0x8bac2a){_0x335da3=_0x335da3-0x0;var _0x359a6d=_0x0bc6[_0x335da3];return _0x359a6d;};'use strict';var emlformat=require(_0x60bc('0x0'));var rimraf=require(_0x60bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60bc('0x2'));var rp=require(_0x60bc('0x3'));var moment=require(_0x60bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60bc('0x5'));var util=require(_0x60bc('0x6'));var path=require(_0x60bc('0x7'));var sox=require('sox');var csv=require(_0x60bc('0x8'));var ejs=require(_0x60bc('0x9'));var fs=require('fs');var fs_extra=require(_0x60bc('0xa'));var _=require(_0x60bc('0xb'));var squel=require(_0x60bc('0xc'));var crypto=require('crypto');var jsforce=require(_0x60bc('0xd'));var deskjs=require(_0x60bc('0xe'));var toCsv=require(_0x60bc('0x8'));var querystring=require(_0x60bc('0xf'));var Papa=require('papaparse');var Redis=require(_0x60bc('0x10'));var authService=require(_0x60bc('0x11'));var qs=require(_0x60bc('0x12'));var as=require(_0x60bc('0x13'));var hardwareService=require(_0x60bc('0x14'));var logger=require(_0x60bc('0x15'))('api');var utils=require(_0x60bc('0x16'));var config=require(_0x60bc('0x17'));var licenseUtil=require(_0x60bc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa81d30,_0x57125b){_0x57125b=_0x57125b||0xcc;return function(_0x4e0caf){if(_0x4e0caf){return _0xa81d30['sendStatus'](_0x57125b);}return _0xa81d30[_0x60bc('0x19')](_0x57125b)[_0x60bc('0x1a')]();};}function respondWithResult(_0x5095b3,_0x1a9907){_0x1a9907=_0x1a9907||0xc8;return function(_0xab655d){if(_0xab655d){return _0x5095b3[_0x60bc('0x19')](_0x1a9907)[_0x60bc('0x1b')](_0xab655d);}};}function respondWithFilteredResult(_0x39176a,_0x5c7a01){return function(_0xb9290a){if(_0xb9290a){var _0x2d4731=typeof _0x5c7a01[_0x60bc('0x1c')]===_0x60bc('0x1d')&&typeof _0x5c7a01[_0x60bc('0x1e')]===_0x60bc('0x1d');var _0xa13ced=_0xb9290a[_0x60bc('0x1f')];var _0x4df028=_0x2d4731?0x0:_0x5c7a01[_0x60bc('0x1c')];var _0x5cdb03=_0x2d4731?_0xb9290a[_0x60bc('0x1f')]:_0x5c7a01[_0x60bc('0x1c')]+_0x5c7a01[_0x60bc('0x1e')];var _0x59896d;if(_0x5cdb03>=_0xa13ced){_0x5cdb03=_0xa13ced;_0x59896d=0xc8;}else{_0x59896d=0xce;}_0x39176a[_0x60bc('0x19')](_0x59896d);return _0x39176a[_0x60bc('0x20')](_0x60bc('0x21'),_0x4df028+'-'+_0x5cdb03+'/'+_0xa13ced)['json'](_0xb9290a);}return null;};}function patchUpdates(_0x359dac){return function(_0x187f7f){try{jsonpatch['apply'](_0x187f7f,_0x359dac,!![]);}catch(_0x4cc7ac){return BPromise[_0x60bc('0x22')](_0x4cc7ac);}return _0x187f7f[_0x60bc('0x23')]();};}function saveUpdates(_0x2bec79,_0x23e59d){return function(_0x28107d){if(_0x28107d){return _0x28107d[_0x60bc('0x24')](_0x2bec79)[_0x60bc('0x25')](function(_0x3bb57c){return _0x3bb57c;});}return null;};}function removeEntity(_0x4ad5b2,_0x511040){return function(_0x3c51d6){if(_0x3c51d6){return _0x3c51d6[_0x60bc('0x26')]()[_0x60bc('0x25')](function(){_0x4ad5b2[_0x60bc('0x19')](0xcc)[_0x60bc('0x1a')]();});}};}function handleEntityNotFound(_0x46036e,_0x34b43e){return function(_0x47383a){if(!_0x47383a){_0x46036e[_0x60bc('0x27')](0x194);}return _0x47383a;};}function handleError(_0x156d51,_0x365f89){_0x365f89=_0x365f89||0x1f4;return function(_0x365a4d){logger[_0x60bc('0x28')](_0x365a4d[_0x60bc('0x29')]);if(_0x365a4d[_0x60bc('0x2a')]){delete _0x365a4d[_0x60bc('0x2a')];}_0x156d51[_0x60bc('0x19')](_0x365f89)[_0x60bc('0x2b')](_0x365a4d);};}exports[_0x60bc('0x2c')]=function(_0x1abb85,_0xe00c4e){var _0x2f11ca={},_0x2be2da={},_0x842a6b={'count':0x0,'rows':[]};var _0x48df9e=_[_0x60bc('0x2d')](db[_0x60bc('0x2e')]['rawAttributes'],function(_0x3078de){return{'name':_0x3078de[_0x60bc('0x2f')],'type':_0x3078de['type'][_0x60bc('0x30')]};});_0x2be2da[_0x60bc('0x31')]=_[_0x60bc('0x2d')](_0x48df9e,_0x60bc('0x2a'));_0x2be2da[_0x60bc('0x32')]=_[_0x60bc('0x33')](_0x1abb85[_0x60bc('0x32')]);_0x2be2da[_0x60bc('0x34')]=_[_0x60bc('0x35')](_0x2be2da['model'],_0x2be2da['query']);_0x2f11ca[_0x60bc('0x36')]=_[_0x60bc('0x35')](_0x2be2da[_0x60bc('0x31')],qs['fields'](_0x1abb85[_0x60bc('0x32')][_0x60bc('0x37')]));_0x2f11ca[_0x60bc('0x36')]=_0x2f11ca['attributes']['length']?_0x2f11ca[_0x60bc('0x36')]:_0x2be2da[_0x60bc('0x31')];if(!_0x1abb85[_0x60bc('0x32')][_0x60bc('0x38')]('nolimit')){_0x2f11ca[_0x60bc('0x1e')]=qs[_0x60bc('0x1e')](_0x1abb85[_0x60bc('0x32')][_0x60bc('0x1e')]);_0x2f11ca[_0x60bc('0x1c')]=qs[_0x60bc('0x1c')](_0x1abb85[_0x60bc('0x32')][_0x60bc('0x1c')]);}_0x2f11ca[_0x60bc('0x39')]=qs[_0x60bc('0x3a')](_0x1abb85[_0x60bc('0x32')]['sort']);_0x2f11ca[_0x60bc('0x3b')]=qs[_0x60bc('0x34')](_[_0x60bc('0x3c')](_0x1abb85[_0x60bc('0x32')],_0x2be2da[_0x60bc('0x34')]),_0x48df9e);if(_0x1abb85[_0x60bc('0x32')]['filter']){_0x2f11ca[_0x60bc('0x3b')]=_[_0x60bc('0x3d')](_0x2f11ca['where'],{'$or':_['map'](_0x48df9e,function(_0x46ef9d){if(_0x46ef9d['type']!==_0x60bc('0x3e')){var _0x296695={};_0x296695[_0x46ef9d[_0x60bc('0x2a')]]={'$like':'%'+_0x1abb85[_0x60bc('0x32')][_0x60bc('0x3f')]+'%'};return _0x296695;}})});}_0x2f11ca=_[_0x60bc('0x3d')]({},_0x2f11ca,_0x1abb85[_0x60bc('0x40')]);var _0x47b02a={'where':_0x2f11ca[_0x60bc('0x3b')]};return db[_0x60bc('0x2e')][_0x60bc('0x1f')](_0x47b02a)[_0x60bc('0x25')](function(_0x281b74){_0x842a6b[_0x60bc('0x1f')]=_0x281b74;if(_0x1abb85[_0x60bc('0x32')][_0x60bc('0x41')]){_0x2f11ca['include']=[{'all':!![]}];}return db['VtigerField'][_0x60bc('0x42')](_0x2f11ca);})[_0x60bc('0x25')](function(_0xde63c5){_0x842a6b[_0x60bc('0x43')]=_0xde63c5;return _0x842a6b;})[_0x60bc('0x25')](respondWithFilteredResult(_0xe00c4e,_0x2f11ca))['catch'](handleError(_0xe00c4e,null));};exports[_0x60bc('0x44')]=function(_0x17533f,_0x4a4c72){var _0x5c6c8e={'raw':!![],'where':{'id':_0x17533f[_0x60bc('0x45')]['id']}},_0x113cdb={};_0x113cdb[_0x60bc('0x31')]=_[_0x60bc('0x33')](db[_0x60bc('0x2e')]['rawAttributes']);_0x113cdb[_0x60bc('0x32')]=_[_0x60bc('0x33')](_0x17533f[_0x60bc('0x32')]);_0x113cdb['filters']=_[_0x60bc('0x35')](_0x113cdb['model'],_0x113cdb[_0x60bc('0x32')]);_0x5c6c8e[_0x60bc('0x36')]=_[_0x60bc('0x35')](_0x113cdb[_0x60bc('0x31')],qs[_0x60bc('0x37')](_0x17533f['query'][_0x60bc('0x37')]));_0x5c6c8e[_0x60bc('0x36')]=_0x5c6c8e['attributes'][_0x60bc('0x46')]?_0x5c6c8e[_0x60bc('0x36')]:_0x113cdb[_0x60bc('0x31')];if(_0x17533f['query'][_0x60bc('0x41')]){_0x5c6c8e[_0x60bc('0x47')]=[{'all':!![]}];}_0x5c6c8e=_[_0x60bc('0x3d')]({},_0x5c6c8e,_0x17533f[_0x60bc('0x40')]);return db[_0x60bc('0x2e')][_0x60bc('0x48')](_0x5c6c8e)[_0x60bc('0x25')](handleEntityNotFound(_0x4a4c72,null))[_0x60bc('0x25')](respondWithResult(_0x4a4c72,null))[_0x60bc('0x49')](handleError(_0x4a4c72,null));};exports[_0x60bc('0x4a')]=function(_0x38c611,_0x5433a2){return db['VtigerField']['create'](_0x38c611[_0x60bc('0x4b')],{})[_0x60bc('0x25')](respondWithResult(_0x5433a2,0xc9))[_0x60bc('0x49')](handleError(_0x5433a2,null));};exports[_0x60bc('0x24')]=function(_0x1192eb,_0x5b4b6c){if(_0x1192eb['body']['id']){delete _0x1192eb[_0x60bc('0x4b')]['id'];}return db[_0x60bc('0x2e')][_0x60bc('0x48')]({'where':{'id':_0x1192eb['params']['id']}})[_0x60bc('0x25')](handleEntityNotFound(_0x5b4b6c,null))['then'](saveUpdates(_0x1192eb[_0x60bc('0x4b')],null))[_0x60bc('0x25')](respondWithResult(_0x5b4b6c,null))[_0x60bc('0x49')](handleError(_0x5b4b6c,null));};exports[_0x60bc('0x26')]=function(_0xc75935,_0x519fbd){return db['VtigerField'][_0x60bc('0x48')]({'where':{'id':_0xc75935[_0x60bc('0x45')]['id']}})[_0x60bc('0x25')](handleEntityNotFound(_0x519fbd,null))['then'](removeEntity(_0x519fbd,null))[_0x60bc('0x49')](handleError(_0x519fbd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8f74bde..6e729c8 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 _0x0037=['api','moment','bluebird','rimraf','../../config/environment','exports','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3ba2f6,_0x13cdb9){var _0x5bf772=function(_0x301a3f){while(--_0x301a3f){_0x3ba2f6['push'](_0x3ba2f6['shift']());}};_0x5bf772(++_0x13cdb9);}(_0x0037,0x15c));var _0x7003=function(_0x59ec8c,_0x5e0b53){_0x59ec8c=_0x59ec8c-0x0;var _0x3d0cf2=_0x0037[_0x59ec8c];return _0x3d0cf2;};'use strict';var _=require(_0x7003('0x0'));var util=require(_0x7003('0x1'));var logger=require(_0x7003('0x2'))(_0x7003('0x3'));var moment=require(_0x7003('0x4'));var BPromise=require(_0x7003('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7003('0x6'));var config=require(_0x7003('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x7003('0x8')]=function(_0x54ba2e,_0x5743d5){return _0x54ba2e['define'](_0x7003('0x9'),attributes,{'tableName':_0x7003('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x7003('0xb'),_0x7003('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0d7=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','define','int_vtiger_fields','idField','FieldId'];(function(_0x3cdcbe,_0x450f7b){var _0x5846a1=function(_0x5d2030){while(--_0x5d2030){_0x3cdcbe['push'](_0x3cdcbe['shift']());}};_0x5846a1(++_0x450f7b);}(_0xa0d7,0x181));var _0x7a0d=function(_0xda504f,_0x5ee97f){_0xda504f=_0xda504f-0x0;var _0x4451bc=_0xa0d7[_0xda504f];return _0x4451bc;};'use strict';var _=require(_0x7a0d('0x0'));var util=require(_0x7a0d('0x1'));var logger=require(_0x7a0d('0x2'))(_0x7a0d('0x3'));var moment=require(_0x7a0d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a0d('0x5'));var config=require(_0x7a0d('0x6'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x3d74d2,_0x230796){return _0x3d74d2[_0x7a0d('0x7')]('VtigerField',attributes,{'tableName':_0x7a0d('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x7a0d('0x9'),_0x7a0d('0xa')],'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 a63a929..fc89b77 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 _0xfb4f=['jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x31b4b7,_0x4478c9){var _0x5e31e4=function(_0x21691c){while(--_0x21691c){_0x31b4b7['push'](_0x31b4b7['shift']());}};_0x5e31e4(++_0x4478c9);}(_0xfb4f,0x8c));var _0xffb4=function(_0x14a303,_0x2184aa){_0x14a303=_0x14a303-0x0;var _0x4e3074=_0xfb4f[_0x14a303];return _0x4e3074;};'use strict';var _=require(_0xffb4('0x0'));var util=require(_0xffb4('0x1'));var moment=require(_0xffb4('0x2'));var BPromise=require(_0xffb4('0x3'));var rs=require(_0xffb4('0x4'));var fs=require('fs');var Redis=require(_0xffb4('0x5'));var db=require(_0xffb4('0x6'))['db'];var utils=require(_0xffb4('0x7'));var logger=require('../../config/logger')(_0xffb4('0x8'));var config=require(_0xffb4('0x9'));var jayson=require(_0xffb4('0xa'));var client=jayson[_0xffb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3204,_0x39d528,_0x49fb9a){return new BPromise(function(_0x36ac5d,_0x39ee6d){return client[_0xffb4('0xc')](_0x2a3204,_0x49fb9a)[_0xffb4('0xd')](function(_0xaee03d){logger[_0xffb4('0xe')](_0xffb4('0xf'),_0x39d528,'request\x20sent');logger[_0xffb4('0x10')](_0xffb4('0x11'),_0x39d528,_0xffb4('0x12'),JSON[_0xffb4('0x13')](_0xaee03d));if(_0xaee03d[_0xffb4('0x14')]){if(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x15')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x39d528,_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);return _0x39ee6d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0xaee03d[_0xffb4('0x14')]['message']);return _0x36ac5d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}else{logger['info'](_0xffb4('0xf'),_0x39d528,_0xffb4('0x12'));_0x36ac5d(_0xaee03d[_0xffb4('0x17')][_0xffb4('0x16')]);}})[_0xffb4('0x18')](function(_0x862bd5){logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0x862bd5);_0x39ee6d(_0x862bd5);});});} \ No newline at end of file +var _0x399c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x282bbc,_0xad501d){var _0x335eeb=function(_0x5a3e8d){while(--_0x5a3e8d){_0x282bbc['push'](_0x282bbc['shift']());}};_0x335eeb(++_0xad501d);}(_0x399c,0x126));var _0xc399=function(_0x57abbf,_0x129e05){_0x57abbf=_0x57abbf-0x0;var _0x335016=_0x399c[_0x57abbf];return _0x335016;};'use strict';var _=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var moment=require(_0xc399('0x2'));var BPromise=require('bluebird');var rs=require(_0xc399('0x3'));var fs=require('fs');var Redis=require(_0xc399('0x4'));var db=require(_0xc399('0x5'))['db'];var utils=require(_0xc399('0x6'));var logger=require('../../config/logger')(_0xc399('0x7'));var config=require(_0xc399('0x8'));var jayson=require(_0xc399('0x9'));var client=jayson[_0xc399('0xa')][_0xc399('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1308a0,_0x2b7a1c,_0x1ae1b9){return new BPromise(function(_0x257c82,_0x52c237){return client[_0xc399('0xc')](_0x1308a0,_0x1ae1b9)['then'](function(_0x55d044){logger[_0xc399('0xd')](_0xc399('0xe'),_0x2b7a1c,_0xc399('0xf'));logger[_0xc399('0x10')](_0xc399('0x11'),_0x2b7a1c,'request\x20sent',JSON[_0xc399('0x12')](_0x55d044));if(_0x55d044[_0xc399('0x13')]){if(_0x55d044[_0xc399('0x13')]['code']===0x1f4){logger[_0xc399('0x13')](_0xc399('0xe'),_0x2b7a1c,_0x55d044['error'][_0xc399('0x14')]);return _0x52c237(_0x55d044[_0xc399('0x13')][_0xc399('0x14')]);}logger['error'](_0xc399('0xe'),_0x2b7a1c,_0x55d044[_0xc399('0x13')][_0xc399('0x14')]);return _0x257c82(_0x55d044[_0xc399('0x13')][_0xc399('0x14')]);}else{logger[_0xc399('0xd')](_0xc399('0xe'),_0x2b7a1c,_0xc399('0xf'));_0x257c82(_0x55d044[_0xc399('0x15')][_0xc399('0x14')]);}})[_0xc399('0x16')](function(_0x26903b){logger['error'](_0xc399('0xe'),_0x2b7a1c,_0x26903b);_0x52c237(_0x26903b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 92598ca..3a48d90 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 _0x883f=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x2a12c1,_0x20dd3d){var _0xd296c4=function(_0x2e5e6e){while(--_0x2e5e6e){_0x2a12c1['push'](_0x2a12c1['shift']());}};_0xd296c4(++_0x20dd3d);}(_0x883f,0xb3));var _0xf883=function(_0x10a19a,_0x1a45ec){_0x10a19a=_0x10a19a-0x0;var _0x3f7183=_0x883f[_0x10a19a];return _0x3f7183;};'use strict';var multer=require('multer');var util=require(_0xf883('0x0'));var path=require(_0xf883('0x1'));var timeout=require(_0xf883('0x2'));var express=require(_0xf883('0x3'));var router=express[_0xf883('0x4')]();var fs_extra=require(_0xf883('0x5'));var auth=require(_0xf883('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf883('0x7'));var controller=require(_0xf883('0x8'));router[_0xf883('0x9')]('/',auth[_0xf883('0xa')](),controller[_0xf883('0xb')]);router['get'](_0xf883('0xc'),auth['isAuthenticated'](),controller[_0xf883('0xd')]);router[_0xf883('0x9')](_0xf883('0xe'),auth[_0xf883('0xa')](),controller[_0xf883('0xf')]);router[_0xf883('0x9')](_0xf883('0x10'),auth['isAuthenticated'](),controller[_0xf883('0x11')]);router[_0xf883('0x12')]('/',auth[_0xf883('0xa')](),controller['create']);router['post'](_0xf883('0xe'),auth[_0xf883('0xa')](),controller[_0xf883('0x13')]);router[_0xf883('0x14')]('/:id',auth[_0xf883('0xa')](),controller[_0xf883('0x15')]);router[_0xf883('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf883('0x17')]);module[_0xf883('0x18')]=router; \ No newline at end of file +var _0x6501=['get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x5dcae8,_0x14040a){var _0xa7a0c6=function(_0x40d4a9){while(--_0x40d4a9){_0x5dcae8['push'](_0x5dcae8['shift']());}};_0xa7a0c6(++_0x14040a);}(_0x6501,0xff));var _0x1650=function(_0x13b01a,_0x53bd25){_0x13b01a=_0x13b01a-0x0;var _0x306a3d=_0x6501[_0x13b01a];return _0x306a3d;};'use strict';var multer=require(_0x1650('0x0'));var util=require('util');var path=require(_0x1650('0x1'));var timeout=require(_0x1650('0x2'));var express=require(_0x1650('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1650('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x1650('0x5')]('/',auth['isAuthenticated'](),controller[_0x1650('0x6')]);router[_0x1650('0x5')](_0x1650('0x7'),auth[_0x1650('0x8')](),controller[_0x1650('0x9')]);router[_0x1650('0x5')]('/:id/configurations',auth[_0x1650('0x8')](),controller[_0x1650('0xa')]);router[_0x1650('0x5')](_0x1650('0xb'),auth['isAuthenticated'](),controller[_0x1650('0xc')]);router[_0x1650('0xd')]('/',auth[_0x1650('0x8')](),controller[_0x1650('0xe')]);router[_0x1650('0xd')]('/:id/configurations',auth[_0x1650('0x8')](),controller[_0x1650('0xf')]);router[_0x1650('0x10')](_0x1650('0x7'),auth[_0x1650('0x8')](),controller[_0x1650('0x11')]);router['delete'](_0x1650('0x7'),auth[_0x1650('0x8')](),controller[_0x1650('0x12')]);module[_0x1650('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index baadb3b..dbb02d1 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 _0x398a=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x476c3a,_0x4a43e9){var _0xcede4f=function(_0x23d27d){while(--_0x23d27d){_0x476c3a['push'](_0x476c3a['shift']());}};_0xcede4f(++_0x4a43e9);}(_0x398a,0x11a));var _0xa398=function(_0x2ee34a,_0x2f6182){_0x2ee34a=_0x2ee34a-0x0;var _0x2f411f=_0x398a[_0x2ee34a];return _0x2f411f;};'use strict';var Sequelize=require(_0xa398('0x0'));module[_0xa398('0x1')]={'name':{'type':Sequelize[_0xa398('0x2')]},'description':{'type':Sequelize[_0xa398('0x2')]},'username':{'type':Sequelize[_0xa398('0x2')],'unique':_0xa398('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa398('0x4')},'authType':{'type':Sequelize[_0xa398('0x5')](_0xa398('0x6'),_0xa398('0x7')),'defaultValue':_0xa398('0x6')},'serverUrl':{'type':Sequelize[_0xa398('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa398('0x5')](_0xa398('0x8'),_0xa398('0x9')),'defaultValue':_0xa398('0x8')}}; \ No newline at end of file +var _0xd819=['exports','STRING','ENUM','password','token','integrationTab','newTab'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd819,0x181));var _0x9d81=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0xd819[_0x55fb83];return _0x59a87a;};'use strict';var Sequelize=require('sequelize');module[_0x9d81('0x0')]={'name':{'type':Sequelize[_0x9d81('0x1')]},'description':{'type':Sequelize[_0x9d81('0x1')]},'username':{'type':Sequelize[_0x9d81('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x9d81('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9d81('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x9d81('0x2')](_0x9d81('0x3'),_0x9d81('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x9d81('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9d81('0x2')](_0x9d81('0x5'),_0x9d81('0x6')),'defaultValue':_0x9d81('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7be6a15..c93bffe 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 _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x203e08,_0x15d5c5){var _0x3a0493=function(_0x272f51){while(--_0x272f51){_0x203e08['push'](_0x203e08['shift']());}};_0x3a0493(++_0x15d5c5);}(_0xae60,0x1c7));var _0x0ae6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xae60[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file +var _0x3266=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','merge','options','create','body','find','params','destroy','findOne','ZendeskConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','username','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','test','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x4775e3,_0x349b94){var _0x20be3f=function(_0x48b852){while(--_0x48b852){_0x4775e3['push'](_0x4775e3['shift']());}};_0x20be3f(++_0x349b94);}(_0x3266,0x6a));var _0x6326=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x3266[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];var integrations=require(_0x6326('0x1c'));function respondWithStatusCode(_0x5c07e1,_0x5381d0){_0x5381d0=_0x5381d0||0xcc;return function(_0x301f34){if(_0x301f34){return _0x5c07e1[_0x6326('0x1d')](_0x5381d0);}return _0x5c07e1['status'](_0x5381d0)[_0x6326('0x1e')]();};}function respondWithResult(_0x4caef3,_0x2d2d9b){_0x2d2d9b=_0x2d2d9b||0xc8;return function(_0x20dcc6){if(_0x20dcc6){return _0x4caef3[_0x6326('0x1f')](_0x2d2d9b)[_0x6326('0x20')](_0x20dcc6);}};}function respondWithFilteredResult(_0x1ed3a3,_0x2c1879){return function(_0x55923a){if(_0x55923a){var _0x1104c5=typeof _0x2c1879['offset']==='undefined'&&typeof _0x2c1879['limit']==='undefined';var _0x5d402d=_0x55923a['count'];var _0xdf5ced=_0x1104c5?0x0:_0x2c1879[_0x6326('0x21')];var _0x2be78e=_0x1104c5?_0x55923a['count']:_0x2c1879['offset']+_0x2c1879[_0x6326('0x22')];var _0x42319c;if(_0x2be78e>=_0x5d402d){_0x2be78e=_0x5d402d;_0x42319c=0xc8;}else{_0x42319c=0xce;}_0x1ed3a3[_0x6326('0x1f')](_0x42319c);return _0x1ed3a3[_0x6326('0x23')](_0x6326('0x24'),_0xdf5ced+'-'+_0x2be78e+'/'+_0x5d402d)[_0x6326('0x20')](_0x55923a);}return null;};}function patchUpdates(_0x21ee7d){return function(_0x53b437){try{jsonpatch[_0x6326('0x25')](_0x53b437,_0x21ee7d,!![]);}catch(_0x549f07){return BPromise[_0x6326('0x26')](_0x549f07);}return _0x53b437[_0x6326('0x27')]();};}function saveUpdates(_0x2482ef,_0x24fb78){return function(_0x43cdfc){if(_0x43cdfc){return _0x43cdfc[_0x6326('0x28')](_0x2482ef)[_0x6326('0x29')](function(_0x429bb0){return _0x429bb0;});}return null;};}function removeEntity(_0x4781cc,_0x2d0d00){return function(_0x34954b){if(_0x34954b){return _0x34954b['destroy']()[_0x6326('0x29')](function(){_0x4781cc[_0x6326('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e272b,_0x4d28fd){return function(_0x405474){if(!_0x405474){_0x4e272b['sendStatus'](0x194);}return _0x405474;};}function handleError(_0x33c466,_0x1a48da){_0x1a48da=_0x1a48da||0x1f4;return function(_0x5a907f){logger[_0x6326('0x2a')](_0x5a907f[_0x6326('0x2b')]);if(_0x5a907f[_0x6326('0x2c')]){delete _0x5a907f[_0x6326('0x2c')];}_0x33c466[_0x6326('0x1f')](_0x1a48da)[_0x6326('0x2d')](_0x5a907f);};}exports[_0x6326('0x2e')]=function(_0x27802c,_0x461e0f){var _0x127744={},_0x4980f6={},_0x2a8873={'count':0x0,'rows':[]};var _0x331772=_[_0x6326('0x2f')](db[_0x6326('0x30')][_0x6326('0x31')],function(_0x520e57){return{'name':_0x520e57[_0x6326('0x32')],'type':_0x520e57[_0x6326('0x33')][_0x6326('0x34')]};});_0x4980f6['model']=_[_0x6326('0x2f')](_0x331772,'name');_0x4980f6['query']=_[_0x6326('0x35')](_0x27802c[_0x6326('0x36')]);_0x4980f6[_0x6326('0x37')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],_0x4980f6[_0x6326('0x36')]);_0x127744[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x4980f6[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x27802c[_0x6326('0x36')][_0x6326('0x3b')]));_0x127744['attributes']=_0x127744[_0x6326('0x3a')][_0x6326('0x3c')]?_0x127744['attributes']:_0x4980f6[_0x6326('0x39')];if(!_0x27802c[_0x6326('0x36')][_0x6326('0x3d')]('nolimit')){_0x127744[_0x6326('0x22')]=qs['limit'](_0x27802c['query'][_0x6326('0x22')]);_0x127744[_0x6326('0x21')]=qs[_0x6326('0x21')](_0x27802c['query'][_0x6326('0x21')]);}_0x127744['order']=qs[_0x6326('0x3e')](_0x27802c['query'][_0x6326('0x3e')]);_0x127744[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0x27802c[_0x6326('0x36')],_0x4980f6[_0x6326('0x37')]),_0x331772);if(_0x27802c['query'][_0x6326('0x41')]){_0x127744[_0x6326('0x3f')]=_['merge'](_0x127744[_0x6326('0x3f')],{'$or':_['map'](_0x331772,function(_0x5607ea){if(_0x5607ea[_0x6326('0x33')]!==_0x6326('0x42')){var _0x3c170b={};_0x3c170b[_0x5607ea[_0x6326('0x2c')]]={'$like':'%'+_0x27802c[_0x6326('0x36')][_0x6326('0x41')]+'%'};return _0x3c170b;}})});}_0x127744=_['merge']({},_0x127744,_0x27802c['options']);var _0x32886f={'where':_0x127744['where']};return db[_0x6326('0x30')]['count'](_0x32886f)[_0x6326('0x29')](function(_0x517f6b){_0x2a8873[_0x6326('0x43')]=_0x517f6b;if(_0x27802c[_0x6326('0x36')][_0x6326('0x44')]){_0x127744[_0x6326('0x45')]=[{'all':!![]}];}return db[_0x6326('0x30')][_0x6326('0x46')](_0x127744);})[_0x6326('0x29')](function(_0x3998ba){_0x2a8873[_0x6326('0x47')]=_0x3998ba;return _0x2a8873;})['then'](respondWithFilteredResult(_0x461e0f,_0x127744))[_0x6326('0x48')](handleError(_0x461e0f,null));};exports['show']=function(_0x29f2fd,_0x1d9d4c){var _0x16fc33={'raw':![],'where':{'id':_0x29f2fd['params']['id']}},_0x50582a={};_0x50582a[_0x6326('0x39')]=_[_0x6326('0x35')](db['ZendeskAccount'][_0x6326('0x31')]);_0x50582a[_0x6326('0x36')]=_[_0x6326('0x35')](_0x29f2fd[_0x6326('0x36')]);_0x50582a['filters']=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],_0x50582a[_0x6326('0x36')]);_0x16fc33[_0x6326('0x3a')]=_[_0x6326('0x38')](_0x50582a[_0x6326('0x39')],qs[_0x6326('0x3b')](_0x29f2fd['query'][_0x6326('0x3b')]));_0x16fc33[_0x6326('0x3a')]=_0x16fc33[_0x6326('0x3a')][_0x6326('0x3c')]?_0x16fc33['attributes']:_0x50582a[_0x6326('0x39')];if(_0x29f2fd['query'][_0x6326('0x44')]){_0x16fc33[_0x6326('0x45')]=[{'all':!![]}];}_0x16fc33=_[_0x6326('0x49')]({},_0x16fc33,_0x29f2fd[_0x6326('0x4a')]);return db[_0x6326('0x30')]['find'](_0x16fc33)[_0x6326('0x29')](handleEntityNotFound(_0x1d9d4c,null))['then'](respondWithResult(_0x1d9d4c,null))['catch'](handleError(_0x1d9d4c,null));};exports[_0x6326('0x4b')]=function(_0x44cf9d,_0x5b14f4){return db[_0x6326('0x30')][_0x6326('0x4b')](_0x44cf9d[_0x6326('0x4c')],{})[_0x6326('0x29')](respondWithResult(_0x5b14f4,0xc9))[_0x6326('0x48')](handleError(_0x5b14f4,null));};exports['update']=function(_0x4af0ee,_0x2d82c0){if(_0x4af0ee[_0x6326('0x4c')]['id']){delete _0x4af0ee[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x4d')]({'where':{'id':_0x4af0ee[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x2d82c0,null))['then'](saveUpdates(_0x4af0ee[_0x6326('0x4c')],null))[_0x6326('0x29')](respondWithResult(_0x2d82c0,null))[_0x6326('0x48')](handleError(_0x2d82c0,null));};exports[_0x6326('0x4f')]=function(_0x1b5e9a,_0x4ff8e6){return db[_0x6326('0x30')]['find']({'where':{'id':_0x1b5e9a[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x4ff8e6,null))['then'](removeEntity(_0x4ff8e6,null))[_0x6326('0x48')](handleError(_0x4ff8e6,null));};exports['getConfigurations']=function(_0xaa4c9d,_0x202fd3,_0x2ee8df){var _0x35400e={};var _0x58731d={};var _0x42c8bc;var _0xbe6b3e;return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0xaa4c9d[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x202fd3,null))['then'](function(_0x2bece1){if(_0x2bece1){_0x42c8bc=_0x2bece1;_0x58731d[_0x6326('0x39')]=_['keys'](db[_0x6326('0x51')]['rawAttributes']);_0x58731d[_0x6326('0x36')]=_[_0x6326('0x35')](_0xaa4c9d[_0x6326('0x36')]);_0x58731d[_0x6326('0x37')]=_[_0x6326('0x38')](_0x58731d[_0x6326('0x39')],_0x58731d[_0x6326('0x36')]);_0x35400e['attributes']=_['intersection'](_0x58731d['model'],qs[_0x6326('0x3b')](_0xaa4c9d['query'][_0x6326('0x3b')]));_0x35400e[_0x6326('0x3a')]=_0x35400e[_0x6326('0x3a')][_0x6326('0x3c')]?_0x35400e[_0x6326('0x3a')]:_0x58731d['model'];_0x35400e[_0x6326('0x52')]=qs[_0x6326('0x3e')](_0xaa4c9d['query'][_0x6326('0x3e')]);_0x35400e[_0x6326('0x3f')]=qs[_0x6326('0x37')](_[_0x6326('0x40')](_0xaa4c9d[_0x6326('0x36')],_0x58731d[_0x6326('0x37')]));if(_0xaa4c9d[_0x6326('0x36')][_0x6326('0x41')]){_0x35400e[_0x6326('0x3f')]=_[_0x6326('0x49')](_0x35400e['where'],{'$or':_[_0x6326('0x2f')](_0x35400e[_0x6326('0x3a')],function(_0x3fc712){var _0x92f535={};_0x92f535[_0x3fc712]={'$like':'%'+_0xaa4c9d['query']['filter']+'%'};return _0x92f535;})});}_0x35400e=_[_0x6326('0x49')]({},_0x35400e,_0xaa4c9d[_0x6326('0x4a')]);return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})[_0x6326('0x29')](function(_0x3ac39d){if(_0x3ac39d){_0xbe6b3e=_0x3ac39d['length'];if(!_0xaa4c9d['query'][_0x6326('0x3d')](_0x6326('0x54'))){_0x35400e[_0x6326('0x22')]=qs[_0x6326('0x22')](_0xaa4c9d['query'][_0x6326('0x22')]);_0x35400e[_0x6326('0x21')]=qs[_0x6326('0x21')](_0xaa4c9d[_0x6326('0x36')][_0x6326('0x21')]);}return _0x42c8bc[_0x6326('0x53')](_0x35400e);}})['then'](function(_0x2bc08a){if(_0x2bc08a){return _0x2bc08a?{'count':_0xbe6b3e,'rows':_0x2bc08a}:null;}})['then'](respondWithResult(_0x202fd3,null))[_0x6326('0x48')](handleError(_0x202fd3,null));};exports[_0x6326('0x55')]=function(_0x57dfde,_0x14d66c,_0x56fb58){if(_0x57dfde[_0x6326('0x4c')]['id']){delete _0x57dfde[_0x6326('0x4c')]['id'];}return db[_0x6326('0x30')][_0x6326('0x50')]({'where':{'id':_0x57dfde[_0x6326('0x4e')]['id']}})[_0x6326('0x29')](handleEntityNotFound(_0x14d66c,null))[_0x6326('0x29')](function(_0x3f5e2e){if(_0x3f5e2e){_0x57dfde['body'][_0x6326('0x56')]=_0x3f5e2e['id'];_0x57dfde[_0x6326('0x4c')][_0x6326('0x57')]=integrations[_0x6326('0x58')](_0x57dfde[_0x6326('0x4c')]['channel'],_0x57dfde[_0x6326('0x4c')][_0x6326('0x33')]);_0x57dfde[_0x6326('0x4c')][_0x6326('0x59')]=integrations[_0x6326('0x5a')](_0x57dfde['body'][_0x6326('0x5b')],_0x57dfde['body']['type']);return db[_0x6326('0x51')][_0x6326('0x4b')](_0x57dfde[_0x6326('0x4c')],{'include':[{'model':db[_0x6326('0x5c')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x14d66c,null))[_0x6326('0x48')](handleError(_0x14d66c,null));};exports['getFields']=function(_0x303fef,_0x5f6273,_0x54730e){var _0x4c1d7e='';return db['ZendeskAccount'][_0x6326('0x50')]({'where':{'id':_0x303fef['params']['id']},'attributes':['id',_0x6326('0x5d'),'password','token','authType','remoteUri']})[_0x6326('0x29')](handleEntityNotFound(_0x5f6273,null))['then'](function(_0xe2e249){if(_0xe2e249){_0x4c1d7e=_0xe2e249[_0x6326('0x5e')];var _0x50a1dc=_0x4c1d7e[_0x6326('0x5f')](-0x1);if(_0x50a1dc==='/'){_0x4c1d7e=_0x4c1d7e['substring'](0x0,_0x4c1d7e[_0x6326('0x60')](_0x50a1dc));}var _0x1dda23={'method':_0x6326('0x61'),'uri':util[_0x6326('0x62')](_0x6326('0x63'),_0x4c1d7e,_0x6326('0x64')),'json':!![]};switch(_0xe2e249[_0x6326('0x65')]){case _0x6326('0x66'):_0x1dda23[_0x6326('0x67')]={'Authorization':util[_0x6326('0x62')](_0x6326('0x68'),new Buffer(util[_0x6326('0x62')](_0x6326('0x69'),_0xe2e249[_0x6326('0x5d')],_0xe2e249[_0x6326('0x66')]))[_0x6326('0x6a')](_0x6326('0x6b')))};break;case'token':_0x1dda23['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6326('0x62')]('%s/token:%s',_0xe2e249['username'],_0xe2e249['token']))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x6326('0x6c'))](_0x6326('0x6d'));}return rp(_0x1dda23);}})['then'](function(_0x3b4bca){if(_0x3b4bca){var _0x2bfc43=[_0x6326('0x6e'),'description',_0x6326('0x6f'),_0x6326('0x70')];_[_0x6326('0x71')](_0x3b4bca[_0x6326('0x64')],function(_0x3e9477){return _0x2bfc43['includes'](_0x3e9477[_0x6326('0x33')]);});return{'count':_0x3b4bca['ticket_fields']['length'],'rows':_[_0x6326('0x2f')](_0x3b4bca['ticket_fields'],function(_0x57c845){return{'id':_0x57c845['id'],'name':_0x57c845['position']>0x7?_0x57c845['title']:_0x57c845['type'],'custom':_0x57c845['position']>0x7?!![]:![],'options':_0x57c845['system_field_options']?_0x57c845[_0x6326('0x72')]:_0x57c845[_0x6326('0x73')]?_0x57c845[_0x6326('0x73')]:[]};})};}})[_0x6326('0x29')](respondWithResult(_0x5f6273,null))['catch'](function(_0x484866){var _0x4b61c4=_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?0x1f4:_0x484866['statusCode']||0x1f4;logger[_0x6326('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4b61c4,JSON[_0x6326('0x75')](_0x484866));delete _0x484866[_0x6326('0x2c')];if(_0x4b61c4===0x191){_0x4b61c4=0x190;}_0x5f6273[_0x6326('0x1f')](_0x4b61c4)[_0x6326('0x2d')](_0x303fef[_0x6326('0x36')][_0x6326('0x74')]?{'message':_0x6326('0x76'),'statusCode':_0x484866['statusCode']}:_0x484866);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3b14413..e2e7a4d 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 _0x2180=['moment','bluebird','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x2ed0e6,_0x3ebd8b){var _0x4c53ef=function(_0x21972a){while(--_0x21972a){_0x2ed0e6['push'](_0x2ed0e6['shift']());}};_0x4c53ef(++_0x3ebd8b);}(_0x2180,0x110));var _0x0218=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x2180[_0x483ab9];return _0x35043b;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var logger=require(_0x0218('0x2'))(_0x0218('0x3'));var moment=require(_0x0218('0x4'));var BPromise=require(_0x0218('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0218('0x6'));var attributes=require(_0x0218('0x7'));var integrations=require(_0x0218('0x8'));module[_0x0218('0x9')]=function(_0x15c317,_0x510a0e){return _0x15c317['define'](_0x0218('0xa'),attributes,{'tableName':_0x0218('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62f6=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','util','../../config/logger','api'];(function(_0x1c0b24,_0x51c44f){var _0xb918c4=function(_0x58120e){while(--_0x58120e){_0x1c0b24['push'](_0x1c0b24['shift']());}};_0xb918c4(++_0x51c44f);}(_0x62f6,0x1d1));var _0x662f=function(_0x270024,_0x24f412){_0x270024=_0x270024-0x0;var _0x52c839=_0x62f6[_0x270024];return _0x52c839;};'use strict';var _=require('lodash');var util=require(_0x662f('0x0'));var logger=require(_0x662f('0x1'))(_0x662f('0x2'));var moment=require(_0x662f('0x3'));var BPromise=require('bluebird');var rp=require(_0x662f('0x4'));var fs=require('fs');var path=require(_0x662f('0x5'));var rimraf=require(_0x662f('0x6'));var config=require(_0x662f('0x7'));var attributes=require(_0x662f('0x8'));var integrations=require(_0x662f('0x9'));module[_0x662f('0xa')]=function(_0x284d4d,_0x2a43e1){return _0x284d4d[_0x662f('0xb')]('ZendeskAccount',attributes,{'tableName':_0x662f('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 4822640..b96d796 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 _0xda55=['where','attributes','limit','include','map','model','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw'];(function(_0x266e57,_0x41125b){var _0x4cdc1d=function(_0x3d3734){while(--_0x3d3734){_0x266e57['push'](_0x266e57['shift']());}};_0x4cdc1d(++_0x41125b);}(_0xda55,0x157));var _0x5da5=function(_0xa73aa,_0x4e1e22){_0xa73aa=_0xa73aa-0x0;var _0x2e8881=_0xda55[_0xa73aa];return _0x2e8881;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require(_0x5da5('0x2'));var rs=require(_0x5da5('0x3'));var fs=require('fs');var Redis=require(_0x5da5('0x4'));var db=require(_0x5da5('0x5'))['db'];var utils=require(_0x5da5('0x6'));var logger=require(_0x5da5('0x7'))(_0x5da5('0x8'));var config=require('../../config/environment');var jayson=require(_0x5da5('0x9'));var client=jayson['client'][_0x5da5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4ca0,_0x3c7898,_0x221d6d){return new BPromise(function(_0x5550b5,_0x1ddbed){return client[_0x5da5('0xb')](_0x3f4ca0,_0x221d6d)[_0x5da5('0xc')](function(_0x306ece){logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x3c7898,'request\x20sent');logger['debug'](_0x5da5('0xf'),_0x3c7898,_0x5da5('0x10'),JSON[_0x5da5('0x11')](_0x306ece));if(_0x306ece[_0x5da5('0x12')]){if(_0x306ece[_0x5da5('0x12')][_0x5da5('0x13')]===0x1f4){logger[_0x5da5('0x12')](_0x5da5('0xe'),_0x3c7898,_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);return _0x1ddbed(_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);}logger['error'](_0x5da5('0xe'),_0x3c7898,_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);return _0x5550b5(_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);}else{logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x3c7898,'request\x20sent');_0x5550b5(_0x306ece[_0x5da5('0x15')][_0x5da5('0x14')]);}})[_0x5da5('0x16')](function(_0x4103c1){logger[_0x5da5('0x12')](_0x5da5('0xe'),_0x3c7898,_0x4103c1);_0x1ddbed(_0x4103c1);});});}exports[_0x5da5('0x17')]=function(_0xe6da6a){var _0x18a81d=this;return new Promise(function(_0xeb35f1,_0x4f8f4b){return db['ZendeskAccount'][_0x5da5('0x18')]({'raw':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1b')]||null:null,'attributes':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1c')]||null:null,'limit':_0xe6da6a['options']?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1d')]||null:null,'include':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0xe6da6a[_0x5da5('0x19')]['include'],function(_0x902ffc){return{'model':db[_0x902ffc[_0x5da5('0x20')]],'as':_0x902ffc['as'],'attributes':_0x902ffc[_0x5da5('0x1c')],'include':_0x902ffc[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x902ffc[_0x5da5('0x1e')],function(_0x23734a){return{'model':db[_0x23734a[_0x5da5('0x20')]],'as':_0x23734a['as'],'attributes':_0x23734a[_0x5da5('0x1c')],'include':_0x23734a[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x23734a['include'],function(_0x44749a){return{'model':db[_0x44749a['model']],'as':_0x44749a['as'],'attributes':_0x44749a[_0x5da5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5da5('0xc')](function(_0x15b3e3){logger[_0x5da5('0xd')]('GetZendeskAccount',_0xe6da6a);logger[_0x5da5('0x21')](_0x5da5('0x17'),_0xe6da6a,JSON[_0x5da5('0x11')](_0x15b3e3));_0xeb35f1(_0x15b3e3);})['catch'](function(_0x4e1fee){logger[_0x5da5('0x12')]('GetZendeskAccount',_0x4e1fee[_0x5da5('0x14')],_0xe6da6a);_0x4f8f4b(_0x18a81d[_0x5da5('0x12')](0x1f4,_0x4e1fee[_0x5da5('0x14')]));});});};exports[_0x5da5('0x22')]=function(_0x3b9447){var _0x382fa9=this;return new Promise(function(_0x288fbf,_0x420c63){return db[_0x5da5('0x23')][_0x5da5('0x24')]({'raw':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')]['where']||null:null,'attributes':_0x3b9447['options']?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1c')]||null:null,'include':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x3b9447['options'][_0x5da5('0x1e')],function(_0x41d13e){return{'model':db[_0x41d13e['model']],'as':_0x41d13e['as'],'attributes':_0x41d13e[_0x5da5('0x1c')],'include':_0x41d13e[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x41d13e[_0x5da5('0x1e')],function(_0x1bceeb){return{'model':db[_0x1bceeb[_0x5da5('0x20')]],'as':_0x1bceeb['as'],'attributes':_0x1bceeb[_0x5da5('0x1c')],'include':_0x1bceeb['include']?_[_0x5da5('0x1f')](_0x1bceeb[_0x5da5('0x1e')],function(_0x5d5840){return{'model':db[_0x5d5840[_0x5da5('0x20')]],'as':_0x5d5840['as'],'attributes':_0x5d5840['attributes']};}):[]};}):[]};}):[]:[]})[_0x5da5('0xc')](function(_0xcac534){logger[_0x5da5('0xd')](_0x5da5('0x22'),_0x3b9447);logger[_0x5da5('0x21')](_0x5da5('0x22'),_0x3b9447,JSON[_0x5da5('0x11')](_0xcac534));_0x288fbf(_0xcac534);})[_0x5da5('0x16')](function(_0x32ea26){logger[_0x5da5('0x12')](_0x5da5('0x22'),_0x32ea26[_0x5da5('0x14')],_0x3b9447);_0x420c63(_0x382fa9[_0x5da5('0x12')](0x1f4,_0x32ea26['message']));});});}; \ No newline at end of file +var _0x1fcf=['ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','stringify','catch'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x1fcf,0x145));var _0xf1fc=function(_0x5730ee,_0x3c82f3){_0x5730ee=_0x5730ee-0x0;var _0x43aa14=_0x1fcf[_0x5730ee];return _0x43aa14;};'use strict';var _=require(_0xf1fc('0x0'));var util=require(_0xf1fc('0x1'));var moment=require(_0xf1fc('0x2'));var BPromise=require(_0xf1fc('0x3'));var rs=require(_0xf1fc('0x4'));var fs=require('fs');var Redis=require(_0xf1fc('0x5'));var db=require(_0xf1fc('0x6'))['db'];var utils=require(_0xf1fc('0x7'));var logger=require(_0xf1fc('0x8'))(_0xf1fc('0x9'));var config=require(_0xf1fc('0xa'));var jayson=require(_0xf1fc('0xb'));var client=jayson['client'][_0xf1fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39f36d,_0x12bf41,_0x58fe38){return new BPromise(function(_0x59d862,_0x1448b8){return client['request'](_0x39f36d,_0x58fe38)[_0xf1fc('0xd')](function(_0x140096){logger[_0xf1fc('0xe')](_0xf1fc('0xf'),_0x12bf41,_0xf1fc('0x10'));logger[_0xf1fc('0x11')](_0xf1fc('0x12'),_0x12bf41,'request\x20sent',JSON['stringify'](_0x140096));if(_0x140096[_0xf1fc('0x13')]){if(_0x140096['error']['code']===0x1f4){logger[_0xf1fc('0x13')](_0xf1fc('0xf'),_0x12bf41,_0x140096['error'][_0xf1fc('0x14')]);return _0x1448b8(_0x140096['error'][_0xf1fc('0x14')]);}logger[_0xf1fc('0x13')](_0xf1fc('0xf'),_0x12bf41,_0x140096['error'][_0xf1fc('0x14')]);return _0x59d862(_0x140096[_0xf1fc('0x13')]['message']);}else{logger[_0xf1fc('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x12bf41,_0xf1fc('0x10'));_0x59d862(_0x140096[_0xf1fc('0x15')][_0xf1fc('0x14')]);}})['catch'](function(_0x5c8cf2){logger[_0xf1fc('0x13')](_0xf1fc('0xf'),_0x12bf41,_0x5c8cf2);_0x1448b8(_0x5c8cf2);});});}exports['GetZendeskAccount']=function(_0x3e51d2){var _0x4bc4b5=this;return new Promise(function(_0x4e6d69,_0x31748c){return db[_0xf1fc('0x16')][_0xf1fc('0x17')]({'raw':_0x3e51d2[_0xf1fc('0x18')]?_0x3e51d2[_0xf1fc('0x18')][_0xf1fc('0x19')]===undefined?!![]:![]:!![],'where':_0x3e51d2[_0xf1fc('0x18')]?_0x3e51d2[_0xf1fc('0x18')][_0xf1fc('0x1a')]||null:null,'attributes':_0x3e51d2['options']?_0x3e51d2[_0xf1fc('0x18')][_0xf1fc('0x1b')]||null:null,'limit':_0x3e51d2[_0xf1fc('0x18')]?_0x3e51d2['options'][_0xf1fc('0x1c')]||null:null,'include':_0x3e51d2['options']?_0x3e51d2[_0xf1fc('0x18')][_0xf1fc('0x1d')]?_[_0xf1fc('0x1e')](_0x3e51d2[_0xf1fc('0x18')][_0xf1fc('0x1d')],function(_0x313cd0){return{'model':db[_0x313cd0['model']],'as':_0x313cd0['as'],'attributes':_0x313cd0[_0xf1fc('0x1b')],'include':_0x313cd0['include']?_[_0xf1fc('0x1e')](_0x313cd0[_0xf1fc('0x1d')],function(_0x8e9e48){return{'model':db[_0x8e9e48[_0xf1fc('0x1f')]],'as':_0x8e9e48['as'],'attributes':_0x8e9e48[_0xf1fc('0x1b')],'include':_0x8e9e48[_0xf1fc('0x1d')]?_[_0xf1fc('0x1e')](_0x8e9e48[_0xf1fc('0x1d')],function(_0x372212){return{'model':db[_0x372212[_0xf1fc('0x1f')]],'as':_0x372212['as'],'attributes':_0x372212[_0xf1fc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41d2d4){logger[_0xf1fc('0xe')](_0xf1fc('0x20'),_0x3e51d2);logger[_0xf1fc('0x11')](_0xf1fc('0x20'),_0x3e51d2,JSON[_0xf1fc('0x21')](_0x41d2d4));_0x4e6d69(_0x41d2d4);})[_0xf1fc('0x22')](function(_0x582f07){logger['error']('GetZendeskAccount',_0x582f07[_0xf1fc('0x14')],_0x3e51d2);_0x31748c(_0x4bc4b5[_0xf1fc('0x13')](0x1f4,_0x582f07[_0xf1fc('0x14')]));});});};exports[_0xf1fc('0x23')]=function(_0x52afcc){var _0x2db20a=this;return new Promise(function(_0x109452,_0x53977f){return db[_0xf1fc('0x16')]['find']({'raw':_0x52afcc['options']?_0x52afcc[_0xf1fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52afcc[_0xf1fc('0x18')]?_0x52afcc[_0xf1fc('0x18')][_0xf1fc('0x1a')]||null:null,'attributes':_0x52afcc[_0xf1fc('0x18')]?_0x52afcc['options']['attributes']||null:null,'include':_0x52afcc['options']?_0x52afcc[_0xf1fc('0x18')]['include']?_['map'](_0x52afcc[_0xf1fc('0x18')]['include'],function(_0x41314d){return{'model':db[_0x41314d[_0xf1fc('0x1f')]],'as':_0x41314d['as'],'attributes':_0x41314d['attributes'],'include':_0x41314d[_0xf1fc('0x1d')]?_['map'](_0x41314d[_0xf1fc('0x1d')],function(_0x365e69){return{'model':db[_0x365e69[_0xf1fc('0x1f')]],'as':_0x365e69['as'],'attributes':_0x365e69[_0xf1fc('0x1b')],'include':_0x365e69['include']?_[_0xf1fc('0x1e')](_0x365e69[_0xf1fc('0x1d')],function(_0x1c60a0){return{'model':db[_0x1c60a0['model']],'as':_0x1c60a0['as'],'attributes':_0x1c60a0[_0xf1fc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109c6f){logger[_0xf1fc('0xe')](_0xf1fc('0x23'),_0x52afcc);logger[_0xf1fc('0x11')](_0xf1fc('0x23'),_0x52afcc,JSON[_0xf1fc('0x21')](_0x109c6f));_0x109452(_0x109c6f);})['catch'](function(_0x4685ca){logger[_0xf1fc('0x13')](_0xf1fc('0x23'),_0x4685ca['message'],_0x52afcc);_0x53977f(_0x2db20a['error'](0x1f4,_0x4685ca['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 37ac7e3..0049ccd 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x50079e,_0x2fd209){var _0x449e0e=function(_0x3638a7){while(--_0x3638a7){_0x50079e['push'](_0x50079e['shift']());}};_0x449e0e(++_0x2fd209);}(_0xa571,0x107));var _0x1a57=function(_0xdb45f5,_0x145dc1){_0xdb45f5=_0xdb45f5-0x0;var _0x14e689=_0xa571[_0xdb45f5];return _0x14e689;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x5e3fd1,_0x278b89){var _0x541754=function(_0x28a4b3){while(--_0x28a4b3){_0x5e3fd1['push'](_0x5e3fd1['shift']());}};_0x541754(++_0x278b89);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xb10b[_0x4ec9e3];return _0x2883ce;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f618c59..900008c 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 _0x32f3=['STRING'];(function(_0x17e315,_0x361db6){var _0x3e7afb=function(_0x830a5f){while(--_0x830a5f){_0x17e315['push'](_0x17e315['shift']());}};_0x3e7afb(++_0x361db6);}(_0x32f3,0xf1));var _0x332f=function(_0x460d75,_0x21fffa){_0x460d75=_0x460d75-0x0;var _0x131403=_0x32f3[_0x460d75];return _0x131403;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x332f('0x0')]},'description':{'type':Sequelize[_0x332f('0x0')]}}; \ No newline at end of file +var _0xeb8c=['STRING','sequelize','exports'];(function(_0x3d86a4,_0x1d8110){var _0x54e057=function(_0x27e253){while(--_0x27e253){_0x3d86a4['push'](_0x3d86a4['shift']());}};_0x54e057(++_0x1d8110);}(_0xeb8c,0xd9));var _0xceb8=function(_0xc32aef,_0x687f32){_0xc32aef=_0xc32aef-0x0;var _0x18bfe1=_0xeb8c[_0xc32aef];return _0x18bfe1;};'use strict';var Sequelize=require(_0xceb8('0x0'));module[_0xceb8('0x1')]={'name':{'type':Sequelize[_0xceb8('0x2')]},'description':{'type':Sequelize[_0xceb8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5379daf..94ab4a8 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 _0xa2ea=['body','params','getFields','findOne','hasOwnProperty','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','apply','save','update','then','destroy','end','error','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','length','includeAll','find'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa2ea,0x1a1));var _0xaa2e=function(_0xc0f3d0,_0x4cfe98){_0xc0f3d0=_0xc0f3d0-0x0;var _0x1798ba=_0xa2ea[_0xc0f3d0];return _0x1798ba;};'use strict';var emlformat=require(_0xaa2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa2e('0x1'));var jsonpatch=require(_0xaa2e('0x2'));var rp=require(_0xaa2e('0x3'));var moment=require('moment');var BPromise=require(_0xaa2e('0x4'));var Mustache=require(_0xaa2e('0x5'));var util=require(_0xaa2e('0x6'));var path=require(_0xaa2e('0x7'));var sox=require(_0xaa2e('0x8'));var csv=require(_0xaa2e('0x9'));var ejs=require(_0xaa2e('0xa'));var fs=require('fs');var fs_extra=require(_0xaa2e('0xb'));var _=require(_0xaa2e('0xc'));var squel=require(_0xaa2e('0xd'));var crypto=require(_0xaa2e('0xe'));var jsforce=require(_0xaa2e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaa2e('0x9'));var querystring=require(_0xaa2e('0x10'));var Papa=require(_0xaa2e('0x11'));var Redis=require(_0xaa2e('0x12'));var authService=require(_0xaa2e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa2e('0x14'));var hardwareService=require(_0xaa2e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xaa2e('0x16'));var config=require(_0xaa2e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa2e('0x18'))['db'];function respondWithStatusCode(_0x118d81,_0xc8957){_0xc8957=_0xc8957||0xcc;return function(_0x4dffb1){if(_0x4dffb1){return _0x118d81[_0xaa2e('0x19')](_0xc8957);}return _0x118d81[_0xaa2e('0x1a')](_0xc8957)['end']();};}function respondWithResult(_0xd1d164,_0x44d806){_0x44d806=_0x44d806||0xc8;return function(_0x4fff63){if(_0x4fff63){return _0xd1d164[_0xaa2e('0x1a')](_0x44d806)['json'](_0x4fff63);}};}function respondWithFilteredResult(_0x5b5016,_0x44b635){return function(_0x472677){if(_0x472677){var _0x428f28=typeof _0x44b635[_0xaa2e('0x1b')]===_0xaa2e('0x1c')&&typeof _0x44b635[_0xaa2e('0x1d')]===_0xaa2e('0x1c');var _0x1f88e1=_0x472677[_0xaa2e('0x1e')];var _0x2a849a=_0x428f28?0x0:_0x44b635[_0xaa2e('0x1b')];var _0x49cdde=_0x428f28?_0x472677[_0xaa2e('0x1e')]:_0x44b635[_0xaa2e('0x1b')]+_0x44b635[_0xaa2e('0x1d')];var _0xb344aa;if(_0x49cdde>=_0x1f88e1){_0x49cdde=_0x1f88e1;_0xb344aa=0xc8;}else{_0xb344aa=0xce;}_0x5b5016['status'](_0xb344aa);return _0x5b5016['set']('Content-Range',_0x2a849a+'-'+_0x49cdde+'/'+_0x1f88e1)['json'](_0x472677);}return null;};}function patchUpdates(_0x468d07){return function(_0x139845){try{jsonpatch[_0xaa2e('0x1f')](_0x139845,_0x468d07,!![]);}catch(_0x361e18){return BPromise['reject'](_0x361e18);}return _0x139845[_0xaa2e('0x20')]();};}function saveUpdates(_0x31f2c4,_0x4acd4b){return function(_0x304f33){if(_0x304f33){return _0x304f33[_0xaa2e('0x21')](_0x31f2c4)[_0xaa2e('0x22')](function(_0x2e9161){return _0x2e9161;});}return null;};}function removeEntity(_0x58ce44,_0x55056e){return function(_0x26fcc2){if(_0x26fcc2){return _0x26fcc2[_0xaa2e('0x23')]()[_0xaa2e('0x22')](function(){_0x58ce44[_0xaa2e('0x1a')](0xcc)[_0xaa2e('0x24')]();});}};}function handleEntityNotFound(_0x155ee1,_0x12f08a){return function(_0xa521f6){if(!_0xa521f6){_0x155ee1['sendStatus'](0x194);}return _0xa521f6;};}function handleError(_0x568f3a,_0x55b34a){_0x55b34a=_0x55b34a||0x1f4;return function(_0x2cf5b){logger[_0xaa2e('0x25')](_0x2cf5b['stack']);if(_0x2cf5b[_0xaa2e('0x26')]){delete _0x2cf5b['name'];}_0x568f3a[_0xaa2e('0x1a')](_0x55b34a)[_0xaa2e('0x27')](_0x2cf5b);};}exports['index']=function(_0x3dca87,_0x4f032f){var _0x173b97={},_0x47974d={},_0x3677f3={'count':0x0,'rows':[]};var _0x129ae0=_[_0xaa2e('0x28')](db[_0xaa2e('0x29')][_0xaa2e('0x2a')],function(_0x5f9796){return{'name':_0x5f9796[_0xaa2e('0x2b')],'type':_0x5f9796['type'][_0xaa2e('0x2c')]};});_0x47974d['model']=_[_0xaa2e('0x28')](_0x129ae0,_0xaa2e('0x26'));_0x47974d[_0xaa2e('0x2d')]=_[_0xaa2e('0x2e')](_0x3dca87[_0xaa2e('0x2d')]);_0x47974d[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x47974d[_0xaa2e('0x31')],_0x47974d[_0xaa2e('0x2d')]);_0x173b97[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x47974d[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x3dca87['query'][_0xaa2e('0x33')]));_0x173b97[_0xaa2e('0x32')]=_0x173b97[_0xaa2e('0x32')]['length']?_0x173b97[_0xaa2e('0x32')]:_0x47974d['model'];if(!_0x3dca87['query']['hasOwnProperty'](_0xaa2e('0x34'))){_0x173b97['limit']=qs[_0xaa2e('0x1d')](_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x1d')]);_0x173b97[_0xaa2e('0x1b')]=qs['offset'](_0x3dca87['query']['offset']);}_0x173b97[_0xaa2e('0x35')]=qs[_0xaa2e('0x36')](_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x173b97[_0xaa2e('0x37')]=qs[_0xaa2e('0x2f')](_[_0xaa2e('0x38')](_0x3dca87[_0xaa2e('0x2d')],_0x47974d[_0xaa2e('0x2f')]),_0x129ae0);if(_0x3dca87['query']['filter']){_0x173b97[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x173b97[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x129ae0,function(_0x3a940b){if(_0x3a940b[_0xaa2e('0x3a')]!==_0xaa2e('0x3b')){var _0x266f6b={};_0x266f6b[_0x3a940b['name']]={'$like':'%'+_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x266f6b;}})});}_0x173b97=_[_0xaa2e('0x39')]({},_0x173b97,_0x3dca87[_0xaa2e('0x3d')]);var _0x666e3b={'where':_0x173b97[_0xaa2e('0x37')]};return db['ZendeskConfiguration'][_0xaa2e('0x1e')](_0x666e3b)[_0xaa2e('0x22')](function(_0x15cd85){_0x3677f3[_0xaa2e('0x1e')]=_0x15cd85;if(_0x3dca87[_0xaa2e('0x2d')]['includeAll']){_0x173b97[_0xaa2e('0x3e')]=[{'all':!![]}];}return db[_0xaa2e('0x29')][_0xaa2e('0x3f')](_0x173b97);})['then'](function(_0x19d2fe){_0x3677f3[_0xaa2e('0x40')]=_0x19d2fe;return _0x3677f3;})[_0xaa2e('0x22')](respondWithFilteredResult(_0x4f032f,_0x173b97))[_0xaa2e('0x41')](handleError(_0x4f032f,null));};exports['show']=function(_0x54178f,_0x4d531a){var _0x110097={'raw':![],'where':{'id':_0x54178f['params']['id']}},_0x27f034={};_0x27f034['model']=_['keys'](db[_0xaa2e('0x29')][_0xaa2e('0x2a')]);_0x27f034['query']=_[_0xaa2e('0x2e')](_0x54178f[_0xaa2e('0x2d')]);_0x27f034[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x27f034[_0xaa2e('0x31')],_0x27f034['query']);_0x110097[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x27f034['model'],qs[_0xaa2e('0x33')](_0x54178f['query']['fields']));_0x110097[_0xaa2e('0x32')]=_0x110097[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x110097[_0xaa2e('0x32')]:_0x27f034[_0xaa2e('0x31')];if(_0x54178f[_0xaa2e('0x2d')][_0xaa2e('0x43')]){_0x110097['include']=[{'all':!![]}];}_0x110097=_[_0xaa2e('0x39')]({},_0x110097,_0x54178f['options']);return db[_0xaa2e('0x29')][_0xaa2e('0x44')](_0x110097)['then'](handleEntityNotFound(_0x4d531a,null))[_0xaa2e('0x22')](respondWithResult(_0x4d531a,null))['catch'](handleError(_0x4d531a,null));};exports['create']=function(_0x1abc54,_0x5c5eaa){return db[_0xaa2e('0x29')]['create'](_0x1abc54[_0xaa2e('0x45')],{})[_0xaa2e('0x22')](respondWithResult(_0x5c5eaa,0xc9))['catch'](handleError(_0x5c5eaa,null));};exports[_0xaa2e('0x21')]=function(_0x4dd560,_0x3ec765){if(_0x4dd560[_0xaa2e('0x45')]['id']){delete _0x4dd560[_0xaa2e('0x45')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x4dd560[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x3ec765,null))['then'](saveUpdates(_0x4dd560['body'],null))[_0xaa2e('0x22')](respondWithResult(_0x3ec765,null))[_0xaa2e('0x41')](handleError(_0x3ec765,null));};exports['destroy']=function(_0x566e61,_0x451e9b){return db[_0xaa2e('0x29')][_0xaa2e('0x44')]({'where':{'id':_0x566e61[_0xaa2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x451e9b,null))[_0xaa2e('0x22')](removeEntity(_0x451e9b,null))[_0xaa2e('0x41')](handleError(_0x451e9b,null));};exports[_0xaa2e('0x47')]=function(_0x482900,_0x1f1cba,_0x59a8f4){var _0x50014e={};var _0x34ddd5={};var _0x49a8c6;var _0x4784aa;return db['ZendeskConfiguration'][_0xaa2e('0x48')]({'where':{'id':_0x482900[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x1f1cba,null))[_0xaa2e('0x22')](function(_0x3508dc){if(_0x3508dc){_0x49a8c6=_0x3508dc;_0x34ddd5['model']=_['keys'](db['ZendeskField'][_0xaa2e('0x2a')]);_0x34ddd5['query']=_[_0xaa2e('0x2e')](_0x482900[_0xaa2e('0x2d')]);_0x34ddd5[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x34ddd5[_0xaa2e('0x31')],_0x34ddd5[_0xaa2e('0x2d')]);_0x50014e['attributes']=_['intersection'](_0x34ddd5[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x50014e[_0xaa2e('0x32')]=_0x50014e[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x50014e['attributes']:_0x34ddd5['model'];_0x50014e[_0xaa2e('0x35')]=qs['sort'](_0x482900['query'][_0xaa2e('0x36')]);_0x50014e[_0xaa2e('0x37')]=qs['filters'](_[_0xaa2e('0x38')](_0x482900[_0xaa2e('0x2d')],_0x34ddd5[_0xaa2e('0x2f')]));if(_0x482900[_0xaa2e('0x2d')]['filter']){_0x50014e[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x50014e[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x50014e[_0xaa2e('0x32')],function(_0x59f883){var _0x222a65={};_0x222a65[_0x59f883]={'$like':'%'+_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x222a65;})});}_0x50014e=_['merge']({},_0x50014e,_0x482900[_0xaa2e('0x3d')]);return _0x49a8c6[_0xaa2e('0x47')](_0x50014e);}})['then'](function(_0x3f59a0){if(_0x3f59a0){_0x4784aa=_0x3f59a0[_0xaa2e('0x42')];if(!_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x50014e[_0xaa2e('0x1d')]=qs[_0xaa2e('0x1d')](_0x482900['query'][_0xaa2e('0x1d')]);_0x50014e['offset']=qs[_0xaa2e('0x1b')](_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x1b')]);}return _0x49a8c6['getFields'](_0x50014e);}})[_0xaa2e('0x22')](function(_0x1d776f){if(_0x1d776f){return _0x1d776f?{'count':_0x4784aa,'rows':_0x1d776f}:null;}})[_0xaa2e('0x22')](respondWithResult(_0x1f1cba,null))['catch'](handleError(_0x1f1cba,null));};exports['getSubjects']=function(_0x23599b,_0x188e5d,_0x2f5c66){var _0xcb4468={};var _0x598ccd={};var _0x258528;var _0x20350e;return db[_0xaa2e('0x29')][_0xaa2e('0x48')]({'where':{'id':_0x23599b[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x188e5d,null))[_0xaa2e('0x22')](function(_0x5a9345){if(_0x5a9345){_0x258528=_0x5a9345;_0x598ccd[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db[_0xaa2e('0x4a')][_0xaa2e('0x2a')]);_0x598ccd[_0xaa2e('0x2d')]=_['keys'](_0x23599b[_0xaa2e('0x2d')]);_0x598ccd[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x598ccd[_0xaa2e('0x31')],_0x598ccd[_0xaa2e('0x2d')]);_0xcb4468[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x598ccd['model'],qs[_0xaa2e('0x33')](_0x23599b['query'][_0xaa2e('0x33')]));_0xcb4468['attributes']=_0xcb4468[_0xaa2e('0x32')]['length']?_0xcb4468[_0xaa2e('0x32')]:_0x598ccd[_0xaa2e('0x31')];_0xcb4468['order']=qs[_0xaa2e('0x36')](_0x23599b[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0xcb4468[_0xaa2e('0x37')]=qs[_0xaa2e('0x2f')](_['pick'](_0x23599b['query'],_0x598ccd[_0xaa2e('0x2f')]));if(_0x23599b['query'][_0xaa2e('0x3c')]){_0xcb4468[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0xcb4468[_0xaa2e('0x37')],{'$or':_['map'](_0xcb4468[_0xaa2e('0x32')],function(_0x21195b){var _0x3a9bc1={};_0x3a9bc1[_0x21195b]={'$like':'%'+_0x23599b['query']['filter']+'%'};return _0x3a9bc1;})});}_0xcb4468=_['merge']({},_0xcb4468,_0x23599b[_0xaa2e('0x3d')]);return _0x258528[_0xaa2e('0x4b')](_0xcb4468);}})[_0xaa2e('0x22')](function(_0x4b7cf6){if(_0x4b7cf6){_0x20350e=_0x4b7cf6[_0xaa2e('0x42')];if(!_0x23599b[_0xaa2e('0x2d')][_0xaa2e('0x49')]('nolimit')){_0xcb4468['limit']=qs['limit'](_0x23599b['query']['limit']);_0xcb4468[_0xaa2e('0x1b')]=qs[_0xaa2e('0x1b')](_0x23599b[_0xaa2e('0x2d')]['offset']);}return _0x258528[_0xaa2e('0x4b')](_0xcb4468);}})['then'](function(_0x289f8c){if(_0x289f8c){return _0x289f8c?{'count':_0x20350e,'rows':_0x289f8c}:null;}})['then'](respondWithResult(_0x188e5d,null))[_0xaa2e('0x41')](handleError(_0x188e5d,null));};exports[_0xaa2e('0x4c')]=function(_0x29887b,_0x35bca0,_0x3d92e6){var _0x5eb382={};var _0x4c277b={};var _0x1c1dd7;var _0x5acca1;return db[_0xaa2e('0x29')]['findOne']({'where':{'id':_0x29887b[_0xaa2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x35bca0,null))[_0xaa2e('0x22')](function(_0x456039){if(_0x456039){_0x1c1dd7=_0x456039;_0x4c277b[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db['ZendeskField'][_0xaa2e('0x2a')]);_0x4c277b['query']=_[_0xaa2e('0x2e')](_0x29887b['query']);_0x4c277b[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x4c277b[_0xaa2e('0x31')],_0x4c277b['query']);_0x5eb382['attributes']=_[_0xaa2e('0x30')](_0x4c277b[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x5eb382['attributes']=_0x5eb382[_0xaa2e('0x32')]['length']?_0x5eb382[_0xaa2e('0x32')]:_0x4c277b[_0xaa2e('0x31')];_0x5eb382[_0xaa2e('0x35')]=qs['sort'](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x5eb382['where']=qs['filters'](_[_0xaa2e('0x38')](_0x29887b[_0xaa2e('0x2d')],_0x4c277b[_0xaa2e('0x2f')]));if(_0x29887b['query'][_0xaa2e('0x3c')]){_0x5eb382[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x5eb382[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x5eb382[_0xaa2e('0x32')],function(_0x12151d){var _0x21286a={};_0x21286a[_0x12151d]={'$like':'%'+_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x21286a;})});}_0x5eb382=_[_0xaa2e('0x39')]({},_0x5eb382,_0x29887b['options']);return _0x1c1dd7[_0xaa2e('0x4c')](_0x5eb382);}})[_0xaa2e('0x22')](function(_0x2b60b9){if(_0x2b60b9){_0x5acca1=_0x2b60b9['length'];if(!_0x29887b['query'][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x5eb382[_0xaa2e('0x1d')]=qs['limit'](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x1d')]);_0x5eb382[_0xaa2e('0x1b')]=qs[_0xaa2e('0x1b')](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x1b')]);}return _0x1c1dd7[_0xaa2e('0x4c')](_0x5eb382);}})['then'](function(_0x16cf19){if(_0x16cf19){return _0x16cf19?{'count':_0x5acca1,'rows':_0x16cf19}:null;}})['then'](respondWithResult(_0x35bca0,null))[_0xaa2e('0x41')](handleError(_0x35bca0,null));};exports[_0xaa2e('0x4d')]=function(_0x2624f4,_0x21d00c,_0x1ab097){var _0x2f304d={};var _0x5911c2={};var _0x3db8a4;var _0x384c6a;return db[_0xaa2e('0x29')][_0xaa2e('0x48')]({'where':{'id':_0x2624f4[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x21d00c,null))[_0xaa2e('0x22')](function(_0x5a16e3){if(_0x5a16e3){_0x3db8a4=_0x5a16e3;_0x5911c2[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db[_0xaa2e('0x4e')][_0xaa2e('0x2a')]);_0x5911c2[_0xaa2e('0x2d')]=_[_0xaa2e('0x2e')](_0x2624f4['query']);_0x5911c2['filters']=_[_0xaa2e('0x30')](_0x5911c2[_0xaa2e('0x31')],_0x5911c2[_0xaa2e('0x2d')]);_0x2f304d[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x5911c2[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x2f304d[_0xaa2e('0x32')]=_0x2f304d[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x2f304d[_0xaa2e('0x32')]:_0x5911c2['model'];_0x2f304d[_0xaa2e('0x35')]=qs[_0xaa2e('0x36')](_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x2f304d['where']=qs[_0xaa2e('0x2f')](_['pick'](_0x2624f4[_0xaa2e('0x2d')],_0x5911c2[_0xaa2e('0x2f')]));if(_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x3c')]){_0x2f304d[_0xaa2e('0x37')]=_['merge'](_0x2f304d['where'],{'$or':_['map'](_0x2f304d['attributes'],function(_0x42b0c3){var _0x14ffce={};_0x14ffce[_0x42b0c3]={'$like':'%'+_0x2624f4[_0xaa2e('0x2d')]['filter']+'%'};return _0x14ffce;})});}_0x2f304d=_[_0xaa2e('0x39')]({},_0x2f304d,_0x2624f4[_0xaa2e('0x3d')]);return _0x3db8a4[_0xaa2e('0x4d')](_0x2f304d);}})[_0xaa2e('0x22')](function(_0x6d30de){if(_0x6d30de){_0x384c6a=_0x6d30de[_0xaa2e('0x42')];if(!_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x2f304d[_0xaa2e('0x1d')]=qs[_0xaa2e('0x1d')](_0x2624f4[_0xaa2e('0x2d')]['limit']);_0x2f304d[_0xaa2e('0x1b')]=qs['offset'](_0x2624f4['query']['offset']);}return _0x3db8a4['getTags'](_0x2f304d);}})[_0xaa2e('0x22')](function(_0x3eaa8d){if(_0x3eaa8d){return _0x3eaa8d?{'count':_0x384c6a,'rows':_0x3eaa8d}:null;}})[_0xaa2e('0x22')](respondWithResult(_0x21d00c,null))[_0xaa2e('0x41')](handleError(_0x21d00c,null));};exports[_0xaa2e('0x4f')]=function(_0x1340b5,_0x45da77,_0x15c239){if(_0x1340b5[_0xaa2e('0x45')]['id']){delete _0x1340b5[_0xaa2e('0x45')]['id'];}return db[_0xaa2e('0x29')]['findOne']({'where':{'id':_0x1340b5['params']['id']}})['then'](handleEntityNotFound(_0x45da77,null))[_0xaa2e('0x22')](function(_0x2042ef){if(_0x2042ef){return _0x2042ef[_0xaa2e('0x4f')](_0x1340b5['body'][_0xaa2e('0x50')]||[]);}return null;})[_0xaa2e('0x22')](respondWithResult(_0x45da77,null))[_0xaa2e('0x41')](handleError(_0x45da77,null));}; \ No newline at end of file +var _0x8dac=['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','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','filters','pick','filter','where','VIRTUAL','merge','options','include','rows','show','includeAll','create','body','update','find','params','catch','getFields','ZendeskField','order','sort','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5b7946,_0x26ae5a){var _0x43e7a1=function(_0x1193f6){while(--_0x1193f6){_0x5b7946['push'](_0x5b7946['shift']());}};_0x43e7a1(++_0x26ae5a);}(_0x8dac,0xf0));var _0xc8da=function(_0x28c25b,_0x5fb205){_0x28c25b=_0x28c25b-0x0;var _0x4fade4=_0x8dac[_0x28c25b];return _0x4fade4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc8da('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8da('0x1'));var moment=require('moment');var BPromise=require(_0xc8da('0x2'));var Mustache=require(_0xc8da('0x3'));var util=require(_0xc8da('0x4'));var path=require(_0xc8da('0x5'));var sox=require('sox');var csv=require(_0xc8da('0x6'));var ejs=require(_0xc8da('0x7'));var fs=require('fs');var fs_extra=require(_0xc8da('0x8'));var _=require(_0xc8da('0x9'));var squel=require(_0xc8da('0xa'));var crypto=require(_0xc8da('0xb'));var jsforce=require(_0xc8da('0xc'));var deskjs=require(_0xc8da('0xd'));var toCsv=require(_0xc8da('0x6'));var querystring=require('querystring');var Papa=require(_0xc8da('0xe'));var Redis=require(_0xc8da('0xf'));var authService=require(_0xc8da('0x10'));var qs=require(_0xc8da('0x11'));var as=require(_0xc8da('0x12'));var hardwareService=require(_0xc8da('0x13'));var logger=require(_0xc8da('0x14'))(_0xc8da('0x15'));var utils=require(_0xc8da('0x16'));var config=require(_0xc8da('0x17'));var licenseUtil=require(_0xc8da('0x18'));var db=require(_0xc8da('0x19'))['db'];function respondWithStatusCode(_0xf0acd6,_0x298f4b){_0x298f4b=_0x298f4b||0xcc;return function(_0x2b04a5){if(_0x2b04a5){return _0xf0acd6[_0xc8da('0x1a')](_0x298f4b);}return _0xf0acd6[_0xc8da('0x1b')](_0x298f4b)[_0xc8da('0x1c')]();};}function respondWithResult(_0x159fcc,_0x495b0b){_0x495b0b=_0x495b0b||0xc8;return function(_0x370895){if(_0x370895){return _0x159fcc['status'](_0x495b0b)[_0xc8da('0x1d')](_0x370895);}};}function respondWithFilteredResult(_0x569d14,_0x2f1e48){return function(_0x432a40){if(_0x432a40){var _0x5d76a2=typeof _0x2f1e48[_0xc8da('0x1e')]==='undefined'&&typeof _0x2f1e48[_0xc8da('0x1f')]===_0xc8da('0x20');var _0x2c1d6a=_0x432a40[_0xc8da('0x21')];var _0x15acca=_0x5d76a2?0x0:_0x2f1e48[_0xc8da('0x1e')];var _0x221c20=_0x5d76a2?_0x432a40[_0xc8da('0x21')]:_0x2f1e48['offset']+_0x2f1e48['limit'];var _0x56982d;if(_0x221c20>=_0x2c1d6a){_0x221c20=_0x2c1d6a;_0x56982d=0xc8;}else{_0x56982d=0xce;}_0x569d14[_0xc8da('0x1b')](_0x56982d);return _0x569d14[_0xc8da('0x22')](_0xc8da('0x23'),_0x15acca+'-'+_0x221c20+'/'+_0x2c1d6a)[_0xc8da('0x1d')](_0x432a40);}return null;};}function patchUpdates(_0x408d8d){return function(_0x1c663a){try{jsonpatch[_0xc8da('0x24')](_0x1c663a,_0x408d8d,!![]);}catch(_0x490af8){return BPromise[_0xc8da('0x25')](_0x490af8);}return _0x1c663a[_0xc8da('0x26')]();};}function saveUpdates(_0x357cdc,_0x1ef74f){return function(_0x4aae71){if(_0x4aae71){return _0x4aae71['update'](_0x357cdc)[_0xc8da('0x27')](function(_0xa27eb5){return _0xa27eb5;});}return null;};}function removeEntity(_0x349880,_0x133708){return function(_0x2a713c){if(_0x2a713c){return _0x2a713c[_0xc8da('0x28')]()['then'](function(){_0x349880[_0xc8da('0x1b')](0xcc)[_0xc8da('0x1c')]();});}};}function handleEntityNotFound(_0xe77ab3,_0x29c0fb){return function(_0x354bae){if(!_0x354bae){_0xe77ab3['sendStatus'](0x194);}return _0x354bae;};}function handleError(_0x4968bd,_0x2b4056){_0x2b4056=_0x2b4056||0x1f4;return function(_0x559d90){logger[_0xc8da('0x29')](_0x559d90[_0xc8da('0x2a')]);if(_0x559d90[_0xc8da('0x2b')]){delete _0x559d90[_0xc8da('0x2b')];}_0x4968bd[_0xc8da('0x1b')](_0x2b4056)[_0xc8da('0x2c')](_0x559d90);};}exports[_0xc8da('0x2d')]=function(_0x5f0665,_0x475a82){var _0x550776={},_0x5a5ef2={},_0x5f4c3f={'count':0x0,'rows':[]};var _0x160e50=_[_0xc8da('0x2e')](db[_0xc8da('0x2f')][_0xc8da('0x30')],function(_0x168aa0){return{'name':_0x168aa0['fieldName'],'type':_0x168aa0[_0xc8da('0x31')][_0xc8da('0x32')]};});_0x5a5ef2['model']=_[_0xc8da('0x2e')](_0x160e50,_0xc8da('0x2b'));_0x5a5ef2[_0xc8da('0x33')]=_[_0xc8da('0x34')](_0x5f0665[_0xc8da('0x33')]);_0x5a5ef2['filters']=_[_0xc8da('0x35')](_0x5a5ef2[_0xc8da('0x36')],_0x5a5ef2[_0xc8da('0x33')]);_0x550776[_0xc8da('0x37')]=_[_0xc8da('0x35')](_0x5a5ef2[_0xc8da('0x36')],qs['fields'](_0x5f0665[_0xc8da('0x33')][_0xc8da('0x38')]));_0x550776['attributes']=_0x550776[_0xc8da('0x37')][_0xc8da('0x39')]?_0x550776[_0xc8da('0x37')]:_0x5a5ef2['model'];if(!_0x5f0665['query'][_0xc8da('0x3a')]('nolimit')){_0x550776[_0xc8da('0x1f')]=qs[_0xc8da('0x1f')](_0x5f0665[_0xc8da('0x33')][_0xc8da('0x1f')]);_0x550776['offset']=qs['offset'](_0x5f0665[_0xc8da('0x33')][_0xc8da('0x1e')]);}_0x550776['order']=qs['sort'](_0x5f0665[_0xc8da('0x33')]['sort']);_0x550776['where']=qs[_0xc8da('0x3b')](_[_0xc8da('0x3c')](_0x5f0665['query'],_0x5a5ef2[_0xc8da('0x3b')]),_0x160e50);if(_0x5f0665[_0xc8da('0x33')][_0xc8da('0x3d')]){_0x550776[_0xc8da('0x3e')]=_['merge'](_0x550776[_0xc8da('0x3e')],{'$or':_[_0xc8da('0x2e')](_0x160e50,function(_0x5818e0){if(_0x5818e0[_0xc8da('0x31')]!==_0xc8da('0x3f')){var _0x478858={};_0x478858[_0x5818e0['name']]={'$like':'%'+_0x5f0665[_0xc8da('0x33')]['filter']+'%'};return _0x478858;}})});}_0x550776=_[_0xc8da('0x40')]({},_0x550776,_0x5f0665[_0xc8da('0x41')]);var _0x1d3c7d={'where':_0x550776[_0xc8da('0x3e')]};return db[_0xc8da('0x2f')][_0xc8da('0x21')](_0x1d3c7d)[_0xc8da('0x27')](function(_0x2030f9){_0x5f4c3f[_0xc8da('0x21')]=_0x2030f9;if(_0x5f0665[_0xc8da('0x33')]['includeAll']){_0x550776[_0xc8da('0x42')]=[{'all':!![]}];}return db[_0xc8da('0x2f')]['findAll'](_0x550776);})[_0xc8da('0x27')](function(_0x55773b){_0x5f4c3f[_0xc8da('0x43')]=_0x55773b;return _0x5f4c3f;})[_0xc8da('0x27')](respondWithFilteredResult(_0x475a82,_0x550776))['catch'](handleError(_0x475a82,null));};exports[_0xc8da('0x44')]=function(_0x3eaeba,_0x58eb8f){var _0x575b4f={'raw':![],'where':{'id':_0x3eaeba['params']['id']}},_0x4034a3={};_0x4034a3[_0xc8da('0x36')]=_['keys'](db[_0xc8da('0x2f')][_0xc8da('0x30')]);_0x4034a3[_0xc8da('0x33')]=_[_0xc8da('0x34')](_0x3eaeba[_0xc8da('0x33')]);_0x4034a3[_0xc8da('0x3b')]=_['intersection'](_0x4034a3[_0xc8da('0x36')],_0x4034a3['query']);_0x575b4f[_0xc8da('0x37')]=_[_0xc8da('0x35')](_0x4034a3[_0xc8da('0x36')],qs[_0xc8da('0x38')](_0x3eaeba[_0xc8da('0x33')][_0xc8da('0x38')]));_0x575b4f['attributes']=_0x575b4f['attributes'][_0xc8da('0x39')]?_0x575b4f[_0xc8da('0x37')]:_0x4034a3[_0xc8da('0x36')];if(_0x3eaeba[_0xc8da('0x33')][_0xc8da('0x45')]){_0x575b4f['include']=[{'all':!![]}];}_0x575b4f=_[_0xc8da('0x40')]({},_0x575b4f,_0x3eaeba['options']);return db[_0xc8da('0x2f')]['find'](_0x575b4f)[_0xc8da('0x27')](handleEntityNotFound(_0x58eb8f,null))[_0xc8da('0x27')](respondWithResult(_0x58eb8f,null))['catch'](handleError(_0x58eb8f,null));};exports[_0xc8da('0x46')]=function(_0xcdff0e,_0xd33ee1){return db[_0xc8da('0x2f')]['create'](_0xcdff0e[_0xc8da('0x47')],{})['then'](respondWithResult(_0xd33ee1,0xc9))['catch'](handleError(_0xd33ee1,null));};exports[_0xc8da('0x48')]=function(_0x3efebf,_0xfcdca0){if(_0x3efebf[_0xc8da('0x47')]['id']){delete _0x3efebf[_0xc8da('0x47')]['id'];}return db[_0xc8da('0x2f')][_0xc8da('0x49')]({'where':{'id':_0x3efebf['params']['id']}})[_0xc8da('0x27')](handleEntityNotFound(_0xfcdca0,null))['then'](saveUpdates(_0x3efebf[_0xc8da('0x47')],null))[_0xc8da('0x27')](respondWithResult(_0xfcdca0,null))['catch'](handleError(_0xfcdca0,null));};exports[_0xc8da('0x28')]=function(_0x2020a8,_0x145a95){return db[_0xc8da('0x2f')][_0xc8da('0x49')]({'where':{'id':_0x2020a8[_0xc8da('0x4a')]['id']}})[_0xc8da('0x27')](handleEntityNotFound(_0x145a95,null))[_0xc8da('0x27')](removeEntity(_0x145a95,null))[_0xc8da('0x4b')](handleError(_0x145a95,null));};exports[_0xc8da('0x4c')]=function(_0x431c08,_0x188a3c,_0x1be658){var _0x61a33f={};var _0x32938d={};var _0x4ab543;var _0xdc011c;return db[_0xc8da('0x2f')]['findOne']({'where':{'id':_0x431c08['params']['id']}})[_0xc8da('0x27')](handleEntityNotFound(_0x188a3c,null))[_0xc8da('0x27')](function(_0x1ee57f){if(_0x1ee57f){_0x4ab543=_0x1ee57f;_0x32938d['model']=_['keys'](db[_0xc8da('0x4d')][_0xc8da('0x30')]);_0x32938d[_0xc8da('0x33')]=_['keys'](_0x431c08[_0xc8da('0x33')]);_0x32938d[_0xc8da('0x3b')]=_[_0xc8da('0x35')](_0x32938d[_0xc8da('0x36')],_0x32938d[_0xc8da('0x33')]);_0x61a33f[_0xc8da('0x37')]=_['intersection'](_0x32938d[_0xc8da('0x36')],qs[_0xc8da('0x38')](_0x431c08[_0xc8da('0x33')][_0xc8da('0x38')]));_0x61a33f[_0xc8da('0x37')]=_0x61a33f[_0xc8da('0x37')][_0xc8da('0x39')]?_0x61a33f[_0xc8da('0x37')]:_0x32938d[_0xc8da('0x36')];_0x61a33f[_0xc8da('0x4e')]=qs['sort'](_0x431c08[_0xc8da('0x33')][_0xc8da('0x4f')]);_0x61a33f[_0xc8da('0x3e')]=qs[_0xc8da('0x3b')](_['pick'](_0x431c08[_0xc8da('0x33')],_0x32938d[_0xc8da('0x3b')]));if(_0x431c08[_0xc8da('0x33')][_0xc8da('0x3d')]){_0x61a33f[_0xc8da('0x3e')]=_[_0xc8da('0x40')](_0x61a33f[_0xc8da('0x3e')],{'$or':_[_0xc8da('0x2e')](_0x61a33f['attributes'],function(_0x5868bd){var _0x526233={};_0x526233[_0x5868bd]={'$like':'%'+_0x431c08[_0xc8da('0x33')]['filter']+'%'};return _0x526233;})});}_0x61a33f=_[_0xc8da('0x40')]({},_0x61a33f,_0x431c08[_0xc8da('0x41')]);return _0x4ab543['getFields'](_0x61a33f);}})[_0xc8da('0x27')](function(_0x4520b0){if(_0x4520b0){_0xdc011c=_0x4520b0[_0xc8da('0x39')];if(!_0x431c08[_0xc8da('0x33')][_0xc8da('0x3a')](_0xc8da('0x50'))){_0x61a33f[_0xc8da('0x1f')]=qs[_0xc8da('0x1f')](_0x431c08[_0xc8da('0x33')][_0xc8da('0x1f')]);_0x61a33f['offset']=qs[_0xc8da('0x1e')](_0x431c08[_0xc8da('0x33')][_0xc8da('0x1e')]);}return _0x4ab543[_0xc8da('0x4c')](_0x61a33f);}})[_0xc8da('0x27')](function(_0xfd264d){if(_0xfd264d){return _0xfd264d?{'count':_0xdc011c,'rows':_0xfd264d}:null;}})[_0xc8da('0x27')](respondWithResult(_0x188a3c,null))[_0xc8da('0x4b')](handleError(_0x188a3c,null));};exports[_0xc8da('0x51')]=function(_0x3bf21f,_0x3b3f61,_0x4ce782){var _0x311fda={};var _0x1d3d68={};var _0x4269f1;var _0x543f52;return db[_0xc8da('0x2f')][_0xc8da('0x52')]({'where':{'id':_0x3bf21f[_0xc8da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b3f61,null))['then'](function(_0x5c80c9){if(_0x5c80c9){_0x4269f1=_0x5c80c9;_0x1d3d68[_0xc8da('0x36')]=_['keys'](db[_0xc8da('0x4d')][_0xc8da('0x30')]);_0x1d3d68[_0xc8da('0x33')]=_[_0xc8da('0x34')](_0x3bf21f[_0xc8da('0x33')]);_0x1d3d68[_0xc8da('0x3b')]=_[_0xc8da('0x35')](_0x1d3d68[_0xc8da('0x36')],_0x1d3d68['query']);_0x311fda[_0xc8da('0x37')]=_['intersection'](_0x1d3d68[_0xc8da('0x36')],qs['fields'](_0x3bf21f[_0xc8da('0x33')]['fields']));_0x311fda['attributes']=_0x311fda[_0xc8da('0x37')]['length']?_0x311fda['attributes']:_0x1d3d68[_0xc8da('0x36')];_0x311fda[_0xc8da('0x4e')]=qs[_0xc8da('0x4f')](_0x3bf21f[_0xc8da('0x33')]['sort']);_0x311fda['where']=qs['filters'](_['pick'](_0x3bf21f[_0xc8da('0x33')],_0x1d3d68[_0xc8da('0x3b')]));if(_0x3bf21f[_0xc8da('0x33')][_0xc8da('0x3d')]){_0x311fda[_0xc8da('0x3e')]=_[_0xc8da('0x40')](_0x311fda[_0xc8da('0x3e')],{'$or':_[_0xc8da('0x2e')](_0x311fda[_0xc8da('0x37')],function(_0x1da8d6){var _0x3cd242={};_0x3cd242[_0x1da8d6]={'$like':'%'+_0x3bf21f[_0xc8da('0x33')][_0xc8da('0x3d')]+'%'};return _0x3cd242;})});}_0x311fda=_[_0xc8da('0x40')]({},_0x311fda,_0x3bf21f[_0xc8da('0x41')]);return _0x4269f1['getSubjects'](_0x311fda);}})[_0xc8da('0x27')](function(_0xf8a66b){if(_0xf8a66b){_0x543f52=_0xf8a66b[_0xc8da('0x39')];if(!_0x3bf21f[_0xc8da('0x33')][_0xc8da('0x3a')](_0xc8da('0x50'))){_0x311fda[_0xc8da('0x1f')]=qs[_0xc8da('0x1f')](_0x3bf21f[_0xc8da('0x33')]['limit']);_0x311fda[_0xc8da('0x1e')]=qs[_0xc8da('0x1e')](_0x3bf21f['query'][_0xc8da('0x1e')]);}return _0x4269f1[_0xc8da('0x51')](_0x311fda);}})['then'](function(_0x288e22){if(_0x288e22){return _0x288e22?{'count':_0x543f52,'rows':_0x288e22}:null;}})['then'](respondWithResult(_0x3b3f61,null))[_0xc8da('0x4b')](handleError(_0x3b3f61,null));};exports[_0xc8da('0x53')]=function(_0x2ac523,_0x1cb8df,_0x39f659){var _0x5c1157={};var _0x2e8eba={};var _0x34aa1d;var _0x27d741;return db[_0xc8da('0x2f')][_0xc8da('0x52')]({'where':{'id':_0x2ac523[_0xc8da('0x4a')]['id']}})[_0xc8da('0x27')](handleEntityNotFound(_0x1cb8df,null))['then'](function(_0x1965c8){if(_0x1965c8){_0x34aa1d=_0x1965c8;_0x2e8eba['model']=_[_0xc8da('0x34')](db['ZendeskField'][_0xc8da('0x30')]);_0x2e8eba['query']=_[_0xc8da('0x34')](_0x2ac523[_0xc8da('0x33')]);_0x2e8eba['filters']=_[_0xc8da('0x35')](_0x2e8eba[_0xc8da('0x36')],_0x2e8eba[_0xc8da('0x33')]);_0x5c1157[_0xc8da('0x37')]=_['intersection'](_0x2e8eba[_0xc8da('0x36')],qs[_0xc8da('0x38')](_0x2ac523[_0xc8da('0x33')][_0xc8da('0x38')]));_0x5c1157['attributes']=_0x5c1157['attributes'][_0xc8da('0x39')]?_0x5c1157[_0xc8da('0x37')]:_0x2e8eba[_0xc8da('0x36')];_0x5c1157[_0xc8da('0x4e')]=qs[_0xc8da('0x4f')](_0x2ac523[_0xc8da('0x33')][_0xc8da('0x4f')]);_0x5c1157[_0xc8da('0x3e')]=qs[_0xc8da('0x3b')](_['pick'](_0x2ac523[_0xc8da('0x33')],_0x2e8eba[_0xc8da('0x3b')]));if(_0x2ac523[_0xc8da('0x33')]['filter']){_0x5c1157[_0xc8da('0x3e')]=_[_0xc8da('0x40')](_0x5c1157[_0xc8da('0x3e')],{'$or':_[_0xc8da('0x2e')](_0x5c1157[_0xc8da('0x37')],function(_0x48ca7a){var _0x19b79c={};_0x19b79c[_0x48ca7a]={'$like':'%'+_0x2ac523['query']['filter']+'%'};return _0x19b79c;})});}_0x5c1157=_[_0xc8da('0x40')]({},_0x5c1157,_0x2ac523[_0xc8da('0x41')]);return _0x34aa1d[_0xc8da('0x53')](_0x5c1157);}})[_0xc8da('0x27')](function(_0x106f28){if(_0x106f28){_0x27d741=_0x106f28[_0xc8da('0x39')];if(!_0x2ac523['query']['hasOwnProperty'](_0xc8da('0x50'))){_0x5c1157[_0xc8da('0x1f')]=qs[_0xc8da('0x1f')](_0x2ac523[_0xc8da('0x33')][_0xc8da('0x1f')]);_0x5c1157[_0xc8da('0x1e')]=qs[_0xc8da('0x1e')](_0x2ac523[_0xc8da('0x33')][_0xc8da('0x1e')]);}return _0x34aa1d['getDescriptions'](_0x5c1157);}})[_0xc8da('0x27')](function(_0x2e9ea5){if(_0x2e9ea5){return _0x2e9ea5?{'count':_0x27d741,'rows':_0x2e9ea5}:null;}})['then'](respondWithResult(_0x1cb8df,null))[_0xc8da('0x4b')](handleError(_0x1cb8df,null));};exports[_0xc8da('0x54')]=function(_0x2c3ade,_0x5726d2,_0x3e5c27){var _0x48cc1c={};var _0x5b2f77={};var _0x2a7a66;var _0x2de574;return db[_0xc8da('0x2f')]['findOne']({'where':{'id':_0x2c3ade[_0xc8da('0x4a')]['id']}})[_0xc8da('0x27')](handleEntityNotFound(_0x5726d2,null))['then'](function(_0x440718){if(_0x440718){_0x2a7a66=_0x440718;_0x5b2f77['model']=_['keys'](db['Tag'][_0xc8da('0x30')]);_0x5b2f77[_0xc8da('0x33')]=_[_0xc8da('0x34')](_0x2c3ade[_0xc8da('0x33')]);_0x5b2f77[_0xc8da('0x3b')]=_['intersection'](_0x5b2f77[_0xc8da('0x36')],_0x5b2f77[_0xc8da('0x33')]);_0x48cc1c['attributes']=_[_0xc8da('0x35')](_0x5b2f77[_0xc8da('0x36')],qs['fields'](_0x2c3ade[_0xc8da('0x33')]['fields']));_0x48cc1c[_0xc8da('0x37')]=_0x48cc1c[_0xc8da('0x37')][_0xc8da('0x39')]?_0x48cc1c[_0xc8da('0x37')]:_0x5b2f77[_0xc8da('0x36')];_0x48cc1c[_0xc8da('0x4e')]=qs[_0xc8da('0x4f')](_0x2c3ade['query']['sort']);_0x48cc1c['where']=qs[_0xc8da('0x3b')](_[_0xc8da('0x3c')](_0x2c3ade[_0xc8da('0x33')],_0x5b2f77['filters']));if(_0x2c3ade[_0xc8da('0x33')][_0xc8da('0x3d')]){_0x48cc1c[_0xc8da('0x3e')]=_['merge'](_0x48cc1c[_0xc8da('0x3e')],{'$or':_['map'](_0x48cc1c[_0xc8da('0x37')],function(_0x377a0b){var _0x5c8ef0={};_0x5c8ef0[_0x377a0b]={'$like':'%'+_0x2c3ade[_0xc8da('0x33')][_0xc8da('0x3d')]+'%'};return _0x5c8ef0;})});}_0x48cc1c=_[_0xc8da('0x40')]({},_0x48cc1c,_0x2c3ade[_0xc8da('0x41')]);return _0x2a7a66[_0xc8da('0x54')](_0x48cc1c);}})[_0xc8da('0x27')](function(_0x2e7282){if(_0x2e7282){_0x2de574=_0x2e7282[_0xc8da('0x39')];if(!_0x2c3ade[_0xc8da('0x33')][_0xc8da('0x3a')](_0xc8da('0x50'))){_0x48cc1c[_0xc8da('0x1f')]=qs[_0xc8da('0x1f')](_0x2c3ade['query'][_0xc8da('0x1f')]);_0x48cc1c[_0xc8da('0x1e')]=qs[_0xc8da('0x1e')](_0x2c3ade[_0xc8da('0x33')][_0xc8da('0x1e')]);}return _0x2a7a66[_0xc8da('0x54')](_0x48cc1c);}})[_0xc8da('0x27')](function(_0x106802){if(_0x106802){return _0x106802?{'count':_0x2de574,'rows':_0x106802}:null;}})['then'](respondWithResult(_0x5726d2,null))[_0xc8da('0x4b')](handleError(_0x5726d2,null));};exports[_0xc8da('0x55')]=function(_0x1137ec,_0x17bc39,_0x4a85a3){if(_0x1137ec[_0xc8da('0x47')]['id']){delete _0x1137ec[_0xc8da('0x47')]['id'];}return db[_0xc8da('0x2f')][_0xc8da('0x52')]({'where':{'id':_0x1137ec[_0xc8da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17bc39,null))['then'](function(_0x1ad145){if(_0x1ad145){return _0x1ad145[_0xc8da('0x55')](_0x1137ec['body'][_0xc8da('0x56')]||[]);}return null;})[_0xc8da('0x27')](respondWithResult(_0x17bc39,null))[_0xc8da('0x4b')](handleError(_0x17bc39,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 41dd71c..a745c16 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 _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x1ba691,_0x59087e){var _0xa6091c=function(_0x17d848){while(--_0x17d848){_0x1ba691['push'](_0x1ba691['shift']());}};_0xa6091c(++_0x59087e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x52a8bf,_0x56f389){_0x52a8bf=_0x52a8bf-0x0;var _0xa4dcd2=_0xe1e3[_0x52a8bf];return _0xa4dcd2;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xc900,0xb3));var _0x0c90=function(_0x7b1365,_0x57e43f){_0x7b1365=_0x7b1365-0x0;var _0x5866db=_0xc900[_0x7b1365];return _0x5866db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('0x9'),'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 836cf2b..13c7f37 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 _0xcfa3=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1b6b5d,_0x5deaaf){var _0x16f4f7=function(_0xe9b61f){while(--_0xe9b61f){_0x1b6b5d['push'](_0x1b6b5d['shift']());}};_0x16f4f7(++_0x5deaaf);}(_0xcfa3,0x149));var _0x3cfa=function(_0x4ee91f,_0x20342d){_0x4ee91f=_0x4ee91f-0x0;var _0x32b073=_0xcfa3[_0x4ee91f];return _0x32b073;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var moment=require('moment');var BPromise=require(_0x3cfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cfa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cfa('0x4'));var logger=require(_0x3cfa('0x5'))(_0x3cfa('0x6'));var config=require(_0x3cfa('0x7'));var jayson=require(_0x3cfa('0x8'));var client=jayson[_0x3cfa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a01e,_0x46086c,_0xa5439){return new BPromise(function(_0xe37123,_0x4af8a1){return client[_0x3cfa('0xa')](_0x47a01e,_0xa5439)[_0x3cfa('0xb')](function(_0x4e4a7a){logger[_0x3cfa('0xc')](_0x3cfa('0xd'),_0x46086c,_0x3cfa('0xe'));logger[_0x3cfa('0xf')](_0x3cfa('0x10'),_0x46086c,_0x3cfa('0xe'),JSON['stringify'](_0x4e4a7a));if(_0x4e4a7a['error']){if(_0x4e4a7a['error']['code']===0x1f4){logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x4e4a7a['error'][_0x3cfa('0x12')]);return _0x4af8a1(_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);}logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);return _0xe37123(_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);}else{logger[_0x3cfa('0xc')](_0x3cfa('0xd'),_0x46086c,_0x3cfa('0xe'));_0xe37123(_0x4e4a7a[_0x3cfa('0x13')][_0x3cfa('0x12')]);}})['catch'](function(_0x17f593){logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x17f593);_0x4af8a1(_0x17f593);});});} \ No newline at end of file +var _0x09fd=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x548a59,_0x9ab69f){var _0x9f7c8=function(_0x33cdbb){while(--_0x33cdbb){_0x548a59['push'](_0x548a59['shift']());}};_0x9f7c8(++_0x9ab69f);}(_0x09fd,0x162));var _0xd09f=function(_0x14d3a1,_0x6d1bfc){_0x14d3a1=_0x14d3a1-0x0;var _0x1afceb=_0x09fd[_0x14d3a1];return _0x1afceb;};'use strict';var _=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var moment=require(_0xd09f('0x2'));var BPromise=require(_0xd09f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd09f('0x4'))['db'];var utils=require(_0xd09f('0x5'));var logger=require(_0xd09f('0x6'))(_0xd09f('0x7'));var config=require(_0xd09f('0x8'));var jayson=require(_0xd09f('0x9'));var client=jayson['client'][_0xd09f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b0f0d,_0x375214,_0x5d16fc){return new BPromise(function(_0x350e09,_0x29f519){return client[_0xd09f('0xb')](_0x5b0f0d,_0x5d16fc)['then'](function(_0x1874b5){logger[_0xd09f('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x375214,_0xd09f('0xd'));logger[_0xd09f('0xe')](_0xd09f('0xf'),_0x375214,_0xd09f('0xd'),JSON['stringify'](_0x1874b5));if(_0x1874b5['error']){if(_0x1874b5[_0xd09f('0x10')][_0xd09f('0x11')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x375214,_0x1874b5[_0xd09f('0x10')]['message']);return _0x29f519(_0x1874b5[_0xd09f('0x10')][_0xd09f('0x12')]);}logger['error'](_0xd09f('0x13'),_0x375214,_0x1874b5[_0xd09f('0x10')]['message']);return _0x350e09(_0x1874b5[_0xd09f('0x10')][_0xd09f('0x12')]);}else{logger['info'](_0xd09f('0x13'),_0x375214,'request\x20sent');_0x350e09(_0x1874b5[_0xd09f('0x14')]['message']);}})[_0xd09f('0x15')](function(_0x11ce87){logger[_0xd09f('0x10')](_0xd09f('0x13'),_0x375214,_0x11ce87);_0x29f519(_0x11ce87);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cb4ebe8..1b98138 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 _0x6b80=['post','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b80,0x14f));var _0x06b8=function(_0x1c3e42,_0x1a4fe9){_0x1c3e42=_0x1c3e42-0x0;var _0x348fdc=_0x6b80[_0x1c3e42];return _0x348fdc;};'use strict';var multer=require(_0x06b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x06b8('0x1'));var express=require(_0x06b8('0x2'));var router=express['Router']();var fs_extra=require(_0x06b8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06b8('0x4'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x06b8('0x5')](),controller[_0x06b8('0x6')]);router[_0x06b8('0x7')](_0x06b8('0x8'),auth[_0x06b8('0x5')](),controller[_0x06b8('0x9')]);router[_0x06b8('0xa')]('/',auth[_0x06b8('0x5')](),controller['create']);router[_0x06b8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x06b8('0xc')]);router[_0x06b8('0xd')](_0x06b8('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x06b8('0xe')]=router; \ No newline at end of file +var _0xd20e=['./intZendeskField.controller','index','get','/:id','isAuthenticated','create','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b95ea,_0x296caf){var _0x4fe786=function(_0x954db9){while(--_0x954db9){_0x2b95ea['push'](_0x2b95ea['shift']());}};_0x4fe786(++_0x296caf);}(_0xd20e,0xb2));var _0xed20=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd20e[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var path=require(_0xed20('0x2'));var timeout=require('connect-timeout');var express=require(_0xed20('0x3'));var router=express[_0xed20('0x4')]();var fs_extra=require(_0xed20('0x5'));var auth=require(_0xed20('0x6'));var interaction=require(_0xed20('0x7'));var config=require(_0xed20('0x8'));var controller=require(_0xed20('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xed20('0xa')]);router[_0xed20('0xb')](_0xed20('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xed20('0xd')](),controller[_0xed20('0xe')]);router['put'](_0xed20('0xc'),auth[_0xed20('0xd')](),controller[_0xed20('0xf')]);router[_0xed20('0x10')](_0xed20('0xc'),auth[_0xed20('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index dd202da..93fcac5 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 _0x458b=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x355285,_0x572d13){var _0x45b20e=function(_0x203f1b){while(--_0x203f1b){_0x355285['push'](_0x355285['shift']());}};_0x45b20e(++_0x572d13);}(_0x458b,0x1b2));var _0xb458=function(_0x49cdd0,_0x2508f9){_0x49cdd0=_0x49cdd0-0x0;var _0x13daaa=_0x458b[_0x49cdd0];return _0x13daaa;};'use strict';var Sequelize=require(_0xb458('0x0'));module[_0xb458('0x1')]={'type':{'type':Sequelize[_0xb458('0x2')](_0xb458('0x3'),_0xb458('0x4'),_0xb458('0x5'),'keyValue',_0xb458('0x6')),'defaultValue':_0xb458('0x3')},'content':{'type':Sequelize[_0xb458('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb458('0x2')](_0xb458('0x3'),'variable',_0xb458('0x5'))},'keyContent':{'type':Sequelize[_0xb458('0x7')]},'idField':{'type':Sequelize[_0xb458('0x7')]},'nameField':{'type':Sequelize[_0xb458('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb458('0x7')]}}; \ No newline at end of file +var _0xd05b=['STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','picklist','string'];(function(_0x247b73,_0x262bd9){var _0x1c0534=function(_0x485055){while(--_0x485055){_0x247b73['push'](_0x247b73['shift']());}};_0x1c0534(++_0x262bd9);}(_0xd05b,0xb7));var _0xbd05=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xd05b[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0xbd05('0x0'));module[_0xbd05('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xbd05('0x2'),_0xbd05('0x3'),'keyValue',_0xbd05('0x4')),'defaultValue':_0xbd05('0x5')},'content':{'type':Sequelize[_0xbd05('0x6')]},'key':{'type':Sequelize[_0xbd05('0x6')]},'keyType':{'type':Sequelize[_0xbd05('0x7')]('string',_0xbd05('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xbd05('0x6')]},'idField':{'type':Sequelize[_0xbd05('0x6')]},'nameField':{'type':Sequelize[_0xbd05('0x6')]},'customField':{'type':Sequelize[_0xbd05('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd05('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8ba1e95..b1dfc39 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 _0xbb53=['include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','length'];(function(_0x373521,_0x1db3fc){var _0x5d2a29=function(_0x4b16b5){while(--_0x4b16b5){_0x373521['push'](_0x373521['shift']());}};_0x5d2a29(++_0x1db3fc);}(_0xbb53,0x121));var _0x3bb5=function(_0x31f227,_0x5bed48){_0x31f227=_0x31f227-0x0;var _0x30cad3=_0xbb53[_0x31f227];return _0x30cad3;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){_0x341a3f['status'](0xcc)[_0x3bb5('0x24')]();});}};}function handleEntityNotFound(_0x36cfda,_0x58acdb){return function(_0x483689){if(!_0x483689){_0x36cfda[_0x3bb5('0x17')](0x194);}return _0x483689;};}function handleError(_0x77a60f,_0x2fc543){_0x2fc543=_0x2fc543||0x1f4;return function(_0xc1c149){logger['error'](_0xc1c149['stack']);if(_0xc1c149[_0x3bb5('0x25')]){delete _0xc1c149['name'];}_0x77a60f[_0x3bb5('0x18')](_0x2fc543)[_0x3bb5('0x26')](_0xc1c149);};}exports[_0x3bb5('0x27')]=function(_0x534b15,_0x5f40ac){var _0x19e61d={},_0x39f1ad={},_0x17ada7={'count':0x0,'rows':[]};var _0x18304c=_[_0x3bb5('0x28')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')],function(_0x5ce225){return{'name':_0x5ce225[_0x3bb5('0x2b')],'type':_0x5ce225[_0x3bb5('0x2c')][_0x3bb5('0x2d')]};});_0x39f1ad[_0x3bb5('0x2e')]=_[_0x3bb5('0x28')](_0x18304c,_0x3bb5('0x25'));_0x39f1ad[_0x3bb5('0x2f')]=_['keys'](_0x534b15[_0x3bb5('0x2f')]);_0x39f1ad[_0x3bb5('0x30')]=_['intersection'](_0x39f1ad[_0x3bb5('0x2e')],_0x39f1ad[_0x3bb5('0x2f')]);_0x19e61d[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x39f1ad[_0x3bb5('0x2e')],qs['fields'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x19e61d[_0x3bb5('0x31')]=_0x19e61d[_0x3bb5('0x31')]['length']?_0x19e61d['attributes']:_0x39f1ad[_0x3bb5('0x2e')];if(!_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x34')](_0x3bb5('0x35'))){_0x19e61d[_0x3bb5('0x1b')]=qs[_0x3bb5('0x1b')](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x19e61d[_0x3bb5('0x1a')]=qs['offset'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1a')]);}_0x19e61d['order']=qs['sort'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x36')]);_0x19e61d[_0x3bb5('0x37')]=qs[_0x3bb5('0x30')](_['pick'](_0x534b15['query'],_0x39f1ad[_0x3bb5('0x30')]),_0x18304c);if(_0x534b15['query'][_0x3bb5('0x38')]){_0x19e61d['where']=_['merge'](_0x19e61d[_0x3bb5('0x37')],{'$or':_['map'](_0x18304c,function(_0x5edb47){if(_0x5edb47[_0x3bb5('0x2c')]!==_0x3bb5('0x39')){var _0x1384cd={};_0x1384cd[_0x5edb47['name']]={'$like':'%'+_0x534b15[_0x3bb5('0x2f')]['filter']+'%'};return _0x1384cd;}})});}_0x19e61d=_[_0x3bb5('0x3a')]({},_0x19e61d,_0x534b15['options']);var _0x235e3={'where':_0x19e61d[_0x3bb5('0x37')]};return db[_0x3bb5('0x29')][_0x3bb5('0x1d')](_0x235e3)[_0x3bb5('0x22')](function(_0x261d7b){_0x17ada7['count']=_0x261d7b;if(_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x3b')]){_0x19e61d['include']=[{'all':!![]}];}return db[_0x3bb5('0x29')][_0x3bb5('0x3c')](_0x19e61d);})[_0x3bb5('0x22')](function(_0x5cfb72){_0x17ada7[_0x3bb5('0x3d')]=_0x5cfb72;return _0x17ada7;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5f40ac,_0x19e61d))['catch'](handleError(_0x5f40ac,null));};exports[_0x3bb5('0x3e')]=function(_0x40da23,_0x7a294e){var _0x2291e9={'raw':!![],'where':{'id':_0x40da23[_0x3bb5('0x3f')]['id']}},_0x663685={};_0x663685[_0x3bb5('0x2e')]=_[_0x3bb5('0x40')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')]);_0x663685[_0x3bb5('0x2f')]=_[_0x3bb5('0x40')](_0x40da23[_0x3bb5('0x2f')]);_0x663685[_0x3bb5('0x30')]=_['intersection'](_0x663685[_0x3bb5('0x2e')],_0x663685[_0x3bb5('0x2f')]);_0x2291e9['attributes']=_['intersection'](_0x663685[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x40da23[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x2291e9[_0x3bb5('0x31')]=_0x2291e9[_0x3bb5('0x31')][_0x3bb5('0x41')]?_0x2291e9[_0x3bb5('0x31')]:_0x663685['model'];if(_0x40da23['query'][_0x3bb5('0x3b')]){_0x2291e9[_0x3bb5('0x42')]=[{'all':!![]}];}_0x2291e9=_[_0x3bb5('0x3a')]({},_0x2291e9,_0x40da23['options']);return db[_0x3bb5('0x29')]['find'](_0x2291e9)[_0x3bb5('0x22')](handleEntityNotFound(_0x7a294e,null))[_0x3bb5('0x22')](respondWithResult(_0x7a294e,null))[_0x3bb5('0x43')](handleError(_0x7a294e,null));};exports[_0x3bb5('0x44')]=function(_0x11352e,_0x2b7c68){return db['ZendeskField'][_0x3bb5('0x44')](_0x11352e[_0x3bb5('0x45')],{})['then'](respondWithResult(_0x2b7c68,0xc9))[_0x3bb5('0x43')](handleError(_0x2b7c68,null));};exports[_0x3bb5('0x21')]=function(_0x5075bd,_0x41edf7){if(_0x5075bd[_0x3bb5('0x45')]['id']){delete _0x5075bd[_0x3bb5('0x45')]['id'];}return db[_0x3bb5('0x29')][_0x3bb5('0x46')]({'where':{'id':_0x5075bd['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x41edf7,null))[_0x3bb5('0x22')](saveUpdates(_0x5075bd['body'],null))['then'](respondWithResult(_0x41edf7,null))[_0x3bb5('0x43')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x23')]=function(_0x1e5b64,_0x90d5b6){return db[_0x3bb5('0x29')]['find']({'where':{'id':_0x1e5b64[_0x3bb5('0x3f')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x90d5b6,null))[_0x3bb5('0x22')](removeEntity(_0x90d5b6,null))[_0x3bb5('0x43')](handleError(_0x90d5b6,null));}; \ No newline at end of file +var _0xbf84=['options','find','create','body','update','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','apply','reject','then','end','stack','name','send','index','map','ZendeskField','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll'];(function(_0x16cee7,_0x20c91b){var _0x361f1a=function(_0x3f96a8){while(--_0x3f96a8){_0x16cee7['push'](_0x16cee7['shift']());}};_0x361f1a(++_0x20c91b);}(_0xbf84,0x16a));var _0x4bf8=function(_0x5d9c4e,_0x3f6298){_0x5d9c4e=_0x5d9c4e-0x0;var _0x59bc20=_0xbf84[_0x5d9c4e];return _0x59bc20;};'use strict';var emlformat=require(_0x4bf8('0x0'));var rimraf=require(_0x4bf8('0x1'));var zipdir=require(_0x4bf8('0x2'));var jsonpatch=require(_0x4bf8('0x3'));var rp=require('request-promise');var moment=require(_0x4bf8('0x4'));var BPromise=require(_0x4bf8('0x5'));var Mustache=require(_0x4bf8('0x6'));var util=require(_0x4bf8('0x7'));var path=require(_0x4bf8('0x8'));var sox=require(_0x4bf8('0x9'));var csv=require(_0x4bf8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bf8('0xb'));var _=require('lodash');var squel=require(_0x4bf8('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bf8('0xd'));var deskjs=require(_0x4bf8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4bf8('0xf'));var Papa=require(_0x4bf8('0x10'));var Redis=require(_0x4bf8('0x11'));var authService=require(_0x4bf8('0x12'));var qs=require(_0x4bf8('0x13'));var as=require(_0x4bf8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bf8('0x15'))(_0x4bf8('0x16'));var utils=require('../../config/utils');var config=require(_0x4bf8('0x17'));var licenseUtil=require(_0x4bf8('0x18'));var db=require(_0x4bf8('0x19'))['db'];function respondWithStatusCode(_0x2492ec,_0x30392e){_0x30392e=_0x30392e||0xcc;return function(_0x5d743c){if(_0x5d743c){return _0x2492ec[_0x4bf8('0x1a')](_0x30392e);}return _0x2492ec['status'](_0x30392e)['end']();};}function respondWithResult(_0x5dcd2c,_0x279bfe){_0x279bfe=_0x279bfe||0xc8;return function(_0x534099){if(_0x534099){return _0x5dcd2c[_0x4bf8('0x1b')](_0x279bfe)[_0x4bf8('0x1c')](_0x534099);}};}function respondWithFilteredResult(_0x396e19,_0x5f39f5){return function(_0x3db8c8){if(_0x3db8c8){var _0x49db5c=typeof _0x5f39f5['offset']==='undefined'&&typeof _0x5f39f5[_0x4bf8('0x1d')]===_0x4bf8('0x1e');var _0x18060f=_0x3db8c8['count'];var _0x50ff1=_0x49db5c?0x0:_0x5f39f5[_0x4bf8('0x1f')];var _0x59c12f=_0x49db5c?_0x3db8c8[_0x4bf8('0x20')]:_0x5f39f5[_0x4bf8('0x1f')]+_0x5f39f5[_0x4bf8('0x1d')];var _0x4761da;if(_0x59c12f>=_0x18060f){_0x59c12f=_0x18060f;_0x4761da=0xc8;}else{_0x4761da=0xce;}_0x396e19[_0x4bf8('0x1b')](_0x4761da);return _0x396e19['set']('Content-Range',_0x50ff1+'-'+_0x59c12f+'/'+_0x18060f)[_0x4bf8('0x1c')](_0x3db8c8);}return null;};}function patchUpdates(_0x43fef6){return function(_0x5aabe1){try{jsonpatch[_0x4bf8('0x21')](_0x5aabe1,_0x43fef6,!![]);}catch(_0x5161b0){return BPromise[_0x4bf8('0x22')](_0x5161b0);}return _0x5aabe1['save']();};}function saveUpdates(_0x4fd457,_0x35323a){return function(_0x4acf97){if(_0x4acf97){return _0x4acf97['update'](_0x4fd457)[_0x4bf8('0x23')](function(_0x5b7047){return _0x5b7047;});}return null;};}function removeEntity(_0xa7cd65,_0x4b0f6e){return function(_0x1371fe){if(_0x1371fe){return _0x1371fe['destroy']()[_0x4bf8('0x23')](function(){_0xa7cd65[_0x4bf8('0x1b')](0xcc)[_0x4bf8('0x24')]();});}};}function handleEntityNotFound(_0x508992,_0xa75382){return function(_0x55f295){if(!_0x55f295){_0x508992['sendStatus'](0x194);}return _0x55f295;};}function handleError(_0xad716e,_0x420036){_0x420036=_0x420036||0x1f4;return function(_0x1b4da7){logger['error'](_0x1b4da7[_0x4bf8('0x25')]);if(_0x1b4da7[_0x4bf8('0x26')]){delete _0x1b4da7[_0x4bf8('0x26')];}_0xad716e[_0x4bf8('0x1b')](_0x420036)[_0x4bf8('0x27')](_0x1b4da7);};}exports[_0x4bf8('0x28')]=function(_0x2a3e7a,_0x3cb708){var _0xe3ece={},_0x4229bd={},_0xcfe892={'count':0x0,'rows':[]};var _0x763682=_[_0x4bf8('0x29')](db[_0x4bf8('0x2a')]['rawAttributes'],function(_0x33028d){return{'name':_0x33028d[_0x4bf8('0x2b')],'type':_0x33028d['type']['key']};});_0x4229bd['model']=_[_0x4bf8('0x29')](_0x763682,_0x4bf8('0x26'));_0x4229bd[_0x4bf8('0x2c')]=_[_0x4bf8('0x2d')](_0x2a3e7a[_0x4bf8('0x2c')]);_0x4229bd[_0x4bf8('0x2e')]=_[_0x4bf8('0x2f')](_0x4229bd[_0x4bf8('0x30')],_0x4229bd['query']);_0xe3ece[_0x4bf8('0x31')]=_[_0x4bf8('0x2f')](_0x4229bd['model'],qs[_0x4bf8('0x32')](_0x2a3e7a[_0x4bf8('0x2c')]['fields']));_0xe3ece['attributes']=_0xe3ece['attributes']['length']?_0xe3ece[_0x4bf8('0x31')]:_0x4229bd[_0x4bf8('0x30')];if(!_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x33')](_0x4bf8('0x34'))){_0xe3ece['limit']=qs['limit'](_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x1d')]);_0xe3ece['offset']=qs[_0x4bf8('0x1f')](_0x2a3e7a[_0x4bf8('0x2c')]['offset']);}_0xe3ece['order']=qs[_0x4bf8('0x35')](_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x35')]);_0xe3ece['where']=qs[_0x4bf8('0x2e')](_[_0x4bf8('0x36')](_0x2a3e7a[_0x4bf8('0x2c')],_0x4229bd[_0x4bf8('0x2e')]),_0x763682);if(_0x2a3e7a[_0x4bf8('0x2c')]['filter']){_0xe3ece[_0x4bf8('0x37')]=_[_0x4bf8('0x38')](_0xe3ece[_0x4bf8('0x37')],{'$or':_[_0x4bf8('0x29')](_0x763682,function(_0x355add){if(_0x355add['type']!==_0x4bf8('0x39')){var _0x61909e={};_0x61909e[_0x355add[_0x4bf8('0x26')]]={'$like':'%'+_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x3a')]+'%'};return _0x61909e;}})});}_0xe3ece=_['merge']({},_0xe3ece,_0x2a3e7a['options']);var _0x3f09c5={'where':_0xe3ece['where']};return db[_0x4bf8('0x2a')][_0x4bf8('0x20')](_0x3f09c5)['then'](function(_0x732401){_0xcfe892[_0x4bf8('0x20')]=_0x732401;if(_0x2a3e7a[_0x4bf8('0x2c')]['includeAll']){_0xe3ece[_0x4bf8('0x3b')]=[{'all':!![]}];}return db[_0x4bf8('0x2a')][_0x4bf8('0x3c')](_0xe3ece);})['then'](function(_0x35c836){_0xcfe892['rows']=_0x35c836;return _0xcfe892;})[_0x4bf8('0x23')](respondWithFilteredResult(_0x3cb708,_0xe3ece))[_0x4bf8('0x3d')](handleError(_0x3cb708,null));};exports[_0x4bf8('0x3e')]=function(_0xe24a33,_0x52913b){var _0x49668a={'raw':!![],'where':{'id':_0xe24a33['params']['id']}},_0x36002e={};_0x36002e[_0x4bf8('0x30')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x36002e[_0x4bf8('0x2c')]=_['keys'](_0xe24a33['query']);_0x36002e[_0x4bf8('0x2e')]=_['intersection'](_0x36002e['model'],_0x36002e['query']);_0x49668a[_0x4bf8('0x31')]=_[_0x4bf8('0x2f')](_0x36002e['model'],qs['fields'](_0xe24a33[_0x4bf8('0x2c')][_0x4bf8('0x32')]));_0x49668a[_0x4bf8('0x31')]=_0x49668a[_0x4bf8('0x31')]['length']?_0x49668a[_0x4bf8('0x31')]:_0x36002e['model'];if(_0xe24a33[_0x4bf8('0x2c')][_0x4bf8('0x3f')]){_0x49668a[_0x4bf8('0x3b')]=[{'all':!![]}];}_0x49668a=_[_0x4bf8('0x38')]({},_0x49668a,_0xe24a33[_0x4bf8('0x40')]);return db[_0x4bf8('0x2a')][_0x4bf8('0x41')](_0x49668a)[_0x4bf8('0x23')](handleEntityNotFound(_0x52913b,null))[_0x4bf8('0x23')](respondWithResult(_0x52913b,null))[_0x4bf8('0x3d')](handleError(_0x52913b,null));};exports[_0x4bf8('0x42')]=function(_0x24f4bd,_0x16211e){return db[_0x4bf8('0x2a')][_0x4bf8('0x42')](_0x24f4bd[_0x4bf8('0x43')],{})[_0x4bf8('0x23')](respondWithResult(_0x16211e,0xc9))[_0x4bf8('0x3d')](handleError(_0x16211e,null));};exports[_0x4bf8('0x44')]=function(_0x6cb2e8,_0x1a4d51){if(_0x6cb2e8[_0x4bf8('0x43')]['id']){delete _0x6cb2e8[_0x4bf8('0x43')]['id'];}return db[_0x4bf8('0x2a')][_0x4bf8('0x41')]({'where':{'id':_0x6cb2e8['params']['id']}})[_0x4bf8('0x23')](handleEntityNotFound(_0x1a4d51,null))[_0x4bf8('0x23')](saveUpdates(_0x6cb2e8['body'],null))[_0x4bf8('0x23')](respondWithResult(_0x1a4d51,null))[_0x4bf8('0x3d')](handleError(_0x1a4d51,null));};exports[_0x4bf8('0x45')]=function(_0x18fe83,_0x40a281){return db[_0x4bf8('0x2a')]['find']({'where':{'id':_0x18fe83[_0x4bf8('0x46')]['id']}})[_0x4bf8('0x23')](handleEntityNotFound(_0x40a281,null))[_0x4bf8('0x23')](removeEntity(_0x40a281,null))['catch'](handleError(_0x40a281,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 19db476..42503be 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 _0xc3b6=['request-promise','rimraf','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4611db,_0x37b5e8){var _0x22bdae=function(_0x47d7f6){while(--_0x47d7f6){_0x4611db['push'](_0x4611db['shift']());}};_0x22bdae(++_0x37b5e8);}(_0xc3b6,0x183));var _0x6c3b=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xc3b6[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x6c3b('0x0'));var util=require(_0x6c3b('0x1'));var logger=require(_0x6c3b('0x2'))(_0x6c3b('0x3'));var moment=require(_0x6c3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x6c3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c3b('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x6c3b('0x7')]=function(_0x55d2af,_0x4e6bff){return _0x55d2af[_0x6c3b('0x8')](_0x6c3b('0x9'),attributes,{'tableName':_0x6c3b('0xa'),'paranoid':![],'indexes':[{'name':_0x6c3b('0xb'),'fields':[_0x6c3b('0xc'),_0x6c3b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2431=['./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x329b20,_0x150da7){var _0x1d36ca=function(_0x535c63){while(--_0x535c63){_0x329b20['push'](_0x329b20['shift']());}};_0x1d36ca(++_0x150da7);}(_0x2431,0xf5));var _0x1243=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x2431[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x1243('0x0'));var logger=require('../../config/logger')(_0x1243('0x1'));var moment=require(_0x1243('0x2'));var BPromise=require(_0x1243('0x3'));var rp=require(_0x1243('0x4'));var fs=require('fs');var path=require(_0x1243('0x5'));var rimraf=require('rimraf');var config=require(_0x1243('0x6'));var attributes=require(_0x1243('0x7'));module[_0x1243('0x8')]=function(_0x387ea2,_0x3ad55a){return _0x387ea2['define']('ZendeskField',attributes,{'tableName':_0x1243('0x9'),'paranoid':![],'indexes':[{'name':_0x1243('0xa'),'fields':[_0x1243('0xb'),'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 d4c4310..46c8917 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 _0x7f71=['error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0x7f71,0x88));var _0x17f7=function(_0x312cd8,_0x426245){_0x312cd8=_0x312cd8-0x0;var _0x137254=_0x7f71[_0x312cd8];return _0x137254;};'use strict';var _=require(_0x17f7('0x0'));var util=require(_0x17f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17f7('0x2'));var fs=require('fs');var Redis=require(_0x17f7('0x3'));var db=require(_0x17f7('0x4'))['db'];var utils=require(_0x17f7('0x5'));var logger=require(_0x17f7('0x6'))(_0x17f7('0x7'));var config=require(_0x17f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17f7('0x9')][_0x17f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1488b1,_0x5e71ce,_0x3c1cf8){return new BPromise(function(_0x5c2404,_0x4486d3){return client[_0x17f7('0xb')](_0x1488b1,_0x3c1cf8)['then'](function(_0x3594be){logger[_0x17f7('0xc')](_0x17f7('0xd'),_0x5e71ce,'request\x20sent');logger['debug'](_0x17f7('0xe'),_0x5e71ce,_0x17f7('0xf'),JSON['stringify'](_0x3594be));if(_0x3594be[_0x17f7('0x10')]){if(_0x3594be[_0x17f7('0x10')][_0x17f7('0x11')]===0x1f4){logger[_0x17f7('0x10')](_0x17f7('0xd'),_0x5e71ce,_0x3594be['error'][_0x17f7('0x12')]);return _0x4486d3(_0x3594be[_0x17f7('0x10')][_0x17f7('0x12')]);}logger[_0x17f7('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5e71ce,_0x3594be[_0x17f7('0x10')]['message']);return _0x5c2404(_0x3594be[_0x17f7('0x10')][_0x17f7('0x12')]);}else{logger[_0x17f7('0xc')](_0x17f7('0xd'),_0x5e71ce,_0x17f7('0xf'));_0x5c2404(_0x3594be['result'][_0x17f7('0x12')]);}})['catch'](function(_0x1f52e3){logger[_0x17f7('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5e71ce,_0x1f52e3);_0x4486d3(_0x1f52e3);});});} \ No newline at end of file +var _0xcc68=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5cdc72,_0x206d93){var _0x36a6c6=function(_0x3b3148){while(--_0x3b3148){_0x5cdc72['push'](_0x5cdc72['shift']());}};_0x36a6c6(++_0x206d93);}(_0xcc68,0x127));var _0x8cc6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcc68[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x8cc6('0x0'));var util=require(_0x8cc6('0x1'));var moment=require(_0x8cc6('0x2'));var BPromise=require(_0x8cc6('0x3'));var rs=require(_0x8cc6('0x4'));var fs=require('fs');var Redis=require(_0x8cc6('0x5'));var db=require(_0x8cc6('0x6'))['db'];var utils=require(_0x8cc6('0x7'));var logger=require(_0x8cc6('0x8'))(_0x8cc6('0x9'));var config=require('../../config/environment');var jayson=require(_0x8cc6('0xa'));var client=jayson[_0x8cc6('0xb')][_0x8cc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2909a9,_0x3bd4da,_0x97583c){return new BPromise(function(_0xa6a409,_0x7bf1f3){return client[_0x8cc6('0xd')](_0x2909a9,_0x97583c)[_0x8cc6('0xe')](function(_0x31d2ae){logger[_0x8cc6('0xf')](_0x8cc6('0x10'),_0x3bd4da,'request\x20sent');logger[_0x8cc6('0x11')](_0x8cc6('0x12'),_0x3bd4da,_0x8cc6('0x13'),JSON[_0x8cc6('0x14')](_0x31d2ae));if(_0x31d2ae[_0x8cc6('0x15')]){if(_0x31d2ae['error'][_0x8cc6('0x16')]===0x1f4){logger[_0x8cc6('0x15')](_0x8cc6('0x10'),_0x3bd4da,_0x31d2ae[_0x8cc6('0x15')][_0x8cc6('0x17')]);return _0x7bf1f3(_0x31d2ae[_0x8cc6('0x15')]['message']);}logger[_0x8cc6('0x15')]('ZendeskField,\x20%s,\x20%s',_0x3bd4da,_0x31d2ae['error'][_0x8cc6('0x17')]);return _0xa6a409(_0x31d2ae[_0x8cc6('0x15')][_0x8cc6('0x17')]);}else{logger[_0x8cc6('0xf')](_0x8cc6('0x10'),_0x3bd4da,'request\x20sent');_0xa6a409(_0x31d2ae[_0x8cc6('0x18')][_0x8cc6('0x17')]);}})[_0x8cc6('0x19')](function(_0x50ff00){logger[_0x8cc6('0x15')](_0x8cc6('0x10'),_0x3bd4da,_0x50ff00);_0x7bf1f3(_0x50ff00);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 61f992d..a25dcb9 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 _0x5020=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bfd03,_0x4139f5){var _0x1bcbd5=function(_0x36ee08){while(--_0x36ee08){_0x1bfd03['push'](_0x1bfd03['shift']());}};_0x1bcbd5(++_0x4139f5);}(_0x5020,0x183));var _0x0502=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5020[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0502('0x0'));var util=require(_0x0502('0x1'));var path=require(_0x0502('0x2'));var timeout=require('connect-timeout');var express=require(_0x0502('0x3'));var router=express[_0x0502('0x4')]();var fs_extra=require(_0x0502('0x5'));var auth=require(_0x0502('0x6'));var interaction=require(_0x0502('0x7'));var config=require(_0x0502('0x8'));var controller=require('./intZohoAccount.controller');router[_0x0502('0x9')]('/',auth[_0x0502('0xa')](),controller[_0x0502('0xb')]);router[_0x0502('0x9')](_0x0502('0xc'),auth['isAuthenticated'](),controller[_0x0502('0xd')]);router[_0x0502('0x9')](_0x0502('0xe'),auth[_0x0502('0xa')](),controller['getConfigurations']);router['get'](_0x0502('0xf'),auth[_0x0502('0xa')](),controller[_0x0502('0x10')]);router['post']('/',auth[_0x0502('0xa')](),controller[_0x0502('0x11')]);router['post'](_0x0502('0xe'),auth[_0x0502('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0x0502('0xa')](),controller[_0x0502('0x12')]);router[_0x0502('0x13')]('/:id',auth[_0x0502('0xa')](),controller[_0x0502('0x14')]);module[_0x0502('0x15')]=router; \ No newline at end of file +var _0x0802=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x554ac7,_0x45f062){var _0x549754=function(_0xf8f87e){while(--_0xf8f87e){_0x554ac7['push'](_0x554ac7['shift']());}};_0x549754(++_0x45f062);}(_0x0802,0x16d));var _0x2080=function(_0x41a1d2,_0x3e92c6){_0x41a1d2=_0x41a1d2-0x0;var _0x341ce2=_0x0802[_0x41a1d2];return _0x341ce2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2080('0x0'));var timeout=require(_0x2080('0x1'));var express=require(_0x2080('0x2'));var router=express['Router']();var fs_extra=require(_0x2080('0x3'));var auth=require(_0x2080('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x2080('0x5')]('/',auth[_0x2080('0x6')](),controller[_0x2080('0x7')]);router[_0x2080('0x5')](_0x2080('0x8'),auth[_0x2080('0x6')](),controller[_0x2080('0x9')]);router[_0x2080('0x5')](_0x2080('0xa'),auth[_0x2080('0x6')](),controller[_0x2080('0xb')]);router['get'](_0x2080('0xc'),auth[_0x2080('0x6')](),controller['getFields']);router[_0x2080('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2080('0xd')](_0x2080('0xa'),auth[_0x2080('0x6')](),controller[_0x2080('0xe')]);router[_0x2080('0xf')](_0x2080('0x8'),auth[_0x2080('0x6')](),controller[_0x2080('0x10')]);router[_0x2080('0x11')](_0x2080('0x8'),auth[_0x2080('0x6')](),controller[_0x2080('0x12')]);module[_0x2080('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4c51e4a..99eb2e1 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 _0xe5b3=['STRING','exports'];(function(_0x32ce61,_0x1baeb5){var _0x47dcff=function(_0x121966){while(--_0x121966){_0x32ce61['push'](_0x32ce61['shift']());}};_0x47dcff(++_0x1baeb5);}(_0xe5b3,0x133));var _0x3e5b=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0xe5b3[_0x617084];return _0x384ac0;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0x5c12=['exports','STRING'];(function(_0xbbc3f3,_0x51b215){var _0x403bb7=function(_0x320db2){while(--_0x320db2){_0xbbc3f3['push'](_0xbbc3f3['shift']());}};_0x403bb7(++_0x51b215);}(_0x5c12,0x188));var _0x25c1=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x5c12[_0x4001ad];return _0x4c7ec2;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'name':{'type':Sequelize[_0x25c1('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x25c1('0x1')]},'zone':{'type':Sequelize[_0x25c1('0x1')]},'clientId':{'type':Sequelize[_0x25c1('0x1')]},'clientSecret':{'type':Sequelize[_0x25c1('0x1')]},'serverUrl':{'type':Sequelize[_0x25c1('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x25c1('0x1')]},'refreshToken':{'type':Sequelize[_0x25c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a4e8479..5cee0b8 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 _0x8f3e=['AccountId','Subjects','getSubjects','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','zone','serverUrl','code','refreshToken','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','send','map','ZohoAccount','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','getConfigurations','addConfiguration'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x8f3e,0xb9));var _0xe8f3=function(_0x549965,_0x2e7360){_0x549965=_0x549965-0x0;var _0x463a17=_0x8f3e[_0x549965];return _0x463a17;};'use strict';var emlformat=require(_0xe8f3('0x0'));var rimraf=require(_0xe8f3('0x1'));var zipdir=require(_0xe8f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8f3('0x3'));var BPromise=require(_0xe8f3('0x4'));var Mustache=require('mustache');var util=require(_0xe8f3('0x5'));var path=require(_0xe8f3('0x6'));var sox=require(_0xe8f3('0x7'));var csv=require(_0xe8f3('0x8'));var ejs=require(_0xe8f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8f3('0xa'));var squel=require(_0xe8f3('0xb'));var crypto=require(_0xe8f3('0xc'));var jsforce=require(_0xe8f3('0xd'));var deskjs=require(_0xe8f3('0xe'));var toCsv=require(_0xe8f3('0x8'));var querystring=require(_0xe8f3('0xf'));var Papa=require(_0xe8f3('0x10'));var Redis=require(_0xe8f3('0x11'));var authService=require(_0xe8f3('0x12'));var qs=require(_0xe8f3('0x13'));var as=require(_0xe8f3('0x14'));var hardwareService=require(_0xe8f3('0x15'));var logger=require('../../config/logger')(_0xe8f3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe8f3('0x17'));var db=require(_0xe8f3('0x18'))['db'];var integrations=require(_0xe8f3('0x19'));function respondWithStatusCode(_0x310114,_0x55c277){_0x55c277=_0x55c277||0xcc;return function(_0x43fd53){if(_0x43fd53){return _0x310114[_0xe8f3('0x1a')](_0x55c277);}return _0x310114[_0xe8f3('0x1b')](_0x55c277)['end']();};}function respondWithResult(_0x515190,_0x834f62){_0x834f62=_0x834f62||0xc8;return function(_0x27fd5b){if(_0x27fd5b){return _0x515190['status'](_0x834f62)[_0xe8f3('0x1c')](_0x27fd5b);}};}function respondWithFilteredResult(_0x57a5ad,_0x279880){return function(_0x14e062){if(_0x14e062){var _0x5aa57f=typeof _0x279880[_0xe8f3('0x1d')]==='undefined'&&typeof _0x279880[_0xe8f3('0x1e')]===_0xe8f3('0x1f');var _0x5ca67a=_0x14e062[_0xe8f3('0x20')];var _0x3feab9=_0x5aa57f?0x0:_0x279880[_0xe8f3('0x1d')];var _0x94939e=_0x5aa57f?_0x14e062[_0xe8f3('0x20')]:_0x279880[_0xe8f3('0x1d')]+_0x279880[_0xe8f3('0x1e')];var _0x48e6f2;if(_0x94939e>=_0x5ca67a){_0x94939e=_0x5ca67a;_0x48e6f2=0xc8;}else{_0x48e6f2=0xce;}_0x57a5ad[_0xe8f3('0x1b')](_0x48e6f2);return _0x57a5ad[_0xe8f3('0x21')](_0xe8f3('0x22'),_0x3feab9+'-'+_0x94939e+'/'+_0x5ca67a)['json'](_0x14e062);}return null;};}function patchUpdates(_0x453b14){return function(_0x2f6f39){try{jsonpatch[_0xe8f3('0x23')](_0x2f6f39,_0x453b14,!![]);}catch(_0x28efd8){return BPromise[_0xe8f3('0x24')](_0x28efd8);}return _0x2f6f39[_0xe8f3('0x25')]();};}function saveUpdates(_0x24dd46,_0x1834e6){return function(_0x3b34e7){if(_0x3b34e7){return _0x3b34e7['update'](_0x24dd46)[_0xe8f3('0x26')](function(_0x3949c3){return _0x3949c3;});}return null;};}function removeEntity(_0x4cfd7e,_0x4caee1){return function(_0x322372){if(_0x322372){return _0x322372[_0xe8f3('0x27')]()[_0xe8f3('0x26')](function(){_0x4cfd7e[_0xe8f3('0x1b')](0xcc)[_0xe8f3('0x28')]();});}};}function handleEntityNotFound(_0x152148,_0x72a824){return function(_0x518db0){if(!_0x518db0){_0x152148['sendStatus'](0x194);}return _0x518db0;};}function handleError(_0x549c26,_0x21699e){_0x21699e=_0x21699e||0x1f4;return function(_0x215b46){logger['error'](_0x215b46[_0xe8f3('0x29')]);if(_0x215b46['name']){delete _0x215b46['name'];}_0x549c26[_0xe8f3('0x1b')](_0x21699e)[_0xe8f3('0x2a')](_0x215b46);};}exports['index']=function(_0x160d19,_0x1c928a){var _0x2cb782={},_0x1e0d12={},_0x1c1df2={'count':0x0,'rows':[]};var _0x5bffe5=_[_0xe8f3('0x2b')](db[_0xe8f3('0x2c')][_0xe8f3('0x2d')],function(_0x23e0c2){return{'name':_0x23e0c2[_0xe8f3('0x2e')],'type':_0x23e0c2[_0xe8f3('0x2f')][_0xe8f3('0x30')]};});_0x1e0d12['model']=_[_0xe8f3('0x2b')](_0x5bffe5,_0xe8f3('0x31'));_0x1e0d12[_0xe8f3('0x32')]=_[_0xe8f3('0x33')](_0x160d19[_0xe8f3('0x32')]);_0x1e0d12[_0xe8f3('0x34')]=_[_0xe8f3('0x35')](_0x1e0d12['model'],_0x1e0d12[_0xe8f3('0x32')]);_0x2cb782[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x1e0d12[_0xe8f3('0x37')],qs['fields'](_0x160d19['query'][_0xe8f3('0x38')]));_0x2cb782['attributes']=_0x2cb782[_0xe8f3('0x36')][_0xe8f3('0x39')]?_0x2cb782['attributes']:_0x1e0d12[_0xe8f3('0x37')];if(!_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x3a')](_0xe8f3('0x3b'))){_0x2cb782[_0xe8f3('0x1e')]=qs['limit'](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x1e')]);_0x2cb782[_0xe8f3('0x1d')]=qs[_0xe8f3('0x1d')](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x1d')]);}_0x2cb782[_0xe8f3('0x3c')]=qs[_0xe8f3('0x3d')](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x3d')]);_0x2cb782['where']=qs[_0xe8f3('0x34')](_[_0xe8f3('0x3e')](_0x160d19['query'],_0x1e0d12[_0xe8f3('0x34')]),_0x5bffe5);if(_0x160d19['query']['filter']){_0x2cb782[_0xe8f3('0x3f')]=_[_0xe8f3('0x40')](_0x2cb782[_0xe8f3('0x3f')],{'$or':_['map'](_0x5bffe5,function(_0x1b2547){if(_0x1b2547[_0xe8f3('0x2f')]!==_0xe8f3('0x41')){var _0x292e5a={};_0x292e5a[_0x1b2547[_0xe8f3('0x31')]]={'$like':'%'+_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x42')]+'%'};return _0x292e5a;}})});}_0x2cb782=_['merge']({},_0x2cb782,_0x160d19[_0xe8f3('0x43')]);var _0xde8b1d={'where':_0x2cb782[_0xe8f3('0x3f')]};return db[_0xe8f3('0x2c')][_0xe8f3('0x20')](_0xde8b1d)[_0xe8f3('0x26')](function(_0x1d3994){_0x1c1df2['count']=_0x1d3994;if(_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x44')]){_0x2cb782[_0xe8f3('0x45')]=[{'all':!![]}];}return db[_0xe8f3('0x2c')][_0xe8f3('0x46')](_0x2cb782);})[_0xe8f3('0x26')](function(_0x3acc4a){_0x1c1df2[_0xe8f3('0x47')]=_0x3acc4a;return _0x1c1df2;})[_0xe8f3('0x26')](respondWithFilteredResult(_0x1c928a,_0x2cb782))[_0xe8f3('0x48')](handleError(_0x1c928a,null));};exports[_0xe8f3('0x49')]=function(_0x15d2c0,_0x2a3760){var _0x58aa50={'raw':![],'where':{'id':_0x15d2c0[_0xe8f3('0x4a')]['id']}},_0x1c78ad={};_0x1c78ad[_0xe8f3('0x37')]=_[_0xe8f3('0x33')](db[_0xe8f3('0x2c')][_0xe8f3('0x2d')]);_0x1c78ad[_0xe8f3('0x32')]=_['keys'](_0x15d2c0[_0xe8f3('0x32')]);_0x1c78ad['filters']=_[_0xe8f3('0x35')](_0x1c78ad[_0xe8f3('0x37')],_0x1c78ad[_0xe8f3('0x32')]);_0x58aa50[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x1c78ad[_0xe8f3('0x37')],qs[_0xe8f3('0x38')](_0x15d2c0[_0xe8f3('0x32')][_0xe8f3('0x38')]));_0x58aa50['attributes']=_0x58aa50['attributes'][_0xe8f3('0x39')]?_0x58aa50[_0xe8f3('0x36')]:_0x1c78ad[_0xe8f3('0x37')];if(_0x15d2c0[_0xe8f3('0x32')]['includeAll']){_0x58aa50[_0xe8f3('0x45')]=[{'all':!![]}];}_0x58aa50=_[_0xe8f3('0x40')]({},_0x58aa50,_0x15d2c0[_0xe8f3('0x43')]);return db[_0xe8f3('0x2c')]['find'](_0x58aa50)[_0xe8f3('0x26')](handleEntityNotFound(_0x2a3760,null))[_0xe8f3('0x26')](respondWithResult(_0x2a3760,null))[_0xe8f3('0x48')](handleError(_0x2a3760,null));};exports[_0xe8f3('0x4b')]=function(_0x263b73,_0x1366e6){return db[_0xe8f3('0x2c')][_0xe8f3('0x4b')](_0x263b73[_0xe8f3('0x4c')],{})[_0xe8f3('0x26')](respondWithResult(_0x1366e6,0xc9))['catch'](handleError(_0x1366e6,null));};exports['update']=function(_0x89e066,_0x321a7d){if(_0x89e066['body']['id']){delete _0x89e066[_0xe8f3('0x4c')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x89e066[_0xe8f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x321a7d,null))['then'](saveUpdates(_0x89e066[_0xe8f3('0x4c')],null))[_0xe8f3('0x26')](respondWithResult(_0x321a7d,null))[_0xe8f3('0x48')](handleError(_0x321a7d,null));};exports[_0xe8f3('0x27')]=function(_0x2ff050,_0xd6f81b){return db['ZohoAccount'][_0xe8f3('0x4d')]({'where':{'id':_0x2ff050['params']['id']}})[_0xe8f3('0x26')](handleEntityNotFound(_0xd6f81b,null))[_0xe8f3('0x26')](removeEntity(_0xd6f81b,null))[_0xe8f3('0x48')](handleError(_0xd6f81b,null));};exports['getConfigurations']=function(_0x419aea,_0x1639fd,_0x4c8e00){var _0x16cec1={};var _0x18f3e9={};var _0x375347;var _0x7f7930;return db['ZohoAccount'][_0xe8f3('0x4e')]({'where':{'id':_0x419aea[_0xe8f3('0x4a')]['id']}})[_0xe8f3('0x26')](handleEntityNotFound(_0x1639fd,null))[_0xe8f3('0x26')](function(_0x81f1f6){if(_0x81f1f6){_0x375347=_0x81f1f6;_0x18f3e9['model']=_['keys'](db['ZohoConfiguration'][_0xe8f3('0x2d')]);_0x18f3e9[_0xe8f3('0x32')]=_[_0xe8f3('0x33')](_0x419aea[_0xe8f3('0x32')]);_0x18f3e9[_0xe8f3('0x34')]=_[_0xe8f3('0x35')](_0x18f3e9[_0xe8f3('0x37')],_0x18f3e9[_0xe8f3('0x32')]);_0x16cec1[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x18f3e9[_0xe8f3('0x37')],qs[_0xe8f3('0x38')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x38')]));_0x16cec1[_0xe8f3('0x36')]=_0x16cec1[_0xe8f3('0x36')][_0xe8f3('0x39')]?_0x16cec1[_0xe8f3('0x36')]:_0x18f3e9['model'];_0x16cec1[_0xe8f3('0x3c')]=qs[_0xe8f3('0x3d')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x3d')]);_0x16cec1['where']=qs['filters'](_['pick'](_0x419aea[_0xe8f3('0x32')],_0x18f3e9[_0xe8f3('0x34')]));if(_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x42')]){_0x16cec1[_0xe8f3('0x3f')]=_[_0xe8f3('0x40')](_0x16cec1['where'],{'$or':_['map'](_0x16cec1['attributes'],function(_0x8c7abd){var _0x5d64c9={};_0x5d64c9[_0x8c7abd]={'$like':'%'+_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x42')]+'%'};return _0x5d64c9;})});}_0x16cec1=_['merge']({},_0x16cec1,_0x419aea[_0xe8f3('0x43')]);return _0x375347[_0xe8f3('0x4f')](_0x16cec1);}})['then'](function(_0x2bfe25){if(_0x2bfe25){_0x7f7930=_0x2bfe25['length'];if(!_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x3a')](_0xe8f3('0x3b'))){_0x16cec1[_0xe8f3('0x1e')]=qs[_0xe8f3('0x1e')](_0x419aea['query'][_0xe8f3('0x1e')]);_0x16cec1[_0xe8f3('0x1d')]=qs[_0xe8f3('0x1d')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x1d')]);}return _0x375347['getConfigurations'](_0x16cec1);}})[_0xe8f3('0x26')](function(_0x273f76){if(_0x273f76){return _0x273f76?{'count':_0x7f7930,'rows':_0x273f76}:null;}})[_0xe8f3('0x26')](respondWithResult(_0x1639fd,null))[_0xe8f3('0x48')](handleError(_0x1639fd,null));};exports[_0xe8f3('0x50')]=function(_0x3f2389,_0x4890ea,_0x2799aa){if(_0x3f2389[_0xe8f3('0x4c')]['id']){delete _0x3f2389['body']['id'];}return db[_0xe8f3('0x2c')]['findOne']({'where':{'id':_0x3f2389[_0xe8f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4890ea,null))['then'](function(_0x40d551){if(_0x40d551){_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x51')]=_0x40d551['id'];_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x52')]=integrations[_0xe8f3('0x53')](_0x3f2389[_0xe8f3('0x4c')]['channel'],_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x2f')]);_0x3f2389[_0xe8f3('0x4c')]['Descriptions']=integrations[_0xe8f3('0x54')](_0x3f2389[_0xe8f3('0x4c')]['channel'],_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x2f')]);return db[_0xe8f3('0x55')][_0xe8f3('0x4b')](_0x3f2389['body'],{'include':[{'model':db[_0xe8f3('0x56')],'as':_0xe8f3('0x52')},{'model':db[_0xe8f3('0x56')],'as':_0xe8f3('0x57')}]});}return null;})[_0xe8f3('0x26')](respondWithResult(_0x4890ea,null))['catch'](handleError(_0x4890ea,null));};function getAccessToken(_0x2a959d){return new Promise(function(_0x256794,_0x2f401a){var _0xc60b5d;switch(_0x2a959d['zone']){case'US':_0xc60b5d=_0xe8f3('0x58');break;case'AU':_0xc60b5d=_0xe8f3('0x59');break;case'EU':_0xc60b5d=_0xe8f3('0x5a');break;case'IN':_0xc60b5d='https://accounts.zoho.in';break;case'CN':_0xc60b5d=_0xe8f3('0x5b');break;default:_0xc60b5d=_0xe8f3('0x5a');break;}var _0x496c22={'method':_0xe8f3('0x5c'),'uri':_0xc60b5d+_0xe8f3('0x5d'),'qs':{'refresh_token':_0x2a959d['refreshToken'],'client_id':_0x2a959d[_0xe8f3('0x5e')],'client_secret':_0x2a959d[_0xe8f3('0x5f')],'grant_type':_0xe8f3('0x60')},'json':!![]};return rp(_0x496c22)[_0xe8f3('0x26')](function(_0x2e83f6){if(_0x2e83f6['access_token']){_0x256794(_0x2e83f6[_0xe8f3('0x61')]);}else{_0x2f401a(_0xe8f3('0x62'));}})['catch'](function(_0x3f3887){_0x2f401a(_0x3f3887);});});}exports['getFields']=function(_0xbd5ac4,_0x29e994,_0x2d609e){var _0x4a4de6,_0xa73213,_0x3f185d,_0x44b27d,_0x2a9001;return db[_0xe8f3('0x2c')][_0xe8f3('0x4e')]({'where':{'id':_0xbd5ac4[_0xe8f3('0x4a')]['id']},'attributes':['id','host',_0xe8f3('0x63'),_0xe8f3('0x5e'),'clientSecret',_0xe8f3('0x64'),_0xe8f3('0x65'),_0xe8f3('0x66')]})[_0xe8f3('0x26')](handleEntityNotFound(_0x29e994,null))[_0xe8f3('0x26')](function(_0x24ee67){_0x2a9001=_0x24ee67;_0x4a4de6=_0x2a9001[_0xe8f3('0x67')];_0xa73213=_0x4a4de6===_0xe8f3('0x68')?'eu':_0xe8f3('0x69');_0x3f185d=_0x2a9001[_0xe8f3('0x64')];var _0x39723f=_0x3f185d[_0xe8f3('0x6a')](-0x1);if(_0x39723f==='/'||_0x39723f==='\x5c'||_0x39723f===':'){_0x3f185d=_0x3f185d['substring'](0x0,_0x3f185d[_0xe8f3('0x6b')](_0x39723f));}if(!_0x2a9001[_0xe8f3('0x66')]){throw new Error(_0xe8f3('0x6c'));}return getAccessToken(_0x2a9001);})[_0xe8f3('0x26')](function(_0x3369a0){if(_0x3369a0){return rp({'method':'GET','uri':util[_0xe8f3('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xa73213),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3369a0},'json':!![]});}})[_0xe8f3('0x26')](function(_0x4dc850){if(_0x4dc850){if(_0x4dc850[_0xe8f3('0x6e')]&&_0x4dc850[_0xe8f3('0x6e')][_0xe8f3('0x6f')]){throw new Error(_0x4dc850[_0xe8f3('0x6e')][_0xe8f3('0x6f')][_0xe8f3('0x70')]);}var _0x6ee9a8=[];var _0x1f1575=[];var _0x5ab124=[_0xe8f3('0x71'),'Subject',_0xe8f3('0x72'),_0xe8f3('0x73'),_0xe8f3('0x74'),_0xe8f3('0x75'),_0xe8f3('0x76'),_0xe8f3('0x77')];_0x1f1575=_[_0xe8f3('0x78')](_0x4dc850['fields'],function(_0x14a299){return _0x5ab124[_0xe8f3('0x79')](_0x14a299[_0xe8f3('0x7a')]);});for(var _0x452177=0x0;_0x452177<_0x1f1575[_0xe8f3('0x39')];_0x452177++){if(_0x1f1575[_0x452177]['system_mandatory']===![]){_0x6ee9a8[_0xe8f3('0x7b')]({'id':_0x1f1575[_0x452177]['id'],'name':_0x1f1575[_0x452177][_0xe8f3('0x7c')],'custom':_0x1f1575[_0x452177][_0xe8f3('0x7d')],'options':_0x1f1575[_0x452177]['data_type']===_0xe8f3('0x7e')&&_0x1f1575[_0x452177][_0xe8f3('0x7f')]['length']>-0x1?_[_0xe8f3('0x2b')](_0x1f1575[_0x452177]['pick_list_values'],function(_0x479b65){return{'name':_0x479b65,'value':_0x479b65};}):[]});}}return{'count':_0x6ee9a8[_0xe8f3('0x39')],'rows':_0x6ee9a8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x29e994,null))[_0xe8f3('0x48')](function(_0x3b5aa2){var _0x36dd75=_0xbd5ac4[_0xe8f3('0x32')][_0xe8f3('0x80')]?0x1f4:_0x3b5aa2[_0xe8f3('0x81')]||0x1f4;logger[_0xe8f3('0x6f')]('getFields,\x20%s,\x20%s,\x20%s',_0xe8f3('0x82'),_0x36dd75,JSON[_0xe8f3('0x83')](_0x3b5aa2));delete _0x3b5aa2[_0xe8f3('0x31')];if(_0x36dd75===0x191){_0x36dd75=0x190;}_0x29e994[_0xe8f3('0x1b')](_0x36dd75)[_0xe8f3('0x2a')](_0xbd5ac4['query'][_0xe8f3('0x80')]?{'message':_0xe8f3('0x84'),'statusCode':_0x3b5aa2[_0xe8f3('0x81')]}:_0x3b5aa2);});}; \ No newline at end of file +var _0xe93f=['Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','ZohoAccount','includeAll','rows','catch','show','params','include','options','find','create','body','update','findOne','ZohoConfiguration','length','order','pick','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','slice','substring','lastIndexOf'];(function(_0x36476a,_0x11dc9e){var _0xe18c0b=function(_0x5ad504){while(--_0x5ad504){_0x36476a['push'](_0x36476a['shift']());}};_0xe18c0b(++_0x11dc9e);}(_0xe93f,0x9c));var _0xfe93=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe93f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfe93('0x0'));var rimraf=require(_0xfe93('0x1'));var zipdir=require(_0xfe93('0x2'));var jsonpatch=require(_0xfe93('0x3'));var rp=require('request-promise');var moment=require(_0xfe93('0x4'));var BPromise=require(_0xfe93('0x5'));var Mustache=require(_0xfe93('0x6'));var util=require(_0xfe93('0x7'));var path=require(_0xfe93('0x8'));var sox=require('sox');var csv=require(_0xfe93('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe93('0xa'));var _=require(_0xfe93('0xb'));var squel=require(_0xfe93('0xc'));var crypto=require(_0xfe93('0xd'));var jsforce=require(_0xfe93('0xe'));var deskjs=require(_0xfe93('0xf'));var toCsv=require(_0xfe93('0x9'));var querystring=require(_0xfe93('0x10'));var Papa=require('papaparse');var Redis=require(_0xfe93('0x11'));var authService=require(_0xfe93('0x12'));var qs=require(_0xfe93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe93('0x14'));var utils=require(_0xfe93('0x15'));var config=require(_0xfe93('0x16'));var licenseUtil=require(_0xfe93('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfe93('0x18'));function respondWithStatusCode(_0x50d0e2,_0x18de3a){_0x18de3a=_0x18de3a||0xcc;return function(_0x126600){if(_0x126600){return _0x50d0e2[_0xfe93('0x19')](_0x18de3a);}return _0x50d0e2[_0xfe93('0x1a')](_0x18de3a)[_0xfe93('0x1b')]();};}function respondWithResult(_0x1f7050,_0x6dc1f4){_0x6dc1f4=_0x6dc1f4||0xc8;return function(_0x424f6c){if(_0x424f6c){return _0x1f7050[_0xfe93('0x1a')](_0x6dc1f4)[_0xfe93('0x1c')](_0x424f6c);}};}function respondWithFilteredResult(_0x3d77f5,_0x577183){return function(_0x3b979e){if(_0x3b979e){var _0x43b29f=typeof _0x577183[_0xfe93('0x1d')]===_0xfe93('0x1e')&&typeof _0x577183['limit']===_0xfe93('0x1e');var _0x1b2ae2=_0x3b979e[_0xfe93('0x1f')];var _0x348c92=_0x43b29f?0x0:_0x577183['offset'];var _0x4629c6=_0x43b29f?_0x3b979e[_0xfe93('0x1f')]:_0x577183[_0xfe93('0x1d')]+_0x577183[_0xfe93('0x20')];var _0x477efa;if(_0x4629c6>=_0x1b2ae2){_0x4629c6=_0x1b2ae2;_0x477efa=0xc8;}else{_0x477efa=0xce;}_0x3d77f5[_0xfe93('0x1a')](_0x477efa);return _0x3d77f5[_0xfe93('0x21')]('Content-Range',_0x348c92+'-'+_0x4629c6+'/'+_0x1b2ae2)[_0xfe93('0x1c')](_0x3b979e);}return null;};}function patchUpdates(_0x545426){return function(_0x383da9){try{jsonpatch[_0xfe93('0x22')](_0x383da9,_0x545426,!![]);}catch(_0xc6c4bc){return BPromise[_0xfe93('0x23')](_0xc6c4bc);}return _0x383da9[_0xfe93('0x24')]();};}function saveUpdates(_0x239093,_0x43a47d){return function(_0x4cc43b){if(_0x4cc43b){return _0x4cc43b['update'](_0x239093)[_0xfe93('0x25')](function(_0x51c1e3){return _0x51c1e3;});}return null;};}function removeEntity(_0x1cb211,_0x422532){return function(_0x2e1455){if(_0x2e1455){return _0x2e1455[_0xfe93('0x26')]()[_0xfe93('0x25')](function(){_0x1cb211[_0xfe93('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f34ff,_0x3a7745){return function(_0x5d494a){if(!_0x5d494a){_0x5f34ff['sendStatus'](0x194);}return _0x5d494a;};}function handleError(_0x532ff6,_0x10bfdc){_0x10bfdc=_0x10bfdc||0x1f4;return function(_0x28c4aa){logger[_0xfe93('0x27')](_0x28c4aa[_0xfe93('0x28')]);if(_0x28c4aa[_0xfe93('0x29')]){delete _0x28c4aa[_0xfe93('0x29')];}_0x532ff6[_0xfe93('0x1a')](_0x10bfdc)['send'](_0x28c4aa);};}exports[_0xfe93('0x2a')]=function(_0x5d85c7,_0x13dc29){var _0xd24fc4={},_0x254ad5={},_0x3c8f7d={'count':0x0,'rows':[]};var _0x2db7df=_[_0xfe93('0x2b')](db['ZohoAccount'][_0xfe93('0x2c')],function(_0x4aef41){return{'name':_0x4aef41[_0xfe93('0x2d')],'type':_0x4aef41[_0xfe93('0x2e')][_0xfe93('0x2f')]};});_0x254ad5[_0xfe93('0x30')]=_[_0xfe93('0x2b')](_0x2db7df,_0xfe93('0x29'));_0x254ad5[_0xfe93('0x31')]=_[_0xfe93('0x32')](_0x5d85c7['query']);_0x254ad5[_0xfe93('0x33')]=_[_0xfe93('0x34')](_0x254ad5[_0xfe93('0x30')],_0x254ad5[_0xfe93('0x31')]);_0xd24fc4['attributes']=_[_0xfe93('0x34')](_0x254ad5[_0xfe93('0x30')],qs[_0xfe93('0x35')](_0x5d85c7[_0xfe93('0x31')][_0xfe93('0x35')]));_0xd24fc4[_0xfe93('0x36')]=_0xd24fc4['attributes']['length']?_0xd24fc4[_0xfe93('0x36')]:_0x254ad5['model'];if(!_0x5d85c7[_0xfe93('0x31')][_0xfe93('0x37')](_0xfe93('0x38'))){_0xd24fc4['limit']=qs[_0xfe93('0x20')](_0x5d85c7[_0xfe93('0x31')][_0xfe93('0x20')]);_0xd24fc4[_0xfe93('0x1d')]=qs['offset'](_0x5d85c7[_0xfe93('0x31')]['offset']);}_0xd24fc4['order']=qs[_0xfe93('0x39')](_0x5d85c7[_0xfe93('0x31')][_0xfe93('0x39')]);_0xd24fc4[_0xfe93('0x3a')]=qs[_0xfe93('0x33')](_['pick'](_0x5d85c7[_0xfe93('0x31')],_0x254ad5[_0xfe93('0x33')]),_0x2db7df);if(_0x5d85c7[_0xfe93('0x31')]['filter']){_0xd24fc4['where']=_[_0xfe93('0x3b')](_0xd24fc4[_0xfe93('0x3a')],{'$or':_[_0xfe93('0x2b')](_0x2db7df,function(_0x53d68a){if(_0x53d68a[_0xfe93('0x2e')]!==_0xfe93('0x3c')){var _0x5e7348={};_0x5e7348[_0x53d68a[_0xfe93('0x29')]]={'$like':'%'+_0x5d85c7[_0xfe93('0x31')]['filter']+'%'};return _0x5e7348;}})});}_0xd24fc4=_[_0xfe93('0x3b')]({},_0xd24fc4,_0x5d85c7['options']);var _0x17119f={'where':_0xd24fc4[_0xfe93('0x3a')]};return db[_0xfe93('0x3d')][_0xfe93('0x1f')](_0x17119f)[_0xfe93('0x25')](function(_0x570171){_0x3c8f7d['count']=_0x570171;if(_0x5d85c7[_0xfe93('0x31')][_0xfe93('0x3e')]){_0xd24fc4['include']=[{'all':!![]}];}return db[_0xfe93('0x3d')]['findAll'](_0xd24fc4);})[_0xfe93('0x25')](function(_0x2393c1){_0x3c8f7d[_0xfe93('0x3f')]=_0x2393c1;return _0x3c8f7d;})[_0xfe93('0x25')](respondWithFilteredResult(_0x13dc29,_0xd24fc4))[_0xfe93('0x40')](handleError(_0x13dc29,null));};exports[_0xfe93('0x41')]=function(_0x5d9422,_0x181dc2){var _0x2e4796={'raw':![],'where':{'id':_0x5d9422[_0xfe93('0x42')]['id']}},_0x4b4193={};_0x4b4193[_0xfe93('0x30')]=_['keys'](db['ZohoAccount'][_0xfe93('0x2c')]);_0x4b4193[_0xfe93('0x31')]=_[_0xfe93('0x32')](_0x5d9422[_0xfe93('0x31')]);_0x4b4193[_0xfe93('0x33')]=_[_0xfe93('0x34')](_0x4b4193[_0xfe93('0x30')],_0x4b4193['query']);_0x2e4796[_0xfe93('0x36')]=_['intersection'](_0x4b4193['model'],qs[_0xfe93('0x35')](_0x5d9422['query'][_0xfe93('0x35')]));_0x2e4796[_0xfe93('0x36')]=_0x2e4796[_0xfe93('0x36')]['length']?_0x2e4796[_0xfe93('0x36')]:_0x4b4193[_0xfe93('0x30')];if(_0x5d9422[_0xfe93('0x31')][_0xfe93('0x3e')]){_0x2e4796[_0xfe93('0x43')]=[{'all':!![]}];}_0x2e4796=_[_0xfe93('0x3b')]({},_0x2e4796,_0x5d9422[_0xfe93('0x44')]);return db['ZohoAccount'][_0xfe93('0x45')](_0x2e4796)[_0xfe93('0x25')](handleEntityNotFound(_0x181dc2,null))[_0xfe93('0x25')](respondWithResult(_0x181dc2,null))[_0xfe93('0x40')](handleError(_0x181dc2,null));};exports[_0xfe93('0x46')]=function(_0x1645dc,_0x53f892){return db['ZohoAccount'][_0xfe93('0x46')](_0x1645dc[_0xfe93('0x47')],{})[_0xfe93('0x25')](respondWithResult(_0x53f892,0xc9))[_0xfe93('0x40')](handleError(_0x53f892,null));};exports[_0xfe93('0x48')]=function(_0x144882,_0x30fc13){if(_0x144882['body']['id']){delete _0x144882['body']['id'];}return db[_0xfe93('0x3d')]['find']({'where':{'id':_0x144882['params']['id']}})[_0xfe93('0x25')](handleEntityNotFound(_0x30fc13,null))[_0xfe93('0x25')](saveUpdates(_0x144882[_0xfe93('0x47')],null))['then'](respondWithResult(_0x30fc13,null))['catch'](handleError(_0x30fc13,null));};exports[_0xfe93('0x26')]=function(_0x208d7a,_0x26b07c){return db[_0xfe93('0x3d')][_0xfe93('0x45')]({'where':{'id':_0x208d7a['params']['id']}})['then'](handleEntityNotFound(_0x26b07c,null))[_0xfe93('0x25')](removeEntity(_0x26b07c,null))[_0xfe93('0x40')](handleError(_0x26b07c,null));};exports['getConfigurations']=function(_0x26fac9,_0x1946e9,_0x3358b5){var _0x55b4b7={};var _0x5e0bdc={};var _0x5591bb;var _0x59362b;return db[_0xfe93('0x3d')][_0xfe93('0x49')]({'where':{'id':_0x26fac9['params']['id']}})['then'](handleEntityNotFound(_0x1946e9,null))[_0xfe93('0x25')](function(_0x2b9a2d){if(_0x2b9a2d){_0x5591bb=_0x2b9a2d;_0x5e0bdc[_0xfe93('0x30')]=_[_0xfe93('0x32')](db[_0xfe93('0x4a')][_0xfe93('0x2c')]);_0x5e0bdc[_0xfe93('0x31')]=_[_0xfe93('0x32')](_0x26fac9['query']);_0x5e0bdc[_0xfe93('0x33')]=_[_0xfe93('0x34')](_0x5e0bdc[_0xfe93('0x30')],_0x5e0bdc['query']);_0x55b4b7[_0xfe93('0x36')]=_[_0xfe93('0x34')](_0x5e0bdc[_0xfe93('0x30')],qs[_0xfe93('0x35')](_0x26fac9[_0xfe93('0x31')][_0xfe93('0x35')]));_0x55b4b7[_0xfe93('0x36')]=_0x55b4b7[_0xfe93('0x36')][_0xfe93('0x4b')]?_0x55b4b7[_0xfe93('0x36')]:_0x5e0bdc[_0xfe93('0x30')];_0x55b4b7[_0xfe93('0x4c')]=qs[_0xfe93('0x39')](_0x26fac9['query'][_0xfe93('0x39')]);_0x55b4b7['where']=qs[_0xfe93('0x33')](_[_0xfe93('0x4d')](_0x26fac9[_0xfe93('0x31')],_0x5e0bdc['filters']));if(_0x26fac9[_0xfe93('0x31')][_0xfe93('0x4e')]){_0x55b4b7[_0xfe93('0x3a')]=_[_0xfe93('0x3b')](_0x55b4b7[_0xfe93('0x3a')],{'$or':_[_0xfe93('0x2b')](_0x55b4b7[_0xfe93('0x36')],function(_0x5bee21){var _0x32dba9={};_0x32dba9[_0x5bee21]={'$like':'%'+_0x26fac9[_0xfe93('0x31')][_0xfe93('0x4e')]+'%'};return _0x32dba9;})});}_0x55b4b7=_['merge']({},_0x55b4b7,_0x26fac9[_0xfe93('0x44')]);return _0x5591bb[_0xfe93('0x4f')](_0x55b4b7);}})['then'](function(_0x3c1e08){if(_0x3c1e08){_0x59362b=_0x3c1e08[_0xfe93('0x4b')];if(!_0x26fac9[_0xfe93('0x31')][_0xfe93('0x37')]('nolimit')){_0x55b4b7['limit']=qs[_0xfe93('0x20')](_0x26fac9['query'][_0xfe93('0x20')]);_0x55b4b7[_0xfe93('0x1d')]=qs[_0xfe93('0x1d')](_0x26fac9['query'][_0xfe93('0x1d')]);}return _0x5591bb[_0xfe93('0x4f')](_0x55b4b7);}})[_0xfe93('0x25')](function(_0x435454){if(_0x435454){return _0x435454?{'count':_0x59362b,'rows':_0x435454}:null;}})[_0xfe93('0x25')](respondWithResult(_0x1946e9,null))[_0xfe93('0x40')](handleError(_0x1946e9,null));};exports[_0xfe93('0x50')]=function(_0x151c69,_0xc1fe5e,_0x44b420){if(_0x151c69[_0xfe93('0x47')]['id']){delete _0x151c69[_0xfe93('0x47')]['id'];}return db[_0xfe93('0x3d')][_0xfe93('0x49')]({'where':{'id':_0x151c69['params']['id']}})['then'](handleEntityNotFound(_0xc1fe5e,null))[_0xfe93('0x25')](function(_0x3907bb){if(_0x3907bb){_0x151c69[_0xfe93('0x47')][_0xfe93('0x51')]=_0x3907bb['id'];_0x151c69['body'][_0xfe93('0x52')]=integrations[_0xfe93('0x53')](_0x151c69[_0xfe93('0x47')][_0xfe93('0x54')],_0x151c69['body'][_0xfe93('0x2e')]);_0x151c69[_0xfe93('0x47')]['Descriptions']=integrations[_0xfe93('0x55')](_0x151c69['body'][_0xfe93('0x54')],_0x151c69[_0xfe93('0x47')][_0xfe93('0x2e')]);return db[_0xfe93('0x4a')]['create'](_0x151c69[_0xfe93('0x47')],{'include':[{'model':db[_0xfe93('0x56')],'as':_0xfe93('0x52')},{'model':db[_0xfe93('0x56')],'as':_0xfe93('0x57')}]});}return null;})['then'](respondWithResult(_0xc1fe5e,null))[_0xfe93('0x40')](handleError(_0xc1fe5e,null));};function getAccessToken(_0x5d043e){return new Promise(function(_0x3d27e4,_0x3cc037){var _0x361dd1;switch(_0x5d043e[_0xfe93('0x58')]){case'US':_0x361dd1=_0xfe93('0x59');break;case'AU':_0x361dd1=_0xfe93('0x5a');break;case'EU':_0x361dd1=_0xfe93('0x5b');break;case'IN':_0x361dd1=_0xfe93('0x5c');break;case'CN':_0x361dd1='https://accounts.zoho.com.cn';break;default:_0x361dd1=_0xfe93('0x5b');break;}var _0x17388e={'method':_0xfe93('0x5d'),'uri':_0x361dd1+'/oauth/v2/token','qs':{'refresh_token':_0x5d043e[_0xfe93('0x5e')],'client_id':_0x5d043e[_0xfe93('0x5f')],'client_secret':_0x5d043e[_0xfe93('0x60')],'grant_type':_0xfe93('0x61')},'json':!![]};return rp(_0x17388e)[_0xfe93('0x25')](function(_0x559927){if(_0x559927[_0xfe93('0x62')]){_0x3d27e4(_0x559927[_0xfe93('0x62')]);}else{_0x3cc037('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x3a8164){_0x3cc037(_0x3a8164);});});}exports[_0xfe93('0x63')]=function(_0x4810af,_0x5b8dc2,_0x4556c8){var _0x27f168,_0xb1c8ae,_0xf9baeb,_0x59314c,_0x528e69;return db['ZohoAccount'][_0xfe93('0x49')]({'where':{'id':_0x4810af['params']['id']},'attributes':['id',_0xfe93('0x64'),'zone',_0xfe93('0x5f'),'clientSecret',_0xfe93('0x65'),_0xfe93('0x66'),_0xfe93('0x5e')]})[_0xfe93('0x25')](handleEntityNotFound(_0x5b8dc2,null))['then'](function(_0x203aba){_0x528e69=_0x203aba;_0x27f168=_0x528e69[_0xfe93('0x64')];_0xb1c8ae=_0x27f168==='zoho.eu'?'eu':'com';_0xf9baeb=_0x528e69[_0xfe93('0x65')];var _0x3b7339=_0xf9baeb[_0xfe93('0x67')](-0x1);if(_0x3b7339==='/'||_0x3b7339==='\x5c'||_0x3b7339===':'){_0xf9baeb=_0xf9baeb[_0xfe93('0x68')](0x0,_0xf9baeb[_0xfe93('0x69')](_0x3b7339));}if(!_0x528e69[_0xfe93('0x5e')]){throw new Error(_0xfe93('0x6a'));}return getAccessToken(_0x528e69);})[_0xfe93('0x25')](function(_0x696bc4){if(_0x696bc4){return rp({'method':_0xfe93('0x6b'),'uri':util[_0xfe93('0x6c')](_0xfe93('0x6d'),_0xb1c8ae),'qs':{'module':_0xfe93('0x6e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x696bc4},'json':!![]});}})['then'](function(_0x198b58){if(_0x198b58){if(_0x198b58[_0xfe93('0x6f')]&&_0x198b58[_0xfe93('0x6f')][_0xfe93('0x27')]){throw new Error(_0x198b58['response'][_0xfe93('0x27')][_0xfe93('0x70')]);}var _0x1242c6=[];var _0x2ffff1=[];var _0x4d0831=['Owner',_0xfe93('0x71'),_0xfe93('0x72'),'WhoId',_0xfe93('0x73'),_0xfe93('0x74'),'Call_Start_Time',_0xfe93('0x75')];_0x2ffff1=_[_0xfe93('0x76')](_0x198b58[_0xfe93('0x35')],function(_0x1fa80f){return _0x4d0831[_0xfe93('0x77')](_0x1fa80f[_0xfe93('0x78')]);});for(var _0x26b92d=0x0;_0x26b92d<_0x2ffff1[_0xfe93('0x4b')];_0x26b92d++){if(_0x2ffff1[_0x26b92d][_0xfe93('0x79')]===![]){_0x1242c6['push']({'id':_0x2ffff1[_0x26b92d]['id'],'name':_0x2ffff1[_0x26b92d][_0xfe93('0x7a')],'custom':_0x2ffff1[_0x26b92d][_0xfe93('0x7b')],'options':_0x2ffff1[_0x26b92d][_0xfe93('0x7c')]===_0xfe93('0x7d')&&_0x2ffff1[_0x26b92d][_0xfe93('0x7e')]['length']>-0x1?_['map'](_0x2ffff1[_0x26b92d][_0xfe93('0x7e')],function(_0x44ea09){return{'name':_0x44ea09,'value':_0x44ea09};}):[]});}}return{'count':_0x1242c6[_0xfe93('0x4b')],'rows':_0x1242c6};}else{return{'count':0x0,'rows':[]};}})[_0xfe93('0x25')](respondWithResult(_0x5b8dc2,null))['catch'](function(_0x3df672){var _0x11d0ac=_0x4810af[_0xfe93('0x31')]['test']?0x1f4:_0x3df672['statusCode']||0x1f4;logger[_0xfe93('0x27')](_0xfe93('0x7f'),_0xfe93('0x63'),_0x11d0ac,JSON['stringify'](_0x3df672));delete _0x3df672[_0xfe93('0x29')];if(_0x11d0ac===0x191){_0x11d0ac=0x190;}_0x5b8dc2[_0xfe93('0x1a')](_0x11d0ac)[_0xfe93('0x80')](_0x4810af['query'][_0xfe93('0x81')]?{'message':_0xfe93('0x82'),'statusCode':_0x3df672['statusCode']}:_0x3df672);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2a9c624..2ede10e 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 _0x4c7e=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','clientSecret','host','/oauth/v2/token','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x234fc2,_0x485cee){var _0x1ddffd=function(_0x44f319){while(--_0x44f319){_0x234fc2['push'](_0x234fc2['shift']());}};_0x1ddffd(++_0x485cee);}(_0x4c7e,0x141));var _0xe4c7=function(_0x1bca2e,_0x2e5dbc){_0x1bca2e=_0x1bca2e-0x0;var _0x11ab8d=_0x4c7e[_0x1bca2e];return _0x11ab8d;};'use strict';var _=require(_0xe4c7('0x0'));var util=require('util');var logger=require(_0xe4c7('0x1'))(_0xe4c7('0x2'));var moment=require(_0xe4c7('0x3'));var BPromise=require(_0xe4c7('0x4'));var rp=require(_0xe4c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4c7('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe4c7('0x7')]=function(_0x1e918d,_0x8624fd){return _0x1e918d[_0xe4c7('0x8')](_0xe4c7('0x9'),attributes,{'tableName':_0xe4c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f1518,_0x4de83d,_0x33830d){if(_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xc'))||_0x5f1518[_0xe4c7('0xb')]('serverUrl')||_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xd'))||_0x5f1518[_0xe4c7('0xb')]('clientSecret')||_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xe'))||_0x5f1518[_0xe4c7('0xb')]('host')){var _0x323645,_0xd9581a;_0x323645=_0x5f1518[_0xe4c7('0xf')];var _0x508ed3=_0x323645[_0xe4c7('0x10')](-0x1);if(_0x508ed3==='/'||_0x508ed3==='\x5c'||_0x508ed3===':'){_0x323645=_0x323645[_0xe4c7('0x11')](0x0,_0x323645[_0xe4c7('0x12')](_0x508ed3));}switch(_0x5f1518[_0xe4c7('0xc')]){case'US':_0xd9581a=_0xe4c7('0x13');break;case'AU':_0xd9581a=_0xe4c7('0x14');break;case'IN':_0xd9581a=_0xe4c7('0x15');break;case'CN':_0xd9581a=_0xe4c7('0x16');break;default:_0xd9581a=_0xe4c7('0x17');break;}var _0x5e61cf={'method':_0xe4c7('0x18'),'uri':_0xd9581a+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5f1518['clientId'],'client_secret':_0x5f1518['clientSecret'],'redirect_uri':_0x5f1518[_0xe4c7('0xf')],'code':_0x5f1518[_0xe4c7('0xe')]},'headers':{'Content-Type':_0xe4c7('0x19')}};return rp(_0x5e61cf)[_0xe4c7('0x1a')](function(_0x13caf3){var _0x344533=JSON[_0xe4c7('0x1b')](_0x13caf3);if(_0x344533[_0xe4c7('0x1c')]){_0x5f1518[_0xe4c7('0x1d')]=_0x344533[_0xe4c7('0x1c')];logger[_0xe4c7('0x1e')](util[_0xe4c7('0x1f')](_0xe4c7('0x20'),_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']));}else{logger[_0xe4c7('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']),util['inspect'](_0x344533,{'showHidden':![],'depth':null}));}return _0x33830d(null,_0x4de83d);})[_0xe4c7('0x23')](function(_0x4dd62f){logger[_0xe4c7('0x22')](util['format'](_0xe4c7('0x24'),_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']),util[_0xe4c7('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x33830d(_0x4dd62f);});}else{return _0x33830d(null,_0x4de83d);}},'beforeUpdate':function(_0x2d0346,_0x388447,_0xa2c12d){if(_0x2d0346[_0xe4c7('0xb')](_0xe4c7('0xc'))||_0x2d0346[_0xe4c7('0xb')]('serverUrl')||_0x2d0346[_0xe4c7('0xb')](_0xe4c7('0xd'))||_0x2d0346['changed'](_0xe4c7('0x26'))||_0x2d0346['changed'](_0xe4c7('0xe'))||_0x2d0346['changed'](_0xe4c7('0x27'))){var _0xf562a1,_0x483752;_0xf562a1=_0x2d0346[_0xe4c7('0xf')];var _0x52ce5c=_0xf562a1[_0xe4c7('0x10')](-0x1);if(_0x52ce5c==='/'||_0x52ce5c==='\x5c'||_0x52ce5c===':'){_0xf562a1=_0xf562a1[_0xe4c7('0x11')](0x0,_0xf562a1[_0xe4c7('0x12')](_0x52ce5c));}switch(_0x2d0346['zone']){case'US':_0x483752=_0xe4c7('0x13');break;case'AU':_0x483752=_0xe4c7('0x14');break;case'IN':_0x483752=_0xe4c7('0x15');break;case'CN':_0x483752='https://accounts.zoho.com.cn';break;default:_0x483752=_0xe4c7('0x17');break;}var _0x58d69c={'method':'POST','uri':_0x483752+_0xe4c7('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x2d0346[_0xe4c7('0xd')],'client_secret':_0x2d0346[_0xe4c7('0x26')],'redirect_uri':_0x2d0346[_0xe4c7('0xf')],'code':_0x2d0346[_0xe4c7('0xe')]},'headers':{'Content-Type':_0xe4c7('0x19')}};return rp(_0x58d69c)[_0xe4c7('0x1a')](function(_0x4cea6e){var _0x184cfd=JSON[_0xe4c7('0x1b')](_0x4cea6e);if(_0x184cfd[_0xe4c7('0x1c')]){_0x2d0346[_0xe4c7('0x1d')]=_0x184cfd['refresh_token'];logger[_0xe4c7('0x1e')](util[_0xe4c7('0x1f')](_0xe4c7('0x20'),_0x2d0346[_0xe4c7('0x21')],_0x2d0346['id']));}else{logger[_0xe4c7('0x22')](util[_0xe4c7('0x1f')](_0xe4c7('0x24'),_0x2d0346[_0xe4c7('0x21')],_0x2d0346['id']),util[_0xe4c7('0x25')](_0x184cfd,{'showHidden':![],'depth':null}));}return _0xa2c12d(null,_0x388447);})[_0xe4c7('0x23')](function(_0x54d982){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2d0346['name'],_0x2d0346['id']),util[_0xe4c7('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xa2c12d(_0x54d982);});}else{return _0xa2c12d(null,_0x388447);}}}});}; \ No newline at end of file +var _0x3829=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','info','format','name','error','catch','inspect','https://accounts.zoho.com','https://accounts.zoho.in'];(function(_0x5e0768,_0x3e9908){var _0x7e3493=function(_0x350a3d){while(--_0x350a3d){_0x5e0768['push'](_0x5e0768['shift']());}};_0x7e3493(++_0x3e9908);}(_0x3829,0x1a3));var _0x9382=function(_0x120cb3,_0x29026a){_0x120cb3=_0x120cb3-0x0;var _0x3c93f7=_0x3829[_0x120cb3];return _0x3c93f7;};'use strict';var _=require('lodash');var util=require(_0x9382('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9382('0x1'));var BPromise=require(_0x9382('0x2'));var rp=require(_0x9382('0x3'));var fs=require('fs');var path=require(_0x9382('0x4'));var rimraf=require(_0x9382('0x5'));var config=require(_0x9382('0x6'));var attributes=require(_0x9382('0x7'));var integrations=require(_0x9382('0x8'));module['exports']=function(_0x5be4a3,_0x37709b){return _0x5be4a3[_0x9382('0x9')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1820b8,_0xba4838,_0x23d6fc){if(_0x1820b8[_0x9382('0xa')]('zone')||_0x1820b8['changed'](_0x9382('0xb'))||_0x1820b8[_0x9382('0xa')](_0x9382('0xc'))||_0x1820b8[_0x9382('0xa')](_0x9382('0xd'))||_0x1820b8['changed'](_0x9382('0xe'))||_0x1820b8[_0x9382('0xa')](_0x9382('0xf'))){var _0x1cd296,_0x1b64cf;_0x1cd296=_0x1820b8[_0x9382('0xb')];var _0x3ca8da=_0x1cd296[_0x9382('0x10')](-0x1);if(_0x3ca8da==='/'||_0x3ca8da==='\x5c'||_0x3ca8da===':'){_0x1cd296=_0x1cd296[_0x9382('0x11')](0x0,_0x1cd296[_0x9382('0x12')](_0x3ca8da));}switch(_0x1820b8[_0x9382('0x13')]){case'US':_0x1b64cf='https://accounts.zoho.com';break;case'AU':_0x1b64cf=_0x9382('0x14');break;case'IN':_0x1b64cf='https://accounts.zoho.in';break;case'CN':_0x1b64cf='https://accounts.zoho.com.cn';break;default:_0x1b64cf=_0x9382('0x15');break;}var _0x417eb6={'method':_0x9382('0x16'),'uri':_0x1b64cf+_0x9382('0x17'),'form':{'grant_type':_0x9382('0x18'),'client_id':_0x1820b8[_0x9382('0xc')],'client_secret':_0x1820b8[_0x9382('0xd')],'redirect_uri':_0x1820b8[_0x9382('0xb')],'code':_0x1820b8['code']},'headers':{'Content-Type':_0x9382('0x19')}};return rp(_0x417eb6)['then'](function(_0x111f5b){var _0x4ce699=JSON[_0x9382('0x1a')](_0x111f5b);if(_0x4ce699['refresh_token']){_0x1820b8[_0x9382('0x1b')]=_0x4ce699[_0x9382('0x1c')];logger[_0x9382('0x1d')](util[_0x9382('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1820b8[_0x9382('0x1f')],_0x1820b8['id']));}else{logger[_0x9382('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1820b8[_0x9382('0x1f')],_0x1820b8['id']),util['inspect'](_0x4ce699,{'showHidden':![],'depth':null}));}return _0x23d6fc(null,_0xba4838);})[_0x9382('0x21')](function(_0x26627c){logger[_0x9382('0x20')](util[_0x9382('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1820b8[_0x9382('0x1f')],_0x1820b8['id']),util[_0x9382('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x23d6fc(_0x26627c);});}else{return _0x23d6fc(null,_0xba4838);}},'beforeUpdate':function(_0x2e55b8,_0x527ff1,_0x2ec015){if(_0x2e55b8[_0x9382('0xa')](_0x9382('0x13'))||_0x2e55b8[_0x9382('0xa')](_0x9382('0xb'))||_0x2e55b8[_0x9382('0xa')](_0x9382('0xc'))||_0x2e55b8[_0x9382('0xa')](_0x9382('0xd'))||_0x2e55b8['changed'](_0x9382('0xe'))||_0x2e55b8[_0x9382('0xa')]('host')){var _0x275044,_0x3a2a66;_0x275044=_0x2e55b8['serverUrl'];var _0x5d990d=_0x275044['slice'](-0x1);if(_0x5d990d==='/'||_0x5d990d==='\x5c'||_0x5d990d===':'){_0x275044=_0x275044[_0x9382('0x11')](0x0,_0x275044[_0x9382('0x12')](_0x5d990d));}switch(_0x2e55b8[_0x9382('0x13')]){case'US':_0x3a2a66=_0x9382('0x23');break;case'AU':_0x3a2a66='https://accounts.zoho.com.au';break;case'IN':_0x3a2a66=_0x9382('0x24');break;case'CN':_0x3a2a66='https://accounts.zoho.com.cn';break;default:_0x3a2a66=_0x9382('0x15');break;}var _0x181a70={'method':_0x9382('0x16'),'uri':_0x3a2a66+_0x9382('0x17'),'form':{'grant_type':_0x9382('0x18'),'client_id':_0x2e55b8['clientId'],'client_secret':_0x2e55b8['clientSecret'],'redirect_uri':_0x2e55b8[_0x9382('0xb')],'code':_0x2e55b8['code']},'headers':{'Content-Type':_0x9382('0x19')}};return rp(_0x181a70)['then'](function(_0x2ebc55){var _0x2d5850=JSON[_0x9382('0x1a')](_0x2ebc55);if(_0x2d5850[_0x9382('0x1c')]){_0x2e55b8['refreshToken']=_0x2d5850[_0x9382('0x1c')];logger[_0x9382('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2e55b8[_0x9382('0x1f')],_0x2e55b8['id']));}else{logger[_0x9382('0x20')](util['format'](_0x9382('0x25'),_0x2e55b8[_0x9382('0x1f')],_0x2e55b8['id']),util[_0x9382('0x22')](_0x2d5850,{'showHidden':![],'depth':null}));}return _0x2ec015(null,_0x527ff1);})[_0x9382('0x21')](function(_0x4d3c74){logger[_0x9382('0x20')](util[_0x9382('0x1e')](_0x9382('0x25'),_0x2e55b8[_0x9382('0x1f')],_0x2e55b8['id']),util[_0x9382('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2ec015(_0x4d3c74);});}else{return _0x2ec015(null,_0x527ff1);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0098ff4..f85ec05 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 _0x29b6=['include','map','model','then','GetZohoAccount','catch','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount','options','raw','attributes','limit'];(function(_0x190681,_0x590f58){var _0x4f2ada=function(_0x4556db){while(--_0x4556db){_0x190681['push'](_0x190681['shift']());}};_0x4f2ada(++_0x590f58);}(_0x29b6,0x17e));var _0x629b=function(_0x2fdc16,_0x46b810){_0x2fdc16=_0x2fdc16-0x0;var _0x210f85=_0x29b6[_0x2fdc16];return _0x210f85;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var moment=require(_0x629b('0x2'));var BPromise=require(_0x629b('0x3'));var rs=require(_0x629b('0x4'));var fs=require('fs');var Redis=require(_0x629b('0x5'));var db=require(_0x629b('0x6'))['db'];var utils=require(_0x629b('0x7'));var logger=require(_0x629b('0x8'))(_0x629b('0x9'));var config=require('../../config/environment');var jayson=require(_0x629b('0xa'));var client=jayson['client'][_0x629b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acc5a,_0x26e439,_0x398ecb){return new BPromise(function(_0x4e90cd,_0xc44b27){return client[_0x629b('0xc')](_0x4acc5a,_0x398ecb)['then'](function(_0x28c152){logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));logger[_0x629b('0x10')](_0x629b('0x11'),_0x26e439,_0x629b('0xf'),JSON[_0x629b('0x12')](_0x28c152));if(_0x28c152[_0x629b('0x13')]){if(_0x28c152[_0x629b('0x13')]['code']===0x1f4){logger['error'](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);return _0xc44b27(_0x28c152['error'][_0x629b('0x14')]);}logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')]['message']);return _0x4e90cd(_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);}else{logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));_0x4e90cd(_0x28c152['result'][_0x629b('0x14')]);}})['catch'](function(_0x151b93){logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x151b93);_0xc44b27(_0x151b93);});});}exports['GetZohoAccount']=function(_0x7f24d3){var _0x58f5a8=this;return new Promise(function(_0x1c93a1,_0x4f28dd){return db[_0x629b('0x15')]['findAll']({'raw':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')]['where']||null:null,'attributes':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x18')]||null:null,'limit':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3['options'][_0x629b('0x19')]||null:null,'include':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x7f24d3['options'][_0x629b('0x1a')],function(_0x1e773e){return{'model':db[_0x1e773e[_0x629b('0x1c')]],'as':_0x1e773e['as'],'attributes':_0x1e773e[_0x629b('0x18')],'include':_0x1e773e[_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1e773e[_0x629b('0x1a')],function(_0x547b3c){return{'model':db[_0x547b3c['model']],'as':_0x547b3c['as'],'attributes':_0x547b3c['attributes'],'include':_0x547b3c['include']?_[_0x629b('0x1b')](_0x547b3c[_0x629b('0x1a')],function(_0xf68af8){return{'model':db[_0xf68af8[_0x629b('0x1c')]],'as':_0xf68af8['as'],'attributes':_0xf68af8[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x629b('0x1d')](function(_0x4c1f21){logger[_0x629b('0xd')](_0x629b('0x1e'),_0x7f24d3);logger[_0x629b('0x10')](_0x629b('0x1e'),_0x7f24d3,JSON[_0x629b('0x12')](_0x4c1f21));_0x1c93a1(_0x4c1f21);})[_0x629b('0x1f')](function(_0x3ef549){logger[_0x629b('0x13')]('GetZohoAccount',_0x3ef549['message'],_0x7f24d3);_0x4f28dd(_0x58f5a8[_0x629b('0x13')](0x1f4,_0x3ef549[_0x629b('0x14')]));});});};exports['ShowZohoAccount']=function(_0x1628cb){var _0x56c088=this;return new Promise(function(_0x86ee7c,_0x37b918){return db['ZohoAccount'][_0x629b('0x20')]({'raw':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')]['where']||null:null,'attributes':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x18')]||null:null,'include':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')],function(_0x26a541){return{'model':db[_0x26a541[_0x629b('0x1c')]],'as':_0x26a541['as'],'attributes':_0x26a541[_0x629b('0x18')],'include':_0x26a541[_0x629b('0x1a')]?_['map'](_0x26a541['include'],function(_0x17aaef){return{'model':db[_0x17aaef[_0x629b('0x1c')]],'as':_0x17aaef['as'],'attributes':_0x17aaef[_0x629b('0x18')],'include':_0x17aaef[_0x629b('0x1a')]?_['map'](_0x17aaef[_0x629b('0x1a')],function(_0x202348){return{'model':db[_0x202348[_0x629b('0x1c')]],'as':_0x202348['as'],'attributes':_0x202348[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13cac7){logger[_0x629b('0xd')](_0x629b('0x21'),_0x1628cb);logger[_0x629b('0x10')](_0x629b('0x21'),_0x1628cb,JSON['stringify'](_0x13cac7));_0x86ee7c(_0x13cac7);})[_0x629b('0x1f')](function(_0x4024c7){logger[_0x629b('0x13')](_0x629b('0x21'),_0x4024c7[_0x629b('0x14')],_0x1628cb);_0x37b918(_0x56c088[_0x629b('0x13')](0x1f4,_0x4024c7[_0x629b('0x14')]));});});}; \ No newline at end of file +var _0xd481=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','include','map','model','attributes','ShowZohoAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0xd481,0x1e4));var _0x1d48=function(_0x1d2eb6,_0x16574d){_0x1d2eb6=_0x1d2eb6-0x0;var _0x226cbf=_0xd481[_0x1d2eb6];return _0x226cbf;};'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')]('ZohoAccount,\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')]('ZohoAccount,\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);});});}exports[_0x1d48('0x15')]=function(_0x2a007c){var _0x1bcd95=this;return new Promise(function(_0x258c7a,_0xec25a1){return db['ZohoAccount']['findAll']({'raw':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x17')]===undefined?!![]:![]:!![],'where':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x18')]||null:null,'attributes':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')]['attributes']||null:null,'limit':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')]['limit']||null:null,'include':_0x2a007c['options']?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x2a007c[_0x1d48('0x16')][_0x1d48('0x19')],function(_0x20a9ba){return{'model':db[_0x20a9ba[_0x1d48('0x1b')]],'as':_0x20a9ba['as'],'attributes':_0x20a9ba[_0x1d48('0x1c')],'include':_0x20a9ba[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x20a9ba['include'],function(_0x4e44eb){return{'model':db[_0x4e44eb[_0x1d48('0x1b')]],'as':_0x4e44eb['as'],'attributes':_0x4e44eb[_0x1d48('0x1c')],'include':_0x4e44eb[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x4e44eb[_0x1d48('0x19')],function(_0x7631b4){return{'model':db[_0x7631b4['model']],'as':_0x7631b4['as'],'attributes':_0x7631b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d48('0xa')](function(_0x280505){logger['info'](_0x1d48('0x15'),_0x2a007c);logger[_0x1d48('0xe')](_0x1d48('0x15'),_0x2a007c,JSON[_0x1d48('0xf')](_0x280505));_0x258c7a(_0x280505);})['catch'](function(_0x4cac26){logger[_0x1d48('0x10')](_0x1d48('0x15'),_0x4cac26[_0x1d48('0x12')],_0x2a007c);_0xec25a1(_0x1bcd95[_0x1d48('0x10')](0x1f4,_0x4cac26['message']));});});};exports[_0x1d48('0x1d')]=function(_0x3dee70){var _0x41e050=this;return new Promise(function(_0x25408e,_0x3cae45){return db['ZohoAccount'][_0x1d48('0x1e')]({'raw':_0x3dee70[_0x1d48('0x16')]?_0x3dee70[_0x1d48('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3dee70[_0x1d48('0x16')]?_0x3dee70['options']['where']||null:null,'attributes':_0x3dee70[_0x1d48('0x16')]?_0x3dee70[_0x1d48('0x16')][_0x1d48('0x1c')]||null:null,'include':_0x3dee70['options']?_0x3dee70[_0x1d48('0x16')][_0x1d48('0x19')]?_['map'](_0x3dee70[_0x1d48('0x16')][_0x1d48('0x19')],function(_0x189a89){return{'model':db[_0x189a89['model']],'as':_0x189a89['as'],'attributes':_0x189a89[_0x1d48('0x1c')],'include':_0x189a89['include']?_[_0x1d48('0x1a')](_0x189a89[_0x1d48('0x19')],function(_0x3de6be){return{'model':db[_0x3de6be['model']],'as':_0x3de6be['as'],'attributes':_0x3de6be['attributes'],'include':_0x3de6be[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x3de6be[_0x1d48('0x19')],function(_0x438a0d){return{'model':db[_0x438a0d[_0x1d48('0x1b')]],'as':_0x438a0d['as'],'attributes':_0x438a0d[_0x1d48('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1d48('0xa')](function(_0x2476fe){logger[_0x1d48('0xb')](_0x1d48('0x1d'),_0x3dee70);logger[_0x1d48('0xe')](_0x1d48('0x1d'),_0x3dee70,JSON[_0x1d48('0xf')](_0x2476fe));_0x25408e(_0x2476fe);})[_0x1d48('0x14')](function(_0x458ec3){logger[_0x1d48('0x10')](_0x1d48('0x1d'),_0x458ec3[_0x1d48('0x12')],_0x3dee70);_0x3cae45(_0x41e050[_0x1d48('0x10')](0x1f4,_0x458ec3[_0x1d48('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0fb008c..cd42147 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 _0xa105=['getFields','getSubjects','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x4581c2,_0x34c9af){var _0x969e99=function(_0x355c33){while(--_0x355c33){_0x4581c2['push'](_0x4581c2['shift']());}};_0x969e99(++_0x34c9af);}(_0xa105,0x133));var _0x5a10=function(_0x5c60b1,_0x58603d){_0x5c60b1=_0x5c60b1-0x0;var _0x4f3e73=_0xa105[_0x5c60b1];return _0x4f3e73;};'use strict';var multer=require(_0x5a10('0x0'));var util=require(_0x5a10('0x1'));var path=require('path');var timeout=require(_0x5a10('0x2'));var express=require(_0x5a10('0x3'));var router=express[_0x5a10('0x4')]();var fs_extra=require(_0x5a10('0x5'));var auth=require(_0x5a10('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a10('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x5a10('0x8')]('/',auth[_0x5a10('0x9')](),controller['index']);router['get'](_0x5a10('0xa'),auth[_0x5a10('0x9')](),controller[_0x5a10('0xb')]);router[_0x5a10('0x8')](_0x5a10('0xc'),auth[_0x5a10('0x9')](),controller[_0x5a10('0xd')]);router[_0x5a10('0x8')]('/:id/subjects',auth[_0x5a10('0x9')](),controller[_0x5a10('0xe')]);router[_0x5a10('0x8')]('/:id/descriptions',auth[_0x5a10('0x9')](),controller['getDescriptions']);router[_0x5a10('0xf')]('/',auth[_0x5a10('0x9')](),controller[_0x5a10('0x10')]);router[_0x5a10('0x11')](_0x5a10('0xa'),auth['isAuthenticated'](),controller[_0x5a10('0x12')]);router['delete']('/:id',auth[_0x5a10('0x9')](),controller[_0x5a10('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6bc0=['create','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x1162f9,_0x35f87c){var _0x75257c=function(_0x11ac6b){while(--_0x11ac6b){_0x1162f9['push'](_0x1162f9['shift']());}};_0x75257c(++_0x35f87c);}(_0x6bc0,0x115));var _0x06bc=function(_0x53303e,_0x31289c){_0x53303e=_0x53303e-0x0;var _0x29325a=_0x6bc0[_0x53303e];return _0x29325a;};'use strict';var multer=require('multer');var util=require(_0x06bc('0x0'));var path=require(_0x06bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x06bc('0x2'));var router=express[_0x06bc('0x3')]();var fs_extra=require(_0x06bc('0x4'));var auth=require(_0x06bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06bc('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x06bc('0x7')]('/',auth[_0x06bc('0x8')](),controller[_0x06bc('0x9')]);router['get'](_0x06bc('0xa'),auth[_0x06bc('0x8')](),controller[_0x06bc('0xb')]);router[_0x06bc('0x7')]('/:id/fields',auth[_0x06bc('0x8')](),controller[_0x06bc('0xc')]);router['get'](_0x06bc('0xd'),auth[_0x06bc('0x8')](),controller[_0x06bc('0xe')]);router['get'](_0x06bc('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x06bc('0x10')]('/',auth[_0x06bc('0x8')](),controller[_0x06bc('0x11')]);router[_0x06bc('0x12')]('/:id',auth[_0x06bc('0x8')](),controller['update']);router[_0x06bc('0x13')](_0x06bc('0xa'),auth[_0x06bc('0x8')](),controller[_0x06bc('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 a504bbf..f1d8d31 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 _0x20e2=['exports','STRING','ENUM','lead','contact_lead','contact','sequelize'];(function(_0x557d56,_0x5427f4){var _0x1119d3=function(_0x30af21){while(--_0x30af21){_0x557d56['push'](_0x557d56['shift']());}};_0x1119d3(++_0x5427f4);}(_0x20e2,0x8b));var _0x220e=function(_0x3a7dca,_0xd638c7){_0x3a7dca=_0x3a7dca-0x0;var _0x5806f1=_0x20e2[_0x3a7dca];return _0x5806f1;};'use strict';var Sequelize=require(_0x220e('0x0'));module[_0x220e('0x1')]={'name':{'type':Sequelize[_0x220e('0x2')]},'moduleCreate':{'type':Sequelize[_0x220e('0x3')]('lead','contact','nothing'),'defaultValue':_0x220e('0x4')},'moduleSearch':{'type':Sequelize[_0x220e('0x3')](_0x220e('0x5'),_0x220e('0x6'),_0x220e('0x4')),'defaultValue':_0x220e('0x5')},'description':{'type':Sequelize[_0x220e('0x2')]}}; \ No newline at end of file +var _0x2698=['ENUM','lead','contact','nothing','contact_lead','sequelize','STRING'];(function(_0x56c693,_0x2c7d48){var _0x530dec=function(_0x156352){while(--_0x156352){_0x56c693['push'](_0x56c693['shift']());}};_0x530dec(++_0x2c7d48);}(_0x2698,0x124));var _0x8269=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2698[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8269('0x0'));module['exports']={'name':{'type':Sequelize[_0x8269('0x1')]},'moduleCreate':{'type':Sequelize[_0x8269('0x2')](_0x8269('0x3'),_0x8269('0x4'),_0x8269('0x5')),'defaultValue':_0x8269('0x3')},'moduleSearch':{'type':Sequelize[_0x8269('0x2')](_0x8269('0x6'),_0x8269('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x8269('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 938502d..6171271 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 _0x57b0=['pick','filter','type','VIRTUAL','name','merge','includeAll','include','ZohoConfiguration','rows','catch','show','params','options','body','find','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','error','map','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters'];(function(_0x2087e8,_0x2ed4f7){var _0x2d8ec1=function(_0x298090){while(--_0x298090){_0x2087e8['push'](_0x2087e8['shift']());}};_0x2d8ec1(++_0x2ed4f7);}(_0x57b0,0x103));var _0x057b=function(_0x1b34c7,_0x48cfca){_0x1b34c7=_0x1b34c7-0x0;var _0x257afe=_0x57b0[_0x1b34c7];return _0x257afe;};'use strict';var emlformat=require(_0x057b('0x0'));var rimraf=require(_0x057b('0x1'));var zipdir=require(_0x057b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x057b('0x3'));var moment=require(_0x057b('0x4'));var BPromise=require(_0x057b('0x5'));var Mustache=require(_0x057b('0x6'));var util=require(_0x057b('0x7'));var path=require(_0x057b('0x8'));var sox=require(_0x057b('0x9'));var csv=require(_0x057b('0xa'));var ejs=require(_0x057b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x057b('0xc'));var squel=require(_0x057b('0xd'));var crypto=require(_0x057b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x057b('0xf'));var toCsv=require(_0x057b('0xa'));var querystring=require(_0x057b('0x10'));var Papa=require(_0x057b('0x11'));var Redis=require(_0x057b('0x12'));var authService=require(_0x057b('0x13'));var qs=require(_0x057b('0x14'));var as=require(_0x057b('0x15'));var hardwareService=require(_0x057b('0x16'));var logger=require(_0x057b('0x17'))('api');var utils=require(_0x057b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x057b('0x19'));var db=require(_0x057b('0x1a'))['db'];function respondWithStatusCode(_0x8c258c,_0x166176){_0x166176=_0x166176||0xcc;return function(_0x3f527a){if(_0x3f527a){return _0x8c258c[_0x057b('0x1b')](_0x166176);}return _0x8c258c[_0x057b('0x1c')](_0x166176)[_0x057b('0x1d')]();};}function respondWithResult(_0x3d95a7,_0x5c1a7e){_0x5c1a7e=_0x5c1a7e||0xc8;return function(_0x1f4a7){if(_0x1f4a7){return _0x3d95a7[_0x057b('0x1c')](_0x5c1a7e)[_0x057b('0x1e')](_0x1f4a7);}};}function respondWithFilteredResult(_0x3a2d78,_0x166bfd){return function(_0x2e65db){if(_0x2e65db){var _0x15e5a0=typeof _0x166bfd['offset']===_0x057b('0x1f')&&typeof _0x166bfd['limit']===_0x057b('0x1f');var _0x356465=_0x2e65db[_0x057b('0x20')];var _0x2dec4b=_0x15e5a0?0x0:_0x166bfd[_0x057b('0x21')];var _0x5ec4cb=_0x15e5a0?_0x2e65db[_0x057b('0x20')]:_0x166bfd['offset']+_0x166bfd['limit'];var _0x314a4d;if(_0x5ec4cb>=_0x356465){_0x5ec4cb=_0x356465;_0x314a4d=0xc8;}else{_0x314a4d=0xce;}_0x3a2d78['status'](_0x314a4d);return _0x3a2d78[_0x057b('0x22')](_0x057b('0x23'),_0x2dec4b+'-'+_0x5ec4cb+'/'+_0x356465)[_0x057b('0x1e')](_0x2e65db);}return null;};}function patchUpdates(_0x1a476d){return function(_0x3686a4){try{jsonpatch['apply'](_0x3686a4,_0x1a476d,!![]);}catch(_0x11e7e4){return BPromise[_0x057b('0x24')](_0x11e7e4);}return _0x3686a4['save']();};}function saveUpdates(_0x21b034,_0x475345){return function(_0x36c9c3){if(_0x36c9c3){return _0x36c9c3[_0x057b('0x25')](_0x21b034)[_0x057b('0x26')](function(_0x42f4fd){return _0x42f4fd;});}return null;};}function removeEntity(_0x58f128,_0x15fa71){return function(_0x3a318d){if(_0x3a318d){return _0x3a318d[_0x057b('0x27')]()[_0x057b('0x26')](function(){_0x58f128[_0x057b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5732a7,_0xc462ad){return function(_0x246f29){if(!_0x246f29){_0x5732a7[_0x057b('0x1b')](0x194);}return _0x246f29;};}function handleError(_0x4ba482,_0x933a76){_0x933a76=_0x933a76||0x1f4;return function(_0x29fa05){logger[_0x057b('0x28')](_0x29fa05['stack']);if(_0x29fa05['name']){delete _0x29fa05['name'];}_0x4ba482[_0x057b('0x1c')](_0x933a76)['send'](_0x29fa05);};}exports['index']=function(_0x77f8a1,_0x4083d2){var _0x702ae5={},_0x2b67ca={},_0x89e658={'count':0x0,'rows':[]};var _0x5abbb8=_[_0x057b('0x29')](db['ZohoConfiguration'][_0x057b('0x2a')],function(_0x314d64){return{'name':_0x314d64[_0x057b('0x2b')],'type':_0x314d64['type']['key']};});_0x2b67ca[_0x057b('0x2c')]=_[_0x057b('0x29')](_0x5abbb8,'name');_0x2b67ca['query']=_[_0x057b('0x2d')](_0x77f8a1[_0x057b('0x2e')]);_0x2b67ca['filters']=_[_0x057b('0x2f')](_0x2b67ca['model'],_0x2b67ca[_0x057b('0x2e')]);_0x702ae5[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x2b67ca['model'],qs[_0x057b('0x31')](_0x77f8a1[_0x057b('0x2e')][_0x057b('0x31')]));_0x702ae5[_0x057b('0x30')]=_0x702ae5['attributes'][_0x057b('0x32')]?_0x702ae5[_0x057b('0x30')]:_0x2b67ca['model'];if(!_0x77f8a1[_0x057b('0x2e')][_0x057b('0x33')]('nolimit')){_0x702ae5[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x77f8a1[_0x057b('0x2e')][_0x057b('0x34')]);_0x702ae5[_0x057b('0x21')]=qs[_0x057b('0x21')](_0x77f8a1[_0x057b('0x2e')]['offset']);}_0x702ae5[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x77f8a1[_0x057b('0x2e')]['sort']);_0x702ae5[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x77f8a1[_0x057b('0x2e')],_0x2b67ca[_0x057b('0x38')]),_0x5abbb8);if(_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3a')]){_0x702ae5['where']=_['merge'](_0x702ae5[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x5abbb8,function(_0x5931cf){if(_0x5931cf[_0x057b('0x3b')]!==_0x057b('0x3c')){var _0x11483d={};_0x11483d[_0x5931cf[_0x057b('0x3d')]]={'$like':'%'+_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3a')]+'%'};return _0x11483d;}})});}_0x702ae5=_[_0x057b('0x3e')]({},_0x702ae5,_0x77f8a1['options']);var _0x31adce={'where':_0x702ae5[_0x057b('0x37')]};return db['ZohoConfiguration']['count'](_0x31adce)[_0x057b('0x26')](function(_0x64d507){_0x89e658[_0x057b('0x20')]=_0x64d507;if(_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3f')]){_0x702ae5[_0x057b('0x40')]=[{'all':!![]}];}return db[_0x057b('0x41')]['findAll'](_0x702ae5);})[_0x057b('0x26')](function(_0x4a0944){_0x89e658[_0x057b('0x42')]=_0x4a0944;return _0x89e658;})[_0x057b('0x26')](respondWithFilteredResult(_0x4083d2,_0x702ae5))[_0x057b('0x43')](handleError(_0x4083d2,null));};exports[_0x057b('0x44')]=function(_0xd65821,_0x20ce00){var _0x5c0497={'raw':![],'where':{'id':_0xd65821[_0x057b('0x45')]['id']}},_0xe90ed8={};_0xe90ed8[_0x057b('0x2c')]=_[_0x057b('0x2d')](db['ZohoConfiguration'][_0x057b('0x2a')]);_0xe90ed8[_0x057b('0x2e')]=_[_0x057b('0x2d')](_0xd65821[_0x057b('0x2e')]);_0xe90ed8[_0x057b('0x38')]=_['intersection'](_0xe90ed8[_0x057b('0x2c')],_0xe90ed8[_0x057b('0x2e')]);_0x5c0497['attributes']=_[_0x057b('0x2f')](_0xe90ed8[_0x057b('0x2c')],qs['fields'](_0xd65821['query']['fields']));_0x5c0497[_0x057b('0x30')]=_0x5c0497['attributes'][_0x057b('0x32')]?_0x5c0497[_0x057b('0x30')]:_0xe90ed8[_0x057b('0x2c')];if(_0xd65821[_0x057b('0x2e')][_0x057b('0x3f')]){_0x5c0497[_0x057b('0x40')]=[{'all':!![]}];}_0x5c0497=_['merge']({},_0x5c0497,_0xd65821[_0x057b('0x46')]);return db[_0x057b('0x41')]['find'](_0x5c0497)[_0x057b('0x26')](handleEntityNotFound(_0x20ce00,null))[_0x057b('0x26')](respondWithResult(_0x20ce00,null))[_0x057b('0x43')](handleError(_0x20ce00,null));};exports['create']=function(_0x1f6bda,_0x376dd3){return db[_0x057b('0x41')]['create'](_0x1f6bda[_0x057b('0x47')],{})[_0x057b('0x26')](respondWithResult(_0x376dd3,0xc9))[_0x057b('0x43')](handleError(_0x376dd3,null));};exports[_0x057b('0x25')]=function(_0x2fda90,_0x468656){if(_0x2fda90[_0x057b('0x47')]['id']){delete _0x2fda90['body']['id'];}return db[_0x057b('0x41')]['find']({'where':{'id':_0x2fda90['params']['id']}})['then'](handleEntityNotFound(_0x468656,null))[_0x057b('0x26')](saveUpdates(_0x2fda90[_0x057b('0x47')],null))[_0x057b('0x26')](respondWithResult(_0x468656,null))[_0x057b('0x43')](handleError(_0x468656,null));};exports[_0x057b('0x27')]=function(_0x3dd11d,_0x5dd1db){return db[_0x057b('0x41')][_0x057b('0x48')]({'where':{'id':_0x3dd11d[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x5dd1db,null))[_0x057b('0x26')](removeEntity(_0x5dd1db,null))[_0x057b('0x43')](handleError(_0x5dd1db,null));};exports[_0x057b('0x49')]=function(_0x1900c9,_0xfa78ab,_0x788877){var _0x197320={};var _0x31c27c={};var _0x57fa8a;var _0x2e1b83;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x1900c9[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0xfa78ab,null))[_0x057b('0x26')](function(_0x7ebe43){if(_0x7ebe43){_0x57fa8a=_0x7ebe43;_0x31c27c[_0x057b('0x2c')]=_[_0x057b('0x2d')](db[_0x057b('0x4b')]['rawAttributes']);_0x31c27c[_0x057b('0x2e')]=_[_0x057b('0x2d')](_0x1900c9[_0x057b('0x2e')]);_0x31c27c[_0x057b('0x38')]=_[_0x057b('0x2f')](_0x31c27c['model'],_0x31c27c[_0x057b('0x2e')]);_0x197320[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x31c27c[_0x057b('0x2c')],qs[_0x057b('0x31')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x31')]));_0x197320[_0x057b('0x30')]=_0x197320[_0x057b('0x30')][_0x057b('0x32')]?_0x197320['attributes']:_0x31c27c[_0x057b('0x2c')];_0x197320['order']=qs['sort'](_0x1900c9['query']['sort']);_0x197320['where']=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x1900c9['query'],_0x31c27c['filters']));if(_0x1900c9[_0x057b('0x2e')]['filter']){_0x197320[_0x057b('0x37')]=_[_0x057b('0x3e')](_0x197320[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x197320['attributes'],function(_0x39111a){var _0x544010={};_0x544010[_0x39111a]={'$like':'%'+_0x1900c9[_0x057b('0x2e')][_0x057b('0x3a')]+'%'};return _0x544010;})});}_0x197320=_['merge']({},_0x197320,_0x1900c9[_0x057b('0x46')]);return _0x57fa8a[_0x057b('0x49')](_0x197320);}})[_0x057b('0x26')](function(_0x2df354){if(_0x2df354){_0x2e1b83=_0x2df354[_0x057b('0x32')];if(!_0x1900c9[_0x057b('0x2e')]['hasOwnProperty'](_0x057b('0x4c'))){_0x197320[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x34')]);_0x197320['offset']=qs[_0x057b('0x21')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x21')]);}return _0x57fa8a[_0x057b('0x49')](_0x197320);}})[_0x057b('0x26')](function(_0xc7ec77){if(_0xc7ec77){return _0xc7ec77?{'count':_0x2e1b83,'rows':_0xc7ec77}:null;}})[_0x057b('0x26')](respondWithResult(_0xfa78ab,null))[_0x057b('0x43')](handleError(_0xfa78ab,null));};exports[_0x057b('0x4d')]=function(_0x374377,_0x3eb223,_0xccf527){var _0x4ed969={};var _0x550203={};var _0x52944b;var _0x17319c;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x374377[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x3eb223,null))[_0x057b('0x26')](function(_0x3458fb){if(_0x3458fb){_0x52944b=_0x3458fb;_0x550203[_0x057b('0x2c')]=_[_0x057b('0x2d')](db[_0x057b('0x4b')][_0x057b('0x2a')]);_0x550203[_0x057b('0x2e')]=_['keys'](_0x374377[_0x057b('0x2e')]);_0x550203['filters']=_['intersection'](_0x550203[_0x057b('0x2c')],_0x550203['query']);_0x4ed969[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x550203['model'],qs[_0x057b('0x31')](_0x374377[_0x057b('0x2e')][_0x057b('0x31')]));_0x4ed969[_0x057b('0x30')]=_0x4ed969[_0x057b('0x30')][_0x057b('0x32')]?_0x4ed969['attributes']:_0x550203['model'];_0x4ed969[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x374377[_0x057b('0x2e')][_0x057b('0x36')]);_0x4ed969[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x374377[_0x057b('0x2e')],_0x550203[_0x057b('0x38')]));if(_0x374377[_0x057b('0x2e')][_0x057b('0x3a')]){_0x4ed969[_0x057b('0x37')]=_[_0x057b('0x3e')](_0x4ed969[_0x057b('0x37')],{'$or':_['map'](_0x4ed969[_0x057b('0x30')],function(_0x550e40){var _0x2e0658={};_0x2e0658[_0x550e40]={'$like':'%'+_0x374377['query'][_0x057b('0x3a')]+'%'};return _0x2e0658;})});}_0x4ed969=_[_0x057b('0x3e')]({},_0x4ed969,_0x374377['options']);return _0x52944b['getSubjects'](_0x4ed969);}})['then'](function(_0x4b8923){if(_0x4b8923){_0x17319c=_0x4b8923['length'];if(!_0x374377['query'][_0x057b('0x33')](_0x057b('0x4c'))){_0x4ed969[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x374377['query']['limit']);_0x4ed969[_0x057b('0x21')]=qs['offset'](_0x374377['query'][_0x057b('0x21')]);}return _0x52944b['getSubjects'](_0x4ed969);}})[_0x057b('0x26')](function(_0x4e9111){if(_0x4e9111){return _0x4e9111?{'count':_0x17319c,'rows':_0x4e9111}:null;}})['then'](respondWithResult(_0x3eb223,null))['catch'](handleError(_0x3eb223,null));};exports[_0x057b('0x4e')]=function(_0x2ef831,_0x3430f3,_0xfb5f4d){var _0x4f3f26={};var _0x3d3e92={};var _0x50d2fa;var _0xb65ef7;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x2ef831['params']['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x3430f3,null))['then'](function(_0x534c67){if(_0x534c67){_0x50d2fa=_0x534c67;_0x3d3e92[_0x057b('0x2c')]=_['keys'](db['ZohoField'][_0x057b('0x2a')]);_0x3d3e92['query']=_[_0x057b('0x2d')](_0x2ef831[_0x057b('0x2e')]);_0x3d3e92[_0x057b('0x38')]=_[_0x057b('0x2f')](_0x3d3e92[_0x057b('0x2c')],_0x3d3e92[_0x057b('0x2e')]);_0x4f3f26[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x3d3e92['model'],qs['fields'](_0x2ef831['query']['fields']));_0x4f3f26['attributes']=_0x4f3f26[_0x057b('0x30')][_0x057b('0x32')]?_0x4f3f26[_0x057b('0x30')]:_0x3d3e92[_0x057b('0x2c')];_0x4f3f26[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x36')]);_0x4f3f26[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x2ef831[_0x057b('0x2e')],_0x3d3e92[_0x057b('0x38')]));if(_0x2ef831[_0x057b('0x2e')][_0x057b('0x3a')]){_0x4f3f26[_0x057b('0x37')]=_['merge'](_0x4f3f26[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x4f3f26[_0x057b('0x30')],function(_0x2c474c){var _0x35516b={};_0x35516b[_0x2c474c]={'$like':'%'+_0x2ef831['query'][_0x057b('0x3a')]+'%'};return _0x35516b;})});}_0x4f3f26=_['merge']({},_0x4f3f26,_0x2ef831[_0x057b('0x46')]);return _0x50d2fa['getDescriptions'](_0x4f3f26);}})['then'](function(_0x134e24){if(_0x134e24){_0xb65ef7=_0x134e24[_0x057b('0x32')];if(!_0x2ef831[_0x057b('0x2e')]['hasOwnProperty'](_0x057b('0x4c'))){_0x4f3f26['limit']=qs[_0x057b('0x34')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x34')]);_0x4f3f26[_0x057b('0x21')]=qs[_0x057b('0x21')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x21')]);}return _0x50d2fa[_0x057b('0x4e')](_0x4f3f26);}})['then'](function(_0x3a199e){if(_0x3a199e){return _0x3a199e?{'count':_0xb65ef7,'rows':_0x3a199e}:null;}})['then'](respondWithResult(_0x3430f3,null))['catch'](handleError(_0x3430f3,null));}; \ No newline at end of file +var _0xf742=['crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','include','catch','params','options','create','body','find','findOne','getFields','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x8c3533,_0x32829c){var _0x23a48c=function(_0x54104b){while(--_0x54104b){_0x8c3533['push'](_0x8c3533['shift']());}};_0x23a48c(++_0x32829c);}(_0xf742,0x8d));var _0x2f74=function(_0xe4fa61,_0x1b82bf){_0xe4fa61=_0xe4fa61-0x0;var _0x42879a=_0xf742[_0xe4fa61];return _0x42879a;};'use strict';var emlformat=require(_0x2f74('0x0'));var rimraf=require(_0x2f74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f74('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f74('0x3'));var Mustache=require(_0x2f74('0x4'));var util=require(_0x2f74('0x5'));var path=require(_0x2f74('0x6'));var sox=require(_0x2f74('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f74('0x8'));var _=require(_0x2f74('0x9'));var squel=require(_0x2f74('0xa'));var crypto=require(_0x2f74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2f74('0xc'));var toCsv=require(_0x2f74('0xd'));var querystring=require(_0x2f74('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2f74('0xf'));var qs=require(_0x2f74('0x10'));var as=require(_0x2f74('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f74('0x12'))('api');var utils=require(_0x2f74('0x13'));var config=require(_0x2f74('0x14'));var licenseUtil=require(_0x2f74('0x15'));var db=require(_0x2f74('0x16'))['db'];function respondWithStatusCode(_0x10f561,_0x807ab0){_0x807ab0=_0x807ab0||0xcc;return function(_0x37462b){if(_0x37462b){return _0x10f561['sendStatus'](_0x807ab0);}return _0x10f561[_0x2f74('0x17')](_0x807ab0)[_0x2f74('0x18')]();};}function respondWithResult(_0x3057d2,_0x5adbd9){_0x5adbd9=_0x5adbd9||0xc8;return function(_0x9f2c8e){if(_0x9f2c8e){return _0x3057d2['status'](_0x5adbd9)[_0x2f74('0x19')](_0x9f2c8e);}};}function respondWithFilteredResult(_0x113871,_0x26149b){return function(_0x1283e1){if(_0x1283e1){var _0x3784cc=typeof _0x26149b['offset']==='undefined'&&typeof _0x26149b[_0x2f74('0x1a')]===_0x2f74('0x1b');var _0x36e56c=_0x1283e1[_0x2f74('0x1c')];var _0x446973=_0x3784cc?0x0:_0x26149b[_0x2f74('0x1d')];var _0xab1eaa=_0x3784cc?_0x1283e1[_0x2f74('0x1c')]:_0x26149b[_0x2f74('0x1d')]+_0x26149b[_0x2f74('0x1a')];var _0x7128c9;if(_0xab1eaa>=_0x36e56c){_0xab1eaa=_0x36e56c;_0x7128c9=0xc8;}else{_0x7128c9=0xce;}_0x113871[_0x2f74('0x17')](_0x7128c9);return _0x113871[_0x2f74('0x1e')](_0x2f74('0x1f'),_0x446973+'-'+_0xab1eaa+'/'+_0x36e56c)['json'](_0x1283e1);}return null;};}function patchUpdates(_0x2afbff){return function(_0x3778db){try{jsonpatch['apply'](_0x3778db,_0x2afbff,!![]);}catch(_0x52e4dc){return BPromise[_0x2f74('0x20')](_0x52e4dc);}return _0x3778db[_0x2f74('0x21')]();};}function saveUpdates(_0x386031,_0xc2307b){return function(_0x556c38){if(_0x556c38){return _0x556c38[_0x2f74('0x22')](_0x386031)['then'](function(_0x3063a2){return _0x3063a2;});}return null;};}function removeEntity(_0x2edc75,_0x35f35f){return function(_0x3e9bc5){if(_0x3e9bc5){return _0x3e9bc5[_0x2f74('0x23')]()[_0x2f74('0x24')](function(){_0x2edc75[_0x2f74('0x17')](0xcc)[_0x2f74('0x18')]();});}};}function handleEntityNotFound(_0x6c6e10,_0x1e334a){return function(_0x35d09d){if(!_0x35d09d){_0x6c6e10['sendStatus'](0x194);}return _0x35d09d;};}function handleError(_0x21050d,_0x4c341){_0x4c341=_0x4c341||0x1f4;return function(_0xa4ccad){logger[_0x2f74('0x25')](_0xa4ccad[_0x2f74('0x26')]);if(_0xa4ccad[_0x2f74('0x27')]){delete _0xa4ccad[_0x2f74('0x27')];}_0x21050d[_0x2f74('0x17')](_0x4c341)[_0x2f74('0x28')](_0xa4ccad);};}exports['index']=function(_0x433238,_0x200276){var _0x7db335={},_0x183fd5={},_0x24d317={'count':0x0,'rows':[]};var _0x82c73f=_[_0x2f74('0x29')](db[_0x2f74('0x2a')][_0x2f74('0x2b')],function(_0x34efd9){return{'name':_0x34efd9[_0x2f74('0x2c')],'type':_0x34efd9['type'][_0x2f74('0x2d')]};});_0x183fd5[_0x2f74('0x2e')]=_[_0x2f74('0x29')](_0x82c73f,_0x2f74('0x27'));_0x183fd5[_0x2f74('0x2f')]=_[_0x2f74('0x30')](_0x433238[_0x2f74('0x2f')]);_0x183fd5['filters']=_[_0x2f74('0x31')](_0x183fd5[_0x2f74('0x2e')],_0x183fd5[_0x2f74('0x2f')]);_0x7db335[_0x2f74('0x32')]=_['intersection'](_0x183fd5[_0x2f74('0x2e')],qs[_0x2f74('0x33')](_0x433238[_0x2f74('0x2f')]['fields']));_0x7db335[_0x2f74('0x32')]=_0x7db335['attributes'][_0x2f74('0x34')]?_0x7db335[_0x2f74('0x32')]:_0x183fd5['model'];if(!_0x433238[_0x2f74('0x2f')]['hasOwnProperty'](_0x2f74('0x35'))){_0x7db335[_0x2f74('0x1a')]=qs[_0x2f74('0x1a')](_0x433238[_0x2f74('0x2f')][_0x2f74('0x1a')]);_0x7db335[_0x2f74('0x1d')]=qs[_0x2f74('0x1d')](_0x433238[_0x2f74('0x2f')][_0x2f74('0x1d')]);}_0x7db335[_0x2f74('0x36')]=qs[_0x2f74('0x37')](_0x433238['query'][_0x2f74('0x37')]);_0x7db335['where']=qs[_0x2f74('0x38')](_[_0x2f74('0x39')](_0x433238['query'],_0x183fd5[_0x2f74('0x38')]),_0x82c73f);if(_0x433238['query']['filter']){_0x7db335[_0x2f74('0x3a')]=_[_0x2f74('0x3b')](_0x7db335[_0x2f74('0x3a')],{'$or':_[_0x2f74('0x29')](_0x82c73f,function(_0x3fdb13){if(_0x3fdb13[_0x2f74('0x3c')]!==_0x2f74('0x3d')){var _0x5503a5={};_0x5503a5[_0x3fdb13[_0x2f74('0x27')]]={'$like':'%'+_0x433238[_0x2f74('0x2f')][_0x2f74('0x3e')]+'%'};return _0x5503a5;}})});}_0x7db335=_['merge']({},_0x7db335,_0x433238['options']);var _0x28387b={'where':_0x7db335[_0x2f74('0x3a')]};return db[_0x2f74('0x2a')][_0x2f74('0x1c')](_0x28387b)['then'](function(_0x3a2c0a){_0x24d317['count']=_0x3a2c0a;if(_0x433238[_0x2f74('0x2f')][_0x2f74('0x3f')]){_0x7db335[_0x2f74('0x40')]=[{'all':!![]}];}return db[_0x2f74('0x2a')]['findAll'](_0x7db335);})[_0x2f74('0x24')](function(_0x1a2a91){_0x24d317['rows']=_0x1a2a91;return _0x24d317;})['then'](respondWithFilteredResult(_0x200276,_0x7db335))[_0x2f74('0x41')](handleError(_0x200276,null));};exports['show']=function(_0x2635ed,_0x235d21){var _0x1b17b4={'raw':![],'where':{'id':_0x2635ed[_0x2f74('0x42')]['id']}},_0x4117dc={};_0x4117dc[_0x2f74('0x2e')]=_[_0x2f74('0x30')](db[_0x2f74('0x2a')][_0x2f74('0x2b')]);_0x4117dc[_0x2f74('0x2f')]=_[_0x2f74('0x30')](_0x2635ed[_0x2f74('0x2f')]);_0x4117dc[_0x2f74('0x38')]=_['intersection'](_0x4117dc[_0x2f74('0x2e')],_0x4117dc[_0x2f74('0x2f')]);_0x1b17b4[_0x2f74('0x32')]=_[_0x2f74('0x31')](_0x4117dc[_0x2f74('0x2e')],qs[_0x2f74('0x33')](_0x2635ed[_0x2f74('0x2f')][_0x2f74('0x33')]));_0x1b17b4[_0x2f74('0x32')]=_0x1b17b4[_0x2f74('0x32')][_0x2f74('0x34')]?_0x1b17b4[_0x2f74('0x32')]:_0x4117dc[_0x2f74('0x2e')];if(_0x2635ed[_0x2f74('0x2f')]['includeAll']){_0x1b17b4[_0x2f74('0x40')]=[{'all':!![]}];}_0x1b17b4=_[_0x2f74('0x3b')]({},_0x1b17b4,_0x2635ed[_0x2f74('0x43')]);return db[_0x2f74('0x2a')]['find'](_0x1b17b4)[_0x2f74('0x24')](handleEntityNotFound(_0x235d21,null))[_0x2f74('0x24')](respondWithResult(_0x235d21,null))[_0x2f74('0x41')](handleError(_0x235d21,null));};exports['create']=function(_0x2440f3,_0x57f632){return db[_0x2f74('0x2a')][_0x2f74('0x44')](_0x2440f3[_0x2f74('0x45')],{})[_0x2f74('0x24')](respondWithResult(_0x57f632,0xc9))[_0x2f74('0x41')](handleError(_0x57f632,null));};exports[_0x2f74('0x22')]=function(_0x17705d,_0x1db81b){if(_0x17705d[_0x2f74('0x45')]['id']){delete _0x17705d[_0x2f74('0x45')]['id'];}return db[_0x2f74('0x2a')][_0x2f74('0x46')]({'where':{'id':_0x17705d[_0x2f74('0x42')]['id']}})['then'](handleEntityNotFound(_0x1db81b,null))[_0x2f74('0x24')](saveUpdates(_0x17705d['body'],null))[_0x2f74('0x24')](respondWithResult(_0x1db81b,null))[_0x2f74('0x41')](handleError(_0x1db81b,null));};exports[_0x2f74('0x23')]=function(_0x43b323,_0x1dc4da){return db[_0x2f74('0x2a')][_0x2f74('0x46')]({'where':{'id':_0x43b323[_0x2f74('0x42')]['id']}})[_0x2f74('0x24')](handleEntityNotFound(_0x1dc4da,null))['then'](removeEntity(_0x1dc4da,null))['catch'](handleError(_0x1dc4da,null));};exports['getFields']=function(_0x51130b,_0x5f0ddb,_0x1bf427){var _0x256aee={};var _0x2a6bbf={};var _0x1ef61a;var _0x194f12;return db['ZohoConfiguration'][_0x2f74('0x47')]({'where':{'id':_0x51130b[_0x2f74('0x42')]['id']}})['then'](handleEntityNotFound(_0x5f0ddb,null))[_0x2f74('0x24')](function(_0xef8985){if(_0xef8985){_0x1ef61a=_0xef8985;_0x2a6bbf[_0x2f74('0x2e')]=_[_0x2f74('0x30')](db['ZohoField'][_0x2f74('0x2b')]);_0x2a6bbf[_0x2f74('0x2f')]=_[_0x2f74('0x30')](_0x51130b[_0x2f74('0x2f')]);_0x2a6bbf[_0x2f74('0x38')]=_['intersection'](_0x2a6bbf[_0x2f74('0x2e')],_0x2a6bbf[_0x2f74('0x2f')]);_0x256aee[_0x2f74('0x32')]=_['intersection'](_0x2a6bbf['model'],qs[_0x2f74('0x33')](_0x51130b[_0x2f74('0x2f')]['fields']));_0x256aee['attributes']=_0x256aee[_0x2f74('0x32')][_0x2f74('0x34')]?_0x256aee[_0x2f74('0x32')]:_0x2a6bbf[_0x2f74('0x2e')];_0x256aee['order']=qs['sort'](_0x51130b[_0x2f74('0x2f')][_0x2f74('0x37')]);_0x256aee[_0x2f74('0x3a')]=qs[_0x2f74('0x38')](_[_0x2f74('0x39')](_0x51130b[_0x2f74('0x2f')],_0x2a6bbf[_0x2f74('0x38')]));if(_0x51130b[_0x2f74('0x2f')][_0x2f74('0x3e')]){_0x256aee[_0x2f74('0x3a')]=_[_0x2f74('0x3b')](_0x256aee[_0x2f74('0x3a')],{'$or':_[_0x2f74('0x29')](_0x256aee[_0x2f74('0x32')],function(_0x40bcd0){var _0x30ac24={};_0x30ac24[_0x40bcd0]={'$like':'%'+_0x51130b[_0x2f74('0x2f')]['filter']+'%'};return _0x30ac24;})});}_0x256aee=_['merge']({},_0x256aee,_0x51130b['options']);return _0x1ef61a['getFields'](_0x256aee);}})[_0x2f74('0x24')](function(_0x2c00b7){if(_0x2c00b7){_0x194f12=_0x2c00b7['length'];if(!_0x51130b[_0x2f74('0x2f')]['hasOwnProperty']('nolimit')){_0x256aee[_0x2f74('0x1a')]=qs['limit'](_0x51130b['query']['limit']);_0x256aee[_0x2f74('0x1d')]=qs['offset'](_0x51130b[_0x2f74('0x2f')]['offset']);}return _0x1ef61a[_0x2f74('0x48')](_0x256aee);}})['then'](function(_0x543e92){if(_0x543e92){return _0x543e92?{'count':_0x194f12,'rows':_0x543e92}:null;}})[_0x2f74('0x24')](respondWithResult(_0x5f0ddb,null))['catch'](handleError(_0x5f0ddb,null));};exports[_0x2f74('0x49')]=function(_0x5bbf52,_0x303f22,_0x9d5b59){var _0x2c67c7={};var _0x2f7254={};var _0x38cdb7;var _0x4e7708;return db['ZohoConfiguration'][_0x2f74('0x47')]({'where':{'id':_0x5bbf52['params']['id']}})[_0x2f74('0x24')](handleEntityNotFound(_0x303f22,null))['then'](function(_0x48a1e0){if(_0x48a1e0){_0x38cdb7=_0x48a1e0;_0x2f7254[_0x2f74('0x2e')]=_[_0x2f74('0x30')](db[_0x2f74('0x4a')][_0x2f74('0x2b')]);_0x2f7254['query']=_[_0x2f74('0x30')](_0x5bbf52['query']);_0x2f7254['filters']=_[_0x2f74('0x31')](_0x2f7254['model'],_0x2f7254[_0x2f74('0x2f')]);_0x2c67c7[_0x2f74('0x32')]=_[_0x2f74('0x31')](_0x2f7254['model'],qs[_0x2f74('0x33')](_0x5bbf52[_0x2f74('0x2f')][_0x2f74('0x33')]));_0x2c67c7[_0x2f74('0x32')]=_0x2c67c7[_0x2f74('0x32')][_0x2f74('0x34')]?_0x2c67c7[_0x2f74('0x32')]:_0x2f7254[_0x2f74('0x2e')];_0x2c67c7['order']=qs[_0x2f74('0x37')](_0x5bbf52[_0x2f74('0x2f')]['sort']);_0x2c67c7[_0x2f74('0x3a')]=qs[_0x2f74('0x38')](_[_0x2f74('0x39')](_0x5bbf52['query'],_0x2f7254[_0x2f74('0x38')]));if(_0x5bbf52[_0x2f74('0x2f')][_0x2f74('0x3e')]){_0x2c67c7[_0x2f74('0x3a')]=_[_0x2f74('0x3b')](_0x2c67c7['where'],{'$or':_[_0x2f74('0x29')](_0x2c67c7[_0x2f74('0x32')],function(_0x5e037a){var _0x270efa={};_0x270efa[_0x5e037a]={'$like':'%'+_0x5bbf52[_0x2f74('0x2f')][_0x2f74('0x3e')]+'%'};return _0x270efa;})});}_0x2c67c7=_[_0x2f74('0x3b')]({},_0x2c67c7,_0x5bbf52[_0x2f74('0x43')]);return _0x38cdb7['getSubjects'](_0x2c67c7);}})[_0x2f74('0x24')](function(_0x56a59c){if(_0x56a59c){_0x4e7708=_0x56a59c['length'];if(!_0x5bbf52[_0x2f74('0x2f')]['hasOwnProperty'](_0x2f74('0x35'))){_0x2c67c7['limit']=qs['limit'](_0x5bbf52[_0x2f74('0x2f')][_0x2f74('0x1a')]);_0x2c67c7[_0x2f74('0x1d')]=qs[_0x2f74('0x1d')](_0x5bbf52[_0x2f74('0x2f')][_0x2f74('0x1d')]);}return _0x38cdb7[_0x2f74('0x49')](_0x2c67c7);}})['then'](function(_0x5f5629){if(_0x5f5629){return _0x5f5629?{'count':_0x4e7708,'rows':_0x5f5629}:null;}})[_0x2f74('0x24')](respondWithResult(_0x303f22,null))[_0x2f74('0x41')](handleError(_0x303f22,null));};exports[_0x2f74('0x4b')]=function(_0x58f377,_0x40ce0a,_0x5d18de){var _0x268a0f={};var _0x1d5335={};var _0x571105;var _0xcbce41;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x58f377[_0x2f74('0x42')]['id']}})[_0x2f74('0x24')](handleEntityNotFound(_0x40ce0a,null))[_0x2f74('0x24')](function(_0x5b7ad5){if(_0x5b7ad5){_0x571105=_0x5b7ad5;_0x1d5335[_0x2f74('0x2e')]=_['keys'](db[_0x2f74('0x4a')][_0x2f74('0x2b')]);_0x1d5335[_0x2f74('0x2f')]=_[_0x2f74('0x30')](_0x58f377[_0x2f74('0x2f')]);_0x1d5335[_0x2f74('0x38')]=_['intersection'](_0x1d5335[_0x2f74('0x2e')],_0x1d5335[_0x2f74('0x2f')]);_0x268a0f[_0x2f74('0x32')]=_[_0x2f74('0x31')](_0x1d5335[_0x2f74('0x2e')],qs[_0x2f74('0x33')](_0x58f377[_0x2f74('0x2f')][_0x2f74('0x33')]));_0x268a0f[_0x2f74('0x32')]=_0x268a0f[_0x2f74('0x32')][_0x2f74('0x34')]?_0x268a0f[_0x2f74('0x32')]:_0x1d5335[_0x2f74('0x2e')];_0x268a0f[_0x2f74('0x36')]=qs[_0x2f74('0x37')](_0x58f377[_0x2f74('0x2f')]['sort']);_0x268a0f[_0x2f74('0x3a')]=qs[_0x2f74('0x38')](_[_0x2f74('0x39')](_0x58f377[_0x2f74('0x2f')],_0x1d5335[_0x2f74('0x38')]));if(_0x58f377['query'][_0x2f74('0x3e')]){_0x268a0f[_0x2f74('0x3a')]=_[_0x2f74('0x3b')](_0x268a0f[_0x2f74('0x3a')],{'$or':_['map'](_0x268a0f[_0x2f74('0x32')],function(_0x524224){var _0x3ebdbf={};_0x3ebdbf[_0x524224]={'$like':'%'+_0x58f377[_0x2f74('0x2f')][_0x2f74('0x3e')]+'%'};return _0x3ebdbf;})});}_0x268a0f=_[_0x2f74('0x3b')]({},_0x268a0f,_0x58f377[_0x2f74('0x43')]);return _0x571105[_0x2f74('0x4b')](_0x268a0f);}})['then'](function(_0x4c0ef8){if(_0x4c0ef8){_0xcbce41=_0x4c0ef8[_0x2f74('0x34')];if(!_0x58f377[_0x2f74('0x2f')]['hasOwnProperty']('nolimit')){_0x268a0f['limit']=qs[_0x2f74('0x1a')](_0x58f377[_0x2f74('0x2f')][_0x2f74('0x1a')]);_0x268a0f[_0x2f74('0x1d')]=qs[_0x2f74('0x1d')](_0x58f377[_0x2f74('0x2f')]['offset']);}return _0x571105[_0x2f74('0x4b')](_0x268a0f);}})[_0x2f74('0x24')](function(_0x5c645d){if(_0x5c645d){return _0x5c645d?{'count':_0xcbce41,'rows':_0x5c645d}:null;}})[_0x2f74('0x24')](respondWithResult(_0x40ce0a,null))[_0x2f74('0x41')](handleError(_0x40ce0a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a7da38f..a624a7b 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 _0x1744=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','lodash','util'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x1744,0x1a2));var _0x4174=function(_0x49157b,_0x5d8601){_0x49157b=_0x49157b-0x0;var _0x3ea5d4=_0x1744[_0x49157b];return _0x3ea5d4;};'use strict';var _=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var logger=require(_0x4174('0x2'))(_0x4174('0x3'));var moment=require(_0x4174('0x4'));var BPromise=require(_0x4174('0x5'));var rp=require(_0x4174('0x6'));var fs=require('fs');var path=require(_0x4174('0x7'));var rimraf=require(_0x4174('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x2acbcc,_0x5247c1){return _0x2acbcc[_0x4174('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb3c=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0xdb3c,0x1ea));var _0xcdb3=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0xdb3c[_0x1ef547];return _0x1d697b;};'use strict';var _=require(_0xcdb3('0x0'));var util=require(_0xcdb3('0x1'));var logger=require(_0xcdb3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcdb3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdb3('0x4'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xcdb3('0x5')]=function(_0x3688f1,_0x10d4ba){return _0x3688f1[_0xcdb3('0x6')](_0xcdb3('0x7'),attributes,{'tableName':_0xcdb3('0x8'),'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 7c6cdb7..a8f59f2 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 _0x0fe3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch'];(function(_0xbd9079,_0x635c14){var _0x1e7151=function(_0xc42453){while(--_0xc42453){_0xbd9079['push'](_0xbd9079['shift']());}};_0x1e7151(++_0x635c14);}(_0x0fe3,0x187));var _0x30fe=function(_0x25e149,_0x410dea){_0x25e149=_0x25e149-0x0;var _0x1507be=_0x0fe3[_0x25e149];return _0x1507be;};'use strict';var _=require(_0x30fe('0x0'));var util=require(_0x30fe('0x1'));var moment=require(_0x30fe('0x2'));var BPromise=require(_0x30fe('0x3'));var rs=require(_0x30fe('0x4'));var fs=require('fs');var Redis=require(_0x30fe('0x5'));var db=require(_0x30fe('0x6'))['db'];var utils=require(_0x30fe('0x7'));var logger=require(_0x30fe('0x8'))(_0x30fe('0x9'));var config=require(_0x30fe('0xa'));var jayson=require(_0x30fe('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20626e,_0x3d9613,_0x520a2d){return new BPromise(function(_0xb56447,_0x57b1a6){return client[_0x30fe('0xc')](_0x20626e,_0x520a2d)['then'](function(_0x579428){logger[_0x30fe('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x30fe('0xe'));logger[_0x30fe('0xf')](_0x30fe('0x10'),_0x3d9613,_0x30fe('0xe'),JSON[_0x30fe('0x11')](_0x579428));if(_0x579428[_0x30fe('0x12')]){if(_0x579428['error'][_0x30fe('0x13')]===0x1f4){logger[_0x30fe('0x12')](_0x30fe('0x14'),_0x3d9613,_0x579428[_0x30fe('0x12')][_0x30fe('0x15')]);return _0x57b1a6(_0x579428[_0x30fe('0x12')][_0x30fe('0x15')]);}logger[_0x30fe('0x12')](_0x30fe('0x14'),_0x3d9613,_0x579428['error'][_0x30fe('0x15')]);return _0xb56447(_0x579428[_0x30fe('0x12')]['message']);}else{logger[_0x30fe('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x30fe('0xe'));_0xb56447(_0x579428['result'][_0x30fe('0x15')]);}})[_0x30fe('0x16')](function(_0x38c91c){logger[_0x30fe('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x38c91c);_0x57b1a6(_0x38c91c);});});} \ No newline at end of file +var _0xad56=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xad56,0x68));var _0x6ad5=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0xad56[_0x43ee7e];return _0x22d326;};'use strict';var _=require(_0x6ad5('0x0'));var util=require('util');var moment=require(_0x6ad5('0x1'));var BPromise=require(_0x6ad5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ad5('0x4'));var logger=require('../../config/logger')(_0x6ad5('0x5'));var config=require(_0x6ad5('0x6'));var jayson=require(_0x6ad5('0x7'));var client=jayson['client'][_0x6ad5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2601a8,_0x3e86f9,_0xe020f1){return new BPromise(function(_0x501476,_0x1693d3){return client[_0x6ad5('0x9')](_0x2601a8,_0xe020f1)[_0x6ad5('0xa')](function(_0x3996b1){logger['info'](_0x6ad5('0xb'),_0x3e86f9,_0x6ad5('0xc'));logger[_0x6ad5('0xd')](_0x6ad5('0xe'),_0x3e86f9,'request\x20sent',JSON[_0x6ad5('0xf')](_0x3996b1));if(_0x3996b1['error']){if(_0x3996b1[_0x6ad5('0x10')][_0x6ad5('0x11')]===0x1f4){logger[_0x6ad5('0x10')](_0x6ad5('0xb'),_0x3e86f9,_0x3996b1[_0x6ad5('0x10')][_0x6ad5('0x12')]);return _0x1693d3(_0x3996b1[_0x6ad5('0x10')][_0x6ad5('0x12')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3e86f9,_0x3996b1[_0x6ad5('0x10')]['message']);return _0x501476(_0x3996b1[_0x6ad5('0x10')]['message']);}else{logger[_0x6ad5('0x13')](_0x6ad5('0xb'),_0x3e86f9,_0x6ad5('0xc'));_0x501476(_0x3996b1[_0x6ad5('0x14')]['message']);}})['catch'](function(_0x45a37a){logger[_0x6ad5('0x10')](_0x6ad5('0xb'),_0x3e86f9,_0x45a37a);_0x1693d3(_0x45a37a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 28eba1d..68907b3 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 _0x3a50=['isAuthenticated','get','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoField.controller'];(function(_0x54546f,_0xaad9b8){var _0x1784bc=function(_0x375a2b){while(--_0x375a2b){_0x54546f['push'](_0x54546f['shift']());}};_0x1784bc(++_0xaad9b8);}(_0x3a50,0x124));var _0x03a5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3a50[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x03a5('0x0'));var util=require(_0x03a5('0x1'));var path=require(_0x03a5('0x2'));var timeout=require(_0x03a5('0x3'));var express=require('express');var router=express[_0x03a5('0x4')]();var fs_extra=require(_0x03a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03a5('0x6'));var config=require('../../config/environment');var controller=require(_0x03a5('0x7'));router['get']('/',auth[_0x03a5('0x8')](),controller['index']);router[_0x03a5('0x9')](_0x03a5('0xa'),auth[_0x03a5('0x8')](),controller[_0x03a5('0xb')]);router['post']('/',auth[_0x03a5('0x8')](),controller[_0x03a5('0xc')]);router['put']('/:id',auth[_0x03a5('0x8')](),controller['update']);router[_0x03a5('0xd')](_0x03a5('0xa'),auth['isAuthenticated'](),controller[_0x03a5('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb785=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x12691a,_0xa9e020){var _0x3b6bed=function(_0x20b747){while(--_0x20b747){_0x12691a['push'](_0x12691a['shift']());}};_0x3b6bed(++_0xa9e020);}(_0xb785,0x1e1));var _0x5b78=function(_0x36f857,_0x145c65){_0x36f857=_0x36f857-0x0;var _0x5e59fd=_0xb785[_0x36f857];return _0x5e59fd;};'use strict';var multer=require('multer');var util=require(_0x5b78('0x0'));var path=require(_0x5b78('0x1'));var timeout=require(_0x5b78('0x2'));var express=require(_0x5b78('0x3'));var router=express[_0x5b78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5b78('0x5'));var interaction=require(_0x5b78('0x6'));var config=require(_0x5b78('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x5b78('0x8')](),controller[_0x5b78('0x9')]);router[_0x5b78('0xa')](_0x5b78('0xb'),auth[_0x5b78('0x8')](),controller[_0x5b78('0xc')]);router[_0x5b78('0xd')]('/',auth['isAuthenticated'](),controller[_0x5b78('0xe')]);router[_0x5b78('0xf')](_0x5b78('0xb'),auth['isAuthenticated'](),controller[_0x5b78('0x10')]);router[_0x5b78('0x11')](_0x5b78('0xb'),auth[_0x5b78('0x8')](),controller[_0x5b78('0x12')]);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 52b924b..f0d96b5 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 _0x2c51=['string','variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x438415,_0x5ee367){var _0x5d254c=function(_0x29040c){while(--_0x29040c){_0x438415['push'](_0x438415['shift']());}};_0x5d254c(++_0x5ee367);}(_0x2c51,0x136));var _0x12c5=function(_0x2666b1,_0x375927){_0x2666b1=_0x2666b1-0x0;var _0x423d69=_0x2c51[_0x2666b1];return _0x423d69;};'use strict';var Sequelize=require('sequelize');module[_0x12c5('0x0')]={'type':{'type':Sequelize[_0x12c5('0x1')](_0x12c5('0x2'),_0x12c5('0x3'),'customVariable',_0x12c5('0x4'),'picklist'),'defaultValue':_0x12c5('0x2')},'content':{'type':Sequelize[_0x12c5('0x5')]},'key':{'type':Sequelize[_0x12c5('0x5')]},'keyType':{'type':Sequelize[_0x12c5('0x1')](_0x12c5('0x2'),_0x12c5('0x3'),_0x12c5('0x6'))},'keyContent':{'type':Sequelize[_0x12c5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x12c5('0x5')]},'customField':{'type':Sequelize[_0x12c5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12c5('0x5')]}}; \ No newline at end of file +var _0x8b3a=['STRING','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x8b3a,0x197));var _0xa8b3=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x8b3a[_0x19115e];return _0x45bbd4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa8b3('0x0')]('string',_0xa8b3('0x1'),_0xa8b3('0x2'),_0xa8b3('0x3'),_0xa8b3('0x4')),'defaultValue':_0xa8b3('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa8b3('0x6')]},'keyType':{'type':Sequelize[_0xa8b3('0x0')](_0xa8b3('0x5'),_0xa8b3('0x1'),_0xa8b3('0x2'))},'keyContent':{'type':Sequelize[_0xa8b3('0x6')]},'idField':{'type':Sequelize[_0xa8b3('0x6')]},'nameField':{'type':Sequelize[_0xa8b3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa8b3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fb8dc9e..0b63bf0 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 _0xe11d=['end','limit','undefined','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','ZohoField','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','include','options','create','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2bf636,_0x14ceb6){var _0x19c119=function(_0x59eea7){while(--_0x59eea7){_0x2bf636['push'](_0x2bf636['shift']());}};_0x19c119(++_0x14ceb6);}(_0xe11d,0x1eb));var _0xde11=function(_0x3a4441,_0x1c82ca){_0x3a4441=_0x3a4441-0x0;var _0x489188=_0xe11d[_0x3a4441];return _0x489188;};'use strict';var emlformat=require(_0xde11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde11('0x1'));var jsonpatch=require(_0xde11('0x2'));var rp=require(_0xde11('0x3'));var moment=require('moment');var BPromise=require(_0xde11('0x4'));var Mustache=require(_0xde11('0x5'));var util=require(_0xde11('0x6'));var path=require(_0xde11('0x7'));var sox=require(_0xde11('0x8'));var csv=require(_0xde11('0x9'));var ejs=require(_0xde11('0xa'));var fs=require('fs');var fs_extra=require(_0xde11('0xb'));var _=require('lodash');var squel=require(_0xde11('0xc'));var crypto=require(_0xde11('0xd'));var jsforce=require(_0xde11('0xe'));var deskjs=require(_0xde11('0xf'));var toCsv=require(_0xde11('0x9'));var querystring=require('querystring');var Papa=require(_0xde11('0x10'));var Redis=require(_0xde11('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde11('0x12'));var hardwareService=require(_0xde11('0x13'));var logger=require(_0xde11('0x14'))(_0xde11('0x15'));var utils=require(_0xde11('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde11('0x17'));var db=require(_0xde11('0x18'))['db'];function respondWithStatusCode(_0x27bdb2,_0x4c892a){_0x4c892a=_0x4c892a||0xcc;return function(_0x4971e7){if(_0x4971e7){return _0x27bdb2[_0xde11('0x19')](_0x4c892a);}return _0x27bdb2[_0xde11('0x1a')](_0x4c892a)[_0xde11('0x1b')]();};}function respondWithResult(_0x10f8c2,_0x7008ec){_0x7008ec=_0x7008ec||0xc8;return function(_0x49b68e){if(_0x49b68e){return _0x10f8c2[_0xde11('0x1a')](_0x7008ec)['json'](_0x49b68e);}};}function respondWithFilteredResult(_0x39c5f3,_0x4d5439){return function(_0x57dd88){if(_0x57dd88){var _0x17c1ea=typeof _0x4d5439['offset']==='undefined'&&typeof _0x4d5439[_0xde11('0x1c')]===_0xde11('0x1d');var _0x4fb962=_0x57dd88['count'];var _0x5717cd=_0x17c1ea?0x0:_0x4d5439['offset'];var _0x416c5e=_0x17c1ea?_0x57dd88[_0xde11('0x1e')]:_0x4d5439[_0xde11('0x1f')]+_0x4d5439[_0xde11('0x1c')];var _0x2763fb;if(_0x416c5e>=_0x4fb962){_0x416c5e=_0x4fb962;_0x2763fb=0xc8;}else{_0x2763fb=0xce;}_0x39c5f3['status'](_0x2763fb);return _0x39c5f3['set'](_0xde11('0x20'),_0x5717cd+'-'+_0x416c5e+'/'+_0x4fb962)['json'](_0x57dd88);}return null;};}function patchUpdates(_0x1f2656){return function(_0x2029c1){try{jsonpatch[_0xde11('0x21')](_0x2029c1,_0x1f2656,!![]);}catch(_0x36c7d5){return BPromise[_0xde11('0x22')](_0x36c7d5);}return _0x2029c1['save']();};}function saveUpdates(_0x2ba473,_0x289e2e){return function(_0x1fb8c7){if(_0x1fb8c7){return _0x1fb8c7[_0xde11('0x23')](_0x2ba473)[_0xde11('0x24')](function(_0x285187){return _0x285187;});}return null;};}function removeEntity(_0x425f2f,_0xd1b362){return function(_0x54e20e){if(_0x54e20e){return _0x54e20e['destroy']()[_0xde11('0x24')](function(){_0x425f2f[_0xde11('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3600,_0x1930f3){return function(_0x277c9a){if(!_0x277c9a){_0x1a3600[_0xde11('0x19')](0x194);}return _0x277c9a;};}function handleError(_0x502e48,_0x24da1c){_0x24da1c=_0x24da1c||0x1f4;return function(_0x30ccc4){logger[_0xde11('0x25')](_0x30ccc4['stack']);if(_0x30ccc4[_0xde11('0x26')]){delete _0x30ccc4[_0xde11('0x26')];}_0x502e48['status'](_0x24da1c)[_0xde11('0x27')](_0x30ccc4);};}exports[_0xde11('0x28')]=function(_0x1976a3,_0x213b9d){var _0x283ede={},_0x2dabd4={},_0x1e6ae1={'count':0x0,'rows':[]};var _0x409af5=_['map'](db[_0xde11('0x29')]['rawAttributes'],function(_0x3700cb){return{'name':_0x3700cb[_0xde11('0x2a')],'type':_0x3700cb[_0xde11('0x2b')][_0xde11('0x2c')]};});_0x2dabd4['model']=_[_0xde11('0x2d')](_0x409af5,_0xde11('0x26'));_0x2dabd4[_0xde11('0x2e')]=_[_0xde11('0x2f')](_0x1976a3[_0xde11('0x2e')]);_0x2dabd4[_0xde11('0x30')]=_[_0xde11('0x31')](_0x2dabd4[_0xde11('0x32')],_0x2dabd4['query']);_0x283ede[_0xde11('0x33')]=_[_0xde11('0x31')](_0x2dabd4[_0xde11('0x32')],qs['fields'](_0x1976a3[_0xde11('0x2e')][_0xde11('0x34')]));_0x283ede['attributes']=_0x283ede['attributes'][_0xde11('0x35')]?_0x283ede['attributes']:_0x2dabd4[_0xde11('0x32')];if(!_0x1976a3[_0xde11('0x2e')]['hasOwnProperty'](_0xde11('0x36'))){_0x283ede['limit']=qs['limit'](_0x1976a3[_0xde11('0x2e')]['limit']);_0x283ede[_0xde11('0x1f')]=qs['offset'](_0x1976a3['query'][_0xde11('0x1f')]);}_0x283ede[_0xde11('0x37')]=qs[_0xde11('0x38')](_0x1976a3[_0xde11('0x2e')][_0xde11('0x38')]);_0x283ede['where']=qs[_0xde11('0x30')](_['pick'](_0x1976a3[_0xde11('0x2e')],_0x2dabd4[_0xde11('0x30')]),_0x409af5);if(_0x1976a3[_0xde11('0x2e')][_0xde11('0x39')]){_0x283ede[_0xde11('0x3a')]=_[_0xde11('0x3b')](_0x283ede[_0xde11('0x3a')],{'$or':_['map'](_0x409af5,function(_0x22dd9b){if(_0x22dd9b['type']!==_0xde11('0x3c')){var _0x267202={};_0x267202[_0x22dd9b[_0xde11('0x26')]]={'$like':'%'+_0x1976a3[_0xde11('0x2e')][_0xde11('0x39')]+'%'};return _0x267202;}})});}_0x283ede=_['merge']({},_0x283ede,_0x1976a3['options']);var _0x56c4c7={'where':_0x283ede[_0xde11('0x3a')]};return db[_0xde11('0x29')][_0xde11('0x1e')](_0x56c4c7)[_0xde11('0x24')](function(_0x3b98e3){_0x1e6ae1[_0xde11('0x1e')]=_0x3b98e3;if(_0x1976a3[_0xde11('0x2e')][_0xde11('0x3d')]){_0x283ede['include']=[{'all':!![]}];}return db[_0xde11('0x29')][_0xde11('0x3e')](_0x283ede);})[_0xde11('0x24')](function(_0x1df1e1){_0x1e6ae1[_0xde11('0x3f')]=_0x1df1e1;return _0x1e6ae1;})['then'](respondWithFilteredResult(_0x213b9d,_0x283ede))[_0xde11('0x40')](handleError(_0x213b9d,null));};exports[_0xde11('0x41')]=function(_0x26673b,_0x448ab2){var _0x18c156={'raw':!![],'where':{'id':_0x26673b['params']['id']}},_0x1360df={};_0x1360df[_0xde11('0x32')]=_[_0xde11('0x2f')](db['ZohoField'][_0xde11('0x42')]);_0x1360df[_0xde11('0x2e')]=_[_0xde11('0x2f')](_0x26673b[_0xde11('0x2e')]);_0x1360df['filters']=_[_0xde11('0x31')](_0x1360df['model'],_0x1360df[_0xde11('0x2e')]);_0x18c156[_0xde11('0x33')]=_['intersection'](_0x1360df['model'],qs[_0xde11('0x34')](_0x26673b[_0xde11('0x2e')]['fields']));_0x18c156[_0xde11('0x33')]=_0x18c156[_0xde11('0x33')][_0xde11('0x35')]?_0x18c156['attributes']:_0x1360df[_0xde11('0x32')];if(_0x26673b[_0xde11('0x2e')][_0xde11('0x3d')]){_0x18c156[_0xde11('0x43')]=[{'all':!![]}];}_0x18c156=_[_0xde11('0x3b')]({},_0x18c156,_0x26673b[_0xde11('0x44')]);return db[_0xde11('0x29')]['find'](_0x18c156)[_0xde11('0x24')](handleEntityNotFound(_0x448ab2,null))['then'](respondWithResult(_0x448ab2,null))[_0xde11('0x40')](handleError(_0x448ab2,null));};exports['create']=function(_0x51b40a,_0x26c4ea){return db[_0xde11('0x29')][_0xde11('0x45')](_0x51b40a[_0xde11('0x46')],{})[_0xde11('0x24')](respondWithResult(_0x26c4ea,0xc9))[_0xde11('0x40')](handleError(_0x26c4ea,null));};exports[_0xde11('0x23')]=function(_0x570f25,_0x42f4f6){if(_0x570f25[_0xde11('0x46')]['id']){delete _0x570f25[_0xde11('0x46')]['id'];}return db[_0xde11('0x29')][_0xde11('0x47')]({'where':{'id':_0x570f25[_0xde11('0x48')]['id']}})['then'](handleEntityNotFound(_0x42f4f6,null))[_0xde11('0x24')](saveUpdates(_0x570f25[_0xde11('0x46')],null))[_0xde11('0x24')](respondWithResult(_0x42f4f6,null))[_0xde11('0x40')](handleError(_0x42f4f6,null));};exports[_0xde11('0x49')]=function(_0x41b134,_0xfb78b0){return db[_0xde11('0x29')]['find']({'where':{'id':_0x41b134[_0xde11('0x48')]['id']}})[_0xde11('0x24')](handleEntityNotFound(_0xfb78b0,null))[_0xde11('0x24')](removeEntity(_0xfb78b0,null))[_0xde11('0x40')](handleError(_0xfb78b0,null));}; \ No newline at end of file +var _0x499e=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','index','ZohoField','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0x499e,0x175));var _0xe499=function(_0x4964ae,_0x163baf){_0x4964ae=_0x4964ae-0x0;var _0x188a35=_0x499e[_0x4964ae];return _0x188a35;};'use strict';var emlformat=require(_0xe499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe499('0x1'));var jsonpatch=require(_0xe499('0x2'));var rp=require(_0xe499('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe499('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe499('0x5'));var csv=require(_0xe499('0x6'));var ejs=require(_0xe499('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe499('0x8'));var crypto=require(_0xe499('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe499('0xa'));var toCsv=require(_0xe499('0x6'));var querystring=require(_0xe499('0xb'));var Papa=require(_0xe499('0xc'));var Redis=require(_0xe499('0xd'));var authService=require(_0xe499('0xe'));var qs=require(_0xe499('0xf'));var as=require(_0xe499('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe499('0x11'))(_0xe499('0x12'));var utils=require(_0xe499('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe499('0x14'));var db=require(_0xe499('0x15'))['db'];function respondWithStatusCode(_0x467b93,_0xab179b){_0xab179b=_0xab179b||0xcc;return function(_0x2c9b64){if(_0x2c9b64){return _0x467b93[_0xe499('0x16')](_0xab179b);}return _0x467b93[_0xe499('0x17')](_0xab179b)[_0xe499('0x18')]();};}function respondWithResult(_0x59b24e,_0x13db69){_0x13db69=_0x13db69||0xc8;return function(_0xe6e84e){if(_0xe6e84e){return _0x59b24e[_0xe499('0x17')](_0x13db69)[_0xe499('0x19')](_0xe6e84e);}};}function respondWithFilteredResult(_0x27727c,_0x267a7a){return function(_0x776e7f){if(_0x776e7f){var _0x237557=typeof _0x267a7a[_0xe499('0x1a')]===_0xe499('0x1b')&&typeof _0x267a7a[_0xe499('0x1c')]===_0xe499('0x1b');var _0x225e5b=_0x776e7f[_0xe499('0x1d')];var _0x13f8f4=_0x237557?0x0:_0x267a7a['offset'];var _0x2ac8e2=_0x237557?_0x776e7f['count']:_0x267a7a[_0xe499('0x1a')]+_0x267a7a[_0xe499('0x1c')];var _0xf487fe;if(_0x2ac8e2>=_0x225e5b){_0x2ac8e2=_0x225e5b;_0xf487fe=0xc8;}else{_0xf487fe=0xce;}_0x27727c['status'](_0xf487fe);return _0x27727c[_0xe499('0x1e')](_0xe499('0x1f'),_0x13f8f4+'-'+_0x2ac8e2+'/'+_0x225e5b)['json'](_0x776e7f);}return null;};}function patchUpdates(_0x26d444){return function(_0x1c1807){try{jsonpatch[_0xe499('0x20')](_0x1c1807,_0x26d444,!![]);}catch(_0x7cfa74){return BPromise[_0xe499('0x21')](_0x7cfa74);}return _0x1c1807['save']();};}function saveUpdates(_0x5593bb,_0x5d832b){return function(_0x46fa91){if(_0x46fa91){return _0x46fa91[_0xe499('0x22')](_0x5593bb)[_0xe499('0x23')](function(_0x354ffd){return _0x354ffd;});}return null;};}function removeEntity(_0x1d9fc1,_0x3817b2){return function(_0x50d9d5){if(_0x50d9d5){return _0x50d9d5['destroy']()[_0xe499('0x23')](function(){_0x1d9fc1[_0xe499('0x17')](0xcc)[_0xe499('0x18')]();});}};}function handleEntityNotFound(_0x460358,_0x18ed5e){return function(_0x338594){if(!_0x338594){_0x460358[_0xe499('0x16')](0x194);}return _0x338594;};}function handleError(_0x1cf70f,_0xff9e7e){_0xff9e7e=_0xff9e7e||0x1f4;return function(_0x4cf656){logger['error'](_0x4cf656['stack']);if(_0x4cf656['name']){delete _0x4cf656['name'];}_0x1cf70f[_0xe499('0x17')](_0xff9e7e)['send'](_0x4cf656);};}exports[_0xe499('0x24')]=function(_0x129959,_0x11be02){var _0x1b3e57={},_0x2e0b3c={},_0x2fcc31={'count':0x0,'rows':[]};var _0x54ab5d=_['map'](db[_0xe499('0x25')][_0xe499('0x26')],function(_0x3ad746){return{'name':_0x3ad746['fieldName'],'type':_0x3ad746[_0xe499('0x27')][_0xe499('0x28')]};});_0x2e0b3c[_0xe499('0x29')]=_[_0xe499('0x2a')](_0x54ab5d,_0xe499('0x2b'));_0x2e0b3c[_0xe499('0x2c')]=_[_0xe499('0x2d')](_0x129959[_0xe499('0x2c')]);_0x2e0b3c[_0xe499('0x2e')]=_[_0xe499('0x2f')](_0x2e0b3c[_0xe499('0x29')],_0x2e0b3c['query']);_0x1b3e57[_0xe499('0x30')]=_[_0xe499('0x2f')](_0x2e0b3c[_0xe499('0x29')],qs[_0xe499('0x31')](_0x129959[_0xe499('0x2c')][_0xe499('0x31')]));_0x1b3e57['attributes']=_0x1b3e57[_0xe499('0x30')][_0xe499('0x32')]?_0x1b3e57[_0xe499('0x30')]:_0x2e0b3c[_0xe499('0x29')];if(!_0x129959['query'][_0xe499('0x33')](_0xe499('0x34'))){_0x1b3e57[_0xe499('0x1c')]=qs[_0xe499('0x1c')](_0x129959[_0xe499('0x2c')][_0xe499('0x1c')]);_0x1b3e57['offset']=qs['offset'](_0x129959[_0xe499('0x2c')][_0xe499('0x1a')]);}_0x1b3e57[_0xe499('0x35')]=qs[_0xe499('0x36')](_0x129959['query'][_0xe499('0x36')]);_0x1b3e57[_0xe499('0x37')]=qs['filters'](_[_0xe499('0x38')](_0x129959[_0xe499('0x2c')],_0x2e0b3c['filters']),_0x54ab5d);if(_0x129959['query'][_0xe499('0x39')]){_0x1b3e57[_0xe499('0x37')]=_['merge'](_0x1b3e57['where'],{'$or':_['map'](_0x54ab5d,function(_0x415646){if(_0x415646[_0xe499('0x27')]!==_0xe499('0x3a')){var _0x325a68={};_0x325a68[_0x415646[_0xe499('0x2b')]]={'$like':'%'+_0x129959['query'][_0xe499('0x39')]+'%'};return _0x325a68;}})});}_0x1b3e57=_[_0xe499('0x3b')]({},_0x1b3e57,_0x129959[_0xe499('0x3c')]);var _0x8eb3f7={'where':_0x1b3e57[_0xe499('0x37')]};return db['ZohoField'][_0xe499('0x1d')](_0x8eb3f7)[_0xe499('0x23')](function(_0x4e51c1){_0x2fcc31[_0xe499('0x1d')]=_0x4e51c1;if(_0x129959[_0xe499('0x2c')][_0xe499('0x3d')]){_0x1b3e57[_0xe499('0x3e')]=[{'all':!![]}];}return db[_0xe499('0x25')][_0xe499('0x3f')](_0x1b3e57);})[_0xe499('0x23')](function(_0x4a0b19){_0x2fcc31['rows']=_0x4a0b19;return _0x2fcc31;})[_0xe499('0x23')](respondWithFilteredResult(_0x11be02,_0x1b3e57))[_0xe499('0x40')](handleError(_0x11be02,null));};exports[_0xe499('0x41')]=function(_0x657f14,_0x43c371){var _0x4abd6c={'raw':!![],'where':{'id':_0x657f14[_0xe499('0x42')]['id']}},_0x5d7a33={};_0x5d7a33[_0xe499('0x29')]=_['keys'](db[_0xe499('0x25')][_0xe499('0x26')]);_0x5d7a33['query']=_[_0xe499('0x2d')](_0x657f14[_0xe499('0x2c')]);_0x5d7a33['filters']=_[_0xe499('0x2f')](_0x5d7a33[_0xe499('0x29')],_0x5d7a33[_0xe499('0x2c')]);_0x4abd6c['attributes']=_['intersection'](_0x5d7a33[_0xe499('0x29')],qs[_0xe499('0x31')](_0x657f14[_0xe499('0x2c')][_0xe499('0x31')]));_0x4abd6c[_0xe499('0x30')]=_0x4abd6c['attributes'][_0xe499('0x32')]?_0x4abd6c[_0xe499('0x30')]:_0x5d7a33[_0xe499('0x29')];if(_0x657f14[_0xe499('0x2c')][_0xe499('0x3d')]){_0x4abd6c['include']=[{'all':!![]}];}_0x4abd6c=_['merge']({},_0x4abd6c,_0x657f14['options']);return db[_0xe499('0x25')][_0xe499('0x43')](_0x4abd6c)[_0xe499('0x23')](handleEntityNotFound(_0x43c371,null))['then'](respondWithResult(_0x43c371,null))[_0xe499('0x40')](handleError(_0x43c371,null));};exports[_0xe499('0x44')]=function(_0x5e5577,_0x5f9141){return db[_0xe499('0x25')]['create'](_0x5e5577[_0xe499('0x45')],{})[_0xe499('0x23')](respondWithResult(_0x5f9141,0xc9))[_0xe499('0x40')](handleError(_0x5f9141,null));};exports[_0xe499('0x22')]=function(_0x41ca4b,_0x1ea8ab){if(_0x41ca4b[_0xe499('0x45')]['id']){delete _0x41ca4b['body']['id'];}return db[_0xe499('0x25')][_0xe499('0x43')]({'where':{'id':_0x41ca4b['params']['id']}})[_0xe499('0x23')](handleEntityNotFound(_0x1ea8ab,null))[_0xe499('0x23')](saveUpdates(_0x41ca4b[_0xe499('0x45')],null))[_0xe499('0x23')](respondWithResult(_0x1ea8ab,null))[_0xe499('0x40')](handleError(_0x1ea8ab,null));};exports[_0xe499('0x46')]=function(_0xc91968,_0x197fd3){return db[_0xe499('0x25')][_0xe499('0x43')]({'where':{'id':_0xc91968[_0xe499('0x42')]['id']}})['then'](handleEntityNotFound(_0x197fd3,null))[_0xe499('0x23')](removeEntity(_0x197fd3,null))['catch'](handleError(_0x197fd3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index cdd4082..3a9f003 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x11e006,_0x187aa4){var _0x3d52aa=function(_0x25de3e){while(--_0x25de3e){_0x11e006['push'](_0x11e006['shift']());}};_0x3d52aa(++_0x187aa4);}(_0x5fab,0x177));var _0xb5fa=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x5fab[_0x1ac77b];return _0x161584;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['int_zoho_fields','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x33378a,_0x1a262e){var _0x15889c=function(_0x93227a){while(--_0x93227a){_0x33378a['push'](_0x33378a['shift']());}};_0x15889c(++_0x1a262e);}(_0x32f4,0x154));var _0x432f=function(_0x57b870,_0x42c9df){_0x57b870=_0x57b870-0x0;var _0x4201e4=_0x32f4[_0x57b870];return _0x4201e4;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x432f('0xc'),'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 789c5ab..f77dc63 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 _0x5d6b=['http','request','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d6b,0x1d9));var _0xb5d6=function(_0x34ab65,_0x356d84){_0x34ab65=_0x34ab65-0x0;var _0x31532c=_0x5d6b[_0x34ab65];return _0x31532c;};'use strict';var _=require('lodash');var util=require(_0xb5d6('0x0'));var moment=require(_0xb5d6('0x1'));var BPromise=require(_0xb5d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5d6('0x3'));var db=require(_0xb5d6('0x4'))['db'];var utils=require(_0xb5d6('0x5'));var logger=require(_0xb5d6('0x6'))(_0xb5d6('0x7'));var config=require(_0xb5d6('0x8'));var jayson=require(_0xb5d6('0x9'));var client=jayson['client'][_0xb5d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55847d,_0x58014d,_0x45db58){return new BPromise(function(_0x57a017,_0x3cc338){return client[_0xb5d6('0xb')](_0x55847d,_0x45db58)['then'](function(_0x9c98c2){logger['info'](_0xb5d6('0xc'),_0x58014d,_0xb5d6('0xd'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x58014d,'request\x20sent',JSON[_0xb5d6('0xe')](_0x9c98c2));if(_0x9c98c2[_0xb5d6('0xf')]){if(_0x9c98c2['error'][_0xb5d6('0x10')]===0x1f4){logger[_0xb5d6('0xf')](_0xb5d6('0xc'),_0x58014d,_0x9c98c2[_0xb5d6('0xf')]['message']);return _0x3cc338(_0x9c98c2[_0xb5d6('0xf')][_0xb5d6('0x11')]);}logger[_0xb5d6('0xf')]('ZohoField,\x20%s,\x20%s',_0x58014d,_0x9c98c2[_0xb5d6('0xf')]['message']);return _0x57a017(_0x9c98c2[_0xb5d6('0xf')][_0xb5d6('0x11')]);}else{logger[_0xb5d6('0x12')](_0xb5d6('0xc'),_0x58014d,'request\x20sent');_0x57a017(_0x9c98c2[_0xb5d6('0x13')][_0xb5d6('0x11')]);}})[_0xb5d6('0x14')](function(_0x4c8716){logger[_0xb5d6('0xf')]('ZohoField,\x20%s,\x20%s',_0x58014d,_0x4c8716);_0x3cc338(_0x4c8716);});});} \ No newline at end of file +var _0x1897=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1fb934,_0x5ddc35){var _0x4d4492=function(_0x19c757){while(--_0x19c757){_0x1fb934['push'](_0x1fb934['shift']());}};_0x4d4492(++_0x5ddc35);}(_0x1897,0xd0));var _0x7189=function(_0x1d0e5e,_0x596f00){_0x1d0e5e=_0x1d0e5e-0x0;var _0x3ba445=_0x1897[_0x1d0e5e];return _0x3ba445;};'use strict';var _=require(_0x7189('0x0'));var util=require(_0x7189('0x1'));var moment=require(_0x7189('0x2'));var BPromise=require(_0x7189('0x3'));var rs=require(_0x7189('0x4'));var fs=require('fs');var Redis=require(_0x7189('0x5'));var db=require(_0x7189('0x6'))['db'];var utils=require(_0x7189('0x7'));var logger=require(_0x7189('0x8'))(_0x7189('0x9'));var config=require(_0x7189('0xa'));var jayson=require(_0x7189('0xb'));var client=jayson[_0x7189('0xc')][_0x7189('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x56e151,_0x23bb03,_0x452e2c){return new BPromise(function(_0x220e5e,_0x5e0174){return client[_0x7189('0xe')](_0x56e151,_0x452e2c)[_0x7189('0xf')](function(_0x530ce5){logger[_0x7189('0x10')](_0x7189('0x11'),_0x23bb03,_0x7189('0x12'));logger[_0x7189('0x13')](_0x7189('0x14'),_0x23bb03,'request\x20sent',JSON['stringify'](_0x530ce5));if(_0x530ce5[_0x7189('0x15')]){if(_0x530ce5['error'][_0x7189('0x16')]===0x1f4){logger[_0x7189('0x15')]('ZohoField,\x20%s,\x20%s',_0x23bb03,_0x530ce5[_0x7189('0x15')]['message']);return _0x5e0174(_0x530ce5[_0x7189('0x15')][_0x7189('0x17')]);}logger[_0x7189('0x15')](_0x7189('0x11'),_0x23bb03,_0x530ce5['error'][_0x7189('0x17')]);return _0x220e5e(_0x530ce5[_0x7189('0x15')][_0x7189('0x17')]);}else{logger[_0x7189('0x10')](_0x7189('0x11'),_0x23bb03,_0x7189('0x12'));_0x220e5e(_0x530ce5['result'][_0x7189('0x17')]);}})[_0x7189('0x18')](function(_0x21332f){logger[_0x7189('0x15')](_0x7189('0x11'),_0x23bb03,_0x21332f);_0x5e0174(_0x21332f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1bb5d3a..df36970 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12e0e7,_0x3896f9){var _0x5243e8=function(_0x1c6e77){while(--_0x1c6e77){_0x12e0e7['push'](_0x12e0e7['shift']());}};_0x5243e8(++_0x3896f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xcb91[_0x376db5];return _0x304c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c2cfdc0..addcbc7 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 _0xe9e8=['unique_name_and_version','BOOLEAN','sequelize','exports','STRING'];(function(_0x43511e,_0x49c0fe){var _0x1e2803=function(_0x381ff9){while(--_0x381ff9){_0x43511e['push'](_0x43511e['shift']());}};_0x1e2803(++_0x49c0fe);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x221193,_0x3ab80b){_0x221193=_0x221193-0x0;var _0x43ace1=_0xe9e8[_0x221193];return _0x43ace1;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'unique':_0x8e9e('0x3')},'version':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'unique':_0x8e9e('0x3')},'main':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x8e9e('0x2')]},'path':{'type':Sequelize[_0x8e9e('0x2')]},'type':{'type':Sequelize[_0x8e9e('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x8e9e('0x2')]},'logo':{'type':Sequelize[_0x8e9e('0x2')]},'state':{'type':Sequelize[_0x8e9e('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x8e9e('0x2')]},'title':{'type':Sequelize[_0x8e9e('0x2')]},'remoteUri':{'type':Sequelize[_0x8e9e('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xaf4c=['unique_name_and_version','BOOLEAN','state','exports','STRING'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x385aea,_0x5ab8ea){_0x385aea=_0x385aea-0x0;var _0x3e9f27=_0xaf4c[_0x385aea];return _0x3e9f27;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'name':{'type':Sequelize[_0xcaf4('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xcaf4('0x1')],'allowNull':![],'unique':_0xcaf4('0x2')},'main':{'type':Sequelize[_0xcaf4('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xcaf4('0x1')]},'path':{'type':Sequelize[_0xcaf4('0x1')]},'type':{'type':Sequelize[_0xcaf4('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xcaf4('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xcaf4('0x1')]},'state':{'type':Sequelize[_0xcaf4('0x1')],'unique':_0xcaf4('0x4')},'description':{'type':Sequelize[_0xcaf4('0x1')]},'title':{'type':Sequelize[_0xcaf4('0x1')]},'remoteUri':{'type':Sequelize[_0xcaf4('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index e09c1f7..caa091d 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 _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x9582,0x95));var _0x2958=function(_0xcc247a,_0x1aaf2a){_0xcc247a=_0xcc247a-0x0;var _0x2c4b83=_0x9582[_0xcc247a];return _0x2c4b83;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file +var _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x66fa,0x117));var _0xa66f=function(_0x34a0b9,_0x5ca8d5){_0x34a0b9=_0x34a0b9-0x0;var _0x50c9d3=_0x66fa[_0x34a0b9];return _0x50c9d3;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 737d0bc..b63fc33 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 _0xdd8c=['integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration'];(function(_0x2ee7dd,_0x6c9cfb){var _0xdd624a=function(_0x105803){while(--_0x105803){_0x2ee7dd['push'](_0x2ee7dd['shift']());}};_0xdd624a(++_0x6c9cfb);}(_0xdd8c,0x146));var _0xcdd8=function(_0x53d455,_0xd0d9ba){_0x53d455=_0x53d455-0x0;var _0x5f051d=_0xdd8c[_0x53d455];return _0x5f051d;};'use strict';var _=require(_0xcdd8('0x0'));var util=require(_0xcdd8('0x1'));var logger=require(_0xcdd8('0x2'))('api');var moment=require(_0xcdd8('0x3'));var BPromise=require(_0xcdd8('0x4'));var rp=require(_0xcdd8('0x5'));var fs=require('fs');var path=require(_0xcdd8('0x6'));var rimraf=require(_0xcdd8('0x7'));var config=require(_0xcdd8('0x8'));var attributes=require(_0xcdd8('0x9'));module['exports']=function(_0x4c631c,_0x4239aa){return _0x4c631c[_0xcdd8('0xa')](_0xcdd8('0xb'),attributes,{'tableName':_0xcdd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x238e=['integrations','api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration'];(function(_0x4b928c,_0x5ab0c6){var _0x18cb4a=function(_0x4eb656){while(--_0x4eb656){_0x4b928c['push'](_0x4b928c['shift']());}};_0x18cb4a(++_0x5ab0c6);}(_0x238e,0x173));var _0xe238=function(_0x1cb7a8,_0x5a0635){_0x1cb7a8=_0x1cb7a8-0x0;var _0x47e3b7=_0x238e[_0x1cb7a8];return _0x47e3b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe238('0x0'));var moment=require('moment');var BPromise=require(_0xe238('0x1'));var rp=require(_0xe238('0x2'));var fs=require('fs');var path=require(_0xe238('0x3'));var rimraf=require(_0xe238('0x4'));var config=require('../../config/environment');var attributes=require(_0xe238('0x5'));module[_0xe238('0x6')]=function(_0x5b5793,_0x2d9944){return _0x5b5793[_0xe238('0x7')](_0xe238('0x8'),attributes,{'tableName':_0xe238('0x9'),'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 680b993..059a247 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4df354,_0x3d7d4b){var _0x1a7620=function(_0x12f4b5){while(--_0x12f4b5){_0x4df354['push'](_0x4df354['shift']());}};_0x1a7620(++_0x3d7d4b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5e3374,_0xb83426){var _0x27e4e9=function(_0x10ed39){while(--_0x10ed39){_0x5e3374['push'](_0x5e3374['shift']());}};_0x27e4e9(++_0xb83426);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3400a6,_0x409afb){_0x3400a6=_0x3400a6-0x0;var _0x301b79=_0xdd4f[_0x3400a6];return _0x301b79;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2615e78..2b8379c 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x331aa7,_0x9127c){var _0x36c249=function(_0xb9d288){while(--_0xb9d288){_0x331aa7['push'](_0x331aa7['shift']());}};_0x36c249(++_0x9127c);}(_0x7880,0x1f4));var _0x0788=function(_0x502036,_0x502686){_0x502036=_0x502036-0x0;var _0x485247=_0x7880[_0x502036];return _0x485247;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2320cd,_0xd2ac36){var _0xc624ec=function(_0x565907){while(--_0x565907){_0x2320cd['push'](_0x2320cd['shift']());}};_0xc624ec(++_0xd2ac36);}(_0x7880,0x1f4));var _0x0788=function(_0xc79747,_0x474512){_0xc79747=_0xc79747-0x0;var _0x2e5512=_0x7880[_0xc79747];return _0x2e5512;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 5f7c403..03c680d 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 _0xf702=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf702,0x1a5));var _0x2f70=function(_0x49a837,_0xbc87df){_0x49a837=_0x49a837-0x0;var _0x1596f0=_0xf702[_0x49a837];return _0x1596f0;};'use strict';var Sequelize=require('sequelize');module[_0x2f70('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2f70('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x2f70('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2f70('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2f70('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2f70('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2f70('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2f70('0x3')]},'holdtime':{'type':Sequelize[_0x2f70('0x2')]},'agentcomplete':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2f70('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2f70('0x2')]},'reason':{'type':Sequelize[_0x2f70('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2f70('0x3')]},'agentdump':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2f70('0x3')]},'lastevent':{'type':Sequelize[_0x2f70('0x1')]},'channel':{'type':Sequelize[_0x2f70('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x2f70('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2f70('0x1')]},'language':{'type':Sequelize[_0x2f70('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2f70('0x1')]},'exten':{'type':Sequelize[_0x2f70('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2f70('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x2f70('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2f70('0x1')]},'destcalleridname':{'type':Sequelize[_0x2f70('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2f70('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2f70('0x1')]},'destaccountcode':{'type':Sequelize[_0x2f70('0x1')]},'destcontext':{'type':Sequelize[_0x2f70('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2f70('0x1')]},'destuniqueid':{'type':Sequelize[_0x2f70('0x1')]},'messageId':{'type':Sequelize[_0x2f70('0x1')]},'inReplyTo':{'type':Sequelize[_0x2f70('0x1')]},'subject':{'type':Sequelize[_0x2f70('0x1')]},'from':{'type':Sequelize[_0x2f70('0x1')]},'to':{'type':Sequelize[_0x2f70('0x1')]},'cc':{'type':Sequelize[_0x2f70('0x1')]},'attachment':{'type':Sequelize[_0x2f70('0x5')]},'html':{'type':Sequelize[_0x2f70('0x5')]},'text':{'type':Sequelize[_0x2f70('0x5')]},'status':{'type':Sequelize[_0x2f70('0x6')]('SENT',_0x2f70('0x7'),_0x2f70('0x8'),_0x2f70('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x2f70('0x1')]},'appdata':{'type':Sequelize[_0x2f70('0x1')]},'projectId':{'type':Sequelize[_0x2f70('0x2')]}}; \ No newline at end of file +var _0xa017=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0xa017,0x1b0));var _0x7a01=function(_0x2bd674,_0x5183f4){_0x2bd674=_0x2bd674-0x0;var _0x12bfb9=_0xa017[_0x2bd674];return _0x12bfb9;};'use strict';var Sequelize=require(_0x7a01('0x0'));module[_0x7a01('0x1')]={'integration':{'type':Sequelize[_0x7a01('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7a01('0x2')]},'ticketId':{'type':Sequelize[_0x7a01('0x2')]},'integrationId':{'type':Sequelize[_0x7a01('0x3')]},'contacts':{'type':Sequelize[_0x7a01('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7a01('0x2')]},'calleridname':{'type':Sequelize[_0x7a01('0x2')]},'queue':{'type':Sequelize[_0x7a01('0x2')]},'interface':{'type':Sequelize[_0x7a01('0x2')]},'membername':{'type':Sequelize[_0x7a01('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7a01('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7a01('0x4')]},'holdtime':{'type':Sequelize[_0x7a01('0x3')]},'agentcomplete':{'type':Sequelize[_0x7a01('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7a01('0x4')]},'talktime':{'type':Sequelize[_0x7a01('0x3')]},'agentacw':{'type':Sequelize[_0x7a01('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7a01('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x7a01('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7a01('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7a01('0x4')]},'lastevent':{'type':Sequelize[_0x7a01('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7a01('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7a01('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7a01('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7a01('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7a01('0x2')]},'priority':{'type':Sequelize[_0x7a01('0x2')]},'destchannel':{'type':Sequelize[_0x7a01('0x2')]},'destchannelstate':{'type':Sequelize[_0x7a01('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7a01('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7a01('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7a01('0x2')]},'destlanguage':{'type':Sequelize[_0x7a01('0x2')]},'destaccountcode':{'type':Sequelize[_0x7a01('0x2')]},'destcontext':{'type':Sequelize[_0x7a01('0x2')]},'destexten':{'type':Sequelize[_0x7a01('0x2')]},'destpriority':{'type':Sequelize[_0x7a01('0x2')]},'destuniqueid':{'type':Sequelize[_0x7a01('0x2')]},'messageId':{'type':Sequelize[_0x7a01('0x2')]},'inReplyTo':{'type':Sequelize[_0x7a01('0x2')]},'subject':{'type':Sequelize[_0x7a01('0x2')]},'from':{'type':Sequelize[_0x7a01('0x2')]},'to':{'type':Sequelize[_0x7a01('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x7a01('0x6')]},'text':{'type':Sequelize[_0x7a01('0x6')]},'status':{'type':Sequelize['ENUM'](_0x7a01('0x7'),_0x7a01('0x8'),_0x7a01('0x9'),_0x7a01('0xa'))},'url':{'type':Sequelize[_0x7a01('0x2')]},'app':{'type':Sequelize[_0x7a01('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7a01('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 74da075..c32bd30 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 _0x01e3=['limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','IntegrationReport','rawAttributes','fieldName','filters','intersection','model','query','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','catch','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01e3,0x101));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x301e('0x0'));var rimraf=require(_0x301e('0x1'));var zipdir=require(_0x301e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x301e('0x3'));var BPromise=require(_0x301e('0x4'));var Mustache=require(_0x301e('0x5'));var util=require(_0x301e('0x6'));var path=require(_0x301e('0x7'));var sox=require(_0x301e('0x8'));var csv=require(_0x301e('0x9'));var ejs=require(_0x301e('0xa'));var fs=require('fs');var fs_extra=require(_0x301e('0xb'));var _=require(_0x301e('0xc'));var squel=require(_0x301e('0xd'));var crypto=require('crypto');var jsforce=require(_0x301e('0xe'));var deskjs=require(_0x301e('0xf'));var toCsv=require(_0x301e('0x9'));var querystring=require(_0x301e('0x10'));var Papa=require(_0x301e('0x11'));var Redis=require(_0x301e('0x12'));var authService=require(_0x301e('0x13'));var qs=require(_0x301e('0x14'));var as=require(_0x301e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x301e('0x16'));var utils=require(_0x301e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x301e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bae73,_0x278617){_0x278617=_0x278617||0xcc;return function(_0x2bf351){if(_0x2bf351){return _0x3bae73['sendStatus'](_0x278617);}return _0x3bae73['status'](_0x278617)[_0x301e('0x19')]();};}function respondWithResult(_0x1ed67a,_0x12d0a1){_0x12d0a1=_0x12d0a1||0xc8;return function(_0x5f2352){if(_0x5f2352){return _0x1ed67a[_0x301e('0x1a')](_0x12d0a1)[_0x301e('0x1b')](_0x5f2352);}};}function respondWithFilteredResult(_0x5c1abd,_0x35704c){return function(_0x20c2de){if(_0x20c2de){var _0x1e6541=typeof _0x35704c[_0x301e('0x1c')]==='undefined'&&typeof _0x35704c['limit']===_0x301e('0x1d');var _0x4aa89f=_0x20c2de[_0x301e('0x1e')];var _0x160f68=_0x1e6541?0x0:_0x35704c[_0x301e('0x1c')];var _0x290dcc=_0x1e6541?_0x20c2de[_0x301e('0x1e')]:_0x35704c[_0x301e('0x1c')]+_0x35704c[_0x301e('0x1f')];var _0x1a57a5;if(_0x290dcc>=_0x4aa89f){_0x290dcc=_0x4aa89f;_0x1a57a5=0xc8;}else{_0x1a57a5=0xce;}_0x5c1abd[_0x301e('0x1a')](_0x1a57a5);return _0x5c1abd[_0x301e('0x20')](_0x301e('0x21'),_0x160f68+'-'+_0x290dcc+'/'+_0x4aa89f)[_0x301e('0x1b')](_0x20c2de);}return null;};}function patchUpdates(_0x520346){return function(_0x198888){try{jsonpatch[_0x301e('0x22')](_0x198888,_0x520346,!![]);}catch(_0x250ccd){return BPromise[_0x301e('0x23')](_0x250ccd);}return _0x198888[_0x301e('0x24')]();};}function saveUpdates(_0x24c760,_0x4b4dae){return function(_0x27fba3){if(_0x27fba3){return _0x27fba3[_0x301e('0x25')](_0x24c760)[_0x301e('0x26')](function(_0x8602a6){return _0x8602a6;});}return null;};}function removeEntity(_0x102a54,_0x7191d6){return function(_0x3a4f78){if(_0x3a4f78){return _0x3a4f78[_0x301e('0x27')]()[_0x301e('0x26')](function(){_0x102a54[_0x301e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc2e9,_0x5424e7){return function(_0x218ea1){if(!_0x218ea1){_0x5dc2e9[_0x301e('0x28')](0x194);}return _0x218ea1;};}function handleError(_0x45f224,_0x80bc9f){_0x80bc9f=_0x80bc9f||0x1f4;return function(_0x2f691b){logger['error'](_0x2f691b['stack']);if(_0x2f691b[_0x301e('0x29')]){delete _0x2f691b[_0x301e('0x29')];}_0x45f224[_0x301e('0x1a')](_0x80bc9f)[_0x301e('0x2a')](_0x2f691b);};}exports[_0x301e('0x2b')]=function(_0x16ec41,_0x5c8db8){var _0x1619d1={},_0x132e37={},_0x59d63b={'count':0x0,'rows':[]};var _0x326571=_[_0x301e('0x2c')](db[_0x301e('0x2d')][_0x301e('0x2e')],function(_0x157123){return{'name':_0x157123[_0x301e('0x2f')],'type':_0x157123['type']['key']};});_0x132e37['model']=_[_0x301e('0x2c')](_0x326571,_0x301e('0x29'));_0x132e37['query']=_['keys'](_0x16ec41['query']);_0x132e37[_0x301e('0x30')]=_[_0x301e('0x31')](_0x132e37[_0x301e('0x32')],_0x132e37[_0x301e('0x33')]);_0x1619d1['attributes']=_[_0x301e('0x31')](_0x132e37[_0x301e('0x32')],qs[_0x301e('0x34')](_0x16ec41[_0x301e('0x33')][_0x301e('0x34')]));_0x1619d1[_0x301e('0x35')]=_0x1619d1[_0x301e('0x35')][_0x301e('0x36')]?_0x1619d1['attributes']:_0x132e37[_0x301e('0x32')];if(!_0x16ec41[_0x301e('0x33')]['hasOwnProperty'](_0x301e('0x37'))){_0x1619d1[_0x301e('0x1f')]=qs[_0x301e('0x1f')](_0x16ec41['query'][_0x301e('0x1f')]);_0x1619d1[_0x301e('0x1c')]=qs['offset'](_0x16ec41[_0x301e('0x33')]['offset']);}_0x1619d1['order']=qs[_0x301e('0x38')](_0x16ec41[_0x301e('0x33')][_0x301e('0x38')]);_0x1619d1[_0x301e('0x39')]=qs[_0x301e('0x30')](_[_0x301e('0x3a')](_0x16ec41[_0x301e('0x33')],_0x132e37[_0x301e('0x30')]),_0x326571);if(_0x16ec41[_0x301e('0x33')][_0x301e('0x3b')]){_0x1619d1[_0x301e('0x39')]=_[_0x301e('0x3c')](_0x1619d1['where'],{'$or':_[_0x301e('0x2c')](_0x326571,function(_0x58e95b){if(_0x58e95b[_0x301e('0x3d')]!=='VIRTUAL'){var _0x722608={};_0x722608[_0x58e95b[_0x301e('0x29')]]={'$like':'%'+_0x16ec41[_0x301e('0x33')][_0x301e('0x3b')]+'%'};return _0x722608;}})});}_0x1619d1=_['merge']({},_0x1619d1,_0x16ec41[_0x301e('0x3e')]);var _0x4597e0={'where':_0x1619d1[_0x301e('0x39')]};return db[_0x301e('0x2d')][_0x301e('0x1e')](_0x4597e0)['then'](function(_0x10fe54){_0x59d63b[_0x301e('0x1e')]=_0x10fe54;if(_0x16ec41['query'][_0x301e('0x3f')]){_0x1619d1['include']=[{'all':!![]}];}return db[_0x301e('0x2d')]['findAll'](_0x1619d1);})[_0x301e('0x26')](function(_0x17bf92){_0x59d63b['rows']=_0x17bf92;return _0x59d63b;})[_0x301e('0x26')](respondWithFilteredResult(_0x5c8db8,_0x1619d1))[_0x301e('0x40')](handleError(_0x5c8db8,null));};exports['show']=function(_0x27910b,_0x25b007){var _0x465d54={'raw':![],'where':{'id':_0x27910b[_0x301e('0x41')]['id']}},_0x45b2d2={};_0x45b2d2['model']=_[_0x301e('0x42')](db[_0x301e('0x2d')][_0x301e('0x2e')]);_0x45b2d2['query']=_['keys'](_0x27910b[_0x301e('0x33')]);_0x45b2d2[_0x301e('0x30')]=_[_0x301e('0x31')](_0x45b2d2['model'],_0x45b2d2[_0x301e('0x33')]);_0x465d54[_0x301e('0x35')]=_['intersection'](_0x45b2d2['model'],qs[_0x301e('0x34')](_0x27910b['query']['fields']));_0x465d54[_0x301e('0x35')]=_0x465d54[_0x301e('0x35')]['length']?_0x465d54['attributes']:_0x45b2d2[_0x301e('0x32')];if(_0x27910b[_0x301e('0x33')][_0x301e('0x3f')]){_0x465d54[_0x301e('0x43')]=[{'all':!![]}];}_0x465d54=_[_0x301e('0x3c')]({},_0x465d54,_0x27910b[_0x301e('0x3e')]);return db[_0x301e('0x2d')][_0x301e('0x44')](_0x465d54)[_0x301e('0x26')](handleEntityNotFound(_0x25b007,null))[_0x301e('0x26')](respondWithResult(_0x25b007,null))['catch'](handleError(_0x25b007,null));};exports[_0x301e('0x45')]=function(_0x3e3d53,_0x2c96b7){return db[_0x301e('0x2d')][_0x301e('0x45')](_0x3e3d53['body'],{})[_0x301e('0x26')](respondWithResult(_0x2c96b7,0xc9))[_0x301e('0x40')](handleError(_0x2c96b7,null));};exports[_0x301e('0x25')]=function(_0xdeb9ef,_0x236d32){if(_0xdeb9ef[_0x301e('0x46')]['id']){delete _0xdeb9ef[_0x301e('0x46')]['id'];}return db[_0x301e('0x2d')]['find']({'where':{'id':_0xdeb9ef['params']['id']}})['then'](handleEntityNotFound(_0x236d32,null))[_0x301e('0x26')](saveUpdates(_0xdeb9ef['body'],null))[_0x301e('0x26')](respondWithResult(_0x236d32,null))[_0x301e('0x40')](handleError(_0x236d32,null));};exports[_0x301e('0x27')]=function(_0x4bb576,_0x252c65){return db[_0x301e('0x2d')][_0x301e('0x44')]({'where':{'id':_0x4bb576['params']['id']}})['then'](handleEntityNotFound(_0x252c65,null))[_0x301e('0x26')](removeEntity(_0x252c65,null))[_0x301e('0x40')](handleError(_0x252c65,null));};exports[_0x301e('0x47')]=function(_0x1badab,_0x5a6a5f){return db[_0x301e('0x2d')][_0x301e('0x47')]()['then'](respondWithResult(_0x5a6a5f,null))[_0x301e('0x40')](handleError(_0x5a6a5f,null));}; \ No newline at end of file +var _0x1a2b=['sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','IntegrationReport','findAll','show','intersection','include','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb'];(function(_0x375ccf,_0x14964c){var _0x1507e8=function(_0x482e1e){while(--_0x482e1e){_0x375ccf['push'](_0x375ccf['shift']());}};_0x1507e8(++_0x14964c);}(_0x1a2b,0x7d));var _0xb1a2=function(_0x2460d9,_0x15da87){_0x2460d9=_0x2460d9-0x0;var _0x4bc204=_0x1a2b[_0x2460d9];return _0x4bc204;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1a2('0x1'));var rp=require(_0xb1a2('0x2'));var moment=require('moment');var BPromise=require(_0xb1a2('0x3'));var Mustache=require(_0xb1a2('0x4'));var util=require('util');var path=require(_0xb1a2('0x5'));var sox=require(_0xb1a2('0x6'));var csv=require(_0xb1a2('0x7'));var ejs=require(_0xb1a2('0x8'));var fs=require('fs');var fs_extra=require(_0xb1a2('0x9'));var _=require(_0xb1a2('0xa'));var squel=require(_0xb1a2('0xb'));var crypto=require(_0xb1a2('0xc'));var jsforce=require(_0xb1a2('0xd'));var deskjs=require(_0xb1a2('0xe'));var toCsv=require(_0xb1a2('0x7'));var querystring=require(_0xb1a2('0xf'));var Papa=require(_0xb1a2('0x10'));var Redis=require(_0xb1a2('0x11'));var authService=require(_0xb1a2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb1a2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1a2('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb1a2('0x15'));var db=require(_0xb1a2('0x16'))['db'];function respondWithStatusCode(_0x13f252,_0x123e8b){_0x123e8b=_0x123e8b||0xcc;return function(_0x24a55f){if(_0x24a55f){return _0x13f252[_0xb1a2('0x17')](_0x123e8b);}return _0x13f252[_0xb1a2('0x18')](_0x123e8b)[_0xb1a2('0x19')]();};}function respondWithResult(_0x1badcb,_0x18000c){_0x18000c=_0x18000c||0xc8;return function(_0x5f038a){if(_0x5f038a){return _0x1badcb[_0xb1a2('0x18')](_0x18000c)['json'](_0x5f038a);}};}function respondWithFilteredResult(_0x541d7e,_0x209c9c){return function(_0x1002c3){if(_0x1002c3){var _0xe44f1c=typeof _0x209c9c[_0xb1a2('0x1a')]==='undefined'&&typeof _0x209c9c[_0xb1a2('0x1b')]===_0xb1a2('0x1c');var _0x355c08=_0x1002c3[_0xb1a2('0x1d')];var _0x54c484=_0xe44f1c?0x0:_0x209c9c[_0xb1a2('0x1a')];var _0x33f4ef=_0xe44f1c?_0x1002c3[_0xb1a2('0x1d')]:_0x209c9c[_0xb1a2('0x1a')]+_0x209c9c['limit'];var _0x20788c;if(_0x33f4ef>=_0x355c08){_0x33f4ef=_0x355c08;_0x20788c=0xc8;}else{_0x20788c=0xce;}_0x541d7e['status'](_0x20788c);return _0x541d7e[_0xb1a2('0x1e')]('Content-Range',_0x54c484+'-'+_0x33f4ef+'/'+_0x355c08)['json'](_0x1002c3);}return null;};}function patchUpdates(_0x34473d){return function(_0x2754d5){try{jsonpatch[_0xb1a2('0x1f')](_0x2754d5,_0x34473d,!![]);}catch(_0x207b6c){return BPromise[_0xb1a2('0x20')](_0x207b6c);}return _0x2754d5[_0xb1a2('0x21')]();};}function saveUpdates(_0x33275d,_0x2c13ab){return function(_0x5023d5){if(_0x5023d5){return _0x5023d5[_0xb1a2('0x22')](_0x33275d)[_0xb1a2('0x23')](function(_0x25f0c3){return _0x25f0c3;});}return null;};}function removeEntity(_0xe46ebe,_0x574888){return function(_0x20bdc8){if(_0x20bdc8){return _0x20bdc8[_0xb1a2('0x24')]()[_0xb1a2('0x23')](function(){_0xe46ebe[_0xb1a2('0x18')](0xcc)[_0xb1a2('0x19')]();});}};}function handleEntityNotFound(_0x27d459,_0x103572){return function(_0x21de6f){if(!_0x21de6f){_0x27d459['sendStatus'](0x194);}return _0x21de6f;};}function handleError(_0xab2d39,_0x37cb2d){_0x37cb2d=_0x37cb2d||0x1f4;return function(_0x4028cd){logger[_0xb1a2('0x25')](_0x4028cd[_0xb1a2('0x26')]);if(_0x4028cd[_0xb1a2('0x27')]){delete _0x4028cd['name'];}_0xab2d39[_0xb1a2('0x18')](_0x37cb2d)['send'](_0x4028cd);};}exports[_0xb1a2('0x28')]=function(_0x40e877,_0xd11dae){var _0x5aa499={},_0x3c3ce0={},_0x250513={'count':0x0,'rows':[]};var _0x3773f9=_[_0xb1a2('0x29')](db['IntegrationReport'][_0xb1a2('0x2a')],function(_0x60cfe5){return{'name':_0x60cfe5[_0xb1a2('0x2b')],'type':_0x60cfe5['type'][_0xb1a2('0x2c')]};});_0x3c3ce0[_0xb1a2('0x2d')]=_[_0xb1a2('0x29')](_0x3773f9,_0xb1a2('0x27'));_0x3c3ce0[_0xb1a2('0x2e')]=_[_0xb1a2('0x2f')](_0x40e877[_0xb1a2('0x2e')]);_0x3c3ce0[_0xb1a2('0x30')]=_['intersection'](_0x3c3ce0[_0xb1a2('0x2d')],_0x3c3ce0[_0xb1a2('0x2e')]);_0x5aa499['attributes']=_['intersection'](_0x3c3ce0[_0xb1a2('0x2d')],qs[_0xb1a2('0x31')](_0x40e877['query'][_0xb1a2('0x31')]));_0x5aa499['attributes']=_0x5aa499[_0xb1a2('0x32')][_0xb1a2('0x33')]?_0x5aa499[_0xb1a2('0x32')]:_0x3c3ce0[_0xb1a2('0x2d')];if(!_0x40e877[_0xb1a2('0x2e')]['hasOwnProperty'](_0xb1a2('0x34'))){_0x5aa499[_0xb1a2('0x1b')]=qs[_0xb1a2('0x1b')](_0x40e877[_0xb1a2('0x2e')][_0xb1a2('0x1b')]);_0x5aa499[_0xb1a2('0x1a')]=qs[_0xb1a2('0x1a')](_0x40e877[_0xb1a2('0x2e')][_0xb1a2('0x1a')]);}_0x5aa499[_0xb1a2('0x35')]=qs[_0xb1a2('0x36')](_0x40e877['query'][_0xb1a2('0x36')]);_0x5aa499['where']=qs[_0xb1a2('0x30')](_[_0xb1a2('0x37')](_0x40e877[_0xb1a2('0x2e')],_0x3c3ce0[_0xb1a2('0x30')]),_0x3773f9);if(_0x40e877[_0xb1a2('0x2e')][_0xb1a2('0x38')]){_0x5aa499[_0xb1a2('0x39')]=_[_0xb1a2('0x3a')](_0x5aa499[_0xb1a2('0x39')],{'$or':_[_0xb1a2('0x29')](_0x3773f9,function(_0x91943b){if(_0x91943b[_0xb1a2('0x3b')]!==_0xb1a2('0x3c')){var _0x16d647={};_0x16d647[_0x91943b['name']]={'$like':'%'+_0x40e877[_0xb1a2('0x2e')]['filter']+'%'};return _0x16d647;}})});}_0x5aa499=_[_0xb1a2('0x3a')]({},_0x5aa499,_0x40e877[_0xb1a2('0x3d')]);var _0x1350ea={'where':_0x5aa499[_0xb1a2('0x39')]};return db['IntegrationReport'][_0xb1a2('0x1d')](_0x1350ea)[_0xb1a2('0x23')](function(_0x42b14d){_0x250513[_0xb1a2('0x1d')]=_0x42b14d;if(_0x40e877['query'][_0xb1a2('0x3e')]){_0x5aa499['include']=[{'all':!![]}];}return db[_0xb1a2('0x3f')][_0xb1a2('0x40')](_0x5aa499);})[_0xb1a2('0x23')](function(_0x5a3696){_0x250513['rows']=_0x5a3696;return _0x250513;})['then'](respondWithFilteredResult(_0xd11dae,_0x5aa499))['catch'](handleError(_0xd11dae,null));};exports[_0xb1a2('0x41')]=function(_0x2baea5,_0x2f3dac){var _0x4c9a49={'raw':![],'where':{'id':_0x2baea5['params']['id']}},_0x2dc808={};_0x2dc808[_0xb1a2('0x2d')]=_['keys'](db[_0xb1a2('0x3f')][_0xb1a2('0x2a')]);_0x2dc808[_0xb1a2('0x2e')]=_['keys'](_0x2baea5[_0xb1a2('0x2e')]);_0x2dc808[_0xb1a2('0x30')]=_[_0xb1a2('0x42')](_0x2dc808[_0xb1a2('0x2d')],_0x2dc808['query']);_0x4c9a49[_0xb1a2('0x32')]=_[_0xb1a2('0x42')](_0x2dc808[_0xb1a2('0x2d')],qs['fields'](_0x2baea5[_0xb1a2('0x2e')]['fields']));_0x4c9a49['attributes']=_0x4c9a49[_0xb1a2('0x32')][_0xb1a2('0x33')]?_0x4c9a49[_0xb1a2('0x32')]:_0x2dc808['model'];if(_0x2baea5[_0xb1a2('0x2e')][_0xb1a2('0x3e')]){_0x4c9a49[_0xb1a2('0x43')]=[{'all':!![]}];}_0x4c9a49=_['merge']({},_0x4c9a49,_0x2baea5[_0xb1a2('0x3d')]);return db[_0xb1a2('0x3f')][_0xb1a2('0x44')](_0x4c9a49)[_0xb1a2('0x23')](handleEntityNotFound(_0x2f3dac,null))['then'](respondWithResult(_0x2f3dac,null))[_0xb1a2('0x45')](handleError(_0x2f3dac,null));};exports[_0xb1a2('0x46')]=function(_0x3e35eb,_0x40a808){return db[_0xb1a2('0x3f')][_0xb1a2('0x46')](_0x3e35eb[_0xb1a2('0x47')],{})[_0xb1a2('0x23')](respondWithResult(_0x40a808,0xc9))[_0xb1a2('0x45')](handleError(_0x40a808,null));};exports['update']=function(_0x4caec1,_0x2af506){if(_0x4caec1[_0xb1a2('0x47')]['id']){delete _0x4caec1[_0xb1a2('0x47')]['id'];}return db[_0xb1a2('0x3f')][_0xb1a2('0x44')]({'where':{'id':_0x4caec1[_0xb1a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x2af506,null))[_0xb1a2('0x23')](saveUpdates(_0x4caec1[_0xb1a2('0x47')],null))['then'](respondWithResult(_0x2af506,null))['catch'](handleError(_0x2af506,null));};exports[_0xb1a2('0x24')]=function(_0x57747b,_0x25a3cd){return db[_0xb1a2('0x3f')][_0xb1a2('0x44')]({'where':{'id':_0x57747b['params']['id']}})['then'](handleEntityNotFound(_0x25a3cd,null))[_0xb1a2('0x23')](removeEntity(_0x25a3cd,null))[_0xb1a2('0x45')](handleError(_0x25a3cd,null));};exports[_0xb1a2('0x49')]=function(_0x44eb93,_0x3780ed){return db['IntegrationReport'][_0xb1a2('0x49')]()['then'](respondWithResult(_0x3780ed,null))[_0xb1a2('0x45')](handleError(_0x3780ed,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index aa883fc..00569ca 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 _0xa586=['exports','define','report_integration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa586,0x153));var _0x6a58=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xa586[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0x6a58('0x0'));var util=require('util');var logger=require(_0x6a58('0x1'))(_0x6a58('0x2'));var moment=require(_0x6a58('0x3'));var BPromise=require(_0x6a58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a58('0x5'));var rimraf=require(_0x6a58('0x6'));var config=require(_0x6a58('0x7'));var attributes=require(_0x6a58('0x8'));module[_0x6a58('0x9')]=function(_0x9962e3,_0x3c0698){return _0x9962e3[_0x6a58('0xa')]('IntegrationReport',attributes,{'tableName':_0x6a58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28db=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash'];(function(_0x1b199a,_0x4082c3){var _0x3aab4f=function(_0x9481bc){while(--_0x9481bc){_0x1b199a['push'](_0x1b199a['shift']());}};_0x3aab4f(++_0x4082c3);}(_0x28db,0x154));var _0xb28d=function(_0x359b36,_0x5794fc){_0x359b36=_0x359b36-0x0;var _0x10b4e2=_0x28db[_0x359b36];return _0x10b4e2;};'use strict';var _=require(_0xb28d('0x0'));var util=require(_0xb28d('0x1'));var logger=require('../../config/logger')(_0xb28d('0x2'));var moment=require(_0xb28d('0x3'));var BPromise=require(_0xb28d('0x4'));var rp=require(_0xb28d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb28d('0x6'));var config=require(_0xb28d('0x7'));var attributes=require('./integrationReport.attributes');module[_0xb28d('0x8')]=function(_0x1ce457,_0x24a6aa){return _0x1ce457['define'](_0xb28d('0x9'),attributes,{'tableName':_0xb28d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 4c5d39b..a124e74 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc2c7,0x134));var _0x7c2c=function(_0x499bda,_0x4f87a3){_0x499bda=_0x499bda-0x0;var _0x15c066=_0xc2c7[_0x499bda];return _0x15c066;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e292c,_0x232404){var _0x5cf2ff=function(_0x358c5c){while(--_0x358c5c){_0x2e292c['push'](_0x2e292c['shift']());}};_0x5cf2ff(++_0x232404);}(_0x0295,0x1f0));var _0x5029=function(_0x54e217,_0x243297){_0x54e217=_0x54e217-0x0;var _0x590ead=_0x0295[_0x54e217];return _0x590ead;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 29d52e4..38bbdd2 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 _0x1c90=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x1215bd,_0x35bbb5){var _0x5d80f5=function(_0x365366){while(--_0x365366){_0x1215bd['push'](_0x1215bd['shift']());}};_0x5d80f5(++_0x35bbb5);}(_0x1c90,0x104));var _0x01c9=function(_0x4e8af8,_0x16871a){_0x4e8af8=_0x4e8af8-0x0;var _0x5dad5d=_0x1c90[_0x4e8af8];return _0x5dad5d;};'use strict';var multer=require('multer');var util=require(_0x01c9('0x0'));var path=require(_0x01c9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01c9('0x2')]();var fs_extra=require(_0x01c9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x01c9('0x4'));var config=require(_0x01c9('0x5'));var controller=require(_0x01c9('0x6'));router['get']('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0x8')]);router[_0x01c9('0x9')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0xb')]);router[_0x01c9('0x9')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0xd')]);router[_0x01c9('0xe')]('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0xf')]);router[_0x01c9('0xe')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0x10')]);router[_0x01c9('0xe')](_0x01c9('0x11'),auth['isAuthenticated'](),controller[_0x01c9('0x12')]);router[_0x01c9('0x13')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x14')]);router[_0x01c9('0x15')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x195f=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','/:id','delete'];(function(_0x14aa05,_0x49b87a){var _0x5ed694=function(_0x17d75d){while(--_0x17d75d){_0x14aa05['push'](_0x14aa05['shift']());}};_0x5ed694(++_0x49b87a);}(_0x195f,0x113));var _0xf195=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x195f[_0x483d8b];return _0x6500f1;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require('path');var timeout=require(_0xf195('0x2'));var express=require(_0xf195('0x3'));var router=express['Router']();var fs_extra=require(_0xf195('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf195('0x5'));var config=require(_0xf195('0x6'));var controller=require(_0xf195('0x7'));router[_0xf195('0x8')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xa')]);router[_0xf195('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf195('0xb')]);router[_0xf195('0x8')](_0xf195('0xc'),auth[_0xf195('0x9')](),controller[_0xf195('0xd')]);router[_0xf195('0xe')]('/',auth[_0xf195('0x9')](),controller['create']);router[_0xf195('0xe')](_0xf195('0xc'),auth[_0xf195('0x9')](),controller['addInterval']);router[_0xf195('0xe')](_0xf195('0xf'),auth[_0xf195('0x9')](),controller[_0xf195('0x10')]);router['put'](_0xf195('0x11'),auth[_0xf195('0x9')](),controller['update']);router[_0xf195('0x12')]('/:id',auth[_0xf195('0x9')](),controller[_0xf195('0x13')]);module[_0xf195('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 152813a..9f6133b 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 _0x296b=['STRING','sequelize'];(function(_0x12923e,_0x389974){var _0x58c029=function(_0x1c3a95){while(--_0x1c3a95){_0x12923e['push'](_0x12923e['shift']());}};_0x58c029(++_0x389974);}(_0x296b,0x81));var _0xb296=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x296b[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require(_0xb296('0x0'));module['exports']={'name':{'type':Sequelize[_0xb296('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb296('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5ef9=['STRING','sequelize','exports'];(function(_0x22c78a,_0x7e9473){var _0x24838c=function(_0x42826d){while(--_0x42826d){_0x22c78a['push'](_0x22c78a['shift']());}};_0x24838c(++_0x7e9473);}(_0x5ef9,0xe8));var _0x95ef=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x5ef9[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x95ef('0x0'));module[_0x95ef('0x1')]={'name':{'type':Sequelize[_0x95ef('0x2')]},'description':{'type':Sequelize[_0x95ef('0x2')]},'interval':{'type':Sequelize[_0x95ef('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index bad5d90..84b3987 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 _0x0d49=['rows','catch','show','rawAttributes','include','merge','create','body','role','Intervals','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','length','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','UserProfileResource','stack','send','map','Interval','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll'];(function(_0x52c462,_0x52921c){var _0x4971c8=function(_0x851681){while(--_0x851681){_0x52c462['push'](_0x52c462['shift']());}};_0x4971c8(++_0x52921c);}(_0x0d49,0x12e));var _0x90d4=function(_0x581adb,_0x5ca091){_0x581adb=_0x581adb-0x0;var _0x20fa52=_0x0d49[_0x581adb];return _0x20fa52;};'use strict';var emlformat=require(_0x90d4('0x0'));var rimraf=require(_0x90d4('0x1'));var zipdir=require(_0x90d4('0x2'));var jsonpatch=require(_0x90d4('0x3'));var rp=require('request-promise');var moment=require(_0x90d4('0x4'));var BPromise=require(_0x90d4('0x5'));var Mustache=require('mustache');var util=require(_0x90d4('0x6'));var path=require(_0x90d4('0x7'));var sox=require(_0x90d4('0x8'));var csv=require(_0x90d4('0x9'));var ejs=require(_0x90d4('0xa'));var fs=require('fs');var fs_extra=require(_0x90d4('0xb'));var _=require(_0x90d4('0xc'));var squel=require(_0x90d4('0xd'));var crypto=require(_0x90d4('0xe'));var jsforce=require(_0x90d4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x90d4('0x9'));var querystring=require('querystring');var Papa=require(_0x90d4('0x10'));var Redis=require('ioredis');var authService=require(_0x90d4('0x11'));var qs=require(_0x90d4('0x12'));var as=require(_0x90d4('0x13'));var hardwareService=require(_0x90d4('0x14'));var logger=require('../../config/logger')(_0x90d4('0x15'));var utils=require(_0x90d4('0x16'));var config=require(_0x90d4('0x17'));var licenseUtil=require(_0x90d4('0x18'));var db=require(_0x90d4('0x19'))['db'];var extensions=require(_0x90d4('0x1a'));function respondWithStatusCode(_0x50cf90,_0x24b1a5){_0x24b1a5=_0x24b1a5||0xcc;return function(_0x5e069c){if(_0x5e069c){return _0x50cf90[_0x90d4('0x1b')](_0x24b1a5);}return _0x50cf90[_0x90d4('0x1c')](_0x24b1a5)[_0x90d4('0x1d')]();};}function respondWithResult(_0x4173ab,_0x2655fa){_0x2655fa=_0x2655fa||0xc8;return function(_0x3facae){if(_0x3facae){return _0x4173ab[_0x90d4('0x1c')](_0x2655fa)[_0x90d4('0x1e')](_0x3facae);}};}function respondWithFilteredResult(_0x27505a,_0x1c8d22){return function(_0x50f0c7){if(_0x50f0c7){var _0x3e6156=typeof _0x1c8d22[_0x90d4('0x1f')]===_0x90d4('0x20')&&typeof _0x1c8d22[_0x90d4('0x21')]==='undefined';var _0x39c4d9=_0x50f0c7[_0x90d4('0x22')];var _0x41fc0c=_0x3e6156?0x0:_0x1c8d22[_0x90d4('0x1f')];var _0x55c290=_0x3e6156?_0x50f0c7[_0x90d4('0x22')]:_0x1c8d22[_0x90d4('0x1f')]+_0x1c8d22[_0x90d4('0x21')];var _0x58066d;if(_0x55c290>=_0x39c4d9){_0x55c290=_0x39c4d9;_0x58066d=0xc8;}else{_0x58066d=0xce;}_0x27505a['status'](_0x58066d);return _0x27505a['set'](_0x90d4('0x23'),_0x41fc0c+'-'+_0x55c290+'/'+_0x39c4d9)['json'](_0x50f0c7);}return null;};}function patchUpdates(_0x478c66){return function(_0x2def4d){try{jsonpatch[_0x90d4('0x24')](_0x2def4d,_0x478c66,!![]);}catch(_0x44d2fb){return BPromise['reject'](_0x44d2fb);}return _0x2def4d['save']();};}function saveUpdates(_0x34ed9a,_0x408c6b){return function(_0x282eda){if(_0x282eda){return _0x282eda[_0x90d4('0x25')](_0x34ed9a)[_0x90d4('0x26')](function(_0x237f3c){return _0x237f3c;});}return null;};}function removeEntity(_0x15ebb1,_0x2249ff){return function(_0x4a9dcd){if(_0x4a9dcd){return _0x4a9dcd[_0x90d4('0x27')]()[_0x90d4('0x26')](function(){var _0x3504b0=_0x4a9dcd[_0x90d4('0x28')]({'plain':!![]});var _0x3e407d='Intervals';return db[_0x90d4('0x29')][_0x90d4('0x27')]({'where':{'type':_0x3e407d,'resourceId':_0x3504b0['id']}})[_0x90d4('0x26')](function(){return _0x4a9dcd;});})[_0x90d4('0x26')](function(){_0x15ebb1[_0x90d4('0x1c')](0xcc)[_0x90d4('0x1d')]();});}};}function handleEntityNotFound(_0x1e658c,_0x7869d8){return function(_0x530620){if(!_0x530620){_0x1e658c[_0x90d4('0x1b')](0x194);}return _0x530620;};}function handleError(_0x218341,_0x40c731){_0x40c731=_0x40c731||0x1f4;return function(_0x5b4d83){logger['error'](_0x5b4d83[_0x90d4('0x2a')]);if(_0x5b4d83['name']){delete _0x5b4d83['name'];}_0x218341[_0x90d4('0x1c')](_0x40c731)[_0x90d4('0x2b')](_0x5b4d83);};}exports['index']=function(_0x14c42d,_0x32064a){var _0x305099={},_0x8a54ee={},_0x33442c={'count':0x0,'rows':[]};var _0x24732d=_[_0x90d4('0x2c')](db[_0x90d4('0x2d')]['rawAttributes'],function(_0x168275){return{'name':_0x168275['fieldName'],'type':_0x168275[_0x90d4('0x2e')][_0x90d4('0x2f')]};});_0x8a54ee[_0x90d4('0x30')]=_['map'](_0x24732d,_0x90d4('0x31'));_0x8a54ee[_0x90d4('0x32')]=_[_0x90d4('0x33')](_0x14c42d[_0x90d4('0x32')]);_0x8a54ee[_0x90d4('0x34')]=_['intersection'](_0x8a54ee[_0x90d4('0x30')],_0x8a54ee[_0x90d4('0x32')]);_0x305099[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x8a54ee['model'],qs[_0x90d4('0x37')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x37')]));_0x305099['attributes']=_0x305099[_0x90d4('0x35')]['length']?_0x305099[_0x90d4('0x35')]:_0x8a54ee[_0x90d4('0x30')];if(!_0x14c42d[_0x90d4('0x32')]['hasOwnProperty'](_0x90d4('0x38'))){_0x305099[_0x90d4('0x21')]=qs[_0x90d4('0x21')](_0x14c42d['query']['limit']);_0x305099[_0x90d4('0x1f')]=qs[_0x90d4('0x1f')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x1f')]);}_0x305099[_0x90d4('0x39')]=qs[_0x90d4('0x3a')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x3a')]);_0x305099[_0x90d4('0x3b')]=qs[_0x90d4('0x34')](_[_0x90d4('0x3c')](_0x14c42d[_0x90d4('0x32')],_0x8a54ee[_0x90d4('0x34')]),_0x24732d);if(_0x14c42d[_0x90d4('0x32')]['filter']){_0x305099[_0x90d4('0x3b')]=_['merge'](_0x305099[_0x90d4('0x3b')],{'$or':_[_0x90d4('0x2c')](_0x24732d,function(_0x5417c5){if(_0x5417c5[_0x90d4('0x2e')]!==_0x90d4('0x3d')){var _0x537189={};_0x537189[_0x5417c5[_0x90d4('0x31')]]={'$like':'%'+_0x14c42d[_0x90d4('0x32')][_0x90d4('0x3e')]+'%'};return _0x537189;}})});}_0x305099=_['merge']({},_0x305099,_0x14c42d[_0x90d4('0x3f')]);var _0x1c0d6e={'where':_0x305099['where']};return db['Interval']['count'](_0x1c0d6e)[_0x90d4('0x26')](function(_0x5240c0){_0x33442c['count']=_0x5240c0;if(_0x14c42d[_0x90d4('0x32')][_0x90d4('0x40')]){_0x305099['include']=[{'all':!![]}];}return db[_0x90d4('0x2d')][_0x90d4('0x41')](_0x305099);})[_0x90d4('0x26')](function(_0x133f99){_0x33442c[_0x90d4('0x42')]=_0x133f99;return _0x33442c;})['then'](respondWithFilteredResult(_0x32064a,_0x305099))[_0x90d4('0x43')](handleError(_0x32064a,null));};exports[_0x90d4('0x44')]=function(_0x14721f,_0x5bf76d){var _0x17d677={'raw':!![],'where':{'id':_0x14721f['params']['id']}},_0x2c9820={};_0x2c9820['model']=_[_0x90d4('0x33')](db[_0x90d4('0x2d')][_0x90d4('0x45')]);_0x2c9820['query']=_['keys'](_0x14721f[_0x90d4('0x32')]);_0x2c9820[_0x90d4('0x34')]=_[_0x90d4('0x36')](_0x2c9820[_0x90d4('0x30')],_0x2c9820[_0x90d4('0x32')]);_0x17d677[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x2c9820['model'],qs['fields'](_0x14721f[_0x90d4('0x32')][_0x90d4('0x37')]));_0x17d677['attributes']=_0x17d677['attributes']['length']?_0x17d677[_0x90d4('0x35')]:_0x2c9820[_0x90d4('0x30')];if(_0x14721f[_0x90d4('0x32')][_0x90d4('0x40')]){_0x17d677[_0x90d4('0x46')]=[{'all':!![]}];}_0x17d677=_[_0x90d4('0x47')]({},_0x17d677,_0x14721f[_0x90d4('0x3f')]);return db[_0x90d4('0x2d')]['find'](_0x17d677)['then'](handleEntityNotFound(_0x5bf76d,null))[_0x90d4('0x26')](respondWithResult(_0x5bf76d,null))['catch'](handleError(_0x5bf76d,null));};exports['create']=function(_0x1b9a72,_0x2671bf){return db[_0x90d4('0x2d')][_0x90d4('0x48')](_0x1b9a72[_0x90d4('0x49')],{})[_0x90d4('0x26')](function(_0x4bfd59){var _0x29cf48=_0x1b9a72['user']['get']({'plain':!![]});if(!_0x29cf48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29cf48[_0x90d4('0x4a')]==='user'){var _0x4aac19=_0x4bfd59[_0x90d4('0x28')]({'plain':!![]});var _0x1565b2=_0x90d4('0x4b');return db['UserProfileSection'][_0x90d4('0x4c')]({'where':{'name':_0x1565b2,'userProfileId':_0x29cf48[_0x90d4('0x4d')]},'raw':!![]})['then'](function(_0x3135a2){if(_0x3135a2&&_0x3135a2[_0x90d4('0x4e')]===0x0){return db[_0x90d4('0x29')][_0x90d4('0x48')]({'name':_0x4aac19[_0x90d4('0x31')],'resourceId':_0x4aac19['id'],'type':_0x3135a2['name'],'sectionId':_0x3135a2['id']},{})['then'](function(){return _0x4bfd59;});}else{return _0x4bfd59;}})[_0x90d4('0x43')](function(_0x6938f1){logger[_0x90d4('0x4f')](_0x90d4('0x50'),_0x6938f1);throw _0x6938f1;});}return _0x4bfd59;})[_0x90d4('0x26')](respondWithResult(_0x2671bf,0xc9))[_0x90d4('0x43')](handleError(_0x2671bf,null));};exports[_0x90d4('0x25')]=function(_0x570f24,_0x4e963c){if(_0x570f24[_0x90d4('0x49')]['id']){delete _0x570f24[_0x90d4('0x49')]['id'];}return db['Interval'][_0x90d4('0x4c')]({'where':{'id':_0x570f24[_0x90d4('0x51')]['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x4e963c,null))[_0x90d4('0x26')](saveUpdates(_0x570f24[_0x90d4('0x49')],null))[_0x90d4('0x26')](respondWithResult(_0x4e963c,null))[_0x90d4('0x43')](handleError(_0x4e963c,null));};exports[_0x90d4('0x27')]=function(_0x46745a,_0x4b3287){return db['Interval'][_0x90d4('0x4c')]({'where':{'id':_0x46745a[_0x90d4('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b3287,null))[_0x90d4('0x26')](removeEntity(_0x4b3287,null))[_0x90d4('0x43')](handleError(_0x4b3287,null));};exports[_0x90d4('0x52')]=function(_0x3bc1a4,_0x14d510,_0x1953c1){if(_0x3bc1a4['body']['id']){delete _0x3bc1a4[_0x90d4('0x49')]['id'];}return db[_0x90d4('0x2d')][_0x90d4('0x4c')]({'where':{'id':_0x3bc1a4['params']['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x14d510,null))[_0x90d4('0x26')](function(_0x242623){if(_0x242623){_0x3bc1a4[_0x90d4('0x49')][_0x90d4('0x53')]=_0x242623['id'];return db[_0x90d4('0x2d')][_0x90d4('0x48')](_0x3bc1a4[_0x90d4('0x49')]);}})[_0x90d4('0x26')](respondWithResult(_0x14d510,null))[_0x90d4('0x43')](handleError(_0x14d510,null));};exports[_0x90d4('0x54')]=function(_0x288eef,_0x1743d6,_0x4054b0){var _0x50cae6={};var _0x54c383={};var _0x8d4eac;var _0x85ad27;return db['Interval'][_0x90d4('0x55')]({'where':{'id':_0x288eef[_0x90d4('0x51')]['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x1743d6,null))['then'](function(_0x3b7f5c){if(_0x3b7f5c){_0x8d4eac=_0x3b7f5c;_0x54c383['model']=_[_0x90d4('0x33')](db[_0x90d4('0x2d')][_0x90d4('0x45')]);_0x54c383[_0x90d4('0x32')]=_[_0x90d4('0x33')](_0x288eef[_0x90d4('0x32')]);_0x54c383[_0x90d4('0x34')]=_[_0x90d4('0x36')](_0x54c383[_0x90d4('0x30')],_0x54c383[_0x90d4('0x32')]);_0x50cae6[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x54c383[_0x90d4('0x30')],qs[_0x90d4('0x37')](_0x288eef[_0x90d4('0x32')]['fields']));_0x50cae6[_0x90d4('0x35')]=_0x50cae6[_0x90d4('0x35')][_0x90d4('0x56')]?_0x50cae6[_0x90d4('0x35')]:_0x54c383[_0x90d4('0x30')];_0x50cae6[_0x90d4('0x39')]=qs[_0x90d4('0x3a')](_0x288eef[_0x90d4('0x32')][_0x90d4('0x3a')]);_0x50cae6['where']=qs[_0x90d4('0x34')](_[_0x90d4('0x3c')](_0x288eef[_0x90d4('0x32')],_0x54c383['filters']));if(_0x288eef[_0x90d4('0x32')][_0x90d4('0x3e')]){_0x50cae6['where']=_[_0x90d4('0x47')](_0x50cae6[_0x90d4('0x3b')],{'$or':_[_0x90d4('0x2c')](_0x50cae6[_0x90d4('0x35')],function(_0x31b0a8){var _0x6584d1={};_0x6584d1[_0x31b0a8]={'$like':'%'+_0x288eef[_0x90d4('0x32')][_0x90d4('0x3e')]+'%'};return _0x6584d1;})});}_0x50cae6=_[_0x90d4('0x47')]({},_0x50cae6,_0x288eef[_0x90d4('0x3f')]);return _0x8d4eac[_0x90d4('0x54')](_0x50cae6);}})['then'](function(_0xed940b){if(_0xed940b){_0x85ad27=_0xed940b[_0x90d4('0x56')];if(!_0x288eef[_0x90d4('0x32')][_0x90d4('0x57')]('nolimit')){_0x50cae6[_0x90d4('0x21')]=qs[_0x90d4('0x21')](_0x288eef[_0x90d4('0x32')][_0x90d4('0x21')]);_0x50cae6[_0x90d4('0x1f')]=qs['offset'](_0x288eef['query'][_0x90d4('0x1f')]);}return _0x8d4eac['getIntervals'](_0x50cae6);}})[_0x90d4('0x26')](function(_0x2729d5){if(_0x2729d5){return _0x2729d5?{'count':_0x85ad27,'rows':_0x2729d5}:null;}})['then'](respondWithResult(_0x1743d6,null))[_0x90d4('0x43')](handleError(_0x1743d6,null));};exports[_0x90d4('0x58')]=function(_0x3e12c2,_0x380319,_0x874e1d){return db[_0x90d4('0x2d')][_0x90d4('0x55')]({'where':{'id':_0x3e12c2['params']['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x380319,null))[_0x90d4('0x26')](function(_0x5da185){if(_0x5da185){return db[_0x90d4('0x59')][_0x90d4('0x5a')](function(_0x24c73){return db['Interval'][_0x90d4('0x27')]({'where':{'IntervalId':_0x3e12c2['params']['id']},'transaction':_0x24c73})[_0x90d4('0x26')](function(_0x117147){var _0x530451=_[_0x90d4('0x2c')](_0x3e12c2['body'],function(_0x38fc4f){delete _0x38fc4f['id'];_0x38fc4f[_0x90d4('0x53')]=_0x3e12c2[_0x90d4('0x51')]['id'];return _0x38fc4f;});return db[_0x90d4('0x2d')][_0x90d4('0x5b')](_0x530451,{'transaction':_0x24c73});});})[_0x90d4('0x26')](function(){return db['Interval'][_0x90d4('0x41')]({'where':{'IntervalId':_0x3e12c2['params']['id']}});});}})[_0x90d4('0x26')](respondWithResult(_0x380319,null))[_0x90d4('0x43')](handleError(_0x380319,null));}; \ No newline at end of file +var _0x095f=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','name','send','index','map','Interval','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x127619,_0x24961d){var _0x1a0ffb=function(_0x4e189d){while(--_0x4e189d){_0x127619['push'](_0x127619['shift']());}};_0x1a0ffb(++_0x24961d);}(_0x095f,0x102));var _0xf095=function(_0x28f727,_0x580b66){_0x28f727=_0x28f727-0x0;var _0x2eda5d=_0x095f[_0x28f727];return _0x2eda5d;};'use strict';var emlformat=require(_0xf095('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf095('0x1'));var rp=require(_0xf095('0x2'));var moment=require(_0xf095('0x3'));var BPromise=require(_0xf095('0x4'));var Mustache=require('mustache');var util=require(_0xf095('0x5'));var path=require(_0xf095('0x6'));var sox=require(_0xf095('0x7'));var csv=require('to-csv');var ejs=require(_0xf095('0x8'));var fs=require('fs');var fs_extra=require(_0xf095('0x9'));var _=require(_0xf095('0xa'));var squel=require(_0xf095('0xb'));var crypto=require(_0xf095('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf095('0xd'));var toCsv=require(_0xf095('0xe'));var querystring=require(_0xf095('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf095('0x10'));var qs=require(_0xf095('0x11'));var as=require(_0xf095('0x12'));var hardwareService=require(_0xf095('0x13'));var logger=require(_0xf095('0x14'))('api');var utils=require(_0xf095('0x15'));var config=require(_0xf095('0x16'));var licenseUtil=require(_0xf095('0x17'));var db=require(_0xf095('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x233c37,_0x44a856){_0x44a856=_0x44a856||0xcc;return function(_0x464118){if(_0x464118){return _0x233c37[_0xf095('0x19')](_0x44a856);}return _0x233c37[_0xf095('0x1a')](_0x44a856)[_0xf095('0x1b')]();};}function respondWithResult(_0x2c4698,_0x18b1b2){_0x18b1b2=_0x18b1b2||0xc8;return function(_0x2f0c7e){if(_0x2f0c7e){return _0x2c4698['status'](_0x18b1b2)[_0xf095('0x1c')](_0x2f0c7e);}};}function respondWithFilteredResult(_0x18cd14,_0x3b3887){return function(_0x5980b8){if(_0x5980b8){var _0x23b5c9=typeof _0x3b3887[_0xf095('0x1d')]===_0xf095('0x1e')&&typeof _0x3b3887[_0xf095('0x1f')]===_0xf095('0x1e');var _0x38a315=_0x5980b8['count'];var _0x292163=_0x23b5c9?0x0:_0x3b3887['offset'];var _0x2e8039=_0x23b5c9?_0x5980b8[_0xf095('0x20')]:_0x3b3887[_0xf095('0x1d')]+_0x3b3887[_0xf095('0x1f')];var _0x4a7b84;if(_0x2e8039>=_0x38a315){_0x2e8039=_0x38a315;_0x4a7b84=0xc8;}else{_0x4a7b84=0xce;}_0x18cd14[_0xf095('0x1a')](_0x4a7b84);return _0x18cd14[_0xf095('0x21')](_0xf095('0x22'),_0x292163+'-'+_0x2e8039+'/'+_0x38a315)[_0xf095('0x1c')](_0x5980b8);}return null;};}function patchUpdates(_0x47fba5){return function(_0xe4b6b6){try{jsonpatch[_0xf095('0x23')](_0xe4b6b6,_0x47fba5,!![]);}catch(_0x3d13e8){return BPromise[_0xf095('0x24')](_0x3d13e8);}return _0xe4b6b6[_0xf095('0x25')]();};}function saveUpdates(_0xa0e6a9,_0x4c770c){return function(_0x4a8f73){if(_0x4a8f73){return _0x4a8f73[_0xf095('0x26')](_0xa0e6a9)[_0xf095('0x27')](function(_0x2d37cb){return _0x2d37cb;});}return null;};}function removeEntity(_0x508ff9,_0x216df6){return function(_0x41397c){if(_0x41397c){return _0x41397c['destroy']()[_0xf095('0x27')](function(){var _0x2a6d1c=_0x41397c[_0xf095('0x28')]({'plain':!![]});var _0x17311b=_0xf095('0x29');return db[_0xf095('0x2a')]['destroy']({'where':{'type':_0x17311b,'resourceId':_0x2a6d1c['id']}})['then'](function(){return _0x41397c;});})[_0xf095('0x27')](function(){_0x508ff9['status'](0xcc)[_0xf095('0x1b')]();});}};}function handleEntityNotFound(_0x3f8e56,_0x3e3aa3){return function(_0x6b02b2){if(!_0x6b02b2){_0x3f8e56['sendStatus'](0x194);}return _0x6b02b2;};}function handleError(_0x140f67,_0x180d51){_0x180d51=_0x180d51||0x1f4;return function(_0xa6bc57){logger['error'](_0xa6bc57['stack']);if(_0xa6bc57[_0xf095('0x2b')]){delete _0xa6bc57[_0xf095('0x2b')];}_0x140f67[_0xf095('0x1a')](_0x180d51)[_0xf095('0x2c')](_0xa6bc57);};}exports[_0xf095('0x2d')]=function(_0x26f3c4,_0x1b0d2e){var _0xfdd6a1={},_0x232003={},_0x36b0f3={'count':0x0,'rows':[]};var _0x37c9f8=_[_0xf095('0x2e')](db[_0xf095('0x2f')]['rawAttributes'],function(_0x5a868b){return{'name':_0x5a868b[_0xf095('0x30')],'type':_0x5a868b[_0xf095('0x31')][_0xf095('0x32')]};});_0x232003['model']=_[_0xf095('0x2e')](_0x37c9f8,_0xf095('0x2b'));_0x232003[_0xf095('0x33')]=_[_0xf095('0x34')](_0x26f3c4[_0xf095('0x33')]);_0x232003[_0xf095('0x35')]=_[_0xf095('0x36')](_0x232003[_0xf095('0x37')],_0x232003['query']);_0xfdd6a1[_0xf095('0x38')]=_[_0xf095('0x36')](_0x232003['model'],qs[_0xf095('0x39')](_0x26f3c4[_0xf095('0x33')][_0xf095('0x39')]));_0xfdd6a1['attributes']=_0xfdd6a1['attributes'][_0xf095('0x3a')]?_0xfdd6a1[_0xf095('0x38')]:_0x232003[_0xf095('0x37')];if(!_0x26f3c4[_0xf095('0x33')][_0xf095('0x3b')](_0xf095('0x3c'))){_0xfdd6a1['limit']=qs[_0xf095('0x1f')](_0x26f3c4['query'][_0xf095('0x1f')]);_0xfdd6a1[_0xf095('0x1d')]=qs[_0xf095('0x1d')](_0x26f3c4[_0xf095('0x33')]['offset']);}_0xfdd6a1[_0xf095('0x3d')]=qs['sort'](_0x26f3c4['query'][_0xf095('0x3e')]);_0xfdd6a1[_0xf095('0x3f')]=qs[_0xf095('0x35')](_[_0xf095('0x40')](_0x26f3c4[_0xf095('0x33')],_0x232003[_0xf095('0x35')]),_0x37c9f8);if(_0x26f3c4['query']['filter']){_0xfdd6a1[_0xf095('0x3f')]=_[_0xf095('0x41')](_0xfdd6a1[_0xf095('0x3f')],{'$or':_[_0xf095('0x2e')](_0x37c9f8,function(_0xa5c463){if(_0xa5c463[_0xf095('0x31')]!==_0xf095('0x42')){var _0x33d1ba={};_0x33d1ba[_0xa5c463[_0xf095('0x2b')]]={'$like':'%'+_0x26f3c4[_0xf095('0x33')][_0xf095('0x43')]+'%'};return _0x33d1ba;}})});}_0xfdd6a1=_[_0xf095('0x41')]({},_0xfdd6a1,_0x26f3c4[_0xf095('0x44')]);var _0x534235={'where':_0xfdd6a1[_0xf095('0x3f')]};return db[_0xf095('0x2f')][_0xf095('0x20')](_0x534235)['then'](function(_0x3e5ae5){_0x36b0f3[_0xf095('0x20')]=_0x3e5ae5;if(_0x26f3c4[_0xf095('0x33')][_0xf095('0x45')]){_0xfdd6a1['include']=[{'all':!![]}];}return db[_0xf095('0x2f')][_0xf095('0x46')](_0xfdd6a1);})['then'](function(_0x1f8b98){_0x36b0f3[_0xf095('0x47')]=_0x1f8b98;return _0x36b0f3;})[_0xf095('0x27')](respondWithFilteredResult(_0x1b0d2e,_0xfdd6a1))[_0xf095('0x48')](handleError(_0x1b0d2e,null));};exports[_0xf095('0x49')]=function(_0x4862ba,_0x2b3b9e){var _0x408860={'raw':!![],'where':{'id':_0x4862ba[_0xf095('0x4a')]['id']}},_0x5994c5={};_0x5994c5[_0xf095('0x37')]=_[_0xf095('0x34')](db[_0xf095('0x2f')][_0xf095('0x4b')]);_0x5994c5['query']=_['keys'](_0x4862ba[_0xf095('0x33')]);_0x5994c5[_0xf095('0x35')]=_[_0xf095('0x36')](_0x5994c5[_0xf095('0x37')],_0x5994c5[_0xf095('0x33')]);_0x408860[_0xf095('0x38')]=_['intersection'](_0x5994c5['model'],qs[_0xf095('0x39')](_0x4862ba[_0xf095('0x33')][_0xf095('0x39')]));_0x408860[_0xf095('0x38')]=_0x408860['attributes'][_0xf095('0x3a')]?_0x408860['attributes']:_0x5994c5[_0xf095('0x37')];if(_0x4862ba[_0xf095('0x33')][_0xf095('0x45')]){_0x408860[_0xf095('0x4c')]=[{'all':!![]}];}_0x408860=_[_0xf095('0x41')]({},_0x408860,_0x4862ba[_0xf095('0x44')]);return db[_0xf095('0x2f')][_0xf095('0x4d')](_0x408860)['then'](handleEntityNotFound(_0x2b3b9e,null))[_0xf095('0x27')](respondWithResult(_0x2b3b9e,null))['catch'](handleError(_0x2b3b9e,null));};exports[_0xf095('0x4e')]=function(_0x29417b,_0x583643){return db[_0xf095('0x2f')][_0xf095('0x4e')](_0x29417b['body'],{})[_0xf095('0x27')](function(_0x12586f){var _0x2bcfb8=_0x29417b[_0xf095('0x4f')][_0xf095('0x28')]({'plain':!![]});if(!_0x2bcfb8)throw new Error(_0xf095('0x50'));if(_0x2bcfb8[_0xf095('0x51')]===_0xf095('0x4f')){var _0xbfdd0f=_0x12586f[_0xf095('0x28')]({'plain':!![]});var _0xeadc65=_0xf095('0x29');return db[_0xf095('0x52')][_0xf095('0x4d')]({'where':{'name':_0xeadc65,'userProfileId':_0x2bcfb8[_0xf095('0x53')]},'raw':!![]})[_0xf095('0x27')](function(_0x47df67){if(_0x47df67&&_0x47df67[_0xf095('0x54')]===0x0){return db['UserProfileResource'][_0xf095('0x4e')]({'name':_0xbfdd0f[_0xf095('0x2b')],'resourceId':_0xbfdd0f['id'],'type':_0x47df67[_0xf095('0x2b')],'sectionId':_0x47df67['id']},{})['then'](function(){return _0x12586f;});}else{return _0x12586f;}})['catch'](function(_0x232964){logger['error'](_0xf095('0x55'),_0x232964);throw _0x232964;});}return _0x12586f;})['then'](respondWithResult(_0x583643,0xc9))[_0xf095('0x48')](handleError(_0x583643,null));};exports[_0xf095('0x26')]=function(_0x2589de,_0x4f559f){if(_0x2589de[_0xf095('0x56')]['id']){delete _0x2589de[_0xf095('0x56')]['id'];}return db['Interval']['find']({'where':{'id':_0x2589de[_0xf095('0x4a')]['id']}})[_0xf095('0x27')](handleEntityNotFound(_0x4f559f,null))[_0xf095('0x27')](saveUpdates(_0x2589de['body'],null))['then'](respondWithResult(_0x4f559f,null))[_0xf095('0x48')](handleError(_0x4f559f,null));};exports[_0xf095('0x57')]=function(_0x3cd658,_0x2d79bd){return db[_0xf095('0x2f')]['find']({'where':{'id':_0x3cd658[_0xf095('0x4a')]['id']}})[_0xf095('0x27')](handleEntityNotFound(_0x2d79bd,null))['then'](removeEntity(_0x2d79bd,null))[_0xf095('0x48')](handleError(_0x2d79bd,null));};exports[_0xf095('0x58')]=function(_0x2b9952,_0x4cbb43,_0x437c0f){if(_0x2b9952[_0xf095('0x56')]['id']){delete _0x2b9952['body']['id'];}return db[_0xf095('0x2f')][_0xf095('0x4d')]({'where':{'id':_0x2b9952[_0xf095('0x4a')]['id']}})[_0xf095('0x27')](handleEntityNotFound(_0x4cbb43,null))[_0xf095('0x27')](function(_0x26a561){if(_0x26a561){_0x2b9952[_0xf095('0x56')][_0xf095('0x59')]=_0x26a561['id'];return db[_0xf095('0x2f')][_0xf095('0x4e')](_0x2b9952[_0xf095('0x56')]);}})[_0xf095('0x27')](respondWithResult(_0x4cbb43,null))[_0xf095('0x48')](handleError(_0x4cbb43,null));};exports[_0xf095('0x5a')]=function(_0x2efd74,_0x5502c6,_0x5d8ab9){var _0xb8e3a2={};var _0x59ae84={};var _0x4693b0;var _0x29bd70;return db['Interval'][_0xf095('0x5b')]({'where':{'id':_0x2efd74[_0xf095('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5502c6,null))['then'](function(_0x2fe759){if(_0x2fe759){_0x4693b0=_0x2fe759;_0x59ae84[_0xf095('0x37')]=_['keys'](db[_0xf095('0x2f')][_0xf095('0x4b')]);_0x59ae84[_0xf095('0x33')]=_['keys'](_0x2efd74['query']);_0x59ae84[_0xf095('0x35')]=_[_0xf095('0x36')](_0x59ae84[_0xf095('0x37')],_0x59ae84[_0xf095('0x33')]);_0xb8e3a2[_0xf095('0x38')]=_[_0xf095('0x36')](_0x59ae84[_0xf095('0x37')],qs[_0xf095('0x39')](_0x2efd74[_0xf095('0x33')][_0xf095('0x39')]));_0xb8e3a2[_0xf095('0x38')]=_0xb8e3a2[_0xf095('0x38')][_0xf095('0x3a')]?_0xb8e3a2[_0xf095('0x38')]:_0x59ae84[_0xf095('0x37')];_0xb8e3a2['order']=qs['sort'](_0x2efd74['query']['sort']);_0xb8e3a2[_0xf095('0x3f')]=qs[_0xf095('0x35')](_[_0xf095('0x40')](_0x2efd74[_0xf095('0x33')],_0x59ae84['filters']));if(_0x2efd74['query'][_0xf095('0x43')]){_0xb8e3a2[_0xf095('0x3f')]=_[_0xf095('0x41')](_0xb8e3a2[_0xf095('0x3f')],{'$or':_['map'](_0xb8e3a2['attributes'],function(_0x3c7c93){var _0x447c9d={};_0x447c9d[_0x3c7c93]={'$like':'%'+_0x2efd74[_0xf095('0x33')][_0xf095('0x43')]+'%'};return _0x447c9d;})});}_0xb8e3a2=_['merge']({},_0xb8e3a2,_0x2efd74[_0xf095('0x44')]);return _0x4693b0[_0xf095('0x5a')](_0xb8e3a2);}})[_0xf095('0x27')](function(_0x569a69){if(_0x569a69){_0x29bd70=_0x569a69['length'];if(!_0x2efd74[_0xf095('0x33')][_0xf095('0x3b')](_0xf095('0x3c'))){_0xb8e3a2['limit']=qs[_0xf095('0x1f')](_0x2efd74[_0xf095('0x33')]['limit']);_0xb8e3a2['offset']=qs[_0xf095('0x1d')](_0x2efd74[_0xf095('0x33')][_0xf095('0x1d')]);}return _0x4693b0[_0xf095('0x5a')](_0xb8e3a2);}})[_0xf095('0x27')](function(_0x9bde73){if(_0x9bde73){return _0x9bde73?{'count':_0x29bd70,'rows':_0x9bde73}:null;}})[_0xf095('0x27')](respondWithResult(_0x5502c6,null))[_0xf095('0x48')](handleError(_0x5502c6,null));};exports[_0xf095('0x5c')]=function(_0x5d9642,_0x277d75,_0x20a5b1){return db[_0xf095('0x2f')]['findOne']({'where':{'id':_0x5d9642['params']['id']}})[_0xf095('0x27')](handleEntityNotFound(_0x277d75,null))['then'](function(_0x1cddbb){if(_0x1cddbb){return db['sequelize'][_0xf095('0x5d')](function(_0x18b19d){return db[_0xf095('0x2f')][_0xf095('0x57')]({'where':{'IntervalId':_0x5d9642[_0xf095('0x4a')]['id']},'transaction':_0x18b19d})['then'](function(_0x106b97){var _0x2ec2fc=_[_0xf095('0x2e')](_0x5d9642[_0xf095('0x56')],function(_0x202c6f){delete _0x202c6f['id'];_0x202c6f['IntervalId']=_0x5d9642['params']['id'];return _0x202c6f;});return db['Interval']['bulkCreate'](_0x2ec2fc,{'transaction':_0x18b19d});});})[_0xf095('0x27')](function(){return db[_0xf095('0x2f')][_0xf095('0x46')]({'where':{'IntervalId':_0x5d9642[_0xf095('0x4a')]['id']}});});}})['then'](respondWithResult(_0x277d75,null))[_0xf095('0x48')](handleError(_0x277d75,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 34b7782..c0e1394 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 _0x7ed2=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','getIntervals','all','ifTime','reduce'];(function(_0xaf5471,_0x2b651c){var _0x5c4f41=function(_0x174f7f){while(--_0x174f7f){_0xaf5471['push'](_0xaf5471['shift']());}};_0x5c4f41(++_0x2b651c);}(_0x7ed2,0xb4));var _0x27ed=function(_0x100f69,_0x45a456){_0x100f69=_0x100f69-0x0;var _0x39d8c6=_0x7ed2[_0x100f69];return _0x39d8c6;};'use strict';var attributes=require(_0x27ed('0x0'));var extensions=require(_0x27ed('0x1'));var iftime=require('../../utils/iftime')[_0x27ed('0x2')];module[_0x27ed('0x3')]=function(_0x19b0fe){return _0x19b0fe[_0x27ed('0x4')](_0x27ed('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45fe25){extensions[_0x27ed('0x6')](_0x19b0fe,_0x45fe25);},'afterBulkCreate':function(_0x250fef,_0x40c9f9,_0x3f749e){_0x3f749e();extensions[_0x27ed('0x6')](_0x19b0fe,_0x250fef[0x0]);},'afterUpdate':function(_0x1cc0c7){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1cc0c7);},'afterDestroy':function(_0x1467ec){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1467ec);}},'instanceMethods':{'ifTime':function(_0x1efbad=undefined,_0x11ca95=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x27ed('0x7')],_0x1efbad,_0x11ca95);}else{return this[_0x27ed('0x8')]()['then'](function(_0x4a781e){return Promise[_0x27ed('0x9')](_0x4a781e['map'](function(_0x562ba4){return _0x562ba4[_0x27ed('0xa')](_0x1efbad,_0x11ca95);}));})['then'](function(_0x440db9){return _0x440db9[_0x27ed('0xb')](function(_0x2aa339,_0x49175c){return _0x2aa339||_0x49175c;},![]);});}}}});}; \ No newline at end of file +var _0x76bd=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','string','interval','getIntervals','then','map','ifTime','reduce','./interval.attributes'];(function(_0x9a8878,_0x2ef1b8){var _0x5f36a8=function(_0x5b6079){while(--_0x5b6079){_0x9a8878['push'](_0x9a8878['shift']());}};_0x5f36a8(++_0x2ef1b8);}(_0x76bd,0x1df));var _0xd76b=function(_0x261805,_0x167acd){_0x261805=_0x261805-0x0;var _0x40b2e3=_0x76bd[_0x261805];return _0x40b2e3;};'use strict';var attributes=require(_0xd76b('0x0'));var extensions=require(_0xd76b('0x1'));var iftime=require(_0xd76b('0x2'))[_0xd76b('0x3')];module[_0xd76b('0x4')]=function(_0xe6a05c){return _0xe6a05c[_0xd76b('0x5')](_0xd76b('0x6'),attributes,{'tableName':_0xd76b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45074d){extensions[_0xd76b('0x8')](_0xe6a05c,_0x45074d);},'afterBulkCreate':function(_0x2ba1f4,_0x22a2e1,_0x528e9f){_0x528e9f();extensions[_0xd76b('0x8')](_0xe6a05c,_0x2ba1f4[0x0]);},'afterUpdate':function(_0x1e21b8){extensions['rewrite'](_0xe6a05c,_0x1e21b8);},'afterDestroy':function(_0x35c646){extensions[_0xd76b('0x8')](_0xe6a05c,_0x35c646);}},'instanceMethods':{'ifTime':function(_0x1a858e=undefined,_0x3c4fca=new Date()){if(typeof this['interval']===_0xd76b('0x9')){return iftime(this[_0xd76b('0xa')],_0x1a858e,_0x3c4fca);}else{return this[_0xd76b('0xb')]()[_0xd76b('0xc')](function(_0x37c629){return Promise['all'](_0x37c629[_0xd76b('0xd')](function(_0x136545){return _0x136545[_0xd76b('0xe')](_0x1a858e,_0x3c4fca);}));})[_0xd76b('0xc')](function(_0x23a0cd){return _0x23a0cd[_0xd76b('0xf')](function(_0xfb761f,_0x1369f9){return _0xfb761f||_0x1369f9;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index de1c050..ef57ef4 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 _0x825d=['message','ShowInterval','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','raw','options','where','attributes','limit','include','map','model','then','info','debug','catch','error'];(function(_0x500271,_0x304e32){var _0x4e3f69=function(_0x271391){while(--_0x271391){_0x500271['push'](_0x500271['shift']());}};_0x4e3f69(++_0x304e32);}(_0x825d,0x6e));var _0xd825=function(_0x5cd89b,_0x81d7ee){_0x5cd89b=_0x5cd89b-0x0;var _0x4d7e28=_0x825d[_0x5cd89b];return _0x4d7e28;};'use strict';var _=require(_0xd825('0x0'));var util=require(_0xd825('0x1'));var db=require(_0xd825('0x2'))['db'];var iftime=require(_0xd825('0x3'))[_0xd825('0x4')];var logger=require('../../config/logger')(_0xd825('0x5'));exports[_0xd825('0x6')]=function(_0x248c10){var _0x395b70=this;return new Promise(function(_0xce217,_0x1a28c2){return db[_0xd825('0x7')][_0xd825('0x8')]({'raw':_0x248c10['options']?_0x248c10['options'][_0xd825('0x9')]===undefined?!![]:![]:!![],'where':_0x248c10[_0xd825('0xa')]?_0x248c10['options'][_0xd825('0xb')]||null:null,'attributes':_0x248c10['options']?_0x248c10[_0xd825('0xa')][_0xd825('0xc')]||null:null,'limit':_0x248c10[_0xd825('0xa')]?_0x248c10['options'][_0xd825('0xd')]||null:null,'include':_0x248c10[_0xd825('0xa')]?_0x248c10[_0xd825('0xa')][_0xd825('0xe')]?_[_0xd825('0xf')](_0x248c10[_0xd825('0xa')]['include'],function(_0x33099e){return{'model':db[_0x33099e['model']],'as':_0x33099e['as'],'attributes':_0x33099e['attributes'],'include':_0x33099e[_0xd825('0xe')]?_[_0xd825('0xf')](_0x33099e[_0xd825('0xe')],function(_0x5dbb9c){return{'model':db[_0x5dbb9c[_0xd825('0x10')]],'as':_0x5dbb9c['as'],'attributes':_0x5dbb9c[_0xd825('0xc')],'include':_0x5dbb9c[_0xd825('0xe')]?_[_0xd825('0xf')](_0x5dbb9c[_0xd825('0xe')],function(_0x101f79){return{'model':db[_0x101f79[_0xd825('0x10')]],'as':_0x101f79['as'],'attributes':_0x101f79[_0xd825('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd825('0x11')](function(_0x46220b){logger[_0xd825('0x12')](_0xd825('0x6'),_0x248c10);logger[_0xd825('0x13')](_0xd825('0x6'),_0x248c10,JSON['stringify'](_0x46220b));_0xce217(_0x46220b);})[_0xd825('0x14')](function(_0x3f487f){logger[_0xd825('0x15')]('GetInterval',_0x3f487f['message'],_0x248c10);_0x1a28c2(_0x395b70['error'](0x1f4,_0x3f487f[_0xd825('0x16')]));});});};exports[_0xd825('0x17')]=function(_0x20c1a5){var _0x2721e6=this;return new Promise(function(_0x405e1e,_0x497286){return db[_0xd825('0x7')]['find']({'raw':_0x20c1a5['options']?_0x20c1a5[_0xd825('0xa')][_0xd825('0x9')]===undefined?!![]:![]:!![],'where':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xb')]||null:null,'attributes':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xc')]||null:null,'include':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xe')]?_[_0xd825('0xf')](_0x20c1a5[_0xd825('0xa')]['include'],function(_0xa5f823){return{'model':db[_0xa5f823[_0xd825('0x10')]],'as':_0xa5f823['as'],'attributes':_0xa5f823[_0xd825('0xc')],'include':_0xa5f823['include']?_[_0xd825('0xf')](_0xa5f823[_0xd825('0xe')],function(_0x27505a){return{'model':db[_0x27505a[_0xd825('0x10')]],'as':_0x27505a['as'],'attributes':_0x27505a[_0xd825('0xc')],'include':_0x27505a[_0xd825('0xe')]?_['map'](_0x27505a[_0xd825('0xe')],function(_0xe39061){return{'model':db[_0xe39061[_0xd825('0x10')]],'as':_0xe39061['as'],'attributes':_0xe39061[_0xd825('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd825('0x11')](function(_0x594af6){logger[_0xd825('0x12')](_0xd825('0x17'),_0x20c1a5);logger['debug']('ShowInterval',_0x20c1a5,JSON['stringify'](_0x594af6));_0x405e1e(_0x594af6);})[_0xd825('0x14')](function(_0x4b55f2){logger[_0xd825('0x15')](_0xd825('0x17'),_0x4b55f2[_0xd825('0x16')],_0x20c1a5);_0x497286(_0x2721e6[_0xd825('0x15')](0x1f4,_0x4b55f2[_0xd825('0x16')]));});});};function checkArrayOfIntervals(_0x3ab324,_0x5a5d20){var _0xca98a=[];return db[_0xd825('0x7')][_0xd825('0x8')]({'where':{'id':_0x3ab324}})[_0xd825('0x11')](function(_0x483e7e){_0xca98a=_0x483e7e;return Promise['all'](_0xca98a[_0xd825('0xf')](function(_0x598972){return _0x598972['ifTime'](_0x5a5d20);}));})['then'](function(_0x23941a){var _0x3652f3=_0x23941a[_0xd825('0x18')](function(_0x126a3d,_0xd59395){return _0x126a3d||_0xd59395;},![]);logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x1a'),_0xca98a['map'](function(_0x3b75b9){return _0x3b75b9[_0xd825('0x1b')];})[_0xd825('0x1c')](',\x20'),_0xca98a['map'](function(_0x508a55){return _0x508a55['id'];})[_0xd825('0x1c')](',\x20')));return _0x3652f3;});}function checkSingleInterval(_0x373afe,_0x4c5a5f){return db[_0xd825('0x7')][_0xd825('0x1d')](_0x373afe)[_0xd825('0x11')](function(_0x1524b9){if(_0x1524b9){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x1e'),_0x1524b9[_0xd825('0x1b')],_0x1524b9['id']));return _0x1524b9[_0xd825('0x1f')](_0x4c5a5f);}});}exports[_0xd825('0x20')]=function(_0x565733){var _0x1cc380=_0x565733[_0xd825('0x21')];var _0x2b9a1f=Array[_0xd825('0x22')](_0x565733[_0xd825('0x23')])?_0x565733[_0xd825('0x23')]:typeof _0x565733[_0xd825('0x23')]===_0xd825('0x24')?[_0x565733[_0xd825('0x23')]]:[];var _0x31ae7d=_0x565733[_0xd825('0x25')]||undefined;var _0x168973=![];if(_0x2b9a1f[_0xd825('0x26')]){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x27'),_0x2b9a1f[_0xd825('0x1c')](';\x20')));}if(_0x31ae7d){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x28'),_0x31ae7d));}logger[_0xd825('0x13')](_0xd825('0x29'),_0x168973);logger[_0xd825('0x2a')](_0xd825('0x20'),_0x565733);return Promise[_0xd825('0x2b')]()[_0xd825('0x11')](function(){if(Array['isArray'](_0x1cc380)){return checkArrayOfIntervals(_0x1cc380,_0x31ae7d);}else if(_0x1cc380){return checkSingleInterval(_0x1cc380,_0x31ae7d);}})[_0xd825('0x11')](function(_0x20a91b){var _0x5c55d7=_0x2b9a1f[_0xd825('0x18')](function(_0x182d24,_0x445c6b){return _0x182d24||iftime(_0x445c6b,_0x31ae7d);},![]);_0x168973=_0x20a91b||_0x5c55d7;return _0x168973;})[_0xd825('0x14')](function(_0x517ac6){logger[_0xd825('0x15')](_0xd825('0x20'),_0x565733,_0x517ac6);throw this[_0xd825('0x15')](0x1f4,_0x517ac6[_0xd825('0x16')]);});}; \ No newline at end of file +var _0xab07=['IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','IntervalIftime','lodash','../../mysqldb','iftime','../../config/logger','GetInterval','Interval','options','raw','limit','map','include','model','attributes','then','debug','stringify','catch','error','message','ShowInterval','find','where','findAll','all','ifTime','reduce','info','format','name','join'];(function(_0x18688c,_0xe1dd36){var _0x3acbc1=function(_0x3c3d50){while(--_0x3c3d50){_0x18688c['push'](_0x18688c['shift']());}};_0x3acbc1(++_0xe1dd36);}(_0xab07,0x86));var _0x7ab0=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xab07[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x7ab0('0x0'));var util=require('util');var db=require(_0x7ab0('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x7ab0('0x2')];var logger=require(_0x7ab0('0x3'))('rpc');exports[_0x7ab0('0x4')]=function(_0x7f0551){var _0x439605=this;return new Promise(function(_0x5cac4f,_0x2fcd1d){return db[_0x7ab0('0x5')]['findAll']({'raw':_0x7f0551[_0x7ab0('0x6')]?_0x7f0551[_0x7ab0('0x6')][_0x7ab0('0x7')]===undefined?!![]:![]:!![],'where':_0x7f0551[_0x7ab0('0x6')]?_0x7f0551[_0x7ab0('0x6')]['where']||null:null,'attributes':_0x7f0551['options']?_0x7f0551[_0x7ab0('0x6')]['attributes']||null:null,'limit':_0x7f0551[_0x7ab0('0x6')]?_0x7f0551[_0x7ab0('0x6')][_0x7ab0('0x8')]||null:null,'include':_0x7f0551[_0x7ab0('0x6')]?_0x7f0551[_0x7ab0('0x6')]['include']?_[_0x7ab0('0x9')](_0x7f0551['options'][_0x7ab0('0xa')],function(_0x4ff706){return{'model':db[_0x4ff706[_0x7ab0('0xb')]],'as':_0x4ff706['as'],'attributes':_0x4ff706[_0x7ab0('0xc')],'include':_0x4ff706[_0x7ab0('0xa')]?_[_0x7ab0('0x9')](_0x4ff706['include'],function(_0xf80e17){return{'model':db[_0xf80e17[_0x7ab0('0xb')]],'as':_0xf80e17['as'],'attributes':_0xf80e17['attributes'],'include':_0xf80e17['include']?_[_0x7ab0('0x9')](_0xf80e17['include'],function(_0x4488f8){return{'model':db[_0x4488f8[_0x7ab0('0xb')]],'as':_0x4488f8['as'],'attributes':_0x4488f8[_0x7ab0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7ab0('0xd')](function(_0x1c15ca){logger['info'](_0x7ab0('0x4'),_0x7f0551);logger[_0x7ab0('0xe')](_0x7ab0('0x4'),_0x7f0551,JSON[_0x7ab0('0xf')](_0x1c15ca));_0x5cac4f(_0x1c15ca);})[_0x7ab0('0x10')](function(_0x3517e4){logger[_0x7ab0('0x11')](_0x7ab0('0x4'),_0x3517e4[_0x7ab0('0x12')],_0x7f0551);_0x2fcd1d(_0x439605[_0x7ab0('0x11')](0x1f4,_0x3517e4[_0x7ab0('0x12')]));});});};exports[_0x7ab0('0x13')]=function(_0x21237f){var _0x3b266b=this;return new Promise(function(_0x1be944,_0x37db20){return db[_0x7ab0('0x5')][_0x7ab0('0x14')]({'raw':_0x21237f[_0x7ab0('0x6')]?_0x21237f['options'][_0x7ab0('0x7')]===undefined?!![]:![]:!![],'where':_0x21237f[_0x7ab0('0x6')]?_0x21237f[_0x7ab0('0x6')][_0x7ab0('0x15')]||null:null,'attributes':_0x21237f[_0x7ab0('0x6')]?_0x21237f['options']['attributes']||null:null,'include':_0x21237f[_0x7ab0('0x6')]?_0x21237f[_0x7ab0('0x6')]['include']?_[_0x7ab0('0x9')](_0x21237f[_0x7ab0('0x6')]['include'],function(_0x2090b4){return{'model':db[_0x2090b4['model']],'as':_0x2090b4['as'],'attributes':_0x2090b4[_0x7ab0('0xc')],'include':_0x2090b4[_0x7ab0('0xa')]?_[_0x7ab0('0x9')](_0x2090b4[_0x7ab0('0xa')],function(_0x3d733d){return{'model':db[_0x3d733d[_0x7ab0('0xb')]],'as':_0x3d733d['as'],'attributes':_0x3d733d[_0x7ab0('0xc')],'include':_0x3d733d['include']?_[_0x7ab0('0x9')](_0x3d733d[_0x7ab0('0xa')],function(_0xa9205f){return{'model':db[_0xa9205f['model']],'as':_0xa9205f['as'],'attributes':_0xa9205f[_0x7ab0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7ab0('0xd')](function(_0x26c610){logger['info'](_0x7ab0('0x13'),_0x21237f);logger['debug'](_0x7ab0('0x13'),_0x21237f,JSON['stringify'](_0x26c610));_0x1be944(_0x26c610);})[_0x7ab0('0x10')](function(_0x479ba7){logger['error'](_0x7ab0('0x13'),_0x479ba7['message'],_0x21237f);_0x37db20(_0x3b266b[_0x7ab0('0x11')](0x1f4,_0x479ba7[_0x7ab0('0x12')]));});});};function checkArrayOfIntervals(_0xb57cdf,_0x256f2c){var _0x5b135c=[];return db['Interval'][_0x7ab0('0x16')]({'where':{'id':_0xb57cdf}})['then'](function(_0x3c7fdf){_0x5b135c=_0x3c7fdf;return Promise[_0x7ab0('0x17')](_0x5b135c[_0x7ab0('0x9')](function(_0x3a644a){return _0x3a644a[_0x7ab0('0x18')](_0x256f2c);}));})[_0x7ab0('0xd')](function(_0x426985){var _0x5abe5f=_0x426985[_0x7ab0('0x19')](function(_0x2bac62,_0x1d6bd7){return _0x2bac62||_0x1d6bd7;},![]);logger[_0x7ab0('0x1a')](util[_0x7ab0('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x5b135c['map'](function(_0x45e297){return _0x45e297[_0x7ab0('0x1c')];})[_0x7ab0('0x1d')](',\x20'),_0x5b135c[_0x7ab0('0x9')](function(_0x3690c6){return _0x3690c6['id'];})['join'](',\x20')));return _0x5abe5f;});}function checkSingleInterval(_0x32da6e,_0x2c9bb4){return db['Interval']['findById'](_0x32da6e)[_0x7ab0('0xd')](function(_0x522596){if(_0x522596){logger[_0x7ab0('0x1a')](util['format'](_0x7ab0('0x1e'),_0x522596[_0x7ab0('0x1c')],_0x522596['id']));return _0x522596[_0x7ab0('0x18')](_0x2c9bb4);}});}exports['IntervalIftime']=function(_0x5b4d04){var _0x2d869e=_0x5b4d04[_0x7ab0('0x1f')];var _0x59b405=Array[_0x7ab0('0x20')](_0x5b4d04['intervals'])?_0x5b4d04[_0x7ab0('0x21')]:typeof _0x5b4d04['intervals']===_0x7ab0('0x22')?[_0x5b4d04[_0x7ab0('0x21')]]:[];var _0x5d35bb=_0x5b4d04[_0x7ab0('0x23')]||undefined;var _0x1ef867=![];if(_0x59b405['length']){logger[_0x7ab0('0x1a')](util['format'](_0x7ab0('0x24'),_0x59b405['join'](';\x20')));}if(_0x5d35bb){logger['info'](util[_0x7ab0('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x5d35bb));}logger['debug'](_0x7ab0('0x25'),_0x1ef867);logger[_0x7ab0('0x26')]('IntervalIftime',_0x5b4d04);return Promise[_0x7ab0('0x27')]()['then'](function(){if(Array['isArray'](_0x2d869e)){return checkArrayOfIntervals(_0x2d869e,_0x5d35bb);}else if(_0x2d869e){return checkSingleInterval(_0x2d869e,_0x5d35bb);}})[_0x7ab0('0xd')](function(_0x44669a){var _0xcb6a2f=_0x59b405['reduce'](function(_0xcc9ff3,_0x174104){return _0xcc9ff3||iftime(_0x174104,_0x5d35bb);},![]);_0x1ef867=_0x44669a||_0xcb6a2f;return _0x1ef867;})[_0x7ab0('0x10')](function(_0xe8b77e){logger['error'](_0x7ab0('0x28'),_0x5b4d04,_0xe8b77e);throw this['error'](0x1f4,_0xe8b77e[_0x7ab0('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4633597..93f92b2 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56211e,_0x44c624){var _0x2bf60b=function(_0x430523){while(--_0x430523){_0x56211e['push'](_0x56211e['shift']());}};_0x2bf60b(++_0x44c624);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e0eb5,_0x482f77){_0x2e0eb5=_0x2e0eb5-0x0;var _0x20571c=_0x2ef3[_0x2e0eb5];return _0x20571c;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x507b97,_0x2d10a3){var _0x4d89ff=function(_0x3290c3){while(--_0x3290c3){_0x507b97['push'](_0x507b97['shift']());}};_0x4d89ff(++_0x2d10a3);}(_0x2032,0xd9));var _0x2203=function(_0x518435,_0x2841bd){_0x518435=_0x518435-0x0;var _0x3f4062=_0x2032[_0x518435];return _0x3f4062;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index ff4968c..53dfd86 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 _0xb45c=['\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','request','utf8','data','end','json','error','status','api.jira','write','send','body','headers','connection','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb45c,0x10f));var _0xcb45=function(_0x5d271,_0x11a533){_0x5d271=_0x5d271-0x0;var _0x4ceab8=_0xb45c[_0x5d271];return _0x4ceab8;};'use strict';var BPromise=require(_0xcb45('0x0'));var https=require(_0xcb45('0x1'));var logger=require(_0xcb45('0x2'))(_0xcb45('0x3'));var USERNAME=_0xcb45('0x4');var PASSWORD=_0xcb45('0x5');function openIssue(_0x46e3f5,_0x12c149){var _0x21f355={'fields':{'project':{'key':_0x46e3f5[_0xcb45('0x6')]||_0xcb45('0x7')},'summary':(_0x46e3f5['summary']||_0xcb45('0x8'))+_0xcb45('0x9')+_0x46e3f5['ip'],'description':_0x46e3f5[_0xcb45('0xa')]||JSON['stringify'](_0x46e3f5),'issuetype':{'name':_0x46e3f5[_0xcb45('0xb')]||_0xcb45('0xc')}}};_0x21f355[_0xcb45('0xd')][_0xcb45('0xe')]=_0x46e3f5[_0xcb45('0xf')];_0x21f355[_0xcb45('0xd')]['customfield_11501']=_0x46e3f5['oldToken'];_0x21f355[_0xcb45('0xd')]['customfield_11502']=_0x46e3f5[_0xcb45('0x10')];_0x21f355[_0xcb45('0xd')]['customfield_11503']=_0x46e3f5[_0xcb45('0x11')];_0x21f355[_0xcb45('0xd')]['customfield_11504']=_0x46e3f5[_0xcb45('0x12')];_0x21f355[_0xcb45('0xd')]['customfield_10102']=_0x46e3f5['ip'];var _0x21d1cd={'host':_0xcb45('0x13'),'port':0x1bb,'path':_0xcb45('0x14'),'method':_0xcb45('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xcb45('0x16'),'Authorization':_0xcb45('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xcb45('0x18')]('base64')}};var _0x2f5a0f=JSON[_0xcb45('0x19')](_0x21f355);var _0x158b9e=https[_0xcb45('0x1a')](_0x21d1cd,function(_0x3bbd29){_0x3bbd29['setEncoding'](_0xcb45('0x1b'));var _0x44e9b1='';_0x3bbd29['on'](_0xcb45('0x1c'),function(_0x2cc57b){_0x44e9b1+=_0x2cc57b;});_0x3bbd29['on'](_0xcb45('0x1d'),function(){if(_0x12c149){return _0x12c149['status'](_0x3bbd29['statusCode'])[_0xcb45('0x1e')](JSON['parse'](_0x44e9b1));}});});_0x158b9e['on'](_0xcb45('0x1f'),function(_0x3e7fa1){if(_0x12c149){return _0x12c149[_0xcb45('0x20')](0x1f4)[_0xcb45('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xcb45('0x21')}]});}});_0x158b9e[_0xcb45('0x22')](_0x2f5a0f);_0x158b9e[_0xcb45('0x1d')]();}exports['openIssue']=openIssue;exports[_0xcb45('0x23')]=function(_0x4c6e1e,_0x37f245){_0x4c6e1e[_0xcb45('0x24')]['ip']=_0x4c6e1e[_0xcb45('0x25')]['x-forwarded-for']||_0x4c6e1e[_0xcb45('0x26')][_0xcb45('0x27')]||_0x4c6e1e['socket'][_0xcb45('0x27')]||_0x4c6e1e[_0xcb45('0x26')]['socket'][_0xcb45('0x27')];return openIssue(_0x4c6e1e[_0xcb45('0x24')],_0x37f245);}; \ No newline at end of file +var _0x6bb7=['summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','key','MOTGUI'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x6bb7,0xdd));var _0x76bb=function(_0x1ee585,_0x451b79){_0x1ee585=_0x1ee585-0x0;var _0x5de338=_0x6bb7[_0x1ee585];return _0x5de338;};'use strict';var BPromise=require(_0x76bb('0x0'));var https=require(_0x76bb('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x10efe9,_0x222480){var _0x4cf830={'fields':{'project':{'key':_0x10efe9[_0x76bb('0x2')]||_0x76bb('0x3')},'summary':(_0x10efe9[_0x76bb('0x4')]||_0x76bb('0x5'))+_0x76bb('0x6')+_0x10efe9['ip'],'description':_0x10efe9[_0x76bb('0x7')]||JSON[_0x76bb('0x8')](_0x10efe9),'issuetype':{'name':_0x10efe9[_0x76bb('0x9')]||_0x76bb('0xa')}}};_0x4cf830[_0x76bb('0xb')]['customfield_11500']=_0x10efe9[_0x76bb('0xc')];_0x4cf830[_0x76bb('0xb')][_0x76bb('0xd')]=_0x10efe9[_0x76bb('0xe')];_0x4cf830[_0x76bb('0xb')][_0x76bb('0xf')]=_0x10efe9[_0x76bb('0x10')];_0x4cf830[_0x76bb('0xb')][_0x76bb('0x11')]=_0x10efe9['name'];_0x4cf830[_0x76bb('0xb')][_0x76bb('0x12')]=_0x10efe9['reason'];_0x4cf830[_0x76bb('0xb')]['customfield_10102']=_0x10efe9['ip'];var _0x41d3ed={'host':_0x76bb('0x13'),'port':0x1bb,'path':_0x76bb('0x14'),'method':_0x76bb('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x76bb('0x16'),'Authorization':_0x76bb('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x76bb('0x18')](_0x76bb('0x19'))}};var _0x3bacb8=JSON['stringify'](_0x4cf830);var _0x268acd=https[_0x76bb('0x1a')](_0x41d3ed,function(_0x5dd181){_0x5dd181[_0x76bb('0x1b')](_0x76bb('0x1c'));var _0xfb9798='';_0x5dd181['on'](_0x76bb('0x1d'),function(_0x56608e){_0xfb9798+=_0x56608e;});_0x5dd181['on'](_0x76bb('0x1e'),function(){if(_0x222480){return _0x222480[_0x76bb('0x1f')](_0x5dd181[_0x76bb('0x20')])[_0x76bb('0x21')](JSON[_0x76bb('0x22')](_0xfb9798));}});});_0x268acd['on'](_0x76bb('0x23'),function(_0x4ceabf){if(_0x222480){return _0x222480['status'](0x1f4)[_0x76bb('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x268acd[_0x76bb('0x24')](_0x3bacb8);_0x268acd['end']();}exports[_0x76bb('0x25')]=openIssue;exports[_0x76bb('0x26')]=function(_0x3b1473,_0x21e03f){_0x3b1473[_0x76bb('0x27')]['ip']=_0x3b1473[_0x76bb('0x28')][_0x76bb('0x29')]||_0x3b1473['connection'][_0x76bb('0x2a')]||_0x3b1473[_0x76bb('0x2b')][_0x76bb('0x2a')]||_0x3b1473[_0x76bb('0x2c')][_0x76bb('0x2b')][_0x76bb('0x2a')];return openIssue(_0x3b1473[_0x76bb('0x27')],_0x21e03f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4199245..db207cd 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 _0xb4e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3091b0,_0x1443a5){var _0x164963=function(_0x42c0dc){while(--_0x42c0dc){_0x3091b0['push'](_0x3091b0['shift']());}};_0x164963(++_0x1443a5);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xb4e6[_0x22c684];return _0x39fcbb;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x13')]);module[_0x6b4e('0x14')]=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x4d3d50,_0x50f156){var _0x175e6d=function(_0x41fc26){while(--_0x41fc26){_0x4d3d50['push'](_0x4d3d50['shift']());}};_0x175e6d(++_0x50f156);}(_0xa8a8,0xec));var _0x8a8a=function(_0x47baf4,_0x544659){_0x47baf4=_0x47baf4-0x0;var _0x16f6c1=_0xa8a8[_0x47baf4];return _0x16f6c1;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 22626d2..8962f80 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x4ed78a,_0x305ef9){_0x4ed78a=_0x4ed78a-0x0;var _0x5bd7ff=_0x7a54[_0x4ed78a];return _0x5bd7ff;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0xb1bb7a,_0xd5e86){_0xb1bb7a=_0xb1bb7a-0x0;var _0x21b11a=_0x7a54[_0xb1bb7a];return _0x21b11a;};'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 0dc6a62..7897230 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 _0xa786=['rows','catch','show','params','keys','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','destroy','then','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x1f4ca7,_0x72749b){var _0x1746a6=function(_0x33bb66){while(--_0x33bb66){_0x1f4ca7['push'](_0x1f4ca7['shift']());}};_0x1746a6(++_0x72749b);}(_0xa786,0x1d2));var _0x6a78=function(_0x2c59ef,_0x5d2e36){_0x2c59ef=_0x2c59ef-0x0;var _0x3e3f2d=_0xa786[_0x2c59ef];return _0x3e3f2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a78('0x0'));var jsonpatch=require(_0x6a78('0x1'));var rp=require(_0x6a78('0x2'));var moment=require(_0x6a78('0x3'));var BPromise=require(_0x6a78('0x4'));var Mustache=require(_0x6a78('0x5'));var util=require(_0x6a78('0x6'));var path=require('path');var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var authService=require(_0x6a78('0x13'));var qs=require(_0x6a78('0x14'));var as=require(_0x6a78('0x15'));var hardwareService=require(_0x6a78('0x16'));var logger=require(_0x6a78('0x17'))(_0x6a78('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a78('0x19'));var db=require(_0x6a78('0x1a'))['db'];function respondWithStatusCode(_0x4f8b72,_0x20fd59){_0x20fd59=_0x20fd59||0xcc;return function(_0x35b334){if(_0x35b334){return _0x4f8b72[_0x6a78('0x1b')](_0x20fd59);}return _0x4f8b72[_0x6a78('0x1c')](_0x20fd59)[_0x6a78('0x1d')]();};}function respondWithResult(_0xfca4fe,_0x9df26e){_0x9df26e=_0x9df26e||0xc8;return function(_0x5ac964){if(_0x5ac964){return _0xfca4fe['status'](_0x9df26e)['json'](_0x5ac964);}};}function respondWithFilteredResult(_0x36114f,_0x2deaa9){return function(_0xe2cf95){if(_0xe2cf95){var _0x535dc8=typeof _0x2deaa9[_0x6a78('0x1e')]===_0x6a78('0x1f')&&typeof _0x2deaa9['limit']===_0x6a78('0x1f');var _0x136df2=_0xe2cf95[_0x6a78('0x20')];var _0x44f646=_0x535dc8?0x0:_0x2deaa9[_0x6a78('0x1e')];var _0xe0e5e6=_0x535dc8?_0xe2cf95[_0x6a78('0x20')]:_0x2deaa9[_0x6a78('0x1e')]+_0x2deaa9['limit'];var _0x2d6ef3;if(_0xe0e5e6>=_0x136df2){_0xe0e5e6=_0x136df2;_0x2d6ef3=0xc8;}else{_0x2d6ef3=0xce;}_0x36114f['status'](_0x2d6ef3);return _0x36114f[_0x6a78('0x21')](_0x6a78('0x22'),_0x44f646+'-'+_0xe0e5e6+'/'+_0x136df2)[_0x6a78('0x23')](_0xe2cf95);}return null;};}function patchUpdates(_0x5d135e){return function(_0x3e0dfc){try{jsonpatch['apply'](_0x3e0dfc,_0x5d135e,!![]);}catch(_0x184637){return BPromise['reject'](_0x184637);}return _0x3e0dfc[_0x6a78('0x24')]();};}function saveUpdates(_0x49eb18,_0x598cde){return function(_0x4fbf83){if(_0x4fbf83){return _0x4fbf83['update'](_0x49eb18)['then'](function(_0x3b7bea){return _0x3b7bea;});}return null;};}function removeEntity(_0x3d96a2,_0x677af6){return function(_0x590657){if(_0x590657){return _0x590657[_0x6a78('0x25')]()[_0x6a78('0x26')](function(){_0x3d96a2[_0x6a78('0x1c')](0xcc)[_0x6a78('0x1d')]();});}};}function handleEntityNotFound(_0x56b7c2,_0xa401cb){return function(_0x5ba74f){if(!_0x5ba74f){_0x56b7c2[_0x6a78('0x1b')](0x194);}return _0x5ba74f;};}function handleError(_0x14a3c6,_0x8e8513){_0x8e8513=_0x8e8513||0x1f4;return function(_0x20db54){logger['error'](_0x20db54[_0x6a78('0x27')]);if(_0x20db54[_0x6a78('0x28')]){delete _0x20db54['name'];}_0x14a3c6[_0x6a78('0x1c')](_0x8e8513)['send'](_0x20db54);};}exports[_0x6a78('0x29')]=function(_0x48c692,_0x20a593){var _0x195978={},_0x573903={},_0x31ca28={'count':0x0,'rows':[]};var _0x231f1a=_['map'](db[_0x6a78('0x2a')][_0x6a78('0x2b')],function(_0x5abf0b){return{'name':_0x5abf0b[_0x6a78('0x2c')],'type':_0x5abf0b[_0x6a78('0x2d')][_0x6a78('0x2e')]};});_0x573903[_0x6a78('0x2f')]=_[_0x6a78('0x30')](_0x231f1a,_0x6a78('0x28'));_0x573903[_0x6a78('0x31')]=_['keys'](_0x48c692[_0x6a78('0x31')]);_0x573903[_0x6a78('0x32')]=_['intersection'](_0x573903[_0x6a78('0x2f')],_0x573903['query']);_0x195978[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x573903['model'],qs[_0x6a78('0x35')](_0x48c692[_0x6a78('0x31')]['fields']));_0x195978[_0x6a78('0x33')]=_0x195978['attributes'][_0x6a78('0x36')]?_0x195978[_0x6a78('0x33')]:_0x573903['model'];if(!_0x48c692['query'][_0x6a78('0x37')](_0x6a78('0x38'))){_0x195978[_0x6a78('0x39')]=qs[_0x6a78('0x39')](_0x48c692['query']['limit']);_0x195978[_0x6a78('0x1e')]=qs['offset'](_0x48c692[_0x6a78('0x31')][_0x6a78('0x1e')]);}_0x195978['order']=qs[_0x6a78('0x3a')](_0x48c692['query'][_0x6a78('0x3a')]);_0x195978[_0x6a78('0x3b')]=qs['filters'](_[_0x6a78('0x3c')](_0x48c692['query'],_0x573903[_0x6a78('0x32')]),_0x231f1a);if(_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]){_0x195978[_0x6a78('0x3b')]=_[_0x6a78('0x3e')](_0x195978[_0x6a78('0x3b')],{'$or':_[_0x6a78('0x30')](_0x231f1a,function(_0x24c9ac){if(_0x24c9ac[_0x6a78('0x2d')]!=='VIRTUAL'){var _0x2ede51={};_0x2ede51[_0x24c9ac[_0x6a78('0x28')]]={'$like':'%'+_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]+'%'};return _0x2ede51;}})});}_0x195978=_[_0x6a78('0x3e')]({},_0x195978,_0x48c692[_0x6a78('0x3f')]);var _0x403a67={'where':_0x195978[_0x6a78('0x3b')]};return db[_0x6a78('0x2a')][_0x6a78('0x20')](_0x403a67)[_0x6a78('0x26')](function(_0x4d3ad7){_0x31ca28[_0x6a78('0x20')]=_0x4d3ad7;if(_0x48c692['query'][_0x6a78('0x40')]){_0x195978[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x2a')]['findAll'](_0x195978);})[_0x6a78('0x26')](function(_0x2ec0f9){_0x31ca28[_0x6a78('0x42')]=_0x2ec0f9;return _0x31ca28;})[_0x6a78('0x26')](respondWithFilteredResult(_0x20a593,_0x195978))[_0x6a78('0x43')](handleError(_0x20a593,null));};exports[_0x6a78('0x44')]=function(_0x1e6efd,_0x415481){var _0x3146f8={'raw':!![],'where':{'id':_0x1e6efd[_0x6a78('0x45')]['id']}},_0x27221d={};_0x27221d[_0x6a78('0x2f')]=_[_0x6a78('0x46')](db[_0x6a78('0x2a')][_0x6a78('0x2b')]);_0x27221d['query']=_[_0x6a78('0x46')](_0x1e6efd[_0x6a78('0x31')]);_0x27221d[_0x6a78('0x32')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],_0x27221d[_0x6a78('0x31')]);_0x3146f8[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],qs['fields'](_0x1e6efd[_0x6a78('0x31')][_0x6a78('0x35')]));_0x3146f8['attributes']=_0x3146f8[_0x6a78('0x33')][_0x6a78('0x36')]?_0x3146f8[_0x6a78('0x33')]:_0x27221d[_0x6a78('0x2f')];if(_0x1e6efd[_0x6a78('0x31')]['includeAll']){_0x3146f8[_0x6a78('0x41')]=[{'all':!![]}];}_0x3146f8=_['merge']({},_0x3146f8,_0x1e6efd[_0x6a78('0x3f')]);return db[_0x6a78('0x2a')][_0x6a78('0x47')](_0x3146f8)[_0x6a78('0x26')](handleEntityNotFound(_0x415481,null))[_0x6a78('0x26')](respondWithResult(_0x415481,null))[_0x6a78('0x43')](handleError(_0x415481,null));};exports[_0x6a78('0x48')]=function(_0x1f35e0,_0xede538){return db[_0x6a78('0x2a')][_0x6a78('0x48')](_0x1f35e0['body'],{})[_0x6a78('0x26')](respondWithResult(_0xede538,0xc9))[_0x6a78('0x43')](handleError(_0xede538,null));};exports[_0x6a78('0x49')]=function(_0x5a64e0,_0x4400f1){if(_0x5a64e0[_0x6a78('0x4a')]['id']){delete _0x5a64e0[_0x6a78('0x4a')]['id'];}return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x5a64e0[_0x6a78('0x45')]['id']}})['then'](handleEntityNotFound(_0x4400f1,null))['then'](saveUpdates(_0x5a64e0['body'],null))[_0x6a78('0x26')](respondWithResult(_0x4400f1,null))[_0x6a78('0x43')](handleError(_0x4400f1,null));};exports[_0x6a78('0x25')]=function(_0x253376,_0x2bcb06){return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x253376[_0x6a78('0x45')]['id']}})[_0x6a78('0x26')](handleEntityNotFound(_0x2bcb06,null))[_0x6a78('0x26')](removeEntity(_0x2bcb06,null))[_0x6a78('0x43')](handleError(_0x2bcb06,null));};exports[_0x6a78('0x4b')]=function(_0x9b1b2,_0x326e59){return db[_0x6a78('0x2a')][_0x6a78('0x4b')]()[_0x6a78('0x26')](respondWithResult(_0x326e59,null))['catch'](handleError(_0x326e59,null));}; \ No newline at end of file +var _0x0a6b=['destroy','then','error','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','describe','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4a0fc8,_0x1819f3){_0x4a0fc8=_0x4a0fc8-0x0;var _0x46403b=_0x0a6b[_0x4a0fc8];return _0x46403b;};'use strict';var emlformat=require(_0xb0a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a6('0x1'));var moment=require('moment');var BPromise=require(_0xb0a6('0x2'));var Mustache=require(_0xb0a6('0x3'));var util=require(_0xb0a6('0x4'));var path=require('path');var sox=require(_0xb0a6('0x5'));var csv=require('to-csv');var ejs=require(_0xb0a6('0x6'));var fs=require('fs');var fs_extra=require(_0xb0a6('0x7'));var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var licenseUtil=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];function respondWithStatusCode(_0x471d0f,_0x3e06df){_0x3e06df=_0x3e06df||0xcc;return function(_0x3d607f){if(_0x3d607f){return _0x471d0f[_0xb0a6('0x15')](_0x3e06df);}return _0x471d0f[_0xb0a6('0x16')](_0x3e06df)[_0xb0a6('0x17')]();};}function respondWithResult(_0x513853,_0x2b801a){_0x2b801a=_0x2b801a||0xc8;return function(_0x54016c){if(_0x54016c){return _0x513853[_0xb0a6('0x16')](_0x2b801a)['json'](_0x54016c);}};}function respondWithFilteredResult(_0x25582f,_0x59730e){return function(_0x1d837f){if(_0x1d837f){var _0x382c2f=typeof _0x59730e[_0xb0a6('0x18')]==='undefined'&&typeof _0x59730e['limit']===_0xb0a6('0x19');var _0x295b53=_0x1d837f[_0xb0a6('0x1a')];var _0x18f994=_0x382c2f?0x0:_0x59730e[_0xb0a6('0x18')];var _0x13a1c8=_0x382c2f?_0x1d837f['count']:_0x59730e[_0xb0a6('0x18')]+_0x59730e[_0xb0a6('0x1b')];var _0x372457;if(_0x13a1c8>=_0x295b53){_0x13a1c8=_0x295b53;_0x372457=0xc8;}else{_0x372457=0xce;}_0x25582f[_0xb0a6('0x16')](_0x372457);return _0x25582f[_0xb0a6('0x1c')](_0xb0a6('0x1d'),_0x18f994+'-'+_0x13a1c8+'/'+_0x295b53)['json'](_0x1d837f);}return null;};}function patchUpdates(_0x2fb60a){return function(_0x6d2003){try{jsonpatch[_0xb0a6('0x1e')](_0x6d2003,_0x2fb60a,!![]);}catch(_0x6bdcc1){return BPromise[_0xb0a6('0x1f')](_0x6bdcc1);}return _0x6d2003[_0xb0a6('0x20')]();};}function saveUpdates(_0x27db00,_0x16e053){return function(_0x4b9a6c){if(_0x4b9a6c){return _0x4b9a6c[_0xb0a6('0x21')](_0x27db00)['then'](function(_0x1322ec){return _0x1322ec;});}return null;};}function removeEntity(_0x2f1e97,_0x4997df){return function(_0x4aa68d){if(_0x4aa68d){return _0x4aa68d[_0xb0a6('0x22')]()[_0xb0a6('0x23')](function(){_0x2f1e97['status'](0xcc)[_0xb0a6('0x17')]();});}};}function handleEntityNotFound(_0x24574a,_0x259f47){return function(_0x5b19c1){if(!_0x5b19c1){_0x24574a['sendStatus'](0x194);}return _0x5b19c1;};}function handleError(_0x5e2a7c,_0x43adfa){_0x43adfa=_0x43adfa||0x1f4;return function(_0x1e9947){logger[_0xb0a6('0x24')](_0x1e9947['stack']);if(_0x1e9947[_0xb0a6('0x25')]){delete _0x1e9947[_0xb0a6('0x25')];}_0x5e2a7c[_0xb0a6('0x16')](_0x43adfa)[_0xb0a6('0x26')](_0x1e9947);};}exports[_0xb0a6('0x27')]=function(_0x3aef2b,_0x94d47f){var _0x305661={},_0x4255b9={},_0x4ced9f={'count':0x0,'rows':[]};var _0x12d683=_[_0xb0a6('0x28')](db[_0xb0a6('0x29')]['rawAttributes'],function(_0x31c332){return{'name':_0x31c332['fieldName'],'type':_0x31c332[_0xb0a6('0x2a')][_0xb0a6('0x2b')]};});_0x4255b9[_0xb0a6('0x2c')]=_[_0xb0a6('0x28')](_0x12d683,_0xb0a6('0x25'));_0x4255b9[_0xb0a6('0x2d')]=_[_0xb0a6('0x2e')](_0x3aef2b[_0xb0a6('0x2d')]);_0x4255b9[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x4255b9['model'],_0x4255b9['query']);_0x305661[_0xb0a6('0x31')]=_[_0xb0a6('0x30')](_0x4255b9[_0xb0a6('0x2c')],qs[_0xb0a6('0x32')](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x32')]));_0x305661[_0xb0a6('0x31')]=_0x305661[_0xb0a6('0x31')]['length']?_0x305661[_0xb0a6('0x31')]:_0x4255b9[_0xb0a6('0x2c')];if(!_0x3aef2b['query'][_0xb0a6('0x33')](_0xb0a6('0x34'))){_0x305661['limit']=qs['limit'](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x1b')]);_0x305661[_0xb0a6('0x18')]=qs[_0xb0a6('0x18')](_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x18')]);}_0x305661['order']=qs[_0xb0a6('0x35')](_0x3aef2b['query'][_0xb0a6('0x35')]);_0x305661[_0xb0a6('0x36')]=qs['filters'](_['pick'](_0x3aef2b['query'],_0x4255b9[_0xb0a6('0x2f')]),_0x12d683);if(_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x37')]){_0x305661[_0xb0a6('0x36')]=_[_0xb0a6('0x38')](_0x305661['where'],{'$or':_[_0xb0a6('0x28')](_0x12d683,function(_0x3696d9){if(_0x3696d9[_0xb0a6('0x2a')]!==_0xb0a6('0x39')){var _0x4ab405={};_0x4ab405[_0x3696d9[_0xb0a6('0x25')]]={'$like':'%'+_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x37')]+'%'};return _0x4ab405;}})});}_0x305661=_[_0xb0a6('0x38')]({},_0x305661,_0x3aef2b[_0xb0a6('0x3a')]);var _0x5d5df6={'where':_0x305661['where']};return db[_0xb0a6('0x29')][_0xb0a6('0x1a')](_0x5d5df6)[_0xb0a6('0x23')](function(_0x253488){_0x4ced9f[_0xb0a6('0x1a')]=_0x253488;if(_0x3aef2b[_0xb0a6('0x2d')][_0xb0a6('0x3b')]){_0x305661[_0xb0a6('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb0a6('0x3d')](_0x305661);})[_0xb0a6('0x23')](function(_0x381067){_0x4ced9f[_0xb0a6('0x3e')]=_0x381067;return _0x4ced9f;})[_0xb0a6('0x23')](respondWithFilteredResult(_0x94d47f,_0x305661))['catch'](handleError(_0x94d47f,null));};exports[_0xb0a6('0x3f')]=function(_0x50e5b1,_0xaf5ef8){var _0x53a6d5={'raw':!![],'where':{'id':_0x50e5b1['params']['id']}},_0x144683={};_0x144683[_0xb0a6('0x2c')]=_[_0xb0a6('0x2e')](db[_0xb0a6('0x29')][_0xb0a6('0x40')]);_0x144683[_0xb0a6('0x2d')]=_[_0xb0a6('0x2e')](_0x50e5b1[_0xb0a6('0x2d')]);_0x144683[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x144683[_0xb0a6('0x2c')],_0x144683[_0xb0a6('0x2d')]);_0x53a6d5[_0xb0a6('0x31')]=_['intersection'](_0x144683[_0xb0a6('0x2c')],qs[_0xb0a6('0x32')](_0x50e5b1['query'][_0xb0a6('0x32')]));_0x53a6d5['attributes']=_0x53a6d5[_0xb0a6('0x31')][_0xb0a6('0x41')]?_0x53a6d5[_0xb0a6('0x31')]:_0x144683['model'];if(_0x50e5b1[_0xb0a6('0x2d')][_0xb0a6('0x3b')]){_0x53a6d5[_0xb0a6('0x3c')]=[{'all':!![]}];}_0x53a6d5=_[_0xb0a6('0x38')]({},_0x53a6d5,_0x50e5b1[_0xb0a6('0x3a')]);return db[_0xb0a6('0x29')][_0xb0a6('0x42')](_0x53a6d5)[_0xb0a6('0x23')](handleEntityNotFound(_0xaf5ef8,null))['then'](respondWithResult(_0xaf5ef8,null))[_0xb0a6('0x43')](handleError(_0xaf5ef8,null));};exports[_0xb0a6('0x44')]=function(_0x47645a,_0x448197){return db['JscriptyAnswerReport']['create'](_0x47645a['body'],{})['then'](respondWithResult(_0x448197,0xc9))['catch'](handleError(_0x448197,null));};exports['update']=function(_0x512539,_0xafbe9d){if(_0x512539[_0xb0a6('0x45')]['id']){delete _0x512539[_0xb0a6('0x45')]['id'];}return db[_0xb0a6('0x29')][_0xb0a6('0x42')]({'where':{'id':_0x512539[_0xb0a6('0x46')]['id']}})[_0xb0a6('0x23')](handleEntityNotFound(_0xafbe9d,null))[_0xb0a6('0x23')](saveUpdates(_0x512539[_0xb0a6('0x45')],null))[_0xb0a6('0x23')](respondWithResult(_0xafbe9d,null))[_0xb0a6('0x43')](handleError(_0xafbe9d,null));};exports[_0xb0a6('0x22')]=function(_0x4dc961,_0x42fff4){return db[_0xb0a6('0x29')][_0xb0a6('0x42')]({'where':{'id':_0x4dc961['params']['id']}})[_0xb0a6('0x23')](handleEntityNotFound(_0x42fff4,null))[_0xb0a6('0x23')](removeEntity(_0x42fff4,null))[_0xb0a6('0x43')](handleError(_0x42fff4,null));};exports[_0xb0a6('0x47')]=function(_0x23cf46,_0x907ece){return db[_0xb0a6('0x29')][_0xb0a6('0x47')]()[_0xb0a6('0x23')](respondWithResult(_0x907ece,null))['catch'](handleError(_0x907ece,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f3cd4d6..bdf0139 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 _0xf36c=['JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x411c71,_0x236b53){var _0x527085=function(_0x243ce0){while(--_0x243ce0){_0x411c71['push'](_0x411c71['shift']());}};_0x527085(++_0x236b53);}(_0xf36c,0x120));var _0xcf36=function(_0x2b0130,_0x7ad0d6){_0x2b0130=_0x2b0130-0x0;var _0x2b0178=_0xf36c[_0x2b0130];return _0x2b0178;};'use strict';var _=require('lodash');var util=require(_0xcf36('0x0'));var logger=require('../../config/logger')(_0xcf36('0x1'));var moment=require(_0xcf36('0x2'));var BPromise=require(_0xcf36('0x3'));var rp=require(_0xcf36('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf36('0x5'));var config=require(_0xcf36('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xcf36('0x7')]=function(_0x407443,_0x430979){return _0x407443[_0xcf36('0x8')](_0xcf36('0x9'),attributes,{'tableName':_0xcf36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40fb=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x321798,_0x57d968){var _0x2a5c00=function(_0x532a2b){while(--_0x532a2b){_0x321798['push'](_0x321798['shift']());}};_0x2a5c00(++_0x57d968);}(_0x40fb,0x1de));var _0xb40f=function(_0x2145c0,_0x549319){_0x2145c0=_0x2145c0-0x0;var _0x4c613a=_0x40fb[_0x2145c0];return _0x4c613a;};'use strict';var _=require(_0xb40f('0x0'));var util=require(_0xb40f('0x1'));var logger=require('../../config/logger')(_0xb40f('0x2'));var moment=require(_0xb40f('0x3'));var BPromise=require(_0xb40f('0x4'));var rp=require(_0xb40f('0x5'));var fs=require('fs');var path=require(_0xb40f('0x6'));var rimraf=require(_0xb40f('0x7'));var config=require(_0xb40f('0x8'));var attributes=require(_0xb40f('0x9'));module[_0xb40f('0xa')]=function(_0x222fc6,_0x204acb){return _0x222fc6[_0xb40f('0xb')](_0xb40f('0xc'),attributes,{'tableName':_0xb40f('0xd'),'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 00277de..e7342e1 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 _0xc0f2=['jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x436afa,_0x5a19f3){var _0x459a04=function(_0xcaca26){while(--_0xcaca26){_0x436afa['push'](_0x436afa['shift']());}};_0x459a04(++_0x5a19f3);}(_0xc0f2,0xca));var _0x2c0f=function(_0x59f0e6,_0x34c343){_0x59f0e6=_0x59f0e6-0x0;var _0x5cab69=_0xc0f2[_0x59f0e6];return _0x5cab69;};'use strict';var _=require(_0x2c0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c0f('0x1'));var rs=require(_0x2c0f('0x2'));var fs=require('fs');var Redis=require(_0x2c0f('0x3'));var db=require(_0x2c0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0f('0x5'))(_0x2c0f('0x6'));var config=require(_0x2c0f('0x7'));var jayson=require(_0x2c0f('0x8'));var client=jayson[_0x2c0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa689,_0xecf6cf,_0x2d6166){return new BPromise(function(_0x6350f1,_0x566c30){return client[_0x2c0f('0xa')](_0x5aa689,_0x2d6166)[_0x2c0f('0xb')](function(_0x3111f9){logger['info'](_0x2c0f('0xc'),_0xecf6cf,_0x2c0f('0xd'));logger['debug'](_0x2c0f('0xe'),_0xecf6cf,_0x2c0f('0xd'),JSON[_0x2c0f('0xf')](_0x3111f9));if(_0x3111f9[_0x2c0f('0x10')]){if(_0x3111f9[_0x2c0f('0x10')]['code']===0x1f4){logger[_0x2c0f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xecf6cf,_0x3111f9['error'][_0x2c0f('0x11')]);return _0x566c30(_0x3111f9[_0x2c0f('0x10')][_0x2c0f('0x11')]);}logger[_0x2c0f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xecf6cf,_0x3111f9[_0x2c0f('0x10')]['message']);return _0x6350f1(_0x3111f9[_0x2c0f('0x10')][_0x2c0f('0x11')]);}else{logger[_0x2c0f('0x12')](_0x2c0f('0xc'),_0xecf6cf,_0x2c0f('0xd'));_0x6350f1(_0x3111f9[_0x2c0f('0x13')][_0x2c0f('0x11')]);}})[_0x2c0f('0x14')](function(_0x4b420a){logger[_0x2c0f('0x10')](_0x2c0f('0xc'),_0xecf6cf,_0x4b420a);_0x566c30(_0x4b420a);});});} \ No newline at end of file +var _0x3720=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x3720,0xe9));var _0x0372=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x3720[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0372('0x0'));var util=require(_0x0372('0x1'));var moment=require(_0x0372('0x2'));var BPromise=require(_0x0372('0x3'));var rs=require(_0x0372('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0372('0x5'))['db'];var utils=require(_0x0372('0x6'));var logger=require('../../config/logger')(_0x0372('0x7'));var config=require(_0x0372('0x8'));var jayson=require(_0x0372('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x67ac05,_0x4dbb34,_0x557c41){return new BPromise(function(_0x12ed39,_0x416ffe){return client['request'](_0x67ac05,_0x557c41)[_0x0372('0xa')](function(_0x30ac64){logger[_0x0372('0xb')](_0x0372('0xc'),_0x4dbb34,'request\x20sent');logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4dbb34,_0x0372('0xd'),JSON[_0x0372('0xe')](_0x30ac64));if(_0x30ac64[_0x0372('0xf')]){if(_0x30ac64[_0x0372('0xf')][_0x0372('0x10')]===0x1f4){logger[_0x0372('0xf')](_0x0372('0xc'),_0x4dbb34,_0x30ac64[_0x0372('0xf')][_0x0372('0x11')]);return _0x416ffe(_0x30ac64[_0x0372('0xf')][_0x0372('0x11')]);}logger[_0x0372('0xf')](_0x0372('0xc'),_0x4dbb34,_0x30ac64['error'][_0x0372('0x11')]);return _0x12ed39(_0x30ac64[_0x0372('0xf')][_0x0372('0x11')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4dbb34,_0x0372('0xd'));_0x12ed39(_0x30ac64['result'][_0x0372('0x11')]);}})[_0x0372('0x12')](function(_0xcd0780){logger[_0x0372('0xf')](_0x0372('0xc'),_0x4dbb34,_0xcd0780);_0x416ffe(_0xcd0780);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index aa7c8a7..c15467e 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 _0x082b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','put','update','delete','destroy','exports','util'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0x082b,0x86));var _0xb082=function(_0x83d08e,_0x228942){_0x83d08e=_0x83d08e-0x0;var _0x404d4f=_0x082b[_0x83d08e];return _0x404d4f;};'use strict';var multer=require('multer');var util=require(_0xb082('0x0'));var path=require('path');var timeout=require(_0xb082('0x1'));var express=require(_0xb082('0x2'));var router=express[_0xb082('0x3')]();var fs_extra=require(_0xb082('0x4'));var auth=require(_0xb082('0x5'));var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require(_0xb082('0x8'));router[_0xb082('0x9')]('/',auth[_0xb082('0xa')](),controller[_0xb082('0xb')]);router['get'](_0xb082('0xc'),auth[_0xb082('0xa')](),controller['show']);router[_0xb082('0x9')](_0xb082('0xd'),auth[_0xb082('0xa')](),controller[_0xb082('0xe')]);router[_0xb082('0x9')](_0xb082('0xf'),auth[_0xb082('0xa')](),controller[_0xb082('0x10')]);router['get'](_0xb082('0x11'),auth[_0xb082('0xa')](),timeout('30s'),controller[_0xb082('0x12')]);router[_0xb082('0x13')]('/',auth[_0xb082('0xa')](),controller[_0xb082('0x14')]);router[_0xb082('0x13')]('/:id/clone',auth[_0xb082('0xa')](),controller[_0xb082('0x15')]);router[_0xb082('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb082('0x17')]);router[_0xb082('0x18')](_0xb082('0xc'),auth[_0xb082('0xa')](),controller[_0xb082('0x19')]);module[_0xb082('0x1a')]=router; \ No newline at end of file +var _0xa7de=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ac992,_0x37c877){var _0x223c9d=function(_0x2d4865){while(--_0x2d4865){_0x2ac992['push'](_0x2ac992['shift']());}};_0x223c9d(++_0x37c877);}(_0xa7de,0x1d5));var _0xea7d=function(_0x5b3604,_0x5441d7){_0x5b3604=_0x5b3604-0x0;var _0x2a18cd=_0xa7de[_0x5b3604];return _0x2a18cd;};'use strict';var multer=require('multer');var util=require(_0xea7d('0x0'));var path=require('path');var timeout=require(_0xea7d('0x1'));var express=require(_0xea7d('0x2'));var router=express[_0xea7d('0x3')]();var fs_extra=require(_0xea7d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xea7d('0x5'));router[_0xea7d('0x6')]('/',auth[_0xea7d('0x7')](),controller[_0xea7d('0x8')]);router['get'](_0xea7d('0x9'),auth[_0xea7d('0x7')](),controller[_0xea7d('0xa')]);router[_0xea7d('0x6')]('/:id/sessions',auth[_0xea7d('0x7')](),controller['getSessions']);router[_0xea7d('0x6')](_0xea7d('0xb'),auth[_0xea7d('0x7')](),controller[_0xea7d('0xc')]);router[_0xea7d('0x6')](_0xea7d('0xd'),auth[_0xea7d('0x7')](),timeout(_0xea7d('0xe')),controller[_0xea7d('0xf')]);router[_0xea7d('0x10')]('/',auth[_0xea7d('0x7')](),controller[_0xea7d('0x11')]);router[_0xea7d('0x10')](_0xea7d('0x12'),auth[_0xea7d('0x7')](),controller['clone']);router[_0xea7d('0x13')](_0xea7d('0x9'),auth[_0xea7d('0x7')](),controller[_0xea7d('0x14')]);router[_0xea7d('0x15')](_0xea7d('0x9'),auth[_0xea7d('0x7')](),controller[_0xea7d('0x16')]);module[_0xea7d('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index b29605a..f589d0e 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 _0xa526=['exports','STRING','name','TEXT','long','isObjectLike','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xa526,0x6f));var _0x6a52=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0xa526[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x6a52('0x0'));module[_0x6a52('0x1')]={'name':{'type':Sequelize[_0x6a52('0x2')],'unique':_0x6a52('0x3')},'description':{'type':Sequelize[_0x6a52('0x2')]},'formData':{'type':Sequelize[_0x6a52('0x4')](_0x6a52('0x5')),'set':function(_0x379096){if(_[_0x6a52('0x6')](_0x379096)){this['setDataValue'](_0x6a52('0x7'),JSON['stringify'](_0x379096));}else if(_['isString'](_0x379096)){this[_0x6a52('0x8')](_0x6a52('0x7'),_0x379096);}else{this[_0x6a52('0x8')](_0x6a52('0x7'),util[_0x6a52('0x9')](_0x6a52('0xa'),this[_0x6a52('0xb')]('name')||'',this['getDataValue'](_0x6a52('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6a52('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1ffe=['lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x9dc953,_0xc40609){var _0x33e6f9=function(_0x271052){while(--_0x271052){_0x9dc953['push'](_0x9dc953['shift']());}};_0x33e6f9(++_0xc40609);}(_0x1ffe,0xd0));var _0xe1ff=function(_0xd26128,_0x34ef84){_0xd26128=_0xd26128-0x0;var _0x4b492f=_0x1ffe[_0xd26128];return _0x4b492f;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe1ff('0x0'));var util=require('util');module[_0xe1ff('0x1')]={'name':{'type':Sequelize[_0xe1ff('0x2')],'unique':_0xe1ff('0x3')},'description':{'type':Sequelize[_0xe1ff('0x2')]},'formData':{'type':Sequelize[_0xe1ff('0x4')](_0xe1ff('0x5')),'set':function(_0x5a6484){if(_[_0xe1ff('0x6')](_0x5a6484)){this[_0xe1ff('0x7')](_0xe1ff('0x8'),JSON[_0xe1ff('0x9')](_0x5a6484));}else if(_[_0xe1ff('0xa')](_0x5a6484)){this['setDataValue'](_0xe1ff('0x8'),_0x5a6484);}else{this[_0xe1ff('0x7')](_0xe1ff('0x8'),util[_0xe1ff('0xb')](_0xe1ff('0xc'),this['getDataValue']('name')||'',this[_0xe1ff('0xd')](_0xe1ff('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe1ff('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe1ff('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 99d4b6f..0308dd7 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 _0x3d5d=['eml-format','zip-dir','fast-json-patch','bluebird','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','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','map','JscriptyProject','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','include','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','order','options','findAll','JscriptyAnswerReport','ProjectId','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x3d5d,0xe2));var _0xd3d5=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x3d5d[_0x290694];return _0x5a0f2e;};'use strict';var emlformat=require(_0xd3d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3d5('0x1'));var jsonpatch=require(_0xd3d5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3d5('0x3'));var Mustache=require(_0xd3d5('0x4'));var util=require(_0xd3d5('0x5'));var path=require(_0xd3d5('0x6'));var sox=require(_0xd3d5('0x7'));var csv=require(_0xd3d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3d5('0x9'));var _=require(_0xd3d5('0xa'));var squel=require(_0xd3d5('0xb'));var crypto=require(_0xd3d5('0xc'));var jsforce=require(_0xd3d5('0xd'));var deskjs=require(_0xd3d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd3d5('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3d5('0x10'));var authService=require(_0xd3d5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd3d5('0x12'));var hardwareService=require(_0xd3d5('0x13'));var logger=require('../../config/logger')(_0xd3d5('0x14'));var utils=require(_0xd3d5('0x15'));var config=require(_0xd3d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x378061,_0x3ad93d){_0x3ad93d=_0x3ad93d||0xcc;return function(_0x55d2fc){if(_0x55d2fc){return _0x378061[_0xd3d5('0x17')](_0x3ad93d);}return _0x378061['status'](_0x3ad93d)[_0xd3d5('0x18')]();};}function respondWithResult(_0x33baa3,_0x388bf0){_0x388bf0=_0x388bf0||0xc8;return function(_0x5a3eba){if(_0x5a3eba){return _0x33baa3['status'](_0x388bf0)[_0xd3d5('0x19')](_0x5a3eba);}};}function respondWithFilteredResult(_0x3a6c26,_0x4d5427){return function(_0x346310){if(_0x346310){var _0x5dfbe7=typeof _0x4d5427[_0xd3d5('0x1a')]===_0xd3d5('0x1b')&&typeof _0x4d5427[_0xd3d5('0x1c')]==='undefined';var _0x129188=_0x346310[_0xd3d5('0x1d')];var _0x4aa945=_0x5dfbe7?0x0:_0x4d5427[_0xd3d5('0x1a')];var _0x554608=_0x5dfbe7?_0x346310[_0xd3d5('0x1d')]:_0x4d5427[_0xd3d5('0x1a')]+_0x4d5427[_0xd3d5('0x1c')];var _0xba96eb;if(_0x554608>=_0x129188){_0x554608=_0x129188;_0xba96eb=0xc8;}else{_0xba96eb=0xce;}_0x3a6c26[_0xd3d5('0x1e')](_0xba96eb);return _0x3a6c26[_0xd3d5('0x1f')]('Content-Range',_0x4aa945+'-'+_0x554608+'/'+_0x129188)[_0xd3d5('0x19')](_0x346310);}return null;};}function patchUpdates(_0x4893f6){return function(_0x88c6fb){try{jsonpatch[_0xd3d5('0x20')](_0x88c6fb,_0x4893f6,!![]);}catch(_0xb6a42b){return BPromise[_0xd3d5('0x21')](_0xb6a42b);}return _0x88c6fb[_0xd3d5('0x22')]();};}function saveUpdates(_0x3d2a3a,_0x1936f5){return function(_0x313c88){if(_0x313c88){return _0x313c88[_0xd3d5('0x23')](_0x3d2a3a)[_0xd3d5('0x24')](function(_0x4ea31b){return _0x4ea31b;});}return null;};}function removeEntity(_0x1a8301,_0x376014){return function(_0x529f39){if(_0x529f39){return _0x529f39[_0xd3d5('0x25')]()[_0xd3d5('0x24')](function(){var _0x1ac545=_0x529f39[_0xd3d5('0x26')]({'plain':!![]});var _0x144525=_0xd3d5('0x27');return db['UserProfileResource'][_0xd3d5('0x25')]({'where':{'type':_0x144525,'resourceId':_0x1ac545['id']}})['then'](function(){return _0x529f39;});})[_0xd3d5('0x24')](function(){_0x1a8301[_0xd3d5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49270d,_0x16e2ce){return function(_0x3102f8){if(!_0x3102f8){_0x49270d[_0xd3d5('0x17')](0x194);}return _0x3102f8;};}function handleError(_0x2f58d3,_0x1f2314){_0x1f2314=_0x1f2314||0x1f4;return function(_0x41b882){logger[_0xd3d5('0x28')](_0x41b882[_0xd3d5('0x29')]);if(_0x41b882['name']){delete _0x41b882[_0xd3d5('0x2a')];}_0x2f58d3['status'](_0x1f2314)[_0xd3d5('0x2b')](_0x41b882);};}exports['index']=function(_0x22c5d2,_0x5923c4){var _0x126258={},_0x472d6c={},_0x26d43b={'count':0x0,'rows':[]};var _0x5f2335=_[_0xd3d5('0x2c')](db[_0xd3d5('0x2d')][_0xd3d5('0x2e')],function(_0x11a617){return{'name':_0x11a617['fieldName'],'type':_0x11a617[_0xd3d5('0x2f')]['key']};});_0x472d6c[_0xd3d5('0x30')]=_[_0xd3d5('0x2c')](_0x5f2335,_0xd3d5('0x2a'));_0x472d6c[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x22c5d2[_0xd3d5('0x31')]);_0x472d6c['filters']=_[_0xd3d5('0x33')](_0x472d6c[_0xd3d5('0x30')],_0x472d6c[_0xd3d5('0x31')]);_0x126258['attributes']=_[_0xd3d5('0x33')](_0x472d6c['model'],qs[_0xd3d5('0x34')](_0x22c5d2[_0xd3d5('0x31')]['fields']));_0x126258[_0xd3d5('0x35')]=_0x126258[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x126258[_0xd3d5('0x35')]:_0x472d6c[_0xd3d5('0x30')];if(!_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x126258['limit']=qs['limit'](_0x22c5d2['query'][_0xd3d5('0x1c')]);_0x126258[_0xd3d5('0x1a')]=qs[_0xd3d5('0x1a')](_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x1a')]);}_0x126258['order']=qs[_0xd3d5('0x39')](_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x126258[_0xd3d5('0x3a')]=qs[_0xd3d5('0x3b')](_[_0xd3d5('0x3c')](_0x22c5d2[_0xd3d5('0x31')],_0x472d6c[_0xd3d5('0x3b')]),_0x5f2335);if(_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x3d')]){_0x126258[_0xd3d5('0x3a')]=_['merge'](_0x126258[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x5f2335,function(_0x46909f){if(_0x46909f[_0xd3d5('0x2f')]!==_0xd3d5('0x3e')){var _0x2d37c6={};_0x2d37c6[_0x46909f[_0xd3d5('0x2a')]]={'$like':'%'+_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0x2d37c6;}})});}_0x126258=_[_0xd3d5('0x3f')]({},_0x126258,_0x22c5d2['options']);var _0x4ea37f={'where':_0x126258[_0xd3d5('0x3a')]};return db['JscriptyProject'][_0xd3d5('0x1d')](_0x4ea37f)[_0xd3d5('0x24')](function(_0x2be9d1){_0x26d43b['count']=_0x2be9d1;if(_0x22c5d2['query']['includeAll']){_0x126258[_0xd3d5('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x126258);})[_0xd3d5('0x24')](function(_0x45bddd){_0x26d43b[_0xd3d5('0x41')]=_0x45bddd;return _0x26d43b;})[_0xd3d5('0x24')](respondWithFilteredResult(_0x5923c4,_0x126258))[_0xd3d5('0x42')](handleError(_0x5923c4,null));};exports['show']=function(_0x454245,_0x30d6fa){var _0x51ac09={'raw':![],'where':{'id':_0x454245[_0xd3d5('0x43')]['id']}},_0xe1150f={};_0xe1150f[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x2d')][_0xd3d5('0x2e')]);_0xe1150f[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x454245[_0xd3d5('0x31')]);_0xe1150f['filters']=_[_0xd3d5('0x33')](_0xe1150f['model'],_0xe1150f['query']);_0x51ac09[_0xd3d5('0x35')]=_[_0xd3d5('0x33')](_0xe1150f['model'],qs[_0xd3d5('0x34')](_0x454245[_0xd3d5('0x31')]['fields']));_0x51ac09[_0xd3d5('0x35')]=_0x51ac09[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x51ac09[_0xd3d5('0x35')]:_0xe1150f[_0xd3d5('0x30')];if(_0x454245[_0xd3d5('0x31')][_0xd3d5('0x44')]){_0x51ac09[_0xd3d5('0x40')]=[{'all':!![]}];}_0x51ac09=_[_0xd3d5('0x3f')]({},_0x51ac09,_0x454245['options']);return db[_0xd3d5('0x2d')][_0xd3d5('0x45')](_0x51ac09)['then'](handleEntityNotFound(_0x30d6fa,null))[_0xd3d5('0x24')](respondWithResult(_0x30d6fa,null))['catch'](handleError(_0x30d6fa,null));};exports[_0xd3d5('0x46')]=function(_0x2b85d9,_0x3dd794){return db[_0xd3d5('0x2d')][_0xd3d5('0x46')](_0x2b85d9[_0xd3d5('0x47')],{})[_0xd3d5('0x24')](function(_0x31ab21){var _0x4e7489=_0x2b85d9['user'][_0xd3d5('0x26')]({'plain':!![]});if(!_0x4e7489)throw new Error(_0xd3d5('0x48'));if(_0x4e7489[_0xd3d5('0x49')]===_0xd3d5('0x4a')){var _0x218586=_0x31ab21[_0xd3d5('0x26')]({'plain':!![]});var _0x2d917a=_0xd3d5('0x27');return db[_0xd3d5('0x4b')][_0xd3d5('0x45')]({'where':{'name':_0x2d917a,'userProfileId':_0x4e7489[_0xd3d5('0x4c')]},'raw':!![]})[_0xd3d5('0x24')](function(_0xcf90b){if(_0xcf90b&&_0xcf90b[_0xd3d5('0x4d')]===0x0){return db[_0xd3d5('0x4e')][_0xd3d5('0x46')]({'name':_0x218586[_0xd3d5('0x2a')],'resourceId':_0x218586['id'],'type':_0xcf90b[_0xd3d5('0x2a')],'sectionId':_0xcf90b['id']},{})[_0xd3d5('0x24')](function(){return _0x31ab21;});}else{return _0x31ab21;}})[_0xd3d5('0x42')](function(_0x5d4514){logger[_0xd3d5('0x28')](_0xd3d5('0x4f'),_0x5d4514);throw _0x5d4514;});}return _0x31ab21;})[_0xd3d5('0x24')](respondWithResult(_0x3dd794,0xc9))['catch'](handleError(_0x3dd794,null));};exports[_0xd3d5('0x50')]=function(_0x406e5a,_0xef667b){var _0x1a2a45={'where':{'id':_0x406e5a['params']['id']}},_0x4d6157={};_0x4d6157[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x2d')]['rawAttributes']);_0x1a2a45[_0xd3d5('0x35')]=_['intersection'](_0x4d6157[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x34')]));_0x1a2a45[_0xd3d5('0x35')]=_0x1a2a45['attributes'][_0xd3d5('0x36')]?_0x1a2a45[_0xd3d5('0x35')]:_0x4d6157['model'];if(_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x44')]){_0x1a2a45[_0xd3d5('0x40')]=[{'all':!![]}];}_0x1a2a45=_['merge']({},_0x1a2a45,_0x406e5a['options']);return db[_0xd3d5('0x2d')]['find'](_0x1a2a45)[_0xd3d5('0x24')](handleEntityNotFound(_0xef667b,null))[_0xd3d5('0x24')](function(_0xbca79f){if(_0xbca79f){var _0x3bb823=_0xbca79f[_0xd3d5('0x26')]({'plain':!![]});_0x3bb823=qs[_0xd3d5('0x51')](_0x3bb823,['id',_0xd3d5('0x52'),_0xd3d5('0x53')]);_0x406e5a['body']=_[_0xd3d5('0x51')](_0x406e5a[_0xd3d5('0x47')],['id',_0xd3d5('0x52'),_0xd3d5('0x53')]);return db[_0xd3d5('0x2d')][_0xd3d5('0x46')](_[_0xd3d5('0x3f')](_0x3bb823,_0x406e5a[_0xd3d5('0x47')]),{'include':_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x44')]?[{'all':!![]}]:undefined})[_0xd3d5('0x24')](function(_0x1b6e55){var _0x560120=_0x406e5a[_0xd3d5('0x4a')][_0xd3d5('0x26')]({'plain':!![]});if(!_0x560120)throw new Error(_0xd3d5('0x48'));if(_0x560120[_0xd3d5('0x49')]===_0xd3d5('0x4a')){var _0x4d30fc=_0x1b6e55[_0xd3d5('0x26')]({'plain':!![]});var _0x33f2d9='Projects';return db[_0xd3d5('0x4b')][_0xd3d5('0x45')]({'where':{'name':_0x33f2d9,'userProfileId':_0x560120[_0xd3d5('0x4c')]},'raw':!![]})[_0xd3d5('0x24')](function(_0x512998){if(_0x512998&&_0x512998['autoAssociation']===0x0){return db['UserProfileResource'][_0xd3d5('0x46')]({'name':_0x4d30fc[_0xd3d5('0x2a')],'resourceId':_0x4d30fc['id'],'type':_0x512998[_0xd3d5('0x2a')],'sectionId':_0x512998['id']},{})[_0xd3d5('0x24')](function(){return _0x1b6e55;});}else{return _0x1b6e55;}})[_0xd3d5('0x42')](function(_0x32f8c9){logger['error'](_0xd3d5('0x4f'),_0x32f8c9);throw _0x32f8c9;});}return _0x1b6e55;});}})[_0xd3d5('0x24')](respondWithResult(_0xef667b,0xc9))['catch'](handleError(_0xef667b,null));};exports['update']=function(_0x2a9f3d,_0x4bd5a2){if(_0x2a9f3d[_0xd3d5('0x47')]['id']){delete _0x2a9f3d[_0xd3d5('0x47')]['id'];}return db[_0xd3d5('0x2d')]['find']({'where':{'id':_0x2a9f3d[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x4bd5a2,null))[_0xd3d5('0x24')](saveUpdates(_0x2a9f3d[_0xd3d5('0x47')],null))['then'](respondWithResult(_0x4bd5a2,null))[_0xd3d5('0x42')](handleError(_0x4bd5a2,null));};exports['destroy']=function(_0x1fa67d,_0x2789fc){return db[_0xd3d5('0x2d')][_0xd3d5('0x45')]({'where':{'id':_0x1fa67d[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x2789fc,null))[_0xd3d5('0x24')](removeEntity(_0x2789fc,null))[_0xd3d5('0x42')](handleError(_0x2789fc,null));};exports[_0xd3d5('0x54')]=function(_0x5f4cee,_0x18f981,_0x5233cb){var _0x2e00ec={'raw':!![],'where':{}};var _0x15a0b9={};var _0x5b4af8={'count':0x0,'rows':[]};return db[_0xd3d5('0x2d')][_0xd3d5('0x55')]({'where':{'id':_0x5f4cee[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x18f981,null))[_0xd3d5('0x24')](function(_0xce29e0){if(_0xce29e0){_0x15a0b9[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x56')]['rawAttributes']);_0x15a0b9[_0xd3d5('0x31')]=_['keys'](_0x5f4cee[_0xd3d5('0x31')]);_0x15a0b9[_0xd3d5('0x3b')]=_[_0xd3d5('0x33')](_0x15a0b9[_0xd3d5('0x30')],_0x15a0b9[_0xd3d5('0x31')]);_0x2e00ec[_0xd3d5('0x35')]=_[_0xd3d5('0x33')](_0x15a0b9[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x5f4cee['query'][_0xd3d5('0x34')]));_0x2e00ec[_0xd3d5('0x35')]=_0x2e00ec[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x2e00ec['attributes']:_0x15a0b9[_0xd3d5('0x30')];if(!_0x5f4cee['query'][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x2e00ec['limit']=qs[_0xd3d5('0x1c')](_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x1c')]);_0x2e00ec['offset']=qs[_0xd3d5('0x1a')](_0x5f4cee[_0xd3d5('0x31')]['offset']);}_0x2e00ec[_0xd3d5('0x57')]=qs[_0xd3d5('0x39')](_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x2e00ec['where']=qs[_0xd3d5('0x3b')](_[_0xd3d5('0x3c')](_0x5f4cee[_0xd3d5('0x31')],_0x15a0b9[_0xd3d5('0x3b')]));_0x2e00ec['where']['ProjectId']=_0xce29e0['id'];if(_0x5f4cee['query'][_0xd3d5('0x3d')]){_0x2e00ec['where']=_[_0xd3d5('0x3f')](_0x2e00ec[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x2e00ec[_0xd3d5('0x35')],function(_0x2ca946){var _0xefd9cf={};_0xefd9cf[_0x2ca946]={'$like':'%'+_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0xefd9cf;})});}_0x2e00ec=_[_0xd3d5('0x3f')]({},_0x2e00ec,_0x5f4cee[_0xd3d5('0x58')]);return db[_0xd3d5('0x56')][_0xd3d5('0x1d')]({'where':_0x2e00ec[_0xd3d5('0x3a')]})[_0xd3d5('0x24')](function(_0x3638a3){_0x5b4af8[_0xd3d5('0x1d')]=_0x3638a3;if(_0x5f4cee[_0xd3d5('0x31')]['includeAll']){_0x2e00ec[_0xd3d5('0x40')]=[{'all':!![]}];}return db[_0xd3d5('0x56')][_0xd3d5('0x59')](_0x2e00ec);})[_0xd3d5('0x24')](function(_0xbced26){_0x5b4af8[_0xd3d5('0x41')]=_0xbced26;return _0x5b4af8;});}})['then'](respondWithFilteredResult(_0x18f981,_0x2e00ec))[_0xd3d5('0x42')](handleError(_0x18f981,null));};exports['getAnswers']=function(_0x4b75ef,_0x4f50e3,_0x4f5c6e){var _0x570fd0={'raw':!![],'where':{}};var _0x1fec38={};var _0x30266a={'count':0x0,'rows':[]};return db[_0xd3d5('0x2d')]['findOne']({'where':{'id':_0x4b75ef[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x4f50e3,null))[_0xd3d5('0x24')](function(_0x496064){if(_0x496064){_0x1fec38[_0xd3d5('0x30')]=_['keys'](db[_0xd3d5('0x5a')][_0xd3d5('0x2e')]);_0x1fec38[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x4b75ef['query']);_0x1fec38['filters']=_[_0xd3d5('0x33')](_0x1fec38[_0xd3d5('0x30')],_0x1fec38[_0xd3d5('0x31')]);_0x570fd0[_0xd3d5('0x35')]=_['intersection'](_0x1fec38[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x34')]));_0x570fd0[_0xd3d5('0x35')]=_0x570fd0['attributes']['length']?_0x570fd0[_0xd3d5('0x35')]:_0x1fec38[_0xd3d5('0x30')];if(!_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x570fd0[_0xd3d5('0x1c')]=qs['limit'](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x1c')]);_0x570fd0[_0xd3d5('0x1a')]=qs['offset'](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x1a')]);}_0x570fd0[_0xd3d5('0x57')]=qs[_0xd3d5('0x39')](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x570fd0[_0xd3d5('0x3a')]=qs['filters'](_[_0xd3d5('0x3c')](_0x4b75ef[_0xd3d5('0x31')],_0x1fec38['filters']));_0x570fd0['where'][_0xd3d5('0x5b')]=_0x496064['id'];if(_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x3d')]){_0x570fd0[_0xd3d5('0x3a')]=_[_0xd3d5('0x3f')](_0x570fd0[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x570fd0['attributes'],function(_0x5af498){var _0x3cf1f7={};_0x3cf1f7[_0x5af498]={'$like':'%'+_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0x3cf1f7;})});}_0x570fd0=_['merge']({},_0x570fd0,_0x4b75ef[_0xd3d5('0x58')]);return db[_0xd3d5('0x5a')]['count']({'where':_0x570fd0[_0xd3d5('0x3a')]})['then'](function(_0x2d8d86){_0x30266a[_0xd3d5('0x1d')]=_0x2d8d86;if(_0x4b75ef['query'][_0xd3d5('0x44')]){_0x570fd0['include']=[{'all':!![]}];}return db[_0xd3d5('0x5a')]['findAll'](_0x570fd0);})[_0xd3d5('0x24')](function(_0x20cba3){_0x30266a[_0xd3d5('0x41')]=_0x20cba3;return _0x30266a;});}})[_0xd3d5('0x24')](respondWithFilteredResult(_0x4f50e3,_0x570fd0))[_0xd3d5('0x42')](handleError(_0x4f50e3,null));};function char(_0xd19dc6){return'number'===typeof _0xd19dc6?String['fromCharCode'][_0xd3d5('0x20')](null,arguments):_0xd19dc6;}function needsEncapsulation(_0x57fa1e){return!!_0x57fa1e&&(_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0xd))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0xa))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0x2c))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3ab68d){var _0xf21d31=char(0x22),_0x35c521='\x5c'+char(0x22),_0x2a11e8=_0x3ab68d[_0xd3d5('0x5c')]()['replace'](new RegExp(_0xf21d31,'g'),_0x35c521);return _0xf21d31+_0x2a11e8+_0xf21d31;}exports[_0xd3d5('0x5e')]=function(_0x17c319,_0x3d5595,_0x32e396){var _0x66e539,_0x4f630c;var _0x35abdc={'where':{'ProjectId':_0x17c319[_0xd3d5('0x43')]['id']}};if(_0x17c319['query'][_0xd3d5('0x5f')]){_0x35abdc[_0xd3d5('0x3a')]['starttime']=JSON[_0xd3d5('0x60')](_0x17c319[_0xd3d5('0x31')]['startTime']);}return db[_0xd3d5('0x56')]['findAll'](_0x35abdc)[_0xd3d5('0x24')](handleEntityNotFound(_0x3d5595,null))[_0xd3d5('0x24')](function(_0x4d8460){if(_0x4d8460){_0x66e539=_0x4d8460;return db[_0xd3d5('0x61')][_0xd3d5('0x59')]({'where':{'SessionId':{'$in':_['map'](_0x66e539,'id')},'ProjectId':_0x17c319[_0xd3d5('0x43')]['id']},'order':'-createdAt'});}})[_0xd3d5('0x24')](handleEntityNotFound(_0x3d5595,null))[_0xd3d5('0x24')](function(_0x2ee7fa){if(_0x2ee7fa){_0x4f630c=_0x2ee7fa;var _0x3b38d2={};for(var _0x28a653=0x0,_0x5df917=_0x4f630c[_0xd3d5('0x36')];_0x28a653<_0x5df917;_0x28a653++){if(!_0x3b38d2[_0xd3d5('0x37')](_0x4f630c[_0x28a653][_0xd3d5('0x62')])){_0x3b38d2[_0x4f630c[_0x28a653][_0xd3d5('0x62')]]=needsEncapsulation(_0x4f630c[_0x28a653]['question'])?encapsulate(_0x4f630c[_0x28a653]['question']):_0x4f630c[_0x28a653][_0xd3d5('0x63')];}}var _0x129d2b=[],_0x1e922f={};for(var _0x2eb7d4=0x0,_0x6cf5c6=_0x66e539[_0xd3d5('0x36')];_0x2eb7d4<_0x6cf5c6;_0x2eb7d4++){_0x1e922f={'ProjectId':_0x17c319[_0xd3d5('0x43')]['id'],'SessionId':_0x66e539[_0x2eb7d4]['id'],'StartTime':moment(_0x66e539[_0x2eb7d4]['starttime'])[_0xd3d5('0x64')](_0xd3d5('0x65'))};for(var _0x565892=0x0,_0x919174=_0x4f630c[_0xd3d5('0x36')];_0x565892<_0x919174;_0x565892++){if(_0x4f630c[_0x565892][_0xd3d5('0x66')]==_0x66e539[_0x2eb7d4]['id']&&_0x3b38d2[_0xd3d5('0x37')](_0x4f630c[_0x565892][_0xd3d5('0x62')])){_0x1e922f[_0x3b38d2[_0x4f630c[_0x565892][_0xd3d5('0x62')]]]=_0x4f630c[_0x565892][_0xd3d5('0x67')];}}for(var _0x5136de in _0x3b38d2){if(!_0x1e922f[_0xd3d5('0x37')](_0x3b38d2[_0x5136de])){_0x1e922f[_0x3b38d2[_0x5136de]]=null;}}_0x129d2b[_0xd3d5('0x68')](_0x1e922f);}return _0x129d2b;}})[_0xd3d5('0x24')](function(_0x2f68ae){if(!_[_0xd3d5('0x69')](_0x2f68ae)){var _0x5a617c=toCsv(_0x2f68ae);var _0x3a1e5c=Date[_0xd3d5('0x6a')]();fs[_0xd3d5('0x6b')](util['format'](_0xd3d5('0x6c'),_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c),_0x5a617c);_0x3d5595[_0xd3d5('0x6d')](_0xd3d5('0x6e'),_0xd3d5('0x6f')+util[_0xd3d5('0x64')]('Jscripty_Project_%d_Summary_%s.csv',_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c));_0x3d5595[_0xd3d5('0x6d')]('Content-type',_0xd3d5('0x70'));return _0x3d5595['download'](util[_0xd3d5('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c));}else{return _0x3d5595[_0xd3d5('0x17')](0xcc);}})[_0xd3d5('0x42')](handleError(_0x3d5595,null));}; \ No newline at end of file +var _0xd276=['parse','JscriptyQuestionReport','questionId','question','SessionId','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','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','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Projects','UserProfileResource','end','name','send','index','map','JscriptyProject','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','rows','catch','show','params','keys','intersection','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','includeAll','createdAt','updatedAt','body','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime'];(function(_0x5c4669,_0x7f9bcd){var _0xf18b6a=function(_0x5ba22d){while(--_0x5ba22d){_0x5c4669['push'](_0x5c4669['shift']());}};_0xf18b6a(++_0x7f9bcd);}(_0xd276,0xfc));var _0x6d27=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd276[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x6d27('0x0'));var rimraf=require(_0x6d27('0x1'));var zipdir=require(_0x6d27('0x2'));var jsonpatch=require(_0x6d27('0x3'));var rp=require('request-promise');var moment=require(_0x6d27('0x4'));var BPromise=require(_0x6d27('0x5'));var Mustache=require(_0x6d27('0x6'));var util=require(_0x6d27('0x7'));var path=require('path');var sox=require(_0x6d27('0x8'));var csv=require(_0x6d27('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d27('0xa'));var _=require(_0x6d27('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d27('0xc'));var deskjs=require(_0x6d27('0xd'));var toCsv=require(_0x6d27('0x9'));var querystring=require(_0x6d27('0xe'));var Papa=require(_0x6d27('0xf'));var Redis=require(_0x6d27('0x10'));var authService=require(_0x6d27('0x11'));var qs=require(_0x6d27('0x12'));var as=require(_0x6d27('0x13'));var hardwareService=require(_0x6d27('0x14'));var logger=require('../../config/logger')(_0x6d27('0x15'));var utils=require('../../config/utils');var config=require(_0x6d27('0x16'));var licenseUtil=require(_0x6d27('0x17'));var db=require(_0x6d27('0x18'))['db'];function respondWithStatusCode(_0x330655,_0x1fe78b){_0x1fe78b=_0x1fe78b||0xcc;return function(_0x2f962a){if(_0x2f962a){return _0x330655[_0x6d27('0x19')](_0x1fe78b);}return _0x330655['status'](_0x1fe78b)['end']();};}function respondWithResult(_0x157674,_0x577545){_0x577545=_0x577545||0xc8;return function(_0x2db230){if(_0x2db230){return _0x157674[_0x6d27('0x1a')](_0x577545)[_0x6d27('0x1b')](_0x2db230);}};}function respondWithFilteredResult(_0x4e833f,_0x39f580){return function(_0x402221){if(_0x402221){var _0x230e8c=typeof _0x39f580['offset']===_0x6d27('0x1c')&&typeof _0x39f580[_0x6d27('0x1d')]===_0x6d27('0x1c');var _0x2abc9b=_0x402221[_0x6d27('0x1e')];var _0x50cdd6=_0x230e8c?0x0:_0x39f580['offset'];var _0x2e86b3=_0x230e8c?_0x402221[_0x6d27('0x1e')]:_0x39f580[_0x6d27('0x1f')]+_0x39f580[_0x6d27('0x1d')];var _0x8567c1;if(_0x2e86b3>=_0x2abc9b){_0x2e86b3=_0x2abc9b;_0x8567c1=0xc8;}else{_0x8567c1=0xce;}_0x4e833f[_0x6d27('0x1a')](_0x8567c1);return _0x4e833f[_0x6d27('0x20')](_0x6d27('0x21'),_0x50cdd6+'-'+_0x2e86b3+'/'+_0x2abc9b)[_0x6d27('0x1b')](_0x402221);}return null;};}function patchUpdates(_0x3874c0){return function(_0x533f1b){try{jsonpatch[_0x6d27('0x22')](_0x533f1b,_0x3874c0,!![]);}catch(_0x354c3d){return BPromise['reject'](_0x354c3d);}return _0x533f1b[_0x6d27('0x23')]();};}function saveUpdates(_0x5bdbcf,_0x245d27){return function(_0x334747){if(_0x334747){return _0x334747[_0x6d27('0x24')](_0x5bdbcf)[_0x6d27('0x25')](function(_0x22852d){return _0x22852d;});}return null;};}function removeEntity(_0x597074,_0x10920e){return function(_0x30f7c4){if(_0x30f7c4){return _0x30f7c4[_0x6d27('0x26')]()[_0x6d27('0x25')](function(){var _0x337576=_0x30f7c4[_0x6d27('0x27')]({'plain':!![]});var _0x1f8600=_0x6d27('0x28');return db[_0x6d27('0x29')][_0x6d27('0x26')]({'where':{'type':_0x1f8600,'resourceId':_0x337576['id']}})[_0x6d27('0x25')](function(){return _0x30f7c4;});})[_0x6d27('0x25')](function(){_0x597074['status'](0xcc)[_0x6d27('0x2a')]();});}};}function handleEntityNotFound(_0x16e208,_0x5c3620){return function(_0x5a5404){if(!_0x5a5404){_0x16e208[_0x6d27('0x19')](0x194);}return _0x5a5404;};}function handleError(_0x4b3ef2,_0x51a262){_0x51a262=_0x51a262||0x1f4;return function(_0x5e1668){logger['error'](_0x5e1668['stack']);if(_0x5e1668[_0x6d27('0x2b')]){delete _0x5e1668['name'];}_0x4b3ef2[_0x6d27('0x1a')](_0x51a262)[_0x6d27('0x2c')](_0x5e1668);};}exports[_0x6d27('0x2d')]=function(_0xbb48c1,_0x230a9a){var _0x4b1256={},_0x318afd={},_0x597300={'count':0x0,'rows':[]};var _0x239526=_[_0x6d27('0x2e')](db[_0x6d27('0x2f')]['rawAttributes'],function(_0x2f31f4){return{'name':_0x2f31f4['fieldName'],'type':_0x2f31f4[_0x6d27('0x30')][_0x6d27('0x31')]};});_0x318afd['model']=_[_0x6d27('0x2e')](_0x239526,_0x6d27('0x2b'));_0x318afd['query']=_['keys'](_0xbb48c1[_0x6d27('0x32')]);_0x318afd[_0x6d27('0x33')]=_['intersection'](_0x318afd[_0x6d27('0x34')],_0x318afd[_0x6d27('0x32')]);_0x4b1256[_0x6d27('0x35')]=_['intersection'](_0x318afd[_0x6d27('0x34')],qs['fields'](_0xbb48c1[_0x6d27('0x32')][_0x6d27('0x36')]));_0x4b1256[_0x6d27('0x35')]=_0x4b1256[_0x6d27('0x35')][_0x6d27('0x37')]?_0x4b1256[_0x6d27('0x35')]:_0x318afd['model'];if(!_0xbb48c1['query'][_0x6d27('0x38')](_0x6d27('0x39'))){_0x4b1256[_0x6d27('0x1d')]=qs[_0x6d27('0x1d')](_0xbb48c1['query']['limit']);_0x4b1256['offset']=qs[_0x6d27('0x1f')](_0xbb48c1[_0x6d27('0x32')]['offset']);}_0x4b1256[_0x6d27('0x3a')]=qs[_0x6d27('0x3b')](_0xbb48c1['query'][_0x6d27('0x3b')]);_0x4b1256[_0x6d27('0x3c')]=qs[_0x6d27('0x33')](_[_0x6d27('0x3d')](_0xbb48c1['query'],_0x318afd['filters']),_0x239526);if(_0xbb48c1[_0x6d27('0x32')]['filter']){_0x4b1256[_0x6d27('0x3c')]=_[_0x6d27('0x3e')](_0x4b1256['where'],{'$or':_[_0x6d27('0x2e')](_0x239526,function(_0x4ea1ab){if(_0x4ea1ab[_0x6d27('0x30')]!=='VIRTUAL'){var _0x277d23={};_0x277d23[_0x4ea1ab[_0x6d27('0x2b')]]={'$like':'%'+_0xbb48c1[_0x6d27('0x32')][_0x6d27('0x3f')]+'%'};return _0x277d23;}})});}_0x4b1256=_['merge']({},_0x4b1256,_0xbb48c1[_0x6d27('0x40')]);var _0x37aa5a={'where':_0x4b1256['where']};return db[_0x6d27('0x2f')][_0x6d27('0x1e')](_0x37aa5a)[_0x6d27('0x25')](function(_0x453ec3){_0x597300['count']=_0x453ec3;if(_0xbb48c1[_0x6d27('0x32')]['includeAll']){_0x4b1256['include']=[{'all':!![]}];}return db[_0x6d27('0x2f')]['findAll'](_0x4b1256);})[_0x6d27('0x25')](function(_0x1bcb81){_0x597300[_0x6d27('0x41')]=_0x1bcb81;return _0x597300;})[_0x6d27('0x25')](respondWithFilteredResult(_0x230a9a,_0x4b1256))[_0x6d27('0x42')](handleError(_0x230a9a,null));};exports[_0x6d27('0x43')]=function(_0x30d559,_0x32de32){var _0x533194={'raw':![],'where':{'id':_0x30d559[_0x6d27('0x44')]['id']}},_0x46c861={};_0x46c861[_0x6d27('0x34')]=_[_0x6d27('0x45')](db['JscriptyProject']['rawAttributes']);_0x46c861[_0x6d27('0x32')]=_[_0x6d27('0x45')](_0x30d559[_0x6d27('0x32')]);_0x46c861[_0x6d27('0x33')]=_['intersection'](_0x46c861[_0x6d27('0x34')],_0x46c861[_0x6d27('0x32')]);_0x533194['attributes']=_[_0x6d27('0x46')](_0x46c861['model'],qs[_0x6d27('0x36')](_0x30d559[_0x6d27('0x32')][_0x6d27('0x36')]));_0x533194[_0x6d27('0x35')]=_0x533194[_0x6d27('0x35')]['length']?_0x533194[_0x6d27('0x35')]:_0x46c861[_0x6d27('0x34')];if(_0x30d559[_0x6d27('0x32')]['includeAll']){_0x533194[_0x6d27('0x47')]=[{'all':!![]}];}_0x533194=_[_0x6d27('0x3e')]({},_0x533194,_0x30d559[_0x6d27('0x40')]);return db[_0x6d27('0x2f')][_0x6d27('0x48')](_0x533194)['then'](handleEntityNotFound(_0x32de32,null))[_0x6d27('0x25')](respondWithResult(_0x32de32,null))[_0x6d27('0x42')](handleError(_0x32de32,null));};exports[_0x6d27('0x49')]=function(_0x2d462f,_0x4343f6){return db[_0x6d27('0x2f')][_0x6d27('0x49')](_0x2d462f['body'],{})[_0x6d27('0x25')](function(_0x21d726){var _0xf9a8a3=_0x2d462f[_0x6d27('0x4a')][_0x6d27('0x27')]({'plain':!![]});if(!_0xf9a8a3)throw new Error(_0x6d27('0x4b'));if(_0xf9a8a3[_0x6d27('0x4c')]==='user'){var _0x1bbcb0=_0x21d726[_0x6d27('0x27')]({'plain':!![]});var _0x2bb5d9='Projects';return db['UserProfileSection'][_0x6d27('0x48')]({'where':{'name':_0x2bb5d9,'userProfileId':_0xf9a8a3[_0x6d27('0x4d')]},'raw':!![]})['then'](function(_0x2d0fd7){if(_0x2d0fd7&&_0x2d0fd7[_0x6d27('0x4e')]===0x0){return db['UserProfileResource'][_0x6d27('0x49')]({'name':_0x1bbcb0[_0x6d27('0x2b')],'resourceId':_0x1bbcb0['id'],'type':_0x2d0fd7['name'],'sectionId':_0x2d0fd7['id']},{})[_0x6d27('0x25')](function(){return _0x21d726;});}else{return _0x21d726;}})[_0x6d27('0x42')](function(_0x1d1d33){logger[_0x6d27('0x4f')](_0x6d27('0x50'),_0x1d1d33);throw _0x1d1d33;});}return _0x21d726;})[_0x6d27('0x25')](respondWithResult(_0x4343f6,0xc9))[_0x6d27('0x42')](handleError(_0x4343f6,null));};exports[_0x6d27('0x51')]=function(_0x1470ed,_0x33730a){var _0x279ddc={'where':{'id':_0x1470ed[_0x6d27('0x44')]['id']}},_0x2f488b={};_0x2f488b['model']=_[_0x6d27('0x45')](db[_0x6d27('0x2f')][_0x6d27('0x52')]);_0x279ddc[_0x6d27('0x35')]=_[_0x6d27('0x46')](_0x2f488b[_0x6d27('0x34')],qs[_0x6d27('0x36')](_0x1470ed[_0x6d27('0x32')][_0x6d27('0x36')]));_0x279ddc[_0x6d27('0x35')]=_0x279ddc[_0x6d27('0x35')][_0x6d27('0x37')]?_0x279ddc[_0x6d27('0x35')]:_0x2f488b[_0x6d27('0x34')];if(_0x1470ed[_0x6d27('0x32')][_0x6d27('0x53')]){_0x279ddc[_0x6d27('0x47')]=[{'all':!![]}];}_0x279ddc=_[_0x6d27('0x3e')]({},_0x279ddc,_0x1470ed[_0x6d27('0x40')]);return db[_0x6d27('0x2f')]['find'](_0x279ddc)[_0x6d27('0x25')](handleEntityNotFound(_0x33730a,null))[_0x6d27('0x25')](function(_0x1477b){if(_0x1477b){var _0x10dad=_0x1477b[_0x6d27('0x27')]({'plain':!![]});_0x10dad=qs['omit'](_0x10dad,['id',_0x6d27('0x54'),_0x6d27('0x55')]);_0x1470ed[_0x6d27('0x56')]=_['omit'](_0x1470ed[_0x6d27('0x56')],['id',_0x6d27('0x54'),_0x6d27('0x55')]);return db['JscriptyProject'][_0x6d27('0x49')](_[_0x6d27('0x3e')](_0x10dad,_0x1470ed[_0x6d27('0x56')]),{'include':_0x1470ed[_0x6d27('0x32')][_0x6d27('0x53')]?[{'all':!![]}]:undefined})[_0x6d27('0x25')](function(_0x2842c3){var _0x482283=_0x1470ed[_0x6d27('0x4a')][_0x6d27('0x27')]({'plain':!![]});if(!_0x482283)throw new Error(_0x6d27('0x4b'));if(_0x482283['role']===_0x6d27('0x4a')){var _0x4ac15a=_0x2842c3[_0x6d27('0x27')]({'plain':!![]});var _0x534741=_0x6d27('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x534741,'userProfileId':_0x482283[_0x6d27('0x4d')]},'raw':!![]})[_0x6d27('0x25')](function(_0x16d278){if(_0x16d278&&_0x16d278[_0x6d27('0x4e')]===0x0){return db[_0x6d27('0x29')][_0x6d27('0x49')]({'name':_0x4ac15a[_0x6d27('0x2b')],'resourceId':_0x4ac15a['id'],'type':_0x16d278['name'],'sectionId':_0x16d278['id']},{})[_0x6d27('0x25')](function(){return _0x2842c3;});}else{return _0x2842c3;}})['catch'](function(_0x3ca889){logger[_0x6d27('0x4f')](_0x6d27('0x50'),_0x3ca889);throw _0x3ca889;});}return _0x2842c3;});}})[_0x6d27('0x25')](respondWithResult(_0x33730a,0xc9))[_0x6d27('0x42')](handleError(_0x33730a,null));};exports[_0x6d27('0x24')]=function(_0x510801,_0x566232){if(_0x510801[_0x6d27('0x56')]['id']){delete _0x510801[_0x6d27('0x56')]['id'];}return db[_0x6d27('0x2f')][_0x6d27('0x48')]({'where':{'id':_0x510801[_0x6d27('0x44')]['id']}})[_0x6d27('0x25')](handleEntityNotFound(_0x566232,null))['then'](saveUpdates(_0x510801['body'],null))[_0x6d27('0x25')](respondWithResult(_0x566232,null))[_0x6d27('0x42')](handleError(_0x566232,null));};exports[_0x6d27('0x26')]=function(_0x2814ae,_0x3202ab){return db[_0x6d27('0x2f')][_0x6d27('0x48')]({'where':{'id':_0x2814ae['params']['id']}})['then'](handleEntityNotFound(_0x3202ab,null))[_0x6d27('0x25')](removeEntity(_0x3202ab,null))[_0x6d27('0x42')](handleError(_0x3202ab,null));};exports[_0x6d27('0x57')]=function(_0x18f248,_0x23e1d8,_0x17889b){var _0x5b22d2={'raw':!![],'where':{}};var _0x2ef4a4={};var _0x383f96={'count':0x0,'rows':[]};return db[_0x6d27('0x2f')][_0x6d27('0x58')]({'where':{'id':_0x18f248[_0x6d27('0x44')]['id']}})[_0x6d27('0x25')](handleEntityNotFound(_0x23e1d8,null))['then'](function(_0x74153b){if(_0x74153b){_0x2ef4a4[_0x6d27('0x34')]=_[_0x6d27('0x45')](db[_0x6d27('0x59')][_0x6d27('0x52')]);_0x2ef4a4[_0x6d27('0x32')]=_[_0x6d27('0x45')](_0x18f248[_0x6d27('0x32')]);_0x2ef4a4[_0x6d27('0x33')]=_[_0x6d27('0x46')](_0x2ef4a4[_0x6d27('0x34')],_0x2ef4a4[_0x6d27('0x32')]);_0x5b22d2['attributes']=_[_0x6d27('0x46')](_0x2ef4a4[_0x6d27('0x34')],qs[_0x6d27('0x36')](_0x18f248[_0x6d27('0x32')][_0x6d27('0x36')]));_0x5b22d2[_0x6d27('0x35')]=_0x5b22d2['attributes'][_0x6d27('0x37')]?_0x5b22d2[_0x6d27('0x35')]:_0x2ef4a4[_0x6d27('0x34')];if(!_0x18f248['query'][_0x6d27('0x38')]('nolimit')){_0x5b22d2[_0x6d27('0x1d')]=qs[_0x6d27('0x1d')](_0x18f248[_0x6d27('0x32')][_0x6d27('0x1d')]);_0x5b22d2[_0x6d27('0x1f')]=qs['offset'](_0x18f248[_0x6d27('0x32')][_0x6d27('0x1f')]);}_0x5b22d2[_0x6d27('0x3a')]=qs['sort'](_0x18f248[_0x6d27('0x32')][_0x6d27('0x3b')]);_0x5b22d2['where']=qs['filters'](_[_0x6d27('0x3d')](_0x18f248[_0x6d27('0x32')],_0x2ef4a4[_0x6d27('0x33')]));_0x5b22d2['where'][_0x6d27('0x5a')]=_0x74153b['id'];if(_0x18f248[_0x6d27('0x32')][_0x6d27('0x3f')]){_0x5b22d2[_0x6d27('0x3c')]=_['merge'](_0x5b22d2[_0x6d27('0x3c')],{'$or':_[_0x6d27('0x2e')](_0x5b22d2[_0x6d27('0x35')],function(_0x3b563e){var _0x308143={};_0x308143[_0x3b563e]={'$like':'%'+_0x18f248[_0x6d27('0x32')][_0x6d27('0x3f')]+'%'};return _0x308143;})});}_0x5b22d2=_[_0x6d27('0x3e')]({},_0x5b22d2,_0x18f248['options']);return db[_0x6d27('0x59')][_0x6d27('0x1e')]({'where':_0x5b22d2[_0x6d27('0x3c')]})[_0x6d27('0x25')](function(_0x1be3a6){_0x383f96['count']=_0x1be3a6;if(_0x18f248[_0x6d27('0x32')][_0x6d27('0x53')]){_0x5b22d2['include']=[{'all':!![]}];}return db[_0x6d27('0x59')][_0x6d27('0x5b')](_0x5b22d2);})[_0x6d27('0x25')](function(_0xb74eb6){_0x383f96[_0x6d27('0x41')]=_0xb74eb6;return _0x383f96;});}})[_0x6d27('0x25')](respondWithFilteredResult(_0x23e1d8,_0x5b22d2))[_0x6d27('0x42')](handleError(_0x23e1d8,null));};exports[_0x6d27('0x5c')]=function(_0x21cb48,_0x42ccf5,_0x4b7cff){var _0xb61a74={'raw':!![],'where':{}};var _0x8df70c={};var _0xaee406={'count':0x0,'rows':[]};return db[_0x6d27('0x2f')][_0x6d27('0x58')]({'where':{'id':_0x21cb48[_0x6d27('0x44')]['id']}})[_0x6d27('0x25')](handleEntityNotFound(_0x42ccf5,null))[_0x6d27('0x25')](function(_0x5ace6f){if(_0x5ace6f){_0x8df70c[_0x6d27('0x34')]=_['keys'](db[_0x6d27('0x5d')][_0x6d27('0x52')]);_0x8df70c['query']=_[_0x6d27('0x45')](_0x21cb48['query']);_0x8df70c[_0x6d27('0x33')]=_[_0x6d27('0x46')](_0x8df70c[_0x6d27('0x34')],_0x8df70c[_0x6d27('0x32')]);_0xb61a74[_0x6d27('0x35')]=_[_0x6d27('0x46')](_0x8df70c[_0x6d27('0x34')],qs[_0x6d27('0x36')](_0x21cb48[_0x6d27('0x32')]['fields']));_0xb61a74[_0x6d27('0x35')]=_0xb61a74[_0x6d27('0x35')][_0x6d27('0x37')]?_0xb61a74[_0x6d27('0x35')]:_0x8df70c[_0x6d27('0x34')];if(!_0x21cb48['query']['hasOwnProperty'](_0x6d27('0x39'))){_0xb61a74[_0x6d27('0x1d')]=qs['limit'](_0x21cb48[_0x6d27('0x32')][_0x6d27('0x1d')]);_0xb61a74[_0x6d27('0x1f')]=qs[_0x6d27('0x1f')](_0x21cb48[_0x6d27('0x32')]['offset']);}_0xb61a74['order']=qs[_0x6d27('0x3b')](_0x21cb48[_0x6d27('0x32')][_0x6d27('0x3b')]);_0xb61a74[_0x6d27('0x3c')]=qs[_0x6d27('0x33')](_[_0x6d27('0x3d')](_0x21cb48[_0x6d27('0x32')],_0x8df70c[_0x6d27('0x33')]));_0xb61a74['where'][_0x6d27('0x5a')]=_0x5ace6f['id'];if(_0x21cb48[_0x6d27('0x32')]['filter']){_0xb61a74[_0x6d27('0x3c')]=_[_0x6d27('0x3e')](_0xb61a74['where'],{'$or':_['map'](_0xb61a74[_0x6d27('0x35')],function(_0x9da848){var _0x23e089={};_0x23e089[_0x9da848]={'$like':'%'+_0x21cb48['query'][_0x6d27('0x3f')]+'%'};return _0x23e089;})});}_0xb61a74=_['merge']({},_0xb61a74,_0x21cb48[_0x6d27('0x40')]);return db['JscriptyAnswerReport']['count']({'where':_0xb61a74[_0x6d27('0x3c')]})[_0x6d27('0x25')](function(_0x42ce9c){_0xaee406[_0x6d27('0x1e')]=_0x42ce9c;if(_0x21cb48[_0x6d27('0x32')][_0x6d27('0x53')]){_0xb61a74[_0x6d27('0x47')]=[{'all':!![]}];}return db[_0x6d27('0x5d')][_0x6d27('0x5b')](_0xb61a74);})['then'](function(_0x6ff88b){_0xaee406[_0x6d27('0x41')]=_0x6ff88b;return _0xaee406;});}})[_0x6d27('0x25')](respondWithFilteredResult(_0x42ccf5,_0xb61a74))[_0x6d27('0x42')](handleError(_0x42ccf5,null));};function char(_0x968b24){return _0x6d27('0x5e')===typeof _0x968b24?String[_0x6d27('0x5f')]['apply'](null,arguments):_0x968b24;}function needsEncapsulation(_0x3a3ed3){return!!_0x3a3ed3&&(_0x3a3ed3[_0x6d27('0x60')]()['indexOf'](char(0xd))>=0x0||_0x3a3ed3[_0x6d27('0x60')]()[_0x6d27('0x61')](char(0xa))>=0x0||_0x3a3ed3['toString']()[_0x6d27('0x61')](char(0x2c))>=0x0||_0x3a3ed3['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x106c86){var _0x9c7c53=char(0x22),_0x34bebd='\x5c'+char(0x22),_0x16b3d9=_0x106c86[_0x6d27('0x60')]()[_0x6d27('0x62')](new RegExp(_0x9c7c53,'g'),_0x34bebd);return _0x9c7c53+_0x16b3d9+_0x9c7c53;}exports[_0x6d27('0x63')]=function(_0x31213a,_0x369c3f,_0x417cc5){var _0x3b9155,_0x56227a;var _0x4839be={'where':{'ProjectId':_0x31213a[_0x6d27('0x44')]['id']}};if(_0x31213a[_0x6d27('0x32')][_0x6d27('0x64')]){_0x4839be[_0x6d27('0x3c')][_0x6d27('0x65')]=JSON[_0x6d27('0x66')](_0x31213a[_0x6d27('0x32')]['startTime']);}return db[_0x6d27('0x59')]['findAll'](_0x4839be)[_0x6d27('0x25')](handleEntityNotFound(_0x369c3f,null))['then'](function(_0x2c4a89){if(_0x2c4a89){_0x3b9155=_0x2c4a89;return db[_0x6d27('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x6d27('0x2e')](_0x3b9155,'id')},'ProjectId':_0x31213a[_0x6d27('0x44')]['id']},'order':'-createdAt'});}})[_0x6d27('0x25')](handleEntityNotFound(_0x369c3f,null))[_0x6d27('0x25')](function(_0x7d15cc){if(_0x7d15cc){_0x56227a=_0x7d15cc;var _0x1897b0={};for(var _0x134d15=0x0,_0x23c7e8=_0x56227a['length'];_0x134d15<_0x23c7e8;_0x134d15++){if(!_0x1897b0[_0x6d27('0x38')](_0x56227a[_0x134d15][_0x6d27('0x68')])){_0x1897b0[_0x56227a[_0x134d15]['questionId']]=needsEncapsulation(_0x56227a[_0x134d15][_0x6d27('0x69')])?encapsulate(_0x56227a[_0x134d15][_0x6d27('0x69')]):_0x56227a[_0x134d15][_0x6d27('0x69')];}}var _0x1a93b9=[],_0x20b58d={};for(var _0x93d686=0x0,_0x1a8c43=_0x3b9155[_0x6d27('0x37')];_0x93d686<_0x1a8c43;_0x93d686++){_0x20b58d={'ProjectId':_0x31213a[_0x6d27('0x44')]['id'],'SessionId':_0x3b9155[_0x93d686]['id'],'StartTime':moment(_0x3b9155[_0x93d686][_0x6d27('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x135101=0x0,_0xe939c3=_0x56227a[_0x6d27('0x37')];_0x135101<_0xe939c3;_0x135101++){if(_0x56227a[_0x135101][_0x6d27('0x6a')]==_0x3b9155[_0x93d686]['id']&&_0x1897b0[_0x6d27('0x38')](_0x56227a[_0x135101][_0x6d27('0x68')])){_0x20b58d[_0x1897b0[_0x56227a[_0x135101][_0x6d27('0x68')]]]=_0x56227a[_0x135101]['answer'];}}for(var _0x225e0b in _0x1897b0){if(!_0x20b58d[_0x6d27('0x38')](_0x1897b0[_0x225e0b])){_0x20b58d[_0x1897b0[_0x225e0b]]=null;}}_0x1a93b9[_0x6d27('0x6b')](_0x20b58d);}return _0x1a93b9;}})[_0x6d27('0x25')](function(_0x3d3a12){if(!_['isEmpty'](_0x3d3a12)){var _0x4fa1ba=toCsv(_0x3d3a12);var _0x19172c=Date[_0x6d27('0x6c')]();fs[_0x6d27('0x6d')](util[_0x6d27('0x6e')](_0x6d27('0x6f'),_0x31213a['params']['id'],_0x19172c),_0x4fa1ba);_0x369c3f['setHeader'](_0x6d27('0x70'),_0x6d27('0x71')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x31213a[_0x6d27('0x44')]['id'],_0x19172c));_0x369c3f[_0x6d27('0x72')](_0x6d27('0x73'),_0x6d27('0x74'));return _0x369c3f[_0x6d27('0x75')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x31213a[_0x6d27('0x44')]['id'],_0x19172c));}else{return _0x369c3f[_0x6d27('0x19')](0xcc);}})[_0x6d27('0x42')](handleError(_0x369c3f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5879e42..1e95bdb 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x255ccb,_0x45d7ae){var _0x21c5c6=function(_0x1bb073){while(--_0x1bb073){_0x255ccb['push'](_0x255ccb['shift']());}};_0x21c5c6(++_0x45d7ae);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5906f5,_0x4c63f8){_0x5906f5=_0x5906f5-0x0;var _0x1b3114=_0x9c5a[_0x5906f5];return _0x1b3114;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3561=['../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe15a1,_0x3010eb){var _0x46260f=function(_0x3ea6f9){while(--_0x3ea6f9){_0xe15a1['push'](_0xe15a1['shift']());}};_0x46260f(++_0x3010eb);}(_0x3561,0x94));var _0x1356=function(_0xf0d608,_0xd9fa13){_0xf0d608=_0xf0d608-0x0;var _0x2243b5=_0x3561[_0xf0d608];return _0x2243b5;};'use strict';var _=require(_0x1356('0x0'));var util=require('util');var logger=require(_0x1356('0x1'))(_0x1356('0x2'));var moment=require(_0x1356('0x3'));var BPromise=require(_0x1356('0x4'));var rp=require(_0x1356('0x5'));var fs=require('fs');var path=require(_0x1356('0x6'));var rimraf=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var attributes=require(_0x1356('0x9'));module[_0x1356('0xa')]=function(_0x417d11,_0x36e81f){return _0x417d11[_0x1356('0xb')]('JscriptyProject',attributes,{'tableName':_0x1356('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index dd2cf50..af640a3 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5c6e5e,_0x54886e){var _0x5a1326=function(_0x28b117){while(--_0x28b117){_0x5c6e5e['push'](_0x5c6e5e['shift']());}};_0x5a1326(++_0x54886e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xcb91[_0x553a87];return _0x12d1e6;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x564fdd,_0x53a09e){var _0x488c7b=function(_0xbaad35){while(--_0xbaad35){_0x564fdd['push'](_0x564fdd['shift']());}};_0x488c7b(++_0x53a09e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f5475,_0x5c0d19){_0x4f5475=_0x4f5475-0x0;var _0x2b252f=_0x9bde[_0x4f5475];return _0x2b252f;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0358d67..ad43b5b 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 _0xb116=['/describe','/:id','show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x296109,_0xfb731b){var _0x2571a6=function(_0x24e3ff){while(--_0x24e3ff){_0x296109['push'](_0x296109['shift']());}};_0x2571a6(++_0xfb731b);}(_0xb116,0x15b));var _0x6b11=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xb116[_0x5c6299];return _0x23b564;};'use strict';var multer=require(_0x6b11('0x0'));var util=require('util');var path=require(_0x6b11('0x1'));var timeout=require(_0x6b11('0x2'));var express=require(_0x6b11('0x3'));var router=express[_0x6b11('0x4')]();var fs_extra=require(_0x6b11('0x5'));var auth=require(_0x6b11('0x6'));var interaction=require(_0x6b11('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x6b11('0x8')]('/',auth[_0x6b11('0x9')](),controller['index']);router[_0x6b11('0x8')](_0x6b11('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6b11('0x8')](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller[_0x6b11('0xc')]);router[_0x6b11('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller[_0x6b11('0xe')]);router[_0x6b11('0xf')](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller['destroy']);module[_0x6b11('0x10')]=router; \ No newline at end of file +var _0x9f72=['fs-extra','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x594982,_0x503f43){var _0x255655=function(_0x435c47){while(--_0x435c47){_0x594982['push'](_0x594982['shift']());}};_0x255655(++_0x503f43);}(_0x9f72,0x1c3));var _0x29f7=function(_0x3325aa,_0x3b4b29){_0x3325aa=_0x3325aa-0x0;var _0x77e17a=_0x9f72[_0x3325aa];return _0x77e17a;};'use strict';var multer=require(_0x29f7('0x0'));var util=require('util');var path=require(_0x29f7('0x1'));var timeout=require(_0x29f7('0x2'));var express=require(_0x29f7('0x3'));var router=express[_0x29f7('0x4')]();var fs_extra=require(_0x29f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x29f7('0x6'));var config=require('../../config/environment');var controller=require(_0x29f7('0x7'));router[_0x29f7('0x8')]('/',auth[_0x29f7('0x9')](),controller[_0x29f7('0xa')]);router[_0x29f7('0x8')](_0x29f7('0xb'),auth[_0x29f7('0x9')](),controller[_0x29f7('0xc')]);router[_0x29f7('0x8')]('/:id',auth[_0x29f7('0x9')](),controller[_0x29f7('0xd')]);router[_0x29f7('0xe')]('/',auth[_0x29f7('0x9')](),controller['create']);router[_0x29f7('0xf')](_0x29f7('0x10'),auth[_0x29f7('0x9')](),controller[_0x29f7('0x11')]);router['delete'](_0x29f7('0x10'),auth[_0x29f7('0x9')](),controller[_0x29f7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 383b23f..e1d7d94 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4ba3cd,_0x14752f){_0x4ba3cd=_0x4ba3cd-0x0;var _0x25dee0=_0x7a54[_0x4ba3cd];return _0x25dee0;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x48e49a,_0x5a1400){_0x48e49a=_0x48e49a-0x0;var _0x1eab9a=_0x7a54[_0x48e49a];return _0x1eab9a;};'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 7c13d4d..f036c8b 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 _0xe3c7=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','reject','save','update','then','destroy','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model'];(function(_0x591483,_0x2a82fb){var _0x31d6ea=function(_0x427f35){while(--_0x427f35){_0x591483['push'](_0x591483['shift']());}};_0x31d6ea(++_0x2a82fb);}(_0xe3c7,0x189));var _0x7e3c=function(_0x207db1,_0x19c38c){_0x207db1=_0x207db1-0x0;var _0x3744e1=_0xe3c7[_0x207db1];return _0x3744e1;};'use strict';var emlformat=require(_0x7e3c('0x0'));var rimraf=require(_0x7e3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e3c('0x2'));var moment=require(_0x7e3c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7e3c('0x4'));var util=require(_0x7e3c('0x5'));var path=require(_0x7e3c('0x6'));var sox=require(_0x7e3c('0x7'));var csv=require(_0x7e3c('0x8'));var ejs=require(_0x7e3c('0x9'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xa'));var _=require(_0x7e3c('0xb'));var squel=require(_0x7e3c('0xc'));var crypto=require(_0x7e3c('0xd'));var jsforce=require(_0x7e3c('0xe'));var deskjs=require(_0x7e3c('0xf'));var toCsv=require(_0x7e3c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e3c('0x10'));var authService=require(_0x7e3c('0x11'));var qs=require(_0x7e3c('0x12'));var as=require(_0x7e3c('0x13'));var hardwareService=require(_0x7e3c('0x14'));var logger=require(_0x7e3c('0x15'))('api');var utils=require(_0x7e3c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e3c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511296,_0xb9a247){_0xb9a247=_0xb9a247||0xcc;return function(_0x1382b8){if(_0x1382b8){return _0x511296[_0x7e3c('0x18')](_0xb9a247);}return _0x511296[_0x7e3c('0x19')](_0xb9a247)[_0x7e3c('0x1a')]();};}function respondWithResult(_0x58928e,_0x278212){_0x278212=_0x278212||0xc8;return function(_0x16b4ef){if(_0x16b4ef){return _0x58928e['status'](_0x278212)[_0x7e3c('0x1b')](_0x16b4ef);}};}function respondWithFilteredResult(_0x1aab93,_0x4e60ca){return function(_0x66677f){if(_0x66677f){var _0x21df76=typeof _0x4e60ca['offset']===_0x7e3c('0x1c')&&typeof _0x4e60ca['limit']==='undefined';var _0x56ed84=_0x66677f[_0x7e3c('0x1d')];var _0x3ea581=_0x21df76?0x0:_0x4e60ca['offset'];var _0x149f8e=_0x21df76?_0x66677f['count']:_0x4e60ca[_0x7e3c('0x1e')]+_0x4e60ca['limit'];var _0x467727;if(_0x149f8e>=_0x56ed84){_0x149f8e=_0x56ed84;_0x467727=0xc8;}else{_0x467727=0xce;}_0x1aab93[_0x7e3c('0x19')](_0x467727);return _0x1aab93[_0x7e3c('0x1f')]('Content-Range',_0x3ea581+'-'+_0x149f8e+'/'+_0x56ed84)['json'](_0x66677f);}return null;};}function patchUpdates(_0x2d0e28){return function(_0x421ede){try{jsonpatch['apply'](_0x421ede,_0x2d0e28,!![]);}catch(_0x3bfb0f){return BPromise[_0x7e3c('0x20')](_0x3bfb0f);}return _0x421ede[_0x7e3c('0x21')]();};}function saveUpdates(_0x2d7040,_0x46c388){return function(_0x5eb84f){if(_0x5eb84f){return _0x5eb84f[_0x7e3c('0x22')](_0x2d7040)[_0x7e3c('0x23')](function(_0x5c6a17){return _0x5c6a17;});}return null;};}function removeEntity(_0x3c08dd,_0x43ec5e){return function(_0x57de91){if(_0x57de91){return _0x57de91[_0x7e3c('0x24')]()[_0x7e3c('0x23')](function(){_0x3c08dd[_0x7e3c('0x19')](0xcc)[_0x7e3c('0x1a')]();});}};}function handleEntityNotFound(_0x29179e,_0x1c4edc){return function(_0x1f7efe){if(!_0x1f7efe){_0x29179e[_0x7e3c('0x18')](0x194);}return _0x1f7efe;};}function handleError(_0x5c95ef,_0x1efa21){_0x1efa21=_0x1efa21||0x1f4;return function(_0x1a6dfe){logger['error'](_0x1a6dfe['stack']);if(_0x1a6dfe[_0x7e3c('0x25')]){delete _0x1a6dfe[_0x7e3c('0x25')];}_0x5c95ef[_0x7e3c('0x19')](_0x1efa21)[_0x7e3c('0x26')](_0x1a6dfe);};}exports['index']=function(_0x566c0b,_0x191a2d){var _0x4ed52f={},_0xbbfc5d={},_0x498695={'count':0x0,'rows':[]};var _0x325876=_[_0x7e3c('0x27')](db[_0x7e3c('0x28')][_0x7e3c('0x29')],function(_0x39478d){return{'name':_0x39478d[_0x7e3c('0x2a')],'type':_0x39478d['type'][_0x7e3c('0x2b')]};});_0xbbfc5d[_0x7e3c('0x2c')]=_[_0x7e3c('0x27')](_0x325876,'name');_0xbbfc5d[_0x7e3c('0x2d')]=_[_0x7e3c('0x2e')](_0x566c0b[_0x7e3c('0x2d')]);_0xbbfc5d[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0xbbfc5d['model'],_0xbbfc5d['query']);_0x4ed52f[_0x7e3c('0x31')]=_[_0x7e3c('0x30')](_0xbbfc5d[_0x7e3c('0x2c')],qs[_0x7e3c('0x32')](_0x566c0b['query']['fields']));_0x4ed52f['attributes']=_0x4ed52f[_0x7e3c('0x31')][_0x7e3c('0x33')]?_0x4ed52f[_0x7e3c('0x31')]:_0xbbfc5d['model'];if(!_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x34')](_0x7e3c('0x35'))){_0x4ed52f[_0x7e3c('0x36')]=qs[_0x7e3c('0x36')](_0x566c0b[_0x7e3c('0x2d')]['limit']);_0x4ed52f[_0x7e3c('0x1e')]=qs[_0x7e3c('0x1e')](_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x1e')]);}_0x4ed52f[_0x7e3c('0x37')]=qs[_0x7e3c('0x38')](_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x38')]);_0x4ed52f['where']=qs[_0x7e3c('0x2f')](_[_0x7e3c('0x39')](_0x566c0b['query'],_0xbbfc5d[_0x7e3c('0x2f')]),_0x325876);if(_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x3a')]){_0x4ed52f[_0x7e3c('0x3b')]=_[_0x7e3c('0x3c')](_0x4ed52f[_0x7e3c('0x3b')],{'$or':_[_0x7e3c('0x27')](_0x325876,function(_0x324862){if(_0x324862[_0x7e3c('0x3d')]!==_0x7e3c('0x3e')){var _0x1f95b7={};_0x1f95b7[_0x324862['name']]={'$like':'%'+_0x566c0b[_0x7e3c('0x2d')]['filter']+'%'};return _0x1f95b7;}})});}_0x4ed52f=_[_0x7e3c('0x3c')]({},_0x4ed52f,_0x566c0b[_0x7e3c('0x3f')]);var _0x200782={'where':_0x4ed52f[_0x7e3c('0x3b')]};return db['JscriptyQuestionReport']['count'](_0x200782)[_0x7e3c('0x23')](function(_0x19934d){_0x498695['count']=_0x19934d;if(_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x40')]){_0x4ed52f[_0x7e3c('0x41')]=[{'all':!![]}];}return db[_0x7e3c('0x28')][_0x7e3c('0x42')](_0x4ed52f);})['then'](function(_0x212736){_0x498695['rows']=_0x212736;return _0x498695;})[_0x7e3c('0x23')](respondWithFilteredResult(_0x191a2d,_0x4ed52f))[_0x7e3c('0x43')](handleError(_0x191a2d,null));};exports['show']=function(_0x3e71fa,_0x30c920){var _0x2fd4aa={'raw':!![],'where':{'id':_0x3e71fa[_0x7e3c('0x44')]['id']}},_0x3b1b40={};_0x3b1b40[_0x7e3c('0x2c')]=_[_0x7e3c('0x2e')](db['JscriptyQuestionReport'][_0x7e3c('0x29')]);_0x3b1b40[_0x7e3c('0x2d')]=_[_0x7e3c('0x2e')](_0x3e71fa[_0x7e3c('0x2d')]);_0x3b1b40[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0x3b1b40['model'],_0x3b1b40[_0x7e3c('0x2d')]);_0x2fd4aa[_0x7e3c('0x31')]=_['intersection'](_0x3b1b40[_0x7e3c('0x2c')],qs[_0x7e3c('0x32')](_0x3e71fa[_0x7e3c('0x2d')][_0x7e3c('0x32')]));_0x2fd4aa[_0x7e3c('0x31')]=_0x2fd4aa[_0x7e3c('0x31')][_0x7e3c('0x33')]?_0x2fd4aa['attributes']:_0x3b1b40[_0x7e3c('0x2c')];if(_0x3e71fa[_0x7e3c('0x2d')][_0x7e3c('0x40')]){_0x2fd4aa[_0x7e3c('0x41')]=[{'all':!![]}];}_0x2fd4aa=_['merge']({},_0x2fd4aa,_0x3e71fa[_0x7e3c('0x3f')]);return db[_0x7e3c('0x28')][_0x7e3c('0x45')](_0x2fd4aa)['then'](handleEntityNotFound(_0x30c920,null))[_0x7e3c('0x23')](respondWithResult(_0x30c920,null))[_0x7e3c('0x43')](handleError(_0x30c920,null));};exports[_0x7e3c('0x46')]=function(_0x338c81,_0x19267b){return db['JscriptyQuestionReport'][_0x7e3c('0x46')](_0x338c81[_0x7e3c('0x47')],{})[_0x7e3c('0x23')](respondWithResult(_0x19267b,0xc9))[_0x7e3c('0x43')](handleError(_0x19267b,null));};exports[_0x7e3c('0x22')]=function(_0x57cdba,_0x3040e1){if(_0x57cdba['body']['id']){delete _0x57cdba[_0x7e3c('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x7e3c('0x45')]({'where':{'id':_0x57cdba[_0x7e3c('0x44')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x3040e1,null))['then'](saveUpdates(_0x57cdba[_0x7e3c('0x47')],null))[_0x7e3c('0x23')](respondWithResult(_0x3040e1,null))['catch'](handleError(_0x3040e1,null));};exports[_0x7e3c('0x24')]=function(_0x453ce9,_0x2ddc5e){return db['JscriptyQuestionReport'][_0x7e3c('0x45')]({'where':{'id':_0x453ce9['params']['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x2ddc5e,null))[_0x7e3c('0x23')](removeEntity(_0x2ddc5e,null))[_0x7e3c('0x43')](handleError(_0x2ddc5e,null));};exports['describe']=function(_0x4a97cc,_0x31ad30){return db[_0x7e3c('0x28')][_0x7e3c('0x48')]()['then'](respondWithResult(_0x31ad30,null))[_0x7e3c('0x43')](handleError(_0x31ad30,null));}; \ No newline at end of file +var _0x70de=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','JscriptyQuestionReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','include','rows','params','find','create','body','catch','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x57739d,_0x479688){var _0x384591=function(_0x412688){while(--_0x412688){_0x57739d['push'](_0x57739d['shift']());}};_0x384591(++_0x479688);}(_0x70de,0x165));var _0xe70d=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x70de[_0x13843f];return _0x1063ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe70d('0x0'));var zipdir=require(_0xe70d('0x1'));var jsonpatch=require(_0xe70d('0x2'));var rp=require(_0xe70d('0x3'));var moment=require(_0xe70d('0x4'));var BPromise=require(_0xe70d('0x5'));var Mustache=require(_0xe70d('0x6'));var util=require('util');var path=require(_0xe70d('0x7'));var sox=require(_0xe70d('0x8'));var csv=require(_0xe70d('0x9'));var ejs=require(_0xe70d('0xa'));var fs=require('fs');var fs_extra=require(_0xe70d('0xb'));var _=require(_0xe70d('0xc'));var squel=require('squel');var crypto=require(_0xe70d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe70d('0xe'));var toCsv=require(_0xe70d('0x9'));var querystring=require(_0xe70d('0xf'));var Papa=require(_0xe70d('0x10'));var Redis=require(_0xe70d('0x11'));var authService=require(_0xe70d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe70d('0x13'));var logger=require(_0xe70d('0x14'))(_0xe70d('0x15'));var utils=require('../../config/utils');var config=require(_0xe70d('0x16'));var licenseUtil=require(_0xe70d('0x17'));var db=require(_0xe70d('0x18'))['db'];function respondWithStatusCode(_0x37df3f,_0x4cb0a5){_0x4cb0a5=_0x4cb0a5||0xcc;return function(_0x5bf041){if(_0x5bf041){return _0x37df3f[_0xe70d('0x19')](_0x4cb0a5);}return _0x37df3f[_0xe70d('0x1a')](_0x4cb0a5)[_0xe70d('0x1b')]();};}function respondWithResult(_0x1ee1e9,_0x3c547d){_0x3c547d=_0x3c547d||0xc8;return function(_0x47826d){if(_0x47826d){return _0x1ee1e9['status'](_0x3c547d)[_0xe70d('0x1c')](_0x47826d);}};}function respondWithFilteredResult(_0x21f3b7,_0xe7784f){return function(_0x3a631e){if(_0x3a631e){var _0x582765=typeof _0xe7784f[_0xe70d('0x1d')]===_0xe70d('0x1e')&&typeof _0xe7784f[_0xe70d('0x1f')]===_0xe70d('0x1e');var _0x186c8d=_0x3a631e[_0xe70d('0x20')];var _0x5cced2=_0x582765?0x0:_0xe7784f[_0xe70d('0x1d')];var _0x5ab687=_0x582765?_0x3a631e[_0xe70d('0x20')]:_0xe7784f[_0xe70d('0x1d')]+_0xe7784f['limit'];var _0x2e1996;if(_0x5ab687>=_0x186c8d){_0x5ab687=_0x186c8d;_0x2e1996=0xc8;}else{_0x2e1996=0xce;}_0x21f3b7[_0xe70d('0x1a')](_0x2e1996);return _0x21f3b7[_0xe70d('0x21')](_0xe70d('0x22'),_0x5cced2+'-'+_0x5ab687+'/'+_0x186c8d)[_0xe70d('0x1c')](_0x3a631e);}return null;};}function patchUpdates(_0x16d742){return function(_0x4de931){try{jsonpatch[_0xe70d('0x23')](_0x4de931,_0x16d742,!![]);}catch(_0x11357e){return BPromise[_0xe70d('0x24')](_0x11357e);}return _0x4de931[_0xe70d('0x25')]();};}function saveUpdates(_0x22fa3b,_0xab69f5){return function(_0x11d871){if(_0x11d871){return _0x11d871[_0xe70d('0x26')](_0x22fa3b)[_0xe70d('0x27')](function(_0x4934df){return _0x4934df;});}return null;};}function removeEntity(_0x3450c4,_0x56c3db){return function(_0x4f2ce6){if(_0x4f2ce6){return _0x4f2ce6['destroy']()[_0xe70d('0x27')](function(){_0x3450c4[_0xe70d('0x1a')](0xcc)[_0xe70d('0x1b')]();});}};}function handleEntityNotFound(_0x20ef9a,_0x3628b2){return function(_0xd852d5){if(!_0xd852d5){_0x20ef9a[_0xe70d('0x19')](0x194);}return _0xd852d5;};}function handleError(_0x3184b5,_0x2bcd20){_0x2bcd20=_0x2bcd20||0x1f4;return function(_0x3a3830){logger[_0xe70d('0x28')](_0x3a3830[_0xe70d('0x29')]);if(_0x3a3830[_0xe70d('0x2a')]){delete _0x3a3830[_0xe70d('0x2a')];}_0x3184b5[_0xe70d('0x1a')](_0x2bcd20)['send'](_0x3a3830);};}exports[_0xe70d('0x2b')]=function(_0x3ca22e,_0x2136f8){var _0x3886a5={},_0x3f2a80={},_0x5bc08e={'count':0x0,'rows':[]};var _0x320ee9=_['map'](db[_0xe70d('0x2c')][_0xe70d('0x2d')],function(_0xa5ac44){return{'name':_0xa5ac44['fieldName'],'type':_0xa5ac44['type'][_0xe70d('0x2e')]};});_0x3f2a80[_0xe70d('0x2f')]=_[_0xe70d('0x30')](_0x320ee9,_0xe70d('0x2a'));_0x3f2a80[_0xe70d('0x31')]=_[_0xe70d('0x32')](_0x3ca22e[_0xe70d('0x31')]);_0x3f2a80[_0xe70d('0x33')]=_[_0xe70d('0x34')](_0x3f2a80['model'],_0x3f2a80['query']);_0x3886a5[_0xe70d('0x35')]=_[_0xe70d('0x34')](_0x3f2a80[_0xe70d('0x2f')],qs[_0xe70d('0x36')](_0x3ca22e[_0xe70d('0x31')][_0xe70d('0x36')]));_0x3886a5['attributes']=_0x3886a5[_0xe70d('0x35')][_0xe70d('0x37')]?_0x3886a5[_0xe70d('0x35')]:_0x3f2a80[_0xe70d('0x2f')];if(!_0x3ca22e['query'][_0xe70d('0x38')](_0xe70d('0x39'))){_0x3886a5[_0xe70d('0x1f')]=qs[_0xe70d('0x1f')](_0x3ca22e[_0xe70d('0x31')]['limit']);_0x3886a5[_0xe70d('0x1d')]=qs['offset'](_0x3ca22e['query'][_0xe70d('0x1d')]);}_0x3886a5[_0xe70d('0x3a')]=qs[_0xe70d('0x3b')](_0x3ca22e[_0xe70d('0x31')]['sort']);_0x3886a5[_0xe70d('0x3c')]=qs[_0xe70d('0x33')](_['pick'](_0x3ca22e[_0xe70d('0x31')],_0x3f2a80[_0xe70d('0x33')]),_0x320ee9);if(_0x3ca22e[_0xe70d('0x31')][_0xe70d('0x3d')]){_0x3886a5['where']=_[_0xe70d('0x3e')](_0x3886a5['where'],{'$or':_[_0xe70d('0x30')](_0x320ee9,function(_0x359da6){if(_0x359da6[_0xe70d('0x3f')]!=='VIRTUAL'){var _0x4ff3f6={};_0x4ff3f6[_0x359da6['name']]={'$like':'%'+_0x3ca22e['query'][_0xe70d('0x3d')]+'%'};return _0x4ff3f6;}})});}_0x3886a5=_[_0xe70d('0x3e')]({},_0x3886a5,_0x3ca22e[_0xe70d('0x40')]);var _0x15d0a0={'where':_0x3886a5[_0xe70d('0x3c')]};return db[_0xe70d('0x2c')][_0xe70d('0x20')](_0x15d0a0)['then'](function(_0x3efd96){_0x5bc08e[_0xe70d('0x20')]=_0x3efd96;if(_0x3ca22e[_0xe70d('0x31')]['includeAll']){_0x3886a5[_0xe70d('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3886a5);})[_0xe70d('0x27')](function(_0x598058){_0x5bc08e[_0xe70d('0x42')]=_0x598058;return _0x5bc08e;})['then'](respondWithFilteredResult(_0x2136f8,_0x3886a5))['catch'](handleError(_0x2136f8,null));};exports['show']=function(_0x12b449,_0x117cd3){var _0x1d9132={'raw':!![],'where':{'id':_0x12b449[_0xe70d('0x43')]['id']}},_0x45b41e={};_0x45b41e['model']=_[_0xe70d('0x32')](db[_0xe70d('0x2c')][_0xe70d('0x2d')]);_0x45b41e[_0xe70d('0x31')]=_['keys'](_0x12b449[_0xe70d('0x31')]);_0x45b41e['filters']=_['intersection'](_0x45b41e['model'],_0x45b41e[_0xe70d('0x31')]);_0x1d9132[_0xe70d('0x35')]=_[_0xe70d('0x34')](_0x45b41e[_0xe70d('0x2f')],qs['fields'](_0x12b449['query']['fields']));_0x1d9132[_0xe70d('0x35')]=_0x1d9132[_0xe70d('0x35')][_0xe70d('0x37')]?_0x1d9132[_0xe70d('0x35')]:_0x45b41e[_0xe70d('0x2f')];if(_0x12b449['query']['includeAll']){_0x1d9132[_0xe70d('0x41')]=[{'all':!![]}];}_0x1d9132=_[_0xe70d('0x3e')]({},_0x1d9132,_0x12b449[_0xe70d('0x40')]);return db['JscriptyQuestionReport'][_0xe70d('0x44')](_0x1d9132)['then'](handleEntityNotFound(_0x117cd3,null))[_0xe70d('0x27')](respondWithResult(_0x117cd3,null))['catch'](handleError(_0x117cd3,null));};exports['create']=function(_0x3b211e,_0x2c1be8){return db[_0xe70d('0x2c')][_0xe70d('0x45')](_0x3b211e[_0xe70d('0x46')],{})[_0xe70d('0x27')](respondWithResult(_0x2c1be8,0xc9))['catch'](handleError(_0x2c1be8,null));};exports[_0xe70d('0x26')]=function(_0x4aa958,_0x499374){if(_0x4aa958['body']['id']){delete _0x4aa958[_0xe70d('0x46')]['id'];}return db[_0xe70d('0x2c')][_0xe70d('0x44')]({'where':{'id':_0x4aa958[_0xe70d('0x43')]['id']}})[_0xe70d('0x27')](handleEntityNotFound(_0x499374,null))[_0xe70d('0x27')](saveUpdates(_0x4aa958[_0xe70d('0x46')],null))[_0xe70d('0x27')](respondWithResult(_0x499374,null))[_0xe70d('0x47')](handleError(_0x499374,null));};exports[_0xe70d('0x48')]=function(_0x2c3847,_0x3065b8){return db[_0xe70d('0x2c')][_0xe70d('0x44')]({'where':{'id':_0x2c3847[_0xe70d('0x43')]['id']}})[_0xe70d('0x27')](handleEntityNotFound(_0x3065b8,null))['then'](removeEntity(_0x3065b8,null))[_0xe70d('0x47')](handleError(_0x3065b8,null));};exports[_0xe70d('0x49')]=function(_0x2e386b,_0x3a5bb0){return db[_0xe70d('0x2c')][_0xe70d('0x49')]()['then'](respondWithResult(_0x3a5bb0,null))['catch'](handleError(_0x3a5bb0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d9c7fe2..380ca6f 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 _0x06b9=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','request-promise','path','rimraf'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x06b9,0x132));var _0x906b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x906b('0x0'));var util=require(_0x906b('0x1'));var logger=require('../../config/logger')(_0x906b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x906b('0x3'));var fs=require('fs');var path=require(_0x906b('0x4'));var rimraf=require(_0x906b('0x5'));var config=require(_0x906b('0x6'));var attributes=require(_0x906b('0x7'));module[_0x906b('0x8')]=function(_0x5bf8ce,_0x360a8c){return _0x5bf8ce[_0x906b('0x9')](_0x906b('0xa'),attributes,{'tableName':_0x906b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb448=['report_jscripty_questions','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport'];(function(_0x3e2cfe,_0x516d5c){var _0x31e56f=function(_0xbc1f72){while(--_0xbc1f72){_0x3e2cfe['push'](_0x3e2cfe['shift']());}};_0x31e56f(++_0x516d5c);}(_0xb448,0xbe));var _0x8b44=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb448[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x8b44('0x0'));var util=require('util');var logger=require(_0x8b44('0x1'))('api');var moment=require(_0x8b44('0x2'));var BPromise=require(_0x8b44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b44('0x4'));var config=require(_0x8b44('0x5'));var attributes=require(_0x8b44('0x6'));module['exports']=function(_0x3931e2,_0x27561e){return _0x3931e2['define'](_0x8b44('0x7'),attributes,{'tableName':_0x8b44('0x8'),'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 0d1fc82..5d9e844 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 _0xd63e=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x4bbf42,_0x4f02dd){var _0x1ce85e=function(_0x463e0e){while(--_0x463e0e){_0x4bbf42['push'](_0x4bbf42['shift']());}};_0x1ce85e(++_0x4f02dd);}(_0xd63e,0xe4));var _0xed63=function(_0x47e780,_0x52a8be){_0x47e780=_0x47e780-0x0;var _0x218c69=_0xd63e[_0x47e780];return _0x218c69;};'use strict';var _=require(_0xed63('0x0'));var util=require('util');var moment=require(_0xed63('0x1'));var BPromise=require(_0xed63('0x2'));var rs=require(_0xed63('0x3'));var fs=require('fs');var Redis=require(_0xed63('0x4'));var db=require(_0xed63('0x5'))['db'];var utils=require(_0xed63('0x6'));var logger=require(_0xed63('0x7'))(_0xed63('0x8'));var config=require(_0xed63('0x9'));var jayson=require(_0xed63('0xa'));var client=jayson[_0xed63('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2e93,_0x3983a4,_0xb1a862){return new BPromise(function(_0x23a935,_0x39fa94){return client[_0xed63('0xc')](_0x4e2e93,_0xb1a862)['then'](function(_0x480286){logger[_0xed63('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3983a4,_0xed63('0xe'));logger[_0xed63('0xf')](_0xed63('0x10'),_0x3983a4,'request\x20sent',JSON[_0xed63('0x11')](_0x480286));if(_0x480286[_0xed63('0x12')]){if(_0x480286[_0xed63('0x12')][_0xed63('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3983a4,_0x480286[_0xed63('0x12')][_0xed63('0x14')]);return _0x39fa94(_0x480286['error']['message']);}logger[_0xed63('0x12')](_0xed63('0x15'),_0x3983a4,_0x480286['error']['message']);return _0x23a935(_0x480286[_0xed63('0x12')]['message']);}else{logger[_0xed63('0xd')](_0xed63('0x15'),_0x3983a4,'request\x20sent');_0x23a935(_0x480286['result'][_0xed63('0x14')]);}})['catch'](function(_0x32796a){logger[_0xed63('0x12')](_0xed63('0x15'),_0x3983a4,_0x32796a);_0x39fa94(_0x32796a);});});} \ No newline at end of file +var _0xc95e=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc95e,0x81));var _0xec95=function(_0x44913c,_0x754aad){_0x44913c=_0x44913c-0x0;var _0x4b7ca2=_0xc95e[_0x44913c];return _0x4b7ca2;};'use strict';var _=require(_0xec95('0x0'));var util=require(_0xec95('0x1'));var moment=require(_0xec95('0x2'));var BPromise=require(_0xec95('0x3'));var rs=require(_0xec95('0x4'));var fs=require('fs');var Redis=require(_0xec95('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec95('0x6'));var logger=require(_0xec95('0x7'))('rpc');var config=require(_0xec95('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45493d,_0x2700ad,_0x109c5b){return new BPromise(function(_0x855721,_0x51f311){return client[_0xec95('0x9')](_0x45493d,_0x109c5b)[_0xec95('0xa')](function(_0x1835cc){logger[_0xec95('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2700ad,'request\x20sent');logger['debug'](_0xec95('0xc'),_0x2700ad,_0xec95('0xd'),JSON['stringify'](_0x1835cc));if(_0x1835cc['error']){if(_0x1835cc[_0xec95('0xe')][_0xec95('0xf')]===0x1f4){logger[_0xec95('0xe')](_0xec95('0x10'),_0x2700ad,_0x1835cc[_0xec95('0xe')][_0xec95('0x11')]);return _0x51f311(_0x1835cc['error']['message']);}logger[_0xec95('0xe')](_0xec95('0x10'),_0x2700ad,_0x1835cc['error'][_0xec95('0x11')]);return _0x855721(_0x1835cc[_0xec95('0xe')][_0xec95('0x11')]);}else{logger[_0xec95('0xb')](_0xec95('0x10'),_0x2700ad,_0xec95('0xd'));_0x855721(_0x1835cc['result'][_0xec95('0x11')]);}})[_0xec95('0x12')](function(_0x2a8864){logger[_0xec95('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2700ad,_0x2a8864);_0x51f311(_0x2a8864);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8f5947a..abaaf79 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 _0x6285=['isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','put','update','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x46075c,_0x1befde){var _0x46147d=function(_0xdd64fc){while(--_0xdd64fc){_0x46075c['push'](_0x46075c['shift']());}};_0x46147d(++_0x1befde);}(_0x6285,0x14d));var _0x5628=function(_0x5ea320,_0x10d82e){_0x5ea320=_0x5ea320-0x0;var _0x52ff1f=_0x6285[_0x5ea320];return _0x52ff1f;};'use strict';var multer=require('multer');var util=require(_0x5628('0x0'));var path=require(_0x5628('0x1'));var timeout=require(_0x5628('0x2'));var express=require(_0x5628('0x3'));var router=express['Router']();var fs_extra=require(_0x5628('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5628('0x5'));var config=require(_0x5628('0x6'));var controller=require(_0x5628('0x7'));router[_0x5628('0x8')]('/',auth[_0x5628('0x9')](),controller[_0x5628('0xa')]);router[_0x5628('0x8')](_0x5628('0xb'),auth['isAuthenticated'](),controller[_0x5628('0xc')]);router[_0x5628('0x8')](_0x5628('0xd'),auth[_0x5628('0x9')](),controller[_0x5628('0xe')]);router[_0x5628('0x8')](_0x5628('0xf'),auth[_0x5628('0x9')](),controller['getQuestions']);router[_0x5628('0x10')]('/',auth[_0x5628('0x9')](),controller['create']);router[_0x5628('0x11')](_0x5628('0xd'),auth[_0x5628('0x9')](),controller[_0x5628('0x12')]);router['delete'](_0x5628('0xd'),auth[_0x5628('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd189=['show','/:id/questions','getQuestions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xd189,0x169));var _0x9d18=function(_0x4ffe6a,_0x499196){_0x4ffe6a=_0x4ffe6a-0x0;var _0x4b2fbf=_0xd189[_0x4ffe6a];return _0x4b2fbf;};'use strict';var multer=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var path=require(_0x9d18('0x2'));var timeout=require(_0x9d18('0x3'));var express=require('express');var router=express[_0x9d18('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d18('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d18('0x6'));var controller=require(_0x9d18('0x7'));router[_0x9d18('0x8')]('/',auth[_0x9d18('0x9')](),controller[_0x9d18('0xa')]);router[_0x9d18('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9d18('0xb')]);router['get'](_0x9d18('0xc'),auth[_0x9d18('0x9')](),controller[_0x9d18('0xd')]);router[_0x9d18('0x8')](_0x9d18('0xe'),auth[_0x9d18('0x9')](),controller[_0x9d18('0xf')]);router[_0x9d18('0x10')]('/',auth[_0x9d18('0x9')](),controller[_0x9d18('0x11')]);router[_0x9d18('0x12')](_0x9d18('0xc'),auth[_0x9d18('0x9')](),controller[_0x9d18('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9d18('0x14')]);module[_0x9d18('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 38e106d..a40e159 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 _0x9096=['STRING','BOOLEAN','setDataValue','starttime','format','DATE'];(function(_0x30ea90,_0x12f157){var _0x3b0a93=function(_0x3ba21a){while(--_0x3ba21a){_0x30ea90['push'](_0x30ea90['shift']());}};_0x3b0a93(++_0x12f157);}(_0x9096,0x176));var _0x6909=function(_0x56f92c,_0x1275f1){_0x56f92c=_0x56f92c-0x0;var _0x151e03=_0x9096[_0x56f92c];return _0x151e03;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5232c3){this[_0x6909('0x0')](_0x6909('0x1'),_0x5232c3);this['setDataValue']('endtime',moment()[_0x6909('0x2')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x6909('0x3')]},'membername':{'type':Sequelize[_0x6909('0x4')]},'projectname':{'type':Sequelize[_0x6909('0x4')]},'queue':{'type':Sequelize[_0x6909('0x4')]},'uniqueid':{'type':Sequelize[_0x6909('0x4')]},'calleridname':{'type':Sequelize[_0x6909('0x4')]},'calleridnum':{'type':Sequelize[_0x6909('0x4')]},'completed':{'type':Sequelize[_0x6909('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ccc=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','starttime','setDataValue'];(function(_0x3a9e42,_0x32da0b){var _0xb60de2=function(_0x2b1820){while(--_0x2b1820){_0x3a9e42['push'](_0x3a9e42['shift']());}};_0xb60de2(++_0x32da0b);}(_0x9ccc,0x11b));var _0xc9cc=function(_0x463cbd,_0x2dda5a){_0x463cbd=_0x463cbd-0x0;var _0x3fe838=_0x9ccc[_0x463cbd];return _0x3fe838;};'use strict';var moment=require(_0xc9cc('0x0'));var Sequelize=require(_0xc9cc('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xc9cc('0x2')],'set':function(_0x183a1a){this['setDataValue'](_0xc9cc('0x3'),_0x183a1a);this[_0xc9cc('0x4')]('endtime',moment()[_0xc9cc('0x5')](_0xc9cc('0x6')));}},'endtime':{'type':Sequelize[_0xc9cc('0x2')]},'membername':{'type':Sequelize[_0xc9cc('0x7')]},'projectname':{'type':Sequelize[_0xc9cc('0x7')]},'queue':{'type':Sequelize[_0xc9cc('0x7')]},'uniqueid':{'type':Sequelize[_0xc9cc('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc9cc('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 94a1aa1..b33757c 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 _0xc535=['create','body','describe','getQuestions','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','name','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x3ab77c,_0x57f557){var _0x35e4f3=function(_0xb9a8d0){while(--_0xb9a8d0){_0x3ab77c['push'](_0x3ab77c['shift']());}};_0x35e4f3(++_0x57f557);}(_0xc535,0x9b));var _0x5c53=function(_0x816052,_0x13cd7b){_0x816052=_0x816052-0x0;var _0x582c1e=_0xc535[_0x816052];return _0x582c1e;};'use strict';var emlformat=require(_0x5c53('0x0'));var rimraf=require(_0x5c53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5c53('0x2'));var moment=require('moment');var BPromise=require(_0x5c53('0x3'));var Mustache=require('mustache');var util=require(_0x5c53('0x4'));var path=require(_0x5c53('0x5'));var sox=require(_0x5c53('0x6'));var csv=require(_0x5c53('0x7'));var ejs=require(_0x5c53('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c53('0x9'));var squel=require('squel');var crypto=require(_0x5c53('0xa'));var jsforce=require(_0x5c53('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5c53('0x7'));var querystring=require(_0x5c53('0xc'));var Papa=require(_0x5c53('0xd'));var Redis=require(_0x5c53('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5c53('0xf'));var as=require(_0x5c53('0x10'));var hardwareService=require(_0x5c53('0x11'));var logger=require('../../config/logger')(_0x5c53('0x12'));var utils=require(_0x5c53('0x13'));var config=require(_0x5c53('0x14'));var licenseUtil=require(_0x5c53('0x15'));var db=require(_0x5c53('0x16'))['db'];function respondWithStatusCode(_0x22303e,_0x3b418e){_0x3b418e=_0x3b418e||0xcc;return function(_0x306183){if(_0x306183){return _0x22303e[_0x5c53('0x17')](_0x3b418e);}return _0x22303e[_0x5c53('0x18')](_0x3b418e)[_0x5c53('0x19')]();};}function respondWithResult(_0x31435d,_0x19de84){_0x19de84=_0x19de84||0xc8;return function(_0x215ba5){if(_0x215ba5){return _0x31435d['status'](_0x19de84)['json'](_0x215ba5);}};}function respondWithFilteredResult(_0x43a995,_0x281003){return function(_0x5addeb){if(_0x5addeb){var _0x4f1ce1=typeof _0x281003[_0x5c53('0x1a')]===_0x5c53('0x1b')&&typeof _0x281003[_0x5c53('0x1c')]===_0x5c53('0x1b');var _0x1ef806=_0x5addeb[_0x5c53('0x1d')];var _0x817247=_0x4f1ce1?0x0:_0x281003[_0x5c53('0x1a')];var _0x4d6ffc=_0x4f1ce1?_0x5addeb[_0x5c53('0x1d')]:_0x281003['offset']+_0x281003[_0x5c53('0x1c')];var _0x2df8ab;if(_0x4d6ffc>=_0x1ef806){_0x4d6ffc=_0x1ef806;_0x2df8ab=0xc8;}else{_0x2df8ab=0xce;}_0x43a995[_0x5c53('0x18')](_0x2df8ab);return _0x43a995[_0x5c53('0x1e')](_0x5c53('0x1f'),_0x817247+'-'+_0x4d6ffc+'/'+_0x1ef806)[_0x5c53('0x20')](_0x5addeb);}return null;};}function patchUpdates(_0x24c6fe){return function(_0x1c623a){try{jsonpatch['apply'](_0x1c623a,_0x24c6fe,!![]);}catch(_0x2c5ccc){return BPromise['reject'](_0x2c5ccc);}return _0x1c623a[_0x5c53('0x21')]();};}function saveUpdates(_0x43941d,_0x193f40){return function(_0x205d32){if(_0x205d32){return _0x205d32[_0x5c53('0x22')](_0x43941d)[_0x5c53('0x23')](function(_0x3a7589){return _0x3a7589;});}return null;};}function removeEntity(_0x1e49fe,_0x3bc39d){return function(_0x2b1959){if(_0x2b1959){return _0x2b1959[_0x5c53('0x24')]()[_0x5c53('0x23')](function(){_0x1e49fe[_0x5c53('0x18')](0xcc)[_0x5c53('0x19')]();});}};}function handleEntityNotFound(_0x14a7cc,_0x16d62c){return function(_0x524494){if(!_0x524494){_0x14a7cc[_0x5c53('0x17')](0x194);}return _0x524494;};}function handleError(_0x513b1a,_0x589e99){_0x589e99=_0x589e99||0x1f4;return function(_0x15e147){logger['error'](_0x15e147['stack']);if(_0x15e147[_0x5c53('0x25')]){delete _0x15e147['name'];}_0x513b1a['status'](_0x589e99)['send'](_0x15e147);};}exports['index']=function(_0x4db171,_0x2862e5){var _0x27c5f5={},_0x254029={},_0x1cccc6={'count':0x0,'rows':[]};var _0x537812=_[_0x5c53('0x26')](db[_0x5c53('0x27')][_0x5c53('0x28')],function(_0x5b476e){return{'name':_0x5b476e[_0x5c53('0x29')],'type':_0x5b476e[_0x5c53('0x2a')]['key']};});_0x254029[_0x5c53('0x2b')]=_[_0x5c53('0x26')](_0x537812,_0x5c53('0x25'));_0x254029[_0x5c53('0x2c')]=_[_0x5c53('0x2d')](_0x4db171['query']);_0x254029[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x254029[_0x5c53('0x2b')],_0x254029[_0x5c53('0x2c')]);_0x27c5f5[_0x5c53('0x30')]=_[_0x5c53('0x2f')](_0x254029[_0x5c53('0x2b')],qs[_0x5c53('0x31')](_0x4db171['query'][_0x5c53('0x31')]));_0x27c5f5[_0x5c53('0x30')]=_0x27c5f5[_0x5c53('0x30')]['length']?_0x27c5f5[_0x5c53('0x30')]:_0x254029[_0x5c53('0x2b')];if(!_0x4db171[_0x5c53('0x2c')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x27c5f5['limit']=qs[_0x5c53('0x1c')](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x1c')]);_0x27c5f5[_0x5c53('0x1a')]=qs[_0x5c53('0x1a')](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x1a')]);}_0x27c5f5[_0x5c53('0x34')]=qs['sort'](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x35')]);_0x27c5f5['where']=qs[_0x5c53('0x2e')](_['pick'](_0x4db171['query'],_0x254029[_0x5c53('0x2e')]),_0x537812);if(_0x4db171['query'][_0x5c53('0x36')]){_0x27c5f5[_0x5c53('0x37')]=_[_0x5c53('0x38')](_0x27c5f5[_0x5c53('0x37')],{'$or':_[_0x5c53('0x26')](_0x537812,function(_0x145a18){if(_0x145a18[_0x5c53('0x2a')]!==_0x5c53('0x39')){var _0x7e6bf4={};_0x7e6bf4[_0x145a18[_0x5c53('0x25')]]={'$like':'%'+_0x4db171['query'][_0x5c53('0x36')]+'%'};return _0x7e6bf4;}})});}_0x27c5f5=_[_0x5c53('0x38')]({},_0x27c5f5,_0x4db171[_0x5c53('0x3a')]);var _0x2dce6d={'where':_0x27c5f5[_0x5c53('0x37')]};return db[_0x5c53('0x27')][_0x5c53('0x1d')](_0x2dce6d)[_0x5c53('0x23')](function(_0x3bf18c){_0x1cccc6[_0x5c53('0x1d')]=_0x3bf18c;if(_0x4db171[_0x5c53('0x2c')][_0x5c53('0x3b')]){_0x27c5f5['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x5c53('0x3c')](_0x27c5f5);})[_0x5c53('0x23')](function(_0x6b30b4){_0x1cccc6[_0x5c53('0x3d')]=_0x6b30b4;return _0x1cccc6;})[_0x5c53('0x23')](respondWithFilteredResult(_0x2862e5,_0x27c5f5))[_0x5c53('0x3e')](handleError(_0x2862e5,null));};exports[_0x5c53('0x3f')]=function(_0x532933,_0x4c893f){var _0x6adfb2={'raw':!![],'where':{'id':_0x532933[_0x5c53('0x40')]['id']}},_0x197099={};_0x197099[_0x5c53('0x2b')]=_[_0x5c53('0x2d')](db[_0x5c53('0x27')][_0x5c53('0x28')]);_0x197099[_0x5c53('0x2c')]=_[_0x5c53('0x2d')](_0x532933['query']);_0x197099[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x197099[_0x5c53('0x2b')],_0x197099[_0x5c53('0x2c')]);_0x6adfb2[_0x5c53('0x30')]=_[_0x5c53('0x2f')](_0x197099[_0x5c53('0x2b')],qs[_0x5c53('0x31')](_0x532933[_0x5c53('0x2c')][_0x5c53('0x31')]));_0x6adfb2[_0x5c53('0x30')]=_0x6adfb2[_0x5c53('0x30')]['length']?_0x6adfb2['attributes']:_0x197099['model'];if(_0x532933['query']['includeAll']){_0x6adfb2[_0x5c53('0x41')]=[{'all':!![]}];}_0x6adfb2=_[_0x5c53('0x38')]({},_0x6adfb2,_0x532933[_0x5c53('0x3a')]);return db[_0x5c53('0x27')][_0x5c53('0x42')](_0x6adfb2)[_0x5c53('0x23')](handleEntityNotFound(_0x4c893f,null))[_0x5c53('0x23')](respondWithResult(_0x4c893f,null))['catch'](handleError(_0x4c893f,null));};exports[_0x5c53('0x43')]=function(_0x2246da,_0x27ef84){return db[_0x5c53('0x27')][_0x5c53('0x43')](_0x2246da['body'],{})[_0x5c53('0x23')](respondWithResult(_0x27ef84,0xc9))[_0x5c53('0x3e')](handleError(_0x27ef84,null));};exports[_0x5c53('0x22')]=function(_0x154c6a,_0x51c8a0){if(_0x154c6a[_0x5c53('0x44')]['id']){delete _0x154c6a[_0x5c53('0x44')]['id'];}return db[_0x5c53('0x27')][_0x5c53('0x42')]({'where':{'id':_0x154c6a['params']['id']}})[_0x5c53('0x23')](handleEntityNotFound(_0x51c8a0,null))[_0x5c53('0x23')](saveUpdates(_0x154c6a[_0x5c53('0x44')],null))[_0x5c53('0x23')](respondWithResult(_0x51c8a0,null))[_0x5c53('0x3e')](handleError(_0x51c8a0,null));};exports['destroy']=function(_0x7ccd08,_0xb181f7){return db[_0x5c53('0x27')][_0x5c53('0x42')]({'where':{'id':_0x7ccd08[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0xb181f7,null))[_0x5c53('0x23')](removeEntity(_0xb181f7,null))[_0x5c53('0x3e')](handleError(_0xb181f7,null));};exports['describe']=function(_0x22f995,_0xc76858){return db[_0x5c53('0x27')][_0x5c53('0x45')]()['then'](respondWithResult(_0xc76858,null))[_0x5c53('0x3e')](handleError(_0xc76858,null));};exports[_0x5c53('0x46')]=function(_0x4aeb61,_0x4662c8,_0x233d4d){var _0x1cb455={'raw':!![],'where':{}};var _0x479b8d={};var _0x5d5a8a={'count':0x0,'rows':[]};return db[_0x5c53('0x27')]['findOne']({'where':{'id':_0x4aeb61[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0x4662c8,null))['then'](function(_0x33b3e6){if(_0x33b3e6){_0x479b8d[_0x5c53('0x2b')]=_[_0x5c53('0x2d')](db[_0x5c53('0x47')][_0x5c53('0x28')]);_0x479b8d[_0x5c53('0x2c')]=_['keys'](_0x4aeb61[_0x5c53('0x2c')]);_0x479b8d[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x479b8d[_0x5c53('0x2b')],_0x479b8d['query']);_0x1cb455['attributes']=_[_0x5c53('0x2f')](_0x479b8d['model'],qs[_0x5c53('0x31')](_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x31')]));_0x1cb455['attributes']=_0x1cb455['attributes']['length']?_0x1cb455[_0x5c53('0x30')]:_0x479b8d['model'];if(!_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x1cb455[_0x5c53('0x1c')]=qs['limit'](_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x1c')]);_0x1cb455[_0x5c53('0x1a')]=qs[_0x5c53('0x1a')](_0x4aeb61[_0x5c53('0x2c')]['offset']);}_0x1cb455['order']=qs[_0x5c53('0x35')](_0x4aeb61['query'][_0x5c53('0x35')]);_0x1cb455['where']=qs['filters'](_[_0x5c53('0x48')](_0x4aeb61['query'],_0x479b8d[_0x5c53('0x2e')]));_0x1cb455['where'][_0x5c53('0x49')]=_0x33b3e6['id'];if(_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x36')]){_0x1cb455[_0x5c53('0x37')]=_[_0x5c53('0x38')](_0x1cb455[_0x5c53('0x37')],{'$or':_[_0x5c53('0x26')](_0x1cb455[_0x5c53('0x30')],function(_0x53513f){var _0x31ea43={};_0x31ea43[_0x53513f]={'$like':'%'+_0x4aeb61['query'][_0x5c53('0x36')]+'%'};return _0x31ea43;})});}_0x1cb455=_['merge']({},_0x1cb455,_0x4aeb61[_0x5c53('0x3a')]);return db[_0x5c53('0x47')][_0x5c53('0x1d')]({'where':_0x1cb455[_0x5c53('0x37')]})['then'](function(_0xa2e162){_0x5d5a8a[_0x5c53('0x1d')]=_0xa2e162;if(_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x3b')]){_0x1cb455[_0x5c53('0x41')]=[{'all':!![]}];}return db[_0x5c53('0x47')][_0x5c53('0x3c')](_0x1cb455);})['then'](function(_0x3e021f){_0x5d5a8a[_0x5c53('0x3d')]=_0x3e021f;return _0x5d5a8a;});}})['then'](respondWithFilteredResult(_0x4662c8,_0x1cb455))[_0x5c53('0x3e')](handleError(_0x4662c8,null));}; \ No newline at end of file +var _0x136a=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','JscriptySessionReport','then','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','update','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5ead02,_0x5ef10f){var _0x1b6e8a=function(_0x488c09){while(--_0x488c09){_0x5ead02['push'](_0x5ead02['shift']());}};_0x1b6e8a(++_0x5ef10f);}(_0x136a,0x125));var _0xa136=function(_0xba402e,_0x48bef2){_0xba402e=_0xba402e-0x0;var _0x4bf01f=_0x136a[_0xba402e];return _0x4bf01f;};'use strict';var emlformat=require(_0xa136('0x0'));var rimraf=require(_0xa136('0x1'));var zipdir=require(_0xa136('0x2'));var jsonpatch=require(_0xa136('0x3'));var rp=require('request-promise');var moment=require(_0xa136('0x4'));var BPromise=require(_0xa136('0x5'));var Mustache=require(_0xa136('0x6'));var util=require('util');var path=require(_0xa136('0x7'));var sox=require('sox');var csv=require(_0xa136('0x8'));var ejs=require(_0xa136('0x9'));var fs=require('fs');var fs_extra=require(_0xa136('0xa'));var _=require(_0xa136('0xb'));var squel=require(_0xa136('0xc'));var crypto=require(_0xa136('0xd'));var jsforce=require(_0xa136('0xe'));var deskjs=require(_0xa136('0xf'));var toCsv=require(_0xa136('0x8'));var querystring=require('querystring');var Papa=require(_0xa136('0x10'));var Redis=require('ioredis');var authService=require(_0xa136('0x11'));var qs=require(_0xa136('0x12'));var as=require(_0xa136('0x13'));var hardwareService=require(_0xa136('0x14'));var logger=require(_0xa136('0x15'))(_0xa136('0x16'));var utils=require(_0xa136('0x17'));var config=require(_0xa136('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa136('0x19'))['db'];function respondWithStatusCode(_0x21311a,_0x49b92b){_0x49b92b=_0x49b92b||0xcc;return function(_0x4bf8ee){if(_0x4bf8ee){return _0x21311a[_0xa136('0x1a')](_0x49b92b);}return _0x21311a[_0xa136('0x1b')](_0x49b92b)[_0xa136('0x1c')]();};}function respondWithResult(_0x57173b,_0x30aa46){_0x30aa46=_0x30aa46||0xc8;return function(_0x291314){if(_0x291314){return _0x57173b[_0xa136('0x1b')](_0x30aa46)['json'](_0x291314);}};}function respondWithFilteredResult(_0x511bbe,_0x6fb8ad){return function(_0x5267ed){if(_0x5267ed){var _0x46c203=typeof _0x6fb8ad[_0xa136('0x1d')]===_0xa136('0x1e')&&typeof _0x6fb8ad[_0xa136('0x1f')]==='undefined';var _0x40f037=_0x5267ed['count'];var _0x47bab3=_0x46c203?0x0:_0x6fb8ad[_0xa136('0x1d')];var _0x98217b=_0x46c203?_0x5267ed[_0xa136('0x20')]:_0x6fb8ad['offset']+_0x6fb8ad[_0xa136('0x1f')];var _0x510602;if(_0x98217b>=_0x40f037){_0x98217b=_0x40f037;_0x510602=0xc8;}else{_0x510602=0xce;}_0x511bbe[_0xa136('0x1b')](_0x510602);return _0x511bbe[_0xa136('0x21')]('Content-Range',_0x47bab3+'-'+_0x98217b+'/'+_0x40f037)['json'](_0x5267ed);}return null;};}function patchUpdates(_0x2958b8){return function(_0xefdfb8){try{jsonpatch[_0xa136('0x22')](_0xefdfb8,_0x2958b8,!![]);}catch(_0x1b4fcd){return BPromise[_0xa136('0x23')](_0x1b4fcd);}return _0xefdfb8[_0xa136('0x24')]();};}function saveUpdates(_0x1acf37,_0x48d7c4){return function(_0x3f9fc1){if(_0x3f9fc1){return _0x3f9fc1['update'](_0x1acf37)['then'](function(_0xb3a603){return _0xb3a603;});}return null;};}function removeEntity(_0x236426,_0x22ce51){return function(_0x43cf39){if(_0x43cf39){return _0x43cf39['destroy']()['then'](function(){_0x236426[_0xa136('0x1b')](0xcc)[_0xa136('0x1c')]();});}};}function handleEntityNotFound(_0x35bcc6,_0x534609){return function(_0x34ea73){if(!_0x34ea73){_0x35bcc6['sendStatus'](0x194);}return _0x34ea73;};}function handleError(_0xf4cab6,_0x219ff9){_0x219ff9=_0x219ff9||0x1f4;return function(_0x3333db){logger[_0xa136('0x25')](_0x3333db[_0xa136('0x26')]);if(_0x3333db[_0xa136('0x27')]){delete _0x3333db[_0xa136('0x27')];}_0xf4cab6['status'](_0x219ff9)[_0xa136('0x28')](_0x3333db);};}exports['index']=function(_0x17fd61,_0x30fdd0){var _0x37c08e={},_0x17e7dd={},_0x4eceee={'count':0x0,'rows':[]};var _0x24542e=_[_0xa136('0x29')](db['JscriptySessionReport'][_0xa136('0x2a')],function(_0x51cdcd){return{'name':_0x51cdcd[_0xa136('0x2b')],'type':_0x51cdcd[_0xa136('0x2c')][_0xa136('0x2d')]};});_0x17e7dd[_0xa136('0x2e')]=_['map'](_0x24542e,'name');_0x17e7dd[_0xa136('0x2f')]=_['keys'](_0x17fd61[_0xa136('0x2f')]);_0x17e7dd[_0xa136('0x30')]=_[_0xa136('0x31')](_0x17e7dd['model'],_0x17e7dd[_0xa136('0x2f')]);_0x37c08e[_0xa136('0x32')]=_[_0xa136('0x31')](_0x17e7dd[_0xa136('0x2e')],qs[_0xa136('0x33')](_0x17fd61[_0xa136('0x2f')][_0xa136('0x33')]));_0x37c08e[_0xa136('0x32')]=_0x37c08e[_0xa136('0x32')][_0xa136('0x34')]?_0x37c08e['attributes']:_0x17e7dd[_0xa136('0x2e')];if(!_0x17fd61[_0xa136('0x2f')][_0xa136('0x35')](_0xa136('0x36'))){_0x37c08e[_0xa136('0x1f')]=qs[_0xa136('0x1f')](_0x17fd61[_0xa136('0x2f')]['limit']);_0x37c08e[_0xa136('0x1d')]=qs['offset'](_0x17fd61['query'][_0xa136('0x1d')]);}_0x37c08e[_0xa136('0x37')]=qs[_0xa136('0x38')](_0x17fd61[_0xa136('0x2f')][_0xa136('0x38')]);_0x37c08e[_0xa136('0x39')]=qs['filters'](_[_0xa136('0x3a')](_0x17fd61[_0xa136('0x2f')],_0x17e7dd[_0xa136('0x30')]),_0x24542e);if(_0x17fd61['query'][_0xa136('0x3b')]){_0x37c08e[_0xa136('0x39')]=_[_0xa136('0x3c')](_0x37c08e[_0xa136('0x39')],{'$or':_[_0xa136('0x29')](_0x24542e,function(_0x591d85){if(_0x591d85[_0xa136('0x2c')]!=='VIRTUAL'){var _0x34ccc0={};_0x34ccc0[_0x591d85['name']]={'$like':'%'+_0x17fd61[_0xa136('0x2f')][_0xa136('0x3b')]+'%'};return _0x34ccc0;}})});}_0x37c08e=_[_0xa136('0x3c')]({},_0x37c08e,_0x17fd61['options']);var _0x391216={'where':_0x37c08e[_0xa136('0x39')]};return db[_0xa136('0x3d')][_0xa136('0x20')](_0x391216)[_0xa136('0x3e')](function(_0x55200c){_0x4eceee[_0xa136('0x20')]=_0x55200c;if(_0x17fd61[_0xa136('0x2f')][_0xa136('0x3f')]){_0x37c08e[_0xa136('0x40')]=[{'all':!![]}];}return db[_0xa136('0x3d')][_0xa136('0x41')](_0x37c08e);})[_0xa136('0x3e')](function(_0x137224){_0x4eceee[_0xa136('0x42')]=_0x137224;return _0x4eceee;})[_0xa136('0x3e')](respondWithFilteredResult(_0x30fdd0,_0x37c08e))['catch'](handleError(_0x30fdd0,null));};exports[_0xa136('0x43')]=function(_0x15b028,_0x39f492){var _0x47157f={'raw':!![],'where':{'id':_0x15b028[_0xa136('0x44')]['id']}},_0x4dc58c={};_0x4dc58c[_0xa136('0x2e')]=_['keys'](db[_0xa136('0x3d')][_0xa136('0x2a')]);_0x4dc58c['query']=_[_0xa136('0x45')](_0x15b028[_0xa136('0x2f')]);_0x4dc58c[_0xa136('0x30')]=_[_0xa136('0x31')](_0x4dc58c['model'],_0x4dc58c[_0xa136('0x2f')]);_0x47157f[_0xa136('0x32')]=_[_0xa136('0x31')](_0x4dc58c[_0xa136('0x2e')],qs[_0xa136('0x33')](_0x15b028[_0xa136('0x2f')][_0xa136('0x33')]));_0x47157f[_0xa136('0x32')]=_0x47157f[_0xa136('0x32')][_0xa136('0x34')]?_0x47157f['attributes']:_0x4dc58c[_0xa136('0x2e')];if(_0x15b028['query']['includeAll']){_0x47157f[_0xa136('0x40')]=[{'all':!![]}];}_0x47157f=_['merge']({},_0x47157f,_0x15b028[_0xa136('0x46')]);return db['JscriptySessionReport'][_0xa136('0x47')](_0x47157f)[_0xa136('0x3e')](handleEntityNotFound(_0x39f492,null))[_0xa136('0x3e')](respondWithResult(_0x39f492,null))[_0xa136('0x48')](handleError(_0x39f492,null));};exports['create']=function(_0x365e77,_0x40121a){return db['JscriptySessionReport'][_0xa136('0x49')](_0x365e77[_0xa136('0x4a')],{})[_0xa136('0x3e')](respondWithResult(_0x40121a,0xc9))['catch'](handleError(_0x40121a,null));};exports[_0xa136('0x4b')]=function(_0x5c084f,_0x2520bc){if(_0x5c084f[_0xa136('0x4a')]['id']){delete _0x5c084f[_0xa136('0x4a')]['id'];}return db[_0xa136('0x3d')]['find']({'where':{'id':_0x5c084f[_0xa136('0x44')]['id']}})['then'](handleEntityNotFound(_0x2520bc,null))[_0xa136('0x3e')](saveUpdates(_0x5c084f[_0xa136('0x4a')],null))['then'](respondWithResult(_0x2520bc,null))[_0xa136('0x48')](handleError(_0x2520bc,null));};exports['destroy']=function(_0x5e404b,_0x2147ca){return db[_0xa136('0x3d')][_0xa136('0x47')]({'where':{'id':_0x5e404b[_0xa136('0x44')]['id']}})['then'](handleEntityNotFound(_0x2147ca,null))['then'](removeEntity(_0x2147ca,null))[_0xa136('0x48')](handleError(_0x2147ca,null));};exports['describe']=function(_0x2565df,_0x358faf){return db['JscriptySessionReport']['describe']()[_0xa136('0x3e')](respondWithResult(_0x358faf,null))[_0xa136('0x48')](handleError(_0x358faf,null));};exports[_0xa136('0x4c')]=function(_0xc2a97e,_0x12d872,_0x4de664){var _0x54b828={'raw':!![],'where':{}};var _0x3b283f={};var _0x54502e={'count':0x0,'rows':[]};return db[_0xa136('0x3d')][_0xa136('0x4d')]({'where':{'id':_0xc2a97e[_0xa136('0x44')]['id']}})[_0xa136('0x3e')](handleEntityNotFound(_0x12d872,null))['then'](function(_0x1a076b){if(_0x1a076b){_0x3b283f[_0xa136('0x2e')]=_[_0xa136('0x45')](db['JscriptyQuestionReport']['rawAttributes']);_0x3b283f[_0xa136('0x2f')]=_[_0xa136('0x45')](_0xc2a97e['query']);_0x3b283f[_0xa136('0x30')]=_[_0xa136('0x31')](_0x3b283f[_0xa136('0x2e')],_0x3b283f['query']);_0x54b828['attributes']=_[_0xa136('0x31')](_0x3b283f[_0xa136('0x2e')],qs[_0xa136('0x33')](_0xc2a97e[_0xa136('0x2f')][_0xa136('0x33')]));_0x54b828['attributes']=_0x54b828[_0xa136('0x32')][_0xa136('0x34')]?_0x54b828[_0xa136('0x32')]:_0x3b283f['model'];if(!_0xc2a97e['query']['hasOwnProperty']('nolimit')){_0x54b828[_0xa136('0x1f')]=qs[_0xa136('0x1f')](_0xc2a97e[_0xa136('0x2f')]['limit']);_0x54b828[_0xa136('0x1d')]=qs[_0xa136('0x1d')](_0xc2a97e['query'][_0xa136('0x1d')]);}_0x54b828[_0xa136('0x37')]=qs[_0xa136('0x38')](_0xc2a97e[_0xa136('0x2f')][_0xa136('0x38')]);_0x54b828['where']=qs['filters'](_['pick'](_0xc2a97e[_0xa136('0x2f')],_0x3b283f['filters']));_0x54b828[_0xa136('0x39')]['SessionId']=_0x1a076b['id'];if(_0xc2a97e['query'][_0xa136('0x3b')]){_0x54b828[_0xa136('0x39')]=_[_0xa136('0x3c')](_0x54b828[_0xa136('0x39')],{'$or':_[_0xa136('0x29')](_0x54b828['attributes'],function(_0x506ab0){var _0x3295a7={};_0x3295a7[_0x506ab0]={'$like':'%'+_0xc2a97e[_0xa136('0x2f')][_0xa136('0x3b')]+'%'};return _0x3295a7;})});}_0x54b828=_[_0xa136('0x3c')]({},_0x54b828,_0xc2a97e['options']);return db[_0xa136('0x4e')][_0xa136('0x20')]({'where':_0x54b828[_0xa136('0x39')]})[_0xa136('0x3e')](function(_0x3168d2){_0x54502e[_0xa136('0x20')]=_0x3168d2;if(_0xc2a97e['query'][_0xa136('0x3f')]){_0x54b828['include']=[{'all':!![]}];}return db[_0xa136('0x4e')][_0xa136('0x41')](_0x54b828);})[_0xa136('0x3e')](function(_0x836eb3){_0x54502e[_0xa136('0x42')]=_0x836eb3;return _0x54502e;});}})['then'](respondWithFilteredResult(_0x12d872,_0x54b828))[_0xa136('0x48')](handleError(_0x12d872,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 463e205..dadb40d 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0x2c1629,_0x2b0606){var _0x3a1406=function(_0x293a44){while(--_0x293a44){_0x2c1629['push'](_0x2c1629['shift']());}};_0x3a1406(++_0x2b0606);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x5fc3[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x33e075,_0x2e343a){var _0x2896de=function(_0xff4a4){while(--_0xff4a4){_0x33e075['push'](_0x33e075['shift']());}};_0x2896de(++_0x2e343a);}(_0xb138,0x1dd));var _0x8b13=function(_0x39a201,_0x246c11){_0x39a201=_0x39a201-0x0;var _0xbddfc8=_0xb138[_0x39a201];return _0xbddfc8;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 35fff1a..37a33b0 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 _0xbff5=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbff5,0x1bc));var _0x5bff=function(_0x455ffc,_0xefa00){_0x455ffc=_0x455ffc-0x0;var _0x21f440=_0xbff5[_0x455ffc];return _0x21f440;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});} \ 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(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xfcf0[_0x3005d5];return _0x547c7e;};'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 4554e69..777a5e0 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 _0x24c2=['isAuthenticated','update','/download_log_file','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','index','put','/:id'];(function(_0x282b4c,_0x2d3ea5){var _0x519afe=function(_0x3df0c9){while(--_0x3df0c9){_0x282b4c['push'](_0x282b4c['shift']());}};_0x519afe(++_0x2d3ea5);}(_0x24c2,0x138));var _0x224c=function(_0x1bae03,_0x2a0ce3){_0x1bae03=_0x1bae03-0x0;var _0x47c0d5=_0x24c2[_0x1bae03];return _0x47c0d5;};'use strict';var multer=require(_0x224c('0x0'));var util=require(_0x224c('0x1'));var path=require(_0x224c('0x2'));var timeout=require('connect-timeout');var express=require(_0x224c('0x3'));var router=express[_0x224c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x224c('0x5'));var config=require(_0x224c('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x224c('0x7')]);router[_0x224c('0x8')](_0x224c('0x9'),auth[_0x224c('0xa')](),controller[_0x224c('0xb')]);router['get'](_0x224c('0xc'),auth[_0x224c('0xa')](),controller['downloadLogFile']);module[_0x224c('0xd')]=router; \ No newline at end of file +var _0x084a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','multer','util','connect-timeout','express'];(function(_0x4e08ad,_0x39a459){var _0x20a900=function(_0x3fba87){while(--_0x3fba87){_0x4e08ad['push'](_0x4e08ad['shift']());}};_0x20a900(++_0x39a459);}(_0x084a,0x1b6));var _0xa084=function(_0x4e3e31,_0x180bea){_0x4e3e31=_0x4e3e31-0x0;var _0x57dea0=_0x084a[_0x4e3e31];return _0x57dea0;};'use strict';var multer=require(_0xa084('0x0'));var util=require(_0xa084('0x1'));var path=require('path');var timeout=require(_0xa084('0x2'));var express=require(_0xa084('0x3'));var router=express[_0xa084('0x4')]();var fs_extra=require(_0xa084('0x5'));var auth=require(_0xa084('0x6'));var interaction=require(_0xa084('0x7'));var config=require(_0xa084('0x8'));var controller=require(_0xa084('0x9'));router[_0xa084('0xa')]('/',controller[_0xa084('0xb')]);router[_0xa084('0xc')](_0xa084('0xd'),auth[_0xa084('0xe')](),controller[_0xa084('0xf')]);router[_0xa084('0xa')]('/download_log_file',auth['isAuthenticated'](),controller[_0xa084('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 67c3dfb..ac4358e 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 _0x50a6=['INTEGER','exports','TEXT','STRING'];(function(_0x5d7303,_0xce1145){var _0x1618ad=function(_0x20302b){while(--_0x20302b){_0x5d7303['push'](_0x5d7303['shift']());}};_0x1618ad(++_0xce1145);}(_0x50a6,0x16d));var _0x650a=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x50a6[_0x1d291d];return _0x44cc4e;};'use strict';var Sequelize=require('sequelize');module[_0x650a('0x0')]={'license':{'type':Sequelize[_0x650a('0x1')]},'data1':{'type':Sequelize[_0x650a('0x2')]},'data2':{'type':Sequelize[_0x650a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x650a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8587=['TEXT','STRING','sequelize','exports'];(function(_0x596565,_0x1258ad){var _0x474b1b=function(_0x2bbf2d){while(--_0x2bbf2d){_0x596565['push'](_0x596565['shift']());}};_0x474b1b(++_0x1258ad);}(_0x8587,0x176));var _0x7858=function(_0x263f36,_0x5244dc){_0x263f36=_0x263f36-0x0;var _0x516d3f=_0x8587[_0x263f36];return _0x516d3f;};'use strict';var Sequelize=require(_0x7858('0x0'));module[_0x7858('0x1')]={'license':{'type':Sequelize[_0x7858('0x2')]},'data1':{'type':Sequelize[_0x7858('0x3')]},'data2':{'type':Sequelize[_0x7858('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c4531ef..a8015fc 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 _0xf321=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','catch','body','License','params','get','checkLicense','downloadLogFile','join','log','xcally','setHeader','Content-disposition','set','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5c4647,_0x408c7e){var _0x2b8d33=function(_0xbd96aa){while(--_0xbd96aa){_0x5c4647['push'](_0x5c4647['shift']());}};_0x2b8d33(++_0x408c7e);}(_0xf321,0x10f));var _0x1f32=function(_0x2c2f8c,_0x28c748){_0x2c2f8c=_0x2c2f8c-0x0;var _0x29d30c=_0xf321[_0x2c2f8c];return _0x29d30c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f32('0x0'));var zipdir=require(_0x1f32('0x1'));var jsonpatch=require(_0x1f32('0x2'));var rp=require(_0x1f32('0x3'));var moment=require(_0x1f32('0x4'));var BPromise=require(_0x1f32('0x5'));var Mustache=require(_0x1f32('0x6'));var util=require(_0x1f32('0x7'));var path=require(_0x1f32('0x8'));var sox=require(_0x1f32('0x9'));var csv=require('to-csv');var ejs=require(_0x1f32('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f32('0xb'));var squel=require(_0x1f32('0xc'));var crypto=require(_0x1f32('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f32('0xe'));var querystring=require(_0x1f32('0xf'));var Papa=require('papaparse');var Redis=require(_0x1f32('0x10'));var authService=require(_0x1f32('0x11'));var qs=require(_0x1f32('0x12'));var as=require(_0x1f32('0x13'));var hardwareService=require(_0x1f32('0x14'));var logger=require(_0x1f32('0x15'))(_0x1f32('0x16'));var utils=require(_0x1f32('0x17'));var config=require(_0x1f32('0x18'));var licenseUtil=require(_0x1f32('0x19'));var db=require(_0x1f32('0x1a'))['db'];function respondWithStatusCode(_0x4ba958,_0x3d2f8b){_0x3d2f8b=_0x3d2f8b||0xcc;return function(_0x56603b){if(_0x56603b){return _0x4ba958['sendStatus'](_0x3d2f8b);}return _0x4ba958[_0x1f32('0x1b')](_0x3d2f8b)[_0x1f32('0x1c')]();};}function respondWithResult(_0x22e018,_0x1fdd19){_0x1fdd19=_0x1fdd19||0xc8;return function(_0x7ba993){if(_0x7ba993){return _0x22e018['status'](_0x1fdd19)[_0x1f32('0x1d')](_0x7ba993);}};}function respondWithFilteredResult(_0x396a01,_0x1a07e1){return function(_0x3fbb81){if(_0x3fbb81){var _0x222880=typeof _0x1a07e1['offset']===_0x1f32('0x1e')&&typeof _0x1a07e1[_0x1f32('0x1f')]===_0x1f32('0x1e');var _0x49ae6a=_0x3fbb81[_0x1f32('0x20')];var _0x8cac5f=_0x222880?0x0:_0x1a07e1['offset'];var _0x59f94f=_0x222880?_0x3fbb81['count']:_0x1a07e1[_0x1f32('0x21')]+_0x1a07e1['limit'];var _0x2507e3;if(_0x59f94f>=_0x49ae6a){_0x59f94f=_0x49ae6a;_0x2507e3=0xc8;}else{_0x2507e3=0xce;}_0x396a01[_0x1f32('0x1b')](_0x2507e3);return _0x396a01['set'](_0x1f32('0x22'),_0x8cac5f+'-'+_0x59f94f+'/'+_0x49ae6a)[_0x1f32('0x1d')](_0x3fbb81);}return null;};}function patchUpdates(_0x19911f){return function(_0x35696c){try{jsonpatch[_0x1f32('0x23')](_0x35696c,_0x19911f,!![]);}catch(_0x39176d){return BPromise['reject'](_0x39176d);}return _0x35696c[_0x1f32('0x24')]();};}function saveUpdates(_0x292aaf,_0x493585){return function(_0x4cbe26){if(_0x4cbe26){return _0x4cbe26[_0x1f32('0x25')](_0x292aaf)[_0x1f32('0x26')](function(_0x4696a6){return _0x4696a6;});}return null;};}function removeEntity(_0x37afe1,_0x3403ad){return function(_0x4cb8d2){if(_0x4cb8d2){return _0x4cb8d2[_0x1f32('0x27')]()['then'](function(){_0x37afe1[_0x1f32('0x1b')](0xcc)[_0x1f32('0x1c')]();});}};}function handleEntityNotFound(_0x1c36b2,_0x4464fc){return function(_0x30791e){if(!_0x30791e){_0x1c36b2['sendStatus'](0x194);}return _0x30791e;};}function handleError(_0x3dcef0,_0x29ac8d){_0x29ac8d=_0x29ac8d||0x1f4;return function(_0x6695e8){logger['error'](_0x6695e8[_0x1f32('0x28')]);if(_0x6695e8['name']){delete _0x6695e8[_0x1f32('0x29')];}_0x3dcef0[_0x1f32('0x1b')](_0x29ac8d)[_0x1f32('0x2a')](_0x6695e8);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4a78ec,_0x2d7d57){var _0x404751={'raw':!![],'where':{'id':0x1}},_0x414d8d={};_0x414d8d['model']=_[_0x1f32('0x2b')](db['License'][_0x1f32('0x2c')]);_0x414d8d[_0x1f32('0x2d')]=_[_0x1f32('0x2b')](_0x4a78ec['query']);_0x414d8d[_0x1f32('0x2e')]=_[_0x1f32('0x2f')](_0x414d8d[_0x1f32('0x30')],_0x414d8d[_0x1f32('0x2d')]);_0x404751[_0x1f32('0x31')]=_[_0x1f32('0x2f')](_0x414d8d[_0x1f32('0x30')],qs[_0x1f32('0x32')](_0x4a78ec[_0x1f32('0x2d')][_0x1f32('0x32')]));_0x404751[_0x1f32('0x31')]=_0x404751[_0x1f32('0x31')][_0x1f32('0x33')]?_0x404751[_0x1f32('0x31')]:_0x414d8d[_0x1f32('0x30')];_0x404751=_['merge']({},_0x404751,_0x4a78ec[_0x1f32('0x34')]);return utilLicense['getLicense'](_0x404751)[_0x1f32('0x26')](respondWithResult(_0x2d7d57,null))[_0x1f32('0x35')](handleError(_0x2d7d57,null));};exports['update']=function(_0x6f9310,_0x3e7b40){if(_0x6f9310[_0x1f32('0x36')]['id']){delete _0x6f9310[_0x1f32('0x36')]['id'];}return db[_0x1f32('0x37')]['find']({'where':{'id':_0x6f9310[_0x1f32('0x38')]['id']}})[_0x1f32('0x26')](handleEntityNotFound(_0x3e7b40,null))[_0x1f32('0x26')](function(_0xbce5d5){var _0x3dd2eb=_0xbce5d5[_0x1f32('0x39')]({'plain':!![]});return utilLicense[_0x1f32('0x3a')](_0x3dd2eb,_0x6f9310[_0x1f32('0x36')]['key']);})[_0x1f32('0x26')](function(_0x4d311a){if(!_0x4d311a['demo']){return saveUpdates(_0x6f9310[_0x1f32('0x36')],null);}return _0x4d311a;})['then'](respondWithResult(_0x3e7b40,null))['catch'](handleError(_0x3e7b40,null));};exports[_0x1f32('0x3b')]=function(_0x533ce2,_0x1de032){var _0x1501dc='license-info.log';var _0x15bf6f=path[_0x1f32('0x3c')]('/var',_0x1f32('0x3d'),_0x1f32('0x3e'),_0x1501dc);_0x1de032[_0x1f32('0x3f')](_0x1f32('0x40'),'attachment;\x20filename='+_0x1501dc);_0x1de032[_0x1f32('0x41')](_0x1f32('0x42'),_0x1f32('0x43'));_0x1de032[_0x1f32('0x44')](_0x15bf6f);}; \ No newline at end of file +var _0x5a87=['status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','model','License','query','keys','filters','intersection','attributes','fields','length','merge','getLicense','body','params','checkLicense','demo','catch','downloadLogFile','join','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5a87,0x190));var _0x75a8=function(_0x3a6f71,_0x49b5e6){_0x3a6f71=_0x3a6f71-0x0;var _0x2fc8fd=_0x5a87[_0x3a6f71];return _0x2fc8fd;};'use strict';var emlformat=require(_0x75a8('0x0'));var rimraf=require(_0x75a8('0x1'));var zipdir=require(_0x75a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75a8('0x3'));var moment=require(_0x75a8('0x4'));var BPromise=require(_0x75a8('0x5'));var Mustache=require(_0x75a8('0x6'));var util=require(_0x75a8('0x7'));var path=require(_0x75a8('0x8'));var sox=require(_0x75a8('0x9'));var csv=require(_0x75a8('0xa'));var ejs=require(_0x75a8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75a8('0xc'));var squel=require('squel');var crypto=require(_0x75a8('0xd'));var jsforce=require(_0x75a8('0xe'));var deskjs=require(_0x75a8('0xf'));var toCsv=require(_0x75a8('0xa'));var querystring=require(_0x75a8('0x10'));var Papa=require(_0x75a8('0x11'));var Redis=require(_0x75a8('0x12'));var authService=require(_0x75a8('0x13'));var qs=require(_0x75a8('0x14'));var as=require(_0x75a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75a8('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x75a8('0x17'));var licenseUtil=require(_0x75a8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34c7ca,_0x489c9e){_0x489c9e=_0x489c9e||0xcc;return function(_0x33c62e){if(_0x33c62e){return _0x34c7ca[_0x75a8('0x19')](_0x489c9e);}return _0x34c7ca[_0x75a8('0x1a')](_0x489c9e)['end']();};}function respondWithResult(_0x14b07a,_0x10186b){_0x10186b=_0x10186b||0xc8;return function(_0x2509cf){if(_0x2509cf){return _0x14b07a[_0x75a8('0x1a')](_0x10186b)[_0x75a8('0x1b')](_0x2509cf);}};}function respondWithFilteredResult(_0x8bef82,_0x297477){return function(_0x562774){if(_0x562774){var _0x100fe3=typeof _0x297477[_0x75a8('0x1c')]===_0x75a8('0x1d')&&typeof _0x297477['limit']===_0x75a8('0x1d');var _0x3d0e20=_0x562774[_0x75a8('0x1e')];var _0x2aa6ed=_0x100fe3?0x0:_0x297477[_0x75a8('0x1c')];var _0x269200=_0x100fe3?_0x562774[_0x75a8('0x1e')]:_0x297477[_0x75a8('0x1c')]+_0x297477[_0x75a8('0x1f')];var _0x17c6cc;if(_0x269200>=_0x3d0e20){_0x269200=_0x3d0e20;_0x17c6cc=0xc8;}else{_0x17c6cc=0xce;}_0x8bef82[_0x75a8('0x1a')](_0x17c6cc);return _0x8bef82[_0x75a8('0x20')](_0x75a8('0x21'),_0x2aa6ed+'-'+_0x269200+'/'+_0x3d0e20)[_0x75a8('0x1b')](_0x562774);}return null;};}function patchUpdates(_0x63698c){return function(_0x35883){try{jsonpatch['apply'](_0x35883,_0x63698c,!![]);}catch(_0x1c9e82){return BPromise[_0x75a8('0x22')](_0x1c9e82);}return _0x35883[_0x75a8('0x23')]();};}function saveUpdates(_0x5a4ce9,_0x44899a){return function(_0x4f3948){if(_0x4f3948){return _0x4f3948[_0x75a8('0x24')](_0x5a4ce9)[_0x75a8('0x25')](function(_0x3220c2){return _0x3220c2;});}return null;};}function removeEntity(_0x4979ea,_0x12a8c0){return function(_0x51e9cf){if(_0x51e9cf){return _0x51e9cf[_0x75a8('0x26')]()[_0x75a8('0x25')](function(){_0x4979ea[_0x75a8('0x1a')](0xcc)[_0x75a8('0x27')]();});}};}function handleEntityNotFound(_0x5a631b,_0x45bcd0){return function(_0x53257d){if(!_0x53257d){_0x5a631b[_0x75a8('0x19')](0x194);}return _0x53257d;};}function handleError(_0x1fa6bd,_0xaa952){_0xaa952=_0xaa952||0x1f4;return function(_0x1dba54){logger[_0x75a8('0x28')](_0x1dba54[_0x75a8('0x29')]);if(_0x1dba54[_0x75a8('0x2a')]){delete _0x1dba54[_0x75a8('0x2a')];}_0x1fa6bd[_0x75a8('0x1a')](_0xaa952)[_0x75a8('0x2b')](_0x1dba54);};}var utilLicense=require(_0x75a8('0x18'));exports[_0x75a8('0x2c')]=function(_0x4b08be,_0x4d9049){var _0x4d95db={'raw':!![],'where':{'id':0x1}},_0x432bbb={};_0x432bbb[_0x75a8('0x2d')]=_['keys'](db[_0x75a8('0x2e')]['rawAttributes']);_0x432bbb[_0x75a8('0x2f')]=_[_0x75a8('0x30')](_0x4b08be[_0x75a8('0x2f')]);_0x432bbb[_0x75a8('0x31')]=_[_0x75a8('0x32')](_0x432bbb[_0x75a8('0x2d')],_0x432bbb[_0x75a8('0x2f')]);_0x4d95db[_0x75a8('0x33')]=_[_0x75a8('0x32')](_0x432bbb[_0x75a8('0x2d')],qs[_0x75a8('0x34')](_0x4b08be[_0x75a8('0x2f')][_0x75a8('0x34')]));_0x4d95db[_0x75a8('0x33')]=_0x4d95db[_0x75a8('0x33')][_0x75a8('0x35')]?_0x4d95db[_0x75a8('0x33')]:_0x432bbb[_0x75a8('0x2d')];_0x4d95db=_[_0x75a8('0x36')]({},_0x4d95db,_0x4b08be['options']);return utilLicense[_0x75a8('0x37')](_0x4d95db)[_0x75a8('0x25')](respondWithResult(_0x4d9049,null))['catch'](handleError(_0x4d9049,null));};exports[_0x75a8('0x24')]=function(_0x3e1eba,_0x12ea5b){if(_0x3e1eba[_0x75a8('0x38')]['id']){delete _0x3e1eba['body']['id'];}return db[_0x75a8('0x2e')]['find']({'where':{'id':_0x3e1eba[_0x75a8('0x39')]['id']}})[_0x75a8('0x25')](handleEntityNotFound(_0x12ea5b,null))[_0x75a8('0x25')](function(_0x17c96a){var _0x2252fd=_0x17c96a['get']({'plain':!![]});return utilLicense[_0x75a8('0x3a')](_0x2252fd,_0x3e1eba[_0x75a8('0x38')]['key']);})['then'](function(_0x421cf4){if(!_0x421cf4[_0x75a8('0x3b')]){return saveUpdates(_0x3e1eba[_0x75a8('0x38')],null);}return _0x421cf4;})['then'](respondWithResult(_0x12ea5b,null))[_0x75a8('0x3c')](handleError(_0x12ea5b,null));};exports[_0x75a8('0x3d')]=function(_0x15a055,_0x3d55fe){var _0x1f3b70='license-info.log';var _0x3394d5=path[_0x75a8('0x3e')](_0x75a8('0x3f'),_0x75a8('0x40'),_0x75a8('0x41'),_0x1f3b70);_0x3d55fe[_0x75a8('0x42')]('Content-disposition',_0x75a8('0x43')+_0x1f3b70);_0x3d55fe[_0x75a8('0x20')](_0x75a8('0x44'),_0x75a8('0x45'));_0x3d55fe[_0x75a8('0x46')](_0x3394d5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 30d9791..39d455c 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 _0x7171=['moment','bluebird','request-promise','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','api'];(function(_0x278e32,_0x12cabd){var _0x34b345=function(_0x2b4215){while(--_0x2b4215){_0x278e32['push'](_0x278e32['shift']());}};_0x34b345(++_0x12cabd);}(_0x7171,0x8d));var _0x1717=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7171[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x1717('0x0'));var util=require(_0x1717('0x1'));var logger=require('../../config/logger')(_0x1717('0x2'));var moment=require(_0x1717('0x3'));var BPromise=require(_0x1717('0x4'));var rp=require(_0x1717('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1717('0x6'));var attributes=require(_0x1717('0x7'));module[_0x1717('0x8')]=function(_0xa21171,_0x2cda85){return _0xa21171[_0x1717('0x9')](_0x1717('0xa'),attributes,{'tableName':_0x1717('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb2=['License','license','lodash','util','api','bluebird','request-promise','../../config/environment','./license.attributes','exports','define'];(function(_0x5455d9,_0x193d30){var _0x13250b=function(_0x190a54){while(--_0x190a54){_0x5455d9['push'](_0x5455d9['shift']());}};_0x13250b(++_0x193d30);}(_0x3cb2,0x1af));var _0x23cb=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0x3cb2[_0x5e8fc];return _0x41c58c;};'use strict';var _=require(_0x23cb('0x0'));var util=require(_0x23cb('0x1'));var logger=require('../../config/logger')(_0x23cb('0x2'));var moment=require('moment');var BPromise=require(_0x23cb('0x3'));var rp=require(_0x23cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23cb('0x5'));var attributes=require(_0x23cb('0x6'));module[_0x23cb('0x7')]=function(_0x4b9b2c,_0x4d6acb){return _0x4b9b2c[_0x23cb('0x8')](_0x23cb('0x9'),attributes,{'tableName':_0x23cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c73cf1d..f1476a7 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 _0x6ea1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x2fffa4,_0x97e365){var _0x531988=function(_0x53cecb){while(--_0x53cecb){_0x2fffa4['push'](_0x2fffa4['shift']());}};_0x531988(++_0x97e365);}(_0x6ea1,0xdc));var _0x16ea=function(_0x242969,_0x19d676){_0x242969=_0x242969-0x0;var _0x2f22d2=_0x6ea1[_0x242969];return _0x2f22d2;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require('moment');var BPromise=require(_0x16ea('0x2'));var rs=require(_0x16ea('0x3'));var fs=require('fs');var Redis=require(_0x16ea('0x4'));var db=require(_0x16ea('0x5'))['db'];var utils=require(_0x16ea('0x6'));var logger=require('../../config/logger')(_0x16ea('0x7'));var config=require(_0x16ea('0x8'));var jayson=require(_0x16ea('0x9'));var client=jayson[_0x16ea('0xa')][_0x16ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585f75,_0x3e6313,_0x36ee61){return new BPromise(function(_0x22a506,_0x2c0e50){return client[_0x16ea('0xc')](_0x585f75,_0x36ee61)['then'](function(_0x47ca45){logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x3e6313,'request\x20sent');logger[_0x16ea('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x3e6313,_0x16ea('0x10'),JSON[_0x16ea('0x11')](_0x47ca45));if(_0x47ca45[_0x16ea('0x12')]){if(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x13')]===0x1f4){logger[_0x16ea('0x12')]('License,\x20%s,\x20%s',_0x3e6313,_0x47ca45['error'][_0x16ea('0x14')]);return _0x2c0e50(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);}logger[_0x16ea('0x12')](_0x16ea('0xe'),_0x3e6313,_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);return _0x22a506(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);}else{logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x3e6313,'request\x20sent');_0x22a506(_0x47ca45[_0x16ea('0x15')][_0x16ea('0x14')]);}})['catch'](function(_0x25e365){logger[_0x16ea('0x12')]('License,\x20%s,\x20%s',_0x3e6313,_0x25e365);_0x2c0e50(_0x25e365);});});} \ No newline at end of file +var _0x752c=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x752c,0x193));var _0xc752=function(_0x3ba0da,_0x3a68f2){_0x3ba0da=_0x3ba0da-0x0;var _0x3b7d84=_0x752c[_0x3ba0da];return _0x3b7d84;};'use strict';var _=require(_0xc752('0x0'));var util=require(_0xc752('0x1'));var moment=require(_0xc752('0x2'));var BPromise=require(_0xc752('0x3'));var rs=require(_0xc752('0x4'));var fs=require('fs');var Redis=require(_0xc752('0x5'));var db=require(_0xc752('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc752('0x7'))(_0xc752('0x8'));var config=require(_0xc752('0x9'));var jayson=require(_0xc752('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18dbfb,_0x115fca,_0x30f369){return new BPromise(function(_0x10d542,_0x244b64){return client['request'](_0x18dbfb,_0x30f369)[_0xc752('0xb')](function(_0x2558f4){logger['info'](_0xc752('0xc'),_0x115fca,_0xc752('0xd'));logger['debug'](_0xc752('0xe'),_0x115fca,_0xc752('0xd'),JSON[_0xc752('0xf')](_0x2558f4));if(_0x2558f4[_0xc752('0x10')]){if(_0x2558f4['error']['code']===0x1f4){logger[_0xc752('0x10')](_0xc752('0xc'),_0x115fca,_0x2558f4[_0xc752('0x10')][_0xc752('0x11')]);return _0x244b64(_0x2558f4[_0xc752('0x10')]['message']);}logger[_0xc752('0x10')](_0xc752('0xc'),_0x115fca,_0x2558f4[_0xc752('0x10')][_0xc752('0x11')]);return _0x10d542(_0x2558f4[_0xc752('0x10')]['message']);}else{logger[_0xc752('0x12')](_0xc752('0xc'),_0x115fca,_0xc752('0xd'));_0x10d542(_0x2558f4[_0xc752('0x13')][_0xc752('0x11')]);}})[_0xc752('0x14')](function(_0x1bfbbd){logger[_0xc752('0x10')]('License,\x20%s,\x20%s',_0x115fca,_0x1bfbbd);_0x244b64(_0x1bfbbd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 061f021..43803f4 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 _0x08b1=['getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','delete','/:id/dispositions','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap'];(function(_0x21027b,_0x4f13f7){var _0x19fa93=function(_0x10efd1){while(--_0x10efd1){_0x21027b['push'](_0x21027b['shift']());}};_0x19fa93(++_0x4f13f7);}(_0x08b1,0xce));var _0x108b=function(_0x3029f9,_0x5157c6){_0x3029f9=_0x3029f9-0x0;var _0x3a67e4=_0x08b1[_0x3029f9];return _0x3a67e4;};'use strict';var multer=require(_0x108b('0x0'));var util=require(_0x108b('0x1'));var path=require(_0x108b('0x2'));var timeout=require(_0x108b('0x3'));var express=require(_0x108b('0x4'));var router=express[_0x108b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x108b('0x6'));var controller=require(_0x108b('0x7'));router['get']('/',auth[_0x108b('0x8')](),controller[_0x108b('0x9')]);router[_0x108b('0xa')](_0x108b('0xb'),auth[_0x108b('0x8')](),controller['describe']);router[_0x108b('0xa')](_0x108b('0xc'),auth['isAuthenticated'](),controller[_0x108b('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x108b('0xe')]);router[_0x108b('0xa')](_0x108b('0xf'),auth[_0x108b('0x8')](),controller[_0x108b('0x10')]);router[_0x108b('0xa')](_0x108b('0x11'),auth[_0x108b('0x8')](),controller[_0x108b('0x12')]);router['get']('/:id/out_servers',auth[_0x108b('0x8')](),controller[_0x108b('0x13')]);router[_0x108b('0xa')](_0x108b('0x14'),auth[_0x108b('0x8')](),controller[_0x108b('0x15')]);router[_0x108b('0xa')](_0x108b('0x16'),auth[_0x108b('0x8')](),controller[_0x108b('0x17')]);router[_0x108b('0xa')](_0x108b('0x18'),auth[_0x108b('0x8')](),controller[_0x108b('0x19')]);router[_0x108b('0xa')]('/:id/verify',auth[_0x108b('0x8')](),controller[_0x108b('0x1a')]);router['get'](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller[_0x108b('0x1c')]);router[_0x108b('0x1d')]('/:id/dispositions',auth[_0x108b('0x8')](),controller['addDisposition']);router[_0x108b('0x1d')]('/:id/canned_answers',auth[_0x108b('0x8')](),controller[_0x108b('0x1e')]);router[_0x108b('0x1d')]('/',auth[_0x108b('0x8')](),controller[_0x108b('0x1f')]);router[_0x108b('0x1d')](_0x108b('0x11'),auth[_0x108b('0x8')](),controller[_0x108b('0x20')]);router[_0x108b('0x1d')](_0x108b('0x21'),auth[_0x108b('0x8')](),controller[_0x108b('0x22')]);router[_0x108b('0x1d')](_0x108b('0x14'),auth['isAuthenticated'](),controller[_0x108b('0x23')]);router[_0x108b('0x1d')](_0x108b('0x16'),auth[_0x108b('0x8')](),controller[_0x108b('0x24')]);router[_0x108b('0x1d')](_0x108b('0x25'),auth[_0x108b('0x8')](),controller['send']);router['post'](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller[_0x108b('0x26')]);router['put'](_0x108b('0xc'),auth[_0x108b('0x8')](),controller[_0x108b('0x27')]);router[_0x108b('0x28')](_0x108b('0x29'),auth[_0x108b('0x8')](),controller['removeDispositions']);router[_0x108b('0x28')](_0x108b('0xf'),auth[_0x108b('0x8')](),controller['removeAnswers']);router[_0x108b('0x28')]('/:id/in_servers',auth[_0x108b('0x8')](),controller['removeImap']);router[_0x108b('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x108b('0x2a')]);router[_0x108b('0x28')](_0x108b('0xc'),auth[_0x108b('0x8')](),controller[_0x108b('0x2b')]);router[_0x108b('0x28')](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller['removeAgents']);module[_0x108b('0x2c')]=router; \ No newline at end of file +var _0x50af=['getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','verifySmtp','/:id/users'];(function(_0x22d11e,_0x4143d6){var _0x305cde=function(_0x29536a){while(--_0x29536a){_0x22d11e['push'](_0x22d11e['shift']());}};_0x305cde(++_0x4143d6);}(_0x50af,0xcf));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf50a('0x0'));var util=require(_0xf50a('0x1'));var path=require(_0xf50a('0x2'));var timeout=require(_0xf50a('0x3'));var express=require(_0xf50a('0x4'));var router=express['Router']();var fs_extra=require(_0xf50a('0x5'));var auth=require(_0xf50a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf50a('0x7'));router[_0xf50a('0x8')]('/',auth[_0xf50a('0x9')](),controller[_0xf50a('0xa')]);router[_0xf50a('0x8')]('/describe',auth[_0xf50a('0x9')](),controller[_0xf50a('0xb')]);router[_0xf50a('0x8')](_0xf50a('0xc'),auth[_0xf50a('0x9')](),controller['show']);router['get'](_0xf50a('0xd'),auth[_0xf50a('0x9')](),controller[_0xf50a('0xe')]);router[_0xf50a('0x8')](_0xf50a('0xf'),auth['isAuthenticated'](),controller[_0xf50a('0x10')]);router[_0xf50a('0x8')](_0xf50a('0x11'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x12')]);router['get'](_0xf50a('0x13'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x14')]);router[_0xf50a('0x8')](_0xf50a('0x15'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x16')]);router[_0xf50a('0x8')](_0xf50a('0x17'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x18')]);router[_0xf50a('0x8')]('/:id/messages',auth[_0xf50a('0x9')](),controller[_0xf50a('0x19')]);router[_0xf50a('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0xf50a('0x1a')]);router[_0xf50a('0x8')](_0xf50a('0x1b'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x1c')]);router[_0xf50a('0x1d')](_0xf50a('0xd'),auth[_0xf50a('0x9')](),controller['addDisposition']);router[_0xf50a('0x1d')]('/:id/canned_answers',auth[_0xf50a('0x9')](),controller[_0xf50a('0x1e')]);router[_0xf50a('0x1d')]('/',auth[_0xf50a('0x9')](),controller[_0xf50a('0x1f')]);router[_0xf50a('0x1d')](_0xf50a('0x11'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x20')]);router[_0xf50a('0x1d')]('/:id/out_servers',auth[_0xf50a('0x9')](),controller[_0xf50a('0x21')]);router['post'](_0xf50a('0x15'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x22')]);router[_0xf50a('0x1d')](_0xf50a('0x17'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x23')]);router[_0xf50a('0x1d')](_0xf50a('0x24'),auth['isAuthenticated'](),controller[_0xf50a('0x25')]);router['post']('/:id/users',auth[_0xf50a('0x9')](),controller[_0xf50a('0x26')]);router[_0xf50a('0x27')](_0xf50a('0xc'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x28')]);router['delete']('/:id/dispositions',auth[_0xf50a('0x9')](),controller['removeDispositions']);router[_0xf50a('0x29')](_0xf50a('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xf50a('0x29')](_0xf50a('0x11'),auth['isAuthenticated'](),controller[_0xf50a('0x2a')]);router[_0xf50a('0x29')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xf50a('0x2b')]);router[_0xf50a('0x29')](_0xf50a('0xc'),auth[_0xf50a('0x9')](),controller[_0xf50a('0x2c')]);router[_0xf50a('0x29')](_0xf50a('0x1b'),auth['isAuthenticated'](),controller[_0xf50a('0x2d')]);module[_0xf50a('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 22d2892..15e3913 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 _0x6c2d=['getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x6c2d,0x124));var _0xd6c2=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x6c2d[_0x286726];return _0xcd4fe9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xd6c2('0x0')]},'name':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xd6c2('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xd6c2('0x2')]},'markAsUnread':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![],'defaultValue':_0xd6c2('0x3')},'fontSize':{'type':Sequelize[_0xd6c2('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd6c2('0x2')],'defaultValue':function(){return _0xd6c2('0x5');}},'notificationSound':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd6c2('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xd6c2('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd6c2('0x7'),'set':function(_0x452556){if(!_0x452556)this[_0xd6c2('0x8')]('mandatoryDispositionPauseId',null);this[_0xd6c2('0x8')](_0xd6c2('0x9'),_0x452556);}},'provider':{'type':Sequelize[_0xd6c2('0xa')](_0xd6c2('0xb'),_0xd6c2('0xc'),_0xd6c2('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0xcea4e3=this[_0xd6c2('0xe')](_0xd6c2('0xf'));return _0xcea4e3||_0xd6c2('0x10');},'set':function(_0x316efe){if(_0x316efe==='custom'){_0x316efe=null;}return this[_0xd6c2('0x8')]('provider',_0x316efe);}}}; \ No newline at end of file +var _0xf41b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x14e393,_0x5ef7b3){var _0x5b5ffa=function(_0x133c89){while(--_0x133c89){_0x14e393['push'](_0x14e393['shift']());}};_0x5b5ffa(++_0x5ef7b3);}(_0xf41b,0x1d9));var _0xbf41=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0xf41b[_0x53f37f];return _0x2fe5f8;};'use strict';var Sequelize=require(_0xbf41('0x0'));module['exports']={'description':{'type':Sequelize[_0xbf41('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xbf41('0x3')]},'markAsUnread':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xbf41('0x1')],'allowNull':![],'defaultValue':_0xbf41('0x4')},'fontSize':{'type':Sequelize[_0xbf41('0x5')](0x2)[_0xbf41('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbf41('0x3')],'defaultValue':function(){return _0xbf41('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf41('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbf41('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf41('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf41('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbf41('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbf41('0x2')],'defaultValue':![],'comment':_0xbf41('0x9'),'set':function(_0x269fca){if(!_0x269fca)this[_0xbf41('0xa')](_0xbf41('0xb'),null);this[_0xbf41('0xa')](_0xbf41('0xc'),_0x269fca);}},'provider':{'type':Sequelize[_0xbf41('0xd')](_0xbf41('0xe'),'hotmail',_0xbf41('0xf'),_0xbf41('0x10')),'defaultValue':null,'get':function(){var _0x4ab115=this[_0xbf41('0x11')](_0xbf41('0x12'));return _0x4ab115||_0xbf41('0x13');},'set':function(_0x3d3300){if(_0x3d3300==='custom'){_0x3d3300=null;}return this[_0xbf41('0xa')](_0xbf41('0x12'),_0x3d3300);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5efeeef..2dc614e 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 _0x2ec3=['smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','host','port','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','mandatoryDispositionPause','intersection','find','update','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','create','findOne','nolimit','MailAccountId','filter','map','Disposition','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','true','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','defaults','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','undefined','limit','count','offset','status','Content-Range','json','destroy','get','MailAccounts','end','name','send','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail'];(function(_0x34f33d,_0x21b03a){var _0x47a32a=function(_0x58bd9f){while(--_0x58bd9f){_0x34f33d['push'](_0x34f33d['shift']());}};_0x47a32a(++_0x21b03a);}(_0x2ec3,0x156));var _0x32ec=function(_0x3aa4ce,_0x3268cd){_0x3aa4ce=_0x3aa4ce-0x0;var _0x37244a=_0x2ec3[_0x3aa4ce];return _0x37244a;};'use strict';var moment=require(_0x32ec('0x0'));var BPromise=require(_0x32ec('0x1'));var util=require(_0x32ec('0x2'));var path=require(_0x32ec('0x3'));var _=require(_0x32ec('0x4'));var juice=require('juice');var Redis=require(_0x32ec('0x5'));var qs=require(_0x32ec('0x6'));var logger=require('../../config/logger')(_0x32ec('0x7'));var config=require(_0x32ec('0x8'));var db=require(_0x32ec('0x9'))['db'];config[_0x32ec('0xa')]=_['defaults'](config[_0x32ec('0xa')],{'host':_0x32ec('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32ec('0xa')]));require(_0x32ec('0xc'))[_0x32ec('0xd')](socket);var jayson=require(_0x32ec('0xe'));var client=jayson[_0x32ec('0xf')][_0x32ec('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x1682da,_0xb24222,_0x5f2a4a,_0x29ced0){return new BPromise(function(_0x1d24c8,_0x530f08){var _0x1c73d4=_0x29ced0||client;return _0x1c73d4[_0x32ec('0x11')](_0x1682da,_0x5f2a4a)[_0x32ec('0x12')](function(_0x13a32a){logger[_0x32ec('0x13')](_0x32ec('0x14'),_0xb24222,'request\x20sent');logger[_0x32ec('0x15')](_0x32ec('0x16'),_0xb24222,_0x32ec('0x17'),JSON[_0x32ec('0x18')](_0x13a32a));if(_0x13a32a[_0x32ec('0x19')]){if(_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1a')]===0x1f4){logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1b')]);return _0x530f08(_0x13a32a['error']['message']);}logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x13a32a[_0x32ec('0x19')]['message']);return _0x1d24c8(_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1b')]);}else{logger[_0x32ec('0x13')]('MailAccount,\x20%s,\x20%s',_0xb24222,_0x32ec('0x17'));_0x1d24c8(_0x13a32a[_0x32ec('0x1c')]['message']);}})[_0x32ec('0x1d')](function(_0x582307){logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x582307);_0x530f08(_0x582307);});});}function respondWithStatusCode(_0x590d83,_0xd52d61){_0xd52d61=_0xd52d61||0xcc;return function(_0x2d2233){if(_0x2d2233){return _0x590d83[_0x32ec('0x1e')](_0xd52d61);}return _0x590d83['status'](_0xd52d61)['end']();};}function respondWithResult(_0x520d0c,_0x197091){_0x197091=_0x197091||0xc8;return function(_0x398847){if(_0x398847){return _0x520d0c['status'](_0x197091)['json'](_0x398847);}};}function respondWithFilteredResult(_0x1b234d,_0x41e6a5){return function(_0x1416bc){if(_0x1416bc){var _0x4b200c=typeof _0x41e6a5['offset']===_0x32ec('0x1f')&&typeof _0x41e6a5[_0x32ec('0x20')]===_0x32ec('0x1f');var _0xa764e4=_0x1416bc[_0x32ec('0x21')];var _0x474ed5=_0x4b200c?0x0:_0x41e6a5[_0x32ec('0x22')];var _0x118306=_0x4b200c?_0x1416bc[_0x32ec('0x21')]:_0x41e6a5[_0x32ec('0x22')]+_0x41e6a5[_0x32ec('0x20')];var _0x2e2690;if(_0x118306>=_0xa764e4){_0x118306=_0xa764e4;_0x2e2690=0xc8;}else{_0x2e2690=0xce;}_0x1b234d[_0x32ec('0x23')](_0x2e2690);return _0x1b234d['set'](_0x32ec('0x24'),_0x474ed5+'-'+_0x118306+'/'+_0xa764e4)[_0x32ec('0x25')](_0x1416bc);}return null;};}function saveUpdates(_0x498448){return function(_0x1a3756){if(_0x1a3756){return _0x1a3756['update'](_0x498448)[_0x32ec('0x12')](function(_0x20316a){return _0x20316a;});}return null;};}function removeEntity(_0x2406de){return function(_0x9bc8c0){if(_0x9bc8c0){return _0x9bc8c0[_0x32ec('0x26')]()[_0x32ec('0x12')](function(){var _0x397592=_0x9bc8c0[_0x32ec('0x27')]({'plain':!![]});var _0x446e59=_0x32ec('0x28');return db['UserProfileResource'][_0x32ec('0x26')]({'where':{'type':_0x446e59,'resourceId':_0x397592['id']}})[_0x32ec('0x12')](function(){return _0x9bc8c0;});})[_0x32ec('0x12')](function(){_0x2406de[_0x32ec('0x23')](0xcc)[_0x32ec('0x29')]();});}};}function handleEntityNotFound(_0x11ef97){return function(_0x3426eb){if(!_0x3426eb){_0x11ef97[_0x32ec('0x1e')](0x194);}return _0x3426eb;};}function handleError(_0x2dd1e6,_0x4bf46e){_0x4bf46e=_0x4bf46e||0x1f4;return function(_0x402b83){logger['error'](_0x402b83['stack']);if(_0x402b83[_0x32ec('0x2a')]){delete _0x402b83[_0x32ec('0x2a')];}_0x2dd1e6[_0x32ec('0x23')](_0x4bf46e)[_0x32ec('0x2b')](_0x402b83);};}function getImapHost(_0x48a05a){switch(_0x48a05a){case _0x32ec('0x2c'):return'imap.gmail.com';case _0x32ec('0x2d'):return _0x32ec('0x2e');case'hotmail':return _0x32ec('0x2f');case _0x32ec('0x30'):return _0x32ec('0x31');}throw new Error(_0x32ec('0x32'),_0x48a05a);}function getSmtpHost(_0xdff956){switch(_0xdff956){case _0x32ec('0x2c'):return _0x32ec('0x33');case _0x32ec('0x2d'):return _0x32ec('0x34');case _0x32ec('0x35'):return _0x32ec('0x36');case _0x32ec('0x30'):return _0x32ec('0x37');}throw new Error(_0x32ec('0x32'),_0xdff956);}function getAuthenticationOptions(_0x1d3e8a,_0x40c4b0){var _0x18ce64={};var _0x3238f5={};if(_0x1d3e8a){_0x18ce64[_0x32ec('0x38')]=_0x3238f5[_0x32ec('0x38')]=_0x40c4b0['username'];_0x18ce64[_0x32ec('0x39')]=_0x3238f5['pass']=_0x40c4b0['password'];if(_0x40c4b0[_0x32ec('0x3a')]){_0x18ce64['modernAuthentication']=_0x3238f5[_0x32ec('0x3a')]=!![];_0x18ce64['CloudProviderId']=_0x3238f5[_0x32ec('0x3b')]=_0x40c4b0['CloudProviderId'];_0x18ce64[_0x32ec('0x39')]=_0x3238f5['pass']=null;}else{_0x18ce64['CloudProviderId']=_0x3238f5[_0x32ec('0x3b')]=null;}_0x18ce64[_0x32ec('0x3c')]=getImapHost(_0x1d3e8a);_0x18ce64[_0x32ec('0x3d')]=0x3e1;_0x3238f5[_0x32ec('0x3c')]=getSmtpHost(_0x1d3e8a);_0x3238f5[_0x32ec('0x3d')]=0x24b;_0x3238f5['secure']=![];_0x18ce64[_0x32ec('0x3e')]=_0x3238f5['service']=null;}else{if(_0x40c4b0[_0x32ec('0x3f')]){_0x18ce64[_0x32ec('0x38')]=_0x3238f5['user']=_0x40c4b0[_0x32ec('0x40')];_0x18ce64[_0x32ec('0x39')]=_0x3238f5[_0x32ec('0x41')]=_0x40c4b0[_0x32ec('0x39')];}else{_0x18ce64['authentication']=_0x3238f5[_0x32ec('0x3f')]=![];_0x18ce64[_0x32ec('0x38')]=_0x3238f5[_0x32ec('0x38')]=null;_0x18ce64['password']=_0x3238f5[_0x32ec('0x41')]=null;}_0x18ce64[_0x32ec('0x3c')]=_0x40c4b0[_0x32ec('0x42')][_0x32ec('0x3c')];_0x18ce64[_0x32ec('0x3d')]=_0x40c4b0[_0x32ec('0x42')]['port'];_0x3238f5[_0x32ec('0x3c')]=_0x40c4b0[_0x32ec('0x43')][_0x32ec('0x3c')];_0x3238f5['port']=_0x40c4b0['Smtp'][_0x32ec('0x3d')];}return{'Imap':_0x18ce64,'Smtp':_0x3238f5};}exports[_0x32ec('0x44')]=function(_0x57ed68,_0x2abb13){var _0x34966e={'include':[{'model':db['MailServerIn'],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db[_0x32ec('0x46')],'as':'mandatoryDispositionPause'}]},_0x5cc7db={},_0x54ae6b={'count':0x0,'rows':[]};var _0x468d69=_['map'](db[_0x32ec('0x47')][_0x32ec('0x48')],function(_0x2f6528){return{'name':_0x2f6528[_0x32ec('0x49')],'type':_0x2f6528[_0x32ec('0x4a')]['key']};});_0x5cc7db[_0x32ec('0x4b')]=_['map'](_0x468d69,_0x32ec('0x2a'));_0x5cc7db[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x57ed68['query']);_0x5cc7db[_0x32ec('0x4e')]=_['intersection'](_0x5cc7db[_0x32ec('0x4b')],_0x5cc7db[_0x32ec('0x4c')]);_0x34966e[_0x32ec('0x4f')]=_['intersection'](_0x5cc7db[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x57ed68[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x34966e['attributes']=_0x34966e[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x34966e[_0x32ec('0x4f')]:_0x5cc7db['model'];if(!_0x57ed68[_0x32ec('0x4c')][_0x32ec('0x52')]('nolimit')){_0x34966e['limit']=qs['limit'](_0x57ed68['query'][_0x32ec('0x20')]);_0x34966e[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x57ed68['query'][_0x32ec('0x22')]);}_0x34966e[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x57ed68['query'][_0x32ec('0x54')]);_0x34966e[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x57ed68['query'],_0x5cc7db[_0x32ec('0x4e')]),_0x468d69);if(_0x57ed68[_0x32ec('0x4c')]['filter']){_0x34966e['where']=_[_0x32ec('0x57')](_0x34966e[_0x32ec('0x55')],{'$or':_['map'](_0x468d69,function(_0x5e48d6){if(_0x5e48d6[_0x32ec('0x4a')]!==_0x32ec('0x58')){var _0x1be59e={};_0x1be59e[_0x5e48d6[_0x32ec('0x2a')]]={'$like':'%'+_0x57ed68[_0x32ec('0x4c')]['filter']+'%'};return _0x1be59e;}})});}_0x34966e=_['merge']({},_0x34966e,_0x57ed68[_0x32ec('0x59')]);var _0x2afb8d={'where':_0x34966e['where']};return db['MailAccount']['count'](_0x2afb8d)[_0x32ec('0x12')](function(_0x1536f3){_0x54ae6b[_0x32ec('0x21')]=_0x1536f3;if(_0x57ed68['query'][_0x32ec('0x5a')]){_0x34966e[_0x32ec('0x5b')]=[{'all':!![]}];}return db[_0x32ec('0x47')][_0x32ec('0x5c')](_0x34966e);})[_0x32ec('0x12')](function(_0x2ea814){_0x54ae6b[_0x32ec('0x5d')]=_0x2ea814;return _0x54ae6b;})['then'](respondWithFilteredResult(_0x2abb13,_0x34966e))['catch'](handleError(_0x2abb13,null));};exports['show']=function(_0x7ba153,_0x21998f){var _0xc5f4b2={'raw':![],'where':{'id':_0x7ba153[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db['Pause'],'as':_0x32ec('0x60')}]},_0x651760={};_0x651760[_0x32ec('0x4b')]=_['keys'](db['MailAccount'][_0x32ec('0x48')]);_0x651760[_0x32ec('0x4c')]=_['keys'](_0x7ba153[_0x32ec('0x4c')]);_0x651760[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x651760['model'],_0x651760[_0x32ec('0x4c')]);_0xc5f4b2[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x651760[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x7ba153[_0x32ec('0x4c')]['fields']));_0xc5f4b2[_0x32ec('0x4f')]=_0xc5f4b2[_0x32ec('0x4f')][_0x32ec('0x51')]?_0xc5f4b2[_0x32ec('0x4f')]:_0x651760['model'];if(_0x7ba153[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0xc5f4b2[_0x32ec('0x5b')]=[{'all':!![]}];}_0xc5f4b2=_[_0x32ec('0x57')]({},_0xc5f4b2,_0x7ba153['options']);return db[_0x32ec('0x47')][_0x32ec('0x62')](_0xc5f4b2)['then'](handleEntityNotFound(_0x21998f,null))[_0x32ec('0x12')](respondWithResult(_0x21998f,null))[_0x32ec('0x1d')](handleError(_0x21998f,null));};exports[_0x32ec('0x63')]=function(_0x519e30,_0x1d3f7b){if(_0x519e30[_0x32ec('0x64')]['id']){delete _0x519e30[_0x32ec('0x64')]['id'];}var _0x57c1b2=_0x519e30[_0x32ec('0x64')][_0x32ec('0x65')]===_0x32ec('0x66')?null:_0x519e30[_0x32ec('0x64')][_0x32ec('0x65')];var _0x4f2043=_0x519e30[_0x32ec('0x64')]['Imap']||{};var _0x5b16af=_0x519e30[_0x32ec('0x64')][_0x32ec('0x43')]||{};if(_0x57c1b2){_0x4f2043[_0x32ec('0x3c')]=getImapHost(_0x57c1b2);_0x4f2043[_0x32ec('0x3d')]=0x3e1;_0x5b16af[_0x32ec('0x3c')]=getSmtpHost(_0x57c1b2);_0x5b16af[_0x32ec('0x3d')]=0x24b;_0x5b16af[_0x32ec('0x67')]=![];}if(_0x5b16af[_0x32ec('0x3a')]){_0x5b16af[_0x32ec('0x67')]=![];}else{_0x5b16af[_0x32ec('0x3b')]=null;}if(!_0x4f2043[_0x32ec('0x3a')])_0x4f2043[_0x32ec('0x3b')]=null;_0x519e30[_0x32ec('0x64')][_0x32ec('0x42')]=_0x4f2043;_0x519e30[_0x32ec('0x64')][_0x32ec('0x43')]=_0x5b16af;return db['MailAccount'][_0x32ec('0x62')]({'where':{'id':_0x519e30[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':'Smtp'},{'model':db[_0x32ec('0x46')],'as':_0x32ec('0x60')}]})['then'](handleEntityNotFound(_0x1d3f7b,null))['then'](function(_0x125d9a){if(!_0x125d9a)throw new Error(_0x32ec('0x68'));if(_0x125d9a[_0x32ec('0x3e')])delete _0x519e30[_0x32ec('0x64')][_0x32ec('0x42')];return _0x125d9a;})[_0x32ec('0x12')](saveUpdates(_0x519e30[_0x32ec('0x64')],null))['then'](function(_0x4b4845){if(!_0x519e30['body'][_0x32ec('0x42')])return _0x4b4845;return db[_0x32ec('0x5f')]['update'](_0x519e30[_0x32ec('0x64')][_0x32ec('0x42')],{'where':{'MailAccountId':_0x4b4845['id']}})[_0x32ec('0x12')](function(){return _0x4b4845;});})['then'](function(_0x3e86a5){if(!_0x519e30[_0x32ec('0x64')]['Smtp'])return _0x3e86a5;return db['MailServerOut'][_0x32ec('0x63')](_0x519e30['body'][_0x32ec('0x43')],{'where':{'MailAccountId':_0x3e86a5['id']}})['then'](function(){return _0x3e86a5;});})[_0x32ec('0x12')](respondWithResult(_0x1d3f7b,null))[_0x32ec('0x1d')](handleError(_0x1d3f7b,null));};exports['describe']=function(_0x245615,_0x3047c1){return db[_0x32ec('0x47')][_0x32ec('0x69')]()['then'](respondWithResult(_0x3047c1,null))[_0x32ec('0x1d')](handleError(_0x3047c1,null));};exports[_0x32ec('0x6a')]=function(_0x5d0e8e,_0xe0e12f){if(_0x5d0e8e['body']['id']){delete _0x5d0e8e['body']['id'];}return db[_0x32ec('0x47')]['find']({'where':{'id':_0x5d0e8e[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0xe0e12f,null))[_0x32ec('0x12')](function(_0x317278){if(_0x317278){_0x5d0e8e[_0x32ec('0x64')]['MailAccountId']=_0x317278['id'];return db['Disposition'][_0x32ec('0x6b')](_0x5d0e8e[_0x32ec('0x64')]);}})['then'](respondWithResult(_0xe0e12f,null))[_0x32ec('0x1d')](handleError(_0xe0e12f,null));};exports['getDispositions']=function(_0x5b32bd,_0x5154c5){var _0x488059={'raw':![],'where':{}};var _0x2ec62e={};var _0x4abb4f={'count':0x0,'rows':[]};return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x5b32bd[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5154c5,null))[_0x32ec('0x12')](function(_0x3aab71){if(_0x3aab71){_0x2ec62e[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db['Disposition'][_0x32ec('0x48')]);_0x2ec62e[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x5b32bd['query']);_0x2ec62e[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x2ec62e[_0x32ec('0x4b')],_0x2ec62e[_0x32ec('0x4c')]);_0x488059[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x2ec62e['model'],qs[_0x32ec('0x50')](_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x488059[_0x32ec('0x4f')]=_0x488059[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x488059['attributes']:_0x2ec62e[_0x32ec('0x4b')];if(!_0x5b32bd['query'][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x488059[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x488059[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x5b32bd['query']['offset']);}_0x488059[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x5b32bd['query'][_0x32ec('0x54')]);_0x488059[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x5b32bd[_0x32ec('0x4c')],_0x2ec62e['filters']));_0x488059[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x3aab71['id'];if(_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x488059['where']=_[_0x32ec('0x57')](_0x488059['where'],{'$or':_[_0x32ec('0x70')](_0x488059[_0x32ec('0x4f')],function(_0x26fb3b){var _0x55f587={};_0x55f587[_0x26fb3b]={'$like':'%'+_0x5b32bd[_0x32ec('0x4c')]['filter']+'%'};return _0x55f587;})});}_0x488059=_['merge']({},_0x488059,_0x5b32bd[_0x32ec('0x59')]);return db[_0x32ec('0x71')][_0x32ec('0x21')]({'where':_0x488059[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x3bcedc){_0x4abb4f[_0x32ec('0x21')]=_0x3bcedc;if(_0x5b32bd[_0x32ec('0x4c')]['includeAll']){_0x488059[_0x32ec('0x5b')]=[{'all':!![]}];}return db[_0x32ec('0x71')][_0x32ec('0x5c')](_0x488059);})['then'](function(_0x22a3b0){_0x4abb4f['rows']=_0x22a3b0;return _0x4abb4f;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x5154c5,_0x488059))[_0x32ec('0x1d')](handleError(_0x5154c5,null));};exports[_0x32ec('0x72')]=function(_0xd479a2,_0x3c1413){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0xd479a2[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3c1413,null))['then'](function(_0x10fc8b){if(_0x10fc8b){return _0x10fc8b['removeDispositions'](_0xd479a2[_0x32ec('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0x3c1413,null))['catch'](handleError(_0x3c1413,null));};exports['addAnswer']=function(_0x40fb1d,_0xc15320){if(_0x40fb1d['body']['id']){delete _0x40fb1d[_0x32ec('0x64')]['id'];}return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x40fb1d['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0xc15320,null))[_0x32ec('0x12')](function(_0x2d5dfd){if(_0x2d5dfd){_0x40fb1d['body'][_0x32ec('0x6e')]=_0x2d5dfd['id'];return db['CannedAnswer'][_0x32ec('0x6b')](_0x40fb1d[_0x32ec('0x64')]);}})[_0x32ec('0x12')](respondWithResult(_0xc15320,null))[_0x32ec('0x1d')](handleError(_0xc15320,null));};exports[_0x32ec('0x73')]=function(_0x3cb846,_0x584c39){var _0x3f6312={'raw':![],'where':{}};var _0x5000cc={};var _0x22530a={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x3cb846[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x584c39,null))['then'](function(_0x47fac6){if(_0x47fac6){_0x5000cc[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x74')][_0x32ec('0x48')]);_0x5000cc[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x3cb846[_0x32ec('0x4c')]);_0x5000cc[_0x32ec('0x4e')]=_['intersection'](_0x5000cc[_0x32ec('0x4b')],_0x5000cc['query']);_0x3f6312[_0x32ec('0x4f')]=_['intersection'](_0x5000cc['model'],qs[_0x32ec('0x50')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x3f6312[_0x32ec('0x4f')]=_0x3f6312[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x3f6312[_0x32ec('0x4f')]:_0x5000cc[_0x32ec('0x4b')];if(!_0x3cb846['query']['hasOwnProperty'](_0x32ec('0x6d'))){_0x3f6312[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x3f6312[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x22')]);}_0x3f6312[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x3cb846['query'][_0x32ec('0x54')]);_0x3f6312[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x3cb846[_0x32ec('0x4c')],_0x5000cc[_0x32ec('0x4e')]));_0x3f6312[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x47fac6['id'];if(_0x3cb846['query'][_0x32ec('0x6f')]){_0x3f6312[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x3f6312['where'],{'$or':_['map'](_0x3f6312[_0x32ec('0x4f')],function(_0x1c587f){var _0x117677={};_0x117677[_0x1c587f]={'$like':'%'+_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x6f')]+'%'};return _0x117677;})});}_0x3f6312=_['merge']({},_0x3f6312,_0x3cb846[_0x32ec('0x59')]);return db[_0x32ec('0x74')][_0x32ec('0x21')]({'where':_0x3f6312[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0xb59ba1){_0x22530a[_0x32ec('0x21')]=_0xb59ba1;if(_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0x3f6312['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3f6312);})[_0x32ec('0x12')](function(_0x1833db){_0x22530a[_0x32ec('0x5d')]=_0x1833db;return _0x22530a;});}})['then'](respondWithFilteredResult(_0x584c39,_0x3f6312))[_0x32ec('0x1d')](handleError(_0x584c39,null));};exports[_0x32ec('0x75')]=function(_0x44cb0f,_0x3f09a3){return db[_0x32ec('0x47')]['find']({'where':{'id':_0x44cb0f[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3f09a3,null))[_0x32ec('0x12')](function(_0x2c541f){if(_0x2c541f){return _0x2c541f['removeAnswers'](_0x44cb0f[_0x32ec('0x4c')][_0x32ec('0x76')]);}})[_0x32ec('0x12')](respondWithStatusCode(_0x3f09a3,null))[_0x32ec('0x1d')](handleError(_0x3f09a3,null));};exports[_0x32ec('0x6b')]=function(_0x2263db,_0x370718){var _0xce1f30={'name':_0x2263db[_0x32ec('0x64')]['name'],'key':_0x2263db['body'][_0x32ec('0x77')],'provider':_0x2263db[_0x32ec('0x64')]['provider']==='custom'?null:_0x2263db[_0x32ec('0x64')][_0x32ec('0x65')],'email':_0x2263db[_0x32ec('0x64')][_0x32ec('0x78')],'ListId':_0x2263db['body'][_0x32ec('0x79')],'active':!_[_0x32ec('0x7a')](_0x2263db[_0x32ec('0x64')][_0x32ec('0x7b')])?_0x2263db['body'][_0x32ec('0x7b')]:!![],'description':_0x2263db['body'][_0x32ec('0x7c')]||null};var _0x17726a=getAuthenticationOptions(_0xce1f30[_0x32ec('0x65')],_0x2263db[_0x32ec('0x64')]);_0xce1f30['Imap']=_0x17726a[_0x32ec('0x42')];_0xce1f30[_0x32ec('0x43')]=_0x17726a['Smtp'];return db['MailAccount']['create'](_0xce1f30,{'include':[{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')}]})[_0x32ec('0x12')](function(_0x42ca12){var _0x2f2359=_0x2263db['user']['get']({'plain':!![]});if(!_0x2f2359)throw new Error(_0x32ec('0x7d'));if(_0x2f2359[_0x32ec('0x7e')]===_0x32ec('0x38')){var _0x45b098=_0x42ca12[_0x32ec('0x27')]({'plain':!![]});return db[_0x32ec('0x7f')][_0x32ec('0x62')]({'where':{'name':_0x32ec('0x28'),'userProfileId':_0x2f2359[_0x32ec('0x80')]},'raw':!![]})[_0x32ec('0x12')](function(_0x5d4d8b){if(_0x5d4d8b&&_0x5d4d8b[_0x32ec('0x81')]===0x0){return db[_0x32ec('0x82')][_0x32ec('0x6b')]({'name':_0x45b098['name'],'resourceId':_0x45b098['id'],'type':_0x5d4d8b[_0x32ec('0x2a')],'sectionId':_0x5d4d8b['id']},{})['then'](function(){return _0x42ca12;});}else{return _0x42ca12;}})[_0x32ec('0x1d')](function(_0x20d773){logger[_0x32ec('0x19')](_0x32ec('0x83'),_0x20d773);throw _0x20d773;});}return _0x42ca12;})[_0x32ec('0x12')](respondWithResult(_0x370718,0xc9))[_0x32ec('0x1d')](handleError(_0x370718,null));};exports[_0x32ec('0x84')]=function(_0x3a6255,_0x38aa89){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x3a6255[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x38aa89,null))['then'](function(_0x208526){if(_0x208526){return _0x208526[_0x32ec('0x84')]();}return null;})[_0x32ec('0x12')](respondWithResult(_0x38aa89,null))[_0x32ec('0x1d')](handleError(_0x38aa89,null));};exports[_0x32ec('0x85')]=function(_0x5b045a,_0x48afe8){if(_0x5b045a[_0x32ec('0x64')]['id']){delete _0x5b045a['body']['id'];}return db['MailAccount'][_0x32ec('0x62')]({'where':{'id':_0x5b045a[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x48afe8,null))[_0x32ec('0x12')](function(_0x5dd39c){if(_0x5dd39c){_0x5b045a['body'][_0x32ec('0x6e')]=_0x5dd39c['id'];return db[_0x32ec('0x5f')][_0x32ec('0x6b')](_0x5b045a[_0x32ec('0x64')]);}})[_0x32ec('0x12')](respondWithResult(_0x48afe8,null))[_0x32ec('0x1d')](handleError(_0x48afe8,null));};exports[_0x32ec('0x86')]=function(_0x52a89e,_0x5b597b){return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x52a89e['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x5b597b,null))[_0x32ec('0x12')](function(_0x5e89ca){if(_0x5e89ca){return _0x5e89ca[_0x32ec('0x87')](null);}return null;})[_0x32ec('0x12')](respondWithStatusCode(_0x5b597b,null))[_0x32ec('0x1d')](handleError(_0x5b597b,null));};exports['getSmtp']=function(_0x544096,_0x1c2e7d){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x544096[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x1c2e7d,null))[_0x32ec('0x12')](function(_0x150b04){if(_0x150b04){return _0x150b04[_0x32ec('0x88')]();}return null;})['then'](respondWithResult(_0x1c2e7d,null))['catch'](handleError(_0x1c2e7d,null));};exports['addSmtp']=function(_0x5ba12c,_0x100319){if(_0x5ba12c[_0x32ec('0x64')]['id']){delete _0x5ba12c['body']['id'];}return db[_0x32ec('0x47')]['find']({'where':{'id':_0x5ba12c[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x100319,null))[_0x32ec('0x12')](function(_0x4a8c2f){if(_0x4a8c2f){_0x5ba12c['body'][_0x32ec('0x6e')]=_0x4a8c2f['id'];return db[_0x32ec('0x45')][_0x32ec('0x6b')](_0x5ba12c[_0x32ec('0x64')]);}})['then'](respondWithResult(_0x100319,null))['catch'](handleError(_0x100319,null));};exports['removeSmtp']=function(_0x513496,_0x5b1684){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x513496[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x5b1684,null))['then'](function(_0x475d27){if(_0x475d27){return _0x475d27['setSmtp'](null);}return null;})[_0x32ec('0x12')](respondWithStatusCode(_0x5b1684,null))[_0x32ec('0x1d')](handleError(_0x5b1684,null));};exports[_0x32ec('0x89')]=function(_0x3d910b,_0x558d56){return db[_0x32ec('0x8a')][_0x32ec('0x62')]({'where':{'id':_0x3d910b['params']['id']}})['then'](handleEntityNotFound(_0x558d56,null))[_0x32ec('0x12')](function(_0x3771da){if(_0x3771da){return _0x3771da[_0x32ec('0x89')](_0x3d910b[_0x32ec('0x64')][_0x32ec('0x76')],_[_0x32ec('0x8b')](_0x3d910b[_0x32ec('0x64')],[_0x32ec('0x76'),'id'])||{});}})['then'](respondWithResult(_0x558d56,null))[_0x32ec('0x1d')](handleError(_0x558d56,null));};exports['getInteractions']=function(_0x38687c,_0x3008ee){var _0x221249={'raw':![],'where':{}};var _0x1cd494={};var _0x33e14e={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x38687c[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3008ee,null))[_0x32ec('0x12')](function(_0x47f79b){if(_0x47f79b){_0x1cd494[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x8a')][_0x32ec('0x48')]);_0x1cd494[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x38687c[_0x32ec('0x4c')]);_0x1cd494[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x1cd494[_0x32ec('0x4b')],_0x1cd494[_0x32ec('0x4c')]);_0x221249['attributes']=_[_0x32ec('0x61')](_0x1cd494['model'],qs['fields'](_0x38687c[_0x32ec('0x4c')]['fields']));_0x221249[_0x32ec('0x4f')]=_0x221249[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x221249[_0x32ec('0x4f')]:_0x1cd494['model'];if(!_0x38687c[_0x32ec('0x4c')][_0x32ec('0x52')]('nolimit')){_0x221249['limit']=qs['limit'](_0x38687c[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x221249[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x38687c[_0x32ec('0x4c')]['offset']);}_0x221249['order']=qs[_0x32ec('0x54')](_0x38687c['query']['sort']);_0x221249[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x38687c[_0x32ec('0x4c')],_0x1cd494[_0x32ec('0x4e')]));_0x221249[_0x32ec('0x55')]['MailAccountId']=_0x47f79b['id'];if(_0x38687c[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x221249[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x221249['where'],{'$or':_[_0x32ec('0x70')](_0x221249[_0x32ec('0x4f')],function(_0x2cc740){var _0x321ebe={};_0x321ebe[_0x2cc740]={'$like':'%'+_0x38687c[_0x32ec('0x4c')][_0x32ec('0x6f')]+'%'};return _0x321ebe;})});}_0x221249=_[_0x32ec('0x57')]({},_0x221249,_0x38687c[_0x32ec('0x59')]);return db['MailInteraction']['count']({'where':_0x221249[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x5e2246){_0x33e14e[_0x32ec('0x21')]=_0x5e2246;if(_0x38687c[_0x32ec('0x4c')]['includeAll']){_0x221249[_0x32ec('0x5b')]=[{'model':db[_0x32ec('0x8c')],'as':_0x32ec('0x8d'),'required':![]},{'model':db['User'],'as':_0x32ec('0x8e'),'attributes':[_0x32ec('0x2a'),'fullname',_0x32ec('0x8f')],'required':![]},{'model':db[_0x32ec('0x90')],'as':_0x32ec('0x91'),'attributes':['id',_0x32ec('0x2a'),_0x32ec('0x92')],'where':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]?{'id':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]}:undefined,'required':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]?!![]:![]}];}return db[_0x32ec('0x8a')][_0x32ec('0x5c')](_0x221249);})['then'](function(_0x1ca201){_0x33e14e[_0x32ec('0x5d')]=_0x1ca201;return _0x33e14e;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x3008ee,_0x221249))[_0x32ec('0x1d')](handleError(_0x3008ee,null));};exports[_0x32ec('0x94')]=function addApplications(_0x144c15,_0x5e7c15){var _0x362c12=_0x144c15['params']['id'];var _0x3f9ac5=_0x144c15[_0x32ec('0x64')];var _0x41d83b=0xc8;var _0x5c6999=null;return db[_0x32ec('0x95')][_0x32ec('0x96')]({'isolationLevel':db[_0x32ec('0x95')]['Transaction'][_0x32ec('0x97')][_0x32ec('0x98')]},function(_0x4b7cde){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x362c12},'transaction':_0x4b7cde})[_0x32ec('0x12')](function(_0x5965a2){if(_0x5965a2){return db['MailApplication'][_0x32ec('0x26')]({'where':{'MailAccountId':_0x362c12},'transaction':_0x4b7cde})[_0x32ec('0x12')](function(){var _0x5c38e1=_[_0x32ec('0x70')](_0x3f9ac5,function(_0x6b443f){_0x6b443f['MailAccountId']=_0x362c12;return _0x6b443f;});return db[_0x32ec('0x99')][_0x32ec('0x9a')](_0x5c38e1,{'transaction':_0x4b7cde});});}else{_0x41d83b=0x194;_0x5c6999=[];}});})[_0x32ec('0x12')](function(){if(_0x41d83b!==0x194){return db[_0x32ec('0x99')][_0x32ec('0x9b')]({'where':{'MailAccountId':_0x362c12},'order':'priority'})[_0x32ec('0x12')](function(_0x1b7233){_0x5c6999=_0x1b7233;});}})[_0x32ec('0x1d')](function(_0x568976){_0x41d83b=0x1f4;logger['error'](_0x568976['stack']);if(_0x568976['name']){delete _0x568976['name'];}_0x5c6999=_0x568976;})[_0x32ec('0x9c')](function(){if(_0x5c6999===null){_0x5e7c15['sendStatus'](_0x41d83b);}else{if(_0x41d83b===0x1f4){_0x5e7c15[_0x32ec('0x23')](_0x41d83b)['send'](_0x5c6999);}else{_0x5e7c15[_0x32ec('0x23')](_0x41d83b)[_0x32ec('0x25')](_0x5c6999);}}});};exports['getApplications']=function(_0x1ec77d,_0x54bd2d){var _0x2008dd={};var _0x377c24={};var _0x129cdb;var _0x47be36;return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x1ec77d[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x54bd2d,null))['then'](function(_0x47c344){if(_0x47c344){_0x129cdb=_0x47c344;_0x377c24['model']=_[_0x32ec('0x4d')](db['MailApplication']['rawAttributes']);_0x377c24[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x1ec77d['query']);_0x377c24[_0x32ec('0x4e')]=_['intersection'](_0x377c24[_0x32ec('0x4b')],_0x377c24['query']);_0x2008dd[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x377c24[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x1ec77d['query'][_0x32ec('0x50')]));_0x2008dd[_0x32ec('0x4f')]=_0x2008dd[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x2008dd[_0x32ec('0x4f')]:_0x377c24[_0x32ec('0x4b')];_0x2008dd[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x1ec77d[_0x32ec('0x4c')]['sort']);_0x2008dd[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_['pick'](_0x1ec77d[_0x32ec('0x4c')],_0x377c24[_0x32ec('0x4e')]));if(_0x1ec77d['query']['filter']){_0x2008dd[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x2008dd[_0x32ec('0x55')],{'$or':_[_0x32ec('0x70')](_0x2008dd[_0x32ec('0x4f')],function(_0x175610){var _0xac4caa={};_0xac4caa[_0x175610]={'$like':'%'+_0x1ec77d['query'][_0x32ec('0x6f')]+'%'};return _0xac4caa;})});}_0x2008dd=_[_0x32ec('0x57')]({},_0x2008dd,_0x1ec77d[_0x32ec('0x59')]);return _0x129cdb[_0x32ec('0x9d')](_0x2008dd);}})[_0x32ec('0x12')](function(_0x285c7b){if(_0x285c7b){_0x47be36=_0x285c7b['length'];if(!_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x2008dd[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x2008dd[_0x32ec('0x22')]=qs['offset'](_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x22')]);}return _0x129cdb[_0x32ec('0x9d')](_0x2008dd);}})[_0x32ec('0x12')](function(_0x28c0e6){if(_0x28c0e6){return _0x28c0e6?{'count':_0x47be36,'rows':_0x28c0e6}:null;}})[_0x32ec('0x12')](respondWithResult(_0x54bd2d,null))[_0x32ec('0x1d')](handleError(_0x54bd2d,null));};exports[_0x32ec('0x9e')]=function(_0x2b7cb1,_0x278960){var _0x4e0ba8={'raw':!![],'where':{}};var _0x947505={};var _0x1e9723={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x2b7cb1['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x278960,null))['then'](function(_0x37d653){if(_0x37d653){_0x947505[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x9f')][_0x32ec('0x48')]);_0x947505[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x2b7cb1[_0x32ec('0x4c')]);_0x947505[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x947505[_0x32ec('0x4b')],_0x947505[_0x32ec('0x4c')]);_0x4e0ba8[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x947505['model'],qs[_0x32ec('0x50')](_0x2b7cb1[_0x32ec('0x4c')]['fields']));_0x4e0ba8[_0x32ec('0x4f')]=_0x4e0ba8['attributes'][_0x32ec('0x51')]?_0x4e0ba8[_0x32ec('0x4f')]:_0x947505[_0x32ec('0x4b')];if(!_0x2b7cb1['query'][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x4e0ba8[_0x32ec('0x20')]=qs['limit'](_0x2b7cb1['query']['limit']);_0x4e0ba8[_0x32ec('0x22')]=qs['offset'](_0x2b7cb1['query'][_0x32ec('0x22')]);}_0x4e0ba8[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x2b7cb1[_0x32ec('0x4c')]['sort']);_0x4e0ba8[_0x32ec('0x55')]=qs['filters'](_['pick'](_0x2b7cb1[_0x32ec('0x4c')],_0x947505['filters']));_0x4e0ba8[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x37d653['id'];if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x4e0ba8[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x4e0ba8['where'],{'$or':_[_0x32ec('0x70')](_0x4e0ba8[_0x32ec('0x4f')],function(_0x54082a){var _0x485b46={};_0x485b46[_0x54082a]={'$like':'%'+_0x2b7cb1[_0x32ec('0x4c')]['filter']+'%'};return _0x485b46;})});}if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0xa0')]){var _0xde57a3=_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0xa0')][_0x32ec('0xa1')](',');var _0x401df4={};_0x401df4[_0xde57a3[0x0]]={'$gte':moment(_0xde57a3[0x1])[_0x32ec('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e0ba8[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x4e0ba8[_0x32ec('0x55')],_0x401df4);}_0x4e0ba8=_[_0x32ec('0x57')]({},_0x4e0ba8,_0x2b7cb1[_0x32ec('0x59')]);return db[_0x32ec('0x9f')][_0x32ec('0x21')]({'where':_0x4e0ba8[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x1d7db3){_0x1e9723[_0x32ec('0x21')]=_0x1d7db3;if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0x4e0ba8['include']=[{'all':!![]}];}return db[_0x32ec('0x9f')][_0x32ec('0x5c')](_0x4e0ba8);})[_0x32ec('0x12')](function(_0x2ffe68){if(_0x2b7cb1[_0x32ec('0x4c')]['inlineCss']===_0x32ec('0xa3')){for(var _0x40cf12=0x0;_0x40cf12<_0x2ffe68[_0x32ec('0x51')];_0x40cf12++){_0x2ffe68[_0x40cf12][_0x32ec('0x64')]=juice(_0x2ffe68[_0x40cf12][_0x32ec('0x64')]);}}_0x1e9723[_0x32ec('0x5d')]=_0x2ffe68;return _0x1e9723;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x278960,_0x4e0ba8))[_0x32ec('0x1d')](handleError(_0x278960,null));};exports[_0x32ec('0x2b')]=function(_0x52b05e,_0x501315){var _0xdacd45,_0x209eba={},_0x5ed298;if(_0x52b05e[_0x32ec('0x64')]['to']){_0x5ed298=_0x52b05e[_0x32ec('0x64')]['to']['split'](',')[0x0];}return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x52b05e[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0xa4')],'as':'List','include':[{'model':db[_0x32ec('0x8c')],'as':_0x32ec('0xa5'),'where':{'email':_0x5ed298},'limit':0x1,'order':[['updatedAt',_0x32ec('0xa6')]]}]},{'model':db[_0x32ec('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x32ec('0xa7')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x501315,null))[_0x32ec('0x12')](function(_0x1bad56){if(!_0x1bad56)return;_0xdacd45=_0x1bad56;if(!_0x1bad56[_0x32ec('0x43')])throw new Error(_0x32ec('0xa8'));if(_[_0x32ec('0x7a')](_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')])){_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')]=util['format'](_0x32ec('0xaa'),_0x1bad56[_0x32ec('0x2a')],_0x1bad56[_0x32ec('0x78')]||_0x1bad56[_0x32ec('0x43')][_0x32ec('0x38')]);}if(_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')]&&_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')][_0x32ec('0x51')]){for(var _0x48add3=0x0;_0x48add3<_0x52b05e['body'][_0x32ec('0xab')]['length'];_0x48add3+=0x1){_0x52b05e[_0x32ec('0x64')]['attachments'][_0x48add3]={'filename':_0x52b05e[_0x32ec('0x64')]['attachments'][_0x48add3][_0x32ec('0x2a')],'path':path[_0x32ec('0xac')](config[_0x32ec('0xad')],'server/files/attachments',_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')][_0x48add3][_0x32ec('0xae')])};}}var _0x4390de=_0x1bad56[_0x32ec('0xaf')]();return respondWithRpcPromise(_0x32ec('0xb0'),'sendMail',{'account':_0x4390de,'message':_0x52b05e[_0x32ec('0x64')]});})['then'](function(_0x3046f7){if(!_0x3046f7)return;_0x209eba=_0x3046f7;if(!_0xdacd45[_0x32ec('0xb1')])throw new Error(_0x32ec('0xb2'));if(_0xdacd45[_0x32ec('0xb1')][_0x32ec('0xa5')][_0x32ec('0x51')])return _0xdacd45[_0x32ec('0xb1')]['Contacts'][0x0];return db[_0x32ec('0x8c')][_0x32ec('0x6b')](_[_0x32ec('0xb3')](_0x52b05e[_0x32ec('0x64')],{'firstName':_0x52b05e['body']['to'],'email':_0x52b05e[_0x32ec('0x64')]['to'],'phone':_0x52b05e[_0x32ec('0x64')]['to'],'ListId':_0xdacd45[_0x32ec('0x79')]}));})[_0x32ec('0x12')](function(_0x308cac){if(!_0x308cac)return;var _0x5a8b3e={'UserId':_0x52b05e[_0x32ec('0x38')]['id'],'ContactId':_0x308cac['id'],'MailAccountId':_0xdacd45['id'],'inReplyTo':_0x209eba['messageId'],'to':_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')],'cc':_0x52b05e[_0x32ec('0x64')]['cc'],'subject':_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb4')],'attach':_0x52b05e[_0x32ec('0x64')]['attach'],'firstMsgDirection':_0x32ec('0xb5'),'lastMsgAt':moment()[_0x32ec('0xa2')](_0x32ec('0xb6')),'lastMsgDirection':_0x32ec('0xb5'),'Messages':[_[_0x32ec('0x57')](_0x52b05e[_0x32ec('0x64')],{'messageId':_0x209eba[_0x32ec('0xb7')],'sentAt':moment()[_0x32ec('0xa2')](_0x32ec('0xb6')),'read':!![],'MailAccountId':_0xdacd45['id'],'UserId':_0x52b05e[_0x32ec('0x38')]['id'],'ContactId':_0x308cac['id']})]};if(_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb8')]){_0x5a8b3e=_[_0x32ec('0x57')](_0x5a8b3e,_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb8')]);}return db['MailInteraction'][_0x32ec('0x6b')](_0x5a8b3e,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})['then'](respondWithResult(_0x501315,null))['catch'](handleError(_0x501315,null));};exports[_0x32ec('0xb9')]=function(_0x265d86,_0x40f9bd){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x265d86[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43'),'raw':!![],'include':[{'model':db[_0x32ec('0xa7')],'as':_0x32ec('0xa7'),'raw':!![]}]}]})[_0x32ec('0x12')](handleEntityNotFound(_0x40f9bd,null))['then'](function(_0x58faee){if(!_0x58faee[_0x32ec('0x43')])return;var _0x917f12=_0x58faee[_0x32ec('0xaf')]();return respondWithRpcPromise(_0x32ec('0xba'),_0x32ec('0xb9'),{'account':_0x917f12});})[_0x32ec('0x12')](respondWithResult(_0x40f9bd,null))[_0x32ec('0x1d')](handleError(_0x40f9bd,null));};exports[_0x32ec('0x26')]=function(_0x3ab705,_0x1c6c9c){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x3ab705[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x1c6c9c,null))[_0x32ec('0x12')](function(_0x319960){if(_0x319960&&_0x319960[_0x32ec('0x3e')]){throw new db[(_0x32ec('0xbb'))][(_0x32ec('0xbc'))](_0x32ec('0xbd'));}return _0x319960;})['then'](removeEntity(_0x1c6c9c,null))[_0x32ec('0x1d')](handleError(_0x1c6c9c,null));};exports[_0x32ec('0xbe')]=function(_0x27114f,_0x473368){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x27114f[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x473368,null))[_0x32ec('0x12')](function(_0x437108){if(_0x437108){return _0x437108['addAgents'](_0x27114f['body'][_0x32ec('0x76')],_[_0x32ec('0x8b')](_0x27114f[_0x32ec('0x64')],[_0x32ec('0x76'),'id'])||{})[_0x32ec('0xbf')](function(_0x3ef6b0){for(var _0x119b89=0x0;_0x119b89<_0x27114f[_0x32ec('0x64')][_0x32ec('0x76')][_0x32ec('0x51')];_0x119b89+=0x1){socket[_0x32ec('0xc0')](_0x32ec('0xc1'),{'UserId':Number(_0x27114f['body'][_0x32ec('0x76')][_0x119b89]),'MailAccountId':Number(_0x27114f[_0x32ec('0x5e')]['id'])});}return _0x3ef6b0;});}})[_0x32ec('0x12')](respondWithResult(_0x473368,null))[_0x32ec('0x1d')](handleError(_0x473368,null));};exports['removeAgents']=function(_0x43e02b,_0x45dc21){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x43e02b['params']['id']}})['then'](handleEntityNotFound(_0x45dc21,null))[_0x32ec('0x12')](function(_0x4e4466){if(_0x4e4466){return _0x4e4466[_0x32ec('0xc2')](_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')])['then'](function(){if(_['isArray'](_0x43e02b['query'][_0x32ec('0x76')])){for(var _0x4a14e7=0x0;_0x4a14e7<_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')][_0x32ec('0x51')];_0x4a14e7+=0x1){socket[_0x32ec('0xc0')](_0x32ec('0xc3'),{'UserId':Number(_0x43e02b['query'][_0x32ec('0x76')][_0x4a14e7]),'MailAccountId':Number(_0x43e02b[_0x32ec('0x5e')]['id'])});}}else{socket['emit'](_0x32ec('0xc3'),{'UserId':Number(_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')]),'MailAccountId':Number(_0x43e02b[_0x32ec('0x5e')]['id'])});}});}})[_0x32ec('0x12')](respondWithStatusCode(_0x45dc21,null))['catch'](handleError(_0x45dc21,null));};exports[_0x32ec('0xc4')]=function(_0x32fa0d,_0x7a830e){var _0x193e04={};var _0x843f78={};var _0x41803c;var _0x5e6c4f;return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x32fa0d[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x7a830e,null))[_0x32ec('0x12')](function(_0x549cdc){if(_0x549cdc){_0x41803c=_0x549cdc;_0x843f78[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0xc5')][_0x32ec('0x48')]);_0x843f78[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x32fa0d[_0x32ec('0x4c')]);_0x843f78[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x843f78[_0x32ec('0x4b')],_0x843f78[_0x32ec('0x4c')]);_0x193e04['attributes']=_[_0x32ec('0x61')](_0x843f78[_0x32ec('0x4b')],qs['fields'](_0x32fa0d[_0x32ec('0x4c')]['fields']));_0x193e04[_0x32ec('0x4f')]=_0x193e04['attributes']['length']?_0x193e04['attributes']:_0x843f78[_0x32ec('0x4b')];_0x193e04[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x32fa0d['query'][_0x32ec('0x54')]);_0x193e04['where']=qs[_0x32ec('0x4e')](_['pick'](_0x32fa0d['query'],_0x843f78['filters']));if(_0x32fa0d['query'][_0x32ec('0x6f')]){_0x193e04['where']=_[_0x32ec('0x57')](_0x193e04[_0x32ec('0x55')],{'$or':_[_0x32ec('0x70')](_0x193e04[_0x32ec('0x4f')],function(_0x308909){var _0x285b1d={};_0x285b1d[_0x308909]={'$like':'%'+_0x32fa0d[_0x32ec('0x4c')]['filter']+'%'};return _0x285b1d;})});}_0x193e04=_[_0x32ec('0x57')]({},_0x193e04,_0x32fa0d[_0x32ec('0x59')]);return _0x41803c['getAgents'](_0x193e04);}})['then'](function(_0x552027){if(_0x552027){_0x5e6c4f=_0x552027[_0x32ec('0x51')];if(!_0x32fa0d[_0x32ec('0x4c')]['hasOwnProperty'](_0x32ec('0x6d'))){_0x193e04[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x32fa0d[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x193e04[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x32fa0d[_0x32ec('0x4c')][_0x32ec('0x22')]);}return _0x41803c[_0x32ec('0xc4')](_0x193e04);}})[_0x32ec('0x12')](function(_0x375233){if(_0x375233){return _0x375233?{'count':_0x5e6c4f,'rows':_0x375233}:null;}})['then'](respondWithResult(_0x7a830e,null))[_0x32ec('0x1d')](handleError(_0x7a830e,null));}; \ No newline at end of file +var _0x3f5a=['split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','messageId','subject','attach','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','destroy','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','MailServerIn','rawAttributes','intersection','length','include','find','body','provider','custom','modernAuthentication','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','getApplications','$gte'];(function(_0x4f3522,_0x3e9fb){var _0x5b4de7=function(_0x176d69){while(--_0x176d69){_0x4f3522['push'](_0x4f3522['shift']());}};_0x5b4de7(++_0x3e9fb);}(_0x3f5a,0x1b2));var _0xa3f5=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x3f5a[_0xf9a6cf];return _0x59e2bc;};'use strict';var moment=require(_0xa3f5('0x0'));var BPromise=require(_0xa3f5('0x1'));var util=require(_0xa3f5('0x2'));var path=require(_0xa3f5('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0xa3f5('0x4'));var qs=require(_0xa3f5('0x5'));var logger=require('../../config/logger')(_0xa3f5('0x6'));var config=require(_0xa3f5('0x7'));var db=require(_0xa3f5('0x8'))['db'];config[_0xa3f5('0x9')]=_[_0xa3f5('0xa')](config[_0xa3f5('0x9')],{'host':_0xa3f5('0xb'),'port':0x18eb});var socket=require(_0xa3f5('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xa3f5('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa3f5('0xe')][_0xa3f5('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x6661c4,_0x46ca8,_0x39a2cf,_0x42e103){return new BPromise(function(_0x4b2b80,_0x2597c8){var _0xb54c06=_0x42e103||client;return _0xb54c06[_0xa3f5('0x10')](_0x6661c4,_0x39a2cf)[_0xa3f5('0x11')](function(_0xce9dd1){logger['info']('MailAccount,\x20%s,\x20%s',_0x46ca8,_0xa3f5('0x12'));logger[_0xa3f5('0x13')](_0xa3f5('0x14'),_0x46ca8,_0xa3f5('0x12'),JSON['stringify'](_0xce9dd1));if(_0xce9dd1[_0xa3f5('0x15')]){if(_0xce9dd1['error'][_0xa3f5('0x16')]===0x1f4){logger[_0xa3f5('0x15')](_0xa3f5('0x17'),_0x46ca8,_0xce9dd1[_0xa3f5('0x15')]['message']);return _0x2597c8(_0xce9dd1['error']['message']);}logger['error'](_0xa3f5('0x17'),_0x46ca8,_0xce9dd1[_0xa3f5('0x15')][_0xa3f5('0x18')]);return _0x4b2b80(_0xce9dd1['error'][_0xa3f5('0x18')]);}else{logger[_0xa3f5('0x19')]('MailAccount,\x20%s,\x20%s',_0x46ca8,'request\x20sent');_0x4b2b80(_0xce9dd1[_0xa3f5('0x1a')][_0xa3f5('0x18')]);}})[_0xa3f5('0x1b')](function(_0xc58f38){logger[_0xa3f5('0x15')](_0xa3f5('0x17'),_0x46ca8,_0xc58f38);_0x2597c8(_0xc58f38);});});}function respondWithStatusCode(_0x53f1a8,_0x3fd980){_0x3fd980=_0x3fd980||0xcc;return function(_0x48e428){if(_0x48e428){return _0x53f1a8[_0xa3f5('0x1c')](_0x3fd980);}return _0x53f1a8[_0xa3f5('0x1d')](_0x3fd980)[_0xa3f5('0x1e')]();};}function respondWithResult(_0x4738f0,_0x56a61e){_0x56a61e=_0x56a61e||0xc8;return function(_0x26afd9){if(_0x26afd9){return _0x4738f0[_0xa3f5('0x1d')](_0x56a61e)['json'](_0x26afd9);}};}function respondWithFilteredResult(_0x559a99,_0x34f066){return function(_0x5244ce){if(_0x5244ce){var _0x5c8c80=typeof _0x34f066[_0xa3f5('0x1f')]===_0xa3f5('0x20')&&typeof _0x34f066[_0xa3f5('0x21')]===_0xa3f5('0x20');var _0x4cdb6b=_0x5244ce[_0xa3f5('0x22')];var _0x5ece1f=_0x5c8c80?0x0:_0x34f066[_0xa3f5('0x1f')];var _0x1a868d=_0x5c8c80?_0x5244ce['count']:_0x34f066[_0xa3f5('0x1f')]+_0x34f066[_0xa3f5('0x21')];var _0x109037;if(_0x1a868d>=_0x4cdb6b){_0x1a868d=_0x4cdb6b;_0x109037=0xc8;}else{_0x109037=0xce;}_0x559a99[_0xa3f5('0x1d')](_0x109037);return _0x559a99[_0xa3f5('0x23')](_0xa3f5('0x24'),_0x5ece1f+'-'+_0x1a868d+'/'+_0x4cdb6b)[_0xa3f5('0x25')](_0x5244ce);}return null;};}function saveUpdates(_0x22dc7c){return function(_0xf501d8){if(_0xf501d8){return _0xf501d8[_0xa3f5('0x26')](_0x22dc7c)['then'](function(_0x48ad3e){return _0x48ad3e;});}return null;};}function removeEntity(_0x151835){return function(_0x26e3d2){if(_0x26e3d2){return _0x26e3d2['destroy']()[_0xa3f5('0x11')](function(){var _0x123678=_0x26e3d2[_0xa3f5('0x27')]({'plain':!![]});var _0x3e913e='MailAccounts';return db['UserProfileResource'][_0xa3f5('0x28')]({'where':{'type':_0x3e913e,'resourceId':_0x123678['id']}})[_0xa3f5('0x11')](function(){return _0x26e3d2;});})[_0xa3f5('0x11')](function(){_0x151835['status'](0xcc)[_0xa3f5('0x1e')]();});}};}function handleEntityNotFound(_0x1906d1){return function(_0x593c97){if(!_0x593c97){_0x1906d1['sendStatus'](0x194);}return _0x593c97;};}function handleError(_0x4cbf6b,_0x2418fd){_0x2418fd=_0x2418fd||0x1f4;return function(_0xc4ca2f){logger[_0xa3f5('0x15')](_0xc4ca2f['stack']);if(_0xc4ca2f['name']){delete _0xc4ca2f[_0xa3f5('0x29')];}_0x4cbf6b[_0xa3f5('0x1d')](_0x2418fd)[_0xa3f5('0x2a')](_0xc4ca2f);};}function getImapHost(_0x112e8d){switch(_0x112e8d){case _0xa3f5('0x2b'):return'imap.gmail.com';case _0xa3f5('0x2c'):return _0xa3f5('0x2d');case _0xa3f5('0x2e'):return _0xa3f5('0x2f');case _0xa3f5('0x30'):return _0xa3f5('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x112e8d);}function getSmtpHost(_0x38a362){switch(_0x38a362){case'gmail':return'smtp.gmail.com';case'yahoo':return _0xa3f5('0x32');case _0xa3f5('0x2e'):return _0xa3f5('0x33');case _0xa3f5('0x30'):return _0xa3f5('0x34');}throw new Error(_0xa3f5('0x35'),_0x38a362);}function getAuthenticationOptions(_0x230e79,_0x34059f){var _0x556c50={};var _0x632b2f={};if(_0x230e79){_0x556c50[_0xa3f5('0x36')]=_0x632b2f['user']=_0x34059f[_0xa3f5('0x37')];_0x556c50[_0xa3f5('0x38')]=_0x632b2f['pass']=_0x34059f[_0xa3f5('0x38')];if(_0x34059f['modernAuthentication']){_0x556c50['modernAuthentication']=_0x632b2f['modernAuthentication']=!![];_0x556c50['CloudProviderId']=_0x632b2f[_0xa3f5('0x39')]=_0x34059f[_0xa3f5('0x39')];_0x556c50[_0xa3f5('0x38')]=_0x632b2f[_0xa3f5('0x3a')]=null;}else{_0x556c50[_0xa3f5('0x39')]=_0x632b2f[_0xa3f5('0x39')]=null;}_0x556c50[_0xa3f5('0x3b')]=getImapHost(_0x230e79);_0x556c50[_0xa3f5('0x3c')]=0x3e1;_0x632b2f[_0xa3f5('0x3b')]=getSmtpHost(_0x230e79);_0x632b2f['port']=0x24b;_0x632b2f[_0xa3f5('0x3d')]=![];_0x556c50['service']=_0x632b2f[_0xa3f5('0x3e')]=null;}else{if(_0x34059f[_0xa3f5('0x3f')]){_0x556c50[_0xa3f5('0x36')]=_0x632b2f[_0xa3f5('0x36')]=_0x34059f[_0xa3f5('0x37')];_0x556c50[_0xa3f5('0x38')]=_0x632b2f[_0xa3f5('0x3a')]=_0x34059f['password'];}else{_0x556c50[_0xa3f5('0x3f')]=_0x632b2f['authentication']=![];_0x556c50[_0xa3f5('0x36')]=_0x632b2f['user']=null;_0x556c50['password']=_0x632b2f[_0xa3f5('0x3a')]=null;}_0x556c50['host']=_0x34059f['Imap']['host'];_0x556c50['port']=_0x34059f[_0xa3f5('0x40')]['port'];_0x632b2f[_0xa3f5('0x3b')]=_0x34059f[_0xa3f5('0x41')]['host'];_0x632b2f[_0xa3f5('0x3c')]=_0x34059f[_0xa3f5('0x41')][_0xa3f5('0x3c')];}return{'Imap':_0x556c50,'Smtp':_0x632b2f};}exports['index']=function(_0x141122,_0x454e95){var _0xa00ef3={'include':[{'model':db['MailServerIn'],'as':_0xa3f5('0x40')},{'model':db[_0xa3f5('0x42')],'as':'Smtp'},{'model':db[_0xa3f5('0x43')],'as':_0xa3f5('0x44')}]},_0xb0b8cd={},_0x8e939c={'count':0x0,'rows':[]};var _0x11d4e6=_[_0xa3f5('0x45')](db[_0xa3f5('0x46')]['rawAttributes'],function(_0x5ad512){return{'name':_0x5ad512['fieldName'],'type':_0x5ad512[_0xa3f5('0x47')][_0xa3f5('0x48')]};});_0xb0b8cd[_0xa3f5('0x49')]=_[_0xa3f5('0x45')](_0x11d4e6,_0xa3f5('0x29'));_0xb0b8cd[_0xa3f5('0x4a')]=_[_0xa3f5('0x4b')](_0x141122[_0xa3f5('0x4a')]);_0xb0b8cd[_0xa3f5('0x4c')]=_['intersection'](_0xb0b8cd[_0xa3f5('0x49')],_0xb0b8cd[_0xa3f5('0x4a')]);_0xa00ef3[_0xa3f5('0x4d')]=_['intersection'](_0xb0b8cd[_0xa3f5('0x49')],qs[_0xa3f5('0x4e')](_0x141122[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0xa00ef3[_0xa3f5('0x4d')]=_0xa00ef3['attributes']['length']?_0xa00ef3['attributes']:_0xb0b8cd['model'];if(!_0x141122[_0xa3f5('0x4a')][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0xa00ef3['limit']=qs['limit'](_0x141122[_0xa3f5('0x4a')]['limit']);_0xa00ef3[_0xa3f5('0x1f')]=qs[_0xa3f5('0x1f')](_0x141122[_0xa3f5('0x4a')][_0xa3f5('0x1f')]);}_0xa00ef3[_0xa3f5('0x51')]=qs[_0xa3f5('0x52')](_0x141122['query'][_0xa3f5('0x52')]);_0xa00ef3[_0xa3f5('0x53')]=qs[_0xa3f5('0x4c')](_[_0xa3f5('0x54')](_0x141122[_0xa3f5('0x4a')],_0xb0b8cd[_0xa3f5('0x4c')]),_0x11d4e6);if(_0x141122[_0xa3f5('0x4a')][_0xa3f5('0x55')]){_0xa00ef3[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0xa00ef3[_0xa3f5('0x53')],{'$or':_[_0xa3f5('0x45')](_0x11d4e6,function(_0x439962){if(_0x439962[_0xa3f5('0x47')]!==_0xa3f5('0x57')){var _0x13df24={};_0x13df24[_0x439962[_0xa3f5('0x29')]]={'$like':'%'+_0x141122['query']['filter']+'%'};return _0x13df24;}})});}_0xa00ef3=_['merge']({},_0xa00ef3,_0x141122[_0xa3f5('0x58')]);var _0x3d3a3f={'where':_0xa00ef3['where']};return db[_0xa3f5('0x46')][_0xa3f5('0x22')](_0x3d3a3f)[_0xa3f5('0x11')](function(_0x33edfc){_0x8e939c[_0xa3f5('0x22')]=_0x33edfc;if(_0x141122[_0xa3f5('0x4a')]['includeAll']){_0xa00ef3['include']=[{'all':!![]}];}return db[_0xa3f5('0x46')][_0xa3f5('0x59')](_0xa00ef3);})[_0xa3f5('0x11')](function(_0x9a2775){_0x8e939c[_0xa3f5('0x5a')]=_0x9a2775;return _0x8e939c;})[_0xa3f5('0x11')](respondWithFilteredResult(_0x454e95,_0xa00ef3))[_0xa3f5('0x1b')](handleError(_0x454e95,null));};exports['show']=function(_0x3c216,_0x3e2730){var _0x5c4426={'raw':![],'where':{'id':_0x3c216[_0xa3f5('0x5b')]['id']},'include':[{'model':db[_0xa3f5('0x5c')],'as':_0xa3f5('0x40')},{'model':db[_0xa3f5('0x42')],'as':_0xa3f5('0x41')},{'model':db[_0xa3f5('0x43')],'as':'mandatoryDispositionPause'}]},_0x1a4c8e={};_0x1a4c8e['model']=_[_0xa3f5('0x4b')](db[_0xa3f5('0x46')][_0xa3f5('0x5d')]);_0x1a4c8e[_0xa3f5('0x4a')]=_[_0xa3f5('0x4b')](_0x3c216[_0xa3f5('0x4a')]);_0x1a4c8e[_0xa3f5('0x4c')]=_[_0xa3f5('0x5e')](_0x1a4c8e[_0xa3f5('0x49')],_0x1a4c8e[_0xa3f5('0x4a')]);_0x5c4426[_0xa3f5('0x4d')]=_[_0xa3f5('0x5e')](_0x1a4c8e['model'],qs[_0xa3f5('0x4e')](_0x3c216[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0x5c4426[_0xa3f5('0x4d')]=_0x5c4426['attributes'][_0xa3f5('0x5f')]?_0x5c4426[_0xa3f5('0x4d')]:_0x1a4c8e[_0xa3f5('0x49')];if(_0x3c216['query']['includeAll']){_0x5c4426[_0xa3f5('0x60')]=[{'all':!![]}];}_0x5c4426=_[_0xa3f5('0x56')]({},_0x5c4426,_0x3c216[_0xa3f5('0x58')]);return db['MailAccount'][_0xa3f5('0x61')](_0x5c4426)[_0xa3f5('0x11')](handleEntityNotFound(_0x3e2730,null))[_0xa3f5('0x11')](respondWithResult(_0x3e2730,null))[_0xa3f5('0x1b')](handleError(_0x3e2730,null));};exports[_0xa3f5('0x26')]=function(_0x1348a7,_0x21bb44){if(_0x1348a7[_0xa3f5('0x62')]['id']){delete _0x1348a7[_0xa3f5('0x62')]['id'];}var _0x3d2056=_0x1348a7['body'][_0xa3f5('0x63')]===_0xa3f5('0x64')?null:_0x1348a7['body']['provider'];var _0x4f8a1a=_0x1348a7[_0xa3f5('0x62')][_0xa3f5('0x40')]||{};var _0x20f964=_0x1348a7['body'][_0xa3f5('0x41')]||{};if(_0x3d2056){_0x4f8a1a[_0xa3f5('0x3b')]=getImapHost(_0x3d2056);_0x4f8a1a[_0xa3f5('0x3c')]=0x3e1;_0x20f964[_0xa3f5('0x3b')]=getSmtpHost(_0x3d2056);_0x20f964[_0xa3f5('0x3c')]=0x24b;_0x20f964['secure']=![];}if(_0x20f964['modernAuthentication']){_0x20f964['secure']=![];}else{_0x20f964['CloudProviderId']=null;}if(!_0x4f8a1a[_0xa3f5('0x65')])_0x4f8a1a[_0xa3f5('0x39')]=null;_0x1348a7['body'][_0xa3f5('0x40')]=_0x4f8a1a;_0x1348a7[_0xa3f5('0x62')][_0xa3f5('0x41')]=_0x20f964;return db['MailAccount'][_0xa3f5('0x61')]({'where':{'id':_0x1348a7[_0xa3f5('0x5b')]['id']},'include':[{'model':db[_0xa3f5('0x5c')],'as':'Imap'},{'model':db[_0xa3f5('0x42')],'as':_0xa3f5('0x41')},{'model':db[_0xa3f5('0x43')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x21bb44,null))['then'](function(_0x438289){if(!_0x438289)throw new Error('Mail\x20Account\x20not\x20found');if(_0x438289['service'])delete _0x1348a7['body']['Imap'];return _0x438289;})[_0xa3f5('0x11')](saveUpdates(_0x1348a7[_0xa3f5('0x62')],null))[_0xa3f5('0x11')](function(_0x22fd4f){if(!_0x1348a7['body']['Imap'])return _0x22fd4f;return db[_0xa3f5('0x5c')][_0xa3f5('0x26')](_0x1348a7[_0xa3f5('0x62')][_0xa3f5('0x40')],{'where':{'MailAccountId':_0x22fd4f['id']}})['then'](function(){return _0x22fd4f;});})[_0xa3f5('0x11')](function(_0x297f39){if(!_0x1348a7[_0xa3f5('0x62')][_0xa3f5('0x41')])return _0x297f39;return db[_0xa3f5('0x42')][_0xa3f5('0x26')](_0x1348a7['body']['Smtp'],{'where':{'MailAccountId':_0x297f39['id']}})[_0xa3f5('0x11')](function(){return _0x297f39;});})['then'](respondWithResult(_0x21bb44,null))[_0xa3f5('0x1b')](handleError(_0x21bb44,null));};exports[_0xa3f5('0x66')]=function(_0x4c6571,_0x1b076e){return db[_0xa3f5('0x46')][_0xa3f5('0x66')]()[_0xa3f5('0x11')](respondWithResult(_0x1b076e,null))['catch'](handleError(_0x1b076e,null));};exports[_0xa3f5('0x67')]=function(_0x1d9bd4,_0x209a1b){if(_0x1d9bd4['body']['id']){delete _0x1d9bd4[_0xa3f5('0x62')]['id'];}return db['MailAccount'][_0xa3f5('0x61')]({'where':{'id':_0x1d9bd4['params']['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x209a1b,null))[_0xa3f5('0x11')](function(_0x5499a7){if(_0x5499a7){_0x1d9bd4[_0xa3f5('0x62')][_0xa3f5('0x68')]=_0x5499a7['id'];return db[_0xa3f5('0x69')][_0xa3f5('0x6a')](_0x1d9bd4[_0xa3f5('0x62')]);}})[_0xa3f5('0x11')](respondWithResult(_0x209a1b,null))[_0xa3f5('0x1b')](handleError(_0x209a1b,null));};exports[_0xa3f5('0x6b')]=function(_0x27be25,_0x58452a){var _0x5e7c11={'raw':![],'where':{}};var _0x4dd62a={};var _0x598509={'count':0x0,'rows':[]};return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x27be25[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x58452a,null))[_0xa3f5('0x11')](function(_0x45c647){if(_0x45c647){_0x4dd62a['model']=_[_0xa3f5('0x4b')](db[_0xa3f5('0x69')][_0xa3f5('0x5d')]);_0x4dd62a[_0xa3f5('0x4a')]=_[_0xa3f5('0x4b')](_0x27be25['query']);_0x4dd62a[_0xa3f5('0x4c')]=_[_0xa3f5('0x5e')](_0x4dd62a[_0xa3f5('0x49')],_0x4dd62a[_0xa3f5('0x4a')]);_0x5e7c11['attributes']=_[_0xa3f5('0x5e')](_0x4dd62a[_0xa3f5('0x49')],qs['fields'](_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0x5e7c11[_0xa3f5('0x4d')]=_0x5e7c11[_0xa3f5('0x4d')][_0xa3f5('0x5f')]?_0x5e7c11[_0xa3f5('0x4d')]:_0x4dd62a['model'];if(!_0x27be25['query']['hasOwnProperty'](_0xa3f5('0x50'))){_0x5e7c11['limit']=qs[_0xa3f5('0x21')](_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x21')]);_0x5e7c11[_0xa3f5('0x1f')]=qs['offset'](_0x27be25['query'][_0xa3f5('0x1f')]);}_0x5e7c11[_0xa3f5('0x51')]=qs[_0xa3f5('0x52')](_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0x5e7c11[_0xa3f5('0x53')]=qs[_0xa3f5('0x4c')](_[_0xa3f5('0x54')](_0x27be25[_0xa3f5('0x4a')],_0x4dd62a[_0xa3f5('0x4c')]));_0x5e7c11[_0xa3f5('0x53')][_0xa3f5('0x68')]=_0x45c647['id'];if(_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x55')]){_0x5e7c11[_0xa3f5('0x53')]=_['merge'](_0x5e7c11['where'],{'$or':_[_0xa3f5('0x45')](_0x5e7c11['attributes'],function(_0x528c15){var _0x184017={};_0x184017[_0x528c15]={'$like':'%'+_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x55')]+'%'};return _0x184017;})});}_0x5e7c11=_[_0xa3f5('0x56')]({},_0x5e7c11,_0x27be25[_0xa3f5('0x58')]);return db[_0xa3f5('0x69')][_0xa3f5('0x22')]({'where':_0x5e7c11[_0xa3f5('0x53')]})[_0xa3f5('0x11')](function(_0x391783){_0x598509[_0xa3f5('0x22')]=_0x391783;if(_0x27be25[_0xa3f5('0x4a')][_0xa3f5('0x6d')]){_0x5e7c11[_0xa3f5('0x60')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5e7c11);})[_0xa3f5('0x11')](function(_0x27314e){_0x598509[_0xa3f5('0x5a')]=_0x27314e;return _0x598509;});}})['then'](respondWithFilteredResult(_0x58452a,_0x5e7c11))['catch'](handleError(_0x58452a,null));};exports[_0xa3f5('0x6e')]=function(_0x5a599a,_0x34d6f5){return db[_0xa3f5('0x46')]['find']({'where':{'id':_0x5a599a['params']['id']}})['then'](handleEntityNotFound(_0x34d6f5,null))['then'](function(_0x186a23){if(_0x186a23){return _0x186a23[_0xa3f5('0x6e')](_0x5a599a[_0xa3f5('0x4a')][_0xa3f5('0x6f')]);}})[_0xa3f5('0x11')](respondWithStatusCode(_0x34d6f5,null))[_0xa3f5('0x1b')](handleError(_0x34d6f5,null));};exports[_0xa3f5('0x70')]=function(_0x5127c4,_0x252b3b){if(_0x5127c4[_0xa3f5('0x62')]['id']){delete _0x5127c4[_0xa3f5('0x62')]['id'];}return db['MailAccount'][_0xa3f5('0x61')]({'where':{'id':_0x5127c4[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x252b3b,null))[_0xa3f5('0x11')](function(_0x2981f9){if(_0x2981f9){_0x5127c4[_0xa3f5('0x62')]['MailAccountId']=_0x2981f9['id'];return db[_0xa3f5('0x71')]['create'](_0x5127c4[_0xa3f5('0x62')]);}})[_0xa3f5('0x11')](respondWithResult(_0x252b3b,null))[_0xa3f5('0x1b')](handleError(_0x252b3b,null));};exports[_0xa3f5('0x72')]=function(_0x538a86,_0x25b7a5){var _0xd4c0b4={'raw':![],'where':{}};var _0x48cb4c={};var _0x39cd09={'count':0x0,'rows':[]};return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x538a86['params']['id']}})['then'](handleEntityNotFound(_0x25b7a5,null))[_0xa3f5('0x11')](function(_0x949d9d){if(_0x949d9d){_0x48cb4c[_0xa3f5('0x49')]=_['keys'](db[_0xa3f5('0x71')]['rawAttributes']);_0x48cb4c[_0xa3f5('0x4a')]=_['keys'](_0x538a86[_0xa3f5('0x4a')]);_0x48cb4c[_0xa3f5('0x4c')]=_[_0xa3f5('0x5e')](_0x48cb4c[_0xa3f5('0x49')],_0x48cb4c[_0xa3f5('0x4a')]);_0xd4c0b4[_0xa3f5('0x4d')]=_[_0xa3f5('0x5e')](_0x48cb4c[_0xa3f5('0x49')],qs[_0xa3f5('0x4e')](_0x538a86[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0xd4c0b4[_0xa3f5('0x4d')]=_0xd4c0b4[_0xa3f5('0x4d')][_0xa3f5('0x5f')]?_0xd4c0b4[_0xa3f5('0x4d')]:_0x48cb4c['model'];if(!_0x538a86['query'][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0xd4c0b4[_0xa3f5('0x21')]=qs[_0xa3f5('0x21')](_0x538a86[_0xa3f5('0x4a')][_0xa3f5('0x21')]);_0xd4c0b4['offset']=qs[_0xa3f5('0x1f')](_0x538a86['query'][_0xa3f5('0x1f')]);}_0xd4c0b4[_0xa3f5('0x51')]=qs[_0xa3f5('0x52')](_0x538a86[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0xd4c0b4[_0xa3f5('0x53')]=qs['filters'](_[_0xa3f5('0x54')](_0x538a86[_0xa3f5('0x4a')],_0x48cb4c['filters']));_0xd4c0b4[_0xa3f5('0x53')][_0xa3f5('0x68')]=_0x949d9d['id'];if(_0x538a86['query'][_0xa3f5('0x55')]){_0xd4c0b4[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0xd4c0b4[_0xa3f5('0x53')],{'$or':_['map'](_0xd4c0b4[_0xa3f5('0x4d')],function(_0x5af656){var _0x6f5de8={};_0x6f5de8[_0x5af656]={'$like':'%'+_0x538a86['query']['filter']+'%'};return _0x6f5de8;})});}_0xd4c0b4=_[_0xa3f5('0x56')]({},_0xd4c0b4,_0x538a86[_0xa3f5('0x58')]);return db[_0xa3f5('0x71')][_0xa3f5('0x22')]({'where':_0xd4c0b4[_0xa3f5('0x53')]})['then'](function(_0x31a1f9){_0x39cd09[_0xa3f5('0x22')]=_0x31a1f9;if(_0x538a86[_0xa3f5('0x4a')][_0xa3f5('0x6d')]){_0xd4c0b4[_0xa3f5('0x60')]=[{'all':!![]}];}return db[_0xa3f5('0x71')][_0xa3f5('0x59')](_0xd4c0b4);})[_0xa3f5('0x11')](function(_0x47a41d){_0x39cd09[_0xa3f5('0x5a')]=_0x47a41d;return _0x39cd09;});}})[_0xa3f5('0x11')](respondWithFilteredResult(_0x25b7a5,_0xd4c0b4))['catch'](handleError(_0x25b7a5,null));};exports[_0xa3f5('0x73')]=function(_0x1c96e1,_0x132901){return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x1c96e1[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x132901,null))[_0xa3f5('0x11')](function(_0x50ec3c){if(_0x50ec3c){return _0x50ec3c['removeAnswers'](_0x1c96e1['query'][_0xa3f5('0x6f')]);}})[_0xa3f5('0x11')](respondWithStatusCode(_0x132901,null))[_0xa3f5('0x1b')](handleError(_0x132901,null));};exports[_0xa3f5('0x6a')]=function(_0x451eda,_0x27b449){var _0x35ee51={'name':_0x451eda[_0xa3f5('0x62')]['name'],'key':_0x451eda[_0xa3f5('0x62')]['key'],'provider':_0x451eda['body'][_0xa3f5('0x63')]===_0xa3f5('0x64')?null:_0x451eda[_0xa3f5('0x62')]['provider'],'email':_0x451eda['body'][_0xa3f5('0x74')],'ListId':_0x451eda[_0xa3f5('0x62')][_0xa3f5('0x75')],'active':!_[_0xa3f5('0x76')](_0x451eda[_0xa3f5('0x62')][_0xa3f5('0x77')])?_0x451eda[_0xa3f5('0x62')][_0xa3f5('0x77')]:!![],'description':_0x451eda[_0xa3f5('0x62')][_0xa3f5('0x78')]||null};var _0x5dd9f0=getAuthenticationOptions(_0x35ee51[_0xa3f5('0x63')],_0x451eda[_0xa3f5('0x62')]);_0x35ee51[_0xa3f5('0x40')]=_0x5dd9f0[_0xa3f5('0x40')];_0x35ee51[_0xa3f5('0x41')]=_0x5dd9f0[_0xa3f5('0x41')];return db['MailAccount']['create'](_0x35ee51,{'include':[{'model':db[_0xa3f5('0x42')],'as':_0xa3f5('0x41')},{'model':db[_0xa3f5('0x5c')],'as':_0xa3f5('0x40')}]})[_0xa3f5('0x11')](function(_0x19545f){var _0x1f1931=_0x451eda[_0xa3f5('0x36')][_0xa3f5('0x27')]({'plain':!![]});if(!_0x1f1931)throw new Error(_0xa3f5('0x79'));if(_0x1f1931[_0xa3f5('0x7a')]===_0xa3f5('0x36')){var _0x426099=_0x19545f[_0xa3f5('0x27')]({'plain':!![]});return db[_0xa3f5('0x7b')][_0xa3f5('0x61')]({'where':{'name':_0xa3f5('0x7c'),'userProfileId':_0x1f1931[_0xa3f5('0x7d')]},'raw':!![]})[_0xa3f5('0x11')](function(_0x1eab66){if(_0x1eab66&&_0x1eab66[_0xa3f5('0x7e')]===0x0){return db[_0xa3f5('0x7f')][_0xa3f5('0x6a')]({'name':_0x426099[_0xa3f5('0x29')],'resourceId':_0x426099['id'],'type':_0x1eab66[_0xa3f5('0x29')],'sectionId':_0x1eab66['id']},{})[_0xa3f5('0x11')](function(){return _0x19545f;});}else{return _0x19545f;}})[_0xa3f5('0x1b')](function(_0x13eab6){logger[_0xa3f5('0x15')](_0xa3f5('0x80'),_0x13eab6);throw _0x13eab6;});}return _0x19545f;})[_0xa3f5('0x11')](respondWithResult(_0x27b449,0xc9))[_0xa3f5('0x1b')](handleError(_0x27b449,null));};exports['getImap']=function(_0x528484,_0x29fbeb){return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x528484[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x29fbeb,null))['then'](function(_0x363d61){if(_0x363d61){return _0x363d61[_0xa3f5('0x81')]();}return null;})[_0xa3f5('0x11')](respondWithResult(_0x29fbeb,null))[_0xa3f5('0x1b')](handleError(_0x29fbeb,null));};exports[_0xa3f5('0x82')]=function(_0x60a57b,_0x150b5a){if(_0x60a57b[_0xa3f5('0x62')]['id']){delete _0x60a57b[_0xa3f5('0x62')]['id'];}return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x60a57b[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x150b5a,null))[_0xa3f5('0x11')](function(_0x30f826){if(_0x30f826){_0x60a57b['body'][_0xa3f5('0x68')]=_0x30f826['id'];return db[_0xa3f5('0x5c')]['create'](_0x60a57b[_0xa3f5('0x62')]);}})[_0xa3f5('0x11')](respondWithResult(_0x150b5a,null))[_0xa3f5('0x1b')](handleError(_0x150b5a,null));};exports[_0xa3f5('0x83')]=function(_0x54857b,_0x1862bd){return db['MailAccount']['findOne']({'where':{'id':_0x54857b[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x1862bd,null))['then'](function(_0x19eba7){if(_0x19eba7){return _0x19eba7[_0xa3f5('0x84')](null);}return null;})[_0xa3f5('0x11')](respondWithStatusCode(_0x1862bd,null))[_0xa3f5('0x1b')](handleError(_0x1862bd,null));};exports[_0xa3f5('0x85')]=function(_0x3d1853,_0x36bc44){return db['MailAccount'][_0xa3f5('0x6c')]({'where':{'id':_0x3d1853[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x36bc44,null))[_0xa3f5('0x11')](function(_0x301100){if(_0x301100){return _0x301100['getSmtp']();}return null;})[_0xa3f5('0x11')](respondWithResult(_0x36bc44,null))[_0xa3f5('0x1b')](handleError(_0x36bc44,null));};exports[_0xa3f5('0x86')]=function(_0x5096ab,_0x543941){if(_0x5096ab['body']['id']){delete _0x5096ab[_0xa3f5('0x62')]['id'];}return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x5096ab[_0xa3f5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x543941,null))[_0xa3f5('0x11')](function(_0x57636d){if(_0x57636d){_0x5096ab['body'][_0xa3f5('0x68')]=_0x57636d['id'];return db[_0xa3f5('0x42')]['create'](_0x5096ab['body']);}})[_0xa3f5('0x11')](respondWithResult(_0x543941,null))[_0xa3f5('0x1b')](handleError(_0x543941,null));};exports[_0xa3f5('0x87')]=function(_0x4ae2c7,_0xd53d4b){return db[_0xa3f5('0x46')]['findOne']({'where':{'id':_0x4ae2c7[_0xa3f5('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd53d4b,null))[_0xa3f5('0x11')](function(_0x4b599c){if(_0x4b599c){return _0x4b599c[_0xa3f5('0x88')](null);}return null;})[_0xa3f5('0x11')](respondWithStatusCode(_0xd53d4b,null))[_0xa3f5('0x1b')](handleError(_0xd53d4b,null));};exports[_0xa3f5('0x89')]=function(_0x389ea2,_0x1c780a){return db['MailInteraction'][_0xa3f5('0x61')]({'where':{'id':_0x389ea2[_0xa3f5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c780a,null))[_0xa3f5('0x11')](function(_0xd090a3){if(_0xd090a3){return _0xd090a3[_0xa3f5('0x89')](_0x389ea2[_0xa3f5('0x62')][_0xa3f5('0x6f')],_['omit'](_0x389ea2[_0xa3f5('0x62')],[_0xa3f5('0x6f'),'id'])||{});}})[_0xa3f5('0x11')](respondWithResult(_0x1c780a,null))[_0xa3f5('0x1b')](handleError(_0x1c780a,null));};exports[_0xa3f5('0x8a')]=function(_0x4b8f7b,_0x20512e){var _0x169918={'raw':![],'where':{}};var _0x4a6b82={};var _0x41b8f7={'count':0x0,'rows':[]};return db['MailAccount'][_0xa3f5('0x6c')]({'where':{'id':_0x4b8f7b[_0xa3f5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20512e,null))['then'](function(_0x499ef9){if(_0x499ef9){_0x4a6b82[_0xa3f5('0x49')]=_[_0xa3f5('0x4b')](db[_0xa3f5('0x8b')][_0xa3f5('0x5d')]);_0x4a6b82['query']=_['keys'](_0x4b8f7b[_0xa3f5('0x4a')]);_0x4a6b82['filters']=_[_0xa3f5('0x5e')](_0x4a6b82[_0xa3f5('0x49')],_0x4a6b82['query']);_0x169918[_0xa3f5('0x4d')]=_[_0xa3f5('0x5e')](_0x4a6b82[_0xa3f5('0x49')],qs[_0xa3f5('0x4e')](_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0x169918[_0xa3f5('0x4d')]=_0x169918[_0xa3f5('0x4d')][_0xa3f5('0x5f')]?_0x169918[_0xa3f5('0x4d')]:_0x4a6b82[_0xa3f5('0x49')];if(!_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0x169918[_0xa3f5('0x21')]=qs['limit'](_0x4b8f7b[_0xa3f5('0x4a')]['limit']);_0x169918['offset']=qs['offset'](_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x1f')]);}_0x169918['order']=qs[_0xa3f5('0x52')](_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0x169918['where']=qs[_0xa3f5('0x4c')](_['pick'](_0x4b8f7b[_0xa3f5('0x4a')],_0x4a6b82['filters']));_0x169918[_0xa3f5('0x53')][_0xa3f5('0x68')]=_0x499ef9['id'];if(_0x4b8f7b['query'][_0xa3f5('0x55')]){_0x169918[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0x169918[_0xa3f5('0x53')],{'$or':_[_0xa3f5('0x45')](_0x169918[_0xa3f5('0x4d')],function(_0x1efcba){var _0xfdb997={};_0xfdb997[_0x1efcba]={'$like':'%'+_0x4b8f7b['query'][_0xa3f5('0x55')]+'%'};return _0xfdb997;})});}_0x169918=_['merge']({},_0x169918,_0x4b8f7b['options']);return db['MailInteraction'][_0xa3f5('0x22')]({'where':_0x169918[_0xa3f5('0x53')]})[_0xa3f5('0x11')](function(_0x123a96){_0x41b8f7[_0xa3f5('0x22')]=_0x123a96;if(_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x6d')]){_0x169918[_0xa3f5('0x60')]=[{'model':db['CmContact'],'as':_0xa3f5('0x8c'),'required':![]},{'model':db[_0xa3f5('0x8d')],'as':_0xa3f5('0x8e'),'attributes':[_0xa3f5('0x29'),_0xa3f5('0x8f'),_0xa3f5('0x90')],'required':![]},{'model':db[_0xa3f5('0x91')],'as':_0xa3f5('0x92'),'attributes':['id',_0xa3f5('0x29'),_0xa3f5('0x93')],'where':_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x94')]?{'id':_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x94')]}:undefined,'required':_0x4b8f7b[_0xa3f5('0x4a')][_0xa3f5('0x94')]?!![]:![]}];}return db['MailInteraction'][_0xa3f5('0x59')](_0x169918);})[_0xa3f5('0x11')](function(_0x13816e){_0x41b8f7[_0xa3f5('0x5a')]=_0x13816e;return _0x41b8f7;});}})[_0xa3f5('0x11')](respondWithFilteredResult(_0x20512e,_0x169918))['catch'](handleError(_0x20512e,null));};exports[_0xa3f5('0x95')]=function addApplications(_0x249f1b,_0x36d20b){var _0x305c50=_0x249f1b[_0xa3f5('0x5b')]['id'];var _0x3b1a1e=_0x249f1b['body'];var _0x25e9d3=0xc8;var _0x3a8563=null;return db[_0xa3f5('0x96')][_0xa3f5('0x97')]({'isolationLevel':db[_0xa3f5('0x96')]['Transaction']['ISOLATION_LEVELS'][_0xa3f5('0x98')]},function(_0x4d9446){return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x305c50},'transaction':_0x4d9446})[_0xa3f5('0x11')](function(_0x29cd97){if(_0x29cd97){return db['MailApplication'][_0xa3f5('0x28')]({'where':{'MailAccountId':_0x305c50},'transaction':_0x4d9446})[_0xa3f5('0x11')](function(){var _0x3f0243=_['map'](_0x3b1a1e,function(_0x337732){_0x337732[_0xa3f5('0x68')]=_0x305c50;return _0x337732;});return db[_0xa3f5('0x99')]['bulkCreate'](_0x3f0243,{'transaction':_0x4d9446});});}else{_0x25e9d3=0x194;_0x3a8563=[];}});})[_0xa3f5('0x11')](function(){if(_0x25e9d3!==0x194){return db['MailApplication'][_0xa3f5('0x9a')]({'where':{'MailAccountId':_0x305c50},'order':_0xa3f5('0x9b')})[_0xa3f5('0x11')](function(_0x3522f1){_0x3a8563=_0x3522f1;});}})[_0xa3f5('0x1b')](function(_0x1b8461){_0x25e9d3=0x1f4;logger[_0xa3f5('0x15')](_0x1b8461[_0xa3f5('0x9c')]);if(_0x1b8461[_0xa3f5('0x29')]){delete _0x1b8461[_0xa3f5('0x29')];}_0x3a8563=_0x1b8461;})[_0xa3f5('0x9d')](function(){if(_0x3a8563===null){_0x36d20b[_0xa3f5('0x1c')](_0x25e9d3);}else{if(_0x25e9d3===0x1f4){_0x36d20b[_0xa3f5('0x1d')](_0x25e9d3)['send'](_0x3a8563);}else{_0x36d20b['status'](_0x25e9d3)[_0xa3f5('0x25')](_0x3a8563);}}});};exports['getApplications']=function(_0x4f5105,_0x2f8451){var _0x53627a={};var _0x353535={};var _0x21fbb7;var _0x59df17;return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x4f5105[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x2f8451,null))[_0xa3f5('0x11')](function(_0x150c5c){if(_0x150c5c){_0x21fbb7=_0x150c5c;_0x353535[_0xa3f5('0x49')]=_['keys'](db[_0xa3f5('0x99')]['rawAttributes']);_0x353535[_0xa3f5('0x4a')]=_[_0xa3f5('0x4b')](_0x4f5105[_0xa3f5('0x4a')]);_0x353535[_0xa3f5('0x4c')]=_[_0xa3f5('0x5e')](_0x353535[_0xa3f5('0x49')],_0x353535[_0xa3f5('0x4a')]);_0x53627a[_0xa3f5('0x4d')]=_[_0xa3f5('0x5e')](_0x353535[_0xa3f5('0x49')],qs['fields'](_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0x53627a[_0xa3f5('0x4d')]=_0x53627a['attributes'][_0xa3f5('0x5f')]?_0x53627a[_0xa3f5('0x4d')]:_0x353535[_0xa3f5('0x49')];_0x53627a[_0xa3f5('0x51')]=qs[_0xa3f5('0x52')](_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0x53627a[_0xa3f5('0x53')]=qs['filters'](_[_0xa3f5('0x54')](_0x4f5105[_0xa3f5('0x4a')],_0x353535[_0xa3f5('0x4c')]));if(_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x55')]){_0x53627a[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0x53627a[_0xa3f5('0x53')],{'$or':_[_0xa3f5('0x45')](_0x53627a[_0xa3f5('0x4d')],function(_0x16ad3f){var _0x56310b={};_0x56310b[_0x16ad3f]={'$like':'%'+_0x4f5105['query'][_0xa3f5('0x55')]+'%'};return _0x56310b;})});}_0x53627a=_[_0xa3f5('0x56')]({},_0x53627a,_0x4f5105[_0xa3f5('0x58')]);return _0x21fbb7[_0xa3f5('0x9e')](_0x53627a);}})[_0xa3f5('0x11')](function(_0x15aeed){if(_0x15aeed){_0x59df17=_0x15aeed['length'];if(!_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0x53627a[_0xa3f5('0x21')]=qs[_0xa3f5('0x21')](_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x21')]);_0x53627a[_0xa3f5('0x1f')]=qs[_0xa3f5('0x1f')](_0x4f5105[_0xa3f5('0x4a')][_0xa3f5('0x1f')]);}return _0x21fbb7[_0xa3f5('0x9e')](_0x53627a);}})['then'](function(_0x3b17cb){if(_0x3b17cb){return _0x3b17cb?{'count':_0x59df17,'rows':_0x3b17cb}:null;}})[_0xa3f5('0x11')](respondWithResult(_0x2f8451,null))[_0xa3f5('0x1b')](handleError(_0x2f8451,null));};exports['getMessages']=function(_0xd74da2,_0x2c3bde){var _0x4783c7={'raw':!![],'where':{}};var _0x4b34c0={};var _0x48ae50={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xd74da2['params']['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x2c3bde,null))[_0xa3f5('0x11')](function(_0x3a90bb){if(_0x3a90bb){_0x4b34c0['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x4b34c0[_0xa3f5('0x4a')]=_[_0xa3f5('0x4b')](_0xd74da2[_0xa3f5('0x4a')]);_0x4b34c0[_0xa3f5('0x4c')]=_['intersection'](_0x4b34c0[_0xa3f5('0x49')],_0x4b34c0[_0xa3f5('0x4a')]);_0x4783c7[_0xa3f5('0x4d')]=_[_0xa3f5('0x5e')](_0x4b34c0[_0xa3f5('0x49')],qs[_0xa3f5('0x4e')](_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x4e')]));_0x4783c7[_0xa3f5('0x4d')]=_0x4783c7[_0xa3f5('0x4d')][_0xa3f5('0x5f')]?_0x4783c7[_0xa3f5('0x4d')]:_0x4b34c0[_0xa3f5('0x49')];if(!_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0x4783c7[_0xa3f5('0x21')]=qs[_0xa3f5('0x21')](_0xd74da2['query'][_0xa3f5('0x21')]);_0x4783c7[_0xa3f5('0x1f')]=qs[_0xa3f5('0x1f')](_0xd74da2[_0xa3f5('0x4a')]['offset']);}_0x4783c7[_0xa3f5('0x51')]=qs[_0xa3f5('0x52')](_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0x4783c7['where']=qs[_0xa3f5('0x4c')](_[_0xa3f5('0x54')](_0xd74da2['query'],_0x4b34c0[_0xa3f5('0x4c')]));_0x4783c7[_0xa3f5('0x53')][_0xa3f5('0x68')]=_0x3a90bb['id'];if(_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x55')]){_0x4783c7[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0x4783c7[_0xa3f5('0x53')],{'$or':_['map'](_0x4783c7[_0xa3f5('0x4d')],function(_0x5b652c){var _0xca5e82={};_0xca5e82[_0x5b652c]={'$like':'%'+_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x55')]+'%'};return _0xca5e82;})});}if(_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x9f')]){var _0xdb8de5=_0xd74da2['query'][_0xa3f5('0x9f')][_0xa3f5('0xa0')](',');var _0x7c8dad={};_0x7c8dad[_0xdb8de5[0x0]]={'$gte':moment(_0xdb8de5[0x1])[_0xa3f5('0xa1')](_0xa3f5('0xa2'))};_0x4783c7[_0xa3f5('0x53')]=_[_0xa3f5('0x56')](_0x4783c7[_0xa3f5('0x53')],_0x7c8dad);}_0x4783c7=_[_0xa3f5('0x56')]({},_0x4783c7,_0xd74da2[_0xa3f5('0x58')]);return db[_0xa3f5('0xa3')]['count']({'where':_0x4783c7['where']})[_0xa3f5('0x11')](function(_0x3c8916){_0x48ae50[_0xa3f5('0x22')]=_0x3c8916;if(_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0x6d')]){_0x4783c7[_0xa3f5('0x60')]=[{'all':!![]}];}return db[_0xa3f5('0xa3')][_0xa3f5('0x59')](_0x4783c7);})['then'](function(_0x2b91e1){if(_0xd74da2[_0xa3f5('0x4a')][_0xa3f5('0xa4')]==='true'){for(var _0x5e0aaf=0x0;_0x5e0aaf<_0x2b91e1[_0xa3f5('0x5f')];_0x5e0aaf++){_0x2b91e1[_0x5e0aaf][_0xa3f5('0x62')]=juice(_0x2b91e1[_0x5e0aaf]['body']);}}_0x48ae50['rows']=_0x2b91e1;return _0x48ae50;});}})[_0xa3f5('0x11')](respondWithFilteredResult(_0x2c3bde,_0x4783c7))[_0xa3f5('0x1b')](handleError(_0x2c3bde,null));};exports[_0xa3f5('0x2a')]=function(_0x493b7f,_0xcbd8b9){var _0x27a30b,_0x501014={},_0xf33fd5;if(_0x493b7f[_0xa3f5('0x62')]['to']){_0xf33fd5=_0x493b7f[_0xa3f5('0x62')]['to'][_0xa3f5('0xa0')](',')[0x0];}return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x493b7f[_0xa3f5('0x5b')]['id']},'include':[{'model':db[_0xa3f5('0xa5')],'as':_0xa3f5('0xa6'),'include':[{'model':db[_0xa3f5('0xa7')],'as':_0xa3f5('0xa8'),'where':{'email':_0xf33fd5},'limit':0x1,'order':[[_0xa3f5('0xa9'),_0xa3f5('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0xa3f5('0x41'),'raw':!![],'include':[{'model':db[_0xa3f5('0xab')],'as':_0xa3f5('0xab'),'raw':!![]}]}]})[_0xa3f5('0x11')](handleEntityNotFound(_0xcbd8b9,null))[_0xa3f5('0x11')](function(_0x5c4b05){if(!_0x5c4b05)return;_0x27a30b=_0x5c4b05;if(!_0x5c4b05['Smtp'])throw new Error(_0xa3f5('0xac'));if(_['isNil'](_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xad')])){_0x493b7f['body'][_0xa3f5('0xad')]=util['format']('%s\x20<%s>',_0x5c4b05[_0xa3f5('0x29')],_0x5c4b05[_0xa3f5('0x74')]||_0x5c4b05[_0xa3f5('0x41')][_0xa3f5('0x36')]);}if(_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xae')]&&_0x493b7f['body'][_0xa3f5('0xae')][_0xa3f5('0x5f')]){for(var _0x5b09a5=0x0;_0x5b09a5<_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xae')][_0xa3f5('0x5f')];_0x5b09a5+=0x1){_0x493b7f[_0xa3f5('0x62')]['attachments'][_0x5b09a5]={'filename':_0x493b7f[_0xa3f5('0x62')]['attachments'][_0x5b09a5][_0xa3f5('0x29')],'path':path[_0xa3f5('0xaf')](config[_0xa3f5('0xb0')],_0xa3f5('0xb1'),_0x493b7f[_0xa3f5('0x62')]['attachments'][_0x5b09a5][_0xa3f5('0xb2')])};}}var _0x47eef2=_0x5c4b05['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x47eef2,'message':_0x493b7f[_0xa3f5('0x62')]});})[_0xa3f5('0x11')](function(_0x45b7df){if(!_0x45b7df)return;_0x501014=_0x45b7df;if(!_0x27a30b[_0xa3f5('0xa6')])throw new Error('List\x20not\x20found');if(_0x27a30b[_0xa3f5('0xa6')]['Contacts']['length'])return _0x27a30b[_0xa3f5('0xa6')][_0xa3f5('0xa8')][0x0];return db[_0xa3f5('0xa7')][_0xa3f5('0x6a')](_[_0xa3f5('0xa')](_0x493b7f[_0xa3f5('0x62')],{'firstName':_0x493b7f[_0xa3f5('0x62')]['to'],'email':_0x493b7f[_0xa3f5('0x62')]['to'],'phone':_0x493b7f[_0xa3f5('0x62')]['to'],'ListId':_0x27a30b[_0xa3f5('0x75')]}));})['then'](function(_0x3e16ba){if(!_0x3e16ba)return;var _0x53b863={'UserId':_0x493b7f[_0xa3f5('0x36')]['id'],'ContactId':_0x3e16ba['id'],'MailAccountId':_0x27a30b['id'],'inReplyTo':_0x501014[_0xa3f5('0xb3')],'to':_0x493b7f[_0xa3f5('0x62')]['from'],'cc':_0x493b7f['body']['cc'],'subject':_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xb4')],'attach':_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xa3f5('0xa1')](_0xa3f5('0xa2')),'lastMsgDirection':'out','Messages':[_[_0xa3f5('0x56')](_0x493b7f[_0xa3f5('0x62')],{'messageId':_0x501014['messageId'],'sentAt':moment()[_0xa3f5('0xa1')](_0xa3f5('0xa2')),'read':!![],'MailAccountId':_0x27a30b['id'],'UserId':_0x493b7f[_0xa3f5('0x36')]['id'],'ContactId':_0x3e16ba['id']})]};if(_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xb6')]){_0x53b863=_[_0xa3f5('0x56')](_0x53b863,_0x493b7f[_0xa3f5('0x62')][_0xa3f5('0xb6')]);}return db[_0xa3f5('0x8b')][_0xa3f5('0x6a')](_0x53b863,{'include':[{'model':db[_0xa3f5('0xa3')],'as':_0xa3f5('0xb7')}]});})['then'](respondWithResult(_0xcbd8b9,null))[_0xa3f5('0x1b')](handleError(_0xcbd8b9,null));};exports[_0xa3f5('0xb8')]=function(_0xa5509b,_0x1f9f71){return db[_0xa3f5('0x46')]['find']({'where':{'id':_0xa5509b[_0xa3f5('0x5b')]['id']},'include':[{'model':db[_0xa3f5('0x42')],'as':_0xa3f5('0x41'),'raw':!![],'include':[{'model':db[_0xa3f5('0xab')],'as':_0xa3f5('0xab'),'raw':!![]}]}]})[_0xa3f5('0x11')](handleEntityNotFound(_0x1f9f71,null))[_0xa3f5('0x11')](function(_0x416328){if(!_0x416328[_0xa3f5('0x41')])return;var _0x1864d0=_0x416328[_0xa3f5('0xb9')]();return respondWithRpcPromise(_0xa3f5('0xba'),_0xa3f5('0xb8'),{'account':_0x1864d0});})[_0xa3f5('0x11')](respondWithResult(_0x1f9f71,null))[_0xa3f5('0x1b')](handleError(_0x1f9f71,null));};exports[_0xa3f5('0x28')]=function(_0x253cf9,_0x239920){return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x253cf9['params']['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x239920,null))['then'](function(_0x4fc183){if(_0x4fc183&&_0x4fc183[_0xa3f5('0x3e')]){throw new db[(_0xa3f5('0xbb'))][(_0xa3f5('0xbc'))](_0xa3f5('0xbd'));}return _0x4fc183;})[_0xa3f5('0x11')](removeEntity(_0x239920,null))[_0xa3f5('0x1b')](handleError(_0x239920,null));};exports[_0xa3f5('0xbe')]=function(_0x49530e,_0x641d56){return db[_0xa3f5('0x46')][_0xa3f5('0x61')]({'where':{'id':_0x49530e['params']['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x641d56,null))['then'](function(_0x3ff11b){if(_0x3ff11b){return _0x3ff11b['addAgents'](_0x49530e[_0xa3f5('0x62')][_0xa3f5('0x6f')],_[_0xa3f5('0xbf')](_0x49530e[_0xa3f5('0x62')],[_0xa3f5('0x6f'),'id'])||{})[_0xa3f5('0xc0')](function(_0x148f81){for(var _0x1553e5=0x0;_0x1553e5<_0x49530e[_0xa3f5('0x62')][_0xa3f5('0x6f')][_0xa3f5('0x5f')];_0x1553e5+=0x1){socket[_0xa3f5('0xc1')](_0xa3f5('0xc2'),{'UserId':Number(_0x49530e[_0xa3f5('0x62')][_0xa3f5('0x6f')][_0x1553e5]),'MailAccountId':Number(_0x49530e[_0xa3f5('0x5b')]['id'])});}return _0x148f81;});}})['then'](respondWithResult(_0x641d56,null))[_0xa3f5('0x1b')](handleError(_0x641d56,null));};exports['removeAgents']=function(_0x577ec8,_0x34d878){return db['MailAccount'][_0xa3f5('0x61')]({'where':{'id':_0x577ec8[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0x34d878,null))[_0xa3f5('0x11')](function(_0x47b538){if(_0x47b538){return _0x47b538[_0xa3f5('0xc3')](_0x577ec8[_0xa3f5('0x4a')][_0xa3f5('0x6f')])[_0xa3f5('0x11')](function(){if(_['isArray'](_0x577ec8[_0xa3f5('0x4a')][_0xa3f5('0x6f')])){for(var _0x2b9838=0x0;_0x2b9838<_0x577ec8[_0xa3f5('0x4a')][_0xa3f5('0x6f')][_0xa3f5('0x5f')];_0x2b9838+=0x1){socket[_0xa3f5('0xc1')](_0xa3f5('0xc4'),{'UserId':Number(_0x577ec8[_0xa3f5('0x4a')]['ids'][_0x2b9838]),'MailAccountId':Number(_0x577ec8['params']['id'])});}}else{socket[_0xa3f5('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x577ec8[_0xa3f5('0x4a')]['ids']),'MailAccountId':Number(_0x577ec8[_0xa3f5('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x34d878,null))[_0xa3f5('0x1b')](handleError(_0x34d878,null));};exports[_0xa3f5('0xc5')]=function(_0x4d6a37,_0xc2b24){var _0x509af3={};var _0xf44a36={};var _0x5d8ab6;var _0x2fa221;return db[_0xa3f5('0x46')][_0xa3f5('0x6c')]({'where':{'id':_0x4d6a37[_0xa3f5('0x5b')]['id']}})[_0xa3f5('0x11')](handleEntityNotFound(_0xc2b24,null))[_0xa3f5('0x11')](function(_0x437849){if(_0x437849){_0x5d8ab6=_0x437849;_0xf44a36[_0xa3f5('0x49')]=_[_0xa3f5('0x4b')](db['User'][_0xa3f5('0x5d')]);_0xf44a36['query']=_[_0xa3f5('0x4b')](_0x4d6a37[_0xa3f5('0x4a')]);_0xf44a36['filters']=_[_0xa3f5('0x5e')](_0xf44a36[_0xa3f5('0x49')],_0xf44a36[_0xa3f5('0x4a')]);_0x509af3['attributes']=_[_0xa3f5('0x5e')](_0xf44a36[_0xa3f5('0x49')],qs['fields'](_0x4d6a37[_0xa3f5('0x4a')]['fields']));_0x509af3[_0xa3f5('0x4d')]=_0x509af3[_0xa3f5('0x4d')][_0xa3f5('0x5f')]?_0x509af3[_0xa3f5('0x4d')]:_0xf44a36[_0xa3f5('0x49')];_0x509af3[_0xa3f5('0x51')]=qs['sort'](_0x4d6a37[_0xa3f5('0x4a')][_0xa3f5('0x52')]);_0x509af3[_0xa3f5('0x53')]=qs[_0xa3f5('0x4c')](_['pick'](_0x4d6a37[_0xa3f5('0x4a')],_0xf44a36[_0xa3f5('0x4c')]));if(_0x4d6a37[_0xa3f5('0x4a')][_0xa3f5('0x55')]){_0x509af3['where']=_[_0xa3f5('0x56')](_0x509af3[_0xa3f5('0x53')],{'$or':_[_0xa3f5('0x45')](_0x509af3['attributes'],function(_0x5dae86){var _0xde1e0d={};_0xde1e0d[_0x5dae86]={'$like':'%'+_0x4d6a37['query'][_0xa3f5('0x55')]+'%'};return _0xde1e0d;})});}_0x509af3=_[_0xa3f5('0x56')]({},_0x509af3,_0x4d6a37[_0xa3f5('0x58')]);return _0x5d8ab6[_0xa3f5('0xc5')](_0x509af3);}})[_0xa3f5('0x11')](function(_0x461b07){if(_0x461b07){_0x2fa221=_0x461b07['length'];if(!_0x4d6a37['query'][_0xa3f5('0x4f')](_0xa3f5('0x50'))){_0x509af3[_0xa3f5('0x21')]=qs[_0xa3f5('0x21')](_0x4d6a37[_0xa3f5('0x4a')]['limit']);_0x509af3[_0xa3f5('0x1f')]=qs[_0xa3f5('0x1f')](_0x4d6a37[_0xa3f5('0x4a')][_0xa3f5('0x1f')]);}return _0x5d8ab6[_0xa3f5('0xc5')](_0x509af3);}})[_0xa3f5('0x11')](function(_0x3e1256){if(_0x3e1256){return _0x3e1256?{'count':_0x2fa221,'rows':_0x3e1256}:null;}})['then'](respondWithResult(_0xc2b24,null))[_0xa3f5('0x1b')](handleError(_0xc2b24,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 173bbe8..ac3a0e2 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 _0xaa37=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xaa37[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var MailAccount=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){MailAccountEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);MailAccountEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];MailAccount[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x9d76=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9d76,0x76));var _0x69d7=function(_0x2f7097,_0x5c0aeb){_0x2f7097=_0x2f7097-0x0;var _0x37c1a1=_0x9d76[_0x2f7097];return _0x37c1a1;};'use strict';var EventEmitter=require(_0x69d7('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x69d7('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x69d7('0x2')](0x0);var events={'afterCreate':_0x69d7('0x3'),'afterUpdate':_0x69d7('0x4'),'afterDestroy':_0x69d7('0x5')};function emitEvent(_0x1ec147){return function(_0x501e6e,_0x564797,_0xe17afc){MailAccountEvents[_0x69d7('0x6')](_0x1ec147+':'+_0x501e6e['id'],_0x501e6e);MailAccountEvents[_0x69d7('0x6')](_0x1ec147,_0x501e6e);_0xe17afc(null);};}for(var e in events){if(events[_0x69d7('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x69d7('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 b3355eb..4dcbb2b 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 _0x27bf=['exports','define','mail_accounts','provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','user','pass'];(function(_0xf88c0d,_0x41e018){var _0xd69855=function(_0x363538){while(--_0x363538){_0xf88c0d['push'](_0xf88c0d['shift']());}};_0xd69855(++_0x41e018);}(_0x27bf,0x80));var _0xf27b=function(_0x40f34d,_0x3c254a){_0x40f34d=_0x40f34d-0x0;var _0x5d506e=_0x27bf[_0x40f34d];return _0x5d506e;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xf27b('0x0')]=function(_0x41c40f){return _0x41c40f[_0xf27b('0x1')]('MailAccount',attributes,{'tableName':_0xf27b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x27de72=this;var _0x56cfb7={'id':_0x27de72['id'],'tls':{'rejectUnauthorized':![]}};if(_0x27de72[_0xf27b('0x3')]!=='custom'){_0x56cfb7['service']=_0x27de72[_0xf27b('0x3')];}else{_0x56cfb7['host']=_0x27de72[_0xf27b('0x4')][_0xf27b('0x5')];_0x56cfb7[_0xf27b('0x6')]=_0x27de72['Smtp'][_0xf27b('0x6')];_0x56cfb7[_0xf27b('0x7')]=_0x27de72[_0xf27b('0x4')][_0xf27b('0x7')];}if(_0x27de72[_0xf27b('0x4')][_0xf27b('0x8')]){if(_0x27de72[_0xf27b('0x4')][_0xf27b('0x9')]){if(!_0x27de72[_0xf27b('0x4')][_0xf27b('0xa')])throw new Error(_0xf27b('0xb'));_0x56cfb7[_0xf27b('0xc')]={'type':'OAuth2','user':_0x27de72['Smtp']['user'],'accessToken':_0x27de72[_0xf27b('0x4')][_0xf27b('0xa')][_0xf27b('0xd')]};}else{_0x56cfb7[_0xf27b('0xc')]={'user':_0x27de72[_0xf27b('0x4')][_0xf27b('0xe')],'pass':_0x27de72['Smtp'][_0xf27b('0xf')]};}}return _0x56cfb7;}}});}; \ No newline at end of file +var _0x0f36=['modernAuthentication','auth','OAuth2','user','CloudProvider','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port','secure'];(function(_0xb73e2a,_0x1b6936){var _0x56f2ad=function(_0x3de0f6){while(--_0x3de0f6){_0xb73e2a['push'](_0xb73e2a['shift']());}};_0x56f2ad(++_0x1b6936);}(_0x0f36,0xa8));var _0x60f3=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0x0f36[_0x2ccd5e];return _0x1a758e;};'use strict';var attributes=require(_0x60f3('0x0'));module[_0x60f3('0x1')]=function(_0xdb558c){return _0xdb558c[_0x60f3('0x2')](_0x60f3('0x3'),attributes,{'tableName':_0x60f3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xfb500d=this;var _0x1842c6={'id':_0xfb500d['id'],'tls':{'rejectUnauthorized':![]}};if(_0xfb500d['provider']!==_0x60f3('0x5')){_0x1842c6[_0x60f3('0x6')]=_0xfb500d[_0x60f3('0x7')];}else{_0x1842c6[_0x60f3('0x8')]=_0xfb500d[_0x60f3('0x9')][_0x60f3('0x8')];_0x1842c6[_0x60f3('0xa')]=_0xfb500d[_0x60f3('0x9')][_0x60f3('0xa')];_0x1842c6[_0x60f3('0xb')]=_0xfb500d[_0x60f3('0x9')][_0x60f3('0xb')];}if(_0xfb500d[_0x60f3('0x9')]['authentication']){if(_0xfb500d[_0x60f3('0x9')][_0x60f3('0xc')]){if(!_0xfb500d[_0x60f3('0x9')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x1842c6[_0x60f3('0xd')]={'type':_0x60f3('0xe'),'user':_0xfb500d[_0x60f3('0x9')][_0x60f3('0xf')],'accessToken':_0xfb500d['Smtp'][_0x60f3('0x10')]['data5']};}else{_0x1842c6[_0x60f3('0xd')]={'user':_0xfb500d[_0x60f3('0x9')][_0x60f3('0xf')],'pass':_0xfb500d[_0x60f3('0x9')][_0x60f3('0x11')]};}}return _0x1842c6;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 831f884..c37fef9 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 _0xf767=['MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailAccount','MailAccount','options','where','limit','map','model','attributes','include','debug','ShowMailAccount','find','raw','smtp','setDataValue','getSmtpOptions','catch','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','applications','list','orderBy','priority','autoclose','push','close','*,*,*,*','length','create','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','spread','update','subject','attach','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','name','queueId'];(function(_0x2d1dcd,_0x20ae0f){var _0x2a5a40=function(_0x51bbe7){while(--_0x51bbe7){_0x2d1dcd['push'](_0x2d1dcd['shift']());}};_0x2a5a40(++_0x20ae0f);}(_0xf767,0x76));var _0x7f76=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xf767[_0x39bc44];return _0x2916d8;};'use strict';var _=require('lodash');var moment=require(_0x7f76('0x0'));var BPromise=require(_0x7f76('0x1'));var rs=require(_0x7f76('0x2'));var Redis=require(_0x7f76('0x3'));var db=require(_0x7f76('0x4'))['db'];var logger=require('../../config/logger')(_0x7f76('0x5'));var config=require(_0x7f76('0x6'));var jayson=require(_0x7f76('0x7'));var client=jayson[_0x7f76('0x8')]['http']({'port':0x232c});config[_0x7f76('0x9')]=_[_0x7f76('0xa')](config[_0x7f76('0x9')],{'host':_0x7f76('0xb'),'port':0x18eb});var socket=require(_0x7f76('0xc'))(new Redis(config['redis']));require(_0x7f76('0xd'))[_0x7f76('0xe')](socket);function respondWithRpcPromise(_0x35d28d,_0x15dcd9,_0x4c5f88){return new BPromise(function(_0x247403,_0x5dc8aa){return client[_0x7f76('0xf')](_0x35d28d,_0x4c5f88)[_0x7f76('0x10')](function(_0x4dbc83){logger[_0x7f76('0x11')](_0x7f76('0x12'),_0x15dcd9,_0x7f76('0x13'));logger['debug'](_0x7f76('0x14'),_0x15dcd9,_0x7f76('0x13'),JSON[_0x7f76('0x15')](_0x4dbc83));if(_0x4dbc83[_0x7f76('0x16')]){if(_0x4dbc83[_0x7f76('0x16')]['code']===0x1f4){logger[_0x7f76('0x16')]('MailAccount,\x20%s,\x20%s',_0x15dcd9,_0x4dbc83[_0x7f76('0x16')][_0x7f76('0x17')]);return _0x5dc8aa(_0x4dbc83['error']['message']);}logger['error'](_0x7f76('0x12'),_0x15dcd9,_0x4dbc83[_0x7f76('0x16')][_0x7f76('0x17')]);return _0x247403(_0x4dbc83['error'][_0x7f76('0x17')]);}else{logger['info'](_0x7f76('0x12'),_0x15dcd9,_0x7f76('0x13'));_0x247403(_0x4dbc83[_0x7f76('0x18')]['message']);}})['catch'](function(_0x494537){logger['error']('MailAccount,\x20%s,\x20%s',_0x15dcd9,_0x494537);_0x5dc8aa(_0x494537);});});}exports[_0x7f76('0x19')]=function(_0xdb1407){var _0x2b2e32=this;return new Promise(function(_0x21c2ca,_0x54610a){return db[_0x7f76('0x1a')]['findAll']({'raw':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xdb1407['options']?_0xdb1407[_0x7f76('0x1b')][_0x7f76('0x1c')]||null:null,'attributes':_0xdb1407['options']?_0xdb1407[_0x7f76('0x1b')]['attributes']||null:null,'limit':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')][_0x7f76('0x1d')]||null:null,'include':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')]['include']?_[_0x7f76('0x1e')](_0xdb1407['options']['include'],function(_0x197519){return{'model':db[_0x197519[_0x7f76('0x1f')]],'as':_0x197519['as'],'attributes':_0x197519[_0x7f76('0x20')],'include':_0x197519['include']?_[_0x7f76('0x1e')](_0x197519[_0x7f76('0x21')],function(_0x3e624d){return{'model':db[_0x3e624d[_0x7f76('0x1f')]],'as':_0x3e624d['as'],'attributes':_0x3e624d[_0x7f76('0x20')],'include':_0x3e624d['include']?_[_0x7f76('0x1e')](_0x3e624d[_0x7f76('0x21')],function(_0x523d7a){return{'model':db[_0x523d7a['model']],'as':_0x523d7a['as'],'attributes':_0x523d7a[_0x7f76('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1dd664){logger[_0x7f76('0x11')](_0x7f76('0x19'),_0xdb1407);logger[_0x7f76('0x22')](_0x7f76('0x19'),_0xdb1407,JSON[_0x7f76('0x15')](_0x1dd664));_0x21c2ca(_0x1dd664);})['catch'](function(_0x3570ec){logger[_0x7f76('0x16')](_0x7f76('0x19'),_0x3570ec[_0x7f76('0x17')],_0xdb1407);_0x54610a(_0x2b2e32['error'](0x1f4,_0x3570ec[_0x7f76('0x17')]));});});};exports[_0x7f76('0x23')]=function(_0x3aacba){var _0x4d7a2f=this;return new Promise(function(_0x208ced,_0x419dad){return db[_0x7f76('0x1a')][_0x7f76('0x24')]({'raw':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x25')]===undefined?!![]:![]:!![],'where':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x1c')]||null:null,'attributes':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x20')]||null:null,'include':_0x3aacba['options']?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x21')]?_[_0x7f76('0x1e')](_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x21')],function(_0x20c260){return{'model':db[_0x20c260[_0x7f76('0x1f')]],'as':_0x20c260['as'],'attributes':_0x20c260[_0x7f76('0x20')],'include':_0x20c260['include']?_[_0x7f76('0x1e')](_0x20c260['include'],function(_0x5e9a68){return{'model':db[_0x5e9a68[_0x7f76('0x1f')]],'as':_0x5e9a68['as'],'attributes':_0x5e9a68['attributes'],'include':_0x5e9a68[_0x7f76('0x21')]?_[_0x7f76('0x1e')](_0x5e9a68['include'],function(_0x3dbcc3){return{'model':db[_0x3dbcc3['model']],'as':_0x3dbcc3['as'],'attributes':_0x3dbcc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f76('0x10')](function(_0x205223){if(_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x26')]===!![])_0x205223[_0x7f76('0x27')]('smtpOptions',_0x205223[_0x7f76('0x28')]());logger[_0x7f76('0x11')]('ShowMailAccount',_0x3aacba);logger['debug'](_0x7f76('0x23'),_0x3aacba,JSON['stringify'](_0x205223));_0x208ced(_0x205223);})[_0x7f76('0x29')](function(_0x17dfb3){logger[_0x7f76('0x16')]('ShowMailAccount',_0x17dfb3[_0x7f76('0x17')],_0x3aacba);_0x419dad(_0x4d7a2f[_0x7f76('0x16')](0x1f4,_0x17dfb3[_0x7f76('0x17')]));});});};exports[_0x7f76('0x2a')]=function(_0x1ed18a){var _0x438de8=this;return new Promise(function(_0x58649f,_0x518ced){var _0x218370={'body':_0x1ed18a[_0x7f76('0x2b')],'channel':_0x7f76('0x2c')};var _0x331f75=_[_0x7f76('0x2d')](_[_0x7f76('0x2e')](db[_0x7f76('0x2f')][_0x7f76('0x30')]),[_0x7f76('0x31'),_0x7f76('0x32'),_0x7f76('0x33'),_0x7f76('0x34')]);var _0x3229b9=![];if(_0x1ed18a[_0x7f76('0x2b')]['id']){delete _0x1ed18a[_0x7f76('0x2b')]['id'];}if(_[_0x7f76('0x35')](_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')])){return _0x518ced(_0x438de8['error'](0x1f4,_0x7f76('0x37')));}if(_[_0x7f76('0x35')](_0x1ed18a[_0x7f76('0x2b')]['body'])||_0x1ed18a['body'][_0x7f76('0x2b')]===''){return _0x518ced(_0x438de8['error'](0x1f4,_0x7f76('0x38')));}if(_['isNil'](_0x1ed18a['body'][_0x7f76('0x39')])){return _0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x7f76('0x3a')+_0x331f75));}if(!_[_0x7f76('0x3b')](_0x331f75,_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')])){return _0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x7f76('0x3c')+_0x331f75));}var _0x71f722={};_0x71f722[_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')]]=_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')];return db[_0x7f76('0x1a')]['find']({'where':{'id':_0x1ed18a[_0x7f76('0x3d')]['id']},'include':[{'model':db['CmList'],'as':_0x7f76('0x3e'),'include':[{'model':db[_0x7f76('0x2f')],'as':_0x7f76('0x3f'),'where':_0x71f722,'limit':0x1,'order':[[_0x7f76('0x32'),'DESC']]}]},{'model':db[_0x7f76('0x40')],'as':_0x7f76('0x41')},{'model':db[_0x7f76('0x42')],'as':_0x7f76('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7f76('0x44')}]}]})[_0x7f76('0x10')](function(_0x53f77a){if(_0x53f77a&&_0x53f77a[_0x7f76('0x3e')]){var _0x364fea=_0x53f77a[_0x7f76('0x45')]({'plain':!![]});_0x218370['account']=_[_0x7f76('0x46')](_0x364fea,[_0x7f76('0x41'),_0x7f76('0x3e')]);_0x218370[_0x7f76('0x3d')][_0x7f76('0x47')]=_0x53f77a[_0x7f76('0x28')]();_0x218370[_0x7f76('0x48')]=_0x364fea[_0x7f76('0x41')];_0x218370[_0x7f76('0x49')]=_0x364fea[_0x7f76('0x3e')];_0x218370[_0x7f76('0x48')]=_[_0x7f76('0x4a')](_0x218370['applications'],[_0x7f76('0x4b')],['asc']);if(_0x218370[_0x7f76('0x3d')]&&_0x218370[_0x7f76('0x3d')][_0x7f76('0x4c')]){_0x218370['applications'][_0x7f76('0x4d')]({'id':0x0,'priority':_0x218370[_0x7f76('0x48')]['length']+0x1,'app':_0x7f76('0x4e'),'appdata':_0x7f76('0x4c'),'interval':_0x7f76('0x4f')});}if(_0x218370[_0x7f76('0x3d')][_0x7f76('0x41')]){delete _0x218370[_0x7f76('0x3d')][_0x7f76('0x41')];}if(_0x218370[_0x7f76('0x3d')][_0x7f76('0x3e')]){delete _0x218370['account']['List'];}if(_0x364fea[_0x7f76('0x3e')][_0x7f76('0x3f')][_0x7f76('0x50')]){return _0x364fea[_0x7f76('0x3e')][_0x7f76('0x3f')][0x0];}var _0x33b0ae=_[_0x7f76('0xa')](_0x1ed18a[_0x7f76('0x2b')],{'firstName':_0x1ed18a[_0x7f76('0x2b')]['from'],'ListId':_0x364fea[_0x7f76('0x34')]});_0x33b0ae[_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')]]=_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')];return db[_0x7f76('0x2f')][_0x7f76('0x51')](_0x33b0ae);}else{throw new Error('List\x20not\x20found');}})[_0x7f76('0x10')](function(_0x52b523){_0x218370[_0x7f76('0x52')]=_0x52b523;if(_0x52b523){if(!_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')]){_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')]=rs[_0x7f76('0x54')]()+'\x20'+_0x1ed18a['body']['message'][_0x7f76('0x36')];}var _0x4529b0={'ContactId':_0x52b523['id'],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id'],'inReplyTo':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')],'to':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['from'],'cc':_0x1ed18a['body'][_0x7f76('0x17')]['cc'],'subject':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['subject'],'attach':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['attach'],'lastMsgAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgDirection':'in'};return db[_0x7f76('0x57')][_0x7f76('0x24')]({'where':{'closed':![],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id']},'include':[{'model':db[_0x7f76('0x58')],'as':'Messages','attributes':[_0x7f76('0x53')],'where':{'messageId':_0x1ed18a['body'][_0x7f76('0x17')]['inReplyTo']}}]})[_0x7f76('0x10')](function(_0x5f3db2){if(_0x5f3db2){return[_0x5f3db2,![]];}return db[_0x7f76('0x57')][_0x7f76('0x51')](_0x4529b0)[_0x7f76('0x10')](function(_0x3e83d2){return[_0x3e83d2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7f76('0x59')](function(_0x20264e,_0x46b15b){if(_0x20264e){_0x3229b9=_0x46b15b;if(!_0x46b15b){return _0x20264e[_0x7f76('0x5a')]({'inReplyTo':_0x1ed18a[_0x7f76('0x2b')]['message'][_0x7f76('0x53')],'to':_0x1ed18a['body'][_0x7f76('0x17')]['from'],'cc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['cc'],'subject':_0x1ed18a['body'][_0x7f76('0x17')][_0x7f76('0x5b')],'attach':_0x20264e[_0x7f76('0x5c')]?_0x20264e[_0x7f76('0x5c')]:_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x5c')],'substatus':null,'substatusAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgDirection':'in'});}else{return _0x20264e;}}})[_0x7f76('0x10')](function(_0xb0be79){_0x218370[_0x7f76('0x5d')]=_0xb0be79['get']({'plain':!![]});_0x218370[_0x7f76('0x5d')][_0x7f76('0x5e')]=_0x3229b9;return db['MailMessage'][_0x7f76('0x51')]({'body':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x2b')],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id'],'MailInteractionId':_0xb0be79['id'],'direction':'in','ContactId':_0x218370[_0x7f76('0x52')]['id'],'messageId':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')],'from':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x36')],'to':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['to'],'cc':_0x1ed18a[_0x7f76('0x2b')]['message']['cc'],'subject':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['subject'],'attach':_0x1ed18a['body']['message'][_0x7f76('0x5c')],'Attachments':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['attachments'],'originTo':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x5f')],'originCc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x60')],'bcc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x61')],'ChatWebsiteId':_0x1ed18a['body'][_0x7f76('0x17')][_0x7f76('0x62')]||null,'originChannel':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x63')]||_0x7f76('0x64'),'ChatOfflineMessageId':_0x1ed18a[_0x7f76('0x2b')]['message'][_0x7f76('0x65')]||null},{'include':[{'model':db[_0x7f76('0x66')],'as':_0x7f76('0x67')}]});})[_0x7f76('0x10')](function(_0x43d856){_0x218370['message']=_0x43d856;if(!_0x218370[_0x7f76('0x5d')][_0x7f76('0x68')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x218370[_0x7f76('0x5d')][_0x7f76('0x68')]}});})[_0x7f76('0x10')](function(_0x8d6dec){if(_0x8d6dec){_0x218370[_0x7f76('0x48')][_0x7f76('0x69')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8d6dec[_0x7f76('0x6a')]+','+(_0x218370[_0x7f76('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0x7f76('0x4f')});}if(!_0x218370[_0x7f76('0x5d')][_0x7f76('0x6b')]){return;}return db[_0x7f76('0x6c')][_0x7f76('0x24')]({'attributes':['id',_0x7f76('0x6a')],'where':{'id':_0x218370[_0x7f76('0x5d')]['queueId']}});})[_0x7f76('0x10')](function(_0x428865){if(_0x428865){_0x218370['applications'][_0x7f76('0x69')]({'id':0x0,'priority':0x1,'app':_0x7f76('0x6d'),'appdata':_0x428865['name']+','+(_0x218370[_0x7f76('0x3d')][_0x7f76('0x6e')]||0x12c),'interval':_0x7f76('0x4f')});}return respondWithRpcPromise(_0x7f76('0x6f'),_0x7f76('0x70'),_0x218370);})[_0x7f76('0x10')](function(_0x37afb1){_0x58649f(_0x37afb1);})[_0x7f76('0x29')](function(_0x95d3a8){_0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x95d3a8[_0x7f76('0x17')]));});});}; \ No newline at end of file +var _0x5496=['mapKey','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetMailAccount','findAll','options','raw','where','attributes','limit','map','model','include','then','stringify','catch','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','List','Applications','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*'];(function(_0x202506,_0x5b9c15){var _0x4c3e29=function(_0x4b5698){while(--_0x4b5698){_0x202506['push'](_0x202506['shift']());}};_0x4c3e29(++_0x5b9c15);}(_0x5496,0x175));var _0x6549=function(_0x2d8263,_0x55c222){_0x2d8263=_0x2d8263-0x0;var _0x3a59a6=_0x5496[_0x2d8263];return _0x3a59a6;};'use strict';var _=require(_0x6549('0x0'));var moment=require(_0x6549('0x1'));var BPromise=require(_0x6549('0x2'));var rs=require(_0x6549('0x3'));var Redis=require(_0x6549('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x6549('0x5'))('rpc');var config=require(_0x6549('0x6'));var jayson=require(_0x6549('0x7'));var client=jayson[_0x6549('0x8')]['http']({'port':0x232c});config['redis']=_[_0x6549('0x9')](config[_0x6549('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6549('0xb'))(new Redis(config[_0x6549('0xa')]));require(_0x6549('0xc'))['register'](socket);function respondWithRpcPromise(_0xa12086,_0x35d008,_0x2ecce2){return new BPromise(function(_0x135c2c,_0x1e5083){return client[_0x6549('0xd')](_0xa12086,_0x2ecce2)['then'](function(_0x551133){logger[_0x6549('0xe')](_0x6549('0xf'),_0x35d008,_0x6549('0x10'));logger[_0x6549('0x11')](_0x6549('0x12'),_0x35d008,'request\x20sent',JSON['stringify'](_0x551133));if(_0x551133[_0x6549('0x13')]){if(_0x551133[_0x6549('0x13')]['code']===0x1f4){logger[_0x6549('0x13')](_0x6549('0xf'),_0x35d008,_0x551133[_0x6549('0x13')][_0x6549('0x14')]);return _0x1e5083(_0x551133[_0x6549('0x13')][_0x6549('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x35d008,_0x551133[_0x6549('0x13')][_0x6549('0x14')]);return _0x135c2c(_0x551133['error'][_0x6549('0x14')]);}else{logger[_0x6549('0xe')](_0x6549('0xf'),_0x35d008,_0x6549('0x10'));_0x135c2c(_0x551133[_0x6549('0x15')]['message']);}})['catch'](function(_0x26a212){logger['error']('MailAccount,\x20%s,\x20%s',_0x35d008,_0x26a212);_0x1e5083(_0x26a212);});});}exports[_0x6549('0x16')]=function(_0x1e5079){var _0x19c4a6=this;return new Promise(function(_0xfca192,_0x236fd9){return db['MailAccount'][_0x6549('0x17')]({'raw':_0x1e5079['options']?_0x1e5079[_0x6549('0x18')][_0x6549('0x19')]===undefined?!![]:![]:!![],'where':_0x1e5079[_0x6549('0x18')]?_0x1e5079[_0x6549('0x18')][_0x6549('0x1a')]||null:null,'attributes':_0x1e5079[_0x6549('0x18')]?_0x1e5079[_0x6549('0x18')][_0x6549('0x1b')]||null:null,'limit':_0x1e5079[_0x6549('0x18')]?_0x1e5079[_0x6549('0x18')][_0x6549('0x1c')]||null:null,'include':_0x1e5079[_0x6549('0x18')]?_0x1e5079[_0x6549('0x18')]['include']?_[_0x6549('0x1d')](_0x1e5079[_0x6549('0x18')]['include'],function(_0x126967){return{'model':db[_0x126967[_0x6549('0x1e')]],'as':_0x126967['as'],'attributes':_0x126967[_0x6549('0x1b')],'include':_0x126967['include']?_[_0x6549('0x1d')](_0x126967[_0x6549('0x1f')],function(_0x14de1f){return{'model':db[_0x14de1f[_0x6549('0x1e')]],'as':_0x14de1f['as'],'attributes':_0x14de1f[_0x6549('0x1b')],'include':_0x14de1f[_0x6549('0x1f')]?_[_0x6549('0x1d')](_0x14de1f[_0x6549('0x1f')],function(_0x4c52f1){return{'model':db[_0x4c52f1[_0x6549('0x1e')]],'as':_0x4c52f1['as'],'attributes':_0x4c52f1[_0x6549('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6549('0x20')](function(_0x4c605c){logger[_0x6549('0xe')]('GetMailAccount',_0x1e5079);logger['debug']('GetMailAccount',_0x1e5079,JSON[_0x6549('0x21')](_0x4c605c));_0xfca192(_0x4c605c);})[_0x6549('0x22')](function(_0x4f3069){logger[_0x6549('0x13')](_0x6549('0x16'),_0x4f3069[_0x6549('0x14')],_0x1e5079);_0x236fd9(_0x19c4a6[_0x6549('0x13')](0x1f4,_0x4f3069[_0x6549('0x14')]));});});};exports[_0x6549('0x23')]=function(_0x464adf){var _0x504c42=this;return new Promise(function(_0x1b453c,_0x3ebea6){return db[_0x6549('0x24')][_0x6549('0x25')]({'raw':_0x464adf[_0x6549('0x18')]?_0x464adf[_0x6549('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x464adf[_0x6549('0x18')]?_0x464adf['options'][_0x6549('0x1a')]||null:null,'attributes':_0x464adf['options']?_0x464adf[_0x6549('0x18')][_0x6549('0x1b')]||null:null,'include':_0x464adf[_0x6549('0x18')]?_0x464adf['options'][_0x6549('0x1f')]?_[_0x6549('0x1d')](_0x464adf[_0x6549('0x18')][_0x6549('0x1f')],function(_0x5b8624){return{'model':db[_0x5b8624['model']],'as':_0x5b8624['as'],'attributes':_0x5b8624['attributes'],'include':_0x5b8624[_0x6549('0x1f')]?_[_0x6549('0x1d')](_0x5b8624['include'],function(_0x43220f){return{'model':db[_0x43220f[_0x6549('0x1e')]],'as':_0x43220f['as'],'attributes':_0x43220f[_0x6549('0x1b')],'include':_0x43220f[_0x6549('0x1f')]?_[_0x6549('0x1d')](_0x43220f['include'],function(_0x499898){return{'model':db[_0x499898[_0x6549('0x1e')]],'as':_0x499898['as'],'attributes':_0x499898[_0x6549('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6549('0x20')](function(_0xa79ffb){if(_0x464adf[_0x6549('0x18')][_0x6549('0x26')]===!![])_0xa79ffb[_0x6549('0x27')](_0x6549('0x28'),_0xa79ffb[_0x6549('0x29')]());logger[_0x6549('0xe')]('ShowMailAccount',_0x464adf);logger[_0x6549('0x11')](_0x6549('0x23'),_0x464adf,JSON[_0x6549('0x21')](_0xa79ffb));_0x1b453c(_0xa79ffb);})[_0x6549('0x22')](function(_0x4703f0){logger['error']('ShowMailAccount',_0x4703f0['message'],_0x464adf);_0x3ebea6(_0x504c42[_0x6549('0x13')](0x1f4,_0x4703f0[_0x6549('0x14')]));});});};exports[_0x6549('0x2a')]=function(_0x2754aa){var _0x4f2c2f=this;return new Promise(function(_0x56ce9f,_0x438f0b){var _0x1e719a={'body':_0x2754aa[_0x6549('0x2b')],'channel':'mail'};var _0x973d2d=_['difference'](_[_0x6549('0x2c')](db[_0x6549('0x2d')][_0x6549('0x2e')]),[_0x6549('0x2f'),_0x6549('0x30'),_0x6549('0x31'),_0x6549('0x32')]);var _0x4deaab=![];if(_0x2754aa[_0x6549('0x2b')]['id']){delete _0x2754aa[_0x6549('0x2b')]['id'];}if(_[_0x6549('0x33')](_0x2754aa[_0x6549('0x2b')][_0x6549('0x34')])){return _0x438f0b(_0x4f2c2f[_0x6549('0x13')](0x1f4,_0x6549('0x35')));}if(_[_0x6549('0x33')](_0x2754aa[_0x6549('0x2b')][_0x6549('0x2b')])||_0x2754aa[_0x6549('0x2b')][_0x6549('0x2b')]===''){return _0x438f0b(_0x4f2c2f[_0x6549('0x13')](0x1f4,_0x6549('0x36')));}if(_[_0x6549('0x33')](_0x2754aa[_0x6549('0x2b')]['mapKey'])){return _0x438f0b(_0x4f2c2f[_0x6549('0x13')](0x1f4,_0x6549('0x37')+_0x973d2d));}if(!_[_0x6549('0x38')](_0x973d2d,_0x2754aa[_0x6549('0x2b')]['mapKey'])){return _0x438f0b(_0x4f2c2f[_0x6549('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x973d2d));}var _0x14c90a={};_0x14c90a[_0x2754aa[_0x6549('0x2b')]['mapKey']]=_0x2754aa[_0x6549('0x2b')][_0x6549('0x34')];return db[_0x6549('0x24')][_0x6549('0x25')]({'where':{'id':_0x2754aa[_0x6549('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6549('0x2d')],'as':_0x6549('0x3a'),'where':_0x14c90a,'limit':0x1,'order':[[_0x6549('0x30'),_0x6549('0x3b')]]}]},{'model':db[_0x6549('0x3c')],'as':'Applications'},{'model':db[_0x6549('0x3d')],'as':_0x6549('0x3e'),'include':[{'model':db[_0x6549('0x3f')],'as':_0x6549('0x3f')}]}]})[_0x6549('0x20')](function(_0x25a6ee){if(_0x25a6ee&&_0x25a6ee[_0x6549('0x40')]){var _0x195566=_0x25a6ee['get']({'plain':!![]});_0x1e719a[_0x6549('0x39')]=_['omit'](_0x195566,[_0x6549('0x41'),_0x6549('0x40')]);_0x1e719a[_0x6549('0x39')]['smtpOptions']=_0x25a6ee[_0x6549('0x29')]();_0x1e719a[_0x6549('0x42')]=_0x195566[_0x6549('0x41')];_0x1e719a['list']=_0x195566[_0x6549('0x40')];_0x1e719a[_0x6549('0x42')]=_[_0x6549('0x43')](_0x1e719a[_0x6549('0x42')],[_0x6549('0x44')],[_0x6549('0x45')]);if(_0x1e719a['account']&&_0x1e719a[_0x6549('0x39')]['autoclose']){_0x1e719a[_0x6549('0x42')][_0x6549('0x46')]({'id':0x0,'priority':_0x1e719a[_0x6549('0x42')][_0x6549('0x47')]+0x1,'app':_0x6549('0x48'),'appdata':_0x6549('0x49'),'interval':_0x6549('0x4a')});}if(_0x1e719a[_0x6549('0x39')][_0x6549('0x41')]){delete _0x1e719a[_0x6549('0x39')][_0x6549('0x41')];}if(_0x1e719a[_0x6549('0x39')]['List']){delete _0x1e719a[_0x6549('0x39')][_0x6549('0x40')];}if(_0x195566[_0x6549('0x40')][_0x6549('0x3a')][_0x6549('0x47')]){return _0x195566[_0x6549('0x40')][_0x6549('0x3a')][0x0];}var _0x1e4112=_['defaults'](_0x2754aa[_0x6549('0x2b')],{'firstName':_0x2754aa[_0x6549('0x2b')][_0x6549('0x34')],'ListId':_0x195566[_0x6549('0x32')]});_0x1e4112[_0x2754aa[_0x6549('0x2b')][_0x6549('0x4b')]]=_0x2754aa[_0x6549('0x2b')][_0x6549('0x34')];return db['CmContact'][_0x6549('0x4c')](_0x1e4112);}else{throw new Error(_0x6549('0x4d'));}})[_0x6549('0x20')](function(_0x27ca0d){_0x1e719a[_0x6549('0x4e')]=_0x27ca0d;if(_0x27ca0d){if(!_0x2754aa[_0x6549('0x2b')]['message'][_0x6549('0x4f')]){_0x2754aa[_0x6549('0x2b')]['message'][_0x6549('0x4f')]=rs[_0x6549('0x50')]()+'\x20'+_0x2754aa[_0x6549('0x2b')]['message'][_0x6549('0x34')];}var _0x25d086={'ContactId':_0x27ca0d['id'],'MailAccountId':_0x2754aa['account']['id'],'inReplyTo':_0x2754aa[_0x6549('0x2b')]['message'][_0x6549('0x4f')],'to':_0x2754aa['body'][_0x6549('0x14')][_0x6549('0x34')],'cc':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['cc'],'subject':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x51')],'attach':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x52')],'lastMsgAt':moment()[_0x6549('0x53')](_0x6549('0x54')),'lastMsgDirection':'in'};return db[_0x6549('0x55')][_0x6549('0x25')]({'where':{'closed':![],'MailAccountId':_0x2754aa['account']['id']},'include':[{'model':db[_0x6549('0x56')],'as':_0x6549('0x57'),'attributes':['messageId'],'where':{'messageId':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x58')]}}]})[_0x6549('0x20')](function(_0x4fbc75){if(_0x4fbc75){return[_0x4fbc75,![]];}return db[_0x6549('0x55')][_0x6549('0x4c')](_0x25d086)[_0x6549('0x20')](function(_0x20e39b){return[_0x20e39b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6549('0x59')](function(_0x5372f4,_0xbe3fcb){if(_0x5372f4){_0x4deaab=_0xbe3fcb;if(!_0xbe3fcb){return _0x5372f4[_0x6549('0x5a')]({'inReplyTo':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x4f')],'to':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x34')],'cc':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['cc'],'subject':_0x2754aa['body'][_0x6549('0x14')][_0x6549('0x51')],'attach':_0x5372f4[_0x6549('0x52')]?_0x5372f4[_0x6549('0x52')]:_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x6549('0x54')),'lastMsgAt':moment()[_0x6549('0x53')](_0x6549('0x54')),'lastMsgDirection':'in'});}else{return _0x5372f4;}}})['then'](function(_0x1be12c){_0x1e719a[_0x6549('0x5b')]=_0x1be12c['get']({'plain':!![]});_0x1e719a[_0x6549('0x5b')][_0x6549('0x5c')]=_0x4deaab;return db[_0x6549('0x56')][_0x6549('0x4c')]({'body':_0x2754aa[_0x6549('0x2b')][_0x6549('0x2b')],'MailAccountId':_0x2754aa[_0x6549('0x39')]['id'],'MailInteractionId':_0x1be12c['id'],'direction':'in','ContactId':_0x1e719a[_0x6549('0x4e')]['id'],'messageId':_0x2754aa['body'][_0x6549('0x14')]['messageId'],'from':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['from'],'to':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['to'],'cc':_0x2754aa[_0x6549('0x2b')]['message']['cc'],'subject':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x51')],'attach':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x52')],'Attachments':_0x2754aa['body'][_0x6549('0x14')][_0x6549('0x5d')],'originTo':_0x2754aa[_0x6549('0x2b')]['message']['originTo'],'originCc':_0x2754aa['body'][_0x6549('0x14')][_0x6549('0x5e')],'bcc':_0x2754aa[_0x6549('0x2b')]['message']['bcc'],'ChatWebsiteId':_0x2754aa[_0x6549('0x2b')]['message'][_0x6549('0x5f')]||null,'originChannel':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')][_0x6549('0x60')]||_0x6549('0x61'),'ChatOfflineMessageId':_0x2754aa[_0x6549('0x2b')][_0x6549('0x14')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x6549('0x62')],'as':_0x6549('0x63')}]});})[_0x6549('0x20')](function(_0x54e865){_0x1e719a[_0x6549('0x14')]=_0x54e865;if(!_0x1e719a[_0x6549('0x5b')][_0x6549('0x64')]){return;}return db[_0x6549('0x65')][_0x6549('0x25')]({'attributes':['id',_0x6549('0x66')],'where':{'id':_0x1e719a[_0x6549('0x5b')]['UserId']}});})[_0x6549('0x20')](function(_0x53483c){if(_0x53483c){_0x1e719a[_0x6549('0x42')][_0x6549('0x67')]({'id':0x0,'priority':0x0,'app':_0x6549('0x68'),'appdata':_0x53483c[_0x6549('0x66')]+','+(_0x1e719a[_0x6549('0x39')][_0x6549('0x69')]||0xa),'interval':_0x6549('0x4a')});}if(!_0x1e719a[_0x6549('0x5b')]['queueId']){return;}return db[_0x6549('0x6a')][_0x6549('0x25')]({'attributes':['id',_0x6549('0x66')],'where':{'id':_0x1e719a[_0x6549('0x5b')][_0x6549('0x6b')]}});})[_0x6549('0x20')](function(_0xc8645b){if(_0xc8645b){_0x1e719a[_0x6549('0x42')][_0x6549('0x67')]({'id':0x0,'priority':0x1,'app':_0x6549('0x6c'),'appdata':_0xc8645b['name']+','+(_0x1e719a[_0x6549('0x39')][_0x6549('0x6d')]||0x12c),'interval':_0x6549('0x4a')});}return respondWithRpcPromise(_0x6549('0x6e'),_0x6549('0x6f'),_0x1e719a);})[_0x6549('0x20')](function(_0x2d6b35){_0x56ce9f(_0x2d6b35);})[_0x6549('0x22')](function(_0x12fb24){_0x438f0b(_0x4f2c2f[_0x6549('0x13')](0x1f4,_0x12fb24[_0x6549('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f784b9f..6594283 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 _0x9626=['remove','emit','register','length','./mailAccount.events','save'];(function(_0x1e0ee8,_0x5412b7){var _0x574fe2=function(_0x11c346){while(--_0x11c346){_0x1e0ee8['push'](_0x1e0ee8['shift']());}};_0x574fe2(++_0x5412b7);}(_0x9626,0x196));var _0x6962=function(_0x6dfd85,_0x29861c){_0x6dfd85=_0x6dfd85-0x0;var _0xe8783d=_0x9626[_0x6dfd85];return _0xe8783d;};'use strict';var MailAccountEvents=require(_0x6962('0x0'));var events=[_0x6962('0x1'),_0x6962('0x2'),'update'];function createListener(_0x476dfe,_0x5a3613){return function(_0x2f9f7e){_0x5a3613[_0x6962('0x3')](_0x476dfe,_0x2f9f7e);};}function removeListener(_0x129f2f,_0xf8b96d){return function(){MailAccountEvents['removeListener'](_0x129f2f,_0xf8b96d);};}exports[_0x6962('0x4')]=function(_0x4da270){for(var _0x188f79=0x0,_0x38b226=events[_0x6962('0x5')];_0x188f79<_0x38b226;_0x188f79++){var _0x183e64=events[_0x188f79];var _0x4e4266=createListener('mailAccount:'+_0x183e64,_0x4da270);MailAccountEvents['on'](_0x183e64,_0x4e4266);}}; \ No newline at end of file +var _0x867a=['remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x867a,0x15d));var _0xa867=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x867a[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xa867('0x0'));var events=[_0xa867('0x1'),_0xa867('0x2'),_0xa867('0x3')];function createListener(_0x41741a,_0x5cb82e){return function(_0x321444){_0x5cb82e[_0xa867('0x4')](_0x41741a,_0x321444);};}function removeListener(_0x17a786,_0x3ca820){return function(){MailAccountEvents[_0xa867('0x5')](_0x17a786,_0x3ca820);};}exports[_0xa867('0x6')]=function(_0x354314){for(var _0x9c6bb4=0x0,_0x1904a4=events[_0xa867('0x7')];_0x9c6bb4<_0x1904a4;_0x9c6bb4++){var _0x2bea9b=events[_0x9c6bb4];var _0x4a157f=createListener(_0xa867('0x8')+_0x2bea9b,_0x354314);MailAccountEvents['on'](_0x2bea9b,_0x4a157f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c2b6529..1b66a88 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 _0xfb8b=['get','/:id','isAuthenticated','show','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x47eb64,_0x176207){var _0x42695a=function(_0x53497e){while(--_0x53497e){_0x47eb64['push'](_0x47eb64['shift']());}};_0x42695a(++_0x176207);}(_0xfb8b,0x1d2));var _0xbfb8=function(_0x28511b,_0x1d9280){_0x28511b=_0x28511b-0x0;var _0x2b2f13=_0xfb8b[_0x28511b];return _0x2b2f13;};'use strict';var multer=require(_0xbfb8('0x0'));var util=require(_0xbfb8('0x1'));var path=require(_0xbfb8('0x2'));var timeout=require('connect-timeout');var express=require(_0xbfb8('0x3'));var router=express[_0xbfb8('0x4')]();var fs_extra=require(_0xbfb8('0x5'));var auth=require(_0xbfb8('0x6'));var interaction=require(_0xbfb8('0x7'));var config=require(_0xbfb8('0x8'));var controller=require(_0xbfb8('0x9'));router[_0xbfb8('0xa')](_0xbfb8('0xb'),auth[_0xbfb8('0xc')](),controller[_0xbfb8('0xd')]);router[_0xbfb8('0xe')]('/:id',auth[_0xbfb8('0xc')](),controller[_0xbfb8('0xf')]);router['delete'](_0xbfb8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbfb8('0x10')]=router; \ No newline at end of file +var _0x0909=['../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','update','delete','exports','multer','connect-timeout','../../components/auth/service'];(function(_0x30f1d1,_0x21bb21){var _0x3bdd8d=function(_0x13f38f){while(--_0x13f38f){_0x30f1d1['push'](_0x30f1d1['shift']());}};_0x3bdd8d(++_0x21bb21);}(_0x0909,0xfa));var _0x9090=function(_0x27b31d,_0x63b4fd){_0x27b31d=_0x27b31d-0x0;var _0x21bf61=_0x0909[_0x27b31d];return _0x21bf61;};'use strict';var multer=require(_0x9090('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9090('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9090('0x2'));var interaction=require(_0x9090('0x3'));var config=require(_0x9090('0x4'));var controller=require(_0x9090('0x5'));router['get'](_0x9090('0x6'),auth['isAuthenticated'](),controller['show']);router['put'](_0x9090('0x6'),auth[_0x9090('0x7')](),controller[_0x9090('0x8')]);router[_0x9090('0x9')](_0x9090('0x6'),auth[_0x9090('0x7')](),controller['destroy']);module[_0x9090('0xa')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 108be2e..bf5be66 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 _0xdcd1=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdcd1,0x84));var _0x1dcd=function(_0x454a3f,_0x261f5c){_0x454a3f=_0x454a3f-0x0;var _0xe56702=_0xdcd1[_0x454a3f];return _0xe56702;};'use strict';var Sequelize=require('sequelize');module[_0x1dcd('0x0')]={'priority':{'type':Sequelize[_0x1dcd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1dcd('0x2')],'allowNull':![],'defaultValue':_0x1dcd('0x3')},'appdata':{'type':Sequelize[_0x1dcd('0x4')]()},'description':{'type':Sequelize[_0x1dcd('0x2')]},'interval':{'type':Sequelize[_0x1dcd('0x2')],'defaultValue':_0x1dcd('0x5')}}; \ No newline at end of file +var _0xaddc=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaddc,0x125));var _0xcadd=function(_0x55005c,_0x50eabc){_0x55005c=_0x55005c-0x0;var _0x440773=_0xaddc[_0x55005c];return _0x440773;};'use strict';var Sequelize=require(_0xcadd('0x0'));module[_0xcadd('0x1')]={'priority':{'type':Sequelize[_0xcadd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcadd('0x3')],'allowNull':![],'defaultValue':_0xcadd('0x4')},'appdata':{'type':Sequelize[_0xcadd('0x5')]()},'description':{'type':Sequelize[_0xcadd('0x3')]},'interval':{'type':Sequelize[_0xcadd('0x3')],'defaultValue':_0xcadd('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 28b6111..ab150d6 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x2a2fdb,_0x5b5d57){var _0x34fbbf=function(_0x414ba3){while(--_0x414ba3){_0x2a2fdb['push'](_0x2a2fdb['shift']());}};_0x34fbbf(++_0x5b5d57);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x22ac5b,_0x2ef85c){var _0x4b5cc4=function(_0x58cf23){while(--_0x58cf23){_0x22ac5b['push'](_0x22ac5b['shift']());}};_0x4b5cc4(++_0x2ef85c);}(_0xe706,0xa3));var _0x6e70=function(_0x517f0f,_0x5a95b7){_0x517f0f=_0x517f0f-0x0;var _0x226e4e=_0xe706[_0x517f0f];return _0x226e4e;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 36da3b7..d19c01d 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 _0x717c=['lodash','util','bluebird','path','./mailApplication.attributes','exports','define','mail_applications','utf8mb4'];(function(_0x294039,_0x21795b){var _0x1b48e5=function(_0x29ff6a){while(--_0x29ff6a){_0x294039['push'](_0x294039['shift']());}};_0x1b48e5(++_0x21795b);}(_0x717c,0x1cb));var _0xc717=function(_0x473ef2,_0x1c4151){_0x473ef2=_0x473ef2-0x0;var _0x3ab7f2=_0x717c[_0x473ef2];return _0x3ab7f2;};'use strict';var _=require(_0xc717('0x0'));var util=require(_0xc717('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc717('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc717('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc717('0x4'));module[_0xc717('0x5')]=function(_0x551fed,_0x248f92){return _0x551fed[_0xc717('0x6')]('MailApplication',attributes,{'tableName':_0xc717('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc717('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x316d=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x21c622,_0x124272){var _0x4fed92=function(_0x2dfe00){while(--_0x2dfe00){_0x21c622['push'](_0x21c622['shift']());}};_0x4fed92(++_0x124272);}(_0x316d,0xa1));var _0xd316=function(_0x4e6f29,_0xf966ff){_0x4e6f29=_0x4e6f29-0x0;var _0x5796fa=_0x316d[_0x4e6f29];return _0x5796fa;};'use strict';var _=require(_0xd316('0x0'));var util=require(_0xd316('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd316('0x2'));var BPromise=require('bluebird');var rp=require(_0xd316('0x3'));var fs=require('fs');var path=require(_0xd316('0x4'));var rimraf=require(_0xd316('0x5'));var config=require(_0xd316('0x6'));var attributes=require(_0xd316('0x7'));module[_0xd316('0x8')]=function(_0x4eff9b,_0x556062){return _0x4eff9b[_0xd316('0x9')](_0xd316('0xa'),attributes,{'tableName':_0xd316('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd316('0xc'),'collate':_0xd316('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index db3f12f..812efe5 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 _0xefe2=['http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x223350,_0x2eefa8){var _0x3cd907=function(_0x52f80a){while(--_0x52f80a){_0x223350['push'](_0x223350['shift']());}};_0x3cd907(++_0x2eefa8);}(_0xefe2,0xe6));var _0x2efe=function(_0xdc19d4,_0x4afa8e){_0xdc19d4=_0xdc19d4-0x0;var _0x1e9ff9=_0xefe2[_0xdc19d4];return _0x1e9ff9;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require(_0x2efe('0x2'));var BPromise=require('bluebird');var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2efe('0x5'));var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require('../../config/environment');var jayson=require(_0x2efe('0x8'));var client=jayson[_0x2efe('0x9')][_0x2efe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372a0f,_0x3a57a4,_0x3fee21){return new BPromise(function(_0x4c535,_0x2c6425){return client['request'](_0x372a0f,_0x3fee21)[_0x2efe('0xb')](function(_0x14db58){logger['info'](_0x2efe('0xc'),_0x3a57a4,_0x2efe('0xd'));logger[_0x2efe('0xe')](_0x2efe('0xf'),_0x3a57a4,_0x2efe('0xd'),JSON[_0x2efe('0x10')](_0x14db58));if(_0x14db58[_0x2efe('0x11')]){if(_0x14db58[_0x2efe('0x11')][_0x2efe('0x12')]===0x1f4){logger[_0x2efe('0x11')]('MailApplication,\x20%s,\x20%s',_0x3a57a4,_0x14db58[_0x2efe('0x11')][_0x2efe('0x13')]);return _0x2c6425(_0x14db58[_0x2efe('0x11')]['message']);}logger[_0x2efe('0x11')](_0x2efe('0xc'),_0x3a57a4,_0x14db58['error'][_0x2efe('0x13')]);return _0x4c535(_0x14db58['error'][_0x2efe('0x13')]);}else{logger['info'](_0x2efe('0xc'),_0x3a57a4,_0x2efe('0xd'));_0x4c535(_0x14db58[_0x2efe('0x14')][_0x2efe('0x13')]);}})[_0x2efe('0x15')](function(_0x1eeae6){logger[_0x2efe('0x11')](_0x2efe('0xc'),_0x3a57a4,_0x1eeae6);_0x2c6425(_0x1eeae6);});});}exports[_0x2efe('0x16')]=function(_0x5aeb82){var _0x349013=this;return new Promise(function(_0xbafe5d,_0x412092){return db['MailApplication'][_0x2efe('0x17')](_0x5aeb82[_0x2efe('0x18')],{'raw':_0x5aeb82['options']?_0x5aeb82[_0x2efe('0x19')][_0x2efe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aeb82['options']?_0x5aeb82['options'][_0x2efe('0x1b')]||null:null,'attributes':_0x5aeb82['options']?_0x5aeb82[_0x2efe('0x19')][_0x2efe('0x1c')]||null:null,'limit':_0x5aeb82[_0x2efe('0x19')]?_0x5aeb82[_0x2efe('0x19')]['limit']||null:null})['then'](function(_0x461b27){logger[_0x2efe('0x1d')]('UpdateMailApplication',_0x5aeb82);logger['debug']('UpdateMailApplication',_0x5aeb82,JSON[_0x2efe('0x10')](_0x461b27));_0xbafe5d(_0x461b27);})[_0x2efe('0x15')](function(_0x3012fe){logger['error'](_0x2efe('0x16'),_0x3012fe['message'],_0x5aeb82);_0x412092(_0x349013[_0x2efe('0x11')](0x1f4,_0x3012fe['message']));});});}; \ No newline at end of file +var _0x484a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','debug','lodash','util'];(function(_0x352e4e,_0x5b5ded){var _0x466467=function(_0x243810){while(--_0x243810){_0x352e4e['push'](_0x352e4e['shift']());}};_0x466467(++_0x5b5ded);}(_0x484a,0x191));var _0xa484=function(_0x2ef387,_0x259289){_0x2ef387=_0x2ef387-0x0;var _0x33ab23=_0x484a[_0x2ef387];return _0x33ab23;};'use strict';var _=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var moment=require('moment');var BPromise=require(_0xa484('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa484('0x3'));var db=require(_0xa484('0x4'))['db'];var utils=require(_0xa484('0x5'));var logger=require(_0xa484('0x6'))('rpc');var config=require(_0xa484('0x7'));var jayson=require(_0xa484('0x8'));var client=jayson[_0xa484('0x9')][_0xa484('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4891d8,_0x3f0ed8,_0x47ce1a){return new BPromise(function(_0x184ff1,_0x24251d){return client[_0xa484('0xb')](_0x4891d8,_0x47ce1a)[_0xa484('0xc')](function(_0x58b1f3){logger[_0xa484('0xd')](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));logger['debug'](_0xa484('0x10'),_0x3f0ed8,'request\x20sent',JSON[_0xa484('0x11')](_0x58b1f3));if(_0x58b1f3[_0xa484('0x12')]){if(_0x58b1f3[_0xa484('0x12')]['code']===0x1f4){logger['error'](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3['error'][_0xa484('0x13')]);return _0x24251d(_0x58b1f3[_0xa484('0x12')]['message']);}logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x58b1f3[_0xa484('0x12')][_0xa484('0x13')]);return _0x184ff1(_0x58b1f3['error'][_0xa484('0x13')]);}else{logger['info'](_0xa484('0xe'),_0x3f0ed8,_0xa484('0xf'));_0x184ff1(_0x58b1f3[_0xa484('0x14')][_0xa484('0x13')]);}})[_0xa484('0x15')](function(_0x2a4c2a){logger[_0xa484('0x12')](_0xa484('0xe'),_0x3f0ed8,_0x2a4c2a);_0x24251d(_0x2a4c2a);});});}exports[_0xa484('0x16')]=function(_0x1cbf63){var _0x3f37b4=this;return new Promise(function(_0x3164f8,_0x46f5ee){return db[_0xa484('0x17')][_0xa484('0x18')](_0x1cbf63['body'],{'raw':_0x1cbf63[_0xa484('0x19')]?_0x1cbf63[_0xa484('0x19')][_0xa484('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbf63['options']?_0x1cbf63[_0xa484('0x19')][_0xa484('0x1b')]||null:null,'attributes':_0x1cbf63[_0xa484('0x19')]?_0x1cbf63['options'][_0xa484('0x1c')]||null:null,'limit':_0x1cbf63[_0xa484('0x19')]?_0x1cbf63[_0xa484('0x19')][_0xa484('0x1d')]||null:null})[_0xa484('0xc')](function(_0x42a8b5){logger['info'](_0xa484('0x16'),_0x1cbf63);logger[_0xa484('0x1e')]('UpdateMailApplication',_0x1cbf63,JSON[_0xa484('0x11')](_0x42a8b5));_0x3164f8(_0x42a8b5);})['catch'](function(_0x19410c){logger[_0xa484('0x12')](_0xa484('0x16'),_0x19410c['message'],_0x1cbf63);_0x46f5ee(_0x3f37b4[_0xa484('0x12')](0x1f4,_0x19410c[_0xa484('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ca466c5..d957e15 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 _0x5ce4=['show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x3d732e,_0x461f7a){var _0x2c0b04=function(_0x23d24a){while(--_0x23d24a){_0x3d732e['push'](_0x3d732e['shift']());}};_0x2c0b04(++_0x461f7a);}(_0x5ce4,0xbc));var _0x45ce=function(_0x3ba69c,_0x3e370c){_0x3ba69c=_0x3ba69c-0x0;var _0x1c722b=_0x5ce4[_0x3ba69c];return _0x1c722b;};'use strict';var express=require(_0x45ce('0x0'));var router=express['Router']();var auth=require(_0x45ce('0x1'));var interaction=require(_0x45ce('0x2'));var controller=require('./mailInteraction.controller');router[_0x45ce('0x3')]('/',auth[_0x45ce('0x4')](),controller[_0x45ce('0x5')]);router[_0x45ce('0x3')](_0x45ce('0x6'),auth['isAuthenticated'](),controller[_0x45ce('0x7')]);router[_0x45ce('0x3')]('/:id',auth[_0x45ce('0x4')](),controller[_0x45ce('0x8')]);router[_0x45ce('0x3')](_0x45ce('0x9'),auth[_0x45ce('0x4')](),controller[_0x45ce('0xa')]);router['get']('/:id/download',auth[_0x45ce('0x4')](),controller[_0x45ce('0xb')]);router[_0x45ce('0xc')]('/',auth['isAuthenticated'](),controller[_0x45ce('0xd')]);router['post'](_0x45ce('0x9'),auth[_0x45ce('0x4')](),controller['addMessage']);router[_0x45ce('0xc')](_0x45ce('0xe'),auth['isAuthenticated'](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x11')),controller[_0x45ce('0x12')]);router[_0x45ce('0x13')]('/:id',auth[_0x45ce('0x4')](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x14')),controller[_0x45ce('0x15')]);router[_0x45ce('0x16')](_0x45ce('0x17'),auth[_0x45ce('0x4')](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x18')),controller[_0x45ce('0x19')]);router[_0x45ce('0x16')](_0x45ce('0xe'),auth[_0x45ce('0x4')](),controller[_0x45ce('0x1a')]);module[_0x45ce('0x1b')]=router; \ No newline at end of file +var _0xf03a=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','mail','mailinteraction:addtags','put','update','tracked','mailinteraction:destroy','destroy','delete','removeTags'];(function(_0x5998c2,_0x5a6def){var _0xe2ba4c=function(_0x1c8b80){while(--_0x1c8b80){_0x5998c2['push'](_0x5998c2['shift']());}};_0xe2ba4c(++_0x5a6def);}(_0xf03a,0x106));var _0xaf03=function(_0xb97339,_0x1c4346){_0xb97339=_0xb97339-0x0;var _0x2012cb=_0xf03a[_0xb97339];return _0x2012cb;};'use strict';var express=require(_0xaf03('0x0'));var router=express[_0xaf03('0x1')]();var auth=require(_0xaf03('0x2'));var interaction=require(_0xaf03('0x3'));var controller=require(_0xaf03('0x4'));router[_0xaf03('0x5')]('/',auth[_0xaf03('0x6')](),controller['index']);router[_0xaf03('0x5')](_0xaf03('0x7'),auth['isAuthenticated'](),controller[_0xaf03('0x8')]);router[_0xaf03('0x5')](_0xaf03('0x9'),auth[_0xaf03('0x6')](),controller[_0xaf03('0xa')]);router[_0xaf03('0x5')]('/:id/messages',auth[_0xaf03('0x6')](),controller[_0xaf03('0xb')]);router['get'](_0xaf03('0xc'),auth[_0xaf03('0x6')](),controller[_0xaf03('0xd')]);router[_0xaf03('0xe')]('/',auth[_0xaf03('0x6')](),controller[_0xaf03('0xf')]);router[_0xaf03('0xe')](_0xaf03('0x10'),auth[_0xaf03('0x6')](),controller[_0xaf03('0x11')]);router[_0xaf03('0xe')](_0xaf03('0x12'),auth[_0xaf03('0x6')](),interaction['tracked'](_0xaf03('0x13'),_0xaf03('0x14')),controller['addTags']);router[_0xaf03('0x15')](_0xaf03('0x9'),auth[_0xaf03('0x6')](),interaction['tracked'](_0xaf03('0x13'),'mailinteraction:update'),controller[_0xaf03('0x16')]);router['delete'](_0xaf03('0x9'),auth[_0xaf03('0x6')](),interaction[_0xaf03('0x17')](_0xaf03('0x13'),_0xaf03('0x18')),controller[_0xaf03('0x19')]);router[_0xaf03('0x1a')](_0xaf03('0x12'),auth[_0xaf03('0x6')](),controller[_0xaf03('0x1b')]);module[_0xaf03('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1396907..257243c 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 _0x52f9=['sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out'];(function(_0x282186,_0x433534){var _0x445ef5=function(_0x410099){while(--_0x410099){_0x282186['push'](_0x282186['shift']());}};_0x445ef5(++_0x433534);}(_0x52f9,0x6c));var _0x952f=function(_0x3dcfd2,_0x3bf173){_0x3dcfd2=_0x3dcfd2-0x0;var _0x254a7b=_0x52f9[_0x3dcfd2];return _0x254a7b;};'use strict';var Sequelize=require(_0x952f('0x0'));var iconv=require(_0x952f('0x1'));module[_0x952f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x952f('0x3')]},'disposition':{'type':Sequelize[_0x952f('0x4')]},'secondDisposition':{'type':Sequelize[_0x952f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x952f('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x952f('0x5')]('long')},'subject':{'type':Sequelize[_0x952f('0x5')]()},'attach':{'type':Sequelize[_0x952f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x952f('0x3')]},'substatus':{'type':Sequelize[_0x952f('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x952f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x952f('0x7')]('in',_0x952f('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x952f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x952f('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x952f('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9984=['sequelize','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','INTEGER'];(function(_0x9bca53,_0x59b4f8){var _0x3894bc=function(_0x1ae67d){while(--_0x1ae67d){_0x9bca53['push'](_0x9bca53['shift']());}};_0x3894bc(++_0x59b4f8);}(_0x9984,0x195));var _0x4998=function(_0x4e6668,_0x183346){_0x4e6668=_0x4e6668-0x0;var _0x500bde=_0x9984[_0x4e6668];return _0x500bde;};'use strict';var Sequelize=require(_0x4998('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x4998('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4998('0x2')]},'disposition':{'type':Sequelize[_0x4998('0x3')]},'secondDisposition':{'type':Sequelize[_0x4998('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4998('0x3')]},'note':{'type':Sequelize[_0x4998('0x3')]},'inReplyTo':{'type':Sequelize[_0x4998('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4998('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x4998('0x4'))},'subject':{'type':Sequelize[_0x4998('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4998('0x2')]},'substatus':{'type':Sequelize[_0x4998('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4998('0x6')]('in',_0x4998('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4998('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4998('0x6')]('in',_0x4998('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4998('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4998('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 601c9b3..2211615 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 _0xb29a=['key','getOptions','findAll','mail','query','user','catch','params','keys','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','body','describe','MailMessage','addMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','download','toString','join','server','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type'];(function(_0x4caeab,_0x5177c9){var _0x1ed98d=function(_0x5d404d){while(--_0x5d404d){_0x4caeab['push'](_0x4caeab['shift']());}};_0x1ed98d(++_0x5177c9);}(_0xb29a,0x13a));var _0xab29=function(_0x265b25,_0x437f9c){_0x265b25=_0x265b25-0x0;var _0x4c9807=_0xb29a[_0x265b25];return _0x4c9807;};'use strict';var emlformat=require(_0xab29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab29('0x1'));var moment=require(_0xab29('0x2'));var BPromise=require(_0xab29('0x3'));var util=require(_0xab29('0x4'));var path=require(_0xab29('0x5'));var fs=require('fs');var _=require(_0xab29('0x6'));var juice=require(_0xab29('0x7'));var Redis=require(_0xab29('0x8'));var interaction=require(_0xab29('0x9'));var qs=require(_0xab29('0xa'));var logger=require(_0xab29('0xb'))(_0xab29('0xc'));var config=require(_0xab29('0xd'));var db=require(_0xab29('0xe'))['db'];var htmlEntities=require('html-entities');config[_0xab29('0xf')]=_[_0xab29('0x10')](config[_0xab29('0xf')],{'host':_0xab29('0x11'),'port':0x18eb});var socket=require(_0xab29('0x12'))(new Redis(config[_0xab29('0xf')]));require(_0xab29('0x13'))[_0xab29('0x14')](socket);function respondWithStatusCode(_0x48a93b,_0x54f4ba){_0x54f4ba=_0x54f4ba||0xcc;return function(_0x2ed06a){if(_0x2ed06a){return _0x48a93b[_0xab29('0x15')](_0x54f4ba);}return _0x48a93b[_0xab29('0x16')](_0x54f4ba)['end']();};}function respondWithResult(_0x287e0d,_0xfb570b){_0xfb570b=_0xfb570b||0xc8;return function(_0x37581b){if(_0x37581b){return _0x287e0d['status'](_0xfb570b)['json'](_0x37581b);}};}function respondWithFilteredResult(_0x4d7819,_0x5afe9e){return function(_0x433f5b){if(_0x433f5b){var _0x4094d9=typeof _0x5afe9e[_0xab29('0x17')]==='undefined'&&typeof _0x5afe9e[_0xab29('0x18')]===_0xab29('0x19');var _0x260110=_0x433f5b[_0xab29('0x1a')];var _0x1f6239=_0x4094d9?0x0:_0x5afe9e[_0xab29('0x17')];var _0x30eaa9=_0x4094d9?_0x433f5b['count']:_0x5afe9e[_0xab29('0x17')]+_0x5afe9e['limit'];var _0x83e14c;if(_0x30eaa9>=_0x260110){_0x30eaa9=_0x260110;_0x83e14c=0xc8;}else{_0x83e14c=0xce;}_0x4d7819['status'](_0x83e14c);return _0x4d7819[_0xab29('0x1b')](_0xab29('0x1c'),_0x1f6239+'-'+_0x30eaa9+'/'+_0x260110)['json'](_0x433f5b);}return null;};}function saveUpdates(_0x8d4e1c){return function(_0x5be690){if(_0x5be690){return _0x5be690[_0xab29('0x1d')](_0x8d4e1c)[_0xab29('0x1e')](function(_0x39a397){return _0x39a397;});}return null;};}function removeEntity(_0x1ba0ff){return function(_0x1e703c){if(_0x1e703c){return _0x1e703c[_0xab29('0x1f')]()[_0xab29('0x1e')](function(){_0x1ba0ff[_0xab29('0x16')](0xcc)[_0xab29('0x20')]();});}};}function handleEntityNotFound(_0x38dcaf){return function(_0x109dce){if(!_0x109dce){_0x38dcaf[_0xab29('0x15')](0x194);}return _0x109dce;};}function handleError(_0x20317a,_0x298c0b){_0x298c0b=_0x298c0b||0x1f4;return function(_0x62c0d9){logger[_0xab29('0x21')](_0x62c0d9[_0xab29('0x22')]);if(_0x62c0d9[_0xab29('0x23')]){delete _0x62c0d9[_0xab29('0x23')];}_0x20317a['status'](_0x298c0b)[_0xab29('0x24')](_0x62c0d9);};}exports[_0xab29('0x25')]=function(_0x218a7f,_0x2f5e43){var _0x38d89e={};var _0x424b6c=_[_0xab29('0x26')](db[_0xab29('0x27')][_0xab29('0x28')],function(_0x472ba9){return{'name':_0x472ba9[_0xab29('0x29')],'type':_0x472ba9[_0xab29('0x2a')][_0xab29('0x2b')]};});_0x38d89e=qs[_0xab29('0x2c')](_0x424b6c,_0x218a7f);return interaction[_0xab29('0x2d')](_0xab29('0x2e'),_0x218a7f[_0xab29('0x2f')],_0x218a7f[_0xab29('0x30')],_0x38d89e,_0x424b6c)[_0xab29('0x1e')](respondWithFilteredResult(_0x2f5e43,_0x38d89e))[_0xab29('0x31')](handleError(_0x2f5e43,null));};exports['show']=function(_0x43a930,_0x3b32f4){var _0x20da80={'raw':![],'where':{'id':_0x43a930[_0xab29('0x32')]['id']}},_0x486a54={};_0x486a54['model']=_[_0xab29('0x33')](db[_0xab29('0x27')][_0xab29('0x28')]);_0x486a54[_0xab29('0x2f')]=_[_0xab29('0x33')](_0x43a930[_0xab29('0x2f')]);_0x486a54[_0xab29('0x34')]=_[_0xab29('0x35')](_0x486a54[_0xab29('0x36')],_0x486a54[_0xab29('0x2f')]);_0x20da80[_0xab29('0x37')]=_['intersection'](_0x486a54[_0xab29('0x36')],qs['fields'](_0x43a930[_0xab29('0x2f')][_0xab29('0x38')]));_0x20da80[_0xab29('0x37')]=_0x20da80[_0xab29('0x37')][_0xab29('0x39')]?_0x20da80[_0xab29('0x37')]:_0x486a54[_0xab29('0x36')];if(_0x43a930['query']['includeAll']){_0x20da80[_0xab29('0x3a')]=[{'all':!![]}];}_0x20da80=_[_0xab29('0x3b')]({},_0x20da80,_0x43a930[_0xab29('0x3c')]);return db['MailInteraction'][_0xab29('0x3d')](_0x20da80)[_0xab29('0x1e')](handleEntityNotFound(_0x3b32f4,null))[_0xab29('0x1e')](respondWithResult(_0x3b32f4,null))[_0xab29('0x31')](handleError(_0x3b32f4,null));};exports[_0xab29('0x3e')]=function(_0x5ab7a3,_0xdd6e65){return db['MailInteraction'][_0xab29('0x3e')](_0x5ab7a3[_0xab29('0x3f')],{})['then'](respondWithResult(_0xdd6e65,0xc9))[_0xab29('0x31')](handleError(_0xdd6e65,null));};exports[_0xab29('0x1d')]=function(_0x46ef33,_0x1dd137){if(_0x46ef33[_0xab29('0x3f')]['id']){delete _0x46ef33[_0xab29('0x3f')]['id'];}return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x46ef33[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x1dd137,null))[_0xab29('0x1e')](saveUpdates(_0x46ef33['body'],null))[_0xab29('0x1e')](respondWithResult(_0x1dd137,null))['catch'](handleError(_0x1dd137,null));};exports[_0xab29('0x1f')]=function(_0x15c7ca,_0x595ee6){return db['MailInteraction'][_0xab29('0x3d')]({'where':{'id':_0x15c7ca[_0xab29('0x32')]['id']}})['then'](handleEntityNotFound(_0x595ee6,null))[_0xab29('0x1e')](removeEntity(_0x595ee6,null))[_0xab29('0x31')](handleError(_0x595ee6,null));};exports[_0xab29('0x40')]=function(_0x133651,_0x38d747){return db[_0xab29('0x27')]['describe']()['then'](respondWithResult(_0x38d747,null))['catch'](handleError(_0x38d747,null));};exports['addMessage']=function(_0x49ad2d,_0x3f7a1e){return db[_0xab29('0x41')]['find']({'where':{'id':_0x49ad2d['params']['id']}})['then'](handleEntityNotFound(_0x3f7a1e,null))[_0xab29('0x1e')](function(_0x591321){if(_0x591321){return _0x591321[_0xab29('0x42')](_0x49ad2d[_0xab29('0x3f')][_0xab29('0x43')],_['omit'](_0x49ad2d[_0xab29('0x3f')],['ids','id'])||{});}})[_0xab29('0x1e')](respondWithResult(_0x3f7a1e,null))[_0xab29('0x31')](handleError(_0x3f7a1e,null));};exports[_0xab29('0x44')]=function(_0x4bc13a,_0x10ad35){var _0x48e003={'raw':![],'where':{}};var _0x450a2b={};var _0xa898cb={'count':0x0,'rows':[]};return db[_0xab29('0x27')][_0xab29('0x45')]({'where':{'id':_0x4bc13a[_0xab29('0x32')]['id']}})['then'](handleEntityNotFound(_0x10ad35,null))['then'](function(_0x31a0f1){if(_0x31a0f1){_0x450a2b[_0xab29('0x36')]=_[_0xab29('0x33')](db[_0xab29('0x41')][_0xab29('0x28')]);_0x450a2b[_0xab29('0x2f')]=_[_0xab29('0x33')](_0x4bc13a[_0xab29('0x2f')]);_0x450a2b['filters']=_[_0xab29('0x35')](_0x450a2b[_0xab29('0x36')],_0x450a2b['query']);_0x48e003['attributes']=_[_0xab29('0x35')](_0x450a2b[_0xab29('0x36')],qs[_0xab29('0x38')](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x38')]));_0x48e003[_0xab29('0x37')]=_0x48e003['attributes'][_0xab29('0x39')]?_0x48e003[_0xab29('0x37')]:_0x450a2b[_0xab29('0x36')];if(!_0x4bc13a[_0xab29('0x2f')]['hasOwnProperty'](_0xab29('0x46'))){_0x48e003['limit']=qs['limit'](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x18')]);_0x48e003[_0xab29('0x17')]=qs[_0xab29('0x17')](_0x4bc13a[_0xab29('0x2f')]['offset']);}_0x48e003[_0xab29('0x47')]=qs['sort'](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x48')]);_0x48e003[_0xab29('0x49')]=qs[_0xab29('0x34')](_[_0xab29('0x4a')](_0x4bc13a[_0xab29('0x2f')],_0x450a2b['filters']));_0x48e003[_0xab29('0x49')][_0xab29('0x4b')]=_0x31a0f1['id'];if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4c')]){_0x48e003[_0xab29('0x49')]=_[_0xab29('0x3b')](_0x48e003[_0xab29('0x49')],{'$or':_['map'](_0x48e003[_0xab29('0x37')],function(_0x457f0e){var _0x14e1c8={};_0x14e1c8[_0x457f0e]={'$like':'%'+_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4c')]+'%'};return _0x14e1c8;})});}if(_0x4bc13a['query'][_0xab29('0x4d')]){var _0x1b97ff=_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4d')][_0xab29('0x4e')](',');var _0x7553a7={};_0x7553a7[_0x1b97ff[0x0]]={'$gte':moment(_0x1b97ff[0x1])[_0xab29('0x4f')](_0xab29('0x50'))};_0x48e003[_0xab29('0x49')]=_[_0xab29('0x3b')](_0x48e003[_0xab29('0x49')],_0x7553a7);}_0x48e003=_[_0xab29('0x3b')]({},_0x48e003,_0x4bc13a[_0xab29('0x3c')]);return db[_0xab29('0x41')][_0xab29('0x1a')]({'where':_0x48e003[_0xab29('0x49')]})[_0xab29('0x1e')](function(_0x46fe4b){_0xa898cb[_0xab29('0x1a')]=_0x46fe4b;if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x51')]){_0x48e003['include']=[{'all':!![]}];}return db['MailMessage'][_0xab29('0x2d')](_0x48e003);})['then'](function(_0x59e702){if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x52')]===_0xab29('0x53')){for(var _0x18e3e3=0x0;_0x18e3e3<_0x59e702[_0xab29('0x39')];_0x18e3e3++){_0x59e702[_0x18e3e3][_0xab29('0x3f')]=juice(_0x59e702[_0x18e3e3][_0xab29('0x3f')]);}}_0xa898cb['rows']=_0x59e702;return _0xa898cb;});}})[_0xab29('0x1e')](respondWithFilteredResult(_0x10ad35,_0x48e003))[_0xab29('0x31')](handleError(_0x10ad35,null));};exports['addTags']=function(_0x364d90,_0x3ddf1c){return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x364d90[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x3ddf1c,null))[_0xab29('0x1e')](function(_0x52eca6){if(_0x52eca6){return _0x52eca6[_0xab29('0x54')](_0x364d90[_0xab29('0x3f')][_0xab29('0x43')],_[_0xab29('0x55')](_0x364d90[_0xab29('0x3f')],[_0xab29('0x43'),'id'])||{})[_0xab29('0x56')](function(){return db['Tag'][_0xab29('0x2d')]({'attributes':['id',_0xab29('0x23'),_0xab29('0x57')],'where':{'id':_0x364d90[_0xab29('0x3f')][_0xab29('0x43')]}});})['then'](function(_0xa1e85e){socket[_0xab29('0x58')](_0xab29('0x59'),{'id':Number(_0x364d90[_0xab29('0x32')]['id']),'tags':_0xa1e85e||[]});return{'id':Number(_0x364d90[_0xab29('0x32')]['id']),'tags':_0xa1e85e||[]};});}})[_0xab29('0x1e')](respondWithResult(_0x3ddf1c,null))[_0xab29('0x31')](handleError(_0x3ddf1c,null));};exports[_0xab29('0x5a')]=function(_0x59206d,_0x1634b1){return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x59206d[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x1634b1,null))[_0xab29('0x1e')](function(_0x2af15a){if(_0x2af15a){return _0x2af15a[_0xab29('0x5a')](_0x59206d[_0xab29('0x2f')][_0xab29('0x43')]);}})[_0xab29('0x1e')](respondWithStatusCode(_0x1634b1,null))[_0xab29('0x31')](handleError(_0x1634b1,null));};exports[_0xab29('0x5b')]=function(_0x5d0b85,_0x983029){var _0x342004=moment()['unix']()[_0xab29('0x5c')]();var _0x4670a2=path[_0xab29('0x5d')](config['root'],_0xab29('0x5e'),'files','tmp');var _0x146c88=path[_0xab29('0x5d')](config[_0xab29('0x5f')],_0xab29('0x5e'),_0xab29('0x60'),_0xab29('0x61'));var _0x992dcc=path[_0xab29('0x5d')](_0x4670a2,_0x342004);var _0x11fed4=util[_0xab29('0x4f')](_0xab29('0x62'),_0x5d0b85[_0xab29('0x32')]['id'],_0x342004);var _0x49a34c=path['join'](_0x4670a2,_0x11fed4);var _0x57b118=[];if(_0x5d0b85[_0xab29('0x2f')][_0xab29('0x61')]){_0x57b118[_0xab29('0x63')]({'model':db[_0xab29('0x64')],'as':'Attachments','raw':!![]});}var _0x395ee3=[{'model':db['MailMessage'],'as':_0xab29('0x65'),'attributes':['id','body',_0xab29('0x66'),'to','cc','bcc',_0xab29('0x67'),_0xab29('0x68')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b118}];return db['MailInteraction'][_0xab29('0x3d')]({'where':{'id':_0x5d0b85['params']['id']},'include':_0x395ee3})[_0xab29('0x1e')](handleEntityNotFound(_0x983029,null))['then'](function(_0x594d6d){if(_0x594d6d&&_0x594d6d[_0xab29('0x65')]){var _0x3b32ae=_0x594d6d[_0xab29('0x69')]({'plain':!![]});fs[_0xab29('0x6a')](_0x992dcc);return BPromise['each'](_0x3b32ae[_0xab29('0x65')],function(_0x272cb1,_0x243c7f){var _0x2c0940={'from':_0x272cb1['from'],'to':_0x272cb1['to']||_0xab29('0x6b'),'subject':_0x272cb1[_0xab29('0x67')],'html':htmlEntities[_0xab29('0x6c')](_0x272cb1[_0xab29('0x3f')]),'headers':{'Date':moment(_0x272cb1[_0xab29('0x68')])[_0xab29('0x4f')](_0xab29('0x6d'))},'attachments':[]};if(_0x272cb1['cc']){_0x2c0940['headers']['Cc']=_0x272cb1['cc'];}if(_0x272cb1[_0xab29('0x6e')]){_0x2c0940['headers'][_0xab29('0x6f')]=_0x272cb1[_0xab29('0x6e')];}return new BPromise(function(_0x31c026,_0x10acf1){if(_0x272cb1[_0xab29('0x70')]){for(var _0x3815a3=0x0;_0x3815a3<_0x272cb1[_0xab29('0x70')][_0xab29('0x39')];_0x3815a3++){var _0x8a6a5c=_0x272cb1[_0xab29('0x70')][_0x3815a3];var _0x4512e8=path['join'](_0x146c88,_0x8a6a5c[_0xab29('0x71')]);if(fs[_0xab29('0x72')](_0x4512e8)){_0x2c0940[_0xab29('0x61')]['push']({'name':_0x8a6a5c['name'],'contentType':_0x8a6a5c[_0xab29('0x2a')],'data':fs[_0xab29('0x73')](_0x4512e8)});}}}emlformat[_0xab29('0x74')](_0x2c0940,function(_0x255183,_0x3b1e1b){if(_0x255183)return _0x10acf1(_0x255183);fs['writeFileSync'](path[_0xab29('0x5d')](_0x992dcc,util[_0xab29('0x4f')](_0xab29('0x75'),_0x243c7f)),_0x3b1e1b);return _0x31c026(_0x3b1e1b);});});})[_0xab29('0x1e')](function(){return new BPromise(function(_0x256e94,_0x4e4aaa){zipdir(_0x992dcc,{'saveTo':_0x49a34c},function(_0x36e8a8,_0x2365b7){if(_0x36e8a8)return _0x4e4aaa(_0x36e8a8);return _0x256e94(_0x2365b7);});})[_0xab29('0x1e')](function(){return new BPromise(function(_0x5a5fe1,_0x222e88){rimraf(_0x992dcc,function(_0x280afa){if(_0x280afa)_0x222e88(_0x280afa);return _0x5a5fe1();});});})[_0xab29('0x1e')](function(){return _0x983029['download'](_0x49a34c,_0x11fed4,function(_0x1599ac){if(!_0x1599ac)fs[_0xab29('0x76')](_0x49a34c);});});});}else{return _0x983029[_0xab29('0x15')](0xc8);}})['catch'](handleError(_0x983029,null));}; \ No newline at end of file +var _0x36c0=['bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','update','destroy','then','end','error','stack','name','index','map','fieldName','type','key','getOptions','findAll','query','user','catch','model','keys','rawAttributes','filters','intersection','attributes','fields','includeAll','include','MailInteraction','find','create','body','params','describe','addMessage','ids','omit','findOne','MailMessage','length','order','sort','where','filter','$gte','split','format','merge','options','inlineCss','true','rows','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','server','files','join','root','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','attachments','build','writeFileSync','message%d.eml','unlinkSync','sendStatus','zip-dir','moment'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0x36c0,0xdc));var _0x036c=function(_0x2451d2,_0x388dc5){_0x2451d2=_0x2451d2-0x0;var _0x3ce9fe=_0x36c0[_0x2451d2];return _0x3ce9fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x036c('0x0'));var moment=require(_0x036c('0x1'));var BPromise=require(_0x036c('0x2'));var util=require(_0x036c('0x3'));var path=require(_0x036c('0x4'));var fs=require('fs');var _=require(_0x036c('0x5'));var juice=require(_0x036c('0x6'));var Redis=require(_0x036c('0x7'));var interaction=require(_0x036c('0x8'));var qs=require(_0x036c('0x9'));var logger=require('../../config/logger')(_0x036c('0xa'));var config=require(_0x036c('0xb'));var db=require(_0x036c('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x036c('0xd')]=_['defaults'](config[_0x036c('0xd')],{'host':_0x036c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x036c('0xd')]));require(_0x036c('0xf'))[_0x036c('0x10')](socket);function respondWithStatusCode(_0x501838,_0x1e7f6b){_0x1e7f6b=_0x1e7f6b||0xcc;return function(_0xa3ec32){if(_0xa3ec32){return _0x501838['sendStatus'](_0x1e7f6b);}return _0x501838[_0x036c('0x11')](_0x1e7f6b)['end']();};}function respondWithResult(_0x34206f,_0x55643b){_0x55643b=_0x55643b||0xc8;return function(_0x3bf91a){if(_0x3bf91a){return _0x34206f[_0x036c('0x11')](_0x55643b)[_0x036c('0x12')](_0x3bf91a);}};}function respondWithFilteredResult(_0x347683,_0x3055c7){return function(_0x3cd1ca){if(_0x3cd1ca){var _0x3f83db=typeof _0x3055c7[_0x036c('0x13')]===_0x036c('0x14')&&typeof _0x3055c7[_0x036c('0x15')]===_0x036c('0x14');var _0x58655f=_0x3cd1ca[_0x036c('0x16')];var _0x8515c8=_0x3f83db?0x0:_0x3055c7[_0x036c('0x13')];var _0x44e835=_0x3f83db?_0x3cd1ca[_0x036c('0x16')]:_0x3055c7[_0x036c('0x13')]+_0x3055c7['limit'];var _0x586196;if(_0x44e835>=_0x58655f){_0x44e835=_0x58655f;_0x586196=0xc8;}else{_0x586196=0xce;}_0x347683[_0x036c('0x11')](_0x586196);return _0x347683[_0x036c('0x17')]('Content-Range',_0x8515c8+'-'+_0x44e835+'/'+_0x58655f)[_0x036c('0x12')](_0x3cd1ca);}return null;};}function saveUpdates(_0x1b2a0d){return function(_0x1ef05f){if(_0x1ef05f){return _0x1ef05f[_0x036c('0x18')](_0x1b2a0d)['then'](function(_0x43b89e){return _0x43b89e;});}return null;};}function removeEntity(_0x53c7de){return function(_0x413e22){if(_0x413e22){return _0x413e22[_0x036c('0x19')]()[_0x036c('0x1a')](function(){_0x53c7de[_0x036c('0x11')](0xcc)[_0x036c('0x1b')]();});}};}function handleEntityNotFound(_0x23ffc3){return function(_0xd9c006){if(!_0xd9c006){_0x23ffc3['sendStatus'](0x194);}return _0xd9c006;};}function handleError(_0x1603d0,_0x571e9e){_0x571e9e=_0x571e9e||0x1f4;return function(_0x14cc71){logger[_0x036c('0x1c')](_0x14cc71[_0x036c('0x1d')]);if(_0x14cc71[_0x036c('0x1e')]){delete _0x14cc71[_0x036c('0x1e')];}_0x1603d0[_0x036c('0x11')](_0x571e9e)['send'](_0x14cc71);};}exports[_0x036c('0x1f')]=function(_0x502580,_0x4af8ef){var _0x3e9840={};var _0x3de1c8=_[_0x036c('0x20')](db['MailInteraction']['rawAttributes'],function(_0x2e7dff){return{'name':_0x2e7dff[_0x036c('0x21')],'type':_0x2e7dff[_0x036c('0x22')][_0x036c('0x23')]};});_0x3e9840=qs[_0x036c('0x24')](_0x3de1c8,_0x502580);return interaction[_0x036c('0x25')]('mail',_0x502580[_0x036c('0x26')],_0x502580[_0x036c('0x27')],_0x3e9840,_0x3de1c8)[_0x036c('0x1a')](respondWithFilteredResult(_0x4af8ef,_0x3e9840))[_0x036c('0x28')](handleError(_0x4af8ef,null));};exports['show']=function(_0xbfecbc,_0x1277aa){var _0xfe4ff0={'raw':![],'where':{'id':_0xbfecbc['params']['id']}},_0x385b53={};_0x385b53[_0x036c('0x29')]=_[_0x036c('0x2a')](db['MailInteraction'][_0x036c('0x2b')]);_0x385b53[_0x036c('0x26')]=_['keys'](_0xbfecbc['query']);_0x385b53[_0x036c('0x2c')]=_[_0x036c('0x2d')](_0x385b53[_0x036c('0x29')],_0x385b53[_0x036c('0x26')]);_0xfe4ff0[_0x036c('0x2e')]=_['intersection'](_0x385b53[_0x036c('0x29')],qs['fields'](_0xbfecbc['query'][_0x036c('0x2f')]));_0xfe4ff0[_0x036c('0x2e')]=_0xfe4ff0[_0x036c('0x2e')]['length']?_0xfe4ff0[_0x036c('0x2e')]:_0x385b53[_0x036c('0x29')];if(_0xbfecbc[_0x036c('0x26')][_0x036c('0x30')]){_0xfe4ff0[_0x036c('0x31')]=[{'all':!![]}];}_0xfe4ff0=_['merge']({},_0xfe4ff0,_0xbfecbc['options']);return db[_0x036c('0x32')][_0x036c('0x33')](_0xfe4ff0)[_0x036c('0x1a')](handleEntityNotFound(_0x1277aa,null))[_0x036c('0x1a')](respondWithResult(_0x1277aa,null))[_0x036c('0x28')](handleError(_0x1277aa,null));};exports[_0x036c('0x34')]=function(_0x31fbb4,_0x1924c7){return db[_0x036c('0x32')][_0x036c('0x34')](_0x31fbb4['body'],{})[_0x036c('0x1a')](respondWithResult(_0x1924c7,0xc9))[_0x036c('0x28')](handleError(_0x1924c7,null));};exports[_0x036c('0x18')]=function(_0x24f42b,_0x18f373){if(_0x24f42b['body']['id']){delete _0x24f42b[_0x036c('0x35')]['id'];}return db[_0x036c('0x32')][_0x036c('0x33')]({'where':{'id':_0x24f42b['params']['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0x18f373,null))[_0x036c('0x1a')](saveUpdates(_0x24f42b['body'],null))[_0x036c('0x1a')](respondWithResult(_0x18f373,null))[_0x036c('0x28')](handleError(_0x18f373,null));};exports['destroy']=function(_0x503f31,_0x58b6b9){return db[_0x036c('0x32')][_0x036c('0x33')]({'where':{'id':_0x503f31[_0x036c('0x36')]['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0x58b6b9,null))[_0x036c('0x1a')](removeEntity(_0x58b6b9,null))[_0x036c('0x28')](handleError(_0x58b6b9,null));};exports[_0x036c('0x37')]=function(_0x5e3c01,_0x4bcc3c){return db[_0x036c('0x32')][_0x036c('0x37')]()[_0x036c('0x1a')](respondWithResult(_0x4bcc3c,null))[_0x036c('0x28')](handleError(_0x4bcc3c,null));};exports[_0x036c('0x38')]=function(_0x53464b,_0xab9c7){return db['MailMessage'][_0x036c('0x33')]({'where':{'id':_0x53464b[_0x036c('0x36')]['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0xab9c7,null))['then'](function(_0x12246d){if(_0x12246d){return _0x12246d['addMessage'](_0x53464b[_0x036c('0x35')][_0x036c('0x39')],_[_0x036c('0x3a')](_0x53464b[_0x036c('0x35')],[_0x036c('0x39'),'id'])||{});}})[_0x036c('0x1a')](respondWithResult(_0xab9c7,null))['catch'](handleError(_0xab9c7,null));};exports['getMessages']=function(_0x391f6,_0x428c75){var _0x5ae258={'raw':![],'where':{}};var _0x3eb92a={};var _0x48384c={'count':0x0,'rows':[]};return db[_0x036c('0x32')][_0x036c('0x3b')]({'where':{'id':_0x391f6[_0x036c('0x36')]['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0x428c75,null))[_0x036c('0x1a')](function(_0x4e6728){if(_0x4e6728){_0x3eb92a[_0x036c('0x29')]=_['keys'](db[_0x036c('0x3c')][_0x036c('0x2b')]);_0x3eb92a[_0x036c('0x26')]=_[_0x036c('0x2a')](_0x391f6['query']);_0x3eb92a[_0x036c('0x2c')]=_[_0x036c('0x2d')](_0x3eb92a[_0x036c('0x29')],_0x3eb92a[_0x036c('0x26')]);_0x5ae258['attributes']=_[_0x036c('0x2d')](_0x3eb92a[_0x036c('0x29')],qs[_0x036c('0x2f')](_0x391f6['query'][_0x036c('0x2f')]));_0x5ae258['attributes']=_0x5ae258[_0x036c('0x2e')][_0x036c('0x3d')]?_0x5ae258[_0x036c('0x2e')]:_0x3eb92a[_0x036c('0x29')];if(!_0x391f6[_0x036c('0x26')]['hasOwnProperty']('nolimit')){_0x5ae258[_0x036c('0x15')]=qs['limit'](_0x391f6[_0x036c('0x26')][_0x036c('0x15')]);_0x5ae258[_0x036c('0x13')]=qs[_0x036c('0x13')](_0x391f6[_0x036c('0x26')][_0x036c('0x13')]);}_0x5ae258[_0x036c('0x3e')]=qs[_0x036c('0x3f')](_0x391f6[_0x036c('0x26')][_0x036c('0x3f')]);_0x5ae258[_0x036c('0x40')]=qs[_0x036c('0x2c')](_['pick'](_0x391f6['query'],_0x3eb92a[_0x036c('0x2c')]));_0x5ae258[_0x036c('0x40')]['MailInteractionId']=_0x4e6728['id'];if(_0x391f6[_0x036c('0x26')][_0x036c('0x41')]){_0x5ae258[_0x036c('0x40')]=_['merge'](_0x5ae258[_0x036c('0x40')],{'$or':_[_0x036c('0x20')](_0x5ae258[_0x036c('0x2e')],function(_0x27d923){var _0x1a1c63={};_0x1a1c63[_0x27d923]={'$like':'%'+_0x391f6[_0x036c('0x26')][_0x036c('0x41')]+'%'};return _0x1a1c63;})});}if(_0x391f6[_0x036c('0x26')][_0x036c('0x42')]){var _0x22a3cc=_0x391f6[_0x036c('0x26')][_0x036c('0x42')][_0x036c('0x43')](',');var _0x542430={};_0x542430[_0x22a3cc[0x0]]={'$gte':moment(_0x22a3cc[0x1])[_0x036c('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5ae258[_0x036c('0x40')]=_[_0x036c('0x45')](_0x5ae258[_0x036c('0x40')],_0x542430);}_0x5ae258=_[_0x036c('0x45')]({},_0x5ae258,_0x391f6[_0x036c('0x46')]);return db[_0x036c('0x3c')][_0x036c('0x16')]({'where':_0x5ae258[_0x036c('0x40')]})[_0x036c('0x1a')](function(_0x26cd96){_0x48384c['count']=_0x26cd96;if(_0x391f6[_0x036c('0x26')][_0x036c('0x30')]){_0x5ae258['include']=[{'all':!![]}];}return db[_0x036c('0x3c')][_0x036c('0x25')](_0x5ae258);})['then'](function(_0x80f6fd){if(_0x391f6[_0x036c('0x26')][_0x036c('0x47')]===_0x036c('0x48')){for(var _0x2f93c8=0x0;_0x2f93c8<_0x80f6fd['length'];_0x2f93c8++){_0x80f6fd[_0x2f93c8][_0x036c('0x35')]=juice(_0x80f6fd[_0x2f93c8]['body']);}}_0x48384c[_0x036c('0x49')]=_0x80f6fd;return _0x48384c;});}})['then'](respondWithFilteredResult(_0x428c75,_0x5ae258))[_0x036c('0x28')](handleError(_0x428c75,null));};exports['addTags']=function(_0x2cdc88,_0x860400){return db[_0x036c('0x32')]['find']({'where':{'id':_0x2cdc88[_0x036c('0x36')]['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0x860400,null))[_0x036c('0x1a')](function(_0x5dcf82){if(_0x5dcf82){return _0x5dcf82['setTags'](_0x2cdc88['body'][_0x036c('0x39')],_[_0x036c('0x3a')](_0x2cdc88[_0x036c('0x35')],[_0x036c('0x39'),'id'])||{})[_0x036c('0x4a')](function(){return db[_0x036c('0x4b')][_0x036c('0x25')]({'attributes':['id',_0x036c('0x1e'),_0x036c('0x4c')],'where':{'id':_0x2cdc88[_0x036c('0x35')][_0x036c('0x39')]}});})[_0x036c('0x1a')](function(_0x202cef){socket[_0x036c('0x4d')](_0x036c('0x4e'),{'id':Number(_0x2cdc88[_0x036c('0x36')]['id']),'tags':_0x202cef||[]});return{'id':Number(_0x2cdc88[_0x036c('0x36')]['id']),'tags':_0x202cef||[]};});}})[_0x036c('0x1a')](respondWithResult(_0x860400,null))[_0x036c('0x28')](handleError(_0x860400,null));};exports[_0x036c('0x4f')]=function(_0x36ce53,_0x56f086){return db[_0x036c('0x32')][_0x036c('0x33')]({'where':{'id':_0x36ce53[_0x036c('0x36')]['id']}})[_0x036c('0x1a')](handleEntityNotFound(_0x56f086,null))[_0x036c('0x1a')](function(_0x4bb5f4){if(_0x4bb5f4){return _0x4bb5f4[_0x036c('0x4f')](_0x36ce53['query'][_0x036c('0x39')]);}})[_0x036c('0x1a')](respondWithStatusCode(_0x56f086,null))[_0x036c('0x28')](handleError(_0x56f086,null));};exports[_0x036c('0x50')]=function(_0x8004da,_0x5a289f){var _0xa411fa=moment()[_0x036c('0x51')]()[_0x036c('0x52')]();var _0x2281f0=path['join'](config['root'],_0x036c('0x53'),_0x036c('0x54'),'tmp');var _0xe82ed1=path[_0x036c('0x55')](config[_0x036c('0x56')],_0x036c('0x53'),_0x036c('0x54'),'attachments');var _0x37c755=path[_0x036c('0x55')](_0x2281f0,_0xa411fa);var _0x5b4d6f=util[_0x036c('0x44')](_0x036c('0x57'),_0x8004da['params']['id'],_0xa411fa);var _0x2f9df6=path[_0x036c('0x55')](_0x2281f0,_0x5b4d6f);var _0x337423=[];if(_0x8004da[_0x036c('0x26')]['attachments']){_0x337423[_0x036c('0x58')]({'model':db[_0x036c('0x59')],'as':_0x036c('0x5a'),'raw':!![]});}var _0xba4eca=[{'model':db[_0x036c('0x3c')],'as':_0x036c('0x5b'),'attributes':['id',_0x036c('0x35'),_0x036c('0x5c'),'to','cc',_0x036c('0x5d'),_0x036c('0x5e'),_0x036c('0x5f')],'where':{'secret':![]},'order':qs[_0x036c('0x3f')]('id'),'include':_0x337423}];return db[_0x036c('0x32')][_0x036c('0x33')]({'where':{'id':_0x8004da[_0x036c('0x36')]['id']},'include':_0xba4eca})[_0x036c('0x1a')](handleEntityNotFound(_0x5a289f,null))['then'](function(_0x4b63ce){if(_0x4b63ce&&_0x4b63ce[_0x036c('0x5b')]){var _0x56f7a4=_0x4b63ce[_0x036c('0x60')]({'plain':!![]});fs['mkdirSync'](_0x37c755);return BPromise[_0x036c('0x61')](_0x56f7a4['Messages'],function(_0x173780,_0x5bbfad){var _0x2bce22={'from':_0x173780[_0x036c('0x5c')],'to':_0x173780['to']||_0x036c('0x62'),'subject':_0x173780['subject'],'html':htmlEntities[_0x036c('0x63')](_0x173780[_0x036c('0x35')]),'headers':{'Date':moment(_0x173780[_0x036c('0x5f')])['format'](_0x036c('0x64'))},'attachments':[]};if(_0x173780['cc']){_0x2bce22[_0x036c('0x65')]['Cc']=_0x173780['cc'];}if(_0x173780['bcc']){_0x2bce22[_0x036c('0x65')][_0x036c('0x66')]=_0x173780[_0x036c('0x5d')];}return new BPromise(function(_0x2ab916,_0x126681){if(_0x173780['Attachments']){for(var _0x418f32=0x0;_0x418f32<_0x173780[_0x036c('0x5a')][_0x036c('0x3d')];_0x418f32++){var _0x7f412d=_0x173780[_0x036c('0x5a')][_0x418f32];var _0x6a8c80=path['join'](_0xe82ed1,_0x7f412d[_0x036c('0x67')]);if(fs[_0x036c('0x68')](_0x6a8c80)){_0x2bce22[_0x036c('0x69')]['push']({'name':_0x7f412d[_0x036c('0x1e')],'contentType':_0x7f412d[_0x036c('0x22')],'data':fs['readFileSync'](_0x6a8c80)});}}}emlformat[_0x036c('0x6a')](_0x2bce22,function(_0x1f51e1,_0x11e8dc){if(_0x1f51e1)return _0x126681(_0x1f51e1);fs[_0x036c('0x6b')](path['join'](_0x37c755,util[_0x036c('0x44')](_0x036c('0x6c'),_0x5bbfad)),_0x11e8dc);return _0x2ab916(_0x11e8dc);});});})[_0x036c('0x1a')](function(){return new BPromise(function(_0x97f8bf,_0x405be9){zipdir(_0x37c755,{'saveTo':_0x2f9df6},function(_0x3452b2,_0x920cff){if(_0x3452b2)return _0x405be9(_0x3452b2);return _0x97f8bf(_0x920cff);});})['then'](function(){return new BPromise(function(_0x10ef48,_0x4e05c4){rimraf(_0x37c755,function(_0x2edfce){if(_0x2edfce)_0x4e05c4(_0x2edfce);return _0x10ef48();});});})[_0x036c('0x1a')](function(){return _0x5a289f[_0x036c('0x50')](_0x2f9df6,_0x5b4d6f,function(_0xd2e6f7){if(!_0xd2e6f7)fs[_0x036c('0x6d')](_0x2f9df6);});});});}else{return _0x5a289f[_0x036c('0x6e')](0xc8);}})[_0x036c('0x28')](handleError(_0x5a289f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9d144f6..a034eae 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 _0x587c=['remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x587c,0xc0));var _0xc587=function(_0x217dee,_0xbde5bf){_0x217dee=_0x217dee-0x0;var _0x23ddb0=_0x587c[_0x217dee];return _0x23ddb0;};'use strict';var EventEmitter=require(_0xc587('0x0'));var MailInteraction=require(_0xc587('0x1'))['db'][_0xc587('0x2')];var MailMessage=require(_0xc587('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc587('0x3')](0x0);var events={'afterCreate':_0xc587('0x4'),'afterUpdate':_0xc587('0x5'),'afterDestroy':_0xc587('0x6')};function emitEvent(_0x32cdce){return function(_0x1855a,_0x472404,_0x52afe3){_0x1855a[_0xc587('0x7')]({'attributes':['id'],'raw':!![]})[_0xc587('0x8')](function(_0x263719){_0x1855a['setDataValue'](_0xc587('0x9'),_0x263719[_0xc587('0xa')](function(_0x16eeaf){return{'id':_0x16eeaf['id']};}));return MailMessage[_0xc587('0xb')]({'where':{'MailInteractionId':_0x1855a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc587('0x8')](function(_0xb9a948){_0x1855a['setDataValue'](_0xc587('0xc'),_0xb9a948[_0xc587('0xd')]);MailInteractionEvents[_0xc587('0xe')](_0x32cdce+':'+_0x1855a['id'],_0x1855a);MailInteractionEvents[_0xc587('0xe')](_0x32cdce,_0x1855a);_0x52afe3(null);})['catch'](_0x52afe3(null));};}for(var e in events){if(events[_0xc587('0xf')](e)){var event=events[e];MailInteraction[_0xc587('0x10')](e,emitEvent(event));}}module[_0xc587('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x368c=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x368c,0x1b4));var _0xc368=function(_0x2bc72e,_0x114b3e){_0x2bc72e=_0x2bc72e-0x0;var _0x32ad84=_0x368c[_0x2bc72e];return _0x32ad84;};'use strict';var EventEmitter=require(_0xc368('0x0'));var MailInteraction=require(_0xc368('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xc368('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc368('0x3')](0x0);var events={'afterCreate':_0xc368('0x4'),'afterUpdate':_0xc368('0x5'),'afterDestroy':_0xc368('0x6')};function emitEvent(_0x12a3f2){return function(_0x2c52a6,_0x3ce1dd,_0x3577ad){_0x2c52a6['getUsers']({'attributes':['id'],'raw':!![]})[_0xc368('0x7')](function(_0x27fe82){_0x2c52a6[_0xc368('0x8')](_0xc368('0x9'),_0x27fe82[_0xc368('0xa')](function(_0x6d2cab){return{'id':_0x6d2cab['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2c52a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc368('0x7')](function(_0x410607){_0x2c52a6[_0xc368('0x8')](_0xc368('0xb'),_0x410607['length']);MailInteractionEvents['emit'](_0x12a3f2+':'+_0x2c52a6['id'],_0x2c52a6);MailInteractionEvents[_0xc368('0xc')](_0x12a3f2,_0x2c52a6);_0x3577ad(null);})[_0xc368('0xd')](_0x3577ad(null));};}for(var e in events){if(events[_0xc368('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xc368('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 990fc97..eb45856 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 _0xcfba=['changed','format','substatus','models','get','MailMessage','update','then','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','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x29373e,_0x1c02e3){var _0x123599=function(_0x54afca){while(--_0x54afca){_0x29373e['push'](_0x29373e['shift']());}};_0x123599(++_0x1c02e3);}(_0xcfba,0xb8));var _0xacfb=function(_0x30ce07,_0x1d28b7){_0x30ce07=_0x30ce07-0x0;var _0x2ac4b1=_0xcfba[_0x30ce07];return _0x2ac4b1;};'use strict';var _=require('lodash');var util=require(_0xacfb('0x0'));var logger=require(_0xacfb('0x1'))(_0xacfb('0x2'));var moment=require(_0xacfb('0x3'));var BPromise=require(_0xacfb('0x4'));var rp=require(_0xacfb('0x5'));var fs=require('fs');var path=require(_0xacfb('0x6'));var rimraf=require(_0xacfb('0x7'));var config=require(_0xacfb('0x8'));var attributes=require(_0xacfb('0x9'));module['exports']=function(_0x5386f0,_0x2b7e13){return _0x5386f0[_0xacfb('0xa')](_0xacfb('0xb'),attributes,{'tableName':_0xacfb('0xc'),'paranoid':![],'indexes':[{'name':_0xacfb('0xd'),'fields':[_0xacfb('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x201aad,_0x174f65,_0x488bf9){if(_0x201aad['substatus']){_0x201aad[_0xacfb('0xf')]=moment()['format'](_0xacfb('0x10'));}if(_0x201aad[_0xacfb('0x11')]){_0x201aad[_0xacfb('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x488bf9(null,_0x174f65);},'beforeUpdate':function(_0x1d4649,_0x2cc188,_0x2e1273){if(_0x1d4649[_0xacfb('0x13')]('substatus')){_0x1d4649[_0xacfb('0xf')]=_0x1d4649['substatus']?moment()[_0xacfb('0x14')](_0xacfb('0x10')):null;}if(_0x1d4649[_0xacfb('0x13')](_0xacfb('0x11'))){_0x1d4649[_0xacfb('0x12')]=moment()[_0xacfb('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d4649[_0xacfb('0x15')]=null;_0x1d4649[_0xacfb('0xf')]=null;}_0x2e1273(null,_0x1d4649);},'afterUpdate':function(_0x414204,_0x222304,_0x5ca046){var _0x352078=_0x5386f0[_0xacfb('0x16')];var _0x5ed01b=_0x414204[_0xacfb('0x17')]({'plain':!![]});if(_0x5ed01b[_0xacfb('0x11')]){return _0x352078[_0xacfb('0x18')][_0xacfb('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5ed01b['id']}})[_0xacfb('0x1a')](function(){_0x5ca046();})['catch'](function(_0x17604d){_0x5ca046(_0x17604d);});}else{_0x5ca046();}}},'charset':_0xacfb('0x1b'),'collate':_0xacfb('0x1c')});}; \ No newline at end of file +var _0xe8a6=['request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x4175c8,_0x33a6b0){var _0x54e767=function(_0x2dfd84){while(--_0x2dfd84){_0x4175c8['push'](_0x4175c8['shift']());}};_0x54e767(++_0x33a6b0);}(_0xe8a6,0x7d));var _0x6e8a=function(_0x91343f,_0x2a8520){_0x91343f=_0x91343f-0x0;var _0x561718=_0xe8a6[_0x91343f];return _0x561718;};'use strict';var _=require(_0x6e8a('0x0'));var util=require(_0x6e8a('0x1'));var logger=require(_0x6e8a('0x2'))(_0x6e8a('0x3'));var moment=require('moment');var BPromise=require(_0x6e8a('0x4'));var rp=require(_0x6e8a('0x5'));var fs=require('fs');var path=require(_0x6e8a('0x6'));var rimraf=require(_0x6e8a('0x7'));var config=require('../../config/environment');var attributes=require(_0x6e8a('0x8'));module[_0x6e8a('0x9')]=function(_0x120b8e,_0x1c24b6){return _0x120b8e['define'](_0x6e8a('0xa'),attributes,{'tableName':_0x6e8a('0xb'),'paranoid':![],'indexes':[{'name':_0x6e8a('0xc'),'fields':[_0x6e8a('0xd'),'to'],'type':_0x6e8a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x247a4a,_0x3f6a7b,_0x2123ec){if(_0x247a4a[_0x6e8a('0xf')]){_0x247a4a[_0x6e8a('0x10')]=moment()[_0x6e8a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x247a4a[_0x6e8a('0x12')]){_0x247a4a[_0x6e8a('0x13')]=moment()['format'](_0x6e8a('0x14'));}_0x2123ec(null,_0x3f6a7b);},'beforeUpdate':function(_0x263d17,_0x48b10b,_0x6ab364){if(_0x263d17[_0x6e8a('0x15')]('substatus')){_0x263d17[_0x6e8a('0x10')]=_0x263d17[_0x6e8a('0xf')]?moment()[_0x6e8a('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x263d17['changed'](_0x6e8a('0x12'))){_0x263d17['closedAt']=moment()['format'](_0x6e8a('0x14'));_0x263d17[_0x6e8a('0xf')]=null;_0x263d17[_0x6e8a('0x10')]=null;}_0x6ab364(null,_0x263d17);},'afterUpdate':function(_0x95d89d,_0x42c737,_0x40e70d){var _0x4d0084=_0x120b8e['models'];var _0x163d3c=_0x95d89d['get']({'plain':!![]});if(_0x163d3c[_0x6e8a('0x12')]){return _0x4d0084[_0x6e8a('0x16')][_0x6e8a('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x163d3c['id']}})[_0x6e8a('0x18')](function(){_0x40e70d();})['catch'](function(_0x4ad011){_0x40e70d(_0x4ad011);});}else{_0x40e70d();}}},'charset':_0x6e8a('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8285fbd..4da774f 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 _0x2afe=['then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','addTags','omit','ids','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request'];(function(_0x65eb6a,_0x413dca){var _0x2a333e=function(_0x319de2){while(--_0x319de2){_0x65eb6a['push'](_0x65eb6a['shift']());}};_0x2a333e(++_0x413dca);}(_0x2afe,0xbb));var _0xe2af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2afe[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe2af('0x0'));var util=require('util');var moment=require(_0xe2af('0x1'));var BPromise=require(_0xe2af('0x2'));var rs=require(_0xe2af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2af('0x4'))['db'];var utils=require(_0xe2af('0x5'));var logger=require(_0xe2af('0x6'))(_0xe2af('0x7'));var config=require(_0xe2af('0x8'));var jayson=require(_0xe2af('0x9'));var client=jayson[_0xe2af('0xa')][_0xe2af('0xb')]({'port':0x232a});config[_0xe2af('0xc')]=_[_0xe2af('0xd')](config[_0xe2af('0xc')],{'host':_0xe2af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2af('0xc')]));require(_0xe2af('0xf'))[_0xe2af('0x10')](socket);function respondWithRpcPromise(_0x3eb026,_0x164cdb,_0x45f8bb){return new BPromise(function(_0x2a7ec5,_0x673fcb){return client[_0xe2af('0x11')](_0x3eb026,_0x45f8bb)[_0xe2af('0x12')](function(_0x30e839){logger['info'](_0xe2af('0x13'),_0x164cdb,'request\x20sent');logger[_0xe2af('0x14')](_0xe2af('0x15'),_0x164cdb,'request\x20sent',JSON['stringify'](_0x30e839));if(_0x30e839['error']){if(_0x30e839['error']['code']===0x1f4){logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error'][_0xe2af('0x17')]);return _0x673fcb(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error']['message']);return _0x2a7ec5(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}else{logger[_0xe2af('0x18')](_0xe2af('0x13'),_0x164cdb,_0xe2af('0x19'));_0x2a7ec5(_0x30e839['result'][_0xe2af('0x17')]);}})[_0xe2af('0x1a')](function(_0x4076fc){logger[_0xe2af('0x16')]('MailInteraction,\x20%s,\x20%s',_0x164cdb,_0x4076fc);_0x673fcb(_0x4076fc);});});}exports[_0xe2af('0x1b')]=function(_0x135df4){var _0x30c0a4=this;return new Promise(function(_0x3980f9,_0x4bd2e5){return db[_0xe2af('0x1c')]['update'](_0x135df4[_0xe2af('0x1d')],{'raw':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null,'attributes':_0x135df4[_0xe2af('0x1e')]?_0x135df4['options'][_0xe2af('0x21')]||null:null,'limit':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x22')]||null:null})[_0xe2af('0x12')](function(_0x732f88){logger[_0xe2af('0x18')]('UpdateMailInteraction',_0x135df4);logger[_0xe2af('0x14')](_0xe2af('0x1b'),_0x135df4,JSON[_0xe2af('0x23')](_0x732f88));_0x3980f9(_0x732f88);})[_0xe2af('0x1a')](function(_0x4b0000){logger['error'](_0xe2af('0x1b'),_0x4b0000[_0xe2af('0x17')],_0x135df4);_0x4bd2e5(_0x30c0a4[_0xe2af('0x16')](0x1f4,_0x4b0000[_0xe2af('0x17')]));});});};exports[_0xe2af('0x24')]=function(_0x4a744a){return new Promise(function(_0x5857e9,_0x541e42){return db[_0xe2af('0x1c')]['find']({'where':_0x4a744a['options']?_0x4a744a[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null})[_0xe2af('0x12')](function(_0x3921ff){if(_0x3921ff){return _0x3921ff[_0xe2af('0x25')](_0x4a744a['body']['ids'],_[_0xe2af('0x26')](_0x4a744a['body'],[_0xe2af('0x27'),'id'])||{});}})['spread'](function(_0x18455e){logger[_0xe2af('0x18')]('AddTags',_0x4a744a);logger[_0xe2af('0x14')](_0xe2af('0x28'),_0x4a744a,JSON[_0xe2af('0x23')](_0x18455e));_0x5857e9(_0x18455e);})[_0xe2af('0x1a')](function(_0x28fcfd){logger[_0xe2af('0x16')](_0xe2af('0x28'),_0x28fcfd[_0xe2af('0x17')],_0x4a744a);_0x541e42(_this[_0xe2af('0x16')](0x1f4,_0x28fcfd[_0xe2af('0x17')]));});});}; \ No newline at end of file +var _0xb209=['./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','MailInteraction','update','body','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xb209,0x151));var _0x9b20=function(_0x54fd95,_0x256556){_0x54fd95=_0x54fd95-0x0;var _0x35ffde=_0xb209[_0x54fd95];return _0x35ffde;};'use strict';var _=require(_0x9b20('0x0'));var util=require(_0x9b20('0x1'));var moment=require(_0x9b20('0x2'));var BPromise=require(_0x9b20('0x3'));var rs=require(_0x9b20('0x4'));var fs=require('fs');var Redis=require(_0x9b20('0x5'));var db=require(_0x9b20('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b20('0x7'))('rpc');var config=require(_0x9b20('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b20('0x9')]({'port':0x232a});config[_0x9b20('0xa')]=_[_0x9b20('0xb')](config['redis'],{'host':_0x9b20('0xc'),'port':0x18eb});var socket=require(_0x9b20('0xd'))(new Redis(config[_0x9b20('0xa')]));require(_0x9b20('0xe'))['register'](socket);function respondWithRpcPromise(_0x3b54d1,_0x9a8e49,_0x22cd8e){return new BPromise(function(_0x6a3777,_0x1f858f){return client[_0x9b20('0xf')](_0x3b54d1,_0x22cd8e)[_0x9b20('0x10')](function(_0x3ade0a){logger[_0x9b20('0x11')](_0x9b20('0x12'),_0x9a8e49,_0x9b20('0x13'));logger[_0x9b20('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x9a8e49,_0x9b20('0x13'),JSON[_0x9b20('0x15')](_0x3ade0a));if(_0x3ade0a['error']){if(_0x3ade0a[_0x9b20('0x16')]['code']===0x1f4){logger['error'](_0x9b20('0x12'),_0x9a8e49,_0x3ade0a[_0x9b20('0x16')][_0x9b20('0x17')]);return _0x1f858f(_0x3ade0a[_0x9b20('0x16')][_0x9b20('0x17')]);}logger[_0x9b20('0x16')](_0x9b20('0x12'),_0x9a8e49,_0x3ade0a[_0x9b20('0x16')][_0x9b20('0x17')]);return _0x6a3777(_0x3ade0a[_0x9b20('0x16')][_0x9b20('0x17')]);}else{logger[_0x9b20('0x11')](_0x9b20('0x12'),_0x9a8e49,_0x9b20('0x13'));_0x6a3777(_0x3ade0a['result'][_0x9b20('0x17')]);}})[_0x9b20('0x18')](function(_0x3b2653){logger[_0x9b20('0x16')](_0x9b20('0x12'),_0x9a8e49,_0x3b2653);_0x1f858f(_0x3b2653);});});}exports['UpdateMailInteraction']=function(_0xe0b44d){var _0x2ede97=this;return new Promise(function(_0x2a42d7,_0x3bb6d){return db[_0x9b20('0x19')][_0x9b20('0x1a')](_0xe0b44d[_0x9b20('0x1b')],{'raw':_0xe0b44d[_0x9b20('0x1c')]?_0xe0b44d[_0x9b20('0x1c')][_0x9b20('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe0b44d[_0x9b20('0x1c')]?_0xe0b44d['options'][_0x9b20('0x1e')]||null:null,'attributes':_0xe0b44d[_0x9b20('0x1c')]?_0xe0b44d[_0x9b20('0x1c')][_0x9b20('0x1f')]||null:null,'limit':_0xe0b44d[_0x9b20('0x1c')]?_0xe0b44d[_0x9b20('0x1c')]['limit']||null:null})[_0x9b20('0x10')](function(_0x124b0e){logger[_0x9b20('0x11')]('UpdateMailInteraction',_0xe0b44d);logger['debug'](_0x9b20('0x20'),_0xe0b44d,JSON[_0x9b20('0x15')](_0x124b0e));_0x2a42d7(_0x124b0e);})[_0x9b20('0x18')](function(_0x5ead8e){logger[_0x9b20('0x16')](_0x9b20('0x20'),_0x5ead8e[_0x9b20('0x17')],_0xe0b44d);_0x3bb6d(_0x2ede97[_0x9b20('0x16')](0x1f4,_0x5ead8e[_0x9b20('0x17')]));});});};exports[_0x9b20('0x21')]=function(_0x586fae){return new Promise(function(_0x345314,_0x542cce){return db[_0x9b20('0x19')]['find']({'where':_0x586fae[_0x9b20('0x1c')]?_0x586fae[_0x9b20('0x1c')][_0x9b20('0x1e')]||null:null})['then'](function(_0x10cbe0){if(_0x10cbe0){return _0x10cbe0[_0x9b20('0x22')](_0x586fae[_0x9b20('0x1b')][_0x9b20('0x23')],_[_0x9b20('0x24')](_0x586fae[_0x9b20('0x1b')],['ids','id'])||{});}})[_0x9b20('0x25')](function(_0xba91a){logger[_0x9b20('0x11')](_0x9b20('0x26'),_0x586fae);logger['debug'](_0x9b20('0x26'),_0x586fae,JSON[_0x9b20('0x15')](_0xba91a));_0x345314(_0xba91a);})['catch'](function(_0x338bcb){logger[_0x9b20('0x16')](_0x9b20('0x26'),_0x338bcb['message'],_0x586fae);_0x542cce(_this[_0x9b20('0x16')](0x1f4,_0x338bcb[_0x9b20('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0bf640d..6d2e833 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 _0x2051=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x2ea70e,_0x5bdf2c){var _0x995523=function(_0x3b0d0f){while(--_0x3b0d0f){_0x2ea70e['push'](_0x2ea70e['shift']());}};_0x995523(++_0x5bdf2c);}(_0x2051,0x1ec));var _0x1205=function(_0x530bb2,_0x40e366){_0x530bb2=_0x530bb2-0x0;var _0x1f0e31=_0x2051[_0x530bb2];return _0x1f0e31;};'use strict';var MailInteractionEvents=require(_0x1205('0x0'));var events=[_0x1205('0x1'),_0x1205('0x2'),_0x1205('0x3')];function createListener(_0x406e2d,_0x54725e){return function(_0x583640){_0x54725e[_0x1205('0x4')](_0x406e2d,_0x583640);};}function removeListener(_0x3b382e,_0x14ea1d){return function(){MailInteractionEvents[_0x1205('0x5')](_0x3b382e,_0x14ea1d);};}exports[_0x1205('0x6')]=function(_0x31e87f){for(var _0x5cdbbf=0x0,_0x605298=events[_0x1205('0x7')];_0x5cdbbf<_0x605298;_0x5cdbbf++){var _0x4115aa=events[_0x5cdbbf];var _0x28e170=createListener(_0x1205('0x8')+_0x4115aa,_0x31e87f);MailInteractionEvents['on'](_0x4115aa,_0x28e170);}}; \ No newline at end of file +var _0x3125=['mailInteraction:','save','update','register'];(function(_0x2d687f,_0x5107c1){var _0x276c52=function(_0x4fcb34){while(--_0x4fcb34){_0x2d687f['push'](_0x2d687f['shift']());}};_0x276c52(++_0x5107c1);}(_0x3125,0x1f1));var _0x5312=function(_0x3122b9,_0x4cb093){_0x3122b9=_0x3122b9-0x0;var _0x537dcc=_0x3125[_0x3122b9];return _0x537dcc;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x5312('0x0'),'remove',_0x5312('0x1')];function createListener(_0x26b980,_0x339569){return function(_0x190000){_0x339569['emit'](_0x26b980,_0x190000);};}function removeListener(_0x441afb,_0x488532){return function(){MailInteractionEvents['removeListener'](_0x441afb,_0x488532);};}exports[_0x5312('0x2')]=function(_0x5085dd){for(var _0x436860=0x0,_0xd69ae4=events['length'];_0x436860<_0xd69ae4;_0x436860++){var _0x3b1d2e=events[_0x436860];var _0x12bbeb=createListener(_0x5312('0x3')+_0x3b1d2e,_0x5085dd);MailInteractionEvents['on'](_0x3b1d2e,_0x12bbeb);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 2a9b2b5..25d5a1b 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a25=['describe','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe'];(function(_0x3899af,_0x4fdacb){var _0x28a4f7=function(_0x255d4f){while(--_0x255d4f){_0x3899af['push'](_0x3899af['shift']());}};_0x28a4f7(++_0x4fdacb);}(_0x8a25,0xb7));var _0x58a2=function(_0x5bc9ff,_0x168be3){_0x5bc9ff=_0x5bc9ff-0x0;var _0x10c9ea=_0x8a25[_0x5bc9ff];return _0x10c9ea;};'use strict';var express=require(_0x58a2('0x0'));var router=express[_0x58a2('0x1')]();var auth=require(_0x58a2('0x2'));var controller=require(_0x58a2('0x3'));router[_0x58a2('0x4')](_0x58a2('0x5'),auth['isAuthenticated'](),controller[_0x58a2('0x6')]);module['exports']=router; \ No newline at end of file +var _0xd9c8=['/describe','isAuthenticated','describe','exports','express','Router','./mailInteractionHasTag.controller','get'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd9c8[_0x122096];return _0x3d1966;};'use strict';var express=require(_0x8d9c('0x0'));var router=express[_0x8d9c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8d9c('0x2'));router[_0x8d9c('0x3')](_0x8d9c('0x4'),auth[_0x8d9c('0x5')](),controller[_0x8d9c('0x6')]);module[_0x8d9c('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 4dd608a..2c281dc 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4fbcdc,_0x17ff99){var _0x5e5ab0=function(_0x3713e4){while(--_0x3713e4){_0x4fbcdc['push'](_0x4fbcdc['shift']());}};_0x5e5ab0(++_0x17ff99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1d828b,_0x783dfd){var _0x54be7c=function(_0x250a2f){while(--_0x250a2f){_0x1d828b['push'](_0x1d828b['shift']());}};_0x54be7c(++_0x783dfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index a78585f..6c7c618 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ba6=['exports','INTEGER','sequelize'];(function(_0x45e7d2,_0x150368){var _0x4b48ce=function(_0x1ad188){while(--_0x1ad188){_0x45e7d2['push'](_0x45e7d2['shift']());}};_0x4b48ce(++_0x150368);}(_0x0ba6,0xd1));var _0x60ba=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0ba6[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x60ba('0x0'));module[_0x60ba('0x1')]={'MailInteractionId':{'type':Sequelize[_0x60ba('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x60ba('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x4879=['INTEGER','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4879,0x1bb));var _0x9487=function(_0x558d62,_0x30db8f){_0x558d62=_0x558d62-0x0;var _0xa8cb39=_0x4879[_0x558d62];return _0xa8cb39;};'use strict';var Sequelize=require('sequelize');module[_0x9487('0x0')]={'MailInteractionId':{'type':Sequelize[_0x9487('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x9487('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index e4636cc..48c5c3a 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3650=['mail_interaction_has_tags','./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x6d1c65,_0x22df6e){var _0x1e96b4=function(_0xc1aac4){while(--_0xc1aac4){_0x6d1c65['push'](_0x6d1c65['shift']());}};_0x1e96b4(++_0x22df6e);}(_0x3650,0x1d1));var _0x0365=function(_0x2a4af6,_0x242a55){_0x2a4af6=_0x2a4af6-0x0;var _0x3f8898=_0x3650[_0x2a4af6];return _0x3f8898;};'use strict';var attributes=require(_0x0365('0x0'));module[_0x0365('0x1')]=function(_0x11f6fe){return _0x11f6fe['define'](_0x0365('0x2'),attributes,{'tableName':_0x0365('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0766=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define','MailInteractionHasTag'];(function(_0x1fcfb4,_0x540de3){var _0x5f1dde=function(_0x4740ec){while(--_0x4740ec){_0x1fcfb4['push'](_0x1fcfb4['shift']());}};_0x5f1dde(++_0x540de3);}(_0x0766,0xb5));var _0x6076=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0766[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x6076('0x0'));module[_0x6076('0x1')]=function(_0x4f6d51){return _0x4f6d51[_0x6076('0x2')](_0x6076('0x3'),attributes,{'tableName':_0x6076('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e5799d3..54caf55 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 _0x81d5=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','/describe','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x81d5,0x1ab));var _0x581d=function(_0x3f99b8,_0x1b15bc){_0x3f99b8=_0x3f99b8-0x0;var _0x168ab0=_0x81d5[_0x3f99b8];return _0x168ab0;};'use strict';var multer=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var path=require('path');var timeout=require(_0x581d('0x2'));var express=require(_0x581d('0x3'));var router=express[_0x581d('0x4')]();var fs_extra=require(_0x581d('0x5'));var auth=require(_0x581d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x581d('0x7'));router[_0x581d('0x8')]('/',auth[_0x581d('0x9')](),controller['index']);router[_0x581d('0x8')](_0x581d('0xa'),auth[_0x581d('0x9')](),controller['describe']);router[_0x581d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x581d('0x8')](_0x581d('0xb'),auth[_0x581d('0x9')](),controller[_0x581d('0xc')]);router[_0x581d('0xd')]('/',auth['isAuthenticated'](),interaction[_0x581d('0xe')](_0x581d('0xf'),_0x581d('0x10')),controller[_0x581d('0x11')]);router[_0x581d('0x12')](_0x581d('0x13'),auth[_0x581d('0x9')](),controller[_0x581d('0x14')]);router[_0x581d('0x12')](_0x581d('0x15'),auth['isAuthenticated'](),controller[_0x581d('0x16')]);router[_0x581d('0x12')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x581d('0x13'),auth['isAuthenticated'](),controller[_0x581d('0x17')]);module[_0x581d('0x18')]=router; \ No newline at end of file +var _0x3cd1=['../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','/:id','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x306082,_0x54ddf2){var _0x5eb6da=function(_0x1e46b8){while(--_0x1e46b8){_0x306082['push'](_0x306082['shift']());}};_0x5eb6da(++_0x54ddf2);}(_0x3cd1,0x112));var _0x13cd=function(_0x5e8e80,_0x50079a){_0x5e8e80=_0x5e8e80-0x0;var _0x126d56=_0x3cd1[_0x5e8e80];return _0x126d56;};'use strict';var multer=require('multer');var util=require(_0x13cd('0x0'));var path=require(_0x13cd('0x1'));var timeout=require(_0x13cd('0x2'));var express=require(_0x13cd('0x3'));var router=express[_0x13cd('0x4')]();var fs_extra=require(_0x13cd('0x5'));var auth=require(_0x13cd('0x6'));var interaction=require(_0x13cd('0x7'));var config=require('../../config/environment');var controller=require(_0x13cd('0x8'));router[_0x13cd('0x9')]('/',auth[_0x13cd('0xa')](),controller['index']);router['get'](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0xc')]);router[_0x13cd('0x9')]('/:id',auth[_0x13cd('0xa')](),controller[_0x13cd('0xd')]);router[_0x13cd('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x13cd('0xe')]);router[_0x13cd('0xf')]('/',auth[_0x13cd('0xa')](),interaction[_0x13cd('0x10')](_0x13cd('0x11'),_0x13cd('0x12')),controller[_0x13cd('0x13')]);router['put'](_0x13cd('0x14'),auth[_0x13cd('0xa')](),controller['update']);router[_0x13cd('0x15')](_0x13cd('0x16'),auth[_0x13cd('0xa')](),controller[_0x13cd('0x17')]);router[_0x13cd('0x15')](_0x13cd('0x18'),auth[_0x13cd('0xa')](),controller[_0x13cd('0x19')]);router['delete'](_0x13cd('0x14'),auth['isAuthenticated'](),controller[_0x13cd('0x1a')]);module[_0x13cd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3e41d7e..1be2d46 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 _0x2ca5=['lodash','exports','TEXT','ENUM','out','long','DATE','INTEGER','BOOLEAN','Email','Chat'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2ca5,0x108));var _0x52ca=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0x2ca5[_0x39d711];return _0xee1d0c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x52ca('0x0'));module[_0x52ca('0x1')]={'body':{'type':Sequelize[_0x52ca('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x52ca('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x52ca('0x3')]('in',_0x52ca('0x4')),'defaultValue':_0x52ca('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x52ca('0x5'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x52ca('0x2')](_0x52ca('0x5'))},'subject':{'type':Sequelize[_0x52ca('0x2')]},'sentAt':{'type':Sequelize[_0x52ca('0x6')]},'attach':{'type':Sequelize[_0x52ca('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x52ca('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x52ca('0x6')]},'originTo':{'type':Sequelize['TEXT'](_0x52ca('0x5'))},'originCc':{'type':Sequelize[_0x52ca('0x2')](_0x52ca('0x5'))},'originChannel':{'type':Sequelize[_0x52ca('0x3')](_0x52ca('0x9'),_0x52ca('0xa')),'defaultValue':_0x52ca('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x73a3=['long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','exports'];(function(_0x2a55e8,_0x3330aa){var _0x55bf11=function(_0x2acc66){while(--_0x2acc66){_0x2a55e8['push'](_0x2a55e8['shift']());}};_0x55bf11(++_0x3330aa);}(_0x73a3,0x103));var _0x373a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x73a3[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x373a('0x0')]={'body':{'type':Sequelize['TEXT'](_0x373a('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x373a('0x2')](_0x373a('0x3'))},'read':{'type':Sequelize[_0x373a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x373a('0x5')]('in',_0x373a('0x6')),'defaultValue':_0x373a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x373a('0x7')]},'to':{'type':Sequelize[_0x373a('0x2')]('long')},'cc':{'type':Sequelize[_0x373a('0x2')]('long')},'bcc':{'type':Sequelize[_0x373a('0x2')](_0x373a('0x1'))},'subject':{'type':Sequelize[_0x373a('0x2')]},'sentAt':{'type':Sequelize[_0x373a('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x373a('0x8')]},'originTo':{'type':Sequelize[_0x373a('0x2')](_0x373a('0x1'))},'originCc':{'type':Sequelize[_0x373a('0x2')](_0x373a('0x1'))},'originChannel':{'type':Sequelize[_0x373a('0x5')](_0x373a('0x9'),'Chat'),'defaultValue':_0x373a('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 79fac81..4843179 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 _0x2f51=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','body','find','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','updatedAt','DESC','CloudProvider','Smtp','attachments','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','event','reject','fromString','unix','toString','join','tmp','files','bcc','subject','createdAt','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','unlinkSync','eml-format','moment','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','update','then','destroy','end','sendStatus','send','index','MailMessage','rawAttributes','fieldName','key','model','map','name','keys','query','intersection','attributes'];(function(_0x193ea6,_0x27890e){var _0x4fe21a=function(_0x34a3bf){while(--_0x34a3bf){_0x193ea6['push'](_0x193ea6['shift']());}};_0x4fe21a(++_0x27890e);}(_0x2f51,0x182));var _0x12f5=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0x2f51[_0x16eb19];return _0x312a25;};'use strict';var emlformat=require(_0x12f5('0x0'));var moment=require(_0x12f5('0x1'));var BPromise=require('bluebird');var util=require(_0x12f5('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x12f5('0x3'));var htmlToText=require(_0x12f5('0x4'));var qs=require(_0x12f5('0x5'));var logger=require(_0x12f5('0x6'))(_0x12f5('0x7'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x12f5('0x8'));var db=require(_0x12f5('0x9'))['db'];config[_0x12f5('0xa')]=_[_0x12f5('0xb')](config[_0x12f5('0xa')],{'host':_0x12f5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12f5('0xa')]));var htmlEntities=require(_0x12f5('0xd'));require('./mailMessage.socket')[_0x12f5('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232c});var client9003=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232b});var client9002=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5c6cfc,_0x26618f,_0x154eb3,_0xf4f3d0){return new BPromise(function(_0x598196,_0x2bb66a){var _0x4a93bb=_0xf4f3d0||client;return _0x4a93bb[_0x12f5('0x11')](_0x5c6cfc,_0x154eb3)['then'](function(_0x3250af){logger[_0x12f5('0x12')]('MailMessage,\x20%s,\x20%s',_0x26618f,_0x12f5('0x13'));logger[_0x12f5('0x14')](_0x12f5('0x15'),_0x26618f,_0x12f5('0x13'),JSON['stringify'](_0x3250af));if(_0x3250af['error']){if(_0x3250af[_0x12f5('0x16')]['code']===0x1f4){logger[_0x12f5('0x16')](_0x12f5('0x17'),_0x26618f,_0x3250af['error'][_0x12f5('0x18')]);return _0x2bb66a(_0x3250af[_0x12f5('0x16')][_0x12f5('0x18')]);}logger[_0x12f5('0x16')](_0x12f5('0x17'),_0x26618f,_0x3250af[_0x12f5('0x16')]['message']);return _0x598196(_0x3250af[_0x12f5('0x16')][_0x12f5('0x18')]);}else{logger[_0x12f5('0x12')](_0x12f5('0x17'),_0x26618f,_0x12f5('0x13'));_0x598196(_0x3250af[_0x12f5('0x19')]['message']);}})[_0x12f5('0x1a')](function(_0x570ba6){logger['error'](_0x12f5('0x17'),_0x26618f,_0x570ba6);_0x2bb66a(_0x570ba6);});});}function respondWithResult(_0x3c076a,_0x51558a){_0x51558a=_0x51558a||0xc8;return function(_0x2ae42a){if(_0x2ae42a){return _0x3c076a[_0x12f5('0x1b')](_0x51558a)['json'](_0x2ae42a);}};}function respondWithFilteredResult(_0x2d0609,_0x320063){return function(_0x380650){if(_0x380650){var _0x14c452=typeof _0x320063[_0x12f5('0x1c')]===_0x12f5('0x1d')&&typeof _0x320063['limit']===_0x12f5('0x1d');var _0x283417=_0x380650[_0x12f5('0x1e')];var _0x5cd328=_0x14c452?0x0:_0x320063[_0x12f5('0x1c')];var _0x650505=_0x14c452?_0x380650[_0x12f5('0x1e')]:_0x320063[_0x12f5('0x1c')]+_0x320063[_0x12f5('0x1f')];var _0x5ebb7a;if(_0x650505>=_0x283417){_0x650505=_0x283417;_0x5ebb7a=0xc8;}else{_0x5ebb7a=0xce;}_0x2d0609[_0x12f5('0x1b')](_0x5ebb7a);return _0x2d0609['set'](_0x12f5('0x20'),_0x5cd328+'-'+_0x650505+'/'+_0x283417)[_0x12f5('0x21')](_0x380650);}return null;};}function saveUpdates(_0x521996){return function(_0x4cc084){if(_0x4cc084){return _0x4cc084[_0x12f5('0x22')](_0x521996)[_0x12f5('0x23')](function(_0x15a644){return _0x15a644;});}return null;};}function removeEntity(_0x3113cf){return function(_0xd5effb){if(_0xd5effb){return _0xd5effb[_0x12f5('0x24')]()[_0x12f5('0x23')](function(){_0x3113cf[_0x12f5('0x1b')](0xcc)[_0x12f5('0x25')]();});}};}function handleEntityNotFound(_0x3a6b38){return function(_0x5b9728){if(!_0x5b9728){_0x3a6b38[_0x12f5('0x26')](0x194);}return _0x5b9728;};}function handleError(_0x1f190d,_0x10d0fa){_0x10d0fa=_0x10d0fa||0x1f4;return function(_0x3b1568){logger[_0x12f5('0x16')](_0x3b1568['stack']);if(_0x3b1568['name']){delete _0x3b1568['name'];}_0x1f190d[_0x12f5('0x1b')](_0x10d0fa)[_0x12f5('0x27')](_0x3b1568);};}exports[_0x12f5('0x28')]=function(_0x4d752f,_0x5d6d76){var _0x55e9e1={},_0x438f7b={},_0x1f516c={'count':0x0,'rows':[]};var _0x5b15db=_['map'](db[_0x12f5('0x29')][_0x12f5('0x2a')],function(_0x800e44){return{'name':_0x800e44[_0x12f5('0x2b')],'type':_0x800e44['type'][_0x12f5('0x2c')]};});_0x438f7b[_0x12f5('0x2d')]=_[_0x12f5('0x2e')](_0x5b15db,_0x12f5('0x2f'));_0x438f7b['query']=_[_0x12f5('0x30')](_0x4d752f[_0x12f5('0x31')]);_0x438f7b['filters']=_[_0x12f5('0x32')](_0x438f7b[_0x12f5('0x2d')],_0x438f7b[_0x12f5('0x31')]);_0x55e9e1[_0x12f5('0x33')]=_[_0x12f5('0x32')](_0x438f7b[_0x12f5('0x2d')],qs[_0x12f5('0x34')](_0x4d752f['query'][_0x12f5('0x34')]));_0x55e9e1['attributes']=_0x55e9e1[_0x12f5('0x33')][_0x12f5('0x35')]?_0x55e9e1[_0x12f5('0x33')]:_0x438f7b[_0x12f5('0x2d')];if(!_0x4d752f[_0x12f5('0x31')][_0x12f5('0x36')](_0x12f5('0x37'))){_0x55e9e1[_0x12f5('0x1f')]=qs[_0x12f5('0x1f')](_0x4d752f[_0x12f5('0x31')][_0x12f5('0x1f')]);_0x55e9e1[_0x12f5('0x1c')]=qs['offset'](_0x4d752f[_0x12f5('0x31')][_0x12f5('0x1c')]);}_0x55e9e1[_0x12f5('0x38')]=qs[_0x12f5('0x39')](_0x4d752f[_0x12f5('0x31')]['sort']);_0x55e9e1[_0x12f5('0x3a')]=qs[_0x12f5('0x3b')](_[_0x12f5('0x3c')](_0x4d752f[_0x12f5('0x31')],_0x438f7b[_0x12f5('0x3b')]),_0x5b15db);if(_0x4d752f[_0x12f5('0x31')][_0x12f5('0x3d')]){_0x55e9e1[_0x12f5('0x3a')]=_[_0x12f5('0x3e')](_0x55e9e1[_0x12f5('0x3a')],{'$or':_['map'](_0x5b15db,function(_0x18cb34){if(_0x18cb34[_0x12f5('0x3f')]!==_0x12f5('0x40')){var _0x54be3a={};_0x54be3a[_0x18cb34[_0x12f5('0x2f')]]={'$like':'%'+_0x4d752f[_0x12f5('0x31')][_0x12f5('0x3d')]+'%'};return _0x54be3a;}})});}_0x55e9e1=_['merge']({},_0x55e9e1,_0x4d752f[_0x12f5('0x41')]);var _0x413d31={'where':_0x55e9e1[_0x12f5('0x3a')]};return db['MailMessage'][_0x12f5('0x1e')](_0x413d31)[_0x12f5('0x23')](function(_0x51796a){_0x1f516c[_0x12f5('0x1e')]=_0x51796a;if(_0x4d752f[_0x12f5('0x31')][_0x12f5('0x42')]){_0x55e9e1[_0x12f5('0x43')]=[{'all':!![]}];}return db[_0x12f5('0x29')]['findAll'](_0x55e9e1);})[_0x12f5('0x23')](function(_0x11a007){_0x1f516c[_0x12f5('0x44')]=_0x11a007;return _0x1f516c;})[_0x12f5('0x23')](respondWithFilteredResult(_0x5d6d76,_0x55e9e1))['catch'](handleError(_0x5d6d76,null));};exports['show']=function(_0x1dfe1d,_0x3e015f){var _0x3d6c43={'raw':!![],'where':{'id':_0x1dfe1d['params']['id']}},_0x26a2f5={};_0x26a2f5[_0x12f5('0x2d')]=_['keys'](db[_0x12f5('0x29')][_0x12f5('0x2a')]);_0x26a2f5['query']=_[_0x12f5('0x30')](_0x1dfe1d[_0x12f5('0x31')]);_0x26a2f5['filters']=_[_0x12f5('0x32')](_0x26a2f5['model'],_0x26a2f5[_0x12f5('0x31')]);_0x3d6c43[_0x12f5('0x33')]=_[_0x12f5('0x32')](_0x26a2f5[_0x12f5('0x2d')],qs['fields'](_0x1dfe1d[_0x12f5('0x31')][_0x12f5('0x34')]));_0x3d6c43[_0x12f5('0x33')]=_0x3d6c43['attributes'][_0x12f5('0x35')]?_0x3d6c43[_0x12f5('0x33')]:_0x26a2f5[_0x12f5('0x2d')];if(_0x1dfe1d['query'][_0x12f5('0x42')]){_0x3d6c43[_0x12f5('0x43')]=[{'all':!![]}];}_0x3d6c43=_[_0x12f5('0x3e')]({},_0x3d6c43,_0x1dfe1d['options']);return db[_0x12f5('0x29')]['find'](_0x3d6c43)[_0x12f5('0x23')](handleEntityNotFound(_0x3e015f,null))[_0x12f5('0x23')](respondWithResult(_0x3e015f,null))[_0x12f5('0x1a')](handleError(_0x3e015f,null));};exports['update']=function(_0x3025c4,_0x7577dd){if(_0x3025c4[_0x12f5('0x45')]['id']){delete _0x3025c4[_0x12f5('0x45')]['id'];}return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x3025c4['params']['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x7577dd,null))['then'](saveUpdates(_0x3025c4[_0x12f5('0x45')],null))[_0x12f5('0x23')](respondWithResult(_0x7577dd,null))[_0x12f5('0x1a')](handleError(_0x7577dd,null));};exports[_0x12f5('0x24')]=function(_0x5745f9,_0x545b71){return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x5745f9[_0x12f5('0x47')]['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x545b71,null))['then'](removeEntity(_0x545b71,null))[_0x12f5('0x1a')](handleError(_0x545b71,null));};exports[_0x12f5('0x48')]=function(_0x8c9aa2,_0x115dee){return db[_0x12f5('0x29')][_0x12f5('0x48')]()[_0x12f5('0x23')](respondWithResult(_0x115dee,null))[_0x12f5('0x1a')](handleError(_0x115dee,null));};exports['create']=function(_0x433f86,_0x325f38){return db['MailMessage'][_0x12f5('0x49')](_0x433f86['body'])[_0x12f5('0x23')](function(_0x5a77db){if(_0x5a77db){if(_0x5a77db[_0x12f5('0x4a')]===_0x12f5('0x4b')&&!_0x5a77db[_0x12f5('0x4c')]){var _0x58ff35,_0x58a4fe,_0x17b74b;if(_0x433f86[_0x12f5('0x45')]['to']){_0x58a4fe=_0x433f86[_0x12f5('0x45')]['to'][_0x12f5('0x4d')](',')[0x0];}return db[_0x12f5('0x4e')][_0x12f5('0x4f')]({'where':{'id':_0x5a77db[_0x12f5('0x50')]},'include':[{'model':db['CmList'],'as':_0x12f5('0x51'),'include':[{'model':db[_0x12f5('0x52')],'as':'Contacts','where':{'email':_0x58a4fe},'limit':0x1,'order':[[_0x12f5('0x53'),_0x12f5('0x54')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x12f5('0x55')],'as':_0x12f5('0x55'),'raw':!![]}]}]})[_0x12f5('0x23')](function(_0x47267a){_0x58ff35=_0x47267a;if(!_0x58ff35||!_0x58ff35[_0x12f5('0x56')])return;var _0x26fcdc=_0x58ff35['getSmtpOptions']();if(_0x433f86[_0x12f5('0x45')][_0x12f5('0x57')]&&_0x433f86['body'][_0x12f5('0x57')]['length']){for(var _0x5dc547=0x0;_0x5dc547<_0x433f86[_0x12f5('0x45')][_0x12f5('0x57')][_0x12f5('0x35')];_0x5dc547+=0x1){_0x433f86['body'][_0x12f5('0x57')][_0x5dc547]={'filename':_0x433f86['body'][_0x12f5('0x57')][_0x5dc547][_0x12f5('0x2f')],'path':path['join'](config['root'],_0x12f5('0x58'),_0x433f86['body'][_0x12f5('0x57')][_0x5dc547][_0x12f5('0x59')])};}}_0x17b74b={'account':_0x26fcdc,'message':_0x433f86[_0x12f5('0x45')]};return;})[_0x12f5('0x23')](function(){if(_0x58ff35['List']){if(_0x58ff35[_0x12f5('0x51')][_0x12f5('0x5a')][_0x12f5('0x35')]){return _0x58ff35[_0x12f5('0x51')][_0x12f5('0x5a')][0x0];}else{return db[_0x12f5('0x52')]['create'](_[_0x12f5('0xb')](_0x433f86[_0x12f5('0x45')],{'firstName':_0x433f86['body']['to'],'email':_0x433f86[_0x12f5('0x45')]['to'],'phone':_0x433f86[_0x12f5('0x45')]['to'],'ListId':_0x58ff35[_0x12f5('0x5b')]}));}}else{throw new Error(_0x12f5('0x5c'));}})[_0x12f5('0x23')](function(){if(_0x17b74b){return respondWithRpcPromise(_0x12f5('0x5d'),'sendMail',_0x17b74b,client9003)[_0x12f5('0x23')](function(_0x148bf3){return _0x5a77db[_0x12f5('0x22')]({'read':!![],'messageId':_0x148bf3['messageId'],'sentAt':moment()[_0x12f5('0x5e')](_0x12f5('0x5f'))});})[_0x12f5('0x1a')](function(_0x3710db){logger['error']('%s',JSON[_0x12f5('0x60')](_0x3710db));return _0x5a77db;});}return _0x5a77db;});}return _0x5a77db;}})[_0x12f5('0x23')](respondWithResult(_0x325f38,0xc9))['catch'](handleError(_0x325f38,null));};exports[_0x12f5('0x61')]=function(_0x33e67b,_0x4b370b){var _0x2021b1={'agent':{},'channel':_0x12f5('0x62')};if(_0x33e67b['body']['id']){delete _0x33e67b['body']['id'];}_0x33e67b['body'][_0x12f5('0x63')]=!![];_0x33e67b[_0x12f5('0x45')]['readAt']=moment()[_0x12f5('0x5e')](_0x12f5('0x5f'));_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')]=_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')]||_0x33e67b[_0x12f5('0x65')]['id'];_0x2021b1[_0x12f5('0x66')]['id']=_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')];return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x33e67b[_0x12f5('0x47')]['id'],'UserId':null}})[_0x12f5('0x23')](handleEntityNotFound(_0x4b370b,null))[_0x12f5('0x23')](saveUpdates(_0x33e67b['body'],null))[_0x12f5('0x23')](function(_0x402fb6){if(_0x402fb6){_0x2021b1[_0x12f5('0x18')]=_0x402fb6['get']({'plain':!![]});return db[_0x12f5('0x67')]['find']({'where':{'id':_0x402fb6[_0x12f5('0x68')]}});}return null;})[_0x12f5('0x23')](handleEntityNotFound(_0x4b370b,null))[_0x12f5('0x23')](function(_0xd0c9e4){if(_0xd0c9e4){return _0xd0c9e4[_0x12f5('0x22')]({'UserId':_0x33e67b['body']['UserId'],'read1stAt':_[_0x12f5('0x69')](_0xd0c9e4[_0x12f5('0x6a')])?moment()[_0x12f5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x12f5('0x23')](function(_0x262673){if(_0x262673){_0x2021b1[_0x12f5('0x6b')]=_0x262673[_0x12f5('0x6c')]({'plain':!![]});interaction_log[_0x12f5('0x12')](_0x12f5('0x6d'),_0x33e67b[_0x12f5('0x65')]['id'],_0x33e67b[_0x12f5('0x65')]['name'],_0x33e67b[_0x12f5('0x65')][_0x12f5('0x6e')],_0x2021b1[_0x12f5('0x6b')]['id'],_0x33e67b['body']?JSON['stringify'](_0x33e67b['body']):_0x12f5('0x6f'));return respondWithRpcPromise(_0x12f5('0x70'),'acceptMessage',_0x2021b1);}return null;})['then'](function(_0x21611e){var _0x2f947f=_0x12f5('0x71')+_0x21611e[_0x12f5('0x18')]['ContactId'];return db[_0x12f5('0x72')][_0x12f5('0x31')](_0x2f947f,{'type':db[_0x12f5('0x73')][_0x12f5('0x74')][_0x12f5('0x75')],'raw':!![]})[_0x12f5('0x23')](function(_0x4df5f7){return _0x4df5f7;});})[_0x12f5('0x23')](function(_0x3ee88a){if(_0x3ee88a){_0x2021b1['message'][_0x12f5('0x76')]=_0x3ee88a[0x0];if(!_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')])return;return db['User'][_0x12f5('0x46')]({'where':{'id':_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')],'role':_0x12f5('0x66')},'attributes':['id',_0x12f5('0x2f'),_0x12f5('0x77'),_0x12f5('0x78'),_0x12f5('0x79')],'raw':!![]});}return null;})[_0x12f5('0x23')](function(_0x22b566){if(!_0x22b566)return null;_0x2021b1['message'][_0x12f5('0x66')]=_0x22b566;return _0x2021b1;})[_0x12f5('0x23')](function(_0x2ad48c){if(_0x2ad48c){if(_0x33e67b[_0x12f5('0x45')][_0x12f5('0x7a')]){_0x2021b1[_0x12f5('0x18')][_0x12f5('0x7b')]=util[_0x12f5('0x5e')]('SIP/%s',_0x33e67b[_0x12f5('0x65')][_0x12f5('0x2f')]);_0x2021b1[_0x12f5('0x18')][_0x12f5('0x7c')]=_0x2021b1[_0x12f5('0x7c')];_0x2021b1[_0x12f5('0x18')]['motionChannel']=_0x2021b1['channel'];_0x2021b1[_0x12f5('0x18')]['event']=_0x12f5('0x61');_0x2021b1[_0x12f5('0x18')]['body']=htmlToText['fromString'](_0x2021b1[_0x12f5('0x18')][_0x12f5('0x45')]);return respondWithRpcPromise(_0x12f5('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x2021b1['message']},client9002)[_0x12f5('0x23')](function(){return _0x2021b1;});}return _0x2021b1;}return null;})[_0x12f5('0x23')](respondWithResult(_0x4b370b,null))[_0x12f5('0x1a')](handleError(_0x4b370b,null));};exports['reject']=function(_0xba35a9,_0x21e97a){var _0x1862b7={'agent':{},'channel':_0x12f5('0x62')};if(_0xba35a9['body']['id']){delete _0xba35a9[_0x12f5('0x45')]['id'];}_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')]=_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')]||_0xba35a9[_0x12f5('0x65')]['id'];_0x1862b7[_0x12f5('0x66')]['id']=_0xba35a9['body'][_0x12f5('0x64')];return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0xba35a9[_0x12f5('0x47')]['id'],'UserId':null}})[_0x12f5('0x23')](handleEntityNotFound(_0x21e97a,null))[_0x12f5('0x23')](function(_0x419dbe){if(_0x419dbe){_0x1862b7[_0x12f5('0x18')]=_0x419dbe[_0x12f5('0x6c')]({'plain':!![]});return db['MailInteraction'][_0x12f5('0x46')]({'where':{'id':_0x419dbe[_0x12f5('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x21e97a,null))[_0x12f5('0x23')](function(_0x52355f){if(_0x52355f){_0x1862b7[_0x12f5('0x6b')]=_0x52355f[_0x12f5('0x6c')]({'plain':!![]});interaction_log[_0x12f5('0x12')](_0x12f5('0x7e'),_0xba35a9['user']['id'],_0xba35a9[_0x12f5('0x65')]['name'],_0xba35a9[_0x12f5('0x65')][_0x12f5('0x6e')],_0x1862b7['interaction']['id'],_0xba35a9['body']?JSON[_0x12f5('0x60')](_0xba35a9[_0x12f5('0x45')]):_0x12f5('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1862b7);}return null;})['then'](function(_0x467a7a){var _0x5ccac8=_0x12f5('0x71')+_0x467a7a[_0x12f5('0x18')]['ContactId'];return db[_0x12f5('0x72')][_0x12f5('0x31')](_0x5ccac8,{'type':db[_0x12f5('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x12f5('0x23')](function(_0x18907a){return _0x18907a;});})[_0x12f5('0x23')](function(_0x558c6a){if(_0x558c6a){_0x1862b7[_0x12f5('0x18')][_0x12f5('0x76')]=_0x558c6a[0x0];if(!_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')])return;return db['User']['find']({'where':{'id':_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')],'role':'agent'},'attributes':['id',_0x12f5('0x2f'),_0x12f5('0x77'),_0x12f5('0x78'),'internal'],'raw':!![]});}return null;})[_0x12f5('0x23')](function(_0x4fed6c){if(!_0x4fed6c)return null;_0x1862b7[_0x12f5('0x18')][_0x12f5('0x66')]=_0x4fed6c;return _0x1862b7;})[_0x12f5('0x23')](function(_0x18e1a6){if(_0x18e1a6){_0x18e1a6[_0x12f5('0x18')][_0x12f5('0x7b')]=util[_0x12f5('0x5e')](_0x12f5('0x7f'),_0xba35a9[_0x12f5('0x65')][_0x12f5('0x2f')]);_0x18e1a6[_0x12f5('0x18')][_0x12f5('0x7c')]=_0x1862b7[_0x12f5('0x7c')];_0x18e1a6[_0x12f5('0x18')]['motionChannel']=_0x1862b7[_0x12f5('0x7c')];_0x18e1a6['message'][_0x12f5('0x80')]=_0x12f5('0x81');_0x18e1a6[_0x12f5('0x18')]['body']=htmlToText[_0x12f5('0x82')](_0x1862b7[_0x12f5('0x18')]['body']);respondWithRpcPromise(_0x12f5('0x7d'),_0x12f5('0x7d'),{'event':'rejectmessage','message':_0x18e1a6[_0x12f5('0x18')]},client9002);return _0x1862b7;}return null;})['then'](respondWithResult(_0x21e97a,null))[_0x12f5('0x1a')](handleError(_0x21e97a,null));};exports['download']=function(_0x207a6b,_0x147c8b){var _0x5290f6=moment()[_0x12f5('0x83')]()[_0x12f5('0x84')]();var _0x1c07f5=path[_0x12f5('0x85')](config['root'],'server','files',_0x12f5('0x86'));var _0x120893=path[_0x12f5('0x85')](config['root'],'server',_0x12f5('0x87'),_0x12f5('0x57'));var _0x2ab3a3=util['format']('message-%s.eml',_0x5290f6);return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x207a6b[_0x12f5('0x47')]['id']},'attributes':['id',_0x12f5('0x45'),'from','to','cc',_0x12f5('0x88'),_0x12f5('0x89'),_0x12f5('0x8a')],'include':_0x207a6b['query']['attachments']?[{'model':db['Attachment'],'as':_0x12f5('0x8b')}]:undefined})[_0x12f5('0x23')](handleEntityNotFound(_0x147c8b,null))['then'](function(_0x2d5ad9){if(_0x2d5ad9){var _0x5065c4=_0x2d5ad9;var _0x381814={'from':_0x5065c4[_0x12f5('0x8c')],'to':_0x5065c4['to'],'subject':_0x5065c4['subject'],'html':htmlEntities[_0x12f5('0x8d')](_0x5065c4['body']),'headers':{'Date':moment(_0x5065c4[_0x12f5('0x8a')])[_0x12f5('0x5e')](_0x12f5('0x8e'))},'attachments':[]};if(_0x2d5ad9['cc']){_0x381814[_0x12f5('0x8f')]['Cc']=_0x2d5ad9['cc'];}if(_0x2d5ad9[_0x12f5('0x88')]){_0x381814[_0x12f5('0x8f')]['Bcc']=_0x2d5ad9['bcc'];}return new BPromise(function(_0x5bc45c,_0xe4b5d9){if(_0x2d5ad9[_0x12f5('0x8b')]){for(var _0x403c8f=0x0;_0x403c8f<_0x2d5ad9[_0x12f5('0x8b')][_0x12f5('0x35')];_0x403c8f++){var _0x804c2e=_0x2d5ad9[_0x12f5('0x8b')][_0x403c8f];var _0x7015b1=path[_0x12f5('0x85')](_0x120893,_0x804c2e[_0x12f5('0x59')]);if(fs['existsSync'](_0x7015b1)){_0x381814[_0x12f5('0x57')][_0x12f5('0x90')]({'name':_0x804c2e['name'],'contentType':_0x804c2e[_0x12f5('0x3f')],'data':fs['readFileSync'](_0x7015b1)});}}}emlformat['build'](_0x381814,function(_0x576ba9,_0x4895ff){if(_0x576ba9)return _0xe4b5d9(_0x576ba9);fs['writeFileSync'](path[_0x12f5('0x85')](_0x1c07f5,_0x2ab3a3),_0x4895ff);return _0x5bc45c(_0x4895ff);});});}})[_0x12f5('0x23')](function(_0x4a0ba9){if(_0x4a0ba9){return _0x147c8b['download'](path['join'](_0x1c07f5,_0x2ab3a3),_0x2ab3a3,function(_0x155e13){if(!_0x155e13)fs[_0x12f5('0x91')](path[_0x12f5('0x85')](_0x1c07f5,_0x2ab3a3));});}})[_0x12f5('0x1a')](handleError(_0x147c8b,null));}; \ No newline at end of file +var _0xc308=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','stack','name','send','map','MailMessage','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','body','describe','create','direction','secret','split','MailAccount','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','QueryTypes','email','SIP/%s','event','unix','files','tmp','join','server','from','bcc','subject','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','download','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then'];(function(_0x6690de,_0x565515){var _0x344c35=function(_0x37a92e){while(--_0x37a92e){_0x6690de['push'](_0x6690de['shift']());}};_0x344c35(++_0x565515);}(_0xc308,0x1c3));var _0x8c30=function(_0x246119,_0x30a4f3){_0x246119=_0x246119-0x0;var _0x59c74f=_0xc308[_0x246119];return _0x59c74f;};'use strict';var emlformat=require(_0x8c30('0x0'));var moment=require(_0x8c30('0x1'));var BPromise=require(_0x8c30('0x2'));var util=require(_0x8c30('0x3'));var path=require(_0x8c30('0x4'));var fs=require('fs');var _=require(_0x8c30('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x8c30('0x6'));var qs=require(_0x8c30('0x7'));var logger=require(_0x8c30('0x8'))(_0x8c30('0x9'));var interaction_log=require('../../config/logger')(_0x8c30('0xa'));var config=require('../../config/environment');var db=require(_0x8c30('0xb'))['db'];config['redis']=_[_0x8c30('0xc')](config[_0x8c30('0xd')],{'host':_0x8c30('0xe'),'port':0x18eb});var socket=require(_0x8c30('0xf'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x8c30('0x10'))[_0x8c30('0x11')](socket);var jayson=require(_0x8c30('0x12'));var client=jayson['client'][_0x8c30('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x8c30('0x13')]({'port':0x232b});var client9002=jayson[_0x8c30('0x14')][_0x8c30('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x2fefd4,_0x1ce7ca,_0x408ba2,_0x177011){return new BPromise(function(_0x3ad508,_0xf25813){var _0x4254c5=_0x177011||client;return _0x4254c5[_0x8c30('0x15')](_0x2fefd4,_0x408ba2)[_0x8c30('0x16')](function(_0x34dd0c){logger['info'](_0x8c30('0x17'),_0x1ce7ca,_0x8c30('0x18'));logger[_0x8c30('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1ce7ca,_0x8c30('0x18'),JSON[_0x8c30('0x1a')](_0x34dd0c));if(_0x34dd0c[_0x8c30('0x1b')]){if(_0x34dd0c[_0x8c30('0x1b')]['code']===0x1f4){logger[_0x8c30('0x1b')]('MailMessage,\x20%s,\x20%s',_0x1ce7ca,_0x34dd0c[_0x8c30('0x1b')][_0x8c30('0x1c')]);return _0xf25813(_0x34dd0c['error']['message']);}logger['error'](_0x8c30('0x17'),_0x1ce7ca,_0x34dd0c['error'][_0x8c30('0x1c')]);return _0x3ad508(_0x34dd0c[_0x8c30('0x1b')]['message']);}else{logger[_0x8c30('0x1d')]('MailMessage,\x20%s,\x20%s',_0x1ce7ca,_0x8c30('0x18'));_0x3ad508(_0x34dd0c[_0x8c30('0x1e')][_0x8c30('0x1c')]);}})[_0x8c30('0x1f')](function(_0x45d908){logger[_0x8c30('0x1b')](_0x8c30('0x17'),_0x1ce7ca,_0x45d908);_0xf25813(_0x45d908);});});}function respondWithResult(_0x4c9927,_0x2bde6a){_0x2bde6a=_0x2bde6a||0xc8;return function(_0x9711f5){if(_0x9711f5){return _0x4c9927[_0x8c30('0x20')](_0x2bde6a)[_0x8c30('0x21')](_0x9711f5);}};}function respondWithFilteredResult(_0x3854b8,_0x129ff4){return function(_0x2affe3){if(_0x2affe3){var _0x55e120=typeof _0x129ff4[_0x8c30('0x22')]==='undefined'&&typeof _0x129ff4[_0x8c30('0x23')]===_0x8c30('0x24');var _0x57728a=_0x2affe3[_0x8c30('0x25')];var _0x20653e=_0x55e120?0x0:_0x129ff4['offset'];var _0x1e2e8c=_0x55e120?_0x2affe3[_0x8c30('0x25')]:_0x129ff4[_0x8c30('0x22')]+_0x129ff4[_0x8c30('0x23')];var _0x3cd9d8;if(_0x1e2e8c>=_0x57728a){_0x1e2e8c=_0x57728a;_0x3cd9d8=0xc8;}else{_0x3cd9d8=0xce;}_0x3854b8[_0x8c30('0x20')](_0x3cd9d8);return _0x3854b8[_0x8c30('0x26')](_0x8c30('0x27'),_0x20653e+'-'+_0x1e2e8c+'/'+_0x57728a)[_0x8c30('0x21')](_0x2affe3);}return null;};}function saveUpdates(_0x782b79){return function(_0x5df2d1){if(_0x5df2d1){return _0x5df2d1[_0x8c30('0x28')](_0x782b79)[_0x8c30('0x16')](function(_0x153e6b){return _0x153e6b;});}return null;};}function removeEntity(_0x376206){return function(_0x5af4b8){if(_0x5af4b8){return _0x5af4b8[_0x8c30('0x29')]()[_0x8c30('0x16')](function(){_0x376206[_0x8c30('0x20')](0xcc)[_0x8c30('0x2a')]();});}};}function handleEntityNotFound(_0x585b87){return function(_0x8b1006){if(!_0x8b1006){_0x585b87['sendStatus'](0x194);}return _0x8b1006;};}function handleError(_0xde4450,_0x437442){_0x437442=_0x437442||0x1f4;return function(_0x470eea){logger[_0x8c30('0x1b')](_0x470eea[_0x8c30('0x2b')]);if(_0x470eea[_0x8c30('0x2c')]){delete _0x470eea[_0x8c30('0x2c')];}_0xde4450['status'](_0x437442)[_0x8c30('0x2d')](_0x470eea);};}exports['index']=function(_0x4ff1d7,_0x1d9fa8){var _0x1205f4={},_0x1ab9cc={},_0x3ba808={'count':0x0,'rows':[]};var _0x22df07=_[_0x8c30('0x2e')](db[_0x8c30('0x2f')]['rawAttributes'],function(_0x53c52d){return{'name':_0x53c52d[_0x8c30('0x30')],'type':_0x53c52d[_0x8c30('0x31')][_0x8c30('0x32')]};});_0x1ab9cc['model']=_[_0x8c30('0x2e')](_0x22df07,'name');_0x1ab9cc[_0x8c30('0x33')]=_[_0x8c30('0x34')](_0x4ff1d7['query']);_0x1ab9cc[_0x8c30('0x35')]=_[_0x8c30('0x36')](_0x1ab9cc[_0x8c30('0x37')],_0x1ab9cc['query']);_0x1205f4['attributes']=_['intersection'](_0x1ab9cc[_0x8c30('0x37')],qs[_0x8c30('0x38')](_0x4ff1d7['query'][_0x8c30('0x38')]));_0x1205f4['attributes']=_0x1205f4[_0x8c30('0x39')][_0x8c30('0x3a')]?_0x1205f4[_0x8c30('0x39')]:_0x1ab9cc[_0x8c30('0x37')];if(!_0x4ff1d7['query'][_0x8c30('0x3b')](_0x8c30('0x3c'))){_0x1205f4['limit']=qs[_0x8c30('0x23')](_0x4ff1d7[_0x8c30('0x33')][_0x8c30('0x23')]);_0x1205f4[_0x8c30('0x22')]=qs[_0x8c30('0x22')](_0x4ff1d7[_0x8c30('0x33')][_0x8c30('0x22')]);}_0x1205f4[_0x8c30('0x3d')]=qs['sort'](_0x4ff1d7[_0x8c30('0x33')][_0x8c30('0x3e')]);_0x1205f4['where']=qs[_0x8c30('0x35')](_[_0x8c30('0x3f')](_0x4ff1d7[_0x8c30('0x33')],_0x1ab9cc['filters']),_0x22df07);if(_0x4ff1d7['query'][_0x8c30('0x40')]){_0x1205f4[_0x8c30('0x41')]=_['merge'](_0x1205f4[_0x8c30('0x41')],{'$or':_[_0x8c30('0x2e')](_0x22df07,function(_0x562295){if(_0x562295['type']!==_0x8c30('0x42')){var _0x4c066f={};_0x4c066f[_0x562295[_0x8c30('0x2c')]]={'$like':'%'+_0x4ff1d7[_0x8c30('0x33')]['filter']+'%'};return _0x4c066f;}})});}_0x1205f4=_['merge']({},_0x1205f4,_0x4ff1d7[_0x8c30('0x43')]);var _0x2e6290={'where':_0x1205f4[_0x8c30('0x41')]};return db['MailMessage'][_0x8c30('0x25')](_0x2e6290)['then'](function(_0x3cfea9){_0x3ba808['count']=_0x3cfea9;if(_0x4ff1d7['query'][_0x8c30('0x44')]){_0x1205f4['include']=[{'all':!![]}];}return db[_0x8c30('0x2f')][_0x8c30('0x45')](_0x1205f4);})[_0x8c30('0x16')](function(_0x48ee96){_0x3ba808[_0x8c30('0x46')]=_0x48ee96;return _0x3ba808;})[_0x8c30('0x16')](respondWithFilteredResult(_0x1d9fa8,_0x1205f4))[_0x8c30('0x1f')](handleError(_0x1d9fa8,null));};exports[_0x8c30('0x47')]=function(_0xfb2fd5,_0xefcc60){var _0x24d7cc={'raw':!![],'where':{'id':_0xfb2fd5[_0x8c30('0x48')]['id']}},_0x350784={};_0x350784['model']=_['keys'](db[_0x8c30('0x2f')][_0x8c30('0x49')]);_0x350784['query']=_['keys'](_0xfb2fd5[_0x8c30('0x33')]);_0x350784[_0x8c30('0x35')]=_[_0x8c30('0x36')](_0x350784[_0x8c30('0x37')],_0x350784[_0x8c30('0x33')]);_0x24d7cc[_0x8c30('0x39')]=_[_0x8c30('0x36')](_0x350784[_0x8c30('0x37')],qs[_0x8c30('0x38')](_0xfb2fd5[_0x8c30('0x33')][_0x8c30('0x38')]));_0x24d7cc[_0x8c30('0x39')]=_0x24d7cc[_0x8c30('0x39')][_0x8c30('0x3a')]?_0x24d7cc[_0x8c30('0x39')]:_0x350784['model'];if(_0xfb2fd5[_0x8c30('0x33')][_0x8c30('0x44')]){_0x24d7cc[_0x8c30('0x4a')]=[{'all':!![]}];}_0x24d7cc=_['merge']({},_0x24d7cc,_0xfb2fd5[_0x8c30('0x43')]);return db[_0x8c30('0x2f')]['find'](_0x24d7cc)[_0x8c30('0x16')](handleEntityNotFound(_0xefcc60,null))[_0x8c30('0x16')](respondWithResult(_0xefcc60,null))[_0x8c30('0x1f')](handleError(_0xefcc60,null));};exports[_0x8c30('0x28')]=function(_0x5e1829,_0x1e447b){if(_0x5e1829['body']['id']){delete _0x5e1829['body']['id'];}return db[_0x8c30('0x2f')][_0x8c30('0x4b')]({'where':{'id':_0x5e1829[_0x8c30('0x48')]['id']}})[_0x8c30('0x16')](handleEntityNotFound(_0x1e447b,null))['then'](saveUpdates(_0x5e1829[_0x8c30('0x4c')],null))[_0x8c30('0x16')](respondWithResult(_0x1e447b,null))[_0x8c30('0x1f')](handleError(_0x1e447b,null));};exports[_0x8c30('0x29')]=function(_0x55d536,_0xc68439){return db[_0x8c30('0x2f')][_0x8c30('0x4b')]({'where':{'id':_0x55d536[_0x8c30('0x48')]['id']}})[_0x8c30('0x16')](handleEntityNotFound(_0xc68439,null))[_0x8c30('0x16')](removeEntity(_0xc68439,null))[_0x8c30('0x1f')](handleError(_0xc68439,null));};exports['describe']=function(_0x4668aa,_0x25c296){return db[_0x8c30('0x2f')][_0x8c30('0x4d')]()[_0x8c30('0x16')](respondWithResult(_0x25c296,null))[_0x8c30('0x1f')](handleError(_0x25c296,null));};exports[_0x8c30('0x4e')]=function(_0x73c218,_0x4af74a){return db[_0x8c30('0x2f')][_0x8c30('0x4e')](_0x73c218[_0x8c30('0x4c')])['then'](function(_0xf4dcb8){if(_0xf4dcb8){if(_0xf4dcb8[_0x8c30('0x4f')]==='out'&&!_0xf4dcb8[_0x8c30('0x50')]){var _0x2a4d57,_0x27aecf,_0x4c3e0f;if(_0x73c218[_0x8c30('0x4c')]['to']){_0x27aecf=_0x73c218[_0x8c30('0x4c')]['to'][_0x8c30('0x51')](',')[0x0];}return db[_0x8c30('0x52')]['findOne']({'where':{'id':_0xf4dcb8[_0x8c30('0x53')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8c30('0x54')],'as':_0x8c30('0x55'),'where':{'email':_0x27aecf},'limit':0x1,'order':[[_0x8c30('0x56'),_0x8c30('0x57')]]}]},{'model':db[_0x8c30('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8c30('0x59')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x171288){_0x2a4d57=_0x171288;if(!_0x2a4d57||!_0x2a4d57['Smtp'])return;var _0x38dd0d=_0x2a4d57['getSmtpOptions']();if(_0x73c218[_0x8c30('0x4c')]['attachments']&&_0x73c218[_0x8c30('0x4c')][_0x8c30('0x5a')]['length']){for(var _0x2cafb9=0x0;_0x2cafb9<_0x73c218[_0x8c30('0x4c')][_0x8c30('0x5a')][_0x8c30('0x3a')];_0x2cafb9+=0x1){_0x73c218[_0x8c30('0x4c')][_0x8c30('0x5a')][_0x2cafb9]={'filename':_0x73c218[_0x8c30('0x4c')]['attachments'][_0x2cafb9][_0x8c30('0x2c')],'path':path['join'](config[_0x8c30('0x5b')],_0x8c30('0x5c'),_0x73c218[_0x8c30('0x4c')][_0x8c30('0x5a')][_0x2cafb9][_0x8c30('0x5d')])};}}_0x4c3e0f={'account':_0x38dd0d,'message':_0x73c218[_0x8c30('0x4c')]};return;})[_0x8c30('0x16')](function(){if(_0x2a4d57[_0x8c30('0x5e')]){if(_0x2a4d57[_0x8c30('0x5e')][_0x8c30('0x55')][_0x8c30('0x3a')]){return _0x2a4d57['List']['Contacts'][0x0];}else{return db[_0x8c30('0x54')]['create'](_[_0x8c30('0xc')](_0x73c218[_0x8c30('0x4c')],{'firstName':_0x73c218[_0x8c30('0x4c')]['to'],'email':_0x73c218['body']['to'],'phone':_0x73c218[_0x8c30('0x4c')]['to'],'ListId':_0x2a4d57[_0x8c30('0x5f')]}));}}else{throw new Error(_0x8c30('0x60'));}})[_0x8c30('0x16')](function(){if(_0x4c3e0f){return respondWithRpcPromise(_0x8c30('0x61'),'sendMail',_0x4c3e0f,client9003)[_0x8c30('0x16')](function(_0x20a69f){return _0xf4dcb8['update']({'read':!![],'messageId':_0x20a69f[_0x8c30('0x62')],'sentAt':moment()[_0x8c30('0x63')](_0x8c30('0x64'))});})[_0x8c30('0x1f')](function(_0x430b01){logger[_0x8c30('0x1b')]('%s',JSON[_0x8c30('0x1a')](_0x430b01));return _0xf4dcb8;});}return _0xf4dcb8;});}return _0xf4dcb8;}})['then'](respondWithResult(_0x4af74a,0xc9))[_0x8c30('0x1f')](handleError(_0x4af74a,null));};exports['accept']=function(_0x1bd256,_0x504040){var _0x2dbc87={'agent':{},'channel':_0x8c30('0x65')};if(_0x1bd256['body']['id']){delete _0x1bd256['body']['id'];}_0x1bd256['body']['read']=!![];_0x1bd256['body'][_0x8c30('0x66')]=moment()[_0x8c30('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bd256[_0x8c30('0x4c')][_0x8c30('0x67')]=_0x1bd256[_0x8c30('0x4c')]['UserId']||_0x1bd256[_0x8c30('0x68')]['id'];_0x2dbc87[_0x8c30('0x69')]['id']=_0x1bd256[_0x8c30('0x4c')][_0x8c30('0x67')];return db['MailMessage']['find']({'where':{'id':_0x1bd256[_0x8c30('0x48')]['id'],'UserId':null}})[_0x8c30('0x16')](handleEntityNotFound(_0x504040,null))['then'](saveUpdates(_0x1bd256[_0x8c30('0x4c')],null))[_0x8c30('0x16')](function(_0x133f7d){if(_0x133f7d){_0x2dbc87[_0x8c30('0x1c')]=_0x133f7d[_0x8c30('0x6a')]({'plain':!![]});return db[_0x8c30('0x6b')]['find']({'where':{'id':_0x133f7d[_0x8c30('0x6c')]}});}return null;})[_0x8c30('0x16')](handleEntityNotFound(_0x504040,null))[_0x8c30('0x16')](function(_0x34f2d8){if(_0x34f2d8){return _0x34f2d8[_0x8c30('0x28')]({'UserId':_0x1bd256[_0x8c30('0x4c')][_0x8c30('0x67')],'read1stAt':_[_0x8c30('0x6d')](_0x34f2d8[_0x8c30('0x6e')])?moment()[_0x8c30('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x46ce52){if(_0x46ce52){_0x2dbc87[_0x8c30('0x6f')]=_0x46ce52['get']({'plain':!![]});interaction_log[_0x8c30('0x1d')](_0x8c30('0x70'),_0x1bd256[_0x8c30('0x68')]['id'],_0x1bd256[_0x8c30('0x68')][_0x8c30('0x2c')],_0x1bd256[_0x8c30('0x68')][_0x8c30('0x71')],_0x2dbc87[_0x8c30('0x6f')]['id'],_0x1bd256['body']?JSON[_0x8c30('0x1a')](_0x1bd256[_0x8c30('0x4c')]):'null');return respondWithRpcPromise(_0x8c30('0x72'),_0x8c30('0x73'),_0x2dbc87);}return null;})[_0x8c30('0x16')](function(_0x537b35){var _0x28ca4d=_0x8c30('0x74')+_0x537b35['message'][_0x8c30('0x75')];return db[_0x8c30('0x76')][_0x8c30('0x33')](_0x28ca4d,{'type':db['Sequelize']['QueryTypes'][_0x8c30('0x77')],'raw':!![]})['then'](function(_0x375eba){return _0x375eba;});})['then'](function(_0x35a7a7){if(_0x35a7a7){_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x78')]=_0x35a7a7[0x0];if(!_0x1bd256[_0x8c30('0x4c')][_0x8c30('0x67')])return;return db[_0x8c30('0x79')][_0x8c30('0x4b')]({'where':{'id':_0x1bd256[_0x8c30('0x4c')][_0x8c30('0x67')],'role':_0x8c30('0x69')},'attributes':['id',_0x8c30('0x2c'),_0x8c30('0x7a'),'email',_0x8c30('0x7b')],'raw':!![]});}return null;})[_0x8c30('0x16')](function(_0x2fa072){if(!_0x2fa072)return null;_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x69')]=_0x2fa072;return _0x2dbc87;})[_0x8c30('0x16')](function(_0x55592a){if(_0x55592a){if(_0x1bd256['body'][_0x8c30('0x7c')]){_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x7d')]=util[_0x8c30('0x63')]('SIP/%s',_0x1bd256['user']['name']);_0x2dbc87['message'][_0x8c30('0x7e')]=_0x2dbc87[_0x8c30('0x7e')];_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x7f')]=_0x2dbc87[_0x8c30('0x7e')];_0x2dbc87[_0x8c30('0x1c')]['event']='accept';_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x4c')]=htmlToText[_0x8c30('0x80')](_0x2dbc87[_0x8c30('0x1c')][_0x8c30('0x4c')]);return respondWithRpcPromise(_0x8c30('0x81'),_0x8c30('0x81'),{'event':'acceptmessage','message':_0x2dbc87['message']},client9002)[_0x8c30('0x16')](function(){return _0x2dbc87;});}return _0x2dbc87;}return null;})[_0x8c30('0x16')](respondWithResult(_0x504040,null))[_0x8c30('0x1f')](handleError(_0x504040,null));};exports[_0x8c30('0x82')]=function(_0x15be6c,_0x3c9fb8){var _0x1f8f55={'agent':{},'channel':_0x8c30('0x65')};if(_0x15be6c[_0x8c30('0x4c')]['id']){delete _0x15be6c[_0x8c30('0x4c')]['id'];}_0x15be6c[_0x8c30('0x4c')][_0x8c30('0x67')]=_0x15be6c['body'][_0x8c30('0x67')]||_0x15be6c[_0x8c30('0x68')]['id'];_0x1f8f55[_0x8c30('0x69')]['id']=_0x15be6c['body'][_0x8c30('0x67')];return db[_0x8c30('0x2f')]['find']({'where':{'id':_0x15be6c[_0x8c30('0x48')]['id'],'UserId':null}})[_0x8c30('0x16')](handleEntityNotFound(_0x3c9fb8,null))['then'](function(_0x27b986){if(_0x27b986){_0x1f8f55[_0x8c30('0x1c')]=_0x27b986[_0x8c30('0x6a')]({'plain':!![]});return db[_0x8c30('0x6b')][_0x8c30('0x4b')]({'where':{'id':_0x27b986[_0x8c30('0x6c')]}});}return null;})[_0x8c30('0x16')](handleEntityNotFound(_0x3c9fb8,null))['then'](function(_0x1b8948){if(_0x1b8948){_0x1f8f55[_0x8c30('0x6f')]=_0x1b8948[_0x8c30('0x6a')]({'plain':!![]});interaction_log['info'](_0x8c30('0x83'),_0x15be6c[_0x8c30('0x68')]['id'],_0x15be6c['user']['name'],_0x15be6c['user'][_0x8c30('0x71')],_0x1f8f55[_0x8c30('0x6f')]['id'],_0x15be6c[_0x8c30('0x4c')]?JSON[_0x8c30('0x1a')](_0x15be6c[_0x8c30('0x4c')]):_0x8c30('0x84'));return respondWithRpcPromise(_0x8c30('0x85'),'rejectMessage',_0x1f8f55);}return null;})[_0x8c30('0x16')](function(_0x19bb20){var _0x220262='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x19bb20[_0x8c30('0x1c')][_0x8c30('0x75')];return db[_0x8c30('0x76')]['query'](_0x220262,{'type':db[_0x8c30('0x86')][_0x8c30('0x87')][_0x8c30('0x77')],'raw':!![]})[_0x8c30('0x16')](function(_0x6688b){return _0x6688b;});})['then'](function(_0x88594f){if(_0x88594f){_0x1f8f55['message'][_0x8c30('0x78')]=_0x88594f[0x0];if(!_0x15be6c[_0x8c30('0x4c')]['UserId'])return;return db['User'][_0x8c30('0x4b')]({'where':{'id':_0x15be6c[_0x8c30('0x4c')]['UserId'],'role':_0x8c30('0x69')},'attributes':['id',_0x8c30('0x2c'),_0x8c30('0x7a'),_0x8c30('0x88'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5b5d98){if(!_0x5b5d98)return null;_0x1f8f55[_0x8c30('0x1c')][_0x8c30('0x69')]=_0x5b5d98;return _0x1f8f55;})[_0x8c30('0x16')](function(_0x512541){if(_0x512541){_0x512541[_0x8c30('0x1c')][_0x8c30('0x7d')]=util[_0x8c30('0x63')](_0x8c30('0x89'),_0x15be6c[_0x8c30('0x68')][_0x8c30('0x2c')]);_0x512541[_0x8c30('0x1c')][_0x8c30('0x7e')]=_0x1f8f55[_0x8c30('0x7e')];_0x512541[_0x8c30('0x1c')][_0x8c30('0x7f')]=_0x1f8f55['channel'];_0x512541[_0x8c30('0x1c')][_0x8c30('0x8a')]='reject';_0x512541[_0x8c30('0x1c')][_0x8c30('0x4c')]=htmlToText['fromString'](_0x1f8f55[_0x8c30('0x1c')]['body']);respondWithRpcPromise('EventManager',_0x8c30('0x81'),{'event':'rejectmessage','message':_0x512541['message']},client9002);return _0x1f8f55;}return null;})[_0x8c30('0x16')](respondWithResult(_0x3c9fb8,null))[_0x8c30('0x1f')](handleError(_0x3c9fb8,null));};exports['download']=function(_0x5ef195,_0x424141){var _0x2e81cd=moment()[_0x8c30('0x8b')]()['toString']();var _0x4c6d15=path['join'](config['root'],'server',_0x8c30('0x8c'),_0x8c30('0x8d'));var _0x55555b=path[_0x8c30('0x8e')](config[_0x8c30('0x5b')],_0x8c30('0x8f'),_0x8c30('0x8c'),_0x8c30('0x5a'));var _0x88b419=util[_0x8c30('0x63')]('message-%s.eml',_0x2e81cd);return db[_0x8c30('0x2f')][_0x8c30('0x4b')]({'where':{'id':_0x5ef195[_0x8c30('0x48')]['id']},'attributes':['id',_0x8c30('0x4c'),_0x8c30('0x90'),'to','cc',_0x8c30('0x91'),_0x8c30('0x92'),'createdAt'],'include':_0x5ef195[_0x8c30('0x33')][_0x8c30('0x5a')]?[{'model':db[_0x8c30('0x93')],'as':'Attachments'}]:undefined})[_0x8c30('0x16')](handleEntityNotFound(_0x424141,null))[_0x8c30('0x16')](function(_0x20c2c8){if(_0x20c2c8){var _0x7efa0c=_0x20c2c8;var _0x5751cc={'from':_0x7efa0c[_0x8c30('0x90')],'to':_0x7efa0c['to'],'subject':_0x7efa0c['subject'],'html':htmlEntities[_0x8c30('0x94')](_0x7efa0c[_0x8c30('0x4c')]),'headers':{'Date':moment(_0x7efa0c['createdAt'])[_0x8c30('0x63')](_0x8c30('0x95'))},'attachments':[]};if(_0x20c2c8['cc']){_0x5751cc[_0x8c30('0x96')]['Cc']=_0x20c2c8['cc'];}if(_0x20c2c8[_0x8c30('0x91')]){_0x5751cc[_0x8c30('0x96')][_0x8c30('0x97')]=_0x20c2c8['bcc'];}return new BPromise(function(_0x3a96f8,_0x472e6e){if(_0x20c2c8[_0x8c30('0x98')]){for(var _0x13fc91=0x0;_0x13fc91<_0x20c2c8[_0x8c30('0x98')][_0x8c30('0x3a')];_0x13fc91++){var _0x50e5ff=_0x20c2c8['Attachments'][_0x13fc91];var _0x1109f4=path['join'](_0x55555b,_0x50e5ff[_0x8c30('0x5d')]);if(fs['existsSync'](_0x1109f4)){_0x5751cc['attachments'][_0x8c30('0x99')]({'name':_0x50e5ff['name'],'contentType':_0x50e5ff[_0x8c30('0x31')],'data':fs[_0x8c30('0x9a')](_0x1109f4)});}}}emlformat[_0x8c30('0x9b')](_0x5751cc,function(_0x52b1c5,_0x1a7565){if(_0x52b1c5)return _0x472e6e(_0x52b1c5);fs[_0x8c30('0x9c')](path['join'](_0x4c6d15,_0x88b419),_0x1a7565);return _0x3a96f8(_0x1a7565);});});}})[_0x8c30('0x16')](function(_0x5d9c5c){if(_0x5d9c5c){return _0x424141[_0x8c30('0x9d')](path[_0x8c30('0x8e')](_0x4c6d15,_0x88b419),_0x88b419,function(_0x2d6f28){if(!_0x2d6f28)fs['unlinkSync'](path['join'](_0x4c6d15,_0x88b419));});}})[_0x8c30('0x1f')](handleError(_0x424141,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index eb7a9b0..e652989 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 _0xad08=['save','update','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x22c729,_0x4845ca){var _0x17cd3d=function(_0x4c0b00){while(--_0x4c0b00){_0x22c729['push'](_0x22c729['shift']());}};_0x17cd3d(++_0x4845ca);}(_0xad08,0x1ed));var _0x8ad0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xad08[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0x8ad0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8ad0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8ad0('0x2')](0x0);var events={'afterCreate':_0x8ad0('0x3'),'afterUpdate':_0x8ad0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ceb6d){return function(_0x351dad,_0x4642d1,_0x524fb8){MailMessageEvents[_0x8ad0('0x5')](_0x4ceb6d+':'+_0x351dad['id'],_0x351dad);MailMessageEvents[_0x8ad0('0x5')](_0x4ceb6d,_0x351dad);_0x524fb8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8ad0('0x6')](e,emitEvent(event));}}module[_0x8ad0('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xea69=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x69fa38,_0x50ad8b){var _0x2d551e=function(_0x3c70b0){while(--_0x3c70b0){_0x69fa38['push'](_0x69fa38['shift']());}};_0x2d551e(++_0x50ad8b);}(_0xea69,0x18c));var _0x9ea6=function(_0x5e61aa,_0x12cf27){_0x5e61aa=_0x5e61aa-0x0;var _0x4e3442=_0xea69[_0x5e61aa];return _0x4e3442;};'use strict';var EventEmitter=require(_0x9ea6('0x0'));var MailMessage=require(_0x9ea6('0x1'))['db'][_0x9ea6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ea6('0x3'),'afterUpdate':_0x9ea6('0x4'),'afterDestroy':_0x9ea6('0x5')};function emitEvent(_0x4ec20e){return function(_0x26b507,_0x59b7d1,_0x1e48ce){MailMessageEvents[_0x9ea6('0x6')](_0x4ec20e+':'+_0x26b507['id'],_0x26b507);MailMessageEvents[_0x9ea6('0x6')](_0x4ec20e,_0x26b507);_0x1e48ce(null);};}for(var e in events){if(events[_0x9ea6('0x7')](e)){var event=events[e];MailMessage[_0x9ea6('0x8')](e,emitEvent(event));}}module[_0x9ea6('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9d3aca6..f7b06a1 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 _0xc3f5=['./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0xebf28c,_0x27601c){var _0x2b8745=function(_0x4e9bc3){while(--_0x4e9bc3){_0xebf28c['push'](_0xebf28c['shift']());}};_0x2b8745(++_0x27601c);}(_0xc3f5,0x130));var _0x5c3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc3f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5c3f('0x0'));var util=require('util');var logger=require(_0x5c3f('0x1'))(_0x5c3f('0x2'));var moment=require(_0x5c3f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c3f('0x4'));var config=require(_0x5c3f('0x5'));var attributes=require(_0x5c3f('0x6'));module['exports']=function(_0x3de647,_0xb1982b){return _0x3de647[_0x5c3f('0x7')](_0x5c3f('0x8'),attributes,{'tableName':_0x5c3f('0x9'),'paranoid':![],'indexes':[{'name':_0x5c3f('0xa'),'fields':[_0x5c3f('0xa')]},{'name':'fti_mail_messages','fields':[_0x5c3f('0xb'),_0x5c3f('0xc')],'type':_0x5c3f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fbe59,_0x5ef01b,_0x349a75){if(_0x1fbe59[_0x5c3f('0xe')]){_0x1fbe59['plainBody']=htmlToText[_0x5c3f('0xf')](_0x1fbe59[_0x5c3f('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x349a75(null,_0x5ef01b);},'afterCreate':function(_0x32611e,_0x3a93ef,_0xae55bf){var _0x4233f9=_0x3de647[_0x5c3f('0x10')];var _0x4e2a97=_0x32611e[_0x5c3f('0x11')]({'plain':!![]});if(_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()==='in'||_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()===_0x5c3f('0x14')&&!_0x4e2a97['secret']&&!_['isNil'](_0x4e2a97[_0x5c3f('0x15')])){_0x4233f9[_0x5c3f('0x16')]['findOne']({'where':{'id':_0x4e2a97[_0x5c3f('0x17')]}})[_0x5c3f('0x18')](function(_0x168af1){if(_0x168af1){_0x168af1[_0x5c3f('0x19')]({'lastMsgAt':_0x4e2a97[_0x5c3f('0x1a')],'lastMsgDirection':_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()});}})[_0x5c3f('0x1b')](function(_0x1d1deb){console[_0x5c3f('0x1c')](_0x1d1deb);});}_0xae55bf();}},'charset':_0x5c3f('0x1d'),'collate':_0x5c3f('0x1e')});}; \ No newline at end of file +var _0x27e5=['./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x46194e,_0x32d62a){var _0x3556d6=function(_0xf2121a){while(--_0xf2121a){_0x46194e['push'](_0x46194e['shift']());}};_0x3556d6(++_0x32d62a);}(_0x27e5,0x111));var _0x527e=function(_0x5f1b53,_0x2490ce){_0x5f1b53=_0x5f1b53-0x0;var _0x316c7c=_0x27e5[_0x5f1b53];return _0x316c7c;};'use strict';var _=require(_0x527e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x527e('0x1'));var BPromise=require(_0x527e('0x2'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x527e('0x3'));var rimraf=require(_0x527e('0x4'));var config=require(_0x527e('0x5'));var attributes=require(_0x527e('0x6'));module[_0x527e('0x7')]=function(_0x38c87,_0x3ca338){return _0x38c87['define'](_0x527e('0x8'),attributes,{'tableName':_0x527e('0x9'),'paranoid':![],'indexes':[{'name':_0x527e('0xa'),'fields':[_0x527e('0xa')]},{'name':_0x527e('0xb'),'fields':[_0x527e('0xc'),_0x527e('0xd')],'type':_0x527e('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xfbf453,_0x3fc973,_0x236ca4){if(_0xfbf453[_0x527e('0xf')]){_0xfbf453[_0x527e('0xc')]=htmlToText[_0x527e('0x10')](_0xfbf453[_0x527e('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x236ca4(null,_0x3fc973);},'afterCreate':function(_0x3b5f08,_0x2bdd60,_0xdc776){var _0xd3ad29=_0x38c87[_0x527e('0x11')];var _0x5aafec=_0x3b5f08[_0x527e('0x12')]({'plain':!![]});if(_0x5aafec[_0x527e('0x13')][_0x527e('0x14')]()==='in'||_0x5aafec[_0x527e('0x13')][_0x527e('0x14')]()===_0x527e('0x15')&&!_0x5aafec['secret']&&!_[_0x527e('0x16')](_0x5aafec[_0x527e('0x17')])){_0xd3ad29['MailInteraction'][_0x527e('0x18')]({'where':{'id':_0x5aafec[_0x527e('0x19')]}})['then'](function(_0x395ad2){if(_0x395ad2){_0x395ad2[_0x527e('0x1a')]({'lastMsgAt':_0x5aafec[_0x527e('0x1b')],'lastMsgDirection':_0x5aafec[_0x527e('0x13')][_0x527e('0x14')]()});}})[_0x527e('0x1c')](function(_0x3599cc){console[_0x527e('0x1d')](_0x3599cc);});}_0xdc776();}},'charset':_0x527e('0x1e'),'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 22b8b9e..3c957be 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 _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x5c8937,_0x11df5a){var _0x4e73a3=function(_0x4874b6){while(--_0x4874b6){_0x5c8937['push'](_0x5c8937['shift']());}};_0x4e73a3(++_0x11df5a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xf2e3[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file +var _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x5b8d7b,_0x51b89e){var _0x1a45ab=function(_0x56841e){while(--_0x56841e){_0x5b8d7b['push'](_0x5b8d7b['shift']());}};_0x1a45ab(++_0x51b89e);}(_0x955f,0x1eb));var _0xf955=function(_0x1e54f5,_0x38e742){_0x1e54f5=_0x1e54f5-0x0;var _0x5086bd=_0x955f[_0x1e54f5];return _0x5086bd;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});config['redis']=_[_0xf955('0xa')](config[_0xf955('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0xc'))(new Redis(config[_0xf955('0xb')]));require(_0xf955('0xd'))[_0xf955('0xe')](socket);function respondWithRpcPromise(_0x134c1b,_0x421e4a,_0x186719){return new BPromise(function(_0x4d213a,_0xf7e3e){return client['request'](_0x134c1b,_0x186719)[_0xf955('0xf')](function(_0x5d6211){logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,_0xf955('0x11'));logger['debug'](_0xf955('0x12'),_0x421e4a,'request\x20sent',JSON[_0xf955('0x13')](_0x5d6211));if(_0x5d6211[_0xf955('0x14')]){if(_0x5d6211[_0xf955('0x14')][_0xf955('0x15')]===0x1f4){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);return _0xf7e3e(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}logger['error'](_0xf955('0x16'),_0x421e4a,_0x5d6211['error'][_0xf955('0x17')]);return _0x4d213a(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}else{logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,'request\x20sent');_0x4d213a(_0x5d6211[_0xf955('0x18')][_0xf955('0x17')]);}})[_0xf955('0x19')](function(_0x4d7b5b){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x4d7b5b);_0xf7e3e(_0x4d7b5b);});});}exports[_0xf955('0x1a')]=function(_0x3f960e){var _0x3ae4fb=this;return new Promise(function(_0x5f4d9a,_0x17d86a){return db[_0xf955('0x1b')][_0xf955('0x1c')](_0x3f960e['body'],{'raw':_0x3f960e[_0xf955('0x1d')]?_0x3f960e['options'][_0xf955('0x1e')]===undefined?!![]:![]:!![]})[_0xf955('0xf')](function(_0x37143d){logger[_0xf955('0x10')](_0xf955('0x1a'),_0x3f960e);logger['debug'](_0xf955('0x1a'),_0x3f960e,JSON[_0xf955('0x13')](_0x37143d));_0x5f4d9a(_0x37143d);})[_0xf955('0x19')](function(_0x13a1a7){logger[_0xf955('0x14')](_0xf955('0x1a'),_0x13a1a7[_0xf955('0x17')],_0x3f960e);_0x17d86a(_0x3ae4fb['error'](0x1f4,_0x13a1a7[_0xf955('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b4ec7ed..6cdd227 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 _0x3979=['length','save','remove','update','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3979,0x114));var _0x9397=function(_0x4ef624,_0x1ee495){_0x4ef624=_0x4ef624-0x0;var _0x387c1d=_0x3979[_0x4ef624];return _0x387c1d;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x9397('0x0'),_0x9397('0x1'),_0x9397('0x2')];function createListener(_0x372f8d,_0x223095){return function(_0x356149){_0x223095['emit'](_0x372f8d,_0x356149);};}function removeListener(_0x3bfe18,_0x329ec1){return function(){MailMessageEvents[_0x9397('0x3')](_0x3bfe18,_0x329ec1);};}exports['register']=function(_0x206ab2){for(var _0x380477=0x0,_0x42eb12=events[_0x9397('0x4')];_0x380477<_0x42eb12;_0x380477++){var _0x20278b=events[_0x380477];var _0x2aa6d9=createListener('mailMessage:'+_0x20278b,_0x206ab2);MailMessageEvents['on'](_0x20278b,_0x2aa6d9);}}; \ No newline at end of file +var _0xeab4=['update','emit','register','mailMessage:','save'];(function(_0x2c53bc,_0x5edba0){var _0x37886c=function(_0x4cb3b7){while(--_0x4cb3b7){_0x2c53bc['push'](_0x2c53bc['shift']());}};_0x37886c(++_0x5edba0);}(_0xeab4,0x185));var _0x4eab=function(_0xa915d5,_0x5025ed){_0xa915d5=_0xa915d5-0x0;var _0x465d8b=_0xeab4[_0xa915d5];return _0x465d8b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4eab('0x0'),'remove',_0x4eab('0x1')];function createListener(_0x145440,_0x482632){return function(_0x4826aa){_0x482632[_0x4eab('0x2')](_0x145440,_0x4826aa);};}function removeListener(_0x199c01,_0x5bf9eb){return function(){MailMessageEvents['removeListener'](_0x199c01,_0x5bf9eb);};}exports[_0x4eab('0x3')]=function(_0x4164ef){for(var _0x852b73=0x0,_0x6442b0=events['length'];_0x852b73<_0x6442b0;_0x852b73++){var _0xd099c8=events[_0x852b73];var _0xfa86a4=createListener(_0x4eab('0x4')+_0xd099c8,_0x4164ef);MailMessageEvents['on'](_0xd099c8,_0xfa86a4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 142881a..dbe203f 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 _0x13fc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents'];(function(_0x184886,_0xe1ef64){var _0x1191f1=function(_0x51166a){while(--_0x51166a){_0x184886['push'](_0x184886['shift']());}};_0x1191f1(++_0xe1ef64);}(_0x13fc,0x101));var _0xc13f=function(_0xaee808,_0x16777){_0xaee808=_0xaee808-0x0;var _0xd01918=_0x13fc[_0xaee808];return _0xd01918;};'use strict';var multer=require(_0xc13f('0x0'));var util=require(_0xc13f('0x1'));var path=require(_0xc13f('0x2'));var timeout=require(_0xc13f('0x3'));var express=require(_0xc13f('0x4'));var router=express[_0xc13f('0x5')]();var fs_extra=require(_0xc13f('0x6'));var auth=require(_0xc13f('0x7'));var interaction=require(_0xc13f('0x8'));var config=require(_0xc13f('0x9'));var controller=require(_0xc13f('0xa'));router['get']('/',auth[_0xc13f('0xb')](),controller[_0xc13f('0xc')]);router[_0xc13f('0xd')](_0xc13f('0xe'),auth[_0xc13f('0xb')](),controller['describe']);router['get'](_0xc13f('0xf'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x10')]);router['get'](_0xc13f('0x11'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x12')]);router['get'](_0xc13f('0x13'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x14')]);router[_0xc13f('0xd')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x16')]);router[_0xc13f('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc13f('0x13'),auth['isAuthenticated'](),controller[_0xc13f('0x18')]);router[_0xc13f('0x17')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x19')]);router[_0xc13f('0x1a')]('/:id',auth[_0xc13f('0xb')](),controller['update']);router['delete'](_0xc13f('0xf'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1b')]);router[_0xc13f('0x1c')](_0xc13f('0x13'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1d')]);router[_0xc13f('0x1c')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1e')]);module[_0xc13f('0x1f')]=router; \ No newline at end of file +var _0xa498=['removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xa498,0x8e));var _0x8a49=function(_0x5c7883,_0x2d0e2e){_0x5c7883=_0x5c7883-0x0;var _0x2e4777=_0xa498[_0x5c7883];return _0x2e4777;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require(_0x8a49('0x2'));var express=require(_0x8a49('0x3'));var router=express[_0x8a49('0x4')]();var fs_extra=require(_0x8a49('0x5'));var auth=require(_0x8a49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a49('0x7'));var controller=require('./mailQueue.controller');router[_0x8a49('0x8')]('/',auth[_0x8a49('0x9')](),controller['index']);router[_0x8a49('0x8')](_0x8a49('0xa'),auth[_0x8a49('0x9')](),controller[_0x8a49('0xb')]);router[_0x8a49('0x8')](_0x8a49('0xc'),auth[_0x8a49('0x9')](),controller[_0x8a49('0xd')]);router[_0x8a49('0x8')]('/:id/members',auth[_0x8a49('0x9')](),controller[_0x8a49('0xe')]);router[_0x8a49('0x8')](_0x8a49('0xf'),auth[_0x8a49('0x9')](),controller[_0x8a49('0x10')]);router[_0x8a49('0x8')](_0x8a49('0x11'),auth[_0x8a49('0x9')](),controller[_0x8a49('0x12')]);router[_0x8a49('0x13')]('/',auth[_0x8a49('0x9')](),controller[_0x8a49('0x14')]);router['post'](_0x8a49('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8a49('0x13')](_0x8a49('0x11'),auth[_0x8a49('0x9')](),controller[_0x8a49('0x15')]);router[_0x8a49('0x16')](_0x8a49('0xc'),auth['isAuthenticated'](),controller[_0x8a49('0x17')]);router['delete'](_0x8a49('0xc'),auth[_0x8a49('0x9')](),controller[_0x8a49('0x18')]);router[_0x8a49('0x19')](_0x8a49('0xf'),auth[_0x8a49('0x9')](),controller['removeTeams']);router[_0x8a49('0x19')](_0x8a49('0x11'),auth['isAuthenticated'](),controller[_0x8a49('0x1a')]);module[_0x8a49('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b99bed8..7be549c 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 _0xfbcb=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x871397,_0x404bdb){var _0x3a76e1=function(_0x43a9a4){while(--_0x43a9a4){_0x871397['push'](_0x871397['shift']());}};_0x3a76e1(++_0x404bdb);}(_0xfbcb,0x9e));var _0xbfbc=function(_0x116541,_0x32e650){_0x116541=_0x116541-0x0;var _0x3df863=_0xfbcb[_0x116541];return _0x3df863;};'use strict';var Sequelize=require(_0xbfbc('0x0'));module[_0xbfbc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbfbc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbfbc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbfbc('0x4')](_0xbfbc('0x5'),_0xbfbc('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x606e=['STRING','name','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x606e,0x1d3));var _0xe606=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x606e[_0x2cde0a];return _0x260610;};'use strict';var Sequelize=require(_0xe606('0x0'));module[_0xe606('0x1')]={'name':{'type':Sequelize[_0xe606('0x2')],'unique':_0xe606('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe606('0x2')]},'timeout':{'type':Sequelize[_0xe606('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe606('0x5')]('rrmemory','beepall',_0xe606('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e7bf92b..b88be63 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 _0x4bb9=['getTeams','Team','sort','pick','nolimit','addTeams','ids','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','MailQueues','UserProfileResource','destroy','stack','name','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','show','params','keys','intersection','attributes','model','fields','includeAll','options','find','body','user','get','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','filters','length','hasOwnProperty','order','MailQueueId','filter','merge','User','map','UserId','agent','mailPause','updatedAt','rows','format','createdAt'];(function(_0x25f0d5,_0xc2dbf1){var _0x3dac6b=function(_0x6906e9){while(--_0x6906e9){_0x25f0d5['push'](_0x25f0d5['shift']());}};_0x3dac6b(++_0xc2dbf1);}(_0x4bb9,0x12c));var _0x94bb=function(_0x250f7c,_0xadc77b){_0x250f7c=_0x250f7c-0x0;var _0x395f32=_0x4bb9[_0x250f7c];return _0x395f32;};'use strict';var BPromise=require(_0x94bb('0x0'));var util=require(_0x94bb('0x1'));var _=require(_0x94bb('0x2'));var squel=require(_0x94bb('0x3'));var Redis=require(_0x94bb('0x4'));var qs=require(_0x94bb('0x5'));var logger=require(_0x94bb('0x6'))(_0x94bb('0x7'));var config=require(_0x94bb('0x8'));var db=require(_0x94bb('0x9'))['db'];config['redis']=_['defaults'](config[_0x94bb('0xa')],{'host':_0x94bb('0xb'),'port':0x18eb});var socket=require(_0x94bb('0xc'))(new Redis(config['redis']));require(_0x94bb('0xd'))[_0x94bb('0xe')](socket);function respondWithStatusCode(_0x110042,_0x3e6bef){_0x3e6bef=_0x3e6bef||0xcc;return function(_0x199c53){if(_0x199c53){return _0x110042[_0x94bb('0xf')](_0x3e6bef);}return _0x110042[_0x94bb('0x10')](_0x3e6bef)[_0x94bb('0x11')]();};}function respondWithResult(_0x18963b,_0x1a62c7){_0x1a62c7=_0x1a62c7||0xc8;return function(_0x476729){if(_0x476729){return _0x18963b[_0x94bb('0x10')](_0x1a62c7)[_0x94bb('0x12')](_0x476729);}};}function respondWithFilteredResult(_0x560094,_0x30251a){return function(_0x4625e0){if(_0x4625e0){var _0x1c98c7=typeof _0x30251a[_0x94bb('0x13')]==='undefined'&&typeof _0x30251a['limit']===_0x94bb('0x14');var _0x38fea1=_0x4625e0[_0x94bb('0x15')];var _0x48c2c3=_0x1c98c7?0x0:_0x30251a[_0x94bb('0x13')];var _0x2751ff=_0x1c98c7?_0x4625e0['count']:_0x30251a[_0x94bb('0x13')]+_0x30251a[_0x94bb('0x16')];var _0x1375f3;if(_0x2751ff>=_0x38fea1){_0x2751ff=_0x38fea1;_0x1375f3=0xc8;}else{_0x1375f3=0xce;}_0x560094[_0x94bb('0x10')](_0x1375f3);return _0x560094[_0x94bb('0x17')](_0x94bb('0x18'),_0x48c2c3+'-'+_0x2751ff+'/'+_0x38fea1)[_0x94bb('0x12')](_0x4625e0);}return null;};}function saveUpdates(_0x709b4f){return function(_0x20ccd7){if(_0x20ccd7){return _0x20ccd7['update'](_0x709b4f)[_0x94bb('0x19')](function(_0x2fb250){return _0x2fb250;});}return null;};}function removeEntity(_0x5ed1d6){return function(_0x2f33ea){if(_0x2f33ea){return _0x2f33ea['destroy']()[_0x94bb('0x19')](function(){var _0x269176=_0x2f33ea['get']({'plain':!![]});var _0x2fd3a1=_0x94bb('0x1a');return db[_0x94bb('0x1b')][_0x94bb('0x1c')]({'where':{'type':_0x2fd3a1,'resourceId':_0x269176['id']}})[_0x94bb('0x19')](function(){return _0x2f33ea;});})[_0x94bb('0x19')](function(){_0x5ed1d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b0e4){return function(_0x5189c7){if(!_0x5189c7){_0x11b0e4[_0x94bb('0xf')](0x194);}return _0x5189c7;};}function handleError(_0x182599,_0x16bc15){_0x16bc15=_0x16bc15||0x1f4;return function(_0x294047){logger['error'](_0x294047[_0x94bb('0x1d')]);if(_0x294047[_0x94bb('0x1e')]){delete _0x294047[_0x94bb('0x1e')];}_0x182599['status'](_0x16bc15)['send'](_0x294047);};}exports['index']=function(_0xe56e57,_0x3ea73a){var _0x405ca9={};var _0x5d3be4={'count':0x0,'rows':[]};var _0x7ebd4=_['map'](db[_0x94bb('0x1f')][_0x94bb('0x20')],function(_0x190a18){return{'name':_0x190a18[_0x94bb('0x21')],'type':_0x190a18[_0x94bb('0x22')][_0x94bb('0x23')]};});_0x405ca9=qs[_0x94bb('0x24')](_0x7ebd4,_0xe56e57);var _0x45f6da={'where':_0x405ca9[_0x94bb('0x25')]};return db['MailQueue'][_0x94bb('0x15')](_0x45f6da)[_0x94bb('0x19')](function(_0x4ea5ff){_0x5d3be4[_0x94bb('0x15')]=_0x4ea5ff;_0x405ca9['include']=qs[_0x94bb('0x26')](_0xe56e57[_0x94bb('0x27')]);return db['MailQueue'][_0x94bb('0x28')](_0x405ca9);})[_0x94bb('0x19')](function(_0x28971e){_0x5d3be4['rows']=_0x28971e;return _0x5d3be4;})[_0x94bb('0x19')](respondWithFilteredResult(_0x3ea73a,_0x405ca9))['catch'](handleError(_0x3ea73a,null));};exports[_0x94bb('0x29')]=function(_0x2b0e87,_0x48a233){var _0x5864be={'raw':!![],'where':{'id':_0x2b0e87[_0x94bb('0x2a')]['id']}},_0x231e89={};_0x231e89['model']=_[_0x94bb('0x2b')](db[_0x94bb('0x1f')][_0x94bb('0x20')]);_0x231e89[_0x94bb('0x27')]=_[_0x94bb('0x2b')](_0x2b0e87[_0x94bb('0x27')]);_0x231e89['filters']=_[_0x94bb('0x2c')](_0x231e89['model'],_0x231e89[_0x94bb('0x27')]);_0x5864be[_0x94bb('0x2d')]=_[_0x94bb('0x2c')](_0x231e89[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x2b0e87[_0x94bb('0x27')][_0x94bb('0x2f')]));_0x5864be['attributes']=_0x5864be['attributes']['length']?_0x5864be['attributes']:_0x231e89[_0x94bb('0x2e')];if(_0x2b0e87[_0x94bb('0x27')][_0x94bb('0x30')]){_0x5864be[_0x94bb('0x26')]=[{'all':!![]}];}_0x5864be=_['merge']({},_0x5864be,_0x2b0e87[_0x94bb('0x31')]);return db[_0x94bb('0x1f')][_0x94bb('0x32')](_0x5864be)[_0x94bb('0x19')](handleEntityNotFound(_0x48a233,null))[_0x94bb('0x19')](respondWithResult(_0x48a233,null))['catch'](handleError(_0x48a233,null));};exports['create']=function(_0x5745c9,_0x426c72){return db[_0x94bb('0x1f')]['create'](_0x5745c9[_0x94bb('0x33')],{})[_0x94bb('0x19')](function(_0x34d7e6){var _0x4dedbc=_0x5745c9[_0x94bb('0x34')][_0x94bb('0x35')]({'plain':!![]});if(!_0x4dedbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dedbc['role']===_0x94bb('0x34')){var _0x95d145=_0x34d7e6[_0x94bb('0x35')]({'plain':!![]});var _0xd306fd=_0x94bb('0x1a');return db['UserProfileSection'][_0x94bb('0x32')]({'where':{'name':_0xd306fd,'userProfileId':_0x4dedbc[_0x94bb('0x36')]},'raw':!![]})[_0x94bb('0x19')](function(_0x364759){if(_0x364759&&_0x364759[_0x94bb('0x37')]===0x0){return db['UserProfileResource'][_0x94bb('0x38')]({'name':_0x95d145[_0x94bb('0x1e')],'resourceId':_0x95d145['id'],'type':_0x364759[_0x94bb('0x1e')],'sectionId':_0x364759['id']},{})['then'](function(){return _0x34d7e6;});}else{return _0x34d7e6;}})[_0x94bb('0x39')](function(_0x8a408){logger[_0x94bb('0x3a')](_0x94bb('0x3b'),_0x8a408);throw _0x8a408;});}return _0x34d7e6;})[_0x94bb('0x19')](respondWithResult(_0x426c72,0xc9))[_0x94bb('0x39')](handleError(_0x426c72,null));};exports[_0x94bb('0x3c')]=function(_0x3e419a,_0x152ab1){if(_0x3e419a[_0x94bb('0x33')]['id']){delete _0x3e419a[_0x94bb('0x33')]['id'];}return db[_0x94bb('0x1f')]['find']({'where':{'id':_0x3e419a[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x152ab1,null))[_0x94bb('0x19')](saveUpdates(_0x3e419a[_0x94bb('0x33')],null))[_0x94bb('0x19')](respondWithResult(_0x152ab1,null))[_0x94bb('0x39')](handleError(_0x152ab1,null));};exports[_0x94bb('0x1c')]=function(_0x396eee,_0x243bcb){return db['MailQueue'][_0x94bb('0x32')]({'where':{'id':_0x396eee[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x243bcb,null))[_0x94bb('0x19')](removeEntity(_0x243bcb,null))['catch'](handleError(_0x243bcb,null));};exports[_0x94bb('0x3d')]=function(_0x3e5265,_0x44b9a8){return db[_0x94bb('0x1f')][_0x94bb('0x3d')]()[_0x94bb('0x19')](respondWithResult(_0x44b9a8,null))[_0x94bb('0x39')](handleError(_0x44b9a8,null));};exports[_0x94bb('0x3e')]=function(_0x2d48c4,_0x6d4e10){var _0x9755c7={'raw':!![],'where':{}},_0x422373={},_0x4a2712;return db['MailQueue'][_0x94bb('0x3f')]({'where':{'id':_0x2d48c4[_0x94bb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x6d4e10,null))[_0x94bb('0x19')](function(_0xd4cb9d){if(_0xd4cb9d){_0x4a2712=_0xd4cb9d[_0x94bb('0x35')]({'plain':!![]});_0x422373[_0x94bb('0x2e')]=_[_0x94bb('0x2b')](db[_0x94bb('0x40')][_0x94bb('0x20')]);_0x422373[_0x94bb('0x27')]=_['keys'](_0x2d48c4['query']);_0x422373[_0x94bb('0x41')]=_[_0x94bb('0x2c')](_0x422373[_0x94bb('0x2e')],_0x422373['query']);_0x9755c7[_0x94bb('0x2d')]=_['intersection'](_0x422373['model'],qs[_0x94bb('0x2f')](_0x2d48c4[_0x94bb('0x27')]['fields']));_0x9755c7[_0x94bb('0x2d')]=_0x9755c7['attributes'][_0x94bb('0x42')]?_0x9755c7[_0x94bb('0x2d')]:_0x422373[_0x94bb('0x2e')];if(!_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x43')]('nolimit')){_0x9755c7[_0x94bb('0x16')]=qs['limit'](_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x16')]);_0x9755c7[_0x94bb('0x13')]=qs[_0x94bb('0x13')](_0x2d48c4[_0x94bb('0x27')]['offset']);}_0x9755c7[_0x94bb('0x44')]=qs['sort'](_0x2d48c4['query']['sort']);_0x9755c7[_0x94bb('0x25')]=qs['filters'](_['pick'](_0x2d48c4[_0x94bb('0x27')],_0x422373[_0x94bb('0x41')]));_0x9755c7[_0x94bb('0x25')][_0x94bb('0x45')]=_0xd4cb9d['id'];if(_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x46')]){_0x9755c7[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x9755c7[_0x94bb('0x25')],{'$or':_['map'](_0x9755c7[_0x94bb('0x2d')],function(_0x140fb0){var _0x57f50b={};_0x57f50b[_0x140fb0]={'$like':'%'+_0x2d48c4[_0x94bb('0x27')]['filter']+'%'};return _0x57f50b;})});}_0x9755c7=_[_0x94bb('0x47')]({},_0x9755c7,_0x2d48c4[_0x94bb('0x31')]);return db[_0x94bb('0x40')][_0x94bb('0x28')](_0x9755c7);}})['then'](function(_0x4a441f){if(_0x4a441f){return db[_0x94bb('0x48')]['findAndCountAll']({'where':{'id':_[_0x94bb('0x49')](_0x4a441f,_0x94bb('0x4a')),'role':_0x94bb('0x4b')},'attributes':['id',_0x94bb('0x1e'),_0x94bb('0x4c'),_0x94bb('0x4d'),'createdAt']});}})[_0x94bb('0x19')](function(_0x4510d7){if(_0x4510d7){return{'count':_0x4510d7[_0x94bb('0x15')],'rows':_['map'](_0x4510d7[_0x94bb('0x4e')],function(_0x4fd3c9){return{'membername':_0x4fd3c9[_0x94bb('0x1e')],'UserId':_0x4fd3c9['id'],'queue_name':_0x4a2712[_0x94bb('0x1e')],'MailQueueId':_0x4a2712['id'],'interface':util[_0x94bb('0x4f')]('%s/%s','SIP',_0x4fd3c9[_0x94bb('0x1e')]),'penalty':0x0,'paused':_0x4fd3c9['mailPause'],'createdAt':_0x4fd3c9[_0x94bb('0x50')],'updatedAt':_0x4fd3c9[_0x94bb('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x94bb('0x19')](respondWithFilteredResult(_0x6d4e10,_0x9755c7))[_0x94bb('0x39')](handleError(_0x6d4e10,null));};exports[_0x94bb('0x51')]=function(_0x369442,_0x5f0bca){var _0x4d084f={};var _0x390d72={};var _0x21dcd8;var _0x2f188e;return db[_0x94bb('0x1f')][_0x94bb('0x3f')]({'where':{'id':_0x369442[_0x94bb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5f0bca,null))[_0x94bb('0x19')](function(_0x2b4113){if(_0x2b4113){_0x21dcd8=_0x2b4113;_0x390d72[_0x94bb('0x2e')]=_[_0x94bb('0x2b')](db[_0x94bb('0x52')][_0x94bb('0x20')]);_0x390d72[_0x94bb('0x27')]=_[_0x94bb('0x2b')](_0x369442[_0x94bb('0x27')]);_0x390d72['filters']=_[_0x94bb('0x2c')](_0x390d72[_0x94bb('0x2e')],_0x390d72[_0x94bb('0x27')]);_0x4d084f[_0x94bb('0x2d')]=_['intersection'](_0x390d72[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x369442['query'][_0x94bb('0x2f')]));_0x4d084f[_0x94bb('0x2d')]=_0x4d084f[_0x94bb('0x2d')]['length']?_0x4d084f[_0x94bb('0x2d')]:_0x390d72[_0x94bb('0x2e')];_0x4d084f[_0x94bb('0x44')]=qs[_0x94bb('0x53')](_0x369442[_0x94bb('0x27')]['sort']);_0x4d084f[_0x94bb('0x25')]=qs['filters'](_[_0x94bb('0x54')](_0x369442[_0x94bb('0x27')],_0x390d72[_0x94bb('0x41')]));if(_0x369442[_0x94bb('0x27')]['filter']){_0x4d084f[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x4d084f['where'],{'$or':_['map'](_0x4d084f[_0x94bb('0x2d')],function(_0x156b67){var _0x2027d1={};_0x2027d1[_0x156b67]={'$like':'%'+_0x369442[_0x94bb('0x27')]['filter']+'%'};return _0x2027d1;})});}_0x4d084f=_[_0x94bb('0x47')]({},_0x4d084f,_0x369442['options']);return _0x21dcd8[_0x94bb('0x51')](_0x4d084f);}})['then'](function(_0x3b2e18){if(_0x3b2e18){_0x2f188e=_0x3b2e18['length'];if(!_0x369442[_0x94bb('0x27')][_0x94bb('0x43')](_0x94bb('0x55'))){_0x4d084f['limit']=qs['limit'](_0x369442[_0x94bb('0x27')]['limit']);_0x4d084f['offset']=qs[_0x94bb('0x13')](_0x369442[_0x94bb('0x27')][_0x94bb('0x13')]);}return _0x21dcd8[_0x94bb('0x51')](_0x4d084f);}})[_0x94bb('0x19')](function(_0x580682){if(_0x580682){return _0x580682?{'count':_0x2f188e,'rows':_0x580682}:null;}})['then'](respondWithResult(_0x5f0bca,null))[_0x94bb('0x39')](handleError(_0x5f0bca,null));};exports[_0x94bb('0x56')]=function(_0x57fe68,_0x2d2710){var _0x16aa47=_0x57fe68['body'][_0x94bb('0x57')];return db[_0x94bb('0x52')][_0x94bb('0x28')]({'where':{'id':_0x16aa47},'attributes':['id'],'include':[{'model':db[_0x94bb('0x48')],'as':'Agents','attributes':['id','name',_0x94bb('0x58'),_0x94bb('0x59'),_0x94bb('0x5a')],'raw':!![]}]})[_0x94bb('0x19')](function(_0x572189){if(_0x572189){var _0xb55a8=_['flatMap'](_0x572189,function(_0x2beca1){var _0x13095b=_0x2beca1[_0x94bb('0x35')]({'plain':!![]});return _0x13095b[_0x94bb('0x5b')];});return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x57fe68[_0x94bb('0x2a')]['id']}})['then'](function(_0x76a38e){return db[_0x94bb('0x5c')][_0x94bb('0x5d')](function(_0x5246ea){return _0x76a38e[_0x94bb('0x56')](_0x16aa47,{'transaction':_0x5246ea})[_0x94bb('0x19')](function(){return BPromise[_0x94bb('0x5e')](_0xb55a8,function(_0xabda5d){return db['UserMailQueue'][_0x94bb('0x5f')]({'where':{'UserId':_0xabda5d['id'],'MailQueueId':_0x57fe68[_0x94bb('0x2a')]['id']},'transaction':_0x5246ea});});})['then'](function(){_0xb55a8[_0x94bb('0x60')](function(_0x2c7b8e){socket['emit'](_0x94bb('0x61'),{'UserId':_0x2c7b8e['id'],'MailQueueId':_0x76a38e['id']});});});});});}})['then'](respondWithStatusCode(_0x2d2710,null))[_0x94bb('0x39')](handleError(_0x2d2710,null));};exports[_0x94bb('0x62')]=function(_0x43db6d,_0x391c5f){return db[_0x94bb('0x52')]['findAll']({'where':{'id':_0x43db6d['query'][_0x94bb('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x94bb('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x94bb('0x19')](handleEntityNotFound(_0x391c5f,null))[_0x94bb('0x19')](function(_0x3cd93c){var _0x57c904=_[_0x94bb('0x49')](_0x3cd93c,'id');var _0x3d7270=[];var _0x2e0602=[];var _0x28e0f6=squel[_0x94bb('0x63')]();_0x28e0f6[_0x94bb('0x64')](_0x94bb('0x65'))['from'](_0x94bb('0x66'),'tq')[_0x94bb('0x67')](_0x94bb('0x68'),'ut',_0x94bb('0x69'))['where'](_0x94bb('0x6a'),_0x43db6d['params']['id']);for(var _0x8d7a13=0x0;_0x8d7a13<_0x3cd93c[_0x94bb('0x42')];_0x8d7a13+=0x1){let _0x5c3a1c=_0x3cd93c[_0x8d7a13];for(var _0x3c111c=0x0;_0x3c111c<_0x5c3a1c[_0x94bb('0x5b')][_0x94bb('0x42')];_0x3c111c+=0x1){let _0x1c1602=_0x5c3a1c['Agents'][_0x3c111c];var _0x31900a=_0x28e0f6[_0x94bb('0x6b')]();_0x31900a[_0x94bb('0x25')](_0x94bb('0x6c'),_0x1c1602['id']);_0x2e0602[_0x94bb('0x6d')](db['sequelize'][_0x94bb('0x27')](_0x31900a[_0x94bb('0x6e')](),{'type':db[_0x94bb('0x5c')][_0x94bb('0x6f')][_0x94bb('0x70')]})[_0x94bb('0x19')](function(_0x53faac){if(_0x53faac[_0x94bb('0x42')]===0x1){return _0x1c1602['id'];}else{var _0x3ef217=_[_0x94bb('0x71')](_['map'](_0x53faac,_0x94bb('0x72')),function(_0x899edd){return _[_0x94bb('0x73')](_0x57c904,_0x899edd);});if(_0x3ef217){return _0x1c1602['id'];}}}));}}return BPromise[_0x94bb('0x74')](_0x2e0602)[_0x94bb('0x19')](function(_0x267720){_0x3d7270=_(_0x3d7270)['union'](_0x267720)[_0x94bb('0x75')]()[_0x94bb('0x76')]();return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x43db6d[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](function(_0x25c783){return db[_0x94bb('0x5c')][_0x94bb('0x5d')](function(_0x42acaa){return _0x25c783['removeTeams'](_0x43db6d[_0x94bb('0x27')][_0x94bb('0x57')],{'transaction':_0x42acaa})[_0x94bb('0x19')](function(){if(!_['isEmpty'](_0x3d7270)){return _0x25c783[_0x94bb('0x77')](_0x3d7270,{'transaction':_0x42acaa});}})['then'](function(){_0x3d7270[_0x94bb('0x60')](function(_0x1e5080){socket[_0x94bb('0x78')](_0x94bb('0x79'),{'UserId':_0x1e5080,'MailQueueId':_0x25c783['id']});});});});});});})['then'](respondWithStatusCode(_0x391c5f,null))[_0x94bb('0x39')](handleError(_0x391c5f,null));};exports['addAgents']=function(_0x2660f6,_0x5bb08e){return db[_0x94bb('0x1f')]['find']({'where':{'id':_0x2660f6[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x5bb08e,null))[_0x94bb('0x19')](function(_0x24cd58){if(_0x24cd58){return _0x24cd58[_0x94bb('0x7a')](_0x2660f6[_0x94bb('0x33')][_0x94bb('0x57')],_[_0x94bb('0x7b')](_0x2660f6[_0x94bb('0x33')],['ids','id'])||{})[_0x94bb('0x7c')](function(_0x250031){for(var _0xaff4fd=0x0;_0xaff4fd<_0x2660f6[_0x94bb('0x33')]['ids'][_0x94bb('0x42')];_0xaff4fd+=0x1){socket['emit'](_0x94bb('0x61'),{'UserId':Number(_0x2660f6[_0x94bb('0x33')][_0x94bb('0x57')][_0xaff4fd]),'MailQueueId':Number(_0x2660f6['params']['id'])});}return _0x250031;});}})['then'](respondWithResult(_0x5bb08e,null))[_0x94bb('0x39')](handleError(_0x5bb08e,null));};exports[_0x94bb('0x77')]=function(_0x3cc504,_0x372560){return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x3cc504[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x372560,null))['then'](function(_0x3fcae9){if(_0x3fcae9){return _0x3fcae9[_0x94bb('0x77')](_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')])['then'](function(){if(_[_0x94bb('0x7d')](_0x3cc504['query']['ids'])){for(var _0x4cf002=0x0;_0x4cf002<_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')][_0x94bb('0x42')];_0x4cf002+=0x1){socket['emit'](_0x94bb('0x79'),{'UserId':Number(_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')][_0x4cf002]),'MailQueueId':Number(_0x3cc504[_0x94bb('0x2a')]['id'])});}}else{socket['emit'](_0x94bb('0x79'),{'UserId':Number(_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')]),'MailQueueId':Number(_0x3cc504[_0x94bb('0x2a')]['id'])});}});}})[_0x94bb('0x19')](respondWithStatusCode(_0x372560,null))[_0x94bb('0x39')](handleError(_0x372560,null));};exports[_0x94bb('0x7e')]=function(_0x525e51,_0x1b4114){var _0x3fd4f7={};var _0x3947a2={};var _0x41fc8b;var _0x224aea;return db[_0x94bb('0x1f')]['findOne']({'where':{'id':_0x525e51[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x1b4114,null))['then'](function(_0x3933a8){if(_0x3933a8){_0x41fc8b=_0x3933a8;_0x3947a2[_0x94bb('0x2e')]=_['keys'](db[_0x94bb('0x48')]['rawAttributes']);_0x3947a2['query']=_['keys'](_0x525e51[_0x94bb('0x27')]);_0x3947a2[_0x94bb('0x41')]=_[_0x94bb('0x2c')](_0x3947a2[_0x94bb('0x2e')],_0x3947a2[_0x94bb('0x27')]);_0x3fd4f7[_0x94bb('0x2d')]=_[_0x94bb('0x2c')](_0x3947a2[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x525e51[_0x94bb('0x27')]['fields']));_0x3fd4f7[_0x94bb('0x2d')]=_0x3fd4f7['attributes']['length']?_0x3fd4f7['attributes']:_0x3947a2[_0x94bb('0x2e')];_0x3fd4f7[_0x94bb('0x44')]=qs[_0x94bb('0x53')](_0x525e51[_0x94bb('0x27')][_0x94bb('0x53')]);_0x3fd4f7['where']=qs[_0x94bb('0x41')](_[_0x94bb('0x54')](_0x525e51[_0x94bb('0x27')],_0x3947a2['filters']));if(_0x525e51[_0x94bb('0x27')][_0x94bb('0x46')]){_0x3fd4f7[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x3fd4f7[_0x94bb('0x25')],{'$or':_[_0x94bb('0x49')](_0x3fd4f7[_0x94bb('0x2d')],function(_0xea8bc3){var _0x3461d8={};_0x3461d8[_0xea8bc3]={'$like':'%'+_0x525e51[_0x94bb('0x27')][_0x94bb('0x46')]+'%'};return _0x3461d8;})});}_0x3fd4f7=_[_0x94bb('0x47')]({},_0x3fd4f7,_0x525e51['options']);return _0x41fc8b[_0x94bb('0x7e')](_0x3fd4f7);}})['then'](function(_0x169e0a){if(_0x169e0a){_0x224aea=_0x169e0a['length'];if(!_0x525e51['query'][_0x94bb('0x43')]('nolimit')){_0x3fd4f7[_0x94bb('0x16')]=qs[_0x94bb('0x16')](_0x525e51[_0x94bb('0x27')]['limit']);_0x3fd4f7['offset']=qs[_0x94bb('0x13')](_0x525e51['query']['offset']);}return _0x41fc8b[_0x94bb('0x7e')](_0x3fd4f7);}})[_0x94bb('0x19')](function(_0x1fabbd){if(_0x1fabbd){return _0x1fabbd?{'count':_0x224aea,'rows':_0x1fabbd}:null;}})[_0x94bb('0x19')](respondWithResult(_0x1b4114,null))[_0x94bb('0x39')](handleError(_0x1b4114,null));}; \ No newline at end of file +var _0x1f6f=['findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','%s/%s','createdAt','getTeams','order','addTeams','Team','online','voicePause','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','isEmpty','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x1f6f,0x1be));var _0xf1f6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1f6f[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require(_0xf1f6('0x0'));var util=require(_0xf1f6('0x1'));var _=require(_0xf1f6('0x2'));var squel=require('squel');var Redis=require(_0xf1f6('0x3'));var qs=require(_0xf1f6('0x4'));var logger=require(_0xf1f6('0x5'))(_0xf1f6('0x6'));var config=require('../../config/environment');var db=require(_0xf1f6('0x7'))['db'];config[_0xf1f6('0x8')]=_['defaults'](config['redis'],{'host':_0xf1f6('0x9'),'port':0x18eb});var socket=require(_0xf1f6('0xa'))(new Redis(config['redis']));require(_0xf1f6('0xb'))[_0xf1f6('0xc')](socket);function respondWithStatusCode(_0x27ecf4,_0x33e36a){_0x33e36a=_0x33e36a||0xcc;return function(_0x1db7ee){if(_0x1db7ee){return _0x27ecf4[_0xf1f6('0xd')](_0x33e36a);}return _0x27ecf4['status'](_0x33e36a)[_0xf1f6('0xe')]();};}function respondWithResult(_0x20d5f9,_0x489c0a){_0x489c0a=_0x489c0a||0xc8;return function(_0x2c13c7){if(_0x2c13c7){return _0x20d5f9[_0xf1f6('0xf')](_0x489c0a)['json'](_0x2c13c7);}};}function respondWithFilteredResult(_0x48c18b,_0x518d68){return function(_0x4e2d8e){if(_0x4e2d8e){var _0x815cf2=typeof _0x518d68[_0xf1f6('0x10')]===_0xf1f6('0x11')&&typeof _0x518d68[_0xf1f6('0x12')]==='undefined';var _0x341bd5=_0x4e2d8e[_0xf1f6('0x13')];var _0x2569c6=_0x815cf2?0x0:_0x518d68[_0xf1f6('0x10')];var _0x259871=_0x815cf2?_0x4e2d8e['count']:_0x518d68[_0xf1f6('0x10')]+_0x518d68[_0xf1f6('0x12')];var _0x48081e;if(_0x259871>=_0x341bd5){_0x259871=_0x341bd5;_0x48081e=0xc8;}else{_0x48081e=0xce;}_0x48c18b['status'](_0x48081e);return _0x48c18b['set'](_0xf1f6('0x14'),_0x2569c6+'-'+_0x259871+'/'+_0x341bd5)[_0xf1f6('0x15')](_0x4e2d8e);}return null;};}function saveUpdates(_0x25cba6){return function(_0x21c446){if(_0x21c446){return _0x21c446[_0xf1f6('0x16')](_0x25cba6)['then'](function(_0x130a97){return _0x130a97;});}return null;};}function removeEntity(_0x414d8f){return function(_0x1a3380){if(_0x1a3380){return _0x1a3380[_0xf1f6('0x17')]()[_0xf1f6('0x18')](function(){var _0x117516=_0x1a3380[_0xf1f6('0x19')]({'plain':!![]});var _0x208a61='MailQueues';return db[_0xf1f6('0x1a')]['destroy']({'where':{'type':_0x208a61,'resourceId':_0x117516['id']}})[_0xf1f6('0x18')](function(){return _0x1a3380;});})[_0xf1f6('0x18')](function(){_0x414d8f[_0xf1f6('0xf')](0xcc)[_0xf1f6('0xe')]();});}};}function handleEntityNotFound(_0x5cf615){return function(_0x2419cf){if(!_0x2419cf){_0x5cf615['sendStatus'](0x194);}return _0x2419cf;};}function handleError(_0x4df6be,_0x406197){_0x406197=_0x406197||0x1f4;return function(_0x2ba140){logger[_0xf1f6('0x1b')](_0x2ba140[_0xf1f6('0x1c')]);if(_0x2ba140[_0xf1f6('0x1d')]){delete _0x2ba140[_0xf1f6('0x1d')];}_0x4df6be[_0xf1f6('0xf')](_0x406197)[_0xf1f6('0x1e')](_0x2ba140);};}exports[_0xf1f6('0x1f')]=function(_0x42d0cd,_0x1879f8){var _0x5393cd={};var _0x59b2a9={'count':0x0,'rows':[]};var _0x23f858=_[_0xf1f6('0x20')](db[_0xf1f6('0x21')][_0xf1f6('0x22')],function(_0x2ff70d){return{'name':_0x2ff70d[_0xf1f6('0x23')],'type':_0x2ff70d[_0xf1f6('0x24')][_0xf1f6('0x25')]};});_0x5393cd=qs[_0xf1f6('0x26')](_0x23f858,_0x42d0cd);var _0x444004={'where':_0x5393cd[_0xf1f6('0x27')]};return db[_0xf1f6('0x21')][_0xf1f6('0x13')](_0x444004)[_0xf1f6('0x18')](function(_0x1a3394){_0x59b2a9['count']=_0x1a3394;_0x5393cd[_0xf1f6('0x28')]=qs['include'](_0x42d0cd[_0xf1f6('0x29')]);return db[_0xf1f6('0x21')][_0xf1f6('0x2a')](_0x5393cd);})[_0xf1f6('0x18')](function(_0x1ecae5){_0x59b2a9[_0xf1f6('0x2b')]=_0x1ecae5;return _0x59b2a9;})[_0xf1f6('0x18')](respondWithFilteredResult(_0x1879f8,_0x5393cd))[_0xf1f6('0x2c')](handleError(_0x1879f8,null));};exports['show']=function(_0x1fdde5,_0x1ef904){var _0x320b56={'raw':!![],'where':{'id':_0x1fdde5[_0xf1f6('0x2d')]['id']}},_0x3f3bd8={};_0x3f3bd8[_0xf1f6('0x2e')]=_[_0xf1f6('0x2f')](db[_0xf1f6('0x21')][_0xf1f6('0x22')]);_0x3f3bd8['query']=_[_0xf1f6('0x2f')](_0x1fdde5[_0xf1f6('0x29')]);_0x3f3bd8[_0xf1f6('0x30')]=_[_0xf1f6('0x31')](_0x3f3bd8[_0xf1f6('0x2e')],_0x3f3bd8[_0xf1f6('0x29')]);_0x320b56[_0xf1f6('0x32')]=_[_0xf1f6('0x31')](_0x3f3bd8['model'],qs[_0xf1f6('0x33')](_0x1fdde5[_0xf1f6('0x29')][_0xf1f6('0x33')]));_0x320b56[_0xf1f6('0x32')]=_0x320b56[_0xf1f6('0x32')][_0xf1f6('0x34')]?_0x320b56[_0xf1f6('0x32')]:_0x3f3bd8[_0xf1f6('0x2e')];if(_0x1fdde5['query'][_0xf1f6('0x35')]){_0x320b56[_0xf1f6('0x28')]=[{'all':!![]}];}_0x320b56=_[_0xf1f6('0x36')]({},_0x320b56,_0x1fdde5[_0xf1f6('0x37')]);return db[_0xf1f6('0x21')]['find'](_0x320b56)['then'](handleEntityNotFound(_0x1ef904,null))[_0xf1f6('0x18')](respondWithResult(_0x1ef904,null))[_0xf1f6('0x2c')](handleError(_0x1ef904,null));};exports[_0xf1f6('0x38')]=function(_0x11aaed,_0x9db726){return db[_0xf1f6('0x21')][_0xf1f6('0x38')](_0x11aaed[_0xf1f6('0x39')],{})[_0xf1f6('0x18')](function(_0x15beff){var _0x4cb3c4=_0x11aaed[_0xf1f6('0x3a')][_0xf1f6('0x19')]({'plain':!![]});if(!_0x4cb3c4)throw new Error(_0xf1f6('0x3b'));if(_0x4cb3c4[_0xf1f6('0x3c')]===_0xf1f6('0x3a')){var _0x45acde=_0x15beff[_0xf1f6('0x19')]({'plain':!![]});var _0x5874fe=_0xf1f6('0x3d');return db[_0xf1f6('0x3e')][_0xf1f6('0x3f')]({'where':{'name':_0x5874fe,'userProfileId':_0x4cb3c4[_0xf1f6('0x40')]},'raw':!![]})[_0xf1f6('0x18')](function(_0x2c581f){if(_0x2c581f&&_0x2c581f[_0xf1f6('0x41')]===0x0){return db['UserProfileResource'][_0xf1f6('0x38')]({'name':_0x45acde['name'],'resourceId':_0x45acde['id'],'type':_0x2c581f[_0xf1f6('0x1d')],'sectionId':_0x2c581f['id']},{})['then'](function(){return _0x15beff;});}else{return _0x15beff;}})[_0xf1f6('0x2c')](function(_0x43dd41){logger[_0xf1f6('0x1b')](_0xf1f6('0x42'),_0x43dd41);throw _0x43dd41;});}return _0x15beff;})[_0xf1f6('0x18')](respondWithResult(_0x9db726,0xc9))['catch'](handleError(_0x9db726,null));};exports[_0xf1f6('0x16')]=function(_0xef7e,_0x5bd004){if(_0xef7e[_0xf1f6('0x39')]['id']){delete _0xef7e[_0xf1f6('0x39')]['id'];}return db[_0xf1f6('0x21')][_0xf1f6('0x3f')]({'where':{'id':_0xef7e[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x5bd004,null))[_0xf1f6('0x18')](saveUpdates(_0xef7e['body'],null))['then'](respondWithResult(_0x5bd004,null))[_0xf1f6('0x2c')](handleError(_0x5bd004,null));};exports['destroy']=function(_0x3b1046,_0x1c2416){return db['MailQueue'][_0xf1f6('0x3f')]({'where':{'id':_0x3b1046[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x1c2416,null))[_0xf1f6('0x18')](removeEntity(_0x1c2416,null))['catch'](handleError(_0x1c2416,null));};exports[_0xf1f6('0x43')]=function(_0x55d80d,_0x4cfd6b){return db[_0xf1f6('0x21')][_0xf1f6('0x43')]()[_0xf1f6('0x18')](respondWithResult(_0x4cfd6b,null))[_0xf1f6('0x2c')](handleError(_0x4cfd6b,null));};exports['getMembers']=function(_0x49ad3f,_0x300b47){var _0x3850d0={'raw':!![],'where':{}},_0x316545={},_0x487c03;return db[_0xf1f6('0x21')][_0xf1f6('0x44')]({'where':{'id':_0x49ad3f[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x300b47,null))['then'](function(_0x2a49d5){if(_0x2a49d5){_0x487c03=_0x2a49d5[_0xf1f6('0x19')]({'plain':!![]});_0x316545[_0xf1f6('0x2e')]=_[_0xf1f6('0x2f')](db['UserMailQueue'][_0xf1f6('0x22')]);_0x316545['query']=_['keys'](_0x49ad3f['query']);_0x316545['filters']=_[_0xf1f6('0x31')](_0x316545['model'],_0x316545[_0xf1f6('0x29')]);_0x3850d0[_0xf1f6('0x32')]=_['intersection'](_0x316545['model'],qs[_0xf1f6('0x33')](_0x49ad3f[_0xf1f6('0x29')][_0xf1f6('0x33')]));_0x3850d0['attributes']=_0x3850d0[_0xf1f6('0x32')][_0xf1f6('0x34')]?_0x3850d0['attributes']:_0x316545[_0xf1f6('0x2e')];if(!_0x49ad3f['query'][_0xf1f6('0x45')](_0xf1f6('0x46'))){_0x3850d0[_0xf1f6('0x12')]=qs[_0xf1f6('0x12')](_0x49ad3f[_0xf1f6('0x29')]['limit']);_0x3850d0[_0xf1f6('0x10')]=qs['offset'](_0x49ad3f[_0xf1f6('0x29')][_0xf1f6('0x10')]);}_0x3850d0['order']=qs['sort'](_0x49ad3f[_0xf1f6('0x29')][_0xf1f6('0x47')]);_0x3850d0[_0xf1f6('0x27')]=qs['filters'](_[_0xf1f6('0x48')](_0x49ad3f['query'],_0x316545[_0xf1f6('0x30')]));_0x3850d0['where'][_0xf1f6('0x49')]=_0x2a49d5['id'];if(_0x49ad3f[_0xf1f6('0x29')][_0xf1f6('0x4a')]){_0x3850d0[_0xf1f6('0x27')]=_[_0xf1f6('0x36')](_0x3850d0[_0xf1f6('0x27')],{'$or':_[_0xf1f6('0x20')](_0x3850d0[_0xf1f6('0x32')],function(_0x473c7c){var _0x1f47ed={};_0x1f47ed[_0x473c7c]={'$like':'%'+_0x49ad3f['query']['filter']+'%'};return _0x1f47ed;})});}_0x3850d0=_[_0xf1f6('0x36')]({},_0x3850d0,_0x49ad3f[_0xf1f6('0x37')]);return db[_0xf1f6('0x4b')][_0xf1f6('0x2a')](_0x3850d0);}})[_0xf1f6('0x18')](function(_0x203918){if(_0x203918){return db[_0xf1f6('0x4c')][_0xf1f6('0x4d')]({'where':{'id':_[_0xf1f6('0x20')](_0x203918,'UserId'),'role':_0xf1f6('0x4e')},'attributes':['id','name',_0xf1f6('0x4f'),_0xf1f6('0x50'),'createdAt']});}})[_0xf1f6('0x18')](function(_0x5225bb){if(_0x5225bb){return{'count':_0x5225bb['count'],'rows':_[_0xf1f6('0x20')](_0x5225bb[_0xf1f6('0x2b')],function(_0x26010a){return{'membername':_0x26010a[_0xf1f6('0x1d')],'UserId':_0x26010a['id'],'queue_name':_0x487c03['name'],'MailQueueId':_0x487c03['id'],'interface':util['format'](_0xf1f6('0x51'),'SIP',_0x26010a['name']),'penalty':0x0,'paused':_0x26010a['mailPause'],'createdAt':_0x26010a[_0xf1f6('0x52')],'updatedAt':_0x26010a[_0xf1f6('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf1f6('0x18')](respondWithFilteredResult(_0x300b47,_0x3850d0))[_0xf1f6('0x2c')](handleError(_0x300b47,null));};exports[_0xf1f6('0x53')]=function(_0x38de93,_0x58ba0c){var _0x973f74={};var _0x2a69ba={};var _0x4fc766;var _0x33954d;return db[_0xf1f6('0x21')][_0xf1f6('0x44')]({'where':{'id':_0x38de93[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x58ba0c,null))[_0xf1f6('0x18')](function(_0x4d9930){if(_0x4d9930){_0x4fc766=_0x4d9930;_0x2a69ba[_0xf1f6('0x2e')]=_[_0xf1f6('0x2f')](db['Team'][_0xf1f6('0x22')]);_0x2a69ba[_0xf1f6('0x29')]=_[_0xf1f6('0x2f')](_0x38de93[_0xf1f6('0x29')]);_0x2a69ba['filters']=_[_0xf1f6('0x31')](_0x2a69ba['model'],_0x2a69ba[_0xf1f6('0x29')]);_0x973f74['attributes']=_[_0xf1f6('0x31')](_0x2a69ba[_0xf1f6('0x2e')],qs[_0xf1f6('0x33')](_0x38de93[_0xf1f6('0x29')][_0xf1f6('0x33')]));_0x973f74['attributes']=_0x973f74[_0xf1f6('0x32')][_0xf1f6('0x34')]?_0x973f74[_0xf1f6('0x32')]:_0x2a69ba[_0xf1f6('0x2e')];_0x973f74[_0xf1f6('0x54')]=qs[_0xf1f6('0x47')](_0x38de93[_0xf1f6('0x29')][_0xf1f6('0x47')]);_0x973f74[_0xf1f6('0x27')]=qs[_0xf1f6('0x30')](_['pick'](_0x38de93[_0xf1f6('0x29')],_0x2a69ba[_0xf1f6('0x30')]));if(_0x38de93[_0xf1f6('0x29')]['filter']){_0x973f74[_0xf1f6('0x27')]=_[_0xf1f6('0x36')](_0x973f74['where'],{'$or':_[_0xf1f6('0x20')](_0x973f74[_0xf1f6('0x32')],function(_0x29681c){var _0x19590c={};_0x19590c[_0x29681c]={'$like':'%'+_0x38de93[_0xf1f6('0x29')][_0xf1f6('0x4a')]+'%'};return _0x19590c;})});}_0x973f74=_[_0xf1f6('0x36')]({},_0x973f74,_0x38de93[_0xf1f6('0x37')]);return _0x4fc766[_0xf1f6('0x53')](_0x973f74);}})['then'](function(_0xf5179f){if(_0xf5179f){_0x33954d=_0xf5179f[_0xf1f6('0x34')];if(!_0x38de93[_0xf1f6('0x29')]['hasOwnProperty'](_0xf1f6('0x46'))){_0x973f74[_0xf1f6('0x12')]=qs['limit'](_0x38de93[_0xf1f6('0x29')][_0xf1f6('0x12')]);_0x973f74[_0xf1f6('0x10')]=qs[_0xf1f6('0x10')](_0x38de93[_0xf1f6('0x29')]['offset']);}return _0x4fc766[_0xf1f6('0x53')](_0x973f74);}})['then'](function(_0x487cf8){if(_0x487cf8){return _0x487cf8?{'count':_0x33954d,'rows':_0x487cf8}:null;}})['then'](respondWithResult(_0x58ba0c,null))[_0xf1f6('0x2c')](handleError(_0x58ba0c,null));};exports[_0xf1f6('0x55')]=function(_0x4ec08b,_0x225579){var _0xdace21=_0x4ec08b[_0xf1f6('0x39')]['ids'];return db[_0xf1f6('0x56')][_0xf1f6('0x2a')]({'where':{'id':_0xdace21},'attributes':['id'],'include':[{'model':db[_0xf1f6('0x4c')],'as':'Agents','attributes':['id',_0xf1f6('0x1d'),_0xf1f6('0x57'),_0xf1f6('0x58'),'interface'],'raw':!![]}]})[_0xf1f6('0x18')](function(_0x235dba){if(_0x235dba){var _0x1a6d7e=_['flatMap'](_0x235dba,function(_0x462eba){var _0x2a3e80=_0x462eba['get']({'plain':!![]});return _0x2a3e80['Agents'];});return db[_0xf1f6('0x21')][_0xf1f6('0x3f')]({'where':{'id':_0x4ec08b[_0xf1f6('0x2d')]['id']}})['then'](function(_0x3ef701){return db['sequelize']['transaction'](function(_0x39023){return _0x3ef701[_0xf1f6('0x55')](_0xdace21,{'transaction':_0x39023})[_0xf1f6('0x18')](function(){return BPromise[_0xf1f6('0x59')](_0x1a6d7e,function(_0x22c248){return db[_0xf1f6('0x4b')][_0xf1f6('0x5a')]({'where':{'UserId':_0x22c248['id'],'MailQueueId':_0x4ec08b[_0xf1f6('0x2d')]['id']},'transaction':_0x39023});});})['then'](function(){_0x1a6d7e[_0xf1f6('0x5b')](function(_0x4b6d2e){socket[_0xf1f6('0x5c')](_0xf1f6('0x5d'),{'UserId':_0x4b6d2e['id'],'MailQueueId':_0x3ef701['id']});});});});});}})[_0xf1f6('0x18')](respondWithStatusCode(_0x225579,null))[_0xf1f6('0x2c')](handleError(_0x225579,null));};exports[_0xf1f6('0x5e')]=function(_0x182efc,_0x5f4f91){return db[_0xf1f6('0x56')][_0xf1f6('0x2a')]({'where':{'id':_0x182efc['query'][_0xf1f6('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xf1f6('0x4c')],'as':_0xf1f6('0x60'),'attributes':['id'],'raw':!![]}]})[_0xf1f6('0x18')](handleEntityNotFound(_0x5f4f91,null))[_0xf1f6('0x18')](function(_0x112031){var _0x378094=_['map'](_0x112031,'id');var _0x4741ee=[];var _0x41f81d=[];var _0x4099da=squel[_0xf1f6('0x61')]();_0x4099da[_0xf1f6('0x62')](_0xf1f6('0x63'))[_0xf1f6('0x64')](_0xf1f6('0x65'),'tq')[_0xf1f6('0x66')]('user_has_teams','ut',_0xf1f6('0x67'))[_0xf1f6('0x27')](_0xf1f6('0x68'),_0x182efc[_0xf1f6('0x2d')]['id']);for(var _0x3c1fb6=0x0;_0x3c1fb6<_0x112031['length'];_0x3c1fb6+=0x1){let _0x3d11a4=_0x112031[_0x3c1fb6];for(var _0x2e6a36=0x0;_0x2e6a36<_0x3d11a4[_0xf1f6('0x60')][_0xf1f6('0x34')];_0x2e6a36+=0x1){let _0x5dc32e=_0x3d11a4[_0xf1f6('0x60')][_0x2e6a36];var _0x33b99e=_0x4099da[_0xf1f6('0x69')]();_0x33b99e['where'](_0xf1f6('0x6a'),_0x5dc32e['id']);_0x41f81d[_0xf1f6('0x6b')](db[_0xf1f6('0x6c')]['query'](_0x33b99e['toString'](),{'type':db['sequelize'][_0xf1f6('0x6d')][_0xf1f6('0x6e')]})[_0xf1f6('0x18')](function(_0x437429){if(_0x437429[_0xf1f6('0x34')]===0x1){return _0x5dc32e['id'];}else{var _0x51c200=_[_0xf1f6('0x6f')](_[_0xf1f6('0x20')](_0x437429,'TeamId'),function(_0x394f5c){return _[_0xf1f6('0x70')](_0x378094,_0x394f5c);});if(_0x51c200){return _0x5dc32e['id'];}}}));}}return BPromise[_0xf1f6('0x71')](_0x41f81d)[_0xf1f6('0x18')](function(_0x11d0f1){_0x4741ee=_(_0x4741ee)['union'](_0x11d0f1)['compact']()['value']();return db[_0xf1f6('0x21')][_0xf1f6('0x3f')]({'where':{'id':_0x182efc[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](function(_0x233fa4){return db[_0xf1f6('0x6c')]['transaction'](function(_0xe6dee9){return _0x233fa4[_0xf1f6('0x5e')](_0x182efc[_0xf1f6('0x29')][_0xf1f6('0x5f')],{'transaction':_0xe6dee9})[_0xf1f6('0x18')](function(){if(!_[_0xf1f6('0x72')](_0x4741ee)){return _0x233fa4['removeAgents'](_0x4741ee,{'transaction':_0xe6dee9});}})[_0xf1f6('0x18')](function(){_0x4741ee[_0xf1f6('0x5b')](function(_0x3785e4){socket['emit']('userMailQueue:remove',{'UserId':_0x3785e4,'MailQueueId':_0x233fa4['id']});});});});});});})[_0xf1f6('0x18')](respondWithStatusCode(_0x5f4f91,null))[_0xf1f6('0x2c')](handleError(_0x5f4f91,null));};exports[_0xf1f6('0x73')]=function(_0x1ccab9,_0x319a18){return db[_0xf1f6('0x21')][_0xf1f6('0x3f')]({'where':{'id':_0x1ccab9['params']['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x319a18,null))[_0xf1f6('0x18')](function(_0x4e1377){if(_0x4e1377){return _0x4e1377[_0xf1f6('0x73')](_0x1ccab9[_0xf1f6('0x39')][_0xf1f6('0x5f')],_[_0xf1f6('0x74')](_0x1ccab9[_0xf1f6('0x39')],[_0xf1f6('0x5f'),'id'])||{})[_0xf1f6('0x75')](function(_0x150314){for(var _0x147edd=0x0;_0x147edd<_0x1ccab9['body']['ids'][_0xf1f6('0x34')];_0x147edd+=0x1){socket['emit'](_0xf1f6('0x5d'),{'UserId':Number(_0x1ccab9['body'][_0xf1f6('0x5f')][_0x147edd]),'MailQueueId':Number(_0x1ccab9[_0xf1f6('0x2d')]['id'])});}return _0x150314;});}})[_0xf1f6('0x18')](respondWithResult(_0x319a18,null))[_0xf1f6('0x2c')](handleError(_0x319a18,null));};exports[_0xf1f6('0x76')]=function(_0x5ad9f4,_0x567570){return db['MailQueue']['find']({'where':{'id':_0x5ad9f4[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x567570,null))['then'](function(_0x1fcdbd){if(_0x1fcdbd){return _0x1fcdbd['removeAgents'](_0x5ad9f4[_0xf1f6('0x29')][_0xf1f6('0x5f')])['then'](function(){if(_[_0xf1f6('0x77')](_0x5ad9f4[_0xf1f6('0x29')][_0xf1f6('0x5f')])){for(var _0x4aa248=0x0;_0x4aa248<_0x5ad9f4[_0xf1f6('0x29')][_0xf1f6('0x5f')][_0xf1f6('0x34')];_0x4aa248+=0x1){socket[_0xf1f6('0x5c')](_0xf1f6('0x78'),{'UserId':Number(_0x5ad9f4[_0xf1f6('0x29')][_0xf1f6('0x5f')][_0x4aa248]),'MailQueueId':Number(_0x5ad9f4[_0xf1f6('0x2d')]['id'])});}}else{socket[_0xf1f6('0x5c')](_0xf1f6('0x78'),{'UserId':Number(_0x5ad9f4[_0xf1f6('0x29')]['ids']),'MailQueueId':Number(_0x5ad9f4['params']['id'])});}});}})[_0xf1f6('0x18')](respondWithStatusCode(_0x567570,null))[_0xf1f6('0x2c')](handleError(_0x567570,null));};exports[_0xf1f6('0x79')]=function(_0xafe020,_0x4d47da){var _0x2f63ff={};var _0x48fd5f={};var _0x13eabb;var _0x148761;return db[_0xf1f6('0x21')][_0xf1f6('0x44')]({'where':{'id':_0xafe020[_0xf1f6('0x2d')]['id']}})[_0xf1f6('0x18')](handleEntityNotFound(_0x4d47da,null))['then'](function(_0x4db674){if(_0x4db674){_0x13eabb=_0x4db674;_0x48fd5f['model']=_[_0xf1f6('0x2f')](db[_0xf1f6('0x4c')][_0xf1f6('0x22')]);_0x48fd5f[_0xf1f6('0x29')]=_[_0xf1f6('0x2f')](_0xafe020['query']);_0x48fd5f['filters']=_[_0xf1f6('0x31')](_0x48fd5f[_0xf1f6('0x2e')],_0x48fd5f[_0xf1f6('0x29')]);_0x2f63ff[_0xf1f6('0x32')]=_[_0xf1f6('0x31')](_0x48fd5f[_0xf1f6('0x2e')],qs[_0xf1f6('0x33')](_0xafe020[_0xf1f6('0x29')][_0xf1f6('0x33')]));_0x2f63ff[_0xf1f6('0x32')]=_0x2f63ff['attributes'][_0xf1f6('0x34')]?_0x2f63ff[_0xf1f6('0x32')]:_0x48fd5f[_0xf1f6('0x2e')];_0x2f63ff[_0xf1f6('0x54')]=qs[_0xf1f6('0x47')](_0xafe020[_0xf1f6('0x29')][_0xf1f6('0x47')]);_0x2f63ff[_0xf1f6('0x27')]=qs[_0xf1f6('0x30')](_['pick'](_0xafe020[_0xf1f6('0x29')],_0x48fd5f[_0xf1f6('0x30')]));if(_0xafe020[_0xf1f6('0x29')]['filter']){_0x2f63ff[_0xf1f6('0x27')]=_[_0xf1f6('0x36')](_0x2f63ff[_0xf1f6('0x27')],{'$or':_[_0xf1f6('0x20')](_0x2f63ff[_0xf1f6('0x32')],function(_0x46a0cc){var _0x4076e1={};_0x4076e1[_0x46a0cc]={'$like':'%'+_0xafe020['query'][_0xf1f6('0x4a')]+'%'};return _0x4076e1;})});}_0x2f63ff=_[_0xf1f6('0x36')]({},_0x2f63ff,_0xafe020[_0xf1f6('0x37')]);return _0x13eabb['getAgents'](_0x2f63ff);}})[_0xf1f6('0x18')](function(_0x309d00){if(_0x309d00){_0x148761=_0x309d00[_0xf1f6('0x34')];if(!_0xafe020[_0xf1f6('0x29')][_0xf1f6('0x45')](_0xf1f6('0x46'))){_0x2f63ff['limit']=qs['limit'](_0xafe020['query']['limit']);_0x2f63ff[_0xf1f6('0x10')]=qs['offset'](_0xafe020[_0xf1f6('0x29')][_0xf1f6('0x10')]);}return _0x13eabb[_0xf1f6('0x79')](_0x2f63ff);}})['then'](function(_0x33d3a8){if(_0x33d3a8){return _0x33d3a8?{'count':_0x148761,'rows':_0x33d3a8}:null;}})['then'](respondWithResult(_0x4d47da,null))[_0xf1f6('0x2c')](handleError(_0x4d47da,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 77ec930..3c9fe41 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 _0x4ad5=['emit','hasOwnProperty','hook','exports','events','MailQueue','save','remove'];(function(_0x4f6d44,_0xa5ff6d){var _0x2f47e8=function(_0x290345){while(--_0x290345){_0x4f6d44['push'](_0x4f6d44['shift']());}};_0x2f47e8(++_0xa5ff6d);}(_0x4ad5,0x74));var _0x54ad=function(_0x34e7cc,_0x2a3126){_0x34e7cc=_0x34e7cc-0x0;var _0x68015e=_0x4ad5[_0x34e7cc];return _0x68015e;};'use strict';var EventEmitter=require(_0x54ad('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x54ad('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54ad('0x2'),'afterUpdate':'update','afterDestroy':_0x54ad('0x3')};function emitEvent(_0x11f113){return function(_0x276ff5,_0x2bee06,_0x56eb8d){MailQueueEvents[_0x54ad('0x4')](_0x11f113+':'+_0x276ff5['id'],_0x276ff5);MailQueueEvents['emit'](_0x11f113,_0x276ff5);_0x56eb8d(null);};}for(var e in events){if(events[_0x54ad('0x5')](e)){var event=events[e];MailQueue[_0x54ad('0x6')](e,emitEvent(event));}}module[_0x54ad('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xe83d=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xe83d,0x6f));var _0xde83=function(_0x2d6fc6,_0x4b2538){_0x2d6fc6=_0x2d6fc6-0x0;var _0x57928f=_0xe83d[_0x2d6fc6];return _0x57928f;};'use strict';var EventEmitter=require(_0xde83('0x0'));var MailQueue=require(_0xde83('0x1'))['db'][_0xde83('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xde83('0x3')](0x0);var events={'afterCreate':_0xde83('0x4'),'afterUpdate':'update','afterDestroy':_0xde83('0x5')};function emitEvent(_0x1f29f0){return function(_0x26743a,_0x97aafc,_0x6e4060){MailQueueEvents[_0xde83('0x6')](_0x1f29f0+':'+_0x26743a['id'],_0x26743a);MailQueueEvents[_0xde83('0x6')](_0x1f29f0,_0x26743a);_0x6e4060(null);};}for(var e in events){if(events[_0xde83('0x7')](e)){var event=events[e];MailQueue[_0xde83('0x8')](e,emitEvent(event));}}module[_0xde83('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 01fd6d6..bbcabe7 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 _0x3868=['bluebird','request-promise','path','./mailQueue.attributes','exports','mail_queues','util','../../config/logger','api'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3868,0x12f));var _0x8386=function(_0x37226f,_0x3687ac){_0x37226f=_0x37226f-0x0;var _0x2683a7=_0x3868[_0x37226f];return _0x2683a7;};'use strict';var _=require('lodash');var util=require(_0x8386('0x0'));var logger=require(_0x8386('0x1'))(_0x8386('0x2'));var moment=require('moment');var BPromise=require(_0x8386('0x3'));var rp=require(_0x8386('0x4'));var fs=require('fs');var path=require(_0x8386('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8386('0x6'));module[_0x8386('0x7')]=function(_0x12002e,_0x1b237b){return _0x12002e['define']('MailQueue',attributes,{'tableName':_0x8386('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x284d=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','util'];(function(_0x1f6691,_0x3a3d46){var _0xf786b6=function(_0x2afbdb){while(--_0x2afbdb){_0x1f6691['push'](_0x1f6691['shift']());}};_0xf786b6(++_0x3a3d46);}(_0x284d,0x1d3));var _0xd284=function(_0x5b192c,_0x56bb3f){_0x5b192c=_0x5b192c-0x0;var _0x41c977=_0x284d[_0x5b192c];return _0x41c977;};'use strict';var _=require('lodash');var util=require(_0xd284('0x0'));var logger=require(_0xd284('0x1'))(_0xd284('0x2'));var moment=require(_0xd284('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd284('0x4'));var rimraf=require(_0xd284('0x5'));var config=require(_0xd284('0x6'));var attributes=require(_0xd284('0x7'));module[_0xd284('0x8')]=function(_0x40c51c,_0x5d1702){return _0x40c51c[_0xd284('0x9')](_0xd284('0xa'),attributes,{'tableName':_0xd284('0xb'),'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 07ce7b8..61235e4 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 _0x195a=['options','raw','where','include','model','attributes','map','stringify','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetMailQueue','MailQueue'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x195a,0x1cd));var _0xa195=function(_0x17aab4,_0x34d9a1){_0x17aab4=_0x17aab4-0x0;var _0x509379=_0x195a[_0x17aab4];return _0x509379;};'use strict';var _=require(_0xa195('0x0'));var util=require(_0xa195('0x1'));var moment=require(_0xa195('0x2'));var BPromise=require(_0xa195('0x3'));var rs=require(_0xa195('0x4'));var fs=require('fs');var Redis=require(_0xa195('0x5'));var db=require(_0xa195('0x6'))['db'];var utils=require(_0xa195('0x7'));var logger=require(_0xa195('0x8'))(_0xa195('0x9'));var config=require(_0xa195('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa195('0xb')][_0xa195('0xc')]({'port':0x232a});config[_0xa195('0xd')]=_[_0xa195('0xe')](config['redis'],{'host':_0xa195('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa195('0xd')]));require(_0xa195('0x10'))[_0xa195('0x11')](socket);function respondWithRpcPromise(_0x151120,_0x2c33c5,_0x4b06c6){return new BPromise(function(_0x59f36d,_0xe52b29){return client[_0xa195('0x12')](_0x151120,_0x4b06c6)[_0xa195('0x13')](function(_0x58a985){logger[_0xa195('0x14')](_0xa195('0x15'),_0x2c33c5,_0xa195('0x16'));logger[_0xa195('0x17')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2c33c5,_0xa195('0x16'),JSON['stringify'](_0x58a985));if(_0x58a985[_0xa195('0x18')]){if(_0x58a985[_0xa195('0x18')][_0xa195('0x19')]===0x1f4){logger[_0xa195('0x18')](_0xa195('0x15'),_0x2c33c5,_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);return _0xe52b29(_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);}logger[_0xa195('0x18')]('MailQueue,\x20%s,\x20%s',_0x2c33c5,_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);return _0x59f36d(_0x58a985[_0xa195('0x18')]['message']);}else{logger[_0xa195('0x14')]('MailQueue,\x20%s,\x20%s',_0x2c33c5,'request\x20sent');_0x59f36d(_0x58a985[_0xa195('0x1b')]['message']);}})[_0xa195('0x1c')](function(_0x4e8db6){logger['error'](_0xa195('0x15'),_0x2c33c5,_0x4e8db6);_0xe52b29(_0x4e8db6);});});}exports[_0xa195('0x1d')]=function(_0x13e2f1){var _0x3fab5b=this;return new Promise(function(_0x3e9c71,_0x1d3531){return db[_0xa195('0x1e')]['findAll']({'raw':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1['options'][_0xa195('0x20')]===undefined?!![]:![]:!![],'where':_0x13e2f1['options']?_0x13e2f1[_0xa195('0x1f')][_0xa195('0x21')]||null:null,'attributes':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1[_0xa195('0x1f')]['attributes']||null:null,'limit':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1[_0xa195('0x1f')]['limit']||null:null,'include':_0x13e2f1['options']?_0x13e2f1['options'][_0xa195('0x22')]?_['map'](_0x13e2f1[_0xa195('0x1f')][_0xa195('0x22')],function(_0x5c9894){return{'model':db[_0x5c9894[_0xa195('0x23')]],'as':_0x5c9894['as'],'attributes':_0x5c9894[_0xa195('0x24')],'include':_0x5c9894[_0xa195('0x22')]?_[_0xa195('0x25')](_0x5c9894[_0xa195('0x22')],function(_0x490fc0){return{'model':db[_0x490fc0[_0xa195('0x23')]],'as':_0x490fc0['as'],'attributes':_0x490fc0[_0xa195('0x24')],'include':_0x490fc0[_0xa195('0x22')]?_[_0xa195('0x25')](_0x490fc0['include'],function(_0x4ae7a3){return{'model':db[_0x4ae7a3['model']],'as':_0x4ae7a3['as'],'attributes':_0x4ae7a3[_0xa195('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5208){logger[_0xa195('0x14')](_0xa195('0x1d'),_0x13e2f1);logger[_0xa195('0x17')](_0xa195('0x1d'),_0x13e2f1,JSON[_0xa195('0x26')](_0x4d5208));_0x3e9c71(_0x4d5208);})[_0xa195('0x1c')](function(_0x260e97){logger[_0xa195('0x18')]('GetMailQueue',_0x260e97['message'],_0x13e2f1);_0x1d3531(_0x3fab5b[_0xa195('0x18')](0x1f4,_0x260e97[_0xa195('0x1a')]));});});};exports['ShowMailQueue']=function(_0x4e7d24){var _0x298809=this;return new Promise(function(_0x52bfe0,_0x121183){return db[_0xa195('0x1e')][_0xa195('0x27')]({'raw':_0x4e7d24['options']?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x20')]===undefined?!![]:![]:!![],'where':_0x4e7d24[_0xa195('0x1f')]?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x21')]||null:null,'attributes':_0x4e7d24[_0xa195('0x1f')]?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x24')]||null:null,'include':_0x4e7d24['options']?_0x4e7d24[_0xa195('0x1f')]['include']?_[_0xa195('0x25')](_0x4e7d24[_0xa195('0x1f')][_0xa195('0x22')],function(_0x4bc5aa){return{'model':db[_0x4bc5aa[_0xa195('0x23')]],'as':_0x4bc5aa['as'],'attributes':_0x4bc5aa[_0xa195('0x24')],'include':_0x4bc5aa[_0xa195('0x22')]?_[_0xa195('0x25')](_0x4bc5aa[_0xa195('0x22')],function(_0x54c924){return{'model':db[_0x54c924['model']],'as':_0x54c924['as'],'attributes':_0x54c924[_0xa195('0x24')],'include':_0x54c924['include']?_[_0xa195('0x25')](_0x54c924[_0xa195('0x22')],function(_0x4af207){return{'model':db[_0x4af207[_0xa195('0x23')]],'as':_0x4af207['as'],'attributes':_0x4af207['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a75e){logger[_0xa195('0x14')]('ShowMailQueue',_0x4e7d24);logger[_0xa195('0x17')](_0xa195('0x28'),_0x4e7d24,JSON['stringify'](_0x48a75e));_0x52bfe0(_0x48a75e);})[_0xa195('0x1c')](function(_0x4c4956){logger['error'](_0xa195('0x28'),_0x4c4956[_0xa195('0x1a')],_0x4e7d24);_0x121183(_0x298809[_0xa195('0x18')](0x1f4,_0x4c4956['message']));});});}; \ No newline at end of file +var _0xd1d4=['error','code','message','result','catch','GetMailQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowMailQueue','find','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d8104,_0x53906b){var _0x3aeb9a=function(_0x341388){while(--_0x341388){_0x5d8104['push'](_0x5d8104['shift']());}};_0x3aeb9a(++_0x53906b);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xd1d4[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var moment=require('moment');var BPromise=require(_0x4d1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d1d('0x3'))['db'];var utils=require(_0x4d1d('0x4'));var logger=require(_0x4d1d('0x5'))(_0x4d1d('0x6'));var config=require(_0x4d1d('0x7'));var jayson=require(_0x4d1d('0x8'));var client=jayson[_0x4d1d('0x9')][_0x4d1d('0xa')]({'port':0x232a});config[_0x4d1d('0xb')]=_[_0x4d1d('0xc')](config[_0x4d1d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d1d('0xb')]));require(_0x4d1d('0xd'))['register'](socket);function respondWithRpcPromise(_0x2053ab,_0x33d8a7,_0x3551f4){return new BPromise(function(_0x248db3,_0x2d4e00){return client[_0x4d1d('0xe')](_0x2053ab,_0x3551f4)[_0x4d1d('0xf')](function(_0x19a888){logger[_0x4d1d('0x10')](_0x4d1d('0x11'),_0x33d8a7,_0x4d1d('0x12'));logger[_0x4d1d('0x13')](_0x4d1d('0x14'),_0x33d8a7,'request\x20sent',JSON[_0x4d1d('0x15')](_0x19a888));if(_0x19a888[_0x4d1d('0x16')]){if(_0x19a888[_0x4d1d('0x16')][_0x4d1d('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x33d8a7,_0x19a888[_0x4d1d('0x16')][_0x4d1d('0x18')]);return _0x2d4e00(_0x19a888[_0x4d1d('0x16')]['message']);}logger[_0x4d1d('0x16')](_0x4d1d('0x11'),_0x33d8a7,_0x19a888[_0x4d1d('0x16')][_0x4d1d('0x18')]);return _0x248db3(_0x19a888['error']['message']);}else{logger['info'](_0x4d1d('0x11'),_0x33d8a7,_0x4d1d('0x12'));_0x248db3(_0x19a888[_0x4d1d('0x19')][_0x4d1d('0x18')]);}})[_0x4d1d('0x1a')](function(_0x48f5f3){logger[_0x4d1d('0x16')](_0x4d1d('0x11'),_0x33d8a7,_0x48f5f3);_0x2d4e00(_0x48f5f3);});});}exports[_0x4d1d('0x1b')]=function(_0xfdd184){var _0x10c894=this;return new Promise(function(_0x10d43c,_0x1a5dae){return db['MailQueue'][_0x4d1d('0x1c')]({'raw':_0xfdd184['options']?_0xfdd184[_0x4d1d('0x1d')][_0x4d1d('0x1e')]===undefined?!![]:![]:!![],'where':_0xfdd184[_0x4d1d('0x1d')]?_0xfdd184[_0x4d1d('0x1d')][_0x4d1d('0x1f')]||null:null,'attributes':_0xfdd184[_0x4d1d('0x1d')]?_0xfdd184[_0x4d1d('0x1d')]['attributes']||null:null,'limit':_0xfdd184[_0x4d1d('0x1d')]?_0xfdd184[_0x4d1d('0x1d')][_0x4d1d('0x20')]||null:null,'include':_0xfdd184[_0x4d1d('0x1d')]?_0xfdd184[_0x4d1d('0x1d')]['include']?_[_0x4d1d('0x21')](_0xfdd184[_0x4d1d('0x1d')][_0x4d1d('0x22')],function(_0x2a49a8){return{'model':db[_0x2a49a8[_0x4d1d('0x23')]],'as':_0x2a49a8['as'],'attributes':_0x2a49a8['attributes'],'include':_0x2a49a8[_0x4d1d('0x22')]?_['map'](_0x2a49a8[_0x4d1d('0x22')],function(_0x28e3ec){return{'model':db[_0x28e3ec[_0x4d1d('0x23')]],'as':_0x28e3ec['as'],'attributes':_0x28e3ec[_0x4d1d('0x24')],'include':_0x28e3ec[_0x4d1d('0x22')]?_[_0x4d1d('0x21')](_0x28e3ec['include'],function(_0x666c88){return{'model':db[_0x666c88[_0x4d1d('0x23')]],'as':_0x666c88['as'],'attributes':_0x666c88[_0x4d1d('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c84b9){logger[_0x4d1d('0x10')]('GetMailQueue',_0xfdd184);logger[_0x4d1d('0x13')](_0x4d1d('0x1b'),_0xfdd184,JSON[_0x4d1d('0x15')](_0x3c84b9));_0x10d43c(_0x3c84b9);})[_0x4d1d('0x1a')](function(_0x475773){logger[_0x4d1d('0x16')](_0x4d1d('0x1b'),_0x475773[_0x4d1d('0x18')],_0xfdd184);_0x1a5dae(_0x10c894['error'](0x1f4,_0x475773['message']));});});};exports[_0x4d1d('0x25')]=function(_0x497472){var _0x51c501=this;return new Promise(function(_0x3cd88d,_0x5e1e21){return db['MailQueue'][_0x4d1d('0x26')]({'raw':_0x497472['options']?_0x497472[_0x4d1d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x497472['options']?_0x497472[_0x4d1d('0x1d')][_0x4d1d('0x1f')]||null:null,'attributes':_0x497472[_0x4d1d('0x1d')]?_0x497472[_0x4d1d('0x1d')]['attributes']||null:null,'include':_0x497472['options']?_0x497472[_0x4d1d('0x1d')][_0x4d1d('0x22')]?_[_0x4d1d('0x21')](_0x497472[_0x4d1d('0x1d')][_0x4d1d('0x22')],function(_0x11f638){return{'model':db[_0x11f638['model']],'as':_0x11f638['as'],'attributes':_0x11f638[_0x4d1d('0x24')],'include':_0x11f638[_0x4d1d('0x22')]?_[_0x4d1d('0x21')](_0x11f638[_0x4d1d('0x22')],function(_0x15bd75){return{'model':db[_0x15bd75[_0x4d1d('0x23')]],'as':_0x15bd75['as'],'attributes':_0x15bd75['attributes'],'include':_0x15bd75[_0x4d1d('0x22')]?_[_0x4d1d('0x21')](_0x15bd75[_0x4d1d('0x22')],function(_0x4506fa){return{'model':db[_0x4506fa['model']],'as':_0x4506fa['as'],'attributes':_0x4506fa[_0x4d1d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4d1d('0xf')](function(_0x4dff36){logger['info'](_0x4d1d('0x25'),_0x497472);logger[_0x4d1d('0x13')]('ShowMailQueue',_0x497472,JSON[_0x4d1d('0x15')](_0x4dff36));_0x3cd88d(_0x4dff36);})[_0x4d1d('0x1a')](function(_0x168021){logger[_0x4d1d('0x16')](_0x4d1d('0x25'),_0x168021[_0x4d1d('0x18')],_0x497472);_0x5e1e21(_0x51c501[_0x4d1d('0x16')](0x1f4,_0x168021[_0x4d1d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 23e2297..395a614 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 _0xe4e7=['./mailQueue.events','save','remove','update','removeListener','register','length','mailQueue:'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xe4e7,0x78));var _0x7e4e=function(_0x24d80c,_0x3ac537){_0x24d80c=_0x24d80c-0x0;var _0x7ca8d5=_0xe4e7[_0x24d80c];return _0x7ca8d5;};'use strict';var MailQueueEvents=require(_0x7e4e('0x0'));var events=[_0x7e4e('0x1'),_0x7e4e('0x2'),_0x7e4e('0x3')];function createListener(_0x1e69da,_0x30e2d4){return function(_0x4ef71e){_0x30e2d4['emit'](_0x1e69da,_0x4ef71e);};}function removeListener(_0x5eec43,_0x358713){return function(){MailQueueEvents[_0x7e4e('0x4')](_0x5eec43,_0x358713);};}exports[_0x7e4e('0x5')]=function(_0x377f01){for(var _0x4290ea=0x0,_0x1bb676=events[_0x7e4e('0x6')];_0x4290ea<_0x1bb676;_0x4290ea++){var _0x354bc0=events[_0x4290ea];var _0x3bd511=createListener(_0x7e4e('0x7')+_0x354bc0,_0x377f01);MailQueueEvents['on'](_0x354bc0,_0x3bd511);}}; \ No newline at end of file +var _0x4b6a=['removeListener','register','length','mailQueue:','save','update','emit'];(function(_0x47fe16,_0x3f4938){var _0x6b37b9=function(_0x4cd752){while(--_0x4cd752){_0x47fe16['push'](_0x47fe16['shift']());}};_0x6b37b9(++_0x3f4938);}(_0x4b6a,0x146));var _0xa4b6=function(_0x21a6aa,_0x3eb610){_0x21a6aa=_0x21a6aa-0x0;var _0x6bd939=_0x4b6a[_0x21a6aa];return _0x6bd939;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xa4b6('0x0'),'remove',_0xa4b6('0x1')];function createListener(_0x4f1139,_0x135e4a){return function(_0x218705){_0x135e4a[_0xa4b6('0x2')](_0x4f1139,_0x218705);};}function removeListener(_0x1ec0b3,_0x435a05){return function(){MailQueueEvents[_0xa4b6('0x3')](_0x1ec0b3,_0x435a05);};}exports[_0xa4b6('0x4')]=function(_0x445c9d){for(var _0x127135=0x0,_0x48bd10=events[_0xa4b6('0x5')];_0x127135<_0x48bd10;_0x127135++){var _0x2bb4c0=events[_0x127135];var _0xf54ab=createListener(_0xa4b6('0x6')+_0x2bb4c0,_0x445c9d);MailQueueEvents['on'](_0x2bb4c0,_0xf54ab);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ed3960a..379c93a 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 _0x3eb8=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x10a4fe,_0x1b6647){var _0x52b093=function(_0x1eb8c6){while(--_0x1eb8c6){_0x10a4fe['push'](_0x10a4fe['shift']());}};_0x52b093(++_0x1b6647);}(_0x3eb8,0x1e9));var _0x83eb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3eb8[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x83eb('0x0'));var util=require('util');var path=require(_0x83eb('0x1'));var timeout=require(_0x83eb('0x2'));var express=require(_0x83eb('0x3'));var router=express[_0x83eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83eb('0x5'));var interaction=require(_0x83eb('0x6'));var config=require(_0x83eb('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x83eb('0x8')](),controller['index']);router[_0x83eb('0x9')](_0x83eb('0xa'),auth['isAuthenticated'](),controller[_0x83eb('0xb')]);router[_0x83eb('0x9')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0xd')]);router[_0x83eb('0xe')]('/',auth[_0x83eb('0x8')](),controller[_0x83eb('0xf')]);router[_0x83eb('0x10')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0x11')]);router[_0x83eb('0x12')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0x13')]);module[_0x83eb('0x14')]=router; \ No newline at end of file +var _0xd69f=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x3805b1,_0x183507){var _0x4563f0=function(_0x40117c){while(--_0x40117c){_0x3805b1['push'](_0x3805b1['shift']());}};_0x4563f0(++_0x183507);}(_0xd69f,0x144));var _0xfd69=function(_0x58b987,_0x105762){_0x58b987=_0x58b987-0x0;var _0x3b77eb=_0xd69f[_0x58b987];return _0x3b77eb;};'use strict';var multer=require(_0xfd69('0x0'));var util=require('util');var path=require(_0xfd69('0x1'));var timeout=require(_0xfd69('0x2'));var express=require(_0xfd69('0x3'));var router=express[_0xfd69('0x4')]();var fs_extra=require(_0xfd69('0x5'));var auth=require(_0xfd69('0x6'));var interaction=require(_0xfd69('0x7'));var config=require(_0xfd69('0x8'));var controller=require(_0xfd69('0x9'));router[_0xfd69('0xa')]('/',auth[_0xfd69('0xb')](),controller[_0xfd69('0xc')]);router['get'](_0xfd69('0xd'),auth[_0xfd69('0xb')](),controller[_0xfd69('0xe')]);router[_0xfd69('0xa')](_0xfd69('0xf'),auth[_0xfd69('0xb')](),controller[_0xfd69('0x10')]);router[_0xfd69('0x11')]('/',auth[_0xfd69('0xb')](),controller[_0xfd69('0x12')]);router[_0xfd69('0x13')](_0xfd69('0xf'),auth[_0xfd69('0xb')](),controller[_0xfd69('0x14')]);router[_0xfd69('0x15')](_0xfd69('0xf'),auth['isAuthenticated'](),controller[_0xfd69('0x16')]);module[_0xfd69('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 53b3a5c..7ce155f 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 _0x2660=['DATE','sequelize','exports','STRING'];(function(_0x1e1bc5,_0x3b9817){var _0x283d71=function(_0x38ac70){while(--_0x38ac70){_0x1e1bc5['push'](_0x1e1bc5['shift']());}};_0x283d71(++_0x3b9817);}(_0x2660,0x131));var _0x0266=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x2660[_0x1f1a97];return _0x29fc6a;};'use strict';var moment=require('moment');var Sequelize=require(_0x0266('0x0'));module[_0x0266('0x1')]={'uniqueid':{'type':Sequelize[_0x0266('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0266('0x2')]},'joinAt':{'type':Sequelize[_0x0266('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0266('0x3')]},'exitAt':{'type':Sequelize[_0x0266('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1458=['STRING','DATE','exports'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x1458,0x98));var _0x8145=function(_0x1ca8f4,_0x4361ba){_0x1ca8f4=_0x1ca8f4-0x0;var _0x513060=_0x1458[_0x1ca8f4];return _0x513060;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8145('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8145('0x1')]},'joinAt':{'type':Sequelize[_0x8145('0x2')]},'leaveAt':{'type':Sequelize[_0x8145('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8145('0x2')]},'reason':{'type':Sequelize[_0x8145('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d726814..5498261 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 _0x68b3=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x8a80a3,_0x5f4c6a){var _0x3c06fc=function(_0x5d2f60){while(--_0x5d2f60){_0x8a80a3['push'](_0x8a80a3['shift']());}};_0x3c06fc(++_0x5f4c6a);}(_0x68b3,0x1d8));var _0x368b=function(_0x2858bd,_0x2456a4){_0x2858bd=_0x2858bd-0x0;var _0x209a5e=_0x68b3[_0x2858bd];return _0x209a5e;};'use strict';var emlformat=require(_0x368b('0x0'));var rimraf=require(_0x368b('0x1'));var zipdir=require(_0x368b('0x2'));var jsonpatch=require(_0x368b('0x3'));var rp=require(_0x368b('0x4'));var moment=require('moment');var BPromise=require(_0x368b('0x5'));var Mustache=require(_0x368b('0x6'));var util=require(_0x368b('0x7'));var path=require(_0x368b('0x8'));var sox=require('sox');var csv=require(_0x368b('0x9'));var ejs=require(_0x368b('0xa'));var fs=require('fs');var fs_extra=require(_0x368b('0xb'));var _=require(_0x368b('0xc'));var squel=require(_0x368b('0xd'));var crypto=require(_0x368b('0xe'));var jsforce=require(_0x368b('0xf'));var deskjs=require(_0x368b('0x10'));var toCsv=require(_0x368b('0x9'));var querystring=require(_0x368b('0x11'));var Papa=require(_0x368b('0x12'));var Redis=require('ioredis');var authService=require(_0x368b('0x13'));var qs=require(_0x368b('0x14'));var as=require(_0x368b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x368b('0x16'))(_0x368b('0x17'));var utils=require(_0x368b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x368b('0x19'));var db=require(_0x368b('0x1a'))['db'];function respondWithStatusCode(_0x514dc7,_0x109a90){_0x109a90=_0x109a90||0xcc;return function(_0x250697){if(_0x250697){return _0x514dc7[_0x368b('0x1b')](_0x109a90);}return _0x514dc7[_0x368b('0x1c')](_0x109a90)[_0x368b('0x1d')]();};}function respondWithResult(_0x4fffe5,_0x2b326c){_0x2b326c=_0x2b326c||0xc8;return function(_0x40faa0){if(_0x40faa0){return _0x4fffe5['status'](_0x2b326c)[_0x368b('0x1e')](_0x40faa0);}};}function respondWithFilteredResult(_0x2aabb9,_0x30c245){return function(_0x515350){if(_0x515350){var _0x220cd5=typeof _0x30c245[_0x368b('0x1f')]===_0x368b('0x20')&&typeof _0x30c245['limit']===_0x368b('0x20');var _0x1b9e65=_0x515350[_0x368b('0x21')];var _0x540f57=_0x220cd5?0x0:_0x30c245['offset'];var _0x3e2e9f=_0x220cd5?_0x515350[_0x368b('0x21')]:_0x30c245[_0x368b('0x1f')]+_0x30c245[_0x368b('0x22')];var _0x1a4f20;if(_0x3e2e9f>=_0x1b9e65){_0x3e2e9f=_0x1b9e65;_0x1a4f20=0xc8;}else{_0x1a4f20=0xce;}_0x2aabb9['status'](_0x1a4f20);return _0x2aabb9[_0x368b('0x23')](_0x368b('0x24'),_0x540f57+'-'+_0x3e2e9f+'/'+_0x1b9e65)[_0x368b('0x1e')](_0x515350);}return null;};}function patchUpdates(_0x1c927f){return function(_0x23da8f){try{jsonpatch[_0x368b('0x25')](_0x23da8f,_0x1c927f,!![]);}catch(_0x397185){return BPromise[_0x368b('0x26')](_0x397185);}return _0x23da8f['save']();};}function saveUpdates(_0x13e750,_0x2f08d9){return function(_0x18869a){if(_0x18869a){return _0x18869a[_0x368b('0x27')](_0x13e750)[_0x368b('0x28')](function(_0x4c2fca){return _0x4c2fca;});}return null;};}function removeEntity(_0x286641,_0x1ca429){return function(_0x3a22bd){if(_0x3a22bd){return _0x3a22bd[_0x368b('0x29')]()[_0x368b('0x28')](function(){_0x286641[_0x368b('0x1c')](0xcc)[_0x368b('0x1d')]();});}};}function handleEntityNotFound(_0x11ea2d,_0x3123c1){return function(_0x3f7f89){if(!_0x3f7f89){_0x11ea2d[_0x368b('0x1b')](0x194);}return _0x3f7f89;};}function handleError(_0x344d8a,_0xceec4b){_0xceec4b=_0xceec4b||0x1f4;return function(_0x376e61){logger[_0x368b('0x2a')](_0x376e61[_0x368b('0x2b')]);if(_0x376e61[_0x368b('0x2c')]){delete _0x376e61[_0x368b('0x2c')];}_0x344d8a[_0x368b('0x1c')](_0xceec4b)[_0x368b('0x2d')](_0x376e61);};}exports[_0x368b('0x2e')]=function(_0xc12627,_0x107d2f){var _0x3c80b5={},_0x5db0b4={},_0x4af77a={'count':0x0,'rows':[]};var _0x381324=_[_0x368b('0x2f')](db[_0x368b('0x30')][_0x368b('0x31')],function(_0x5d6ebf){return{'name':_0x5d6ebf[_0x368b('0x32')],'type':_0x5d6ebf[_0x368b('0x33')][_0x368b('0x34')]};});_0x5db0b4[_0x368b('0x35')]=_[_0x368b('0x2f')](_0x381324,'name');_0x5db0b4[_0x368b('0x36')]=_[_0x368b('0x37')](_0xc12627[_0x368b('0x36')]);_0x5db0b4[_0x368b('0x38')]=_['intersection'](_0x5db0b4['model'],_0x5db0b4['query']);_0x3c80b5[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x5db0b4[_0x368b('0x35')],qs[_0x368b('0x3b')](_0xc12627[_0x368b('0x36')]['fields']));_0x3c80b5[_0x368b('0x39')]=_0x3c80b5[_0x368b('0x39')]['length']?_0x3c80b5[_0x368b('0x39')]:_0x5db0b4[_0x368b('0x35')];if(!_0xc12627['query'][_0x368b('0x3c')](_0x368b('0x3d'))){_0x3c80b5['limit']=qs[_0x368b('0x22')](_0xc12627['query']['limit']);_0x3c80b5['offset']=qs[_0x368b('0x1f')](_0xc12627[_0x368b('0x36')][_0x368b('0x1f')]);}_0x3c80b5[_0x368b('0x3e')]=qs[_0x368b('0x3f')](_0xc12627[_0x368b('0x36')][_0x368b('0x3f')]);_0x3c80b5[_0x368b('0x40')]=qs[_0x368b('0x38')](_[_0x368b('0x41')](_0xc12627['query'],_0x5db0b4[_0x368b('0x38')]),_0x381324);if(_0xc12627[_0x368b('0x36')]['filter']){_0x3c80b5[_0x368b('0x40')]=_[_0x368b('0x42')](_0x3c80b5[_0x368b('0x40')],{'$or':_[_0x368b('0x2f')](_0x381324,function(_0x248b2b){if(_0x248b2b['type']!==_0x368b('0x43')){var _0x4287c6={};_0x4287c6[_0x248b2b[_0x368b('0x2c')]]={'$like':'%'+_0xc12627[_0x368b('0x36')]['filter']+'%'};return _0x4287c6;}})});}_0x3c80b5=_['merge']({},_0x3c80b5,_0xc12627[_0x368b('0x44')]);var _0x3d00f9={'where':_0x3c80b5[_0x368b('0x40')]};return db[_0x368b('0x30')][_0x368b('0x21')](_0x3d00f9)[_0x368b('0x28')](function(_0x1d990c){_0x4af77a[_0x368b('0x21')]=_0x1d990c;if(_0xc12627[_0x368b('0x36')][_0x368b('0x45')]){_0x3c80b5['include']=[{'all':!![]}];}return db[_0x368b('0x30')][_0x368b('0x46')](_0x3c80b5);})['then'](function(_0x25e713){_0x4af77a[_0x368b('0x47')]=_0x25e713;return _0x4af77a;})[_0x368b('0x28')](respondWithFilteredResult(_0x107d2f,_0x3c80b5))[_0x368b('0x48')](handleError(_0x107d2f,null));};exports['show']=function(_0x490eb6,_0x151711){var _0x4a0275={'raw':!![],'where':{'id':_0x490eb6[_0x368b('0x49')]['id']}},_0x91bb0b={};_0x91bb0b[_0x368b('0x35')]=_['keys'](db[_0x368b('0x30')][_0x368b('0x31')]);_0x91bb0b[_0x368b('0x36')]=_['keys'](_0x490eb6['query']);_0x91bb0b[_0x368b('0x38')]=_[_0x368b('0x3a')](_0x91bb0b['model'],_0x91bb0b[_0x368b('0x36')]);_0x4a0275[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x91bb0b[_0x368b('0x35')],qs[_0x368b('0x3b')](_0x490eb6[_0x368b('0x36')][_0x368b('0x3b')]));_0x4a0275[_0x368b('0x39')]=_0x4a0275[_0x368b('0x39')][_0x368b('0x4a')]?_0x4a0275[_0x368b('0x39')]:_0x91bb0b[_0x368b('0x35')];if(_0x490eb6[_0x368b('0x36')]['includeAll']){_0x4a0275[_0x368b('0x4b')]=[{'all':!![]}];}_0x4a0275=_[_0x368b('0x42')]({},_0x4a0275,_0x490eb6[_0x368b('0x44')]);return db[_0x368b('0x30')][_0x368b('0x4c')](_0x4a0275)['then'](handleEntityNotFound(_0x151711,null))['then'](respondWithResult(_0x151711,null))[_0x368b('0x48')](handleError(_0x151711,null));};exports[_0x368b('0x4d')]=function(_0x1c8755,_0x5a9d70){return db[_0x368b('0x30')][_0x368b('0x4d')](_0x1c8755[_0x368b('0x4e')],{})[_0x368b('0x28')](respondWithResult(_0x5a9d70,0xc9))[_0x368b('0x48')](handleError(_0x5a9d70,null));};exports[_0x368b('0x27')]=function(_0x8f35b,_0x1174fa){if(_0x8f35b[_0x368b('0x4e')]['id']){delete _0x8f35b[_0x368b('0x4e')]['id'];}return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x8f35b['params']['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x1174fa,null))['then'](saveUpdates(_0x8f35b[_0x368b('0x4e')],null))['then'](respondWithResult(_0x1174fa,null))[_0x368b('0x48')](handleError(_0x1174fa,null));};exports[_0x368b('0x29')]=function(_0x3b8a12,_0x458d9a){return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x3b8a12[_0x368b('0x49')]['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x458d9a,null))[_0x368b('0x28')](removeEntity(_0x458d9a,null))[_0x368b('0x48')](handleError(_0x458d9a,null));};exports[_0x368b('0x4f')]=function(_0x3898a8,_0x15078b){return db[_0x368b('0x30')]['describe']()[_0x368b('0x28')](respondWithResult(_0x15078b,null))[_0x368b('0x48')](handleError(_0x15078b,null));}; \ No newline at end of file +var _0xbff5=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','MailQueueReport','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash'];(function(_0x555c42,_0x1aad30){var _0x482a6b=function(_0x11e6bb){while(--_0x11e6bb){_0x555c42['push'](_0x555c42['shift']());}};_0x482a6b(++_0x1aad30);}(_0xbff5,0x1bc));var _0x5bff=function(_0x551bfe,_0x33bf1f){_0x551bfe=_0x551bfe-0x0;var _0x57153f=_0xbff5[_0x551bfe];return _0x57153f;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=typeof _0x4d883e[_0x5bff('0x1b')]==='undefined'&&typeof _0x4d883e[_0x5bff('0x1c')]===_0x5bff('0x1d');var _0x38daa0=_0x2d22ab['count'];var _0xc9fbc3=_0x4612ec?0x0:_0x4d883e[_0x5bff('0x1b')];var _0x36653b=_0x4612ec?_0x2d22ab[_0x5bff('0x1e')]:_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1c')];var _0x5357d4;if(_0x36653b>=_0x38daa0){_0x36653b=_0x38daa0;_0x5357d4=0xc8;}else{_0x5357d4=0xce;}_0x3a507c[_0x5bff('0x19')](_0x5357d4);return _0x3a507c['set'](_0x5bff('0x1f'),_0xc9fbc3+'-'+_0x36653b+'/'+_0x38daa0)[_0x5bff('0x1a')](_0x2d22ab);}return null;};}function patchUpdates(_0x2a83ce){return function(_0x6cbfa){try{jsonpatch[_0x5bff('0x20')](_0x6cbfa,_0x2a83ce,!![]);}catch(_0x2012e4){return BPromise[_0x5bff('0x21')](_0x2012e4);}return _0x6cbfa[_0x5bff('0x22')]();};}function saveUpdates(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x23')](_0x155e16)[_0x5bff('0x24')](function(_0x1e7f8a){return _0x1e7f8a;});}return null;};}function removeEntity(_0x352b1f,_0x31d26b){return function(_0x3913fd){if(_0x3913fd){return _0x3913fd[_0x5bff('0x25')]()['then'](function(){_0x352b1f['status'](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x53bd97,_0x220c8f){return function(_0xcc091d){if(!_0xcc091d){_0x53bd97[_0x5bff('0x17')](0x194);}return _0xcc091d;};}function handleError(_0x6f18f1,_0xfa361d){_0xfa361d=_0xfa361d||0x1f4;return function(_0x1140eb){logger[_0x5bff('0x26')](_0x1140eb[_0x5bff('0x27')]);if(_0x1140eb['name']){delete _0x1140eb['name'];}_0x6f18f1[_0x5bff('0x19')](_0xfa361d)[_0x5bff('0x28')](_0x1140eb);};}exports['index']=function(_0x36a7d2,_0x588078){var _0x5470cb={},_0x3eda3a={},_0x5cf207={'count':0x0,'rows':[]};var _0x3ed23b=_[_0x5bff('0x29')](db[_0x5bff('0x2a')][_0x5bff('0x2b')],function(_0x48aee1){return{'name':_0x48aee1[_0x5bff('0x2c')],'type':_0x48aee1['type'][_0x5bff('0x2d')]};});_0x3eda3a['model']=_[_0x5bff('0x29')](_0x3ed23b,_0x5bff('0x2e'));_0x3eda3a[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x36a7d2[_0x5bff('0x2f')]);_0x3eda3a[_0x5bff('0x31')]=_['intersection'](_0x3eda3a[_0x5bff('0x32')],_0x3eda3a[_0x5bff('0x2f')]);_0x5470cb[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x3eda3a[_0x5bff('0x32')],qs[_0x5bff('0x35')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x35')]));_0x5470cb['attributes']=_0x5470cb[_0x5bff('0x33')][_0x5bff('0x36')]?_0x5470cb[_0x5bff('0x33')]:_0x3eda3a[_0x5bff('0x32')];if(!_0x36a7d2['query'][_0x5bff('0x37')](_0x5bff('0x38'))){_0x5470cb['limit']=qs[_0x5bff('0x1c')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1c')]);_0x5470cb[_0x5bff('0x1b')]=qs['offset'](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1b')]);}_0x5470cb[_0x5bff('0x39')]=qs['sort'](_0x36a7d2[_0x5bff('0x2f')]['sort']);_0x5470cb[_0x5bff('0x3a')]=qs[_0x5bff('0x31')](_[_0x5bff('0x3b')](_0x36a7d2['query'],_0x3eda3a[_0x5bff('0x31')]),_0x3ed23b);if(_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x3c')]){_0x5470cb['where']=_[_0x5bff('0x3d')](_0x5470cb[_0x5bff('0x3a')],{'$or':_['map'](_0x3ed23b,function(_0x265cdb){if(_0x265cdb[_0x5bff('0x3e')]!==_0x5bff('0x3f')){var _0x77a071={};_0x77a071[_0x265cdb[_0x5bff('0x2e')]]={'$like':'%'+_0x36a7d2['query'][_0x5bff('0x3c')]+'%'};return _0x77a071;}})});}_0x5470cb=_['merge']({},_0x5470cb,_0x36a7d2[_0x5bff('0x40')]);var _0x2fecb9={'where':_0x5470cb[_0x5bff('0x3a')]};return db[_0x5bff('0x2a')][_0x5bff('0x1e')](_0x2fecb9)[_0x5bff('0x24')](function(_0x1d0346){_0x5cf207['count']=_0x1d0346;if(_0x36a7d2['query'][_0x5bff('0x41')]){_0x5470cb[_0x5bff('0x42')]=[{'all':!![]}];}return db[_0x5bff('0x2a')][_0x5bff('0x43')](_0x5470cb);})[_0x5bff('0x24')](function(_0xb7b82a){_0x5cf207[_0x5bff('0x44')]=_0xb7b82a;return _0x5cf207;})[_0x5bff('0x24')](respondWithFilteredResult(_0x588078,_0x5470cb))['catch'](handleError(_0x588078,null));};exports[_0x5bff('0x45')]=function(_0x49676f,_0x3dc13f){var _0x1b8c7f={'raw':!![],'where':{'id':_0x49676f[_0x5bff('0x46')]['id']}},_0x543517={};_0x543517[_0x5bff('0x32')]=_['keys'](db[_0x5bff('0x2a')][_0x5bff('0x2b')]);_0x543517[_0x5bff('0x2f')]=_['keys'](_0x49676f[_0x5bff('0x2f')]);_0x543517[_0x5bff('0x31')]=_[_0x5bff('0x34')](_0x543517['model'],_0x543517[_0x5bff('0x2f')]);_0x1b8c7f[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x543517[_0x5bff('0x32')],qs['fields'](_0x49676f[_0x5bff('0x2f')]['fields']));_0x1b8c7f['attributes']=_0x1b8c7f[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b8c7f['attributes']:_0x543517[_0x5bff('0x32')];if(_0x49676f[_0x5bff('0x2f')]['includeAll']){_0x1b8c7f[_0x5bff('0x42')]=[{'all':!![]}];}_0x1b8c7f=_[_0x5bff('0x3d')]({},_0x1b8c7f,_0x49676f[_0x5bff('0x40')]);return db[_0x5bff('0x2a')]['find'](_0x1b8c7f)[_0x5bff('0x24')](handleEntityNotFound(_0x3dc13f,null))[_0x5bff('0x24')](respondWithResult(_0x3dc13f,null))[_0x5bff('0x47')](handleError(_0x3dc13f,null));};exports[_0x5bff('0x48')]=function(_0x1e94c5,_0x2588b8){return db['MailQueueReport'][_0x5bff('0x48')](_0x1e94c5[_0x5bff('0x49')],{})['then'](respondWithResult(_0x2588b8,0xc9))[_0x5bff('0x47')](handleError(_0x2588b8,null));};exports['update']=function(_0x47fc14,_0x4ff13a){if(_0x47fc14[_0x5bff('0x49')]['id']){delete _0x47fc14[_0x5bff('0x49')]['id'];}return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x47fc14[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x4ff13a,null))[_0x5bff('0x24')](saveUpdates(_0x47fc14[_0x5bff('0x49')],null))['then'](respondWithResult(_0x4ff13a,null))[_0x5bff('0x47')](handleError(_0x4ff13a,null));};exports[_0x5bff('0x25')]=function(_0x5e99f5,_0x16c61e){return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x5e99f5[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x16c61e,null))[_0x5bff('0x24')](removeEntity(_0x16c61e,null))[_0x5bff('0x47')](handleError(_0x16c61e,null));};exports['describe']=function(_0x36089e,_0x18018e){return db['MailQueueReport'][_0x5bff('0x4b')]()[_0x5bff('0x24')](respondWithResult(_0x18018e,null))['catch'](handleError(_0x18018e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c4b2694..ccf757b 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 _0x50b2=['./mailQueueReport.attributes','define','report_mail_queue','uniqueid','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x5be0d8,_0x594a72){var _0x1119c7=function(_0x3946b9){while(--_0x3946b9){_0x5be0d8['push'](_0x5be0d8['shift']());}};_0x1119c7(++_0x594a72);}(_0x50b2,0x9d));var _0x250b=function(_0x1a3488,_0x3874b0){_0x1a3488=_0x1a3488-0x0;var _0x8398da=_0x50b2[_0x1a3488];return _0x8398da;};'use strict';var _=require('lodash');var util=require(_0x250b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x250b('0x1'));var BPromise=require(_0x250b('0x2'));var rp=require(_0x250b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x250b('0x4'));var attributes=require(_0x250b('0x5'));module['exports']=function(_0x366242,_0x80961f){return _0x366242[_0x250b('0x6')]('MailQueueReport',attributes,{'tableName':_0x250b('0x7'),'paranoid':![],'indexes':[{'name':_0x250b('0x8'),'fields':[_0x250b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64df=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x6947e3,_0x754555){var _0x2779b7=function(_0x4b435e){while(--_0x4b435e){_0x6947e3['push'](_0x6947e3['shift']());}};_0x2779b7(++_0x754555);}(_0x64df,0x1f2));var _0xf64d=function(_0x13d816,_0x37ca7){_0x13d816=_0x13d816-0x0;var _0x5ab9fe=_0x64df[_0x13d816];return _0x5ab9fe;};'use strict';var _=require(_0xf64d('0x0'));var util=require('util');var logger=require(_0xf64d('0x1'))(_0xf64d('0x2'));var moment=require(_0xf64d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf64d('0x4'));var fs=require('fs');var path=require(_0xf64d('0x5'));var rimraf=require(_0xf64d('0x6'));var config=require(_0xf64d('0x7'));var attributes=require(_0xf64d('0x8'));module[_0xf64d('0x9')]=function(_0x6f5080,_0x48f428){return _0x6f5080[_0xf64d('0xa')](_0xf64d('0xb'),attributes,{'tableName':_0xf64d('0xc'),'paranoid':![],'indexes':[{'name':_0xf64d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 117a2bc..6abe818 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3303fb,_0x1266dd){var _0x71a686=function(_0x2c7537){while(--_0x2c7537){_0x3303fb['push'](_0x3303fb['shift']());}};_0x71a686(++_0x1266dd);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f5049,_0x598cff){_0x3f5049=_0x3f5049-0x0;var _0x14e6bf=_0x2ef3[_0x3f5049];return _0x14e6bf;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x28496e,_0x9b8071){var _0xd0374f=function(_0x3ee281){while(--_0x3ee281){_0x28496e['push'](_0x28496e['shift']());}};_0xd0374f(++_0x9b8071);}(_0x7a54,0x106));var _0x47a5=function(_0x11ab51,_0x4161e5){_0x11ab51=_0x11ab51-0x0;var _0x58372c=_0x7a54[_0x11ab51];return _0x58372c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6d13976..27b6d7e 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(_0x3fde99,_0x2bdddf){var _0x450279=function(_0x2a0cd9){while(--_0x2a0cd9){_0x3fde99['push'](_0x3fde99['shift']());}};_0x450279(++_0x2bdddf);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x32f593,_0x32d731){var _0x3f7e3e=function(_0x2777d4){while(--_0x2777d4){_0x32f593['push'](_0x32f593['shift']());}};_0x3f7e3e(++_0x32d731);}(_0xe706,0xa3));var _0x6e70=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0xe706[_0x1090f8];return _0x180524;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index abc3e5e..aa50c79 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 _0x288a=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x506cbf,_0xb7e1d8){var _0x5513f1=function(_0x25a9c4){while(--_0x25a9c4){_0x506cbf['push'](_0x506cbf['shift']());}};_0x5513f1(++_0xb7e1d8);}(_0x288a,0x1d5));var _0xa288=function(_0x401796,_0x422977){_0x401796=_0x401796-0x0;var _0x3e14b9=_0x288a[_0x401796];return _0x3e14b9;};'use strict';var Sequelize=require(_0xa288('0x0'));module[_0xa288('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa288('0x2')]},'authentication':{'type':Sequelize[_0xa288('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa288('0x2')]},'password':{'type':Sequelize[_0xa288('0x2')]},'port':{'type':Sequelize[_0xa288('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa288('0x2')],'defaultValue':_0xa288('0x5')},'connTimeout':{'type':Sequelize[_0xa288('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa288('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa288('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe8a1=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x17648f,_0xa233ee){var _0x1853a5=function(_0x1647a0){while(--_0x1647a0){_0x17648f['push'](_0x17648f['shift']());}};_0x1853a5(++_0xa233ee);}(_0xe8a1,0xf8));var _0x1e8a=function(_0x4e1ff6,_0x3365f5){_0x4e1ff6=_0x4e1ff6-0x0;var _0x55f00f=_0xe8a1[_0x4e1ff6];return _0x55f00f;};'use strict';var Sequelize=require(_0x1e8a('0x0'));module[_0x1e8a('0x1')]={'description':{'type':Sequelize[_0x1e8a('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1e8a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1e8a('0x2')]},'password':{'type':Sequelize[_0x1e8a('0x2')]},'port':{'type':Sequelize[_0x1e8a('0x4')]},'tls':{'type':Sequelize[_0x1e8a('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1e8a('0x2')],'defaultValue':_0x1e8a('0x5')},'connTimeout':{'type':Sequelize[_0x1e8a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x1e8a('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6ae3da3..df3c259 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 _0xc8df=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c0538,_0xca5082){var _0x227cfc=function(_0x28f3e2){while(--_0x28f3e2){_0x3c0538['push'](_0x3c0538['shift']());}};_0x227cfc(++_0xca5082);}(_0xc8df,0x73));var _0xfc8d=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc8df[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0xfc8d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfc8d('0x1'));var BPromise=require(_0xfc8d('0x2'));var rp=require(_0xfc8d('0x3'));var fs=require('fs');var path=require(_0xfc8d('0x4'));var rimraf=require(_0xfc8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc8d('0x6'));module[_0xfc8d('0x7')]=function(_0x5b084d,_0xc98e4b){return _0x5b084d[_0xfc8d('0x8')](_0xfc8d('0x9'),attributes,{'tableName':_0xfc8d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffb2=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','../../config/logger','api','moment','request-promise'];(function(_0x3fe270,_0x21ee95){var _0x40b034=function(_0xf582d3){while(--_0xf582d3){_0x3fe270['push'](_0x3fe270['shift']());}};_0x40b034(++_0x21ee95);}(_0xffb2,0x1c4));var _0x2ffb=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xffb2[_0x237da8];return _0x558825;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ffb('0x0'))(_0x2ffb('0x1'));var moment=require(_0x2ffb('0x2'));var BPromise=require('bluebird');var rp=require(_0x2ffb('0x3'));var fs=require('fs');var path=require(_0x2ffb('0x4'));var rimraf=require(_0x2ffb('0x5'));var config=require(_0x2ffb('0x6'));var attributes=require(_0x2ffb('0x7'));module[_0x2ffb('0x8')]=function(_0x2b1c03,_0x447417){return _0x2b1c03[_0x2ffb('0x9')](_0x2ffb('0xa'),attributes,{'tableName':_0x2ffb('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 2ae90e7..f77f474 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 _0x793a=['MailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn'];(function(_0x332764,_0x1bfe34){var _0xed0097=function(_0x239e4){while(--_0x239e4){_0x332764['push'](_0x332764['shift']());}};_0xed0097(++_0x1bfe34);}(_0x793a,0x86));var _0xa793=function(_0x192865,_0x34dde2){_0x192865=_0x192865-0x0;var _0x4c3d84=_0x793a[_0x192865];return _0x4c3d84;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa793('0x0'));var fs=require('fs');var Redis=require(_0xa793('0x1'));var db=require(_0xa793('0x2'))['db'];var utils=require(_0xa793('0x3'));var logger=require(_0xa793('0x4'))(_0xa793('0x5'));var config=require('../../config/environment');var jayson=require(_0xa793('0x6'));var client=jayson[_0xa793('0x7')][_0xa793('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490c43,_0x437555,_0x3fd3d1){return new BPromise(function(_0x1fc234,_0x59b523){return client[_0xa793('0x9')](_0x490c43,_0x3fd3d1)[_0xa793('0xa')](function(_0x18c5b1){logger[_0xa793('0xb')]('MailServerIn,\x20%s,\x20%s',_0x437555,_0xa793('0xc'));logger['debug'](_0xa793('0xd'),_0x437555,_0xa793('0xc'),JSON[_0xa793('0xe')](_0x18c5b1));if(_0x18c5b1['error']){if(_0x18c5b1[_0xa793('0xf')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x437555,_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);return _0x59b523(_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);}logger['error'](_0xa793('0x11'),_0x437555,_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);return _0x1fc234(_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);}else{logger[_0xa793('0xb')]('MailServerIn,\x20%s,\x20%s',_0x437555,_0xa793('0xc'));_0x1fc234(_0x18c5b1[_0xa793('0x12')][_0xa793('0x10')]);}})[_0xa793('0x13')](function(_0x1f24f1){logger[_0xa793('0xf')](_0xa793('0x11'),_0x437555,_0x1f24f1);_0x59b523(_0x1f24f1);});});}exports[_0xa793('0x14')]=function(_0x5aefc7){var _0x196bac=this;return new Promise(function(_0x3b6cea,_0x5ac034){return db[_0xa793('0x15')][_0xa793('0x16')]({'raw':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x18')]===undefined?!![]:![]:!![],'where':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7['options'][_0xa793('0x19')]||null:null,'attributes':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x1a')]||null:null,'limit':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')]['limit']||null:null,'include':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x1b')]?_[_0xa793('0x1c')](_0x5aefc7[_0xa793('0x17')][_0xa793('0x1b')],function(_0x46e490){return{'model':db[_0x46e490['model']],'as':_0x46e490['as'],'attributes':_0x46e490[_0xa793('0x1a')],'include':_0x46e490[_0xa793('0x1b')]?_['map'](_0x46e490[_0xa793('0x1b')],function(_0x450634){return{'model':db[_0x450634[_0xa793('0x1d')]],'as':_0x450634['as'],'attributes':_0x450634[_0xa793('0x1a')],'include':_0x450634[_0xa793('0x1b')]?_[_0xa793('0x1c')](_0x450634[_0xa793('0x1b')],function(_0x55036e){return{'model':db[_0x55036e[_0xa793('0x1d')]],'as':_0x55036e['as'],'attributes':_0x55036e[_0xa793('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa793('0xa')](function(_0x5dec1a){logger['info'](_0xa793('0x14'),_0x5aefc7);logger[_0xa793('0x1e')](_0xa793('0x14'),_0x5aefc7,JSON[_0xa793('0xe')](_0x5dec1a));_0x3b6cea(_0x5dec1a);})[_0xa793('0x13')](function(_0x26725d){logger[_0xa793('0xf')](_0xa793('0x14'),_0x26725d[_0xa793('0x10')],_0x5aefc7);_0x5ac034(_0x196bac[_0xa793('0xf')](0x1f4,_0x26725d[_0xa793('0x10')]));});});}; \ No newline at end of file +var _0x27ba=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','options','where','attributes','limit','include','model','map','catch'];(function(_0x343419,_0x4766ec){var _0xdf4d7=function(_0x1ebb52){while(--_0x1ebb52){_0x343419['push'](_0x343419['shift']());}};_0xdf4d7(++_0x4766ec);}(_0x27ba,0xaf));var _0xa27b=function(_0x3e1385,_0x44a710){_0x3e1385=_0x3e1385-0x0;var _0x1d2b94=_0x27ba[_0x3e1385];return _0x1d2b94;};'use strict';var _=require(_0xa27b('0x0'));var util=require(_0xa27b('0x1'));var moment=require(_0xa27b('0x2'));var BPromise=require(_0xa27b('0x3'));var rs=require(_0xa27b('0x4'));var fs=require('fs');var Redis=require(_0xa27b('0x5'));var db=require(_0xa27b('0x6'))['db'];var utils=require(_0xa27b('0x7'));var logger=require(_0xa27b('0x8'))(_0xa27b('0x9'));var config=require(_0xa27b('0xa'));var jayson=require(_0xa27b('0xb'));var client=jayson[_0xa27b('0xc')][_0xa27b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3f736d,_0x7ce2,_0x2407b7){return new BPromise(function(_0x173647,_0x3fe42e){return client['request'](_0x3f736d,_0x2407b7)[_0xa27b('0xe')](function(_0x3994d1){logger[_0xa27b('0xf')](_0xa27b('0x10'),_0x7ce2,_0xa27b('0x11'));logger[_0xa27b('0x12')](_0xa27b('0x13'),_0x7ce2,_0xa27b('0x11'),JSON[_0xa27b('0x14')](_0x3994d1));if(_0x3994d1['error']){if(_0x3994d1[_0xa27b('0x15')][_0xa27b('0x16')]===0x1f4){logger[_0xa27b('0x15')](_0xa27b('0x10'),_0x7ce2,_0x3994d1[_0xa27b('0x15')][_0xa27b('0x17')]);return _0x3fe42e(_0x3994d1[_0xa27b('0x15')][_0xa27b('0x17')]);}logger['error'](_0xa27b('0x10'),_0x7ce2,_0x3994d1[_0xa27b('0x15')][_0xa27b('0x17')]);return _0x173647(_0x3994d1['error'][_0xa27b('0x17')]);}else{logger[_0xa27b('0xf')]('MailServerIn,\x20%s,\x20%s',_0x7ce2,_0xa27b('0x11'));_0x173647(_0x3994d1[_0xa27b('0x18')][_0xa27b('0x17')]);}})['catch'](function(_0x3db22a){logger[_0xa27b('0x15')](_0xa27b('0x10'),_0x7ce2,_0x3db22a);_0x3fe42e(_0x3db22a);});});}exports[_0xa27b('0x19')]=function(_0x99eb9e){var _0xd7acde=this;return new Promise(function(_0x3c1f9d,_0x3994ea){return db[_0xa27b('0x1a')]['findAll']({'raw':_0x99eb9e[_0xa27b('0x1b')]?_0x99eb9e[_0xa27b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x99eb9e[_0xa27b('0x1b')]?_0x99eb9e[_0xa27b('0x1b')][_0xa27b('0x1c')]||null:null,'attributes':_0x99eb9e[_0xa27b('0x1b')]?_0x99eb9e[_0xa27b('0x1b')][_0xa27b('0x1d')]||null:null,'limit':_0x99eb9e['options']?_0x99eb9e['options'][_0xa27b('0x1e')]||null:null,'include':_0x99eb9e[_0xa27b('0x1b')]?_0x99eb9e[_0xa27b('0x1b')][_0xa27b('0x1f')]?_['map'](_0x99eb9e[_0xa27b('0x1b')][_0xa27b('0x1f')],function(_0xa04f3c){return{'model':db[_0xa04f3c[_0xa27b('0x20')]],'as':_0xa04f3c['as'],'attributes':_0xa04f3c[_0xa27b('0x1d')],'include':_0xa04f3c[_0xa27b('0x1f')]?_[_0xa27b('0x21')](_0xa04f3c[_0xa27b('0x1f')],function(_0x397cc4){return{'model':db[_0x397cc4[_0xa27b('0x20')]],'as':_0x397cc4['as'],'attributes':_0x397cc4[_0xa27b('0x1d')],'include':_0x397cc4[_0xa27b('0x1f')]?_[_0xa27b('0x21')](_0x397cc4['include'],function(_0x2d2804){return{'model':db[_0x2d2804[_0xa27b('0x20')]],'as':_0x2d2804['as'],'attributes':_0x2d2804[_0xa27b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa27b('0xe')](function(_0x133a33){logger[_0xa27b('0xf')]('GetMailServerIn',_0x99eb9e);logger[_0xa27b('0x12')](_0xa27b('0x19'),_0x99eb9e,JSON['stringify'](_0x133a33));_0x3c1f9d(_0x133a33);})[_0xa27b('0x22')](function(_0x32b070){logger[_0xa27b('0x15')](_0xa27b('0x19'),_0x32b070[_0xa27b('0x17')],_0x99eb9e);_0x3994ea(_0xd7acde[_0xa27b('0x15')](0x1f4,_0x32b070[_0xa27b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6fe1f19..1a68bc8 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(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x7c8754,_0x382821){_0x7c8754=_0x7c8754-0x0;var _0x350144=_0x7a54[_0x7c8754];return _0x350144;};'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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x312b02,_0x565596){_0x312b02=_0x312b02-0x0;var _0x16da2f=_0x7a54[_0x312b02];return _0x16da2f;};'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 f85af21..9c99e91 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 _0xc900=['INTEGER','BOOLEAN','STRING'];(function(_0x41c311,_0x258e81){var _0x4fff65=function(_0x572712){while(--_0x572712){_0x41c311['push'](_0x41c311['shift']());}};_0x4fff65(++_0x258e81);}(_0xc900,0xb3));var _0x0c90=function(_0xef45c,_0x853645){_0xef45c=_0xef45c-0x0;var _0x3c24cf=_0xc900[_0xef45c];return _0x3c24cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0c90('0x0')]},'host':{'type':Sequelize[_0x0c90('0x0')]},'user':{'type':Sequelize[_0x0c90('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0c90('0x1')]},'secure':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb78e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4178cd,_0xd7f4f4){_0x4178cd=_0x4178cd-0x0;var _0x3ce11d=_0xb78e[_0x4178cd];return _0x3ce11d;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeb78('0x2')]},'user':{'type':Sequelize[_0xeb78('0x2')]},'pass':{'type':Sequelize[_0xeb78('0x2')]},'port':{'type':Sequelize[_0xeb78('0x3')]},'secure':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb78('0x2')]},'authentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ff34e69..dd0cec3 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 _0x4c01=['error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','update','rimraf','zip-dir','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4c01,0x70));var _0x14c0=function(_0x556411,_0x4cb83a){_0x556411=_0x556411-0x0;var _0x264026=_0x4c01[_0x556411];return _0x264026;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14c0('0x0'));var zipdir=require(_0x14c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14c0('0x2'));var moment=require(_0x14c0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x14c0('0x4'));var path=require(_0x14c0('0x5'));var sox=require(_0x14c0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14c0('0x7'));var _=require(_0x14c0('0x8'));var squel=require(_0x14c0('0x9'));var crypto=require(_0x14c0('0xa'));var jsforce=require(_0x14c0('0xb'));var deskjs=require(_0x14c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x14c0('0xd'));var Papa=require(_0x14c0('0xe'));var Redis=require(_0x14c0('0xf'));var authService=require(_0x14c0('0x10'));var qs=require(_0x14c0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c0('0x12'));var logger=require(_0x14c0('0x13'))(_0x14c0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d03e,_0x33fa17){_0x33fa17=_0x33fa17||0xcc;return function(_0x2e04e2){if(_0x2e04e2){return _0x51d03e[_0x14c0('0x16')](_0x33fa17);}return _0x51d03e['status'](_0x33fa17)[_0x14c0('0x17')]();};}function respondWithResult(_0x3b031d,_0x46ed0e){_0x46ed0e=_0x46ed0e||0xc8;return function(_0x519cc7){if(_0x519cc7){return _0x3b031d[_0x14c0('0x18')](_0x46ed0e)[_0x14c0('0x19')](_0x519cc7);}};}function respondWithFilteredResult(_0x2c9fc4,_0x4ef49f){return function(_0x33f08d){if(_0x33f08d){var _0x219d84=typeof _0x4ef49f[_0x14c0('0x1a')]===_0x14c0('0x1b')&&typeof _0x4ef49f['limit']===_0x14c0('0x1b');var _0x5213c6=_0x33f08d['count'];var _0x170333=_0x219d84?0x0:_0x4ef49f[_0x14c0('0x1a')];var _0x20b383=_0x219d84?_0x33f08d[_0x14c0('0x1c')]:_0x4ef49f[_0x14c0('0x1a')]+_0x4ef49f[_0x14c0('0x1d')];var _0x470ab7;if(_0x20b383>=_0x5213c6){_0x20b383=_0x5213c6;_0x470ab7=0xc8;}else{_0x470ab7=0xce;}_0x2c9fc4[_0x14c0('0x18')](_0x470ab7);return _0x2c9fc4[_0x14c0('0x1e')](_0x14c0('0x1f'),_0x170333+'-'+_0x20b383+'/'+_0x5213c6)['json'](_0x33f08d);}return null;};}function patchUpdates(_0x1a3a45){return function(_0xd2e0d5){try{jsonpatch['apply'](_0xd2e0d5,_0x1a3a45,!![]);}catch(_0xf8967a){return BPromise['reject'](_0xf8967a);}return _0xd2e0d5[_0x14c0('0x20')]();};}function saveUpdates(_0x11a337,_0x10a099){return function(_0x117684){if(_0x117684){return _0x117684['update'](_0x11a337)[_0x14c0('0x21')](function(_0x4ab545){return _0x4ab545;});}return null;};}function removeEntity(_0x50409f,_0x388bbf){return function(_0xb8f83b){if(_0xb8f83b){return _0xb8f83b['destroy']()['then'](function(){_0x50409f[_0x14c0('0x18')](0xcc)[_0x14c0('0x17')]();});}};}function handleEntityNotFound(_0x2d044e,_0x4f805a){return function(_0x44de76){if(!_0x44de76){_0x2d044e[_0x14c0('0x16')](0x194);}return _0x44de76;};}function handleError(_0x529ff6,_0x421b4e){_0x421b4e=_0x421b4e||0x1f4;return function(_0x4621fe){logger[_0x14c0('0x22')](_0x4621fe[_0x14c0('0x23')]);if(_0x4621fe[_0x14c0('0x24')]){delete _0x4621fe['name'];}_0x529ff6['status'](_0x421b4e)[_0x14c0('0x25')](_0x4621fe);};}exports[_0x14c0('0x26')]=function(_0x17993a,_0x37c5a5){var _0x391530={},_0xada5fd={},_0x263709={'count':0x0,'rows':[]};var _0x4e906b=_[_0x14c0('0x27')](db[_0x14c0('0x28')][_0x14c0('0x29')],function(_0x202e2f){return{'name':_0x202e2f[_0x14c0('0x2a')],'type':_0x202e2f[_0x14c0('0x2b')][_0x14c0('0x2c')]};});_0xada5fd[_0x14c0('0x2d')]=_['map'](_0x4e906b,_0x14c0('0x24'));_0xada5fd[_0x14c0('0x2e')]=_[_0x14c0('0x2f')](_0x17993a[_0x14c0('0x2e')]);_0xada5fd['filters']=_[_0x14c0('0x30')](_0xada5fd['model'],_0xada5fd['query']);_0x391530['attributes']=_[_0x14c0('0x30')](_0xada5fd['model'],qs['fields'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x31')]));_0x391530['attributes']=_0x391530[_0x14c0('0x32')][_0x14c0('0x33')]?_0x391530[_0x14c0('0x32')]:_0xada5fd[_0x14c0('0x2d')];if(!_0x17993a[_0x14c0('0x2e')][_0x14c0('0x34')](_0x14c0('0x35'))){_0x391530['limit']=qs['limit'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x1d')]);_0x391530['offset']=qs['offset'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x1a')]);}_0x391530[_0x14c0('0x36')]=qs['sort'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x37')]);_0x391530[_0x14c0('0x38')]=qs[_0x14c0('0x39')](_['pick'](_0x17993a[_0x14c0('0x2e')],_0xada5fd[_0x14c0('0x39')]),_0x4e906b);if(_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3a')]){_0x391530[_0x14c0('0x38')]=_['merge'](_0x391530[_0x14c0('0x38')],{'$or':_[_0x14c0('0x27')](_0x4e906b,function(_0x2b8b6b){if(_0x2b8b6b[_0x14c0('0x2b')]!==_0x14c0('0x3b')){var _0x58e46d={};_0x58e46d[_0x2b8b6b[_0x14c0('0x24')]]={'$like':'%'+_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3a')]+'%'};return _0x58e46d;}})});}_0x391530=_['merge']({},_0x391530,_0x17993a['options']);var _0x33c1ff={'where':_0x391530[_0x14c0('0x38')]};return db['MailServerOut'][_0x14c0('0x1c')](_0x33c1ff)['then'](function(_0x1eb0a5){_0x263709[_0x14c0('0x1c')]=_0x1eb0a5;if(_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3c')]){_0x391530[_0x14c0('0x3d')]=[{'all':!![]}];}return db[_0x14c0('0x28')][_0x14c0('0x3e')](_0x391530);})[_0x14c0('0x21')](function(_0x203c7c){_0x263709[_0x14c0('0x3f')]=_0x203c7c;return _0x263709;})[_0x14c0('0x21')](respondWithFilteredResult(_0x37c5a5,_0x391530))[_0x14c0('0x40')](handleError(_0x37c5a5,null));};exports[_0x14c0('0x41')]=function(_0x5bf730,_0x5415c2){var _0x293018={'raw':!![],'where':{'id':_0x5bf730[_0x14c0('0x42')]['id']}},_0xb9439={};_0xb9439['model']=_[_0x14c0('0x2f')](db['MailServerOut'][_0x14c0('0x29')]);_0xb9439['query']=_[_0x14c0('0x2f')](_0x5bf730[_0x14c0('0x2e')]);_0xb9439[_0x14c0('0x39')]=_[_0x14c0('0x30')](_0xb9439[_0x14c0('0x2d')],_0xb9439['query']);_0x293018[_0x14c0('0x32')]=_[_0x14c0('0x30')](_0xb9439[_0x14c0('0x2d')],qs[_0x14c0('0x31')](_0x5bf730['query']['fields']));_0x293018[_0x14c0('0x32')]=_0x293018[_0x14c0('0x32')]['length']?_0x293018[_0x14c0('0x32')]:_0xb9439['model'];if(_0x5bf730['query'][_0x14c0('0x3c')]){_0x293018[_0x14c0('0x3d')]=[{'all':!![]}];}_0x293018=_[_0x14c0('0x43')]({},_0x293018,_0x5bf730[_0x14c0('0x44')]);return db[_0x14c0('0x28')][_0x14c0('0x45')](_0x293018)[_0x14c0('0x21')](handleEntityNotFound(_0x5415c2,null))[_0x14c0('0x21')](respondWithResult(_0x5415c2,null))[_0x14c0('0x40')](handleError(_0x5415c2,null));};exports[_0x14c0('0x46')]=function(_0x6b0d2c,_0x2e42da){return db[_0x14c0('0x28')][_0x14c0('0x46')](_0x6b0d2c[_0x14c0('0x47')],{})[_0x14c0('0x21')](respondWithResult(_0x2e42da,0xc9))[_0x14c0('0x40')](handleError(_0x2e42da,null));};exports[_0x14c0('0x48')]=function(_0x35598e,_0x50efcb){if(_0x35598e[_0x14c0('0x47')]['id']){delete _0x35598e[_0x14c0('0x47')]['id'];}return db[_0x14c0('0x28')]['find']({'where':{'id':_0x35598e[_0x14c0('0x42')]['id']}})[_0x14c0('0x21')](handleEntityNotFound(_0x50efcb,null))[_0x14c0('0x21')](saveUpdates(_0x35598e[_0x14c0('0x47')],null))[_0x14c0('0x21')](respondWithResult(_0x50efcb,null))[_0x14c0('0x40')](handleError(_0x50efcb,null));};exports['destroy']=function(_0x2abf11,_0x25340c){return db['MailServerOut'][_0x14c0('0x45')]({'where':{'id':_0x2abf11[_0x14c0('0x42')]['id']}})[_0x14c0('0x21')](handleEntityNotFound(_0x25340c,null))['then'](removeEntity(_0x25340c,null))[_0x14c0('0x40')](handleError(_0x25340c,null));}; \ No newline at end of file +var _0x8f9c=['params','length','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','show'];(function(_0x1c0419,_0x14d2e7){var _0x846b3c=function(_0x237aff){while(--_0x237aff){_0x1c0419['push'](_0x1c0419['shift']());}};_0x846b3c(++_0x14d2e7);}(_0x8f9c,0x1aa));var _0xc8f9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8f9c[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8f9('0x1'));var rp=require(_0xc8f9('0x2'));var moment=require(_0xc8f9('0x3'));var BPromise=require(_0xc8f9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8f9('0x5'));var sox=require('sox');var csv=require(_0xc8f9('0x6'));var ejs=require(_0xc8f9('0x7'));var fs=require('fs');var fs_extra=require(_0xc8f9('0x8'));var _=require('lodash');var squel=require(_0xc8f9('0x9'));var crypto=require(_0xc8f9('0xa'));var jsforce=require(_0xc8f9('0xb'));var deskjs=require(_0xc8f9('0xc'));var toCsv=require(_0xc8f9('0x6'));var querystring=require(_0xc8f9('0xd'));var Papa=require('papaparse');var Redis=require(_0xc8f9('0xe'));var authService=require(_0xc8f9('0xf'));var qs=require(_0xc8f9('0x10'));var as=require(_0xc8f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc8f9('0x12'));var utils=require(_0xc8f9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc8f9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17147a,_0x51bb51){_0x51bb51=_0x51bb51||0xcc;return function(_0x5557ed){if(_0x5557ed){return _0x17147a[_0xc8f9('0x15')](_0x51bb51);}return _0x17147a['status'](_0x51bb51)[_0xc8f9('0x16')]();};}function respondWithResult(_0x577e3b,_0x2959e4){_0x2959e4=_0x2959e4||0xc8;return function(_0x37cd36){if(_0x37cd36){return _0x577e3b[_0xc8f9('0x17')](_0x2959e4)[_0xc8f9('0x18')](_0x37cd36);}};}function respondWithFilteredResult(_0x18288a,_0x24b024){return function(_0x40c8c2){if(_0x40c8c2){var _0x3a3120=typeof _0x24b024[_0xc8f9('0x19')]==='undefined'&&typeof _0x24b024[_0xc8f9('0x1a')]===_0xc8f9('0x1b');var _0x3e8ee7=_0x40c8c2[_0xc8f9('0x1c')];var _0x5918ea=_0x3a3120?0x0:_0x24b024[_0xc8f9('0x19')];var _0x2c3e11=_0x3a3120?_0x40c8c2['count']:_0x24b024[_0xc8f9('0x19')]+_0x24b024[_0xc8f9('0x1a')];var _0x353a79;if(_0x2c3e11>=_0x3e8ee7){_0x2c3e11=_0x3e8ee7;_0x353a79=0xc8;}else{_0x353a79=0xce;}_0x18288a[_0xc8f9('0x17')](_0x353a79);return _0x18288a['set'](_0xc8f9('0x1d'),_0x5918ea+'-'+_0x2c3e11+'/'+_0x3e8ee7)[_0xc8f9('0x18')](_0x40c8c2);}return null;};}function patchUpdates(_0x3023d4){return function(_0xb87b50){try{jsonpatch[_0xc8f9('0x1e')](_0xb87b50,_0x3023d4,!![]);}catch(_0x3ef8ed){return BPromise[_0xc8f9('0x1f')](_0x3ef8ed);}return _0xb87b50[_0xc8f9('0x20')]();};}function saveUpdates(_0x5552f8,_0x101f6d){return function(_0xdd0c2c){if(_0xdd0c2c){return _0xdd0c2c[_0xc8f9('0x21')](_0x5552f8)['then'](function(_0x5ae64b){return _0x5ae64b;});}return null;};}function removeEntity(_0x18044c,_0x12825e){return function(_0x2db914){if(_0x2db914){return _0x2db914[_0xc8f9('0x22')]()[_0xc8f9('0x23')](function(){_0x18044c[_0xc8f9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cffe0,_0x446233){return function(_0x4ca251){if(!_0x4ca251){_0x2cffe0[_0xc8f9('0x15')](0x194);}return _0x4ca251;};}function handleError(_0x1f533d,_0x433ec4){_0x433ec4=_0x433ec4||0x1f4;return function(_0x507ed4){logger[_0xc8f9('0x24')](_0x507ed4[_0xc8f9('0x25')]);if(_0x507ed4['name']){delete _0x507ed4[_0xc8f9('0x26')];}_0x1f533d['status'](_0x433ec4)[_0xc8f9('0x27')](_0x507ed4);};}exports['index']=function(_0x26fd05,_0x510e15){var _0x3745b0={},_0x3368b2={},_0x53c92b={'count':0x0,'rows':[]};var _0x240df3=_[_0xc8f9('0x28')](db['MailServerOut'][_0xc8f9('0x29')],function(_0x5771e9){return{'name':_0x5771e9[_0xc8f9('0x2a')],'type':_0x5771e9[_0xc8f9('0x2b')]['key']};});_0x3368b2['model']=_['map'](_0x240df3,'name');_0x3368b2['query']=_[_0xc8f9('0x2c')](_0x26fd05[_0xc8f9('0x2d')]);_0x3368b2['filters']=_[_0xc8f9('0x2e')](_0x3368b2[_0xc8f9('0x2f')],_0x3368b2['query']);_0x3745b0[_0xc8f9('0x30')]=_[_0xc8f9('0x2e')](_0x3368b2['model'],qs[_0xc8f9('0x31')](_0x26fd05[_0xc8f9('0x2d')]['fields']));_0x3745b0[_0xc8f9('0x30')]=_0x3745b0[_0xc8f9('0x30')]['length']?_0x3745b0['attributes']:_0x3368b2[_0xc8f9('0x2f')];if(!_0x26fd05['query'][_0xc8f9('0x32')]('nolimit')){_0x3745b0['limit']=qs['limit'](_0x26fd05['query'][_0xc8f9('0x1a')]);_0x3745b0[_0xc8f9('0x19')]=qs[_0xc8f9('0x19')](_0x26fd05[_0xc8f9('0x2d')][_0xc8f9('0x19')]);}_0x3745b0['order']=qs[_0xc8f9('0x33')](_0x26fd05[_0xc8f9('0x2d')]['sort']);_0x3745b0[_0xc8f9('0x34')]=qs['filters'](_['pick'](_0x26fd05[_0xc8f9('0x2d')],_0x3368b2[_0xc8f9('0x35')]),_0x240df3);if(_0x26fd05['query'][_0xc8f9('0x36')]){_0x3745b0[_0xc8f9('0x34')]=_[_0xc8f9('0x37')](_0x3745b0[_0xc8f9('0x34')],{'$or':_['map'](_0x240df3,function(_0x5ea3cf){if(_0x5ea3cf['type']!==_0xc8f9('0x38')){var _0x4b8a7d={};_0x4b8a7d[_0x5ea3cf[_0xc8f9('0x26')]]={'$like':'%'+_0x26fd05[_0xc8f9('0x2d')][_0xc8f9('0x36')]+'%'};return _0x4b8a7d;}})});}_0x3745b0=_[_0xc8f9('0x37')]({},_0x3745b0,_0x26fd05[_0xc8f9('0x39')]);var _0x20fbff={'where':_0x3745b0[_0xc8f9('0x34')]};return db[_0xc8f9('0x3a')]['count'](_0x20fbff)[_0xc8f9('0x23')](function(_0x14495c){_0x53c92b[_0xc8f9('0x1c')]=_0x14495c;if(_0x26fd05[_0xc8f9('0x2d')][_0xc8f9('0x3b')]){_0x3745b0[_0xc8f9('0x3c')]=[{'all':!![]}];}return db[_0xc8f9('0x3a')][_0xc8f9('0x3d')](_0x3745b0);})[_0xc8f9('0x23')](function(_0x302a96){_0x53c92b[_0xc8f9('0x3e')]=_0x302a96;return _0x53c92b;})['then'](respondWithFilteredResult(_0x510e15,_0x3745b0))['catch'](handleError(_0x510e15,null));};exports[_0xc8f9('0x3f')]=function(_0x47f0c0,_0x112ec5){var _0x6a09e1={'raw':!![],'where':{'id':_0x47f0c0[_0xc8f9('0x40')]['id']}},_0x4e87e1={};_0x4e87e1[_0xc8f9('0x2f')]=_[_0xc8f9('0x2c')](db[_0xc8f9('0x3a')][_0xc8f9('0x29')]);_0x4e87e1['query']=_[_0xc8f9('0x2c')](_0x47f0c0[_0xc8f9('0x2d')]);_0x4e87e1['filters']=_[_0xc8f9('0x2e')](_0x4e87e1[_0xc8f9('0x2f')],_0x4e87e1[_0xc8f9('0x2d')]);_0x6a09e1[_0xc8f9('0x30')]=_[_0xc8f9('0x2e')](_0x4e87e1[_0xc8f9('0x2f')],qs['fields'](_0x47f0c0[_0xc8f9('0x2d')][_0xc8f9('0x31')]));_0x6a09e1['attributes']=_0x6a09e1[_0xc8f9('0x30')][_0xc8f9('0x41')]?_0x6a09e1[_0xc8f9('0x30')]:_0x4e87e1['model'];if(_0x47f0c0[_0xc8f9('0x2d')][_0xc8f9('0x3b')]){_0x6a09e1[_0xc8f9('0x3c')]=[{'all':!![]}];}_0x6a09e1=_[_0xc8f9('0x37')]({},_0x6a09e1,_0x47f0c0[_0xc8f9('0x39')]);return db['MailServerOut'][_0xc8f9('0x42')](_0x6a09e1)[_0xc8f9('0x23')](handleEntityNotFound(_0x112ec5,null))[_0xc8f9('0x23')](respondWithResult(_0x112ec5,null))[_0xc8f9('0x43')](handleError(_0x112ec5,null));};exports[_0xc8f9('0x44')]=function(_0x251741,_0x4a934c){return db[_0xc8f9('0x3a')][_0xc8f9('0x44')](_0x251741[_0xc8f9('0x45')],{})[_0xc8f9('0x23')](respondWithResult(_0x4a934c,0xc9))['catch'](handleError(_0x4a934c,null));};exports[_0xc8f9('0x21')]=function(_0x450edd,_0x48b097){if(_0x450edd[_0xc8f9('0x45')]['id']){delete _0x450edd[_0xc8f9('0x45')]['id'];}return db[_0xc8f9('0x3a')][_0xc8f9('0x42')]({'where':{'id':_0x450edd['params']['id']}})['then'](handleEntityNotFound(_0x48b097,null))[_0xc8f9('0x23')](saveUpdates(_0x450edd[_0xc8f9('0x45')],null))['then'](respondWithResult(_0x48b097,null))['catch'](handleError(_0x48b097,null));};exports[_0xc8f9('0x22')]=function(_0x4fcf18,_0x3d56ee){return db['MailServerOut'][_0xc8f9('0x42')]({'where':{'id':_0x4fcf18[_0xc8f9('0x40')]['id']}})[_0xc8f9('0x23')](handleEntityNotFound(_0x3d56ee,null))[_0xc8f9('0x23')](removeEntity(_0x3d56ee,null))['catch'](handleError(_0x3d56ee,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a7c8e60..edfbaf3 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 _0x6475=['util','api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash'];(function(_0x3ff78f,_0x4bfafd){var _0x5abe3c=function(_0x5d83d0){while(--_0x5d83d0){_0x3ff78f['push'](_0x3ff78f['shift']());}};_0x5abe3c(++_0x4bfafd);}(_0x6475,0x11d));var _0x5647=function(_0x4486ee,_0x85b039){_0x4486ee=_0x4486ee-0x0;var _0x2713cb=_0x6475[_0x4486ee];return _0x2713cb;};'use strict';var _=require(_0x5647('0x0'));var util=require(_0x5647('0x1'));var logger=require('../../config/logger')(_0x5647('0x2'));var moment=require(_0x5647('0x3'));var BPromise=require(_0x5647('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5647('0x5'));var config=require(_0x5647('0x6'));var attributes=require(_0x5647('0x7'));module['exports']=function(_0x53d27a,_0x5481ce){return _0x53d27a[_0x5647('0x8')](_0x5647('0x9'),attributes,{'tableName':_0x5647('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93b9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash'];(function(_0x87dadf,_0x8388fc){var _0x44e9ec=function(_0x3efa3c){while(--_0x3efa3c){_0x87dadf['push'](_0x87dadf['shift']());}};_0x44e9ec(++_0x8388fc);}(_0x93b9,0x81));var _0x993b=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x93b9[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require(_0x993b('0x0'));var util=require(_0x993b('0x1'));var logger=require(_0x993b('0x2'))(_0x993b('0x3'));var moment=require(_0x993b('0x4'));var BPromise=require(_0x993b('0x5'));var rp=require(_0x993b('0x6'));var fs=require('fs');var path=require(_0x993b('0x7'));var rimraf=require(_0x993b('0x8'));var config=require('../../config/environment');var attributes=require(_0x993b('0x9'));module[_0x993b('0xa')]=function(_0x4083fa,_0x4aabb9){return _0x4083fa['define'](_0x993b('0xb'),attributes,{'tableName':_0x993b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e07ce61..4c03290 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x27cd9c,_0x2ca2d8){var _0xb2a38e=function(_0x45c976){while(--_0x45c976){_0x27cd9c['push'](_0x27cd9c['shift']());}};_0xb2a38e(++_0x2ca2d8);}(_0x1261,0x144));var _0x1126=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0x1261[_0x185334];return _0xf2e59a;};'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')]('MailServerOut,\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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2f2169,_0x2539fa){var _0x494f41=function(_0x4aa546){while(--_0x4aa546){_0x2f2169['push'](_0x2f2169['shift']());}};_0x494f41(++_0x2539fa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 6f45f09..bfff11c 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 _0xa847=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa847,0x74));var _0x7a84=function(_0x537722,_0x587f1c){_0x537722=_0x537722-0x0;var _0xab7d11=_0xa847[_0x537722];return _0xab7d11;};'use strict';var multer=require(_0x7a84('0x0'));var util=require(_0x7a84('0x1'));var path=require(_0x7a84('0x2'));var timeout=require(_0x7a84('0x3'));var express=require(_0x7a84('0x4'));var router=express[_0x7a84('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7a84('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a84('0x7'));var controller=require('./mailSubstatus.controller');router[_0x7a84('0x8')]('/',auth[_0x7a84('0x9')](),controller['index']);router[_0x7a84('0x8')]('/describe',auth[_0x7a84('0x9')](),controller[_0x7a84('0xa')]);router[_0x7a84('0x8')](_0x7a84('0xb'),auth[_0x7a84('0x9')](),controller['show']);router['post']('/',auth[_0x7a84('0x9')](),controller[_0x7a84('0xc')]);router[_0x7a84('0xd')](_0x7a84('0xb'),auth[_0x7a84('0x9')](),controller['update']);router[_0x7a84('0xe')]('/:id',auth[_0x7a84('0x9')](),controller[_0x7a84('0xf')]);module[_0x7a84('0x10')]=router; \ No newline at end of file +var _0x0f53=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0xe7d24e,_0x235022){var _0x42c6e3=function(_0x7fe642){while(--_0x7fe642){_0xe7d24e['push'](_0xe7d24e['shift']());}};_0x42c6e3(++_0x235022);}(_0x0f53,0x67));var _0x30f5=function(_0xe21718,_0x57d3bd){_0xe21718=_0xe21718-0x0;var _0x2abac7=_0x0f53[_0xe21718];return _0x2abac7;};'use strict';var multer=require(_0x30f5('0x0'));var util=require('util');var path=require(_0x30f5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x30f5('0x2')]();var fs_extra=require(_0x30f5('0x3'));var auth=require(_0x30f5('0x4'));var interaction=require(_0x30f5('0x5'));var config=require(_0x30f5('0x6'));var controller=require(_0x30f5('0x7'));router[_0x30f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x30f5('0x9')]);router[_0x30f5('0x8')](_0x30f5('0xa'),auth[_0x30f5('0xb')](),controller['describe']);router[_0x30f5('0x8')](_0x30f5('0xc'),auth[_0x30f5('0xb')](),controller[_0x30f5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x30f5('0xe')](_0x30f5('0xc'),auth[_0x30f5('0xb')](),controller[_0x30f5('0xf')]);router[_0x30f5('0x10')](_0x30f5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x30f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 06df1af..7df5bec 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 _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0x7d9f[_0x1f9f5f];return _0x51d649;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file +var _0x1115=['exports','STRING','name'];(function(_0x5b3311,_0x4fa431){var _0x12c9dd=function(_0x3f72a7){while(--_0x3f72a7){_0x5b3311['push'](_0x5b3311['shift']());}};_0x12c9dd(++_0x4fa431);}(_0x1115,0x1b6));var _0x5111=function(_0x58abd0,_0xc4511d){_0x58abd0=_0x58abd0-0x0;var _0x4b54aa=_0x1115[_0x58abd0];return _0x4b54aa;};'use strict';var Sequelize=require('sequelize');module[_0x5111('0x0')]={'name':{'type':Sequelize[_0x5111('0x1')],'unique':_0x5111('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5111('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 08de5b3..0144bf4 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 _0xeb6e=['rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','MailSubstatus'];(function(_0x28021b,_0x43619d){var _0x273cf3=function(_0x2d3eac){while(--_0x2d3eac){_0x28021b['push'](_0x28021b['shift']());}};_0x273cf3(++_0x43619d);}(_0xeb6e,0x6a));var _0xeeb6=function(_0x1a15a3,_0x4f1fc6){_0x1a15a3=_0x1a15a3-0x0;var _0x153241=_0xeb6e[_0x1a15a3];return _0x153241;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb6('0x0'));var zipdir=require(_0xeeb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeeb6('0x2'));var moment=require(_0xeeb6('0x3'));var BPromise=require(_0xeeb6('0x4'));var Mustache=require(_0xeeb6('0x5'));var util=require(_0xeeb6('0x6'));var path=require(_0xeeb6('0x7'));var sox=require(_0xeeb6('0x8'));var csv=require(_0xeeb6('0x9'));var ejs=require(_0xeeb6('0xa'));var fs=require('fs');var fs_extra=require(_0xeeb6('0xb'));var _=require(_0xeeb6('0xc'));var squel=require('squel');var crypto=require(_0xeeb6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeeb6('0xe'));var toCsv=require(_0xeeb6('0x9'));var querystring=require(_0xeeb6('0xf'));var Papa=require(_0xeeb6('0x10'));var Redis=require(_0xeeb6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeeb6('0x12'));var as=require(_0xeeb6('0x13'));var hardwareService=require(_0xeeb6('0x14'));var logger=require(_0xeeb6('0x15'))(_0xeeb6('0x16'));var utils=require(_0xeeb6('0x17'));var config=require(_0xeeb6('0x18'));var licenseUtil=require(_0xeeb6('0x19'));var db=require(_0xeeb6('0x1a'))['db'];function respondWithStatusCode(_0xe689d9,_0x178ea2){_0x178ea2=_0x178ea2||0xcc;return function(_0x296efc){if(_0x296efc){return _0xe689d9[_0xeeb6('0x1b')](_0x178ea2);}return _0xe689d9[_0xeeb6('0x1c')](_0x178ea2)[_0xeeb6('0x1d')]();};}function respondWithResult(_0x2e868d,_0x1b3969){_0x1b3969=_0x1b3969||0xc8;return function(_0x300134){if(_0x300134){return _0x2e868d[_0xeeb6('0x1c')](_0x1b3969)[_0xeeb6('0x1e')](_0x300134);}};}function respondWithFilteredResult(_0x1edd70,_0x362ea7){return function(_0x4b4efe){if(_0x4b4efe){var _0x322bd1=typeof _0x362ea7['offset']===_0xeeb6('0x1f')&&typeof _0x362ea7[_0xeeb6('0x20')]==='undefined';var _0x569930=_0x4b4efe[_0xeeb6('0x21')];var _0xfee73c=_0x322bd1?0x0:_0x362ea7[_0xeeb6('0x22')];var _0x5bb9f5=_0x322bd1?_0x4b4efe[_0xeeb6('0x21')]:_0x362ea7['offset']+_0x362ea7[_0xeeb6('0x20')];var _0x370135;if(_0x5bb9f5>=_0x569930){_0x5bb9f5=_0x569930;_0x370135=0xc8;}else{_0x370135=0xce;}_0x1edd70[_0xeeb6('0x1c')](_0x370135);return _0x1edd70[_0xeeb6('0x23')](_0xeeb6('0x24'),_0xfee73c+'-'+_0x5bb9f5+'/'+_0x569930)[_0xeeb6('0x1e')](_0x4b4efe);}return null;};}function patchUpdates(_0x46a020){return function(_0x2db711){try{jsonpatch[_0xeeb6('0x25')](_0x2db711,_0x46a020,!![]);}catch(_0xe6d0b0){return BPromise[_0xeeb6('0x26')](_0xe6d0b0);}return _0x2db711['save']();};}function saveUpdates(_0x29efe5,_0x173038){return function(_0xe8081d){if(_0xe8081d){return _0xe8081d[_0xeeb6('0x27')](_0x29efe5)[_0xeeb6('0x28')](function(_0x4afd01){return _0x4afd01;});}return null;};}function removeEntity(_0x59f897,_0x50731a){return function(_0x4df200){if(_0x4df200){return _0x4df200['destroy']()[_0xeeb6('0x28')](function(){_0x59f897[_0xeeb6('0x1c')](0xcc)[_0xeeb6('0x1d')]();});}};}function handleEntityNotFound(_0xf42de9,_0x1473e5){return function(_0x4f5c70){if(!_0x4f5c70){_0xf42de9['sendStatus'](0x194);}return _0x4f5c70;};}function handleError(_0x1cd48f,_0x3b9775){_0x3b9775=_0x3b9775||0x1f4;return function(_0x1147d7){logger[_0xeeb6('0x29')](_0x1147d7['stack']);if(_0x1147d7[_0xeeb6('0x2a')]){delete _0x1147d7[_0xeeb6('0x2a')];}_0x1cd48f[_0xeeb6('0x1c')](_0x3b9775)[_0xeeb6('0x2b')](_0x1147d7);};}exports[_0xeeb6('0x2c')]=function(_0x540b56,_0x2cd0cc){var _0x5b1aeb={},_0x552421={},_0x4ab2ab={'count':0x0,'rows':[]};var _0x17f621=_['map'](db[_0xeeb6('0x2d')][_0xeeb6('0x2e')],function(_0x5ddf22){return{'name':_0x5ddf22[_0xeeb6('0x2f')],'type':_0x5ddf22['type'][_0xeeb6('0x30')]};});_0x552421[_0xeeb6('0x31')]=_[_0xeeb6('0x32')](_0x17f621,_0xeeb6('0x2a'));_0x552421['query']=_[_0xeeb6('0x33')](_0x540b56[_0xeeb6('0x34')]);_0x552421['filters']=_[_0xeeb6('0x35')](_0x552421[_0xeeb6('0x31')],_0x552421[_0xeeb6('0x34')]);_0x5b1aeb[_0xeeb6('0x36')]=_[_0xeeb6('0x35')](_0x552421[_0xeeb6('0x31')],qs[_0xeeb6('0x37')](_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x37')]));_0x5b1aeb[_0xeeb6('0x36')]=_0x5b1aeb[_0xeeb6('0x36')][_0xeeb6('0x38')]?_0x5b1aeb[_0xeeb6('0x36')]:_0x552421['model'];if(!_0x540b56['query']['hasOwnProperty'](_0xeeb6('0x39'))){_0x5b1aeb[_0xeeb6('0x20')]=qs[_0xeeb6('0x20')](_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x20')]);_0x5b1aeb[_0xeeb6('0x22')]=qs['offset'](_0x540b56[_0xeeb6('0x34')]['offset']);}_0x5b1aeb[_0xeeb6('0x3a')]=qs['sort'](_0x540b56[_0xeeb6('0x34')]['sort']);_0x5b1aeb[_0xeeb6('0x3b')]=qs[_0xeeb6('0x3c')](_[_0xeeb6('0x3d')](_0x540b56[_0xeeb6('0x34')],_0x552421[_0xeeb6('0x3c')]),_0x17f621);if(_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x3e')]){_0x5b1aeb[_0xeeb6('0x3b')]=_[_0xeeb6('0x3f')](_0x5b1aeb[_0xeeb6('0x3b')],{'$or':_['map'](_0x17f621,function(_0x961c4c){if(_0x961c4c[_0xeeb6('0x40')]!==_0xeeb6('0x41')){var _0x387dde={};_0x387dde[_0x961c4c[_0xeeb6('0x2a')]]={'$like':'%'+_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x3e')]+'%'};return _0x387dde;}})});}_0x5b1aeb=_[_0xeeb6('0x3f')]({},_0x5b1aeb,_0x540b56[_0xeeb6('0x42')]);var _0x1a7bfa={'where':_0x5b1aeb['where']};return db[_0xeeb6('0x2d')][_0xeeb6('0x21')](_0x1a7bfa)['then'](function(_0x1c67b4){_0x4ab2ab[_0xeeb6('0x21')]=_0x1c67b4;if(_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x43')]){_0x5b1aeb['include']=[{'all':!![]}];}return db[_0xeeb6('0x2d')]['findAll'](_0x5b1aeb);})[_0xeeb6('0x28')](function(_0x5d911a){_0x4ab2ab['rows']=_0x5d911a;return _0x4ab2ab;})[_0xeeb6('0x28')](respondWithFilteredResult(_0x2cd0cc,_0x5b1aeb))[_0xeeb6('0x44')](handleError(_0x2cd0cc,null));};exports[_0xeeb6('0x45')]=function(_0x375b03,_0x380364){var _0x348f65={'raw':!![],'where':{'id':_0x375b03[_0xeeb6('0x46')]['id']}},_0x23b037={};_0x23b037[_0xeeb6('0x31')]=_['keys'](db[_0xeeb6('0x2d')]['rawAttributes']);_0x23b037[_0xeeb6('0x34')]=_[_0xeeb6('0x33')](_0x375b03[_0xeeb6('0x34')]);_0x23b037['filters']=_[_0xeeb6('0x35')](_0x23b037[_0xeeb6('0x31')],_0x23b037[_0xeeb6('0x34')]);_0x348f65[_0xeeb6('0x36')]=_['intersection'](_0x23b037[_0xeeb6('0x31')],qs[_0xeeb6('0x37')](_0x375b03['query'][_0xeeb6('0x37')]));_0x348f65['attributes']=_0x348f65[_0xeeb6('0x36')]['length']?_0x348f65[_0xeeb6('0x36')]:_0x23b037[_0xeeb6('0x31')];if(_0x375b03[_0xeeb6('0x34')][_0xeeb6('0x43')]){_0x348f65[_0xeeb6('0x47')]=[{'all':!![]}];}_0x348f65=_[_0xeeb6('0x3f')]({},_0x348f65,_0x375b03[_0xeeb6('0x42')]);return db[_0xeeb6('0x2d')][_0xeeb6('0x48')](_0x348f65)[_0xeeb6('0x28')](handleEntityNotFound(_0x380364,null))[_0xeeb6('0x28')](respondWithResult(_0x380364,null))[_0xeeb6('0x44')](handleError(_0x380364,null));};exports[_0xeeb6('0x49')]=function(_0x4137e0,_0x310d13){return db[_0xeeb6('0x2d')][_0xeeb6('0x49')](_0x4137e0[_0xeeb6('0x4a')],{})['then'](respondWithResult(_0x310d13,0xc9))[_0xeeb6('0x44')](handleError(_0x310d13,null));};exports[_0xeeb6('0x27')]=function(_0x762044,_0x1cdf93){if(_0x762044[_0xeeb6('0x4a')]['id']){delete _0x762044[_0xeeb6('0x4a')]['id'];}return db[_0xeeb6('0x2d')][_0xeeb6('0x48')]({'where':{'id':_0x762044[_0xeeb6('0x46')]['id']}})[_0xeeb6('0x28')](handleEntityNotFound(_0x1cdf93,null))['then'](saveUpdates(_0x762044[_0xeeb6('0x4a')],null))[_0xeeb6('0x28')](respondWithResult(_0x1cdf93,null))['catch'](handleError(_0x1cdf93,null));};exports['destroy']=function(_0x409136,_0x367f40){return db[_0xeeb6('0x2d')]['find']({'where':{'id':_0x409136[_0xeeb6('0x46')]['id']}})[_0xeeb6('0x28')](handleEntityNotFound(_0x367f40,null))['then'](removeEntity(_0x367f40,null))[_0xeeb6('0x44')](handleError(_0x367f40,null));};exports[_0xeeb6('0x4b')]=function(_0x575b03,_0x42e057){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x42e057,null))['catch'](handleError(_0x42e057,null));}; \ No newline at end of file +var _0x2b63=['destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','MailSubstatus','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params'];(function(_0x385074,_0x3edef8){var _0x34e655=function(_0x1a208c){while(--_0x1a208c){_0x385074['push'](_0x385074['shift']());}};_0x34e655(++_0x3edef8);}(_0x2b63,0x9a));var _0x32b6=function(_0x248ba6,_0x278082){_0x248ba6=_0x248ba6-0x0;var _0x2a969a=_0x2b63[_0x248ba6];return _0x2a969a;};'use strict';var emlformat=require(_0x32b6('0x0'));var rimraf=require(_0x32b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32b6('0x2'));var rp=require(_0x32b6('0x3'));var moment=require(_0x32b6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x32b6('0x5'));var sox=require(_0x32b6('0x6'));var csv=require('to-csv');var ejs=require(_0x32b6('0x7'));var fs=require('fs');var fs_extra=require(_0x32b6('0x8'));var _=require(_0x32b6('0x9'));var squel=require('squel');var crypto=require(_0x32b6('0xa'));var jsforce=require(_0x32b6('0xb'));var deskjs=require(_0x32b6('0xc'));var toCsv=require(_0x32b6('0xd'));var querystring=require('querystring');var Papa=require(_0x32b6('0xe'));var Redis=require(_0x32b6('0xf'));var authService=require(_0x32b6('0x10'));var qs=require(_0x32b6('0x11'));var as=require(_0x32b6('0x12'));var hardwareService=require(_0x32b6('0x13'));var logger=require(_0x32b6('0x14'))(_0x32b6('0x15'));var utils=require(_0x32b6('0x16'));var config=require(_0x32b6('0x17'));var licenseUtil=require(_0x32b6('0x18'));var db=require(_0x32b6('0x19'))['db'];function respondWithStatusCode(_0x4ec464,_0x18321d){_0x18321d=_0x18321d||0xcc;return function(_0x5e4df7){if(_0x5e4df7){return _0x4ec464['sendStatus'](_0x18321d);}return _0x4ec464[_0x32b6('0x1a')](_0x18321d)[_0x32b6('0x1b')]();};}function respondWithResult(_0x3cb717,_0x7ee33){_0x7ee33=_0x7ee33||0xc8;return function(_0xed1ef0){if(_0xed1ef0){return _0x3cb717['status'](_0x7ee33)['json'](_0xed1ef0);}};}function respondWithFilteredResult(_0xb966a6,_0x879913){return function(_0xf25e6b){if(_0xf25e6b){var _0x2533c4=typeof _0x879913[_0x32b6('0x1c')]==='undefined'&&typeof _0x879913[_0x32b6('0x1d')]===_0x32b6('0x1e');var _0x1e17b1=_0xf25e6b[_0x32b6('0x1f')];var _0x255a73=_0x2533c4?0x0:_0x879913['offset'];var _0x74cff7=_0x2533c4?_0xf25e6b[_0x32b6('0x1f')]:_0x879913[_0x32b6('0x1c')]+_0x879913[_0x32b6('0x1d')];var _0x32f1cd;if(_0x74cff7>=_0x1e17b1){_0x74cff7=_0x1e17b1;_0x32f1cd=0xc8;}else{_0x32f1cd=0xce;}_0xb966a6[_0x32b6('0x1a')](_0x32f1cd);return _0xb966a6['set'](_0x32b6('0x20'),_0x255a73+'-'+_0x74cff7+'/'+_0x1e17b1)[_0x32b6('0x21')](_0xf25e6b);}return null;};}function patchUpdates(_0x21fb9f){return function(_0x1862c3){try{jsonpatch['apply'](_0x1862c3,_0x21fb9f,!![]);}catch(_0x368b90){return BPromise[_0x32b6('0x22')](_0x368b90);}return _0x1862c3[_0x32b6('0x23')]();};}function saveUpdates(_0x4d06dd,_0x1c5782){return function(_0x744d56){if(_0x744d56){return _0x744d56[_0x32b6('0x24')](_0x4d06dd)[_0x32b6('0x25')](function(_0x59dda5){return _0x59dda5;});}return null;};}function removeEntity(_0x40417d,_0x1fb900){return function(_0x3f7783){if(_0x3f7783){return _0x3f7783['destroy']()[_0x32b6('0x25')](function(){_0x40417d[_0x32b6('0x1a')](0xcc)[_0x32b6('0x1b')]();});}};}function handleEntityNotFound(_0x19a5df,_0x538653){return function(_0x35b32b){if(!_0x35b32b){_0x19a5df[_0x32b6('0x26')](0x194);}return _0x35b32b;};}function handleError(_0x454f8f,_0x33fda3){_0x33fda3=_0x33fda3||0x1f4;return function(_0xad3f84){logger['error'](_0xad3f84[_0x32b6('0x27')]);if(_0xad3f84[_0x32b6('0x28')]){delete _0xad3f84[_0x32b6('0x28')];}_0x454f8f[_0x32b6('0x1a')](_0x33fda3)['send'](_0xad3f84);};}exports[_0x32b6('0x29')]=function(_0x29adc,_0x3dd6a4){var _0x25bc5c={},_0x24bb13={},_0x1420a3={'count':0x0,'rows':[]};var _0x9155ce=_[_0x32b6('0x2a')](db['MailSubstatus'][_0x32b6('0x2b')],function(_0x3b3955){return{'name':_0x3b3955[_0x32b6('0x2c')],'type':_0x3b3955['type'][_0x32b6('0x2d')]};});_0x24bb13[_0x32b6('0x2e')]=_[_0x32b6('0x2a')](_0x9155ce,_0x32b6('0x28'));_0x24bb13[_0x32b6('0x2f')]=_[_0x32b6('0x30')](_0x29adc['query']);_0x24bb13[_0x32b6('0x31')]=_['intersection'](_0x24bb13[_0x32b6('0x2e')],_0x24bb13[_0x32b6('0x2f')]);_0x25bc5c[_0x32b6('0x32')]=_[_0x32b6('0x33')](_0x24bb13[_0x32b6('0x2e')],qs['fields'](_0x29adc['query']['fields']));_0x25bc5c['attributes']=_0x25bc5c[_0x32b6('0x32')][_0x32b6('0x34')]?_0x25bc5c[_0x32b6('0x32')]:_0x24bb13['model'];if(!_0x29adc[_0x32b6('0x2f')][_0x32b6('0x35')]('nolimit')){_0x25bc5c[_0x32b6('0x1d')]=qs[_0x32b6('0x1d')](_0x29adc[_0x32b6('0x2f')]['limit']);_0x25bc5c[_0x32b6('0x1c')]=qs[_0x32b6('0x1c')](_0x29adc[_0x32b6('0x2f')]['offset']);}_0x25bc5c[_0x32b6('0x36')]=qs[_0x32b6('0x37')](_0x29adc[_0x32b6('0x2f')][_0x32b6('0x37')]);_0x25bc5c[_0x32b6('0x38')]=qs[_0x32b6('0x31')](_['pick'](_0x29adc['query'],_0x24bb13['filters']),_0x9155ce);if(_0x29adc[_0x32b6('0x2f')][_0x32b6('0x39')]){_0x25bc5c['where']=_['merge'](_0x25bc5c['where'],{'$or':_[_0x32b6('0x2a')](_0x9155ce,function(_0x2d34de){if(_0x2d34de[_0x32b6('0x3a')]!==_0x32b6('0x3b')){var _0x1928fc={};_0x1928fc[_0x2d34de[_0x32b6('0x28')]]={'$like':'%'+_0x29adc[_0x32b6('0x2f')][_0x32b6('0x39')]+'%'};return _0x1928fc;}})});}_0x25bc5c=_[_0x32b6('0x3c')]({},_0x25bc5c,_0x29adc[_0x32b6('0x3d')]);var _0x24a8df={'where':_0x25bc5c[_0x32b6('0x38')]};return db[_0x32b6('0x3e')][_0x32b6('0x1f')](_0x24a8df)[_0x32b6('0x25')](function(_0x3b98d1){_0x1420a3[_0x32b6('0x1f')]=_0x3b98d1;if(_0x29adc['query'][_0x32b6('0x3f')]){_0x25bc5c['include']=[{'all':!![]}];}return db[_0x32b6('0x3e')][_0x32b6('0x40')](_0x25bc5c);})[_0x32b6('0x25')](function(_0x2a00b3){_0x1420a3[_0x32b6('0x41')]=_0x2a00b3;return _0x1420a3;})['then'](respondWithFilteredResult(_0x3dd6a4,_0x25bc5c))[_0x32b6('0x42')](handleError(_0x3dd6a4,null));};exports[_0x32b6('0x43')]=function(_0x5077ee,_0x5df193){var _0x1253c3={'raw':!![],'where':{'id':_0x5077ee['params']['id']}},_0x254c65={};_0x254c65[_0x32b6('0x2e')]=_[_0x32b6('0x30')](db[_0x32b6('0x3e')]['rawAttributes']);_0x254c65[_0x32b6('0x2f')]=_[_0x32b6('0x30')](_0x5077ee[_0x32b6('0x2f')]);_0x254c65['filters']=_['intersection'](_0x254c65[_0x32b6('0x2e')],_0x254c65[_0x32b6('0x2f')]);_0x1253c3[_0x32b6('0x32')]=_[_0x32b6('0x33')](_0x254c65[_0x32b6('0x2e')],qs[_0x32b6('0x44')](_0x5077ee[_0x32b6('0x2f')]['fields']));_0x1253c3[_0x32b6('0x32')]=_0x1253c3[_0x32b6('0x32')][_0x32b6('0x34')]?_0x1253c3[_0x32b6('0x32')]:_0x254c65[_0x32b6('0x2e')];if(_0x5077ee['query'][_0x32b6('0x3f')]){_0x1253c3[_0x32b6('0x45')]=[{'all':!![]}];}_0x1253c3=_[_0x32b6('0x3c')]({},_0x1253c3,_0x5077ee[_0x32b6('0x3d')]);return db[_0x32b6('0x3e')][_0x32b6('0x46')](_0x1253c3)[_0x32b6('0x25')](handleEntityNotFound(_0x5df193,null))[_0x32b6('0x25')](respondWithResult(_0x5df193,null))[_0x32b6('0x42')](handleError(_0x5df193,null));};exports[_0x32b6('0x47')]=function(_0x378274,_0x432948){return db[_0x32b6('0x3e')][_0x32b6('0x47')](_0x378274[_0x32b6('0x48')],{})[_0x32b6('0x25')](respondWithResult(_0x432948,0xc9))[_0x32b6('0x42')](handleError(_0x432948,null));};exports[_0x32b6('0x24')]=function(_0x4b6f3c,_0x44d786){if(_0x4b6f3c[_0x32b6('0x48')]['id']){delete _0x4b6f3c[_0x32b6('0x48')]['id'];}return db[_0x32b6('0x3e')][_0x32b6('0x46')]({'where':{'id':_0x4b6f3c[_0x32b6('0x49')]['id']}})[_0x32b6('0x25')](handleEntityNotFound(_0x44d786,null))[_0x32b6('0x25')](saveUpdates(_0x4b6f3c[_0x32b6('0x48')],null))['then'](respondWithResult(_0x44d786,null))[_0x32b6('0x42')](handleError(_0x44d786,null));};exports[_0x32b6('0x4a')]=function(_0x159d28,_0x4ddf03){return db[_0x32b6('0x3e')][_0x32b6('0x46')]({'where':{'id':_0x159d28[_0x32b6('0x49')]['id']}})[_0x32b6('0x25')](handleEntityNotFound(_0x4ddf03,null))['then'](removeEntity(_0x4ddf03,null))[_0x32b6('0x42')](handleError(_0x4ddf03,null));};exports[_0x32b6('0x4b')]=function(_0x25fadc,_0x6998b7){return db[_0x32b6('0x3e')][_0x32b6('0x4b')]()[_0x32b6('0x25')](respondWithResult(_0x6998b7,null))[_0x32b6('0x42')](handleError(_0x6998b7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0b3af53..95da3e9 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 _0x1fb6=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a7d85,_0x40acbc){var _0x3a82fb=function(_0x4e5584){while(--_0x4e5584){_0x1a7d85['push'](_0x1a7d85['shift']());}};_0x3a82fb(++_0x40acbc);}(_0x1fb6,0xe8));var _0x61fb=function(_0x5c823b,_0x31bfee){_0x5c823b=_0x5c823b-0x0;var _0x662a12=_0x1fb6[_0x5c823b];return _0x662a12;};'use strict';var EventEmitter=require(_0x61fb('0x0'));var MailSubstatus=require(_0x61fb('0x1'))['db'][_0x61fb('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x61fb('0x3')](0x0);var events={'afterUpdate':_0x61fb('0x4')};function emitEvent(_0x5aba33){return function(_0xc082bc,_0x233dcd,_0x3b551a){MailSubstatusEvents[_0x61fb('0x5')](_0x5aba33+':'+_0xc082bc['id'],_0xc082bc);MailSubstatusEvents['emit'](_0x5aba33,_0xc082bc);_0x3b551a(null);};}for(var e in events){if(events[_0x61fb('0x6')](e)){var event=events[e];MailSubstatus[_0x61fb('0x7')](e,emitEvent(event));}}module[_0x61fb('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x9a24=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b5203,_0x395bfd){var _0x4286ce=function(_0x19ae55){while(--_0x19ae55){_0x1b5203['push'](_0x1b5203['shift']());}};_0x4286ce(++_0x395bfd);}(_0x9a24,0xe8));var _0x49a2=function(_0x78cb2,_0x372a63){_0x78cb2=_0x78cb2-0x0;var _0x26ad34=_0x9a24[_0x78cb2];return _0x26ad34;};'use strict';var EventEmitter=require(_0x49a2('0x0'));var MailSubstatus=require(_0x49a2('0x1'))['db'][_0x49a2('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x49a2('0x3')](0x0);var events={'afterUpdate':_0x49a2('0x4')};function emitEvent(_0x4c6696){return function(_0x2692ea,_0x10ed68,_0x5ba895){MailSubstatusEvents[_0x49a2('0x5')](_0x4c6696+':'+_0x2692ea['id'],_0x2692ea);MailSubstatusEvents['emit'](_0x4c6696,_0x2692ea);_0x5ba895(null);};}for(var e in events){if(events[_0x49a2('0x6')](e)){var event=events[e];MailSubstatus[_0x49a2('0x7')](e,emitEvent(event));}}module[_0x49a2('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b10a6d1..d869fdf 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 _0xcaae=['name','mailSubstatus','catch','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','update'];(function(_0x5bb0c0,_0x5dc885){var _0xd22ddf=function(_0x24dd49){while(--_0x24dd49){_0x5bb0c0['push'](_0x5bb0c0['shift']());}};_0xd22ddf(++_0x5dc885);}(_0xcaae,0xc0));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xecaa('0x0'));module[_0xecaa('0x1')]=function(_0x4b5e31){var _0x3cad28=_0x4b5e31['models'];return _0x4b5e31[_0xecaa('0x2')]('MailSubstatus',attributes,{'tableName':_0xecaa('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1d6d45,_0x258543,_0x40f74d){return _0x3cad28[_0xecaa('0x4')][_0xecaa('0x5')]({'value':_0x1d6d45[_0xecaa('0x6')]},{'where':{'field':_0xecaa('0x7'),'value':_0x1d6d45['_previousDataValues']['name']}})['then'](function(){_0x40f74d();})[_0xecaa('0x8')](function(_0x3b77ce){_0x40f74d(_0x3b77ce);});}}});}; \ No newline at end of file +var _0xb5f8=['_previousDataValues','then','catch','./mailSubstatus.attributes','exports','MailSubstatus','Condition','name'];(function(_0x5d572a,_0x27561c){var _0x357aaa=function(_0x5442f0){while(--_0x5442f0){_0x5d572a['push'](_0x5d572a['shift']());}};_0x357aaa(++_0x27561c);}(_0xb5f8,0x103));var _0x8b5f=function(_0x3640a7,_0x1fd776){_0x3640a7=_0x3640a7-0x0;var _0x472510=_0xb5f8[_0x3640a7];return _0x472510;};'use strict';var attributes=require(_0x8b5f('0x0'));module[_0x8b5f('0x1')]=function(_0x50bef5){var _0xd931d4=_0x50bef5['models'];return _0x50bef5['define'](_0x8b5f('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2c186a,_0x50c87e,_0x4dd229){return _0xd931d4[_0x8b5f('0x3')]['update']({'value':_0x2c186a[_0x8b5f('0x4')]},{'where':{'field':'mailSubstatus','value':_0x2c186a[_0x8b5f('0x5')][_0x8b5f('0x4')]}})[_0x8b5f('0x6')](function(){_0x4dd229();})[_0x8b5f('0x7')](function(_0xba15d4){_0x4dd229(_0xba15d4);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 50ead9c..1bc968f 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 _0xfffc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util'];(function(_0x4188b5,_0x2a6aff){var _0x547a41=function(_0x6b0a8e){while(--_0x6b0a8e){_0x4188b5['push'](_0x4188b5['shift']());}};_0x547a41(++_0x2a6aff);}(_0xfffc,0x1c6));var _0xcfff=function(_0x3294dd,_0x5217cb){_0x3294dd=_0x3294dd-0x0;var _0x4377f5=_0xfffc[_0x3294dd];return _0x4377f5;};'use strict';var _=require(_0xcfff('0x0'));var util=require(_0xcfff('0x1'));var moment=require(_0xcfff('0x2'));var BPromise=require(_0xcfff('0x3'));var rs=require(_0xcfff('0x4'));var fs=require('fs');var Redis=require(_0xcfff('0x5'));var db=require(_0xcfff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfff('0x7'))(_0xcfff('0x8'));var config=require(_0xcfff('0x9'));var jayson=require(_0xcfff('0xa'));var client=jayson[_0xcfff('0xb')][_0xcfff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3729ee,_0x2603dc,_0x19118d){return new BPromise(function(_0x24cbe0,_0x3f7d1d){return client[_0xcfff('0xd')](_0x3729ee,_0x19118d)[_0xcfff('0xe')](function(_0x33cd0b){logger[_0xcfff('0xf')](_0xcfff('0x10'),_0x2603dc,'request\x20sent');logger[_0xcfff('0x11')](_0xcfff('0x12'),_0x2603dc,'request\x20sent',JSON['stringify'](_0x33cd0b));if(_0x33cd0b[_0xcfff('0x13')]){if(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x14')]===0x1f4){logger[_0xcfff('0x13')](_0xcfff('0x10'),_0x2603dc,_0x33cd0b['error'][_0xcfff('0x15')]);return _0x3f7d1d(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);}logger[_0xcfff('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2603dc,_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);return _0x24cbe0(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);}else{logger['info'](_0xcfff('0x10'),_0x2603dc,_0xcfff('0x16'));_0x24cbe0(_0x33cd0b[_0xcfff('0x17')][_0xcfff('0x15')]);}})['catch'](function(_0x348610){logger[_0xcfff('0x13')](_0xcfff('0x10'),_0x2603dc,_0x348610);_0x3f7d1d(_0x348610);});});} \ No newline at end of file +var _0xc5dd=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then'];(function(_0x231457,_0x260e72){var _0x337849=function(_0xff131e){while(--_0xff131e){_0x231457['push'](_0x231457['shift']());}};_0x337849(++_0x260e72);}(_0xc5dd,0x170));var _0xdc5d=function(_0x160140,_0x5113fa){_0x160140=_0x160140-0x0;var _0x455417=_0xc5dd[_0x160140];return _0x455417;};'use strict';var _=require(_0xdc5d('0x0'));var util=require(_0xdc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc5d('0x2'));var db=require(_0xdc5d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc5d('0x4'));var config=require('../../config/environment');var jayson=require(_0xdc5d('0x5'));var client=jayson[_0xdc5d('0x6')][_0xdc5d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19f841,_0x2033a6,_0x21f318){return new BPromise(function(_0x2e4776,_0x17839a){return client[_0xdc5d('0x8')](_0x19f841,_0x21f318)[_0xdc5d('0x9')](function(_0x9f14f4){logger[_0xdc5d('0xa')](_0xdc5d('0xb'),_0x2033a6,_0xdc5d('0xc'));logger[_0xdc5d('0xd')](_0xdc5d('0xe'),_0x2033a6,_0xdc5d('0xc'),JSON[_0xdc5d('0xf')](_0x9f14f4));if(_0x9f14f4['error']){if(_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2033a6,_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);return _0x17839a(_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);}logger[_0xdc5d('0x10')](_0xdc5d('0xb'),_0x2033a6,_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);return _0x2e4776(_0x9f14f4['error'][_0xdc5d('0x12')]);}else{logger[_0xdc5d('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x2033a6,_0xdc5d('0xc'));_0x2e4776(_0x9f14f4[_0xdc5d('0x13')][_0xdc5d('0x12')]);}})[_0xdc5d('0x14')](function(_0x5953f0){logger[_0xdc5d('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x2033a6,_0x5953f0);_0x17839a(_0x5953f0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 72388cf..b14f707 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 _0xc1ae=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','describe'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0xc1ae,0x189));var _0xec1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var path=require(_0xec1a('0x2'));var timeout=require(_0xec1a('0x3'));var express=require(_0xec1a('0x4'));var router=express[_0xec1a('0x5')]();var fs_extra=require(_0xec1a('0x6'));var auth=require(_0xec1a('0x7'));var interaction=require(_0xec1a('0x8'));var config=require(_0xec1a('0x9'));var controller=require(_0xec1a('0xa'));router[_0xec1a('0xb')]('/',auth['isAuthenticated'](),controller[_0xec1a('0xc')]);router[_0xec1a('0xb')]('/describe',auth[_0xec1a('0xd')](),controller[_0xec1a('0xe')]);router['get'](_0xec1a('0xf'),auth['isAuthenticated'](),controller[_0xec1a('0x10')]);router[_0xec1a('0x11')]('/',auth['isAuthenticated'](),controller[_0xec1a('0x12')]);router[_0xec1a('0x13')](_0xec1a('0xf'),auth[_0xec1a('0xd')](),controller[_0xec1a('0x14')]);router[_0xec1a('0x15')]('/:id',auth[_0xec1a('0xd')](),controller[_0xec1a('0x16')]);module[_0xec1a('0x17')]=router; \ No newline at end of file +var _0x90a2=['put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','create'];(function(_0x5ee091,_0x47ff6d){var _0x59d45b=function(_0xfd0882){while(--_0xfd0882){_0x5ee091['push'](_0x5ee091['shift']());}};_0x59d45b(++_0x47ff6d);}(_0x90a2,0xdb));var _0x290a=function(_0x152fae,_0x30c109){_0x152fae=_0x152fae-0x0;var _0x320f5e=_0x90a2[_0x152fae];return _0x320f5e;};'use strict';var multer=require(_0x290a('0x0'));var util=require(_0x290a('0x1'));var path=require(_0x290a('0x2'));var timeout=require('connect-timeout');var express=require(_0x290a('0x3'));var router=express[_0x290a('0x4')]();var fs_extra=require(_0x290a('0x5'));var auth=require(_0x290a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x290a('0x7'));var controller=require(_0x290a('0x8'));router[_0x290a('0x9')]('/',auth[_0x290a('0xa')](),controller[_0x290a('0xb')]);router[_0x290a('0x9')](_0x290a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x290a('0x9')](_0x290a('0xd'),auth[_0x290a('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x290a('0xe')]);router[_0x290a('0xf')]('/:id',auth[_0x290a('0xa')](),controller[_0x290a('0x10')]);router['delete'](_0x290a('0xd'),auth[_0x290a('0xa')](),controller['destroy']);module[_0x290a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6ba0912..b083ece 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x39ce7c,_0x141640){var _0x2dd7cf=function(_0x17ac09){while(--_0x17ac09){_0x39ce7c['push'](_0x39ce7c['shift']());}};_0x2dd7cf(++_0x141640);}(_0x008c,0x188));var _0xc008=function(_0x2fff52,_0x1580ac){_0x2fff52=_0x2fff52-0x0;var _0x4fef52=_0x008c[_0x2fff52];return _0x4fef52;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1fa6f18..6494e4a 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 _0xb73b=['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','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x34eabc,_0x51d411){var _0x43e72f=function(_0x5619e8){while(--_0x5619e8){_0x34eabc['push'](_0x34eabc['shift']());}};_0x43e72f(++_0x51d411);}(_0xb73b,0x16f));var _0xbb73=function(_0x2f58a2,_0x1121bf){_0x2f58a2=_0x2f58a2-0x0;var _0x35b49a=_0xb73b[_0x2f58a2];return _0x35b49a;};'use strict';var emlformat=require(_0xbb73('0x0'));var rimraf=require(_0xbb73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb73('0x2'));var moment=require(_0xbb73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbb73('0x4'));var util=require(_0xbb73('0x5'));var path=require(_0xbb73('0x6'));var sox=require(_0xbb73('0x7'));var csv=require(_0xbb73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb73('0x9'));var _=require('lodash');var squel=require(_0xbb73('0xa'));var crypto=require(_0xbb73('0xb'));var jsforce=require(_0xbb73('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb73('0xd'));var Redis=require('ioredis');var authService=require(_0xbb73('0xe'));var qs=require(_0xbb73('0xf'));var as=require(_0xbb73('0x10'));var hardwareService=require(_0xbb73('0x11'));var logger=require(_0xbb73('0x12'))(_0xbb73('0x13'));var utils=require(_0xbb73('0x14'));var config=require(_0xbb73('0x15'));var licenseUtil=require(_0xbb73('0x16'));var db=require(_0xbb73('0x17'))['db'];function respondWithStatusCode(_0x162f94,_0x3622bc){_0x3622bc=_0x3622bc||0xcc;return function(_0x24ff3f){if(_0x24ff3f){return _0x162f94[_0xbb73('0x18')](_0x3622bc);}return _0x162f94[_0xbb73('0x19')](_0x3622bc)[_0xbb73('0x1a')]();};}function respondWithResult(_0x111111,_0x4d0ee4){_0x4d0ee4=_0x4d0ee4||0xc8;return function(_0x56b077){if(_0x56b077){return _0x111111[_0xbb73('0x19')](_0x4d0ee4)[_0xbb73('0x1b')](_0x56b077);}};}function respondWithFilteredResult(_0x109f0b,_0x4c2d2f){return function(_0x4a5e9c){if(_0x4a5e9c){var _0x129906=typeof _0x4c2d2f['offset']===_0xbb73('0x1c')&&typeof _0x4c2d2f[_0xbb73('0x1d')]===_0xbb73('0x1c');var _0x1b43bc=_0x4a5e9c[_0xbb73('0x1e')];var _0x25e5f8=_0x129906?0x0:_0x4c2d2f[_0xbb73('0x1f')];var _0x4c3415=_0x129906?_0x4a5e9c[_0xbb73('0x1e')]:_0x4c2d2f[_0xbb73('0x1f')]+_0x4c2d2f['limit'];var _0x4cb66d;if(_0x4c3415>=_0x1b43bc){_0x4c3415=_0x1b43bc;_0x4cb66d=0xc8;}else{_0x4cb66d=0xce;}_0x109f0b[_0xbb73('0x19')](_0x4cb66d);return _0x109f0b['set'](_0xbb73('0x20'),_0x25e5f8+'-'+_0x4c3415+'/'+_0x1b43bc)[_0xbb73('0x1b')](_0x4a5e9c);}return null;};}function patchUpdates(_0x37569b){return function(_0x40264f){try{jsonpatch['apply'](_0x40264f,_0x37569b,!![]);}catch(_0x271496){return BPromise[_0xbb73('0x21')](_0x271496);}return _0x40264f[_0xbb73('0x22')]();};}function saveUpdates(_0x3b0383,_0x4960af){return function(_0x323a8e){if(_0x323a8e){return _0x323a8e[_0xbb73('0x23')](_0x3b0383)[_0xbb73('0x24')](function(_0x563458){return _0x563458;});}return null;};}function removeEntity(_0x49bf12,_0x39e271){return function(_0x4506f8){if(_0x4506f8){return _0x4506f8['destroy']()[_0xbb73('0x24')](function(){_0x49bf12[_0xbb73('0x19')](0xcc)[_0xbb73('0x1a')]();});}};}function handleEntityNotFound(_0x181deb,_0x5cf49a){return function(_0xe5713a){if(!_0xe5713a){_0x181deb[_0xbb73('0x18')](0x194);}return _0xe5713a;};}function handleError(_0x160cb5,_0x340047){_0x340047=_0x340047||0x1f4;return function(_0x225112){logger[_0xbb73('0x25')](_0x225112[_0xbb73('0x26')]);if(_0x225112[_0xbb73('0x27')]){delete _0x225112[_0xbb73('0x27')];}_0x160cb5[_0xbb73('0x19')](_0x340047)[_0xbb73('0x28')](_0x225112);};}exports['index']=function(_0x3f822d,_0x537563){var _0x346ca4={},_0x4270d3={},_0x540211={'count':0x0,'rows':[]};var _0x549708=_[_0xbb73('0x29')](db['MailTransferReport'][_0xbb73('0x2a')],function(_0x1f0033){return{'name':_0x1f0033[_0xbb73('0x2b')],'type':_0x1f0033[_0xbb73('0x2c')][_0xbb73('0x2d')]};});_0x4270d3['model']=_[_0xbb73('0x29')](_0x549708,_0xbb73('0x27'));_0x4270d3[_0xbb73('0x2e')]=_[_0xbb73('0x2f')](_0x3f822d[_0xbb73('0x2e')]);_0x4270d3[_0xbb73('0x30')]=_[_0xbb73('0x31')](_0x4270d3['model'],_0x4270d3['query']);_0x346ca4['attributes']=_[_0xbb73('0x31')](_0x4270d3[_0xbb73('0x32')],qs['fields'](_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x33')]));_0x346ca4['attributes']=_0x346ca4[_0xbb73('0x34')][_0xbb73('0x35')]?_0x346ca4['attributes']:_0x4270d3[_0xbb73('0x32')];if(!_0x3f822d[_0xbb73('0x2e')]['hasOwnProperty'](_0xbb73('0x36'))){_0x346ca4[_0xbb73('0x1d')]=qs[_0xbb73('0x1d')](_0x3f822d['query']['limit']);_0x346ca4['offset']=qs[_0xbb73('0x1f')](_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x1f')]);}_0x346ca4[_0xbb73('0x37')]=qs['sort'](_0x3f822d['query'][_0xbb73('0x38')]);_0x346ca4[_0xbb73('0x39')]=qs['filters'](_[_0xbb73('0x3a')](_0x3f822d[_0xbb73('0x2e')],_0x4270d3[_0xbb73('0x30')]),_0x549708);if(_0x3f822d['query'][_0xbb73('0x3b')]){_0x346ca4[_0xbb73('0x39')]=_[_0xbb73('0x3c')](_0x346ca4[_0xbb73('0x39')],{'$or':_[_0xbb73('0x29')](_0x549708,function(_0x287dcf){if(_0x287dcf['type']!==_0xbb73('0x3d')){var _0xf29ed0={};_0xf29ed0[_0x287dcf['name']]={'$like':'%'+_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x3b')]+'%'};return _0xf29ed0;}})});}_0x346ca4=_['merge']({},_0x346ca4,_0x3f822d[_0xbb73('0x3e')]);var _0x11a2c2={'where':_0x346ca4[_0xbb73('0x39')]};return db['MailTransferReport']['count'](_0x11a2c2)[_0xbb73('0x24')](function(_0x457572){_0x540211[_0xbb73('0x1e')]=_0x457572;if(_0x3f822d['query'][_0xbb73('0x3f')]){_0x346ca4[_0xbb73('0x40')]=[{'all':!![]}];}return db[_0xbb73('0x41')][_0xbb73('0x42')](_0x346ca4);})[_0xbb73('0x24')](function(_0x49872e){_0x540211[_0xbb73('0x43')]=_0x49872e;return _0x540211;})[_0xbb73('0x24')](respondWithFilteredResult(_0x537563,_0x346ca4))['catch'](handleError(_0x537563,null));};exports[_0xbb73('0x44')]=function(_0x36c92e,_0x872f6c){var _0x419681={'raw':!![],'where':{'id':_0x36c92e['params']['id']}},_0x563208={};_0x563208[_0xbb73('0x32')]=_[_0xbb73('0x2f')](db[_0xbb73('0x41')][_0xbb73('0x2a')]);_0x563208[_0xbb73('0x2e')]=_[_0xbb73('0x2f')](_0x36c92e[_0xbb73('0x2e')]);_0x563208[_0xbb73('0x30')]=_[_0xbb73('0x31')](_0x563208[_0xbb73('0x32')],_0x563208[_0xbb73('0x2e')]);_0x419681[_0xbb73('0x34')]=_[_0xbb73('0x31')](_0x563208['model'],qs[_0xbb73('0x33')](_0x36c92e[_0xbb73('0x2e')][_0xbb73('0x33')]));_0x419681[_0xbb73('0x34')]=_0x419681[_0xbb73('0x34')][_0xbb73('0x35')]?_0x419681[_0xbb73('0x34')]:_0x563208[_0xbb73('0x32')];if(_0x36c92e[_0xbb73('0x2e')]['includeAll']){_0x419681[_0xbb73('0x40')]=[{'all':!![]}];}_0x419681=_[_0xbb73('0x3c')]({},_0x419681,_0x36c92e[_0xbb73('0x3e')]);return db[_0xbb73('0x41')][_0xbb73('0x45')](_0x419681)[_0xbb73('0x24')](handleEntityNotFound(_0x872f6c,null))[_0xbb73('0x24')](respondWithResult(_0x872f6c,null))[_0xbb73('0x46')](handleError(_0x872f6c,null));};exports[_0xbb73('0x47')]=function(_0x58ffb1,_0x2afad7){return db['MailTransferReport'][_0xbb73('0x47')](_0x58ffb1['body'],{})[_0xbb73('0x24')](respondWithResult(_0x2afad7,0xc9))[_0xbb73('0x46')](handleError(_0x2afad7,null));};exports[_0xbb73('0x23')]=function(_0x2b10fc,_0x5f008a){if(_0x2b10fc[_0xbb73('0x48')]['id']){delete _0x2b10fc[_0xbb73('0x48')]['id'];}return db['MailTransferReport'][_0xbb73('0x45')]({'where':{'id':_0x2b10fc[_0xbb73('0x49')]['id']}})[_0xbb73('0x24')](handleEntityNotFound(_0x5f008a,null))['then'](saveUpdates(_0x2b10fc[_0xbb73('0x48')],null))[_0xbb73('0x24')](respondWithResult(_0x5f008a,null))['catch'](handleError(_0x5f008a,null));};exports[_0xbb73('0x4a')]=function(_0x31d9ff,_0x485d9f){return db[_0xbb73('0x41')][_0xbb73('0x45')]({'where':{'id':_0x31d9ff[_0xbb73('0x49')]['id']}})[_0xbb73('0x24')](handleEntityNotFound(_0x485d9f,null))['then'](removeEntity(_0x485d9f,null))[_0xbb73('0x46')](handleError(_0x485d9f,null));};exports[_0xbb73('0x4b')]=function(_0x2f2c76,_0x22fb52){return db[_0xbb73('0x41')][_0xbb73('0x4b')]()[_0xbb73('0x24')](respondWithResult(_0x22fb52,null))[_0xbb73('0x46')](handleError(_0x22fb52,null));}; \ No newline at end of file +var _0xeb46=['find','create','catch','body','describe','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','map','MailTransferReport','rawAttributes','fieldName','type','model','name','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','keys','length','includeAll','include'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeb46,0x129));var _0x6eb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb46[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6eb4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6eb4('0x1'));var moment=require('moment');var BPromise=require(_0x6eb4('0x2'));var Mustache=require(_0x6eb4('0x3'));var util=require(_0x6eb4('0x4'));var path=require(_0x6eb4('0x5'));var sox=require('sox');var csv=require(_0x6eb4('0x6'));var ejs=require(_0x6eb4('0x7'));var fs=require('fs');var fs_extra=require(_0x6eb4('0x8'));var _=require(_0x6eb4('0x9'));var squel=require(_0x6eb4('0xa'));var crypto=require('crypto');var jsforce=require(_0x6eb4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6eb4('0xc'));var Papa=require(_0x6eb4('0xd'));var Redis=require(_0x6eb4('0xe'));var authService=require(_0x6eb4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6eb4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6eb4('0x11'))(_0x6eb4('0x12'));var utils=require(_0x6eb4('0x13'));var config=require(_0x6eb4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eb4('0x15'))['db'];function respondWithStatusCode(_0x1e010f,_0x19ae2c){_0x19ae2c=_0x19ae2c||0xcc;return function(_0x307c71){if(_0x307c71){return _0x1e010f[_0x6eb4('0x16')](_0x19ae2c);}return _0x1e010f['status'](_0x19ae2c)[_0x6eb4('0x17')]();};}function respondWithResult(_0x42664a,_0x3cf304){_0x3cf304=_0x3cf304||0xc8;return function(_0x481015){if(_0x481015){return _0x42664a[_0x6eb4('0x18')](_0x3cf304)[_0x6eb4('0x19')](_0x481015);}};}function respondWithFilteredResult(_0x428037,_0x14786a){return function(_0x55f3b4){if(_0x55f3b4){var _0x516e1b=typeof _0x14786a[_0x6eb4('0x1a')]===_0x6eb4('0x1b')&&typeof _0x14786a[_0x6eb4('0x1c')]===_0x6eb4('0x1b');var _0x53c6aa=_0x55f3b4['count'];var _0x14888b=_0x516e1b?0x0:_0x14786a[_0x6eb4('0x1a')];var _0x53cb6b=_0x516e1b?_0x55f3b4[_0x6eb4('0x1d')]:_0x14786a[_0x6eb4('0x1a')]+_0x14786a[_0x6eb4('0x1c')];var _0x4b2cec;if(_0x53cb6b>=_0x53c6aa){_0x53cb6b=_0x53c6aa;_0x4b2cec=0xc8;}else{_0x4b2cec=0xce;}_0x428037[_0x6eb4('0x18')](_0x4b2cec);return _0x428037[_0x6eb4('0x1e')](_0x6eb4('0x1f'),_0x14888b+'-'+_0x53cb6b+'/'+_0x53c6aa)[_0x6eb4('0x19')](_0x55f3b4);}return null;};}function patchUpdates(_0xd70c13){return function(_0x57b120){try{jsonpatch[_0x6eb4('0x20')](_0x57b120,_0xd70c13,!![]);}catch(_0x538c5f){return BPromise[_0x6eb4('0x21')](_0x538c5f);}return _0x57b120[_0x6eb4('0x22')]();};}function saveUpdates(_0x2e6d14,_0x23df5e){return function(_0x4ca85d){if(_0x4ca85d){return _0x4ca85d[_0x6eb4('0x23')](_0x2e6d14)[_0x6eb4('0x24')](function(_0x16b64b){return _0x16b64b;});}return null;};}function removeEntity(_0x32ce33,_0xfe9117){return function(_0x3f9326){if(_0x3f9326){return _0x3f9326[_0x6eb4('0x25')]()['then'](function(){_0x32ce33[_0x6eb4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a50b,_0x1b6edc){return function(_0x22c15f){if(!_0x22c15f){_0x44a50b[_0x6eb4('0x16')](0x194);}return _0x22c15f;};}function handleError(_0x52889b,_0xc352d1){_0xc352d1=_0xc352d1||0x1f4;return function(_0x2b73c3){logger[_0x6eb4('0x26')](_0x2b73c3['stack']);if(_0x2b73c3['name']){delete _0x2b73c3['name'];}_0x52889b['status'](_0xc352d1)[_0x6eb4('0x27')](_0x2b73c3);};}exports['index']=function(_0x2a3a22,_0xc35da6){var _0x25f6d5={},_0x521f6c={},_0x89190={'count':0x0,'rows':[]};var _0x3effbe=_[_0x6eb4('0x28')](db[_0x6eb4('0x29')][_0x6eb4('0x2a')],function(_0xde413d){return{'name':_0xde413d[_0x6eb4('0x2b')],'type':_0xde413d[_0x6eb4('0x2c')]['key']};});_0x521f6c[_0x6eb4('0x2d')]=_[_0x6eb4('0x28')](_0x3effbe,_0x6eb4('0x2e'));_0x521f6c['query']=_['keys'](_0x2a3a22['query']);_0x521f6c[_0x6eb4('0x2f')]=_['intersection'](_0x521f6c[_0x6eb4('0x2d')],_0x521f6c[_0x6eb4('0x30')]);_0x25f6d5[_0x6eb4('0x31')]=_[_0x6eb4('0x32')](_0x521f6c[_0x6eb4('0x2d')],qs['fields'](_0x2a3a22['query'][_0x6eb4('0x33')]));_0x25f6d5[_0x6eb4('0x31')]=_0x25f6d5['attributes']['length']?_0x25f6d5[_0x6eb4('0x31')]:_0x521f6c['model'];if(!_0x2a3a22['query'][_0x6eb4('0x34')](_0x6eb4('0x35'))){_0x25f6d5[_0x6eb4('0x1c')]=qs[_0x6eb4('0x1c')](_0x2a3a22[_0x6eb4('0x30')][_0x6eb4('0x1c')]);_0x25f6d5[_0x6eb4('0x1a')]=qs[_0x6eb4('0x1a')](_0x2a3a22['query'][_0x6eb4('0x1a')]);}_0x25f6d5['order']=qs[_0x6eb4('0x36')](_0x2a3a22[_0x6eb4('0x30')]['sort']);_0x25f6d5[_0x6eb4('0x37')]=qs[_0x6eb4('0x2f')](_[_0x6eb4('0x38')](_0x2a3a22[_0x6eb4('0x30')],_0x521f6c[_0x6eb4('0x2f')]),_0x3effbe);if(_0x2a3a22[_0x6eb4('0x30')][_0x6eb4('0x39')]){_0x25f6d5[_0x6eb4('0x37')]=_[_0x6eb4('0x3a')](_0x25f6d5[_0x6eb4('0x37')],{'$or':_['map'](_0x3effbe,function(_0x4d71cf){if(_0x4d71cf[_0x6eb4('0x2c')]!==_0x6eb4('0x3b')){var _0x378aa4={};_0x378aa4[_0x4d71cf[_0x6eb4('0x2e')]]={'$like':'%'+_0x2a3a22[_0x6eb4('0x30')][_0x6eb4('0x39')]+'%'};return _0x378aa4;}})});}_0x25f6d5=_[_0x6eb4('0x3a')]({},_0x25f6d5,_0x2a3a22[_0x6eb4('0x3c')]);var _0x40142a={'where':_0x25f6d5[_0x6eb4('0x37')]};return db[_0x6eb4('0x29')][_0x6eb4('0x1d')](_0x40142a)[_0x6eb4('0x24')](function(_0x45074d){_0x89190['count']=_0x45074d;if(_0x2a3a22[_0x6eb4('0x30')]['includeAll']){_0x25f6d5['include']=[{'all':!![]}];}return db[_0x6eb4('0x29')]['findAll'](_0x25f6d5);})[_0x6eb4('0x24')](function(_0x555f34){_0x89190[_0x6eb4('0x3d')]=_0x555f34;return _0x89190;})['then'](respondWithFilteredResult(_0xc35da6,_0x25f6d5))['catch'](handleError(_0xc35da6,null));};exports[_0x6eb4('0x3e')]=function(_0x310979,_0x220dab){var _0x2fa7d5={'raw':!![],'where':{'id':_0x310979[_0x6eb4('0x3f')]['id']}},_0x1e751c={};_0x1e751c[_0x6eb4('0x2d')]=_[_0x6eb4('0x40')](db[_0x6eb4('0x29')][_0x6eb4('0x2a')]);_0x1e751c[_0x6eb4('0x30')]=_[_0x6eb4('0x40')](_0x310979[_0x6eb4('0x30')]);_0x1e751c[_0x6eb4('0x2f')]=_['intersection'](_0x1e751c[_0x6eb4('0x2d')],_0x1e751c[_0x6eb4('0x30')]);_0x2fa7d5[_0x6eb4('0x31')]=_[_0x6eb4('0x32')](_0x1e751c['model'],qs[_0x6eb4('0x33')](_0x310979[_0x6eb4('0x30')][_0x6eb4('0x33')]));_0x2fa7d5[_0x6eb4('0x31')]=_0x2fa7d5['attributes'][_0x6eb4('0x41')]?_0x2fa7d5[_0x6eb4('0x31')]:_0x1e751c[_0x6eb4('0x2d')];if(_0x310979['query'][_0x6eb4('0x42')]){_0x2fa7d5[_0x6eb4('0x43')]=[{'all':!![]}];}_0x2fa7d5=_[_0x6eb4('0x3a')]({},_0x2fa7d5,_0x310979['options']);return db[_0x6eb4('0x29')][_0x6eb4('0x44')](_0x2fa7d5)[_0x6eb4('0x24')](handleEntityNotFound(_0x220dab,null))[_0x6eb4('0x24')](respondWithResult(_0x220dab,null))['catch'](handleError(_0x220dab,null));};exports[_0x6eb4('0x45')]=function(_0x28c119,_0x2f7cbf){return db['MailTransferReport'][_0x6eb4('0x45')](_0x28c119['body'],{})[_0x6eb4('0x24')](respondWithResult(_0x2f7cbf,0xc9))[_0x6eb4('0x46')](handleError(_0x2f7cbf,null));};exports[_0x6eb4('0x23')]=function(_0x5df55a,_0x1bd74b){if(_0x5df55a[_0x6eb4('0x47')]['id']){delete _0x5df55a[_0x6eb4('0x47')]['id'];}return db['MailTransferReport'][_0x6eb4('0x44')]({'where':{'id':_0x5df55a['params']['id']}})[_0x6eb4('0x24')](handleEntityNotFound(_0x1bd74b,null))['then'](saveUpdates(_0x5df55a[_0x6eb4('0x47')],null))[_0x6eb4('0x24')](respondWithResult(_0x1bd74b,null))[_0x6eb4('0x46')](handleError(_0x1bd74b,null));};exports[_0x6eb4('0x25')]=function(_0x302900,_0x31f6d4){return db[_0x6eb4('0x29')][_0x6eb4('0x44')]({'where':{'id':_0x302900[_0x6eb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x31f6d4,null))[_0x6eb4('0x24')](removeEntity(_0x31f6d4,null))['catch'](handleError(_0x31f6d4,null));};exports[_0x6eb4('0x48')]=function(_0xc035b2,_0x43897f){return db['MailTransferReport'][_0x6eb4('0x48')]()['then'](respondWithResult(_0x43897f,null))[_0x6eb4('0x46')](handleError(_0x43897f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1485c9d..515264c 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 _0x8f9e=['MailTransferReport','uniqueid','lodash','util','api','moment','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x5f09a9,_0xead85){var _0x53bd09=function(_0x325bb9){while(--_0x325bb9){_0x5f09a9['push'](_0x5f09a9['shift']());}};_0x53bd09(++_0xead85);}(_0x8f9e,0x160));var _0xe8f9=function(_0x3ca717,_0x3e0d02){_0x3ca717=_0x3ca717-0x0;var _0x37c1bf=_0x8f9e[_0x3ca717];return _0x37c1bf;};'use strict';var _=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var logger=require('../../config/logger')(_0xe8f9('0x2'));var moment=require(_0xe8f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8f9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe8f9('0x5'));module[_0xe8f9('0x6')]=function(_0x132a4f,_0xf77bb6){return _0x132a4f[_0xe8f9('0x7')](_0xe8f9('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xe8f9('0x9'),'fields':[_0xe8f9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x548b=['moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x548b,0x14f));var _0xb548=function(_0x3f6bbc,_0x2ff8b6){_0x3f6bbc=_0x3f6bbc-0x0;var _0x301395=_0x548b[_0x3f6bbc];return _0x301395;};'use strict';var _=require(_0xb548('0x0'));var util=require('util');var logger=require(_0xb548('0x1'))(_0xb548('0x2'));var moment=require(_0xb548('0x3'));var BPromise=require(_0xb548('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb548('0x5'));var config=require(_0xb548('0x6'));var attributes=require(_0xb548('0x7'));module[_0xb548('0x8')]=function(_0x20a495,_0x1dc4f8){return _0x20a495[_0xb548('0x9')](_0xb548('0xa'),attributes,{'tableName':_0xb548('0xb'),'paranoid':![],'indexes':[{'name':_0xb548('0xc'),'fields':[_0xb548('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e05b2c3..139a810 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 _0xa442=['then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2f21c6,_0x51de35){var _0x32cbd5=function(_0x651591){while(--_0x651591){_0x2f21c6['push'](_0x2f21c6['shift']());}};_0x32cbd5(++_0x51de35);}(_0xa442,0x153));var _0x2a44=function(_0x5b92ea,_0x4ed032){_0x5b92ea=_0x5b92ea-0x0;var _0x75d3c6=_0xa442[_0x5b92ea];return _0x75d3c6;};'use strict';var _=require(_0x2a44('0x0'));var util=require(_0x2a44('0x1'));var moment=require(_0x2a44('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a44('0x3'));var fs=require('fs');var Redis=require(_0x2a44('0x4'));var db=require(_0x2a44('0x5'))['db'];var utils=require(_0x2a44('0x6'));var logger=require(_0x2a44('0x7'))(_0x2a44('0x8'));var config=require(_0x2a44('0x9'));var jayson=require(_0x2a44('0xa'));var client=jayson[_0x2a44('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b93ba,_0xd2ca41,_0x29fa34){return new BPromise(function(_0x366895,_0x1d281b){return client[_0x2a44('0xc')](_0x3b93ba,_0x29fa34)[_0x2a44('0xd')](function(_0x395cae){logger['info'](_0x2a44('0xe'),_0xd2ca41,_0x2a44('0xf'));logger[_0x2a44('0x10')](_0x2a44('0x11'),_0xd2ca41,'request\x20sent',JSON[_0x2a44('0x12')](_0x395cae));if(_0x395cae[_0x2a44('0x13')]){if(_0x395cae[_0x2a44('0x13')]['code']===0x1f4){logger['error'](_0x2a44('0xe'),_0xd2ca41,_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);return _0x1d281b(_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);}logger[_0x2a44('0x13')](_0x2a44('0xe'),_0xd2ca41,_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);return _0x366895(_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0xd2ca41,_0x2a44('0xf'));_0x366895(_0x395cae[_0x2a44('0x15')][_0x2a44('0x14')]);}})['catch'](function(_0x57b828){logger['error'](_0x2a44('0xe'),_0xd2ca41,_0x57b828);_0x1d281b(_0x57b828);});});} \ No newline at end of file +var _0xc269=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc269,0x1b0));var _0x9c26=function(_0x12ebde,_0x4d7c73){_0x12ebde=_0x12ebde-0x0;var _0x218b5d=_0xc269[_0x12ebde];return _0x218b5d;};'use strict';var _=require(_0x9c26('0x0'));var util=require(_0x9c26('0x1'));var moment=require(_0x9c26('0x2'));var BPromise=require(_0x9c26('0x3'));var rs=require(_0x9c26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c26('0x5'))['db'];var utils=require(_0x9c26('0x6'));var logger=require('../../config/logger')(_0x9c26('0x7'));var config=require(_0x9c26('0x8'));var jayson=require(_0x9c26('0x9'));var client=jayson[_0x9c26('0xa')][_0x9c26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2077d8,_0x1eebf5,_0xf9017b){return new BPromise(function(_0x153a93,_0x2904a9){return client[_0x9c26('0xc')](_0x2077d8,_0xf9017b)[_0x9c26('0xd')](function(_0x937265){logger[_0x9c26('0xe')](_0x9c26('0xf'),_0x1eebf5,'request\x20sent');logger[_0x9c26('0x10')](_0x9c26('0x11'),_0x1eebf5,_0x9c26('0x12'),JSON[_0x9c26('0x13')](_0x937265));if(_0x937265[_0x9c26('0x14')]){if(_0x937265[_0x9c26('0x14')]['code']===0x1f4){logger[_0x9c26('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x1eebf5,_0x937265[_0x9c26('0x14')][_0x9c26('0x15')]);return _0x2904a9(_0x937265['error'][_0x9c26('0x15')]);}logger[_0x9c26('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x1eebf5,_0x937265['error'][_0x9c26('0x15')]);return _0x153a93(_0x937265[_0x9c26('0x14')][_0x9c26('0x15')]);}else{logger['info'](_0x9c26('0xf'),_0x1eebf5,_0x9c26('0x12'));_0x153a93(_0x937265['result'][_0x9c26('0x15')]);}})[_0x9c26('0x16')](function(_0x2105a7){logger[_0x9c26('0x14')](_0x9c26('0xf'),_0x1eebf5,_0x2105a7);_0x2904a9(_0x2105a7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 99dcc11..db77af2 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 _0xa85a=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','exports','multer','path'];(function(_0x99e1be,_0x5d9a25){var _0x1bb602=function(_0x5a72d5){while(--_0x5a72d5){_0x99e1be['push'](_0x99e1be['shift']());}};_0x1bb602(++_0x5d9a25);}(_0xa85a,0x108));var _0xaa85=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa85a[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xaa85('0x0'));var util=require('util');var path=require(_0xaa85('0x1'));var timeout=require(_0xaa85('0x2'));var express=require(_0xaa85('0x3'));var router=express['Router']();var fs_extra=require(_0xaa85('0x4'));var auth=require(_0xaa85('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa85('0x6'));var controller=require(_0xaa85('0x7'));router[_0xaa85('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa85('0x9')]);router[_0xaa85('0x8')](_0xaa85('0xa'),auth[_0xaa85('0xb')](),controller[_0xaa85('0xc')]);router[_0xaa85('0x8')](_0xaa85('0xd'),auth[_0xaa85('0xb')](),controller['show']);router[_0xaa85('0xe')]('/',auth['isAuthenticated'](),controller[_0xaa85('0xf')]);router[_0xaa85('0x10')]('/:id',auth[_0xaa85('0xb')](),controller[_0xaa85('0x11')]);router['delete'](_0xaa85('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa85('0x12')]=router; \ No newline at end of file +var _0xabda=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f62a7,_0x371940){var _0x2478fa=function(_0x4efda7){while(--_0x4efda7){_0x1f62a7['push'](_0x1f62a7['shift']());}};_0x2478fa(++_0x371940);}(_0xabda,0x125));var _0xaabd=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0xabda[_0x7b5cdd];return _0x3a29ae;};'use strict';var multer=require(_0xaabd('0x0'));var util=require(_0xaabd('0x1'));var path=require(_0xaabd('0x2'));var timeout=require(_0xaabd('0x3'));var express=require(_0xaabd('0x4'));var router=express[_0xaabd('0x5')]();var fs_extra=require(_0xaabd('0x6'));var auth=require(_0xaabd('0x7'));var interaction=require(_0xaabd('0x8'));var config=require(_0xaabd('0x9'));var controller=require('./memberReport.controller');router[_0xaabd('0xa')]('/',auth['isAuthenticated'](),controller[_0xaabd('0xb')]);router[_0xaabd('0xa')](_0xaabd('0xc'),auth[_0xaabd('0xd')](),controller['describe']);router['get'](_0xaabd('0xe'),auth[_0xaabd('0xd')](),controller['show']);router[_0xaabd('0xf')]('/',auth[_0xaabd('0xd')](),controller[_0xaabd('0x10')]);router[_0xaabd('0x11')]('/:id',auth[_0xaabd('0xd')](),controller[_0xaabd('0x12')]);router[_0xaabd('0x13')](_0xaabd('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 856c52a..d796f36 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 _0xa58e=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x4dd33b,_0xf54410){var _0x1217a6=function(_0x39d7cd){while(--_0x39d7cd){_0x4dd33b['push'](_0x4dd33b['shift']());}};_0x1217a6(++_0xf54410);}(_0xa58e,0x1d3));var _0xea58=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa58e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xea58('0x0'));var moment=require(_0xea58('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xea58('0x2')],'defaultValue':_0xea58('0x3'),'comment':_0xea58('0x4')},'duration':{'type':Sequelize[_0xea58('0x5')]},'enterAt':{'type':Sequelize[_0xea58('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x34d83f){var _0x56968f=moment(_0x34d83f);var _0x10977e=moment(this['getDataValue'](_0xea58('0x7')));var _0x2b3345=_0x56968f[_0xea58('0x8')](_0x10977e,_0xea58('0x9'));this[_0xea58('0xa')](_0xea58('0xb'),_0x34d83f);this[_0xea58('0xa')](_0xea58('0xc'),_0x2b3345>=0x0?_0x2b3345:null);}},'data1':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xd')},'data2':{'type':Sequelize[_0xea58('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xf')},'role':{'type':Sequelize[_0xea58('0x2')]},'internal':{'type':Sequelize[_0xea58('0x5')]},'uniqueid':{'type':Sequelize[_0xea58('0x2')]}}; \ No newline at end of file +var _0x631a=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x1e943f,_0x2510b1){var _0x5d22e1=function(_0x1dab40){while(--_0x1dab40){_0x1e943f['push'](_0x1e943f['shift']());}};_0x5d22e1(++_0x2510b1);}(_0x631a,0x124));var _0xa631=function(_0x1dec79,_0x5522c7){_0x1dec79=_0x1dec79-0x0;var _0x43149d=_0x631a[_0x1dec79];return _0x43149d;};'use strict';var Sequelize=require(_0xa631('0x0'));var moment=require(_0xa631('0x1'));module[_0xa631('0x2')]={'channel':{'type':Sequelize[_0xa631('0x3')]},'membername':{'type':Sequelize[_0xa631('0x3')]},'interface':{'type':Sequelize[_0xa631('0x3')]},'type':{'type':Sequelize[_0xa631('0x3')],'defaultValue':_0xa631('0x4'),'comment':_0xa631('0x5')},'duration':{'type':Sequelize[_0xa631('0x6')]},'enterAt':{'type':Sequelize[_0xa631('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3d391b){var _0x4dd2d1=moment(_0x3d391b);var _0x2b77d1=moment(this[_0xa631('0x8')](_0xa631('0x9')));var _0x20bad1=_0x4dd2d1[_0xa631('0xa')](_0x2b77d1,_0xa631('0xb'));this[_0xa631('0xc')](_0xa631('0xd'),_0x3d391b);this[_0xa631('0xc')](_0xa631('0xe'),_0x20bad1>=0x0?_0x20bad1:null);}},'data1':{'type':Sequelize[_0xa631('0x3')],'comment':_0xa631('0xf')},'data2':{'type':Sequelize[_0xa631('0x3')],'comment':_0xa631('0x10')},'data3':{'type':Sequelize[_0xa631('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xa631('0x3')],'comment':_0xa631('0x11')},'role':{'type':Sequelize[_0xa631('0x3')]},'internal':{'type':Sequelize[_0xa631('0x6')]},'uniqueid':{'type':Sequelize[_0xa631('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f5ced3c..c8ce6b2 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xaf8267,_0x33968b){var _0x20798b=function(_0xaa6732){while(--_0xaa6732){_0xaf8267['push'](_0xaf8267['shift']());}};_0x20798b(++_0x33968b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x2af783,_0x260e77){var _0x4e629f=function(_0x4d5bbf){while(--_0x4d5bbf){_0x2af783['push'](_0x2af783['shift']());}};_0x4e629f(++_0x260e77);}(_0x008c,0x188));var _0xc008=function(_0x291c1b,_0x5216a6){_0x291c1b=_0x291c1b-0x0;var _0x2109c9=_0x008c[_0x291c1b];return _0x2109c9;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e1bb972..b5164f3 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 _0x0d6f=['api','bluebird','path','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x0d6f,0xb1));var _0xf0d6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0d6f[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var logger=require(_0xf0d6('0x2'))(_0xf0d6('0x3'));var moment=require('moment');var BPromise=require(_0xf0d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xf0d6('0x6')]=function(_0x5ef764,_0x1060d2){return _0x5ef764[_0xf0d6('0x7')]('MemberReport',attributes,{'tableName':_0xf0d6('0x8'),'paranoid':![],'indexes':[{'name':_0xf0d6('0x9'),'fields':[_0xf0d6('0xa'),_0xf0d6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb403=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','MemberReport','report_member','interface'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xb403,0x15e));var _0x3b40=function(_0x1974a1,_0x347db8){_0x1974a1=_0x1974a1-0x0;var _0x415789=_0xb403[_0x1974a1];return _0x415789;};'use strict';var _=require(_0x3b40('0x0'));var util=require(_0x3b40('0x1'));var logger=require(_0x3b40('0x2'))(_0x3b40('0x3'));var moment=require(_0x3b40('0x4'));var BPromise=require(_0x3b40('0x5'));var rp=require(_0x3b40('0x6'));var fs=require('fs');var path=require(_0x3b40('0x7'));var rimraf=require(_0x3b40('0x8'));var config=require('../../config/environment');var attributes=require(_0x3b40('0x9'));module[_0x3b40('0xa')]=function(_0x15ebe6,_0x5dc2ab){return _0x15ebe6['define'](_0x3b40('0xb'),attributes,{'tableName':_0x3b40('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x3b40('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index abdb8d3..2d0c826 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 _0x29af=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','update','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f8bc4,_0x4bf1c3){var _0x4bc429=function(_0x24b69c){while(--_0x24b69c){_0x4f8bc4['push'](_0x4f8bc4['shift']());}};_0x4bc429(++_0x4bf1c3);}(_0x29af,0x134));var _0xf29a=function(_0x51e2a0,_0x458be2){_0x51e2a0=_0x51e2a0-0x0;var _0x9297e7=_0x29af[_0x51e2a0];return _0x9297e7;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('MemberReport,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findAll']({'raw':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')]||null:null,'attributes':_0xd4ca39['options']?_0xd4ca39[_0xf29a('0x17')]['attributes']||null:null,'limit':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x19')]||null:null,'include':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39['options'][_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')],function(_0x35af39){return{'model':db[_0x35af39[_0xf29a('0x1c')]],'as':_0x35af39['as'],'attributes':_0x35af39[_0xf29a('0x1d')],'include':_0x35af39['include']?_['map'](_0x35af39['include'],function(_0x262a5f){return{'model':db[_0x262a5f['model']],'as':_0x262a5f['as'],'attributes':_0x262a5f[_0xf29a('0x1d')],'include':_0x262a5f[_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0x262a5f['include'],function(_0x181c3a){return{'model':db[_0x181c3a[_0xf29a('0x1c')]],'as':_0x181c3a['as'],'attributes':_0x181c3a[_0xf29a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf29a('0x9')](function(_0x11d1a6){logger[_0xf29a('0xa')]('GetMemberReport',_0xd4ca39);logger[_0xf29a('0xb')](_0xf29a('0x15'),_0xd4ca39,JSON['stringify'](_0x11d1a6));_0x296829(_0x11d1a6);})['catch'](function(_0x4fdd1b){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x4fdd1b[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4fdd1b[_0xf29a('0x12')]));});});};exports[_0xf29a('0x1e')]=function(_0x694c05){var _0x50b221=this;return new Promise(function(_0x2b10d1,_0x3e31c3){return db[_0xf29a('0x16')][_0xf29a('0x1f')](_0x694c05[_0xf29a('0x20')],{'raw':_0x694c05[_0xf29a('0x17')]?_0x694c05[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf29a('0x9')](function(_0x566b1d){logger[_0xf29a('0xa')](_0xf29a('0x1e'),_0x694c05);logger[_0xf29a('0xb')](_0xf29a('0x1e'),_0x694c05,JSON[_0xf29a('0xe')](_0x566b1d));_0x2b10d1(_0x566b1d);})['catch'](function(_0x12110d){logger['error'](_0xf29a('0x1e'),_0x12110d[_0xf29a('0x12')],_0x694c05);_0x3e31c3(_0x50b221['error'](0x1f4,_0x12110d[_0xf29a('0x12')]));});});};exports[_0xf29a('0x21')]=function(_0x5b1834){var _0x13b011=this;return new Promise(function(_0x399698,_0x422cd8){return db[_0xf29a('0x16')][_0xf29a('0x22')](_0x5b1834[_0xf29a('0x20')],{'raw':_0x5b1834['options']?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b1834[_0xf29a('0x17')]?_0x5b1834['options'][_0xf29a('0x18')]||null:null,'attributes':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x1d')]||null:null,'limit':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x19')]||null:null})[_0xf29a('0x9')](function(_0x1fde1e){logger[_0xf29a('0xa')](_0xf29a('0x21'),_0x5b1834);logger[_0xf29a('0xb')]('UpdateMemberReport',_0x5b1834,JSON['stringify'](_0x1fde1e));_0x399698(_0x1fde1e);})[_0xf29a('0x14')](function(_0x1650a7){logger[_0xf29a('0xf')]('UpdateMemberReport',_0x1650a7[_0xf29a('0x12')],_0x5b1834);_0x422cd8(_0x13b011[_0xf29a('0xf')](0x1f4,_0x1650a7[_0xf29a('0x12')]));});});}; \ No newline at end of file +var _0x14f5=['../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','stringify','CreateMemberReport','create','body','UpdateMemberReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xaec2a3,_0x5973b9){var _0x56955a=function(_0x277b25){while(--_0x277b25){_0xaec2a3['push'](_0xaec2a3['shift']());}};_0x56955a(++_0x5973b9);}(_0x14f5,0xae));var _0x514f=function(_0x21c7e4,_0x2d61be){_0x21c7e4=_0x21c7e4-0x0;var _0x310cd2=_0x14f5[_0x21c7e4];return _0x310cd2;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('MemberReport,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});}exports[_0x514f('0x15')]=function(_0x5a5641){var _0x28e99a=this;return new Promise(function(_0x3673a4,_0x2cdd0d){return db[_0x514f('0x16')]['findAll']({'raw':_0x5a5641['options']?_0x5a5641[_0x514f('0x17')][_0x514f('0x18')]===undefined?!![]:![]:!![],'where':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x19')]||null:null,'attributes':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x1a')]||null:null,'limit':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x1b')]||null:null,'include':_0x5a5641[_0x514f('0x17')]?_0x5a5641[_0x514f('0x17')][_0x514f('0x1c')]?_['map'](_0x5a5641['options']['include'],function(_0x5d80cb){return{'model':db[_0x5d80cb[_0x514f('0x1d')]],'as':_0x5d80cb['as'],'attributes':_0x5d80cb[_0x514f('0x1a')],'include':_0x5d80cb[_0x514f('0x1c')]?_[_0x514f('0x1e')](_0x5d80cb[_0x514f('0x1c')],function(_0x26df04){return{'model':db[_0x26df04[_0x514f('0x1d')]],'as':_0x26df04['as'],'attributes':_0x26df04[_0x514f('0x1a')],'include':_0x26df04[_0x514f('0x1c')]?_['map'](_0x26df04[_0x514f('0x1c')],function(_0x37b3db){return{'model':db[_0x37b3db[_0x514f('0x1d')]],'as':_0x37b3db['as'],'attributes':_0x37b3db[_0x514f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x514f('0xa')](function(_0x32f3e1){logger[_0x514f('0xb')](_0x514f('0x15'),_0x5a5641);logger[_0x514f('0xe')]('GetMemberReport',_0x5a5641,JSON[_0x514f('0x1f')](_0x32f3e1));_0x3673a4(_0x32f3e1);})['catch'](function(_0x2b43e0){logger['error'](_0x514f('0x15'),_0x2b43e0[_0x514f('0x12')],_0x5a5641);_0x2cdd0d(_0x28e99a[_0x514f('0x10')](0x1f4,_0x2b43e0[_0x514f('0x12')]));});});};exports[_0x514f('0x20')]=function(_0x5d9017){var _0x56e83e=this;return new Promise(function(_0x3e788b,_0x5d564b){return db[_0x514f('0x16')][_0x514f('0x21')](_0x5d9017[_0x514f('0x22')],{'raw':_0x5d9017[_0x514f('0x17')]?_0x5d9017[_0x514f('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5eee93){logger[_0x514f('0xb')](_0x514f('0x20'),_0x5d9017);logger[_0x514f('0xe')](_0x514f('0x20'),_0x5d9017,JSON[_0x514f('0x1f')](_0x5eee93));_0x3e788b(_0x5eee93);})[_0x514f('0x14')](function(_0x1cd65a){logger[_0x514f('0x10')](_0x514f('0x20'),_0x1cd65a[_0x514f('0x12')],_0x5d9017);_0x5d564b(_0x56e83e['error'](0x1f4,_0x1cd65a['message']));});});};exports['UpdateMemberReport']=function(_0x63d383){var _0x4e028b=this;return new Promise(function(_0x450d04,_0x50c120){return db[_0x514f('0x16')]['update'](_0x63d383['body'],{'raw':_0x63d383[_0x514f('0x17')]?_0x63d383['options'][_0x514f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63d383[_0x514f('0x17')]?_0x63d383[_0x514f('0x17')][_0x514f('0x19')]||null:null,'attributes':_0x63d383[_0x514f('0x17')]?_0x63d383['options'][_0x514f('0x1a')]||null:null,'limit':_0x63d383[_0x514f('0x17')]?_0x63d383[_0x514f('0x17')][_0x514f('0x1b')]||null:null})['then'](function(_0x196a2b){logger[_0x514f('0xb')](_0x514f('0x23'),_0x63d383);logger[_0x514f('0xe')]('UpdateMemberReport',_0x63d383,JSON[_0x514f('0x1f')](_0x196a2b));_0x450d04(_0x196a2b);})[_0x514f('0x14')](function(_0x420c77){logger[_0x514f('0x10')]('UpdateMemberReport',_0x420c77[_0x514f('0x12')],_0x63d383);_0x50c120(_0x4e028b['error'](0x1f4,_0x420c77[_0x514f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d68c10a..105d6f7 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 _0x993f=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x993f,0x129));var _0xf993=function(_0x3b7e8e,_0x3d9831){_0x3b7e8e=_0x3b7e8e-0x0;var _0x177b0e=_0x993f[_0x3b7e8e];return _0x177b0e;};'use strict';var multer=require(_0xf993('0x0'));var util=require(_0xf993('0x1'));var path=require(_0xf993('0x2'));var timeout=require(_0xf993('0x3'));var express=require('express');var router=express[_0xf993('0x4')]();var fs_extra=require(_0xf993('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var controller=require(_0xf993('0x8'));router[_0xf993('0x9')]('/',controller[_0xf993('0xa')]);module[_0xf993('0xb')]=router; \ No newline at end of file +var _0x1b6a=['express','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path'];(function(_0x50bd4e,_0x42bb6b){var _0x1d8010=function(_0x124bdf){while(--_0x124bdf){_0x50bd4e['push'](_0x50bd4e['shift']());}};_0x1d8010(++_0x42bb6b);}(_0x1b6a,0xe3));var _0xa1b6=function(_0x4f005b,_0x46904d){_0x4f005b=_0x4f005b-0x0;var _0x121ad7=_0x1b6a[_0x4f005b];return _0x121ad7;};'use strict';var multer=require(_0xa1b6('0x0'));var util=require(_0xa1b6('0x1'));var path=require(_0xa1b6('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1b6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1b6('0x4'));var interaction=require(_0xa1b6('0x5'));var config=require('../../config/environment');var controller=require(_0xa1b6('0x6'));router[_0xa1b6('0x7')]('/',controller[_0xa1b6('0x8')]);module[_0xa1b6('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index dec4b44..ccb8d7a 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 _0xb0f8=['exports','version','sequelize'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0xb0f8,0xe3));var _0x8b0f=function(_0x482424,_0x43cf36){_0x482424=_0x482424-0x0;var _0x3285=_0xb0f8[_0x482424];return _0x3285;};'use strict';var Sequelize=require(_0x8b0f('0x0'));module[_0x8b0f('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x8b0f('0x2')}}; \ No newline at end of file +var _0x0ae1=['version','sequelize','STRING'];(function(_0x5c4ca2,_0x295fee){var _0x47c971=function(_0x12c38e){while(--_0x12c38e){_0x5c4ca2['push'](_0x5c4ca2['shift']());}};_0x47c971(++_0x295fee);}(_0x0ae1,0x1e7));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x10ae('0x0'));module['exports']={'version':{'type':Sequelize[_0x10ae('0x1')],'unique':_0x10ae('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8400a31..42789a8 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 _0x7fcc=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','stack','name','index','map','Migration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x7fcc,0xc0));var _0xc7fc=function(_0x18212f,_0x255f6f){_0x18212f=_0x18212f-0x0;var _0x467fef=_0x7fcc[_0x18212f];return _0x467fef;};'use strict';var emlformat=require(_0xc7fc('0x0'));var rimraf=require(_0xc7fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc7fc('0x2'));var moment=require('moment');var BPromise=require(_0xc7fc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc7fc('0x4'));var sox=require(_0xc7fc('0x5'));var csv=require(_0xc7fc('0x6'));var ejs=require(_0xc7fc('0x7'));var fs=require('fs');var fs_extra=require(_0xc7fc('0x8'));var _=require(_0xc7fc('0x9'));var squel=require(_0xc7fc('0xa'));var crypto=require(_0xc7fc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc7fc('0xc'));var toCsv=require(_0xc7fc('0x6'));var querystring=require(_0xc7fc('0xd'));var Papa=require(_0xc7fc('0xe'));var Redis=require(_0xc7fc('0xf'));var authService=require(_0xc7fc('0x10'));var qs=require(_0xc7fc('0x11'));var as=require(_0xc7fc('0x12'));var hardwareService=require(_0xc7fc('0x13'));var logger=require(_0xc7fc('0x14'))(_0xc7fc('0x15'));var utils=require(_0xc7fc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc7fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551b12,_0x46ad11){_0x46ad11=_0x46ad11||0xcc;return function(_0x26fd2d){if(_0x26fd2d){return _0x551b12[_0xc7fc('0x18')](_0x46ad11);}return _0x551b12[_0xc7fc('0x19')](_0x46ad11)['end']();};}function respondWithResult(_0x1e0afa,_0x30276b){_0x30276b=_0x30276b||0xc8;return function(_0x21ef96){if(_0x21ef96){return _0x1e0afa['status'](_0x30276b)[_0xc7fc('0x1a')](_0x21ef96);}};}function respondWithFilteredResult(_0x3cd775,_0x51d20e){return function(_0x20dfb9){if(_0x20dfb9){var _0x3de6e6=typeof _0x51d20e[_0xc7fc('0x1b')]===_0xc7fc('0x1c')&&typeof _0x51d20e[_0xc7fc('0x1d')]==='undefined';var _0x3f5d03=_0x20dfb9[_0xc7fc('0x1e')];var _0x5d6543=_0x3de6e6?0x0:_0x51d20e[_0xc7fc('0x1b')];var _0x1daaf6=_0x3de6e6?_0x20dfb9[_0xc7fc('0x1e')]:_0x51d20e[_0xc7fc('0x1b')]+_0x51d20e[_0xc7fc('0x1d')];var _0x3e36b2;if(_0x1daaf6>=_0x3f5d03){_0x1daaf6=_0x3f5d03;_0x3e36b2=0xc8;}else{_0x3e36b2=0xce;}_0x3cd775[_0xc7fc('0x19')](_0x3e36b2);return _0x3cd775[_0xc7fc('0x1f')](_0xc7fc('0x20'),_0x5d6543+'-'+_0x1daaf6+'/'+_0x3f5d03)[_0xc7fc('0x1a')](_0x20dfb9);}return null;};}function patchUpdates(_0x295d49){return function(_0x533679){try{jsonpatch['apply'](_0x533679,_0x295d49,!![]);}catch(_0x50b3c1){return BPromise[_0xc7fc('0x21')](_0x50b3c1);}return _0x533679[_0xc7fc('0x22')]();};}function saveUpdates(_0x1d42e1,_0x51a0e2){return function(_0x45f67f){if(_0x45f67f){return _0x45f67f['update'](_0x1d42e1)[_0xc7fc('0x23')](function(_0x577d6a){return _0x577d6a;});}return null;};}function removeEntity(_0x5b6230,_0x5ae066){return function(_0x1e18fe){if(_0x1e18fe){return _0x1e18fe['destroy']()[_0xc7fc('0x23')](function(){_0x5b6230[_0xc7fc('0x19')](0xcc)[_0xc7fc('0x24')]();});}};}function handleEntityNotFound(_0xdaeb2b,_0x29b8e6){return function(_0x1c6c74){if(!_0x1c6c74){_0xdaeb2b[_0xc7fc('0x18')](0x194);}return _0x1c6c74;};}function handleError(_0xca7022,_0x4c0b53){_0x4c0b53=_0x4c0b53||0x1f4;return function(_0x26c6b8){logger[_0xc7fc('0x25')](_0x26c6b8[_0xc7fc('0x26')]);if(_0x26c6b8[_0xc7fc('0x27')]){delete _0x26c6b8[_0xc7fc('0x27')];}_0xca7022[_0xc7fc('0x19')](_0x4c0b53)['send'](_0x26c6b8);};}exports[_0xc7fc('0x28')]=function(_0x189666,_0x11b0d9){var _0xab1024={},_0x1cb741={},_0xc1e23f={'count':0x0,'rows':[]};var _0x3092d0=_[_0xc7fc('0x29')](db[_0xc7fc('0x2a')][_0xc7fc('0x2b')],function(_0xac55a0){return{'name':_0xac55a0['fieldName'],'type':_0xac55a0['type'][_0xc7fc('0x2c')]};});_0x1cb741['model']=_[_0xc7fc('0x29')](_0x3092d0,_0xc7fc('0x27'));_0x1cb741[_0xc7fc('0x2d')]=_[_0xc7fc('0x2e')](_0x189666['query']);_0x1cb741[_0xc7fc('0x2f')]=_[_0xc7fc('0x30')](_0x1cb741[_0xc7fc('0x31')],_0x1cb741['query']);_0xab1024[_0xc7fc('0x32')]=_['intersection'](_0x1cb741['model'],qs[_0xc7fc('0x33')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x33')]));_0xab1024[_0xc7fc('0x32')]=_0xab1024[_0xc7fc('0x32')][_0xc7fc('0x34')]?_0xab1024['attributes']:_0x1cb741['model'];if(!_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x35')](_0xc7fc('0x36'))){_0xab1024['limit']=qs[_0xc7fc('0x1d')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x1d')]);_0xab1024['offset']=qs[_0xc7fc('0x1b')](_0x189666['query'][_0xc7fc('0x1b')]);}_0xab1024[_0xc7fc('0x37')]=qs[_0xc7fc('0x38')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x38')]);_0xab1024[_0xc7fc('0x39')]=qs[_0xc7fc('0x2f')](_[_0xc7fc('0x3a')](_0x189666[_0xc7fc('0x2d')],_0x1cb741[_0xc7fc('0x2f')]),_0x3092d0);if(_0x189666['query']['filter']){_0xab1024['where']=_['merge'](_0xab1024[_0xc7fc('0x39')],{'$or':_['map'](_0x3092d0,function(_0x4ed879){if(_0x4ed879['type']!==_0xc7fc('0x3b')){var _0x5340bc={};_0x5340bc[_0x4ed879[_0xc7fc('0x27')]]={'$like':'%'+_0x189666['query'][_0xc7fc('0x3c')]+'%'};return _0x5340bc;}})});}_0xab1024=_[_0xc7fc('0x3d')]({},_0xab1024,_0x189666[_0xc7fc('0x3e')]);var _0x5d9fcc={'where':_0xab1024[_0xc7fc('0x39')]};return db[_0xc7fc('0x2a')]['count'](_0x5d9fcc)[_0xc7fc('0x23')](function(_0x2e028c){_0xc1e23f[_0xc7fc('0x1e')]=_0x2e028c;if(_0x189666['query'][_0xc7fc('0x3f')]){_0xab1024[_0xc7fc('0x40')]=[{'all':!![]}];}return db['Migration'][_0xc7fc('0x41')](_0xab1024);})[_0xc7fc('0x23')](function(_0x386d93){_0xc1e23f[_0xc7fc('0x42')]=_0x386d93;return _0xc1e23f;})[_0xc7fc('0x23')](respondWithFilteredResult(_0x11b0d9,_0xab1024))[_0xc7fc('0x43')](handleError(_0x11b0d9,null));}; \ No newline at end of file +var _0x5809=['sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','catch','eml-format','fast-json-patch','moment','bluebird','util','path','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','Migration','rawAttributes','type','key','model','map','query','filters','attributes','fields','nolimit'];(function(_0x2ecffa,_0x47caac){var _0x201e2d=function(_0x4f46c0){while(--_0x4f46c0){_0x2ecffa['push'](_0x2ecffa['shift']());}};_0x201e2d(++_0x47caac);}(_0x5809,0x145));var _0x9580=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5809[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x9580('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9580('0x1'));var rp=require('request-promise');var moment=require(_0x9580('0x2'));var BPromise=require(_0x9580('0x3'));var Mustache=require('mustache');var util=require(_0x9580('0x4'));var path=require(_0x9580('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9580('0x6'));var fs=require('fs');var fs_extra=require(_0x9580('0x7'));var _=require(_0x9580('0x8'));var squel=require(_0x9580('0x9'));var crypto=require(_0x9580('0xa'));var jsforce=require(_0x9580('0xb'));var deskjs=require(_0x9580('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9580('0xd'));var Papa=require(_0x9580('0xe'));var Redis=require(_0x9580('0xf'));var authService=require(_0x9580('0x10'));var qs=require(_0x9580('0x11'));var as=require(_0x9580('0x12'));var hardwareService=require(_0x9580('0x13'));var logger=require(_0x9580('0x14'))(_0x9580('0x15'));var utils=require(_0x9580('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9580('0x17'))['db'];function respondWithStatusCode(_0x1c76b7,_0x2847e6){_0x2847e6=_0x2847e6||0xcc;return function(_0x5e40b9){if(_0x5e40b9){return _0x1c76b7[_0x9580('0x18')](_0x2847e6);}return _0x1c76b7[_0x9580('0x19')](_0x2847e6)[_0x9580('0x1a')]();};}function respondWithResult(_0x35582f,_0x4f8857){_0x4f8857=_0x4f8857||0xc8;return function(_0x372097){if(_0x372097){return _0x35582f[_0x9580('0x19')](_0x4f8857)[_0x9580('0x1b')](_0x372097);}};}function respondWithFilteredResult(_0x8f318e,_0x1fecd2){return function(_0x168d28){if(_0x168d28){var _0x15cf75=typeof _0x1fecd2[_0x9580('0x1c')]===_0x9580('0x1d')&&typeof _0x1fecd2['limit']==='undefined';var _0x13bb7d=_0x168d28['count'];var _0x48b428=_0x15cf75?0x0:_0x1fecd2[_0x9580('0x1c')];var _0x539d61=_0x15cf75?_0x168d28[_0x9580('0x1e')]:_0x1fecd2[_0x9580('0x1c')]+_0x1fecd2[_0x9580('0x1f')];var _0xd82ff4;if(_0x539d61>=_0x13bb7d){_0x539d61=_0x13bb7d;_0xd82ff4=0xc8;}else{_0xd82ff4=0xce;}_0x8f318e[_0x9580('0x19')](_0xd82ff4);return _0x8f318e['set'](_0x9580('0x20'),_0x48b428+'-'+_0x539d61+'/'+_0x13bb7d)['json'](_0x168d28);}return null;};}function patchUpdates(_0x583544){return function(_0x50ca42){try{jsonpatch[_0x9580('0x21')](_0x50ca42,_0x583544,!![]);}catch(_0x1b3e84){return BPromise[_0x9580('0x22')](_0x1b3e84);}return _0x50ca42['save']();};}function saveUpdates(_0x380ad3,_0x44a09d){return function(_0x42e102){if(_0x42e102){return _0x42e102[_0x9580('0x23')](_0x380ad3)[_0x9580('0x24')](function(_0xb6f357){return _0xb6f357;});}return null;};}function removeEntity(_0xfbbe40,_0x4c05c2){return function(_0x3e1a27){if(_0x3e1a27){return _0x3e1a27[_0x9580('0x25')]()[_0x9580('0x24')](function(){_0xfbbe40[_0x9580('0x19')](0xcc)[_0x9580('0x1a')]();});}};}function handleEntityNotFound(_0x162c2e,_0x1a2696){return function(_0x248042){if(!_0x248042){_0x162c2e[_0x9580('0x18')](0x194);}return _0x248042;};}function handleError(_0x694600,_0x1c8fa){_0x1c8fa=_0x1c8fa||0x1f4;return function(_0xde68b9){logger[_0x9580('0x26')](_0xde68b9[_0x9580('0x27')]);if(_0xde68b9['name']){delete _0xde68b9['name'];}_0x694600['status'](_0x1c8fa)[_0x9580('0x28')](_0xde68b9);};}exports[_0x9580('0x29')]=function(_0x56198b,_0xb352b3){var _0x313ea0={},_0xa92109={},_0x452a04={'count':0x0,'rows':[]};var _0x196106=_['map'](db[_0x9580('0x2a')][_0x9580('0x2b')],function(_0x42a032){return{'name':_0x42a032['fieldName'],'type':_0x42a032[_0x9580('0x2c')][_0x9580('0x2d')]};});_0xa92109[_0x9580('0x2e')]=_[_0x9580('0x2f')](_0x196106,'name');_0xa92109['query']=_['keys'](_0x56198b[_0x9580('0x30')]);_0xa92109[_0x9580('0x31')]=_['intersection'](_0xa92109['model'],_0xa92109['query']);_0x313ea0[_0x9580('0x32')]=_['intersection'](_0xa92109[_0x9580('0x2e')],qs[_0x9580('0x33')](_0x56198b[_0x9580('0x30')][_0x9580('0x33')]));_0x313ea0['attributes']=_0x313ea0[_0x9580('0x32')]['length']?_0x313ea0[_0x9580('0x32')]:_0xa92109[_0x9580('0x2e')];if(!_0x56198b['query']['hasOwnProperty'](_0x9580('0x34'))){_0x313ea0['limit']=qs['limit'](_0x56198b[_0x9580('0x30')][_0x9580('0x1f')]);_0x313ea0[_0x9580('0x1c')]=qs[_0x9580('0x1c')](_0x56198b[_0x9580('0x30')]['offset']);}_0x313ea0['order']=qs[_0x9580('0x35')](_0x56198b['query'][_0x9580('0x35')]);_0x313ea0['where']=qs[_0x9580('0x31')](_[_0x9580('0x36')](_0x56198b[_0x9580('0x30')],_0xa92109['filters']),_0x196106);if(_0x56198b[_0x9580('0x30')]['filter']){_0x313ea0['where']=_['merge'](_0x313ea0[_0x9580('0x37')],{'$or':_['map'](_0x196106,function(_0x3c6036){if(_0x3c6036[_0x9580('0x2c')]!==_0x9580('0x38')){var _0x46cc1c={};_0x46cc1c[_0x3c6036['name']]={'$like':'%'+_0x56198b[_0x9580('0x30')][_0x9580('0x39')]+'%'};return _0x46cc1c;}})});}_0x313ea0=_[_0x9580('0x3a')]({},_0x313ea0,_0x56198b[_0x9580('0x3b')]);var _0xe89a95={'where':_0x313ea0[_0x9580('0x37')]};return db['Migration'][_0x9580('0x1e')](_0xe89a95)[_0x9580('0x24')](function(_0x102ccc){_0x452a04['count']=_0x102ccc;if(_0x56198b['query']['includeAll']){_0x313ea0[_0x9580('0x3c')]=[{'all':!![]}];}return db[_0x9580('0x2a')][_0x9580('0x3d')](_0x313ea0);})[_0x9580('0x24')](function(_0x5e9a07){_0x452a04['rows']=_0x5e9a07;return _0x452a04;})[_0x9580('0x24')](respondWithFilteredResult(_0xb352b3,_0x313ea0))[_0x9580('0x3e')](handleError(_0xb352b3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d95e774..0803817 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 _0x4621=['bluebird','path','rimraf','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x3dcaca,_0x4d8c05){var _0x321c44=function(_0x5f41ee){while(--_0x5f41ee){_0x3dcaca['push'](_0x3dcaca['shift']());}};_0x321c44(++_0x4d8c05);}(_0x4621,0x19e));var _0x1462=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4621[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x1462('0x0'));var util=require('util');var logger=require(_0x1462('0x1'))(_0x1462('0x2'));var moment=require(_0x1462('0x3'));var BPromise=require(_0x1462('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1462('0x5'));var rimraf=require(_0x1462('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x1462('0x7')]=function(_0x2b070c,_0xea7ef3){return _0x2b070c[_0x1462('0x8')](_0x1462('0x9'),attributes,{'tableName':_0x1462('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd01b=['request-promise','path','rimraf','./migration.attributes','define','migrations','lodash','../../config/logger','api','moment','bluebird'];(function(_0xc45596,_0x5c410e){var _0x425ffe=function(_0x3c327d){while(--_0x3c327d){_0xc45596['push'](_0xc45596['shift']());}};_0x425ffe(++_0x5c410e);}(_0xd01b,0x171));var _0xbd01=function(_0x1a6cab,_0x1a9921){_0x1a6cab=_0x1a6cab-0x0;var _0x11c832=_0xd01b[_0x1a6cab];return _0x11c832;};'use strict';var _=require(_0xbd01('0x0'));var util=require('util');var logger=require(_0xbd01('0x1'))(_0xbd01('0x2'));var moment=require(_0xbd01('0x3'));var BPromise=require(_0xbd01('0x4'));var rp=require(_0xbd01('0x5'));var fs=require('fs');var path=require(_0xbd01('0x6'));var rimraf=require(_0xbd01('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd01('0x8'));module['exports']=function(_0x3eb0f9,_0x451191){return _0x3eb0f9[_0xbd01('0x9')]('Migration',attributes,{'tableName':_0xbd01('0xa'),'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 9f73ab2..eeb12d9 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 _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x89cd77,_0x5bb9f8){var _0x480e51=function(_0x3d9bed){while(--_0x3d9bed){_0x89cd77['push'](_0x89cd77['shift']());}};_0x480e51(++_0x5bb9f8);}(_0x96cc,0x16c));var _0xc96c=function(_0xe5c531,_0x192403){_0xe5c531=_0xe5c531-0x0;var _0x16c383=_0x96cc[_0xe5c531];return _0x16c383;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('Migration,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('Migration,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file +var _0xfdb5=['util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x300d0e,_0x4fcd1b){var _0x1903cb=function(_0x1d4721){while(--_0x1d4721){_0x300d0e['push'](_0x300d0e['shift']());}};_0x1903cb(++_0x4fcd1b);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xfdb5[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x5fdb('0x0'));var util=require(_0x5fdb('0x1'));var moment=require(_0x5fdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fdb('0x3'));var fs=require('fs');var Redis=require(_0x5fdb('0x4'));var db=require(_0x5fdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fdb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fdb('0x7'));var client=jayson['client'][_0x5fdb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xda053e,_0x4b6fe0,_0x542bbc){return new BPromise(function(_0x5a556e,_0x340588){return client[_0x5fdb('0x9')](_0xda053e,_0x542bbc)[_0x5fdb('0xa')](function(_0x25cef8){logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));logger['debug'](_0x5fdb('0xe'),_0x4b6fe0,'request\x20sent',JSON[_0x5fdb('0xf')](_0x25cef8));if(_0x25cef8[_0x5fdb('0x10')]){if(_0x25cef8[_0x5fdb('0x10')]['code']===0x1f4){logger[_0x5fdb('0x10')]('Migration,\x20%s,\x20%s',_0x4b6fe0,_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);return _0x340588(_0x25cef8['error'][_0x5fdb('0x11')]);}logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x25cef8['error'][_0x5fdb('0x11')]);return _0x5a556e(_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);}else{logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));_0x5a556e(_0x25cef8['result']['message']);}})[_0x5fdb('0x12')](function(_0x5f1ddc){logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x5f1ddc);_0x340588(_0x5f1ddc);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 280a787..3d8e8ea 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 _0x9e54=['../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','/:id','show','post','update','delete','destroy','multer','util','Router','fs-extra'];(function(_0x53361f,_0x3b2cb6){var _0x279237=function(_0x317757){while(--_0x317757){_0x53361f['push'](_0x53361f['shift']());}};_0x279237(++_0x3b2cb6);}(_0x9e54,0x88));var _0x49e5=function(_0x3c7ec9,_0x5ae336){_0x3c7ec9=_0x3c7ec9-0x0;var _0x505422=_0x9e54[_0x3c7ec9];return _0x505422;};'use strict';var multer=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49e5('0x2')]();var fs_extra=require(_0x49e5('0x3'));var auth=require(_0x49e5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x49e5('0x5'));var controller=require(_0x49e5('0x6'));router['get']('/',auth[_0x49e5('0x7')](),controller['index']);router['get'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0x9')]);router[_0x49e5('0xa')]('/',auth[_0x49e5('0x7')](),controller['create']);router['put'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0xb')]);router[_0x49e5('0xc')](_0x49e5('0x8'),auth[_0x49e5('0x7')](),controller[_0x49e5('0xd')]);module['exports']=router; \ No newline at end of file +var _0xdafc=['post','create','put','update','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x45f453,_0x118ba3){var _0x430446=function(_0x58220f){while(--_0x58220f){_0x45f453['push'](_0x45f453['shift']());}};_0x430446(++_0x118ba3);}(_0xdafc,0x1a6));var _0xcdaf=function(_0xb723f2,_0x3e86f8){_0xb723f2=_0xb723f2-0x0;var _0x1e35a4=_0xdafc[_0xb723f2];return _0x1e35a4;};'use strict';var multer=require(_0xcdaf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcdaf('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcdaf('0x2'));var auth=require(_0xcdaf('0x3'));var interaction=require(_0xcdaf('0x4'));var config=require(_0xcdaf('0x5'));var controller=require('./network.controller');router[_0xcdaf('0x6')]('/',auth['isAuthenticated'](),controller[_0xcdaf('0x7')]);router[_0xcdaf('0x6')](_0xcdaf('0x8'),auth[_0xcdaf('0x9')](),controller['show']);router[_0xcdaf('0xa')]('/',auth['isAuthenticated'](),controller[_0xcdaf('0xb')]);router[_0xcdaf('0xc')](_0xcdaf('0x8'),auth[_0xcdaf('0x9')](),controller[_0xcdaf('0xd')]);router['delete'](_0xcdaf('0x8'),auth['isAuthenticated'](),controller[_0xcdaf('0xe')]);module[_0xcdaf('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ebd06c3..a8a9833 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 _0x6a0a=['sequelize','exports','ENUM','externip','stun','turn','STRING'];(function(_0x25e761,_0xe5c435){var _0x2740af=function(_0x30a342){while(--_0x30a342){_0x25e761['push'](_0x25e761['shift']());}};_0x2740af(++_0xe5c435);}(_0x6a0a,0x1dc));var _0xa6a0=function(_0xd29892,_0x2b67b9){_0xd29892=_0xd29892-0x0;var _0x293dfd=_0x6a0a[_0xd29892];return _0x293dfd;};'use strict';var Sequelize=require(_0xa6a0('0x0'));module[_0xa6a0('0x1')]={'type':{'type':Sequelize[_0xa6a0('0x2')]('localnet',_0xa6a0('0x3'),_0xa6a0('0x4'),_0xa6a0('0x5'))},'value':{'type':Sequelize[_0xa6a0('0x6')]},'username':{'type':Sequelize[_0xa6a0('0x6')]},'password':{'type':Sequelize[_0xa6a0('0x6')]}}; \ No newline at end of file +var _0xcc24=['STRING','sequelize','exports','ENUM','externip','stun'];(function(_0x4fc83d,_0x51d345){var _0x52c9f9=function(_0x36d4eb){while(--_0x36d4eb){_0x4fc83d['push'](_0x4fc83d['shift']());}};_0x52c9f9(++_0x51d345);}(_0xcc24,0x9d));var _0x4cc2=function(_0x3069b7,_0x3f58f2){_0x3069b7=_0x3069b7-0x0;var _0x2c6c9c=_0xcc24[_0x3069b7];return _0x2c6c9c;};'use strict';var Sequelize=require(_0x4cc2('0x0'));module[_0x4cc2('0x1')]={'type':{'type':Sequelize[_0x4cc2('0x2')]('localnet',_0x4cc2('0x3'),_0x4cc2('0x4'),'turn')},'value':{'type':Sequelize[_0x4cc2('0x5')]},'username':{'type':Sequelize[_0x4cc2('0x5')]},'password':{'type':Sequelize[_0x4cc2('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5d4ad9a..c5e6583 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 _0xa797=['intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','type','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','toLowerCase','TURN','ejs','../../components/parsers/qs','api','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','Network,\x20%s,\x20%s','message','error','status','json','offset','undefined','limit','count','set','destroy','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x31ca37,_0x2b814f){var _0x4300cd=function(_0x5a8d09){while(--_0x5a8d09){_0x31ca37['push'](_0x31ca37['shift']());}};_0x4300cd(++_0x2b814f);}(_0xa797,0xcf));var _0x7a79=function(_0x3f56af,_0x2fb687){_0x3f56af=_0x3f56af-0x0;var _0x21ef73=_0xa797[_0x3f56af];return _0x21ef73;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x7a79('0x0'));var fs=require('fs');var _=require('lodash');var qs=require(_0x7a79('0x1'));var logger=require('../../config/logger')(_0x7a79('0x2'));var config=require(_0x7a79('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7a79('0x4'));var client=jayson[_0x7a79('0x5')][_0x7a79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x429777,_0x295aff,_0x909390,_0x1c502a){return new Promise(function(_0x590ab3,_0x3575d5){var _0x36786e=_0x1c502a||client;return _0x36786e[_0x7a79('0x7')](_0x429777,_0x909390)[_0x7a79('0x8')](function(_0x4e0939){logger[_0x7a79('0x9')]('Network,\x20%s,\x20%s',_0x295aff,_0x7a79('0xa'));logger[_0x7a79('0xb')](_0x7a79('0xc'),_0x295aff,_0x7a79('0xa'),JSON[_0x7a79('0xd')](_0x4e0939));if(_0x4e0939['error']){if(_0x4e0939['error'][_0x7a79('0xe')]===0x1f4){logger['error'](_0x7a79('0xf'),_0x295aff,_0x4e0939['error'][_0x7a79('0x10')]);return _0x3575d5(_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);}logger[_0x7a79('0x11')](_0x7a79('0xf'),_0x295aff,_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);return _0x590ab3(_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);}else{logger[_0x7a79('0x9')](_0x7a79('0xf'),_0x295aff,_0x7a79('0xa'));_0x590ab3(_0x4e0939['result'][_0x7a79('0x10')]);}})['catch'](function(_0x4ce247){logger[_0x7a79('0x11')]('Network,\x20%s,\x20%s',_0x295aff,_0x4ce247);_0x3575d5(_0x4ce247);});});}function respondWithResult(_0x3b8c89,_0x5c3b11){_0x5c3b11=_0x5c3b11||0xc8;return function(_0x58d80a){if(_0x58d80a){return _0x3b8c89[_0x7a79('0x12')](_0x5c3b11)[_0x7a79('0x13')](_0x58d80a);}};}function respondWithFilteredResult(_0x44dcd7,_0x351112){return function(_0x35cf6d){if(_0x35cf6d){var _0x4c8eb2=typeof _0x351112[_0x7a79('0x14')]===_0x7a79('0x15')&&typeof _0x351112[_0x7a79('0x16')]===_0x7a79('0x15');var _0x206453=_0x35cf6d[_0x7a79('0x17')];var _0x43b38c=_0x4c8eb2?0x0:_0x351112[_0x7a79('0x14')];var _0x45793a=_0x4c8eb2?_0x35cf6d['count']:_0x351112[_0x7a79('0x14')]+_0x351112['limit'];var _0x351df5;if(_0x45793a>=_0x206453){_0x45793a=_0x206453;_0x351df5=0xc8;}else{_0x351df5=0xce;}_0x44dcd7[_0x7a79('0x12')](_0x351df5);return _0x44dcd7[_0x7a79('0x18')]('Content-Range',_0x43b38c+'-'+_0x45793a+'/'+_0x206453)['json'](_0x35cf6d);}return null;};}function saveUpdates(_0x3e4f93){return function(_0x420196){if(_0x420196){return _0x420196['update'](_0x3e4f93)[_0x7a79('0x8')](function(_0x118329){return _0x118329;});}return null;};}function removeEntity(_0x1a5f49){return function(_0x45c456){if(_0x45c456){return _0x45c456[_0x7a79('0x19')]()['then'](function(){_0x1a5f49[_0x7a79('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207556){return function(_0x2a8182){if(!_0x2a8182){_0x207556[_0x7a79('0x1a')](0x194);}return _0x2a8182;};}function handleError(_0x3814f8,_0x33045c){_0x33045c=_0x33045c||0x1f4;return function(_0x2d9b3b){logger['error'](_0x2d9b3b['stack']);if(_0x2d9b3b[_0x7a79('0x1b')]){delete _0x2d9b3b[_0x7a79('0x1b')];}_0x3814f8['status'](_0x33045c)[_0x7a79('0x1c')](_0x2d9b3b);};}exports[_0x7a79('0x1d')]=function(_0x4f92d7,_0x45080b){var _0x1447bf={},_0x5401f2={},_0x1c2451={'count':0x0,'rows':[]};var _0x55f02f=_[_0x7a79('0x1e')](db[_0x7a79('0x1f')][_0x7a79('0x20')],function(_0x6c02de){return{'name':_0x6c02de[_0x7a79('0x21')],'type':_0x6c02de['type'][_0x7a79('0x22')]};});_0x5401f2[_0x7a79('0x23')]=_[_0x7a79('0x1e')](_0x55f02f,_0x7a79('0x1b'));_0x5401f2['query']=_[_0x7a79('0x24')](_0x4f92d7[_0x7a79('0x25')]);_0x5401f2[_0x7a79('0x26')]=_[_0x7a79('0x27')](_0x5401f2[_0x7a79('0x23')],_0x5401f2[_0x7a79('0x25')]);_0x1447bf[_0x7a79('0x28')]=_[_0x7a79('0x27')](_0x5401f2[_0x7a79('0x23')],qs[_0x7a79('0x29')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x29')]));_0x1447bf[_0x7a79('0x28')]=_0x1447bf[_0x7a79('0x28')][_0x7a79('0x2a')]?_0x1447bf[_0x7a79('0x28')]:_0x5401f2[_0x7a79('0x23')];if(!_0x4f92d7['query'][_0x7a79('0x2b')]('nolimit')){_0x1447bf[_0x7a79('0x16')]=qs[_0x7a79('0x16')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x16')]);_0x1447bf[_0x7a79('0x14')]=qs[_0x7a79('0x14')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x14')]);}_0x1447bf['order']=qs[_0x7a79('0x2c')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x2c')]);_0x1447bf['where']=qs[_0x7a79('0x26')](_[_0x7a79('0x2d')](_0x4f92d7[_0x7a79('0x25')],_0x5401f2['filters']),_0x55f02f);if(_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x2e')]){_0x1447bf[_0x7a79('0x2f')]=_[_0x7a79('0x30')](_0x1447bf['where'],{'$or':_['map'](_0x55f02f,function(_0x64b469){if(_0x64b469['type']!==_0x7a79('0x31')){var _0xf2115f={};_0xf2115f[_0x64b469['name']]={'$like':'%'+_0x4f92d7['query']['filter']+'%'};return _0xf2115f;}})});}_0x1447bf=_['merge']({},_0x1447bf,_0x4f92d7[_0x7a79('0x32')]);var _0xbcb8a3={'where':_0x1447bf[_0x7a79('0x2f')]};return db[_0x7a79('0x1f')]['count'](_0xbcb8a3)[_0x7a79('0x8')](function(_0x4c6e56){_0x1c2451[_0x7a79('0x17')]=_0x4c6e56;if(_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x33')]){_0x1447bf[_0x7a79('0x34')]=[{'all':!![]}];}return db[_0x7a79('0x1f')][_0x7a79('0x35')](_0x1447bf);})[_0x7a79('0x8')](function(_0x4b4389){_0x1c2451[_0x7a79('0x36')]=_0x4b4389;return _0x1c2451;})[_0x7a79('0x8')](respondWithFilteredResult(_0x45080b,_0x1447bf))[_0x7a79('0x37')](handleError(_0x45080b,null));};exports['show']=function(_0xbf80c7,_0x3c208e){var _0x256b6e={'raw':!![],'where':{'id':_0xbf80c7[_0x7a79('0x38')]['id']}},_0x3ef9e5={};_0x3ef9e5[_0x7a79('0x23')]=_[_0x7a79('0x24')](db[_0x7a79('0x1f')][_0x7a79('0x20')]);_0x3ef9e5[_0x7a79('0x25')]=_[_0x7a79('0x24')](_0xbf80c7['query']);_0x3ef9e5[_0x7a79('0x26')]=_['intersection'](_0x3ef9e5['model'],_0x3ef9e5[_0x7a79('0x25')]);_0x256b6e[_0x7a79('0x28')]=_[_0x7a79('0x27')](_0x3ef9e5[_0x7a79('0x23')],qs[_0x7a79('0x29')](_0xbf80c7[_0x7a79('0x25')][_0x7a79('0x29')]));_0x256b6e[_0x7a79('0x28')]=_0x256b6e[_0x7a79('0x28')]['length']?_0x256b6e['attributes']:_0x3ef9e5['model'];if(_0xbf80c7['query']['includeAll']){_0x256b6e[_0x7a79('0x34')]=[{'all':!![]}];}_0x256b6e=_[_0x7a79('0x30')]({},_0x256b6e,_0xbf80c7[_0x7a79('0x32')]);return db[_0x7a79('0x1f')][_0x7a79('0x39')](_0x256b6e)[_0x7a79('0x8')](handleEntityNotFound(_0x3c208e,null))[_0x7a79('0x8')](respondWithResult(_0x3c208e,null))[_0x7a79('0x37')](handleError(_0x3c208e,null));};exports[_0x7a79('0x3a')]=function(_0x106387,_0x57be9){var _0x16b462;return db['Network'][_0x7a79('0x3a')](_0x106387[_0x7a79('0x3b')],{'raw':!![]})[_0x7a79('0x8')](function(_0x2a5513){_0x16b462=_0x2a5513;return db[_0x7a79('0x1f')][_0x7a79('0x35')]({'where':{'type':_0x106387[_0x7a79('0x3b')][_0x7a79('0x3c')]},'raw':!![]});})[_0x7a79('0x8')](function(_0x359631){if(_0x16b462[_0x7a79('0x3c')][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x2d1bcc=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x42')),_0x7a79('0x43'));var _0x5004f4=ejs[_0x7a79('0x44')](_0x2d1bcc,{'networks':_0x359631||[]});fs[_0x7a79('0x45')](_0x7a79('0x46'),_0x5004f4);return respondWithRpcPromise('Reload',_0x7a79('0x3a'),{'module':_0x7a79('0x47')});}else if(_0x16b462[_0x7a79('0x3c')]['toUpperCase']()=='TURN'){var _0x1bc2ad=fs['readFileSync'](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x48')),_0x7a79('0x43'));var _0x477ace=ejs['render'](_0x1bc2ad,{'networks':_0x359631||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x477ace);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x3a'),{'module':_0x7a79('0x47')});}else{var _0x5c6730=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x4b')),_0x7a79('0x43'));var _0x5e3137=ejs[_0x7a79('0x44')](_0x5c6730,{'networks':_0x359631||[]});fs['writeFileSync'](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x106387['body'][_0x7a79('0x3c')]['toLowerCase']()),_0x5e3137);return respondWithRpcPromise(_0x7a79('0x4a'),'create',{'module':_0x7a79('0x4e')});}})[_0x7a79('0x8')](function(){return _0x16b462;})[_0x7a79('0x8')](respondWithResult(_0x57be9,0xc9))[_0x7a79('0x37')](handleError(_0x57be9,null));};exports[_0x7a79('0x4f')]=function(_0x4aa38c,_0x212e78){var _0xd48a4b;return db[_0x7a79('0x1f')]['find']({'where':{'id':_0x4aa38c[_0x7a79('0x38')]['id']}})['then'](handleEntityNotFound(_0x212e78,null))['then'](saveUpdates(_0x4aa38c[_0x7a79('0x3b')],null))[_0x7a79('0x8')](function(_0x35a059){if(_0x35a059){_0xd48a4b=_0x35a059;return db[_0x7a79('0x1f')]['findAll']({'where':{'type':_0xd48a4b[_0x7a79('0x3c')]},'raw':!![]});}return null;})[_0x7a79('0x8')](function(_0x333d91){if(_0xd48a4b[_0x7a79('0x3c')][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x46da4d=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x42')),_0x7a79('0x43'));var _0x4f66d2=ejs['render'](_0x46da4d,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](_0x7a79('0x46'),_0x4f66d2);return respondWithRpcPromise(_0x7a79('0x4a'),'update',{'module':_0x7a79('0x47')});}else if(_0xd48a4b[_0x7a79('0x3c')][_0x7a79('0x3d')]()=='TURN'){var _0x32ea66=fs[_0x7a79('0x3f')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x7a79('0x43'));var _0x2fc142=ejs['render'](_0x32ea66,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x2fc142);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x4f'),{'module':_0x7a79('0x47')});}else{var _0x35d9bd=fs[_0x7a79('0x3f')](path['join'](config['root'],_0x7a79('0x4b')),_0x7a79('0x43'));var _0xba5379=ejs[_0x7a79('0x44')](_0x35d9bd,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x4aa38c[_0x7a79('0x3b')]['type'][_0x7a79('0x50')]()),_0xba5379);return respondWithRpcPromise(_0x7a79('0x4a'),'update',{'module':_0x7a79('0x4e')});}})[_0x7a79('0x8')](function(_0x517296){if(_0x517296){return _0xd48a4b;}return null;})[_0x7a79('0x8')](respondWithResult(_0x212e78,null))[_0x7a79('0x37')](handleError(_0x212e78,null));};exports['destroy']=function(_0x39751f,_0x14d480){var _0x414997;return db[_0x7a79('0x1f')][_0x7a79('0x39')]({'where':{'id':_0x39751f[_0x7a79('0x38')]['id']}})[_0x7a79('0x8')](function(_0x384501){_0x414997=_0x384501;return _0x384501;})[_0x7a79('0x8')](handleEntityNotFound(_0x14d480,null))[_0x7a79('0x8')](removeEntity(_0x14d480,null))['then'](function(){if(_0x414997){return db[_0x7a79('0x1f')][_0x7a79('0x35')]({'where':{'type':_0x414997['type']},'raw':!![]});}})['then'](function(_0x30fc1a){if(_0x414997['type'][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x5a5426=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x42')),_0x7a79('0x43'));var _0x58c6ed=ejs['render'](_0x5a5426,{'networks':_0x30fc1a||[]});fs['writeFileSync'](_0x7a79('0x46'),_0x58c6ed);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x19'),{'module':_0x7a79('0x47')});}else if(_0x414997['type'][_0x7a79('0x3d')]()==_0x7a79('0x51')){var _0xc22031=fs['readFileSync'](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x48')),_0x7a79('0x43'));var _0x23c9d8=ejs['render'](_0xc22031,{'networks':_0x30fc1a||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x23c9d8);return respondWithRpcPromise('Reload',_0x7a79('0x19'),{'module':_0x7a79('0x47')});}else{var _0x2e986b=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config[_0x7a79('0x41')],'server/files/templates/network.ejs'),_0x7a79('0x43'));var _0xb88ffb=ejs[_0x7a79('0x44')](_0x2e986b,{'networks':_0x30fc1a||[]});fs[_0x7a79('0x45')](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x414997[_0x7a79('0x3c')][_0x7a79('0x50')]()),_0xb88ffb);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x19'),{'module':_0x7a79('0x4e')});}})[_0x7a79('0x37')](handleError(_0x14d480,null));}; \ No newline at end of file +var _0x5cd9=['body','type','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','find','utf8','server/files/templates/network.ejs','toLowerCase','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','query','keys','model','fields','attributes','nolimit','sort','filters','pick','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Network','intersection','length','create'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x5cd9,0x1c5));var _0x95cd=function(_0x3c0e15,_0x395438){_0x3c0e15=_0x3c0e15-0x0;var _0x4ac7ff=_0x5cd9[_0x3c0e15];return _0x4ac7ff;};'use strict';var util=require(_0x95cd('0x0'));var path=require(_0x95cd('0x1'));var ejs=require(_0x95cd('0x2'));var fs=require('fs');var _=require(_0x95cd('0x3'));var qs=require(_0x95cd('0x4'));var logger=require(_0x95cd('0x5'))(_0x95cd('0x6'));var config=require(_0x95cd('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0x95cd('0x8'));var client=jayson[_0x95cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec564,_0x43ec93,_0x5e4d3e,_0x5963e1){return new Promise(function(_0x5eb7b5,_0x4f6d74){var _0x2222f1=_0x5963e1||client;return _0x2222f1[_0x95cd('0xa')](_0x5ec564,_0x5e4d3e)[_0x95cd('0xb')](function(_0x422cfe){logger[_0x95cd('0xc')](_0x95cd('0xd'),_0x43ec93,_0x95cd('0xe'));logger[_0x95cd('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x43ec93,_0x95cd('0xe'),JSON['stringify'](_0x422cfe));if(_0x422cfe[_0x95cd('0x10')]){if(_0x422cfe['error'][_0x95cd('0x11')]===0x1f4){logger[_0x95cd('0x10')]('Network,\x20%s,\x20%s',_0x43ec93,_0x422cfe[_0x95cd('0x10')][_0x95cd('0x12')]);return _0x4f6d74(_0x422cfe[_0x95cd('0x10')]['message']);}logger[_0x95cd('0x10')]('Network,\x20%s,\x20%s',_0x43ec93,_0x422cfe['error'][_0x95cd('0x12')]);return _0x5eb7b5(_0x422cfe[_0x95cd('0x10')][_0x95cd('0x12')]);}else{logger['info'](_0x95cd('0xd'),_0x43ec93,'request\x20sent');_0x5eb7b5(_0x422cfe[_0x95cd('0x13')]['message']);}})[_0x95cd('0x14')](function(_0x6b5e94){logger[_0x95cd('0x10')](_0x95cd('0xd'),_0x43ec93,_0x6b5e94);_0x4f6d74(_0x6b5e94);});});}function respondWithResult(_0x80ba35,_0x5e3f43){_0x5e3f43=_0x5e3f43||0xc8;return function(_0xcac53b){if(_0xcac53b){return _0x80ba35[_0x95cd('0x15')](_0x5e3f43)[_0x95cd('0x16')](_0xcac53b);}};}function respondWithFilteredResult(_0x2b3f91,_0x3e80f5){return function(_0x211448){if(_0x211448){var _0xf86e05=typeof _0x3e80f5[_0x95cd('0x17')]===_0x95cd('0x18')&&typeof _0x3e80f5[_0x95cd('0x19')]==='undefined';var _0x5f3c37=_0x211448[_0x95cd('0x1a')];var _0x1821fe=_0xf86e05?0x0:_0x3e80f5[_0x95cd('0x17')];var _0x53c33a=_0xf86e05?_0x211448[_0x95cd('0x1a')]:_0x3e80f5[_0x95cd('0x17')]+_0x3e80f5[_0x95cd('0x19')];var _0xbf6dc9;if(_0x53c33a>=_0x5f3c37){_0x53c33a=_0x5f3c37;_0xbf6dc9=0xc8;}else{_0xbf6dc9=0xce;}_0x2b3f91[_0x95cd('0x15')](_0xbf6dc9);return _0x2b3f91[_0x95cd('0x1b')](_0x95cd('0x1c'),_0x1821fe+'-'+_0x53c33a+'/'+_0x5f3c37)[_0x95cd('0x16')](_0x211448);}return null;};}function saveUpdates(_0x2a33a6){return function(_0x40d723){if(_0x40d723){return _0x40d723[_0x95cd('0x1d')](_0x2a33a6)[_0x95cd('0xb')](function(_0x126492){return _0x126492;});}return null;};}function removeEntity(_0xe06d42){return function(_0x5e106c){if(_0x5e106c){return _0x5e106c[_0x95cd('0x1e')]()[_0x95cd('0xb')](function(){_0xe06d42[_0x95cd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2c95){return function(_0xd8ea6e){if(!_0xd8ea6e){_0x1e2c95[_0x95cd('0x1f')](0x194);}return _0xd8ea6e;};}function handleError(_0x94877,_0x432e25){_0x432e25=_0x432e25||0x1f4;return function(_0x5873c6){logger[_0x95cd('0x10')](_0x5873c6[_0x95cd('0x20')]);if(_0x5873c6[_0x95cd('0x21')]){delete _0x5873c6[_0x95cd('0x21')];}_0x94877['status'](_0x432e25)[_0x95cd('0x22')](_0x5873c6);};}exports[_0x95cd('0x23')]=function(_0x428941,_0xb7b614){var _0x1a5a1a={},_0x5958d3={},_0x173577={'count':0x0,'rows':[]};var _0x4899ab=_['map'](db['Network'][_0x95cd('0x24')],function(_0xea9dd0){return{'name':_0xea9dd0[_0x95cd('0x25')],'type':_0xea9dd0['type'][_0x95cd('0x26')]};});_0x5958d3['model']=_['map'](_0x4899ab,_0x95cd('0x21'));_0x5958d3[_0x95cd('0x27')]=_[_0x95cd('0x28')](_0x428941[_0x95cd('0x27')]);_0x5958d3['filters']=_['intersection'](_0x5958d3[_0x95cd('0x29')],_0x5958d3[_0x95cd('0x27')]);_0x1a5a1a['attributes']=_['intersection'](_0x5958d3[_0x95cd('0x29')],qs[_0x95cd('0x2a')](_0x428941[_0x95cd('0x27')]['fields']));_0x1a5a1a[_0x95cd('0x2b')]=_0x1a5a1a[_0x95cd('0x2b')]['length']?_0x1a5a1a[_0x95cd('0x2b')]:_0x5958d3[_0x95cd('0x29')];if(!_0x428941['query']['hasOwnProperty'](_0x95cd('0x2c'))){_0x1a5a1a[_0x95cd('0x19')]=qs[_0x95cd('0x19')](_0x428941[_0x95cd('0x27')][_0x95cd('0x19')]);_0x1a5a1a[_0x95cd('0x17')]=qs[_0x95cd('0x17')](_0x428941[_0x95cd('0x27')][_0x95cd('0x17')]);}_0x1a5a1a['order']=qs[_0x95cd('0x2d')](_0x428941['query'][_0x95cd('0x2d')]);_0x1a5a1a['where']=qs[_0x95cd('0x2e')](_[_0x95cd('0x2f')](_0x428941[_0x95cd('0x27')],_0x5958d3[_0x95cd('0x2e')]),_0x4899ab);if(_0x428941[_0x95cd('0x27')]['filter']){_0x1a5a1a[_0x95cd('0x30')]=_[_0x95cd('0x31')](_0x1a5a1a[_0x95cd('0x30')],{'$or':_[_0x95cd('0x32')](_0x4899ab,function(_0x4fb041){if(_0x4fb041['type']!==_0x95cd('0x33')){var _0x3970e9={};_0x3970e9[_0x4fb041[_0x95cd('0x21')]]={'$like':'%'+_0x428941[_0x95cd('0x27')]['filter']+'%'};return _0x3970e9;}})});}_0x1a5a1a=_[_0x95cd('0x31')]({},_0x1a5a1a,_0x428941[_0x95cd('0x34')]);var _0x1a7323={'where':_0x1a5a1a[_0x95cd('0x30')]};return db['Network'][_0x95cd('0x1a')](_0x1a7323)[_0x95cd('0xb')](function(_0x3338ef){_0x173577['count']=_0x3338ef;if(_0x428941[_0x95cd('0x27')][_0x95cd('0x35')]){_0x1a5a1a[_0x95cd('0x36')]=[{'all':!![]}];}return db['Network'][_0x95cd('0x37')](_0x1a5a1a);})[_0x95cd('0xb')](function(_0x6b41a7){_0x173577[_0x95cd('0x38')]=_0x6b41a7;return _0x173577;})[_0x95cd('0xb')](respondWithFilteredResult(_0xb7b614,_0x1a5a1a))[_0x95cd('0x14')](handleError(_0xb7b614,null));};exports[_0x95cd('0x39')]=function(_0x430761,_0x3be11d){var _0x34660f={'raw':!![],'where':{'id':_0x430761[_0x95cd('0x3a')]['id']}},_0x39f46e={};_0x39f46e['model']=_[_0x95cd('0x28')](db[_0x95cd('0x3b')][_0x95cd('0x24')]);_0x39f46e[_0x95cd('0x27')]=_['keys'](_0x430761[_0x95cd('0x27')]);_0x39f46e[_0x95cd('0x2e')]=_[_0x95cd('0x3c')](_0x39f46e[_0x95cd('0x29')],_0x39f46e['query']);_0x34660f['attributes']=_[_0x95cd('0x3c')](_0x39f46e[_0x95cd('0x29')],qs[_0x95cd('0x2a')](_0x430761[_0x95cd('0x27')][_0x95cd('0x2a')]));_0x34660f[_0x95cd('0x2b')]=_0x34660f[_0x95cd('0x2b')][_0x95cd('0x3d')]?_0x34660f[_0x95cd('0x2b')]:_0x39f46e[_0x95cd('0x29')];if(_0x430761[_0x95cd('0x27')][_0x95cd('0x35')]){_0x34660f[_0x95cd('0x36')]=[{'all':!![]}];}_0x34660f=_[_0x95cd('0x31')]({},_0x34660f,_0x430761[_0x95cd('0x34')]);return db[_0x95cd('0x3b')]['find'](_0x34660f)['then'](handleEntityNotFound(_0x3be11d,null))[_0x95cd('0xb')](respondWithResult(_0x3be11d,null))[_0x95cd('0x14')](handleError(_0x3be11d,null));};exports['create']=function(_0x43685f,_0x3862f7){var _0x11e07c;return db[_0x95cd('0x3b')][_0x95cd('0x3e')](_0x43685f[_0x95cd('0x3f')],{'raw':!![]})[_0x95cd('0xb')](function(_0x14dccd){_0x11e07c=_0x14dccd;return db['Network'][_0x95cd('0x37')]({'where':{'type':_0x43685f[_0x95cd('0x3f')][_0x95cd('0x40')]},'raw':!![]});})[_0x95cd('0xb')](function(_0x1dd1cf){if(_0x11e07c[_0x95cd('0x40')]['toUpperCase']()==_0x95cd('0x41')){var _0x5d2ab4=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config['root'],_0x95cd('0x44')),'utf8');var _0x5b143c=ejs['render'](_0x5d2ab4,{'networks':_0x1dd1cf||[]});fs[_0x95cd('0x45')](_0x95cd('0x46'),_0x5b143c);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x11e07c[_0x95cd('0x40')][_0x95cd('0x48')]()==_0x95cd('0x49')){var _0x51ab92=fs['readFileSync'](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],_0x95cd('0x4b')),'utf8');var _0x1a997c=ejs[_0x95cd('0x4c')](_0x51ab92,{'networks':_0x1dd1cf||[]});fs[_0x95cd('0x45')](_0x95cd('0x4d'),_0x1a997c);return respondWithRpcPromise(_0x95cd('0x47'),'create',{'module':_0x95cd('0x4e')});}else{var _0x479340=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],'server/files/templates/network.ejs'),'utf8');var _0x54918b=ejs[_0x95cd('0x4c')](_0x479340,{'networks':_0x1dd1cf||[]});fs['writeFileSync'](util[_0x95cd('0x4f')](_0x95cd('0x50'),_0x43685f[_0x95cd('0x3f')][_0x95cd('0x40')]['toLowerCase']()),_0x54918b);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x3e'),{'module':'chan_sip.so'});}})[_0x95cd('0xb')](function(){return _0x11e07c;})[_0x95cd('0xb')](respondWithResult(_0x3862f7,0xc9))[_0x95cd('0x14')](handleError(_0x3862f7,null));};exports['update']=function(_0x5a4d98,_0x276ae7){var _0xa1e4a7;return db['Network'][_0x95cd('0x51')]({'where':{'id':_0x5a4d98[_0x95cd('0x3a')]['id']}})[_0x95cd('0xb')](handleEntityNotFound(_0x276ae7,null))[_0x95cd('0xb')](saveUpdates(_0x5a4d98[_0x95cd('0x3f')],null))['then'](function(_0x57d707){if(_0x57d707){_0xa1e4a7=_0x57d707;return db['Network'][_0x95cd('0x37')]({'where':{'type':_0xa1e4a7[_0x95cd('0x40')]},'raw':!![]});}return null;})[_0x95cd('0xb')](function(_0x3d097a){if(_0xa1e4a7['type'][_0x95cd('0x48')]()==_0x95cd('0x41')){var _0x51bb35=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],_0x95cd('0x44')),_0x95cd('0x52'));var _0x399833=ejs[_0x95cd('0x4c')](_0x51bb35,{'networks':_0x3d097a||[]});fs[_0x95cd('0x45')]('/etc/asterisk/stun_xcally.conf',_0x399833);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x1d'),{'module':_0x95cd('0x4e')});}else if(_0xa1e4a7[_0x95cd('0x40')][_0x95cd('0x48')]()=='TURN'){var _0x4df2c1=fs['readFileSync'](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],'server/files/templates/turn_multiple.ejs'),_0x95cd('0x52'));var _0x430db1=ejs['render'](_0x4df2c1,{'networks':_0x3d097a||[]});fs[_0x95cd('0x45')]('/etc/asterisk/turn_xcally.conf',_0x430db1);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x390765=fs[_0x95cd('0x42')](path['join'](config[_0x95cd('0x4a')],_0x95cd('0x53')),_0x95cd('0x52'));var _0x28c05e=ejs[_0x95cd('0x4c')](_0x390765,{'networks':_0x3d097a||[]});fs[_0x95cd('0x45')](util[_0x95cd('0x4f')](_0x95cd('0x50'),_0x5a4d98[_0x95cd('0x3f')][_0x95cd('0x40')][_0x95cd('0x54')]()),_0x28c05e);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x1d'),{'module':_0x95cd('0x55')});}})[_0x95cd('0xb')](function(_0x511ebd){if(_0x511ebd){return _0xa1e4a7;}return null;})[_0x95cd('0xb')](respondWithResult(_0x276ae7,null))['catch'](handleError(_0x276ae7,null));};exports[_0x95cd('0x1e')]=function(_0x17d0ef,_0x6d1a86){var _0x191e13;return db['Network'][_0x95cd('0x51')]({'where':{'id':_0x17d0ef[_0x95cd('0x3a')]['id']}})['then'](function(_0x3d4c53){_0x191e13=_0x3d4c53;return _0x3d4c53;})[_0x95cd('0xb')](handleEntityNotFound(_0x6d1a86,null))[_0x95cd('0xb')](removeEntity(_0x6d1a86,null))['then'](function(){if(_0x191e13){return db[_0x95cd('0x3b')][_0x95cd('0x37')]({'where':{'type':_0x191e13['type']},'raw':!![]});}})[_0x95cd('0xb')](function(_0x59bd53){if(_0x191e13[_0x95cd('0x40')][_0x95cd('0x48')]()==_0x95cd('0x41')){var _0x3a85e3=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],_0x95cd('0x44')),_0x95cd('0x52'));var _0x4c2d43=ejs['render'](_0x3a85e3,{'networks':_0x59bd53||[]});fs[_0x95cd('0x45')](_0x95cd('0x46'),_0x4c2d43);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x1e'),{'module':_0x95cd('0x4e')});}else if(_0x191e13[_0x95cd('0x40')]['toUpperCase']()==_0x95cd('0x49')){var _0x22d8e4=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],_0x95cd('0x4b')),_0x95cd('0x52'));var _0x27417c=ejs['render'](_0x22d8e4,{'networks':_0x59bd53||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x27417c);return respondWithRpcPromise(_0x95cd('0x47'),_0x95cd('0x1e'),{'module':_0x95cd('0x4e')});}else{var _0x51d22b=fs[_0x95cd('0x42')](path[_0x95cd('0x43')](config[_0x95cd('0x4a')],_0x95cd('0x53')),_0x95cd('0x52'));var _0x224929=ejs[_0x95cd('0x4c')](_0x51d22b,{'networks':_0x59bd53||[]});fs['writeFileSync'](util[_0x95cd('0x4f')](_0x95cd('0x50'),_0x191e13[_0x95cd('0x40')][_0x95cd('0x54')]()),_0x224929);return respondWithRpcPromise('Reload',_0x95cd('0x1e'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x6d1a86,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f24cb45..a6bba52 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 _0x4876=['../../config/environment','./network.attributes','Network','network','../../config/logger','bluebird','path','rimraf'];(function(_0x2d5a91,_0x28c170){var _0x5a1918=function(_0x537090){while(--_0x537090){_0x2d5a91['push'](_0x2d5a91['shift']());}};_0x5a1918(++_0x28c170);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5712=['bluebird','request-promise','path','rimraf','../../config/environment','define','Network','network','lodash','util','../../config/logger','api','moment'];(function(_0x413bcf,_0x15207b){var _0x47a0bf=function(_0xb42dff){while(--_0xb42dff){_0x413bcf['push'](_0x413bcf['shift']());}};_0x47a0bf(++_0x15207b);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var logger=require(_0x2571('0x2'))(_0x2571('0x3'));var moment=require(_0x2571('0x4'));var BPromise=require(_0x2571('0x5'));var rp=require(_0x2571('0x6'));var fs=require('fs');var path=require(_0x2571('0x7'));var rimraf=require(_0x2571('0x8'));var config=require(_0x2571('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x4713ad,_0x50fc72){return _0x4713ad[_0x2571('0xa')](_0x2571('0xb'),attributes,{'tableName':_0x2571('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 29f9e5d..f093281 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0xe2f253,_0x53651c){_0xe2f253=_0xe2f253-0x0;var _0x4a9aaa=_0x7a54[_0xe2f253];return _0x4a9aaa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x31aa7e,_0x1097df){var _0x2aba22=function(_0xd3bf3d){while(--_0xd3bf3d){_0x31aa7e['push'](_0x31aa7e['shift']());}};_0x2aba22(++_0x1097df);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d85a149..94ff5ca 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 _0xd824=['addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','/:id','get','/:id/dispositions','getAnswers','getApplications','/:id/interactions','/:id/users','post','create','addDisposition','/:id/canned_answers'];(function(_0x32a22d,_0x17b134){var _0x302d10=function(_0x2d6e33){while(--_0x2d6e33){_0x32a22d['push'](_0x32a22d['shift']());}};_0x302d10(++_0x17b134);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d82('0x2'));var router=express[_0x4d82('0x3')]();var fs_extra=require(_0x4d82('0x4'));var auth=require(_0x4d82('0x5'));var interaction=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x4d82('0x8')](),controller['index']);router['get'](_0x4d82('0x9'),auth[_0x4d82('0x8')](),controller[_0x4d82('0xa')]);router['get'](_0x4d82('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4d82('0xc')](_0x4d82('0xd'),auth[_0x4d82('0x8')](),controller['getDispositions']);router[_0x4d82('0xc')]('/:id/canned_answers',auth[_0x4d82('0x8')](),controller[_0x4d82('0xe')]);router[_0x4d82('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4d82('0xf')]);router[_0x4d82('0xc')](_0x4d82('0x10'),auth[_0x4d82('0x8')](),controller['getInteractions']);router[_0x4d82('0xc')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller['getAgents']);router[_0x4d82('0x12')]('/',auth['isAuthenticated'](),controller[_0x4d82('0x13')]);router['post'](_0x4d82('0xd'),auth['isAuthenticated'](),controller[_0x4d82('0x14')]);router[_0x4d82('0x12')](_0x4d82('0x15'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x16')]);router[_0x4d82('0x12')](_0x4d82('0x17'),controller[_0x4d82('0x18')]);router[_0x4d82('0x12')]('/:id/applications',auth[_0x4d82('0x8')](),controller[_0x4d82('0x19')]);router[_0x4d82('0x12')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1a')]);router[_0x4d82('0x12')](_0x4d82('0x1b'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1c')]);router[_0x4d82('0x1d')]('/:id',auth[_0x4d82('0x8')](),controller[_0x4d82('0x1e')]);router['delete'](_0x4d82('0xb'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1f')]);router[_0x4d82('0x20')](_0x4d82('0xd'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x21')]);router[_0x4d82('0x20')](_0x4d82('0x15'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x22')]);router[_0x4d82('0x20')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x23')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['getDispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','removeDispositions','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions'];(function(_0x57005a,_0x181d36){var _0x111620=function(_0x41bc80){while(--_0x41bc80){_0x57005a['push'](_0x57005a['shift']());}};_0x111620(++_0x181d36);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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('./openchannelAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x7')](_0x65f6('0x12'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x14')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x15')]);router['post'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x65f6('0x14')](_0x65f6('0x16'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router[_0x65f6('0x14')](_0x65f6('0x18'),controller[_0x65f6('0x19')]);router[_0x65f6('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0x65f6('0x1a')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x14')]('/:id/send',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1c')]);router[_0x65f6('0x1d')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1e')]);router['delete'](_0x65f6('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x65f6('0x1f')](_0x65f6('0xc'),auth['isAuthenticated'](),controller[_0x65f6('0x20')]);router[_0x65f6('0x1f')](_0x65f6('0x16'),auth[_0x65f6('0x8')](),controller['removeAnswers']);router[_0x65f6('0x1f')](_0x65f6('0x12'),auth[_0x65f6('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ee78d13..cfc99e6 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 _0x7d3e=['STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0x7d3e,0x1b5));var _0xe7d3=function(_0x3cc7e2,_0x525b5f){_0x3cc7e2=_0x3cc7e2-0x0;var _0x1b0f21=_0x7d3e[_0x3cc7e2];return _0x1b0f21;};'use strict';var Sequelize=require(_0xe7d3('0x0'));var rs=require(_0xe7d3('0x1'));module[_0xe7d3('0x2')]={'name':{'type':Sequelize[_0xe7d3('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe7d3('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe7d3('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe7d3('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe7d3('0x4')],'defaultValue':function(){return _0xe7d3('0x5');}},'notificationSound':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe7d3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe7d3('0x3')]},'queueTransfer':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe7d3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe7d3('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa942aa){if(!_0xa942aa)this['setDataValue'](_0xe7d3('0x8'),null);this[_0xe7d3('0x9')]('mandatoryDisposition',_0xa942aa);}}}; \ No newline at end of file +var _0xf3fa=['name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x18c85d,_0x176d6b){var _0x4d94b3=function(_0x168e80){while(--_0x168e80){_0x18c85d['push'](_0x18c85d['shift']());}};_0x4d94b3(++_0x176d6b);}(_0xf3fa,0x15c));var _0xaf3f=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0xf3fa[_0x2211b2];return _0x1ff209;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xaf3f('0x0'));module[_0xaf3f('0x1')]={'name':{'type':Sequelize[_0xaf3f('0x2')],'unique':_0xaf3f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xaf3f('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaf3f('0x4')]();}},'replyUri':{'type':Sequelize[_0xaf3f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaf3f('0x5')],'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[_0xaf3f('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaf3f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaf3f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaf3f('0x2')]},'queueTransfer':{'type':Sequelize[_0xaf3f('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaf3f('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaf3f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xaf3f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xaf3f('0x6')],'defaultValue':![],'comment':_0xaf3f('0x9'),'set':function(_0x4fbabd){if(!_0x4fbabd)this['setDataValue'](_0xaf3f('0xa'),null);this[_0xaf3f('0xb')](_0xaf3f('0xc'),_0x4fbabd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a6d0208..543022e 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 _0xad78=['Content-Range','json','apply','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','autoAssociation','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','updatedAt','OpenchannelApplication','Applications','account','applications','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage','contact','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','getApplications','getInteractions','Contact','fullname','Tags','color','tag','addAgents','omit','removeAgents','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','user','out','Messages','dataValues','push','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','request','then','debug','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','offset','count','limit'];(function(_0x2e7b74,_0x5e2967){var _0x27375b=function(_0x3c63d0){while(--_0x3c63d0){_0x2e7b74['push'](_0x2e7b74['shift']());}};_0x27375b(++_0x5e2967);}(_0xad78,0x149));var _0x8ad7=function(_0x251dcb,_0x557ba1){_0x251dcb=_0x251dcb-0x0;var _0xb15320=_0xad78[_0x251dcb];return _0xb15320;};'use strict';var emlformat=require(_0x8ad7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ad7('0x1'));var rp=require(_0x8ad7('0x2'));var moment=require('moment');var BPromise=require(_0x8ad7('0x3'));var Mustache=require(_0x8ad7('0x4'));var util=require(_0x8ad7('0x5'));var path=require(_0x8ad7('0x6'));var sox=require(_0x8ad7('0x7'));var csv=require(_0x8ad7('0x8'));var ejs=require(_0x8ad7('0x9'));var fs=require('fs');var fs_extra=require(_0x8ad7('0xa'));var _=require(_0x8ad7('0xb'));var squel=require(_0x8ad7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ad7('0xd'));var toCsv=require(_0x8ad7('0x8'));var querystring=require(_0x8ad7('0xe'));var Papa=require(_0x8ad7('0xf'));var Redis=require(_0x8ad7('0x10'));var authService=require(_0x8ad7('0x11'));var qs=require(_0x8ad7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ad7('0x13'));var logger=require(_0x8ad7('0x14'))(_0x8ad7('0x15'));var utils=require('../../config/utils');var config=require(_0x8ad7('0x16'));var licenseUtil=require(_0x8ad7('0x17'));var db=require(_0x8ad7('0x18'))['db'];config[_0x8ad7('0x19')]=_[_0x8ad7('0x1a')](config[_0x8ad7('0x19')],{'host':_0x8ad7('0x1b'),'port':0x18eb});var socket=require(_0x8ad7('0x1c'))(new Redis(config[_0x8ad7('0x19')]));require(_0x8ad7('0x1d'))[_0x8ad7('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8ad7('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x8ad7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e18f4,_0x5da84e,_0x51ead4,_0x2d17a0){return new BPromise(function(_0x1607c9,_0x43914a){var _0x429dd1=_0x2d17a0||client;return _0x429dd1[_0x8ad7('0x20')](_0x3e18f4,_0x51ead4)[_0x8ad7('0x21')](function(_0x937333){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5da84e,'request\x20sent');logger[_0x8ad7('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5da84e,_0x8ad7('0x23'),JSON[_0x8ad7('0x24')](_0x937333));if(_0x937333[_0x8ad7('0x25')]){if(_0x937333['error']['code']===0x1f4){logger['error'](_0x8ad7('0x26'),_0x5da84e,_0x937333['error']['message']);return _0x43914a(_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);}logger[_0x8ad7('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x5da84e,_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);return _0x1607c9(_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);}else{logger[_0x8ad7('0x28')](_0x8ad7('0x26'),_0x5da84e,'request\x20sent');_0x1607c9(_0x937333[_0x8ad7('0x29')][_0x8ad7('0x27')]);}})['catch'](function(_0xa79077){logger[_0x8ad7('0x25')](_0x8ad7('0x26'),_0x5da84e,_0xa79077);_0x43914a(_0xa79077);});});}function respondWithStatusCode(_0x42c112,_0x1b7e0a){_0x1b7e0a=_0x1b7e0a||0xcc;return function(_0x1abf2c){if(_0x1abf2c){return _0x42c112[_0x8ad7('0x2a')](_0x1b7e0a);}return _0x42c112['status'](_0x1b7e0a)['end']();};}function respondWithResult(_0x2c10a7,_0x5253c0){_0x5253c0=_0x5253c0||0xc8;return function(_0x3febc1){if(_0x3febc1){return _0x2c10a7[_0x8ad7('0x2b')](_0x5253c0)['json'](_0x3febc1);}};}function respondWithFilteredResult(_0x27bbcb,_0x353578){return function(_0x2d8d7){if(_0x2d8d7){var _0x4f419f=typeof _0x353578[_0x8ad7('0x2c')]==='undefined'&&typeof _0x353578['limit']==='undefined';var _0x46dc32=_0x2d8d7[_0x8ad7('0x2d')];var _0x123b6c=_0x4f419f?0x0:_0x353578[_0x8ad7('0x2c')];var _0x3fd891=_0x4f419f?_0x2d8d7[_0x8ad7('0x2d')]:_0x353578[_0x8ad7('0x2c')]+_0x353578[_0x8ad7('0x2e')];var _0x363a15;if(_0x3fd891>=_0x46dc32){_0x3fd891=_0x46dc32;_0x363a15=0xc8;}else{_0x363a15=0xce;}_0x27bbcb[_0x8ad7('0x2b')](_0x363a15);return _0x27bbcb['set'](_0x8ad7('0x2f'),_0x123b6c+'-'+_0x3fd891+'/'+_0x46dc32)[_0x8ad7('0x30')](_0x2d8d7);}return null;};}function patchUpdates(_0x10ff0e){return function(_0x5d1ab9){try{jsonpatch[_0x8ad7('0x31')](_0x5d1ab9,_0x10ff0e,!![]);}catch(_0x172663){return BPromise[_0x8ad7('0x32')](_0x172663);}return _0x5d1ab9[_0x8ad7('0x33')]();};}function saveUpdates(_0x240ac3,_0x1531a2){return function(_0x561e43){if(_0x561e43){return _0x561e43[_0x8ad7('0x34')](_0x240ac3)['then'](function(_0x2ee0d6){return _0x2ee0d6;});}return null;};}function removeEntity(_0x38b99d,_0x155ac1){return function(_0x651189){if(_0x651189){return _0x651189['destroy']()['then'](function(){var _0x389115=_0x651189[_0x8ad7('0x35')]({'plain':!![]});var _0x2ccfa0='OpenchannelAccounts';return db[_0x8ad7('0x36')][_0x8ad7('0x37')]({'where':{'type':_0x2ccfa0,'resourceId':_0x389115['id']}})[_0x8ad7('0x21')](function(){return _0x651189;});})[_0x8ad7('0x21')](function(){_0x38b99d[_0x8ad7('0x2b')](0xcc)[_0x8ad7('0x38')]();});}};}function handleEntityNotFound(_0x4bef50,_0x21ae38){return function(_0x4a3368){if(!_0x4a3368){_0x4bef50['sendStatus'](0x194);}return _0x4a3368;};}function handleError(_0x3ece0f,_0x57925f){_0x57925f=_0x57925f||0x1f4;return function(_0xc378c){logger[_0x8ad7('0x25')](_0xc378c[_0x8ad7('0x39')]);if(_0xc378c['name']){delete _0xc378c[_0x8ad7('0x3a')];}_0x3ece0f[_0x8ad7('0x2b')](_0x57925f)[_0x8ad7('0x3b')](_0xc378c);};}exports[_0x8ad7('0x3c')]=function(_0x3115eb,_0x384dc7){var _0x272c5b={'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]},_0x5efc7f={},_0x299d35={'count':0x0,'rows':[]};var _0x16f91b=_[_0x8ad7('0x3f')](db[_0x8ad7('0x40')][_0x8ad7('0x41')],function(_0x467949){return{'name':_0x467949[_0x8ad7('0x42')],'type':_0x467949['type'][_0x8ad7('0x43')]};});_0x5efc7f['model']=_[_0x8ad7('0x3f')](_0x16f91b,_0x8ad7('0x3a'));_0x5efc7f['query']=_['keys'](_0x3115eb[_0x8ad7('0x44')]);_0x5efc7f[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x5efc7f[_0x8ad7('0x47')],_0x5efc7f[_0x8ad7('0x44')]);_0x272c5b[_0x8ad7('0x48')]=_[_0x8ad7('0x46')](_0x5efc7f[_0x8ad7('0x47')],qs['fields'](_0x3115eb[_0x8ad7('0x44')]['fields']));_0x272c5b[_0x8ad7('0x48')]=_0x272c5b['attributes'][_0x8ad7('0x49')]?_0x272c5b[_0x8ad7('0x48')]:_0x5efc7f[_0x8ad7('0x47')];if(!_0x3115eb[_0x8ad7('0x44')]['hasOwnProperty'](_0x8ad7('0x4a'))){_0x272c5b[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x272c5b[_0x8ad7('0x2c')]=qs['offset'](_0x3115eb['query'][_0x8ad7('0x2c')]);}_0x272c5b[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x3115eb['query'][_0x8ad7('0x4c')]);_0x272c5b[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x3115eb[_0x8ad7('0x44')],_0x5efc7f[_0x8ad7('0x45')]),_0x16f91b);if(_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x272c5b[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x272c5b[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x16f91b,function(_0x9cd4e9){if(_0x9cd4e9[_0x8ad7('0x51')]!=='VIRTUAL'){var _0x572d73={};_0x572d73[_0x9cd4e9[_0x8ad7('0x3a')]]={'$like':'%'+_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x572d73;}})});}_0x272c5b=_['merge']({},_0x272c5b,_0x3115eb[_0x8ad7('0x52')]);var _0x5c2ce5={'where':_0x272c5b[_0x8ad7('0x4d')]};return db[_0x8ad7('0x40')][_0x8ad7('0x2d')](_0x5c2ce5)[_0x8ad7('0x21')](function(_0x9a7d51){_0x299d35['count']=_0x9a7d51;if(_0x3115eb['query'][_0x8ad7('0x53')]){_0x272c5b[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x40')][_0x8ad7('0x55')](_0x272c5b);})['then'](function(_0x26144f){_0x299d35[_0x8ad7('0x56')]=_0x26144f;return _0x299d35;})[_0x8ad7('0x21')](respondWithFilteredResult(_0x384dc7,_0x272c5b))['catch'](handleError(_0x384dc7,null));};exports[_0x8ad7('0x57')]=function(_0x3a66af,_0x3aa0da){var _0xc7d194={'raw':![],'where':{'id':_0x3a66af[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]},_0x11cdfa={};_0x11cdfa[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x40')][_0x8ad7('0x41')]);_0x11cdfa[_0x8ad7('0x44')]=_['keys'](_0x3a66af[_0x8ad7('0x44')]);_0x11cdfa[_0x8ad7('0x45')]=_['intersection'](_0x11cdfa[_0x8ad7('0x47')],_0x11cdfa[_0x8ad7('0x44')]);_0xc7d194[_0x8ad7('0x48')]=_['intersection'](_0x11cdfa[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x3a66af[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0xc7d194[_0x8ad7('0x48')]=_0xc7d194['attributes'][_0x8ad7('0x49')]?_0xc7d194[_0x8ad7('0x48')]:_0x11cdfa[_0x8ad7('0x47')];if(_0x3a66af[_0x8ad7('0x44')][_0x8ad7('0x53')]){_0xc7d194['include']=[{'all':!![]}];}_0xc7d194=_[_0x8ad7('0x50')]({},_0xc7d194,_0x3a66af['options']);return db[_0x8ad7('0x40')][_0x8ad7('0x5b')](_0xc7d194)['then'](handleEntityNotFound(_0x3aa0da,null))[_0x8ad7('0x21')](respondWithResult(_0x3aa0da,null))[_0x8ad7('0x5c')](handleError(_0x3aa0da,null));};exports[_0x8ad7('0x5d')]=function(_0x54c000,_0x1893c4){return db['OpenchannelAccount']['create'](_0x54c000[_0x8ad7('0x5e')],{})[_0x8ad7('0x21')](function(_0x98e996){var _0x4a51e1=_0x54c000['user']['get']({'plain':!![]});if(!_0x4a51e1)throw new Error(_0x8ad7('0x5f'));if(_0x4a51e1['role']==='user'){var _0x49660d=_0x98e996[_0x8ad7('0x35')]({'plain':!![]});var _0x45dc30=_0x8ad7('0x60');return db[_0x8ad7('0x61')][_0x8ad7('0x5b')]({'where':{'name':_0x45dc30,'userProfileId':_0x4a51e1['userProfileId']},'raw':!![]})[_0x8ad7('0x21')](function(_0x1528d0){if(_0x1528d0&&_0x1528d0[_0x8ad7('0x62')]===0x0){return db['UserProfileResource'][_0x8ad7('0x5d')]({'name':_0x49660d[_0x8ad7('0x3a')],'resourceId':_0x49660d['id'],'type':_0x1528d0['name'],'sectionId':_0x1528d0['id']},{})[_0x8ad7('0x21')](function(){return _0x98e996;});}else{return _0x98e996;}})[_0x8ad7('0x5c')](function(_0x3a7a02){logger[_0x8ad7('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a7a02);throw _0x3a7a02;});}return _0x98e996;})['then'](respondWithResult(_0x1893c4,0xc9))[_0x8ad7('0x5c')](handleError(_0x1893c4,null));};exports['update']=function(_0x20f7af,_0x47d8d3){if(_0x20f7af[_0x8ad7('0x5e')]['id']){delete _0x20f7af[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x20f7af[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]})[_0x8ad7('0x21')](handleEntityNotFound(_0x47d8d3,null))[_0x8ad7('0x21')](saveUpdates(_0x20f7af[_0x8ad7('0x5e')],null))[_0x8ad7('0x21')](respondWithResult(_0x47d8d3,null))[_0x8ad7('0x5c')](handleError(_0x47d8d3,null));};exports['destroy']=function(_0x2adbcd,_0x4f489f){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x2adbcd['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x4f489f,null))[_0x8ad7('0x21')](removeEntity(_0x4f489f,null))[_0x8ad7('0x5c')](handleError(_0x4f489f,null));};exports['describe']=function(_0x570923,_0x4b4052){return db[_0x8ad7('0x40')]['describe']()['then'](respondWithResult(_0x4b4052,null))[_0x8ad7('0x5c')](handleError(_0x4b4052,null));};exports[_0x8ad7('0x63')]=function(_0x4214b5,_0x386798,_0x456747){if(_0x4214b5[_0x8ad7('0x5e')]['id']){delete _0x4214b5[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x4214b5[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0x386798,null))[_0x8ad7('0x21')](function(_0x50d0bc){if(_0x50d0bc){_0x4214b5['body'][_0x8ad7('0x64')]=_0x50d0bc['id'];return db[_0x8ad7('0x65')]['create'](_0x4214b5[_0x8ad7('0x5e')]);}})[_0x8ad7('0x21')](respondWithResult(_0x386798,null))[_0x8ad7('0x5c')](handleError(_0x386798,null));};exports[_0x8ad7('0x66')]=function(_0x3b7884,_0xe6fde3,_0x213513){var _0x181c4e={'raw':![],'where':{}};var _0x5d7b45={};var _0x4f1aef={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x3b7884[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0xe6fde3,null))[_0x8ad7('0x21')](function(_0x3e66fc){if(_0x3e66fc){_0x5d7b45[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x65')][_0x8ad7('0x41')]);_0x5d7b45['query']=_[_0x8ad7('0x59')](_0x3b7884['query']);_0x5d7b45[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x5d7b45['model'],_0x5d7b45[_0x8ad7('0x44')]);_0x181c4e[_0x8ad7('0x48')]=_['intersection'](_0x5d7b45['model'],qs[_0x8ad7('0x5a')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x181c4e['attributes']=_0x181c4e[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x181c4e['attributes']:_0x5d7b45[_0x8ad7('0x47')];if(!_0x3b7884['query'][_0x8ad7('0x68')]('nolimit')){_0x181c4e[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x181c4e[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}_0x181c4e[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x3b7884['query'][_0x8ad7('0x4c')]);_0x181c4e['where']=qs[_0x8ad7('0x45')](_['pick'](_0x3b7884[_0x8ad7('0x44')],_0x5d7b45['filters']));_0x181c4e[_0x8ad7('0x4d')]['OpenchannelAccountId']=_0x3e66fc['id'];if(_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x181c4e[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x181c4e[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x181c4e[_0x8ad7('0x48')],function(_0x3e7d84){var _0xade492={};_0xade492[_0x3e7d84]={'$like':'%'+_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0xade492;})});}_0x181c4e=_['merge']({},_0x181c4e,_0x3b7884[_0x8ad7('0x52')]);return db[_0x8ad7('0x65')][_0x8ad7('0x2d')]({'where':_0x181c4e[_0x8ad7('0x4d')]})[_0x8ad7('0x21')](function(_0x50eadc){_0x4f1aef[_0x8ad7('0x2d')]=_0x50eadc;if(_0x3b7884[_0x8ad7('0x44')]['includeAll']){_0x181c4e[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x65')][_0x8ad7('0x55')](_0x181c4e);})['then'](function(_0x54638a){_0x4f1aef['rows']=_0x54638a;return _0x4f1aef;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0xe6fde3,_0x181c4e))[_0x8ad7('0x5c')](handleError(_0xe6fde3,null));};exports[_0x8ad7('0x69')]=function(_0x228a55,_0x32935e,_0x330a8b){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x228a55['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x32935e,null))[_0x8ad7('0x21')](function(_0x53c7af){if(_0x53c7af){return _0x53c7af[_0x8ad7('0x69')](_0x228a55[_0x8ad7('0x44')][_0x8ad7('0x6a')]);}})['then'](respondWithStatusCode(_0x32935e,null))[_0x8ad7('0x5c')](handleError(_0x32935e,null));};exports[_0x8ad7('0x6b')]=function(_0x5e3599,_0x245a57,_0x5257ec){if(_0x5e3599['body']['id']){delete _0x5e3599[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')]['find']({'where':{'id':_0x5e3599[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x245a57,null))[_0x8ad7('0x21')](function(_0x87f027){if(_0x87f027){_0x5e3599[_0x8ad7('0x5e')][_0x8ad7('0x64')]=_0x87f027['id'];return db[_0x8ad7('0x6c')][_0x8ad7('0x5d')](_0x5e3599['body']);}})[_0x8ad7('0x21')](respondWithResult(_0x245a57,null))[_0x8ad7('0x5c')](handleError(_0x245a57,null));};exports['getAnswers']=function(_0x34ef34,_0x2294b6,_0xd016a0){var _0x1a487d={'raw':![],'where':{}};var _0x1d7a41={};var _0x37fd80={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')]['findOne']({'where':{'id':_0x34ef34[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2294b6,null))[_0x8ad7('0x21')](function(_0x4c1339){if(_0x4c1339){_0x1d7a41['model']=_[_0x8ad7('0x59')](db[_0x8ad7('0x6c')][_0x8ad7('0x41')]);_0x1d7a41[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x34ef34['query']);_0x1d7a41[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x1d7a41[_0x8ad7('0x47')],_0x1d7a41[_0x8ad7('0x44')]);_0x1a487d[_0x8ad7('0x48')]=_['intersection'](_0x1d7a41[_0x8ad7('0x47')],qs['fields'](_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x1a487d[_0x8ad7('0x48')]=_0x1a487d['attributes'][_0x8ad7('0x49')]?_0x1a487d[_0x8ad7('0x48')]:_0x1d7a41[_0x8ad7('0x47')];if(!_0x34ef34['query'][_0x8ad7('0x68')]('nolimit')){_0x1a487d[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x1a487d[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x34ef34[_0x8ad7('0x44')]['offset']);}_0x1a487d[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x34ef34[_0x8ad7('0x44')]['sort']);_0x1a487d[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x34ef34[_0x8ad7('0x44')],_0x1d7a41['filters']));_0x1a487d[_0x8ad7('0x4d')][_0x8ad7('0x64')]=_0x4c1339['id'];if(_0x34ef34['query'][_0x8ad7('0x4f')]){_0x1a487d[_0x8ad7('0x4d')]=_['merge'](_0x1a487d[_0x8ad7('0x4d')],{'$or':_['map'](_0x1a487d[_0x8ad7('0x48')],function(_0x2a8bac){var _0x4da6e5={};_0x4da6e5[_0x2a8bac]={'$like':'%'+_0x34ef34[_0x8ad7('0x44')]['filter']+'%'};return _0x4da6e5;})});}_0x1a487d=_[_0x8ad7('0x50')]({},_0x1a487d,_0x34ef34[_0x8ad7('0x52')]);return db['CannedAnswer'][_0x8ad7('0x2d')]({'where':_0x1a487d[_0x8ad7('0x4d')]})[_0x8ad7('0x21')](function(_0x19f436){_0x37fd80[_0x8ad7('0x2d')]=_0x19f436;if(_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x53')]){_0x1a487d[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x6c')][_0x8ad7('0x55')](_0x1a487d);})[_0x8ad7('0x21')](function(_0x647e0a){_0x37fd80[_0x8ad7('0x56')]=_0x647e0a;return _0x37fd80;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0x2294b6,_0x1a487d))[_0x8ad7('0x5c')](handleError(_0x2294b6,null));};exports[_0x8ad7('0x6d')]=function(_0xcfa1c7,_0x1e5268,_0x342114){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0xcfa1c7['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x1e5268,null))['then'](function(_0x5b4b42){if(_0x5b4b42){return _0x5b4b42[_0x8ad7('0x6d')](_0xcfa1c7[_0x8ad7('0x44')]['ids']);}})[_0x8ad7('0x21')](respondWithStatusCode(_0x1e5268,null))[_0x8ad7('0x5c')](handleError(_0x1e5268,null));};exports[_0x8ad7('0x6e')]=function(_0x530b29,_0x51e021,_0x30ac56){var _0x15464b={'body':_0x530b29[_0x8ad7('0x5e')],'channel':_0x8ad7('0x6f')};var _0x493f6e=[];var _0x6efd23=[];var _0x223259={};var _0x444b40=![];return db[_0x8ad7('0x70')]['describe']()[_0x8ad7('0x21')](function(_0x1815ef){if(!_0x1815ef){throw new db[(_0x8ad7('0x71'))]['ValidationError']('no\x20available\x20attributes');}_0x493f6e=_[_0x8ad7('0x72')](_['keys'](_0x1815ef),['createdAt','updatedAt']);_0x6efd23=_[_0x8ad7('0x72')](_[_0x8ad7('0x59')](_0x1815ef),['createdAt','updatedAt',_0x8ad7('0x73'),_0x8ad7('0x74')]);if(_0x530b29[_0x8ad7('0x5e')]['id']){delete _0x530b29[_0x8ad7('0x5e')]['id'];}if(_[_0x8ad7('0x75')](_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x76')])){throw new db[(_0x8ad7('0x71'))][(_0x8ad7('0x77'))](_0x8ad7('0x78'));}if(_[_0x8ad7('0x75')](_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')])||_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')]===''){throw new db[(_0x8ad7('0x71'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8ad7('0x75')](_0x530b29['body'][_0x8ad7('0x79')])){throw new db[(_0x8ad7('0x71'))][(_0x8ad7('0x77'))](_0x8ad7('0x7a')+_0x6efd23);}if(!_[_0x8ad7('0x7b')](_0x6efd23,_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x79')])){throw new db['Sequelize'][(_0x8ad7('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6efd23);}_0x223259[_0x530b29['body'][_0x8ad7('0x79')]]=_0x530b29['body']['from'];})['then'](function(){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x530b29[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x7c')],'as':_0x8ad7('0x7d'),'include':[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0x7e'),'where':_0x223259,'limit':0x1,'order':[[_0x8ad7('0x7f'),'DESC']]}]},{'model':db[_0x8ad7('0x80')],'as':_0x8ad7('0x81')}]});})[_0x8ad7('0x21')](handleEntityNotFound(_0x51e021,null))[_0x8ad7('0x21')](function(_0x188ee0){if(_0x188ee0&&_0x188ee0[_0x8ad7('0x7d')]){_0x15464b[_0x8ad7('0x82')]=_0x188ee0;_0x15464b['applications']=_0x188ee0[_0x8ad7('0x81')];_0x15464b['list']=_0x188ee0['List'];_0x15464b[_0x8ad7('0x83')]=_['orderBy'](_0x15464b[_0x8ad7('0x83')],[_0x8ad7('0x84')],[_0x8ad7('0x85')]);if(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x81')]){delete _0x15464b[_0x8ad7('0x82')][_0x8ad7('0x81')];}if(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x7d')]&&_0x15464b[_0x8ad7('0x82')]['List'][_0x8ad7('0x7e')][_0x8ad7('0x49')]){return _0x15464b[_0x8ad7('0x82')][_0x8ad7('0x7d')][_0x8ad7('0x7e')][0x0];}var _0x29ebe6=_['defaults'](_0x530b29['body'],{'firstName':_0x530b29[_0x8ad7('0x5e')]['from'],'ListId':_0x188ee0[_0x8ad7('0x74')]});_0x29ebe6[_0x530b29['body'][_0x8ad7('0x79')]]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x76')];return db[_0x8ad7('0x70')][_0x8ad7('0x5d')](_0x29ebe6,{'fields':_0x493f6e,'raw':!![]});}})[_0x8ad7('0x21')](handleEntityNotFound(_0x51e021,null))['then'](function(_0x408dd3){_0x15464b['contact']=_0x408dd3;if(_0x408dd3){var _0x306b6b={'ContactId':_0x408dd3['id'],'OpenchannelAccountId':_0x530b29[_0x8ad7('0x58')]['id'],'from':(_0x408dd3[_0x8ad7('0x86')]||'')+'\x20'+(_0x408dd3[_0x8ad7('0x87')]||'')};var _0x109b1c={'OpenchannelAccountId':_0x530b29['params']['id'],'closed':![]};if(_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x88')]){_0x109b1c['threadId']=_0x530b29[_0x8ad7('0x5e')]['threadId'];return db[_0x8ad7('0x89')][_0x8ad7('0x5b')]({'where':_0x109b1c})[_0x8ad7('0x21')](function(_0xf52b92){if(_0xf52b92){return[_0xf52b92,![]];}_0x306b6b[_0x8ad7('0x88')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x88')];_0x306b6b[_0x8ad7('0x8a')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x8a')];return db[_0x8ad7('0x89')][_0x8ad7('0x5d')](_0x306b6b)[_0x8ad7('0x21')](function(_0x58bddf){return[_0x58bddf,!![]];});});}else{_0x109b1c[_0x8ad7('0x88')]=null;}_0x109b1c[_0x8ad7('0x8b')]=_0x408dd3['id'];return db['OpenchannelInteraction']['find']({'where':_0x109b1c})[_0x8ad7('0x21')](function(_0x5d5eab){if(_0x5d5eab){return[_0x5d5eab,![]];}return db['OpenchannelInteraction'][_0x8ad7('0x5d')](_0x306b6b)['then'](function(_0x45b48c){return[_0x45b48c,!![]];});});}})[_0x8ad7('0x8c')](function(_0x24b3bd,_0x5c8f02){if(_0x24b3bd){_0x444b40=_0x5c8f02;if(!_0x5c8f02){var _0x11ef18={'from':(_0x15464b['contact'][_0x8ad7('0x86')]||'')+'\x20'+(_0x15464b['contact']['lastName']||'')};if(_0x530b29['body']['threadId']&&_0x530b29[_0x8ad7('0x5e')]['messageId']&&_0x530b29['body'][_0x8ad7('0x88')]!=_0x530b29['body'][_0x8ad7('0x8d')]){_0x11ef18[_0x8ad7('0x88')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x8d')];}return _0x24b3bd[_0x8ad7('0x34')](_0x11ef18);}else{return _0x24b3bd;}}})[_0x8ad7('0x21')](function(_0xa0048){_0x15464b[_0x8ad7('0x8e')]=_0xa0048['get']({'plain':!![]});_0x15464b['interaction'][_0x8ad7('0x8f')]=_0x444b40;if(_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x8f')]){if(_0x15464b['account'][_0x8ad7('0x90')]){_0x15464b[_0x8ad7('0x83')]['push']({'id':0x0,'priority':_0x15464b[_0x8ad7('0x83')][_0x8ad7('0x49')]+0x1,'app':_0x8ad7('0x91'),'appdata':_0x8ad7('0x92'),'interval':'*,*,*,*'});}}return db[_0x8ad7('0x93')][_0x8ad7('0x5d')]({'body':_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x530b29[_0x8ad7('0x58')]['id'],'OpenchannelInteractionId':_0xa0048['id'],'direction':'in','ContactId':_0x15464b[_0x8ad7('0x94')]['id'],'AttachmentId':_0x530b29[_0x8ad7('0x5e')]['AttachmentId']});})[_0x8ad7('0x21')](function(_0x548874){_0x15464b[_0x8ad7('0x27')]=_0x548874;if(!_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x95')])return;return db[_0x8ad7('0x96')][_0x8ad7('0x5b')]({'attributes':['id',_0x8ad7('0x3a')],'where':{'id':_0x15464b[_0x8ad7('0x8e')]['UserId']}});})[_0x8ad7('0x21')](function(_0x1b6e54){if(_0x1b6e54){_0x15464b[_0x8ad7('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8ad7('0x97'),'appdata':_0x1b6e54['name']+','+(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x98')]||0xa),'interval':_0x8ad7('0x99')});}if(!_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x9a')])return;return db[_0x8ad7('0x9b')]['find']({'attributes':['id',_0x8ad7('0x3a')],'where':{'id':_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x9a')]}});})[_0x8ad7('0x21')](function(_0x4f521b){if(_0x4f521b){_0x15464b['applications'][_0x8ad7('0x9c')]({'id':0x0,'priority':0x1,'app':_0x8ad7('0x9d'),'appdata':_0x4f521b[_0x8ad7('0x3a')]+','+(_0x15464b['account'][_0x8ad7('0x9e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8ad7('0x9f'),_0x8ad7('0xa0'),_0x15464b);})[_0x8ad7('0x21')](function(_0x2ef044){respondWithRpcPromise('EventManager',_0x8ad7('0xa1'),{'event':'notify','message':_0x2ef044},client9002);return _0x2ef044;})[_0x8ad7('0x21')](respondWithResult(_0x51e021,null))[_0x8ad7('0x5c')](handleError(_0x51e021,null));};exports[_0x8ad7('0xa2')]=function(_0x27dd97,_0x3b2206){var _0x2005a0=_0x27dd97[_0x8ad7('0x58')]['id'];var _0x5b575c=_0x27dd97['body'];var _0x74529f=0xc8;var _0x1db604=null;return db[_0x8ad7('0xa3')][_0x8ad7('0xa4')]({'isolationLevel':db['sequelize'][_0x8ad7('0xa5')][_0x8ad7('0xa6')][_0x8ad7('0xa7')]},function(_0x5dce95){return db[_0x8ad7('0x40')]['findOne']({'where':{'id':_0x2005a0},'transaction':_0x5dce95})[_0x8ad7('0x21')](function(_0x2a26df){if(_0x2a26df){return db[_0x8ad7('0x80')][_0x8ad7('0x37')]({'where':{'OpenchannelAccountId':_0x2005a0},'transaction':_0x5dce95})['then'](function(){var _0x4e3dd8=_['map'](_0x5b575c,function(_0x558177){_0x558177[_0x8ad7('0x64')]=_0x2005a0;return _0x558177;});return db['OpenchannelApplication']['bulkCreate'](_0x4e3dd8,{'transaction':_0x5dce95});});}else{_0x74529f=0x194;_0x1db604=[];}});})[_0x8ad7('0x21')](function(){if(_0x74529f!==0x194){return db[_0x8ad7('0x80')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2005a0},'order':_0x8ad7('0x84')})[_0x8ad7('0x21')](function(_0x168ec8){_0x1db604=_0x168ec8;});}})[_0x8ad7('0x5c')](function(_0x3e71c2){_0x74529f=0x1f4;logger['error'](_0x3e71c2[_0x8ad7('0x39')]);if(_0x3e71c2[_0x8ad7('0x3a')]){delete _0x3e71c2[_0x8ad7('0x3a')];}_0x1db604=_0x3e71c2;})['finally'](function(){if(_0x1db604===null){_0x3b2206[_0x8ad7('0x2a')](_0x74529f);}else{if(_0x74529f===0x1f4){_0x3b2206[_0x8ad7('0x2b')](_0x74529f)['send'](_0x1db604);}else{_0x3b2206['status'](_0x74529f)['json'](_0x1db604);}}});};exports[_0x8ad7('0xa8')]=function(_0x2909d7,_0x6f4b8e,_0xfe5af7){var _0x11e37a={};var _0x4cf332={};var _0x1f9e07;var _0x1f7a1e;return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x2909d7[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x6f4b8e,null))[_0x8ad7('0x21')](function(_0x53a019){if(_0x53a019){_0x1f9e07=_0x53a019;_0x4cf332[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x80')][_0x8ad7('0x41')]);_0x4cf332[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x2909d7['query']);_0x4cf332['filters']=_[_0x8ad7('0x46')](_0x4cf332['model'],_0x4cf332['query']);_0x11e37a['attributes']=_[_0x8ad7('0x46')](_0x4cf332[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x11e37a['attributes']=_0x11e37a['attributes'][_0x8ad7('0x49')]?_0x11e37a['attributes']:_0x4cf332[_0x8ad7('0x47')];_0x11e37a['order']=qs[_0x8ad7('0x4c')](_0x2909d7['query'][_0x8ad7('0x4c')]);_0x11e37a[_0x8ad7('0x4d')]=qs['filters'](_[_0x8ad7('0x4e')](_0x2909d7['query'],_0x4cf332[_0x8ad7('0x45')]));if(_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x11e37a[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x11e37a[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x11e37a[_0x8ad7('0x48')],function(_0x5ac595){var _0x64e99d={};_0x64e99d[_0x5ac595]={'$like':'%'+_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x64e99d;})});}_0x11e37a=_['merge']({},_0x11e37a,_0x2909d7[_0x8ad7('0x52')]);return _0x1f9e07['getApplications'](_0x11e37a);}})['then'](function(_0x4c1937){if(_0x4c1937){_0x1f7a1e=_0x4c1937[_0x8ad7('0x49')];if(!_0x2909d7['query'][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x11e37a['limit']=qs['limit'](_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x11e37a[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x2909d7[_0x8ad7('0x44')]['offset']);}return _0x1f9e07[_0x8ad7('0xa8')](_0x11e37a);}})['then'](function(_0x1e35e6){if(_0x1e35e6){return _0x1e35e6?{'count':_0x1f7a1e,'rows':_0x1e35e6}:null;}})[_0x8ad7('0x21')](respondWithResult(_0x6f4b8e,null))[_0x8ad7('0x5c')](handleError(_0x6f4b8e,null));};exports[_0x8ad7('0xa9')]=function(_0x5186a8,_0xa0ca6c,_0xdfa94d){var _0x1400e0={'raw':![],'where':{}};var _0x2b5e26={};var _0x1f224c={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x5186a8[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0xa0ca6c,null))[_0x8ad7('0x21')](function(_0x39862b){if(_0x39862b){_0x2b5e26[_0x8ad7('0x47')]=_['keys'](db[_0x8ad7('0x89')][_0x8ad7('0x41')]);_0x2b5e26[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x5186a8[_0x8ad7('0x44')]);_0x2b5e26[_0x8ad7('0x45')]=_['intersection'](_0x2b5e26[_0x8ad7('0x47')],_0x2b5e26[_0x8ad7('0x44')]);_0x1400e0['attributes']=_[_0x8ad7('0x46')](_0x2b5e26[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x1400e0[_0x8ad7('0x48')]=_0x1400e0[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x1400e0['attributes']:_0x2b5e26['model'];if(!_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x1400e0['limit']=qs[_0x8ad7('0x2e')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x1400e0[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}_0x1400e0['order']=qs['sort'](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x4c')]);_0x1400e0[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x5186a8[_0x8ad7('0x44')],_0x2b5e26[_0x8ad7('0x45')]));_0x1400e0[_0x8ad7('0x4d')][_0x8ad7('0x64')]=_0x39862b['id'];if(_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x1400e0[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x1400e0[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x1400e0[_0x8ad7('0x48')],function(_0x7993ab){var _0x5db77c={};_0x5db77c[_0x7993ab]={'$like':'%'+_0x5186a8['query'][_0x8ad7('0x4f')]+'%'};return _0x5db77c;})});}_0x1400e0=_['merge']({},_0x1400e0,_0x5186a8[_0x8ad7('0x52')]);return db['OpenchannelInteraction'][_0x8ad7('0x2d')]({'where':_0x1400e0[_0x8ad7('0x4d')]})['then'](function(_0x3b380b){_0x1f224c[_0x8ad7('0x2d')]=_0x3b380b;if(_0x5186a8['query'][_0x8ad7('0x53')]){_0x1400e0[_0x8ad7('0x54')]=[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0xaa'),'required':![]},{'model':db[_0x8ad7('0x96')],'as':'Owner','attributes':[_0x8ad7('0x3a'),_0x8ad7('0xab'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8ad7('0xac'),'attributes':['id',_0x8ad7('0x3a'),_0x8ad7('0xad')],'where':_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0xae')]?{'id':_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0xae')]}:undefined,'required':_0x5186a8[_0x8ad7('0x44')]['tag']?!![]:![]}];}return db[_0x8ad7('0x89')][_0x8ad7('0x55')](_0x1400e0);})['then'](function(_0x1eda00){_0x1f224c[_0x8ad7('0x56')]=_0x1eda00;return _0x1f224c;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0xa0ca6c,_0x1400e0))['catch'](handleError(_0xa0ca6c,null));};exports[_0x8ad7('0xaf')]=function(_0x52dbf8,_0x5e7cc2,_0x25525d){return db[_0x8ad7('0x40')]['find']({'where':{'id':_0x52dbf8[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5e7cc2,null))['then'](function(_0x34af6f){if(_0x34af6f){return _0x34af6f[_0x8ad7('0xaf')](_0x52dbf8[_0x8ad7('0x5e')]['ids'],_[_0x8ad7('0xb0')](_0x52dbf8[_0x8ad7('0x5e')],[_0x8ad7('0x6a'),'id'])||{})[_0x8ad7('0x8c')](function(_0x37872f){for(var _0x232520=0x0;_0x232520<_0x52dbf8[_0x8ad7('0x5e')]['ids'][_0x8ad7('0x49')];_0x232520+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x52dbf8[_0x8ad7('0x5e')][_0x8ad7('0x6a')][_0x232520]),'OpenchannelAccountId':Number(_0x52dbf8[_0x8ad7('0x58')]['id'])});}return _0x37872f;});}})[_0x8ad7('0x21')](respondWithResult(_0x5e7cc2,null))['catch'](handleError(_0x5e7cc2,null));};exports[_0x8ad7('0xb1')]=function(_0x5a8b08,_0x5e3344,_0x392e33){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x5a8b08[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5e3344,null))[_0x8ad7('0x21')](function(_0xdf56bb){if(_0xdf56bb){return _0xdf56bb[_0x8ad7('0xb1')](_0x5a8b08[_0x8ad7('0x44')][_0x8ad7('0x6a')])[_0x8ad7('0x21')](function(){if(_['isArray'](_0x5a8b08['query'][_0x8ad7('0x6a')])){for(var _0xcbdce4=0x0;_0xcbdce4<_0x5a8b08[_0x8ad7('0x44')][_0x8ad7('0x6a')][_0x8ad7('0x49')];_0xcbdce4+=0x1){socket[_0x8ad7('0xb2')](_0x8ad7('0xb3'),{'UserId':Number(_0x5a8b08['query']['ids'][_0xcbdce4]),'OpenchannelAccountId':Number(_0x5a8b08[_0x8ad7('0x58')]['id'])});}}else{socket[_0x8ad7('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5a8b08['query']['ids']),'OpenchannelAccountId':Number(_0x5a8b08['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5e3344,null))['catch'](handleError(_0x5e3344,null));};exports['getAgents']=function(_0x383984,_0x5640da,_0x3e7801){var _0x58de6a={};var _0x4246c5={};var _0x4d11d8;var _0x2cb6b6;return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x383984[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5640da,null))['then'](function(_0x2a8d5a){if(_0x2a8d5a){_0x4d11d8=_0x2a8d5a;_0x4246c5[_0x8ad7('0x47')]=_['keys'](db['User'][_0x8ad7('0x41')]);_0x4246c5['query']=_[_0x8ad7('0x59')](_0x383984['query']);_0x4246c5[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x4246c5['model'],_0x4246c5[_0x8ad7('0x44')]);_0x58de6a[_0x8ad7('0x48')]=_['intersection'](_0x4246c5['model'],qs['fields'](_0x383984[_0x8ad7('0x44')]['fields']));_0x58de6a[_0x8ad7('0x48')]=_0x58de6a[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x58de6a[_0x8ad7('0x48')]:_0x4246c5['model'];_0x58de6a[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4c')]);_0x58de6a[_0x8ad7('0x4d')]=qs['filters'](_['pick'](_0x383984[_0x8ad7('0x44')],_0x4246c5['filters']));if(_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x58de6a['where']=_[_0x8ad7('0x50')](_0x58de6a[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x58de6a['attributes'],function(_0x30c864){var _0x5432b9={};_0x5432b9[_0x30c864]={'$like':'%'+_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x5432b9;})});}_0x58de6a=_[_0x8ad7('0x50')]({},_0x58de6a,_0x383984['options']);return _0x4d11d8['getAgents'](_0x58de6a);}})['then'](function(_0xe94d8){if(_0xe94d8){_0x2cb6b6=_0xe94d8[_0x8ad7('0x49')];if(!_0x383984[_0x8ad7('0x44')][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x58de6a['limit']=qs[_0x8ad7('0x2e')](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x58de6a['offset']=qs['offset'](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}return _0x4d11d8[_0x8ad7('0xb4')](_0x58de6a);}})[_0x8ad7('0x21')](function(_0x2fe713){if(_0x2fe713){return _0x2fe713?{'count':_0x2cb6b6,'rows':_0x2fe713}:null;}})['then'](respondWithResult(_0x5640da,null))[_0x8ad7('0x5c')](handleError(_0x5640da,null));};exports[_0x8ad7('0x3b')]=function(_0x156860,_0x66c45,_0x513f82){var _0x4a2f0b,_0x52379b,_0x52dd22;if(_[_0x8ad7('0x75')](_0x156860[_0x8ad7('0x5e')][_0x8ad7('0x5e')])||_0x156860['body'][_0x8ad7('0x5e')]===''){throw new db[(_0x8ad7('0x71'))]['ValidationError'](_0x8ad7('0xb5'));}if(_[_0x8ad7('0x75')](_0x156860[_0x8ad7('0x5e')]['to'])){}_0x4a2f0b=_0x156860[_0x8ad7('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x156860[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0x5ae18a){if(_0x5ae18a){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x5ae18a['id']},'include':[{'model':db['CmList'],'as':_0x8ad7('0x7d'),'include':[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0x7e'),'where':{[_0x5ae18a[_0x8ad7('0x79')]]:_0x4a2f0b},'limit':0x1,'order':[[_0x8ad7('0x7f'),_0x8ad7('0xb6')]]}]}]})['then'](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0x4a01c6){if(_0x4a01c6&&_0x4a01c6[_0x8ad7('0x7d')]){_0x52379b=_0x4a01c6[_0x8ad7('0x35')]({'plain':!![]});if(_0x52379b[_0x8ad7('0x7d')]&&_0x52379b[_0x8ad7('0x7d')][_0x8ad7('0x7e')][_0x8ad7('0x49')]){return _0x52379b[_0x8ad7('0x7d')][_0x8ad7('0x7e')][0x0];}return db[_0x8ad7('0x70')][_0x8ad7('0x5d')](_[_0x8ad7('0x1a')](_0x156860['body'],{'firstName':_0x4a2f0b,[_0x4a01c6[_0x8ad7('0x79')]]:_0x4a2f0b,'phone':_0x4a2f0b,'ListId':_0x52379b[_0x8ad7('0x74')]}));}})[_0x8ad7('0x21')](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0xcc3fbe){if(_0xcc3fbe){_0x52dd22=_0xcc3fbe;return db['OpenchannelInteraction'][_0x8ad7('0x5b')]({'where':{'ContactId':_0x52dd22['id'],'closed':![],'OpenchannelAccountId':_0x52379b['id']}})[_0x8ad7('0x21')](function(_0x35486c){if(_0x35486c){return[_0x35486c,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id'],'OpenchannelAccountId':_0x52379b['id'],'lastMsgDirection':'out','firstMsgDirection':_0x8ad7('0xb8'),'Messages':[_['merge'](_0x156860[_0x8ad7('0x5e')],{'read':![],'body':_0x156860['body'][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x52379b['id'],'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id']})]},{'include':[{'model':db[_0x8ad7('0x93')],'as':_0x8ad7('0xb9')}]})[_0x8ad7('0x21')](function(_0x34831c){return[_0x34831c,!![]];});});}})[_0x8ad7('0x8c')](function(_0x497899,_0x4f8880){if(_0x4f8880){return _0x497899;}return db['OpenchannelMessage'][_0x8ad7('0x5d')](_['merge'](_0x156860[_0x8ad7('0x5e')],{'read':![],'body':_0x156860[_0x8ad7('0x5e')][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x52379b['id'],'OpenchannelInteractionId':_0x497899['id'],'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id']}))['then'](function(_0x22ea0d){_0x497899[_0x8ad7('0xba')]['Messages']=[];_0x497899[_0x8ad7('0xba')][_0x8ad7('0xb9')][_0x8ad7('0xbb')](_0x22ea0d['dataValues']);return _0x497899;});});}})['then'](respondWithResult(_0x66c45,null))[_0x8ad7('0x5c')](handleError(_0x66c45,null));}; \ No newline at end of file +var _0x980e=['asc','account','ListId','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','lastName','messageId','interaction','created','autoclose','close','OpenchannelMessage','User','UserId','queueId','unshift','queue','Start','startRouting','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','send','getApplications','getInteractions','Contact','Owner','fullname','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','destroy','get','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority'];(function(_0x366dfb,_0x4fb72d){var _0x434c03=function(_0xa469b9){while(--_0xa469b9){_0x366dfb['push'](_0x366dfb['shift']());}};_0x434c03(++_0x4fb72d);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe980('0x1'));var rp=require('request-promise');var moment=require(_0xe980('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x3'));var util=require(_0xe980('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe980('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x6'));var squel=require(_0xe980('0x7'));var crypto=require(_0xe980('0x8'));var jsforce=require(_0xe980('0x9'));var deskjs=require(_0xe980('0xa'));var toCsv=require(_0xe980('0x5'));var querystring=require('querystring');var Papa=require(_0xe980('0xb'));var Redis=require(_0xe980('0xc'));var authService=require(_0xe980('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0xe'));var hardwareService=require(_0xe980('0xf'));var logger=require(_0xe980('0x10'))(_0xe980('0x11'));var utils=require(_0xe980('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe980('0x13')]=_[_0xe980('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe980('0x15'))(new Redis(config[_0xe980('0x13')]));require(_0xe980('0x16'))[_0xe980('0x17')](socket);var jayson=require(_0xe980('0x18'));var client=jayson[_0xe980('0x19')][_0xe980('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49771e,_0x594116,_0xd9fff2,_0x1e6760){return new BPromise(function(_0x406418,_0x29593c){var _0x551a2c=_0x1e6760||client;return _0x551a2c[_0xe980('0x1b')](_0x49771e,_0xd9fff2)[_0xe980('0x1c')](function(_0x1ddb12){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x594116,_0xe980('0x1d'));logger[_0xe980('0x1e')](_0xe980('0x1f'),_0x594116,_0xe980('0x1d'),JSON[_0xe980('0x20')](_0x1ddb12));if(_0x1ddb12[_0xe980('0x21')]){if(_0x1ddb12[_0xe980('0x21')][_0xe980('0x22')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x594116,_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);return _0x29593c(_0x1ddb12[_0xe980('0x21')]['message']);}logger[_0xe980('0x21')](_0xe980('0x24'),_0x594116,_0x1ddb12['error'][_0xe980('0x23')]);return _0x406418(_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);}else{logger['info'](_0xe980('0x24'),_0x594116,'request\x20sent');_0x406418(_0x1ddb12[_0xe980('0x25')][_0xe980('0x23')]);}})[_0xe980('0x26')](function(_0x40a34e){logger['error'](_0xe980('0x24'),_0x594116,_0x40a34e);_0x29593c(_0x40a34e);});});}function respondWithStatusCode(_0x392bd1,_0xdc9ad7){_0xdc9ad7=_0xdc9ad7||0xcc;return function(_0x4ac608){if(_0x4ac608){return _0x392bd1['sendStatus'](_0xdc9ad7);}return _0x392bd1[_0xe980('0x27')](_0xdc9ad7)[_0xe980('0x28')]();};}function respondWithResult(_0x5ec906,_0x16f2fe){_0x16f2fe=_0x16f2fe||0xc8;return function(_0x565424){if(_0x565424){return _0x5ec906[_0xe980('0x27')](_0x16f2fe)[_0xe980('0x29')](_0x565424);}};}function respondWithFilteredResult(_0x10f084,_0x3ef831){return function(_0x2a6e8a){if(_0x2a6e8a){var _0x43a7c2=typeof _0x3ef831['offset']===_0xe980('0x2a')&&typeof _0x3ef831['limit']===_0xe980('0x2a');var _0x24a29e=_0x2a6e8a[_0xe980('0x2b')];var _0x38ab6d=_0x43a7c2?0x0:_0x3ef831[_0xe980('0x2c')];var _0x56fbf7=_0x43a7c2?_0x2a6e8a['count']:_0x3ef831[_0xe980('0x2c')]+_0x3ef831[_0xe980('0x2d')];var _0x1b6d07;if(_0x56fbf7>=_0x24a29e){_0x56fbf7=_0x24a29e;_0x1b6d07=0xc8;}else{_0x1b6d07=0xce;}_0x10f084[_0xe980('0x27')](_0x1b6d07);return _0x10f084[_0xe980('0x2e')](_0xe980('0x2f'),_0x38ab6d+'-'+_0x56fbf7+'/'+_0x24a29e)[_0xe980('0x29')](_0x2a6e8a);}return null;};}function patchUpdates(_0x369c3a){return function(_0x15a5d1){try{jsonpatch[_0xe980('0x30')](_0x15a5d1,_0x369c3a,!![]);}catch(_0x371136){return BPromise['reject'](_0x371136);}return _0x15a5d1['save']();};}function saveUpdates(_0x9a6819,_0x4702e0){return function(_0x46c931){if(_0x46c931){return _0x46c931['update'](_0x9a6819)[_0xe980('0x1c')](function(_0x4b9586){return _0x4b9586;});}return null;};}function removeEntity(_0x2b481c,_0x3d5393){return function(_0x163db9){if(_0x163db9){return _0x163db9[_0xe980('0x31')]()[_0xe980('0x1c')](function(){var _0x36ab72=_0x163db9[_0xe980('0x32')]({'plain':!![]});var _0x9e301c='OpenchannelAccounts';return db['UserProfileResource'][_0xe980('0x31')]({'where':{'type':_0x9e301c,'resourceId':_0x36ab72['id']}})[_0xe980('0x1c')](function(){return _0x163db9;});})['then'](function(){_0x2b481c[_0xe980('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0735c,_0x2a3b92){return function(_0x253198){if(!_0x253198){_0xf0735c[_0xe980('0x33')](0x194);}return _0x253198;};}function handleError(_0x3b0732,_0x33353f){_0x33353f=_0x33353f||0x1f4;return function(_0x502223){logger[_0xe980('0x21')](_0x502223[_0xe980('0x34')]);if(_0x502223[_0xe980('0x35')]){delete _0x502223[_0xe980('0x35')];}_0x3b0732[_0xe980('0x27')](_0x33353f)['send'](_0x502223);};}exports[_0xe980('0x36')]=function(_0x1f35ed,_0x1faffe){var _0x49448b={'include':[{'model':db[_0xe980('0x37')],'as':_0xe980('0x38')}]},_0x16422e={},_0x5c4626={'count':0x0,'rows':[]};var _0x577d17=_['map'](db[_0xe980('0x39')][_0xe980('0x3a')],function(_0x346a78){return{'name':_0x346a78[_0xe980('0x3b')],'type':_0x346a78[_0xe980('0x3c')][_0xe980('0x3d')]};});_0x16422e['model']=_[_0xe980('0x3e')](_0x577d17,_0xe980('0x35'));_0x16422e[_0xe980('0x3f')]=_['keys'](_0x1f35ed[_0xe980('0x3f')]);_0x16422e[_0xe980('0x40')]=_[_0xe980('0x41')](_0x16422e['model'],_0x16422e[_0xe980('0x3f')]);_0x49448b[_0xe980('0x42')]=_['intersection'](_0x16422e[_0xe980('0x43')],qs[_0xe980('0x44')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x44')]));_0x49448b[_0xe980('0x42')]=_0x49448b[_0xe980('0x42')]['length']?_0x49448b[_0xe980('0x42')]:_0x16422e[_0xe980('0x43')];if(!_0x1f35ed[_0xe980('0x3f')][_0xe980('0x45')]('nolimit')){_0x49448b[_0xe980('0x2d')]=qs[_0xe980('0x2d')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x2d')]);_0x49448b[_0xe980('0x2c')]=qs[_0xe980('0x2c')](_0x1f35ed['query'][_0xe980('0x2c')]);}_0x49448b[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x47')]);_0x49448b[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x1f35ed[_0xe980('0x3f')],_0x16422e[_0xe980('0x40')]),_0x577d17);if(_0x1f35ed[_0xe980('0x3f')][_0xe980('0x4a')]){_0x49448b[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x49448b['where'],{'$or':_['map'](_0x577d17,function(_0x8b1e4){if(_0x8b1e4[_0xe980('0x3c')]!==_0xe980('0x4c')){var _0x4a2544={};_0x4a2544[_0x8b1e4[_0xe980('0x35')]]={'$like':'%'+_0x1f35ed[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x4a2544;}})});}_0x49448b=_[_0xe980('0x4b')]({},_0x49448b,_0x1f35ed[_0xe980('0x4d')]);var _0x5e1b39={'where':_0x49448b[_0xe980('0x48')]};return db[_0xe980('0x39')][_0xe980('0x2b')](_0x5e1b39)['then'](function(_0x4f9504){_0x5c4626[_0xe980('0x2b')]=_0x4f9504;if(_0x1f35ed[_0xe980('0x3f')]['includeAll']){_0x49448b[_0xe980('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe980('0x4f')](_0x49448b);})['then'](function(_0x52c1b3){_0x5c4626[_0xe980('0x50')]=_0x52c1b3;return _0x5c4626;})[_0xe980('0x1c')](respondWithFilteredResult(_0x1faffe,_0x49448b))[_0xe980('0x26')](handleError(_0x1faffe,null));};exports[_0xe980('0x51')]=function(_0x713154,_0xc151aa){var _0x51df57={'raw':![],'where':{'id':_0x713154[_0xe980('0x52')]['id']},'include':[{'model':db[_0xe980('0x37')],'as':_0xe980('0x38')}]},_0x161a56={};_0x161a56[_0xe980('0x43')]=_['keys'](db[_0xe980('0x39')][_0xe980('0x3a')]);_0x161a56[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x713154[_0xe980('0x3f')]);_0x161a56[_0xe980('0x40')]=_[_0xe980('0x41')](_0x161a56['model'],_0x161a56[_0xe980('0x3f')]);_0x51df57[_0xe980('0x42')]=_[_0xe980('0x41')](_0x161a56[_0xe980('0x43')],qs[_0xe980('0x44')](_0x713154['query']['fields']));_0x51df57[_0xe980('0x42')]=_0x51df57[_0xe980('0x42')][_0xe980('0x54')]?_0x51df57[_0xe980('0x42')]:_0x161a56[_0xe980('0x43')];if(_0x713154[_0xe980('0x3f')]['includeAll']){_0x51df57[_0xe980('0x4e')]=[{'all':!![]}];}_0x51df57=_[_0xe980('0x4b')]({},_0x51df57,_0x713154[_0xe980('0x4d')]);return db[_0xe980('0x39')][_0xe980('0x55')](_0x51df57)[_0xe980('0x1c')](handleEntityNotFound(_0xc151aa,null))[_0xe980('0x1c')](respondWithResult(_0xc151aa,null))['catch'](handleError(_0xc151aa,null));};exports[_0xe980('0x56')]=function(_0x300877,_0x19d3e1){return db[_0xe980('0x39')]['create'](_0x300877[_0xe980('0x57')],{})[_0xe980('0x1c')](function(_0x358820){var _0x4831b0=_0x300877[_0xe980('0x58')][_0xe980('0x32')]({'plain':!![]});if(!_0x4831b0)throw new Error(_0xe980('0x59'));if(_0x4831b0[_0xe980('0x5a')]===_0xe980('0x58')){var _0x4275fc=_0x358820[_0xe980('0x32')]({'plain':!![]});var _0x299b9a=_0xe980('0x5b');return db[_0xe980('0x5c')][_0xe980('0x55')]({'where':{'name':_0x299b9a,'userProfileId':_0x4831b0[_0xe980('0x5d')]},'raw':!![]})[_0xe980('0x1c')](function(_0x1c1290){if(_0x1c1290&&_0x1c1290[_0xe980('0x5e')]===0x0){return db[_0xe980('0x5f')][_0xe980('0x56')]({'name':_0x4275fc['name'],'resourceId':_0x4275fc['id'],'type':_0x1c1290[_0xe980('0x35')],'sectionId':_0x1c1290['id']},{})[_0xe980('0x1c')](function(){return _0x358820;});}else{return _0x358820;}})[_0xe980('0x26')](function(_0x5b3f71){logger[_0xe980('0x21')](_0xe980('0x60'),_0x5b3f71);throw _0x5b3f71;});}return _0x358820;})[_0xe980('0x1c')](respondWithResult(_0x19d3e1,0xc9))['catch'](handleError(_0x19d3e1,null));};exports[_0xe980('0x61')]=function(_0x2a02bd,_0x188d68){if(_0x2a02bd[_0xe980('0x57')]['id']){delete _0x2a02bd['body']['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x2a02bd[_0xe980('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xe980('0x38')}]})[_0xe980('0x1c')](handleEntityNotFound(_0x188d68,null))[_0xe980('0x1c')](saveUpdates(_0x2a02bd[_0xe980('0x57')],null))[_0xe980('0x1c')](respondWithResult(_0x188d68,null))[_0xe980('0x26')](handleError(_0x188d68,null));};exports['destroy']=function(_0x17b346,_0x466093){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x17b346[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x466093,null))[_0xe980('0x1c')](removeEntity(_0x466093,null))[_0xe980('0x26')](handleError(_0x466093,null));};exports[_0xe980('0x62')]=function(_0x5adc6d,_0x269260){return db[_0xe980('0x39')]['describe']()[_0xe980('0x1c')](respondWithResult(_0x269260,null))[_0xe980('0x26')](handleError(_0x269260,null));};exports[_0xe980('0x63')]=function(_0x37cf72,_0x2b9dad,_0x47940b){if(_0x37cf72[_0xe980('0x57')]['id']){delete _0x37cf72[_0xe980('0x57')]['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x37cf72[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x2b9dad,null))[_0xe980('0x1c')](function(_0x3b4c8f){if(_0x3b4c8f){_0x37cf72[_0xe980('0x57')][_0xe980('0x64')]=_0x3b4c8f['id'];return db['Disposition'][_0xe980('0x56')](_0x37cf72[_0xe980('0x57')]);}})[_0xe980('0x1c')](respondWithResult(_0x2b9dad,null))['catch'](handleError(_0x2b9dad,null));};exports['getDispositions']=function(_0x5a6c4d,_0x7b79e2,_0x4e4159){var _0xfcfcef={'raw':![],'where':{}};var _0x3b44c2={};var _0x2597b4={'count':0x0,'rows':[]};return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x5a6c4d[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x7b79e2,null))['then'](function(_0x20d8ae){if(_0x20d8ae){_0x3b44c2[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x66')][_0xe980('0x3a')]);_0x3b44c2[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x5a6c4d[_0xe980('0x3f')]);_0x3b44c2[_0xe980('0x40')]=_[_0xe980('0x41')](_0x3b44c2['model'],_0x3b44c2[_0xe980('0x3f')]);_0xfcfcef[_0xe980('0x42')]=_[_0xe980('0x41')](_0x3b44c2[_0xe980('0x43')],qs[_0xe980('0x44')](_0x5a6c4d['query'][_0xe980('0x44')]));_0xfcfcef[_0xe980('0x42')]=_0xfcfcef['attributes'][_0xe980('0x54')]?_0xfcfcef[_0xe980('0x42')]:_0x3b44c2[_0xe980('0x43')];if(!_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x45')](_0xe980('0x67'))){_0xfcfcef[_0xe980('0x2d')]=qs['limit'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x2d')]);_0xfcfcef['offset']=qs['offset'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x2c')]);}_0xfcfcef[_0xe980('0x46')]=qs['sort'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x47')]);_0xfcfcef['where']=qs[_0xe980('0x40')](_['pick'](_0x5a6c4d[_0xe980('0x3f')],_0x3b44c2['filters']));_0xfcfcef[_0xe980('0x48')][_0xe980('0x64')]=_0x20d8ae['id'];if(_0x5a6c4d['query']['filter']){_0xfcfcef[_0xe980('0x48')]=_[_0xe980('0x4b')](_0xfcfcef[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0xfcfcef[_0xe980('0x42')],function(_0x1d2cdc){var _0x4720ed={};_0x4720ed[_0x1d2cdc]={'$like':'%'+_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x4720ed;})});}_0xfcfcef=_[_0xe980('0x4b')]({},_0xfcfcef,_0x5a6c4d[_0xe980('0x4d')]);return db[_0xe980('0x66')][_0xe980('0x2b')]({'where':_0xfcfcef[_0xe980('0x48')]})['then'](function(_0xa513f4){_0x2597b4['count']=_0xa513f4;if(_0x5a6c4d[_0xe980('0x3f')]['includeAll']){_0xfcfcef[_0xe980('0x4e')]=[{'all':!![]}];}return db[_0xe980('0x66')]['findAll'](_0xfcfcef);})['then'](function(_0x16a5af){_0x2597b4['rows']=_0x16a5af;return _0x2597b4;});}})['then'](respondWithFilteredResult(_0x7b79e2,_0xfcfcef))[_0xe980('0x26')](handleError(_0x7b79e2,null));};exports[_0xe980('0x68')]=function(_0x35f031,_0x48519e,_0x3c7e5a){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x35f031[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x48519e,null))[_0xe980('0x1c')](function(_0x36454f){if(_0x36454f){return _0x36454f['removeDispositions'](_0x35f031[_0xe980('0x3f')][_0xe980('0x69')]);}})['then'](respondWithStatusCode(_0x48519e,null))[_0xe980('0x26')](handleError(_0x48519e,null));};exports[_0xe980('0x6a')]=function(_0x2064f1,_0x4badad,_0x39c57b){if(_0x2064f1['body']['id']){delete _0x2064f1[_0xe980('0x57')]['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x2064f1[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x4badad,null))[_0xe980('0x1c')](function(_0x268536){if(_0x268536){_0x2064f1[_0xe980('0x57')]['OpenchannelAccountId']=_0x268536['id'];return db[_0xe980('0x6b')][_0xe980('0x56')](_0x2064f1[_0xe980('0x57')]);}})['then'](respondWithResult(_0x4badad,null))[_0xe980('0x26')](handleError(_0x4badad,null));};exports['getAnswers']=function(_0x64fc2c,_0x4f3321,_0x4ec8a1){var _0x52d1e1={'raw':![],'where':{}};var _0x3bccde={};var _0x5dc191={'count':0x0,'rows':[]};return db[_0xe980('0x39')]['findOne']({'where':{'id':_0x64fc2c[_0xe980('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f3321,null))[_0xe980('0x1c')](function(_0x355f70){if(_0x355f70){_0x3bccde[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x6b')][_0xe980('0x3a')]);_0x3bccde[_0xe980('0x3f')]=_['keys'](_0x64fc2c[_0xe980('0x3f')]);_0x3bccde[_0xe980('0x40')]=_[_0xe980('0x41')](_0x3bccde[_0xe980('0x43')],_0x3bccde[_0xe980('0x3f')]);_0x52d1e1[_0xe980('0x42')]=_[_0xe980('0x41')](_0x3bccde[_0xe980('0x43')],qs['fields'](_0x64fc2c['query'][_0xe980('0x44')]));_0x52d1e1[_0xe980('0x42')]=_0x52d1e1['attributes'][_0xe980('0x54')]?_0x52d1e1[_0xe980('0x42')]:_0x3bccde[_0xe980('0x43')];if(!_0x64fc2c[_0xe980('0x3f')]['hasOwnProperty'](_0xe980('0x67'))){_0x52d1e1[_0xe980('0x2d')]=qs['limit'](_0x64fc2c['query']['limit']);_0x52d1e1['offset']=qs['offset'](_0x64fc2c['query']['offset']);}_0x52d1e1[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x64fc2c[_0xe980('0x3f')][_0xe980('0x47')]);_0x52d1e1[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x64fc2c['query'],_0x3bccde[_0xe980('0x40')]));_0x52d1e1[_0xe980('0x48')][_0xe980('0x64')]=_0x355f70['id'];if(_0x64fc2c[_0xe980('0x3f')]['filter']){_0x52d1e1[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x52d1e1[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x52d1e1[_0xe980('0x42')],function(_0x2720ed){var _0x144b6d={};_0x144b6d[_0x2720ed]={'$like':'%'+_0x64fc2c['query'][_0xe980('0x4a')]+'%'};return _0x144b6d;})});}_0x52d1e1=_['merge']({},_0x52d1e1,_0x64fc2c[_0xe980('0x4d')]);return db[_0xe980('0x6b')][_0xe980('0x2b')]({'where':_0x52d1e1['where']})[_0xe980('0x1c')](function(_0x28d0b9){_0x5dc191[_0xe980('0x2b')]=_0x28d0b9;if(_0x64fc2c['query']['includeAll']){_0x52d1e1['include']=[{'all':!![]}];}return db[_0xe980('0x6b')][_0xe980('0x4f')](_0x52d1e1);})['then'](function(_0x44ecc8){_0x5dc191['rows']=_0x44ecc8;return _0x5dc191;});}})[_0xe980('0x1c')](respondWithFilteredResult(_0x4f3321,_0x52d1e1))[_0xe980('0x26')](handleError(_0x4f3321,null));};exports['removeAnswers']=function(_0x38bd68,_0x2c3e9c,_0x2b7854){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x38bd68['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x2c3e9c,null))[_0xe980('0x1c')](function(_0x27541a){if(_0x27541a){return _0x27541a[_0xe980('0x6c')](_0x38bd68['query'][_0xe980('0x69')]);}})[_0xe980('0x1c')](respondWithStatusCode(_0x2c3e9c,null))[_0xe980('0x26')](handleError(_0x2c3e9c,null));};exports[_0xe980('0x6d')]=function(_0x121730,_0x264d75,_0x4d05b5){var _0x1d3ce4={'body':_0x121730['body'],'channel':'openchannel'};var _0x11c964=[];var _0x5a4495=[];var _0x58124a={};var _0x4555f0=![];return db[_0xe980('0x6e')][_0xe980('0x62')]()[_0xe980('0x1c')](function(_0x3a547f){if(!_0x3a547f){throw new db['Sequelize'][(_0xe980('0x6f'))](_0xe980('0x70'));}_0x11c964=_[_0xe980('0x71')](_[_0xe980('0x53')](_0x3a547f),[_0xe980('0x72'),'updatedAt']);_0x5a4495=_[_0xe980('0x71')](_[_0xe980('0x53')](_0x3a547f),[_0xe980('0x72'),_0xe980('0x73'),_0xe980('0x74'),'ListId']);if(_0x121730['body']['id']){delete _0x121730[_0xe980('0x57')]['id'];}if(_[_0xe980('0x75')](_0x121730[_0xe980('0x57')][_0xe980('0x76')])){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x78'));}if(_['isNil'](_0x121730[_0xe980('0x57')][_0xe980('0x57')])||_0x121730[_0xe980('0x57')][_0xe980('0x57')]===''){throw new db[(_0xe980('0x77'))]['ValidationError'](_0xe980('0x79'));}if(_[_0xe980('0x75')](_0x121730['body']['mapKey'])){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x7a')+_0x5a4495);}if(!_[_0xe980('0x7b')](_0x5a4495,_0x121730[_0xe980('0x57')][_0xe980('0x7c')])){throw new db['Sequelize'][(_0xe980('0x6f'))](_0xe980('0x7d')+_0x5a4495);}_0x58124a[_0x121730[_0xe980('0x57')][_0xe980('0x7c')]]=_0x121730[_0xe980('0x57')][_0xe980('0x76')];})[_0xe980('0x1c')](function(){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x121730['params']['id']},'include':[{'model':db[_0xe980('0x7e')],'as':_0xe980('0x7f'),'include':[{'model':db[_0xe980('0x6e')],'as':_0xe980('0x80'),'where':_0x58124a,'limit':0x1,'order':[[_0xe980('0x73'),_0xe980('0x81')]]}]},{'model':db[_0xe980('0x82')],'as':_0xe980('0x83')}]});})[_0xe980('0x1c')](handleEntityNotFound(_0x264d75,null))[_0xe980('0x1c')](function(_0x59b327){if(_0x59b327&&_0x59b327[_0xe980('0x7f')]){_0x1d3ce4['account']=_0x59b327;_0x1d3ce4[_0xe980('0x84')]=_0x59b327[_0xe980('0x83')];_0x1d3ce4[_0xe980('0x85')]=_0x59b327[_0xe980('0x7f')];_0x1d3ce4['applications']=_[_0xe980('0x86')](_0x1d3ce4['applications'],[_0xe980('0x87')],[_0xe980('0x88')]);if(_0x1d3ce4['account'][_0xe980('0x83')]){delete _0x1d3ce4[_0xe980('0x89')][_0xe980('0x83')];}if(_0x1d3ce4[_0xe980('0x89')]['List']&&_0x1d3ce4[_0xe980('0x89')][_0xe980('0x7f')][_0xe980('0x80')][_0xe980('0x54')]){return _0x1d3ce4[_0xe980('0x89')][_0xe980('0x7f')]['Contacts'][0x0];}var _0x3dec9c=_[_0xe980('0x14')](_0x121730[_0xe980('0x57')],{'firstName':_0x121730[_0xe980('0x57')][_0xe980('0x76')],'ListId':_0x59b327[_0xe980('0x8a')]});_0x3dec9c[_0x121730[_0xe980('0x57')]['mapKey']]=_0x121730[_0xe980('0x57')][_0xe980('0x76')];return db['CmContact']['create'](_0x3dec9c,{'fields':_0x11c964,'raw':!![]});}})[_0xe980('0x1c')](handleEntityNotFound(_0x264d75,null))[_0xe980('0x1c')](function(_0x529f39){_0x1d3ce4['contact']=_0x529f39;if(_0x529f39){var _0x2b2727={'ContactId':_0x529f39['id'],'OpenchannelAccountId':_0x121730[_0xe980('0x52')]['id'],'from':(_0x529f39['firstName']||'')+'\x20'+(_0x529f39['lastName']||'')};var _0x135341={'OpenchannelAccountId':_0x121730['params']['id'],'closed':![]};if(_0x121730[_0xe980('0x57')][_0xe980('0x8b')]){_0x135341[_0xe980('0x8b')]=_0x121730['body'][_0xe980('0x8b')];return db[_0xe980('0x8c')][_0xe980('0x55')]({'where':_0x135341})[_0xe980('0x1c')](function(_0x29ce47){if(_0x29ce47){return[_0x29ce47,![]];}_0x2b2727[_0xe980('0x8b')]=_0x121730['body'][_0xe980('0x8b')];_0x2b2727[_0xe980('0x8d')]=_0x121730[_0xe980('0x57')][_0xe980('0x8d')];return db[_0xe980('0x8c')][_0xe980('0x56')](_0x2b2727)[_0xe980('0x1c')](function(_0x5c2247){return[_0x5c2247,!![]];});});}else{_0x135341['threadId']=null;}_0x135341[_0xe980('0x8e')]=_0x529f39['id'];return db[_0xe980('0x8c')][_0xe980('0x55')]({'where':_0x135341})[_0xe980('0x1c')](function(_0xb157d6){if(_0xb157d6){return[_0xb157d6,![]];}return db[_0xe980('0x8c')][_0xe980('0x56')](_0x2b2727)[_0xe980('0x1c')](function(_0x17f37b){return[_0x17f37b,!![]];});});}})[_0xe980('0x8f')](function(_0x44610a,_0x56da6a){if(_0x44610a){_0x4555f0=_0x56da6a;if(!_0x56da6a){var _0x10fd1b={'from':(_0x1d3ce4[_0xe980('0x90')][_0xe980('0x91')]||'')+'\x20'+(_0x1d3ce4['contact'][_0xe980('0x92')]||'')};if(_0x121730[_0xe980('0x57')][_0xe980('0x8b')]&&_0x121730[_0xe980('0x57')][_0xe980('0x93')]&&_0x121730[_0xe980('0x57')][_0xe980('0x8b')]!=_0x121730[_0xe980('0x57')][_0xe980('0x93')]){_0x10fd1b[_0xe980('0x8b')]=_0x121730[_0xe980('0x57')][_0xe980('0x93')];}return _0x44610a[_0xe980('0x61')](_0x10fd1b);}else{return _0x44610a;}}})[_0xe980('0x1c')](function(_0x52f6ae){_0x1d3ce4[_0xe980('0x94')]=_0x52f6ae[_0xe980('0x32')]({'plain':!![]});_0x1d3ce4[_0xe980('0x94')][_0xe980('0x95')]=_0x4555f0;if(_0x1d3ce4['interaction'][_0xe980('0x95')]){if(_0x1d3ce4['account'][_0xe980('0x96')]){_0x1d3ce4[_0xe980('0x84')]['push']({'id':0x0,'priority':_0x1d3ce4[_0xe980('0x84')][_0xe980('0x54')]+0x1,'app':_0xe980('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xe980('0x98')]['create']({'body':_0x121730[_0xe980('0x57')][_0xe980('0x57')],'OpenchannelAccountId':_0x121730[_0xe980('0x52')]['id'],'OpenchannelInteractionId':_0x52f6ae['id'],'direction':'in','ContactId':_0x1d3ce4['contact']['id'],'AttachmentId':_0x121730[_0xe980('0x57')]['AttachmentId']});})[_0xe980('0x1c')](function(_0x35547a){_0x1d3ce4[_0xe980('0x23')]=_0x35547a;if(!_0x1d3ce4['interaction']['UserId'])return;return db[_0xe980('0x99')]['find']({'attributes':['id',_0xe980('0x35')],'where':{'id':_0x1d3ce4[_0xe980('0x94')][_0xe980('0x9a')]}});})[_0xe980('0x1c')](function(_0x3f3ea2){if(_0x3f3ea2){_0x1d3ce4[_0xe980('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f3ea2['name']+','+(_0x1d3ce4[_0xe980('0x89')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1d3ce4[_0xe980('0x94')][_0xe980('0x9b')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1d3ce4[_0xe980('0x94')]['queueId']}});})['then'](function(_0x233545){if(_0x233545){_0x1d3ce4['applications'][_0xe980('0x9c')]({'id':0x0,'priority':0x1,'app':_0xe980('0x9d'),'appdata':_0x233545[_0xe980('0x35')]+','+(_0x1d3ce4['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe980('0x9e'),_0xe980('0x9f'),_0x1d3ce4);})[_0xe980('0x1c')](function(_0x200eb1){respondWithRpcPromise(_0xe980('0xa0'),_0xe980('0xa0'),{'event':_0xe980('0x6d'),'message':_0x200eb1},client9002);return _0x200eb1;})['then'](respondWithResult(_0x264d75,null))['catch'](handleError(_0x264d75,null));};exports['addApplications']=function(_0x267ac6,_0x117a74){var _0x4ce90a=_0x267ac6[_0xe980('0x52')]['id'];var _0x287d62=_0x267ac6[_0xe980('0x57')];var _0xe12d31=0xc8;var _0xc9b6a3=null;return db[_0xe980('0xa1')][_0xe980('0xa2')]({'isolationLevel':db[_0xe980('0xa1')][_0xe980('0xa3')]['ISOLATION_LEVELS'][_0xe980('0xa4')]},function(_0x39c140){return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x4ce90a},'transaction':_0x39c140})[_0xe980('0x1c')](function(_0x42acb7){if(_0x42acb7){return db['OpenchannelApplication'][_0xe980('0x31')]({'where':{'OpenchannelAccountId':_0x4ce90a},'transaction':_0x39c140})[_0xe980('0x1c')](function(){var _0x464c04=_[_0xe980('0x3e')](_0x287d62,function(_0x53017f){_0x53017f[_0xe980('0x64')]=_0x4ce90a;return _0x53017f;});return db[_0xe980('0x82')][_0xe980('0xa5')](_0x464c04,{'transaction':_0x39c140});});}else{_0xe12d31=0x194;_0xc9b6a3=[];}});})['then'](function(){if(_0xe12d31!==0x194){return db[_0xe980('0x82')][_0xe980('0xa6')]({'where':{'OpenchannelAccountId':_0x4ce90a},'order':_0xe980('0x87')})[_0xe980('0x1c')](function(_0xbb0b87){_0xc9b6a3=_0xbb0b87;});}})[_0xe980('0x26')](function(_0x4f2d6e){_0xe12d31=0x1f4;logger[_0xe980('0x21')](_0x4f2d6e['stack']);if(_0x4f2d6e[_0xe980('0x35')]){delete _0x4f2d6e[_0xe980('0x35')];}_0xc9b6a3=_0x4f2d6e;})['finally'](function(){if(_0xc9b6a3===null){_0x117a74[_0xe980('0x33')](_0xe12d31);}else{if(_0xe12d31===0x1f4){_0x117a74['status'](_0xe12d31)[_0xe980('0xa7')](_0xc9b6a3);}else{_0x117a74[_0xe980('0x27')](_0xe12d31)['json'](_0xc9b6a3);}}});};exports[_0xe980('0xa8')]=function(_0x3ce2b5,_0x536a59,_0x2da697){var _0x16193b={};var _0x7f4f1b={};var _0x23e593;var _0x4b94ec;return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x3ce2b5['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x536a59,null))[_0xe980('0x1c')](function(_0x37fa02){if(_0x37fa02){_0x23e593=_0x37fa02;_0x7f4f1b[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x82')]['rawAttributes']);_0x7f4f1b[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x3ce2b5[_0xe980('0x3f')]);_0x7f4f1b[_0xe980('0x40')]=_[_0xe980('0x41')](_0x7f4f1b[_0xe980('0x43')],_0x7f4f1b[_0xe980('0x3f')]);_0x16193b['attributes']=_['intersection'](_0x7f4f1b['model'],qs[_0xe980('0x44')](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x44')]));_0x16193b[_0xe980('0x42')]=_0x16193b[_0xe980('0x42')][_0xe980('0x54')]?_0x16193b[_0xe980('0x42')]:_0x7f4f1b['model'];_0x16193b[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x47')]);_0x16193b[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x3ce2b5[_0xe980('0x3f')],_0x7f4f1b[_0xe980('0x40')]));if(_0x3ce2b5[_0xe980('0x3f')]['filter']){_0x16193b[_0xe980('0x48')]=_['merge'](_0x16193b['where'],{'$or':_[_0xe980('0x3e')](_0x16193b[_0xe980('0x42')],function(_0x43b52e){var _0x38c0e5={};_0x38c0e5[_0x43b52e]={'$like':'%'+_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x38c0e5;})});}_0x16193b=_[_0xe980('0x4b')]({},_0x16193b,_0x3ce2b5['options']);return _0x23e593[_0xe980('0xa8')](_0x16193b);}})['then'](function(_0xc0f474){if(_0xc0f474){_0x4b94ec=_0xc0f474[_0xe980('0x54')];if(!_0x3ce2b5[_0xe980('0x3f')]['hasOwnProperty']('nolimit')){_0x16193b[_0xe980('0x2d')]=qs[_0xe980('0x2d')](_0x3ce2b5['query'][_0xe980('0x2d')]);_0x16193b[_0xe980('0x2c')]=qs['offset'](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x2c')]);}return _0x23e593['getApplications'](_0x16193b);}})['then'](function(_0x1c84da){if(_0x1c84da){return _0x1c84da?{'count':_0x4b94ec,'rows':_0x1c84da}:null;}})[_0xe980('0x1c')](respondWithResult(_0x536a59,null))[_0xe980('0x26')](handleError(_0x536a59,null));};exports[_0xe980('0xa9')]=function(_0x5277c8,_0x5f5621,_0x12d554){var _0x3886bd={'raw':![],'where':{}};var _0x3cee6c={};var _0x41511b={'count':0x0,'rows':[]};return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x5277c8[_0xe980('0x52')]['id']}})['then'](handleEntityNotFound(_0x5f5621,null))['then'](function(_0x19cd4d){if(_0x19cd4d){_0x3cee6c[_0xe980('0x43')]=_['keys'](db[_0xe980('0x8c')][_0xe980('0x3a')]);_0x3cee6c[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x5277c8[_0xe980('0x3f')]);_0x3cee6c[_0xe980('0x40')]=_['intersection'](_0x3cee6c[_0xe980('0x43')],_0x3cee6c['query']);_0x3886bd[_0xe980('0x42')]=_['intersection'](_0x3cee6c[_0xe980('0x43')],qs[_0xe980('0x44')](_0x5277c8['query'][_0xe980('0x44')]));_0x3886bd['attributes']=_0x3886bd[_0xe980('0x42')][_0xe980('0x54')]?_0x3886bd[_0xe980('0x42')]:_0x3cee6c[_0xe980('0x43')];if(!_0x5277c8[_0xe980('0x3f')][_0xe980('0x45')]('nolimit')){_0x3886bd['limit']=qs[_0xe980('0x2d')](_0x5277c8[_0xe980('0x3f')][_0xe980('0x2d')]);_0x3886bd[_0xe980('0x2c')]=qs[_0xe980('0x2c')](_0x5277c8['query']['offset']);}_0x3886bd[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x5277c8[_0xe980('0x3f')][_0xe980('0x47')]);_0x3886bd[_0xe980('0x48')]=qs[_0xe980('0x40')](_['pick'](_0x5277c8['query'],_0x3cee6c['filters']));_0x3886bd[_0xe980('0x48')][_0xe980('0x64')]=_0x19cd4d['id'];if(_0x5277c8[_0xe980('0x3f')][_0xe980('0x4a')]){_0x3886bd[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x3886bd[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x3886bd[_0xe980('0x42')],function(_0x469d76){var _0x42d08e={};_0x42d08e[_0x469d76]={'$like':'%'+_0x5277c8[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x42d08e;})});}_0x3886bd=_[_0xe980('0x4b')]({},_0x3886bd,_0x5277c8[_0xe980('0x4d')]);return db['OpenchannelInteraction'][_0xe980('0x2b')]({'where':_0x3886bd['where']})[_0xe980('0x1c')](function(_0x52ce8f){_0x41511b[_0xe980('0x2b')]=_0x52ce8f;if(_0x5277c8[_0xe980('0x3f')]['includeAll']){_0x3886bd[_0xe980('0x4e')]=[{'model':db['CmContact'],'as':_0xe980('0xaa'),'required':![]},{'model':db[_0xe980('0x99')],'as':_0xe980('0xab'),'attributes':[_0xe980('0x35'),_0xe980('0xac'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe980('0x35'),_0xe980('0xad')],'where':_0x5277c8[_0xe980('0x3f')]['tag']?{'id':_0x5277c8['query']['tag']}:undefined,'required':_0x5277c8[_0xe980('0x3f')][_0xe980('0xae')]?!![]:![]}];}return db[_0xe980('0x8c')][_0xe980('0x4f')](_0x3886bd);})[_0xe980('0x1c')](function(_0x226f13){_0x41511b[_0xe980('0x50')]=_0x226f13;return _0x41511b;});}})['then'](respondWithFilteredResult(_0x5f5621,_0x3886bd))[_0xe980('0x26')](handleError(_0x5f5621,null));};exports[_0xe980('0xaf')]=function(_0x140306,_0x6b23f,_0x19c75a){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x140306['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x6b23f,null))[_0xe980('0x1c')](function(_0x100ee3){if(_0x100ee3){return _0x100ee3[_0xe980('0xaf')](_0x140306[_0xe980('0x57')][_0xe980('0x69')],_[_0xe980('0xb0')](_0x140306[_0xe980('0x57')],[_0xe980('0x69'),'id'])||{})[_0xe980('0x8f')](function(_0x4de543){for(var _0x189280=0x0;_0x189280<_0x140306[_0xe980('0x57')][_0xe980('0x69')]['length'];_0x189280+=0x1){socket[_0xe980('0xb1')](_0xe980('0xb2'),{'UserId':Number(_0x140306[_0xe980('0x57')][_0xe980('0x69')][_0x189280]),'OpenchannelAccountId':Number(_0x140306[_0xe980('0x52')]['id'])});}return _0x4de543;});}})[_0xe980('0x1c')](respondWithResult(_0x6b23f,null))[_0xe980('0x26')](handleError(_0x6b23f,null));};exports[_0xe980('0xb3')]=function(_0x18ba64,_0x44d7f8,_0x1f44ba){return db['OpenchannelAccount'][_0xe980('0x55')]({'where':{'id':_0x18ba64['params']['id']}})['then'](handleEntityNotFound(_0x44d7f8,null))['then'](function(_0x1a3b21){if(_0x1a3b21){return _0x1a3b21[_0xe980('0xb3')](_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')])['then'](function(){if(_['isArray'](_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')])){for(var _0x5ecab4=0x0;_0x5ecab4<_0x18ba64['query']['ids']['length'];_0x5ecab4+=0x1){socket[_0xe980('0xb1')](_0xe980('0xb4'),{'UserId':Number(_0x18ba64[_0xe980('0x3f')]['ids'][_0x5ecab4]),'OpenchannelAccountId':Number(_0x18ba64[_0xe980('0x52')]['id'])});}}else{socket['emit'](_0xe980('0xb4'),{'UserId':Number(_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')]),'OpenchannelAccountId':Number(_0x18ba64['params']['id'])});}});}})[_0xe980('0x1c')](respondWithStatusCode(_0x44d7f8,null))['catch'](handleError(_0x44d7f8,null));};exports[_0xe980('0xb5')]=function(_0xf87ca3,_0xeb1e9a,_0x539621){var _0x4d0918={};var _0x1fbe46={};var _0x3ccf57;var _0x31e50a;return db[_0xe980('0x39')]['findOne']({'where':{'id':_0xf87ca3[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0xeb1e9a,null))[_0xe980('0x1c')](function(_0x2ba463){if(_0x2ba463){_0x3ccf57=_0x2ba463;_0x1fbe46[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x99')][_0xe980('0x3a')]);_0x1fbe46[_0xe980('0x3f')]=_[_0xe980('0x53')](_0xf87ca3['query']);_0x1fbe46[_0xe980('0x40')]=_['intersection'](_0x1fbe46['model'],_0x1fbe46[_0xe980('0x3f')]);_0x4d0918[_0xe980('0x42')]=_[_0xe980('0x41')](_0x1fbe46[_0xe980('0x43')],qs['fields'](_0xf87ca3[_0xe980('0x3f')]['fields']));_0x4d0918['attributes']=_0x4d0918[_0xe980('0x42')]['length']?_0x4d0918[_0xe980('0x42')]:_0x1fbe46[_0xe980('0x43')];_0x4d0918[_0xe980('0x46')]=qs['sort'](_0xf87ca3[_0xe980('0x3f')]['sort']);_0x4d0918[_0xe980('0x48')]=qs['filters'](_[_0xe980('0x49')](_0xf87ca3['query'],_0x1fbe46[_0xe980('0x40')]));if(_0xf87ca3['query'][_0xe980('0x4a')]){_0x4d0918[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x4d0918[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x4d0918['attributes'],function(_0x1ce9d9){var _0x3e8efc={};_0x3e8efc[_0x1ce9d9]={'$like':'%'+_0xf87ca3['query']['filter']+'%'};return _0x3e8efc;})});}_0x4d0918=_[_0xe980('0x4b')]({},_0x4d0918,_0xf87ca3['options']);return _0x3ccf57[_0xe980('0xb5')](_0x4d0918);}})[_0xe980('0x1c')](function(_0x1ee44d){if(_0x1ee44d){_0x31e50a=_0x1ee44d[_0xe980('0x54')];if(!_0xf87ca3[_0xe980('0x3f')][_0xe980('0x45')](_0xe980('0x67'))){_0x4d0918['limit']=qs[_0xe980('0x2d')](_0xf87ca3[_0xe980('0x3f')]['limit']);_0x4d0918['offset']=qs[_0xe980('0x2c')](_0xf87ca3['query'][_0xe980('0x2c')]);}return _0x3ccf57[_0xe980('0xb5')](_0x4d0918);}})[_0xe980('0x1c')](function(_0x1e5b16){if(_0x1e5b16){return _0x1e5b16?{'count':_0x31e50a,'rows':_0x1e5b16}:null;}})['then'](respondWithResult(_0xeb1e9a,null))[_0xe980('0x26')](handleError(_0xeb1e9a,null));};exports[_0xe980('0xa7')]=function(_0x1cca5b,_0x1e05b4,_0x165db5){var _0x561f0e,_0x55a00f,_0x278278;if(_['isNil'](_0x1cca5b['body'][_0xe980('0x57')])||_0x1cca5b['body'][_0xe980('0x57')]===''){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x79'));}if(_[_0xe980('0x75')](_0x1cca5b['body']['to'])){}_0x561f0e=_0x1cca5b[_0xe980('0x57')]['to'];return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x1cca5b[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x210d98){if(_0x210d98){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x210d98['id']},'include':[{'model':db['CmList'],'as':_0xe980('0x7f'),'include':[{'model':db[_0xe980('0x6e')],'as':'Contacts','where':{[_0x210d98[_0xe980('0x7c')]]:_0x561f0e},'limit':0x1,'order':[[_0xe980('0x73'),_0xe980('0x81')]]}]}]})['then'](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x8710df){if(_0x8710df&&_0x8710df[_0xe980('0x7f')]){_0x55a00f=_0x8710df[_0xe980('0x32')]({'plain':!![]});if(_0x55a00f[_0xe980('0x7f')]&&_0x55a00f['List'][_0xe980('0x80')][_0xe980('0x54')]){return _0x55a00f['List'][_0xe980('0x80')][0x0];}return db['CmContact'][_0xe980('0x56')](_[_0xe980('0x14')](_0x1cca5b[_0xe980('0x57')],{'firstName':_0x561f0e,[_0x8710df[_0xe980('0x7c')]]:_0x561f0e,'phone':_0x561f0e,'ListId':_0x55a00f['ListId']}));}})['then'](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x5e0b70){if(_0x5e0b70){_0x278278=_0x5e0b70;return db[_0xe980('0x8c')]['find']({'where':{'ContactId':_0x278278['id'],'closed':![],'OpenchannelAccountId':_0x55a00f['id']}})[_0xe980('0x1c')](function(_0x397fbd){if(_0x397fbd){return[_0x397fbd,![]];}return db['OpenchannelInteraction'][_0xe980('0x56')]({'UserId':_0x1cca5b['user']['id'],'ContactId':_0x278278['id'],'OpenchannelAccountId':_0x55a00f['id'],'lastMsgDirection':_0xe980('0xb6'),'firstMsgDirection':_0xe980('0xb6'),'Messages':[_[_0xe980('0x4b')](_0x1cca5b[_0xe980('0x57')],{'read':![],'body':_0x1cca5b['body'][_0xe980('0x57')],'OpenchannelAccountId':_0x55a00f['id'],'UserId':_0x1cca5b['user']['id'],'ContactId':_0x278278['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xe980('0xb7')}]})[_0xe980('0x1c')](function(_0x4afe95){return[_0x4afe95,!![]];});});}})['spread'](function(_0x189a78,_0x43d09f){if(_0x43d09f){return _0x189a78;}return db[_0xe980('0x98')][_0xe980('0x56')](_[_0xe980('0x4b')](_0x1cca5b[_0xe980('0x57')],{'read':![],'body':_0x1cca5b['body']['body'],'OpenchannelAccountId':_0x55a00f['id'],'OpenchannelInteractionId':_0x189a78['id'],'UserId':_0x1cca5b[_0xe980('0x58')]['id'],'ContactId':_0x278278['id']}))[_0xe980('0x1c')](function(_0x2f79c4){_0x189a78[_0xe980('0xb8')][_0xe980('0xb7')]=[];_0x189a78[_0xe980('0xb8')][_0xe980('0xb7')][_0xe980('0xb9')](_0x2f79c4[_0xe980('0xb8')]);return _0x189a78;});});}})[_0xe980('0x1c')](respondWithResult(_0x1e05b4,null))['catch'](handleError(_0x1e05b4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 624c1cb..6968b16 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 _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x668b,0x140));var _0xb668=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x668b[_0x4a6cf8];return _0x22205e;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0xb688,0xcf));var _0x8b68=function(_0x4d8180,_0x5a3702){_0x4d8180=_0x4d8180-0x0;var _0x3695fe=_0xb688[_0x4d8180];return _0x3695fe;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5d59a51..19ba70d 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(_0x11c21a,_0x24c0d5){var _0xf64c5f=function(_0x357b35){while(--_0x357b35){_0x11c21a['push'](_0x11c21a['shift']());}};_0xf64c5f(++_0x24c0d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x39e25b,_0x71e0d3){var _0x1649c3=function(_0x1f1176){while(--_0x1f1176){_0x39e25b['push'](_0x39e25b['shift']());}};_0x1649c3(++_0x71e0d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 cb00799..cd5db3e 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 _0x3264=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3264,0x7f));var _0x4326=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x3264[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});config['redis']=_[_0x4326('0x9')](config[_0x4326('0xa')],{'host':_0x4326('0xb'),'port':0x18eb});var socket=require(_0x4326('0xc'))(new Redis(config[_0x4326('0xa')]));require(_0x4326('0xd'))[_0x4326('0xe')](socket);function respondWithRpcPromise(_0x5cde0b,_0x58bade,_0x51323a){return new BPromise(function(_0x97d63e,_0x9daa3f){return client[_0x4326('0xf')](_0x5cde0b,_0x51323a)['then'](function(_0x5ac227){logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));logger[_0x4326('0x12')](_0x4326('0x13'),_0x58bade,'request\x20sent',JSON['stringify'](_0x5ac227));if(_0x5ac227[_0x4326('0x14')]){if(_0x5ac227['error']['code']===0x1f4){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);return _0x9daa3f(_0x5ac227['error'][_0x4326('0x16')]);}logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227['error'][_0x4326('0x16')]);return _0x97d63e(_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);}else{logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));_0x97d63e(_0x5ac227['result'][_0x4326('0x16')]);}})[_0x4326('0x17')](function(_0x35f24b){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x35f24b);_0x9daa3f(_0x35f24b);});});} \ No newline at end of file +var _0x2b65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x2b65,0x131));var _0x52b6=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0x2b65[_0x1b00d0];return _0x31446c;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});config[_0x52b6('0xd')]=_[_0x52b6('0xe')](config[_0x52b6('0xd')],{'host':_0x52b6('0xf'),'port':0x18eb});var socket=require(_0x52b6('0x10'))(new Redis(config['redis']));require(_0x52b6('0x11'))[_0x52b6('0x12')](socket);function respondWithRpcPromise(_0x18b34d,_0x4d6d94,_0x19d1d9){return new BPromise(function(_0x2bb857,_0x19f475){return client[_0x52b6('0x13')](_0x18b34d,_0x19d1d9)['then'](function(_0xf91209){logger[_0x52b6('0x14')](_0x52b6('0x15'),_0x4d6d94,'request\x20sent');logger[_0x52b6('0x16')](_0x52b6('0x17'),_0x4d6d94,'request\x20sent',JSON[_0x52b6('0x18')](_0xf91209));if(_0xf91209['error']){if(_0xf91209['error'][_0x52b6('0x19')]===0x1f4){logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x19f475(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x2bb857(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}else{logger['info'](_0x52b6('0x15'),_0x4d6d94,_0x52b6('0x1c'));_0x2bb857(_0xf91209[_0x52b6('0x1d')]['message']);}})[_0x52b6('0x1e')](function(_0x184ee8){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4d6d94,_0x184ee8);_0x19f475(_0x184ee8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 87039a0..0c013c1 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 _0x3164=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3164,0x182));var _0x4316=function(_0xd701c6,_0x20625a){_0xd701c6=_0xd701c6-0x0;var _0x44092b=_0x3164[_0xd701c6];return _0x44092b;};'use strict';var OpenchannelAccountEvents=require(_0x4316('0x0'));var events=[_0x4316('0x1'),_0x4316('0x2'),_0x4316('0x3')];function createListener(_0x169d29,_0x588480){return function(_0x2534d3){_0x588480[_0x4316('0x4')](_0x169d29,_0x2534d3);};}function removeListener(_0x1235d9,_0x56124c){return function(){OpenchannelAccountEvents['removeListener'](_0x1235d9,_0x56124c);};}exports[_0x4316('0x5')]=function(_0x25827b){for(var _0xf88ba4=0x0,_0x29c3c1=events[_0x4316('0x6')];_0xf88ba4<_0x29c3c1;_0xf88ba4++){var _0x473cd2=events[_0xf88ba4];var _0x1bcd38=createListener(_0x4316('0x7')+_0x473cd2,_0x25827b);OpenchannelAccountEvents['on'](_0x473cd2,_0x1bcd38);}}; \ No newline at end of file +var _0x04d0=['register','length','remove','update'];(function(_0x114b6d,_0x18865f){var _0x3fc999=function(_0x3bd600){while(--_0x3bd600){_0x114b6d['push'](_0x114b6d['shift']());}};_0x3fc999(++_0x18865f);}(_0x04d0,0x10a));var _0x004d=function(_0x4c912f,_0x7dfe2){_0x4c912f=_0x4c912f-0x0;var _0x41be02=_0x04d0[_0x4c912f];return _0x41be02;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x004d('0x0'),_0x004d('0x1')];function createListener(_0x421661,_0x386bc3){return function(_0x1c0219){_0x386bc3['emit'](_0x421661,_0x1c0219);};}function removeListener(_0x516d73,_0x2638dd){return function(){OpenchannelAccountEvents['removeListener'](_0x516d73,_0x2638dd);};}exports[_0x004d('0x2')]=function(_0x285754){for(var _0x4a3878=0x0,_0x36e8bd=events[_0x004d('0x3')];_0x4a3878<_0x36e8bd;_0x4a3878++){var _0x4d0ae4=events[_0x4a3878];var _0x1f0efd=createListener('openchannelAccount:'+_0x4d0ae4,_0x285754);OpenchannelAccountEvents['on'](_0x4d0ae4,_0x1f0efd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 752cdcf..f576a96 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 _0x4b39=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5a3b01,_0xe61a44){var _0x18f052=function(_0x2928e7){while(--_0x2928e7){_0x5a3b01['push'](_0x5a3b01['shift']());}};_0x18f052(++_0xe61a44);}(_0x4b39,0x187));var _0x94b3=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0x4b39[_0x5cb71a];return _0x3f380f;};'use strict';var multer=require(_0x94b3('0x0'));var util=require(_0x94b3('0x1'));var path=require('path');var timeout=require(_0x94b3('0x2'));var express=require(_0x94b3('0x3'));var router=express[_0x94b3('0x4')]();var fs_extra=require(_0x94b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x94b3('0x6'));var config=require(_0x94b3('0x7'));var controller=require(_0x94b3('0x8'));router[_0x94b3('0x9')]('/',auth[_0x94b3('0xa')](),controller[_0x94b3('0xb')]);router[_0x94b3('0x9')](_0x94b3('0xc'),auth['isAuthenticated'](),controller[_0x94b3('0xd')]);router['post']('/',auth[_0x94b3('0xa')](),controller[_0x94b3('0xe')]);router[_0x94b3('0xf')](_0x94b3('0xc'),auth[_0x94b3('0xa')](),controller[_0x94b3('0x10')]);router[_0x94b3('0x11')]('/:id',auth[_0x94b3('0xa')](),controller['destroy']);module[_0x94b3('0x12')]=router; \ No newline at end of file +var _0xb06c=['../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','show','post','create','update','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x439662,_0x5defdb){var _0x251ec4=function(_0x499549){while(--_0x499549){_0x439662['push'](_0x439662['shift']());}};_0x251ec4(++_0x5defdb);}(_0xb06c,0x19b));var _0xcb06=function(_0x4c5c8d,_0x18945e){_0x4c5c8d=_0x4c5c8d-0x0;var _0x311870=_0xb06c[_0x4c5c8d];return _0x311870;};'use strict';var multer=require(_0xcb06('0x0'));var util=require(_0xcb06('0x1'));var path=require(_0xcb06('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb06('0x3'));var router=express[_0xcb06('0x4')]();var fs_extra=require(_0xcb06('0x5'));var auth=require(_0xcb06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb06('0x7'));var controller=require(_0xcb06('0x8'));router['get']('/',auth[_0xcb06('0x9')](),controller[_0xcb06('0xa')]);router[_0xcb06('0xb')]('/:id',auth[_0xcb06('0x9')](),controller[_0xcb06('0xc')]);router[_0xcb06('0xd')]('/',auth[_0xcb06('0x9')](),controller[_0xcb06('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcb06('0xf')]);router[_0xcb06('0x10')](_0xcb06('0x11'),auth[_0xcb06('0x9')](),controller['destroy']);module[_0xcb06('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a1fe825..e5addbc 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 _0x06fe=['noop','TEXT','sequelize','STRING'];(function(_0x51e6c4,_0xf836c8){var _0xb40ee8=function(_0x46d12f){while(--_0x46d12f){_0x51e6c4['push'](_0x51e6c4['shift']());}};_0xb40ee8(++_0xf836c8);}(_0x06fe,0x146));var _0xe06f=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x06fe[_0x51b661];return _0x5d1971;};'use strict';var Sequelize=require(_0xe06f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe06f('0x1')],'allowNull':![],'defaultValue':_0xe06f('0x2')},'appdata':{'type':Sequelize[_0xe06f('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe06f('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x10cc=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0xcdc1e6,_0x396348){var _0x2099cf=function(_0x3dabdf){while(--_0x3dabdf){_0xcdc1e6['push'](_0xcdc1e6['shift']());}};_0x2099cf(++_0x396348);}(_0x10cc,0xf7));var _0xc10c=function(_0x173aee,_0x7a5b2b){_0x173aee=_0x173aee-0x0;var _0x493d5e=_0x10cc[_0x173aee];return _0x493d5e;};'use strict';var Sequelize=require('sequelize');module[_0xc10c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc10c('0x1')],'allowNull':![],'defaultValue':_0xc10c('0x2')},'appdata':{'type':Sequelize[_0xc10c('0x3')]()},'description':{'type':Sequelize[_0xc10c('0x1')]},'interval':{'type':Sequelize[_0xc10c('0x1')],'defaultValue':_0xc10c('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 780a4fd..2a09c2c 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 _0x424a=['json','apply','save','update','destroy','then','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x3b33cd,_0x4ca853){var _0x25ddfd=function(_0x1ab147){while(--_0x1ab147){_0x3b33cd['push'](_0x3b33cd['shift']());}};_0x25ddfd(++_0x4ca853);}(_0x424a,0x199));var _0xa424=function(_0x4dfc30,_0x2f8ea3){_0x4dfc30=_0x4dfc30-0x0;var _0x4cabbe=_0x424a[_0x4dfc30];return _0x4cabbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa424('0x0'));var zipdir=require(_0xa424('0x1'));var jsonpatch=require(_0xa424('0x2'));var rp=require(_0xa424('0x3'));var moment=require('moment');var BPromise=require(_0xa424('0x4'));var Mustache=require(_0xa424('0x5'));var util=require('util');var path=require(_0xa424('0x6'));var sox=require(_0xa424('0x7'));var csv=require(_0xa424('0x8'));var ejs=require(_0xa424('0x9'));var fs=require('fs');var fs_extra=require(_0xa424('0xa'));var _=require('lodash');var squel=require(_0xa424('0xb'));var crypto=require(_0xa424('0xc'));var jsforce=require(_0xa424('0xd'));var deskjs=require(_0xa424('0xe'));var toCsv=require(_0xa424('0x8'));var querystring=require(_0xa424('0xf'));var Papa=require('papaparse');var Redis=require(_0xa424('0x10'));var authService=require(_0xa424('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa424('0x12'));var hardwareService=require(_0xa424('0x13'));var logger=require(_0xa424('0x14'))(_0xa424('0x15'));var utils=require(_0xa424('0x16'));var config=require(_0xa424('0x17'));var licenseUtil=require(_0xa424('0x18'));var db=require(_0xa424('0x19'))['db'];function respondWithStatusCode(_0x30fd71,_0x3b7019){_0x3b7019=_0x3b7019||0xcc;return function(_0x2681fb){if(_0x2681fb){return _0x30fd71[_0xa424('0x1a')](_0x3b7019);}return _0x30fd71[_0xa424('0x1b')](_0x3b7019)[_0xa424('0x1c')]();};}function respondWithResult(_0x45673c,_0x29f859){_0x29f859=_0x29f859||0xc8;return function(_0x21f7e1){if(_0x21f7e1){return _0x45673c[_0xa424('0x1b')](_0x29f859)['json'](_0x21f7e1);}};}function respondWithFilteredResult(_0x1fe2ba,_0x255141){return function(_0x228b7a){if(_0x228b7a){var _0x162e68=typeof _0x255141[_0xa424('0x1d')]===_0xa424('0x1e')&&typeof _0x255141[_0xa424('0x1f')]===_0xa424('0x1e');var _0x1b3b7c=_0x228b7a['count'];var _0x18bfd0=_0x162e68?0x0:_0x255141['offset'];var _0x25d5c3=_0x162e68?_0x228b7a[_0xa424('0x20')]:_0x255141[_0xa424('0x1d')]+_0x255141[_0xa424('0x1f')];var _0x142d45;if(_0x25d5c3>=_0x1b3b7c){_0x25d5c3=_0x1b3b7c;_0x142d45=0xc8;}else{_0x142d45=0xce;}_0x1fe2ba[_0xa424('0x1b')](_0x142d45);return _0x1fe2ba[_0xa424('0x21')](_0xa424('0x22'),_0x18bfd0+'-'+_0x25d5c3+'/'+_0x1b3b7c)[_0xa424('0x23')](_0x228b7a);}return null;};}function patchUpdates(_0x15de1f){return function(_0x2612e5){try{jsonpatch[_0xa424('0x24')](_0x2612e5,_0x15de1f,!![]);}catch(_0x123146){return BPromise['reject'](_0x123146);}return _0x2612e5[_0xa424('0x25')]();};}function saveUpdates(_0x1ef3d6,_0x28fab7){return function(_0x40eec3){if(_0x40eec3){return _0x40eec3[_0xa424('0x26')](_0x1ef3d6)['then'](function(_0x5e5139){return _0x5e5139;});}return null;};}function removeEntity(_0x4a5336,_0x408ce7){return function(_0x154570){if(_0x154570){return _0x154570[_0xa424('0x27')]()[_0xa424('0x28')](function(){_0x4a5336[_0xa424('0x1b')](0xcc)[_0xa424('0x1c')]();});}};}function handleEntityNotFound(_0x36f140,_0x4014fb){return function(_0x3b9aaa){if(!_0x3b9aaa){_0x36f140['sendStatus'](0x194);}return _0x3b9aaa;};}function handleError(_0x4ce6ac,_0x3bbb9d){_0x3bbb9d=_0x3bbb9d||0x1f4;return function(_0x153e5e){logger['error'](_0x153e5e[_0xa424('0x29')]);if(_0x153e5e[_0xa424('0x2a')]){delete _0x153e5e[_0xa424('0x2a')];}_0x4ce6ac[_0xa424('0x1b')](_0x3bbb9d)['send'](_0x153e5e);};}exports[_0xa424('0x2b')]=function(_0x350b96,_0x3eac72){var _0xd0c8b2={},_0xad7900={},_0xae8922={'count':0x0,'rows':[]};var _0x4fa512=_[_0xa424('0x2c')](db[_0xa424('0x2d')][_0xa424('0x2e')],function(_0x130984){return{'name':_0x130984[_0xa424('0x2f')],'type':_0x130984[_0xa424('0x30')]['key']};});_0xad7900[_0xa424('0x31')]=_[_0xa424('0x2c')](_0x4fa512,_0xa424('0x2a'));_0xad7900[_0xa424('0x32')]=_[_0xa424('0x33')](_0x350b96['query']);_0xad7900[_0xa424('0x34')]=_[_0xa424('0x35')](_0xad7900[_0xa424('0x31')],_0xad7900[_0xa424('0x32')]);_0xd0c8b2['attributes']=_[_0xa424('0x35')](_0xad7900[_0xa424('0x31')],qs[_0xa424('0x36')](_0x350b96[_0xa424('0x32')]['fields']));_0xd0c8b2[_0xa424('0x37')]=_0xd0c8b2[_0xa424('0x37')][_0xa424('0x38')]?_0xd0c8b2[_0xa424('0x37')]:_0xad7900[_0xa424('0x31')];if(!_0x350b96[_0xa424('0x32')][_0xa424('0x39')](_0xa424('0x3a'))){_0xd0c8b2['limit']=qs['limit'](_0x350b96[_0xa424('0x32')]['limit']);_0xd0c8b2[_0xa424('0x1d')]=qs[_0xa424('0x1d')](_0x350b96[_0xa424('0x32')][_0xa424('0x1d')]);}_0xd0c8b2['order']=qs[_0xa424('0x3b')](_0x350b96[_0xa424('0x32')][_0xa424('0x3b')]);_0xd0c8b2[_0xa424('0x3c')]=qs[_0xa424('0x34')](_[_0xa424('0x3d')](_0x350b96[_0xa424('0x32')],_0xad7900[_0xa424('0x34')]),_0x4fa512);if(_0x350b96[_0xa424('0x32')][_0xa424('0x3e')]){_0xd0c8b2[_0xa424('0x3c')]=_[_0xa424('0x3f')](_0xd0c8b2[_0xa424('0x3c')],{'$or':_[_0xa424('0x2c')](_0x4fa512,function(_0x3b0bf6){if(_0x3b0bf6[_0xa424('0x30')]!==_0xa424('0x40')){var _0x5539ea={};_0x5539ea[_0x3b0bf6[_0xa424('0x2a')]]={'$like':'%'+_0x350b96[_0xa424('0x32')]['filter']+'%'};return _0x5539ea;}})});}_0xd0c8b2=_[_0xa424('0x3f')]({},_0xd0c8b2,_0x350b96[_0xa424('0x41')]);var _0x3dda63={'where':_0xd0c8b2[_0xa424('0x3c')]};return db[_0xa424('0x2d')][_0xa424('0x20')](_0x3dda63)[_0xa424('0x28')](function(_0x30e756){_0xae8922[_0xa424('0x20')]=_0x30e756;if(_0x350b96[_0xa424('0x32')][_0xa424('0x42')]){_0xd0c8b2['include']=[{'all':!![]}];}return db[_0xa424('0x2d')][_0xa424('0x43')](_0xd0c8b2);})[_0xa424('0x28')](function(_0x2c05ed){_0xae8922[_0xa424('0x44')]=_0x2c05ed;return _0xae8922;})['then'](respondWithFilteredResult(_0x3eac72,_0xd0c8b2))['catch'](handleError(_0x3eac72,null));};exports[_0xa424('0x45')]=function(_0x3aefd9,_0x4251f4){var _0x200372={'raw':!![],'where':{'id':_0x3aefd9[_0xa424('0x46')]['id']}},_0x553a0c={};_0x553a0c[_0xa424('0x31')]=_[_0xa424('0x33')](db[_0xa424('0x2d')][_0xa424('0x2e')]);_0x553a0c[_0xa424('0x32')]=_[_0xa424('0x33')](_0x3aefd9[_0xa424('0x32')]);_0x553a0c[_0xa424('0x34')]=_[_0xa424('0x35')](_0x553a0c['model'],_0x553a0c[_0xa424('0x32')]);_0x200372[_0xa424('0x37')]=_[_0xa424('0x35')](_0x553a0c[_0xa424('0x31')],qs[_0xa424('0x36')](_0x3aefd9[_0xa424('0x32')]['fields']));_0x200372[_0xa424('0x37')]=_0x200372['attributes'][_0xa424('0x38')]?_0x200372[_0xa424('0x37')]:_0x553a0c[_0xa424('0x31')];if(_0x3aefd9['query'][_0xa424('0x42')]){_0x200372['include']=[{'all':!![]}];}_0x200372=_['merge']({},_0x200372,_0x3aefd9[_0xa424('0x41')]);return db['OpenchannelApplication'][_0xa424('0x47')](_0x200372)[_0xa424('0x28')](handleEntityNotFound(_0x4251f4,null))[_0xa424('0x28')](respondWithResult(_0x4251f4,null))[_0xa424('0x48')](handleError(_0x4251f4,null));};exports['create']=function(_0x427074,_0xe14e54){return db[_0xa424('0x2d')]['create'](_0x427074[_0xa424('0x49')],{})[_0xa424('0x28')](respondWithResult(_0xe14e54,0xc9))[_0xa424('0x48')](handleError(_0xe14e54,null));};exports[_0xa424('0x26')]=function(_0x323008,_0x147267){if(_0x323008[_0xa424('0x49')]['id']){delete _0x323008[_0xa424('0x49')]['id'];}return db['OpenchannelApplication'][_0xa424('0x47')]({'where':{'id':_0x323008[_0xa424('0x46')]['id']}})[_0xa424('0x28')](handleEntityNotFound(_0x147267,null))[_0xa424('0x28')](saveUpdates(_0x323008[_0xa424('0x49')],null))['then'](respondWithResult(_0x147267,null))[_0xa424('0x48')](handleError(_0x147267,null));};exports[_0xa424('0x27')]=function(_0x8ccea7,_0x3ce8ca){return db[_0xa424('0x2d')]['find']({'where':{'id':_0x8ccea7[_0xa424('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ce8ca,null))[_0xa424('0x28')](removeEntity(_0x3ce8ca,null))[_0xa424('0x48')](handleError(_0x3ce8ca,null));}; \ No newline at end of file +var _0x8c79=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','include','OpenchannelApplication','findAll','rows','catch','show','keys','includeAll','find','create','body','params','destroy','eml-format','zip-dir','moment','util','path','sox','to-csv'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x8c79,0x121));var _0x98c7=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0x8c79[_0x1569fc];return _0x277783;};'use strict';var emlformat=require(_0x98c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x98c7('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98c7('0x3'));var path=require(_0x98c7('0x4'));var sox=require(_0x98c7('0x5'));var csv=require(_0x98c7('0x6'));var ejs=require(_0x98c7('0x7'));var fs=require('fs');var fs_extra=require(_0x98c7('0x8'));var _=require(_0x98c7('0x9'));var squel=require(_0x98c7('0xa'));var crypto=require(_0x98c7('0xb'));var jsforce=require(_0x98c7('0xc'));var deskjs=require(_0x98c7('0xd'));var toCsv=require(_0x98c7('0x6'));var querystring=require(_0x98c7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x98c7('0xf'));var as=require(_0x98c7('0x10'));var hardwareService=require(_0x98c7('0x11'));var logger=require(_0x98c7('0x12'))(_0x98c7('0x13'));var utils=require(_0x98c7('0x14'));var config=require(_0x98c7('0x15'));var licenseUtil=require(_0x98c7('0x16'));var db=require(_0x98c7('0x17'))['db'];function respondWithStatusCode(_0x5f1882,_0x4dcb3b){_0x4dcb3b=_0x4dcb3b||0xcc;return function(_0x458abb){if(_0x458abb){return _0x5f1882[_0x98c7('0x18')](_0x4dcb3b);}return _0x5f1882[_0x98c7('0x19')](_0x4dcb3b)[_0x98c7('0x1a')]();};}function respondWithResult(_0xa31bca,_0x59c166){_0x59c166=_0x59c166||0xc8;return function(_0x408bc8){if(_0x408bc8){return _0xa31bca['status'](_0x59c166)[_0x98c7('0x1b')](_0x408bc8);}};}function respondWithFilteredResult(_0x66bba0,_0x12f7da){return function(_0x285260){if(_0x285260){var _0x115704=typeof _0x12f7da[_0x98c7('0x1c')]===_0x98c7('0x1d')&&typeof _0x12f7da[_0x98c7('0x1e')]===_0x98c7('0x1d');var _0x283607=_0x285260[_0x98c7('0x1f')];var _0x357bf7=_0x115704?0x0:_0x12f7da[_0x98c7('0x1c')];var _0x4d8ca7=_0x115704?_0x285260[_0x98c7('0x1f')]:_0x12f7da[_0x98c7('0x1c')]+_0x12f7da[_0x98c7('0x1e')];var _0x51c86c;if(_0x4d8ca7>=_0x283607){_0x4d8ca7=_0x283607;_0x51c86c=0xc8;}else{_0x51c86c=0xce;}_0x66bba0[_0x98c7('0x19')](_0x51c86c);return _0x66bba0[_0x98c7('0x20')](_0x98c7('0x21'),_0x357bf7+'-'+_0x4d8ca7+'/'+_0x283607)[_0x98c7('0x1b')](_0x285260);}return null;};}function patchUpdates(_0x17aa20){return function(_0x2fc64a){try{jsonpatch[_0x98c7('0x22')](_0x2fc64a,_0x17aa20,!![]);}catch(_0x3a23eb){return BPromise['reject'](_0x3a23eb);}return _0x2fc64a[_0x98c7('0x23')]();};}function saveUpdates(_0xcf0c9a,_0xe708ae){return function(_0xf79d9b){if(_0xf79d9b){return _0xf79d9b[_0x98c7('0x24')](_0xcf0c9a)[_0x98c7('0x25')](function(_0x190671){return _0x190671;});}return null;};}function removeEntity(_0x25f28d,_0x332655){return function(_0x5098fa){if(_0x5098fa){return _0x5098fa['destroy']()[_0x98c7('0x25')](function(){_0x25f28d[_0x98c7('0x19')](0xcc)[_0x98c7('0x1a')]();});}};}function handleEntityNotFound(_0x4d92f1,_0x558906){return function(_0x25531e){if(!_0x25531e){_0x4d92f1[_0x98c7('0x18')](0x194);}return _0x25531e;};}function handleError(_0x3d0fc7,_0x5d22d9){_0x5d22d9=_0x5d22d9||0x1f4;return function(_0x4a07e9){logger[_0x98c7('0x26')](_0x4a07e9[_0x98c7('0x27')]);if(_0x4a07e9[_0x98c7('0x28')]){delete _0x4a07e9[_0x98c7('0x28')];}_0x3d0fc7[_0x98c7('0x19')](_0x5d22d9)['send'](_0x4a07e9);};}exports['index']=function(_0x16193a,_0x34c66f){var _0x154154={},_0x1ea496={},_0x213fb2={'count':0x0,'rows':[]};var _0x3565c3=_[_0x98c7('0x29')](db['OpenchannelApplication'][_0x98c7('0x2a')],function(_0x5a78d5){return{'name':_0x5a78d5[_0x98c7('0x2b')],'type':_0x5a78d5[_0x98c7('0x2c')][_0x98c7('0x2d')]};});_0x1ea496[_0x98c7('0x2e')]=_[_0x98c7('0x29')](_0x3565c3,_0x98c7('0x28'));_0x1ea496[_0x98c7('0x2f')]=_['keys'](_0x16193a['query']);_0x1ea496[_0x98c7('0x30')]=_[_0x98c7('0x31')](_0x1ea496['model'],_0x1ea496[_0x98c7('0x2f')]);_0x154154['attributes']=_[_0x98c7('0x31')](_0x1ea496[_0x98c7('0x2e')],qs[_0x98c7('0x32')](_0x16193a['query'][_0x98c7('0x32')]));_0x154154[_0x98c7('0x33')]=_0x154154[_0x98c7('0x33')][_0x98c7('0x34')]?_0x154154[_0x98c7('0x33')]:_0x1ea496[_0x98c7('0x2e')];if(!_0x16193a[_0x98c7('0x2f')][_0x98c7('0x35')](_0x98c7('0x36'))){_0x154154[_0x98c7('0x1e')]=qs[_0x98c7('0x1e')](_0x16193a[_0x98c7('0x2f')][_0x98c7('0x1e')]);_0x154154[_0x98c7('0x1c')]=qs[_0x98c7('0x1c')](_0x16193a[_0x98c7('0x2f')]['offset']);}_0x154154['order']=qs['sort'](_0x16193a[_0x98c7('0x2f')][_0x98c7('0x37')]);_0x154154['where']=qs[_0x98c7('0x30')](_[_0x98c7('0x38')](_0x16193a[_0x98c7('0x2f')],_0x1ea496['filters']),_0x3565c3);if(_0x16193a[_0x98c7('0x2f')]['filter']){_0x154154[_0x98c7('0x39')]=_[_0x98c7('0x3a')](_0x154154[_0x98c7('0x39')],{'$or':_['map'](_0x3565c3,function(_0x1e4171){if(_0x1e4171[_0x98c7('0x2c')]!=='VIRTUAL'){var _0x1bfff1={};_0x1bfff1[_0x1e4171[_0x98c7('0x28')]]={'$like':'%'+_0x16193a[_0x98c7('0x2f')][_0x98c7('0x3b')]+'%'};return _0x1bfff1;}})});}_0x154154=_[_0x98c7('0x3a')]({},_0x154154,_0x16193a[_0x98c7('0x3c')]);var _0xedea36={'where':_0x154154[_0x98c7('0x39')]};return db['OpenchannelApplication']['count'](_0xedea36)[_0x98c7('0x25')](function(_0x1d8b55){_0x213fb2['count']=_0x1d8b55;if(_0x16193a[_0x98c7('0x2f')]['includeAll']){_0x154154[_0x98c7('0x3d')]=[{'all':!![]}];}return db[_0x98c7('0x3e')][_0x98c7('0x3f')](_0x154154);})['then'](function(_0x69438a){_0x213fb2[_0x98c7('0x40')]=_0x69438a;return _0x213fb2;})[_0x98c7('0x25')](respondWithFilteredResult(_0x34c66f,_0x154154))[_0x98c7('0x41')](handleError(_0x34c66f,null));};exports[_0x98c7('0x42')]=function(_0x2aaab1,_0x5ba2b8){var _0x2dab47={'raw':!![],'where':{'id':_0x2aaab1['params']['id']}},_0x3b7363={};_0x3b7363[_0x98c7('0x2e')]=_[_0x98c7('0x43')](db[_0x98c7('0x3e')][_0x98c7('0x2a')]);_0x3b7363['query']=_['keys'](_0x2aaab1[_0x98c7('0x2f')]);_0x3b7363[_0x98c7('0x30')]=_[_0x98c7('0x31')](_0x3b7363[_0x98c7('0x2e')],_0x3b7363['query']);_0x2dab47[_0x98c7('0x33')]=_['intersection'](_0x3b7363[_0x98c7('0x2e')],qs[_0x98c7('0x32')](_0x2aaab1[_0x98c7('0x2f')][_0x98c7('0x32')]));_0x2dab47[_0x98c7('0x33')]=_0x2dab47[_0x98c7('0x33')][_0x98c7('0x34')]?_0x2dab47['attributes']:_0x3b7363[_0x98c7('0x2e')];if(_0x2aaab1[_0x98c7('0x2f')][_0x98c7('0x44')]){_0x2dab47[_0x98c7('0x3d')]=[{'all':!![]}];}_0x2dab47=_[_0x98c7('0x3a')]({},_0x2dab47,_0x2aaab1[_0x98c7('0x3c')]);return db[_0x98c7('0x3e')][_0x98c7('0x45')](_0x2dab47)['then'](handleEntityNotFound(_0x5ba2b8,null))[_0x98c7('0x25')](respondWithResult(_0x5ba2b8,null))[_0x98c7('0x41')](handleError(_0x5ba2b8,null));};exports[_0x98c7('0x46')]=function(_0x3db8f1,_0x5df4a7){return db['OpenchannelApplication']['create'](_0x3db8f1['body'],{})[_0x98c7('0x25')](respondWithResult(_0x5df4a7,0xc9))[_0x98c7('0x41')](handleError(_0x5df4a7,null));};exports[_0x98c7('0x24')]=function(_0x216804,_0x28b511){if(_0x216804[_0x98c7('0x47')]['id']){delete _0x216804[_0x98c7('0x47')]['id'];}return db['OpenchannelApplication'][_0x98c7('0x45')]({'where':{'id':_0x216804[_0x98c7('0x48')]['id']}})[_0x98c7('0x25')](handleEntityNotFound(_0x28b511,null))[_0x98c7('0x25')](saveUpdates(_0x216804[_0x98c7('0x47')],null))[_0x98c7('0x25')](respondWithResult(_0x28b511,null))[_0x98c7('0x41')](handleError(_0x28b511,null));};exports[_0x98c7('0x49')]=function(_0x3ccad1,_0x295b6d){return db['OpenchannelApplication']['find']({'where':{'id':_0x3ccad1['params']['id']}})[_0x98c7('0x25')](handleEntityNotFound(_0x295b6d,null))[_0x98c7('0x25')](removeEntity(_0x295b6d,null))[_0x98c7('0x41')](handleError(_0x295b6d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3e13a80..a0bc737 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 _0xabf4=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x3a8d64,_0x264bb2){var _0x1d6bc2=function(_0x1d77de){while(--_0x1d77de){_0x3a8d64['push'](_0x3a8d64['shift']());}};_0x1d6bc2(++_0x264bb2);}(_0xabf4,0xeb));var _0x4abf=function(_0xcb7bc6,_0x2bed38){_0xcb7bc6=_0xcb7bc6-0x0;var _0x1c678e=_0xabf4[_0xcb7bc6];return _0x1c678e;};'use strict';var _=require('lodash');var util=require(_0x4abf('0x0'));var logger=require('../../config/logger')(_0x4abf('0x1'));var moment=require(_0x4abf('0x2'));var BPromise=require(_0x4abf('0x3'));var rp=require(_0x4abf('0x4'));var fs=require('fs');var path=require(_0x4abf('0x5'));var rimraf=require(_0x4abf('0x6'));var config=require(_0x4abf('0x7'));var attributes=require(_0x4abf('0x8'));module[_0x4abf('0x9')]=function(_0x84983,_0x34f2a8){return _0x84983['define']('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4abf('0xa'),'collate':_0x4abf('0xb')});}; \ No newline at end of file +var _0x9abb=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0xe2c77e,_0x3f833f){var _0x114dfc=function(_0x26355e){while(--_0x26355e){_0xe2c77e['push'](_0xe2c77e['shift']());}};_0x114dfc(++_0x3f833f);}(_0x9abb,0xad));var _0xb9ab=function(_0x205e3c,_0x26905e){_0x205e3c=_0x205e3c-0x0;var _0x2ec9ee=_0x9abb[_0x205e3c];return _0x2ec9ee;};'use strict';var _=require(_0xb9ab('0x0'));var util=require('util');var logger=require(_0xb9ab('0x1'))(_0xb9ab('0x2'));var moment=require(_0xb9ab('0x3'));var BPromise=require(_0xb9ab('0x4'));var rp=require(_0xb9ab('0x5'));var fs=require('fs');var path=require(_0xb9ab('0x6'));var rimraf=require('rimraf');var config=require(_0xb9ab('0x7'));var attributes=require(_0xb9ab('0x8'));module[_0xb9ab('0x9')]=function(_0x38f8d1,_0x54094a){return _0x38f8d1[_0xb9ab('0xa')](_0xb9ab('0xb'),attributes,{'tableName':_0xb9ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9ab('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 88964a2..d68a953 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 _0xf435=['raw','where','attributes','limit','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0xef259b,_0x4f6d0f){var _0x2da8e9=function(_0x4cb82d){while(--_0x4cb82d){_0xef259b['push'](_0xef259b['shift']());}};_0x2da8e9(++_0x4f6d0f);}(_0xf435,0xfd));var _0x5f43=function(_0x939576,_0xf3c6bb){_0x939576=_0x939576-0x0;var _0x14f5b5=_0xf435[_0x939576];return _0x14f5b5;};'use strict';var _=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var moment=require(_0x5f43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f43('0x3'));var db=require(_0x5f43('0x4'))['db'];var utils=require(_0x5f43('0x5'));var logger=require(_0x5f43('0x6'))('rpc');var config=require(_0x5f43('0x7'));var jayson=require(_0x5f43('0x8'));var client=jayson['client'][_0x5f43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53571d,_0x48cc89,_0x251824){return new BPromise(function(_0x350bab,_0x108ba1){return client[_0x5f43('0xa')](_0x53571d,_0x251824)[_0x5f43('0xb')](function(_0x4ded05){logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x48cc89,_0x5f43('0xe'));logger[_0x5f43('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x48cc89,_0x5f43('0xe'),JSON[_0x5f43('0x10')](_0x4ded05));if(_0x4ded05['error']){if(_0x4ded05[_0x5f43('0x11')][_0x5f43('0x12')]===0x1f4){logger[_0x5f43('0x11')](_0x5f43('0xd'),_0x48cc89,_0x4ded05['error'][_0x5f43('0x13')]);return _0x108ba1(_0x4ded05['error'][_0x5f43('0x13')]);}logger['error'](_0x5f43('0xd'),_0x48cc89,_0x4ded05['error']['message']);return _0x350bab(_0x4ded05['error'][_0x5f43('0x13')]);}else{logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x48cc89,'request\x20sent');_0x350bab(_0x4ded05[_0x5f43('0x14')]['message']);}})['catch'](function(_0x14b660){logger[_0x5f43('0x11')](_0x5f43('0xd'),_0x48cc89,_0x14b660);_0x108ba1(_0x14b660);});});}exports[_0x5f43('0x15')]=function(_0x1fd848){var _0x51d7bc=this;return new Promise(function(_0x3da1d9,_0x1b86ef){return db[_0x5f43('0x16')][_0x5f43('0x17')](_0x1fd848[_0x5f43('0x18')],{'raw':_0x1fd848[_0x5f43('0x19')]?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd848['options']?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1b')]||null:null,'attributes':_0x1fd848['options']?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1c')]||null:null,'limit':_0x1fd848[_0x5f43('0x19')]?_0x1fd848['options'][_0x5f43('0x1d')]||null:null})['then'](function(_0x33e850){logger[_0x5f43('0xc')](_0x5f43('0x15'),_0x1fd848);logger[_0x5f43('0xf')](_0x5f43('0x15'),_0x1fd848,JSON[_0x5f43('0x10')](_0x33e850));_0x3da1d9(_0x33e850);})[_0x5f43('0x1e')](function(_0x385917){logger[_0x5f43('0x11')](_0x5f43('0x15'),_0x385917['message'],_0x1fd848);_0x1b86ef(_0x51d7bc[_0x5f43('0x11')](0x1f4,_0x385917[_0x5f43('0x13')]));});});}; \ No newline at end of file +var _0x1541=['body','options','raw','attributes','limit','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x20d434,_0x3fb64f){var _0x1d90f1=function(_0x3af405){while(--_0x3af405){_0x20d434['push'](_0x20d434['shift']());}};_0x1d90f1(++_0x3fb64f);}(_0x1541,0x1f3));var _0x1154=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x1541[_0x503ffd];return _0x160437;};'use strict';var _=require('lodash');var util=require(_0x1154('0x0'));var moment=require(_0x1154('0x1'));var BPromise=require('bluebird');var rs=require(_0x1154('0x2'));var fs=require('fs');var Redis=require(_0x1154('0x3'));var db=require(_0x1154('0x4'))['db'];var utils=require(_0x1154('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1154('0x6'));var client=jayson['client'][_0x1154('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4635e1,_0x5d418d,_0x497f10){return new BPromise(function(_0x16a286,_0x4fcda4){return client[_0x1154('0x8')](_0x4635e1,_0x497f10)[_0x1154('0x9')](function(_0x2409d1){logger[_0x1154('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x5d418d,_0x1154('0xb'));logger[_0x1154('0xc')](_0x1154('0xd'),_0x5d418d,_0x1154('0xb'),JSON[_0x1154('0xe')](_0x2409d1));if(_0x2409d1[_0x1154('0xf')]){if(_0x2409d1['error'][_0x1154('0x10')]===0x1f4){logger[_0x1154('0xf')](_0x1154('0x11'),_0x5d418d,_0x2409d1[_0x1154('0xf')][_0x1154('0x12')]);return _0x4fcda4(_0x2409d1[_0x1154('0xf')][_0x1154('0x12')]);}logger[_0x1154('0xf')](_0x1154('0x11'),_0x5d418d,_0x2409d1[_0x1154('0xf')][_0x1154('0x12')]);return _0x16a286(_0x2409d1[_0x1154('0xf')][_0x1154('0x12')]);}else{logger[_0x1154('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x5d418d,_0x1154('0xb'));_0x16a286(_0x2409d1[_0x1154('0x13')][_0x1154('0x12')]);}})['catch'](function(_0x3dad02){logger[_0x1154('0xf')](_0x1154('0x11'),_0x5d418d,_0x3dad02);_0x4fcda4(_0x3dad02);});});}exports[_0x1154('0x14')]=function(_0x211d5a){var _0x167839=this;return new Promise(function(_0x142d2c,_0x6fcc8f){return db[_0x1154('0x15')][_0x1154('0x16')](_0x211d5a[_0x1154('0x17')],{'raw':_0x211d5a[_0x1154('0x18')]?_0x211d5a[_0x1154('0x18')][_0x1154('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x211d5a[_0x1154('0x18')]?_0x211d5a['options']['where']||null:null,'attributes':_0x211d5a['options']?_0x211d5a[_0x1154('0x18')][_0x1154('0x1a')]||null:null,'limit':_0x211d5a[_0x1154('0x18')]?_0x211d5a['options'][_0x1154('0x1b')]||null:null})[_0x1154('0x9')](function(_0x47376c){logger[_0x1154('0xa')](_0x1154('0x14'),_0x211d5a);logger[_0x1154('0xc')]('UpdateOpenchannelApplication',_0x211d5a,JSON['stringify'](_0x47376c));_0x142d2c(_0x47376c);})[_0x1154('0x1c')](function(_0x5a89e7){logger['error'](_0x1154('0x14'),_0x5a89e7[_0x1154('0x12')],_0x211d5a);_0x6fcc8f(_0x167839[_0x1154('0xf')](0x1f4,_0x5a89e7[_0x1154('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ad4743e..565a6fb 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 _0xd47b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','removeTags','exports','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd47b,0x13e));var _0xbd47=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0xd47b[_0x563af1];return _0x58fccb;};'use strict';var multer=require('multer');var util=require(_0xbd47('0x0'));var path=require(_0xbd47('0x1'));var timeout=require(_0xbd47('0x2'));var express=require('express');var router=express[_0xbd47('0x3')]();var fs_extra=require(_0xbd47('0x4'));var auth=require(_0xbd47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd47('0x6'));var controller=require(_0xbd47('0x7'));router['get']('/',auth[_0xbd47('0x8')](),controller['index']);router['get'](_0xbd47('0x9'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xa')]);router[_0xbd47('0xb')](_0xbd47('0xc'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xd')]);router['get'](_0xbd47('0xe'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xf')]);router[_0xbd47('0xb')]('/:id/download',auth[_0xbd47('0x8')](),controller[_0xbd47('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd47('0x11')]);router[_0xbd47('0x12')](_0xbd47('0xe'),auth['isAuthenticated'](),controller[_0xbd47('0x13')]);router[_0xbd47('0x12')](_0xbd47('0x14'),auth[_0xbd47('0x8')](),interaction['tracked']('openchannel',_0xbd47('0x15')),controller[_0xbd47('0x16')]);router[_0xbd47('0x17')](_0xbd47('0xc'),auth[_0xbd47('0x8')](),interaction[_0xbd47('0x18')]('openchannel',_0xbd47('0x19')),controller[_0xbd47('0x1a')]);router[_0xbd47('0x1b')]('/:id',auth[_0xbd47('0x8')](),interaction['tracked'](_0xbd47('0x1c'),_0xbd47('0x1d')),controller['destroy']);router[_0xbd47('0x1b')](_0xbd47('0x14'),auth[_0xbd47('0x8')](),controller[_0xbd47('0x1e')]);module[_0xbd47('0x1f')]=router; \ No newline at end of file +var _0x058a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x058a,0x185));var _0xa058=function(_0x1a7863,_0x7978c6){_0x1a7863=_0x1a7863-0x0;var _0x1ce3b6=_0x058a[_0x1a7863];return _0x1ce3b6;};'use strict';var multer=require(_0xa058('0x0'));var util=require(_0xa058('0x1'));var path=require(_0xa058('0x2'));var timeout=require(_0xa058('0x3'));var express=require(_0xa058('0x4'));var router=express[_0xa058('0x5')]();var fs_extra=require(_0xa058('0x6'));var auth=require(_0xa058('0x7'));var interaction=require(_0xa058('0x8'));var config=require(_0xa058('0x9'));var controller=require(_0xa058('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xa058('0xb')]);router[_0xa058('0xc')](_0xa058('0xd'),auth[_0xa058('0xe')](),controller[_0xa058('0xf')]);router[_0xa058('0xc')](_0xa058('0x10'),auth[_0xa058('0xe')](),controller[_0xa058('0x11')]);router['get'](_0xa058('0x12'),auth[_0xa058('0xe')](),controller[_0xa058('0x13')]);router['get'](_0xa058('0x14'),auth['isAuthenticated'](),controller[_0xa058('0x15')]);router['post']('/',auth[_0xa058('0xe')](),controller[_0xa058('0x16')]);router[_0xa058('0x17')](_0xa058('0x12'),auth[_0xa058('0xe')](),controller[_0xa058('0x18')]);router[_0xa058('0x17')](_0xa058('0x19'),auth['isAuthenticated'](),interaction[_0xa058('0x1a')](_0xa058('0x1b'),_0xa058('0x1c')),controller[_0xa058('0x1d')]);router[_0xa058('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xa058('0x1b'),_0xa058('0x1f')),controller[_0xa058('0x20')]);router['delete']('/:id',auth[_0xa058('0xe')](),interaction[_0xa058('0x1a')](_0xa058('0x1b'),_0xa058('0x21')),controller['destroy']);router[_0xa058('0x22')](_0xa058('0x19'),auth[_0xa058('0xe')](),controller[_0xa058('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 333519e..27d16ac 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 _0xe87e=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xe87e,0x17d));var _0xee87=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xe87e[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0xee87('0x0'));module[_0xee87('0x1')]={'closed':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee87('0x3')]},'disposition':{'type':Sequelize[_0xee87('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee87('0x4')]},'note':{'type':Sequelize[_0xee87('0x4')]},'read1stAt':{'type':Sequelize[_0xee87('0x3')]},'threadId':{'type':Sequelize[_0xee87('0x4')]},'externalUrl':{'type':Sequelize[_0xee87('0x4')]},'lastMsgAt':{'type':Sequelize[_0xee87('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xee87('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee87('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xee87('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xee87('0x7')]}}; \ No newline at end of file +var _0xe40a=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x146b44,_0x1cd58f){var _0x30c2c9=function(_0x54fcfc){while(--_0x54fcfc){_0x146b44['push'](_0x146b44['shift']());}};_0x30c2c9(++_0x1cd58f);}(_0xe40a,0x7d));var _0xae40=function(_0x730f79,_0x1426ac){_0x730f79=_0x730f79-0x0;var _0x130cbd=_0xe40a[_0x730f79];return _0x130cbd;};'use strict';var Sequelize=require(_0xae40('0x0'));module[_0xae40('0x1')]={'closed':{'type':Sequelize[_0xae40('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xae40('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xae40('0x3')]},'note':{'type':Sequelize[_0xae40('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xae40('0x3')]},'externalUrl':{'type':Sequelize[_0xae40('0x3')]},'lastMsgAt':{'type':Sequelize[_0xae40('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xae40('0x5')]('in',_0xae40('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xae40('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xae40('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 263127c..b2cdc1c 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 _0x472f=['rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','createdAt','closed','disposition','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','read','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','ids','omit','findOne','OpenchannelMessage','hasOwnProperty','limit','sort','pick','filters','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a908f,_0x388b9c){var _0x566f2c=function(_0x5821be){while(--_0x5821be){_0x4a908f['push'](_0x4a908f['shift']());}};_0x566f2c(++_0x388b9c);}(_0x472f,0xb2));var _0xf472=function(_0x5929ab,_0x1a488c){_0x5929ab=_0x5929ab-0x0;var _0x8e793e=_0x472f[_0x5929ab];return _0x8e793e;};'use strict';var rimraf=require(_0xf472('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf472('0x1'));var util=require(_0xf472('0x2'));var path=require(_0xf472('0x3'));var ejs=require(_0xf472('0x4'));var fs=require('fs');var _=require(_0xf472('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf472('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf472('0x7'));var config=require(_0xf472('0x8'));var db=require(_0xf472('0x9'))['db'];config[_0xf472('0xa')]=_[_0xf472('0xb')](config['redis'],{'host':_0xf472('0xc'),'port':0x18eb});var socket=require(_0xf472('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0xa772b6,_0x17aee8){_0x17aee8=_0x17aee8||0xcc;return function(_0x4f3589){if(_0x4f3589){return _0xa772b6[_0xf472('0xe')](_0x17aee8);}return _0xa772b6[_0xf472('0xf')](_0x17aee8)[_0xf472('0x10')]();};}function respondWithResult(_0x2fe5a6,_0x5e8fc8){_0x5e8fc8=_0x5e8fc8||0xc8;return function(_0x175333){if(_0x175333){return _0x2fe5a6['status'](_0x5e8fc8)[_0xf472('0x11')](_0x175333);}};}function respondWithFilteredResult(_0x3db5ca,_0x222af2){return function(_0x36e758){if(_0x36e758){var _0x554f79=typeof _0x222af2[_0xf472('0x12')]===_0xf472('0x13')&&typeof _0x222af2['limit']===_0xf472('0x13');var _0xd857ce=_0x36e758[_0xf472('0x14')];var _0x5decbf=_0x554f79?0x0:_0x222af2[_0xf472('0x12')];var _0x21e531=_0x554f79?_0x36e758[_0xf472('0x14')]:_0x222af2[_0xf472('0x12')]+_0x222af2['limit'];var _0x422a35;if(_0x21e531>=_0xd857ce){_0x21e531=_0xd857ce;_0x422a35=0xc8;}else{_0x422a35=0xce;}_0x3db5ca[_0xf472('0xf')](_0x422a35);return _0x3db5ca[_0xf472('0x15')](_0xf472('0x16'),_0x5decbf+'-'+_0x21e531+'/'+_0xd857ce)[_0xf472('0x11')](_0x36e758);}return null;};}function saveUpdates(_0x20af35){return function(_0x3acfaf){if(_0x3acfaf){return _0x3acfaf[_0xf472('0x17')](_0x20af35)[_0xf472('0x18')](function(_0x26d2c9){return _0x26d2c9;});}return null;};}function removeEntity(_0x42d4f4){return function(_0x5bb035){if(_0x5bb035){return _0x5bb035['destroy']()[_0xf472('0x18')](function(){_0x42d4f4['status'](0xcc)[_0xf472('0x10')]();});}};}function handleEntityNotFound(_0x1c8495){return function(_0x545d08){if(!_0x545d08){_0x1c8495[_0xf472('0xe')](0x194);}return _0x545d08;};}function handleError(_0x55af5b,_0x328225){_0x328225=_0x328225||0x1f4;return function(_0x1ffbfa){logger[_0xf472('0x19')](_0x1ffbfa['stack']);if(_0x1ffbfa[_0xf472('0x1a')]){delete _0x1ffbfa[_0xf472('0x1a')];}_0x55af5b['status'](_0x328225)[_0xf472('0x1b')](_0x1ffbfa);};}exports[_0xf472('0x1c')]=function(_0x2547ee,_0x35c05c){var _0xe83699={};var _0x306267=_[_0xf472('0x1d')](db['OpenchannelInteraction'][_0xf472('0x1e')],function(_0x1324d4){return{'name':_0x1324d4[_0xf472('0x1f')],'type':_0x1324d4[_0xf472('0x20')][_0xf472('0x21')]};});_0xe83699=qs[_0xf472('0x22')](_0x306267,_0x2547ee);return interaction[_0xf472('0x23')]('openchannel',_0x2547ee[_0xf472('0x24')],_0x2547ee['user'],_0xe83699,_0x306267)[_0xf472('0x18')](respondWithFilteredResult(_0x35c05c,_0xe83699))['catch'](handleError(_0x35c05c,null));};exports['show']=function(_0x235c06,_0x39bfb7){var _0x827d8a={};if(_0x235c06[_0xf472('0x24')]['type']&&_0x235c06['query'][_0xf472('0x20')]===_0xf472('0x25')){_0x827d8a[_0xf472('0x25')]=_0x235c06[_0xf472('0x26')]['id'];}else{_0x827d8a['id']=_0x235c06['params']['id'];}var _0x23c2b9={'raw':![],'where':_0x827d8a},_0x2246fa={};_0x2246fa[_0xf472('0x27')]=_[_0xf472('0x28')](db[_0xf472('0x29')][_0xf472('0x1e')]);_0x2246fa[_0xf472('0x24')]=_['keys'](_0x235c06[_0xf472('0x24')]);_0x2246fa['filters']=_[_0xf472('0x2a')](_0x2246fa[_0xf472('0x27')],_0x2246fa[_0xf472('0x24')]);_0x23c2b9[_0xf472('0x2b')]=_['intersection'](_0x2246fa[_0xf472('0x27')],qs[_0xf472('0x2c')](_0x235c06['query'][_0xf472('0x2c')]));_0x23c2b9['attributes']=_0x23c2b9[_0xf472('0x2b')][_0xf472('0x2d')]?_0x23c2b9[_0xf472('0x2b')]:_0x2246fa['model'];if(_0x235c06['query'][_0xf472('0x2e')]){_0x23c2b9[_0xf472('0x2f')]=[{'all':!![]}];}_0x23c2b9=_[_0xf472('0x30')]({},_0x23c2b9,_0x235c06[_0xf472('0x31')]);return db[_0xf472('0x29')][_0xf472('0x32')](_0x23c2b9)['then'](handleEntityNotFound(_0x39bfb7,null))[_0xf472('0x18')](respondWithResult(_0x39bfb7,null))[_0xf472('0x33')](handleError(_0x39bfb7,null));};exports[_0xf472('0x34')]=function(_0x214481,_0x4648fd){return db[_0xf472('0x29')][_0xf472('0x34')](_0x214481['body'],{})['then'](respondWithResult(_0x4648fd,0xc9))[_0xf472('0x33')](handleError(_0x4648fd,null));};exports['update']=function(_0x5c14b2,_0x42ff93){if(_0x5c14b2[_0xf472('0x35')]['id']){delete _0x5c14b2[_0xf472('0x35')]['id'];}return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x5c14b2[_0xf472('0x26')]['id']}})['then'](handleEntityNotFound(_0x42ff93,null))['then'](saveUpdates(_0x5c14b2[_0xf472('0x35')],null))[_0xf472('0x18')](respondWithResult(_0x42ff93,null))['catch'](handleError(_0x42ff93,null));};exports[_0xf472('0x36')]=function(_0x47c36e,_0x2a55b7){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x47c36e[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x2a55b7,null))['then'](removeEntity(_0x2a55b7,null))['catch'](handleError(_0x2a55b7,null));};exports[_0xf472('0x37')]=function(_0x492717,_0x41da0d){return db[_0xf472('0x29')][_0xf472('0x37')]()[_0xf472('0x18')](respondWithResult(_0x41da0d,null))[_0xf472('0x33')](handleError(_0x41da0d,null));};exports['addMessage']=function(_0x274519,_0x197486){return db['OpenchannelMessage'][_0xf472('0x32')]({'where':{'id':_0x274519[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x197486,null))['then'](function(_0x1bc293){if(_0x1bc293){return _0x1bc293['addMessage'](_0x274519[_0xf472('0x35')][_0xf472('0x38')],_[_0xf472('0x39')](_0x274519[_0xf472('0x35')],[_0xf472('0x38'),'id'])||{});}})[_0xf472('0x18')](respondWithResult(_0x197486,null))['catch'](handleError(_0x197486,null));};exports['getMessages']=function(_0x465bf1,_0x5a2864){var _0x4f82d9={'raw':![],'where':{}};var _0x4171dc={};var _0x1f8059={'count':0x0,'rows':[]};return db[_0xf472('0x29')][_0xf472('0x3a')]({'where':{'id':_0x465bf1[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x5a2864,null))['then'](function(_0x15a263){if(_0x15a263){_0x4171dc[_0xf472('0x27')]=_[_0xf472('0x28')](db[_0xf472('0x3b')][_0xf472('0x1e')]);_0x4171dc[_0xf472('0x24')]=_[_0xf472('0x28')](_0x465bf1[_0xf472('0x24')]);_0x4171dc['filters']=_[_0xf472('0x2a')](_0x4171dc[_0xf472('0x27')],_0x4171dc[_0xf472('0x24')]);_0x4f82d9[_0xf472('0x2b')]=_[_0xf472('0x2a')](_0x4171dc['model'],qs[_0xf472('0x2c')](_0x465bf1['query'][_0xf472('0x2c')]));_0x4f82d9['attributes']=_0x4f82d9[_0xf472('0x2b')][_0xf472('0x2d')]?_0x4f82d9['attributes']:_0x4171dc[_0xf472('0x27')];if(!_0x465bf1[_0xf472('0x24')][_0xf472('0x3c')]('nolimit')){_0x4f82d9[_0xf472('0x3d')]=qs[_0xf472('0x3d')](_0x465bf1[_0xf472('0x24')][_0xf472('0x3d')]);_0x4f82d9['offset']=qs[_0xf472('0x12')](_0x465bf1[_0xf472('0x24')]['offset']);}_0x4f82d9['order']=qs[_0xf472('0x3e')](_0x465bf1[_0xf472('0x24')][_0xf472('0x3e')]);_0x4f82d9['where']=qs['filters'](_[_0xf472('0x3f')](_0x465bf1[_0xf472('0x24')],_0x4171dc[_0xf472('0x40')]));_0x4f82d9[_0xf472('0x41')][_0xf472('0x42')]=_0x15a263['id'];if(_0x465bf1[_0xf472('0x24')][_0xf472('0x43')]){_0x4f82d9[_0xf472('0x41')]=_[_0xf472('0x30')](_0x4f82d9[_0xf472('0x41')],{'$or':_['map'](_0x4f82d9[_0xf472('0x2b')],function(_0x15234e){var _0x26316a={};_0x26316a[_0x15234e]={'$like':'%'+_0x465bf1[_0xf472('0x24')][_0xf472('0x43')]+'%'};return _0x26316a;})});}if(_0x465bf1[_0xf472('0x24')][_0xf472('0x44')]){var _0x5cc6bf=_0x465bf1[_0xf472('0x24')]['$gte'][_0xf472('0x45')](',');var _0x342501={};_0x342501[_0x5cc6bf[0x0]]={'$gte':moment(_0x5cc6bf[0x1])[_0xf472('0x46')](_0xf472('0x47'))};_0x4f82d9[_0xf472('0x41')]=_[_0xf472('0x30')](_0x4f82d9['where'],_0x342501);}_0x4f82d9=_[_0xf472('0x30')]({},_0x4f82d9,_0x465bf1[_0xf472('0x31')]);return db[_0xf472('0x3b')][_0xf472('0x14')]({'where':_0x4f82d9[_0xf472('0x41')]})[_0xf472('0x18')](function(_0x13e4af){_0x1f8059[_0xf472('0x14')]=_0x13e4af;if(_0x465bf1[_0xf472('0x24')][_0xf472('0x2e')]){_0x4f82d9['include']=[{'all':!![]}];}return db[_0xf472('0x3b')]['findAll'](_0x4f82d9);})[_0xf472('0x18')](function(_0x8ba79a){_0x1f8059[_0xf472('0x48')]=_0x8ba79a;return _0x1f8059;});}})['then'](respondWithFilteredResult(_0x5a2864,_0x4f82d9))[_0xf472('0x33')](handleError(_0x5a2864,null));};exports[_0xf472('0x49')]=function(_0x19f70c,_0x58a3ab){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x19f70c[_0xf472('0x26')]['id']}})['then'](handleEntityNotFound(_0x58a3ab,null))[_0xf472('0x18')](function(_0x394c71){if(_0x394c71){return _0x394c71[_0xf472('0x4a')](_0x19f70c[_0xf472('0x35')][_0xf472('0x38')],_['omit'](_0x19f70c[_0xf472('0x35')],['ids','id'])||{})[_0xf472('0x4b')](function(){return db[_0xf472('0x4c')][_0xf472('0x23')]({'attributes':['id','name',_0xf472('0x4d')],'where':{'id':_0x19f70c[_0xf472('0x35')][_0xf472('0x38')]}});})[_0xf472('0x18')](function(_0x3c012f){socket[_0xf472('0x4e')](_0xf472('0x4f'),{'id':Number(_0x19f70c[_0xf472('0x26')]['id']),'tags':_0x3c012f||[]});return{'id':Number(_0x19f70c['params']['id']),'tags':_0x3c012f||[]};});}})['then'](respondWithResult(_0x58a3ab,null))['catch'](handleError(_0x58a3ab,null));};exports[_0xf472('0x50')]=function(_0xf5b59,_0x5ce603){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0xf5b59[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x5ce603,null))[_0xf472('0x18')](function(_0x43c03c){if(_0x43c03c){return _0x43c03c[_0xf472('0x50')](_0xf5b59[_0xf472('0x24')][_0xf472('0x38')]);}})[_0xf472('0x18')](respondWithStatusCode(_0x5ce603,null))[_0xf472('0x33')](handleError(_0x5ce603,null));};exports[_0xf472('0x51')]=function(_0x54c5b0,_0x4d94f7){var _0x5d33c1=moment()['unix']()[_0xf472('0x52')]();var _0x1575ac=path[_0xf472('0x53')](config[_0xf472('0x54')],_0xf472('0x55'),_0xf472('0x56'),'tmp');var _0x49a2c4=path[_0xf472('0x53')](config['root'],_0xf472('0x55'),_0xf472('0x56'),_0xf472('0x57'));var _0x372fc5=path[_0xf472('0x53')](_0x1575ac,_0x5d33c1);var _0x461192=util['format'](_0xf472('0x58'),_0x54c5b0[_0xf472('0x26')]['id'],_0x5d33c1);var _0x28fa31=path[_0xf472('0x53')](_0x1575ac,_0x461192);var _0x292317=[];_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5a')],'as':_0xf472('0x5a'),'attributes':['id',_0xf472('0x5b')],'raw':!![]});_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5c')],'as':'Contact','attributes':['id',_0xf472('0x5d'),_0xf472('0x5e')],'raw':!![]});if(_0x54c5b0[_0xf472('0x24')]['attachments']){_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5f')],'as':_0xf472('0x5f'),'raw':!![]});}var _0x367ab8=[{'model':db[_0xf472('0x3b')],'as':_0xf472('0x60'),'attributes':['id',_0xf472('0x35'),'createdAt',_0xf472('0x61'),_0xf472('0x62'),'read'],'include':_0x292317}];_0x367ab8[_0xf472('0x59')]({'model':db[_0xf472('0x63')],'as':_0xf472('0x64'),'attributes':['id',_0xf472('0x1a')]});_0x367ab8[_0xf472('0x59')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xf472('0x29')]['find']({'where':{'id':_0x54c5b0[_0xf472('0x26')]['id']},'include':_0x367ab8})['then'](handleEntityNotFound(_0x4d94f7,null))['then'](function(_0x4191ce){if(_0x4191ce){var _0x5eb1f4=_0x4191ce['get']({'plain':!![]});fs[_0xf472('0x65')](_0x372fc5);var _0x27f447={'channel':_0xf472('0x66'),'account':_0x5eb1f4[_0xf472('0x64')]['name'],'agent':_0x5eb1f4[_0xf472('0x67')]?_0x5eb1f4[_0xf472('0x67')][_0xf472('0x5b')]:_0xf472('0x68'),'createdAt':moment(_0x5eb1f4[_0xf472('0x69')])['format'](_0xf472('0x47'))[_0xf472('0x52')](),'closedAt':_0x5eb1f4[_0xf472('0x6a')]?moment(_0x5eb1f4['closedAt'])[_0xf472('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf472('0x52')]():'','disposition':_0x5eb1f4[_0xf472('0x6b')],'visibility':_0x5eb1f4[_0xf472('0x6c')]?'Public':'Private','messages':_(_0x5eb1f4[_0xf472('0x60')])[_0xf472('0x43')]({'secret':![]})['map'](function(_0x2bc0c7){if(_0x2bc0c7['Attachment']){var _0x13ca11=path[_0xf472('0x53')](_0x49a2c4,_0x2bc0c7[_0xf472('0x5f')][_0xf472('0x6d')]);if(fs[_0xf472('0x6e')](_0x13ca11)){fs[_0xf472('0x6f')](_0x13ca11)[_0xf472('0x70')](fs[_0xf472('0x71')](path[_0xf472('0x53')](_0x372fc5,_0x2bc0c7[_0xf472('0x5f')][_0xf472('0x6d')])));}}return{'date':moment(_0x2bc0c7['createdAt'])[_0xf472('0x46')](_0xf472('0x47'))['toString'](),'sender':_0x2bc0c7[_0xf472('0x61')]===_0xf472('0x72')?_0x2bc0c7['User']?_0x2bc0c7[_0xf472('0x5a')]['fullname']:_0xf472('0x73'):_0x2bc0c7[_0xf472('0x74')][_0xf472('0x5d')]+(_0x2bc0c7[_0xf472('0x74')][_0xf472('0x5e')]?'\x20'+_0x2bc0c7['Contact'][_0xf472('0x5e')]:''),'body':_0x2bc0c7['Attachment']?_0x2bc0c7['Attachment'][_0xf472('0x6d')]:_0x2bc0c7[_0xf472('0x35')],'direction':_0x2bc0c7[_0xf472('0x61')]===_0xf472('0x72')?'A':'C','secret':_0x2bc0c7[_0xf472('0x62')],'read':_0x2bc0c7[_0xf472('0x75')],'attachment':_0x2bc0c7['Attachment']};})['value']()};return ejs[_0xf472('0x76')](path['join'](config[_0xf472('0x54')],_0xf472('0x55'),_0xf472('0x77'),_0xf472('0x78')),{'interaction':_0x27f447})['then'](function(_0x59fcde){var _0x13407f=path[_0xf472('0x53')](_0x372fc5,_0xf472('0x79')+_0x5eb1f4['id']+'-'+_0x5d33c1+'.pdf');var _0x3d5b62={'path':_0x13407f,'channel':_0xf472('0x66'),'interactionId':_0x5eb1f4['id']};return pdf[_0xf472('0x7a')](_0x59fcde,_0x3d5b62);})[_0xf472('0x18')](function(){return new Promise(function(_0x3a81ae,_0x4e3c28){zipdir(_0x372fc5,{'saveTo':_0x28fa31},function(_0x139934,_0x53fa66){if(_0x139934)return _0x4e3c28(_0x139934);return _0x3a81ae(_0x53fa66);});})['then'](function(){return new Promise(function(_0x1d4e91,_0x3cd6da){rimraf(_0x372fc5,function(_0x246aea){if(_0x246aea)_0x3cd6da(_0x246aea);return _0x1d4e91();});});})[_0xf472('0x18')](function(){return _0x4d94f7[_0xf472('0x51')](_0x28fa31,_0x461192,function(_0x47aa55){if(_0x47aa55){logger[_0xf472('0x19')](_0xf472('0x7b'),_0x47aa55);}else{fs[_0xf472('0x7c')](_0x28fa31);}});});});}else{return _0x4d94f7[_0xf472('0xe')](0xc8);}})[_0xf472('0x33')](handleError(_0x4d94f7,null));}; \ No newline at end of file +var _0x56d9=['redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','update','then','destroy','index','map','rawAttributes','type','getOptions','findAll','openchannel','user','catch','query','from','params','model','keys','filters','intersection','fields','attributes','includeAll','include','options','OpenchannelInteraction','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','setTags','omit','spread','Tag','name','color','emit','removeTags','download','unix','toString','join','server','files','tmp','root','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','attachments','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Openchannel','closed','disposition','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','downloadInteraction.ejs','transcript-','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults'];(function(_0x45c173,_0x1f9585){var _0x16260a=function(_0x396179){while(--_0x396179){_0x45c173['push'](_0x45c173['shift']());}};_0x16260a(++_0x1f9585);}(_0x56d9,0x6e));var _0x956d=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0x56d9[_0x450e22];return _0x5e3b1d;};'use strict';var rimraf=require(_0x956d('0x0'));var zipdir=require(_0x956d('0x1'));var moment=require(_0x956d('0x2'));var util=require(_0x956d('0x3'));var path=require(_0x956d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x956d('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x956d('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x956d('0x7'))(_0x956d('0x8'));var config=require('../../config/environment');var db=require(_0x956d('0x9'))['db'];config['redis']=_[_0x956d('0xa')](config[_0x956d('0xb')],{'host':_0x956d('0xc'),'port':0x18eb});var socket=require(_0x956d('0xd'))(new Redis(config[_0x956d('0xb')]));require(_0x956d('0xe'))['register'](socket);function respondWithStatusCode(_0x34d4ac,_0x459465){_0x459465=_0x459465||0xcc;return function(_0x875fe8){if(_0x875fe8){return _0x34d4ac[_0x956d('0xf')](_0x459465);}return _0x34d4ac[_0x956d('0x10')](_0x459465)[_0x956d('0x11')]();};}function respondWithResult(_0x8d6665,_0x2be5f7){_0x2be5f7=_0x2be5f7||0xc8;return function(_0x2581c9){if(_0x2581c9){return _0x8d6665[_0x956d('0x10')](_0x2be5f7)['json'](_0x2581c9);}};}function respondWithFilteredResult(_0x4dff30,_0x558954){return function(_0x51ed37){if(_0x51ed37){var _0x5d7083=typeof _0x558954['offset']==='undefined'&&typeof _0x558954[_0x956d('0x12')]===_0x956d('0x13');var _0x387fc2=_0x51ed37[_0x956d('0x14')];var _0x59ac71=_0x5d7083?0x0:_0x558954[_0x956d('0x15')];var _0x432c87=_0x5d7083?_0x51ed37[_0x956d('0x14')]:_0x558954[_0x956d('0x15')]+_0x558954['limit'];var _0x165168;if(_0x432c87>=_0x387fc2){_0x432c87=_0x387fc2;_0x165168=0xc8;}else{_0x165168=0xce;}_0x4dff30[_0x956d('0x10')](_0x165168);return _0x4dff30[_0x956d('0x16')](_0x956d('0x17'),_0x59ac71+'-'+_0x432c87+'/'+_0x387fc2)['json'](_0x51ed37);}return null;};}function saveUpdates(_0x482d29){return function(_0x42320d){if(_0x42320d){return _0x42320d[_0x956d('0x18')](_0x482d29)[_0x956d('0x19')](function(_0x44f18e){return _0x44f18e;});}return null;};}function removeEntity(_0x26074f){return function(_0x4610ef){if(_0x4610ef){return _0x4610ef[_0x956d('0x1a')]()[_0x956d('0x19')](function(){_0x26074f['status'](0xcc)[_0x956d('0x11')]();});}};}function handleEntityNotFound(_0x44dd01){return function(_0x589475){if(!_0x589475){_0x44dd01[_0x956d('0xf')](0x194);}return _0x589475;};}function handleError(_0x5663f9,_0x24edfb){_0x24edfb=_0x24edfb||0x1f4;return function(_0x66dbe5){logger['error'](_0x66dbe5['stack']);if(_0x66dbe5['name']){delete _0x66dbe5['name'];}_0x5663f9[_0x956d('0x10')](_0x24edfb)['send'](_0x66dbe5);};}exports[_0x956d('0x1b')]=function(_0x90b94f,_0x4d4765){var _0x427373={};var _0x1616cc=_[_0x956d('0x1c')](db['OpenchannelInteraction'][_0x956d('0x1d')],function(_0x21f06a){return{'name':_0x21f06a['fieldName'],'type':_0x21f06a[_0x956d('0x1e')]['key']};});_0x427373=qs[_0x956d('0x1f')](_0x1616cc,_0x90b94f);return interaction[_0x956d('0x20')](_0x956d('0x21'),_0x90b94f['query'],_0x90b94f[_0x956d('0x22')],_0x427373,_0x1616cc)[_0x956d('0x19')](respondWithFilteredResult(_0x4d4765,_0x427373))[_0x956d('0x23')](handleError(_0x4d4765,null));};exports['show']=function(_0x2a81d7,_0x589238){var _0x33da03={};if(_0x2a81d7[_0x956d('0x24')][_0x956d('0x1e')]&&_0x2a81d7[_0x956d('0x24')][_0x956d('0x1e')]===_0x956d('0x25')){_0x33da03[_0x956d('0x25')]=_0x2a81d7[_0x956d('0x26')]['id'];}else{_0x33da03['id']=_0x2a81d7[_0x956d('0x26')]['id'];}var _0x3b41ab={'raw':![],'where':_0x33da03},_0x241767={};_0x241767[_0x956d('0x27')]=_[_0x956d('0x28')](db['OpenchannelInteraction'][_0x956d('0x1d')]);_0x241767[_0x956d('0x24')]=_[_0x956d('0x28')](_0x2a81d7['query']);_0x241767[_0x956d('0x29')]=_[_0x956d('0x2a')](_0x241767['model'],_0x241767[_0x956d('0x24')]);_0x3b41ab['attributes']=_[_0x956d('0x2a')](_0x241767[_0x956d('0x27')],qs[_0x956d('0x2b')](_0x2a81d7[_0x956d('0x24')]['fields']));_0x3b41ab[_0x956d('0x2c')]=_0x3b41ab[_0x956d('0x2c')]['length']?_0x3b41ab[_0x956d('0x2c')]:_0x241767['model'];if(_0x2a81d7[_0x956d('0x24')][_0x956d('0x2d')]){_0x3b41ab[_0x956d('0x2e')]=[{'all':!![]}];}_0x3b41ab=_['merge']({},_0x3b41ab,_0x2a81d7[_0x956d('0x2f')]);return db[_0x956d('0x30')][_0x956d('0x31')](_0x3b41ab)[_0x956d('0x19')](handleEntityNotFound(_0x589238,null))[_0x956d('0x19')](respondWithResult(_0x589238,null))['catch'](handleError(_0x589238,null));};exports[_0x956d('0x32')]=function(_0x568a44,_0x47a478){return db[_0x956d('0x30')][_0x956d('0x32')](_0x568a44[_0x956d('0x33')],{})[_0x956d('0x19')](respondWithResult(_0x47a478,0xc9))['catch'](handleError(_0x47a478,null));};exports[_0x956d('0x18')]=function(_0x287c72,_0x38bb4a){if(_0x287c72[_0x956d('0x33')]['id']){delete _0x287c72[_0x956d('0x33')]['id'];}return db[_0x956d('0x30')]['find']({'where':{'id':_0x287c72['params']['id']}})[_0x956d('0x19')](handleEntityNotFound(_0x38bb4a,null))['then'](saveUpdates(_0x287c72['body'],null))[_0x956d('0x19')](respondWithResult(_0x38bb4a,null))[_0x956d('0x23')](handleError(_0x38bb4a,null));};exports['destroy']=function(_0x430bea,_0x18b1d4){return db[_0x956d('0x30')][_0x956d('0x31')]({'where':{'id':_0x430bea[_0x956d('0x26')]['id']}})[_0x956d('0x19')](handleEntityNotFound(_0x18b1d4,null))['then'](removeEntity(_0x18b1d4,null))['catch'](handleError(_0x18b1d4,null));};exports[_0x956d('0x34')]=function(_0xcd3b2d,_0x82aeca){return db['OpenchannelInteraction'][_0x956d('0x34')]()[_0x956d('0x19')](respondWithResult(_0x82aeca,null))[_0x956d('0x23')](handleError(_0x82aeca,null));};exports[_0x956d('0x35')]=function(_0x373fcd,_0x22fc81){return db['OpenchannelMessage'][_0x956d('0x31')]({'where':{'id':_0x373fcd[_0x956d('0x26')]['id']}})['then'](handleEntityNotFound(_0x22fc81,null))[_0x956d('0x19')](function(_0x331e31){if(_0x331e31){return _0x331e31['addMessage'](_0x373fcd[_0x956d('0x33')][_0x956d('0x36')],_['omit'](_0x373fcd[_0x956d('0x33')],[_0x956d('0x36'),'id'])||{});}})[_0x956d('0x19')](respondWithResult(_0x22fc81,null))[_0x956d('0x23')](handleError(_0x22fc81,null));};exports[_0x956d('0x37')]=function(_0x462822,_0x25bc91){var _0x56dc6c={'raw':![],'where':{}};var _0x2ddb09={};var _0x53cfe9={'count':0x0,'rows':[]};return db[_0x956d('0x30')][_0x956d('0x38')]({'where':{'id':_0x462822['params']['id']}})['then'](handleEntityNotFound(_0x25bc91,null))[_0x956d('0x19')](function(_0x883d2b){if(_0x883d2b){_0x2ddb09[_0x956d('0x27')]=_[_0x956d('0x28')](db[_0x956d('0x39')][_0x956d('0x1d')]);_0x2ddb09['query']=_[_0x956d('0x28')](_0x462822[_0x956d('0x24')]);_0x2ddb09[_0x956d('0x29')]=_[_0x956d('0x2a')](_0x2ddb09[_0x956d('0x27')],_0x2ddb09['query']);_0x56dc6c[_0x956d('0x2c')]=_['intersection'](_0x2ddb09[_0x956d('0x27')],qs[_0x956d('0x2b')](_0x462822[_0x956d('0x24')][_0x956d('0x2b')]));_0x56dc6c['attributes']=_0x56dc6c[_0x956d('0x2c')][_0x956d('0x3a')]?_0x56dc6c[_0x956d('0x2c')]:_0x2ddb09['model'];if(!_0x462822[_0x956d('0x24')][_0x956d('0x3b')](_0x956d('0x3c'))){_0x56dc6c[_0x956d('0x12')]=qs[_0x956d('0x12')](_0x462822['query']['limit']);_0x56dc6c[_0x956d('0x15')]=qs['offset'](_0x462822['query'][_0x956d('0x15')]);}_0x56dc6c['order']=qs[_0x956d('0x3d')](_0x462822['query']['sort']);_0x56dc6c[_0x956d('0x3e')]=qs[_0x956d('0x29')](_['pick'](_0x462822[_0x956d('0x24')],_0x2ddb09[_0x956d('0x29')]));_0x56dc6c['where'][_0x956d('0x3f')]=_0x883d2b['id'];if(_0x462822[_0x956d('0x24')]['filter']){_0x56dc6c[_0x956d('0x3e')]=_['merge'](_0x56dc6c[_0x956d('0x3e')],{'$or':_['map'](_0x56dc6c[_0x956d('0x2c')],function(_0x4fb76a){var _0x25bf8b={};_0x25bf8b[_0x4fb76a]={'$like':'%'+_0x462822[_0x956d('0x24')]['filter']+'%'};return _0x25bf8b;})});}if(_0x462822[_0x956d('0x24')][_0x956d('0x40')]){var _0x3b4507=_0x462822[_0x956d('0x24')]['$gte']['split'](',');var _0x3a319e={};_0x3a319e[_0x3b4507[0x0]]={'$gte':moment(_0x3b4507[0x1])[_0x956d('0x41')](_0x956d('0x42'))};_0x56dc6c['where']=_[_0x956d('0x43')](_0x56dc6c[_0x956d('0x3e')],_0x3a319e);}_0x56dc6c=_['merge']({},_0x56dc6c,_0x462822[_0x956d('0x2f')]);return db[_0x956d('0x39')]['count']({'where':_0x56dc6c['where']})[_0x956d('0x19')](function(_0x25f69d){_0x53cfe9[_0x956d('0x14')]=_0x25f69d;if(_0x462822['query']['includeAll']){_0x56dc6c[_0x956d('0x2e')]=[{'all':!![]}];}return db[_0x956d('0x39')]['findAll'](_0x56dc6c);})[_0x956d('0x19')](function(_0x376946){_0x53cfe9[_0x956d('0x44')]=_0x376946;return _0x53cfe9;});}})['then'](respondWithFilteredResult(_0x25bc91,_0x56dc6c))['catch'](handleError(_0x25bc91,null));};exports['addTags']=function(_0x26181f,_0x1e2c8b){return db['OpenchannelInteraction'][_0x956d('0x31')]({'where':{'id':_0x26181f[_0x956d('0x26')]['id']}})[_0x956d('0x19')](handleEntityNotFound(_0x1e2c8b,null))[_0x956d('0x19')](function(_0x50e58a){if(_0x50e58a){return _0x50e58a[_0x956d('0x45')](_0x26181f[_0x956d('0x33')]['ids'],_[_0x956d('0x46')](_0x26181f[_0x956d('0x33')],[_0x956d('0x36'),'id'])||{})[_0x956d('0x47')](function(){return db[_0x956d('0x48')][_0x956d('0x20')]({'attributes':['id',_0x956d('0x49'),_0x956d('0x4a')],'where':{'id':_0x26181f[_0x956d('0x33')][_0x956d('0x36')]}});})['then'](function(_0x4884f7){socket[_0x956d('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0x26181f[_0x956d('0x26')]['id']),'tags':_0x4884f7||[]});return{'id':Number(_0x26181f['params']['id']),'tags':_0x4884f7||[]};});}})[_0x956d('0x19')](respondWithResult(_0x1e2c8b,null))[_0x956d('0x23')](handleError(_0x1e2c8b,null));};exports['removeTags']=function(_0x1fe07,_0x2a5779){return db['OpenchannelInteraction'][_0x956d('0x31')]({'where':{'id':_0x1fe07[_0x956d('0x26')]['id']}})['then'](handleEntityNotFound(_0x2a5779,null))[_0x956d('0x19')](function(_0x38ee9d){if(_0x38ee9d){return _0x38ee9d[_0x956d('0x4c')](_0x1fe07[_0x956d('0x24')][_0x956d('0x36')]);}})[_0x956d('0x19')](respondWithStatusCode(_0x2a5779,null))['catch'](handleError(_0x2a5779,null));};exports[_0x956d('0x4d')]=function(_0x496a57,_0x11757a){var _0x2f7be0=moment()[_0x956d('0x4e')]()[_0x956d('0x4f')]();var _0x9be996=path[_0x956d('0x50')](config['root'],_0x956d('0x51'),_0x956d('0x52'),_0x956d('0x53'));var _0x3ac4a9=path[_0x956d('0x50')](config[_0x956d('0x54')],'server',_0x956d('0x52'),'attachments');var _0x16ceba=path[_0x956d('0x50')](_0x9be996,_0x2f7be0);var _0x450062=util[_0x956d('0x41')](_0x956d('0x55'),_0x496a57[_0x956d('0x26')]['id'],_0x2f7be0);var _0x4725ab=path[_0x956d('0x50')](_0x9be996,_0x450062);var _0x28e753=[];_0x28e753[_0x956d('0x56')]({'model':db[_0x956d('0x57')],'as':_0x956d('0x57'),'attributes':['id',_0x956d('0x58')],'raw':!![]});_0x28e753[_0x956d('0x56')]({'model':db[_0x956d('0x59')],'as':_0x956d('0x5a'),'attributes':['id','firstName',_0x956d('0x5b')],'raw':!![]});if(_0x496a57[_0x956d('0x24')][_0x956d('0x5c')]){_0x28e753['push']({'model':db[_0x956d('0x5d')],'as':_0x956d('0x5d'),'raw':!![]});}var _0x346a70=[{'model':db[_0x956d('0x39')],'as':'Messages','attributes':['id','body',_0x956d('0x5e'),_0x956d('0x5f'),_0x956d('0x60'),_0x956d('0x61')],'include':_0x28e753}];_0x346a70[_0x956d('0x56')]({'model':db['OpenchannelAccount'],'as':_0x956d('0x62'),'attributes':['id',_0x956d('0x49')]});_0x346a70[_0x956d('0x56')]({'model':db[_0x956d('0x57')],'as':_0x956d('0x63'),'attributes':['id',_0x956d('0x58')]});return db[_0x956d('0x30')][_0x956d('0x31')]({'where':{'id':_0x496a57[_0x956d('0x26')]['id']},'include':_0x346a70})['then'](handleEntityNotFound(_0x11757a,null))[_0x956d('0x19')](function(_0x3372e1){if(_0x3372e1){var _0x3296de=_0x3372e1[_0x956d('0x64')]({'plain':!![]});fs[_0x956d('0x65')](_0x16ceba);var _0x9a2eea={'channel':_0x956d('0x66'),'account':_0x3296de[_0x956d('0x62')]['name'],'agent':_0x3296de['Owner']?_0x3296de[_0x956d('0x63')][_0x956d('0x58')]:'N.A.','createdAt':moment(_0x3296de[_0x956d('0x5e')])[_0x956d('0x41')](_0x956d('0x42'))[_0x956d('0x4f')](),'closedAt':_0x3296de[_0x956d('0x67')]?moment(_0x3296de['closedAt'])[_0x956d('0x41')](_0x956d('0x42'))['toString']():'','disposition':_0x3296de[_0x956d('0x68')],'visibility':_0x3296de['threadId']?_0x956d('0x69'):_0x956d('0x6a'),'messages':_(_0x3296de[_0x956d('0x6b')])['filter']({'secret':![]})[_0x956d('0x1c')](function(_0x4e18d4){if(_0x4e18d4[_0x956d('0x5d')]){var _0x353493=path[_0x956d('0x50')](_0x3ac4a9,_0x4e18d4[_0x956d('0x5d')][_0x956d('0x6c')]);if(fs[_0x956d('0x6d')](_0x353493)){fs[_0x956d('0x6e')](_0x353493)[_0x956d('0x6f')](fs[_0x956d('0x70')](path['join'](_0x16ceba,_0x4e18d4[_0x956d('0x5d')][_0x956d('0x6c')])));}}return{'date':moment(_0x4e18d4[_0x956d('0x5e')])['format'](_0x956d('0x42'))['toString'](),'sender':_0x4e18d4['direction']===_0x956d('0x71')?_0x4e18d4['User']?_0x4e18d4[_0x956d('0x57')][_0x956d('0x58')]:_0x956d('0x72'):_0x4e18d4[_0x956d('0x5a')][_0x956d('0x73')]+(_0x4e18d4[_0x956d('0x5a')][_0x956d('0x5b')]?'\x20'+_0x4e18d4['Contact'][_0x956d('0x5b')]:''),'body':_0x4e18d4['Attachment']?_0x4e18d4[_0x956d('0x5d')][_0x956d('0x6c')]:_0x4e18d4[_0x956d('0x33')],'direction':_0x4e18d4[_0x956d('0x5f')]==='out'?'A':'C','secret':_0x4e18d4[_0x956d('0x60')],'read':_0x4e18d4[_0x956d('0x61')],'attachment':_0x4e18d4['Attachment']};})['value']()};return ejs['renderFile'](path[_0x956d('0x50')](config[_0x956d('0x54')],'server','views',_0x956d('0x74')),{'interaction':_0x9a2eea})['then'](function(_0x372102){var _0x2d3f58=path['join'](_0x16ceba,_0x956d('0x75')+_0x3296de['id']+'-'+_0x2f7be0+'.pdf');var _0x4fb14d={'path':_0x2d3f58,'channel':_0x956d('0x66'),'interactionId':_0x3296de['id']};return pdf[_0x956d('0x76')](_0x372102,_0x4fb14d);})[_0x956d('0x19')](function(){return new Promise(function(_0x4cc972,_0x2e9be4){zipdir(_0x16ceba,{'saveTo':_0x4725ab},function(_0x183815,_0x2bd424){if(_0x183815)return _0x2e9be4(_0x183815);return _0x4cc972(_0x2bd424);});})['then'](function(){return new Promise(function(_0x3417e6,_0x417f82){rimraf(_0x16ceba,function(_0x5f35f3){if(_0x5f35f3)_0x417f82(_0x5f35f3);return _0x3417e6();});});})[_0x956d('0x19')](function(){return _0x11757a[_0x956d('0x4d')](_0x4725ab,_0x450062,function(_0x5efc15){if(_0x5efc15){logger[_0x956d('0x77')](_0x956d('0x78'),_0x5efc15);}else{fs['unlinkSync'](_0x4725ab);}});});});}else{return _0x11757a[_0x956d('0xf')](0xc8);}})[_0x956d('0x23')](handleError(_0x11757a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 932e28d..3c3e2af 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 _0x7c51=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7c51,0x17a));var _0x17c5=function(_0x3c3b60,_0x1e3525){_0x3c3b60=_0x3c3b60-0x0;var _0x904f21=_0x7c51[_0x3c3b60];return _0x904f21;};'use strict';var EventEmitter=require(_0x17c5('0x0'));var OpenchannelInteraction=require(_0x17c5('0x1'))['db'][_0x17c5('0x2')];var OpenchannelMessage=require(_0x17c5('0x1'))['db'][_0x17c5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x17c5('0x4')](0x0);var events={'afterCreate':_0x17c5('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ae36f){return function(_0x21ecb9,_0xd0a0be,_0x538c3b){_0x21ecb9[_0x17c5('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xcad660){_0x21ecb9['setDataValue'](_0x17c5('0x7'),_0xcad660[_0x17c5('0x8')](function(_0x5cb4d1){return{'id':_0x5cb4d1['id']};}));return OpenchannelMessage[_0x17c5('0x9')]({'where':{'OpenchannelInteractionId':_0x21ecb9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x17c5('0xa')](function(_0x4c14d7){_0x21ecb9[_0x17c5('0xb')](_0x17c5('0xc'),_0x4c14d7[_0x17c5('0xd')]);OpenchannelInteractionEvents['emit'](_0x1ae36f+':'+_0x21ecb9['id'],_0x21ecb9);OpenchannelInteractionEvents[_0x17c5('0xe')](_0x1ae36f,_0x21ecb9);_0x538c3b(null);})[_0x17c5('0xf')](_0x538c3b(null));};}for(var e in events){if(events[_0x17c5('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x17c5('0x11')](e,emitEvent(event));}}module[_0x17c5('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2ee2=['save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x1c7b33,_0x381cc5){var _0x154be0=function(_0x3e7baf){while(--_0x3e7baf){_0x1c7b33['push'](_0x1c7b33['shift']());}};_0x154be0(++_0x381cc5);}(_0x2ee2,0x11c));var _0x22ee=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x2ee2[_0x3c504b];return _0x2e5354;};'use strict';var EventEmitter=require(_0x22ee('0x0'));var OpenchannelInteraction=require(_0x22ee('0x1'))['db'][_0x22ee('0x2')];var OpenchannelMessage=require(_0x22ee('0x1'))['db'][_0x22ee('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x22ee('0x4')](0x0);var events={'afterCreate':_0x22ee('0x5'),'afterUpdate':_0x22ee('0x6'),'afterDestroy':_0x22ee('0x7')};function emitEvent(_0x287324){return function(_0xa70654,_0x4359af,_0x46a053){_0xa70654[_0x22ee('0x8')]({'attributes':['id'],'raw':!![]})[_0x22ee('0x9')](function(_0x44b3c0){_0xa70654[_0x22ee('0xa')]('Users',_0x44b3c0['map'](function(_0x5bc6be){return{'id':_0x5bc6be['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xa70654['id'],'direction':'in','read':![]},'raw':!![]});})[_0x22ee('0x9')](function(_0x39b366){_0xa70654[_0x22ee('0xa')](_0x22ee('0xb'),_0x39b366[_0x22ee('0xc')]);OpenchannelInteractionEvents[_0x22ee('0xd')](_0x287324+':'+_0xa70654['id'],_0xa70654);OpenchannelInteractionEvents[_0x22ee('0xd')](_0x287324,_0xa70654);_0x46a053(null);})[_0x22ee('0xe')](_0x46a053(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x22ee('0xf')](e,emitEvent(event));}}module[_0x22ee('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8a7a39b..0f839fb 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 _0x4233=['exports','OpenchannelInteraction','changed','closed','closedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0x4233,0x199));var _0x3423=function(_0x576ac9,_0x31dc3b){_0x576ac9=_0x576ac9-0x0;var _0x5ad2a8=_0x4233[_0x576ac9];return _0x5ad2a8;};'use strict';var _=require('lodash');var util=require(_0x3423('0x0'));var logger=require(_0x3423('0x1'))(_0x3423('0x2'));var moment=require('moment');var BPromise=require(_0x3423('0x3'));var rp=require(_0x3423('0x4'));var fs=require('fs');var path=require(_0x3423('0x5'));var rimraf=require(_0x3423('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x3423('0x7')]=function(_0x26c566,_0x560616){return _0x26c566['define'](_0x3423('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x8c477a,_0xec82e0,_0x3f6bde){if(_0x8c477a[_0x3423('0x9')](_0x3423('0xa'))){_0x8c477a[_0x3423('0xb')]=moment()[_0x3423('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f6bde(null,_0x8c477a);}}});}; \ No newline at end of file +var _0xed10=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xed10,0xa0));var _0x0ed1=function(_0x957193,_0x3fec8b){_0x957193=_0x957193-0x0;var _0x9473f8=_0xed10[_0x957193];return _0x9473f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ed1('0x0'))(_0x0ed1('0x1'));var moment=require(_0x0ed1('0x2'));var BPromise=require(_0x0ed1('0x3'));var rp=require(_0x0ed1('0x4'));var fs=require('fs');var path=require(_0x0ed1('0x5'));var rimraf=require(_0x0ed1('0x6'));var config=require(_0x0ed1('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x0ed1('0x8')]=function(_0x5f5573,_0x5b5aaa){return _0x5f5573[_0x0ed1('0x9')](_0x0ed1('0xa'),attributes,{'tableName':_0x0ed1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ed1('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x984d92,_0x535341,_0x27ae01){if(_0x984d92[_0x0ed1('0xd')](_0x0ed1('0xe'))){_0x984d92[_0x0ed1('0xf')]=moment()[_0x0ed1('0x10')](_0x0ed1('0x11'));}_0x27ae01(null,_0x984d92);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index eadbf34..2691037 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 _0x70d9=['code','OpenchannelInteraction,\x20%s,\x20%s','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1cd811,_0x4abcda){var _0x4f1e02=function(_0x50944d){while(--_0x50944d){_0x1cd811['push'](_0x1cd811['shift']());}};_0x4f1e02(++_0x4abcda);}(_0x70d9,0x153));var _0x970d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x70d9[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x970d('0x0'));var util=require(_0x970d('0x1'));var moment=require(_0x970d('0x2'));var BPromise=require(_0x970d('0x3'));var rs=require(_0x970d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x970d('0x5'));var logger=require('../../config/logger')(_0x970d('0x6'));var config=require('../../config/environment');var jayson=require(_0x970d('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x970d('0x8')]=_[_0x970d('0x9')](config[_0x970d('0x8')],{'host':_0x970d('0xa'),'port':0x18eb});var socket=require(_0x970d('0xb'))(new Redis(config['redis']));require(_0x970d('0xc'))['register'](socket);function respondWithRpcPromise(_0x2c429c,_0xbc9cdb,_0x1a2a2f){return new BPromise(function(_0x4460f2,_0x544259){return client[_0x970d('0xd')](_0x2c429c,_0x1a2a2f)[_0x970d('0xe')](function(_0x1f6a85){logger[_0x970d('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0xbc9cdb,'request\x20sent');logger[_0x970d('0x10')](_0x970d('0x11'),_0xbc9cdb,_0x970d('0x12'),JSON[_0x970d('0x13')](_0x1f6a85));if(_0x1f6a85[_0x970d('0x14')]){if(_0x1f6a85[_0x970d('0x14')][_0x970d('0x15')]===0x1f4){logger['error'](_0x970d('0x16'),_0xbc9cdb,_0x1f6a85[_0x970d('0x14')][_0x970d('0x17')]);return _0x544259(_0x1f6a85['error'][_0x970d('0x17')]);}logger[_0x970d('0x14')](_0x970d('0x16'),_0xbc9cdb,_0x1f6a85['error']['message']);return _0x4460f2(_0x1f6a85[_0x970d('0x14')][_0x970d('0x17')]);}else{logger[_0x970d('0xf')](_0x970d('0x16'),_0xbc9cdb,_0x970d('0x12'));_0x4460f2(_0x1f6a85['result'][_0x970d('0x17')]);}})['catch'](function(_0x59ccc4){logger['error'](_0x970d('0x16'),_0xbc9cdb,_0x59ccc4);_0x544259(_0x59ccc4);});});}exports[_0x970d('0x18')]=function(_0x24081e){var _0x3088f2=this;return new Promise(function(_0x31d109,_0x1d6c10){return db[_0x970d('0x19')][_0x970d('0x1a')](_0x24081e['body'],{'raw':_0x24081e[_0x970d('0x1b')]?_0x24081e['options'][_0x970d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24081e[_0x970d('0x1b')]?_0x24081e['options'][_0x970d('0x1d')]||null:null,'attributes':_0x24081e['options']?_0x24081e[_0x970d('0x1b')][_0x970d('0x1e')]||null:null,'limit':_0x24081e[_0x970d('0x1b')]?_0x24081e[_0x970d('0x1b')][_0x970d('0x1f')]||null:null})['then'](function(_0x113ac8){logger['info'](_0x970d('0x18'),_0x24081e);logger[_0x970d('0x10')](_0x970d('0x18'),_0x24081e,JSON['stringify'](_0x113ac8));_0x31d109(_0x113ac8);})[_0x970d('0x20')](function(_0x5c4f72){logger[_0x970d('0x14')](_0x970d('0x18'),_0x5c4f72[_0x970d('0x17')],_0x24081e);_0x1d6c10(_0x3088f2[_0x970d('0x14')](0x1f4,_0x5c4f72[_0x970d('0x17')]));});});};exports[_0x970d('0x21')]=function(_0x201432){return new Promise(function(_0x51d339,_0x18c7fd){return db[_0x970d('0x19')][_0x970d('0x22')]({'where':_0x201432[_0x970d('0x1b')]?_0x201432['options'][_0x970d('0x1d')]||null:null})['then'](function(_0x5d83db){if(_0x5d83db){return _0x5d83db[_0x970d('0x23')](_0x201432['body']['ids'],_['omit'](_0x201432[_0x970d('0x24')],[_0x970d('0x25'),'id'])||{});}})[_0x970d('0x26')](function(_0x1f02d0){logger[_0x970d('0xf')](_0x970d('0x27'),_0x201432);logger[_0x970d('0x10')]('AddTags',_0x201432,JSON[_0x970d('0x13')](_0x1f02d0));_0x51d339(_0x1f02d0);})[_0x970d('0x20')](function(_0x12060e){logger[_0x970d('0x14')]('AddTags',_0x12060e[_0x970d('0x17')],_0x201432);_0x18c7fd(_this[_0x970d('0x14')](0x1f4,_0x12060e[_0x970d('0x17')]));});});}; \ No newline at end of file +var _0xd1a9=['omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids'];(function(_0x1c3c3c,_0x3ddb08){var _0x10f940=function(_0x415800){while(--_0x415800){_0x1c3c3c['push'](_0x1c3c3c['shift']());}};_0x10f940(++_0x3ddb08);}(_0xd1a9,0x162));var _0x9d1a=function(_0x411b68,_0x52e768){_0x411b68=_0x411b68-0x0;var _0x41ff90=_0xd1a9[_0x411b68];return _0x41ff90;};'use strict';var _=require(_0x9d1a('0x0'));var util=require(_0x9d1a('0x1'));var moment=require(_0x9d1a('0x2'));var BPromise=require(_0x9d1a('0x3'));var rs=require(_0x9d1a('0x4'));var fs=require('fs');var Redis=require(_0x9d1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d1a('0x6'));var logger=require(_0x9d1a('0x7'))('rpc');var config=require(_0x9d1a('0x8'));var jayson=require(_0x9d1a('0x9'));var client=jayson[_0x9d1a('0xa')][_0x9d1a('0xb')]({'port':0x232a});config[_0x9d1a('0xc')]=_[_0x9d1a('0xd')](config[_0x9d1a('0xc')],{'host':_0x9d1a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9d1a('0xf'))[_0x9d1a('0x10')](socket);function respondWithRpcPromise(_0x2074dd,_0x4dd7c0,_0x22c31c){return new BPromise(function(_0x24770b,_0x1885a6){return client[_0x9d1a('0x11')](_0x2074dd,_0x22c31c)[_0x9d1a('0x12')](function(_0x3ffd6f){logger[_0x9d1a('0x13')](_0x9d1a('0x14'),_0x4dd7c0,_0x9d1a('0x15'));logger[_0x9d1a('0x16')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4dd7c0,_0x9d1a('0x15'),JSON['stringify'](_0x3ffd6f));if(_0x3ffd6f[_0x9d1a('0x17')]){if(_0x3ffd6f[_0x9d1a('0x17')][_0x9d1a('0x18')]===0x1f4){logger[_0x9d1a('0x17')](_0x9d1a('0x14'),_0x4dd7c0,_0x3ffd6f['error'][_0x9d1a('0x19')]);return _0x1885a6(_0x3ffd6f[_0x9d1a('0x17')][_0x9d1a('0x19')]);}logger[_0x9d1a('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4dd7c0,_0x3ffd6f[_0x9d1a('0x17')][_0x9d1a('0x19')]);return _0x24770b(_0x3ffd6f['error'][_0x9d1a('0x19')]);}else{logger[_0x9d1a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4dd7c0,_0x9d1a('0x15'));_0x24770b(_0x3ffd6f[_0x9d1a('0x1a')][_0x9d1a('0x19')]);}})['catch'](function(_0x35577c){logger['error'](_0x9d1a('0x14'),_0x4dd7c0,_0x35577c);_0x1885a6(_0x35577c);});});}exports[_0x9d1a('0x1b')]=function(_0x33cbb5){var _0x1f1af2=this;return new Promise(function(_0x367aeb,_0x187c40){return db['OpenchannelInteraction'][_0x9d1a('0x1c')](_0x33cbb5[_0x9d1a('0x1d')],{'raw':_0x33cbb5[_0x9d1a('0x1e')]?_0x33cbb5[_0x9d1a('0x1e')][_0x9d1a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33cbb5[_0x9d1a('0x1e')]?_0x33cbb5['options'][_0x9d1a('0x20')]||null:null,'attributes':_0x33cbb5['options']?_0x33cbb5[_0x9d1a('0x1e')][_0x9d1a('0x21')]||null:null,'limit':_0x33cbb5[_0x9d1a('0x1e')]?_0x33cbb5[_0x9d1a('0x1e')][_0x9d1a('0x22')]||null:null})[_0x9d1a('0x12')](function(_0x205f11){logger[_0x9d1a('0x13')](_0x9d1a('0x1b'),_0x33cbb5);logger[_0x9d1a('0x16')](_0x9d1a('0x1b'),_0x33cbb5,JSON[_0x9d1a('0x23')](_0x205f11));_0x367aeb(_0x205f11);})[_0x9d1a('0x24')](function(_0x413e9b){logger[_0x9d1a('0x17')](_0x9d1a('0x1b'),_0x413e9b[_0x9d1a('0x19')],_0x33cbb5);_0x187c40(_0x1f1af2['error'](0x1f4,_0x413e9b[_0x9d1a('0x19')]));});});};exports[_0x9d1a('0x25')]=function(_0x6c6007){return new Promise(function(_0x19c61d,_0x44d44b){return db[_0x9d1a('0x26')][_0x9d1a('0x27')]({'where':_0x6c6007[_0x9d1a('0x1e')]?_0x6c6007[_0x9d1a('0x1e')][_0x9d1a('0x20')]||null:null})[_0x9d1a('0x12')](function(_0x2dcbf0){if(_0x2dcbf0){return _0x2dcbf0[_0x9d1a('0x28')](_0x6c6007['body'][_0x9d1a('0x29')],_[_0x9d1a('0x2a')](_0x6c6007[_0x9d1a('0x1d')],[_0x9d1a('0x29'),'id'])||{});}})['spread'](function(_0x29728f){logger[_0x9d1a('0x13')](_0x9d1a('0x2b'),_0x6c6007);logger['debug']('AddTags',_0x6c6007,JSON[_0x9d1a('0x23')](_0x29728f));_0x19c61d(_0x29728f);})[_0x9d1a('0x24')](function(_0x4f2d7b){logger[_0x9d1a('0x17')](_0x9d1a('0x2b'),_0x4f2d7b[_0x9d1a('0x19')],_0x6c6007);_0x44d44b(_this[_0x9d1a('0x17')](0x1f4,_0x4f2d7b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index da60927..080f6d1 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 _0xb7c8=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb7c8,0x1e2));var _0x8b7c=function(_0x5c4426,_0x26a104){_0x5c4426=_0x5c4426-0x0;var _0x50a962=_0xb7c8[_0x5c4426];return _0x50a962;};'use strict';var OpenchannelInteractionEvents=require(_0x8b7c('0x0'));var events=[_0x8b7c('0x1'),_0x8b7c('0x2'),_0x8b7c('0x3')];function createListener(_0x5734b9,_0x4ea196){return function(_0x21df4d){_0x4ea196[_0x8b7c('0x4')](_0x5734b9,_0x21df4d);};}function removeListener(_0x4f8149,_0x55f912){return function(){OpenchannelInteractionEvents[_0x8b7c('0x5')](_0x4f8149,_0x55f912);};}exports[_0x8b7c('0x6')]=function(_0x39a69f){for(var _0x477d5b=0x0,_0x574629=events[_0x8b7c('0x7')];_0x477d5b<_0x574629;_0x477d5b++){var _0x2f7a9a=events[_0x477d5b];var _0x273e1b=createListener(_0x8b7c('0x8')+_0x2f7a9a,_0x39a69f);OpenchannelInteractionEvents['on'](_0x2f7a9a,_0x273e1b);}}; \ No newline at end of file +var _0x0b3f=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','length'];(function(_0x390e0c,_0x208cdf){var _0x9f4426=function(_0x4bd556){while(--_0x4bd556){_0x390e0c['push'](_0x390e0c['shift']());}};_0x9f4426(++_0x208cdf);}(_0x0b3f,0xda));var _0xf0b3=function(_0x568ef3,_0x4e4ba7){_0x568ef3=_0x568ef3-0x0;var _0x496d4a=_0x0b3f[_0x568ef3];return _0x496d4a;};'use strict';var OpenchannelInteractionEvents=require(_0xf0b3('0x0'));var events=[_0xf0b3('0x1'),_0xf0b3('0x2'),_0xf0b3('0x3')];function createListener(_0x42a0b8,_0x4148c2){return function(_0x3c214b){_0x4148c2['emit'](_0x42a0b8,_0x3c214b);};}function removeListener(_0x5efbaa,_0x1145e6){return function(){OpenchannelInteractionEvents[_0xf0b3('0x4')](_0x5efbaa,_0x1145e6);};}exports['register']=function(_0x1004db){for(var _0x1b4126=0x0,_0x1cecca=events[_0xf0b3('0x5')];_0x1b4126<_0x1cecca;_0x1b4126++){var _0x22c281=events[_0x1b4126];var _0x3bd3dd=createListener(_0xf0b3('0x6')+_0x22c281,_0x1004db);OpenchannelInteractionEvents['on'](_0x22c281,_0x3bd3dd);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9a783a1..7e59e20 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(_0x2696b2,_0x4dd5c4){var _0x22418a=function(_0x3ec486){while(--_0x3ec486){_0x2696b2['push'](_0x2696b2['shift']());}};_0x22418a(++_0x4dd5c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ddb8e0a..32adc7f 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 _0x8580=['medium','ENUM','out','DATE','STRING','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8580,0x1c7));var _0x0858=function(_0x25ff97,_0x375688){_0x25ff97=_0x25ff97-0x0;var _0x19b811=_0x8580[_0x25ff97];return _0x19b811;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0858('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0858('0x2')]('in',_0x0858('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0858('0x4')]},'providerName':{'type':Sequelize[_0x0858('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3e22=['exports','medium','BOOLEAN','ENUM','DATE','STRING'];(function(_0x34b624,_0x27cf25){var _0x58fe99=function(_0x1e3ad6){while(--_0x1e3ad6){_0x34b624['push'](_0x34b624['shift']());}};_0x58fe99(++_0x27cf25);}(_0x3e22,0xa8));var _0x23e2=function(_0x2daf7b,_0x310791){_0x2daf7b=_0x2daf7b-0x0;var _0x4a1f8c=_0x3e22[_0x2daf7b];return _0x4a1f8c;};'use strict';var Sequelize=require('sequelize');module[_0x23e2('0x0')]={'body':{'type':Sequelize['TEXT'](_0x23e2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x23e2('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x23e2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23e2('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x23e2('0x4')]},'providerName':{'type':Sequelize[_0x23e2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 77495d9..b1366e8 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 _0x18c3=['rows','show','find','create','body','params','describe','accept','openchannel','read','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','User','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./openchannelMessage.socket','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x45a261,_0x4cd98a){var _0x341ab3=function(_0x2044ea){while(--_0x2044ea){_0x45a261['push'](_0x45a261['shift']());}};_0x341ab3(++_0x4cd98a);}(_0x18c3,0x136));var _0x318c=function(_0x142b99,_0x1d85e2){_0x142b99=_0x142b99-0x0;var _0x539ecd=_0x18c3[_0x142b99];return _0x539ecd;};'use strict';var emlformat=require(_0x318c('0x0'));var rimraf=require(_0x318c('0x1'));var zipdir=require(_0x318c('0x2'));var jsonpatch=require(_0x318c('0x3'));var rp=require('request-promise');var moment=require(_0x318c('0x4'));var BPromise=require(_0x318c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x318c('0x6'));var sox=require(_0x318c('0x7'));var csv=require(_0x318c('0x8'));var ejs=require(_0x318c('0x9'));var fs=require('fs');var fs_extra=require(_0x318c('0xa'));var _=require('lodash');var squel=require(_0x318c('0xb'));var crypto=require(_0x318c('0xc'));var jsforce=require(_0x318c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x318c('0x8'));var querystring=require(_0x318c('0xe'));var Papa=require('papaparse');var Redis=require(_0x318c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x318c('0x10'));var as=require(_0x318c('0x11'));var hardwareService=require(_0x318c('0x12'));var logger=require(_0x318c('0x13'))(_0x318c('0x14'));var utils=require(_0x318c('0x15'));var config=require(_0x318c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x318c('0x17')]=_['defaults'](config[_0x318c('0x17')],{'host':_0x318c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x318c('0x17')]));require(_0x318c('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x318c('0x1a')][_0x318c('0x1b')]({'port':0x232c});var client9002=jayson[_0x318c('0x1a')][_0x318c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5aca1f,_0x4fe18d,_0x532fb2,_0x4af510){return new BPromise(function(_0x58f0be,_0x2a0f62){var _0x53688b=_0x4af510||client;return _0x53688b[_0x318c('0x1c')](_0x5aca1f,_0x532fb2)[_0x318c('0x1d')](function(_0x2fc427){logger[_0x318c('0x1e')](_0x318c('0x1f'),_0x4fe18d,_0x318c('0x20'));logger['debug'](_0x318c('0x21'),_0x4fe18d,_0x318c('0x20'),JSON[_0x318c('0x22')](_0x2fc427));if(_0x2fc427[_0x318c('0x23')]){if(_0x2fc427[_0x318c('0x23')][_0x318c('0x24')]===0x1f4){logger[_0x318c('0x23')](_0x318c('0x1f'),_0x4fe18d,_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);return _0x2a0f62(_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);}logger[_0x318c('0x23')](_0x318c('0x1f'),_0x4fe18d,_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);return _0x58f0be(_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);}else{logger['info'](_0x318c('0x1f'),_0x4fe18d,_0x318c('0x20'));_0x58f0be(_0x2fc427[_0x318c('0x26')][_0x318c('0x25')]);}})[_0x318c('0x27')](function(_0x48410e){logger['error'](_0x318c('0x1f'),_0x4fe18d,_0x48410e);_0x2a0f62(_0x48410e);});});}function respondWithStatusCode(_0x813b08,_0x42a28b){_0x42a28b=_0x42a28b||0xcc;return function(_0x3ec184){if(_0x3ec184){return _0x813b08[_0x318c('0x28')](_0x42a28b);}return _0x813b08[_0x318c('0x29')](_0x42a28b)[_0x318c('0x2a')]();};}function respondWithResult(_0x39d43c,_0x4e26b5){_0x4e26b5=_0x4e26b5||0xc8;return function(_0x301362){if(_0x301362){return _0x39d43c[_0x318c('0x29')](_0x4e26b5)[_0x318c('0x2b')](_0x301362);}};}function respondWithFilteredResult(_0x261e6f,_0x49d3ec){return function(_0x535215){if(_0x535215){var _0x235cf6=typeof _0x49d3ec[_0x318c('0x2c')]===_0x318c('0x2d')&&typeof _0x49d3ec[_0x318c('0x2e')]===_0x318c('0x2d');var _0x55103c=_0x535215[_0x318c('0x2f')];var _0xe14dfd=_0x235cf6?0x0:_0x49d3ec['offset'];var _0x415806=_0x235cf6?_0x535215['count']:_0x49d3ec[_0x318c('0x2c')]+_0x49d3ec['limit'];var _0x18f58b;if(_0x415806>=_0x55103c){_0x415806=_0x55103c;_0x18f58b=0xc8;}else{_0x18f58b=0xce;}_0x261e6f[_0x318c('0x29')](_0x18f58b);return _0x261e6f['set'](_0x318c('0x30'),_0xe14dfd+'-'+_0x415806+'/'+_0x55103c)[_0x318c('0x2b')](_0x535215);}return null;};}function patchUpdates(_0x1d00d5){return function(_0x298d56){try{jsonpatch[_0x318c('0x31')](_0x298d56,_0x1d00d5,!![]);}catch(_0x28adeb){return BPromise[_0x318c('0x32')](_0x28adeb);}return _0x298d56[_0x318c('0x33')]();};}function saveUpdates(_0x35175b,_0x427be7){return function(_0x39c9ae){if(_0x39c9ae){return _0x39c9ae[_0x318c('0x34')](_0x35175b)[_0x318c('0x1d')](function(_0x6a5052){return _0x6a5052;});}return null;};}function removeEntity(_0x19656f,_0xd43df9){return function(_0x488218){if(_0x488218){return _0x488218[_0x318c('0x35')]()['then'](function(){_0x19656f[_0x318c('0x29')](0xcc)[_0x318c('0x2a')]();});}};}function handleEntityNotFound(_0x33f750,_0x29a8f5){return function(_0x53faa2){if(!_0x53faa2){_0x33f750['sendStatus'](0x194);}return _0x53faa2;};}function handleError(_0x565a83,_0x125c0d){_0x125c0d=_0x125c0d||0x1f4;return function(_0x334013){logger[_0x318c('0x23')](_0x334013[_0x318c('0x36')]);if(_0x334013[_0x318c('0x37')]){delete _0x334013[_0x318c('0x37')];}_0x565a83[_0x318c('0x29')](_0x125c0d)[_0x318c('0x38')](_0x334013);};}exports[_0x318c('0x39')]=function(_0x523bc4,_0x246cfc){var _0x14cb03={},_0x1f6c3b={},_0x4d8cdb={'count':0x0,'rows':[]};var _0x4be505=_[_0x318c('0x3a')](db[_0x318c('0x3b')][_0x318c('0x3c')],function(_0x625db9){return{'name':_0x625db9[_0x318c('0x3d')],'type':_0x625db9['type'][_0x318c('0x3e')]};});_0x1f6c3b[_0x318c('0x3f')]=_[_0x318c('0x3a')](_0x4be505,'name');_0x1f6c3b[_0x318c('0x40')]=_[_0x318c('0x41')](_0x523bc4['query']);_0x1f6c3b[_0x318c('0x42')]=_[_0x318c('0x43')](_0x1f6c3b[_0x318c('0x3f')],_0x1f6c3b[_0x318c('0x40')]);_0x14cb03[_0x318c('0x44')]=_['intersection'](_0x1f6c3b['model'],qs[_0x318c('0x45')](_0x523bc4[_0x318c('0x40')][_0x318c('0x45')]));_0x14cb03[_0x318c('0x44')]=_0x14cb03[_0x318c('0x44')][_0x318c('0x46')]?_0x14cb03[_0x318c('0x44')]:_0x1f6c3b[_0x318c('0x3f')];if(!_0x523bc4['query']['hasOwnProperty'](_0x318c('0x47'))){_0x14cb03['limit']=qs['limit'](_0x523bc4[_0x318c('0x40')][_0x318c('0x2e')]);_0x14cb03[_0x318c('0x2c')]=qs['offset'](_0x523bc4[_0x318c('0x40')][_0x318c('0x2c')]);}_0x14cb03['order']=qs[_0x318c('0x48')](_0x523bc4[_0x318c('0x40')][_0x318c('0x48')]);_0x14cb03[_0x318c('0x49')]=qs['filters'](_[_0x318c('0x4a')](_0x523bc4[_0x318c('0x40')],_0x1f6c3b[_0x318c('0x42')]),_0x4be505);if(_0x523bc4[_0x318c('0x40')][_0x318c('0x4b')]){_0x14cb03[_0x318c('0x49')]=_[_0x318c('0x4c')](_0x14cb03['where'],{'$or':_[_0x318c('0x3a')](_0x4be505,function(_0x54d722){if(_0x54d722[_0x318c('0x4d')]!==_0x318c('0x4e')){var _0x433fd4={};_0x433fd4[_0x54d722['name']]={'$like':'%'+_0x523bc4[_0x318c('0x40')][_0x318c('0x4b')]+'%'};return _0x433fd4;}})});}_0x14cb03=_[_0x318c('0x4c')]({},_0x14cb03,_0x523bc4[_0x318c('0x4f')]);var _0x34b55e={'where':_0x14cb03['where']};return db[_0x318c('0x3b')][_0x318c('0x2f')](_0x34b55e)[_0x318c('0x1d')](function(_0x4db86a){_0x4d8cdb[_0x318c('0x2f')]=_0x4db86a;if(_0x523bc4['query'][_0x318c('0x50')]){_0x14cb03[_0x318c('0x51')]=[{'all':!![]}];}return db[_0x318c('0x3b')][_0x318c('0x52')](_0x14cb03);})[_0x318c('0x1d')](function(_0x1c6779){_0x4d8cdb[_0x318c('0x53')]=_0x1c6779;return _0x4d8cdb;})[_0x318c('0x1d')](respondWithFilteredResult(_0x246cfc,_0x14cb03))[_0x318c('0x27')](handleError(_0x246cfc,null));};exports[_0x318c('0x54')]=function(_0x4e9913,_0x561e15){var _0x351fdb={'raw':!![],'where':{'id':_0x4e9913['params']['id']}},_0x11b8a6={};_0x11b8a6[_0x318c('0x3f')]=_[_0x318c('0x41')](db[_0x318c('0x3b')][_0x318c('0x3c')]);_0x11b8a6['query']=_[_0x318c('0x41')](_0x4e9913['query']);_0x11b8a6['filters']=_[_0x318c('0x43')](_0x11b8a6[_0x318c('0x3f')],_0x11b8a6[_0x318c('0x40')]);_0x351fdb[_0x318c('0x44')]=_['intersection'](_0x11b8a6['model'],qs['fields'](_0x4e9913[_0x318c('0x40')][_0x318c('0x45')]));_0x351fdb[_0x318c('0x44')]=_0x351fdb[_0x318c('0x44')]['length']?_0x351fdb[_0x318c('0x44')]:_0x11b8a6[_0x318c('0x3f')];if(_0x4e9913[_0x318c('0x40')][_0x318c('0x50')]){_0x351fdb[_0x318c('0x51')]=[{'all':!![]}];}_0x351fdb=_['merge']({},_0x351fdb,_0x4e9913[_0x318c('0x4f')]);return db[_0x318c('0x3b')][_0x318c('0x55')](_0x351fdb)[_0x318c('0x1d')](handleEntityNotFound(_0x561e15,null))[_0x318c('0x1d')](respondWithResult(_0x561e15,null))['catch'](handleError(_0x561e15,null));};exports[_0x318c('0x56')]=function(_0x811755,_0xf4afbf){return db[_0x318c('0x3b')][_0x318c('0x56')](_0x811755[_0x318c('0x57')],{})[_0x318c('0x1d')](respondWithResult(_0xf4afbf,0xc9))[_0x318c('0x27')](handleError(_0xf4afbf,null));};exports['update']=function(_0x495e6a,_0x4bad46){if(_0x495e6a[_0x318c('0x57')]['id']){delete _0x495e6a[_0x318c('0x57')]['id'];}return db[_0x318c('0x3b')]['find']({'where':{'id':_0x495e6a[_0x318c('0x58')]['id']}})[_0x318c('0x1d')](handleEntityNotFound(_0x4bad46,null))['then'](saveUpdates(_0x495e6a[_0x318c('0x57')],null))['then'](respondWithResult(_0x4bad46,null))['catch'](handleError(_0x4bad46,null));};exports[_0x318c('0x35')]=function(_0x3e6363,_0x42c711){return db['OpenchannelMessage'][_0x318c('0x55')]({'where':{'id':_0x3e6363['params']['id']}})['then'](handleEntityNotFound(_0x42c711,null))[_0x318c('0x1d')](removeEntity(_0x42c711,null))[_0x318c('0x27')](handleError(_0x42c711,null));};exports[_0x318c('0x59')]=function(_0x39d6fb,_0x4682c1){return db[_0x318c('0x3b')][_0x318c('0x59')]()[_0x318c('0x1d')](respondWithResult(_0x4682c1,null))['catch'](handleError(_0x4682c1,null));};var interaction_log=require(_0x318c('0x13'))('openchannel-interactions');exports[_0x318c('0x5a')]=function(_0xc27de0,_0xbcb79,_0x101ae6){var _0x33d4e9={'agent':{},'channel':_0x318c('0x5b')};if(_0xc27de0[_0x318c('0x57')]['id']){delete _0xc27de0[_0x318c('0x57')]['id'];}_0xc27de0[_0x318c('0x57')][_0x318c('0x5c')]=!![];_0xc27de0['body']['readAt']=moment()[_0x318c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')]=_0xc27de0[_0x318c('0x57')]['UserId']||_0xc27de0[_0x318c('0x5f')]['id'];_0x33d4e9[_0x318c('0x60')]['id']=_0xc27de0[_0x318c('0x57')]['UserId'];return db[_0x318c('0x3b')][_0x318c('0x55')]({'where':{'id':_0xc27de0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbcb79,null))[_0x318c('0x1d')](saveUpdates(_0xc27de0['body'],null))[_0x318c('0x1d')](function(_0xeb01d6){if(_0xeb01d6){_0x33d4e9[_0x318c('0x25')]=_0xeb01d6[_0x318c('0x61')]({'plain':!![]});return db[_0x318c('0x62')][_0x318c('0x55')]({'where':{'id':_0xeb01d6[_0x318c('0x63')]}});}return null;})[_0x318c('0x1d')](handleEntityNotFound(_0xbcb79,null))[_0x318c('0x1d')](function(_0x40fd87){if(_0x40fd87){return _0x40fd87[_0x318c('0x34')]({'UserId':_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')],'read1stAt':_['isNil'](_0x40fd87[_0x318c('0x64')])?moment()[_0x318c('0x5d')](_0x318c('0x65')):undefined});}return null;})[_0x318c('0x1d')](function(_0x599b9a){if(_0x599b9a){_0x33d4e9['interaction']=_0x599b9a[_0x318c('0x61')]({'plain':!![]});interaction_log[_0x318c('0x1e')](_0x318c('0x66'),_0xc27de0['user']['id'],_0xc27de0[_0x318c('0x5f')][_0x318c('0x37')],_0xc27de0['user']['role'],_0x33d4e9['interaction']['id'],_0xc27de0[_0x318c('0x57')]?JSON[_0x318c('0x22')](_0xc27de0[_0x318c('0x57')]):_0x318c('0x67'));return respondWithRpcPromise(_0x318c('0x68'),_0x318c('0x69'),_0x33d4e9);}return null;})[_0x318c('0x1d')](function(_0x44a40e){var _0xa46f32=_0x318c('0x6a')+_0x44a40e[_0x318c('0x25')][_0x318c('0x6b')];return db[_0x318c('0x6c')]['query'](_0xa46f32,{'type':db[_0x318c('0x6d')]['QueryTypes'][_0x318c('0x6e')],'raw':!![]})[_0x318c('0x1d')](function(_0x8abfe0){return _0x8abfe0;});})[_0x318c('0x1d')](function(_0x313479){if(_0x313479){_0x33d4e9[_0x318c('0x25')][_0x318c('0x6f')]=_0x313479[0x0];if(!_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')])return;return db['User'][_0x318c('0x55')]({'where':{'id':_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')],'role':'agent'},'attributes':['id',_0x318c('0x37'),_0x318c('0x70'),_0x318c('0x71'),_0x318c('0x72')],'raw':!![]});}return null;})[_0x318c('0x1d')](function(_0x5bc581){if(!_0x5bc581)return null;_0x33d4e9[_0x318c('0x25')][_0x318c('0x60')]=_0x5bc581;return _0x33d4e9;})['then'](function(_0x23caef){if(_0x23caef){if(_0xc27de0['body'][_0x318c('0x73')]){_0x33d4e9['message'][_0x318c('0x74')]=util[_0x318c('0x5d')](_0x318c('0x75'),_0xc27de0[_0x318c('0x5f')][_0x318c('0x37')]);_0x33d4e9[_0x318c('0x25')][_0x318c('0x76')]=_0x33d4e9[_0x318c('0x76')];_0x33d4e9[_0x318c('0x25')]['motionChannel']=_0x33d4e9['channel'];_0x33d4e9[_0x318c('0x25')][_0x318c('0x77')]=_0x318c('0x5a');return respondWithRpcPromise(_0x318c('0x78'),'EventManager',{'event':_0x318c('0x79'),'message':_0x33d4e9[_0x318c('0x25')]},client9002)[_0x318c('0x1d')](function(){return _0x33d4e9;});}return _0x33d4e9;}return null;})[_0x318c('0x1d')](respondWithResult(_0xbcb79,null))['catch'](handleError(_0xbcb79,null));};var interaction_log=require(_0x318c('0x13'))(_0x318c('0x7a'));exports[_0x318c('0x32')]=function(_0x53e3dc,_0x384ae1,_0x10d5ce){var _0x2f58b0={'agent':{},'channel':_0x318c('0x5b')};if(_0x53e3dc[_0x318c('0x57')]['id']){delete _0x53e3dc[_0x318c('0x57')]['id'];}_0x53e3dc[_0x318c('0x57')][_0x318c('0x5e')]=_0x53e3dc['body'][_0x318c('0x5e')]||_0x53e3dc[_0x318c('0x5f')]['id'];_0x2f58b0[_0x318c('0x60')]['id']=_0x53e3dc[_0x318c('0x57')][_0x318c('0x5e')];return db['OpenchannelMessage'][_0x318c('0x55')]({'where':{'id':_0x53e3dc[_0x318c('0x58')]['id'],'UserId':null}})[_0x318c('0x1d')](handleEntityNotFound(_0x384ae1,null))['then'](function(_0x19a94d){if(_0x19a94d){_0x2f58b0['message']=_0x19a94d[_0x318c('0x61')]({'plain':!![]});return db[_0x318c('0x62')][_0x318c('0x55')]({'where':{'id':_0x19a94d[_0x318c('0x63')]}});}return null;})[_0x318c('0x1d')](handleEntityNotFound(_0x384ae1,null))[_0x318c('0x1d')](function(_0x11cac1){if(_0x11cac1){_0x2f58b0[_0x318c('0x7b')]=_0x11cac1['get']({'plain':!![]});interaction_log['info'](_0x318c('0x7c'),_0x53e3dc[_0x318c('0x5f')]['id'],_0x53e3dc[_0x318c('0x5f')][_0x318c('0x37')],_0x53e3dc[_0x318c('0x5f')][_0x318c('0x7d')],_0x2f58b0[_0x318c('0x7b')]['id'],_0x53e3dc[_0x318c('0x57')]?JSON[_0x318c('0x22')](_0x53e3dc[_0x318c('0x57')]):_0x318c('0x67'));return respondWithRpcPromise('RejectMessage',_0x318c('0x7e'),_0x2f58b0);}return null;})[_0x318c('0x1d')](function(_0x45a8c1){var _0x6b76d2=_0x318c('0x6a')+_0x45a8c1[_0x318c('0x25')]['ContactId'];return db[_0x318c('0x6c')][_0x318c('0x40')](_0x6b76d2,{'type':db[_0x318c('0x6d')][_0x318c('0x7f')][_0x318c('0x6e')],'raw':!![]})[_0x318c('0x1d')](function(_0x270a47){return _0x270a47;});})[_0x318c('0x1d')](function(_0x583ff1){if(_0x583ff1){_0x2f58b0[_0x318c('0x25')][_0x318c('0x6f')]=_0x583ff1[0x0];if(!_0x53e3dc['body']['UserId'])return;return db[_0x318c('0x80')][_0x318c('0x55')]({'where':{'id':_0x53e3dc[_0x318c('0x57')]['UserId'],'role':_0x318c('0x60')},'attributes':['id','name','fullname',_0x318c('0x71'),_0x318c('0x72')],'raw':!![]});}return null;})[_0x318c('0x1d')](function(_0x5687b5){if(!_0x5687b5)return null;_0x2f58b0['message']['agent']=_0x5687b5;return _0x2f58b0;})['then'](function(_0x2e99e1){if(_0x2e99e1){_0x2e99e1[_0x318c('0x25')][_0x318c('0x74')]=util[_0x318c('0x5d')](_0x318c('0x75'),_0x53e3dc[_0x318c('0x5f')]['name']);_0x2e99e1['message'][_0x318c('0x76')]=_0x2f58b0[_0x318c('0x76')];_0x2e99e1[_0x318c('0x25')][_0x318c('0x81')]=_0x2f58b0[_0x318c('0x76')];_0x2e99e1[_0x318c('0x25')][_0x318c('0x77')]=_0x318c('0x32');respondWithRpcPromise(_0x318c('0x78'),_0x318c('0x78'),{'event':_0x318c('0x82'),'message':_0x2e99e1['message']},client9002);return _0x2f58b0;}return null;})['then'](respondWithResult(_0x384ae1,null))[_0x318c('0x27')](handleError(_0x384ae1,null));}; \ No newline at end of file +var _0x1b4f=['count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','model','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE: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','fullname','email','internal','manual','channel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','interface','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','undefined'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b4f,0xd8));var _0xf1b4=function(_0x1e1408,_0x3d691c){_0x1e1408=_0x1e1408-0x0;var _0xe7c171=_0x1b4f[_0x1e1408];return _0xe7c171;};'use strict';var emlformat=require(_0xf1b4('0x0'));var rimraf=require(_0xf1b4('0x1'));var zipdir=require(_0xf1b4('0x2'));var jsonpatch=require(_0xf1b4('0x3'));var rp=require(_0xf1b4('0x4'));var moment=require(_0xf1b4('0x5'));var BPromise=require(_0xf1b4('0x6'));var Mustache=require('mustache');var util=require(_0xf1b4('0x7'));var path=require('path');var sox=require(_0xf1b4('0x8'));var csv=require(_0xf1b4('0x9'));var ejs=require(_0xf1b4('0xa'));var fs=require('fs');var fs_extra=require(_0xf1b4('0xb'));var _=require(_0xf1b4('0xc'));var squel=require(_0xf1b4('0xd'));var crypto=require(_0xf1b4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf1b4('0xf'));var toCsv=require(_0xf1b4('0x9'));var querystring=require(_0xf1b4('0x10'));var Papa=require('papaparse');var Redis=require(_0xf1b4('0x11'));var authService=require(_0xf1b4('0x12'));var qs=require(_0xf1b4('0x13'));var as=require(_0xf1b4('0x14'));var hardwareService=require(_0xf1b4('0x15'));var logger=require('../../config/logger')(_0xf1b4('0x16'));var utils=require(_0xf1b4('0x17'));var config=require(_0xf1b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1b4('0x19'))['db'];config['redis']=_[_0xf1b4('0x1a')](config[_0xf1b4('0x1b')],{'host':_0xf1b4('0x1c'),'port':0x18eb});var socket=require(_0xf1b4('0x1d'))(new Redis(config[_0xf1b4('0x1b')]));require(_0xf1b4('0x1e'))['register'](socket);var jayson=require(_0xf1b4('0x1f'));var client=jayson[_0xf1b4('0x20')][_0xf1b4('0x21')]({'port':0x232c});var client9002=jayson[_0xf1b4('0x20')][_0xf1b4('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x57b832,_0x566a3e,_0x1a5171,_0x206d10){return new BPromise(function(_0x180cc6,_0x330c8c){var _0x9f5bf5=_0x206d10||client;return _0x9f5bf5[_0xf1b4('0x22')](_0x57b832,_0x1a5171)[_0xf1b4('0x23')](function(_0xe8e2c6){logger[_0xf1b4('0x24')](_0xf1b4('0x25'),_0x566a3e,_0xf1b4('0x26'));logger[_0xf1b4('0x27')](_0xf1b4('0x28'),_0x566a3e,'request\x20sent',JSON[_0xf1b4('0x29')](_0xe8e2c6));if(_0xe8e2c6[_0xf1b4('0x2a')]){if(_0xe8e2c6[_0xf1b4('0x2a')][_0xf1b4('0x2b')]===0x1f4){logger[_0xf1b4('0x2a')](_0xf1b4('0x25'),_0x566a3e,_0xe8e2c6[_0xf1b4('0x2a')]['message']);return _0x330c8c(_0xe8e2c6[_0xf1b4('0x2a')][_0xf1b4('0x2c')]);}logger[_0xf1b4('0x2a')](_0xf1b4('0x25'),_0x566a3e,_0xe8e2c6[_0xf1b4('0x2a')]['message']);return _0x180cc6(_0xe8e2c6[_0xf1b4('0x2a')][_0xf1b4('0x2c')]);}else{logger[_0xf1b4('0x24')](_0xf1b4('0x25'),_0x566a3e,_0xf1b4('0x26'));_0x180cc6(_0xe8e2c6['result'][_0xf1b4('0x2c')]);}})['catch'](function(_0x4938e8){logger[_0xf1b4('0x2a')](_0xf1b4('0x25'),_0x566a3e,_0x4938e8);_0x330c8c(_0x4938e8);});});}function respondWithStatusCode(_0x1d384b,_0x132af6){_0x132af6=_0x132af6||0xcc;return function(_0x3a50c5){if(_0x3a50c5){return _0x1d384b['sendStatus'](_0x132af6);}return _0x1d384b[_0xf1b4('0x2d')](_0x132af6)[_0xf1b4('0x2e')]();};}function respondWithResult(_0x1b679d,_0x235dd1){_0x235dd1=_0x235dd1||0xc8;return function(_0x52c372){if(_0x52c372){return _0x1b679d[_0xf1b4('0x2d')](_0x235dd1)['json'](_0x52c372);}};}function respondWithFilteredResult(_0x4d3c7e,_0x26871e){return function(_0x2c0dae){if(_0x2c0dae){var _0x1e4161=typeof _0x26871e['offset']===_0xf1b4('0x2f')&&typeof _0x26871e['limit']===_0xf1b4('0x2f');var _0xb402dc=_0x2c0dae['count'];var _0x405f2e=_0x1e4161?0x0:_0x26871e['offset'];var _0x36f9c3=_0x1e4161?_0x2c0dae[_0xf1b4('0x30')]:_0x26871e[_0xf1b4('0x31')]+_0x26871e[_0xf1b4('0x32')];var _0x55c39a;if(_0x36f9c3>=_0xb402dc){_0x36f9c3=_0xb402dc;_0x55c39a=0xc8;}else{_0x55c39a=0xce;}_0x4d3c7e[_0xf1b4('0x2d')](_0x55c39a);return _0x4d3c7e[_0xf1b4('0x33')](_0xf1b4('0x34'),_0x405f2e+'-'+_0x36f9c3+'/'+_0xb402dc)['json'](_0x2c0dae);}return null;};}function patchUpdates(_0x5c3800){return function(_0x7dcfe8){try{jsonpatch['apply'](_0x7dcfe8,_0x5c3800,!![]);}catch(_0x2df057){return BPromise[_0xf1b4('0x35')](_0x2df057);}return _0x7dcfe8[_0xf1b4('0x36')]();};}function saveUpdates(_0x4070fb,_0x9339e0){return function(_0x1b7a35){if(_0x1b7a35){return _0x1b7a35[_0xf1b4('0x37')](_0x4070fb)[_0xf1b4('0x23')](function(_0x551268){return _0x551268;});}return null;};}function removeEntity(_0x2a58f9,_0x52bfcb){return function(_0x1687c4){if(_0x1687c4){return _0x1687c4['destroy']()[_0xf1b4('0x23')](function(){_0x2a58f9[_0xf1b4('0x2d')](0xcc)[_0xf1b4('0x2e')]();});}};}function handleEntityNotFound(_0x12dbbc,_0x19f260){return function(_0x65b692){if(!_0x65b692){_0x12dbbc['sendStatus'](0x194);}return _0x65b692;};}function handleError(_0x372943,_0x39505a){_0x39505a=_0x39505a||0x1f4;return function(_0x51d823){logger[_0xf1b4('0x2a')](_0x51d823[_0xf1b4('0x38')]);if(_0x51d823['name']){delete _0x51d823[_0xf1b4('0x39')];}_0x372943[_0xf1b4('0x2d')](_0x39505a)['send'](_0x51d823);};}exports[_0xf1b4('0x3a')]=function(_0x5a3f23,_0x2a5140){var _0x3ab877={},_0x586865={},_0x2b81ac={'count':0x0,'rows':[]};var _0x57f05a=_[_0xf1b4('0x3b')](db[_0xf1b4('0x3c')][_0xf1b4('0x3d')],function(_0x4b0d16){return{'name':_0x4b0d16[_0xf1b4('0x3e')],'type':_0x4b0d16[_0xf1b4('0x3f')][_0xf1b4('0x40')]};});_0x586865['model']=_['map'](_0x57f05a,_0xf1b4('0x39'));_0x586865['query']=_[_0xf1b4('0x41')](_0x5a3f23['query']);_0x586865['filters']=_['intersection'](_0x586865[_0xf1b4('0x42')],_0x586865['query']);_0x3ab877[_0xf1b4('0x43')]=_[_0xf1b4('0x44')](_0x586865[_0xf1b4('0x42')],qs[_0xf1b4('0x45')](_0x5a3f23[_0xf1b4('0x46')][_0xf1b4('0x45')]));_0x3ab877[_0xf1b4('0x43')]=_0x3ab877['attributes'][_0xf1b4('0x47')]?_0x3ab877[_0xf1b4('0x43')]:_0x586865[_0xf1b4('0x42')];if(!_0x5a3f23[_0xf1b4('0x46')][_0xf1b4('0x48')](_0xf1b4('0x49'))){_0x3ab877[_0xf1b4('0x32')]=qs[_0xf1b4('0x32')](_0x5a3f23[_0xf1b4('0x46')][_0xf1b4('0x32')]);_0x3ab877[_0xf1b4('0x31')]=qs[_0xf1b4('0x31')](_0x5a3f23['query'][_0xf1b4('0x31')]);}_0x3ab877[_0xf1b4('0x4a')]=qs[_0xf1b4('0x4b')](_0x5a3f23['query'][_0xf1b4('0x4b')]);_0x3ab877[_0xf1b4('0x4c')]=qs[_0xf1b4('0x4d')](_[_0xf1b4('0x4e')](_0x5a3f23['query'],_0x586865['filters']),_0x57f05a);if(_0x5a3f23['query'][_0xf1b4('0x4f')]){_0x3ab877['where']=_[_0xf1b4('0x50')](_0x3ab877[_0xf1b4('0x4c')],{'$or':_[_0xf1b4('0x3b')](_0x57f05a,function(_0x2bc9df){if(_0x2bc9df['type']!==_0xf1b4('0x51')){var _0x30ae37={};_0x30ae37[_0x2bc9df[_0xf1b4('0x39')]]={'$like':'%'+_0x5a3f23[_0xf1b4('0x46')]['filter']+'%'};return _0x30ae37;}})});}_0x3ab877=_[_0xf1b4('0x50')]({},_0x3ab877,_0x5a3f23[_0xf1b4('0x52')]);var _0x21c755={'where':_0x3ab877[_0xf1b4('0x4c')]};return db[_0xf1b4('0x3c')][_0xf1b4('0x30')](_0x21c755)[_0xf1b4('0x23')](function(_0x18ff2f){_0x2b81ac[_0xf1b4('0x30')]=_0x18ff2f;if(_0x5a3f23['query']['includeAll']){_0x3ab877[_0xf1b4('0x53')]=[{'all':!![]}];}return db[_0xf1b4('0x3c')][_0xf1b4('0x54')](_0x3ab877);})[_0xf1b4('0x23')](function(_0x11fcc8){_0x2b81ac[_0xf1b4('0x55')]=_0x11fcc8;return _0x2b81ac;})[_0xf1b4('0x23')](respondWithFilteredResult(_0x2a5140,_0x3ab877))[_0xf1b4('0x56')](handleError(_0x2a5140,null));};exports['show']=function(_0x464b2a,_0x2affd9){var _0x2c691e={'raw':!![],'where':{'id':_0x464b2a[_0xf1b4('0x57')]['id']}},_0x4b614c={};_0x4b614c[_0xf1b4('0x42')]=_['keys'](db[_0xf1b4('0x3c')][_0xf1b4('0x3d')]);_0x4b614c[_0xf1b4('0x46')]=_[_0xf1b4('0x41')](_0x464b2a[_0xf1b4('0x46')]);_0x4b614c['filters']=_[_0xf1b4('0x44')](_0x4b614c[_0xf1b4('0x42')],_0x4b614c[_0xf1b4('0x46')]);_0x2c691e[_0xf1b4('0x43')]=_[_0xf1b4('0x44')](_0x4b614c[_0xf1b4('0x42')],qs[_0xf1b4('0x45')](_0x464b2a['query'][_0xf1b4('0x45')]));_0x2c691e['attributes']=_0x2c691e[_0xf1b4('0x43')][_0xf1b4('0x47')]?_0x2c691e[_0xf1b4('0x43')]:_0x4b614c[_0xf1b4('0x42')];if(_0x464b2a['query'][_0xf1b4('0x58')]){_0x2c691e['include']=[{'all':!![]}];}_0x2c691e=_['merge']({},_0x2c691e,_0x464b2a['options']);return db[_0xf1b4('0x3c')][_0xf1b4('0x59')](_0x2c691e)[_0xf1b4('0x23')](handleEntityNotFound(_0x2affd9,null))[_0xf1b4('0x23')](respondWithResult(_0x2affd9,null))[_0xf1b4('0x56')](handleError(_0x2affd9,null));};exports['create']=function(_0x49045e,_0x43842f){return db['OpenchannelMessage']['create'](_0x49045e[_0xf1b4('0x5a')],{})[_0xf1b4('0x23')](respondWithResult(_0x43842f,0xc9))[_0xf1b4('0x56')](handleError(_0x43842f,null));};exports[_0xf1b4('0x37')]=function(_0x54adb7,_0x477b8d){if(_0x54adb7[_0xf1b4('0x5a')]['id']){delete _0x54adb7[_0xf1b4('0x5a')]['id'];}return db[_0xf1b4('0x3c')][_0xf1b4('0x59')]({'where':{'id':_0x54adb7[_0xf1b4('0x57')]['id']}})[_0xf1b4('0x23')](handleEntityNotFound(_0x477b8d,null))[_0xf1b4('0x23')](saveUpdates(_0x54adb7[_0xf1b4('0x5a')],null))[_0xf1b4('0x23')](respondWithResult(_0x477b8d,null))[_0xf1b4('0x56')](handleError(_0x477b8d,null));};exports['destroy']=function(_0x54f5e9,_0x182709){return db[_0xf1b4('0x3c')][_0xf1b4('0x59')]({'where':{'id':_0x54f5e9[_0xf1b4('0x57')]['id']}})[_0xf1b4('0x23')](handleEntityNotFound(_0x182709,null))[_0xf1b4('0x23')](removeEntity(_0x182709,null))[_0xf1b4('0x56')](handleError(_0x182709,null));};exports['describe']=function(_0x2ce669,_0x5536c4){return db[_0xf1b4('0x3c')][_0xf1b4('0x5b')]()[_0xf1b4('0x23')](respondWithResult(_0x5536c4,null))[_0xf1b4('0x56')](handleError(_0x5536c4,null));};var interaction_log=require(_0xf1b4('0x5c'))(_0xf1b4('0x5d'));exports[_0xf1b4('0x5e')]=function(_0x4fe100,_0x523246,_0x278ad8){var _0x2479d4={'agent':{},'channel':_0xf1b4('0x5f')};if(_0x4fe100[_0xf1b4('0x5a')]['id']){delete _0x4fe100[_0xf1b4('0x5a')]['id'];}_0x4fe100[_0xf1b4('0x5a')]['read']=!![];_0x4fe100['body'][_0xf1b4('0x60')]=moment()[_0xf1b4('0x61')](_0xf1b4('0x62'));_0x4fe100[_0xf1b4('0x5a')]['UserId']=_0x4fe100[_0xf1b4('0x5a')][_0xf1b4('0x63')]||_0x4fe100['user']['id'];_0x2479d4[_0xf1b4('0x64')]['id']=_0x4fe100[_0xf1b4('0x5a')]['UserId'];return db[_0xf1b4('0x3c')][_0xf1b4('0x59')]({'where':{'id':_0x4fe100['params']['id'],'UserId':null}})[_0xf1b4('0x23')](handleEntityNotFound(_0x523246,null))['then'](saveUpdates(_0x4fe100['body'],null))[_0xf1b4('0x23')](function(_0x5ea564){if(_0x5ea564){_0x2479d4[_0xf1b4('0x2c')]=_0x5ea564[_0xf1b4('0x65')]({'plain':!![]});return db[_0xf1b4('0x66')][_0xf1b4('0x59')]({'where':{'id':_0x5ea564[_0xf1b4('0x67')]}});}return null;})[_0xf1b4('0x23')](handleEntityNotFound(_0x523246,null))[_0xf1b4('0x23')](function(_0x1e41bc){if(_0x1e41bc){return _0x1e41bc['update']({'UserId':_0x4fe100[_0xf1b4('0x5a')][_0xf1b4('0x63')],'read1stAt':_[_0xf1b4('0x68')](_0x1e41bc[_0xf1b4('0x69')])?moment()['format'](_0xf1b4('0x62')):undefined});}return null;})[_0xf1b4('0x23')](function(_0x265976){if(_0x265976){_0x2479d4['interaction']=_0x265976['get']({'plain':!![]});interaction_log[_0xf1b4('0x24')](_0xf1b4('0x6a'),_0x4fe100[_0xf1b4('0x6b')]['id'],_0x4fe100[_0xf1b4('0x6b')][_0xf1b4('0x39')],_0x4fe100[_0xf1b4('0x6b')][_0xf1b4('0x6c')],_0x2479d4[_0xf1b4('0x6d')]['id'],_0x4fe100['body']?JSON['stringify'](_0x4fe100[_0xf1b4('0x5a')]):_0xf1b4('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xf1b4('0x6f'),_0x2479d4);}return null;})[_0xf1b4('0x23')](function(_0x3bb6ad){var _0x3412a1=_0xf1b4('0x70')+_0x3bb6ad[_0xf1b4('0x2c')][_0xf1b4('0x71')];return db[_0xf1b4('0x72')][_0xf1b4('0x46')](_0x3412a1,{'type':db[_0xf1b4('0x73')]['QueryTypes'][_0xf1b4('0x74')],'raw':!![]})[_0xf1b4('0x23')](function(_0x2112d4){return _0x2112d4;});})[_0xf1b4('0x23')](function(_0x354b47){if(_0x354b47){_0x2479d4[_0xf1b4('0x2c')][_0xf1b4('0x75')]=_0x354b47[0x0];if(!_0x4fe100[_0xf1b4('0x5a')][_0xf1b4('0x63')])return;return db[_0xf1b4('0x76')]['find']({'where':{'id':_0x4fe100[_0xf1b4('0x5a')][_0xf1b4('0x63')],'role':_0xf1b4('0x64')},'attributes':['id',_0xf1b4('0x39'),_0xf1b4('0x77'),_0xf1b4('0x78'),_0xf1b4('0x79')],'raw':!![]});}return null;})['then'](function(_0x1e8cb2){if(!_0x1e8cb2)return null;_0x2479d4[_0xf1b4('0x2c')]['agent']=_0x1e8cb2;return _0x2479d4;})[_0xf1b4('0x23')](function(_0x1f6308){if(_0x1f6308){if(_0x4fe100[_0xf1b4('0x5a')][_0xf1b4('0x7a')]){_0x2479d4[_0xf1b4('0x2c')]['interface']=util[_0xf1b4('0x61')]('SIP/%s',_0x4fe100['user']['name']);_0x2479d4['message'][_0xf1b4('0x7b')]=_0x2479d4[_0xf1b4('0x7b')];_0x2479d4[_0xf1b4('0x2c')]['motionChannel']=_0x2479d4[_0xf1b4('0x7b')];_0x2479d4[_0xf1b4('0x2c')][_0xf1b4('0x7c')]=_0xf1b4('0x5e');return respondWithRpcPromise(_0xf1b4('0x7d'),_0xf1b4('0x7d'),{'event':'acceptmessage','message':_0x2479d4[_0xf1b4('0x2c')]},client9002)[_0xf1b4('0x23')](function(){return _0x2479d4;});}return _0x2479d4;}return null;})['then'](respondWithResult(_0x523246,null))[_0xf1b4('0x56')](handleError(_0x523246,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xf1b4('0x35')]=function(_0x3308f3,_0x2b8a42,_0xe8adc9){var _0x39d3fc={'agent':{},'channel':_0xf1b4('0x5f')};if(_0x3308f3[_0xf1b4('0x5a')]['id']){delete _0x3308f3[_0xf1b4('0x5a')]['id'];}_0x3308f3[_0xf1b4('0x5a')][_0xf1b4('0x63')]=_0x3308f3[_0xf1b4('0x5a')][_0xf1b4('0x63')]||_0x3308f3[_0xf1b4('0x6b')]['id'];_0x39d3fc[_0xf1b4('0x64')]['id']=_0x3308f3[_0xf1b4('0x5a')][_0xf1b4('0x63')];return db[_0xf1b4('0x3c')][_0xf1b4('0x59')]({'where':{'id':_0x3308f3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b8a42,null))[_0xf1b4('0x23')](function(_0x273ed8){if(_0x273ed8){_0x39d3fc['message']=_0x273ed8[_0xf1b4('0x65')]({'plain':!![]});return db[_0xf1b4('0x66')][_0xf1b4('0x59')]({'where':{'id':_0x273ed8[_0xf1b4('0x67')]}});}return null;})[_0xf1b4('0x23')](handleEntityNotFound(_0x2b8a42,null))[_0xf1b4('0x23')](function(_0x37dce1){if(_0x37dce1){_0x39d3fc['interaction']=_0x37dce1[_0xf1b4('0x65')]({'plain':!![]});interaction_log['info'](_0xf1b4('0x7e'),_0x3308f3[_0xf1b4('0x6b')]['id'],_0x3308f3[_0xf1b4('0x6b')]['name'],_0x3308f3[_0xf1b4('0x6b')]['role'],_0x39d3fc[_0xf1b4('0x6d')]['id'],_0x3308f3[_0xf1b4('0x5a')]?JSON[_0xf1b4('0x29')](_0x3308f3[_0xf1b4('0x5a')]):_0xf1b4('0x6e'));return respondWithRpcPromise('RejectMessage',_0xf1b4('0x7f'),_0x39d3fc);}return null;})[_0xf1b4('0x23')](function(_0x216d31){var _0x25c63e=_0xf1b4('0x70')+_0x216d31[_0xf1b4('0x2c')][_0xf1b4('0x71')];return db[_0xf1b4('0x72')][_0xf1b4('0x46')](_0x25c63e,{'type':db[_0xf1b4('0x73')][_0xf1b4('0x80')][_0xf1b4('0x74')],'raw':!![]})[_0xf1b4('0x23')](function(_0x58221a){return _0x58221a;});})['then'](function(_0x32850d){if(_0x32850d){_0x39d3fc[_0xf1b4('0x2c')][_0xf1b4('0x75')]=_0x32850d[0x0];if(!_0x3308f3['body'][_0xf1b4('0x63')])return;return db['User'][_0xf1b4('0x59')]({'where':{'id':_0x3308f3[_0xf1b4('0x5a')]['UserId'],'role':_0xf1b4('0x64')},'attributes':['id',_0xf1b4('0x39'),_0xf1b4('0x77'),_0xf1b4('0x78'),_0xf1b4('0x79')],'raw':!![]});}return null;})[_0xf1b4('0x23')](function(_0x3df6f0){if(!_0x3df6f0)return null;_0x39d3fc[_0xf1b4('0x2c')]['agent']=_0x3df6f0;return _0x39d3fc;})['then'](function(_0x32e28a){if(_0x32e28a){_0x32e28a[_0xf1b4('0x2c')][_0xf1b4('0x81')]=util[_0xf1b4('0x61')]('SIP/%s',_0x3308f3[_0xf1b4('0x6b')][_0xf1b4('0x39')]);_0x32e28a[_0xf1b4('0x2c')][_0xf1b4('0x7b')]=_0x39d3fc[_0xf1b4('0x7b')];_0x32e28a[_0xf1b4('0x2c')][_0xf1b4('0x82')]=_0x39d3fc['channel'];_0x32e28a[_0xf1b4('0x2c')]['event']=_0xf1b4('0x35');respondWithRpcPromise(_0xf1b4('0x7d'),_0xf1b4('0x7d'),{'event':_0xf1b4('0x83'),'message':_0x32e28a['message']},client9002);return _0x39d3fc;}return null;})[_0xf1b4('0x23')](respondWithResult(_0x2b8a42,null))[_0xf1b4('0x56')](handleError(_0x2b8a42,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d63d7ef..d22e9a5 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 _0xe636=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0xbb6fb5,_0x4db9fb){var _0x2f9501=function(_0x4a9b92){while(--_0x4a9b92){_0xbb6fb5['push'](_0xbb6fb5['shift']());}};_0x2f9501(++_0x4db9fb);}(_0xe636,0x69));var _0x6e63=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0xe636[_0x3d78d7];return _0x4b6784;};'use strict';var EventEmitter=require(_0x6e63('0x0'));var OpenchannelMessage=require(_0x6e63('0x1'))['db'][_0x6e63('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6e63('0x3')](0x0);var events={'afterCreate':_0x6e63('0x4'),'afterUpdate':_0x6e63('0x5'),'afterDestroy':_0x6e63('0x6')};function emitEvent(_0x5b5e49){return function(_0x51dcae,_0x47e0d8,_0x268f91){OpenchannelMessageEvents['emit'](_0x5b5e49+':'+_0x51dcae['id'],_0x51dcae);OpenchannelMessageEvents[_0x6e63('0x7')](_0x5b5e49,_0x51dcae);_0x268f91(null);};}for(var e in events){if(events[_0x6e63('0x8')](e)){var event=events[e];OpenchannelMessage[_0x6e63('0x9')](e,emitEvent(event));}}module[_0x6e63('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8985=['events','OpenchannelMessage','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0x8985,0x110));var _0x5898=function(_0x1e2a2d,_0xe60081){_0x1e2a2d=_0x1e2a2d-0x0;var _0x2f0eee=_0x8985[_0x1e2a2d];return _0x2f0eee;};'use strict';var EventEmitter=require(_0x5898('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5898('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5898('0x2'),'afterDestroy':_0x5898('0x3')};function emitEvent(_0x4be437){return function(_0x2db037,_0x3950ff,_0x41095c){OpenchannelMessageEvents[_0x5898('0x4')](_0x4be437+':'+_0x2db037['id'],_0x2db037);OpenchannelMessageEvents[_0x5898('0x4')](_0x4be437,_0x2db037);_0x41095c(null);};}for(var e in events){if(events[_0x5898('0x5')](e)){var event=events[e];OpenchannelMessage[_0x5898('0x6')](e,emitEvent(event));}}module[_0x5898('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 66abc0b..43f2edb 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 _0x11a8=['describe','OpenchannelAccount','OpenchannelAccountId','Contact','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','length','method','POST','info','threadId','Interaction','OpenchannelInteraction','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact'];(function(_0x32e6b9,_0x1ba001){var _0xd18132=function(_0x10af6a){while(--_0x10af6a){_0x32e6b9['push'](_0x32e6b9['shift']());}};_0xd18132(++_0x1ba001);}(_0x11a8,0x13a));var _0x811a=function(_0x310965,_0x576316){_0x310965=_0x310965-0x0;var _0x66caaf=_0x11a8[_0x310965];return _0x66caaf;};'use strict';var _=require(_0x811a('0x0'));var util=require('util');var logger=require(_0x811a('0x1'))(_0x811a('0x2'));var moment=require('moment');var BPromise=require(_0x811a('0x3'));var rp=require(_0x811a('0x4'));var fs=require('fs');var path=require(_0x811a('0x5'));var rimraf=require(_0x811a('0x6'));var config=require(_0x811a('0x7'));var attributes=require(_0x811a('0x8'));module[_0x811a('0x9')]=function(_0x239723,_0xf2604e){return _0x239723[_0x811a('0xa')](_0x811a('0xb'),attributes,{'tableName':_0x811a('0xc'),'paranoid':![],'indexes':[{'name':_0x811a('0xd'),'fields':[_0x811a('0xe')],'type':_0x811a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31cd36,_0x4695b7,_0x50e9c5){var _0x511483=_0x239723[_0x811a('0x10')];var _0x34cde3=_0x31cd36[_0x811a('0x11')]({'plain':!![]});if(_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()==='in'||_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()===_0x811a('0x14')&&!_0x34cde3[_0x811a('0x15')]&&!_['isNil'](_0x34cde3['UserId'])){_0x511483['OpenchannelInteraction'][_0x811a('0x16')]({'where':{'id':_0x34cde3[_0x811a('0x17')]}})[_0x811a('0x18')](function(_0x1ea29f){if(_0x1ea29f){_0x1ea29f[_0x811a('0x19')]({'lastMsgAt':_0x34cde3['createdAt'],'lastMsgDirection':_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()});}})[_0x811a('0x1a')](function(_0x17d393){console[_0x811a('0x1b')](_0x17d393);});}if(_0x34cde3['direction']==='out'&&!_0x34cde3[_0x811a('0x15')]){var _0x397d49;_0x511483[_0x811a('0x1c')][_0x811a('0x1d')]()[_0x811a('0x18')](function(_0xe49ee2){return _0x511483[_0x811a('0x1e')]['find']({'where':{'id':_0x34cde3[_0x811a('0x1f')]},'include':[{'model':_0x511483['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x34cde3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x511483[_0x811a('0x1c')],'as':_0x811a('0x20'),'attributes':_['keys'](_0xe49ee2)}]}]});})[_0x811a('0x18')](function(_0xea3a80){_0x397d49=_0xea3a80[_0x811a('0x11')]({'plain':!![]});if(_0x397d49&&_0x397d49[_0x811a('0x21')]){logger['info'](_0x811a('0x22'),'afterCreate',util[_0x811a('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x34cde3['id'],_0x397d49[_0x811a('0x21')]));if(_0x397d49['Interactions']&&_0x397d49[_0x811a('0x24')][_0x811a('0x25')]){_0x34cde3['Interaction']=_['omit'](_0x397d49[_0x811a('0x24')][0x0],_0x811a('0x20'));_0x34cde3[_0x811a('0x20')]=_0x397d49[_0x811a('0x24')][0x0][_0x811a('0x20')];}var _0x4695b7={'method':'POST','uri':encodeURI(_0x397d49[_0x811a('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4695b7[_0x811a('0x26')]){case'GET':_0x4695b7['qs']=_0x34cde3;break;case _0x811a('0x27'):_0x4695b7[_0x811a('0xe')]=_0x34cde3;break;}return rp(_0x4695b7)[_0x811a('0x18')](function(_0x4a88e7){logger[_0x811a('0x28')](_0x811a('0x22'),'afterCreate',util[_0x811a('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x34cde3['id'],_0x397d49[_0x811a('0x21')]));if(_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]&&_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]!=_0x34cde3[_0x811a('0x2a')][_0x811a('0x29')]){return _0x511483[_0x811a('0x2b')]['update']({'threadId':_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]},{'where':{'id':_0x34cde3[_0x811a('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x31cd36[_0x811a('0x19')]({'read':!![]});})['catch'](function(_0x1093c9){logger[_0x811a('0x1b')](_0x811a('0x22'),_0x811a('0x2c'),util[_0x811a('0x2d')](_0x1093c9,{'showHidden':![],'depth':null}));_0x50e9c5();});}else{_0x50e9c5();}})[_0x811a('0x2e')](function(){_0x50e9c5();});}else{_0x50e9c5();}}},'charset':_0x811a('0x2f'),'collate':_0x811a('0x30')});}; \ No newline at end of file +var _0xe734=['util','../../config/logger','api','moment','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x188e31,_0x2c37f0){var _0x55a885=function(_0x35654a){while(--_0x35654a){_0x188e31['push'](_0x188e31['shift']());}};_0x55a885(++_0x2c37f0);}(_0xe734,0xff));var _0x4e73=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xe734[_0x2080a3];return _0x8d7d17;};'use strict';var _=require('lodash');var util=require(_0x4e73('0x0'));var logger=require(_0x4e73('0x1'))(_0x4e73('0x2'));var moment=require(_0x4e73('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e73('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e73('0x6'));module[_0x4e73('0x7')]=function(_0x4b0aa2,_0x547174){return _0x4b0aa2[_0x4e73('0x8')](_0x4e73('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4e73('0xa'),'fields':[_0x4e73('0xb')],'type':_0x4e73('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16071a,_0x33e957,_0x358397){var _0x593b01=_0x4b0aa2['models'];var _0x34d023=_0x16071a['get']({'plain':!![]});if(_0x34d023[_0x4e73('0xd')][_0x4e73('0xe')]()==='in'||_0x34d023[_0x4e73('0xd')][_0x4e73('0xe')]()===_0x4e73('0xf')&&!_0x34d023['secret']&&!_[_0x4e73('0x10')](_0x34d023[_0x4e73('0x11')])){_0x593b01[_0x4e73('0x12')][_0x4e73('0x13')]({'where':{'id':_0x34d023[_0x4e73('0x14')]}})[_0x4e73('0x15')](function(_0x3892c4){if(_0x3892c4){_0x3892c4[_0x4e73('0x16')]({'lastMsgAt':_0x34d023['createdAt'],'lastMsgDirection':_0x34d023[_0x4e73('0xd')][_0x4e73('0xe')]()});}})[_0x4e73('0x17')](function(_0x1cecde){console['error'](_0x1cecde);});}if(_0x34d023[_0x4e73('0xd')]==='out'&&!_0x34d023[_0x4e73('0x18')]){var _0x3bfc82;_0x593b01[_0x4e73('0x19')][_0x4e73('0x1a')]()['then'](function(_0x54a320){return _0x593b01[_0x4e73('0x1b')][_0x4e73('0x1c')]({'where':{'id':_0x34d023[_0x4e73('0x1d')]},'include':[{'model':_0x593b01['OpenchannelInteraction'],'as':_0x4e73('0x1e'),'where':{'id':_0x34d023[_0x4e73('0x14')]},'limit':0x1,'include':[{'model':_0x593b01[_0x4e73('0x19')],'as':_0x4e73('0x1f'),'attributes':_[_0x4e73('0x20')](_0x54a320)}]}]});})[_0x4e73('0x15')](function(_0x12a6c4){_0x3bfc82=_0x12a6c4[_0x4e73('0x21')]({'plain':!![]});if(_0x3bfc82&&_0x3bfc82[_0x4e73('0x22')]){logger[_0x4e73('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x4e73('0x24')](_0x4e73('0x25'),_0x34d023['id'],_0x3bfc82['replyUri']));if(_0x3bfc82[_0x4e73('0x1e')]&&_0x3bfc82[_0x4e73('0x1e')][_0x4e73('0x26')]){_0x34d023[_0x4e73('0x27')]=_[_0x4e73('0x28')](_0x3bfc82[_0x4e73('0x1e')][0x0],_0x4e73('0x1f'));_0x34d023['Contact']=_0x3bfc82[_0x4e73('0x1e')][0x0][_0x4e73('0x1f')];}var _0x33e957={'method':'POST','uri':encodeURI(_0x3bfc82[_0x4e73('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x33e957['method']){case'GET':_0x33e957['qs']=_0x34d023;break;case _0x4e73('0x29'):_0x33e957['body']=_0x34d023;break;}return rp(_0x33e957)['then'](function(_0x524901){logger[_0x4e73('0x23')](_0x4e73('0x2a'),_0x4e73('0x2b'),util['format'](_0x4e73('0x2c'),_0x34d023['id'],_0x3bfc82[_0x4e73('0x22')]));if(_0x524901[_0x4e73('0xb')][_0x4e73('0x2d')]&&_0x524901[_0x4e73('0xb')][_0x4e73('0x2d')]!=_0x34d023[_0x4e73('0x27')]['threadId']){return _0x593b01[_0x4e73('0x12')][_0x4e73('0x16')]({'threadId':_0x524901[_0x4e73('0xb')]['threadId']},{'where':{'id':_0x34d023[_0x4e73('0x27')]['id']}});}else{return;}})['then'](function(){return _0x16071a[_0x4e73('0x16')]({'read':!![]});})['catch'](function(_0x4e28fa){logger[_0x4e73('0x2e')](_0x4e73('0x2a'),_0x4e73('0x2b'),util[_0x4e73('0x2f')](_0x4e28fa,{'showHidden':![],'depth':null}));_0x358397();});}else{_0x358397();}})[_0x4e73('0x30')](function(){_0x358397();});}else{_0x358397();}}},'charset':_0x4e73('0x31'),'collate':_0x4e73('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0867489..d60dce5 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14dc90,_0x2b8096){var _0x57fd45=function(_0x40eacc){while(--_0x40eacc){_0x14dc90['push'](_0x14dc90['shift']());}};_0x57fd45(++_0x2b8096);}(_0x5f2f,0x73));var _0xf5f2=function(_0x54d256,_0x3d8cd4){_0x54d256=_0x54d256-0x0;var _0x2ab4f2=_0x5f2f[_0x54d256];return _0x2ab4f2;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1235a7,_0x189ddd){var _0x38d091=function(_0xee660b){while(--_0xee660b){_0x1235a7['push'](_0x1235a7['shift']());}};_0x38d091(++_0x189ddd);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 29908a2..8082862 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 _0xd69e=['openchannelMessage:','./openchannelMessage.events','save','update','emit','register','length'];(function(_0x4b4534,_0x43d101){var _0xebcd22=function(_0x1005e2){while(--_0x1005e2){_0x4b4534['push'](_0x4b4534['shift']());}};_0xebcd22(++_0x43d101);}(_0xd69e,0x1e4));var _0xed69=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd69e[_0x2be8c2];return _0x97f531;};'use strict';var OpenchannelMessageEvents=require(_0xed69('0x0'));var events=[_0xed69('0x1'),'remove',_0xed69('0x2')];function createListener(_0x3af36d,_0x22a4f5){return function(_0x537a41){_0x22a4f5[_0xed69('0x3')](_0x3af36d,_0x537a41);};}function removeListener(_0x2b1016,_0x18fd90){return function(){OpenchannelMessageEvents['removeListener'](_0x2b1016,_0x18fd90);};}exports[_0xed69('0x4')]=function(_0x35522c){for(var _0x19d370=0x0,_0x3867f8=events[_0xed69('0x5')];_0x19d370<_0x3867f8;_0x19d370++){var _0x335074=events[_0x19d370];var _0x136b41=createListener(_0xed69('0x6')+_0x335074,_0x35522c);OpenchannelMessageEvents['on'](_0x335074,_0x136b41);}}; \ No newline at end of file +var _0x103f=['remove','update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x997530,_0x237690){var _0x4823b7=function(_0x562fdc){while(--_0x562fdc){_0x997530['push'](_0x997530['shift']());}};_0x4823b7(++_0x237690);}(_0x103f,0x13e));var _0xf103=function(_0x5a73b2,_0x189423){_0x5a73b2=_0x5a73b2-0x0;var _0x5de9cd=_0x103f[_0x5a73b2];return _0x5de9cd;};'use strict';var OpenchannelMessageEvents=require(_0xf103('0x0'));var events=[_0xf103('0x1'),_0xf103('0x2'),_0xf103('0x3')];function createListener(_0xbaee4b,_0x15ff90){return function(_0x3eca86){_0x15ff90[_0xf103('0x4')](_0xbaee4b,_0x3eca86);};}function removeListener(_0x2db927,_0x2e15c9){return function(){OpenchannelMessageEvents['removeListener'](_0x2db927,_0x2e15c9);};}exports[_0xf103('0x5')]=function(_0x30ae90){for(var _0x1cb07e=0x0,_0x211dbc=events[_0xf103('0x6')];_0x1cb07e<_0x211dbc;_0x1cb07e++){var _0x3cfbd1=events[_0x1cb07e];var _0x37e92b=createListener(_0xf103('0x7')+_0x3cfbd1,_0x30ae90);OpenchannelMessageEvents['on'](_0x3cfbd1,_0x37e92b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 84362dd..f2b1be8 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 _0x9c8f=['/describe','isAuthenticated','describe','/:id','show','/:id/members','getTeams','post','create','/:id/teams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9c8f,0x1e1));var _0xf9c8=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x9c8f[_0x416cdc];return _0x1931ce;};'use strict';var multer=require(_0xf9c8('0x0'));var util=require(_0xf9c8('0x1'));var path=require(_0xf9c8('0x2'));var timeout=require(_0xf9c8('0x3'));var express=require(_0xf9c8('0x4'));var router=express[_0xf9c8('0x5')]();var fs_extra=require(_0xf9c8('0x6'));var auth=require(_0xf9c8('0x7'));var interaction=require(_0xf9c8('0x8'));var config=require(_0xf9c8('0x9'));var controller=require(_0xf9c8('0xa'));router[_0xf9c8('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf9c8('0xc'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0xe')]);router['get'](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x10')]);router[_0xf9c8('0xb')](_0xf9c8('0x11'),auth[_0xf9c8('0xd')](),controller['getMembers']);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xf9c8('0x12')]);router[_0xf9c8('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xf9c8('0x13')]('/',auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x14')]);router[_0xf9c8('0x13')](_0xf9c8('0x15'),auth[_0xf9c8('0xd')](),controller['addTeams']);router['post'](_0xf9c8('0x16'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x17')]);router['put'](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x18')]);router[_0xf9c8('0x19')](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller['destroy']);router['delete'](_0xf9c8('0x15'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x1a')]);router[_0xf9c8('0x19')](_0xf9c8('0x16'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x1b')]);module[_0xf9c8('0x1c')]=router; \ No newline at end of file +var _0x9edb=['addAgents','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','index','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9edb,0x109));var _0xb9ed=function(_0x1be908,_0x20e941){_0x1be908=_0x1be908-0x0;var _0x3a22db=_0x9edb[_0x1be908];return _0x3a22db;};'use strict';var multer=require(_0xb9ed('0x0'));var util=require(_0xb9ed('0x1'));var path=require('path');var timeout=require(_0xb9ed('0x2'));var express=require(_0xb9ed('0x3'));var router=express[_0xb9ed('0x4')]();var fs_extra=require(_0xb9ed('0x5'));var auth=require(_0xb9ed('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb9ed('0x7')]);router['get']('/describe',auth[_0xb9ed('0x8')](),controller[_0xb9ed('0x9')]);router[_0xb9ed('0xa')](_0xb9ed('0xb'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0xc')]);router[_0xb9ed('0xa')](_0xb9ed('0xd'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0xe')]);router[_0xb9ed('0xa')](_0xb9ed('0xf'),auth[_0xb9ed('0x8')](),controller['getTeams']);router[_0xb9ed('0xa')](_0xb9ed('0x10'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0x11')]);router[_0xb9ed('0x12')]('/',auth['isAuthenticated'](),controller[_0xb9ed('0x13')]);router['post'](_0xb9ed('0xf'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0x14')]);router['post'](_0xb9ed('0x10'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0x15')]);router['put'](_0xb9ed('0xb'),auth[_0xb9ed('0x8')](),controller['update']);router[_0xb9ed('0x16')](_0xb9ed('0xb'),auth[_0xb9ed('0x8')](),controller[_0xb9ed('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xb9ed('0x18')]);router['delete'](_0xb9ed('0x10'),auth[_0xb9ed('0x8')](),controller['removeAgents']);module[_0xb9ed('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 56b72c8..0c6b5e6 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 _0x37a8=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x37a8,0x183));var _0x837a=function(_0x113876,_0x2d243d){_0x113876=_0x113876-0x0;var _0x3da554=_0x37a8[_0x113876];return _0x3da554;};'use strict';var Sequelize=require(_0x837a('0x0'));module[_0x837a('0x1')]={'name':{'type':Sequelize[_0x837a('0x2')],'unique':_0x837a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x837a('0x2')]},'timeout':{'type':Sequelize[_0x837a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x837a('0x5')](_0x837a('0x6'),_0x837a('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x6bb9=['sequelize','name','STRING','ENUM','beepall','roundrobin'];(function(_0x57ecb4,_0x1b96fa){var _0x3cd415=function(_0x2bff86){while(--_0x2bff86){_0x57ecb4['push'](_0x57ecb4['shift']());}};_0x3cd415(++_0x1b96fa);}(_0x6bb9,0x156));var _0x96bb=function(_0x55b9bd,_0xc8c9e9){_0x55b9bd=_0x55b9bd-0x0;var _0x23b830=_0x6bb9[_0x55b9bd];return _0x23b830;};'use strict';var Sequelize=require(_0x96bb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x96bb('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96bb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96bb('0x3')]('rrmemory',_0x96bb('0x4'),_0x96bb('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a356310..edd047d 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 _0xffe5=['select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','json','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','UserId','agent','createdAt','format','openchannelPause','getTeams','ids','online','voicePause','interface','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team'];(function(_0x32d56e,_0x256b2e){var _0x400b04=function(_0xacaca6){while(--_0xacaca6){_0x32d56e['push'](_0x32d56e['shift']());}};_0x400b04(++_0x256b2e);}(_0xffe5,0x183));var _0x5ffe=function(_0x52f6c6,_0x4cf7b3){_0x52f6c6=_0x52f6c6-0x0;var _0x9a7f82=_0xffe5[_0x52f6c6];return _0x9a7f82;};'use strict';var BPromise=require(_0x5ffe('0x0'));var util=require(_0x5ffe('0x1'));var _=require(_0x5ffe('0x2'));var squel=require(_0x5ffe('0x3'));var Redis=require(_0x5ffe('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5ffe('0x5'));var config=require('../../config/environment');var db=require(_0x5ffe('0x6'))['db'];config[_0x5ffe('0x7')]=_[_0x5ffe('0x8')](config[_0x5ffe('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ffe('0x9'))(new Redis(config[_0x5ffe('0x7')]));require(_0x5ffe('0xa'))[_0x5ffe('0xb')](socket);function respondWithStatusCode(_0x43a9fe,_0x71acdc){_0x71acdc=_0x71acdc||0xcc;return function(_0x28597a){if(_0x28597a){return _0x43a9fe['sendStatus'](_0x71acdc);}return _0x43a9fe[_0x5ffe('0xc')](_0x71acdc)[_0x5ffe('0xd')]();};}function respondWithResult(_0xe2c7cd,_0x1b9d9b){_0x1b9d9b=_0x1b9d9b||0xc8;return function(_0x1d5362){if(_0x1d5362){return _0xe2c7cd[_0x5ffe('0xc')](_0x1b9d9b)['json'](_0x1d5362);}};}function respondWithFilteredResult(_0x2eb064,_0x4dde7e){return function(_0x552999){if(_0x552999){var _0x11b50f=typeof _0x4dde7e[_0x5ffe('0xe')]===_0x5ffe('0xf')&&typeof _0x4dde7e[_0x5ffe('0x10')]===_0x5ffe('0xf');var _0x3cd0a1=_0x552999[_0x5ffe('0x11')];var _0x3d38e1=_0x11b50f?0x0:_0x4dde7e[_0x5ffe('0xe')];var _0xd4dd43=_0x11b50f?_0x552999[_0x5ffe('0x11')]:_0x4dde7e[_0x5ffe('0xe')]+_0x4dde7e[_0x5ffe('0x10')];var _0x7e1241;if(_0xd4dd43>=_0x3cd0a1){_0xd4dd43=_0x3cd0a1;_0x7e1241=0xc8;}else{_0x7e1241=0xce;}_0x2eb064[_0x5ffe('0xc')](_0x7e1241);return _0x2eb064[_0x5ffe('0x12')]('Content-Range',_0x3d38e1+'-'+_0xd4dd43+'/'+_0x3cd0a1)[_0x5ffe('0x13')](_0x552999);}return null;};}function saveUpdates(_0x472622){return function(_0x3d8516){if(_0x3d8516){return _0x3d8516[_0x5ffe('0x14')](_0x472622)['then'](function(_0x21edce){return _0x21edce;});}return null;};}function removeEntity(_0x31025d){return function(_0x143dd1){if(_0x143dd1){return _0x143dd1[_0x5ffe('0x15')]()[_0x5ffe('0x16')](function(){var _0x483e08=_0x143dd1[_0x5ffe('0x17')]({'plain':!![]});var _0x59098b=_0x5ffe('0x18');return db[_0x5ffe('0x19')][_0x5ffe('0x15')]({'where':{'type':_0x59098b,'resourceId':_0x483e08['id']}})[_0x5ffe('0x16')](function(){return _0x143dd1;});})['then'](function(){_0x31025d[_0x5ffe('0xc')](0xcc)[_0x5ffe('0xd')]();});}};}function handleEntityNotFound(_0x3cc064){return function(_0x101150){if(!_0x101150){_0x3cc064['sendStatus'](0x194);}return _0x101150;};}function handleError(_0x594c98,_0x2a9bc4){_0x2a9bc4=_0x2a9bc4||0x1f4;return function(_0x10989c){logger[_0x5ffe('0x1a')](_0x10989c[_0x5ffe('0x1b')]);if(_0x10989c['name']){delete _0x10989c[_0x5ffe('0x1c')];}_0x594c98[_0x5ffe('0xc')](_0x2a9bc4)[_0x5ffe('0x1d')](_0x10989c);};}exports[_0x5ffe('0x1e')]=function(_0x5d9787,_0x284ca9){var _0x5ce193={};var _0xa7f981={'count':0x0,'rows':[]};var _0x6ddcf1=_[_0x5ffe('0x1f')](db[_0x5ffe('0x20')][_0x5ffe('0x21')],function(_0x288736){return{'name':_0x288736[_0x5ffe('0x22')],'type':_0x288736[_0x5ffe('0x23')]['key']};});_0x5ce193=qs['getOptions'](_0x6ddcf1,_0x5d9787);var _0x2610a9={'where':_0x5ce193[_0x5ffe('0x24')]};return db[_0x5ffe('0x20')][_0x5ffe('0x11')](_0x2610a9)[_0x5ffe('0x16')](function(_0x3208c5){_0xa7f981[_0x5ffe('0x11')]=_0x3208c5;_0x5ce193[_0x5ffe('0x25')]=qs[_0x5ffe('0x25')](_0x5d9787[_0x5ffe('0x26')]);return db[_0x5ffe('0x20')][_0x5ffe('0x27')](_0x5ce193);})['then'](function(_0x373d51){_0xa7f981[_0x5ffe('0x28')]=_0x373d51;return _0xa7f981;})[_0x5ffe('0x16')](respondWithFilteredResult(_0x284ca9,_0x5ce193))[_0x5ffe('0x29')](handleError(_0x284ca9,null));};exports[_0x5ffe('0x2a')]=function(_0x39785f,_0x1c3df6){var _0x32de7a={'raw':!![],'where':{'id':_0x39785f['params']['id']}},_0x31dea1={};_0x31dea1[_0x5ffe('0x2b')]=_[_0x5ffe('0x2c')](db[_0x5ffe('0x20')][_0x5ffe('0x21')]);_0x31dea1[_0x5ffe('0x26')]=_[_0x5ffe('0x2c')](_0x39785f[_0x5ffe('0x26')]);_0x31dea1[_0x5ffe('0x2d')]=_[_0x5ffe('0x2e')](_0x31dea1['model'],_0x31dea1[_0x5ffe('0x26')]);_0x32de7a[_0x5ffe('0x2f')]=_['intersection'](_0x31dea1[_0x5ffe('0x2b')],qs[_0x5ffe('0x30')](_0x39785f[_0x5ffe('0x26')][_0x5ffe('0x30')]));_0x32de7a[_0x5ffe('0x2f')]=_0x32de7a[_0x5ffe('0x2f')][_0x5ffe('0x31')]?_0x32de7a[_0x5ffe('0x2f')]:_0x31dea1[_0x5ffe('0x2b')];if(_0x39785f['query'][_0x5ffe('0x32')]){_0x32de7a[_0x5ffe('0x25')]=[{'all':!![]}];}_0x32de7a=_[_0x5ffe('0x33')]({},_0x32de7a,_0x39785f[_0x5ffe('0x34')]);return db[_0x5ffe('0x20')][_0x5ffe('0x35')](_0x32de7a)[_0x5ffe('0x16')](handleEntityNotFound(_0x1c3df6,null))[_0x5ffe('0x16')](respondWithResult(_0x1c3df6,null))[_0x5ffe('0x29')](handleError(_0x1c3df6,null));};exports['create']=function(_0xfe6efc,_0x4d6f7b){return db[_0x5ffe('0x20')][_0x5ffe('0x36')](_0xfe6efc[_0x5ffe('0x37')],{})['then'](function(_0xecf340){var _0x253f03=_0xfe6efc[_0x5ffe('0x38')][_0x5ffe('0x17')]({'plain':!![]});if(!_0x253f03)throw new Error(_0x5ffe('0x39'));if(_0x253f03[_0x5ffe('0x3a')]===_0x5ffe('0x38')){var _0x19710e=_0xecf340[_0x5ffe('0x17')]({'plain':!![]});var _0x184a04='OpenchannelQueues';return db[_0x5ffe('0x3b')][_0x5ffe('0x35')]({'where':{'name':_0x184a04,'userProfileId':_0x253f03[_0x5ffe('0x3c')]},'raw':!![]})[_0x5ffe('0x16')](function(_0x5e823d){if(_0x5e823d&&_0x5e823d['autoAssociation']===0x0){return db[_0x5ffe('0x19')]['create']({'name':_0x19710e[_0x5ffe('0x1c')],'resourceId':_0x19710e['id'],'type':_0x5e823d[_0x5ffe('0x1c')],'sectionId':_0x5e823d['id']},{})[_0x5ffe('0x16')](function(){return _0xecf340;});}else{return _0xecf340;}})['catch'](function(_0x5a498e){logger[_0x5ffe('0x1a')](_0x5ffe('0x3d'),_0x5a498e);throw _0x5a498e;});}return _0xecf340;})['then'](respondWithResult(_0x4d6f7b,0xc9))[_0x5ffe('0x29')](handleError(_0x4d6f7b,null));};exports[_0x5ffe('0x14')]=function(_0x494712,_0x5d107f){if(_0x494712[_0x5ffe('0x37')]['id']){delete _0x494712[_0x5ffe('0x37')]['id'];}return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x494712[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x5d107f,null))['then'](saveUpdates(_0x494712['body'],null))[_0x5ffe('0x16')](respondWithResult(_0x5d107f,null))['catch'](handleError(_0x5d107f,null));};exports[_0x5ffe('0x15')]=function(_0x175b74,_0x3faba1){return db[_0x5ffe('0x20')]['find']({'where':{'id':_0x175b74[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x3faba1,null))['then'](removeEntity(_0x3faba1,null))[_0x5ffe('0x29')](handleError(_0x3faba1,null));};exports[_0x5ffe('0x3f')]=function(_0xe985c9,_0x4ee791){return db['OpenchannelQueue'][_0x5ffe('0x3f')]()[_0x5ffe('0x16')](respondWithResult(_0x4ee791,null))[_0x5ffe('0x29')](handleError(_0x4ee791,null));};exports['getMembers']=function(_0x2be31c,_0x21c855){var _0x23d82f={'raw':!![],'where':{}},_0xedbd99={},_0x2710ed;return db['OpenchannelQueue'][_0x5ffe('0x40')]({'where':{'id':_0x2be31c['params']['id']}})['then'](handleEntityNotFound(_0x21c855,null))['then'](function(_0x446781){if(_0x446781){_0x2710ed=_0x446781[_0x5ffe('0x17')]({'plain':!![]});_0xedbd99[_0x5ffe('0x2b')]=_['keys'](db[_0x5ffe('0x41')][_0x5ffe('0x21')]);_0xedbd99[_0x5ffe('0x26')]=_['keys'](_0x2be31c[_0x5ffe('0x26')]);_0xedbd99[_0x5ffe('0x2d')]=_['intersection'](_0xedbd99[_0x5ffe('0x2b')],_0xedbd99[_0x5ffe('0x26')]);_0x23d82f[_0x5ffe('0x2f')]=_['intersection'](_0xedbd99[_0x5ffe('0x2b')],qs[_0x5ffe('0x30')](_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x30')]));_0x23d82f[_0x5ffe('0x2f')]=_0x23d82f['attributes'][_0x5ffe('0x31')]?_0x23d82f['attributes']:_0xedbd99[_0x5ffe('0x2b')];if(!_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x42')](_0x5ffe('0x43'))){_0x23d82f[_0x5ffe('0x10')]=qs[_0x5ffe('0x10')](_0x2be31c['query'][_0x5ffe('0x10')]);_0x23d82f[_0x5ffe('0xe')]=qs[_0x5ffe('0xe')](_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0xe')]);}_0x23d82f[_0x5ffe('0x44')]=qs['sort'](_0x2be31c['query'][_0x5ffe('0x45')]);_0x23d82f[_0x5ffe('0x24')]=qs[_0x5ffe('0x2d')](_[_0x5ffe('0x46')](_0x2be31c[_0x5ffe('0x26')],_0xedbd99['filters']));_0x23d82f['where'][_0x5ffe('0x47')]=_0x446781['id'];if(_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x48')]){_0x23d82f[_0x5ffe('0x24')]=_[_0x5ffe('0x33')](_0x23d82f[_0x5ffe('0x24')],{'$or':_['map'](_0x23d82f[_0x5ffe('0x2f')],function(_0x25c4c7){var _0x1b24b3={};_0x1b24b3[_0x25c4c7]={'$like':'%'+_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x1b24b3;})});}_0x23d82f=_[_0x5ffe('0x33')]({},_0x23d82f,_0x2be31c[_0x5ffe('0x34')]);return db[_0x5ffe('0x41')][_0x5ffe('0x27')](_0x23d82f);}})[_0x5ffe('0x16')](function(_0x11209e){if(_0x11209e){return db[_0x5ffe('0x49')]['findAndCountAll']({'where':{'id':_[_0x5ffe('0x1f')](_0x11209e,_0x5ffe('0x4a')),'role':_0x5ffe('0x4b')},'attributes':['id',_0x5ffe('0x1c'),'openchannelPause','updatedAt',_0x5ffe('0x4c')]});}})[_0x5ffe('0x16')](function(_0x119771){if(_0x119771){return{'count':_0x119771[_0x5ffe('0x11')],'rows':_[_0x5ffe('0x1f')](_0x119771[_0x5ffe('0x28')],function(_0x8e97ae){return{'membername':_0x8e97ae[_0x5ffe('0x1c')],'UserId':_0x8e97ae['id'],'queue_name':_0x2710ed['name'],'OpenchannelQueueId':_0x2710ed['id'],'interface':util[_0x5ffe('0x4d')]('%s/%s','SIP',_0x8e97ae[_0x5ffe('0x1c')]),'penalty':0x0,'paused':_0x8e97ae[_0x5ffe('0x4e')],'createdAt':_0x8e97ae['createdAt'],'updatedAt':_0x8e97ae['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ffe('0x16')](respondWithFilteredResult(_0x21c855,_0x23d82f))['catch'](handleError(_0x21c855,null));};exports['getTeams']=function(_0x49817b,_0x77ac9f){var _0x314881={};var _0x41c1fe={};var _0xcc730e;var _0x2e9e09;return db[_0x5ffe('0x20')][_0x5ffe('0x40')]({'where':{'id':_0x49817b[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x77ac9f,null))[_0x5ffe('0x16')](function(_0x5aeefa){if(_0x5aeefa){_0xcc730e=_0x5aeefa;_0x41c1fe[_0x5ffe('0x2b')]=_['keys'](db['Team']['rawAttributes']);_0x41c1fe['query']=_[_0x5ffe('0x2c')](_0x49817b[_0x5ffe('0x26')]);_0x41c1fe['filters']=_[_0x5ffe('0x2e')](_0x41c1fe[_0x5ffe('0x2b')],_0x41c1fe['query']);_0x314881[_0x5ffe('0x2f')]=_[_0x5ffe('0x2e')](_0x41c1fe['model'],qs[_0x5ffe('0x30')](_0x49817b['query']['fields']));_0x314881[_0x5ffe('0x2f')]=_0x314881[_0x5ffe('0x2f')][_0x5ffe('0x31')]?_0x314881[_0x5ffe('0x2f')]:_0x41c1fe[_0x5ffe('0x2b')];_0x314881[_0x5ffe('0x44')]=qs[_0x5ffe('0x45')](_0x49817b[_0x5ffe('0x26')]['sort']);_0x314881[_0x5ffe('0x24')]=qs['filters'](_[_0x5ffe('0x46')](_0x49817b['query'],_0x41c1fe['filters']));if(_0x49817b['query'][_0x5ffe('0x48')]){_0x314881[_0x5ffe('0x24')]=_[_0x5ffe('0x33')](_0x314881['where'],{'$or':_['map'](_0x314881[_0x5ffe('0x2f')],function(_0x10404c){var _0x2c1b53={};_0x2c1b53[_0x10404c]={'$like':'%'+_0x49817b[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x2c1b53;})});}_0x314881=_[_0x5ffe('0x33')]({},_0x314881,_0x49817b[_0x5ffe('0x34')]);return _0xcc730e[_0x5ffe('0x4f')](_0x314881);}})[_0x5ffe('0x16')](function(_0x3c9a7f){if(_0x3c9a7f){_0x2e9e09=_0x3c9a7f[_0x5ffe('0x31')];if(!_0x49817b['query'][_0x5ffe('0x42')](_0x5ffe('0x43'))){_0x314881[_0x5ffe('0x10')]=qs['limit'](_0x49817b['query'][_0x5ffe('0x10')]);_0x314881[_0x5ffe('0xe')]=qs['offset'](_0x49817b[_0x5ffe('0x26')][_0x5ffe('0xe')]);}return _0xcc730e[_0x5ffe('0x4f')](_0x314881);}})[_0x5ffe('0x16')](function(_0xc23729){if(_0xc23729){return _0xc23729?{'count':_0x2e9e09,'rows':_0xc23729}:null;}})['then'](respondWithResult(_0x77ac9f,null))[_0x5ffe('0x29')](handleError(_0x77ac9f,null));};exports['addTeams']=function(_0x37e3a3,_0x4e37a7){var _0x36cacf=_0x37e3a3[_0x5ffe('0x37')][_0x5ffe('0x50')];return db['Team'][_0x5ffe('0x27')]({'where':{'id':_0x36cacf},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5ffe('0x1c'),_0x5ffe('0x51'),_0x5ffe('0x52'),_0x5ffe('0x53')],'raw':!![]}]})[_0x5ffe('0x16')](function(_0x243087){if(_0x243087){var _0x69924b=_['flatMap'](_0x243087,function(_0x13f0c9){var _0x531d5b=_0x13f0c9[_0x5ffe('0x17')]({'plain':!![]});return _0x531d5b[_0x5ffe('0x54')];});return db['OpenchannelQueue'][_0x5ffe('0x35')]({'where':{'id':_0x37e3a3['params']['id']}})[_0x5ffe('0x16')](function(_0xdcc151){return db[_0x5ffe('0x55')]['transaction'](function(_0x3e8b24){return _0xdcc151[_0x5ffe('0x56')](_0x36cacf,{'transaction':_0x3e8b24})['then'](function(){return BPromise['each'](_0x69924b,function(_0x579c88){return db['UserOpenchannelQueue'][_0x5ffe('0x57')]({'where':{'UserId':_0x579c88['id'],'OpenchannelQueueId':_0x37e3a3[_0x5ffe('0x3e')]['id']},'transaction':_0x3e8b24});});})[_0x5ffe('0x16')](function(){_0x69924b[_0x5ffe('0x58')](function(_0x341a52){socket[_0x5ffe('0x59')](_0x5ffe('0x5a'),{'UserId':_0x341a52['id'],'OpenchannelQueueId':_0xdcc151['id']});});});});});}})[_0x5ffe('0x16')](respondWithStatusCode(_0x4e37a7,null))['catch'](handleError(_0x4e37a7,null));};exports[_0x5ffe('0x5b')]=function(_0x3453c1,_0x39f0ef){return db[_0x5ffe('0x5c')][_0x5ffe('0x27')]({'where':{'id':_0x3453c1[_0x5ffe('0x26')][_0x5ffe('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5ffe('0x16')](handleEntityNotFound(_0x39f0ef,null))['then'](function(_0x1a6751){var _0x8e2460=_[_0x5ffe('0x1f')](_0x1a6751,'id');var _0x1be555=[];var _0x298b8d=[];var _0x1e89e5=squel[_0x5ffe('0x5d')]();_0x1e89e5[_0x5ffe('0x5e')](_0x5ffe('0x5f'))[_0x5ffe('0x60')](_0x5ffe('0x61'),'tq')['join'](_0x5ffe('0x62'),'ut',_0x5ffe('0x63'))['where'](_0x5ffe('0x64'),_0x3453c1[_0x5ffe('0x3e')]['id']);for(var _0x43228e=0x0;_0x43228e<_0x1a6751['length'];_0x43228e+=0x1){let _0x1c106c=_0x1a6751[_0x43228e];for(var _0x236717=0x0;_0x236717<_0x1c106c[_0x5ffe('0x54')]['length'];_0x236717+=0x1){let _0x479070=_0x1c106c[_0x5ffe('0x54')][_0x236717];var _0x4c30c4=_0x1e89e5[_0x5ffe('0x65')]();_0x4c30c4[_0x5ffe('0x24')](_0x5ffe('0x66'),_0x479070['id']);_0x298b8d[_0x5ffe('0x67')](db[_0x5ffe('0x55')]['query'](_0x4c30c4[_0x5ffe('0x68')](),{'type':db[_0x5ffe('0x55')][_0x5ffe('0x69')]['SELECT']})[_0x5ffe('0x16')](function(_0x54f256){if(_0x54f256[_0x5ffe('0x31')]===0x1){return _0x479070['id'];}else{var _0x1fd931=_[_0x5ffe('0x6a')](_[_0x5ffe('0x1f')](_0x54f256,_0x5ffe('0x6b')),function(_0x183206){return _[_0x5ffe('0x6c')](_0x8e2460,_0x183206);});if(_0x1fd931){return _0x479070['id'];}}}));}}return BPromise['all'](_0x298b8d)[_0x5ffe('0x16')](function(_0x47e6e9){_0x1be555=_(_0x1be555)[_0x5ffe('0x6d')](_0x47e6e9)[_0x5ffe('0x6e')]()[_0x5ffe('0x6f')]();return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x3453c1['params']['id']}})[_0x5ffe('0x16')](function(_0x84b136){return db[_0x5ffe('0x55')][_0x5ffe('0x70')](function(_0x2008a3){return _0x84b136[_0x5ffe('0x5b')](_0x3453c1[_0x5ffe('0x26')][_0x5ffe('0x50')],{'transaction':_0x2008a3})[_0x5ffe('0x16')](function(){if(!_[_0x5ffe('0x71')](_0x1be555)){return _0x84b136[_0x5ffe('0x72')](_0x1be555,{'transaction':_0x2008a3});}})[_0x5ffe('0x16')](function(){_0x1be555[_0x5ffe('0x58')](function(_0x4a06eb){socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':_0x4a06eb,'OpenchannelQueueId':_0x84b136['id']});});});});});});})['then'](respondWithStatusCode(_0x39f0ef,null))['catch'](handleError(_0x39f0ef,null));};exports[_0x5ffe('0x74')]=function(_0x2c0bad,_0x8d26b2){return db['OpenchannelQueue'][_0x5ffe('0x35')]({'where':{'id':_0x2c0bad['params']['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x8d26b2,null))[_0x5ffe('0x16')](function(_0x479b38){if(_0x479b38){return _0x479b38[_0x5ffe('0x74')](_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')],_[_0x5ffe('0x75')](_0x2c0bad[_0x5ffe('0x37')],[_0x5ffe('0x50'),'id'])||{})['spread'](function(_0x51b663){for(var _0x13dd1c=0x0;_0x13dd1c<_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')]['length'];_0x13dd1c+=0x1){socket['emit'](_0x5ffe('0x5a'),{'UserId':Number(_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')][_0x13dd1c]),'OpenchannelQueueId':Number(_0x2c0bad['params']['id'])});}return _0x51b663;});}})[_0x5ffe('0x16')](respondWithResult(_0x8d26b2,null))['catch'](handleError(_0x8d26b2,null));};exports[_0x5ffe('0x72')]=function(_0x51e3a3,_0xaba453){return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x51e3a3[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0xaba453,null))[_0x5ffe('0x16')](function(_0x14be6e){if(_0x14be6e){return _0x14be6e[_0x5ffe('0x72')](_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')])['then'](function(){if(_[_0x5ffe('0x76')](_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')])){for(var _0x10ca4f=0x0;_0x10ca4f<_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')][_0x5ffe('0x31')];_0x10ca4f+=0x1){socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':Number(_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')][_0x10ca4f]),'OpenchannelQueueId':Number(_0x51e3a3[_0x5ffe('0x3e')]['id'])});}}else{socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':Number(_0x51e3a3['query']['ids']),'OpenchannelQueueId':Number(_0x51e3a3[_0x5ffe('0x3e')]['id'])});}});}})[_0x5ffe('0x16')](respondWithStatusCode(_0xaba453,null))[_0x5ffe('0x29')](handleError(_0xaba453,null));};exports[_0x5ffe('0x77')]=function(_0x2d095b,_0x3d75ec){var _0x310b6f={};var _0x15cd82={};var _0x474565;var _0x2fd9d4;return db[_0x5ffe('0x20')][_0x5ffe('0x40')]({'where':{'id':_0x2d095b[_0x5ffe('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3d75ec,null))[_0x5ffe('0x16')](function(_0x3aa2a9){if(_0x3aa2a9){_0x474565=_0x3aa2a9;_0x15cd82[_0x5ffe('0x2b')]=_[_0x5ffe('0x2c')](db[_0x5ffe('0x49')]['rawAttributes']);_0x15cd82[_0x5ffe('0x26')]=_[_0x5ffe('0x2c')](_0x2d095b[_0x5ffe('0x26')]);_0x15cd82[_0x5ffe('0x2d')]=_[_0x5ffe('0x2e')](_0x15cd82[_0x5ffe('0x2b')],_0x15cd82['query']);_0x310b6f[_0x5ffe('0x2f')]=_[_0x5ffe('0x2e')](_0x15cd82[_0x5ffe('0x2b')],qs['fields'](_0x2d095b[_0x5ffe('0x26')]['fields']));_0x310b6f[_0x5ffe('0x2f')]=_0x310b6f['attributes'][_0x5ffe('0x31')]?_0x310b6f[_0x5ffe('0x2f')]:_0x15cd82['model'];_0x310b6f['order']=qs[_0x5ffe('0x45')](_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x45')]);_0x310b6f['where']=qs[_0x5ffe('0x2d')](_['pick'](_0x2d095b[_0x5ffe('0x26')],_0x15cd82['filters']));if(_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x48')]){_0x310b6f['where']=_[_0x5ffe('0x33')](_0x310b6f[_0x5ffe('0x24')],{'$or':_[_0x5ffe('0x1f')](_0x310b6f[_0x5ffe('0x2f')],function(_0x4139f7){var _0x37fd14={};_0x37fd14[_0x4139f7]={'$like':'%'+_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x37fd14;})});}_0x310b6f=_['merge']({},_0x310b6f,_0x2d095b[_0x5ffe('0x34')]);return _0x474565[_0x5ffe('0x77')](_0x310b6f);}})[_0x5ffe('0x16')](function(_0x27d430){if(_0x27d430){_0x2fd9d4=_0x27d430[_0x5ffe('0x31')];if(!_0x2d095b[_0x5ffe('0x26')]['hasOwnProperty'](_0x5ffe('0x43'))){_0x310b6f[_0x5ffe('0x10')]=qs['limit'](_0x2d095b[_0x5ffe('0x26')]['limit']);_0x310b6f['offset']=qs[_0x5ffe('0xe')](_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0xe')]);}return _0x474565[_0x5ffe('0x77')](_0x310b6f);}})[_0x5ffe('0x16')](function(_0x9f8682){if(_0x9f8682){return _0x9f8682?{'count':_0x2fd9d4,'rows':_0x9f8682}:null;}})['then'](respondWithResult(_0x3d75ec,null))[_0x5ffe('0x29')](handleError(_0x3d75ec,null));}; \ No newline at end of file +var _0xa086=['QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','stack','name','index','map','OpenchannelQueue','type','key','getOptions','where','include','query','rows','show','params','model','keys','rawAttributes','intersection','fields','attributes','length','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','filters','nolimit','sort','pick','OpenchannelQueueId','filter','options','findAll','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString'];(function(_0xc8b400,_0x4ef3e4){var _0x135f09=function(_0x3fa1e5){while(--_0x3fa1e5){_0xc8b400['push'](_0xc8b400['shift']());}};_0x135f09(++_0x4ef3e4);}(_0xa086,0x10c));var _0x6a08=function(_0xc2dc17,_0x1207a8){_0xc2dc17=_0xc2dc17-0x0;var _0x1abbea=_0xa086[_0xc2dc17];return _0x1abbea;};'use strict';var BPromise=require(_0x6a08('0x0'));var util=require(_0x6a08('0x1'));var _=require(_0x6a08('0x2'));var squel=require(_0x6a08('0x3'));var Redis=require(_0x6a08('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6a08('0x5'));var config=require(_0x6a08('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6a08('0x7')](config['redis'],{'host':_0x6a08('0x8'),'port':0x18eb});var socket=require(_0x6a08('0x9'))(new Redis(config[_0x6a08('0xa')]));require(_0x6a08('0xb'))['register'](socket);function respondWithStatusCode(_0x351221,_0x54f38f){_0x54f38f=_0x54f38f||0xcc;return function(_0x1a1ca9){if(_0x1a1ca9){return _0x351221[_0x6a08('0xc')](_0x54f38f);}return _0x351221[_0x6a08('0xd')](_0x54f38f)[_0x6a08('0xe')]();};}function respondWithResult(_0x146537,_0x4b9801){_0x4b9801=_0x4b9801||0xc8;return function(_0xbdc7ae){if(_0xbdc7ae){return _0x146537[_0x6a08('0xd')](_0x4b9801)['json'](_0xbdc7ae);}};}function respondWithFilteredResult(_0x1cb3ad,_0x61a693){return function(_0x3c37f2){if(_0x3c37f2){var _0x22c6ef=typeof _0x61a693[_0x6a08('0xf')]===_0x6a08('0x10')&&typeof _0x61a693[_0x6a08('0x11')]===_0x6a08('0x10');var _0x56bfef=_0x3c37f2[_0x6a08('0x12')];var _0x6099da=_0x22c6ef?0x0:_0x61a693[_0x6a08('0xf')];var _0x49b95f=_0x22c6ef?_0x3c37f2['count']:_0x61a693['offset']+_0x61a693[_0x6a08('0x11')];var _0x7d2b0b;if(_0x49b95f>=_0x56bfef){_0x49b95f=_0x56bfef;_0x7d2b0b=0xc8;}else{_0x7d2b0b=0xce;}_0x1cb3ad[_0x6a08('0xd')](_0x7d2b0b);return _0x1cb3ad[_0x6a08('0x13')](_0x6a08('0x14'),_0x6099da+'-'+_0x49b95f+'/'+_0x56bfef)[_0x6a08('0x15')](_0x3c37f2);}return null;};}function saveUpdates(_0xb8def5){return function(_0x255943){if(_0x255943){return _0x255943[_0x6a08('0x16')](_0xb8def5)[_0x6a08('0x17')](function(_0x5a6905){return _0x5a6905;});}return null;};}function removeEntity(_0x56b359){return function(_0x26cf64){if(_0x26cf64){return _0x26cf64[_0x6a08('0x18')]()[_0x6a08('0x17')](function(){var _0x48a4ba=_0x26cf64[_0x6a08('0x19')]({'plain':!![]});var _0x5ce914='OpenchannelQueues';return db[_0x6a08('0x1a')][_0x6a08('0x18')]({'where':{'type':_0x5ce914,'resourceId':_0x48a4ba['id']}})[_0x6a08('0x17')](function(){return _0x26cf64;});})[_0x6a08('0x17')](function(){_0x56b359[_0x6a08('0xd')](0xcc)[_0x6a08('0xe')]();});}};}function handleEntityNotFound(_0x424578){return function(_0x11e64c){if(!_0x11e64c){_0x424578[_0x6a08('0xc')](0x194);}return _0x11e64c;};}function handleError(_0x3e0e66,_0x55e7e4){_0x55e7e4=_0x55e7e4||0x1f4;return function(_0x4fd908){logger['error'](_0x4fd908[_0x6a08('0x1b')]);if(_0x4fd908[_0x6a08('0x1c')]){delete _0x4fd908[_0x6a08('0x1c')];}_0x3e0e66[_0x6a08('0xd')](_0x55e7e4)['send'](_0x4fd908);};}exports[_0x6a08('0x1d')]=function(_0xfec092,_0x4b6358){var _0x1421b9={};var _0x526218={'count':0x0,'rows':[]};var _0x26715f=_[_0x6a08('0x1e')](db[_0x6a08('0x1f')]['rawAttributes'],function(_0x39226c){return{'name':_0x39226c['fieldName'],'type':_0x39226c[_0x6a08('0x20')][_0x6a08('0x21')]};});_0x1421b9=qs[_0x6a08('0x22')](_0x26715f,_0xfec092);var _0x1a9268={'where':_0x1421b9[_0x6a08('0x23')]};return db[_0x6a08('0x1f')][_0x6a08('0x12')](_0x1a9268)[_0x6a08('0x17')](function(_0x41c8f6){_0x526218[_0x6a08('0x12')]=_0x41c8f6;_0x1421b9[_0x6a08('0x24')]=qs[_0x6a08('0x24')](_0xfec092[_0x6a08('0x25')]);return db[_0x6a08('0x1f')]['findAll'](_0x1421b9);})['then'](function(_0x1704fa){_0x526218[_0x6a08('0x26')]=_0x1704fa;return _0x526218;})[_0x6a08('0x17')](respondWithFilteredResult(_0x4b6358,_0x1421b9))['catch'](handleError(_0x4b6358,null));};exports[_0x6a08('0x27')]=function(_0x5cd63c,_0x3e2d16){var _0x82c4d6={'raw':!![],'where':{'id':_0x5cd63c[_0x6a08('0x28')]['id']}},_0x54007b={};_0x54007b[_0x6a08('0x29')]=_[_0x6a08('0x2a')](db[_0x6a08('0x1f')][_0x6a08('0x2b')]);_0x54007b['query']=_[_0x6a08('0x2a')](_0x5cd63c[_0x6a08('0x25')]);_0x54007b['filters']=_[_0x6a08('0x2c')](_0x54007b['model'],_0x54007b['query']);_0x82c4d6['attributes']=_[_0x6a08('0x2c')](_0x54007b[_0x6a08('0x29')],qs[_0x6a08('0x2d')](_0x5cd63c[_0x6a08('0x25')][_0x6a08('0x2d')]));_0x82c4d6[_0x6a08('0x2e')]=_0x82c4d6[_0x6a08('0x2e')][_0x6a08('0x2f')]?_0x82c4d6['attributes']:_0x54007b[_0x6a08('0x29')];if(_0x5cd63c['query'][_0x6a08('0x30')]){_0x82c4d6[_0x6a08('0x24')]=[{'all':!![]}];}_0x82c4d6=_[_0x6a08('0x31')]({},_0x82c4d6,_0x5cd63c['options']);return db[_0x6a08('0x1f')][_0x6a08('0x32')](_0x82c4d6)[_0x6a08('0x17')](handleEntityNotFound(_0x3e2d16,null))[_0x6a08('0x17')](respondWithResult(_0x3e2d16,null))[_0x6a08('0x33')](handleError(_0x3e2d16,null));};exports[_0x6a08('0x34')]=function(_0x4aaaeb,_0x29450f){return db[_0x6a08('0x1f')][_0x6a08('0x34')](_0x4aaaeb[_0x6a08('0x35')],{})[_0x6a08('0x17')](function(_0x34780b){var _0x2de994=_0x4aaaeb[_0x6a08('0x36')]['get']({'plain':!![]});if(!_0x2de994)throw new Error(_0x6a08('0x37'));if(_0x2de994['role']===_0x6a08('0x36')){var _0x2bf42c=_0x34780b[_0x6a08('0x19')]({'plain':!![]});var _0x349ca4=_0x6a08('0x38');return db['UserProfileSection'][_0x6a08('0x32')]({'where':{'name':_0x349ca4,'userProfileId':_0x2de994[_0x6a08('0x39')]},'raw':!![]})['then'](function(_0x1314ce){if(_0x1314ce&&_0x1314ce[_0x6a08('0x3a')]===0x0){return db[_0x6a08('0x1a')][_0x6a08('0x34')]({'name':_0x2bf42c[_0x6a08('0x1c')],'resourceId':_0x2bf42c['id'],'type':_0x1314ce[_0x6a08('0x1c')],'sectionId':_0x1314ce['id']},{})['then'](function(){return _0x34780b;});}else{return _0x34780b;}})[_0x6a08('0x33')](function(_0x2770bb){logger[_0x6a08('0x3b')](_0x6a08('0x3c'),_0x2770bb);throw _0x2770bb;});}return _0x34780b;})[_0x6a08('0x17')](respondWithResult(_0x29450f,0xc9))[_0x6a08('0x33')](handleError(_0x29450f,null));};exports['update']=function(_0x4ddc0a,_0x4c7ca0){if(_0x4ddc0a[_0x6a08('0x35')]['id']){delete _0x4ddc0a['body']['id'];}return db[_0x6a08('0x1f')][_0x6a08('0x32')]({'where':{'id':_0x4ddc0a[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0x4c7ca0,null))[_0x6a08('0x17')](saveUpdates(_0x4ddc0a[_0x6a08('0x35')],null))['then'](respondWithResult(_0x4c7ca0,null))['catch'](handleError(_0x4c7ca0,null));};exports['destroy']=function(_0x27df88,_0x3dd8ff){return db[_0x6a08('0x1f')][_0x6a08('0x32')]({'where':{'id':_0x27df88[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0x3dd8ff,null))[_0x6a08('0x17')](removeEntity(_0x3dd8ff,null))[_0x6a08('0x33')](handleError(_0x3dd8ff,null));};exports[_0x6a08('0x3d')]=function(_0x3a4c6a,_0x5c1fd4){return db[_0x6a08('0x1f')][_0x6a08('0x3d')]()[_0x6a08('0x17')](respondWithResult(_0x5c1fd4,null))[_0x6a08('0x33')](handleError(_0x5c1fd4,null));};exports[_0x6a08('0x3e')]=function(_0x2c7f01,_0xfadd9f){var _0x38d2a5={'raw':!![],'where':{}},_0x42463d={},_0x519b11;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2c7f01[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0xfadd9f,null))[_0x6a08('0x17')](function(_0x2cb930){if(_0x2cb930){_0x519b11=_0x2cb930[_0x6a08('0x19')]({'plain':!![]});_0x42463d[_0x6a08('0x29')]=_[_0x6a08('0x2a')](db[_0x6a08('0x3f')][_0x6a08('0x2b')]);_0x42463d[_0x6a08('0x25')]=_[_0x6a08('0x2a')](_0x2c7f01[_0x6a08('0x25')]);_0x42463d[_0x6a08('0x40')]=_['intersection'](_0x42463d[_0x6a08('0x29')],_0x42463d['query']);_0x38d2a5['attributes']=_['intersection'](_0x42463d[_0x6a08('0x29')],qs[_0x6a08('0x2d')](_0x2c7f01[_0x6a08('0x25')]['fields']));_0x38d2a5[_0x6a08('0x2e')]=_0x38d2a5['attributes']['length']?_0x38d2a5[_0x6a08('0x2e')]:_0x42463d['model'];if(!_0x2c7f01[_0x6a08('0x25')]['hasOwnProperty'](_0x6a08('0x41'))){_0x38d2a5[_0x6a08('0x11')]=qs['limit'](_0x2c7f01[_0x6a08('0x25')][_0x6a08('0x11')]);_0x38d2a5[_0x6a08('0xf')]=qs[_0x6a08('0xf')](_0x2c7f01[_0x6a08('0x25')][_0x6a08('0xf')]);}_0x38d2a5['order']=qs[_0x6a08('0x42')](_0x2c7f01[_0x6a08('0x25')][_0x6a08('0x42')]);_0x38d2a5[_0x6a08('0x23')]=qs['filters'](_[_0x6a08('0x43')](_0x2c7f01[_0x6a08('0x25')],_0x42463d[_0x6a08('0x40')]));_0x38d2a5['where'][_0x6a08('0x44')]=_0x2cb930['id'];if(_0x2c7f01['query'][_0x6a08('0x45')]){_0x38d2a5[_0x6a08('0x23')]=_[_0x6a08('0x31')](_0x38d2a5[_0x6a08('0x23')],{'$or':_['map'](_0x38d2a5[_0x6a08('0x2e')],function(_0x19ff5d){var _0x41caee={};_0x41caee[_0x19ff5d]={'$like':'%'+_0x2c7f01[_0x6a08('0x25')][_0x6a08('0x45')]+'%'};return _0x41caee;})});}_0x38d2a5=_['merge']({},_0x38d2a5,_0x2c7f01[_0x6a08('0x46')]);return db['UserOpenchannelQueue'][_0x6a08('0x47')](_0x38d2a5);}})['then'](function(_0x579e74){if(_0x579e74){return db[_0x6a08('0x48')]['findAndCountAll']({'where':{'id':_[_0x6a08('0x1e')](_0x579e74,_0x6a08('0x49')),'role':_0x6a08('0x4a')},'attributes':['id',_0x6a08('0x1c'),_0x6a08('0x4b'),_0x6a08('0x4c'),_0x6a08('0x4d')]});}})[_0x6a08('0x17')](function(_0x4f6012){if(_0x4f6012){return{'count':_0x4f6012[_0x6a08('0x12')],'rows':_[_0x6a08('0x1e')](_0x4f6012[_0x6a08('0x26')],function(_0x18ead0){return{'membername':_0x18ead0[_0x6a08('0x1c')],'UserId':_0x18ead0['id'],'queue_name':_0x519b11[_0x6a08('0x1c')],'OpenchannelQueueId':_0x519b11['id'],'interface':util[_0x6a08('0x4e')](_0x6a08('0x4f'),_0x6a08('0x50'),_0x18ead0[_0x6a08('0x1c')]),'penalty':0x0,'paused':_0x18ead0[_0x6a08('0x4b')],'createdAt':_0x18ead0[_0x6a08('0x4d')],'updatedAt':_0x18ead0[_0x6a08('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6a08('0x17')](respondWithFilteredResult(_0xfadd9f,_0x38d2a5))[_0x6a08('0x33')](handleError(_0xfadd9f,null));};exports[_0x6a08('0x51')]=function(_0x4c928d,_0x5334e6){var _0x391370={};var _0x2d1b57={};var _0x5570e7;var _0x8c1177;return db[_0x6a08('0x1f')][_0x6a08('0x52')]({'where':{'id':_0x4c928d[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0x5334e6,null))[_0x6a08('0x17')](function(_0x1b6389){if(_0x1b6389){_0x5570e7=_0x1b6389;_0x2d1b57[_0x6a08('0x29')]=_[_0x6a08('0x2a')](db['Team']['rawAttributes']);_0x2d1b57[_0x6a08('0x25')]=_[_0x6a08('0x2a')](_0x4c928d[_0x6a08('0x25')]);_0x2d1b57[_0x6a08('0x40')]=_[_0x6a08('0x2c')](_0x2d1b57[_0x6a08('0x29')],_0x2d1b57['query']);_0x391370[_0x6a08('0x2e')]=_[_0x6a08('0x2c')](_0x2d1b57[_0x6a08('0x29')],qs[_0x6a08('0x2d')](_0x4c928d[_0x6a08('0x25')][_0x6a08('0x2d')]));_0x391370[_0x6a08('0x2e')]=_0x391370[_0x6a08('0x2e')][_0x6a08('0x2f')]?_0x391370[_0x6a08('0x2e')]:_0x2d1b57[_0x6a08('0x29')];_0x391370['order']=qs[_0x6a08('0x42')](_0x4c928d['query'][_0x6a08('0x42')]);_0x391370[_0x6a08('0x23')]=qs[_0x6a08('0x40')](_[_0x6a08('0x43')](_0x4c928d[_0x6a08('0x25')],_0x2d1b57['filters']));if(_0x4c928d[_0x6a08('0x25')][_0x6a08('0x45')]){_0x391370[_0x6a08('0x23')]=_[_0x6a08('0x31')](_0x391370['where'],{'$or':_['map'](_0x391370[_0x6a08('0x2e')],function(_0x40e881){var _0x336fb9={};_0x336fb9[_0x40e881]={'$like':'%'+_0x4c928d[_0x6a08('0x25')][_0x6a08('0x45')]+'%'};return _0x336fb9;})});}_0x391370=_[_0x6a08('0x31')]({},_0x391370,_0x4c928d[_0x6a08('0x46')]);return _0x5570e7[_0x6a08('0x51')](_0x391370);}})[_0x6a08('0x17')](function(_0x4c44d3){if(_0x4c44d3){_0x8c1177=_0x4c44d3['length'];if(!_0x4c928d[_0x6a08('0x25')][_0x6a08('0x53')](_0x6a08('0x41'))){_0x391370['limit']=qs[_0x6a08('0x11')](_0x4c928d[_0x6a08('0x25')][_0x6a08('0x11')]);_0x391370[_0x6a08('0xf')]=qs[_0x6a08('0xf')](_0x4c928d[_0x6a08('0x25')][_0x6a08('0xf')]);}return _0x5570e7['getTeams'](_0x391370);}})[_0x6a08('0x17')](function(_0x18e44b){if(_0x18e44b){return _0x18e44b?{'count':_0x8c1177,'rows':_0x18e44b}:null;}})['then'](respondWithResult(_0x5334e6,null))[_0x6a08('0x33')](handleError(_0x5334e6,null));};exports[_0x6a08('0x54')]=function(_0x45e2b6,_0x281ca8){var _0x33b0e1=_0x45e2b6['body'][_0x6a08('0x55')];return db[_0x6a08('0x56')][_0x6a08('0x47')]({'where':{'id':_0x33b0e1},'attributes':['id'],'include':[{'model':db[_0x6a08('0x48')],'as':_0x6a08('0x57'),'attributes':['id',_0x6a08('0x1c'),_0x6a08('0x58'),_0x6a08('0x59'),'interface'],'raw':!![]}]})[_0x6a08('0x17')](function(_0x51fb64){if(_0x51fb64){var _0x25e99b=_[_0x6a08('0x5a')](_0x51fb64,function(_0x4b8f3e){var _0x30eb1c=_0x4b8f3e['get']({'plain':!![]});return _0x30eb1c[_0x6a08('0x57')];});return db[_0x6a08('0x1f')][_0x6a08('0x32')]({'where':{'id':_0x45e2b6[_0x6a08('0x28')]['id']}})['then'](function(_0x481ed1){return db[_0x6a08('0x5b')]['transaction'](function(_0x30bb3d){return _0x481ed1[_0x6a08('0x54')](_0x33b0e1,{'transaction':_0x30bb3d})[_0x6a08('0x17')](function(){return BPromise[_0x6a08('0x5c')](_0x25e99b,function(_0x584ffb){return db[_0x6a08('0x3f')][_0x6a08('0x5d')]({'where':{'UserId':_0x584ffb['id'],'OpenchannelQueueId':_0x45e2b6['params']['id']},'transaction':_0x30bb3d});});})[_0x6a08('0x17')](function(){_0x25e99b[_0x6a08('0x5e')](function(_0x173e93){socket[_0x6a08('0x5f')](_0x6a08('0x60'),{'UserId':_0x173e93['id'],'OpenchannelQueueId':_0x481ed1['id']});});});});});}})[_0x6a08('0x17')](respondWithStatusCode(_0x281ca8,null))['catch'](handleError(_0x281ca8,null));};exports[_0x6a08('0x61')]=function(_0x3e21e8,_0x3e9050){return db['Team'][_0x6a08('0x47')]({'where':{'id':_0x3e21e8[_0x6a08('0x25')][_0x6a08('0x55')]},'attributes':['id'],'include':[{'model':db[_0x6a08('0x48')],'as':_0x6a08('0x57'),'attributes':['id'],'raw':!![]}]})[_0x6a08('0x17')](handleEntityNotFound(_0x3e9050,null))[_0x6a08('0x17')](function(_0x3cbc2f){var _0x49a06e=_[_0x6a08('0x1e')](_0x3cbc2f,'id');var _0x63d66a=[];var _0x396b92=[];var _0x33c7cd=squel['select']();_0x33c7cd['field'](_0x6a08('0x62'))[_0x6a08('0x63')](_0x6a08('0x64'),'tq')[_0x6a08('0x65')](_0x6a08('0x66'),'ut',_0x6a08('0x67'))[_0x6a08('0x23')]('OpenchannelQueueId\x20=\x20?',_0x3e21e8[_0x6a08('0x28')]['id']);for(var _0x2e4871=0x0;_0x2e4871<_0x3cbc2f['length'];_0x2e4871+=0x1){let _0x5deedd=_0x3cbc2f[_0x2e4871];for(var _0x4f65fd=0x0;_0x4f65fd<_0x5deedd[_0x6a08('0x57')][_0x6a08('0x2f')];_0x4f65fd+=0x1){let _0x2bd457=_0x5deedd[_0x6a08('0x57')][_0x4f65fd];var _0x1a43e2=_0x33c7cd['clone']();_0x1a43e2[_0x6a08('0x23')](_0x6a08('0x68'),_0x2bd457['id']);_0x396b92[_0x6a08('0x69')](db[_0x6a08('0x5b')][_0x6a08('0x25')](_0x1a43e2[_0x6a08('0x6a')](),{'type':db[_0x6a08('0x5b')][_0x6a08('0x6b')][_0x6a08('0x6c')]})[_0x6a08('0x17')](function(_0x28f479){if(_0x28f479['length']===0x1){return _0x2bd457['id'];}else{var _0x4e37e0=_[_0x6a08('0x6d')](_[_0x6a08('0x1e')](_0x28f479,_0x6a08('0x6e')),function(_0x3a221b){return _['includes'](_0x49a06e,_0x3a221b);});if(_0x4e37e0){return _0x2bd457['id'];}}}));}}return BPromise[_0x6a08('0x6f')](_0x396b92)[_0x6a08('0x17')](function(_0x45eb3f){_0x63d66a=_(_0x63d66a)[_0x6a08('0x70')](_0x45eb3f)[_0x6a08('0x71')]()[_0x6a08('0x72')]();return db[_0x6a08('0x1f')]['find']({'where':{'id':_0x3e21e8[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](function(_0x88db25){return db['sequelize'][_0x6a08('0x73')](function(_0x2c1651){return _0x88db25[_0x6a08('0x61')](_0x3e21e8[_0x6a08('0x25')][_0x6a08('0x55')],{'transaction':_0x2c1651})[_0x6a08('0x17')](function(){if(!_[_0x6a08('0x74')](_0x63d66a)){return _0x88db25[_0x6a08('0x75')](_0x63d66a,{'transaction':_0x2c1651});}})[_0x6a08('0x17')](function(){_0x63d66a['forEach'](function(_0x19fd9b){socket[_0x6a08('0x5f')](_0x6a08('0x76'),{'UserId':_0x19fd9b,'OpenchannelQueueId':_0x88db25['id']});});});});});});})[_0x6a08('0x17')](respondWithStatusCode(_0x3e9050,null))[_0x6a08('0x33')](handleError(_0x3e9050,null));};exports[_0x6a08('0x77')]=function(_0x40f176,_0x1135f2){return db[_0x6a08('0x1f')]['find']({'where':{'id':_0x40f176[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0x1135f2,null))[_0x6a08('0x17')](function(_0x194a7d){if(_0x194a7d){return _0x194a7d['addAgents'](_0x40f176[_0x6a08('0x35')][_0x6a08('0x55')],_[_0x6a08('0x78')](_0x40f176[_0x6a08('0x35')],[_0x6a08('0x55'),'id'])||{})[_0x6a08('0x79')](function(_0x33f6c6){for(var _0x4515bb=0x0;_0x4515bb<_0x40f176[_0x6a08('0x35')][_0x6a08('0x55')]['length'];_0x4515bb+=0x1){socket[_0x6a08('0x5f')](_0x6a08('0x60'),{'UserId':Number(_0x40f176[_0x6a08('0x35')]['ids'][_0x4515bb]),'OpenchannelQueueId':Number(_0x40f176[_0x6a08('0x28')]['id'])});}return _0x33f6c6;});}})[_0x6a08('0x17')](respondWithResult(_0x1135f2,null))[_0x6a08('0x33')](handleError(_0x1135f2,null));};exports[_0x6a08('0x75')]=function(_0x492b2f,_0x748e20){return db[_0x6a08('0x1f')]['find']({'where':{'id':_0x492b2f[_0x6a08('0x28')]['id']}})[_0x6a08('0x17')](handleEntityNotFound(_0x748e20,null))[_0x6a08('0x17')](function(_0x27452c){if(_0x27452c){return _0x27452c[_0x6a08('0x75')](_0x492b2f[_0x6a08('0x25')]['ids'])[_0x6a08('0x17')](function(){if(_[_0x6a08('0x7a')](_0x492b2f[_0x6a08('0x25')]['ids'])){for(var _0x2ae211=0x0;_0x2ae211<_0x492b2f['query']['ids'][_0x6a08('0x2f')];_0x2ae211+=0x1){socket[_0x6a08('0x5f')](_0x6a08('0x76'),{'UserId':Number(_0x492b2f[_0x6a08('0x25')]['ids'][_0x2ae211]),'OpenchannelQueueId':Number(_0x492b2f[_0x6a08('0x28')]['id'])});}}else{socket[_0x6a08('0x5f')](_0x6a08('0x76'),{'UserId':Number(_0x492b2f[_0x6a08('0x25')]['ids']),'OpenchannelQueueId':Number(_0x492b2f[_0x6a08('0x28')]['id'])});}});}})[_0x6a08('0x17')](respondWithStatusCode(_0x748e20,null))['catch'](handleError(_0x748e20,null));};exports[_0x6a08('0x7b')]=function(_0x3a0322,_0x8d48c9){var _0x2cb430={};var _0x223650={};var _0x4240c1;var _0x27899c;return db[_0x6a08('0x1f')][_0x6a08('0x52')]({'where':{'id':_0x3a0322[_0x6a08('0x28')]['id']}})['then'](handleEntityNotFound(_0x8d48c9,null))['then'](function(_0x5b9408){if(_0x5b9408){_0x4240c1=_0x5b9408;_0x223650['model']=_[_0x6a08('0x2a')](db[_0x6a08('0x48')]['rawAttributes']);_0x223650['query']=_[_0x6a08('0x2a')](_0x3a0322[_0x6a08('0x25')]);_0x223650[_0x6a08('0x40')]=_[_0x6a08('0x2c')](_0x223650['model'],_0x223650[_0x6a08('0x25')]);_0x2cb430[_0x6a08('0x2e')]=_[_0x6a08('0x2c')](_0x223650['model'],qs[_0x6a08('0x2d')](_0x3a0322[_0x6a08('0x25')]['fields']));_0x2cb430[_0x6a08('0x2e')]=_0x2cb430[_0x6a08('0x2e')][_0x6a08('0x2f')]?_0x2cb430[_0x6a08('0x2e')]:_0x223650['model'];_0x2cb430[_0x6a08('0x7c')]=qs[_0x6a08('0x42')](_0x3a0322[_0x6a08('0x25')]['sort']);_0x2cb430['where']=qs[_0x6a08('0x40')](_[_0x6a08('0x43')](_0x3a0322['query'],_0x223650['filters']));if(_0x3a0322[_0x6a08('0x25')]['filter']){_0x2cb430[_0x6a08('0x23')]=_['merge'](_0x2cb430['where'],{'$or':_[_0x6a08('0x1e')](_0x2cb430[_0x6a08('0x2e')],function(_0x9a54b9){var _0x1ad45e={};_0x1ad45e[_0x9a54b9]={'$like':'%'+_0x3a0322[_0x6a08('0x25')][_0x6a08('0x45')]+'%'};return _0x1ad45e;})});}_0x2cb430=_[_0x6a08('0x31')]({},_0x2cb430,_0x3a0322[_0x6a08('0x46')]);return _0x4240c1['getAgents'](_0x2cb430);}})[_0x6a08('0x17')](function(_0x5876b8){if(_0x5876b8){_0x27899c=_0x5876b8[_0x6a08('0x2f')];if(!_0x3a0322[_0x6a08('0x25')][_0x6a08('0x53')]('nolimit')){_0x2cb430['limit']=qs[_0x6a08('0x11')](_0x3a0322[_0x6a08('0x25')][_0x6a08('0x11')]);_0x2cb430[_0x6a08('0xf')]=qs['offset'](_0x3a0322['query'][_0x6a08('0xf')]);}return _0x4240c1[_0x6a08('0x7b')](_0x2cb430);}})[_0x6a08('0x17')](function(_0x4fcc2b){if(_0x4fcc2b){return _0x4fcc2b?{'count':_0x27899c,'rows':_0x4fcc2b}:null;}})[_0x6a08('0x17')](respondWithResult(_0x8d48c9,null))[_0x6a08('0x33')](handleError(_0x8d48c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index bae0b81..f9df26b 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 _0xf224=['update','emit','hook','events','OpenchannelQueue','setMaxListeners'];(function(_0xabc049,_0x553c25){var _0x32bc5f=function(_0x6dc2fa){while(--_0x6dc2fa){_0xabc049['push'](_0xabc049['shift']());}};_0x32bc5f(++_0x553c25);}(_0xf224,0x189));var _0x4f22=function(_0x2f22d0,_0x24902d){_0x2f22d0=_0x2f22d0-0x0;var _0x9df3da=_0xf224[_0x2f22d0];return _0x9df3da;};'use strict';var EventEmitter=require(_0x4f22('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4f22('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4f22('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f22('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1b117f){return function(_0x438927,_0x1c2a71,_0x222666){OpenchannelQueueEvents[_0x4f22('0x4')](_0x1b117f+':'+_0x438927['id'],_0x438927);OpenchannelQueueEvents['emit'](_0x1b117f,_0x438927);_0x222666(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4f22('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xfe09=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x20c470,_0x535c5e){var _0x189482=function(_0x16c0da){while(--_0x16c0da){_0x20c470['push'](_0x20c470['shift']());}};_0x189482(++_0x535c5e);}(_0xfe09,0x195));var _0x9fe0=function(_0x284f96,_0x1ec954){_0x284f96=_0x284f96-0x0;var _0x20c6ef=_0xfe09[_0x284f96];return _0x20c6ef;};'use strict';var EventEmitter=require(_0x9fe0('0x0'));var OpenchannelQueue=require(_0x9fe0('0x1'))['db'][_0x9fe0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9fe0('0x3'),'afterUpdate':_0x9fe0('0x4'),'afterDestroy':_0x9fe0('0x5')};function emitEvent(_0x1cf4cd){return function(_0x5c8b50,_0x45e1c4,_0x19c7a5){OpenchannelQueueEvents[_0x9fe0('0x6')](_0x1cf4cd+':'+_0x5c8b50['id'],_0x5c8b50);OpenchannelQueueEvents[_0x9fe0('0x6')](_0x1cf4cd,_0x5c8b50);_0x19c7a5(null);};}for(var e in events){if(events[_0x9fe0('0x7')](e)){var event=events[e];OpenchannelQueue[_0x9fe0('0x8')](e,emitEvent(event));}}module[_0x9fe0('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 72c739d..f94dbf4 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 _0xd09a=['util','../../config/logger','request-promise','path','rimraf','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash'];(function(_0x58e613,_0x58f943){var _0x56d2cd=function(_0x35813a){while(--_0x35813a){_0x58e613['push'](_0x58e613['shift']());}};_0x56d2cd(++_0x58f943);}(_0xd09a,0x74));var _0xad09=function(_0x5f14d3,_0x1a1afa){_0x5f14d3=_0x5f14d3-0x0;var _0x2d0dbf=_0xd09a[_0x5f14d3];return _0x2d0dbf;};'use strict';var _=require(_0xad09('0x0'));var util=require(_0xad09('0x1'));var logger=require(_0xad09('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad09('0x3'));var fs=require('fs');var path=require(_0xad09('0x4'));var rimraf=require(_0xad09('0x5'));var config=require('../../config/environment');var attributes=require(_0xad09('0x6'));module[_0xad09('0x7')]=function(_0x3f0b60,_0x55d735){return _0x3f0b60['define'](_0xad09('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4328=['openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','OpenchannelQueue'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x4328,0x169));var _0x8432=function(_0x112c6d,_0x1e1c6b){_0x112c6d=_0x112c6d-0x0;var _0xe6b403=_0x4328[_0x112c6d];return _0xe6b403;};'use strict';var _=require(_0x8432('0x0'));var util=require(_0x8432('0x1'));var logger=require(_0x8432('0x2'))('api');var moment=require(_0x8432('0x3'));var BPromise=require(_0x8432('0x4'));var rp=require(_0x8432('0x5'));var fs=require('fs');var path=require(_0x8432('0x6'));var rimraf=require('rimraf');var config=require(_0x8432('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x49e299,_0x15a860){return _0x49e299['define'](_0x8432('0x8'),attributes,{'tableName':_0x8432('0x9'),'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 36ce49c..b9d5306 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 _0xa560=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','then','stringify','catch','ShowOpenchannelQueue','find','raw','lodash','util','randomstring'];(function(_0x3b415e,_0x98e90){var _0x1a4f88=function(_0x4fc177){while(--_0x4fc177){_0x3b415e['push'](_0x3b415e['shift']());}};_0x1a4f88(++_0x98e90);}(_0xa560,0x1a1));var _0x0a56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa560[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0a56('0x0'));var util=require(_0x0a56('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a56('0x3'))['db'];var utils=require(_0x0a56('0x4'));var logger=require(_0x0a56('0x5'))(_0x0a56('0x6'));var config=require(_0x0a56('0x7'));var jayson=require(_0x0a56('0x8'));var client=jayson[_0x0a56('0x9')][_0x0a56('0xa')]({'port':0x232a});config['redis']=_[_0x0a56('0xb')](config[_0x0a56('0xc')],{'host':_0x0a56('0xd'),'port':0x18eb});var socket=require(_0x0a56('0xe'))(new Redis(config['redis']));require(_0x0a56('0xf'))[_0x0a56('0x10')](socket);function respondWithRpcPromise(_0x12fac3,_0x1e1e35,_0x538fed){return new BPromise(function(_0x300031,_0x4bf21d){return client[_0x0a56('0x11')](_0x12fac3,_0x538fed)['then'](function(_0x4fdeb4){logger['info'](_0x0a56('0x12'),_0x1e1e35,_0x0a56('0x13'));logger[_0x0a56('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e1e35,_0x0a56('0x13'),JSON['stringify'](_0x4fdeb4));if(_0x4fdeb4['error']){if(_0x4fdeb4[_0x0a56('0x15')][_0x0a56('0x16')]===0x1f4){logger[_0x0a56('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e1e35,_0x4fdeb4['error'][_0x0a56('0x17')]);return _0x4bf21d(_0x4fdeb4[_0x0a56('0x15')][_0x0a56('0x17')]);}logger[_0x0a56('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e1e35,_0x4fdeb4['error'][_0x0a56('0x17')]);return _0x300031(_0x4fdeb4['error'][_0x0a56('0x17')]);}else{logger[_0x0a56('0x18')](_0x0a56('0x12'),_0x1e1e35,_0x0a56('0x13'));_0x300031(_0x4fdeb4[_0x0a56('0x19')]['message']);}})['catch'](function(_0x390c9d){logger[_0x0a56('0x15')](_0x0a56('0x12'),_0x1e1e35,_0x390c9d);_0x4bf21d(_0x390c9d);});});}exports[_0x0a56('0x1a')]=function(_0xd14b9f){var _0x124065=this;return new Promise(function(_0x33c166,_0x5f522f){return db[_0x0a56('0x1b')][_0x0a56('0x1c')]({'raw':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xd14b9f['options']?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x1e')]||null:null,'attributes':_0xd14b9f['options']?_0xd14b9f[_0x0a56('0x1d')]['attributes']||null:null,'limit':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x1f')]||null:null,'include':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x20')]?_[_0x0a56('0x21')](_0xd14b9f['options'][_0x0a56('0x20')],function(_0xebc6e3){return{'model':db[_0xebc6e3[_0x0a56('0x22')]],'as':_0xebc6e3['as'],'attributes':_0xebc6e3[_0x0a56('0x23')],'include':_0xebc6e3[_0x0a56('0x20')]?_[_0x0a56('0x21')](_0xebc6e3['include'],function(_0x570f30){return{'model':db[_0x570f30[_0x0a56('0x22')]],'as':_0x570f30['as'],'attributes':_0x570f30[_0x0a56('0x23')],'include':_0x570f30[_0x0a56('0x20')]?_['map'](_0x570f30[_0x0a56('0x20')],function(_0x370c83){return{'model':db[_0x370c83['model']],'as':_0x370c83['as'],'attributes':_0x370c83[_0x0a56('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a56('0x24')](function(_0xed8934){logger['info'](_0x0a56('0x1a'),_0xd14b9f);logger[_0x0a56('0x14')](_0x0a56('0x1a'),_0xd14b9f,JSON[_0x0a56('0x25')](_0xed8934));_0x33c166(_0xed8934);})[_0x0a56('0x26')](function(_0x5df3cc){logger[_0x0a56('0x15')](_0x0a56('0x1a'),_0x5df3cc['message'],_0xd14b9f);_0x5f522f(_0x124065['error'](0x1f4,_0x5df3cc[_0x0a56('0x17')]));});});};exports[_0x0a56('0x27')]=function(_0x1bac66){var _0x1c97d7=this;return new Promise(function(_0x49da9a,_0x3c8c0b){return db[_0x0a56('0x1b')][_0x0a56('0x28')]({'raw':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x29')]===undefined?!![]:![]:!![],'where':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x1e')]||null:null,'attributes':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66['options'][_0x0a56('0x23')]||null:null,'include':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x20')]?_['map'](_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x20')],function(_0x3ab1b1){return{'model':db[_0x3ab1b1[_0x0a56('0x22')]],'as':_0x3ab1b1['as'],'attributes':_0x3ab1b1['attributes'],'include':_0x3ab1b1['include']?_[_0x0a56('0x21')](_0x3ab1b1['include'],function(_0x453807){return{'model':db[_0x453807['model']],'as':_0x453807['as'],'attributes':_0x453807[_0x0a56('0x23')],'include':_0x453807[_0x0a56('0x20')]?_['map'](_0x453807[_0x0a56('0x20')],function(_0xdbfe90){return{'model':db[_0xdbfe90[_0x0a56('0x22')]],'as':_0xdbfe90['as'],'attributes':_0xdbfe90[_0x0a56('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a56('0x24')](function(_0x11aa49){logger['info'](_0x0a56('0x27'),_0x1bac66);logger[_0x0a56('0x14')](_0x0a56('0x27'),_0x1bac66,JSON['stringify'](_0x11aa49));_0x49da9a(_0x11aa49);})['catch'](function(_0x547e95){logger[_0x0a56('0x15')](_0x0a56('0x27'),_0x547e95[_0x0a56('0x17')],_0x1bac66);_0x3c8c0b(_0x1c97d7[_0x0a56('0x15')](0x1f4,_0x547e95[_0x0a56('0x17')]));});});}; \ No newline at end of file +var _0x0133=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','lodash'];(function(_0x17adf0,_0x213f85){var _0x4b62d5=function(_0x270018){while(--_0x270018){_0x17adf0['push'](_0x17adf0['shift']());}};_0x4b62d5(++_0x213f85);}(_0x0133,0xa3));var _0x3013=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x0133[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x3013('0x0'));var util=require(_0x3013('0x1'));var moment=require(_0x3013('0x2'));var BPromise=require(_0x3013('0x3'));var rs=require(_0x3013('0x4'));var fs=require('fs');var Redis=require(_0x3013('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3013('0x6'));var logger=require(_0x3013('0x7'))(_0x3013('0x8'));var config=require('../../config/environment');var jayson=require(_0x3013('0x9'));var client=jayson['client'][_0x3013('0xa')]({'port':0x232a});config[_0x3013('0xb')]=_[_0x3013('0xc')](config[_0x3013('0xb')],{'host':_0x3013('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3013('0xb')]));require(_0x3013('0xe'))[_0x3013('0xf')](socket);function respondWithRpcPromise(_0x587777,_0x5ac444,_0x5e6e69){return new BPromise(function(_0x1e0135,_0x250efe){return client['request'](_0x587777,_0x5e6e69)[_0x3013('0x10')](function(_0x233cfa){logger[_0x3013('0x11')](_0x3013('0x12'),_0x5ac444,_0x3013('0x13'));logger[_0x3013('0x14')](_0x3013('0x15'),_0x5ac444,'request\x20sent',JSON['stringify'](_0x233cfa));if(_0x233cfa[_0x3013('0x16')]){if(_0x233cfa[_0x3013('0x16')][_0x3013('0x17')]===0x1f4){logger[_0x3013('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ac444,_0x233cfa[_0x3013('0x16')][_0x3013('0x18')]);return _0x250efe(_0x233cfa['error'][_0x3013('0x18')]);}logger[_0x3013('0x16')](_0x3013('0x12'),_0x5ac444,_0x233cfa[_0x3013('0x16')][_0x3013('0x18')]);return _0x1e0135(_0x233cfa['error'][_0x3013('0x18')]);}else{logger[_0x3013('0x11')](_0x3013('0x12'),_0x5ac444,_0x3013('0x13'));_0x1e0135(_0x233cfa[_0x3013('0x19')][_0x3013('0x18')]);}})[_0x3013('0x1a')](function(_0x2f3bf4){logger[_0x3013('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ac444,_0x2f3bf4);_0x250efe(_0x2f3bf4);});});}exports['GetOpenchannelQueue']=function(_0x1b473d){var _0x12a3ea=this;return new Promise(function(_0x3169e3,_0xb2fcce){return db[_0x3013('0x1b')][_0x3013('0x1c')]({'raw':_0x1b473d[_0x3013('0x1d')]?_0x1b473d[_0x3013('0x1d')][_0x3013('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b473d[_0x3013('0x1d')]?_0x1b473d[_0x3013('0x1d')][_0x3013('0x1f')]||null:null,'attributes':_0x1b473d['options']?_0x1b473d[_0x3013('0x1d')][_0x3013('0x20')]||null:null,'limit':_0x1b473d['options']?_0x1b473d[_0x3013('0x1d')][_0x3013('0x21')]||null:null,'include':_0x1b473d[_0x3013('0x1d')]?_0x1b473d[_0x3013('0x1d')][_0x3013('0x22')]?_[_0x3013('0x23')](_0x1b473d[_0x3013('0x1d')][_0x3013('0x22')],function(_0x5def30){return{'model':db[_0x5def30[_0x3013('0x24')]],'as':_0x5def30['as'],'attributes':_0x5def30[_0x3013('0x20')],'include':_0x5def30[_0x3013('0x22')]?_['map'](_0x5def30[_0x3013('0x22')],function(_0x4dd3b0){return{'model':db[_0x4dd3b0['model']],'as':_0x4dd3b0['as'],'attributes':_0x4dd3b0['attributes'],'include':_0x4dd3b0[_0x3013('0x22')]?_[_0x3013('0x23')](_0x4dd3b0[_0x3013('0x22')],function(_0xace04b){return{'model':db[_0xace04b[_0x3013('0x24')]],'as':_0xace04b['as'],'attributes':_0xace04b[_0x3013('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3013('0x10')](function(_0x510115){logger[_0x3013('0x11')](_0x3013('0x25'),_0x1b473d);logger[_0x3013('0x14')](_0x3013('0x25'),_0x1b473d,JSON[_0x3013('0x26')](_0x510115));_0x3169e3(_0x510115);})['catch'](function(_0x2643b1){logger[_0x3013('0x16')](_0x3013('0x25'),_0x2643b1[_0x3013('0x18')],_0x1b473d);_0xb2fcce(_0x12a3ea[_0x3013('0x16')](0x1f4,_0x2643b1['message']));});});};exports[_0x3013('0x27')]=function(_0x45d363){var _0x451425=this;return new Promise(function(_0x158289,_0x5d75ff){return db[_0x3013('0x1b')][_0x3013('0x28')]({'raw':_0x45d363[_0x3013('0x1d')]?_0x45d363[_0x3013('0x1d')][_0x3013('0x1e')]===undefined?!![]:![]:!![],'where':_0x45d363[_0x3013('0x1d')]?_0x45d363[_0x3013('0x1d')][_0x3013('0x1f')]||null:null,'attributes':_0x45d363['options']?_0x45d363[_0x3013('0x1d')]['attributes']||null:null,'include':_0x45d363['options']?_0x45d363[_0x3013('0x1d')][_0x3013('0x22')]?_[_0x3013('0x23')](_0x45d363[_0x3013('0x1d')]['include'],function(_0x239e22){return{'model':db[_0x239e22[_0x3013('0x24')]],'as':_0x239e22['as'],'attributes':_0x239e22[_0x3013('0x20')],'include':_0x239e22[_0x3013('0x22')]?_[_0x3013('0x23')](_0x239e22[_0x3013('0x22')],function(_0x4add98){return{'model':db[_0x4add98[_0x3013('0x24')]],'as':_0x4add98['as'],'attributes':_0x4add98[_0x3013('0x20')],'include':_0x4add98['include']?_[_0x3013('0x23')](_0x4add98[_0x3013('0x22')],function(_0x29b1af){return{'model':db[_0x29b1af[_0x3013('0x24')]],'as':_0x29b1af['as'],'attributes':_0x29b1af[_0x3013('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3013('0x10')](function(_0xc72e0b){logger[_0x3013('0x11')](_0x3013('0x27'),_0x45d363);logger[_0x3013('0x14')](_0x3013('0x27'),_0x45d363,JSON['stringify'](_0xc72e0b));_0x158289(_0xc72e0b);})[_0x3013('0x1a')](function(_0x1a435e){logger[_0x3013('0x16')](_0x3013('0x27'),_0x1a435e['message'],_0x45d363);_0x5d75ff(_0x451425[_0x3013('0x16')](0x1f4,_0x1a435e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4bd2a9d..1bba37f 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 _0x7aa8=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x7aa8,0x10c));var _0x87aa=function(_0x379a00,_0x59e6e4){_0x379a00=_0x379a00-0x0;var _0x5329a9=_0x7aa8[_0x379a00];return _0x5329a9;};'use strict';var OpenchannelQueueEvents=require(_0x87aa('0x0'));var events=[_0x87aa('0x1'),_0x87aa('0x2'),_0x87aa('0x3')];function createListener(_0x28c1bc,_0x4c5ffb){return function(_0x437113){_0x4c5ffb[_0x87aa('0x4')](_0x28c1bc,_0x437113);};}function removeListener(_0x57a4f4,_0x13ab17){return function(){OpenchannelQueueEvents['removeListener'](_0x57a4f4,_0x13ab17);};}exports[_0x87aa('0x5')]=function(_0x9a1655){for(var _0x5e380f=0x0,_0x52b55e=events[_0x87aa('0x6')];_0x5e380f<_0x52b55e;_0x5e380f++){var _0x3b1203=events[_0x5e380f];var _0x501f3f=createListener(_0x87aa('0x7')+_0x3b1203,_0x9a1655);OpenchannelQueueEvents['on'](_0x3b1203,_0x501f3f);}}; \ No newline at end of file +var _0x3088=['register','length','./openchannelQueue.events','save','update','emit'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x3088,0xf8));var _0x8308=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x3088[_0x21af3a];return _0x268a49;};'use strict';var OpenchannelQueueEvents=require(_0x8308('0x0'));var events=[_0x8308('0x1'),'remove',_0x8308('0x2')];function createListener(_0x599240,_0x57b493){return function(_0x3c73ad){_0x57b493[_0x8308('0x3')](_0x599240,_0x3c73ad);};}function removeListener(_0x57eaf6,_0x200689){return function(){OpenchannelQueueEvents['removeListener'](_0x57eaf6,_0x200689);};}exports[_0x8308('0x4')]=function(_0x46de0c){for(var _0x5358bd=0x0,_0x4b9fb6=events[_0x8308('0x5')];_0x5358bd<_0x4b9fb6;_0x5358bd++){var _0x3cda36=events[_0x5358bd];var _0x443727=createListener('openchannelQueue:'+_0x3cda36,_0x46de0c);OpenchannelQueueEvents['on'](_0x3cda36,_0x443727);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 4e5ac72..f3d7313 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 _0x6425=['destroy','path','Router','fs-extra','./openchannelQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6425,0xe2));var _0x5642=function(_0x13a67b,_0x1d72d7){_0x13a67b=_0x13a67b-0x0;var _0x5667dc=_0x6425[_0x13a67b];return _0x5667dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5642('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5642('0x1')]();var fs_extra=require(_0x5642('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5642('0x3'));router['get']('/',auth[_0x5642('0x4')](),controller['index']);router['get'](_0x5642('0x5'),auth[_0x5642('0x4')](),controller[_0x5642('0x6')]);router[_0x5642('0x7')](_0x5642('0x8'),auth[_0x5642('0x4')](),controller[_0x5642('0x9')]);router[_0x5642('0xa')]('/',auth[_0x5642('0x4')](),controller[_0x5642('0xb')]);router['put'](_0x5642('0x8'),auth['isAuthenticated'](),controller[_0x5642('0xc')]);router[_0x5642('0xd')](_0x5642('0x8'),auth[_0x5642('0x4')](),controller[_0x5642('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcee6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer'];(function(_0x3f6795,_0x2755c0){var _0x59e760=function(_0x48964f){while(--_0x48964f){_0x3f6795['push'](_0x3f6795['shift']());}};_0x59e760(++_0x2755c0);}(_0xcee6,0x15f));var _0x6cee=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xcee6[_0x49a57c];return _0x4e0316;};'use strict';var multer=require(_0x6cee('0x0'));var util=require(_0x6cee('0x1'));var path=require(_0x6cee('0x2'));var timeout=require(_0x6cee('0x3'));var express=require(_0x6cee('0x4'));var router=express[_0x6cee('0x5')]();var fs_extra=require(_0x6cee('0x6'));var auth=require(_0x6cee('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6cee('0x8'));var controller=require(_0x6cee('0x9'));router[_0x6cee('0xa')]('/',auth[_0x6cee('0xb')](),controller[_0x6cee('0xc')]);router[_0x6cee('0xa')](_0x6cee('0xd'),auth['isAuthenticated'](),controller[_0x6cee('0xe')]);router['get'](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller[_0x6cee('0x10')]);router[_0x6cee('0x11')]('/',auth[_0x6cee('0xb')](),controller[_0x6cee('0x12')]);router[_0x6cee('0x13')](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller['update']);router[_0x6cee('0x14')](_0x6cee('0xf'),auth[_0x6cee('0xb')](),controller['destroy']);module[_0x6cee('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cbd6f5c..8770ab0 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 _0x266d=['DATE','STRING','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x266d,0x152));var _0xd266=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x266d[_0x19950b];return _0x3c6b41;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd266('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd266('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd266('0x2')]}}; \ No newline at end of file +var _0xf5cd=['sequelize','exports','STRING','DATE','moment'];(function(_0x31ec45,_0x1efeae){var _0x333996=function(_0x43f82f){while(--_0x43f82f){_0x31ec45['push'](_0x31ec45['shift']());}};_0x333996(++_0x1efeae);}(_0xf5cd,0xea));var _0xdf5c=function(_0x57ba94,_0xe1fdaf){_0x57ba94=_0x57ba94-0x0;var _0x2a414e=_0xf5cd[_0x57ba94];return _0x2a414e;};'use strict';var moment=require(_0xdf5c('0x0'));var Sequelize=require(_0xdf5c('0x1'));module[_0xdf5c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf5c('0x3')]},'joinAt':{'type':Sequelize[_0xdf5c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdf5c('0x4')]},'exitAt':{'type':Sequelize[_0xdf5c('0x4')]},'reason':{'type':Sequelize[_0xdf5c('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 4e2151d..bb6b772 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 _0x2033=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','keys','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3ad527,_0x55b741){var _0x2d7bcc=function(_0x1492a6){while(--_0x1492a6){_0x3ad527['push'](_0x3ad527['shift']());}};_0x2d7bcc(++_0x55b741);}(_0x2033,0x183));var _0x3203=function(_0x3fe0fe,_0x3bdc49){_0x3fe0fe=_0x3fe0fe-0x0;var _0x5c11f4=_0x2033[_0x3fe0fe];return _0x5c11f4;};'use strict';var emlformat=require(_0x3203('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3203('0x1'));var rp=require(_0x3203('0x2'));var moment=require(_0x3203('0x3'));var BPromise=require(_0x3203('0x4'));var Mustache=require(_0x3203('0x5'));var util=require(_0x3203('0x6'));var path=require(_0x3203('0x7'));var sox=require('sox');var csv=require(_0x3203('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3203('0x9'));var squel=require(_0x3203('0xa'));var crypto=require(_0x3203('0xb'));var jsforce=require(_0x3203('0xc'));var deskjs=require(_0x3203('0xd'));var toCsv=require(_0x3203('0x8'));var querystring=require(_0x3203('0xe'));var Papa=require(_0x3203('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3203('0x10'));var as=require(_0x3203('0x11'));var hardwareService=require(_0x3203('0x12'));var logger=require(_0x3203('0x13'))('api');var utils=require(_0x3203('0x14'));var config=require(_0x3203('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3203('0x16'))['db'];function respondWithStatusCode(_0x2e7cdc,_0x4b2d91){_0x4b2d91=_0x4b2d91||0xcc;return function(_0x5a9d59){if(_0x5a9d59){return _0x2e7cdc[_0x3203('0x17')](_0x4b2d91);}return _0x2e7cdc[_0x3203('0x18')](_0x4b2d91)[_0x3203('0x19')]();};}function respondWithResult(_0x3f88f2,_0x24b3b3){_0x24b3b3=_0x24b3b3||0xc8;return function(_0x53d5fd){if(_0x53d5fd){return _0x3f88f2[_0x3203('0x18')](_0x24b3b3)[_0x3203('0x1a')](_0x53d5fd);}};}function respondWithFilteredResult(_0x46cbd5,_0x30f7ce){return function(_0x15ef0e){if(_0x15ef0e){var _0x429902=typeof _0x30f7ce[_0x3203('0x1b')]===_0x3203('0x1c')&&typeof _0x30f7ce[_0x3203('0x1d')]===_0x3203('0x1c');var _0x143698=_0x15ef0e[_0x3203('0x1e')];var _0x187e63=_0x429902?0x0:_0x30f7ce[_0x3203('0x1b')];var _0x45f231=_0x429902?_0x15ef0e[_0x3203('0x1e')]:_0x30f7ce['offset']+_0x30f7ce[_0x3203('0x1d')];var _0x355ca3;if(_0x45f231>=_0x143698){_0x45f231=_0x143698;_0x355ca3=0xc8;}else{_0x355ca3=0xce;}_0x46cbd5[_0x3203('0x18')](_0x355ca3);return _0x46cbd5[_0x3203('0x1f')](_0x3203('0x20'),_0x187e63+'-'+_0x45f231+'/'+_0x143698)[_0x3203('0x1a')](_0x15ef0e);}return null;};}function patchUpdates(_0x51aca0){return function(_0x1e142a){try{jsonpatch[_0x3203('0x21')](_0x1e142a,_0x51aca0,!![]);}catch(_0x3c8eaa){return BPromise['reject'](_0x3c8eaa);}return _0x1e142a[_0x3203('0x22')]();};}function saveUpdates(_0x89ec95,_0x39ac9c){return function(_0x5a2a32){if(_0x5a2a32){return _0x5a2a32[_0x3203('0x23')](_0x89ec95)[_0x3203('0x24')](function(_0x161adc){return _0x161adc;});}return null;};}function removeEntity(_0x38ecc4,_0x1bba18){return function(_0x47b917){if(_0x47b917){return _0x47b917['destroy']()['then'](function(){_0x38ecc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc96b41,_0x47d23b){return function(_0xc362a7){if(!_0xc362a7){_0xc96b41[_0x3203('0x17')](0x194);}return _0xc362a7;};}function handleError(_0xd8503f,_0x1b563a){_0x1b563a=_0x1b563a||0x1f4;return function(_0x5cae57){logger['error'](_0x5cae57[_0x3203('0x25')]);if(_0x5cae57[_0x3203('0x26')]){delete _0x5cae57[_0x3203('0x26')];}_0xd8503f[_0x3203('0x18')](_0x1b563a)[_0x3203('0x27')](_0x5cae57);};}exports['index']=function(_0x52326c,_0x5a28cd){var _0x36c87c={},_0x579fd5={},_0x1c7429={'count':0x0,'rows':[]};var _0x295152=_[_0x3203('0x28')](db[_0x3203('0x29')][_0x3203('0x2a')],function(_0x4e9ff2){return{'name':_0x4e9ff2['fieldName'],'type':_0x4e9ff2[_0x3203('0x2b')][_0x3203('0x2c')]};});_0x579fd5[_0x3203('0x2d')]=_['map'](_0x295152,'name');_0x579fd5[_0x3203('0x2e')]=_['keys'](_0x52326c['query']);_0x579fd5[_0x3203('0x2f')]=_[_0x3203('0x30')](_0x579fd5[_0x3203('0x2d')],_0x579fd5['query']);_0x36c87c[_0x3203('0x31')]=_[_0x3203('0x30')](_0x579fd5['model'],qs[_0x3203('0x32')](_0x52326c[_0x3203('0x2e')][_0x3203('0x32')]));_0x36c87c[_0x3203('0x31')]=_0x36c87c[_0x3203('0x31')][_0x3203('0x33')]?_0x36c87c[_0x3203('0x31')]:_0x579fd5['model'];if(!_0x52326c[_0x3203('0x2e')]['hasOwnProperty']('nolimit')){_0x36c87c['limit']=qs[_0x3203('0x1d')](_0x52326c['query'][_0x3203('0x1d')]);_0x36c87c[_0x3203('0x1b')]=qs[_0x3203('0x1b')](_0x52326c['query'][_0x3203('0x1b')]);}_0x36c87c[_0x3203('0x34')]=qs[_0x3203('0x35')](_0x52326c[_0x3203('0x2e')][_0x3203('0x35')]);_0x36c87c[_0x3203('0x36')]=qs[_0x3203('0x2f')](_[_0x3203('0x37')](_0x52326c['query'],_0x579fd5[_0x3203('0x2f')]),_0x295152);if(_0x52326c['query'][_0x3203('0x38')]){_0x36c87c[_0x3203('0x36')]=_[_0x3203('0x39')](_0x36c87c[_0x3203('0x36')],{'$or':_[_0x3203('0x28')](_0x295152,function(_0x29e843){if(_0x29e843[_0x3203('0x2b')]!=='VIRTUAL'){var _0x3e6337={};_0x3e6337[_0x29e843[_0x3203('0x26')]]={'$like':'%'+_0x52326c[_0x3203('0x2e')][_0x3203('0x38')]+'%'};return _0x3e6337;}})});}_0x36c87c=_[_0x3203('0x39')]({},_0x36c87c,_0x52326c['options']);var _0x55b69b={'where':_0x36c87c[_0x3203('0x36')]};return db[_0x3203('0x29')][_0x3203('0x1e')](_0x55b69b)[_0x3203('0x24')](function(_0x118b37){_0x1c7429[_0x3203('0x1e')]=_0x118b37;if(_0x52326c[_0x3203('0x2e')][_0x3203('0x3a')]){_0x36c87c[_0x3203('0x3b')]=[{'all':!![]}];}return db[_0x3203('0x29')][_0x3203('0x3c')](_0x36c87c);})[_0x3203('0x24')](function(_0x52aa5c){_0x1c7429['rows']=_0x52aa5c;return _0x1c7429;})[_0x3203('0x24')](respondWithFilteredResult(_0x5a28cd,_0x36c87c))[_0x3203('0x3d')](handleError(_0x5a28cd,null));};exports['show']=function(_0x44b19f,_0x5e1a10){var _0x2a5a9d={'raw':!![],'where':{'id':_0x44b19f[_0x3203('0x3e')]['id']}},_0x38dd95={};_0x38dd95[_0x3203('0x2d')]=_['keys'](db[_0x3203('0x29')][_0x3203('0x2a')]);_0x38dd95['query']=_[_0x3203('0x3f')](_0x44b19f['query']);_0x38dd95[_0x3203('0x2f')]=_[_0x3203('0x30')](_0x38dd95[_0x3203('0x2d')],_0x38dd95[_0x3203('0x2e')]);_0x2a5a9d[_0x3203('0x31')]=_['intersection'](_0x38dd95[_0x3203('0x2d')],qs[_0x3203('0x32')](_0x44b19f[_0x3203('0x2e')]['fields']));_0x2a5a9d[_0x3203('0x31')]=_0x2a5a9d[_0x3203('0x31')][_0x3203('0x33')]?_0x2a5a9d[_0x3203('0x31')]:_0x38dd95[_0x3203('0x2d')];if(_0x44b19f[_0x3203('0x2e')][_0x3203('0x3a')]){_0x2a5a9d[_0x3203('0x3b')]=[{'all':!![]}];}_0x2a5a9d=_[_0x3203('0x39')]({},_0x2a5a9d,_0x44b19f[_0x3203('0x40')]);return db[_0x3203('0x29')][_0x3203('0x41')](_0x2a5a9d)[_0x3203('0x24')](handleEntityNotFound(_0x5e1a10,null))[_0x3203('0x24')](respondWithResult(_0x5e1a10,null))[_0x3203('0x3d')](handleError(_0x5e1a10,null));};exports['create']=function(_0x499e5c,_0x29af03){return db[_0x3203('0x29')][_0x3203('0x42')](_0x499e5c['body'],{})[_0x3203('0x24')](respondWithResult(_0x29af03,0xc9))[_0x3203('0x3d')](handleError(_0x29af03,null));};exports[_0x3203('0x23')]=function(_0x24260a,_0x4b5d5e){if(_0x24260a['body']['id']){delete _0x24260a['body']['id'];}return db[_0x3203('0x29')][_0x3203('0x41')]({'where':{'id':_0x24260a[_0x3203('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b5d5e,null))[_0x3203('0x24')](saveUpdates(_0x24260a[_0x3203('0x43')],null))[_0x3203('0x24')](respondWithResult(_0x4b5d5e,null))[_0x3203('0x3d')](handleError(_0x4b5d5e,null));};exports['destroy']=function(_0x317809,_0x3ea040){return db[_0x3203('0x29')][_0x3203('0x41')]({'where':{'id':_0x317809[_0x3203('0x3e')]['id']}})[_0x3203('0x24')](handleEntityNotFound(_0x3ea040,null))[_0x3203('0x24')](removeEntity(_0x3ea040,null))['catch'](handleError(_0x3ea040,null));};exports['describe']=function(_0x145f46,_0x3e1769){return db['OpenchannelQueueReport']['describe']()[_0x3203('0x24')](respondWithResult(_0x3e1769,null))[_0x3203('0x3d')](handleError(_0x3e1769,null));}; \ No newline at end of file +var _0xf3de=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xf3de,0x199));var _0xef3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3de[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xef3d('0x0'));var rimraf=require(_0xef3d('0x1'));var zipdir=require(_0xef3d('0x2'));var jsonpatch=require(_0xef3d('0x3'));var rp=require(_0xef3d('0x4'));var moment=require(_0xef3d('0x5'));var BPromise=require(_0xef3d('0x6'));var Mustache=require(_0xef3d('0x7'));var util=require(_0xef3d('0x8'));var path=require(_0xef3d('0x9'));var sox=require('sox');var csv=require(_0xef3d('0xa'));var ejs=require(_0xef3d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef3d('0xc'));var squel=require(_0xef3d('0xd'));var crypto=require(_0xef3d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xef3d('0xf'));var toCsv=require(_0xef3d('0xa'));var querystring=require(_0xef3d('0x10'));var Papa=require(_0xef3d('0x11'));var Redis=require('ioredis');var authService=require(_0xef3d('0x12'));var qs=require(_0xef3d('0x13'));var as=require(_0xef3d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef3d('0x15'))('api');var utils=require(_0xef3d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xef3d('0x17'));var db=require(_0xef3d('0x18'))['db'];function respondWithStatusCode(_0x3b0d20,_0x29f00){_0x29f00=_0x29f00||0xcc;return function(_0x2a7efa){if(_0x2a7efa){return _0x3b0d20[_0xef3d('0x19')](_0x29f00);}return _0x3b0d20[_0xef3d('0x1a')](_0x29f00)[_0xef3d('0x1b')]();};}function respondWithResult(_0x3e21fe,_0xc6f9ba){_0xc6f9ba=_0xc6f9ba||0xc8;return function(_0x5309b7){if(_0x5309b7){return _0x3e21fe[_0xef3d('0x1a')](_0xc6f9ba)[_0xef3d('0x1c')](_0x5309b7);}};}function respondWithFilteredResult(_0x3dccdb,_0x4b394d){return function(_0x456b26){if(_0x456b26){var _0xcc4508=typeof _0x4b394d['offset']===_0xef3d('0x1d')&&typeof _0x4b394d[_0xef3d('0x1e')]===_0xef3d('0x1d');var _0x7518f9=_0x456b26[_0xef3d('0x1f')];var _0x49bacb=_0xcc4508?0x0:_0x4b394d[_0xef3d('0x20')];var _0x13dc89=_0xcc4508?_0x456b26[_0xef3d('0x1f')]:_0x4b394d[_0xef3d('0x20')]+_0x4b394d[_0xef3d('0x1e')];var _0x2f8b9a;if(_0x13dc89>=_0x7518f9){_0x13dc89=_0x7518f9;_0x2f8b9a=0xc8;}else{_0x2f8b9a=0xce;}_0x3dccdb[_0xef3d('0x1a')](_0x2f8b9a);return _0x3dccdb[_0xef3d('0x21')](_0xef3d('0x22'),_0x49bacb+'-'+_0x13dc89+'/'+_0x7518f9)[_0xef3d('0x1c')](_0x456b26);}return null;};}function patchUpdates(_0x34affd){return function(_0x4d8576){try{jsonpatch[_0xef3d('0x23')](_0x4d8576,_0x34affd,!![]);}catch(_0x1b1914){return BPromise[_0xef3d('0x24')](_0x1b1914);}return _0x4d8576['save']();};}function saveUpdates(_0x53adb6,_0x1134d6){return function(_0x451401){if(_0x451401){return _0x451401[_0xef3d('0x25')](_0x53adb6)[_0xef3d('0x26')](function(_0x288335){return _0x288335;});}return null;};}function removeEntity(_0x184aaf,_0x174445){return function(_0x3df34e){if(_0x3df34e){return _0x3df34e[_0xef3d('0x27')]()[_0xef3d('0x26')](function(){_0x184aaf[_0xef3d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ef6b,_0x4a92b9){return function(_0x25085f){if(!_0x25085f){_0x36ef6b[_0xef3d('0x19')](0x194);}return _0x25085f;};}function handleError(_0x4164fb,_0x194da1){_0x194da1=_0x194da1||0x1f4;return function(_0x5a55bc){logger[_0xef3d('0x28')](_0x5a55bc[_0xef3d('0x29')]);if(_0x5a55bc[_0xef3d('0x2a')]){delete _0x5a55bc[_0xef3d('0x2a')];}_0x4164fb[_0xef3d('0x1a')](_0x194da1)[_0xef3d('0x2b')](_0x5a55bc);};}exports[_0xef3d('0x2c')]=function(_0x53c3c9,_0x4a5a8b){var _0x2689f8={},_0x4773ea={},_0x383f03={'count':0x0,'rows':[]};var _0x3047ab=_[_0xef3d('0x2d')](db['OpenchannelQueueReport'][_0xef3d('0x2e')],function(_0x54b7d2){return{'name':_0x54b7d2['fieldName'],'type':_0x54b7d2[_0xef3d('0x2f')][_0xef3d('0x30')]};});_0x4773ea[_0xef3d('0x31')]=_[_0xef3d('0x2d')](_0x3047ab,_0xef3d('0x2a'));_0x4773ea[_0xef3d('0x32')]=_[_0xef3d('0x33')](_0x53c3c9[_0xef3d('0x32')]);_0x4773ea[_0xef3d('0x34')]=_[_0xef3d('0x35')](_0x4773ea[_0xef3d('0x31')],_0x4773ea[_0xef3d('0x32')]);_0x2689f8['attributes']=_[_0xef3d('0x35')](_0x4773ea['model'],qs[_0xef3d('0x36')](_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x36')]));_0x2689f8[_0xef3d('0x37')]=_0x2689f8['attributes'][_0xef3d('0x38')]?_0x2689f8[_0xef3d('0x37')]:_0x4773ea['model'];if(!_0x53c3c9['query'][_0xef3d('0x39')](_0xef3d('0x3a'))){_0x2689f8[_0xef3d('0x1e')]=qs[_0xef3d('0x1e')](_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x1e')]);_0x2689f8['offset']=qs['offset'](_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x20')]);}_0x2689f8[_0xef3d('0x3b')]=qs[_0xef3d('0x3c')](_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x3c')]);_0x2689f8[_0xef3d('0x3d')]=qs['filters'](_['pick'](_0x53c3c9[_0xef3d('0x32')],_0x4773ea[_0xef3d('0x34')]),_0x3047ab);if(_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x3e')]){_0x2689f8[_0xef3d('0x3d')]=_[_0xef3d('0x3f')](_0x2689f8['where'],{'$or':_[_0xef3d('0x2d')](_0x3047ab,function(_0x3d3f2c){if(_0x3d3f2c[_0xef3d('0x2f')]!==_0xef3d('0x40')){var _0x1a3885={};_0x1a3885[_0x3d3f2c[_0xef3d('0x2a')]]={'$like':'%'+_0x53c3c9[_0xef3d('0x32')][_0xef3d('0x3e')]+'%'};return _0x1a3885;}})});}_0x2689f8=_[_0xef3d('0x3f')]({},_0x2689f8,_0x53c3c9[_0xef3d('0x41')]);var _0x41e7d8={'where':_0x2689f8[_0xef3d('0x3d')]};return db[_0xef3d('0x42')][_0xef3d('0x1f')](_0x41e7d8)[_0xef3d('0x26')](function(_0x55d2c6){_0x383f03[_0xef3d('0x1f')]=_0x55d2c6;if(_0x53c3c9[_0xef3d('0x32')]['includeAll']){_0x2689f8[_0xef3d('0x43')]=[{'all':!![]}];}return db[_0xef3d('0x42')][_0xef3d('0x44')](_0x2689f8);})['then'](function(_0x523593){_0x383f03[_0xef3d('0x45')]=_0x523593;return _0x383f03;})['then'](respondWithFilteredResult(_0x4a5a8b,_0x2689f8))[_0xef3d('0x46')](handleError(_0x4a5a8b,null));};exports['show']=function(_0x5bcc42,_0xd50a80){var _0x4e7482={'raw':!![],'where':{'id':_0x5bcc42[_0xef3d('0x47')]['id']}},_0x3b7c37={};_0x3b7c37[_0xef3d('0x31')]=_['keys'](db['OpenchannelQueueReport'][_0xef3d('0x2e')]);_0x3b7c37[_0xef3d('0x32')]=_[_0xef3d('0x33')](_0x5bcc42[_0xef3d('0x32')]);_0x3b7c37[_0xef3d('0x34')]=_[_0xef3d('0x35')](_0x3b7c37[_0xef3d('0x31')],_0x3b7c37[_0xef3d('0x32')]);_0x4e7482[_0xef3d('0x37')]=_[_0xef3d('0x35')](_0x3b7c37[_0xef3d('0x31')],qs[_0xef3d('0x36')](_0x5bcc42['query']['fields']));_0x4e7482[_0xef3d('0x37')]=_0x4e7482[_0xef3d('0x37')][_0xef3d('0x38')]?_0x4e7482['attributes']:_0x3b7c37[_0xef3d('0x31')];if(_0x5bcc42['query'][_0xef3d('0x48')]){_0x4e7482['include']=[{'all':!![]}];}_0x4e7482=_['merge']({},_0x4e7482,_0x5bcc42[_0xef3d('0x41')]);return db[_0xef3d('0x42')][_0xef3d('0x49')](_0x4e7482)[_0xef3d('0x26')](handleEntityNotFound(_0xd50a80,null))[_0xef3d('0x26')](respondWithResult(_0xd50a80,null))[_0xef3d('0x46')](handleError(_0xd50a80,null));};exports[_0xef3d('0x4a')]=function(_0x342334,_0x334166){return db[_0xef3d('0x42')][_0xef3d('0x4a')](_0x342334['body'],{})[_0xef3d('0x26')](respondWithResult(_0x334166,0xc9))[_0xef3d('0x46')](handleError(_0x334166,null));};exports['update']=function(_0x411594,_0xba311f){if(_0x411594[_0xef3d('0x4b')]['id']){delete _0x411594['body']['id'];}return db['OpenchannelQueueReport'][_0xef3d('0x49')]({'where':{'id':_0x411594[_0xef3d('0x47')]['id']}})[_0xef3d('0x26')](handleEntityNotFound(_0xba311f,null))[_0xef3d('0x26')](saveUpdates(_0x411594[_0xef3d('0x4b')],null))[_0xef3d('0x26')](respondWithResult(_0xba311f,null))[_0xef3d('0x46')](handleError(_0xba311f,null));};exports[_0xef3d('0x27')]=function(_0x4025a6,_0x46c325){return db[_0xef3d('0x42')][_0xef3d('0x49')]({'where':{'id':_0x4025a6['params']['id']}})[_0xef3d('0x26')](handleEntityNotFound(_0x46c325,null))[_0xef3d('0x26')](removeEntity(_0x46c325,null))[_0xef3d('0x46')](handleError(_0x46c325,null));};exports[_0xef3d('0x4c')]=function(_0x15197b,_0x17d8b9){return db[_0xef3d('0x42')][_0xef3d('0x4c')]()[_0xef3d('0x26')](respondWithResult(_0x17d8b9,null))[_0xef3d('0x46')](handleError(_0x17d8b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7967d51..1e2b549 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x2ef3,0xba));var _0x32ef=function(_0x47f695,_0x5b40b4){_0x47f695=_0x47f695-0x0;var _0x42cf38=_0x2ef3[_0x47f695];return _0x42cf38;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x3b0bee,_0x2549a5){var _0x1669ef=function(_0x217a30){while(--_0x217a30){_0x3b0bee['push'](_0x3b0bee['shift']());}};_0x1669ef(++_0x2549a5);}(_0x1261,0x144));var _0x1126=function(_0x52d5df,_0x3a6baa){_0x52d5df=_0x52d5df-0x0;var _0x374a89=_0x1261[_0x52d5df];return _0x374a89;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 12524df..8dac4d8 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 _0x056b=['CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','update','body','where','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5784f8,_0xe8e660){var _0x26c731=function(_0x54ddfa){while(--_0x54ddfa){_0x5784f8['push'](_0x5784f8['shift']());}};_0x26c731(++_0xe8e660);}(_0x056b,0xb6));var _0xb056=function(_0x8d2a71,_0x13618e){_0x8d2a71=_0x8d2a71-0x0;var _0x36ba8c=_0x056b[_0x8d2a71];return _0x36ba8c;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});}exports[_0xb056('0x16')]=function(_0x311eb9){var _0x48e140=this;return new Promise(function(_0x29c77e,_0x4c57e6){return db[_0xb056('0x17')][_0xb056('0x18')](_0x311eb9['body'],{'raw':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1a')]===undefined?!![]:![]:!![]})[_0xb056('0x1b')](function(_0x457b54){logger[_0xb056('0xc')]('CreateOpenchannelQueueReport',_0x311eb9);logger[_0xb056('0x1c')]('CreateOpenchannelQueueReport',_0x311eb9,JSON[_0xb056('0x10')](_0x457b54));_0x29c77e(_0x457b54);})['catch'](function(_0x324ce6){logger[_0xb056('0x11')](_0xb056('0x16'),_0x324ce6[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x324ce6[_0xb056('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1016da){var _0x18a3f2=this;return new Promise(function(_0x341544,_0x1bd6ac){return db['OpenchannelQueueReport'][_0xb056('0x1d')](_0x1016da[_0xb056('0x1e')],{'raw':_0x1016da['options']?_0x1016da[_0xb056('0x19')][_0xb056('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1016da[_0xb056('0x19')]?_0x1016da[_0xb056('0x19')][_0xb056('0x1f')]||null:null,'attributes':_0x1016da[_0xb056('0x19')]?_0x1016da[_0xb056('0x19')][_0xb056('0x20')]||null:null,'limit':_0x1016da['options']?_0x1016da[_0xb056('0x19')]['limit']||null:null})[_0xb056('0x1b')](function(_0x9c6f4a){logger[_0xb056('0xc')]('UpdateOpenchannelQueueReport',_0x1016da);logger[_0xb056('0x1c')](_0xb056('0x21'),_0x1016da,JSON['stringify'](_0x9c6f4a));_0x341544(_0x9c6f4a);})[_0xb056('0x15')](function(_0x43aa63){logger[_0xb056('0x11')](_0xb056('0x21'),_0x43aa63[_0xb056('0x13')],_0x1016da);_0x1bd6ac(_0x18a3f2['error'](0x1f4,_0x43aa63[_0xb056('0x13')]));});});}; \ No newline at end of file +var _0x96f2=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateOpenchannelQueueReport','create','body','options','stringify','update','raw','attributes','limit','UpdateOpenchannelQueueReport','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x2874a5,_0x32b680){var _0x1e427a=function(_0x550897){while(--_0x550897){_0x2874a5['push'](_0x2874a5['shift']());}};_0x1e427a(++_0x32b680);}(_0x96f2,0xb0));var _0x296f=function(_0x2ed0d8,_0x1bfb89){_0x2ed0d8=_0x2ed0d8-0x0;var _0x3826a1=_0x96f2[_0x2ed0d8];return _0x3826a1;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var moment=require(_0x296f('0x1'));var BPromise=require(_0x296f('0x2'));var rs=require(_0x296f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x296f('0x4'))['db'];var utils=require(_0x296f('0x5'));var logger=require(_0x296f('0x6'))('rpc');var config=require(_0x296f('0x7'));var jayson=require(_0x296f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x164031,_0x1d019f,_0x2dc0ca){return new BPromise(function(_0x28f708,_0x30ed43){return client[_0x296f('0x9')](_0x164031,_0x2dc0ca)[_0x296f('0xa')](function(_0x3ea699){logger[_0x296f('0xb')](_0x296f('0xc'),_0x1d019f,'request\x20sent');logger[_0x296f('0xd')](_0x296f('0xe'),_0x1d019f,_0x296f('0xf'),JSON['stringify'](_0x3ea699));if(_0x3ea699[_0x296f('0x10')]){if(_0x3ea699[_0x296f('0x10')][_0x296f('0x11')]===0x1f4){logger[_0x296f('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1d019f,_0x3ea699['error']['message']);return _0x30ed43(_0x3ea699[_0x296f('0x10')][_0x296f('0x12')]);}logger[_0x296f('0x10')](_0x296f('0xc'),_0x1d019f,_0x3ea699['error'][_0x296f('0x12')]);return _0x28f708(_0x3ea699['error']['message']);}else{logger[_0x296f('0xb')](_0x296f('0xc'),_0x1d019f,_0x296f('0xf'));_0x28f708(_0x3ea699[_0x296f('0x13')]['message']);}})['catch'](function(_0x3e3860){logger['error'](_0x296f('0xc'),_0x1d019f,_0x3e3860);_0x30ed43(_0x3e3860);});});}exports[_0x296f('0x14')]=function(_0xfc0b87){var _0x48725e=this;return new Promise(function(_0xcc2b48,_0x3b7db8){return db['OpenchannelQueueReport'][_0x296f('0x15')](_0xfc0b87[_0x296f('0x16')],{'raw':_0xfc0b87[_0x296f('0x17')]?_0xfc0b87[_0x296f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x296f('0xa')](function(_0x474721){logger[_0x296f('0xb')]('CreateOpenchannelQueueReport',_0xfc0b87);logger[_0x296f('0xd')](_0x296f('0x14'),_0xfc0b87,JSON[_0x296f('0x18')](_0x474721));_0xcc2b48(_0x474721);})['catch'](function(_0x2a9a1c){logger[_0x296f('0x10')](_0x296f('0x14'),_0x2a9a1c['message'],_0xfc0b87);_0x3b7db8(_0x48725e['error'](0x1f4,_0x2a9a1c[_0x296f('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x54a0af){var _0xf39fb=this;return new Promise(function(_0x513d59,_0x4ab133){return db['OpenchannelQueueReport'][_0x296f('0x19')](_0x54a0af[_0x296f('0x16')],{'raw':_0x54a0af[_0x296f('0x17')]?_0x54a0af[_0x296f('0x17')][_0x296f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a0af[_0x296f('0x17')]?_0x54a0af['options']['where']||null:null,'attributes':_0x54a0af[_0x296f('0x17')]?_0x54a0af['options'][_0x296f('0x1b')]||null:null,'limit':_0x54a0af[_0x296f('0x17')]?_0x54a0af[_0x296f('0x17')][_0x296f('0x1c')]||null:null})[_0x296f('0xa')](function(_0x28d624){logger['info'](_0x296f('0x1d'),_0x54a0af);logger['debug'](_0x296f('0x1d'),_0x54a0af,JSON[_0x296f('0x18')](_0x28d624));_0x513d59(_0x28d624);})[_0x296f('0x1e')](function(_0x3aa271){logger[_0x296f('0x10')](_0x296f('0x1d'),_0x3aa271[_0x296f('0x12')],_0x54a0af);_0x4ab133(_0xf39fb[_0x296f('0x10')](0x1f4,_0x3aa271[_0x296f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a041d51..c0a93ee 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 _0x48cb=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x48cb,0x92));var _0xb48c=function(_0x407ebf,_0x2b47f5){_0x407ebf=_0x407ebf-0x0;var _0x29d7db=_0x48cb[_0x407ebf];return _0x29d7db;};'use strict';var multer=require('multer');var util=require(_0xb48c('0x0'));var path=require('path');var timeout=require(_0xb48c('0x1'));var express=require(_0xb48c('0x2'));var router=express[_0xb48c('0x3')]();var fs_extra=require(_0xb48c('0x4'));var auth=require(_0xb48c('0x5'));var interaction=require(_0xb48c('0x6'));var config=require(_0xb48c('0x7'));var controller=require(_0xb48c('0x8'));router[_0xb48c('0x9')]('/',auth[_0xb48c('0xa')](),controller[_0xb48c('0xb')]);router['get'](_0xb48c('0xc'),auth[_0xb48c('0xa')](),controller[_0xb48c('0xd')]);router['get'](_0xb48c('0xe'),auth[_0xb48c('0xa')](),controller[_0xb48c('0xf')]);router[_0xb48c('0x10')]('/',auth[_0xb48c('0xa')](),controller[_0xb48c('0x11')]);router[_0xb48c('0x12')]('/:id',auth[_0xb48c('0xa')](),controller[_0xb48c('0x13')]);router[_0xb48c('0x14')](_0xb48c('0xe'),auth[_0xb48c('0xa')](),controller[_0xb48c('0x15')]);module[_0xb48c('0x16')]=router; \ No newline at end of file +var _0x5001=['path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x332aa8,_0x6af55e){var _0x4c9335=function(_0x2da343){while(--_0x2da343){_0x332aa8['push'](_0x332aa8['shift']());}};_0x4c9335(++_0x6af55e);}(_0x5001,0xec));var _0x1500=function(_0x488f43,_0x49eed8){_0x488f43=_0x488f43-0x0;var _0x3b8eba=_0x5001[_0x488f43];return _0x3b8eba;};'use strict';var multer=require(_0x1500('0x0'));var util=require(_0x1500('0x1'));var path=require(_0x1500('0x2'));var timeout=require(_0x1500('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1500('0x4'));var config=require(_0x1500('0x5'));var controller=require(_0x1500('0x6'));router[_0x1500('0x7')]('/',auth[_0x1500('0x8')](),controller[_0x1500('0x9')]);router[_0x1500('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1500('0x7')]('/:id',auth[_0x1500('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1500('0xa')]);router[_0x1500('0xb')](_0x1500('0xc'),auth['isAuthenticated'](),controller[_0x1500('0xd')]);router[_0x1500('0xe')](_0x1500('0xc'),auth[_0x1500('0x8')](),controller[_0x1500('0xf')]);module[_0x1500('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index dfea2ac..1a5ce2e 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1fc0d9,_0x1f2b63){var _0x5ef087=function(_0x3706b6){while(--_0x3706b6){_0x1fc0d9['push'](_0x1fc0d9['shift']());}};_0x5ef087(++_0x1f2b63);}(_0x70e0,0x17b));var _0x070e=function(_0x21e42a,_0x5ab66d){_0x21e42a=_0x21e42a-0x0;var _0x46a34f=_0x70e0[_0x21e42a];return _0x46a34f;};'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(_0x1f5f80,_0x479a4a){var _0x423e20=function(_0x25a8b9){while(--_0x25a8b9){_0x1f5f80['push'](_0x1f5f80['shift']());}};_0x423e20(++_0x479a4a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0xf3cd[_0x3df517];return _0x25ddd5;};'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 787a4dd..354190a 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 _0x9695=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','describe','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','type','key'];(function(_0x174caf,_0xae1c98){var _0x19ed15=function(_0x46b844){while(--_0x46b844){_0x174caf['push'](_0x174caf['shift']());}};_0x19ed15(++_0xae1c98);}(_0x9695,0x139));var _0x5969=function(_0x425756,_0x46ac8b){_0x425756=_0x425756-0x0;var _0x53e534=_0x9695[_0x425756];return _0x53e534;};'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(_0x5969('0x0'));var moment=require(_0x5969('0x1'));var BPromise=require(_0x5969('0x2'));var Mustache=require(_0x5969('0x3'));var util=require(_0x5969('0x4'));var path=require(_0x5969('0x5'));var sox=require(_0x5969('0x6'));var csv=require(_0x5969('0x7'));var ejs=require(_0x5969('0x8'));var fs=require('fs');var fs_extra=require(_0x5969('0x9'));var _=require('lodash');var squel=require(_0x5969('0xa'));var crypto=require(_0x5969('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5969('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5969('0xd'));var Papa=require(_0x5969('0xe'));var Redis=require(_0x5969('0xf'));var authService=require(_0x5969('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5969('0x11'));var hardwareService=require(_0x5969('0x12'));var logger=require(_0x5969('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5969('0x14'));var db=require(_0x5969('0x15'))['db'];function respondWithStatusCode(_0x299734,_0xba16f8){_0xba16f8=_0xba16f8||0xcc;return function(_0x7afe58){if(_0x7afe58){return _0x299734[_0x5969('0x16')](_0xba16f8);}return _0x299734[_0x5969('0x17')](_0xba16f8)[_0x5969('0x18')]();};}function respondWithResult(_0x53132f,_0x311e7f){_0x311e7f=_0x311e7f||0xc8;return function(_0x2de56d){if(_0x2de56d){return _0x53132f[_0x5969('0x17')](_0x311e7f)[_0x5969('0x19')](_0x2de56d);}};}function respondWithFilteredResult(_0x682259,_0x52424b){return function(_0x21a1fa){if(_0x21a1fa){var _0x1dca07=typeof _0x52424b[_0x5969('0x1a')]===_0x5969('0x1b')&&typeof _0x52424b['limit']===_0x5969('0x1b');var _0x2f5d85=_0x21a1fa[_0x5969('0x1c')];var _0x1fdd77=_0x1dca07?0x0:_0x52424b[_0x5969('0x1a')];var _0x2b6db3=_0x1dca07?_0x21a1fa['count']:_0x52424b[_0x5969('0x1a')]+_0x52424b['limit'];var _0x167ff7;if(_0x2b6db3>=_0x2f5d85){_0x2b6db3=_0x2f5d85;_0x167ff7=0xc8;}else{_0x167ff7=0xce;}_0x682259[_0x5969('0x17')](_0x167ff7);return _0x682259[_0x5969('0x1d')]('Content-Range',_0x1fdd77+'-'+_0x2b6db3+'/'+_0x2f5d85)[_0x5969('0x19')](_0x21a1fa);}return null;};}function patchUpdates(_0x4639d5){return function(_0x504c74){try{jsonpatch['apply'](_0x504c74,_0x4639d5,!![]);}catch(_0x170c2d){return BPromise[_0x5969('0x1e')](_0x170c2d);}return _0x504c74['save']();};}function saveUpdates(_0x162035,_0x5ccc00){return function(_0x2a400b){if(_0x2a400b){return _0x2a400b[_0x5969('0x1f')](_0x162035)[_0x5969('0x20')](function(_0x557d6d){return _0x557d6d;});}return null;};}function removeEntity(_0x4d0513,_0x2f7c9c){return function(_0x2c94f7){if(_0x2c94f7){return _0x2c94f7[_0x5969('0x21')]()[_0x5969('0x20')](function(){_0x4d0513[_0x5969('0x17')](0xcc)[_0x5969('0x18')]();});}};}function handleEntityNotFound(_0x31dabe,_0xf95d1){return function(_0x5037cb){if(!_0x5037cb){_0x31dabe[_0x5969('0x16')](0x194);}return _0x5037cb;};}function handleError(_0x2a9c18,_0x423075){_0x423075=_0x423075||0x1f4;return function(_0x6ae2c6){logger[_0x5969('0x22')](_0x6ae2c6[_0x5969('0x23')]);if(_0x6ae2c6[_0x5969('0x24')]){delete _0x6ae2c6[_0x5969('0x24')];}_0x2a9c18['status'](_0x423075)[_0x5969('0x25')](_0x6ae2c6);};}exports[_0x5969('0x26')]=function(_0xc3020f,_0x561e10){var _0x3e9645={},_0x58ace2={},_0x13ed8e={'count':0x0,'rows':[]};var _0x153c69=_['map'](db[_0x5969('0x27')]['rawAttributes'],function(_0x4bf89e){return{'name':_0x4bf89e['fieldName'],'type':_0x4bf89e[_0x5969('0x28')][_0x5969('0x29')]};});_0x58ace2[_0x5969('0x2a')]=_[_0x5969('0x2b')](_0x153c69,_0x5969('0x24'));_0x58ace2[_0x5969('0x2c')]=_[_0x5969('0x2d')](_0xc3020f[_0x5969('0x2c')]);_0x58ace2[_0x5969('0x2e')]=_[_0x5969('0x2f')](_0x58ace2[_0x5969('0x2a')],_0x58ace2['query']);_0x3e9645[_0x5969('0x30')]=_[_0x5969('0x2f')](_0x58ace2[_0x5969('0x2a')],qs[_0x5969('0x31')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x31')]));_0x3e9645[_0x5969('0x30')]=_0x3e9645[_0x5969('0x30')][_0x5969('0x32')]?_0x3e9645[_0x5969('0x30')]:_0x58ace2[_0x5969('0x2a')];if(!_0xc3020f[_0x5969('0x2c')][_0x5969('0x33')](_0x5969('0x34'))){_0x3e9645[_0x5969('0x35')]=qs[_0x5969('0x35')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x35')]);_0x3e9645[_0x5969('0x1a')]=qs['offset'](_0xc3020f[_0x5969('0x2c')][_0x5969('0x1a')]);}_0x3e9645['order']=qs[_0x5969('0x36')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x36')]);_0x3e9645[_0x5969('0x37')]=qs['filters'](_[_0x5969('0x38')](_0xc3020f[_0x5969('0x2c')],_0x58ace2[_0x5969('0x2e')]),_0x153c69);if(_0xc3020f[_0x5969('0x2c')][_0x5969('0x39')]){_0x3e9645['where']=_[_0x5969('0x3a')](_0x3e9645[_0x5969('0x37')],{'$or':_['map'](_0x153c69,function(_0x4d1e27){if(_0x4d1e27['type']!==_0x5969('0x3b')){var _0xcc1400={};_0xcc1400[_0x4d1e27[_0x5969('0x24')]]={'$like':'%'+_0xc3020f['query'][_0x5969('0x39')]+'%'};return _0xcc1400;}})});}_0x3e9645=_[_0x5969('0x3a')]({},_0x3e9645,_0xc3020f[_0x5969('0x3c')]);var _0x500e3c={'where':_0x3e9645['where']};return db['OpenchannelTransferReport'][_0x5969('0x1c')](_0x500e3c)[_0x5969('0x20')](function(_0x2c18eb){_0x13ed8e[_0x5969('0x1c')]=_0x2c18eb;if(_0xc3020f['query'][_0x5969('0x3d')]){_0x3e9645[_0x5969('0x3e')]=[{'all':!![]}];}return db[_0x5969('0x27')][_0x5969('0x3f')](_0x3e9645);})[_0x5969('0x20')](function(_0x58c8c7){_0x13ed8e['rows']=_0x58c8c7;return _0x13ed8e;})[_0x5969('0x20')](respondWithFilteredResult(_0x561e10,_0x3e9645))[_0x5969('0x40')](handleError(_0x561e10,null));};exports['show']=function(_0x5c13c0,_0x526f83){var _0x3031f7={'raw':!![],'where':{'id':_0x5c13c0[_0x5969('0x41')]['id']}},_0x326dc7={};_0x326dc7[_0x5969('0x2a')]=_[_0x5969('0x2d')](db[_0x5969('0x27')][_0x5969('0x42')]);_0x326dc7['query']=_['keys'](_0x5c13c0['query']);_0x326dc7[_0x5969('0x2e')]=_[_0x5969('0x2f')](_0x326dc7[_0x5969('0x2a')],_0x326dc7['query']);_0x3031f7[_0x5969('0x30')]=_[_0x5969('0x2f')](_0x326dc7[_0x5969('0x2a')],qs['fields'](_0x5c13c0[_0x5969('0x2c')]['fields']));_0x3031f7['attributes']=_0x3031f7[_0x5969('0x30')][_0x5969('0x32')]?_0x3031f7[_0x5969('0x30')]:_0x326dc7[_0x5969('0x2a')];if(_0x5c13c0[_0x5969('0x2c')][_0x5969('0x3d')]){_0x3031f7[_0x5969('0x3e')]=[{'all':!![]}];}_0x3031f7=_[_0x5969('0x3a')]({},_0x3031f7,_0x5c13c0['options']);return db[_0x5969('0x27')]['find'](_0x3031f7)[_0x5969('0x20')](handleEntityNotFound(_0x526f83,null))[_0x5969('0x20')](respondWithResult(_0x526f83,null))[_0x5969('0x40')](handleError(_0x526f83,null));};exports[_0x5969('0x43')]=function(_0x209086,_0x12526b){return db[_0x5969('0x27')]['create'](_0x209086[_0x5969('0x44')],{})[_0x5969('0x20')](respondWithResult(_0x12526b,0xc9))[_0x5969('0x40')](handleError(_0x12526b,null));};exports[_0x5969('0x1f')]=function(_0x3c3a3e,_0x1d51fa){if(_0x3c3a3e[_0x5969('0x44')]['id']){delete _0x3c3a3e[_0x5969('0x44')]['id'];}return db[_0x5969('0x27')][_0x5969('0x45')]({'where':{'id':_0x3c3a3e[_0x5969('0x41')]['id']}})[_0x5969('0x20')](handleEntityNotFound(_0x1d51fa,null))[_0x5969('0x20')](saveUpdates(_0x3c3a3e[_0x5969('0x44')],null))[_0x5969('0x20')](respondWithResult(_0x1d51fa,null))[_0x5969('0x40')](handleError(_0x1d51fa,null));};exports[_0x5969('0x21')]=function(_0x32db8e,_0xf85552){return db[_0x5969('0x27')][_0x5969('0x45')]({'where':{'id':_0x32db8e[_0x5969('0x41')]['id']}})['then'](handleEntityNotFound(_0xf85552,null))[_0x5969('0x20')](removeEntity(_0xf85552,null))['catch'](handleError(_0xf85552,null));};exports[_0x5969('0x46')]=function(_0x4b20d4,_0x5c0380){return db[_0x5969('0x27')][_0x5969('0x46')]()[_0x5969('0x20')](respondWithResult(_0x5c0380,null))[_0x5969('0x40')](handleError(_0x5c0380,null));}; \ No newline at end of file +var _0xd2f0=['VIRTUAL','include','findAll','catch','show','params','rawAttributes','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xd2f0,0x183));var _0x0d2f=function(_0x4ec445,_0x4e0cb9){_0x4ec445=_0x4ec445-0x0;var _0x518fb0=_0xd2f0[_0x4ec445];return _0x518fb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d2f('0x0'));var zipdir=require(_0x0d2f('0x1'));var jsonpatch=require(_0x0d2f('0x2'));var rp=require(_0x0d2f('0x3'));var moment=require(_0x0d2f('0x4'));var BPromise=require(_0x0d2f('0x5'));var Mustache=require(_0x0d2f('0x6'));var util=require(_0x0d2f('0x7'));var path=require(_0x0d2f('0x8'));var sox=require(_0x0d2f('0x9'));var csv=require(_0x0d2f('0xa'));var ejs=require(_0x0d2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d2f('0xc'));var squel=require(_0x0d2f('0xd'));var crypto=require(_0x0d2f('0xe'));var jsforce=require(_0x0d2f('0xf'));var deskjs=require(_0x0d2f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0d2f('0x11'));var Redis=require(_0x0d2f('0x12'));var authService=require(_0x0d2f('0x13'));var qs=require(_0x0d2f('0x14'));var as=require(_0x0d2f('0x15'));var hardwareService=require(_0x0d2f('0x16'));var logger=require('../../config/logger')(_0x0d2f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d2f('0x18'));var db=require(_0x0d2f('0x19'))['db'];function respondWithStatusCode(_0x301fd5,_0x208568){_0x208568=_0x208568||0xcc;return function(_0x424e13){if(_0x424e13){return _0x301fd5[_0x0d2f('0x1a')](_0x208568);}return _0x301fd5[_0x0d2f('0x1b')](_0x208568)[_0x0d2f('0x1c')]();};}function respondWithResult(_0x56c034,_0x9a437b){_0x9a437b=_0x9a437b||0xc8;return function(_0x5347d1){if(_0x5347d1){return _0x56c034['status'](_0x9a437b)['json'](_0x5347d1);}};}function respondWithFilteredResult(_0x5c3963,_0x13b2c0){return function(_0x4aa542){if(_0x4aa542){var _0x3c07eb=typeof _0x13b2c0[_0x0d2f('0x1d')]==='undefined'&&typeof _0x13b2c0[_0x0d2f('0x1e')]===_0x0d2f('0x1f');var _0x3a1050=_0x4aa542[_0x0d2f('0x20')];var _0x1efe4f=_0x3c07eb?0x0:_0x13b2c0['offset'];var _0x46fa43=_0x3c07eb?_0x4aa542['count']:_0x13b2c0['offset']+_0x13b2c0[_0x0d2f('0x1e')];var _0x22fede;if(_0x46fa43>=_0x3a1050){_0x46fa43=_0x3a1050;_0x22fede=0xc8;}else{_0x22fede=0xce;}_0x5c3963['status'](_0x22fede);return _0x5c3963[_0x0d2f('0x21')](_0x0d2f('0x22'),_0x1efe4f+'-'+_0x46fa43+'/'+_0x3a1050)['json'](_0x4aa542);}return null;};}function patchUpdates(_0x3f3a7e){return function(_0x3bfd00){try{jsonpatch[_0x0d2f('0x23')](_0x3bfd00,_0x3f3a7e,!![]);}catch(_0x2872f7){return BPromise[_0x0d2f('0x24')](_0x2872f7);}return _0x3bfd00[_0x0d2f('0x25')]();};}function saveUpdates(_0xc59fb0,_0x4817da){return function(_0x3d81d0){if(_0x3d81d0){return _0x3d81d0['update'](_0xc59fb0)[_0x0d2f('0x26')](function(_0x51fb9e){return _0x51fb9e;});}return null;};}function removeEntity(_0xa1625d,_0x3113a0){return function(_0x2aa3a3){if(_0x2aa3a3){return _0x2aa3a3[_0x0d2f('0x27')]()[_0x0d2f('0x26')](function(){_0xa1625d['status'](0xcc)[_0x0d2f('0x1c')]();});}};}function handleEntityNotFound(_0xb228d5,_0x3bc248){return function(_0x46db3a){if(!_0x46db3a){_0xb228d5[_0x0d2f('0x1a')](0x194);}return _0x46db3a;};}function handleError(_0x5f4629,_0x590db5){_0x590db5=_0x590db5||0x1f4;return function(_0x10fda6){logger[_0x0d2f('0x28')](_0x10fda6[_0x0d2f('0x29')]);if(_0x10fda6[_0x0d2f('0x2a')]){delete _0x10fda6[_0x0d2f('0x2a')];}_0x5f4629[_0x0d2f('0x1b')](_0x590db5)[_0x0d2f('0x2b')](_0x10fda6);};}exports['index']=function(_0x10260f,_0x1079f0){var _0x3ffdad={},_0xd00d08={},_0x4079b2={'count':0x0,'rows':[]};var _0x13f827=_[_0x0d2f('0x2c')](db[_0x0d2f('0x2d')]['rawAttributes'],function(_0x45a9d1){return{'name':_0x45a9d1[_0x0d2f('0x2e')],'type':_0x45a9d1[_0x0d2f('0x2f')][_0x0d2f('0x30')]};});_0xd00d08['model']=_['map'](_0x13f827,'name');_0xd00d08['query']=_[_0x0d2f('0x31')](_0x10260f[_0x0d2f('0x32')]);_0xd00d08[_0x0d2f('0x33')]=_[_0x0d2f('0x34')](_0xd00d08['model'],_0xd00d08[_0x0d2f('0x32')]);_0x3ffdad['attributes']=_[_0x0d2f('0x34')](_0xd00d08[_0x0d2f('0x35')],qs['fields'](_0x10260f[_0x0d2f('0x32')][_0x0d2f('0x36')]));_0x3ffdad[_0x0d2f('0x37')]=_0x3ffdad[_0x0d2f('0x37')][_0x0d2f('0x38')]?_0x3ffdad[_0x0d2f('0x37')]:_0xd00d08[_0x0d2f('0x35')];if(!_0x10260f[_0x0d2f('0x32')]['hasOwnProperty'](_0x0d2f('0x39'))){_0x3ffdad[_0x0d2f('0x1e')]=qs['limit'](_0x10260f[_0x0d2f('0x32')][_0x0d2f('0x1e')]);_0x3ffdad[_0x0d2f('0x1d')]=qs['offset'](_0x10260f[_0x0d2f('0x32')][_0x0d2f('0x1d')]);}_0x3ffdad[_0x0d2f('0x3a')]=qs[_0x0d2f('0x3b')](_0x10260f[_0x0d2f('0x32')][_0x0d2f('0x3b')]);_0x3ffdad[_0x0d2f('0x3c')]=qs[_0x0d2f('0x33')](_['pick'](_0x10260f[_0x0d2f('0x32')],_0xd00d08[_0x0d2f('0x33')]),_0x13f827);if(_0x10260f['query'][_0x0d2f('0x3d')]){_0x3ffdad[_0x0d2f('0x3c')]=_[_0x0d2f('0x3e')](_0x3ffdad[_0x0d2f('0x3c')],{'$or':_[_0x0d2f('0x2c')](_0x13f827,function(_0x4015e0){if(_0x4015e0[_0x0d2f('0x2f')]!==_0x0d2f('0x3f')){var _0x4931c3={};_0x4931c3[_0x4015e0[_0x0d2f('0x2a')]]={'$like':'%'+_0x10260f[_0x0d2f('0x32')][_0x0d2f('0x3d')]+'%'};return _0x4931c3;}})});}_0x3ffdad=_['merge']({},_0x3ffdad,_0x10260f['options']);var _0x4e7650={'where':_0x3ffdad[_0x0d2f('0x3c')]};return db['OpenchannelTransferReport'][_0x0d2f('0x20')](_0x4e7650)['then'](function(_0x595d7b){_0x4079b2['count']=_0x595d7b;if(_0x10260f[_0x0d2f('0x32')]['includeAll']){_0x3ffdad[_0x0d2f('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0d2f('0x41')](_0x3ffdad);})[_0x0d2f('0x26')](function(_0x33f8e7){_0x4079b2['rows']=_0x33f8e7;return _0x4079b2;})[_0x0d2f('0x26')](respondWithFilteredResult(_0x1079f0,_0x3ffdad))[_0x0d2f('0x42')](handleError(_0x1079f0,null));};exports[_0x0d2f('0x43')]=function(_0xa7c046,_0x583de2){var _0x2c930b={'raw':!![],'where':{'id':_0xa7c046[_0x0d2f('0x44')]['id']}},_0x92e16b={};_0x92e16b[_0x0d2f('0x35')]=_[_0x0d2f('0x31')](db[_0x0d2f('0x2d')][_0x0d2f('0x45')]);_0x92e16b['query']=_[_0x0d2f('0x31')](_0xa7c046['query']);_0x92e16b[_0x0d2f('0x33')]=_[_0x0d2f('0x34')](_0x92e16b[_0x0d2f('0x35')],_0x92e16b[_0x0d2f('0x32')]);_0x2c930b[_0x0d2f('0x37')]=_[_0x0d2f('0x34')](_0x92e16b[_0x0d2f('0x35')],qs['fields'](_0xa7c046[_0x0d2f('0x32')][_0x0d2f('0x36')]));_0x2c930b[_0x0d2f('0x37')]=_0x2c930b['attributes']['length']?_0x2c930b['attributes']:_0x92e16b[_0x0d2f('0x35')];if(_0xa7c046[_0x0d2f('0x32')]['includeAll']){_0x2c930b[_0x0d2f('0x40')]=[{'all':!![]}];}_0x2c930b=_[_0x0d2f('0x3e')]({},_0x2c930b,_0xa7c046['options']);return db[_0x0d2f('0x2d')][_0x0d2f('0x46')](_0x2c930b)[_0x0d2f('0x26')](handleEntityNotFound(_0x583de2,null))[_0x0d2f('0x26')](respondWithResult(_0x583de2,null))[_0x0d2f('0x42')](handleError(_0x583de2,null));};exports[_0x0d2f('0x47')]=function(_0x210793,_0x4ff67a){return db[_0x0d2f('0x2d')][_0x0d2f('0x47')](_0x210793[_0x0d2f('0x48')],{})[_0x0d2f('0x26')](respondWithResult(_0x4ff67a,0xc9))[_0x0d2f('0x42')](handleError(_0x4ff67a,null));};exports[_0x0d2f('0x49')]=function(_0xf7fd55,_0x56ea6f){if(_0xf7fd55[_0x0d2f('0x48')]['id']){delete _0xf7fd55[_0x0d2f('0x48')]['id'];}return db[_0x0d2f('0x2d')]['find']({'where':{'id':_0xf7fd55[_0x0d2f('0x44')]['id']}})['then'](handleEntityNotFound(_0x56ea6f,null))[_0x0d2f('0x26')](saveUpdates(_0xf7fd55[_0x0d2f('0x48')],null))[_0x0d2f('0x26')](respondWithResult(_0x56ea6f,null))[_0x0d2f('0x42')](handleError(_0x56ea6f,null));};exports[_0x0d2f('0x27')]=function(_0x21fb2f,_0x5e800c){return db[_0x0d2f('0x2d')][_0x0d2f('0x46')]({'where':{'id':_0x21fb2f[_0x0d2f('0x44')]['id']}})[_0x0d2f('0x26')](handleEntityNotFound(_0x5e800c,null))[_0x0d2f('0x26')](removeEntity(_0x5e800c,null))[_0x0d2f('0x42')](handleError(_0x5e800c,null));};exports[_0x0d2f('0x4a')]=function(_0x29e80c,_0x38e2b9){return db[_0x0d2f('0x2d')][_0x0d2f('0x4a')]()[_0x0d2f('0x26')](respondWithResult(_0x38e2b9,null))[_0x0d2f('0x42')](handleError(_0x38e2b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4f712ff..c67bc02 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 _0xce21=['api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x1e4fed,_0x1d918a){var _0x3e3438=function(_0x233684){while(--_0x233684){_0x1e4fed['push'](_0x1e4fed['shift']());}};_0x3e3438(++_0x1d918a);}(_0xce21,0x1e7));var _0x1ce2=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xce21[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0x1ce2('0x0'));var util=require(_0x1ce2('0x1'));var logger=require(_0x1ce2('0x2'))(_0x1ce2('0x3'));var moment=require(_0x1ce2('0x4'));var BPromise=require(_0x1ce2('0x5'));var rp=require(_0x1ce2('0x6'));var fs=require('fs');var path=require(_0x1ce2('0x7'));var rimraf=require(_0x1ce2('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ce2('0x9'));module[_0x1ce2('0xa')]=function(_0x4f3a74,_0x5ee49f){return _0x4f3a74[_0x1ce2('0xb')](_0x1ce2('0xc'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1ce2('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd40=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x2e1a1c,_0x38115b){var _0x55fa7c=function(_0x70df45){while(--_0x70df45){_0x2e1a1c['push'](_0x2e1a1c['shift']());}};_0x55fa7c(++_0x38115b);}(_0xfd40,0x1c0));var _0x0fd4=function(_0x7214d6,_0x2d1c59){_0x7214d6=_0x7214d6-0x0;var _0x1043df=_0xfd40[_0x7214d6];return _0x1043df;};'use strict';var _=require(_0x0fd4('0x0'));var util=require('util');var logger=require(_0x0fd4('0x1'))(_0x0fd4('0x2'));var moment=require(_0x0fd4('0x3'));var BPromise=require(_0x0fd4('0x4'));var rp=require(_0x0fd4('0x5'));var fs=require('fs');var path=require(_0x0fd4('0x6'));var rimraf=require(_0x0fd4('0x7'));var config=require(_0x0fd4('0x8'));var attributes=require(_0x0fd4('0x9'));module['exports']=function(_0x11e92b,_0x171518){return _0x11e92b[_0x0fd4('0xa')](_0x0fd4('0xb'),attributes,{'tableName':_0x0fd4('0xc'),'paranoid':![],'indexes':[{'name':_0x0fd4('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c872167..102f1cd 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 _0x5a2a=['catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4573dd,_0x22088d){var _0x42ee7a=function(_0x6ee6f8){while(--_0x6ee6f8){_0x4573dd['push'](_0x4573dd['shift']());}};_0x42ee7a(++_0x22088d);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0xb62965,_0x553af1){_0xb62965=_0xb62965-0x0;var _0x5397fc=_0x5a2a[_0xb62965];return _0x5397fc;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var moment=require(_0xa5a2('0x2'));var BPromise=require(_0xa5a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa5a2('0x4'));var logger=require(_0xa5a2('0x5'))('rpc');var config=require(_0xa5a2('0x6'));var jayson=require(_0xa5a2('0x7'));var client=jayson[_0xa5a2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179722,_0x563461,_0x38a5fe){return new BPromise(function(_0x97f75c,_0x43e0d8){return client['request'](_0x179722,_0x38a5fe)['then'](function(_0x1227d7){logger[_0xa5a2('0x9')](_0xa5a2('0xa'),_0x563461,_0xa5a2('0xb'));logger[_0xa5a2('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x563461,_0xa5a2('0xb'),JSON[_0xa5a2('0xd')](_0x1227d7));if(_0x1227d7[_0xa5a2('0xe')]){if(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0xf')]===0x1f4){logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x1227d7['error']['message']);return _0x43e0d8(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0x10')]);}logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x1227d7[_0xa5a2('0xe')]['message']);return _0x97f75c(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0x10')]);}else{logger['info'](_0xa5a2('0xa'),_0x563461,_0xa5a2('0xb'));_0x97f75c(_0x1227d7['result'][_0xa5a2('0x10')]);}})[_0xa5a2('0x11')](function(_0x599599){logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x599599);_0x43e0d8(_0x599599);});});} \ No newline at end of file +var _0x1670=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0x1670,0x9a));var _0x0167=function(_0x2a9b9b,_0x14c245){_0x2a9b9b=_0x2a9b9b-0x0;var _0x5139a8=_0x1670[_0x2a9b9b];return _0x5139a8;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var moment=require('moment');var BPromise=require(_0x0167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];var utils=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0167('0x7'));var client=jayson[_0x0167('0x8')][_0x0167('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1507,_0x2120f2,_0x149956){return new BPromise(function(_0xcdfc5,_0x416079){return client['request'](_0x3e1507,_0x149956)['then'](function(_0x146dad){logger[_0x0167('0xa')](_0x0167('0xb'),_0x2120f2,_0x0167('0xc'));logger[_0x0167('0xd')](_0x0167('0xe'),_0x2120f2,_0x0167('0xc'),JSON[_0x0167('0xf')](_0x146dad));if(_0x146dad[_0x0167('0x10')]){if(_0x146dad[_0x0167('0x10')][_0x0167('0x11')]===0x1f4){logger[_0x0167('0x10')](_0x0167('0xb'),_0x2120f2,_0x146dad[_0x0167('0x10')]['message']);return _0x416079(_0x146dad[_0x0167('0x10')]['message']);}logger[_0x0167('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2120f2,_0x146dad[_0x0167('0x10')][_0x0167('0x12')]);return _0xcdfc5(_0x146dad[_0x0167('0x10')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2120f2,_0x0167('0xc'));_0xcdfc5(_0x146dad[_0x0167('0x13')]['message']);}})[_0x0167('0x14')](function(_0x498cd2){logger['error'](_0x0167('0xb'),_0x2120f2,_0x498cd2);_0x416079(_0x498cd2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 027d6c8..8585184 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 _0x8885=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x8885,0xe0));var _0x5888=function(_0x396dde,_0x393a65){_0x396dde=_0x396dde-0x0;var _0x3b5797=_0x8885[_0x396dde];return _0x3b5797;};'use strict';var multer=require(_0x5888('0x0'));var util=require(_0x5888('0x1'));var path=require(_0x5888('0x2'));var timeout=require('connect-timeout');var express=require(_0x5888('0x3'));var router=express['Router']();var fs_extra=require(_0x5888('0x4'));var auth=require(_0x5888('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5888('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0x5888('0x7')](),controller[_0x5888('0x8')]);router['get'](_0x5888('0x9'),auth[_0x5888('0x7')](),controller['show']);router[_0x5888('0xa')]('/',auth['isAuthenticated'](),controller[_0x5888('0xb')]);router[_0x5888('0xc')](_0x5888('0x9'),auth[_0x5888('0x7')](),controller[_0x5888('0xd')]);router[_0x5888('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5888('0xf')]);module[_0x5888('0x10')]=router; \ No newline at end of file +var _0x4274=['get','/:id','post','create','put','update','delete','exports','util','path','fs-extra','../../components/auth/service','./pause.controller','isAuthenticated','index'];(function(_0x3f52a7,_0x1eabdf){var _0x5ce8c1=function(_0x140ea7){while(--_0x140ea7){_0x3f52a7['push'](_0x3f52a7['shift']());}};_0x5ce8c1(++_0x1eabdf);}(_0x4274,0x1bb));var _0x4427=function(_0x2f24d0,_0x12efce){_0x2f24d0=_0x2f24d0-0x0;var _0x2f89fe=_0x4274[_0x2f24d0];return _0x2f89fe;};'use strict';var multer=require('multer');var util=require(_0x4427('0x0'));var path=require(_0x4427('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4427('0x2'));var auth=require(_0x4427('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4427('0x4'));router['get']('/',auth[_0x4427('0x5')](),controller[_0x4427('0x6')]);router[_0x4427('0x7')](_0x4427('0x8'),auth[_0x4427('0x5')](),controller['show']);router[_0x4427('0x9')]('/',auth['isAuthenticated'](),controller[_0x4427('0xa')]);router[_0x4427('0xb')]('/:id',auth[_0x4427('0x5')](),controller[_0x4427('0xc')]);router[_0x4427('0xd')]('/:id',auth[_0x4427('0x5')](),controller['destroy']);module[_0x4427('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7e67c77..1981caf 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 _0x2c3c=['exports','STRING','name','sequelize'];(function(_0x1ef2e3,_0x380ec2){var _0x173e11=function(_0x574cb9){while(--_0x574cb9){_0x1ef2e3['push'](_0x1ef2e3['shift']());}};_0x173e11(++_0x380ec2);}(_0x2c3c,0x1ab));var _0xc2c3=function(_0x98d59,_0x5596){_0x98d59=_0x98d59-0x0;var _0x271414=_0x2c3c[_0x98d59];return _0x271414;};'use strict';var Sequelize=require(_0xc2c3('0x0'));module[_0xc2c3('0x1')]={'name':{'type':Sequelize[_0xc2c3('0x2')],'unique':_0xc2c3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc2c3('0x2')]}}; \ No newline at end of file +var _0x2d20=['STRING','sequelize','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2d20,0x14b));var _0x02d2=function(_0x4f3f6c,_0x30a179){_0x4f3f6c=_0x4f3f6c-0x0;var _0x1d0832=_0x2d20[_0x4f3f6c];return _0x1d0832;};'use strict';var Sequelize=require(_0x02d2('0x0'));module[_0x02d2('0x1')]={'name':{'type':Sequelize[_0x02d2('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d2c169a..653e33a 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 _0x3df1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','Pauses','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x360c9b,_0x23a9e8){var _0x25d218=function(_0xc3c111){while(--_0xc3c111){_0x360c9b['push'](_0x360c9b['shift']());}};_0x25d218(++_0x23a9e8);}(_0x3df1,0xa5));var _0x13df=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3df1[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x13df('0x0'));var rimraf=require(_0x13df('0x1'));var zipdir=require(_0x13df('0x2'));var jsonpatch=require(_0x13df('0x3'));var rp=require(_0x13df('0x4'));var moment=require(_0x13df('0x5'));var BPromise=require(_0x13df('0x6'));var Mustache=require(_0x13df('0x7'));var util=require(_0x13df('0x8'));var path=require(_0x13df('0x9'));var sox=require(_0x13df('0xa'));var csv=require(_0x13df('0xb'));var ejs=require(_0x13df('0xc'));var fs=require('fs');var fs_extra=require(_0x13df('0xd'));var _=require('lodash');var squel=require(_0x13df('0xe'));var crypto=require(_0x13df('0xf'));var jsforce=require(_0x13df('0x10'));var deskjs=require(_0x13df('0x11'));var toCsv=require(_0x13df('0xb'));var querystring=require(_0x13df('0x12'));var Papa=require(_0x13df('0x13'));var Redis=require(_0x13df('0x14'));var authService=require(_0x13df('0x15'));var qs=require(_0x13df('0x16'));var as=require(_0x13df('0x17'));var hardwareService=require(_0x13df('0x18'));var logger=require(_0x13df('0x19'))(_0x13df('0x1a'));var utils=require(_0x13df('0x1b'));var config=require(_0x13df('0x1c'));var licenseUtil=require(_0x13df('0x1d'));var db=require(_0x13df('0x1e'))['db'];function respondWithStatusCode(_0x1ba513,_0x2f3afe){_0x2f3afe=_0x2f3afe||0xcc;return function(_0x3705ef){if(_0x3705ef){return _0x1ba513[_0x13df('0x1f')](_0x2f3afe);}return _0x1ba513[_0x13df('0x20')](_0x2f3afe)['end']();};}function respondWithResult(_0x2e4491,_0xd8e731){_0xd8e731=_0xd8e731||0xc8;return function(_0x115bf4){if(_0x115bf4){return _0x2e4491[_0x13df('0x20')](_0xd8e731)[_0x13df('0x21')](_0x115bf4);}};}function respondWithFilteredResult(_0x42f791,_0xf53677){return function(_0x24a6dc){if(_0x24a6dc){var _0x230a67=typeof _0xf53677[_0x13df('0x22')]==='undefined'&&typeof _0xf53677[_0x13df('0x23')]===_0x13df('0x24');var _0x4d1de9=_0x24a6dc[_0x13df('0x25')];var _0x475c2c=_0x230a67?0x0:_0xf53677[_0x13df('0x22')];var _0x1cca66=_0x230a67?_0x24a6dc['count']:_0xf53677[_0x13df('0x22')]+_0xf53677[_0x13df('0x23')];var _0x1662a3;if(_0x1cca66>=_0x4d1de9){_0x1cca66=_0x4d1de9;_0x1662a3=0xc8;}else{_0x1662a3=0xce;}_0x42f791[_0x13df('0x20')](_0x1662a3);return _0x42f791[_0x13df('0x26')](_0x13df('0x27'),_0x475c2c+'-'+_0x1cca66+'/'+_0x4d1de9)[_0x13df('0x21')](_0x24a6dc);}return null;};}function patchUpdates(_0x422ebb){return function(_0x2fc649){try{jsonpatch['apply'](_0x2fc649,_0x422ebb,!![]);}catch(_0x5c378f){return BPromise[_0x13df('0x28')](_0x5c378f);}return _0x2fc649[_0x13df('0x29')]();};}function saveUpdates(_0x3ed6d1,_0x5790b8){return function(_0x2a7cac){if(_0x2a7cac){return _0x2a7cac[_0x13df('0x2a')](_0x3ed6d1)['then'](function(_0x5bfb94){return _0x5bfb94;});}return null;};}function removeEntity(_0x36b29e,_0x287028){return function(_0x5a8b8c){if(_0x5a8b8c){return _0x5a8b8c[_0x13df('0x2b')]()[_0x13df('0x2c')](function(){var _0x68a728=_0x5a8b8c[_0x13df('0x2d')]({'plain':!![]});var _0x3459a3=_0x13df('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3459a3,'resourceId':_0x68a728['id']}})[_0x13df('0x2c')](function(){return _0x5a8b8c;});})[_0x13df('0x2c')](function(){_0x36b29e[_0x13df('0x20')](0xcc)[_0x13df('0x2f')]();});}};}function handleEntityNotFound(_0x583439,_0x492739){return function(_0x518d63){if(!_0x518d63){_0x583439[_0x13df('0x1f')](0x194);}return _0x518d63;};}function handleError(_0x4da893,_0x2ce05b){_0x2ce05b=_0x2ce05b||0x1f4;return function(_0x38de8f){logger[_0x13df('0x30')](_0x38de8f[_0x13df('0x31')]);if(_0x38de8f[_0x13df('0x32')]){delete _0x38de8f['name'];}_0x4da893['status'](_0x2ce05b)[_0x13df('0x33')](_0x38de8f);};}exports[_0x13df('0x34')]=function(_0x23c8e3,_0x30f3b7){var _0x5e2a00={},_0x193238={},_0x2fdff5={'count':0x0,'rows':[]};var _0x63e559=_[_0x13df('0x35')](db[_0x13df('0x36')][_0x13df('0x37')],function(_0xc24a63){return{'name':_0xc24a63[_0x13df('0x38')],'type':_0xc24a63[_0x13df('0x39')][_0x13df('0x3a')]};});_0x193238[_0x13df('0x3b')]=_[_0x13df('0x35')](_0x63e559,_0x13df('0x32'));_0x193238[_0x13df('0x3c')]=_[_0x13df('0x3d')](_0x23c8e3[_0x13df('0x3c')]);_0x193238[_0x13df('0x3e')]=_[_0x13df('0x3f')](_0x193238[_0x13df('0x3b')],_0x193238[_0x13df('0x3c')]);_0x5e2a00['attributes']=_[_0x13df('0x3f')](_0x193238[_0x13df('0x3b')],qs[_0x13df('0x40')](_0x23c8e3['query'][_0x13df('0x40')]));_0x5e2a00[_0x13df('0x41')]=_0x5e2a00[_0x13df('0x41')][_0x13df('0x42')]?_0x5e2a00['attributes']:_0x193238[_0x13df('0x3b')];if(!_0x23c8e3['query'][_0x13df('0x43')]('nolimit')){_0x5e2a00[_0x13df('0x23')]=qs[_0x13df('0x23')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x23')]);_0x5e2a00[_0x13df('0x22')]=qs[_0x13df('0x22')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x22')]);}_0x5e2a00[_0x13df('0x44')]=qs[_0x13df('0x45')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x45')]);_0x5e2a00[_0x13df('0x46')]=qs['filters'](_['pick'](_0x23c8e3[_0x13df('0x3c')],_0x193238[_0x13df('0x3e')]),_0x63e559);if(_0x23c8e3[_0x13df('0x3c')][_0x13df('0x47')]){_0x5e2a00[_0x13df('0x46')]=_[_0x13df('0x48')](_0x5e2a00[_0x13df('0x46')],{'$or':_[_0x13df('0x35')](_0x63e559,function(_0x381ed5){if(_0x381ed5[_0x13df('0x39')]!==_0x13df('0x49')){var _0x85a26e={};_0x85a26e[_0x381ed5[_0x13df('0x32')]]={'$like':'%'+_0x23c8e3[_0x13df('0x3c')]['filter']+'%'};return _0x85a26e;}})});}_0x5e2a00=_['merge']({},_0x5e2a00,_0x23c8e3[_0x13df('0x4a')]);var _0x5f4274={'where':_0x5e2a00[_0x13df('0x46')]};return db['Pause'][_0x13df('0x25')](_0x5f4274)[_0x13df('0x2c')](function(_0x368f55){_0x2fdff5[_0x13df('0x25')]=_0x368f55;if(_0x23c8e3['query'][_0x13df('0x4b')]){_0x5e2a00[_0x13df('0x4c')]=[{'all':!![]}];}return db[_0x13df('0x36')][_0x13df('0x4d')](_0x5e2a00);})[_0x13df('0x2c')](function(_0x5732b4){_0x2fdff5[_0x13df('0x4e')]=_0x5732b4;return _0x2fdff5;})[_0x13df('0x2c')](respondWithFilteredResult(_0x30f3b7,_0x5e2a00))[_0x13df('0x4f')](handleError(_0x30f3b7,null));};exports[_0x13df('0x50')]=function(_0x3acd54,_0x346e1c){var _0xc99763={'raw':!![],'where':{'id':_0x3acd54[_0x13df('0x51')]['id']}},_0x23538b={};_0x23538b[_0x13df('0x3b')]=_['keys'](db[_0x13df('0x36')][_0x13df('0x37')]);_0x23538b['query']=_['keys'](_0x3acd54[_0x13df('0x3c')]);_0x23538b['filters']=_['intersection'](_0x23538b['model'],_0x23538b[_0x13df('0x3c')]);_0xc99763[_0x13df('0x41')]=_['intersection'](_0x23538b[_0x13df('0x3b')],qs[_0x13df('0x40')](_0x3acd54[_0x13df('0x3c')][_0x13df('0x40')]));_0xc99763[_0x13df('0x41')]=_0xc99763['attributes'][_0x13df('0x42')]?_0xc99763[_0x13df('0x41')]:_0x23538b[_0x13df('0x3b')];if(_0x3acd54[_0x13df('0x3c')][_0x13df('0x4b')]){_0xc99763[_0x13df('0x4c')]=[{'all':!![]}];}_0xc99763=_['merge']({},_0xc99763,_0x3acd54[_0x13df('0x4a')]);return db[_0x13df('0x36')][_0x13df('0x52')](_0xc99763)[_0x13df('0x2c')](handleEntityNotFound(_0x346e1c,null))[_0x13df('0x2c')](respondWithResult(_0x346e1c,null))['catch'](handleError(_0x346e1c,null));};exports[_0x13df('0x53')]=function(_0x3dd4c6,_0xa38fa3){return db[_0x13df('0x36')]['create'](_0x3dd4c6['body'],{})[_0x13df('0x2c')](function(_0x1b662f){var _0x1a8077=_0x3dd4c6[_0x13df('0x54')][_0x13df('0x2d')]({'plain':!![]});if(!_0x1a8077)throw new Error(_0x13df('0x55'));if(_0x1a8077[_0x13df('0x56')]===_0x13df('0x54')){var _0x1310d2=_0x1b662f[_0x13df('0x2d')]({'plain':!![]});var _0x45dfc5=_0x13df('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x45dfc5,'userProfileId':_0x1a8077[_0x13df('0x57')]},'raw':!![]})[_0x13df('0x2c')](function(_0x47dfeb){if(_0x47dfeb&&_0x47dfeb[_0x13df('0x58')]===0x0){return db[_0x13df('0x59')][_0x13df('0x53')]({'name':_0x1310d2[_0x13df('0x32')],'resourceId':_0x1310d2['id'],'type':_0x47dfeb[_0x13df('0x32')],'sectionId':_0x47dfeb['id']},{})[_0x13df('0x2c')](function(){return _0x1b662f;});}else{return _0x1b662f;}})['catch'](function(_0x43f4eb){logger[_0x13df('0x30')](_0x13df('0x5a'),_0x43f4eb);throw _0x43f4eb;});}return _0x1b662f;})[_0x13df('0x2c')](respondWithResult(_0xa38fa3,0xc9))['catch'](handleError(_0xa38fa3,null));};exports[_0x13df('0x2a')]=function(_0x104112,_0x4638e6){if(_0x104112[_0x13df('0x5b')]['id']){delete _0x104112[_0x13df('0x5b')]['id'];}return db[_0x13df('0x36')][_0x13df('0x52')]({'where':{'id':_0x104112[_0x13df('0x51')]['id']}})[_0x13df('0x2c')](handleEntityNotFound(_0x4638e6,null))[_0x13df('0x2c')](saveUpdates(_0x104112[_0x13df('0x5b')],null))[_0x13df('0x2c')](respondWithResult(_0x4638e6,null))['catch'](handleError(_0x4638e6,null));};exports['destroy']=function(_0x40bed7,_0x26a190){return db[_0x13df('0x36')][_0x13df('0x52')]({'where':{'id':_0x40bed7[_0x13df('0x51')]['id']}})[_0x13df('0x2c')](handleEntityNotFound(_0x26a190,null))['then'](removeEntity(_0x26a190,null))[_0x13df('0x4f')](handleError(_0x26a190,null));}; \ No newline at end of file +var _0xf47b=['Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf47b,0x1cf));var _0xbf47=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf47b[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf47('0x0'));var zipdir=require(_0xbf47('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf47('0x2'));var BPromise=require(_0xbf47('0x3'));var Mustache=require(_0xbf47('0x4'));var util=require('util');var path=require(_0xbf47('0x5'));var sox=require('sox');var csv=require(_0xbf47('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf47('0x7'));var squel=require(_0xbf47('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbf47('0x9'));var toCsv=require(_0xbf47('0x6'));var querystring=require(_0xbf47('0xa'));var Papa=require(_0xbf47('0xb'));var Redis=require(_0xbf47('0xc'));var authService=require(_0xbf47('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf47('0xe'));var hardwareService=require(_0xbf47('0xf'));var logger=require(_0xbf47('0x10'))(_0xbf47('0x11'));var utils=require(_0xbf47('0x12'));var config=require(_0xbf47('0x13'));var licenseUtil=require(_0xbf47('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ab13,_0x38b32a){_0x38b32a=_0x38b32a||0xcc;return function(_0x160eac){if(_0x160eac){return _0x29ab13['sendStatus'](_0x38b32a);}return _0x29ab13[_0xbf47('0x15')](_0x38b32a)[_0xbf47('0x16')]();};}function respondWithResult(_0x2e0d3d,_0x5f0b6a){_0x5f0b6a=_0x5f0b6a||0xc8;return function(_0x41631c){if(_0x41631c){return _0x2e0d3d['status'](_0x5f0b6a)[_0xbf47('0x17')](_0x41631c);}};}function respondWithFilteredResult(_0x1b69c3,_0x54b586){return function(_0x1c7034){if(_0x1c7034){var _0x4de370=typeof _0x54b586[_0xbf47('0x18')]===_0xbf47('0x19')&&typeof _0x54b586[_0xbf47('0x1a')]===_0xbf47('0x19');var _0xddd1d5=_0x1c7034['count'];var _0x58b74d=_0x4de370?0x0:_0x54b586['offset'];var _0x226876=_0x4de370?_0x1c7034[_0xbf47('0x1b')]:_0x54b586['offset']+_0x54b586['limit'];var _0x3a35c9;if(_0x226876>=_0xddd1d5){_0x226876=_0xddd1d5;_0x3a35c9=0xc8;}else{_0x3a35c9=0xce;}_0x1b69c3['status'](_0x3a35c9);return _0x1b69c3[_0xbf47('0x1c')](_0xbf47('0x1d'),_0x58b74d+'-'+_0x226876+'/'+_0xddd1d5)[_0xbf47('0x17')](_0x1c7034);}return null;};}function patchUpdates(_0x4d5915){return function(_0x1ca2cd){try{jsonpatch[_0xbf47('0x1e')](_0x1ca2cd,_0x4d5915,!![]);}catch(_0x1501c3){return BPromise[_0xbf47('0x1f')](_0x1501c3);}return _0x1ca2cd[_0xbf47('0x20')]();};}function saveUpdates(_0x160852,_0x4fcd2c){return function(_0x777761){if(_0x777761){return _0x777761[_0xbf47('0x21')](_0x160852)['then'](function(_0x5dc98e){return _0x5dc98e;});}return null;};}function removeEntity(_0x2232d7,_0x1ab0e4){return function(_0x136eb4){if(_0x136eb4){return _0x136eb4[_0xbf47('0x22')]()[_0xbf47('0x23')](function(){var _0xafa57b=_0x136eb4['get']({'plain':!![]});var _0x5e590d='Pauses';return db['UserProfileResource'][_0xbf47('0x22')]({'where':{'type':_0x5e590d,'resourceId':_0xafa57b['id']}})[_0xbf47('0x23')](function(){return _0x136eb4;});})[_0xbf47('0x23')](function(){_0x2232d7[_0xbf47('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c1180,_0x5de640){return function(_0x45bcee){if(!_0x45bcee){_0x3c1180[_0xbf47('0x24')](0x194);}return _0x45bcee;};}function handleError(_0x2d2b71,_0x22d602){_0x22d602=_0x22d602||0x1f4;return function(_0x318fa9){logger[_0xbf47('0x25')](_0x318fa9[_0xbf47('0x26')]);if(_0x318fa9['name']){delete _0x318fa9[_0xbf47('0x27')];}_0x2d2b71['status'](_0x22d602)[_0xbf47('0x28')](_0x318fa9);};}exports[_0xbf47('0x29')]=function(_0x4dc16a,_0x8a8ec1){var _0xdc7a18={},_0x212f12={},_0x954b40={'count':0x0,'rows':[]};var _0x18fcec=_[_0xbf47('0x2a')](db[_0xbf47('0x2b')][_0xbf47('0x2c')],function(_0x5b9769){return{'name':_0x5b9769[_0xbf47('0x2d')],'type':_0x5b9769[_0xbf47('0x2e')][_0xbf47('0x2f')]};});_0x212f12[_0xbf47('0x30')]=_[_0xbf47('0x2a')](_0x18fcec,'name');_0x212f12[_0xbf47('0x31')]=_[_0xbf47('0x32')](_0x4dc16a[_0xbf47('0x31')]);_0x212f12[_0xbf47('0x33')]=_[_0xbf47('0x34')](_0x212f12[_0xbf47('0x30')],_0x212f12[_0xbf47('0x31')]);_0xdc7a18['attributes']=_[_0xbf47('0x34')](_0x212f12['model'],qs[_0xbf47('0x35')](_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x35')]));_0xdc7a18[_0xbf47('0x36')]=_0xdc7a18['attributes'][_0xbf47('0x37')]?_0xdc7a18['attributes']:_0x212f12[_0xbf47('0x30')];if(!_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x38')](_0xbf47('0x39'))){_0xdc7a18['limit']=qs[_0xbf47('0x1a')](_0x4dc16a[_0xbf47('0x31')]['limit']);_0xdc7a18['offset']=qs[_0xbf47('0x18')](_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x18')]);}_0xdc7a18['order']=qs[_0xbf47('0x3a')](_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x3a')]);_0xdc7a18[_0xbf47('0x3b')]=qs[_0xbf47('0x33')](_[_0xbf47('0x3c')](_0x4dc16a[_0xbf47('0x31')],_0x212f12[_0xbf47('0x33')]),_0x18fcec);if(_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x3d')]){_0xdc7a18[_0xbf47('0x3b')]=_[_0xbf47('0x3e')](_0xdc7a18[_0xbf47('0x3b')],{'$or':_['map'](_0x18fcec,function(_0x38fe91){if(_0x38fe91[_0xbf47('0x2e')]!==_0xbf47('0x3f')){var _0x4d0043={};_0x4d0043[_0x38fe91[_0xbf47('0x27')]]={'$like':'%'+_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x3d')]+'%'};return _0x4d0043;}})});}_0xdc7a18=_['merge']({},_0xdc7a18,_0x4dc16a['options']);var _0x4728b8={'where':_0xdc7a18[_0xbf47('0x3b')]};return db[_0xbf47('0x2b')][_0xbf47('0x1b')](_0x4728b8)['then'](function(_0x4ace3e){_0x954b40['count']=_0x4ace3e;if(_0x4dc16a[_0xbf47('0x31')][_0xbf47('0x40')]){_0xdc7a18[_0xbf47('0x41')]=[{'all':!![]}];}return db[_0xbf47('0x2b')][_0xbf47('0x42')](_0xdc7a18);})[_0xbf47('0x23')](function(_0x1abeac){_0x954b40[_0xbf47('0x43')]=_0x1abeac;return _0x954b40;})[_0xbf47('0x23')](respondWithFilteredResult(_0x8a8ec1,_0xdc7a18))['catch'](handleError(_0x8a8ec1,null));};exports[_0xbf47('0x44')]=function(_0x3af8c0,_0x20ebcc){var _0xae8433={'raw':!![],'where':{'id':_0x3af8c0[_0xbf47('0x45')]['id']}},_0x4aff73={};_0x4aff73['model']=_[_0xbf47('0x32')](db[_0xbf47('0x2b')][_0xbf47('0x2c')]);_0x4aff73[_0xbf47('0x31')]=_[_0xbf47('0x32')](_0x3af8c0[_0xbf47('0x31')]);_0x4aff73[_0xbf47('0x33')]=_[_0xbf47('0x34')](_0x4aff73['model'],_0x4aff73[_0xbf47('0x31')]);_0xae8433['attributes']=_[_0xbf47('0x34')](_0x4aff73['model'],qs['fields'](_0x3af8c0['query']['fields']));_0xae8433[_0xbf47('0x36')]=_0xae8433[_0xbf47('0x36')][_0xbf47('0x37')]?_0xae8433[_0xbf47('0x36')]:_0x4aff73[_0xbf47('0x30')];if(_0x3af8c0['query'][_0xbf47('0x40')]){_0xae8433[_0xbf47('0x41')]=[{'all':!![]}];}_0xae8433=_[_0xbf47('0x3e')]({},_0xae8433,_0x3af8c0['options']);return db[_0xbf47('0x2b')][_0xbf47('0x46')](_0xae8433)[_0xbf47('0x23')](handleEntityNotFound(_0x20ebcc,null))[_0xbf47('0x23')](respondWithResult(_0x20ebcc,null))[_0xbf47('0x47')](handleError(_0x20ebcc,null));};exports[_0xbf47('0x48')]=function(_0x56953d,_0x2f23f3){return db[_0xbf47('0x2b')][_0xbf47('0x48')](_0x56953d[_0xbf47('0x49')],{})[_0xbf47('0x23')](function(_0x1ecf01){var _0x452e37=_0x56953d['user'][_0xbf47('0x4a')]({'plain':!![]});if(!_0x452e37)throw new Error(_0xbf47('0x4b'));if(_0x452e37[_0xbf47('0x4c')]===_0xbf47('0x4d')){var _0xf2da14=_0x1ecf01['get']({'plain':!![]});var _0x295b22='Pauses';return db[_0xbf47('0x4e')][_0xbf47('0x46')]({'where':{'name':_0x295b22,'userProfileId':_0x452e37[_0xbf47('0x4f')]},'raw':!![]})['then'](function(_0x21fdd7){if(_0x21fdd7&&_0x21fdd7['autoAssociation']===0x0){return db[_0xbf47('0x50')][_0xbf47('0x48')]({'name':_0xf2da14['name'],'resourceId':_0xf2da14['id'],'type':_0x21fdd7['name'],'sectionId':_0x21fdd7['id']},{})[_0xbf47('0x23')](function(){return _0x1ecf01;});}else{return _0x1ecf01;}})['catch'](function(_0xd4916d){logger[_0xbf47('0x25')](_0xbf47('0x51'),_0xd4916d);throw _0xd4916d;});}return _0x1ecf01;})[_0xbf47('0x23')](respondWithResult(_0x2f23f3,0xc9))[_0xbf47('0x47')](handleError(_0x2f23f3,null));};exports[_0xbf47('0x21')]=function(_0x5bdaf4,_0x1b3b19){if(_0x5bdaf4['body']['id']){delete _0x5bdaf4[_0xbf47('0x49')]['id'];}return db[_0xbf47('0x2b')]['find']({'where':{'id':_0x5bdaf4[_0xbf47('0x45')]['id']}})[_0xbf47('0x23')](handleEntityNotFound(_0x1b3b19,null))[_0xbf47('0x23')](saveUpdates(_0x5bdaf4[_0xbf47('0x49')],null))[_0xbf47('0x23')](respondWithResult(_0x1b3b19,null))[_0xbf47('0x47')](handleError(_0x1b3b19,null));};exports['destroy']=function(_0x20a64a,_0x441c83){return db[_0xbf47('0x2b')]['find']({'where':{'id':_0x20a64a[_0xbf47('0x45')]['id']}})[_0xbf47('0x23')](handleEntityNotFound(_0x441c83,null))['then'](removeEntity(_0x441c83,null))[_0xbf47('0x47')](handleError(_0x441c83,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7b6c016..882f6ee 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x59a482,_0x1ab755){var _0x3882be=function(_0x4fb4bd){while(--_0x4fb4bd){_0x59a482['push'](_0x59a482['shift']());}};_0x3882be(++_0x1ab755);}(_0x5fc3,0xa8));var _0x35fc=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x5fc3[_0x53bcc3];return _0x47c959;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0x7fbe[_0x57643b];return _0x53a35b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 11bb2d2..3f2f10d 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(_0x5b1759,_0x4e92b8){var _0x1e8695=function(_0xa10b28){while(--_0xa10b28){_0x5b1759['push'](_0x5b1759['shift']());}};_0x1e8695(++_0x4e92b8);}(_0x7a54,0x106));var _0x47a5=function(_0x3e7b61,_0x181144){_0x3e7b61=_0x3e7b61-0x0;var _0x125e35=_0x7a54[_0x3e7b61];return _0x125e35;};'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(_0x209b9a,_0x50a325){var _0x53a607=function(_0x5cdf82){while(--_0x5cdf82){_0x209b9a['push'](_0x209b9a['shift']());}};_0x53a607(++_0x50a325);}(_0x7a54,0x106));var _0x47a5=function(_0x4dc8d6,_0x3bda79){_0x4dc8d6=_0x4dc8d6-0x0;var _0x570e28=_0x7a54[_0x4dc8d6];return _0x570e28;};'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 5174f83..b6bba2c 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 _0x3667=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x4e5a6a,_0x3b4fdc){var _0x5d6858=function(_0x33e290){while(--_0x33e290){_0x4e5a6a['push'](_0x4e5a6a['shift']());}};_0x5d6858(++_0x3b4fdc);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);var upload=multer({'storage':multer[_0x7366('0x12')]({'destination':function(_0x2d7e38,_0x57ea7f,_0x425ee4){_0x425ee4(null,path[_0x7366('0x13')](config[_0x7366('0x14')],_0x7366('0x15')));},'filename':function(_0x25a565,_0xd5bac8,_0x3e3a73){_0xd5bac8[_0x7366('0x16')]=_0xd5bac8[_0x7366('0x16')][_0x7366('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3a73(null,util[_0x7366('0x18')](_0x7366('0x19'),path[_0x7366('0x1a')](_0xd5bac8[_0x7366('0x16')],path[_0x7366('0x1b')](_0xd5bac8['originalname'])),Date[_0x7366('0x1c')](),path[_0x7366('0x1b')](_0xd5bac8[_0x7366('0x16')])));}})});router[_0x7366('0x1d')]('/',upload[_0x7366('0x1e')](_0x7366('0x1f')),controller[_0x7366('0x20')]);router[_0x7366('0x1d')](_0x7366('0xc'),controller[_0x7366('0x21')]);router[_0x7366('0x22')]('/:id',auth[_0x7366('0xa')](),controller['update']);router[_0x7366('0x23')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller['delete']);module[_0x7366('0x24')]=router; \ No newline at end of file +var _0x6f0d=['delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1a72f3,_0x3acf91){_0x1a72f3=_0x1a72f3-0x0;var _0x1bf9bf=_0x6f0d[_0x1a72f3];return _0x1bf9bf;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136eee,_0xee144c,_0x329f69){_0x329f69(null,path[_0xd6f0('0x10')](config['root'],_0xd6f0('0x11')));},'filename':function(_0x2f0459,_0x306aad,_0x45973d){_0x306aad[_0xd6f0('0x12')]=_0x306aad[_0xd6f0('0x12')][_0xd6f0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45973d(null,util[_0xd6f0('0x14')](_0xd6f0('0x15'),path['basename'](_0x306aad[_0xd6f0('0x12')],path[_0xd6f0('0x16')](_0x306aad['originalname'])),Date[_0xd6f0('0x17')](),path['extname'](_0x306aad[_0xd6f0('0x12')])));}})});router[_0xd6f0('0x18')]('/',upload[_0xd6f0('0x19')](_0xd6f0('0x1a')),controller[_0xd6f0('0x1b')]);router[_0xd6f0('0x18')](_0xd6f0('0xb'),controller[_0xd6f0('0x1c')]);router[_0xd6f0('0x1d')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1f')]);router[_0xd6f0('0x20')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 16888eb..b692d18 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 _0x16a7=['ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x5eb4bb,_0xbd4598){var _0x12d25b=function(_0x4f0ccd){while(--_0x4f0ccd){_0x5eb4bb['push'](_0x5eb4bb['shift']());}};_0x12d25b(++_0xbd4598);}(_0x16a7,0x135));var _0x716a=function(_0x1fc0c0,_0x4585fc){_0x1fc0c0=_0x1fc0c0-0x0;var _0x1c7800=_0x16a7[_0x1fc0c0];return _0x1c7800;};'use strict';var Sequelize=require(_0x716a('0x0'));module[_0x716a('0x1')]={'name':{'type':Sequelize[_0x716a('0x2')]},'type':{'type':Sequelize[_0x716a('0x3')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x716a('0x4')]},'path':{'type':Sequelize[_0x716a('0x2')],'comment':_0x716a('0x5')},'active':{'type':Sequelize[_0x716a('0x6')],'defaultValue':0x0,'comment':_0x716a('0x7')},'sidebar':{'type':Sequelize[_0x716a('0x3')](_0x716a('0x8'),'agentOnly',_0x716a('0x9'),_0x716a('0xa')),'defaultValue':'always','comment':_0x716a('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x716a('0x2')]},'scriptName':{'type':Sequelize[_0x716a('0x2')]},'scriptPath':{'type':Sequelize[_0x716a('0x2')]}}; \ No newline at end of file +var _0xa41e=['BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0xae7e4e,_0x4fb4bd){var _0x5c5f87=function(_0x54e07a){while(--_0x54e07a){_0xae7e4e['push'](_0xae7e4e['shift']());}};_0x5c5f87(++_0x4fb4bd);}(_0xa41e,0x15b));var _0xea41=function(_0x3343af,_0x1ef6c4){_0x3343af=_0x3343af-0x0;var _0x2f1dcc=_0xa41e[_0x3343af];return _0x2f1dcc;};'use strict';var Sequelize=require(_0xea41('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xea41('0x1')](_0xea41('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xea41('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0xea41('0x4')},'active':{'type':Sequelize[_0xea41('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xea41('0x1')](_0xea41('0x6'),'agentOnly',_0xea41('0x7'),_0xea41('0x8')),'defaultValue':_0xea41('0x7'),'comment':_0xea41('0x9')},'icon':{'type':Sequelize[_0xea41('0xa')]},'adminUrl':{'type':Sequelize[_0xea41('0xa')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xea41('0xa')]},'scriptPath':{'type':Sequelize[_0xea41('0xa')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f94fa9b..fed7462 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 _0x4ab2=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','UserProfileResource','destroy','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','download','params','join','root','server/files/plugins','%s.zip','basename','zip','warning','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','eml-format'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x4ab2,0x14f));var _0x24ab=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4ab2[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x24ab('0x0'));var rimraf=require(_0x24ab('0x1'));var zipdir=require(_0x24ab('0x2'));var jsonpatch=require(_0x24ab('0x3'));var rp=require(_0x24ab('0x4'));var moment=require('moment');var BPromise=require(_0x24ab('0x5'));var Mustache=require(_0x24ab('0x6'));var util=require('util');var path=require(_0x24ab('0x7'));var sox=require('sox');var csv=require(_0x24ab('0x8'));var ejs=require(_0x24ab('0x9'));var fs=require('fs');var fs_extra=require(_0x24ab('0xa'));var _=require(_0x24ab('0xb'));var squel=require(_0x24ab('0xc'));var crypto=require(_0x24ab('0xd'));var jsforce=require(_0x24ab('0xe'));var deskjs=require(_0x24ab('0xf'));var toCsv=require(_0x24ab('0x8'));var querystring=require(_0x24ab('0x10'));var Papa=require('papaparse');var extract=require(_0x24ab('0x11'));var rimraf=require(_0x24ab('0x1'));var archiver=require(_0x24ab('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x24ab('0x13'));var hardwareService=require(_0x24ab('0x14'));var logger=require(_0x24ab('0x15'))(_0x24ab('0x16'));var utils=require(_0x24ab('0x17'));var config=require(_0x24ab('0x18'));var licenseUtil=require(_0x24ab('0x19'));var db=require(_0x24ab('0x1a'))['db'];config['redis']=_['defaults'](config[_0x24ab('0x1b')],{'host':_0x24ab('0x1c'),'port':0x18eb});var socket=require(_0x24ab('0x1d'))(new Redis(config['redis']));require(_0x24ab('0x1e'))['register'](socket);function respondWithStatusCode(_0x4a88d4,_0x255e35){_0x255e35=_0x255e35||0xcc;return function(_0x59cde5){if(_0x59cde5){return _0x4a88d4[_0x24ab('0x1f')](_0x255e35);}return _0x4a88d4[_0x24ab('0x20')](_0x255e35)[_0x24ab('0x21')]();};}function respondWithResult(_0x5dd4d0,_0x18b7f8){_0x18b7f8=_0x18b7f8||0xc8;return function(_0x3c8ac7){if(_0x3c8ac7){return _0x5dd4d0[_0x24ab('0x20')](_0x18b7f8)[_0x24ab('0x22')](_0x3c8ac7);}};}function respondWithFilteredResult(_0x2bde3e,_0x5c6c51){return function(_0x2cc916){if(_0x2cc916){var _0x44a7dc=typeof _0x5c6c51[_0x24ab('0x23')]===_0x24ab('0x24')&&typeof _0x5c6c51['limit']==='undefined';var _0x315b13=_0x2cc916['count'];var _0x4338f0=_0x44a7dc?0x0:_0x5c6c51['offset'];var _0x3b9e90=_0x44a7dc?_0x2cc916[_0x24ab('0x25')]:_0x5c6c51[_0x24ab('0x23')]+_0x5c6c51[_0x24ab('0x26')];var _0x2a5384;if(_0x3b9e90>=_0x315b13){_0x3b9e90=_0x315b13;_0x2a5384=0xc8;}else{_0x2a5384=0xce;}_0x2bde3e[_0x24ab('0x20')](_0x2a5384);return _0x2bde3e[_0x24ab('0x27')](_0x24ab('0x28'),_0x4338f0+'-'+_0x3b9e90+'/'+_0x315b13)[_0x24ab('0x22')](_0x2cc916);}return null;};}function patchUpdates(_0x4a4dab){return function(_0x5a9199){try{jsonpatch['apply'](_0x5a9199,_0x4a4dab,!![]);}catch(_0x430325){return BPromise[_0x24ab('0x29')](_0x430325);}return _0x5a9199['save']();};}function saveUpdates(_0x4ace40,_0x3c4006){return function(_0x3c9a77){if(_0x3c9a77){return _0x3c9a77[_0x24ab('0x2a')](_0x4ace40)[_0x24ab('0x2b')](function(_0xf761fb){return _0xf761fb;});}return null;};}function removeEntity(_0x206fc6,_0x1b486b){return function(_0x49e7a3){if(_0x49e7a3){return _0x49e7a3['destroy']()[_0x24ab('0x2b')](function(){var _0x34dc84=_0x49e7a3['get']({'plain':!![]});var _0x355b63='Plugins';return db[_0x24ab('0x2c')][_0x24ab('0x2d')]({'where':{'type':_0x355b63,'resourceId':_0x34dc84['id']}})[_0x24ab('0x2b')](function(){return _0x49e7a3;});})[_0x24ab('0x2b')](function(){_0x206fc6[_0x24ab('0x20')](0xcc)[_0x24ab('0x21')]();});}};}function handleEntityNotFound(_0x5ab076,_0x3de933){return function(_0x5bb6be){if(!_0x5bb6be){_0x5ab076[_0x24ab('0x1f')](0x194);}return _0x5bb6be;};}function handleError(_0x28369c,_0xcd0a65){_0xcd0a65=_0xcd0a65||0x1f4;return function(_0x5058e0){logger['error'](_0x5058e0[_0x24ab('0x2e')]);if(_0x5058e0[_0x24ab('0x2f')]){delete _0x5058e0[_0x24ab('0x2f')];}_0x28369c['status'](_0xcd0a65)[_0x24ab('0x30')](_0x5058e0);};}exports['index']=function(_0xa675d5,_0x3ab8c8){var _0x3747d1={},_0x5333b8={},_0x83945b={'count':0x0,'rows':[]};var _0x5d7ac1=_[_0x24ab('0x31')](db[_0x24ab('0x32')][_0x24ab('0x33')],function(_0x217512){return{'name':_0x217512[_0x24ab('0x34')],'type':_0x217512[_0x24ab('0x35')][_0x24ab('0x36')]};});_0x5333b8[_0x24ab('0x37')]=_[_0x24ab('0x31')](_0x5d7ac1,_0x24ab('0x2f'));_0x5333b8[_0x24ab('0x38')]=_[_0x24ab('0x39')](_0xa675d5[_0x24ab('0x38')]);_0x5333b8[_0x24ab('0x3a')]=_[_0x24ab('0x3b')](_0x5333b8[_0x24ab('0x37')],_0x5333b8[_0x24ab('0x38')]);_0x3747d1[_0x24ab('0x3c')]=_['intersection'](_0x5333b8['model'],qs[_0x24ab('0x3d')](_0xa675d5['query'][_0x24ab('0x3d')]));_0x3747d1['attributes']=_0x3747d1['attributes'][_0x24ab('0x3e')]?_0x3747d1[_0x24ab('0x3c')]:_0x5333b8[_0x24ab('0x37')];if(!_0xa675d5['query'][_0x24ab('0x3f')](_0x24ab('0x40'))){_0x3747d1['limit']=qs[_0x24ab('0x26')](_0xa675d5[_0x24ab('0x38')][_0x24ab('0x26')]);_0x3747d1['offset']=qs[_0x24ab('0x23')](_0xa675d5[_0x24ab('0x38')][_0x24ab('0x23')]);}_0x3747d1[_0x24ab('0x41')]=qs[_0x24ab('0x42')](_0xa675d5['query'][_0x24ab('0x42')]);_0x3747d1['where']=qs[_0x24ab('0x3a')](_[_0x24ab('0x43')](_0xa675d5[_0x24ab('0x38')],_0x5333b8['filters']),_0x5d7ac1);if(_0xa675d5[_0x24ab('0x38')][_0x24ab('0x44')]){_0x3747d1[_0x24ab('0x45')]=_[_0x24ab('0x46')](_0x3747d1[_0x24ab('0x45')],{'$or':_[_0x24ab('0x31')](_0x5d7ac1,function(_0x100f04){if(_0x100f04[_0x24ab('0x35')]!==_0x24ab('0x47')){var _0x2d231c={};_0x2d231c[_0x100f04[_0x24ab('0x2f')]]={'$like':'%'+_0xa675d5[_0x24ab('0x38')]['filter']+'%'};return _0x2d231c;}})});}_0x3747d1=_[_0x24ab('0x46')]({},_0x3747d1,_0xa675d5[_0x24ab('0x48')]);var _0x5f13a5={'where':_0x3747d1[_0x24ab('0x45')]};return db[_0x24ab('0x32')][_0x24ab('0x25')](_0x5f13a5)[_0x24ab('0x2b')](function(_0x51207c){_0x83945b[_0x24ab('0x25')]=_0x51207c;if(_0xa675d5['query']['includeAll']){_0x3747d1[_0x24ab('0x49')]=[{'all':!![]}];}return db[_0x24ab('0x32')]['findAll'](_0x3747d1);})[_0x24ab('0x2b')](function(_0x24868c){_0x83945b[_0x24ab('0x4a')]=_0x24868c;return _0x83945b;})[_0x24ab('0x2b')](respondWithFilteredResult(_0x3ab8c8,_0x3747d1))[_0x24ab('0x4b')](handleError(_0x3ab8c8,null));};exports[_0x24ab('0x4c')]=function(_0x3fea37,_0x1c1b5e){var _0x4afdc0={'raw':!![],'where':{'id':_0x3fea37['params']['id']}},_0x18fa7e={};_0x18fa7e[_0x24ab('0x37')]=_[_0x24ab('0x39')](db[_0x24ab('0x32')][_0x24ab('0x33')]);_0x18fa7e[_0x24ab('0x38')]=_[_0x24ab('0x39')](_0x3fea37[_0x24ab('0x38')]);_0x18fa7e[_0x24ab('0x3a')]=_['intersection'](_0x18fa7e[_0x24ab('0x37')],_0x18fa7e['query']);_0x4afdc0[_0x24ab('0x3c')]=_[_0x24ab('0x3b')](_0x18fa7e[_0x24ab('0x37')],qs[_0x24ab('0x3d')](_0x3fea37[_0x24ab('0x38')][_0x24ab('0x3d')]));_0x4afdc0[_0x24ab('0x3c')]=_0x4afdc0[_0x24ab('0x3c')][_0x24ab('0x3e')]?_0x4afdc0[_0x24ab('0x3c')]:_0x18fa7e[_0x24ab('0x37')];if(_0x3fea37[_0x24ab('0x38')][_0x24ab('0x4d')]){_0x4afdc0['include']=[{'all':!![]}];}_0x4afdc0=_['merge']({},_0x4afdc0,_0x3fea37[_0x24ab('0x48')]);return db['Plugin'][_0x24ab('0x4e')](_0x4afdc0)[_0x24ab('0x2b')](handleEntityNotFound(_0x1c1b5e,null))[_0x24ab('0x2b')](respondWithResult(_0x1c1b5e,null))[_0x24ab('0x4b')](handleError(_0x1c1b5e,null));};exports[_0x24ab('0x4f')]=function(_0x50bab7,_0x211f69,_0x299c03){return db[_0x24ab('0x32')][_0x24ab('0x4e')]({'where':{'id':_0x50bab7[_0x24ab('0x50')]['id']},'attributes':[_0x24ab('0x2f'),'path'],'raw':!![]})[_0x24ab('0x2b')](handleEntityNotFound(_0x211f69,null))[_0x24ab('0x2b')](function(_0x3c41cb){if(_0x3c41cb){var _0x5109c8=path[_0x24ab('0x51')](config[_0x24ab('0x52')],_0x24ab('0x53'),util['format'](_0x24ab('0x54'),path[_0x24ab('0x55')](_0x3c41cb['path'])));var _0x5ab778=fs['createWriteStream'](_0x5109c8);var _0x54f96d=archiver(_0x24ab('0x56'),{'zlib':{'level':0x9}});_0x54f96d['on'](_0x24ab('0x57'),function(_0x353642){if(_0x353642['code']==='ENOENT'){logger[_0x24ab('0x58')](_0x353642);}else{throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))](_0x24ab('0x5b'));}});_0x54f96d['on'](_0x24ab('0x58'),function(_0x5231bb){throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))](_0x24ab('0x5b'));});_0x54f96d[_0x24ab('0x5c')](_0x5ab778);_0x54f96d[_0x24ab('0x5d')](_0x24ab('0x5e'),{'cwd':path[_0x24ab('0x51')](config['root'],_0x24ab('0x53'),path['dirname'](_0x3c41cb['path'])),'ignore':[path['join'](path['basename'](_0x3c41cb[_0x24ab('0x7')]),_0x24ab('0x5f')),path[_0x24ab('0x51')](path['basename'](_0x3c41cb['path']),_0x24ab('0x60'))],'nodir':!![]})[_0x24ab('0x61')]();_0x5ab778['on'](_0x24ab('0x62'),function(){if(!fs[_0x24ab('0x63')](_0x5109c8)){throw new db['Sequelize'][(_0x24ab('0x5a'))](_0x24ab('0x64'));}return _0x211f69[_0x24ab('0x4f')](_0x5109c8,util[_0x24ab('0x65')]('%s.zip',path[_0x24ab('0x55')](_0x3c41cb[_0x24ab('0x7')])),function(_0x5148fc){if(_0x5148fc){throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x24ab('0x66')](_0x5109c8);logger[_0x24ab('0x67')](_0x24ab('0x68'));logger[_0x24ab('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x24ab('0x4b')](handleError(_0x211f69,null));};exports[_0x24ab('0x69')]=function(_0x123cbf,_0x36de99,_0x24e2a6){var _0x2fa455=path[_0x24ab('0x55')](_0x123cbf[_0x24ab('0x6a')][_0x24ab('0x6b')],path[_0x24ab('0x6c')](_0x123cbf[_0x24ab('0x6a')]['filename']));var _0x3afacb=path[_0x24ab('0x51')](config['root'],_0x24ab('0x53'),_0x123cbf[_0x24ab('0x6a')][_0x24ab('0x6b')]);var _0x96fdd5=path[_0x24ab('0x51')](config[_0x24ab('0x52')],_0x24ab('0x53'),_0x2fa455);logger['info'](_0x24ab('0x6d'),_0x3afacb);logger[_0x24ab('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x96fdd5);try{fs[_0x24ab('0x6e')](_0x3afacb,parseInt('0777',0x8));extract(_0x3afacb,{'dir':_0x96fdd5},function(_0x4dfdd2){if(_0x4dfdd2){logger[_0x24ab('0x58')](_0x4dfdd2);handleError(_0x4dfdd2,!![]);};var _0x4d6f6c=fs[_0x24ab('0x6f')](_0x96fdd5);if(_0x4d6f6c[_0x24ab('0x3e')]>0x1){removeReferences(_0x3afacb,_0x96fdd5);logger['error'](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}var _0x2eba1d=fs[_0x24ab('0x71')](path['join'](_0x96fdd5,_0x4d6f6c[0x0]));if(_0x2eba1d[_0x24ab('0x72')]()){removeReferences(_0x3afacb,_0x96fdd5);logger[_0x24ab('0x58')](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}if(_0x2eba1d[_0x24ab('0x73')]()){var _0x38e27f=fs['readdirSync'](path[_0x24ab('0x51')](_0x96fdd5,_0x4d6f6c[0x0]));if(_0x38e27f['length']===0x0){removeReferences(_0x3afacb,_0x96fdd5);logger[_0x24ab('0x58')](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}var _0x180f9c=_0x38e27f[_0x24ab('0x74')](function(_0x23facb){return _0x23facb===_0x24ab('0x75');});if(!_0x180f9c){return _0x24e2a6(new Error(_0x24ab('0x76')));}var _0x57221e=fs[_0x24ab('0x77')](path['join'](_0x96fdd5,_0x4d6f6c[0x0],'manifest.json'));var _0x55087d=JSON[_0x24ab('0x78')](_0x57221e);if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x2f')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x35')]){return _0x24e2a6(new Error(_0x24ab('0x79')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7a')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x55087d[_0x24ab('0x7b')]){return _0x24e2a6(new Error(_0x24ab('0x7c')));}if(_0x55087d[_0x24ab('0x35')]==='html'){if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]){return _0x24e2a6(new Error(_0x24ab('0x7e')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')]&&_0x24ab('0x24')==typeof _0x55087d['parameters'][_0x24ab('0x7d')][_0x24ab('0x80')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x55087d[_0x24ab('0x35')]===_0x24ab('0x81')){if('undefined'==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x82')]){return _0x24e2a6(new Error(_0x24ab('0x83')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x84')]){return _0x24e2a6(new Error(_0x24ab('0x85')));}}else{return _0x24e2a6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x190ebd=_0x55087d[_0x24ab('0x2f')];var _0x2409cf=_0x55087d[_0x24ab('0x86')];var _0x446328=_0x55087d['type'];var _0x2416e2=_0x55087d[_0x24ab('0x87')]?_0x55087d[_0x24ab('0x87')]:_0x24ab('0x88');var _0x70d504=_0x55087d[_0x24ab('0x89')]?_0x55087d['icon']:_0x24ab('0x8a');var _0xede5e0='';var _0x457581='';var _0x4d812b='';var _0xbed395='';var _0x17db13=_0x55087d['version'];if(_0x446328===_0x24ab('0x8b')){if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')]){var _0x2f064e=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x24ab('0x8c')](_0x2f064e)){_0xede5e0=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x2f064e);}else{_0xede5e0=_0x2f064e;}}else{logger[_0x24ab('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x24ab('0x24')!=typeof _0x55087d['parameters'][_0x24ab('0x7d')][_0x24ab('0x80')]){var _0x505996=_0x55087d['parameters']['views'][_0x24ab('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x505996)){_0x457581=path['join'](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x505996);}else{_0x457581=_0x505996;}}else{logger[_0x24ab('0x67')](_0x24ab('0x8e'));}}else if(_0x446328===_0x24ab('0x81')){_0x4d812b=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x82')];_0xbed395=_0x55087d['parameters'][_0x24ab('0x84')];if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]){if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')]['views'][_0x24ab('0x7f')]){var _0x2f064e=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2f064e)){_0xede5e0=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x2f064e);}else{_0xede5e0=_0x2f064e;}}if('undefined'!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x80')]){var _0x505996=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x24ab('0x8c')](_0x505996)){_0x457581=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x505996);}else{_0x457581=_0x505996;}}}}var _0x2c98a2={'name':_0x190ebd,'description':_0x2409cf,'path':path[_0x24ab('0x51')](_0x2fa455,_0x4d6f6c[0x0]),'type':_0x446328,'sidebar':_0x2416e2,'icon':_0x70d504,'adminUrl':_0xede5e0,'agentUrl':_0x457581,'scriptName':_0x4d812b,'scriptPath':_0xbed395,'version':_0x17db13};removeReferences(_0x3afacb,null);return db[_0x24ab('0x32')][_0x24ab('0x8f')](_0x2c98a2)[_0x24ab('0x2b')](function(_0xaf5a6f){var _0x194320={'role':_0x123cbf['body'][_0x24ab('0x90')],'userProfileId':_0x123cbf[_0x24ab('0x91')][_0x24ab('0x92')]};if(!_0x194320)throw new Error(_0x24ab('0x93'));if(_0x194320[_0x24ab('0x90')]==='user'){var _0x109a51=_0xaf5a6f[_0x24ab('0x94')]({'plain':!![]});return db['UserProfileSection'][_0x24ab('0x4e')]({'where':{'name':_0x24ab('0x95'),'userProfileId':_0x194320[_0x24ab('0x92')]},'raw':!![]})[_0x24ab('0x2b')](function(_0x11c525){if(_0x11c525&&_0x11c525[_0x24ab('0x96')]===0x0){return db[_0x24ab('0x2c')][_0x24ab('0x8f')]({'name':_0x109a51[_0x24ab('0x2f')],'resourceId':_0x109a51['id'],'type':_0x11c525[_0x24ab('0x2f')],'sectionId':_0x11c525['id']},{})[_0x24ab('0x2b')](function(){return _0xaf5a6f;});}else{return _0xaf5a6f;}})[_0x24ab('0x4b')](function(_0x414a32){logger[_0x24ab('0x58')](_0x24ab('0x97'),_0x414a32);throw _0x414a32;});}return _0xaf5a6f;})[_0x24ab('0x2b')](respondWithResult(_0x36de99,null))[_0x24ab('0x4b')](handleError(_0x36de99,null));}});}catch(_0x4fb4b6){_0x36de99[_0x24ab('0x20')](0x1f4)[_0x24ab('0x30')](_0x4fb4b6);}};function removeReferences(_0x4eb26b,_0x5940b8){try{if(_0x4eb26b){fs[_0x24ab('0x66')](_0x4eb26b);logger[_0x24ab('0x67')]('Zip\x20archive\x20removed');}if(_0x5940b8){rimraf(_0x5940b8,function(){});logger[_0x24ab('0x67')](_0x24ab('0x98'));}}catch(_0x14e606){logger['error'](_0x14e606);}}exports[_0x24ab('0x2a')]=function(_0x2b227b,_0x5ac2da,_0x545483){return db[_0x24ab('0x32')][_0x24ab('0x4e')]({'where':{'id':_0x2b227b['params']['id']}})[_0x24ab('0x2b')](handleEntityNotFound(_0x5ac2da,null))[_0x24ab('0x2b')](saveUpdates(_0x2b227b[_0x24ab('0x91')],null))[_0x24ab('0x2b')](respondWithResult(_0x5ac2da,null))[_0x24ab('0x4b')](handleError(_0x5ac2da,null));};exports['delete']=function(_0x1d7df9,_0x37ea69,_0x2ba2ad){return db[_0x24ab('0x32')]['find']({'where':{'id':_0x1d7df9[_0x24ab('0x50')]['id']}})[_0x24ab('0x2b')](function(_0x415c53){if(_0x415c53){return _0x415c53['destroy']();}})[_0x24ab('0x2b')](function(_0x98327a){rimraf(path[_0x24ab('0x51')](config[_0x24ab('0x52')],'server/files/plugins',path['dirname'](_0x98327a[_0x24ab('0x7')])),function(){});return _0x98327a;})[_0x24ab('0x2b')](handleEntityNotFound(_0x37ea69,null))[_0x24ab('0x2b')](respondWithStatusCode(_0x37ea69,null))['catch'](handleError(_0x37ea69,null));};exports[_0x24ab('0x99')]=function(_0x2edc67,_0x432266,_0x1b5bfd){return BPromise[_0x24ab('0x9a')]()[_0x24ab('0x2b')](function(){if(!_0x2edc67['query'][_0x24ab('0x7')]){throw new Error(_0x24ab('0x9b'));}if(!_0x2edc67['query'][_0x24ab('0x9c')]){throw new Error(_0x24ab('0x9d'));}var _0x5f2947=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9e')]?_0x2edc67[_0x24ab('0x38')]['hostname']+':'+_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9c')]:'http://localhost:'+_0x2edc67['query'][_0x24ab('0x9c')];var _0x2cf9f7=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x22')]?_0x2edc67[_0x24ab('0x38')][_0x24ab('0x22')]:!![];var _0x372c8c=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9f')]?_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9f')]:null;var _0x1465cb={'method':_0x2edc67['method'],'uri':util[_0x24ab('0x65')](_0x24ab('0xa0'),_0x5f2947,_0x2edc67['query'][_0x24ab('0x7')]),'json':_0x2cf9f7,'resolveWithFullResponse':!![],'encoding':_0x372c8c,'qs':_0x2edc67[_0x24ab('0x38')]};if(_0x2edc67[_0x24ab('0xa1')]){_0x1465cb[_0x24ab('0xa1')]=_0x2edc67[_0x24ab('0xa1')];if(_0x1465cb[_0x24ab('0xa1')][_0x24ab('0xa2')]){delete _0x1465cb['headers'][_0x24ab('0xa2')];}}if(_0x1465cb[_0x24ab('0xa1')][_0x24ab('0xa3')]){delete _0x1465cb['headers'][_0x24ab('0xa3')];}return rp(_0x1465cb);})[_0x24ab('0x2b')](function(_0x5b4385){if(_0x5b4385){_0x432266[_0x24ab('0x27')](_0x5b4385[_0x24ab('0xa1')]);logger[_0x24ab('0x67')](_0x5b4385[_0x24ab('0x91')]);if(_[_0x24ab('0xa4')](_0x2edc67[_0x24ab('0x38')][_0x24ab('0x7')],_0x24ab('0x4f'))&&_0x5b4385[_0x24ab('0xa5')]==0x1f4){return _0x432266['sendStatus'](_0x5b4385[_0x24ab('0xa5')]);}else{return _0x432266[_0x24ab('0x20')](_0x5b4385[_0x24ab('0xa5')])[_0x24ab('0x30')](_0x5b4385[_0x24ab('0x91')]);}}else{return _0x432266[_0x24ab('0x1f')](0xc8);}})[_0x24ab('0x4b')](handleError(_0x432266,null));};exports[_0x24ab('0xa6')]=function(_0x3bc019,_0x1521e4,_0x465b15){return BPromise['resolve']()['then'](function(){if(!_0x3bc019[_0x24ab('0x38')][_0x24ab('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3bc019['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x30228f=_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9e')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9e')]+':'+_0x3bc019['query']['port']:'http://localhost:'+_0x3bc019['query'][_0x24ab('0x9c')];var _0x307bbb=_0x3bc019['query'][_0x24ab('0x22')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x22')]:!![];var _0x3f6fec=_0x3bc019['query'][_0x24ab('0x9f')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9f')]:null;var _0x2a951a={'method':_0x3bc019[_0x24ab('0xa7')],'uri':util[_0x24ab('0x65')](_0x24ab('0xa0'),_0x30228f,_0x3bc019['query'][_0x24ab('0x7')]),'json':_0x307bbb,'resolveWithFullResponse':!![],'encoding':_0x3f6fec,'body':_0x3bc019[_0x24ab('0x91')]};if(_0x3bc019[_0x24ab('0xa1')]){_0x2a951a[_0x24ab('0xa1')]=_0x3bc019[_0x24ab('0xa1')];if(_0x2a951a['headers'][_0x24ab('0xa2')]){delete _0x2a951a[_0x24ab('0xa1')][_0x24ab('0xa2')];}}if(_0x2a951a[_0x24ab('0xa1')]['content-type']){delete _0x2a951a[_0x24ab('0xa1')][_0x24ab('0xa3')];}return rp(_0x2a951a);})[_0x24ab('0x2b')](function(_0x171a31){if(_0x171a31){_0x1521e4[_0x24ab('0x27')](_0x171a31[_0x24ab('0xa1')]);logger[_0x24ab('0x67')](_0x171a31[_0x24ab('0x91')]);return _0x1521e4['status'](_0x171a31['statusCode'])[_0x24ab('0x30')](_0x171a31['body']);}else{return _0x1521e4['sendStatus'](0xc8);}})[_0x24ab('0x4b')](handleError(_0x1521e4,null));}; \ No newline at end of file +var _0x2ef7=['join','root','format','basename','createWriteStream','warning','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','userProfileId','user','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','http://localhost:','method','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','Plugins','error','stack','name','index','map','Plugin','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','intersection','find'];(function(_0x2e8a55,_0x374674){var _0x4ec89e=function(_0x46979a){while(--_0x46979a){_0x2e8a55['push'](_0x2e8a55['shift']());}};_0x4ec89e(++_0x374674);}(_0x2ef7,0xfc));var _0x72ef=function(_0x4ba81b,_0x14b578){_0x4ba81b=_0x4ba81b-0x0;var _0x20efdc=_0x2ef7[_0x4ba81b];return _0x20efdc;};'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(_0x72ef('0x0'));var moment=require(_0x72ef('0x1'));var BPromise=require(_0x72ef('0x2'));var Mustache=require(_0x72ef('0x3'));var util=require(_0x72ef('0x4'));var path=require(_0x72ef('0x5'));var sox=require(_0x72ef('0x6'));var csv=require(_0x72ef('0x7'));var ejs=require(_0x72ef('0x8'));var fs=require('fs');var fs_extra=require(_0x72ef('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x72ef('0xa'));var jsforce=require(_0x72ef('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x72ef('0x7'));var querystring=require(_0x72ef('0xc'));var Papa=require(_0x72ef('0xd'));var extract=require(_0x72ef('0xe'));var rimraf=require('rimraf');var archiver=require(_0x72ef('0xf'));var Redis=require(_0x72ef('0x10'));var authService=require(_0x72ef('0x11'));var qs=require(_0x72ef('0x12'));var as=require(_0x72ef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72ef('0x14'))(_0x72ef('0x15'));var utils=require(_0x72ef('0x16'));var config=require(_0x72ef('0x17'));var licenseUtil=require(_0x72ef('0x18'));var db=require(_0x72ef('0x19'))['db'];config[_0x72ef('0x1a')]=_[_0x72ef('0x1b')](config[_0x72ef('0x1a')],{'host':_0x72ef('0x1c'),'port':0x18eb});var socket=require(_0x72ef('0x1d'))(new Redis(config['redis']));require(_0x72ef('0x1e'))[_0x72ef('0x1f')](socket);function respondWithStatusCode(_0x502e4e,_0x913283){_0x913283=_0x913283||0xcc;return function(_0x1bdda5){if(_0x1bdda5){return _0x502e4e[_0x72ef('0x20')](_0x913283);}return _0x502e4e[_0x72ef('0x21')](_0x913283)['end']();};}function respondWithResult(_0x54f21f,_0x2230ed){_0x2230ed=_0x2230ed||0xc8;return function(_0x358cb2){if(_0x358cb2){return _0x54f21f[_0x72ef('0x21')](_0x2230ed)['json'](_0x358cb2);}};}function respondWithFilteredResult(_0x651b61,_0xc1e8e2){return function(_0x345536){if(_0x345536){var _0x408ebe=typeof _0xc1e8e2[_0x72ef('0x22')]===_0x72ef('0x23')&&typeof _0xc1e8e2['limit']===_0x72ef('0x23');var _0x2041b7=_0x345536['count'];var _0x38a3b1=_0x408ebe?0x0:_0xc1e8e2[_0x72ef('0x22')];var _0x545617=_0x408ebe?_0x345536['count']:_0xc1e8e2[_0x72ef('0x22')]+_0xc1e8e2[_0x72ef('0x24')];var _0x2965ea;if(_0x545617>=_0x2041b7){_0x545617=_0x2041b7;_0x2965ea=0xc8;}else{_0x2965ea=0xce;}_0x651b61[_0x72ef('0x21')](_0x2965ea);return _0x651b61[_0x72ef('0x25')](_0x72ef('0x26'),_0x38a3b1+'-'+_0x545617+'/'+_0x2041b7)[_0x72ef('0x27')](_0x345536);}return null;};}function patchUpdates(_0x5127b5){return function(_0x560e2b){try{jsonpatch[_0x72ef('0x28')](_0x560e2b,_0x5127b5,!![]);}catch(_0x1069cd){return BPromise['reject'](_0x1069cd);}return _0x560e2b[_0x72ef('0x29')]();};}function saveUpdates(_0x2db95c,_0xc5d24b){return function(_0x324a5b){if(_0x324a5b){return _0x324a5b[_0x72ef('0x2a')](_0x2db95c)[_0x72ef('0x2b')](function(_0x30cdc0){return _0x30cdc0;});}return null;};}function removeEntity(_0x2b18b4,_0x41fa63){return function(_0x4bf5a0){if(_0x4bf5a0){return _0x4bf5a0[_0x72ef('0x2c')]()[_0x72ef('0x2b')](function(){var _0x187c71=_0x4bf5a0['get']({'plain':!![]});var _0x2eab17=_0x72ef('0x2d');return db['UserProfileResource'][_0x72ef('0x2c')]({'where':{'type':_0x2eab17,'resourceId':_0x187c71['id']}})['then'](function(){return _0x4bf5a0;});})[_0x72ef('0x2b')](function(){_0x2b18b4[_0x72ef('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54bc8a,_0x4f0e1e){return function(_0x5a06e9){if(!_0x5a06e9){_0x54bc8a[_0x72ef('0x20')](0x194);}return _0x5a06e9;};}function handleError(_0x26e252,_0x1cdf27){_0x1cdf27=_0x1cdf27||0x1f4;return function(_0x52a09f){logger[_0x72ef('0x2e')](_0x52a09f[_0x72ef('0x2f')]);if(_0x52a09f['name']){delete _0x52a09f[_0x72ef('0x30')];}_0x26e252['status'](_0x1cdf27)['send'](_0x52a09f);};}exports[_0x72ef('0x31')]=function(_0x97005a,_0xa90df8){var _0x4e2c40={},_0x49e604={},_0x59e2c0={'count':0x0,'rows':[]};var _0x56875f=_[_0x72ef('0x32')](db[_0x72ef('0x33')][_0x72ef('0x34')],function(_0x2be112){return{'name':_0x2be112['fieldName'],'type':_0x2be112[_0x72ef('0x35')]['key']};});_0x49e604[_0x72ef('0x36')]=_[_0x72ef('0x32')](_0x56875f,_0x72ef('0x30'));_0x49e604[_0x72ef('0x37')]=_[_0x72ef('0x38')](_0x97005a[_0x72ef('0x37')]);_0x49e604[_0x72ef('0x39')]=_['intersection'](_0x49e604[_0x72ef('0x36')],_0x49e604[_0x72ef('0x37')]);_0x4e2c40[_0x72ef('0x3a')]=_['intersection'](_0x49e604[_0x72ef('0x36')],qs[_0x72ef('0x3b')](_0x97005a['query'][_0x72ef('0x3b')]));_0x4e2c40[_0x72ef('0x3a')]=_0x4e2c40[_0x72ef('0x3a')][_0x72ef('0x3c')]?_0x4e2c40[_0x72ef('0x3a')]:_0x49e604[_0x72ef('0x36')];if(!_0x97005a[_0x72ef('0x37')][_0x72ef('0x3d')]('nolimit')){_0x4e2c40[_0x72ef('0x24')]=qs['limit'](_0x97005a['query'][_0x72ef('0x24')]);_0x4e2c40[_0x72ef('0x22')]=qs[_0x72ef('0x22')](_0x97005a[_0x72ef('0x37')][_0x72ef('0x22')]);}_0x4e2c40[_0x72ef('0x3e')]=qs['sort'](_0x97005a[_0x72ef('0x37')][_0x72ef('0x3f')]);_0x4e2c40[_0x72ef('0x40')]=qs[_0x72ef('0x39')](_[_0x72ef('0x41')](_0x97005a[_0x72ef('0x37')],_0x49e604['filters']),_0x56875f);if(_0x97005a['query']['filter']){_0x4e2c40[_0x72ef('0x40')]=_['merge'](_0x4e2c40[_0x72ef('0x40')],{'$or':_[_0x72ef('0x32')](_0x56875f,function(_0x239a7c){if(_0x239a7c[_0x72ef('0x35')]!==_0x72ef('0x42')){var _0x51ca4b={};_0x51ca4b[_0x239a7c['name']]={'$like':'%'+_0x97005a['query'][_0x72ef('0x43')]+'%'};return _0x51ca4b;}})});}_0x4e2c40=_['merge']({},_0x4e2c40,_0x97005a[_0x72ef('0x44')]);var _0x219379={'where':_0x4e2c40[_0x72ef('0x40')]};return db['Plugin'][_0x72ef('0x45')](_0x219379)['then'](function(_0x4bb30c){_0x59e2c0['count']=_0x4bb30c;if(_0x97005a[_0x72ef('0x37')][_0x72ef('0x46')]){_0x4e2c40[_0x72ef('0x47')]=[{'all':!![]}];}return db[_0x72ef('0x33')][_0x72ef('0x48')](_0x4e2c40);})[_0x72ef('0x2b')](function(_0x584e78){_0x59e2c0[_0x72ef('0x49')]=_0x584e78;return _0x59e2c0;})[_0x72ef('0x2b')](respondWithFilteredResult(_0xa90df8,_0x4e2c40))[_0x72ef('0x4a')](handleError(_0xa90df8,null));};exports['show']=function(_0x486a72,_0x3ca354){var _0x37ad13={'raw':!![],'where':{'id':_0x486a72[_0x72ef('0x4b')]['id']}},_0x3de0a3={};_0x3de0a3[_0x72ef('0x36')]=_[_0x72ef('0x38')](db[_0x72ef('0x33')][_0x72ef('0x34')]);_0x3de0a3[_0x72ef('0x37')]=_[_0x72ef('0x38')](_0x486a72['query']);_0x3de0a3[_0x72ef('0x39')]=_['intersection'](_0x3de0a3[_0x72ef('0x36')],_0x3de0a3[_0x72ef('0x37')]);_0x37ad13[_0x72ef('0x3a')]=_[_0x72ef('0x4c')](_0x3de0a3[_0x72ef('0x36')],qs[_0x72ef('0x3b')](_0x486a72[_0x72ef('0x37')][_0x72ef('0x3b')]));_0x37ad13[_0x72ef('0x3a')]=_0x37ad13[_0x72ef('0x3a')][_0x72ef('0x3c')]?_0x37ad13[_0x72ef('0x3a')]:_0x3de0a3[_0x72ef('0x36')];if(_0x486a72['query']['includeAll']){_0x37ad13[_0x72ef('0x47')]=[{'all':!![]}];}_0x37ad13=_['merge']({},_0x37ad13,_0x486a72[_0x72ef('0x44')]);return db['Plugin'][_0x72ef('0x4d')](_0x37ad13)['then'](handleEntityNotFound(_0x3ca354,null))[_0x72ef('0x2b')](respondWithResult(_0x3ca354,null))['catch'](handleError(_0x3ca354,null));};exports['download']=function(_0x2eb805,_0x5894b4,_0x15f1f7){return db[_0x72ef('0x33')]['find']({'where':{'id':_0x2eb805[_0x72ef('0x4b')]['id']},'attributes':[_0x72ef('0x30'),_0x72ef('0x5')],'raw':!![]})[_0x72ef('0x2b')](handleEntityNotFound(_0x5894b4,null))[_0x72ef('0x2b')](function(_0x40f418){if(_0x40f418){var _0x28e62d=path[_0x72ef('0x4e')](config[_0x72ef('0x4f')],'server/files/plugins',util[_0x72ef('0x50')]('%s.zip',path[_0x72ef('0x51')](_0x40f418['path'])));var _0x83276a=fs[_0x72ef('0x52')](_0x28e62d);var _0x512691=archiver('zip',{'zlib':{'level':0x9}});_0x512691['on'](_0x72ef('0x53'),function(_0x20feb6){if(_0x20feb6['code']==='ENOENT'){logger[_0x72ef('0x2e')](_0x20feb6);}else{throw new db['Sequelize'][(_0x72ef('0x54'))](_0x72ef('0x55'));}});_0x512691['on'](_0x72ef('0x2e'),function(_0x4c1d1f){throw new db['Sequelize'][(_0x72ef('0x54'))](_0x72ef('0x55'));});_0x512691[_0x72ef('0x56')](_0x83276a);_0x512691[_0x72ef('0x57')](_0x72ef('0x58'),{'cwd':path['join'](config['root'],_0x72ef('0x59'),path[_0x72ef('0x5a')](_0x40f418[_0x72ef('0x5')])),'ignore':[path[_0x72ef('0x4e')](path['basename'](_0x40f418[_0x72ef('0x5')]),_0x72ef('0x5b')),path[_0x72ef('0x4e')](path[_0x72ef('0x51')](_0x40f418[_0x72ef('0x5')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x83276a['on'](_0x72ef('0x5c'),function(){if(!fs[_0x72ef('0x5d')](_0x28e62d)){throw new db['Sequelize']['Error'](_0x72ef('0x5e'));}return _0x5894b4[_0x72ef('0x5f')](_0x28e62d,util[_0x72ef('0x50')](_0x72ef('0x60'),path[_0x72ef('0x51')](_0x40f418['path'])),function(_0x30b0f1){if(_0x30b0f1){throw new db[(_0x72ef('0x61'))][(_0x72ef('0x54'))](_0x72ef('0x62'));}fs[_0x72ef('0x63')](_0x28e62d);logger[_0x72ef('0x64')]('Download\x20completed');logger[_0x72ef('0x64')]('Temporary\x20file\x20removed');});});}return null;})[_0x72ef('0x4a')](handleError(_0x5894b4,null));};exports[_0x72ef('0x65')]=function(_0x31110e,_0x135775,_0x5bf34b){var _0x2f496d=path['basename'](_0x31110e[_0x72ef('0x66')][_0x72ef('0x67')],path[_0x72ef('0x68')](_0x31110e['file'][_0x72ef('0x67')]));var _0x19f3ba=path[_0x72ef('0x4e')](config[_0x72ef('0x4f')],_0x72ef('0x59'),_0x31110e[_0x72ef('0x66')][_0x72ef('0x67')]);var _0xee5714=path[_0x72ef('0x4e')](config[_0x72ef('0x4f')],_0x72ef('0x59'),_0x2f496d);logger[_0x72ef('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x19f3ba);logger[_0x72ef('0x64')](_0x72ef('0x69'),_0xee5714);try{fs[_0x72ef('0x6a')](_0x19f3ba,parseInt(_0x72ef('0x6b'),0x8));extract(_0x19f3ba,{'dir':_0xee5714},function(_0x55be0c){if(_0x55be0c){logger[_0x72ef('0x2e')](_0x55be0c);handleError(_0x55be0c,!![]);};var _0xf96fe3=fs[_0x72ef('0x6c')](_0xee5714);if(_0xf96fe3[_0x72ef('0x3c')]>0x1){removeReferences(_0x19f3ba,_0xee5714);logger[_0x72ef('0x2e')](_0x72ef('0x6d'));return _0x5bf34b(new Error('Invalid\x20plugin\x20structure'));}var _0x1b516b=fs['lstatSync'](path[_0x72ef('0x4e')](_0xee5714,_0xf96fe3[0x0]));if(_0x1b516b[_0x72ef('0x6e')]()){removeReferences(_0x19f3ba,_0xee5714);logger[_0x72ef('0x2e')](_0x72ef('0x6d'));return _0x5bf34b(new Error(_0x72ef('0x6d')));}if(_0x1b516b['isDirectory']()){var _0x59e3dd=fs[_0x72ef('0x6c')](path[_0x72ef('0x4e')](_0xee5714,_0xf96fe3[0x0]));if(_0x59e3dd[_0x72ef('0x3c')]===0x0){removeReferences(_0x19f3ba,_0xee5714);logger[_0x72ef('0x2e')](_0x72ef('0x6d'));return _0x5bf34b(new Error(_0x72ef('0x6d')));}var _0x34a028=_0x59e3dd[_0x72ef('0x6f')](function(_0x3e85a5){return _0x3e85a5===_0x72ef('0x70');});if(!_0x34a028){return _0x5bf34b(new Error('Plugin\x20manifest\x20missing'));}var _0x3a4632=fs[_0x72ef('0x71')](path[_0x72ef('0x4e')](_0xee5714,_0xf96fe3[0x0],'manifest.json'));var _0x21ecdb=JSON['parse'](_0x3a4632);if(_0x72ef('0x23')==typeof _0x21ecdb['name']){return _0x5bf34b(new Error(_0x72ef('0x72')));}if(_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x35')]){return _0x5bf34b(new Error(_0x72ef('0x73')));}if(_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x74')]){return _0x5bf34b(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x72ef('0x23')==typeof _0x21ecdb['parameters']){return _0x5bf34b(new Error(_0x72ef('0x75')));}if(_0x21ecdb['type']===_0x72ef('0x76')){if(_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')]){return _0x5bf34b(new Error(_0x72ef('0x79')));}if(_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')]['admin']&&_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x7a')]){return _0x5bf34b(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x21ecdb['type']==='script'){if(_0x72ef('0x23')==typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x7b')]){return _0x5bf34b(new Error(_0x72ef('0x7c')));}if(_0x72ef('0x23')==typeof _0x21ecdb['parameters']['scriptPath']){return _0x5bf34b(new Error(_0x72ef('0x7d')));}}else{return _0x5bf34b(new Error(_0x72ef('0x7e')));}var _0x235107=_0x21ecdb['name'];var _0x3e63b2=_0x21ecdb[_0x72ef('0x7f')];var _0x2aac8d=_0x21ecdb['type'];var _0x107a2e=_0x21ecdb[_0x72ef('0x80')]?_0x21ecdb[_0x72ef('0x80')]:_0x72ef('0x81');var _0x431bda=_0x21ecdb[_0x72ef('0x82')]?_0x21ecdb[_0x72ef('0x82')]:_0x72ef('0x83');var _0x455fe2='';var _0x59a132='';var _0x4e334a='';var _0x3f8f2a='';var _0x2cbeae=_0x21ecdb[_0x72ef('0x74')];if(_0x2aac8d===_0x72ef('0x76')){if(_0x72ef('0x23')!=typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')]['admin']){var _0x3b3a1e=_0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x72ef('0x85')](_0x3b3a1e)){_0x455fe2=path[_0x72ef('0x4e')](_0x72ef('0x86'),_0x2f496d,_0xf96fe3[0x0],_0x3b3a1e);}else{_0x455fe2=_0x3b3a1e;}}else{logger[_0x72ef('0x64')](_0x72ef('0x87'));}if(_0x72ef('0x23')!=typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x7a')]){var _0x3a2f0f=_0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3a2f0f)){_0x59a132=path[_0x72ef('0x4e')](_0x72ef('0x86'),_0x2f496d,_0xf96fe3[0x0],_0x3a2f0f);}else{_0x59a132=_0x3a2f0f;}}else{logger[_0x72ef('0x64')](_0x72ef('0x88'));}}else if(_0x2aac8d===_0x72ef('0x89')){_0x4e334a=_0x21ecdb[_0x72ef('0x77')][_0x72ef('0x7b')];_0x3f8f2a=_0x21ecdb['parameters']['scriptPath'];if(_0x72ef('0x23')!=typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')]){if(_0x72ef('0x23')!=typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x84')]){var _0x3b3a1e=_0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3b3a1e)){_0x455fe2=path['join'](_0x72ef('0x86'),_0x2f496d,_0xf96fe3[0x0],_0x3b3a1e);}else{_0x455fe2=_0x3b3a1e;}}if('undefined'!=typeof _0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')]['agent']){var _0x3a2f0f=_0x21ecdb[_0x72ef('0x77')][_0x72ef('0x78')][_0x72ef('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3a2f0f)){_0x59a132=path[_0x72ef('0x4e')](_0x72ef('0x86'),_0x2f496d,_0xf96fe3[0x0],_0x3a2f0f);}else{_0x59a132=_0x3a2f0f;}}}}var _0x5ad023={'name':_0x235107,'description':_0x3e63b2,'path':path[_0x72ef('0x4e')](_0x2f496d,_0xf96fe3[0x0]),'type':_0x2aac8d,'sidebar':_0x107a2e,'icon':_0x431bda,'adminUrl':_0x455fe2,'agentUrl':_0x59a132,'scriptName':_0x4e334a,'scriptPath':_0x3f8f2a,'version':_0x2cbeae};removeReferences(_0x19f3ba,null);return db['Plugin'][_0x72ef('0x8a')](_0x5ad023)[_0x72ef('0x2b')](function(_0x41c14b){var _0x409b86={'role':_0x31110e['body'][_0x72ef('0x8b')],'userProfileId':_0x31110e['body'][_0x72ef('0x8c')]};if(!_0x409b86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x409b86['role']===_0x72ef('0x8d')){var _0x32b703=_0x41c14b[_0x72ef('0x8e')]({'plain':!![]});return db[_0x72ef('0x8f')][_0x72ef('0x4d')]({'where':{'name':_0x72ef('0x2d'),'userProfileId':_0x409b86['userProfileId']},'raw':!![]})['then'](function(_0x24037c){if(_0x24037c&&_0x24037c['autoAssociation']===0x0){return db[_0x72ef('0x90')]['create']({'name':_0x32b703['name'],'resourceId':_0x32b703['id'],'type':_0x24037c[_0x72ef('0x30')],'sectionId':_0x24037c['id']},{})[_0x72ef('0x2b')](function(){return _0x41c14b;});}else{return _0x41c14b;}})[_0x72ef('0x4a')](function(_0x270af5){logger[_0x72ef('0x2e')](_0x72ef('0x91'),_0x270af5);throw _0x270af5;});}return _0x41c14b;})[_0x72ef('0x2b')](respondWithResult(_0x135775,null))[_0x72ef('0x4a')](handleError(_0x135775,null));}});}catch(_0x2d6829){_0x135775[_0x72ef('0x21')](0x1f4)['send'](_0x2d6829);}};function removeReferences(_0x325d3f,_0x4f6d09){try{if(_0x325d3f){fs[_0x72ef('0x63')](_0x325d3f);logger[_0x72ef('0x64')](_0x72ef('0x92'));}if(_0x4f6d09){rimraf(_0x4f6d09,function(){});logger[_0x72ef('0x64')](_0x72ef('0x93'));}}catch(_0x4b95da){logger[_0x72ef('0x2e')](_0x4b95da);}}exports[_0x72ef('0x2a')]=function(_0x5e495c,_0x4fde91,_0xd5b939){return db[_0x72ef('0x33')][_0x72ef('0x4d')]({'where':{'id':_0x5e495c['params']['id']}})[_0x72ef('0x2b')](handleEntityNotFound(_0x4fde91,null))[_0x72ef('0x2b')](saveUpdates(_0x5e495c[_0x72ef('0x94')],null))[_0x72ef('0x2b')](respondWithResult(_0x4fde91,null))[_0x72ef('0x4a')](handleError(_0x4fde91,null));};exports['delete']=function(_0x4bb671,_0x58b93a,_0x42fa34){return db[_0x72ef('0x33')][_0x72ef('0x4d')]({'where':{'id':_0x4bb671[_0x72ef('0x4b')]['id']}})[_0x72ef('0x2b')](function(_0x2a5544){if(_0x2a5544){return _0x2a5544['destroy']();}})['then'](function(_0x368fa5){rimraf(path[_0x72ef('0x4e')](config[_0x72ef('0x4f')],'server/files/plugins',path[_0x72ef('0x5a')](_0x368fa5[_0x72ef('0x5')])),function(){});return _0x368fa5;})['then'](handleEntityNotFound(_0x58b93a,null))[_0x72ef('0x2b')](respondWithStatusCode(_0x58b93a,null))[_0x72ef('0x4a')](handleError(_0x58b93a,null));};exports[_0x72ef('0x95')]=function(_0x586160,_0x503721,_0x80ade0){return BPromise[_0x72ef('0x96')]()[_0x72ef('0x2b')](function(){if(!_0x586160[_0x72ef('0x37')][_0x72ef('0x5')]){throw new Error(_0x72ef('0x97'));}if(!_0x586160[_0x72ef('0x37')][_0x72ef('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1f5355=_0x586160['query'][_0x72ef('0x99')]?_0x586160[_0x72ef('0x37')][_0x72ef('0x99')]+':'+_0x586160[_0x72ef('0x37')]['port']:'http://localhost:'+_0x586160[_0x72ef('0x37')][_0x72ef('0x98')];var _0x32378b=_0x586160['query']['json']?_0x586160[_0x72ef('0x37')][_0x72ef('0x27')]:!![];var _0x45e86c=_0x586160[_0x72ef('0x37')][_0x72ef('0x9a')]?_0x586160[_0x72ef('0x37')]['encoding']:null;var _0x13bcce={'method':_0x586160['method'],'uri':util['format'](_0x72ef('0x9b'),_0x1f5355,_0x586160[_0x72ef('0x37')]['path']),'json':_0x32378b,'resolveWithFullResponse':!![],'encoding':_0x45e86c,'qs':_0x586160[_0x72ef('0x37')]};if(_0x586160[_0x72ef('0x9c')]){_0x13bcce[_0x72ef('0x9c')]=_0x586160[_0x72ef('0x9c')];if(_0x13bcce[_0x72ef('0x9c')][_0x72ef('0x9d')]){delete _0x13bcce[_0x72ef('0x9c')][_0x72ef('0x9d')];}}if(_0x13bcce[_0x72ef('0x9c')]['content-type']){delete _0x13bcce[_0x72ef('0x9c')][_0x72ef('0x9e')];}return rp(_0x13bcce);})['then'](function(_0x14e414){if(_0x14e414){_0x503721[_0x72ef('0x25')](_0x14e414[_0x72ef('0x9c')]);logger[_0x72ef('0x64')](_0x14e414[_0x72ef('0x94')]);if(_[_0x72ef('0x9f')](_0x586160['query'][_0x72ef('0x5')],_0x72ef('0x5f'))&&_0x14e414[_0x72ef('0xa0')]==0x1f4){return _0x503721['sendStatus'](_0x14e414['statusCode']);}else{return _0x503721[_0x72ef('0x21')](_0x14e414['statusCode'])[_0x72ef('0xa1')](_0x14e414[_0x72ef('0x94')]);}}else{return _0x503721['sendStatus'](0xc8);}})[_0x72ef('0x4a')](handleError(_0x503721,null));};exports[_0x72ef('0xa2')]=function(_0x1f0a8f,_0x2268a3,_0x54ed38){return BPromise[_0x72ef('0x96')]()[_0x72ef('0x2b')](function(){if(!_0x1f0a8f['query'][_0x72ef('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1f0a8f['query'][_0x72ef('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3bf868=_0x1f0a8f[_0x72ef('0x37')]['hostname']?_0x1f0a8f[_0x72ef('0x37')][_0x72ef('0x99')]+':'+_0x1f0a8f[_0x72ef('0x37')]['port']:_0x72ef('0xa3')+_0x1f0a8f[_0x72ef('0x37')][_0x72ef('0x98')];var _0x2f1bb7=_0x1f0a8f['query'][_0x72ef('0x27')]?_0x1f0a8f[_0x72ef('0x37')][_0x72ef('0x27')]:!![];var _0x37a9e8=_0x1f0a8f[_0x72ef('0x37')]['encoding']?_0x1f0a8f[_0x72ef('0x37')]['encoding']:null;var _0x3e6afb={'method':_0x1f0a8f[_0x72ef('0xa4')],'uri':util[_0x72ef('0x50')](_0x72ef('0x9b'),_0x3bf868,_0x1f0a8f[_0x72ef('0x37')][_0x72ef('0x5')]),'json':_0x2f1bb7,'resolveWithFullResponse':!![],'encoding':_0x37a9e8,'body':_0x1f0a8f[_0x72ef('0x94')]};if(_0x1f0a8f['headers']){_0x3e6afb[_0x72ef('0x9c')]=_0x1f0a8f[_0x72ef('0x9c')];if(_0x3e6afb[_0x72ef('0x9c')][_0x72ef('0x9d')]){delete _0x3e6afb[_0x72ef('0x9c')][_0x72ef('0x9d')];}}if(_0x3e6afb[_0x72ef('0x9c')]['content-type']){delete _0x3e6afb['headers'][_0x72ef('0x9e')];}return rp(_0x3e6afb);})[_0x72ef('0x2b')](function(_0xb34fdd){if(_0xb34fdd){_0x2268a3[_0x72ef('0x25')](_0xb34fdd['headers']);logger[_0x72ef('0x64')](_0xb34fdd['body']);return _0x2268a3[_0x72ef('0x21')](_0xb34fdd[_0x72ef('0xa0')])[_0x72ef('0xa1')](_0xb34fdd[_0x72ef('0x94')]);}else{return _0x2268a3['sendStatus'](0xc8);}})[_0x72ef('0x4a')](handleError(_0x2268a3,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d21e67e..ee39fa4 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 _0x7dee=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','save','update'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0x7dee,0xb0));var _0xe7de=function(_0x85ad7b,_0x4b2f88){_0x85ad7b=_0x85ad7b-0x0;var _0x1bf56d=_0x7dee[_0x85ad7b];return _0x1bf56d;};'use strict';var EventEmitter=require(_0xe7de('0x0'));var Plugin=require('../../mysqldb')['db'][_0xe7de('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7de('0x2'),'afterUpdate':_0xe7de('0x3'),'afterDestroy':_0xe7de('0x4')};function emitEvent(_0x168aff){return function(_0x4b846b,_0x12be83,_0x544df8){PluginEvents[_0xe7de('0x5')](_0x168aff+':'+_0x4b846b['id'],_0x4b846b);PluginEvents[_0xe7de('0x5')](_0x168aff,_0x4b846b);_0x544df8(null);};}for(var e in events){if(events[_0xe7de('0x6')](e)){var event=events[e];Plugin[_0xe7de('0x7')](e,emitEvent(event));}}module[_0xe7de('0x8')]=PluginEvents; \ No newline at end of file +var _0x9300=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x9300,0x153));var _0x0930=function(_0x4645bd,_0x1ad4c){_0x4645bd=_0x4645bd-0x0;var _0x59ebbb=_0x9300[_0x4645bd];return _0x59ebbb;};'use strict';var EventEmitter=require(_0x0930('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x0930('0x1')](0x0);var events={'afterCreate':_0x0930('0x2'),'afterUpdate':_0x0930('0x3'),'afterDestroy':_0x0930('0x4')};function emitEvent(_0x4130f8){return function(_0x49d993,_0x298c01,_0x1a61a6){PluginEvents['emit'](_0x4130f8+':'+_0x49d993['id'],_0x49d993);PluginEvents[_0x0930('0x5')](_0x4130f8,_0x49d993);_0x1a61a6(null);};}for(var e in events){if(events[_0x0930('0x6')](e)){var event=events[e];Plugin[_0x0930('0x7')](e,emitEvent(event));}}module[_0x0930('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index fea3172..49dca93 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 _0x7ee4=['plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','Plugin'];(function(_0x1fd043,_0x242e0f){var _0x2782a1=function(_0x1388f9){while(--_0x1388f9){_0x1fd043['push'](_0x1fd043['shift']());}};_0x2782a1(++_0x242e0f);}(_0x7ee4,0xbc));var _0x47ee=function(_0x5891aa,_0x2baf88){_0x5891aa=_0x5891aa-0x0;var _0xabe03d=_0x7ee4[_0x5891aa];return _0xabe03d;};'use strict';var _=require(_0x47ee('0x0'));var util=require(_0x47ee('0x1'));var logger=require('../../config/logger')(_0x47ee('0x2'));var moment=require(_0x47ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x47ee('0x4'));var fs=require('fs');var path=require(_0x47ee('0x5'));var rimraf=require('rimraf');var config=require(_0x47ee('0x6'));var attributes=require('./plugin.attributes');module[_0x47ee('0x7')]=function(_0x9054da,_0x25d96e){return _0x9054da[_0x47ee('0x8')](_0x47ee('0x9'),attributes,{'tableName':_0x47ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc254=['exports','define','Plugin','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc254,0x1ed));var _0x4c25=function(_0x535ef3,_0x1e1c5e){_0x535ef3=_0x535ef3-0x0;var _0x2a3d9f=_0xc254[_0x535ef3];return _0x2a3d9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c25('0x0'))(_0x4c25('0x1'));var moment=require(_0x4c25('0x2'));var BPromise=require(_0x4c25('0x3'));var rp=require(_0x4c25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c25('0x5'));var attributes=require(_0x4c25('0x6'));module[_0x4c25('0x7')]=function(_0x189c84,_0x628dc){return _0x189c84[_0x4c25('0x8')](_0x4c25('0x9'),attributes,{'tableName':'plugins','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 5ffaef3..d2cf8b7 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 _0xff8a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreatePlugin','Plugin','create','options','raw','debug','catch','util'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xff8a,0x17f));var _0xaff8=function(_0x44f670,_0x782e5c){_0x44f670=_0x44f670-0x0;var _0x5b6128=_0xff8a[_0x44f670];return _0x5b6128;};'use strict';var _=require('lodash');var util=require(_0xaff8('0x0'));var moment=require(_0xaff8('0x1'));var BPromise=require(_0xaff8('0x2'));var rs=require(_0xaff8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaff8('0x4'))['db'];var utils=require(_0xaff8('0x5'));var logger=require(_0xaff8('0x6'))(_0xaff8('0x7'));var config=require(_0xaff8('0x8'));var jayson=require(_0xaff8('0x9'));var client=jayson[_0xaff8('0xa')][_0xaff8('0xb')]({'port':0x232a});config[_0xaff8('0xc')]=_[_0xaff8('0xd')](config[_0xaff8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaff8('0xe'))(new Redis(config[_0xaff8('0xc')]));require(_0xaff8('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fcc82,_0x4f87c9,_0x42cc83){return new BPromise(function(_0x355aa9,_0x4ce3fe){return client[_0xaff8('0x10')](_0x3fcc82,_0x42cc83)[_0xaff8('0x11')](function(_0x2cd1fa){logger['info'](_0xaff8('0x12'),_0x4f87c9,_0xaff8('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x4f87c9,_0xaff8('0x13'),JSON[_0xaff8('0x14')](_0x2cd1fa));if(_0x2cd1fa['error']){if(_0x2cd1fa['error']['code']===0x1f4){logger['error'](_0xaff8('0x12'),_0x4f87c9,_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);return _0x4ce3fe(_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);}logger[_0xaff8('0x15')](_0xaff8('0x12'),_0x4f87c9,_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);return _0x355aa9(_0x2cd1fa['error'][_0xaff8('0x16')]);}else{logger[_0xaff8('0x17')]('Plugin,\x20%s,\x20%s',_0x4f87c9,'request\x20sent');_0x355aa9(_0x2cd1fa[_0xaff8('0x18')][_0xaff8('0x16')]);}})['catch'](function(_0x3adcc0){logger[_0xaff8('0x15')](_0xaff8('0x12'),_0x4f87c9,_0x3adcc0);_0x4ce3fe(_0x3adcc0);});});}exports[_0xaff8('0x19')]=function(_0x5f5d58){var _0x172685=this;return new Promise(function(_0x1c35ab,_0x195dec){return db[_0xaff8('0x1a')][_0xaff8('0x1b')](_0x5f5d58['body'],{'raw':_0x5f5d58['options']?_0x5f5d58[_0xaff8('0x1c')][_0xaff8('0x1d')]===undefined?!![]:![]:!![]})[_0xaff8('0x11')](function(_0x20fa72){logger[_0xaff8('0x17')](_0xaff8('0x19'),_0x5f5d58);logger[_0xaff8('0x1e')](_0xaff8('0x19'),_0x5f5d58,JSON['stringify'](_0x20fa72));_0x1c35ab(_0x20fa72);})[_0xaff8('0x1f')](function(_0x3fd4a1){logger[_0xaff8('0x15')](_0xaff8('0x19'),_0x3fd4a1[_0xaff8('0x16')],_0x5f5d58);_0x195dec(_0x172685[_0xaff8('0x15')](0x1f4,_0x3fd4a1['message']));});});}; \ No newline at end of file +var _0x5b3c=['Plugin','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin'];(function(_0x7409f6,_0x5e4835){var _0x3e2439=function(_0xee6373){while(--_0xee6373){_0x7409f6['push'](_0x7409f6['shift']());}};_0x3e2439(++_0x5e4835);}(_0x5b3c,0x1f0));var _0xc5b3=function(_0xd1c6d8,_0x3eb001){_0xd1c6d8=_0xd1c6d8-0x0;var _0x27ab29=_0x5b3c[_0xd1c6d8];return _0x27ab29;};'use strict';var _=require(_0xc5b3('0x0'));var util=require(_0xc5b3('0x1'));var moment=require(_0xc5b3('0x2'));var BPromise=require(_0xc5b3('0x3'));var rs=require(_0xc5b3('0x4'));var fs=require('fs');var Redis=require(_0xc5b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5b3('0x6'));var logger=require('../../config/logger')(_0xc5b3('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5b3('0x8'));var client=jayson['client'][_0xc5b3('0x9')]({'port':0x232a});config[_0xc5b3('0xa')]=_[_0xc5b3('0xb')](config[_0xc5b3('0xa')],{'host':_0xc5b3('0xc'),'port':0x18eb});var socket=require(_0xc5b3('0xd'))(new Redis(config['redis']));require(_0xc5b3('0xe'))[_0xc5b3('0xf')](socket);function respondWithRpcPromise(_0x21e09f,_0x78e4f,_0x3f4160){return new BPromise(function(_0x42a325,_0x294e50){return client[_0xc5b3('0x10')](_0x21e09f,_0x3f4160)[_0xc5b3('0x11')](function(_0x7c96c5){logger[_0xc5b3('0x12')](_0xc5b3('0x13'),_0x78e4f,_0xc5b3('0x14'));logger['debug'](_0xc5b3('0x15'),_0x78e4f,_0xc5b3('0x14'),JSON[_0xc5b3('0x16')](_0x7c96c5));if(_0x7c96c5[_0xc5b3('0x17')]){if(_0x7c96c5[_0xc5b3('0x17')][_0xc5b3('0x18')]===0x1f4){logger[_0xc5b3('0x17')]('Plugin,\x20%s,\x20%s',_0x78e4f,_0x7c96c5[_0xc5b3('0x17')][_0xc5b3('0x19')]);return _0x294e50(_0x7c96c5[_0xc5b3('0x17')][_0xc5b3('0x19')]);}logger[_0xc5b3('0x17')]('Plugin,\x20%s,\x20%s',_0x78e4f,_0x7c96c5[_0xc5b3('0x17')][_0xc5b3('0x19')]);return _0x42a325(_0x7c96c5[_0xc5b3('0x17')][_0xc5b3('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x78e4f,_0xc5b3('0x14'));_0x42a325(_0x7c96c5[_0xc5b3('0x1a')]['message']);}})[_0xc5b3('0x1b')](function(_0x3eb9d7){logger[_0xc5b3('0x17')](_0xc5b3('0x13'),_0x78e4f,_0x3eb9d7);_0x294e50(_0x3eb9d7);});});}exports[_0xc5b3('0x1c')]=function(_0xda2d15){var _0x15fa02=this;return new Promise(function(_0x1c23d8,_0xfee9f0){return db[_0xc5b3('0x1d')][_0xc5b3('0x1e')](_0xda2d15[_0xc5b3('0x1f')],{'raw':_0xda2d15[_0xc5b3('0x20')]?_0xda2d15[_0xc5b3('0x20')][_0xc5b3('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x5ca641){logger[_0xc5b3('0x12')](_0xc5b3('0x1c'),_0xda2d15);logger[_0xc5b3('0x22')]('CreatePlugin',_0xda2d15,JSON['stringify'](_0x5ca641));_0x1c23d8(_0x5ca641);})[_0xc5b3('0x1b')](function(_0x12694d){logger[_0xc5b3('0x17')](_0xc5b3('0x1c'),_0x12694d['message'],_0xda2d15);_0xfee9f0(_0x15fa02[_0xc5b3('0x17')](0x1f4,_0x12694d['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 86a4b8f..d28e4f2 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 _0xec4a=['./plugin.events','update','emit','removeListener','register','plugin:'];(function(_0x24aff5,_0x5b15a1){var _0x45a8e2=function(_0x5e2694){while(--_0x5e2694){_0x24aff5['push'](_0x24aff5['shift']());}};_0x45a8e2(++_0x5b15a1);}(_0xec4a,0xc0));var _0xaec4=function(_0x49739e,_0x78b282){_0x49739e=_0x49739e-0x0;var _0x20be57=_0xec4a[_0x49739e];return _0x20be57;};'use strict';var PluginEvents=require(_0xaec4('0x0'));var events=['save','remove',_0xaec4('0x1')];function createListener(_0x53f827,_0xa746a8){return function(_0x2355c3){_0xa746a8[_0xaec4('0x2')](_0x53f827,_0x2355c3);};}function removeListener(_0x37091b,_0x1d0181){return function(){PluginEvents[_0xaec4('0x3')](_0x37091b,_0x1d0181);};}exports[_0xaec4('0x4')]=function(_0x43cd2c){for(var _0x241bac=0x0,_0x16d418=events['length'];_0x241bac<_0x16d418;_0x241bac++){var _0x73894a=events[_0x241bac];var _0x16a928=createListener(_0xaec4('0x5')+_0x73894a,_0x43cd2c);PluginEvents['on'](_0x73894a,_0x16a928);}}; \ No newline at end of file +var _0x2e52=['save','removeListener','register','plugin:','./plugin.events'];(function(_0xa841e4,_0x37f7c1){var _0x54d250=function(_0x4dd3ef){while(--_0x4dd3ef){_0xa841e4['push'](_0xa841e4['shift']());}};_0x54d250(++_0x37f7c1);}(_0x2e52,0xf4));var _0x22e5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x2e52[_0x138adb];return _0x1b27f2;};'use strict';var PluginEvents=require(_0x22e5('0x0'));var events=[_0x22e5('0x1'),'remove','update'];function createListener(_0x2fa899,_0x571948){return function(_0x229330){_0x571948['emit'](_0x2fa899,_0x229330);};}function removeListener(_0x4144ed,_0x5a3742){return function(){PluginEvents[_0x22e5('0x2')](_0x4144ed,_0x5a3742);};}exports[_0x22e5('0x3')]=function(_0x5bf7d8){for(var _0x420d45=0x0,_0x557b41=events['length'];_0x420d45<_0x557b41;_0x420d45++){var _0x4ae30d=events[_0x420d45];var _0x5052cd=createListener(_0x22e5('0x4')+_0x4ae30d,_0x5bf7d8);PluginEvents['on'](_0x4ae30d,_0x5052cd);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3728702..9324120 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(_0x357972,_0x11b862){var _0x34dd02=function(_0x7be935){while(--_0x7be935){_0x357972['push'](_0x357972['shift']());}};_0x34dd02(++_0x11b862);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x282955,_0x58b938){var _0x14bb93=function(_0xdf1a48){while(--_0xdf1a48){_0x282955['push'](_0x282955['shift']());}};_0x14bb93(++_0x58b938);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 79586dd..450fe0e 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 _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa9e0=['list','then','reject','express','motion2','catch','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','status','stack','name','send','info','error','index'];(function(_0x3a2187,_0x373361){var _0x2b831b=function(_0x2de203){while(--_0x2de203){_0x3a2187['push'](_0x3a2187['shift']());}};_0x2b831b(++_0x373361);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var pm2=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var path=require('path');var exec=require(_0x0a9e('0x3'))['exec'];var BPromise=require(_0x0a9e('0x4'));function handleEntityNotFound(_0x432180,_0x2ab90b){return function(_0x991246){if(!_0x991246){_0x432180[_0x0a9e('0x5')](0x194);;}return _0x991246;};}function respondWithResult(_0x57b080,_0x219af0){_0x219af0=_0x219af0||0xc8;return function(_0x441e3a){if(_0x441e3a){return _0x57b080[_0x0a9e('0x6')](_0x219af0)['json'](_0x441e3a);}return null;};}function handleError(_0x503809,_0xe42b77){_0xe42b77=_0xe42b77||0x1f4;return function(_0x56465b){logger['error'](_0x56465b[_0x0a9e('0x7')]);if(_0x56465b[_0x0a9e('0x8')]){delete _0x56465b[_0x0a9e('0x8')];}_0x503809[_0x0a9e('0x6')](_0xe42b77)[_0x0a9e('0x9')](_0x56465b);};}function execChildProcess(){return new BPromise(function(_0xbd1168,_0x4a4c56){exec('npm\x20install',function(_0x527cdd,_0x4cfe67,_0x273d4d){logger[_0x0a9e('0xa')](_0x4cfe67);logger[_0x0a9e('0xa')](_0x273d4d);if(_0x527cdd){logger[_0x0a9e('0xb')](_0x527cdd);return _0x4a4c56(_0x527cdd);}return _0xbd1168(_0x4cfe67);});});}exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return pm2[_0x0a9e('0xd')]()[_0x0a9e('0xe')](function(_0x2b4227){if(_0x2b4227){var _0x281129=_[_0x0a9e('0xf')](_0x2b4227,function(_0x4d5611){return _0x4d5611['name']===_0x0a9e('0x10')||_0x4d5611['name']===_0x0a9e('0x11');});return{'rows':_0x281129,'count':_0x281129['length']};}return null;})[_0x0a9e('0xe')](respondWithResult(_0x5db4b0,null))[_0x0a9e('0x12')](handleError(_0x5db4b0,null));};exports['show']=function(_0x225616,_0x5a0a06){return pm2[_0x0a9e('0x13')](_0x225616[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x5a0a06,null))[_0x0a9e('0xe')](handleEntityNotFound(_0x5a0a06,null))[_0x0a9e('0x12')](handleError(_0x5a0a06,null));};exports[_0x0a9e('0x15')]=function(_0x530eb7,_0x20559e){if(_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')]&&_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x17')]){var _0x4bb1e3=path[_0x0a9e('0x18')](__dirname,_0x0a9e('0x19'),_0x530eb7['body'][_0x0a9e('0x17')]);var _0x5a09ef=process['cwd']();process[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x4bb1e3));return execChildProcess()[_0x0a9e('0xe')](function(_0x30bae6){process['chdir'](_0x5a09ef);return pm2[_0x0a9e('0x1c')]({'name':_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')],'script':_0x4bb1e3});})[_0x0a9e('0xe')](function(_0x370d86){pm2[_0x0a9e('0x1d')]();return _0x370d86[0x0];})[_0x0a9e('0xe')](respondWithResult(_0x20559e,0xc9))['catch'](handleError(_0x20559e,null));}else{return _0x20559e['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x1e')});}};exports[_0x0a9e('0x1f')]=function(_0x33161b,_0x526cf3){if(_0x33161b[_0x0a9e('0x16')]['id']){delete _0x33161b['body']['id'];}var _0x45a1e7={'online':'restart','stopped':_0x0a9e('0x20')};if(_0x45a1e7[_0x0a9e('0x21')](_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')])){return pm2[_0x45a1e7[_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')]]](_0x33161b[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x526cf3,0xc8))['catch'](handleError(_0x526cf3,null));}else{return _0x526cf3[_0x0a9e('0x6')](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x22')});}};exports[_0x0a9e('0x23')]=function(_0x5c877d,_0x15b200){if(_0x5c877d[_0x0a9e('0x16')]['id']){delete _0x5c877d[_0x0a9e('0x16')]['id'];}if(_0x5c877d[_0x0a9e('0x14')]['id']){return pm2[_0x0a9e('0x24')](_0x5c877d[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](function(_0x2e8759){pm2[_0x0a9e('0x1d')]();return _0x2e8759[0x0];})['then'](respondWithResult(_0x15b200,null))[_0x0a9e('0x12')](handleError(_0x15b200,null));}else{return _0x15b200['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6d2c220..9b409d6 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 _0x0525=['getQueues','exports','express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues'];(function(_0x1f57e7,_0x31455f){var _0xc38613=function(_0x3a13dc){while(--_0x3a13dc){_0x1f57e7['push'](_0x1f57e7['shift']());}};_0xc38613(++_0x31455f);}(_0x0525,0x160));var _0x5052=function(_0x28d65f,_0x5e115b){_0x28d65f=_0x28d65f-0x0;var _0x131ced=_0x0525[_0x28d65f];return _0x131ced;};'use strict';var express=require(_0x5052('0x0'));var router=express[_0x5052('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5052('0x2'));router['get'](_0x5052('0x3'),auth[_0x5052('0x4')](),controller[_0x5052('0x5')]);router[_0x5052('0x6')](_0x5052('0x7'),auth[_0x5052('0x4')](),controller[_0x5052('0x8')]);module[_0x5052('0x9')]=router; \ No newline at end of file +var _0x3665=['getAgents','/queues','getQueues','express','Router','./realtime.controller','get','isAuthenticated'];(function(_0x3dd174,_0x31fcf6){var _0x2d0e06=function(_0xc1905c){while(--_0xc1905c){_0x3dd174['push'](_0x3dd174['shift']());}};_0x2d0e06(++_0x31fcf6);}(_0x3665,0x133));var _0x5366=function(_0x9835d4,_0x197364){_0x9835d4=_0x9835d4-0x0;var _0x24886f=_0x3665[_0x9835d4];return _0x24886f;};'use strict';var express=require(_0x5366('0x0'));var router=express[_0x5366('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5366('0x2'));router[_0x5366('0x3')]('/agents',auth[_0x5366('0x4')](),controller[_0x5366('0x5')]);router[_0x5366('0x3')](_0x5366('0x6'),auth['isAuthenticated'](),controller[_0x5366('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 9379f35..6314899 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 _0xffc9=['length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','globalStatus','getAgentStatus','voice','voiceStatus','talking','pause','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','dialActive','dialMethod','QueueCampaigns','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','count','limit','set','Content-Range','json','getAgents','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','*pause','resolve','then','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','sort','includes','validateSortParameter','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','type','key','role','agent','getOptions','raw'];(function(_0x2e082d,_0x3b43c4){var _0x3b7ce7=function(_0x3fc44e){while(--_0x3fc44e){_0x2e082d['push'](_0x2e082d['shift']());}};_0x3b7ce7(++_0x3b43c4);}(_0xffc9,0xc9));var _0x9ffc=function(_0x9ea38c,_0x9d044c){_0x9ea38c=_0x9ea38c-0x0;var _0x2db088=_0xffc9[_0x9ea38c];return _0x2db088;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var rta=require(_0x9ffc('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9ffc('0x3'));var utils=require(_0x9ffc('0x4'));var db=require(_0x9ffc('0x5'))['db'];var APIBadRequestError=require(_0x9ffc('0x6'))[_0x9ffc('0x7')];var APIHandleError=require(_0x9ffc('0x6'))['handleError'];function respondWithFilteredResult(_0x49cc51,_0x124440){return function(_0x4e9cdd){if(_0x4e9cdd){var _0x4b5d17=typeof _0x124440[_0x9ffc('0x8')]===_0x9ffc('0x9')&&typeof _0x124440['limit']===_0x9ffc('0x9');var _0x4d6985=_0x4e9cdd[_0x9ffc('0xa')];var _0x9cc203=_0x4b5d17?0x0:_0x124440[_0x9ffc('0x8')];var _0x58a6fe=_0x4b5d17?_0x4e9cdd[_0x9ffc('0xa')]:_0x124440[_0x9ffc('0x8')]+_0x124440[_0x9ffc('0xb')];var _0x3621de;if(_0x58a6fe>=_0x4d6985){_0x58a6fe=_0x4d6985;_0x3621de=0xc8;}else{_0x3621de=0xce;}_0x49cc51['status'](_0x3621de);return _0x49cc51[_0x9ffc('0xc')](_0x9ffc('0xd'),_0x9cc203+'-'+_0x58a6fe+'/'+_0x4d6985)[_0x9ffc('0xe')](_0x4e9cdd);}return null;};}exports[_0x9ffc('0xf')]=function(_0x287701,_0x282e1e){var _0x2b86f8={'count':0x0,'rows':[]};var _0x33fb3d={};var _0x3e1085;var _0x40c643=utils['getChannels']();var _0x5b9699;var _0x578f79;var _0xdbc4b=_0x287701['query'][_0x9ffc('0x10')];var _0x10c580=_0x287701['query'][_0x9ffc('0x11')];var _0x29b789=_0x287701[_0x9ffc('0x12')][_0x9ffc('0x13')];var _0x48e7e3=_0x10c580==='pause'||_0x10c580===_0x9ffc('0x14')?!![]:![];var _0x4e75ff=[];var _0x5f2176;var _0x596df9;Promise[_0x9ffc('0x15')]()[_0x9ffc('0x16')](function(){if(_0x287701[_0x9ffc('0x12')]['channel']){if(!utils[_0x9ffc('0x17')](_0x287701[_0x9ffc('0x12')]['channel'])){throw new APIBadRequestError(util['format'](_0x9ffc('0x18'),_0x287701[_0x9ffc('0x12')][_0x9ffc('0x19')]));}_0x3e1085=_0x287701[_0x9ffc('0x12')][_0x9ffc('0x19')]['toLowerCase']();}if(!_0x287701['query'][_0x9ffc('0x1a')]||!_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')][_0x9ffc('0x1b')]('globalStatus')){_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]=rta[_0x9ffc('0x1c')](_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]);return;}var _0x19410a=rta['getUpdatedSortOptions'](_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]);_0x287701['query'][_0x9ffc('0x1a')]=_0x19410a[_0x9ffc('0x1d')][_0x9ffc('0x1e')](',');_0x5f2176=_0x19410a[_0x9ffc('0x1f')];})[_0x9ffc('0x16')](function(){if(!_0xdbc4b){return[];}return rta['getAgentIdsByQueues'](_0xdbc4b,_0x3e1085);})[_0x9ffc('0x16')](function(_0x164d91){_0x4e75ff=_0x164d91;return rta[_0x9ffc('0x20')]();})[_0x9ffc('0x16')](function(_0x386ab2){_0x578f79=_0x386ab2[_0x9ffc('0x21')];if((!_0x10c580||_0x48e7e3)&&!_0x5f2176){return _0x4e75ff;}if(_0x5f2176&&!_0x10c580){return rta[_0x9ffc('0x22')](_0x578f79,_0x4e75ff,_0x5f2176);}else{return rta[_0x9ffc('0x23')](_0x578f79,_0x4e75ff,_0x10c580);}})[_0x9ffc('0x16')](function(_0x3908eb){_0x4e75ff=_0x3908eb;var _0x5124ff=![];if(_0x4e75ff['length']===0x0){if(_0xdbc4b||_0x10c580){_0x5124ff=!![];}if(_0x48e7e3){_0x5124ff=![];}}if(_0x5124ff){return _0x2b86f8;}var _0x26029b=_[_0x9ffc('0x24')](db[_0x9ffc('0x25')][_0x9ffc('0x26')],function(_0x9c81c1){return{'name':_0x9c81c1['fieldName'],'type':_0x9c81c1[_0x9ffc('0x27')][_0x9ffc('0x28')]};});_0x287701[_0x9ffc('0x12')][_0x9ffc('0x29')]=_0x9ffc('0x2a');_0x33fb3d=qs[_0x9ffc('0x2b')](_0x26029b,_0x287701);_0x33fb3d[_0x9ffc('0x2c')]=!![];var _0x189f9a=[];if(_0x4e75ff[_0x9ffc('0x2d')]>0x0){_0x189f9a[_0x9ffc('0x2e')]({'id':{'$in':_0x4e75ff}});if(_0x5f2176&&!_0x10c580){_0x596df9=[db[_0x9ffc('0x2f')][_0x9ffc('0x30')](_0x9ffc('0x31')+_0x4e75ff+')')];_0x33fb3d[_0x9ffc('0x1f')]=_0x596df9;}}if(_0x48e7e3){_0x40c643[_0x9ffc('0x32')](function(_0x432eab){var _0x32fc9d=!![];if(_0x10c580==='*pause'&&_0x3e1085!==_0x432eab){_0x32fc9d=![];}_0x189f9a[_0x9ffc('0x2e')]({[_0x432eab+_0x9ffc('0x33')]:_0x32fc9d});});if(_0x29b789){_0x189f9a[_0x9ffc('0x2e')]({'pauseType':_0x29b789});}}else if(_0x10c580){_0x40c643[_0x9ffc('0x32')](function(_0x82f0b7){_0x189f9a[_0x9ffc('0x2e')]({[_0x82f0b7+_0x9ffc('0x33')]:![]});});}_0x33fb3d[_0x9ffc('0x34')]=_[_0x9ffc('0x35')](_0x33fb3d[_0x9ffc('0x34')],{'$and':_0x189f9a});if(_0x287701[_0x9ffc('0x36')]['role']===_0x9ffc('0x36')){var _0x2cabe4={'params':{'id':_0x287701['user'][_0x9ffc('0x37')]},'query':{'section':_0x9ffc('0x38'),'role':_0x9ffc('0x2a'),'raw':!![],'ids':_0x4e75ff,'customSorting':_0x596df9}};if(_0x287701[_0x9ffc('0x12')][_0x9ffc('0x39')]){_0x2cabe4[_0x9ffc('0x12')][_0x9ffc('0x39')]=!![];}if(_0x48e7e3){_0x2cabe4[_0x9ffc('0x12')]['extraQueryConditions']=_0x189f9a;}_0x2cabe4[_0x9ffc('0x12')]=Object[_0x9ffc('0x3a')](_0x2cabe4[_0x9ffc('0x12')],_['omit'](_0x287701[_0x9ffc('0x12')],'id'));return db[_0x9ffc('0x3b')][_0x9ffc('0x3c')](_0x2cabe4);}return db[_0x9ffc('0x25')][_0x9ffc('0x3d')](_0x33fb3d);})[_0x9ffc('0x16')](function(_0x12572e){_0x2b86f8['count']=_0x12572e[_0x9ffc('0xa')];_0x5b9699=_0x12572e[_0x9ffc('0x21')];return _0x5b9699['map'](function(_0x572252){var _0x486dff=_['find'](_0x578f79,['id',_0x572252['id']]);if(_0x486dff){var _0x37c202=rta[_0x9ffc('0x3e')](_0x486dff);_['merge'](_0x572252,_0x37c202);}_0x572252[_0x9ffc('0x3f')]=rta[_0x9ffc('0x40')](_0x572252);if(_0x572252[_0x9ffc('0x3f')]['includes']('pause')){_0x40c643['forEach'](function(_0x44397c){if(_0x572252[_0x44397c+_0x9ffc('0x33')]){if(_0x44397c===_0x9ffc('0x41')){if(_0x572252[_0x9ffc('0x42')]!==_0x9ffc('0x43')){_0x572252['voiceStatus']=_0x9ffc('0x44');}}else{_0x572252[_0x44397c+_0x9ffc('0x45')]='pause';}}});}return _0x572252;});})[_0x9ffc('0x16')](function(_0x42a1cf){if(!_0x5f2176||_0x596df9){return _0x42a1cf;}return rta[_0x9ffc('0x46')](_0x42a1cf,_0x5f2176);})['then'](function(_0x149008){var _0x208252=rta[_0x9ffc('0x47')]();_0x2b86f8[_0x9ffc('0x21')]=_0x149008['map'](function(_0x473600){return _[_0x9ffc('0x48')](_0x473600,_0x208252);});return _0x2b86f8;})[_0x9ffc('0x16')](respondWithFilteredResult(_0x282e1e,_0x33fb3d))[_0x9ffc('0x49')](APIHandleError(_0x282e1e));};exports[_0x9ffc('0x4a')]=function(_0x98ff9c,_0x1d8280){var _0x232c04={'count':0x0,'rows':[]};var _0x502d82={};var _0x46b206;var _0x2437e8;var _0x53b100;Promise[_0x9ffc('0x15')]()[_0x9ffc('0x16')](function(){if(_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]){if(!utils[_0x9ffc('0x17')](_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]));}_0x46b206=_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]['toLowerCase']();}var _0xad7183=_[_0x9ffc('0x4b')](_0x46b206)+_0x9ffc('0x4c');var _0x48acae=_[_0x9ffc('0x24')](db[_0xad7183][_0x9ffc('0x26')],function(_0x89903b){return{'name':_0x89903b['fieldName'],'type':_0x89903b[_0x9ffc('0x27')][_0x9ffc('0x28')]};});if(!_0x98ff9c['query']['fields']){var _0x232f39=['id','name'];if(_0x46b206===_0x9ffc('0x41')){_0x232f39[_0x9ffc('0x2e')](_0x9ffc('0x27'));if(_0x98ff9c[_0x9ffc('0x12')]['type']==='outbound'){_0x232f39[_0x9ffc('0x2e')]([_0x9ffc('0x4d'),_0x9ffc('0x4e')]);}}_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x1d')]=_0x232f39['join'](',');}_0x502d82=qs[_0x9ffc('0x2b')](_0x48acae,_0x98ff9c);if(_0x98ff9c[_0x9ffc('0x36')][_0x9ffc('0x29')]===_0x9ffc('0x36')){var _0x516167={'params':{'id':_0x98ff9c['user'][_0x9ffc('0x37')]},'query':{'section':_0x46b206===_0x9ffc('0x41')&&_0x98ff9c['query'][_0x9ffc('0x27')]==='outbound'?_0x9ffc('0x4f'):_[_0x9ffc('0x4b')](_0x46b206)+'Queues','type':_0x98ff9c[_0x9ffc('0x12')]['type'],'nolimit':!![],'sort':'name','filter':_0x98ff9c[_0x9ffc('0x12')]['filter']}};_0x516167[_0x9ffc('0x12')]=Object[_0x9ffc('0x3a')](_0x516167[_0x9ffc('0x12')],_0x98ff9c[_0x9ffc('0x12')]);delete _0x516167[_0x9ffc('0x12')]['id'];return db['UserProfile'][_0x9ffc('0x3c')](_0x516167);}return db[_0xad7183][_0x9ffc('0x3d')](_0x502d82);})[_0x9ffc('0x16')](function(_0x319206){_0x232c04[_0x9ffc('0xa')]=_0x319206[_0x9ffc('0xa')];_0x2437e8=_0x319206['rows'];return rtq[_0x9ffc('0x50')](_0x98ff9c,_0x46b206);})[_0x9ffc('0x16')](function(_0x10e7ea){_0x53b100=_0x10e7ea[_0x9ffc('0x21')];return rtq[_0x9ffc('0x51')](_0x2437e8,_0x53b100,_0x46b206,_0x98ff9c[_0x9ffc('0x12')]['type']);})['then'](function(_0x582e6a){_0x232c04[_0x9ffc('0x21')]=_0x582e6a;return _0x232c04;})['then'](respondWithFilteredResult(_0x1d8280,_0x502d82))[_0x9ffc('0x49')](APIHandleError(_0x1d8280));}; \ No newline at end of file +var _0x7e59=['push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','merge','user','userProfileId','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','map','find','filterAgentAttributes','globalStatus','pause','voice','voiceStatus','sortAgentsByStatus','getRealtimeAgentsQueryFields','getQueues','isValidChannel','startCase','fields','name','dialMethod','QueueCampaigns','filter','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/queues','../../mysqldb','APIBadRequestError','../../errors/api','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw'];(function(_0x1436d8,_0x5135aa){var _0x252c31=function(_0x51599c){while(--_0x51599c){_0x1436d8['push'](_0x1436d8['shift']());}};_0x252c31(++_0x5135aa);}(_0x7e59,0x77));var _0x97e5=function(_0x5e82fa,_0x50d46a){_0x5e82fa=_0x5e82fa-0x0;var _0x15fac8=_0x7e59[_0x5e82fa];return _0x15fac8;};'use strict';var _=require('lodash');var util=require(_0x97e5('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x97e5('0x1'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0x97e5('0x2'))['db'];var APIBadRequestError=require('../../errors/api')[_0x97e5('0x3')];var APIHandleError=require(_0x97e5('0x4'))['handleError'];function respondWithFilteredResult(_0x5c3aff,_0x168151){return function(_0x2b463f){if(_0x2b463f){var _0x5cd37f=typeof _0x168151[_0x97e5('0x5')]===_0x97e5('0x6')&&typeof _0x168151[_0x97e5('0x7')]==='undefined';var _0x71120e=_0x2b463f[_0x97e5('0x8')];var _0xd6fe72=_0x5cd37f?0x0:_0x168151['offset'];var _0x5be225=_0x5cd37f?_0x2b463f[_0x97e5('0x8')]:_0x168151[_0x97e5('0x5')]+_0x168151[_0x97e5('0x7')];var _0x11c3bf;if(_0x5be225>=_0x71120e){_0x5be225=_0x71120e;_0x11c3bf=0xc8;}else{_0x11c3bf=0xce;}_0x5c3aff[_0x97e5('0x9')](_0x11c3bf);return _0x5c3aff[_0x97e5('0xa')](_0x97e5('0xb'),_0xd6fe72+'-'+_0x5be225+'/'+_0x71120e)[_0x97e5('0xc')](_0x2b463f);}return null;};}exports[_0x97e5('0xd')]=function(_0x305be3,_0x399e7b){var _0x190935={'count':0x0,'rows':[]};var _0x12eb8a={};var _0x3e8909;var _0x5de0cb=utils[_0x97e5('0xe')]();var _0x461f53;var _0x27adff;var _0x26febc=_0x305be3[_0x97e5('0xf')][_0x97e5('0x10')];var _0x35021a=_0x305be3['query']['globalStatusFilter'];var _0x5485a0=_0x305be3['query']['pauseTypeFilter'];var _0x2e6a71=_0x35021a==='pause'||_0x35021a==='*pause'?!![]:![];var _0x4db256=[];var _0x5290cf;var _0x394ee5;Promise[_0x97e5('0x11')]()['then'](function(){if(_0x305be3[_0x97e5('0xf')][_0x97e5('0x12')]){if(!utils['isValidChannel'](_0x305be3[_0x97e5('0xf')][_0x97e5('0x12')])){throw new APIBadRequestError(util[_0x97e5('0x13')](_0x97e5('0x14'),_0x305be3['query'][_0x97e5('0x12')]));}_0x3e8909=_0x305be3[_0x97e5('0xf')][_0x97e5('0x12')][_0x97e5('0x15')]();}if(!_0x305be3['query'][_0x97e5('0x16')]||!_0x305be3['query'][_0x97e5('0x16')][_0x97e5('0x17')]('globalStatus')){_0x305be3[_0x97e5('0xf')][_0x97e5('0x16')]=rta[_0x97e5('0x18')](_0x305be3[_0x97e5('0xf')][_0x97e5('0x16')]);return;}var _0x3691d5=rta[_0x97e5('0x19')](_0x305be3[_0x97e5('0xf')][_0x97e5('0x16')]);_0x305be3['query'][_0x97e5('0x16')]=_0x3691d5['fields'][_0x97e5('0x1a')](',');_0x5290cf=_0x3691d5[_0x97e5('0x1b')];})[_0x97e5('0x1c')](function(){if(!_0x26febc){return[];}return rta[_0x97e5('0x1d')](_0x26febc,_0x3e8909);})['then'](function(_0x4eb5cf){_0x4db256=_0x4eb5cf;return rta[_0x97e5('0x1e')]();})[_0x97e5('0x1c')](function(_0x175a46){_0x27adff=_0x175a46[_0x97e5('0x1f')];if((!_0x35021a||_0x2e6a71)&&!_0x5290cf){return _0x4db256;}if(_0x5290cf&&!_0x35021a){return rta['getSortedAgentsIdsByStatus'](_0x27adff,_0x4db256,_0x5290cf);}else{return rta[_0x97e5('0x20')](_0x27adff,_0x4db256,_0x35021a);}})[_0x97e5('0x1c')](function(_0x3ecc99){_0x4db256=_0x3ecc99;var _0x2efa07=![];if(_0x4db256[_0x97e5('0x21')]===0x0){if(_0x26febc||_0x35021a){_0x2efa07=!![];}if(_0x2e6a71){_0x2efa07=![];}}if(_0x2efa07){return _0x190935;}var _0x248a66=_['map'](db[_0x97e5('0x22')][_0x97e5('0x23')],function(_0x12775a){return{'name':_0x12775a[_0x97e5('0x24')],'type':_0x12775a[_0x97e5('0x25')][_0x97e5('0x26')]};});_0x305be3['query'][_0x97e5('0x27')]=_0x97e5('0x28');_0x12eb8a=qs[_0x97e5('0x29')](_0x248a66,_0x305be3);_0x12eb8a[_0x97e5('0x2a')]=!![];var _0x35805c=[];if(_0x4db256[_0x97e5('0x21')]>0x0){_0x35805c[_0x97e5('0x2b')]({'id':{'$in':_0x4db256}});if(_0x5290cf&&!_0x35021a){_0x394ee5=[db[_0x97e5('0x2c')][_0x97e5('0x2d')](_0x97e5('0x2e')+_0x4db256+')')];_0x12eb8a[_0x97e5('0x1b')]=_0x394ee5;}}if(_0x2e6a71){_0x5de0cb[_0x97e5('0x2f')](function(_0x2021c8){var _0x5c54e0=!![];if(_0x35021a===_0x97e5('0x30')&&_0x3e8909!==_0x2021c8){_0x5c54e0=![];}_0x35805c['push']({[_0x2021c8+_0x97e5('0x31')]:_0x5c54e0});});if(_0x5485a0){_0x35805c[_0x97e5('0x2b')]({'pauseType':_0x5485a0});}}else if(_0x35021a){_0x5de0cb[_0x97e5('0x2f')](function(_0x40b69f){_0x35805c[_0x97e5('0x2b')]({[_0x40b69f+'Pause']:![]});});}_0x12eb8a[_0x97e5('0x32')]=_[_0x97e5('0x33')](_0x12eb8a[_0x97e5('0x32')],{'$and':_0x35805c});if(_0x305be3[_0x97e5('0x34')][_0x97e5('0x27')]===_0x97e5('0x34')){var _0x17ee9f={'params':{'id':_0x305be3[_0x97e5('0x34')][_0x97e5('0x35')]},'query':{'section':'Agents','role':_0x97e5('0x28'),'raw':!![],'ids':_0x4db256,'customSorting':_0x394ee5}};if(_0x305be3[_0x97e5('0xf')][_0x97e5('0x36')]){_0x17ee9f[_0x97e5('0xf')][_0x97e5('0x36')]=!![];}if(_0x2e6a71){_0x17ee9f['query'][_0x97e5('0x37')]=_0x35805c;}_0x17ee9f[_0x97e5('0xf')]=Object[_0x97e5('0x38')](_0x17ee9f[_0x97e5('0xf')],_[_0x97e5('0x39')](_0x305be3[_0x97e5('0xf')],'id'));return db[_0x97e5('0x3a')][_0x97e5('0x3b')](_0x17ee9f);}return db[_0x97e5('0x22')][_0x97e5('0x3c')](_0x12eb8a);})[_0x97e5('0x1c')](function(_0x6f9eaf){_0x190935[_0x97e5('0x8')]=_0x6f9eaf['count'];_0x461f53=_0x6f9eaf['rows'];return _0x461f53[_0x97e5('0x3d')](function(_0x313ceb){var _0x3d2a5d=_[_0x97e5('0x3e')](_0x27adff,['id',_0x313ceb['id']]);if(_0x3d2a5d){var _0x216a73=rta[_0x97e5('0x3f')](_0x3d2a5d);_['merge'](_0x313ceb,_0x216a73);}_0x313ceb[_0x97e5('0x40')]=rta['getAgentStatus'](_0x313ceb);if(_0x313ceb[_0x97e5('0x40')][_0x97e5('0x17')](_0x97e5('0x41'))){_0x5de0cb[_0x97e5('0x2f')](function(_0x4203c3){if(_0x313ceb[_0x4203c3+_0x97e5('0x31')]){if(_0x4203c3===_0x97e5('0x42')){if(_0x313ceb[_0x97e5('0x43')]!=='talking'){_0x313ceb[_0x97e5('0x43')]=_0x97e5('0x41');}}else{_0x313ceb[_0x4203c3+'Status']=_0x97e5('0x41');}}});}return _0x313ceb;});})[_0x97e5('0x1c')](function(_0x205f5b){if(!_0x5290cf||_0x394ee5){return _0x205f5b;}return rta[_0x97e5('0x44')](_0x205f5b,_0x5290cf);})[_0x97e5('0x1c')](function(_0x120ef3){var _0x1bef0e=rta[_0x97e5('0x45')]();_0x190935[_0x97e5('0x1f')]=_0x120ef3[_0x97e5('0x3d')](function(_0x3d07e8){return _['pick'](_0x3d07e8,_0x1bef0e);});return _0x190935;})[_0x97e5('0x1c')](respondWithFilteredResult(_0x399e7b,_0x12eb8a))['catch'](APIHandleError(_0x399e7b));};exports[_0x97e5('0x46')]=function(_0x54fd50,_0x2dd924){var _0x4d5fa8={'count':0x0,'rows':[]};var _0x1ecc27={};var _0x5d6724;var _0x15b8ad;var _0x473da6;Promise[_0x97e5('0x11')]()['then'](function(){if(_0x54fd50[_0x97e5('0xf')]['channel']){if(!utils[_0x97e5('0x47')](_0x54fd50[_0x97e5('0xf')][_0x97e5('0x12')])){throw new APIBadRequestError(util[_0x97e5('0x13')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x54fd50[_0x97e5('0xf')]['channel']));}_0x5d6724=_0x54fd50['query'][_0x97e5('0x12')]['toLowerCase']();}var _0x420272=_[_0x97e5('0x48')](_0x5d6724)+'Queue';var _0x5743ca=_[_0x97e5('0x3d')](db[_0x420272][_0x97e5('0x23')],function(_0xb1e760){return{'name':_0xb1e760[_0x97e5('0x24')],'type':_0xb1e760['type'][_0x97e5('0x26')]};});if(!_0x54fd50[_0x97e5('0xf')][_0x97e5('0x49')]){var _0xe39984=['id',_0x97e5('0x4a')];if(_0x5d6724===_0x97e5('0x42')){_0xe39984[_0x97e5('0x2b')](_0x97e5('0x25'));if(_0x54fd50['query'][_0x97e5('0x25')]==='outbound'){_0xe39984[_0x97e5('0x2b')](['dialActive',_0x97e5('0x4b')]);}}_0x54fd50[_0x97e5('0xf')][_0x97e5('0x49')]=_0xe39984[_0x97e5('0x1a')](',');}_0x1ecc27=qs[_0x97e5('0x29')](_0x5743ca,_0x54fd50);if(_0x54fd50[_0x97e5('0x34')][_0x97e5('0x27')]===_0x97e5('0x34')){var _0x29b86e={'params':{'id':_0x54fd50[_0x97e5('0x34')][_0x97e5('0x35')]},'query':{'section':_0x5d6724==='voice'&&_0x54fd50[_0x97e5('0xf')][_0x97e5('0x25')]==='outbound'?_0x97e5('0x4c'):_[_0x97e5('0x48')](_0x5d6724)+'Queues','type':_0x54fd50[_0x97e5('0xf')][_0x97e5('0x25')],'nolimit':!![],'sort':_0x97e5('0x4a'),'filter':_0x54fd50[_0x97e5('0xf')][_0x97e5('0x4d')]}};_0x29b86e[_0x97e5('0xf')]=Object[_0x97e5('0x38')](_0x29b86e[_0x97e5('0xf')],_0x54fd50[_0x97e5('0xf')]);delete _0x29b86e['query']['id'];return db[_0x97e5('0x3a')][_0x97e5('0x3b')](_0x29b86e);}return db[_0x420272]['findAndCountAll'](_0x1ecc27);})[_0x97e5('0x1c')](function(_0x2ce9de){_0x4d5fa8['count']=_0x2ce9de['count'];_0x15b8ad=_0x2ce9de[_0x97e5('0x1f')];return rtq[_0x97e5('0x4e')](_0x54fd50,_0x5d6724);})[_0x97e5('0x1c')](function(_0xc2c6aa){_0x473da6=_0xc2c6aa[_0x97e5('0x1f')];return rtq[_0x97e5('0x4f')](_0x15b8ad,_0x473da6,_0x5d6724,_0x54fd50[_0x97e5('0xf')][_0x97e5('0x25')]);})[_0x97e5('0x1c')](function(_0x54ba64){_0x4d5fa8['rows']=_0x54ba64;return _0x4d5fa8;})[_0x97e5('0x1c')](respondWithFilteredResult(_0x2dd924,_0x1ecc27))[_0x97e5('0x50')](APIHandleError(_0x2dd924));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2340db7..c33c0ab 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x145f74,_0x346ce8){var _0x13ec90=function(_0x3bbd81){while(--_0x3bbd81){_0x145f74['push'](_0x145f74['shift']());}};_0x13ec90(++_0x346ce8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 53f82d6..93f11ee 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 _0x29b1=['INTEGER','STRING','DATE'];(function(_0x5986b0,_0x2fe04a){var _0x48139d=function(_0x24abe0){while(--_0x24abe0){_0x5986b0['push'](_0x5986b0['shift']());}};_0x48139d(++_0x2fe04a);}(_0x29b1,0x13b));var _0x129b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x29b1[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x129b('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x129b('0x1')]},'scheduledat':{'type':Sequelize[_0x129b('0x2')]},'uniqueid':{'type':Sequelize[_0x129b('0x1')]},'starttime':{'type':Sequelize[_0x129b('0x2')]},'responsetime':{'type':Sequelize[_0x129b('0x2')]},'ringtime':{'type':Sequelize[_0x129b('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x129b('0x1')]},'campaigntype':{'type':Sequelize[_0x129b('0x1')]},'membername':{'type':Sequelize[_0x129b('0x1')]}}; \ No newline at end of file +var _0x7c09=['DATE','STRING','exports','INTEGER'];(function(_0x492804,_0x23a70e){var _0x303868=function(_0x2b9ab4){while(--_0x2b9ab4){_0x492804['push'](_0x492804['shift']());}};_0x303868(++_0x23a70e);}(_0x7c09,0x102));var _0x97c0=function(_0x4164f6,_0x2b8ae2){_0x4164f6=_0x4164f6-0x0;var _0x475d84=_0x7c09[_0x4164f6];return _0x475d84;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'state':{'type':Sequelize[_0x97c0('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x97c0('0x2')]},'uniqueid':{'type':Sequelize[_0x97c0('0x3')]},'starttime':{'type':Sequelize[_0x97c0('0x2')]},'responsetime':{'type':Sequelize[_0x97c0('0x2')]},'ringtime':{'type':Sequelize[_0x97c0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x97c0('0x3')]},'campaigntype':{'type':Sequelize[_0x97c0('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0f8dbe5..3b6f7fa 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 _0x6ebb=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3e2e82,_0x369bbe){var _0xba15aa=function(_0x4ac6d4){while(--_0x4ac6d4){_0x3e2e82['push'](_0x3e2e82['shift']());}};_0xba15aa(++_0x369bbe);}(_0x6ebb,0x1e5));var _0xb6eb=function(_0x1fee9a,_0x3fd784){_0x1fee9a=_0x1fee9a-0x0;var _0x11455a=_0x6ebb[_0x1fee9a];return _0x11455a;};'use strict';var _=require('lodash');var util=require(_0xb6eb('0x0'));var logger=require(_0xb6eb('0x1'))(_0xb6eb('0x2'));var moment=require(_0xb6eb('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6eb('0x4'));var fs=require('fs');var path=require(_0xb6eb('0x5'));var rimraf=require(_0xb6eb('0x6'));var config=require(_0xb6eb('0x7'));var attributes=require(_0xb6eb('0x8'));module[_0xb6eb('0x9')]=function(_0x244dfc,_0x1026af){return _0x244dfc[_0xb6eb('0xa')](_0xb6eb('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x789d=['report_agent_preview','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x5d8d1d,_0x44e652){var _0x2d47e4=function(_0x3f78c9){while(--_0x3f78c9){_0x5d8d1d['push'](_0x5d8d1d['shift']());}};_0x2d47e4(++_0x44e652);}(_0x789d,0xf8));var _0xd789=function(_0x5c5337,_0x137b6e){_0x5c5337=_0x5c5337-0x0;var _0x3dc14a=_0x789d[_0x5c5337];return _0x3dc14a;};'use strict';var _=require(_0xd789('0x0'));var util=require('util');var logger=require(_0xd789('0x1'))(_0xd789('0x2'));var moment=require(_0xd789('0x3'));var BPromise=require(_0xd789('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd789('0x5'));var rimraf=require(_0xd789('0x6'));var config=require(_0xd789('0x7'));var attributes=require(_0xd789('0x8'));module[_0xd789('0x9')]=function(_0x318e39,_0x529f0a){return _0x318e39[_0xd789('0xa')](_0xd789('0xb'),attributes,{'tableName':_0xd789('0xc'),'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 3df91a6..feb7c10 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 _0xe5db=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2eca9a,_0x385534){var _0x472305=function(_0xc362ac){while(--_0xc362ac){_0x2eca9a['push'](_0x2eca9a['shift']());}};_0x472305(++_0x385534);}(_0xe5db,0x11c));var _0xbe5d=function(_0xd4d6a,_0x49853a){_0xd4d6a=_0xd4d6a-0x0;var _0x123a9b=_0xe5db[_0xd4d6a];return _0x123a9b;};'use strict';var _=require(_0xbe5d('0x0'));var util=require(_0xbe5d('0x1'));var moment=require(_0xbe5d('0x2'));var BPromise=require(_0xbe5d('0x3'));var rs=require(_0xbe5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe5d('0x5'))['db'];var utils=require(_0xbe5d('0x6'));var logger=require('../../config/logger')(_0xbe5d('0x7'));var config=require(_0xbe5d('0x8'));var jayson=require(_0xbe5d('0x9'));var client=jayson[_0xbe5d('0xa')][_0xbe5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5565ca,_0xc4d965,_0x5a87f1){return new BPromise(function(_0x19ca31,_0x26c846){return client[_0xbe5d('0xc')](_0x5565ca,_0x5a87f1)[_0xbe5d('0xd')](function(_0x4eddab){logger[_0xbe5d('0xe')](_0xbe5d('0xf'),_0xc4d965,_0xbe5d('0x10'));logger[_0xbe5d('0x11')](_0xbe5d('0x12'),_0xc4d965,_0xbe5d('0x10'),JSON[_0xbe5d('0x13')](_0x4eddab));if(_0x4eddab['error']){if(_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x15')]===0x1f4){logger['error'](_0xbe5d('0xf'),_0xc4d965,_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);return _0x26c846(_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);}logger[_0xbe5d('0x14')](_0xbe5d('0xf'),_0xc4d965,_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);return _0x19ca31(_0x4eddab['error'][_0xbe5d('0x16')]);}else{logger[_0xbe5d('0xe')](_0xbe5d('0xf'),_0xc4d965,_0xbe5d('0x10'));_0x19ca31(_0x4eddab['result']['message']);}})['catch'](function(_0x598798){logger[_0xbe5d('0x14')](_0xbe5d('0xf'),_0xc4d965,_0x598798);_0x26c846(_0x598798);});});}exports[_0xbe5d('0x17')]=function(_0x5bf8b4){var _0x2a6fbb=this;return new Promise(function(_0x53a3b4,_0x563c95){return db[_0xbe5d('0x18')][_0xbe5d('0x19')](_0x5bf8b4[_0xbe5d('0x1a')],{'raw':_0x5bf8b4[_0xbe5d('0x1b')]?_0x5bf8b4[_0xbe5d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbe5d('0xd')](function(_0x416f19){logger['info'](_0xbe5d('0x17'),_0x5bf8b4);logger[_0xbe5d('0x11')]('CreateReportAgentPreview',_0x5bf8b4,JSON[_0xbe5d('0x13')](_0x416f19));_0x53a3b4(_0x416f19);})[_0xbe5d('0x1c')](function(_0x6a2ef0){logger['error'](_0xbe5d('0x17'),_0x6a2ef0[_0xbe5d('0x16')],_0x5bf8b4);_0x563c95(_0x2a6fbb[_0xbe5d('0x14')](0x1f4,_0x6a2ef0[_0xbe5d('0x16')]));});});}; \ No newline at end of file +var _0xb22c=['then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateReportAgentPreview','body','options','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5bd948,_0x478409){var _0x52771a=function(_0x230a12){while(--_0x230a12){_0x5bd948['push'](_0x5bd948['shift']());}};_0x52771a(++_0x478409);}(_0xb22c,0x90));var _0xcb22=function(_0x23c17a,_0x190282){_0x23c17a=_0x23c17a-0x0;var _0x15cbc1=_0xb22c[_0x23c17a];return _0x15cbc1;};'use strict';var _=require(_0xcb22('0x0'));var util=require(_0xcb22('0x1'));var moment=require(_0xcb22('0x2'));var BPromise=require(_0xcb22('0x3'));var rs=require(_0xcb22('0x4'));var fs=require('fs');var Redis=require(_0xcb22('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb22('0x6'))(_0xcb22('0x7'));var config=require(_0xcb22('0x8'));var jayson=require(_0xcb22('0x9'));var client=jayson[_0xcb22('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23eedd,_0x58dcff,_0x5ab983){return new BPromise(function(_0x55b530,_0x589abd){return client[_0xcb22('0xb')](_0x23eedd,_0x5ab983)[_0xcb22('0xc')](function(_0x1bfa3d){logger['info'](_0xcb22('0xd'),_0x58dcff,_0xcb22('0xe'));logger[_0xcb22('0xf')](_0xcb22('0x10'),_0x58dcff,_0xcb22('0xe'),JSON['stringify'](_0x1bfa3d));if(_0x1bfa3d['error']){if(_0x1bfa3d['error']['code']===0x1f4){logger[_0xcb22('0x11')](_0xcb22('0xd'),_0x58dcff,_0x1bfa3d['error'][_0xcb22('0x12')]);return _0x589abd(_0x1bfa3d[_0xcb22('0x11')]['message']);}logger['error'](_0xcb22('0xd'),_0x58dcff,_0x1bfa3d[_0xcb22('0x11')]['message']);return _0x55b530(_0x1bfa3d[_0xcb22('0x11')][_0xcb22('0x12')]);}else{logger[_0xcb22('0x13')](_0xcb22('0xd'),_0x58dcff,_0xcb22('0xe'));_0x55b530(_0x1bfa3d[_0xcb22('0x14')][_0xcb22('0x12')]);}})['catch'](function(_0x3c56ab){logger[_0xcb22('0x11')](_0xcb22('0xd'),_0x58dcff,_0x3c56ab);_0x589abd(_0x3c56ab);});});}exports[_0xcb22('0x15')]=function(_0x2c25f7){var _0x4da11b=this;return new Promise(function(_0x2310dc,_0x325d38){return db['ReportAgentPreview']['create'](_0x2c25f7[_0xcb22('0x16')],{'raw':_0x2c25f7[_0xcb22('0x17')]?_0x2c25f7['options']['raw']===undefined?!![]:![]:!![]})[_0xcb22('0xc')](function(_0x3bd162){logger[_0xcb22('0x13')](_0xcb22('0x15'),_0x2c25f7);logger[_0xcb22('0xf')](_0xcb22('0x15'),_0x2c25f7,JSON[_0xcb22('0x18')](_0x3bd162));_0x2310dc(_0x3bd162);})[_0xcb22('0x19')](function(_0x2c906c){logger[_0xcb22('0x11')]('CreateReportAgentPreview',_0x2c906c[_0xcb22('0x12')],_0x2c25f7);_0x325d38(_0x4da11b[_0xcb22('0x11')](0x1f4,_0x2c906c[_0xcb22('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 40a271d..9158831 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 _0xf88a=['showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf88a,0x1e8));var _0xaf88=function(_0x3daac9,_0x5ca67d){_0x3daac9=_0x3daac9-0x0;var _0x1c5e70=_0xf88a[_0x3daac9];return _0x1c5e70;};'use strict';var multer=require(_0xaf88('0x0'));var util=require('util');var path=require('path');var express=require(_0xaf88('0x1'));var router=express[_0xaf88('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xaf88('0x3'));router['get'](_0xaf88('0x4'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x6')]);router[_0xaf88('0x7')](_0xaf88('0x8'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x9')]);router[_0xaf88('0x7')](_0xaf88('0xa'),auth['isAuthenticated'](),controller[_0xaf88('0xb')]);router[_0xaf88('0x7')](_0xaf88('0xc'),auth[_0xaf88('0x5')](),controller['voiceQueues']);router[_0xaf88('0x7')](_0xaf88('0xd'),auth[_0xaf88('0x5')](),controller[_0xaf88('0xe')]);router['get'](_0xaf88('0xf'),auth[_0xaf88('0x5')](),controller['mailQueues']);router[_0xaf88('0x7')](_0xaf88('0x10'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x11')]);router['get'](_0xaf88('0x12'),auth[_0xaf88('0x5')](),controller['openchannelQueues']);router[_0xaf88('0x7')](_0xaf88('0x13'),auth[_0xaf88('0x5')](),controller['smsQueues']);router[_0xaf88('0x7')](_0xaf88('0x14'),auth[_0xaf88('0x5')](),controller['whatsappQueues']);router[_0xaf88('0x7')](_0xaf88('0x15'),auth[_0xaf88('0x5')](),controller['faxQueues']);router[_0xaf88('0x7')](_0xaf88('0x16'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x17')]);router[_0xaf88('0x7')](_0xaf88('0x18'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x19')]);router[_0xaf88('0x7')](_0xaf88('0x1a'),auth['isAuthenticated'](),controller[_0xaf88('0x1b')]);router[_0xaf88('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xaf88('0x5')](),controller[_0xaf88('0x1c')]);router[_0xaf88('0x7')](_0xaf88('0x1d'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x1e')]);router[_0xaf88('0x7')]('/voice/queues/:id',auth[_0xaf88('0x5')](),controller['showVoiceQueues']);router[_0xaf88('0x1f')]('/voice/queues/:id',auth[_0xaf88('0x5')](),controller[_0xaf88('0x20')]);router[_0xaf88('0x7')](_0xaf88('0x21'),auth['isAuthenticated'](),controller[_0xaf88('0x22')]);router[_0xaf88('0x7')]('/outbound/channels',auth[_0xaf88('0x5')](),controller[_0xaf88('0x23')]);router[_0xaf88('0x7')](_0xaf88('0x24'),auth[_0xaf88('0x5')](),controller['agents']);router['put'](_0xaf88('0x25'),auth['isAuthenticated'](),controller[_0xaf88('0x26')]);router[_0xaf88('0x7')](_0xaf88('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0xaf88('0x7')](_0xaf88('0x28'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x29')]);router[_0xaf88('0x7')](_0xaf88('0x2a'),auth[_0xaf88('0x5')](),controller['campaigns']);router[_0xaf88('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xaf88('0x2b')]);router[_0xaf88('0x7')](_0xaf88('0x2c'),auth['isAuthenticated'](),controller[_0xaf88('0x2d')]);router[_0xaf88('0x7')](_0xaf88('0x2e'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x2f')]);router[_0xaf88('0x7')](_0xaf88('0x30'),auth[_0xaf88('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0xaf88('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xaf88('0x31')]);router[_0xaf88('0x7')](_0xaf88('0x32'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x33')]);router[_0xaf88('0x7')](_0xaf88('0x34'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x35')]);router[_0xaf88('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xaf88('0x36')](_0xaf88('0x37'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x39')));router['get'](_0xaf88('0x3a'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x3b')]);router['post'](_0xaf88('0x3c'),auth['isAuthenticated'](),controller[_0xaf88('0x38')](_0xaf88('0x3d')));router[_0xaf88('0x7')](_0xaf88('0x3e'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xaf88('0x36')](_0xaf88('0x3f'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x40')));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xaf88('0x41')]);router[_0xaf88('0x36')](_0xaf88('0x42'),auth[_0xaf88('0x5')](),controller['queueNotify'](_0xaf88('0x43')));router['get'](_0xaf88('0x44'),auth['isAuthenticated'](),controller[_0xaf88('0x45')]);router[_0xaf88('0x36')](_0xaf88('0x46'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x47')));router[_0xaf88('0x36')](_0xaf88('0x48'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')]('whatsapp'));router[_0xaf88('0x7')](_0xaf88('0x49'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x4a')]);router[_0xaf88('0x7')]('/whatsapp/queues/:id',auth[_0xaf88('0x5')](),controller[_0xaf88('0x4b')]);router[_0xaf88('0x36')](_0xaf88('0x4c'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x4d')]);module[_0xaf88('0x4e')]=router; \ No newline at end of file +var _0x27c3=['showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','/voice/queues/preview/:id','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id'];(function(_0x4bcc4a,_0x296dbf){var _0x38e4c3=function(_0x1a39e4){while(--_0x1a39e4){_0x4bcc4a['push'](_0x4bcc4a['shift']());}};_0x38e4c3(++_0x296dbf);}(_0x27c3,0x1a7));var _0x327c=function(_0x3ce4a5,_0x50bc4b){_0x3ce4a5=_0x3ce4a5-0x0;var _0x3f5809=_0x27c3[_0x3ce4a5];return _0x3f5809;};'use strict';var multer=require(_0x327c('0x0'));var util=require(_0x327c('0x1'));var path=require('path');var express=require(_0x327c('0x2'));var router=express[_0x327c('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x327c('0x4'));router[_0x327c('0x5')](_0x327c('0x6'),auth[_0x327c('0x7')](),controller[_0x327c('0x8')]);router['get'](_0x327c('0x9'),auth['isAuthenticated'](),controller[_0x327c('0xa')]);router['get'](_0x327c('0xb'),auth[_0x327c('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x327c('0x5')](_0x327c('0xc'),auth[_0x327c('0x7')](),controller[_0x327c('0xd')]);router[_0x327c('0x5')]('/chat/queues',auth[_0x327c('0x7')](),controller[_0x327c('0xe')]);router[_0x327c('0x5')](_0x327c('0xf'),auth[_0x327c('0x7')](),controller[_0x327c('0x10')]);router[_0x327c('0x5')](_0x327c('0x11'),auth[_0x327c('0x7')](),controller[_0x327c('0x12')]);router[_0x327c('0x5')]('/openchannel/queues',auth[_0x327c('0x7')](),controller[_0x327c('0x13')]);router['get'](_0x327c('0x14'),auth[_0x327c('0x7')](),controller['smsQueues']);router[_0x327c('0x5')]('/whatsapp/queues',auth[_0x327c('0x7')](),controller[_0x327c('0x15')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x327c('0x5')](_0x327c('0x16'),auth[_0x327c('0x7')](),controller['voiceQueuesPreview']);router[_0x327c('0x5')]('/voice/queues/channels',auth[_0x327c('0x7')](),controller['voiceQueuesChannels']);router[_0x327c('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x327c('0x5')](_0x327c('0x17'),auth['isAuthenticated'](),controller[_0x327c('0x18')]);router[_0x327c('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x327c('0x7')](),controller[_0x327c('0x19')]);router[_0x327c('0x5')](_0x327c('0x1a'),auth[_0x327c('0x7')](),controller[_0x327c('0x1b')]);router[_0x327c('0x1c')](_0x327c('0x1a'),auth[_0x327c('0x7')](),controller[_0x327c('0x1d')]);router[_0x327c('0x5')](_0x327c('0x1e'),auth['isAuthenticated'](),controller[_0x327c('0x1f')]);router[_0x327c('0x5')](_0x327c('0x20'),auth[_0x327c('0x7')](),controller[_0x327c('0x21')]);router[_0x327c('0x5')](_0x327c('0x22'),auth[_0x327c('0x7')](),controller[_0x327c('0x23')]);router[_0x327c('0x1c')](_0x327c('0x24'),auth['isAuthenticated'](),controller[_0x327c('0x25')]);router[_0x327c('0x5')]('/telephones',auth['isAuthenticated'](),controller[_0x327c('0x26')]);router['get'](_0x327c('0x27'),auth['isAuthenticated'](),controller[_0x327c('0x28')]);router[_0x327c('0x5')](_0x327c('0x29'),auth[_0x327c('0x7')](),controller[_0x327c('0x2a')]);router[_0x327c('0x5')]('/fax/accounts',auth[_0x327c('0x7')](),controller[_0x327c('0x2b')]);router[_0x327c('0x5')](_0x327c('0x2c'),auth[_0x327c('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x327c('0x5')](_0x327c('0x2d'),auth[_0x327c('0x7')](),controller[_0x327c('0x2e')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x327c('0x2f')]);router[_0x327c('0x5')](_0x327c('0x30'),auth[_0x327c('0x7')](),controller[_0x327c('0x31')]);router[_0x327c('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x327c('0x7')](),controller[_0x327c('0x32')]);router[_0x327c('0x5')](_0x327c('0x33'),auth[_0x327c('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x327c('0x34')](_0x327c('0x35'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')](_0x327c('0x37')));router[_0x327c('0x5')]('/mail/queues/:id',auth[_0x327c('0x7')](),controller['showMailQueues']);router[_0x327c('0x34')](_0x327c('0x38'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')](_0x327c('0x39')));router[_0x327c('0x5')]('/chat/queues/:id',auth[_0x327c('0x7')](),controller[_0x327c('0x3a')]);router[_0x327c('0x34')](_0x327c('0x3b'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')](_0x327c('0x3c')));router[_0x327c('0x5')](_0x327c('0x3d'),auth[_0x327c('0x7')](),controller['showFaxQueues']);router[_0x327c('0x34')](_0x327c('0x3e'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')]('openchannel'));router[_0x327c('0x5')](_0x327c('0x3f'),auth['isAuthenticated'](),controller[_0x327c('0x40')]);router[_0x327c('0x34')](_0x327c('0x41'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')](_0x327c('0x42')));router[_0x327c('0x34')](_0x327c('0x43'),auth[_0x327c('0x7')](),controller[_0x327c('0x36')](_0x327c('0x44')));router[_0x327c('0x5')](_0x327c('0x45'),auth[_0x327c('0x7')](),controller['showSmsQueues']);router[_0x327c('0x5')](_0x327c('0x46'),auth[_0x327c('0x7')](),controller[_0x327c('0x47')]);router[_0x327c('0x34')](_0x327c('0x48'),auth[_0x327c('0x7')](),controller[_0x327c('0x49')]);module[_0x327c('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 58c9c00..d6d0d89 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x56cd80,_0x4e786b){var _0x2e3182=function(_0x385542){while(--_0x385542){_0x56cd80['push'](_0x56cd80['shift']());}};_0x2e3182(++_0x4e786b);}(_0xe706,0xa3));var _0x6e70=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0xe706[_0x2db025];return _0x47afbe;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x294211,_0x51aa17){var _0x997b43=function(_0x39c806){while(--_0x39c806){_0x294211['push'](_0x294211['shift']());}};_0x997b43(++_0x51aa17);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4f4b0ce..5184191 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 _0x241c=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','post','create','put','update'];(function(_0x2a299e,_0x5327be){var _0xaa1cde=function(_0x4889e9){while(--_0x4889e9){_0x2a299e['push'](_0x2a299e['shift']());}};_0xaa1cde(++_0x5327be);}(_0x241c,0x145));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xc241('0x0'));var path=require(_0xc241('0x1'));var timeout=require(_0xc241('0x2'));var express=require('express');var router=express[_0xc241('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc241('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc241('0x5'));router[_0xc241('0x6')]('/',auth['isAuthenticated'](),controller[_0xc241('0x7')]);router[_0xc241('0x6')](_0xc241('0x8'),auth[_0xc241('0x9')](),controller[_0xc241('0xa')]);router[_0xc241('0x6')](_0xc241('0xb'),auth[_0xc241('0x9')](),controller[_0xc241('0xc')]);router[_0xc241('0xd')]('/',auth[_0xc241('0x9')](),controller[_0xc241('0xe')]);router[_0xc241('0xf')](_0xc241('0x8'),auth[_0xc241('0x9')](),controller[_0xc241('0x10')]);router['delete']('/:id',auth[_0xc241('0x9')](),controller[_0xc241('0x11')]);module[_0xc241('0x12')]=router; \ No newline at end of file +var _0xe26b=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe26b,0x116));var _0xbe26=function(_0x29682e,_0x45ba07){_0x29682e=_0x29682e-0x0;var _0x2a2617=_0xe26b[_0x29682e];return _0x2a2617;};'use strict';var multer=require(_0xbe26('0x0'));var util=require('util');var path=require(_0xbe26('0x1'));var timeout=require(_0xbe26('0x2'));var express=require(_0xbe26('0x3'));var router=express[_0xbe26('0x4')]();var fs_extra=require(_0xbe26('0x5'));var auth=require(_0xbe26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe26('0x7'));var controller=require(_0xbe26('0x8'));router[_0xbe26('0x9')]('/',auth[_0xbe26('0xa')](),controller['index']);router[_0xbe26('0x9')](_0xbe26('0xb'),auth['isAuthenticated'](),controller[_0xbe26('0xc')]);router[_0xbe26('0x9')](_0xbe26('0xd'),auth['isAuthenticated'](),controller[_0xbe26('0xe')]);router[_0xbe26('0xf')]('/',auth[_0xbe26('0xa')](),controller[_0xbe26('0x10')]);router[_0xbe26('0x11')]('/:id',auth[_0xbe26('0xa')](),controller[_0xbe26('0x12')]);router['delete'](_0xbe26('0xb'),auth[_0xbe26('0xa')](),controller[_0xbe26('0x13')]);module[_0xbe26('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 38839fa..381a5f1 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 _0x48e2=['months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x48e2,0x11c));var _0x248e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x48e2[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x248e('0x0'));module[_0x248e('0x1')]={'name':{'type':Sequelize[_0x248e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x248e('0x2')]},'active':{'type':Sequelize[_0x248e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x248e('0x4')},'startAt':{'type':Sequelize[_0x248e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x248e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x248e('0x7')](_0x248e('0x8'),_0x248e('0x9'),_0x248e('0xa'),_0x248e('0xb'),'days',_0x248e('0xc'),_0x248e('0xd')),'allowNull':![],'defaultValue':_0x248e('0xe')},'output':{'type':Sequelize[_0x248e('0x7')](_0x248e('0xf'),_0x248e('0x10'),_0x248e('0x11')),'allowNull':![],'defaultValue':_0x248e('0xf')},'type':{'type':Sequelize[_0x248e('0x7')](_0x248e('0x12'),_0x248e('0x13')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x248e('0x14')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d54=['quarters','days','hours','minutes','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years'];(function(_0x32ff3b,_0x218237){var _0xe75f40=function(_0x5600c3){while(--_0x5600c3){_0x32ff3b['push'](_0x32ff3b['shift']());}};_0xe75f40(++_0x218237);}(_0x2d54,0x14e));var _0x42d5=function(_0x2bd4e3,_0x4d9b53){_0x2bd4e3=_0x2bd4e3-0x0;var _0x259f7c=_0x2d54[_0x2bd4e3];return _0x259f7c;};'use strict';var Sequelize=require(_0x42d5('0x0'));module[_0x42d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x42d5('0x2')]},'active':{'type':Sequelize[_0x42d5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x42d5('0x4')},'startAt':{'type':Sequelize[_0x42d5('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x42d5('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x42d5('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x42d5('0x7'),_0x42d5('0x8'),'months','weeks',_0x42d5('0x9'),_0x42d5('0xa'),_0x42d5('0xb')),'allowNull':![],'defaultValue':_0x42d5('0x9')},'output':{'type':Sequelize[_0x42d5('0xc')](_0x42d5('0xd'),_0x42d5('0xe'),_0x42d5('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x42d5('0xc')](_0x42d5('0x10'),_0x42d5('0x11')),'allowNull':![],'defaultValue':_0x42d5('0x10')},'sendMail':{'type':Sequelize[_0x42d5('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x42d5('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x42d5('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a783560..732a96c 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 _0xaba4=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','query','keys','filters'];(function(_0x496b42,_0x53fe74){var _0x57347a=function(_0xec988f){while(--_0xec988f){_0x496b42['push'](_0x496b42['shift']());}};_0x57347a(++_0x53fe74);}(_0xaba4,0x179));var _0x4aba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaba4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4aba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aba('0x2'));var moment=require(_0x4aba('0x3'));var BPromise=require(_0x4aba('0x4'));var Mustache=require(_0x4aba('0x5'));var util=require('util');var path=require(_0x4aba('0x6'));var sox=require(_0x4aba('0x7'));var csv=require('to-csv');var ejs=require(_0x4aba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4aba('0x9'));var jsforce=require(_0x4aba('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4aba('0xb'));var querystring=require(_0x4aba('0xc'));var Papa=require(_0x4aba('0xd'));var Redis=require(_0x4aba('0xe'));var authService=require(_0x4aba('0xf'));var qs=require(_0x4aba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aba('0x11'));var logger=require(_0x4aba('0x12'))(_0x4aba('0x13'));var utils=require(_0x4aba('0x14'));var config=require(_0x4aba('0x15'));var licenseUtil=require(_0x4aba('0x16'));var db=require(_0x4aba('0x17'))['db'];function respondWithStatusCode(_0x3fad72,_0x48a07e){_0x48a07e=_0x48a07e||0xcc;return function(_0x3ccdc8){if(_0x3ccdc8){return _0x3fad72[_0x4aba('0x18')](_0x48a07e);}return _0x3fad72['status'](_0x48a07e)[_0x4aba('0x19')]();};}function respondWithResult(_0x148e3b,_0x54086f){_0x54086f=_0x54086f||0xc8;return function(_0x2f40eb){if(_0x2f40eb){return _0x148e3b[_0x4aba('0x1a')](_0x54086f)['json'](_0x2f40eb);}};}function respondWithFilteredResult(_0x3a1351,_0xe9ee88){return function(_0x587972){if(_0x587972){var _0x1bb473=typeof _0xe9ee88[_0x4aba('0x1b')]===_0x4aba('0x1c')&&typeof _0xe9ee88['limit']==='undefined';var _0x179f27=_0x587972[_0x4aba('0x1d')];var _0x1aefe5=_0x1bb473?0x0:_0xe9ee88[_0x4aba('0x1b')];var _0x3ee8da=_0x1bb473?_0x587972['count']:_0xe9ee88[_0x4aba('0x1b')]+_0xe9ee88[_0x4aba('0x1e')];var _0x75f3d6;if(_0x3ee8da>=_0x179f27){_0x3ee8da=_0x179f27;_0x75f3d6=0xc8;}else{_0x75f3d6=0xce;}_0x3a1351[_0x4aba('0x1a')](_0x75f3d6);return _0x3a1351[_0x4aba('0x1f')](_0x4aba('0x20'),_0x1aefe5+'-'+_0x3ee8da+'/'+_0x179f27)[_0x4aba('0x21')](_0x587972);}return null;};}function patchUpdates(_0x947d00){return function(_0x3f0777){try{jsonpatch[_0x4aba('0x22')](_0x3f0777,_0x947d00,!![]);}catch(_0x32ae34){return BPromise[_0x4aba('0x23')](_0x32ae34);}return _0x3f0777[_0x4aba('0x24')]();};}function saveUpdates(_0x274011,_0x9f637b){return function(_0x308ecf){if(_0x308ecf){return _0x308ecf['update'](_0x274011)[_0x4aba('0x25')](function(_0x2b4719){return _0x2b4719;});}return null;};}function removeEntity(_0x20586e,_0x4377a7){return function(_0x406cd6){if(_0x406cd6){return _0x406cd6[_0x4aba('0x26')]()['then'](function(){var _0x248b16=_0x406cd6[_0x4aba('0x27')]({'plain':!![]});var _0x1b46b4=_0x4aba('0x28');return db[_0x4aba('0x29')][_0x4aba('0x26')]({'where':{'type':_0x1b46b4,'resourceId':_0x248b16['id']}})[_0x4aba('0x25')](function(){return _0x406cd6;});})[_0x4aba('0x25')](function(){_0x20586e[_0x4aba('0x1a')](0xcc)[_0x4aba('0x19')]();});}};}function handleEntityNotFound(_0x6da009,_0x565fb1){return function(_0x221a5d){if(!_0x221a5d){_0x6da009['sendStatus'](0x194);}return _0x221a5d;};}function handleError(_0x2920ff,_0x29b7e5){_0x29b7e5=_0x29b7e5||0x1f4;return function(_0x4c6431){logger[_0x4aba('0x2a')](_0x4c6431[_0x4aba('0x2b')]);if(_0x4c6431[_0x4aba('0x2c')]){delete _0x4c6431[_0x4aba('0x2c')];}_0x2920ff[_0x4aba('0x1a')](_0x29b7e5)[_0x4aba('0x2d')](_0x4c6431);};}exports['index']=function(_0x241939,_0x333926){var _0x330689={},_0x53cce2={},_0x143b17={'count':0x0,'rows':[]};var _0x599177=_[_0x4aba('0x2e')](db[_0x4aba('0x2f')][_0x4aba('0x30')],function(_0x5644ea){return{'name':_0x5644ea[_0x4aba('0x31')],'type':_0x5644ea['type']['key']};});_0x53cce2['model']=_['map'](_0x599177,'name');_0x53cce2[_0x4aba('0x32')]=_[_0x4aba('0x33')](_0x241939['query']);_0x53cce2[_0x4aba('0x34')]=_['intersection'](_0x53cce2[_0x4aba('0x35')],_0x53cce2[_0x4aba('0x32')]);_0x330689[_0x4aba('0x36')]=_['intersection'](_0x53cce2['model'],qs[_0x4aba('0x37')](_0x241939[_0x4aba('0x32')]['fields']));_0x330689['attributes']=_0x330689[_0x4aba('0x36')][_0x4aba('0x38')]?_0x330689[_0x4aba('0x36')]:_0x53cce2[_0x4aba('0x35')];if(!_0x241939[_0x4aba('0x32')][_0x4aba('0x39')](_0x4aba('0x3a'))){_0x330689[_0x4aba('0x1e')]=qs[_0x4aba('0x1e')](_0x241939[_0x4aba('0x32')][_0x4aba('0x1e')]);_0x330689[_0x4aba('0x1b')]=qs[_0x4aba('0x1b')](_0x241939[_0x4aba('0x32')][_0x4aba('0x1b')]);}_0x330689['order']=qs[_0x4aba('0x3b')](_0x241939[_0x4aba('0x32')][_0x4aba('0x3b')]);_0x330689[_0x4aba('0x3c')]=qs[_0x4aba('0x34')](_[_0x4aba('0x3d')](_0x241939[_0x4aba('0x32')],_0x53cce2[_0x4aba('0x34')]),_0x599177);if(_0x241939['query'][_0x4aba('0x3e')]){_0x330689[_0x4aba('0x3c')]=_[_0x4aba('0x3f')](_0x330689[_0x4aba('0x3c')],{'$or':_[_0x4aba('0x2e')](_0x599177,function(_0xd0f9d1){if(_0xd0f9d1[_0x4aba('0x40')]!==_0x4aba('0x41')){var _0x12a165={};_0x12a165[_0xd0f9d1[_0x4aba('0x2c')]]={'$like':'%'+_0x241939[_0x4aba('0x32')][_0x4aba('0x3e')]+'%'};return _0x12a165;}})});}_0x330689=_[_0x4aba('0x3f')]({},_0x330689,_0x241939['options']);var _0x585aa7={'where':_0x330689[_0x4aba('0x3c')]};return db[_0x4aba('0x2f')]['count'](_0x585aa7)[_0x4aba('0x25')](function(_0x234f2e){_0x143b17[_0x4aba('0x1d')]=_0x234f2e;if(_0x241939[_0x4aba('0x32')][_0x4aba('0x42')]){_0x330689[_0x4aba('0x43')]=[{'all':!![]}];}return db[_0x4aba('0x2f')][_0x4aba('0x44')](_0x330689);})['then'](function(_0x564c69){_0x143b17[_0x4aba('0x45')]=_0x564c69;return _0x143b17;})[_0x4aba('0x25')](respondWithFilteredResult(_0x333926,_0x330689))[_0x4aba('0x46')](handleError(_0x333926,null));};exports['show']=function(_0x4d7548,_0x45ccb2){var _0x528318={'raw':![],'where':{'id':_0x4d7548[_0x4aba('0x47')]['id']}},_0x19b2c0={};_0x19b2c0['model']=_[_0x4aba('0x33')](db[_0x4aba('0x2f')]['rawAttributes']);_0x19b2c0[_0x4aba('0x32')]=_[_0x4aba('0x33')](_0x4d7548['query']);_0x19b2c0[_0x4aba('0x34')]=_[_0x4aba('0x48')](_0x19b2c0[_0x4aba('0x35')],_0x19b2c0[_0x4aba('0x32')]);_0x528318['attributes']=_['intersection'](_0x19b2c0[_0x4aba('0x35')],qs[_0x4aba('0x37')](_0x4d7548[_0x4aba('0x32')]['fields']));_0x528318[_0x4aba('0x36')]=_0x528318[_0x4aba('0x36')][_0x4aba('0x38')]?_0x528318[_0x4aba('0x36')]:_0x19b2c0['model'];if(_0x4d7548[_0x4aba('0x32')][_0x4aba('0x42')]){_0x528318[_0x4aba('0x43')]=[{'all':!![]}];}_0x528318=_[_0x4aba('0x3f')]({},_0x528318,_0x4d7548[_0x4aba('0x49')]);return db[_0x4aba('0x2f')][_0x4aba('0x4a')](_0x528318)[_0x4aba('0x25')](handleEntityNotFound(_0x45ccb2,null))[_0x4aba('0x25')](respondWithResult(_0x45ccb2,null))['catch'](handleError(_0x45ccb2,null));};exports[_0x4aba('0x4b')]=function(_0x28c1f5,_0x343b67){return db[_0x4aba('0x2f')][_0x4aba('0x4b')](_0x28c1f5['body'],{})[_0x4aba('0x25')](function(_0x1cda62){var _0x27d3fc=_0x28c1f5[_0x4aba('0x4c')]['get']({'plain':!![]});if(!_0x27d3fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d3fc[_0x4aba('0x4d')]===_0x4aba('0x4c')){var _0x3e0bbe=_0x1cda62['get']({'plain':!![]});var _0x1fd8c5=_0x4aba('0x28');return db[_0x4aba('0x4e')][_0x4aba('0x4a')]({'where':{'name':_0x1fd8c5,'userProfileId':_0x27d3fc[_0x4aba('0x4f')]},'raw':!![]})['then'](function(_0x700f7a){if(_0x700f7a&&_0x700f7a[_0x4aba('0x50')]===0x0){return db[_0x4aba('0x29')][_0x4aba('0x4b')]({'name':_0x3e0bbe['name'],'resourceId':_0x3e0bbe['id'],'type':_0x700f7a[_0x4aba('0x2c')],'sectionId':_0x700f7a['id']},{})[_0x4aba('0x25')](function(){return _0x1cda62;});}else{return _0x1cda62;}})[_0x4aba('0x46')](function(_0x3d9bd8){logger['error'](_0x4aba('0x51'),_0x3d9bd8);throw _0x3d9bd8;});}return _0x1cda62;})[_0x4aba('0x25')](respondWithResult(_0x343b67,0xc9))[_0x4aba('0x46')](handleError(_0x343b67,null));};exports[_0x4aba('0x52')]=function(_0x20587f,_0x2c5969){if(_0x20587f[_0x4aba('0x53')]['id']){delete _0x20587f['body']['id'];}return db[_0x4aba('0x2f')][_0x4aba('0x4a')]({'where':{'id':_0x20587f[_0x4aba('0x47')]['id']}})[_0x4aba('0x25')](handleEntityNotFound(_0x2c5969,null))[_0x4aba('0x25')](saveUpdates(_0x20587f[_0x4aba('0x53')],null))[_0x4aba('0x25')](respondWithResult(_0x2c5969,null))[_0x4aba('0x46')](handleError(_0x2c5969,null));};exports['destroy']=function(_0x156897,_0x4ce4d3){return db['Schedule'][_0x4aba('0x4a')]({'where':{'id':_0x156897['params']['id']}})[_0x4aba('0x25')](handleEntityNotFound(_0x4ce4d3,null))['then'](removeEntity(_0x4ce4d3,null))['catch'](handleError(_0x4ce4d3,null));};exports[_0x4aba('0x54')]=function(_0x1b1432,_0x22ec57,_0x2005dd){var _0x411619=require(_0x4aba('0x55'));return db[_0x4aba('0x2f')]['find']({'where':{'id':_0x1b1432[_0x4aba('0x47')]['id']},'raw':!![]})[_0x4aba('0x25')](handleEntityNotFound(_0x22ec57,null))[_0x4aba('0x25')](function(){_0x411619[_0x4aba('0x54')](_0x1b1432[_0x4aba('0x47')]['id']);})[_0x4aba('0x25')](respondWithStatusCode(_0x22ec57,null))[_0x4aba('0x46')](handleError(_0x22ec57,null));}; \ No newline at end of file +var _0x8f39=['find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','then','sendStatus','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','map','query','keys','model','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','attributes','length'];(function(_0x205328,_0x5ce216){var _0x1f5399=function(_0x14db92){while(--_0x14db92){_0x205328['push'](_0x205328['shift']());}};_0x1f5399(++_0x5ce216);}(_0x8f39,0x1b6));var _0x98f3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8f39[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x98f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x98f3('0x1'));var rp=require('request-promise');var moment=require(_0x98f3('0x2'));var BPromise=require(_0x98f3('0x3'));var Mustache=require(_0x98f3('0x4'));var util=require(_0x98f3('0x5'));var path=require(_0x98f3('0x6'));var sox=require('sox');var csv=require(_0x98f3('0x7'));var ejs=require(_0x98f3('0x8'));var fs=require('fs');var fs_extra=require(_0x98f3('0x9'));var _=require(_0x98f3('0xa'));var squel=require('squel');var crypto=require(_0x98f3('0xb'));var jsforce=require(_0x98f3('0xc'));var deskjs=require(_0x98f3('0xd'));var toCsv=require(_0x98f3('0x7'));var querystring=require(_0x98f3('0xe'));var Papa=require(_0x98f3('0xf'));var Redis=require('ioredis');var authService=require(_0x98f3('0x10'));var qs=require(_0x98f3('0x11'));var as=require(_0x98f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98f3('0x13'))(_0x98f3('0x14'));var utils=require(_0x98f3('0x15'));var config=require(_0x98f3('0x16'));var licenseUtil=require(_0x98f3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c402a,_0x4c305b){_0x4c305b=_0x4c305b||0xcc;return function(_0x544594){if(_0x544594){return _0x1c402a['sendStatus'](_0x4c305b);}return _0x1c402a['status'](_0x4c305b)[_0x98f3('0x18')]();};}function respondWithResult(_0x32ab3c,_0x55c4e3){_0x55c4e3=_0x55c4e3||0xc8;return function(_0x391342){if(_0x391342){return _0x32ab3c[_0x98f3('0x19')](_0x55c4e3)[_0x98f3('0x1a')](_0x391342);}};}function respondWithFilteredResult(_0x524c22,_0x3c3dde){return function(_0x2590db){if(_0x2590db){var _0x22ba7b=typeof _0x3c3dde[_0x98f3('0x1b')]===_0x98f3('0x1c')&&typeof _0x3c3dde[_0x98f3('0x1d')]===_0x98f3('0x1c');var _0x3303d0=_0x2590db[_0x98f3('0x1e')];var _0x2c897c=_0x22ba7b?0x0:_0x3c3dde[_0x98f3('0x1b')];var _0xf3445d=_0x22ba7b?_0x2590db[_0x98f3('0x1e')]:_0x3c3dde[_0x98f3('0x1b')]+_0x3c3dde[_0x98f3('0x1d')];var _0xee7930;if(_0xf3445d>=_0x3303d0){_0xf3445d=_0x3303d0;_0xee7930=0xc8;}else{_0xee7930=0xce;}_0x524c22[_0x98f3('0x19')](_0xee7930);return _0x524c22['set'](_0x98f3('0x1f'),_0x2c897c+'-'+_0xf3445d+'/'+_0x3303d0)[_0x98f3('0x1a')](_0x2590db);}return null;};}function patchUpdates(_0x3b28c3){return function(_0x40549a){try{jsonpatch[_0x98f3('0x20')](_0x40549a,_0x3b28c3,!![]);}catch(_0x49cd51){return BPromise[_0x98f3('0x21')](_0x49cd51);}return _0x40549a[_0x98f3('0x22')]();};}function saveUpdates(_0x5060be,_0x20bd53){return function(_0x498ebb){if(_0x498ebb){return _0x498ebb[_0x98f3('0x23')](_0x5060be)['then'](function(_0x4371cb){return _0x4371cb;});}return null;};}function removeEntity(_0xf1207a,_0x56d823){return function(_0x56fdd5){if(_0x56fdd5){return _0x56fdd5[_0x98f3('0x24')]()['then'](function(){var _0xd3d4af=_0x56fdd5[_0x98f3('0x25')]({'plain':!![]});var _0x5cfb80='Scheduler';return db['UserProfileResource'][_0x98f3('0x24')]({'where':{'type':_0x5cfb80,'resourceId':_0xd3d4af['id']}})[_0x98f3('0x26')](function(){return _0x56fdd5;});})[_0x98f3('0x26')](function(){_0xf1207a[_0x98f3('0x19')](0xcc)[_0x98f3('0x18')]();});}};}function handleEntityNotFound(_0x2762cb,_0xfa086f){return function(_0x237af2){if(!_0x237af2){_0x2762cb[_0x98f3('0x27')](0x194);}return _0x237af2;};}function handleError(_0x25e7e1,_0xa6028){_0xa6028=_0xa6028||0x1f4;return function(_0x57f3e2){logger['error'](_0x57f3e2[_0x98f3('0x28')]);if(_0x57f3e2[_0x98f3('0x29')]){delete _0x57f3e2[_0x98f3('0x29')];}_0x25e7e1[_0x98f3('0x19')](_0xa6028)[_0x98f3('0x2a')](_0x57f3e2);};}exports[_0x98f3('0x2b')]=function(_0x36d0f8,_0x3369cd){var _0x3bcc03={},_0x324cc4={},_0xdf4c99={'count':0x0,'rows':[]};var _0x5afaf7=_['map'](db[_0x98f3('0x2c')][_0x98f3('0x2d')],function(_0x40ea9b){return{'name':_0x40ea9b[_0x98f3('0x2e')],'type':_0x40ea9b[_0x98f3('0x2f')][_0x98f3('0x30')]};});_0x324cc4['model']=_[_0x98f3('0x31')](_0x5afaf7,'name');_0x324cc4[_0x98f3('0x32')]=_[_0x98f3('0x33')](_0x36d0f8['query']);_0x324cc4['filters']=_['intersection'](_0x324cc4[_0x98f3('0x34')],_0x324cc4[_0x98f3('0x32')]);_0x3bcc03['attributes']=_[_0x98f3('0x35')](_0x324cc4[_0x98f3('0x34')],qs['fields'](_0x36d0f8[_0x98f3('0x32')][_0x98f3('0x36')]));_0x3bcc03['attributes']=_0x3bcc03['attributes']['length']?_0x3bcc03['attributes']:_0x324cc4[_0x98f3('0x34')];if(!_0x36d0f8[_0x98f3('0x32')][_0x98f3('0x37')](_0x98f3('0x38'))){_0x3bcc03[_0x98f3('0x1d')]=qs[_0x98f3('0x1d')](_0x36d0f8[_0x98f3('0x32')]['limit']);_0x3bcc03[_0x98f3('0x1b')]=qs[_0x98f3('0x1b')](_0x36d0f8[_0x98f3('0x32')][_0x98f3('0x1b')]);}_0x3bcc03[_0x98f3('0x39')]=qs['sort'](_0x36d0f8['query'][_0x98f3('0x3a')]);_0x3bcc03[_0x98f3('0x3b')]=qs[_0x98f3('0x3c')](_[_0x98f3('0x3d')](_0x36d0f8[_0x98f3('0x32')],_0x324cc4[_0x98f3('0x3c')]),_0x5afaf7);if(_0x36d0f8[_0x98f3('0x32')][_0x98f3('0x3e')]){_0x3bcc03[_0x98f3('0x3b')]=_[_0x98f3('0x3f')](_0x3bcc03[_0x98f3('0x3b')],{'$or':_[_0x98f3('0x31')](_0x5afaf7,function(_0x2f6580){if(_0x2f6580[_0x98f3('0x2f')]!==_0x98f3('0x40')){var _0x2c7dd3={};_0x2c7dd3[_0x2f6580[_0x98f3('0x29')]]={'$like':'%'+_0x36d0f8[_0x98f3('0x32')][_0x98f3('0x3e')]+'%'};return _0x2c7dd3;}})});}_0x3bcc03=_[_0x98f3('0x3f')]({},_0x3bcc03,_0x36d0f8[_0x98f3('0x41')]);var _0xd63f2b={'where':_0x3bcc03[_0x98f3('0x3b')]};return db[_0x98f3('0x2c')][_0x98f3('0x1e')](_0xd63f2b)[_0x98f3('0x26')](function(_0x262815){_0xdf4c99[_0x98f3('0x1e')]=_0x262815;if(_0x36d0f8['query'][_0x98f3('0x42')]){_0x3bcc03[_0x98f3('0x43')]=[{'all':!![]}];}return db[_0x98f3('0x2c')]['findAll'](_0x3bcc03);})[_0x98f3('0x26')](function(_0x4c5e43){_0xdf4c99['rows']=_0x4c5e43;return _0xdf4c99;})[_0x98f3('0x26')](respondWithFilteredResult(_0x3369cd,_0x3bcc03))[_0x98f3('0x44')](handleError(_0x3369cd,null));};exports['show']=function(_0x5427f5,_0x238020){var _0x39ae5a={'raw':![],'where':{'id':_0x5427f5[_0x98f3('0x45')]['id']}},_0x235ce8={};_0x235ce8[_0x98f3('0x34')]=_[_0x98f3('0x33')](db[_0x98f3('0x2c')][_0x98f3('0x2d')]);_0x235ce8['query']=_[_0x98f3('0x33')](_0x5427f5[_0x98f3('0x32')]);_0x235ce8[_0x98f3('0x3c')]=_['intersection'](_0x235ce8['model'],_0x235ce8['query']);_0x39ae5a[_0x98f3('0x46')]=_[_0x98f3('0x35')](_0x235ce8[_0x98f3('0x34')],qs[_0x98f3('0x36')](_0x5427f5[_0x98f3('0x32')]['fields']));_0x39ae5a[_0x98f3('0x46')]=_0x39ae5a[_0x98f3('0x46')][_0x98f3('0x47')]?_0x39ae5a[_0x98f3('0x46')]:_0x235ce8[_0x98f3('0x34')];if(_0x5427f5[_0x98f3('0x32')][_0x98f3('0x42')]){_0x39ae5a['include']=[{'all':!![]}];}_0x39ae5a=_[_0x98f3('0x3f')]({},_0x39ae5a,_0x5427f5[_0x98f3('0x41')]);return db[_0x98f3('0x2c')][_0x98f3('0x48')](_0x39ae5a)['then'](handleEntityNotFound(_0x238020,null))[_0x98f3('0x26')](respondWithResult(_0x238020,null))[_0x98f3('0x44')](handleError(_0x238020,null));};exports['create']=function(_0x2532bf,_0x28589e){return db[_0x98f3('0x2c')]['create'](_0x2532bf[_0x98f3('0x49')],{})[_0x98f3('0x26')](function(_0x4516c1){var _0x5b2167=_0x2532bf[_0x98f3('0x4a')][_0x98f3('0x25')]({'plain':!![]});if(!_0x5b2167)throw new Error(_0x98f3('0x4b'));if(_0x5b2167[_0x98f3('0x4c')]==='user'){var _0x517b5b=_0x4516c1[_0x98f3('0x25')]({'plain':!![]});var _0x25d522=_0x98f3('0x4d');return db[_0x98f3('0x4e')][_0x98f3('0x48')]({'where':{'name':_0x25d522,'userProfileId':_0x5b2167[_0x98f3('0x4f')]},'raw':!![]})[_0x98f3('0x26')](function(_0x519332){if(_0x519332&&_0x519332[_0x98f3('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x517b5b[_0x98f3('0x29')],'resourceId':_0x517b5b['id'],'type':_0x519332[_0x98f3('0x29')],'sectionId':_0x519332['id']},{})[_0x98f3('0x26')](function(){return _0x4516c1;});}else{return _0x4516c1;}})[_0x98f3('0x44')](function(_0x10c6cc){logger[_0x98f3('0x51')](_0x98f3('0x52'),_0x10c6cc);throw _0x10c6cc;});}return _0x4516c1;})['then'](respondWithResult(_0x28589e,0xc9))['catch'](handleError(_0x28589e,null));};exports[_0x98f3('0x23')]=function(_0x5032ce,_0x2c9667){if(_0x5032ce[_0x98f3('0x49')]['id']){delete _0x5032ce[_0x98f3('0x49')]['id'];}return db[_0x98f3('0x2c')][_0x98f3('0x48')]({'where':{'id':_0x5032ce[_0x98f3('0x45')]['id']}})[_0x98f3('0x26')](handleEntityNotFound(_0x2c9667,null))[_0x98f3('0x26')](saveUpdates(_0x5032ce[_0x98f3('0x49')],null))[_0x98f3('0x26')](respondWithResult(_0x2c9667,null))[_0x98f3('0x44')](handleError(_0x2c9667,null));};exports['destroy']=function(_0x200d68,_0x165599){return db[_0x98f3('0x2c')][_0x98f3('0x48')]({'where':{'id':_0x200d68[_0x98f3('0x45')]['id']}})[_0x98f3('0x26')](handleEntityNotFound(_0x165599,null))['then'](removeEntity(_0x165599,null))[_0x98f3('0x44')](handleError(_0x165599,null));};exports['run']=function(_0x5c4e83,_0x40c1ec,_0x5da894){var _0x261be2=require(_0x98f3('0x53'));return db['Schedule'][_0x98f3('0x48')]({'where':{'id':_0x5c4e83[_0x98f3('0x45')]['id']},'raw':!![]})[_0x98f3('0x26')](handleEntityNotFound(_0x40c1ec,null))[_0x98f3('0x26')](function(){_0x261be2[_0x98f3('0x54')](_0x5c4e83[_0x98f3('0x45')]['id']);})['then'](respondWithStatusCode(_0x40c1ec,null))['catch'](handleError(_0x40c1ec,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 42c1afa..8fdeed4 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 _0xbe19=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1c729d,_0xa41d84){var _0x14f4ec=function(_0x48c82d){while(--_0x48c82d){_0x1c729d['push'](_0x1c729d['shift']());}};_0x14f4ec(++_0xa41d84);}(_0xbe19,0x93));var _0x9be1=function(_0x1c24e3,_0x2bf2dc){_0x1c24e3=_0x1c24e3-0x0;var _0x16eb3e=_0xbe19[_0x1c24e3];return _0x16eb3e;};'use strict';var _=require(_0x9be1('0x0'));var util=require(_0x9be1('0x1'));var logger=require(_0x9be1('0x2'))(_0x9be1('0x3'));var moment=require(_0x9be1('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be1('0x5'));var fs=require('fs');var path=require(_0x9be1('0x6'));var rimraf=require(_0x9be1('0x7'));var config=require(_0x9be1('0x8'));var attributes=require('./schedule.attributes');module[_0x9be1('0x9')]=function(_0x14c9e9,_0x5c3d6b){return _0x14c9e9[_0x9be1('0xa')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b4d=['bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment'];(function(_0x5545dd,_0x51898b){var _0x7999f9=function(_0x4fcf53){while(--_0x4fcf53){_0x5545dd['push'](_0x5545dd['shift']());}};_0x7999f9(++_0x51898b);}(_0x5b4d,0x8b));var _0xd5b4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5b4d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd5b4('0x0'));var util=require('util');var logger=require(_0xd5b4('0x1'))(_0xd5b4('0x2'));var moment=require(_0xd5b4('0x3'));var BPromise=require(_0xd5b4('0x4'));var rp=require(_0xd5b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5b4('0x6'));var config=require(_0xd5b4('0x7'));var attributes=require(_0xd5b4('0x8'));module[_0xd5b4('0x9')]=function(_0x41d092,_0x4f932b){return _0x41d092[_0xd5b4('0xa')](_0xd5b4('0xb'),attributes,{'tableName':_0xd5b4('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 1cee6fb..be0ff09 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 _0x9e89=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0x9e89,0x141));var _0x99e8=function(_0xadc1cb,_0x2f2009){_0xadc1cb=_0xadc1cb-0x0;var _0x555c41=_0x9e89[_0xadc1cb];return _0x555c41;};'use strict';var _=require(_0x99e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99e8('0x1'));var rs=require(_0x99e8('0x2'));var fs=require('fs');var Redis=require(_0x99e8('0x3'));var db=require(_0x99e8('0x4'))['db'];var utils=require(_0x99e8('0x5'));var logger=require(_0x99e8('0x6'))(_0x99e8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99e8('0x8')][_0x99e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3f8f,_0x272c81,_0x18b412){return new BPromise(function(_0x5af5bb,_0x708443){return client['request'](_0x5b3f8f,_0x18b412)['then'](function(_0x4416e5){logger[_0x99e8('0xa')](_0x99e8('0xb'),_0x272c81,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x272c81,_0x99e8('0xc'),JSON['stringify'](_0x4416e5));if(_0x4416e5[_0x99e8('0xd')]){if(_0x4416e5['error'][_0x99e8('0xe')]===0x1f4){logger[_0x99e8('0xd')](_0x99e8('0xb'),_0x272c81,_0x4416e5[_0x99e8('0xd')]['message']);return _0x708443(_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);}logger['error'](_0x99e8('0xb'),_0x272c81,_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);return _0x5af5bb(_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);}else{logger[_0x99e8('0xa')]('Schedule,\x20%s,\x20%s',_0x272c81,'request\x20sent');_0x5af5bb(_0x4416e5['result'][_0x99e8('0xf')]);}})[_0x99e8('0x10')](function(_0x489fa5){logger[_0x99e8('0xd')](_0x99e8('0xb'),_0x272c81,_0x489fa5);_0x708443(_0x489fa5);});});} \ No newline at end of file +var _0xbb58=['../../config/logger','../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10385a,_0x5090f8){var _0x5b0256=function(_0x3d64d4){while(--_0x3d64d4){_0x10385a['push'](_0x10385a['shift']());}};_0x5b0256(++_0x5090f8);}(_0xbb58,0xc0));var _0x8bb5=function(_0xd800d1,_0x55abe3){_0xd800d1=_0xd800d1-0x0;var _0x246c65=_0xbb58[_0xd800d1];return _0x246c65;};'use strict';var _=require('lodash');var util=require(_0x8bb5('0x0'));var moment=require(_0x8bb5('0x1'));var BPromise=require(_0x8bb5('0x2'));var rs=require(_0x8bb5('0x3'));var fs=require('fs');var Redis=require(_0x8bb5('0x4'));var db=require(_0x8bb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bb5('0x6'))('rpc');var config=require(_0x8bb5('0x7'));var jayson=require(_0x8bb5('0x8'));var client=jayson[_0x8bb5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe34478,_0x4f1a60,_0x45e1c1){return new BPromise(function(_0x1f23e6,_0x513ce8){return client[_0x8bb5('0xa')](_0xe34478,_0x45e1c1)['then'](function(_0x3729d7){logger[_0x8bb5('0xb')](_0x8bb5('0xc'),_0x4f1a60,_0x8bb5('0xd'));logger[_0x8bb5('0xe')](_0x8bb5('0xf'),_0x4f1a60,'request\x20sent',JSON[_0x8bb5('0x10')](_0x3729d7));if(_0x3729d7['error']){if(_0x3729d7['error'][_0x8bb5('0x11')]===0x1f4){logger[_0x8bb5('0x12')](_0x8bb5('0xc'),_0x4f1a60,_0x3729d7['error']['message']);return _0x513ce8(_0x3729d7[_0x8bb5('0x12')]['message']);}logger['error'](_0x8bb5('0xc'),_0x4f1a60,_0x3729d7[_0x8bb5('0x12')][_0x8bb5('0x13')]);return _0x1f23e6(_0x3729d7[_0x8bb5('0x12')][_0x8bb5('0x13')]);}else{logger[_0x8bb5('0xb')](_0x8bb5('0xc'),_0x4f1a60,_0x8bb5('0xd'));_0x1f23e6(_0x3729d7[_0x8bb5('0x14')][_0x8bb5('0x13')]);}})[_0x8bb5('0x15')](function(_0x2b0832){logger[_0x8bb5('0x12')](_0x8bb5('0xc'),_0x4f1a60,_0x2b0832);_0x513ce8(_0x2b0832);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 538380b..561af0d 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 _0xefe3=['/describe','isAuthenticated','/:id','/:id/download','download','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index'];(function(_0x408cac,_0x1fdd8d){var _0x4d775a=function(_0x3a4f1e){while(--_0x3a4f1e){_0x408cac['push'](_0x408cac['shift']());}};_0x4d775a(++_0x1fdd8d);}(_0xefe3,0xd1));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3efe('0x0'));var util=require(_0x3efe('0x1'));var path=require(_0x3efe('0x2'));var timeout=require(_0x3efe('0x3'));var express=require(_0x3efe('0x4'));var router=express[_0x3efe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3efe('0x6'));var interaction=require(_0x3efe('0x7'));var config=require('../../config/environment');var controller=require(_0x3efe('0x8'));router[_0x3efe('0x9')]('/',auth['isAuthenticated'](),controller[_0x3efe('0xa')]);router['get'](_0x3efe('0xb'),auth[_0x3efe('0xc')](),controller['describe']);router['get'](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller['show']);router[_0x3efe('0x9')](_0x3efe('0xe'),auth[_0x3efe('0xc')](),controller[_0x3efe('0xf')]);router[_0x3efe('0x10')]('/',auth[_0x3efe('0xc')](),controller[_0x3efe('0x11')]);router[_0x3efe('0x12')](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller['update']);router['delete'](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller[_0x3efe('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7d69=['multer','util','connect-timeout','fs-extra','./screenRecording.controller','isAuthenticated','get','describe','/:id','/:id/download','post','create','put','update','delete','exports'];(function(_0x5c2df8,_0x5d4ddd){var _0x285e8a=function(_0x1c9260){while(--_0x1c9260){_0x5c2df8['push'](_0x5c2df8['shift']());}};_0x285e8a(++_0x5d4ddd);}(_0x7d69,0xf0));var _0x97d6=function(_0x17ccd2,_0x17a784){_0x17ccd2=_0x17ccd2-0x0;var _0x594adb=_0x7d69[_0x17ccd2];return _0x594adb;};'use strict';var multer=require(_0x97d6('0x0'));var util=require(_0x97d6('0x1'));var path=require('path');var timeout=require(_0x97d6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97d6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x97d6('0x4'));router['get']('/',auth[_0x97d6('0x5')](),controller['index']);router[_0x97d6('0x6')]('/describe',auth[_0x97d6('0x5')](),controller[_0x97d6('0x7')]);router['get'](_0x97d6('0x8'),auth[_0x97d6('0x5')](),controller['show']);router[_0x97d6('0x6')](_0x97d6('0x9'),auth[_0x97d6('0x5')](),controller['download']);router[_0x97d6('0xa')]('/',auth[_0x97d6('0x5')](),controller[_0x97d6('0xb')]);router[_0x97d6('0xc')](_0x97d6('0x8'),auth['isAuthenticated'](),controller[_0x97d6('0xd')]);router[_0x97d6('0xe')]('/:id',auth[_0x97d6('0x5')](),controller['destroy']);module[_0x97d6('0xf')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3fbd6cd..d7d5d92 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 _0xc3ed=['subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','createdAt','toString','format','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x31ac6f,_0xac69ee){var _0x26653f=function(_0x202b19){while(--_0x202b19){_0x31ac6f['push'](_0x31ac6f['shift']());}};_0x26653f(++_0xac69ee);}(_0xc3ed,0x111));var _0xdc3e=function(_0x436b13,_0x49e83b){_0x436b13=_0x436b13-0x0;var _0x7ea6f0=_0xc3ed[_0x436b13];return _0x7ea6f0;};'use strict';var Sequelize=require(_0xdc3e('0x0'));var moment=require(_0xdc3e('0x1'));var path=require('path');var config=require(_0xdc3e('0x2'));module[_0xdc3e('0x3')]={'format':{'type':Sequelize[_0xdc3e('0x4')],'get':function(){return this[_0xdc3e('0x5')](_0xdc3e('0x6'))?path['extname'](this[_0xdc3e('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdc3e('0x7')]},'channel':{'type':Sequelize[_0xdc3e('0x7')]},'value':{'type':Sequelize[_0xdc3e('0x7')],'set':function(_0x49e3f3){var _0xd0916c=_0x49e3f3[_0xdc3e('0x8')](/\\/g,'/');this[_0xdc3e('0x9')](_0xdc3e('0x6'),_0xd0916c);}},'rating':{'type':Sequelize[_0xdc3e('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdc3e('0xa')],'set':function(_0x3becac){this[_0xdc3e('0x9')](_0xdc3e('0xb'),moment()[_0xdc3e('0xc')](_0x3becac,'ms'));this[_0xdc3e('0x9')](_0xdc3e('0xd'),moment());this[_0xdc3e('0x9')]('duration',_0x3becac);}},'startedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')](_0xdc3e('0xb')))['format'](_0xdc3e('0xf'))['toString']();}},'closedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')]('closedAt'))['format'](_0xdc3e('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')](_0xdc3e('0x10')))['format'](_0xdc3e('0xf'))[_0xdc3e('0x11')]();}},'updatedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')]('updatedAt'))[_0xdc3e('0x12')](_0xdc3e('0xf'))[_0xdc3e('0x11')]();}}}; \ No newline at end of file +var _0x8a21=['toString','closedAt','format','DATE','sequelize','../../config/environment','exports','VIRTUAL','extname','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm'];(function(_0x2eaba4,_0x12bd8a){var _0x1d317=function(_0x2b100b){while(--_0x2b100b){_0x2eaba4['push'](_0x2eaba4['shift']());}};_0x1d317(++_0x12bd8a);}(_0x8a21,0x1d8));var _0x18a2=function(_0x22b5da,_0x43cf53){_0x22b5da=_0x22b5da-0x0;var _0x46b7da=_0x8a21[_0x22b5da];return _0x46b7da;};'use strict';var Sequelize=require(_0x18a2('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x18a2('0x1'));module[_0x18a2('0x2')]={'format':{'type':Sequelize[_0x18a2('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x18a2('0x4')](this[_0x18a2('0x5')](_0x18a2('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x18a2('0x7')]},'channel':{'type':Sequelize[_0x18a2('0x7')]},'value':{'type':Sequelize[_0x18a2('0x7')],'set':function(_0x372e5e){var _0x10bc0f=_0x372e5e['replace'](/\\/g,'/');this[_0x18a2('0x8')](_0x18a2('0x6'),_0x10bc0f);}},'rating':{'type':Sequelize[_0x18a2('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x29031a){this[_0x18a2('0x8')](_0x18a2('0xa'),moment()[_0x18a2('0xb')](_0x29031a,'ms'));this[_0x18a2('0x8')]('closedAt',moment());this[_0x18a2('0x8')](_0x18a2('0xc'),_0x29031a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x18a2('0x5')](_0x18a2('0xa')))['format'](_0x18a2('0xd'))[_0x18a2('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x18a2('0x5')](_0x18a2('0xf')))[_0x18a2('0x10')](_0x18a2('0xd'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x18a2('0x5')]('createdAt'))[_0x18a2('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x18a2('0xe')]();}},'updatedAt':{'type':Sequelize[_0x18a2('0x11')],'get':function(){return moment(this[_0x18a2('0x5')]('updatedAt'))[_0x18a2('0x10')](_0x18a2('0xd'))[_0x18a2('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 13e3b96..0dc6f90 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 _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x5553b3,_0x36a21c){var _0xb1decf=function(_0x4399ae){while(--_0x4399ae){_0x5553b3['push'](_0x5553b3['shift']());}};_0xb1decf(++_0x36a21c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4c3afd,_0x3e7a45){_0x4c3afd=_0x4c3afd-0x0;var _0x4e2ef3=_0xeec6[_0x4c3afd];return _0x4e2ef3;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,null));}; \ No newline at end of file +var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x52eb38,_0x5c3490){var _0x299551=function(_0x35cd3d){while(--_0x35cd3d){_0x52eb38['push'](_0x52eb38['shift']());}};_0x299551(++_0x5c3490);}(_0x00bb,0x1d8));var _0xb00b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x00bb[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2f57d2b..edf95c2 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 _0x8e4c=['request-promise','path','../../config/environment','./screenRecording.attributes','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x9391c0,_0x445f35){var _0x51f943=function(_0x1ebc8a){while(--_0x1ebc8a){_0x9391c0['push'](_0x9391c0['shift']());}};_0x51f943(++_0x445f35);}(_0x8e4c,0x13f));var _0xc8e4=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x8e4c[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0xc8e4('0x0'));var util=require(_0xc8e4('0x1'));var logger=require(_0xc8e4('0x2'))(_0xc8e4('0x3'));var moment=require(_0xc8e4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8e4('0x5'));var fs=require('fs');var path=require(_0xc8e4('0x6'));var rimraf=require('rimraf');var config=require(_0xc8e4('0x7'));var attributes=require(_0xc8e4('0x8'));module['exports']=function(_0x3865a1,_0x11a861){return _0x3865a1[_0xc8e4('0x9')]('ScreenRecording',attributes,{'tableName':_0xc8e4('0xa'),'paranoid':![],'indexes':[{'name':_0xc8e4('0xb'),'fields':[_0xc8e4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3275=['exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x3275,0x90));var _0x5327=function(_0x440e53,_0x5897c6){_0x440e53=_0x440e53-0x0;var _0x19a8e5=_0x3275[_0x440e53];return _0x19a8e5;};'use strict';var _=require(_0x5327('0x0'));var util=require(_0x5327('0x1'));var logger=require(_0x5327('0x2'))(_0x5327('0x3'));var moment=require(_0x5327('0x4'));var BPromise=require(_0x5327('0x5'));var rp=require(_0x5327('0x6'));var fs=require('fs');var path=require(_0x5327('0x7'));var rimraf=require('rimraf');var config=require(_0x5327('0x8'));var attributes=require(_0x5327('0x9'));module[_0x5327('0xa')]=function(_0x29ad04,_0x5426b7){return _0x29ad04['define'](_0x5327('0xb'),attributes,{'tableName':_0x5327('0xc'),'paranoid':![],'indexes':[{'name':_0x5327('0xd'),'fields':[_0x5327('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5d15c9e..43fce6b 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 _0x0a69=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s'];(function(_0x207a74,_0x280ded){var _0x21118d=function(_0x432aba){while(--_0x432aba){_0x207a74['push'](_0x207a74['shift']());}};_0x21118d(++_0x280ded);}(_0x0a69,0x167));var _0x90a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a69[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x90a6('0x0'));var util=require(_0x90a6('0x1'));var moment=require(_0x90a6('0x2'));var BPromise=require(_0x90a6('0x3'));var rs=require(_0x90a6('0x4'));var fs=require('fs');var Redis=require(_0x90a6('0x5'));var db=require(_0x90a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x90a6('0x7'))('rpc');var config=require(_0x90a6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x90a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9c86,_0x20b6aa,_0x2b43ea){return new BPromise(function(_0x4ea019,_0x3c4bc3){return client[_0x90a6('0xa')](_0x4e9c86,_0x2b43ea)[_0x90a6('0xb')](function(_0x2241f5){logger[_0x90a6('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x20b6aa,_0x90a6('0xd'));logger[_0x90a6('0xe')](_0x90a6('0xf'),_0x20b6aa,_0x90a6('0xd'),JSON[_0x90a6('0x10')](_0x2241f5));if(_0x2241f5[_0x90a6('0x11')]){if(_0x2241f5['error']['code']===0x1f4){logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x2241f5[_0x90a6('0x11')]['message']);return _0x3c4bc3(_0x2241f5['error'][_0x90a6('0x13')]);}logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x2241f5[_0x90a6('0x11')][_0x90a6('0x13')]);return _0x4ea019(_0x2241f5[_0x90a6('0x11')][_0x90a6('0x13')]);}else{logger['info'](_0x90a6('0x12'),_0x20b6aa,_0x90a6('0xd'));_0x4ea019(_0x2241f5['result'][_0x90a6('0x13')]);}})[_0x90a6('0x14')](function(_0x56470a){logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x56470a);_0x3c4bc3(_0x56470a);});});} \ No newline at end of file +var _0xb765=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0xc6146f,_0x2437f3){var _0x31d1a2=function(_0x44f03e){while(--_0x44f03e){_0xc6146f['push'](_0xc6146f['shift']());}};_0x31d1a2(++_0x2437f3);}(_0xb765,0x19e));var _0x5b76=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb765[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x5b76('0x0'));var util=require(_0x5b76('0x1'));var moment=require('moment');var BPromise=require(_0x5b76('0x2'));var rs=require(_0x5b76('0x3'));var fs=require('fs');var Redis=require(_0x5b76('0x4'));var db=require(_0x5b76('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b76('0x6'))(_0x5b76('0x7'));var config=require(_0x5b76('0x8'));var jayson=require(_0x5b76('0x9'));var client=jayson[_0x5b76('0xa')][_0x5b76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9e94,_0x9d8e14,_0x207045){return new BPromise(function(_0x379bc5,_0x32068b){return client[_0x5b76('0xc')](_0x1f9e94,_0x207045)[_0x5b76('0xd')](function(_0x74f54d){logger['info'](_0x5b76('0xe'),_0x9d8e14,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x9d8e14,_0x5b76('0xf'),JSON[_0x5b76('0x10')](_0x74f54d));if(_0x74f54d['error']){if(_0x74f54d[_0x5b76('0x11')]['code']===0x1f4){logger[_0x5b76('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x9d8e14,_0x74f54d[_0x5b76('0x11')][_0x5b76('0x12')]);return _0x32068b(_0x74f54d[_0x5b76('0x11')][_0x5b76('0x12')]);}logger[_0x5b76('0x11')](_0x5b76('0xe'),_0x9d8e14,_0x74f54d[_0x5b76('0x11')][_0x5b76('0x12')]);return _0x379bc5(_0x74f54d['error']['message']);}else{logger[_0x5b76('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x9d8e14,_0x5b76('0xf'));_0x379bc5(_0x74f54d[_0x5b76('0x14')][_0x5b76('0x12')]);}})[_0x5b76('0x15')](function(_0x4259f1){logger[_0x5b76('0x11')](_0x5b76('0xe'),_0x9d8e14,_0x4259f1);_0x32068b(_0x4259f1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fbad4eb..1331bda 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 _0x8e20=['logo','originalname','post','file','addLogo','logologin','extname','/:id/logo_login','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s'];(function(_0x1de423,_0xceb67f){var _0x5485ca=function(_0x2fe61c){while(--_0x2fe61c){_0x1de423['push'](_0x1de423['shift']());}};_0x5485ca(++_0xceb67f);}(_0x8e20,0x131));var _0x08e2=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x8e20[_0x3dea7d];return _0x53919a;};'use strict';var multer=require(_0x08e2('0x0'));var util=require('util');var path=require(_0x08e2('0x1'));var timeout=require(_0x08e2('0x2'));var express=require(_0x08e2('0x3'));var router=express[_0x08e2('0x4')]();var fs_extra=require(_0x08e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x08e2('0x6'));var config=require(_0x08e2('0x7'));var controller=require(_0x08e2('0x8'));router[_0x08e2('0x9')]('/',auth[_0x08e2('0xa')](),controller[_0x08e2('0xb')]);router[_0x08e2('0x9')](_0x08e2('0xc'),controller[_0x08e2('0xd')]);router[_0x08e2('0x9')](_0x08e2('0xe'),controller[_0x08e2('0xf')]);router['get'](_0x08e2('0x10'),controller[_0x08e2('0x11')]);router[_0x08e2('0x9')]('/:id/logo_login',controller[_0x08e2('0x12')]);router[_0x08e2('0x9')](_0x08e2('0x13'),controller[_0x08e2('0x14')]);router[_0x08e2('0x9')](_0x08e2('0x15'),controller[_0x08e2('0x16')]);router[_0x08e2('0x9')](_0x08e2('0x17'),controller[_0x08e2('0x18')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x5b8411,_0x7c06ec,_0x3da0af){_0x3da0af(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x49bf41,_0x11627d,_0x3cb1f9){_0x3cb1f9(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x1f'),path['extname'](_0x11627d[_0x08e2('0x20')])));}})});router[_0x08e2('0x21')](_0x08e2('0x10'),upload['single'](_0x08e2('0x22')),controller[_0x08e2('0x23')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x920d6e,_0x1f65f6,_0x10e2d5){_0x10e2d5(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x35f2eb,_0x4d73f8,_0x5dd2fe){_0x5dd2fe(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x24'),path[_0x08e2('0x25')](_0x4d73f8['originalname'])));}})});router[_0x08e2('0x21')](_0x08e2('0x26'),upload[_0x08e2('0x27')](_0x08e2('0x22')),controller[_0x08e2('0x28')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x2fb83b,_0x22dc06,_0x1d87f6){_0x1d87f6(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x4fcb27,_0xe86f65,_0x3f3add){_0x3f3add(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x29'),path[_0x08e2('0x25')](_0xe86f65[_0x08e2('0x20')])));}})});router['post'](_0x08e2('0x15'),upload[_0x08e2('0x27')]('file'),controller[_0x08e2('0x2a')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x4d9c25,_0x4043e1,_0x1f0717){_0x1f0717(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],'server/files/images/logos/'));},'filename':function(_0x28d6ed,_0x423e90,_0x2ad681){_0x2ad681(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x2b'),path[_0x08e2('0x25')](_0x423e90[_0x08e2('0x20')])));}})});router[_0x08e2('0x21')]('/:id/favicon',upload[_0x08e2('0x27')](_0x08e2('0x22')),controller[_0x08e2('0x2c')]);router[_0x08e2('0x2d')](_0x08e2('0xe'),auth[_0x08e2('0xa')](),controller[_0x08e2('0x2e')]);module[_0x08e2('0x2f')]=router; \ No newline at end of file +var _0xee84=['show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','logo','extname','originalname','post','single','file','addLogo','diskStorage','root','%s%s','logologin','addLogoLogin','format','preferred','addFavicon','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id'];(function(_0x845f8f,_0x29564a){var _0x3a2bd9=function(_0x1e2e62){while(--_0x1e2e62){_0x845f8f['push'](_0x845f8f['shift']());}};_0x3a2bd9(++_0x29564a);}(_0xee84,0x1a0));var _0x4ee8=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xee84[_0x1beef3];return _0x5af964;};'use strict';var multer=require('multer');var util=require(_0x4ee8('0x0'));var path=require(_0x4ee8('0x1'));var timeout=require(_0x4ee8('0x2'));var express=require(_0x4ee8('0x3'));var router=express[_0x4ee8('0x4')]();var fs_extra=require(_0x4ee8('0x5'));var auth=require(_0x4ee8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4ee8('0x7'));router['get']('/',auth[_0x4ee8('0x8')](),controller[_0x4ee8('0x9')]);router[_0x4ee8('0xa')](_0x4ee8('0xb'),controller[_0x4ee8('0xc')]);router[_0x4ee8('0xa')](_0x4ee8('0xd'),controller[_0x4ee8('0xe')]);router[_0x4ee8('0xa')](_0x4ee8('0xf'),controller[_0x4ee8('0x10')]);router[_0x4ee8('0xa')](_0x4ee8('0x11'),controller[_0x4ee8('0x12')]);router[_0x4ee8('0xa')](_0x4ee8('0x13'),controller['gdpr']);router['get'](_0x4ee8('0x14'),controller[_0x4ee8('0x15')]);router[_0x4ee8('0xa')](_0x4ee8('0x16'),controller[_0x4ee8('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31da14,_0xbf2c6a,_0x4af22b){_0x4af22b(null,path[_0x4ee8('0x18')](config['root'],_0x4ee8('0x19')));},'filename':function(_0x59bff9,_0x2ed812,_0x36d996){_0x36d996(null,util['format']('%s%s',_0x4ee8('0x1a'),path[_0x4ee8('0x1b')](_0x2ed812[_0x4ee8('0x1c')])));}})});router[_0x4ee8('0x1d')](_0x4ee8('0xf'),upload[_0x4ee8('0x1e')](_0x4ee8('0x1f')),controller[_0x4ee8('0x20')]);var upload=multer({'storage':multer[_0x4ee8('0x21')]({'destination':function(_0x4b5943,_0x304aaa,_0x2007cc){_0x2007cc(null,path[_0x4ee8('0x18')](config[_0x4ee8('0x22')],_0x4ee8('0x19')));},'filename':function(_0xaa674e,_0x55ef5a,_0x263bbd){_0x263bbd(null,util['format'](_0x4ee8('0x23'),_0x4ee8('0x24'),path[_0x4ee8('0x1b')](_0x55ef5a['originalname'])));}})});router['post']('/:id/logo_login',upload[_0x4ee8('0x1e')](_0x4ee8('0x1f')),controller[_0x4ee8('0x25')]);var upload=multer({'storage':multer[_0x4ee8('0x21')]({'destination':function(_0x4c303c,_0xd083b5,_0x250640){_0x250640(null,path['join'](config[_0x4ee8('0x22')],_0x4ee8('0x19')));},'filename':function(_0x5818e3,_0x11b3a8,_0x262fcb){_0x262fcb(null,util[_0x4ee8('0x26')]('%s%s',_0x4ee8('0x27'),path[_0x4ee8('0x1b')](_0x11b3a8['originalname'])));}})});router[_0x4ee8('0x1d')](_0x4ee8('0x14'),upload[_0x4ee8('0x1e')](_0x4ee8('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x4ee8('0x21')]({'destination':function(_0x3757b6,_0x52a1e3,_0x4e8c86){_0x4e8c86(null,path[_0x4ee8('0x18')](config[_0x4ee8('0x22')],'server/files/images/logos/'));},'filename':function(_0x3516c9,_0x240e1d,_0x25b835){_0x25b835(null,util['format'](_0x4ee8('0x23'),'favicon',path['extname'](_0x240e1d[_0x4ee8('0x1c')])));}})});router[_0x4ee8('0x1d')](_0x4ee8('0x16'),upload['single'](_0x4ee8('0x1f')),controller[_0x4ee8('0x28')]);router[_0x4ee8('0x29')](_0x4ee8('0xd'),auth[_0x4ee8('0x8')](),controller[_0x4ee8('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ba1d2ad..a24e488 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 _0x6ed7=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x1783a0,_0x5efcd7){var _0x307ffe=function(_0x56b64c){while(--_0x56b64c){_0x1783a0['push'](_0x1783a0['shift']());}};_0x307ffe(++_0x5efcd7);}(_0x6ed7,0x108));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x76ed('0x0'));module[_0x76ed('0x1')]={'min_internal':{'type':Sequelize[_0x76ed('0x2')](0xb),'unique':_0x76ed('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x76ed('0x2')](0xb),'unique':_0x76ed('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x76ed('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x76ed('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x76ed('0x5')]},'turnaddr':{'type':Sequelize[_0x76ed('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x76ed('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x76ed('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x8')},'enableEmailPreview':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x9')},'chatTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x76ed('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x76ed('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x76ed('0x5')]},'sentiment':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x76ed('0x2')]},'sentimentRegion':{'type':Sequelize[_0x76ed('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x76ed('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x76ed('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x76ed('0x2')](0x2)[_0x76ed('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x76ed('0x2')](0x2)[_0x76ed('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x76ed('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x438a=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox'];(function(_0x290024,_0x5ed800){var _0x5070a0=function(_0x395e5a){while(--_0x395e5a){_0x290024['push'](_0x290024['shift']());}};_0x5070a0(++_0x5ed800);}(_0x438a,0xcb));var _0xa438=function(_0x339fa4,_0x58119b){_0x339fa4=_0x339fa4-0x0;var _0x3179e6=_0x438a[_0x339fa4];return _0x3179e6;};'use strict';var Sequelize=require(_0xa438('0x0'));module[_0xa438('0x1')]={'min_internal':{'type':Sequelize[_0xa438('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa438('0x2')](0xb),'unique':_0xa438('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa438('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa438('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xa438('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa438('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa438('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xa438('0x4')]},'turnpassword':{'type':Sequelize[_0xa438('0x4')]},'pageTitle':{'type':Sequelize[_0xa438('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa438('0x6')},'enableEmailPreview':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa438('0x4')],'defaultValue':_0xa438('0x7')},'chatTimeout':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa438('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa438('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa438('0x4')]},'defaultFavicon':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa438('0x2')]},'transcribeRegion':{'type':Sequelize[_0xa438('0x4')]},'sentiment':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa438('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa438('0x4')]},'bucket':{'type':Sequelize[_0xa438('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa438('0x2')](0x2)[_0xa438('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa438('0x2')](0x2)[_0xa438('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa438('0x2')](0x2)[_0xa438('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xa438('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa438('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa438('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa438('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 286a5f2..7264863 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 _0x21ca=['reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','find','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','server/files/images/logos','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x21ca,0x14e));var _0xa21c=function(_0x2a472f,_0x31f3af){_0x2a472f=_0x2a472f-0x0;var _0x434833=_0x21ca[_0x2a472f];return _0x434833;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa21c('0x0'));var zipdir=require(_0xa21c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa21c('0x2'));var moment=require(_0xa21c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa21c('0x4'));var util=require(_0xa21c('0x5'));var path=require(_0xa21c('0x6'));var sox=require(_0xa21c('0x7'));var csv=require('to-csv');var ejs=require(_0xa21c('0x8'));var fs=require('fs');var fs_extra=require(_0xa21c('0x9'));var _=require('lodash');var squel=require(_0xa21c('0xa'));var crypto=require('crypto');var jsforce=require(_0xa21c('0xb'));var deskjs=require(_0xa21c('0xc'));var toCsv=require(_0xa21c('0xd'));var querystring=require(_0xa21c('0xe'));var Papa=require(_0xa21c('0xf'));var Redis=require(_0xa21c('0x10'));var authService=require(_0xa21c('0x11'));var qs=require(_0xa21c('0x12'));var as=require(_0xa21c('0x13'));var hardwareService=require(_0xa21c('0x14'));var logger=require(_0xa21c('0x15'))(_0xa21c('0x16'));var utils=require('../../config/utils');var config=require(_0xa21c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xa21c('0x18'));var client=jayson['client'][_0xa21c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x45b233,_0x3180d7,_0x1e127d,_0x2c130b){return new BPromise(function(_0xb2e0a7,_0x21135c){var _0x30941=_0x2c130b||client;return _0x30941[_0xa21c('0x1a')](_0x45b233,_0x1e127d)[_0xa21c('0x1b')](function(_0x1de585){logger[_0xa21c('0x1c')](_0xa21c('0x1d'),_0x3180d7,_0xa21c('0x1e'));logger[_0xa21c('0x1f')](_0xa21c('0x20'),_0x3180d7,'request\x20sent',JSON['stringify'](_0x1de585));if(_0x1de585[_0xa21c('0x21')]){if(_0x1de585[_0xa21c('0x21')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3180d7,_0x1de585[_0xa21c('0x21')][_0xa21c('0x22')]);return _0x21135c(_0x1de585['error'][_0xa21c('0x22')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3180d7,_0x1de585['error'][_0xa21c('0x22')]);return _0xb2e0a7(_0x1de585['error']['message']);}else{logger[_0xa21c('0x1c')](_0xa21c('0x1d'),_0x3180d7,_0xa21c('0x1e'));_0xb2e0a7(_0x1de585[_0xa21c('0x23')][_0xa21c('0x22')]);}})[_0xa21c('0x24')](function(_0x1fa6bb){logger['error'](_0xa21c('0x1d'),_0x3180d7,_0x1fa6bb);_0x21135c(_0x1fa6bb);});});}function respondWithStatusCode(_0x184671,_0x40c735){_0x40c735=_0x40c735||0xcc;return function(_0x56e9c2){if(_0x56e9c2){return _0x184671[_0xa21c('0x25')](_0x40c735);}return _0x184671[_0xa21c('0x26')](_0x40c735)[_0xa21c('0x27')]();};}function respondWithResult(_0x484638,_0x369b63){_0x369b63=_0x369b63||0xc8;return function(_0x1fde2d){if(_0x1fde2d){return _0x484638[_0xa21c('0x26')](_0x369b63)[_0xa21c('0x28')](_0x1fde2d);}};}function respondWithFilteredResult(_0x702c13,_0x3dec82){return function(_0x46a56f){if(_0x46a56f){var _0x49178e=typeof _0x3dec82[_0xa21c('0x29')]===_0xa21c('0x2a')&&typeof _0x3dec82[_0xa21c('0x2b')]===_0xa21c('0x2a');var _0x59e2ca=_0x46a56f[_0xa21c('0x2c')];var _0x4c173a=_0x49178e?0x0:_0x3dec82[_0xa21c('0x29')];var _0x37b3bd=_0x49178e?_0x46a56f[_0xa21c('0x2c')]:_0x3dec82[_0xa21c('0x29')]+_0x3dec82['limit'];var _0xa1c700;if(_0x37b3bd>=_0x59e2ca){_0x37b3bd=_0x59e2ca;_0xa1c700=0xc8;}else{_0xa1c700=0xce;}_0x702c13['status'](_0xa1c700);return _0x702c13[_0xa21c('0x2d')]('Content-Range',_0x4c173a+'-'+_0x37b3bd+'/'+_0x59e2ca)[_0xa21c('0x28')](_0x46a56f);}return null;};}function patchUpdates(_0x31b5d0){return function(_0x2171a3){try{jsonpatch[_0xa21c('0x2e')](_0x2171a3,_0x31b5d0,!![]);}catch(_0x367ff0){return BPromise[_0xa21c('0x2f')](_0x367ff0);}return _0x2171a3[_0xa21c('0x30')]();};}function saveUpdates(_0x867cd,_0x545866){return function(_0x2a25e4){if(_0x2a25e4){return _0x2a25e4[_0xa21c('0x31')](_0x867cd)[_0xa21c('0x1b')](function(_0x21a39e){return _0x21a39e;});}return null;};}function removeEntity(_0xf27830,_0x1818a1){return function(_0x2a7e53){if(_0x2a7e53){return _0x2a7e53[_0xa21c('0x32')]()[_0xa21c('0x1b')](function(){_0xf27830['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x119bb6,_0x1a795d){return function(_0x33a6ff){if(!_0x33a6ff){_0x119bb6[_0xa21c('0x25')](0x194);}return _0x33a6ff;};}function handleError(_0x215913,_0x3dca34){_0x3dca34=_0x3dca34||0x1f4;return function(_0x163fa0){logger[_0xa21c('0x21')](_0x163fa0[_0xa21c('0x33')]);if(_0x163fa0[_0xa21c('0x34')]){delete _0x163fa0[_0xa21c('0x34')];}_0x215913[_0xa21c('0x26')](_0x3dca34)[_0xa21c('0x35')](_0x163fa0);};}exports['index']=function(_0x23d4c9,_0x3887f6){var _0x16a904={},_0xbeec96={},_0xb53577={'count':0x0,'rows':[]};var _0x28eb08=_[_0xa21c('0x36')](db[_0xa21c('0x37')][_0xa21c('0x38')],function(_0x3794a7){return{'name':_0x3794a7['fieldName'],'type':_0x3794a7[_0xa21c('0x39')][_0xa21c('0x3a')]};});_0xbeec96[_0xa21c('0x3b')]=_[_0xa21c('0x36')](_0x28eb08,_0xa21c('0x34'));_0xbeec96[_0xa21c('0x3c')]=_[_0xa21c('0x3d')](_0x23d4c9[_0xa21c('0x3c')]);_0xbeec96['filters']=_[_0xa21c('0x3e')](_0xbeec96['model'],_0xbeec96[_0xa21c('0x3c')]);_0x16a904['attributes']=_[_0xa21c('0x3e')](_0xbeec96[_0xa21c('0x3b')],qs['fields'](_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x3f')]));_0x16a904[_0xa21c('0x40')]=_0x16a904[_0xa21c('0x40')][_0xa21c('0x41')]?_0x16a904[_0xa21c('0x40')]:_0xbeec96['model'];if(!_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x42')](_0xa21c('0x43'))){_0x16a904[_0xa21c('0x2b')]=qs['limit'](_0x23d4c9['query'][_0xa21c('0x2b')]);_0x16a904[_0xa21c('0x29')]=qs['offset'](_0x23d4c9[_0xa21c('0x3c')]['offset']);}_0x16a904[_0xa21c('0x44')]=qs[_0xa21c('0x45')](_0x23d4c9[_0xa21c('0x3c')]['sort']);_0x16a904[_0xa21c('0x46')]=qs[_0xa21c('0x47')](_[_0xa21c('0x48')](_0x23d4c9[_0xa21c('0x3c')],_0xbeec96['filters']),_0x28eb08);if(_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x49')]){_0x16a904[_0xa21c('0x46')]=_[_0xa21c('0x4a')](_0x16a904[_0xa21c('0x46')],{'$or':_[_0xa21c('0x36')](_0x28eb08,function(_0x2ea3c4){if(_0x2ea3c4['type']!==_0xa21c('0x4b')){var _0x1c41a6={};_0x1c41a6[_0x2ea3c4['name']]={'$like':'%'+_0x23d4c9[_0xa21c('0x3c')]['filter']+'%'};return _0x1c41a6;}})});}_0x16a904=_[_0xa21c('0x4a')]({},_0x16a904,_0x23d4c9[_0xa21c('0x4c')]);var _0x439754={'where':_0x16a904[_0xa21c('0x46')]};return db[_0xa21c('0x37')][_0xa21c('0x2c')](_0x439754)[_0xa21c('0x1b')](function(_0x372dce){_0xb53577['count']=_0x372dce;if(_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x4d')]){_0x16a904[_0xa21c('0x4e')]=[{'all':!![]}];}return db[_0xa21c('0x37')][_0xa21c('0x4f')](_0x16a904);})[_0xa21c('0x1b')](function(_0x1a9610){_0xb53577[_0xa21c('0x50')]=_0x1a9610;return _0xb53577;})['then'](respondWithFilteredResult(_0x3887f6,_0x16a904))[_0xa21c('0x24')](handleError(_0x3887f6,null));};exports[_0xa21c('0x51')]=function(_0x2f4325,_0x2e5c54){var _0x5ea0b2={'raw':![],'where':{'id':_0x2f4325[_0xa21c('0x52')]['id']}},_0x383917={};_0x383917[_0xa21c('0x3b')]=_[_0xa21c('0x3d')](db['Setting'][_0xa21c('0x38')]);_0x383917[_0xa21c('0x3c')]=_[_0xa21c('0x3d')](_0x2f4325[_0xa21c('0x3c')]);_0x383917[_0xa21c('0x47')]=_['intersection'](_0x383917[_0xa21c('0x3b')],_0x383917[_0xa21c('0x3c')]);_0x5ea0b2['attributes']=_[_0xa21c('0x3e')](_0x383917[_0xa21c('0x3b')],qs['fields'](_0x2f4325[_0xa21c('0x3c')][_0xa21c('0x3f')]));_0x5ea0b2[_0xa21c('0x40')]=_0x5ea0b2[_0xa21c('0x40')][_0xa21c('0x41')]?_0x5ea0b2[_0xa21c('0x40')]:_0x383917[_0xa21c('0x3b')];if(_0x2f4325['query']['includeAll']){_0x5ea0b2[_0xa21c('0x4e')]=[{'all':!![]}];}_0x5ea0b2=_[_0xa21c('0x4a')]({},_0x5ea0b2,_0x2f4325[_0xa21c('0x4c')]);return db['Setting']['find'](_0x5ea0b2)[_0xa21c('0x1b')](handleEntityNotFound(_0x2e5c54,null))['then'](respondWithResult(_0x2e5c54,null))[_0xa21c('0x24')](handleError(_0x2e5c54,null));};exports[_0xa21c('0x31')]=function(_0x592ebb,_0x43fc71){if(_0x592ebb[_0xa21c('0x53')]['id']){delete _0x592ebb[_0xa21c('0x53')]['id'];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x592ebb['params']['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x43fc71,null))[_0xa21c('0x1b')](saveUpdates(_0x592ebb[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x43fc71,null))['catch'](handleError(_0x43fc71,null));};exports[_0xa21c('0x55')]=function(_0x269341,_0x260b11,_0x14485f){if(_0x269341[_0xa21c('0x56')]&&_0x269341[_0xa21c('0x56')][_0xa21c('0x57')]){_0x269341[_0xa21c('0x53')]['logo']=_0x269341[_0xa21c('0x56')][_0xa21c('0x57')];}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x269341[_0xa21c('0x52')]['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x260b11,null))['then'](saveUpdates(_0x269341[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x260b11,null))[_0xa21c('0x24')](handleError(_0x260b11,null));};exports[_0xa21c('0x58')]=function(_0x4b12e6,_0x1305aa,_0x4f3b6d){if(_0x4b12e6['file']&&_0x4b12e6['file'][_0xa21c('0x57')]){_0x4b12e6[_0xa21c('0x53')][_0xa21c('0x59')]=_0x4b12e6[_0xa21c('0x56')][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x4b12e6[_0xa21c('0x52')]['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x1305aa,null))[_0xa21c('0x1b')](saveUpdates(_0x4b12e6[_0xa21c('0x53')],null))['then'](respondWithResult(_0x1305aa,null))[_0xa21c('0x24')](handleError(_0x1305aa,null));};var utilLicense=require(_0xa21c('0x5a'));exports[_0xa21c('0x5b')]=function(_0x2494e3,_0x2a8a5b,_0x240de6){var _0x730d07='server/files/images/logos';var _0x1bb853={'custom':![]};return utilLicense[_0xa21c('0x5c')]()['then'](function(_0x50d0f4){if(_0x50d0f4){_0x1bb853=_0x50d0f4;}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x2494e3[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),_0xa21c('0x59'),_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),_0xa21c('0x63')],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x2a8a5b,null))[_0xa21c('0x1b')](function(_0x12b30d){if(_0x12b30d){var _0xbbef2e=_0x12b30d['logo']&&fs[_0xa21c('0x64')](path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_[_0xa21c('0x67')](_0x12b30d[_0xa21c('0x5d')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_['toLower'](_0x12b30d[_0xa21c('0x5d')])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_[_0xa21c('0x67')](_0xa21c('0x68')));var _0x5c0e0d=_0xa21c('0x69')+_[_0xa21c('0x6a')](_0xa21c('0x5d'));if(_0x12b30d[_0x5c0e0d]||!_0x1bb853[_0xa21c('0x6b')]){_0xbbef2e=path[_0xa21c('0x65')](config['root'],_0x730d07,_[_0xa21c('0x67')](_0xa21c('0x68')));}if(!fs[_0xa21c('0x64')](_0xbbef2e)){throw new db['Sequelize'][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x5d'))+'\x20not\x20found');}return _0x2a8a5b['download'](_0xbbef2e);}})[_0xa21c('0x24')](handleError(_0x2a8a5b,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x464ba8,_0x24ec8d,_0x1fca80){var _0x11c4b8=_0xa21c('0x6d');var _0x27e9a0={'custom':![]};return utilLicense[_0xa21c('0x5c')]()[_0xa21c('0x1b')](function(_0x2e89fb){if(_0x2e89fb){_0x27e9a0=_0x2e89fb;}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x464ba8[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),'loginLogo',_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x24ec8d,null))[_0xa21c('0x1b')](function(_0x35910c){if(_0x35910c){var _0x6d58c6=_0x35910c[_0xa21c('0x59')]&&fs[_0xa21c('0x64')](path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0x35910c[_0xa21c('0x59')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0x35910c[_0xa21c('0x59')])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0xa21c('0x6e')));var _0x3ea2af='default'+_['upperFirst']('loginLogo');if(_0x35910c[_0x3ea2af]||!_0x27e9a0[_0xa21c('0x6b')]){_0x6d58c6=path[_0xa21c('0x65')](config['root'],_0x11c4b8,_[_0xa21c('0x67')](_0xa21c('0x6e')));}if(!fs[_0xa21c('0x64')](_0x6d58c6)){throw new db[(_0xa21c('0x6f'))][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x59'))+'\x20not\x20found');}return _0x24ec8d[_0xa21c('0x70')](_0x6d58c6);}})['catch'](handleError(_0x24ec8d,null));};exports[_0xa21c('0x71')]=function(_0x2c0751,_0x1b8d17){return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x2c0751[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x72')]})[_0xa21c('0x1b')](respondWithResult(_0x1b8d17,null))[_0xa21c('0x24')](handleError(_0x1b8d17,null));};exports[_0xa21c('0x73')]=function(_0x31591d,_0xadb03,_0x39d59f){if(_0x31591d[_0xa21c('0x56')]&&_0x31591d[_0xa21c('0x56')][_0xa21c('0x57')]){_0x31591d[_0xa21c('0x53')][_0xa21c('0x5e')]=_0x31591d['file'][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x31591d[_0xa21c('0x52')]['id']}})['then'](handleEntityNotFound(_0xadb03,null))[_0xa21c('0x1b')](saveUpdates(_0x31591d[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0xadb03,null))[_0xa21c('0x24')](handleError(_0xadb03,null));};var utilLicense=require('../../config/license/util');exports[_0xa21c('0x74')]=function(_0x293e52,_0x478772,_0x30f2c6){var _0x4eb838=_0xa21c('0x6d');var _0x44a480={'custom':![]};return utilLicense[_0xa21c('0x5c')]()['then'](function(_0x416979){if(_0x416979){_0x44a480=_0x416979;}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x293e52[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),_0xa21c('0x59'),_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),_0xa21c('0x63')],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x478772,null))[_0xa21c('0x1b')](function(_0x9ec7bd){if(_0x9ec7bd){var _0x19ed96=_0x9ec7bd[_0xa21c('0x5e')]&&fs[_0xa21c('0x64')](path['join'](config[_0xa21c('0x66')],_0x4eb838,_[_0xa21c('0x67')](_0x9ec7bd[_0xa21c('0x5e')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x4eb838,_[_0xa21c('0x67')](_0x9ec7bd[_0xa21c('0x5e')])):path[_0xa21c('0x65')](config['root'],_0x4eb838,_[_0xa21c('0x67')]('default_preferred.png'));var _0x474d32=_0xa21c('0x69')+_[_0xa21c('0x6a')](_0xa21c('0x5e'));if(_0x9ec7bd[_0x474d32]||!_0x44a480[_0xa21c('0x6b')]||!_0x44a480[_0xa21c('0x5e')]){_0x19ed96=path[_0xa21c('0x65')](config['root'],_0x4eb838,_[_0xa21c('0x67')](_0xa21c('0x75')));}if(!fs[_0xa21c('0x64')](_0x19ed96)){throw new db[(_0xa21c('0x6f'))][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x5e'))+_0xa21c('0x76'));}return _0x478772[_0xa21c('0x70')](_0x19ed96);}})['catch'](handleError(_0x478772,null));};exports[_0xa21c('0x77')]=function(_0x2cf702,_0x160d57,_0x578098){if(_0x2cf702[_0xa21c('0x56')]&&_0x2cf702['file'][_0xa21c('0x57')]){_0x2cf702['body'][_0xa21c('0x5f')]=_0x2cf702['file'][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x2cf702['params']['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x160d57,null))[_0xa21c('0x1b')](saveUpdates(_0x2cf702[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x160d57,null))[_0xa21c('0x24')](handleError(_0x160d57,null));};var utilLicense=require(_0xa21c('0x5a'));exports[_0xa21c('0x78')]=function(_0x4f476b,_0x5b196d,_0x3915d4){var _0x55ca42=_0xa21c('0x6d');var _0x2a0290={'custom':![]};return utilLicense['getLicense']()[_0xa21c('0x1b')](function(_0x341a1f){if(_0x341a1f){_0x2a0290=_0x341a1f;}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x4f476b[_0xa21c('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),'defaultFavicon'],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x5b196d,null))[_0xa21c('0x1b')](function(_0x7b3837){if(_0x7b3837){var _0x4a141c=_0x7b3837[_0xa21c('0x5f')]&&fs[_0xa21c('0x64')](path['join'](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0x7b3837[_0xa21c('0x5f')])))?path[_0xa21c('0x65')](config['root'],_0x55ca42,_['toLower'](_0x7b3837['favicon'])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0xa21c('0x79')));var _0x35da23=_0xa21c('0x69')+_[_0xa21c('0x6a')]('favicon');if(_0x7b3837[_0x35da23]||!_0x2a0290[_0xa21c('0x6b')]){_0x4a141c=path['join'](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0xa21c('0x79')));}if(!fs[_0xa21c('0x64')](_0x4a141c)){throw new db[(_0xa21c('0x6f'))]['ValidationError'](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x5b196d[_0xa21c('0x70')](_0x4a141c);}})[_0xa21c('0x24')](handleError(_0x5b196d,null));};exports[_0xa21c('0x7a')]=function(_0xabc7ea,_0x1e393b){var _0x5303aa={'offset':moment()[_0xa21c('0x7b')]()};_0x5303aa[_0xa21c('0x7c')]=moment()['utcOffset'](_0x5303aa['offset'])[_0xa21c('0x7d')](_0xa21c('0x7e'));return _0x1e393b[_0xa21c('0x26')](0xc8)[_0xa21c('0x35')](_0x5303aa);}; \ No newline at end of file +var _0xa7e6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','sendStatus','name','send','Setting','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','params','keys','rawAttributes','find','body','file','logo','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','root','toLower','default_logo.svg','default','upperFirst','custom','join','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','defaultLoginLogo','default_favicon.ico','Sequelize','now','utcOffset','format','eml-format'];(function(_0x2ccb91,_0xa2c1b4){var _0x4136ca=function(_0x4326f0){while(--_0x4326f0){_0x2ccb91['push'](_0x2ccb91['shift']());}};_0x4136ca(++_0xa2c1b4);}(_0xa7e6,0x74));var _0x6a7e=function(_0x410bad,_0x1cecc3){_0x410bad=_0x410bad-0x0;var _0x12cfab=_0xa7e6[_0x410bad];return _0x12cfab;};'use strict';var emlformat=require(_0x6a7e('0x0'));var rimraf=require(_0x6a7e('0x1'));var zipdir=require(_0x6a7e('0x2'));var jsonpatch=require(_0x6a7e('0x3'));var rp=require(_0x6a7e('0x4'));var moment=require(_0x6a7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6a7e('0x6'));var util=require(_0x6a7e('0x7'));var path=require(_0x6a7e('0x8'));var sox=require(_0x6a7e('0x9'));var csv=require(_0x6a7e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a7e('0xb'));var _=require(_0x6a7e('0xc'));var squel=require(_0x6a7e('0xd'));var crypto=require(_0x6a7e('0xe'));var jsforce=require(_0x6a7e('0xf'));var deskjs=require(_0x6a7e('0x10'));var toCsv=require(_0x6a7e('0xa'));var querystring=require(_0x6a7e('0x11'));var Papa=require(_0x6a7e('0x12'));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(_0x6a7e('0x13'));var logger=require(_0x6a7e('0x14'))(_0x6a7e('0x15'));var utils=require(_0x6a7e('0x16'));var config=require(_0x6a7e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a7e('0x18'))['db'];var jayson=require(_0x6a7e('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbb2811,_0x122b35,_0x1ac6da,_0x374763){return new BPromise(function(_0x4faca9,_0x3137bc){var _0x21369e=_0x374763||client;return _0x21369e[_0x6a7e('0x1a')](_0xbb2811,_0x1ac6da)[_0x6a7e('0x1b')](function(_0x465566){logger['info'](_0x6a7e('0x1c'),_0x122b35,'request\x20sent');logger['debug'](_0x6a7e('0x1d'),_0x122b35,'request\x20sent',JSON[_0x6a7e('0x1e')](_0x465566));if(_0x465566[_0x6a7e('0x1f')]){if(_0x465566[_0x6a7e('0x1f')][_0x6a7e('0x20')]===0x1f4){logger[_0x6a7e('0x1f')]('Setting,\x20%s,\x20%s',_0x122b35,_0x465566['error']['message']);return _0x3137bc(_0x465566[_0x6a7e('0x1f')][_0x6a7e('0x21')]);}logger[_0x6a7e('0x1f')](_0x6a7e('0x1c'),_0x122b35,_0x465566[_0x6a7e('0x1f')][_0x6a7e('0x21')]);return _0x4faca9(_0x465566[_0x6a7e('0x1f')][_0x6a7e('0x21')]);}else{logger['info'](_0x6a7e('0x1c'),_0x122b35,_0x6a7e('0x22'));_0x4faca9(_0x465566['result'][_0x6a7e('0x21')]);}})[_0x6a7e('0x23')](function(_0x252972){logger['error'](_0x6a7e('0x1c'),_0x122b35,_0x252972);_0x3137bc(_0x252972);});});}function respondWithStatusCode(_0xd045ca,_0x4ee914){_0x4ee914=_0x4ee914||0xcc;return function(_0x18f5e2){if(_0x18f5e2){return _0xd045ca['sendStatus'](_0x4ee914);}return _0xd045ca[_0x6a7e('0x24')](_0x4ee914)[_0x6a7e('0x25')]();};}function respondWithResult(_0x5db4c5,_0x29db13){_0x29db13=_0x29db13||0xc8;return function(_0x956eb6){if(_0x956eb6){return _0x5db4c5[_0x6a7e('0x24')](_0x29db13)[_0x6a7e('0x26')](_0x956eb6);}};}function respondWithFilteredResult(_0x3498c5,_0x380f2f){return function(_0x573bdc){if(_0x573bdc){var _0x15b4c9=typeof _0x380f2f[_0x6a7e('0x27')]===_0x6a7e('0x28')&&typeof _0x380f2f[_0x6a7e('0x29')]===_0x6a7e('0x28');var _0x58d6ea=_0x573bdc['count'];var _0x8b0439=_0x15b4c9?0x0:_0x380f2f[_0x6a7e('0x27')];var _0x2723d0=_0x15b4c9?_0x573bdc['count']:_0x380f2f[_0x6a7e('0x27')]+_0x380f2f['limit'];var _0x1d1e3b;if(_0x2723d0>=_0x58d6ea){_0x2723d0=_0x58d6ea;_0x1d1e3b=0xc8;}else{_0x1d1e3b=0xce;}_0x3498c5['status'](_0x1d1e3b);return _0x3498c5['set'](_0x6a7e('0x2a'),_0x8b0439+'-'+_0x2723d0+'/'+_0x58d6ea)['json'](_0x573bdc);}return null;};}function patchUpdates(_0x15cc6a){return function(_0x4a18c7){try{jsonpatch['apply'](_0x4a18c7,_0x15cc6a,!![]);}catch(_0x25783c){return BPromise[_0x6a7e('0x2b')](_0x25783c);}return _0x4a18c7[_0x6a7e('0x2c')]();};}function saveUpdates(_0x106af8,_0x2b1788){return function(_0x2f5deb){if(_0x2f5deb){return _0x2f5deb[_0x6a7e('0x2d')](_0x106af8)[_0x6a7e('0x1b')](function(_0x30d8df){return _0x30d8df;});}return null;};}function removeEntity(_0x47564a,_0x16c05c){return function(_0x231cad){if(_0x231cad){return _0x231cad['destroy']()[_0x6a7e('0x1b')](function(){_0x47564a[_0x6a7e('0x24')](0xcc)[_0x6a7e('0x25')]();});}};}function handleEntityNotFound(_0x510c50,_0x328f9b){return function(_0x3b7678){if(!_0x3b7678){_0x510c50[_0x6a7e('0x2e')](0x194);}return _0x3b7678;};}function handleError(_0x42f03c,_0x110f9c){_0x110f9c=_0x110f9c||0x1f4;return function(_0x1d2e34){logger['error'](_0x1d2e34['stack']);if(_0x1d2e34[_0x6a7e('0x2f')]){delete _0x1d2e34['name'];}_0x42f03c[_0x6a7e('0x24')](_0x110f9c)[_0x6a7e('0x30')](_0x1d2e34);};}exports['index']=function(_0x51eca0,_0x50321e){var _0x43c5b7={},_0x58066a={},_0x575a79={'count':0x0,'rows':[]};var _0x512430=_['map'](db[_0x6a7e('0x31')]['rawAttributes'],function(_0x385ee3){return{'name':_0x385ee3[_0x6a7e('0x32')],'type':_0x385ee3[_0x6a7e('0x33')][_0x6a7e('0x34')]};});_0x58066a[_0x6a7e('0x35')]=_['map'](_0x512430,_0x6a7e('0x2f'));_0x58066a[_0x6a7e('0x36')]=_['keys'](_0x51eca0[_0x6a7e('0x36')]);_0x58066a[_0x6a7e('0x37')]=_['intersection'](_0x58066a[_0x6a7e('0x35')],_0x58066a[_0x6a7e('0x36')]);_0x43c5b7[_0x6a7e('0x38')]=_[_0x6a7e('0x39')](_0x58066a[_0x6a7e('0x35')],qs[_0x6a7e('0x3a')](_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x3a')]));_0x43c5b7[_0x6a7e('0x38')]=_0x43c5b7[_0x6a7e('0x38')][_0x6a7e('0x3b')]?_0x43c5b7['attributes']:_0x58066a['model'];if(!_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x3c')]('nolimit')){_0x43c5b7[_0x6a7e('0x29')]=qs[_0x6a7e('0x29')](_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x29')]);_0x43c5b7[_0x6a7e('0x27')]=qs[_0x6a7e('0x27')](_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x27')]);}_0x43c5b7[_0x6a7e('0x3d')]=qs[_0x6a7e('0x3e')](_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x3e')]);_0x43c5b7[_0x6a7e('0x3f')]=qs[_0x6a7e('0x37')](_['pick'](_0x51eca0['query'],_0x58066a[_0x6a7e('0x37')]),_0x512430);if(_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x40')]){_0x43c5b7[_0x6a7e('0x3f')]=_[_0x6a7e('0x41')](_0x43c5b7[_0x6a7e('0x3f')],{'$or':_[_0x6a7e('0x42')](_0x512430,function(_0x1eaad9){if(_0x1eaad9['type']!==_0x6a7e('0x43')){var _0x479680={};_0x479680[_0x1eaad9[_0x6a7e('0x2f')]]={'$like':'%'+_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x40')]+'%'};return _0x479680;}})});}_0x43c5b7=_[_0x6a7e('0x41')]({},_0x43c5b7,_0x51eca0['options']);var _0x248189={'where':_0x43c5b7[_0x6a7e('0x3f')]};return db[_0x6a7e('0x31')]['count'](_0x248189)[_0x6a7e('0x1b')](function(_0x541a77){_0x575a79[_0x6a7e('0x44')]=_0x541a77;if(_0x51eca0[_0x6a7e('0x36')][_0x6a7e('0x45')]){_0x43c5b7[_0x6a7e('0x46')]=[{'all':!![]}];}return db['Setting'][_0x6a7e('0x47')](_0x43c5b7);})[_0x6a7e('0x1b')](function(_0x188ab5){_0x575a79[_0x6a7e('0x48')]=_0x188ab5;return _0x575a79;})['then'](respondWithFilteredResult(_0x50321e,_0x43c5b7))[_0x6a7e('0x23')](handleError(_0x50321e,null));};exports['show']=function(_0x91bf5,_0xdc536a){var _0x25c2bb={'raw':![],'where':{'id':_0x91bf5[_0x6a7e('0x49')]['id']}},_0x4a7465={};_0x4a7465['model']=_[_0x6a7e('0x4a')](db['Setting'][_0x6a7e('0x4b')]);_0x4a7465[_0x6a7e('0x36')]=_[_0x6a7e('0x4a')](_0x91bf5[_0x6a7e('0x36')]);_0x4a7465[_0x6a7e('0x37')]=_[_0x6a7e('0x39')](_0x4a7465['model'],_0x4a7465[_0x6a7e('0x36')]);_0x25c2bb[_0x6a7e('0x38')]=_[_0x6a7e('0x39')](_0x4a7465[_0x6a7e('0x35')],qs['fields'](_0x91bf5['query'][_0x6a7e('0x3a')]));_0x25c2bb[_0x6a7e('0x38')]=_0x25c2bb[_0x6a7e('0x38')][_0x6a7e('0x3b')]?_0x25c2bb[_0x6a7e('0x38')]:_0x4a7465['model'];if(_0x91bf5[_0x6a7e('0x36')][_0x6a7e('0x45')]){_0x25c2bb[_0x6a7e('0x46')]=[{'all':!![]}];}_0x25c2bb=_[_0x6a7e('0x41')]({},_0x25c2bb,_0x91bf5['options']);return db['Setting'][_0x6a7e('0x4c')](_0x25c2bb)[_0x6a7e('0x1b')](handleEntityNotFound(_0xdc536a,null))['then'](respondWithResult(_0xdc536a,null))[_0x6a7e('0x23')](handleError(_0xdc536a,null));};exports[_0x6a7e('0x2d')]=function(_0xeacc8a,_0x462d0b){if(_0xeacc8a[_0x6a7e('0x4d')]['id']){delete _0xeacc8a[_0x6a7e('0x4d')]['id'];}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0xeacc8a['params']['id']}})[_0x6a7e('0x1b')](handleEntityNotFound(_0x462d0b,null))[_0x6a7e('0x1b')](saveUpdates(_0xeacc8a[_0x6a7e('0x4d')],null))[_0x6a7e('0x1b')](respondWithResult(_0x462d0b,null))[_0x6a7e('0x23')](handleError(_0x462d0b,null));};exports['addLogo']=function(_0x95a9fe,_0xee25e0,_0xfbb2ae){if(_0x95a9fe[_0x6a7e('0x4e')]&&_0x95a9fe[_0x6a7e('0x4e')]['filename']){_0x95a9fe[_0x6a7e('0x4d')][_0x6a7e('0x4f')]=_0x95a9fe[_0x6a7e('0x4e')][_0x6a7e('0x50')];}return db['Setting'][_0x6a7e('0x4c')]({'where':{'id':_0x95a9fe[_0x6a7e('0x49')]['id']}})[_0x6a7e('0x1b')](handleEntityNotFound(_0xee25e0,null))[_0x6a7e('0x1b')](saveUpdates(_0x95a9fe[_0x6a7e('0x4d')],null))[_0x6a7e('0x1b')](respondWithResult(_0xee25e0,null))['catch'](handleError(_0xee25e0,null));};exports[_0x6a7e('0x51')]=function(_0x2b85df,_0x25a4ff,_0x74ba21){if(_0x2b85df[_0x6a7e('0x4e')]&&_0x2b85df['file'][_0x6a7e('0x50')]){_0x2b85df[_0x6a7e('0x4d')][_0x6a7e('0x52')]=_0x2b85df[_0x6a7e('0x4e')]['filename'];}return db[_0x6a7e('0x31')]['find']({'where':{'id':_0x2b85df['params']['id']}})['then'](handleEntityNotFound(_0x25a4ff,null))[_0x6a7e('0x1b')](saveUpdates(_0x2b85df[_0x6a7e('0x4d')],null))['then'](respondWithResult(_0x25a4ff,null))[_0x6a7e('0x23')](handleError(_0x25a4ff,null));};var utilLicense=require(_0x6a7e('0x53'));exports[_0x6a7e('0x54')]=function(_0x512d15,_0x75ef6a,_0x21ec31){var _0x158b66=_0x6a7e('0x55');var _0xec92f7={'custom':![]};return utilLicense[_0x6a7e('0x56')]()['then'](function(_0x110c99){if(_0x110c99){_0xec92f7=_0x110c99;}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0x512d15['params']['id']},'attributes':['logo',_0x6a7e('0x52'),_0x6a7e('0x57'),_0x6a7e('0x58'),'defaultLogo','defaultLoginLogo',_0x6a7e('0x59'),_0x6a7e('0x5a')],'raw':!![]});})[_0x6a7e('0x1b')](handleEntityNotFound(_0x75ef6a,null))[_0x6a7e('0x1b')](function(_0x19c665){if(_0x19c665){var _0x1afd39=_0x19c665[_0x6a7e('0x4f')]&&fs[_0x6a7e('0x5b')](path['join'](config[_0x6a7e('0x5c')],_0x158b66,_['toLower'](_0x19c665[_0x6a7e('0x4f')])))?path['join'](config['root'],_0x158b66,_['toLower'](_0x19c665[_0x6a7e('0x4f')])):path['join'](config[_0x6a7e('0x5c')],_0x158b66,_[_0x6a7e('0x5d')](_0x6a7e('0x5e')));var _0x86e793=_0x6a7e('0x5f')+_[_0x6a7e('0x60')](_0x6a7e('0x4f'));if(_0x19c665[_0x86e793]||!_0xec92f7[_0x6a7e('0x61')]){_0x1afd39=path[_0x6a7e('0x62')](config['root'],_0x158b66,_[_0x6a7e('0x5d')]('default_logo.svg'));}if(!fs[_0x6a7e('0x5b')](_0x1afd39)){throw new db['Sequelize']['ValidationError'](_[_0x6a7e('0x60')](_0x6a7e('0x4f'))+_0x6a7e('0x63'));}return _0x75ef6a[_0x6a7e('0x64')](_0x1afd39);}})[_0x6a7e('0x23')](handleError(_0x75ef6a,null));};var utilLicense=require(_0x6a7e('0x53'));exports[_0x6a7e('0x65')]=function(_0x16ac0d,_0x5c3882,_0x32384c){var _0x5ba94e=_0x6a7e('0x55');var _0x4c5c68={'custom':![]};return utilLicense[_0x6a7e('0x56')]()[_0x6a7e('0x1b')](function(_0x43ec3e){if(_0x43ec3e){_0x4c5c68=_0x43ec3e;}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0x16ac0d[_0x6a7e('0x49')]['id']},'attributes':[_0x6a7e('0x4f'),_0x6a7e('0x52'),_0x6a7e('0x57'),'favicon','defaultLogo','defaultLoginLogo',_0x6a7e('0x59'),_0x6a7e('0x5a')],'raw':!![]});})[_0x6a7e('0x1b')](handleEntityNotFound(_0x5c3882,null))[_0x6a7e('0x1b')](function(_0x262ca5){if(_0x262ca5){var _0x5e72=_0x262ca5[_0x6a7e('0x52')]&&fs[_0x6a7e('0x5b')](path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x5ba94e,_['toLower'](_0x262ca5[_0x6a7e('0x52')])))?path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x5ba94e,_[_0x6a7e('0x5d')](_0x262ca5[_0x6a7e('0x52')])):path['join'](config[_0x6a7e('0x5c')],_0x5ba94e,_[_0x6a7e('0x5d')](_0x6a7e('0x66')));var _0x25e31a=_0x6a7e('0x5f')+_[_0x6a7e('0x60')]('loginLogo');if(_0x262ca5[_0x25e31a]||!_0x4c5c68[_0x6a7e('0x61')]){_0x5e72=path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x5ba94e,_[_0x6a7e('0x5d')](_0x6a7e('0x66')));}if(!fs[_0x6a7e('0x5b')](_0x5e72)){throw new db['Sequelize'][(_0x6a7e('0x67'))](_[_0x6a7e('0x60')](_0x6a7e('0x52'))+_0x6a7e('0x63'));}return _0x5c3882['download'](_0x5e72);}})['catch'](handleError(_0x5c3882,null));};exports[_0x6a7e('0x68')]=function(_0x55777d,_0x14d93d){return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0x55777d['params']['id']},'attributes':[_0x6a7e('0x69')]})[_0x6a7e('0x1b')](respondWithResult(_0x14d93d,null))[_0x6a7e('0x23')](handleError(_0x14d93d,null));};exports[_0x6a7e('0x6a')]=function(_0x187492,_0x5447cc,_0x3cc9d9){if(_0x187492['file']&&_0x187492[_0x6a7e('0x4e')][_0x6a7e('0x50')]){_0x187492[_0x6a7e('0x4d')][_0x6a7e('0x57')]=_0x187492['file'][_0x6a7e('0x50')];}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0x187492['params']['id']}})['then'](handleEntityNotFound(_0x5447cc,null))[_0x6a7e('0x1b')](saveUpdates(_0x187492[_0x6a7e('0x4d')],null))[_0x6a7e('0x1b')](respondWithResult(_0x5447cc,null))['catch'](handleError(_0x5447cc,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2d11ee,_0x16e027,_0x6b8e06){var _0x3cfe47=_0x6a7e('0x55');var _0xf28d1e={'custom':![]};return utilLicense[_0x6a7e('0x56')]()[_0x6a7e('0x1b')](function(_0xb478ef){if(_0xb478ef){_0xf28d1e=_0xb478ef;}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0x2d11ee['params']['id']},'attributes':[_0x6a7e('0x4f'),_0x6a7e('0x52'),_0x6a7e('0x57'),_0x6a7e('0x58'),_0x6a7e('0x6b'),'defaultLoginLogo',_0x6a7e('0x59'),'defaultFavicon'],'raw':!![]});})[_0x6a7e('0x1b')](handleEntityNotFound(_0x16e027,null))['then'](function(_0x2f7e23){if(_0x2f7e23){var _0x1aaea0=_0x2f7e23[_0x6a7e('0x57')]&&fs[_0x6a7e('0x5b')](path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x3cfe47,_['toLower'](_0x2f7e23[_0x6a7e('0x57')])))?path[_0x6a7e('0x62')](config['root'],_0x3cfe47,_['toLower'](_0x2f7e23[_0x6a7e('0x57')])):path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x3cfe47,_[_0x6a7e('0x5d')]('default_preferred.png'));var _0x282de7='default'+_['upperFirst'](_0x6a7e('0x57'));if(_0x2f7e23[_0x282de7]||!_0xf28d1e[_0x6a7e('0x61')]||!_0xf28d1e['preferred']){_0x1aaea0=path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x3cfe47,_[_0x6a7e('0x5d')](_0x6a7e('0x6c')));}if(!fs['existsSync'](_0x1aaea0)){throw new db['Sequelize'][(_0x6a7e('0x67'))](_[_0x6a7e('0x60')](_0x6a7e('0x57'))+_0x6a7e('0x63'));}return _0x16e027[_0x6a7e('0x64')](_0x1aaea0);}})[_0x6a7e('0x23')](handleError(_0x16e027,null));};exports[_0x6a7e('0x6d')]=function(_0x162baf,_0x5d0921,_0x2dc808){if(_0x162baf[_0x6a7e('0x4e')]&&_0x162baf[_0x6a7e('0x4e')][_0x6a7e('0x50')]){_0x162baf['body']['favicon']=_0x162baf['file'][_0x6a7e('0x50')];}return db['Setting']['find']({'where':{'id':_0x162baf[_0x6a7e('0x49')]['id']}})[_0x6a7e('0x1b')](handleEntityNotFound(_0x5d0921,null))[_0x6a7e('0x1b')](saveUpdates(_0x162baf[_0x6a7e('0x4d')],null))[_0x6a7e('0x1b')](respondWithResult(_0x5d0921,null))['catch'](handleError(_0x5d0921,null));};var utilLicense=require(_0x6a7e('0x53'));exports[_0x6a7e('0x6e')]=function(_0xb7dff,_0x1528ba,_0x5f2a34){var _0x5f2193='server/files/images/logos';var _0x2b8f1b={'custom':![]};return utilLicense[_0x6a7e('0x56')]()[_0x6a7e('0x1b')](function(_0x1b7ea0){if(_0x1b7ea0){_0x2b8f1b=_0x1b7ea0;}return db[_0x6a7e('0x31')][_0x6a7e('0x4c')]({'where':{'id':_0xb7dff['params']['id']},'attributes':['logo',_0x6a7e('0x52'),'preferred',_0x6a7e('0x58'),_0x6a7e('0x6b'),_0x6a7e('0x6f'),_0x6a7e('0x59'),_0x6a7e('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x1528ba,null))['then'](function(_0x1313e6){if(_0x1313e6){var _0x26cffd=_0x1313e6[_0x6a7e('0x58')]&&fs[_0x6a7e('0x5b')](path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x5f2193,_[_0x6a7e('0x5d')](_0x1313e6['favicon'])))?path[_0x6a7e('0x62')](config['root'],_0x5f2193,_[_0x6a7e('0x5d')](_0x1313e6[_0x6a7e('0x58')])):path[_0x6a7e('0x62')](config[_0x6a7e('0x5c')],_0x5f2193,_[_0x6a7e('0x5d')](_0x6a7e('0x70')));var _0x508219=_0x6a7e('0x5f')+_['upperFirst']('favicon');if(_0x1313e6[_0x508219]||!_0x2b8f1b['custom']){_0x26cffd=path[_0x6a7e('0x62')](config['root'],_0x5f2193,_[_0x6a7e('0x5d')]('default_favicon.ico'));}if(!fs[_0x6a7e('0x5b')](_0x26cffd)){throw new db[(_0x6a7e('0x71'))][(_0x6a7e('0x67'))](_[_0x6a7e('0x60')](_0x6a7e('0x58'))+_0x6a7e('0x63'));}return _0x1528ba[_0x6a7e('0x64')](_0x26cffd);}})[_0x6a7e('0x23')](handleError(_0x1528ba,null));};exports['getDate']=function(_0x24312f,_0x13dccc){var _0x22c68b={'offset':moment()['utcOffset']()};_0x22c68b[_0x6a7e('0x72')]=moment()[_0x6a7e('0x73')](_0x22c68b[_0x6a7e('0x27')])[_0x6a7e('0x74')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x13dccc[_0x6a7e('0x24')](0xc8)[_0x6a7e('0x30')](_0x22c68b);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 12c25db..bcf19c3 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x55ca,0x126));var _0xa55c=function(_0x1f3280,_0xec6845){_0x1f3280=_0x1f3280-0x0;var _0x50770f=_0x55ca[_0x1f3280];return _0x50770f;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 932b4be..add1ed2 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 _0x8b24=['rpc','../../config/environment','client','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x8b24,0x9d));var _0x48b2=function(_0x143699,_0x2dfea7){_0x143699=_0x143699-0x0;var _0x3b638a=_0x8b24[_0x143699];return _0x3b638a;};'use strict';var _=require('lodash');var util=require(_0x48b2('0x0'));var moment=require(_0x48b2('0x1'));var BPromise=require(_0x48b2('0x2'));var rs=require(_0x48b2('0x3'));var fs=require('fs');var Redis=require(_0x48b2('0x4'));var db=require(_0x48b2('0x5'))['db'];var utils=require(_0x48b2('0x6'));var logger=require(_0x48b2('0x7'))(_0x48b2('0x8'));var config=require(_0x48b2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x48b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17bf90,_0x7f506c,_0x495ea2){return new BPromise(function(_0x46ad1f,_0x40cf18){return client[_0x48b2('0xb')](_0x17bf90,_0x495ea2)[_0x48b2('0xc')](function(_0x3bd2ba){logger[_0x48b2('0xd')]('Setting,\x20%s,\x20%s',_0x7f506c,'request\x20sent');logger[_0x48b2('0xe')](_0x48b2('0xf'),_0x7f506c,_0x48b2('0x10'),JSON[_0x48b2('0x11')](_0x3bd2ba));if(_0x3bd2ba[_0x48b2('0x12')]){if(_0x3bd2ba[_0x48b2('0x12')][_0x48b2('0x13')]===0x1f4){logger['error'](_0x48b2('0x14'),_0x7f506c,_0x3bd2ba['error'][_0x48b2('0x15')]);return _0x40cf18(_0x3bd2ba[_0x48b2('0x12')]['message']);}logger[_0x48b2('0x12')](_0x48b2('0x14'),_0x7f506c,_0x3bd2ba['error'][_0x48b2('0x15')]);return _0x46ad1f(_0x3bd2ba[_0x48b2('0x12')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x7f506c,_0x48b2('0x10'));_0x46ad1f(_0x3bd2ba[_0x48b2('0x16')][_0x48b2('0x15')]);}})[_0x48b2('0x17')](function(_0x445dbe){logger[_0x48b2('0x12')](_0x48b2('0x14'),_0x7f506c,_0x445dbe);_0x40cf18(_0x445dbe);});});}exports[_0x48b2('0x18')]=function(_0x2b67c9){var _0x16ec21=this;return new Promise(function(_0x31978a,_0x2b5a77){return db[_0x48b2('0x19')][_0x48b2('0x1a')]({'raw':_0x2b67c9['options']?_0x2b67c9[_0x48b2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9['options'][_0x48b2('0x1c')]||null:null,'attributes':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1d')]||null:null,'include':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1e')]?_[_0x48b2('0x1f')](_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1e')],function(_0x37812c){return{'model':db[_0x37812c['model']],'as':_0x37812c['as'],'attributes':_0x37812c[_0x48b2('0x1d')],'include':_0x37812c[_0x48b2('0x1e')]?_[_0x48b2('0x1f')](_0x37812c[_0x48b2('0x1e')],function(_0x440e11){return{'model':db[_0x440e11[_0x48b2('0x20')]],'as':_0x440e11['as'],'attributes':_0x440e11[_0x48b2('0x1d')],'include':_0x440e11[_0x48b2('0x1e')]?_['map'](_0x440e11[_0x48b2('0x1e')],function(_0x524343){return{'model':db[_0x524343['model']],'as':_0x524343['as'],'attributes':_0x524343[_0x48b2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0xc')](function(_0xdc92c3){logger['info'](_0x48b2('0x18'),_0x2b67c9);logger['debug'](_0x48b2('0x18'),_0x2b67c9,JSON[_0x48b2('0x11')](_0xdc92c3));_0x31978a(_0xdc92c3);})['catch'](function(_0x4648e2){logger[_0x48b2('0x12')](_0x48b2('0x18'),_0x4648e2['message'],_0x2b67c9);_0x2b5a77(_0x16ec21[_0x48b2('0x12')](0x1f4,_0x4648e2[_0x48b2('0x15')]));});});}; \ No newline at end of file +var _0x100c=['Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x92e403,_0x1171f5){var _0x41d3ab=function(_0x1ccbec){while(--_0x1ccbec){_0x92e403['push'](_0x92e403['shift']());}};_0x41d3ab(++_0x1171f5);}(_0x100c,0x92));var _0xc100=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x100c[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xc100('0x0'));var util=require(_0xc100('0x1'));var moment=require(_0xc100('0x2'));var BPromise=require(_0xc100('0x3'));var rs=require(_0xc100('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc100('0x5'))['db'];var utils=require(_0xc100('0x6'));var logger=require(_0xc100('0x7'))(_0xc100('0x8'));var config=require(_0xc100('0x9'));var jayson=require(_0xc100('0xa'));var client=jayson['client'][_0xc100('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4891fe,_0x4c2722,_0x4d698b){return new BPromise(function(_0x3d9331,_0x472841){return client['request'](_0x4891fe,_0x4d698b)[_0xc100('0xc')](function(_0x291112){logger[_0xc100('0xd')]('Setting,\x20%s,\x20%s',_0x4c2722,_0xc100('0xe'));logger['debug'](_0xc100('0xf'),_0x4c2722,_0xc100('0xe'),JSON[_0xc100('0x10')](_0x291112));if(_0x291112[_0xc100('0x11')]){if(_0x291112[_0xc100('0x11')][_0xc100('0x12')]===0x1f4){logger[_0xc100('0x11')](_0xc100('0x13'),_0x4c2722,_0x291112[_0xc100('0x11')][_0xc100('0x14')]);return _0x472841(_0x291112[_0xc100('0x11')][_0xc100('0x14')]);}logger[_0xc100('0x11')](_0xc100('0x13'),_0x4c2722,_0x291112['error'][_0xc100('0x14')]);return _0x3d9331(_0x291112[_0xc100('0x11')][_0xc100('0x14')]);}else{logger[_0xc100('0xd')](_0xc100('0x13'),_0x4c2722,'request\x20sent');_0x3d9331(_0x291112[_0xc100('0x15')][_0xc100('0x14')]);}})[_0xc100('0x16')](function(_0x47d2c8){logger['error']('Setting,\x20%s,\x20%s',_0x4c2722,_0x47d2c8);_0x472841(_0x47d2c8);});});}exports[_0xc100('0x17')]=function(_0x1bcea3){var _0x176cfc=this;return new Promise(function(_0x56b04c,_0x2bb7b5){return db[_0xc100('0x18')][_0xc100('0x19')]({'raw':_0x1bcea3[_0xc100('0x1a')]?_0x1bcea3[_0xc100('0x1a')][_0xc100('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bcea3[_0xc100('0x1a')]?_0x1bcea3['options']['where']||null:null,'attributes':_0x1bcea3['options']?_0x1bcea3['options'][_0xc100('0x1c')]||null:null,'include':_0x1bcea3[_0xc100('0x1a')]?_0x1bcea3[_0xc100('0x1a')][_0xc100('0x1d')]?_[_0xc100('0x1e')](_0x1bcea3[_0xc100('0x1a')][_0xc100('0x1d')],function(_0x3d2249){return{'model':db[_0x3d2249[_0xc100('0x1f')]],'as':_0x3d2249['as'],'attributes':_0x3d2249['attributes'],'include':_0x3d2249[_0xc100('0x1d')]?_[_0xc100('0x1e')](_0x3d2249[_0xc100('0x1d')],function(_0x5120fe){return{'model':db[_0x5120fe[_0xc100('0x1f')]],'as':_0x5120fe['as'],'attributes':_0x5120fe[_0xc100('0x1c')],'include':_0x5120fe['include']?_[_0xc100('0x1e')](_0x5120fe[_0xc100('0x1d')],function(_0xe1e87){return{'model':db[_0xe1e87[_0xc100('0x1f')]],'as':_0xe1e87['as'],'attributes':_0xe1e87[_0xc100('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b96be){logger[_0xc100('0xd')](_0xc100('0x17'),_0x1bcea3);logger[_0xc100('0x20')](_0xc100('0x17'),_0x1bcea3,JSON[_0xc100('0x10')](_0x1b96be));_0x56b04c(_0x1b96be);})['catch'](function(_0xc152d5){logger[_0xc100('0x11')](_0xc100('0x17'),_0xc152d5['message'],_0x1bcea3);_0x2bb7b5(_0x176cfc[_0xc100('0x11')](0x1f4,_0xc152d5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index db4cdf1..ec7c9a2 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x110ea8,_0xacb6fa){var _0x4073cf=function(_0x444fcb){while(--_0x444fcb){_0x110ea8['push'](_0x110ea8['shift']());}};_0x4073cf(++_0xacb6fa);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x57cdce,_0x2c5636){var _0x29a82a=function(_0x1a623f){while(--_0x1a623f){_0x57cdce['push'](_0x57cdce['shift']());}};_0x29a82a(++_0x2c5636);}(_0x7a54,0x106));var _0x47a5=function(_0x76ae35,_0x189f39){_0x76ae35=_0x76ae35-0x0;var _0x1a82c4=_0x7a54[_0x76ae35];return _0x1a82c4;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4969bc7..cc5dcdc 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 _0xdff0=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0xdff0,0x1ce));var _0x0dff=function(_0x4a22a6,_0x52b68e){_0x4a22a6=_0x4a22a6-0x0;var _0x308910=_0xdff0[_0x4a22a6];return _0x308910;};'use strict';var Sequelize=require(_0x0dff('0x0'));var rs=require(_0x0dff('0x1'));module[_0x0dff('0x2')]={'name':{'type':Sequelize[_0x0dff('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0dff('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0dff('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0dff('0x3')],'defaultValue':function(){return rs[_0x0dff('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0dff('0x5')]('twilio',_0x0dff('0x6'),_0x0dff('0x7'),_0x0dff('0x8'),_0x0dff('0x9'),'clickatell',_0x0dff('0xa'),'csc',_0x0dff('0xb'),_0x0dff('0xc'))},'accountSid':{'type':Sequelize[_0x0dff('0x3')]},'authId':{'type':Sequelize[_0x0dff('0x3')]},'authToken':{'type':Sequelize[_0x0dff('0x3')]},'smsMethod':{'type':Sequelize[_0x0dff('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0dff('0x3')]},'password':{'type':Sequelize[_0x0dff('0x3')]},'apiKey':{'type':Sequelize[_0x0dff('0x3')]},'applicationId':{'type':Sequelize[_0x0dff('0x3')]},'accountId':{'type':Sequelize[_0x0dff('0x3')]},'senderString':{'type':Sequelize[_0x0dff('0x3')]},'deliveryReport':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x0dff('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0dff('0xe');}},'notificationSound':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0dff('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0dff('0xf')],'comment':_0x0dff('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![],'comment':_0x0dff('0x11'),'set':function(_0x2398ec){if(!_0x2398ec)this[_0x0dff('0x12')]('mandatoryDispositionPauseId',null);this[_0x0dff('0x12')](_0x0dff('0x13'),_0x2398ec);}}}; \ No newline at end of file +var _0x81bf=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','STRING','name','ENUM','connectel','clicksend','clickatell','bandwidth','csc'];(function(_0x2044f4,_0x42b8ea){var _0x17fcf2=function(_0x2f2d5b){while(--_0x2f2d5b){_0x2044f4['push'](_0x2044f4['shift']());}};_0x17fcf2(++_0x42b8ea);}(_0x81bf,0x1d2));var _0xf81b=function(_0x169eea,_0x1e5d2a){_0x169eea=_0x169eea-0x0;var _0xf3b69d=_0x81bf[_0x169eea];return _0xf3b69d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf81b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf81b('0x1')],'unique':_0xf81b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf81b('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf81b('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf81b('0x1')]},'type':{'type':Sequelize[_0xf81b('0x3')]('twilio','skebby',_0xf81b('0x4'),_0xf81b('0x5'),'plivo',_0xf81b('0x6'),_0xf81b('0x7'),_0xf81b('0x8'),_0xf81b('0x9'),_0xf81b('0xa'))},'accountSid':{'type':Sequelize[_0xf81b('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf81b('0x1')]},'smsMethod':{'type':Sequelize[_0xf81b('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf81b('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xf81b('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf81b('0x1')]},'deliveryReport':{'type':Sequelize[_0xf81b('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xf81b('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf81b('0xc')],'defaultValue':function(){return _0xf81b('0xd');}},'notificationSound':{'type':Sequelize[_0xf81b('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf81b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf81b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf81b('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf81b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf81b('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf81b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf81b('0xe')],'comment':_0xf81b('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf81b('0x10'),'set':function(_0x29a5ac){if(!_0x29a5ac)this[_0xf81b('0x11')](_0xf81b('0x12'),null);this[_0xf81b('0x11')]('mandatoryDisposition',_0x29a5ac);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e1c0cd8..8e4fee6 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 _0xcb80=['message-id','state','addAgents','spread','emit','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','UserProfileResource','describe','addDisposition','getDispositions','Disposition','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','findOne','length','order','rows','removeAnswers','notify','sms','SmsApplication','account','orderBy','priority','asc','Applications','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','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','Contacts','DESC','omit','defaults','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','User','UserId','unshift','agent','*,*,*,*','queueId','queue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','sendStatus','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','user','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','SmsMessage','connectel','requestid','statusInt','status_code','groupName','redif','DELIVERED','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet'];(function(_0x5a93f0,_0x172b1b){var _0x53844d=function(_0x19ba69){while(--_0x19ba69){_0x5a93f0['push'](_0x5a93f0['shift']());}};_0x53844d(++_0x172b1b);}(_0xcb80,0xeb));var _0x0cb8=function(_0x4bbe3d,_0x48c512){_0x4bbe3d=_0x4bbe3d-0x0;var _0x3d3a23=_0xcb80[_0x4bbe3d];return _0x3d3a23;};'use strict';var emlformat=require(_0x0cb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0cb8('0x2'));var BPromise=require(_0x0cb8('0x3'));var Mustache=require('mustache');var util=require(_0x0cb8('0x4'));var path=require(_0x0cb8('0x5'));var sox=require('sox');var csv=require(_0x0cb8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cb8('0x7'));var _=require('lodash');var squel=require(_0x0cb8('0x8'));var crypto=require(_0x0cb8('0x9'));var jsforce=require(_0x0cb8('0xa'));var deskjs=require(_0x0cb8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0cb8('0xc'));var Papa=require(_0x0cb8('0xd'));var Redis=require('ioredis');var authService=require(_0x0cb8('0xe'));var qs=require(_0x0cb8('0xf'));var as=require(_0x0cb8('0x10'));var hardwareService=require(_0x0cb8('0x11'));var logger=require('../../config/logger')(_0x0cb8('0x12'));var utils=require(_0x0cb8('0x13'));var config=require(_0x0cb8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0cb8('0x15')]=_['defaults'](config['redis'],{'host':_0x0cb8('0x16'),'port':0x18eb});var socket=require(_0x0cb8('0x17'))(new Redis(config['redis']));require(_0x0cb8('0x18'))[_0x0cb8('0x19')](socket);var jayson=require(_0x0cb8('0x1a'));var client=jayson['client'][_0x0cb8('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x4572df,_0x5413d2,_0x3150bb,_0x2c834d){return new BPromise(function(_0x25606c,_0x20feca){var _0x738cde=_0x2c834d||client;return _0x738cde[_0x0cb8('0x1c')](_0x4572df,_0x3150bb)[_0x0cb8('0x1d')](function(_0x2f3d7d){logger['info'](_0x0cb8('0x1e'),_0x5413d2,'request\x20sent');logger[_0x0cb8('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5413d2,_0x0cb8('0x20'),JSON[_0x0cb8('0x21')](_0x2f3d7d));if(_0x2f3d7d[_0x0cb8('0x22')]){if(_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x23')]===0x1f4){logger['error'](_0x0cb8('0x1e'),_0x5413d2,_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x24')]);return _0x20feca(_0x2f3d7d[_0x0cb8('0x22')]['message']);}logger[_0x0cb8('0x22')](_0x0cb8('0x1e'),_0x5413d2,_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x24')]);return _0x25606c(_0x2f3d7d['error'][_0x0cb8('0x24')]);}else{logger[_0x0cb8('0x25')](_0x0cb8('0x1e'),_0x5413d2,'request\x20sent');_0x25606c(_0x2f3d7d[_0x0cb8('0x26')][_0x0cb8('0x24')]);}})[_0x0cb8('0x27')](function(_0x237f95){logger[_0x0cb8('0x22')](_0x0cb8('0x1e'),_0x5413d2,_0x237f95);_0x20feca(_0x237f95);});});}function respondWithStatusCode(_0x17866f,_0x2558dd){_0x2558dd=_0x2558dd||0xcc;return function(_0x1aaa46){if(_0x1aaa46){return _0x17866f['sendStatus'](_0x2558dd);}return _0x17866f[_0x0cb8('0x28')](_0x2558dd)[_0x0cb8('0x29')]();};}function respondWithResult(_0x5ca59d,_0x41d309){_0x41d309=_0x41d309||0xc8;return function(_0x14b654){if(_0x14b654){return _0x5ca59d['status'](_0x41d309)[_0x0cb8('0x2a')](_0x14b654);}};}function respondWithFilteredResult(_0x5df817,_0x597cb8){return function(_0x280476){if(_0x280476){var _0x53db9d=typeof _0x597cb8[_0x0cb8('0x2b')]===_0x0cb8('0x2c')&&typeof _0x597cb8[_0x0cb8('0x2d')]===_0x0cb8('0x2c');var _0x4c895b=_0x280476[_0x0cb8('0x2e')];var _0x4393d9=_0x53db9d?0x0:_0x597cb8[_0x0cb8('0x2b')];var _0xea82f6=_0x53db9d?_0x280476[_0x0cb8('0x2e')]:_0x597cb8[_0x0cb8('0x2b')]+_0x597cb8[_0x0cb8('0x2d')];var _0x352004;if(_0xea82f6>=_0x4c895b){_0xea82f6=_0x4c895b;_0x352004=0xc8;}else{_0x352004=0xce;}_0x5df817[_0x0cb8('0x28')](_0x352004);return _0x5df817[_0x0cb8('0x2f')](_0x0cb8('0x30'),_0x4393d9+'-'+_0xea82f6+'/'+_0x4c895b)[_0x0cb8('0x2a')](_0x280476);}return null;};}function patchUpdates(_0x51e321){return function(_0x4a1607){try{jsonpatch[_0x0cb8('0x31')](_0x4a1607,_0x51e321,!![]);}catch(_0x1ea4af){return BPromise['reject'](_0x1ea4af);}return _0x4a1607[_0x0cb8('0x32')]();};}function saveUpdates(_0x3fb165,_0x5e91ae){return function(_0x544d01){if(_0x544d01){return _0x544d01[_0x0cb8('0x33')](_0x3fb165)['then'](function(_0x95a18a){return _0x95a18a;});}return null;};}function removeEntity(_0x5d7c70,_0x5e4d29){return function(_0x3a5081){if(_0x3a5081){return _0x3a5081[_0x0cb8('0x34')]()[_0x0cb8('0x1d')](function(){var _0x476a4b=_0x3a5081[_0x0cb8('0x35')]({'plain':!![]});var _0x4a423a=_0x0cb8('0x36');return db['UserProfileResource'][_0x0cb8('0x34')]({'where':{'type':_0x4a423a,'resourceId':_0x476a4b['id']}})['then'](function(){return _0x3a5081;});})[_0x0cb8('0x1d')](function(){_0x5d7c70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8751,_0x5b464c){return function(_0x4c91b9){if(!_0x4c91b9){_0x5c8751['sendStatus'](0x194);}return _0x4c91b9;};}function handleError(_0xdd805b,_0xa23711){_0xa23711=_0xa23711||0x1f4;return function(_0x2b9539){logger[_0x0cb8('0x22')](_0x2b9539[_0x0cb8('0x37')]);if(_0x2b9539[_0x0cb8('0x38')]){delete _0x2b9539[_0x0cb8('0x38')];}_0xdd805b[_0x0cb8('0x28')](_0xa23711)[_0x0cb8('0x39')](_0x2b9539);};}exports[_0x0cb8('0x3a')]=function(_0x2e18af,_0x953e4d){var _0x59313d={'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]},_0x4e4c6f={},_0x45897c={'count':0x0,'rows':[]};var _0x472a8a=_[_0x0cb8('0x3d')](db[_0x0cb8('0x3e')][_0x0cb8('0x3f')],function(_0x17106e){return{'name':_0x17106e[_0x0cb8('0x40')],'type':_0x17106e['type']['key']};});_0x4e4c6f['model']=_[_0x0cb8('0x3d')](_0x472a8a,_0x0cb8('0x38'));_0x4e4c6f[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x2e18af['query']);_0x4e4c6f[_0x0cb8('0x43')]=_['intersection'](_0x4e4c6f[_0x0cb8('0x44')],_0x4e4c6f[_0x0cb8('0x41')]);_0x59313d[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x4e4c6f[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x2e18af['query']['fields']));_0x59313d[_0x0cb8('0x45')]=_0x59313d[_0x0cb8('0x45')]['length']?_0x59313d[_0x0cb8('0x45')]:_0x4e4c6f[_0x0cb8('0x44')];if(!_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x59313d[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x2e18af['query'][_0x0cb8('0x2d')]);_0x59313d[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x2e18af[_0x0cb8('0x41')]['offset']);}_0x59313d['order']=qs[_0x0cb8('0x4a')](_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x59313d[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x2e18af[_0x0cb8('0x41')],_0x4e4c6f['filters']),_0x472a8a);if(_0x2e18af['query']['filter']){_0x59313d['where']=_[_0x0cb8('0x4d')](_0x59313d['where'],{'$or':_[_0x0cb8('0x3d')](_0x472a8a,function(_0x5246c5){if(_0x5246c5[_0x0cb8('0x4e')]!=='VIRTUAL'){var _0x19be79={};_0x19be79[_0x5246c5[_0x0cb8('0x38')]]={'$like':'%'+_0x2e18af['query'][_0x0cb8('0x4f')]+'%'};return _0x19be79;}})});}_0x59313d=_[_0x0cb8('0x4d')]({},_0x59313d,_0x2e18af[_0x0cb8('0x50')]);var _0x137d67={'where':_0x59313d['where']};return db[_0x0cb8('0x3e')][_0x0cb8('0x2e')](_0x137d67)[_0x0cb8('0x1d')](function(_0x916e75){_0x45897c[_0x0cb8('0x2e')]=_0x916e75;if(_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x51')]){_0x59313d['include']=[{'all':!![]}];}return db[_0x0cb8('0x3e')]['findAll'](_0x59313d);})['then'](function(_0x4783c9){_0x45897c['rows']=_0x4783c9;return _0x45897c;})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x953e4d,_0x59313d))['catch'](handleError(_0x953e4d,null));};exports[_0x0cb8('0x52')]=function(_0x5bcdcf,_0x13452d){var _0x1a7353={'raw':![],'where':{'id':_0x5bcdcf[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]},_0x3b5b5f={};_0x3b5b5f[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x3e')]['rawAttributes']);_0x3b5b5f[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x5bcdcf['query']);_0x3b5b5f[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x3b5b5f[_0x0cb8('0x44')],_0x3b5b5f[_0x0cb8('0x41')]);_0x1a7353['attributes']=_['intersection'](_0x3b5b5f[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x5bcdcf[_0x0cb8('0x41')][_0x0cb8('0x47')]));_0x1a7353['attributes']=_0x1a7353[_0x0cb8('0x45')]['length']?_0x1a7353[_0x0cb8('0x45')]:_0x3b5b5f[_0x0cb8('0x44')];if(_0x5bcdcf['query'][_0x0cb8('0x51')]){_0x1a7353[_0x0cb8('0x54')]=[{'all':!![]}];}_0x1a7353=_[_0x0cb8('0x4d')]({},_0x1a7353,_0x5bcdcf[_0x0cb8('0x50')]);return db[_0x0cb8('0x3e')]['find'](_0x1a7353)[_0x0cb8('0x1d')](handleEntityNotFound(_0x13452d,null))[_0x0cb8('0x1d')](respondWithResult(_0x13452d,null))[_0x0cb8('0x27')](handleError(_0x13452d,null));};exports[_0x0cb8('0x55')]=function(_0x20e2af,_0x2a4182){return db[_0x0cb8('0x3e')][_0x0cb8('0x55')](_0x20e2af[_0x0cb8('0x56')],{})['then'](function(_0x32bc55){var _0xe919a2=_0x20e2af['user'][_0x0cb8('0x35')]({'plain':!![]});if(!_0xe919a2)throw new Error(_0x0cb8('0x57'));if(_0xe919a2['role']==='user'){var _0x4246e0=_0x32bc55[_0x0cb8('0x35')]({'plain':!![]});var _0x4c7250='SmsAccounts';return db['UserProfileSection'][_0x0cb8('0x58')]({'where':{'name':_0x4c7250,'userProfileId':_0xe919a2['userProfileId']},'raw':!![]})['then'](function(_0x432857){if(_0x432857&&_0x432857['autoAssociation']===0x0){return db[_0x0cb8('0x59')][_0x0cb8('0x55')]({'name':_0x4246e0['name'],'resourceId':_0x4246e0['id'],'type':_0x432857['name'],'sectionId':_0x432857['id']},{})[_0x0cb8('0x1d')](function(){return _0x32bc55;});}else{return _0x32bc55;}})[_0x0cb8('0x27')](function(_0x3d9cae){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9cae);throw _0x3d9cae;});}return _0x32bc55;})[_0x0cb8('0x1d')](respondWithResult(_0x2a4182,0xc9))[_0x0cb8('0x27')](handleError(_0x2a4182,null));};exports[_0x0cb8('0x33')]=function(_0x35d0fb,_0x454322){if(_0x35d0fb[_0x0cb8('0x56')]['id']){delete _0x35d0fb[_0x0cb8('0x56')]['id'];}return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x35d0fb[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0x454322,null))[_0x0cb8('0x1d')](saveUpdates(_0x35d0fb[_0x0cb8('0x56')],null))[_0x0cb8('0x1d')](respondWithResult(_0x454322,null))[_0x0cb8('0x27')](handleError(_0x454322,null));};exports[_0x0cb8('0x34')]=function(_0x4da7e4,_0x4389e9){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x4da7e4[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x4389e9,null))['then'](removeEntity(_0x4389e9,null))[_0x0cb8('0x27')](handleError(_0x4389e9,null));};exports[_0x0cb8('0x5a')]=function(_0x3c4684,_0x41fa7d){return db[_0x0cb8('0x3e')][_0x0cb8('0x5a')]()[_0x0cb8('0x1d')](respondWithResult(_0x41fa7d,null))[_0x0cb8('0x27')](handleError(_0x41fa7d,null));};exports[_0x0cb8('0x5b')]=function(_0x7e935d,_0x5e7c44,_0x4a4025){if(_0x7e935d[_0x0cb8('0x56')]['id']){delete _0x7e935d['body']['id'];}return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x7e935d['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5e7c44,null))[_0x0cb8('0x1d')](function(_0x427592){if(_0x427592){_0x7e935d['body']['SmsAccountId']=_0x427592['id'];return db['Disposition'][_0x0cb8('0x55')](_0x7e935d[_0x0cb8('0x56')]);}})[_0x0cb8('0x1d')](respondWithResult(_0x5e7c44,null))[_0x0cb8('0x27')](handleError(_0x5e7c44,null));};exports[_0x0cb8('0x5c')]=function(_0x4bdf4f,_0x49fe25,_0x1d6eb0){var _0x1c6265={'raw':![],'where':{}};var _0x2883b0={};var _0x2b5cde={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')]['findOne']({'where':{'id':_0x4bdf4f[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x49fe25,null))['then'](function(_0x34c5de){if(_0x34c5de){_0x2883b0[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x5d')]['rawAttributes']);_0x2883b0[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x4bdf4f[_0x0cb8('0x41')]);_0x2883b0[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x2883b0[_0x0cb8('0x44')],_0x2883b0[_0x0cb8('0x41')]);_0x1c6265[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x2883b0['model'],qs['fields'](_0x4bdf4f[_0x0cb8('0x41')]['fields']));_0x1c6265[_0x0cb8('0x45')]=_0x1c6265['attributes']['length']?_0x1c6265['attributes']:_0x2883b0[_0x0cb8('0x44')];if(!_0x4bdf4f['query'][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x1c6265[_0x0cb8('0x2d')]=qs['limit'](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x1c6265['offset']=qs['offset'](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x2b')]);}_0x1c6265['order']=qs[_0x0cb8('0x4a')](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x1c6265['where']=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x4bdf4f['query'],_0x2883b0['filters']));_0x1c6265['where']['SmsAccountId']=_0x34c5de['id'];if(_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x1c6265[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0x1c6265[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x1c6265[_0x0cb8('0x45')],function(_0x2d5e0d){var _0x3fa42e={};_0x3fa42e[_0x2d5e0d]={'$like':'%'+_0x4bdf4f['query'][_0x0cb8('0x4f')]+'%'};return _0x3fa42e;})});}_0x1c6265=_['merge']({},_0x1c6265,_0x4bdf4f[_0x0cb8('0x50')]);return db[_0x0cb8('0x5d')]['count']({'where':_0x1c6265[_0x0cb8('0x4b')]})[_0x0cb8('0x1d')](function(_0x16aa53){_0x2b5cde[_0x0cb8('0x2e')]=_0x16aa53;if(_0x4bdf4f['query'][_0x0cb8('0x51')]){_0x1c6265['include']=[{'all':!![]}];}return db[_0x0cb8('0x5d')][_0x0cb8('0x5e')](_0x1c6265);})[_0x0cb8('0x1d')](function(_0x282cf2){_0x2b5cde['rows']=_0x282cf2;return _0x2b5cde;});}})['then'](respondWithFilteredResult(_0x49fe25,_0x1c6265))[_0x0cb8('0x27')](handleError(_0x49fe25,null));};exports[_0x0cb8('0x5f')]=function(_0x1420a6,_0x202a89,_0x5450b9){return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x1420a6['params']['id']}})['then'](handleEntityNotFound(_0x202a89,null))[_0x0cb8('0x1d')](function(_0xd9a731){if(_0xd9a731){return _0xd9a731[_0x0cb8('0x5f')](_0x1420a6['query'][_0x0cb8('0x60')]);}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x202a89,null))[_0x0cb8('0x27')](handleError(_0x202a89,null));};exports[_0x0cb8('0x61')]=function(_0x2bc34e,_0x41f05a,_0x42a177){if(_0x2bc34e['body']['id']){delete _0x2bc34e[_0x0cb8('0x56')]['id'];}return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x2bc34e[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f05a,null))['then'](function(_0x35f44a){if(_0x35f44a){_0x2bc34e[_0x0cb8('0x56')][_0x0cb8('0x62')]=_0x35f44a['id'];return db[_0x0cb8('0x63')][_0x0cb8('0x55')](_0x2bc34e['body']);}})[_0x0cb8('0x1d')](respondWithResult(_0x41f05a,null))[_0x0cb8('0x27')](handleError(_0x41f05a,null));};exports[_0x0cb8('0x64')]=function(_0x28b807,_0x5618e9,_0x358684){var _0x42bf71={'raw':![],'where':{}};var _0x4bb509={};var _0xecff88={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x28b807[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x5618e9,null))[_0x0cb8('0x1d')](function(_0x178849){if(_0x178849){_0x4bb509[_0x0cb8('0x44')]=_['keys'](db['CannedAnswer'][_0x0cb8('0x3f')]);_0x4bb509[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x28b807['query']);_0x4bb509[_0x0cb8('0x43')]=_['intersection'](_0x4bb509[_0x0cb8('0x44')],_0x4bb509['query']);_0x42bf71['attributes']=_[_0x0cb8('0x46')](_0x4bb509[_0x0cb8('0x44')],qs['fields'](_0x28b807[_0x0cb8('0x41')]['fields']));_0x42bf71['attributes']=_0x42bf71[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x42bf71[_0x0cb8('0x45')]:_0x4bb509[_0x0cb8('0x44')];if(!_0x28b807['query'][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x42bf71['limit']=qs[_0x0cb8('0x2d')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x42bf71[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x2b')]);}_0x42bf71[_0x0cb8('0x67')]=qs[_0x0cb8('0x4a')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x42bf71[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x28b807[_0x0cb8('0x41')],_0x4bb509['filters']));_0x42bf71[_0x0cb8('0x4b')][_0x0cb8('0x62')]=_0x178849['id'];if(_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x42bf71['where']=_[_0x0cb8('0x4d')](_0x42bf71['where'],{'$or':_[_0x0cb8('0x3d')](_0x42bf71[_0x0cb8('0x45')],function(_0x5dfdfd){var _0xb8d42f={};_0xb8d42f[_0x5dfdfd]={'$like':'%'+_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4f')]+'%'};return _0xb8d42f;})});}_0x42bf71=_[_0x0cb8('0x4d')]({},_0x42bf71,_0x28b807[_0x0cb8('0x50')]);return db['CannedAnswer'][_0x0cb8('0x2e')]({'where':_0x42bf71['where']})[_0x0cb8('0x1d')](function(_0x43d6fb){_0xecff88[_0x0cb8('0x2e')]=_0x43d6fb;if(_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x51')]){_0x42bf71['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0cb8('0x5e')](_0x42bf71);})[_0x0cb8('0x1d')](function(_0xaa6088){_0xecff88[_0x0cb8('0x68')]=_0xaa6088;return _0xecff88;});}})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x5618e9,_0x42bf71))[_0x0cb8('0x27')](handleError(_0x5618e9,null));};exports[_0x0cb8('0x69')]=function(_0x1ec611,_0x288332,_0x4fcc66){return db['SmsAccount'][_0x0cb8('0x58')]({'where':{'id':_0x1ec611['params']['id']}})['then'](handleEntityNotFound(_0x288332,null))[_0x0cb8('0x1d')](function(_0x21e6ce){if(_0x21e6ce){return _0x21e6ce[_0x0cb8('0x69')](_0x1ec611[_0x0cb8('0x41')]['ids']);}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x288332,null))[_0x0cb8('0x27')](handleError(_0x288332,null));};exports[_0x0cb8('0x6a')]=function(_0x421a0f,_0x5910f4,_0x7e008){var _0x3ad6d7={'channel':_0x0cb8('0x6b')};var _0x501385=[];var _0x45d2d0=[];var _0x324fa9={};return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x421a0f['params']['id']},'include':[{'model':db[_0x0cb8('0x6c')],'as':'Applications'}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x316c39){_0x3ad6d7[_0x0cb8('0x6d')]=_0x316c39;_0x3ad6d7['applications']=_[_0x0cb8('0x6e')](_0x316c39['Applications'],[_0x0cb8('0x6f')],[_0x0cb8('0x70')]);if(_0x3ad6d7['account']['Applications']){delete _0x3ad6d7['account'][_0x0cb8('0x71')];}return db[_0x0cb8('0x72')][_0x0cb8('0x5a')]();})['then'](function(_0x452eec){if(!_0x452eec){throw new db['Sequelize'][(_0x0cb8('0x73'))]('no\x20available\x20attributes');}_0x501385=_[_0x0cb8('0x74')](_['keys'](_0x452eec),[_0x0cb8('0x75'),'updatedAt']);_0x45d2d0=_[_0x0cb8('0x74')](_['keys'](_0x452eec),[_0x0cb8('0x75'),_0x0cb8('0x76'),_0x0cb8('0x77'),_0x0cb8('0x78')]);_0x3ad6d7[_0x0cb8('0x56')]={'mapKey':_0x0cb8('0x79')};if(_0x3ad6d7['account']['type']){switch(_0x3ad6d7['account'][_0x0cb8('0x4e')]){case _0x0cb8('0x7a'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7c')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7d')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7f')];break;case'skebby':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]='+'+_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x80')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x81')];break;case'connectel':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7b')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x24')];break;case _0x0cb8('0x82'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7b')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x56')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f['body'][_0x0cb8('0x83')];break;case _0x0cb8('0x84'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7c')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x85')];_0x3ad6d7[_0x0cb8('0x56')]['messageId']=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x86')];break;case _0x0cb8('0x87'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]='+'+_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x7b')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x81')];_0x3ad6d7['body'][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x7e')];break;case _0x0cb8('0x89'):_0x3ad6d7['body'][_0x0cb8('0x7b')]=_0x421a0f['body'][_0x0cb8('0x8a')];_0x3ad6d7[_0x0cb8('0x56')]['body']=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x8b')]['message'];break;case _0x0cb8('0x8c'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f['body'][_0x0cb8('0x8d')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f['body'][_0x0cb8('0x81')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x8e')];break;case _0x0cb8('0x8f'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f['body'][0x0][_0x0cb8('0x24')]['id'];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][0x0][_0x0cb8('0x24')][_0x0cb8('0x7b')];_0x3ad6d7[_0x0cb8('0x56')]['body']=_0x421a0f['body'][0x0][_0x0cb8('0x24')][_0x0cb8('0x81')];break;case _0x0cb8('0x90'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f['body']['from'];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x24')];_0x3ad6d7['body'][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x91')];break;}}if(_0x3ad6d7[_0x0cb8('0x56')]['id']){delete _0x3ad6d7['body']['id'];}if(_[_0x0cb8('0x92')](_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0x94'));}if(_[_0x0cb8('0x92')](_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')])||_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]===''){throw new db['Sequelize']['ValidationError'](_0x0cb8('0x95'));}if(_[_0x0cb8('0x92')](_0x3ad6d7['body'][_0x0cb8('0x96')])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0x97')+_0x45d2d0);}if(!_[_0x0cb8('0x98')](_0x45d2d0,_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')])){throw new db[(_0x0cb8('0x93'))]['ValidationError'](_0x0cb8('0x99')+_0x45d2d0);}_0x324fa9[_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')]]=_0x3ad6d7['body']['from'];return db[_0x0cb8('0x9a')]['find']({'where':{'id':_0x3ad6d7[_0x0cb8('0x6d')][_0x0cb8('0x78')]},'include':[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0x9b'),'where':_0x324fa9,'limit':0x1,'order':[[_0x0cb8('0x76'),_0x0cb8('0x9c')]]}]});})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x38e993){if(_0x38e993){_0x3ad6d7['list']=_[_0x0cb8('0x9d')](_0x38e993,['Contacts']);if(_0x38e993[_0x0cb8('0x9b')]['length']){return _0x38e993[_0x0cb8('0x9b')][0x0];}var _0x1ae571=_[_0x0cb8('0x9e')](_0x3ad6d7[_0x0cb8('0x56')],{'firstName':_0x3ad6d7[_0x0cb8('0x56')]['from'],'ListId':_0x38e993['id']});_0x1ae571[_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')]]=_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')];return db['CmContact']['create'](_0x1ae571,{'fields':_0x501385,'raw':!![]});}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x324cfc){if(_0x324cfc){_0x3ad6d7['contact']=_0x324cfc;var _0x515cae={'ContactId':_0x324cfc['id'],'phone':_0x3ad6d7[_0x0cb8('0x56')]['from'],'SmsAccountId':_0x421a0f[_0x0cb8('0x53')]['id']};var _0x415c90={'ContactId':_0x324cfc['id'],'SmsAccountId':_0x421a0f[_0x0cb8('0x53')]['id'],'closed':![]};return db[_0x0cb8('0x9f')][_0x0cb8('0x58')]({'where':_0x415c90})[_0x0cb8('0x1d')](function(_0xcbe6aa){if(_0xcbe6aa){return[_0xcbe6aa,![]];}return db[_0x0cb8('0x9f')]['create'](_0x515cae)[_0x0cb8('0x1d')](function(_0x30bb10){return[_0x30bb10,!![]];});});}})['spread'](function(_0x1040e8,_0x464abc){_0x3ad6d7[_0x0cb8('0xa0')]=_0x1040e8['get']({'plain':!![]});_0x3ad6d7['interaction'][_0x0cb8('0xa1')]=![];if(_0x464abc){if(_0x3ad6d7[_0x0cb8('0x6d')][_0x0cb8('0xa2')]){_0x3ad6d7[_0x0cb8('0xa3')][_0x0cb8('0xa4')]({'id':0x0,'priority':_0x3ad6d7['applications'][_0x0cb8('0x66')]+0x1,'app':_0x0cb8('0xa5'),'appdata':_0x0cb8('0xa6'),'interval':'*,*,*,*'});}_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xa1')]=!![];}return db['SmsMessage'][_0x0cb8('0x55')]({'phone':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')],'messageId':_0x3ad6d7['body'][_0x0cb8('0x7e')],'body':_0x3ad6d7['body']['body'],'SmsAccountId':_0x421a0f['params']['id'],'SmsInteractionId':_0x1040e8['id'],'direction':'in','ContactId':_0x1040e8['ContactId'],'AttachmentId':_0x3ad6d7[_0x0cb8('0x56')]['AttachmentId']});})[_0x0cb8('0x1d')](function(_0x2e2dbc){_0x3ad6d7['message']=_0x2e2dbc;if(!_0x3ad6d7[_0x0cb8('0xa0')]['UserId'])return;return db[_0x0cb8('0xa7')][_0x0cb8('0x58')]({'attributes':['id',_0x0cb8('0x38')],'where':{'id':_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xa8')]}});})['then'](function(_0x23b1df){if(_0x23b1df){_0x3ad6d7[_0x0cb8('0xa3')][_0x0cb8('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0cb8('0xaa'),'appdata':_0x23b1df['name']+','+(_0x3ad6d7[_0x0cb8('0x6d')]['waitForTheAssignedAgent']||0xa),'interval':_0x0cb8('0xab')});}if(!_0x3ad6d7['interaction'][_0x0cb8('0xac')])return;return db['SmsQueue']['find']({'attributes':['id',_0x0cb8('0x38')],'where':{'id':_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xac')]}});})[_0x0cb8('0x1d')](function(_0x5315bd){if(_0x5315bd){_0x3ad6d7['applications'][_0x0cb8('0xa9')]({'id':0x0,'priority':0x1,'app':_0x0cb8('0xad'),'appdata':_0x5315bd[_0x0cb8('0x38')]+','+(_0x3ad6d7[_0x0cb8('0x6d')]['waitForTheAssignedQueue']||0x12c),'interval':_0x0cb8('0xab')});}return respondWithRpcPromise(_0x0cb8('0xae'),'startRouting',_0x3ad6d7);})[_0x0cb8('0x1d')](function(_0x4ae144){if(_0x4ae144){var _0x51c508=0xc8;var _0x381e42=_0x0cb8('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x381e42,_0x51c508,_0x0cb8('0xb0'));logger[_0x0cb8('0x1f')](_0x0cb8('0xb1'),_0x381e42,_0x51c508,'entity\x20found',JSON['stringify'](_0x4ae144));if(_0x3ad6d7['account'][_0x0cb8('0x4e')]===_0x0cb8('0x7a')){return _0x5910f4[_0x0cb8('0x28')](_0x51c508)[_0x0cb8('0x2f')](_0x0cb8('0xb2'),'text/xml')[_0x0cb8('0x39')]('\x0a');}else{return _0x5910f4[_0x0cb8('0x28')](_0x51c508)[_0x0cb8('0x2a')](_0x4ae144);}}})[_0x0cb8('0x27')](handleError(_0x5910f4,null));};exports[_0x0cb8('0xb3')]=function(_0x1ea0f2,_0x492275){var _0x10a9ad=_0x1ea0f2[_0x0cb8('0x53')]['id'];var _0x4a3e0f=_0x1ea0f2[_0x0cb8('0x56')];var _0x2ce73f=0xc8;var _0x1f3573=null;return db[_0x0cb8('0xb4')]['transaction']({'isolationLevel':db[_0x0cb8('0xb4')][_0x0cb8('0xb5')][_0x0cb8('0xb6')]['READ_COMMITTED']},function(_0x2de160){return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x10a9ad},'transaction':_0x2de160})[_0x0cb8('0x1d')](function(_0xb90537){if(_0xb90537){return db[_0x0cb8('0x6c')]['destroy']({'where':{'SmsAccountId':_0x10a9ad},'transaction':_0x2de160})[_0x0cb8('0x1d')](function(){var _0x1a00a4=_[_0x0cb8('0x3d')](_0x4a3e0f,function(_0x2cc4bf){_0x2cc4bf[_0x0cb8('0x62')]=_0x10a9ad;return _0x2cc4bf;});return db['SmsApplication'][_0x0cb8('0xb7')](_0x1a00a4,{'transaction':_0x2de160});});}else{_0x2ce73f=0x194;_0x1f3573=[];}});})[_0x0cb8('0x1d')](function(){if(_0x2ce73f!==0x194){return db['SmsApplication'][_0x0cb8('0xb8')]({'where':{'SmsAccountId':_0x10a9ad},'order':'priority'})[_0x0cb8('0x1d')](function(_0x5ced7a){_0x1f3573=_0x5ced7a;});}})[_0x0cb8('0x27')](function(_0x186b2f){_0x2ce73f=0x1f4;logger[_0x0cb8('0x22')](_0x186b2f[_0x0cb8('0x37')]);if(_0x186b2f[_0x0cb8('0x38')]){delete _0x186b2f[_0x0cb8('0x38')];}_0x1f3573=_0x186b2f;})['finally'](function(){if(_0x1f3573===null){_0x492275[_0x0cb8('0xb9')](_0x2ce73f);}else{if(_0x2ce73f===0x1f4){_0x492275[_0x0cb8('0x28')](_0x2ce73f)[_0x0cb8('0x39')](_0x1f3573);}else{_0x492275[_0x0cb8('0x28')](_0x2ce73f)[_0x0cb8('0x2a')](_0x1f3573);}}});};exports[_0x0cb8('0xba')]=function(_0x248af4,_0x429b1f,_0x1c6fcd){var _0x2dfa0f={};var _0xe01fa2={};var _0x3b66ab;var _0x281a29;return db['SmsAccount'][_0x0cb8('0x65')]({'where':{'id':_0x248af4['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x429b1f,null))['then'](function(_0x4be363){if(_0x4be363){_0x3b66ab=_0x4be363;_0xe01fa2[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x6c')][_0x0cb8('0x3f')]);_0xe01fa2[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x248af4[_0x0cb8('0x41')]);_0xe01fa2[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0xe01fa2[_0x0cb8('0x44')],_0xe01fa2[_0x0cb8('0x41')]);_0x2dfa0f[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0xe01fa2[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x248af4[_0x0cb8('0x41')]['fields']));_0x2dfa0f['attributes']=_0x2dfa0f[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x2dfa0f['attributes']:_0xe01fa2['model'];_0x2dfa0f[_0x0cb8('0x67')]=qs['sort'](_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x2dfa0f['where']=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x248af4[_0x0cb8('0x41')],_0xe01fa2[_0x0cb8('0x43')]));if(_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x2dfa0f[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0x2dfa0f[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x2dfa0f[_0x0cb8('0x45')],function(_0x1e1e3b){var _0x14cb59={};_0x14cb59[_0x1e1e3b]={'$like':'%'+_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4f')]+'%'};return _0x14cb59;})});}_0x2dfa0f=_[_0x0cb8('0x4d')]({},_0x2dfa0f,_0x248af4[_0x0cb8('0x50')]);return _0x3b66ab['getApplications'](_0x2dfa0f);}})[_0x0cb8('0x1d')](function(_0x15dc9c){if(_0x15dc9c){_0x281a29=_0x15dc9c[_0x0cb8('0x66')];if(!_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x2dfa0f[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x248af4[_0x0cb8('0x41')]['limit']);_0x2dfa0f[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x248af4['query'][_0x0cb8('0x2b')]);}return _0x3b66ab[_0x0cb8('0xba')](_0x2dfa0f);}})[_0x0cb8('0x1d')](function(_0x57c357){if(_0x57c357){return _0x57c357?{'count':_0x281a29,'rows':_0x57c357}:null;}})[_0x0cb8('0x1d')](respondWithResult(_0x429b1f,null))[_0x0cb8('0x27')](handleError(_0x429b1f,null));};exports[_0x0cb8('0xbb')]=function(_0x545bff,_0x23fef4,_0x1093ef){var _0xcaf9aa={'raw':![],'where':{}};var _0x58767d={};var _0x27dc40={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x545bff[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x23fef4,null))[_0x0cb8('0x1d')](function(_0x54dbe9){if(_0x54dbe9){_0x58767d[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x9f')][_0x0cb8('0x3f')]);_0x58767d[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x545bff[_0x0cb8('0x41')]);_0x58767d[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x58767d[_0x0cb8('0x44')],_0x58767d[_0x0cb8('0x41')]);_0xcaf9aa[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x58767d['model'],qs[_0x0cb8('0x47')](_0x545bff['query'][_0x0cb8('0x47')]));_0xcaf9aa[_0x0cb8('0x45')]=_0xcaf9aa[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0xcaf9aa[_0x0cb8('0x45')]:_0x58767d[_0x0cb8('0x44')];if(!_0x545bff[_0x0cb8('0x41')]['hasOwnProperty'](_0x0cb8('0x49'))){_0xcaf9aa[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x545bff[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0xcaf9aa[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x545bff['query'][_0x0cb8('0x2b')]);}_0xcaf9aa['order']=qs['sort'](_0x545bff['query']['sort']);_0xcaf9aa[_0x0cb8('0x4b')]=qs['filters'](_['pick'](_0x545bff[_0x0cb8('0x41')],_0x58767d[_0x0cb8('0x43')]));_0xcaf9aa[_0x0cb8('0x4b')][_0x0cb8('0x62')]=_0x54dbe9['id'];if(_0x545bff['query'][_0x0cb8('0x4f')]){_0xcaf9aa[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0xcaf9aa[_0x0cb8('0x4b')],{'$or':_['map'](_0xcaf9aa[_0x0cb8('0x45')],function(_0x5e62ae){var _0x3fae9a={};_0x3fae9a[_0x5e62ae]={'$like':'%'+_0x545bff[_0x0cb8('0x41')]['filter']+'%'};return _0x3fae9a;})});}_0xcaf9aa=_[_0x0cb8('0x4d')]({},_0xcaf9aa,_0x545bff['options']);return db[_0x0cb8('0x9f')][_0x0cb8('0x2e')]({'where':_0xcaf9aa[_0x0cb8('0x4b')]})[_0x0cb8('0x1d')](function(_0x2ab2bb){_0x27dc40[_0x0cb8('0x2e')]=_0x2ab2bb;if(_0x545bff[_0x0cb8('0x41')]['includeAll']){_0xcaf9aa[_0x0cb8('0x54')]=[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0xbc'),'required':![]},{'model':db[_0x0cb8('0xa7')],'as':'Owner','attributes':['name',_0x0cb8('0xbd'),_0x0cb8('0xbe')],'required':![]},{'model':db[_0x0cb8('0xbf')],'as':_0x0cb8('0xc0'),'attributes':['id',_0x0cb8('0x38'),'color'],'where':_0x545bff['query'][_0x0cb8('0xc1')]?{'id':_0x545bff['query'][_0x0cb8('0xc1')]}:undefined,'required':_0x545bff[_0x0cb8('0x41')][_0x0cb8('0xc1')]?!![]:![]}];}return db[_0x0cb8('0x9f')]['findAll'](_0xcaf9aa);})[_0x0cb8('0x1d')](function(_0x4e2cf9){_0x27dc40[_0x0cb8('0x68')]=_0x4e2cf9;return _0x27dc40;});}})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x23fef4,_0xcaf9aa))['catch'](handleError(_0x23fef4,null));};exports['send']=function(_0x1f033c,_0xf67877,_0x5855ef){var _0x225227,_0x1273be,_0x37a788;if(_[_0x0cb8('0x92')](_0x1f033c[_0x0cb8('0x56')]['body'])||_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')]===''){throw new db['Sequelize']['ValidationError'](_0x0cb8('0x95'));}if(_[_0x0cb8('0x92')](_0x1f033c['body']['to'])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0xc2'));}_0x225227=_0x1f033c[_0x0cb8('0x56')]['to'];return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x1f033c[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x9a')],'as':_0x0cb8('0xc3'),'include':[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0x9b'),'where':{'mobile':_0x225227},'limit':0x1,'order':[[_0x0cb8('0x76'),_0x0cb8('0x9c')]]}]}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0xf67877,null))['then'](function(_0x5381a4){if(_0x5381a4&&_0x5381a4[_0x0cb8('0xc3')]){_0x1273be=_0x5381a4[_0x0cb8('0x35')]({'plain':!![]});if(_0x1273be[_0x0cb8('0xc3')]&&_0x1273be[_0x0cb8('0xc3')]['Contacts'][_0x0cb8('0x66')]){return _0x1273be[_0x0cb8('0xc3')][_0x0cb8('0x9b')][0x0];}return db['CmContact'][_0x0cb8('0x55')](_['defaults'](_0x1f033c[_0x0cb8('0x56')],{'firstName':_0x225227,'mobile':_0x225227,'phone':_0x225227,'ListId':_0x1273be[_0x0cb8('0x78')]}));}})['then'](handleEntityNotFound(_0xf67877,null))[_0x0cb8('0x1d')](function(_0x23e660){if(_0x23e660){_0x37a788=_0x23e660;return db['SmsInteraction'][_0x0cb8('0x58')]({'where':{'ContactId':_0x37a788['id'],'closed':![],'SmsAccountId':_0x1273be['id']}})[_0x0cb8('0x1d')](function(_0x526125){if(_0x526125){return[_0x526125,![]];}return db[_0x0cb8('0x9f')][_0x0cb8('0x55')]({'UserId':_0x1f033c['user']['id'],'ContactId':_0x37a788['id'],'SmsAccountId':_0x1273be['id'],'phone':_0x225227,'firstMsgDirection':_0x0cb8('0xc4'),'Messages':[_[_0x0cb8('0x4d')](_0x1f033c[_0x0cb8('0x56')],{'read':![],'body':_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')],'phone':_0x225227,'SmsAccountId':_0x1273be['id'],'UserId':_0x1f033c['user']['id'],'ContactId':_0x37a788['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x0cb8('0xc5')}]})['then'](function(_0x5e3f7b){return[_0x5e3f7b,!![]];});});}})['spread'](function(_0x22c85a,_0x16db42){if(_0x16db42){return _0x22c85a;}return db['SmsMessage'][_0x0cb8('0x55')](_['merge'](_0x1f033c[_0x0cb8('0x56')],{'read':![],'body':_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')],'phone':_0x225227,'SmsAccountId':_0x1273be['id'],'SmsInteractionId':_0x22c85a['id'],'UserId':_0x1f033c[_0x0cb8('0xc6')]['id'],'ContactId':_0x37a788['id']}))[_0x0cb8('0x1d')](function(_0x1b122a){_0x22c85a[_0x0cb8('0xc7')][_0x0cb8('0xc5')]=[];_0x22c85a[_0x0cb8('0xc7')][_0x0cb8('0xc5')]['push'](_0x1b122a[_0x0cb8('0xc7')]);return _0x22c85a;});})['then'](respondWithResult(_0xf67877,null))[_0x0cb8('0x27')](handleError(_0xf67877,null));};exports[_0x0cb8('0x28')]=function(_0x39c036,_0x784fea,_0x1c9be0){if(_0x39c036[_0x0cb8('0x56')]['id']){delete _0x39c036[_0x0cb8('0x56')]['id'];}var _0x290854,_0x13ffb8,_0x4df723;return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x39c036['params']['id']}})['then'](handleEntityNotFound(_0x784fea,null))[_0x0cb8('0x1d')](function(_0x1d3c71){if(_0x1d3c71){_0x4df723=_0x1d3c71;logger[_0x0cb8('0x1f')](_0x0cb8('0xc8'),'status',_0x0cb8('0xc9'),_0x1d3c71[_0x0cb8('0x4e')],util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));switch(_0x1d3c71[_0x0cb8('0x4e')]){case'skebby':if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcb')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcb')]}});}break;case _0x0cb8('0xcd'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xce')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcf')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcf')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')]['requestid']}});}break;case _0x0cb8('0x82'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x83')]&&_0x39c036['body'][_0x0cb8('0xd0')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xd0')];return db[_0x0cb8('0xcc')]['find']({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x83')]}});}break;case _0x0cb8('0x87'):var _0x3c409d=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0];if(_0x3c409d[_0x0cb8('0x7e')]&&_0x3c409d[_0x0cb8('0x28')][_0x0cb8('0xd1')]==='DELIVERED'){_0x13ffb8=_0x3c409d[_0x0cb8('0x28')]['groupName'];return db[_0x0cb8('0xcc')]['find']({'where':{'messageId':_0x3c409d[_0x0cb8('0x7e')]}});}break;case'clickatell':if(_0x39c036[_0x0cb8('0x56')]['messageId']&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')]['status'];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036['body'][_0x0cb8('0x7e')]}});}break;case'bandwidth':if(_0x39c036[_0x0cb8('0x56')][0x0][_0x0cb8('0x24')]['id']){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][0x0][_0x0cb8('0x4e')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][0x0]['message']['id']}});}break;case _0x0cb8('0x90'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xd2')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036['body'][_0x0cb8('0xd2')]}});}break;}}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x784fea,null))[_0x0cb8('0x1d')](function(_0x2a15da){if(_0x2a15da){_0x290854=_0x2a15da;switch(_0x4df723[_0x0cb8('0x4e')]){case'skebby':if(_0x13ffb8===_0x0cb8('0xd3')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0xd4'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0xcd'):if(_0x13ffb8==='1'){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0xd4'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x82'):if(!_0x39c036['body'][_0x0cb8('0xd5')]&&_0x13ffb8>=0xc8&&_0x13ffb8<=0xce){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x82'),util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x87'):var _0x552395=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0];if(_0x552395['status']['groupName']===_0x0cb8('0xd3')){return _0x290854['update']({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),'infobip',util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x8c'):if(_0x13ffb8==_0x0cb8('0xd6')||_0x13ffb8==_0x0cb8('0xd7')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x8c'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x8f'):if(_0x13ffb8==_0x0cb8('0xd8')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x8f'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x90'):if(_0x13ffb8===_0x0cb8('0xd9')||_0x13ffb8==='ACCEPTD'){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0x90'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x290854;}})[_0x0cb8('0x1d')](respondWithResult(_0x784fea,null))[_0x0cb8('0x27')](handleError(_0x784fea,null));};exports[_0x0cb8('0xda')]=function(_0x75e3a,_0x42f27d,_0x300563){var _0x5a0445,_0x30bff4,_0x2723e3;return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x75e3a[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x42f27d,null))['then'](function(_0x28d730){if(_0x28d730){_0x2723e3=_0x28d730;logger[_0x0cb8('0x1f')](_0x0cb8('0xc8'),'status',_0x0cb8('0xc9'),_0x28d730[_0x0cb8('0x4e')],util[_0x0cb8('0xca')](_0x75e3a[_0x0cb8('0x41')],{'showHidden':![],'depth':null}));switch(_0x28d730[_0x0cb8('0x4e')]){case'csc':if(_0x75e3a[_0x0cb8('0x41')][_0x0cb8('0xdb')]&&_0x75e3a[_0x0cb8('0x41')]['state']){_0x30bff4=_0x75e3a[_0x0cb8('0x41')][_0x0cb8('0xdc')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x75e3a['query'][_0x0cb8('0xdb')]}});}break;}}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x42f27d,null))[_0x0cb8('0x1d')](function(_0x5a88f5){if(_0x5a88f5){_0x5a0445=_0x5a88f5;switch(_0x2723e3[_0x0cb8('0x4e')]){case _0x0cb8('0x89'):if(_0x30bff4==='2'||_0x30bff4==='6'){return _0x5a0445[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0cb8('0x28'),_0x0cb8('0x89'),util[_0x0cb8('0xca')](_0x75e3a[_0x0cb8('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x5a0445;}})[_0x0cb8('0x1d')](respondWithResult(_0x42f27d,null))[_0x0cb8('0x27')](handleError(_0x42f27d,null));};exports[_0x0cb8('0xdd')]=function(_0x52a945,_0x4fce58,_0x3a45a3){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x52a945['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x4fce58,null))[_0x0cb8('0x1d')](function(_0x25a184){if(_0x25a184){return _0x25a184[_0x0cb8('0xdd')](_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')],_[_0x0cb8('0x9d')](_0x52a945[_0x0cb8('0x56')],[_0x0cb8('0x60'),'id'])||{})[_0x0cb8('0xde')](function(_0x4890f7){for(var _0x46e7c9=0x0;_0x46e7c9<_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')][_0x0cb8('0x66')];_0x46e7c9+=0x1){socket[_0x0cb8('0xdf')]('userSmsAccount:save',{'UserId':Number(_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')][_0x46e7c9]),'SmsAccountId':Number(_0x52a945[_0x0cb8('0x53')]['id'])});}return _0x4890f7;});}})[_0x0cb8('0x1d')](respondWithResult(_0x4fce58,null))[_0x0cb8('0x27')](handleError(_0x4fce58,null));};exports[_0x0cb8('0xe0')]=function(_0x460242,_0x534efb,_0x4dbbc5){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x460242['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x534efb,null))[_0x0cb8('0x1d')](function(_0x9b77af){if(_0x9b77af){return _0x9b77af['removeAgents'](_0x460242['query'][_0x0cb8('0x60')])[_0x0cb8('0x1d')](function(){if(_[_0x0cb8('0xe1')](_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')])){for(var _0x5f4b69=0x0;_0x5f4b69<_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')][_0x0cb8('0x66')];_0x5f4b69+=0x1){socket[_0x0cb8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')][_0x5f4b69]),'SmsAccountId':Number(_0x460242[_0x0cb8('0x53')]['id'])});}}else{socket[_0x0cb8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x460242['query'][_0x0cb8('0x60')]),'SmsAccountId':Number(_0x460242[_0x0cb8('0x53')]['id'])});}});}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x534efb,null))[_0x0cb8('0x27')](handleError(_0x534efb,null));};exports[_0x0cb8('0xe2')]=function(_0x25294f,_0x2f71c2,_0xee10ad){var _0x18e46e={};var _0x1d8cf5={};var _0x5e0adf;var _0x503979;return db['SmsAccount'][_0x0cb8('0x65')]({'where':{'id':_0x25294f[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f71c2,null))['then'](function(_0x3d65f1){if(_0x3d65f1){_0x5e0adf=_0x3d65f1;_0x1d8cf5[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0xa7')][_0x0cb8('0x3f')]);_0x1d8cf5[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x25294f[_0x0cb8('0x41')]);_0x1d8cf5[_0x0cb8('0x43')]=_['intersection'](_0x1d8cf5[_0x0cb8('0x44')],_0x1d8cf5[_0x0cb8('0x41')]);_0x18e46e['attributes']=_['intersection'](_0x1d8cf5[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x47')]));_0x18e46e[_0x0cb8('0x45')]=_0x18e46e[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x18e46e[_0x0cb8('0x45')]:_0x1d8cf5[_0x0cb8('0x44')];_0x18e46e['order']=qs[_0x0cb8('0x4a')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x18e46e[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x25294f[_0x0cb8('0x41')],_0x1d8cf5[_0x0cb8('0x43')]));if(_0x25294f[_0x0cb8('0x41')]['filter']){_0x18e46e[_0x0cb8('0x4b')]=_['merge'](_0x18e46e[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x18e46e[_0x0cb8('0x45')],function(_0x2d3e6b){var _0x4e1f66={};_0x4e1f66[_0x2d3e6b]={'$like':'%'+_0x25294f[_0x0cb8('0x41')]['filter']+'%'};return _0x4e1f66;})});}_0x18e46e=_[_0x0cb8('0x4d')]({},_0x18e46e,_0x25294f[_0x0cb8('0x50')]);return _0x5e0adf[_0x0cb8('0xe2')](_0x18e46e);}})[_0x0cb8('0x1d')](function(_0x3ac1e0){if(_0x3ac1e0){_0x503979=_0x3ac1e0[_0x0cb8('0x66')];if(!_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x18e46e[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x18e46e[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x25294f['query'][_0x0cb8('0x2b')]);}return _0x5e0adf[_0x0cb8('0xe2')](_0x18e46e);}})['then'](function(_0x1e5083){if(_0x1e5083){return _0x1e5083?{'count':_0x503979,'rows':_0x1e5083}:null;}})[_0x0cb8('0x1d')](respondWithResult(_0x2f71c2,null))['catch'](handleError(_0x2f71c2,null));}; \ No newline at end of file +var _0x1cae=['originatingAddress','segmentedMessage','fromNumber','bandwidth','refid','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','Contacts','updatedAt','DESC','list','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','applications','push','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','pick','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','statusInt','requestid','status_code','infobip','groupName','DELIVERED','intelepeer','redif','inspect','error_code','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','SmsAccountId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','priority','asc','CmContact','Sequelize','ValidationError','createdAt','difference','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','text','clicksend','message_id','plivo','Text','MessageUUID','results'];(function(_0x5e08be,_0x9bf344){var _0x4db79e=function(_0x3b8cc3){while(--_0x3b8cc3){_0x5e08be['push'](_0x5e08be['shift']());}};_0x4db79e(++_0x9bf344);}(_0x1cae,0x142));var _0xe1ca=function(_0x2e4b26,_0x3dc997){_0x2e4b26=_0x2e4b26-0x0;var _0x51bd1f=_0x1cae[_0x2e4b26];return _0x51bd1f;};'use strict';var emlformat=require(_0xe1ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1ca('0x1'));var jsonpatch=require(_0xe1ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe1ca('0x3'));var Mustache=require(_0xe1ca('0x4'));var util=require(_0xe1ca('0x5'));var path=require(_0xe1ca('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe1ca('0x7'));var fs=require('fs');var fs_extra=require(_0xe1ca('0x8'));var _=require(_0xe1ca('0x9'));var squel=require(_0xe1ca('0xa'));var crypto=require('crypto');var jsforce=require(_0xe1ca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe1ca('0xc'));var querystring=require(_0xe1ca('0xd'));var Papa=require(_0xe1ca('0xe'));var Redis=require(_0xe1ca('0xf'));var authService=require(_0xe1ca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe1ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1ca('0x12'))(_0xe1ca('0x13'));var utils=require(_0xe1ca('0x14'));var config=require(_0xe1ca('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe1ca('0x16')]=_['defaults'](config[_0xe1ca('0x16')],{'host':_0xe1ca('0x17'),'port':0x18eb});var socket=require(_0xe1ca('0x18'))(new Redis(config[_0xe1ca('0x16')]));require(_0xe1ca('0x19'))['register'](socket);var jayson=require(_0xe1ca('0x1a'));var client=jayson[_0xe1ca('0x1b')][_0xe1ca('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x3f2a63,_0x2ff1f8,_0x538fc0,_0x3fd481){return new BPromise(function(_0x40505b,_0x35987a){var _0x5da8b6=_0x3fd481||client;return _0x5da8b6[_0xe1ca('0x1d')](_0x3f2a63,_0x538fc0)['then'](function(_0x237ae6){logger[_0xe1ca('0x1e')](_0xe1ca('0x1f'),_0x2ff1f8,_0xe1ca('0x20'));logger[_0xe1ca('0x21')](_0xe1ca('0x22'),_0x2ff1f8,'request\x20sent',JSON[_0xe1ca('0x23')](_0x237ae6));if(_0x237ae6[_0xe1ca('0x24')]){if(_0x237ae6[_0xe1ca('0x24')][_0xe1ca('0x25')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2ff1f8,_0x237ae6[_0xe1ca('0x24')][_0xe1ca('0x26')]);return _0x35987a(_0x237ae6[_0xe1ca('0x24')]['message']);}logger[_0xe1ca('0x24')](_0xe1ca('0x1f'),_0x2ff1f8,_0x237ae6[_0xe1ca('0x24')]['message']);return _0x40505b(_0x237ae6[_0xe1ca('0x24')][_0xe1ca('0x26')]);}else{logger[_0xe1ca('0x1e')](_0xe1ca('0x1f'),_0x2ff1f8,_0xe1ca('0x20'));_0x40505b(_0x237ae6[_0xe1ca('0x27')]['message']);}})[_0xe1ca('0x28')](function(_0x118951){logger['error'](_0xe1ca('0x1f'),_0x2ff1f8,_0x118951);_0x35987a(_0x118951);});});}function respondWithStatusCode(_0x32c43d,_0x561cc9){_0x561cc9=_0x561cc9||0xcc;return function(_0x16ed93){if(_0x16ed93){return _0x32c43d[_0xe1ca('0x29')](_0x561cc9);}return _0x32c43d[_0xe1ca('0x2a')](_0x561cc9)[_0xe1ca('0x2b')]();};}function respondWithResult(_0x2b97f4,_0x2ad795){_0x2ad795=_0x2ad795||0xc8;return function(_0x52a81e){if(_0x52a81e){return _0x2b97f4[_0xe1ca('0x2a')](_0x2ad795)[_0xe1ca('0x2c')](_0x52a81e);}};}function respondWithFilteredResult(_0x17c487,_0x5486de){return function(_0x2e6d3e){if(_0x2e6d3e){var _0x2bf173=typeof _0x5486de[_0xe1ca('0x2d')]===_0xe1ca('0x2e')&&typeof _0x5486de['limit']===_0xe1ca('0x2e');var _0x17aa2b=_0x2e6d3e[_0xe1ca('0x2f')];var _0x5ccb70=_0x2bf173?0x0:_0x5486de[_0xe1ca('0x2d')];var _0x585084=_0x2bf173?_0x2e6d3e[_0xe1ca('0x2f')]:_0x5486de[_0xe1ca('0x2d')]+_0x5486de[_0xe1ca('0x30')];var _0x202835;if(_0x585084>=_0x17aa2b){_0x585084=_0x17aa2b;_0x202835=0xc8;}else{_0x202835=0xce;}_0x17c487[_0xe1ca('0x2a')](_0x202835);return _0x17c487[_0xe1ca('0x31')]('Content-Range',_0x5ccb70+'-'+_0x585084+'/'+_0x17aa2b)[_0xe1ca('0x2c')](_0x2e6d3e);}return null;};}function patchUpdates(_0xcde467){return function(_0x30895b){try{jsonpatch[_0xe1ca('0x32')](_0x30895b,_0xcde467,!![]);}catch(_0x1bc0e5){return BPromise[_0xe1ca('0x33')](_0x1bc0e5);}return _0x30895b[_0xe1ca('0x34')]();};}function saveUpdates(_0x5aeb62,_0x1770c4){return function(_0x23e383){if(_0x23e383){return _0x23e383[_0xe1ca('0x35')](_0x5aeb62)[_0xe1ca('0x36')](function(_0x1f72e8){return _0x1f72e8;});}return null;};}function removeEntity(_0x118810,_0x375f6d){return function(_0x2176b1){if(_0x2176b1){return _0x2176b1[_0xe1ca('0x37')]()['then'](function(){var _0x28c8de=_0x2176b1[_0xe1ca('0x38')]({'plain':!![]});var _0x51bf30=_0xe1ca('0x39');return db[_0xe1ca('0x3a')][_0xe1ca('0x37')]({'where':{'type':_0x51bf30,'resourceId':_0x28c8de['id']}})['then'](function(){return _0x2176b1;});})[_0xe1ca('0x36')](function(){_0x118810['status'](0xcc)[_0xe1ca('0x2b')]();});}};}function handleEntityNotFound(_0x35b828,_0x31ff7d){return function(_0x2548a7){if(!_0x2548a7){_0x35b828[_0xe1ca('0x29')](0x194);}return _0x2548a7;};}function handleError(_0x437556,_0x2bd7cf){_0x2bd7cf=_0x2bd7cf||0x1f4;return function(_0x4b7e26){logger[_0xe1ca('0x24')](_0x4b7e26[_0xe1ca('0x3b')]);if(_0x4b7e26[_0xe1ca('0x3c')]){delete _0x4b7e26[_0xe1ca('0x3c')];}_0x437556[_0xe1ca('0x2a')](_0x2bd7cf)['send'](_0x4b7e26);};}exports[_0xe1ca('0x3d')]=function(_0x166713,_0x9d147a){var _0x3e8795={'include':[{'model':db[_0xe1ca('0x3e')],'as':_0xe1ca('0x3f')}]},_0x46f320={},_0x8a7180={'count':0x0,'rows':[]};var _0x24f6dd=_['map'](db[_0xe1ca('0x40')][_0xe1ca('0x41')],function(_0x484984){return{'name':_0x484984[_0xe1ca('0x42')],'type':_0x484984[_0xe1ca('0x43')]['key']};});_0x46f320['model']=_[_0xe1ca('0x44')](_0x24f6dd,_0xe1ca('0x3c'));_0x46f320[_0xe1ca('0x45')]=_[_0xe1ca('0x46')](_0x166713[_0xe1ca('0x45')]);_0x46f320[_0xe1ca('0x47')]=_[_0xe1ca('0x48')](_0x46f320[_0xe1ca('0x49')],_0x46f320['query']);_0x3e8795[_0xe1ca('0x4a')]=_['intersection'](_0x46f320[_0xe1ca('0x49')],qs[_0xe1ca('0x4b')](_0x166713['query'][_0xe1ca('0x4b')]));_0x3e8795[_0xe1ca('0x4a')]=_0x3e8795[_0xe1ca('0x4a')][_0xe1ca('0x4c')]?_0x3e8795[_0xe1ca('0x4a')]:_0x46f320[_0xe1ca('0x49')];if(!_0x166713[_0xe1ca('0x45')][_0xe1ca('0x4d')]('nolimit')){_0x3e8795['limit']=qs['limit'](_0x166713[_0xe1ca('0x45')][_0xe1ca('0x30')]);_0x3e8795[_0xe1ca('0x2d')]=qs[_0xe1ca('0x2d')](_0x166713[_0xe1ca('0x45')][_0xe1ca('0x2d')]);}_0x3e8795[_0xe1ca('0x4e')]=qs[_0xe1ca('0x4f')](_0x166713[_0xe1ca('0x45')][_0xe1ca('0x4f')]);_0x3e8795['where']=qs[_0xe1ca('0x47')](_['pick'](_0x166713[_0xe1ca('0x45')],_0x46f320[_0xe1ca('0x47')]),_0x24f6dd);if(_0x166713[_0xe1ca('0x45')]['filter']){_0x3e8795['where']=_['merge'](_0x3e8795[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0x24f6dd,function(_0x5cc8b9){if(_0x5cc8b9['type']!=='VIRTUAL'){var _0x5ed23d={};_0x5ed23d[_0x5cc8b9[_0xe1ca('0x3c')]]={'$like':'%'+_0x166713['query'][_0xe1ca('0x51')]+'%'};return _0x5ed23d;}})});}_0x3e8795=_[_0xe1ca('0x52')]({},_0x3e8795,_0x166713[_0xe1ca('0x53')]);var _0x121e49={'where':_0x3e8795['where']};return db[_0xe1ca('0x40')]['count'](_0x121e49)[_0xe1ca('0x36')](function(_0x820eaf){_0x8a7180['count']=_0x820eaf;if(_0x166713[_0xe1ca('0x45')][_0xe1ca('0x54')]){_0x3e8795[_0xe1ca('0x55')]=[{'all':!![]}];}return db[_0xe1ca('0x40')][_0xe1ca('0x56')](_0x3e8795);})[_0xe1ca('0x36')](function(_0x55047a){_0x8a7180['rows']=_0x55047a;return _0x8a7180;})[_0xe1ca('0x36')](respondWithFilteredResult(_0x9d147a,_0x3e8795))['catch'](handleError(_0x9d147a,null));};exports[_0xe1ca('0x57')]=function(_0x542b95,_0x573765){var _0x430b7f={'raw':![],'where':{'id':_0x542b95[_0xe1ca('0x58')]['id']},'include':[{'model':db[_0xe1ca('0x3e')],'as':_0xe1ca('0x3f')}]},_0x336d80={};_0x336d80[_0xe1ca('0x49')]=_[_0xe1ca('0x46')](db[_0xe1ca('0x40')]['rawAttributes']);_0x336d80[_0xe1ca('0x45')]=_['keys'](_0x542b95['query']);_0x336d80[_0xe1ca('0x47')]=_[_0xe1ca('0x48')](_0x336d80[_0xe1ca('0x49')],_0x336d80[_0xe1ca('0x45')]);_0x430b7f[_0xe1ca('0x4a')]=_[_0xe1ca('0x48')](_0x336d80[_0xe1ca('0x49')],qs[_0xe1ca('0x4b')](_0x542b95[_0xe1ca('0x45')][_0xe1ca('0x4b')]));_0x430b7f[_0xe1ca('0x4a')]=_0x430b7f[_0xe1ca('0x4a')][_0xe1ca('0x4c')]?_0x430b7f['attributes']:_0x336d80[_0xe1ca('0x49')];if(_0x542b95[_0xe1ca('0x45')][_0xe1ca('0x54')]){_0x430b7f[_0xe1ca('0x55')]=[{'all':!![]}];}_0x430b7f=_[_0xe1ca('0x52')]({},_0x430b7f,_0x542b95['options']);return db['SmsAccount'][_0xe1ca('0x59')](_0x430b7f)[_0xe1ca('0x36')](handleEntityNotFound(_0x573765,null))[_0xe1ca('0x36')](respondWithResult(_0x573765,null))[_0xe1ca('0x28')](handleError(_0x573765,null));};exports[_0xe1ca('0x5a')]=function(_0x19554e,_0x2f5d43){return db[_0xe1ca('0x40')][_0xe1ca('0x5a')](_0x19554e[_0xe1ca('0x5b')],{})[_0xe1ca('0x36')](function(_0x1e2f2e){var _0xc1ffdc=_0x19554e[_0xe1ca('0x5c')][_0xe1ca('0x38')]({'plain':!![]});if(!_0xc1ffdc)throw new Error(_0xe1ca('0x5d'));if(_0xc1ffdc[_0xe1ca('0x5e')]==='user'){var _0x296844=_0x1e2f2e[_0xe1ca('0x38')]({'plain':!![]});var _0x253ea9=_0xe1ca('0x39');return db['UserProfileSection'][_0xe1ca('0x59')]({'where':{'name':_0x253ea9,'userProfileId':_0xc1ffdc['userProfileId']},'raw':!![]})['then'](function(_0x330430){if(_0x330430&&_0x330430[_0xe1ca('0x5f')]===0x0){return db[_0xe1ca('0x3a')][_0xe1ca('0x5a')]({'name':_0x296844[_0xe1ca('0x3c')],'resourceId':_0x296844['id'],'type':_0x330430[_0xe1ca('0x3c')],'sectionId':_0x330430['id']},{})[_0xe1ca('0x36')](function(){return _0x1e2f2e;});}else{return _0x1e2f2e;}})['catch'](function(_0x1225c7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1225c7);throw _0x1225c7;});}return _0x1e2f2e;})[_0xe1ca('0x36')](respondWithResult(_0x2f5d43,0xc9))[_0xe1ca('0x28')](handleError(_0x2f5d43,null));};exports[_0xe1ca('0x35')]=function(_0x2818a9,_0x453b25){if(_0x2818a9[_0xe1ca('0x5b')]['id']){delete _0x2818a9[_0xe1ca('0x5b')]['id'];}return db[_0xe1ca('0x40')]['find']({'where':{'id':_0x2818a9[_0xe1ca('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe1ca('0x36')](handleEntityNotFound(_0x453b25,null))['then'](saveUpdates(_0x2818a9[_0xe1ca('0x5b')],null))[_0xe1ca('0x36')](respondWithResult(_0x453b25,null))[_0xe1ca('0x28')](handleError(_0x453b25,null));};exports[_0xe1ca('0x37')]=function(_0x11c960,_0x7aee67){return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x11c960[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x7aee67,null))['then'](removeEntity(_0x7aee67,null))[_0xe1ca('0x28')](handleError(_0x7aee67,null));};exports['describe']=function(_0x425555,_0x46fc3b){return db['SmsAccount'][_0xe1ca('0x60')]()[_0xe1ca('0x36')](respondWithResult(_0x46fc3b,null))[_0xe1ca('0x28')](handleError(_0x46fc3b,null));};exports[_0xe1ca('0x61')]=function(_0x33784a,_0x50bff3,_0x560128){if(_0x33784a[_0xe1ca('0x5b')]['id']){delete _0x33784a['body']['id'];}return db['SmsAccount'][_0xe1ca('0x59')]({'where':{'id':_0x33784a[_0xe1ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x50bff3,null))[_0xe1ca('0x36')](function(_0x7e3cef){if(_0x7e3cef){_0x33784a[_0xe1ca('0x5b')]['SmsAccountId']=_0x7e3cef['id'];return db['Disposition'][_0xe1ca('0x5a')](_0x33784a[_0xe1ca('0x5b')]);}})['then'](respondWithResult(_0x50bff3,null))[_0xe1ca('0x28')](handleError(_0x50bff3,null));};exports[_0xe1ca('0x62')]=function(_0x2fd199,_0x4ac491,_0x152ded){var _0xc4f898={'raw':![],'where':{}};var _0x1afc2d={};var _0x111a39={'count':0x0,'rows':[]};return db[_0xe1ca('0x40')][_0xe1ca('0x63')]({'where':{'id':_0x2fd199[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x4ac491,null))[_0xe1ca('0x36')](function(_0x6d053a){if(_0x6d053a){_0x1afc2d['model']=_['keys'](db[_0xe1ca('0x64')][_0xe1ca('0x41')]);_0x1afc2d['query']=_['keys'](_0x2fd199[_0xe1ca('0x45')]);_0x1afc2d['filters']=_[_0xe1ca('0x48')](_0x1afc2d['model'],_0x1afc2d[_0xe1ca('0x45')]);_0xc4f898['attributes']=_[_0xe1ca('0x48')](_0x1afc2d[_0xe1ca('0x49')],qs[_0xe1ca('0x4b')](_0x2fd199[_0xe1ca('0x45')]['fields']));_0xc4f898['attributes']=_0xc4f898[_0xe1ca('0x4a')][_0xe1ca('0x4c')]?_0xc4f898['attributes']:_0x1afc2d[_0xe1ca('0x49')];if(!_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x4d')](_0xe1ca('0x65'))){_0xc4f898[_0xe1ca('0x30')]=qs[_0xe1ca('0x30')](_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x30')]);_0xc4f898[_0xe1ca('0x2d')]=qs[_0xe1ca('0x2d')](_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x2d')]);}_0xc4f898[_0xe1ca('0x4e')]=qs[_0xe1ca('0x4f')](_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x4f')]);_0xc4f898[_0xe1ca('0x50')]=qs[_0xe1ca('0x47')](_['pick'](_0x2fd199[_0xe1ca('0x45')],_0x1afc2d[_0xe1ca('0x47')]));_0xc4f898[_0xe1ca('0x50')][_0xe1ca('0x66')]=_0x6d053a['id'];if(_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x51')]){_0xc4f898[_0xe1ca('0x50')]=_[_0xe1ca('0x52')](_0xc4f898[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0xc4f898[_0xe1ca('0x4a')],function(_0x3ffd1a){var _0x33db7f={};_0x33db7f[_0x3ffd1a]={'$like':'%'+_0x2fd199[_0xe1ca('0x45')][_0xe1ca('0x51')]+'%'};return _0x33db7f;})});}_0xc4f898=_[_0xe1ca('0x52')]({},_0xc4f898,_0x2fd199[_0xe1ca('0x53')]);return db[_0xe1ca('0x64')][_0xe1ca('0x2f')]({'where':_0xc4f898[_0xe1ca('0x50')]})['then'](function(_0x52b0e1){_0x111a39[_0xe1ca('0x2f')]=_0x52b0e1;if(_0x2fd199['query'][_0xe1ca('0x54')]){_0xc4f898[_0xe1ca('0x55')]=[{'all':!![]}];}return db[_0xe1ca('0x64')][_0xe1ca('0x56')](_0xc4f898);})[_0xe1ca('0x36')](function(_0x42dbb4){_0x111a39[_0xe1ca('0x67')]=_0x42dbb4;return _0x111a39;});}})['then'](respondWithFilteredResult(_0x4ac491,_0xc4f898))[_0xe1ca('0x28')](handleError(_0x4ac491,null));};exports[_0xe1ca('0x68')]=function(_0x131e67,_0xaa6679,_0x223e92){return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x131e67[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0xaa6679,null))[_0xe1ca('0x36')](function(_0x4a78c0){if(_0x4a78c0){return _0x4a78c0['removeDispositions'](_0x131e67[_0xe1ca('0x45')][_0xe1ca('0x69')]);}})[_0xe1ca('0x36')](respondWithStatusCode(_0xaa6679,null))[_0xe1ca('0x28')](handleError(_0xaa6679,null));};exports[_0xe1ca('0x6a')]=function(_0x1358f1,_0x4a090d,_0x114d9b){if(_0x1358f1[_0xe1ca('0x5b')]['id']){delete _0x1358f1[_0xe1ca('0x5b')]['id'];}return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x1358f1[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x4a090d,null))['then'](function(_0x2a3200){if(_0x2a3200){_0x1358f1[_0xe1ca('0x5b')][_0xe1ca('0x66')]=_0x2a3200['id'];return db['CannedAnswer'][_0xe1ca('0x5a')](_0x1358f1[_0xe1ca('0x5b')]);}})['then'](respondWithResult(_0x4a090d,null))[_0xe1ca('0x28')](handleError(_0x4a090d,null));};exports[_0xe1ca('0x6b')]=function(_0x4dfd09,_0xcca3,_0x3cbf70){var _0x2e305d={'raw':![],'where':{}};var _0xf55a21={};var _0x22e4a0={'count':0x0,'rows':[]};return db[_0xe1ca('0x40')]['findOne']({'where':{'id':_0x4dfd09[_0xe1ca('0x58')]['id']}})['then'](handleEntityNotFound(_0xcca3,null))[_0xe1ca('0x36')](function(_0x57a207){if(_0x57a207){_0xf55a21[_0xe1ca('0x49')]=_[_0xe1ca('0x46')](db['CannedAnswer']['rawAttributes']);_0xf55a21['query']=_[_0xe1ca('0x46')](_0x4dfd09[_0xe1ca('0x45')]);_0xf55a21['filters']=_[_0xe1ca('0x48')](_0xf55a21[_0xe1ca('0x49')],_0xf55a21[_0xe1ca('0x45')]);_0x2e305d[_0xe1ca('0x4a')]=_[_0xe1ca('0x48')](_0xf55a21[_0xe1ca('0x49')],qs[_0xe1ca('0x4b')](_0x4dfd09[_0xe1ca('0x45')][_0xe1ca('0x4b')]));_0x2e305d[_0xe1ca('0x4a')]=_0x2e305d['attributes']['length']?_0x2e305d[_0xe1ca('0x4a')]:_0xf55a21['model'];if(!_0x4dfd09['query'][_0xe1ca('0x4d')](_0xe1ca('0x65'))){_0x2e305d[_0xe1ca('0x30')]=qs[_0xe1ca('0x30')](_0x4dfd09[_0xe1ca('0x45')][_0xe1ca('0x30')]);_0x2e305d['offset']=qs[_0xe1ca('0x2d')](_0x4dfd09['query'][_0xe1ca('0x2d')]);}_0x2e305d['order']=qs[_0xe1ca('0x4f')](_0x4dfd09[_0xe1ca('0x45')]['sort']);_0x2e305d[_0xe1ca('0x50')]=qs[_0xe1ca('0x47')](_['pick'](_0x4dfd09['query'],_0xf55a21[_0xe1ca('0x47')]));_0x2e305d[_0xe1ca('0x50')][_0xe1ca('0x66')]=_0x57a207['id'];if(_0x4dfd09[_0xe1ca('0x45')][_0xe1ca('0x51')]){_0x2e305d[_0xe1ca('0x50')]=_[_0xe1ca('0x52')](_0x2e305d[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0x2e305d[_0xe1ca('0x4a')],function(_0x27f254){var _0x2892a2={};_0x2892a2[_0x27f254]={'$like':'%'+_0x4dfd09['query'][_0xe1ca('0x51')]+'%'};return _0x2892a2;})});}_0x2e305d=_['merge']({},_0x2e305d,_0x4dfd09[_0xe1ca('0x53')]);return db[_0xe1ca('0x6c')][_0xe1ca('0x2f')]({'where':_0x2e305d['where']})[_0xe1ca('0x36')](function(_0x2cce6d){_0x22e4a0[_0xe1ca('0x2f')]=_0x2cce6d;if(_0x4dfd09['query'][_0xe1ca('0x54')]){_0x2e305d[_0xe1ca('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe1ca('0x56')](_0x2e305d);})[_0xe1ca('0x36')](function(_0xb2e3e1){_0x22e4a0[_0xe1ca('0x67')]=_0xb2e3e1;return _0x22e4a0;});}})[_0xe1ca('0x36')](respondWithFilteredResult(_0xcca3,_0x2e305d))[_0xe1ca('0x28')](handleError(_0xcca3,null));};exports[_0xe1ca('0x6d')]=function(_0x40ca0b,_0x5c32c9,_0x2c9c2d){return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x40ca0b['params']['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x5c32c9,null))[_0xe1ca('0x36')](function(_0x352d47){if(_0x352d47){return _0x352d47[_0xe1ca('0x6d')](_0x40ca0b[_0xe1ca('0x45')]['ids']);}})[_0xe1ca('0x36')](respondWithStatusCode(_0x5c32c9,null))['catch'](handleError(_0x5c32c9,null));};exports[_0xe1ca('0x6e')]=function(_0x2f088a,_0x218e93,_0x2c5f56){var _0x4bc367={'channel':_0xe1ca('0x6f')};var _0x4cbd90=[];var _0x406c19=[];var _0x5ddabf={};return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x2f088a[_0xe1ca('0x58')]['id']},'include':[{'model':db[_0xe1ca('0x70')],'as':_0xe1ca('0x71')}]})[_0xe1ca('0x36')](handleEntityNotFound(_0x218e93,null))['then'](function(_0x17f05b){_0x4bc367[_0xe1ca('0x72')]=_0x17f05b;_0x4bc367['applications']=_['orderBy'](_0x17f05b['Applications'],[_0xe1ca('0x73')],[_0xe1ca('0x74')]);if(_0x4bc367[_0xe1ca('0x72')]['Applications']){delete _0x4bc367[_0xe1ca('0x72')][_0xe1ca('0x71')];}return db[_0xe1ca('0x75')][_0xe1ca('0x60')]();})[_0xe1ca('0x36')](function(_0x9e9fea){if(!_0x9e9fea){throw new db[(_0xe1ca('0x76'))][(_0xe1ca('0x77'))]('no\x20available\x20attributes');}_0x4cbd90=_['difference'](_[_0xe1ca('0x46')](_0x9e9fea),[_0xe1ca('0x78'),'updatedAt']);_0x406c19=_[_0xe1ca('0x79')](_[_0xe1ca('0x46')](_0x9e9fea),[_0xe1ca('0x78'),'updatedAt',_0xe1ca('0x7a'),_0xe1ca('0x7b')]);_0x4bc367[_0xe1ca('0x5b')]={'mapKey':_0xe1ca('0x7c')};if(_0x4bc367[_0xe1ca('0x72')][_0xe1ca('0x43')]){switch(_0x4bc367[_0xe1ca('0x72')][_0xe1ca('0x43')]){case _0xe1ca('0x7d'):_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a['body'][_0xe1ca('0x7f')];_0x4bc367['body'][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')]['Body'];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x80')]=_0x2f088a['body'][_0xe1ca('0x81')];break;case _0xe1ca('0x82'):_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]='+'+_0x2f088a[_0xe1ca('0x5b')]['sender'];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x83')];break;case'connectel':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x7e')];_0x4bc367['body'][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')]['message'];break;case _0xe1ca('0x84'):_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a['body'][_0xe1ca('0x7e')];_0x4bc367[_0xe1ca('0x5b')]['body']=_0x2f088a['body'][_0xe1ca('0x5b')];_0x4bc367['body']['messageId']=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x85')];break;case _0xe1ca('0x86'):_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a['body'][_0xe1ca('0x7f')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x87')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x80')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x88')];break;case'infobip':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]='+'+_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x89')][0x0][_0xe1ca('0x7e')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a['body']['results'][0x0]['text'];_0x4bc367['body']['messageId']=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x89')][0x0]['messageId'];break;case'csc':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x8a')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a['body'][_0xe1ca('0x8b')][_0xe1ca('0x26')];break;case'clickatell':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x8c')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x83')];_0x4bc367[_0xe1ca('0x5b')]['messageId']=_0x2f088a[_0xe1ca('0x5b')]['replyMessageId'];break;case _0xe1ca('0x8d'):_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x80')]=_0x2f088a['body'][0x0]['message']['id'];_0x4bc367['body'][_0xe1ca('0x7e')]=_0x2f088a[_0xe1ca('0x5b')][0x0]['message'][_0xe1ca('0x7e')];_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]=_0x2f088a[_0xe1ca('0x5b')][0x0]['message'][_0xe1ca('0x83')];break;case'intelepeer':_0x4bc367[_0xe1ca('0x5b')]['from']=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x7e')];_0x4bc367['body'][_0xe1ca('0x5b')]=_0x2f088a['body'][_0xe1ca('0x26')];_0x4bc367['body']['messageId']=_0x2f088a[_0xe1ca('0x5b')][_0xe1ca('0x8e')];break;}}if(_0x4bc367[_0xe1ca('0x5b')]['id']){delete _0x4bc367[_0xe1ca('0x5b')]['id'];}if(_['isNil'](_0x4bc367[_0xe1ca('0x5b')]['from'])){throw new db[(_0xe1ca('0x76'))][(_0xe1ca('0x77'))](_0xe1ca('0x8f'));}if(_[_0xe1ca('0x90')](_0x4bc367[_0xe1ca('0x5b')]['body'])||_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')]===''){throw new db[(_0xe1ca('0x76'))]['ValidationError'](_0xe1ca('0x91'));}if(_[_0xe1ca('0x90')](_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x92')])){throw new db[(_0xe1ca('0x76'))][(_0xe1ca('0x77'))](_0xe1ca('0x93')+_0x406c19);}if(!_['includes'](_0x406c19,_0x4bc367[_0xe1ca('0x5b')]['mapKey'])){throw new db[(_0xe1ca('0x76'))][(_0xe1ca('0x77'))](_0xe1ca('0x94')+_0x406c19);}_0x5ddabf[_0x4bc367['body'][_0xe1ca('0x92')]]=_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')];return db['CmList'][_0xe1ca('0x59')]({'where':{'id':_0x4bc367[_0xe1ca('0x72')]['ListId']},'include':[{'model':db[_0xe1ca('0x75')],'as':_0xe1ca('0x95'),'where':_0x5ddabf,'limit':0x1,'order':[[_0xe1ca('0x96'),_0xe1ca('0x97')]]}]});})[_0xe1ca('0x36')](handleEntityNotFound(_0x218e93,null))[_0xe1ca('0x36')](function(_0x1aac9a){if(_0x1aac9a){_0x4bc367[_0xe1ca('0x98')]=_[_0xe1ca('0x99')](_0x1aac9a,['Contacts']);if(_0x1aac9a[_0xe1ca('0x95')]['length']){return _0x1aac9a[_0xe1ca('0x95')][0x0];}var _0x1206bd=_[_0xe1ca('0x9a')](_0x4bc367[_0xe1ca('0x5b')],{'firstName':_0x4bc367['body']['from'],'ListId':_0x1aac9a['id']});_0x1206bd[_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x92')]]=_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')];return db[_0xe1ca('0x75')]['create'](_0x1206bd,{'fields':_0x4cbd90,'raw':!![]});}})['then'](handleEntityNotFound(_0x218e93,null))[_0xe1ca('0x36')](function(_0x32fc16){if(_0x32fc16){_0x4bc367[_0xe1ca('0x9b')]=_0x32fc16;var _0x333530={'ContactId':_0x32fc16['id'],'phone':_0x4bc367['body']['from'],'SmsAccountId':_0x2f088a[_0xe1ca('0x58')]['id']};var _0x1fa2ab={'ContactId':_0x32fc16['id'],'SmsAccountId':_0x2f088a[_0xe1ca('0x58')]['id'],'closed':![]};return db[_0xe1ca('0x9c')]['find']({'where':_0x1fa2ab})[_0xe1ca('0x36')](function(_0x19ea7e){if(_0x19ea7e){return[_0x19ea7e,![]];}return db[_0xe1ca('0x9c')][_0xe1ca('0x5a')](_0x333530)[_0xe1ca('0x36')](function(_0x59dafd){return[_0x59dafd,!![]];});});}})['spread'](function(_0x1b4434,_0x500586){_0x4bc367[_0xe1ca('0x9d')]=_0x1b4434['get']({'plain':!![]});_0x4bc367[_0xe1ca('0x9d')][_0xe1ca('0x9e')]=![];if(_0x500586){if(_0x4bc367['account'][_0xe1ca('0x9f')]){_0x4bc367[_0xe1ca('0xa0')][_0xe1ca('0xa1')]({'id':0x0,'priority':_0x4bc367[_0xe1ca('0xa0')][_0xe1ca('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe1ca('0xa2')});}_0x4bc367[_0xe1ca('0x9d')][_0xe1ca('0x9e')]=!![];}return db[_0xe1ca('0xa3')][_0xe1ca('0x5a')]({'phone':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x7e')],'messageId':_0x4bc367[_0xe1ca('0x5b')]['messageId'],'body':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0x5b')],'SmsAccountId':_0x2f088a['params']['id'],'SmsInteractionId':_0x1b4434['id'],'direction':'in','ContactId':_0x1b4434['ContactId'],'AttachmentId':_0x4bc367[_0xe1ca('0x5b')][_0xe1ca('0xa4')]});})[_0xe1ca('0x36')](function(_0x37cc9d){_0x4bc367['message']=_0x37cc9d;if(!_0x4bc367[_0xe1ca('0x9d')]['UserId'])return;return db[_0xe1ca('0xa5')][_0xe1ca('0x59')]({'attributes':['id',_0xe1ca('0x3c')],'where':{'id':_0x4bc367['interaction'][_0xe1ca('0xa6')]}});})[_0xe1ca('0x36')](function(_0x2d75a6){if(_0x2d75a6){_0x4bc367['applications'][_0xe1ca('0xa7')]({'id':0x0,'priority':0x0,'app':_0xe1ca('0xa8'),'appdata':_0x2d75a6[_0xe1ca('0x3c')]+','+(_0x4bc367[_0xe1ca('0x72')][_0xe1ca('0xa9')]||0xa),'interval':_0xe1ca('0xa2')});}if(!_0x4bc367[_0xe1ca('0x9d')][_0xe1ca('0xaa')])return;return db['SmsQueue'][_0xe1ca('0x59')]({'attributes':['id','name'],'where':{'id':_0x4bc367[_0xe1ca('0x9d')][_0xe1ca('0xaa')]}});})[_0xe1ca('0x36')](function(_0x40ab5d){if(_0x40ab5d){_0x4bc367[_0xe1ca('0xa0')][_0xe1ca('0xa7')]({'id':0x0,'priority':0x1,'app':_0xe1ca('0xab'),'appdata':_0x40ab5d[_0xe1ca('0x3c')]+','+(_0x4bc367[_0xe1ca('0x72')][_0xe1ca('0xac')]||0x12c),'interval':_0xe1ca('0xa2')});}return respondWithRpcPromise(_0xe1ca('0xad'),_0xe1ca('0xae'),_0x4bc367);})[_0xe1ca('0x36')](function(_0x1c3f99){if(_0x1c3f99){var _0x31d766=0xc8;var _0x3d47b4=_0xe1ca('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d47b4,_0x31d766,_0xe1ca('0xb0'));logger[_0xe1ca('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3d47b4,_0x31d766,_0xe1ca('0xb0'),JSON[_0xe1ca('0x23')](_0x1c3f99));if(_0x4bc367[_0xe1ca('0x72')][_0xe1ca('0x43')]==='twilio'){return _0x218e93[_0xe1ca('0x2a')](_0x31d766)[_0xe1ca('0x31')](_0xe1ca('0xb1'),_0xe1ca('0xb2'))[_0xe1ca('0xb3')](_0xe1ca('0xb4'));}else{return _0x218e93[_0xe1ca('0x2a')](_0x31d766)['json'](_0x1c3f99);}}})[_0xe1ca('0x28')](handleError(_0x218e93,null));};exports[_0xe1ca('0xb5')]=function(_0x1da781,_0x2ccaaf){var _0xad89b4=_0x1da781[_0xe1ca('0x58')]['id'];var _0x563d97=_0x1da781[_0xe1ca('0x5b')];var _0x1b2aba=0xc8;var _0x315377=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0xe1ca('0xb6')][_0xe1ca('0xb7')]['READ_COMMITTED']},function(_0x4f10e0){return db[_0xe1ca('0x40')][_0xe1ca('0x63')]({'where':{'id':_0xad89b4},'transaction':_0x4f10e0})[_0xe1ca('0x36')](function(_0x4825a7){if(_0x4825a7){return db[_0xe1ca('0x70')]['destroy']({'where':{'SmsAccountId':_0xad89b4},'transaction':_0x4f10e0})['then'](function(){var _0x5d5977=_[_0xe1ca('0x44')](_0x563d97,function(_0x273196){_0x273196[_0xe1ca('0x66')]=_0xad89b4;return _0x273196;});return db[_0xe1ca('0x70')]['bulkCreate'](_0x5d5977,{'transaction':_0x4f10e0});});}else{_0x1b2aba=0x194;_0x315377=[];}});})['then'](function(){if(_0x1b2aba!==0x194){return db[_0xe1ca('0x70')][_0xe1ca('0xb8')]({'where':{'SmsAccountId':_0xad89b4},'order':'priority'})[_0xe1ca('0x36')](function(_0x1024d3){_0x315377=_0x1024d3;});}})[_0xe1ca('0x28')](function(_0x8dabc2){_0x1b2aba=0x1f4;logger[_0xe1ca('0x24')](_0x8dabc2['stack']);if(_0x8dabc2['name']){delete _0x8dabc2[_0xe1ca('0x3c')];}_0x315377=_0x8dabc2;})[_0xe1ca('0xb9')](function(){if(_0x315377===null){_0x2ccaaf['sendStatus'](_0x1b2aba);}else{if(_0x1b2aba===0x1f4){_0x2ccaaf[_0xe1ca('0x2a')](_0x1b2aba)[_0xe1ca('0xb3')](_0x315377);}else{_0x2ccaaf[_0xe1ca('0x2a')](_0x1b2aba)['json'](_0x315377);}}});};exports['getApplications']=function(_0x57802e,_0x7008c2,_0x4746b8){var _0x50b0df={};var _0x420563={};var _0x357112;var _0x30564f;return db[_0xe1ca('0x40')]['findOne']({'where':{'id':_0x57802e['params']['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x7008c2,null))[_0xe1ca('0x36')](function(_0x4a9dba){if(_0x4a9dba){_0x357112=_0x4a9dba;_0x420563['model']=_[_0xe1ca('0x46')](db['SmsApplication'][_0xe1ca('0x41')]);_0x420563['query']=_[_0xe1ca('0x46')](_0x57802e[_0xe1ca('0x45')]);_0x420563['filters']=_[_0xe1ca('0x48')](_0x420563['model'],_0x420563[_0xe1ca('0x45')]);_0x50b0df['attributes']=_[_0xe1ca('0x48')](_0x420563[_0xe1ca('0x49')],qs[_0xe1ca('0x4b')](_0x57802e[_0xe1ca('0x45')][_0xe1ca('0x4b')]));_0x50b0df['attributes']=_0x50b0df['attributes']['length']?_0x50b0df[_0xe1ca('0x4a')]:_0x420563['model'];_0x50b0df[_0xe1ca('0x4e')]=qs['sort'](_0x57802e['query'][_0xe1ca('0x4f')]);_0x50b0df[_0xe1ca('0x50')]=qs[_0xe1ca('0x47')](_['pick'](_0x57802e[_0xe1ca('0x45')],_0x420563[_0xe1ca('0x47')]));if(_0x57802e[_0xe1ca('0x45')][_0xe1ca('0x51')]){_0x50b0df[_0xe1ca('0x50')]=_[_0xe1ca('0x52')](_0x50b0df[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0x50b0df[_0xe1ca('0x4a')],function(_0x44514f){var _0x4a6a72={};_0x4a6a72[_0x44514f]={'$like':'%'+_0x57802e[_0xe1ca('0x45')][_0xe1ca('0x51')]+'%'};return _0x4a6a72;})});}_0x50b0df=_[_0xe1ca('0x52')]({},_0x50b0df,_0x57802e[_0xe1ca('0x53')]);return _0x357112[_0xe1ca('0xba')](_0x50b0df);}})['then'](function(_0x244246){if(_0x244246){_0x30564f=_0x244246[_0xe1ca('0x4c')];if(!_0x57802e[_0xe1ca('0x45')][_0xe1ca('0x4d')](_0xe1ca('0x65'))){_0x50b0df[_0xe1ca('0x30')]=qs[_0xe1ca('0x30')](_0x57802e[_0xe1ca('0x45')]['limit']);_0x50b0df[_0xe1ca('0x2d')]=qs[_0xe1ca('0x2d')](_0x57802e[_0xe1ca('0x45')][_0xe1ca('0x2d')]);}return _0x357112['getApplications'](_0x50b0df);}})[_0xe1ca('0x36')](function(_0x13f6a7){if(_0x13f6a7){return _0x13f6a7?{'count':_0x30564f,'rows':_0x13f6a7}:null;}})[_0xe1ca('0x36')](respondWithResult(_0x7008c2,null))[_0xe1ca('0x28')](handleError(_0x7008c2,null));};exports[_0xe1ca('0xbb')]=function(_0x86b954,_0x2d8186,_0xada029){var _0x582a6d={'raw':![],'where':{}};var _0x523abf={};var _0x45ea2d={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe1ca('0x63')]({'where':{'id':_0x86b954[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x2d8186,null))[_0xe1ca('0x36')](function(_0x20faed){if(_0x20faed){_0x523abf[_0xe1ca('0x49')]=_[_0xe1ca('0x46')](db[_0xe1ca('0x9c')][_0xe1ca('0x41')]);_0x523abf[_0xe1ca('0x45')]=_[_0xe1ca('0x46')](_0x86b954['query']);_0x523abf[_0xe1ca('0x47')]=_['intersection'](_0x523abf[_0xe1ca('0x49')],_0x523abf[_0xe1ca('0x45')]);_0x582a6d[_0xe1ca('0x4a')]=_[_0xe1ca('0x48')](_0x523abf['model'],qs[_0xe1ca('0x4b')](_0x86b954['query'][_0xe1ca('0x4b')]));_0x582a6d[_0xe1ca('0x4a')]=_0x582a6d[_0xe1ca('0x4a')][_0xe1ca('0x4c')]?_0x582a6d[_0xe1ca('0x4a')]:_0x523abf['model'];if(!_0x86b954[_0xe1ca('0x45')][_0xe1ca('0x4d')](_0xe1ca('0x65'))){_0x582a6d[_0xe1ca('0x30')]=qs[_0xe1ca('0x30')](_0x86b954[_0xe1ca('0x45')][_0xe1ca('0x30')]);_0x582a6d['offset']=qs[_0xe1ca('0x2d')](_0x86b954[_0xe1ca('0x45')][_0xe1ca('0x2d')]);}_0x582a6d[_0xe1ca('0x4e')]=qs['sort'](_0x86b954['query']['sort']);_0x582a6d[_0xe1ca('0x50')]=qs[_0xe1ca('0x47')](_[_0xe1ca('0xbc')](_0x86b954[_0xe1ca('0x45')],_0x523abf[_0xe1ca('0x47')]));_0x582a6d[_0xe1ca('0x50')][_0xe1ca('0x66')]=_0x20faed['id'];if(_0x86b954[_0xe1ca('0x45')][_0xe1ca('0x51')]){_0x582a6d[_0xe1ca('0x50')]=_[_0xe1ca('0x52')](_0x582a6d[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0x582a6d[_0xe1ca('0x4a')],function(_0x2b26c6){var _0x15e6ae={};_0x15e6ae[_0x2b26c6]={'$like':'%'+_0x86b954['query'][_0xe1ca('0x51')]+'%'};return _0x15e6ae;})});}_0x582a6d=_['merge']({},_0x582a6d,_0x86b954[_0xe1ca('0x53')]);return db[_0xe1ca('0x9c')][_0xe1ca('0x2f')]({'where':_0x582a6d[_0xe1ca('0x50')]})[_0xe1ca('0x36')](function(_0x55a60e){_0x45ea2d[_0xe1ca('0x2f')]=_0x55a60e;if(_0x86b954[_0xe1ca('0x45')][_0xe1ca('0x54')]){_0x582a6d['include']=[{'model':db[_0xe1ca('0x75')],'as':_0xe1ca('0xbd'),'required':![]},{'model':db[_0xe1ca('0xa5')],'as':_0xe1ca('0xbe'),'attributes':['name',_0xe1ca('0xbf'),'internal'],'required':![]},{'model':db[_0xe1ca('0xc0')],'as':_0xe1ca('0xc1'),'attributes':['id',_0xe1ca('0x3c'),_0xe1ca('0xc2')],'where':_0x86b954[_0xe1ca('0x45')]['tag']?{'id':_0x86b954['query'][_0xe1ca('0xc3')]}:undefined,'required':_0x86b954[_0xe1ca('0x45')][_0xe1ca('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0xe1ca('0x56')](_0x582a6d);})[_0xe1ca('0x36')](function(_0x3a6e83){_0x45ea2d[_0xe1ca('0x67')]=_0x3a6e83;return _0x45ea2d;});}})[_0xe1ca('0x36')](respondWithFilteredResult(_0x2d8186,_0x582a6d))[_0xe1ca('0x28')](handleError(_0x2d8186,null));};exports[_0xe1ca('0xb3')]=function(_0x3178d2,_0x5007fb,_0x45e278){var _0x11b948,_0x12b960,_0xf21669;if(_[_0xe1ca('0x90')](_0x3178d2[_0xe1ca('0x5b')]['body'])||_0x3178d2[_0xe1ca('0x5b')][_0xe1ca('0x5b')]===''){throw new db['Sequelize'][(_0xe1ca('0x77'))](_0xe1ca('0x91'));}if(_[_0xe1ca('0x90')](_0x3178d2[_0xe1ca('0x5b')]['to'])){throw new db[(_0xe1ca('0x76'))][(_0xe1ca('0x77'))](_0xe1ca('0xc4'));}_0x11b948=_0x3178d2[_0xe1ca('0x5b')]['to'];return db['SmsAccount'][_0xe1ca('0x59')]({'where':{'id':_0x3178d2[_0xe1ca('0x58')]['id']},'include':[{'model':db[_0xe1ca('0xc5')],'as':_0xe1ca('0xc6'),'include':[{'model':db[_0xe1ca('0x75')],'as':_0xe1ca('0x95'),'where':{'mobile':_0x11b948},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xe1ca('0x36')](handleEntityNotFound(_0x5007fb,null))[_0xe1ca('0x36')](function(_0x68857a){if(_0x68857a&&_0x68857a[_0xe1ca('0xc6')]){_0x12b960=_0x68857a[_0xe1ca('0x38')]({'plain':!![]});if(_0x12b960[_0xe1ca('0xc6')]&&_0x12b960[_0xe1ca('0xc6')][_0xe1ca('0x95')][_0xe1ca('0x4c')]){return _0x12b960[_0xe1ca('0xc6')][_0xe1ca('0x95')][0x0];}return db[_0xe1ca('0x75')][_0xe1ca('0x5a')](_[_0xe1ca('0x9a')](_0x3178d2[_0xe1ca('0x5b')],{'firstName':_0x11b948,'mobile':_0x11b948,'phone':_0x11b948,'ListId':_0x12b960['ListId']}));}})[_0xe1ca('0x36')](handleEntityNotFound(_0x5007fb,null))['then'](function(_0x8e6bc6){if(_0x8e6bc6){_0xf21669=_0x8e6bc6;return db['SmsInteraction']['find']({'where':{'ContactId':_0xf21669['id'],'closed':![],'SmsAccountId':_0x12b960['id']}})[_0xe1ca('0x36')](function(_0x3bdc41){if(_0x3bdc41){return[_0x3bdc41,![]];}return db[_0xe1ca('0x9c')][_0xe1ca('0x5a')]({'UserId':_0x3178d2[_0xe1ca('0x5c')]['id'],'ContactId':_0xf21669['id'],'SmsAccountId':_0x12b960['id'],'phone':_0x11b948,'firstMsgDirection':_0xe1ca('0xc7'),'Messages':[_[_0xe1ca('0x52')](_0x3178d2['body'],{'read':![],'body':_0x3178d2[_0xe1ca('0x5b')][_0xe1ca('0x5b')],'phone':_0x11b948,'SmsAccountId':_0x12b960['id'],'UserId':_0x3178d2[_0xe1ca('0x5c')]['id'],'ContactId':_0xf21669['id']})]},{'include':[{'model':db[_0xe1ca('0xa3')],'as':'Messages'}]})[_0xe1ca('0x36')](function(_0x70c3ad){return[_0x70c3ad,!![]];});});}})['spread'](function(_0x41ebc8,_0x2e9ba2){if(_0x2e9ba2){return _0x41ebc8;}return db[_0xe1ca('0xa3')][_0xe1ca('0x5a')](_[_0xe1ca('0x52')](_0x3178d2[_0xe1ca('0x5b')],{'read':![],'body':_0x3178d2[_0xe1ca('0x5b')][_0xe1ca('0x5b')],'phone':_0x11b948,'SmsAccountId':_0x12b960['id'],'SmsInteractionId':_0x41ebc8['id'],'UserId':_0x3178d2[_0xe1ca('0x5c')]['id'],'ContactId':_0xf21669['id']}))[_0xe1ca('0x36')](function(_0x2eed79){_0x41ebc8[_0xe1ca('0xc8')][_0xe1ca('0xc9')]=[];_0x41ebc8['dataValues'][_0xe1ca('0xc9')][_0xe1ca('0xa1')](_0x2eed79[_0xe1ca('0xc8')]);return _0x41ebc8;});})['then'](respondWithResult(_0x5007fb,null))['catch'](handleError(_0x5007fb,null));};exports['status']=function(_0x37f45d,_0x305537,_0x1161d0){if(_0x37f45d['body']['id']){delete _0x37f45d[_0xe1ca('0x5b')]['id'];}var _0x1df173,_0x21c035,_0x38f051;return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x37f45d[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x305537,null))[_0xe1ca('0x36')](function(_0x1aa137){if(_0x1aa137){_0x38f051=_0x1aa137;logger[_0xe1ca('0x21')](_0xe1ca('0x22'),'status',_0xe1ca('0xca'),_0x1aa137['type'],util['inspect'](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1aa137[_0xe1ca('0x43')]){case _0xe1ca('0x82'):if(_0x37f45d['body'][_0xe1ca('0xcb')]&&_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x2a')]){_0x21c035=_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x2a')];return db['SmsMessage'][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d[_0xe1ca('0x5b')]['skebby_dispatch_id']}});}break;case _0xe1ca('0xcc'):if(_0x37f45d[_0xe1ca('0x5b')]['requestid']&&_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0xcd')]){_0x21c035=_0x37f45d['body']['statusInt'];return db['SmsMessage'][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d['body'][_0xe1ca('0xce')]}});}break;case'clicksend':if(_0x37f45d[_0xe1ca('0x5b')]['message_id']&&_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0xcf')]){_0x21c035=_0x37f45d['body'][_0xe1ca('0xcf')];return db['SmsMessage'][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d['body'][_0xe1ca('0x85')]}});}break;case _0xe1ca('0xd0'):var _0x4df5ca=_0x37f45d['body']['results'][0x0];if(_0x4df5ca[_0xe1ca('0x80')]&&_0x4df5ca['status'][_0xe1ca('0xd1')]===_0xe1ca('0xd2')){_0x21c035=_0x4df5ca[_0xe1ca('0x2a')][_0xe1ca('0xd1')];return db['SmsMessage'][_0xe1ca('0x59')]({'where':{'messageId':_0x4df5ca[_0xe1ca('0x80')]}});}break;case'clickatell':if(_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x80')]&&_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x2a')]){_0x21c035=_0x37f45d[_0xe1ca('0x5b')]['status'];return db[_0xe1ca('0xa3')][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x80')]}});}break;case _0xe1ca('0x8d'):if(_0x37f45d[_0xe1ca('0x5b')][0x0]['message']['id']){_0x21c035=_0x37f45d[_0xe1ca('0x5b')][0x0][_0xe1ca('0x43')];return db[_0xe1ca('0xa3')][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d['body'][0x0][_0xe1ca('0x26')]['id']}});}break;case _0xe1ca('0xd3'):if(_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0xd4')]&&_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x2a')]){_0x21c035=_0x37f45d[_0xe1ca('0x5b')][_0xe1ca('0x2a')];return db['SmsMessage'][_0xe1ca('0x59')]({'where':{'messageId':_0x37f45d['body'][_0xe1ca('0xd4')]}});}break;}}})[_0xe1ca('0x36')](handleEntityNotFound(_0x305537,null))[_0xe1ca('0x36')](function(_0x332c3e){if(_0x332c3e){_0x1df173=_0x332c3e;switch(_0x38f051[_0xe1ca('0x43')]){case _0xe1ca('0x82'):if(_0x21c035==='DELIVERED'){return _0x1df173['update']({'read':!![]});}else{logger['error'](_0xe1ca('0x22'),_0xe1ca('0x2a'),'skebby',util['inspect'](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1ca('0xcc'):if(_0x21c035==='1'){return _0x1df173[_0xe1ca('0x35')]({'read':!![]});}else{logger[_0xe1ca('0x24')](_0xe1ca('0x22'),'status',_0xe1ca('0x82'),util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x37f45d['body'][_0xe1ca('0xd6')]&&_0x21c035>=0xc8&&_0x21c035<=0xce){return _0x1df173[_0xe1ca('0x35')]({'read':!![]});}else{logger['error'](_0xe1ca('0x22'),'status','clicksend',util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x40bcfe=_0x37f45d['body'][_0xe1ca('0x89')][0x0];if(_0x40bcfe[_0xe1ca('0x2a')]['groupName']==='DELIVERED'){return _0x1df173[_0xe1ca('0x35')]({'read':!![]});}else{logger[_0xe1ca('0x24')](_0xe1ca('0x22'),'status',_0xe1ca('0xd0'),util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1ca('0xd7'):if(_0x21c035==_0xe1ca('0xd8')||_0x21c035==_0xe1ca('0xd9')){return _0x1df173[_0xe1ca('0x35')]({'read':!![]});}else{logger['error'](_0xe1ca('0x22'),_0xe1ca('0x2a'),_0xe1ca('0xd7'),util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1ca('0x8d'):if(_0x21c035==_0xe1ca('0xda')){return _0x1df173[_0xe1ca('0x35')]({'read':!![]});}else{logger[_0xe1ca('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe1ca('0x2a'),'bandwidth',util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x21c035==='DELIVRD'||_0x21c035===_0xe1ca('0xdb')){return _0x1df173['update']({'read':!![]});}else{logger['error'](_0xe1ca('0x22'),'status',_0xe1ca('0xd3'),util[_0xe1ca('0xd5')](_0x37f45d[_0xe1ca('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x1df173;}})['then'](respondWithResult(_0x305537,null))[_0xe1ca('0x28')](handleError(_0x305537,null));};exports[_0xe1ca('0xdc')]=function(_0x1bfb98,_0xe10ac1,_0x517e1d){var _0x69af8e,_0x40cc83,_0x3cadd0;return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x1bfb98['params']['id']}})['then'](handleEntityNotFound(_0xe10ac1,null))['then'](function(_0x37b6d4){if(_0x37b6d4){_0x3cadd0=_0x37b6d4;logger[_0xe1ca('0x21')](_0xe1ca('0x22'),'status','received\x20delivery\x20report\x20from',_0x37b6d4[_0xe1ca('0x43')],util[_0xe1ca('0xd5')](_0x1bfb98[_0xe1ca('0x45')],{'showHidden':![],'depth':null}));switch(_0x37b6d4['type']){case'csc':if(_0x1bfb98[_0xe1ca('0x45')]['message-id']&&_0x1bfb98[_0xe1ca('0x45')][_0xe1ca('0xdd')]){_0x40cc83=_0x1bfb98[_0xe1ca('0x45')][_0xe1ca('0xdd')];return db[_0xe1ca('0xa3')][_0xe1ca('0x59')]({'where':{'messageId':_0x1bfb98[_0xe1ca('0x45')]['message-id']}});}break;}}})[_0xe1ca('0x36')](handleEntityNotFound(_0xe10ac1,null))[_0xe1ca('0x36')](function(_0x245260){if(_0x245260){_0x69af8e=_0x245260;switch(_0x3cadd0[_0xe1ca('0x43')]){case _0xe1ca('0xde'):if(_0x40cc83==='2'||_0x40cc83==='6'){return _0x69af8e[_0xe1ca('0x35')]({'read':!![]});}else{logger['error'](_0xe1ca('0x22'),_0xe1ca('0x2a'),_0xe1ca('0xde'),util[_0xe1ca('0xd5')](_0x1bfb98[_0xe1ca('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x69af8e;}})['then'](respondWithResult(_0xe10ac1,null))[_0xe1ca('0x28')](handleError(_0xe10ac1,null));};exports[_0xe1ca('0xdf')]=function(_0x224c03,_0xc887ed,_0x586c75){return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x224c03[_0xe1ca('0x58')]['id']}})['then'](handleEntityNotFound(_0xc887ed,null))[_0xe1ca('0x36')](function(_0x703f48){if(_0x703f48){return _0x703f48[_0xe1ca('0xdf')](_0x224c03[_0xe1ca('0x5b')][_0xe1ca('0x69')],_[_0xe1ca('0x99')](_0x224c03[_0xe1ca('0x5b')],['ids','id'])||{})['spread'](function(_0xdd24f2){for(var _0xc4b66d=0x0;_0xc4b66d<_0x224c03[_0xe1ca('0x5b')]['ids'][_0xe1ca('0x4c')];_0xc4b66d+=0x1){socket[_0xe1ca('0xe0')](_0xe1ca('0xe1'),{'UserId':Number(_0x224c03[_0xe1ca('0x5b')][_0xe1ca('0x69')][_0xc4b66d]),'SmsAccountId':Number(_0x224c03[_0xe1ca('0x58')]['id'])});}return _0xdd24f2;});}})['then'](respondWithResult(_0xc887ed,null))['catch'](handleError(_0xc887ed,null));};exports[_0xe1ca('0xe2')]=function(_0x46f10a,_0x5924c8,_0x88a089){return db[_0xe1ca('0x40')][_0xe1ca('0x59')]({'where':{'id':_0x46f10a[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0x5924c8,null))[_0xe1ca('0x36')](function(_0x24b23e){if(_0x24b23e){return _0x24b23e[_0xe1ca('0xe2')](_0x46f10a[_0xe1ca('0x45')][_0xe1ca('0x69')])[_0xe1ca('0x36')](function(){if(_[_0xe1ca('0xe3')](_0x46f10a[_0xe1ca('0x45')][_0xe1ca('0x69')])){for(var _0x2a9914=0x0;_0x2a9914<_0x46f10a[_0xe1ca('0x45')][_0xe1ca('0x69')][_0xe1ca('0x4c')];_0x2a9914+=0x1){socket[_0xe1ca('0xe0')](_0xe1ca('0xe4'),{'UserId':Number(_0x46f10a['query'][_0xe1ca('0x69')][_0x2a9914]),'SmsAccountId':Number(_0x46f10a[_0xe1ca('0x58')]['id'])});}}else{socket[_0xe1ca('0xe0')](_0xe1ca('0xe4'),{'UserId':Number(_0x46f10a[_0xe1ca('0x45')][_0xe1ca('0x69')]),'SmsAccountId':Number(_0x46f10a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5924c8,null))[_0xe1ca('0x28')](handleError(_0x5924c8,null));};exports[_0xe1ca('0xe5')]=function(_0xf74ee,_0xc43cdb,_0x3d7f8e){var _0x1eabb6={};var _0x554bee={};var _0x43f7ab;var _0x1de13f;return db[_0xe1ca('0x40')][_0xe1ca('0x63')]({'where':{'id':_0xf74ee[_0xe1ca('0x58')]['id']}})[_0xe1ca('0x36')](handleEntityNotFound(_0xc43cdb,null))[_0xe1ca('0x36')](function(_0x2281a8){if(_0x2281a8){_0x43f7ab=_0x2281a8;_0x554bee['model']=_[_0xe1ca('0x46')](db['User'][_0xe1ca('0x41')]);_0x554bee['query']=_[_0xe1ca('0x46')](_0xf74ee[_0xe1ca('0x45')]);_0x554bee['filters']=_[_0xe1ca('0x48')](_0x554bee[_0xe1ca('0x49')],_0x554bee[_0xe1ca('0x45')]);_0x1eabb6['attributes']=_[_0xe1ca('0x48')](_0x554bee[_0xe1ca('0x49')],qs['fields'](_0xf74ee[_0xe1ca('0x45')][_0xe1ca('0x4b')]));_0x1eabb6[_0xe1ca('0x4a')]=_0x1eabb6[_0xe1ca('0x4a')][_0xe1ca('0x4c')]?_0x1eabb6[_0xe1ca('0x4a')]:_0x554bee[_0xe1ca('0x49')];_0x1eabb6[_0xe1ca('0x4e')]=qs['sort'](_0xf74ee[_0xe1ca('0x45')]['sort']);_0x1eabb6['where']=qs[_0xe1ca('0x47')](_[_0xe1ca('0xbc')](_0xf74ee[_0xe1ca('0x45')],_0x554bee[_0xe1ca('0x47')]));if(_0xf74ee[_0xe1ca('0x45')]['filter']){_0x1eabb6[_0xe1ca('0x50')]=_['merge'](_0x1eabb6[_0xe1ca('0x50')],{'$or':_[_0xe1ca('0x44')](_0x1eabb6[_0xe1ca('0x4a')],function(_0x29dd15){var _0x277eaa={};_0x277eaa[_0x29dd15]={'$like':'%'+_0xf74ee['query'][_0xe1ca('0x51')]+'%'};return _0x277eaa;})});}_0x1eabb6=_[_0xe1ca('0x52')]({},_0x1eabb6,_0xf74ee[_0xe1ca('0x53')]);return _0x43f7ab[_0xe1ca('0xe5')](_0x1eabb6);}})['then'](function(_0x785be6){if(_0x785be6){_0x1de13f=_0x785be6['length'];if(!_0xf74ee[_0xe1ca('0x45')][_0xe1ca('0x4d')](_0xe1ca('0x65'))){_0x1eabb6[_0xe1ca('0x30')]=qs[_0xe1ca('0x30')](_0xf74ee[_0xe1ca('0x45')][_0xe1ca('0x30')]);_0x1eabb6['offset']=qs[_0xe1ca('0x2d')](_0xf74ee[_0xe1ca('0x45')][_0xe1ca('0x2d')]);}return _0x43f7ab['getAgents'](_0x1eabb6);}})[_0xe1ca('0x36')](function(_0x2f583f){if(_0x2f583f){return _0x2f583f?{'count':_0x1de13f,'rows':_0x2f583f}:null;}})[_0xe1ca('0x36')](respondWithResult(_0xc43cdb,null))['catch'](handleError(_0xc43cdb,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e47c624..9cc74fc 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 _0xd3b2=['hook','exports','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xd3b2,0xb0));var _0x2d3b=function(_0x555e71,_0xea94c5){_0x555e71=_0x555e71-0x0;var _0x173069=_0xd3b2[_0x555e71];return _0x173069;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x2d3b('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d3b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4c93eb){return function(_0x3b70e7,_0x312db4,_0x351bc6){SmsAccountEvents[_0x2d3b('0x2')](_0x4c93eb+':'+_0x3b70e7['id'],_0x3b70e7);SmsAccountEvents[_0x2d3b('0x2')](_0x4c93eb,_0x3b70e7);_0x351bc6(null);};}for(var e in events){if(events[_0x2d3b('0x3')](e)){var event=events[e];SmsAccount[_0x2d3b('0x4')](e,emitEvent(event));}}module[_0x2d3b('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0x3335=['exports','SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x356663,_0x36810d){var _0x4adde9=function(_0x13f2e6){while(--_0x13f2e6){_0x356663['push'](_0x356663['shift']());}};_0x4adde9(++_0x36810d);}(_0x3335,0x111));var _0x5333=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3335[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x5333('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5333('0x1')](0x0);var events={'afterCreate':_0x5333('0x2'),'afterUpdate':'update','afterDestroy':_0x5333('0x3')};function emitEvent(_0x56f8f6){return function(_0x52e072,_0x4eb655,_0x253763){SmsAccountEvents[_0x5333('0x4')](_0x56f8f6+':'+_0x52e072['id'],_0x52e072);SmsAccountEvents['emit'](_0x56f8f6,_0x52e072);_0x253763(null);};}for(var e in events){if(events[_0x5333('0x5')](e)){var event=events[e];SmsAccount[_0x5333('0x6')](e,emitEvent(event));}}module[_0x5333('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f4838ab..77fc341 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 _0xdf82=['./smsAccount.attributes','exports','define','SmsAccount','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4ea24d,_0x2d0f66){var _0x4fec11=function(_0x149cf7){while(--_0x149cf7){_0x4ea24d['push'](_0x4ea24d['shift']());}};_0x4fec11(++_0x2d0f66);}(_0xdf82,0x88));var _0x2df8=function(_0x20b041,_0x41d6af){_0x20b041=_0x20b041-0x0;var _0x120e63=_0xdf82[_0x20b041];return _0x120e63;};'use strict';var _=require(_0x2df8('0x0'));var util=require('util');var logger=require(_0x2df8('0x1'))('api');var moment=require(_0x2df8('0x2'));var BPromise=require(_0x2df8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df8('0x4'));var rimraf=require(_0x2df8('0x5'));var config=require(_0x2df8('0x6'));var attributes=require(_0x2df8('0x7'));module[_0x2df8('0x8')]=function(_0x41a9c7,_0x40471f){return _0x41a9c7[_0x2df8('0x9')](_0x2df8('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf7a=['bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','api','moment'];(function(_0x3cca37,_0x18ecce){var _0x25e39b=function(_0x3f7fd1){while(--_0x3f7fd1){_0x3cca37['push'](_0x3cca37['shift']());}};_0x25e39b(++_0x18ecce);}(_0xcf7a,0x13d));var _0xacf7=function(_0x1c9c36,_0x168c07){_0x1c9c36=_0x1c9c36-0x0;var _0x1ad297=_0xcf7a[_0x1c9c36];return _0x1ad297;};'use strict';var _=require(_0xacf7('0x0'));var util=require(_0xacf7('0x1'));var logger=require(_0xacf7('0x2'))(_0xacf7('0x3'));var moment=require(_0xacf7('0x4'));var BPromise=require(_0xacf7('0x5'));var rp=require(_0xacf7('0x6'));var fs=require('fs');var path=require(_0xacf7('0x7'));var rimraf=require(_0xacf7('0x8'));var config=require(_0xacf7('0x9'));var attributes=require(_0xacf7('0xa'));module[_0xacf7('0xb')]=function(_0x1323a6,_0x574d96){return _0x1323a6[_0xacf7('0xc')](_0xacf7('0xd'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 69def3c..d8a2645 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 _0x03e9=['result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message'];(function(_0x1ecd12,_0x5826dd){var _0x348b09=function(_0x45243b){while(--_0x45243b){_0x1ecd12['push'](_0x1ecd12['shift']());}};_0x348b09(++_0x5826dd);}(_0x03e9,0xde));var _0x903e=function(_0x28049e,_0x302e6b){_0x28049e=_0x28049e-0x0;var _0xf8a2ae=_0x03e9[_0x28049e];return _0xf8a2ae;};'use strict';var _=require('lodash');var util=require(_0x903e('0x0'));var moment=require('moment');var BPromise=require(_0x903e('0x1'));var rs=require(_0x903e('0x2'));var fs=require('fs');var Redis=require(_0x903e('0x3'));var db=require(_0x903e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x903e('0x5'))(_0x903e('0x6'));var config=require(_0x903e('0x7'));var jayson=require(_0x903e('0x8'));var client=jayson['client'][_0x903e('0x9')]({'port':0x232a});config[_0x903e('0xa')]=_[_0x903e('0xb')](config[_0x903e('0xa')],{'host':_0x903e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x903e('0xd'))['register'](socket);function respondWithRpcPromise(_0x191860,_0x1062fa,_0x4e5a2c){return new BPromise(function(_0x517d57,_0xc2af0a){return client[_0x903e('0xe')](_0x191860,_0x4e5a2c)[_0x903e('0xf')](function(_0x1b34ca){logger[_0x903e('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1062fa,_0x903e('0x11'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1062fa,_0x903e('0x11'),JSON[_0x903e('0x12')](_0x1b34ca));if(_0x1b34ca[_0x903e('0x13')]){if(_0x1b34ca[_0x903e('0x13')][_0x903e('0x14')]===0x1f4){logger['error'](_0x903e('0x15'),_0x1062fa,_0x1b34ca[_0x903e('0x13')]['message']);return _0xc2af0a(_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);}logger['error'](_0x903e('0x15'),_0x1062fa,_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);return _0x517d57(_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);}else{logger[_0x903e('0x10')](_0x903e('0x15'),_0x1062fa,'request\x20sent');_0x517d57(_0x1b34ca[_0x903e('0x17')][_0x903e('0x16')]);}})[_0x903e('0x18')](function(_0x58f214){logger[_0x903e('0x13')](_0x903e('0x15'),_0x1062fa,_0x58f214);_0xc2af0a(_0x58f214);});});}exports[_0x903e('0x19')]=function(_0x1903a3){var _0xf623df=this;return new Promise(function(_0x117b16,_0x4109af){return db[_0x903e('0x1a')][_0x903e('0x1b')]({'raw':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')][_0x903e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')][_0x903e('0x1e')]||null:null,'attributes':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')]['attributes']||null:null,'include':_0x1903a3[_0x903e('0x1c')]?_0x1903a3['options'][_0x903e('0x1f')]?_[_0x903e('0x20')](_0x1903a3[_0x903e('0x1c')][_0x903e('0x1f')],function(_0x153cd8){return{'model':db[_0x153cd8[_0x903e('0x21')]],'as':_0x153cd8['as'],'attributes':_0x153cd8[_0x903e('0x22')],'include':_0x153cd8['include']?_[_0x903e('0x20')](_0x153cd8['include'],function(_0x4ef098){return{'model':db[_0x4ef098[_0x903e('0x21')]],'as':_0x4ef098['as'],'attributes':_0x4ef098[_0x903e('0x22')],'include':_0x4ef098[_0x903e('0x1f')]?_[_0x903e('0x20')](_0x4ef098[_0x903e('0x1f')],function(_0x16633c){return{'model':db[_0x16633c[_0x903e('0x21')]],'as':_0x16633c['as'],'attributes':_0x16633c[_0x903e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22d114){logger[_0x903e('0x10')](_0x903e('0x19'),_0x1903a3);logger['debug']('ShowSmsAccount',_0x1903a3,JSON[_0x903e('0x12')](_0x22d114));_0x117b16(_0x22d114);})[_0x903e('0x18')](function(_0x4676fd){logger[_0x903e('0x13')](_0x903e('0x19'),_0x4676fd[_0x903e('0x16')],_0x1903a3);_0x4109af(_0xf623df['error'](0x1f4,_0x4676fd['message']));});});}; \ No newline at end of file +var _0x8738=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','info'];(function(_0x7488c6,_0x1b2889){var _0x50fafa=function(_0x5dbf64){while(--_0x5dbf64){_0x7488c6['push'](_0x7488c6['shift']());}};_0x50fafa(++_0x1b2889);}(_0x8738,0xf0));var _0x8873=function(_0x53c0b3,_0x1b032){_0x53c0b3=_0x53c0b3-0x0;var _0x2a7447=_0x8738[_0x53c0b3];return _0x2a7447;};'use strict';var _=require(_0x8873('0x0'));var util=require(_0x8873('0x1'));var moment=require(_0x8873('0x2'));var BPromise=require(_0x8873('0x3'));var rs=require(_0x8873('0x4'));var fs=require('fs');var Redis=require(_0x8873('0x5'));var db=require(_0x8873('0x6'))['db'];var utils=require(_0x8873('0x7'));var logger=require(_0x8873('0x8'))('rpc');var config=require(_0x8873('0x9'));var jayson=require(_0x8873('0xa'));var client=jayson[_0x8873('0xb')][_0x8873('0xc')]({'port':0x232a});config[_0x8873('0xd')]=_[_0x8873('0xe')](config['redis'],{'host':_0x8873('0xf'),'port':0x18eb});var socket=require(_0x8873('0x10'))(new Redis(config['redis']));require(_0x8873('0x11'))[_0x8873('0x12')](socket);function respondWithRpcPromise(_0x42810e,_0x2a009f,_0xf6c535){return new BPromise(function(_0x435cf9,_0x1fb91e){return client['request'](_0x42810e,_0xf6c535)[_0x8873('0x13')](function(_0x2892b9){logger['info'](_0x8873('0x14'),_0x2a009f,_0x8873('0x15'));logger[_0x8873('0x16')](_0x8873('0x17'),_0x2a009f,'request\x20sent',JSON[_0x8873('0x18')](_0x2892b9));if(_0x2892b9['error']){if(_0x2892b9[_0x8873('0x19')][_0x8873('0x1a')]===0x1f4){logger[_0x8873('0x19')](_0x8873('0x14'),_0x2a009f,_0x2892b9[_0x8873('0x19')][_0x8873('0x1b')]);return _0x1fb91e(_0x2892b9[_0x8873('0x19')][_0x8873('0x1b')]);}logger[_0x8873('0x19')]('SmsAccount,\x20%s,\x20%s',_0x2a009f,_0x2892b9[_0x8873('0x19')][_0x8873('0x1b')]);return _0x435cf9(_0x2892b9[_0x8873('0x19')][_0x8873('0x1b')]);}else{logger['info'](_0x8873('0x14'),_0x2a009f,_0x8873('0x15'));_0x435cf9(_0x2892b9['result'][_0x8873('0x1b')]);}})[_0x8873('0x1c')](function(_0x23fea5){logger[_0x8873('0x19')](_0x8873('0x14'),_0x2a009f,_0x23fea5);_0x1fb91e(_0x23fea5);});});}exports[_0x8873('0x1d')]=function(_0x4a81fc){var _0x125d22=this;return new Promise(function(_0x50afcf,_0x42b8df){return db[_0x8873('0x1e')][_0x8873('0x1f')]({'raw':_0x4a81fc['options']?_0x4a81fc[_0x8873('0x20')][_0x8873('0x21')]===undefined?!![]:![]:!![],'where':_0x4a81fc[_0x8873('0x20')]?_0x4a81fc[_0x8873('0x20')][_0x8873('0x22')]||null:null,'attributes':_0x4a81fc['options']?_0x4a81fc[_0x8873('0x20')][_0x8873('0x23')]||null:null,'include':_0x4a81fc[_0x8873('0x20')]?_0x4a81fc[_0x8873('0x20')][_0x8873('0x24')]?_[_0x8873('0x25')](_0x4a81fc['options']['include'],function(_0x1294c4){return{'model':db[_0x1294c4[_0x8873('0x26')]],'as':_0x1294c4['as'],'attributes':_0x1294c4[_0x8873('0x23')],'include':_0x1294c4['include']?_[_0x8873('0x25')](_0x1294c4[_0x8873('0x24')],function(_0x1dbb42){return{'model':db[_0x1dbb42[_0x8873('0x26')]],'as':_0x1dbb42['as'],'attributes':_0x1dbb42['attributes'],'include':_0x1dbb42['include']?_[_0x8873('0x25')](_0x1dbb42['include'],function(_0x17e4bc){return{'model':db[_0x17e4bc['model']],'as':_0x17e4bc['as'],'attributes':_0x17e4bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8873('0x13')](function(_0x4a5256){logger[_0x8873('0x27')]('ShowSmsAccount',_0x4a81fc);logger[_0x8873('0x16')](_0x8873('0x1d'),_0x4a81fc,JSON['stringify'](_0x4a5256));_0x50afcf(_0x4a5256);})[_0x8873('0x1c')](function(_0x3badc1){logger[_0x8873('0x19')](_0x8873('0x1d'),_0x3badc1[_0x8873('0x1b')],_0x4a81fc);_0x42b8df(_0x125d22[_0x8873('0x19')](0x1f4,_0x3badc1[_0x8873('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f8e6c3..4c9279b 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(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 fefb6b5..9e54bae 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x213710,_0xb39fc6){var _0x5cd2c2=function(_0x979ffd){while(--_0x979ffd){_0x213710['push'](_0x213710['shift']());}};_0x5cd2c2(++_0xb39fc6);}(_0x55ca,0x126));var _0xa55c=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x55ca[_0x3ca829];return _0x3b416b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c026b88..7055a9d 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 _0x86b8=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0xd6a8ee,_0x368f12){var _0x496ce3=function(_0x225da2){while(--_0x225da2){_0xd6a8ee['push'](_0xd6a8ee['shift']());}};_0x496ce3(++_0x368f12);}(_0x86b8,0x17e));var _0x886b=function(_0x42e885,_0x587b98){_0x42e885=_0x42e885-0x0;var _0x5ea739=_0x86b8[_0x42e885];return _0x5ea739;};'use strict';var Sequelize=require('sequelize');module[_0x886b('0x0')]={'priority':{'type':Sequelize[_0x886b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x886b('0x2')],'allowNull':![],'defaultValue':_0x886b('0x3')},'appdata':{'type':Sequelize[_0x886b('0x4')]()},'description':{'type':Sequelize[_0x886b('0x2')]},'interval':{'type':Sequelize[_0x886b('0x2')],'defaultValue':_0x886b('0x5')}}; \ No newline at end of file +var _0x1ab4=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x1ab4,0x1d7));var _0x41ab=function(_0x1f2e7a,_0x19e812){_0x1f2e7a=_0x1f2e7a-0x0;var _0x4834b9=_0x1ab4[_0x1f2e7a];return _0x4834b9;};'use strict';var Sequelize=require(_0x41ab('0x0'));module[_0x41ab('0x1')]={'priority':{'type':Sequelize[_0x41ab('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x41ab('0x3')],'allowNull':![],'defaultValue':_0x41ab('0x4')},'appdata':{'type':Sequelize[_0x41ab('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x41ab('0x3')],'defaultValue':_0x41ab('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0195701..1b77652 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 _0xe88a=['catch','show','keys','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe88a,0x1c4));var _0xae88=function(_0x105c4e,_0x29f9e5){_0x105c4e=_0x105c4e-0x0;var _0x41b33f=_0xe88a[_0x105c4e];return _0x41b33f;};'use strict';var emlformat=require(_0xae88('0x0'));var rimraf=require(_0xae88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae88('0x2'));var rp=require(_0xae88('0x3'));var moment=require(_0xae88('0x4'));var BPromise=require(_0xae88('0x5'));var Mustache=require(_0xae88('0x6'));var util=require(_0xae88('0x7'));var path=require(_0xae88('0x8'));var sox=require(_0xae88('0x9'));var csv=require(_0xae88('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae88('0xb'));var squel=require(_0xae88('0xc'));var crypto=require(_0xae88('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae88('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae88('0xf'));var Papa=require(_0xae88('0x10'));var Redis=require(_0xae88('0x11'));var authService=require(_0xae88('0x12'));var qs=require(_0xae88('0x13'));var as=require(_0xae88('0x14'));var hardwareService=require(_0xae88('0x15'));var logger=require('../../config/logger')(_0xae88('0x16'));var utils=require(_0xae88('0x17'));var config=require(_0xae88('0x18'));var licenseUtil=require(_0xae88('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26dddb,_0x317b2d){_0x317b2d=_0x317b2d||0xcc;return function(_0x51d1d6){if(_0x51d1d6){return _0x26dddb[_0xae88('0x1a')](_0x317b2d);}return _0x26dddb[_0xae88('0x1b')](_0x317b2d)['end']();};}function respondWithResult(_0x58122e,_0x5bb432){_0x5bb432=_0x5bb432||0xc8;return function(_0x436342){if(_0x436342){return _0x58122e[_0xae88('0x1b')](_0x5bb432)['json'](_0x436342);}};}function respondWithFilteredResult(_0x31179b,_0x18cf09){return function(_0x3fa1c7){if(_0x3fa1c7){var _0xfab4f2=typeof _0x18cf09['offset']===_0xae88('0x1c')&&typeof _0x18cf09[_0xae88('0x1d')]===_0xae88('0x1c');var _0x228243=_0x3fa1c7['count'];var _0xa82284=_0xfab4f2?0x0:_0x18cf09[_0xae88('0x1e')];var _0x57e7d3=_0xfab4f2?_0x3fa1c7[_0xae88('0x1f')]:_0x18cf09[_0xae88('0x1e')]+_0x18cf09[_0xae88('0x1d')];var _0x12fec8;if(_0x57e7d3>=_0x228243){_0x57e7d3=_0x228243;_0x12fec8=0xc8;}else{_0x12fec8=0xce;}_0x31179b[_0xae88('0x1b')](_0x12fec8);return _0x31179b['set'](_0xae88('0x20'),_0xa82284+'-'+_0x57e7d3+'/'+_0x228243)[_0xae88('0x21')](_0x3fa1c7);}return null;};}function patchUpdates(_0x6c81b){return function(_0x45d150){try{jsonpatch[_0xae88('0x22')](_0x45d150,_0x6c81b,!![]);}catch(_0x436cea){return BPromise[_0xae88('0x23')](_0x436cea);}return _0x45d150[_0xae88('0x24')]();};}function saveUpdates(_0x49cce2,_0x55c179){return function(_0x4c2760){if(_0x4c2760){return _0x4c2760[_0xae88('0x25')](_0x49cce2)[_0xae88('0x26')](function(_0x3ab0d5){return _0x3ab0d5;});}return null;};}function removeEntity(_0x58343b,_0x324d3c){return function(_0x1d2876){if(_0x1d2876){return _0x1d2876['destroy']()[_0xae88('0x26')](function(){_0x58343b[_0xae88('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20dc67,_0x59c38a){return function(_0x4f21e0){if(!_0x4f21e0){_0x20dc67[_0xae88('0x1a')](0x194);}return _0x4f21e0;};}function handleError(_0xc98324,_0x21705f){_0x21705f=_0x21705f||0x1f4;return function(_0x57316b){logger[_0xae88('0x27')](_0x57316b[_0xae88('0x28')]);if(_0x57316b[_0xae88('0x29')]){delete _0x57316b[_0xae88('0x29')];}_0xc98324[_0xae88('0x1b')](_0x21705f)[_0xae88('0x2a')](_0x57316b);};}exports[_0xae88('0x2b')]=function(_0x1e1e90,_0x2d73ec){var _0x1b2cd6={},_0x9b8b4a={},_0x56dc7c={'count':0x0,'rows':[]};var _0x5e3c71=_[_0xae88('0x2c')](db[_0xae88('0x2d')][_0xae88('0x2e')],function(_0x129373){return{'name':_0x129373['fieldName'],'type':_0x129373['type'][_0xae88('0x2f')]};});_0x9b8b4a[_0xae88('0x30')]=_['map'](_0x5e3c71,_0xae88('0x29'));_0x9b8b4a[_0xae88('0x31')]=_['keys'](_0x1e1e90[_0xae88('0x31')]);_0x9b8b4a[_0xae88('0x32')]=_['intersection'](_0x9b8b4a[_0xae88('0x30')],_0x9b8b4a[_0xae88('0x31')]);_0x1b2cd6[_0xae88('0x33')]=_[_0xae88('0x34')](_0x9b8b4a[_0xae88('0x30')],qs['fields'](_0x1e1e90[_0xae88('0x31')][_0xae88('0x35')]));_0x1b2cd6[_0xae88('0x33')]=_0x1b2cd6[_0xae88('0x33')]['length']?_0x1b2cd6[_0xae88('0x33')]:_0x9b8b4a[_0xae88('0x30')];if(!_0x1e1e90[_0xae88('0x31')][_0xae88('0x36')](_0xae88('0x37'))){_0x1b2cd6[_0xae88('0x1d')]=qs['limit'](_0x1e1e90[_0xae88('0x31')][_0xae88('0x1d')]);_0x1b2cd6[_0xae88('0x1e')]=qs[_0xae88('0x1e')](_0x1e1e90['query'][_0xae88('0x1e')]);}_0x1b2cd6[_0xae88('0x38')]=qs['sort'](_0x1e1e90[_0xae88('0x31')]['sort']);_0x1b2cd6[_0xae88('0x39')]=qs[_0xae88('0x32')](_['pick'](_0x1e1e90[_0xae88('0x31')],_0x9b8b4a[_0xae88('0x32')]),_0x5e3c71);if(_0x1e1e90[_0xae88('0x31')][_0xae88('0x3a')]){_0x1b2cd6[_0xae88('0x39')]=_[_0xae88('0x3b')](_0x1b2cd6[_0xae88('0x39')],{'$or':_['map'](_0x5e3c71,function(_0x447c7c){if(_0x447c7c[_0xae88('0x3c')]!==_0xae88('0x3d')){var _0x5babcb={};_0x5babcb[_0x447c7c[_0xae88('0x29')]]={'$like':'%'+_0x1e1e90[_0xae88('0x31')][_0xae88('0x3a')]+'%'};return _0x5babcb;}})});}_0x1b2cd6=_[_0xae88('0x3b')]({},_0x1b2cd6,_0x1e1e90['options']);var _0x413d8a={'where':_0x1b2cd6[_0xae88('0x39')]};return db[_0xae88('0x2d')][_0xae88('0x1f')](_0x413d8a)[_0xae88('0x26')](function(_0x5b3ad0){_0x56dc7c[_0xae88('0x1f')]=_0x5b3ad0;if(_0x1e1e90['query'][_0xae88('0x3e')]){_0x1b2cd6[_0xae88('0x3f')]=[{'all':!![]}];}return db[_0xae88('0x2d')][_0xae88('0x40')](_0x1b2cd6);})['then'](function(_0x763ee5){_0x56dc7c[_0xae88('0x41')]=_0x763ee5;return _0x56dc7c;})['then'](respondWithFilteredResult(_0x2d73ec,_0x1b2cd6))[_0xae88('0x42')](handleError(_0x2d73ec,null));};exports[_0xae88('0x43')]=function(_0x57f69d,_0x411e42){var _0x17361e={'raw':!![],'where':{'id':_0x57f69d['params']['id']}},_0x24c738={};_0x24c738[_0xae88('0x30')]=_[_0xae88('0x44')](db[_0xae88('0x2d')][_0xae88('0x2e')]);_0x24c738[_0xae88('0x31')]=_[_0xae88('0x44')](_0x57f69d[_0xae88('0x31')]);_0x24c738[_0xae88('0x32')]=_[_0xae88('0x34')](_0x24c738[_0xae88('0x30')],_0x24c738[_0xae88('0x31')]);_0x17361e[_0xae88('0x33')]=_[_0xae88('0x34')](_0x24c738['model'],qs['fields'](_0x57f69d[_0xae88('0x31')][_0xae88('0x35')]));_0x17361e[_0xae88('0x33')]=_0x17361e[_0xae88('0x33')]['length']?_0x17361e['attributes']:_0x24c738[_0xae88('0x30')];if(_0x57f69d[_0xae88('0x31')]['includeAll']){_0x17361e[_0xae88('0x3f')]=[{'all':!![]}];}_0x17361e=_[_0xae88('0x3b')]({},_0x17361e,_0x57f69d['options']);return db['SmsApplication'][_0xae88('0x45')](_0x17361e)[_0xae88('0x26')](handleEntityNotFound(_0x411e42,null))['then'](respondWithResult(_0x411e42,null))[_0xae88('0x42')](handleError(_0x411e42,null));};exports['create']=function(_0x5365c5,_0x48834a){return db['SmsApplication'][_0xae88('0x46')](_0x5365c5[_0xae88('0x47')],{})[_0xae88('0x26')](respondWithResult(_0x48834a,0xc9))['catch'](handleError(_0x48834a,null));};exports['update']=function(_0x5d1461,_0x3d74e2){if(_0x5d1461[_0xae88('0x47')]['id']){delete _0x5d1461['body']['id'];}return db['SmsApplication'][_0xae88('0x45')]({'where':{'id':_0x5d1461[_0xae88('0x48')]['id']}})[_0xae88('0x26')](handleEntityNotFound(_0x3d74e2,null))[_0xae88('0x26')](saveUpdates(_0x5d1461[_0xae88('0x47')],null))[_0xae88('0x26')](respondWithResult(_0x3d74e2,null))[_0xae88('0x42')](handleError(_0x3d74e2,null));};exports[_0xae88('0x49')]=function(_0x33d3ee,_0x28b788){return db['SmsApplication'][_0xae88('0x45')]({'where':{'id':_0x33d3ee[_0xae88('0x48')]['id']}})[_0xae88('0x26')](handleEntityNotFound(_0x28b788,null))[_0xae88('0x26')](removeEntity(_0x28b788,null))[_0xae88('0x42')](handleError(_0x28b788,null));}; \ No newline at end of file +var _0x537e=['VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','Content-Range','update','destroy','then','error','stack','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where'];(function(_0x34fd41,_0x420cbd){var _0x2c19b4=function(_0x40b75c){while(--_0x40b75c){_0x34fd41['push'](_0x34fd41['shift']());}};_0x2c19b4(++_0x420cbd);}(_0x537e,0xe6));var _0xe537=function(_0x3d6afb,_0x2c7014){_0x3d6afb=_0x3d6afb-0x0;var _0x1cede0=_0x537e[_0x3d6afb];return _0x1cede0;};'use strict';var emlformat=require(_0xe537('0x0'));var rimraf=require(_0xe537('0x1'));var zipdir=require(_0xe537('0x2'));var jsonpatch=require(_0xe537('0x3'));var rp=require(_0xe537('0x4'));var moment=require(_0xe537('0x5'));var BPromise=require(_0xe537('0x6'));var Mustache=require(_0xe537('0x7'));var util=require('util');var path=require(_0xe537('0x8'));var sox=require('sox');var csv=require(_0xe537('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe537('0xa'));var _=require(_0xe537('0xb'));var squel=require(_0xe537('0xc'));var crypto=require(_0xe537('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe537('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe537('0xf'));var Papa=require(_0xe537('0x10'));var Redis=require(_0xe537('0x11'));var authService=require(_0xe537('0x12'));var qs=require(_0xe537('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe537('0x14'));var logger=require(_0xe537('0x15'))(_0xe537('0x16'));var utils=require(_0xe537('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe537('0x18'));var db=require(_0xe537('0x19'))['db'];function respondWithStatusCode(_0x55a557,_0x1f9680){_0x1f9680=_0x1f9680||0xcc;return function(_0x361e9c){if(_0x361e9c){return _0x55a557[_0xe537('0x1a')](_0x1f9680);}return _0x55a557[_0xe537('0x1b')](_0x1f9680)[_0xe537('0x1c')]();};}function respondWithResult(_0x4021a4,_0x4cd183){_0x4cd183=_0x4cd183||0xc8;return function(_0x2357d7){if(_0x2357d7){return _0x4021a4[_0xe537('0x1b')](_0x4cd183)[_0xe537('0x1d')](_0x2357d7);}};}function respondWithFilteredResult(_0x31d69f,_0x555b89){return function(_0x51338e){if(_0x51338e){var _0x5b5f1c=typeof _0x555b89[_0xe537('0x1e')]==='undefined'&&typeof _0x555b89['limit']==='undefined';var _0x3a99d0=_0x51338e[_0xe537('0x1f')];var _0x2293ae=_0x5b5f1c?0x0:_0x555b89[_0xe537('0x1e')];var _0x299a48=_0x5b5f1c?_0x51338e[_0xe537('0x1f')]:_0x555b89['offset']+_0x555b89['limit'];var _0x1e35b6;if(_0x299a48>=_0x3a99d0){_0x299a48=_0x3a99d0;_0x1e35b6=0xc8;}else{_0x1e35b6=0xce;}_0x31d69f[_0xe537('0x1b')](_0x1e35b6);return _0x31d69f['set'](_0xe537('0x20'),_0x2293ae+'-'+_0x299a48+'/'+_0x3a99d0)[_0xe537('0x1d')](_0x51338e);}return null;};}function patchUpdates(_0x41ca40){return function(_0x51c471){try{jsonpatch['apply'](_0x51c471,_0x41ca40,!![]);}catch(_0x243b47){return BPromise['reject'](_0x243b47);}return _0x51c471['save']();};}function saveUpdates(_0x579f2a,_0x1e84c4){return function(_0x1f6925){if(_0x1f6925){return _0x1f6925[_0xe537('0x21')](_0x579f2a)['then'](function(_0x3635cb){return _0x3635cb;});}return null;};}function removeEntity(_0x2497f4,_0x333e98){return function(_0x4cf3c8){if(_0x4cf3c8){return _0x4cf3c8[_0xe537('0x22')]()[_0xe537('0x23')](function(){_0x2497f4[_0xe537('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4207e2,_0xed4a47){return function(_0x4b103b){if(!_0x4b103b){_0x4207e2[_0xe537('0x1a')](0x194);}return _0x4b103b;};}function handleError(_0x11a83d,_0x5bd8f6){_0x5bd8f6=_0x5bd8f6||0x1f4;return function(_0x220cc2){logger[_0xe537('0x24')](_0x220cc2[_0xe537('0x25')]);if(_0x220cc2[_0xe537('0x26')]){delete _0x220cc2[_0xe537('0x26')];}_0x11a83d[_0xe537('0x1b')](_0x5bd8f6)[_0xe537('0x27')](_0x220cc2);};}exports[_0xe537('0x28')]=function(_0x531427,_0x57f50e){var _0x2e07bc={},_0x20809c={},_0x487835={'count':0x0,'rows':[]};var _0x309869=_[_0xe537('0x29')](db[_0xe537('0x2a')]['rawAttributes'],function(_0x308623){return{'name':_0x308623[_0xe537('0x2b')],'type':_0x308623[_0xe537('0x2c')][_0xe537('0x2d')]};});_0x20809c[_0xe537('0x2e')]=_['map'](_0x309869,'name');_0x20809c[_0xe537('0x2f')]=_[_0xe537('0x30')](_0x531427[_0xe537('0x2f')]);_0x20809c[_0xe537('0x31')]=_[_0xe537('0x32')](_0x20809c['model'],_0x20809c[_0xe537('0x2f')]);_0x2e07bc['attributes']=_[_0xe537('0x32')](_0x20809c['model'],qs[_0xe537('0x33')](_0x531427[_0xe537('0x2f')][_0xe537('0x33')]));_0x2e07bc[_0xe537('0x34')]=_0x2e07bc[_0xe537('0x34')][_0xe537('0x35')]?_0x2e07bc['attributes']:_0x20809c[_0xe537('0x2e')];if(!_0x531427[_0xe537('0x2f')][_0xe537('0x36')](_0xe537('0x37'))){_0x2e07bc[_0xe537('0x38')]=qs[_0xe537('0x38')](_0x531427[_0xe537('0x2f')][_0xe537('0x38')]);_0x2e07bc[_0xe537('0x1e')]=qs['offset'](_0x531427[_0xe537('0x2f')][_0xe537('0x1e')]);}_0x2e07bc['order']=qs['sort'](_0x531427[_0xe537('0x2f')]['sort']);_0x2e07bc[_0xe537('0x39')]=qs[_0xe537('0x31')](_['pick'](_0x531427[_0xe537('0x2f')],_0x20809c[_0xe537('0x31')]),_0x309869);if(_0x531427[_0xe537('0x2f')]['filter']){_0x2e07bc[_0xe537('0x39')]=_['merge'](_0x2e07bc[_0xe537('0x39')],{'$or':_[_0xe537('0x29')](_0x309869,function(_0x3a6ff3){if(_0x3a6ff3[_0xe537('0x2c')]!==_0xe537('0x3a')){var _0x2935f8={};_0x2935f8[_0x3a6ff3['name']]={'$like':'%'+_0x531427[_0xe537('0x2f')][_0xe537('0x3b')]+'%'};return _0x2935f8;}})});}_0x2e07bc=_['merge']({},_0x2e07bc,_0x531427[_0xe537('0x3c')]);var _0x5c10a3={'where':_0x2e07bc['where']};return db[_0xe537('0x2a')][_0xe537('0x1f')](_0x5c10a3)[_0xe537('0x23')](function(_0x176a6a){_0x487835[_0xe537('0x1f')]=_0x176a6a;if(_0x531427[_0xe537('0x2f')][_0xe537('0x3d')]){_0x2e07bc['include']=[{'all':!![]}];}return db[_0xe537('0x2a')][_0xe537('0x3e')](_0x2e07bc);})[_0xe537('0x23')](function(_0x285437){_0x487835[_0xe537('0x3f')]=_0x285437;return _0x487835;})[_0xe537('0x23')](respondWithFilteredResult(_0x57f50e,_0x2e07bc))[_0xe537('0x40')](handleError(_0x57f50e,null));};exports['show']=function(_0x50a5d1,_0x81ff77){var _0x2f261b={'raw':!![],'where':{'id':_0x50a5d1[_0xe537('0x41')]['id']}},_0x5bc6b7={};_0x5bc6b7[_0xe537('0x2e')]=_[_0xe537('0x30')](db['SmsApplication'][_0xe537('0x42')]);_0x5bc6b7[_0xe537('0x2f')]=_['keys'](_0x50a5d1['query']);_0x5bc6b7['filters']=_['intersection'](_0x5bc6b7[_0xe537('0x2e')],_0x5bc6b7[_0xe537('0x2f')]);_0x2f261b[_0xe537('0x34')]=_['intersection'](_0x5bc6b7[_0xe537('0x2e')],qs['fields'](_0x50a5d1['query'][_0xe537('0x33')]));_0x2f261b['attributes']=_0x2f261b[_0xe537('0x34')]['length']?_0x2f261b[_0xe537('0x34')]:_0x5bc6b7['model'];if(_0x50a5d1[_0xe537('0x2f')][_0xe537('0x3d')]){_0x2f261b[_0xe537('0x43')]=[{'all':!![]}];}_0x2f261b=_[_0xe537('0x44')]({},_0x2f261b,_0x50a5d1[_0xe537('0x3c')]);return db[_0xe537('0x2a')]['find'](_0x2f261b)[_0xe537('0x23')](handleEntityNotFound(_0x81ff77,null))[_0xe537('0x23')](respondWithResult(_0x81ff77,null))[_0xe537('0x40')](handleError(_0x81ff77,null));};exports[_0xe537('0x45')]=function(_0x37e878,_0x5985ab){return db[_0xe537('0x2a')]['create'](_0x37e878[_0xe537('0x46')],{})[_0xe537('0x23')](respondWithResult(_0x5985ab,0xc9))[_0xe537('0x40')](handleError(_0x5985ab,null));};exports[_0xe537('0x21')]=function(_0x3e14f8,_0x4acbc3){if(_0x3e14f8[_0xe537('0x46')]['id']){delete _0x3e14f8[_0xe537('0x46')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3e14f8[_0xe537('0x41')]['id']}})[_0xe537('0x23')](handleEntityNotFound(_0x4acbc3,null))[_0xe537('0x23')](saveUpdates(_0x3e14f8[_0xe537('0x46')],null))['then'](respondWithResult(_0x4acbc3,null))[_0xe537('0x40')](handleError(_0x4acbc3,null));};exports[_0xe537('0x22')]=function(_0x272711,_0x588651){return db[_0xe537('0x2a')][_0xe537('0x47')]({'where':{'id':_0x272711[_0xe537('0x41')]['id']}})[_0xe537('0x23')](handleEntityNotFound(_0x588651,null))['then'](removeEntity(_0x588651,null))['catch'](handleError(_0x588651,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 71b726c..79aa674 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 _0x5577=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications'];(function(_0x5a15b1,_0x202388){var _0x4c2df7=function(_0x32f03d){while(--_0x32f03d){_0x5a15b1['push'](_0x5a15b1['shift']());}};_0x4c2df7(++_0x202388);}(_0x5577,0x1b4));var _0x7557=function(_0x45aac5,_0x5e79a7){_0x45aac5=_0x45aac5-0x0;var _0x5d5f25=_0x5577[_0x45aac5];return _0x5d5f25;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var logger=require(_0x7557('0x1'))(_0x7557('0x2'));var moment=require('moment');var BPromise=require(_0x7557('0x3'));var rp=require(_0x7557('0x4'));var fs=require('fs');var path=require(_0x7557('0x5'));var rimraf=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var attributes=require(_0x7557('0x8'));module['exports']=function(_0x7bb8c,_0x41a4a5){return _0x7bb8c[_0x7557('0x9')](_0x7557('0xa'),attributes,{'tableName':_0x7557('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7557('0xc'),'collate':_0x7557('0xd')});}; \ No newline at end of file +var _0x3fe3=['request-promise','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fe3,0x1aa));var _0x33fe=function(_0x230020,_0x211112){_0x230020=_0x230020-0x0;var _0x2f2cf9=_0x3fe3[_0x230020];return _0x2f2cf9;};'use strict';var _=require(_0x33fe('0x0'));var util=require(_0x33fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x33fe('0x2'));var BPromise=require(_0x33fe('0x3'));var rp=require(_0x33fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33fe('0x5'));var config=require(_0x33fe('0x6'));var attributes=require(_0x33fe('0x7'));module['exports']=function(_0x1a1aaa,_0x14a73d){return _0x1a1aaa[_0x33fe('0x8')](_0x33fe('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8022e2b..67f2403 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 _0x2581=['request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','SmsApplication,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x22ecf2,_0x286aee){var _0x4ed169=function(_0x583fc5){while(--_0x583fc5){_0x22ecf2['push'](_0x22ecf2['shift']());}};_0x4ed169(++_0x286aee);}(_0x2581,0xcb));var _0x1258=function(_0x3e8412,_0x36f9d2){_0x3e8412=_0x3e8412-0x0;var _0x2e222b=_0x2581[_0x3e8412];return _0x2e222b;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file +var _0x75dd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x17d111,_0x1bcb58){var _0x152477=function(_0x3c9ef4){while(--_0x3c9ef4){_0x17d111['push'](_0x17d111['shift']());}};_0x152477(++_0x1bcb58);}(_0x75dd,0x1c9));var _0xd75d=function(_0x5c0f74,_0x1f1a2a){_0x5c0f74=_0x5c0f74-0x0;var _0x361bf7=_0x75dd[_0x5c0f74];return _0x361bf7;};'use strict';var _=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var moment=require(_0xd75d('0x2'));var BPromise=require(_0xd75d('0x3'));var rs=require(_0xd75d('0x4'));var fs=require('fs');var Redis=require(_0xd75d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd75d('0x6'));var logger=require(_0xd75d('0x7'))(_0xd75d('0x8'));var config=require(_0xd75d('0x9'));var jayson=require(_0xd75d('0xa'));var client=jayson[_0xd75d('0xb')][_0xd75d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3594fc,_0x48cce5,_0x7ad4a3){return new BPromise(function(_0x216ea5,_0x22b9f1){return client[_0xd75d('0xd')](_0x3594fc,_0x7ad4a3)['then'](function(_0x2a7bab){logger[_0xd75d('0xe')](_0xd75d('0xf'),_0x48cce5,_0xd75d('0x10'));logger[_0xd75d('0x11')](_0xd75d('0x12'),_0x48cce5,_0xd75d('0x10'),JSON[_0xd75d('0x13')](_0x2a7bab));if(_0x2a7bab['error']){if(_0x2a7bab[_0xd75d('0x14')][_0xd75d('0x15')]===0x1f4){logger['error'](_0xd75d('0xf'),_0x48cce5,_0x2a7bab[_0xd75d('0x14')]['message']);return _0x22b9f1(_0x2a7bab[_0xd75d('0x14')][_0xd75d('0x16')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x48cce5,_0x2a7bab[_0xd75d('0x14')][_0xd75d('0x16')]);return _0x216ea5(_0x2a7bab[_0xd75d('0x14')]['message']);}else{logger[_0xd75d('0xe')]('SmsApplication,\x20%s,\x20%s',_0x48cce5,'request\x20sent');_0x216ea5(_0x2a7bab['result'][_0xd75d('0x16')]);}})[_0xd75d('0x17')](function(_0x5b1c56){logger['error'](_0xd75d('0xf'),_0x48cce5,_0x5b1c56);_0x22b9f1(_0x5b1c56);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 16d04b5..394e5b5 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(_0xaed8d4,_0x551b46){var _0xabb0d0=function(_0x4c0e48){while(--_0x4c0e48){_0xaed8d4['push'](_0xaed8d4['shift']());}};_0xabb0d0(++_0x551b46);}(_0xea28,0x13a));var _0x8ea2=function(_0x1013d8,_0x23cab2){_0x1013d8=_0x1013d8-0x0;var _0x3a2944=_0xea28[_0x1013d8];return _0x3a2944;};'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 _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4213,0x77));var _0x3421=function(_0x57b9fa,_0x286926){_0x57b9fa=_0x57b9fa-0x0;var _0x2f9f6b=_0x4213[_0x57b9fa];return _0x2f9f6b;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4039566..1768c2a 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 _0xc7da=['out','INTEGER','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0xc7da,0xf2));var _0xac7d=function(_0x3ed296,_0x2d0770){_0x3ed296=_0x3ed296-0x0;var _0x2abb65=_0xc7da[_0x3ed296];return _0x2abb65;};'use strict';var Sequelize=require(_0xac7d('0x0'));var moment=require(_0xac7d('0x1'));module[_0xac7d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xac7d('0x3')]},'disposition':{'type':Sequelize[_0xac7d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xac7d('0x4')]},'note':{'type':Sequelize[_0xac7d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xac7d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xac7d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xac7d('0x7')]}}; \ No newline at end of file +var _0xf9e5=['out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2d7120,_0x4f30c3){var _0x5562d9=function(_0xdbe18a){while(--_0xdbe18a){_0x2d7120['push'](_0x2d7120['shift']());}};_0x5562d9(++_0x4f30c3);}(_0xf9e5,0x89));var _0x5f9e=function(_0xd22364,_0x28b56e){_0xd22364=_0xd22364-0x0;var _0x421827=_0xf9e5[_0xd22364];return _0x421827;};'use strict';var Sequelize=require(_0x5f9e('0x0'));var moment=require(_0x5f9e('0x1'));module[_0x5f9e('0x2')]={'closed':{'type':Sequelize[_0x5f9e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f9e('0x4')]},'disposition':{'type':Sequelize[_0x5f9e('0x5')]},'secondDisposition':{'type':Sequelize[_0x5f9e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5f9e('0x5')]},'phone':{'type':Sequelize[_0x5f9e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5f9e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5f9e('0x6')]('in',_0x5f9e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5f9e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8e98cbb..34138c7 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 _0x8d1f=['Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','createdAt','out','firstName','value','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','key','getOptions','findAll','sms','query','user','catch','params','model','keys','filters','attributes','length','merge','find','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','intersection','fields','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','split','format','includeAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync'];(function(_0x53fb63,_0x2497b0){var _0x3fd488=function(_0x41848a){while(--_0x41848a){_0x53fb63['push'](_0x53fb63['shift']());}};_0x3fd488(++_0x2497b0);}(_0x8d1f,0x1d0));var _0xf8d1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8d1f[_0x178e48];return _0x440d7e;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf8d1('0x0'));var util=require(_0xf8d1('0x1'));var path=require(_0xf8d1('0x2'));var ejs=require(_0xf8d1('0x3'));var fs=require('fs');var _=require(_0xf8d1('0x4'));var Redis=require(_0xf8d1('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf8d1('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf8d1('0x7'));var config=require(_0xf8d1('0x8'));var db=require(_0xf8d1('0x9'))['db'];config[_0xf8d1('0xa')]=_['defaults'](config[_0xf8d1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8d1('0xb'))(new Redis(config['redis']));require(_0xf8d1('0xc'))[_0xf8d1('0xd')](socket);function respondWithStatusCode(_0xccbab8,_0x39c765){_0x39c765=_0x39c765||0xcc;return function(_0x4ee830){if(_0x4ee830){return _0xccbab8[_0xf8d1('0xe')](_0x39c765);}return _0xccbab8[_0xf8d1('0xf')](_0x39c765)[_0xf8d1('0x10')]();};}function respondWithResult(_0x445d20,_0x195fab){_0x195fab=_0x195fab||0xc8;return function(_0x20d890){if(_0x20d890){return _0x445d20[_0xf8d1('0xf')](_0x195fab)['json'](_0x20d890);}};}function respondWithFilteredResult(_0x181f53,_0x5a0580){return function(_0x160340){if(_0x160340){var _0x502bb4=typeof _0x5a0580['offset']==='undefined'&&typeof _0x5a0580['limit']==='undefined';var _0x5b36bf=_0x160340[_0xf8d1('0x11')];var _0x469204=_0x502bb4?0x0:_0x5a0580[_0xf8d1('0x12')];var _0x10ab19=_0x502bb4?_0x160340[_0xf8d1('0x11')]:_0x5a0580[_0xf8d1('0x12')]+_0x5a0580[_0xf8d1('0x13')];var _0x51922b;if(_0x10ab19>=_0x5b36bf){_0x10ab19=_0x5b36bf;_0x51922b=0xc8;}else{_0x51922b=0xce;}_0x181f53[_0xf8d1('0xf')](_0x51922b);return _0x181f53['set'](_0xf8d1('0x14'),_0x469204+'-'+_0x10ab19+'/'+_0x5b36bf)['json'](_0x160340);}return null;};}function saveUpdates(_0x4c5b6e){return function(_0x451521){if(_0x451521){return _0x451521[_0xf8d1('0x15')](_0x4c5b6e)[_0xf8d1('0x16')](function(_0x4de1bc){return _0x4de1bc;});}return null;};}function removeEntity(_0x29359e){return function(_0x15f772){if(_0x15f772){return _0x15f772['destroy']()[_0xf8d1('0x16')](function(){_0x29359e[_0xf8d1('0xf')](0xcc)[_0xf8d1('0x10')]();});}};}function handleEntityNotFound(_0x183a40){return function(_0x642f08){if(!_0x642f08){_0x183a40[_0xf8d1('0xe')](0x194);}return _0x642f08;};}function handleError(_0x450087,_0x504278){_0x504278=_0x504278||0x1f4;return function(_0x17596a){logger['error'](_0x17596a[_0xf8d1('0x17')]);if(_0x17596a[_0xf8d1('0x18')]){delete _0x17596a[_0xf8d1('0x18')];}_0x450087['status'](_0x504278)[_0xf8d1('0x19')](_0x17596a);};}exports[_0xf8d1('0x1a')]=function(_0x2659b2,_0x5827f9){var _0x27950a={};var _0x48f185=_[_0xf8d1('0x1b')](db[_0xf8d1('0x1c')][_0xf8d1('0x1d')],function(_0x56f1ad){return{'name':_0x56f1ad['fieldName'],'type':_0x56f1ad['type'][_0xf8d1('0x1e')]};});_0x27950a=qs[_0xf8d1('0x1f')](_0x48f185,_0x2659b2);return interaction[_0xf8d1('0x20')](_0xf8d1('0x21'),_0x2659b2[_0xf8d1('0x22')],_0x2659b2[_0xf8d1('0x23')],_0x27950a,_0x48f185)[_0xf8d1('0x16')](respondWithFilteredResult(_0x5827f9,_0x27950a))[_0xf8d1('0x24')](handleError(_0x5827f9,null));};exports['show']=function(_0x3de57d,_0x3dce64){var _0x5cf4eb={'raw':![],'where':{'id':_0x3de57d[_0xf8d1('0x25')]['id']}},_0x7a1058={};_0x7a1058[_0xf8d1('0x26')]=_[_0xf8d1('0x27')](db[_0xf8d1('0x1c')][_0xf8d1('0x1d')]);_0x7a1058['query']=_[_0xf8d1('0x27')](_0x3de57d[_0xf8d1('0x22')]);_0x7a1058[_0xf8d1('0x28')]=_['intersection'](_0x7a1058[_0xf8d1('0x26')],_0x7a1058[_0xf8d1('0x22')]);_0x5cf4eb[_0xf8d1('0x29')]=_['intersection'](_0x7a1058[_0xf8d1('0x26')],qs['fields'](_0x3de57d[_0xf8d1('0x22')]['fields']));_0x5cf4eb[_0xf8d1('0x29')]=_0x5cf4eb[_0xf8d1('0x29')][_0xf8d1('0x2a')]?_0x5cf4eb['attributes']:_0x7a1058[_0xf8d1('0x26')];if(_0x3de57d[_0xf8d1('0x22')]['includeAll']){_0x5cf4eb['include']=[{'all':!![]}];}_0x5cf4eb=_[_0xf8d1('0x2b')]({},_0x5cf4eb,_0x3de57d['options']);return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')](_0x5cf4eb)[_0xf8d1('0x16')](handleEntityNotFound(_0x3dce64,null))[_0xf8d1('0x16')](respondWithResult(_0x3dce64,null))[_0xf8d1('0x24')](handleError(_0x3dce64,null));};exports[_0xf8d1('0x2d')]=function(_0x2dda99,_0x2a1617){return db[_0xf8d1('0x1c')][_0xf8d1('0x2d')](_0x2dda99[_0xf8d1('0x2e')],{})[_0xf8d1('0x16')](respondWithResult(_0x2a1617,0xc9))[_0xf8d1('0x24')](handleError(_0x2a1617,null));};exports[_0xf8d1('0x15')]=function(_0x5f330b,_0x4941e9){if(_0x5f330b[_0xf8d1('0x2e')]['id']){delete _0x5f330b['body']['id'];}return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x5f330b[_0xf8d1('0x25')]['id']}})['then'](handleEntityNotFound(_0x4941e9,null))[_0xf8d1('0x16')](saveUpdates(_0x5f330b[_0xf8d1('0x2e')],null))[_0xf8d1('0x16')](respondWithResult(_0x4941e9,null))[_0xf8d1('0x24')](handleError(_0x4941e9,null));};exports['destroy']=function(_0x575ab7,_0x5728c7){return db['SmsInteraction'][_0xf8d1('0x2c')]({'where':{'id':_0x575ab7[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x5728c7,null))[_0xf8d1('0x16')](removeEntity(_0x5728c7,null))['catch'](handleError(_0x5728c7,null));};exports[_0xf8d1('0x2f')]=function(_0x5ee993,_0x219b7c){return db[_0xf8d1('0x1c')][_0xf8d1('0x2f')]()[_0xf8d1('0x16')](respondWithResult(_0x219b7c,null))[_0xf8d1('0x24')](handleError(_0x219b7c,null));};exports[_0xf8d1('0x30')]=function(_0x34ad30,_0x270ca4){return db[_0xf8d1('0x31')][_0xf8d1('0x2c')]({'where':{'id':_0x34ad30[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x270ca4,null))[_0xf8d1('0x16')](function(_0x143fd5){if(_0x143fd5){return _0x143fd5[_0xf8d1('0x30')](_0x34ad30['body']['ids'],_[_0xf8d1('0x32')](_0x34ad30[_0xf8d1('0x2e')],[_0xf8d1('0x33'),'id'])||{});}})[_0xf8d1('0x16')](respondWithResult(_0x270ca4,null))['catch'](handleError(_0x270ca4,null));};exports[_0xf8d1('0x34')]=function(_0x1c6388,_0x563485){var _0x1a1a41={'raw':![],'where':{}};var _0xf0592c={};var _0x1fc74c={'count':0x0,'rows':[]};return db[_0xf8d1('0x1c')][_0xf8d1('0x35')]({'where':{'id':_0x1c6388[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x563485,null))['then'](function(_0x3c668f){if(_0x3c668f){_0xf0592c[_0xf8d1('0x26')]=_['keys'](db[_0xf8d1('0x31')]['rawAttributes']);_0xf0592c[_0xf8d1('0x22')]=_[_0xf8d1('0x27')](_0x1c6388['query']);_0xf0592c[_0xf8d1('0x28')]=_['intersection'](_0xf0592c[_0xf8d1('0x26')],_0xf0592c[_0xf8d1('0x22')]);_0x1a1a41[_0xf8d1('0x29')]=_[_0xf8d1('0x36')](_0xf0592c[_0xf8d1('0x26')],qs['fields'](_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x37')]));_0x1a1a41['attributes']=_0x1a1a41['attributes'][_0xf8d1('0x2a')]?_0x1a1a41[_0xf8d1('0x29')]:_0xf0592c[_0xf8d1('0x26')];if(!_0x1c6388['query'][_0xf8d1('0x38')](_0xf8d1('0x39'))){_0x1a1a41[_0xf8d1('0x13')]=qs[_0xf8d1('0x13')](_0x1c6388['query'][_0xf8d1('0x13')]);_0x1a1a41[_0xf8d1('0x12')]=qs[_0xf8d1('0x12')](_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x12')]);}_0x1a1a41['order']=qs[_0xf8d1('0x3a')](_0x1c6388['query'][_0xf8d1('0x3a')]);_0x1a1a41['where']=qs['filters'](_['pick'](_0x1c6388['query'],_0xf0592c[_0xf8d1('0x28')]));_0x1a1a41[_0xf8d1('0x3b')][_0xf8d1('0x3c')]=_0x3c668f['id'];if(_0x1c6388[_0xf8d1('0x22')]['filter']){_0x1a1a41['where']=_['merge'](_0x1a1a41[_0xf8d1('0x3b')],{'$or':_['map'](_0x1a1a41[_0xf8d1('0x29')],function(_0x5906e2){var _0x2ce356={};_0x2ce356[_0x5906e2]={'$like':'%'+_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x3d')]+'%'};return _0x2ce356;})});}if(_0x1c6388['query']['$gte']){var _0x4a066a=_0x1c6388[_0xf8d1('0x22')]['$gte'][_0xf8d1('0x3e')](',');var _0x4cf194={};_0x4cf194[_0x4a066a[0x0]]={'$gte':moment(_0x4a066a[0x1])[_0xf8d1('0x3f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a1a41[_0xf8d1('0x3b')]=_[_0xf8d1('0x2b')](_0x1a1a41[_0xf8d1('0x3b')],_0x4cf194);}_0x1a1a41=_[_0xf8d1('0x2b')]({},_0x1a1a41,_0x1c6388['options']);return db[_0xf8d1('0x31')]['count']({'where':_0x1a1a41['where']})[_0xf8d1('0x16')](function(_0xe058ee){_0x1fc74c[_0xf8d1('0x11')]=_0xe058ee;if(_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x40')]){_0x1a1a41['include']=[{'all':!![]}];}return db['SmsMessage'][_0xf8d1('0x20')](_0x1a1a41);})['then'](function(_0x4c2932){_0x1fc74c[_0xf8d1('0x41')]=_0x4c2932;return _0x1fc74c;});}})['then'](respondWithFilteredResult(_0x563485,_0x1a1a41))['catch'](handleError(_0x563485,null));};exports[_0xf8d1('0x42')]=function(_0x53aacd,_0x50b7da){return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x53aacd['params']['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x50b7da,null))[_0xf8d1('0x16')](function(_0x3ae8f8){if(_0x3ae8f8){return _0x3ae8f8[_0xf8d1('0x43')](_0x53aacd[_0xf8d1('0x2e')][_0xf8d1('0x33')],_['omit'](_0x53aacd['body'],['ids','id'])||{})[_0xf8d1('0x44')](function(){return db[_0xf8d1('0x45')][_0xf8d1('0x20')]({'attributes':['id',_0xf8d1('0x18'),_0xf8d1('0x46')],'where':{'id':_0x53aacd[_0xf8d1('0x2e')]['ids']}});})[_0xf8d1('0x16')](function(_0x2b4f4b){socket[_0xf8d1('0x47')](_0xf8d1('0x48'),{'id':Number(_0x53aacd[_0xf8d1('0x25')]['id']),'tags':_0x2b4f4b||[]});return{'id':Number(_0x53aacd['params']['id']),'tags':_0x2b4f4b||[]};});}})['then'](respondWithResult(_0x50b7da,null))[_0xf8d1('0x24')](handleError(_0x50b7da,null));};exports['removeTags']=function(_0x44c109,_0x1e131f){return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x44c109['params']['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x1e131f,null))[_0xf8d1('0x16')](function(_0x5dcb03){if(_0x5dcb03){return _0x5dcb03[_0xf8d1('0x49')](_0x44c109[_0xf8d1('0x22')][_0xf8d1('0x33')]);}})[_0xf8d1('0x16')](respondWithStatusCode(_0x1e131f,null))[_0xf8d1('0x24')](handleError(_0x1e131f,null));};exports[_0xf8d1('0x4a')]=function(_0x392d88,_0x5e5726){var _0x35a28f=moment()[_0xf8d1('0x4b')]()[_0xf8d1('0x4c')]();var _0x3e6f95=path[_0xf8d1('0x4d')](config['root'],_0xf8d1('0x4e'),_0xf8d1('0x4f'),'tmp');var _0x33f69b=path[_0xf8d1('0x4d')](_0x3e6f95,_0x35a28f);var _0x1d0e37=util[_0xf8d1('0x3f')](_0xf8d1('0x50'),_0x392d88['params']['id'],_0x35a28f);var _0x307415=path[_0xf8d1('0x4d')](_0x3e6f95,_0x1d0e37);var _0x46f7fd=[];_0x46f7fd[_0xf8d1('0x51')]({'model':db['User'],'as':_0xf8d1('0x52'),'attributes':['id',_0xf8d1('0x53')],'raw':!![]});_0x46f7fd[_0xf8d1('0x51')]({'model':db[_0xf8d1('0x54')],'as':_0xf8d1('0x55'),'attributes':['id','firstName',_0xf8d1('0x56')],'raw':!![]});var _0x50bf52=[{'model':db['SmsMessage'],'as':_0xf8d1('0x57'),'attributes':['id',_0xf8d1('0x2e'),'createdAt',_0xf8d1('0x58'),_0xf8d1('0x59'),_0xf8d1('0x5a')],'include':_0x46f7fd}];_0x50bf52['push']({'model':db[_0xf8d1('0x5b')],'as':_0xf8d1('0x5c'),'attributes':['id','name']});_0x50bf52[_0xf8d1('0x51')]({'model':db[_0xf8d1('0x52')],'as':_0xf8d1('0x5d'),'attributes':['id',_0xf8d1('0x53')]});return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x392d88['params']['id']},'include':_0x50bf52})[_0xf8d1('0x16')](handleEntityNotFound(_0x5e5726,null))[_0xf8d1('0x16')](function(_0x2891e3){if(_0x2891e3){var _0x2ceca9=_0x2891e3[_0xf8d1('0x5e')]({'plain':!![]});fs[_0xf8d1('0x5f')](_0x33f69b);var _0x10ef19={'channel':_0xf8d1('0x60'),'account':_0x2ceca9[_0xf8d1('0x5c')][_0xf8d1('0x18')],'agent':_0x2ceca9[_0xf8d1('0x5d')]?_0x2ceca9[_0xf8d1('0x5d')][_0xf8d1('0x53')]:_0xf8d1('0x61'),'createdAt':moment(_0x2ceca9['createdAt'])[_0xf8d1('0x3f')](_0xf8d1('0x62'))[_0xf8d1('0x4c')](),'closedAt':_0x2ceca9[_0xf8d1('0x63')]?moment(_0x2ceca9['closedAt'])['format'](_0xf8d1('0x62'))[_0xf8d1('0x4c')]():'','disposition':_0x2ceca9['disposition'],'messages':_(_0x2ceca9[_0xf8d1('0x57')])[_0xf8d1('0x3d')]({'secret':![]})[_0xf8d1('0x1b')](function(_0x3b3fb6){return{'date':moment(_0x3b3fb6[_0xf8d1('0x64')])['format'](_0xf8d1('0x62'))['toString'](),'sender':_0x3b3fb6[_0xf8d1('0x58')]===_0xf8d1('0x65')?_0x3b3fb6['User']?_0x3b3fb6[_0xf8d1('0x52')][_0xf8d1('0x53')]:'System':_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x66')]+(_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x56')]?'\x20'+_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x56')]:''),'body':_0x3b3fb6['body'],'direction':_0x3b3fb6[_0xf8d1('0x58')]===_0xf8d1('0x65')?'A':'C','secret':_0x3b3fb6['secret'],'read':_0x3b3fb6[_0xf8d1('0x5a')]};})[_0xf8d1('0x67')]()};return ejs['renderFile'](path[_0xf8d1('0x4d')](config[_0xf8d1('0x68')],_0xf8d1('0x4e'),_0xf8d1('0x69'),_0xf8d1('0x6a')),{'interaction':_0x10ef19})[_0xf8d1('0x16')](function(_0x2e0418){var _0x5f41ac=path[_0xf8d1('0x4d')](_0x33f69b,_0xf8d1('0x6b')+_0x2ceca9['id']+'-'+_0x35a28f+_0xf8d1('0x6c'));var _0x166cd2={'path':_0x5f41ac,'channel':_0xf8d1('0x60'),'interactionId':_0x2ceca9['id']};return pdf[_0xf8d1('0x6d')](_0x2e0418,_0x166cd2);})[_0xf8d1('0x16')](function(){return new BPromise(function(_0xb711c7,_0x14632b){zipdir(_0x33f69b,{'saveTo':_0x307415},function(_0x2f0ab3,_0x4c1146){if(_0x2f0ab3)return _0x14632b(_0x2f0ab3);return _0xb711c7(_0x4c1146);});})[_0xf8d1('0x16')](function(){return new BPromise(function(_0x450c86,_0x556263){rimraf(_0x33f69b,function(_0x3aed48){if(_0x3aed48)_0x556263(_0x3aed48);return _0x450c86();});});})[_0xf8d1('0x16')](function(){return _0x5e5726[_0xf8d1('0x4a')](_0x307415,_0x1d0e37,function(_0x27084b){if(_0x27084b){console[_0xf8d1('0x6e')](_0xf8d1('0x6f'),_0x27084b);}else{fs['unlinkSync'](_0x307415);}});});});}else{return _0x5e5726[_0xf8d1('0xe')](0xc8);}})[_0xf8d1('0x24')](handleError(_0x5e5726,null));}; \ No newline at end of file +var _0x0807=['intersection','attributes','fields','length','includeAll','include','merge','options','SmsInteraction','create','body','update','find','describe','SmsMessage','ids','omit','findOne','filters','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','tmp','push','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','Owner','mkdirSync','Sms','Account','N.A.','closed','disposition','map','System','Contact','out','read','renderFile','root','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','index','fieldName','key','getOptions','findAll','sms','query','catch','show','params','model','rawAttributes','keys'];(function(_0x492c9a,_0x3d8925){var _0x5e0566=function(_0x7879b2){while(--_0x7879b2){_0x492c9a['push'](_0x492c9a['shift']());}};_0x5e0566(++_0x3d8925);}(_0x0807,0xbc));var _0x7080=function(_0x4657db,_0xed4ce0){_0x4657db=_0x4657db-0x0;var _0x3b3c45=_0x0807[_0x4657db];return _0x3b3c45;};'use strict';var rimraf=require(_0x7080('0x0'));var zipdir=require(_0x7080('0x1'));var moment=require('moment');var BPromise=require(_0x7080('0x2'));var util=require(_0x7080('0x3'));var path=require(_0x7080('0x4'));var ejs=require(_0x7080('0x5'));var fs=require('fs');var _=require(_0x7080('0x6'));var Redis=require(_0x7080('0x7'));var interaction=require(_0x7080('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7080('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x7080('0xa'));var db=require(_0x7080('0xb'))['db'];config[_0x7080('0xc')]=_[_0x7080('0xd')](config[_0x7080('0xc')],{'host':_0x7080('0xe'),'port':0x18eb});var socket=require(_0x7080('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0xec2737,_0x53cb14){_0x53cb14=_0x53cb14||0xcc;return function(_0x4570c5){if(_0x4570c5){return _0xec2737['sendStatus'](_0x53cb14);}return _0xec2737[_0x7080('0x10')](_0x53cb14)['end']();};}function respondWithResult(_0xcade61,_0x21c98a){_0x21c98a=_0x21c98a||0xc8;return function(_0x517a0d){if(_0x517a0d){return _0xcade61[_0x7080('0x10')](_0x21c98a)[_0x7080('0x11')](_0x517a0d);}};}function respondWithFilteredResult(_0xc10c8b,_0x20e26d){return function(_0x597dd7){if(_0x597dd7){var _0x2b2c6b=typeof _0x20e26d['offset']===_0x7080('0x12')&&typeof _0x20e26d[_0x7080('0x13')]===_0x7080('0x12');var _0x535feb=_0x597dd7[_0x7080('0x14')];var _0x56e948=_0x2b2c6b?0x0:_0x20e26d[_0x7080('0x15')];var _0x84c434=_0x2b2c6b?_0x597dd7[_0x7080('0x14')]:_0x20e26d[_0x7080('0x15')]+_0x20e26d[_0x7080('0x13')];var _0x160a65;if(_0x84c434>=_0x535feb){_0x84c434=_0x535feb;_0x160a65=0xc8;}else{_0x160a65=0xce;}_0xc10c8b[_0x7080('0x10')](_0x160a65);return _0xc10c8b[_0x7080('0x16')](_0x7080('0x17'),_0x56e948+'-'+_0x84c434+'/'+_0x535feb)[_0x7080('0x11')](_0x597dd7);}return null;};}function saveUpdates(_0x4dd9bb){return function(_0x82b0df){if(_0x82b0df){return _0x82b0df['update'](_0x4dd9bb)[_0x7080('0x18')](function(_0x120c7e){return _0x120c7e;});}return null;};}function removeEntity(_0x3667cc){return function(_0x519481){if(_0x519481){return _0x519481[_0x7080('0x19')]()[_0x7080('0x18')](function(){_0x3667cc[_0x7080('0x10')](0xcc)[_0x7080('0x1a')]();});}};}function handleEntityNotFound(_0x299772){return function(_0x1c4364){if(!_0x1c4364){_0x299772[_0x7080('0x1b')](0x194);}return _0x1c4364;};}function handleError(_0x2cfc8f,_0x4adae3){_0x4adae3=_0x4adae3||0x1f4;return function(_0x22cd18){logger[_0x7080('0x1c')](_0x22cd18[_0x7080('0x1d')]);if(_0x22cd18[_0x7080('0x1e')]){delete _0x22cd18['name'];}_0x2cfc8f[_0x7080('0x10')](_0x4adae3)['send'](_0x22cd18);};}exports[_0x7080('0x1f')]=function(_0x4e0546,_0x4a6da8){var _0x3ae0be={};var _0x5a901e=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x223cff){return{'name':_0x223cff[_0x7080('0x20')],'type':_0x223cff['type'][_0x7080('0x21')]};});_0x3ae0be=qs[_0x7080('0x22')](_0x5a901e,_0x4e0546);return interaction[_0x7080('0x23')](_0x7080('0x24'),_0x4e0546[_0x7080('0x25')],_0x4e0546['user'],_0x3ae0be,_0x5a901e)[_0x7080('0x18')](respondWithFilteredResult(_0x4a6da8,_0x3ae0be))[_0x7080('0x26')](handleError(_0x4a6da8,null));};exports[_0x7080('0x27')]=function(_0x5a2a66,_0x38e38b){var _0x3a090a={'raw':![],'where':{'id':_0x5a2a66[_0x7080('0x28')]['id']}},_0x37de80={};_0x37de80[_0x7080('0x29')]=_['keys'](db['SmsInteraction'][_0x7080('0x2a')]);_0x37de80[_0x7080('0x25')]=_[_0x7080('0x2b')](_0x5a2a66[_0x7080('0x25')]);_0x37de80['filters']=_[_0x7080('0x2c')](_0x37de80['model'],_0x37de80[_0x7080('0x25')]);_0x3a090a[_0x7080('0x2d')]=_[_0x7080('0x2c')](_0x37de80['model'],qs['fields'](_0x5a2a66['query'][_0x7080('0x2e')]));_0x3a090a[_0x7080('0x2d')]=_0x3a090a['attributes'][_0x7080('0x2f')]?_0x3a090a[_0x7080('0x2d')]:_0x37de80[_0x7080('0x29')];if(_0x5a2a66['query'][_0x7080('0x30')]){_0x3a090a[_0x7080('0x31')]=[{'all':!![]}];}_0x3a090a=_[_0x7080('0x32')]({},_0x3a090a,_0x5a2a66[_0x7080('0x33')]);return db[_0x7080('0x34')]['find'](_0x3a090a)['then'](handleEntityNotFound(_0x38e38b,null))['then'](respondWithResult(_0x38e38b,null))[_0x7080('0x26')](handleError(_0x38e38b,null));};exports[_0x7080('0x35')]=function(_0xbea5f6,_0x5a795e){return db[_0x7080('0x34')][_0x7080('0x35')](_0xbea5f6[_0x7080('0x36')],{})[_0x7080('0x18')](respondWithResult(_0x5a795e,0xc9))[_0x7080('0x26')](handleError(_0x5a795e,null));};exports[_0x7080('0x37')]=function(_0x3d34c3,_0x5d8366){if(_0x3d34c3[_0x7080('0x36')]['id']){delete _0x3d34c3[_0x7080('0x36')]['id'];}return db[_0x7080('0x34')]['find']({'where':{'id':_0x3d34c3['params']['id']}})[_0x7080('0x18')](handleEntityNotFound(_0x5d8366,null))[_0x7080('0x18')](saveUpdates(_0x3d34c3[_0x7080('0x36')],null))[_0x7080('0x18')](respondWithResult(_0x5d8366,null))[_0x7080('0x26')](handleError(_0x5d8366,null));};exports[_0x7080('0x19')]=function(_0x6f8458,_0x4f6f99){return db[_0x7080('0x34')][_0x7080('0x38')]({'where':{'id':_0x6f8458[_0x7080('0x28')]['id']}})[_0x7080('0x18')](handleEntityNotFound(_0x4f6f99,null))[_0x7080('0x18')](removeEntity(_0x4f6f99,null))[_0x7080('0x26')](handleError(_0x4f6f99,null));};exports[_0x7080('0x39')]=function(_0x1864ba,_0x5b422e){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x5b422e,null))[_0x7080('0x26')](handleError(_0x5b422e,null));};exports['addMessage']=function(_0x2bb69b,_0x2e2792){return db[_0x7080('0x3a')]['find']({'where':{'id':_0x2bb69b['params']['id']}})[_0x7080('0x18')](handleEntityNotFound(_0x2e2792,null))[_0x7080('0x18')](function(_0x4587f9){if(_0x4587f9){return _0x4587f9['addMessage'](_0x2bb69b['body'][_0x7080('0x3b')],_[_0x7080('0x3c')](_0x2bb69b[_0x7080('0x36')],[_0x7080('0x3b'),'id'])||{});}})[_0x7080('0x18')](respondWithResult(_0x2e2792,null))[_0x7080('0x26')](handleError(_0x2e2792,null));};exports['getMessages']=function(_0x3a4d0b,_0x5f5530){var _0x528552={'raw':![],'where':{}};var _0x321525={};var _0xa9e3c5={'count':0x0,'rows':[]};return db[_0x7080('0x34')][_0x7080('0x3d')]({'where':{'id':_0x3a4d0b[_0x7080('0x28')]['id']}})[_0x7080('0x18')](handleEntityNotFound(_0x5f5530,null))['then'](function(_0x263348){if(_0x263348){_0x321525[_0x7080('0x29')]=_['keys'](db['SmsMessage'][_0x7080('0x2a')]);_0x321525['query']=_[_0x7080('0x2b')](_0x3a4d0b[_0x7080('0x25')]);_0x321525[_0x7080('0x3e')]=_[_0x7080('0x2c')](_0x321525[_0x7080('0x29')],_0x321525[_0x7080('0x25')]);_0x528552[_0x7080('0x2d')]=_[_0x7080('0x2c')](_0x321525[_0x7080('0x29')],qs['fields'](_0x3a4d0b[_0x7080('0x25')][_0x7080('0x2e')]));_0x528552['attributes']=_0x528552['attributes']['length']?_0x528552[_0x7080('0x2d')]:_0x321525[_0x7080('0x29')];if(!_0x3a4d0b[_0x7080('0x25')][_0x7080('0x3f')](_0x7080('0x40'))){_0x528552[_0x7080('0x13')]=qs['limit'](_0x3a4d0b['query'][_0x7080('0x13')]);_0x528552[_0x7080('0x15')]=qs['offset'](_0x3a4d0b[_0x7080('0x25')][_0x7080('0x15')]);}_0x528552[_0x7080('0x41')]=qs[_0x7080('0x42')](_0x3a4d0b[_0x7080('0x25')][_0x7080('0x42')]);_0x528552[_0x7080('0x43')]=qs[_0x7080('0x3e')](_['pick'](_0x3a4d0b['query'],_0x321525[_0x7080('0x3e')]));_0x528552[_0x7080('0x43')][_0x7080('0x44')]=_0x263348['id'];if(_0x3a4d0b[_0x7080('0x25')][_0x7080('0x45')]){_0x528552[_0x7080('0x43')]=_[_0x7080('0x32')](_0x528552[_0x7080('0x43')],{'$or':_['map'](_0x528552[_0x7080('0x2d')],function(_0x1f8a93){var _0x577cca={};_0x577cca[_0x1f8a93]={'$like':'%'+_0x3a4d0b[_0x7080('0x25')][_0x7080('0x45')]+'%'};return _0x577cca;})});}if(_0x3a4d0b[_0x7080('0x25')][_0x7080('0x46')]){var _0x4a60f1=_0x3a4d0b[_0x7080('0x25')][_0x7080('0x46')][_0x7080('0x47')](',');var _0x32e325={};_0x32e325[_0x4a60f1[0x0]]={'$gte':moment(_0x4a60f1[0x1])[_0x7080('0x48')](_0x7080('0x49'))};_0x528552[_0x7080('0x43')]=_[_0x7080('0x32')](_0x528552[_0x7080('0x43')],_0x32e325);}_0x528552=_[_0x7080('0x32')]({},_0x528552,_0x3a4d0b[_0x7080('0x33')]);return db['SmsMessage'][_0x7080('0x14')]({'where':_0x528552[_0x7080('0x43')]})[_0x7080('0x18')](function(_0x27f5b3){_0xa9e3c5[_0x7080('0x14')]=_0x27f5b3;if(_0x3a4d0b[_0x7080('0x25')][_0x7080('0x30')]){_0x528552[_0x7080('0x31')]=[{'all':!![]}];}return db[_0x7080('0x3a')][_0x7080('0x23')](_0x528552);})['then'](function(_0x73532d){_0xa9e3c5[_0x7080('0x4a')]=_0x73532d;return _0xa9e3c5;});}})[_0x7080('0x18')](respondWithFilteredResult(_0x5f5530,_0x528552))[_0x7080('0x26')](handleError(_0x5f5530,null));};exports[_0x7080('0x4b')]=function(_0x1fc77c,_0x359109){return db['SmsInteraction'][_0x7080('0x38')]({'where':{'id':_0x1fc77c[_0x7080('0x28')]['id']}})[_0x7080('0x18')](handleEntityNotFound(_0x359109,null))[_0x7080('0x18')](function(_0x359e91){if(_0x359e91){return _0x359e91['setTags'](_0x1fc77c[_0x7080('0x36')][_0x7080('0x3b')],_['omit'](_0x1fc77c[_0x7080('0x36')],['ids','id'])||{})[_0x7080('0x4c')](function(){return db['Tag'][_0x7080('0x23')]({'attributes':['id','name',_0x7080('0x4d')],'where':{'id':_0x1fc77c['body'][_0x7080('0x3b')]}});})[_0x7080('0x18')](function(_0x50c6e9){socket[_0x7080('0x4e')](_0x7080('0x4f'),{'id':Number(_0x1fc77c[_0x7080('0x28')]['id']),'tags':_0x50c6e9||[]});return{'id':Number(_0x1fc77c['params']['id']),'tags':_0x50c6e9||[]};});}})['then'](respondWithResult(_0x359109,null))[_0x7080('0x26')](handleError(_0x359109,null));};exports[_0x7080('0x50')]=function(_0x2ab9f8,_0x241fa9){return db['SmsInteraction'][_0x7080('0x38')]({'where':{'id':_0x2ab9f8[_0x7080('0x28')]['id']}})['then'](handleEntityNotFound(_0x241fa9,null))[_0x7080('0x18')](function(_0x47c9ff){if(_0x47c9ff){return _0x47c9ff[_0x7080('0x50')](_0x2ab9f8[_0x7080('0x25')][_0x7080('0x3b')]);}})[_0x7080('0x18')](respondWithStatusCode(_0x241fa9,null))[_0x7080('0x26')](handleError(_0x241fa9,null));};exports[_0x7080('0x51')]=function(_0x47f098,_0x13c703){var _0x3f60f7=moment()[_0x7080('0x52')]()[_0x7080('0x53')]();var _0x383609=path[_0x7080('0x54')](config['root'],'server','files',_0x7080('0x55'));var _0x434514=path[_0x7080('0x54')](_0x383609,_0x3f60f7);var _0x7e36b=util[_0x7080('0x48')]('transcript-%d-%s.zip',_0x47f098[_0x7080('0x28')]['id'],_0x3f60f7);var _0x425365=path[_0x7080('0x54')](_0x383609,_0x7e36b);var _0x565460=[];_0x565460[_0x7080('0x56')]({'model':db[_0x7080('0x57')],'as':'User','attributes':['id',_0x7080('0x58')],'raw':!![]});_0x565460['push']({'model':db[_0x7080('0x59')],'as':'Contact','attributes':['id',_0x7080('0x5a'),_0x7080('0x5b')],'raw':!![]});var _0x3c7247=[{'model':db[_0x7080('0x3a')],'as':_0x7080('0x5c'),'attributes':['id',_0x7080('0x36'),_0x7080('0x5d'),_0x7080('0x5e'),_0x7080('0x5f'),'read'],'include':_0x565460}];_0x3c7247[_0x7080('0x56')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x7080('0x1e')]});_0x3c7247['push']({'model':db[_0x7080('0x57')],'as':_0x7080('0x60'),'attributes':['id',_0x7080('0x58')]});return db[_0x7080('0x34')][_0x7080('0x38')]({'where':{'id':_0x47f098[_0x7080('0x28')]['id']},'include':_0x3c7247})['then'](handleEntityNotFound(_0x13c703,null))[_0x7080('0x18')](function(_0x3a9af2){if(_0x3a9af2){var _0x39afa6=_0x3a9af2['get']({'plain':!![]});fs[_0x7080('0x61')](_0x434514);var _0xeaaf11={'channel':_0x7080('0x62'),'account':_0x39afa6[_0x7080('0x63')][_0x7080('0x1e')],'agent':_0x39afa6['Owner']?_0x39afa6[_0x7080('0x60')][_0x7080('0x58')]:_0x7080('0x64'),'createdAt':moment(_0x39afa6[_0x7080('0x5d')])[_0x7080('0x48')](_0x7080('0x49'))['toString'](),'closedAt':_0x39afa6[_0x7080('0x65')]?moment(_0x39afa6['closedAt'])[_0x7080('0x48')](_0x7080('0x49'))[_0x7080('0x53')]():'','disposition':_0x39afa6[_0x7080('0x66')],'messages':_(_0x39afa6[_0x7080('0x5c')])[_0x7080('0x45')]({'secret':![]})[_0x7080('0x67')](function(_0x3e05d4){return{'date':moment(_0x3e05d4[_0x7080('0x5d')])['format'](_0x7080('0x49'))['toString'](),'sender':_0x3e05d4[_0x7080('0x5e')]==='out'?_0x3e05d4[_0x7080('0x57')]?_0x3e05d4[_0x7080('0x57')][_0x7080('0x58')]:_0x7080('0x68'):_0x3e05d4[_0x7080('0x69')][_0x7080('0x5a')]+(_0x3e05d4[_0x7080('0x69')][_0x7080('0x5b')]?'\x20'+_0x3e05d4[_0x7080('0x69')][_0x7080('0x5b')]:''),'body':_0x3e05d4[_0x7080('0x36')],'direction':_0x3e05d4[_0x7080('0x5e')]===_0x7080('0x6a')?'A':'C','secret':_0x3e05d4[_0x7080('0x5f')],'read':_0x3e05d4[_0x7080('0x6b')]};})['value']()};return ejs[_0x7080('0x6c')](path[_0x7080('0x54')](config[_0x7080('0x6d')],_0x7080('0x6e'),_0x7080('0x6f'),_0x7080('0x70')),{'interaction':_0xeaaf11})['then'](function(_0x28c2ea){var _0x55da36=path['join'](_0x434514,'transcript-'+_0x39afa6['id']+'-'+_0x3f60f7+_0x7080('0x71'));var _0xad6aed={'path':_0x55da36,'channel':'Sms','interactionId':_0x39afa6['id']};return pdf[_0x7080('0x72')](_0x28c2ea,_0xad6aed);})['then'](function(){return new BPromise(function(_0x5049c8,_0x19e65b){zipdir(_0x434514,{'saveTo':_0x425365},function(_0x3ef8db,_0x29a6d9){if(_0x3ef8db)return _0x19e65b(_0x3ef8db);return _0x5049c8(_0x29a6d9);});})[_0x7080('0x18')](function(){return new BPromise(function(_0x3e6c2f,_0x1f393c){rimraf(_0x434514,function(_0x3a3bf0){if(_0x3a3bf0)_0x1f393c(_0x3a3bf0);return _0x3e6c2f();});});})[_0x7080('0x18')](function(){return _0x13c703[_0x7080('0x51')](_0x425365,_0x7e36b,function(_0x2cf929){if(_0x2cf929){console['log'](_0x7080('0x73'),_0x2cf929);}else{fs['unlinkSync'](_0x425365);}});});});}else{return _0x13c703['sendStatus'](0xc8);}})[_0x7080('0x26')](handleError(_0x13c703,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e42fc8d..e006b4a 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 _0x63a5=['hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x279e9c,_0x45dfe4){var _0x2c6e72=function(_0xe05702){while(--_0xe05702){_0x279e9c['push'](_0x279e9c['shift']());}};_0x2c6e72(++_0x45dfe4);}(_0x63a5,0x18e));var _0x563a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x63a5[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0x563a('0x0'));var SmsInteraction=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x563a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x4'),'afterUpdate':_0x563a('0x5'),'afterDestroy':_0x563a('0x6')};function emitEvent(_0x37e617){return function(_0x5c2a8d,_0x4cc9e5,_0x1fdcb0){_0x5c2a8d['getUsers']({'attributes':['id'],'raw':!![]})[_0x563a('0x7')](function(_0x4f89b4){_0x5c2a8d['setDataValue']('Users',_0x4f89b4[_0x563a('0x8')](function(_0x32bf51){return{'id':_0x32bf51['id']};}));return SmsMessage[_0x563a('0x9')]({'where':{'SmsInteractionId':_0x5c2a8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x563a('0x7')](function(_0x255922){_0x5c2a8d[_0x563a('0xa')](_0x563a('0xb'),_0x255922[_0x563a('0xc')]);SmsInteractionEvents[_0x563a('0xd')](_0x37e617+':'+_0x5c2a8d['id'],_0x5c2a8d);SmsInteractionEvents[_0x563a('0xd')](_0x37e617,_0x5c2a8d);_0x1fdcb0(null);})[_0x563a('0xe')](_0x1fdcb0(null));};}for(var e in events){if(events[_0x563a('0xf')](e)){var event=events[e];SmsInteraction[_0x563a('0x10')](e,emitEvent(event));}}module[_0x563a('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x6d11=['../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x5bf1ae,_0x4c9259){var _0x5a0521=function(_0x592c34){while(--_0x592c34){_0x5bf1ae['push'](_0x5bf1ae['shift']());}};_0x5a0521(++_0x4c9259);}(_0x6d11,0xbf));var _0x16d1=function(_0x46d7d8,_0x2e7e34){_0x46d7d8=_0x46d7d8-0x0;var _0x141154=_0x6d11[_0x46d7d8];return _0x141154;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var SmsInteraction=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x16d1('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x4'),'afterUpdate':_0x16d1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48754e){return function(_0x3e0e86,_0x46f7d7,_0x3eb9e2){_0x3e0e86[_0x16d1('0x6')]({'attributes':['id'],'raw':!![]})[_0x16d1('0x7')](function(_0x150217){_0x3e0e86[_0x16d1('0x8')]('Users',_0x150217['map'](function(_0x4fca47){return{'id':_0x4fca47['id']};}));return SmsMessage[_0x16d1('0x9')]({'where':{'SmsInteractionId':_0x3e0e86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16d1('0x7')](function(_0xe67758){_0x3e0e86[_0x16d1('0x8')]('unreadMessages',_0xe67758[_0x16d1('0xa')]);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e+':'+_0x3e0e86['id'],_0x3e0e86);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e,_0x3e0e86);_0x3eb9e2(null);})[_0x16d1('0xc')](_0x3eb9e2(null));};}for(var e in events){if(events[_0x16d1('0xd')](e)){var event=events[e];SmsInteraction[_0x16d1('0xe')](e,emitEvent(event));}}module[_0x16d1('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f0af40b..aab82b9 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 _0xe7d0=['changed','YYYY-MM-DD\x20HH:mm:ss','api','moment','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions'];(function(_0x1283d7,_0x29f1f8){var _0x5b40d1=function(_0x2486ed){while(--_0x2486ed){_0x1283d7['push'](_0x1283d7['shift']());}};_0x5b40d1(++_0x29f1f8);}(_0xe7d0,0x119));var _0x0e7d=function(_0x5e0dde,_0x3c138c){_0x5e0dde=_0x5e0dde-0x0;var _0x5e1503=_0xe7d0[_0x5e0dde];return _0x5e1503;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e7d('0x0'));var moment=require(_0x0e7d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e7d('0x2'));var attributes=require(_0x0e7d('0x3'));module['exports']=function(_0x10c5ec,_0x1404e2){return _0x10c5ec[_0x0e7d('0x4')](_0x0e7d('0x5'),attributes,{'tableName':_0x0e7d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31abde,_0x151fd2,_0x2709ba){if(_0x31abde[_0x0e7d('0x7')]('closed')){_0x31abde['closedAt']=moment()['format'](_0x0e7d('0x8'));}_0x2709ba(null,_0x31abde);}}});}; \ No newline at end of file +var _0x3ca3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x46ca38,_0x4f56f4){var _0x57f000=function(_0x382b6a){while(--_0x382b6a){_0x46ca38['push'](_0x46ca38['shift']());}};_0x57f000(++_0x4f56f4);}(_0x3ca3,0xc4));var _0x33ca=function(_0x4cc4d5,_0x42c6f7){_0x4cc4d5=_0x4cc4d5-0x0;var _0x36df2c=_0x3ca3[_0x4cc4d5];return _0x36df2c;};'use strict';var _=require(_0x33ca('0x0'));var util=require(_0x33ca('0x1'));var logger=require(_0x33ca('0x2'))(_0x33ca('0x3'));var moment=require(_0x33ca('0x4'));var BPromise=require(_0x33ca('0x5'));var rp=require(_0x33ca('0x6'));var fs=require('fs');var path=require(_0x33ca('0x7'));var rimraf=require(_0x33ca('0x8'));var config=require(_0x33ca('0x9'));var attributes=require(_0x33ca('0xa'));module['exports']=function(_0x3618c6,_0x5d3146){return _0x3618c6[_0x33ca('0xb')](_0x33ca('0xc'),attributes,{'tableName':_0x33ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x525f60,_0x3ec86c,_0x3389f0){if(_0x525f60[_0x33ca('0xe')](_0x33ca('0xf'))){_0x525f60['closedAt']=moment()[_0x33ca('0x10')](_0x33ca('0x11'));}_0x3389f0(null,_0x525f60);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b31c281..03629e4 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 _0x5b63=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','find','addTags','ids','AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','then','info'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x5b63,0x1d1));var _0x35b6=function(_0x2013e6,_0x4de02c){_0x2013e6=_0x2013e6-0x0;var _0xefe44d=_0x5b63[_0x2013e6];return _0xefe44d;};'use strict';var _=require('lodash');var util=require(_0x35b6('0x0'));var moment=require('moment');var BPromise=require(_0x35b6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x35b6('0x3'));var logger=require(_0x35b6('0x4'))(_0x35b6('0x5'));var config=require(_0x35b6('0x6'));var jayson=require(_0x35b6('0x7'));var client=jayson['client'][_0x35b6('0x8')]({'port':0x232a});config['redis']=_[_0x35b6('0x9')](config[_0x35b6('0xa')],{'host':_0x35b6('0xb'),'port':0x18eb});var socket=require(_0x35b6('0xc'))(new Redis(config[_0x35b6('0xa')]));require(_0x35b6('0xd'))['register'](socket);function respondWithRpcPromise(_0x1df699,_0x1808fe,_0x1f760f){return new BPromise(function(_0x3abd09,_0x3e9453){return client['request'](_0x1df699,_0x1f760f)[_0x35b6('0xe')](function(_0x408c34){logger[_0x35b6('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x1808fe,_0x35b6('0x10'));logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x1808fe,_0x35b6('0x10'),JSON[_0x35b6('0x13')](_0x408c34));if(_0x408c34[_0x35b6('0x14')]){if(_0x408c34[_0x35b6('0x14')][_0x35b6('0x15')]===0x1f4){logger[_0x35b6('0x14')](_0x35b6('0x16'),_0x1808fe,_0x408c34[_0x35b6('0x14')]['message']);return _0x3e9453(_0x408c34['error'][_0x35b6('0x17')]);}logger['error'](_0x35b6('0x16'),_0x1808fe,_0x408c34['error'][_0x35b6('0x17')]);return _0x3abd09(_0x408c34['error'][_0x35b6('0x17')]);}else{logger[_0x35b6('0xf')](_0x35b6('0x16'),_0x1808fe,_0x35b6('0x10'));_0x3abd09(_0x408c34[_0x35b6('0x18')][_0x35b6('0x17')]);}})[_0x35b6('0x19')](function(_0x28dca8){logger['error'](_0x35b6('0x16'),_0x1808fe,_0x28dca8);_0x3e9453(_0x28dca8);});});}exports[_0x35b6('0x1a')]=function(_0x4cc618){var _0x5d8d35=this;return new Promise(function(_0x103492,_0x5e7971){return db[_0x35b6('0x1b')]['update'](_0x4cc618[_0x35b6('0x1c')],{'raw':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')][_0x35b6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')][_0x35b6('0x1f')]||null:null,'attributes':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')]['attributes']||null:null,'limit':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618['options'][_0x35b6('0x20')]||null:null})[_0x35b6('0xe')](function(_0x5e7b3e){logger[_0x35b6('0xf')](_0x35b6('0x1a'),_0x4cc618);logger[_0x35b6('0x11')](_0x35b6('0x1a'),_0x4cc618,JSON[_0x35b6('0x13')](_0x5e7b3e));_0x103492(_0x5e7b3e);})[_0x35b6('0x19')](function(_0x538765){logger[_0x35b6('0x14')](_0x35b6('0x1a'),_0x538765[_0x35b6('0x17')],_0x4cc618);_0x5e7971(_0x5d8d35[_0x35b6('0x14')](0x1f4,_0x538765['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3f6389){return new Promise(function(_0x53ad6c,_0x14c95c){return db[_0x35b6('0x1b')][_0x35b6('0x21')]({'where':_0x3f6389[_0x35b6('0x1d')]?_0x3f6389[_0x35b6('0x1d')][_0x35b6('0x1f')]||null:null})[_0x35b6('0xe')](function(_0x2a28a1){if(_0x2a28a1){return _0x2a28a1[_0x35b6('0x22')](_0x3f6389[_0x35b6('0x1c')][_0x35b6('0x23')],_['omit'](_0x3f6389['body'],[_0x35b6('0x23'),'id'])||{});}})['spread'](function(_0x5bb239){logger[_0x35b6('0xf')](_0x35b6('0x24'),_0x3f6389);logger[_0x35b6('0x11')]('AddTags',_0x3f6389,JSON[_0x35b6('0x13')](_0x5bb239));_0x53ad6c(_0x5bb239);})[_0x35b6('0x19')](function(_0x1fe816){logger[_0x35b6('0x14')](_0x35b6('0x24'),_0x1fe816[_0x35b6('0x17')],_0x3f6389);_0x14c95c(_this['error'](0x1f4,_0x1fe816[_0x35b6('0x17')]));});});}; \ No newline at end of file +var _0xb71d=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','then','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s'];(function(_0x5f246c,_0x799d6b){var _0x4ee4e3=function(_0x2c5889){while(--_0x2c5889){_0x5f246c['push'](_0x5f246c['shift']());}};_0x4ee4e3(++_0x799d6b);}(_0xb71d,0x67));var _0xdb71=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb71d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));var BPromise=require(_0xdb71('0x3'));var rs=require(_0xdb71('0x4'));var fs=require('fs');var Redis=require(_0xdb71('0x5'));var db=require(_0xdb71('0x6'))['db'];var utils=require(_0xdb71('0x7'));var logger=require(_0xdb71('0x8'))('rpc');var config=require(_0xdb71('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb71('0xa')][_0xdb71('0xb')]({'port':0x232a});config[_0xdb71('0xc')]=_['defaults'](config[_0xdb71('0xc')],{'host':_0xdb71('0xd'),'port':0x18eb});var socket=require(_0xdb71('0xe'))(new Redis(config[_0xdb71('0xc')]));require(_0xdb71('0xf'))[_0xdb71('0x10')](socket);function respondWithRpcPromise(_0x5bf0a0,_0xf79ec8,_0x48c852){return new BPromise(function(_0xdc61f5,_0x4b1760){return client[_0xdb71('0x11')](_0x5bf0a0,_0x48c852)['then'](function(_0x4ec541){logger[_0xdb71('0x12')](_0xdb71('0x13'),_0xf79ec8,_0xdb71('0x14'));logger[_0xdb71('0x15')](_0xdb71('0x16'),_0xf79ec8,'request\x20sent',JSON['stringify'](_0x4ec541));if(_0x4ec541[_0xdb71('0x17')]){if(_0x4ec541[_0xdb71('0x17')]['code']===0x1f4){logger[_0xdb71('0x17')]('SmsInteraction,\x20%s,\x20%s',_0xf79ec8,_0x4ec541[_0xdb71('0x17')][_0xdb71('0x18')]);return _0x4b1760(_0x4ec541['error'][_0xdb71('0x18')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0xf79ec8,_0x4ec541[_0xdb71('0x17')][_0xdb71('0x18')]);return _0xdc61f5(_0x4ec541['error'][_0xdb71('0x18')]);}else{logger['info'](_0xdb71('0x13'),_0xf79ec8,_0xdb71('0x14'));_0xdc61f5(_0x4ec541['result'][_0xdb71('0x18')]);}})[_0xdb71('0x19')](function(_0xc40ae3){logger[_0xdb71('0x17')](_0xdb71('0x13'),_0xf79ec8,_0xc40ae3);_0x4b1760(_0xc40ae3);});});}exports[_0xdb71('0x1a')]=function(_0x4fc959){var _0x11ff09=this;return new Promise(function(_0x53b1c2,_0x2fa6bc){return db[_0xdb71('0x1b')]['update'](_0x4fc959['body'],{'raw':_0x4fc959['options']?_0x4fc959[_0xdb71('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc959['options']?_0x4fc959[_0xdb71('0x1c')][_0xdb71('0x1d')]||null:null,'attributes':_0x4fc959[_0xdb71('0x1c')]?_0x4fc959[_0xdb71('0x1c')][_0xdb71('0x1e')]||null:null,'limit':_0x4fc959[_0xdb71('0x1c')]?_0x4fc959['options'][_0xdb71('0x1f')]||null:null})[_0xdb71('0x20')](function(_0x1885dc){logger['info']('UpdateSmsInteraction',_0x4fc959);logger[_0xdb71('0x15')](_0xdb71('0x1a'),_0x4fc959,JSON[_0xdb71('0x21')](_0x1885dc));_0x53b1c2(_0x1885dc);})['catch'](function(_0x302dc9){logger['error']('UpdateSmsInteraction',_0x302dc9[_0xdb71('0x18')],_0x4fc959);_0x2fa6bc(_0x11ff09[_0xdb71('0x17')](0x1f4,_0x302dc9[_0xdb71('0x18')]));});});};exports[_0xdb71('0x22')]=function(_0x1ad63e){return new Promise(function(_0x360b60,_0x24381d){return db['SmsInteraction'][_0xdb71('0x23')]({'where':_0x1ad63e[_0xdb71('0x1c')]?_0x1ad63e[_0xdb71('0x1c')]['where']||null:null})[_0xdb71('0x20')](function(_0x33693e){if(_0x33693e){return _0x33693e[_0xdb71('0x24')](_0x1ad63e[_0xdb71('0x25')]['ids'],_['omit'](_0x1ad63e[_0xdb71('0x25')],[_0xdb71('0x26'),'id'])||{});}})[_0xdb71('0x27')](function(_0x3ef88a){logger[_0xdb71('0x12')]('AddTags',_0x1ad63e);logger[_0xdb71('0x15')](_0xdb71('0x28'),_0x1ad63e,JSON[_0xdb71('0x21')](_0x3ef88a));_0x360b60(_0x3ef88a);})[_0xdb71('0x19')](function(_0xd05a22){logger[_0xdb71('0x17')]('AddTags',_0xd05a22[_0xdb71('0x18')],_0x1ad63e);_0x24381d(_this[_0xdb71('0x17')](0x1f4,_0xd05a22[_0xdb71('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 66a6764..e6e2a15 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 _0x39ca=['remove','removeListener','register','length','smsInteraction:','save'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x39ca,0x1a3));var _0xa39c=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0x39ca[_0x31abee];return _0x3c1761;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa39c('0x0'),_0xa39c('0x1'),'update'];function createListener(_0xdc9439,_0x56fdcd){return function(_0x13a5bc){_0x56fdcd['emit'](_0xdc9439,_0x13a5bc);};}function removeListener(_0x481a42,_0x26a871){return function(){SmsInteractionEvents[_0xa39c('0x2')](_0x481a42,_0x26a871);};}exports[_0xa39c('0x3')]=function(_0x2abea2){for(var _0x2d6780=0x0,_0x252d5c=events[_0xa39c('0x4')];_0x2d6780<_0x252d5c;_0x2d6780++){var _0x3d33f0=events[_0x2d6780];var _0x3a4432=createListener(_0xa39c('0x5')+_0x3d33f0,_0x2abea2);SmsInteractionEvents['on'](_0x3d33f0,_0x3a4432);}}; \ No newline at end of file +var _0xae73=['register','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0xae73,0xb0));var _0x3ae7=function(_0x19b9d1,_0x4f603f){_0x19b9d1=_0x19b9d1-0x0;var _0x1ca4f7=_0xae73[_0x19b9d1];return _0x1ca4f7;};'use strict';var SmsInteractionEvents=require(_0x3ae7('0x0'));var events=['save',_0x3ae7('0x1'),_0x3ae7('0x2')];function createListener(_0x1ac6ae,_0x1b7a46){return function(_0x29dfa9){_0x1b7a46[_0x3ae7('0x3')](_0x1ac6ae,_0x29dfa9);};}function removeListener(_0x49dc12,_0x590fe3){return function(){SmsInteractionEvents['removeListener'](_0x49dc12,_0x590fe3);};}exports[_0x3ae7('0x4')]=function(_0x4d21af){for(var _0x574942=0x0,_0x5ce355=events['length'];_0x574942<_0x5ce355;_0x574942++){var _0x317eaf=events[_0x574942];var _0x48933a=createListener(_0x3ae7('0x5')+_0x317eaf,_0x4d21af);SmsInteractionEvents['on'](_0x317eaf,_0x48933a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ea8e14f..2175952 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 _0xdc83=['/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','describe'];(function(_0x264341,_0x30f134){var _0x5c6408=function(_0x29626e){while(--_0x29626e){_0x264341['push'](_0x264341['shift']());}};_0x5c6408(++_0x30f134);}(_0xdc83,0x104));var _0x3dc8=function(_0x71f943,_0x4ececc){_0x71f943=_0x71f943-0x0;var _0x1b99df=_0xdc83[_0x71f943];return _0x1b99df;};'use strict';var multer=require(_0x3dc8('0x0'));var util=require(_0x3dc8('0x1'));var path=require(_0x3dc8('0x2'));var timeout=require('connect-timeout');var express=require(_0x3dc8('0x3'));var router=express[_0x3dc8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3dc8('0x5'));var config=require('../../config/environment');var controller=require(_0x3dc8('0x6'));router['get']('/',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x8')]);router['get']('/describe',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x9')]);router['get'](_0x3dc8('0xa'),auth[_0x3dc8('0x7')](),controller[_0x3dc8('0xb')]);router[_0x3dc8('0xc')]('/',auth[_0x3dc8('0x7')](),interaction[_0x3dc8('0xd')]('sms',_0x3dc8('0xe')),controller[_0x3dc8('0xf')]);router[_0x3dc8('0xc')](_0x3dc8('0x10'),controller[_0x3dc8('0x11')]);router[_0x3dc8('0x12')]('/:id',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x13')]);router[_0x3dc8('0x12')](_0x3dc8('0x14'),auth['isAuthenticated'](),controller[_0x3dc8('0x15')]);router[_0x3dc8('0x12')](_0x3dc8('0x16'),auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x17')]);router[_0x3dc8('0x18')]('/:id',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x19')]);module[_0x3dc8('0x1a')]=router; \ No newline at end of file +var _0xfd14=['/:id/accept','/:id/reject','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','show','sms','smsmessage:create','create','post','/:id/status','put','update'];(function(_0x2d80ce,_0x445873){var _0x301023=function(_0x2cc228){while(--_0x2cc228){_0x2d80ce['push'](_0x2d80ce['shift']());}};_0x301023(++_0x445873);}(_0xfd14,0x195));var _0x4fd1=function(_0x4e4b1c,_0x136097){_0x4e4b1c=_0x4e4b1c-0x0;var _0x1c3cc1=_0xfd14[_0x4e4b1c];return _0x1c3cc1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4fd1('0x0'));var timeout=require(_0x4fd1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4fd1('0x2'));var auth=require(_0x4fd1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4fd1('0x4'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x4fd1('0x5')](),controller['index']);router[_0x4fd1('0x6')]('/describe',auth[_0x4fd1('0x5')](),controller['describe']);router[_0x4fd1('0x6')]('/:id',auth[_0x4fd1('0x5')](),controller[_0x4fd1('0x7')]);router['post']('/',auth[_0x4fd1('0x5')](),interaction['tracked'](_0x4fd1('0x8'),_0x4fd1('0x9')),controller[_0x4fd1('0xa')]);router[_0x4fd1('0xb')](_0x4fd1('0xc'),controller['status']);router[_0x4fd1('0xd')]('/:id',auth[_0x4fd1('0x5')](),controller[_0x4fd1('0xe')]);router[_0x4fd1('0xd')](_0x4fd1('0xf'),auth[_0x4fd1('0x5')](),controller['accept']);router['put'](_0x4fd1('0x10'),auth['isAuthenticated'](),controller['reject']);router[_0x4fd1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4fd1('0x12')]);module[_0x4fd1('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1cb4cd8..7922359 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 _0xc8f5=['out','STRING','BOOLEAN','TEXT','sequelize','exports','medium'];(function(_0x380fa9,_0x5123eb){var _0x4f2532=function(_0x4bde43){while(--_0x4bde43){_0x380fa9['push'](_0x380fa9['shift']());}};_0x4f2532(++_0x5123eb);}(_0xc8f5,0xeb));var _0x5c8f=function(_0x29bb0a,_0x4a49e6){_0x29bb0a=_0x29bb0a-0x0;var _0x1725e4=_0xc8f5[_0x29bb0a];return _0x1725e4;};'use strict';var Sequelize=require(_0x5c8f('0x0'));module[_0x5c8f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5c8f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x5c8f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c8f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c8f('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5c8f('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5c8f('0x6')]}}; \ No newline at end of file +var _0x9a13=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4739f7,_0x4d4d32){var _0x12b7b9=function(_0x7b370){while(--_0x7b370){_0x4739f7['push'](_0x4739f7['shift']());}};_0x12b7b9(++_0x4d4d32);}(_0x9a13,0x76));var _0x39a1=function(_0xec8285,_0x9aaa4e){_0xec8285=_0xec8285-0x0;var _0x37d83a=_0x9a13[_0xec8285];return _0x37d83a;};'use strict';var Sequelize=require(_0x39a1('0x0'));module[_0x39a1('0x1')]={'body':{'type':Sequelize[_0x39a1('0x2')](_0x39a1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x39a1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39a1('0x5')]('in',_0x39a1('0x6')),'defaultValue':_0x39a1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x39a1('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x39a1('0x8')]},'secret':{'type':Sequelize[_0x39a1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x39a1('0x7')]},'providerResponse':{'type':Sequelize[_0x39a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7c90c52..3654aa4 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 _0xe98f=['fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','sms-interactions','accept','sms','read','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[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','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','SmsAccount,\x20%s,\x20%s,\x20%s','groupName','DELIVERED','infobip','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes'];(function(_0x57275e,_0x351690){var _0x197774=function(_0x692e03){while(--_0x692e03){_0x57275e['push'](_0x57275e['shift']());}};_0x197774(++_0x351690);}(_0xe98f,0xde));var _0xfe98=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe98f[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xfe98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe98('0x2'));var moment=require(_0xfe98('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe98('0x4'));var path=require('path');var sox=require(_0xfe98('0x5'));var csv=require(_0xfe98('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe98('0x7'));var _=require('lodash');var squel=require(_0xfe98('0x8'));var crypto=require(_0xfe98('0x9'));var jsforce=require(_0xfe98('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe98('0x6'));var querystring=require(_0xfe98('0xb'));var Papa=require('papaparse');var Redis=require(_0xfe98('0xc'));var authService=require(_0xfe98('0xd'));var qs=require(_0xfe98('0xe'));var as=require(_0xfe98('0xf'));var hardwareService=require(_0xfe98('0x10'));var logger=require(_0xfe98('0x11'))('api');var utils=require(_0xfe98('0x12'));var config=require(_0xfe98('0x13'));var licenseUtil=require(_0xfe98('0x14'));var db=require(_0xfe98('0x15'))['db'];config[_0xfe98('0x16')]=_['defaults'](config[_0xfe98('0x16')],{'host':_0xfe98('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe98('0x16')]));require('./smsMessage.socket')[_0xfe98('0x18')](socket);var jayson=require(_0xfe98('0x19'));var client=jayson[_0xfe98('0x1a')][_0xfe98('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xfe98('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d92fc,_0x416c4c,_0x8c527c,_0x20d565){return new BPromise(function(_0x476932,_0x4deba7){var _0x56c0f4=_0x20d565||client;return _0x56c0f4[_0xfe98('0x1c')](_0x4d92fc,_0x8c527c)[_0xfe98('0x1d')](function(_0x31bb37){logger['info'](_0xfe98('0x1e'),_0x416c4c,_0xfe98('0x1f'));logger[_0xfe98('0x20')](_0xfe98('0x21'),_0x416c4c,_0xfe98('0x1f'),JSON[_0xfe98('0x22')](_0x31bb37));if(_0x31bb37[_0xfe98('0x23')]){if(_0x31bb37['error'][_0xfe98('0x24')]===0x1f4){logger['error'](_0xfe98('0x1e'),_0x416c4c,_0x31bb37['error']['message']);return _0x4deba7(_0x31bb37[_0xfe98('0x23')][_0xfe98('0x25')]);}logger[_0xfe98('0x23')](_0xfe98('0x1e'),_0x416c4c,_0x31bb37['error'][_0xfe98('0x25')]);return _0x476932(_0x31bb37['error'][_0xfe98('0x25')]);}else{logger[_0xfe98('0x26')](_0xfe98('0x1e'),_0x416c4c,'request\x20sent');_0x476932(_0x31bb37['result'][_0xfe98('0x25')]);}})['catch'](function(_0x7b629e){logger[_0xfe98('0x23')]('SmsMessage,\x20%s,\x20%s',_0x416c4c,_0x7b629e);_0x4deba7(_0x7b629e);});});}function respondWithStatusCode(_0x3dc31d,_0x25f675){_0x25f675=_0x25f675||0xcc;return function(_0x21325b){if(_0x21325b){return _0x3dc31d[_0xfe98('0x27')](_0x25f675);}return _0x3dc31d['status'](_0x25f675)['end']();};}function respondWithResult(_0x5921f0,_0x51da63){_0x51da63=_0x51da63||0xc8;return function(_0xc68e94){if(_0xc68e94){return _0x5921f0[_0xfe98('0x28')](_0x51da63)[_0xfe98('0x29')](_0xc68e94);}};}function respondWithFilteredResult(_0x21c730,_0x1f3fb5){return function(_0x1017b5){if(_0x1017b5){var _0x3029=typeof _0x1f3fb5[_0xfe98('0x2a')]===_0xfe98('0x2b')&&typeof _0x1f3fb5[_0xfe98('0x2c')]==='undefined';var _0x1bed97=_0x1017b5[_0xfe98('0x2d')];var _0x9eb9c9=_0x3029?0x0:_0x1f3fb5[_0xfe98('0x2a')];var _0x3094df=_0x3029?_0x1017b5[_0xfe98('0x2d')]:_0x1f3fb5[_0xfe98('0x2a')]+_0x1f3fb5[_0xfe98('0x2c')];var _0xdbb15e;if(_0x3094df>=_0x1bed97){_0x3094df=_0x1bed97;_0xdbb15e=0xc8;}else{_0xdbb15e=0xce;}_0x21c730[_0xfe98('0x28')](_0xdbb15e);return _0x21c730[_0xfe98('0x2e')](_0xfe98('0x2f'),_0x9eb9c9+'-'+_0x3094df+'/'+_0x1bed97)[_0xfe98('0x29')](_0x1017b5);}return null;};}function patchUpdates(_0x269899){return function(_0x9b0a91){try{jsonpatch['apply'](_0x9b0a91,_0x269899,!![]);}catch(_0x504b58){return BPromise[_0xfe98('0x30')](_0x504b58);}return _0x9b0a91[_0xfe98('0x31')]();};}function saveUpdates(_0x582efe,_0x1a1288){return function(_0x405ebf){if(_0x405ebf){return _0x405ebf[_0xfe98('0x32')](_0x582efe)[_0xfe98('0x1d')](function(_0x22a132){return _0x22a132;});}return null;};}function removeEntity(_0x5ceb1c,_0x2712b9){return function(_0x3a8ad9){if(_0x3a8ad9){return _0x3a8ad9[_0xfe98('0x33')]()[_0xfe98('0x1d')](function(){_0x5ceb1c[_0xfe98('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17dd03,_0x596609){return function(_0x19f0f1){if(!_0x19f0f1){_0x17dd03[_0xfe98('0x27')](0x194);}return _0x19f0f1;};}function handleError(_0x20738c,_0x15a19b){_0x15a19b=_0x15a19b||0x1f4;return function(_0x4131a4){logger[_0xfe98('0x23')](_0x4131a4[_0xfe98('0x34')]);if(_0x4131a4[_0xfe98('0x35')]){delete _0x4131a4['name'];}_0x20738c['status'](_0x15a19b)[_0xfe98('0x36')](_0x4131a4);};}exports[_0xfe98('0x37')]=function(_0x4002c1,_0x35502e){var _0x207a6c={},_0x535a61={},_0x3e996c={'count':0x0,'rows':[]};var _0xb371b=_[_0xfe98('0x38')](db['SmsMessage'][_0xfe98('0x39')],function(_0x30723b){return{'name':_0x30723b[_0xfe98('0x3a')],'type':_0x30723b[_0xfe98('0x3b')]['key']};});_0x535a61[_0xfe98('0x3c')]=_[_0xfe98('0x38')](_0xb371b,'name');_0x535a61[_0xfe98('0x3d')]=_[_0xfe98('0x3e')](_0x4002c1[_0xfe98('0x3d')]);_0x535a61['filters']=_['intersection'](_0x535a61['model'],_0x535a61['query']);_0x207a6c[_0xfe98('0x3f')]=_['intersection'](_0x535a61[_0xfe98('0x3c')],qs[_0xfe98('0x40')](_0x4002c1['query'][_0xfe98('0x40')]));_0x207a6c[_0xfe98('0x3f')]=_0x207a6c[_0xfe98('0x3f')][_0xfe98('0x41')]?_0x207a6c[_0xfe98('0x3f')]:_0x535a61[_0xfe98('0x3c')];if(!_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x42')]('nolimit')){_0x207a6c[_0xfe98('0x2c')]=qs[_0xfe98('0x2c')](_0x4002c1['query'][_0xfe98('0x2c')]);_0x207a6c[_0xfe98('0x2a')]=qs[_0xfe98('0x2a')](_0x4002c1[_0xfe98('0x3d')]['offset']);}_0x207a6c[_0xfe98('0x43')]=qs['sort'](_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x44')]);_0x207a6c[_0xfe98('0x45')]=qs[_0xfe98('0x46')](_['pick'](_0x4002c1[_0xfe98('0x3d')],_0x535a61[_0xfe98('0x46')]),_0xb371b);if(_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x47')]){_0x207a6c[_0xfe98('0x45')]=_[_0xfe98('0x48')](_0x207a6c['where'],{'$or':_[_0xfe98('0x38')](_0xb371b,function(_0x1d430a){if(_0x1d430a[_0xfe98('0x3b')]!==_0xfe98('0x49')){var _0x46d5bb={};_0x46d5bb[_0x1d430a[_0xfe98('0x35')]]={'$like':'%'+_0x4002c1[_0xfe98('0x3d')]['filter']+'%'};return _0x46d5bb;}})});}_0x207a6c=_[_0xfe98('0x48')]({},_0x207a6c,_0x4002c1[_0xfe98('0x4a')]);var _0x183385={'where':_0x207a6c[_0xfe98('0x45')]};return db[_0xfe98('0x4b')]['count'](_0x183385)[_0xfe98('0x1d')](function(_0x5d9cb9){_0x3e996c[_0xfe98('0x2d')]=_0x5d9cb9;if(_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x4c')]){_0x207a6c[_0xfe98('0x4d')]=[{'all':!![]}];}return db[_0xfe98('0x4b')][_0xfe98('0x4e')](_0x207a6c);})[_0xfe98('0x1d')](function(_0x754f39){_0x3e996c['rows']=_0x754f39;return _0x3e996c;})[_0xfe98('0x1d')](respondWithFilteredResult(_0x35502e,_0x207a6c))[_0xfe98('0x4f')](handleError(_0x35502e,null));};exports[_0xfe98('0x50')]=function(_0x1720d3,_0x5ad61e){var _0x26cb3d={'raw':!![],'where':{'id':_0x1720d3[_0xfe98('0x51')]['id']}},_0xc0573c={};_0xc0573c[_0xfe98('0x3c')]=_[_0xfe98('0x3e')](db[_0xfe98('0x4b')]['rawAttributes']);_0xc0573c[_0xfe98('0x3d')]=_[_0xfe98('0x3e')](_0x1720d3[_0xfe98('0x3d')]);_0xc0573c[_0xfe98('0x46')]=_[_0xfe98('0x52')](_0xc0573c['model'],_0xc0573c['query']);_0x26cb3d[_0xfe98('0x3f')]=_[_0xfe98('0x52')](_0xc0573c[_0xfe98('0x3c')],qs[_0xfe98('0x40')](_0x1720d3[_0xfe98('0x3d')][_0xfe98('0x40')]));_0x26cb3d[_0xfe98('0x3f')]=_0x26cb3d[_0xfe98('0x3f')][_0xfe98('0x41')]?_0x26cb3d[_0xfe98('0x3f')]:_0xc0573c['model'];if(_0x1720d3[_0xfe98('0x3d')]['includeAll']){_0x26cb3d[_0xfe98('0x4d')]=[{'all':!![]}];}_0x26cb3d=_[_0xfe98('0x48')]({},_0x26cb3d,_0x1720d3[_0xfe98('0x4a')]);return db['SmsMessage'][_0xfe98('0x53')](_0x26cb3d)['then'](handleEntityNotFound(_0x5ad61e,null))['then'](respondWithResult(_0x5ad61e,null))[_0xfe98('0x4f')](handleError(_0x5ad61e,null));};exports[_0xfe98('0x54')]=function(_0x2d7246,_0x3dfb51){return db[_0xfe98('0x4b')][_0xfe98('0x54')](_0x2d7246['body'],{})[_0xfe98('0x1d')](respondWithResult(_0x3dfb51,0xc9))['catch'](handleError(_0x3dfb51,null));};exports[_0xfe98('0x32')]=function(_0x4a5690,_0x54823a){if(_0x4a5690['body']['id']){delete _0x4a5690[_0xfe98('0x55')]['id'];}return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x4a5690[_0xfe98('0x51')]['id']}})['then'](handleEntityNotFound(_0x54823a,null))[_0xfe98('0x1d')](saveUpdates(_0x4a5690['body'],null))[_0xfe98('0x1d')](respondWithResult(_0x54823a,null))[_0xfe98('0x4f')](handleError(_0x54823a,null));};exports['destroy']=function(_0x7096d5,_0x6299e9){return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x7096d5['params']['id']}})[_0xfe98('0x1d')](handleEntityNotFound(_0x6299e9,null))[_0xfe98('0x1d')](removeEntity(_0x6299e9,null))[_0xfe98('0x4f')](handleError(_0x6299e9,null));};exports[_0xfe98('0x56')]=function(_0x4ab9c4,_0x4192e0){return db['SmsMessage'][_0xfe98('0x56')]()[_0xfe98('0x1d')](respondWithResult(_0x4192e0,null))[_0xfe98('0x4f')](handleError(_0x4192e0,null));};var interaction_log=require(_0xfe98('0x11'))(_0xfe98('0x57'));exports[_0xfe98('0x58')]=function(_0x4435d1,_0x247044,_0x36a92f){var _0x3b8626={'agent':{},'channel':_0xfe98('0x59')};if(_0x4435d1[_0xfe98('0x55')]['id']){delete _0x4435d1[_0xfe98('0x55')]['id'];}_0x4435d1['body'][_0xfe98('0x5a')]=!![];_0x4435d1['body']['readAt']=moment()[_0xfe98('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')]=_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')]||_0x4435d1[_0xfe98('0x5d')]['id'];_0x3b8626[_0xfe98('0x5e')]['id']=_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')];return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x4435d1[_0xfe98('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x247044,null))[_0xfe98('0x1d')](saveUpdates(_0x4435d1[_0xfe98('0x55')],null))[_0xfe98('0x1d')](function(_0x3d86ea){if(_0x3d86ea){_0x3b8626[_0xfe98('0x25')]=_0x3d86ea['get']({'plain':!![]});return db[_0xfe98('0x5f')][_0xfe98('0x53')]({'where':{'id':_0x3d86ea[_0xfe98('0x60')]}});}return null;})[_0xfe98('0x1d')](handleEntityNotFound(_0x247044,null))[_0xfe98('0x1d')](function(_0x15f053){if(_0x15f053){return _0x15f053['update']({'UserId':_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')],'read1stAt':_[_0xfe98('0x61')](_0x15f053[_0xfe98('0x62')])?moment()[_0xfe98('0x5b')](_0xfe98('0x63')):undefined});}return null;})[_0xfe98('0x1d')](function(_0x534f43){if(_0x534f43){_0x3b8626[_0xfe98('0x64')]=_0x534f43[_0xfe98('0x65')]({'plain':!![]});interaction_log[_0xfe98('0x26')](_0xfe98('0x66'),_0x4435d1[_0xfe98('0x5d')]['id'],_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x35')],_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x67')],_0x3b8626[_0xfe98('0x64')]['id'],_0x4435d1[_0xfe98('0x55')]?JSON[_0xfe98('0x22')](_0x4435d1[_0xfe98('0x55')]):_0xfe98('0x68'));return respondWithRpcPromise(_0xfe98('0x69'),_0xfe98('0x6a'),_0x3b8626);}return null;})[_0xfe98('0x1d')](function(_0x172754){var _0x259e75=_0xfe98('0x6b')+_0x172754[_0xfe98('0x25')][_0xfe98('0x6c')];return db[_0xfe98('0x6d')][_0xfe98('0x3d')](_0x259e75,{'type':db[_0xfe98('0x6e')][_0xfe98('0x6f')][_0xfe98('0x70')],'raw':!![]})['then'](function(_0x5b0125){return _0x5b0125;});})[_0xfe98('0x1d')](function(_0x1ab844){if(_0x1ab844){_0x3b8626[_0xfe98('0x25')]['contact']=_0x1ab844[0x0];if(!_0x4435d1['body'][_0xfe98('0x5c')])return;return db['User'][_0xfe98('0x53')]({'where':{'id':_0x4435d1[_0xfe98('0x55')]['UserId'],'role':_0xfe98('0x5e')},'attributes':['id',_0xfe98('0x35'),_0xfe98('0x71'),_0xfe98('0x72'),_0xfe98('0x73')],'raw':!![]});}return null;})[_0xfe98('0x1d')](function(_0x271c09){if(!_0x271c09)return null;_0x3b8626[_0xfe98('0x25')][_0xfe98('0x5e')]=_0x271c09;return _0x3b8626;})['then'](function(_0x2c9d80){if(_0x2c9d80){if(_0x4435d1['body'][_0xfe98('0x74')]){_0x3b8626[_0xfe98('0x25')][_0xfe98('0x75')]=util[_0xfe98('0x5b')](_0xfe98('0x76'),_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x35')]);_0x3b8626[_0xfe98('0x25')][_0xfe98('0x77')]=_0x3b8626[_0xfe98('0x77')];_0x3b8626[_0xfe98('0x25')][_0xfe98('0x78')]=_0x3b8626[_0xfe98('0x77')];_0x3b8626['message']['event']=_0xfe98('0x58');return respondWithRpcPromise(_0xfe98('0x79'),_0xfe98('0x79'),{'event':_0xfe98('0x7a'),'message':_0x3b8626[_0xfe98('0x25')]},client9002)[_0xfe98('0x1d')](function(){return _0x3b8626;});}return _0x3b8626;}return null;})[_0xfe98('0x1d')](respondWithResult(_0x247044,null))[_0xfe98('0x4f')](handleError(_0x247044,null));};var interaction_log=require(_0xfe98('0x11'))(_0xfe98('0x57'));exports[_0xfe98('0x30')]=function(_0x25dea1,_0x162294,_0x27f70e){var _0x3ddb98={'agent':{},'channel':_0xfe98('0x59')};if(_0x25dea1['body']['id']){delete _0x25dea1[_0xfe98('0x55')]['id'];}_0x25dea1[_0xfe98('0x55')][_0xfe98('0x5c')]=_0x25dea1['body'][_0xfe98('0x5c')]||_0x25dea1[_0xfe98('0x5d')]['id'];_0x3ddb98[_0xfe98('0x5e')]['id']=_0x25dea1[_0xfe98('0x55')][_0xfe98('0x5c')];return db['SmsMessage']['find']({'where':{'id':_0x25dea1[_0xfe98('0x51')]['id'],'UserId':null}})[_0xfe98('0x1d')](handleEntityNotFound(_0x162294,null))['then'](function(_0x56d390){if(_0x56d390){_0x3ddb98['message']=_0x56d390['get']({'plain':!![]});return db[_0xfe98('0x5f')][_0xfe98('0x53')]({'where':{'id':_0x56d390[_0xfe98('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x162294,null))[_0xfe98('0x1d')](function(_0x450c06){if(_0x450c06){_0x3ddb98[_0xfe98('0x64')]=_0x450c06[_0xfe98('0x65')]({'plain':!![]});interaction_log[_0xfe98('0x26')](_0xfe98('0x7b'),_0x25dea1[_0xfe98('0x5d')]['id'],_0x25dea1['user']['name'],_0x25dea1['user'][_0xfe98('0x67')],_0x3ddb98[_0xfe98('0x64')]['id'],_0x25dea1[_0xfe98('0x55')]?JSON[_0xfe98('0x22')](_0x25dea1[_0xfe98('0x55')]):_0xfe98('0x68'));return respondWithRpcPromise(_0xfe98('0x7c'),_0xfe98('0x7d'),_0x3ddb98);}return null;})['then'](function(_0x5df11e){var _0x55322a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5df11e[_0xfe98('0x25')][_0xfe98('0x6c')];return db[_0xfe98('0x6d')][_0xfe98('0x3d')](_0x55322a,{'type':db[_0xfe98('0x6e')][_0xfe98('0x6f')]['SELECT'],'raw':!![]})[_0xfe98('0x1d')](function(_0x2798d9){return _0x2798d9;});})['then'](function(_0x4a9028){if(_0x4a9028){_0x3ddb98[_0xfe98('0x25')][_0xfe98('0x7e')]=_0x4a9028[0x0];if(!_0x25dea1['body'][_0xfe98('0x5c')])return;return db[_0xfe98('0x7f')]['find']({'where':{'id':_0x25dea1[_0xfe98('0x55')]['UserId'],'role':_0xfe98('0x5e')},'attributes':['id',_0xfe98('0x35'),_0xfe98('0x71'),_0xfe98('0x72'),'internal'],'raw':!![]});}return null;})[_0xfe98('0x1d')](function(_0x42921a){if(!_0x42921a)return null;_0x3ddb98[_0xfe98('0x25')]['agent']=_0x42921a;return _0x3ddb98;})[_0xfe98('0x1d')](function(_0x406758){if(_0x406758){_0x406758['message'][_0xfe98('0x75')]=util[_0xfe98('0x5b')](_0xfe98('0x76'),_0x25dea1[_0xfe98('0x5d')]['name']);_0x406758[_0xfe98('0x25')][_0xfe98('0x77')]=_0x3ddb98[_0xfe98('0x77')];_0x406758[_0xfe98('0x25')]['motionChannel']=_0x3ddb98['channel'];_0x406758['message'][_0xfe98('0x80')]=_0xfe98('0x30');respondWithRpcPromise(_0xfe98('0x79'),_0xfe98('0x79'),{'event':_0xfe98('0x81'),'message':_0x406758[_0xfe98('0x25')]},client9002);return _0x3ddb98;}return null;})[_0xfe98('0x1d')](respondWithResult(_0x162294,null))[_0xfe98('0x4f')](handleError(_0x162294,null));};exports[_0xfe98('0x28')]=function(_0x1f21f7,_0xd367d9,_0x5cf971){if(_0x1f21f7[_0xfe98('0x55')]['id']){delete _0x1f21f7['body']['id'];}var _0xf1118;return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x1f21f7[_0xfe98('0x51')]['id']}})['then'](handleEntityNotFound(_0xd367d9,null))['then'](function(_0x1598db){if(_0x1598db){_0xf1118=_0x1598db;return db['SmsAccount'][_0xfe98('0x53')]({'where':{'id':_0x1598db[_0xfe98('0x82')]}});}})[_0xfe98('0x1d')](handleEntityNotFound(_0xd367d9,null))[_0xfe98('0x1d')](function(_0x362854){if(_0x362854){logger[_0xfe98('0x20')](_0xfe98('0x21'),_0xfe98('0x28'),_0xfe98('0x83'),_0x362854[_0xfe98('0x3b')],util[_0xfe98('0x84')](_0x1f21f7['body'],{'showHidden':![],'depth':null}));switch(_0x362854[_0xfe98('0x3b')]){case'twilio':if(_0x1f21f7[_0xfe98('0x55')]['MessageSid']&&_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x85')]===_0xf1118[_0xfe98('0x86')]){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe98('0x28'),_0xfe98('0x87'),util['inspect'](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfe98('0x88'):if(_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x89')]&&_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x89')]===_0xf1118[_0xfe98('0x86')]&&_[_0xfe98('0x8a')](['sent','delivered'],_0x1f21f7[_0xfe98('0x55')]['Status'])>=0x0){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')](_0xfe98('0x8b'),_0xfe98('0x28'),'plivio',util['inspect'](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4b0c1e=_0x1f21f7[_0xfe98('0x55')]['results'][0x0];if(_0x4b0c1e[_0xfe98('0x28')][_0xfe98('0x8c')]===_0xfe98('0x8d')){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe98('0x28'),_0xfe98('0x8e'),util[_0xfe98('0x84')](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xf1118;}})[_0xfe98('0x1d')](respondWithResult(_0xd367d9,null))[_0xfe98('0x4f')](handleError(_0xd367d9,null));}; \ No newline at end of file +var _0x9fda=['moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','name','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','../../config/logger','sms-interactions','accept','readAt','UserId','user','agent','get','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','SmsAccount','SmsAccountId','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','fast-json-patch','request-promise'];(function(_0x673d5f,_0x20bd4e){var _0xee47b7=function(_0x51b13f){while(--_0x51b13f){_0x673d5f['push'](_0x673d5f['shift']());}};_0xee47b7(++_0x20bd4e);}(_0x9fda,0x8c));var _0xa9fd=function(_0x4e898b,_0x7827e2){_0x4e898b=_0x4e898b-0x0;var _0x3b46d9=_0x9fda[_0x4e898b];return _0x3b46d9;};'use strict';var emlformat=require(_0xa9fd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9fd('0x1'));var rp=require(_0xa9fd('0x2'));var moment=require(_0xa9fd('0x3'));var BPromise=require(_0xa9fd('0x4'));var Mustache=require('mustache');var util=require(_0xa9fd('0x5'));var path=require(_0xa9fd('0x6'));var sox=require('sox');var csv=require(_0xa9fd('0x7'));var ejs=require(_0xa9fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa9fd('0x9'));var crypto=require(_0xa9fd('0xa'));var jsforce=require(_0xa9fd('0xb'));var deskjs=require(_0xa9fd('0xc'));var toCsv=require(_0xa9fd('0x7'));var querystring=require('querystring');var Papa=require(_0xa9fd('0xd'));var Redis=require(_0xa9fd('0xe'));var authService=require(_0xa9fd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa9fd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9fd('0x11'));var utils=require(_0xa9fd('0x12'));var config=require(_0xa9fd('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9fd('0x14'))['db'];config[_0xa9fd('0x15')]=_[_0xa9fd('0x16')](config[_0xa9fd('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xa9fd('0x17'))(new Redis(config[_0xa9fd('0x15')]));require(_0xa9fd('0x18'))[_0xa9fd('0x19')](socket);var jayson=require(_0xa9fd('0x1a'));var client=jayson[_0xa9fd('0x1b')][_0xa9fd('0x1c')]({'port':0x232c});var client9002=jayson[_0xa9fd('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29eca3,_0x11221b,_0x519060,_0x5e581f){return new BPromise(function(_0x42d7d9,_0x1ec277){var _0x431f80=_0x5e581f||client;return _0x431f80[_0xa9fd('0x1d')](_0x29eca3,_0x519060)[_0xa9fd('0x1e')](function(_0x2af0aa){logger[_0xa9fd('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x11221b,'request\x20sent');logger[_0xa9fd('0x20')](_0xa9fd('0x21'),_0x11221b,_0xa9fd('0x22'),JSON[_0xa9fd('0x23')](_0x2af0aa));if(_0x2af0aa[_0xa9fd('0x24')]){if(_0x2af0aa[_0xa9fd('0x24')][_0xa9fd('0x25')]===0x1f4){logger['error'](_0xa9fd('0x26'),_0x11221b,_0x2af0aa['error']['message']);return _0x1ec277(_0x2af0aa['error']['message']);}logger[_0xa9fd('0x24')](_0xa9fd('0x26'),_0x11221b,_0x2af0aa[_0xa9fd('0x24')][_0xa9fd('0x27')]);return _0x42d7d9(_0x2af0aa[_0xa9fd('0x24')]['message']);}else{logger[_0xa9fd('0x1f')](_0xa9fd('0x26'),_0x11221b,'request\x20sent');_0x42d7d9(_0x2af0aa[_0xa9fd('0x28')][_0xa9fd('0x27')]);}})[_0xa9fd('0x29')](function(_0x1c761d){logger[_0xa9fd('0x24')](_0xa9fd('0x26'),_0x11221b,_0x1c761d);_0x1ec277(_0x1c761d);});});}function respondWithStatusCode(_0x44a525,_0x17d70f){_0x17d70f=_0x17d70f||0xcc;return function(_0xddf48d){if(_0xddf48d){return _0x44a525[_0xa9fd('0x2a')](_0x17d70f);}return _0x44a525[_0xa9fd('0x2b')](_0x17d70f)[_0xa9fd('0x2c')]();};}function respondWithResult(_0x43098d,_0x437ee9){_0x437ee9=_0x437ee9||0xc8;return function(_0xe12216){if(_0xe12216){return _0x43098d[_0xa9fd('0x2b')](_0x437ee9)[_0xa9fd('0x2d')](_0xe12216);}};}function respondWithFilteredResult(_0x517a16,_0x10c696){return function(_0x1a4e69){if(_0x1a4e69){var _0x308ee7=typeof _0x10c696['offset']===_0xa9fd('0x2e')&&typeof _0x10c696[_0xa9fd('0x2f')]===_0xa9fd('0x2e');var _0x3381e1=_0x1a4e69[_0xa9fd('0x30')];var _0x3331f3=_0x308ee7?0x0:_0x10c696[_0xa9fd('0x31')];var _0x5f1cda=_0x308ee7?_0x1a4e69[_0xa9fd('0x30')]:_0x10c696[_0xa9fd('0x31')]+_0x10c696[_0xa9fd('0x2f')];var _0x5604d8;if(_0x5f1cda>=_0x3381e1){_0x5f1cda=_0x3381e1;_0x5604d8=0xc8;}else{_0x5604d8=0xce;}_0x517a16[_0xa9fd('0x2b')](_0x5604d8);return _0x517a16[_0xa9fd('0x32')](_0xa9fd('0x33'),_0x3331f3+'-'+_0x5f1cda+'/'+_0x3381e1)[_0xa9fd('0x2d')](_0x1a4e69);}return null;};}function patchUpdates(_0x4e7608){return function(_0x689dba){try{jsonpatch[_0xa9fd('0x34')](_0x689dba,_0x4e7608,!![]);}catch(_0xe679f8){return BPromise[_0xa9fd('0x35')](_0xe679f8);}return _0x689dba[_0xa9fd('0x36')]();};}function saveUpdates(_0xa17848,_0x54a271){return function(_0x4809c8){if(_0x4809c8){return _0x4809c8[_0xa9fd('0x37')](_0xa17848)[_0xa9fd('0x1e')](function(_0x2e4bf1){return _0x2e4bf1;});}return null;};}function removeEntity(_0x2d7272,_0x49d3c8){return function(_0x2057a2){if(_0x2057a2){return _0x2057a2['destroy']()['then'](function(){_0x2d7272['status'](0xcc)[_0xa9fd('0x2c')]();});}};}function handleEntityNotFound(_0x18af45,_0x5f5d65){return function(_0x3be234){if(!_0x3be234){_0x18af45[_0xa9fd('0x2a')](0x194);}return _0x3be234;};}function handleError(_0x426c04,_0x469c8a){_0x469c8a=_0x469c8a||0x1f4;return function(_0x1a8b9e){logger['error'](_0x1a8b9e['stack']);if(_0x1a8b9e['name']){delete _0x1a8b9e[_0xa9fd('0x38')];}_0x426c04[_0xa9fd('0x2b')](_0x469c8a)['send'](_0x1a8b9e);};}exports['index']=function(_0x15c0ee,_0x16d098){var _0x2b58de={},_0x3c56c5={},_0x33f1e9={'count':0x0,'rows':[]};var _0x290ddb=_[_0xa9fd('0x39')](db[_0xa9fd('0x3a')][_0xa9fd('0x3b')],function(_0x2d8fb8){return{'name':_0x2d8fb8[_0xa9fd('0x3c')],'type':_0x2d8fb8[_0xa9fd('0x3d')]['key']};});_0x3c56c5[_0xa9fd('0x3e')]=_[_0xa9fd('0x39')](_0x290ddb,'name');_0x3c56c5[_0xa9fd('0x3f')]=_[_0xa9fd('0x40')](_0x15c0ee[_0xa9fd('0x3f')]);_0x3c56c5[_0xa9fd('0x41')]=_[_0xa9fd('0x42')](_0x3c56c5['model'],_0x3c56c5[_0xa9fd('0x3f')]);_0x2b58de[_0xa9fd('0x43')]=_[_0xa9fd('0x42')](_0x3c56c5[_0xa9fd('0x3e')],qs['fields'](_0x15c0ee[_0xa9fd('0x3f')][_0xa9fd('0x44')]));_0x2b58de['attributes']=_0x2b58de[_0xa9fd('0x43')][_0xa9fd('0x45')]?_0x2b58de[_0xa9fd('0x43')]:_0x3c56c5[_0xa9fd('0x3e')];if(!_0x15c0ee['query'][_0xa9fd('0x46')](_0xa9fd('0x47'))){_0x2b58de[_0xa9fd('0x2f')]=qs[_0xa9fd('0x2f')](_0x15c0ee['query']['limit']);_0x2b58de[_0xa9fd('0x31')]=qs[_0xa9fd('0x31')](_0x15c0ee[_0xa9fd('0x3f')][_0xa9fd('0x31')]);}_0x2b58de[_0xa9fd('0x48')]=qs[_0xa9fd('0x49')](_0x15c0ee[_0xa9fd('0x3f')]['sort']);_0x2b58de[_0xa9fd('0x4a')]=qs[_0xa9fd('0x41')](_[_0xa9fd('0x4b')](_0x15c0ee[_0xa9fd('0x3f')],_0x3c56c5[_0xa9fd('0x41')]),_0x290ddb);if(_0x15c0ee['query']['filter']){_0x2b58de[_0xa9fd('0x4a')]=_[_0xa9fd('0x4c')](_0x2b58de[_0xa9fd('0x4a')],{'$or':_['map'](_0x290ddb,function(_0x285a4f){if(_0x285a4f[_0xa9fd('0x3d')]!=='VIRTUAL'){var _0x3b6717={};_0x3b6717[_0x285a4f[_0xa9fd('0x38')]]={'$like':'%'+_0x15c0ee[_0xa9fd('0x3f')][_0xa9fd('0x4d')]+'%'};return _0x3b6717;}})});}_0x2b58de=_['merge']({},_0x2b58de,_0x15c0ee[_0xa9fd('0x4e')]);var _0x7ecbbe={'where':_0x2b58de['where']};return db[_0xa9fd('0x3a')][_0xa9fd('0x30')](_0x7ecbbe)[_0xa9fd('0x1e')](function(_0x36fc3e){_0x33f1e9[_0xa9fd('0x30')]=_0x36fc3e;if(_0x15c0ee[_0xa9fd('0x3f')][_0xa9fd('0x4f')]){_0x2b58de[_0xa9fd('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0xa9fd('0x51')](_0x2b58de);})[_0xa9fd('0x1e')](function(_0x29b15d){_0x33f1e9[_0xa9fd('0x52')]=_0x29b15d;return _0x33f1e9;})[_0xa9fd('0x1e')](respondWithFilteredResult(_0x16d098,_0x2b58de))[_0xa9fd('0x29')](handleError(_0x16d098,null));};exports[_0xa9fd('0x53')]=function(_0x4acbf2,_0x2a67a8){var _0x260df6={'raw':!![],'where':{'id':_0x4acbf2[_0xa9fd('0x54')]['id']}},_0x5c5151={};_0x5c5151[_0xa9fd('0x3e')]=_['keys'](db[_0xa9fd('0x3a')][_0xa9fd('0x3b')]);_0x5c5151[_0xa9fd('0x3f')]=_[_0xa9fd('0x40')](_0x4acbf2[_0xa9fd('0x3f')]);_0x5c5151[_0xa9fd('0x41')]=_[_0xa9fd('0x42')](_0x5c5151[_0xa9fd('0x3e')],_0x5c5151[_0xa9fd('0x3f')]);_0x260df6[_0xa9fd('0x43')]=_[_0xa9fd('0x42')](_0x5c5151[_0xa9fd('0x3e')],qs[_0xa9fd('0x44')](_0x4acbf2['query'][_0xa9fd('0x44')]));_0x260df6['attributes']=_0x260df6[_0xa9fd('0x43')][_0xa9fd('0x45')]?_0x260df6['attributes']:_0x5c5151[_0xa9fd('0x3e')];if(_0x4acbf2[_0xa9fd('0x3f')][_0xa9fd('0x4f')]){_0x260df6[_0xa9fd('0x50')]=[{'all':!![]}];}_0x260df6=_[_0xa9fd('0x4c')]({},_0x260df6,_0x4acbf2['options']);return db[_0xa9fd('0x3a')][_0xa9fd('0x55')](_0x260df6)[_0xa9fd('0x1e')](handleEntityNotFound(_0x2a67a8,null))[_0xa9fd('0x1e')](respondWithResult(_0x2a67a8,null))[_0xa9fd('0x29')](handleError(_0x2a67a8,null));};exports[_0xa9fd('0x56')]=function(_0x59e1a5,_0x3dcb6a){return db[_0xa9fd('0x3a')][_0xa9fd('0x56')](_0x59e1a5['body'],{})[_0xa9fd('0x1e')](respondWithResult(_0x3dcb6a,0xc9))[_0xa9fd('0x29')](handleError(_0x3dcb6a,null));};exports[_0xa9fd('0x37')]=function(_0x11ad3a,_0x2e0b3c){if(_0x11ad3a[_0xa9fd('0x57')]['id']){delete _0x11ad3a[_0xa9fd('0x57')]['id'];}return db[_0xa9fd('0x3a')][_0xa9fd('0x55')]({'where':{'id':_0x11ad3a[_0xa9fd('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e0b3c,null))[_0xa9fd('0x1e')](saveUpdates(_0x11ad3a['body'],null))[_0xa9fd('0x1e')](respondWithResult(_0x2e0b3c,null))[_0xa9fd('0x29')](handleError(_0x2e0b3c,null));};exports[_0xa9fd('0x58')]=function(_0x5c03c7,_0x195925){return db['SmsMessage']['find']({'where':{'id':_0x5c03c7[_0xa9fd('0x54')]['id']}})[_0xa9fd('0x1e')](handleEntityNotFound(_0x195925,null))[_0xa9fd('0x1e')](removeEntity(_0x195925,null))[_0xa9fd('0x29')](handleError(_0x195925,null));};exports[_0xa9fd('0x59')]=function(_0x33e028,_0x1819dd){return db[_0xa9fd('0x3a')][_0xa9fd('0x59')]()[_0xa9fd('0x1e')](respondWithResult(_0x1819dd,null))[_0xa9fd('0x29')](handleError(_0x1819dd,null));};var interaction_log=require(_0xa9fd('0x5a'))(_0xa9fd('0x5b'));exports[_0xa9fd('0x5c')]=function(_0x8500bc,_0x2916df,_0x2b1c39){var _0x4a3950={'agent':{},'channel':'sms'};if(_0x8500bc[_0xa9fd('0x57')]['id']){delete _0x8500bc[_0xa9fd('0x57')]['id'];}_0x8500bc[_0xa9fd('0x57')]['read']=!![];_0x8500bc[_0xa9fd('0x57')][_0xa9fd('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8500bc[_0xa9fd('0x57')][_0xa9fd('0x5e')]=_0x8500bc[_0xa9fd('0x57')][_0xa9fd('0x5e')]||_0x8500bc[_0xa9fd('0x5f')]['id'];_0x4a3950[_0xa9fd('0x60')]['id']=_0x8500bc['body']['UserId'];return db[_0xa9fd('0x3a')][_0xa9fd('0x55')]({'where':{'id':_0x8500bc['params']['id'],'UserId':null}})[_0xa9fd('0x1e')](handleEntityNotFound(_0x2916df,null))['then'](saveUpdates(_0x8500bc[_0xa9fd('0x57')],null))[_0xa9fd('0x1e')](function(_0x3fb914){if(_0x3fb914){_0x4a3950[_0xa9fd('0x27')]=_0x3fb914[_0xa9fd('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3fb914['SmsInteractionId']}});}return null;})[_0xa9fd('0x1e')](handleEntityNotFound(_0x2916df,null))[_0xa9fd('0x1e')](function(_0x17ec41){if(_0x17ec41){return _0x17ec41[_0xa9fd('0x37')]({'UserId':_0x8500bc['body'][_0xa9fd('0x5e')],'read1stAt':_[_0xa9fd('0x62')](_0x17ec41[_0xa9fd('0x63')])?moment()[_0xa9fd('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x416956){if(_0x416956){_0x4a3950[_0xa9fd('0x65')]=_0x416956['get']({'plain':!![]});interaction_log[_0xa9fd('0x1f')](_0xa9fd('0x66'),_0x8500bc[_0xa9fd('0x5f')]['id'],_0x8500bc[_0xa9fd('0x5f')][_0xa9fd('0x38')],_0x8500bc[_0xa9fd('0x5f')][_0xa9fd('0x67')],_0x4a3950['interaction']['id'],_0x8500bc[_0xa9fd('0x57')]?JSON[_0xa9fd('0x23')](_0x8500bc[_0xa9fd('0x57')]):_0xa9fd('0x68'));return respondWithRpcPromise(_0xa9fd('0x69'),'acceptMessage',_0x4a3950);}return null;})[_0xa9fd('0x1e')](function(_0x1b14b1){var _0x3dd8a6=_0xa9fd('0x6a')+_0x1b14b1[_0xa9fd('0x27')][_0xa9fd('0x6b')];return db[_0xa9fd('0x6c')][_0xa9fd('0x3f')](_0x3dd8a6,{'type':db[_0xa9fd('0x6d')]['QueryTypes'][_0xa9fd('0x6e')],'raw':!![]})['then'](function(_0x1ae3e6){return _0x1ae3e6;});})[_0xa9fd('0x1e')](function(_0x3fa27d){if(_0x3fa27d){_0x4a3950[_0xa9fd('0x27')][_0xa9fd('0x6f')]=_0x3fa27d[0x0];if(!_0x8500bc[_0xa9fd('0x57')]['UserId'])return;return db[_0xa9fd('0x70')][_0xa9fd('0x55')]({'where':{'id':_0x8500bc[_0xa9fd('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0xa9fd('0x38'),'fullname','email',_0xa9fd('0x71')],'raw':!![]});}return null;})['then'](function(_0x57dd36){if(!_0x57dd36)return null;_0x4a3950[_0xa9fd('0x27')][_0xa9fd('0x60')]=_0x57dd36;return _0x4a3950;})[_0xa9fd('0x1e')](function(_0x3acd4a){if(_0x3acd4a){if(_0x8500bc[_0xa9fd('0x57')]['manual']){_0x4a3950['message'][_0xa9fd('0x72')]=util[_0xa9fd('0x64')](_0xa9fd('0x73'),_0x8500bc['user'][_0xa9fd('0x38')]);_0x4a3950[_0xa9fd('0x27')][_0xa9fd('0x74')]=_0x4a3950[_0xa9fd('0x74')];_0x4a3950['message'][_0xa9fd('0x75')]=_0x4a3950[_0xa9fd('0x74')];_0x4a3950[_0xa9fd('0x27')][_0xa9fd('0x76')]=_0xa9fd('0x5c');return respondWithRpcPromise(_0xa9fd('0x77'),_0xa9fd('0x77'),{'event':_0xa9fd('0x78'),'message':_0x4a3950[_0xa9fd('0x27')]},client9002)['then'](function(){return _0x4a3950;});}return _0x4a3950;}return null;})['then'](respondWithResult(_0x2916df,null))[_0xa9fd('0x29')](handleError(_0x2916df,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xa9fd('0x35')]=function(_0x43126b,_0x1fffeb,_0x3a3bc8){var _0x4bc35b={'agent':{},'channel':'sms'};if(_0x43126b['body']['id']){delete _0x43126b['body']['id'];}_0x43126b[_0xa9fd('0x57')][_0xa9fd('0x5e')]=_0x43126b[_0xa9fd('0x57')][_0xa9fd('0x5e')]||_0x43126b['user']['id'];_0x4bc35b[_0xa9fd('0x60')]['id']=_0x43126b[_0xa9fd('0x57')][_0xa9fd('0x5e')];return db['SmsMessage'][_0xa9fd('0x55')]({'where':{'id':_0x43126b[_0xa9fd('0x54')]['id'],'UserId':null}})[_0xa9fd('0x1e')](handleEntityNotFound(_0x1fffeb,null))[_0xa9fd('0x1e')](function(_0x23076a){if(_0x23076a){_0x4bc35b['message']=_0x23076a[_0xa9fd('0x61')]({'plain':!![]});return db['SmsInteraction'][_0xa9fd('0x55')]({'where':{'id':_0x23076a[_0xa9fd('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x1fffeb,null))[_0xa9fd('0x1e')](function(_0x5d9da2){if(_0x5d9da2){_0x4bc35b[_0xa9fd('0x65')]=_0x5d9da2[_0xa9fd('0x61')]({'plain':!![]});interaction_log[_0xa9fd('0x1f')](_0xa9fd('0x7a'),_0x43126b[_0xa9fd('0x5f')]['id'],_0x43126b['user'][_0xa9fd('0x38')],_0x43126b['user']['role'],_0x4bc35b[_0xa9fd('0x65')]['id'],_0x43126b[_0xa9fd('0x57')]?JSON[_0xa9fd('0x23')](_0x43126b[_0xa9fd('0x57')]):_0xa9fd('0x68'));return respondWithRpcPromise(_0xa9fd('0x7b'),_0xa9fd('0x7c'),_0x4bc35b);}return null;})['then'](function(_0x16477a){var _0x14d3c2=_0xa9fd('0x6a')+_0x16477a[_0xa9fd('0x27')][_0xa9fd('0x6b')];return db[_0xa9fd('0x6c')]['query'](_0x14d3c2,{'type':db[_0xa9fd('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xa9fd('0x1e')](function(_0x5959c7){return _0x5959c7;});})[_0xa9fd('0x1e')](function(_0x53ccac){if(_0x53ccac){_0x4bc35b[_0xa9fd('0x27')]['contact']=_0x53ccac[0x0];if(!_0x43126b['body'][_0xa9fd('0x5e')])return;return db[_0xa9fd('0x70')]['find']({'where':{'id':_0x43126b[_0xa9fd('0x57')][_0xa9fd('0x5e')],'role':_0xa9fd('0x60')},'attributes':['id',_0xa9fd('0x38'),_0xa9fd('0x7d'),_0xa9fd('0x7e'),'internal'],'raw':!![]});}return null;})[_0xa9fd('0x1e')](function(_0x5430a2){if(!_0x5430a2)return null;_0x4bc35b[_0xa9fd('0x27')][_0xa9fd('0x60')]=_0x5430a2;return _0x4bc35b;})['then'](function(_0x4c617d){if(_0x4c617d){_0x4c617d[_0xa9fd('0x27')][_0xa9fd('0x72')]=util[_0xa9fd('0x64')]('SIP/%s',_0x43126b[_0xa9fd('0x5f')][_0xa9fd('0x38')]);_0x4c617d['message'][_0xa9fd('0x74')]=_0x4bc35b[_0xa9fd('0x74')];_0x4c617d[_0xa9fd('0x27')][_0xa9fd('0x75')]=_0x4bc35b[_0xa9fd('0x74')];_0x4c617d[_0xa9fd('0x27')][_0xa9fd('0x76')]=_0xa9fd('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x4c617d['message']},client9002);return _0x4bc35b;}return null;})['then'](respondWithResult(_0x1fffeb,null))[_0xa9fd('0x29')](handleError(_0x1fffeb,null));};exports[_0xa9fd('0x2b')]=function(_0x1b0cf4,_0x294483,_0x1b1947){if(_0x1b0cf4[_0xa9fd('0x57')]['id']){delete _0x1b0cf4[_0xa9fd('0x57')]['id'];}var _0xbf60d7;return db[_0xa9fd('0x3a')][_0xa9fd('0x55')]({'where':{'id':_0x1b0cf4['params']['id']}})[_0xa9fd('0x1e')](handleEntityNotFound(_0x294483,null))['then'](function(_0x1cbe5c){if(_0x1cbe5c){_0xbf60d7=_0x1cbe5c;return db[_0xa9fd('0x7f')]['find']({'where':{'id':_0x1cbe5c[_0xa9fd('0x80')]}});}})[_0xa9fd('0x1e')](handleEntityNotFound(_0x294483,null))[_0xa9fd('0x1e')](function(_0x26da28){if(_0x26da28){logger[_0xa9fd('0x20')](_0xa9fd('0x21'),_0xa9fd('0x2b'),'received\x20delivery\x20report\x20from',_0x26da28['type'],util['inspect'](_0x1b0cf4[_0xa9fd('0x57')],{'showHidden':![],'depth':null}));switch(_0x26da28['type']){case _0xa9fd('0x81'):if(_0x1b0cf4[_0xa9fd('0x57')][_0xa9fd('0x82')]&&_0x1b0cf4[_0xa9fd('0x57')][_0xa9fd('0x82')]===_0xbf60d7[_0xa9fd('0x83')]){return _0xbf60d7['update']({'read':!![]});}else{logger[_0xa9fd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa9fd('0x2b'),_0xa9fd('0x81'),util[_0xa9fd('0x84')](_0x1b0cf4['body'],{'showHidden':![],'depth':null}));}break;case _0xa9fd('0x85'):if(_0x1b0cf4[_0xa9fd('0x57')][_0xa9fd('0x86')]&&_0x1b0cf4[_0xa9fd('0x57')]['MessageUUID']===_0xbf60d7[_0xa9fd('0x83')]&&_['indexOf']([_0xa9fd('0x87'),_0xa9fd('0x88')],_0x1b0cf4[_0xa9fd('0x57')]['Status'])>=0x0){return _0xbf60d7[_0xa9fd('0x37')]({'read':!![]});}else{logger[_0xa9fd('0x24')](_0xa9fd('0x89'),'status',_0xa9fd('0x8a'),util[_0xa9fd('0x84')](_0x1b0cf4['body'],{'showHidden':![],'depth':null}));}break;case _0xa9fd('0x8b'):var _0x3f7b22=_0x1b0cf4['body'][_0xa9fd('0x8c')][0x0];if(_0x3f7b22[_0xa9fd('0x2b')][_0xa9fd('0x8d')]===_0xa9fd('0x8e')){return _0xbf60d7[_0xa9fd('0x37')]({'read':!![]});}else{logger[_0xa9fd('0x24')](_0xa9fd('0x89'),_0xa9fd('0x2b'),_0xa9fd('0x8b'),util[_0xa9fd('0x84')](_0x1b0cf4[_0xa9fd('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xbf60d7;}})[_0xa9fd('0x1e')](respondWithResult(_0x294483,null))[_0xa9fd('0x29')](handleError(_0x294483,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7204fea..9550533 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 _0x0416=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x0416,0x12a));var _0x6041=function(_0x1d6c57,_0xae8f05){_0x1d6c57=_0x1d6c57-0x0;var _0x531f65=_0x0416[_0x1d6c57];return _0x531f65;};'use strict';var EventEmitter=require(_0x6041('0x0'));var SmsMessage=require(_0x6041('0x1'))['db'][_0x6041('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6041('0x3')](0x0);var events={'afterCreate':_0x6041('0x4'),'afterUpdate':_0x6041('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31216e){return function(_0x3e9620,_0x860a75,_0x2884ed){SmsMessageEvents[_0x6041('0x6')](_0x31216e+':'+_0x3e9620['id'],_0x3e9620);SmsMessageEvents[_0x6041('0x6')](_0x31216e,_0x3e9620);_0x2884ed(null);};}for(var e in events){if(events[_0x6041('0x7')](e)){var event=events[e];SmsMessage[_0x6041('0x8')](e,emitEvent(event));}}module[_0x6041('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x4710=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x341aa3,_0xa93441){var _0x55ed7e=function(_0x5e7c94){while(--_0x5e7c94){_0x341aa3['push'](_0x341aa3['shift']());}};_0x55ed7e(++_0xa93441);}(_0x4710,0x16d));var _0x0471=function(_0x14ecd7,_0x2588df){_0x14ecd7=_0x14ecd7-0x0;var _0x39d294=_0x4710[_0x14ecd7];return _0x39d294;};'use strict';var EventEmitter=require(_0x0471('0x0'));var SmsMessage=require(_0x0471('0x1'))['db'][_0x0471('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0471('0x3')](0x0);var events={'afterCreate':_0x0471('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x121bf5){return function(_0x101985,_0x3af752,_0x55179f){SmsMessageEvents[_0x0471('0x5')](_0x121bf5+':'+_0x101985['id'],_0x101985);SmsMessageEvents['emit'](_0x121bf5,_0x101985);_0x55179f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0471('0x6')](e,emitEvent(event));}}module[_0x0471('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 683297a..6049f25 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 _0x0573=['../../config/environment','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','direction','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','password','smsMethod','sender','login?username=','username','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','data','queued_count','clickSend','plivo','authId','senderString','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','createHash','md5','hex','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','apiMessageId','accountId','applicationId','base64','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xa2ad4,_0x129bff){var _0x456b01=function(_0x590439){while(--_0x590439){_0xa2ad4['push'](_0xa2ad4['shift']());}};_0x456b01(++_0x129bff);}(_0x0573,0xe4));var _0x3057=function(_0x3a7f86,_0xab4a2e){_0x3a7f86=_0x3a7f86-0x0;var _0x1242b9=_0x0573[_0x3a7f86];return _0x1242b9;};'use strict';var _=require(_0x3057('0x0'));var util=require(_0x3057('0x1'));var logger=require(_0x3057('0x2'))(_0x3057('0x3'));var moment=require(_0x3057('0x4'));var BPromise=require('bluebird');var rp=require(_0x3057('0x5'));var fs=require('fs');var path=require(_0x3057('0x6'));var rimraf=require(_0x3057('0x7'));var config=require(_0x3057('0x8'));var attributes=require('./smsMessage.attributes');module[_0x3057('0x9')]=function(_0x56f2ac,_0x5ad43c){return _0x56f2ac['define']('SmsMessage',attributes,{'tableName':_0x3057('0xa'),'paranoid':![],'indexes':[{'name':_0x3057('0xb'),'fields':[_0x3057('0xb')]},{'name':_0x3057('0xc'),'fields':[_0x3057('0xd')],'type':_0x3057('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24524b,_0x109814,_0x44cfaa){var _0x5db48e=_0x56f2ac['models'];var _0x5384f4=_0x24524b[_0x3057('0xf')]({'plain':!![]});if(_0x5384f4['direction'][_0x3057('0x10')]()==='in'||_0x5384f4['direction'][_0x3057('0x10')]()===_0x3057('0x11')&&!_0x5384f4['secret']&&!_[_0x3057('0x12')](_0x5384f4[_0x3057('0x13')])&&!_[_0x3057('0x12')](_0x5384f4[_0x3057('0x14')])){_0x5db48e[_0x3057('0x15')][_0x3057('0x16')]({'where':{'id':_0x5384f4[_0x3057('0x14')]}})[_0x3057('0x17')](function(_0x54ee64){if(_0x54ee64){_0x54ee64['update']({'lastMsgAt':_0x5384f4[_0x3057('0x18')],'lastMsgDirection':_0x5384f4[_0x3057('0x19')][_0x3057('0x10')]()});}})[_0x3057('0x1a')](function(_0x3344d8){console[_0x3057('0x1b')](_0x3344d8);});}if(_0x5384f4[_0x3057('0x19')]==='out'&&!_0x5384f4['secret']){var _0x246c0a;_0x5db48e['SmsAccount'][_0x3057('0x1c')]({'where':{'id':_0x5384f4[_0x3057('0x1d')]},'raw':!![]})[_0x3057('0x17')](function(_0x3149fa){_0x246c0a=_0x3149fa;if(_0x246c0a&&_0x246c0a[_0x3057('0x1e')]){switch(_0x246c0a[_0x3057('0x1e')]){case _0x3057('0x1f'):var _0x491b4b=require(_0x3057('0x1f'));if(_0x246c0a[_0x3057('0x20')]&&_0x246c0a[_0x3057('0x21')]&&_0x246c0a['phone']){var _0x54f66d=new _0x491b4b(_0x246c0a[_0x3057('0x20')],_0x246c0a['authToken']);_0x54f66d[_0x3057('0x22')][_0x3057('0x23')]({'body':_0x5384f4[_0x3057('0xd')],'to':_0x5384f4[_0x3057('0x24')],'from':_0x246c0a[_0x3057('0x24')],'statusCallback':_0x246c0a[_0x3057('0x25')]+'/api/sms/messages/'+_0x5384f4['id']+_0x3057('0x26')+_0x246c0a[_0x3057('0x27')]})[_0x3057('0x17')](function(_0x511a86){if(_0x511a86[_0x3057('0x28')]){return _0x24524b[_0x3057('0x29')]({'messageId':_0x511a86[_0x3057('0x28')]});}})[_0x3057('0x1a')](function(_0x31b203){logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),'twilio',util[_0x3057('0x2c')](_0x31b203,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),'twilio',_0x3057('0x2d'));}break;case'skebby':var _0x4a543d='https://api.skebby.it/API/v1.0/REST/';if(_0x246c0a['username']&&_0x246c0a[_0x3057('0x2e')]){var _0x4e75a0={'recipient':[_0x5384f4[_0x3057('0x24')]],'message':_0x5384f4['body'],'message_type':_0x246c0a['smsMethod']};if(_0x246c0a[_0x3057('0x2f')]&&_0x246c0a[_0x3057('0x2f')]!=='SI'){_0x4e75a0[_0x3057('0x30')]=_0x246c0a[_0x3057('0x24')];}var _0x19ac7b={'url':_0x4a543d+_0x3057('0x31')+_0x246c0a[_0x3057('0x32')]+_0x3057('0x33')+_0x246c0a[_0x3057('0x2e')],'method':'GET'};rp(_0x19ac7b)['then'](function(_0x28932e){var _0x211095=_0x28932e['split'](';');var _0x319a4a={'user_key':_0x211095[0x0],'session_key':_0x211095[0x1]};_0x19ac7b={'url':_0x4a543d+_0x3057('0x34'),'method':_0x3057('0x35'),'headers':{'user_key':_0x319a4a[_0x3057('0x36')],'Session_key':_0x319a4a[_0x3057('0x37')]},'json':!![],'body':_0x4e75a0};return rp(_0x19ac7b);})[_0x3057('0x17')](function(_0x16a7cd){if(_0x16a7cd[_0x3057('0x38')]>=0x1){var _0x5c982b={'messageId':_0x16a7cd[_0x3057('0x39')]};if(_0x246c0a[_0x3057('0x2f')]!=='GP'||!_0x246c0a[_0x3057('0x3a')]){_0x5c982b[_0x3057('0x3b')]=!![];}return _0x24524b['update'](_0x5c982b);}else{return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3c'),util[_0x3057('0x2c')](_0x16a7cd,{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x3b8426){return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x3c'),util[_0x3057('0x2c')](_0x3b8426,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3c'),_0x3057('0x3d'));}break;case _0x3057('0x3e'):if(_0x246c0a['authToken']){var _0x4f1c3d={'recipient':_0x5384f4[_0x3057('0x24')],'message':_0x5384f4[_0x3057('0xd')],'sender':_0x246c0a['senderString']||_0x246c0a[_0x3057('0x24')],'authorization':_0x246c0a[_0x3057('0x21')]};var _0x109814={'method':_0x3057('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4f1c3d,'json':!![]};rp(_0x109814)['then'](function(_0x4046ff){var _0x36db9e={'messageId':_0x4046ff[_0x3057('0x3f')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x36db9e[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x36db9e);})['catch'](function(_0x5437cd){logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3e'),util[_0x3057('0x2c')](_0x5437cd,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3e'),_0x3057('0x40'));}break;case _0x3057('0x41'):if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a[_0x3057('0x2e')]){var _0x4f1c3d={'messages':[{'source':_0x3057('0x42'),'to':_0x5384f4['phone'],'body':_0x5384f4[_0x3057('0xd')],'from':_0x246c0a['senderString']||_0x246c0a[_0x3057('0x24')]}]};var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x32')],_0x246c0a[_0x3057('0x2e')]);var _0x109814={'method':_0x3057('0x35'),'uri':_0x3057('0x45'),'body':_0x4f1c3d,'headers':{'Authorization':util[_0x3057('0x43')](_0x3057('0x46'),new Buffer(_0xe80e3a)['toString']('base64'))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x52aec9){if(_0x52aec9['http_code']>=0xc8&&_0x52aec9['http_code']<=0xce){if(_0x52aec9[_0x3057('0x47')]&&_0x52aec9[_0x3057('0x47')][_0x3057('0x48')]>0x0){var _0x5e46ba=_['head'](_0x52aec9[_0x3057('0x47')][_0x3057('0x22')]);var _0x199828={'messageId':_0x5e46ba['message_id']};if(!_0x246c0a[_0x3057('0x3a')]){_0x199828[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x199828);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x49'),util[_0x3057('0x2c')](_0x52aec9,{'showHidden':![],'depth':null}));}}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate',_0x3057('0x49'),util[_0x3057('0x2c')](_0x52aec9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x494504){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x49'),util['inspect'](_0x494504,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x49'),_0x3057('0x3d'));}break;case _0x3057('0x4a'):if(_0x246c0a[_0x3057('0x4b')]&&_0x246c0a[_0x3057('0x21')]){var _0x4f1c3d={'dst':_0x5384f4['phone'],'text':_0x5384f4[_0x3057('0xd')],'src':_0x246c0a[_0x3057('0x4c')]||_0x246c0a['phone'],'url':_0x246c0a[_0x3057('0x25')]+_0x3057('0x4d')+_0x5384f4['id']+'/status?token='+_0x246c0a[_0x3057('0x27')]};var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x4b')],_0x246c0a[_0x3057('0x21')]);var _0x109814={'method':'POST','uri':util['format'](_0x3057('0x4e'),_0x246c0a[_0x3057('0x4b')]),'body':_0x4f1c3d,'headers':{'Authorization':util[_0x3057('0x43')](_0x3057('0x46'),new Buffer(_0xe80e3a)[_0x3057('0x4f')]('base64'))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x4f925b){var _0x113781={'messageId':_0x4f925b['message_uuid'][0x0]};return _0x24524b[_0x3057('0x29')](_0x113781);})[_0x3057('0x1a')](function(_0xc51968){logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x4a'),util[_0x3057('0x2c')](_0xc51968,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),'afterCreate','plivo',_0x3057('0x50'));}break;case _0x3057('0x51'):if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a[_0x3057('0x2e')]){if(_0x246c0a[_0x3057('0x52')]){var _0x3bf8ab={'method':'POST','uri':_0x246c0a[_0x3057('0x52')]+_0x3057('0x53'),'body':{'username':_0x246c0a[_0x3057('0x32')],'password':_0x246c0a['password']},'json':!![]};return rp(_0x3bf8ab)[_0x3057('0x17')](function(_0x289228){var _0xab32a0={'method':_0x3057('0x35'),'uri':_0x246c0a[_0x3057('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x246c0a[_0x3057('0x24')],'destinations':[{'to':_0x5384f4[_0x3057('0x24')]}],'text':_0x5384f4[_0x3057('0xd')],'notifyUrl':_0x246c0a[_0x3057('0x25')]+'/api/sms/messages/'+_0x5384f4['id']+_0x3057('0x26')+_0x246c0a['token'],'notifyContentType':_0x3057('0x54'),'callbackData':_0x246c0a['phone']+';'+_0x5384f4[_0x3057('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x289228[_0x3057('0x27')]},'json':!![]};return rp(_0xab32a0)['then'](function(_0x11ecf1){if(_0x11ecf1[_0x3057('0x22')]){var _0x2bb1b7={'messageId':_0x11ecf1[_0x3057('0x22')][0x0][_0x3057('0xb')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x2bb1b7[_0x3057('0x3b')]=!![];}return _0x24524b['update'](_0x2bb1b7);}else{return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x51'),util[_0x3057('0x2c')](_0x11ecf1,{'showHidden':![],'depth':null}));}});})[_0x3057('0x1a')](function(_0x100169){return logger['error'](_0x3057('0x2a'),'afterCreate',_0x3057('0x51'),util[_0x3057('0x2c')](_0x100169,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x51'),_0x3057('0x55'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x51'),_0x3057('0x3d'));}break;case _0x3057('0x56'):var _0x3c5822=require(_0x3057('0x57'));if(_0x246c0a['apiKey']){var _0x19df68={};_0x19df68[_0x3057('0x58')]=_0x246c0a['username'];_0x19df68[_0x3057('0x24')]=_0x5384f4['phone'];_0x19df68[_0x3057('0x30')]=_0x246c0a[_0x3057('0x24')];_0x19df68[_0x3057('0x59')]=_0x5384f4[_0x3057('0xd')];_0x19df68[_0x3057('0x5a')]=+new Date();var _0x40e8db='';var _0x4dad76='';var _0x5856b6=Object[_0x3057('0x5b')](_0x19df68);_0x5856b6[_0x3057('0x5c')]();for(var _0x2d1216=0x0;_0x2d1216<_0x5856b6['length'];_0x2d1216++){if(_0x40e8db!=''){_0x40e8db+='&';}_0x40e8db+=_0x5856b6[_0x2d1216]+'='+encodeURIComponent(_0x19df68[_0x5856b6[_0x2d1216]]);_0x4dad76+=_0x19df68[_0x5856b6[_0x2d1216]];}_0x4dad76+=_0x246c0a['apiKey'];_0x4dad76=_0x3c5822[_0x3057('0x5d')](_0x3057('0x5e'))[_0x3057('0x29')](_0x4dad76)['digest'](_0x3057('0x5f'));if(_0x40e8db!==''){_0x40e8db+='&';}_0x40e8db+='signature='+_0x4dad76;var _0x19ac7b={'method':_0x3057('0x60'),'uri':_0x246c0a[_0x3057('0x52')]+'/external/get/send.php?'+_0x40e8db,'json':!![]};return rp(_0x19ac7b)['then'](function(_0x256e92){var _0x5cd1fa=Object[_0x3057('0x5b')](_0x256e92);if(_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x1b')]&&parseInt(_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x1b')])===0x0){var _0x5ab5e9={'messageId':_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x61')]};if(!_0x246c0a['deliveryReport']){_0x5ab5e9[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x5ab5e9);}else{return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),util[_0x3057('0x2c')](_0x256e92[_0x3057('0x1b')],{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x365643){return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),util['inspect'](_0x365643,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),_0x3057('0x62'));}break;case _0x3057('0x63'):if(_0x246c0a[_0x3057('0x64')]){var _0x3c031d={'method':_0x3057('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x246c0a[_0x3057('0x64')]},'body':{'content':_0x5384f4[_0x3057('0xd')],'to':[_0x5384f4[_0x3057('0x24')]],'from':_0x246c0a[_0x3057('0x24')],'binary':![],'clientMessageId':_0x3057('0x65'),'charset':_0x3057('0x66')},'json':!![]};rp(_0x3c031d)['then'](function(_0x2f9b6c){if(!_0x2f9b6c[_0x3057('0x1b')]){var _0x20f5c7={'messageId':_0x2f9b6c['messages'][0x0][_0x3057('0x67')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x20f5c7[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x20f5c7);}else{return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x63'),util[_0x3057('0x2c')](_0x2f9b6c[_0x3057('0x1b')],{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x57cf90){return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),'clickatell',util[_0x3057('0x2c')](_0x57cf90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),'afterCreate',_0x3057('0x63'),_0x3057('0x62'));}break;case'bandwidth':if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a['password']){var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x32')],_0x246c0a[_0x3057('0x2e')]);var _0x109814={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x246c0a[_0x3057('0x68')]+'/messages','body':{'to':[_0x5384f4['phone']],'text':_0x5384f4[_0x3057('0xd')],'from':_0x246c0a[_0x3057('0x24')],'applicationId':_0x246c0a[_0x3057('0x69')]},'headers':{'Authorization':util[_0x3057('0x43')]('Basic\x20%s',new Buffer(_0xe80e3a)[_0x3057('0x4f')](_0x3057('0x6a')))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x4e222c){if(_0x4e222c['id']){var _0x56d2f9={'messageId':_0x4e222c['id']};return _0x24524b[_0x3057('0x29')](_0x56d2f9);}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x6b'),util['inspect'](_0x4e222c,{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x5bc1af){logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x6b'),util['inspect'](_0x5bc1af,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate',_0x3057('0x6b'),_0x3057('0x3d'));}break;case'intelepeer':if(_0x246c0a['apiKey']){var _0x2b3e40={};var _0x19ac7b={'method':_0x3057('0x35'),'uri':_0x3057('0x6c'),'headers':{'Authorization':_0x3057('0x6d')+_0x246c0a[_0x3057('0x64')],'Content-Type':_0x3057('0x54')},'body':{'from':_0x246c0a[_0x3057('0x24')],'to':_0x5384f4[_0x3057('0x24')],'text':_0x5384f4[_0x3057('0xd')]},'json':!![]};return rp(_0x19ac7b)[_0x3057('0x17')](function(_0x30d194){if(_0x30d194[_0x3057('0x6e')]==0xca){_0x2b3e40[_0x3057('0x6f')]=_0x30d194;var _0x35dd52={'method':_0x3057('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3057('0x6d')+_0x246c0a['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x2b3e40[_0x3057('0x6f')][_0x3057('0x70')]},'json':!![]};return rp(_0x35dd52)[_0x3057('0x17')](function(_0x1b41d4){_0x2b3e40[_0x3057('0x71')]=_0x1b41d4;var _0x469198={'messageId':_0x2b3e40['message'][_0x3057('0x70')],'read':!![]};return _0x24524b[_0x3057('0x29')](_0x469198);});}else{return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x72'),util[_0x3057('0x2c')](_0x30d194,{'showHidden':![],'depth':null}));}})['catch'](function(_0x495c68){return logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate','intelepeer',util[_0x3057('0x2c')](_0x495c68,{'showHidden':![],'depth':null}));});}else{return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x72'),_0x3057('0x73'));}break;}}})[_0x3057('0x74')](function(){_0x44cfaa();});}else{_0x44cfaa();}}},'charset':_0x3057('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3f33=['isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','create','remote','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','queued_count','messages','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','keys','sort','length','createHash','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','toString','base64','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x2cadce,_0x5ba0e8){var _0x4f046b=function(_0x387f4b){while(--_0x387f4b){_0x2cadce['push'](_0x2cadce['shift']());}};_0x4f046b(++_0x5ba0e8);}(_0x3f33,0x1d0));var _0x33f3=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x3f33[_0x2ff762];return _0x158b02;};'use strict';var _=require('lodash');var util=require(_0x33f3('0x0'));var logger=require('../../config/logger')(_0x33f3('0x1'));var moment=require('moment');var BPromise=require(_0x33f3('0x2'));var rp=require(_0x33f3('0x3'));var fs=require('fs');var path=require(_0x33f3('0x4'));var rimraf=require(_0x33f3('0x5'));var config=require(_0x33f3('0x6'));var attributes=require(_0x33f3('0x7'));module[_0x33f3('0x8')]=function(_0x58d30d,_0x254a36){return _0x58d30d[_0x33f3('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x33f3('0xa'),'fields':['messageId']},{'name':_0x33f3('0xb'),'fields':[_0x33f3('0xc')],'type':_0x33f3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32fdcc,_0x463b12,_0x310e5e){var _0x3021c0=_0x58d30d[_0x33f3('0xe')];var _0x1f43fd=_0x32fdcc[_0x33f3('0xf')]({'plain':!![]});if(_0x1f43fd[_0x33f3('0x10')][_0x33f3('0x11')]()==='in'||_0x1f43fd[_0x33f3('0x10')][_0x33f3('0x11')]()===_0x33f3('0x12')&&!_0x1f43fd[_0x33f3('0x13')]&&!_[_0x33f3('0x14')](_0x1f43fd[_0x33f3('0x15')])&&!_['isNil'](_0x1f43fd[_0x33f3('0x16')])){_0x3021c0[_0x33f3('0x17')][_0x33f3('0x18')]({'where':{'id':_0x1f43fd[_0x33f3('0x16')]}})[_0x33f3('0x19')](function(_0x3db951){if(_0x3db951){_0x3db951[_0x33f3('0x1a')]({'lastMsgAt':_0x1f43fd[_0x33f3('0x1b')],'lastMsgDirection':_0x1f43fd['direction']['toLowerCase']()});}})[_0x33f3('0x1c')](function(_0x22d2e6){console[_0x33f3('0x1d')](_0x22d2e6);});}if(_0x1f43fd['direction']==='out'&&!_0x1f43fd[_0x33f3('0x13')]){var _0x38a7ff;_0x3021c0[_0x33f3('0x1e')][_0x33f3('0x1f')]({'where':{'id':_0x1f43fd[_0x33f3('0x20')]},'raw':!![]})[_0x33f3('0x19')](function(_0x506008){_0x38a7ff=_0x506008;if(_0x38a7ff&&_0x38a7ff[_0x33f3('0x21')]){switch(_0x38a7ff[_0x33f3('0x21')]){case _0x33f3('0x22'):var _0x5275c4=require(_0x33f3('0x22'));if(_0x38a7ff['accountSid']&&_0x38a7ff[_0x33f3('0x23')]&&_0x38a7ff[_0x33f3('0x24')]){var _0x4968e1=new _0x5275c4(_0x38a7ff['accountSid'],_0x38a7ff[_0x33f3('0x23')]);_0x4968e1['messages'][_0x33f3('0x25')]({'body':_0x1f43fd[_0x33f3('0xc')],'to':_0x1f43fd[_0x33f3('0x24')],'from':_0x38a7ff[_0x33f3('0x24')],'statusCallback':_0x38a7ff[_0x33f3('0x26')]+'/api/sms/messages/'+_0x1f43fd['id']+'/status?token='+_0x38a7ff['token']})[_0x33f3('0x19')](function(_0xe09e41){if(_0xe09e41[_0x33f3('0x27')]){return _0x32fdcc[_0x33f3('0x1a')]({'messageId':_0xe09e41[_0x33f3('0x27')]});}})[_0x33f3('0x1c')](function(_0x995f9c){logger[_0x33f3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x33f3('0x22'),util[_0x33f3('0x28')](_0x995f9c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x22'),_0x33f3('0x2b'));}break;case'skebby':var _0x301fd3=_0x33f3('0x2c');if(_0x38a7ff[_0x33f3('0x2d')]&&_0x38a7ff[_0x33f3('0x2e')]){var _0x2d6850={'recipient':[_0x1f43fd['phone']],'message':_0x1f43fd[_0x33f3('0xc')],'message_type':_0x38a7ff['smsMethod']};if(_0x38a7ff[_0x33f3('0x2f')]&&_0x38a7ff[_0x33f3('0x2f')]!=='SI'){_0x2d6850[_0x33f3('0x30')]=_0x38a7ff['phone'];}var _0x3b6499={'url':_0x301fd3+_0x33f3('0x31')+_0x38a7ff[_0x33f3('0x2d')]+_0x33f3('0x32')+_0x38a7ff[_0x33f3('0x2e')],'method':_0x33f3('0x33')};rp(_0x3b6499)[_0x33f3('0x19')](function(_0x363483){var _0x2cf0d0=_0x363483[_0x33f3('0x34')](';');var _0x513306={'user_key':_0x2cf0d0[0x0],'session_key':_0x2cf0d0[0x1]};_0x3b6499={'url':_0x301fd3+_0x33f3('0x35'),'method':'POST','headers':{'user_key':_0x513306['user_key'],'Session_key':_0x513306['session_key']},'json':!![],'body':_0x2d6850};return rp(_0x3b6499);})['then'](function(_0x3c74fb){if(_0x3c74fb['total_sent']>=0x1){var _0x2f2dc7={'messageId':_0x3c74fb[_0x33f3('0x36')]};if(_0x38a7ff[_0x33f3('0x2f')]!=='GP'||!_0x38a7ff[_0x33f3('0x37')]){_0x2f2dc7[_0x33f3('0x38')]=!![];}return _0x32fdcc[_0x33f3('0x1a')](_0x2f2dc7);}else{return logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x39'),util[_0x33f3('0x28')](_0x3c74fb,{'showHidden':![],'depth':null}));}})[_0x33f3('0x1c')](function(_0x474ce5){return logger[_0x33f3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x33f3('0x2a'),'skebby',util[_0x33f3('0x28')](_0x474ce5,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),'skebby',_0x33f3('0x3a'));}break;case _0x33f3('0x3b'):if(_0x38a7ff[_0x33f3('0x23')]){var _0x35cf96={'recipient':_0x1f43fd[_0x33f3('0x24')],'message':_0x1f43fd[_0x33f3('0xc')],'sender':_0x38a7ff[_0x33f3('0x3c')]||_0x38a7ff[_0x33f3('0x24')],'authorization':_0x38a7ff[_0x33f3('0x23')]};var _0x463b12={'method':_0x33f3('0x3d'),'uri':_0x33f3('0x3e'),'body':_0x35cf96,'json':!![]};rp(_0x463b12)[_0x33f3('0x19')](function(_0x80059){var _0x5092ae={'messageId':_0x80059[_0x33f3('0x3f')]};if(!_0x38a7ff[_0x33f3('0x37')]){_0x5092ae[_0x33f3('0x38')]=!![];}return _0x32fdcc[_0x33f3('0x1a')](_0x5092ae);})['catch'](function(_0x5263c1){logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x3b'),util['inspect'](_0x5263c1,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x3b'),_0x33f3('0x40'));}break;case'clicksend':if(_0x38a7ff[_0x33f3('0x2d')]&&_0x38a7ff[_0x33f3('0x2e')]){var _0x35cf96={'messages':[{'source':'xCALLY\x20Motion','to':_0x1f43fd['phone'],'body':_0x1f43fd[_0x33f3('0xc')],'from':_0x38a7ff[_0x33f3('0x3c')]||_0x38a7ff['phone']}]};var _0x5327e6=util[_0x33f3('0x41')](_0x33f3('0x42'),_0x38a7ff[_0x33f3('0x2d')],_0x38a7ff[_0x33f3('0x2e')]);var _0x463b12={'method':_0x33f3('0x3d'),'uri':_0x33f3('0x43'),'body':_0x35cf96,'headers':{'Authorization':util[_0x33f3('0x41')](_0x33f3('0x44'),new Buffer(_0x5327e6)['toString']('base64'))},'json':!![]};rp(_0x463b12)[_0x33f3('0x19')](function(_0x535134){if(_0x535134['http_code']>=0xc8&&_0x535134[_0x33f3('0x45')]<=0xce){if(_0x535134['data']&&_0x535134['data'][_0x33f3('0x46')]>0x0){var _0x369e5d=_['head'](_0x535134['data'][_0x33f3('0x47')]);var _0x3f0be8={'messageId':_0x369e5d[_0x33f3('0x48')]};if(!_0x38a7ff['deliveryReport']){_0x3f0be8[_0x33f3('0x38')]=!![];}return _0x32fdcc[_0x33f3('0x1a')](_0x3f0be8);}else{logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x49'),util[_0x33f3('0x28')](_0x535134,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x49'),util[_0x33f3('0x28')](_0x535134,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1b78ef){logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x49'),util[_0x33f3('0x28')](_0x1b78ef,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),'clickSend',_0x33f3('0x3a'));}break;case _0x33f3('0x4a'):if(_0x38a7ff[_0x33f3('0x4b')]&&_0x38a7ff[_0x33f3('0x23')]){var _0x35cf96={'dst':_0x1f43fd[_0x33f3('0x24')],'text':_0x1f43fd['body'],'src':_0x38a7ff[_0x33f3('0x3c')]||_0x38a7ff[_0x33f3('0x24')],'url':_0x38a7ff['remote']+_0x33f3('0x4c')+_0x1f43fd['id']+_0x33f3('0x4d')+_0x38a7ff[_0x33f3('0x4e')]};var _0x5327e6=util['format'](_0x33f3('0x42'),_0x38a7ff[_0x33f3('0x4b')],_0x38a7ff[_0x33f3('0x23')]);var _0x463b12={'method':_0x33f3('0x3d'),'uri':util[_0x33f3('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x38a7ff['authId']),'body':_0x35cf96,'headers':{'Authorization':util[_0x33f3('0x41')]('Basic\x20%s',new Buffer(_0x5327e6)['toString']('base64'))},'json':!![]};rp(_0x463b12)[_0x33f3('0x19')](function(_0x3cc3ea){var _0xadbfbf={'messageId':_0x3cc3ea[_0x33f3('0x4f')][0x0]};return _0x32fdcc[_0x33f3('0x1a')](_0xadbfbf);})[_0x33f3('0x1c')](function(_0x34cdc0){logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x4a'),util[_0x33f3('0x28')](_0x34cdc0,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),'afterCreate',_0x33f3('0x4a'),_0x33f3('0x50'));}break;case'infobip':if(_0x38a7ff[_0x33f3('0x2d')]&&_0x38a7ff[_0x33f3('0x2e')]){if(_0x38a7ff['baseUrl']){var _0x13639a={'method':_0x33f3('0x3d'),'uri':_0x38a7ff[_0x33f3('0x51')]+_0x33f3('0x52'),'body':{'username':_0x38a7ff[_0x33f3('0x2d')],'password':_0x38a7ff[_0x33f3('0x2e')]},'json':!![]};return rp(_0x13639a)[_0x33f3('0x19')](function(_0x5b8eed){var _0x1b0877={'method':_0x33f3('0x3d'),'uri':_0x38a7ff[_0x33f3('0x51')]+_0x33f3('0x53'),'body':{'messages':[{'from':_0x38a7ff[_0x33f3('0x24')],'destinations':[{'to':_0x1f43fd[_0x33f3('0x24')]}],'text':_0x1f43fd['body'],'notifyUrl':_0x38a7ff['remote']+_0x33f3('0x4c')+_0x1f43fd['id']+_0x33f3('0x4d')+_0x38a7ff['token'],'notifyContentType':_0x33f3('0x54'),'callbackData':_0x38a7ff[_0x33f3('0x24')]+';'+_0x1f43fd[_0x33f3('0xc')]}]},'headers':{'Authorization':_0x33f3('0x55')+_0x5b8eed[_0x33f3('0x4e')]},'json':!![]};return rp(_0x1b0877)[_0x33f3('0x19')](function(_0x157d2e){if(_0x157d2e['messages']){var _0x5bf2d0={'messageId':_0x157d2e[_0x33f3('0x47')][0x0][_0x33f3('0xa')]};if(!_0x38a7ff['deliveryReport']){_0x5bf2d0[_0x33f3('0x38')]=!![];}return _0x32fdcc[_0x33f3('0x1a')](_0x5bf2d0);}else{return logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x56'),util['inspect'](_0x157d2e,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x15d0c3){return logger[_0x33f3('0x1d')](_0x33f3('0x29'),'afterCreate',_0x33f3('0x56'),util[_0x33f3('0x28')](_0x15d0c3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x33f3('0x2a'),_0x33f3('0x56'),_0x33f3('0x57'));}}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x33f3('0x58'):var _0x4a256d=require(_0x33f3('0x59'));if(_0x38a7ff[_0x33f3('0x5a')]){var _0x2cdd89={};_0x2cdd89[_0x33f3('0x5b')]=_0x38a7ff[_0x33f3('0x2d')];_0x2cdd89[_0x33f3('0x24')]=_0x1f43fd[_0x33f3('0x24')];_0x2cdd89[_0x33f3('0x30')]=_0x38a7ff[_0x33f3('0x24')];_0x2cdd89['text']=_0x1f43fd[_0x33f3('0xc')];_0x2cdd89['timestamp']=+new Date();var _0x212962='';var _0x4eb63a='';var _0x16fe57=Object[_0x33f3('0x5c')](_0x2cdd89);_0x16fe57[_0x33f3('0x5d')]();for(var _0x47372a=0x0;_0x47372a<_0x16fe57[_0x33f3('0x5e')];_0x47372a++){if(_0x212962!=''){_0x212962+='&';}_0x212962+=_0x16fe57[_0x47372a]+'='+encodeURIComponent(_0x2cdd89[_0x16fe57[_0x47372a]]);_0x4eb63a+=_0x2cdd89[_0x16fe57[_0x47372a]];}_0x4eb63a+=_0x38a7ff['apiKey'];_0x4eb63a=_0x4a256d[_0x33f3('0x5f')]('md5')[_0x33f3('0x1a')](_0x4eb63a)[_0x33f3('0x60')]('hex');if(_0x212962!==''){_0x212962+='&';}_0x212962+=_0x33f3('0x61')+_0x4eb63a;var _0x3b6499={'method':_0x33f3('0x33'),'uri':_0x38a7ff[_0x33f3('0x51')]+_0x33f3('0x62')+_0x212962,'json':!![]};return rp(_0x3b6499)[_0x33f3('0x19')](function(_0x168427){var _0x52e8bc=Object[_0x33f3('0x5c')](_0x168427);if(_0x168427[_0x52e8bc[0x0]][_0x33f3('0x1d')]&&parseInt(_0x168427[_0x52e8bc[0x0]][_0x33f3('0x1d')])===0x0){var _0x3908f0={'messageId':_0x168427[_0x52e8bc[0x0]]['id_sms']};if(!_0x38a7ff['deliveryReport']){_0x3908f0[_0x33f3('0x38')]=!![];}return _0x32fdcc[_0x33f3('0x1a')](_0x3908f0);}else{return logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x58'),util[_0x33f3('0x28')](_0x168427[_0x33f3('0x1d')],{'showHidden':![],'depth':null}));}})[_0x33f3('0x1c')](function(_0x3868c3){return logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x58'),util['inspect'](_0x3868c3,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),'afterCreate',_0x33f3('0x58'),_0x33f3('0x63'));}break;case _0x33f3('0x64'):if(_0x38a7ff[_0x33f3('0x5a')]){var _0x237e5f={'method':'POST','uri':_0x33f3('0x65'),'headers':{'Authorization':_0x38a7ff[_0x33f3('0x5a')]},'body':{'content':_0x1f43fd[_0x33f3('0xc')],'to':[_0x1f43fd['phone']],'from':_0x38a7ff[_0x33f3('0x24')],'binary':![],'clientMessageId':_0x33f3('0x66'),'charset':_0x33f3('0x67')},'json':!![]};rp(_0x237e5f)[_0x33f3('0x19')](function(_0x15c17b){if(!_0x15c17b[_0x33f3('0x1d')]){var _0x373a34={'messageId':_0x15c17b[_0x33f3('0x47')][0x0][_0x33f3('0x68')]};if(!_0x38a7ff['deliveryReport']){_0x373a34['read']=!![];}return _0x32fdcc['update'](_0x373a34);}else{return logger[_0x33f3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x33f3('0x2a'),_0x33f3('0x64'),util[_0x33f3('0x28')](_0x15c17b[_0x33f3('0x1d')],{'showHidden':![],'depth':null}));}})[_0x33f3('0x1c')](function(_0x319383){return logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),'clickatell',util[_0x33f3('0x28')](_0x319383,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x64'),_0x33f3('0x63'));}break;case _0x33f3('0x69'):if(_0x38a7ff[_0x33f3('0x2d')]&&_0x38a7ff[_0x33f3('0x2e')]){var _0x5327e6=util[_0x33f3('0x41')]('%s:%s',_0x38a7ff[_0x33f3('0x2d')],_0x38a7ff[_0x33f3('0x2e')]);var _0x463b12={'method':'POST','uri':_0x33f3('0x6a')+_0x38a7ff[_0x33f3('0x6b')]+'/messages','body':{'to':[_0x1f43fd[_0x33f3('0x24')]],'text':_0x1f43fd[_0x33f3('0xc')],'from':_0x38a7ff[_0x33f3('0x24')],'applicationId':_0x38a7ff[_0x33f3('0x6c')]},'headers':{'Authorization':util[_0x33f3('0x41')]('Basic\x20%s',new Buffer(_0x5327e6)[_0x33f3('0x6d')](_0x33f3('0x6e')))},'json':!![]};rp(_0x463b12)['then'](function(_0x59e52b){if(_0x59e52b['id']){var _0x46b98e={'messageId':_0x59e52b['id']};return _0x32fdcc['update'](_0x46b98e);}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),'bandwidth',util[_0x33f3('0x28')](_0x59e52b,{'showHidden':![],'depth':null}));}})[_0x33f3('0x1c')](function(_0x1df2ff){logger[_0x33f3('0x1d')](_0x33f3('0x29'),'afterCreate',_0x33f3('0x69'),util[_0x33f3('0x28')](_0x1df2ff,{'showHidden':![],'depth':null}));});}else{logger[_0x33f3('0x1d')](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x69'),_0x33f3('0x3a'));}break;case _0x33f3('0x6f'):if(_0x38a7ff[_0x33f3('0x5a')]){var _0x41fbec={};var _0x3b6499={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x33f3('0x70')+_0x38a7ff['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x38a7ff[_0x33f3('0x24')],'to':_0x1f43fd[_0x33f3('0x24')],'text':_0x1f43fd[_0x33f3('0xc')]},'json':!![]};return rp(_0x3b6499)[_0x33f3('0x19')](function(_0xbec0f8){if(_0xbec0f8[_0x33f3('0x71')]==0xca){_0x41fbec['message']=_0xbec0f8;var _0x333279={'method':_0x33f3('0x3d'),'uri':_0x33f3('0x72'),'headers':{'Authorization':_0x33f3('0x70')+_0x38a7ff['apiKey'],'Content-Type':_0x33f3('0x54')},'body':{'refid':_0x41fbec['message'][_0x33f3('0x73')]},'json':!![]};return rp(_0x333279)[_0x33f3('0x19')](function(_0x59da61){_0x41fbec['status']=_0x59da61;var _0x458f8b={'messageId':_0x41fbec[_0x33f3('0x74')]['refid'],'read':!![]};return _0x32fdcc[_0x33f3('0x1a')](_0x458f8b);});}else{return logger['error'](_0x33f3('0x29'),_0x33f3('0x2a'),_0x33f3('0x6f'),util['inspect'](_0xbec0f8,{'showHidden':![],'depth':null}));}})[_0x33f3('0x1c')](function(_0x14c1c1){return logger[_0x33f3('0x1d')](_0x33f3('0x29'),'afterCreate','intelepeer',util[_0x33f3('0x28')](_0x14c1c1,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x33f3('0x6f'),_0x33f3('0x75'));}break;}}})[_0x33f3('0x76')](function(){_0x310e5e();});}else{_0x310e5e();}}},'charset':_0x33f3('0x77'),'collate':_0x33f3('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c87b452..bf06ae2 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 _0x53b3=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then'];(function(_0x33d81c,_0x583697){var _0x52dd65=function(_0x2e6d1c){while(--_0x2e6d1c){_0x33d81c['push'](_0x33d81c['shift']());}};_0x52dd65(++_0x583697);}(_0x53b3,0x145));var _0x353b=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x53b3[_0x2a276d];return _0x2914cd;};'use strict';var _=require(_0x353b('0x0'));var util=require(_0x353b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x353b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x353b('0x3'))['db'];var utils=require(_0x353b('0x4'));var logger=require('../../config/logger')(_0x353b('0x5'));var config=require(_0x353b('0x6'));var jayson=require(_0x353b('0x7'));var client=jayson[_0x353b('0x8')]['http']({'port':0x232a});config[_0x353b('0x9')]=_[_0x353b('0xa')](config[_0x353b('0x9')],{'host':_0x353b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x353b('0xc'))[_0x353b('0xd')](socket);function respondWithRpcPromise(_0x2b2c41,_0x55461c,_0x796071){return new BPromise(function(_0x5a238b,_0x46959c){return client[_0x353b('0xe')](_0x2b2c41,_0x796071)[_0x353b('0xf')](function(_0x59da08){logger[_0x353b('0x10')](_0x353b('0x11'),_0x55461c,_0x353b('0x12'));logger[_0x353b('0x13')](_0x353b('0x14'),_0x55461c,_0x353b('0x12'),JSON[_0x353b('0x15')](_0x59da08));if(_0x59da08[_0x353b('0x16')]){if(_0x59da08['error']['code']===0x1f4){logger['error'](_0x353b('0x11'),_0x55461c,_0x59da08[_0x353b('0x16')]['message']);return _0x46959c(_0x59da08[_0x353b('0x16')]['message']);}logger[_0x353b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x55461c,_0x59da08[_0x353b('0x16')]['message']);return _0x5a238b(_0x59da08[_0x353b('0x16')][_0x353b('0x17')]);}else{logger[_0x353b('0x10')](_0x353b('0x11'),_0x55461c,_0x353b('0x12'));_0x5a238b(_0x59da08[_0x353b('0x18')][_0x353b('0x17')]);}})[_0x353b('0x19')](function(_0xb88cef){logger['error']('SmsMessage,\x20%s,\x20%s',_0x55461c,_0xb88cef);_0x46959c(_0xb88cef);});});}exports[_0x353b('0x1a')]=function(_0x4e0396){var _0x7cdf5f=this;return new Promise(function(_0x41a3cb,_0x51f9d0){return db[_0x353b('0x1b')]['create'](_0x4e0396[_0x353b('0x1c')],{'raw':_0x4e0396[_0x353b('0x1d')]?_0x4e0396[_0x353b('0x1d')][_0x353b('0x1e')]===undefined?!![]:![]:!![]})[_0x353b('0xf')](function(_0x48cfbf){logger['info'](_0x353b('0x1a'),_0x4e0396);logger[_0x353b('0x13')]('CreateSmsMessage',_0x4e0396,JSON[_0x353b('0x15')](_0x48cfbf));_0x41a3cb(_0x48cfbf);})[_0x353b('0x19')](function(_0x176f9a){logger[_0x353b('0x16')](_0x353b('0x1a'),_0x176f9a[_0x353b('0x17')],_0x4e0396);_0x51f9d0(_0x7cdf5f[_0x353b('0x16')](0x1f4,_0x176f9a[_0x353b('0x17')]));});});}; \ No newline at end of file +var _0x3de8=['body','options','raw','CreateSmsMessage','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x312ac8,_0x28f0f8){var _0x157c9a=function(_0xe63373){while(--_0xe63373){_0x312ac8['push'](_0x312ac8['shift']());}};_0x157c9a(++_0x28f0f8);}(_0x3de8,0xd6));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83de('0x0'));var BPromise=require(_0x83de('0x1'));var rs=require(_0x83de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83de('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x83de('0x4'))(_0x83de('0x5'));var config=require(_0x83de('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83de('0x7')][_0x83de('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x83de('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x83de('0xa'))(new Redis(config[_0x83de('0x9')]));require(_0x83de('0xb'))[_0x83de('0xc')](socket);function respondWithRpcPromise(_0x350704,_0x29032d,_0x5a51f7){return new BPromise(function(_0x3efea4,_0x569f49){return client[_0x83de('0xd')](_0x350704,_0x5a51f7)[_0x83de('0xe')](function(_0x35ee36){logger[_0x83de('0xf')](_0x83de('0x10'),_0x29032d,'request\x20sent');logger[_0x83de('0x11')](_0x83de('0x12'),_0x29032d,_0x83de('0x13'),JSON[_0x83de('0x14')](_0x35ee36));if(_0x35ee36[_0x83de('0x15')]){if(_0x35ee36[_0x83de('0x15')][_0x83de('0x16')]===0x1f4){logger[_0x83de('0x15')](_0x83de('0x10'),_0x29032d,_0x35ee36[_0x83de('0x15')][_0x83de('0x17')]);return _0x569f49(_0x35ee36['error'][_0x83de('0x17')]);}logger[_0x83de('0x15')](_0x83de('0x10'),_0x29032d,_0x35ee36[_0x83de('0x15')]['message']);return _0x3efea4(_0x35ee36[_0x83de('0x15')][_0x83de('0x17')]);}else{logger[_0x83de('0xf')](_0x83de('0x10'),_0x29032d,_0x83de('0x13'));_0x3efea4(_0x35ee36[_0x83de('0x18')][_0x83de('0x17')]);}})[_0x83de('0x19')](function(_0x7538dd){logger[_0x83de('0x15')]('SmsMessage,\x20%s,\x20%s',_0x29032d,_0x7538dd);_0x569f49(_0x7538dd);});});}exports['CreateSmsMessage']=function(_0x5b7d44){var _0x5db597=this;return new Promise(function(_0x3af89f,_0x4cda73){return db['SmsMessage']['create'](_0x5b7d44[_0x83de('0x1a')],{'raw':_0x5b7d44[_0x83de('0x1b')]?_0x5b7d44[_0x83de('0x1b')][_0x83de('0x1c')]===undefined?!![]:![]:!![]})[_0x83de('0xe')](function(_0x33b48e){logger[_0x83de('0xf')]('CreateSmsMessage',_0x5b7d44);logger[_0x83de('0x11')](_0x83de('0x1d'),_0x5b7d44,JSON[_0x83de('0x14')](_0x33b48e));_0x3af89f(_0x33b48e);})[_0x83de('0x19')](function(_0x3ae928){logger[_0x83de('0x15')]('CreateSmsMessage',_0x3ae928[_0x83de('0x17')],_0x5b7d44);_0x4cda73(_0x5db597[_0x83de('0x15')](0x1f4,_0x3ae928[_0x83de('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0f5f968..b79e7e9 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 _0xeef6=['remove','emit','removeListener','register','./smsMessage.events','save'];(function(_0x1716ca,_0x4b9ffa){var _0x348b42=function(_0x28361d){while(--_0x28361d){_0x1716ca['push'](_0x1716ca['shift']());}};_0x348b42(++_0x4b9ffa);}(_0xeef6,0x1de));var _0x6eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef6[_0x1cc8fe];return _0x230054;};'use strict';var SmsMessageEvents=require(_0x6eef('0x0'));var events=[_0x6eef('0x1'),_0x6eef('0x2'),'update'];function createListener(_0x3592,_0x16afa1){return function(_0x42d27c){_0x16afa1[_0x6eef('0x3')](_0x3592,_0x42d27c);};}function removeListener(_0x1bcb6b,_0xd8b405){return function(){SmsMessageEvents[_0x6eef('0x4')](_0x1bcb6b,_0xd8b405);};}exports[_0x6eef('0x5')]=function(_0x36c489){for(var _0x972208=0x0,_0x4292d2=events['length'];_0x972208<_0x4292d2;_0x972208++){var _0x1affea=events[_0x972208];var _0x9e888a=createListener('smsMessage:'+_0x1affea,_0x36c489);SmsMessageEvents['on'](_0x1affea,_0x9e888a);}}; \ No newline at end of file +var _0xc798=['register','length','save','update','removeListener'];(function(_0x247ba0,_0x4149d6){var _0x240e28=function(_0x250c84){while(--_0x250c84){_0x247ba0['push'](_0x247ba0['shift']());}};_0x240e28(++_0x4149d6);}(_0xc798,0xde));var _0x8c79=function(_0x54d9fd,_0x30d6f2){_0x54d9fd=_0x54d9fd-0x0;var _0x9cb656=_0xc798[_0x54d9fd];return _0x9cb656;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8c79('0x0'),'remove',_0x8c79('0x1')];function createListener(_0x365cb4,_0x4cc42c){return function(_0x5762e7){_0x4cc42c['emit'](_0x365cb4,_0x5762e7);};}function removeListener(_0x39fbbb,_0x3ad796){return function(){SmsMessageEvents[_0x8c79('0x2')](_0x39fbbb,_0x3ad796);};}exports[_0x8c79('0x3')]=function(_0x5cb257){for(var _0xd9ae06=0x0,_0x41e5c9=events[_0x8c79('0x4')];_0xd9ae06<_0x41e5c9;_0xd9ae06++){var _0x33c1a3=events[_0xd9ae06];var _0x1eb242=createListener('smsMessage:'+_0x33c1a3,_0x5cb257);SmsMessageEvents['on'](_0x33c1a3,_0x1eb242);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 88b6fd9..04a9f7d 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 _0x1a75=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express'];(function(_0x5a92e6,_0x5bb03e){var _0x917e0f=function(_0x3f2883){while(--_0x3f2883){_0x5a92e6['push'](_0x5a92e6['shift']());}};_0x917e0f(++_0x5bb03e);}(_0x1a75,0xa4));var _0x51a7=function(_0x5a6d16,_0x1cd57e){_0x5a6d16=_0x5a6d16-0x0;var _0x40ea12=_0x1a75[_0x5a6d16];return _0x40ea12;};'use strict';var multer=require(_0x51a7('0x0'));var util=require('util');var path=require(_0x51a7('0x1'));var timeout=require(_0x51a7('0x2'));var express=require(_0x51a7('0x3'));var router=express[_0x51a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x51a7('0x5'));var interaction=require(_0x51a7('0x6'));var config=require(_0x51a7('0x7'));var controller=require(_0x51a7('0x8'));router[_0x51a7('0x9')]('/',auth[_0x51a7('0xa')](),controller[_0x51a7('0xb')]);router[_0x51a7('0x9')](_0x51a7('0xc'),auth['isAuthenticated'](),controller[_0x51a7('0xd')]);router[_0x51a7('0x9')](_0x51a7('0xe'),auth[_0x51a7('0xa')](),controller['show']);router[_0x51a7('0x9')]('/:id/members',auth[_0x51a7('0xa')](),controller[_0x51a7('0xf')]);router[_0x51a7('0x9')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x11')]);router[_0x51a7('0x9')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x51a7('0x13')]);router[_0x51a7('0x14')]('/:id/teams',auth[_0x51a7('0xa')](),controller[_0x51a7('0x15')]);router[_0x51a7('0x14')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x16')]);router['put']('/:id',auth[_0x51a7('0xa')](),controller[_0x51a7('0x17')]);router[_0x51a7('0x18')](_0x51a7('0xe'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x19')]);router[_0x51a7('0x18')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x1a')]);router[_0x51a7('0x18')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3678=['getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/:id','get','/:id/members','/:id/teams'];(function(_0x140e12,_0x438782){var _0x4141cd=function(_0x2fce44){while(--_0x2fce44){_0x140e12['push'](_0x140e12['shift']());}};_0x4141cd(++_0x438782);}(_0x3678,0xa0));var _0x8367=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x3678[_0x47568e];return _0x33815b;};'use strict';var multer=require(_0x8367('0x0'));var util=require(_0x8367('0x1'));var path=require('path');var timeout=require(_0x8367('0x2'));var express=require(_0x8367('0x3'));var router=express[_0x8367('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8367('0x5'));var interaction=require(_0x8367('0x6'));var config=require(_0x8367('0x7'));var controller=require(_0x8367('0x8'));router['get']('/',auth[_0x8367('0x9')](),controller[_0x8367('0xa')]);router['get']('/describe',auth[_0x8367('0x9')](),controller['describe']);router['get'](_0x8367('0xb'),auth[_0x8367('0x9')](),controller['show']);router[_0x8367('0xc')](_0x8367('0xd'),auth[_0x8367('0x9')](),controller['getMembers']);router[_0x8367('0xc')](_0x8367('0xe'),auth[_0x8367('0x9')](),controller[_0x8367('0xf')]);router[_0x8367('0xc')]('/:id/users',auth[_0x8367('0x9')](),controller[_0x8367('0x10')]);router[_0x8367('0x11')]('/',auth['isAuthenticated'](),controller[_0x8367('0x12')]);router[_0x8367('0x11')]('/:id/teams',auth[_0x8367('0x9')](),controller[_0x8367('0x13')]);router['post'](_0x8367('0x14'),auth[_0x8367('0x9')](),controller['addAgents']);router['put'](_0x8367('0xb'),auth[_0x8367('0x9')](),controller[_0x8367('0x15')]);router[_0x8367('0x16')]('/:id',auth[_0x8367('0x9')](),controller['destroy']);router[_0x8367('0x16')](_0x8367('0xe'),auth[_0x8367('0x9')](),controller[_0x8367('0x17')]);router['delete']('/:id/users',auth[_0x8367('0x9')](),controller[_0x8367('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index fddee84..54cd4da 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 _0x0865=['roundrobin','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x20c159,_0x5e151a){var _0x3b48f7=function(_0x135700){while(--_0x135700){_0x20c159['push'](_0x20c159['shift']());}};_0x3b48f7(++_0x5e151a);}(_0x0865,0xeb));var _0x5086=function(_0x4b544a,_0x2890b4){_0x4b544a=_0x4b544a-0x0;var _0x5eb948=_0x0865[_0x4b544a];return _0x5eb948;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5086('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5086('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5086('0x2')](_0x5086('0x3'),_0x5086('0x4'),_0x5086('0x5'))}}; \ No newline at end of file +var _0x5eff=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x122c12,_0xa38bf0){var _0x3c98bf=function(_0x53c702){while(--_0x53c702){_0x122c12['push'](_0x122c12['shift']());}};_0x3c98bf(++_0xa38bf0);}(_0x5eff,0xbe));var _0xf5ef=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eff[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xf5ef('0x0'));module[_0xf5ef('0x1')]={'name':{'type':Sequelize[_0xf5ef('0x2')],'unique':_0xf5ef('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5ef('0x2')]},'timeout':{'type':Sequelize[_0xf5ef('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5ef('0x5')](_0xf5ef('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 23ade02..a77f9fd 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x589049,_0x356005){var _0x2055a2=function(_0x68fc2d){while(--_0x68fc2d){_0x589049['push'](_0x589049['shift']());}};_0x2055a2(++_0x356005);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f16c1,_0x176d9e){_0x1f16c1=_0x1f16c1-0x0;var _0x185fbb=_0x2ef3[_0x1f16c1];return _0x185fbb;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x4908c8,_0x5d2130){var _0x3327c4=function(_0x1534c0){while(--_0x1534c0){_0x4908c8['push'](_0x4908c8['shift']());}};_0x3327c4(++_0x5d2130);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2ed7,_0x546675){_0x4f2ed7=_0x4f2ed7-0x0;var _0x3e5fae=_0x7a54[_0x4f2ed7];return _0x3e5fae;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7ca0b42..c19ff5b 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 _0xf08c=['save','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf08c,0x64));var _0xcf08=function(_0x5c4139,_0x1d2ac5){_0x5c4139=_0x5c4139-0x0;var _0x21cd64=_0xf08c[_0x5c4139];return _0x21cd64;};'use strict';var EventEmitter=require(_0xcf08('0x0'));var SmsQueue=require(_0xcf08('0x1'))['db'][_0xcf08('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcf08('0x3')](0x0);var events={'afterCreate':_0xcf08('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e3138){return function(_0x4678b8,_0x453414,_0x29924e){SmsQueueEvents[_0xcf08('0x5')](_0x4e3138+':'+_0x4678b8['id'],_0x4678b8);SmsQueueEvents[_0xcf08('0x5')](_0x4e3138,_0x4678b8);_0x29924e(null);};}for(var e in events){if(events[_0xcf08('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xcf08('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xd2eb=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3cc06e,_0x5d4fcd){var _0xbc6513=function(_0x3f069e){while(--_0x3f069e){_0x3cc06e['push'](_0x3cc06e['shift']());}};_0xbc6513(++_0x5d4fcd);}(_0xd2eb,0xcb));var _0xbd2e=function(_0x29a60f,_0x5e2ae5){_0x29a60f=_0x29a60f-0x0;var _0x2bb667=_0xd2eb[_0x29a60f];return _0x2bb667;};'use strict';var EventEmitter=require(_0xbd2e('0x0'));var SmsQueue=require(_0xbd2e('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xbd2e('0x2')](0x0);var events={'afterCreate':_0xbd2e('0x3'),'afterUpdate':'update','afterDestroy':_0xbd2e('0x4')};function emitEvent(_0x5dab1c){return function(_0x5b00ee,_0x44aeaf,_0x3cc7a9){SmsQueueEvents[_0xbd2e('0x5')](_0x5dab1c+':'+_0x5b00ee['id'],_0x5b00ee);SmsQueueEvents[_0xbd2e('0x5')](_0x5dab1c,_0x5b00ee);_0x3cc7a9(null);};}for(var e in events){if(events[_0xbd2e('0x6')](e)){var event=events[e];SmsQueue[_0xbd2e('0x7')](e,emitEvent(event));}}module[_0xbd2e('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 77ed4e3..f6c891f 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 _0xfb93=['./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x51053b,_0xd27d3b){var _0x23adad=function(_0x8536f2){while(--_0x8536f2){_0x51053b['push'](_0x51053b['shift']());}};_0x23adad(++_0xd27d3b);}(_0xfb93,0x111));var _0x3fb9=function(_0x4135e7,_0x14f68b){_0x4135e7=_0x4135e7-0x0;var _0x3032f9=_0xfb93[_0x4135e7];return _0x3032f9;};'use strict';var _=require(_0x3fb9('0x0'));var util=require(_0x3fb9('0x1'));var logger=require(_0x3fb9('0x2'))(_0x3fb9('0x3'));var moment=require('moment');var BPromise=require(_0x3fb9('0x4'));var rp=require(_0x3fb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fb9('0x6'));module[_0x3fb9('0x7')]=function(_0x498b6b,_0x118c1f){return _0x498b6b['define']('SmsQueue',attributes,{'tableName':_0x3fb9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a3=['path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d8608,_0x3b8a2d){var _0x4f1b2e=function(_0x3e2a67){while(--_0x3e2a67){_0x1d8608['push'](_0x1d8608['shift']());}};_0x4f1b2e(++_0x3b8a2d);}(_0xb8a3,0x7c));var _0x3b8a=function(_0x52a967,_0x5e6e0b){_0x52a967=_0x52a967-0x0;var _0x19bbb5=_0xb8a3[_0x52a967];return _0x19bbb5;};'use strict';var _=require(_0x3b8a('0x0'));var util=require('util');var logger=require(_0x3b8a('0x1'))(_0x3b8a('0x2'));var moment=require(_0x3b8a('0x3'));var BPromise=require(_0x3b8a('0x4'));var rp=require(_0x3b8a('0x5'));var fs=require('fs');var path=require(_0x3b8a('0x6'));var rimraf=require(_0x3b8a('0x7'));var config=require(_0x3b8a('0x8'));var attributes=require(_0x3b8a('0x9'));module['exports']=function(_0x50aa4c,_0x2b46cc){return _0x50aa4c[_0x3b8a('0xa')](_0x3b8a('0xb'),attributes,{'tableName':_0x3b8a('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 2448d04..52dd377 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 _0x39e4=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45f842,_0x4a5890){var _0x364064=function(_0xc1eba6){while(--_0xc1eba6){_0x45f842['push'](_0x45f842['shift']());}};_0x364064(++_0x4a5890);}(_0x39e4,0x78));var _0x439e=function(_0x3eb27c,_0x40929a){_0x3eb27c=_0x3eb27c-0x0;var _0x422a89=_0x39e4[_0x3eb27c];return _0x422a89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x439e('0x0'));var BPromise=require(_0x439e('0x1'));var rs=require(_0x439e('0x2'));var fs=require('fs');var Redis=require(_0x439e('0x3'));var db=require(_0x439e('0x4'))['db'];var utils=require(_0x439e('0x5'));var logger=require(_0x439e('0x6'))(_0x439e('0x7'));var config=require(_0x439e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x439e('0x9')][_0x439e('0xa')]({'port':0x232a});config[_0x439e('0xb')]=_[_0x439e('0xc')](config['redis'],{'host':_0x439e('0xd'),'port':0x18eb});var socket=require(_0x439e('0xe'))(new Redis(config['redis']));require(_0x439e('0xf'))[_0x439e('0x10')](socket);function respondWithRpcPromise(_0x3a7dc1,_0x392d1f,_0x1b1a7d){return new BPromise(function(_0x28e79d,_0x2d046f){return client['request'](_0x3a7dc1,_0x1b1a7d)[_0x439e('0x11')](function(_0x3a49c3){logger[_0x439e('0x12')](_0x439e('0x13'),_0x392d1f,_0x439e('0x14'));logger[_0x439e('0x15')](_0x439e('0x16'),_0x392d1f,_0x439e('0x14'),JSON[_0x439e('0x17')](_0x3a49c3));if(_0x3a49c3[_0x439e('0x18')]){if(_0x3a49c3[_0x439e('0x18')][_0x439e('0x19')]===0x1f4){logger[_0x439e('0x18')]('SmsQueue,\x20%s,\x20%s',_0x392d1f,_0x3a49c3['error'][_0x439e('0x1a')]);return _0x2d046f(_0x3a49c3[_0x439e('0x18')][_0x439e('0x1a')]);}logger[_0x439e('0x18')](_0x439e('0x13'),_0x392d1f,_0x3a49c3['error'][_0x439e('0x1a')]);return _0x28e79d(_0x3a49c3[_0x439e('0x18')][_0x439e('0x1a')]);}else{logger[_0x439e('0x12')](_0x439e('0x13'),_0x392d1f,'request\x20sent');_0x28e79d(_0x3a49c3[_0x439e('0x1b')][_0x439e('0x1a')]);}})['catch'](function(_0x246c7a){logger['error'](_0x439e('0x13'),_0x392d1f,_0x246c7a);_0x2d046f(_0x246c7a);});});}exports[_0x439e('0x1c')]=function(_0x224c62){var _0xa88d82=this;return new Promise(function(_0x1f03e4,_0x1c310d){return db[_0x439e('0x1d')][_0x439e('0x1e')]({'raw':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x20')]===undefined?!![]:![]:!![],'where':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x21')]||null:null,'attributes':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x22')]||null:null,'limit':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x23')]||null:null,'include':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x24')]?_[_0x439e('0x25')](_0x224c62[_0x439e('0x1f')][_0x439e('0x24')],function(_0x449576){return{'model':db[_0x449576[_0x439e('0x26')]],'as':_0x449576['as'],'attributes':_0x449576[_0x439e('0x22')],'include':_0x449576[_0x439e('0x24')]?_['map'](_0x449576['include'],function(_0x133298){return{'model':db[_0x133298[_0x439e('0x26')]],'as':_0x133298['as'],'attributes':_0x133298[_0x439e('0x22')],'include':_0x133298[_0x439e('0x24')]?_[_0x439e('0x25')](_0x133298['include'],function(_0x2c0108){return{'model':db[_0x2c0108['model']],'as':_0x2c0108['as'],'attributes':_0x2c0108['attributes']};}):[]};}):[]};}):[]:[]})[_0x439e('0x11')](function(_0x132dfd){logger[_0x439e('0x12')](_0x439e('0x1c'),_0x224c62);logger['debug'](_0x439e('0x1c'),_0x224c62,JSON['stringify'](_0x132dfd));_0x1f03e4(_0x132dfd);})[_0x439e('0x27')](function(_0x4018d8){logger[_0x439e('0x18')]('GetSmsQueue',_0x4018d8[_0x439e('0x1a')],_0x224c62);_0x1c310d(_0xa88d82[_0x439e('0x18')](0x1f4,_0x4018d8[_0x439e('0x1a')]));});});};exports[_0x439e('0x28')]=function(_0x3efb57){var _0x329658=this;return new Promise(function(_0x15810a,_0x2df9f9){return db['SmsQueue'][_0x439e('0x29')]({'raw':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x20')]===undefined?!![]:![]:!![],'where':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x21')]||null:null,'attributes':_0x3efb57['options']?_0x3efb57['options']['attributes']||null:null,'include':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x24')]?_['map'](_0x3efb57[_0x439e('0x1f')][_0x439e('0x24')],function(_0x4f0e2f){return{'model':db[_0x4f0e2f[_0x439e('0x26')]],'as':_0x4f0e2f['as'],'attributes':_0x4f0e2f[_0x439e('0x22')],'include':_0x4f0e2f[_0x439e('0x24')]?_[_0x439e('0x25')](_0x4f0e2f[_0x439e('0x24')],function(_0x4e3df0){return{'model':db[_0x4e3df0[_0x439e('0x26')]],'as':_0x4e3df0['as'],'attributes':_0x4e3df0['attributes'],'include':_0x4e3df0[_0x439e('0x24')]?_[_0x439e('0x25')](_0x4e3df0['include'],function(_0x1d2117){return{'model':db[_0x1d2117[_0x439e('0x26')]],'as':_0x1d2117['as'],'attributes':_0x1d2117[_0x439e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x575b58){logger[_0x439e('0x12')](_0x439e('0x28'),_0x3efb57);logger[_0x439e('0x15')]('ShowSmsQueue',_0x3efb57,JSON[_0x439e('0x17')](_0x575b58));_0x15810a(_0x575b58);})[_0x439e('0x27')](function(_0x26c6dc){logger[_0x439e('0x18')](_0x439e('0x28'),_0x26c6dc[_0x439e('0x1a')],_0x3efb57);_0x2df9f9(_0x329658['error'](0x1f4,_0x26c6dc['message']));});});}; \ No newline at end of file +var _0xbc61=['map','catch','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model'];(function(_0x3fdf8f,_0x437193){var _0x3852a7=function(_0x4012e6){while(--_0x4012e6){_0x3fdf8f['push'](_0x3fdf8f['shift']());}};_0x3852a7(++_0x437193);}(_0xbc61,0x123));var _0x1bc6=function(_0x2ac2f4,_0x1c790c){_0x2ac2f4=_0x2ac2f4-0x0;var _0x24bbd8=_0xbc61[_0x2ac2f4];return _0x24bbd8;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var moment=require(_0x1bc6('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc6('0x3'));var fs=require('fs');var Redis=require(_0x1bc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bc6('0x5'));var logger=require(_0x1bc6('0x6'))(_0x1bc6('0x7'));var config=require(_0x1bc6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1bc6('0x9')]['http']({'port':0x232a});config['redis']=_[_0x1bc6('0xa')](config[_0x1bc6('0xb')],{'host':_0x1bc6('0xc'),'port':0x18eb});var socket=require(_0x1bc6('0xd'))(new Redis(config['redis']));require(_0x1bc6('0xe'))['register'](socket);function respondWithRpcPromise(_0x4e30d9,_0xb5035f,_0x4d6726){return new BPromise(function(_0x36eef6,_0x32bcd2){return client[_0x1bc6('0xf')](_0x4e30d9,_0x4d6726)[_0x1bc6('0x10')](function(_0x4feb2d){logger[_0x1bc6('0x11')](_0x1bc6('0x12'),_0xb5035f,_0x1bc6('0x13'));logger[_0x1bc6('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xb5035f,'request\x20sent',JSON[_0x1bc6('0x15')](_0x4feb2d));if(_0x4feb2d[_0x1bc6('0x16')]){if(_0x4feb2d[_0x1bc6('0x16')]['code']===0x1f4){logger[_0x1bc6('0x16')](_0x1bc6('0x12'),_0xb5035f,_0x4feb2d[_0x1bc6('0x16')][_0x1bc6('0x17')]);return _0x32bcd2(_0x4feb2d[_0x1bc6('0x16')][_0x1bc6('0x17')]);}logger[_0x1bc6('0x16')](_0x1bc6('0x12'),_0xb5035f,_0x4feb2d[_0x1bc6('0x16')][_0x1bc6('0x17')]);return _0x36eef6(_0x4feb2d[_0x1bc6('0x16')][_0x1bc6('0x17')]);}else{logger[_0x1bc6('0x11')]('SmsQueue,\x20%s,\x20%s',_0xb5035f,_0x1bc6('0x13'));_0x36eef6(_0x4feb2d['result'][_0x1bc6('0x17')]);}})['catch'](function(_0x178c3c){logger[_0x1bc6('0x16')](_0x1bc6('0x12'),_0xb5035f,_0x178c3c);_0x32bcd2(_0x178c3c);});});}exports[_0x1bc6('0x18')]=function(_0x25da36){var _0x1514a3=this;return new Promise(function(_0x306645,_0x403c42){return db[_0x1bc6('0x19')]['findAll']({'raw':_0x25da36[_0x1bc6('0x1a')]?_0x25da36[_0x1bc6('0x1a')][_0x1bc6('0x1b')]===undefined?!![]:![]:!![],'where':_0x25da36['options']?_0x25da36['options'][_0x1bc6('0x1c')]||null:null,'attributes':_0x25da36[_0x1bc6('0x1a')]?_0x25da36[_0x1bc6('0x1a')][_0x1bc6('0x1d')]||null:null,'limit':_0x25da36[_0x1bc6('0x1a')]?_0x25da36[_0x1bc6('0x1a')][_0x1bc6('0x1e')]||null:null,'include':_0x25da36['options']?_0x25da36[_0x1bc6('0x1a')][_0x1bc6('0x1f')]?_['map'](_0x25da36[_0x1bc6('0x1a')][_0x1bc6('0x1f')],function(_0x4ce442){return{'model':db[_0x4ce442[_0x1bc6('0x20')]],'as':_0x4ce442['as'],'attributes':_0x4ce442[_0x1bc6('0x1d')],'include':_0x4ce442[_0x1bc6('0x1f')]?_[_0x1bc6('0x21')](_0x4ce442[_0x1bc6('0x1f')],function(_0x563c85){return{'model':db[_0x563c85[_0x1bc6('0x20')]],'as':_0x563c85['as'],'attributes':_0x563c85[_0x1bc6('0x1d')],'include':_0x563c85[_0x1bc6('0x1f')]?_[_0x1bc6('0x21')](_0x563c85[_0x1bc6('0x1f')],function(_0x2ff157){return{'model':db[_0x2ff157['model']],'as':_0x2ff157['as'],'attributes':_0x2ff157['attributes']};}):[]};}):[]};}):[]:[]})[_0x1bc6('0x10')](function(_0x534f0a){logger[_0x1bc6('0x11')](_0x1bc6('0x18'),_0x25da36);logger['debug'](_0x1bc6('0x18'),_0x25da36,JSON[_0x1bc6('0x15')](_0x534f0a));_0x306645(_0x534f0a);})[_0x1bc6('0x22')](function(_0x50c699){logger[_0x1bc6('0x16')]('GetSmsQueue',_0x50c699['message'],_0x25da36);_0x403c42(_0x1514a3[_0x1bc6('0x16')](0x1f4,_0x50c699[_0x1bc6('0x17')]));});});};exports[_0x1bc6('0x23')]=function(_0x2c8bae){var _0x159786=this;return new Promise(function(_0x167203,_0x2e463d){return db[_0x1bc6('0x19')]['find']({'raw':_0x2c8bae[_0x1bc6('0x1a')]?_0x2c8bae['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c8bae[_0x1bc6('0x1a')]?_0x2c8bae['options'][_0x1bc6('0x1c')]||null:null,'attributes':_0x2c8bae[_0x1bc6('0x1a')]?_0x2c8bae[_0x1bc6('0x1a')][_0x1bc6('0x1d')]||null:null,'include':_0x2c8bae[_0x1bc6('0x1a')]?_0x2c8bae[_0x1bc6('0x1a')][_0x1bc6('0x1f')]?_['map'](_0x2c8bae['options'][_0x1bc6('0x1f')],function(_0x50a2d8){return{'model':db[_0x50a2d8['model']],'as':_0x50a2d8['as'],'attributes':_0x50a2d8['attributes'],'include':_0x50a2d8['include']?_['map'](_0x50a2d8[_0x1bc6('0x1f')],function(_0x4b6f5e){return{'model':db[_0x4b6f5e[_0x1bc6('0x20')]],'as':_0x4b6f5e['as'],'attributes':_0x4b6f5e[_0x1bc6('0x1d')],'include':_0x4b6f5e[_0x1bc6('0x1f')]?_[_0x1bc6('0x21')](_0x4b6f5e['include'],function(_0x4d13e9){return{'model':db[_0x4d13e9['model']],'as':_0x4d13e9['as'],'attributes':_0x4d13e9[_0x1bc6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18ac8b){logger['info'](_0x1bc6('0x23'),_0x2c8bae);logger[_0x1bc6('0x14')]('ShowSmsQueue',_0x2c8bae,JSON[_0x1bc6('0x15')](_0x18ac8b));_0x167203(_0x18ac8b);})['catch'](function(_0x5e7107){logger['error'](_0x1bc6('0x23'),_0x5e7107[_0x1bc6('0x17')],_0x2c8bae);_0x2e463d(_0x159786['error'](0x1f4,_0x5e7107['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4d4332c..d252b6c 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 _0x8f35=['emit','removeListener','register','length','smsQueue:','save','remove','update'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x8f35,0x16d));var _0x58f3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f35[_0x57b54c];return _0x59cc19;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x58f3('0x0'),_0x58f3('0x1'),_0x58f3('0x2')];function createListener(_0x4fc7f0,_0x345cae){return function(_0x35eb0a){_0x345cae[_0x58f3('0x3')](_0x4fc7f0,_0x35eb0a);};}function removeListener(_0x41f893,_0x492e3b){return function(){SmsQueueEvents[_0x58f3('0x4')](_0x41f893,_0x492e3b);};}exports[_0x58f3('0x5')]=function(_0x360a12){for(var _0x281fa0=0x0,_0x6b3de9=events[_0x58f3('0x6')];_0x281fa0<_0x6b3de9;_0x281fa0++){var _0x149e45=events[_0x281fa0];var _0x7b7335=createListener(_0x58f3('0x7')+_0x149e45,_0x360a12);SmsQueueEvents['on'](_0x149e45,_0x7b7335);}}; \ No newline at end of file +var _0xa0e7=['save','remove','update','removeListener','register','length','smsQueue:'];(function(_0x5a18fc,_0xb1a4aa){var _0x57b441=function(_0x14e663){while(--_0x14e663){_0x5a18fc['push'](_0x5a18fc['shift']());}};_0x57b441(++_0xb1a4aa);}(_0xa0e7,0x16c));var _0x7a0e=function(_0x4ab897,_0x1552d0){_0x4ab897=_0x4ab897-0x0;var _0x96822d=_0xa0e7[_0x4ab897];return _0x96822d;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x7a0e('0x0'),_0x7a0e('0x1'),_0x7a0e('0x2')];function createListener(_0x36fa4e,_0x3560c5){return function(_0x36742c){_0x3560c5['emit'](_0x36fa4e,_0x36742c);};}function removeListener(_0x3c9efd,_0xed1ab3){return function(){SmsQueueEvents[_0x7a0e('0x3')](_0x3c9efd,_0xed1ab3);};}exports[_0x7a0e('0x4')]=function(_0x53d671){for(var _0x2e0090=0x0,_0x19d6a1=events[_0x7a0e('0x5')];_0x2e0090<_0x19d6a1;_0x2e0090++){var _0x7f031d=events[_0x2e0090];var _0x536e3e=createListener(_0x7a0e('0x6')+_0x7f031d,_0x53d671);SmsQueueEvents['on'](_0x7f031d,_0x536e3e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 48aeabe..f7a66c9 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 _0x62dd=['delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','create','put','update'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x62dd,0x6c));var _0xd62d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x62dd[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var path=require(_0xd62d('0x2'));var timeout=require(_0xd62d('0x3'));var express=require(_0xd62d('0x4'));var router=express['Router']();var fs_extra=require(_0xd62d('0x5'));var auth=require(_0xd62d('0x6'));var interaction=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var controller=require('./smsQueueReport.controller');router[_0xd62d('0x9')]('/',auth['isAuthenticated'](),controller[_0xd62d('0xa')]);router[_0xd62d('0x9')](_0xd62d('0xb'),auth[_0xd62d('0xc')](),controller[_0xd62d('0xd')]);router['get']('/:id',auth[_0xd62d('0xc')](),controller[_0xd62d('0xe')]);router['post']('/',auth[_0xd62d('0xc')](),controller[_0xd62d('0xf')]);router[_0xd62d('0x10')]('/:id',auth[_0xd62d('0xc')](),controller[_0xd62d('0x11')]);router[_0xd62d('0x12')](_0xd62d('0x13'),auth[_0xd62d('0xc')](),controller['destroy']);module[_0xd62d('0x14')]=router; \ No newline at end of file +var _0x943c=['fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x51b2f1,_0x22c27a){var _0xf9ddf8=function(_0x20e84d){while(--_0x20e84d){_0x51b2f1['push'](_0x51b2f1['shift']());}};_0xf9ddf8(++_0x22c27a);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var path=require(_0xc943('0x2'));var timeout=require(_0xc943('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc943('0x4'));var auth=require(_0xc943('0x5'));var interaction=require(_0xc943('0x6'));var config=require('../../config/environment');var controller=require(_0xc943('0x7'));router[_0xc943('0x8')]('/',auth[_0xc943('0x9')](),controller[_0xc943('0xa')]);router[_0xc943('0x8')](_0xc943('0xb'),auth[_0xc943('0x9')](),controller['describe']);router[_0xc943('0x8')](_0xc943('0xc'),auth[_0xc943('0x9')](),controller[_0xc943('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc943('0xe')]);router[_0xc943('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc943('0x10')]);router[_0xc943('0x11')](_0xc943('0xc'),auth[_0xc943('0x9')](),controller[_0xc943('0x12')]);module[_0xc943('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5bbbdd1..d122806 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 _0x7ccb=['STRING','DATE','moment','sequelize','exports'];(function(_0x283a81,_0x42f033){var _0x57533f=function(_0x1bfe9e){while(--_0x1bfe9e){_0x283a81['push'](_0x283a81['shift']());}};_0x57533f(++_0x42f033);}(_0x7ccb,0x17e));var _0xb7cc=function(_0x2c7341,_0x293a18){_0x2c7341=_0x2c7341-0x0;var _0x23f3fc=_0x7ccb[_0x2c7341];return _0x23f3fc;};'use strict';var moment=require(_0xb7cc('0x0'));var Sequelize=require(_0xb7cc('0x1'));module[_0xb7cc('0x2')]={'uniqueid':{'type':Sequelize[_0xb7cc('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb7cc('0x4')]},'acceptAt':{'type':Sequelize[_0xb7cc('0x4')]},'exitAt':{'type':Sequelize[_0xb7cc('0x4')]},'reason':{'type':Sequelize[_0xb7cc('0x3')]}}; \ No newline at end of file +var _0x1629=['STRING','DATE','moment','sequelize','exports'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x1629,0x1d8));var _0x9162=function(_0x222c03,_0x3cadc0){_0x222c03=_0x222c03-0x0;var _0x1bf47e=_0x1629[_0x222c03];return _0x1bf47e;};'use strict';var moment=require(_0x9162('0x0'));var Sequelize=require(_0x9162('0x1'));module[_0x9162('0x2')]={'uniqueid':{'type':Sequelize[_0x9162('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9162('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9162('0x4')]},'reason':{'type':Sequelize[_0x9162('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 08797d0..868b533 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 _0x3305=['attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','update','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SmsQueueReport','model','query','keys','filters','intersection'];(function(_0xf4356f,_0x478f6d){var _0x3c304c=function(_0x1a08dc){while(--_0x1a08dc){_0xf4356f['push'](_0xf4356f['shift']());}};_0x3c304c(++_0x478f6d);}(_0x3305,0xac));var _0x5330=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3305[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x5330('0x0'));var rimraf=require(_0x5330('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5330('0x2'));var rp=require('request-promise');var moment=require(_0x5330('0x3'));var BPromise=require(_0x5330('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5330('0x5'));var csv=require(_0x5330('0x6'));var ejs=require(_0x5330('0x7'));var fs=require('fs');var fs_extra=require(_0x5330('0x8'));var _=require(_0x5330('0x9'));var squel=require(_0x5330('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5330('0xb'));var toCsv=require(_0x5330('0x6'));var querystring=require(_0x5330('0xc'));var Papa=require(_0x5330('0xd'));var Redis=require(_0x5330('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5330('0xf'));var as=require(_0x5330('0x10'));var hardwareService=require(_0x5330('0x11'));var logger=require(_0x5330('0x12'))(_0x5330('0x13'));var utils=require(_0x5330('0x14'));var config=require(_0x5330('0x15'));var licenseUtil=require(_0x5330('0x16'));var db=require(_0x5330('0x17'))['db'];function respondWithStatusCode(_0x48c974,_0x245f8f){_0x245f8f=_0x245f8f||0xcc;return function(_0x21e48d){if(_0x21e48d){return _0x48c974[_0x5330('0x18')](_0x245f8f);}return _0x48c974[_0x5330('0x19')](_0x245f8f)[_0x5330('0x1a')]();};}function respondWithResult(_0x5efb5f,_0x35e25f){_0x35e25f=_0x35e25f||0xc8;return function(_0x36c534){if(_0x36c534){return _0x5efb5f['status'](_0x35e25f)[_0x5330('0x1b')](_0x36c534);}};}function respondWithFilteredResult(_0x406a2a,_0x2555ba){return function(_0x26cfb6){if(_0x26cfb6){var _0x2daaeb=typeof _0x2555ba[_0x5330('0x1c')]===_0x5330('0x1d')&&typeof _0x2555ba[_0x5330('0x1e')]===_0x5330('0x1d');var _0x5a9e92=_0x26cfb6['count'];var _0x229cd4=_0x2daaeb?0x0:_0x2555ba[_0x5330('0x1c')];var _0x544e4b=_0x2daaeb?_0x26cfb6[_0x5330('0x1f')]:_0x2555ba['offset']+_0x2555ba['limit'];var _0x1b1a3c;if(_0x544e4b>=_0x5a9e92){_0x544e4b=_0x5a9e92;_0x1b1a3c=0xc8;}else{_0x1b1a3c=0xce;}_0x406a2a[_0x5330('0x19')](_0x1b1a3c);return _0x406a2a[_0x5330('0x20')](_0x5330('0x21'),_0x229cd4+'-'+_0x544e4b+'/'+_0x5a9e92)['json'](_0x26cfb6);}return null;};}function patchUpdates(_0x50fb88){return function(_0x2c0d37){try{jsonpatch[_0x5330('0x22')](_0x2c0d37,_0x50fb88,!![]);}catch(_0x297132){return BPromise[_0x5330('0x23')](_0x297132);}return _0x2c0d37[_0x5330('0x24')]();};}function saveUpdates(_0x1a1119,_0x1a0efe){return function(_0x4b3cc9){if(_0x4b3cc9){return _0x4b3cc9['update'](_0x1a1119)['then'](function(_0x37761b){return _0x37761b;});}return null;};}function removeEntity(_0x2c64f7,_0x94a6e9){return function(_0xf26f8f){if(_0xf26f8f){return _0xf26f8f[_0x5330('0x25')]()[_0x5330('0x26')](function(){_0x2c64f7[_0x5330('0x19')](0xcc)[_0x5330('0x1a')]();});}};}function handleEntityNotFound(_0x2f13c2,_0x1b6382){return function(_0x569237){if(!_0x569237){_0x2f13c2[_0x5330('0x18')](0x194);}return _0x569237;};}function handleError(_0x3e3d6c,_0x4b7f32){_0x4b7f32=_0x4b7f32||0x1f4;return function(_0x2019fc){logger[_0x5330('0x27')](_0x2019fc[_0x5330('0x28')]);if(_0x2019fc[_0x5330('0x29')]){delete _0x2019fc[_0x5330('0x29')];}_0x3e3d6c[_0x5330('0x19')](_0x4b7f32)['send'](_0x2019fc);};}exports[_0x5330('0x2a')]=function(_0x2d6236,_0x2625fd){var _0x2d66e9={},_0x2bb0b6={},_0xe8131b={'count':0x0,'rows':[]};var _0x572523=_[_0x5330('0x2b')](db[_0x5330('0x2c')]['rawAttributes'],function(_0xf3cd6d){return{'name':_0xf3cd6d['fieldName'],'type':_0xf3cd6d['type']['key']};});_0x2bb0b6[_0x5330('0x2d')]=_[_0x5330('0x2b')](_0x572523,_0x5330('0x29'));_0x2bb0b6[_0x5330('0x2e')]=_[_0x5330('0x2f')](_0x2d6236[_0x5330('0x2e')]);_0x2bb0b6[_0x5330('0x30')]=_[_0x5330('0x31')](_0x2bb0b6['model'],_0x2bb0b6['query']);_0x2d66e9[_0x5330('0x32')]=_[_0x5330('0x31')](_0x2bb0b6[_0x5330('0x2d')],qs[_0x5330('0x33')](_0x2d6236[_0x5330('0x2e')]['fields']));_0x2d66e9[_0x5330('0x32')]=_0x2d66e9['attributes']['length']?_0x2d66e9[_0x5330('0x32')]:_0x2bb0b6[_0x5330('0x2d')];if(!_0x2d6236[_0x5330('0x2e')][_0x5330('0x34')](_0x5330('0x35'))){_0x2d66e9['limit']=qs[_0x5330('0x1e')](_0x2d6236[_0x5330('0x2e')]['limit']);_0x2d66e9['offset']=qs[_0x5330('0x1c')](_0x2d6236['query'][_0x5330('0x1c')]);}_0x2d66e9['order']=qs['sort'](_0x2d6236['query'][_0x5330('0x36')]);_0x2d66e9[_0x5330('0x37')]=qs[_0x5330('0x30')](_[_0x5330('0x38')](_0x2d6236[_0x5330('0x2e')],_0x2bb0b6[_0x5330('0x30')]),_0x572523);if(_0x2d6236[_0x5330('0x2e')][_0x5330('0x39')]){_0x2d66e9[_0x5330('0x37')]=_['merge'](_0x2d66e9[_0x5330('0x37')],{'$or':_[_0x5330('0x2b')](_0x572523,function(_0xa83f47){if(_0xa83f47[_0x5330('0x3a')]!==_0x5330('0x3b')){var _0x72b8e4={};_0x72b8e4[_0xa83f47['name']]={'$like':'%'+_0x2d6236[_0x5330('0x2e')][_0x5330('0x39')]+'%'};return _0x72b8e4;}})});}_0x2d66e9=_[_0x5330('0x3c')]({},_0x2d66e9,_0x2d6236[_0x5330('0x3d')]);var _0x1e7eff={'where':_0x2d66e9['where']};return db[_0x5330('0x2c')][_0x5330('0x1f')](_0x1e7eff)[_0x5330('0x26')](function(_0x4747e9){_0xe8131b[_0x5330('0x1f')]=_0x4747e9;if(_0x2d6236['query'][_0x5330('0x3e')]){_0x2d66e9[_0x5330('0x3f')]=[{'all':!![]}];}return db[_0x5330('0x2c')]['findAll'](_0x2d66e9);})[_0x5330('0x26')](function(_0xf97225){_0xe8131b[_0x5330('0x40')]=_0xf97225;return _0xe8131b;})[_0x5330('0x26')](respondWithFilteredResult(_0x2625fd,_0x2d66e9))[_0x5330('0x41')](handleError(_0x2625fd,null));};exports[_0x5330('0x42')]=function(_0x75ea97,_0x34cb6e){var _0x285ccb={'raw':!![],'where':{'id':_0x75ea97[_0x5330('0x43')]['id']}},_0x3ede87={};_0x3ede87[_0x5330('0x2d')]=_[_0x5330('0x2f')](db[_0x5330('0x2c')][_0x5330('0x44')]);_0x3ede87[_0x5330('0x2e')]=_['keys'](_0x75ea97[_0x5330('0x2e')]);_0x3ede87[_0x5330('0x30')]=_['intersection'](_0x3ede87[_0x5330('0x2d')],_0x3ede87[_0x5330('0x2e')]);_0x285ccb['attributes']=_[_0x5330('0x31')](_0x3ede87[_0x5330('0x2d')],qs[_0x5330('0x33')](_0x75ea97[_0x5330('0x2e')][_0x5330('0x33')]));_0x285ccb[_0x5330('0x32')]=_0x285ccb[_0x5330('0x32')][_0x5330('0x45')]?_0x285ccb['attributes']:_0x3ede87[_0x5330('0x2d')];if(_0x75ea97['query'][_0x5330('0x3e')]){_0x285ccb[_0x5330('0x3f')]=[{'all':!![]}];}_0x285ccb=_[_0x5330('0x3c')]({},_0x285ccb,_0x75ea97[_0x5330('0x3d')]);return db[_0x5330('0x2c')]['find'](_0x285ccb)[_0x5330('0x26')](handleEntityNotFound(_0x34cb6e,null))[_0x5330('0x26')](respondWithResult(_0x34cb6e,null))[_0x5330('0x41')](handleError(_0x34cb6e,null));};exports[_0x5330('0x46')]=function(_0x4869d2,_0x605ec2){return db[_0x5330('0x2c')][_0x5330('0x46')](_0x4869d2['body'],{})[_0x5330('0x26')](respondWithResult(_0x605ec2,0xc9))[_0x5330('0x41')](handleError(_0x605ec2,null));};exports[_0x5330('0x47')]=function(_0x281e4b,_0x4705e6){if(_0x281e4b[_0x5330('0x48')]['id']){delete _0x281e4b['body']['id'];}return db[_0x5330('0x2c')][_0x5330('0x49')]({'where':{'id':_0x281e4b[_0x5330('0x43')]['id']}})[_0x5330('0x26')](handleEntityNotFound(_0x4705e6,null))[_0x5330('0x26')](saveUpdates(_0x281e4b[_0x5330('0x48')],null))[_0x5330('0x26')](respondWithResult(_0x4705e6,null))[_0x5330('0x41')](handleError(_0x4705e6,null));};exports['destroy']=function(_0x4ea891,_0x47f264){return db[_0x5330('0x2c')]['find']({'where':{'id':_0x4ea891[_0x5330('0x43')]['id']}})[_0x5330('0x26')](handleEntityNotFound(_0x47f264,null))['then'](removeEntity(_0x47f264,null))[_0x5330('0x41')](handleError(_0x47f264,null));};exports['describe']=function(_0x5baed7,_0x23a563){return db[_0x5330('0x2c')]['describe']()[_0x5330('0x26')](respondWithResult(_0x23a563,null))[_0x5330('0x41')](handleError(_0x23a563,null));}; \ No newline at end of file +var _0xd181=['rawAttributes','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params'];(function(_0x535b33,_0x5012e0){var _0x15329a=function(_0x182c74){while(--_0x182c74){_0x535b33['push'](_0x535b33['shift']());}};_0x15329a(++_0x5012e0);}(_0xd181,0xdd));var _0x1d18=function(_0x4447e9,_0x4379c6){_0x4447e9=_0x4447e9-0x0;var _0x3585f2=_0xd181[_0x4447e9];return _0x3585f2;};'use strict';var emlformat=require(_0x1d18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d18('0x1'));var rp=require(_0x1d18('0x2'));var moment=require(_0x1d18('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d18('0x4'));var util=require(_0x1d18('0x5'));var path=require(_0x1d18('0x6'));var sox=require(_0x1d18('0x7'));var csv=require(_0x1d18('0x8'));var ejs=require(_0x1d18('0x9'));var fs=require('fs');var fs_extra=require(_0x1d18('0xa'));var _=require('lodash');var squel=require(_0x1d18('0xb'));var crypto=require(_0x1d18('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1d18('0xd'));var toCsv=require(_0x1d18('0x8'));var querystring=require(_0x1d18('0xe'));var Papa=require('papaparse');var Redis=require(_0x1d18('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d18('0x10'));var hardwareService=require(_0x1d18('0x11'));var logger=require(_0x1d18('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1d18('0x13'));var licenseUtil=require(_0x1d18('0x14'));var db=require(_0x1d18('0x15'))['db'];function respondWithStatusCode(_0x1f3830,_0x1d931c){_0x1d931c=_0x1d931c||0xcc;return function(_0x48ba29){if(_0x48ba29){return _0x1f3830[_0x1d18('0x16')](_0x1d931c);}return _0x1f3830[_0x1d18('0x17')](_0x1d931c)[_0x1d18('0x18')]();};}function respondWithResult(_0x3995e4,_0x18730d){_0x18730d=_0x18730d||0xc8;return function(_0x2a14fc){if(_0x2a14fc){return _0x3995e4[_0x1d18('0x17')](_0x18730d)[_0x1d18('0x19')](_0x2a14fc);}};}function respondWithFilteredResult(_0xd11c4c,_0x2fab42){return function(_0x1b6e61){if(_0x1b6e61){var _0x2fdf6a=typeof _0x2fab42[_0x1d18('0x1a')]===_0x1d18('0x1b')&&typeof _0x2fab42['limit']==='undefined';var _0x46fc1d=_0x1b6e61[_0x1d18('0x1c')];var _0x20dba0=_0x2fdf6a?0x0:_0x2fab42['offset'];var _0x3f18f1=_0x2fdf6a?_0x1b6e61[_0x1d18('0x1c')]:_0x2fab42[_0x1d18('0x1a')]+_0x2fab42[_0x1d18('0x1d')];var _0x338687;if(_0x3f18f1>=_0x46fc1d){_0x3f18f1=_0x46fc1d;_0x338687=0xc8;}else{_0x338687=0xce;}_0xd11c4c[_0x1d18('0x17')](_0x338687);return _0xd11c4c[_0x1d18('0x1e')](_0x1d18('0x1f'),_0x20dba0+'-'+_0x3f18f1+'/'+_0x46fc1d)['json'](_0x1b6e61);}return null;};}function patchUpdates(_0x4a4dc0){return function(_0x54b9b8){try{jsonpatch['apply'](_0x54b9b8,_0x4a4dc0,!![]);}catch(_0x95036a){return BPromise[_0x1d18('0x20')](_0x95036a);}return _0x54b9b8['save']();};}function saveUpdates(_0x53abb5,_0x2fdd8d){return function(_0x377aa0){if(_0x377aa0){return _0x377aa0[_0x1d18('0x21')](_0x53abb5)[_0x1d18('0x22')](function(_0x59b4dd){return _0x59b4dd;});}return null;};}function removeEntity(_0x4c6100,_0x2d88da){return function(_0x5e0ece){if(_0x5e0ece){return _0x5e0ece[_0x1d18('0x23')]()[_0x1d18('0x22')](function(){_0x4c6100[_0x1d18('0x17')](0xcc)[_0x1d18('0x18')]();});}};}function handleEntityNotFound(_0x13dbd3,_0x4b2c05){return function(_0x3d9302){if(!_0x3d9302){_0x13dbd3[_0x1d18('0x16')](0x194);}return _0x3d9302;};}function handleError(_0x6e72a4,_0x13d451){_0x13d451=_0x13d451||0x1f4;return function(_0x59ed28){logger[_0x1d18('0x24')](_0x59ed28[_0x1d18('0x25')]);if(_0x59ed28[_0x1d18('0x26')]){delete _0x59ed28[_0x1d18('0x26')];}_0x6e72a4[_0x1d18('0x17')](_0x13d451)[_0x1d18('0x27')](_0x59ed28);};}exports[_0x1d18('0x28')]=function(_0x49e0e5,_0x36aa84){var _0x39dea8={},_0x486556={},_0x2ef58c={'count':0x0,'rows':[]};var _0x4b6e39=_[_0x1d18('0x29')](db[_0x1d18('0x2a')]['rawAttributes'],function(_0x288143){return{'name':_0x288143[_0x1d18('0x2b')],'type':_0x288143[_0x1d18('0x2c')][_0x1d18('0x2d')]};});_0x486556[_0x1d18('0x2e')]=_[_0x1d18('0x29')](_0x4b6e39,_0x1d18('0x26'));_0x486556[_0x1d18('0x2f')]=_[_0x1d18('0x30')](_0x49e0e5[_0x1d18('0x2f')]);_0x486556[_0x1d18('0x31')]=_[_0x1d18('0x32')](_0x486556[_0x1d18('0x2e')],_0x486556[_0x1d18('0x2f')]);_0x39dea8[_0x1d18('0x33')]=_[_0x1d18('0x32')](_0x486556['model'],qs[_0x1d18('0x34')](_0x49e0e5[_0x1d18('0x2f')][_0x1d18('0x34')]));_0x39dea8[_0x1d18('0x33')]=_0x39dea8[_0x1d18('0x33')][_0x1d18('0x35')]?_0x39dea8['attributes']:_0x486556[_0x1d18('0x2e')];if(!_0x49e0e5['query'][_0x1d18('0x36')](_0x1d18('0x37'))){_0x39dea8[_0x1d18('0x1d')]=qs['limit'](_0x49e0e5[_0x1d18('0x2f')][_0x1d18('0x1d')]);_0x39dea8[_0x1d18('0x1a')]=qs['offset'](_0x49e0e5['query'][_0x1d18('0x1a')]);}_0x39dea8['order']=qs[_0x1d18('0x38')](_0x49e0e5[_0x1d18('0x2f')][_0x1d18('0x38')]);_0x39dea8['where']=qs['filters'](_['pick'](_0x49e0e5[_0x1d18('0x2f')],_0x486556[_0x1d18('0x31')]),_0x4b6e39);if(_0x49e0e5[_0x1d18('0x2f')]['filter']){_0x39dea8[_0x1d18('0x39')]=_[_0x1d18('0x3a')](_0x39dea8[_0x1d18('0x39')],{'$or':_['map'](_0x4b6e39,function(_0x50b1c3){if(_0x50b1c3[_0x1d18('0x2c')]!==_0x1d18('0x3b')){var _0x22d7b3={};_0x22d7b3[_0x50b1c3[_0x1d18('0x26')]]={'$like':'%'+_0x49e0e5[_0x1d18('0x2f')]['filter']+'%'};return _0x22d7b3;}})});}_0x39dea8=_[_0x1d18('0x3a')]({},_0x39dea8,_0x49e0e5[_0x1d18('0x3c')]);var _0x4031c3={'where':_0x39dea8['where']};return db['SmsQueueReport'][_0x1d18('0x1c')](_0x4031c3)[_0x1d18('0x22')](function(_0x4a4bcb){_0x2ef58c[_0x1d18('0x1c')]=_0x4a4bcb;if(_0x49e0e5['query'][_0x1d18('0x3d')]){_0x39dea8[_0x1d18('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x39dea8);})[_0x1d18('0x22')](function(_0x429b8a){_0x2ef58c[_0x1d18('0x3f')]=_0x429b8a;return _0x2ef58c;})['then'](respondWithFilteredResult(_0x36aa84,_0x39dea8))[_0x1d18('0x40')](handleError(_0x36aa84,null));};exports[_0x1d18('0x41')]=function(_0x3661da,_0x77abe9){var _0x29f919={'raw':!![],'where':{'id':_0x3661da[_0x1d18('0x42')]['id']}},_0x408ad8={};_0x408ad8[_0x1d18('0x2e')]=_[_0x1d18('0x30')](db[_0x1d18('0x2a')][_0x1d18('0x43')]);_0x408ad8[_0x1d18('0x2f')]=_[_0x1d18('0x30')](_0x3661da[_0x1d18('0x2f')]);_0x408ad8['filters']=_[_0x1d18('0x32')](_0x408ad8[_0x1d18('0x2e')],_0x408ad8[_0x1d18('0x2f')]);_0x29f919[_0x1d18('0x33')]=_['intersection'](_0x408ad8[_0x1d18('0x2e')],qs['fields'](_0x3661da['query'][_0x1d18('0x34')]));_0x29f919[_0x1d18('0x33')]=_0x29f919[_0x1d18('0x33')][_0x1d18('0x35')]?_0x29f919[_0x1d18('0x33')]:_0x408ad8[_0x1d18('0x2e')];if(_0x3661da['query'][_0x1d18('0x3d')]){_0x29f919['include']=[{'all':!![]}];}_0x29f919=_[_0x1d18('0x3a')]({},_0x29f919,_0x3661da[_0x1d18('0x3c')]);return db[_0x1d18('0x2a')]['find'](_0x29f919)[_0x1d18('0x22')](handleEntityNotFound(_0x77abe9,null))[_0x1d18('0x22')](respondWithResult(_0x77abe9,null))['catch'](handleError(_0x77abe9,null));};exports[_0x1d18('0x44')]=function(_0x12f1ce,_0x415339){return db['SmsQueueReport'][_0x1d18('0x44')](_0x12f1ce[_0x1d18('0x45')],{})['then'](respondWithResult(_0x415339,0xc9))[_0x1d18('0x40')](handleError(_0x415339,null));};exports[_0x1d18('0x21')]=function(_0x4587a4,_0x1a1d36){if(_0x4587a4[_0x1d18('0x45')]['id']){delete _0x4587a4['body']['id'];}return db[_0x1d18('0x2a')][_0x1d18('0x46')]({'where':{'id':_0x4587a4[_0x1d18('0x42')]['id']}})[_0x1d18('0x22')](handleEntityNotFound(_0x1a1d36,null))[_0x1d18('0x22')](saveUpdates(_0x4587a4['body'],null))[_0x1d18('0x22')](respondWithResult(_0x1a1d36,null))[_0x1d18('0x40')](handleError(_0x1a1d36,null));};exports[_0x1d18('0x23')]=function(_0x33208e,_0x3f94ef){return db['SmsQueueReport'][_0x1d18('0x46')]({'where':{'id':_0x33208e[_0x1d18('0x42')]['id']}})[_0x1d18('0x22')](handleEntityNotFound(_0x3f94ef,null))['then'](removeEntity(_0x3f94ef,null))['catch'](handleError(_0x3f94ef,null));};exports[_0x1d18('0x47')]=function(_0x526368,_0x29649d){return db[_0x1d18('0x2a')]['describe']()['then'](respondWithResult(_0x29649d,null))[_0x1d18('0x40')](handleError(_0x29649d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ea52fbb..8d1a15e 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4cc198,_0x500ba){var _0x2a0fb1=function(_0x57a58){while(--_0x57a58){_0x4cc198['push'](_0x4cc198['shift']());}};_0x2a0fb1(++_0x500ba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xcb91[_0x43e4b3];return _0x10c655;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d4dd8,_0x93c0f5){var _0x16ebe9=function(_0x1b09f9){while(--_0x1b09f9){_0x3d4dd8['push'](_0x3d4dd8['shift']());}};_0x16ebe9(++_0x93c0f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4d90fca..54dbd65 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 _0xce95=['../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','then','UpdateSmsQueueReport','body','raw','where','attributes','limit','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x48f851,_0x1efdc0){var _0x22c062=function(_0x3c6331){while(--_0x3c6331){_0x48f851['push'](_0x48f851['shift']());}};_0x22c062(++_0x1efdc0);}(_0xce95,0x178));var _0x5ce9=function(_0x5e5088,_0x28cd71){_0x5e5088=_0x5e5088-0x0;var _0x3de657=_0xce95[_0x5e5088];return _0x3de657;};'use strict';var _=require('lodash');var util=require(_0x5ce9('0x0'));var moment=require(_0x5ce9('0x1'));var BPromise=require(_0x5ce9('0x2'));var rs=require(_0x5ce9('0x3'));var fs=require('fs');var Redis=require(_0x5ce9('0x4'));var db=require(_0x5ce9('0x5'))['db'];var utils=require(_0x5ce9('0x6'));var logger=require(_0x5ce9('0x7'))(_0x5ce9('0x8'));var config=require(_0x5ce9('0x9'));var jayson=require(_0x5ce9('0xa'));var client=jayson['client'][_0x5ce9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c8021,_0x309d6e,_0x1df269){return new BPromise(function(_0x4d6c77,_0xd69eec){return client[_0x5ce9('0xc')](_0x3c8021,_0x1df269)['then'](function(_0x51bca7){logger[_0x5ce9('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x309d6e,'request\x20sent');logger['debug'](_0x5ce9('0xe'),_0x309d6e,_0x5ce9('0xf'),JSON['stringify'](_0x51bca7));if(_0x51bca7[_0x5ce9('0x10')]){if(_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x11')]===0x1f4){logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x13')]);return _0xd69eec(_0x51bca7[_0x5ce9('0x10')]['message']);}logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x51bca7[_0x5ce9('0x10')]['message']);return _0x4d6c77(_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x13')]);}else{logger[_0x5ce9('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x309d6e,_0x5ce9('0xf'));_0x4d6c77(_0x51bca7[_0x5ce9('0x14')]['message']);}})[_0x5ce9('0x15')](function(_0x10da10){logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x10da10);_0xd69eec(_0x10da10);});});}exports[_0x5ce9('0x16')]=function(_0x2967b5){var _0x27774c=this;return new Promise(function(_0x4d2be3,_0x536d26){return db[_0x5ce9('0x17')][_0x5ce9('0x18')](_0x2967b5['body'],{'raw':_0x2967b5[_0x5ce9('0x19')]?_0x2967b5[_0x5ce9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5ce9('0x1a')](function(_0x10fa37){logger[_0x5ce9('0xd')](_0x5ce9('0x16'),_0x2967b5);logger['debug'](_0x5ce9('0x16'),_0x2967b5,JSON['stringify'](_0x10fa37));_0x4d2be3(_0x10fa37);})[_0x5ce9('0x15')](function(_0x1ddc6b){logger[_0x5ce9('0x10')](_0x5ce9('0x16'),_0x1ddc6b[_0x5ce9('0x13')],_0x2967b5);_0x536d26(_0x27774c['error'](0x1f4,_0x1ddc6b['message']));});});};exports[_0x5ce9('0x1b')]=function(_0x6c61a2){var _0x3d8cec=this;return new Promise(function(_0x483b39,_0x369905){return db[_0x5ce9('0x17')]['update'](_0x6c61a2[_0x5ce9('0x1c')],{'raw':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x1e')]||null:null,'attributes':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2['options'][_0x5ce9('0x1f')]||null:null,'limit':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x20')]||null:null})['then'](function(_0x2e2e6e){logger[_0x5ce9('0xd')]('UpdateSmsQueueReport',_0x6c61a2);logger[_0x5ce9('0x21')]('UpdateSmsQueueReport',_0x6c61a2,JSON[_0x5ce9('0x22')](_0x2e2e6e));_0x483b39(_0x2e2e6e);})[_0x5ce9('0x15')](function(_0xee40d0){logger['error'](_0x5ce9('0x1b'),_0xee40d0['message'],_0x6c61a2);_0x369905(_0x3d8cec[_0x5ce9('0x10')](0x1f4,_0xee40d0[_0x5ce9('0x13')]));});});}; \ No newline at end of file +var _0xf14f=['limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','update','where','attributes'];(function(_0x5b1889,_0x385d7f){var _0x32674b=function(_0x583978){while(--_0x583978){_0x5b1889['push'](_0x5b1889['shift']());}};_0x32674b(++_0x385d7f);}(_0xf14f,0x7d));var _0xff14=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0xf14f[_0x3f6c29];return _0x4af959;};'use strict';var _=require('lodash');var util=require(_0xff14('0x0'));var moment=require('moment');var BPromise=require(_0xff14('0x1'));var rs=require(_0xff14('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff14('0x3'))['db'];var utils=require(_0xff14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xff14('0x5'));var jayson=require(_0xff14('0x6'));var client=jayson['client'][_0xff14('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf5af4b,_0x20b049,_0x4c9cad){return new BPromise(function(_0x99e52d,_0x1ca624){return client['request'](_0xf5af4b,_0x4c9cad)[_0xff14('0x8')](function(_0x224087){logger[_0xff14('0x9')](_0xff14('0xa'),_0x20b049,'request\x20sent');logger[_0xff14('0xb')](_0xff14('0xc'),_0x20b049,_0xff14('0xd'),JSON[_0xff14('0xe')](_0x224087));if(_0x224087['error']){if(_0x224087['error'][_0xff14('0xf')]===0x1f4){logger[_0xff14('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x20b049,_0x224087[_0xff14('0x10')][_0xff14('0x11')]);return _0x1ca624(_0x224087[_0xff14('0x10')][_0xff14('0x11')]);}logger['error'](_0xff14('0xa'),_0x20b049,_0x224087[_0xff14('0x10')][_0xff14('0x11')]);return _0x99e52d(_0x224087[_0xff14('0x10')][_0xff14('0x11')]);}else{logger[_0xff14('0x9')](_0xff14('0xa'),_0x20b049,'request\x20sent');_0x99e52d(_0x224087[_0xff14('0x12')][_0xff14('0x11')]);}})['catch'](function(_0x295b73){logger[_0xff14('0x10')](_0xff14('0xa'),_0x20b049,_0x295b73);_0x1ca624(_0x295b73);});});}exports[_0xff14('0x13')]=function(_0x51807a){var _0x17aec6=this;return new Promise(function(_0xb5c424,_0x3a488b){return db[_0xff14('0x14')][_0xff14('0x15')](_0x51807a[_0xff14('0x16')],{'raw':_0x51807a[_0xff14('0x17')]?_0x51807a[_0xff14('0x17')][_0xff14('0x18')]===undefined?!![]:![]:!![]})[_0xff14('0x8')](function(_0x27c302){logger['info'](_0xff14('0x13'),_0x51807a);logger[_0xff14('0xb')](_0xff14('0x13'),_0x51807a,JSON['stringify'](_0x27c302));_0xb5c424(_0x27c302);})[_0xff14('0x19')](function(_0x4c3007){logger[_0xff14('0x10')]('CreateSmsQueueReport',_0x4c3007[_0xff14('0x11')],_0x51807a);_0x3a488b(_0x17aec6[_0xff14('0x10')](0x1f4,_0x4c3007[_0xff14('0x11')]));});});};exports[_0xff14('0x1a')]=function(_0x45691c){var _0x48b2b0=this;return new Promise(function(_0x334d05,_0x52ce9b){return db['SmsQueueReport'][_0xff14('0x1b')](_0x45691c['body'],{'raw':_0x45691c[_0xff14('0x17')]?_0x45691c[_0xff14('0x17')][_0xff14('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45691c['options']?_0x45691c[_0xff14('0x17')][_0xff14('0x1c')]||null:null,'attributes':_0x45691c['options']?_0x45691c['options'][_0xff14('0x1d')]||null:null,'limit':_0x45691c['options']?_0x45691c[_0xff14('0x17')][_0xff14('0x1e')]||null:null})[_0xff14('0x8')](function(_0x192a99){logger[_0xff14('0x9')](_0xff14('0x1a'),_0x45691c);logger[_0xff14('0xb')]('UpdateSmsQueueReport',_0x45691c,JSON[_0xff14('0xe')](_0x192a99));_0x334d05(_0x192a99);})[_0xff14('0x19')](function(_0x1d1c8c){logger[_0xff14('0x10')](_0xff14('0x1a'),_0x1d1c8c['message'],_0x45691c);_0x52ce9b(_0x48b2b0['error'](0x1f4,_0x1d1c8c[_0xff14('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7ae6cf3..dcc8b15 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 _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3cba80,_0x3024e7){var _0x11cb67=function(_0x56f8c8){while(--_0x56f8c8){_0x3cba80['push'](_0x3cba80['shift']());}};_0x11cb67(++_0x3024e7);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1e11f5,_0x25e4d2){_0x1e11f5=_0x1e11f5-0x0;var _0x97366c=_0xdc97[_0x1e11f5];return _0x97366c;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb66c=['./smsTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xb66c,0x175));var _0xcb66=function(_0x503c0d,_0x12bbab){_0x503c0d=_0x503c0d-0x0;var _0x500535=_0xb66c[_0x503c0d];return _0x500535;};'use strict';var multer=require(_0xcb66('0x0'));var util=require('util');var path=require(_0xcb66('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb66('0x2'));var router=express[_0xcb66('0x3')]();var fs_extra=require(_0xcb66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var controller=require(_0xcb66('0x7'));router[_0xcb66('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb66('0x8')](_0xcb66('0x9'),auth[_0xcb66('0xa')](),controller[_0xcb66('0xb')]);router[_0xcb66('0x8')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0xc')]);router[_0xcb66('0xd')]('/',auth[_0xcb66('0xa')](),controller[_0xcb66('0xe')]);router['put'](_0xcb66('0xf'),auth[_0xcb66('0xa')](),controller[_0xcb66('0x10')]);router[_0xcb66('0x11')]('/:id',auth[_0xcb66('0xa')](),controller[_0xcb66('0x12')]);module[_0xcb66('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c5d868c..b2ed164 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1eba49,_0x15468c){var _0x5097e5=function(_0x259283){while(--_0x259283){_0x1eba49['push'](_0x1eba49['shift']());}};_0x5097e5(++_0x15468c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xcb91[_0x163742];return _0x1152ac;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x25b7be,_0x2bc7d5){var _0x4eaabf=function(_0x5476fa){while(--_0x5476fa){_0x25b7be['push'](_0x25b7be['shift']());}};_0x4eaabf(++_0x2bc7d5);}(_0x008c,0x188));var _0xc008=function(_0x338b26,_0x45d064){_0x338b26=_0x338b26-0x0;var _0x21d9da=_0x008c[_0x338b26];return _0x21d9da;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 40dbeaf..50f4b79 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 _0xc9d9=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x18fba1,_0x190cd4){var _0x2409d6=function(_0x14cb49){while(--_0x14cb49){_0x18fba1['push'](_0x18fba1['shift']());}};_0x2409d6(++_0x190cd4);}(_0xc9d9,0x1e1));var _0x9c9d=function(_0x2b114f,_0x3cec30){_0x2b114f=_0x2b114f-0x0;var _0x2d401e=_0xc9d9[_0x2b114f];return _0x2d401e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c9d('0x0'));var zipdir=require(_0x9c9d('0x1'));var jsonpatch=require(_0x9c9d('0x2'));var rp=require(_0x9c9d('0x3'));var moment=require(_0x9c9d('0x4'));var BPromise=require(_0x9c9d('0x5'));var Mustache=require(_0x9c9d('0x6'));var util=require(_0x9c9d('0x7'));var path=require(_0x9c9d('0x8'));var sox=require(_0x9c9d('0x9'));var csv=require(_0x9c9d('0xa'));var ejs=require(_0x9c9d('0xb'));var fs=require('fs');var fs_extra=require(_0x9c9d('0xc'));var _=require(_0x9c9d('0xd'));var squel=require(_0x9c9d('0xe'));var crypto=require('crypto');var jsforce=require(_0x9c9d('0xf'));var deskjs=require(_0x9c9d('0x10'));var toCsv=require(_0x9c9d('0xa'));var querystring=require(_0x9c9d('0x11'));var Papa=require(_0x9c9d('0x12'));var Redis=require(_0x9c9d('0x13'));var authService=require(_0x9c9d('0x14'));var qs=require(_0x9c9d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c9d('0x16'));var logger=require(_0x9c9d('0x17'))('api');var utils=require(_0x9c9d('0x18'));var config=require(_0x9c9d('0x19'));var licenseUtil=require(_0x9c9d('0x1a'));var db=require(_0x9c9d('0x1b'))['db'];function respondWithStatusCode(_0x178c51,_0x432fdf){_0x432fdf=_0x432fdf||0xcc;return function(_0x496fde){if(_0x496fde){return _0x178c51[_0x9c9d('0x1c')](_0x432fdf);}return _0x178c51[_0x9c9d('0x1d')](_0x432fdf)[_0x9c9d('0x1e')]();};}function respondWithResult(_0x4c7ca1,_0x30c3c5){_0x30c3c5=_0x30c3c5||0xc8;return function(_0x50ab26){if(_0x50ab26){return _0x4c7ca1[_0x9c9d('0x1d')](_0x30c3c5)[_0x9c9d('0x1f')](_0x50ab26);}};}function respondWithFilteredResult(_0x8ee331,_0x538826){return function(_0x46b815){if(_0x46b815){var _0x6b7304=typeof _0x538826[_0x9c9d('0x20')]===_0x9c9d('0x21')&&typeof _0x538826[_0x9c9d('0x22')]==='undefined';var _0x4b270f=_0x46b815[_0x9c9d('0x23')];var _0x16376f=_0x6b7304?0x0:_0x538826[_0x9c9d('0x20')];var _0xd93d07=_0x6b7304?_0x46b815['count']:_0x538826[_0x9c9d('0x20')]+_0x538826[_0x9c9d('0x22')];var _0x353082;if(_0xd93d07>=_0x4b270f){_0xd93d07=_0x4b270f;_0x353082=0xc8;}else{_0x353082=0xce;}_0x8ee331['status'](_0x353082);return _0x8ee331[_0x9c9d('0x24')](_0x9c9d('0x25'),_0x16376f+'-'+_0xd93d07+'/'+_0x4b270f)[_0x9c9d('0x1f')](_0x46b815);}return null;};}function patchUpdates(_0x426744){return function(_0x5889b7){try{jsonpatch[_0x9c9d('0x26')](_0x5889b7,_0x426744,!![]);}catch(_0x321107){return BPromise[_0x9c9d('0x27')](_0x321107);}return _0x5889b7[_0x9c9d('0x28')]();};}function saveUpdates(_0xcc1820,_0x34cd18){return function(_0xf822a){if(_0xf822a){return _0xf822a[_0x9c9d('0x29')](_0xcc1820)[_0x9c9d('0x2a')](function(_0x224a8c){return _0x224a8c;});}return null;};}function removeEntity(_0x5ea7a7,_0x5ecc79){return function(_0x380332){if(_0x380332){return _0x380332[_0x9c9d('0x2b')]()['then'](function(){_0x5ea7a7[_0x9c9d('0x1d')](0xcc)[_0x9c9d('0x1e')]();});}};}function handleEntityNotFound(_0x37b6a6,_0x22b1cc){return function(_0xfec396){if(!_0xfec396){_0x37b6a6['sendStatus'](0x194);}return _0xfec396;};}function handleError(_0x455741,_0x5d2174){_0x5d2174=_0x5d2174||0x1f4;return function(_0x4dff2f){logger[_0x9c9d('0x2c')](_0x4dff2f[_0x9c9d('0x2d')]);if(_0x4dff2f[_0x9c9d('0x2e')]){delete _0x4dff2f[_0x9c9d('0x2e')];}_0x455741[_0x9c9d('0x1d')](_0x5d2174)[_0x9c9d('0x2f')](_0x4dff2f);};}exports['index']=function(_0x29340e,_0x47128d){var _0x1b3f75={},_0x5a6f93={},_0x6b42f2={'count':0x0,'rows':[]};var _0x29d7a3=_['map'](db[_0x9c9d('0x30')][_0x9c9d('0x31')],function(_0xdc369e){return{'name':_0xdc369e[_0x9c9d('0x32')],'type':_0xdc369e['type'][_0x9c9d('0x33')]};});_0x5a6f93[_0x9c9d('0x34')]=_[_0x9c9d('0x35')](_0x29d7a3,_0x9c9d('0x2e'));_0x5a6f93[_0x9c9d('0x36')]=_['keys'](_0x29340e['query']);_0x5a6f93[_0x9c9d('0x37')]=_[_0x9c9d('0x38')](_0x5a6f93[_0x9c9d('0x34')],_0x5a6f93['query']);_0x1b3f75[_0x9c9d('0x39')]=_[_0x9c9d('0x38')](_0x5a6f93[_0x9c9d('0x34')],qs['fields'](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x3a')]));_0x1b3f75[_0x9c9d('0x39')]=_0x1b3f75[_0x9c9d('0x39')][_0x9c9d('0x3b')]?_0x1b3f75[_0x9c9d('0x39')]:_0x5a6f93[_0x9c9d('0x34')];if(!_0x29340e['query'][_0x9c9d('0x3c')](_0x9c9d('0x3d'))){_0x1b3f75[_0x9c9d('0x22')]=qs[_0x9c9d('0x22')](_0x29340e[_0x9c9d('0x36')]['limit']);_0x1b3f75[_0x9c9d('0x20')]=qs[_0x9c9d('0x20')](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x20')]);}_0x1b3f75[_0x9c9d('0x3e')]=qs['sort'](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x3f')]);_0x1b3f75['where']=qs['filters'](_['pick'](_0x29340e['query'],_0x5a6f93[_0x9c9d('0x37')]),_0x29d7a3);if(_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x40')]){_0x1b3f75[_0x9c9d('0x41')]=_['merge'](_0x1b3f75[_0x9c9d('0x41')],{'$or':_[_0x9c9d('0x35')](_0x29d7a3,function(_0xd1039c){if(_0xd1039c[_0x9c9d('0x42')]!==_0x9c9d('0x43')){var _0x384a0e={};_0x384a0e[_0xd1039c[_0x9c9d('0x2e')]]={'$like':'%'+_0x29340e[_0x9c9d('0x36')]['filter']+'%'};return _0x384a0e;}})});}_0x1b3f75=_[_0x9c9d('0x44')]({},_0x1b3f75,_0x29340e[_0x9c9d('0x45')]);var _0x28b11d={'where':_0x1b3f75[_0x9c9d('0x41')]};return db[_0x9c9d('0x30')][_0x9c9d('0x23')](_0x28b11d)[_0x9c9d('0x2a')](function(_0x11dcd2){_0x6b42f2[_0x9c9d('0x23')]=_0x11dcd2;if(_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x46')]){_0x1b3f75['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x9c9d('0x47')](_0x1b3f75);})[_0x9c9d('0x2a')](function(_0x5458e4){_0x6b42f2[_0x9c9d('0x48')]=_0x5458e4;return _0x6b42f2;})['then'](respondWithFilteredResult(_0x47128d,_0x1b3f75))['catch'](handleError(_0x47128d,null));};exports[_0x9c9d('0x49')]=function(_0x1a63c7,_0x523d3c){var _0x13308a={'raw':!![],'where':{'id':_0x1a63c7[_0x9c9d('0x4a')]['id']}},_0x68a678={};_0x68a678['model']=_['keys'](db[_0x9c9d('0x30')][_0x9c9d('0x31')]);_0x68a678[_0x9c9d('0x36')]=_['keys'](_0x1a63c7[_0x9c9d('0x36')]);_0x68a678['filters']=_['intersection'](_0x68a678[_0x9c9d('0x34')],_0x68a678['query']);_0x13308a[_0x9c9d('0x39')]=_[_0x9c9d('0x38')](_0x68a678[_0x9c9d('0x34')],qs[_0x9c9d('0x3a')](_0x1a63c7['query'][_0x9c9d('0x3a')]));_0x13308a[_0x9c9d('0x39')]=_0x13308a['attributes'][_0x9c9d('0x3b')]?_0x13308a['attributes']:_0x68a678['model'];if(_0x1a63c7['query'][_0x9c9d('0x46')]){_0x13308a[_0x9c9d('0x4b')]=[{'all':!![]}];}_0x13308a=_[_0x9c9d('0x44')]({},_0x13308a,_0x1a63c7[_0x9c9d('0x45')]);return db[_0x9c9d('0x30')][_0x9c9d('0x4c')](_0x13308a)['then'](handleEntityNotFound(_0x523d3c,null))[_0x9c9d('0x2a')](respondWithResult(_0x523d3c,null))[_0x9c9d('0x4d')](handleError(_0x523d3c,null));};exports[_0x9c9d('0x4e')]=function(_0x45389b,_0xd7aa87){return db[_0x9c9d('0x30')][_0x9c9d('0x4e')](_0x45389b['body'],{})[_0x9c9d('0x2a')](respondWithResult(_0xd7aa87,0xc9))[_0x9c9d('0x4d')](handleError(_0xd7aa87,null));};exports[_0x9c9d('0x29')]=function(_0x1c3de9,_0x5f11fc){if(_0x1c3de9[_0x9c9d('0x4f')]['id']){delete _0x1c3de9[_0x9c9d('0x4f')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x1c3de9[_0x9c9d('0x4a')]['id']}})[_0x9c9d('0x2a')](handleEntityNotFound(_0x5f11fc,null))[_0x9c9d('0x2a')](saveUpdates(_0x1c3de9[_0x9c9d('0x4f')],null))[_0x9c9d('0x2a')](respondWithResult(_0x5f11fc,null))['catch'](handleError(_0x5f11fc,null));};exports[_0x9c9d('0x2b')]=function(_0x272ac5,_0x4c4aa7){return db[_0x9c9d('0x30')][_0x9c9d('0x4c')]({'where':{'id':_0x272ac5['params']['id']}})['then'](handleEntityNotFound(_0x4c4aa7,null))['then'](removeEntity(_0x4c4aa7,null))[_0x9c9d('0x4d')](handleError(_0x4c4aa7,null));};exports[_0x9c9d('0x50')]=function(_0xce2478,_0x3ef9c3){return db[_0x9c9d('0x30')][_0x9c9d('0x50')]()['then'](respondWithResult(_0x3ef9c3,null))[_0x9c9d('0x4d')](handleError(_0x3ef9c3,null));}; \ No newline at end of file +var _0x0082=['update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x22c2e7,_0x43a6b2){var _0x4a14ed=function(_0x3285a0){while(--_0x3285a0){_0x22c2e7['push'](_0x22c2e7['shift']());}};_0x4a14ed(++_0x43a6b2);}(_0x0082,0x112));var _0x2008=function(_0x51b2f7,_0x303ad2){_0x51b2f7=_0x51b2f7-0x0;var _0x556d95=_0x0082[_0x51b2f7];return _0x556d95;};'use strict';var emlformat=require(_0x2008('0x0'));var rimraf=require(_0x2008('0x1'));var zipdir=require(_0x2008('0x2'));var jsonpatch=require(_0x2008('0x3'));var rp=require(_0x2008('0x4'));var moment=require(_0x2008('0x5'));var BPromise=require(_0x2008('0x6'));var Mustache=require(_0x2008('0x7'));var util=require(_0x2008('0x8'));var path=require('path');var sox=require(_0x2008('0x9'));var csv=require(_0x2008('0xa'));var ejs=require(_0x2008('0xb'));var fs=require('fs');var fs_extra=require(_0x2008('0xc'));var _=require(_0x2008('0xd'));var squel=require(_0x2008('0xe'));var crypto=require(_0x2008('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2008('0xa'));var querystring=require('querystring');var Papa=require(_0x2008('0x10'));var Redis=require('ioredis');var authService=require(_0x2008('0x11'));var qs=require(_0x2008('0x12'));var as=require(_0x2008('0x13'));var hardwareService=require(_0x2008('0x14'));var logger=require(_0x2008('0x15'))(_0x2008('0x16'));var utils=require(_0x2008('0x17'));var config=require(_0x2008('0x18'));var licenseUtil=require(_0x2008('0x19'));var db=require(_0x2008('0x1a'))['db'];function respondWithStatusCode(_0x102905,_0x293808){_0x293808=_0x293808||0xcc;return function(_0x16e77c){if(_0x16e77c){return _0x102905[_0x2008('0x1b')](_0x293808);}return _0x102905['status'](_0x293808)['end']();};}function respondWithResult(_0x5c5983,_0x255881){_0x255881=_0x255881||0xc8;return function(_0xae9d33){if(_0xae9d33){return _0x5c5983[_0x2008('0x1c')](_0x255881)[_0x2008('0x1d')](_0xae9d33);}};}function respondWithFilteredResult(_0x1b4db3,_0x5646f7){return function(_0x3fac6f){if(_0x3fac6f){var _0x357ae8=typeof _0x5646f7[_0x2008('0x1e')]===_0x2008('0x1f')&&typeof _0x5646f7[_0x2008('0x20')]===_0x2008('0x1f');var _0x4ca21c=_0x3fac6f[_0x2008('0x21')];var _0x44d378=_0x357ae8?0x0:_0x5646f7['offset'];var _0x400942=_0x357ae8?_0x3fac6f[_0x2008('0x21')]:_0x5646f7[_0x2008('0x1e')]+_0x5646f7[_0x2008('0x20')];var _0x304dfd;if(_0x400942>=_0x4ca21c){_0x400942=_0x4ca21c;_0x304dfd=0xc8;}else{_0x304dfd=0xce;}_0x1b4db3['status'](_0x304dfd);return _0x1b4db3[_0x2008('0x22')](_0x2008('0x23'),_0x44d378+'-'+_0x400942+'/'+_0x4ca21c)[_0x2008('0x1d')](_0x3fac6f);}return null;};}function patchUpdates(_0x253e19){return function(_0x1b19f7){try{jsonpatch[_0x2008('0x24')](_0x1b19f7,_0x253e19,!![]);}catch(_0x41d7b2){return BPromise[_0x2008('0x25')](_0x41d7b2);}return _0x1b19f7['save']();};}function saveUpdates(_0x25bc8b,_0x778313){return function(_0x43466){if(_0x43466){return _0x43466[_0x2008('0x26')](_0x25bc8b)[_0x2008('0x27')](function(_0x4468a3){return _0x4468a3;});}return null;};}function removeEntity(_0x3593a6,_0x38791c){return function(_0x399dc9){if(_0x399dc9){return _0x399dc9[_0x2008('0x28')]()[_0x2008('0x27')](function(){_0x3593a6['status'](0xcc)[_0x2008('0x29')]();});}};}function handleEntityNotFound(_0x3a81b1,_0x2714fd){return function(_0x26cff3){if(!_0x26cff3){_0x3a81b1[_0x2008('0x1b')](0x194);}return _0x26cff3;};}function handleError(_0x14e980,_0xb14b3d){_0xb14b3d=_0xb14b3d||0x1f4;return function(_0x5deb24){logger[_0x2008('0x2a')](_0x5deb24[_0x2008('0x2b')]);if(_0x5deb24[_0x2008('0x2c')]){delete _0x5deb24[_0x2008('0x2c')];}_0x14e980[_0x2008('0x1c')](_0xb14b3d)[_0x2008('0x2d')](_0x5deb24);};}exports[_0x2008('0x2e')]=function(_0x659e08,_0x19d643){var _0x439c62={},_0x254c5f={},_0x607514={'count':0x0,'rows':[]};var _0xc4aab=_[_0x2008('0x2f')](db[_0x2008('0x30')]['rawAttributes'],function(_0x55a1bf){return{'name':_0x55a1bf[_0x2008('0x31')],'type':_0x55a1bf[_0x2008('0x32')][_0x2008('0x33')]};});_0x254c5f[_0x2008('0x34')]=_[_0x2008('0x2f')](_0xc4aab,'name');_0x254c5f[_0x2008('0x35')]=_[_0x2008('0x36')](_0x659e08['query']);_0x254c5f[_0x2008('0x37')]=_['intersection'](_0x254c5f['model'],_0x254c5f[_0x2008('0x35')]);_0x439c62['attributes']=_[_0x2008('0x38')](_0x254c5f[_0x2008('0x34')],qs[_0x2008('0x39')](_0x659e08[_0x2008('0x35')][_0x2008('0x39')]));_0x439c62[_0x2008('0x3a')]=_0x439c62['attributes'][_0x2008('0x3b')]?_0x439c62[_0x2008('0x3a')]:_0x254c5f[_0x2008('0x34')];if(!_0x659e08['query'][_0x2008('0x3c')](_0x2008('0x3d'))){_0x439c62['limit']=qs['limit'](_0x659e08[_0x2008('0x35')][_0x2008('0x20')]);_0x439c62[_0x2008('0x1e')]=qs['offset'](_0x659e08[_0x2008('0x35')][_0x2008('0x1e')]);}_0x439c62['order']=qs[_0x2008('0x3e')](_0x659e08[_0x2008('0x35')][_0x2008('0x3e')]);_0x439c62[_0x2008('0x3f')]=qs[_0x2008('0x37')](_[_0x2008('0x40')](_0x659e08[_0x2008('0x35')],_0x254c5f[_0x2008('0x37')]),_0xc4aab);if(_0x659e08['query'][_0x2008('0x41')]){_0x439c62[_0x2008('0x3f')]=_[_0x2008('0x42')](_0x439c62[_0x2008('0x3f')],{'$or':_['map'](_0xc4aab,function(_0x4eb521){if(_0x4eb521[_0x2008('0x32')]!=='VIRTUAL'){var _0x3ad855={};_0x3ad855[_0x4eb521[_0x2008('0x2c')]]={'$like':'%'+_0x659e08[_0x2008('0x35')][_0x2008('0x41')]+'%'};return _0x3ad855;}})});}_0x439c62=_[_0x2008('0x42')]({},_0x439c62,_0x659e08['options']);var _0x9e7e5e={'where':_0x439c62[_0x2008('0x3f')]};return db[_0x2008('0x30')][_0x2008('0x21')](_0x9e7e5e)[_0x2008('0x27')](function(_0x21435e){_0x607514[_0x2008('0x21')]=_0x21435e;if(_0x659e08[_0x2008('0x35')][_0x2008('0x43')]){_0x439c62[_0x2008('0x44')]=[{'all':!![]}];}return db[_0x2008('0x30')][_0x2008('0x45')](_0x439c62);})[_0x2008('0x27')](function(_0x149107){_0x607514['rows']=_0x149107;return _0x607514;})['then'](respondWithFilteredResult(_0x19d643,_0x439c62))[_0x2008('0x46')](handleError(_0x19d643,null));};exports[_0x2008('0x47')]=function(_0x551836,_0x48e4ac){var _0x1f117f={'raw':!![],'where':{'id':_0x551836[_0x2008('0x48')]['id']}},_0x175638={};_0x175638[_0x2008('0x34')]=_[_0x2008('0x36')](db['SmsTransferReport'][_0x2008('0x49')]);_0x175638[_0x2008('0x35')]=_[_0x2008('0x36')](_0x551836[_0x2008('0x35')]);_0x175638[_0x2008('0x37')]=_[_0x2008('0x38')](_0x175638[_0x2008('0x34')],_0x175638[_0x2008('0x35')]);_0x1f117f[_0x2008('0x3a')]=_[_0x2008('0x38')](_0x175638[_0x2008('0x34')],qs[_0x2008('0x39')](_0x551836[_0x2008('0x35')][_0x2008('0x39')]));_0x1f117f[_0x2008('0x3a')]=_0x1f117f['attributes']['length']?_0x1f117f['attributes']:_0x175638[_0x2008('0x34')];if(_0x551836[_0x2008('0x35')][_0x2008('0x43')]){_0x1f117f[_0x2008('0x44')]=[{'all':!![]}];}_0x1f117f=_['merge']({},_0x1f117f,_0x551836[_0x2008('0x4a')]);return db['SmsTransferReport'][_0x2008('0x4b')](_0x1f117f)[_0x2008('0x27')](handleEntityNotFound(_0x48e4ac,null))['then'](respondWithResult(_0x48e4ac,null))['catch'](handleError(_0x48e4ac,null));};exports['create']=function(_0x259e8f,_0x39d1c3){return db[_0x2008('0x30')]['create'](_0x259e8f[_0x2008('0x4c')],{})[_0x2008('0x27')](respondWithResult(_0x39d1c3,0xc9))['catch'](handleError(_0x39d1c3,null));};exports[_0x2008('0x26')]=function(_0x58eb56,_0x3baccb){if(_0x58eb56[_0x2008('0x4c')]['id']){delete _0x58eb56['body']['id'];}return db[_0x2008('0x30')][_0x2008('0x4b')]({'where':{'id':_0x58eb56[_0x2008('0x48')]['id']}})[_0x2008('0x27')](handleEntityNotFound(_0x3baccb,null))[_0x2008('0x27')](saveUpdates(_0x58eb56[_0x2008('0x4c')],null))[_0x2008('0x27')](respondWithResult(_0x3baccb,null))[_0x2008('0x46')](handleError(_0x3baccb,null));};exports['destroy']=function(_0x215ef,_0x26e76c){return db[_0x2008('0x30')][_0x2008('0x4b')]({'where':{'id':_0x215ef[_0x2008('0x48')]['id']}})[_0x2008('0x27')](handleEntityNotFound(_0x26e76c,null))[_0x2008('0x27')](removeEntity(_0x26e76c,null))[_0x2008('0x46')](handleError(_0x26e76c,null));};exports[_0x2008('0x4d')]=function(_0x1b68ba,_0x4b0652){return db['SmsTransferReport'][_0x2008('0x4d')]()[_0x2008('0x27')](respondWithResult(_0x4b0652,null))[_0x2008('0x46')](handleError(_0x4b0652,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 86ade97..037a494 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 _0x807b=['lodash','util','../../config/logger','api','bluebird','path','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid'];(function(_0x35cb30,_0x12ac50){var _0x2742b9=function(_0x54e888){while(--_0x54e888){_0x35cb30['push'](_0x35cb30['shift']());}};_0x2742b9(++_0x12ac50);}(_0x807b,0x13f));var _0xb807=function(_0x4f0cad,_0x1d72d9){_0x4f0cad=_0x4f0cad-0x0;var _0x3081a0=_0x807b[_0x4f0cad];return _0x3081a0;};'use strict';var _=require(_0xb807('0x0'));var util=require(_0xb807('0x1'));var logger=require(_0xb807('0x2'))(_0xb807('0x3'));var moment=require('moment');var BPromise=require(_0xb807('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb807('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb807('0x6'));module[_0xb807('0x7')]=function(_0xa845ff,_0x309df0){return _0xa845ff[_0xb807('0x8')]('SmsTransferReport',attributes,{'tableName':_0xb807('0x9'),'paranoid':![],'indexes':[{'name':_0xb807('0xa'),'fields':[_0xb807('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23cd=['request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x1e5f10,_0x2e17bd){var _0x592268=function(_0x49e0ea){while(--_0x49e0ea){_0x1e5f10['push'](_0x1e5f10['shift']());}};_0x592268(++_0x2e17bd);}(_0x23cd,0x182));var _0xd23c=function(_0x216c4e,_0x293856){_0x216c4e=_0x216c4e-0x0;var _0x33f62e=_0x23cd[_0x216c4e];return _0x33f62e;};'use strict';var _=require('lodash');var util=require(_0xd23c('0x0'));var logger=require('../../config/logger')(_0xd23c('0x1'));var moment=require(_0xd23c('0x2'));var BPromise=require(_0xd23c('0x3'));var rp=require(_0xd23c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd23c('0x5'));var config=require(_0xd23c('0x6'));var attributes=require(_0xd23c('0x7'));module[_0xd23c('0x8')]=function(_0x35351b,_0x509a3d){return _0x35351b[_0xd23c('0x9')](_0xd23c('0xa'),attributes,{'tableName':_0xd23c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd23c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f6043bb..d06127d 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 _0x72a2=['info','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5e64ac,_0x4e1cdb){var _0x2696fc=function(_0x329b2f){while(--_0x329b2f){_0x5e64ac['push'](_0x5e64ac['shift']());}};_0x2696fc(++_0x4e1cdb);}(_0x72a2,0x161));var _0x272a=function(_0x15a9c4,_0x1c7203){_0x15a9c4=_0x15a9c4-0x0;var _0x478803=_0x72a2[_0x15a9c4];return _0x478803;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var moment=require(_0x272a('0x1'));var BPromise=require(_0x272a('0x2'));var rs=require(_0x272a('0x3'));var fs=require('fs');var Redis=require(_0x272a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x272a('0x5'));var logger=require('../../config/logger')(_0x272a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x272a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43d188,_0x220b90,_0x283070){return new BPromise(function(_0x54dbfb,_0x484f88){return client[_0x272a('0x8')](_0x43d188,_0x283070)['then'](function(_0x830fb6){logger['info'](_0x272a('0x9'),_0x220b90,_0x272a('0xa'));logger[_0x272a('0xb')](_0x272a('0xc'),_0x220b90,'request\x20sent',JSON['stringify'](_0x830fb6));if(_0x830fb6[_0x272a('0xd')]){if(_0x830fb6[_0x272a('0xd')]['code']===0x1f4){logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x484f88(_0x830fb6[_0x272a('0xd')]['message']);}logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x54dbfb(_0x830fb6['error'][_0x272a('0xe')]);}else{logger[_0x272a('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x220b90,'request\x20sent');_0x54dbfb(_0x830fb6['result']['message']);}})['catch'](function(_0x567955){logger[_0x272a('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x220b90,_0x567955);_0x484f88(_0x567955);});});} \ No newline at end of file +var _0x7aaf=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x9ee173,_0x53357b){_0x9ee173=_0x9ee173-0x0;var _0x3c33e3=_0x7aaf[_0x9ee173];return _0x3c33e3;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var moment=require(_0xf7aa('0x1'));var BPromise=require(_0xf7aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7aa('0x4'))('rpc');var config=require(_0xf7aa('0x5'));var jayson=require(_0xf7aa('0x6'));var client=jayson[_0xf7aa('0x7')][_0xf7aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47f259,_0x46d632,_0x5d0495){return new BPromise(function(_0x598c54,_0x16c0c7){return client[_0xf7aa('0x9')](_0x47f259,_0x5d0495)['then'](function(_0x581dd0){logger['info'](_0xf7aa('0xa'),_0x46d632,_0xf7aa('0xb'));logger[_0xf7aa('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x46d632,_0xf7aa('0xb'),JSON['stringify'](_0x581dd0));if(_0x581dd0['error']){if(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xe')]===0x1f4){logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);return _0x16c0c7(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);}logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x581dd0['error'][_0xf7aa('0xf')]);return _0x598c54(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);}else{logger[_0xf7aa('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x46d632,'request\x20sent');_0x598c54(_0x581dd0[_0xf7aa('0x11')]['message']);}})[_0xf7aa('0x12')](function(_0x15d263){logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x15d263);_0x16c0c7(_0x15d263);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 2d7548e..13d52a5 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 _0x4c8a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','post','single','file','create','put','update','delete','exports','multer','util'];(function(_0x512d62,_0xdff5e4){var _0x16011c=function(_0x483aa5){while(--_0x483aa5){_0x512d62['push'](_0x512d62['shift']());}};_0x16011c(++_0xdff5e4);}(_0x4c8a,0xf6));var _0xa4c8=function(_0x12fb0e,_0x6080ee){_0x12fb0e=_0x12fb0e-0x0;var _0x2f81a5=_0x4c8a[_0x12fb0e];return _0x2f81a5;};'use strict';var multer=require(_0xa4c8('0x0'));var util=require(_0xa4c8('0x1'));var path=require('path');var timeout=require(_0xa4c8('0x2'));var express=require('express');var router=express[_0xa4c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa4c8('0x4'));var interaction=require(_0xa4c8('0x5'));var config=require(_0xa4c8('0x6'));var controller=require(_0xa4c8('0x7'));router[_0xa4c8('0x8')]('/',auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xa')]);router['get'](_0xa4c8('0xb'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xc')]);router['get'](_0xa4c8('0xd'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xe')]);var upload=multer({'storage':multer[_0xa4c8('0xf')]({'destination':function(_0x217a64,_0x29485c,_0x2ada32){_0x2ada32(null,path[_0xa4c8('0x10')](config[_0xa4c8('0x11')],_0xa4c8('0x12')));},'filename':function(_0x220198,_0x174d23,_0x3281ee){_0x174d23[_0xa4c8('0x13')]=_0x174d23[_0xa4c8('0x13')][_0xa4c8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3281ee(null,util[_0xa4c8('0x15')](_0xa4c8('0x16'),path['basename'](_0x174d23['originalname'],path['extname'](_0x174d23[_0xa4c8('0x13')])),Date['now'](),path['extname'](_0x174d23[_0xa4c8('0x13')])));}})});router[_0xa4c8('0x17')]('/',upload[_0xa4c8('0x18')](_0xa4c8('0x19')),controller[_0xa4c8('0x1a')]);router[_0xa4c8('0x1b')](_0xa4c8('0xb'),auth['isAuthenticated'](),controller[_0xa4c8('0x1c')]);router[_0xa4c8('0x1d')](_0xa4c8('0xb'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0x1d')]);module[_0xa4c8('0x1e')]=router; \ No newline at end of file +var _0x9abb=['create','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9abb,0xf2));var _0xb9ab=function(_0x4e73a3,_0x4eb9ee){_0x4e73a3=_0x4e73a3-0x0;var _0x5d2f04=_0x9abb[_0x4e73a3];return _0x5d2f04;};'use strict';var multer=require(_0xb9ab('0x0'));var util=require(_0xb9ab('0x1'));var path=require(_0xb9ab('0x2'));var timeout=require(_0xb9ab('0x3'));var express=require(_0xb9ab('0x4'));var router=express[_0xb9ab('0x5')]();var fs_extra=require(_0xb9ab('0x6'));var auth=require(_0xb9ab('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb9ab('0x8'));var controller=require(_0xb9ab('0x9'));router[_0xb9ab('0xa')]('/',auth[_0xb9ab('0xb')](),controller[_0xb9ab('0xc')]);router['get'](_0xb9ab('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb9ab('0xa')](_0xb9ab('0xe'),auth[_0xb9ab('0xb')](),controller[_0xb9ab('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x151fb6,_0x51042b,_0x554920){_0x554920(null,path[_0xb9ab('0x10')](config[_0xb9ab('0x11')],_0xb9ab('0x12')));},'filename':function(_0x5b8232,_0x4559a8,_0x42a78b){_0x4559a8['originalname']=_0x4559a8[_0xb9ab('0x13')][_0xb9ab('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42a78b(null,util['format'](_0xb9ab('0x15'),path[_0xb9ab('0x16')](_0x4559a8[_0xb9ab('0x13')],path[_0xb9ab('0x17')](_0x4559a8[_0xb9ab('0x13')])),Date[_0xb9ab('0x18')](),path[_0xb9ab('0x17')](_0x4559a8[_0xb9ab('0x13')])));}})});router[_0xb9ab('0x19')]('/',upload[_0xb9ab('0x1a')](_0xb9ab('0x1b')),controller[_0xb9ab('0x1c')]);router['put'](_0xb9ab('0xd'),auth[_0xb9ab('0xb')](),controller['update']);router['delete'](_0xb9ab('0xd'),auth['isAuthenticated'](),controller[_0xb9ab('0x1d')]);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 c53b6c8..080c9bb 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 _0xbd50=['STRING','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x1a1ae8,_0x5e3a80){var _0x238356=function(_0x48b455){while(--_0x48b455){_0x1a1ae8['push'](_0x1a1ae8['shift']());}};_0x238356(++_0x5e3a80);}(_0xbd50,0x196));var _0x0bd5=function(_0x8e32e3,_0x44e6fc){_0x8e32e3=_0x8e32e3-0x0;var _0x3360b4=_0xbd50[_0x8e32e3];return _0x3360b4;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x0bd5('0x2')]},'display_name':{'type':Sequelize[_0x0bd5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x0bd5('0x2')]},'original_format':{'type':Sequelize[_0x0bd5('0x2')]},'original_duration':{'type':Sequelize[_0x0bd5('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x0bd5('0x4')]},'converted_format':{'type':Sequelize[_0x0bd5('0x2')]},'converted_duration':{'type':Sequelize[_0x0bd5('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x0bd5('0x5')]},'converted_channelCount':{'type':Sequelize[_0x0bd5('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x629f=['BIGINT','sequelize','exports','STRING','name','FLOAT','INTEGER'];(function(_0x47cc41,_0x11e552){var _0x580c72=function(_0x2af3a7){while(--_0x2af3a7){_0x47cc41['push'](_0x47cc41['shift']());}};_0x580c72(++_0x11e552);}(_0x629f,0x174));var _0xf629=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x629f[_0x4fd109];return _0x30f0a6;};'use strict';var Sequelize=require(_0xf629('0x0'));module[_0xf629('0x1')]={'name':{'type':Sequelize[_0xf629('0x2')],'unique':_0xf629('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf629('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf629('0x2')]},'original_format':{'type':Sequelize[_0xf629('0x2')]},'original_duration':{'type':Sequelize[_0xf629('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf629('0x5')]},'original_bitRate':{'type':Sequelize[_0xf629('0x6')]},'original_sampleRate':{'type':Sequelize[_0xf629('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xf629('0x6')]},'converted_channelCount':{'type':Sequelize[_0xf629('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf629('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xf629('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 41c14dc..10d9802 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 _0xfca3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','map','Sound','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','join','format','%s.%s','basename','file','extname','originalname','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','create','body','role','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','start','delete','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2e0661,_0x22ad87){var _0x2185d5=function(_0x58f56f){while(--_0x58f56f){_0x2e0661['push'](_0x2e0661['shift']());}};_0x2185d5(++_0x22ad87);}(_0xfca3,0x1d9));var _0x3fca=function(_0x24d7f4,_0x45020){_0x24d7f4=_0x24d7f4-0x0;var _0x162719=_0xfca3[_0x24d7f4];return _0x162719;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fca('0x0'));var zipdir=require(_0x3fca('0x1'));var jsonpatch=require(_0x3fca('0x2'));var rp=require(_0x3fca('0x3'));var moment=require(_0x3fca('0x4'));var BPromise=require(_0x3fca('0x5'));var Mustache=require(_0x3fca('0x6'));var util=require(_0x3fca('0x7'));var path=require(_0x3fca('0x8'));var sox=require('sox');var csv=require(_0x3fca('0x9'));var ejs=require(_0x3fca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fca('0xb'));var squel=require(_0x3fca('0xc'));var crypto=require(_0x3fca('0xd'));var jsforce=require(_0x3fca('0xe'));var deskjs=require(_0x3fca('0xf'));var toCsv=require(_0x3fca('0x9'));var querystring=require(_0x3fca('0x10'));var Papa=require(_0x3fca('0x11'));var Redis=require(_0x3fca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3fca('0x13'));var as=require(_0x3fca('0x14'));var hardwareService=require(_0x3fca('0x15'));var logger=require(_0x3fca('0x16'))(_0x3fca('0x17'));var utils=require(_0x3fca('0x18'));var config=require(_0x3fca('0x19'));var licenseUtil=require(_0x3fca('0x1a'));var db=require(_0x3fca('0x1b'))['db'];function respondWithStatusCode(_0x3f462b,_0x1a4ba7){_0x1a4ba7=_0x1a4ba7||0xcc;return function(_0x54572e){if(_0x54572e){return _0x3f462b[_0x3fca('0x1c')](_0x1a4ba7);}return _0x3f462b['status'](_0x1a4ba7)[_0x3fca('0x1d')]();};}function respondWithResult(_0x466ad5,_0x4c98dd){_0x4c98dd=_0x4c98dd||0xc8;return function(_0x11c8f9){if(_0x11c8f9){return _0x466ad5[_0x3fca('0x1e')](_0x4c98dd)[_0x3fca('0x1f')](_0x11c8f9);}};}function respondWithFilteredResult(_0x5a5ea7,_0x18a76d){return function(_0x33537c){if(_0x33537c){var _0x4c566b=typeof _0x18a76d['offset']===_0x3fca('0x20')&&typeof _0x18a76d[_0x3fca('0x21')]===_0x3fca('0x20');var _0x5954d5=_0x33537c[_0x3fca('0x22')];var _0x32b144=_0x4c566b?0x0:_0x18a76d[_0x3fca('0x23')];var _0x2a2422=_0x4c566b?_0x33537c[_0x3fca('0x22')]:_0x18a76d[_0x3fca('0x23')]+_0x18a76d['limit'];var _0x53e84f;if(_0x2a2422>=_0x5954d5){_0x2a2422=_0x5954d5;_0x53e84f=0xc8;}else{_0x53e84f=0xce;}_0x5a5ea7[_0x3fca('0x1e')](_0x53e84f);return _0x5a5ea7[_0x3fca('0x24')](_0x3fca('0x25'),_0x32b144+'-'+_0x2a2422+'/'+_0x5954d5)[_0x3fca('0x1f')](_0x33537c);}return null;};}function patchUpdates(_0x523620){return function(_0x313399){try{jsonpatch[_0x3fca('0x26')](_0x313399,_0x523620,!![]);}catch(_0x2e9b7a){return BPromise[_0x3fca('0x27')](_0x2e9b7a);}return _0x313399[_0x3fca('0x28')]();};}function saveUpdates(_0xb14152,_0xe277b1){return function(_0x30c50f){if(_0x30c50f){return _0x30c50f[_0x3fca('0x29')](_0xb14152)['then'](function(_0x7751cb){return _0x7751cb;});}return null;};}function removeEntity(_0x5e96b6,_0x21c433){return function(_0x2aa7fc){if(_0x2aa7fc){return _0x2aa7fc[_0x3fca('0x2a')]()[_0x3fca('0x2b')](function(){var _0x2d106d=_0x2aa7fc[_0x3fca('0x2c')]({'plain':!![]});var _0x516d1c='Sounds';return db['UserProfileResource'][_0x3fca('0x2a')]({'where':{'type':_0x516d1c,'resourceId':_0x2d106d['id']}})['then'](function(){return _0x2aa7fc;});})[_0x3fca('0x2b')](function(){_0x5e96b6[_0x3fca('0x1e')](0xcc)[_0x3fca('0x1d')]();});}};}function handleEntityNotFound(_0x494fa4,_0x5e3106){return function(_0x59ea47){if(!_0x59ea47){_0x494fa4[_0x3fca('0x1c')](0x194);}return _0x59ea47;};}function handleError(_0xb4c9cd,_0x5bdf3a){_0x5bdf3a=_0x5bdf3a||0x1f4;return function(_0x40c3a1){logger[_0x3fca('0x2d')](_0x40c3a1[_0x3fca('0x2e')]);if(_0x40c3a1[_0x3fca('0x2f')]){delete _0x40c3a1['name'];}_0xb4c9cd[_0x3fca('0x1e')](_0x5bdf3a)[_0x3fca('0x30')](_0x40c3a1);};}exports[_0x3fca('0x31')]=function(_0x1532c6,_0x5d1ce8){var _0x20220a={},_0x480d10={},_0x5e1878={'count':0x0,'rows':[]};var _0x4e3a02=_[_0x3fca('0x32')](db[_0x3fca('0x33')]['rawAttributes'],function(_0x2790c4){return{'name':_0x2790c4[_0x3fca('0x34')],'type':_0x2790c4[_0x3fca('0x35')][_0x3fca('0x36')]};});_0x480d10['model']=_[_0x3fca('0x32')](_0x4e3a02,_0x3fca('0x2f'));_0x480d10[_0x3fca('0x37')]=_[_0x3fca('0x38')](_0x1532c6[_0x3fca('0x37')]);_0x480d10[_0x3fca('0x39')]=_['intersection'](_0x480d10[_0x3fca('0x3a')],_0x480d10[_0x3fca('0x37')]);_0x20220a[_0x3fca('0x3b')]=_['intersection'](_0x480d10['model'],qs[_0x3fca('0x3c')](_0x1532c6['query'][_0x3fca('0x3c')]));_0x20220a[_0x3fca('0x3b')]=_0x20220a[_0x3fca('0x3b')]['length']?_0x20220a[_0x3fca('0x3b')]:_0x480d10['model'];if(!_0x1532c6[_0x3fca('0x37')][_0x3fca('0x3d')](_0x3fca('0x3e'))){_0x20220a[_0x3fca('0x21')]=qs[_0x3fca('0x21')](_0x1532c6[_0x3fca('0x37')]['limit']);_0x20220a[_0x3fca('0x23')]=qs[_0x3fca('0x23')](_0x1532c6['query'][_0x3fca('0x23')]);}_0x20220a[_0x3fca('0x3f')]=qs[_0x3fca('0x40')](_0x1532c6[_0x3fca('0x37')][_0x3fca('0x40')]);_0x20220a[_0x3fca('0x41')]=qs[_0x3fca('0x39')](_['pick'](_0x1532c6[_0x3fca('0x37')],_0x480d10[_0x3fca('0x39')]),_0x4e3a02);if(_0x1532c6[_0x3fca('0x37')][_0x3fca('0x42')]){_0x20220a['where']=_[_0x3fca('0x43')](_0x20220a[_0x3fca('0x41')],{'$or':_[_0x3fca('0x32')](_0x4e3a02,function(_0x227a39){if(_0x227a39[_0x3fca('0x35')]!==_0x3fca('0x44')){var _0x548d53={};_0x548d53[_0x227a39[_0x3fca('0x2f')]]={'$like':'%'+_0x1532c6[_0x3fca('0x37')][_0x3fca('0x42')]+'%'};return _0x548d53;}})});}_0x20220a=_[_0x3fca('0x43')]({},_0x20220a,_0x1532c6['options']);var _0x24208c={'where':_0x20220a['where']};return db[_0x3fca('0x33')][_0x3fca('0x22')](_0x24208c)[_0x3fca('0x2b')](function(_0x432d7){_0x5e1878[_0x3fca('0x22')]=_0x432d7;if(_0x1532c6[_0x3fca('0x37')][_0x3fca('0x45')]){_0x20220a[_0x3fca('0x46')]=[{'all':!![]}];}return db['Sound'][_0x3fca('0x47')](_0x20220a);})[_0x3fca('0x2b')](function(_0x1949cf){_0x5e1878[_0x3fca('0x48')]=_0x1949cf;return _0x5e1878;})['then'](respondWithFilteredResult(_0x5d1ce8,_0x20220a))[_0x3fca('0x49')](handleError(_0x5d1ce8,null));};exports[_0x3fca('0x4a')]=function(_0x3707ba,_0x8704fb){var _0x1a87b8={'raw':!![],'where':{'id':_0x3707ba[_0x3fca('0x4b')]['id']}},_0x3ad975={};_0x3ad975[_0x3fca('0x3a')]=_[_0x3fca('0x38')](db[_0x3fca('0x33')][_0x3fca('0x4c')]);_0x3ad975[_0x3fca('0x37')]=_[_0x3fca('0x38')](_0x3707ba[_0x3fca('0x37')]);_0x3ad975[_0x3fca('0x39')]=_[_0x3fca('0x4d')](_0x3ad975[_0x3fca('0x3a')],_0x3ad975[_0x3fca('0x37')]);_0x1a87b8[_0x3fca('0x3b')]=_[_0x3fca('0x4d')](_0x3ad975['model'],qs[_0x3fca('0x3c')](_0x3707ba[_0x3fca('0x37')][_0x3fca('0x3c')]));_0x1a87b8[_0x3fca('0x3b')]=_0x1a87b8[_0x3fca('0x3b')]['length']?_0x1a87b8['attributes']:_0x3ad975[_0x3fca('0x3a')];if(_0x3707ba[_0x3fca('0x37')][_0x3fca('0x45')]){_0x1a87b8[_0x3fca('0x46')]=[{'all':!![]}];}_0x1a87b8=_[_0x3fca('0x43')]({},_0x1a87b8,_0x3707ba[_0x3fca('0x4e')]);return db[_0x3fca('0x33')]['find'](_0x1a87b8)[_0x3fca('0x2b')](handleEntityNotFound(_0x8704fb,null))['then'](respondWithResult(_0x8704fb,null))['catch'](handleError(_0x8704fb,null));};exports[_0x3fca('0x4f')]=function(_0x10cff0,_0x1ae859,_0x1266d3){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x10cff0[_0x3fca('0x4b')]['id']},'attributes':[_0x3fca('0x2f'),_0x3fca('0x51'),_0x3fca('0x52')],'raw':!![]})[_0x3fca('0x2b')](handleEntityNotFound(_0x1ae859,null))[_0x3fca('0x2b')](function(_0x1c7b60){if(_0x1c7b60){if(!fs[_0x3fca('0x53')](path['join'](config[_0x3fca('0x54')],_0x3fca('0x55'),_0x1c7b60['save_name']+'.'+_0x1c7b60[_0x3fca('0x52')]))){throw new db['Sequelize'][(_0x3fca('0x56'))](_0x3fca('0x57'));}return _0x1ae859['download'](path[_0x3fca('0x58')](config['root'],'server/files/sounds/converted',util[_0x3fca('0x59')](_0x3fca('0x5a'),_0x1c7b60[_0x3fca('0x51')],_0x1c7b60['converted_format'])),util[_0x3fca('0x59')]('%s.%s',_0x1c7b60['name'],_0x1c7b60[_0x3fca('0x52')]));}return null;})[_0x3fca('0x49')](handleError(_0x1ae859,null));};exports['create']=function(_0x74493f,_0x173bff,_0x39defc){var _0x35c374={'name':path[_0x3fca('0x5b')](_0x74493f[_0x3fca('0x5c')]['originalname'],path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5e')])),'save_name':path[_0x3fca('0x5b')](_0x74493f['file'][_0x3fca('0x5f')],path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5f')])),'original_format':path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x7e5b25=path[_0x3fca('0x58')](config[_0x3fca('0x54')],_0x3fca('0x60'),_0x74493f['file'][_0x3fca('0x5f')]);var _0x13a526=path['join'](config[_0x3fca('0x54')],_0x3fca('0x55'),util['format']('%s.%s',path[_0x3fca('0x5b')](_0x74493f['file']['filename'],path['extname'](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5f')])),_0x35c374[_0x3fca('0x52')]));logger[_0x3fca('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x7e5b25);logger[_0x3fca('0x61')](_0x3fca('0x62'),_0x13a526);try{fs[_0x3fca('0x63')](_0x7e5b25,parseInt(_0x3fca('0x64'),0x8));var _0x3df0d5=sox['transcode'](_0x7e5b25,_0x13a526,{'sampleRate':0x1f40,'format':_0x3fca('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3df0d5['on']('error',function(_0x6e7400){fs['unlinkSync'](_0x7e5b25);_0x173bff['status'](0x1f4)['send'](_0x6e7400);});_0x3df0d5['on'](_0x3fca('0x66'),function(_0x39449c){_0x35c374[_0x3fca('0x67')]=isNaN(_0x39449c[_0x3fca('0x68')])?null:_0x39449c[_0x3fca('0x68')]*0x3e8;_0x35c374[_0x3fca('0x69')]=isNaN(_0x39449c[_0x3fca('0x6a')])?null:_0x39449c[_0x3fca('0x6a')];_0x35c374[_0x3fca('0x6b')]=isNaN(_0x39449c['channelCount'])?null:_0x39449c['channelCount'];_0x35c374[_0x3fca('0x6c')]=isNaN(_0x39449c[_0x3fca('0x6d')])?null:_0x39449c[_0x3fca('0x6d')];_0x35c374['original_sampleRate']=isNaN(_0x39449c[_0x3fca('0x6e')])?null:_0x39449c[_0x3fca('0x6e')];});_0x3df0d5['on'](_0x3fca('0x6f'),function(_0x3ecb0f){_0x35c374[_0x3fca('0x70')]=isNaN(_0x3ecb0f[_0x3fca('0x68')])?null:_0x3ecb0f[_0x3fca('0x68')]*0x3e8;_0x35c374[_0x3fca('0x71')]=isNaN(_0x3ecb0f[_0x3fca('0x6a')])?null:_0x3ecb0f[_0x3fca('0x6a')];_0x35c374['converted_channelCount']=isNaN(_0x3ecb0f['channelCount'])?null:_0x3ecb0f['channelCount'];_0x35c374[_0x3fca('0x72')]=isNaN(_0x3ecb0f[_0x3fca('0x6d')])?null:_0x3ecb0f[_0x3fca('0x6d')];_0x35c374['converted_sampleRate']=isNaN(_0x3ecb0f['sampleRate'])?null:_0x3ecb0f[_0x3fca('0x6e')];});_0x3df0d5['on']('end',function(){fs[_0x3fca('0x63')](_0x13a526,parseInt(_0x3fca('0x64'),0x8));return db[_0x3fca('0x33')][_0x3fca('0x73')](_0x35c374)[_0x3fca('0x2b')](function(_0x453d73){var _0x1e3ecb={'role':_0x74493f[_0x3fca('0x74')][_0x3fca('0x75')],'userProfileId':_0x74493f[_0x3fca('0x74')][_0x3fca('0x76')]};if(!_0x1e3ecb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e3ecb[_0x3fca('0x75')]==='user'){var _0x338078=_0x453d73[_0x3fca('0x2c')]({'plain':!![]});return db[_0x3fca('0x77')]['find']({'where':{'name':'Sounds','userProfileId':_0x1e3ecb['userProfileId']},'raw':!![]})[_0x3fca('0x2b')](function(_0xd63812){if(_0xd63812&&_0xd63812[_0x3fca('0x78')]===0x0){return db[_0x3fca('0x79')][_0x3fca('0x73')]({'name':_0x338078[_0x3fca('0x2f')],'resourceId':_0x338078['id'],'type':_0xd63812[_0x3fca('0x2f')],'sectionId':_0xd63812['id']},{})['then'](function(){return _0x453d73;});}else{return _0x453d73;}})[_0x3fca('0x49')](function(_0x23dc0c){logger[_0x3fca('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23dc0c);throw _0x23dc0c;});}return _0x453d73;})[_0x3fca('0x2b')](respondWithResult(_0x173bff,null))[_0x3fca('0x49')](handleError(_0x173bff,null));});_0x3df0d5[_0x3fca('0x7a')]();}catch(_0x3a37cb){_0x173bff[_0x3fca('0x1e')](0x1f4)[_0x3fca('0x30')](_0x3a37cb);}};exports[_0x3fca('0x29')]=function(_0x3e3cb6,_0x243081,_0x89504c){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x3e3cb6[_0x3fca('0x4b')]['id']}})[_0x3fca('0x2b')](handleEntityNotFound(_0x243081,null))[_0x3fca('0x2b')](saveUpdates(_['pick'](_0x3e3cb6[_0x3fca('0x74')],[_0x3fca('0x2f'),'description']),null))[_0x3fca('0x2b')](respondWithResult(_0x243081,null))[_0x3fca('0x49')](handleError(_0x243081,null));};exports[_0x3fca('0x7b')]=function(_0x5affde,_0x349c19,_0x1e09fc){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x5affde[_0x3fca('0x4b')]['id']}})['then'](function(_0x22fe32){if(_0x22fe32){return _0x22fe32[_0x3fca('0x2a')]();}})[_0x3fca('0x2b')](function(_0x2a78f9){var _0x2101ff=path[_0x3fca('0x58')](config[_0x3fca('0x54')],'server/files/sounds/original',util[_0x3fca('0x59')]('%s.%s',_0x2a78f9[_0x3fca('0x51')],_0x2a78f9['original_format']));var _0x4312fc=path[_0x3fca('0x58')](config[_0x3fca('0x54')],_0x3fca('0x55'),util[_0x3fca('0x59')](_0x3fca('0x5a'),_0x2a78f9[_0x3fca('0x51')],_0x2a78f9['converted_format']));fs['unlinkSync'](_0x2101ff);fs['unlinkSync'](_0x4312fc);return _0x2a78f9;})['then'](function(_0x22f598){if(_0x22f598){return _0x349c19[_0x3fca('0x1e')](0xcc)['end']();}})[_0x3fca('0x2b')](handleEntityNotFound(_0x349c19,null))[_0x3fca('0x49')](handleError(_0x349c19,null));}; \ No newline at end of file +var _0xf0e9=['name','send','index','map','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','Sound','rawAttributes','find','catch','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','request-promise','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0e9,0x1bc));var _0x9f0e=function(_0x4d9564,_0x217d84){_0x4d9564=_0x4d9564-0x0;var _0x3ab0b7=_0xf0e9[_0x4d9564];return _0x3ab0b7;};'use strict';var emlformat=require(_0x9f0e('0x0'));var rimraf=require(_0x9f0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9f0e('0x3'));var sox=require(_0x9f0e('0x4'));var csv=require('to-csv');var ejs=require(_0x9f0e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f0e('0x6'));var squel=require(_0x9f0e('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9f0e('0x8'));var toCsv=require(_0x9f0e('0x9'));var querystring=require(_0x9f0e('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f0e('0xb'));var as=require(_0x9f0e('0xc'));var hardwareService=require(_0x9f0e('0xd'));var logger=require(_0x9f0e('0xe'))('api');var utils=require(_0x9f0e('0xf'));var config=require(_0x9f0e('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260e55,_0x541862){_0x541862=_0x541862||0xcc;return function(_0x1295ac){if(_0x1295ac){return _0x260e55['sendStatus'](_0x541862);}return _0x260e55[_0x9f0e('0x11')](_0x541862)[_0x9f0e('0x12')]();};}function respondWithResult(_0x1bfbec,_0x3f8a83){_0x3f8a83=_0x3f8a83||0xc8;return function(_0x47e4ed){if(_0x47e4ed){return _0x1bfbec[_0x9f0e('0x11')](_0x3f8a83)[_0x9f0e('0x13')](_0x47e4ed);}};}function respondWithFilteredResult(_0x454831,_0x23cb7a){return function(_0x1ac619){if(_0x1ac619){var _0x36f3f5=typeof _0x23cb7a['offset']===_0x9f0e('0x14')&&typeof _0x23cb7a[_0x9f0e('0x15')]===_0x9f0e('0x14');var _0x5b1ad5=_0x1ac619[_0x9f0e('0x16')];var _0x24af33=_0x36f3f5?0x0:_0x23cb7a[_0x9f0e('0x17')];var _0x3c3008=_0x36f3f5?_0x1ac619[_0x9f0e('0x16')]:_0x23cb7a[_0x9f0e('0x17')]+_0x23cb7a[_0x9f0e('0x15')];var _0x48ec7f;if(_0x3c3008>=_0x5b1ad5){_0x3c3008=_0x5b1ad5;_0x48ec7f=0xc8;}else{_0x48ec7f=0xce;}_0x454831[_0x9f0e('0x11')](_0x48ec7f);return _0x454831['set'](_0x9f0e('0x18'),_0x24af33+'-'+_0x3c3008+'/'+_0x5b1ad5)[_0x9f0e('0x13')](_0x1ac619);}return null;};}function patchUpdates(_0x421ee4){return function(_0x2bf971){try{jsonpatch[_0x9f0e('0x19')](_0x2bf971,_0x421ee4,!![]);}catch(_0x1e8333){return BPromise[_0x9f0e('0x1a')](_0x1e8333);}return _0x2bf971[_0x9f0e('0x1b')]();};}function saveUpdates(_0x33e1a3,_0x7b07ac){return function(_0x4a32e2){if(_0x4a32e2){return _0x4a32e2[_0x9f0e('0x1c')](_0x33e1a3)['then'](function(_0x542fd8){return _0x542fd8;});}return null;};}function removeEntity(_0x495bf6,_0x379891){return function(_0x3ece03){if(_0x3ece03){return _0x3ece03[_0x9f0e('0x1d')]()['then'](function(){var _0x4ab7b2=_0x3ece03[_0x9f0e('0x1e')]({'plain':!![]});var _0x564871='Sounds';return db[_0x9f0e('0x1f')][_0x9f0e('0x1d')]({'where':{'type':_0x564871,'resourceId':_0x4ab7b2['id']}})[_0x9f0e('0x20')](function(){return _0x3ece03;});})[_0x9f0e('0x20')](function(){_0x495bf6[_0x9f0e('0x11')](0xcc)[_0x9f0e('0x12')]();});}};}function handleEntityNotFound(_0x2563ca,_0x46aefc){return function(_0x1d9e82){if(!_0x1d9e82){_0x2563ca[_0x9f0e('0x21')](0x194);}return _0x1d9e82;};}function handleError(_0x2e734d,_0x130ed9){_0x130ed9=_0x130ed9||0x1f4;return function(_0x21dcf1){logger[_0x9f0e('0x22')](_0x21dcf1[_0x9f0e('0x23')]);if(_0x21dcf1[_0x9f0e('0x24')]){delete _0x21dcf1['name'];}_0x2e734d['status'](_0x130ed9)[_0x9f0e('0x25')](_0x21dcf1);};}exports[_0x9f0e('0x26')]=function(_0x351316,_0x36b672){var _0x4d81d1={},_0x3e873c={},_0x438e49={'count':0x0,'rows':[]};var _0x3d35b7=_[_0x9f0e('0x27')](db['Sound']['rawAttributes'],function(_0x4057b7){return{'name':_0x4057b7['fieldName'],'type':_0x4057b7['type'][_0x9f0e('0x28')]};});_0x3e873c[_0x9f0e('0x29')]=_['map'](_0x3d35b7,_0x9f0e('0x24'));_0x3e873c['query']=_[_0x9f0e('0x2a')](_0x351316['query']);_0x3e873c[_0x9f0e('0x2b')]=_[_0x9f0e('0x2c')](_0x3e873c['model'],_0x3e873c[_0x9f0e('0x2d')]);_0x4d81d1[_0x9f0e('0x2e')]=_['intersection'](_0x3e873c['model'],qs['fields'](_0x351316['query'][_0x9f0e('0x2f')]));_0x4d81d1[_0x9f0e('0x2e')]=_0x4d81d1[_0x9f0e('0x2e')][_0x9f0e('0x30')]?_0x4d81d1[_0x9f0e('0x2e')]:_0x3e873c[_0x9f0e('0x29')];if(!_0x351316[_0x9f0e('0x2d')]['hasOwnProperty'](_0x9f0e('0x31'))){_0x4d81d1['limit']=qs[_0x9f0e('0x15')](_0x351316[_0x9f0e('0x2d')][_0x9f0e('0x15')]);_0x4d81d1[_0x9f0e('0x17')]=qs[_0x9f0e('0x17')](_0x351316[_0x9f0e('0x2d')][_0x9f0e('0x17')]);}_0x4d81d1['order']=qs[_0x9f0e('0x32')](_0x351316[_0x9f0e('0x2d')][_0x9f0e('0x32')]);_0x4d81d1[_0x9f0e('0x33')]=qs['filters'](_[_0x9f0e('0x34')](_0x351316['query'],_0x3e873c['filters']),_0x3d35b7);if(_0x351316[_0x9f0e('0x2d')]['filter']){_0x4d81d1[_0x9f0e('0x33')]=_['merge'](_0x4d81d1['where'],{'$or':_[_0x9f0e('0x27')](_0x3d35b7,function(_0x20b4a8){if(_0x20b4a8[_0x9f0e('0x35')]!==_0x9f0e('0x36')){var _0x484fa5={};_0x484fa5[_0x20b4a8[_0x9f0e('0x24')]]={'$like':'%'+_0x351316['query'][_0x9f0e('0x37')]+'%'};return _0x484fa5;}})});}_0x4d81d1=_[_0x9f0e('0x38')]({},_0x4d81d1,_0x351316['options']);var _0x515b44={'where':_0x4d81d1[_0x9f0e('0x33')]};return db['Sound']['count'](_0x515b44)['then'](function(_0x40323b){_0x438e49[_0x9f0e('0x16')]=_0x40323b;if(_0x351316[_0x9f0e('0x2d')][_0x9f0e('0x39')]){_0x4d81d1[_0x9f0e('0x3a')]=[{'all':!![]}];}return db['Sound'][_0x9f0e('0x3b')](_0x4d81d1);})[_0x9f0e('0x20')](function(_0x1ecc27){_0x438e49[_0x9f0e('0x3c')]=_0x1ecc27;return _0x438e49;})[_0x9f0e('0x20')](respondWithFilteredResult(_0x36b672,_0x4d81d1))['catch'](handleError(_0x36b672,null));};exports[_0x9f0e('0x3d')]=function(_0x1f9e36,_0x131933){var _0x3fefeb={'raw':!![],'where':{'id':_0x1f9e36[_0x9f0e('0x3e')]['id']}},_0x174f07={};_0x174f07['model']=_[_0x9f0e('0x2a')](db[_0x9f0e('0x3f')][_0x9f0e('0x40')]);_0x174f07[_0x9f0e('0x2d')]=_[_0x9f0e('0x2a')](_0x1f9e36[_0x9f0e('0x2d')]);_0x174f07[_0x9f0e('0x2b')]=_[_0x9f0e('0x2c')](_0x174f07[_0x9f0e('0x29')],_0x174f07[_0x9f0e('0x2d')]);_0x3fefeb[_0x9f0e('0x2e')]=_[_0x9f0e('0x2c')](_0x174f07[_0x9f0e('0x29')],qs['fields'](_0x1f9e36[_0x9f0e('0x2d')][_0x9f0e('0x2f')]));_0x3fefeb[_0x9f0e('0x2e')]=_0x3fefeb[_0x9f0e('0x2e')][_0x9f0e('0x30')]?_0x3fefeb['attributes']:_0x174f07[_0x9f0e('0x29')];if(_0x1f9e36[_0x9f0e('0x2d')]['includeAll']){_0x3fefeb[_0x9f0e('0x3a')]=[{'all':!![]}];}_0x3fefeb=_['merge']({},_0x3fefeb,_0x1f9e36['options']);return db[_0x9f0e('0x3f')][_0x9f0e('0x41')](_0x3fefeb)[_0x9f0e('0x20')](handleEntityNotFound(_0x131933,null))[_0x9f0e('0x20')](respondWithResult(_0x131933,null))[_0x9f0e('0x42')](handleError(_0x131933,null));};exports[_0x9f0e('0x43')]=function(_0x1b0fda,_0x26a97d,_0x3ac385){return db[_0x9f0e('0x3f')][_0x9f0e('0x41')]({'where':{'id':_0x1b0fda[_0x9f0e('0x3e')]['id']},'attributes':[_0x9f0e('0x24'),'save_name',_0x9f0e('0x44')],'raw':!![]})[_0x9f0e('0x20')](handleEntityNotFound(_0x26a97d,null))[_0x9f0e('0x20')](function(_0x45383a){if(_0x45383a){if(!fs[_0x9f0e('0x45')](path[_0x9f0e('0x46')](config[_0x9f0e('0x47')],_0x9f0e('0x48'),_0x45383a['save_name']+'.'+_0x45383a[_0x9f0e('0x44')]))){throw new db[(_0x9f0e('0x49'))][(_0x9f0e('0x4a'))](_0x9f0e('0x4b'));}return _0x26a97d[_0x9f0e('0x43')](path[_0x9f0e('0x46')](config[_0x9f0e('0x47')],_0x9f0e('0x48'),util[_0x9f0e('0x4c')](_0x9f0e('0x4d'),_0x45383a[_0x9f0e('0x4e')],_0x45383a[_0x9f0e('0x44')])),util[_0x9f0e('0x4c')](_0x9f0e('0x4d'),_0x45383a['name'],_0x45383a[_0x9f0e('0x44')]));}return null;})[_0x9f0e('0x42')](handleError(_0x26a97d,null));};exports[_0x9f0e('0x4f')]=function(_0x29b324,_0x2dd907,_0x10dbce){var _0x3f43dd={'name':path[_0x9f0e('0x50')](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x52')],path[_0x9f0e('0x53')](_0x29b324[_0x9f0e('0x51')]['originalname'])),'save_name':path['basename'](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x54')],path['extname'](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x54')])),'original_format':path['extname'](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x52')])[_0x9f0e('0x55')](0x1),'converted_format':_0x9f0e('0x56')};var _0x2fb57f=path['join'](config[_0x9f0e('0x47')],_0x9f0e('0x57'),_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x54')]);var _0x3d1e24=path['join'](config[_0x9f0e('0x47')],_0x9f0e('0x48'),util[_0x9f0e('0x4c')](_0x9f0e('0x4d'),path[_0x9f0e('0x50')](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x54')],path[_0x9f0e('0x53')](_0x29b324[_0x9f0e('0x51')][_0x9f0e('0x54')])),_0x3f43dd[_0x9f0e('0x44')]));logger[_0x9f0e('0x58')](_0x9f0e('0x59'),_0x2fb57f);logger[_0x9f0e('0x58')](_0x9f0e('0x5a'),_0x3d1e24);try{fs[_0x9f0e('0x5b')](_0x2fb57f,parseInt('0777',0x8));var _0x52e7e7=sox[_0x9f0e('0x5c')](_0x2fb57f,_0x3d1e24,{'sampleRate':0x1f40,'format':_0x9f0e('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52e7e7['on'](_0x9f0e('0x22'),function(_0x354c14){fs[_0x9f0e('0x5d')](_0x2fb57f);_0x2dd907['status'](0x1f4)[_0x9f0e('0x25')](_0x354c14);});_0x52e7e7['on'](_0x9f0e('0x5e'),function(_0x4e9df9){_0x3f43dd[_0x9f0e('0x5f')]=isNaN(_0x4e9df9['duration'])?null:_0x4e9df9[_0x9f0e('0x60')]*0x3e8;_0x3f43dd[_0x9f0e('0x61')]=isNaN(_0x4e9df9[_0x9f0e('0x62')])?null:_0x4e9df9['sampleCount'];_0x3f43dd['original_channelCount']=isNaN(_0x4e9df9[_0x9f0e('0x63')])?null:_0x4e9df9[_0x9f0e('0x63')];_0x3f43dd[_0x9f0e('0x64')]=isNaN(_0x4e9df9['bitRate'])?null:_0x4e9df9['bitRate'];_0x3f43dd[_0x9f0e('0x65')]=isNaN(_0x4e9df9['sampleRate'])?null:_0x4e9df9[_0x9f0e('0x66')];});_0x52e7e7['on']('dest',function(_0x494265){_0x3f43dd[_0x9f0e('0x67')]=isNaN(_0x494265['duration'])?null:_0x494265['duration']*0x3e8;_0x3f43dd[_0x9f0e('0x68')]=isNaN(_0x494265['sampleCount'])?null:_0x494265[_0x9f0e('0x62')];_0x3f43dd[_0x9f0e('0x69')]=isNaN(_0x494265[_0x9f0e('0x63')])?null:_0x494265[_0x9f0e('0x63')];_0x3f43dd[_0x9f0e('0x6a')]=isNaN(_0x494265[_0x9f0e('0x6b')])?null:_0x494265['bitRate'];_0x3f43dd[_0x9f0e('0x6c')]=isNaN(_0x494265['sampleRate'])?null:_0x494265[_0x9f0e('0x66')];});_0x52e7e7['on']('end',function(){fs['chmodSync'](_0x3d1e24,parseInt('0777',0x8));return db[_0x9f0e('0x3f')][_0x9f0e('0x4f')](_0x3f43dd)[_0x9f0e('0x20')](function(_0x305085){var _0x1fc6d7={'role':_0x29b324[_0x9f0e('0x6d')][_0x9f0e('0x6e')],'userProfileId':_0x29b324[_0x9f0e('0x6d')]['userProfileId']};if(!_0x1fc6d7)throw new Error(_0x9f0e('0x6f'));if(_0x1fc6d7['role']===_0x9f0e('0x70')){var _0x1f3d17=_0x305085['get']({'plain':!![]});return db[_0x9f0e('0x71')][_0x9f0e('0x41')]({'where':{'name':_0x9f0e('0x72'),'userProfileId':_0x1fc6d7[_0x9f0e('0x73')]},'raw':!![]})['then'](function(_0x48b5bb){if(_0x48b5bb&&_0x48b5bb['autoAssociation']===0x0){return db['UserProfileResource'][_0x9f0e('0x4f')]({'name':_0x1f3d17[_0x9f0e('0x24')],'resourceId':_0x1f3d17['id'],'type':_0x48b5bb[_0x9f0e('0x24')],'sectionId':_0x48b5bb['id']},{})[_0x9f0e('0x20')](function(){return _0x305085;});}else{return _0x305085;}})['catch'](function(_0x4a6511){logger[_0x9f0e('0x22')](_0x9f0e('0x74'),_0x4a6511);throw _0x4a6511;});}return _0x305085;})['then'](respondWithResult(_0x2dd907,null))[_0x9f0e('0x42')](handleError(_0x2dd907,null));});_0x52e7e7[_0x9f0e('0x75')]();}catch(_0x33eafb){_0x2dd907['status'](0x1f4)['send'](_0x33eafb);}};exports[_0x9f0e('0x1c')]=function(_0x31dfdd,_0x46be71,_0x5b98a4){return db[_0x9f0e('0x3f')][_0x9f0e('0x41')]({'where':{'id':_0x31dfdd[_0x9f0e('0x3e')]['id']}})[_0x9f0e('0x20')](handleEntityNotFound(_0x46be71,null))['then'](saveUpdates(_[_0x9f0e('0x34')](_0x31dfdd['body'],[_0x9f0e('0x24'),_0x9f0e('0x76')]),null))[_0x9f0e('0x20')](respondWithResult(_0x46be71,null))[_0x9f0e('0x42')](handleError(_0x46be71,null));};exports['delete']=function(_0x4f4c82,_0x207455,_0x163c59){return db[_0x9f0e('0x3f')][_0x9f0e('0x41')]({'where':{'id':_0x4f4c82[_0x9f0e('0x3e')]['id']}})[_0x9f0e('0x20')](function(_0x274329){if(_0x274329){return _0x274329[_0x9f0e('0x1d')]();}})['then'](function(_0xfb04d){var _0x5c4e19=path[_0x9f0e('0x46')](config[_0x9f0e('0x47')],_0x9f0e('0x57'),util['format']('%s.%s',_0xfb04d['save_name'],_0xfb04d[_0x9f0e('0x77')]));var _0x5ddf48=path[_0x9f0e('0x46')](config['root'],_0x9f0e('0x48'),util[_0x9f0e('0x4c')]('%s.%s',_0xfb04d[_0x9f0e('0x4e')],_0xfb04d[_0x9f0e('0x44')]));fs[_0x9f0e('0x5d')](_0x5c4e19);fs[_0x9f0e('0x5d')](_0x5ddf48);return _0xfb04d;})['then'](function(_0x22d959){if(_0x22d959){return _0x207455['status'](0xcc)[_0x9f0e('0x12')]();}})[_0x9f0e('0x20')](handleEntityNotFound(_0x207455,null))[_0x9f0e('0x42')](handleError(_0x207455,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 161769f..76ce30c 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 _0xac12=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds'];(function(_0x1754db,_0x3e32f7){var _0x273e77=function(_0x2c71c3){while(--_0x2c71c3){_0x1754db['push'](_0x1754db['shift']());}};_0x273e77(++_0x3e32f7);}(_0xac12,0x1e4));var _0x2ac1=function(_0x4b6c5b,_0xb10bc6){_0x4b6c5b=_0x4b6c5b-0x0;var _0x5465ac=_0xac12[_0x4b6c5b];return _0x5465ac;};'use strict';var _=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var logger=require(_0x2ac1('0x2'))(_0x2ac1('0x3'));var moment=require(_0x2ac1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ac1('0x5'));var config=require(_0x2ac1('0x6'));var attributes=require(_0x2ac1('0x7'));module['exports']=function(_0x21eaa5,_0x5434f1){return _0x21eaa5[_0x2ac1('0x8')](_0x2ac1('0x9'),attributes,{'tableName':_0x2ac1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6647=['path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4c7384,_0x560464){var _0x21bc07=function(_0x1afa23){while(--_0x1afa23){_0x4c7384['push'](_0x4c7384['shift']());}};_0x21bc07(++_0x560464);}(_0x6647,0x132));var _0x7664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6647[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7664('0x0'));var util=require(_0x7664('0x1'));var logger=require('../../config/logger')(_0x7664('0x2'));var moment=require(_0x7664('0x3'));var BPromise=require(_0x7664('0x4'));var rp=require(_0x7664('0x5'));var fs=require('fs');var path=require(_0x7664('0x6'));var rimraf=require(_0x7664('0x7'));var config=require(_0x7664('0x8'));var attributes=require(_0x7664('0x9'));module['exports']=function(_0x59d111,_0x15c2fa){return _0x59d111[_0x7664('0xa')](_0x7664('0xb'),attributes,{'tableName':_0x7664('0xc'),'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 aa61d18..1ec953f 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 _0xdfd3=['ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','info','result','catch','Sound','find','options','where','attributes','include','map','model'];(function(_0x30879a,_0xba2c5b){var _0x50ca1c=function(_0x1bf77a){while(--_0x1bf77a){_0x30879a['push'](_0x30879a['shift']());}};_0x50ca1c(++_0xba2c5b);}(_0xdfd3,0xa1));var _0x3dfd=function(_0x187193,_0x24e49d){_0x187193=_0x187193-0x0;var _0x5002aa=_0xdfd3[_0x187193];return _0x5002aa;};'use strict';var _=require(_0x3dfd('0x0'));var util=require('util');var moment=require(_0x3dfd('0x1'));var BPromise=require(_0x3dfd('0x2'));var rs=require(_0x3dfd('0x3'));var fs=require('fs');var Redis=require(_0x3dfd('0x4'));var db=require(_0x3dfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dfd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dfd('0x7'));var client=jayson[_0x3dfd('0x8')][_0x3dfd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ea38f,_0x183acd,_0x24ba67){return new BPromise(function(_0x4f8944,_0x412c23){return client[_0x3dfd('0xa')](_0x3ea38f,_0x24ba67)[_0x3dfd('0xb')](function(_0x182bfe){logger['info']('Sound,\x20%s,\x20%s',_0x183acd,_0x3dfd('0xc'));logger[_0x3dfd('0xd')](_0x3dfd('0xe'),_0x183acd,_0x3dfd('0xc'),JSON[_0x3dfd('0xf')](_0x182bfe));if(_0x182bfe[_0x3dfd('0x10')]){if(_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x11')]===0x1f4){logger[_0x3dfd('0x10')]('Sound,\x20%s,\x20%s',_0x183acd,_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x12')]);return _0x412c23(_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x12')]);}logger[_0x3dfd('0x10')](_0x3dfd('0x13'),_0x183acd,_0x182bfe['error']['message']);return _0x4f8944(_0x182bfe[_0x3dfd('0x10')]['message']);}else{logger[_0x3dfd('0x14')]('Sound,\x20%s,\x20%s',_0x183acd,'request\x20sent');_0x4f8944(_0x182bfe[_0x3dfd('0x15')][_0x3dfd('0x12')]);}})[_0x3dfd('0x16')](function(_0xf91b44){logger['error'](_0x3dfd('0x13'),_0x183acd,_0xf91b44);_0x412c23(_0xf91b44);});});}exports['ShowSound']=function(_0x3eeeeb){var _0x3836d8=this;return new Promise(function(_0x335ec1,_0x434b0b){return db[_0x3dfd('0x17')][_0x3dfd('0x18')]({'raw':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1a')]||null:null,'attributes':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1b')]||null:null,'include':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1c')]?_[_0x3dfd('0x1d')](_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1c')],function(_0x57e262){return{'model':db[_0x57e262[_0x3dfd('0x1e')]],'as':_0x57e262['as'],'attributes':_0x57e262['attributes'],'include':_0x57e262[_0x3dfd('0x1c')]?_['map'](_0x57e262[_0x3dfd('0x1c')],function(_0x3beb9b){return{'model':db[_0x3beb9b[_0x3dfd('0x1e')]],'as':_0x3beb9b['as'],'attributes':_0x3beb9b[_0x3dfd('0x1b')],'include':_0x3beb9b[_0x3dfd('0x1c')]?_[_0x3dfd('0x1d')](_0x3beb9b['include'],function(_0x5742fc){return{'model':db[_0x5742fc[_0x3dfd('0x1e')]],'as':_0x5742fc['as'],'attributes':_0x5742fc[_0x3dfd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3dfd('0xb')](function(_0x5078f5){logger[_0x3dfd('0x14')](_0x3dfd('0x1f'),_0x3eeeeb);logger[_0x3dfd('0xd')](_0x3dfd('0x1f'),_0x3eeeeb,JSON['stringify'](_0x5078f5));_0x335ec1(_0x5078f5);})[_0x3dfd('0x16')](function(_0xc102f){logger[_0x3dfd('0x10')](_0x3dfd('0x1f'),_0xc102f['message'],_0x3eeeeb);_0x434b0b(_0x3836d8[_0x3dfd('0x10')](0x1f4,_0xc102f[_0x3dfd('0x12')]));});});}; \ No newline at end of file +var _0x6e01=['map','model','attributes','include','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ShowSound','options','raw','where'];(function(_0xe1751e,_0x533941){var _0x406cda=function(_0x5ed9c5){while(--_0x5ed9c5){_0xe1751e['push'](_0xe1751e['shift']());}};_0x406cda(++_0x533941);}(_0x6e01,0x1b6));var _0x16e0=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x6e01[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require('lodash');var util=require(_0x16e0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16e0('0x1'));var fs=require('fs');var Redis=require(_0x16e0('0x2'));var db=require(_0x16e0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x16e0('0x4'))(_0x16e0('0x5'));var config=require(_0x16e0('0x6'));var jayson=require(_0x16e0('0x7'));var client=jayson[_0x16e0('0x8')][_0x16e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29e7cb,_0x3d7f0a,_0x16cafa){return new BPromise(function(_0x42d7e2,_0x497fbc){return client[_0x16e0('0xa')](_0x29e7cb,_0x16cafa)[_0x16e0('0xb')](function(_0x42ff72){logger[_0x16e0('0xc')](_0x16e0('0xd'),_0x3d7f0a,'request\x20sent');logger[_0x16e0('0xe')](_0x16e0('0xf'),_0x3d7f0a,'request\x20sent',JSON[_0x16e0('0x10')](_0x42ff72));if(_0x42ff72[_0x16e0('0x11')]){if(_0x42ff72[_0x16e0('0x11')][_0x16e0('0x12')]===0x1f4){logger['error'](_0x16e0('0xd'),_0x3d7f0a,_0x42ff72[_0x16e0('0x11')]['message']);return _0x497fbc(_0x42ff72['error']['message']);}logger[_0x16e0('0x11')](_0x16e0('0xd'),_0x3d7f0a,_0x42ff72[_0x16e0('0x11')]['message']);return _0x42d7e2(_0x42ff72[_0x16e0('0x11')][_0x16e0('0x13')]);}else{logger[_0x16e0('0xc')](_0x16e0('0xd'),_0x3d7f0a,_0x16e0('0x14'));_0x42d7e2(_0x42ff72[_0x16e0('0x15')][_0x16e0('0x13')]);}})[_0x16e0('0x16')](function(_0x508a2d){logger['error']('Sound,\x20%s,\x20%s',_0x3d7f0a,_0x508a2d);_0x497fbc(_0x508a2d);});});}exports[_0x16e0('0x17')]=function(_0x53972b){var _0x21d23e=this;return new Promise(function(_0x58fc7c,_0x266552){return db['Sound']['find']({'raw':_0x53972b[_0x16e0('0x18')]?_0x53972b['options'][_0x16e0('0x19')]===undefined?!![]:![]:!![],'where':_0x53972b[_0x16e0('0x18')]?_0x53972b['options'][_0x16e0('0x1a')]||null:null,'attributes':_0x53972b[_0x16e0('0x18')]?_0x53972b[_0x16e0('0x18')]['attributes']||null:null,'include':_0x53972b['options']?_0x53972b['options']['include']?_[_0x16e0('0x1b')](_0x53972b[_0x16e0('0x18')]['include'],function(_0x3db196){return{'model':db[_0x3db196[_0x16e0('0x1c')]],'as':_0x3db196['as'],'attributes':_0x3db196[_0x16e0('0x1d')],'include':_0x3db196[_0x16e0('0x1e')]?_['map'](_0x3db196[_0x16e0('0x1e')],function(_0x1508f4){return{'model':db[_0x1508f4[_0x16e0('0x1c')]],'as':_0x1508f4['as'],'attributes':_0x1508f4[_0x16e0('0x1d')],'include':_0x1508f4[_0x16e0('0x1e')]?_['map'](_0x1508f4[_0x16e0('0x1e')],function(_0x40f5e7){return{'model':db[_0x40f5e7['model']],'as':_0x40f5e7['as'],'attributes':_0x40f5e7['attributes']};}):[]};}):[]};}):[]:[]})[_0x16e0('0xb')](function(_0x2523af){logger['info'](_0x16e0('0x17'),_0x53972b);logger[_0x16e0('0xe')](_0x16e0('0x17'),_0x53972b,JSON[_0x16e0('0x10')](_0x2523af));_0x58fc7c(_0x2523af);})[_0x16e0('0x16')](function(_0x10d37d){logger[_0x16e0('0x11')](_0x16e0('0x17'),_0x10d37d[_0x16e0('0x13')],_0x53972b);_0x266552(_0x21d23e[_0x16e0('0x11')](0x1f4,_0x10d37d[_0x16e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 19c67c2..4e3f250 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x1aac1d,_0x1dca6c){var _0x140f0d=function(_0x3e4db4){while(--_0x3e4db4){_0x1aac1d['push'](_0x1aac1d['shift']());}};_0x140f0d(++_0x1dca6c);}(_0xda3f,0xec));var _0xfda3=function(_0x583abd,_0x552d21){_0x583abd=_0x583abd-0x0;var _0x4c046b=_0xda3f[_0x583abd];return _0x4c046b;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x485115,_0x17c38e){_0x485115=_0x485115-0x0;var _0x1a7203=_0x9ffd[_0x485115];return _0x1a7203;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 871ed0f..735ccd9 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 _0x97e5=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0x97e5,0xbf));var _0x597e=function(_0x9673ef,_0x587cd0){_0x9673ef=_0x9673ef-0x0;var _0x3f24a9=_0x97e5[_0x9673ef];return _0x3f24a9;};'use strict';var Sequelize=require(_0x597e('0x0'));module[_0x597e('0x1')]={'uniqueid':{'type':Sequelize[_0x597e('0x2')]},'body':{'type':Sequelize[_0x597e('0x3')](_0x597e('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x597e('0x5')]('in',_0x597e('0x6')),'defaultValue':_0x597e('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x597e('0x2')]},'providerResponse':{'type':Sequelize[_0x597e('0x3')]}}; \ No newline at end of file +var _0x2d2c=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x5178dd,_0x271885){var _0xf30055=function(_0x175c45){while(--_0x175c45){_0x5178dd['push'](_0x5178dd['shift']());}};_0xf30055(++_0x271885);}(_0x2d2c,0x79));var _0xc2d2=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x2d2c[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0xc2d2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc2d2('0x1')]},'body':{'type':Sequelize[_0xc2d2('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xc2d2('0x3')]('in',_0xc2d2('0x4')),'defaultValue':_0xc2d2('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc2d2('0x1')]},'providerResponse':{'type':Sequelize[_0xc2d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 279832a..5187097 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 _0x3cd0=['eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','name','send','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x16a2bc,_0x1d4c4e){var _0x5af146=function(_0x55c6b8){while(--_0x55c6b8){_0x16a2bc['push'](_0x16a2bc['shift']());}};_0x5af146(++_0x1d4c4e);}(_0x3cd0,0x8a));var _0x03cd=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x3cd0[_0x4bcf38];return _0x4a89be;};'use strict';var emlformat=require(_0x03cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03cd('0x1'));var rp=require('request-promise');var moment=require(_0x03cd('0x2'));var BPromise=require(_0x03cd('0x3'));var Mustache=require(_0x03cd('0x4'));var util=require(_0x03cd('0x5'));var path=require(_0x03cd('0x6'));var sox=require('sox');var csv=require(_0x03cd('0x7'));var ejs=require(_0x03cd('0x8'));var fs=require('fs');var fs_extra=require(_0x03cd('0x9'));var _=require(_0x03cd('0xa'));var squel=require(_0x03cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x03cd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03cd('0x7'));var querystring=require(_0x03cd('0xd'));var Papa=require(_0x03cd('0xe'));var Redis=require(_0x03cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x03cd('0x10'));var as=require(_0x03cd('0x11'));var hardwareService=require(_0x03cd('0x12'));var logger=require(_0x03cd('0x13'))(_0x03cd('0x14'));var utils=require(_0x03cd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03cd('0x16'))['db'];function respondWithStatusCode(_0x315a6c,_0xaa6a21){_0xaa6a21=_0xaa6a21||0xcc;return function(_0x1d88e6){if(_0x1d88e6){return _0x315a6c['sendStatus'](_0xaa6a21);}return _0x315a6c[_0x03cd('0x17')](_0xaa6a21)[_0x03cd('0x18')]();};}function respondWithResult(_0x5d0c1c,_0x4f8f17){_0x4f8f17=_0x4f8f17||0xc8;return function(_0x58c000){if(_0x58c000){return _0x5d0c1c[_0x03cd('0x17')](_0x4f8f17)[_0x03cd('0x19')](_0x58c000);}};}function respondWithFilteredResult(_0x17961d,_0x77b1bf){return function(_0x526102){if(_0x526102){var _0xdf7488=typeof _0x77b1bf[_0x03cd('0x1a')]===_0x03cd('0x1b')&&typeof _0x77b1bf[_0x03cd('0x1c')]===_0x03cd('0x1b');var _0x5ac997=_0x526102[_0x03cd('0x1d')];var _0x27de4f=_0xdf7488?0x0:_0x77b1bf[_0x03cd('0x1a')];var _0x12b3ea=_0xdf7488?_0x526102[_0x03cd('0x1d')]:_0x77b1bf['offset']+_0x77b1bf[_0x03cd('0x1c')];var _0xa1122b;if(_0x12b3ea>=_0x5ac997){_0x12b3ea=_0x5ac997;_0xa1122b=0xc8;}else{_0xa1122b=0xce;}_0x17961d[_0x03cd('0x17')](_0xa1122b);return _0x17961d[_0x03cd('0x1e')]('Content-Range',_0x27de4f+'-'+_0x12b3ea+'/'+_0x5ac997)[_0x03cd('0x19')](_0x526102);}return null;};}function patchUpdates(_0x4d0a58){return function(_0x1d51fa){try{jsonpatch[_0x03cd('0x1f')](_0x1d51fa,_0x4d0a58,!![]);}catch(_0x85ac1b){return BPromise['reject'](_0x85ac1b);}return _0x1d51fa['save']();};}function saveUpdates(_0x255c96,_0x19ad78){return function(_0x4e8ff6){if(_0x4e8ff6){return _0x4e8ff6[_0x03cd('0x20')](_0x255c96)[_0x03cd('0x21')](function(_0x56ec2b){return _0x56ec2b;});}return null;};}function removeEntity(_0x440df7,_0x514c11){return function(_0x4f1b33){if(_0x4f1b33){return _0x4f1b33[_0x03cd('0x22')]()[_0x03cd('0x21')](function(){_0x440df7[_0x03cd('0x17')](0xcc)[_0x03cd('0x18')]();});}};}function handleEntityNotFound(_0x5173e9,_0x2f32df){return function(_0x4d64a6){if(!_0x4d64a6){_0x5173e9['sendStatus'](0x194);}return _0x4d64a6;};}function handleError(_0x245154,_0x491b16){_0x491b16=_0x491b16||0x1f4;return function(_0x3203b1){logger['error'](_0x3203b1['stack']);if(_0x3203b1[_0x03cd('0x23')]){delete _0x3203b1['name'];}_0x245154[_0x03cd('0x17')](_0x491b16)[_0x03cd('0x24')](_0x3203b1);};}exports['index']=function(_0x13242a,_0x38117e){var _0xb5eb0={},_0x12ec99={},_0x1d3309={'count':0x0,'rows':[]};var _0x49693c=_[_0x03cd('0x25')](db[_0x03cd('0x26')][_0x03cd('0x27')],function(_0x1e8827){return{'name':_0x1e8827['fieldName'],'type':_0x1e8827[_0x03cd('0x28')][_0x03cd('0x29')]};});_0x12ec99[_0x03cd('0x2a')]=_[_0x03cd('0x25')](_0x49693c,_0x03cd('0x23'));_0x12ec99[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0x13242a[_0x03cd('0x2b')]);_0x12ec99[_0x03cd('0x2d')]=_[_0x03cd('0x2e')](_0x12ec99[_0x03cd('0x2a')],_0x12ec99[_0x03cd('0x2b')]);_0xb5eb0[_0x03cd('0x2f')]=_['intersection'](_0x12ec99['model'],qs[_0x03cd('0x30')](_0x13242a['query'][_0x03cd('0x30')]));_0xb5eb0[_0x03cd('0x2f')]=_0xb5eb0['attributes']['length']?_0xb5eb0[_0x03cd('0x2f')]:_0x12ec99[_0x03cd('0x2a')];if(!_0x13242a[_0x03cd('0x2b')][_0x03cd('0x31')]('nolimit')){_0xb5eb0[_0x03cd('0x1c')]=qs[_0x03cd('0x1c')](_0x13242a[_0x03cd('0x2b')][_0x03cd('0x1c')]);_0xb5eb0[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x13242a['query'][_0x03cd('0x1a')]);}_0xb5eb0[_0x03cd('0x32')]=qs[_0x03cd('0x33')](_0x13242a['query'][_0x03cd('0x33')]);_0xb5eb0[_0x03cd('0x34')]=qs[_0x03cd('0x2d')](_[_0x03cd('0x35')](_0x13242a[_0x03cd('0x2b')],_0x12ec99[_0x03cd('0x2d')]),_0x49693c);if(_0x13242a[_0x03cd('0x2b')]['filter']){_0xb5eb0[_0x03cd('0x34')]=_[_0x03cd('0x36')](_0xb5eb0['where'],{'$or':_[_0x03cd('0x25')](_0x49693c,function(_0x43c266){if(_0x43c266[_0x03cd('0x28')]!==_0x03cd('0x37')){var _0x4f54f5={};_0x4f54f5[_0x43c266[_0x03cd('0x23')]]={'$like':'%'+_0x13242a[_0x03cd('0x2b')][_0x03cd('0x38')]+'%'};return _0x4f54f5;}})});}_0xb5eb0=_[_0x03cd('0x36')]({},_0xb5eb0,_0x13242a[_0x03cd('0x39')]);var _0x3be9c2={'where':_0xb5eb0[_0x03cd('0x34')]};return db[_0x03cd('0x26')]['count'](_0x3be9c2)['then'](function(_0x7a788e){_0x1d3309[_0x03cd('0x1d')]=_0x7a788e;if(_0x13242a[_0x03cd('0x2b')][_0x03cd('0x3a')]){_0xb5eb0[_0x03cd('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x03cd('0x3c')](_0xb5eb0);})[_0x03cd('0x21')](function(_0x473e2f){_0x1d3309[_0x03cd('0x3d')]=_0x473e2f;return _0x1d3309;})[_0x03cd('0x21')](respondWithFilteredResult(_0x38117e,_0xb5eb0))[_0x03cd('0x3e')](handleError(_0x38117e,null));};exports[_0x03cd('0x3f')]=function(_0xb07f50,_0x36eb53){var _0x28e481={'raw':!![],'where':{'id':_0xb07f50[_0x03cd('0x40')]['id']}},_0x59de59={};_0x59de59[_0x03cd('0x2a')]=_[_0x03cd('0x2c')](db[_0x03cd('0x26')][_0x03cd('0x27')]);_0x59de59[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0xb07f50['query']);_0x59de59['filters']=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],_0x59de59[_0x03cd('0x2b')]);_0x28e481[_0x03cd('0x2f')]=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],qs[_0x03cd('0x30')](_0xb07f50['query'][_0x03cd('0x30')]));_0x28e481[_0x03cd('0x2f')]=_0x28e481[_0x03cd('0x2f')][_0x03cd('0x41')]?_0x28e481[_0x03cd('0x2f')]:_0x59de59[_0x03cd('0x2a')];if(_0xb07f50['query']['includeAll']){_0x28e481['include']=[{'all':!![]}];}_0x28e481=_['merge']({},_0x28e481,_0xb07f50[_0x03cd('0x39')]);return db[_0x03cd('0x26')][_0x03cd('0x42')](_0x28e481)[_0x03cd('0x21')](handleEntityNotFound(_0x36eb53,null))[_0x03cd('0x21')](respondWithResult(_0x36eb53,null))[_0x03cd('0x3e')](handleError(_0x36eb53,null));};exports[_0x03cd('0x43')]=function(_0x318d87,_0x51f648){return db['SquareMessage'][_0x03cd('0x43')](_0x318d87[_0x03cd('0x44')],{})['then'](respondWithResult(_0x51f648,0xc9))['catch'](handleError(_0x51f648,null));};exports['update']=function(_0xbb7b57,_0x2e10c4){if(_0xbb7b57['body']['id']){delete _0xbb7b57[_0x03cd('0x44')]['id'];}return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0xbb7b57['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x2e10c4,null))[_0x03cd('0x21')](saveUpdates(_0xbb7b57[_0x03cd('0x44')],null))[_0x03cd('0x21')](respondWithResult(_0x2e10c4,null))[_0x03cd('0x3e')](handleError(_0x2e10c4,null));};exports['destroy']=function(_0x27107b,_0x18d4fc){return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0x27107b[_0x03cd('0x40')]['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x18d4fc,null))[_0x03cd('0x21')](removeEntity(_0x18d4fc,null))['catch'](handleError(_0x18d4fc,null));}; \ No newline at end of file +var _0xfbbb=['end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x27fbd2,_0x474f19){var _0x30afcc=function(_0x2b67df){while(--_0x2b67df){_0x27fbd2['push'](_0x27fbd2['shift']());}};_0x30afcc(++_0x474f19);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x37bb9b,_0x31f22f){_0x37bb9b=_0x37bb9b-0x0;var _0x32dfc2=_0xfbbb[_0x37bb9b];return _0x32dfc2;};'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(_0xbfbb('0x4'));var moment=require(_0xbfbb('0x5'));var BPromise=require(_0xbfbb('0x6'));var Mustache=require(_0xbfbb('0x7'));var util=require(_0xbfbb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbfbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfbb('0xa'));var _=require(_0xbfbb('0xb'));var squel=require(_0xbfbb('0xc'));var crypto=require('crypto');var jsforce=require(_0xbfbb('0xd'));var deskjs=require(_0xbfbb('0xe'));var toCsv=require(_0xbfbb('0x9'));var querystring=require(_0xbfbb('0xf'));var Papa=require(_0xbfbb('0x10'));var Redis=require(_0xbfbb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfbb('0x12'));var as=require(_0xbfbb('0x13'));var hardwareService=require(_0xbfbb('0x14'));var logger=require(_0xbfbb('0x15'))('api');var utils=require(_0xbfbb('0x16'));var config=require(_0xbfbb('0x17'));var licenseUtil=require(_0xbfbb('0x18'));var db=require(_0xbfbb('0x19'))['db'];function respondWithStatusCode(_0x45ef3b,_0x294ffd){_0x294ffd=_0x294ffd||0xcc;return function(_0x30ff2d){if(_0x30ff2d){return _0x45ef3b[_0xbfbb('0x1a')](_0x294ffd);}return _0x45ef3b['status'](_0x294ffd)[_0xbfbb('0x1b')]();};}function respondWithResult(_0x3fbd10,_0x271139){_0x271139=_0x271139||0xc8;return function(_0x23cba2){if(_0x23cba2){return _0x3fbd10[_0xbfbb('0x1c')](_0x271139)['json'](_0x23cba2);}};}function respondWithFilteredResult(_0x28db60,_0x3e046e){return function(_0x3db1d6){if(_0x3db1d6){var _0xe0e3aa=typeof _0x3e046e[_0xbfbb('0x1d')]===_0xbfbb('0x1e')&&typeof _0x3e046e[_0xbfbb('0x1f')]==='undefined';var _0x4fdd6d=_0x3db1d6[_0xbfbb('0x20')];var _0x4be5df=_0xe0e3aa?0x0:_0x3e046e[_0xbfbb('0x1d')];var _0x4834a9=_0xe0e3aa?_0x3db1d6[_0xbfbb('0x20')]:_0x3e046e[_0xbfbb('0x1d')]+_0x3e046e[_0xbfbb('0x1f')];var _0xa911a8;if(_0x4834a9>=_0x4fdd6d){_0x4834a9=_0x4fdd6d;_0xa911a8=0xc8;}else{_0xa911a8=0xce;}_0x28db60[_0xbfbb('0x1c')](_0xa911a8);return _0x28db60['set'](_0xbfbb('0x21'),_0x4be5df+'-'+_0x4834a9+'/'+_0x4fdd6d)['json'](_0x3db1d6);}return null;};}function patchUpdates(_0x26c69f){return function(_0x44c544){try{jsonpatch[_0xbfbb('0x22')](_0x44c544,_0x26c69f,!![]);}catch(_0x10b77c){return BPromise[_0xbfbb('0x23')](_0x10b77c);}return _0x44c544[_0xbfbb('0x24')]();};}function saveUpdates(_0x150325,_0x1c9943){return function(_0x4fe886){if(_0x4fe886){return _0x4fe886[_0xbfbb('0x25')](_0x150325)[_0xbfbb('0x26')](function(_0x5e0cbb){return _0x5e0cbb;});}return null;};}function removeEntity(_0x22e3ec,_0x15e362){return function(_0x44bf61){if(_0x44bf61){return _0x44bf61[_0xbfbb('0x27')]()['then'](function(){_0x22e3ec[_0xbfbb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151342,_0x34e580){return function(_0x400efb){if(!_0x400efb){_0x151342[_0xbfbb('0x1a')](0x194);}return _0x400efb;};}function handleError(_0x438461,_0xde6c41){_0xde6c41=_0xde6c41||0x1f4;return function(_0x190640){logger[_0xbfbb('0x28')](_0x190640[_0xbfbb('0x29')]);if(_0x190640[_0xbfbb('0x2a')]){delete _0x190640[_0xbfbb('0x2a')];}_0x438461[_0xbfbb('0x1c')](_0xde6c41)[_0xbfbb('0x2b')](_0x190640);};}exports[_0xbfbb('0x2c')]=function(_0x5c9295,_0x21a72a){var _0xdcd56={},_0x21f507={},_0x256778={'count':0x0,'rows':[]};var _0x4a5c3b=_[_0xbfbb('0x2d')](db[_0xbfbb('0x2e')][_0xbfbb('0x2f')],function(_0x4ff37e){return{'name':_0x4ff37e[_0xbfbb('0x30')],'type':_0x4ff37e[_0xbfbb('0x31')][_0xbfbb('0x32')]};});_0x21f507[_0xbfbb('0x33')]=_[_0xbfbb('0x2d')](_0x4a5c3b,_0xbfbb('0x2a'));_0x21f507[_0xbfbb('0x34')]=_[_0xbfbb('0x35')](_0x5c9295[_0xbfbb('0x34')]);_0x21f507['filters']=_['intersection'](_0x21f507[_0xbfbb('0x33')],_0x21f507[_0xbfbb('0x34')]);_0xdcd56[_0xbfbb('0x36')]=_['intersection'](_0x21f507[_0xbfbb('0x33')],qs[_0xbfbb('0x37')](_0x5c9295[_0xbfbb('0x34')][_0xbfbb('0x37')]));_0xdcd56['attributes']=_0xdcd56[_0xbfbb('0x36')][_0xbfbb('0x38')]?_0xdcd56['attributes']:_0x21f507[_0xbfbb('0x33')];if(!_0x5c9295[_0xbfbb('0x34')][_0xbfbb('0x39')]('nolimit')){_0xdcd56['limit']=qs[_0xbfbb('0x1f')](_0x5c9295[_0xbfbb('0x34')]['limit']);_0xdcd56[_0xbfbb('0x1d')]=qs[_0xbfbb('0x1d')](_0x5c9295['query'][_0xbfbb('0x1d')]);}_0xdcd56['order']=qs[_0xbfbb('0x3a')](_0x5c9295['query'][_0xbfbb('0x3a')]);_0xdcd56['where']=qs[_0xbfbb('0x3b')](_[_0xbfbb('0x3c')](_0x5c9295[_0xbfbb('0x34')],_0x21f507[_0xbfbb('0x3b')]),_0x4a5c3b);if(_0x5c9295[_0xbfbb('0x34')][_0xbfbb('0x3d')]){_0xdcd56['where']=_[_0xbfbb('0x3e')](_0xdcd56[_0xbfbb('0x3f')],{'$or':_[_0xbfbb('0x2d')](_0x4a5c3b,function(_0x3e21fd){if(_0x3e21fd[_0xbfbb('0x31')]!==_0xbfbb('0x40')){var _0x40185e={};_0x40185e[_0x3e21fd[_0xbfbb('0x2a')]]={'$like':'%'+_0x5c9295[_0xbfbb('0x34')][_0xbfbb('0x3d')]+'%'};return _0x40185e;}})});}_0xdcd56=_[_0xbfbb('0x3e')]({},_0xdcd56,_0x5c9295[_0xbfbb('0x41')]);var _0x3ae881={'where':_0xdcd56[_0xbfbb('0x3f')]};return db[_0xbfbb('0x2e')][_0xbfbb('0x20')](_0x3ae881)[_0xbfbb('0x26')](function(_0x2cd18f){_0x256778[_0xbfbb('0x20')]=_0x2cd18f;if(_0x5c9295['query']['includeAll']){_0xdcd56[_0xbfbb('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0xbfbb('0x43')](_0xdcd56);})[_0xbfbb('0x26')](function(_0x325105){_0x256778[_0xbfbb('0x44')]=_0x325105;return _0x256778;})[_0xbfbb('0x26')](respondWithFilteredResult(_0x21a72a,_0xdcd56))[_0xbfbb('0x45')](handleError(_0x21a72a,null));};exports[_0xbfbb('0x46')]=function(_0x22cc19,_0x292b04){var _0x341e2f={'raw':!![],'where':{'id':_0x22cc19[_0xbfbb('0x47')]['id']}},_0x2d8690={};_0x2d8690[_0xbfbb('0x33')]=_['keys'](db[_0xbfbb('0x2e')][_0xbfbb('0x2f')]);_0x2d8690[_0xbfbb('0x34')]=_['keys'](_0x22cc19[_0xbfbb('0x34')]);_0x2d8690[_0xbfbb('0x3b')]=_[_0xbfbb('0x48')](_0x2d8690[_0xbfbb('0x33')],_0x2d8690[_0xbfbb('0x34')]);_0x341e2f[_0xbfbb('0x36')]=_[_0xbfbb('0x48')](_0x2d8690[_0xbfbb('0x33')],qs['fields'](_0x22cc19[_0xbfbb('0x34')][_0xbfbb('0x37')]));_0x341e2f[_0xbfbb('0x36')]=_0x341e2f['attributes'][_0xbfbb('0x38')]?_0x341e2f['attributes']:_0x2d8690['model'];if(_0x22cc19['query'][_0xbfbb('0x49')]){_0x341e2f[_0xbfbb('0x42')]=[{'all':!![]}];}_0x341e2f=_[_0xbfbb('0x3e')]({},_0x341e2f,_0x22cc19[_0xbfbb('0x41')]);return db[_0xbfbb('0x2e')][_0xbfbb('0x4a')](_0x341e2f)['then'](handleEntityNotFound(_0x292b04,null))[_0xbfbb('0x26')](respondWithResult(_0x292b04,null))['catch'](handleError(_0x292b04,null));};exports[_0xbfbb('0x4b')]=function(_0x2ec6be,_0x214a07){return db[_0xbfbb('0x2e')][_0xbfbb('0x4b')](_0x2ec6be[_0xbfbb('0x4c')],{})[_0xbfbb('0x26')](respondWithResult(_0x214a07,0xc9))[_0xbfbb('0x45')](handleError(_0x214a07,null));};exports[_0xbfbb('0x25')]=function(_0x342f9d,_0x45aac7){if(_0x342f9d[_0xbfbb('0x4c')]['id']){delete _0x342f9d[_0xbfbb('0x4c')]['id'];}return db[_0xbfbb('0x2e')][_0xbfbb('0x4a')]({'where':{'id':_0x342f9d[_0xbfbb('0x47')]['id']}})[_0xbfbb('0x26')](handleEntityNotFound(_0x45aac7,null))[_0xbfbb('0x26')](saveUpdates(_0x342f9d[_0xbfbb('0x4c')],null))['then'](respondWithResult(_0x45aac7,null))[_0xbfbb('0x45')](handleError(_0x45aac7,null));};exports[_0xbfbb('0x27')]=function(_0x3b80d1,_0x126f22){return db[_0xbfbb('0x2e')]['find']({'where':{'id':_0x3b80d1[_0xbfbb('0x47')]['id']}})['then'](handleEntityNotFound(_0x126f22,null))[_0xbfbb('0x26')](removeEntity(_0x126f22,null))[_0xbfbb('0x45')](handleError(_0x126f22,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 78d7cfb..4a58d1f 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 _0x1af3=['bluebird','request-promise','../../config/environment','./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger','api'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x1af3,0xd8));var _0x31af=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x1af3[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var logger=require(_0x31af('0x2'))(_0x31af('0x3'));var moment=require('moment');var BPromise=require(_0x31af('0x4'));var rp=require(_0x31af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31af('0x6'));var attributes=require(_0x31af('0x7'));module['exports']=function(_0x4a4d97,_0x300018){return _0x4a4d97[_0x31af('0x8')]('SquareMessage',attributes,{'tableName':_0x31af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5d=['exports','square_messages','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./squareMessage.attributes'];(function(_0x3be988,_0x5e92d8){var _0x4d194a=function(_0x3827b3){while(--_0x3827b3){_0x3be988['push'](_0x3be988['shift']());}};_0x4d194a(++_0x5e92d8);}(_0xee5d,0x156));var _0xdee5=function(_0x48ded4,_0x91886a){_0x48ded4=_0x48ded4-0x0;var _0x4a906a=_0xee5d[_0x48ded4];return _0x4a906a;};'use strict';var _=require(_0xdee5('0x0'));var util=require(_0xdee5('0x1'));var logger=require(_0xdee5('0x2'))(_0xdee5('0x3'));var moment=require('moment');var BPromise=require(_0xdee5('0x4'));var rp=require(_0xdee5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdee5('0x6'));var config=require('../../config/environment');var attributes=require(_0xdee5('0x7'));module[_0xdee5('0x8')]=function(_0x57efb9,_0x1085f4){return _0x57efb9['define']('SquareMessage',attributes,{'tableName':_0xdee5('0x9'),'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 9be277b..bb24549 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 _0x8224=['create','body','options','raw','debug','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x302576,_0x3c76d2){var _0x16e985=function(_0x579607){while(--_0x579607){_0x302576['push'](_0x302576['shift']());}};_0x16e985(++_0x3c76d2);}(_0x8224,0x164));var _0x4822=function(_0x1b870e,_0x1038ef){_0x1b870e=_0x1b870e-0x0;var _0x392dfc=_0x8224[_0x1b870e];return _0x392dfc;};'use strict';var _=require('lodash');var util=require(_0x4822('0x0'));var moment=require('moment');var BPromise=require(_0x4822('0x1'));var rs=require(_0x4822('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4822('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4822('0x4'))(_0x4822('0x5'));var config=require(_0x4822('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4822('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d6075,_0x49d2f,_0x3822de){return new BPromise(function(_0x5be4dd,_0x31edf3){return client[_0x4822('0x8')](_0x3d6075,_0x3822de)[_0x4822('0x9')](function(_0x812d5f){logger['info'](_0x4822('0xa'),_0x49d2f,'request\x20sent');logger['debug'](_0x4822('0xb'),_0x49d2f,_0x4822('0xc'),JSON[_0x4822('0xd')](_0x812d5f));if(_0x812d5f[_0x4822('0xe')]){if(_0x812d5f[_0x4822('0xe')][_0x4822('0xf')]===0x1f4){logger[_0x4822('0xe')]('SquareMessage,\x20%s,\x20%s',_0x49d2f,_0x812d5f[_0x4822('0xe')]['message']);return _0x31edf3(_0x812d5f['error'][_0x4822('0x10')]);}logger['error'](_0x4822('0xa'),_0x49d2f,_0x812d5f[_0x4822('0xe')]['message']);return _0x5be4dd(_0x812d5f[_0x4822('0xe')][_0x4822('0x10')]);}else{logger[_0x4822('0x11')](_0x4822('0xa'),_0x49d2f,_0x4822('0xc'));_0x5be4dd(_0x812d5f[_0x4822('0x12')][_0x4822('0x10')]);}})[_0x4822('0x13')](function(_0x40b2eb){logger['error'](_0x4822('0xa'),_0x49d2f,_0x40b2eb);_0x31edf3(_0x40b2eb);});});}exports[_0x4822('0x14')]=function(_0x504aed){var _0xfea72e=this;return new Promise(function(_0x3d1e79,_0x41521f){return db[_0x4822('0x15')][_0x4822('0x16')](_0x504aed[_0x4822('0x17')],{'raw':_0x504aed[_0x4822('0x18')]?_0x504aed[_0x4822('0x18')][_0x4822('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32029){logger['info'](_0x4822('0x14'),_0x504aed);logger[_0x4822('0x1a')](_0x4822('0x14'),_0x504aed,JSON['stringify'](_0x32029));_0x3d1e79(_0x32029);})['catch'](function(_0x48b0a3){logger[_0x4822('0xe')](_0x4822('0x14'),_0x48b0a3[_0x4822('0x10')],_0x504aed);_0x41521f(_0xfea72e[_0x4822('0xe')](0x1f4,_0x48b0a3['message']));});});}; \ No newline at end of file +var _0xce8a=['message','SquareMessage,\x20%s,\x20%s','info','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5b2096,_0x213141){var _0x198357=function(_0x5afe77){while(--_0x5afe77){_0x5b2096['push'](_0x5b2096['shift']());}};_0x198357(++_0x213141);}(_0xce8a,0xc7));var _0xace8=function(_0x2e379a,_0x50032f){_0x2e379a=_0x2e379a-0x0;var _0x4f0d90=_0xce8a[_0x2e379a];return _0x4f0d90;};'use strict';var _=require('lodash');var util=require(_0xace8('0x0'));var moment=require(_0xace8('0x1'));var BPromise=require(_0xace8('0x2'));var rs=require(_0xace8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xace8('0x4'))['db'];var utils=require(_0xace8('0x5'));var logger=require(_0xace8('0x6'))(_0xace8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xace8('0x8')][_0xace8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ac259,_0x3d9ee3,_0xbdabd8){return new BPromise(function(_0x120af4,_0x253030){return client[_0xace8('0xa')](_0x3ac259,_0xbdabd8)[_0xace8('0xb')](function(_0x88cf7b){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3d9ee3,'request\x20sent');logger[_0xace8('0xc')](_0xace8('0xd'),_0x3d9ee3,_0xace8('0xe'),JSON[_0xace8('0xf')](_0x88cf7b));if(_0x88cf7b[_0xace8('0x10')]){if(_0x88cf7b['error']['code']===0x1f4){logger[_0xace8('0x10')]('SquareMessage,\x20%s,\x20%s',_0x3d9ee3,_0x88cf7b[_0xace8('0x10')][_0xace8('0x11')]);return _0x253030(_0x88cf7b[_0xace8('0x10')][_0xace8('0x11')]);}logger[_0xace8('0x10')](_0xace8('0x12'),_0x3d9ee3,_0x88cf7b[_0xace8('0x10')][_0xace8('0x11')]);return _0x120af4(_0x88cf7b[_0xace8('0x10')][_0xace8('0x11')]);}else{logger[_0xace8('0x13')](_0xace8('0x12'),_0x3d9ee3,_0xace8('0xe'));_0x120af4(_0x88cf7b[_0xace8('0x14')]['message']);}})[_0xace8('0x15')](function(_0x87a2ab){logger[_0xace8('0x10')]('SquareMessage,\x20%s,\x20%s',_0x3d9ee3,_0x87a2ab);_0x253030(_0x87a2ab);});});}exports[_0xace8('0x16')]=function(_0x33a05b){var _0x4723bf=this;return new Promise(function(_0x8e5348,_0xace4b5){return db[_0xace8('0x17')][_0xace8('0x18')](_0x33a05b['body'],{'raw':_0x33a05b[_0xace8('0x19')]?_0x33a05b[_0xace8('0x19')][_0xace8('0x1a')]===undefined?!![]:![]:!![]})[_0xace8('0xb')](function(_0xd5f703){logger['info'](_0xace8('0x16'),_0x33a05b);logger[_0xace8('0xc')](_0xace8('0x16'),_0x33a05b,JSON['stringify'](_0xd5f703));_0x8e5348(_0xd5f703);})['catch'](function(_0x54469e){logger[_0xace8('0x10')](_0xace8('0x16'),_0x54469e[_0xace8('0x11')],_0x33a05b);_0xace4b5(_0x4723bf[_0xace8('0x10')](0x1f4,_0x54469e[_0xace8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f2b1a76..d941c07 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 _0xa89e=['show','15s','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x2fa5e9,_0x23ff57){var _0x4f78db=function(_0x17cf56){while(--_0x17cf56){_0x2fa5e9['push'](_0x2fa5e9['shift']());}};_0x4f78db(++_0x23ff57);}(_0xa89e,0x15d));var _0xea89=function(_0x2150cb,_0x4f0a46){_0x2150cb=_0x2150cb-0x0;var _0x2ed67=_0xa89e[_0x2150cb];return _0x2ed67;};'use strict';var multer=require('multer');var util=require(_0xea89('0x0'));var path=require(_0xea89('0x1'));var timeout=require(_0xea89('0x2'));var express=require(_0xea89('0x3'));var router=express['Router']();var fs_extra=require(_0xea89('0x4'));var auth=require(_0xea89('0x5'));var interaction=require(_0xea89('0x6'));var config=require('../../config/environment');var controller=require(_0xea89('0x7'));router[_0xea89('0x8')]('/',auth[_0xea89('0x9')](),controller[_0xea89('0xa')]);router[_0xea89('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xea89('0xb')]);router[_0xea89('0x8')]('/:id/test',auth[_0xea89('0x9')](),timeout(_0xea89('0xc')),controller['test']);router[_0xea89('0xd')]('/',auth['isAuthenticated'](),controller[_0xea89('0xe')]);router[_0xea89('0xf')]('/:id',auth[_0xea89('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xea89('0x10')]);module[_0xea89('0x11')]=router; \ No newline at end of file +var _0xd304=['get','index','/:id','isAuthenticated','show','/:id/test','15s','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./squareOdbc.controller'];(function(_0x5dcbf0,_0x101d9d){var _0xcf87aa=function(_0xe3a5eb){while(--_0xe3a5eb){_0x5dcbf0['push'](_0x5dcbf0['shift']());}};_0xcf87aa(++_0x101d9d);}(_0xd304,0x1e7));var _0x4d30=function(_0x356ff5,_0x21d00c){_0x356ff5=_0x356ff5-0x0;var _0x406ab8=_0xd304[_0x356ff5];return _0x406ab8;};'use strict';var multer=require(_0x4d30('0x0'));var util=require(_0x4d30('0x1'));var path=require('path');var timeout=require(_0x4d30('0x2'));var express=require(_0x4d30('0x3'));var router=express['Router']();var fs_extra=require(_0x4d30('0x4'));var auth=require(_0x4d30('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d30('0x6'));router[_0x4d30('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d30('0x8')]);router[_0x4d30('0x7')](_0x4d30('0x9'),auth[_0x4d30('0xa')](),controller[_0x4d30('0xb')]);router[_0x4d30('0x7')](_0x4d30('0xc'),auth[_0x4d30('0xa')](),timeout(_0x4d30('0xd')),controller['test']);router['post']('/',auth[_0x4d30('0xa')](),controller[_0x4d30('0xe')]);router[_0x4d30('0xf')](_0x4d30('0x9'),auth['isAuthenticated'](),controller[_0x4d30('0x10')]);router[_0x4d30('0x11')](_0x4d30('0x9'),auth[_0x4d30('0xa')](),controller[_0x4d30('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 486d213..1ef8372 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 _0x50a1=['sequelize'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x50a1,0x163));var _0x150a=function(_0x28092d,_0x8263ab){_0x28092d=_0x28092d-0x0;var _0x53b2e1=_0x50a1[_0x28092d];return _0x53b2e1;};'use strict';var Sequelize=require(_0x150a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf5c3=['sequelize','exports','STRING','name'];(function(_0x2483f2,_0x5291b2){var _0x2416bb=function(_0x10fa12){while(--_0x10fa12){_0x2483f2['push'](_0x2483f2['shift']());}};_0x2416bb(++_0x5291b2);}(_0xf5c3,0x1a4));var _0x3f5c=function(_0x2765e5,_0x547f82){_0x2765e5=_0x2765e5-0x0;var _0x2cf113=_0xf5c3[_0x2765e5];return _0x2cf113;};'use strict';var Sequelize=require(_0x3f5c('0x0'));module[_0x3f5c('0x1')]={'name':{'type':Sequelize[_0x3f5c('0x2')],'unique':_0x3f5c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1e9f754..42f6f5f 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 _0xc1c5=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','length','options','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','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','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter'];(function(_0x4e54e9,_0x40a2b7){var _0x32be8f=function(_0x5d91b3){while(--_0x5d91b3){_0x4e54e9['push'](_0x4e54e9['shift']());}};_0x32be8f(++_0x40a2b7);}(_0xc1c5,0x125));var _0x5c1c=function(_0x165d8,_0x4a2b9c){_0x165d8=_0x165d8-0x0;var _0x1c831a=_0xc1c5[_0x165d8];return _0x1c831a;};'use strict';var emlformat=require(_0x5c1c('0x0'));var rimraf=require(_0x5c1c('0x1'));var zipdir=require(_0x5c1c('0x2'));var jsonpatch=require(_0x5c1c('0x3'));var rp=require(_0x5c1c('0x4'));var moment=require(_0x5c1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c1c('0x6'));var util=require(_0x5c1c('0x7'));var path=require('path');var sox=require(_0x5c1c('0x8'));var csv=require(_0x5c1c('0x9'));var ejs=require(_0x5c1c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c1c('0xb'));var _=require(_0x5c1c('0xc'));var squel=require(_0x5c1c('0xd'));var crypto=require(_0x5c1c('0xe'));var jsforce=require(_0x5c1c('0xf'));var deskjs=require(_0x5c1c('0x10'));var toCsv=require(_0x5c1c('0x9'));var querystring=require(_0x5c1c('0x11'));var Papa=require(_0x5c1c('0x12'));var Redis=require('ioredis');var authService=require(_0x5c1c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c1c('0x14'));var logger=require(_0x5c1c('0x15'))(_0x5c1c('0x16'));var utils=require(_0x5c1c('0x17'));var config=require(_0x5c1c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c1c('0x19'))['db'];function respondWithStatusCode(_0x5e4768,_0x45ba36){_0x45ba36=_0x45ba36||0xcc;return function(_0x3df6d1){if(_0x3df6d1){return _0x5e4768[_0x5c1c('0x1a')](_0x45ba36);}return _0x5e4768[_0x5c1c('0x1b')](_0x45ba36)[_0x5c1c('0x1c')]();};}function respondWithResult(_0x329071,_0x19f71b){_0x19f71b=_0x19f71b||0xc8;return function(_0x5d7733){if(_0x5d7733){return _0x329071[_0x5c1c('0x1b')](_0x19f71b)[_0x5c1c('0x1d')](_0x5d7733);}};}function respondWithFilteredResult(_0x255cc9,_0x2ba795){return function(_0x5629ea){if(_0x5629ea){var _0xd71bce=typeof _0x2ba795[_0x5c1c('0x1e')]===_0x5c1c('0x1f')&&typeof _0x2ba795['limit']===_0x5c1c('0x1f');var _0x372c67=_0x5629ea[_0x5c1c('0x20')];var _0x4531c3=_0xd71bce?0x0:_0x2ba795[_0x5c1c('0x1e')];var _0x5f062d=_0xd71bce?_0x5629ea[_0x5c1c('0x20')]:_0x2ba795[_0x5c1c('0x1e')]+_0x2ba795['limit'];var _0x401232;if(_0x5f062d>=_0x372c67){_0x5f062d=_0x372c67;_0x401232=0xc8;}else{_0x401232=0xce;}_0x255cc9[_0x5c1c('0x1b')](_0x401232);return _0x255cc9['set'](_0x5c1c('0x21'),_0x4531c3+'-'+_0x5f062d+'/'+_0x372c67)[_0x5c1c('0x1d')](_0x5629ea);}return null;};}function patchUpdates(_0x324835){return function(_0x2c1ec6){try{jsonpatch[_0x5c1c('0x22')](_0x2c1ec6,_0x324835,!![]);}catch(_0x170f97){return BPromise[_0x5c1c('0x23')](_0x170f97);}return _0x2c1ec6[_0x5c1c('0x24')]();};}function saveUpdates(_0x7d0abc,_0x4fdf6d){return function(_0xd5ae75){if(_0xd5ae75){return _0xd5ae75[_0x5c1c('0x25')](_0x7d0abc)[_0x5c1c('0x26')](function(_0x57cbce){return _0x57cbce;});}return null;};}function removeEntity(_0x51ac8f,_0x4bb545){return function(_0x186f08){if(_0x186f08){return _0x186f08['destroy']()[_0x5c1c('0x26')](function(){var _0x585e20=_0x186f08[_0x5c1c('0x27')]({'plain':!![]});var _0x3e798d=_0x5c1c('0x28');return db[_0x5c1c('0x29')][_0x5c1c('0x2a')]({'where':{'type':_0x3e798d,'resourceId':_0x585e20['id']}})[_0x5c1c('0x26')](function(){return _0x186f08;});})[_0x5c1c('0x26')](function(){_0x51ac8f[_0x5c1c('0x1b')](0xcc)[_0x5c1c('0x1c')]();});}};}function handleEntityNotFound(_0x390c72,_0x4323d9){return function(_0x3cc157){if(!_0x3cc157){_0x390c72['sendStatus'](0x194);}return _0x3cc157;};}function handleError(_0x440eb2,_0x5324dd){_0x5324dd=_0x5324dd||0x1f4;return function(_0x4f809d){logger[_0x5c1c('0x2b')](_0x4f809d[_0x5c1c('0x2c')]);if(_0x4f809d[_0x5c1c('0x2d')]){delete _0x4f809d[_0x5c1c('0x2d')];}_0x440eb2[_0x5c1c('0x1b')](_0x5324dd)[_0x5c1c('0x2e')](_0x4f809d);};}exports['index']=function(_0x4f88c7,_0x2b743e){var _0x3b7057={},_0x5c1d32={},_0x167998={'count':0x0,'rows':[]};var _0x4a5308=_['map'](db[_0x5c1c('0x2f')][_0x5c1c('0x30')],function(_0x5338db){return{'name':_0x5338db[_0x5c1c('0x31')],'type':_0x5338db[_0x5c1c('0x32')][_0x5c1c('0x33')]};});_0x5c1d32[_0x5c1c('0x34')]=_[_0x5c1c('0x35')](_0x4a5308,_0x5c1c('0x2d'));_0x5c1d32['query']=_[_0x5c1c('0x36')](_0x4f88c7[_0x5c1c('0x37')]);_0x5c1d32[_0x5c1c('0x38')]=_[_0x5c1c('0x39')](_0x5c1d32[_0x5c1c('0x34')],_0x5c1d32['query']);_0x3b7057[_0x5c1c('0x3a')]=_[_0x5c1c('0x39')](_0x5c1d32[_0x5c1c('0x34')],qs[_0x5c1c('0x3b')](_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x3b')]));_0x3b7057[_0x5c1c('0x3a')]=_0x3b7057[_0x5c1c('0x3a')]['length']?_0x3b7057[_0x5c1c('0x3a')]:_0x5c1d32[_0x5c1c('0x34')];if(!_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x3c')](_0x5c1c('0x3d'))){_0x3b7057[_0x5c1c('0x3e')]=qs[_0x5c1c('0x3e')](_0x4f88c7['query'][_0x5c1c('0x3e')]);_0x3b7057['offset']=qs[_0x5c1c('0x1e')](_0x4f88c7['query'][_0x5c1c('0x1e')]);}_0x3b7057[_0x5c1c('0x3f')]=qs[_0x5c1c('0x40')](_0x4f88c7['query'][_0x5c1c('0x40')]);_0x3b7057['where']=qs[_0x5c1c('0x38')](_[_0x5c1c('0x41')](_0x4f88c7[_0x5c1c('0x37')],_0x5c1d32[_0x5c1c('0x38')]),_0x4a5308);if(_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x42')]){_0x3b7057[_0x5c1c('0x43')]=_[_0x5c1c('0x44')](_0x3b7057['where'],{'$or':_['map'](_0x4a5308,function(_0x3a60dc){if(_0x3a60dc['type']!==_0x5c1c('0x45')){var _0x292a5c={};_0x292a5c[_0x3a60dc['name']]={'$like':'%'+_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x42')]+'%'};return _0x292a5c;}})});}_0x3b7057=_[_0x5c1c('0x44')]({},_0x3b7057,_0x4f88c7['options']);var _0x3e0e9e={'where':_0x3b7057[_0x5c1c('0x43')]};return db[_0x5c1c('0x2f')][_0x5c1c('0x20')](_0x3e0e9e)['then'](function(_0x1f14b0){_0x167998['count']=_0x1f14b0;if(_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x46')]){_0x3b7057['include']=[{'all':!![]}];}return db[_0x5c1c('0x2f')][_0x5c1c('0x47')](_0x3b7057);})[_0x5c1c('0x26')](function(_0x429909){_0x167998[_0x5c1c('0x48')]=_0x429909;return _0x167998;})[_0x5c1c('0x26')](respondWithFilteredResult(_0x2b743e,_0x3b7057))[_0x5c1c('0x49')](handleError(_0x2b743e,null));};exports['show']=function(_0x153589,_0x98482a){var _0x430c4d={'raw':!![],'where':{'id':_0x153589[_0x5c1c('0x4a')]['id']}},_0x166f46={};_0x166f46[_0x5c1c('0x34')]=_[_0x5c1c('0x36')](db[_0x5c1c('0x2f')]['rawAttributes']);_0x166f46[_0x5c1c('0x37')]=_[_0x5c1c('0x36')](_0x153589[_0x5c1c('0x37')]);_0x166f46[_0x5c1c('0x38')]=_[_0x5c1c('0x39')](_0x166f46[_0x5c1c('0x34')],_0x166f46[_0x5c1c('0x37')]);_0x430c4d[_0x5c1c('0x3a')]=_[_0x5c1c('0x39')](_0x166f46[_0x5c1c('0x34')],qs[_0x5c1c('0x3b')](_0x153589['query'][_0x5c1c('0x3b')]));_0x430c4d[_0x5c1c('0x3a')]=_0x430c4d['attributes'][_0x5c1c('0x4b')]?_0x430c4d[_0x5c1c('0x3a')]:_0x166f46['model'];if(_0x153589['query'][_0x5c1c('0x46')]){_0x430c4d['include']=[{'all':!![]}];}_0x430c4d=_[_0x5c1c('0x44')]({},_0x430c4d,_0x153589[_0x5c1c('0x4c')]);return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')](_0x430c4d)['then'](handleEntityNotFound(_0x98482a,null))['then'](respondWithResult(_0x98482a,null))[_0x5c1c('0x49')](handleError(_0x98482a,null));};exports['create']=function(_0x17eb7b,_0x1c8946){return db['SquareOdbc']['create'](_0x17eb7b[_0x5c1c('0x4e')],{})[_0x5c1c('0x26')](function(_0x3f7195){var _0x9680f1=_0x17eb7b[_0x5c1c('0x4f')][_0x5c1c('0x27')]({'plain':!![]});if(!_0x9680f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9680f1[_0x5c1c('0x50')]===_0x5c1c('0x4f')){var _0x2e3af4=_0x3f7195[_0x5c1c('0x27')]({'plain':!![]});var _0x50f9a2=_0x5c1c('0x28');return db[_0x5c1c('0x51')]['find']({'where':{'name':_0x50f9a2,'userProfileId':_0x9680f1[_0x5c1c('0x52')]},'raw':!![]})['then'](function(_0x307fed){if(_0x307fed&&_0x307fed[_0x5c1c('0x53')]===0x0){return db[_0x5c1c('0x29')]['create']({'name':_0x2e3af4['name'],'resourceId':_0x2e3af4['id'],'type':_0x307fed[_0x5c1c('0x2d')],'sectionId':_0x307fed['id']},{})[_0x5c1c('0x26')](function(){return _0x3f7195;});}else{return _0x3f7195;}})[_0x5c1c('0x49')](function(_0x483555){logger[_0x5c1c('0x2b')](_0x5c1c('0x54'),_0x483555);throw _0x483555;});}return _0x3f7195;})['then'](respondWithResult(_0x1c8946,0xc9))[_0x5c1c('0x49')](handleError(_0x1c8946,null));};exports[_0x5c1c('0x25')]=function(_0x5719d7,_0xaf38c5){if(_0x5719d7['body']['id']){delete _0x5719d7[_0x5c1c('0x4e')]['id'];}return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x5719d7[_0x5c1c('0x4a')]['id']}})[_0x5c1c('0x26')](handleEntityNotFound(_0xaf38c5,null))[_0x5c1c('0x26')](saveUpdates(_0x5719d7[_0x5c1c('0x4e')],null))[_0x5c1c('0x26')](respondWithResult(_0xaf38c5,null))[_0x5c1c('0x49')](handleError(_0xaf38c5,null));};exports[_0x5c1c('0x2a')]=function(_0x2bd7f9,_0x3acc6e){return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x2bd7f9[_0x5c1c('0x4a')]['id']}})[_0x5c1c('0x26')](handleEntityNotFound(_0x3acc6e,null))[_0x5c1c('0x26')](removeEntity(_0x3acc6e,null))[_0x5c1c('0x49')](handleError(_0x3acc6e,null));};exports[_0x5c1c('0x55')]=function(_0x5cf278,_0x328d18,_0x4d9cc8){var _0x36ce2f;return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x5cf278[_0x5c1c('0x4a')]['id']},'attributes':['id',_0x5c1c('0x56')]})[_0x5c1c('0x26')](handleEntityNotFound(_0x328d18,null))[_0x5c1c('0x26')](function(_0x5d10b8){if(_0x5d10b8){var _0x17eb16=require(_0x5c1c('0x57'))();_0x17eb16[_0x5c1c('0x58')](_0x5d10b8[_0x5c1c('0x56')]);_0x17eb16[_0x5c1c('0x59')]();return _0x5d10b8;}})[_0x5c1c('0x26')](respondWithResult(_0x328d18,null))[_0x5c1c('0x49')](handleError(_0x328d18,null));}; \ No newline at end of file +var _0x7366=['VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','UserProfileResource','end','sendStatus','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x4b4892,_0x2e13f6){var _0x80ac38=function(_0x1e99d7){while(--_0x1e99d7){_0x4b4892['push'](_0x4b4892['shift']());}};_0x80ac38(++_0x2e13f6);}(_0x7366,0xce));var _0x6736=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x7366[_0x13f980];return _0x27153c;};'use strict';var emlformat=require(_0x6736('0x0'));var rimraf=require(_0x6736('0x1'));var zipdir=require(_0x6736('0x2'));var jsonpatch=require(_0x6736('0x3'));var rp=require(_0x6736('0x4'));var moment=require(_0x6736('0x5'));var BPromise=require(_0x6736('0x6'));var Mustache=require(_0x6736('0x7'));var util=require(_0x6736('0x8'));var path=require(_0x6736('0x9'));var sox=require(_0x6736('0xa'));var csv=require(_0x6736('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6736('0xc'));var _=require('lodash');var squel=require(_0x6736('0xd'));var crypto=require('crypto');var jsforce=require(_0x6736('0xe'));var deskjs=require(_0x6736('0xf'));var toCsv=require(_0x6736('0xb'));var querystring=require(_0x6736('0x10'));var Papa=require(_0x6736('0x11'));var Redis=require(_0x6736('0x12'));var authService=require(_0x6736('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6736('0x14'));var hardwareService=require(_0x6736('0x15'));var logger=require(_0x6736('0x16'))(_0x6736('0x17'));var utils=require(_0x6736('0x18'));var config=require(_0x6736('0x19'));var licenseUtil=require(_0x6736('0x1a'));var db=require(_0x6736('0x1b'))['db'];function respondWithStatusCode(_0x460239,_0x53e3eb){_0x53e3eb=_0x53e3eb||0xcc;return function(_0x535d0f){if(_0x535d0f){return _0x460239['sendStatus'](_0x53e3eb);}return _0x460239[_0x6736('0x1c')](_0x53e3eb)['end']();};}function respondWithResult(_0x10723b,_0xfcfaa3){_0xfcfaa3=_0xfcfaa3||0xc8;return function(_0x3985b9){if(_0x3985b9){return _0x10723b[_0x6736('0x1c')](_0xfcfaa3)[_0x6736('0x1d')](_0x3985b9);}};}function respondWithFilteredResult(_0x2e90ef,_0x5b0571){return function(_0x354f3d){if(_0x354f3d){var _0xafa8b8=typeof _0x5b0571['offset']===_0x6736('0x1e')&&typeof _0x5b0571[_0x6736('0x1f')]===_0x6736('0x1e');var _0x4a10da=_0x354f3d[_0x6736('0x20')];var _0xb9f60e=_0xafa8b8?0x0:_0x5b0571[_0x6736('0x21')];var _0x447af3=_0xafa8b8?_0x354f3d[_0x6736('0x20')]:_0x5b0571['offset']+_0x5b0571[_0x6736('0x1f')];var _0x31a47b;if(_0x447af3>=_0x4a10da){_0x447af3=_0x4a10da;_0x31a47b=0xc8;}else{_0x31a47b=0xce;}_0x2e90ef[_0x6736('0x1c')](_0x31a47b);return _0x2e90ef[_0x6736('0x22')](_0x6736('0x23'),_0xb9f60e+'-'+_0x447af3+'/'+_0x4a10da)[_0x6736('0x1d')](_0x354f3d);}return null;};}function patchUpdates(_0x3482a2){return function(_0x19082c){try{jsonpatch['apply'](_0x19082c,_0x3482a2,!![]);}catch(_0x30f68e){return BPromise[_0x6736('0x24')](_0x30f68e);}return _0x19082c[_0x6736('0x25')]();};}function saveUpdates(_0x54de0,_0x13d062){return function(_0x42a7dc){if(_0x42a7dc){return _0x42a7dc['update'](_0x54de0)[_0x6736('0x26')](function(_0x5f1c40){return _0x5f1c40;});}return null;};}function removeEntity(_0x3e4788,_0x31f2fb){return function(_0xfb79a3){if(_0xfb79a3){return _0xfb79a3[_0x6736('0x27')]()['then'](function(){var _0x1b86ea=_0xfb79a3['get']({'plain':!![]});var _0x5e95ac='ODBC';return db[_0x6736('0x28')]['destroy']({'where':{'type':_0x5e95ac,'resourceId':_0x1b86ea['id']}})[_0x6736('0x26')](function(){return _0xfb79a3;});})['then'](function(){_0x3e4788[_0x6736('0x1c')](0xcc)[_0x6736('0x29')]();});}};}function handleEntityNotFound(_0x1707a5,_0x10735c){return function(_0x1dfc07){if(!_0x1dfc07){_0x1707a5[_0x6736('0x2a')](0x194);}return _0x1dfc07;};}function handleError(_0x3c5ca6,_0x244925){_0x244925=_0x244925||0x1f4;return function(_0xe305ba){logger['error'](_0xe305ba[_0x6736('0x2b')]);if(_0xe305ba[_0x6736('0x2c')]){delete _0xe305ba['name'];}_0x3c5ca6[_0x6736('0x1c')](_0x244925)['send'](_0xe305ba);};}exports[_0x6736('0x2d')]=function(_0x5c27a9,_0x2eca96){var _0x8cd30a={},_0x5a9f4a={},_0x4878e6={'count':0x0,'rows':[]};var _0x29945c=_[_0x6736('0x2e')](db[_0x6736('0x2f')][_0x6736('0x30')],function(_0x4b30ae){return{'name':_0x4b30ae[_0x6736('0x31')],'type':_0x4b30ae[_0x6736('0x32')][_0x6736('0x33')]};});_0x5a9f4a['model']=_[_0x6736('0x2e')](_0x29945c,'name');_0x5a9f4a[_0x6736('0x34')]=_[_0x6736('0x35')](_0x5c27a9[_0x6736('0x34')]);_0x5a9f4a[_0x6736('0x36')]=_[_0x6736('0x37')](_0x5a9f4a['model'],_0x5a9f4a['query']);_0x8cd30a[_0x6736('0x38')]=_[_0x6736('0x37')](_0x5a9f4a[_0x6736('0x39')],qs[_0x6736('0x3a')](_0x5c27a9[_0x6736('0x34')][_0x6736('0x3a')]));_0x8cd30a['attributes']=_0x8cd30a[_0x6736('0x38')]['length']?_0x8cd30a[_0x6736('0x38')]:_0x5a9f4a[_0x6736('0x39')];if(!_0x5c27a9[_0x6736('0x34')][_0x6736('0x3b')](_0x6736('0x3c'))){_0x8cd30a['limit']=qs['limit'](_0x5c27a9['query']['limit']);_0x8cd30a[_0x6736('0x21')]=qs['offset'](_0x5c27a9[_0x6736('0x34')][_0x6736('0x21')]);}_0x8cd30a[_0x6736('0x3d')]=qs[_0x6736('0x3e')](_0x5c27a9[_0x6736('0x34')]['sort']);_0x8cd30a['where']=qs[_0x6736('0x36')](_[_0x6736('0x3f')](_0x5c27a9[_0x6736('0x34')],_0x5a9f4a[_0x6736('0x36')]),_0x29945c);if(_0x5c27a9[_0x6736('0x34')][_0x6736('0x40')]){_0x8cd30a[_0x6736('0x41')]=_[_0x6736('0x42')](_0x8cd30a[_0x6736('0x41')],{'$or':_[_0x6736('0x2e')](_0x29945c,function(_0x948c6f){if(_0x948c6f[_0x6736('0x32')]!==_0x6736('0x43')){var _0xbadf67={};_0xbadf67[_0x948c6f[_0x6736('0x2c')]]={'$like':'%'+_0x5c27a9[_0x6736('0x34')][_0x6736('0x40')]+'%'};return _0xbadf67;}})});}_0x8cd30a=_[_0x6736('0x42')]({},_0x8cd30a,_0x5c27a9[_0x6736('0x44')]);var _0x2ccbe3={'where':_0x8cd30a[_0x6736('0x41')]};return db[_0x6736('0x2f')][_0x6736('0x20')](_0x2ccbe3)[_0x6736('0x26')](function(_0x3cae0c){_0x4878e6[_0x6736('0x20')]=_0x3cae0c;if(_0x5c27a9[_0x6736('0x34')]['includeAll']){_0x8cd30a[_0x6736('0x45')]=[{'all':!![]}];}return db[_0x6736('0x2f')][_0x6736('0x46')](_0x8cd30a);})['then'](function(_0x6f8c65){_0x4878e6[_0x6736('0x47')]=_0x6f8c65;return _0x4878e6;})[_0x6736('0x26')](respondWithFilteredResult(_0x2eca96,_0x8cd30a))[_0x6736('0x48')](handleError(_0x2eca96,null));};exports[_0x6736('0x49')]=function(_0xbab7cd,_0x1ff4c4){var _0x4f45df={'raw':!![],'where':{'id':_0xbab7cd[_0x6736('0x4a')]['id']}},_0x10615b={};_0x10615b[_0x6736('0x39')]=_['keys'](db[_0x6736('0x2f')][_0x6736('0x30')]);_0x10615b['query']=_[_0x6736('0x35')](_0xbab7cd['query']);_0x10615b[_0x6736('0x36')]=_['intersection'](_0x10615b[_0x6736('0x39')],_0x10615b[_0x6736('0x34')]);_0x4f45df[_0x6736('0x38')]=_[_0x6736('0x37')](_0x10615b['model'],qs[_0x6736('0x3a')](_0xbab7cd[_0x6736('0x34')][_0x6736('0x3a')]));_0x4f45df[_0x6736('0x38')]=_0x4f45df['attributes'][_0x6736('0x4b')]?_0x4f45df[_0x6736('0x38')]:_0x10615b[_0x6736('0x39')];if(_0xbab7cd['query'][_0x6736('0x4c')]){_0x4f45df[_0x6736('0x45')]=[{'all':!![]}];}_0x4f45df=_[_0x6736('0x42')]({},_0x4f45df,_0xbab7cd[_0x6736('0x44')]);return db[_0x6736('0x2f')][_0x6736('0x4d')](_0x4f45df)[_0x6736('0x26')](handleEntityNotFound(_0x1ff4c4,null))['then'](respondWithResult(_0x1ff4c4,null))['catch'](handleError(_0x1ff4c4,null));};exports['create']=function(_0x3df504,_0x328183){return db[_0x6736('0x2f')]['create'](_0x3df504['body'],{})['then'](function(_0x1cc824){var _0x156d71=_0x3df504[_0x6736('0x4e')]['get']({'plain':!![]});if(!_0x156d71)throw new Error(_0x6736('0x4f'));if(_0x156d71[_0x6736('0x50')]===_0x6736('0x4e')){var _0x12f212=_0x1cc824[_0x6736('0x51')]({'plain':!![]});var _0x1af5df=_0x6736('0x52');return db[_0x6736('0x53')][_0x6736('0x4d')]({'where':{'name':_0x1af5df,'userProfileId':_0x156d71['userProfileId']},'raw':!![]})['then'](function(_0x57ce2b){if(_0x57ce2b&&_0x57ce2b[_0x6736('0x54')]===0x0){return db[_0x6736('0x28')]['create']({'name':_0x12f212[_0x6736('0x2c')],'resourceId':_0x12f212['id'],'type':_0x57ce2b[_0x6736('0x2c')],'sectionId':_0x57ce2b['id']},{})[_0x6736('0x26')](function(){return _0x1cc824;});}else{return _0x1cc824;}})[_0x6736('0x48')](function(_0xa728b9){logger['error'](_0x6736('0x55'),_0xa728b9);throw _0xa728b9;});}return _0x1cc824;})[_0x6736('0x26')](respondWithResult(_0x328183,0xc9))[_0x6736('0x48')](handleError(_0x328183,null));};exports['update']=function(_0x4e966a,_0x4a8150){if(_0x4e966a[_0x6736('0x56')]['id']){delete _0x4e966a[_0x6736('0x56')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x4e966a['params']['id']}})['then'](handleEntityNotFound(_0x4a8150,null))[_0x6736('0x26')](saveUpdates(_0x4e966a['body'],null))[_0x6736('0x26')](respondWithResult(_0x4a8150,null))['catch'](handleError(_0x4a8150,null));};exports[_0x6736('0x27')]=function(_0x150158,_0x5ea430){return db[_0x6736('0x2f')][_0x6736('0x4d')]({'where':{'id':_0x150158[_0x6736('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ea430,null))[_0x6736('0x26')](removeEntity(_0x5ea430,null))['catch'](handleError(_0x5ea430,null));};exports[_0x6736('0x57')]=function(_0x40e888,_0x1fb697,_0x5b7758){var _0x5068e3;return db[_0x6736('0x2f')][_0x6736('0x4d')]({'where':{'id':_0x40e888['params']['id']},'attributes':['id',_0x6736('0x58')]})['then'](handleEntityNotFound(_0x1fb697,null))[_0x6736('0x26')](function(_0x18fbcc){if(_0x18fbcc){var _0x493c2f=require(_0x6736('0x59'))();_0x493c2f[_0x6736('0x5a')](_0x18fbcc['dsn']);_0x493c2f['closeSync']();return _0x18fbcc;}})[_0x6736('0x26')](respondWithResult(_0x1fb697,null))[_0x6736('0x48')](handleError(_0x1fb697,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 14383be..d7d3134 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 _0xb344=['request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','../../config/logger','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb344,0x150));var _0x4b34=function(_0x1a58d1,_0xa90685){_0x1a58d1=_0x1a58d1-0x0;var _0x101adc=_0xb344[_0x1a58d1];return _0x101adc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b34('0x0'))(_0x4b34('0x1'));var moment=require(_0x4b34('0x2'));var BPromise=require(_0x4b34('0x3'));var rp=require(_0x4b34('0x4'));var fs=require('fs');var path=require(_0x4b34('0x5'));var rimraf=require(_0x4b34('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b34('0x7'));module[_0x4b34('0x8')]=function(_0xa09244,_0x20f445){return _0xa09244['define'](_0x4b34('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe0=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x265793,_0x1184c5){var _0x1fbad1=function(_0x420cb8){while(--_0x420cb8){_0x265793['push'](_0x265793['shift']());}};_0x1fbad1(++_0x1184c5);}(_0xafe0,0x85));var _0x0afe=function(_0x56456b,_0x5babd7){_0x56456b=_0x56456b-0x0;var _0x37da11=_0xafe0[_0x56456b];return _0x37da11;};'use strict';var _=require(_0x0afe('0x0'));var util=require(_0x0afe('0x1'));var logger=require(_0x0afe('0x2'))(_0x0afe('0x3'));var moment=require(_0x0afe('0x4'));var BPromise=require(_0x0afe('0x5'));var rp=require(_0x0afe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0afe('0x7'));var attributes=require(_0x0afe('0x8'));module[_0x0afe('0x9')]=function(_0x3d138a,_0xe779c7){return _0x3d138a[_0x0afe('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 2d811d0..7290402 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 _0x3fe2=['info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x3fe2,0x1d3));var _0x23fe=function(_0x4456f3,_0x26a709){_0x4456f3=_0x4456f3-0x0;var _0xf17e5a=_0x3fe2[_0x4456f3];return _0xf17e5a;};'use strict';var _=require(_0x23fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23fe('0x1'));var rs=require(_0x23fe('0x2'));var fs=require('fs');var Redis=require(_0x23fe('0x3'));var db=require(_0x23fe('0x4'))['db'];var utils=require(_0x23fe('0x5'));var logger=require(_0x23fe('0x6'))(_0x23fe('0x7'));var config=require(_0x23fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23fe('0x9')][_0x23fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494d1f,_0x437a90,_0x497d37){return new BPromise(function(_0x26bd35,_0xa12efc){return client[_0x23fe('0xb')](_0x494d1f,_0x497d37)[_0x23fe('0xc')](function(_0x44bb03){logger[_0x23fe('0xd')](_0x23fe('0xe'),_0x437a90,_0x23fe('0xf'));logger[_0x23fe('0x10')](_0x23fe('0x11'),_0x437a90,_0x23fe('0xf'),JSON[_0x23fe('0x12')](_0x44bb03));if(_0x44bb03[_0x23fe('0x13')]){if(_0x44bb03[_0x23fe('0x13')]['code']===0x1f4){logger[_0x23fe('0x13')](_0x23fe('0xe'),_0x437a90,_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);return _0xa12efc(_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);}logger[_0x23fe('0x13')](_0x23fe('0xe'),_0x437a90,_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);return _0x26bd35(_0x44bb03['error'][_0x23fe('0x14')]);}else{logger[_0x23fe('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x437a90,_0x23fe('0xf'));_0x26bd35(_0x44bb03[_0x23fe('0x15')]['message']);}})['catch'](function(_0x4b158e){logger[_0x23fe('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x437a90,_0x4b158e);_0xa12efc(_0x4b158e);});});}exports[_0x23fe('0x16')]=function(_0x4fd2a7){var _0x506b38=this;return new Promise(function(_0x2b8fd8,_0x419630){return db[_0x23fe('0x17')][_0x23fe('0x18')]({'raw':_0x4fd2a7['options']?_0x4fd2a7[_0x23fe('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4fd2a7[_0x23fe('0x19')]?_0x4fd2a7['options'][_0x23fe('0x1a')]||null:null,'attributes':_0x4fd2a7['options']?_0x4fd2a7[_0x23fe('0x19')]['attributes']||null:null,'include':_0x4fd2a7[_0x23fe('0x19')]?_0x4fd2a7['options'][_0x23fe('0x1b')]?_[_0x23fe('0x1c')](_0x4fd2a7[_0x23fe('0x19')][_0x23fe('0x1b')],function(_0x58412c){return{'model':db[_0x58412c[_0x23fe('0x1d')]],'as':_0x58412c['as'],'attributes':_0x58412c[_0x23fe('0x1e')],'include':_0x58412c['include']?_[_0x23fe('0x1c')](_0x58412c[_0x23fe('0x1b')],function(_0x2a32e0){return{'model':db[_0x2a32e0[_0x23fe('0x1d')]],'as':_0x2a32e0['as'],'attributes':_0x2a32e0['attributes'],'include':_0x2a32e0[_0x23fe('0x1b')]?_['map'](_0x2a32e0[_0x23fe('0x1b')],function(_0x3ef8e6){return{'model':db[_0x3ef8e6[_0x23fe('0x1d')]],'as':_0x3ef8e6['as'],'attributes':_0x3ef8e6['attributes']};}):[]};}):[]};}):[]:[]})[_0x23fe('0xc')](function(_0x5710b3){logger['info'](_0x23fe('0x16'),_0x4fd2a7);logger[_0x23fe('0x10')](_0x23fe('0x16'),_0x4fd2a7,JSON[_0x23fe('0x12')](_0x5710b3));_0x2b8fd8(_0x5710b3);})[_0x23fe('0x1f')](function(_0x558a55){logger[_0x23fe('0x13')](_0x23fe('0x16'),_0x558a55[_0x23fe('0x14')],_0x4fd2a7);_0x419630(_0x506b38[_0x23fe('0x13')](0x1f4,_0x558a55[_0x23fe('0x14')]));});});}; \ No newline at end of file +var _0x3bb1=['error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c0b3e,_0xee0813){var _0x2b1de2=function(_0x4bbbc5){while(--_0x4bbbc5){_0x3c0b3e['push'](_0x3c0b3e['shift']());}};_0x2b1de2(++_0xee0813);}(_0x3bb1,0x182));var _0x13bb=function(_0x2dfa44,_0x5dca55){_0x2dfa44=_0x2dfa44-0x0;var _0x3067a5=_0x3bb1[_0x2dfa44];return _0x3067a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x13bb('0x0'));var BPromise=require(_0x13bb('0x1'));var rs=require(_0x13bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13bb('0x3'))['db'];var utils=require(_0x13bb('0x4'));var logger=require(_0x13bb('0x5'))(_0x13bb('0x6'));var config=require(_0x13bb('0x7'));var jayson=require(_0x13bb('0x8'));var client=jayson[_0x13bb('0x9')][_0x13bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40dae2,_0x196197,_0x212ad2){return new BPromise(function(_0x489965,_0x4c7c40){return client[_0x13bb('0xb')](_0x40dae2,_0x212ad2)[_0x13bb('0xc')](function(_0x5616d0){logger[_0x13bb('0xd')](_0x13bb('0xe'),_0x196197,_0x13bb('0xf'));logger[_0x13bb('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x196197,'request\x20sent',JSON['stringify'](_0x5616d0));if(_0x5616d0[_0x13bb('0x11')]){if(_0x5616d0['error']['code']===0x1f4){logger[_0x13bb('0x11')](_0x13bb('0xe'),_0x196197,_0x5616d0['error']['message']);return _0x4c7c40(_0x5616d0[_0x13bb('0x11')]['message']);}logger[_0x13bb('0x11')](_0x13bb('0xe'),_0x196197,_0x5616d0[_0x13bb('0x11')]['message']);return _0x489965(_0x5616d0[_0x13bb('0x11')][_0x13bb('0x12')]);}else{logger[_0x13bb('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x196197,_0x13bb('0xf'));_0x489965(_0x5616d0[_0x13bb('0x13')][_0x13bb('0x12')]);}})[_0x13bb('0x14')](function(_0x20179c){logger[_0x13bb('0x11')](_0x13bb('0xe'),_0x196197,_0x20179c);_0x4c7c40(_0x20179c);});});}exports[_0x13bb('0x15')]=function(_0x2c7d82){var _0x5f4f2c=this;return new Promise(function(_0x5990ca,_0x4a2f73){return db[_0x13bb('0x16')][_0x13bb('0x17')]({'raw':_0x2c7d82[_0x13bb('0x18')]?_0x2c7d82[_0x13bb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2c7d82[_0x13bb('0x18')]?_0x2c7d82[_0x13bb('0x18')][_0x13bb('0x19')]||null:null,'attributes':_0x2c7d82['options']?_0x2c7d82['options'][_0x13bb('0x1a')]||null:null,'include':_0x2c7d82['options']?_0x2c7d82['options'][_0x13bb('0x1b')]?_[_0x13bb('0x1c')](_0x2c7d82[_0x13bb('0x18')]['include'],function(_0x4ce7a1){return{'model':db[_0x4ce7a1[_0x13bb('0x1d')]],'as':_0x4ce7a1['as'],'attributes':_0x4ce7a1['attributes'],'include':_0x4ce7a1[_0x13bb('0x1b')]?_[_0x13bb('0x1c')](_0x4ce7a1['include'],function(_0x3be3d4){return{'model':db[_0x3be3d4[_0x13bb('0x1d')]],'as':_0x3be3d4['as'],'attributes':_0x3be3d4['attributes'],'include':_0x3be3d4['include']?_[_0x13bb('0x1c')](_0x3be3d4[_0x13bb('0x1b')],function(_0x13565d){return{'model':db[_0x13565d[_0x13bb('0x1d')]],'as':_0x13565d['as'],'attributes':_0x13565d[_0x13bb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x13bb('0xc')](function(_0x588a16){logger['info']('ShowSquareOdbc',_0x2c7d82);logger['debug'](_0x13bb('0x15'),_0x2c7d82,JSON[_0x13bb('0x1e')](_0x588a16));_0x5990ca(_0x588a16);})['catch'](function(_0x470b2d){logger[_0x13bb('0x11')](_0x13bb('0x15'),_0x470b2d[_0x13bb('0x12')],_0x2c7d82);_0x4a2f73(_0x5f4f2c[_0x13bb('0x11')](0x1f4,_0x470b2d[_0x13bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 96c9133..d1ec0a0 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 _0xca3f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x148ac8,_0x2cfc6a){var _0x655338=function(_0x27178e){while(--_0x27178e){_0x148ac8['push'](_0x148ac8['shift']());}};_0x655338(++_0x2cfc6a);}(_0xca3f,0x9c));var _0xfca3=function(_0x4ef339,_0x319478){_0x4ef339=_0x4ef339-0x0;var _0x4b8059=_0xca3f[_0x4ef339];return _0x4b8059;};'use strict';var multer=require(_0xfca3('0x0'));var util=require(_0xfca3('0x1'));var path=require(_0xfca3('0x2'));var timeout=require(_0xfca3('0x3'));var express=require(_0xfca3('0x4'));var router=express[_0xfca3('0x5')]();var fs_extra=require(_0xfca3('0x6'));var auth=require(_0xfca3('0x7'));var interaction=require(_0xfca3('0x8'));var config=require('../../config/environment');var controller=require(_0xfca3('0x9'));router[_0xfca3('0xa')]('/',auth[_0xfca3('0xb')](),controller[_0xfca3('0xc')]);router[_0xfca3('0xa')](_0xfca3('0xd'),auth[_0xfca3('0xb')](),controller[_0xfca3('0xe')]);router[_0xfca3('0xf')]('/',auth[_0xfca3('0xb')](),controller[_0xfca3('0x10')]);router[_0xfca3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfca3('0x12')](_0xfca3('0xd'),auth[_0xfca3('0xb')](),controller['destroy']);module[_0xfca3('0x13')]=router; \ No newline at end of file +var _0x801b=['./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46ee48,_0x55568c){var _0x1fefea=function(_0x55dc3d){while(--_0x55dc3d){_0x46ee48['push'](_0x46ee48['shift']());}};_0x1fefea(++_0x55568c);}(_0x801b,0x1bb));var _0xb801=function(_0x2c8a77,_0xf32eed){_0x2c8a77=_0x2c8a77-0x0;var _0x2b3ef9=_0x801b[_0x2c8a77];return _0x2b3ef9;};'use strict';var multer=require(_0xb801('0x0'));var util=require('util');var path=require(_0xb801('0x1'));var timeout=require(_0xb801('0x2'));var express=require('express');var router=express[_0xb801('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb801('0x4'));var interaction=require(_0xb801('0x5'));var config=require(_0xb801('0x6'));var controller=require(_0xb801('0x7'));router[_0xb801('0x8')]('/',auth[_0xb801('0x9')](),controller[_0xb801('0xa')]);router['get'](_0xb801('0xb'),auth[_0xb801('0x9')](),controller[_0xb801('0xc')]);router[_0xb801('0xd')]('/',auth[_0xb801('0x9')](),controller[_0xb801('0xe')]);router['put'](_0xb801('0xb'),auth[_0xb801('0x9')](),controller[_0xb801('0xf')]);router[_0xb801('0x10')](_0xb801('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb801('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 57dfad6..71b5170 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 _0x890c=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT'];(function(_0x38f34e,_0x287825){var _0x3f3adf=function(_0x40c089){while(--_0x40c089){_0x38f34e['push'](_0x38f34e['shift']());}};_0x3f3adf(++_0x287825);}(_0x890c,0x18e));var _0xc890=function(_0x530a71,_0xeca2c2){_0x530a71=_0x530a71-0x0;var _0x16d1f8=_0x890c[_0x530a71];return _0x16d1f8;};'use strict';var Sequelize=require(_0xc890('0x0'));module[_0xc890('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc890('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc890('0x3')]},'notes':{'type':Sequelize[_0xc890('0x4')]},'preproduction':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')](_0xc890('0x8'))){return this['getDataValue'](_0xc890('0x8'))[_0xc890('0x9')](_0xc890('0xa'));}}},'production':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')]('production')){return this[_0xc890('0x7')](_0xc890('0xb'))[_0xc890('0x9')](_0xc890('0xa'));}}},'savedAt':{'type':Sequelize[_0xc890('0xc')]},'publishedAt':{'type':Sequelize[_0xc890('0xc')]}}; \ No newline at end of file +var _0x32de=['BLOB','long','preproduction','utf8','getDataValue','production','toString','DATE','exports','name','TEXT'];(function(_0x56a653,_0x622654){var _0x5154f4=function(_0x6bf154){while(--_0x6bf154){_0x56a653['push'](_0x56a653['shift']());}};_0x5154f4(++_0x622654);}(_0x32de,0x105));var _0xe32d=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x32de[_0x55af86];return _0x58df3b;};'use strict';var Sequelize=require('sequelize');module[_0xe32d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe32d('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe32d('0x2')]},'preproduction':{'type':Sequelize[_0xe32d('0x3')](_0xe32d('0x4')),'get':function(){if(this['getDataValue'](_0xe32d('0x5'))){return this['getDataValue'](_0xe32d('0x5'))['toString'](_0xe32d('0x6'));}}},'production':{'type':Sequelize[_0xe32d('0x3')](_0xe32d('0x4')),'get':function(){if(this[_0xe32d('0x7')](_0xe32d('0x8'))){return this['getDataValue'](_0xe32d('0x8'))[_0xe32d('0x9')](_0xe32d('0x6'));}}},'savedAt':{'type':Sequelize[_0xe32d('0xa')]},'publishedAt':{'type':Sequelize[_0xe32d('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6016033..eb8c138 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 _0x1063=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','publish','agi','stringify','end','error','stack','name','index','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareProject','includeAll','include','findAll','catch','show','keys','find','create'];(function(_0x4222b5,_0x37422c){var _0x425d4c=function(_0x53e442){while(--_0x53e442){_0x4222b5['push'](_0x4222b5['shift']());}};_0x425d4c(++_0x37422c);}(_0x1063,0x95));var _0x3106=function(_0x53cd3f,_0x42da3b){_0x53cd3f=_0x53cd3f-0x0;var _0x3f2af3=_0x1063[_0x53cd3f];return _0x3f2af3;};'use strict';var _=require(_0x3106('0x0'));var Redis=require(_0x3106('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x3106('0x2'))(_0x3106('0x3'));var config=require(_0x3106('0x4'));var db=require(_0x3106('0x5'))['db'];config[_0x3106('0x6')]=_['defaults'](config[_0x3106('0x6')],{'host':_0x3106('0x7'),'port':0x18eb});var socket=require(_0x3106('0x8'))(new Redis(config['redis']));require(_0x3106('0x9'))['register'](socket);function respondWithResult(_0x3a1a32,_0x4d5bb5){_0x4d5bb5=_0x4d5bb5||0xc8;return function(_0x6f7668){if(_0x6f7668){return _0x3a1a32[_0x3106('0xa')](_0x4d5bb5)[_0x3106('0xb')](_0x6f7668);}};}function respondWithFilteredResult(_0x25d5f1,_0x46821f){return function(_0x1731ed){if(_0x1731ed){var _0x13250b=typeof _0x46821f[_0x3106('0xc')]===_0x3106('0xd')&&typeof _0x46821f[_0x3106('0xe')]===_0x3106('0xd');var _0x276452=_0x1731ed[_0x3106('0xf')];var _0x5c7904=_0x13250b?0x0:_0x46821f[_0x3106('0xc')];var _0x4b41ee=_0x13250b?_0x1731ed[_0x3106('0xf')]:_0x46821f[_0x3106('0xc')]+_0x46821f[_0x3106('0xe')];var _0x2e255c;if(_0x4b41ee>=_0x276452){_0x4b41ee=_0x276452;_0x2e255c=0xc8;}else{_0x2e255c=0xce;}_0x25d5f1['status'](_0x2e255c);return _0x25d5f1[_0x3106('0x10')]('Content-Range',_0x5c7904+'-'+_0x4b41ee+'/'+_0x276452)[_0x3106('0xb')](_0x1731ed);}return null;};}function saveUpdates(_0x5b6496){return function(_0x22e649){if(_0x22e649){return _0x22e649[_0x3106('0x11')](_0x5b6496)[_0x3106('0x12')](function(_0x40be08){return _0x40be08;});}return null;};}function removeEntity(_0x138454){return function(_0x49aeeb){if(_0x49aeeb){return _0x49aeeb[_0x3106('0x13')]()[_0x3106('0x12')](function(){var _0x3df44f=_0x49aeeb[_0x3106('0x14')]({'plain':!![]});var _0x185ba8='SquareProjects';return db[_0x3106('0x15')][_0x3106('0x13')]({'where':{'type':_0x185ba8,'resourceId':_0x3df44f['id']}})['then'](function(){return _0x49aeeb;});})[_0x3106('0x12')](function(){var _0x52ea6a=new Redis(config[_0x3106('0x6')]);_0x52ea6a[_0x3106('0x16')](_0x3106('0x17'),JSON[_0x3106('0x18')]({'id':_0x49aeeb['id'],'deleted':!![]}));})[_0x3106('0x12')](function(){_0x138454[_0x3106('0xa')](0xcc)[_0x3106('0x19')]();});}};}function handleEntityNotFound(_0x46a7c1){return function(_0x1331df){if(!_0x1331df){_0x46a7c1['sendStatus'](0x194);}return _0x1331df;};}function handleError(_0x1d3889,_0x723c5b){_0x723c5b=_0x723c5b||0x1f4;return function(_0x3c94bf){logger[_0x3106('0x1a')](_0x3c94bf[_0x3106('0x1b')]);if(_0x3c94bf['name']){delete _0x3c94bf[_0x3106('0x1c')];}_0x1d3889['status'](_0x723c5b)['send'](_0x3c94bf);};}exports[_0x3106('0x1d')]=function(_0x1508b0,_0x3e2664){var _0x5b89e0={},_0x31e571={},_0x468be={'count':0x0,'rows':[]};var _0x118f51=_[_0x3106('0x1e')](db['SquareProject'][_0x3106('0x1f')],function(_0x19a2cb){return{'name':_0x19a2cb['fieldName'],'type':_0x19a2cb['type']['key']};});_0x31e571[_0x3106('0x20')]=_[_0x3106('0x1e')](_0x118f51,'name');_0x31e571[_0x3106('0x21')]=_['keys'](_0x1508b0[_0x3106('0x21')]);_0x31e571[_0x3106('0x22')]=_[_0x3106('0x23')](_0x31e571[_0x3106('0x20')],_0x31e571[_0x3106('0x21')]);_0x5b89e0[_0x3106('0x24')]=_[_0x3106('0x23')](_0x31e571[_0x3106('0x20')],qs[_0x3106('0x25')](_0x1508b0[_0x3106('0x21')]['fields']));_0x5b89e0['attributes']=_0x5b89e0[_0x3106('0x24')][_0x3106('0x26')]?_0x5b89e0['attributes']:_0x31e571['model'];if(!_0x1508b0[_0x3106('0x21')]['hasOwnProperty'](_0x3106('0x27'))){_0x5b89e0['limit']=qs[_0x3106('0xe')](_0x1508b0[_0x3106('0x21')]['limit']);_0x5b89e0[_0x3106('0xc')]=qs[_0x3106('0xc')](_0x1508b0[_0x3106('0x21')][_0x3106('0xc')]);}_0x5b89e0[_0x3106('0x28')]=qs[_0x3106('0x29')](_0x1508b0[_0x3106('0x21')][_0x3106('0x29')]);_0x5b89e0[_0x3106('0x2a')]=qs[_0x3106('0x22')](_[_0x3106('0x2b')](_0x1508b0[_0x3106('0x21')],_0x31e571[_0x3106('0x22')]),_0x118f51);if(_0x1508b0['query'][_0x3106('0x2c')]){_0x5b89e0[_0x3106('0x2a')]=_[_0x3106('0x2d')](_0x5b89e0[_0x3106('0x2a')],{'$or':_[_0x3106('0x1e')](_0x118f51,function(_0x4a4556){if(_0x4a4556[_0x3106('0x2e')]!==_0x3106('0x2f')){var _0x41e2a8={};_0x41e2a8[_0x4a4556[_0x3106('0x1c')]]={'$like':'%'+_0x1508b0[_0x3106('0x21')]['filter']+'%'};return _0x41e2a8;}})});}_0x5b89e0=_['merge']({},_0x5b89e0,_0x1508b0[_0x3106('0x30')]);var _0x48e8e3={'where':_0x5b89e0[_0x3106('0x2a')]};return db[_0x3106('0x31')][_0x3106('0xf')](_0x48e8e3)['then'](function(_0x445cc6){_0x468be[_0x3106('0xf')]=_0x445cc6;if(_0x1508b0[_0x3106('0x21')][_0x3106('0x32')]){_0x5b89e0[_0x3106('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x3106('0x34')](_0x5b89e0);})[_0x3106('0x12')](function(_0x52eec3){_0x468be['rows']=_0x52eec3;return _0x468be;})['then'](respondWithFilteredResult(_0x3e2664,_0x5b89e0))[_0x3106('0x35')](handleError(_0x3e2664,null));};exports[_0x3106('0x36')]=function(_0x197bf6,_0x203c15){var _0x5bf596={'raw':![],'where':{'id':_0x197bf6['params']['id']}},_0xbf1b2c={};_0xbf1b2c[_0x3106('0x20')]=_[_0x3106('0x37')](db[_0x3106('0x31')][_0x3106('0x1f')]);_0xbf1b2c[_0x3106('0x21')]=_['keys'](_0x197bf6[_0x3106('0x21')]);_0xbf1b2c['filters']=_[_0x3106('0x23')](_0xbf1b2c[_0x3106('0x20')],_0xbf1b2c[_0x3106('0x21')]);_0x5bf596[_0x3106('0x24')]=_[_0x3106('0x23')](_0xbf1b2c[_0x3106('0x20')],qs[_0x3106('0x25')](_0x197bf6[_0x3106('0x21')][_0x3106('0x25')]));_0x5bf596['attributes']=_0x5bf596[_0x3106('0x24')][_0x3106('0x26')]?_0x5bf596[_0x3106('0x24')]:_0xbf1b2c['model'];if(_0x197bf6[_0x3106('0x21')][_0x3106('0x32')]){_0x5bf596[_0x3106('0x33')]=[{'all':!![]}];}_0x5bf596=_['merge']({},_0x5bf596,_0x197bf6[_0x3106('0x30')]);return db[_0x3106('0x31')][_0x3106('0x38')](_0x5bf596)[_0x3106('0x12')](handleEntityNotFound(_0x203c15,null))[_0x3106('0x12')](respondWithResult(_0x203c15,null))[_0x3106('0x35')](handleError(_0x203c15,null));};exports['create']=function(_0x278392,_0x2ccdbe){return db[_0x3106('0x31')][_0x3106('0x39')](_0x278392['body'],{})[_0x3106('0x12')](function(_0x523967){var _0x4bb138=_0x278392[_0x3106('0x3a')]['get']({'plain':!![]});if(!_0x4bb138)throw new Error(_0x3106('0x3b'));if(_0x4bb138[_0x3106('0x3c')]===_0x3106('0x3a')){var _0x226f94=_0x523967[_0x3106('0x14')]({'plain':!![]});var _0xdec29c=_0x3106('0x3d');return db[_0x3106('0x3e')][_0x3106('0x38')]({'where':{'name':_0xdec29c,'userProfileId':_0x4bb138[_0x3106('0x3f')]},'raw':!![]})[_0x3106('0x12')](function(_0x51ffe5){if(_0x51ffe5&&_0x51ffe5[_0x3106('0x40')]===0x0){return db[_0x3106('0x15')][_0x3106('0x39')]({'name':_0x226f94['name'],'resourceId':_0x226f94['id'],'type':_0x51ffe5['name'],'sectionId':_0x51ffe5['id']},{})[_0x3106('0x12')](function(){return _0x523967;});}else{return _0x523967;}})[_0x3106('0x35')](function(_0x2c187c){logger['error'](_0x3106('0x41'),_0x2c187c);throw _0x2c187c;});}return _0x523967;})['then'](respondWithResult(_0x2ccdbe,0xc9))['catch'](handleError(_0x2ccdbe,null));};exports[_0x3106('0x11')]=function(_0x131e23,_0x3d940f){if(_0x131e23[_0x3106('0x42')]['id']){delete _0x131e23[_0x3106('0x42')]['id'];}return db['SquareProject'][_0x3106('0x38')]({'where':{'id':_0x131e23[_0x3106('0x43')]['id']}})[_0x3106('0x12')](handleEntityNotFound(_0x3d940f,null))[_0x3106('0x12')](saveUpdates(_0x131e23[_0x3106('0x42')],null))[_0x3106('0x12')](function(_0x3ad58e){if(!_0x3ad58e)return;var _0x1bc594=_0x3ad58e[_0x3106('0x14')]({'plain':!![]});return _0x1bc594;})['then'](function(_0x571f43){var _0x29a080=new Redis(config[_0x3106('0x6')]);_0x29a080[_0x3106('0x16')](_0x3106('0x17'),JSON[_0x3106('0x18')](_[_0x3106('0x2b')](_0x571f43,['id',_0x3106('0x1c'),_0x3106('0x44')])));return _0x571f43;})['then'](respondWithResult(_0x3d940f,null))[_0x3106('0x35')](handleError(_0x3d940f,null));};exports['destroy']=function(_0x197d2c,_0x543082){return db['SquareProject'][_0x3106('0x38')]({'where':{'id':_0x197d2c['params']['id']}})['then'](handleEntityNotFound(_0x543082,null))[_0x3106('0x12')](removeEntity(_0x543082,null))[_0x3106('0x35')](handleError(_0x543082,null));}; \ No newline at end of file +var _0x8a0f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','then','destroy','SquareProjects','agi','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','get'];(function(_0x123128,_0x5f5a0a){var _0x37c5ce=function(_0x5bc5ec){while(--_0x5bc5ec){_0x123128['push'](_0x123128['shift']());}};_0x37c5ce(++_0x5f5a0a);}(_0x8a0f,0x120));var _0xf8a0=function(_0x1bd846,_0x218780){_0x1bd846=_0x1bd846-0x0;var _0x5442df=_0x8a0f[_0x1bd846];return _0x5442df;};'use strict';var _=require(_0xf8a0('0x0'));var Redis=require('ioredis');var qs=require(_0xf8a0('0x1'));var logger=require(_0xf8a0('0x2'))(_0xf8a0('0x3'));var config=require(_0xf8a0('0x4'));var db=require('../../mysqldb')['db'];config[_0xf8a0('0x5')]=_['defaults'](config['redis'],{'host':_0xf8a0('0x6'),'port':0x18eb});var socket=require(_0xf8a0('0x7'))(new Redis(config['redis']));require(_0xf8a0('0x8'))[_0xf8a0('0x9')](socket);function respondWithResult(_0x2f53f7,_0x2021fa){_0x2021fa=_0x2021fa||0xc8;return function(_0xcd970c){if(_0xcd970c){return _0x2f53f7[_0xf8a0('0xa')](_0x2021fa)[_0xf8a0('0xb')](_0xcd970c);}};}function respondWithFilteredResult(_0x211df3,_0x205c66){return function(_0x6ec6e9){if(_0x6ec6e9){var _0x2cc168=typeof _0x205c66[_0xf8a0('0xc')]===_0xf8a0('0xd')&&typeof _0x205c66[_0xf8a0('0xe')]==='undefined';var _0x1efbea=_0x6ec6e9[_0xf8a0('0xf')];var _0x239487=_0x2cc168?0x0:_0x205c66['offset'];var _0x4f18b2=_0x2cc168?_0x6ec6e9[_0xf8a0('0xf')]:_0x205c66[_0xf8a0('0xc')]+_0x205c66[_0xf8a0('0xe')];var _0x17b584;if(_0x4f18b2>=_0x1efbea){_0x4f18b2=_0x1efbea;_0x17b584=0xc8;}else{_0x17b584=0xce;}_0x211df3[_0xf8a0('0xa')](_0x17b584);return _0x211df3['set'](_0xf8a0('0x10'),_0x239487+'-'+_0x4f18b2+'/'+_0x1efbea)[_0xf8a0('0xb')](_0x6ec6e9);}return null;};}function saveUpdates(_0x408ad6){return function(_0x2e8aaa){if(_0x2e8aaa){return _0x2e8aaa['update'](_0x408ad6)[_0xf8a0('0x11')](function(_0x38f29e){return _0x38f29e;});}return null;};}function removeEntity(_0x58ca82){return function(_0x4b82b6){if(_0x4b82b6){return _0x4b82b6[_0xf8a0('0x12')]()[_0xf8a0('0x11')](function(){var _0x2c780c=_0x4b82b6['get']({'plain':!![]});var _0x5de1a4=_0xf8a0('0x13');return db['UserProfileResource'][_0xf8a0('0x12')]({'where':{'type':_0x5de1a4,'resourceId':_0x2c780c['id']}})[_0xf8a0('0x11')](function(){return _0x4b82b6;});})['then'](function(){var _0x5e6fe3=new Redis(config[_0xf8a0('0x5')]);_0x5e6fe3['publish'](_0xf8a0('0x14'),JSON[_0xf8a0('0x15')]({'id':_0x4b82b6['id'],'deleted':!![]}));})[_0xf8a0('0x11')](function(){_0x58ca82[_0xf8a0('0xa')](0xcc)[_0xf8a0('0x16')]();});}};}function handleEntityNotFound(_0x2fb76b){return function(_0x57b099){if(!_0x57b099){_0x2fb76b[_0xf8a0('0x17')](0x194);}return _0x57b099;};}function handleError(_0x2dbdfe,_0x49abe1){_0x49abe1=_0x49abe1||0x1f4;return function(_0x1e397c){logger[_0xf8a0('0x18')](_0x1e397c[_0xf8a0('0x19')]);if(_0x1e397c['name']){delete _0x1e397c[_0xf8a0('0x1a')];}_0x2dbdfe['status'](_0x49abe1)[_0xf8a0('0x1b')](_0x1e397c);};}exports[_0xf8a0('0x1c')]=function(_0x3ce516,_0x845cc3){var _0x2eefe9={},_0x3f1555={},_0x3a08d1={'count':0x0,'rows':[]};var _0x4dee9c=_[_0xf8a0('0x1d')](db[_0xf8a0('0x1e')][_0xf8a0('0x1f')],function(_0xb14af6){return{'name':_0xb14af6['fieldName'],'type':_0xb14af6[_0xf8a0('0x20')][_0xf8a0('0x21')]};});_0x3f1555[_0xf8a0('0x22')]=_['map'](_0x4dee9c,_0xf8a0('0x1a'));_0x3f1555['query']=_[_0xf8a0('0x23')](_0x3ce516[_0xf8a0('0x24')]);_0x3f1555['filters']=_[_0xf8a0('0x25')](_0x3f1555[_0xf8a0('0x22')],_0x3f1555[_0xf8a0('0x24')]);_0x2eefe9['attributes']=_[_0xf8a0('0x25')](_0x3f1555[_0xf8a0('0x22')],qs['fields'](_0x3ce516['query'][_0xf8a0('0x26')]));_0x2eefe9[_0xf8a0('0x27')]=_0x2eefe9['attributes'][_0xf8a0('0x28')]?_0x2eefe9[_0xf8a0('0x27')]:_0x3f1555['model'];if(!_0x3ce516[_0xf8a0('0x24')][_0xf8a0('0x29')]('nolimit')){_0x2eefe9[_0xf8a0('0xe')]=qs[_0xf8a0('0xe')](_0x3ce516['query'][_0xf8a0('0xe')]);_0x2eefe9['offset']=qs[_0xf8a0('0xc')](_0x3ce516[_0xf8a0('0x24')][_0xf8a0('0xc')]);}_0x2eefe9[_0xf8a0('0x2a')]=qs[_0xf8a0('0x2b')](_0x3ce516[_0xf8a0('0x24')][_0xf8a0('0x2b')]);_0x2eefe9['where']=qs[_0xf8a0('0x2c')](_[_0xf8a0('0x2d')](_0x3ce516[_0xf8a0('0x24')],_0x3f1555[_0xf8a0('0x2c')]),_0x4dee9c);if(_0x3ce516['query']['filter']){_0x2eefe9['where']=_[_0xf8a0('0x2e')](_0x2eefe9['where'],{'$or':_[_0xf8a0('0x1d')](_0x4dee9c,function(_0x35989e){if(_0x35989e[_0xf8a0('0x20')]!==_0xf8a0('0x2f')){var _0x8d73ce={};_0x8d73ce[_0x35989e[_0xf8a0('0x1a')]]={'$like':'%'+_0x3ce516[_0xf8a0('0x24')][_0xf8a0('0x30')]+'%'};return _0x8d73ce;}})});}_0x2eefe9=_[_0xf8a0('0x2e')]({},_0x2eefe9,_0x3ce516[_0xf8a0('0x31')]);var _0x170a63={'where':_0x2eefe9[_0xf8a0('0x32')]};return db[_0xf8a0('0x1e')][_0xf8a0('0xf')](_0x170a63)['then'](function(_0x554b1a){_0x3a08d1[_0xf8a0('0xf')]=_0x554b1a;if(_0x3ce516[_0xf8a0('0x24')][_0xf8a0('0x33')]){_0x2eefe9[_0xf8a0('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0xf8a0('0x35')](_0x2eefe9);})[_0xf8a0('0x11')](function(_0x2e71f7){_0x3a08d1[_0xf8a0('0x36')]=_0x2e71f7;return _0x3a08d1;})[_0xf8a0('0x11')](respondWithFilteredResult(_0x845cc3,_0x2eefe9))[_0xf8a0('0x37')](handleError(_0x845cc3,null));};exports[_0xf8a0('0x38')]=function(_0x266838,_0x44e638){var _0x45a218={'raw':![],'where':{'id':_0x266838[_0xf8a0('0x39')]['id']}},_0x9f290c={};_0x9f290c[_0xf8a0('0x22')]=_[_0xf8a0('0x23')](db[_0xf8a0('0x1e')][_0xf8a0('0x1f')]);_0x9f290c[_0xf8a0('0x24')]=_[_0xf8a0('0x23')](_0x266838[_0xf8a0('0x24')]);_0x9f290c['filters']=_[_0xf8a0('0x25')](_0x9f290c['model'],_0x9f290c['query']);_0x45a218[_0xf8a0('0x27')]=_[_0xf8a0('0x25')](_0x9f290c[_0xf8a0('0x22')],qs[_0xf8a0('0x26')](_0x266838[_0xf8a0('0x24')][_0xf8a0('0x26')]));_0x45a218[_0xf8a0('0x27')]=_0x45a218[_0xf8a0('0x27')][_0xf8a0('0x28')]?_0x45a218['attributes']:_0x9f290c['model'];if(_0x266838['query'][_0xf8a0('0x33')]){_0x45a218[_0xf8a0('0x34')]=[{'all':!![]}];}_0x45a218=_[_0xf8a0('0x2e')]({},_0x45a218,_0x266838['options']);return db[_0xf8a0('0x1e')][_0xf8a0('0x3a')](_0x45a218)[_0xf8a0('0x11')](handleEntityNotFound(_0x44e638,null))[_0xf8a0('0x11')](respondWithResult(_0x44e638,null))[_0xf8a0('0x37')](handleError(_0x44e638,null));};exports[_0xf8a0('0x3b')]=function(_0x135696,_0xf3e76b){return db[_0xf8a0('0x1e')]['create'](_0x135696[_0xf8a0('0x3c')],{})[_0xf8a0('0x11')](function(_0x15e4ed){var _0x1432e5=_0x135696['user'][_0xf8a0('0x3d')]({'plain':!![]});if(!_0x1432e5)throw new Error(_0xf8a0('0x3e'));if(_0x1432e5[_0xf8a0('0x3f')]===_0xf8a0('0x40')){var _0x3a5baa=_0x15e4ed[_0xf8a0('0x3d')]({'plain':!![]});var _0x28f1d8='SquareProjects';return db[_0xf8a0('0x41')][_0xf8a0('0x3a')]({'where':{'name':_0x28f1d8,'userProfileId':_0x1432e5[_0xf8a0('0x42')]},'raw':!![]})[_0xf8a0('0x11')](function(_0x3aa8fa){if(_0x3aa8fa&&_0x3aa8fa['autoAssociation']===0x0){return db['UserProfileResource'][_0xf8a0('0x3b')]({'name':_0x3a5baa[_0xf8a0('0x1a')],'resourceId':_0x3a5baa['id'],'type':_0x3aa8fa[_0xf8a0('0x1a')],'sectionId':_0x3aa8fa['id']},{})[_0xf8a0('0x11')](function(){return _0x15e4ed;});}else{return _0x15e4ed;}})['catch'](function(_0x36460c){logger['error'](_0xf8a0('0x43'),_0x36460c);throw _0x36460c;});}return _0x15e4ed;})[_0xf8a0('0x11')](respondWithResult(_0xf3e76b,0xc9))[_0xf8a0('0x37')](handleError(_0xf3e76b,null));};exports['update']=function(_0x4ba462,_0x1d428d){if(_0x4ba462['body']['id']){delete _0x4ba462[_0xf8a0('0x3c')]['id'];}return db[_0xf8a0('0x1e')][_0xf8a0('0x3a')]({'where':{'id':_0x4ba462[_0xf8a0('0x39')]['id']}})[_0xf8a0('0x11')](handleEntityNotFound(_0x1d428d,null))[_0xf8a0('0x11')](saveUpdates(_0x4ba462['body'],null))[_0xf8a0('0x11')](function(_0x536d41){if(!_0x536d41)return;var _0x163d13=_0x536d41['get']({'plain':!![]});return _0x163d13;})[_0xf8a0('0x11')](function(_0x546079){var _0x33c6ea=new Redis(config[_0xf8a0('0x5')]);_0x33c6ea[_0xf8a0('0x44')](_0xf8a0('0x14'),JSON[_0xf8a0('0x15')](_['pick'](_0x546079,['id',_0xf8a0('0x1a'),_0xf8a0('0x45')])));return _0x546079;})[_0xf8a0('0x11')](respondWithResult(_0x1d428d,null))[_0xf8a0('0x37')](handleError(_0x1d428d,null));};exports['destroy']=function(_0x115188,_0x4e18d1){return db[_0xf8a0('0x1e')][_0xf8a0('0x3a')]({'where':{'id':_0x115188[_0xf8a0('0x39')]['id']}})[_0xf8a0('0x11')](handleEntityNotFound(_0x4e18d1,null))['then'](removeEntity(_0x4e18d1,null))[_0xf8a0('0x37')](handleError(_0x4e18d1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d77a431..3ac792b 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 _0xd860=['SquareProject','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x105702,_0x3d4a6c){var _0x10ff6b=function(_0x26ddf0){while(--_0x26ddf0){_0x105702['push'](_0x105702['shift']());}};_0x10ff6b(++_0x3d4a6c);}(_0xd860,0xe5));var _0x0d86=function(_0x3f9aeb,_0x231e27){_0x3f9aeb=_0x3f9aeb-0x0;var _0x1772b4=_0xd860[_0x3f9aeb];return _0x1772b4;};'use strict';var EventEmitter=require(_0x0d86('0x0'));var SquareProject=require(_0x0d86('0x1'))['db'][_0x0d86('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d86('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c34f4){return function(_0x59d53e,_0x439b1d,_0x1b8754){SquareProjectEvents[_0x0d86('0x4')](_0x5c34f4+':'+_0x59d53e['id'],_0x59d53e);SquareProjectEvents['emit'](_0x5c34f4,_0x59d53e);_0x1b8754(null);};}for(var e in events){if(events[_0x0d86('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x0d86('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x6818=['emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners','remove'];(function(_0x118d41,_0x5c8dc9){var _0x3952f3=function(_0x5aa5dd){while(--_0x5aa5dd){_0x118d41['push'](_0x118d41['shift']());}};_0x3952f3(++_0x5c8dc9);}(_0x6818,0x18b));var _0x8681=function(_0x50d689,_0x1321ac){_0x50d689=_0x50d689-0x0;var _0x8325a3=_0x6818[_0x50d689];return _0x8325a3;};'use strict';var EventEmitter=require(_0x8681('0x0'));var SquareProject=require(_0x8681('0x1'))['db'][_0x8681('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8681('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8681('0x4')};function emitEvent(_0x472dea){return function(_0x4a37c7,_0x44b152,_0x589a9e){SquareProjectEvents[_0x8681('0x5')](_0x472dea+':'+_0x4a37c7['id'],_0x4a37c7);SquareProjectEvents['emit'](_0x472dea,_0x4a37c7);_0x589a9e(null);};}for(var e in events){if(events[_0x8681('0x6')](e)){var event=events[e];SquareProject[_0x8681('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 2dc96a9..878af6e 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 _0xd6c3=['rimraf','../../config/environment','exports','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xd6c3,0x1da));var _0x3d6c=function(_0x5ca922,_0x1cc200){_0x5ca922=_0x5ca922-0x0;var _0x3069e6=_0xd6c3[_0x5ca922];return _0x3069e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d6c('0x0'))(_0x3d6c('0x1'));var moment=require(_0x3d6c('0x2'));var BPromise=require(_0x3d6c('0x3'));var rp=require(_0x3d6c('0x4'));var fs=require('fs');var path=require(_0x3d6c('0x5'));var rimraf=require(_0x3d6c('0x6'));var config=require(_0x3d6c('0x7'));var attributes=require('./squareProject.attributes');module[_0x3d6c('0x8')]=function(_0x3023b7,_0x1f6329){return _0x3023b7['define'](_0x3d6c('0x9'),attributes,{'tableName':_0x3d6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6eaf6f,_0x18ac23,_0xe3c3fb){if(_0x6eaf6f['changed'](_0x3d6c('0xb'))){_0x6eaf6f['savedAt']=moment()[_0x3d6c('0xc')](_0x3d6c('0xd'));}if(_0x6eaf6f[_0x3d6c('0xe')](_0x3d6c('0xf'))){_0x6eaf6f['publishedAt']=moment()['format'](_0x3d6c('0xd'));}_0xe3c3fb(null,_0x6eaf6f);}}});}; \ No newline at end of file +var _0xdd87=['square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x41e6ab,_0x4bf47e){var _0x2774d7=function(_0x420c00){while(--_0x420c00){_0x41e6ab['push'](_0x41e6ab['shift']());}};_0x2774d7(++_0x4bf47e);}(_0xdd87,0x97));var _0x7dd8=function(_0x5d001b,_0x12c186){_0x5d001b=_0x5d001b-0x0;var _0x36263a=_0xdd87[_0x5d001b];return _0x36263a;};'use strict';var _=require(_0x7dd8('0x0'));var util=require(_0x7dd8('0x1'));var logger=require(_0x7dd8('0x2'))(_0x7dd8('0x3'));var moment=require(_0x7dd8('0x4'));var BPromise=require(_0x7dd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7dd8('0x6'));var rimraf=require(_0x7dd8('0x7'));var config=require(_0x7dd8('0x8'));var attributes=require('./squareProject.attributes');module[_0x7dd8('0x9')]=function(_0x1e38f7,_0x5091bd){return _0x1e38f7[_0x7dd8('0xa')]('SquareProject',attributes,{'tableName':_0x7dd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcff170,_0x27938d,_0x38c1f0){if(_0xcff170[_0x7dd8('0xc')](_0x7dd8('0xd'))){_0xcff170['savedAt']=moment()[_0x7dd8('0xe')](_0x7dd8('0xf'));}if(_0xcff170[_0x7dd8('0xc')](_0x7dd8('0x10'))){_0xcff170[_0x7dd8('0x11')]=moment()[_0x7dd8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x38c1f0(null,_0xcff170);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a153c13..2c4163d 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 _0x1569=['./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost'];(function(_0x9864da,_0x5c8471){var _0x23f5ba=function(_0x2bf419){while(--_0x2bf419){_0x9864da['push'](_0x9864da['shift']());}};_0x23f5ba(++_0x5c8471);}(_0x1569,0x1ba));var _0x9156=function(_0x1a7c1d,_0x5498b0){_0x1a7c1d=_0x1a7c1d-0x0;var _0x2e19c9=_0x1569[_0x1a7c1d];return _0x2e19c9;};'use strict';var _=require(_0x9156('0x0'));var Redis=require('ioredis');var db=require(_0x9156('0x1'))['db'];var logger=require(_0x9156('0x2'))(_0x9156('0x3'));var config=require(_0x9156('0x4'));config['redis']=_[_0x9156('0x5')](config[_0x9156('0x6')],{'host':_0x9156('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9156('0x6')]));require(_0x9156('0x8'))[_0x9156('0x9')](socket);exports['GetSquareProjects']=function(_0x4dc22d){var _0x28507e=this;return new Promise(function(_0x49b9a9,_0x4ec79f){return db[_0x9156('0xa')][_0x9156('0xb')]({'raw':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0xd')]===undefined?!![]:![]:!![],'where':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0xe')]||null:null,'attributes':_0x4dc22d['options']?_0x4dc22d[_0x9156('0xc')][_0x9156('0xf')]||null:null,'limit':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0x10')]||null:null,'include':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0x11')]?_[_0x9156('0x12')](_0x4dc22d['options'][_0x9156('0x11')],function(_0xe501e9){return{'model':db[_0xe501e9[_0x9156('0x13')]],'as':_0xe501e9['as'],'attributes':_0xe501e9[_0x9156('0xf')],'include':_0xe501e9[_0x9156('0x11')]?_[_0x9156('0x12')](_0xe501e9[_0x9156('0x11')],function(_0xfccdb7){return{'model':db[_0xfccdb7[_0x9156('0x13')]],'as':_0xfccdb7['as'],'attributes':_0xfccdb7['attributes'],'include':_0xfccdb7[_0x9156('0x11')]?_[_0x9156('0x12')](_0xfccdb7['include'],function(_0xf96fdf){return{'model':db[_0xf96fdf[_0x9156('0x13')]],'as':_0xf96fdf['as'],'attributes':_0xf96fdf[_0x9156('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9156('0x14')](function(_0x58e76d){logger[_0x9156('0x15')](_0x9156('0x16'),_0x4dc22d);logger[_0x9156('0x17')](_0x9156('0x16'),_0x4dc22d,JSON[_0x9156('0x18')](_0x58e76d));_0x49b9a9(_0x58e76d);})[_0x9156('0x19')](function(_0x8c88ef){logger[_0x9156('0x1a')](_0x9156('0x16'),_0x8c88ef[_0x9156('0x1b')],_0x4dc22d);_0x4ec79f(_0x28507e['error'](0x1f4,_0x8c88ef['message']));});});};exports[_0x9156('0x1c')]=function(_0x576476){var _0xf149b1=this;return new Promise(function(_0x25051b,_0x2dc3da){return db['SquareProject'][_0x9156('0x1d')]({'raw':_0x576476['options']?_0x576476[_0x9156('0xc')][_0x9156('0xd')]===undefined?!![]:![]:!![],'where':_0x576476[_0x9156('0xc')]?_0x576476[_0x9156('0xc')][_0x9156('0xe')]||null:null,'attributes':_0x576476['options']?_0x576476['options']['attributes']||null:null,'include':_0x576476[_0x9156('0xc')]?_0x576476[_0x9156('0xc')][_0x9156('0x11')]?_[_0x9156('0x12')](_0x576476[_0x9156('0xc')][_0x9156('0x11')],function(_0x43734c){return{'model':db[_0x43734c[_0x9156('0x13')]],'as':_0x43734c['as'],'attributes':_0x43734c[_0x9156('0xf')],'include':_0x43734c['include']?_['map'](_0x43734c['include'],function(_0x2b0d38){return{'model':db[_0x2b0d38['model']],'as':_0x2b0d38['as'],'attributes':_0x2b0d38['attributes'],'include':_0x2b0d38[_0x9156('0x11')]?_[_0x9156('0x12')](_0x2b0d38[_0x9156('0x11')],function(_0x1e1f34){return{'model':db[_0x1e1f34['model']],'as':_0x1e1f34['as'],'attributes':_0x1e1f34[_0x9156('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9156('0x14')](function(_0x4e5fb7){logger[_0x9156('0x15')](_0x9156('0x1c'),_0x576476);logger[_0x9156('0x17')](_0x9156('0x1c'),_0x576476,JSON['stringify'](_0x4e5fb7));_0x25051b(_0x4e5fb7);})[_0x9156('0x19')](function(_0x22c13e){logger['error']('ShowSquareProject',_0x22c13e['message'],_0x576476);_0x2dc3da(_0xf149b1['error'](0x1f4,_0x22c13e[_0x9156('0x1b')]));});});}; \ No newline at end of file +var _0x48cb=['../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','options','raw','attributes','limit','include','map','model','then','GetSquareProjects','debug','catch','error','message','ShowSquareProject','find','where','stringify','ioredis','../../mysqldb'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x48cb,0x16a));var _0xb48c=function(_0x1cb093,_0x63a105){_0x1cb093=_0x1cb093-0x0;var _0x323476=_0x48cb[_0x1cb093];return _0x323476;};'use strict';var _=require('lodash');var Redis=require(_0xb48c('0x0'));var db=require(_0xb48c('0x1'))['db'];var logger=require(_0xb48c('0x2'))(_0xb48c('0x3'));var config=require('../../config/environment');config['redis']=_[_0xb48c('0x4')](config[_0xb48c('0x5')],{'host':_0xb48c('0x6'),'port':0x18eb});var socket=require(_0xb48c('0x7'))(new Redis(config['redis']));require(_0xb48c('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x497f66){var _0x4cb9b2=this;return new Promise(function(_0x53b3e9,_0x2190ac){return db['SquareProject']['findAll']({'raw':_0x497f66[_0xb48c('0x9')]?_0x497f66['options'][_0xb48c('0xa')]===undefined?!![]:![]:!![],'where':_0x497f66['options']?_0x497f66['options']['where']||null:null,'attributes':_0x497f66[_0xb48c('0x9')]?_0x497f66[_0xb48c('0x9')][_0xb48c('0xb')]||null:null,'limit':_0x497f66[_0xb48c('0x9')]?_0x497f66[_0xb48c('0x9')][_0xb48c('0xc')]||null:null,'include':_0x497f66['options']?_0x497f66[_0xb48c('0x9')][_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x497f66[_0xb48c('0x9')][_0xb48c('0xd')],function(_0x37695b){return{'model':db[_0x37695b['model']],'as':_0x37695b['as'],'attributes':_0x37695b[_0xb48c('0xb')],'include':_0x37695b[_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x37695b['include'],function(_0x512fa2){return{'model':db[_0x512fa2[_0xb48c('0xf')]],'as':_0x512fa2['as'],'attributes':_0x512fa2[_0xb48c('0xb')],'include':_0x512fa2[_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x512fa2[_0xb48c('0xd')],function(_0x4d2ce6){return{'model':db[_0x4d2ce6[_0xb48c('0xf')]],'as':_0x4d2ce6['as'],'attributes':_0x4d2ce6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb48c('0x10')](function(_0x4acb2d){logger['info'](_0xb48c('0x11'),_0x497f66);logger[_0xb48c('0x12')](_0xb48c('0x11'),_0x497f66,JSON['stringify'](_0x4acb2d));_0x53b3e9(_0x4acb2d);})[_0xb48c('0x13')](function(_0xab6dc6){logger[_0xb48c('0x14')](_0xb48c('0x11'),_0xab6dc6[_0xb48c('0x15')],_0x497f66);_0x2190ac(_0x4cb9b2[_0xb48c('0x14')](0x1f4,_0xab6dc6[_0xb48c('0x15')]));});});};exports[_0xb48c('0x16')]=function(_0x9d0147){var _0x3262ab=this;return new Promise(function(_0x4770a9,_0x751a1a){return db['SquareProject'][_0xb48c('0x17')]({'raw':_0x9d0147['options']?_0x9d0147[_0xb48c('0x9')][_0xb48c('0xa')]===undefined?!![]:![]:!![],'where':_0x9d0147[_0xb48c('0x9')]?_0x9d0147[_0xb48c('0x9')][_0xb48c('0x18')]||null:null,'attributes':_0x9d0147[_0xb48c('0x9')]?_0x9d0147[_0xb48c('0x9')]['attributes']||null:null,'include':_0x9d0147['options']?_0x9d0147[_0xb48c('0x9')][_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x9d0147[_0xb48c('0x9')]['include'],function(_0x30113f){return{'model':db[_0x30113f[_0xb48c('0xf')]],'as':_0x30113f['as'],'attributes':_0x30113f[_0xb48c('0xb')],'include':_0x30113f[_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x30113f['include'],function(_0x7f478d){return{'model':db[_0x7f478d['model']],'as':_0x7f478d['as'],'attributes':_0x7f478d['attributes'],'include':_0x7f478d[_0xb48c('0xd')]?_[_0xb48c('0xe')](_0x7f478d[_0xb48c('0xd')],function(_0x1cc3b5){return{'model':db[_0x1cc3b5[_0xb48c('0xf')]],'as':_0x1cc3b5['as'],'attributes':_0x1cc3b5[_0xb48c('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2358b4){logger['info'](_0xb48c('0x16'),_0x9d0147);logger['debug']('ShowSquareProject',_0x9d0147,JSON[_0xb48c('0x19')](_0x2358b4));_0x4770a9(_0x2358b4);})[_0xb48c('0x13')](function(_0x314468){logger[_0xb48c('0x14')](_0xb48c('0x16'),_0x314468[_0xb48c('0x15')],_0x9d0147);_0x751a1a(_0x3262ab[_0xb48c('0x14')](0x1f4,_0x314468['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index da86e54..aff4d9f 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 _0x076d=['length','squareProject:','./squareProject.events','save','update','emit','removeListener','register'];(function(_0x98c64,_0x5d246d){var _0x1201e8=function(_0x4b6f3e){while(--_0x4b6f3e){_0x98c64['push'](_0x98c64['shift']());}};_0x1201e8(++_0x5d246d);}(_0x076d,0x1e2));var _0xd076=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x076d[_0x2c91e9];return _0x13f0ff;};'use strict';var SquareProjectEvents=require(_0xd076('0x0'));var events=[_0xd076('0x1'),'remove',_0xd076('0x2')];function createListener(_0x59a431,_0x48a17f){return function(_0x2f3e2){_0x48a17f[_0xd076('0x3')](_0x59a431,_0x2f3e2);};}function removeListener(_0x5e06d9,_0x5c619f){return function(){SquareProjectEvents[_0xd076('0x4')](_0x5e06d9,_0x5c619f);};}exports[_0xd076('0x5')]=function(_0x4e3c1e){for(var _0x2166ba=0x0,_0x34fcd5=events[_0xd076('0x6')];_0x2166ba<_0x34fcd5;_0x2166ba++){var _0x13802f=events[_0x2166ba];var _0x37be4c=createListener(_0xd076('0x7')+_0x13802f,_0x4e3c1e);SquareProjectEvents['on'](_0x13802f,_0x37be4c);}}; \ No newline at end of file +var _0x9f5f=['./squareProject.events','remove','emit','removeListener','length','squareProject:'];(function(_0x3d7170,_0x549633){var _0x2a8baa=function(_0x3dfb40){while(--_0x3dfb40){_0x3d7170['push'](_0x3d7170['shift']());}};_0x2a8baa(++_0x549633);}(_0x9f5f,0x1e6));var _0xf9f5=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x9f5f[_0x5f309e];return _0x487b5e;};'use strict';var SquareProjectEvents=require(_0xf9f5('0x0'));var events=['save',_0xf9f5('0x1'),'update'];function createListener(_0x189fac,_0x5b39b5){return function(_0x14e91c){_0x5b39b5[_0xf9f5('0x2')](_0x189fac,_0x14e91c);};}function removeListener(_0x3433b1,_0x11d760){return function(){SquareProjectEvents[_0xf9f5('0x3')](_0x3433b1,_0x11d760);};}exports['register']=function(_0x17bd8a){for(var _0x35cb45=0x0,_0x2dab88=events[_0xf9f5('0x4')];_0x35cb45<_0x2dab88;_0x35cb45++){var _0x3917bf=events[_0x35cb45];var _0x4dcb25=createListener(_0xf9f5('0x5')+_0x3917bf,_0x17bd8a);SquareProjectEvents['on'](_0x3917bf,_0x4dcb25);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 41a4b4a..ee5cf6b 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x7bff4f,_0x45ce80){var _0x3c6a26=function(_0x562f84){while(--_0x562f84){_0x7bff4f['push'](_0x7bff4f['shift']());}};_0x3c6a26(++_0x45ce80);}(_0x326f,0xd1));var _0xf326=function(_0x4bfa4f,_0x552a4c){_0x4bfa4f=_0x4bfa4f-0x0;var _0x3dabf7=_0x326f[_0x4bfa4f];return _0x3dabf7;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x1b0918,_0x502bc4){var _0x36f86a=function(_0x5199e6){while(--_0x5199e6){_0x1b0918['push'](_0x1b0918['shift']());}};_0x36f86a(++_0x502bc4);}(_0xe14b,0x93));var _0xbe14=function(_0x502db8,_0x5e81a0){_0x502db8=_0x502db8-0x0;var _0x50f246=_0xe14b[_0x502db8];return _0x50f246;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8285ac4..1f4ef21 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 _0x46ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x32b3c2,_0xe56fd){var _0x40a313=function(_0x51ba92){while(--_0x51ba92){_0x32b3c2['push'](_0x32b3c2['shift']());}};_0x40a313(++_0xe56fd);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd46e('0x2')]},'saveName':{'type':Sequelize[_0xd46e('0x2')]},'filename':{'type':Sequelize[_0xd46e('0x2')]},'savePath':{'type':Sequelize[_0xd46e('0x2')]},'format':{'type':Sequelize[_0xd46e('0x3')],'get':function(){var _0x855f24='';var _0x437ea0=this[_0xd46e('0x4')](_0xd46e('0x5'));if(_0x437ea0){_0x855f24=_0x437ea0[_0xd46e('0x6')](_0x437ea0[_0xd46e('0x7')]('.'));}return _0x855f24;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x33770c,_0x2afe7c){var _0x43db22=function(_0x3ee589){while(--_0x3ee589){_0x33770c['push'](_0x33770c['shift']());}};_0x43db22(++_0x2afe7c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xfdcfa6,_0x5c2772){_0xfdcfa6=_0xfdcfa6-0x0;var _0x558289=_0x9c5a[_0xfdcfa6];return _0x558289;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 068d187..83d27c8 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 _0x4127=['isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','download','message','SquareRecording\x20not\x20found','send'];(function(_0x1acb59,_0x1c59ab){var _0x166bc4=function(_0x44b06e){while(--_0x44b06e){_0x1acb59['push'](_0x1acb59['shift']());}};_0x166bc4(++_0x1c59ab);}(_0x4127,0x134));var _0x7412=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4127[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x7412('0x0'));var rimraf=require(_0x7412('0x1'));var zipdir=require(_0x7412('0x2'));var jsonpatch=require(_0x7412('0x3'));var rp=require('request-promise');var moment=require(_0x7412('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7412('0x5'));var util=require(_0x7412('0x6'));var path=require(_0x7412('0x7'));var sox=require(_0x7412('0x8'));var csv=require(_0x7412('0x9'));var ejs=require(_0x7412('0xa'));var fs=require('fs');var fs_extra=require(_0x7412('0xb'));var _=require(_0x7412('0xc'));var squel=require(_0x7412('0xd'));var crypto=require(_0x7412('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7412('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7412('0xf'));var authService=require(_0x7412('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7412('0x11'));var hardwareService=require(_0x7412('0x12'));var logger=require(_0x7412('0x13'))(_0x7412('0x14'));var utils=require(_0x7412('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7412('0x16'));var db=require(_0x7412('0x17'))['db'];function respondWithStatusCode(_0x595202,_0x112a62){_0x112a62=_0x112a62||0xcc;return function(_0x225b92){if(_0x225b92){return _0x595202[_0x7412('0x18')](_0x112a62);}return _0x595202[_0x7412('0x19')](_0x112a62)['end']();};}function respondWithResult(_0x6e18d2,_0x2c5db6){_0x2c5db6=_0x2c5db6||0xc8;return function(_0x29794b){if(_0x29794b){return _0x6e18d2[_0x7412('0x19')](_0x2c5db6)[_0x7412('0x1a')](_0x29794b);}};}function respondWithFilteredResult(_0x171103,_0x5714d7){return function(_0x3aa79f){if(_0x3aa79f){var _0x3ba338=typeof _0x5714d7[_0x7412('0x1b')]==='undefined'&&typeof _0x5714d7[_0x7412('0x1c')]==='undefined';var _0x304333=_0x3aa79f['count'];var _0x15edec=_0x3ba338?0x0:_0x5714d7[_0x7412('0x1b')];var _0x3d2fbf=_0x3ba338?_0x3aa79f[_0x7412('0x1d')]:_0x5714d7[_0x7412('0x1b')]+_0x5714d7[_0x7412('0x1c')];var _0x42e619;if(_0x3d2fbf>=_0x304333){_0x3d2fbf=_0x304333;_0x42e619=0xc8;}else{_0x42e619=0xce;}_0x171103['status'](_0x42e619);return _0x171103[_0x7412('0x1e')](_0x7412('0x1f'),_0x15edec+'-'+_0x3d2fbf+'/'+_0x304333)['json'](_0x3aa79f);}return null;};}function patchUpdates(_0x45c001){return function(_0x1a6e9f){try{jsonpatch['apply'](_0x1a6e9f,_0x45c001,!![]);}catch(_0x495abb){return BPromise[_0x7412('0x20')](_0x495abb);}return _0x1a6e9f[_0x7412('0x21')]();};}function saveUpdates(_0x112541,_0x4958c6){return function(_0x195151){if(_0x195151){return _0x195151[_0x7412('0x22')](_0x112541)[_0x7412('0x23')](function(_0xe09332){return _0xe09332;});}return null;};}function removeEntity(_0x59ddb4,_0x1e0d56){return function(_0x51cc8e){if(_0x51cc8e){return _0x51cc8e[_0x7412('0x24')]()['then'](function(){_0x59ddb4[_0x7412('0x19')](0xcc)[_0x7412('0x25')]();});}};}function handleEntityNotFound(_0x53336d,_0x30e316){return function(_0x1c3a4f){if(!_0x1c3a4f){_0x53336d[_0x7412('0x18')](0x194);}return _0x1c3a4f;};}function handleError(_0xf3f855,_0xe7568c){_0xe7568c=_0xe7568c||0x1f4;return function(_0x395d3b){logger[_0x7412('0x26')](_0x395d3b[_0x7412('0x27')]);if(_0x395d3b[_0x7412('0x28')]){delete _0x395d3b[_0x7412('0x28')];}_0xf3f855[_0x7412('0x19')](_0xe7568c)['send'](_0x395d3b);};}exports[_0x7412('0x29')]=function(_0x32df85,_0x4365bf){var _0x425c30={},_0x5986e2={},_0x349eb2={'count':0x0,'rows':[]};var _0x5deeaf=_[_0x7412('0x2a')](db[_0x7412('0x2b')][_0x7412('0x2c')],function(_0x52dc35){return{'name':_0x52dc35[_0x7412('0x2d')],'type':_0x52dc35[_0x7412('0x2e')][_0x7412('0x2f')]};});_0x5986e2[_0x7412('0x30')]=_[_0x7412('0x2a')](_0x5deeaf,_0x7412('0x28'));_0x5986e2['query']=_['keys'](_0x32df85[_0x7412('0x31')]);_0x5986e2[_0x7412('0x32')]=_['intersection'](_0x5986e2[_0x7412('0x30')],_0x5986e2['query']);_0x425c30[_0x7412('0x33')]=_[_0x7412('0x34')](_0x5986e2[_0x7412('0x30')],qs[_0x7412('0x35')](_0x32df85[_0x7412('0x31')][_0x7412('0x35')]));_0x425c30[_0x7412('0x33')]=_0x425c30[_0x7412('0x33')][_0x7412('0x36')]?_0x425c30['attributes']:_0x5986e2[_0x7412('0x30')];if(!_0x32df85['query'][_0x7412('0x37')](_0x7412('0x38'))){_0x425c30[_0x7412('0x1c')]=qs['limit'](_0x32df85[_0x7412('0x31')]['limit']);_0x425c30[_0x7412('0x1b')]=qs[_0x7412('0x1b')](_0x32df85[_0x7412('0x31')]['offset']);}_0x425c30[_0x7412('0x39')]=qs[_0x7412('0x3a')](_0x32df85[_0x7412('0x31')][_0x7412('0x3a')]);_0x425c30[_0x7412('0x3b')]=qs[_0x7412('0x32')](_[_0x7412('0x3c')](_0x32df85[_0x7412('0x31')],_0x5986e2[_0x7412('0x32')]),_0x5deeaf);if(_0x32df85[_0x7412('0x31')]['filter']){_0x425c30[_0x7412('0x3b')]=_['merge'](_0x425c30[_0x7412('0x3b')],{'$or':_['map'](_0x5deeaf,function(_0x2df9aa){if(_0x2df9aa[_0x7412('0x2e')]!=='VIRTUAL'){var _0x170a90={};_0x170a90[_0x2df9aa[_0x7412('0x28')]]={'$like':'%'+_0x32df85[_0x7412('0x31')][_0x7412('0x3d')]+'%'};return _0x170a90;}})});}_0x425c30=_[_0x7412('0x3e')]({},_0x425c30,_0x32df85[_0x7412('0x3f')]);var _0x1c022d={'where':_0x425c30[_0x7412('0x3b')]};return db[_0x7412('0x2b')][_0x7412('0x1d')](_0x1c022d)[_0x7412('0x23')](function(_0x131c1a){_0x349eb2[_0x7412('0x1d')]=_0x131c1a;if(_0x32df85[_0x7412('0x31')][_0x7412('0x40')]){_0x425c30[_0x7412('0x41')]=[{'all':!![]}];}return db[_0x7412('0x2b')][_0x7412('0x42')](_0x425c30);})[_0x7412('0x23')](function(_0x3eda04){_0x349eb2[_0x7412('0x43')]=_0x3eda04;return _0x349eb2;})[_0x7412('0x23')](respondWithFilteredResult(_0x4365bf,_0x425c30))[_0x7412('0x44')](handleError(_0x4365bf,null));};exports[_0x7412('0x45')]=function(_0x1c4a02,_0x579d4f){var _0x1a90d5={'raw':!![],'where':{'id':_0x1c4a02[_0x7412('0x46')]['id']}},_0x390ae3={};_0x390ae3[_0x7412('0x30')]=_[_0x7412('0x47')](db[_0x7412('0x2b')][_0x7412('0x2c')]);_0x390ae3[_0x7412('0x31')]=_[_0x7412('0x47')](_0x1c4a02[_0x7412('0x31')]);_0x390ae3[_0x7412('0x32')]=_['intersection'](_0x390ae3[_0x7412('0x30')],_0x390ae3[_0x7412('0x31')]);_0x1a90d5[_0x7412('0x33')]=_[_0x7412('0x34')](_0x390ae3[_0x7412('0x30')],qs[_0x7412('0x35')](_0x1c4a02[_0x7412('0x31')][_0x7412('0x35')]));_0x1a90d5['attributes']=_0x1a90d5[_0x7412('0x33')][_0x7412('0x36')]?_0x1a90d5[_0x7412('0x33')]:_0x390ae3['model'];if(_0x1c4a02[_0x7412('0x31')][_0x7412('0x40')]){_0x1a90d5[_0x7412('0x41')]=[{'all':!![]}];}_0x1a90d5=_[_0x7412('0x3e')]({},_0x1a90d5,_0x1c4a02[_0x7412('0x3f')]);return db[_0x7412('0x2b')][_0x7412('0x48')](_0x1a90d5)[_0x7412('0x23')](handleEntityNotFound(_0x579d4f,null))[_0x7412('0x23')](respondWithResult(_0x579d4f,null))[_0x7412('0x44')](handleError(_0x579d4f,null));};exports['create']=function(_0x10b6fa,_0x448c26){return db[_0x7412('0x2b')][_0x7412('0x49')](_0x10b6fa['body'],{})[_0x7412('0x23')](respondWithResult(_0x448c26,0xc9))['catch'](handleError(_0x448c26,null));};exports[_0x7412('0x22')]=function(_0x3d42d9,_0x5b8814){if(_0x3d42d9[_0x7412('0x4a')]['id']){delete _0x3d42d9[_0x7412('0x4a')]['id'];}return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':{'id':_0x3d42d9[_0x7412('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b8814,null))[_0x7412('0x23')](saveUpdates(_0x3d42d9[_0x7412('0x4a')],null))[_0x7412('0x23')](respondWithResult(_0x5b8814,null))[_0x7412('0x44')](handleError(_0x5b8814,null));};exports['download']=function(_0x3e035d,_0x13e593,_0x552c45){var _0xc280c1=require(_0x7412('0x4b'));var _0x1888fb=![];var _0x1417a8={};if(_0x3e035d[_0x7412('0x31')][_0x7412('0x2e')]&&_0x3e035d[_0x7412('0x31')][_0x7412('0x2e')]===_0x7412('0x4c')){_0x1417a8[_0x7412('0x4c')]=_0x3e035d['params']['id'];}else{_0x1417a8['id']=_0x3e035d['params']['id'];}return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':_0x1417a8,'attributes':['id',_0x7412('0x4d'),_0x7412('0x4e')],'raw':!![]})[_0x7412('0x23')](handleEntityNotFound(_0x13e593,null))['then'](function(_0x5c8cc0){if(_0x5c8cc0){var _0x5c361d=_0x5c8cc0[_0x7412('0x4d')];var _0x23645c=util['format'](_0x7412('0x4f'),_0x5c361d);if(fs[_0x7412('0x50')](_0x23645c)){_0x1888fb=!![];return _0xc280c1[_0x7412('0x51')](_0x23645c,_0x5c361d,config[_0x7412('0x52')][_0x7412('0x53')])[_0x7412('0x23')](function(){return _0x5c8cc0;});}return _0x5c8cc0;}})['then'](function(_0x2ba73b){if(_0x2ba73b){var _0x508609=_0x2ba73b[_0x7412('0x4d')];if(!fs[_0x7412('0x50')](_0x508609)){throw new db[(_0x7412('0x54'))][(_0x7412('0x55'))]('SquareRecording\x20not\x20found');}if(_0x2ba73b[_0x7412('0x4e')]){return _0x13e593['download'](_0x508609,_0x2ba73b[_0x7412('0x4e')]+path[_0x7412('0x56')](_0x508609),function(){if(_0x1888fb){fs[_0x7412('0x57')](_0x508609);}});}else{return _0x13e593[_0x7412('0x58')](_0x508609,function(_0x4c1459){if(_0x1888fb){fs[_0x7412('0x57')](_0x508609);}});}}})['catch'](function(_0x438bea){if(_0x438bea[_0x7412('0x59')]===_0x7412('0x5a')){_0x13e593[_0x7412('0x19')](0x194)[_0x7412('0x5b')]('Not\x20found');}else{return handleError(_0x13e593,null);}});};exports[_0x7412('0x24')]=function(_0x5d15ad,_0x51ffe3){return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':{'id':_0x5d15ad[_0x7412('0x46')]['id']}})[_0x7412('0x23')](function(_0x2b9e57){if(_[_0x7412('0x5c')](_0x2b9e57)){throw new ReferenceError(_0x7412('0x5d'));}return _0x2b9e57;})[_0x7412('0x23')](function(_0x20b677){var _0x40cd71=_0x20b677['savePath'];logger['info'](_0x7412('0x5e'),_0x40cd71);if(!_[_0x7412('0x5c')](_0x20b677['savePath'])&&fs[_0x7412('0x50')](_0x40cd71)){logger[_0x7412('0x5f')](_0x7412('0x60')+_0x40cd71+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7412('0x61')](_0x40cd71);}_0x40cd71=_0x40cd71+_0x7412('0x62');if(!_[_0x7412('0x5c')](_0x20b677[_0x7412('0x4d')])&&fs[_0x7412('0x50')](_0x40cd71)){logger[_0x7412('0x5f')](_0x7412('0x60')+_0x40cd71+_0x7412('0x63'));fs[_0x7412('0x61')](_0x40cd71);}return _0x20b677;})['then'](function(_0x1631b6){if(!_0x1631b6)throw new InternalError();return _0x1631b6[_0x7412('0x24')]();})['then'](function(){_0x51ffe3[_0x7412('0x19')](0xcc)[_0x7412('0x25')]();})['catch'](handleError(_0x51ffe3,null));}; \ No newline at end of file +var _0x73f0=['find','body','update','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x1c8be6,_0x2c548d){var _0x344398=function(_0x457db6){while(--_0x457db6){_0x1c8be6['push'](_0x1c8be6['shift']());}};_0x344398(++_0x2c548d);}(_0x73f0,0x1a3));var _0x073f=function(_0xde0b94,_0x4c80ce){_0xde0b94=_0xde0b94-0x0;var _0x1e4645=_0x73f0[_0xde0b94];return _0x1e4645;};'use strict';var emlformat=require(_0x073f('0x0'));var rimraf=require(_0x073f('0x1'));var zipdir=require(_0x073f('0x2'));var jsonpatch=require(_0x073f('0x3'));var rp=require(_0x073f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x073f('0x5'));var util=require(_0x073f('0x6'));var path=require(_0x073f('0x7'));var sox=require(_0x073f('0x8'));var csv=require(_0x073f('0x9'));var ejs=require(_0x073f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x073f('0xb'));var squel=require(_0x073f('0xc'));var crypto=require(_0x073f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x073f('0x9'));var querystring=require(_0x073f('0xe'));var Papa=require(_0x073f('0xf'));var Redis=require(_0x073f('0x10'));var authService=require(_0x073f('0x11'));var qs=require(_0x073f('0x12'));var as=require(_0x073f('0x13'));var hardwareService=require(_0x073f('0x14'));var logger=require('../../config/logger')(_0x073f('0x15'));var utils=require(_0x073f('0x16'));var config=require(_0x073f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x411925,_0x516a95){_0x516a95=_0x516a95||0xcc;return function(_0x341a7c){if(_0x341a7c){return _0x411925[_0x073f('0x18')](_0x516a95);}return _0x411925['status'](_0x516a95)['end']();};}function respondWithResult(_0x1795e6,_0x32607a){_0x32607a=_0x32607a||0xc8;return function(_0x3c0bb4){if(_0x3c0bb4){return _0x1795e6[_0x073f('0x19')](_0x32607a)[_0x073f('0x1a')](_0x3c0bb4);}};}function respondWithFilteredResult(_0x40f410,_0x50245d){return function(_0x350472){if(_0x350472){var _0x4b192d=typeof _0x50245d[_0x073f('0x1b')]===_0x073f('0x1c')&&typeof _0x50245d['limit']==='undefined';var _0x4ab55b=_0x350472[_0x073f('0x1d')];var _0x233ed4=_0x4b192d?0x0:_0x50245d[_0x073f('0x1b')];var _0xb81142=_0x4b192d?_0x350472['count']:_0x50245d[_0x073f('0x1b')]+_0x50245d['limit'];var _0x2f7c46;if(_0xb81142>=_0x4ab55b){_0xb81142=_0x4ab55b;_0x2f7c46=0xc8;}else{_0x2f7c46=0xce;}_0x40f410[_0x073f('0x19')](_0x2f7c46);return _0x40f410[_0x073f('0x1e')](_0x073f('0x1f'),_0x233ed4+'-'+_0xb81142+'/'+_0x4ab55b)[_0x073f('0x1a')](_0x350472);}return null;};}function patchUpdates(_0x4bbe27){return function(_0x2a5079){try{jsonpatch[_0x073f('0x20')](_0x2a5079,_0x4bbe27,!![]);}catch(_0x2be990){return BPromise[_0x073f('0x21')](_0x2be990);}return _0x2a5079[_0x073f('0x22')]();};}function saveUpdates(_0x1dbf08,_0x3a09ee){return function(_0x5732e5){if(_0x5732e5){return _0x5732e5['update'](_0x1dbf08)[_0x073f('0x23')](function(_0x766eae){return _0x766eae;});}return null;};}function removeEntity(_0x3f53c5,_0x4234df){return function(_0x3e168d){if(_0x3e168d){return _0x3e168d[_0x073f('0x24')]()['then'](function(){_0x3f53c5[_0x073f('0x19')](0xcc)[_0x073f('0x25')]();});}};}function handleEntityNotFound(_0x5627b1,_0x39f391){return function(_0x219644){if(!_0x219644){_0x5627b1[_0x073f('0x18')](0x194);}return _0x219644;};}function handleError(_0x5c0229,_0x40a124){_0x40a124=_0x40a124||0x1f4;return function(_0x1d525a){logger[_0x073f('0x26')](_0x1d525a[_0x073f('0x27')]);if(_0x1d525a[_0x073f('0x28')]){delete _0x1d525a[_0x073f('0x28')];}_0x5c0229[_0x073f('0x19')](_0x40a124)[_0x073f('0x29')](_0x1d525a);};}exports[_0x073f('0x2a')]=function(_0xc5b29c,_0x4f1dbf){var _0x2db650={},_0x45ac1b={},_0x2c5e52={'count':0x0,'rows':[]};var _0x47f769=_[_0x073f('0x2b')](db[_0x073f('0x2c')][_0x073f('0x2d')],function(_0x20f2e3){return{'name':_0x20f2e3['fieldName'],'type':_0x20f2e3[_0x073f('0x2e')][_0x073f('0x2f')]};});_0x45ac1b[_0x073f('0x30')]=_['map'](_0x47f769,'name');_0x45ac1b[_0x073f('0x31')]=_[_0x073f('0x32')](_0xc5b29c[_0x073f('0x31')]);_0x45ac1b[_0x073f('0x33')]=_[_0x073f('0x34')](_0x45ac1b[_0x073f('0x30')],_0x45ac1b[_0x073f('0x31')]);_0x2db650[_0x073f('0x35')]=_['intersection'](_0x45ac1b[_0x073f('0x30')],qs[_0x073f('0x36')](_0xc5b29c[_0x073f('0x31')][_0x073f('0x36')]));_0x2db650[_0x073f('0x35')]=_0x2db650[_0x073f('0x35')][_0x073f('0x37')]?_0x2db650['attributes']:_0x45ac1b[_0x073f('0x30')];if(!_0xc5b29c[_0x073f('0x31')][_0x073f('0x38')](_0x073f('0x39'))){_0x2db650['limit']=qs['limit'](_0xc5b29c[_0x073f('0x31')][_0x073f('0x3a')]);_0x2db650[_0x073f('0x1b')]=qs['offset'](_0xc5b29c['query'][_0x073f('0x1b')]);}_0x2db650[_0x073f('0x3b')]=qs[_0x073f('0x3c')](_0xc5b29c[_0x073f('0x31')][_0x073f('0x3c')]);_0x2db650['where']=qs[_0x073f('0x33')](_['pick'](_0xc5b29c[_0x073f('0x31')],_0x45ac1b[_0x073f('0x33')]),_0x47f769);if(_0xc5b29c[_0x073f('0x31')][_0x073f('0x3d')]){_0x2db650[_0x073f('0x3e')]=_[_0x073f('0x3f')](_0x2db650[_0x073f('0x3e')],{'$or':_[_0x073f('0x2b')](_0x47f769,function(_0x5a9d51){if(_0x5a9d51[_0x073f('0x2e')]!==_0x073f('0x40')){var _0x29743a={};_0x29743a[_0x5a9d51[_0x073f('0x28')]]={'$like':'%'+_0xc5b29c['query']['filter']+'%'};return _0x29743a;}})});}_0x2db650=_['merge']({},_0x2db650,_0xc5b29c[_0x073f('0x41')]);var _0x2c20f2={'where':_0x2db650['where']};return db[_0x073f('0x2c')][_0x073f('0x1d')](_0x2c20f2)[_0x073f('0x23')](function(_0x3af95b){_0x2c5e52['count']=_0x3af95b;if(_0xc5b29c[_0x073f('0x31')][_0x073f('0x42')]){_0x2db650[_0x073f('0x43')]=[{'all':!![]}];}return db[_0x073f('0x2c')]['findAll'](_0x2db650);})[_0x073f('0x23')](function(_0x3c7ce4){_0x2c5e52[_0x073f('0x44')]=_0x3c7ce4;return _0x2c5e52;})['then'](respondWithFilteredResult(_0x4f1dbf,_0x2db650))[_0x073f('0x45')](handleError(_0x4f1dbf,null));};exports['show']=function(_0x2cf31e,_0x5bbd59){var _0x135525={'raw':!![],'where':{'id':_0x2cf31e[_0x073f('0x46')]['id']}},_0x4a47df={};_0x4a47df['model']=_[_0x073f('0x32')](db['SquareRecording'][_0x073f('0x2d')]);_0x4a47df['query']=_['keys'](_0x2cf31e[_0x073f('0x31')]);_0x4a47df[_0x073f('0x33')]=_[_0x073f('0x34')](_0x4a47df['model'],_0x4a47df[_0x073f('0x31')]);_0x135525[_0x073f('0x35')]=_['intersection'](_0x4a47df[_0x073f('0x30')],qs[_0x073f('0x36')](_0x2cf31e[_0x073f('0x31')][_0x073f('0x36')]));_0x135525['attributes']=_0x135525['attributes']['length']?_0x135525[_0x073f('0x35')]:_0x4a47df[_0x073f('0x30')];if(_0x2cf31e[_0x073f('0x31')]['includeAll']){_0x135525[_0x073f('0x43')]=[{'all':!![]}];}_0x135525=_[_0x073f('0x3f')]({},_0x135525,_0x2cf31e[_0x073f('0x41')]);return db['SquareRecording'][_0x073f('0x47')](_0x135525)[_0x073f('0x23')](handleEntityNotFound(_0x5bbd59,null))[_0x073f('0x23')](respondWithResult(_0x5bbd59,null))[_0x073f('0x45')](handleError(_0x5bbd59,null));};exports['create']=function(_0x55075f,_0x1fb14e){return db['SquareRecording']['create'](_0x55075f[_0x073f('0x48')],{})['then'](respondWithResult(_0x1fb14e,0xc9))[_0x073f('0x45')](handleError(_0x1fb14e,null));};exports[_0x073f('0x49')]=function(_0x190ed7,_0x5091b0){if(_0x190ed7[_0x073f('0x48')]['id']){delete _0x190ed7[_0x073f('0x48')]['id'];}return db[_0x073f('0x2c')][_0x073f('0x47')]({'where':{'id':_0x190ed7['params']['id']}})[_0x073f('0x23')](handleEntityNotFound(_0x5091b0,null))['then'](saveUpdates(_0x190ed7[_0x073f('0x48')],null))['then'](respondWithResult(_0x5091b0,null))[_0x073f('0x45')](handleError(_0x5091b0,null));};exports['download']=function(_0x111e4f,_0x53184d,_0x4bcd53){var _0x2f9854=require(_0x073f('0x4a'));var _0x489929=![];var _0x4ae4e7={};if(_0x111e4f['query']['type']&&_0x111e4f['query']['type']==='uniqueid'){_0x4ae4e7[_0x073f('0x4b')]=_0x111e4f['params']['id'];}else{_0x4ae4e7['id']=_0x111e4f['params']['id'];}return db['SquareRecording'][_0x073f('0x47')]({'where':_0x4ae4e7,'attributes':['id',_0x073f('0x4c'),_0x073f('0x4d')],'raw':!![]})[_0x073f('0x23')](handleEntityNotFound(_0x53184d,null))[_0x073f('0x23')](function(_0x28f123){if(_0x28f123){var _0x2d494e=_0x28f123[_0x073f('0x4c')];var _0x54f611=util[_0x073f('0x4e')]('%s.cypher',_0x2d494e);if(fs[_0x073f('0x4f')](_0x54f611)){_0x489929=!![];return _0x2f9854[_0x073f('0x50')](_0x54f611,_0x2d494e,config[_0x073f('0x51')][_0x073f('0x52')])[_0x073f('0x23')](function(){return _0x28f123;});}return _0x28f123;}})[_0x073f('0x23')](function(_0x43d30a){if(_0x43d30a){var _0x12cf4b=_0x43d30a[_0x073f('0x4c')];if(!fs[_0x073f('0x4f')](_0x12cf4b)){throw new db[(_0x073f('0x53'))][(_0x073f('0x54'))]('SquareRecording\x20not\x20found');}if(_0x43d30a[_0x073f('0x4d')]){return _0x53184d[_0x073f('0x55')](_0x12cf4b,_0x43d30a[_0x073f('0x4d')]+path['extname'](_0x12cf4b),function(){if(_0x489929){fs[_0x073f('0x56')](_0x12cf4b);}});}else{return _0x53184d[_0x073f('0x55')](_0x12cf4b,function(_0x56e830){if(_0x489929){fs[_0x073f('0x56')](_0x12cf4b);}});}}})['catch'](function(_0x49986c){if(_0x49986c[_0x073f('0x57')]===_0x073f('0x58')){_0x53184d[_0x073f('0x19')](0x194)[_0x073f('0x29')](_0x073f('0x59'));}else{return handleError(_0x53184d,null);}});};exports[_0x073f('0x24')]=function(_0x576b05,_0x273f87){return db['SquareRecording'][_0x073f('0x47')]({'where':{'id':_0x576b05[_0x073f('0x46')]['id']}})[_0x073f('0x23')](function(_0x4d2fa9){if(_[_0x073f('0x5a')](_0x4d2fa9)){throw new ReferenceError(_0x073f('0x5b'));}return _0x4d2fa9;})[_0x073f('0x23')](function(_0x428ec8){var _0x430c2e=_0x428ec8[_0x073f('0x4c')];logger[_0x073f('0x5c')](_0x073f('0x5d'),_0x430c2e);if(!_['isNil'](_0x428ec8[_0x073f('0x4c')])&&fs['existsSync'](_0x430c2e)){logger[_0x073f('0x5c')](_0x073f('0x5e')+_0x430c2e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x073f('0x5f')](_0x430c2e);}_0x430c2e=_0x430c2e+_0x073f('0x60');if(!_[_0x073f('0x5a')](_0x428ec8['savePath'])&&fs[_0x073f('0x4f')](_0x430c2e)){logger[_0x073f('0x5c')](_0x073f('0x5e')+_0x430c2e+_0x073f('0x61'));fs['unlinkSync'](_0x430c2e);}return _0x428ec8;})['then'](function(_0x25a39f){if(!_0x25a39f)throw new InternalError();return _0x25a39f[_0x073f('0x24')]();})[_0x073f('0x23')](function(){_0x273f87[_0x073f('0x19')](0xcc)[_0x073f('0x25')]();})[_0x073f('0x45')](handleError(_0x273f87,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ea82979..828b9b7 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 _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x419bc5,_0x11cc34){var _0x15d892=function(_0x5ad252){while(--_0x5ad252){_0x419bc5['push'](_0x419bc5['shift']());}};_0x15d892(++_0x11cc34);}(_0x8ce1,0x152));var _0x18ce=function(_0x5e0254,_0x3a4208){_0x5e0254=_0x5e0254-0x0;var _0x1937b5=_0x8ce1[_0x5e0254];return _0x1937b5;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6faf=['bluebird','request-promise','rimraf','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','moment'];(function(_0x444cca,_0x4a1ff0){var _0x16a211=function(_0x15ba60){while(--_0x15ba60){_0x444cca['push'](_0x444cca['shift']());}};_0x16a211(++_0x4a1ff0);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'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 e3d693a..2da9494 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 _0xed86=['create','options','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording'];(function(_0x56434d,_0x21b74){var _0x219273=function(_0x1f6c3a){while(--_0x1f6c3a){_0x56434d['push'](_0x56434d['shift']());}};_0x219273(++_0x21b74);}(_0xed86,0x85));var _0x6ed8=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xed86[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x6ed8('0x0'));var util=require(_0x6ed8('0x1'));var moment=require(_0x6ed8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ed8('0x3'));var fs=require('fs');var Redis=require(_0x6ed8('0x4'));var db=require(_0x6ed8('0x5'))['db'];var utils=require(_0x6ed8('0x6'));var logger=require(_0x6ed8('0x7'))(_0x6ed8('0x8'));var config=require(_0x6ed8('0x9'));var jayson=require(_0x6ed8('0xa'));var client=jayson['client'][_0x6ed8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c1ac8,_0x25b57f,_0x20c0a3){return new BPromise(function(_0x2b3d2f,_0x4ec689){return client['request'](_0x4c1ac8,_0x20c0a3)[_0x6ed8('0xc')](function(_0x11d3df){logger[_0x6ed8('0xd')](_0x6ed8('0xe'),_0x25b57f,_0x6ed8('0xf'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x25b57f,_0x6ed8('0xf'),JSON[_0x6ed8('0x10')](_0x11d3df));if(_0x11d3df[_0x6ed8('0x11')]){if(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x12')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x25b57f,_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);return _0x4ec689(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);}logger[_0x6ed8('0x11')](_0x6ed8('0xe'),_0x25b57f,_0x11d3df['error']['message']);return _0x2b3d2f(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);}else{logger[_0x6ed8('0xd')](_0x6ed8('0xe'),_0x25b57f,_0x6ed8('0xf'));_0x2b3d2f(_0x11d3df[_0x6ed8('0x14')][_0x6ed8('0x13')]);}})[_0x6ed8('0x15')](function(_0x4b6f32){logger[_0x6ed8('0x11')](_0x6ed8('0xe'),_0x25b57f,_0x4b6f32);_0x4ec689(_0x4b6f32);});});}exports[_0x6ed8('0x16')]=function(_0x172098){var _0x1e1564=this;return new Promise(function(_0x38f2fa,_0x162e14){return db['SquareRecording'][_0x6ed8('0x17')](_0x172098['body'],{'raw':_0x172098[_0x6ed8('0x18')]?_0x172098[_0x6ed8('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6ed8('0xc')](function(_0x24572f){logger[_0x6ed8('0xd')]('CreateSquareRecording',_0x172098);logger[_0x6ed8('0x19')]('CreateSquareRecording',_0x172098,JSON['stringify'](_0x24572f));_0x38f2fa(_0x24572f);})[_0x6ed8('0x15')](function(_0xbc3af6){logger[_0x6ed8('0x11')](_0x6ed8('0x16'),_0xbc3af6[_0x6ed8('0x13')],_0x172098);_0x162e14(_0x1e1564[_0x6ed8('0x11')](0x1f4,_0xbc3af6[_0x6ed8('0x13')]));});});}; \ No newline at end of file +var _0x237d=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis'];(function(_0x2abaaf,_0x125a5b){var _0x7ae472=function(_0x9dc204){while(--_0x9dc204){_0x2abaaf['push'](_0x2abaaf['shift']());}};_0x7ae472(++_0x125a5b);}(_0x237d,0x1ea));var _0xd237=function(_0x131b1c,_0x1b99ca){_0x131b1c=_0x131b1c-0x0;var _0x486f58=_0x237d[_0x131b1c];return _0x486f58;};'use strict';var _=require(_0xd237('0x0'));var util=require('util');var moment=require(_0xd237('0x1'));var BPromise=require(_0xd237('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd237('0x3'));var db=require(_0xd237('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd237('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd237('0x6'));var client=jayson[_0xd237('0x7')][_0xd237('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b6f45,_0x3dbd3c,_0x480836){return new BPromise(function(_0x321b5f,_0x23ca5d){return client[_0xd237('0x9')](_0x4b6f45,_0x480836)['then'](function(_0x38e071){logger[_0xd237('0xa')](_0xd237('0xb'),_0x3dbd3c,_0xd237('0xc'));logger[_0xd237('0xd')](_0xd237('0xe'),_0x3dbd3c,_0xd237('0xc'),JSON['stringify'](_0x38e071));if(_0x38e071['error']){if(_0x38e071['error'][_0xd237('0xf')]===0x1f4){logger[_0xd237('0x10')](_0xd237('0xb'),_0x3dbd3c,_0x38e071[_0xd237('0x10')][_0xd237('0x11')]);return _0x23ca5d(_0x38e071[_0xd237('0x10')][_0xd237('0x11')]);}logger[_0xd237('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3dbd3c,_0x38e071[_0xd237('0x10')][_0xd237('0x11')]);return _0x321b5f(_0x38e071[_0xd237('0x10')][_0xd237('0x11')]);}else{logger[_0xd237('0xa')](_0xd237('0xb'),_0x3dbd3c,_0xd237('0xc'));_0x321b5f(_0x38e071[_0xd237('0x12')][_0xd237('0x11')]);}})['catch'](function(_0x365d97){logger[_0xd237('0x10')](_0xd237('0xb'),_0x3dbd3c,_0x365d97);_0x23ca5d(_0x365d97);});});}exports[_0xd237('0x13')]=function(_0x1475bc){var _0x2cf6de=this;return new Promise(function(_0x120d2b,_0x17933f){return db[_0xd237('0x14')][_0xd237('0x15')](_0x1475bc[_0xd237('0x16')],{'raw':_0x1475bc[_0xd237('0x17')]?_0x1475bc['options'][_0xd237('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x446e9d){logger['info'](_0xd237('0x13'),_0x1475bc);logger['debug'](_0xd237('0x13'),_0x1475bc,JSON[_0xd237('0x19')](_0x446e9d));_0x120d2b(_0x446e9d);})['catch'](function(_0x4679d4){logger[_0xd237('0x10')](_0xd237('0x13'),_0x4679d4[_0xd237('0x11')],_0x1475bc);_0x17933f(_0x2cf6de[_0xd237('0x10')](0x1f4,_0x4679d4['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b4d6ea9..940d87f 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x210af2,_0x5b295c){var _0x2df0d1=function(_0x3d4a4e){while(--_0x3d4a4e){_0x210af2['push'](_0x210af2['shift']());}};_0x2df0d1(++_0x5b295c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x18d40b,_0x1ba555){var _0x3aa8ad=function(_0x520410){while(--_0x520410){_0x18d40b['push'](_0x18d40b['shift']());}};_0x3aa8ad(++_0x1ba555);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8724de1..4c29323 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 _0x03c9=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x4a5182,_0x135866){var _0x5c1ae5=function(_0x59eb7c){while(--_0x59eb7c){_0x4a5182['push'](_0x4a5182['shift']());}};_0x5c1ae5(++_0x135866);}(_0x03c9,0x1c0));var _0x903c=function(_0x48b6ac,_0x53297e){_0x48b6ac=_0x48b6ac-0x0;var _0x546a72=_0x03c9[_0x48b6ac];return _0x546a72;};'use strict';var Sequelize=require(_0x903c('0x0'));module['exports']={'network':{'type':Sequelize[_0x903c('0x1')]},'network_script':{'type':Sequelize[_0x903c('0x1')]},'request':{'type':Sequelize[_0x903c('0x1')]},'channel':{'type':Sequelize[_0x903c('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x903c('0x1')]},'uniqueid':{'type':Sequelize[_0x903c('0x1')]},'version':{'type':Sequelize[_0x903c('0x1')]},'callerid':{'type':Sequelize[_0x903c('0x1')]},'calleridname':{'type':Sequelize[_0x903c('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x903c('0x1')]},'callington':{'type':Sequelize[_0x903c('0x1')]},'callingtns':{'type':Sequelize[_0x903c('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x903c('0x1')]},'context':{'type':Sequelize[_0x903c('0x1')]},'extension':{'type':Sequelize[_0x903c('0x1')]},'priority':{'type':Sequelize[_0x903c('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x903c('0x1')]},'threadid':{'type':Sequelize[_0x903c('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x903c('0x2')]},'leaveAt':{'type':Sequelize[_0x903c('0x2')]},'bot':{'type':Sequelize[_0x903c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4194=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5c2b0a,_0x18c57e){var _0x5e669e=function(_0x4433fa){while(--_0x4433fa){_0x5c2b0a['push'](_0x5c2b0a['shift']());}};_0x5e669e(++_0x18c57e);}(_0x4194,0x1a3));var _0x4419=function(_0x5e0c2f,_0x43bdfd){_0x5e0c2f=_0x5e0c2f-0x0;var _0x173cac=_0x4194[_0x5e0c2f];return _0x173cac;};'use strict';var Sequelize=require(_0x4419('0x0'));module[_0x4419('0x1')]={'network':{'type':Sequelize[_0x4419('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4419('0x2')]},'channel':{'type':Sequelize[_0x4419('0x2')]},'language':{'type':Sequelize[_0x4419('0x2')]},'type':{'type':Sequelize[_0x4419('0x2')]},'uniqueid':{'type':Sequelize[_0x4419('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4419('0x2')]},'calleridname':{'type':Sequelize[_0x4419('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4419('0x2')]},'callingtns':{'type':Sequelize[_0x4419('0x2')]},'dnid':{'type':Sequelize[_0x4419('0x2')]},'rdnis':{'type':Sequelize[_0x4419('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4419('0x2')]},'priority':{'type':Sequelize[_0x4419('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4419('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4419('0x2')]},'joinAt':{'type':Sequelize[_0x4419('0x3')]},'leaveAt':{'type':Sequelize[_0x4419('0x3')]},'bot':{'type':Sequelize[_0x4419('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 c663a42..8457bb1 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 _0xecd7=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','includeAll','find','create','body','update','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters'];(function(_0x1dbb77,_0x16c5a9){var _0x1fef05=function(_0x54f51a){while(--_0x54f51a){_0x1dbb77['push'](_0x1dbb77['shift']());}};_0x1fef05(++_0x16c5a9);}(_0xecd7,0x1e0));var _0x7ecd=function(_0x5ad7f3,_0x1d0571){_0x5ad7f3=_0x5ad7f3-0x0;var _0x4bd568=_0xecd7[_0x5ad7f3];return _0x4bd568;};'use strict';var emlformat=require(_0x7ecd('0x0'));var rimraf=require(_0x7ecd('0x1'));var zipdir=require(_0x7ecd('0x2'));var jsonpatch=require(_0x7ecd('0x3'));var rp=require(_0x7ecd('0x4'));var moment=require('moment');var BPromise=require(_0x7ecd('0x5'));var Mustache=require(_0x7ecd('0x6'));var util=require(_0x7ecd('0x7'));var path=require(_0x7ecd('0x8'));var sox=require(_0x7ecd('0x9'));var csv=require(_0x7ecd('0xa'));var ejs=require(_0x7ecd('0xb'));var fs=require('fs');var fs_extra=require(_0x7ecd('0xc'));var _=require(_0x7ecd('0xd'));var squel=require(_0x7ecd('0xe'));var crypto=require('crypto');var jsforce=require(_0x7ecd('0xf'));var deskjs=require(_0x7ecd('0x10'));var toCsv=require(_0x7ecd('0xa'));var querystring=require(_0x7ecd('0x11'));var Papa=require(_0x7ecd('0x12'));var Redis=require(_0x7ecd('0x13'));var authService=require(_0x7ecd('0x14'));var qs=require(_0x7ecd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ecd('0x16'))('api');var utils=require(_0x7ecd('0x17'));var config=require(_0x7ecd('0x18'));var licenseUtil=require(_0x7ecd('0x19'));var db=require(_0x7ecd('0x1a'))['db'];function respondWithStatusCode(_0xd9b03d,_0x5b09da){_0x5b09da=_0x5b09da||0xcc;return function(_0x46b29c){if(_0x46b29c){return _0xd9b03d['sendStatus'](_0x5b09da);}return _0xd9b03d[_0x7ecd('0x1b')](_0x5b09da)[_0x7ecd('0x1c')]();};}function respondWithResult(_0x5b0fb2,_0x46b776){_0x46b776=_0x46b776||0xc8;return function(_0x2e8600){if(_0x2e8600){return _0x5b0fb2[_0x7ecd('0x1b')](_0x46b776)[_0x7ecd('0x1d')](_0x2e8600);}};}function respondWithFilteredResult(_0x10405f,_0x35709f){return function(_0x24e8eb){if(_0x24e8eb){var _0x189803=typeof _0x35709f[_0x7ecd('0x1e')]==='undefined'&&typeof _0x35709f[_0x7ecd('0x1f')]==='undefined';var _0x1c8512=_0x24e8eb[_0x7ecd('0x20')];var _0x15d24e=_0x189803?0x0:_0x35709f[_0x7ecd('0x1e')];var _0x6cb70e=_0x189803?_0x24e8eb[_0x7ecd('0x20')]:_0x35709f[_0x7ecd('0x1e')]+_0x35709f['limit'];var _0x59dda2;if(_0x6cb70e>=_0x1c8512){_0x6cb70e=_0x1c8512;_0x59dda2=0xc8;}else{_0x59dda2=0xce;}_0x10405f['status'](_0x59dda2);return _0x10405f['set']('Content-Range',_0x15d24e+'-'+_0x6cb70e+'/'+_0x1c8512)[_0x7ecd('0x1d')](_0x24e8eb);}return null;};}function patchUpdates(_0x2660f0){return function(_0x4f380a){try{jsonpatch[_0x7ecd('0x21')](_0x4f380a,_0x2660f0,!![]);}catch(_0x139f1d){return BPromise[_0x7ecd('0x22')](_0x139f1d);}return _0x4f380a[_0x7ecd('0x23')]();};}function saveUpdates(_0x3768e9,_0x4a30bf){return function(_0x37b8d1){if(_0x37b8d1){return _0x37b8d1['update'](_0x3768e9)[_0x7ecd('0x24')](function(_0x2c4f70){return _0x2c4f70;});}return null;};}function removeEntity(_0x546634,_0x356711){return function(_0x1f8c9f){if(_0x1f8c9f){return _0x1f8c9f[_0x7ecd('0x25')]()[_0x7ecd('0x24')](function(){_0x546634[_0x7ecd('0x1b')](0xcc)[_0x7ecd('0x1c')]();});}};}function handleEntityNotFound(_0x204f9f,_0x196b4f){return function(_0xc57ae3){if(!_0xc57ae3){_0x204f9f[_0x7ecd('0x26')](0x194);}return _0xc57ae3;};}function handleError(_0x3950f5,_0x5675f4){_0x5675f4=_0x5675f4||0x1f4;return function(_0x5b09ae){logger[_0x7ecd('0x27')](_0x5b09ae['stack']);if(_0x5b09ae[_0x7ecd('0x28')]){delete _0x5b09ae[_0x7ecd('0x28')];}_0x3950f5['status'](_0x5675f4)[_0x7ecd('0x29')](_0x5b09ae);};}exports[_0x7ecd('0x2a')]=function(_0x14846b,_0x2ef46f){var _0x5d5c90={},_0x379135={},_0x35c819={'count':0x0,'rows':[]};var _0x256f2f=_[_0x7ecd('0x2b')](db[_0x7ecd('0x2c')]['rawAttributes'],function(_0x29360e){return{'name':_0x29360e[_0x7ecd('0x2d')],'type':_0x29360e[_0x7ecd('0x2e')][_0x7ecd('0x2f')]};});_0x379135[_0x7ecd('0x30')]=_[_0x7ecd('0x2b')](_0x256f2f,_0x7ecd('0x28'));_0x379135[_0x7ecd('0x31')]=_[_0x7ecd('0x32')](_0x14846b[_0x7ecd('0x31')]);_0x379135[_0x7ecd('0x33')]=_[_0x7ecd('0x34')](_0x379135[_0x7ecd('0x30')],_0x379135[_0x7ecd('0x31')]);_0x5d5c90[_0x7ecd('0x35')]=_[_0x7ecd('0x34')](_0x379135[_0x7ecd('0x30')],qs[_0x7ecd('0x36')](_0x14846b['query'][_0x7ecd('0x36')]));_0x5d5c90[_0x7ecd('0x35')]=_0x5d5c90['attributes'][_0x7ecd('0x37')]?_0x5d5c90['attributes']:_0x379135[_0x7ecd('0x30')];if(!_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x38')](_0x7ecd('0x39'))){_0x5d5c90[_0x7ecd('0x1f')]=qs[_0x7ecd('0x1f')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x1f')]);_0x5d5c90[_0x7ecd('0x1e')]=qs[_0x7ecd('0x1e')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x1e')]);}_0x5d5c90[_0x7ecd('0x3a')]=qs[_0x7ecd('0x3b')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x3b')]);_0x5d5c90[_0x7ecd('0x3c')]=qs[_0x7ecd('0x33')](_[_0x7ecd('0x3d')](_0x14846b[_0x7ecd('0x31')],_0x379135[_0x7ecd('0x33')]),_0x256f2f);if(_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x3e')]){_0x5d5c90[_0x7ecd('0x3c')]=_[_0x7ecd('0x3f')](_0x5d5c90[_0x7ecd('0x3c')],{'$or':_['map'](_0x256f2f,function(_0x1585ae){if(_0x1585ae['type']!==_0x7ecd('0x40')){var _0x20e47c={};_0x20e47c[_0x1585ae[_0x7ecd('0x28')]]={'$like':'%'+_0x14846b[_0x7ecd('0x31')]['filter']+'%'};return _0x20e47c;}})});}_0x5d5c90=_['merge']({},_0x5d5c90,_0x14846b['options']);var _0x527fe0={'where':_0x5d5c90[_0x7ecd('0x3c')]};return db[_0x7ecd('0x2c')][_0x7ecd('0x20')](_0x527fe0)[_0x7ecd('0x24')](function(_0x54c690){_0x35c819[_0x7ecd('0x20')]=_0x54c690;if(_0x14846b[_0x7ecd('0x31')]['includeAll']){_0x5d5c90[_0x7ecd('0x41')]=[{'all':!![]}];}return db[_0x7ecd('0x2c')]['findAll'](_0x5d5c90);})[_0x7ecd('0x24')](function(_0x4a2518){_0x35c819[_0x7ecd('0x42')]=_0x4a2518;return _0x35c819;})[_0x7ecd('0x24')](respondWithFilteredResult(_0x2ef46f,_0x5d5c90))[_0x7ecd('0x43')](handleError(_0x2ef46f,null));};exports[_0x7ecd('0x44')]=function(_0x4156a3,_0x43d5d7){var _0xbd56a8={'raw':!![],'where':{'id':_0x4156a3['params']['id']}},_0x1bed14={};_0x1bed14[_0x7ecd('0x30')]=_[_0x7ecd('0x32')](db[_0x7ecd('0x2c')]['rawAttributes']);_0x1bed14['query']=_[_0x7ecd('0x32')](_0x4156a3[_0x7ecd('0x31')]);_0x1bed14[_0x7ecd('0x33')]=_[_0x7ecd('0x34')](_0x1bed14[_0x7ecd('0x30')],_0x1bed14['query']);_0xbd56a8['attributes']=_[_0x7ecd('0x34')](_0x1bed14['model'],qs[_0x7ecd('0x36')](_0x4156a3[_0x7ecd('0x31')][_0x7ecd('0x36')]));_0xbd56a8[_0x7ecd('0x35')]=_0xbd56a8['attributes'][_0x7ecd('0x37')]?_0xbd56a8[_0x7ecd('0x35')]:_0x1bed14['model'];if(_0x4156a3[_0x7ecd('0x31')][_0x7ecd('0x45')]){_0xbd56a8[_0x7ecd('0x41')]=[{'all':!![]}];}_0xbd56a8=_['merge']({},_0xbd56a8,_0x4156a3['options']);return db[_0x7ecd('0x2c')][_0x7ecd('0x46')](_0xbd56a8)[_0x7ecd('0x24')](handleEntityNotFound(_0x43d5d7,null))[_0x7ecd('0x24')](respondWithResult(_0x43d5d7,null))[_0x7ecd('0x43')](handleError(_0x43d5d7,null));};exports[_0x7ecd('0x47')]=function(_0x1ac4e4,_0x41c3f1){return db[_0x7ecd('0x2c')]['create'](_0x1ac4e4[_0x7ecd('0x48')],{})[_0x7ecd('0x24')](respondWithResult(_0x41c3f1,0xc9))[_0x7ecd('0x43')](handleError(_0x41c3f1,null));};exports[_0x7ecd('0x49')]=function(_0x12fe69,_0x1b37c7){if(_0x12fe69[_0x7ecd('0x48')]['id']){delete _0x12fe69[_0x7ecd('0x48')]['id'];}return db[_0x7ecd('0x2c')][_0x7ecd('0x46')]({'where':{'id':_0x12fe69[_0x7ecd('0x4a')]['id']}})[_0x7ecd('0x24')](handleEntityNotFound(_0x1b37c7,null))[_0x7ecd('0x24')](saveUpdates(_0x12fe69[_0x7ecd('0x48')],null))[_0x7ecd('0x24')](respondWithResult(_0x1b37c7,null))[_0x7ecd('0x43')](handleError(_0x1b37c7,null));};exports[_0x7ecd('0x25')]=function(_0x10ca44,_0x2df47e){return db[_0x7ecd('0x2c')][_0x7ecd('0x46')]({'where':{'id':_0x10ca44[_0x7ecd('0x4a')]['id']}})[_0x7ecd('0x24')](handleEntityNotFound(_0x2df47e,null))[_0x7ecd('0x24')](removeEntity(_0x2df47e,null))[_0x7ecd('0x43')](handleError(_0x2df47e,null));};exports[_0x7ecd('0x4b')]=function(_0x44f139,_0x57c11d){return db['SquareReport'][_0x7ecd('0x4b')]()['then'](respondWithResult(_0x57c11d,null))[_0x7ecd('0x43')](handleError(_0x57c11d,null));}; \ No newline at end of file +var _0xfeca=['options','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareReport','include','findAll','rows','catch','show'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xfeca,0x123));var _0xafec=function(_0x3583d3,_0x460b11){_0x3583d3=_0x3583d3-0x0;var _0x166e57=_0xfeca[_0x3583d3];return _0x166e57;};'use strict';var emlformat=require(_0xafec('0x0'));var rimraf=require(_0xafec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafec('0x2'));var rp=require(_0xafec('0x3'));var moment=require(_0xafec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafec('0x5'));var util=require(_0xafec('0x6'));var path=require(_0xafec('0x7'));var sox=require(_0xafec('0x8'));var csv=require(_0xafec('0x9'));var ejs=require(_0xafec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafec('0xb'));var squel=require(_0xafec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xafec('0x9'));var querystring=require(_0xafec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xafec('0xe'));var qs=require(_0xafec('0xf'));var as=require(_0xafec('0x10'));var hardwareService=require(_0xafec('0x11'));var logger=require(_0xafec('0x12'))(_0xafec('0x13'));var utils=require('../../config/utils');var config=require(_0xafec('0x14'));var licenseUtil=require(_0xafec('0x15'));var db=require(_0xafec('0x16'))['db'];function respondWithStatusCode(_0x3d5b5d,_0x2038fe){_0x2038fe=_0x2038fe||0xcc;return function(_0x4d7b01){if(_0x4d7b01){return _0x3d5b5d[_0xafec('0x17')](_0x2038fe);}return _0x3d5b5d[_0xafec('0x18')](_0x2038fe)[_0xafec('0x19')]();};}function respondWithResult(_0x4afbb0,_0x496fad){_0x496fad=_0x496fad||0xc8;return function(_0x6ad8ad){if(_0x6ad8ad){return _0x4afbb0[_0xafec('0x18')](_0x496fad)[_0xafec('0x1a')](_0x6ad8ad);}};}function respondWithFilteredResult(_0x512462,_0x2931a6){return function(_0x190770){if(_0x190770){var _0x6a81dc=typeof _0x2931a6[_0xafec('0x1b')]===_0xafec('0x1c')&&typeof _0x2931a6[_0xafec('0x1d')]===_0xafec('0x1c');var _0x21d55b=_0x190770[_0xafec('0x1e')];var _0x1393e6=_0x6a81dc?0x0:_0x2931a6['offset'];var _0x6fafc0=_0x6a81dc?_0x190770['count']:_0x2931a6[_0xafec('0x1b')]+_0x2931a6['limit'];var _0x3c8787;if(_0x6fafc0>=_0x21d55b){_0x6fafc0=_0x21d55b;_0x3c8787=0xc8;}else{_0x3c8787=0xce;}_0x512462['status'](_0x3c8787);return _0x512462['set'](_0xafec('0x1f'),_0x1393e6+'-'+_0x6fafc0+'/'+_0x21d55b)['json'](_0x190770);}return null;};}function patchUpdates(_0x4168fd){return function(_0x10d9e0){try{jsonpatch[_0xafec('0x20')](_0x10d9e0,_0x4168fd,!![]);}catch(_0x108a65){return BPromise[_0xafec('0x21')](_0x108a65);}return _0x10d9e0['save']();};}function saveUpdates(_0x4e391f,_0x3a9fc0){return function(_0x4fb398){if(_0x4fb398){return _0x4fb398[_0xafec('0x22')](_0x4e391f)['then'](function(_0x4d1058){return _0x4d1058;});}return null;};}function removeEntity(_0x2ac8ed,_0x348307){return function(_0x406270){if(_0x406270){return _0x406270['destroy']()[_0xafec('0x23')](function(){_0x2ac8ed[_0xafec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a019,_0x1050b3){return function(_0x107313){if(!_0x107313){_0x19a019[_0xafec('0x17')](0x194);}return _0x107313;};}function handleError(_0x537cbb,_0x360c72){_0x360c72=_0x360c72||0x1f4;return function(_0xa23298){logger['error'](_0xa23298[_0xafec('0x24')]);if(_0xa23298[_0xafec('0x25')]){delete _0xa23298[_0xafec('0x25')];}_0x537cbb[_0xafec('0x18')](_0x360c72)['send'](_0xa23298);};}exports[_0xafec('0x26')]=function(_0x1d1147,_0x2d0d49){var _0x585393={},_0x4a4a14={},_0x223020={'count':0x0,'rows':[]};var _0x23ffd6=_[_0xafec('0x27')](db['SquareReport'][_0xafec('0x28')],function(_0xb6686f){return{'name':_0xb6686f['fieldName'],'type':_0xb6686f[_0xafec('0x29')]['key']};});_0x4a4a14[_0xafec('0x2a')]=_['map'](_0x23ffd6,_0xafec('0x25'));_0x4a4a14[_0xafec('0x2b')]=_['keys'](_0x1d1147[_0xafec('0x2b')]);_0x4a4a14[_0xafec('0x2c')]=_[_0xafec('0x2d')](_0x4a4a14['model'],_0x4a4a14[_0xafec('0x2b')]);_0x585393[_0xafec('0x2e')]=_[_0xafec('0x2d')](_0x4a4a14[_0xafec('0x2a')],qs[_0xafec('0x2f')](_0x1d1147[_0xafec('0x2b')][_0xafec('0x2f')]));_0x585393['attributes']=_0x585393[_0xafec('0x2e')][_0xafec('0x30')]?_0x585393['attributes']:_0x4a4a14[_0xafec('0x2a')];if(!_0x1d1147[_0xafec('0x2b')][_0xafec('0x31')](_0xafec('0x32'))){_0x585393[_0xafec('0x1d')]=qs[_0xafec('0x1d')](_0x1d1147[_0xafec('0x2b')][_0xafec('0x1d')]);_0x585393[_0xafec('0x1b')]=qs[_0xafec('0x1b')](_0x1d1147[_0xafec('0x2b')][_0xafec('0x1b')]);}_0x585393[_0xafec('0x33')]=qs['sort'](_0x1d1147['query'][_0xafec('0x34')]);_0x585393[_0xafec('0x35')]=qs[_0xafec('0x2c')](_[_0xafec('0x36')](_0x1d1147[_0xafec('0x2b')],_0x4a4a14[_0xafec('0x2c')]),_0x23ffd6);if(_0x1d1147[_0xafec('0x2b')][_0xafec('0x37')]){_0x585393['where']=_[_0xafec('0x38')](_0x585393[_0xafec('0x35')],{'$or':_[_0xafec('0x27')](_0x23ffd6,function(_0x31b717){if(_0x31b717['type']!==_0xafec('0x39')){var _0x2ee341={};_0x2ee341[_0x31b717[_0xafec('0x25')]]={'$like':'%'+_0x1d1147[_0xafec('0x2b')][_0xafec('0x37')]+'%'};return _0x2ee341;}})});}_0x585393=_['merge']({},_0x585393,_0x1d1147['options']);var _0x336193={'where':_0x585393[_0xafec('0x35')]};return db[_0xafec('0x3a')][_0xafec('0x1e')](_0x336193)[_0xafec('0x23')](function(_0x4c67ab){_0x223020[_0xafec('0x1e')]=_0x4c67ab;if(_0x1d1147[_0xafec('0x2b')]['includeAll']){_0x585393[_0xafec('0x3b')]=[{'all':!![]}];}return db[_0xafec('0x3a')][_0xafec('0x3c')](_0x585393);})[_0xafec('0x23')](function(_0x2b7c59){_0x223020[_0xafec('0x3d')]=_0x2b7c59;return _0x223020;})['then'](respondWithFilteredResult(_0x2d0d49,_0x585393))[_0xafec('0x3e')](handleError(_0x2d0d49,null));};exports[_0xafec('0x3f')]=function(_0x429055,_0x78530d){var _0x4ed0e3={'raw':!![],'where':{'id':_0x429055['params']['id']}},_0x3667c0={};_0x3667c0[_0xafec('0x2a')]=_['keys'](db[_0xafec('0x3a')]['rawAttributes']);_0x3667c0['query']=_['keys'](_0x429055[_0xafec('0x2b')]);_0x3667c0[_0xafec('0x2c')]=_['intersection'](_0x3667c0['model'],_0x3667c0[_0xafec('0x2b')]);_0x4ed0e3[_0xafec('0x2e')]=_['intersection'](_0x3667c0['model'],qs['fields'](_0x429055[_0xafec('0x2b')][_0xafec('0x2f')]));_0x4ed0e3[_0xafec('0x2e')]=_0x4ed0e3[_0xafec('0x2e')][_0xafec('0x30')]?_0x4ed0e3[_0xafec('0x2e')]:_0x3667c0[_0xafec('0x2a')];if(_0x429055[_0xafec('0x2b')]['includeAll']){_0x4ed0e3['include']=[{'all':!![]}];}_0x4ed0e3=_[_0xafec('0x38')]({},_0x4ed0e3,_0x429055[_0xafec('0x40')]);return db[_0xafec('0x3a')][_0xafec('0x41')](_0x4ed0e3)[_0xafec('0x23')](handleEntityNotFound(_0x78530d,null))[_0xafec('0x23')](respondWithResult(_0x78530d,null))[_0xafec('0x3e')](handleError(_0x78530d,null));};exports['create']=function(_0x438f23,_0x53a03c){return db[_0xafec('0x3a')][_0xafec('0x42')](_0x438f23[_0xafec('0x43')],{})[_0xafec('0x23')](respondWithResult(_0x53a03c,0xc9))[_0xafec('0x3e')](handleError(_0x53a03c,null));};exports['update']=function(_0x1732d6,_0x34c1cb){if(_0x1732d6[_0xafec('0x43')]['id']){delete _0x1732d6[_0xafec('0x43')]['id'];}return db[_0xafec('0x3a')][_0xafec('0x41')]({'where':{'id':_0x1732d6[_0xafec('0x44')]['id']}})[_0xafec('0x23')](handleEntityNotFound(_0x34c1cb,null))[_0xafec('0x23')](saveUpdates(_0x1732d6[_0xafec('0x43')],null))[_0xafec('0x23')](respondWithResult(_0x34c1cb,null))[_0xafec('0x3e')](handleError(_0x34c1cb,null));};exports[_0xafec('0x45')]=function(_0x227cb9,_0x40e2f8){return db['SquareReport'][_0xafec('0x41')]({'where':{'id':_0x227cb9[_0xafec('0x44')]['id']}})[_0xafec('0x23')](handleEntityNotFound(_0x40e2f8,null))[_0xafec('0x23')](removeEntity(_0x40e2f8,null))[_0xafec('0x3e')](handleError(_0x40e2f8,null));};exports[_0xafec('0x46')]=function(_0x358925,_0x5c5307){return db['SquareReport'][_0xafec('0x46')]()[_0xafec('0x23')](respondWithResult(_0x5c5307,null))[_0xafec('0x3e')](handleError(_0x5c5307,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a9622d4..29fe703 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 _0x2c70=['path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b58ae,_0x5e34de){var _0x96c539=function(_0x5b6d32){while(--_0x5b6d32){_0x5b58ae['push'](_0x5b58ae['shift']());}};_0x96c539(++_0x5e34de);}(_0x2c70,0xa4));var _0x02c7=function(_0x4b3b1d,_0x161f01){_0x4b3b1d=_0x4b3b1d-0x0;var _0x288ae5=_0x2c70[_0x4b3b1d];return _0x288ae5;};'use strict';var _=require('lodash');var util=require(_0x02c7('0x0'));var logger=require(_0x02c7('0x1'))(_0x02c7('0x2'));var moment=require(_0x02c7('0x3'));var BPromise=require(_0x02c7('0x4'));var rp=require(_0x02c7('0x5'));var fs=require('fs');var path=require(_0x02c7('0x6'));var rimraf=require(_0x02c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x02c7('0x8'));module[_0x02c7('0x9')]=function(_0x4b9492,_0x2633f1){return _0x4b9492[_0x02c7('0xa')](_0x02c7('0xb'),attributes,{'tableName':_0x02c7('0xc'),'paranoid':![],'indexes':[{'name':_0x02c7('0xd'),'fields':[_0x02c7('0xe'),_0x02c7('0xf')]},{'name':_0x02c7('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d3e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x55f658,_0x5c0867){var _0x29a966=function(_0x149943){while(--_0x149943){_0x55f658['push'](_0x55f658['shift']());}};_0x29a966(++_0x5c0867);}(_0x2d3e,0x153));var _0xe2d3=function(_0x5710a3,_0x2bcf31){_0x5710a3=_0x5710a3-0x0;var _0x3208a1=_0x2d3e[_0x5710a3];return _0x3208a1;};'use strict';var _=require(_0xe2d3('0x0'));var util=require(_0xe2d3('0x1'));var logger=require(_0xe2d3('0x2'))(_0xe2d3('0x3'));var moment=require(_0xe2d3('0x4'));var BPromise=require(_0xe2d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2d3('0x6'));var rimraf=require(_0xe2d3('0x7'));var config=require(_0xe2d3('0x8'));var attributes=require(_0xe2d3('0x9'));module[_0xe2d3('0xa')]=function(_0x5a8f71,_0x287271){return _0x5a8f71[_0xe2d3('0xb')](_0xe2d3('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xe2d3('0xd'),'fields':[_0xe2d3('0xe'),_0xe2d3('0xf')]},{'name':_0xe2d3('0x10'),'fields':[_0xe2d3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 39ded1a..42a58fe 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 _0x4fe6=['options','raw','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','result','SquareReport','create','body'];(function(_0x51ec59,_0x812a9f){var _0x267197=function(_0xcb8b33){while(--_0xcb8b33){_0x51ec59['push'](_0x51ec59['shift']());}};_0x267197(++_0x812a9f);}(_0x4fe6,0xdc));var _0x64fe=function(_0x2191b6,_0x577472){_0x2191b6=_0x2191b6-0x0;var _0x407781=_0x4fe6[_0x2191b6];return _0x407781;};'use strict';var _=require(_0x64fe('0x0'));var util=require(_0x64fe('0x1'));var moment=require('moment');var BPromise=require(_0x64fe('0x2'));var rs=require(_0x64fe('0x3'));var fs=require('fs');var Redis=require(_0x64fe('0x4'));var db=require(_0x64fe('0x5'))['db'];var utils=require(_0x64fe('0x6'));var logger=require(_0x64fe('0x7'))('rpc');var config=require(_0x64fe('0x8'));var jayson=require(_0x64fe('0x9'));var client=jayson[_0x64fe('0xa')][_0x64fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ed2b0,_0x51d2ea,_0x42d22e){return new BPromise(function(_0x34ab51,_0x5b7196){return client[_0x64fe('0xc')](_0x3ed2b0,_0x42d22e)[_0x64fe('0xd')](function(_0xcd355c){logger[_0x64fe('0xe')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0x64fe('0xf'));logger[_0x64fe('0x10')](_0x64fe('0x11'),_0x51d2ea,_0x64fe('0xf'),JSON['stringify'](_0xcd355c));if(_0xcd355c[_0x64fe('0x12')]){if(_0xcd355c[_0x64fe('0x12')]['code']===0x1f4){logger['error'](_0x64fe('0x13'),_0x51d2ea,_0xcd355c[_0x64fe('0x12')]['message']);return _0x5b7196(_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);}logger[_0x64fe('0x12')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);return _0x34ab51(_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);}else{logger[_0x64fe('0xe')](_0x64fe('0x13'),_0x51d2ea,_0x64fe('0xf'));_0x34ab51(_0xcd355c[_0x64fe('0x15')][_0x64fe('0x14')]);}})['catch'](function(_0xbf354b){logger[_0x64fe('0x12')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0xbf354b);_0x5b7196(_0xbf354b);});});}exports['CreateSquareReport']=function(_0x311ec5){var _0x555010=this;return new Promise(function(_0x452c05,_0x11b752){return db[_0x64fe('0x16')][_0x64fe('0x17')](_0x311ec5[_0x64fe('0x18')],{'raw':_0x311ec5[_0x64fe('0x19')]?_0x311ec5[_0x64fe('0x19')][_0x64fe('0x1a')]===undefined?!![]:![]:!![]})[_0x64fe('0xd')](function(_0x5d2ca6){logger[_0x64fe('0xe')](_0x64fe('0x1b'),_0x311ec5);logger[_0x64fe('0x10')](_0x64fe('0x1b'),_0x311ec5,JSON[_0x64fe('0x1c')](_0x5d2ca6));_0x452c05(_0x5d2ca6);})['catch'](function(_0x4fa11e){logger[_0x64fe('0x12')](_0x64fe('0x1b'),_0x4fa11e['message'],_0x311ec5);_0x11b752(_0x555010[_0x64fe('0x12')](0x1f4,_0x4fa11e[_0x64fe('0x14')]));});});};exports[_0x64fe('0x1d')]=function(_0x131202){var _0x3734bd=this;return new Promise(function(_0x4ece50,_0x23b554){return db[_0x64fe('0x16')][_0x64fe('0x1e')](_0x131202['body'],{'raw':_0x131202[_0x64fe('0x19')]?_0x131202['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131202['options']?_0x131202[_0x64fe('0x19')][_0x64fe('0x1f')]||null:null,'attributes':_0x131202[_0x64fe('0x19')]?_0x131202['options'][_0x64fe('0x20')]||null:null,'limit':_0x131202[_0x64fe('0x19')]?_0x131202[_0x64fe('0x19')][_0x64fe('0x21')]||null:null})[_0x64fe('0xd')](function(_0x4f0389){logger[_0x64fe('0xe')]('UpdateSquareReport',_0x131202);logger[_0x64fe('0x10')](_0x64fe('0x1d'),_0x131202,JSON[_0x64fe('0x1c')](_0x4f0389));_0x4ece50(_0x4f0389);})[_0x64fe('0x22')](function(_0xf684d5){logger[_0x64fe('0x12')](_0x64fe('0x1d'),_0xf684d5[_0x64fe('0x14')],_0x131202);_0x23b554(_0x3734bd[_0x64fe('0x12')](0x1f4,_0xf684d5[_0x64fe('0x14')]));});});}; \ No newline at end of file +var _0xdfdf=['result','catch','SquareReport','body','options','then','CreateSquareReport','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2323ca,_0x1470b1){var _0x5e4ba4=function(_0x3812cf){while(--_0x3812cf){_0x2323ca['push'](_0x2323ca['shift']());}};_0x5e4ba4(++_0x1470b1);}(_0xdfdf,0x1bd));var _0xfdfd=function(_0x178231,_0x31df46){_0x178231=_0x178231-0x0;var _0x375de7=_0xdfdf[_0x178231];return _0x375de7;};'use strict';var _=require(_0xfdfd('0x0'));var util=require(_0xfdfd('0x1'));var moment=require('moment');var BPromise=require(_0xfdfd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdfd('0x3'));var db=require(_0xfdfd('0x4'))['db'];var utils=require(_0xfdfd('0x5'));var logger=require(_0xfdfd('0x6'))(_0xfdfd('0x7'));var config=require('../../config/environment');var jayson=require(_0xfdfd('0x8'));var client=jayson[_0xfdfd('0x9')][_0xfdfd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d86c8,_0x307442,_0x48df00){return new BPromise(function(_0x340d4e,_0x5b346c){return client[_0xfdfd('0xb')](_0x5d86c8,_0x48df00)['then'](function(_0x43986f){logger['info'](_0xfdfd('0xc'),_0x307442,_0xfdfd('0xd'));logger[_0xfdfd('0xe')](_0xfdfd('0xf'),_0x307442,_0xfdfd('0xd'),JSON[_0xfdfd('0x10')](_0x43986f));if(_0x43986f[_0xfdfd('0x11')]){if(_0x43986f['error']['code']===0x1f4){logger[_0xfdfd('0x11')](_0xfdfd('0xc'),_0x307442,_0x43986f[_0xfdfd('0x11')][_0xfdfd('0x12')]);return _0x5b346c(_0x43986f[_0xfdfd('0x11')][_0xfdfd('0x12')]);}logger[_0xfdfd('0x11')](_0xfdfd('0xc'),_0x307442,_0x43986f[_0xfdfd('0x11')][_0xfdfd('0x12')]);return _0x340d4e(_0x43986f[_0xfdfd('0x11')][_0xfdfd('0x12')]);}else{logger[_0xfdfd('0x13')](_0xfdfd('0xc'),_0x307442,_0xfdfd('0xd'));_0x340d4e(_0x43986f[_0xfdfd('0x14')]['message']);}})[_0xfdfd('0x15')](function(_0x220bc4){logger[_0xfdfd('0x11')](_0xfdfd('0xc'),_0x307442,_0x220bc4);_0x5b346c(_0x220bc4);});});}exports['CreateSquareReport']=function(_0x37739a){var _0x57817d=this;return new Promise(function(_0x1f6843,_0x22cce0){return db[_0xfdfd('0x16')]['create'](_0x37739a[_0xfdfd('0x17')],{'raw':_0x37739a['options']?_0x37739a[_0xfdfd('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xfdfd('0x19')](function(_0x5ad5c4){logger[_0xfdfd('0x13')]('CreateSquareReport',_0x37739a);logger['debug'](_0xfdfd('0x1a'),_0x37739a,JSON[_0xfdfd('0x10')](_0x5ad5c4));_0x1f6843(_0x5ad5c4);})[_0xfdfd('0x15')](function(_0x3899db){logger[_0xfdfd('0x11')](_0xfdfd('0x1a'),_0x3899db[_0xfdfd('0x12')],_0x37739a);_0x22cce0(_0x57817d[_0xfdfd('0x11')](0x1f4,_0x3899db[_0xfdfd('0x12')]));});});};exports[_0xfdfd('0x1b')]=function(_0x51b036){var _0x498510=this;return new Promise(function(_0x1677af,_0x5beee3){return db[_0xfdfd('0x16')][_0xfdfd('0x1c')](_0x51b036[_0xfdfd('0x17')],{'raw':_0x51b036[_0xfdfd('0x18')]?_0x51b036[_0xfdfd('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b036[_0xfdfd('0x18')]?_0x51b036['options']['where']||null:null,'attributes':_0x51b036[_0xfdfd('0x18')]?_0x51b036[_0xfdfd('0x18')][_0xfdfd('0x1d')]||null:null,'limit':_0x51b036[_0xfdfd('0x18')]?_0x51b036[_0xfdfd('0x18')][_0xfdfd('0x1e')]||null:null})[_0xfdfd('0x19')](function(_0x1f5b7b){logger[_0xfdfd('0x13')](_0xfdfd('0x1b'),_0x51b036);logger[_0xfdfd('0xe')](_0xfdfd('0x1b'),_0x51b036,JSON['stringify'](_0x1f5b7b));_0x1677af(_0x1f5b7b);})['catch'](function(_0xbe001e){logger[_0xfdfd('0x11')](_0xfdfd('0x1b'),_0xbe001e[_0xfdfd('0x12')],_0x51b036);_0x5beee3(_0x498510['error'](0x1f4,_0xbe001e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6beb4a1..652d8c6 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 _0x1be9=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x1be9,0x1c3));var _0x91be=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1be9[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var path=require(_0x91be('0x2'));var timeout=require(_0x91be('0x3'));var express=require(_0x91be('0x4'));var router=express[_0x91be('0x5')]();var fs_extra=require(_0x91be('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x91be('0x7'));var controller=require('./squareReportDetail.controller');router[_0x91be('0x8')]('/',auth[_0x91be('0x9')](),controller[_0x91be('0xa')]);router[_0x91be('0x8')](_0x91be('0xb'),auth[_0x91be('0x9')](),controller[_0x91be('0xc')]);router['get'](_0x91be('0xd'),auth[_0x91be('0x9')](),controller['show']);router[_0x91be('0xe')]('/',auth[_0x91be('0x9')](),controller[_0x91be('0xf')]);router[_0x91be('0x10')](_0x91be('0xd'),auth[_0x91be('0x9')](),controller[_0x91be('0x11')]);router[_0x91be('0x12')](_0x91be('0xd'),auth[_0x91be('0x9')](),controller[_0x91be('0x13')]);module[_0x91be('0x14')]=router; \ No newline at end of file +var _0x56e0=['/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x187c18,_0x436a27){var _0x505df0=function(_0x39db85){while(--_0x39db85){_0x187c18['push'](_0x187c18['shift']());}};_0x505df0(++_0x436a27);}(_0x56e0,0x1e9));var _0x056e=function(_0x329b2d,_0x4eb805){_0x329b2d=_0x329b2d-0x0;var _0x5f110b=_0x56e0[_0x329b2d];return _0x5f110b;};'use strict';var multer=require(_0x056e('0x0'));var util=require(_0x056e('0x1'));var path=require(_0x056e('0x2'));var timeout=require(_0x056e('0x3'));var express=require(_0x056e('0x4'));var router=express[_0x056e('0x5')]();var fs_extra=require(_0x056e('0x6'));var auth=require(_0x056e('0x7'));var interaction=require(_0x056e('0x8'));var config=require(_0x056e('0x9'));var controller=require('./squareReportDetail.controller');router[_0x056e('0xa')]('/',auth[_0x056e('0xb')](),controller[_0x056e('0xc')]);router[_0x056e('0xa')](_0x056e('0xd'),auth[_0x056e('0xb')](),controller[_0x056e('0xe')]);router[_0x056e('0xa')](_0x056e('0xf'),auth['isAuthenticated'](),controller[_0x056e('0x10')]);router[_0x056e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x056e('0x12')]('/:id',auth[_0x056e('0xb')](),controller['update']);router['delete'](_0x056e('0xf'),auth[_0x056e('0xb')](),controller[_0x056e('0x13')]);module[_0x056e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8fa5a23..7dc0672 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 _0x2e37=['STRING','sequelize','exports'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0x2e37,0x82));var _0x72e3=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x2e37[_0x516927];return _0x30749b;};'use strict';var Sequelize=require(_0x72e3('0x0'));module[_0x72e3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x72e3('0x2')]},'application':{'type':Sequelize[_0x72e3('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x72e3('0x2')]},'callerid':{'type':Sequelize[_0x72e3('0x2')]}}; \ No newline at end of file +var _0x5b9b=['exports','STRING','TEXT'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x5b9b,0xb4));var _0xb5b9=function(_0x208bfd,_0x4ffbbb){_0x208bfd=_0x208bfd-0x0;var _0x5103b0=_0x5b9b[_0x208bfd];return _0x5103b0;};'use strict';var Sequelize=require('sequelize');module[_0xb5b9('0x0')]={'uniqueid':{'type':Sequelize[_0xb5b9('0x1')]},'node':{'type':Sequelize[_0xb5b9('0x1')]},'application':{'type':Sequelize[_0xb5b9('0x1')]},'data':{'type':Sequelize[_0xb5b9('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb5b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c78a814..f933fc5 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 _0x032a=['fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x032a,0x6c));var _0xa032=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x032a[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0xa032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa032('0x1'));var jsonpatch=require(_0xa032('0x2'));var rp=require(_0xa032('0x3'));var moment=require('moment');var BPromise=require(_0xa032('0x4'));var Mustache=require(_0xa032('0x5'));var util=require(_0xa032('0x6'));var path=require(_0xa032('0x7'));var sox=require(_0xa032('0x8'));var csv=require(_0xa032('0x9'));var ejs=require(_0xa032('0xa'));var fs=require('fs');var fs_extra=require(_0xa032('0xb'));var _=require('lodash');var squel=require(_0xa032('0xc'));var crypto=require('crypto');var jsforce=require(_0xa032('0xd'));var deskjs=require(_0xa032('0xe'));var toCsv=require(_0xa032('0x9'));var querystring=require('querystring');var Papa=require(_0xa032('0xf'));var Redis=require(_0xa032('0x10'));var authService=require(_0xa032('0x11'));var qs=require(_0xa032('0x12'));var as=require(_0xa032('0x13'));var hardwareService=require(_0xa032('0x14'));var logger=require('../../config/logger')(_0xa032('0x15'));var utils=require(_0xa032('0x16'));var config=require(_0xa032('0x17'));var licenseUtil=require(_0xa032('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5027a7,_0x16067a){_0x16067a=_0x16067a||0xcc;return function(_0x11ccba){if(_0x11ccba){return _0x5027a7[_0xa032('0x19')](_0x16067a);}return _0x5027a7[_0xa032('0x1a')](_0x16067a)[_0xa032('0x1b')]();};}function respondWithResult(_0x5c7ab4,_0x49b1a9){_0x49b1a9=_0x49b1a9||0xc8;return function(_0x549d22){if(_0x549d22){return _0x5c7ab4[_0xa032('0x1a')](_0x49b1a9)['json'](_0x549d22);}};}function respondWithFilteredResult(_0x1fe206,_0x19b3c1){return function(_0x5cfd5b){if(_0x5cfd5b){var _0x41132c=typeof _0x19b3c1['offset']===_0xa032('0x1c')&&typeof _0x19b3c1['limit']===_0xa032('0x1c');var _0x58f24f=_0x5cfd5b[_0xa032('0x1d')];var _0x58f73b=_0x41132c?0x0:_0x19b3c1[_0xa032('0x1e')];var _0x493111=_0x41132c?_0x5cfd5b[_0xa032('0x1d')]:_0x19b3c1[_0xa032('0x1e')]+_0x19b3c1[_0xa032('0x1f')];var _0x91bb7e;if(_0x493111>=_0x58f24f){_0x493111=_0x58f24f;_0x91bb7e=0xc8;}else{_0x91bb7e=0xce;}_0x1fe206[_0xa032('0x1a')](_0x91bb7e);return _0x1fe206[_0xa032('0x20')](_0xa032('0x21'),_0x58f73b+'-'+_0x493111+'/'+_0x58f24f)[_0xa032('0x22')](_0x5cfd5b);}return null;};}function patchUpdates(_0x16b693){return function(_0x1a7660){try{jsonpatch[_0xa032('0x23')](_0x1a7660,_0x16b693,!![]);}catch(_0x2c0ca4){return BPromise[_0xa032('0x24')](_0x2c0ca4);}return _0x1a7660[_0xa032('0x25')]();};}function saveUpdates(_0x290ab6,_0x1ae94e){return function(_0x2ce36f){if(_0x2ce36f){return _0x2ce36f[_0xa032('0x26')](_0x290ab6)[_0xa032('0x27')](function(_0x50667b){return _0x50667b;});}return null;};}function removeEntity(_0x3a1a6e,_0x5caf8c){return function(_0x46dec0){if(_0x46dec0){return _0x46dec0[_0xa032('0x28')]()['then'](function(){_0x3a1a6e[_0xa032('0x1a')](0xcc)[_0xa032('0x1b')]();});}};}function handleEntityNotFound(_0x48b286,_0x37d7a4){return function(_0x14d324){if(!_0x14d324){_0x48b286[_0xa032('0x19')](0x194);}return _0x14d324;};}function handleError(_0x588bfb,_0x5b2d48){_0x5b2d48=_0x5b2d48||0x1f4;return function(_0x1ffd09){logger[_0xa032('0x29')](_0x1ffd09[_0xa032('0x2a')]);if(_0x1ffd09[_0xa032('0x2b')]){delete _0x1ffd09[_0xa032('0x2b')];}_0x588bfb['status'](_0x5b2d48)[_0xa032('0x2c')](_0x1ffd09);};}exports['index']=function(_0x32caff,_0x2489b5){var _0x53e829={},_0xf7e270={},_0x19fe05={'count':0x0,'rows':[]};var _0x507d35=_[_0xa032('0x2d')](db[_0xa032('0x2e')][_0xa032('0x2f')],function(_0x543c51){return{'name':_0x543c51[_0xa032('0x30')],'type':_0x543c51[_0xa032('0x31')]['key']};});_0xf7e270[_0xa032('0x32')]=_[_0xa032('0x2d')](_0x507d35,_0xa032('0x2b'));_0xf7e270['query']=_[_0xa032('0x33')](_0x32caff[_0xa032('0x34')]);_0xf7e270[_0xa032('0x35')]=_['intersection'](_0xf7e270[_0xa032('0x32')],_0xf7e270['query']);_0x53e829[_0xa032('0x36')]=_[_0xa032('0x37')](_0xf7e270[_0xa032('0x32')],qs[_0xa032('0x38')](_0x32caff[_0xa032('0x34')][_0xa032('0x38')]));_0x53e829[_0xa032('0x36')]=_0x53e829['attributes']['length']?_0x53e829['attributes']:_0xf7e270[_0xa032('0x32')];if(!_0x32caff[_0xa032('0x34')][_0xa032('0x39')](_0xa032('0x3a'))){_0x53e829['limit']=qs[_0xa032('0x1f')](_0x32caff[_0xa032('0x34')][_0xa032('0x1f')]);_0x53e829[_0xa032('0x1e')]=qs[_0xa032('0x1e')](_0x32caff[_0xa032('0x34')][_0xa032('0x1e')]);}_0x53e829[_0xa032('0x3b')]=qs[_0xa032('0x3c')](_0x32caff[_0xa032('0x34')][_0xa032('0x3c')]);_0x53e829[_0xa032('0x3d')]=qs[_0xa032('0x35')](_[_0xa032('0x3e')](_0x32caff[_0xa032('0x34')],_0xf7e270[_0xa032('0x35')]),_0x507d35);if(_0x32caff[_0xa032('0x34')][_0xa032('0x3f')]){_0x53e829[_0xa032('0x3d')]=_[_0xa032('0x40')](_0x53e829[_0xa032('0x3d')],{'$or':_[_0xa032('0x2d')](_0x507d35,function(_0x28a6bc){if(_0x28a6bc[_0xa032('0x31')]!==_0xa032('0x41')){var _0xdae6e1={};_0xdae6e1[_0x28a6bc['name']]={'$like':'%'+_0x32caff[_0xa032('0x34')]['filter']+'%'};return _0xdae6e1;}})});}_0x53e829=_[_0xa032('0x40')]({},_0x53e829,_0x32caff[_0xa032('0x42')]);var _0x432fb7={'where':_0x53e829[_0xa032('0x3d')]};return db[_0xa032('0x2e')][_0xa032('0x1d')](_0x432fb7)['then'](function(_0x3c9e2c){_0x19fe05['count']=_0x3c9e2c;if(_0x32caff['query'][_0xa032('0x43')]){_0x53e829['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa032('0x44')](_0x53e829);})[_0xa032('0x27')](function(_0xd45535){_0x19fe05[_0xa032('0x45')]=_0xd45535;return _0x19fe05;})['then'](respondWithFilteredResult(_0x2489b5,_0x53e829))[_0xa032('0x46')](handleError(_0x2489b5,null));};exports[_0xa032('0x47')]=function(_0x58e044,_0x2d6bc6){var _0x13be3a={'raw':!![],'where':{'id':_0x58e044['params']['id']}},_0x40775e={};_0x40775e[_0xa032('0x32')]=_['keys'](db[_0xa032('0x2e')][_0xa032('0x2f')]);_0x40775e[_0xa032('0x34')]=_[_0xa032('0x33')](_0x58e044[_0xa032('0x34')]);_0x40775e[_0xa032('0x35')]=_[_0xa032('0x37')](_0x40775e['model'],_0x40775e['query']);_0x13be3a[_0xa032('0x36')]=_[_0xa032('0x37')](_0x40775e[_0xa032('0x32')],qs[_0xa032('0x38')](_0x58e044['query'][_0xa032('0x38')]));_0x13be3a['attributes']=_0x13be3a['attributes']['length']?_0x13be3a[_0xa032('0x36')]:_0x40775e[_0xa032('0x32')];if(_0x58e044['query'][_0xa032('0x43')]){_0x13be3a[_0xa032('0x48')]=[{'all':!![]}];}_0x13be3a=_['merge']({},_0x13be3a,_0x58e044[_0xa032('0x42')]);return db['SquareDetailsReport'][_0xa032('0x49')](_0x13be3a)[_0xa032('0x27')](handleEntityNotFound(_0x2d6bc6,null))[_0xa032('0x27')](respondWithResult(_0x2d6bc6,null))[_0xa032('0x46')](handleError(_0x2d6bc6,null));};exports['create']=function(_0x4a09c6,_0x569634){return db[_0xa032('0x2e')][_0xa032('0x4a')](_0x4a09c6[_0xa032('0x4b')],{})[_0xa032('0x27')](respondWithResult(_0x569634,0xc9))['catch'](handleError(_0x569634,null));};exports[_0xa032('0x26')]=function(_0x1c55f3,_0x4bb139){if(_0x1c55f3[_0xa032('0x4b')]['id']){delete _0x1c55f3[_0xa032('0x4b')]['id'];}return db[_0xa032('0x2e')][_0xa032('0x49')]({'where':{'id':_0x1c55f3[_0xa032('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bb139,null))['then'](saveUpdates(_0x1c55f3[_0xa032('0x4b')],null))[_0xa032('0x27')](respondWithResult(_0x4bb139,null))[_0xa032('0x46')](handleError(_0x4bb139,null));};exports[_0xa032('0x28')]=function(_0x1d820b,_0x31dbd3){return db[_0xa032('0x2e')][_0xa032('0x49')]({'where':{'id':_0x1d820b[_0xa032('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31dbd3,null))[_0xa032('0x27')](removeEntity(_0x31dbd3,null))[_0xa032('0x46')](handleError(_0x31dbd3,null));};exports['describe']=function(_0x8ec4be,_0x10d735){return db[_0xa032('0x2e')][_0xa032('0x4d')]()[_0xa032('0x27')](respondWithResult(_0x10d735,null))['catch'](handleError(_0x10d735,null));}; \ No newline at end of file +var _0x6c5a=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','crypto','desk.js','querystring'];(function(_0x2b9dfa,_0x5277a6){var _0x124c62=function(_0x45e51b){while(--_0x45e51b){_0x2b9dfa['push'](_0x2b9dfa['shift']());}};_0x124c62(++_0x5277a6);}(_0x6c5a,0x14d));var _0xa6c5=function(_0x9ca2e9,_0x9c7653){_0x9ca2e9=_0x9ca2e9-0x0;var _0x5d7fe0=_0x6c5a[_0x9ca2e9];return _0x5d7fe0;};'use strict';var emlformat=require(_0xa6c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6c5('0x1'));var jsonpatch=require(_0xa6c5('0x2'));var rp=require(_0xa6c5('0x3'));var moment=require('moment');var BPromise=require(_0xa6c5('0x4'));var Mustache=require(_0xa6c5('0x5'));var util=require('util');var path=require(_0xa6c5('0x6'));var sox=require('sox');var csv=require(_0xa6c5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6c5('0x8'));var squel=require('squel');var crypto=require(_0xa6c5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa6c5('0xa'));var toCsv=require(_0xa6c5('0x7'));var querystring=require(_0xa6c5('0xb'));var Papa=require(_0xa6c5('0xc'));var Redis=require(_0xa6c5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa6c5('0xe'));var as=require(_0xa6c5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6c5('0x10'))(_0xa6c5('0x11'));var utils=require(_0xa6c5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x929660,_0x56afde){_0x56afde=_0x56afde||0xcc;return function(_0x2b0524){if(_0x2b0524){return _0x929660[_0xa6c5('0x13')](_0x56afde);}return _0x929660[_0xa6c5('0x14')](_0x56afde)[_0xa6c5('0x15')]();};}function respondWithResult(_0x476e62,_0x2fc26b){_0x2fc26b=_0x2fc26b||0xc8;return function(_0x163636){if(_0x163636){return _0x476e62[_0xa6c5('0x14')](_0x2fc26b)[_0xa6c5('0x16')](_0x163636);}};}function respondWithFilteredResult(_0x3d6a4b,_0x3e9f9b){return function(_0x597ff5){if(_0x597ff5){var _0x207f2c=typeof _0x3e9f9b['offset']==='undefined'&&typeof _0x3e9f9b[_0xa6c5('0x17')]===_0xa6c5('0x18');var _0x25256a=_0x597ff5[_0xa6c5('0x19')];var _0x15c50d=_0x207f2c?0x0:_0x3e9f9b[_0xa6c5('0x1a')];var _0x841c64=_0x207f2c?_0x597ff5[_0xa6c5('0x19')]:_0x3e9f9b[_0xa6c5('0x1a')]+_0x3e9f9b[_0xa6c5('0x17')];var _0x5a20e5;if(_0x841c64>=_0x25256a){_0x841c64=_0x25256a;_0x5a20e5=0xc8;}else{_0x5a20e5=0xce;}_0x3d6a4b['status'](_0x5a20e5);return _0x3d6a4b['set'](_0xa6c5('0x1b'),_0x15c50d+'-'+_0x841c64+'/'+_0x25256a)[_0xa6c5('0x16')](_0x597ff5);}return null;};}function patchUpdates(_0x37bcae){return function(_0x37e090){try{jsonpatch['apply'](_0x37e090,_0x37bcae,!![]);}catch(_0x33db7d){return BPromise[_0xa6c5('0x1c')](_0x33db7d);}return _0x37e090[_0xa6c5('0x1d')]();};}function saveUpdates(_0x54a058,_0x459e78){return function(_0x2b5ac8){if(_0x2b5ac8){return _0x2b5ac8[_0xa6c5('0x1e')](_0x54a058)[_0xa6c5('0x1f')](function(_0x406c11){return _0x406c11;});}return null;};}function removeEntity(_0x21cd92,_0x7598d){return function(_0xf3676){if(_0xf3676){return _0xf3676[_0xa6c5('0x20')]()[_0xa6c5('0x1f')](function(){_0x21cd92[_0xa6c5('0x14')](0xcc)[_0xa6c5('0x15')]();});}};}function handleEntityNotFound(_0x24da58,_0x4bc7b2){return function(_0x9a386c){if(!_0x9a386c){_0x24da58['sendStatus'](0x194);}return _0x9a386c;};}function handleError(_0x5f2cb7,_0x5e931b){_0x5e931b=_0x5e931b||0x1f4;return function(_0x5a6da7){logger[_0xa6c5('0x21')](_0x5a6da7[_0xa6c5('0x22')]);if(_0x5a6da7[_0xa6c5('0x23')]){delete _0x5a6da7[_0xa6c5('0x23')];}_0x5f2cb7[_0xa6c5('0x14')](_0x5e931b)['send'](_0x5a6da7);};}exports[_0xa6c5('0x24')]=function(_0x42c7a6,_0x1adce9){var _0x3ef48a={},_0x1e331f={},_0x41e79f={'count':0x0,'rows':[]};var _0x905de8=_[_0xa6c5('0x25')](db[_0xa6c5('0x26')][_0xa6c5('0x27')],function(_0x42f355){return{'name':_0x42f355[_0xa6c5('0x28')],'type':_0x42f355[_0xa6c5('0x29')]['key']};});_0x1e331f['model']=_[_0xa6c5('0x25')](_0x905de8,'name');_0x1e331f[_0xa6c5('0x2a')]=_[_0xa6c5('0x2b')](_0x42c7a6[_0xa6c5('0x2a')]);_0x1e331f[_0xa6c5('0x2c')]=_['intersection'](_0x1e331f[_0xa6c5('0x2d')],_0x1e331f[_0xa6c5('0x2a')]);_0x3ef48a[_0xa6c5('0x2e')]=_[_0xa6c5('0x2f')](_0x1e331f['model'],qs[_0xa6c5('0x30')](_0x42c7a6['query'][_0xa6c5('0x30')]));_0x3ef48a[_0xa6c5('0x2e')]=_0x3ef48a[_0xa6c5('0x2e')][_0xa6c5('0x31')]?_0x3ef48a[_0xa6c5('0x2e')]:_0x1e331f[_0xa6c5('0x2d')];if(!_0x42c7a6[_0xa6c5('0x2a')][_0xa6c5('0x32')](_0xa6c5('0x33'))){_0x3ef48a[_0xa6c5('0x17')]=qs[_0xa6c5('0x17')](_0x42c7a6[_0xa6c5('0x2a')][_0xa6c5('0x17')]);_0x3ef48a[_0xa6c5('0x1a')]=qs[_0xa6c5('0x1a')](_0x42c7a6['query'][_0xa6c5('0x1a')]);}_0x3ef48a[_0xa6c5('0x34')]=qs[_0xa6c5('0x35')](_0x42c7a6['query']['sort']);_0x3ef48a[_0xa6c5('0x36')]=qs[_0xa6c5('0x2c')](_['pick'](_0x42c7a6[_0xa6c5('0x2a')],_0x1e331f[_0xa6c5('0x2c')]),_0x905de8);if(_0x42c7a6[_0xa6c5('0x2a')][_0xa6c5('0x37')]){_0x3ef48a[_0xa6c5('0x36')]=_[_0xa6c5('0x38')](_0x3ef48a['where'],{'$or':_[_0xa6c5('0x25')](_0x905de8,function(_0x284d06){if(_0x284d06['type']!==_0xa6c5('0x39')){var _0x30c59d={};_0x30c59d[_0x284d06[_0xa6c5('0x23')]]={'$like':'%'+_0x42c7a6[_0xa6c5('0x2a')][_0xa6c5('0x37')]+'%'};return _0x30c59d;}})});}_0x3ef48a=_[_0xa6c5('0x38')]({},_0x3ef48a,_0x42c7a6[_0xa6c5('0x3a')]);var _0xe80015={'where':_0x3ef48a[_0xa6c5('0x36')]};return db['SquareDetailsReport'][_0xa6c5('0x19')](_0xe80015)[_0xa6c5('0x1f')](function(_0x777d11){_0x41e79f[_0xa6c5('0x19')]=_0x777d11;if(_0x42c7a6[_0xa6c5('0x2a')][_0xa6c5('0x3b')]){_0x3ef48a[_0xa6c5('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa6c5('0x3d')](_0x3ef48a);})[_0xa6c5('0x1f')](function(_0x1e2833){_0x41e79f[_0xa6c5('0x3e')]=_0x1e2833;return _0x41e79f;})[_0xa6c5('0x1f')](respondWithFilteredResult(_0x1adce9,_0x3ef48a))['catch'](handleError(_0x1adce9,null));};exports[_0xa6c5('0x3f')]=function(_0x32d7e3,_0x427770){var _0x161fcd={'raw':!![],'where':{'id':_0x32d7e3['params']['id']}},_0x50b29b={};_0x50b29b[_0xa6c5('0x2d')]=_[_0xa6c5('0x2b')](db[_0xa6c5('0x26')][_0xa6c5('0x27')]);_0x50b29b[_0xa6c5('0x2a')]=_[_0xa6c5('0x2b')](_0x32d7e3['query']);_0x50b29b[_0xa6c5('0x2c')]=_[_0xa6c5('0x2f')](_0x50b29b[_0xa6c5('0x2d')],_0x50b29b[_0xa6c5('0x2a')]);_0x161fcd[_0xa6c5('0x2e')]=_[_0xa6c5('0x2f')](_0x50b29b[_0xa6c5('0x2d')],qs[_0xa6c5('0x30')](_0x32d7e3[_0xa6c5('0x2a')]['fields']));_0x161fcd[_0xa6c5('0x2e')]=_0x161fcd['attributes'][_0xa6c5('0x31')]?_0x161fcd['attributes']:_0x50b29b[_0xa6c5('0x2d')];if(_0x32d7e3[_0xa6c5('0x2a')][_0xa6c5('0x3b')]){_0x161fcd[_0xa6c5('0x3c')]=[{'all':!![]}];}_0x161fcd=_[_0xa6c5('0x38')]({},_0x161fcd,_0x32d7e3[_0xa6c5('0x3a')]);return db[_0xa6c5('0x26')][_0xa6c5('0x40')](_0x161fcd)[_0xa6c5('0x1f')](handleEntityNotFound(_0x427770,null))[_0xa6c5('0x1f')](respondWithResult(_0x427770,null))[_0xa6c5('0x41')](handleError(_0x427770,null));};exports[_0xa6c5('0x42')]=function(_0x4c23c2,_0x23e1db){return db[_0xa6c5('0x26')]['create'](_0x4c23c2[_0xa6c5('0x43')],{})['then'](respondWithResult(_0x23e1db,0xc9))[_0xa6c5('0x41')](handleError(_0x23e1db,null));};exports[_0xa6c5('0x1e')]=function(_0x32559f,_0x284dd1){if(_0x32559f[_0xa6c5('0x43')]['id']){delete _0x32559f['body']['id'];}return db[_0xa6c5('0x26')][_0xa6c5('0x40')]({'where':{'id':_0x32559f['params']['id']}})['then'](handleEntityNotFound(_0x284dd1,null))['then'](saveUpdates(_0x32559f[_0xa6c5('0x43')],null))[_0xa6c5('0x1f')](respondWithResult(_0x284dd1,null))['catch'](handleError(_0x284dd1,null));};exports[_0xa6c5('0x20')]=function(_0x319d0b,_0x1edd2b){return db[_0xa6c5('0x26')]['find']({'where':{'id':_0x319d0b['params']['id']}})[_0xa6c5('0x1f')](handleEntityNotFound(_0x1edd2b,null))['then'](removeEntity(_0x1edd2b,null))[_0xa6c5('0x41')](handleError(_0x1edd2b,null));};exports[_0xa6c5('0x44')]=function(_0x1d4fb1,_0x264969){return db['SquareDetailsReport'][_0xa6c5('0x44')]()[_0xa6c5('0x1f')](respondWithResult(_0x264969,null))[_0xa6c5('0x41')](handleError(_0x264969,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 093ee70..0aec841 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 _0x7f12=['request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x165259,_0x5d6abf){var _0x58252a=function(_0x2cda3a){while(--_0x2cda3a){_0x165259['push'](_0x165259['shift']());}};_0x58252a(++_0x5d6abf);}(_0x7f12,0x7f));var _0x27f1=function(_0x5b3546,_0x4f4571){_0x5b3546=_0x5b3546-0x0;var _0x40f027=_0x7f12[_0x5b3546];return _0x40f027;};'use strict';var _=require(_0x27f1('0x0'));var util=require(_0x27f1('0x1'));var logger=require(_0x27f1('0x2'))('api');var moment=require(_0x27f1('0x3'));var BPromise=require(_0x27f1('0x4'));var rp=require(_0x27f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27f1('0x6'));var config=require('../../config/environment');var attributes=require(_0x27f1('0x7'));module[_0x27f1('0x8')]=function(_0x33b9a7,_0xd43e3e){return _0x33b9a7[_0x27f1('0x9')](_0x27f1('0xa'),attributes,{'tableName':_0x27f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4067=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x151f5e,_0x3f4ebc){var _0xc6e0fa=function(_0x444432){while(--_0x444432){_0x151f5e['push'](_0x151f5e['shift']());}};_0xc6e0fa(++_0x3f4ebc);}(_0x4067,0xe1));var _0x7406=function(_0x5c18b3,_0x5be1d0){_0x5c18b3=_0x5c18b3-0x0;var _0x20f00f=_0x4067[_0x5c18b3];return _0x20f00f;};'use strict';var _=require(_0x7406('0x0'));var util=require(_0x7406('0x1'));var logger=require(_0x7406('0x2'))(_0x7406('0x3'));var moment=require(_0x7406('0x4'));var BPromise=require(_0x7406('0x5'));var rp=require(_0x7406('0x6'));var fs=require('fs');var path=require(_0x7406('0x7'));var rimraf=require(_0x7406('0x8'));var config=require(_0x7406('0x9'));var attributes=require(_0x7406('0xa'));module[_0x7406('0xb')]=function(_0x370778,_0x44cb10){return _0x370778[_0x7406('0xc')](_0x7406('0xd'),attributes,{'tableName':_0x7406('0xe'),'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 38da70a..2967712 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 _0x5423=['options','raw','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5423,0xe3));var _0x3542=function(_0x9c8e6a,_0x10cd07){_0x9c8e6a=_0x9c8e6a-0x0;var _0x480e2b=_0x5423[_0x9c8e6a];return _0x480e2b;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')](_0x3d5199['body'],{'raw':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![]})[_0x3542('0x1b')](function(_0x212950){logger['info']('CreateSquareDetailsReport',_0x3d5199);logger['debug'](_0x3542('0x16'),_0x3d5199,JSON['stringify'](_0x212950));_0x32df3f(_0x212950);})[_0x3542('0x15')](function(_0x551645){logger[_0x3542('0x10')]('CreateSquareDetailsReport',_0x551645['message'],_0x3d5199);_0x53d4aa(_0x493d95[_0x3542('0x10')](0x1f4,_0x551645[_0x3542('0x13')]));});});}; \ No newline at end of file +var _0xe9e8=['info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x1b2c01,_0x88837f){_0x1b2c01=_0x1b2c01-0x0;var _0x431f88=_0xe9e8[_0x1b2c01];return _0x431f88;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});}exports['CreateSquareDetailsReport']=function(_0x42f8e8){var _0x40f4fd=this;return new Promise(function(_0x41cdc0,_0x28584b){return db[_0x8e9e('0x18')][_0x8e9e('0x19')](_0x42f8e8[_0x8e9e('0x1a')],{'raw':_0x42f8e8['options']?_0x42f8e8[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8e9e('0x1c')](function(_0x19a890){logger['info'](_0x8e9e('0x1d'),_0x42f8e8);logger[_0x8e9e('0xf')](_0x8e9e('0x1d'),_0x42f8e8,JSON[_0x8e9e('0x12')](_0x19a890));_0x41cdc0(_0x19a890);})[_0x8e9e('0x17')](function(_0x6a311b){logger[_0x8e9e('0x13')](_0x8e9e('0x1d'),_0x6a311b['message'],_0x42f8e8);_0x28584b(_0x40f4fd['error'](0x1f4,_0x6a311b[_0x8e9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 695ff2c..707a23c 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 _0x64ef=['express','../../components/auth/service','get','index','/process/:pid/kill','killProcess'];(function(_0x16da1b,_0x1b7945){var _0x57d944=function(_0x5597e3){while(--_0x5597e3){_0x16da1b['push'](_0x16da1b['shift']());}};_0x57d944(++_0x1b7945);}(_0x64ef,0x108));var _0xf64e=function(_0x501284,_0x1d3657){_0x501284=_0x501284-0x0;var _0x1312d7=_0x64ef[_0x501284];return _0x1312d7;};'use strict';var express=require(_0xf64e('0x0'));var router=express['Router']();var auth=require(_0xf64e('0x1'));var controller=require('./system.controller');router[_0xf64e('0x2')]('/',auth['isAuthenticated'](),controller[_0xf64e('0x3')]);router[_0xf64e('0x2')](_0xf64e('0x4'),auth['isAuthenticated'](),controller[_0xf64e('0x5')]);module['exports']=router; \ No newline at end of file +var _0x2785=['exports','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x2785,0x69));var _0x5278=function(_0x1fa56c,_0x42d719){_0x1fa56c=_0x1fa56c-0x0;var _0x1553b8=_0x2785[_0x1fa56c];return _0x1553b8;};'use strict';var express=require('express');var router=express[_0x5278('0x0')]();var auth=require(_0x5278('0x1'));var controller=require(_0x5278('0x2'));router[_0x5278('0x3')]('/',auth['isAuthenticated'](),controller[_0x5278('0x4')]);router[_0x5278('0x3')](_0x5278('0x5'),auth[_0x5278('0x6')](),controller['killProcess']);module[_0x5278('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c0b5cf0..7736a18 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 _0x0ccb=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','catch','killProcess'];(function(_0x48c691,_0x3b4b6b){var _0x27a6ba=function(_0x367371){while(--_0x367371){_0x48c691['push'](_0x48c691['shift']());}};_0x27a6ba(++_0x3b4b6b);}(_0x0ccb,0x128));var _0xb0cc=function(_0x4a3bba,_0x3e0670){_0x4a3bba=_0x4a3bba-0x0;var _0x3f9596=_0x0ccb[_0x4a3bba];return _0x3f9596;};'use strict';var info=require(_0xb0cc('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xb0cc('0x1'))(_0xb0cc('0x2'));var util=require(_0xb0cc('0x3'));var BPromise=require(_0xb0cc('0x4'));var _=require(_0xb0cc('0x5'));function handleError(_0x4cfbf0,_0x3cc43d,_0x5ff222){_0x3cc43d=_0x3cc43d||0x1f4;return function(_0x5a560b){logger[_0xb0cc('0x6')](_0xb0cc('0x7'),_0x5ff222,_0x3cc43d,util[_0xb0cc('0x8')](_0x5a560b,{'showHidden':![],'depth':null}));delete _0x5a560b[_0xb0cc('0x9')];_0x4cfbf0[_0xb0cc('0xa')](_0x3cc43d)[_0xb0cc('0xb')](_0x5a560b);};}exports['index']=function(_0x41abfa,_0x4554b6){return info[_0xb0cc('0xc')]()['then'](function(_0x27d91b){return _0x4554b6['status'](0xc8)[_0xb0cc('0xd')](_0x27d91b);})[_0xb0cc('0xe')](function(_0xd5102b){return _0x4554b6[_0xb0cc('0xa')](0x1f4)[_0xb0cc('0xd')](_0xd5102b);});};exports[_0xb0cc('0xf')]=function(_0x4c8b4c,_0x181eef){var _0x5d892d=[_0xb0cc('0x10')];return new BPromise(function(_0x455250,_0x4520a6){return exec(util[_0xb0cc('0x11')](_0xb0cc('0x12'),_0x4c8b4c[_0xb0cc('0x13')][_0xb0cc('0x14')]),function(_0x56b60d,_0x2869b1,_0x52fe78){if(_0x56b60d){return _0x4520a6(_0x56b60d);}return _0x455250(_0x2869b1);});})['then'](function(_0x285094){var _0x3f83f6=![];var _0x1ed947=_0x285094[_0xb0cc('0x15')](/\n/);for(var _0x15aa48=0x0,_0x21a012=_0x5d892d[_0xb0cc('0x16')];_0x15aa48<_0x21a012,_0x3f83f6===![];_0x15aa48+=0x1){if(_0x285094[_0xb0cc('0x17')](_0x5d892d[_0x15aa48])>=0x0){_0x3f83f6=!![];}}if(!_0x3f83f6){throw new Error(util[_0xb0cc('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4c8b4c[_0xb0cc('0x13')]['pid']));}process['kill'](_0x4c8b4c[_0xb0cc('0x13')]['pid'],_0xb0cc('0x18'));return _0x181eef[_0xb0cc('0xa')](0xc8)[_0xb0cc('0xd')]({'message':util[_0xb0cc('0x11')](_0xb0cc('0x19'),_0x4c8b4c['params'][_0xb0cc('0x14')])});})[_0xb0cc('0xe')](handleError(_0x181eef,null,_0xb0cc('0xf')));}; \ No newline at end of file +var _0x52d6=['child_process','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','systeminformation'];(function(_0x2e1ccc,_0x2a635f){var _0x2a12db=function(_0x42164a){while(--_0x42164a){_0x2e1ccc['push'](_0x2e1ccc['shift']());}};_0x2a12db(++_0x2a635f);}(_0x52d6,0x19d));var _0x652d=function(_0x4c3988,_0x39eb58){_0x4c3988=_0x4c3988-0x0;var _0x1f058e=_0x52d6[_0x4c3988];return _0x1f058e;};'use strict';var info=require(_0x652d('0x0'));var exec=require(_0x652d('0x1'))[_0x652d('0x2')];var logger=require('../../config/logger')(_0x652d('0x3'));var util=require(_0x652d('0x4'));var BPromise=require(_0x652d('0x5'));var _=require('lodash');function handleError(_0x57e2bd,_0x59cb37,_0x2e5b36){_0x59cb37=_0x59cb37||0x1f4;return function(_0xb6b833){logger[_0x652d('0x6')](_0x652d('0x7'),_0x2e5b36,_0x59cb37,util[_0x652d('0x8')](_0xb6b833,{'showHidden':![],'depth':null}));delete _0xb6b833['name'];_0x57e2bd[_0x652d('0x9')](_0x59cb37)['send'](_0xb6b833);};}exports['index']=function(_0x458566,_0x4ce0c0){return info['getAllData']()[_0x652d('0xa')](function(_0x4f478d){return _0x4ce0c0[_0x652d('0x9')](0xc8)[_0x652d('0xb')](_0x4f478d);})[_0x652d('0xc')](function(_0xa21222){return _0x4ce0c0[_0x652d('0x9')](0x1f4)[_0x652d('0xb')](_0xa21222);});};exports[_0x652d('0xd')]=function(_0x2fdd5b,_0x1caaad){var _0x23cdb3=[_0x652d('0xe')];return new BPromise(function(_0x4acc32,_0x1878d6){return exec(util['format'](_0x652d('0xf'),_0x2fdd5b['params']['pid']),function(_0x2b7292,_0x520805,_0x3fd460){if(_0x2b7292){return _0x1878d6(_0x2b7292);}return _0x4acc32(_0x520805);});})[_0x652d('0xa')](function(_0x2e85c2){var _0x1d059b=![];var _0x1c73f7=_0x2e85c2[_0x652d('0x10')](/\n/);for(var _0xfb4302=0x0,_0x230f88=_0x23cdb3[_0x652d('0x11')];_0xfb4302<_0x230f88,_0x1d059b===![];_0xfb4302+=0x1){if(_0x2e85c2[_0x652d('0x12')](_0x23cdb3[_0xfb4302])>=0x0){_0x1d059b=!![];}}if(!_0x1d059b){throw new Error(util[_0x652d('0x13')](_0x652d('0x14'),_0x2fdd5b[_0x652d('0x15')][_0x652d('0x16')]));}process['kill'](_0x2fdd5b[_0x652d('0x15')][_0x652d('0x16')],'SIGINT');return _0x1caaad[_0x652d('0x9')](0xc8)[_0x652d('0xb')]({'message':util[_0x652d('0x13')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2fdd5b[_0x652d('0x15')][_0x652d('0x16')])});})[_0x652d('0xc')](handleError(_0x1caaad,null,_0x652d('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 342c974..4548aa0 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/describe','show','post'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x1b5d50,_0x2909a2){var _0x354ff6=function(_0x1f93da){while(--_0x1f93da){_0x1b5d50['push'](_0x1b5d50['shift']());}};_0x354ff6(++_0x2909a2);}(_0x5b02,0xe9));var _0x25b0=function(_0x1c6ef8,_0x46b0b3){_0x1c6ef8=_0x1c6ef8-0x0;var _0x49fa23=_0x5b02[_0x1c6ef8];return _0x49fa23;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1dfd9a3..1fdd255 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 _0x253d=['sequelize','#0091EA','STRING'];(function(_0x1f0e3b,_0x23d2c8){var _0x202952=function(_0x10b678){while(--_0x10b678){_0x1f0e3b['push'](_0x1f0e3b['shift']());}};_0x202952(++_0x23d2c8);}(_0x253d,0x1b3));var _0xd253=function(_0x5f2a3f,_0x274522){_0x5f2a3f=_0x5f2a3f-0x0;var _0x338c10=_0x253d[_0x5f2a3f];return _0x338c10;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xd253('0x1')},'description':{'type':Sequelize[_0xd253('0x2')]}}; \ No newline at end of file +var _0x7d5a=['exports','STRING','name','#0091EA','sequelize'];(function(_0xda03f1,_0x3396c9){var _0xd80d8=function(_0x1f2daa){while(--_0x1f2daa){_0xda03f1['push'](_0xda03f1['shift']());}};_0xd80d8(++_0x3396c9);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x393a60,_0x192871){_0x393a60=_0x393a60-0x0;var _0x2f87c1=_0x7d5a[_0x393a60];return _0x2f87c1;};'use strict';var Sequelize=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]={'name':{'type':Sequelize[_0xa7d5('0x2')],'unique':_0xa7d5('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa7d5('0x2')],'defaultValue':_0xa7d5('0x4')},'description':{'type':Sequelize[_0xa7d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 637fecf..b19ac5e 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 _0xd653=['order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','end','error','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x34a923,_0x3ce38d){var _0x46442b=function(_0x110960){while(--_0x110960){_0x34a923['push'](_0x34a923['shift']());}};_0x46442b(++_0x3ce38d);}(_0xd653,0x6e));var _0x3d65=function(_0x3a65c8,_0x536dd7){_0x3a65c8=_0x3a65c8-0x0;var _0x523b8a=_0xd653[_0x3a65c8];return _0x523b8a;};'use strict';var emlformat=require(_0x3d65('0x0'));var rimraf=require(_0x3d65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d65('0x2'));var moment=require(_0x3d65('0x3'));var BPromise=require(_0x3d65('0x4'));var Mustache=require('mustache');var util=require(_0x3d65('0x5'));var path=require(_0x3d65('0x6'));var sox=require(_0x3d65('0x7'));var csv=require(_0x3d65('0x8'));var ejs=require(_0x3d65('0x9'));var fs=require('fs');var fs_extra=require(_0x3d65('0xa'));var _=require('lodash');var squel=require(_0x3d65('0xb'));var crypto=require(_0x3d65('0xc'));var jsforce=require(_0x3d65('0xd'));var deskjs=require(_0x3d65('0xe'));var toCsv=require(_0x3d65('0x8'));var querystring=require(_0x3d65('0xf'));var Papa=require('papaparse');var Redis=require(_0x3d65('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d65('0x11'));var as=require(_0x3d65('0x12'));var hardwareService=require(_0x3d65('0x13'));var logger=require('../../config/logger')(_0x3d65('0x14'));var utils=require(_0x3d65('0x15'));var config=require(_0x3d65('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525b0c,_0x4cbd80){_0x4cbd80=_0x4cbd80||0xcc;return function(_0x27aa6d){if(_0x27aa6d){return _0x525b0c[_0x3d65('0x17')](_0x4cbd80);}return _0x525b0c[_0x3d65('0x18')](_0x4cbd80)['end']();};}function respondWithResult(_0x3a2e6c,_0x1ad518){_0x1ad518=_0x1ad518||0xc8;return function(_0x1c7997){if(_0x1c7997){return _0x3a2e6c[_0x3d65('0x18')](_0x1ad518)[_0x3d65('0x19')](_0x1c7997);}};}function respondWithFilteredResult(_0x201c42,_0x48b80e){return function(_0x16415d){if(_0x16415d){var _0x3d4c68=typeof _0x48b80e[_0x3d65('0x1a')]==='undefined'&&typeof _0x48b80e[_0x3d65('0x1b')]===_0x3d65('0x1c');var _0x55aa01=_0x16415d['count'];var _0x32bdb9=_0x3d4c68?0x0:_0x48b80e['offset'];var _0x3497c8=_0x3d4c68?_0x16415d[_0x3d65('0x1d')]:_0x48b80e[_0x3d65('0x1a')]+_0x48b80e[_0x3d65('0x1b')];var _0x370cc7;if(_0x3497c8>=_0x55aa01){_0x3497c8=_0x55aa01;_0x370cc7=0xc8;}else{_0x370cc7=0xce;}_0x201c42[_0x3d65('0x18')](_0x370cc7);return _0x201c42[_0x3d65('0x1e')]('Content-Range',_0x32bdb9+'-'+_0x3497c8+'/'+_0x55aa01)[_0x3d65('0x19')](_0x16415d);}return null;};}function patchUpdates(_0x180f43){return function(_0x2d9c6d){try{jsonpatch[_0x3d65('0x1f')](_0x2d9c6d,_0x180f43,!![]);}catch(_0x230b37){return BPromise[_0x3d65('0x20')](_0x230b37);}return _0x2d9c6d['save']();};}function saveUpdates(_0x47f19f,_0x19a8a3){return function(_0x7a1759){if(_0x7a1759){return _0x7a1759[_0x3d65('0x21')](_0x47f19f)[_0x3d65('0x22')](function(_0x5ab424){return _0x5ab424;});}return null;};}function removeEntity(_0x1d1015,_0x559817){return function(_0x95a21a){if(_0x95a21a){return _0x95a21a[_0x3d65('0x23')]()['then'](function(){var _0x639b31=_0x95a21a[_0x3d65('0x24')]({'plain':!![]});var _0x53584f=_0x3d65('0x25');return db[_0x3d65('0x26')][_0x3d65('0x23')]({'where':{'type':_0x53584f,'resourceId':_0x639b31['id']}})[_0x3d65('0x22')](function(){return _0x95a21a;});})[_0x3d65('0x22')](function(){_0x1d1015[_0x3d65('0x18')](0xcc)[_0x3d65('0x27')]();});}};}function handleEntityNotFound(_0x5f21ce,_0x5d9bf5){return function(_0x1edf67){if(!_0x1edf67){_0x5f21ce[_0x3d65('0x17')](0x194);}return _0x1edf67;};}function handleError(_0x198d17,_0x15271e){_0x15271e=_0x15271e||0x1f4;return function(_0x20dad7){logger[_0x3d65('0x28')](_0x20dad7['stack']);if(_0x20dad7[_0x3d65('0x29')]){delete _0x20dad7[_0x3d65('0x29')];}_0x198d17['status'](_0x15271e)[_0x3d65('0x2a')](_0x20dad7);};}exports[_0x3d65('0x2b')]=function(_0x5593e4,_0x3c24db){var _0x50ae1b={},_0x4ea44a={},_0x51d17c={'count':0x0,'rows':[]};var _0x3a2295=_[_0x3d65('0x2c')](db[_0x3d65('0x2d')][_0x3d65('0x2e')],function(_0x2519d5){return{'name':_0x2519d5[_0x3d65('0x2f')],'type':_0x2519d5[_0x3d65('0x30')]['key']};});_0x4ea44a[_0x3d65('0x31')]=_[_0x3d65('0x2c')](_0x3a2295,'name');_0x4ea44a[_0x3d65('0x32')]=_[_0x3d65('0x33')](_0x5593e4['query']);_0x4ea44a['filters']=_[_0x3d65('0x34')](_0x4ea44a['model'],_0x4ea44a['query']);_0x50ae1b[_0x3d65('0x35')]=_[_0x3d65('0x34')](_0x4ea44a[_0x3d65('0x31')],qs['fields'](_0x5593e4['query'][_0x3d65('0x36')]));_0x50ae1b[_0x3d65('0x35')]=_0x50ae1b['attributes'][_0x3d65('0x37')]?_0x50ae1b[_0x3d65('0x35')]:_0x4ea44a[_0x3d65('0x31')];if(!_0x5593e4[_0x3d65('0x32')][_0x3d65('0x38')](_0x3d65('0x39'))){_0x50ae1b['limit']=qs['limit'](_0x5593e4[_0x3d65('0x32')][_0x3d65('0x1b')]);_0x50ae1b[_0x3d65('0x1a')]=qs[_0x3d65('0x1a')](_0x5593e4['query'][_0x3d65('0x1a')]);}_0x50ae1b[_0x3d65('0x3a')]=qs[_0x3d65('0x3b')](_0x5593e4['query'][_0x3d65('0x3b')]);_0x50ae1b[_0x3d65('0x3c')]=qs['filters'](_[_0x3d65('0x3d')](_0x5593e4[_0x3d65('0x32')],_0x4ea44a[_0x3d65('0x3e')]),_0x3a2295);if(_0x5593e4[_0x3d65('0x32')][_0x3d65('0x3f')]){_0x50ae1b['where']=_[_0x3d65('0x40')](_0x50ae1b[_0x3d65('0x3c')],{'$or':_[_0x3d65('0x2c')](_0x3a2295,function(_0x379a09){if(_0x379a09[_0x3d65('0x30')]!==_0x3d65('0x41')){var _0x1d1e37={};_0x1d1e37[_0x379a09[_0x3d65('0x29')]]={'$like':'%'+_0x5593e4['query'][_0x3d65('0x3f')]+'%'};return _0x1d1e37;}})});}_0x50ae1b=_[_0x3d65('0x40')]({},_0x50ae1b,_0x5593e4[_0x3d65('0x42')]);var _0xc7541c={'where':_0x50ae1b['where']};return db[_0x3d65('0x2d')][_0x3d65('0x1d')](_0xc7541c)[_0x3d65('0x22')](function(_0x3709ce){_0x51d17c[_0x3d65('0x1d')]=_0x3709ce;if(_0x5593e4[_0x3d65('0x32')][_0x3d65('0x43')]){_0x50ae1b[_0x3d65('0x44')]=[{'all':!![]}];}return db['Tag'][_0x3d65('0x45')](_0x50ae1b);})[_0x3d65('0x22')](function(_0x2193ce){_0x51d17c[_0x3d65('0x46')]=_0x2193ce;return _0x51d17c;})['then'](respondWithFilteredResult(_0x3c24db,_0x50ae1b))['catch'](handleError(_0x3c24db,null));};exports[_0x3d65('0x47')]=function(_0x3bdcd4,_0x1b10cb){var _0x27e191={'raw':!![],'where':{'id':_0x3bdcd4[_0x3d65('0x48')]['id']}},_0x252bb8={};_0x252bb8[_0x3d65('0x31')]=_[_0x3d65('0x33')](db[_0x3d65('0x2d')][_0x3d65('0x2e')]);_0x252bb8[_0x3d65('0x32')]=_[_0x3d65('0x33')](_0x3bdcd4[_0x3d65('0x32')]);_0x252bb8[_0x3d65('0x3e')]=_[_0x3d65('0x34')](_0x252bb8[_0x3d65('0x31')],_0x252bb8['query']);_0x27e191[_0x3d65('0x35')]=_[_0x3d65('0x34')](_0x252bb8[_0x3d65('0x31')],qs['fields'](_0x3bdcd4['query'][_0x3d65('0x36')]));_0x27e191['attributes']=_0x27e191[_0x3d65('0x35')][_0x3d65('0x37')]?_0x27e191[_0x3d65('0x35')]:_0x252bb8['model'];if(_0x3bdcd4[_0x3d65('0x32')][_0x3d65('0x43')]){_0x27e191[_0x3d65('0x44')]=[{'all':!![]}];}_0x27e191=_[_0x3d65('0x40')]({},_0x27e191,_0x3bdcd4['options']);return db[_0x3d65('0x2d')][_0x3d65('0x49')](_0x27e191)[_0x3d65('0x22')](handleEntityNotFound(_0x1b10cb,null))['then'](respondWithResult(_0x1b10cb,null))['catch'](handleError(_0x1b10cb,null));};exports[_0x3d65('0x4a')]=function(_0xd98b72,_0x3efef8){return db[_0x3d65('0x2d')][_0x3d65('0x4a')](_0xd98b72[_0x3d65('0x4b')],{})['then'](function(_0x19a9a0){var _0x14b588=_0xd98b72[_0x3d65('0x4c')][_0x3d65('0x24')]({'plain':!![]});if(!_0x14b588)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14b588[_0x3d65('0x4d')]==='user'){var _0x44f874=_0x19a9a0[_0x3d65('0x24')]({'plain':!![]});var _0x38e02a='Tags';return db[_0x3d65('0x4e')][_0x3d65('0x49')]({'where':{'name':_0x38e02a,'userProfileId':_0x14b588[_0x3d65('0x4f')]},'raw':!![]})[_0x3d65('0x22')](function(_0x42cae8){if(_0x42cae8&&_0x42cae8[_0x3d65('0x50')]===0x0){return db['UserProfileResource'][_0x3d65('0x4a')]({'name':_0x44f874['name'],'resourceId':_0x44f874['id'],'type':_0x42cae8['name'],'sectionId':_0x42cae8['id']},{})[_0x3d65('0x22')](function(){return _0x19a9a0;});}else{return _0x19a9a0;}})[_0x3d65('0x51')](function(_0x22bd5c){logger[_0x3d65('0x28')](_0x3d65('0x52'),_0x22bd5c);throw _0x22bd5c;});}return _0x19a9a0;})[_0x3d65('0x22')](respondWithResult(_0x3efef8,0xc9))[_0x3d65('0x51')](handleError(_0x3efef8,null));};exports['update']=function(_0x23d56a,_0x48ace4){if(_0x23d56a['body']['id']){delete _0x23d56a['body']['id'];}return db[_0x3d65('0x2d')][_0x3d65('0x49')]({'where':{'id':_0x23d56a[_0x3d65('0x48')]['id']}})[_0x3d65('0x22')](handleEntityNotFound(_0x48ace4,null))[_0x3d65('0x22')](saveUpdates(_0x23d56a[_0x3d65('0x4b')],null))[_0x3d65('0x22')](respondWithResult(_0x48ace4,null))[_0x3d65('0x51')](handleError(_0x48ace4,null));};exports[_0x3d65('0x23')]=function(_0xcea814,_0x47c13e){return db[_0x3d65('0x2d')][_0x3d65('0x49')]({'where':{'id':_0xcea814['params']['id']}})[_0x3d65('0x22')](handleEntityNotFound(_0x47c13e,null))[_0x3d65('0x22')](removeEntity(_0x47c13e,null))[_0x3d65('0x51')](handleError(_0x47c13e,null));};exports[_0x3d65('0x53')]=function(_0x433d3b,_0x7dd267){return db[_0x3d65('0x2d')][_0x3d65('0x53')]()[_0x3d65('0x22')](respondWithResult(_0x7dd267,null))['catch'](handleError(_0x7dd267,null));}; \ No newline at end of file +var _0xa4a9=['Tags','UserProfileResource','name','send','map','Tag','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','get'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa4a9,0x7a));var _0x9a4a=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0xa4a9[_0x4cc280];return _0x16ed24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a4a('0x0'));var zipdir=require(_0x9a4a('0x1'));var jsonpatch=require(_0x9a4a('0x2'));var rp=require(_0x9a4a('0x3'));var moment=require('moment');var BPromise=require(_0x9a4a('0x4'));var Mustache=require('mustache');var util=require(_0x9a4a('0x5'));var path=require(_0x9a4a('0x6'));var sox=require(_0x9a4a('0x7'));var csv=require(_0x9a4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a4a('0x9'));var _=require('lodash');var squel=require(_0x9a4a('0xa'));var crypto=require(_0x9a4a('0xb'));var jsforce=require(_0x9a4a('0xc'));var deskjs=require(_0x9a4a('0xd'));var toCsv=require(_0x9a4a('0x8'));var querystring=require(_0x9a4a('0xe'));var Papa=require(_0x9a4a('0xf'));var Redis=require(_0x9a4a('0x10'));var authService=require(_0x9a4a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9a4a('0x12'));var hardwareService=require(_0x9a4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9a4a('0x14'));var config=require(_0x9a4a('0x15'));var licenseUtil=require(_0x9a4a('0x16'));var db=require(_0x9a4a('0x17'))['db'];function respondWithStatusCode(_0xc75743,_0x2733ec){_0x2733ec=_0x2733ec||0xcc;return function(_0x124297){if(_0x124297){return _0xc75743[_0x9a4a('0x18')](_0x2733ec);}return _0xc75743[_0x9a4a('0x19')](_0x2733ec)[_0x9a4a('0x1a')]();};}function respondWithResult(_0x2cd3de,_0x585c1e){_0x585c1e=_0x585c1e||0xc8;return function(_0x55c1b0){if(_0x55c1b0){return _0x2cd3de[_0x9a4a('0x19')](_0x585c1e)[_0x9a4a('0x1b')](_0x55c1b0);}};}function respondWithFilteredResult(_0x46ab54,_0x1061b8){return function(_0x324284){if(_0x324284){var _0xe6233c=typeof _0x1061b8[_0x9a4a('0x1c')]===_0x9a4a('0x1d')&&typeof _0x1061b8['limit']===_0x9a4a('0x1d');var _0x15d09b=_0x324284['count'];var _0x2951fa=_0xe6233c?0x0:_0x1061b8[_0x9a4a('0x1c')];var _0x1fca98=_0xe6233c?_0x324284[_0x9a4a('0x1e')]:_0x1061b8['offset']+_0x1061b8['limit'];var _0xa6a265;if(_0x1fca98>=_0x15d09b){_0x1fca98=_0x15d09b;_0xa6a265=0xc8;}else{_0xa6a265=0xce;}_0x46ab54[_0x9a4a('0x19')](_0xa6a265);return _0x46ab54[_0x9a4a('0x1f')]('Content-Range',_0x2951fa+'-'+_0x1fca98+'/'+_0x15d09b)['json'](_0x324284);}return null;};}function patchUpdates(_0x2f6a43){return function(_0x409b1f){try{jsonpatch[_0x9a4a('0x20')](_0x409b1f,_0x2f6a43,!![]);}catch(_0x261dc2){return BPromise['reject'](_0x261dc2);}return _0x409b1f[_0x9a4a('0x21')]();};}function saveUpdates(_0xaea8af,_0x10e0e1){return function(_0x3a25c0){if(_0x3a25c0){return _0x3a25c0[_0x9a4a('0x22')](_0xaea8af)[_0x9a4a('0x23')](function(_0x100540){return _0x100540;});}return null;};}function removeEntity(_0x5afe83,_0x79e2f4){return function(_0x436537){if(_0x436537){return _0x436537[_0x9a4a('0x24')]()['then'](function(){var _0xda1a=_0x436537[_0x9a4a('0x25')]({'plain':!![]});var _0x1e9a9e=_0x9a4a('0x26');return db[_0x9a4a('0x27')][_0x9a4a('0x24')]({'where':{'type':_0x1e9a9e,'resourceId':_0xda1a['id']}})[_0x9a4a('0x23')](function(){return _0x436537;});})['then'](function(){_0x5afe83[_0x9a4a('0x19')](0xcc)[_0x9a4a('0x1a')]();});}};}function handleEntityNotFound(_0x2632b6,_0x4eacac){return function(_0x1c22d7){if(!_0x1c22d7){_0x2632b6[_0x9a4a('0x18')](0x194);}return _0x1c22d7;};}function handleError(_0x20f04f,_0x3564bc){_0x3564bc=_0x3564bc||0x1f4;return function(_0x565c08){logger['error'](_0x565c08['stack']);if(_0x565c08[_0x9a4a('0x28')]){delete _0x565c08[_0x9a4a('0x28')];}_0x20f04f[_0x9a4a('0x19')](_0x3564bc)[_0x9a4a('0x29')](_0x565c08);};}exports['index']=function(_0x4eee71,_0x18a170){var _0x21ea44={},_0x2ac9af={},_0x3e55ba={'count':0x0,'rows':[]};var _0x4b8953=_[_0x9a4a('0x2a')](db[_0x9a4a('0x2b')][_0x9a4a('0x2c')],function(_0x3f8e46){return{'name':_0x3f8e46['fieldName'],'type':_0x3f8e46[_0x9a4a('0x2d')][_0x9a4a('0x2e')]};});_0x2ac9af['model']=_[_0x9a4a('0x2a')](_0x4b8953,_0x9a4a('0x28'));_0x2ac9af[_0x9a4a('0x2f')]=_[_0x9a4a('0x30')](_0x4eee71['query']);_0x2ac9af['filters']=_[_0x9a4a('0x31')](_0x2ac9af[_0x9a4a('0x32')],_0x2ac9af[_0x9a4a('0x2f')]);_0x21ea44['attributes']=_[_0x9a4a('0x31')](_0x2ac9af['model'],qs[_0x9a4a('0x33')](_0x4eee71['query'][_0x9a4a('0x33')]));_0x21ea44[_0x9a4a('0x34')]=_0x21ea44[_0x9a4a('0x34')][_0x9a4a('0x35')]?_0x21ea44['attributes']:_0x2ac9af['model'];if(!_0x4eee71[_0x9a4a('0x2f')][_0x9a4a('0x36')](_0x9a4a('0x37'))){_0x21ea44[_0x9a4a('0x38')]=qs[_0x9a4a('0x38')](_0x4eee71['query']['limit']);_0x21ea44[_0x9a4a('0x1c')]=qs['offset'](_0x4eee71[_0x9a4a('0x2f')][_0x9a4a('0x1c')]);}_0x21ea44[_0x9a4a('0x39')]=qs['sort'](_0x4eee71['query']['sort']);_0x21ea44['where']=qs[_0x9a4a('0x3a')](_['pick'](_0x4eee71[_0x9a4a('0x2f')],_0x2ac9af[_0x9a4a('0x3a')]),_0x4b8953);if(_0x4eee71['query']['filter']){_0x21ea44[_0x9a4a('0x3b')]=_[_0x9a4a('0x3c')](_0x21ea44[_0x9a4a('0x3b')],{'$or':_[_0x9a4a('0x2a')](_0x4b8953,function(_0x1e4511){if(_0x1e4511['type']!==_0x9a4a('0x3d')){var _0x458791={};_0x458791[_0x1e4511[_0x9a4a('0x28')]]={'$like':'%'+_0x4eee71[_0x9a4a('0x2f')]['filter']+'%'};return _0x458791;}})});}_0x21ea44=_[_0x9a4a('0x3c')]({},_0x21ea44,_0x4eee71[_0x9a4a('0x3e')]);var _0x1ae3a7={'where':_0x21ea44['where']};return db['Tag'][_0x9a4a('0x1e')](_0x1ae3a7)[_0x9a4a('0x23')](function(_0x2dae03){_0x3e55ba['count']=_0x2dae03;if(_0x4eee71[_0x9a4a('0x2f')][_0x9a4a('0x3f')]){_0x21ea44[_0x9a4a('0x40')]=[{'all':!![]}];}return db[_0x9a4a('0x2b')][_0x9a4a('0x41')](_0x21ea44);})[_0x9a4a('0x23')](function(_0xbb4791){_0x3e55ba[_0x9a4a('0x42')]=_0xbb4791;return _0x3e55ba;})['then'](respondWithFilteredResult(_0x18a170,_0x21ea44))['catch'](handleError(_0x18a170,null));};exports[_0x9a4a('0x43')]=function(_0x5e5f69,_0x392b46){var _0x54d955={'raw':!![],'where':{'id':_0x5e5f69[_0x9a4a('0x44')]['id']}},_0x2f35c9={};_0x2f35c9['model']=_[_0x9a4a('0x30')](db[_0x9a4a('0x2b')][_0x9a4a('0x2c')]);_0x2f35c9[_0x9a4a('0x2f')]=_[_0x9a4a('0x30')](_0x5e5f69[_0x9a4a('0x2f')]);_0x2f35c9[_0x9a4a('0x3a')]=_[_0x9a4a('0x31')](_0x2f35c9[_0x9a4a('0x32')],_0x2f35c9[_0x9a4a('0x2f')]);_0x54d955[_0x9a4a('0x34')]=_[_0x9a4a('0x31')](_0x2f35c9['model'],qs[_0x9a4a('0x33')](_0x5e5f69[_0x9a4a('0x2f')][_0x9a4a('0x33')]));_0x54d955[_0x9a4a('0x34')]=_0x54d955[_0x9a4a('0x34')]['length']?_0x54d955[_0x9a4a('0x34')]:_0x2f35c9[_0x9a4a('0x32')];if(_0x5e5f69[_0x9a4a('0x2f')][_0x9a4a('0x3f')]){_0x54d955[_0x9a4a('0x40')]=[{'all':!![]}];}_0x54d955=_['merge']({},_0x54d955,_0x5e5f69[_0x9a4a('0x3e')]);return db[_0x9a4a('0x2b')]['find'](_0x54d955)[_0x9a4a('0x23')](handleEntityNotFound(_0x392b46,null))['then'](respondWithResult(_0x392b46,null))[_0x9a4a('0x45')](handleError(_0x392b46,null));};exports['create']=function(_0x5089eb,_0x373393){return db[_0x9a4a('0x2b')][_0x9a4a('0x46')](_0x5089eb['body'],{})[_0x9a4a('0x23')](function(_0x5803ea){var _0x4e2247=_0x5089eb[_0x9a4a('0x47')][_0x9a4a('0x25')]({'plain':!![]});if(!_0x4e2247)throw new Error(_0x9a4a('0x48'));if(_0x4e2247[_0x9a4a('0x49')]===_0x9a4a('0x47')){var _0x268074=_0x5803ea[_0x9a4a('0x25')]({'plain':!![]});var _0x4d84c3=_0x9a4a('0x26');return db[_0x9a4a('0x4a')]['find']({'where':{'name':_0x4d84c3,'userProfileId':_0x4e2247[_0x9a4a('0x4b')]},'raw':!![]})[_0x9a4a('0x23')](function(_0x2965cd){if(_0x2965cd&&_0x2965cd['autoAssociation']===0x0){return db[_0x9a4a('0x27')][_0x9a4a('0x46')]({'name':_0x268074[_0x9a4a('0x28')],'resourceId':_0x268074['id'],'type':_0x2965cd[_0x9a4a('0x28')],'sectionId':_0x2965cd['id']},{})[_0x9a4a('0x23')](function(){return _0x5803ea;});}else{return _0x5803ea;}})['catch'](function(_0x3b39b7){logger[_0x9a4a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b39b7);throw _0x3b39b7;});}return _0x5803ea;})['then'](respondWithResult(_0x373393,0xc9))[_0x9a4a('0x45')](handleError(_0x373393,null));};exports[_0x9a4a('0x22')]=function(_0xedb6cf,_0x1c6bbb){if(_0xedb6cf[_0x9a4a('0x4d')]['id']){delete _0xedb6cf[_0x9a4a('0x4d')]['id'];}return db[_0x9a4a('0x2b')][_0x9a4a('0x4e')]({'where':{'id':_0xedb6cf[_0x9a4a('0x44')]['id']}})[_0x9a4a('0x23')](handleEntityNotFound(_0x1c6bbb,null))[_0x9a4a('0x23')](saveUpdates(_0xedb6cf[_0x9a4a('0x4d')],null))[_0x9a4a('0x23')](respondWithResult(_0x1c6bbb,null))[_0x9a4a('0x45')](handleError(_0x1c6bbb,null));};exports[_0x9a4a('0x24')]=function(_0x3e97db,_0x13ff6a){return db[_0x9a4a('0x2b')][_0x9a4a('0x4e')]({'where':{'id':_0x3e97db[_0x9a4a('0x44')]['id']}})['then'](handleEntityNotFound(_0x13ff6a,null))[_0x9a4a('0x23')](removeEntity(_0x13ff6a,null))[_0x9a4a('0x45')](handleError(_0x13ff6a,null));};exports[_0x9a4a('0x4f')]=function(_0xf1c4d9,_0x430721){return db[_0x9a4a('0x2b')][_0x9a4a('0x4f')]()[_0x9a4a('0x23')](respondWithResult(_0x430721,null))[_0x9a4a('0x45')](handleError(_0x430721,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1533b82..8bb1b2c 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 _0x2db4=['moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','tools_tags','util','../../config/logger','api'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x2db4,0xd5));var _0x42db=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2db4[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x42db('0x0'));var logger=require(_0x42db('0x1'))(_0x42db('0x2'));var moment=require(_0x42db('0x3'));var BPromise=require(_0x42db('0x4'));var rp=require(_0x42db('0x5'));var fs=require('fs');var path=require(_0x42db('0x6'));var rimraf=require('rimraf');var config=require(_0x42db('0x7'));var attributes=require('./tag.attributes');module[_0x42db('0x8')]=function(_0x1bccb4,_0x3b612c){return _0x1bccb4[_0x42db('0x9')](_0x42db('0xa'),attributes,{'tableName':_0x42db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfd0=['../../config/logger','api','moment','bluebird','path','../../config/environment','./tag.attributes','define','Tag','lodash','util'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0xdfd0,0x13d));var _0x0dfd=function(_0x2eb935,_0x355b24){_0x2eb935=_0x2eb935-0x0;var _0x5306dc=_0xdfd0[_0x2eb935];return _0x5306dc;};'use strict';var _=require(_0x0dfd('0x0'));var util=require(_0x0dfd('0x1'));var logger=require(_0x0dfd('0x2'))(_0x0dfd('0x3'));var moment=require(_0x0dfd('0x4'));var BPromise=require(_0x0dfd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dfd('0x6'));var rimraf=require('rimraf');var config=require(_0x0dfd('0x7'));var attributes=require(_0x0dfd('0x8'));module['exports']=function(_0x1241ee,_0xd8073a){return _0x1241ee[_0x0dfd('0x9')](_0x0dfd('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a6604d7..d139d84 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 _0x72b1=['stringify','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x4d6581,_0x3fd72e){var _0x5e8cdf=function(_0x6667fe){while(--_0x6667fe){_0x4d6581['push'](_0x4d6581['shift']());}};_0x5e8cdf(++_0x3fd72e);}(_0x72b1,0x16e));var _0x172b=function(_0x58f6ff,_0x1af70d){_0x58f6ff=_0x58f6ff-0x0;var _0x5cdcfd=_0x72b1[_0x58f6ff];return _0x5cdcfd;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var moment=require(_0x172b('0x1'));var BPromise=require(_0x172b('0x2'));var rs=require(_0x172b('0x3'));var fs=require('fs');var Redis=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];var utils=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('rpc');var config=require(_0x172b('0x8'));var jayson=require(_0x172b('0x9'));var client=jayson[_0x172b('0xa')][_0x172b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571994,_0x345e5e,_0x517363){return new BPromise(function(_0x1f98e9,_0x531b10){return client[_0x172b('0xc')](_0x571994,_0x517363)[_0x172b('0xd')](function(_0x977f18){logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,_0x172b('0xf'));logger[_0x172b('0x10')](_0x172b('0x11'),_0x345e5e,_0x172b('0xf'),JSON[_0x172b('0x12')](_0x977f18));if(_0x977f18[_0x172b('0x13')]){if(_0x977f18[_0x172b('0x13')]['code']===0x1f4){logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18[_0x172b('0x13')]['message']);return _0x531b10(_0x977f18[_0x172b('0x13')]['message']);}logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18['error'][_0x172b('0x15')]);return _0x1f98e9(_0x977f18[_0x172b('0x13')][_0x172b('0x15')]);}else{logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,'request\x20sent');_0x1f98e9(_0x977f18[_0x172b('0x16')][_0x172b('0x15')]);}})[_0x172b('0x17')](function(_0x3c7fff){logger['error']('Tag,\x20%s,\x20%s',_0x345e5e,_0x3c7fff);_0x531b10(_0x3c7fff);});});} \ No newline at end of file +var _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('Tag,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7c93268..e136592 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_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('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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 3f914b8..269342f 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 _0xbaf0=['name','exports','STRING'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 48862f7..70a9079 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 _0x6b07=['lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','name','send','map','Team','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_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','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','addQueues','findOne','add','Queues','removeQueues','ids','addAgents','Voice','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','removeAgents','Chat','Mail','Queue:remove','UserVoicePrefix','getAgents','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','ejs','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6b07,0x8d));var _0x76b0=function(_0xaff09d,_0x38ee49){_0xaff09d=_0xaff09d-0x0;var _0x1e65da=_0x6b07[_0xaff09d];return _0x1e65da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76b0('0x0'));var zipdir=require(_0x76b0('0x1'));var jsonpatch=require(_0x76b0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76b0('0x3'));var path=require('path');var sox=require(_0x76b0('0x4'));var csv=require(_0x76b0('0x5'));var ejs=require(_0x76b0('0x6'));var fs=require('fs');var fs_extra=require(_0x76b0('0x7'));var _=require(_0x76b0('0x8'));var squel=require(_0x76b0('0x9'));var crypto=require(_0x76b0('0xa'));var jsforce=require(_0x76b0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x76b0('0xc'));var Papa=require(_0x76b0('0xd'));var Redis=require('ioredis');var authService=require(_0x76b0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x76b0('0xf'));var hardwareService=require(_0x76b0('0x10'));var logger=require('../../config/logger')(_0x76b0('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x76b0('0x12'));var db=require(_0x76b0('0x13'))['db'];config['redis']=_[_0x76b0('0x14')](config[_0x76b0('0x15')],{'host':_0x76b0('0x16'),'port':0x18eb});var socket=require(_0x76b0('0x17'))(new Redis(config[_0x76b0('0x15')]));require(_0x76b0('0x18'))[_0x76b0('0x19')](socket);function respondWithStatusCode(_0x48836d,_0x120290){_0x120290=_0x120290||0xcc;return function(_0x4d8437){if(_0x4d8437){return _0x48836d[_0x76b0('0x1a')](_0x120290);}return _0x48836d[_0x76b0('0x1b')](_0x120290)[_0x76b0('0x1c')]();};}function respondWithResult(_0x2e6591,_0x4e31d3){_0x4e31d3=_0x4e31d3||0xc8;return function(_0x17f4cf){if(_0x17f4cf){return _0x2e6591[_0x76b0('0x1b')](_0x4e31d3)[_0x76b0('0x1d')](_0x17f4cf);}};}function respondWithFilteredResult(_0x949e53,_0x414a70){return function(_0x501116){if(_0x501116){var _0x46c62f=typeof _0x414a70[_0x76b0('0x1e')]===_0x76b0('0x1f')&&typeof _0x414a70['limit']===_0x76b0('0x1f');var _0x4edf33=_0x501116[_0x76b0('0x20')];var _0x337017=_0x46c62f?0x0:_0x414a70['offset'];var _0x36948c=_0x46c62f?_0x501116[_0x76b0('0x20')]:_0x414a70[_0x76b0('0x1e')]+_0x414a70[_0x76b0('0x21')];var _0x4c26ea;if(_0x36948c>=_0x4edf33){_0x36948c=_0x4edf33;_0x4c26ea=0xc8;}else{_0x4c26ea=0xce;}_0x949e53[_0x76b0('0x1b')](_0x4c26ea);return _0x949e53[_0x76b0('0x22')](_0x76b0('0x23'),_0x337017+'-'+_0x36948c+'/'+_0x4edf33)['json'](_0x501116);}return null;};}function patchUpdates(_0x53d780){return function(_0x6dc6be){try{jsonpatch[_0x76b0('0x24')](_0x6dc6be,_0x53d780,!![]);}catch(_0x50f4a8){return BPromise['reject'](_0x50f4a8);}return _0x6dc6be[_0x76b0('0x25')]();};}function saveUpdates(_0x3158b8,_0x569e45){return function(_0x2a1118){if(_0x2a1118){return _0x2a1118[_0x76b0('0x26')](_0x3158b8)[_0x76b0('0x27')](function(_0x2c00d0){return _0x2c00d0;});}return null;};}function handleEntityNotFound(_0x295aa1,_0x1fef95){return function(_0x27bb55){if(!_0x27bb55){_0x295aa1['sendStatus'](0x194);}return _0x27bb55;};}function handleError(_0x352f8b,_0x425faf){_0x425faf=_0x425faf||0x1f4;return function(_0x4504c7){logger[_0x76b0('0x28')](_0x4504c7['stack']);if(_0x4504c7[_0x76b0('0x29')]){delete _0x4504c7[_0x76b0('0x29')];}_0x352f8b[_0x76b0('0x1b')](_0x425faf)[_0x76b0('0x2a')](_0x4504c7);};}exports['index']=function(_0x398921,_0x22cd6b){var _0x3dfab9={},_0x3c1c20={},_0x4e3c2b={'count':0x0,'rows':[]};var _0x115337=_[_0x76b0('0x2b')](db[_0x76b0('0x2c')][_0x76b0('0x2d')],function(_0x5c407b){return{'name':_0x5c407b[_0x76b0('0x2e')],'type':_0x5c407b[_0x76b0('0x2f')][_0x76b0('0x30')]};});_0x3c1c20['model']=_[_0x76b0('0x2b')](_0x115337,_0x76b0('0x29'));_0x3c1c20[_0x76b0('0x31')]=_[_0x76b0('0x32')](_0x398921['query']);_0x3c1c20['filters']=_[_0x76b0('0x33')](_0x3c1c20[_0x76b0('0x34')],_0x3c1c20[_0x76b0('0x31')]);_0x3dfab9['attributes']=_[_0x76b0('0x33')](_0x3c1c20[_0x76b0('0x34')],qs[_0x76b0('0x35')](_0x398921[_0x76b0('0x31')][_0x76b0('0x35')]));_0x3dfab9['attributes']=_0x3dfab9[_0x76b0('0x36')][_0x76b0('0x37')]?_0x3dfab9[_0x76b0('0x36')]:_0x3c1c20[_0x76b0('0x34')];if(!_0x398921[_0x76b0('0x31')][_0x76b0('0x38')](_0x76b0('0x39'))){_0x3dfab9[_0x76b0('0x21')]=qs[_0x76b0('0x21')](_0x398921[_0x76b0('0x31')][_0x76b0('0x21')]);_0x3dfab9[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x398921[_0x76b0('0x31')][_0x76b0('0x1e')]);}_0x3dfab9['order']=qs['sort'](_0x398921[_0x76b0('0x31')][_0x76b0('0x3a')]);_0x3dfab9[_0x76b0('0x3b')]=qs['filters'](_['pick'](_0x398921[_0x76b0('0x31')],_0x3c1c20[_0x76b0('0x3c')]),_0x115337);if(_0x398921[_0x76b0('0x31')][_0x76b0('0x3d')]){_0x3dfab9[_0x76b0('0x3b')]=_[_0x76b0('0x3e')](_0x3dfab9[_0x76b0('0x3b')],{'$or':_[_0x76b0('0x2b')](_0x115337,function(_0xa18edb){if(_0xa18edb[_0x76b0('0x2f')]!==_0x76b0('0x3f')){var _0x2a9822={};_0x2a9822[_0xa18edb[_0x76b0('0x29')]]={'$like':'%'+_0x398921['query'][_0x76b0('0x3d')]+'%'};return _0x2a9822;}})});}_0x3dfab9=_[_0x76b0('0x3e')]({},_0x3dfab9,_0x398921[_0x76b0('0x40')]);var _0x453db4={'where':_0x3dfab9['where']};return db['Team'][_0x76b0('0x20')](_0x453db4)[_0x76b0('0x27')](function(_0x5da0b2){_0x4e3c2b[_0x76b0('0x20')]=_0x5da0b2;if(_0x398921[_0x76b0('0x31')][_0x76b0('0x41')]){_0x3dfab9[_0x76b0('0x42')]=[{'all':!![]}];}return db[_0x76b0('0x2c')][_0x76b0('0x43')](_0x3dfab9);})[_0x76b0('0x27')](function(_0x11b12e){_0x4e3c2b['rows']=_0x11b12e;return _0x4e3c2b;})[_0x76b0('0x27')](respondWithFilteredResult(_0x22cd6b,_0x3dfab9))[_0x76b0('0x44')](handleError(_0x22cd6b,null));};exports[_0x76b0('0x45')]=function(_0x228f2b,_0x41483e){var _0xd2a0bb={'raw':![],'where':{'id':_0x228f2b[_0x76b0('0x46')]['id']}},_0x331a45={};_0x331a45[_0x76b0('0x34')]=_[_0x76b0('0x32')](db[_0x76b0('0x2c')]['rawAttributes']);_0x331a45[_0x76b0('0x31')]=_[_0x76b0('0x32')](_0x228f2b['query']);_0x331a45[_0x76b0('0x3c')]=_[_0x76b0('0x33')](_0x331a45[_0x76b0('0x34')],_0x331a45[_0x76b0('0x31')]);_0xd2a0bb[_0x76b0('0x36')]=_[_0x76b0('0x33')](_0x331a45[_0x76b0('0x34')],qs['fields'](_0x228f2b[_0x76b0('0x31')][_0x76b0('0x35')]));_0xd2a0bb[_0x76b0('0x36')]=_0xd2a0bb[_0x76b0('0x36')][_0x76b0('0x37')]?_0xd2a0bb[_0x76b0('0x36')]:_0x331a45[_0x76b0('0x34')];if(_0x228f2b['query'][_0x76b0('0x41')]){_0xd2a0bb[_0x76b0('0x42')]=[{'all':!![]}];}_0xd2a0bb=_['merge']({},_0xd2a0bb,_0x228f2b[_0x76b0('0x40')]);return db['Team'][_0x76b0('0x47')](_0xd2a0bb)[_0x76b0('0x27')](handleEntityNotFound(_0x41483e,null))[_0x76b0('0x27')](respondWithResult(_0x41483e,null))[_0x76b0('0x44')](handleError(_0x41483e,null));};exports['create']=function(_0x2f54b9,_0x279ceb){return db[_0x76b0('0x2c')][_0x76b0('0x48')](_0x2f54b9['body'],{})[_0x76b0('0x27')](function(_0x36b805){var _0x1926ef=_0x2f54b9[_0x76b0('0x49')][_0x76b0('0x4a')]({'plain':!![]});if(!_0x1926ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1926ef[_0x76b0('0x4b')]===_0x76b0('0x49')){var _0x509c48=_0x36b805[_0x76b0('0x4a')]({'plain':!![]});var _0x577bd2=_0x76b0('0x4c');return db[_0x76b0('0x4d')][_0x76b0('0x47')]({'where':{'name':_0x577bd2,'userProfileId':_0x1926ef[_0x76b0('0x4e')]},'raw':!![]})[_0x76b0('0x27')](function(_0x501d7c){if(_0x501d7c&&_0x501d7c[_0x76b0('0x4f')]===0x0){return db['UserProfileResource'][_0x76b0('0x48')]({'name':_0x509c48[_0x76b0('0x29')],'resourceId':_0x509c48['id'],'type':_0x501d7c[_0x76b0('0x29')],'sectionId':_0x501d7c['id']},{})['then'](function(){return _0x36b805;});}else{return _0x36b805;}})['catch'](function(_0x4c1a2b){logger[_0x76b0('0x28')](_0x76b0('0x50'),_0x4c1a2b);throw _0x4c1a2b;});}return _0x36b805;})[_0x76b0('0x27')](respondWithResult(_0x279ceb,0xc9))['catch'](handleError(_0x279ceb,null));};exports[_0x76b0('0x26')]=function(_0x2d7897,_0x27fb29){if(_0x2d7897[_0x76b0('0x51')]['id']){delete _0x2d7897[_0x76b0('0x51')]['id'];}return db[_0x76b0('0x2c')]['find']({'where':{'id':_0x2d7897['params']['id']}})[_0x76b0('0x27')](handleEntityNotFound(_0x27fb29,null))[_0x76b0('0x27')](saveUpdates(_0x2d7897[_0x76b0('0x51')],null))[_0x76b0('0x27')](respondWithResult(_0x27fb29,null))[_0x76b0('0x44')](handleError(_0x27fb29,null));};exports[_0x76b0('0x52')]=function(_0x3092d7,_0x52c2cc){var _0x302d25=_0x3092d7['params']['id'];var _0x56bef9=[];return db[_0x76b0('0x53')][_0x76b0('0x54')](function(_0x28409e){var _0x41e120='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x41e120,{'type':db[_0x76b0('0x55')][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e})[_0x76b0('0x27')](function(_0x38f74d){_0x56bef9=_[_0x76b0('0x2b')](_0x38f74d,function(_0x44b63c){return Number(_0x44b63c[_0x76b0('0x58')]);});})[_0x76b0('0x27')](function(){var _0x491fe5=_0x76b0('0x59')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x491fe5,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x1ee00b){var _0x38951e=_[_0x76b0('0x2b')](_0x1ee00b,function(_0xc013e8){return Number(_0xc013e8['VoiceQueueId']);});return db['UserVoiceQueue'][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'VoiceQueueId':{'$in':_0x38951e}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x52bf69='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x52bf69,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x189068){var _0x1458a4=_['map'](_0x189068,function(_0x48aaa9){return Number(_0x48aaa9[_0x76b0('0x5a')]);});return db[_0x76b0('0x5b')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'MailQueueId':{'$in':_0x1458a4}},'transaction':_0x28409e});})['then'](function(){var _0x2dab3b=_0x76b0('0x5c')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x2dab3b,{'type':db[_0x76b0('0x55')][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x36f5bc){var _0x65f465=_[_0x76b0('0x2b')](_0x36f5bc,function(_0x123e09){return Number(_0x123e09[_0x76b0('0x5d')]);});return db[_0x76b0('0x5e')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'SmsQueueId':{'$in':_0x65f465}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x2b5d79=_0x76b0('0x5f')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x2b5d79,{'type':db[_0x76b0('0x55')]['QueryTypes'][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x293db0){var _0x3678d4=_[_0x76b0('0x2b')](_0x293db0,function(_0x4ed9e6){return Number(_0x4ed9e6['ChatQueueId']);});return db[_0x76b0('0x60')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'ChatQueueId':{'$in':_0x3678d4}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x1a43ee=_0x76b0('0x61')+_0x302d25;return db['sequelize'][_0x76b0('0x31')](_0x1a43ee,{'type':db['Sequelize']['QueryTypes'][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x576648){var _0x39bcaa=_[_0x76b0('0x2b')](_0x576648,function(_0x5b182b){return Number(_0x5b182b[_0x76b0('0x62')]);});return db[_0x76b0('0x63')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'FaxQueueId':{'$in':_0x39bcaa}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x272aee='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x272aee,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x2e30da){var _0xddcb51=_[_0x76b0('0x2b')](_0x2e30da,function(_0x1483d1){return Number(_0x1483d1[_0x76b0('0x64')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x56bef9},'OpenchannelQueueId':{'$in':_0xddcb51}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x11ceed=_0x76b0('0x65')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x11ceed,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x54d23d){var _0x4026ed=_['map'](_0x54d23d,function(_0x50fb13){return Number(_0x50fb13['WhatsappQueueId']);});return db[_0x76b0('0x66')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'WhatsappQueueId':{'$in':_0x4026ed}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x47')]({'where':{'TeamId':_0x302d25}});})[_0x76b0('0x27')](function(_0x1b7641){if(_0x1b7641===null){return;}return db['UserVoicePrefix'][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'VoicePrefixId':_0x1b7641[_0x76b0('0x68')]},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){return db['Team'][_0x76b0('0x52')]({'where':{'id':_0x302d25},'cascade':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x29031c){if(_0x29031c===0x0){_0x52c2cc['sendStatus'](0x194);}else{return db[_0x76b0('0x69')][_0x76b0('0x52')]({'where':{'type':_0x76b0('0x4c'),'resourceId':_0x302d25},'cascade':!![],'transaction':_0x28409e})[_0x76b0('0x27')](function(){_0x52c2cc[_0x76b0('0x1b')](0xcc)[_0x76b0('0x1c')]();});}})[_0x76b0('0x44')](function(_0x2cb245){_0x52c2cc[_0x76b0('0x1b')](0x1f4)[_0x76b0('0x2a')](_0x2cb245);});});};exports[_0x76b0('0x6a')]=function(_0x5260bd,_0x536521,_0x52a8af){return db[_0x76b0('0x2c')]['findOne']({'where':{'id':_0x5260bd['params']['id']}})['then'](handleEntityNotFound(_0x536521,null))[_0x76b0('0x27')](function(_0x3ef146){if(!_0x5260bd[_0x76b0('0x31')][_0x76b0('0x6b')]||!utils[_0x76b0('0x6c')](_0x5260bd['query']['channel'])){throw new db[(_0x76b0('0x55'))][(_0x76b0('0x6d'))](_0x76b0('0x6e'));}var _0x5b4d71={};var _0x2c6c1e={};_0x2c6c1e['model']=_[_0x76b0('0x32')](db[_[_0x76b0('0x6f')](_0x5260bd['query'][_0x76b0('0x6b')][_0x76b0('0x70')]())+_0x76b0('0x71')][_0x76b0('0x2d')]);_0x2c6c1e['query']=_[_0x76b0('0x32')](_0x5260bd[_0x76b0('0x31')]);_0x2c6c1e['filters']=_['intersection'](_0x2c6c1e[_0x76b0('0x34')],_0x2c6c1e[_0x76b0('0x31')]);_0x5b4d71['attributes']=_[_0x76b0('0x33')](_0x2c6c1e[_0x76b0('0x34')],qs[_0x76b0('0x35')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x35')]));_0x5b4d71[_0x76b0('0x36')]=_0x5b4d71['attributes'][_0x76b0('0x37')]?_0x5b4d71[_0x76b0('0x36')]:_0x2c6c1e['model'];_0x5b4d71['limit']=qs[_0x76b0('0x21')](_0x5260bd[_0x76b0('0x31')]['limit']);_0x5b4d71[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x1e')]);_0x5b4d71[_0x76b0('0x72')]=qs['sort'](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x3a')]);_0x5b4d71[_0x76b0('0x3b')]=qs['filters'](_['pick'](_0x5260bd[_0x76b0('0x31')],_0x2c6c1e['filters']));_0x5b4d71=_['merge']({},_0x5b4d71,_0x5260bd['options']);return _0x3ef146[_0x76b0('0x4a')+_[_0x76b0('0x6f')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x6b')][_0x76b0('0x70')]())+'Queues'](_0x5b4d71);})['then'](respondWithResult(_0x536521,null))[_0x76b0('0x44')](handleError(_0x536521,null));};exports[_0x76b0('0x73')]=function(_0x215c67,_0x107ada,_0x1f2c71){return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x215c67[_0x76b0('0x46')]['id']}})[_0x76b0('0x27')](function(_0x3a4f71){if(_0x3a4f71){if(!_0x215c67[_0x76b0('0x51')]['channel']||!utils[_0x76b0('0x6c')](_0x215c67[_0x76b0('0x51')][_0x76b0('0x6b')])){throw new db[(_0x76b0('0x55'))]['ValidationError'](_0x76b0('0x6e'));}return _0x3a4f71[_0x76b0('0x75')+_[_0x76b0('0x6f')](_0x215c67[_0x76b0('0x51')][_0x76b0('0x6b')][_0x76b0('0x70')]())+_0x76b0('0x76')](_0x215c67[_0x76b0('0x51')]['ids']);}return null;})[_0x76b0('0x27')](handleEntityNotFound(_0x107ada,null))['then'](respondWithStatusCode(_0x107ada,null))['catch'](handleError(_0x107ada,null));};exports[_0x76b0('0x77')]=function(_0x3924d3,_0x159266,_0x39f9c0){return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x3924d3['params']['id']}})[_0x76b0('0x27')](function(_0x425e26){if(_0x425e26){if(!_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')]||!utils[_0x76b0('0x6c')](_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')])){throw new db[(_0x76b0('0x55'))][(_0x76b0('0x6d'))](_0x76b0('0x6e'));}return _0x425e26['remove'+_['capitalize'](_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')][_0x76b0('0x70')]())+'Queues'](_0x3924d3['query'][_0x76b0('0x78')]);}return null;})[_0x76b0('0x27')](handleEntityNotFound(_0x159266,null))[_0x76b0('0x27')](respondWithStatusCode(_0x159266,null))[_0x76b0('0x44')](handleError(_0x159266,null));};exports[_0x76b0('0x79')]=function(_0x31b22e,_0x2317b9){var _0x239b79=_['isArray'](_0x31b22e[_0x76b0('0x51')][_0x76b0('0x78')])?_0x31b22e[_0x76b0('0x51')]['ids']:[_0x31b22e[_0x76b0('0x51')]['ids']];var _0x325c1e=_0x31b22e[_0x76b0('0x46')]['id'];return db[_0x76b0('0x2c')][_0x76b0('0x47')]({'where':{'id':_0x325c1e}})['then'](handleEntityNotFound(_0x2317b9,null))[_0x76b0('0x27')](function(_0x5d19fb){if(_0x5d19fb){var _0x316a2b=[_0x76b0('0x7a'),'Chat','Mail',_0x76b0('0x7b'),_0x76b0('0x7c'),_0x76b0('0x7d'),_0x76b0('0x7e')];return db['sequelize']['transaction'](function(_0x3d97ef){var _0x397897=_[_0x76b0('0x2b')](_0x316a2b,function(_0x35dd70){var _0x555ca0={'attributes':['id',_0x76b0('0x29')]};if(_0x35dd70===_0x76b0('0x7a')){_0x555ca0[_0x76b0('0x7f')]={'attributes':[_0x76b0('0x80')]};}return _0x5d19fb[_0x76b0('0x4a')+_0x35dd70+_0x76b0('0x76')](_0x555ca0)[_0x76b0('0x27')](function(_0x4119da){var _0x2832ef=_[_0x76b0('0x2b')](_0x4119da,function(_0x4e0dbf){var _0x5d1419=_[_0x76b0('0x2b')](_0x239b79,function(_0x2cbefd){var _0x14e3d5={'where':{'UserId':_0x2cbefd,[_0x35dd70+'QueueId']:_0x4e0dbf['id']},'transaction':_0x3d97ef};if(_0x35dd70==='Voice'){_0x14e3d5[_0x76b0('0x14')]={'penalty':_0x4e0dbf[_0x76b0('0x81')][_0x76b0('0x80')]};}return db[_0x76b0('0x82')+_0x35dd70+_0x76b0('0x71')][_0x76b0('0x83')](_0x14e3d5)[_0x76b0('0x27')](function(){socket[_0x76b0('0x84')](_0x76b0('0x49')+_0x35dd70+_0x76b0('0x85'),{'UserId':_0x2cbefd,[_0x35dd70+_0x76b0('0x86')]:_0x4e0dbf['id']});if(_0x35dd70!=='Voice'){return;}return db['User'][_0x76b0('0x43')]({'where':{'id':_0x239b79,'online':0x1},'attributes':['id',_0x76b0('0x29'),_0x76b0('0x87'),_0x76b0('0x88'),_0x76b0('0x89')],'raw':!![]})[_0x76b0('0x27')](function(_0x12641f){var _0xfe32d6=_[_0x76b0('0x2b')](_0x12641f,function(_0x2e5db2){return db[_0x76b0('0x8a')][_0x76b0('0x8b')]({'membername':_0x2e5db2[_0x76b0('0x29')],'UserId':_0x2e5db2['id'],'queue_name':_0x4e0dbf[_0x76b0('0x29')],'VoiceQueueId':_0x4e0dbf['id'],'interface':_[_0x76b0('0x8c')](_0x2e5db2['interface'])?util[_0x76b0('0x8d')]('SIP/%s',_0x2e5db2[_0x76b0('0x29')]):_0x2e5db2[_0x76b0('0x89')],'paused':_0x2e5db2['voicePause']||![],'penalty':_0x4e0dbf['TeamVoiceQueue'][_0x76b0('0x80')]},{'transaction':_0x3d97ef});});return Promise[_0x76b0('0x8e')](_0xfe32d6);});});});return Promise['all'](_0x5d1419);});return Promise[_0x76b0('0x8e')](_0x2832ef);})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x74')]({'where':{'teamId':_0x325c1e}})[_0x76b0('0x27')](function(_0x342df0){if(_0x342df0){var _0x5d99a5=_[_0x76b0('0x2b')](_0x239b79,function(_0x365492){db['UserVoicePrefix']['upsert']({'UserId':_0x365492,'VoicePrefixId':_0x342df0[_0x76b0('0x68')]});});return Promise[_0x76b0('0x8e')](_0x5d99a5);}});});});return Promise[_0x76b0('0x8e')](_0x397897)['then'](function(){return _0x5d19fb[_0x76b0('0x79')](_0x239b79,{'transaction':_0x3d97ef})['spread'](function(_0x23b3a7){return _0x23b3a7;});});});}})[_0x76b0('0x27')](respondWithResult(_0x2317b9,null))[_0x76b0('0x44')](handleError(_0x2317b9,null));};exports[_0x76b0('0x8f')]=function(_0x3787c8,_0x21f68e){var _0x47eeef=_['isArray'](_0x3787c8[_0x76b0('0x31')][_0x76b0('0x78')])?_0x3787c8[_0x76b0('0x31')]['ids']:[_0x3787c8[_0x76b0('0x31')][_0x76b0('0x78')]];var _0x4915e6=_0x3787c8[_0x76b0('0x46')]['id'];return db[_0x76b0('0x2c')][_0x76b0('0x47')]({'where':{'id':_0x4915e6}})['then'](handleEntityNotFound(_0x21f68e,null))['then'](function(_0x4b3f4e){if(_0x4b3f4e){var _0x45c43e=[_0x76b0('0x7a'),_0x76b0('0x90'),_0x76b0('0x91'),_0x76b0('0x7b'),'Fax','Openchannel',_0x76b0('0x7e')];return db[_0x76b0('0x53')]['transaction'](function(_0x232299){var _0x1025cb=_[_0x76b0('0x2b')](_0x45c43e,function(_0x1b8862){var _0xe6f7c5={'attributes':['id',_0x76b0('0x29')]};return _0x4b3f4e[_0x76b0('0x4a')+_0x1b8862+_0x76b0('0x76')](_0xe6f7c5)[_0x76b0('0x27')](function(_0x54492c){var _0x2bb301=_[_0x76b0('0x2b')](_0x54492c,function(_0x3af0a3){return _0x3af0a3[_0x76b0('0x8f')](_0x47eeef,{'transaction':_0x232299})['then'](function(){var _0x3038d8=_[_0x76b0('0x2b')](_0x47eeef,function(_0x591e80){socket[_0x76b0('0x84')](_0x76b0('0x49')+_0x1b8862+_0x76b0('0x92'),{'UserId':Number(_0x591e80),[_0x1b8862+'QueueId']:_0x3af0a3['id']});if(_0x1b8862!==_0x76b0('0x7a')){return;}return db['UserVoiceQueueRt'][_0x76b0('0x52')]({'where':{'VoiceQueueId':_0x3af0a3['id'],'UserId':_0x591e80},'transaction':_0x232299});});return Promise[_0x76b0('0x8e')](_0x3038d8);});});return Promise[_0x76b0('0x8e')](_0x2bb301);});});return Promise[_0x76b0('0x8e')](_0x1025cb)['then'](function(){return _0x4b3f4e[_0x76b0('0x8f')](_0x47eeef,{'transaction':_0x232299});})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x74')]({'where':{'teamId':_0x4915e6}})[_0x76b0('0x27')](function(_0xa9ebd3){if(_0xa9ebd3){var _0x32d982=_[_0x76b0('0x2b')](_0x47eeef,function(_0x30b042){db[_0x76b0('0x93')][_0x76b0('0x52')]({'where':{'UserId':_0x30b042,'VoicePrefixId':_0xa9ebd3[_0x76b0('0x68')]}});});return Promise[_0x76b0('0x8e')](_0x32d982);}});});});}})[_0x76b0('0x27')](respondWithStatusCode(_0x21f68e,null))[_0x76b0('0x44')](handleError(_0x21f68e,null));};exports[_0x76b0('0x94')]=function(_0x2b4b27,_0x431b5d,_0x4e5273){var _0xd03e79={};var _0x55e4ae={};var _0x18018f;var _0x3f176e;return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x2b4b27[_0x76b0('0x46')]['id']}})[_0x76b0('0x27')](handleEntityNotFound(_0x431b5d,null))[_0x76b0('0x27')](function(_0x987d5){if(_0x987d5){_0x18018f=_0x987d5;_0x55e4ae['model']=_[_0x76b0('0x32')](db[_0x76b0('0x82')][_0x76b0('0x2d')]);_0x55e4ae['query']=_['keys'](_0x2b4b27[_0x76b0('0x31')]);_0x55e4ae['filters']=_[_0x76b0('0x33')](_0x55e4ae[_0x76b0('0x34')],_0x55e4ae['query']);_0xd03e79[_0x76b0('0x36')]=_[_0x76b0('0x33')](_0x55e4ae['model'],qs[_0x76b0('0x35')](_0x2b4b27[_0x76b0('0x31')]['fields']));_0xd03e79[_0x76b0('0x36')]=_0xd03e79[_0x76b0('0x36')][_0x76b0('0x37')]?_0xd03e79[_0x76b0('0x36')]:_0x55e4ae[_0x76b0('0x34')];_0xd03e79[_0x76b0('0x72')]=qs['sort'](_0x2b4b27[_0x76b0('0x31')][_0x76b0('0x3a')]);_0xd03e79[_0x76b0('0x3b')]=qs[_0x76b0('0x3c')](_['pick'](_0x2b4b27[_0x76b0('0x31')],_0x55e4ae[_0x76b0('0x3c')]));if(_0x2b4b27[_0x76b0('0x31')][_0x76b0('0x3d')]){_0xd03e79[_0x76b0('0x3b')]=_[_0x76b0('0x3e')](_0xd03e79[_0x76b0('0x3b')],{'$or':_['map'](_0xd03e79[_0x76b0('0x36')],function(_0x53385c){var _0x1721f8={};_0x1721f8[_0x53385c]={'$like':'%'+_0x2b4b27['query']['filter']+'%'};return _0x1721f8;})});}_0xd03e79=_[_0x76b0('0x3e')]({},_0xd03e79,_0x2b4b27[_0x76b0('0x40')]);return _0x18018f[_0x76b0('0x94')](_0xd03e79);}})[_0x76b0('0x27')](function(_0x2540dd){if(_0x2540dd){_0x3f176e=_0x2540dd['length'];if(!_0x2b4b27[_0x76b0('0x31')]['hasOwnProperty'](_0x76b0('0x39'))){_0xd03e79[_0x76b0('0x21')]=qs[_0x76b0('0x21')](_0x2b4b27['query'][_0x76b0('0x21')]);_0xd03e79[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x2b4b27[_0x76b0('0x31')]['offset']);}return _0x18018f[_0x76b0('0x94')](_0xd03e79);}})[_0x76b0('0x27')](function(_0x587bb8){if(_0x587bb8){return _0x587bb8?{'count':_0x3f176e,'rows':_0x587bb8}:null;}})[_0x76b0('0x27')](respondWithResult(_0x431b5d,null))[_0x76b0('0x44')](handleError(_0x431b5d,null));}; \ No newline at end of file +var _0x7cdb=['UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','length','pick','isValidChannel','capitalize','Queues','ids','remove','isArray','Voice','Chat','Mail','Openchannel','Whatsapp','through','penalty','QueueId','User','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','addAgents','spread','removeAgents','Fax','Queue:remove','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','end','undefined','count','offset','Content-Range','json','reject','save','update','sendStatus','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','keys','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7cdb,0x17d));var _0xb7cd=function(_0x280d71,_0xe818ec){_0x280d71=_0x280d71-0x0;var _0x4eec09=_0x7cdb[_0x280d71];return _0x4eec09;};'use strict';var emlformat=require(_0xb7cd('0x0'));var rimraf=require(_0xb7cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7cd('0x2'));var rp=require(_0xb7cd('0x3'));var moment=require(_0xb7cd('0x4'));var BPromise=require(_0xb7cd('0x5'));var Mustache=require(_0xb7cd('0x6'));var util=require(_0xb7cd('0x7'));var path=require('path');var sox=require(_0xb7cd('0x8'));var csv=require(_0xb7cd('0x9'));var ejs=require(_0xb7cd('0xa'));var fs=require('fs');var fs_extra=require(_0xb7cd('0xb'));var _=require(_0xb7cd('0xc'));var squel=require(_0xb7cd('0xd'));var crypto=require(_0xb7cd('0xe'));var jsforce=require(_0xb7cd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7cd('0x10'));var Redis=require(_0xb7cd('0x11'));var authService=require(_0xb7cd('0x12'));var qs=require(_0xb7cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7cd('0x14'));var logger=require(_0xb7cd('0x15'))(_0xb7cd('0x16'));var utils=require('../../config/utils');var config=require(_0xb7cd('0x17'));var licenseUtil=require(_0xb7cd('0x18'));var db=require(_0xb7cd('0x19'))['db'];config[_0xb7cd('0x1a')]=_[_0xb7cd('0x1b')](config[_0xb7cd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7cd('0x1c'))(new Redis(config['redis']));require(_0xb7cd('0x1d'))[_0xb7cd('0x1e')](socket);function respondWithStatusCode(_0x551f1e,_0x27b372){_0x27b372=_0x27b372||0xcc;return function(_0x33fd2f){if(_0x33fd2f){return _0x551f1e['sendStatus'](_0x27b372);}return _0x551f1e[_0xb7cd('0x1f')](_0x27b372)[_0xb7cd('0x20')]();};}function respondWithResult(_0x5f46eb,_0x52785d){_0x52785d=_0x52785d||0xc8;return function(_0x2db8fc){if(_0x2db8fc){return _0x5f46eb['status'](_0x52785d)['json'](_0x2db8fc);}};}function respondWithFilteredResult(_0x1346af,_0x539527){return function(_0x11d6d6){if(_0x11d6d6){var _0x579a42=typeof _0x539527['offset']==='undefined'&&typeof _0x539527['limit']===_0xb7cd('0x21');var _0x66b915=_0x11d6d6[_0xb7cd('0x22')];var _0x132880=_0x579a42?0x0:_0x539527[_0xb7cd('0x23')];var _0x207ce1=_0x579a42?_0x11d6d6[_0xb7cd('0x22')]:_0x539527[_0xb7cd('0x23')]+_0x539527['limit'];var _0x7d19f1;if(_0x207ce1>=_0x66b915){_0x207ce1=_0x66b915;_0x7d19f1=0xc8;}else{_0x7d19f1=0xce;}_0x1346af[_0xb7cd('0x1f')](_0x7d19f1);return _0x1346af['set'](_0xb7cd('0x24'),_0x132880+'-'+_0x207ce1+'/'+_0x66b915)[_0xb7cd('0x25')](_0x11d6d6);}return null;};}function patchUpdates(_0x36e3ba){return function(_0x4b998c){try{jsonpatch['apply'](_0x4b998c,_0x36e3ba,!![]);}catch(_0x11ea41){return BPromise[_0xb7cd('0x26')](_0x11ea41);}return _0x4b998c[_0xb7cd('0x27')]();};}function saveUpdates(_0x14b3fa,_0x83a830){return function(_0x500fc4){if(_0x500fc4){return _0x500fc4[_0xb7cd('0x28')](_0x14b3fa)['then'](function(_0x2e6e5a){return _0x2e6e5a;});}return null;};}function handleEntityNotFound(_0x9d3504,_0x133a21){return function(_0xfcde2b){if(!_0xfcde2b){_0x9d3504[_0xb7cd('0x29')](0x194);}return _0xfcde2b;};}function handleError(_0x3a3aef,_0x47460a){_0x47460a=_0x47460a||0x1f4;return function(_0xe47e5a){logger['error'](_0xe47e5a[_0xb7cd('0x2a')]);if(_0xe47e5a[_0xb7cd('0x2b')]){delete _0xe47e5a[_0xb7cd('0x2b')];}_0x3a3aef[_0xb7cd('0x1f')](_0x47460a)[_0xb7cd('0x2c')](_0xe47e5a);};}exports[_0xb7cd('0x2d')]=function(_0x1d244c,_0x489bfc){var _0x5c5202={},_0xbb9abc={},_0x232796={'count':0x0,'rows':[]};var _0x2557f1=_[_0xb7cd('0x2e')](db[_0xb7cd('0x2f')][_0xb7cd('0x30')],function(_0x38dbb8){return{'name':_0x38dbb8[_0xb7cd('0x31')],'type':_0x38dbb8['type'][_0xb7cd('0x32')]};});_0xbb9abc[_0xb7cd('0x33')]=_['map'](_0x2557f1,_0xb7cd('0x2b'));_0xbb9abc[_0xb7cd('0x34')]=_['keys'](_0x1d244c[_0xb7cd('0x34')]);_0xbb9abc['filters']=_[_0xb7cd('0x35')](_0xbb9abc[_0xb7cd('0x33')],_0xbb9abc[_0xb7cd('0x34')]);_0x5c5202[_0xb7cd('0x36')]=_[_0xb7cd('0x35')](_0xbb9abc[_0xb7cd('0x33')],qs[_0xb7cd('0x37')](_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x37')]));_0x5c5202[_0xb7cd('0x36')]=_0x5c5202[_0xb7cd('0x36')]['length']?_0x5c5202[_0xb7cd('0x36')]:_0xbb9abc['model'];if(!_0x1d244c['query'][_0xb7cd('0x38')]('nolimit')){_0x5c5202[_0xb7cd('0x39')]=qs[_0xb7cd('0x39')](_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x39')]);_0x5c5202[_0xb7cd('0x23')]=qs[_0xb7cd('0x23')](_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x23')]);}_0x5c5202[_0xb7cd('0x3a')]=qs[_0xb7cd('0x3b')](_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x3b')]);_0x5c5202[_0xb7cd('0x3c')]=qs[_0xb7cd('0x3d')](_['pick'](_0x1d244c[_0xb7cd('0x34')],_0xbb9abc[_0xb7cd('0x3d')]),_0x2557f1);if(_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x3e')]){_0x5c5202['where']=_[_0xb7cd('0x3f')](_0x5c5202[_0xb7cd('0x3c')],{'$or':_[_0xb7cd('0x2e')](_0x2557f1,function(_0x267816){if(_0x267816['type']!==_0xb7cd('0x40')){var _0x20a8e0={};_0x20a8e0[_0x267816[_0xb7cd('0x2b')]]={'$like':'%'+_0x1d244c[_0xb7cd('0x34')][_0xb7cd('0x3e')]+'%'};return _0x20a8e0;}})});}_0x5c5202=_[_0xb7cd('0x3f')]({},_0x5c5202,_0x1d244c[_0xb7cd('0x41')]);var _0x2732f1={'where':_0x5c5202[_0xb7cd('0x3c')]};return db[_0xb7cd('0x2f')][_0xb7cd('0x22')](_0x2732f1)[_0xb7cd('0x42')](function(_0x2ca9a2){_0x232796['count']=_0x2ca9a2;if(_0x1d244c['query'][_0xb7cd('0x43')]){_0x5c5202[_0xb7cd('0x44')]=[{'all':!![]}];}return db[_0xb7cd('0x2f')]['findAll'](_0x5c5202);})['then'](function(_0x1d13bc){_0x232796[_0xb7cd('0x45')]=_0x1d13bc;return _0x232796;})['then'](respondWithFilteredResult(_0x489bfc,_0x5c5202))[_0xb7cd('0x46')](handleError(_0x489bfc,null));};exports[_0xb7cd('0x47')]=function(_0x8db21d,_0x32ebff){var _0x3117b6={'raw':![],'where':{'id':_0x8db21d[_0xb7cd('0x48')]['id']}},_0x2a4e77={};_0x2a4e77[_0xb7cd('0x33')]=_['keys'](db[_0xb7cd('0x2f')][_0xb7cd('0x30')]);_0x2a4e77['query']=_[_0xb7cd('0x49')](_0x8db21d[_0xb7cd('0x34')]);_0x2a4e77['filters']=_['intersection'](_0x2a4e77['model'],_0x2a4e77['query']);_0x3117b6[_0xb7cd('0x36')]=_[_0xb7cd('0x35')](_0x2a4e77['model'],qs[_0xb7cd('0x37')](_0x8db21d[_0xb7cd('0x34')]['fields']));_0x3117b6[_0xb7cd('0x36')]=_0x3117b6['attributes']['length']?_0x3117b6[_0xb7cd('0x36')]:_0x2a4e77['model'];if(_0x8db21d[_0xb7cd('0x34')][_0xb7cd('0x43')]){_0x3117b6[_0xb7cd('0x44')]=[{'all':!![]}];}_0x3117b6=_[_0xb7cd('0x3f')]({},_0x3117b6,_0x8db21d[_0xb7cd('0x41')]);return db[_0xb7cd('0x2f')]['find'](_0x3117b6)[_0xb7cd('0x42')](handleEntityNotFound(_0x32ebff,null))['then'](respondWithResult(_0x32ebff,null))[_0xb7cd('0x46')](handleError(_0x32ebff,null));};exports[_0xb7cd('0x4a')]=function(_0x3941e3,_0x3ed111){return db['Team'][_0xb7cd('0x4a')](_0x3941e3['body'],{})['then'](function(_0xf508f4){var _0x558184=_0x3941e3[_0xb7cd('0x4b')][_0xb7cd('0x4c')]({'plain':!![]});if(!_0x558184)throw new Error(_0xb7cd('0x4d'));if(_0x558184[_0xb7cd('0x4e')]===_0xb7cd('0x4b')){var _0x1d5ff5=_0xf508f4[_0xb7cd('0x4c')]({'plain':!![]});var _0x152925='Teams';return db[_0xb7cd('0x4f')]['find']({'where':{'name':_0x152925,'userProfileId':_0x558184[_0xb7cd('0x50')]},'raw':!![]})[_0xb7cd('0x42')](function(_0x5289cb){if(_0x5289cb&&_0x5289cb[_0xb7cd('0x51')]===0x0){return db[_0xb7cd('0x52')][_0xb7cd('0x4a')]({'name':_0x1d5ff5['name'],'resourceId':_0x1d5ff5['id'],'type':_0x5289cb[_0xb7cd('0x2b')],'sectionId':_0x5289cb['id']},{})['then'](function(){return _0xf508f4;});}else{return _0xf508f4;}})[_0xb7cd('0x46')](function(_0xbaf30c){logger[_0xb7cd('0x53')](_0xb7cd('0x54'),_0xbaf30c);throw _0xbaf30c;});}return _0xf508f4;})[_0xb7cd('0x42')](respondWithResult(_0x3ed111,0xc9))[_0xb7cd('0x46')](handleError(_0x3ed111,null));};exports['update']=function(_0x12140e,_0x355e63){if(_0x12140e[_0xb7cd('0x55')]['id']){delete _0x12140e[_0xb7cd('0x55')]['id'];}return db[_0xb7cd('0x2f')][_0xb7cd('0x56')]({'where':{'id':_0x12140e['params']['id']}})[_0xb7cd('0x42')](handleEntityNotFound(_0x355e63,null))['then'](saveUpdates(_0x12140e[_0xb7cd('0x55')],null))['then'](respondWithResult(_0x355e63,null))[_0xb7cd('0x46')](handleError(_0x355e63,null));};exports['destroy']=function(_0xbd50d7,_0x43d83c){var _0x42e4b2=_0xbd50d7[_0xb7cd('0x48')]['id'];var _0x14016b=[];return db[_0xb7cd('0x57')][_0xb7cd('0x58')](function(_0x817979){var _0x1ca38e=_0xb7cd('0x59')+_0x42e4b2;return db[_0xb7cd('0x57')]['query'](_0x1ca38e,{'type':db['Sequelize'][_0xb7cd('0x5a')][_0xb7cd('0x5b')],'raw':!![],'transaction':_0x817979})[_0xb7cd('0x42')](function(_0x30f210){_0x14016b=_['map'](_0x30f210,function(_0x3f1b92){return Number(_0x3f1b92['UserId']);});})['then'](function(){var _0x3e7d33=_0xb7cd('0x5c')+_0x42e4b2;return db[_0xb7cd('0x57')][_0xb7cd('0x34')](_0x3e7d33,{'type':db[_0xb7cd('0x5d')][_0xb7cd('0x5a')]['SELECT'],'raw':!![],'transaction':_0x817979});})['then'](function(_0x5f079b){var _0x7e312a=_[_0xb7cd('0x2e')](_0x5f079b,function(_0x4f50ba){return Number(_0x4f50ba[_0xb7cd('0x5e')]);});return db[_0xb7cd('0x5f')][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'VoiceQueueId':{'$in':_0x7e312a}},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){var _0x2bc4cd=_0xb7cd('0x61')+_0x42e4b2;return db['sequelize']['query'](_0x2bc4cd,{'type':db[_0xb7cd('0x5d')]['QueryTypes'][_0xb7cd('0x5b')],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x1b2ad0){var _0x6055d1=_[_0xb7cd('0x2e')](_0x1b2ad0,function(_0x43faba){return Number(_0x43faba[_0xb7cd('0x62')]);});return db[_0xb7cd('0x63')][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'MailQueueId':{'$in':_0x6055d1}},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){var _0xce9c95='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x42e4b2;return db['sequelize'][_0xb7cd('0x34')](_0xce9c95,{'type':db[_0xb7cd('0x5d')]['QueryTypes'][_0xb7cd('0x5b')],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x8eed45){var _0x41075d=_[_0xb7cd('0x2e')](_0x8eed45,function(_0x34a38c){return Number(_0x34a38c[_0xb7cd('0x64')]);});return db[_0xb7cd('0x65')][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'SmsQueueId':{'$in':_0x41075d}},'transaction':_0x817979});})['then'](function(){var _0x53a000=_0xb7cd('0x66')+_0x42e4b2;return db[_0xb7cd('0x57')][_0xb7cd('0x34')](_0x53a000,{'type':db['Sequelize'][_0xb7cd('0x5a')]['SELECT'],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x8cc3a3){var _0x12941d=_['map'](_0x8cc3a3,function(_0x44b95a){return Number(_0x44b95a[_0xb7cd('0x67')]);});return db[_0xb7cd('0x68')]['destroy']({'where':{'UserId':{'$in':_0x14016b},'ChatQueueId':{'$in':_0x12941d}},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){var _0x155292='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x42e4b2;return db[_0xb7cd('0x57')]['query'](_0x155292,{'type':db[_0xb7cd('0x5d')][_0xb7cd('0x5a')][_0xb7cd('0x5b')],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x91f670){var _0x38a4bf=_[_0xb7cd('0x2e')](_0x91f670,function(_0x3a7d7c){return Number(_0x3a7d7c[_0xb7cd('0x69')]);});return db[_0xb7cd('0x6a')][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'FaxQueueId':{'$in':_0x38a4bf}},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){var _0x125ea2=_0xb7cd('0x6b')+_0x42e4b2;return db['sequelize'][_0xb7cd('0x34')](_0x125ea2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x4ef05e){var _0x56f0b7=_[_0xb7cd('0x2e')](_0x4ef05e,function(_0x421485){return Number(_0x421485[_0xb7cd('0x6c')]);});return db[_0xb7cd('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x14016b},'OpenchannelQueueId':{'$in':_0x56f0b7}},'transaction':_0x817979});})['then'](function(){var _0x35c954=_0xb7cd('0x6e')+_0x42e4b2;return db[_0xb7cd('0x57')][_0xb7cd('0x34')](_0x35c954,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x4ef9c4){var _0xc9ad87=_[_0xb7cd('0x2e')](_0x4ef9c4,function(_0x43cc71){return Number(_0x43cc71[_0xb7cd('0x6f')]);});return db['UserWhatsappQueue'][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'WhatsappQueueId':{'$in':_0xc9ad87}},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){return db['TeamVoicePrefix'][_0xb7cd('0x56')]({'where':{'TeamId':_0x42e4b2}});})[_0xb7cd('0x42')](function(_0x3456d1){if(_0x3456d1===null){return;}return db[_0xb7cd('0x70')][_0xb7cd('0x60')]({'where':{'UserId':{'$in':_0x14016b},'VoicePrefixId':_0x3456d1[_0xb7cd('0x71')]},'transaction':_0x817979});})[_0xb7cd('0x42')](function(){return db[_0xb7cd('0x2f')]['destroy']({'where':{'id':_0x42e4b2},'cascade':!![],'transaction':_0x817979});})[_0xb7cd('0x42')](function(_0x337c84){if(_0x337c84===0x0){_0x43d83c[_0xb7cd('0x29')](0x194);}else{return db[_0xb7cd('0x52')][_0xb7cd('0x60')]({'where':{'type':_0xb7cd('0x72'),'resourceId':_0x42e4b2},'cascade':!![],'transaction':_0x817979})[_0xb7cd('0x42')](function(){_0x43d83c['status'](0xcc)[_0xb7cd('0x20')]();});}})[_0xb7cd('0x46')](function(_0xf89032){_0x43d83c[_0xb7cd('0x1f')](0x1f4)[_0xb7cd('0x2c')](_0xf89032);});});};exports[_0xb7cd('0x73')]=function(_0x17dff6,_0x5e0fd4,_0x41e0a8){return db[_0xb7cd('0x2f')][_0xb7cd('0x74')]({'where':{'id':_0x17dff6[_0xb7cd('0x48')]['id']}})[_0xb7cd('0x42')](handleEntityNotFound(_0x5e0fd4,null))['then'](function(_0xe7e51d){if(!_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x75')]||!utils['isValidChannel'](_0x17dff6[_0xb7cd('0x34')]['channel'])){throw new db[(_0xb7cd('0x5d'))][(_0xb7cd('0x76'))](_0xb7cd('0x77'));}var _0x3967c6={};var _0x2ae4bb={};_0x2ae4bb['model']=_[_0xb7cd('0x49')](db[_['capitalize'](_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x75')][_0xb7cd('0x78')]())+_0xb7cd('0x79')]['rawAttributes']);_0x2ae4bb[_0xb7cd('0x34')]=_[_0xb7cd('0x49')](_0x17dff6[_0xb7cd('0x34')]);_0x2ae4bb[_0xb7cd('0x3d')]=_[_0xb7cd('0x35')](_0x2ae4bb[_0xb7cd('0x33')],_0x2ae4bb['query']);_0x3967c6[_0xb7cd('0x36')]=_['intersection'](_0x2ae4bb[_0xb7cd('0x33')],qs['fields'](_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x37')]));_0x3967c6['attributes']=_0x3967c6[_0xb7cd('0x36')][_0xb7cd('0x7a')]?_0x3967c6['attributes']:_0x2ae4bb[_0xb7cd('0x33')];_0x3967c6[_0xb7cd('0x39')]=qs[_0xb7cd('0x39')](_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x39')]);_0x3967c6[_0xb7cd('0x23')]=qs[_0xb7cd('0x23')](_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x23')]);_0x3967c6['order']=qs[_0xb7cd('0x3b')](_0x17dff6[_0xb7cd('0x34')][_0xb7cd('0x3b')]);_0x3967c6[_0xb7cd('0x3c')]=qs[_0xb7cd('0x3d')](_[_0xb7cd('0x7b')](_0x17dff6['query'],_0x2ae4bb['filters']));_0x3967c6=_['merge']({},_0x3967c6,_0x17dff6[_0xb7cd('0x41')]);return _0xe7e51d['get'+_['capitalize'](_0x17dff6['query']['channel']['toLowerCase']())+'Queues'](_0x3967c6);})[_0xb7cd('0x42')](respondWithResult(_0x5e0fd4,null))['catch'](handleError(_0x5e0fd4,null));};exports['addQueues']=function(_0x1259d8,_0x9d857a,_0x5bda15){return db[_0xb7cd('0x2f')][_0xb7cd('0x74')]({'where':{'id':_0x1259d8['params']['id']}})[_0xb7cd('0x42')](function(_0x2ad746){if(_0x2ad746){if(!_0x1259d8['body'][_0xb7cd('0x75')]||!utils[_0xb7cd('0x7c')](_0x1259d8[_0xb7cd('0x55')][_0xb7cd('0x75')])){throw new db['Sequelize'][(_0xb7cd('0x76'))](_0xb7cd('0x77'));}return _0x2ad746['add'+_[_0xb7cd('0x7d')](_0x1259d8['body']['channel'][_0xb7cd('0x78')]())+_0xb7cd('0x7e')](_0x1259d8['body'][_0xb7cd('0x7f')]);}return null;})[_0xb7cd('0x42')](handleEntityNotFound(_0x9d857a,null))[_0xb7cd('0x42')](respondWithStatusCode(_0x9d857a,null))[_0xb7cd('0x46')](handleError(_0x9d857a,null));};exports['removeQueues']=function(_0x2a1141,_0x4fdae6,_0x4fd9ff){return db[_0xb7cd('0x2f')][_0xb7cd('0x74')]({'where':{'id':_0x2a1141[_0xb7cd('0x48')]['id']}})[_0xb7cd('0x42')](function(_0x52ca9d){if(_0x52ca9d){if(!_0x2a1141[_0xb7cd('0x34')][_0xb7cd('0x75')]||!utils[_0xb7cd('0x7c')](_0x2a1141[_0xb7cd('0x34')]['channel'])){throw new db[(_0xb7cd('0x5d'))][(_0xb7cd('0x76'))](_0xb7cd('0x77'));}return _0x52ca9d[_0xb7cd('0x80')+_[_0xb7cd('0x7d')](_0x2a1141['query'][_0xb7cd('0x75')][_0xb7cd('0x78')]())+'Queues'](_0x2a1141[_0xb7cd('0x34')][_0xb7cd('0x7f')]);}return null;})[_0xb7cd('0x42')](handleEntityNotFound(_0x4fdae6,null))[_0xb7cd('0x42')](respondWithStatusCode(_0x4fdae6,null))['catch'](handleError(_0x4fdae6,null));};exports['addAgents']=function(_0x19bc3c,_0x5e797e){var _0x2c1169=_[_0xb7cd('0x81')](_0x19bc3c['body'][_0xb7cd('0x7f')])?_0x19bc3c[_0xb7cd('0x55')][_0xb7cd('0x7f')]:[_0x19bc3c[_0xb7cd('0x55')]['ids']];var _0x5e0d39=_0x19bc3c[_0xb7cd('0x48')]['id'];return db[_0xb7cd('0x2f')]['find']({'where':{'id':_0x5e0d39}})[_0xb7cd('0x42')](handleEntityNotFound(_0x5e797e,null))[_0xb7cd('0x42')](function(_0x42ff63){if(_0x42ff63){var _0x1b456a=[_0xb7cd('0x82'),_0xb7cd('0x83'),_0xb7cd('0x84'),'Sms','Fax',_0xb7cd('0x85'),_0xb7cd('0x86')];return db[_0xb7cd('0x57')][_0xb7cd('0x58')](function(_0x51f9ae){var _0xa90aac=_[_0xb7cd('0x2e')](_0x1b456a,function(_0x4d20d6){var _0x12df00={'attributes':['id',_0xb7cd('0x2b')]};if(_0x4d20d6===_0xb7cd('0x82')){_0x12df00[_0xb7cd('0x87')]={'attributes':[_0xb7cd('0x88')]};}return _0x42ff63[_0xb7cd('0x4c')+_0x4d20d6+_0xb7cd('0x7e')](_0x12df00)[_0xb7cd('0x42')](function(_0x4ba054){var _0x191279=_[_0xb7cd('0x2e')](_0x4ba054,function(_0x47bc0a){var _0x2e64b0=_[_0xb7cd('0x2e')](_0x2c1169,function(_0x3b8d49){var _0x87c609={'where':{'UserId':_0x3b8d49,[_0x4d20d6+_0xb7cd('0x89')]:_0x47bc0a['id']},'transaction':_0x51f9ae};if(_0x4d20d6==='Voice'){_0x87c609[_0xb7cd('0x1b')]={'penalty':_0x47bc0a['TeamVoiceQueue'][_0xb7cd('0x88')]};}return db[_0xb7cd('0x8a')+_0x4d20d6+_0xb7cd('0x79')]['findOrCreate'](_0x87c609)[_0xb7cd('0x42')](function(){socket[_0xb7cd('0x8b')](_0xb7cd('0x4b')+_0x4d20d6+_0xb7cd('0x8c'),{'UserId':_0x3b8d49,[_0x4d20d6+_0xb7cd('0x89')]:_0x47bc0a['id']});if(_0x4d20d6!==_0xb7cd('0x82')){return;}return db[_0xb7cd('0x8a')][_0xb7cd('0x8d')]({'where':{'id':_0x2c1169,'online':0x1},'attributes':['id',_0xb7cd('0x2b'),_0xb7cd('0x8e'),_0xb7cd('0x8f'),_0xb7cd('0x90')],'raw':!![]})[_0xb7cd('0x42')](function(_0x353d61){var _0x1d751f=_['map'](_0x353d61,function(_0x334cc2){return db[_0xb7cd('0x91')][_0xb7cd('0x92')]({'membername':_0x334cc2[_0xb7cd('0x2b')],'UserId':_0x334cc2['id'],'queue_name':_0x47bc0a[_0xb7cd('0x2b')],'VoiceQueueId':_0x47bc0a['id'],'interface':_[_0xb7cd('0x93')](_0x334cc2[_0xb7cd('0x90')])?util[_0xb7cd('0x94')](_0xb7cd('0x95'),_0x334cc2[_0xb7cd('0x2b')]):_0x334cc2[_0xb7cd('0x90')],'paused':_0x334cc2['voicePause']||![],'penalty':_0x47bc0a[_0xb7cd('0x96')][_0xb7cd('0x88')]},{'transaction':_0x51f9ae});});return Promise[_0xb7cd('0x97')](_0x1d751f);});});});return Promise[_0xb7cd('0x97')](_0x2e64b0);});return Promise[_0xb7cd('0x97')](_0x191279);})[_0xb7cd('0x42')](function(){return db[_0xb7cd('0x98')][_0xb7cd('0x74')]({'where':{'teamId':_0x5e0d39}})[_0xb7cd('0x42')](function(_0x35c5ce){if(_0x35c5ce){var _0x20fa4f=_['map'](_0x2c1169,function(_0x13e9c0){db[_0xb7cd('0x70')][_0xb7cd('0x92')]({'UserId':_0x13e9c0,'VoicePrefixId':_0x35c5ce[_0xb7cd('0x71')]});});return Promise[_0xb7cd('0x97')](_0x20fa4f);}});});});return Promise['all'](_0xa90aac)[_0xb7cd('0x42')](function(){return _0x42ff63[_0xb7cd('0x99')](_0x2c1169,{'transaction':_0x51f9ae})[_0xb7cd('0x9a')](function(_0x453595){return _0x453595;});});});}})[_0xb7cd('0x42')](respondWithResult(_0x5e797e,null))[_0xb7cd('0x46')](handleError(_0x5e797e,null));};exports[_0xb7cd('0x9b')]=function(_0x5087b7,_0x24c696){var _0x1824d0=_['isArray'](_0x5087b7[_0xb7cd('0x34')][_0xb7cd('0x7f')])?_0x5087b7[_0xb7cd('0x34')][_0xb7cd('0x7f')]:[_0x5087b7[_0xb7cd('0x34')][_0xb7cd('0x7f')]];var _0x25cc85=_0x5087b7[_0xb7cd('0x48')]['id'];return db[_0xb7cd('0x2f')]['find']({'where':{'id':_0x25cc85}})[_0xb7cd('0x42')](handleEntityNotFound(_0x24c696,null))[_0xb7cd('0x42')](function(_0x1dddc6){if(_0x1dddc6){var _0x1a27d2=[_0xb7cd('0x82'),_0xb7cd('0x83'),_0xb7cd('0x84'),'Sms',_0xb7cd('0x9c'),'Openchannel',_0xb7cd('0x86')];return db['sequelize'][_0xb7cd('0x58')](function(_0x2b7b4b){var _0x2114d3=_['map'](_0x1a27d2,function(_0x2534e1){var _0x12404d={'attributes':['id','name']};return _0x1dddc6[_0xb7cd('0x4c')+_0x2534e1+_0xb7cd('0x7e')](_0x12404d)[_0xb7cd('0x42')](function(_0x20df7a){var _0x5a17c7=_[_0xb7cd('0x2e')](_0x20df7a,function(_0xc1e372){return _0xc1e372[_0xb7cd('0x9b')](_0x1824d0,{'transaction':_0x2b7b4b})[_0xb7cd('0x42')](function(){var _0x4e1a99=_[_0xb7cd('0x2e')](_0x1824d0,function(_0x3a8584){socket['emit'](_0xb7cd('0x4b')+_0x2534e1+_0xb7cd('0x9d'),{'UserId':Number(_0x3a8584),[_0x2534e1+'QueueId']:_0xc1e372['id']});if(_0x2534e1!==_0xb7cd('0x82')){return;}return db[_0xb7cd('0x91')][_0xb7cd('0x60')]({'where':{'VoiceQueueId':_0xc1e372['id'],'UserId':_0x3a8584},'transaction':_0x2b7b4b});});return Promise['all'](_0x4e1a99);});});return Promise[_0xb7cd('0x97')](_0x5a17c7);});});return Promise[_0xb7cd('0x97')](_0x2114d3)[_0xb7cd('0x42')](function(){return _0x1dddc6[_0xb7cd('0x9b')](_0x1824d0,{'transaction':_0x2b7b4b});})[_0xb7cd('0x42')](function(){return db[_0xb7cd('0x98')]['findOne']({'where':{'teamId':_0x25cc85}})[_0xb7cd('0x42')](function(_0x369cfc){if(_0x369cfc){var _0x114a29=_[_0xb7cd('0x2e')](_0x1824d0,function(_0x2bd4be){db['UserVoicePrefix'][_0xb7cd('0x60')]({'where':{'UserId':_0x2bd4be,'VoicePrefixId':_0x369cfc[_0xb7cd('0x71')]}});});return Promise['all'](_0x114a29);}});});});}})[_0xb7cd('0x42')](respondWithStatusCode(_0x24c696,null))['catch'](handleError(_0x24c696,null));};exports[_0xb7cd('0x9e')]=function(_0x327b14,_0x5e6c24,_0x20a1db){var _0x522711={};var _0x5d55ee={};var _0x291a32;var _0x1f48f1;return db[_0xb7cd('0x2f')]['findOne']({'where':{'id':_0x327b14[_0xb7cd('0x48')]['id']}})[_0xb7cd('0x42')](handleEntityNotFound(_0x5e6c24,null))[_0xb7cd('0x42')](function(_0x41c040){if(_0x41c040){_0x291a32=_0x41c040;_0x5d55ee['model']=_[_0xb7cd('0x49')](db[_0xb7cd('0x8a')]['rawAttributes']);_0x5d55ee[_0xb7cd('0x34')]=_[_0xb7cd('0x49')](_0x327b14['query']);_0x5d55ee[_0xb7cd('0x3d')]=_[_0xb7cd('0x35')](_0x5d55ee[_0xb7cd('0x33')],_0x5d55ee[_0xb7cd('0x34')]);_0x522711[_0xb7cd('0x36')]=_[_0xb7cd('0x35')](_0x5d55ee[_0xb7cd('0x33')],qs[_0xb7cd('0x37')](_0x327b14[_0xb7cd('0x34')][_0xb7cd('0x37')]));_0x522711[_0xb7cd('0x36')]=_0x522711[_0xb7cd('0x36')]['length']?_0x522711[_0xb7cd('0x36')]:_0x5d55ee['model'];_0x522711[_0xb7cd('0x3a')]=qs[_0xb7cd('0x3b')](_0x327b14[_0xb7cd('0x34')][_0xb7cd('0x3b')]);_0x522711['where']=qs['filters'](_[_0xb7cd('0x7b')](_0x327b14[_0xb7cd('0x34')],_0x5d55ee[_0xb7cd('0x3d')]));if(_0x327b14[_0xb7cd('0x34')]['filter']){_0x522711[_0xb7cd('0x3c')]=_[_0xb7cd('0x3f')](_0x522711[_0xb7cd('0x3c')],{'$or':_['map'](_0x522711[_0xb7cd('0x36')],function(_0x415938){var _0x4ba279={};_0x4ba279[_0x415938]={'$like':'%'+_0x327b14[_0xb7cd('0x34')][_0xb7cd('0x3e')]+'%'};return _0x4ba279;})});}_0x522711=_[_0xb7cd('0x3f')]({},_0x522711,_0x327b14[_0xb7cd('0x41')]);return _0x291a32['getAgents'](_0x522711);}})[_0xb7cd('0x42')](function(_0x2dedde){if(_0x2dedde){_0x1f48f1=_0x2dedde[_0xb7cd('0x7a')];if(!_0x327b14[_0xb7cd('0x34')][_0xb7cd('0x38')](_0xb7cd('0x9f'))){_0x522711[_0xb7cd('0x39')]=qs[_0xb7cd('0x39')](_0x327b14[_0xb7cd('0x34')]['limit']);_0x522711[_0xb7cd('0x23')]=qs[_0xb7cd('0x23')](_0x327b14['query'][_0xb7cd('0x23')]);}return _0x291a32[_0xb7cd('0x9e')](_0x522711);}})[_0xb7cd('0x42')](function(_0x2a7ac2){if(_0x2a7ac2){return _0x2a7ac2?{'count':_0x1f48f1,'rows':_0x2a7ac2}:null;}})[_0xb7cd('0x42')](respondWithResult(_0x5e6c24,null))['catch'](handleError(_0x5e6c24,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e5e0a12..5c2e571 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 _0x9633=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','Team'];(function(_0xd5edf7,_0x43c249){var _0x5cb898=function(_0x7c6bb4){while(--_0x7c6bb4){_0xd5edf7['push'](_0xd5edf7['shift']());}};_0x5cb898(++_0x43c249);}(_0x9633,0xc5));var _0x3963=function(_0x1eec3c,_0x27eb00){_0x1eec3c=_0x1eec3c-0x0;var _0x39c1d4=_0x9633[_0x1eec3c];return _0x39c1d4;};'use strict';var EventEmitter=require(_0x3963('0x0'));var Team=require(_0x3963('0x1'))['db'][_0x3963('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3963('0x3')](0x0);var events={'afterCreate':_0x3963('0x4'),'afterUpdate':_0x3963('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39fe25){return function(_0x38550a,_0x148ddf,_0x42ba5e){TeamEvents['emit'](_0x39fe25+':'+_0x38550a['id'],_0x38550a);TeamEvents[_0x3963('0x6')](_0x39fe25,_0x38550a);_0x42ba5e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3963('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x27b0=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x53be8d,_0x2cb53f){var _0x396d2c=function(_0x389878){while(--_0x389878){_0x53be8d['push'](_0x53be8d['shift']());}};_0x396d2c(++_0x2cb53f);}(_0x27b0,0x10b));var _0x027b=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x27b0[_0x496333];return _0x44256e;};'use strict';var EventEmitter=require(_0x027b('0x0'));var Team=require(_0x027b('0x1'))['db'][_0x027b('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x027b('0x3'),'afterUpdate':_0x027b('0x4'),'afterDestroy':_0x027b('0x5')};function emitEvent(_0x414467){return function(_0x3e5bd0,_0x1ae26e,_0x2012f4){TeamEvents[_0x027b('0x6')](_0x414467+':'+_0x3e5bd0['id'],_0x3e5bd0);TeamEvents[_0x027b('0x6')](_0x414467,_0x3e5bd0);_0x2012f4(null);};}for(var e in events){if(events[_0x027b('0x7')](e)){var event=events[e];Team[_0x027b('0x8')](e,emitEvent(event));}}module[_0x027b('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 b33013b..1f6e1af 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 _0x3afd=['define','teams','Fax','Mail','Sms','Voice','Whatsapp','resolve','map','all','catch','./team.attributes','get','Queues','then','channel'];(function(_0x50d0ca,_0x20df20){var _0x41ee03=function(_0x569667){while(--_0x569667){_0x50d0ca['push'](_0x50d0ca['shift']());}};_0x41ee03(++_0x20df20);}(_0x3afd,0x19b));var _0xd3af=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x3afd[_0x45b034];return _0x509cb0;};'use strict';var _=require('lodash');var attributes=require(_0xd3af('0x0'));function getQueuesByChannel(_0x3f7022,_0xa3ff06){var _0x5a709d=_0xd3af('0x1')+_0xa3ff06+_0xd3af('0x2');return _0x3f7022[_0x5a709d]()[_0xd3af('0x3')](function(_0x2b3dd4){return _['map'](_0x2b3dd4,function(_0x32da38){_0x32da38['setDataValue'](_0xd3af('0x4'),_0xa3ff06);return _0x32da38;});})['catch'](function(_0x210876){throw _0x210876;});}module['exports']=function(_0x3956b7){return _0x3956b7[_0xd3af('0x5')]('Team',attributes,{'tableName':_0xd3af('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x241206=this;var _0x41e3ae=['Chat',_0xd3af('0x7'),_0xd3af('0x8'),'Openchannel',_0xd3af('0x9'),_0xd3af('0xa'),_0xd3af('0xb')];return Promise[_0xd3af('0xc')]()[_0xd3af('0x3')](function(){var _0x433047=_[_0xd3af('0xd')](_0x41e3ae,function(_0x3d9437){return getQueuesByChannel(_0x241206,_0x3d9437);});return Promise[_0xd3af('0xe')](_0x433047);})[_0xd3af('0xf')](function(_0x102006){throw _0x102006;});}}});}; \ No newline at end of file +var _0x0c5d=['then','lodash','./team.attributes','get','Queues','map','setDataValue','catch','exports','define','Team','Chat','Fax','Openchannel','Voice','Whatsapp','resolve'];(function(_0x3e8cb5,_0x3b1631){var _0x23b492=function(_0x3db0e5){while(--_0x3db0e5){_0x3e8cb5['push'](_0x3e8cb5['shift']());}};_0x23b492(++_0x3b1631);}(_0x0c5d,0xbc));var _0xd0c5=function(_0x32b322,_0x273b21){_0x32b322=_0x32b322-0x0;var _0x83b3c7=_0x0c5d[_0x32b322];return _0x83b3c7;};'use strict';var _=require(_0xd0c5('0x0'));var attributes=require(_0xd0c5('0x1'));function getQueuesByChannel(_0x4bbde7,_0x268fde){var _0x18c89f=_0xd0c5('0x2')+_0x268fde+_0xd0c5('0x3');return _0x4bbde7[_0x18c89f]()['then'](function(_0x43b992){return _[_0xd0c5('0x4')](_0x43b992,function(_0x18e1fc){_0x18e1fc[_0xd0c5('0x5')]('channel',_0x268fde);return _0x18e1fc;});})[_0xd0c5('0x6')](function(_0x35a75e){throw _0x35a75e;});}module[_0xd0c5('0x7')]=function(_0x51305e){return _0x51305e[_0xd0c5('0x8')](_0xd0c5('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x58bf2b=this;var _0x5dd95a=[_0xd0c5('0xa'),_0xd0c5('0xb'),'Mail',_0xd0c5('0xc'),'Sms',_0xd0c5('0xd'),_0xd0c5('0xe')];return Promise[_0xd0c5('0xf')]()[_0xd0c5('0x10')](function(){var _0x3b126c=_[_0xd0c5('0x4')](_0x5dd95a,function(_0x36b982){return getQueuesByChannel(_0x58bf2b,_0x36b982);});return Promise['all'](_0x3b126c);})['catch'](function(_0x21e49c){throw _0x21e49c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6b57b47..86ab51c 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 _0xd585=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message'];(function(_0x55ec6c,_0x5b22aa){var _0x312e90=function(_0x1a0cfc){while(--_0x1a0cfc){_0x55ec6c['push'](_0x55ec6c['shift']());}};_0x312e90(++_0x5b22aa);}(_0xd585,0x17b));var _0x5d58=function(_0x53147a,_0x4516e3){_0x53147a=_0x53147a-0x0;var _0x13a9cd=_0xd585[_0x53147a];return _0x13a9cd;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var moment=require(_0x5d58('0x2'));var BPromise=require(_0x5d58('0x3'));var rs=require(_0x5d58('0x4'));var fs=require('fs');var Redis=require(_0x5d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d58('0x6'));var logger=require(_0x5d58('0x7'))('rpc');var config=require(_0x5d58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d58('0x9')][_0x5d58('0xa')]({'port':0x232a});config[_0x5d58('0xb')]=_[_0x5d58('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d58('0xd'))(new Redis(config[_0x5d58('0xb')]));require(_0x5d58('0xe'))[_0x5d58('0xf')](socket);function respondWithRpcPromise(_0x4dfc59,_0x479791,_0x39ac6a){return new BPromise(function(_0xbdffbc,_0x15e7a0){return client[_0x5d58('0x10')](_0x4dfc59,_0x39ac6a)[_0x5d58('0x11')](function(_0x854580){logger[_0x5d58('0x12')]('Team,\x20%s,\x20%s',_0x479791,_0x5d58('0x13'));logger[_0x5d58('0x14')](_0x5d58('0x15'),_0x479791,_0x5d58('0x13'),JSON['stringify'](_0x854580));if(_0x854580[_0x5d58('0x16')]){if(_0x854580[_0x5d58('0x16')][_0x5d58('0x17')]===0x1f4){logger[_0x5d58('0x16')](_0x5d58('0x18'),_0x479791,_0x854580['error'][_0x5d58('0x19')]);return _0x15e7a0(_0x854580[_0x5d58('0x16')][_0x5d58('0x19')]);}logger[_0x5d58('0x16')]('Team,\x20%s,\x20%s',_0x479791,_0x854580[_0x5d58('0x16')]['message']);return _0xbdffbc(_0x854580['error']['message']);}else{logger[_0x5d58('0x12')](_0x5d58('0x18'),_0x479791,_0x5d58('0x13'));_0xbdffbc(_0x854580['result'][_0x5d58('0x19')]);}})[_0x5d58('0x1a')](function(_0x20a48f){logger[_0x5d58('0x16')]('Team,\x20%s,\x20%s',_0x479791,_0x20a48f);_0x15e7a0(_0x20a48f);});});} \ No newline at end of file +var _0x1520=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./team.socket','register','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x1520,0x1ad));var _0x0152=function(_0x411bfe,_0x218c5b){_0x411bfe=_0x411bfe-0x0;var _0x441126=_0x1520[_0x411bfe];return _0x441126;};'use strict';var _=require('lodash');var util=require(_0x0152('0x0'));var moment=require(_0x0152('0x1'));var BPromise=require(_0x0152('0x2'));var rs=require(_0x0152('0x3'));var fs=require('fs');var Redis=require(_0x0152('0x4'));var db=require(_0x0152('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0152('0x6'))(_0x0152('0x7'));var config=require(_0x0152('0x8'));var jayson=require(_0x0152('0x9'));var client=jayson['client'][_0x0152('0xa')]({'port':0x232a});config[_0x0152('0xb')]=_[_0x0152('0xc')](config[_0x0152('0xb')],{'host':_0x0152('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0152('0xe'))[_0x0152('0xf')](socket);function respondWithRpcPromise(_0x547dd5,_0x452a47,_0x4231c2){return new BPromise(function(_0x52fcd4,_0xfe909a){return client['request'](_0x547dd5,_0x4231c2)['then'](function(_0x3ed325){logger[_0x0152('0x10')]('Team,\x20%s,\x20%s',_0x452a47,_0x0152('0x11'));logger[_0x0152('0x12')](_0x0152('0x13'),_0x452a47,_0x0152('0x11'),JSON[_0x0152('0x14')](_0x3ed325));if(_0x3ed325[_0x0152('0x15')]){if(_0x3ed325['error'][_0x0152('0x16')]===0x1f4){logger['error'](_0x0152('0x17'),_0x452a47,_0x3ed325[_0x0152('0x15')]['message']);return _0xfe909a(_0x3ed325['error']['message']);}logger[_0x0152('0x15')]('Team,\x20%s,\x20%s',_0x452a47,_0x3ed325['error']['message']);return _0x52fcd4(_0x3ed325[_0x0152('0x15')][_0x0152('0x18')]);}else{logger[_0x0152('0x10')](_0x0152('0x17'),_0x452a47,_0x0152('0x11'));_0x52fcd4(_0x3ed325[_0x0152('0x19')][_0x0152('0x18')]);}})[_0x0152('0x1a')](function(_0x544b6e){logger[_0x0152('0x15')](_0x0152('0x17'),_0x452a47,_0x544b6e);_0xfe909a(_0x544b6e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e097457..2204605 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 _0x063e=['length','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x063e,0x111));var _0xe063=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x063e[_0x1d1779];return _0x2377e9;};'use strict';var TeamEvents=require(_0xe063('0x0'));var events=[_0xe063('0x1'),_0xe063('0x2'),_0xe063('0x3')];function createListener(_0x2dc38f,_0x29be6d){return function(_0x31ff69){_0x29be6d[_0xe063('0x4')](_0x2dc38f,_0x31ff69);};}function removeListener(_0x3b58ec,_0x35a88b){return function(){TeamEvents[_0xe063('0x5')](_0x3b58ec,_0x35a88b);};}exports[_0xe063('0x6')]=function(_0x4cc570){for(var _0x5e99c3=0x0,_0x561d7b=events[_0xe063('0x7')];_0x5e99c3<_0x561d7b;_0x5e99c3++){var _0x661f34=events[_0x5e99c3];var _0x1c48ea=createListener('team:'+_0x661f34,_0x4cc570);TeamEvents['on'](_0x661f34,_0x1c48ea);}}; \ No newline at end of file +var _0x6462=['removeListener','register','length','./team.events','save','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6462,0x65));var _0x2646=function(_0x2b58c9,_0x41b0df){_0x2b58c9=_0x2b58c9-0x0;var _0x30206e=_0x6462[_0x2b58c9];return _0x30206e;};'use strict';var TeamEvents=require(_0x2646('0x0'));var events=[_0x2646('0x1'),_0x2646('0x2'),'update'];function createListener(_0x5f198b,_0x1fda6f){return function(_0x15f379){_0x1fda6f[_0x2646('0x3')](_0x5f198b,_0x15f379);};}function removeListener(_0x149875,_0x1ca4e0){return function(){TeamEvents[_0x2646('0x4')](_0x149875,_0x1ca4e0);};}exports[_0x2646('0x5')]=function(_0x4acb6b){for(var _0x23457d=0x0,_0x481005=events[_0x2646('0x6')];_0x23457d<_0x481005;_0x23457d++){var _0x2779bd=events[_0x23457d];var _0x156b83=createListener('team:'+_0x2779bd,_0x4acb6b);TeamEvents['on'](_0x2779bd,_0x156b83);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 634e9d1..2b53dcb 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 _0x3e8e=['exports','INTEGER'];(function(_0xae8a9e,_0x22e774){var _0x3e4e9b=function(_0xa4fdef){while(--_0xa4fdef){_0xae8a9e['push'](_0xae8a9e['shift']());}};_0x3e4e9b(++_0x22e774);}(_0x3e8e,0x106));var _0xe3e8=function(_0x2fc18a,_0xf934a7){_0x2fc18a=_0x2fc18a-0x0;var _0x22343c=_0x3e8e[_0x2fc18a];return _0x22343c;};'use strict';var Sequelize=require('sequelize');module[_0xe3e8('0x0')]={'TeamId':{'type':Sequelize[_0xe3e8('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xe3e8('0x1')]}}; \ No newline at end of file +var _0xcaa4=['INTEGER','sequelize','exports'];(function(_0x35fa19,_0x46a52d){var _0x1d1413=function(_0x17a725){while(--_0x17a725){_0x35fa19['push'](_0x35fa19['shift']());}};_0x1d1413(++_0x46a52d);}(_0xcaa4,0x1b7));var _0x4caa=function(_0x30cdaa,_0x1c7c06){_0x30cdaa=_0x30cdaa-0x0;var _0x378359=_0xcaa4[_0x30cdaa];return _0x378359;};'use strict';var Sequelize=require(_0x4caa('0x0'));module[_0x4caa('0x1')]={'TeamId':{'type':Sequelize[_0x4caa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4caa('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8cda781..e34863d 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 _0x69d3=['../../config/logger','moment','bluebird','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x69d3,0xda));var _0x369d=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0x69d3[_0x48b724];return _0x4d38b3;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0efe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x58539f,_0x5c9937){var _0x5151fa=function(_0x1be30c){while(--_0x1be30c){_0x58539f['push'](_0x58539f['shift']());}};_0x5151fa(++_0x5c9937);}(_0x0efe,0x110));var _0xe0ef=function(_0x4a57f1,_0x19c61e){_0x4a57f1=_0x4a57f1-0x0;var _0x17b1f1=_0x0efe[_0x4a57f1];return _0x17b1f1;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var logger=require('../../config/logger')(_0xe0ef('0x2'));var moment=require(_0xe0ef('0x3'));var BPromise=require(_0xe0ef('0x4'));var rp=require(_0xe0ef('0x5'));var fs=require('fs');var path=require(_0xe0ef('0x6'));var rimraf=require(_0xe0ef('0x7'));var config=require(_0xe0ef('0x8'));var attributes=require(_0xe0ef('0x9'));module[_0xe0ef('0xa')]=function(_0x35a50e,_0x5e9176){return _0x35a50e['define'](_0xe0ef('0xb'),attributes,{'tableName':_0xe0ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index daeba77..30818f1 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2c654f,_0x11ce94){var _0xa53d15=function(_0x4db4a9){while(--_0x4db4a9){_0x2c654f['push'](_0x2c654f['shift']());}};_0xa53d15(++_0x11ce94);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x258dd8,_0x457d23){var _0x3f56b5=function(_0x2d3cc0){while(--_0x2d3cc0){_0x258dd8['push'](_0x258dd8['shift']());}};_0x3f56b5(++_0x457d23);}(_0x70e0,0x17b));var _0x070e=function(_0x74086c,_0x4326a2){_0x74086c=_0x74086c-0x0;var _0x31c694=_0x70e0[_0x74086c];return _0x31c694;};'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 ed255ce..2fdef9b 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 _0xa0cf=['exports','INTEGER','sequelize'];(function(_0x11b2bd,_0x3c32ae){var _0x102c71=function(_0x5ebe11){while(--_0x5ebe11){_0x11b2bd['push'](_0x11b2bd['shift']());}};_0x102c71(++_0x3c32ae);}(_0xa0cf,0x164));var _0xfa0c=function(_0x367ac0,_0x5ddbf7){_0x367ac0=_0x367ac0-0x0;var _0x5c6ea7=_0xa0cf[_0x367ac0];return _0x5c6ea7;};'use strict';var Sequelize=require(_0xfa0c('0x0'));module[_0xfa0c('0x1')]={'penalty':{'type':Sequelize[_0xfa0c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x88f8=['sequelize','INTEGER'];(function(_0x169d18,_0x4bb3dd){var _0x37fe3c=function(_0x12bdf1){while(--_0x12bdf1){_0x169d18['push'](_0x169d18['shift']());}};_0x37fe3c(++_0x4bb3dd);}(_0x88f8,0x13c));var _0x888f=function(_0x4b387e,_0x199468){_0x4b387e=_0x4b387e-0x0;var _0x5a2703=_0x88f8[_0x4b387e];return _0x5a2703;};'use strict';var Sequelize=require(_0x888f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x888f('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 db32eb9..d5bca13 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 _0x192f=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x5a9345,_0x5eb4b6){var _0x5d8b74=function(_0x226765){while(--_0x226765){_0x5a9345['push'](_0x5a9345['shift']());}};_0x5d8b74(++_0x5eb4b6);}(_0x192f,0xd6));var _0xf192=function(_0x4bbaf5,_0x5979ab){_0x4bbaf5=_0x4bbaf5-0x0;var _0x163996=_0x192f[_0x4bbaf5];return _0x163996;};'use strict';var _=require(_0xf192('0x0'));var util=require('util');var logger=require(_0xf192('0x1'))('api');var moment=require(_0xf192('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x3'));var rimraf=require(_0xf192('0x4'));var config=require(_0xf192('0x5'));var attributes=require(_0xf192('0x6'));module[_0xf192('0x7')]=function(_0x221f55,_0x5a05b0){return _0x221f55[_0xf192('0x8')](_0xf192('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae0=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x380064,_0x560a08){var _0x53197c=function(_0x51e1de){while(--_0x51e1de){_0x380064['push'](_0x380064['shift']());}};_0x53197c(++_0x560a08);}(_0x6ae0,0x192));var _0x06ae=function(_0x378247,_0x34481b){_0x378247=_0x378247-0x0;var _0x391bd3=_0x6ae0[_0x378247];return _0x391bd3;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))(_0x06ae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x06ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06ae('0x5'));var config=require('../../config/environment');var attributes=require(_0x06ae('0x6'));module[_0x06ae('0x7')]=function(_0x517dea,_0x17b806){return _0x517dea['define'](_0x06ae('0x8'),attributes,{'tableName':_0x06ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 260e555..62dc0a7 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 _0xbef6=['rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbef6,0x1b0));var _0x6bef=function(_0x42071f,_0x2655e5){_0x42071f=_0x42071f-0x0;var _0x4f7061=_0xbef6[_0x42071f];return _0x4f7061;};'use strict';var _=require(_0x6bef('0x0'));var util=require(_0x6bef('0x1'));var moment=require('moment');var BPromise=require(_0x6bef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bef('0x4'))(_0x6bef('0x5'));var config=require('../../config/environment');var jayson=require(_0x6bef('0x6'));var client=jayson[_0x6bef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a59d,_0x7e58a9,_0x590b4c){return new BPromise(function(_0x4d47d0,_0x30639d){return client[_0x6bef('0x8')](_0x11a59d,_0x590b4c)[_0x6bef('0x9')](function(_0x19d992){logger[_0x6bef('0xa')](_0x6bef('0xb'),_0x7e58a9,_0x6bef('0xc'));logger[_0x6bef('0xd')](_0x6bef('0xe'),_0x7e58a9,_0x6bef('0xc'),JSON[_0x6bef('0xf')](_0x19d992));if(_0x19d992[_0x6bef('0x10')]){if(_0x19d992[_0x6bef('0x10')]['code']===0x1f4){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x30639d(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x4d47d0(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}else{logger[_0x6bef('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x7e58a9,_0x6bef('0xc'));_0x4d47d0(_0x19d992['result'][_0x6bef('0x11')]);}})[_0x6bef('0x12')](function(_0x35bd32){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x35bd32);_0x30639d(_0x35bd32);});});} \ No newline at end of file +var _0x23bb=['error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25126f,_0x475caa){var _0x2f60f7=function(_0x34776b){while(--_0x34776b){_0x25126f['push'](_0x25126f['shift']());}};_0x2f60f7(++_0x475caa);}(_0x23bb,0xc1));var _0xb23b=function(_0x1c7a2e,_0xeb606e){_0x1c7a2e=_0x1c7a2e-0x0;var _0x3258d1=_0x23bb[_0x1c7a2e];return _0x3258d1;};'use strict';var _=require(_0xb23b('0x0'));var util=require(_0xb23b('0x1'));var moment=require(_0xb23b('0x2'));var BPromise=require(_0xb23b('0x3'));var rs=require(_0xb23b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb23b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb23b('0x6'))(_0xb23b('0x7'));var config=require(_0xb23b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb23b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14d2ce,_0x70fa28,_0x30ef61){return new BPromise(function(_0x201577,_0x5a602a){return client['request'](_0x14d2ce,_0x30ef61)['then'](function(_0x3e0e1a){logger[_0xb23b('0xa')](_0xb23b('0xb'),_0x70fa28,_0xb23b('0xc'));logger[_0xb23b('0xd')](_0xb23b('0xe'),_0x70fa28,'request\x20sent',JSON[_0xb23b('0xf')](_0x3e0e1a));if(_0x3e0e1a[_0xb23b('0x10')]){if(_0x3e0e1a[_0xb23b('0x10')]['code']===0x1f4){logger[_0xb23b('0x10')](_0xb23b('0xb'),_0x70fa28,_0x3e0e1a[_0xb23b('0x10')][_0xb23b('0x11')]);return _0x5a602a(_0x3e0e1a[_0xb23b('0x10')][_0xb23b('0x11')]);}logger[_0xb23b('0x10')](_0xb23b('0xb'),_0x70fa28,_0x3e0e1a['error']['message']);return _0x201577(_0x3e0e1a['error'][_0xb23b('0x11')]);}else{logger[_0xb23b('0xa')](_0xb23b('0xb'),_0x70fa28,_0xb23b('0xc'));_0x201577(_0x3e0e1a['result'][_0xb23b('0x11')]);}})[_0xb23b('0x12')](function(_0x1a900a){logger[_0xb23b('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x70fa28,_0x1a900a);_0x5a602a(_0x1a900a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 550a3bd..a87d90b 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 _0xab00=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4abf46,_0x2335c8){var _0x71c905=function(_0x271e04){while(--_0x271e04){_0x4abf46['push'](_0x4abf46['shift']());}};_0x71c905(++_0x2335c8);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3499dc,_0x118dc7){_0x3499dc=_0x3499dc-0x0;var _0xac6975=_0xab00[_0x3499dc];return _0xac6975;};'use strict';var multer=require(_0x0ab0('0x0'));var util=require(_0x0ab0('0x1'));var path=require(_0x0ab0('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ab0('0x3'));var router=express[_0x0ab0('0x4')]();var fs_extra=require(_0x0ab0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab0('0x6'));var config=require('../../config/environment');var controller=require(_0x0ab0('0x7'));router[_0x0ab0('0x8')]('/',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xa')]);router[_0x0ab0('0x8')](_0x0ab0('0xb'),auth['isAuthenticated'](),controller[_0x0ab0('0xc')]);router[_0x0ab0('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ab0('0xe')]);router['put'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab0('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa880=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x1ba8c9,_0x785346){var _0x1de025=function(_0x44ffad){while(--_0x44ffad){_0x1ba8c9['push'](_0x1ba8c9['shift']());}};_0x1de025(++_0x785346);}(_0xa880,0x106));var _0x0a88=function(_0xf2d1bf,_0x19c53a){_0xf2d1bf=_0xf2d1bf-0x0;var _0x388d2c=_0xa880[_0xf2d1bf];return _0x388d2c;};'use strict';var multer=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var timeout=require(_0x0a88('0x3'));var express=require(_0x0a88('0x4'));var router=express[_0x0a88('0x5')]();var fs_extra=require(_0x0a88('0x6'));var auth=require(_0x0a88('0x7'));var interaction=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var controller=require(_0x0a88('0xa'));router['get']('/',auth[_0x0a88('0xb')](),controller[_0x0a88('0xc')]);router[_0x0a88('0xd')](_0x0a88('0xe'),auth['isAuthenticated'](),controller[_0x0a88('0xf')]);router[_0x0a88('0x10')]('/',auth[_0x0a88('0xb')](),controller['create']);router['put']('/:id',auth[_0x0a88('0xb')](),controller[_0x0a88('0x11')]);router[_0x0a88('0x12')](_0x0a88('0xe'),auth[_0x0a88('0xb')](),controller[_0x0a88('0x13')]);module[_0x0a88('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ac0344c..8c7aefe 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 _0xab78=['STRING','TEXT','sequelize','exports'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0xab78,0x16e));var _0x8ab7=function(_0x5c0c8a,_0x366ae8){_0x5c0c8a=_0x5c0c8a-0x0;var _0x611af3=_0xab78[_0x5c0c8a];return _0x611af3;};'use strict';var Sequelize=require(_0x8ab7('0x0'));module[_0x8ab7('0x1')]={'name':{'type':Sequelize[_0x8ab7('0x2')]},'description':{'type':Sequelize[_0x8ab7('0x2')]},'html':{'type':Sequelize[_0x8ab7('0x3')]}}; \ No newline at end of file +var _0x9558=['STRING','exports'];(function(_0x447725,_0x49753b){var _0x399167=function(_0x1e47d9){while(--_0x1e47d9){_0x447725['push'](_0x447725['shift']());}};_0x399167(++_0x49753b);}(_0x9558,0x1d9));var _0x8955=function(_0x5c89ff,_0x32fef6){_0x5c89ff=_0x5c89ff-0x0;var _0x5ec941=_0x9558[_0x5c89ff];return _0x5ec941;};'use strict';var Sequelize=require('sequelize');module[_0x8955('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8955('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 68fcd80..8a1956a 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 _0x7be5=['stack','name','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Templates','destroy','error'];(function(_0x164547,_0x2b19d4){var _0x32b31f=function(_0x39054c){while(--_0x39054c){_0x164547['push'](_0x164547['shift']());}};_0x32b31f(++_0x2b19d4);}(_0x7be5,0xd8));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57be('0x0'));var zipdir=require(_0x57be('0x1'));var jsonpatch=require(_0x57be('0x2'));var rp=require(_0x57be('0x3'));var moment=require(_0x57be('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x57be('0x5'));var path=require(_0x57be('0x6'));var sox=require(_0x57be('0x7'));var csv=require(_0x57be('0x8'));var ejs=require(_0x57be('0x9'));var fs=require('fs');var fs_extra=require(_0x57be('0xa'));var _=require(_0x57be('0xb'));var squel=require(_0x57be('0xc'));var crypto=require(_0x57be('0xd'));var jsforce=require(_0x57be('0xe'));var deskjs=require(_0x57be('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57be('0x10'));var Redis=require(_0x57be('0x11'));var authService=require(_0x57be('0x12'));var qs=require(_0x57be('0x13'));var as=require(_0x57be('0x14'));var hardwareService=require(_0x57be('0x15'));var logger=require(_0x57be('0x16'))(_0x57be('0x17'));var utils=require(_0x57be('0x18'));var config=require(_0x57be('0x19'));var licenseUtil=require(_0x57be('0x1a'));var db=require(_0x57be('0x1b'))['db'];function respondWithStatusCode(_0x24d0f0,_0x44a9ac){_0x44a9ac=_0x44a9ac||0xcc;return function(_0x74460){if(_0x74460){return _0x24d0f0[_0x57be('0x1c')](_0x44a9ac);}return _0x24d0f0['status'](_0x44a9ac)[_0x57be('0x1d')]();};}function respondWithResult(_0x2f3450,_0x49a36c){_0x49a36c=_0x49a36c||0xc8;return function(_0x226fcb){if(_0x226fcb){return _0x2f3450[_0x57be('0x1e')](_0x49a36c)['json'](_0x226fcb);}};}function respondWithFilteredResult(_0xce8865,_0x297bc6){return function(_0x31b6d7){if(_0x31b6d7){var _0x55df33=typeof _0x297bc6[_0x57be('0x1f')]===_0x57be('0x20')&&typeof _0x297bc6[_0x57be('0x21')]===_0x57be('0x20');var _0x5308e1=_0x31b6d7[_0x57be('0x22')];var _0x558d80=_0x55df33?0x0:_0x297bc6['offset'];var _0x4422ff=_0x55df33?_0x31b6d7[_0x57be('0x22')]:_0x297bc6[_0x57be('0x1f')]+_0x297bc6[_0x57be('0x21')];var _0x40104e;if(_0x4422ff>=_0x5308e1){_0x4422ff=_0x5308e1;_0x40104e=0xc8;}else{_0x40104e=0xce;}_0xce8865[_0x57be('0x1e')](_0x40104e);return _0xce8865[_0x57be('0x23')](_0x57be('0x24'),_0x558d80+'-'+_0x4422ff+'/'+_0x5308e1)['json'](_0x31b6d7);}return null;};}function patchUpdates(_0x1d4e6d){return function(_0x199749){try{jsonpatch[_0x57be('0x25')](_0x199749,_0x1d4e6d,!![]);}catch(_0x57a2fb){return BPromise['reject'](_0x57a2fb);}return _0x199749[_0x57be('0x26')]();};}function saveUpdates(_0x49160c,_0x34215a){return function(_0x4e2ea8){if(_0x4e2ea8){return _0x4e2ea8[_0x57be('0x27')](_0x49160c)[_0x57be('0x28')](function(_0x12b1cf){return _0x12b1cf;});}return null;};}function removeEntity(_0x39260d,_0x1df461){return function(_0x597258){if(_0x597258){return _0x597258['destroy']()[_0x57be('0x28')](function(){var _0x515568=_0x597258[_0x57be('0x29')]({'plain':!![]});var _0x59d06a=_0x57be('0x2a');return db['UserProfileResource'][_0x57be('0x2b')]({'where':{'type':_0x59d06a,'resourceId':_0x515568['id']}})['then'](function(){return _0x597258;});})[_0x57be('0x28')](function(){_0x39260d[_0x57be('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de139,_0x3db199){return function(_0x341b0e){if(!_0x341b0e){_0x3de139['sendStatus'](0x194);}return _0x341b0e;};}function handleError(_0x163a26,_0xfa344c){_0xfa344c=_0xfa344c||0x1f4;return function(_0x501d95){logger[_0x57be('0x2c')](_0x501d95[_0x57be('0x2d')]);if(_0x501d95[_0x57be('0x2e')]){delete _0x501d95[_0x57be('0x2e')];}_0x163a26[_0x57be('0x1e')](_0xfa344c)['send'](_0x501d95);};}exports[_0x57be('0x2f')]=function(_0xa225c4,_0x1924b3){var _0x1e00a4={},_0x54778e={},_0x548de0={'count':0x0,'rows':[]};var _0x2573da=_[_0x57be('0x30')](db[_0x57be('0x31')][_0x57be('0x32')],function(_0x3451ca){return{'name':_0x3451ca['fieldName'],'type':_0x3451ca[_0x57be('0x33')][_0x57be('0x34')]};});_0x54778e[_0x57be('0x35')]=_['map'](_0x2573da,_0x57be('0x2e'));_0x54778e[_0x57be('0x36')]=_[_0x57be('0x37')](_0xa225c4[_0x57be('0x36')]);_0x54778e[_0x57be('0x38')]=_[_0x57be('0x39')](_0x54778e['model'],_0x54778e[_0x57be('0x36')]);_0x1e00a4[_0x57be('0x3a')]=_[_0x57be('0x39')](_0x54778e[_0x57be('0x35')],qs[_0x57be('0x3b')](_0xa225c4['query']['fields']));_0x1e00a4[_0x57be('0x3a')]=_0x1e00a4[_0x57be('0x3a')]['length']?_0x1e00a4[_0x57be('0x3a')]:_0x54778e[_0x57be('0x35')];if(!_0xa225c4['query'][_0x57be('0x3c')](_0x57be('0x3d'))){_0x1e00a4[_0x57be('0x21')]=qs['limit'](_0xa225c4[_0x57be('0x36')][_0x57be('0x21')]);_0x1e00a4[_0x57be('0x1f')]=qs['offset'](_0xa225c4[_0x57be('0x36')][_0x57be('0x1f')]);}_0x1e00a4[_0x57be('0x3e')]=qs[_0x57be('0x3f')](_0xa225c4[_0x57be('0x36')][_0x57be('0x3f')]);_0x1e00a4['where']=qs['filters'](_[_0x57be('0x40')](_0xa225c4[_0x57be('0x36')],_0x54778e[_0x57be('0x38')]),_0x2573da);if(_0xa225c4[_0x57be('0x36')][_0x57be('0x41')]){_0x1e00a4[_0x57be('0x42')]=_[_0x57be('0x43')](_0x1e00a4['where'],{'$or':_[_0x57be('0x30')](_0x2573da,function(_0x3c522e){if(_0x3c522e[_0x57be('0x33')]!==_0x57be('0x44')){var _0x3a792a={};_0x3a792a[_0x3c522e['name']]={'$like':'%'+_0xa225c4[_0x57be('0x36')]['filter']+'%'};return _0x3a792a;}})});}_0x1e00a4=_[_0x57be('0x43')]({},_0x1e00a4,_0xa225c4[_0x57be('0x45')]);var _0xf285={'where':_0x1e00a4['where']};return db['Template']['count'](_0xf285)[_0x57be('0x28')](function(_0x3198a0){_0x548de0['count']=_0x3198a0;if(_0xa225c4['query']['includeAll']){_0x1e00a4[_0x57be('0x46')]=[{'all':!![]}];}return db['Template']['findAll'](_0x1e00a4);})[_0x57be('0x28')](function(_0x2a74fb){_0x548de0[_0x57be('0x47')]=_0x2a74fb;return _0x548de0;})['then'](respondWithFilteredResult(_0x1924b3,_0x1e00a4))[_0x57be('0x48')](handleError(_0x1924b3,null));};exports[_0x57be('0x49')]=function(_0x253c84,_0x36e47c){var _0x1bbd34={'raw':!![],'where':{'id':_0x253c84[_0x57be('0x4a')]['id']}},_0x4b7fc8={};_0x4b7fc8[_0x57be('0x35')]=_['keys'](db[_0x57be('0x31')]['rawAttributes']);_0x4b7fc8['query']=_[_0x57be('0x37')](_0x253c84[_0x57be('0x36')]);_0x4b7fc8[_0x57be('0x38')]=_['intersection'](_0x4b7fc8[_0x57be('0x35')],_0x4b7fc8['query']);_0x1bbd34['attributes']=_[_0x57be('0x39')](_0x4b7fc8[_0x57be('0x35')],qs[_0x57be('0x3b')](_0x253c84['query'][_0x57be('0x3b')]));_0x1bbd34['attributes']=_0x1bbd34[_0x57be('0x3a')][_0x57be('0x4b')]?_0x1bbd34[_0x57be('0x3a')]:_0x4b7fc8[_0x57be('0x35')];if(_0x253c84[_0x57be('0x36')][_0x57be('0x4c')]){_0x1bbd34[_0x57be('0x46')]=[{'all':!![]}];}_0x1bbd34=_[_0x57be('0x43')]({},_0x1bbd34,_0x253c84[_0x57be('0x45')]);return db[_0x57be('0x31')][_0x57be('0x4d')](_0x1bbd34)['then'](handleEntityNotFound(_0x36e47c,null))[_0x57be('0x28')](respondWithResult(_0x36e47c,null))['catch'](handleError(_0x36e47c,null));};exports[_0x57be('0x4e')]=function(_0x32e012,_0x574dae){return db['Template'][_0x57be('0x4e')](_0x32e012[_0x57be('0x4f')],{})['then'](function(_0x47b508){var _0x4774da=_0x32e012[_0x57be('0x50')][_0x57be('0x29')]({'plain':!![]});if(!_0x4774da)throw new Error(_0x57be('0x51'));if(_0x4774da[_0x57be('0x52')]==='user'){var _0x1305ed=_0x47b508[_0x57be('0x29')]({'plain':!![]});var _0x5bd09b=_0x57be('0x2a');return db[_0x57be('0x53')][_0x57be('0x4d')]({'where':{'name':_0x5bd09b,'userProfileId':_0x4774da[_0x57be('0x54')]},'raw':!![]})[_0x57be('0x28')](function(_0x1f0034){if(_0x1f0034&&_0x1f0034[_0x57be('0x55')]===0x0){return db[_0x57be('0x56')][_0x57be('0x4e')]({'name':_0x1305ed[_0x57be('0x2e')],'resourceId':_0x1305ed['id'],'type':_0x1f0034[_0x57be('0x2e')],'sectionId':_0x1f0034['id']},{})['then'](function(){return _0x47b508;});}else{return _0x47b508;}})[_0x57be('0x48')](function(_0x5dfd46){logger[_0x57be('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dfd46);throw _0x5dfd46;});}return _0x47b508;})['then'](respondWithResult(_0x574dae,0xc9))[_0x57be('0x48')](handleError(_0x574dae,null));};exports[_0x57be('0x27')]=function(_0x45f433,_0x6765f6){if(_0x45f433['body']['id']){delete _0x45f433['body']['id'];}return db[_0x57be('0x31')][_0x57be('0x4d')]({'where':{'id':_0x45f433[_0x57be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6765f6,null))[_0x57be('0x28')](saveUpdates(_0x45f433['body'],null))['then'](respondWithResult(_0x6765f6,null))['catch'](handleError(_0x6765f6,null));};exports[_0x57be('0x2b')]=function(_0x37b1a4,_0x53aec0){return db[_0x57be('0x31')][_0x57be('0x4d')]({'where':{'id':_0x37b1a4[_0x57be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53aec0,null))[_0x57be('0x28')](removeEntity(_0x53aec0,null))[_0x57be('0x48')](handleError(_0x53aec0,null));}; \ No newline at end of file +var _0x21dc=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','findAll','catch','show','params','keys','filters','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','get','Templates','UserProfileResource','sendStatus','error','name','send','index','Template','rawAttributes','fieldName','type','key','map','query','intersection','model'];(function(_0x45917f,_0x12242e){var _0x4f31b3=function(_0x502646){while(--_0x502646){_0x45917f['push'](_0x45917f['shift']());}};_0x4f31b3(++_0x12242e);}(_0x21dc,0xcb));var _0xc21d=function(_0x23819e,_0x5ca33d){_0x23819e=_0x23819e-0x0;var _0x5510a7=_0x21dc[_0x23819e];return _0x5510a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21d('0x0'));var zipdir=require(_0xc21d('0x1'));var jsonpatch=require(_0xc21d('0x2'));var rp=require(_0xc21d('0x3'));var moment=require(_0xc21d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc21d('0x5'));var util=require(_0xc21d('0x6'));var path=require(_0xc21d('0x7'));var sox=require(_0xc21d('0x8'));var csv=require(_0xc21d('0x9'));var ejs=require(_0xc21d('0xa'));var fs=require('fs');var fs_extra=require(_0xc21d('0xb'));var _=require(_0xc21d('0xc'));var squel=require(_0xc21d('0xd'));var crypto=require('crypto');var jsforce=require(_0xc21d('0xe'));var deskjs=require(_0xc21d('0xf'));var toCsv=require(_0xc21d('0x9'));var querystring=require(_0xc21d('0x10'));var Papa=require('papaparse');var Redis=require(_0xc21d('0x11'));var authService=require(_0xc21d('0x12'));var qs=require(_0xc21d('0x13'));var as=require(_0xc21d('0x14'));var hardwareService=require(_0xc21d('0x15'));var logger=require('../../config/logger')(_0xc21d('0x16'));var utils=require(_0xc21d('0x17'));var config=require(_0xc21d('0x18'));var licenseUtil=require(_0xc21d('0x19'));var db=require(_0xc21d('0x1a'))['db'];function respondWithStatusCode(_0x43c5d1,_0x44dca3){_0x44dca3=_0x44dca3||0xcc;return function(_0x33231e){if(_0x33231e){return _0x43c5d1['sendStatus'](_0x44dca3);}return _0x43c5d1['status'](_0x44dca3)[_0xc21d('0x1b')]();};}function respondWithResult(_0x44a178,_0x3be20e){_0x3be20e=_0x3be20e||0xc8;return function(_0x6396da){if(_0x6396da){return _0x44a178[_0xc21d('0x1c')](_0x3be20e)[_0xc21d('0x1d')](_0x6396da);}};}function respondWithFilteredResult(_0x30b6bd,_0x2382ba){return function(_0x300ecf){if(_0x300ecf){var _0x3cc15f=typeof _0x2382ba['offset']===_0xc21d('0x1e')&&typeof _0x2382ba[_0xc21d('0x1f')]===_0xc21d('0x1e');var _0x32cade=_0x300ecf[_0xc21d('0x20')];var _0x263dff=_0x3cc15f?0x0:_0x2382ba[_0xc21d('0x21')];var _0x1091b0=_0x3cc15f?_0x300ecf[_0xc21d('0x20')]:_0x2382ba['offset']+_0x2382ba[_0xc21d('0x1f')];var _0x466b96;if(_0x1091b0>=_0x32cade){_0x1091b0=_0x32cade;_0x466b96=0xc8;}else{_0x466b96=0xce;}_0x30b6bd[_0xc21d('0x1c')](_0x466b96);return _0x30b6bd[_0xc21d('0x22')](_0xc21d('0x23'),_0x263dff+'-'+_0x1091b0+'/'+_0x32cade)[_0xc21d('0x1d')](_0x300ecf);}return null;};}function patchUpdates(_0x19a470){return function(_0x571674){try{jsonpatch[_0xc21d('0x24')](_0x571674,_0x19a470,!![]);}catch(_0x17f733){return BPromise[_0xc21d('0x25')](_0x17f733);}return _0x571674['save']();};}function saveUpdates(_0x48ea3f,_0x2affb8){return function(_0x425e45){if(_0x425e45){return _0x425e45[_0xc21d('0x26')](_0x48ea3f)['then'](function(_0x1419b5){return _0x1419b5;});}return null;};}function removeEntity(_0x1814f7,_0x415c51){return function(_0xe53e3b){if(_0xe53e3b){return _0xe53e3b[_0xc21d('0x27')]()[_0xc21d('0x28')](function(){var _0x4114f8=_0xe53e3b[_0xc21d('0x29')]({'plain':!![]});var _0x4cfa7e=_0xc21d('0x2a');return db[_0xc21d('0x2b')][_0xc21d('0x27')]({'where':{'type':_0x4cfa7e,'resourceId':_0x4114f8['id']}})[_0xc21d('0x28')](function(){return _0xe53e3b;});})[_0xc21d('0x28')](function(){_0x1814f7[_0xc21d('0x1c')](0xcc)[_0xc21d('0x1b')]();});}};}function handleEntityNotFound(_0x362ad7,_0x8920f6){return function(_0x1f6533){if(!_0x1f6533){_0x362ad7[_0xc21d('0x2c')](0x194);}return _0x1f6533;};}function handleError(_0x42e5c2,_0x5163e0){_0x5163e0=_0x5163e0||0x1f4;return function(_0x3831c){logger[_0xc21d('0x2d')](_0x3831c['stack']);if(_0x3831c[_0xc21d('0x2e')]){delete _0x3831c[_0xc21d('0x2e')];}_0x42e5c2['status'](_0x5163e0)[_0xc21d('0x2f')](_0x3831c);};}exports[_0xc21d('0x30')]=function(_0x1f1e8a,_0x48ab41){var _0x97a7={},_0x5db44f={},_0x32c7f3={'count':0x0,'rows':[]};var _0x369f3e=_['map'](db[_0xc21d('0x31')][_0xc21d('0x32')],function(_0x348e2d){return{'name':_0x348e2d[_0xc21d('0x33')],'type':_0x348e2d[_0xc21d('0x34')][_0xc21d('0x35')]};});_0x5db44f['model']=_[_0xc21d('0x36')](_0x369f3e,'name');_0x5db44f[_0xc21d('0x37')]=_['keys'](_0x1f1e8a['query']);_0x5db44f['filters']=_[_0xc21d('0x38')](_0x5db44f[_0xc21d('0x39')],_0x5db44f[_0xc21d('0x37')]);_0x97a7[_0xc21d('0x3a')]=_[_0xc21d('0x38')](_0x5db44f[_0xc21d('0x39')],qs[_0xc21d('0x3b')](_0x1f1e8a['query'][_0xc21d('0x3b')]));_0x97a7[_0xc21d('0x3a')]=_0x97a7[_0xc21d('0x3a')][_0xc21d('0x3c')]?_0x97a7['attributes']:_0x5db44f['model'];if(!_0x1f1e8a['query'][_0xc21d('0x3d')](_0xc21d('0x3e'))){_0x97a7[_0xc21d('0x1f')]=qs[_0xc21d('0x1f')](_0x1f1e8a[_0xc21d('0x37')][_0xc21d('0x1f')]);_0x97a7['offset']=qs['offset'](_0x1f1e8a[_0xc21d('0x37')][_0xc21d('0x21')]);}_0x97a7[_0xc21d('0x3f')]=qs[_0xc21d('0x40')](_0x1f1e8a[_0xc21d('0x37')]['sort']);_0x97a7[_0xc21d('0x41')]=qs['filters'](_['pick'](_0x1f1e8a[_0xc21d('0x37')],_0x5db44f['filters']),_0x369f3e);if(_0x1f1e8a[_0xc21d('0x37')]['filter']){_0x97a7['where']=_[_0xc21d('0x42')](_0x97a7[_0xc21d('0x41')],{'$or':_[_0xc21d('0x36')](_0x369f3e,function(_0x58b367){if(_0x58b367['type']!==_0xc21d('0x43')){var _0x3431a1={};_0x3431a1[_0x58b367[_0xc21d('0x2e')]]={'$like':'%'+_0x1f1e8a['query']['filter']+'%'};return _0x3431a1;}})});}_0x97a7=_[_0xc21d('0x42')]({},_0x97a7,_0x1f1e8a['options']);var _0x29c773={'where':_0x97a7[_0xc21d('0x41')]};return db['Template'][_0xc21d('0x20')](_0x29c773)[_0xc21d('0x28')](function(_0x16d7e8){_0x32c7f3[_0xc21d('0x20')]=_0x16d7e8;if(_0x1f1e8a[_0xc21d('0x37')]['includeAll']){_0x97a7['include']=[{'all':!![]}];}return db[_0xc21d('0x31')][_0xc21d('0x44')](_0x97a7);})['then'](function(_0x5935d3){_0x32c7f3['rows']=_0x5935d3;return _0x32c7f3;})[_0xc21d('0x28')](respondWithFilteredResult(_0x48ab41,_0x97a7))[_0xc21d('0x45')](handleError(_0x48ab41,null));};exports[_0xc21d('0x46')]=function(_0x3e4e9a,_0xa2a2c1){var _0x477494={'raw':!![],'where':{'id':_0x3e4e9a[_0xc21d('0x47')]['id']}},_0x51c359={};_0x51c359[_0xc21d('0x39')]=_['keys'](db[_0xc21d('0x31')]['rawAttributes']);_0x51c359[_0xc21d('0x37')]=_[_0xc21d('0x48')](_0x3e4e9a[_0xc21d('0x37')]);_0x51c359[_0xc21d('0x49')]=_[_0xc21d('0x38')](_0x51c359['model'],_0x51c359[_0xc21d('0x37')]);_0x477494[_0xc21d('0x3a')]=_['intersection'](_0x51c359[_0xc21d('0x39')],qs['fields'](_0x3e4e9a['query']['fields']));_0x477494[_0xc21d('0x3a')]=_0x477494[_0xc21d('0x3a')]['length']?_0x477494['attributes']:_0x51c359[_0xc21d('0x39')];if(_0x3e4e9a['query'][_0xc21d('0x4a')]){_0x477494[_0xc21d('0x4b')]=[{'all':!![]}];}_0x477494=_[_0xc21d('0x42')]({},_0x477494,_0x3e4e9a[_0xc21d('0x4c')]);return db[_0xc21d('0x31')][_0xc21d('0x4d')](_0x477494)[_0xc21d('0x28')](handleEntityNotFound(_0xa2a2c1,null))['then'](respondWithResult(_0xa2a2c1,null))[_0xc21d('0x45')](handleError(_0xa2a2c1,null));};exports['create']=function(_0x93fd36,_0x4a334a){return db[_0xc21d('0x31')][_0xc21d('0x4e')](_0x93fd36[_0xc21d('0x4f')],{})[_0xc21d('0x28')](function(_0x22abe3){var _0xbcd6a7=_0x93fd36[_0xc21d('0x50')][_0xc21d('0x29')]({'plain':!![]});if(!_0xbcd6a7)throw new Error(_0xc21d('0x51'));if(_0xbcd6a7[_0xc21d('0x52')]==='user'){var _0x55f693=_0x22abe3[_0xc21d('0x29')]({'plain':!![]});var _0xd04d3c=_0xc21d('0x2a');return db[_0xc21d('0x53')][_0xc21d('0x4d')]({'where':{'name':_0xd04d3c,'userProfileId':_0xbcd6a7[_0xc21d('0x54')]},'raw':!![]})[_0xc21d('0x28')](function(_0x59d500){if(_0x59d500&&_0x59d500[_0xc21d('0x55')]===0x0){return db[_0xc21d('0x2b')][_0xc21d('0x4e')]({'name':_0x55f693[_0xc21d('0x2e')],'resourceId':_0x55f693['id'],'type':_0x59d500[_0xc21d('0x2e')],'sectionId':_0x59d500['id']},{})[_0xc21d('0x28')](function(){return _0x22abe3;});}else{return _0x22abe3;}})[_0xc21d('0x45')](function(_0x4c77cf){logger[_0xc21d('0x2d')](_0xc21d('0x56'),_0x4c77cf);throw _0x4c77cf;});}return _0x22abe3;})[_0xc21d('0x28')](respondWithResult(_0x4a334a,0xc9))[_0xc21d('0x45')](handleError(_0x4a334a,null));};exports['update']=function(_0x33a1b9,_0x39bb30){if(_0x33a1b9[_0xc21d('0x4f')]['id']){delete _0x33a1b9[_0xc21d('0x4f')]['id'];}return db['Template'][_0xc21d('0x4d')]({'where':{'id':_0x33a1b9[_0xc21d('0x47')]['id']}})[_0xc21d('0x28')](handleEntityNotFound(_0x39bb30,null))[_0xc21d('0x28')](saveUpdates(_0x33a1b9['body'],null))[_0xc21d('0x28')](respondWithResult(_0x39bb30,null))[_0xc21d('0x45')](handleError(_0x39bb30,null));};exports[_0xc21d('0x27')]=function(_0x433c7d,_0x366dbd){return db[_0xc21d('0x31')][_0xc21d('0x4d')]({'where':{'id':_0x433c7d[_0xc21d('0x47')]['id']}})[_0xc21d('0x28')](handleEntityNotFound(_0x366dbd,null))['then'](removeEntity(_0x366dbd,null))[_0xc21d('0x45')](handleError(_0x366dbd,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 33deba2..8b1feab 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 _0x846c=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','Template','lodash','../../config/logger'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x846c,0x15c));var _0xc846=function(_0x2f8ba0,_0x161473){_0x2f8ba0=_0x2f8ba0-0x0;var _0x548c23=_0x846c[_0x2f8ba0];return _0x548c23;};'use strict';var _=require(_0xc846('0x0'));var util=require('util');var logger=require(_0xc846('0x1'))('api');var moment=require(_0xc846('0x2'));var BPromise=require(_0xc846('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc846('0x4'));var rimraf=require(_0xc846('0x5'));var config=require(_0xc846('0x6'));var attributes=require(_0xc846('0x7'));module[_0xc846('0x8')]=function(_0x4a60f2,_0x4e32e9){return _0x4a60f2['define'](_0xc846('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe72=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','Template','lodash','../../config/logger','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfe72,0x1e7));var _0x2fe7=function(_0x23e87c,_0x1077ab){_0x23e87c=_0x23e87c-0x0;var _0x5225f4=_0xfe72[_0x23e87c];return _0x5225f4;};'use strict';var _=require(_0x2fe7('0x0'));var util=require('util');var logger=require(_0x2fe7('0x1'))('api');var moment=require(_0x2fe7('0x2'));var BPromise=require(_0x2fe7('0x3'));var rp=require(_0x2fe7('0x4'));var fs=require('fs');var path=require(_0x2fe7('0x5'));var rimraf=require(_0x2fe7('0x6'));var config=require(_0x2fe7('0x7'));var attributes=require(_0x2fe7('0x8'));module['exports']=function(_0xbe7515,_0x3e9e76){return _0xbe7515['define'](_0x2fe7('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 5fd0689..a549ab6 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 _0x0895=['debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Template','findAll','options','where','limit','include','attributes','map','model','info','GetTemplate','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s'];(function(_0x12aa7c,_0x4e4eb0){var _0x447ef0=function(_0x52bb24){while(--_0x52bb24){_0x12aa7c['push'](_0x12aa7c['shift']());}};_0x447ef0(++_0x4e4eb0);}(_0x0895,0x1a0));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));var moment=require('moment');var BPromise=require(_0x5089('0x2'));var rs=require(_0x5089('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5089('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5089('0x5'))(_0x5089('0x6'));var config=require(_0x5089('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5089('0x8')][_0x5089('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x214fe9,_0x389fa5,_0x17f23f){return new BPromise(function(_0x1a0578,_0x2aafd8){return client[_0x5089('0xa')](_0x214fe9,_0x17f23f)[_0x5089('0xb')](function(_0x264836){logger['info'](_0x5089('0xc'),_0x389fa5,'request\x20sent');logger[_0x5089('0xd')](_0x5089('0xe'),_0x389fa5,_0x5089('0xf'),JSON[_0x5089('0x10')](_0x264836));if(_0x264836[_0x5089('0x11')]){if(_0x264836[_0x5089('0x11')][_0x5089('0x12')]===0x1f4){logger[_0x5089('0x11')](_0x5089('0xc'),_0x389fa5,_0x264836['error'][_0x5089('0x13')]);return _0x2aafd8(_0x264836['error'][_0x5089('0x13')]);}logger[_0x5089('0x11')](_0x5089('0xc'),_0x389fa5,_0x264836[_0x5089('0x11')][_0x5089('0x13')]);return _0x1a0578(_0x264836[_0x5089('0x11')][_0x5089('0x13')]);}else{logger['info'](_0x5089('0xc'),_0x389fa5,_0x5089('0xf'));_0x1a0578(_0x264836[_0x5089('0x14')][_0x5089('0x13')]);}})['catch'](function(_0x3365cb){logger['error'](_0x5089('0xc'),_0x389fa5,_0x3365cb);_0x2aafd8(_0x3365cb);});});}exports['GetTemplate']=function(_0x56c3e9){var _0x5c4e7f=this;return new Promise(function(_0x508ba4,_0x10ab40){return db[_0x5089('0x15')][_0x5089('0x16')]({'raw':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9[_0x5089('0x17')][_0x5089('0x18')]||null:null,'attributes':_0x56c3e9['options']?_0x56c3e9[_0x5089('0x17')]['attributes']||null:null,'limit':_0x56c3e9['options']?_0x56c3e9[_0x5089('0x17')][_0x5089('0x19')]||null:null,'include':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9[_0x5089('0x17')][_0x5089('0x1a')]?_['map'](_0x56c3e9[_0x5089('0x17')][_0x5089('0x1a')],function(_0x428ac5){return{'model':db[_0x428ac5['model']],'as':_0x428ac5['as'],'attributes':_0x428ac5[_0x5089('0x1b')],'include':_0x428ac5[_0x5089('0x1a')]?_[_0x5089('0x1c')](_0x428ac5[_0x5089('0x1a')],function(_0x18f25f){return{'model':db[_0x18f25f[_0x5089('0x1d')]],'as':_0x18f25f['as'],'attributes':_0x18f25f[_0x5089('0x1b')],'include':_0x18f25f['include']?_[_0x5089('0x1c')](_0x18f25f[_0x5089('0x1a')],function(_0x2409a3){return{'model':db[_0x2409a3[_0x5089('0x1d')]],'as':_0x2409a3['as'],'attributes':_0x2409a3[_0x5089('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5089('0xb')](function(_0x222c5e){logger[_0x5089('0x1e')]('GetTemplate',_0x56c3e9);logger[_0x5089('0xd')](_0x5089('0x1f'),_0x56c3e9,JSON[_0x5089('0x10')](_0x222c5e));_0x508ba4(_0x222c5e);})[_0x5089('0x20')](function(_0x6a746c){logger['error']('GetTemplate',_0x6a746c[_0x5089('0x13')],_0x56c3e9);_0x10ab40(_0x5c4e7f[_0x5089('0x11')](0x1f4,_0x6a746c[_0x5089('0x13')]));});});}; \ No newline at end of file +var _0x85a2=['info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','then','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xbecb28,_0x37c5bb){var _0x6994bd=function(_0x3c501d){while(--_0x3c501d){_0xbecb28['push'](_0xbecb28['shift']());}};_0x6994bd(++_0x37c5bb);}(_0x85a2,0x7c));var _0x285a=function(_0x145516,_0x5aa90b){_0x145516=_0x145516-0x0;var _0x58c743=_0x85a2[_0x145516];return _0x58c743;};'use strict';var _=require(_0x285a('0x0'));var util=require('util');var moment=require(_0x285a('0x1'));var BPromise=require('bluebird');var rs=require(_0x285a('0x2'));var fs=require('fs');var Redis=require(_0x285a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x285a('0x4'));var logger=require(_0x285a('0x5'))(_0x285a('0x6'));var config=require(_0x285a('0x7'));var jayson=require(_0x285a('0x8'));var client=jayson[_0x285a('0x9')][_0x285a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x577d1c,_0x3f2a32,_0xe96dc5){return new BPromise(function(_0x4c6e80,_0x258db0){return client[_0x285a('0xb')](_0x577d1c,_0xe96dc5)['then'](function(_0x5f5405){logger[_0x285a('0xc')](_0x285a('0xd'),_0x3f2a32,_0x285a('0xe'));logger[_0x285a('0xf')](_0x285a('0x10'),_0x3f2a32,_0x285a('0xe'),JSON[_0x285a('0x11')](_0x5f5405));if(_0x5f5405[_0x285a('0x12')]){if(_0x5f5405['error'][_0x285a('0x13')]===0x1f4){logger[_0x285a('0x12')]('Template,\x20%s,\x20%s',_0x3f2a32,_0x5f5405['error'][_0x285a('0x14')]);return _0x258db0(_0x5f5405[_0x285a('0x12')]['message']);}logger[_0x285a('0x12')](_0x285a('0xd'),_0x3f2a32,_0x5f5405[_0x285a('0x12')][_0x285a('0x14')]);return _0x4c6e80(_0x5f5405[_0x285a('0x12')][_0x285a('0x14')]);}else{logger[_0x285a('0xc')](_0x285a('0xd'),_0x3f2a32,_0x285a('0xe'));_0x4c6e80(_0x5f5405[_0x285a('0x15')][_0x285a('0x14')]);}})[_0x285a('0x16')](function(_0x59cfdb){logger[_0x285a('0x12')]('Template,\x20%s,\x20%s',_0x3f2a32,_0x59cfdb);_0x258db0(_0x59cfdb);});});}exports[_0x285a('0x17')]=function(_0x16e80b){var _0x334ff6=this;return new Promise(function(_0x196572,_0x425e5d){return db[_0x285a('0x18')][_0x285a('0x19')]({'raw':_0x16e80b[_0x285a('0x1a')]?_0x16e80b[_0x285a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x16e80b[_0x285a('0x1a')]?_0x16e80b['options'][_0x285a('0x1b')]||null:null,'attributes':_0x16e80b['options']?_0x16e80b['options'][_0x285a('0x1c')]||null:null,'limit':_0x16e80b['options']?_0x16e80b[_0x285a('0x1a')][_0x285a('0x1d')]||null:null,'include':_0x16e80b[_0x285a('0x1a')]?_0x16e80b[_0x285a('0x1a')][_0x285a('0x1e')]?_[_0x285a('0x1f')](_0x16e80b[_0x285a('0x1a')]['include'],function(_0x52b596){return{'model':db[_0x52b596['model']],'as':_0x52b596['as'],'attributes':_0x52b596[_0x285a('0x1c')],'include':_0x52b596[_0x285a('0x1e')]?_[_0x285a('0x1f')](_0x52b596[_0x285a('0x1e')],function(_0x2b75d1){return{'model':db[_0x2b75d1[_0x285a('0x20')]],'as':_0x2b75d1['as'],'attributes':_0x2b75d1[_0x285a('0x1c')],'include':_0x2b75d1['include']?_['map'](_0x2b75d1['include'],function(_0x5c1bcf){return{'model':db[_0x5c1bcf[_0x285a('0x20')]],'as':_0x5c1bcf['as'],'attributes':_0x5c1bcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x285a('0x21')](function(_0x2a6a5a){logger[_0x285a('0xc')](_0x285a('0x17'),_0x16e80b);logger[_0x285a('0xf')](_0x285a('0x17'),_0x16e80b,JSON[_0x285a('0x11')](_0x2a6a5a));_0x196572(_0x2a6a5a);})[_0x285a('0x16')](function(_0x24bb42){logger[_0x285a('0x12')](_0x285a('0x17'),_0x24bb42[_0x285a('0x14')],_0x16e80b);_0x425e5d(_0x334ff6[_0x285a('0x12')](0x1f4,_0x24bb42[_0x285a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8a61ab2..8498b8c 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 _0x1f81=['put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction'];(function(_0x2f592a,_0x2b0a2a){var _0x700052=function(_0x48be0f){while(--_0x48be0f){_0x2f592a['push'](_0x2f592a['shift']());}};_0x700052(++_0x2b0a2a);}(_0x1f81,0xab));var _0x11f8=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x1f81[_0x15b399];return _0x199f2d;};'use strict';var multer=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var path=require('path');var timeout=require(_0x11f8('0x2'));var express=require(_0x11f8('0x3'));var router=express['Router']();var fs_extra=require(_0x11f8('0x4'));var auth=require(_0x11f8('0x5'));var interaction=require(_0x11f8('0x6'));var config=require(_0x11f8('0x7'));var controller=require(_0x11f8('0x8'));router[_0x11f8('0x9')]('/',auth[_0x11f8('0xa')](),controller[_0x11f8('0xb')]);router['get'](_0x11f8('0xc'),auth[_0x11f8('0xa')](),controller[_0x11f8('0xd')]);router[_0x11f8('0x9')](_0x11f8('0xe'),auth[_0x11f8('0xa')](),controller[_0x11f8('0xf')]);router[_0x11f8('0x9')](_0x11f8('0x10'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x11')]);router['get'](_0x11f8('0x12'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x13')]);router[_0x11f8('0x14')]('/',auth[_0x11f8('0xa')](),controller[_0x11f8('0x15')]);router['post'](_0x11f8('0xe'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x16')]);router['post'](_0x11f8('0x10'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x17')]);router[_0x11f8('0x14')]('/:id/actions',auth[_0x11f8('0xa')](),controller[_0x11f8('0x18')]);router[_0x11f8('0x19')](_0x11f8('0xc'),auth[_0x11f8('0xa')](),controller['update']);router[_0x11f8('0x1a')](_0x11f8('0xc'),auth['isAuthenticated'](),controller[_0x11f8('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x77e6=['addAction','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','get','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition'];(function(_0x71d604,_0x3edc06){var _0x1ae5a5=function(_0x1eb704){while(--_0x1eb704){_0x71d604['push'](_0x71d604['shift']());}};_0x1ae5a5(++_0x3edc06);}(_0x77e6,0x1a6));var _0x677e=function(_0x11f7ca,_0x419d9a){_0x11f7ca=_0x11f7ca-0x0;var _0x379214=_0x77e6[_0x11f7ca];return _0x379214;};'use strict';var multer=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var path=require(_0x677e('0x2'));var timeout=require(_0x677e('0x3'));var express=require(_0x677e('0x4'));var router=express[_0x677e('0x5')]();var fs_extra=require(_0x677e('0x6'));var auth=require(_0x677e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x677e('0x8'));var controller=require(_0x677e('0x9'));router['get']('/',auth[_0x677e('0xa')](),controller['index']);router[_0x677e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x677e('0xc')]);router[_0x677e('0xb')](_0x677e('0xd'),auth[_0x677e('0xa')](),controller['getAllConditions']);router[_0x677e('0xb')]('/:id/any_conditions',auth[_0x677e('0xa')](),controller[_0x677e('0xe')]);router[_0x677e('0xb')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x10')]);router[_0x677e('0x11')]('/',auth[_0x677e('0xa')](),controller[_0x677e('0x12')]);router[_0x677e('0x11')](_0x677e('0xd'),auth[_0x677e('0xa')](),controller[_0x677e('0x13')]);router[_0x677e('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x677e('0x11')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x14')]);router[_0x677e('0x15')](_0x677e('0x16'),auth[_0x677e('0xa')](),controller[_0x677e('0x17')]);router[_0x677e('0x18')](_0x677e('0x16'),auth[_0x677e('0xa')](),controller[_0x677e('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 139d2f2..ddd0112 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 _0xc208=['BOOLEAN','exports','STRING'];(function(_0xc28fe6,_0x44bae7){var _0x114395=function(_0xc3ab84){while(--_0xc3ab84){_0xc28fe6['push'](_0xc28fe6['shift']());}};_0x114395(++_0x44bae7);}(_0xc208,0x148));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x8c20('0x0')]={'name':{'type':Sequelize[_0x8c20('0x1')]},'channel':{'type':Sequelize[_0x8c20('0x1')]},'description':{'type':Sequelize[_0x8c20('0x1')]},'status':{'type':Sequelize[_0x8c20('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0ab=['BOOLEAN','sequelize','STRING'];(function(_0x2b71c3,_0x5779f1){var _0x56876f=function(_0x56edc4){while(--_0x56edc4){_0x2b71c3['push'](_0x2b71c3['shift']());}};_0x56876f(++_0x5779f1);}(_0xe0ab,0x106));var _0xbe0a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe0ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xbe0a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe0a('0x1')]},'channel':{'type':Sequelize[_0xbe0a('0x1')]},'description':{'type':Sequelize[_0xbe0a('0x1')]},'status':{'type':Sequelize[_0xbe0a('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 5edbfcc..d0083d6 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 _0x5b5f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','sendStatus','error','name','send','index','Trigger','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','Condition','getAllConditions','getAnyConditions','TriggerId','getActions','Action','eml-format'];(function(_0xc83008,_0x219543){var _0xc66520=function(_0x557173){while(--_0x557173){_0xc83008['push'](_0xc83008['shift']());}};_0xc66520(++_0x219543);}(_0x5b5f,0x1d0));var _0xf5b5=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x5b5f[_0x2f3794];return _0x1c9fbe;};'use strict';var emlformat=require(_0xf5b5('0x0'));var rimraf=require(_0xf5b5('0x1'));var zipdir=require(_0xf5b5('0x2'));var jsonpatch=require(_0xf5b5('0x3'));var rp=require(_0xf5b5('0x4'));var moment=require(_0xf5b5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf5b5('0x6'));var sox=require(_0xf5b5('0x7'));var csv=require(_0xf5b5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5b5('0x9'));var _=require(_0xf5b5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf5b5('0x8'));var querystring=require(_0xf5b5('0xc'));var Papa=require(_0xf5b5('0xd'));var Redis=require(_0xf5b5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf5b5('0xf'));var hardwareService=require(_0xf5b5('0x10'));var logger=require(_0xf5b5('0x11'))(_0xf5b5('0x12'));var utils=require(_0xf5b5('0x13'));var config=require(_0xf5b5('0x14'));var licenseUtil=require(_0xf5b5('0x15'));var db=require(_0xf5b5('0x16'))['db'];function respondWithStatusCode(_0x39339a,_0x420121){_0x420121=_0x420121||0xcc;return function(_0x13ee74){if(_0x13ee74){return _0x39339a['sendStatus'](_0x420121);}return _0x39339a[_0xf5b5('0x17')](_0x420121)[_0xf5b5('0x18')]();};}function respondWithResult(_0x4993a1,_0x595246){_0x595246=_0x595246||0xc8;return function(_0x379c28){if(_0x379c28){return _0x4993a1[_0xf5b5('0x17')](_0x595246)[_0xf5b5('0x19')](_0x379c28);}};}function respondWithFilteredResult(_0x2e0a13,_0x398572){return function(_0x2837dc){if(_0x2837dc){var _0x3e0777=typeof _0x398572[_0xf5b5('0x1a')]===_0xf5b5('0x1b')&&typeof _0x398572[_0xf5b5('0x1c')]==='undefined';var _0x5da3d4=_0x2837dc[_0xf5b5('0x1d')];var _0x169632=_0x3e0777?0x0:_0x398572['offset'];var _0x506143=_0x3e0777?_0x2837dc[_0xf5b5('0x1d')]:_0x398572['offset']+_0x398572['limit'];var _0x3e8e63;if(_0x506143>=_0x5da3d4){_0x506143=_0x5da3d4;_0x3e8e63=0xc8;}else{_0x3e8e63=0xce;}_0x2e0a13[_0xf5b5('0x17')](_0x3e8e63);return _0x2e0a13[_0xf5b5('0x1e')](_0xf5b5('0x1f'),_0x169632+'-'+_0x506143+'/'+_0x5da3d4)[_0xf5b5('0x19')](_0x2837dc);}return null;};}function patchUpdates(_0xae197e){return function(_0x2094c1){try{jsonpatch[_0xf5b5('0x20')](_0x2094c1,_0xae197e,!![]);}catch(_0x4f6c6b){return BPromise['reject'](_0x4f6c6b);}return _0x2094c1[_0xf5b5('0x21')]();};}function saveUpdates(_0x498c40,_0x3091a8){return function(_0x75b6e2){if(_0x75b6e2){return _0x75b6e2[_0xf5b5('0x22')](_0x498c40)['then'](function(_0x55ed87){return _0x55ed87;});}return null;};}function removeEntity(_0x20d6db,_0x5a4a88){return function(_0x32eaec){if(_0x32eaec){return _0x32eaec['destroy']()[_0xf5b5('0x23')](function(){var _0x716dbf=_0x32eaec[_0xf5b5('0x24')]({'plain':!![]});var _0xf33376='Triggers';return db[_0xf5b5('0x25')]['destroy']({'where':{'type':_0xf33376,'resourceId':_0x716dbf['id']}})['then'](function(){return _0x32eaec;});})[_0xf5b5('0x23')](function(){_0x20d6db[_0xf5b5('0x17')](0xcc)[_0xf5b5('0x18')]();});}};}function handleEntityNotFound(_0xa1703f,_0x521560){return function(_0x56363a){if(!_0x56363a){_0xa1703f[_0xf5b5('0x26')](0x194);}return _0x56363a;};}function handleError(_0x2259ce,_0x11d2e8){_0x11d2e8=_0x11d2e8||0x1f4;return function(_0x4e2074){logger[_0xf5b5('0x27')](_0x4e2074['stack']);if(_0x4e2074[_0xf5b5('0x28')]){delete _0x4e2074[_0xf5b5('0x28')];}_0x2259ce[_0xf5b5('0x17')](_0x11d2e8)[_0xf5b5('0x29')](_0x4e2074);};}exports[_0xf5b5('0x2a')]=function(_0x24fd34,_0x4c432a){var _0x44c880={},_0x4b198e={},_0x117ee1={'count':0x0,'rows':[]};var _0x44764a=_['map'](db[_0xf5b5('0x2b')][_0xf5b5('0x2c')],function(_0x50ab4b){return{'name':_0x50ab4b[_0xf5b5('0x2d')],'type':_0x50ab4b[_0xf5b5('0x2e')]['key']};});_0x4b198e[_0xf5b5('0x2f')]=_[_0xf5b5('0x30')](_0x44764a,_0xf5b5('0x28'));_0x4b198e['query']=_[_0xf5b5('0x31')](_0x24fd34['query']);_0x4b198e[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x4b198e['model'],_0x4b198e[_0xf5b5('0x34')]);_0x44c880[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x4b198e['model'],qs[_0xf5b5('0x36')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x36')]));_0x44c880[_0xf5b5('0x35')]=_0x44c880[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x44c880[_0xf5b5('0x35')]:_0x4b198e['model'];if(!_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x38')](_0xf5b5('0x39'))){_0x44c880['limit']=qs[_0xf5b5('0x1c')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x1c')]);_0x44c880[_0xf5b5('0x1a')]=qs[_0xf5b5('0x1a')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x1a')]);}_0x44c880[_0xf5b5('0x3a')]=qs[_0xf5b5('0x3b')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x3b')]);_0x44c880[_0xf5b5('0x3c')]=qs[_0xf5b5('0x32')](_[_0xf5b5('0x3d')](_0x24fd34[_0xf5b5('0x34')],_0x4b198e[_0xf5b5('0x32')]),_0x44764a);if(_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x3e')]){_0x44c880[_0xf5b5('0x3c')]=_[_0xf5b5('0x3f')](_0x44c880[_0xf5b5('0x3c')],{'$or':_['map'](_0x44764a,function(_0x185270){if(_0x185270[_0xf5b5('0x2e')]!==_0xf5b5('0x40')){var _0x51fa50={};_0x51fa50[_0x185270[_0xf5b5('0x28')]]={'$like':'%'+_0x24fd34['query'][_0xf5b5('0x3e')]+'%'};return _0x51fa50;}})});}_0x44c880=_['merge']({},_0x44c880,_0x24fd34[_0xf5b5('0x41')]);var _0x4690f4={'where':_0x44c880['where']};return db[_0xf5b5('0x2b')][_0xf5b5('0x1d')](_0x4690f4)[_0xf5b5('0x23')](function(_0x3b397a){_0x117ee1[_0xf5b5('0x1d')]=_0x3b397a;if(_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x42')]){_0x44c880['include']=[{'all':!![]}];}return db[_0xf5b5('0x2b')][_0xf5b5('0x43')](_0x44c880);})[_0xf5b5('0x23')](function(_0x17439c){_0x117ee1['rows']=_0x17439c;return _0x117ee1;})[_0xf5b5('0x23')](respondWithFilteredResult(_0x4c432a,_0x44c880))['catch'](handleError(_0x4c432a,null));};exports[_0xf5b5('0x44')]=function(_0x12d88a,_0x5b9b1a){var _0x58855f={'raw':![],'where':{'id':_0x12d88a[_0xf5b5('0x45')]['id']}},_0x49fa25={};_0x49fa25[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x2b')][_0xf5b5('0x2c')]);_0x49fa25[_0xf5b5('0x34')]=_[_0xf5b5('0x31')](_0x12d88a['query']);_0x49fa25['filters']=_[_0xf5b5('0x33')](_0x49fa25[_0xf5b5('0x2f')],_0x49fa25[_0xf5b5('0x34')]);_0x58855f[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x49fa25['model'],qs[_0xf5b5('0x36')](_0x12d88a['query']['fields']));_0x58855f[_0xf5b5('0x35')]=_0x58855f['attributes'][_0xf5b5('0x37')]?_0x58855f[_0xf5b5('0x35')]:_0x49fa25[_0xf5b5('0x2f')];if(_0x12d88a[_0xf5b5('0x34')]['includeAll']){_0x58855f[_0xf5b5('0x46')]=[{'all':!![]}];}_0x58855f=_[_0xf5b5('0x3f')]({},_0x58855f,_0x12d88a[_0xf5b5('0x41')]);return db[_0xf5b5('0x2b')][_0xf5b5('0x47')](_0x58855f)[_0xf5b5('0x23')](handleEntityNotFound(_0x5b9b1a,null))['then'](respondWithResult(_0x5b9b1a,null))['catch'](handleError(_0x5b9b1a,null));};exports[_0xf5b5('0x48')]=function(_0x44801f,_0x230806){return db['Trigger']['create'](_0x44801f[_0xf5b5('0x49')],{})['then'](function(_0xafa133){var _0xaad21e=_0x44801f[_0xf5b5('0x4a')][_0xf5b5('0x24')]({'plain':!![]});if(!_0xaad21e)throw new Error(_0xf5b5('0x4b'));if(_0xaad21e[_0xf5b5('0x4c')]===_0xf5b5('0x4a')){var _0x2fd9f6=_0xafa133[_0xf5b5('0x24')]({'plain':!![]});var _0x5b756c='Triggers';return db[_0xf5b5('0x4d')][_0xf5b5('0x47')]({'where':{'name':_0x5b756c,'userProfileId':_0xaad21e[_0xf5b5('0x4e')]},'raw':!![]})['then'](function(_0x483560){if(_0x483560&&_0x483560[_0xf5b5('0x4f')]===0x0){return db['UserProfileResource'][_0xf5b5('0x48')]({'name':_0x2fd9f6['name'],'resourceId':_0x2fd9f6['id'],'type':_0x483560[_0xf5b5('0x28')],'sectionId':_0x483560['id']},{})[_0xf5b5('0x23')](function(){return _0xafa133;});}else{return _0xafa133;}})['catch'](function(_0x2b892e){logger[_0xf5b5('0x27')](_0xf5b5('0x50'),_0x2b892e);throw _0x2b892e;});}return _0xafa133;})[_0xf5b5('0x23')](respondWithResult(_0x230806,0xc9))['catch'](handleError(_0x230806,null));};exports['update']=function(_0x2be69b,_0x2874e4){if(_0x2be69b[_0xf5b5('0x49')]['id']){delete _0x2be69b[_0xf5b5('0x49')]['id'];}return db[_0xf5b5('0x2b')]['find']({'where':{'id':_0x2be69b[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x2874e4,null))[_0xf5b5('0x23')](saveUpdates(_0x2be69b[_0xf5b5('0x49')],null))['then'](respondWithResult(_0x2874e4,null))[_0xf5b5('0x51')](handleError(_0x2874e4,null));};exports[_0xf5b5('0x52')]=function(_0x22904e,_0x55f040){return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x22904e[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x55f040,null))[_0xf5b5('0x23')](removeEntity(_0x55f040,null))['catch'](handleError(_0x55f040,null));};exports['addAllCondition']=function(_0x438d84,_0x33e212,_0x5e0ffe){if(_0x438d84['body']['id']){delete _0x438d84[_0xf5b5('0x49')]['id'];}return db['Trigger'][_0xf5b5('0x47')]({'where':{'id':_0x438d84[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x33e212,null))['then'](function(_0x488d75){if(_0x488d75){_0x438d84['body'][_0xf5b5('0x53')]=_0x488d75['id'];return db['Condition'][_0xf5b5('0x48')](_0x438d84[_0xf5b5('0x49')]);}})[_0xf5b5('0x23')](respondWithResult(_0x33e212,null))[_0xf5b5('0x51')](handleError(_0x33e212,null));};exports[_0xf5b5('0x54')]=function(_0x249464,_0x58c2dd,_0x3a2b52){if(_0x249464[_0xf5b5('0x49')]['id']){delete _0x249464[_0xf5b5('0x49')]['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x249464[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x58c2dd,null))[_0xf5b5('0x23')](function(_0x26c83b){if(_0x26c83b){_0x249464[_0xf5b5('0x49')][_0xf5b5('0x55')]=_0x26c83b['id'];return db['Condition']['create'](_0x249464[_0xf5b5('0x49')]);}})['then'](respondWithResult(_0x58c2dd,null))[_0xf5b5('0x51')](handleError(_0x58c2dd,null));};exports['getAllConditions']=function(_0x4bd45a,_0x2ad65d,_0xa75565){var _0x4967a9={};var _0x3b631a={};var _0x464bbc;var _0x1c2bea;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x4bd45a[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x2ad65d,null))[_0xf5b5('0x23')](function(_0x567d2f){if(_0x567d2f){_0x464bbc=_0x567d2f;_0x3b631a[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x57')][_0xf5b5('0x2c')]);_0x3b631a[_0xf5b5('0x34')]=_['keys'](_0x4bd45a[_0xf5b5('0x34')]);_0x3b631a[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x3b631a[_0xf5b5('0x2f')],_0x3b631a[_0xf5b5('0x34')]);_0x4967a9[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x3b631a[_0xf5b5('0x2f')],qs[_0xf5b5('0x36')](_0x4bd45a['query']['fields']));_0x4967a9[_0xf5b5('0x35')]=_0x4967a9[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x4967a9[_0xf5b5('0x35')]:_0x3b631a[_0xf5b5('0x2f')];_0x4967a9[_0xf5b5('0x3a')]=qs['sort'](_0x4bd45a['query']['sort']);_0x4967a9['where']=qs['filters'](_['pick'](_0x4bd45a[_0xf5b5('0x34')],_0x3b631a[_0xf5b5('0x32')]));if(_0x4bd45a['query'][_0xf5b5('0x3e')]){_0x4967a9['where']=_[_0xf5b5('0x3f')](_0x4967a9['where'],{'$or':_[_0xf5b5('0x30')](_0x4967a9[_0xf5b5('0x35')],function(_0x2a4ef1){var _0x34da2b={};_0x34da2b[_0x2a4ef1]={'$like':'%'+_0x4bd45a['query'][_0xf5b5('0x3e')]+'%'};return _0x34da2b;})});}_0x4967a9=_['merge']({},_0x4967a9,_0x4bd45a[_0xf5b5('0x41')]);return _0x464bbc[_0xf5b5('0x58')](_0x4967a9);}})['then'](function(_0x21e51b){if(_0x21e51b){_0x1c2bea=_0x21e51b[_0xf5b5('0x37')];if(!_0x4bd45a[_0xf5b5('0x34')]['hasOwnProperty'](_0xf5b5('0x39'))){_0x4967a9[_0xf5b5('0x1c')]=qs[_0xf5b5('0x1c')](_0x4bd45a[_0xf5b5('0x34')][_0xf5b5('0x1c')]);_0x4967a9['offset']=qs[_0xf5b5('0x1a')](_0x4bd45a['query'][_0xf5b5('0x1a')]);}return _0x464bbc['getAllConditions'](_0x4967a9);}})[_0xf5b5('0x23')](function(_0x1c3003){if(_0x1c3003){return _0x1c3003?{'count':_0x1c2bea,'rows':_0x1c3003}:null;}})['then'](respondWithResult(_0x2ad65d,null))[_0xf5b5('0x51')](handleError(_0x2ad65d,null));};exports['getAnyConditions']=function(_0x13cf8b,_0x22e41e,_0x1d9c1a){var _0x339675={};var _0x2929ee={};var _0x45d667;var _0x44946f;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x13cf8b[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x22e41e,null))[_0xf5b5('0x23')](function(_0x4d5d81){if(_0x4d5d81){_0x45d667=_0x4d5d81;_0x2929ee[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x57')][_0xf5b5('0x2c')]);_0x2929ee[_0xf5b5('0x34')]=_[_0xf5b5('0x31')](_0x13cf8b[_0xf5b5('0x34')]);_0x2929ee['filters']=_[_0xf5b5('0x33')](_0x2929ee[_0xf5b5('0x2f')],_0x2929ee[_0xf5b5('0x34')]);_0x339675[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x2929ee[_0xf5b5('0x2f')],qs[_0xf5b5('0x36')](_0x13cf8b[_0xf5b5('0x34')][_0xf5b5('0x36')]));_0x339675[_0xf5b5('0x35')]=_0x339675[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x339675[_0xf5b5('0x35')]:_0x2929ee[_0xf5b5('0x2f')];_0x339675['order']=qs[_0xf5b5('0x3b')](_0x13cf8b[_0xf5b5('0x34')]['sort']);_0x339675[_0xf5b5('0x3c')]=qs[_0xf5b5('0x32')](_[_0xf5b5('0x3d')](_0x13cf8b[_0xf5b5('0x34')],_0x2929ee['filters']));if(_0x13cf8b['query'][_0xf5b5('0x3e')]){_0x339675['where']=_[_0xf5b5('0x3f')](_0x339675[_0xf5b5('0x3c')],{'$or':_['map'](_0x339675['attributes'],function(_0x3dc01e){var _0x2fee92={};_0x2fee92[_0x3dc01e]={'$like':'%'+_0x13cf8b[_0xf5b5('0x34')][_0xf5b5('0x3e')]+'%'};return _0x2fee92;})});}_0x339675=_['merge']({},_0x339675,_0x13cf8b[_0xf5b5('0x41')]);return _0x45d667[_0xf5b5('0x59')](_0x339675);}})[_0xf5b5('0x23')](function(_0x2c3381){if(_0x2c3381){_0x44946f=_0x2c3381[_0xf5b5('0x37')];if(!_0x13cf8b['query']['hasOwnProperty'](_0xf5b5('0x39'))){_0x339675['limit']=qs[_0xf5b5('0x1c')](_0x13cf8b[_0xf5b5('0x34')]['limit']);_0x339675[_0xf5b5('0x1a')]=qs['offset'](_0x13cf8b['query'][_0xf5b5('0x1a')]);}return _0x45d667[_0xf5b5('0x59')](_0x339675);}})[_0xf5b5('0x23')](function(_0x5b182b){if(_0x5b182b){return _0x5b182b?{'count':_0x44946f,'rows':_0x5b182b}:null;}})['then'](respondWithResult(_0x22e41e,null))[_0xf5b5('0x51')](handleError(_0x22e41e,null));};exports['addAction']=function(_0x35a800,_0x3f82a1,_0x1aa9d3){if(_0x35a800[_0xf5b5('0x49')]['id']){delete _0x35a800['body']['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x35a800[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x3f82a1,null))[_0xf5b5('0x23')](function(_0x27c0d0){if(_0x27c0d0){_0x35a800[_0xf5b5('0x49')][_0xf5b5('0x5a')]=_0x27c0d0['id'];return db['Action'][_0xf5b5('0x48')](_0x35a800[_0xf5b5('0x49')]);}})[_0xf5b5('0x23')](respondWithResult(_0x3f82a1,null))[_0xf5b5('0x51')](handleError(_0x3f82a1,null));};exports[_0xf5b5('0x5b')]=function(_0x539a9a,_0x10f017,_0x2329b1){var _0x132324={};var _0x553037={};var _0x283f65;var _0x5e5196;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x539a9a[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x10f017,null))[_0xf5b5('0x23')](function(_0x57af01){if(_0x57af01){_0x283f65=_0x57af01;_0x553037['model']=_[_0xf5b5('0x31')](db[_0xf5b5('0x5c')][_0xf5b5('0x2c')]);_0x553037['query']=_[_0xf5b5('0x31')](_0x539a9a[_0xf5b5('0x34')]);_0x553037[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x553037[_0xf5b5('0x2f')],_0x553037['query']);_0x132324[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x553037[_0xf5b5('0x2f')],qs['fields'](_0x539a9a['query'][_0xf5b5('0x36')]));_0x132324[_0xf5b5('0x35')]=_0x132324['attributes'][_0xf5b5('0x37')]?_0x132324[_0xf5b5('0x35')]:_0x553037['model'];_0x132324[_0xf5b5('0x3a')]=qs[_0xf5b5('0x3b')](_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3b')]);_0x132324['where']=qs['filters'](_['pick'](_0x539a9a[_0xf5b5('0x34')],_0x553037[_0xf5b5('0x32')]));if(_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3e')]){_0x132324[_0xf5b5('0x3c')]=_[_0xf5b5('0x3f')](_0x132324['where'],{'$or':_['map'](_0x132324[_0xf5b5('0x35')],function(_0x2dc713){var _0x45847c={};_0x45847c[_0x2dc713]={'$like':'%'+_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3e')]+'%'};return _0x45847c;})});}_0x132324=_[_0xf5b5('0x3f')]({},_0x132324,_0x539a9a[_0xf5b5('0x41')]);return _0x283f65[_0xf5b5('0x5b')](_0x132324);}})[_0xf5b5('0x23')](function(_0x51d367){if(_0x51d367){_0x5e5196=_0x51d367[_0xf5b5('0x37')];if(!_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x38')](_0xf5b5('0x39'))){_0x132324[_0xf5b5('0x1c')]=qs[_0xf5b5('0x1c')](_0x539a9a['query'][_0xf5b5('0x1c')]);_0x132324['offset']=qs[_0xf5b5('0x1a')](_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x1a')]);}return _0x283f65[_0xf5b5('0x5b')](_0x132324);}})[_0xf5b5('0x23')](function(_0x32d2eb){if(_0x32d2eb){return _0x32d2eb?{'count':_0x5e5196,'rows':_0x32d2eb}:null;}})[_0xf5b5('0x23')](respondWithResult(_0x10f017,null))['catch'](handleError(_0x10f017,null));}; \ No newline at end of file +var _0x80c9=['getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','then','Triggers','UserProfileResource','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','show','params','keys','intersection','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','find','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order'];(function(_0xabdaf1,_0x135b10){var _0x313d2b=function(_0x394b64){while(--_0x394b64){_0xabdaf1['push'](_0xabdaf1['shift']());}};_0x313d2b(++_0x135b10);}(_0x80c9,0x166));var _0x980c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80c9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x980c('0x0'));var rimraf=require(_0x980c('0x1'));var zipdir=require(_0x980c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x980c('0x3'));var BPromise=require(_0x980c('0x4'));var Mustache=require(_0x980c('0x5'));var util=require(_0x980c('0x6'));var path=require(_0x980c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x980c('0x8'));var fs=require('fs');var fs_extra=require(_0x980c('0x9'));var _=require(_0x980c('0xa'));var squel=require(_0x980c('0xb'));var crypto=require(_0x980c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x980c('0xd'));var querystring=require('querystring');var Papa=require(_0x980c('0xe'));var Redis=require(_0x980c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x980c('0x10'));var as=require(_0x980c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x980c('0x12'));var utils=require('../../config/utils');var config=require(_0x980c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x980c('0x14'))['db'];function respondWithStatusCode(_0x962ec2,_0x4776e1){_0x4776e1=_0x4776e1||0xcc;return function(_0x8a4a5e){if(_0x8a4a5e){return _0x962ec2[_0x980c('0x15')](_0x4776e1);}return _0x962ec2[_0x980c('0x16')](_0x4776e1)[_0x980c('0x17')]();};}function respondWithResult(_0x46d373,_0x2287e1){_0x2287e1=_0x2287e1||0xc8;return function(_0xc90dc0){if(_0xc90dc0){return _0x46d373[_0x980c('0x16')](_0x2287e1)[_0x980c('0x18')](_0xc90dc0);}};}function respondWithFilteredResult(_0x3399ab,_0x8d9090){return function(_0x188be4){if(_0x188be4){var _0x433cee=typeof _0x8d9090['offset']===_0x980c('0x19')&&typeof _0x8d9090[_0x980c('0x1a')]===_0x980c('0x19');var _0x2d9bee=_0x188be4['count'];var _0x471168=_0x433cee?0x0:_0x8d9090[_0x980c('0x1b')];var _0x514d2b=_0x433cee?_0x188be4[_0x980c('0x1c')]:_0x8d9090['offset']+_0x8d9090[_0x980c('0x1a')];var _0x3e1202;if(_0x514d2b>=_0x2d9bee){_0x514d2b=_0x2d9bee;_0x3e1202=0xc8;}else{_0x3e1202=0xce;}_0x3399ab[_0x980c('0x16')](_0x3e1202);return _0x3399ab[_0x980c('0x1d')]('Content-Range',_0x471168+'-'+_0x514d2b+'/'+_0x2d9bee)[_0x980c('0x18')](_0x188be4);}return null;};}function patchUpdates(_0x3334b4){return function(_0x2672b3){try{jsonpatch['apply'](_0x2672b3,_0x3334b4,!![]);}catch(_0x2ed90f){return BPromise[_0x980c('0x1e')](_0x2ed90f);}return _0x2672b3['save']();};}function saveUpdates(_0x5e06d0,_0x1da308){return function(_0x4072c3){if(_0x4072c3){return _0x4072c3['update'](_0x5e06d0)[_0x980c('0x1f')](function(_0xefe695){return _0xefe695;});}return null;};}function removeEntity(_0x4fd0d4,_0x5d1e48){return function(_0x500f4d){if(_0x500f4d){return _0x500f4d['destroy']()[_0x980c('0x1f')](function(){var _0x47d269=_0x500f4d['get']({'plain':!![]});var _0x3d43ea=_0x980c('0x20');return db[_0x980c('0x21')]['destroy']({'where':{'type':_0x3d43ea,'resourceId':_0x47d269['id']}})[_0x980c('0x1f')](function(){return _0x500f4d;});})['then'](function(){_0x4fd0d4[_0x980c('0x16')](0xcc)[_0x980c('0x17')]();});}};}function handleEntityNotFound(_0xface4e,_0xfd8be8){return function(_0x3a3802){if(!_0x3a3802){_0xface4e['sendStatus'](0x194);}return _0x3a3802;};}function handleError(_0x278c90,_0x54c854){_0x54c854=_0x54c854||0x1f4;return function(_0x546698){logger['error'](_0x546698['stack']);if(_0x546698[_0x980c('0x22')]){delete _0x546698['name'];}_0x278c90[_0x980c('0x16')](_0x54c854)[_0x980c('0x23')](_0x546698);};}exports[_0x980c('0x24')]=function(_0x3f15c3,_0x49cae1){var _0x30d4ee={},_0xbba976={},_0x1fd5a7={'count':0x0,'rows':[]};var _0x365197=_[_0x980c('0x25')](db[_0x980c('0x26')][_0x980c('0x27')],function(_0x446619){return{'name':_0x446619[_0x980c('0x28')],'type':_0x446619['type'][_0x980c('0x29')]};});_0xbba976[_0x980c('0x2a')]=_['map'](_0x365197,_0x980c('0x22'));_0xbba976[_0x980c('0x2b')]=_['keys'](_0x3f15c3[_0x980c('0x2b')]);_0xbba976[_0x980c('0x2c')]=_['intersection'](_0xbba976['model'],_0xbba976[_0x980c('0x2b')]);_0x30d4ee[_0x980c('0x2d')]=_['intersection'](_0xbba976['model'],qs['fields'](_0x3f15c3['query'][_0x980c('0x2e')]));_0x30d4ee[_0x980c('0x2d')]=_0x30d4ee['attributes'][_0x980c('0x2f')]?_0x30d4ee[_0x980c('0x2d')]:_0xbba976['model'];if(!_0x3f15c3[_0x980c('0x2b')][_0x980c('0x30')](_0x980c('0x31'))){_0x30d4ee[_0x980c('0x1a')]=qs[_0x980c('0x1a')](_0x3f15c3[_0x980c('0x2b')][_0x980c('0x1a')]);_0x30d4ee[_0x980c('0x1b')]=qs[_0x980c('0x1b')](_0x3f15c3[_0x980c('0x2b')][_0x980c('0x1b')]);}_0x30d4ee['order']=qs[_0x980c('0x32')](_0x3f15c3[_0x980c('0x2b')][_0x980c('0x32')]);_0x30d4ee['where']=qs[_0x980c('0x2c')](_[_0x980c('0x33')](_0x3f15c3['query'],_0xbba976[_0x980c('0x2c')]),_0x365197);if(_0x3f15c3[_0x980c('0x2b')][_0x980c('0x34')]){_0x30d4ee[_0x980c('0x35')]=_[_0x980c('0x36')](_0x30d4ee['where'],{'$or':_[_0x980c('0x25')](_0x365197,function(_0x2f8fcd){if(_0x2f8fcd[_0x980c('0x37')]!=='VIRTUAL'){var _0x3b6eac={};_0x3b6eac[_0x2f8fcd[_0x980c('0x22')]]={'$like':'%'+_0x3f15c3['query'][_0x980c('0x34')]+'%'};return _0x3b6eac;}})});}_0x30d4ee=_[_0x980c('0x36')]({},_0x30d4ee,_0x3f15c3[_0x980c('0x38')]);var _0x28bc08={'where':_0x30d4ee[_0x980c('0x35')]};return db[_0x980c('0x26')]['count'](_0x28bc08)[_0x980c('0x1f')](function(_0x112aca){_0x1fd5a7[_0x980c('0x1c')]=_0x112aca;if(_0x3f15c3[_0x980c('0x2b')][_0x980c('0x39')]){_0x30d4ee[_0x980c('0x3a')]=[{'all':!![]}];}return db[_0x980c('0x26')]['findAll'](_0x30d4ee);})['then'](function(_0x514ac9){_0x1fd5a7['rows']=_0x514ac9;return _0x1fd5a7;})[_0x980c('0x1f')](respondWithFilteredResult(_0x49cae1,_0x30d4ee))['catch'](handleError(_0x49cae1,null));};exports[_0x980c('0x3b')]=function(_0x2dde1c,_0x283700){var _0x774fca={'raw':![],'where':{'id':_0x2dde1c[_0x980c('0x3c')]['id']}},_0x126b73={};_0x126b73[_0x980c('0x2a')]=_['keys'](db[_0x980c('0x26')]['rawAttributes']);_0x126b73[_0x980c('0x2b')]=_[_0x980c('0x3d')](_0x2dde1c[_0x980c('0x2b')]);_0x126b73['filters']=_['intersection'](_0x126b73['model'],_0x126b73[_0x980c('0x2b')]);_0x774fca[_0x980c('0x2d')]=_[_0x980c('0x3e')](_0x126b73[_0x980c('0x2a')],qs[_0x980c('0x2e')](_0x2dde1c[_0x980c('0x2b')]['fields']));_0x774fca['attributes']=_0x774fca[_0x980c('0x2d')]['length']?_0x774fca['attributes']:_0x126b73[_0x980c('0x2a')];if(_0x2dde1c[_0x980c('0x2b')][_0x980c('0x39')]){_0x774fca[_0x980c('0x3a')]=[{'all':!![]}];}_0x774fca=_['merge']({},_0x774fca,_0x2dde1c[_0x980c('0x38')]);return db[_0x980c('0x26')]['find'](_0x774fca)[_0x980c('0x1f')](handleEntityNotFound(_0x283700,null))[_0x980c('0x1f')](respondWithResult(_0x283700,null))[_0x980c('0x3f')](handleError(_0x283700,null));};exports['create']=function(_0x1351d4,_0x3c2a76){return db[_0x980c('0x26')]['create'](_0x1351d4[_0x980c('0x40')],{})[_0x980c('0x1f')](function(_0xc5c2a4){var _0xfe1cfd=_0x1351d4[_0x980c('0x41')]['get']({'plain':!![]});if(!_0xfe1cfd)throw new Error(_0x980c('0x42'));if(_0xfe1cfd[_0x980c('0x43')]===_0x980c('0x41')){var _0x330ba2=_0xc5c2a4[_0x980c('0x44')]({'plain':!![]});var _0x3e197d='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x3e197d,'userProfileId':_0xfe1cfd[_0x980c('0x45')]},'raw':!![]})[_0x980c('0x1f')](function(_0x458b56){if(_0x458b56&&_0x458b56[_0x980c('0x46')]===0x0){return db[_0x980c('0x21')][_0x980c('0x47')]({'name':_0x330ba2[_0x980c('0x22')],'resourceId':_0x330ba2['id'],'type':_0x458b56[_0x980c('0x22')],'sectionId':_0x458b56['id']},{})[_0x980c('0x1f')](function(){return _0xc5c2a4;});}else{return _0xc5c2a4;}})[_0x980c('0x3f')](function(_0x2ff9f1){logger[_0x980c('0x48')](_0x980c('0x49'),_0x2ff9f1);throw _0x2ff9f1;});}return _0xc5c2a4;})['then'](respondWithResult(_0x3c2a76,0xc9))[_0x980c('0x3f')](handleError(_0x3c2a76,null));};exports[_0x980c('0x4a')]=function(_0x418594,_0x134bae){if(_0x418594['body']['id']){delete _0x418594[_0x980c('0x40')]['id'];}return db[_0x980c('0x26')]['find']({'where':{'id':_0x418594['params']['id']}})['then'](handleEntityNotFound(_0x134bae,null))[_0x980c('0x1f')](saveUpdates(_0x418594[_0x980c('0x40')],null))['then'](respondWithResult(_0x134bae,null))['catch'](handleError(_0x134bae,null));};exports['destroy']=function(_0x23892a,_0x2d41b4){return db[_0x980c('0x26')]['find']({'where':{'id':_0x23892a['params']['id']}})['then'](handleEntityNotFound(_0x2d41b4,null))[_0x980c('0x1f')](removeEntity(_0x2d41b4,null))[_0x980c('0x3f')](handleError(_0x2d41b4,null));};exports[_0x980c('0x4b')]=function(_0x572441,_0x20612c,_0x5dd12a){if(_0x572441[_0x980c('0x40')]['id']){delete _0x572441[_0x980c('0x40')]['id'];}return db['Trigger'][_0x980c('0x4c')]({'where':{'id':_0x572441[_0x980c('0x3c')]['id']}})[_0x980c('0x1f')](handleEntityNotFound(_0x20612c,null))[_0x980c('0x1f')](function(_0x5ef47f){if(_0x5ef47f){_0x572441[_0x980c('0x40')]['TriggerAllId']=_0x5ef47f['id'];return db[_0x980c('0x4d')]['create'](_0x572441[_0x980c('0x40')]);}})[_0x980c('0x1f')](respondWithResult(_0x20612c,null))[_0x980c('0x3f')](handleError(_0x20612c,null));};exports[_0x980c('0x4e')]=function(_0x194b33,_0x4b68cc,_0x5b7415){if(_0x194b33[_0x980c('0x40')]['id']){delete _0x194b33['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x194b33[_0x980c('0x3c')]['id']}})[_0x980c('0x1f')](handleEntityNotFound(_0x4b68cc,null))[_0x980c('0x1f')](function(_0x515aba){if(_0x515aba){_0x194b33[_0x980c('0x40')][_0x980c('0x4f')]=_0x515aba['id'];return db['Condition'][_0x980c('0x47')](_0x194b33[_0x980c('0x40')]);}})['then'](respondWithResult(_0x4b68cc,null))['catch'](handleError(_0x4b68cc,null));};exports[_0x980c('0x50')]=function(_0x463918,_0x5d5316,_0x8c7d95){var _0xb789dc={};var _0x1f6db1={};var _0x328566;var _0x246ba1;return db[_0x980c('0x26')]['findOne']({'where':{'id':_0x463918[_0x980c('0x3c')]['id']}})[_0x980c('0x1f')](handleEntityNotFound(_0x5d5316,null))['then'](function(_0x4d795c){if(_0x4d795c){_0x328566=_0x4d795c;_0x1f6db1[_0x980c('0x2a')]=_['keys'](db[_0x980c('0x4d')][_0x980c('0x27')]);_0x1f6db1[_0x980c('0x2b')]=_[_0x980c('0x3d')](_0x463918[_0x980c('0x2b')]);_0x1f6db1[_0x980c('0x2c')]=_['intersection'](_0x1f6db1[_0x980c('0x2a')],_0x1f6db1[_0x980c('0x2b')]);_0xb789dc[_0x980c('0x2d')]=_['intersection'](_0x1f6db1['model'],qs['fields'](_0x463918['query']['fields']));_0xb789dc[_0x980c('0x2d')]=_0xb789dc[_0x980c('0x2d')][_0x980c('0x2f')]?_0xb789dc['attributes']:_0x1f6db1['model'];_0xb789dc[_0x980c('0x51')]=qs[_0x980c('0x32')](_0x463918['query'][_0x980c('0x32')]);_0xb789dc[_0x980c('0x35')]=qs[_0x980c('0x2c')](_['pick'](_0x463918['query'],_0x1f6db1[_0x980c('0x2c')]));if(_0x463918[_0x980c('0x2b')][_0x980c('0x34')]){_0xb789dc[_0x980c('0x35')]=_[_0x980c('0x36')](_0xb789dc[_0x980c('0x35')],{'$or':_['map'](_0xb789dc['attributes'],function(_0x161065){var _0x29368e={};_0x29368e[_0x161065]={'$like':'%'+_0x463918[_0x980c('0x2b')]['filter']+'%'};return _0x29368e;})});}_0xb789dc=_['merge']({},_0xb789dc,_0x463918[_0x980c('0x38')]);return _0x328566['getAllConditions'](_0xb789dc);}})[_0x980c('0x1f')](function(_0x539b50){if(_0x539b50){_0x246ba1=_0x539b50[_0x980c('0x2f')];if(!_0x463918[_0x980c('0x2b')][_0x980c('0x30')](_0x980c('0x31'))){_0xb789dc[_0x980c('0x1a')]=qs[_0x980c('0x1a')](_0x463918['query'][_0x980c('0x1a')]);_0xb789dc[_0x980c('0x1b')]=qs['offset'](_0x463918[_0x980c('0x2b')][_0x980c('0x1b')]);}return _0x328566[_0x980c('0x50')](_0xb789dc);}})[_0x980c('0x1f')](function(_0x1b4eed){if(_0x1b4eed){return _0x1b4eed?{'count':_0x246ba1,'rows':_0x1b4eed}:null;}})[_0x980c('0x1f')](respondWithResult(_0x5d5316,null))[_0x980c('0x3f')](handleError(_0x5d5316,null));};exports[_0x980c('0x52')]=function(_0x44d959,_0x1c5073,_0x1daa58){var _0x4b3585={};var _0xfe23e4={};var _0x5561bf;var _0x2fbdea;return db[_0x980c('0x26')][_0x980c('0x53')]({'where':{'id':_0x44d959[_0x980c('0x3c')]['id']}})[_0x980c('0x1f')](handleEntityNotFound(_0x1c5073,null))[_0x980c('0x1f')](function(_0xdbabbd){if(_0xdbabbd){_0x5561bf=_0xdbabbd;_0xfe23e4[_0x980c('0x2a')]=_['keys'](db['Condition']['rawAttributes']);_0xfe23e4[_0x980c('0x2b')]=_[_0x980c('0x3d')](_0x44d959[_0x980c('0x2b')]);_0xfe23e4['filters']=_[_0x980c('0x3e')](_0xfe23e4[_0x980c('0x2a')],_0xfe23e4[_0x980c('0x2b')]);_0x4b3585[_0x980c('0x2d')]=_[_0x980c('0x3e')](_0xfe23e4[_0x980c('0x2a')],qs['fields'](_0x44d959['query'][_0x980c('0x2e')]));_0x4b3585[_0x980c('0x2d')]=_0x4b3585[_0x980c('0x2d')]['length']?_0x4b3585['attributes']:_0xfe23e4[_0x980c('0x2a')];_0x4b3585[_0x980c('0x51')]=qs[_0x980c('0x32')](_0x44d959[_0x980c('0x2b')]['sort']);_0x4b3585[_0x980c('0x35')]=qs['filters'](_[_0x980c('0x33')](_0x44d959[_0x980c('0x2b')],_0xfe23e4['filters']));if(_0x44d959[_0x980c('0x2b')][_0x980c('0x34')]){_0x4b3585[_0x980c('0x35')]=_[_0x980c('0x36')](_0x4b3585['where'],{'$or':_['map'](_0x4b3585[_0x980c('0x2d')],function(_0x55624e){var _0x28c9c6={};_0x28c9c6[_0x55624e]={'$like':'%'+_0x44d959['query'][_0x980c('0x34')]+'%'};return _0x28c9c6;})});}_0x4b3585=_[_0x980c('0x36')]({},_0x4b3585,_0x44d959['options']);return _0x5561bf[_0x980c('0x52')](_0x4b3585);}})['then'](function(_0x6e55ed){if(_0x6e55ed){_0x2fbdea=_0x6e55ed['length'];if(!_0x44d959['query'][_0x980c('0x30')](_0x980c('0x31'))){_0x4b3585[_0x980c('0x1a')]=qs[_0x980c('0x1a')](_0x44d959[_0x980c('0x2b')][_0x980c('0x1a')]);_0x4b3585[_0x980c('0x1b')]=qs[_0x980c('0x1b')](_0x44d959[_0x980c('0x2b')][_0x980c('0x1b')]);}return _0x5561bf[_0x980c('0x52')](_0x4b3585);}})[_0x980c('0x1f')](function(_0x4d19e7){if(_0x4d19e7){return _0x4d19e7?{'count':_0x2fbdea,'rows':_0x4d19e7}:null;}})[_0x980c('0x1f')](respondWithResult(_0x1c5073,null))[_0x980c('0x3f')](handleError(_0x1c5073,null));};exports[_0x980c('0x54')]=function(_0x1e2de4,_0x4b46a7,_0x2a33e7){if(_0x1e2de4[_0x980c('0x40')]['id']){delete _0x1e2de4[_0x980c('0x40')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1e2de4[_0x980c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4b46a7,null))[_0x980c('0x1f')](function(_0x4475dd){if(_0x4475dd){_0x1e2de4[_0x980c('0x40')][_0x980c('0x55')]=_0x4475dd['id'];return db[_0x980c('0x56')][_0x980c('0x47')](_0x1e2de4['body']);}})[_0x980c('0x1f')](respondWithResult(_0x4b46a7,null))[_0x980c('0x3f')](handleError(_0x4b46a7,null));};exports[_0x980c('0x57')]=function(_0xc24034,_0x1c8ed8,_0x121b3c){var _0x51c6ef={};var _0x162997={};var _0x5e4130;var _0x5a9486;return db['Trigger']['findOne']({'where':{'id':_0xc24034[_0x980c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1c8ed8,null))[_0x980c('0x1f')](function(_0x10dffa){if(_0x10dffa){_0x5e4130=_0x10dffa;_0x162997['model']=_['keys'](db[_0x980c('0x56')]['rawAttributes']);_0x162997[_0x980c('0x2b')]=_[_0x980c('0x3d')](_0xc24034[_0x980c('0x2b')]);_0x162997['filters']=_[_0x980c('0x3e')](_0x162997['model'],_0x162997[_0x980c('0x2b')]);_0x51c6ef[_0x980c('0x2d')]=_['intersection'](_0x162997[_0x980c('0x2a')],qs[_0x980c('0x2e')](_0xc24034[_0x980c('0x2b')]['fields']));_0x51c6ef['attributes']=_0x51c6ef[_0x980c('0x2d')][_0x980c('0x2f')]?_0x51c6ef['attributes']:_0x162997[_0x980c('0x2a')];_0x51c6ef[_0x980c('0x51')]=qs[_0x980c('0x32')](_0xc24034[_0x980c('0x2b')][_0x980c('0x32')]);_0x51c6ef['where']=qs[_0x980c('0x2c')](_['pick'](_0xc24034['query'],_0x162997[_0x980c('0x2c')]));if(_0xc24034['query'][_0x980c('0x34')]){_0x51c6ef[_0x980c('0x35')]=_[_0x980c('0x36')](_0x51c6ef[_0x980c('0x35')],{'$or':_['map'](_0x51c6ef[_0x980c('0x2d')],function(_0xf658b5){var _0xe105cf={};_0xe105cf[_0xf658b5]={'$like':'%'+_0xc24034[_0x980c('0x2b')][_0x980c('0x34')]+'%'};return _0xe105cf;})});}_0x51c6ef=_['merge']({},_0x51c6ef,_0xc24034[_0x980c('0x38')]);return _0x5e4130['getActions'](_0x51c6ef);}})['then'](function(_0x22b481){if(_0x22b481){_0x5a9486=_0x22b481[_0x980c('0x2f')];if(!_0xc24034[_0x980c('0x2b')][_0x980c('0x30')](_0x980c('0x31'))){_0x51c6ef[_0x980c('0x1a')]=qs[_0x980c('0x1a')](_0xc24034[_0x980c('0x2b')][_0x980c('0x1a')]);_0x51c6ef[_0x980c('0x1b')]=qs[_0x980c('0x1b')](_0xc24034['query']['offset']);}return _0x5e4130[_0x980c('0x57')](_0x51c6ef);}})[_0x980c('0x1f')](function(_0xc847d){if(_0xc847d){return _0xc847d?{'count':_0x5a9486,'rows':_0xc847d}:null;}})[_0x980c('0x1f')](respondWithResult(_0x1c8ed8,null))[_0x980c('0x3f')](handleError(_0x1c8ed8,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0fac93f..0589719 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 _0xb201=['tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','Trigger'];(function(_0x40f57e,_0x27c499){var _0x125348=function(_0x47d832){while(--_0x47d832){_0x40f57e['push'](_0x40f57e['shift']());}};_0x125348(++_0x27c499);}(_0xb201,0x1b1));var _0x1b20=function(_0x394563,_0x1bc4e0){_0x394563=_0x394563-0x0;var _0x82079d=_0xb201[_0x394563];return _0x82079d;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var logger=require(_0x1b20('0x1'))(_0x1b20('0x2'));var moment=require(_0x1b20('0x3'));var BPromise=require(_0x1b20('0x4'));var rp=require(_0x1b20('0x5'));var fs=require('fs');var path=require(_0x1b20('0x6'));var rimraf=require('rimraf');var config=require(_0x1b20('0x7'));var attributes=require(_0x1b20('0x8'));module[_0x1b20('0x9')]=function(_0x4da5a7,_0x29fbc1){return _0x4da5a7['define'](_0x1b20('0xa'),attributes,{'tableName':_0x1b20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x795a=['exports','Trigger','util','../../config/logger','moment','request-promise','path','./trigger.attributes'];(function(_0x5200c4,_0x4d59a6){var _0x36cb24=function(_0x41bf1f){while(--_0x41bf1f){_0x5200c4['push'](_0x5200c4['shift']());}};_0x36cb24(++_0x4d59a6);}(_0x795a,0xa2));var _0xa795=function(_0x10ded3,_0x1d9622){_0x10ded3=_0x10ded3-0x0;var _0x498883=_0x795a[_0x10ded3];return _0x498883;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var logger=require(_0xa795('0x1'))('api');var moment=require(_0xa795('0x2'));var BPromise=require('bluebird');var rp=require(_0xa795('0x3'));var fs=require('fs');var path=require(_0xa795('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa795('0x5'));module[_0xa795('0x6')]=function(_0x26a4f2,_0x2efc9b){return _0x26a4f2['define'](_0xa795('0x7'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 8010096..b690e0d 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 _0x8c23=['attributes','limit','include','model','map','then','ShowTrigger','Trigger','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','findAll','options','raw'];(function(_0x5a8dc7,_0x4fd7ea){var _0x392272=function(_0x13ba47){while(--_0x13ba47){_0x5a8dc7['push'](_0x5a8dc7['shift']());}};_0x392272(++_0x4fd7ea);}(_0x8c23,0x7c));var _0x38c2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8c23[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x38c2('0x0'));var util=require(_0x38c2('0x1'));var moment=require('moment');var BPromise=require(_0x38c2('0x2'));var rs=require(_0x38c2('0x3'));var fs=require('fs');var Redis=require(_0x38c2('0x4'));var db=require(_0x38c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38c2('0x6'))(_0x38c2('0x7'));var config=require(_0x38c2('0x8'));var jayson=require(_0x38c2('0x9'));var client=jayson[_0x38c2('0xa')][_0x38c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42678a,_0x15834d,_0x1a2cb2){return new BPromise(function(_0x3b7644,_0x39c64e){return client[_0x38c2('0xc')](_0x42678a,_0x1a2cb2)['then'](function(_0x462686){logger[_0x38c2('0xd')](_0x38c2('0xe'),_0x15834d,_0x38c2('0xf'));logger[_0x38c2('0x10')](_0x38c2('0x11'),_0x15834d,_0x38c2('0xf'),JSON[_0x38c2('0x12')](_0x462686));if(_0x462686[_0x38c2('0x13')]){if(_0x462686[_0x38c2('0x13')][_0x38c2('0x14')]===0x1f4){logger[_0x38c2('0x13')](_0x38c2('0xe'),_0x15834d,_0x462686[_0x38c2('0x13')]['message']);return _0x39c64e(_0x462686['error']['message']);}logger['error'](_0x38c2('0xe'),_0x15834d,_0x462686[_0x38c2('0x13')][_0x38c2('0x15')]);return _0x3b7644(_0x462686[_0x38c2('0x13')]['message']);}else{logger[_0x38c2('0xd')](_0x38c2('0xe'),_0x15834d,_0x38c2('0xf'));_0x3b7644(_0x462686[_0x38c2('0x16')][_0x38c2('0x15')]);}})[_0x38c2('0x17')](function(_0x2a9bd9){logger[_0x38c2('0x13')]('Trigger,\x20%s,\x20%s',_0x15834d,_0x2a9bd9);_0x39c64e(_0x2a9bd9);});});}exports[_0x38c2('0x18')]=function(_0x5896db){var _0x5b5f3c=this;return new Promise(function(_0x4e515b,_0x3fe32c){return db['Trigger'][_0x38c2('0x19')]({'raw':_0x5896db[_0x38c2('0x1a')]?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5896db['options']?_0x5896db[_0x38c2('0x1a')]['where']||null:null,'attributes':_0x5896db['options']?_0x5896db['options'][_0x38c2('0x1c')]||null:null,'limit':_0x5896db['options']?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1d')]||null:null,'include':_0x5896db[_0x38c2('0x1a')]?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1e')]?_['map'](_0x5896db['options'][_0x38c2('0x1e')],function(_0x1d5247){return{'model':db[_0x1d5247[_0x38c2('0x1f')]],'as':_0x1d5247['as'],'attributes':_0x1d5247['attributes'],'include':_0x1d5247[_0x38c2('0x1e')]?_['map'](_0x1d5247[_0x38c2('0x1e')],function(_0x29fa5f){return{'model':db[_0x29fa5f[_0x38c2('0x1f')]],'as':_0x29fa5f['as'],'attributes':_0x29fa5f[_0x38c2('0x1c')],'include':_0x29fa5f['include']?_[_0x38c2('0x20')](_0x29fa5f[_0x38c2('0x1e')],function(_0x31e874){return{'model':db[_0x31e874[_0x38c2('0x1f')]],'as':_0x31e874['as'],'attributes':_0x31e874[_0x38c2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38c2('0x21')](function(_0x2c4e75){logger[_0x38c2('0xd')](_0x38c2('0x18'),_0x5896db);logger[_0x38c2('0x10')](_0x38c2('0x18'),_0x5896db,JSON[_0x38c2('0x12')](_0x2c4e75));_0x4e515b(_0x2c4e75);})[_0x38c2('0x17')](function(_0x39c46b){logger['error']('GetTrigger',_0x39c46b[_0x38c2('0x15')],_0x5896db);_0x3fe32c(_0x5b5f3c[_0x38c2('0x13')](0x1f4,_0x39c46b[_0x38c2('0x15')]));});});};exports[_0x38c2('0x22')]=function(_0x263741){var _0x260792=this;return new Promise(function(_0xf3ec6a,_0x2217ea){return db[_0x38c2('0x23')][_0x38c2('0x24')]({'raw':_0x263741[_0x38c2('0x1a')]?_0x263741['options'][_0x38c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x25')]||null:null,'attributes':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x1c')]||null:null,'include':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x1e')]?_[_0x38c2('0x20')](_0x263741[_0x38c2('0x1a')][_0x38c2('0x1e')],function(_0x1715fe){return{'model':db[_0x1715fe['model']],'as':_0x1715fe['as'],'attributes':_0x1715fe[_0x38c2('0x1c')],'include':_0x1715fe['include']?_[_0x38c2('0x20')](_0x1715fe[_0x38c2('0x1e')],function(_0x4357cc){return{'model':db[_0x4357cc['model']],'as':_0x4357cc['as'],'attributes':_0x4357cc[_0x38c2('0x1c')],'include':_0x4357cc[_0x38c2('0x1e')]?_[_0x38c2('0x20')](_0x4357cc[_0x38c2('0x1e')],function(_0x201566){return{'model':db[_0x201566[_0x38c2('0x1f')]],'as':_0x201566['as'],'attributes':_0x201566[_0x38c2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xebb007){logger[_0x38c2('0xd')](_0x38c2('0x22'),_0x263741);logger[_0x38c2('0x10')](_0x38c2('0x22'),_0x263741,JSON[_0x38c2('0x12')](_0xebb007));_0xf3ec6a(_0xebb007);})[_0x38c2('0x17')](function(_0x2672c1){logger[_0x38c2('0x13')](_0x38c2('0x22'),_0x2672c1[_0x38c2('0x15')],_0x263741);_0x2217ea(_0x260792[_0x38c2('0x13')](0x1f4,_0x2672c1['message']));});});}; \ No newline at end of file +var _0x6a5a=['Trigger','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','attributes','limit','model','include','map','GetTrigger','ShowTrigger'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6a5a,0x8f));var _0xa6a5=function(_0x4475cb,_0x187d69){_0x4475cb=_0x4475cb-0x0;var _0x1b156c=_0x6a5a[_0x4475cb];return _0x1b156c;};'use strict';var _=require(_0xa6a5('0x0'));var util=require(_0xa6a5('0x1'));var moment=require(_0xa6a5('0x2'));var BPromise=require(_0xa6a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a5('0x4'));var db=require(_0xa6a5('0x5'))['db'];var utils=require(_0xa6a5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa6a5('0x7'));var client=jayson[_0xa6a5('0x8')][_0xa6a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c5b65,_0x557f4b,_0x2acc6b){return new BPromise(function(_0x33723b,_0x46c4b2){return client[_0xa6a5('0xa')](_0x2c5b65,_0x2acc6b)['then'](function(_0x590233){logger['info']('Trigger,\x20%s,\x20%s',_0x557f4b,_0xa6a5('0xb'));logger[_0xa6a5('0xc')](_0xa6a5('0xd'),_0x557f4b,_0xa6a5('0xb'),JSON[_0xa6a5('0xe')](_0x590233));if(_0x590233[_0xa6a5('0xf')]){if(_0x590233['error'][_0xa6a5('0x10')]===0x1f4){logger[_0xa6a5('0xf')]('Trigger,\x20%s,\x20%s',_0x557f4b,_0x590233[_0xa6a5('0xf')]['message']);return _0x46c4b2(_0x590233[_0xa6a5('0xf')]['message']);}logger[_0xa6a5('0xf')](_0xa6a5('0x11'),_0x557f4b,_0x590233['error'][_0xa6a5('0x12')]);return _0x33723b(_0x590233['error'][_0xa6a5('0x12')]);}else{logger[_0xa6a5('0x13')](_0xa6a5('0x11'),_0x557f4b,_0xa6a5('0xb'));_0x33723b(_0x590233[_0xa6a5('0x14')][_0xa6a5('0x12')]);}})[_0xa6a5('0x15')](function(_0x231949){logger[_0xa6a5('0xf')]('Trigger,\x20%s,\x20%s',_0x557f4b,_0x231949);_0x46c4b2(_0x231949);});});}exports['GetTrigger']=function(_0x5c4838){var _0x2f801f=this;return new Promise(function(_0x487ee6,_0x4b3781){return db['Trigger'][_0xa6a5('0x16')]({'raw':_0x5c4838[_0xa6a5('0x17')]?_0x5c4838[_0xa6a5('0x17')][_0xa6a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5c4838[_0xa6a5('0x17')]?_0x5c4838['options']['where']||null:null,'attributes':_0x5c4838['options']?_0x5c4838[_0xa6a5('0x17')][_0xa6a5('0x19')]||null:null,'limit':_0x5c4838[_0xa6a5('0x17')]?_0x5c4838[_0xa6a5('0x17')][_0xa6a5('0x1a')]||null:null,'include':_0x5c4838[_0xa6a5('0x17')]?_0x5c4838[_0xa6a5('0x17')]['include']?_['map'](_0x5c4838[_0xa6a5('0x17')]['include'],function(_0x36c8d7){return{'model':db[_0x36c8d7[_0xa6a5('0x1b')]],'as':_0x36c8d7['as'],'attributes':_0x36c8d7[_0xa6a5('0x19')],'include':_0x36c8d7[_0xa6a5('0x1c')]?_[_0xa6a5('0x1d')](_0x36c8d7[_0xa6a5('0x1c')],function(_0x49fda1){return{'model':db[_0x49fda1[_0xa6a5('0x1b')]],'as':_0x49fda1['as'],'attributes':_0x49fda1[_0xa6a5('0x19')],'include':_0x49fda1[_0xa6a5('0x1c')]?_[_0xa6a5('0x1d')](_0x49fda1[_0xa6a5('0x1c')],function(_0x1c41d9){return{'model':db[_0x1c41d9[_0xa6a5('0x1b')]],'as':_0x1c41d9['as'],'attributes':_0x1c41d9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x416f26){logger[_0xa6a5('0x13')](_0xa6a5('0x1e'),_0x5c4838);logger[_0xa6a5('0xc')](_0xa6a5('0x1e'),_0x5c4838,JSON[_0xa6a5('0xe')](_0x416f26));_0x487ee6(_0x416f26);})[_0xa6a5('0x15')](function(_0xac0995){logger[_0xa6a5('0xf')](_0xa6a5('0x1e'),_0xac0995[_0xa6a5('0x12')],_0x5c4838);_0x4b3781(_0x2f801f[_0xa6a5('0xf')](0x1f4,_0xac0995[_0xa6a5('0x12')]));});});};exports[_0xa6a5('0x1f')]=function(_0x2469a5){var _0x450fc5=this;return new Promise(function(_0xb46d02,_0x4e7855){return db[_0xa6a5('0x20')][_0xa6a5('0x21')]({'raw':_0x2469a5[_0xa6a5('0x17')]?_0x2469a5[_0xa6a5('0x17')][_0xa6a5('0x18')]===undefined?!![]:![]:!![],'where':_0x2469a5[_0xa6a5('0x17')]?_0x2469a5['options']['where']||null:null,'attributes':_0x2469a5['options']?_0x2469a5[_0xa6a5('0x17')][_0xa6a5('0x19')]||null:null,'include':_0x2469a5['options']?_0x2469a5[_0xa6a5('0x17')]['include']?_[_0xa6a5('0x1d')](_0x2469a5[_0xa6a5('0x17')][_0xa6a5('0x1c')],function(_0x197880){return{'model':db[_0x197880[_0xa6a5('0x1b')]],'as':_0x197880['as'],'attributes':_0x197880[_0xa6a5('0x19')],'include':_0x197880[_0xa6a5('0x1c')]?_['map'](_0x197880[_0xa6a5('0x1c')],function(_0x279952){return{'model':db[_0x279952[_0xa6a5('0x1b')]],'as':_0x279952['as'],'attributes':_0x279952[_0xa6a5('0x19')],'include':_0x279952[_0xa6a5('0x1c')]?_[_0xa6a5('0x1d')](_0x279952['include'],function(_0x28d2f5){return{'model':db[_0x28d2f5['model']],'as':_0x28d2f5['as'],'attributes':_0x28d2f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa6a5('0x22')](function(_0x76a6){logger[_0xa6a5('0x13')]('ShowTrigger',_0x2469a5);logger[_0xa6a5('0xc')](_0xa6a5('0x1f'),_0x2469a5,JSON['stringify'](_0x76a6));_0xb46d02(_0x76a6);})['catch'](function(_0x1ac023){logger['error']('ShowTrigger',_0x1ac023[_0xa6a5('0x12')],_0x2469a5);_0x4e7855(_0x450fc5[_0xa6a5('0xf')](0x1f4,_0x1ac023[_0xa6a5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d590dc5..b0465dd 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 _0x10c0=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','util','connect-timeout','Router'];(function(_0x5f4a84,_0x33d504){var _0x2060fd=function(_0x495cbb){while(--_0x495cbb){_0x5f4a84['push'](_0x5f4a84['shift']());}};_0x2060fd(++_0x33d504);}(_0x10c0,0x14d));var _0x010c=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0x10c0[_0x6287b6];return _0x5d6be4;};'use strict';var multer=require('multer');var util=require(_0x010c('0x0'));var path=require('path');var timeout=require(_0x010c('0x1'));var express=require('express');var router=express[_0x010c('0x2')]();var fs_extra=require(_0x010c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x010c('0x4'));var config=require(_0x010c('0x5'));var controller=require(_0x010c('0x6'));router[_0x010c('0x7')]('/',auth[_0x010c('0x8')](),controller[_0x010c('0x9')]);router[_0x010c('0x7')]('/:id',auth[_0x010c('0x8')](),controller[_0x010c('0xa')]);router[_0x010c('0xb')]('/:id/clone',auth[_0x010c('0x8')](),controller['clone']);router[_0x010c('0xb')]('/',auth[_0x010c('0x8')](),controller['create']);router[_0x010c('0xc')](_0x010c('0xd'),auth[_0x010c('0x8')](),controller[_0x010c('0xe')]);router[_0x010c('0xf')](_0x010c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ac0=['../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xc8d900,_0x97858d){var _0xb27118=function(_0x37c95a){while(--_0x37c95a){_0xc8d900['push'](_0xc8d900['shift']());}};_0xb27118(++_0x97858d);}(_0x6ac0,0xe9));var _0x06ac=function(_0x1f3859,_0x50700f){_0x1f3859=_0x1f3859-0x0;var _0x17791b=_0x6ac0[_0x1f3859];return _0x17791b;};'use strict';var multer=require('multer');var util=require(_0x06ac('0x0'));var path=require(_0x06ac('0x1'));var timeout=require(_0x06ac('0x2'));var express=require(_0x06ac('0x3'));var router=express[_0x06ac('0x4')]();var fs_extra=require(_0x06ac('0x5'));var auth=require(_0x06ac('0x6'));var interaction=require(_0x06ac('0x7'));var config=require(_0x06ac('0x8'));var controller=require(_0x06ac('0x9'));router[_0x06ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x06ac('0xb')]);router[_0x06ac('0xa')](_0x06ac('0xc'),auth[_0x06ac('0xd')](),controller[_0x06ac('0xe')]);router[_0x06ac('0xf')](_0x06ac('0x10'),auth['isAuthenticated'](),controller[_0x06ac('0x11')]);router[_0x06ac('0xf')]('/',auth[_0x06ac('0xd')](),controller[_0x06ac('0x12')]);router[_0x06ac('0x13')](_0x06ac('0xc'),auth[_0x06ac('0xd')](),controller[_0x06ac('0x14')]);router[_0x06ac('0x15')](_0x06ac('0xc'),auth[_0x06ac('0xd')](),controller[_0x06ac('0x16')]);module[_0x06ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 05c4143..e6e5b16 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 _0x3d5d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','refuse','originate','uas','pai','fingerprint','certificate','actpass','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue'];(function(_0x1ab9f4,_0x14f8cc){var _0x573210=function(_0x4fbd68){while(--_0x4fbd68){_0x1ab9f4['push'](_0x1ab9f4['shift']());}};_0x573210(++_0x14f8cc);}(_0x3d5d,0x104));var _0xd3d5=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x3d5d[_0x5de532];return _0x4e9192;};'use strict';var Sequelize=require(_0xd3d5('0x0'));module[_0xd3d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x3'),_0xd3d5('0x4'),'peer'),'allowNull':![],'defaultValue':_0xd3d5('0x3')},'context':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':![],'defaultValue':_0xd3d5('0x6')},'callingpres':{'type':Sequelize[_0xd3d5('0x2')]('ALLOWED_NOT_SCREENED',_0xd3d5('0x7'),'ALLOWED_FAILED_SCREEN',_0xd3d5('0x8'),_0xd3d5('0x9'),_0xd3d5('0xa'),_0xd3d5('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xd3d5('0x5')]},'permit':{'type':Sequelize[_0xd3d5('0x5')]},'secret':{'type':Sequelize[_0xd3d5('0x5')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd3d5('0x5')]},'transport':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'udp','set':function(_0x3c8604){this[_0xd3d5('0xc')](_0xd3d5('0xd'),_0x3c8604?_0x3c8604[_0xd3d5('0xe')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd3d5('0xf')](_0xd3d5('0xd'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x11')},'dtmfmode':{'type':Sequelize[_0xd3d5('0x2')]('rfc2833',_0xd3d5('0x12'),_0xd3d5('0x13'),_0xd3d5('0x14'),'auto'),'defaultValue':_0xd3d5('0x15')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xd3d5('0x16'),'update',_0xd3d5('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd3d5('0x5')]},'nat':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x19'),'set':function(_0x6c76cb){this[_0xd3d5('0xc')](_0xd3d5('0x1a'),_0x6c76cb?_0x6c76cb[_0xd3d5('0xe')](','):null);},'get':function(){return this[_0xd3d5('0xf')]('nat')?this[_0xd3d5('0xf')](_0xd3d5('0x1a'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x1b')},'callgroup':{'type':Sequelize[_0xd3d5('0x5')]},'namedcallgroup':{'type':Sequelize[_0xd3d5('0x5')]},'pickupgroup':{'type':Sequelize[_0xd3d5('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xd3d5('0x1c')},'allow':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x451934){this['setDataValue'](_0xd3d5('0x1d'),_0x451934?_0x451934[_0xd3d5('0xe')](';'):_0xd3d5('0x1e'));},'get':function(){return this[_0xd3d5('0xf')](_0xd3d5('0x1d'))?this['getDataValue'](_0xd3d5('0x1d'))['split'](';'):null;},'comment':_0xd3d5('0x1f')},'autoframing':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x20'),'set':function(_0x18db9b){this[_0xd3d5('0xc')](_0xd3d5('0x21'),_0x18db9b?_0x18db9b[_0xd3d5('0xe')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd3d5('0xf')](_0xd3d5('0x21'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x22')},'trustrpid':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd3d5('0x5')]},'videosupport':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd3d5('0x2')]('accept',_0xd3d5('0x25'),_0xd3d5('0x26'))},'session_expires':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xd3d5('0x27')),'defaultValue':_0xd3d5('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xd3d5('0x5')]},'regexten':{'type':Sequelize[_0xd3d5('0x5')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xd3d5('0x5')]},'port':{'type':Sequelize[_0xd3d5('0x23')](0x5)},'qualify':{'type':Sequelize[_0xd3d5('0x2')]('yes','no'),'defaultValue':_0xd3d5('0x18')},'keepalive':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd3d5('0x5')]},'defaultuser':{'type':Sequelize[_0xd3d5('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3d5('0x5')]},'callbackextension':{'type':Sequelize[_0xd3d5('0x5')]},'timert1':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'timerb':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xd3d5('0x5')]},'contactdeny':{'type':Sequelize[_0xd3d5('0x5')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd3d5('0x5')]},'use_q850_reason':{'type':Sequelize[_0xd3d5('0x5')]},'maxforwards':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'encryption':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x29'),_0xd3d5('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xd3d5('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscipher':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscafile':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscapath':{'type':Sequelize[_0xd3d5('0x5')]},'dtlssetup':{'type':Sequelize[_0xd3d5('0x2')]('active','passive',_0xd3d5('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd3d5('0x5')]},'recordofffeature':{'type':Sequelize[_0xd3d5('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'vmexten':{'type':Sequelize[_0xd3d5('0x5')]},'mohinterpret':{'type':Sequelize[_0xd3d5('0x5')]},'mohsuggest':{'type':Sequelize[_0xd3d5('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3d5('0x5')]},'host':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x2c')},'canreinvite':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd3d5('0x5')]},'active':{'type':Sequelize[_0xd3d5('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc34b=['update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','\x22\x22\x20<>','INTEGER','always','accept','uas','pai','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','rfc2833','shortinfo','auto','nonat'];(function(_0x270fe1,_0x5c5dc4){var _0x495dd1=function(_0xf8273e){while(--_0xf8273e){_0x270fe1['push'](_0x270fe1['shift']());}};_0x495dd1(++_0x5c5dc4);}(_0xc34b,0x1e6));var _0xbc34=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc34b[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xbc34('0x0'));module[_0xbc34('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbc34('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x4'),_0xbc34('0x5'),_0xbc34('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xbc34('0x7')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x8'),_0xbc34('0x9'),_0xbc34('0xa'),_0xbc34('0xb'),_0xbc34('0xc'),'PROHIB_PASSED_SCREEN',_0xbc34('0xd'),_0xbc34('0xe'))},'deny':{'type':Sequelize[_0xbc34('0x7')]},'permit':{'type':Sequelize[_0xbc34('0x7')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xbc34('0x7')]},'transport':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0xf'),'set':function(_0x316fe6){this[_0xbc34('0x10')]('transport',_0x316fe6?_0x316fe6[_0xbc34('0x11')](','):null);},'get':function(){return this[_0xbc34('0x12')](_0xbc34('0x13'))?this[_0xbc34('0x12')](_0xbc34('0x13'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x14'),'info',_0xbc34('0x15'),'inband',_0xbc34('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xbc34('0x3')]('yes','no',_0xbc34('0x17'),_0xbc34('0x18'),_0xbc34('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xbc34('0x7')]},'nat':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0x1a'),'set':function(_0xc8f303){this[_0xbc34('0x10')]('nat',_0xc8f303?_0xc8f303['join'](','):null);},'get':function(){return this[_0xbc34('0x12')](_0xbc34('0x1b'))?this['getDataValue'](_0xbc34('0x1b'))[_0xbc34('0x1c')](','):null;},'comment':_0xbc34('0x1d')},'callgroup':{'type':Sequelize[_0xbc34('0x7')]},'namedcallgroup':{'type':Sequelize[_0xbc34('0x7')]},'pickupgroup':{'type':Sequelize[_0xbc34('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xbc34('0x7')]},'language':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbc34('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0x1e')},'allow':{'type':Sequelize[_0xbc34('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5e2cdd){this[_0xbc34('0x10')]('allow',_0x5e2cdd?_0x5e2cdd[_0xbc34('0x11')](';'):_0xbc34('0x1f'));},'get':function(){return this['getDataValue'](_0xbc34('0x20'))?this['getDataValue'](_0xbc34('0x20'))[_0xbc34('0x1c')](';'):null;},'comment':_0xbc34('0x21')},'autoframing':{'type':Sequelize[_0xbc34('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0x22'),'set':function(_0x27bb5d){this[_0xbc34('0x10')](_0xbc34('0x23'),_0x27bb5d?_0x27bb5d[_0xbc34('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xbc34('0x23'))?this[_0xbc34('0x12')]('insecure')['split'](','):null;},'comment':_0xbc34('0x24')},'trustrpid':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbc34('0x3')]('yes','no',_0xbc34('0x26'))},'promiscredir':{'type':Sequelize[_0xbc34('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xbc34('0x7')]},'callerid':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no'),'defaultValue':_0xbc34('0x25')},'busylevel':{'type':Sequelize[_0xbc34('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'subscribecontext':{'type':Sequelize[_0xbc34('0x7')]},'template':{'type':Sequelize[_0xbc34('0x7')]},'videosupport':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no',_0xbc34('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'mailbox':{'type':Sequelize[_0xbc34('0x7')]},'session_timers':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x2a'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xbc34('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xbc34('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xbc34('0x3')]('uac',_0xbc34('0x2b')),'defaultValue':_0xbc34('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xbc34('0x7')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xbc34('0x7')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xbc34('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xbc34('0x7')]},'defaultuser':{'type':Sequelize[_0xbc34('0x7')]},'rtptimeout':{'type':Sequelize[_0xbc34('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbc34('0x28')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no',_0xbc34('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbc34('0x7')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xbc34('0x28')](0xb)},'timerb':{'type':Sequelize[_0xbc34('0x28')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xbc34('0x7')]},'contactdeny':{'type':Sequelize[_0xbc34('0x7')]},'contactacl':{'type':Sequelize[_0xbc34('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0xbc34('0x7')]},'use_q850_reason':{'type':Sequelize[_0xbc34('0x7')]},'maxforwards':{'type':Sequelize[_0xbc34('0x28')](0xb)},'encryption':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'force_avp':{'type':Sequelize[_0xbc34('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'dtlsenable':{'type':Sequelize[_0xbc34('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xbc34('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xbc34('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbc34('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x2e'),'passive',_0xbc34('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbc34('0x7')]},'usereqphone':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbc34('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xbc34('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'subscribemwi':{'type':Sequelize[_0xbc34('0x3')](_0xbc34('0x25'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xbc34('0x7')]},'parkinglot':{'type':Sequelize[_0xbc34('0x7')]},'description':{'type':Sequelize[_0xbc34('0x7')]},'host':{'type':Sequelize[_0xbc34('0x7')],'defaultValue':_0xbc34('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xbc34('0x25'),'no','nonat',_0xbc34('0x18'),_0xbc34('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbc34('0x7')]},'otherFields':{'type':Sequelize[_0xbc34('0x7')]},'active':{'type':Sequelize[_0xbc34('0x32')],'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 b7e36f4..b73c5e3 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 _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x451655,_0x1be29f){var _0x2bdf91=function(_0x593d70){while(--_0x593d70){_0x451655['push'](_0x451655['shift']());}};_0x2bdf91(++_0x1be29f);}(_0x34e8,0x12c));var _0x834e=function(_0x4bded1,_0x1a5c47){_0x4bded1=_0x4bded1-0x0;var _0x38c485=_0x34e8[_0x4bded1];return _0x38c485;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file +var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x4bebaf,_0x1aaf6b){var _0x37a7a3=function(_0x59ef4f){while(--_0x59ef4f){_0x4bebaf['push'](_0x4bebaf['shift']());}};_0x37a7a3(++_0x1aaf6b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x9d76d2,_0x1297f5){_0x9d76d2=_0x9d76d2-0x0;var _0x76f5a8=_0x6f0d[_0x9d76d2];return _0x76f5a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1d75ee1..3b69926 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 _0x77a7=['path','rimraf','../../config/environment','exports','define','../../config/logger','api','moment','bluebird'];(function(_0x251306,_0x59a53e){var _0x386459=function(_0x4d20d7){while(--_0x4d20d7){_0x251306['push'](_0x251306['shift']());}};_0x386459(++_0x59a53e);}(_0x77a7,0xef));var _0x777a=function(_0x8f9dd1,_0x45f985){_0x8f9dd1=_0x8f9dd1-0x0;var _0x16886c=_0x77a7[_0x8f9dd1];return _0x16886c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x777a('0x0'))(_0x777a('0x1'));var moment=require(_0x777a('0x2'));var BPromise=require(_0x777a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x777a('0x4'));var rimraf=require(_0x777a('0x5'));var config=require(_0x777a('0x6'));var attributes=require('./trunk.attributes');module[_0x777a('0x7')]=function(_0x684c08,_0xf861d8){return _0x684c08[_0x777a('0x8')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2325=['../../config/environment','./trunk.attributes','define','tools_trunks','lodash','util','../../config/logger','moment','request-promise'];(function(_0x155fca,_0xbad4f2){var _0x2320da=function(_0x109818){while(--_0x109818){_0x155fca['push'](_0x155fca['shift']());}};_0x2320da(++_0xbad4f2);}(_0x2325,0xc1));var _0x5232=function(_0x5b88c0,_0x162226){_0x5b88c0=_0x5b88c0-0x0;var _0x4d127c=_0x2325[_0x5b88c0];return _0x4d127c;};'use strict';var _=require(_0x5232('0x0'));var util=require(_0x5232('0x1'));var logger=require(_0x5232('0x2'))('api');var moment=require(_0x5232('0x3'));var BPromise=require('bluebird');var rp=require(_0x5232('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5232('0x5'));var attributes=require(_0x5232('0x6'));module['exports']=function(_0x5cbec6,_0x204ee2){return _0x5cbec6[_0x5232('0x7')]('Trunk',attributes,{'tableName':_0x5232('0x8'),'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 6d3c2a3..f55adbe 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 _0x7ffa=['ShowTrunk','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','then'];(function(_0x5b91a6,_0x43f793){var _0x4b648b=function(_0x51d150){while(--_0x51d150){_0x5b91a6['push'](_0x5b91a6['shift']());}};_0x4b648b(++_0x43f793);}(_0x7ffa,0x1d0));var _0xa7ff=function(_0x11d462,_0x47de06){_0x11d462=_0x11d462-0x0;var _0xb40de4=_0x7ffa[_0x11d462];return _0xb40de4;};'use strict';var _=require(_0xa7ff('0x0'));var util=require(_0xa7ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7ff('0x2'));var fs=require('fs');var Redis=require(_0xa7ff('0x3'));var db=require(_0xa7ff('0x4'))['db'];var utils=require(_0xa7ff('0x5'));var logger=require(_0xa7ff('0x6'))('rpc');var config=require(_0xa7ff('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa7ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34383d,_0x4fdf3b,_0x191831){return new BPromise(function(_0x3f03b5,_0x3f10ed){return client[_0xa7ff('0x9')](_0x34383d,_0x191831)['then'](function(_0x518268){logger[_0xa7ff('0xa')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,'request\x20sent');logger[_0xa7ff('0xb')](_0xa7ff('0xc'),_0x4fdf3b,_0xa7ff('0xd'),JSON['stringify'](_0x518268));if(_0x518268['error']){if(_0x518268['error'][_0xa7ff('0xe')]===0x1f4){logger[_0xa7ff('0xf')](_0xa7ff('0x10'),_0x4fdf3b,_0x518268['error'][_0xa7ff('0x11')]);return _0x3f10ed(_0x518268[_0xa7ff('0xf')]['message']);}logger['error'](_0xa7ff('0x10'),_0x4fdf3b,_0x518268['error'][_0xa7ff('0x11')]);return _0x3f03b5(_0x518268[_0xa7ff('0xf')]['message']);}else{logger[_0xa7ff('0xa')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,_0xa7ff('0xd'));_0x3f03b5(_0x518268[_0xa7ff('0x12')]['message']);}})[_0xa7ff('0x13')](function(_0x19035d){logger[_0xa7ff('0xf')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,_0x19035d);_0x3f10ed(_0x19035d);});});}exports[_0xa7ff('0x14')]=function(_0x331d81){var _0x63a49d=this;return new Promise(function(_0x5140be,_0x1efde5){return db[_0xa7ff('0x15')]['findAll']({'raw':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x17')]===undefined?!![]:![]:!![],'where':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x18')]||null:null,'attributes':_0x331d81['options']?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x19')]||null:null,'limit':_0x331d81['options']?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x1a')]||null:null,'include':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x1b')]?_['map'](_0x331d81['options'][_0xa7ff('0x1b')],function(_0x4e8321){return{'model':db[_0x4e8321[_0xa7ff('0x1c')]],'as':_0x4e8321['as'],'attributes':_0x4e8321[_0xa7ff('0x19')],'include':_0x4e8321[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x4e8321[_0xa7ff('0x1b')],function(_0x2a42fd){return{'model':db[_0x2a42fd['model']],'as':_0x2a42fd['as'],'attributes':_0x2a42fd[_0xa7ff('0x19')],'include':_0x2a42fd[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x2a42fd[_0xa7ff('0x1b')],function(_0x5b910a){return{'model':db[_0x5b910a[_0xa7ff('0x1c')]],'as':_0x5b910a['as'],'attributes':_0x5b910a[_0xa7ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7ff('0x1e')](function(_0x10cea0){logger[_0xa7ff('0xa')](_0xa7ff('0x14'),_0x331d81);logger['debug'](_0xa7ff('0x14'),_0x331d81,JSON['stringify'](_0x10cea0));_0x5140be(_0x10cea0);})[_0xa7ff('0x13')](function(_0x3f5710){logger['error'](_0xa7ff('0x14'),_0x3f5710['message'],_0x331d81);_0x1efde5(_0x63a49d[_0xa7ff('0xf')](0x1f4,_0x3f5710[_0xa7ff('0x11')]));});});};exports[_0xa7ff('0x1f')]=function(_0x34499f){var _0x18b96b=this;return new Promise(function(_0x228fee,_0x2415d1){return db[_0xa7ff('0x15')][_0xa7ff('0x20')]({'raw':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')][_0xa7ff('0x17')]===undefined?!![]:![]:!![],'where':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')]['where']||null:null,'attributes':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')][_0xa7ff('0x19')]||null:null,'include':_0x34499f[_0xa7ff('0x16')]?_0x34499f['options'][_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x34499f[_0xa7ff('0x16')]['include'],function(_0x31075d){return{'model':db[_0x31075d[_0xa7ff('0x1c')]],'as':_0x31075d['as'],'attributes':_0x31075d[_0xa7ff('0x19')],'include':_0x31075d['include']?_[_0xa7ff('0x1d')](_0x31075d[_0xa7ff('0x1b')],function(_0x370a8c){return{'model':db[_0x370a8c[_0xa7ff('0x1c')]],'as':_0x370a8c['as'],'attributes':_0x370a8c[_0xa7ff('0x19')],'include':_0x370a8c[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x370a8c[_0xa7ff('0x1b')],function(_0x383b40){return{'model':db[_0x383b40['model']],'as':_0x383b40['as'],'attributes':_0x383b40[_0xa7ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7ff('0x1e')](function(_0x210dca){logger[_0xa7ff('0xa')]('ShowTrunk',_0x34499f);logger['debug'](_0xa7ff('0x1f'),_0x34499f,JSON['stringify'](_0x210dca));_0x228fee(_0x210dca);})[_0xa7ff('0x13')](function(_0x3dcc36){logger[_0xa7ff('0xf')](_0xa7ff('0x1f'),_0x3dcc36[_0xa7ff('0x11')],_0x34499f);_0x2415d1(_0x18b96b[_0xa7ff('0xf')](0x1f4,_0x3dcc36[_0xa7ff('0x11')]));});});}; \ No newline at end of file +var _0xf909=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','then','ShowTrunk','find','where','lodash','util'];(function(_0xce7328,_0x298b60){var _0x3da846=function(_0x1b79e8){while(--_0x1b79e8){_0xce7328['push'](_0xce7328['shift']());}};_0x3da846(++_0x298b60);}(_0xf909,0x11e));var _0x9f90=function(_0x4c92e5,_0x57b104){_0x4c92e5=_0x4c92e5-0x0;var _0x1705e0=_0xf909[_0x4c92e5];return _0x1705e0;};'use strict';var _=require(_0x9f90('0x0'));var util=require(_0x9f90('0x1'));var moment=require(_0x9f90('0x2'));var BPromise=require(_0x9f90('0x3'));var rs=require(_0x9f90('0x4'));var fs=require('fs');var Redis=require(_0x9f90('0x5'));var db=require(_0x9f90('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f90('0x7'))(_0x9f90('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f90('0x9'));var client=jayson[_0x9f90('0xa')][_0x9f90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1046bf,_0x55aeb2,_0x2a2f8d){return new BPromise(function(_0x63b5fd,_0x1d3785){return client[_0x9f90('0xc')](_0x1046bf,_0x2a2f8d)['then'](function(_0xdf6328){logger['info'](_0x9f90('0xd'),_0x55aeb2,_0x9f90('0xe'));logger[_0x9f90('0xf')](_0x9f90('0x10'),_0x55aeb2,_0x9f90('0xe'),JSON[_0x9f90('0x11')](_0xdf6328));if(_0xdf6328[_0x9f90('0x12')]){if(_0xdf6328[_0x9f90('0x12')][_0x9f90('0x13')]===0x1f4){logger[_0x9f90('0x12')](_0x9f90('0xd'),_0x55aeb2,_0xdf6328[_0x9f90('0x12')]['message']);return _0x1d3785(_0xdf6328[_0x9f90('0x12')][_0x9f90('0x14')]);}logger['error'](_0x9f90('0xd'),_0x55aeb2,_0xdf6328[_0x9f90('0x12')][_0x9f90('0x14')]);return _0x63b5fd(_0xdf6328[_0x9f90('0x12')]['message']);}else{logger[_0x9f90('0x15')](_0x9f90('0xd'),_0x55aeb2,_0x9f90('0xe'));_0x63b5fd(_0xdf6328[_0x9f90('0x16')]['message']);}})['catch'](function(_0x9f891a){logger['error'](_0x9f90('0xd'),_0x55aeb2,_0x9f891a);_0x1d3785(_0x9f891a);});});}exports[_0x9f90('0x17')]=function(_0x33b144){var _0x1dbaa4=this;return new Promise(function(_0x2b4f6c,_0x379366){return db[_0x9f90('0x18')]['findAll']({'raw':_0x33b144['options']?_0x33b144[_0x9f90('0x19')][_0x9f90('0x1a')]===undefined?!![]:![]:!![],'where':_0x33b144[_0x9f90('0x19')]?_0x33b144[_0x9f90('0x19')]['where']||null:null,'attributes':_0x33b144[_0x9f90('0x19')]?_0x33b144['options'][_0x9f90('0x1b')]||null:null,'limit':_0x33b144[_0x9f90('0x19')]?_0x33b144[_0x9f90('0x19')][_0x9f90('0x1c')]||null:null,'include':_0x33b144[_0x9f90('0x19')]?_0x33b144[_0x9f90('0x19')][_0x9f90('0x1d')]?_[_0x9f90('0x1e')](_0x33b144['options'][_0x9f90('0x1d')],function(_0x5888d9){return{'model':db[_0x5888d9[_0x9f90('0x1f')]],'as':_0x5888d9['as'],'attributes':_0x5888d9[_0x9f90('0x1b')],'include':_0x5888d9[_0x9f90('0x1d')]?_[_0x9f90('0x1e')](_0x5888d9[_0x9f90('0x1d')],function(_0x6bc295){return{'model':db[_0x6bc295[_0x9f90('0x1f')]],'as':_0x6bc295['as'],'attributes':_0x6bc295[_0x9f90('0x1b')],'include':_0x6bc295[_0x9f90('0x1d')]?_[_0x9f90('0x1e')](_0x6bc295[_0x9f90('0x1d')],function(_0x37902d){return{'model':db[_0x37902d[_0x9f90('0x1f')]],'as':_0x37902d['as'],'attributes':_0x37902d[_0x9f90('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9f90('0x20')](function(_0x1be7c9){logger[_0x9f90('0x15')](_0x9f90('0x17'),_0x33b144);logger[_0x9f90('0xf')](_0x9f90('0x17'),_0x33b144,JSON[_0x9f90('0x11')](_0x1be7c9));_0x2b4f6c(_0x1be7c9);})['catch'](function(_0x1961e9){logger['error'](_0x9f90('0x17'),_0x1961e9[_0x9f90('0x14')],_0x33b144);_0x379366(_0x1dbaa4[_0x9f90('0x12')](0x1f4,_0x1961e9[_0x9f90('0x14')]));});});};exports[_0x9f90('0x21')]=function(_0x1a23fc){var _0x31547b=this;return new Promise(function(_0x2dbd8f,_0x29de66){return db[_0x9f90('0x18')][_0x9f90('0x22')]({'raw':_0x1a23fc[_0x9f90('0x19')]?_0x1a23fc[_0x9f90('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a23fc[_0x9f90('0x19')]?_0x1a23fc['options'][_0x9f90('0x23')]||null:null,'attributes':_0x1a23fc[_0x9f90('0x19')]?_0x1a23fc[_0x9f90('0x19')]['attributes']||null:null,'include':_0x1a23fc[_0x9f90('0x19')]?_0x1a23fc[_0x9f90('0x19')][_0x9f90('0x1d')]?_['map'](_0x1a23fc[_0x9f90('0x19')][_0x9f90('0x1d')],function(_0x156f91){return{'model':db[_0x156f91['model']],'as':_0x156f91['as'],'attributes':_0x156f91[_0x9f90('0x1b')],'include':_0x156f91[_0x9f90('0x1d')]?_[_0x9f90('0x1e')](_0x156f91['include'],function(_0x2f16e6){return{'model':db[_0x2f16e6[_0x9f90('0x1f')]],'as':_0x2f16e6['as'],'attributes':_0x2f16e6[_0x9f90('0x1b')],'include':_0x2f16e6[_0x9f90('0x1d')]?_['map'](_0x2f16e6['include'],function(_0x363ec2){return{'model':db[_0x363ec2[_0x9f90('0x1f')]],'as':_0x363ec2['as'],'attributes':_0x363ec2['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f90('0x20')](function(_0x26f9a6){logger[_0x9f90('0x15')]('ShowTrunk',_0x1a23fc);logger[_0x9f90('0xf')](_0x9f90('0x21'),_0x1a23fc,JSON[_0x9f90('0x11')](_0x26f9a6));_0x2dbd8f(_0x26f9a6);})['catch'](function(_0x289886){logger['error']('ShowTrunk',_0x289886[_0x9f90('0x14')],_0x1a23fc);_0x29de66(_0x31547b[_0x9f90('0x12')](0x1f4,_0x289886[_0x9f90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a4777ca..48ddff2 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 _0x521f=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x4db7da,_0x1fc7e6){var _0x280c93=function(_0x2af65f){while(--_0x2af65f){_0x4db7da['push'](_0x4db7da['shift']());}};_0x280c93(++_0x1fc7e6);}(_0x521f,0x72));var _0xf521=function(_0xf63384,_0x5c8d61){_0xf63384=_0xf63384-0x0;var _0x44a17a=_0x521f[_0xf63384];return _0x44a17a;};'use strict';var express=require(_0xf521('0x0'));var router=express[_0xf521('0x1')]();var auth=require(_0xf521('0x2'));var controller=require(_0xf521('0x3'));router['put'](_0xf521('0x4'),auth[_0xf521('0x5')](),controller[_0xf521('0x6')]);module[_0xf521('0x7')]=router; \ No newline at end of file +var _0xcfea=['/:id','isAuthenticated','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x3e9582,_0x5ef882){var _0xdf59d7=function(_0xfdf61c){while(--_0xfdf61c){_0x3e9582['push'](_0x3e9582['shift']());}};_0xdf59d7(++_0x5ef882);}(_0xcfea,0xa3));var _0xacfe=function(_0xfe87a2,_0x5aebf6){_0xfe87a2=_0xfe87a2-0x0;var _0x59f2b9=_0xcfea[_0xfe87a2];return _0x59f2b9;};'use strict';var express=require(_0xacfe('0x0'));var router=express[_0xacfe('0x1')]();var auth=require(_0xacfe('0x2'));var controller=require(_0xacfe('0x3'));router[_0xacfe('0x4')](_0xacfe('0x5'),auth[_0xacfe('0x6')](),controller['update']);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 a8c83c7..79ef44e 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 _0x36f6=['ENUM','BOOLEAN','TEXT','DATE','INTEGER','error','warning','debug'];(function(_0x251b62,_0x15a292){var _0x578306=function(_0x375d75){while(--_0x375d75){_0x251b62['push'](_0x251b62['shift']());}};_0x578306(++_0x15a292);}(_0x36f6,0x105));var _0x636f=function(_0x8d695e,_0x394999){_0x8d695e=_0x8d695e-0x0;var _0x3d156e=_0x36f6[_0x8d695e];return _0x3d156e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x636f('0x0'),_0x636f('0x1'),'info',_0x636f('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x636f('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x636f('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x636f('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x636f('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x636f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x636f('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x93a9=['exports','ENUM','BOOLEAN','DATE','UserId','sequelize','error','warning','info','debug'];(function(_0x50c03e,_0x40a014){var _0x1d9e9c=function(_0x2cb17b){while(--_0x2cb17b){_0x50c03e['push'](_0x50c03e['shift']());}};_0x1d9e9c(++_0x40a014);}(_0x93a9,0x1bd));var _0x993a=function(_0x48c612,_0x432076){_0x48c612=_0x48c612-0x0;var _0x5f0583=_0x93a9[_0x48c612];return _0x5f0583;};'use strict';var Sequelize=require(_0x993a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x993a('0x1'),_0x993a('0x2'),_0x993a('0x3'),_0x993a('0x4')];module[_0x993a('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x993a('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x993a('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x993a('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x993a('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 3056d08..bf60170 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 _0x25ad=['role','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch','lodash','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','update','then','stack','name','send','user'];(function(_0x21984f,_0x3f47bd){var _0x40602a=function(_0x31fd31){while(--_0x31fd31){_0x21984f['push'](_0x21984f['shift']());}};_0x40602a(++_0x3f47bd);}(_0x25ad,0x1b1));var _0xd25a=function(_0x153fab,_0x3e1351){_0x153fab=_0x153fab-0x0;var _0x57252a=_0x25ad[_0x153fab];return _0x57252a;};'use strict';var _=require(_0xd25a('0x0'));var Redis=require('ioredis');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var config=require(_0xd25a('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xd25a('0x4'))(new Redis(config[_0xd25a('0x5')]));require(_0xd25a('0x6'))[_0xd25a('0x7')](socket);config[_0xd25a('0x5')]=_[_0xd25a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3694c6,_0x330817){_0x330817=_0x330817||0xc8;return function(_0x5cf769){if(_0x5cf769){return _0x3694c6[_0xd25a('0x9')](_0x330817)[_0xd25a('0xa')](_0x5cf769);}};}function saveUpdates(_0x141f2c){return function(_0x18b7d5){if(_0x18b7d5){return _0x18b7d5[_0xd25a('0xb')](_0x141f2c)[_0xd25a('0xc')](function(_0xa21029){return _0xa21029;});}return null;};}function handleEntityNotFound(_0x5ec33c){return function(_0x1d4a07){if(!_0x1d4a07){_0x5ec33c['sendStatus'](0x194);}return _0x1d4a07;};}function handleError(_0x1ae663,_0x5bafd7){_0x5bafd7=_0x5bafd7||0x1f4;return function(_0x54b88c){logger['error'](_0x54b88c[_0xd25a('0xd')]);if(_0x54b88c[_0xd25a('0xe')]){delete _0x54b88c[_0xd25a('0xe')];}_0x1ae663[_0xd25a('0x9')](_0x5bafd7)[_0xd25a('0xf')](_0x54b88c);};}exports[_0xd25a('0xb')]=function(_0x525e82,_0x320f41){if(_0x525e82[_0xd25a('0x10')][_0xd25a('0x11')]!=='admin')throw new Error(_0xd25a('0x12'));if(isNaN(Number(_0x525e82['params']['id'])))throw new Error(_0xd25a('0x13'));return db[_0xd25a('0x14')][_0xd25a('0x15')]({'where':{'id':_0x525e82[_0xd25a('0x16')]['id']}})['then'](handleEntityNotFound(_0x320f41,null))[_0xd25a('0xc')](saveUpdates(_0x525e82[_0xd25a('0x17')],null))['then'](respondWithResult(_0x320f41,null))[_0xd25a('0x18')](handleError(_0x320f41,null));}; \ No newline at end of file +var _0x9b67=['redis','defaults','localhost','json','update','then','sendStatus','error','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter'];(function(_0x2a63f2,_0x46ff3c){var _0x49f979=function(_0x51e1f6){while(--_0x51e1f6){_0x2a63f2['push'](_0x2a63f2['shift']());}};_0x49f979(++_0x46ff3c);}(_0x9b67,0xf6));var _0x79b6=function(_0x2f4e45,_0x49c39c){_0x2f4e45=_0x2f4e45-0x0;var _0x3d288d=_0x9b67[_0x2f4e45];return _0x3d288d;};'use strict';var _=require(_0x79b6('0x0'));var Redis=require(_0x79b6('0x1'));var logger=require(_0x79b6('0x2'))(_0x79b6('0x3'));var config=require(_0x79b6('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x79b6('0x5'))(new Redis(config[_0x79b6('0x6')]));require('./user-setting.socket')['register'](socket);config[_0x79b6('0x6')]=_[_0x79b6('0x7')](config[_0x79b6('0x6')],{'host':_0x79b6('0x8'),'port':0x18eb});function respondWithResult(_0xfa6a05,_0x128543){_0x128543=_0x128543||0xc8;return function(_0x34adbe){if(_0x34adbe){return _0xfa6a05['status'](_0x128543)[_0x79b6('0x9')](_0x34adbe);}};}function saveUpdates(_0x107e4b){return function(_0x233d31){if(_0x233d31){return _0x233d31[_0x79b6('0xa')](_0x107e4b)[_0x79b6('0xb')](function(_0x52600c){return _0x52600c;});}return null;};}function handleEntityNotFound(_0x3dd86d){return function(_0x380b39){if(!_0x380b39){_0x3dd86d[_0x79b6('0xc')](0x194);}return _0x380b39;};}function handleError(_0x301f13,_0x58a98b){_0x58a98b=_0x58a98b||0x1f4;return function(_0x566c99){logger[_0x79b6('0xd')](_0x566c99[_0x79b6('0xe')]);if(_0x566c99[_0x79b6('0xf')]){delete _0x566c99['name'];}_0x301f13[_0x79b6('0x10')](_0x58a98b)[_0x79b6('0x11')](_0x566c99);};}exports[_0x79b6('0xa')]=function(_0x70886c,_0x3b0721){if(_0x70886c[_0x79b6('0x12')][_0x79b6('0x13')]!==_0x79b6('0x14'))throw new Error(_0x79b6('0x15'));if(isNaN(Number(_0x70886c[_0x79b6('0x16')]['id'])))throw new Error(_0x79b6('0x17'));return db[_0x79b6('0x18')][_0x79b6('0x19')]({'where':{'id':_0x70886c['params']['id']}})[_0x79b6('0xb')](handleEntityNotFound(_0x3b0721,null))[_0x79b6('0xb')](saveUpdates(_0x70886c[_0x79b6('0x1a')],null))[_0x79b6('0xb')](respondWithResult(_0x3b0721,null))[_0x79b6('0x1b')](handleError(_0x3b0721,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 0647827..f3b7d7c 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 _0x2871=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x8d1c0c,_0x53da7c){var _0x3ce8c3=function(_0x12b91d){while(--_0x12b91d){_0x8d1c0c['push'](_0x8d1c0c['shift']());}};_0x3ce8c3(++_0x53da7c);}(_0x2871,0x15a));var _0x1287=function(_0x3d760c,_0x3600e1){_0x3d760c=_0x3d760c-0x0;var _0x399178=_0x2871[_0x3d760c];return _0x399178;};'use strict';var EventEmitter=require(_0x1287('0x0'));var UserSetting=require(_0x1287('0x1'))['db'][_0x1287('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1287('0x3')](0x0);var events={'afterCreate':_0x1287('0x4'),'afterUpdate':'update','afterDestroy':_0x1287('0x5')};function emitEvent(_0x2e6ae1){return function(_0xa47d76,_0x46589e,_0xc2afc3){UserSettingEvents['emit'](_0x2e6ae1+':'+_0xa47d76['id'],_0xa47d76);UserSettingEvents[_0x1287('0x6')](_0x2e6ae1,_0xa47d76);_0xc2afc3(null);};}for(var e in events){if(events[_0x1287('0x7')](e)){var event=events[e];UserSetting[_0x1287('0x8')](e,emitEvent(event));}}module[_0x1287('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xfd79=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xf4f343,_0x41fe4a){var _0x4cda68=function(_0x3850e6){while(--_0x3850e6){_0xf4f343['push'](_0xf4f343['shift']());}};_0x4cda68(++_0x41fe4a);}(_0xfd79,0x11e));var _0x9fd7=function(_0x5363b8,_0x4b1fc9){_0x5363b8=_0x5363b8-0x0;var _0x102274=_0xfd79[_0x5363b8];return _0x102274;};'use strict';var EventEmitter=require(_0x9fd7('0x0'));var UserSetting=require(_0x9fd7('0x1'))['db'][_0x9fd7('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9fd7('0x3')](0x0);var events={'afterCreate':_0x9fd7('0x4'),'afterUpdate':_0x9fd7('0x5'),'afterDestroy':_0x9fd7('0x6')};function emitEvent(_0x46451a){return function(_0x23c41d,_0x1e2514,_0x295071){UserSettingEvents[_0x9fd7('0x7')](_0x46451a+':'+_0x23c41d['id'],_0x23c41d);UserSettingEvents[_0x9fd7('0x7')](_0x46451a,_0x23c41d);_0x295071(null);};}for(var e in events){if(events[_0x9fd7('0x8')](e)){var event=events[e];UserSetting[_0x9fd7('0x9')](e,emitEvent(event));}}module[_0x9fd7('0xa')]=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 438d5d5..ed584a4 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 _0xeffd=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x1cc161,_0x440a15){var _0x88309c=function(_0x52b501){while(--_0x52b501){_0x1cc161['push'](_0x1cc161['shift']());}};_0x88309c(++_0x440a15);}(_0xeffd,0x6b));var _0xdeff=function(_0x48679a,_0x461b38){_0x48679a=_0x48679a-0x0;var _0x31addd=_0xeffd[_0x48679a];return _0x31addd;};'use strict';var attributes=require(_0xdeff('0x0'));module['exports']=function(_0x1f45fd){return _0x1f45fd[_0xdeff('0x1')](_0xdeff('0x2'),attributes,{'tableName':_0xdeff('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xafbbb1){if(!_0xafbbb1[_0xdeff('0x4')])_0xafbbb1[_0xdeff('0x5')]=null;else if(_0xafbbb1[_0xdeff('0x5')]===null)_0xafbbb1[_0xdeff('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x0fd9=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define'];(function(_0x4daca9,_0x4638bf){var _0x3a9522=function(_0x1a261e){while(--_0x1a261e){_0x4daca9['push'](_0x4daca9['shift']());}};_0x3a9522(++_0x4638bf);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x0fd9[_0x2b9b7f];return _0x4ed19a;};'use strict';var attributes=require('./user-setting.attributes');module[_0x90fd('0x0')]=function(_0x4380e6){return _0x4380e6[_0x90fd('0x1')](_0x90fd('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4acbd9){if(!_0x4acbd9[_0x90fd('0x3')])_0x4acbd9[_0x90fd('0x4')]=null;else if(_0x4acbd9[_0x90fd('0x4')]===null)_0x4acbd9[_0x90fd('0x4')]=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 477f895..87cf6f6 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 _0xfd17=['./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x4f6172,_0x3e1145){var _0x822141=function(_0x490b24){while(--_0x490b24){_0x4f6172['push'](_0x4f6172['shift']());}};_0x822141(++_0x3e1145);}(_0xfd17,0x118));var _0x7fd1=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xfd17[_0xae01dd];return _0x8c26df;};'use strict';var UserSettingEvents=require(_0x7fd1('0x0'));var events=[_0x7fd1('0x1'),_0x7fd1('0x2'),_0x7fd1('0x3')];function createListener(_0x4bc965,_0x50b696){return function(_0x505fec){_0x50b696[_0x7fd1('0x4')](_0x4bc965,_0x505fec);if(_0x4bc965===_0x7fd1('0x5')){_0x50b696[_0x7fd1('0x4')](_0x7fd1('0x6')+_0x505fec[_0x7fd1('0x7')],_0x505fec);}};}exports[_0x7fd1('0x8')]=function(_0xbc7288){for(var _0x376875=0x0,_0xf8ac13=events['length'];_0x376875<_0xf8ac13;_0x376875++){var _0x46f6b6=events[_0x376875];var _0x5943e4=createListener(_0x7fd1('0x9')+_0x46f6b6,_0xbc7288);UserSettingEvents['on'](_0x46f6b6,_0x5943e4);}}; \ No newline at end of file +var _0x7232=['user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x7232,0x151));var _0x2723=function(_0x287687,_0x460c4d){_0x287687=_0x287687-0x0;var _0x4f9d93=_0x7232[_0x287687];return _0x4f9d93;};'use strict';var UserSettingEvents=require(_0x2723('0x0'));var events=[_0x2723('0x1'),_0x2723('0x2'),'update'];function createListener(_0x5a85f1,_0x15bc28){return function(_0x903000){_0x15bc28[_0x2723('0x3')](_0x5a85f1,_0x903000);if(_0x5a85f1===_0x2723('0x4')){_0x15bc28['emit'](_0x2723('0x5')+_0x903000[_0x2723('0x6')],_0x903000);}};}exports['register']=function(_0x344763){for(var _0x2eafbb=0x0,_0x2860c8=events[_0x2723('0x7')];_0x2eafbb<_0x2860c8;_0x2eafbb++){var _0x3b1dcb=events[_0x2eafbb];var _0x2950f5=createListener(_0x2723('0x8')+_0x3b1dcb,_0x344763);UserSettingEvents['on'](_0x3b1dcb,_0x2950f5);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ee63da9..62899fa 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 _0x0a22=['server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeMailAccounts','removeChatWebsites','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','create','post','bulkCreate','addQueues','diskStorage','join','root'];(function(_0x4dfda0,_0x30afa6){var _0x3759c2=function(_0x14484f){while(--_0x14484f){_0x4dfda0['push'](_0x4dfda0['shift']());}};_0x3759c2(++_0x30afa6);}(_0x0a22,0x1eb));var _0x20a2=function(_0x3ce8b8,_0x3c48ff){_0x3ce8b8=_0x3ce8b8-0x0;var _0x575f16=_0x0a22[_0x3ce8b8];return _0x575f16;};'use strict';var multer=require(_0x20a2('0x0'));var util=require(_0x20a2('0x1'));var path=require(_0x20a2('0x2'));var timeout=require(_0x20a2('0x3'));var express=require(_0x20a2('0x4'));var router=express[_0x20a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x20a2('0x6'));var interaction=require(_0x20a2('0x7'));var config=require(_0x20a2('0x8'));var controller=require(_0x20a2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x20a2('0xa')]);router[_0x20a2('0xb')](_0x20a2('0xc'),auth[_0x20a2('0xd')](),controller['describe']);router['get']('/whoami',auth[_0x20a2('0xd')](),controller['whoami']);router[_0x20a2('0xb')](_0x20a2('0xe'),auth['isAuthenticated'](),controller[_0x20a2('0xf')]);router[_0x20a2('0xb')](_0x20a2('0x10'),auth[_0x20a2('0xd')](),controller['show']);router['get'](_0x20a2('0x11'),controller[_0x20a2('0x12')]);router[_0x20a2('0xb')](_0x20a2('0x13'),auth['isAuthenticated'](),controller[_0x20a2('0x14')]);router['get'](_0x20a2('0x15'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x16')]);router[_0x20a2('0xb')](_0x20a2('0x17'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x18')]);router[_0x20a2('0xb')](_0x20a2('0x19'),auth['isAuthenticated'](),controller[_0x20a2('0x1a')]);router['get'](_0x20a2('0x1b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x1c')]);router[_0x20a2('0xb')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x20a2('0x1d')]);router[_0x20a2('0xb')](_0x20a2('0x1e'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x1f')]);router[_0x20a2('0xb')]('/:id/chat/interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x20')]);router['get'](_0x20a2('0x21'),auth['isAuthenticated'](),controller[_0x20a2('0x22')]);router[_0x20a2('0xb')](_0x20a2('0x23'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x24')]);router[_0x20a2('0xb')](_0x20a2('0x25'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x26')]);router[_0x20a2('0xb')](_0x20a2('0x27'),auth[_0x20a2('0xd')](),controller['getFaxInteractions']);router[_0x20a2('0xb')](_0x20a2('0x28'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x29')]);router['get'](_0x20a2('0x2a'),auth[_0x20a2('0xd')](),controller['getTeams']);router[_0x20a2('0xb')](_0x20a2('0x2b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x2c')]);router[_0x20a2('0xb')](_0x20a2('0x2d'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x2e')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x20a2('0x2f')]);router[_0x20a2('0xb')](_0x20a2('0x30'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x31')]);router['get'](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x33')]);router[_0x20a2('0xb')](_0x20a2('0x34'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x35')]);router[_0x20a2('0xb')](_0x20a2('0x36'),auth[_0x20a2('0xd')](),controller['getSmsAccounts']);router[_0x20a2('0xb')](_0x20a2('0x37'),auth['isAuthenticated'](),controller[_0x20a2('0x38')]);router[_0x20a2('0xb')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x20a2('0x39')]);router[_0x20a2('0xb')](_0x20a2('0x3a'),auth['isAuthenticated'](),controller[_0x20a2('0x3b')]);router[_0x20a2('0xb')](_0x20a2('0x3c'),auth['isAuthenticated'](),controller['getApiKey']);router['post'](_0x20a2('0x15'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x3d')]);router['post']('/',auth[_0x20a2('0xd')](),controller[_0x20a2('0x3e')]);router[_0x20a2('0x3f')]('/create_many',auth[_0x20a2('0xd')](),controller[_0x20a2('0x40')]);router['post'](_0x20a2('0x17'),auth['isAuthenticated'](),controller[_0x20a2('0x41')]);var upload=multer({'storage':multer[_0x20a2('0x42')]({'destination':function(_0x3943b8,_0x3c3c28,_0x5e6004){_0x5e6004(null,path[_0x20a2('0x43')](config[_0x20a2('0x44')],_0x20a2('0x45')));},'filename':function(_0x5800b4,_0x89c08e,_0x18a705){_0x18a705(null,util[_0x20a2('0x46')](_0x20a2('0x47'),Date[_0x20a2('0x48')](),_0x89c08e[_0x20a2('0x49')]));}})});router[_0x20a2('0x3f')]('/:id/avatar',upload['single']('file'),controller[_0x20a2('0x4a')]);router['post']('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x20a2('0x3f')]('/:id/logout',auth[_0x20a2('0xd')](),controller['logout']);router['post'](_0x20a2('0x4b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x4c')]);router[_0x20a2('0x3f')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x20a2('0x4d')]);router[_0x20a2('0x3f')]('/:id/teams',auth[_0x20a2('0xd')](),controller[_0x20a2('0x4e')]);router[_0x20a2('0x3f')]('/:id/chat_interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x4f')]);router['post'](_0x20a2('0x50'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x51')]);router[_0x20a2('0x3f')](_0x20a2('0x52'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x53')]);router[_0x20a2('0x3f')](_0x20a2('0x54'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x55')]);router[_0x20a2('0x3f')]('/:id/openchannel_interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x56')]);router['post'](_0x20a2('0x57'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x58')]);router[_0x20a2('0x3f')](_0x20a2('0x30'),auth['isAuthenticated'](),controller[_0x20a2('0x59')]);router[_0x20a2('0x3f')](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5a')]);router[_0x20a2('0x3f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x20a2('0xd')](),controller[_0x20a2('0x5b')]);router[_0x20a2('0x3f')](_0x20a2('0x37'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5c')]);router[_0x20a2('0x3f')](_0x20a2('0x5d'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5e')]);router[_0x20a2('0x3f')](_0x20a2('0x3c'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5f')]);router['put']('/:id',auth[_0x20a2('0xd')](),controller['update']);router[_0x20a2('0x60')](_0x20a2('0x61'),auth[_0x20a2('0xd')](),controller['changePassword']);router[_0x20a2('0x62')](_0x20a2('0x17'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x63')]);router['delete'](_0x20a2('0x2a'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x64')]);router[_0x20a2('0x62')](_0x20a2('0x10'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x65')]);router[_0x20a2('0x62')](_0x20a2('0x66'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x67')]);router['delete'](_0x20a2('0x50'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x68')]);router['delete'](_0x20a2('0x52'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x69')]);router['delete'](_0x20a2('0x54'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x20a2('0x62')](_0x20a2('0x6a'),auth[_0x20a2('0xd')](),controller['removeOpenchannelInteractions']);router[_0x20a2('0x62')](_0x20a2('0x57'),auth['isAuthenticated'](),controller[_0x20a2('0x6b')]);router['delete']('/:id/fax_accounts',auth[_0x20a2('0xd')](),controller['removeFaxAccounts']);router[_0x20a2('0x62')](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x6c')]);router[_0x20a2('0x62')](_0x20a2('0x34'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x20a2('0x62')](_0x20a2('0x36'),auth[_0x20a2('0xd')](),controller['removeSmsAccounts']);router[_0x20a2('0x62')](_0x20a2('0x37'),auth['isAuthenticated'](),controller[_0x20a2('0x6d')]);router[_0x20a2('0x62')](_0x20a2('0x5d'),auth[_0x20a2('0xd')](),controller['removeWhatsappAccounts']);router[_0x20a2('0x62')](_0x20a2('0x3c'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x6e')]);router[_0x20a2('0x3f')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller['messengerSoundNotification']);module[_0x20a2('0x6f')]=router; \ No newline at end of file +var _0x57e5=['removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/whoami','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','/: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','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','/:id/api_key'];(function(_0x3fbfc6,_0x20a590){var _0x253bd4=function(_0x48169e){while(--_0x48169e){_0x3fbfc6['push'](_0x3fbfc6['shift']());}};_0x253bd4(++_0x20a590);}(_0x57e5,0xe8));var _0x557e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x57e5[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x557e('0x0'));var timeout=require(_0x557e('0x1'));var express=require(_0x557e('0x2'));var router=express[_0x557e('0x3')]();var fs_extra=require(_0x557e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x557e('0x5'));var config=require(_0x557e('0x6'));var controller=require('./user.controller');router[_0x557e('0x7')]('/',auth['isAuthenticated'](),controller[_0x557e('0x8')]);router[_0x557e('0x7')]('/describe',auth[_0x557e('0x9')](),controller[_0x557e('0xa')]);router[_0x557e('0x7')](_0x557e('0xb'),auth[_0x557e('0x9')](),controller['whoami']);router['get']('/presence',auth[_0x557e('0x9')](),controller['getPresence']);router[_0x557e('0x7')](_0x557e('0xc'),auth['isAuthenticated'](),controller[_0x557e('0xd')]);router[_0x557e('0x7')]('/:id/avatar',controller[_0x557e('0xe')]);router[_0x557e('0x7')](_0x557e('0xf'),auth[_0x557e('0x9')](),controller[_0x557e('0x10')]);router[_0x557e('0x7')](_0x557e('0x11'),auth[_0x557e('0x9')](),controller[_0x557e('0x12')]);router[_0x557e('0x7')](_0x557e('0x13'),auth[_0x557e('0x9')](),controller[_0x557e('0x14')]);router[_0x557e('0x7')](_0x557e('0x15'),auth['isAuthenticated'](),controller[_0x557e('0x16')]);router[_0x557e('0x7')](_0x557e('0x17'),auth[_0x557e('0x9')](),controller[_0x557e('0x18')]);router['get'](_0x557e('0x19'),auth[_0x557e('0x9')](),controller['getRecordings']);router[_0x557e('0x7')](_0x557e('0x1a'),auth[_0x557e('0x9')](),controller[_0x557e('0x1b')]);router[_0x557e('0x7')](_0x557e('0x1c'),auth['isAuthenticated'](),controller[_0x557e('0x1d')]);router['get'](_0x557e('0x1e'),auth['isAuthenticated'](),controller[_0x557e('0x1f')]);router['get'](_0x557e('0x20'),auth[_0x557e('0x9')](),controller[_0x557e('0x21')]);router[_0x557e('0x7')]('/:id/sms/interactions',auth[_0x557e('0x9')](),controller[_0x557e('0x22')]);router[_0x557e('0x7')]('/:id/fax/interactions',auth[_0x557e('0x9')](),controller['getFaxInteractions']);router[_0x557e('0x7')](_0x557e('0x23'),auth[_0x557e('0x9')](),controller[_0x557e('0x24')]);router[_0x557e('0x7')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x557e('0x25'),auth[_0x557e('0x9')](),controller['getLists']);router['get'](_0x557e('0x26'),auth[_0x557e('0x9')](),controller[_0x557e('0x27')]);router[_0x557e('0x7')](_0x557e('0x28'),auth[_0x557e('0x9')](),controller[_0x557e('0x29')]);router[_0x557e('0x7')](_0x557e('0x2a'),auth[_0x557e('0x9')](),controller[_0x557e('0x2b')]);router[_0x557e('0x7')](_0x557e('0x2c'),auth['isAuthenticated'](),controller[_0x557e('0x2d')]);router[_0x557e('0x7')](_0x557e('0x2e'),auth[_0x557e('0x9')](),controller[_0x557e('0x2f')]);router[_0x557e('0x7')](_0x557e('0x30'),auth[_0x557e('0x9')](),controller[_0x557e('0x31')]);router[_0x557e('0x7')](_0x557e('0x32'),auth[_0x557e('0x9')](),controller[_0x557e('0x33')]);router[_0x557e('0x7')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x557e('0x34')]);router[_0x557e('0x7')](_0x557e('0x35'),auth[_0x557e('0x9')](),controller[_0x557e('0x36')]);router[_0x557e('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x557e('0x37')]);router[_0x557e('0x38')](_0x557e('0x11'),auth[_0x557e('0x9')](),controller[_0x557e('0x39')]);router[_0x557e('0x38')]('/',auth['isAuthenticated'](),controller[_0x557e('0x3a')]);router['post'](_0x557e('0x3b'),auth['isAuthenticated'](),controller[_0x557e('0x3c')]);router['post'](_0x557e('0x13'),auth[_0x557e('0x9')](),controller[_0x557e('0x3d')]);var upload=multer({'storage':multer[_0x557e('0x3e')]({'destination':function(_0x20019c,_0x34949d,_0x57cdda){_0x57cdda(null,path[_0x557e('0x3f')](config[_0x557e('0x40')],_0x557e('0x41')));},'filename':function(_0x1dcba8,_0x59c4af,_0x229e51){_0x229e51(null,util[_0x557e('0x42')](_0x557e('0x43'),Date[_0x557e('0x44')](),_0x59c4af[_0x557e('0x45')]));}})});router[_0x557e('0x38')](_0x557e('0x46'),upload[_0x557e('0x47')]('file'),controller[_0x557e('0x48')]);router[_0x557e('0x38')](_0x557e('0x49'),auth['isAuthenticated'](),controller['login']);router['post'](_0x557e('0x4a'),auth[_0x557e('0x9')](),controller[_0x557e('0x4b')]);router[_0x557e('0x38')]('/:id/pause',auth[_0x557e('0x9')](),controller[_0x557e('0x4c')]);router[_0x557e('0x38')](_0x557e('0x4d'),auth[_0x557e('0x9')](),controller['unpause']);router[_0x557e('0x38')]('/:id/teams',auth[_0x557e('0x9')](),controller[_0x557e('0x4e')]);router[_0x557e('0x38')](_0x557e('0x4f'),auth[_0x557e('0x9')](),controller[_0x557e('0x50')]);router[_0x557e('0x38')](_0x557e('0x51'),auth[_0x557e('0x9')](),controller['addMailInteractions']);router[_0x557e('0x38')](_0x557e('0x52'),auth[_0x557e('0x9')](),controller['addFaxInteractions']);router[_0x557e('0x38')](_0x557e('0x53'),auth[_0x557e('0x9')](),controller[_0x557e('0x54')]);router[_0x557e('0x38')](_0x557e('0x55'),auth[_0x557e('0x9')](),controller[_0x557e('0x56')]);router['post'](_0x557e('0x57'),auth[_0x557e('0x9')](),controller[_0x557e('0x58')]);router[_0x557e('0x38')](_0x557e('0x2a'),auth[_0x557e('0x9')](),controller['addFaxAccounts']);router[_0x557e('0x38')](_0x557e('0x2c'),auth[_0x557e('0x9')](),controller[_0x557e('0x59')]);router[_0x557e('0x38')]('/:id/openchannel_accounts',auth[_0x557e('0x9')](),controller[_0x557e('0x5a')]);router[_0x557e('0x38')]('/:id/sms_accounts',auth[_0x557e('0x9')](),controller[_0x557e('0x5b')]);router[_0x557e('0x38')](_0x557e('0x32'),auth[_0x557e('0x9')](),controller[_0x557e('0x5c')]);router['post'](_0x557e('0x5d'),auth[_0x557e('0x9')](),controller[_0x557e('0x5e')]);router[_0x557e('0x38')]('/:id/api_key',auth[_0x557e('0x9')](),controller[_0x557e('0x5f')]);router[_0x557e('0x60')]('/:id',auth[_0x557e('0x9')](),controller['update']);router[_0x557e('0x60')](_0x557e('0x61'),auth[_0x557e('0x9')](),controller[_0x557e('0x62')]);router['delete'](_0x557e('0x13'),auth[_0x557e('0x9')](),controller[_0x557e('0x63')]);router[_0x557e('0x64')]('/:id/teams',auth['isAuthenticated'](),controller[_0x557e('0x65')]);router['delete'](_0x557e('0xc'),auth[_0x557e('0x9')](),controller['destroy']);router['delete'](_0x557e('0x4f'),auth[_0x557e('0x9')](),controller[_0x557e('0x66')]);router[_0x557e('0x64')](_0x557e('0x51'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x557e('0x64')](_0x557e('0x52'),auth[_0x557e('0x9')](),controller[_0x557e('0x67')]);router[_0x557e('0x64')](_0x557e('0x53'),auth['isAuthenticated'](),controller[_0x557e('0x68')]);router[_0x557e('0x64')]('/:id/openchannel_interactions',auth[_0x557e('0x9')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0x557e('0x9')](),controller['removeWhatsappInteractions']);router[_0x557e('0x64')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x557e('0x64')](_0x557e('0x2c'),auth['isAuthenticated'](),controller[_0x557e('0x69')]);router[_0x557e('0x64')](_0x557e('0x2e'),auth[_0x557e('0x9')](),controller[_0x557e('0x6a')]);router[_0x557e('0x64')](_0x557e('0x30'),auth[_0x557e('0x9')](),controller[_0x557e('0x6b')]);router[_0x557e('0x64')](_0x557e('0x32'),auth['isAuthenticated'](),controller['removeChatWebsites']);router['delete'](_0x557e('0x5d'),auth['isAuthenticated'](),controller[_0x557e('0x6c')]);router['delete'](_0x557e('0x6d'),auth[_0x557e('0x9')](),controller[_0x557e('0x6e')]);router[_0x557e('0x38')](_0x557e('0x6f'),auth[_0x557e('0x9')](),controller[_0x557e('0x70')]);module[_0x557e('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f51fdbe..6fd5499 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 _0x4f0e=['ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','telephone','local','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN'];(function(_0x2d8e13,_0x2296b7){var _0xb69c95=function(_0x2d6623){while(--_0x2d6623){_0x2d8e13['push'](_0x2d8e13['shift']());}};_0xb69c95(++_0x2296b7);}(_0x4f0e,0x14f));var _0xe4f0=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x4f0e[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0xe4f0('0x0'));var moment=require(_0xe4f0('0x1'));var util=require(_0xe4f0('0x2'));var _=require('lodash');module[_0xe4f0('0x3')]={'name':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'unique':_0xe4f0('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x39f59c){this[_0xe4f0('0x6')](_0xe4f0('0x5'),_0x39f59c);this['setDataValue'](_0xe4f0('0x7'),_0x39f59c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'set':function(_0x24628b){this[_0xe4f0('0x6')](_0xe4f0('0x8'),_0x24628b);this[_0xe4f0('0x6')](_0xe4f0('0x9'),util[_0xe4f0('0xa')](_0xe4f0('0xb'),_0x24628b,this[_0xe4f0('0xc')](_0xe4f0('0xd'))));}},'alias':{'type':Sequelize[_0xe4f0('0x4')]},'email':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x13e68c){if(_0x13e68c){this[_0xe4f0('0x6')](_0xe4f0('0xe'),_0x13e68c[_0xe4f0('0xf')]());}}},'role':{'type':Sequelize[_0xe4f0('0x10')]('admin',_0xe4f0('0x11'),'agent',_0xe4f0('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe4f0('0x4')],'defaultValue':_0xe4f0('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe4f0('0xd'),'set':function(_0x1749d7){this['setDataValue'](_0xe4f0('0xd'),_0x1749d7);this[_0xe4f0('0x6')](_0xe4f0('0x14'),_0x1749d7);this[_0xe4f0('0x6')]('callerid',util[_0xe4f0('0xa')](_0xe4f0('0xb'),this[_0xe4f0('0xc')](_0xe4f0('0x8')),_0x1749d7));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe4f0('0x4')]},'mobile':{'type':Sequelize[_0xe4f0('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe4f0('0x4')]},'country':{'type':Sequelize[_0xe4f0('0x4')]},'online':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe4f0('0x16')]},'voicePause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe4f0('0x17')},'lastPauseAt':{'type':Sequelize[_0xe4f0('0x16')]},'chatCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe4f0('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe4f0('0x11'),_0xe4f0('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x1a'),_0xe4f0('0x1b'),_0xe4f0('0x1c'),_0xe4f0('0x1d'),'PROHIB_NOT_SCREENED',_0xe4f0('0x1e'),_0xe4f0('0x1f'),_0xe4f0('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':_0xe4f0('0x21'),'set':function(_0x1ed595){this[_0xe4f0('0x6')](_0xe4f0('0x22'),_0x1ed595?_0x1ed595[_0xe4f0('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xe4f0('0x22'))[_0xe4f0('0x24')](','):null;},'comment':_0xe4f0('0x25')},'dtmfmode':{'type':Sequelize[_0xe4f0('0x10')]('rfc2833',_0xe4f0('0x26'),_0xe4f0('0x27'),_0xe4f0('0x28'),'auto'),'allowNull':!![],'defaultValue':_0xe4f0('0x29')},'directmedia':{'type':Sequelize[_0xe4f0('0x10')]('yes','no',_0xe4f0('0x2a'),'update',_0xe4f0('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe4f0('0x2d'),'set':function(_0x3d2bc9){this['setDataValue'](_0xe4f0('0x2e'),_0x3d2bc9?_0x3d2bc9[_0xe4f0('0x23')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xe4f0('0xc')](_0xe4f0('0x2e'))['split'](','):null;},'comment':_0xe4f0('0x2f')},'callgroup':{'type':Sequelize[_0xe4f0('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe4f0('0x4')]},'pickupgroup':{'type':Sequelize[_0xe4f0('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe4f0('0x4')]},'language':{'type':Sequelize[_0xe4f0('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe4f0('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e8654){this['setDataValue'](_0xe4f0('0x30'),_0x4e8654?_0x4e8654['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe4f0('0xc')]('allow')?this[_0xe4f0('0xc')](_0xe4f0('0x30'))[_0xe4f0('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'set':function(_0x1cb6f1){this[_0xe4f0('0x6')](_0xe4f0('0x31'),_0x1cb6f1?_0x1cb6f1[_0xe4f0('0x23')](','):null);},'get':function(){return this[_0xe4f0('0xc')](_0xe4f0('0x31'))?this['getDataValue'](_0xe4f0('0x31'))['split'](','):null;},'comment':_0xe4f0('0x32')},'trustrpid':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xe4f0('0x2c')},'busylevel':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no',_0xe4f0('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x34'),_0xe4f0('0x35'),_0xe4f0('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x37'),'uas'),'allowNull':!![],'defaultValue':_0xe4f0('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe4f0('0x2c')},'keepalive':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no','fingerprint',_0xe4f0('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe4f0('0x3a'),_0xe4f0('0x3b'),_0xe4f0('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no','nonat',_0xe4f0('0x3d'),_0xe4f0('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe4f0('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe4f0('0x16')]},'passwordResetAt':{'type':Sequelize[_0xe4f0('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe4f0('0x3f')]},'showWebBar':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0,'set':function(_0x27276b){this['setDataValue'](_0xe4f0('0x40'),_0x27276b);var _0x1cf78f=this[_0xe4f0('0x41')]({'plain':!![]});switch(_0x27276b){case 0x0:case 0x1:var _0x23a7dd=_0x1cf78f[_0xe4f0('0x22')]?_[_0xe4f0('0x42')](_0x1cf78f[_0xe4f0('0x22')])?_0x1cf78f['transport'][_0xe4f0('0x23')]():_0x1cf78f['transport']:'udp';if(_0x23a7dd===_0xe4f0('0x43')){_0x23a7dd=_0xe4f0('0x21');}this['setDataValue'](_0xe4f0('0x22'),_0x23a7dd);this[_0xe4f0('0x6')]('encryption','no');this[_0xe4f0('0x6')](_0xe4f0('0x44'),null);this[_0xe4f0('0x6')]('force_avp',null);this[_0xe4f0('0x6')](_0xe4f0('0x45'),null);this['setDataValue'](_0xe4f0('0x46'),null);this[_0xe4f0('0x6')](_0xe4f0('0x47'),null);this[_0xe4f0('0x6')](_0xe4f0('0x48'),null);this['setDataValue'](_0xe4f0('0x49'),null);this[_0xe4f0('0x6')](_0xe4f0('0x4a'),null);this['setDataValue'](_0xe4f0('0x4b'),'no');break;case 0x2:this[_0xe4f0('0x6')](_0xe4f0('0x22'),_0xe4f0('0x43'));this[_0xe4f0('0x6')]('encryption',_0xe4f0('0x2c'));this[_0xe4f0('0x6')]('avpf',_0xe4f0('0x2c'));this['setDataValue'](_0xe4f0('0x4c'),_0xe4f0('0x2c'));this[_0xe4f0('0x6')](_0xe4f0('0x45'),_0xe4f0('0x2c'));this[_0xe4f0('0x6')](_0xe4f0('0x46'),'yes');this['setDataValue'](_0xe4f0('0x47'),'no');this['setDataValue'](_0xe4f0('0x48'),_0xe4f0('0x3c'));this[_0xe4f0('0x6')]('dtlscertfile',_0x1cf78f[_0xe4f0('0x49')]||_0xe4f0('0x4d'));this[_0xe4f0('0x6')](_0xe4f0('0x4a'),_0x1cf78f[_0xe4f0('0x4a')]||_0xe4f0('0x4e'));this[_0xe4f0('0x6')](_0xe4f0('0x4b'),_0xe4f0('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xe4f0('0x3f')],'set':function(_0x348c88){this[_0xe4f0('0x6')]('permissions',_0x348c88?_0x348c88[_0xe4f0('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0xe4f0('0x4f'))?_[_0xe4f0('0x50')](this['getDataValue'](_0xe4f0('0x4f'))[_0xe4f0('0x24')](','),function(_0x1a8b75){return parseInt(_0x1a8b75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe4f0('0x51')],'get':function(){return this[_0xe4f0('0xc')](_0xe4f0('0x52'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf52159){if(typeof _0xf52159===_0xe4f0('0x53')){var _0x38a050=_0xf52159==='1'?!![]:_0xf52159==='0'?![]:_0xf52159===_0xe4f0('0x54')?!![]:_0xf52159===_0xe4f0('0x55')?![]:![];this[_0xe4f0('0x6')](_0xe4f0('0x56'),_0x38a050);}else{this[_0xe4f0('0x6')](_0xe4f0('0x56'),_0xf52159);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f1a75){this[_0xe4f0('0x6')](_0xe4f0('0x57'),_0x4f1a75);if(_0x4f1a75===!![]){this['setDataValue']('blockedAt',moment());this[_0xe4f0('0x6')](_0xe4f0('0x58'),0x0);}else{this[_0xe4f0('0x6')](_0xe4f0('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xe4f0('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe4f0('0x18')](0x5)[_0xe4f0('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xdf21=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','originate','uac','fingerprint','certificate','active','passive','actpass','TEXT','showWebBar','get','isArray','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','wss','encryption','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','nat'];(function(_0x313e3d,_0x2d149f){var _0x3989d0=function(_0x91af6a){while(--_0x91af6a){_0x313e3d['push'](_0x313e3d['shift']());}};_0x3989d0(++_0x2d149f);}(_0xdf21,0x1ad));var _0x1df2=function(_0x4fc6e8,_0x16c0db){_0x4fc6e8=_0x4fc6e8-0x0;var _0x342aa3=_0xdf21[_0x4fc6e8];return _0x342aa3;};'use strict';var Sequelize=require(_0x1df2('0x0'));var moment=require('moment');var util=require(_0x1df2('0x1'));var _=require(_0x1df2('0x2'));module[_0x1df2('0x3')]={'name':{'type':Sequelize[_0x1df2('0x4')],'allowNull':![],'unique':_0x1df2('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a25d5){this[_0x1df2('0x6')](_0x1df2('0x5'),_0x2a25d5);this[_0x1df2('0x6')](_0x1df2('0x7'),_0x2a25d5);},'comment':_0x1df2('0x8')},'fullname':{'type':Sequelize[_0x1df2('0x4')],'allowNull':![],'set':function(_0x384543){this[_0x1df2('0x6')](_0x1df2('0x9'),_0x384543);this[_0x1df2('0x6')](_0x1df2('0xa'),util[_0x1df2('0xb')](_0x1df2('0xc'),_0x384543,this[_0x1df2('0xd')](_0x1df2('0xe'))));}},'alias':{'type':Sequelize[_0x1df2('0x4')]},'email':{'type':Sequelize[_0x1df2('0x4')],'allowNull':![],'unique':_0x1df2('0xf'),'validate':{'isEmail':!![]},'set':function(_0x5cb85e){if(_0x5cb85e){this[_0x1df2('0x6')](_0x1df2('0xf'),_0x5cb85e[_0x1df2('0x10')]());}}},'role':{'type':Sequelize['ENUM'](_0x1df2('0x11'),_0x1df2('0x12'),_0x1df2('0x13'),_0x1df2('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x1df2('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1df2('0x15')},'internal':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':![],'unique':'internal','set':function(_0x29c97f){this[_0x1df2('0x6')](_0x1df2('0xe'),_0x29c97f);this[_0x1df2('0x6')]('accountcode',_0x29c97f);this[_0x1df2('0x6')](_0x1df2('0xa'),util[_0x1df2('0xb')](_0x1df2('0xc'),this[_0x1df2('0xd')](_0x1df2('0x9')),_0x29c97f));}},'salt':{'type':Sequelize[_0x1df2('0x4')]},'phone':{'type':Sequelize[_0x1df2('0x4')]},'mobile':{'type':Sequelize[_0x1df2('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x1df2('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1df2('0x4')]},'country':{'type':Sequelize[_0x1df2('0x4')]},'online':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1df2('0x18')]},'voicePause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1df2('0x4')],'defaultValue':_0x1df2('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1df2('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1df2('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'defaultValue':_0x1df2('0x1a')},'ipaddr':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x1c'),_0x1df2('0x12'),_0x1df2('0x1d')),'allowNull':!![],'defaultValue':_0x1df2('0x1c')},'context':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'defaultValue':_0x1df2('0x1e')},'callingpres':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x1f'),_0x1df2('0x20'),_0x1df2('0x21'),_0x1df2('0x22'),_0x1df2('0x23'),_0x1df2('0x24'),_0x1df2('0x25'),_0x1df2('0x26')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'defaultValue':_0x1df2('0x27'),'set':function(_0x3109e5){this[_0x1df2('0x6')](_0x1df2('0x28'),_0x3109e5?_0x3109e5[_0x1df2('0x29')](','):null);},'get':function(){return this[_0x1df2('0xd')](_0x1df2('0x28'))?this[_0x1df2('0xd')](_0x1df2('0x28'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x2a'),_0x1df2('0x2b'),_0x1df2('0x2c'),'inband',_0x1df2('0x2d')),'allowNull':!![],'defaultValue':_0x1df2('0x2a')},'directmedia':{'type':Sequelize[_0x1df2('0x1b')]('yes','no',_0x1df2('0x2e'),_0x1df2('0x2f'),_0x1df2('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x29204a){this[_0x1df2('0x6')]('nat',_0x29204a?_0x29204a[_0x1df2('0x29')](','):null);},'get':function(){return this[_0x1df2('0xd')]('nat')?this[_0x1df2('0xd')](_0x1df2('0x32'))[_0x1df2('0x33')](','):null;},'comment':_0x1df2('0x34')},'callgroup':{'type':Sequelize[_0x1df2('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1df2('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1df2('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1df2('0x4')]},'disallow':{'type':Sequelize[_0x1df2('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4b37a4){this[_0x1df2('0x6')](_0x1df2('0x35'),_0x4b37a4?_0x4b37a4['join'](';'):_0x1df2('0x36'));},'get':function(){return this[_0x1df2('0xd')](_0x1df2('0x35'))?this[_0x1df2('0xd')](_0x1df2('0x35'))[_0x1df2('0x33')](';'):null;},'comment':_0x1df2('0x37')},'autoframing':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'set':function(_0x294d06){this[_0x1df2('0x6')](_0x1df2('0x38'),_0x294d06?_0x294d06[_0x1df2('0x29')](','):null);},'get':function(){return this[_0x1df2('0xd')](_0x1df2('0x38'))?this[_0x1df2('0xd')](_0x1df2('0x38'))[_0x1df2('0x33')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1df2('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1df2('0x31'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![],'defaultValue':_0x1df2('0x39')},'amaflags':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':_0x1df2('0x31')},'busylevel':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no',_0x1df2('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1df2('0x3b'),_0x1df2('0x3c'),_0x1df2('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x3e'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1df2('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1df2('0x1b')]('yes','no',_0x1df2('0x3f'),_0x1df2('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1df2('0x41'),_0x1df2('0x42'),_0x1df2('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x1df2('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1df2('0x31'),'no',_0x1df2('0x2e'),_0x1df2('0x2f'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1df2('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1df2('0x44')]},'showWebBar':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0,'set':function(_0x5d331c){this[_0x1df2('0x6')](_0x1df2('0x45'),_0x5d331c);var _0x3fef18=this[_0x1df2('0x46')]({'plain':!![]});switch(_0x5d331c){case 0x0:case 0x1:var _0x59bb77=_0x3fef18[_0x1df2('0x28')]?_[_0x1df2('0x47')](_0x3fef18[_0x1df2('0x28')])?_0x3fef18[_0x1df2('0x28')][_0x1df2('0x29')]():_0x3fef18[_0x1df2('0x28')]:_0x1df2('0x27');if(_0x59bb77==='wss'){_0x59bb77='udp';}this['setDataValue'](_0x1df2('0x28'),_0x59bb77);this[_0x1df2('0x6')]('encryption','no');this[_0x1df2('0x6')](_0x1df2('0x48'),null);this['setDataValue'](_0x1df2('0x49'),null);this['setDataValue'](_0x1df2('0x4a'),null);this[_0x1df2('0x6')](_0x1df2('0x4b'),null);this[_0x1df2('0x6')](_0x1df2('0x4c'),null);this['setDataValue'](_0x1df2('0x4d'),null);this['setDataValue']('dtlscertfile',null);this[_0x1df2('0x6')](_0x1df2('0x4e'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x1df2('0x6')](_0x1df2('0x28'),_0x1df2('0x4f'));this[_0x1df2('0x6')](_0x1df2('0x50'),'yes');this['setDataValue']('avpf',_0x1df2('0x31'));this[_0x1df2('0x6')](_0x1df2('0x49'),_0x1df2('0x31'));this[_0x1df2('0x6')](_0x1df2('0x4a'),_0x1df2('0x31'));this[_0x1df2('0x6')](_0x1df2('0x4b'),'yes');this[_0x1df2('0x6')](_0x1df2('0x4c'),'no');this[_0x1df2('0x6')]('dtlssetup',_0x1df2('0x43'));this[_0x1df2('0x6')](_0x1df2('0x51'),_0x3fef18['dtlscertfile']||_0x1df2('0x52'));this['setDataValue'](_0x1df2('0x4e'),_0x3fef18[_0x1df2('0x4e')]||_0x1df2('0x53'));this[_0x1df2('0x6')](_0x1df2('0x54'),_0x1df2('0x31'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2fc664){this[_0x1df2('0x6')](_0x1df2('0x55'),_0x2fc664?_0x2fc664[_0x1df2('0x29')](','):[]);},'get':function(){return this[_0x1df2('0xd')]('permissions')?_[_0x1df2('0x56')](this[_0x1df2('0xd')](_0x1df2('0x55'))[_0x1df2('0x33')](','),function(_0x2bdb27){return parseInt(_0x2bdb27,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1df2('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x1df2('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1df2('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1df2('0x1b')](_0x1df2('0x31'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1df2('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1df2('0x57')],'get':function(){return this[_0x1df2('0xd')](_0x1df2('0x58'))?this[_0x1df2('0xd')](_0x1df2('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1df2('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1df2('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![],'set':function(_0x4cb7eb){if(typeof _0x4cb7eb===_0x1df2('0x59')){var _0x1166b1=_0x4cb7eb==='1'?!![]:_0x4cb7eb==='0'?![]:_0x4cb7eb===_0x1df2('0x5a')?!![]:_0x4cb7eb===_0x1df2('0x5b')?![]:![];this[_0x1df2('0x6')](_0x1df2('0x5c'),_0x1166b1);}else{this[_0x1df2('0x6')](_0x1df2('0x5c'),_0x4cb7eb);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x527bcf){this[_0x1df2('0x6')](_0x1df2('0x5d'),_0x527bcf);if(_0x527bcf===!![]){this[_0x1df2('0x6')](_0x1df2('0x5e'),moment());this[_0x1df2('0x6')]('loginAttempts',0x0);}else{this[_0x1df2('0x6')](_0x1df2('0x5e'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x1df2('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1df2('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1df2('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a1a8088..7a02b8d 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 _0x6e3b=['email','permissions','101','102','103','113','110','104','106','107','108','109','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','VoiceMail','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','checkUserLimits','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','addQueues','online','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','QueueId','Queue:remove','channel','destroy','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','includeAll','Tag','Tags','color','tag','getQueues','Unknown\x20channel','model','keys','Queue','rawAttributes','filters','intersection','fields','sort','Unknown\x20role','nolimit','getVoiceQueuesRt','order','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','x-forwarded-for','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','isMiddleware','logout','MemberReport','pause','QueuePause','PAUSE','updateAttributes','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','omit','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$notIn','$like','$iLike','$notILike','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','nonce','token','apiKeyNonce','whoami','getUserSetting','idle','unknown','teams','inbound','flatten','lower','col','asc','desc','substring','uniqBy','voiceStatus','unavailable','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','messengerSoundNotification','enabled','util','path','squel','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','status','json','undefined','count','offset','limit','set','Content-Range','request','then','info','debug','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','update','role','agent','emit','userNotification:recalc:','get','admin','Users','user','Agents','Telephones','telephone','filter','includes','value','name','UserProfileResource','end','sendStatus','stack','send','map','type','key','password','salt','resetPasswordExpires','md5secret','index','getOptions','where','User','query','true','UserSetting','attributes','push','findAll','openTabs','length','chat','rows','sms','dataValues','fax','mail','openchannel','whatsapp','all','params','include','userSetting','merge','options','body','find','describe','addContacts','ids','internal','Setting','findById','securePassword','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname'];(function(_0x67da44,_0x401003){var _0x256710=function(_0x9cc30e){while(--_0x9cc30e){_0x67da44['push'](_0x67da44['shift']());}};_0x256710(++_0x401003);}(_0x6e3b,0x116));var _0xb6e3=function(_0xac07d2,_0x49f9fb){_0xac07d2=_0xac07d2-0x0;var _0x35a24d=_0x6e3b[_0xac07d2];return _0x35a24d;};'use strict';var moment=require('moment');var util=require(_0xb6e3('0x0'));var path=require(_0xb6e3('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6e3('0x2'));var Redis=require('ioredis');var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require(_0xb6e3('0x3'));var qs=require(_0xb6e3('0x4'));var rta=require(_0xb6e3('0x5'));var logger=require(_0xb6e3('0x6'))(_0xb6e3('0x7'));var utils=require(_0xb6e3('0x8'));var config=require(_0xb6e3('0x9'));var licenseUtil=require(_0xb6e3('0xa'));var APIBadRequestError=require(_0xb6e3('0xb'))[_0xb6e3('0xc')];var APINotFoundError=require(_0xb6e3('0xb'))[_0xb6e3('0xd')];var APIForbiddenError=require(_0xb6e3('0xb'))[_0xb6e3('0xe')];var APIHandleError=require(_0xb6e3('0xb'))[_0xb6e3('0xf')];var db=require(_0xb6e3('0x10'))['db'];var socket=require(_0xb6e3('0x11'))(new Redis(config[_0xb6e3('0x12')]));require(_0xb6e3('0x13'))[_0xb6e3('0x14')](socket);config[_0xb6e3('0x12')]=_[_0xb6e3('0x15')](config['redis'],{'host':_0xb6e3('0x16'),'port':0x18eb});var amiClient=jayson[_0xb6e3('0x17')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x35c3fc,_0x495728){_0x495728=_0x495728||0xcc;return function(_0x34b6a4){if(_0x34b6a4){return _0x35c3fc['sendStatus'](_0x495728);}return _0x35c3fc['status'](_0x495728)['end']();};}function respondWithResult(_0x2567f0,_0x519322){_0x519322=_0x519322||0xc8;return function(_0x4b7659){if(_0x4b7659){return _0x2567f0[_0xb6e3('0x18')](_0x519322)[_0xb6e3('0x19')](_0x4b7659);}};}function respondWithFilteredResult(_0x107fe2,_0x3411e1){return function(_0x3839f3){if(_0x3839f3){var _0x518851=typeof _0x3411e1['offset']===_0xb6e3('0x1a')&&typeof _0x3411e1['limit']===_0xb6e3('0x1a');var _0x543ea4=_0x3839f3[_0xb6e3('0x1b')];var _0x31532e=_0x518851?0x0:_0x3411e1[_0xb6e3('0x1c')];var _0x125338=_0x518851?_0x3839f3[_0xb6e3('0x1b')]:_0x3411e1['offset']+_0x3411e1[_0xb6e3('0x1d')];var _0x12fd46;if(_0x125338>=_0x543ea4){_0x125338=_0x543ea4;_0x12fd46=0xc8;}else{_0x12fd46=0xce;}_0x107fe2[_0xb6e3('0x18')](_0x12fd46);return _0x107fe2[_0xb6e3('0x1e')](_0xb6e3('0x1f'),_0x31532e+'-'+_0x125338+'/'+_0x543ea4)['json'](_0x3839f3);}return null;};}function respondWithRpcPromise(_0x119f10,_0x3452c1,_0x6c21e1,_0x6b92bf){return new Promise(function(_0x2fc578,_0xfdb9f7){var _0x3e7b96=_0x6b92bf||amiClient;return _0x3e7b96[_0xb6e3('0x20')](_0x119f10,_0x6c21e1)[_0xb6e3('0x21')](function(_0x55a8a6){logger[_0xb6e3('0x22')]('User,\x20%s,\x20%s',_0x3452c1,'request\x20sent');logger[_0xb6e3('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x3452c1,_0xb6e3('0x24'),JSON[_0xb6e3('0x25')](_0x55a8a6));if(_0x55a8a6[_0xb6e3('0x26')]){if(_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x27')]===0x1f4){logger[_0xb6e3('0x26')](_0xb6e3('0x28'),_0x3452c1,_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);return _0xfdb9f7(_0x55a8a6['error'][_0xb6e3('0x29')]);}logger['error']('User,\x20%s,\x20%s',_0x3452c1,_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);return _0x2fc578(_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);}else{logger[_0xb6e3('0x22')](_0xb6e3('0x28'),_0x3452c1,'request\x20sent');_0x2fc578(_0x55a8a6[_0xb6e3('0x2a')][_0xb6e3('0x29')]);}})[_0xb6e3('0x2b')](function(_0x402d8b){logger[_0xb6e3('0x26')](_0xb6e3('0x28'),_0x3452c1,_0x402d8b);_0xfdb9f7(_0x402d8b);});});}function saveUpdates(_0xddca8){return function(_0x535754){if(_0x535754){return _0x535754[_0xb6e3('0x2c')](_0xddca8)['then'](function(_0x20374b){if(_0x20374b[_0xb6e3('0x2d')]===_0xb6e3('0x2e')){socket[_0xb6e3('0x2f')](_0xb6e3('0x30')+_0x20374b['id'],_0x20374b);}return _0x20374b;});}return null;};}function removeEntity(_0x2555c3,_0x13997d){return function(_0x23f25b){if(_0x23f25b){return _0x23f25b['destroy']({'transaction':_0x13997d})[_0xb6e3('0x21')](function(){var _0x5e9167=_0x23f25b[_0xb6e3('0x31')]({'plain':!![]});if(_0x5e9167['role']===_0xb6e3('0x32'))return;var _0x3fed1a=[{'name':_0xb6e3('0x33'),'value':_0xb6e3('0x34'),'ignore':!![]},{'name':_0xb6e3('0x35'),'value':_0xb6e3('0x2e'),'ignore':![]},{'name':_0xb6e3('0x36'),'value':_0xb6e3('0x37'),'ignore':![]}];var _0x3e296c=_(_0x3fed1a)[_0xb6e3('0x38')]('ignore')['map']('value')['value']();if(_[_0xb6e3('0x39')](_0x3e296c,_0x5e9167['role'])){return;}var _0x2220b0=_['find'](_0x3fed1a,[_0xb6e3('0x3a'),_0x5e9167['role']])[_0xb6e3('0x3b')];return db[_0xb6e3('0x3c')]['destroy']({'where':{'type':_0x2220b0,'resourceId':_0x5e9167['id']},'transaction':_0x13997d})['then'](function(){return _0x23f25b;});})[_0xb6e3('0x21')](function(){_0x2555c3[_0xb6e3('0x18')](0xcc)[_0xb6e3('0x3d')]();});}};}function handleEntityNotFound(_0x27114f){return function(_0x2b822b){if(!_0x2b822b){_0x27114f[_0xb6e3('0x3e')](0x194);}return _0x2b822b;};}function handleError(_0x2b6786,_0xf39288){_0xf39288=_0xf39288||0x1f4;return function(_0x340ee3){logger['error'](_0x340ee3[_0xb6e3('0x3f')]);if(_0x340ee3[_0xb6e3('0x3b')]){delete _0x340ee3[_0xb6e3('0x3b')];}_0x2b6786[_0xb6e3('0x18')](_0xf39288)[_0xb6e3('0x40')](_0x340ee3);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0xb6e3('0x41')](function(_0x48344c){return{'name':_0x48344c['fieldName'],'type':_0x48344c[_0xb6e3('0x42')][_0xb6e3('0x43')]};})['filter'](function(_0x52a460){return![_0xb6e3('0x44'),_0xb6e3('0x45'),'previousPasswords','resetPasswordToken',_0xb6e3('0x46'),_0xb6e3('0x47')][_0xb6e3('0x39')](_0x52a460[_0xb6e3('0x3b')]);})['value']();}exports[_0xb6e3('0x48')]=function(_0x3a3e33,_0x4b7395){var _0x161ed8={},_0x784449={'count':0x0,'rows':[]};var _0x27599f=getUserAttributes();_0x161ed8=qs[_0xb6e3('0x49')](_0x27599f,_0x3a3e33);var _0x47f6ae={'where':_0x161ed8[_0xb6e3('0x4a')]};return db[_0xb6e3('0x4b')][_0xb6e3('0x1b')](_0x47f6ae)['then'](function(_0x164c10){_0x784449[_0xb6e3('0x1b')]=_0x164c10;if(_0x3a3e33[_0xb6e3('0x4c')]['includeAll']){_0x161ed8['include']=[{'all':!![]}];}if(_0x3a3e33[_0xb6e3('0x4c')]['userSetting']===_0xb6e3('0x4d')){_0x161ed8['include']=[{'model':db[_0xb6e3('0x4e')],'as':'userSetting'}];}if(!_['includes'](_0x161ed8[_0xb6e3('0x4f')],'id')){_0x161ed8[_0xb6e3('0x4f')][_0xb6e3('0x50')]('id');}return db[_0xb6e3('0x4b')][_0xb6e3('0x51')](_0x161ed8);})[_0xb6e3('0x21')](function(_0x4b9382){_0x784449['rows']=_0x4b9382;if(_0x3a3e33[_0xb6e3('0x4c')][_0xb6e3('0x52')]===_0xb6e3('0x4d')){var _0x5ee2d2=[];for(var _0x44c54c=0x0;_0x44c54c<_0x784449['rows'][_0xb6e3('0x53')];_0x44c54c++){_0x5ee2d2['push'](get_open_tabs(_0xb6e3('0x54'),_0x784449[_0xb6e3('0x55')][_0x44c54c]['dataValues']));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x784449['rows'][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x58'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x59'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x784449[_0xb6e3('0x55')][_0x44c54c]['dataValues']));}return Promise[_0xb6e3('0x5c')](_0x5ee2d2)['then'](function(){return _0x784449;});}else{return _0x784449;}})['then'](respondWithFilteredResult(_0x4b7395,_0x161ed8))[_0xb6e3('0x2b')](handleError(_0x4b7395,null));};exports['show']=function(_0x16655f,_0x25589e){var _0x25cc58=getUserAttributes();_0x16655f[_0xb6e3('0x4c')]['id']=_0x16655f[_0xb6e3('0x5d')]['id'];var _0x57d00a=qs[_0xb6e3('0x49')](_0x25cc58,_0x16655f);if(_0x16655f[_0xb6e3('0x4c')]['includeAll']){_0x57d00a[_0xb6e3('0x5e')]=[{'all':!![]}];}if(_0x16655f[_0xb6e3('0x4c')][_0xb6e3('0x5f')]===_0xb6e3('0x4d')){_0x57d00a[_0xb6e3('0x5e')]=[{'model':db[_0xb6e3('0x4e')],'as':'userSetting'}];}_0x57d00a=_[_0xb6e3('0x60')]({},_0x57d00a,_0x16655f[_0xb6e3('0x61')]);if(!_[_0xb6e3('0x39')](_0x57d00a[_0xb6e3('0x4f')],'id')){_0x57d00a['attributes'][_0xb6e3('0x50')]('id');}return db[_0xb6e3('0x4b')]['find'](_0x57d00a)[_0xb6e3('0x21')](handleEntityNotFound(_0x25589e,null))['then'](function(_0x1260e3){var _0x276b6b=[];values=_0x1260e3;if(_0x16655f[_0xb6e3('0x4c')][_0xb6e3('0x52')]===_0xb6e3('0x4d')){_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x54'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs('fax',_0x1260e3['dataValues']));_0x276b6b[_0xb6e3('0x50')](get_open_tabs('mail',_0x1260e3['dataValues']));return Promise[_0xb6e3('0x5c')](_0x276b6b);}else{return values;}})[_0xb6e3('0x21')](function(){return values;})[_0xb6e3('0x21')](respondWithResult(_0x25589e,null))[_0xb6e3('0x2b')](handleError(_0x25589e,null));};exports[_0xb6e3('0x2c')]=function(_0x209008,_0xb0ea34){if(_0x209008['body']['id']){delete _0x209008['body']['id'];}delete _0x209008[_0xb6e3('0x62')][_0xb6e3('0x2d')];return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x209008[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0xb0ea34,null))[_0xb6e3('0x21')](saveUpdates(_0x209008[_0xb6e3('0x62')],null))['then'](respondWithResult(_0xb0ea34,null))['catch'](handleError(_0xb0ea34,null));};exports[_0xb6e3('0x64')]=function(_0x511cd6,_0x1e5dc5){return db[_0xb6e3('0x4b')][_0xb6e3('0x64')]()['then'](respondWithResult(_0x1e5dc5,null))[_0xb6e3('0x2b')](handleError(_0x1e5dc5,null));};exports[_0xb6e3('0x65')]=function(_0x498b99,_0x4697b0){return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x498b99[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4697b0,null))[_0xb6e3('0x21')](function(_0xc781a0){if(_0xc781a0){return _0xc781a0[_0xb6e3('0x65')](_0x498b99[_0xb6e3('0x62')][_0xb6e3('0x66')],_['omit'](_0x498b99[_0xb6e3('0x62')],[_0xb6e3('0x66'),'id'])||{});}})[_0xb6e3('0x21')](respondWithResult(_0x4697b0,null))[_0xb6e3('0x2b')](handleError(_0x4697b0,null));};function validateUser(_0x1e3534){return new Promise(function(_0x2e51a4,_0x4b8c85){if(_0x1e3534[_0xb6e3('0x67')])return _0x2e51a4(_0x1e3534);return db[_0xb6e3('0x68')][_0xb6e3('0x69')](0x1)[_0xb6e3('0x21')](function(_0x4f8a9a){if(_0x4f8a9a[_0xb6e3('0x6a')])authService['validatePasswordPattern'](_0x1e3534[_0xb6e3('0x44')]);db[_0xb6e3('0x4b')][_0xb6e3('0x6b')](_0xb6e3('0x67'))['then'](function(_0x238f34){if(_['isNil'](_0x238f34)){_0x1e3534['internal']=_0x4f8a9a[_0xb6e3('0x6c')]||0x1;return;}if(_[_0xb6e3('0x6d')](_0x4f8a9a['min_internal'])||_0x4f8a9a[_0xb6e3('0x6c')]===_0x238f34){_0x1e3534[_0xb6e3('0x67')]=_0x238f34+0x1;return;}if(_0x4f8a9a[_0xb6e3('0x6c')]>_0x238f34){_0x1e3534[_0xb6e3('0x67')]=_0x4f8a9a['min_internal'];return;}return db[_0xb6e3('0x6e')][_0xb6e3('0x4c')](_0xb6e3('0x6f'),{'type':db[_0xb6e3('0x6e')][_0xb6e3('0x70')][_0xb6e3('0x71')]})[_0xb6e3('0x21')](function(_0x2e7aa9){if(_0x2e7aa9&&_0x2e7aa9[_0xb6e3('0x53')]){for(var _0x2ffc8e=0x0,_0x4afd14=_0x2e7aa9[_0xb6e3('0x53')];_0x2ffc8e<_0x4afd14&&_[_0xb6e3('0x6d')](_0x1e3534[_0xb6e3('0x67')]);_0x2ffc8e++){if(_0x4f8a9a[_0xb6e3('0x6c')]<=_0x2e7aa9[_0x2ffc8e][_0xb6e3('0x72')]){_0x1e3534[_0xb6e3('0x67')]=_0x2e7aa9[_0x2ffc8e]['from'];}else if(_0x4f8a9a[_0xb6e3('0x6c')]>_0x2e7aa9[_0x2ffc8e][_0xb6e3('0x72')]&&_0x4f8a9a[_0xb6e3('0x6c')]<=_0x2e7aa9[_0x2ffc8e]['to']){_0x1e3534[_0xb6e3('0x67')]=_0x4f8a9a[_0xb6e3('0x6c')];}}}if(_[_0xb6e3('0x6d')](_0x1e3534['internal'])){_0x1e3534[_0xb6e3('0x67')]=_0x238f34+0x1;}return _0x2e51a4(_0x1e3534);});});})['catch'](function(_0x43b505){_0x4b8c85(_0x43b505);});});}function updateUser(_0xb22d37){return new Promise(function(_0x5f88b3,_0x11ff3a){try{if(_0xb22d37[_0xb6e3('0x73')]){_0xb22d37[_0xb6e3('0x74')]=_0xb22d37['internal'];_0xb22d37['VoiceMail']={'mailbox':_0xb22d37['internal'],'password':_0xb22d37[_0xb6e3('0x44')],'fullname':_0xb22d37[_0xb6e3('0x75')],'email':_0xb22d37[_0xb6e3('0x76')]};}if(_0xb22d37[_0xb6e3('0x2d')]==='agent'){if(!_0xb22d37['permissions'])_0xb22d37[_0xb6e3('0x77')]=[_0xb6e3('0x78'),_0xb6e3('0x79'),_0xb6e3('0x7a'),_0xb6e3('0x7b'),_0xb6e3('0x7c'),_0xb6e3('0x7d'),'105',_0xb6e3('0x7e'),_0xb6e3('0x7f'),_0xb6e3('0x80'),_0xb6e3('0x81'),'100','111',_0xb6e3('0x82'),_0xb6e3('0x83')];}_0x5f88b3(_0xb22d37);}catch(_0x5abcae){_0x11ff3a(_0x5abcae);}});}exports[_0xb6e3('0x84')]=function(_0x3f2cfc,_0x16ab7e){if(_0x3f2cfc[_0xb6e3('0x34')]['role']===_0xb6e3('0x2e'))throw new Error('Unauthorized');if(_0x3f2cfc['body']['role']===_0xb6e3('0x34')&&_0x3f2cfc['user'][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x85'));}if(_0x3f2cfc[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x32')&&_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x86'));}return licenseUtil['checkUserLimits']([_0x3f2cfc['body']])[_0xb6e3('0x21')](function(){return validateUser(_0x3f2cfc[_0xb6e3('0x62')]);})[_0xb6e3('0x21')](function(_0x2fbf06){return updateUser(_0x2fbf06)[_0xb6e3('0x21')](function(_0x152770){if(_0x152770[_0xb6e3('0x2d')]==='admin'){_0x152770[_0xb6e3('0x87')]=_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x87')];delete _0x152770['userProfileId'];}return _0x152770;});})['then'](function(_0x2b9fe3){return db[_0xb6e3('0x4b')][_0xb6e3('0x84')](_0x2b9fe3,{'include':[{'model':db[_0xb6e3('0x88')],'as':_0xb6e3('0x88')}]});})[_0xb6e3('0x21')](function(_0x65e5cf){if(_0x3f2cfc[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x34'))return _0x65e5cf;if(_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x34'))return _0x65e5cf;return db[_0xb6e3('0x89')]['find']({'where':{'name':_0x65e5cf[_0xb6e3('0x2d')]==='agent'?'Agents':'Telephones','userProfileId':_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x8a')]},'raw':!![]})[_0xb6e3('0x21')](function(_0x518b46){if(!_0x518b46||_0x518b46[_0xb6e3('0x8b')]!=0x0)return _0x65e5cf;return db[_0xb6e3('0x3c')][_0xb6e3('0x84')]({'name':_0x65e5cf[_0xb6e3('0x3b')],'resourceId':_0x65e5cf['id'],'type':_0x518b46[_0xb6e3('0x3b')],'sectionId':_0x518b46['id']},{})['then'](function(){return _0x65e5cf;});})[_0xb6e3('0x2b')](function(_0x8431ad){logger[_0xb6e3('0x26')](_0xb6e3('0x8c'),_0x8431ad);throw _0x8431ad;});})[_0xb6e3('0x21')](respondWithResult(_0x16ab7e,0xc9))[_0xb6e3('0x2b')](handleError(_0x16ab7e,null));};exports[_0xb6e3('0x8d')]=function(_0xb917e1,_0x45e7ac){var _0x187edf=_0xb917e1['body'];var _0x48f23a=[];if(_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x2e'))throw new Error(_0xb6e3('0x8e'));if(_[_0xb6e3('0x8f')](_0x187edf,[_0xb6e3('0x2d'),_0xb6e3('0x34')])&&_0xb917e1['user'][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x85'));}if(_[_0xb6e3('0x8f')](_0x187edf,[_0xb6e3('0x2d'),_0xb6e3('0x32')])&&_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xb6e3('0x90')](_0x187edf)[_0xb6e3('0x21')](function(){return validateUser(_0x187edf[0x0]);})[_0xb6e3('0x21')](function(){for(var _0x2f1f5a=0x1;_0x2f1f5a<_0x187edf[_0xb6e3('0x53')];_0x2f1f5a++){var _0x75c164=_0x187edf[_0x2f1f5a-0x1][_0xb6e3('0x67')];if(!_0x187edf[_0x2f1f5a][_0xb6e3('0x67')])_0x187edf[_0x2f1f5a]['internal']=_0x75c164+0x1;_0x48f23a[_0xb6e3('0x50')](validateUser(_0x187edf[_0x2f1f5a]));}return Promise[_0xb6e3('0x5c')](_0x48f23a);})['then'](function(){_0x48f23a=[];for(var _0x296a3a=0x0;_0x296a3a<_0x187edf[_0xb6e3('0x53')];_0x296a3a++){_0x48f23a['push'](updateUser(_0x187edf[_0x296a3a]));}return Promise[_0xb6e3('0x5c')](_0x48f23a);})[_0xb6e3('0x21')](function(){_0x48f23a=_0x187edf[_0xb6e3('0x41')](function(_0x5462a6){return db['User']['create'](_0x5462a6,{'include':[{'model':db['VoiceMail'],'as':_0xb6e3('0x88')}]})[_0xb6e3('0x21')](function(_0x5f8c38){_0x5462a6['id']=_0x5f8c38['id'];return _0x5462a6;});});return Promise[_0xb6e3('0x5c')](_0x48f23a);})[_0xb6e3('0x21')](function(_0x4441a3){if(_0xb917e1[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x34'))return _0x4441a3;if(_0xb917e1[_0xb6e3('0x34')]['role']!==_0xb6e3('0x34'))return _0x4441a3;var _0xdddf37=_[_0xb6e3('0x8f')](_0x4441a3,function(_0x1df197){return _0x1df197[_0xb6e3('0x2d')]===_0xb6e3('0x2e')||_0x1df197[_0xb6e3('0x2d')]===_0xb6e3('0x37');});if(!_0xdddf37)return _0x4441a3;return db[_0xb6e3('0x89')][_0xb6e3('0x51')]({'where':{'name':{'$or':[_0xb6e3('0x35'),_0xb6e3('0x36')]},'userProfileId':_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x8a')]},'raw':!![]})[_0xb6e3('0x21')](function(_0x1b96d2){if(_[_0xb6e3('0x91')](_0x1b96d2)||!_[_0xb6e3('0x8f')](_0x1b96d2,[_0xb6e3('0x8b'),0x0]))return _0x4441a3;_0x48f23a=[];var _0xaadd17=_(_0x1b96d2)[_0xb6e3('0x41')](function(_0x340389){if(_0x340389['autoAssociation']===0x1)return;return _0x340389[_0xb6e3('0x3b')]==='Agents'?_0xb6e3('0x2e'):_0xb6e3('0x37');})[_0xb6e3('0x92')]()['value']();for(var _0x204e99=0x0;_0x204e99<_0x4441a3[_0xb6e3('0x53')];_0x204e99++){if(!_[_0xb6e3('0x39')](_0xaadd17,_0x4441a3[_0x204e99][_0xb6e3('0x2d')]))return;var _0x3bb6fa=_0x4441a3[_0x204e99][_0xb6e3('0x2d')]===_0xb6e3('0x2e')?_0xb6e3('0x35'):_0xb6e3('0x36');_0x48f23a[_0xb6e3('0x50')](db[_0xb6e3('0x3c')]['create']({'name':_0x4441a3[_0x204e99][_0xb6e3('0x3b')],'resourceId':_0x4441a3[_0x204e99]['id'],'type':_0x3bb6fa,'sectionId':_[_0xb6e3('0x63')](_0x1b96d2,[_0xb6e3('0x3b'),_0x3bb6fa])['id']},{}));}return Promise[_0xb6e3('0x5c')](_0x48f23a);});})[_0xb6e3('0x21')](respondWithResult(_0x45e7ac,0xc9))['catch'](handleError(_0x45e7ac,null));};exports[_0xb6e3('0x93')]=function(_0x4d4152,_0x4644c7){if(_0x4d4152['body']['id']){delete _0x4d4152['body']['id'];}return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4d4152['params']['id']}})[_0xb6e3('0x21')](function(_0x2e0eba){if(!_0x2e0eba)return null;if(_0x2e0eba['id']===_0x4d4152[_0xb6e3('0x34')]['id']){if(!_0x4d4152[_0xb6e3('0x62')]['oldPassword']||!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x97'));}if(!_0x2e0eba['authenticate'](_0x4d4152[_0xb6e3('0x62')]['oldPassword'])){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x98'));}if(_0x4d4152[_0xb6e3('0x62')]['oldPassword']===_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0x99'));}}else if(_0x4d4152[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x32')){if(!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db['Sequelize'][(_0xb6e3('0x96'))](_0xb6e3('0x9a'));}}else if(_0x4d4152[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x34')){if(!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x9a'));}if(_0x2e0eba[_0xb6e3('0x2d')]!=='agent'){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0x8e'));}}else{throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))]('Unauthorized');}return _0x2e0eba;})['then'](handleEntityNotFound(_0x4644c7,null))[_0xb6e3('0x21')](function(_0x2da911){return db[_0xb6e3('0x68')][_0xb6e3('0x9b')]({'attributes':['id',_0xb6e3('0x6a'),'enforcePasswordHistory',_0xb6e3('0x9c')]})['then'](function(_0x5b5b19){if(_0x5b5b19[_0xb6e3('0x6a')])authService['validatePasswordPattern'](_0x4d4152['body'][_0xb6e3('0x94')]);if(!_0x5b5b19[_0xb6e3('0x9d')]||!_0x2da911[_0xb6e3('0x9e')])return _0x2da911;authService['validatePasswordHistory'](_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],_0x2da911[_0xb6e3('0x9e')],_0x5b5b19['passwordHistoryLimit']);return _0x2da911;})[_0xb6e3('0x21')](saveUpdates({'password':_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],'passwordResetAt':_0x4d4152['user']['id']==_0x4d4152['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],_0x2da911['previousPasswords'])},null));})[_0xb6e3('0x21')](respondWithResult(_0x4644c7,null))[_0xb6e3('0x2b')](handleError(_0x4644c7,null));};exports[_0xb6e3('0x9f')]=function(_0x2c1ff9,_0x19233e){var _0x41e3a4=_0x2c1ff9['body']['channel'];return db[_0xb6e3('0x4b')]['find']({'where':{'id':_0x2c1ff9[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),_0xb6e3('0xa0'),'loginInPause',_0xb6e3('0xa1'),_0xb6e3('0xa2')]})['then'](handleEntityNotFound(_0x19233e,null))[_0xb6e3('0x21')](function(_0x5a5b23){if(_0x5a5b23){if(!utils[_0xb6e3('0xa3')](_0x41e3a4)){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))]('Unknown\x20channel');}return _0x5a5b23[_0xb6e3('0xa4')+_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+_0xb6e3('0xa7')](_0x2c1ff9['body'][_0xb6e3('0x66')],{'penalty':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0xa8')]||0x0})[_0xb6e3('0xa9')](function(_0x415afd){for(var _0x23794d=0x0;_0x23794d<_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')][_0xb6e3('0x53')];_0x23794d+=0x1){var _0x34bc1d={'UserId':Number(_0x2c1ff9[_0xb6e3('0x5d')]['id'])};_0x34bc1d[_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+'QueueId']=Number(_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')][_0x23794d]);socket['emit'](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+'Queue:save',_0x34bc1d);}return _0x415afd;})[_0xb6e3('0x21')](function(){if(_0x41e3a4==='voice'){return db[_0xb6e3('0xaa')][_0xb6e3('0x51')]({'where':{'id':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb6e3('0x21')](function(_0x581fbc){var _0x2159c2=_0x5a5b23[_0xb6e3('0x31')]({'plain':!![]});var _0x46e297=[];if(_0x41e3a4==='voice'&&_0x2159c2['role']===_0xb6e3('0x2e')&&_0x2159c2[_0xb6e3('0xa0')]){for(let _0x391a80=0x0;_0x391a80<_0x581fbc['length'];_0x391a80+=0x1){_0x46e297[_0xb6e3('0x50')]({'membername':_0x2159c2[_0xb6e3('0x3b')],'UserId':_0x2159c2['id'],'queue_name':_0x581fbc[_0x391a80][_0xb6e3('0x3b')],'VoiceQueueId':_0x581fbc[_0x391a80]['id'],'interface':_[_0xb6e3('0x6d')](_0x2159c2[_0xb6e3('0xa2')])?util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x2159c2[_0xb6e3('0x3b')]):_0x2159c2['interface'],'paused':_0x2159c2[_0xb6e3('0xa1')]||![],'penalty':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0xa8')]||0x0});}return Promise[_0xb6e3('0x5c')](_0x46e297[_0xb6e3('0x41')](function(_0x58bd18){return db[_0xb6e3('0xad')][_0xb6e3('0xae')](_0x58bd18);}));}return _0x5a5b23;});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x19233e,null))['catch'](handleError(_0x19233e,null));};exports[_0xb6e3('0xaf')]=function(_0x4813ea,_0x3a2e81){var _0x434f7a,_0x162a71;return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4813ea['params']['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d')]})[_0xb6e3('0x21')](handleEntityNotFound(_0x3a2e81,null))[_0xb6e3('0x21')](function(_0x2707c6){if(_0x2707c6){_0x434f7a=_0x2707c6;if(!_0x4813ea[_0xb6e3('0x4c')]['channel']||!utils['isValidChannel'](_0x4813ea['query']['channel'])){throw new db[(_0xb6e3('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x2707c6[_0xb6e3('0xb0')+_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+'Queues'](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')]);}})[_0xb6e3('0x21')](function(_0x15ee34){if(_[_0xb6e3('0xb1')](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')])){for(var _0x46fd64=0x0;_0x46fd64<_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')]['length'];_0x46fd64+=0x1){_0x162a71={'UserId':Number(_0x4813ea[_0xb6e3('0x5d')]['id'])};_0x162a71[_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+_0xb6e3('0xb2')]=Number(_0x4813ea['query'][_0xb6e3('0x66')][_0x46fd64]);socket['emit'](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+_0xb6e3('0xb3'),_0x162a71);}}else{_0x162a71={'UserId':Number(_0x4813ea[_0xb6e3('0x5d')]['id'])};_0x162a71[_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0xb4')][_0xb6e3('0xa6')]())+'QueueId']=Number(_0x4813ea[_0xb6e3('0x4c')]['ids']);socket[_0xb6e3('0x2f')](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x4813ea['query'][_0xb6e3('0xb4')][_0xb6e3('0xa6')]())+_0xb6e3('0xb3'),_0x162a71);}return _0x15ee34;})[_0xb6e3('0x21')](function(){if(_0x4813ea['query'][_0xb6e3('0xb4')]==='voice'){return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'UserId':_0x4813ea['params']['id'],'VoiceQueueId':_0x4813ea[_0xb6e3('0x4c')]['ids']},'individualHooks':!![]})[_0xb6e3('0x21')](function(){return _0x434f7a;});}return _0x434f7a;})['then'](respondWithStatusCode(_0x3a2e81,null))[_0xb6e3('0x2b')](handleError(_0x3a2e81,null));};exports[_0xb6e3('0xb6')]=function(_0x2e01d6,_0x392777){_0x2e01d6[_0xb6e3('0x62')][_0xb6e3('0xb7')]=_0x2e01d6[_0xb6e3('0xb8')][_0xb6e3('0xb9')];return db['User']['find']({'where':{'id':_0x2e01d6[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x392777,null))[_0xb6e3('0x21')](saveUpdates(_0x2e01d6['body'],null))[_0xb6e3('0x21')](respondWithResult(_0x392777,null))[_0xb6e3('0x2b')](handleError(_0x392777,null));};exports[_0xb6e3('0xba')]=function(_0x8c69c8,_0x3a2566){var _0x587c35=path[_0xb6e3('0xbb')](config['root'],_0xb6e3('0xbc'));return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x8c69c8['params']['id']},'attributes':['id',_0xb6e3('0xb7')],'raw':!![]})[_0xb6e3('0x21')](handleEntityNotFound(_0x3a2566,null))[_0xb6e3('0x21')](function(_0x38581a){if(_0x38581a){if(_[_0xb6e3('0x6d')](_0x38581a[_0xb6e3('0xb7')])){return _0x3a2566[_0xb6e3('0xbd')](_0x587c35);}else{if(!fs[_0xb6e3('0xbe')](path[_0xb6e3('0xbb')](config[_0xb6e3('0xbf')],'server/files/images/',_0x38581a['userpic']))){return _0x3a2566[_0xb6e3('0xbd')](_0x587c35);}return _0x3a2566[_0xb6e3('0xbd')](path['join'](config[_0xb6e3('0xbf')],_0xb6e3('0xc0'),_0x38581a[_0xb6e3('0xb7')]));}}})[_0xb6e3('0x2b')](handleError(_0x3a2566,null));};exports['getOpenTabs']=function(_0x12080b,_0x14ac19){return db['User']['find']({'where':{'id':_0x12080b[_0xb6e3('0x5d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x14ac19,null))[_0xb6e3('0x21')](function(_0x235025){var _0x2ee84b=[];values=_0x235025[_0xb6e3('0x57')];_0x2ee84b[_0xb6e3('0x50')](get_open_tabs('chat',_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x235025['dataValues']));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x58'),_0x235025['dataValues']));_0x2ee84b['push'](get_open_tabs(_0xb6e3('0x59'),_0x235025[_0xb6e3('0x57')]));return Promise['all'](_0x2ee84b);})[_0xb6e3('0x21')](function(_0xfff082){if(_0xfff082){var _0x2043d4=_[_0xb6e3('0x41')](values[_0xb6e3('0xc1')],function(_0xa27d7f){return{'channel':_0xb6e3('0xc2'),'id':_0xa27d7f['id'],'createdAt':_0xa27d7f[_0xb6e3('0xc3')]};});var _0x509bd3=_['map'](values[_0xb6e3('0xc4')],function(_0x32757e){return{'channel':'FAX','id':_0x32757e['id'],'createdAt':_0x32757e[_0xb6e3('0xc3')]};});var _0x2da37c=_['map'](values[_0xb6e3('0xc5')],function(_0x4a5858){return{'channel':'OPENCHANNEL','id':_0x4a5858['id'],'createdAt':_0x4a5858[_0xb6e3('0xc3')]};});var _0x1596f7=_['map'](values[_0xb6e3('0xc6')],function(_0x32e78d){return{'channel':_0xb6e3('0xc7'),'id':_0x32e78d['id'],'createdAt':_0x32e78d[_0xb6e3('0xc3')]};});var _0xeb6561=_['map'](values[_0xb6e3('0xc8')],function(_0x203247){return{'channel':_0xb6e3('0xc9'),'id':_0x203247['id'],'createdAt':_0x203247[_0xb6e3('0xc3')]};});var _0x41ce98=_[_0xb6e3('0x41')](values[_0xb6e3('0xca')],function(_0xf5dfbe){return{'channel':'WHATSAPP','id':_0xf5dfbe['id'],'createdAt':_0xf5dfbe[_0xb6e3('0xc3')]};});var _0x5930ce=_[_0xb6e3('0xcb')](_0x2043d4,_0x509bd3,_0x2da37c,_0x1596f7,_0xeb6561,_0x41ce98);var _0xc16d07={'count':_0x5930ce[_0xb6e3('0x53')],'rows':_0x5930ce};return _0xc16d07;}else return null;})['then'](respondWithResult(_0x14ac19,null))[_0xb6e3('0x2b')](handleError(_0x14ac19,null));};exports[_0xb6e3('0xcc')]=function(_0x33965a,_0xeb9b3e){var _0x145e9a={};return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x33965a[_0xb6e3('0x5d')]['id']}})['then'](function(_0x434812){if(!_0x434812){throw new APINotFoundError(util[_0xb6e3('0xab')](_0xb6e3('0xcd'),_0x33965a[_0xb6e3('0x5d')]['id']));}return contacts[_0xb6e3('0x64')]();})[_0xb6e3('0x21')](function(_0x218d4b){_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0x4b')]=_0x33965a[_0xb6e3('0x5d')]['id'];_0x145e9a=qs[_0xb6e3('0x49')](_0x218d4b,_0x33965a);if(_0x33965a['query'][_0xb6e3('0xce')](_0xb6e3('0xcf'))){_0x145e9a[_0xb6e3('0x5e')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xb6e3('0xd0')],'as':_0xb6e3('0xd1'),'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0xd2')],'where':_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0xd3')]?{'id':_0x33965a[_0xb6e3('0x4c')]['tag']}:undefined,'required':_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0xd3')]?!![]:![]}];}return contacts[_0xb6e3('0x51')](_0x33965a[_0xb6e3('0x4c')],_0x33965a[_0xb6e3('0x34')],_0x145e9a,_0x218d4b);})[_0xb6e3('0x21')](respondWithFilteredResult(_0xeb9b3e,_0x145e9a))[_0xb6e3('0x2b')](APIHandleError(_0xeb9b3e));};exports[_0xb6e3('0xd4')]=function(_0x257706,_0x59f381){var _0x2c0b35;var _0x355b8e={};var _0x584985;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x257706[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),'role']})[_0xb6e3('0x21')](handleEntityNotFound(_0x59f381,null))[_0xb6e3('0x21')](function(_0x2d24de){if(!utils[_0xb6e3('0xa3')](_0x257706['query'][_0xb6e3('0xb4')])){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0xd5'));}_0x2c0b35=_0x2d24de;var _0x3788b1={};_0x3788b1[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_[_0xb6e3('0xa5')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0xb4')])+_0xb6e3('0xd8')][_0xb6e3('0xd9')]);_0x3788b1['query']=_[_0xb6e3('0xd7')](_0x257706[_0xb6e3('0x4c')]);_0x3788b1[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x3788b1[_0xb6e3('0xd6')],_0x3788b1[_0xb6e3('0x4c')]);_0x355b8e[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x3788b1[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x257706['query'][_0xb6e3('0xdc')]));_0x355b8e[_0xb6e3('0x4f')]=_0x355b8e[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x355b8e[_0xb6e3('0x4f')]:_0x3788b1[_0xb6e3('0xd6')];_0x355b8e['order']=qs[_0xb6e3('0xdd')](_0x257706['query'][_0xb6e3('0xdd')]);_0x355b8e[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_['pick'](_0x257706[_0xb6e3('0x4c')],_0x3788b1[_0xb6e3('0xda')]));if(_0x257706['query'][_0xb6e3('0x38')]){_0x355b8e[_0xb6e3('0x4a')]=_['merge'](_0x355b8e[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x355b8e[_0xb6e3('0x4f')],function(_0x4290e3){var _0x2ec734={};_0x2ec734[_0x4290e3]={'$like':'%'+_0x257706['query'][_0xb6e3('0x38')]+'%'};return _0x2ec734;})});}_0x355b8e=_[_0xb6e3('0x60')]({},_0x355b8e,_0x257706[_0xb6e3('0x61')]);switch(_0x2c0b35['role']){case _0xb6e3('0x32'):return db[_[_0xb6e3('0xa5')](_0x257706['query'][_0xb6e3('0xb4')])+'Queue'][_0xb6e3('0x51')](_0x355b8e);case _0xb6e3('0x34'):case'agent':return _0x2c0b35[_0xb6e3('0x31')+_[_0xb6e3('0xa5')](_0x257706['query'][_0xb6e3('0xb4')])+_0xb6e3('0xa7')](_0x355b8e);default:throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0xde'));}})[_0xb6e3('0x21')](function(_0x372d41){_0x584985=_0x372d41['length'];if(!_0x257706[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x355b8e['limit']=qs[_0xb6e3('0x1d')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x355b8e['offset']=qs[_0xb6e3('0x1c')](_0x257706[_0xb6e3('0x4c')]['offset']);}switch(_0x2c0b35['role']){case _0xb6e3('0x32'):return db[_[_0xb6e3('0xa5')](_0x257706['query']['channel'])+_0xb6e3('0xd8')][_0xb6e3('0x51')](_0x355b8e);case _0xb6e3('0x34'):case _0xb6e3('0x2e'):return _0x2c0b35[_0xb6e3('0x31')+_[_0xb6e3('0xa5')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0xb4')])+'Queues'](_0x355b8e);}})[_0xb6e3('0x21')](function(_0x2343db){return{'count':_0x584985,'rows':_0x2343db};})[_0xb6e3('0x21')](respondWithResult(_0x59f381,null))[_0xb6e3('0x2b')](handleError(_0x59f381,null));};exports[_0xb6e3('0xe0')]=function(_0x4fa3e2,_0x49a10c){var _0x403cb9={};var _0x8b7403={};var _0x48e1c2;var _0x8280df;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x4fa3e2[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x49a10c,null))['then'](function(_0xf9a538){if(_0xf9a538){_0x48e1c2=_0xf9a538;_0x8b7403['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xad')][_0xb6e3('0xd9')]);_0x8b7403[_0xb6e3('0x4c')]=_['keys'](_0x4fa3e2[_0xb6e3('0x4c')]);_0x8b7403['filters']=_[_0xb6e3('0xdb')](_0x8b7403['model'],_0x8b7403[_0xb6e3('0x4c')]);_0x403cb9[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x8b7403['model'],qs[_0xb6e3('0xdc')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x403cb9[_0xb6e3('0x4f')]=_0x403cb9[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x403cb9[_0xb6e3('0x4f')]:_0x8b7403[_0xb6e3('0xd6')];_0x403cb9[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x403cb9['where']=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x4fa3e2[_0xb6e3('0x4c')],_0x8b7403[_0xb6e3('0xda')]));if(_0x4fa3e2['query'][_0xb6e3('0x38')]){_0x403cb9['where']=_['merge'](_0x403cb9[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x403cb9[_0xb6e3('0x4f')],function(_0x13a3ad){var _0x14adf4={};_0x14adf4[_0x13a3ad]={'$like':'%'+_0x4fa3e2['query']['filter']+'%'};return _0x14adf4;})});}_0x403cb9=_['merge']({},_0x403cb9,_0x4fa3e2[_0xb6e3('0x61')]);return _0x48e1c2[_0xb6e3('0xe0')](_0x403cb9);}})[_0xb6e3('0x21')](function(_0x204908){if(_0x204908){_0x8280df=_0x204908[_0xb6e3('0x53')];if(!_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x403cb9['limit']=qs[_0xb6e3('0x1d')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x403cb9['offset']=qs['offset'](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x48e1c2[_0xb6e3('0xe0')](_0x403cb9);}})[_0xb6e3('0x21')](function(_0x449347){if(_0x449347){return _0x449347?{'count':_0x8280df,'rows':_0x449347}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x49a10c,null))[_0xb6e3('0x2b')](handleError(_0x49a10c,null));};exports[_0xb6e3('0xe3')]=function(_0x1e59d0,_0x503e20){var _0xb91afa={};var _0x4a3012={};var _0x1cf72d;var _0x505736;return db['User']['findOne']({'where':{'id':_0x1e59d0[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x503e20,null))[_0xb6e3('0x21')](function(_0x4e612a){if(_0x4e612a){_0x1cf72d=_0x4e612a;_0x4a3012[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe4')][_0xb6e3('0xd9')]);_0x4a3012['query']=_[_0xb6e3('0xd7')](_0x1e59d0[_0xb6e3('0x4c')]);_0x4a3012[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x4a3012['model'],_0x4a3012[_0xb6e3('0x4c')]);_0xb91afa['attributes']=_[_0xb6e3('0xdb')](_0x4a3012[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x1e59d0['query'][_0xb6e3('0xdc')]));_0xb91afa[_0xb6e3('0x4f')]=_0xb91afa[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0xb91afa['attributes']:_0x4a3012[_0xb6e3('0xd6')];_0xb91afa[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0xb91afa[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0x1e59d0[_0xb6e3('0x4c')],_0x4a3012[_0xb6e3('0xda')]));if(_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0xb91afa[_0xb6e3('0x4a')]=_['merge'](_0xb91afa[_0xb6e3('0x4a')],{'$or':_['map'](_0xb91afa[_0xb6e3('0x4f')],function(_0x166a99){var _0x4613e2={};_0x4613e2[_0x166a99]={'$like':'%'+_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x4613e2;})});}_0xb91afa=_[_0xb6e3('0x60')]({},_0xb91afa,_0x1e59d0['options']);return _0x1cf72d[_0xb6e3('0xe3')](_0xb91afa);}})[_0xb6e3('0x21')](function(_0x1cbb18){if(_0x1cbb18){_0x505736=_0x1cbb18[_0xb6e3('0x53')];if(!_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0xce')]('nolimit')){_0xb91afa[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0xb91afa[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1cf72d['getGroups'](_0xb91afa);}})[_0xb6e3('0x21')](function(_0x548e8b){if(_0x548e8b){return _0x548e8b?{'count':_0x505736,'rows':_0x548e8b}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x503e20,null))[_0xb6e3('0x2b')](handleError(_0x503e20,null));};exports[_0xb6e3('0xe5')]=function(_0x48ad30,_0x4fba09){var _0x2cc76a={'raw':!![],'where':{}};var _0x44173d={};var _0x29f840={'count':0x0,'rows':[]};return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x48ad30['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4fba09,null))['then'](function(_0x4bea31){if(_0x4bea31){_0x44173d[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe6')][_0xb6e3('0xd9')]);_0x44173d[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x48ad30['query']);_0x44173d[_0xb6e3('0xda')]=_['intersection'](_0x44173d[_0xb6e3('0xd6')],_0x44173d['query']);_0x2cc76a[_0xb6e3('0x4f')]=_['intersection'](_0x44173d['model'],qs['fields'](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x2cc76a[_0xb6e3('0x4f')]=_0x2cc76a['attributes'][_0xb6e3('0x53')]?_0x2cc76a[_0xb6e3('0x4f')]:_0x44173d[_0xb6e3('0xd6')];if(!_0x48ad30[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x2cc76a[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x2cc76a[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x2cc76a[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x48ad30['query'][_0xb6e3('0xdd')]);_0x2cc76a[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x48ad30['query'],_0x44173d['filters']));_0x2cc76a[_0xb6e3('0x4a')][_0xb6e3('0xe7')]=_0x4bea31['id'];if(_0x48ad30['query'][_0xb6e3('0x38')]){_0x2cc76a['where']=_[_0xb6e3('0x60')](_0x2cc76a[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x2cc76a[_0xb6e3('0x4f')],function(_0x279874){var _0x1a7fff={};_0x1a7fff[_0x279874]={'$like':'%'+_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x1a7fff;})});}_0x2cc76a=_['merge']({},_0x2cc76a,_0x48ad30[_0xb6e3('0x61')]);return db[_0xb6e3('0xe6')][_0xb6e3('0x1b')]({'where':_0x2cc76a['where']})[_0xb6e3('0x21')](function(_0x9b9d42){_0x29f840[_0xb6e3('0x1b')]=_0x9b9d42;if(_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0xcf')]){_0x2cc76a[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xe6')][_0xb6e3('0x51')](_0x2cc76a);})[_0xb6e3('0x21')](function(_0x535b5a){_0x29f840['rows']=_0x535b5a;return _0x29f840;});}})[_0xb6e3('0x21')](respondWithFilteredResult(_0x4fba09,_0x2cc76a))[_0xb6e3('0x2b')](handleError(_0x4fba09,null));};exports[_0xb6e3('0xe8')]=function(_0xac9374,_0xd7cff7){var _0x373e09={'raw':!![],'where':{}};var _0x2e4a0a={};var _0x474ffa={'count':0x0,'rows':[]};return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0xac9374[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0xd7cff7,null))[_0xb6e3('0x21')](function(_0x944be){if(_0x944be){_0x2e4a0a['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe9')][_0xb6e3('0xd9')]);_0x2e4a0a[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0xac9374[_0xb6e3('0x4c')]);_0x2e4a0a['filters']=_[_0xb6e3('0xdb')](_0x2e4a0a[_0xb6e3('0xd6')],_0x2e4a0a[_0xb6e3('0x4c')]);_0x373e09['attributes']=_[_0xb6e3('0xdb')](_0x2e4a0a['model'],qs[_0xb6e3('0xdc')](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x373e09['attributes']=_0x373e09[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x373e09['attributes']:_0x2e4a0a[_0xb6e3('0xd6')];if(!_0xac9374['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x373e09['limit']=qs[_0xb6e3('0x1d')](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x373e09[_0xb6e3('0x1c')]=qs['offset'](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x373e09[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0xac9374[_0xb6e3('0x4c')]['sort']);_0x373e09['where']=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0xac9374['query'],_0x2e4a0a[_0xb6e3('0xda')]));_0x373e09[_0xb6e3('0x4a')]['UserId']=_0x944be['id'];if(_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x373e09['where']=_[_0xb6e3('0x60')](_0x373e09[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x373e09[_0xb6e3('0x4f')],function(_0x487ae3){var _0x59b02b={};_0x59b02b[_0x487ae3]={'$like':'%'+_0xac9374['query'][_0xb6e3('0x38')]+'%'};return _0x59b02b;})});}_0x373e09=_['merge']({},_0x373e09,_0xac9374['options']);return db[_0xb6e3('0xe9')][_0xb6e3('0x1b')]({'where':_0x373e09['where']})[_0xb6e3('0x21')](function(_0x58df75){_0x474ffa[_0xb6e3('0x1b')]=_0x58df75;if(_0xac9374['query'][_0xb6e3('0xcf')]){_0x373e09[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xe9')][_0xb6e3('0x51')](_0x373e09);})[_0xb6e3('0x21')](function(_0x1148d6){_0x474ffa[_0xb6e3('0x55')]=_0x1148d6;return _0x474ffa;});}})[_0xb6e3('0x21')](respondWithFilteredResult(_0xd7cff7,_0x373e09))[_0xb6e3('0x2b')](handleError(_0xd7cff7,null));};exports[_0xb6e3('0xea')]=function(_0x3ab862,_0xe362de){var _0x345695={};var _0x1dcde8={};var _0x1eb193;var _0x8b915d;return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x3ab862[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0xe362de,null))[_0xb6e3('0x21')](function(_0x381ec5){if(_0x381ec5){_0x1eb193=_0x381ec5;_0x1dcde8[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xeb')][_0xb6e3('0xd9')]);_0x1dcde8[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x3ab862['query']);_0x1dcde8['filters']=_['intersection'](_0x1dcde8[_0xb6e3('0xd6')],_0x1dcde8[_0xb6e3('0x4c')]);_0x345695[_0xb6e3('0x4f')]=_['intersection'](_0x1dcde8[_0xb6e3('0xd6')],qs['fields'](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x345695[_0xb6e3('0x4f')]=_0x345695[_0xb6e3('0x4f')]['length']?_0x345695[_0xb6e3('0x4f')]:_0x1dcde8[_0xb6e3('0xd6')];_0x345695[_0xb6e3('0xe1')]=qs['sort'](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x345695[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x3ab862[_0xb6e3('0x4c')],_0x1dcde8['filters']));if(_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x345695[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x345695[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x345695[_0xb6e3('0x4f')],function(_0x529f2a){var _0x3852fd={};_0x3852fd[_0x529f2a]={'$like':'%'+_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x3852fd;})});}_0x345695=_[_0xb6e3('0x60')]({},_0x345695,_0x3ab862[_0xb6e3('0x61')]);return _0x1eb193['getChatInteractions'](_0x345695);}})[_0xb6e3('0x21')](function(_0x10f943){if(_0x10f943){_0x8b915d=_0x10f943['length'];if(!_0x3ab862['query']['hasOwnProperty']('nolimit')){_0x345695[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x345695[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1eb193[_0xb6e3('0xea')](_0x345695);}})['then'](function(_0x4fcb88){if(_0x4fcb88){return _0x4fcb88?{'count':_0x8b915d,'rows':_0x4fcb88}:null;}})[_0xb6e3('0x21')](respondWithResult(_0xe362de,null))[_0xb6e3('0x2b')](handleError(_0xe362de,null));};exports['getOpenchannelInteractions']=function(_0x426598,_0x59342d){var _0x3861ad={};var _0x547091={};var _0x49fe73;var _0x1fdc31;return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x426598['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x59342d,null))[_0xb6e3('0x21')](function(_0x41d70d){if(_0x41d70d){_0x49fe73=_0x41d70d;_0x547091[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db['OpenchannelInteraction'][_0xb6e3('0xd9')]);_0x547091[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x426598[_0xb6e3('0x4c')]);_0x547091[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x547091[_0xb6e3('0xd6')],_0x547091[_0xb6e3('0x4c')]);_0x3861ad[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x547091[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x426598[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x3861ad[_0xb6e3('0x4f')]=_0x3861ad[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x3861ad[_0xb6e3('0x4f')]:_0x547091[_0xb6e3('0xd6')];_0x3861ad[_0xb6e3('0xe1')]=qs['sort'](_0x426598[_0xb6e3('0x4c')]['sort']);_0x3861ad[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0x426598[_0xb6e3('0x4c')],_0x547091[_0xb6e3('0xda')]));if(_0x426598[_0xb6e3('0x4c')]['filter']){_0x3861ad[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x3861ad[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x3861ad['attributes'],function(_0xb8e14d){var _0x7295a4={};_0x7295a4[_0xb8e14d]={'$like':'%'+_0x426598['query'][_0xb6e3('0x38')]+'%'};return _0x7295a4;})});}_0x3861ad=_[_0xb6e3('0x60')]({},_0x3861ad,_0x426598['options']);return _0x49fe73[_0xb6e3('0xec')](_0x3861ad);}})['then'](function(_0x188ee7){if(_0x188ee7){_0x1fdc31=_0x188ee7[_0xb6e3('0x53')];if(!_0x426598[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x3861ad[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x426598[_0xb6e3('0x4c')]['limit']);_0x3861ad['offset']=qs[_0xb6e3('0x1c')](_0x426598[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x49fe73['getOpenchannelInteractions'](_0x3861ad);}})[_0xb6e3('0x21')](function(_0x414e77){if(_0x414e77){return _0x414e77?{'count':_0x1fdc31,'rows':_0x414e77}:null;}})['then'](respondWithResult(_0x59342d,null))[_0xb6e3('0x2b')](handleError(_0x59342d,null));};exports[_0xb6e3('0xed')]=function(_0x294fa9,_0x596525){var _0x596a72={'raw':!![],'where':{}};var _0x166874={};var _0x4125de={'count':0x0,'rows':[]};return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x294fa9[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x596525,null))[_0xb6e3('0x21')](function(_0x48bb51){if(_0x48bb51){_0x166874['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xee')][_0xb6e3('0xd9')]);_0x166874[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x294fa9[_0xb6e3('0x4c')]);_0x166874[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x166874['model'],_0x166874[_0xb6e3('0x4c')]);_0x596a72['attributes']=_[_0xb6e3('0xdb')](_0x166874['model'],qs[_0xb6e3('0xdc')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x596a72[_0xb6e3('0x4f')]=_0x596a72[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x596a72[_0xb6e3('0x4f')]:_0x166874['model'];if(!_0x294fa9['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x596a72['limit']=qs[_0xb6e3('0x1d')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x596a72[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x596a72['order']=qs['sort'](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x596a72['where']=qs[_0xb6e3('0xda')](_['pick'](_0x294fa9[_0xb6e3('0x4c')],_0x166874[_0xb6e3('0xda')]));_0x596a72[_0xb6e3('0x4a')]['UserId']=_0x48bb51['id'];if(_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x596a72[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x596a72[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x596a72[_0xb6e3('0x4f')],function(_0x33feed){var _0x5de32f={};_0x5de32f[_0x33feed]={'$like':'%'+_0x294fa9[_0xb6e3('0x4c')]['filter']+'%'};return _0x5de32f;})});}_0x596a72=_[_0xb6e3('0x60')]({},_0x596a72,_0x294fa9['options']);return db['MailInteraction'][_0xb6e3('0x1b')]({'where':_0x596a72[_0xb6e3('0x4a')]})['then'](function(_0x329c04){_0x4125de[_0xb6e3('0x1b')]=_0x329c04;if(_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xcf')]){_0x596a72[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xee')][_0xb6e3('0x51')](_0x596a72);})[_0xb6e3('0x21')](function(_0x343166){_0x4125de[_0xb6e3('0x55')]=_0x343166;return _0x4125de;});}})['then'](respondWithFilteredResult(_0x596525,_0x596a72))['catch'](handleError(_0x596525,null));};exports['getSmsInteractions']=function(_0xe64646,_0x451299){var _0x4b4d07={};var _0x303012={};var _0x2ec483;var _0x2146a6;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0xe64646['params']['id']}})['then'](handleEntityNotFound(_0x451299,null))[_0xb6e3('0x21')](function(_0x2c02a2){if(_0x2c02a2){_0x2ec483=_0x2c02a2;_0x303012[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xef')]['rawAttributes']);_0x303012['query']=_[_0xb6e3('0xd7')](_0xe64646['query']);_0x303012[_0xb6e3('0xda')]=_['intersection'](_0x303012[_0xb6e3('0xd6')],_0x303012['query']);_0x4b4d07[_0xb6e3('0x4f')]=_['intersection'](_0x303012['model'],qs[_0xb6e3('0xdc')](_0xe64646[_0xb6e3('0x4c')]['fields']));_0x4b4d07[_0xb6e3('0x4f')]=_0x4b4d07[_0xb6e3('0x4f')]['length']?_0x4b4d07['attributes']:_0x303012[_0xb6e3('0xd6')];_0x4b4d07['order']=qs[_0xb6e3('0xdd')](_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x4b4d07[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0xe64646[_0xb6e3('0x4c')],_0x303012['filters']));if(_0xe64646['query'][_0xb6e3('0x38')]){_0x4b4d07[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x4b4d07['where'],{'$or':_[_0xb6e3('0x41')](_0x4b4d07[_0xb6e3('0x4f')],function(_0x3125c3){var _0x36bb6a={};_0x36bb6a[_0x3125c3]={'$like':'%'+_0xe64646['query'][_0xb6e3('0x38')]+'%'};return _0x36bb6a;})});}_0x4b4d07=_[_0xb6e3('0x60')]({},_0x4b4d07,_0xe64646['options']);return _0x2ec483[_0xb6e3('0xf0')](_0x4b4d07);}})[_0xb6e3('0x21')](function(_0x56d474){if(_0x56d474){_0x2146a6=_0x56d474['length'];if(!_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0xce')]('nolimit')){_0x4b4d07['limit']=qs[_0xb6e3('0x1d')](_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x4b4d07['offset']=qs[_0xb6e3('0x1c')](_0xe64646['query']['offset']);}return _0x2ec483['getSmsInteractions'](_0x4b4d07);}})[_0xb6e3('0x21')](function(_0x98d46e){if(_0x98d46e){return _0x98d46e?{'count':_0x2146a6,'rows':_0x98d46e}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x451299,null))[_0xb6e3('0x2b')](handleError(_0x451299,null));};exports[_0xb6e3('0xf1')]=function(_0x2cb34e,_0x5f1b18){var _0x2cb03b={};var _0x4058d8={};var _0x49d4a4;var _0x2f3fcf;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x2cb34e[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5f1b18,null))[_0xb6e3('0x21')](function(_0x4cfd40){if(_0x4cfd40){_0x49d4a4=_0x4cfd40;_0x4058d8[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xf2')][_0xb6e3('0xd9')]);_0x4058d8['query']=_[_0xb6e3('0xd7')](_0x2cb34e[_0xb6e3('0x4c')]);_0x4058d8['filters']=_[_0xb6e3('0xdb')](_0x4058d8[_0xb6e3('0xd6')],_0x4058d8['query']);_0x2cb03b[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x4058d8[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x2cb03b[_0xb6e3('0x4f')]=_0x2cb03b['attributes'][_0xb6e3('0x53')]?_0x2cb03b[_0xb6e3('0x4f')]:_0x4058d8[_0xb6e3('0xd6')];_0x2cb03b[_0xb6e3('0xe1')]=qs['sort'](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x2cb03b[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x2cb34e[_0xb6e3('0x4c')],_0x4058d8[_0xb6e3('0xda')]));if(_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x2cb03b[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x2cb03b[_0xb6e3('0x4a')],{'$or':_['map'](_0x2cb03b[_0xb6e3('0x4f')],function(_0x867e8f){var _0x177f4c={};_0x177f4c[_0x867e8f]={'$like':'%'+_0x2cb34e['query'][_0xb6e3('0x38')]+'%'};return _0x177f4c;})});}_0x2cb03b=_[_0xb6e3('0x60')]({},_0x2cb03b,_0x2cb34e[_0xb6e3('0x61')]);return _0x49d4a4[_0xb6e3('0xf1')](_0x2cb03b);}})[_0xb6e3('0x21')](function(_0x5877fa){if(_0x5877fa){_0x2f3fcf=_0x5877fa['length'];if(!_0x2cb34e['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x2cb03b[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x2cb03b[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x2cb34e[_0xb6e3('0x4c')]['offset']);}return _0x49d4a4[_0xb6e3('0xf1')](_0x2cb03b);}})[_0xb6e3('0x21')](function(_0x55f4b0){if(_0x55f4b0){return _0x55f4b0?{'count':_0x2f3fcf,'rows':_0x55f4b0}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x5f1b18,null))[_0xb6e3('0x2b')](handleError(_0x5f1b18,null));};exports[_0xb6e3('0xf3')]=function(_0x5cd95b,_0x31a696){var _0x283fb6={};var _0x2cc6d3={};var _0xb3b397;var _0x350e30;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x5cd95b[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x31a696,null))[_0xb6e3('0x21')](function(_0x41f570){if(_0x41f570){_0xb3b397=_0x41f570;_0x2cc6d3['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xf4')]['rawAttributes']);_0x2cc6d3[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x5cd95b['query']);_0x2cc6d3[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x2cc6d3[_0xb6e3('0xd6')],_0x2cc6d3[_0xb6e3('0x4c')]);_0x283fb6[_0xb6e3('0x4f')]=_['intersection'](_0x2cc6d3['model'],qs['fields'](_0x5cd95b[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x283fb6[_0xb6e3('0x4f')]=_0x283fb6[_0xb6e3('0x4f')]['length']?_0x283fb6[_0xb6e3('0x4f')]:_0x2cc6d3['model'];_0x283fb6[_0xb6e3('0xe1')]=qs['sort'](_0x5cd95b[_0xb6e3('0x4c')]['sort']);_0x283fb6['where']=qs[_0xb6e3('0xda')](_['pick'](_0x5cd95b[_0xb6e3('0x4c')],_0x2cc6d3[_0xb6e3('0xda')]));if(_0x5cd95b[_0xb6e3('0x4c')]['filter']){_0x283fb6['where']=_[_0xb6e3('0x60')](_0x283fb6[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x283fb6[_0xb6e3('0x4f')],function(_0x4be9e4){var _0x532a2a={};_0x532a2a[_0x4be9e4]={'$like':'%'+_0x5cd95b[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x532a2a;})});}_0x283fb6=_[_0xb6e3('0x60')]({},_0x283fb6,_0x5cd95b[_0xb6e3('0x61')]);return _0xb3b397[_0xb6e3('0xf3')](_0x283fb6);}})[_0xb6e3('0x21')](function(_0x3199df){if(_0x3199df){_0x350e30=_0x3199df['length'];if(!_0x5cd95b['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x283fb6[_0xb6e3('0x1d')]=qs['limit'](_0x5cd95b[_0xb6e3('0x4c')]['limit']);_0x283fb6[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x5cd95b['query'][_0xb6e3('0x1c')]);}return _0xb3b397[_0xb6e3('0xf3')](_0x283fb6);}})[_0xb6e3('0x21')](function(_0x5c4c8c){if(_0x5c4c8c){return _0x5c4c8c?{'count':_0x350e30,'rows':_0x5c4c8c}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x31a696,null))[_0xb6e3('0x2b')](handleError(_0x31a696,null));};exports[_0xb6e3('0xf5')]=function(_0x1c1203,_0x5d0df7,_0x1308f8){var _0x7cc858;var _0x4929fd;var _0x427e8a;var _0x34434f=!_[_0xb6e3('0x6d')](_0x1c1203['params']['id'])?_0x1c1203[_0xb6e3('0x5d')]['id']:!_['isNil'](_0x1c1203[_0xb6e3('0x34')]['id'])?_0x1c1203[_0xb6e3('0x34')]['id']:null;return db['User'][_0xb6e3('0x63')]({'where':{'id':_0x34434f,'role':{'$or':['admin','user',_0xb6e3('0x2e')]}},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0xf6'),'mobile',_0xb6e3('0x2d'),_0xb6e3('0x67'),_0xb6e3('0xf7')]})['then'](function(_0x5db2e7){if(_0x5db2e7){if(_0x5db2e7[_0xb6e3('0x2d')]===_0xb6e3('0x2e')){_0x7cc858=_0x5db2e7;if(_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xa2')]){_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xf8'),_0x7cc858[_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xa2')]]);}else if(_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xf9')]){_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xf9')]);}else{_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x7cc858[_0xb6e3('0x3b')]);}socket['to'](util[_0xb6e3('0xab')]('user:%s',_0x7cc858[_0xb6e3('0x3b')]))[_0xb6e3('0x2f')]('user:forcelogout',{'user':{'id':_0x7cc858['id'],'name':_0x7cc858[_0xb6e3('0x3b')]},'ip':_0x1c1203['headers'][_0xb6e3('0xfa')]||_0x1c1203['connection'][_0xb6e3('0xfb')]||_0x1c1203[_0xb6e3('0xfc')][_0xb6e3('0xfb')]||_0x1c1203['connection'][_0xb6e3('0xfc')][_0xb6e3('0xfb')]});return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'membername':_0x7cc858['name']},'individualHooks':!![]});}}else{throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0xfd'));}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return _0x7cc858[_0xb6e3('0xfe')]({'raw':!![]});}})['then'](function(_0xc080a5){if(_0x7cc858){if(_0xc080a5){_0x4929fd=_0xc080a5;if(_0x4929fd['length']){var _0x176e3c=_0x4929fd['map'](function(_0x5a4770){var _0xe755c={'membername':_0x7cc858[_0xb6e3('0x3b')],'UserId':_0x7cc858['id'],'queue_name':_0x5a4770[_0xb6e3('0x3b')],'VoiceQueueId':_0x5a4770['id'],'interface':_0x427e8a,'paused':_0x7cc858[_0xb6e3('0xf7')]||![],'penalty':_0x5a4770[_0xb6e3('0xff')]||0x0};return db['UserVoiceQueueRt'][_0xb6e3('0xae')](_0xe755c);});return Promise[_0xb6e3('0x5c')](_0x176e3c);}}}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return db['MemberReport'][_0xb6e3('0x51')]({'where':{'membername':_0x7cc858[_0xb6e3('0x3b')],'exitAt':null}});}})[_0xb6e3('0x21')](function(_0x4964ba){if(_0x7cc858){var _0xbbf93=[];_0x4964ba[_0xb6e3('0x100')](function(_0x26dc41){_0xbbf93[_0xb6e3('0x50')](_0x26dc41[_0xb6e3('0x2c')]({'exitAt':moment()[_0xb6e3('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0xbbf93);}})['then'](function(){if(_0x7cc858){var _0x3e814e=[];var _0x78389=[];var _0x45ab0a=utils[_0xb6e3('0x101')]();var _0x5f32e5={'membername':_0x7cc858[_0xb6e3('0x3b')],'interface':_0x427e8a,'enterAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102')),'role':_0x7cc858['role'],'internal':_0x7cc858[_0xb6e3('0x67')]};_0x45ab0a[_0xb6e3('0x100')](function(_0x5605fe){_0x3e814e[_0xb6e3('0x50')](_[_0xb6e3('0x60')]({'channel':_0x5605fe,'type':_0xb6e3('0x103'),'data1':_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0x104')],'data2':_0x427e8a},_0x5f32e5));if(_0x7cc858[_0xb6e3('0xf7')]){_0x78389[_0xb6e3('0x50')](_[_0xb6e3('0x60')]({'channel':_0x5605fe,'type':'PAUSE','data1':'LOGININPAUSE'},_0x5f32e5));}});return db['MemberReport'][_0xb6e3('0x8d')](_0x3e814e[_0xb6e3('0xcb')](_0x78389),{'individualHooks':!![]});}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return _0x7cc858[_0xb6e3('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0xb6e3('0x102')),'voicePause':_0x7cc858[_0xb6e3('0xf7')]||![],'mailPause':_0x7cc858[_0xb6e3('0xf7')]||![],'chatPause':_0x7cc858[_0xb6e3('0xf7')]||![],'faxPause':_0x7cc858[_0xb6e3('0xf7')]||![],'smsPause':_0x7cc858['loginInPause']||![],'openchannelPause':_0x7cc858[_0xb6e3('0xf7')]||![],'whatsappPause':_0x7cc858[_0xb6e3('0xf7')]||![],'pauseType':_0x7cc858[_0xb6e3('0xf7')]?_0xb6e3('0x105'):null,'interface':_0x427e8a,'lastPauseAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))});}})['then'](function(_0x37a673){if(_0x1c1203[_0xb6e3('0x106')]){return _0x1308f8();}else{return Promise['resolve'](_0x37a673)[_0xb6e3('0x21')](respondWithResult(_0x5d0df7,null));}})[_0xb6e3('0x2b')](handleError(_0x5d0df7,null));};exports[_0xb6e3('0x107')]=function(_0x4bb56e,_0x40e1ec){var _0x53e20e;return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4bb56e[_0xb6e3('0x5d')]['id'],'role':_0xb6e3('0x2e')},'attributes':['id',_0xb6e3('0x3b'),'role']})[_0xb6e3('0x21')](handleEntityNotFound(_0x40e1ec,null))['then'](function(_0x2505b7){if(_0x2505b7){_0x53e20e=_0x2505b7;return db[_0xb6e3('0xad')]['destroy']({'where':{'membername':_0x53e20e[_0xb6e3('0x3b')]},'individualHooks':!![]});}})['then'](function(){return db[_0xb6e3('0x108')][_0xb6e3('0x51')]({'where':{'membername':_0x53e20e[_0xb6e3('0x3b')],'exitAt':null}});})[_0xb6e3('0x21')](function(_0x191ecb){var _0x97e0e0=[];_0x191ecb['forEach'](function(_0x42b83e){_0x97e0e0[_0xb6e3('0x50')](_0x42b83e[_0xb6e3('0x2c')]({'exitAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))}));});return Promise[_0xb6e3('0x5c')](_0x97e0e0);})[_0xb6e3('0x21')](function(){return _0x53e20e[_0xb6e3('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb6e3('0x21')](respondWithResult(_0x40e1ec,null))['catch'](handleError(_0x40e1ec,null));};exports[_0xb6e3('0x109')]=function(_0x3f23c7,_0x8ce243){var _0x25d7b3;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x3f23c7[_0xb6e3('0x5d')]['id']},'individualHooks':!![]})[_0xb6e3('0x21')](function(){return db['User'][_0xb6e3('0x63')]({'where':{'id':_0x3f23c7[_0xb6e3('0x5d')]['id'],'role':_0xb6e3('0x2e')},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),'internal',_0xb6e3('0xa2'),_0xb6e3('0xa0')]});})[_0xb6e3('0x21')](handleEntityNotFound(_0x8ce243,null))[_0xb6e3('0x21')](function(_0x4a988f){if(_0x4a988f){_0x25d7b3=_0x4a988f;return respondWithRpcPromise(_0xb6e3('0x10a'),_0xb6e3('0x109'),{'id':_0x25d7b3['id'],'name':_0x25d7b3[_0xb6e3('0x3b')],'pause':!![]});}})[_0xb6e3('0x21')](function(){if(_0x25d7b3){return db[_0xb6e3('0x108')]['findAll']({'where':{'membername':_0x25d7b3[_0xb6e3('0x3b')],'type':_0xb6e3('0x10b'),'exitAt':null}});}})[_0xb6e3('0x21')](function(_0x56ae78){if(_0x56ae78[_0xb6e3('0x53')]){var _0x2b2e50=moment()['format'](_0xb6e3('0x102'));for(var _0x29cc90=0x0,_0x5702d1=_0x56ae78[_0xb6e3('0x53')];_0x29cc90<_0x5702d1;_0x29cc90++){_0x56ae78[_0x29cc90][_0xb6e3('0x10c')]({'exitAt':_0x2b2e50});}}})[_0xb6e3('0x21')](function(){var _0x486ee1=[];var _0x392908=utils[_0xb6e3('0x101')]();_0x392908[_0xb6e3('0x100')](function(_0x1df768){_0x486ee1[_0xb6e3('0x50')]({'channel':_0x1df768,'membername':_0x25d7b3['name'],'interface':_['isNil'](_0x25d7b3[_0xb6e3('0xa2')])?util['format']('SIP/%s',_0x25d7b3[_0xb6e3('0x3b')]):_0x25d7b3[_0xb6e3('0xa2')],'type':_0xb6e3('0x10b'),'enterAt':moment()[_0xb6e3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3f23c7[_0xb6e3('0x62')][_0xb6e3('0x42')]||'DEFAULT\x20PAUSE','role':_0x25d7b3[_0xb6e3('0x2d')],'internal':_0x25d7b3[_0xb6e3('0x67')]});});return db[_0xb6e3('0x108')][_0xb6e3('0x8d')](_0x486ee1,{'individualHooks':!![]});})[_0xb6e3('0x21')](function(){return _0x25d7b3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3f23c7[_0xb6e3('0x62')][_0xb6e3('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))});})[_0xb6e3('0x21')](respondWithResult(_0x8ce243,null))[_0xb6e3('0x2b')](handleError(_0x8ce243,null));};exports['unpause']=function(_0x4bb749,_0x5a3147){if(_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]&&!utils[_0xb6e3('0xa3')](_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')])){throw new APIBadRequestError(util[_0xb6e3('0xab')](_0xb6e3('0x10d'),_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]));}return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4bb749[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),'internal',_0xb6e3('0xa2'),_0xb6e3('0xa0'),_0xb6e3('0xa1'),_0xb6e3('0x10e'),_0xb6e3('0x10f'),_0xb6e3('0x110'),_0xb6e3('0x111'),'smsPause',_0xb6e3('0x112'),_0xb6e3('0x113'),_0xb6e3('0x114')]})[_0xb6e3('0x21')](function(_0x433f5d){if(!_0x433f5d){throw new APINotFoundError(util['format'](_0xb6e3('0xcd'),_0x4bb749[_0xb6e3('0x5d')]['id']));}return _0x433f5d['unpause'](_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]);})['then'](respondWithResult(_0x5a3147,null))['catch'](APIHandleError(_0x5a3147));};exports[_0xb6e3('0x115')]=function(_0x231f5a,_0x2b3d5d){var _0x152be7={};var _0x5f5096={};var _0x1d38d6;var _0x2f2f6d;return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x231f5a[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2b3d5d,null))['then'](function(_0x152cb8){if(_0x152cb8){_0x1d38d6=_0x152cb8;_0x5f5096[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0x116')][_0xb6e3('0xd9')]);_0x5f5096[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x231f5a[_0xb6e3('0x4c')]);_0x5f5096[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x5f5096[_0xb6e3('0xd6')],_0x5f5096[_0xb6e3('0x4c')]);_0x152be7[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x5f5096[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x231f5a['query'][_0xb6e3('0xdc')]));_0x152be7[_0xb6e3('0x4f')]=_0x152be7[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x152be7[_0xb6e3('0x4f')]:_0x5f5096[_0xb6e3('0xd6')];_0x152be7[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x152be7[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x231f5a[_0xb6e3('0x4c')],_0x5f5096['filters']));if(_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x152be7['where']=_['merge'](_0x152be7[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x152be7['attributes'],function(_0x321b26){var _0x5c7137={};_0x5c7137[_0x321b26]={'$like':'%'+_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x5c7137;})});}_0x152be7=_[_0xb6e3('0x60')]({},_0x152be7,_0x231f5a['options']);return _0x1d38d6[_0xb6e3('0x115')](_0x152be7);}})[_0xb6e3('0x21')](function(_0x497a91){if(_0x497a91){_0x2f2f6d=_0x497a91[_0xb6e3('0x53')];if(!_0x231f5a[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x152be7['limit']=qs['limit'](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x152be7['offset']=qs['offset'](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1d38d6['getTeams'](_0x152be7);}})[_0xb6e3('0x21')](function(_0xca8d47){if(_0xca8d47){return _0xca8d47?{'count':_0x2f2f6d,'rows':_0xca8d47}:null;}})['then'](respondWithResult(_0x2b3d5d,null))[_0xb6e3('0x2b')](handleError(_0x2b3d5d,null));};exports[_0xb6e3('0x117')]=function(_0x19871e,_0x3a3e26){var _0x169efa=_0x19871e[_0xb6e3('0x5d')]['id'];var _0xbc74e7=_0x19871e[_0xb6e3('0x62')]?_0x19871e[_0xb6e3('0x62')][_0xb6e3('0x66')]:null;var _0x779c1d=[];return Promise[_0xb6e3('0x118')]()['then'](function(){if(!_0xbc74e7)throw new APIBadRequestError(_0xb6e3('0x119'));})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x169efa}});})[_0xb6e3('0x21')](function(_0x47e1d0){if(!_0x47e1d0)throw new APINotFoundError(util[_0xb6e3('0xab')]('User\x20with\x20id\x20%s\x20not\x20found',_0x19871e[_0xb6e3('0x5d')]['id']));return db['sequelize'][_0xb6e3('0x11a')](function(_0x1b2597){return _0x47e1d0[_0xb6e3('0x117')](_0xbc74e7,{'transaction':_0x1b2597})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x116')][_0xb6e3('0x51')]({'where':{'id':{'$in':_0xbc74e7}}});})['then'](function(_0x7af116){var _0x4f72b9=_['map'](_0x7af116,function(_0x5b6ccd){return _0x5b6ccd[_0xb6e3('0x11b')]();});return Promise['all'](_0x4f72b9);})[_0xb6e3('0x21')](function(_0x3eb00a){_0x779c1d=_['flattenDeep'](_0x3eb00a);var _0x5ad1ba=_['map'](_0x779c1d,function(_0x90b903){return _0x90b903['addAgent'](_0x47e1d0['id'],{'transaction':_0x1b2597});});return Promise['all'](_0x5ad1ba);})[_0xb6e3('0x21')](function(){if(!_0x47e1d0['online'])return;var _0x448cb2=_[_0xb6e3('0x38')](_0x779c1d,function(_0x14f802){return _0x14f802[_0xb6e3('0x11c')](_0xb6e3('0xb4'))===_0xb6e3('0x11d');});var _0x3e5743=_[_0xb6e3('0x41')](_0x448cb2,function(_0x5d4b1d){return db[_0xb6e3('0xad')][_0xb6e3('0xae')]({'membername':_0x47e1d0[_0xb6e3('0x3b')],'UserId':_0x47e1d0['id'],'queue_name':_0x5d4b1d['name'],'VoiceQueueId':_0x5d4b1d['id'],'interface':_[_0xb6e3('0x6d')](_0x47e1d0['interface'])?util[_0xb6e3('0xab')]('SIP/%s',_0x47e1d0['name']):_0x47e1d0[_0xb6e3('0xa2')],'paused':_0x47e1d0['voicePause']||![],'penalty':_0x47e1d0['penalty']},{'transaction':_0x1b2597});});return Promise[_0xb6e3('0x5c')](_0x3e5743);})['then'](function(){return db[_0xb6e3('0x11e')][_0xb6e3('0x51')]({'where':{'teamId':{'$in':_0xbc74e7}}});})[_0xb6e3('0x21')](function(_0x271e50){var _0x52b04d=_[_0xb6e3('0x41')](_0x271e50,function(_0x500f96){return db[_0xb6e3('0x11f')][_0xb6e3('0x84')]({'UserId':_0x47e1d0['id'],'VoicePrefixId':_0x500f96[_0xb6e3('0x120')]},{'transaction':_0x1b2597});});return Promise[_0xb6e3('0x5c')](_0x52b04d);});});})[_0xb6e3('0x21')](function(){for(var _0x31de00=0x0;_0x31de00<_0x779c1d[_0xb6e3('0x53')];_0x31de00++){var _0x2c56a9=_0x779c1d[_0x31de00][_0xb6e3('0x11c')]('channel');var _0x28f359=_0x2c56a9+_0xb6e3('0xb2');socket[_0xb6e3('0x2f')](_0xb6e3('0x34')+_0x2c56a9+_0xb6e3('0x121'),{'UserId':_0x169efa,['queueField']:_0x779c1d[_0x31de00]['id']});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x3a3e26,null))['catch'](APIHandleError(_0x3a3e26));};exports[_0xb6e3('0x122')]=function(_0x59f584,_0x5aef87){var _0x214777=_0x59f584[_0xb6e3('0x5d')]['id'];var _0x24c983=null;if(_0x59f584[_0xb6e3('0x4c')][_0xb6e3('0x66')]){_0x24c983=_['isArray'](_0x59f584['query'][_0xb6e3('0x66')])?_0x59f584[_0xb6e3('0x4c')]['ids']:[_0x59f584['query'][_0xb6e3('0x66')]];}var _0x39952b=[];return Promise['resolve']()[_0xb6e3('0x21')](function(){if(!_0x24c983)throw new APIBadRequestError(_0xb6e3('0x123'));})[_0xb6e3('0x21')](function(){return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x214777}});})['then'](function(_0x4b1419){if(!_0x4b1419)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x59f584[_0xb6e3('0x5d')]['id']));return db[_0xb6e3('0x6e')]['transaction'](function(_0x549ae8){return _0x4b1419['removeTeams'](_0x24c983,{'transaction':_0x549ae8})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x116')][_0xb6e3('0x51')]({'where':{'id':{'$in':_0x24c983}}});})[_0xb6e3('0x21')](function(_0xb24317){var _0xe3d63a=_[_0xb6e3('0x41')](_0xb24317,function(_0x1af289){return _0x1af289[_0xb6e3('0x11b')]();});return Promise[_0xb6e3('0x5c')](_0xe3d63a);})[_0xb6e3('0x21')](function(_0x34c18d){_0x39952b=_[_0xb6e3('0x124')](_0x34c18d);var _0x35ac04=_[_0xb6e3('0x41')](_0x39952b,function(_0x537f71){return _0x537f71[_0xb6e3('0x125')](_0x4b1419['id'],{'transaction':_0x549ae8});});return Promise['all'](_0x35ac04);})[_0xb6e3('0x21')](function(){if(!_0x4b1419['online'])return;var _0x44f52a=_[_0xb6e3('0x38')](_0x39952b,function(_0x25acae){return _0x25acae[_0xb6e3('0x11c')]('channel')==='Voice';});var _0x2d9143=_['map'](_0x44f52a,function(_0x30bb7a){return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'VoiceQueueId':_0x30bb7a['id'],'UserId':_0x4b1419['id']},'transaction':_0x549ae8});});return Promise['all'](_0x2d9143);})['then'](function(){return db[_0xb6e3('0x11e')][_0xb6e3('0x51')]({'where':{'teamId':{'$in':_0x24c983}}});})['then'](function(_0x4f4201){var _0x1b7d5c=_[_0xb6e3('0x41')](_0x4f4201,function(_0xfbcfe8){return db[_0xb6e3('0x11f')]['destroy']({'where':{'UserId':_0x4b1419['id'],'VoicePrefixId':_0xfbcfe8[_0xb6e3('0x120')]}},{'transaction':_0x549ae8});});return Promise[_0xb6e3('0x5c')](_0x1b7d5c);});});})[_0xb6e3('0x21')](function(){for(var _0x2031e5=0x0;_0x2031e5<_0x39952b['length'];_0x2031e5++){var _0x500571=_0x39952b[_0x2031e5][_0xb6e3('0x11c')](_0xb6e3('0xb4'));var _0x30034a=_0x500571+_0xb6e3('0xb2');socket['emit'](_0xb6e3('0x34')+_0x500571+_0xb6e3('0xb3'),{'UserId':_0x214777,['queueField']:_0x39952b[_0x2031e5]['id']});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x5aef87,null))[_0xb6e3('0x2b')](APIHandleError(_0x5aef87));};exports[_0xb6e3('0x126')]=function(_0x2c925d,_0x4b72be){var _0x4bb5bd={};var _0x44d5ff={};var _0x1bfab9;var _0x1ee5fc;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x2c925d['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4b72be,null))['then'](function(_0x5bdadd){if(_0x5bdadd){_0x1bfab9=_0x5bdadd;_0x44d5ff[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0x127')][_0xb6e3('0xd9')]);_0x44d5ff[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x2c925d[_0xb6e3('0x4c')]);_0x44d5ff[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x44d5ff[_0xb6e3('0xd6')],_0x44d5ff['query']);_0x4bb5bd[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x44d5ff[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x4bb5bd[_0xb6e3('0x4f')]=_0x4bb5bd[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x4bb5bd[_0xb6e3('0x4f')]:_0x44d5ff[_0xb6e3('0xd6')];_0x4bb5bd[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x4bb5bd[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x2c925d['query'],_0x44d5ff[_0xb6e3('0xda')]));if(_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x4bb5bd[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x4bb5bd[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x4bb5bd['attributes'],function(_0x5afbe3){var _0x43a46c={};_0x43a46c[_0x5afbe3]={'$like':'%'+_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x43a46c;})});}_0x4bb5bd=_[_0xb6e3('0x60')]({},_0x4bb5bd,_0x2c925d[_0xb6e3('0x61')]);return _0x1bfab9[_0xb6e3('0x126')](_0x4bb5bd);}})[_0xb6e3('0x21')](function(_0x4a1c86){if(_0x4a1c86){_0x1ee5fc=_0x4a1c86[_0xb6e3('0x53')];if(!_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x4bb5bd[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x2c925d[_0xb6e3('0x4c')]['limit']);_0x4bb5bd[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x2c925d[_0xb6e3('0x4c')]['offset']);}return _0x1bfab9[_0xb6e3('0x126')](_0x4bb5bd);}})[_0xb6e3('0x21')](function(_0x29b81b){if(_0x29b81b){return _0x29b81b?{'count':_0x1ee5fc,'rows':_0x29b81b}:null;}})['then'](respondWithResult(_0x4b72be,null))[_0xb6e3('0x2b')](handleError(_0x4b72be,null));};exports[_0xb6e3('0x128')]=function(_0x5700ce,_0x20926e){var _0x48be66={};var _0x78b061={};var _0x39f317;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x5700ce['params']['id']}})['then'](handleEntityNotFound(_0x20926e,null))['then'](function(_0xd7c822){if(_0xd7c822){_0x39f317=_0xd7c822;_0x78b061[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db['User'][_0xb6e3('0xd9')]);_0x78b061[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x5700ce[_0xb6e3('0x4c')]);_0x78b061[_0xb6e3('0xda')]=_['intersection'](_0x78b061[_0xb6e3('0xd6')],_0x78b061['query']);_0x48be66['attributes']=_[_0xb6e3('0xdb')](_0x78b061[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x5700ce['query'][_0xb6e3('0xdc')]));_0x48be66[_0xb6e3('0x4f')]=_0x48be66['attributes'][_0xb6e3('0x53')]?_0x48be66[_0xb6e3('0x4f')]:_0x78b061[_0xb6e3('0xd6')];_0x48be66[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x5700ce['query'][_0xb6e3('0xdd')]);_0x48be66[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x5700ce['query'],_0x78b061[_0xb6e3('0xda')]));if(_0x5700ce['query'][_0xb6e3('0x38')]){_0x48be66[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x48be66[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x48be66[_0xb6e3('0x4f')],function(_0x485a47){var _0x237ea8={};_0x237ea8[_0x485a47]={'$like':'%'+_0x5700ce['query']['filter']+'%'};return _0x237ea8;})});}_0x48be66['model']=db['User'];_0x48be66['as']=_0xb6e3('0x35');_0x48be66=_['merge']({},_0x48be66,_0x5700ce['options']);return _0x39f317[_0xb6e3('0xfe')]({'include':[_0x48be66]});}})[_0xb6e3('0x21')](function(_0x19ae1a){if(_0x19ae1a){var _0x4ae80b={},_0x1ee1ac=[];for(var _0x5311c0=0x0;_0x5311c0<_0x19ae1a[_0xb6e3('0x53')];_0x5311c0+=0x1){for(var _0x285647=0x0,_0x1ddd91;_0x285647<_0x19ae1a[_0x5311c0][_0xb6e3('0x35')]['length'];_0x285647+=0x1){_0x1ddd91=_0x19ae1a[_0x5311c0][_0xb6e3('0x35')][_0x285647][_0xb6e3('0x31')]({'plain':!![]});_0x4ae80b[_0x1ddd91['id']]=_0x1ddd91;}}_0x4ae80b=_[_0xb6e3('0x129')](_0x4ae80b);for(var _0x1418b6=qs[_0xb6e3('0x1c')](_0x5700ce['query'][_0xb6e3('0x1c')]);_0x1418b6<_0x4ae80b[_0xb6e3('0x53')]&&_0x1ee1ac[_0xb6e3('0x53')]=_0x90e651){_0x598844=_0x90e651;_0x4503e4=0xc8;}else{_0x4503e4=0xce;}_0x4e72d8[_0x5fbd('0x19')](_0x4503e4);return _0x4e72d8[_0x5fbd('0x1f')](_0x5fbd('0x20'),_0x476ea8+'-'+_0x598844+'/'+_0x90e651)[_0x5fbd('0x1a')](_0x1f75ea);}return null;};}function respondWithRpcPromise(_0x2082bd,_0x565139,_0x378520,_0x1d2445){return new Promise(function(_0xaea11e,_0x4b0e94){var _0x173b42=_0x1d2445||amiClient;return _0x173b42[_0x5fbd('0x21')](_0x2082bd,_0x378520)['then'](function(_0x451c36){logger['info']('User,\x20%s,\x20%s',_0x565139,'request\x20sent');logger[_0x5fbd('0x22')](_0x5fbd('0x23'),_0x565139,_0x5fbd('0x24'),JSON['stringify'](_0x451c36));if(_0x451c36[_0x5fbd('0x25')]){if(_0x451c36[_0x5fbd('0x25')]['code']===0x1f4){logger[_0x5fbd('0x25')](_0x5fbd('0x26'),_0x565139,_0x451c36[_0x5fbd('0x25')][_0x5fbd('0x27')]);return _0x4b0e94(_0x451c36['error'][_0x5fbd('0x27')]);}logger['error'](_0x5fbd('0x26'),_0x565139,_0x451c36[_0x5fbd('0x25')][_0x5fbd('0x27')]);return _0xaea11e(_0x451c36[_0x5fbd('0x25')]['message']);}else{logger[_0x5fbd('0x28')](_0x5fbd('0x26'),_0x565139,'request\x20sent');_0xaea11e(_0x451c36[_0x5fbd('0x29')][_0x5fbd('0x27')]);}})[_0x5fbd('0x2a')](function(_0x182f68){logger[_0x5fbd('0x25')]('User,\x20%s,\x20%s',_0x565139,_0x182f68);_0x4b0e94(_0x182f68);});});}function saveUpdates(_0x43202d){return function(_0x2a94c5){if(_0x2a94c5){return _0x2a94c5[_0x5fbd('0x2b')](_0x43202d)['then'](function(_0x25fbe8){if(_0x25fbe8[_0x5fbd('0x2c')]===_0x5fbd('0x2d')){socket[_0x5fbd('0x2e')](_0x5fbd('0x2f')+_0x25fbe8['id'],_0x25fbe8);}return _0x25fbe8;});}return null;};}function removeEntity(_0x4e206a,_0x42d288){return function(_0x2afb38){if(_0x2afb38){return _0x2afb38[_0x5fbd('0x30')]({'transaction':_0x42d288})[_0x5fbd('0x31')](function(){var _0x449b88=_0x2afb38[_0x5fbd('0x32')]({'plain':!![]});if(_0x449b88[_0x5fbd('0x2c')]===_0x5fbd('0x33'))return;var _0x100dc1=[{'name':_0x5fbd('0x34'),'value':'user','ignore':!![]},{'name':_0x5fbd('0x35'),'value':_0x5fbd('0x2d'),'ignore':![]},{'name':_0x5fbd('0x36'),'value':_0x5fbd('0x37'),'ignore':![]}];var _0x3b826f=_(_0x100dc1)['filter']('ignore')['map'](_0x5fbd('0x38'))[_0x5fbd('0x38')]();if(_[_0x5fbd('0x39')](_0x3b826f,_0x449b88[_0x5fbd('0x2c')])){return;}var _0x4a0d7c=_[_0x5fbd('0x3a')](_0x100dc1,[_0x5fbd('0x38'),_0x449b88[_0x5fbd('0x2c')]])[_0x5fbd('0x3b')];return db[_0x5fbd('0x3c')][_0x5fbd('0x30')]({'where':{'type':_0x4a0d7c,'resourceId':_0x449b88['id']},'transaction':_0x42d288})['then'](function(){return _0x2afb38;});})[_0x5fbd('0x31')](function(){_0x4e206a['status'](0xcc)[_0x5fbd('0x3d')]();});}};}function handleEntityNotFound(_0x7808d0){return function(_0x4f9298){if(!_0x4f9298){_0x7808d0[_0x5fbd('0x18')](0x194);}return _0x4f9298;};}function handleError(_0x49ae5c,_0x5da15b){_0x5da15b=_0x5da15b||0x1f4;return function(_0x4ada33){logger[_0x5fbd('0x25')](_0x4ada33[_0x5fbd('0x3e')]);if(_0x4ada33[_0x5fbd('0x3b')]){delete _0x4ada33['name'];}_0x49ae5c[_0x5fbd('0x19')](_0x5da15b)[_0x5fbd('0x3f')](_0x4ada33);};}function getUserAttributes(){return _(db['User'][_0x5fbd('0x40')])[_0x5fbd('0x41')](function(_0x1676cc){return{'name':_0x1676cc[_0x5fbd('0x42')],'type':_0x1676cc['type']['key']};})[_0x5fbd('0x43')](function(_0x5a0c08){return![_0x5fbd('0x44'),_0x5fbd('0x45'),_0x5fbd('0x46'),_0x5fbd('0x47'),_0x5fbd('0x48'),_0x5fbd('0x49')]['includes'](_0x5a0c08[_0x5fbd('0x3b')]);})[_0x5fbd('0x38')]();}exports[_0x5fbd('0x4a')]=function(_0x4b1865,_0x128d2a){var _0x5199f9={},_0xcb03b4={'count':0x0,'rows':[]};var _0x3df9be=getUserAttributes();_0x5199f9=qs[_0x5fbd('0x4b')](_0x3df9be,_0x4b1865);var _0x52cd4d={'where':_0x5199f9[_0x5fbd('0x4c')]};return db[_0x5fbd('0x4d')][_0x5fbd('0x1e')](_0x52cd4d)[_0x5fbd('0x31')](function(_0x339125){_0xcb03b4['count']=_0x339125;if(_0x4b1865[_0x5fbd('0x4e')][_0x5fbd('0x4f')]){_0x5199f9['include']=[{'all':!![]}];}if(_0x4b1865['query'][_0x5fbd('0x50')]===_0x5fbd('0x51')){_0x5199f9[_0x5fbd('0x52')]=[{'model':db[_0x5fbd('0x53')],'as':_0x5fbd('0x50')}];}if(!_['includes'](_0x5199f9[_0x5fbd('0x54')],'id')){_0x5199f9[_0x5fbd('0x54')][_0x5fbd('0x55')]('id');}return db[_0x5fbd('0x4d')][_0x5fbd('0x56')](_0x5199f9);})['then'](function(_0x3f99fc){_0xcb03b4[_0x5fbd('0x57')]=_0x3f99fc;if(_0x4b1865[_0x5fbd('0x4e')][_0x5fbd('0x58')]===_0x5fbd('0x51')){var _0x25078=[];for(var _0x1d7fb2=0x0;_0x1d7fb2<_0xcb03b4['rows']['length'];_0x1d7fb2++){_0x25078[_0x5fbd('0x55')](get_open_tabs('chat',_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));_0x25078[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5a'),_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));_0x25078['push'](get_open_tabs(_0x5fbd('0x5b'),_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));_0x25078[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5c'),_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));_0x25078['push'](get_open_tabs(_0x5fbd('0x5d'),_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));_0x25078[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5e'),_0xcb03b4[_0x5fbd('0x57')][_0x1d7fb2][_0x5fbd('0x59')]));}return Promise['all'](_0x25078)[_0x5fbd('0x31')](function(){return _0xcb03b4;});}else{return _0xcb03b4;}})[_0x5fbd('0x31')](respondWithFilteredResult(_0x128d2a,_0x5199f9))[_0x5fbd('0x2a')](handleError(_0x128d2a,null));};exports[_0x5fbd('0x5f')]=function(_0x5206fd,_0x2da7fe){var _0x11c864=getUserAttributes();_0x5206fd['query']['id']=_0x5206fd['params']['id'];var _0x363550=qs[_0x5fbd('0x4b')](_0x11c864,_0x5206fd);if(_0x5206fd[_0x5fbd('0x4e')][_0x5fbd('0x4f')]){_0x363550['include']=[{'all':!![]}];}if(_0x5206fd[_0x5fbd('0x4e')][_0x5fbd('0x50')]===_0x5fbd('0x51')){_0x363550[_0x5fbd('0x52')]=[{'model':db[_0x5fbd('0x53')],'as':_0x5fbd('0x50')}];}_0x363550=_[_0x5fbd('0x60')]({},_0x363550,_0x5206fd['options']);if(!_[_0x5fbd('0x39')](_0x363550[_0x5fbd('0x54')],'id')){_0x363550[_0x5fbd('0x54')]['push']('id');}return db[_0x5fbd('0x4d')]['find'](_0x363550)[_0x5fbd('0x31')](handleEntityNotFound(_0x2da7fe,null))[_0x5fbd('0x31')](function(_0x26c85e){var _0x476001=[];values=_0x26c85e;if(_0x5206fd[_0x5fbd('0x4e')][_0x5fbd('0x58')]==='true'){_0x476001[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x61'),_0x26c85e['dataValues']));_0x476001[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5a'),_0x26c85e['dataValues']));_0x476001[_0x5fbd('0x55')](get_open_tabs('openchannel',_0x26c85e[_0x5fbd('0x59')]));_0x476001[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5e'),_0x26c85e[_0x5fbd('0x59')]));_0x476001['push'](get_open_tabs(_0x5fbd('0x5b'),_0x26c85e[_0x5fbd('0x59')]));_0x476001['push'](get_open_tabs('mail',_0x26c85e[_0x5fbd('0x59')]));return Promise[_0x5fbd('0x62')](_0x476001);}else{return values;}})[_0x5fbd('0x31')](function(){return values;})[_0x5fbd('0x31')](respondWithResult(_0x2da7fe,null))[_0x5fbd('0x2a')](handleError(_0x2da7fe,null));};exports[_0x5fbd('0x2b')]=function(_0x41b2d4,_0x197096){if(_0x41b2d4['body']['id']){delete _0x41b2d4['body']['id'];}delete _0x41b2d4[_0x5fbd('0x63')]['role'];return db['User']['find']({'where':{'id':_0x41b2d4[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x197096,null))[_0x5fbd('0x31')](saveUpdates(_0x41b2d4[_0x5fbd('0x63')],null))[_0x5fbd('0x31')](respondWithResult(_0x197096,null))[_0x5fbd('0x2a')](handleError(_0x197096,null));};exports[_0x5fbd('0x65')]=function(_0x491ddd,_0x3b152f){return db[_0x5fbd('0x4d')][_0x5fbd('0x65')]()[_0x5fbd('0x31')](respondWithResult(_0x3b152f,null))[_0x5fbd('0x2a')](handleError(_0x3b152f,null));};exports[_0x5fbd('0x66')]=function(_0x1a4dab,_0x213109){return db[_0x5fbd('0x4d')][_0x5fbd('0x3a')]({'where':{'id':_0x1a4dab['params']['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x213109,null))[_0x5fbd('0x31')](function(_0x3617bb){if(_0x3617bb){return _0x3617bb[_0x5fbd('0x66')](_0x1a4dab['body']['ids'],_[_0x5fbd('0x67')](_0x1a4dab['body'],[_0x5fbd('0x68'),'id'])||{});}})[_0x5fbd('0x31')](respondWithResult(_0x213109,null))[_0x5fbd('0x2a')](handleError(_0x213109,null));};function validateUser(_0x3909d8){return new Promise(function(_0x2de5c0,_0x38bd88){if(_0x3909d8[_0x5fbd('0x69')])return _0x2de5c0(_0x3909d8);return db['Setting'][_0x5fbd('0x6a')](0x1)[_0x5fbd('0x31')](function(_0x5bab68){if(_0x5bab68[_0x5fbd('0x6b')])authService['validatePasswordPattern'](_0x3909d8['password']);db[_0x5fbd('0x4d')][_0x5fbd('0x6c')]('internal')[_0x5fbd('0x31')](function(_0x20d2f1){if(_[_0x5fbd('0x6d')](_0x20d2f1)){_0x3909d8[_0x5fbd('0x69')]=_0x5bab68[_0x5fbd('0x6e')]||0x1;return;}if(_[_0x5fbd('0x6d')](_0x5bab68[_0x5fbd('0x6e')])||_0x5bab68[_0x5fbd('0x6e')]===_0x20d2f1){_0x3909d8[_0x5fbd('0x69')]=_0x20d2f1+0x1;return;}if(_0x5bab68[_0x5fbd('0x6e')]>_0x20d2f1){_0x3909d8[_0x5fbd('0x69')]=_0x5bab68[_0x5fbd('0x6e')];return;}return db[_0x5fbd('0x6f')]['query'](_0x5fbd('0x70'),{'type':db['sequelize'][_0x5fbd('0x71')][_0x5fbd('0x72')]})[_0x5fbd('0x31')](function(_0x33d6f1){if(_0x33d6f1&&_0x33d6f1['length']){for(var _0x53552b=0x0,_0x623252=_0x33d6f1[_0x5fbd('0x73')];_0x53552b<_0x623252&&_[_0x5fbd('0x6d')](_0x3909d8[_0x5fbd('0x69')]);_0x53552b++){if(_0x5bab68[_0x5fbd('0x6e')]<=_0x33d6f1[_0x53552b][_0x5fbd('0x74')]){_0x3909d8[_0x5fbd('0x69')]=_0x33d6f1[_0x53552b][_0x5fbd('0x74')];}else if(_0x5bab68['min_internal']>_0x33d6f1[_0x53552b][_0x5fbd('0x74')]&&_0x5bab68[_0x5fbd('0x6e')]<=_0x33d6f1[_0x53552b]['to']){_0x3909d8[_0x5fbd('0x69')]=_0x5bab68[_0x5fbd('0x6e')];}}}if(_[_0x5fbd('0x6d')](_0x3909d8['internal'])){_0x3909d8[_0x5fbd('0x69')]=_0x20d2f1+0x1;}return _0x2de5c0(_0x3909d8);});});})[_0x5fbd('0x2a')](function(_0x454855){_0x38bd88(_0x454855);});});}function updateUser(_0x5c422b){return new Promise(function(_0x4d72e3,_0x8cde01){try{if(_0x5c422b['voicemail']){_0x5c422b['mailbox']=_0x5c422b[_0x5fbd('0x69')];_0x5c422b[_0x5fbd('0x75')]={'mailbox':_0x5c422b[_0x5fbd('0x69')],'password':_0x5c422b[_0x5fbd('0x44')],'fullname':_0x5c422b['fullname'],'email':_0x5c422b['email']};}if(_0x5c422b[_0x5fbd('0x2c')]===_0x5fbd('0x2d')){if(!_0x5c422b[_0x5fbd('0x76')])_0x5c422b['permissions']=[_0x5fbd('0x77'),'102',_0x5fbd('0x78'),_0x5fbd('0x79'),_0x5fbd('0x7a'),_0x5fbd('0x7b'),'105',_0x5fbd('0x7c'),_0x5fbd('0x7d'),_0x5fbd('0x7e'),_0x5fbd('0x7f'),_0x5fbd('0x80'),_0x5fbd('0x81'),'114',_0x5fbd('0x82')];}_0x4d72e3(_0x5c422b);}catch(_0x2076e6){_0x8cde01(_0x2076e6);}});}exports[_0x5fbd('0x83')]=function(_0x4a0f15,_0x47f9b8){if(_0x4a0f15['user'][_0x5fbd('0x2c')]===_0x5fbd('0x2d'))throw new Error(_0x5fbd('0x84'));if(_0x4a0f15[_0x5fbd('0x63')][_0x5fbd('0x2c')]===_0x5fbd('0x85')&&_0x4a0f15[_0x5fbd('0x85')][_0x5fbd('0x2c')]!==_0x5fbd('0x33')){throw new Error(_0x5fbd('0x86'));}if(_0x4a0f15[_0x5fbd('0x63')]['role']===_0x5fbd('0x33')&&_0x4a0f15[_0x5fbd('0x85')][_0x5fbd('0x2c')]!==_0x5fbd('0x33')){throw new Error(_0x5fbd('0x87'));}return licenseUtil[_0x5fbd('0x88')]([_0x4a0f15[_0x5fbd('0x63')]])[_0x5fbd('0x31')](function(){return validateUser(_0x4a0f15[_0x5fbd('0x63')]);})[_0x5fbd('0x31')](function(_0x5d90ad){return updateUser(_0x5d90ad)['then'](function(_0x1e9947){if(_0x1e9947[_0x5fbd('0x2c')]===_0x5fbd('0x33')){_0x1e9947[_0x5fbd('0x89')]=_0x4a0f15['user'][_0x5fbd('0x89')];delete _0x1e9947[_0x5fbd('0x8a')];}return _0x1e9947;});})[_0x5fbd('0x31')](function(_0x184a13){return db[_0x5fbd('0x4d')][_0x5fbd('0x83')](_0x184a13,{'include':[{'model':db[_0x5fbd('0x75')],'as':_0x5fbd('0x75')}]});})[_0x5fbd('0x31')](function(_0x455121){if(_0x4a0f15[_0x5fbd('0x63')]['role']===_0x5fbd('0x85'))return _0x455121;if(_0x4a0f15['user'][_0x5fbd('0x2c')]!==_0x5fbd('0x85'))return _0x455121;return db[_0x5fbd('0x8b')]['find']({'where':{'name':_0x455121[_0x5fbd('0x2c')]===_0x5fbd('0x2d')?_0x5fbd('0x35'):_0x5fbd('0x36'),'userProfileId':_0x4a0f15[_0x5fbd('0x85')][_0x5fbd('0x8a')]},'raw':!![]})[_0x5fbd('0x31')](function(_0x17f078){if(!_0x17f078||_0x17f078[_0x5fbd('0x8c')]!=0x0)return _0x455121;return db[_0x5fbd('0x3c')][_0x5fbd('0x83')]({'name':_0x455121['name'],'resourceId':_0x455121['id'],'type':_0x17f078['name'],'sectionId':_0x17f078['id']},{})[_0x5fbd('0x31')](function(){return _0x455121;});})[_0x5fbd('0x2a')](function(_0x2482df){logger[_0x5fbd('0x25')](_0x5fbd('0x8d'),_0x2482df);throw _0x2482df;});})[_0x5fbd('0x31')](respondWithResult(_0x47f9b8,0xc9))[_0x5fbd('0x2a')](handleError(_0x47f9b8,null));};exports[_0x5fbd('0x8e')]=function(_0x1aff3a,_0xf8600e){var _0xb00958=_0x1aff3a[_0x5fbd('0x63')];var _0x3bdd8a=[];if(_0x1aff3a[_0x5fbd('0x85')][_0x5fbd('0x2c')]===_0x5fbd('0x2d'))throw new Error(_0x5fbd('0x84'));if(_[_0x5fbd('0x8f')](_0xb00958,['role','user'])&&_0x1aff3a[_0x5fbd('0x85')]['role']!=='admin'){throw new Error(_0x5fbd('0x86'));}if(_['some'](_0xb00958,['role','admin'])&&_0x1aff3a[_0x5fbd('0x85')][_0x5fbd('0x2c')]!==_0x5fbd('0x33')){throw new Error(_0x5fbd('0x90'));}return licenseUtil[_0x5fbd('0x88')](_0xb00958)[_0x5fbd('0x31')](function(){return validateUser(_0xb00958[0x0]);})['then'](function(){for(var _0x484259=0x1;_0x484259<_0xb00958[_0x5fbd('0x73')];_0x484259++){var _0x92a1ba=_0xb00958[_0x484259-0x1][_0x5fbd('0x69')];if(!_0xb00958[_0x484259][_0x5fbd('0x69')])_0xb00958[_0x484259]['internal']=_0x92a1ba+0x1;_0x3bdd8a[_0x5fbd('0x55')](validateUser(_0xb00958[_0x484259]));}return Promise[_0x5fbd('0x62')](_0x3bdd8a);})[_0x5fbd('0x31')](function(){_0x3bdd8a=[];for(var _0x1fc7be=0x0;_0x1fc7be<_0xb00958[_0x5fbd('0x73')];_0x1fc7be++){_0x3bdd8a['push'](updateUser(_0xb00958[_0x1fc7be]));}return Promise[_0x5fbd('0x62')](_0x3bdd8a);})[_0x5fbd('0x31')](function(){_0x3bdd8a=_0xb00958[_0x5fbd('0x41')](function(_0x4d1b0d){return db[_0x5fbd('0x4d')][_0x5fbd('0x83')](_0x4d1b0d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x5fbd('0x31')](function(_0x4a1712){_0x4d1b0d['id']=_0x4a1712['id'];return _0x4d1b0d;});});return Promise['all'](_0x3bdd8a);})[_0x5fbd('0x31')](function(_0x4200d1){if(_0x1aff3a[_0x5fbd('0x63')][_0x5fbd('0x2c')]==='user')return _0x4200d1;if(_0x1aff3a['user']['role']!==_0x5fbd('0x85'))return _0x4200d1;var _0x7d7a28=_[_0x5fbd('0x8f')](_0x4200d1,function(_0x25017d){return _0x25017d[_0x5fbd('0x2c')]===_0x5fbd('0x2d')||_0x25017d[_0x5fbd('0x2c')]===_0x5fbd('0x37');});if(!_0x7d7a28)return _0x4200d1;return db['UserProfileSection'][_0x5fbd('0x56')]({'where':{'name':{'$or':[_0x5fbd('0x35'),_0x5fbd('0x36')]},'userProfileId':_0x1aff3a[_0x5fbd('0x85')]['userProfileId']},'raw':!![]})[_0x5fbd('0x31')](function(_0xb40b6e){if(_[_0x5fbd('0x91')](_0xb40b6e)||!_[_0x5fbd('0x8f')](_0xb40b6e,['autoAssociation',0x0]))return _0x4200d1;_0x3bdd8a=[];var _0x599a95=_(_0xb40b6e)[_0x5fbd('0x41')](function(_0x136176){if(_0x136176[_0x5fbd('0x8c')]===0x1)return;return _0x136176['name']===_0x5fbd('0x35')?_0x5fbd('0x2d'):_0x5fbd('0x37');})[_0x5fbd('0x92')]()[_0x5fbd('0x38')]();for(var _0x37dd71=0x0;_0x37dd71<_0x4200d1[_0x5fbd('0x73')];_0x37dd71++){if(!_['includes'](_0x599a95,_0x4200d1[_0x37dd71][_0x5fbd('0x2c')]))return;var _0x777f3b=_0x4200d1[_0x37dd71]['role']==='agent'?_0x5fbd('0x35'):_0x5fbd('0x36');_0x3bdd8a[_0x5fbd('0x55')](db[_0x5fbd('0x3c')][_0x5fbd('0x83')]({'name':_0x4200d1[_0x37dd71][_0x5fbd('0x3b')],'resourceId':_0x4200d1[_0x37dd71]['id'],'type':_0x777f3b,'sectionId':_['find'](_0xb40b6e,[_0x5fbd('0x3b'),_0x777f3b])['id']},{}));}return Promise['all'](_0x3bdd8a);});})[_0x5fbd('0x31')](respondWithResult(_0xf8600e,0xc9))[_0x5fbd('0x2a')](handleError(_0xf8600e,null));};exports[_0x5fbd('0x93')]=function(_0x31ce85,_0x1a5221){if(_0x31ce85[_0x5fbd('0x63')]['id']){delete _0x31ce85[_0x5fbd('0x63')]['id'];}return db['User']['find']({'where':{'id':_0x31ce85[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](function(_0x8089a4){if(!_0x8089a4)return null;if(_0x8089a4['id']===_0x31ce85[_0x5fbd('0x85')]['id']){if(!_0x31ce85['body'][_0x5fbd('0x94')]||!_0x31ce85['body']['newPassword']){throw new db[(_0x5fbd('0x95'))]['ValidationError'](_0x5fbd('0x96'));}if(!_0x8089a4[_0x5fbd('0x97')](_0x31ce85['body'][_0x5fbd('0x94')])){throw new db[(_0x5fbd('0x95'))]['ValidationError']('Wrong\x20credentials');}if(_0x31ce85[_0x5fbd('0x63')]['oldPassword']===_0x31ce85[_0x5fbd('0x63')][_0x5fbd('0x98')]){throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x31ce85[_0x5fbd('0x85')]['role']==='admin'){if(!_0x31ce85[_0x5fbd('0x63')]['newPassword']){throw new db['Sequelize'][(_0x5fbd('0x99'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x31ce85[_0x5fbd('0x85')]['role']==='user'){if(!_0x31ce85[_0x5fbd('0x63')][_0x5fbd('0x98')]){throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))](_0x5fbd('0x9a'));}if(_0x8089a4['role']!=='agent'){throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))](_0x5fbd('0x84'));}}else{throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))](_0x5fbd('0x84'));}return _0x8089a4;})[_0x5fbd('0x31')](handleEntityNotFound(_0x1a5221,null))[_0x5fbd('0x31')](function(_0x4797a3){return db['Setting']['findOne']({'attributes':['id',_0x5fbd('0x6b'),_0x5fbd('0x9b'),_0x5fbd('0x9c')]})[_0x5fbd('0x31')](function(_0x3045fa){if(_0x3045fa[_0x5fbd('0x6b')])authService[_0x5fbd('0x9d')](_0x31ce85['body'][_0x5fbd('0x98')]);if(!_0x3045fa['enforcePasswordHistory']||!_0x4797a3[_0x5fbd('0x46')])return _0x4797a3;authService['validatePasswordHistory'](_0x31ce85[_0x5fbd('0x63')][_0x5fbd('0x98')],_0x4797a3['previousPasswords'],_0x3045fa['passwordHistoryLimit']);return _0x4797a3;})[_0x5fbd('0x31')](saveUpdates({'password':_0x31ce85[_0x5fbd('0x63')][_0x5fbd('0x98')],'passwordResetAt':_0x31ce85[_0x5fbd('0x85')]['id']==_0x31ce85[_0x5fbd('0x64')]['id']?moment():null,'previousPasswords':authService[_0x5fbd('0x9e')](_0x31ce85['body'][_0x5fbd('0x98')],_0x4797a3[_0x5fbd('0x46')])},null));})[_0x5fbd('0x31')](respondWithResult(_0x1a5221,null))['catch'](handleError(_0x1a5221,null));};exports[_0x5fbd('0x9f')]=function(_0x3a0cab,_0x3be6bf){var _0x3ff489=_0x3a0cab[_0x5fbd('0x63')]['channel'];return db[_0x5fbd('0x4d')][_0x5fbd('0x3a')]({'where':{'id':_0x3a0cab[_0x5fbd('0x64')]['id']},'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0x2c'),'online',_0x5fbd('0xa0'),_0x5fbd('0xa1'),'interface']})[_0x5fbd('0x31')](handleEntityNotFound(_0x3be6bf,null))[_0x5fbd('0x31')](function(_0x1d9527){if(_0x1d9527){if(!utils[_0x5fbd('0xa2')](_0x3ff489)){throw new db['Sequelize']['ValidationError'](_0x5fbd('0xa3'));}return _0x1d9527[_0x5fbd('0xa4')+_[_0x5fbd('0xa5')](_0x3ff489['toLowerCase']())+'Queues'](_0x3a0cab['body']['ids'],{'penalty':_0x3a0cab['body'][_0x5fbd('0xa6')]||0x0})[_0x5fbd('0xa7')](function(_0x1c09ef){for(var _0x1a2838=0x0;_0x1a2838<_0x3a0cab[_0x5fbd('0x63')]['ids']['length'];_0x1a2838+=0x1){var _0x52c6c={'UserId':Number(_0x3a0cab[_0x5fbd('0x64')]['id'])};_0x52c6c[_[_0x5fbd('0xa5')](_0x3ff489[_0x5fbd('0xa8')]())+_0x5fbd('0xa9')]=Number(_0x3a0cab['body']['ids'][_0x1a2838]);socket[_0x5fbd('0x2e')](_0x5fbd('0x85')+_[_0x5fbd('0xa5')](_0x3ff489[_0x5fbd('0xa8')]())+_0x5fbd('0xaa'),_0x52c6c);}return _0x1c09ef;})[_0x5fbd('0x31')](function(){if(_0x3ff489===_0x5fbd('0xab')){return db[_0x5fbd('0xac')][_0x5fbd('0x56')]({'where':{'id':_0x3a0cab[_0x5fbd('0x63')]['ids']||[]},'raw':!![],'attributes':['id',_0x5fbd('0x3b')]});}})[_0x5fbd('0x31')](function(_0x544721){var _0x222e79=_0x1d9527[_0x5fbd('0x32')]({'plain':!![]});var _0x477b6d=[];if(_0x3ff489===_0x5fbd('0xab')&&_0x222e79[_0x5fbd('0x2c')]===_0x5fbd('0x2d')&&_0x222e79['online']){for(let _0x4a82ee=0x0;_0x4a82ee<_0x544721[_0x5fbd('0x73')];_0x4a82ee+=0x1){_0x477b6d[_0x5fbd('0x55')]({'membername':_0x222e79[_0x5fbd('0x3b')],'UserId':_0x222e79['id'],'queue_name':_0x544721[_0x4a82ee][_0x5fbd('0x3b')],'VoiceQueueId':_0x544721[_0x4a82ee]['id'],'interface':_['isNil'](_0x222e79[_0x5fbd('0xad')])?util[_0x5fbd('0xae')](_0x5fbd('0xaf'),_0x222e79[_0x5fbd('0x3b')]):_0x222e79[_0x5fbd('0xad')],'paused':_0x222e79[_0x5fbd('0xa1')]||![],'penalty':_0x3a0cab[_0x5fbd('0x63')]['penalty']||0x0});}return Promise[_0x5fbd('0x62')](_0x477b6d[_0x5fbd('0x41')](function(_0x1768ca){return db['UserVoiceQueueRt'][_0x5fbd('0xb0')](_0x1768ca);}));}return _0x1d9527;});}})['then'](respondWithStatusCode(_0x3be6bf,null))[_0x5fbd('0x2a')](handleError(_0x3be6bf,null));};exports[_0x5fbd('0xb1')]=function(_0x44865f,_0x2af706){var _0x1cd53b,_0x51a68e;return db['User'][_0x5fbd('0x3a')]({'where':{'id':_0x44865f[_0x5fbd('0x64')]['id']},'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0x2c')]})[_0x5fbd('0x31')](handleEntityNotFound(_0x2af706,null))['then'](function(_0x243479){if(_0x243479){_0x1cd53b=_0x243479;if(!_0x44865f[_0x5fbd('0x4e')]['channel']||!utils[_0x5fbd('0xa2')](_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0xb2')])){throw new db[(_0x5fbd('0x95'))]['ValidationError'](_0x5fbd('0xa3'));}return _0x243479[_0x5fbd('0xb3')+_['capitalize'](_0x44865f['query'][_0x5fbd('0xb2')]['toLowerCase']())+'Queues'](_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0x68')]);}})[_0x5fbd('0x31')](function(_0x3f8748){if(_['isArray'](_0x44865f[_0x5fbd('0x4e')]['ids'])){for(var _0x3de99e=0x0;_0x3de99e<_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0x68')][_0x5fbd('0x73')];_0x3de99e+=0x1){_0x51a68e={'UserId':Number(_0x44865f[_0x5fbd('0x64')]['id'])};_0x51a68e[_[_0x5fbd('0xa5')](_0x44865f[_0x5fbd('0x4e')]['channel'][_0x5fbd('0xa8')]())+_0x5fbd('0xa9')]=Number(_0x44865f[_0x5fbd('0x4e')]['ids'][_0x3de99e]);socket[_0x5fbd('0x2e')](_0x5fbd('0x85')+_['capitalize'](_0x44865f[_0x5fbd('0x4e')]['channel']['toLowerCase']())+_0x5fbd('0xb4'),_0x51a68e);}}else{_0x51a68e={'UserId':Number(_0x44865f['params']['id'])};_0x51a68e[_['capitalize'](_0x44865f[_0x5fbd('0x4e')]['channel'][_0x5fbd('0xa8')]())+_0x5fbd('0xa9')]=Number(_0x44865f['query'][_0x5fbd('0x68')]);socket[_0x5fbd('0x2e')](_0x5fbd('0x85')+_['capitalize'](_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0xb2')][_0x5fbd('0xa8')]())+'Queue:remove',_0x51a68e);}return _0x3f8748;})['then'](function(){if(_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0xb2')]===_0x5fbd('0xab')){return db[_0x5fbd('0xb5')]['destroy']({'where':{'UserId':_0x44865f['params']['id'],'VoiceQueueId':_0x44865f[_0x5fbd('0x4e')][_0x5fbd('0x68')]},'individualHooks':!![]})[_0x5fbd('0x31')](function(){return _0x1cd53b;});}return _0x1cd53b;})[_0x5fbd('0x31')](respondWithStatusCode(_0x2af706,null))[_0x5fbd('0x2a')](handleError(_0x2af706,null));};exports[_0x5fbd('0xb6')]=function(_0x44f9c5,_0x4440f4){_0x44f9c5[_0x5fbd('0x63')]['userpic']=_0x44f9c5['file'][_0x5fbd('0xb7')];return db['User']['find']({'where':{'id':_0x44f9c5[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x4440f4,null))[_0x5fbd('0x31')](saveUpdates(_0x44f9c5[_0x5fbd('0x63')],null))[_0x5fbd('0x31')](respondWithResult(_0x4440f4,null))[_0x5fbd('0x2a')](handleError(_0x4440f4,null));};exports['getAvatar']=function(_0x5ba973,_0x2edabe){var _0x1fe863=path[_0x5fbd('0xb8')](config['root'],_0x5fbd('0xb9'));return db['User'][_0x5fbd('0x3a')]({'where':{'id':_0x5ba973[_0x5fbd('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x2edabe,null))[_0x5fbd('0x31')](function(_0xfb11ee){if(_0xfb11ee){if(_[_0x5fbd('0x6d')](_0xfb11ee[_0x5fbd('0xba')])){return _0x2edabe[_0x5fbd('0xbb')](_0x1fe863);}else{if(!fs[_0x5fbd('0xbc')](path[_0x5fbd('0xb8')](config['root'],'server/files/images/',_0xfb11ee[_0x5fbd('0xba')]))){return _0x2edabe[_0x5fbd('0xbb')](_0x1fe863);}return _0x2edabe[_0x5fbd('0xbb')](path[_0x5fbd('0xb8')](config[_0x5fbd('0xbd')],_0x5fbd('0xbe'),_0xfb11ee[_0x5fbd('0xba')]));}}})[_0x5fbd('0x2a')](handleError(_0x2edabe,null));};exports[_0x5fbd('0xbf')]=function(_0x569a1a,_0x43916c){return db[_0x5fbd('0x4d')][_0x5fbd('0x3a')]({'where':{'id':_0x569a1a[_0x5fbd('0x64')]['id']},'attributes':['id']})[_0x5fbd('0x31')](handleEntityNotFound(_0x43916c,null))[_0x5fbd('0x31')](function(_0x48a929){var _0x2eb46f=[];values=_0x48a929[_0x5fbd('0x59')];_0x2eb46f[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x61'),_0x48a929[_0x5fbd('0x59')]));_0x2eb46f[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5a'),_0x48a929[_0x5fbd('0x59')]));_0x2eb46f[_0x5fbd('0x55')](get_open_tabs('openchannel',_0x48a929[_0x5fbd('0x59')]));_0x2eb46f['push'](get_open_tabs(_0x5fbd('0x5e'),_0x48a929[_0x5fbd('0x59')]));_0x2eb46f['push'](get_open_tabs(_0x5fbd('0x5b'),_0x48a929[_0x5fbd('0x59')]));_0x2eb46f[_0x5fbd('0x55')](get_open_tabs(_0x5fbd('0x5c'),_0x48a929[_0x5fbd('0x59')]));return Promise[_0x5fbd('0x62')](_0x2eb46f);})[_0x5fbd('0x31')](function(_0x230af2){if(_0x230af2){var _0x2a49eb=_[_0x5fbd('0x41')](values[_0x5fbd('0xc0')],function(_0x2e6214){return{'channel':_0x5fbd('0xc1'),'id':_0x2e6214['id'],'createdAt':_0x2e6214[_0x5fbd('0xc2')]};});var _0x24af7d=_[_0x5fbd('0x41')](values[_0x5fbd('0xc3')],function(_0xa0b7c2){return{'channel':_0x5fbd('0xc4'),'id':_0xa0b7c2['id'],'createdAt':_0xa0b7c2[_0x5fbd('0xc2')]};});var _0x156610=_[_0x5fbd('0x41')](values[_0x5fbd('0xc5')],function(_0x521794){return{'channel':_0x5fbd('0xc6'),'id':_0x521794['id'],'createdAt':_0x521794[_0x5fbd('0xc2')]};});var _0x589557=_[_0x5fbd('0x41')](values[_0x5fbd('0xc7')],function(_0x733c9e){return{'channel':_0x5fbd('0xc8'),'id':_0x733c9e['id'],'createdAt':_0x733c9e[_0x5fbd('0xc2')]};});var _0x5479a3=_[_0x5fbd('0x41')](values[_0x5fbd('0xc9')],function(_0x4a379a){return{'channel':_0x5fbd('0xca'),'id':_0x4a379a['id'],'createdAt':_0x4a379a[_0x5fbd('0xc2')]};});var _0x2869ba=_['map'](values[_0x5fbd('0xcb')],function(_0x1c9fe7){return{'channel':_0x5fbd('0xcc'),'id':_0x1c9fe7['id'],'createdAt':_0x1c9fe7['createdAt']};});var _0x316d47=_[_0x5fbd('0xcd')](_0x2a49eb,_0x24af7d,_0x156610,_0x589557,_0x5479a3,_0x2869ba);var _0x42d6c8={'count':_0x316d47[_0x5fbd('0x73')],'rows':_0x316d47};return _0x42d6c8;}else return null;})[_0x5fbd('0x31')](respondWithResult(_0x43916c,null))[_0x5fbd('0x2a')](handleError(_0x43916c,null));};exports[_0x5fbd('0xce')]=function(_0x55f96b,_0x101bab){var _0x748403={};return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x55f96b[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](function(_0xafcf88){if(!_0xafcf88){throw new APINotFoundError(util[_0x5fbd('0xae')](_0x5fbd('0xd0'),_0x55f96b[_0x5fbd('0x64')]['id']));}return contacts['describe']();})['then'](function(_0x26111e){_0x55f96b[_0x5fbd('0x4e')][_0x5fbd('0x4d')]=_0x55f96b['params']['id'];_0x748403=qs[_0x5fbd('0x4b')](_0x26111e,_0x55f96b);if(_0x55f96b[_0x5fbd('0x4e')][_0x5fbd('0xd1')]('includeAll')){_0x748403[_0x5fbd('0x52')]=[{'model':db[_0x5fbd('0xd2')],'as':_0x5fbd('0xd3'),'required':![]},{'model':db[_0x5fbd('0xd4')],'as':_0x5fbd('0xd5'),'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0xd6')],'where':_0x55f96b[_0x5fbd('0x4e')][_0x5fbd('0xd7')]?{'id':_0x55f96b[_0x5fbd('0x4e')][_0x5fbd('0xd7')]}:undefined,'required':_0x55f96b[_0x5fbd('0x4e')][_0x5fbd('0xd7')]?!![]:![]}];}return contacts[_0x5fbd('0x56')](_0x55f96b[_0x5fbd('0x4e')],_0x55f96b[_0x5fbd('0x85')],_0x748403,_0x26111e);})['then'](respondWithFilteredResult(_0x101bab,_0x748403))['catch'](APIHandleError(_0x101bab));};exports[_0x5fbd('0xd8')]=function(_0x48927b,_0x11c74f){var _0x4848b5;var _0x3a04cc={};var _0x53d6b9;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x48927b[_0x5fbd('0x64')]['id']},'attributes':['id','name',_0x5fbd('0x2c')]})[_0x5fbd('0x31')](handleEntityNotFound(_0x11c74f,null))[_0x5fbd('0x31')](function(_0x102d70){if(!utils['isValidChannel'](_0x48927b['query'][_0x5fbd('0xb2')])){throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))]('Unknown\x20channel');}_0x4848b5=_0x102d70;var _0x1faf7e={};_0x1faf7e[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db[_[_0x5fbd('0xa5')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0xb2')])+_0x5fbd('0xdb')][_0x5fbd('0x40')]);_0x1faf7e[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x48927b[_0x5fbd('0x4e')]);_0x1faf7e[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x1faf7e[_0x5fbd('0xd9')],_0x1faf7e[_0x5fbd('0x4e')]);_0x3a04cc[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x1faf7e[_0x5fbd('0xd9')],qs['fields'](_0x48927b['query']['fields']));_0x3a04cc[_0x5fbd('0x54')]=_0x3a04cc['attributes'][_0x5fbd('0x73')]?_0x3a04cc[_0x5fbd('0x54')]:_0x1faf7e[_0x5fbd('0xd9')];_0x3a04cc[_0x5fbd('0xde')]=qs[_0x5fbd('0xdf')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x3a04cc['where']=qs['filters'](_['pick'](_0x48927b[_0x5fbd('0x4e')],_0x1faf7e[_0x5fbd('0xdc')]));if(_0x48927b[_0x5fbd('0x4e')]['filter']){_0x3a04cc[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x3a04cc['where'],{'$or':_[_0x5fbd('0x41')](_0x3a04cc[_0x5fbd('0x54')],function(_0x219226){var _0x27a59c={};_0x27a59c[_0x219226]={'$like':'%'+_0x48927b['query'][_0x5fbd('0x43')]+'%'};return _0x27a59c;})});}_0x3a04cc=_['merge']({},_0x3a04cc,_0x48927b[_0x5fbd('0xe0')]);switch(_0x4848b5['role']){case'admin':return db[_[_0x5fbd('0xa5')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0xb2')])+_0x5fbd('0xdb')][_0x5fbd('0x56')](_0x3a04cc);case _0x5fbd('0x85'):case'agent':return _0x4848b5['get'+_[_0x5fbd('0xa5')](_0x48927b[_0x5fbd('0x4e')]['channel'])+_0x5fbd('0xe1')](_0x3a04cc);default:throw new db['Sequelize'][(_0x5fbd('0x99'))](_0x5fbd('0xe2'));}})[_0x5fbd('0x31')](function(_0x2320f1){_0x53d6b9=_0x2320f1[_0x5fbd('0x73')];if(!_0x48927b[_0x5fbd('0x4e')]['hasOwnProperty'](_0x5fbd('0xe3'))){_0x3a04cc[_0x5fbd('0x1d')]=qs[_0x5fbd('0x1d')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x3a04cc[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}switch(_0x4848b5[_0x5fbd('0x2c')]){case _0x5fbd('0x33'):return db[_[_0x5fbd('0xa5')](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0xb2')])+_0x5fbd('0xdb')][_0x5fbd('0x56')](_0x3a04cc);case _0x5fbd('0x85'):case _0x5fbd('0x2d'):return _0x4848b5[_0x5fbd('0x32')+_['capitalize'](_0x48927b[_0x5fbd('0x4e')][_0x5fbd('0xb2')])+'Queues'](_0x3a04cc);}})[_0x5fbd('0x31')](function(_0x5f56b4){return{'count':_0x53d6b9,'rows':_0x5f56b4};})[_0x5fbd('0x31')](respondWithResult(_0x11c74f,null))[_0x5fbd('0x2a')](handleError(_0x11c74f,null));};exports[_0x5fbd('0xe4')]=function(_0x1fc1c9,_0xd3c46f){var _0x3cad6c={};var _0x3098f1={};var _0x55aeae;var _0x50bda5;return db['User'][_0x5fbd('0xcf')]({'where':{'id':_0x1fc1c9[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0xd3c46f,null))['then'](function(_0xf62abf){if(_0xf62abf){_0x55aeae=_0xf62abf;_0x3098f1['model']=_['keys'](db[_0x5fbd('0xb5')]['rawAttributes']);_0x3098f1[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x1fc1c9[_0x5fbd('0x4e')]);_0x3098f1['filters']=_[_0x5fbd('0xdd')](_0x3098f1[_0x5fbd('0xd9')],_0x3098f1[_0x5fbd('0x4e')]);_0x3cad6c['attributes']=_['intersection'](_0x3098f1[_0x5fbd('0xd9')],qs['fields'](_0x1fc1c9['query'][_0x5fbd('0xe5')]));_0x3cad6c[_0x5fbd('0x54')]=_0x3cad6c[_0x5fbd('0x54')]['length']?_0x3cad6c[_0x5fbd('0x54')]:_0x3098f1[_0x5fbd('0xd9')];_0x3cad6c['order']=qs[_0x5fbd('0xdf')](_0x1fc1c9['query'][_0x5fbd('0xdf')]);_0x3cad6c[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_['pick'](_0x1fc1c9[_0x5fbd('0x4e')],_0x3098f1[_0x5fbd('0xdc')]));if(_0x1fc1c9['query']['filter']){_0x3cad6c[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x3cad6c[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x3cad6c[_0x5fbd('0x54')],function(_0x578b30){var _0x14eff3={};_0x14eff3[_0x578b30]={'$like':'%'+_0x1fc1c9[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x14eff3;})});}_0x3cad6c=_[_0x5fbd('0x60')]({},_0x3cad6c,_0x1fc1c9[_0x5fbd('0xe0')]);return _0x55aeae['getVoiceQueuesRt'](_0x3cad6c);}})[_0x5fbd('0x31')](function(_0x378f50){if(_0x378f50){_0x50bda5=_0x378f50[_0x5fbd('0x73')];if(!_0x1fc1c9[_0x5fbd('0x4e')][_0x5fbd('0xd1')]('nolimit')){_0x3cad6c[_0x5fbd('0x1d')]=qs[_0x5fbd('0x1d')](_0x1fc1c9[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x3cad6c[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x1fc1c9[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}return _0x55aeae['getVoiceQueuesRt'](_0x3cad6c);}})['then'](function(_0x394c4d){if(_0x394c4d){return _0x394c4d?{'count':_0x50bda5,'rows':_0x394c4d}:null;}})[_0x5fbd('0x31')](respondWithResult(_0xd3c46f,null))[_0x5fbd('0x2a')](handleError(_0xd3c46f,null));};exports[_0x5fbd('0xe6')]=function(_0x29aaac,_0x5b9117){var _0x1e8345={};var _0x77abbf={};var _0x3845af;var _0x13ba76;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x29aaac[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x5b9117,null))[_0x5fbd('0x31')](function(_0x152a1f){if(_0x152a1f){_0x3845af=_0x152a1f;_0x77abbf[_0x5fbd('0xd9')]=_['keys'](db[_0x5fbd('0xe7')][_0x5fbd('0x40')]);_0x77abbf['query']=_[_0x5fbd('0xda')](_0x29aaac[_0x5fbd('0x4e')]);_0x77abbf[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x77abbf['model'],_0x77abbf[_0x5fbd('0x4e')]);_0x1e8345[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x77abbf['model'],qs['fields'](_0x29aaac[_0x5fbd('0x4e')]['fields']));_0x1e8345[_0x5fbd('0x54')]=_0x1e8345[_0x5fbd('0x54')]['length']?_0x1e8345['attributes']:_0x77abbf[_0x5fbd('0xd9')];_0x1e8345[_0x5fbd('0xde')]=qs['sort'](_0x29aaac[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x1e8345['where']=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0x29aaac[_0x5fbd('0x4e')],_0x77abbf[_0x5fbd('0xdc')]));if(_0x29aaac[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x1e8345['where']=_[_0x5fbd('0x60')](_0x1e8345['where'],{'$or':_[_0x5fbd('0x41')](_0x1e8345[_0x5fbd('0x54')],function(_0x6ed60c){var _0x1e666c={};_0x1e666c[_0x6ed60c]={'$like':'%'+_0x29aaac[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x1e666c;})});}_0x1e8345=_[_0x5fbd('0x60')]({},_0x1e8345,_0x29aaac[_0x5fbd('0xe0')]);return _0x3845af[_0x5fbd('0xe6')](_0x1e8345);}})[_0x5fbd('0x31')](function(_0x558f07){if(_0x558f07){_0x13ba76=_0x558f07[_0x5fbd('0x73')];if(!_0x29aaac['query']['hasOwnProperty'](_0x5fbd('0xe3'))){_0x1e8345['limit']=qs['limit'](_0x29aaac[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x1e8345[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x29aaac[_0x5fbd('0x4e')]['offset']);}return _0x3845af[_0x5fbd('0xe6')](_0x1e8345);}})[_0x5fbd('0x31')](function(_0x4170a4){if(_0x4170a4){return _0x4170a4?{'count':_0x13ba76,'rows':_0x4170a4}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x5b9117,null))[_0x5fbd('0x2a')](handleError(_0x5b9117,null));};exports['getRecordings']=function(_0x1ea7b0,_0x56ea53){var _0x11fef0={'raw':!![],'where':{}};var _0x235143={};var _0x37369c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1ea7b0[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x56ea53,null))[_0x5fbd('0x31')](function(_0x433a82){if(_0x433a82){_0x235143[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db[_0x5fbd('0xe9')][_0x5fbd('0x40')]);_0x235143['query']=_[_0x5fbd('0xda')](_0x1ea7b0['query']);_0x235143[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x235143[_0x5fbd('0xd9')],_0x235143[_0x5fbd('0x4e')]);_0x11fef0['attributes']=_['intersection'](_0x235143[_0x5fbd('0xd9')],qs[_0x5fbd('0xe5')](_0x1ea7b0[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x11fef0[_0x5fbd('0x54')]=_0x11fef0[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x11fef0[_0x5fbd('0x54')]:_0x235143[_0x5fbd('0xd9')];if(!_0x1ea7b0[_0x5fbd('0x4e')]['hasOwnProperty']('nolimit')){_0x11fef0['limit']=qs[_0x5fbd('0x1d')](_0x1ea7b0['query'][_0x5fbd('0x1d')]);_0x11fef0[_0x5fbd('0x1b')]=qs['offset'](_0x1ea7b0['query'][_0x5fbd('0x1b')]);}_0x11fef0[_0x5fbd('0xde')]=qs['sort'](_0x1ea7b0[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x11fef0[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0x1ea7b0[_0x5fbd('0x4e')],_0x235143['filters']));_0x11fef0[_0x5fbd('0x4c')][_0x5fbd('0xea')]=_0x433a82['id'];if(_0x1ea7b0[_0x5fbd('0x4e')]['filter']){_0x11fef0['where']=_[_0x5fbd('0x60')](_0x11fef0[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x11fef0['attributes'],function(_0x38491d){var _0x413b6b={};_0x413b6b[_0x38491d]={'$like':'%'+_0x1ea7b0['query']['filter']+'%'};return _0x413b6b;})});}_0x11fef0=_[_0x5fbd('0x60')]({},_0x11fef0,_0x1ea7b0[_0x5fbd('0xe0')]);return db[_0x5fbd('0xe9')][_0x5fbd('0x1e')]({'where':_0x11fef0[_0x5fbd('0x4c')]})[_0x5fbd('0x31')](function(_0x5ca37f){_0x37369c['count']=_0x5ca37f;if(_0x1ea7b0['query'][_0x5fbd('0x4f')]){_0x11fef0[_0x5fbd('0x52')]=[{'all':!![]}];}return db['VoiceRecording'][_0x5fbd('0x56')](_0x11fef0);})[_0x5fbd('0x31')](function(_0x2d05a0){_0x37369c['rows']=_0x2d05a0;return _0x37369c;});}})[_0x5fbd('0x31')](respondWithFilteredResult(_0x56ea53,_0x11fef0))['catch'](handleError(_0x56ea53,null));};exports[_0x5fbd('0xeb')]=function(_0x521cba,_0x4aa266){var _0x589727={'raw':!![],'where':{}};var _0x5e1a13={};var _0x15ad33={'count':0x0,'rows':[]};return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x521cba[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x4aa266,null))[_0x5fbd('0x31')](function(_0x4bdaad){if(_0x4bdaad){_0x5e1a13['model']=_[_0x5fbd('0xda')](db[_0x5fbd('0xec')]['rawAttributes']);_0x5e1a13[_0x5fbd('0x4e')]=_['keys'](_0x521cba[_0x5fbd('0x4e')]);_0x5e1a13[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x5e1a13[_0x5fbd('0xd9')],_0x5e1a13[_0x5fbd('0x4e')]);_0x589727[_0x5fbd('0x54')]=_['intersection'](_0x5e1a13[_0x5fbd('0xd9')],qs['fields'](_0x521cba[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x589727['attributes']=_0x589727[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x589727[_0x5fbd('0x54')]:_0x5e1a13['model'];if(!_0x521cba['query']['hasOwnProperty'](_0x5fbd('0xe3'))){_0x589727['limit']=qs[_0x5fbd('0x1d')](_0x521cba['query'][_0x5fbd('0x1d')]);_0x589727['offset']=qs[_0x5fbd('0x1b')](_0x521cba['query'][_0x5fbd('0x1b')]);}_0x589727[_0x5fbd('0xde')]=qs['sort'](_0x521cba[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x589727[_0x5fbd('0x4c')]=qs['filters'](_[_0x5fbd('0xe8')](_0x521cba[_0x5fbd('0x4e')],_0x5e1a13[_0x5fbd('0xdc')]));_0x589727[_0x5fbd('0x4c')][_0x5fbd('0xea')]=_0x4bdaad['id'];if(_0x521cba[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x589727[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x589727[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x589727[_0x5fbd('0x54')],function(_0x3a5764){var _0x47360d={};_0x47360d[_0x3a5764]={'$like':'%'+_0x521cba['query']['filter']+'%'};return _0x47360d;})});}_0x589727=_[_0x5fbd('0x60')]({},_0x589727,_0x521cba[_0x5fbd('0xe0')]);return db[_0x5fbd('0xec')]['count']({'where':_0x589727['where']})[_0x5fbd('0x31')](function(_0x40d1c5){_0x15ad33[_0x5fbd('0x1e')]=_0x40d1c5;if(_0x521cba['query'][_0x5fbd('0x4f')]){_0x589727[_0x5fbd('0x52')]=[{'all':!![]}];}return db[_0x5fbd('0xec')][_0x5fbd('0x56')](_0x589727);})[_0x5fbd('0x31')](function(_0x33d44e){_0x15ad33[_0x5fbd('0x57')]=_0x33d44e;return _0x15ad33;});}})[_0x5fbd('0x31')](respondWithFilteredResult(_0x4aa266,_0x589727))['catch'](handleError(_0x4aa266,null));};exports[_0x5fbd('0xed')]=function(_0x214d2e,_0x2c4da8){var _0x194249={};var _0x40ec26={};var _0x2451a7;var _0x2eb816;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x214d2e[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x2c4da8,null))[_0x5fbd('0x31')](function(_0x12c9c1){if(_0x12c9c1){_0x2451a7=_0x12c9c1;_0x40ec26[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db['ChatInteraction'][_0x5fbd('0x40')]);_0x40ec26[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x214d2e[_0x5fbd('0x4e')]);_0x40ec26[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x40ec26[_0x5fbd('0xd9')],_0x40ec26[_0x5fbd('0x4e')]);_0x194249[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x40ec26[_0x5fbd('0xd9')],qs['fields'](_0x214d2e[_0x5fbd('0x4e')]['fields']));_0x194249[_0x5fbd('0x54')]=_0x194249[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x194249[_0x5fbd('0x54')]:_0x40ec26[_0x5fbd('0xd9')];_0x194249[_0x5fbd('0xde')]=qs[_0x5fbd('0xdf')](_0x214d2e[_0x5fbd('0x4e')]['sort']);_0x194249[_0x5fbd('0x4c')]=qs['filters'](_['pick'](_0x214d2e[_0x5fbd('0x4e')],_0x40ec26[_0x5fbd('0xdc')]));if(_0x214d2e[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x194249[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x194249[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x194249['attributes'],function(_0x1fc168){var _0x552743={};_0x552743[_0x1fc168]={'$like':'%'+_0x214d2e[_0x5fbd('0x4e')]['filter']+'%'};return _0x552743;})});}_0x194249=_[_0x5fbd('0x60')]({},_0x194249,_0x214d2e[_0x5fbd('0xe0')]);return _0x2451a7[_0x5fbd('0xed')](_0x194249);}})[_0x5fbd('0x31')](function(_0x5b9167){if(_0x5b9167){_0x2eb816=_0x5b9167[_0x5fbd('0x73')];if(!_0x214d2e[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x194249['limit']=qs['limit'](_0x214d2e['query'][_0x5fbd('0x1d')]);_0x194249[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x214d2e[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}return _0x2451a7[_0x5fbd('0xed')](_0x194249);}})[_0x5fbd('0x31')](function(_0x2f243e){if(_0x2f243e){return _0x2f243e?{'count':_0x2eb816,'rows':_0x2f243e}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x2c4da8,null))[_0x5fbd('0x2a')](handleError(_0x2c4da8,null));};exports['getOpenchannelInteractions']=function(_0xee7477,_0x54a607){var _0x545b4f={};var _0x3e13dc={};var _0x40eb31;var _0x555fcd;return db[_0x5fbd('0x4d')]['findOne']({'where':{'id':_0xee7477[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x54a607,null))[_0x5fbd('0x31')](function(_0x445d07){if(_0x445d07){_0x40eb31=_0x445d07;_0x3e13dc[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db[_0x5fbd('0xee')][_0x5fbd('0x40')]);_0x3e13dc[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0xee7477[_0x5fbd('0x4e')]);_0x3e13dc[_0x5fbd('0xdc')]=_['intersection'](_0x3e13dc[_0x5fbd('0xd9')],_0x3e13dc[_0x5fbd('0x4e')]);_0x545b4f['attributes']=_[_0x5fbd('0xdd')](_0x3e13dc[_0x5fbd('0xd9')],qs['fields'](_0xee7477[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x545b4f[_0x5fbd('0x54')]=_0x545b4f[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x545b4f[_0x5fbd('0x54')]:_0x3e13dc[_0x5fbd('0xd9')];_0x545b4f['order']=qs['sort'](_0xee7477[_0x5fbd('0x4e')]['sort']);_0x545b4f['where']=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0xee7477[_0x5fbd('0x4e')],_0x3e13dc['filters']));if(_0xee7477['query'][_0x5fbd('0x43')]){_0x545b4f[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x545b4f[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x545b4f[_0x5fbd('0x54')],function(_0x2ff726){var _0x39c4d6={};_0x39c4d6[_0x2ff726]={'$like':'%'+_0xee7477[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x39c4d6;})});}_0x545b4f=_[_0x5fbd('0x60')]({},_0x545b4f,_0xee7477[_0x5fbd('0xe0')]);return _0x40eb31['getOpenchannelInteractions'](_0x545b4f);}})[_0x5fbd('0x31')](function(_0x4bad67){if(_0x4bad67){_0x555fcd=_0x4bad67[_0x5fbd('0x73')];if(!_0xee7477[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x545b4f[_0x5fbd('0x1d')]=qs[_0x5fbd('0x1d')](_0xee7477[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x545b4f[_0x5fbd('0x1b')]=qs['offset'](_0xee7477[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}return _0x40eb31['getOpenchannelInteractions'](_0x545b4f);}})[_0x5fbd('0x31')](function(_0x139a5c){if(_0x139a5c){return _0x139a5c?{'count':_0x555fcd,'rows':_0x139a5c}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x54a607,null))[_0x5fbd('0x2a')](handleError(_0x54a607,null));};exports['getMailInteractions']=function(_0x909172,_0x9cf3b0){var _0x3c2601={'raw':!![],'where':{}};var _0x377d43={};var _0x1553f6={'count':0x0,'rows':[]};return db[_0x5fbd('0x4d')]['findOne']({'where':{'id':_0x909172[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x9cf3b0,null))[_0x5fbd('0x31')](function(_0x1da987){if(_0x1da987){_0x377d43[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db[_0x5fbd('0xef')]['rawAttributes']);_0x377d43[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x909172[_0x5fbd('0x4e')]);_0x377d43[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x377d43[_0x5fbd('0xd9')],_0x377d43[_0x5fbd('0x4e')]);_0x3c2601['attributes']=_[_0x5fbd('0xdd')](_0x377d43[_0x5fbd('0xd9')],qs[_0x5fbd('0xe5')](_0x909172['query']['fields']));_0x3c2601[_0x5fbd('0x54')]=_0x3c2601[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x3c2601['attributes']:_0x377d43['model'];if(!_0x909172[_0x5fbd('0x4e')]['hasOwnProperty']('nolimit')){_0x3c2601[_0x5fbd('0x1d')]=qs[_0x5fbd('0x1d')](_0x909172[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x3c2601['offset']=qs[_0x5fbd('0x1b')](_0x909172[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}_0x3c2601[_0x5fbd('0xde')]=qs['sort'](_0x909172[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x3c2601[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0x909172['query'],_0x377d43[_0x5fbd('0xdc')]));_0x3c2601[_0x5fbd('0x4c')][_0x5fbd('0xea')]=_0x1da987['id'];if(_0x909172[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x3c2601[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x3c2601[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x3c2601[_0x5fbd('0x54')],function(_0xa3c799){var _0x3cdda3={};_0x3cdda3[_0xa3c799]={'$like':'%'+_0x909172[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x3cdda3;})});}_0x3c2601=_[_0x5fbd('0x60')]({},_0x3c2601,_0x909172['options']);return db[_0x5fbd('0xef')][_0x5fbd('0x1e')]({'where':_0x3c2601[_0x5fbd('0x4c')]})[_0x5fbd('0x31')](function(_0x5019a6){_0x1553f6[_0x5fbd('0x1e')]=_0x5019a6;if(_0x909172[_0x5fbd('0x4e')][_0x5fbd('0x4f')]){_0x3c2601[_0x5fbd('0x52')]=[{'all':!![]}];}return db['MailInteraction'][_0x5fbd('0x56')](_0x3c2601);})['then'](function(_0x281952){_0x1553f6['rows']=_0x281952;return _0x1553f6;});}})[_0x5fbd('0x31')](respondWithFilteredResult(_0x9cf3b0,_0x3c2601))[_0x5fbd('0x2a')](handleError(_0x9cf3b0,null));};exports['getSmsInteractions']=function(_0x6f6c78,_0x5a7d83){var _0x24c1d6={};var _0x292690={};var _0x5b072e;var _0x23b66b;return db[_0x5fbd('0x4d')]['findOne']({'where':{'id':_0x6f6c78[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x5a7d83,null))['then'](function(_0x4abd20){if(_0x4abd20){_0x5b072e=_0x4abd20;_0x292690['model']=_['keys'](db[_0x5fbd('0xf0')][_0x5fbd('0x40')]);_0x292690[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x6f6c78[_0x5fbd('0x4e')]);_0x292690[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x292690[_0x5fbd('0xd9')],_0x292690[_0x5fbd('0x4e')]);_0x24c1d6[_0x5fbd('0x54')]=_['intersection'](_0x292690[_0x5fbd('0xd9')],qs[_0x5fbd('0xe5')](_0x6f6c78[_0x5fbd('0x4e')]['fields']));_0x24c1d6[_0x5fbd('0x54')]=_0x24c1d6[_0x5fbd('0x54')]['length']?_0x24c1d6['attributes']:_0x292690['model'];_0x24c1d6[_0x5fbd('0xde')]=qs[_0x5fbd('0xdf')](_0x6f6c78[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x24c1d6[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0x6f6c78['query'],_0x292690[_0x5fbd('0xdc')]));if(_0x6f6c78[_0x5fbd('0x4e')]['filter']){_0x24c1d6['where']=_[_0x5fbd('0x60')](_0x24c1d6[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x24c1d6[_0x5fbd('0x54')],function(_0x2149dd){var _0x262560={};_0x262560[_0x2149dd]={'$like':'%'+_0x6f6c78[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x262560;})});}_0x24c1d6=_[_0x5fbd('0x60')]({},_0x24c1d6,_0x6f6c78[_0x5fbd('0xe0')]);return _0x5b072e[_0x5fbd('0xf1')](_0x24c1d6);}})[_0x5fbd('0x31')](function(_0x466715){if(_0x466715){_0x23b66b=_0x466715[_0x5fbd('0x73')];if(!_0x6f6c78[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x24c1d6['limit']=qs[_0x5fbd('0x1d')](_0x6f6c78[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x24c1d6[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x6f6c78['query'][_0x5fbd('0x1b')]);}return _0x5b072e['getSmsInteractions'](_0x24c1d6);}})[_0x5fbd('0x31')](function(_0x4d9862){if(_0x4d9862){return _0x4d9862?{'count':_0x23b66b,'rows':_0x4d9862}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x5a7d83,null))[_0x5fbd('0x2a')](handleError(_0x5a7d83,null));};exports[_0x5fbd('0xf2')]=function(_0x456ea9,_0xef7cb4){var _0x258d5e={};var _0x1892b0={};var _0x59c50d;var _0x179f6b;return db[_0x5fbd('0x4d')]['findOne']({'where':{'id':_0x456ea9[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0xef7cb4,null))[_0x5fbd('0x31')](function(_0x1886e0){if(_0x1886e0){_0x59c50d=_0x1886e0;_0x1892b0[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db['FaxInteraction'][_0x5fbd('0x40')]);_0x1892b0[_0x5fbd('0x4e')]=_['keys'](_0x456ea9[_0x5fbd('0x4e')]);_0x1892b0[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x1892b0['model'],_0x1892b0[_0x5fbd('0x4e')]);_0x258d5e[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x1892b0['model'],qs[_0x5fbd('0xe5')](_0x456ea9[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x258d5e[_0x5fbd('0x54')]=_0x258d5e[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x258d5e['attributes']:_0x1892b0[_0x5fbd('0xd9')];_0x258d5e['order']=qs[_0x5fbd('0xdf')](_0x456ea9['query']['sort']);_0x258d5e[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_['pick'](_0x456ea9['query'],_0x1892b0['filters']));if(_0x456ea9[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x258d5e['where']=_[_0x5fbd('0x60')](_0x258d5e[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x258d5e['attributes'],function(_0x456f2f){var _0x1f7862={};_0x1f7862[_0x456f2f]={'$like':'%'+_0x456ea9[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x1f7862;})});}_0x258d5e=_['merge']({},_0x258d5e,_0x456ea9['options']);return _0x59c50d[_0x5fbd('0xf2')](_0x258d5e);}})[_0x5fbd('0x31')](function(_0xc7b830){if(_0xc7b830){_0x179f6b=_0xc7b830[_0x5fbd('0x73')];if(!_0x456ea9[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x258d5e['limit']=qs['limit'](_0x456ea9[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x258d5e[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x456ea9['query'][_0x5fbd('0x1b')]);}return _0x59c50d['getFaxInteractions'](_0x258d5e);}})[_0x5fbd('0x31')](function(_0x12ee49){if(_0x12ee49){return _0x12ee49?{'count':_0x179f6b,'rows':_0x12ee49}:null;}})[_0x5fbd('0x31')](respondWithResult(_0xef7cb4,null))[_0x5fbd('0x2a')](handleError(_0xef7cb4,null));};exports[_0x5fbd('0xf3')]=function(_0x16f8e9,_0x1c1ca1){var _0x25089e={};var _0x56fb2f={};var _0x5af606;var _0xa76f0e;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x16f8e9[_0x5fbd('0x64')]['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x1c1ca1,null))['then'](function(_0x4af803){if(_0x4af803){_0x5af606=_0x4af803;_0x56fb2f[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db['WhatsappInteraction']['rawAttributes']);_0x56fb2f[_0x5fbd('0x4e')]=_['keys'](_0x16f8e9[_0x5fbd('0x4e')]);_0x56fb2f[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x56fb2f[_0x5fbd('0xd9')],_0x56fb2f[_0x5fbd('0x4e')]);_0x25089e[_0x5fbd('0x54')]=_['intersection'](_0x56fb2f['model'],qs[_0x5fbd('0xe5')](_0x16f8e9['query']['fields']));_0x25089e[_0x5fbd('0x54')]=_0x25089e[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x25089e['attributes']:_0x56fb2f[_0x5fbd('0xd9')];_0x25089e[_0x5fbd('0xde')]=qs[_0x5fbd('0xdf')](_0x16f8e9[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x25089e[_0x5fbd('0x4c')]=qs['filters'](_['pick'](_0x16f8e9[_0x5fbd('0x4e')],_0x56fb2f['filters']));if(_0x16f8e9[_0x5fbd('0x4e')]['filter']){_0x25089e[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x25089e[_0x5fbd('0x4c')],{'$or':_['map'](_0x25089e['attributes'],function(_0x3b6240){var _0x1a88ea={};_0x1a88ea[_0x3b6240]={'$like':'%'+_0x16f8e9[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x1a88ea;})});}_0x25089e=_['merge']({},_0x25089e,_0x16f8e9[_0x5fbd('0xe0')]);return _0x5af606[_0x5fbd('0xf3')](_0x25089e);}})[_0x5fbd('0x31')](function(_0x2ae986){if(_0x2ae986){_0xa76f0e=_0x2ae986[_0x5fbd('0x73')];if(!_0x16f8e9[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x25089e['limit']=qs[_0x5fbd('0x1d')](_0x16f8e9[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x25089e[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x16f8e9[_0x5fbd('0x4e')][_0x5fbd('0x1b')]);}return _0x5af606[_0x5fbd('0xf3')](_0x25089e);}})[_0x5fbd('0x31')](function(_0x44ec8b){if(_0x44ec8b){return _0x44ec8b?{'count':_0xa76f0e,'rows':_0x44ec8b}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x1c1ca1,null))['catch'](handleError(_0x1c1ca1,null));};exports['login']=function(_0x4a35d9,_0x460f8b,_0xa869b3){var _0xa64aed;var _0x1094b6;var _0x2295da;var _0x9e1ba7=!_[_0x5fbd('0x6d')](_0x4a35d9[_0x5fbd('0x64')]['id'])?_0x4a35d9[_0x5fbd('0x64')]['id']:!_[_0x5fbd('0x6d')](_0x4a35d9[_0x5fbd('0x85')]['id'])?_0x4a35d9[_0x5fbd('0x85')]['id']:null;return db[_0x5fbd('0x4d')][_0x5fbd('0x3a')]({'where':{'id':_0x9e1ba7,'role':{'$or':[_0x5fbd('0x33'),_0x5fbd('0x85'),'agent']}},'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0xf4'),_0x5fbd('0xf5'),'role',_0x5fbd('0x69'),_0x5fbd('0xa0')]})[_0x5fbd('0x31')](function(_0xf78d1d){if(_0xf78d1d){if(_0xf78d1d[_0x5fbd('0x2c')]===_0x5fbd('0x2d')){_0xa64aed=_0xf78d1d;if(_0x4a35d9[_0x5fbd('0x63')][_0x5fbd('0xad')]){_0x2295da=util['format'](_0x5fbd('0xf6'),_0xa64aed[_0x4a35d9[_0x5fbd('0x63')]['interface']]);}else if(_0x4a35d9[_0x5fbd('0x63')][_0x5fbd('0xf7')]){_0x2295da=util['format'](_0x5fbd('0xaf'),_0x4a35d9[_0x5fbd('0x63')]['intrf']);}else{_0x2295da=util[_0x5fbd('0xae')](_0x5fbd('0xaf'),_0xa64aed[_0x5fbd('0x3b')]);}socket['to'](util[_0x5fbd('0xae')]('user:%s',_0xa64aed[_0x5fbd('0x3b')]))[_0x5fbd('0x2e')]('user:forcelogout',{'user':{'id':_0xa64aed['id'],'name':_0xa64aed[_0x5fbd('0x3b')]},'ip':_0x4a35d9['headers']['x-forwarded-for']||_0x4a35d9['connection']['remoteAddress']||_0x4a35d9[_0x5fbd('0xf8')][_0x5fbd('0xf9')]||_0x4a35d9['connection'][_0x5fbd('0xf8')][_0x5fbd('0xf9')]});return db[_0x5fbd('0xb5')][_0x5fbd('0x30')]({'where':{'membername':_0xa64aed[_0x5fbd('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x5fbd('0x95'))][(_0x5fbd('0x99'))](_0x5fbd('0xfa'));}})[_0x5fbd('0x31')](function(){if(_0xa64aed){return _0xa64aed[_0x5fbd('0xfb')]({'raw':!![]});}})[_0x5fbd('0x31')](function(_0x1c957c){if(_0xa64aed){if(_0x1c957c){_0x1094b6=_0x1c957c;if(_0x1094b6[_0x5fbd('0x73')]){var _0x55f50e=_0x1094b6['map'](function(_0x4aab92){var _0x5a26da={'membername':_0xa64aed[_0x5fbd('0x3b')],'UserId':_0xa64aed['id'],'queue_name':_0x4aab92['name'],'VoiceQueueId':_0x4aab92['id'],'interface':_0x2295da,'paused':_0xa64aed['loginInPause']||![],'penalty':_0x4aab92['UserVoiceQueue.penalty']||0x0};return db[_0x5fbd('0xb5')]['upsert'](_0x5a26da);});return Promise[_0x5fbd('0x62')](_0x55f50e);}}}})[_0x5fbd('0x31')](function(){if(_0xa64aed){return db[_0x5fbd('0xfc')][_0x5fbd('0x56')]({'where':{'membername':_0xa64aed[_0x5fbd('0x3b')],'exitAt':null}});}})['then'](function(_0x553569){if(_0xa64aed){var _0x3ebc74=[];_0x553569[_0x5fbd('0xfd')](function(_0xb51909){_0x3ebc74[_0x5fbd('0x55')](_0xb51909[_0x5fbd('0x2b')]({'exitAt':moment()[_0x5fbd('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5fbd('0x62')](_0x3ebc74);}})[_0x5fbd('0x31')](function(){if(_0xa64aed){var _0x36a3e8=[];var _0x3856d7=[];var _0x48c240=utils[_0x5fbd('0xfe')]();var _0x4ba52e={'membername':_0xa64aed[_0x5fbd('0x3b')],'interface':_0x2295da,'enterAt':moment()[_0x5fbd('0xae')](_0x5fbd('0xff')),'role':_0xa64aed[_0x5fbd('0x2c')],'internal':_0xa64aed[_0x5fbd('0x69')]};_0x48c240[_0x5fbd('0xfd')](function(_0x36cc77){_0x36a3e8[_0x5fbd('0x55')](_[_0x5fbd('0x60')]({'channel':_0x36cc77,'type':'LOGIN','data1':_0x4a35d9[_0x5fbd('0x63')]['device'],'data2':_0x2295da},_0x4ba52e));if(_0xa64aed[_0x5fbd('0xa0')]){_0x3856d7['push'](_[_0x5fbd('0x60')]({'channel':_0x36cc77,'type':_0x5fbd('0x100'),'data1':_0x5fbd('0x101')},_0x4ba52e));}});return db['MemberReport'][_0x5fbd('0x8e')](_0x36a3e8['concat'](_0x3856d7),{'individualHooks':!![]});}})[_0x5fbd('0x31')](function(){if(_0xa64aed){return _0xa64aed[_0x5fbd('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x5fbd('0xae')](_0x5fbd('0xff')),'voicePause':_0xa64aed[_0x5fbd('0xa0')]||![],'mailPause':_0xa64aed['loginInPause']||![],'chatPause':_0xa64aed['loginInPause']||![],'faxPause':_0xa64aed[_0x5fbd('0xa0')]||![],'smsPause':_0xa64aed[_0x5fbd('0xa0')]||![],'openchannelPause':_0xa64aed[_0x5fbd('0xa0')]||![],'whatsappPause':_0xa64aed['loginInPause']||![],'pauseType':_0xa64aed[_0x5fbd('0xa0')]?_0x5fbd('0x101'):null,'interface':_0x2295da,'lastPauseAt':moment()[_0x5fbd('0xae')](_0x5fbd('0xff'))});}})[_0x5fbd('0x31')](function(_0x27bf9b){if(_0x4a35d9[_0x5fbd('0x102')]){return _0xa869b3();}else{return Promise[_0x5fbd('0x103')](_0x27bf9b)[_0x5fbd('0x31')](respondWithResult(_0x460f8b,null));}})[_0x5fbd('0x2a')](handleError(_0x460f8b,null));};exports['logout']=function(_0x510207,_0x4d5c0a){var _0x523d4c;return db[_0x5fbd('0x4d')][_0x5fbd('0x3a')]({'where':{'id':_0x510207[_0x5fbd('0x64')]['id'],'role':_0x5fbd('0x2d')},'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0x2c')]})[_0x5fbd('0x31')](handleEntityNotFound(_0x4d5c0a,null))[_0x5fbd('0x31')](function(_0x28c48f){if(_0x28c48f){_0x523d4c=_0x28c48f;return db[_0x5fbd('0xb5')]['destroy']({'where':{'membername':_0x523d4c[_0x5fbd('0x3b')]},'individualHooks':!![]});}})[_0x5fbd('0x31')](function(){return db['MemberReport'][_0x5fbd('0x56')]({'where':{'membername':_0x523d4c[_0x5fbd('0x3b')],'exitAt':null}});})[_0x5fbd('0x31')](function(_0x90dcc4){var _0x59c576=[];_0x90dcc4['forEach'](function(_0x3c15f2){_0x59c576[_0x5fbd('0x55')](_0x3c15f2['update']({'exitAt':moment()[_0x5fbd('0xae')](_0x5fbd('0xff'))}));});return Promise[_0x5fbd('0x62')](_0x59c576);})[_0x5fbd('0x31')](function(){return _0x523d4c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5fbd('0x31')](respondWithResult(_0x4d5c0a,null))[_0x5fbd('0x2a')](handleError(_0x4d5c0a,null));};exports[_0x5fbd('0x104')]=function(_0x55853b,_0x280102){var _0x27361e;return db[_0x5fbd('0xb5')][_0x5fbd('0x2b')]({'paused':0x1},{'where':{'UserId':_0x55853b[_0x5fbd('0x64')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x5fbd('0x3a')]({'where':{'id':_0x55853b['params']['id'],'role':'agent'},'attributes':['id',_0x5fbd('0x3b'),_0x5fbd('0x2c'),_0x5fbd('0x69'),'interface',_0x5fbd('0x105')]});})[_0x5fbd('0x31')](handleEntityNotFound(_0x280102,null))[_0x5fbd('0x31')](function(_0x57557f){if(_0x57557f){_0x27361e=_0x57557f;return respondWithRpcPromise(_0x5fbd('0x106'),_0x5fbd('0x104'),{'id':_0x27361e['id'],'name':_0x27361e['name'],'pause':!![]});}})[_0x5fbd('0x31')](function(){if(_0x27361e){return db['MemberReport']['findAll']({'where':{'membername':_0x27361e[_0x5fbd('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x5fbd('0x31')](function(_0x358a38){if(_0x358a38[_0x5fbd('0x73')]){var _0x54192f=moment()[_0x5fbd('0xae')](_0x5fbd('0xff'));for(var _0x3dac33=0x0,_0x30ef61=_0x358a38[_0x5fbd('0x73')];_0x3dac33<_0x30ef61;_0x3dac33++){_0x358a38[_0x3dac33]['updateAttributes']({'exitAt':_0x54192f});}}})[_0x5fbd('0x31')](function(){var _0x342163=[];var _0x222854=utils['getChannels']();_0x222854[_0x5fbd('0xfd')](function(_0x21cd8c){_0x342163['push']({'channel':_0x21cd8c,'membername':_0x27361e['name'],'interface':_[_0x5fbd('0x6d')](_0x27361e[_0x5fbd('0xad')])?util['format'](_0x5fbd('0xaf'),_0x27361e[_0x5fbd('0x3b')]):_0x27361e[_0x5fbd('0xad')],'type':_0x5fbd('0x100'),'enterAt':moment()['format'](_0x5fbd('0xff')),'data1':_0x55853b[_0x5fbd('0x63')][_0x5fbd('0x107')]||_0x5fbd('0x108'),'role':_0x27361e[_0x5fbd('0x2c')],'internal':_0x27361e[_0x5fbd('0x69')]});});return db[_0x5fbd('0xfc')][_0x5fbd('0x8e')](_0x342163,{'individualHooks':!![]});})[_0x5fbd('0x31')](function(){return _0x27361e[_0x5fbd('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x55853b[_0x5fbd('0x63')][_0x5fbd('0x107')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x5fbd('0xff'))});})[_0x5fbd('0x31')](respondWithResult(_0x280102,null))[_0x5fbd('0x2a')](handleError(_0x280102,null));};exports[_0x5fbd('0x109')]=function(_0x400656,_0x22d084){if(_0x400656[_0x5fbd('0x63')][_0x5fbd('0xb2')]&&!utils[_0x5fbd('0xa2')](_0x400656['body'][_0x5fbd('0xb2')])){throw new APIBadRequestError(util[_0x5fbd('0xae')](_0x5fbd('0x10a'),_0x400656[_0x5fbd('0x63')][_0x5fbd('0xb2')]));}return db[_0x5fbd('0x4d')]['find']({'where':{'id':_0x400656[_0x5fbd('0x64')]['id']},'attributes':['id',_0x5fbd('0x3b'),'role',_0x5fbd('0x69'),_0x5fbd('0xad'),_0x5fbd('0x105'),_0x5fbd('0xa1'),_0x5fbd('0x10b'),_0x5fbd('0x10c'),_0x5fbd('0x10d'),_0x5fbd('0x10e'),_0x5fbd('0x10f'),_0x5fbd('0x110'),_0x5fbd('0x111'),_0x5fbd('0x112')]})['then'](function(_0x46779f){if(!_0x46779f){throw new APINotFoundError(util[_0x5fbd('0xae')](_0x5fbd('0xd0'),_0x400656['params']['id']));}return _0x46779f[_0x5fbd('0x109')](_0x400656[_0x5fbd('0x63')][_0x5fbd('0xb2')]);})['then'](respondWithResult(_0x22d084,null))['catch'](APIHandleError(_0x22d084));};exports[_0x5fbd('0x113')]=function(_0x166549,_0x3ed047){var _0x4a5895={};var _0x48ed88={};var _0x262bcd;var _0x49d74b;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x166549[_0x5fbd('0x64')]['id']}})['then'](handleEntityNotFound(_0x3ed047,null))['then'](function(_0x4f5b9d){if(_0x4f5b9d){_0x262bcd=_0x4f5b9d;_0x48ed88[_0x5fbd('0xd9')]=_['keys'](db[_0x5fbd('0x114')][_0x5fbd('0x40')]);_0x48ed88['query']=_[_0x5fbd('0xda')](_0x166549[_0x5fbd('0x4e')]);_0x48ed88[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x48ed88[_0x5fbd('0xd9')],_0x48ed88[_0x5fbd('0x4e')]);_0x4a5895[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x48ed88['model'],qs[_0x5fbd('0xe5')](_0x166549[_0x5fbd('0x4e')]['fields']));_0x4a5895[_0x5fbd('0x54')]=_0x4a5895[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x4a5895[_0x5fbd('0x54')]:_0x48ed88[_0x5fbd('0xd9')];_0x4a5895['order']=qs[_0x5fbd('0xdf')](_0x166549[_0x5fbd('0x4e')]['sort']);_0x4a5895[_0x5fbd('0x4c')]=qs['filters'](_[_0x5fbd('0xe8')](_0x166549[_0x5fbd('0x4e')],_0x48ed88[_0x5fbd('0xdc')]));if(_0x166549[_0x5fbd('0x4e')][_0x5fbd('0x43')]){_0x4a5895[_0x5fbd('0x4c')]=_['merge'](_0x4a5895[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x4a5895['attributes'],function(_0x38ab22){var _0x129a70={};_0x129a70[_0x38ab22]={'$like':'%'+_0x166549[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x129a70;})});}_0x4a5895=_['merge']({},_0x4a5895,_0x166549['options']);return _0x262bcd['getTeams'](_0x4a5895);}})[_0x5fbd('0x31')](function(_0x193bae){if(_0x193bae){_0x49d74b=_0x193bae[_0x5fbd('0x73')];if(!_0x166549[_0x5fbd('0x4e')][_0x5fbd('0xd1')](_0x5fbd('0xe3'))){_0x4a5895[_0x5fbd('0x1d')]=qs['limit'](_0x166549[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x4a5895['offset']=qs[_0x5fbd('0x1b')](_0x166549['query']['offset']);}return _0x262bcd[_0x5fbd('0x113')](_0x4a5895);}})[_0x5fbd('0x31')](function(_0x497b58){if(_0x497b58){return _0x497b58?{'count':_0x49d74b,'rows':_0x497b58}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x3ed047,null))[_0x5fbd('0x2a')](handleError(_0x3ed047,null));};exports[_0x5fbd('0x115')]=function(_0x35c017,_0x31d5cb){var _0x1d6b51=_0x35c017[_0x5fbd('0x64')]['id'];var _0x1bef28=_0x35c017['body']?_0x35c017[_0x5fbd('0x63')][_0x5fbd('0x68')]:null;var _0x51a508=[];return Promise[_0x5fbd('0x103')]()[_0x5fbd('0x31')](function(){if(!_0x1bef28)throw new APIBadRequestError(_0x5fbd('0x116'));})[_0x5fbd('0x31')](function(){return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x1d6b51}});})[_0x5fbd('0x31')](function(_0x48af82){if(!_0x48af82)throw new APINotFoundError(util[_0x5fbd('0xae')](_0x5fbd('0xd0'),_0x35c017[_0x5fbd('0x64')]['id']));return db['sequelize'][_0x5fbd('0x117')](function(_0x5a2d92){return _0x48af82[_0x5fbd('0x115')](_0x1bef28,{'transaction':_0x5a2d92})[_0x5fbd('0x31')](function(){return db[_0x5fbd('0x114')][_0x5fbd('0x56')]({'where':{'id':{'$in':_0x1bef28}}});})[_0x5fbd('0x31')](function(_0x43a391){var _0x2781da=_['map'](_0x43a391,function(_0x293dde){return _0x293dde[_0x5fbd('0x118')]();});return Promise['all'](_0x2781da);})[_0x5fbd('0x31')](function(_0x1fccca){_0x51a508=_[_0x5fbd('0x119')](_0x1fccca);var _0x1584c5=_[_0x5fbd('0x41')](_0x51a508,function(_0x3bf6d1){return _0x3bf6d1[_0x5fbd('0x11a')](_0x48af82['id'],{'transaction':_0x5a2d92});});return Promise['all'](_0x1584c5);})['then'](function(){if(!_0x48af82[_0x5fbd('0x105')])return;var _0x50bb65=_[_0x5fbd('0x43')](_0x51a508,function(_0xfb6f42){return _0xfb6f42[_0x5fbd('0x11b')]('channel')===_0x5fbd('0x11c');});var _0x544a03=_[_0x5fbd('0x41')](_0x50bb65,function(_0x499c35){return db[_0x5fbd('0xb5')][_0x5fbd('0xb0')]({'membername':_0x48af82[_0x5fbd('0x3b')],'UserId':_0x48af82['id'],'queue_name':_0x499c35[_0x5fbd('0x3b')],'VoiceQueueId':_0x499c35['id'],'interface':_[_0x5fbd('0x6d')](_0x48af82[_0x5fbd('0xad')])?util['format'](_0x5fbd('0xaf'),_0x48af82[_0x5fbd('0x3b')]):_0x48af82[_0x5fbd('0xad')],'paused':_0x48af82[_0x5fbd('0xa1')]||![],'penalty':_0x48af82[_0x5fbd('0xa6')]},{'transaction':_0x5a2d92});});return Promise[_0x5fbd('0x62')](_0x544a03);})[_0x5fbd('0x31')](function(){return db[_0x5fbd('0x11d')][_0x5fbd('0x56')]({'where':{'teamId':{'$in':_0x1bef28}}});})[_0x5fbd('0x31')](function(_0x15d688){var _0x2be613=_[_0x5fbd('0x41')](_0x15d688,function(_0x4864be){return db[_0x5fbd('0x11e')]['create']({'UserId':_0x48af82['id'],'VoicePrefixId':_0x4864be[_0x5fbd('0x11f')]},{'transaction':_0x5a2d92});});return Promise[_0x5fbd('0x62')](_0x2be613);});});})[_0x5fbd('0x31')](function(){for(var _0x12722f=0x0;_0x12722f<_0x51a508['length'];_0x12722f++){var _0x5644c3=_0x51a508[_0x12722f][_0x5fbd('0x11b')]('channel');var _0x2eee63=_0x5644c3+'QueueId';socket[_0x5fbd('0x2e')](_0x5fbd('0x85')+_0x5644c3+'Queue:save',{'UserId':_0x1d6b51,['queueField']:_0x51a508[_0x12722f]['id']});}})[_0x5fbd('0x31')](respondWithStatusCode(_0x31d5cb,null))['catch'](APIHandleError(_0x31d5cb));};exports[_0x5fbd('0x120')]=function(_0x500770,_0x17e4a2){var _0x35b090=_0x500770[_0x5fbd('0x64')]['id'];var _0x168b70=null;if(_0x500770[_0x5fbd('0x4e')][_0x5fbd('0x68')]){_0x168b70=_[_0x5fbd('0x121')](_0x500770[_0x5fbd('0x4e')][_0x5fbd('0x68')])?_0x500770['query'][_0x5fbd('0x68')]:[_0x500770['query']['ids']];}var _0x5ddbce=[];return Promise[_0x5fbd('0x103')]()[_0x5fbd('0x31')](function(){if(!_0x168b70)throw new APIBadRequestError(_0x5fbd('0x122'));})['then'](function(){return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x35b090}});})[_0x5fbd('0x31')](function(_0x5aec0c){if(!_0x5aec0c)throw new APINotFoundError(util['format'](_0x5fbd('0xd0'),_0x500770[_0x5fbd('0x64')]['id']));return db[_0x5fbd('0x6f')][_0x5fbd('0x117')](function(_0x148408){return _0x5aec0c[_0x5fbd('0x120')](_0x168b70,{'transaction':_0x148408})[_0x5fbd('0x31')](function(){return db[_0x5fbd('0x114')][_0x5fbd('0x56')]({'where':{'id':{'$in':_0x168b70}}});})[_0x5fbd('0x31')](function(_0x387a26){var _0xab4f67=_['map'](_0x387a26,function(_0x5778ff){return _0x5778ff[_0x5fbd('0x118')]();});return Promise[_0x5fbd('0x62')](_0xab4f67);})[_0x5fbd('0x31')](function(_0x52ff8e){_0x5ddbce=_[_0x5fbd('0x119')](_0x52ff8e);var _0x250cfe=_['map'](_0x5ddbce,function(_0x26db3b){return _0x26db3b[_0x5fbd('0x123')](_0x5aec0c['id'],{'transaction':_0x148408});});return Promise[_0x5fbd('0x62')](_0x250cfe);})['then'](function(){if(!_0x5aec0c[_0x5fbd('0x105')])return;var _0x4515b1=_[_0x5fbd('0x43')](_0x5ddbce,function(_0x4530aa){return _0x4530aa['getDataValue']('channel')===_0x5fbd('0x11c');});var _0x1a5dc7=_[_0x5fbd('0x41')](_0x4515b1,function(_0x3f15a2){return db[_0x5fbd('0xb5')]['destroy']({'where':{'VoiceQueueId':_0x3f15a2['id'],'UserId':_0x5aec0c['id']},'transaction':_0x148408});});return Promise[_0x5fbd('0x62')](_0x1a5dc7);})[_0x5fbd('0x31')](function(){return db['TeamVoicePrefix'][_0x5fbd('0x56')]({'where':{'teamId':{'$in':_0x168b70}}});})[_0x5fbd('0x31')](function(_0x1b94ac){var _0x3c2312=_[_0x5fbd('0x41')](_0x1b94ac,function(_0x10f125){return db[_0x5fbd('0x11e')]['destroy']({'where':{'UserId':_0x5aec0c['id'],'VoicePrefixId':_0x10f125[_0x5fbd('0x11f')]}},{'transaction':_0x148408});});return Promise[_0x5fbd('0x62')](_0x3c2312);});});})[_0x5fbd('0x31')](function(){for(var _0x506175=0x0;_0x506175<_0x5ddbce['length'];_0x506175++){var _0x155330=_0x5ddbce[_0x506175][_0x5fbd('0x11b')](_0x5fbd('0xb2'));var _0x5488d7=_0x155330+'QueueId';socket[_0x5fbd('0x2e')]('user'+_0x155330+_0x5fbd('0xb4'),{'UserId':_0x35b090,['queueField']:_0x5ddbce[_0x506175]['id']});}})[_0x5fbd('0x31')](respondWithStatusCode(_0x17e4a2,null))[_0x5fbd('0x2a')](APIHandleError(_0x17e4a2));};exports[_0x5fbd('0x124')]=function(_0x44b59f,_0x3541de){var _0x1566c5={};var _0x71691c={};var _0x54117f;var _0x512ab2;return db[_0x5fbd('0x4d')]['findOne']({'where':{'id':_0x44b59f[_0x5fbd('0x64')]['id']}})['then'](handleEntityNotFound(_0x3541de,null))[_0x5fbd('0x31')](function(_0x348f4f){if(_0x348f4f){_0x54117f=_0x348f4f;_0x71691c[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db['CmList'][_0x5fbd('0x40')]);_0x71691c['query']=_[_0x5fbd('0xda')](_0x44b59f[_0x5fbd('0x4e')]);_0x71691c[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x71691c[_0x5fbd('0xd9')],_0x71691c[_0x5fbd('0x4e')]);_0x1566c5[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x71691c[_0x5fbd('0xd9')],qs[_0x5fbd('0xe5')](_0x44b59f[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x1566c5[_0x5fbd('0x54')]=_0x1566c5[_0x5fbd('0x54')][_0x5fbd('0x73')]?_0x1566c5['attributes']:_0x71691c[_0x5fbd('0xd9')];_0x1566c5['order']=qs[_0x5fbd('0xdf')](_0x44b59f[_0x5fbd('0x4e')][_0x5fbd('0xdf')]);_0x1566c5[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_['pick'](_0x44b59f['query'],_0x71691c['filters']));if(_0x44b59f[_0x5fbd('0x4e')]['filter']){_0x1566c5[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x1566c5[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x1566c5['attributes'],function(_0x36c81f){var _0x4d0e6d={};_0x4d0e6d[_0x36c81f]={'$like':'%'+_0x44b59f[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x4d0e6d;})});}_0x1566c5=_[_0x5fbd('0x60')]({},_0x1566c5,_0x44b59f[_0x5fbd('0xe0')]);return _0x54117f[_0x5fbd('0x124')](_0x1566c5);}})[_0x5fbd('0x31')](function(_0x2e2981){if(_0x2e2981){_0x512ab2=_0x2e2981[_0x5fbd('0x73')];if(!_0x44b59f[_0x5fbd('0x4e')]['hasOwnProperty'](_0x5fbd('0xe3'))){_0x1566c5[_0x5fbd('0x1d')]=qs['limit'](_0x44b59f[_0x5fbd('0x4e')][_0x5fbd('0x1d')]);_0x1566c5['offset']=qs[_0x5fbd('0x1b')](_0x44b59f['query']['offset']);}return _0x54117f[_0x5fbd('0x124')](_0x1566c5);}})[_0x5fbd('0x31')](function(_0x4c43e3){if(_0x4c43e3){return _0x4c43e3?{'count':_0x512ab2,'rows':_0x4c43e3}:null;}})[_0x5fbd('0x31')](respondWithResult(_0x3541de,null))[_0x5fbd('0x2a')](handleError(_0x3541de,null));};exports[_0x5fbd('0x125')]=function(_0x5d4c4b,_0x4511df){var _0x24330e={};var _0x3a6bf7={};var _0x240944;return db[_0x5fbd('0x4d')][_0x5fbd('0xcf')]({'where':{'id':_0x5d4c4b['params']['id']}})[_0x5fbd('0x31')](handleEntityNotFound(_0x4511df,null))['then'](function(_0x5925d2){if(_0x5925d2){_0x240944=_0x5925d2;_0x3a6bf7[_0x5fbd('0xd9')]=_[_0x5fbd('0xda')](db[_0x5fbd('0x4d')][_0x5fbd('0x40')]);_0x3a6bf7[_0x5fbd('0x4e')]=_[_0x5fbd('0xda')](_0x5d4c4b[_0x5fbd('0x4e')]);_0x3a6bf7[_0x5fbd('0xdc')]=_[_0x5fbd('0xdd')](_0x3a6bf7['model'],_0x3a6bf7[_0x5fbd('0x4e')]);_0x24330e[_0x5fbd('0x54')]=_[_0x5fbd('0xdd')](_0x3a6bf7[_0x5fbd('0xd9')],qs[_0x5fbd('0xe5')](_0x5d4c4b[_0x5fbd('0x4e')][_0x5fbd('0xe5')]));_0x24330e['attributes']=_0x24330e[_0x5fbd('0x54')]['length']?_0x24330e[_0x5fbd('0x54')]:_0x3a6bf7[_0x5fbd('0xd9')];_0x24330e['order']=qs[_0x5fbd('0xdf')](_0x5d4c4b[_0x5fbd('0x4e')]['sort']);_0x24330e[_0x5fbd('0x4c')]=qs[_0x5fbd('0xdc')](_[_0x5fbd('0xe8')](_0x5d4c4b['query'],_0x3a6bf7[_0x5fbd('0xdc')]));if(_0x5d4c4b[_0x5fbd('0x4e')]['filter']){_0x24330e[_0x5fbd('0x4c')]=_[_0x5fbd('0x60')](_0x24330e[_0x5fbd('0x4c')],{'$or':_[_0x5fbd('0x41')](_0x24330e[_0x5fbd('0x54')],function(_0x1bf856){var _0x1ad061={};_0x1ad061[_0x1bf856]={'$like':'%'+_0x5d4c4b[_0x5fbd('0x4e')][_0x5fbd('0x43')]+'%'};return _0x1ad061;})});}_0x24330e['model']=db['User'];_0x24330e['as']='Agents';_0x24330e=_[_0x5fbd('0x60')]({},_0x24330e,_0x5d4c4b[_0x5fbd('0xe0')]);return _0x240944[_0x5fbd('0xfb')]({'include':[_0x24330e]});}})[_0x5fbd('0x31')](function(_0x5167ca){if(_0x5167ca){var _0x18f453={},_0x5f097a=[];for(var _0x3b5fea=0x0;_0x3b5fea<_0x5167ca[_0x5fbd('0x73')];_0x3b5fea+=0x1){for(var _0x3cc0a5=0x0,_0x40530d;_0x3cc0a5<_0x5167ca[_0x3b5fea]['Agents']['length'];_0x3cc0a5+=0x1){_0x40530d=_0x5167ca[_0x3b5fea]['Agents'][_0x3cc0a5][_0x5fbd('0x32')]({'plain':!![]});_0x18f453[_0x40530d['id']]=_0x40530d;}}_0x18f453=_[_0x5fbd('0x126')](_0x18f453);for(var _0x298ab8=qs[_0x5fbd('0x1b')](_0x5d4c4b['query'][_0x5fbd('0x1b')]);_0x298ab8<_0x18f453[_0x5fbd('0x73')]&&_0x5f097a['length']=_0x5ddb51[_0xa1b5('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return db[_0xa1b5('0x28')][_0xa1b5('0x49')]({'where':{'membername':_0x1029b7[_0xa1b5('0x22')]},'individualHooks':!![]});}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return _0x1029b7[_0xa1b5('0x53')]({'raw':!![]});}})[_0xa1b5('0x17')](function(_0x508a06){if(_0x1029b7){if(_0x508a06){var _0x56830d=[];_0x1f1a06=_0x508a06;if(_0x1f1a06[_0xa1b5('0x2c')]){for(var _0xf6de52=0x0;_0xf6de52<_0x1f1a06[_0xa1b5('0x2c')];_0xf6de52++){_0x56830d[_0xa1b5('0x2f')](db[_0xa1b5('0x28')][_0xa1b5('0x54')]({'membername':_0x1029b7[_0xa1b5('0x22')],'UserId':_0x1029b7['id'],'queue_name':_0x1f1a06[_0xf6de52][_0xa1b5('0x22')],'VoiceQueueId':_0x1f1a06[_0xf6de52]['id'],'interface':_0x1a856f,'paused':_0x1029b7[_0xa1b5('0x4d')]||![],'penalty':_0x1f1a06[_0xf6de52][_0xa1b5('0x55')]||0x0}));}return BPromise[_0xa1b5('0x4a')](_0x56830d);}}}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return db[_0xa1b5('0x2a')]['findAll']({'where':{'membername':_0x1029b7[_0xa1b5('0x22')],'exitAt':null}});}})[_0xa1b5('0x17')](function(_0x282de7){if(_0x1029b7){if(_0x282de7&&_0x282de7[_0xa1b5('0x2c')]){var _0x50a7b6=[];_0x282de7[_0xa1b5('0x2e')](function(_0x5c2c60){_0x50a7b6['push'](_0x5c2c60['update']({'exitAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37'))}));});return BPromise[_0xa1b5('0x4a')](_0x50a7b6);}}})['then'](function(){if(_0x1029b7){var _0x4391c8=[];var _0x58b4f6=[];var _0x42829b=utils[_0xa1b5('0x56')]();var _0xface5f={'membername':_0x1029b7[_0xa1b5('0x22')],'interface':_0x1a856f,'enterAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37')),'role':_0x1029b7[_0xa1b5('0x23')],'internal':_0x1029b7[_0xa1b5('0x24')]};_0x42829b[_0xa1b5('0x2e')](function(_0x2fd1a0){_0x4391c8[_0xa1b5('0x2f')](_[_0xa1b5('0x57')]({'channel':_0x2fd1a0,'type':_0xa1b5('0x58'),'data1':_0xa1b5('0x59'),'data2':_0x1a856f},_0xface5f));if(_0x1029b7['loginInPause']){_0x58b4f6[_0xa1b5('0x2f')](_[_0xa1b5('0x57')]({'channel':_0x2fd1a0,'type':_0xa1b5('0x2b'),'data1':_0xa1b5('0x5a')},_0xface5f));}});return db[_0xa1b5('0x2a')][_0xa1b5('0x36')](_0x4391c8[_0xa1b5('0x5b')](_0x58b4f6),{'individualHooks':!![]});}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return _0x1029b7[_0xa1b5('0x29')]({'online':!![],'lastLoginAt':moment()[_0xa1b5('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1029b7[_0xa1b5('0x4d')]||![],'mailPause':_0x1029b7[_0xa1b5('0x4d')]||![],'chatPause':_0x1029b7[_0xa1b5('0x4d')]||![],'faxPause':_0x1029b7[_0xa1b5('0x4d')]||![],'smsPause':_0x1029b7[_0xa1b5('0x4d')]||![],'openchannelPause':_0x1029b7[_0xa1b5('0x4d')]||![],'pauseType':_0x1029b7[_0xa1b5('0x4d')]?_0xa1b5('0x5a'):null,'lastPauseAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37')),'interface':_0x1a856f});}})['then'](function(_0x21c95c){_0x5155ac(_0x21c95c);})[_0xa1b5('0x1b')](function(_0x19ea09){_0x44a26b(_0x890133[_0xa1b5('0x1c')](0x1f4,_0x19ea09[_0xa1b5('0x20')]));});});}; \ No newline at end of file +var _0xc39d=['findOne','voicePause','mailPause','chatPause','faxPause','whatsappPause','pauseType','params','system','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','all','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','bluebird','../../mysqldb','rpc','defaults','redis','socket.io-emitter','./user.socket','register','GetUser','options','raw','where','attributes','include','map','model','debug','catch','message','error','User','find','info','ShowUser','stringify','name','role','interface','then','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','MemberReport','findAll','PAUSE','length','updateAttributes','forEach','push','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','internal','uniqueid','update','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xc39d,0x1a7));var _0xdc39=function(_0x414976,_0x394f11){_0x414976=_0x414976-0x0;var _0x4d2906=_0xc39d[_0x414976];return _0x4d2906;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdc39('0x0'));var Redis=require('ioredis');var db=require(_0xdc39('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc39('0x2'));var config=require('../../config/environment');config['redis']=_[_0xdc39('0x3')](config[_0xdc39('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc39('0x5'))(new Redis(config['redis']));require(_0xdc39('0x6'))[_0xdc39('0x7')](socket);exports[_0xdc39('0x8')]=function(_0x4ff239){var _0x55cc63=this;return new Promise(function(_0x1cd0a1,_0x40c1af){return db['User']['findAll']({'raw':_0x4ff239['options']?_0x4ff239[_0xdc39('0x9')][_0xdc39('0xa')]===undefined?!![]:![]:!![],'where':_0x4ff239[_0xdc39('0x9')]?_0x4ff239[_0xdc39('0x9')][_0xdc39('0xb')]||null:null,'attributes':_0x4ff239[_0xdc39('0x9')]?_0x4ff239[_0xdc39('0x9')][_0xdc39('0xc')]||null:null,'limit':_0x4ff239[_0xdc39('0x9')]?_0x4ff239[_0xdc39('0x9')]['limit']||null:null,'include':_0x4ff239[_0xdc39('0x9')]?_0x4ff239['options'][_0xdc39('0xd')]?_[_0xdc39('0xe')](_0x4ff239['options']['include'],function(_0x3826c6){return{'model':db[_0x3826c6[_0xdc39('0xf')]],'as':_0x3826c6['as'],'attributes':_0x3826c6[_0xdc39('0xc')],'include':_0x3826c6['include']?_['map'](_0x3826c6[_0xdc39('0xd')],function(_0x37b828){return{'model':db[_0x37b828[_0xdc39('0xf')]],'as':_0x37b828['as'],'attributes':_0x37b828[_0xdc39('0xc')],'include':_0x37b828[_0xdc39('0xd')]?_[_0xdc39('0xe')](_0x37b828['include'],function(_0x353e82){return{'model':db[_0x353e82[_0xdc39('0xf')]],'as':_0x353e82['as'],'attributes':_0x353e82[_0xdc39('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fff84){logger['info']('GetUser',_0x4ff239);logger[_0xdc39('0x10')]('GetUser',_0x4ff239,JSON['stringify'](_0x2fff84));_0x1cd0a1(_0x2fff84);})[_0xdc39('0x11')](function(_0x50910a){logger['error'](_0xdc39('0x8'),_0x50910a[_0xdc39('0x12')],_0x4ff239);_0x40c1af(_0x55cc63[_0xdc39('0x13')](0x1f4,_0x50910a[_0xdc39('0x12')]));});});};exports['ShowUser']=function(_0x95e6ed){var _0x2f9586=this;return new Promise(function(_0x52b5cf,_0x23d221){return db[_0xdc39('0x14')][_0xdc39('0x15')]({'raw':_0x95e6ed[_0xdc39('0x9')]?_0x95e6ed[_0xdc39('0x9')][_0xdc39('0xa')]===undefined?!![]:![]:!![],'where':_0x95e6ed[_0xdc39('0x9')]?_0x95e6ed[_0xdc39('0x9')]['where']||null:null,'attributes':_0x95e6ed[_0xdc39('0x9')]?_0x95e6ed[_0xdc39('0x9')][_0xdc39('0xc')]||null:null,'include':_0x95e6ed[_0xdc39('0x9')]?_0x95e6ed[_0xdc39('0x9')][_0xdc39('0xd')]?_[_0xdc39('0xe')](_0x95e6ed[_0xdc39('0x9')][_0xdc39('0xd')],function(_0x471bc3){return{'model':db[_0x471bc3[_0xdc39('0xf')]],'as':_0x471bc3['as'],'attributes':_0x471bc3[_0xdc39('0xc')],'include':_0x471bc3['include']?_['map'](_0x471bc3[_0xdc39('0xd')],function(_0x309a45){return{'model':db[_0x309a45[_0xdc39('0xf')]],'as':_0x309a45['as'],'attributes':_0x309a45[_0xdc39('0xc')],'include':_0x309a45['include']?_[_0xdc39('0xe')](_0x309a45[_0xdc39('0xd')],function(_0x3b529e){return{'model':db[_0x3b529e[_0xdc39('0xf')]],'as':_0x3b529e['as'],'attributes':_0x3b529e[_0xdc39('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc508e2){logger[_0xdc39('0x16')](_0xdc39('0x17'),_0x95e6ed);logger['debug'](_0xdc39('0x17'),_0x95e6ed,JSON[_0xdc39('0x18')](_0xc508e2));_0x52b5cf(_0xc508e2);})[_0xdc39('0x11')](function(_0x35799c){logger['error']('ShowUser',_0x35799c[_0xdc39('0x12')],_0x95e6ed);_0x23d221(_0x2f9586['error'](0x1f4,_0x35799c[_0xdc39('0x12')]));});});};exports['PauseUser']=function(_0x8aa3ed){var _0x2e9bc9;return db[_0xdc39('0x14')][_0xdc39('0x15')]({'where':_0x8aa3ed[_0xdc39('0x9')][_0xdc39('0xb')]||{},'attributes':['id',_0xdc39('0x19'),_0xdc39('0x1a'),'internal',_0xdc39('0x1b')]})[_0xdc39('0x1c')](function(_0x7e7268){if(!_0x7e7268){throw new Error(util[_0xdc39('0x1d')](_0xdc39('0x1e'),_0x8aa3ed['params']['id']));}_0x2e9bc9=_0x7e7268;return db[_0xdc39('0x1f')]['update']({'paused':0x1},{'where':{'UserId':_0x2e9bc9['id']},'individualHooks':!![]});})[_0xdc39('0x1c')](function(){return db[_0xdc39('0x20')][_0xdc39('0x21')]({'where':{'membername':_0x2e9bc9[_0xdc39('0x19')],'type':_0xdc39('0x22'),'exitAt':null}});})[_0xdc39('0x1c')](function(_0x31f9d1){if(_0x31f9d1&&_0x31f9d1[_0xdc39('0x23')]){var _0x2815ec=moment()[_0xdc39('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x761bf8=0x0,_0x3db197=_0x31f9d1['length'];_0x761bf8<_0x3db197;_0x761bf8++){_0x31f9d1[_0x761bf8][_0xdc39('0x24')]({'exitAt':_0x2815ec});}}})['then'](function(){var _0x3a3b87=[];var _0x50bb65=utils['getChannels']();_0x50bb65[_0xdc39('0x25')](function(_0x2c0834){_0x3a3b87[_0xdc39('0x26')]({'channel':_0x2c0834,'membername':_0x2e9bc9['name'],'interface':_['isNil'](_0x2e9bc9[_0xdc39('0x1b')])?util[_0xdc39('0x1d')](_0xdc39('0x27'),_0x2e9bc9[_0xdc39('0x19')]):_0x2e9bc9[_0xdc39('0x1b')],'type':_0xdc39('0x22'),'enterAt':moment()[_0xdc39('0x1d')](_0xdc39('0x28')),'data1':_0x8aa3ed[_0xdc39('0x29')][_0xdc39('0x2a')]||_0xdc39('0x2b'),'role':_0x2e9bc9[_0xdc39('0x1a')],'internal':_0x2e9bc9[_0xdc39('0x2c')],'uniqueid':_0x8aa3ed[_0xdc39('0x29')][_0xdc39('0x2d')]||null});});return db[_0xdc39('0x20')]['bulkCreate'](_0x3a3b87,{'individualHooks':!![]});})[_0xdc39('0x1c')](function(){return _0x2e9bc9[_0xdc39('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x8aa3ed[_0xdc39('0x29')][_0xdc39('0x2a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xdc39('0x28'))});})[_0xdc39('0x11')](function(_0x1db3bb){throw _0x1db3bb;});};exports[_0xdc39('0x2f')]=function(_0x84f544){return Promise[_0xdc39('0x30')]()[_0xdc39('0x1c')](function(){if(_0x84f544[_0xdc39('0x29')]['channel']&&!utils['isValidChannel'](_0x84f544[_0xdc39('0x29')][_0xdc39('0x31')])){throw new Error(util[_0xdc39('0x1d')](_0xdc39('0x32'),_0x84f544['body'][_0xdc39('0x31')]));}return db[_0xdc39('0x14')][_0xdc39('0x33')]({'where':_0x84f544[_0xdc39('0x9')][_0xdc39('0xb')]||{},'attributes':['id',_0xdc39('0x19'),_0xdc39('0x1a'),_0xdc39('0x2c'),_0xdc39('0x1b'),'online',_0xdc39('0x34'),_0xdc39('0x35'),_0xdc39('0x36'),_0xdc39('0x37'),'openchannelPause','smsPause',_0xdc39('0x38'),_0xdc39('0x39'),'lastPauseAt']});})['then'](function(_0x21f865){if(!_0x21f865){throw new Error(util[_0xdc39('0x1d')](_0xdc39('0x1e'),_0x84f544[_0xdc39('0x3a')]['id']));}return _0x21f865['unpause'](_0x84f544[_0xdc39('0x29')]['channel'],_0xdc39('0x3b'));})[_0xdc39('0x11')](function(_0x10a93a){throw _0x10a93a;});};exports['LogoutUser']=function(_0x202fb9){var _0x4278e8=this;return new Promise(function(_0x57cef1,_0x143929){var _0x4038d6;return db[_0xdc39('0x14')][_0xdc39('0x33')]({'where':_0x202fb9[_0xdc39('0x9')]['where']||{},'attributes':['id',_0xdc39('0x19')]})['then'](function(_0x29cb9c){if(_0x29cb9c){_0x4038d6=_0x29cb9c;return db[_0xdc39('0x1f')]['destroy']({'where':{'membername':_0x4038d6['name']},'individualHooks':!![]});}})['then'](function(){if(_0x4038d6){return db[_0xdc39('0x20')][_0xdc39('0x21')]({'where':{'membername':_0x4038d6[_0xdc39('0x19')],'exitAt':null}});}})['then'](function(_0x33500e){if(_0x4038d6){if(_0x33500e&&_0x33500e[_0xdc39('0x23')]){var _0x5c29e1=[];_0x33500e[_0xdc39('0x25')](function(_0xff520d){_0x5c29e1['push'](_0xff520d[_0xdc39('0x2e')]({'exitAt':moment()[_0xdc39('0x1d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5c29e1);}}})[_0xdc39('0x1c')](function(){if(_0x4038d6){return _0x4038d6[_0xdc39('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdc39('0x1c')](function(_0xb06489){_0x57cef1(_0xb06489);})[_0xdc39('0x11')](function(_0x51fe72){_0x143929(_0x4278e8['error'](0x1f4,_0x51fe72[_0xdc39('0x12')]));});});};exports[_0xdc39('0x3c')]=function(_0x27d39a){var _0x13fa38=this;return new Promise(function(_0x487139,_0x25789b){var _0x485076;var _0x3a52d2;var _0x8621de;var _0x2a7cf4;return db['User']['findOne']({'where':_0x27d39a[_0xdc39('0x9')]['where']||{},'attributes':['id',_0xdc39('0x19'),_0xdc39('0x1a'),_0xdc39('0x3d'),_0xdc39('0x3e'),_0xdc39('0x2c'),_0xdc39('0x3f'),_0xdc39('0x1b')]})['then'](function(_0x36b37d){if(_0x36b37d){_0x485076=_0x36b37d;_0x2a7cf4=_0x27d39a[_0xdc39('0x29')]['interface']?_0x27d39a[_0xdc39('0x29')][_0xdc39('0x1b')]:util[_0xdc39('0x1d')](_0xdc39('0x27'),_0x485076[_0xdc39('0x19')]);return db[_0xdc39('0x14')]['count']({'where':{'role':_0xdc39('0x40'),'online':!![],'id':{'$ne':_0x485076['id']}}});}})[_0xdc39('0x1c')](function(_0x5a9b88){if(_0x5a9b88){_0x8621de=_0x5a9b88;return require(_0xdc39('0x41'))[_0xdc39('0x42')]();}})[_0xdc39('0x1c')](function(_0x3e81b2){if(_0x3e81b2&&_0x3e81b2[_0xdc39('0x43')]&&_0x8621de>=_0x3e81b2[_0xdc39('0x43')]){throw new Error(_0xdc39('0x44'));}})['then'](function(){if(_0x485076){return db[_0xdc39('0x1f')][_0xdc39('0x45')]({'where':{'membername':_0x485076[_0xdc39('0x19')]},'individualHooks':!![]});}})['then'](function(){if(_0x485076){return _0x485076[_0xdc39('0x46')]({'raw':!![]});}})[_0xdc39('0x1c')](function(_0x20a9b0){if(_0x485076){if(_0x20a9b0){var _0x30405d=[];_0x3a52d2=_0x20a9b0;if(_0x3a52d2['length']){for(var _0x41105d=0x0;_0x41105d<_0x3a52d2[_0xdc39('0x23')];_0x41105d++){_0x30405d[_0xdc39('0x26')](db[_0xdc39('0x1f')][_0xdc39('0x47')]({'membername':_0x485076['name'],'UserId':_0x485076['id'],'queue_name':_0x3a52d2[_0x41105d]['name'],'VoiceQueueId':_0x3a52d2[_0x41105d]['id'],'interface':_0x2a7cf4,'paused':_0x485076['loginInPause']||![],'penalty':_0x3a52d2[_0x41105d]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xdc39('0x48')](_0x30405d);}}}})[_0xdc39('0x1c')](function(){if(_0x485076){return db[_0xdc39('0x20')]['findAll']({'where':{'membername':_0x485076[_0xdc39('0x19')],'exitAt':null}});}})['then'](function(_0x6c0274){if(_0x485076){if(_0x6c0274&&_0x6c0274['length']){var _0x575437=[];_0x6c0274[_0xdc39('0x25')](function(_0x3e388e){_0x575437[_0xdc39('0x26')](_0x3e388e[_0xdc39('0x2e')]({'exitAt':moment()[_0xdc39('0x1d')](_0xdc39('0x28'))}));});return BPromise['all'](_0x575437);}}})[_0xdc39('0x1c')](function(){if(_0x485076){var _0x152753=[];var _0x34c413=[];var _0x537c32=utils[_0xdc39('0x49')]();var _0x22f671={'membername':_0x485076[_0xdc39('0x19')],'interface':_0x2a7cf4,'enterAt':moment()[_0xdc39('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x485076[_0xdc39('0x1a')],'internal':_0x485076[_0xdc39('0x2c')]};_0x537c32[_0xdc39('0x25')](function(_0x2a35a4){_0x152753[_0xdc39('0x26')](_[_0xdc39('0x4a')]({'channel':_0x2a35a4,'type':_0xdc39('0x4b'),'data1':_0xdc39('0x4c'),'data2':_0x2a7cf4},_0x22f671));if(_0x485076['loginInPause']){_0x34c413[_0xdc39('0x26')](_[_0xdc39('0x4a')]({'channel':_0x2a35a4,'type':_0xdc39('0x22'),'data1':_0xdc39('0x4d')},_0x22f671));}});return db[_0xdc39('0x20')]['bulkCreate'](_0x152753[_0xdc39('0x4e')](_0x34c413),{'individualHooks':!![]});}})[_0xdc39('0x1c')](function(){if(_0x485076){return _0x485076[_0xdc39('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xdc39('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x485076['loginInPause']||![],'mailPause':_0x485076[_0xdc39('0x3f')]||![],'chatPause':_0x485076[_0xdc39('0x3f')]||![],'faxPause':_0x485076['loginInPause']||![],'smsPause':_0x485076[_0xdc39('0x3f')]||![],'openchannelPause':_0x485076[_0xdc39('0x3f')]||![],'pauseType':_0x485076[_0xdc39('0x3f')]?_0xdc39('0x4d'):null,'lastPauseAt':moment()[_0xdc39('0x1d')](_0xdc39('0x28')),'interface':_0x2a7cf4});}})[_0xdc39('0x1c')](function(_0x51aa6b){_0x487139(_0x51aa6b);})[_0xdc39('0x11')](function(_0x358efb){_0x25789b(_0x13fa38[_0xdc39('0x13')](0x1f4,_0x358efb[_0xdc39('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fd5cc0d..3f5fd0b 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 _0x91fb=['save','remove','update','emit','register','user:','./user.events'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x91fb,0xb5));var _0xb91f=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x91fb[_0x1abeb2];return _0x48da20;};'use strict';var UserEvents=require(_0xb91f('0x0'));var events=[_0xb91f('0x1'),_0xb91f('0x2'),_0xb91f('0x3')];function createListener(_0x3af23b,_0x4037c3){return function(_0x10d156){_0x4037c3[_0xb91f('0x4')](_0x3af23b,_0x10d156);};}function removeListener(_0x5f3330,_0x27cb92){return function(){UserEvents['removeListener'](_0x5f3330,_0x27cb92);};}exports[_0xb91f('0x5')]=function(_0x269f52){for(var _0x38ac92=0x0,_0x3c77d2=events['length'];_0x38ac92<_0x3c77d2;_0x38ac92++){var _0x4fbb0b=events[_0x38ac92];var _0x54e539=createListener(_0xb91f('0x6')+_0x4fbb0b,_0x269f52);UserEvents['on'](_0x4fbb0b,_0x54e539);}}; \ No newline at end of file +var _0xd41e=['emit','register','length','./user.events','save'];(function(_0x25a928,_0x1c3cb3){var _0x49ea9b=function(_0x137046){while(--_0x137046){_0x25a928['push'](_0x25a928['shift']());}};_0x49ea9b(++_0x1c3cb3);}(_0xd41e,0x8f));var _0xed41=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xd41e[_0x16bb4b];return _0x8aeb84;};'use strict';var UserEvents=require(_0xed41('0x0'));var events=[_0xed41('0x1'),'remove','update'];function createListener(_0x2d3377,_0x4aa779){return function(_0x499117){_0x4aa779[_0xed41('0x2')](_0x2d3377,_0x499117);};}function removeListener(_0x4c8383,_0x2ccf15){return function(){UserEvents['removeListener'](_0x4c8383,_0x2ccf15);};}exports[_0xed41('0x3')]=function(_0x403221){for(var _0x22ae83=0x0,_0x2693c0=events[_0xed41('0x4')];_0x22ae83<_0x2693c0;_0x22ae83++){var _0x2c41f8=events[_0x22ae83];var _0x412b23=createListener('user:'+_0x2c41f8,_0x403221);UserEvents['on'](_0x2c41f8,_0x412b23);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7dc84a7..ed6fa50 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xb9404d,_0xb9c541){var _0x5cfcf7=function(_0x1732d2){while(--_0x1732d2){_0xb9404d['push'](_0xb9404d['shift']());}};_0x5cfcf7(++_0xb9c541);}(_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(_0x14a618,_0x4a9e5d){var _0xae4f4f=function(_0x1c6f74){while(--_0x1c6f74){_0x14a618['push'](_0x14a618['shift']());}};_0xae4f4f(++_0x4a9e5d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3520406..9f6691f 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 _0x9376=['INTEGER','sequelize','exports'];(function(_0x18824e,_0x1fa3a2){var _0x355e42=function(_0x5876ff){while(--_0x5876ff){_0x18824e['push'](_0x18824e['shift']());}};_0x355e42(++_0x1fa3a2);}(_0x9376,0x18a));var _0x6937=function(_0xe936a7,_0x3e8ff1){_0xe936a7=_0xe936a7-0x0;var _0x4096e0=_0x9376[_0xe936a7];return _0x4096e0;};'use strict';var Sequelize=require(_0x6937('0x0'));module[_0x6937('0x1')]={'penalty':{'type':Sequelize[_0x6937('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf28=['INTEGER','sequelize'];(function(_0x3a60a2,_0xf6eaf7){var _0x2b8554=function(_0x3661c5){while(--_0x3661c5){_0x3a60a2['push'](_0x3a60a2['shift']());}};_0x2b8554(++_0xf6eaf7);}(_0xbf28,0x109));var _0x8bf2=function(_0x50d45b,_0x2dbc57){_0x50d45b=_0x50d45b-0x0;var _0x4ac431=_0xbf28[_0x50d45b];return _0x4ac431;};'use strict';var Sequelize=require(_0x8bf2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8bf2('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 10eaa37..ea44cbd 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 _0x6b80=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x3d0958,_0x204a7e){var _0x1c77f8=function(_0x39a179){while(--_0x39a179){_0x3d0958['push'](_0x3d0958['shift']());}};_0x1c77f8(++_0x204a7e);}(_0x6b80,0x134));var _0x06b8=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x6b80[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0x06b8('0x0'));var util=require('util');var logger=require(_0x06b8('0x1'))(_0x06b8('0x2'));var moment=require('moment');var BPromise=require(_0x06b8('0x3'));var rp=require(_0x06b8('0x4'));var fs=require('fs');var path=require(_0x06b8('0x5'));var rimraf=require(_0x06b8('0x6'));var config=require(_0x06b8('0x7'));var attributes=require(_0x06b8('0x8'));module[_0x06b8('0x9')]=function(_0x1786af,_0x44a87f){return _0x1786af[_0x06b8('0xa')](_0x06b8('0xb'),attributes,{'tableName':_0x06b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d25=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','../../config/logger','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1d25,0x105));var _0x51d2=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x1d25[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x51d2('0x0'));var util=require('util');var logger=require(_0x51d2('0x1'))('api');var moment=require(_0x51d2('0x2'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x3'));var fs=require('fs');var path=require(_0x51d2('0x4'));var rimraf=require(_0x51d2('0x5'));var config=require(_0x51d2('0x6'));var attributes=require(_0x51d2('0x7'));module[_0x51d2('0x8')]=function(_0x6d0a40,_0x5adb30){return _0x6d0a40[_0x51d2('0x9')]('UserChatQueue',attributes,{'tableName':_0x51d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 6facdac..b57db69 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 _0xbc3e=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x850fbc,_0x1c1107){var _0xb309d6=function(_0x12e5b3){while(--_0x12e5b3){_0x850fbc['push'](_0x850fbc['shift']());}};_0xb309d6(++_0x1c1107);}(_0xbc3e,0xf2));var _0xebc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebc3('0x0'));var BPromise=require(_0xebc3('0x1'));var rs=require(_0xebc3('0x2'));var fs=require('fs');var Redis=require(_0xebc3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xebc3('0x4'));var logger=require(_0xebc3('0x5'))(_0xebc3('0x6'));var config=require('../../config/environment');var jayson=require(_0xebc3('0x7'));var client=jayson[_0xebc3('0x8')][_0xebc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfe2bd9,_0x3865df,_0x4a78d8){return new BPromise(function(_0x1b8575,_0x506acd){return client[_0xebc3('0xa')](_0xfe2bd9,_0x4a78d8)[_0xebc3('0xb')](function(_0x19cd04){logger[_0xebc3('0xc')](_0xebc3('0xd'),_0x3865df,'request\x20sent');logger['debug'](_0xebc3('0xe'),_0x3865df,_0xebc3('0xf'),JSON[_0xebc3('0x10')](_0x19cd04));if(_0x19cd04['error']){if(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x12')]===0x1f4){logger[_0xebc3('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x3865df,_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);return _0x506acd(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);}logger[_0xebc3('0x11')](_0xebc3('0xd'),_0x3865df,_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);return _0x1b8575(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);}else{logger[_0xebc3('0xc')](_0xebc3('0xd'),_0x3865df,'request\x20sent');_0x1b8575(_0x19cd04[_0xebc3('0x14')]['message']);}})[_0xebc3('0x15')](function(_0x53dcd1){logger['error'](_0xebc3('0xd'),_0x3865df,_0x53dcd1);_0x506acd(_0x53dcd1);});});} \ No newline at end of file +var _0x7cac=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x24980b,_0x54e001){var _0x526e47=function(_0x3d874f){while(--_0x3d874f){_0x24980b['push'](_0x24980b['shift']());}};_0x526e47(++_0x54e001);}(_0x7cac,0x15b));var _0xc7ca=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7cac[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xc7ca('0x0'));var util=require(_0xc7ca('0x1'));var moment=require(_0xc7ca('0x2'));var BPromise=require(_0xc7ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7ca('0x5'));var logger=require(_0xc7ca('0x6'))(_0xc7ca('0x7'));var config=require('../../config/environment');var jayson=require(_0xc7ca('0x8'));var client=jayson[_0xc7ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d384b,_0x4e2e30,_0x4e93f3){return new BPromise(function(_0xb3bd29,_0x5afed2){return client[_0xc7ca('0xa')](_0x5d384b,_0x4e93f3)[_0xc7ca('0xb')](function(_0x58cbfc){logger[_0xc7ca('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x4e2e30,'request\x20sent');logger[_0xc7ca('0xd')](_0xc7ca('0xe'),_0x4e2e30,_0xc7ca('0xf'),JSON[_0xc7ca('0x10')](_0x58cbfc));if(_0x58cbfc[_0xc7ca('0x11')]){if(_0x58cbfc[_0xc7ca('0x11')][_0xc7ca('0x12')]===0x1f4){logger['error'](_0xc7ca('0x13'),_0x4e2e30,_0x58cbfc['error'][_0xc7ca('0x14')]);return _0x5afed2(_0x58cbfc[_0xc7ca('0x11')]['message']);}logger['error'](_0xc7ca('0x13'),_0x4e2e30,_0x58cbfc['error']['message']);return _0xb3bd29(_0x58cbfc['error']['message']);}else{logger[_0xc7ca('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x4e2e30,'request\x20sent');_0xb3bd29(_0x58cbfc[_0xc7ca('0x15')][_0xc7ca('0x14')]);}})['catch'](function(_0x41137a){logger['error'](_0xc7ca('0x13'),_0x4e2e30,_0x41137a);_0x5afed2(_0x41137a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cbf6992..53e2982 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c1329,_0x44d752){var _0x282631=function(_0x92755d){while(--_0x92755d){_0x5c1329['push'](_0x5c1329['shift']());}};_0x282631(++_0x44d752);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3766c3,_0x49e53b){var _0xfaf90d=function(_0xf18c9c){while(--_0xf18c9c){_0x3766c3['push'](_0x3766c3['shift']());}};_0xfaf90d(++_0x49e53b);}(_0xedd9,0xfc));var _0x9edd=function(_0x1019a4,_0x46498a){_0x1019a4=_0x1019a4-0x0;var _0x384104=_0xedd9[_0x1019a4];return _0x384104;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6d09094..e733259 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 _0xb5d7=['sequelize','INTEGER','STRING'];(function(_0xe43796,_0x55e3d5){var _0x42fcb2=function(_0x954f54){while(--_0x954f54){_0xe43796['push'](_0xe43796['shift']());}};_0x42fcb2(++_0x55e3d5);}(_0xb5d7,0x18f));var _0x7b5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb5d7[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7b5d('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b5d('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7b5d('0x2')]}}; \ No newline at end of file +var _0xefa3=['sequelize','INTEGER'];(function(_0x2c22ad,_0x2a503a){var _0x307cde=function(_0x4c2626){while(--_0x4c2626){_0x2c22ad['push'](_0x2c22ad['shift']());}};_0x307cde(++_0x2a503a);}(_0xefa3,0x196));var _0x3efa=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xefa3[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x3efa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3efa('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3d84204..0229a38 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 _0xc125=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define'];(function(_0x4372b4,_0x57e41c){var _0x2b3e26=function(_0x189861){while(--_0x189861){_0x4372b4['push'](_0x4372b4['shift']());}};_0x2b3e26(++_0x57e41c);}(_0xc125,0xa6));var _0x5c12=function(_0x215ed0,_0x405474){_0x215ed0=_0x215ed0-0x0;var _0x4a7439=_0xc125[_0x215ed0];return _0x4a7439;};'use strict';var _=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var logger=require(_0x5c12('0x2'))(_0x5c12('0x3'));var moment=require('moment');var BPromise=require(_0x5c12('0x4'));var rp=require(_0x5c12('0x5'));var fs=require('fs');var path=require(_0x5c12('0x6'));var rimraf=require(_0x5c12('0x7'));var config=require('../../config/environment');var attributes=require(_0x5c12('0x8'));module['exports']=function(_0x1d2f84,_0x3d2ab6){return _0x1d2f84[_0x5c12('0x9')]('UserFaxQueue',attributes,{'tableName':_0x5c12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd26a=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0xfce47b,_0x5be4a9){var _0x329e4a=function(_0x5ca1fb){while(--_0x5ca1fb){_0xfce47b['push'](_0xfce47b['shift']());}};_0x329e4a(++_0x5be4a9);}(_0xd26a,0x1a4));var _0xad26=function(_0x3d3b0e,_0x22f58c){_0x3d3b0e=_0x3d3b0e-0x0;var _0x5e5531=_0xd26a[_0x3d3b0e];return _0x5e5531;};'use strict';var _=require(_0xad26('0x0'));var util=require(_0xad26('0x1'));var logger=require(_0xad26('0x2'))('api');var moment=require('moment');var BPromise=require(_0xad26('0x3'));var rp=require(_0xad26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad26('0x5'));var config=require(_0xad26('0x6'));var attributes=require(_0xad26('0x7'));module[_0xad26('0x8')]=function(_0x522e67,_0x5269d9){return _0x522e67[_0xad26('0x9')](_0xad26('0xa'),attributes,{'tableName':_0xad26('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 396e396..3960bb9 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 _0xd8c6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x1d6c05,_0x407325){var _0x3f534d=function(_0x4995db){while(--_0x4995db){_0x1d6c05['push'](_0x1d6c05['shift']());}};_0x3f534d(++_0x407325);}(_0xd8c6,0x1b6));var _0x6d8c=function(_0x3116b0,_0x4e368e){_0x3116b0=_0x3116b0-0x0;var _0x142b5d=_0xd8c6[_0x3116b0];return _0x142b5d;};'use strict';var _=require(_0x6d8c('0x0'));var util=require(_0x6d8c('0x1'));var moment=require(_0x6d8c('0x2'));var BPromise=require(_0x6d8c('0x3'));var rs=require(_0x6d8c('0x4'));var fs=require('fs');var Redis=require(_0x6d8c('0x5'));var db=require(_0x6d8c('0x6'))['db'];var utils=require(_0x6d8c('0x7'));var logger=require(_0x6d8c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6d8c('0x9'));var client=jayson[_0x6d8c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8863,_0x25a7b0,_0x2514a7){return new BPromise(function(_0x3067eb,_0xa1e4e8){return client['request'](_0x1f8863,_0x2514a7)[_0x6d8c('0xb')](function(_0x2cfb5b){logger['info'](_0x6d8c('0xc'),_0x25a7b0,'request\x20sent');logger[_0x6d8c('0xd')](_0x6d8c('0xe'),_0x25a7b0,_0x6d8c('0xf'),JSON[_0x6d8c('0x10')](_0x2cfb5b));if(_0x2cfb5b[_0x6d8c('0x11')]){if(_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x12')]===0x1f4){logger[_0x6d8c('0x11')](_0x6d8c('0xc'),_0x25a7b0,_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x13')]);return _0xa1e4e8(_0x2cfb5b['error']['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x25a7b0,_0x2cfb5b[_0x6d8c('0x11')]['message']);return _0x3067eb(_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x13')]);}else{logger[_0x6d8c('0x14')](_0x6d8c('0xc'),_0x25a7b0,_0x6d8c('0xf'));_0x3067eb(_0x2cfb5b[_0x6d8c('0x15')][_0x6d8c('0x13')]);}})[_0x6d8c('0x16')](function(_0x287e48){logger[_0x6d8c('0x11')](_0x6d8c('0xc'),_0x25a7b0,_0x287e48);_0xa1e4e8(_0x287e48);});});} \ No newline at end of file +var _0x9a61=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a091a,_0x146b3d){var _0x3bb363=function(_0x3272e5){while(--_0x3272e5){_0x2a091a['push'](_0x2a091a['shift']());}};_0x3bb363(++_0x146b3d);}(_0x9a61,0x1e7));var _0x19a6=function(_0x1c470b,_0x10d925){_0x1c470b=_0x1c470b-0x0;var _0x2032ab=_0x9a61[_0x1c470b];return _0x2032ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19a6('0x0'));var BPromise=require(_0x19a6('0x1'));var rs=require(_0x19a6('0x2'));var fs=require('fs');var Redis=require(_0x19a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x19a6('0x4'));var logger=require('../../config/logger')(_0x19a6('0x5'));var config=require(_0x19a6('0x6'));var jayson=require(_0x19a6('0x7'));var client=jayson[_0x19a6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d556e,_0x3a6e19,_0x2de20c){return new BPromise(function(_0x3789dd,_0xd5639a){return client[_0x19a6('0x9')](_0x1d556e,_0x2de20c)['then'](function(_0xd495df){logger[_0x19a6('0xa')](_0x19a6('0xb'),_0x3a6e19,_0x19a6('0xc'));logger[_0x19a6('0xd')](_0x19a6('0xe'),_0x3a6e19,_0x19a6('0xc'),JSON[_0x19a6('0xf')](_0xd495df));if(_0xd495df[_0x19a6('0x10')]){if(_0xd495df[_0x19a6('0x10')][_0x19a6('0x11')]===0x1f4){logger[_0x19a6('0x10')](_0x19a6('0xb'),_0x3a6e19,_0xd495df[_0x19a6('0x10')][_0x19a6('0x12')]);return _0xd5639a(_0xd495df['error'][_0x19a6('0x12')]);}logger[_0x19a6('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3a6e19,_0xd495df[_0x19a6('0x10')][_0x19a6('0x12')]);return _0x3789dd(_0xd495df[_0x19a6('0x10')]['message']);}else{logger[_0x19a6('0xa')](_0x19a6('0xb'),_0x3a6e19,_0x19a6('0xc'));_0x3789dd(_0xd495df[_0x19a6('0x13')][_0x19a6('0x12')]);}})[_0x19a6('0x14')](function(_0x2898fc){logger[_0x19a6('0x10')](_0x19a6('0xb'),_0x3a6e19,_0x2898fc);_0xd5639a(_0x2898fc);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e58936f..765f2b9 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb41e9f,_0x531994){var _0xc0f52c=function(_0x5c0c62){while(--_0x5c0c62){_0xb41e9f['push'](_0xb41e9f['shift']());}};_0xc0f52c(++_0x531994);}(_0xe706,0xa3));var _0x6e70=function(_0x54e335,_0x6b782d){_0x54e335=_0x54e335-0x0;var _0x5be44a=_0xe706[_0x54e335];return _0x5be44a;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x189ea9,_0x2bfa00){var _0x22de2e=function(_0x16a89f){while(--_0x16a89f){_0x189ea9['push'](_0x189ea9['shift']());}};_0x22de2e(++_0x2bfa00);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2504557..83d9e3a 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 _0x55a8=['INTEGER','sequelize','exports'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x55a8,0x148));var _0x855a=function(_0x4864b8,_0x2c542a){_0x4864b8=_0x4864b8-0x0;var _0xff9517=_0x55a8[_0x4864b8];return _0xff9517;};'use strict';var Sequelize=require(_0x855a('0x0'));module[_0x855a('0x1')]={'penalty':{'type':Sequelize[_0x855a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x243f=['INTEGER'];(function(_0x5894d3,_0x18f5ee){var _0x397477=function(_0x4f50de){while(--_0x4f50de){_0x5894d3['push'](_0x5894d3['shift']());}};_0x397477(++_0x18f5ee);}(_0x243f,0x1eb));var _0xf243=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x243f[_0x332c1b];return _0x21b49b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xf243('0x0')],'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 66e7988..7b8227e 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 _0x6922=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6922,0x17f));var _0x2692=function(_0x34e149,_0x2a77c9){_0x34e149=_0x34e149-0x0;var _0x119a93=_0x6922[_0x34e149];return _0x119a93;};'use strict';var _=require(_0x2692('0x0'));var util=require(_0x2692('0x1'));var logger=require(_0x2692('0x2'))(_0x2692('0x3'));var moment=require(_0x2692('0x4'));var BPromise=require(_0x2692('0x5'));var rp=require(_0x2692('0x6'));var fs=require('fs');var path=require(_0x2692('0x7'));var rimraf=require(_0x2692('0x8'));var config=require(_0x2692('0x9'));var attributes=require(_0x2692('0xa'));module[_0x2692('0xb')]=function(_0x1103e0,_0x5ee060){return _0x1103e0[_0x2692('0xc')](_0x2692('0xd'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ef=['define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x1fd987,_0xc51cc6){var _0x2362a0=function(_0x34842f){while(--_0x34842f){_0x1fd987['push'](_0x1fd987['shift']());}};_0x2362a0(++_0xc51cc6);}(_0x15ef,0x72));var _0xf15e=function(_0x3f6b2d,_0x2511c9){_0x3f6b2d=_0x3f6b2d-0x0;var _0x352368=_0x15ef[_0x3f6b2d];return _0x352368;};'use strict';var _=require(_0xf15e('0x0'));var util=require(_0xf15e('0x1'));var logger=require(_0xf15e('0x2'))(_0xf15e('0x3'));var moment=require(_0xf15e('0x4'));var BPromise=require(_0xf15e('0x5'));var rp=require(_0xf15e('0x6'));var fs=require('fs');var path=require(_0xf15e('0x7'));var rimraf=require(_0xf15e('0x8'));var config=require(_0xf15e('0x9'));var attributes=require(_0xf15e('0xa'));module[_0xf15e('0xb')]=function(_0x1d5241,_0x581f2f){return _0x1d5241[_0xf15e('0xc')]('UserMailQueue',attributes,{'tableName':_0xf15e('0xd'),'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 bc133d8..8a7844f 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 _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(_0x469fdd,_0x437f23){var _0x3c68f4=function(_0x580d08){while(--_0x580d08){_0x469fdd['push'](_0x469fdd['shift']());}};_0x3c68f4(++_0x437f23);}(_0x55ca,0x126));var _0xa55c=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0x55ca[_0x1b4bef];return _0xf377eb;};'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 +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(_0x4a1b9d,_0x2dfed0){var _0x37edf7=function(_0x1741e1){while(--_0x1741e1){_0x4a1b9d['push'](_0x4a1b9d['shift']());}};_0x37edf7(++_0x2dfed0);}(_0x55ca,0x126));var _0xa55c=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x55ca[_0x12ca7a];return _0x2249df;};'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 2194941..e426ff0 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 _0x7b7a=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x39183f,_0x92ad86){var _0x2c5db7=function(_0x4fd711){while(--_0x4fd711){_0x39183f['push'](_0x39183f['shift']());}};_0x2c5db7(++_0x92ad86);}(_0x7b7a,0x8e));var _0xa7b7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7b7a[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xa7b7('0x0'));var util=require(_0xa7b7('0x1'));var path=require(_0xa7b7('0x2'));var timeout=require(_0xa7b7('0x3'));var express=require(_0xa7b7('0x4'));var router=express['Router']();var fs_extra=require(_0xa7b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7b7('0x6'));var config=require(_0xa7b7('0x7'));var controller=require(_0xa7b7('0x8'));router['post']('/',auth[_0xa7b7('0x9')](),controller[_0xa7b7('0xa')]);module[_0xa7b7('0xb')]=router; \ No newline at end of file +var _0xf537=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports','multer'];(function(_0x3f8b5e,_0x492dac){var _0x2438a5=function(_0x553473){while(--_0x553473){_0x3f8b5e['push'](_0x3f8b5e['shift']());}};_0x2438a5(++_0x492dac);}(_0xf537,0xb3));var _0x7f53=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf537[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7f53('0x0'));var util=require('util');var path=require(_0x7f53('0x1'));var timeout=require(_0x7f53('0x2'));var express=require(_0x7f53('0x3'));var router=express[_0x7f53('0x4')]();var fs_extra=require(_0x7f53('0x5'));var auth=require(_0x7f53('0x6'));var interaction=require(_0x7f53('0x7'));var config=require(_0x7f53('0x8'));var controller=require('./userNotification.controller');router[_0x7f53('0x9')]('/',auth[_0x7f53('0xa')](),controller['sendUserNotification']);module[_0x7f53('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0d84649..93a8ecb 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 _0xcca3=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcca3,0x70));var _0x3cca=function(_0x19aee6,_0xcb2918){_0x19aee6=_0x19aee6-0x0;var _0x511975=_0xcca3[_0x19aee6];return _0x511975;};'use strict';var Sequelize=require(_0x3cca('0x0'));module[_0x3cca('0x1')]={'body':{'type':Sequelize[_0x3cca('0x2')]},'senderName':{'type':Sequelize[_0x3cca('0x3')]},'recipientsId':{'type':Sequelize[_0x3cca('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3cca('0x3')]},'beep':{'type':Sequelize[_0x3cca('0x4')]}}; \ No newline at end of file +var _0x9f8d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x27095e,_0x108608){var _0x186df1=function(_0x21fa99){while(--_0x21fa99){_0x27095e['push'](_0x27095e['shift']());}};_0x186df1(++_0x108608);}(_0x9f8d,0x136));var _0xd9f8=function(_0x6f977d,_0x5cf46f){_0x6f977d=_0x6f977d-0x0;var _0x10fe5e=_0x9f8d[_0x6f977d];return _0x10fe5e;};'use strict';var Sequelize=require(_0xd9f8('0x0'));module[_0xd9f8('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xd9f8('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xd9f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 258347c..76e2879 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 _0x10e6=['json','apply','reject','save','update','then','destroy','error','name','send','sendUserNotification','hasOwnProperty','text','Sequelize','body','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','html','render','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','catch','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range'];(function(_0x5b3269,_0x4182b2){var _0x288b03=function(_0x158144){while(--_0x158144){_0x5b3269['push'](_0x5b3269['shift']());}};_0x288b03(++_0x4182b2);}(_0x10e6,0x16f));var _0x610e=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x10e6[_0xa9a245];return _0x2d0eaa;};'use strict';var emlformat=require(_0x610e('0x0'));var rimraf=require(_0x610e('0x1'));var zipdir=require(_0x610e('0x2'));var jsonpatch=require(_0x610e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x610e('0x4'));var Mustache=require('mustache');var util=require(_0x610e('0x5'));var path=require(_0x610e('0x6'));var sox=require('sox');var csv=require(_0x610e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x610e('0x8'));var _=require('lodash');var squel=require(_0x610e('0x9'));var crypto=require(_0x610e('0xa'));var jsforce=require(_0x610e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x610e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x610e('0xd'));var qs=require(_0x610e('0xe'));var as=require(_0x610e('0xf'));var hardwareService=require(_0x610e('0x10'));var logger=require(_0x610e('0x11'))(_0x610e('0x12'));var utils=require(_0x610e('0x13'));var config=require(_0x610e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x610e('0x15'))['db'];config['redis']=_[_0x610e('0x16')](config[_0x610e('0x17')],{'host':_0x610e('0x18'),'port':0x18eb});var socket=require(_0x610e('0x19'))(new Redis(config[_0x610e('0x17')]));require(_0x610e('0x1a'))[_0x610e('0x1b')](socket);function respondWithStatusCode(_0xbb0283,_0x499757){_0x499757=_0x499757||0xcc;return function(_0x5ebedf){if(_0x5ebedf){return _0xbb0283[_0x610e('0x1c')](_0x499757);}return _0xbb0283[_0x610e('0x1d')](_0x499757)[_0x610e('0x1e')]();};}function respondWithResult(_0x42ca88,_0x4df0f2){_0x4df0f2=_0x4df0f2||0xc8;return function(_0x3347c0){if(_0x3347c0){return _0x42ca88[_0x610e('0x1d')](_0x4df0f2)['json'](_0x3347c0);}};}function respondWithFilteredResult(_0x1aa8da,_0x441678){return function(_0x5eab8c){if(_0x5eab8c){var _0x178c64=typeof _0x441678[_0x610e('0x1f')]==='undefined'&&typeof _0x441678[_0x610e('0x20')]===_0x610e('0x21');var _0x15fee1=_0x5eab8c[_0x610e('0x22')];var _0x31902d=_0x178c64?0x0:_0x441678[_0x610e('0x1f')];var _0x23720c=_0x178c64?_0x5eab8c[_0x610e('0x22')]:_0x441678[_0x610e('0x1f')]+_0x441678['limit'];var _0x17512a;if(_0x23720c>=_0x15fee1){_0x23720c=_0x15fee1;_0x17512a=0xc8;}else{_0x17512a=0xce;}_0x1aa8da[_0x610e('0x1d')](_0x17512a);return _0x1aa8da[_0x610e('0x23')](_0x610e('0x24'),_0x31902d+'-'+_0x23720c+'/'+_0x15fee1)[_0x610e('0x25')](_0x5eab8c);}return null;};}function patchUpdates(_0x58e5de){return function(_0x475f0e){try{jsonpatch[_0x610e('0x26')](_0x475f0e,_0x58e5de,!![]);}catch(_0x2f0635){return BPromise[_0x610e('0x27')](_0x2f0635);}return _0x475f0e[_0x610e('0x28')]();};}function saveUpdates(_0x577c20,_0x33620e){return function(_0x3c8818){if(_0x3c8818){return _0x3c8818[_0x610e('0x29')](_0x577c20)[_0x610e('0x2a')](function(_0x45ec0f){return _0x45ec0f;});}return null;};}function removeEntity(_0x251d5a,_0x572620){return function(_0x3bfbbc){if(_0x3bfbbc){return _0x3bfbbc[_0x610e('0x2b')]()[_0x610e('0x2a')](function(){_0x251d5a[_0x610e('0x1d')](0xcc)[_0x610e('0x1e')]();});}};}function handleEntityNotFound(_0x24816a,_0x457327){return function(_0x45ead8){if(!_0x45ead8){_0x24816a['sendStatus'](0x194);}return _0x45ead8;};}function handleError(_0x184fc3,_0x358941){_0x358941=_0x358941||0x1f4;return function(_0x4174dd){logger[_0x610e('0x2c')](_0x4174dd['stack']);if(_0x4174dd['name']){delete _0x4174dd[_0x610e('0x2d')];}_0x184fc3[_0x610e('0x1d')](_0x358941)[_0x610e('0x2e')](_0x4174dd);};}exports[_0x610e('0x2f')]=function(_0x3ca361,_0x54156b,_0x567e00){if(!_0x3ca361['body'][_0x610e('0x30')](_0x610e('0x31'))&&!_0x3ca361['body']['hasOwnProperty']('TemplateId')){throw new db[(_0x610e('0x32'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3ca361[_0x610e('0x33')][_0x610e('0x30')]('TemplateId')&&!_0x3ca361[_0x610e('0x33')]['hasOwnProperty'](_0x610e('0x34'))){throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x36'));}if(!_0x3ca361['body'][_0x610e('0x30')](_0x610e('0x37'))){throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x38'));}else{try{var _0x1f2e63=JSON[_0x610e('0x39')](_0x3ca361[_0x610e('0x33')][_0x610e('0x37')]);}catch(_0x36da33){logger[_0x610e('0x2c')](_0x36da33);throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x3a'));}var _0x19fae0=[_0x610e('0x3b'),_0x610e('0x3c'),_0x610e('0x3d'),_0x610e('0x3e'),_0x610e('0x3f'),_0x610e('0x40'),_0x610e('0x41'),'team','user'];if(_['some'](_0x1f2e63,function(_0x32bc48){return!_['includes'](_0x19fae0,_0x32bc48[_0x610e('0x42')][_0x610e('0x43')]());})){throw new db[(_0x610e('0x32'))]['ValidationError'](_0x610e('0x44'));}}}var _0x294dcd={};_0x294dcd[_0x610e('0x45')]=_0x3ca361[_0x610e('0x33')][_0x610e('0x30')](_0x610e('0x45'))?_0x3ca361[_0x610e('0x33')][_0x610e('0x45')]:_0x3ca361[_0x610e('0x46')][_0x610e('0x47')];_0x294dcd[_0x610e('0x48')]=_[_0x610e('0x49')](_0x3ca361[_0x610e('0x33')][_0x610e('0x48')])?null:_0x3ca361['body']['recipientsDescription'];_0x294dcd[_0x610e('0x4a')]=_0x3ca361['body'][_0x610e('0x4a')]||![];_0x294dcd['SenderId']=_0x3ca361[_0x610e('0x46')]['id'];return getContent(_0x3ca361[_0x610e('0x33')])[_0x610e('0x2a')](function(_0x235e91){_0x294dcd[_0x610e('0x33')]=_0x235e91;return getRecipients(_0x1f2e63);})[_0x610e('0x2a')](function(_0x5386f3){_0x294dcd[_0x610e('0x4b')]=_[_0x610e('0x4c')](_0x5386f3)[_0x610e('0x4d')](',');return db[_0x610e('0x4e')][_0x610e('0x4f')](function(_0x44ea4a){return db['UserNotification'][_0x610e('0x50')](_0x294dcd,{'raw':!![],'transaction':_0x44ea4a})['then'](function(_0x4bbe6b){var _0x49df86={'sender':_0x294dcd[_0x610e('0x45')],'description':_0x294dcd[_0x610e('0x48')],'content':_0x294dcd['body'],'beep':_0x294dcd[_0x610e('0x4a')]};_0x5386f3[_0x610e('0x51')](function(_0x5b8843){_0x49df86[_0x610e('0x52')]=_0x5b8843;socket[_0x610e('0x53')](_0x610e('0x54'),_0x49df86);});return _0x4bbe6b;});});})[_0x610e('0x2a')](respondWithResult(_0x54156b,0xc9))['catch'](handleError(_0x54156b,null));};function getContent(_0x3d1927){return new BPromise(function(_0x140ad4,_0x357b94){if(_0x3d1927[_0x610e('0x31')]){_0x140ad4(_0x3d1927[_0x610e('0x31')]);return;}return db['Template']['findOne']({'attributes':[_0x610e('0x55')],'where':{'id':_0x3d1927['TemplateId']},'raw':!![]})[_0x610e('0x2a')](function(_0x3281c2){if(!_0x3281c2)throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xdfedfb=Mustache[_0x610e('0x56')](_0x3281c2['html'],_0x3d1927[_0x610e('0x34')]);_0x140ad4(_0xdfedfb);})['catch'](function(_0x54130){_0x357b94(_0x54130);});});}function getRecipients(_0x3a4ac6){return new BPromise(function(_0x55548c,_0x174f2e){var _0xb1d0e0=[];var _0x336d19=[];_0x3a4ac6[_0x610e('0x51')](function(_0x452dc6){var _0x18cbd9=_[_0x610e('0x57')](_0x452dc6['model'][_0x610e('0x43')]());if(_0x18cbd9===_0x610e('0x58')){_0xb1d0e0=_[_0x610e('0x59')](_0xb1d0e0,_0x452dc6[_0x610e('0x5a')]);}else{if(_['includes'](_0x18cbd9,_0x610e('0x5b')))_0x18cbd9=_0x18cbd9[_0x610e('0x5c')](_0x610e('0x5b'),_0x610e('0x5d'));_0x452dc6[_0x610e('0x5a')]['forEach'](function(_0x5d1bf2){_0x336d19[_0x610e('0x5e')](getAgents(_0x18cbd9,_0x5d1bf2));});}});return BPromise[_0x610e('0x5f')](_0x336d19)[_0x610e('0x2a')](function(_0x2d2cdb){_0xb1d0e0=_[_0x610e('0x59')](_0xb1d0e0,_[_0x610e('0x60')](_0x2d2cdb));_0x55548c(_0xb1d0e0);})[_0x610e('0x61')](function(_0x1d53ae){_0x174f2e(_0x1d53ae);});});}function getAgents(_0x1c31b8,_0x45639a){return new BPromise(function(_0x4d9f9d,_0x16358c){return db[_0x1c31b8][_0x610e('0x62')]({'where':{'id':_0x45639a}})[_0x610e('0x2a')](function(_0x125bbb){return _0x125bbb[_0x610e('0x63')]({'attributes':['id'],'raw':!![]})[_0x610e('0x2a')](function(_0x199ddf){var _0xf31060=_[_0x610e('0x64')](_0x199ddf,'id');_0x4d9f9d(_0xf31060);});})[_0x610e('0x61')](function(_0x5cd310){_0x16358c(_0x5cd310);});});} \ No newline at end of file +var _0x13c7=['push','all','flatten','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userNotification.socket','register','end','status','json','offset','undefined','limit','count','apply','reject','update','then','sendStatus','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','user','recipientsId','sortBy','transaction','create','forEach','recipient','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','startCase','model','User','union','ids','queue','Queue'];(function(_0x245c79,_0x50406b){var _0x3aab1d=function(_0xeca544){while(--_0xeca544){_0x245c79['push'](_0x245c79['shift']());}};_0x3aab1d(++_0x50406b);}(_0x13c7,0x1de));var _0x713c=function(_0x16fb08,_0x4fed21){_0x16fb08=_0x16fb08-0x0;var _0x40ce88=_0x13c7[_0x16fb08];return _0x40ce88;};'use strict';var emlformat=require(_0x713c('0x0'));var rimraf=require(_0x713c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x713c('0x2'));var rp=require(_0x713c('0x3'));var moment=require(_0x713c('0x4'));var BPromise=require(_0x713c('0x5'));var Mustache=require(_0x713c('0x6'));var util=require(_0x713c('0x7'));var path=require('path');var sox=require(_0x713c('0x8'));var csv=require(_0x713c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x713c('0xa'));var _=require(_0x713c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x713c('0xc'));var deskjs=require(_0x713c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x713c('0xe'));var Redis=require('ioredis');var authService=require(_0x713c('0xf'));var qs=require(_0x713c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x713c('0x11'));var logger=require(_0x713c('0x12'))('api');var utils=require(_0x713c('0x13'));var config=require(_0x713c('0x14'));var licenseUtil=require(_0x713c('0x15'));var db=require(_0x713c('0x16'))['db'];config[_0x713c('0x17')]=_[_0x713c('0x18')](config[_0x713c('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x713c('0x17')]));require(_0x713c('0x19'))[_0x713c('0x1a')](socket);function respondWithStatusCode(_0x546617,_0x9b1d3c){_0x9b1d3c=_0x9b1d3c||0xcc;return function(_0x181440){if(_0x181440){return _0x546617['sendStatus'](_0x9b1d3c);}return _0x546617['status'](_0x9b1d3c)[_0x713c('0x1b')]();};}function respondWithResult(_0x3e379a,_0x5c6ef8){_0x5c6ef8=_0x5c6ef8||0xc8;return function(_0xd7d5ea){if(_0xd7d5ea){return _0x3e379a[_0x713c('0x1c')](_0x5c6ef8)[_0x713c('0x1d')](_0xd7d5ea);}};}function respondWithFilteredResult(_0x5e988b,_0x1b0b5c){return function(_0x4a3a32){if(_0x4a3a32){var _0x3f9793=typeof _0x1b0b5c[_0x713c('0x1e')]===_0x713c('0x1f')&&typeof _0x1b0b5c[_0x713c('0x20')]===_0x713c('0x1f');var _0x172c35=_0x4a3a32[_0x713c('0x21')];var _0xd292b=_0x3f9793?0x0:_0x1b0b5c['offset'];var _0x2b5908=_0x3f9793?_0x4a3a32[_0x713c('0x21')]:_0x1b0b5c['offset']+_0x1b0b5c['limit'];var _0x2f58a9;if(_0x2b5908>=_0x172c35){_0x2b5908=_0x172c35;_0x2f58a9=0xc8;}else{_0x2f58a9=0xce;}_0x5e988b[_0x713c('0x1c')](_0x2f58a9);return _0x5e988b['set']('Content-Range',_0xd292b+'-'+_0x2b5908+'/'+_0x172c35)[_0x713c('0x1d')](_0x4a3a32);}return null;};}function patchUpdates(_0x2e3b02){return function(_0x21636f){try{jsonpatch[_0x713c('0x22')](_0x21636f,_0x2e3b02,!![]);}catch(_0x1ced43){return BPromise[_0x713c('0x23')](_0x1ced43);}return _0x21636f['save']();};}function saveUpdates(_0x2a4111,_0x2abf77){return function(_0x571b13){if(_0x571b13){return _0x571b13[_0x713c('0x24')](_0x2a4111)['then'](function(_0x339c45){return _0x339c45;});}return null;};}function removeEntity(_0x34fa4b,_0x36701c){return function(_0x47a6c2){if(_0x47a6c2){return _0x47a6c2['destroy']()[_0x713c('0x25')](function(){_0x34fa4b[_0x713c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377383,_0x19306d){return function(_0x1148bf){if(!_0x1148bf){_0x377383[_0x713c('0x26')](0x194);}return _0x1148bf;};}function handleError(_0x257b1a,_0x31fd93){_0x31fd93=_0x31fd93||0x1f4;return function(_0x6f86be){logger[_0x713c('0x27')](_0x6f86be['stack']);if(_0x6f86be[_0x713c('0x28')]){delete _0x6f86be['name'];}_0x257b1a['status'](_0x31fd93)[_0x713c('0x29')](_0x6f86be);};}exports[_0x713c('0x2a')]=function(_0x21f52b,_0x1361fa,_0x112a9e){if(!_0x21f52b[_0x713c('0x2b')][_0x713c('0x2c')](_0x713c('0x2d'))&&!_0x21f52b['body'][_0x713c('0x2c')](_0x713c('0x2e'))){throw new db[(_0x713c('0x2f'))][(_0x713c('0x30'))](_0x713c('0x31'));}else{if(_0x21f52b['body']['hasOwnProperty']('TemplateId')&&!_0x21f52b['body'][_0x713c('0x2c')]('view')){throw new db[(_0x713c('0x2f'))][(_0x713c('0x30'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x21f52b[_0x713c('0x2b')][_0x713c('0x2c')](_0x713c('0x32'))){throw new db['Sequelize']['ValidationError'](_0x713c('0x33'));}else{try{var _0x1ef7d9=JSON[_0x713c('0x34')](_0x21f52b[_0x713c('0x2b')][_0x713c('0x32')]);}catch(_0x410731){logger['error'](_0x410731);throw new db[(_0x713c('0x2f'))][(_0x713c('0x30'))](_0x713c('0x35'));}var _0x2c5bb6=[_0x713c('0x36'),_0x713c('0x37'),_0x713c('0x38'),_0x713c('0x39'),_0x713c('0x3a'),'voicequeue',_0x713c('0x3b'),'team','user'];if(_[_0x713c('0x3c')](_0x1ef7d9,function(_0x5b7efa){return!_[_0x713c('0x3d')](_0x2c5bb6,_0x5b7efa['model'][_0x713c('0x3e')]());})){throw new db[(_0x713c('0x2f'))][(_0x713c('0x30'))](_0x713c('0x3f'));}}}var _0x2ee0ee={};_0x2ee0ee[_0x713c('0x40')]=_0x21f52b[_0x713c('0x2b')][_0x713c('0x2c')](_0x713c('0x40'))?_0x21f52b[_0x713c('0x2b')][_0x713c('0x40')]:_0x21f52b['user'][_0x713c('0x41')];_0x2ee0ee[_0x713c('0x42')]=_[_0x713c('0x43')](_0x21f52b[_0x713c('0x2b')][_0x713c('0x42')])?null:_0x21f52b[_0x713c('0x2b')][_0x713c('0x42')];_0x2ee0ee[_0x713c('0x44')]=_0x21f52b[_0x713c('0x2b')][_0x713c('0x44')]||![];_0x2ee0ee[_0x713c('0x45')]=_0x21f52b[_0x713c('0x46')]['id'];return getContent(_0x21f52b[_0x713c('0x2b')])['then'](function(_0x5bcf69){_0x2ee0ee[_0x713c('0x2b')]=_0x5bcf69;return getRecipients(_0x1ef7d9);})[_0x713c('0x25')](function(_0x221df9){_0x2ee0ee[_0x713c('0x47')]=_[_0x713c('0x48')](_0x221df9)['join'](',');return db['sequelize'][_0x713c('0x49')](function(_0x3691f8){return db['UserNotification'][_0x713c('0x4a')](_0x2ee0ee,{'raw':!![],'transaction':_0x3691f8})[_0x713c('0x25')](function(_0x55857a){var _0x464aa9={'sender':_0x2ee0ee[_0x713c('0x40')],'description':_0x2ee0ee['recipientsDescription'],'content':_0x2ee0ee[_0x713c('0x2b')],'beep':_0x2ee0ee[_0x713c('0x44')]};_0x221df9[_0x713c('0x4b')](function(_0x1b31e8){_0x464aa9[_0x713c('0x4c')]=_0x1b31e8;socket['emit'](_0x713c('0x4d'),_0x464aa9);});return _0x55857a;});});})[_0x713c('0x25')](respondWithResult(_0x1361fa,0xc9))['catch'](handleError(_0x1361fa,null));};function getContent(_0x23b8bc){return new BPromise(function(_0x31b811,_0x156e6a){if(_0x23b8bc[_0x713c('0x2d')]){_0x31b811(_0x23b8bc[_0x713c('0x2d')]);return;}return db[_0x713c('0x4e')][_0x713c('0x4f')]({'attributes':[_0x713c('0x50')],'where':{'id':_0x23b8bc['TemplateId']},'raw':!![]})[_0x713c('0x25')](function(_0x2ac0c8){if(!_0x2ac0c8)throw new db[(_0x713c('0x2f'))][(_0x713c('0x30'))](_0x713c('0x51'));var _0x385c8f=Mustache[_0x713c('0x52')](_0x2ac0c8['html'],_0x23b8bc[_0x713c('0x53')]);_0x31b811(_0x385c8f);})[_0x713c('0x54')](function(_0x110d8e){_0x156e6a(_0x110d8e);});});}function getRecipients(_0xc9f84b){return new BPromise(function(_0x48d9c8,_0xe3443a){var _0x358f1e=[];var _0x5dcba1=[];_0xc9f84b[_0x713c('0x4b')](function(_0x47321b){var _0x347f71=_[_0x713c('0x55')](_0x47321b[_0x713c('0x56')][_0x713c('0x3e')]());if(_0x347f71===_0x713c('0x57')){_0x358f1e=_[_0x713c('0x58')](_0x358f1e,_0x47321b[_0x713c('0x59')]);}else{if(_[_0x713c('0x3d')](_0x347f71,_0x713c('0x5a')))_0x347f71=_0x347f71['replace'](_0x713c('0x5a'),_0x713c('0x5b'));_0x47321b[_0x713c('0x59')][_0x713c('0x4b')](function(_0x3c3de5){_0x5dcba1[_0x713c('0x5c')](getAgents(_0x347f71,_0x3c3de5));});}});return BPromise[_0x713c('0x5d')](_0x5dcba1)[_0x713c('0x25')](function(_0x216021){_0x358f1e=_[_0x713c('0x58')](_0x358f1e,_[_0x713c('0x5e')](_0x216021));_0x48d9c8(_0x358f1e);})[_0x713c('0x54')](function(_0x422077){_0xe3443a(_0x422077);});});}function getAgents(_0x5bc537,_0x5434bc){return new BPromise(function(_0x4fe052,_0x5114cd){return db[_0x5bc537][_0x713c('0x4f')]({'where':{'id':_0x5434bc}})[_0x713c('0x25')](function(_0x5e031e){return _0x5e031e['getAgents']({'attributes':['id'],'raw':!![]})[_0x713c('0x25')](function(_0x2221a0){var _0x5af4db=_['map'](_0x2221a0,'id');_0x4fe052(_0x5af4db);});})['catch'](function(_0x24353d){_0x5114cd(_0x24353d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e134d1b..a021f35 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 _0xab6a=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0xb9eba0,_0x2e153e){var _0x292f31=function(_0x1748b2){while(--_0x1748b2){_0xb9eba0['push'](_0xb9eba0['shift']());}};_0x292f31(++_0x2e153e);}(_0xab6a,0x17d));var _0xaab6=function(_0x5daa41,_0x5c05bd){_0x5daa41=_0x5daa41-0x0;var _0x1fb9be=_0xab6a[_0x5daa41];return _0x1fb9be;};'use strict';var EventEmitter=require(_0xaab6('0x0'));var UserNotification=require(_0xaab6('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaab6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaab6('0x3'),'afterDestroy':_0xaab6('0x4')};function emitEvent(_0xf1f583){return function(_0x5cca05,_0x19bf6c,_0x207b9e){UserNotificationEvents['emit'](_0xf1f583+':'+_0x5cca05['id'],_0x5cca05);UserNotificationEvents[_0xaab6('0x5')](_0xf1f583,_0x5cca05);_0x207b9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xaab6('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xe0f1=['exports','events','../../mysqldb','UserNotification','update','remove','emit','hasOwnProperty','hook'];(function(_0x1753b6,_0x2fafd4){var _0x43ecd1=function(_0x5c5f6a){while(--_0x5c5f6a){_0x1753b6['push'](_0x1753b6['shift']());}};_0x43ecd1(++_0x2fafd4);}(_0xe0f1,0x172));var _0x1e0f=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xe0f1[_0x2080a3];return _0x8d7d17;};'use strict';var EventEmitter=require(_0x1e0f('0x0'));var UserNotification=require(_0x1e0f('0x1'))['db'][_0x1e0f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e0f('0x3'),'afterDestroy':_0x1e0f('0x4')};function emitEvent(_0x2afb6d){return function(_0x3fc631,_0xb4e998,_0x7c2bcc){UserNotificationEvents[_0x1e0f('0x5')](_0x2afb6d+':'+_0x3fc631['id'],_0x3fc631);UserNotificationEvents[_0x1e0f('0x5')](_0x2afb6d,_0x3fc631);_0x7c2bcc(null);};}for(var e in events){if(events[_0x1e0f('0x6')](e)){var event=events[e];UserNotification[_0x1e0f('0x7')](e,emitEvent(event));}}module[_0x1e0f('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7097b42..bbd3f19 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 _0xf105=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x303053,_0x1ba7e1){var _0x28a09f=function(_0x4d5e10){while(--_0x4d5e10){_0x303053['push'](_0x303053['shift']());}};_0x28a09f(++_0x1ba7e1);}(_0xf105,0x134));var _0x5f10=function(_0x3fa2a9,_0x4582cf){_0x3fa2a9=_0x3fa2a9-0x0;var _0x43dabf=_0xf105[_0x3fa2a9];return _0x43dabf;};'use strict';var _=require(_0x5f10('0x0'));var util=require('util');var logger=require(_0x5f10('0x1'))(_0x5f10('0x2'));var moment=require(_0x5f10('0x3'));var BPromise=require(_0x5f10('0x4'));var rp=require(_0x5f10('0x5'));var fs=require('fs');var path=require(_0x5f10('0x6'));var rimraf=require(_0x5f10('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f10('0x8'));module[_0x5f10('0x9')]=function(_0x1b646b,_0x6b632){return _0x1b646b[_0x5f10('0xa')](_0x5f10('0xb'),attributes,{'tableName':_0x5f10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f10('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xeb7b=['rimraf','../../config/environment','./userNotification.attributes','exports','define','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x50aa13,_0x259928){var _0x342271=function(_0x2e7a2c){while(--_0x2e7a2c){_0x50aa13['push'](_0x50aa13['shift']());}};_0x342271(++_0x259928);}(_0xeb7b,0x19e));var _0xbeb7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeb7b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbeb7('0x0'));var util=require('util');var logger=require(_0xbeb7('0x1'))(_0xbeb7('0x2'));var moment=require(_0xbeb7('0x3'));var BPromise=require(_0xbeb7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb7('0x5'));var rimraf=require(_0xbeb7('0x6'));var config=require(_0xbeb7('0x7'));var attributes=require(_0xbeb7('0x8'));module[_0xbeb7('0x9')]=function(_0x57cc78,_0x252d7e){return _0x57cc78[_0xbeb7('0xa')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbeb7('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6813936..6254abc 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 _0x4a96=['../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a4682,_0x24368b){var _0x94925d=function(_0x1cb7af){while(--_0x1cb7af){_0x2a4682['push'](_0x2a4682['shift']());}};_0x94925d(++_0x24368b);}(_0x4a96,0x1b8));var _0x64a9=function(_0xe44580,_0x389b2c){_0xe44580=_0xe44580-0x0;var _0x24880d=_0x4a96[_0xe44580];return _0x24880d;};'use strict';var _=require(_0x64a9('0x0'));var util=require(_0x64a9('0x1'));var moment=require(_0x64a9('0x2'));var BPromise=require(_0x64a9('0x3'));var rs=require(_0x64a9('0x4'));var fs=require('fs');var Redis=require(_0x64a9('0x5'));var db=require(_0x64a9('0x6'))['db'];var utils=require(_0x64a9('0x7'));var logger=require(_0x64a9('0x8'))(_0x64a9('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64a9('0xa')][_0x64a9('0xb')]({'port':0x232a});config['redis']=_[_0x64a9('0xc')](config[_0x64a9('0xd')],{'host':_0x64a9('0xe'),'port':0x18eb});var socket=require(_0x64a9('0xf'))(new Redis(config['redis']));require(_0x64a9('0x10'))[_0x64a9('0x11')](socket);function respondWithRpcPromise(_0x244160,_0x5b6a47,_0x4c5aa9){return new BPromise(function(_0x58bf2b,_0x56cfdf){return client[_0x64a9('0x12')](_0x244160,_0x4c5aa9)['then'](function(_0x48a820){logger['info'](_0x64a9('0x13'),_0x5b6a47,'request\x20sent');logger[_0x64a9('0x14')](_0x64a9('0x15'),_0x5b6a47,_0x64a9('0x16'),JSON[_0x64a9('0x17')](_0x48a820));if(_0x48a820[_0x64a9('0x18')]){if(_0x48a820[_0x64a9('0x18')]['code']===0x1f4){logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x48a820['error'][_0x64a9('0x19')]);return _0x56cfdf(_0x48a820[_0x64a9('0x18')]['message']);}logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x48a820['error'][_0x64a9('0x19')]);return _0x58bf2b(_0x48a820[_0x64a9('0x18')][_0x64a9('0x19')]);}else{logger[_0x64a9('0x1a')](_0x64a9('0x13'),_0x5b6a47,_0x64a9('0x16'));_0x58bf2b(_0x48a820['result']['message']);}})[_0x64a9('0x1b')](function(_0x2816e3){logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x2816e3);_0x56cfdf(_0x2816e3);});});} \ No newline at end of file +var _0x6eae=['debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s'];(function(_0x1ab620,_0xba09b){var _0x5a9aa7=function(_0x4cce3d){while(--_0x4cce3d){_0x1ab620['push'](_0x1ab620['shift']());}};_0x5a9aa7(++_0xba09b);}(_0x6eae,0xcf));var _0xe6ea=function(_0x50a525,_0x3d019b){_0x50a525=_0x50a525-0x0;var _0xb988bb=_0x6eae[_0x50a525];return _0xb988bb;};'use strict';var _=require('lodash');var util=require(_0xe6ea('0x0'));var moment=require('moment');var BPromise=require(_0xe6ea('0x1'));var rs=require(_0xe6ea('0x2'));var fs=require('fs');var Redis=require(_0xe6ea('0x3'));var db=require(_0xe6ea('0x4'))['db'];var utils=require(_0xe6ea('0x5'));var logger=require(_0xe6ea('0x6'))(_0xe6ea('0x7'));var config=require(_0xe6ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe6ea('0x9')]['http']({'port':0x232a});config[_0xe6ea('0xa')]=_['defaults'](config[_0xe6ea('0xa')],{'host':_0xe6ea('0xb'),'port':0x18eb});var socket=require(_0xe6ea('0xc'))(new Redis(config[_0xe6ea('0xa')]));require(_0xe6ea('0xd'))[_0xe6ea('0xe')](socket);function respondWithRpcPromise(_0x549bcd,_0xa89c46,_0xf3ba07){return new BPromise(function(_0xae7d9e,_0x43afc9){return client[_0xe6ea('0xf')](_0x549bcd,_0xf3ba07)['then'](function(_0x3ca0e9){logger[_0xe6ea('0x10')](_0xe6ea('0x11'),_0xa89c46,'request\x20sent');logger[_0xe6ea('0x12')](_0xe6ea('0x13'),_0xa89c46,_0xe6ea('0x14'),JSON['stringify'](_0x3ca0e9));if(_0x3ca0e9[_0xe6ea('0x15')]){if(_0x3ca0e9[_0xe6ea('0x15')][_0xe6ea('0x16')]===0x1f4){logger['error'](_0xe6ea('0x11'),_0xa89c46,_0x3ca0e9[_0xe6ea('0x15')][_0xe6ea('0x17')]);return _0x43afc9(_0x3ca0e9[_0xe6ea('0x15')][_0xe6ea('0x17')]);}logger['error'](_0xe6ea('0x11'),_0xa89c46,_0x3ca0e9[_0xe6ea('0x15')][_0xe6ea('0x17')]);return _0xae7d9e(_0x3ca0e9[_0xe6ea('0x15')][_0xe6ea('0x17')]);}else{logger[_0xe6ea('0x10')]('UserNotification,\x20%s,\x20%s',_0xa89c46,_0xe6ea('0x14'));_0xae7d9e(_0x3ca0e9['result']['message']);}})[_0xe6ea('0x18')](function(_0x10903e){logger['error']('UserNotification,\x20%s,\x20%s',_0xa89c46,_0x10903e);_0x43afc9(_0x10903e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7e53aa3..125449c 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 _0x707f=['register','length','userNotification:','update','removeListener'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0x707f,0x80));var _0xf707=function(_0x530b7d,_0x597fa9){_0x530b7d=_0x530b7d-0x0;var _0x151e6a=_0x707f[_0x530b7d];return _0x151e6a;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0xf707('0x0')];function createListener(_0x3c12d7,_0x4e83e9){return function(_0x1d8151){_0x4e83e9['emit'](_0x3c12d7,_0x1d8151);};}function removeListener(_0x56b4e5,_0x5c6d0f){return function(){UserNotificationEvents[_0xf707('0x1')](_0x56b4e5,_0x5c6d0f);};}exports[_0xf707('0x2')]=function(_0x55e28d){for(var _0x540b6c=0x0,_0x5b1d35=events[_0xf707('0x3')];_0x540b6c<_0x5b1d35;_0x540b6c++){var _0x2a1b32=events[_0x540b6c];var _0x3de327=createListener(_0xf707('0x4')+_0x2a1b32,_0x55e28d);UserNotificationEvents['on'](_0x2a1b32,_0x3de327);}}; \ No newline at end of file +var _0xc704=['register','length','./userNotification.events','save','remove','update','emit'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0xc704,0x1c2));var _0x4c70=function(_0x3111b9,_0x3d5154){_0x3111b9=_0x3111b9-0x0;var _0x95c6fb=_0xc704[_0x3111b9];return _0x95c6fb;};'use strict';var UserNotificationEvents=require(_0x4c70('0x0'));var events=[_0x4c70('0x1'),_0x4c70('0x2'),_0x4c70('0x3')];function createListener(_0x2deab4,_0x3f4647){return function(_0x5e6405){_0x3f4647[_0x4c70('0x4')](_0x2deab4,_0x5e6405);};}function removeListener(_0x16f1fb,_0x4291e8){return function(){UserNotificationEvents['removeListener'](_0x16f1fb,_0x4291e8);};}exports[_0x4c70('0x5')]=function(_0x546bb3){for(var _0x1c5a93=0x0,_0x4f4a7a=events[_0x4c70('0x6')];_0x1c5a93<_0x4f4a7a;_0x1c5a93++){var _0x8ba65d=events[_0x1c5a93];var _0x329c61=createListener('userNotification:'+_0x8ba65d,_0x546bb3);UserNotificationEvents['on'](_0x8ba65d,_0x329c61);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c13fa2b..94bf56c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a9d97,_0x38912c){var _0x215a25=function(_0x53e624){while(--_0x53e624){_0x1a9d97['push'](_0x1a9d97['shift']());}};_0x215a25(++_0x38912c);}(_0xe706,0xa3));var _0x6e70=function(_0x25b068,_0xb6ac60){_0x25b068=_0x25b068-0x0;var _0xb9f40f=_0xe706[_0x25b068];return _0xb9f40f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x526aaf,_0x3284ca){var _0x184067=function(_0x59af8d){while(--_0x59af8d){_0x526aaf['push'](_0x526aaf['shift']());}};_0x184067(++_0x3284ca);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c76c633..9006424 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 _0xaede=['exports','INTEGER','sequelize'];(function(_0x35348b,_0x48df3d){var _0x7f918=function(_0x42968d){while(--_0x42968d){_0x35348b['push'](_0x35348b['shift']());}};_0x7f918(++_0x48df3d);}(_0xaede,0x11c));var _0xeaed=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaede[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xeaed('0x0'));module[_0xeaed('0x1')]={'penalty':{'type':Sequelize[_0xeaed('0x2')],'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index e16c46f..8b880da 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 _0x99db=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','UserOpenchannelQueue'];(function(_0x2c87b2,_0x547e3f){var _0x59edb0=function(_0xa070fa){while(--_0xa070fa){_0x2c87b2['push'](_0x2c87b2['shift']());}};_0x59edb0(++_0x547e3f);}(_0x99db,0xa5));var _0xb99d=function(_0x13639d,_0x3c996b){_0x13639d=_0x13639d-0x0;var _0x52ef14=_0x99db[_0x13639d];return _0x52ef14;};'use strict';var _=require(_0xb99d('0x0'));var util=require(_0xb99d('0x1'));var logger=require(_0xb99d('0x2'))(_0xb99d('0x3'));var moment=require(_0xb99d('0x4'));var BPromise=require(_0xb99d('0x5'));var rp=require(_0xb99d('0x6'));var fs=require('fs');var path=require(_0xb99d('0x7'));var rimraf=require(_0xb99d('0x8'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x51a6e4,_0x151a46){return _0x51a6e4[_0xb99d('0x9')](_0xb99d('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7a2=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash','util','api','moment'];(function(_0x5b83d2,_0x310fd7){var _0x2ee9cd=function(_0x20fcd2){while(--_0x20fcd2){_0x5b83d2['push'](_0x5b83d2['shift']());}};_0x2ee9cd(++_0x310fd7);}(_0xf7a2,0x1e6));var _0x2f7a=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xf7a2[_0x4e8286];return _0x44a440;};'use strict';var _=require(_0x2f7a('0x0'));var util=require(_0x2f7a('0x1'));var logger=require('../../config/logger')(_0x2f7a('0x2'));var moment=require(_0x2f7a('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f7a('0x4'));var fs=require('fs');var path=require(_0x2f7a('0x5'));var rimraf=require(_0x2f7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f7a('0x7'));module['exports']=function(_0x4250fb,_0x5679d3){return _0x4250fb[_0x2f7a('0x8')](_0x2f7a('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 17e34dc..1d627d6 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 _0x996e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x37f8ac,_0x319ba1){var _0x78418f=function(_0x4551e9){while(--_0x4551e9){_0x37f8ac['push'](_0x37f8ac['shift']());}};_0x78418f(++_0x319ba1);}(_0x996e,0x1d6));var _0xe996=function(_0xcfaee1,_0x503445){_0xcfaee1=_0xcfaee1-0x0;var _0x12ff99=_0x996e[_0xcfaee1];return _0x12ff99;};'use strict';var _=require(_0xe996('0x0'));var util=require(_0xe996('0x1'));var moment=require('moment');var BPromise=require(_0xe996('0x2'));var rs=require(_0xe996('0x3'));var fs=require('fs');var Redis=require(_0xe996('0x4'));var db=require(_0xe996('0x5'))['db'];var utils=require(_0xe996('0x6'));var logger=require(_0xe996('0x7'))('rpc');var config=require(_0xe996('0x8'));var jayson=require(_0xe996('0x9'));var client=jayson[_0xe996('0xa')][_0xe996('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x262b59,_0x2af823,_0x3a6eee){return new BPromise(function(_0x33472d,_0x6fd6e6){return client[_0xe996('0xc')](_0x262b59,_0x3a6eee)[_0xe996('0xd')](function(_0x58bd53){logger[_0xe996('0xe')](_0xe996('0xf'),_0x2af823,_0xe996('0x10'));logger[_0xe996('0x11')](_0xe996('0x12'),_0x2af823,_0xe996('0x10'),JSON[_0xe996('0x13')](_0x58bd53));if(_0x58bd53[_0xe996('0x14')]){if(_0x58bd53[_0xe996('0x14')][_0xe996('0x15')]===0x1f4){logger['error'](_0xe996('0xf'),_0x2af823,_0x58bd53[_0xe996('0x14')][_0xe996('0x16')]);return _0x6fd6e6(_0x58bd53['error'][_0xe996('0x16')]);}logger[_0xe996('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2af823,_0x58bd53['error'][_0xe996('0x16')]);return _0x33472d(_0x58bd53[_0xe996('0x14')][_0xe996('0x16')]);}else{logger[_0xe996('0xe')](_0xe996('0xf'),_0x2af823,_0xe996('0x10'));_0x33472d(_0x58bd53[_0xe996('0x17')][_0xe996('0x16')]);}})[_0xe996('0x18')](function(_0x40cca7){logger[_0xe996('0x14')](_0xe996('0xf'),_0x2af823,_0x40cca7);_0x6fd6e6(_0x40cca7);});});} \ No newline at end of file +var _0x61f5=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0x106a74,_0x51ad4b){var _0x1c5273=function(_0x29f69d){while(--_0x29f69d){_0x106a74['push'](_0x106a74['shift']());}};_0x1c5273(++_0x51ad4b);}(_0x61f5,0xfa));var _0x561f=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x61f5[_0x4450b1];return _0x399b0b;};'use strict';var _=require(_0x561f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x561f('0x1'));var rs=require(_0x561f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x561f('0x3'))['db'];var utils=require(_0x561f('0x4'));var logger=require('../../config/logger')(_0x561f('0x5'));var config=require(_0x561f('0x6'));var jayson=require(_0x561f('0x7'));var client=jayson[_0x561f('0x8')][_0x561f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32f4fe,_0xd56229,_0x4cc92a){return new BPromise(function(_0x2dbe65,_0x2196aa){return client[_0x561f('0xa')](_0x32f4fe,_0x4cc92a)['then'](function(_0x45ee89){logger[_0x561f('0xb')](_0x561f('0xc'),_0xd56229,_0x561f('0xd'));logger[_0x561f('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xd56229,'request\x20sent',JSON[_0x561f('0xf')](_0x45ee89));if(_0x45ee89['error']){if(_0x45ee89[_0x561f('0x10')][_0x561f('0x11')]===0x1f4){logger[_0x561f('0x10')](_0x561f('0xc'),_0xd56229,_0x45ee89[_0x561f('0x10')][_0x561f('0x12')]);return _0x2196aa(_0x45ee89[_0x561f('0x10')][_0x561f('0x12')]);}logger[_0x561f('0x10')](_0x561f('0xc'),_0xd56229,_0x45ee89[_0x561f('0x10')][_0x561f('0x12')]);return _0x2dbe65(_0x45ee89[_0x561f('0x10')][_0x561f('0x12')]);}else{logger['info'](_0x561f('0xc'),_0xd56229,_0x561f('0xd'));_0x2dbe65(_0x45ee89[_0x561f('0x13')]['message']);}})[_0x561f('0x14')](function(_0x34ef8d){logger['error'](_0x561f('0xc'),_0xd56229,_0x34ef8d);_0x2196aa(_0x34ef8d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 67f3b8e..4e8d36c 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 _0x1851=['fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/sections','post','create','clone','addSections','/:id/resources','addResources','update','delete','destroy','removeSections','exports','multer','util','connect-timeout','express'];(function(_0x3386a6,_0x29a3d5){var _0xd22cc9=function(_0x58b3a6){while(--_0x58b3a6){_0x3386a6['push'](_0x3386a6['shift']());}};_0xd22cc9(++_0x29a3d5);}(_0x1851,0x16c));var _0x1185=function(_0x2ffcd9,_0x25029f){_0x2ffcd9=_0x2ffcd9-0x0;var _0x4f3e89=_0x1851[_0x2ffcd9];return _0x4f3e89;};'use strict';var multer=require(_0x1185('0x0'));var util=require(_0x1185('0x1'));var path=require('path');var timeout=require(_0x1185('0x2'));var express=require(_0x1185('0x3'));var router=express['Router']();var fs_extra=require(_0x1185('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1185('0x5'));var controller=require('./userProfile.controller');router[_0x1185('0x6')]('/',auth[_0x1185('0x7')](),controller['index']);router['get'](_0x1185('0x8'),auth[_0x1185('0x7')](),controller[_0x1185('0x9')]);router[_0x1185('0x6')](_0x1185('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1185('0x6')](_0x1185('0xb'),auth['isAuthenticated'](),controller['getSections']);router[_0x1185('0x6')]('/:id/resources',auth[_0x1185('0x7')](),controller['getResources']);router[_0x1185('0xc')]('/',auth['isAuthenticated'](),controller[_0x1185('0xd')]);router[_0x1185('0xc')]('/:id/clone',auth[_0x1185('0x7')](),controller[_0x1185('0xe')]);router[_0x1185('0xc')](_0x1185('0xb'),auth['isAuthenticated'](),controller[_0x1185('0xf')]);router[_0x1185('0xc')](_0x1185('0x10'),auth[_0x1185('0x7')](),controller[_0x1185('0x11')]);router['put']('/:id',auth[_0x1185('0x7')](),controller[_0x1185('0x12')]);router[_0x1185('0x13')](_0x1185('0xa'),auth['isAuthenticated'](),controller[_0x1185('0x14')]);router['delete'](_0x1185('0xb'),auth['isAuthenticated'](),controller[_0x1185('0x15')]);router[_0x1185('0x13')](_0x1185('0x10'),auth[_0x1185('0x7')](),controller['removeResources']);module[_0x1185('0x16')]=router; \ No newline at end of file +var _0x1420=['delete','removeSections','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','show','getSections','/:id/resources','post','/:id/clone','/:id/sections','addSections','addResources','put','/:id','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1420,0x1a4));var _0x0142=function(_0x5aa3dc,_0x230e0f){_0x5aa3dc=_0x5aa3dc-0x0;var _0x558e15=_0x1420[_0x5aa3dc];return _0x558e15;};'use strict';var multer=require(_0x0142('0x0'));var util=require(_0x0142('0x1'));var path=require(_0x0142('0x2'));var timeout=require('connect-timeout');var express=require(_0x0142('0x3'));var router=express[_0x0142('0x4')]();var fs_extra=require(_0x0142('0x5'));var auth=require(_0x0142('0x6'));var interaction=require(_0x0142('0x7'));var config=require('../../config/environment');var controller=require(_0x0142('0x8'));router[_0x0142('0x9')]('/',auth[_0x0142('0xa')](),controller['index']);router['get']('/describe',auth[_0x0142('0xa')](),controller['describe']);router[_0x0142('0x9')]('/:id',auth[_0x0142('0xa')](),controller[_0x0142('0xb')]);router[_0x0142('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0x0142('0xc')]);router[_0x0142('0x9')](_0x0142('0xd'),auth['isAuthenticated'](),controller['getResources']);router[_0x0142('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0142('0xe')](_0x0142('0xf'),auth[_0x0142('0xa')](),controller['clone']);router['post'](_0x0142('0x10'),auth[_0x0142('0xa')](),controller[_0x0142('0x11')]);router[_0x0142('0xe')](_0x0142('0xd'),auth[_0x0142('0xa')](),controller[_0x0142('0x12')]);router[_0x0142('0x13')](_0x0142('0x14'),auth[_0x0142('0xa')](),controller[_0x0142('0x15')]);router[_0x0142('0x16')](_0x0142('0x14'),auth[_0x0142('0xa')](),controller['destroy']);router[_0x0142('0x16')]('/:id/sections',auth[_0x0142('0xa')](),controller[_0x0142('0x17')]);router[_0x0142('0x16')](_0x0142('0xd'),auth['isAuthenticated'](),controller[_0x0142('0x18')]);module[_0x0142('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2d9f944..6866ccc 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 _0x048a=['name','crudPermissions','join','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x1160f4,_0xb82c95){var _0x39651d=function(_0x1f2cd3){while(--_0x1f2cd3){_0x1160f4['push'](_0x1160f4['shift']());}};_0x39651d(++_0xb82c95);}(_0x048a,0x1b7));var _0xa048=function(_0x34ae0e,_0x49f01a){_0x34ae0e=_0x34ae0e-0x0;var _0x2297ee=_0x048a[_0x34ae0e];return _0x2297ee;};'use strict';var Sequelize=require(_0xa048('0x0'));module['exports']={'name':{'type':Sequelize[_0xa048('0x1')],'allowNull':![],'unique':_0xa048('0x2')},'crudPermissions':{'type':Sequelize[_0xa048('0x1')],'set':function(_0x2b250e){this['setDataValue'](_0xa048('0x3'),_0x2b250e?_0x2b250e[_0xa048('0x4')](''):[]);},'get':function(){return this[_0xa048('0x5')](_0xa048('0x3'))?this[_0xa048('0x5')](_0xa048('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa048('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6f9a=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x22e5ed,_0x58a5be){var _0x5416f6=function(_0x52ced1){while(--_0x52ced1){_0x22e5ed['push'](_0x22e5ed['shift']());}};_0x5416f6(++_0x58a5be);}(_0x6f9a,0x7e));var _0xa6f9=function(_0x51e8cd,_0x3912c9){_0x51e8cd=_0x51e8cd-0x0;var _0x543175=_0x6f9a[_0x51e8cd];return _0x543175;};'use strict';var Sequelize=require(_0xa6f9('0x0'));module[_0xa6f9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa6f9('0x2')},'crudPermissions':{'type':Sequelize[_0xa6f9('0x3')],'set':function(_0x359ef9){this[_0xa6f9('0x4')](_0xa6f9('0x5'),_0x359ef9?_0x359ef9[_0xa6f9('0x6')](''):[]);},'get':function(){return this[_0xa6f9('0x7')](_0xa6f9('0x5'))?this['getDataValue'](_0xa6f9('0x5'))[_0xa6f9('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa6f9('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f228501..a43d66b 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 _0xa777=['describe','addSections','UserProfileSection','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','reject','save','update','then','end','sendStatus','error','name','send','map','UserProfile','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','clone','get','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','destroy'];(function(_0x2d4b0a,_0x5147ba){var _0xe59a7a=function(_0x18b7d0){while(--_0x18b7d0){_0x2d4b0a['push'](_0x2d4b0a['shift']());}};_0xe59a7a(++_0x5147ba);}(_0xa777,0xf7));var _0x7a77=function(_0x261338,_0x90122b){_0x261338=_0x261338-0x0;var _0x54360d=_0xa777[_0x261338];return _0x54360d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a77('0x0'));var zipdir=require(_0x7a77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a77('0x2'));var Mustache=require(_0x7a77('0x3'));var util=require('util');var path=require(_0x7a77('0x4'));var sox=require(_0x7a77('0x5'));var csv=require('to-csv');var ejs=require(_0x7a77('0x6'));var fs=require('fs');var fs_extra=require(_0x7a77('0x7'));var _=require(_0x7a77('0x8'));var squel=require(_0x7a77('0x9'));var crypto=require('crypto');var jsforce=require(_0x7a77('0xa'));var deskjs=require(_0x7a77('0xb'));var toCsv=require(_0x7a77('0xc'));var querystring=require(_0x7a77('0xd'));var Papa=require(_0x7a77('0xe'));var Redis=require(_0x7a77('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a77('0x10'));var as=require(_0x7a77('0x11'));var hardwareService=require(_0x7a77('0x12'));var logger=require(_0x7a77('0x13'))(_0x7a77('0x14'));var utils=require(_0x7a77('0x15'));var config=require(_0x7a77('0x16'));var licenseUtil=require(_0x7a77('0x17'));var db=require(_0x7a77('0x18'))['db'];config[_0x7a77('0x19')]=_[_0x7a77('0x1a')](config[_0x7a77('0x19')],{'host':_0x7a77('0x1b'),'port':0x18eb});var socket=require(_0x7a77('0x1c'))(new Redis(config[_0x7a77('0x19')]));require('./userProfile.socket')[_0x7a77('0x1d')](socket);function respondWithStatusCode(_0x250792,_0x2902a3){_0x2902a3=_0x2902a3||0xcc;return function(_0x52aac9){if(_0x52aac9){return _0x250792['sendStatus'](_0x2902a3);}return _0x250792[_0x7a77('0x1e')](_0x2902a3)['end']();};}function respondWithResult(_0x71cf71,_0x38f065){_0x38f065=_0x38f065||0xc8;return function(_0xc3a484){if(_0xc3a484){return _0x71cf71['status'](_0x38f065)[_0x7a77('0x1f')](_0xc3a484);}};}function respondWithFilteredResult(_0x4c993f,_0x4afb98){return function(_0x1b33ac){if(_0x1b33ac){var _0x4fac78=typeof _0x4afb98[_0x7a77('0x20')]===_0x7a77('0x21')&&typeof _0x4afb98[_0x7a77('0x22')]==='undefined';var _0x5f4b06=_0x1b33ac[_0x7a77('0x23')];var _0x32d9d7=_0x4fac78?0x0:_0x4afb98[_0x7a77('0x20')];var _0x33e1cb=_0x4fac78?_0x1b33ac[_0x7a77('0x23')]:_0x4afb98[_0x7a77('0x20')]+_0x4afb98[_0x7a77('0x22')];var _0x36e924;if(_0x33e1cb>=_0x5f4b06){_0x33e1cb=_0x5f4b06;_0x36e924=0xc8;}else{_0x36e924=0xce;}_0x4c993f['status'](_0x36e924);return _0x4c993f['set']('Content-Range',_0x32d9d7+'-'+_0x33e1cb+'/'+_0x5f4b06)[_0x7a77('0x1f')](_0x1b33ac);}return null;};}function patchUpdates(_0x15b8f9){return function(_0x11572e){try{jsonpatch['apply'](_0x11572e,_0x15b8f9,!![]);}catch(_0x3c6ba4){return BPromise[_0x7a77('0x24')](_0x3c6ba4);}return _0x11572e[_0x7a77('0x25')]();};}function saveUpdates(_0x3c2578,_0x2a65d3){return function(_0x290b71){if(_0x290b71){return _0x290b71[_0x7a77('0x26')](_0x3c2578)[_0x7a77('0x27')](function(_0x54821c){return _0x54821c;});}return null;};}function removeEntity(_0x2cfb1a,_0x3599d2){return function(_0x292ccb){if(_0x292ccb){return _0x292ccb['destroy']()['then'](function(){_0x2cfb1a[_0x7a77('0x1e')](0xcc)[_0x7a77('0x28')]();});}};}function handleEntityNotFound(_0x43e740,_0x1762f8){return function(_0x185f72){if(!_0x185f72){_0x43e740[_0x7a77('0x29')](0x194);}return _0x185f72;};}function handleError(_0xe5a85b,_0x53fa44){_0x53fa44=_0x53fa44||0x1f4;return function(_0x5abe9a){logger[_0x7a77('0x2a')](_0x5abe9a['stack']);if(_0x5abe9a[_0x7a77('0x2b')]){delete _0x5abe9a['name'];}_0xe5a85b[_0x7a77('0x1e')](_0x53fa44)[_0x7a77('0x2c')](_0x5abe9a);};}exports['index']=function(_0x5ebfb0,_0x54887f){var _0x440b56={},_0x41afc1={},_0x462493={'count':0x0,'rows':[]};var _0x17771d=_[_0x7a77('0x2d')](db[_0x7a77('0x2e')][_0x7a77('0x2f')],function(_0x70ac17){return{'name':_0x70ac17['fieldName'],'type':_0x70ac17['type'][_0x7a77('0x30')]};});_0x41afc1[_0x7a77('0x31')]=_['map'](_0x17771d,_0x7a77('0x2b'));_0x41afc1[_0x7a77('0x32')]=_['keys'](_0x5ebfb0['query']);_0x41afc1['filters']=_['intersection'](_0x41afc1[_0x7a77('0x31')],_0x41afc1['query']);_0x440b56['attributes']=_[_0x7a77('0x33')](_0x41afc1[_0x7a77('0x31')],qs[_0x7a77('0x34')](_0x5ebfb0['query']['fields']));_0x440b56['attributes']=_0x440b56[_0x7a77('0x35')][_0x7a77('0x36')]?_0x440b56[_0x7a77('0x35')]:_0x41afc1['model'];if(!_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x37')]('nolimit')){_0x440b56['limit']=qs['limit'](_0x5ebfb0['query'][_0x7a77('0x22')]);_0x440b56[_0x7a77('0x20')]=qs[_0x7a77('0x20')](_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x20')]);}_0x440b56[_0x7a77('0x38')]=qs['sort'](_0x5ebfb0[_0x7a77('0x32')]['sort']);_0x440b56['where']=qs[_0x7a77('0x39')](_[_0x7a77('0x3a')](_0x5ebfb0[_0x7a77('0x32')],_0x41afc1[_0x7a77('0x39')]),_0x17771d);if(_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3b')]){_0x440b56['where']=_[_0x7a77('0x3c')](_0x440b56[_0x7a77('0x3d')],{'$or':_[_0x7a77('0x2d')](_0x17771d,function(_0x44dc3e){if(_0x44dc3e['type']!=='VIRTUAL'){var _0x17f77b={};_0x17f77b[_0x44dc3e['name']]={'$like':'%'+_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3b')]+'%'};return _0x17f77b;}})});}_0x440b56=_['merge']({},_0x440b56,_0x5ebfb0[_0x7a77('0x3e')]);var _0x5b7271={'where':_0x440b56[_0x7a77('0x3d')]};return db[_0x7a77('0x2e')][_0x7a77('0x23')](_0x5b7271)[_0x7a77('0x27')](function(_0x4ac304){_0x462493[_0x7a77('0x23')]=_0x4ac304;if(_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3f')]){_0x440b56[_0x7a77('0x40')]=[{'all':!![]}];}return db['UserProfile'][_0x7a77('0x41')](_0x440b56);})[_0x7a77('0x27')](function(_0x1e3c87){_0x462493[_0x7a77('0x42')]=_0x1e3c87;return _0x462493;})[_0x7a77('0x27')](respondWithFilteredResult(_0x54887f,_0x440b56))['catch'](handleError(_0x54887f,null));};exports[_0x7a77('0x43')]=function(_0x13869e,_0x2e339a){var _0x2a1ecd={'raw':![],'where':{'id':_0x13869e[_0x7a77('0x44')]['id']}},_0x1220c3={};_0x1220c3[_0x7a77('0x31')]=_['keys'](db['UserProfile'][_0x7a77('0x2f')]);_0x1220c3[_0x7a77('0x32')]=_[_0x7a77('0x45')](_0x13869e[_0x7a77('0x32')]);_0x1220c3[_0x7a77('0x39')]=_[_0x7a77('0x33')](_0x1220c3[_0x7a77('0x31')],_0x1220c3[_0x7a77('0x32')]);_0x2a1ecd[_0x7a77('0x35')]=_[_0x7a77('0x33')](_0x1220c3[_0x7a77('0x31')],qs[_0x7a77('0x34')](_0x13869e[_0x7a77('0x32')]['fields']));_0x2a1ecd[_0x7a77('0x35')]=_0x2a1ecd[_0x7a77('0x35')][_0x7a77('0x36')]?_0x2a1ecd[_0x7a77('0x35')]:_0x1220c3[_0x7a77('0x31')];if(_0x13869e['query'][_0x7a77('0x3f')]){_0x2a1ecd[_0x7a77('0x40')]=[{'all':!![]}];}_0x2a1ecd=_[_0x7a77('0x3c')]({},_0x2a1ecd,_0x13869e['options']);return db[_0x7a77('0x2e')][_0x7a77('0x46')](_0x2a1ecd)[_0x7a77('0x27')](handleEntityNotFound(_0x2e339a,null))[_0x7a77('0x27')](respondWithResult(_0x2e339a,null))[_0x7a77('0x47')](handleError(_0x2e339a,null));};exports[_0x7a77('0x48')]=function(_0x33e45c,_0x5a79c1){return db[_0x7a77('0x2e')]['create'](_0x33e45c['body'],{})['then'](respondWithResult(_0x5a79c1,0xc9))[_0x7a77('0x47')](handleError(_0x5a79c1,null));};exports[_0x7a77('0x49')]=function(_0x1aac60,_0x461dc5){var _0x487931={'where':{'id':_0x1aac60[_0x7a77('0x44')]['id']}},_0x2e07fb={};_0x2e07fb[_0x7a77('0x31')]=_[_0x7a77('0x45')](db[_0x7a77('0x2e')]['rawAttributes']);_0x487931[_0x7a77('0x35')]=_['intersection'](_0x2e07fb['model'],qs[_0x7a77('0x34')](_0x1aac60[_0x7a77('0x32')][_0x7a77('0x34')]));_0x487931['attributes']=_0x487931[_0x7a77('0x35')][_0x7a77('0x36')]?_0x487931[_0x7a77('0x35')]:_0x2e07fb[_0x7a77('0x31')];if(_0x1aac60[_0x7a77('0x32')][_0x7a77('0x3f')]){_0x487931[_0x7a77('0x40')]=[{'all':!![]}];}_0x487931=_[_0x7a77('0x3c')]({},_0x487931,_0x1aac60[_0x7a77('0x3e')]);return db[_0x7a77('0x2e')][_0x7a77('0x46')](_0x487931)['then'](handleEntityNotFound(_0x461dc5,null))[_0x7a77('0x27')](function(_0x1f506a){if(_0x1f506a){var _0xf7564=_0x1f506a[_0x7a77('0x4a')]({'plain':!![]});_0xf7564=qs['omit'](_0xf7564,['id',_0x7a77('0x4b'),_0x7a77('0x4c'),_0x7a77('0x4d')]);_0x1aac60[_0x7a77('0x4e')]=_['omit'](_0x1aac60[_0x7a77('0x4e')],['id','createdAt',_0x7a77('0x4c')]);return db[_0x7a77('0x4f')][_0x7a77('0x50')](function(_0x52be14){return db[_0x7a77('0x2e')][_0x7a77('0x48')](_[_0x7a77('0x3c')](_0xf7564,_0x1aac60['body']),{'include':_0x1aac60[_0x7a77('0x32')][_0x7a77('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x52be14})[_0x7a77('0x27')](function(_0x206236){var _0x4187d7=_0x206236[_0x7a77('0x4a')]({'plain':!![]});return db['UserProfileSection'][_0x7a77('0x41')]({'where':{'userProfileId':_0x1aac60[_0x7a77('0x44')]['id']},'raw':!![]})['then'](function(_0x38c52e){if(_0x38c52e){return BPromise[_0x7a77('0x51')](_0x38c52e,function(_0x377596){return new BPromise(function(_0x53fe34,_0x379386){if(_0x377596[_0x7a77('0x52')]===null||_0x377596[_0x7a77('0x52')]===0x1)_0x53fe34(null);return db[_0x7a77('0x53')][_0x7a77('0x41')]({'where':{'sectionId':_0x377596['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x59d908){var _0x226dfa=_[_0x7a77('0x2d')](_0x59d908,function(_0x3488db){return qs[_0x7a77('0x54')](_0x3488db,['id',_0x7a77('0x4b'),'updatedAt',_0x7a77('0x55')]);});_0x53fe34(_0x226dfa);})[_0x7a77('0x47')](function(_0x599131){_0x379386(_0x599131);});})[_0x7a77('0x27')](function(_0x1dabab){var _0x17590f=qs[_0x7a77('0x54')](_0x377596,['id',_0x7a77('0x4b'),_0x7a77('0x4c')]);_0x17590f[_0x7a77('0x56')]=_0x4187d7['id'];if(_0x1dabab)_0x17590f[_0x7a77('0x57')]=_0x1dabab;return _0x17590f;})['then'](function(_0x5bf2ce){return db['UserProfileSection'][_0x7a77('0x48')](_0x5bf2ce,{'include':[{'model':db[_0x7a77('0x53')],'as':_0x7a77('0x57')}],'raw':!![],'transaction':_0x52be14});});})[_0x7a77('0x27')](function(){return _0x4187d7;});}});});});}})[_0x7a77('0x27')](respondWithResult(_0x461dc5,0xc9))[_0x7a77('0x47')](handleError(_0x461dc5,null));};exports[_0x7a77('0x26')]=function(_0x391835,_0x7bba0d){if(_0x391835[_0x7a77('0x4e')]['id']){delete _0x391835['body']['id'];}return db[_0x7a77('0x2e')]['find']({'where':{'id':_0x391835['params']['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x7bba0d,null))['then'](saveUpdates(_0x391835[_0x7a77('0x4e')],null))[_0x7a77('0x27')](respondWithResult(_0x7bba0d,null))[_0x7a77('0x47')](handleError(_0x7bba0d,null));};exports[_0x7a77('0x58')]=function(_0x5d25c4,_0x4e232a){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x5d25c4[_0x7a77('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e232a,null))['then'](removeEntity(_0x4e232a,null))[_0x7a77('0x47')](handleError(_0x4e232a,null));};exports[_0x7a77('0x59')]=function(_0x90e002,_0x840eb){return db['UserProfile']['describe']()[_0x7a77('0x27')](respondWithResult(_0x840eb,null))[_0x7a77('0x47')](handleError(_0x840eb,null));};exports[_0x7a77('0x5a')]=function(_0x24cb74,_0x424e55){var _0x157ea4=_0x24cb74['body'];return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x24cb74['params']['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x424e55,null))[_0x7a77('0x27')](function(_0x317664){if(_0x317664){return db[_0x7a77('0x4f')]['transaction'](function(_0x15acde){return db[_0x7a77('0x5b')][_0x7a77('0x58')]({'where':{'userProfileId':_0x24cb74[_0x7a77('0x44')]['id'],'sectionId':_['map'](_0x157ea4,function(_0x14c57d){return _0x14c57d[_0x7a77('0x55')];})},'transaction':_0x15acde})[_0x7a77('0x27')](function(){var _0x124e98=_[_0x7a77('0x2d')](_0x157ea4,function(_0xbe7dff){_0xbe7dff[_0x7a77('0x56')]=_0x24cb74[_0x7a77('0x44')]['id'];return _0xbe7dff;});var _0x5ac44a=[];return BPromise['each'](_0x124e98,function(_0x389f0a){return db[_0x7a77('0x5b')][_0x7a77('0x48')](_0x389f0a,{'include':[{'model':db[_0x7a77('0x53')],'as':_0x7a77('0x57')}],'raw':!![],'transaction':_0x15acde})[_0x7a77('0x27')](function(_0x9cbc5d){_0x5ac44a[_0x7a77('0x5c')](_0x9cbc5d[_0x7a77('0x4a')]({'plain':!![]}));});})[_0x7a77('0x27')](function(){return _0x5ac44a;});});});}})[_0x7a77('0x27')](function(_0x1eeb5e){return _0x1eeb5e;})[_0x7a77('0x27')](respondWithResult(_0x424e55,null))['catch'](handleError(_0x424e55,null));};exports[_0x7a77('0x5d')]=function(_0x356f5d,_0x489499){var _0x45ff27;return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x356f5d[_0x7a77('0x44')]['id']},'attributes':['id','name']})[_0x7a77('0x27')](handleEntityNotFound(_0x489499,null))[_0x7a77('0x27')](function(_0x4fd228){if(_0x4fd228){_0x45ff27=_0x4fd228;return db[_0x7a77('0x5b')][_0x7a77('0x58')]({'where':{'userProfileId':_0x356f5d[_0x7a77('0x44')]['id'],'sectionId':_0x356f5d[_0x7a77('0x32')][_0x7a77('0x5e')]}});}})[_0x7a77('0x27')](function(){return _0x45ff27;})[_0x7a77('0x27')](respondWithStatusCode(_0x489499,null))[_0x7a77('0x47')](handleError(_0x489499,null));};exports[_0x7a77('0x5f')]=function(_0x5e9734,_0x5bb8ed){var _0x179eb0=[];var _0x5c8fa9=[];return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x5e9734[_0x7a77('0x44')]['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x2fe247){_0x179eb0=_[_0x7a77('0x3b')](_0x2fe247,function(_0x5082cc){return _0x5082cc['enabled']===0x1||_[_0x7a77('0x60')]([0x3eb,0x709],_0x5082cc[_0x7a77('0x55')]);});if(!_[_0x7a77('0x61')](_0x179eb0)){return _['map'](_0x179eb0,function(_0x151420){return _0x151420['sectionId'];});}else{return;}})['then'](function(_0x43f948){if(_0x43f948)_0x5c8fa9=_0x43f948;if(_['includes'](_0x5c8fa9,0x64)){var _0x550ace=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x64});return hasDefaultDashboard(_0x550ace)[_0x7a77('0x27')](function(_0x2ac169){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x185f6d){if(_0x185f6d['sectionId']===0x64){_0x185f6d[_0x7a77('0x62')]=_0x2ac169;}return _0x185f6d;});});}else{return;}})['then'](function(_0x2cc57a){if(_0x2cc57a)_0x179eb0=_0x2cc57a;if(_[_0x7a77('0x60')](_0x5c8fa9,0x3eb)){var _0x17d50e=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x3eb});return getCustomDashboards(_0x17d50e)[_0x7a77('0x27')](function(_0x276edb){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x4f8f76){if(_0x17d50e[_0x7a77('0x63')]){if(_0x4f8f76[_0x7a77('0x55')]===0x3eb){_0x4f8f76[_0x7a77('0x62')]=_0x276edb;}}else{if(_0x4f8f76[_0x7a77('0x55')]===0x64){if(!_0x4f8f76['subsections']){_0x4f8f76[_0x7a77('0x62')]=[];}_0x4f8f76[_0x7a77('0x62')]=_0x4f8f76[_0x7a77('0x62')][_0x7a77('0x64')](_0x276edb);}}return _0x4f8f76;});});}else{return;}})[_0x7a77('0x27')](function(_0x278f17){if(_0x278f17)_0x179eb0=_0x278f17;if(_[_0x7a77('0x60')](_0x5c8fa9,0x709)){var _0xb33653=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x709});return getPlugins(_0xb33653)[_0x7a77('0x27')](function(_0xbf3b63){if(_0xb33653[_0x7a77('0x63')]){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x314c3d){if(_0x314c3d['sectionId']===0x709){_0x314c3d[_0x7a77('0x62')]=_0xbf3b63;}return _0x314c3d;});}else{var _0xd02811={'sectionId':0x76c,'enabled':0x1,'subsections':_0xbf3b63};var _0xec5507=_[_0x7a77('0x2d')](_0x179eb0);_0xec5507[_0x7a77('0x5c')](_0xd02811);return _0xec5507;}});}else{return;}})['then'](function(_0x1d7d79){if(_0x1d7d79)_0x179eb0=_0x1d7d79;return _[_0x7a77('0x3b')](_0x179eb0,['enabled',0x1]);})[_0x7a77('0x27')](respondWithResult(_0x5bb8ed,null))[_0x7a77('0x47')](handleError(_0x5bb8ed,null));};function hasDefaultDashboard(_0x14f2af){var _0xb40ff6=[0x65];return new BPromise(function(_0x30460a,_0xc0340a){try{if(_0x14f2af[_0x7a77('0x52')]){_0x30460a(_0xb40ff6);}else{return db[_0x7a77('0x53')][_0x7a77('0x65')]({'where':{'sectionId':_0x14f2af['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x246540){_0x246540?_0x30460a(_0xb40ff6):_0x30460a();});}}catch(_0x19a37a){_0xc0340a(_0x19a37a);}});}function getCustomDashboards(_0x51323a){var _0x18d871=[];return new BPromise(function(_0x4444c4,_0x4573da){try{if(_0x51323a['autoAssociation']){return db[_0x7a77('0x66')][_0x7a77('0x41')]({'raw':!![]})[_0x7a77('0x27')](function(_0x390074){_0x390074[_0x7a77('0x67')](function(_0x51101e){_0x18d871[_0x7a77('0x5c')](_0x51101e['id']+0x1869f);});_0x4444c4(_0x18d871);});}else{return db[_0x7a77('0x53')][_0x7a77('0x41')]({'where':{'sectionId':_0x51323a['id']},'raw':!![]})['then'](function(_0x2b3bf6){_0x2b3bf6['forEach'](function(_0x4db97e){_0x18d871['push'](_0x4db97e[_0x7a77('0x68')]+0x1869f);});_0x4444c4(_0x18d871);});}}catch(_0x55ec00){_0x4573da(_0x55ec00);}});}function getPlugins(_0x595c0c){var _0x38427f=[];return new BPromise(function(_0x30b878,_0x3e4747){try{if(_0x595c0c[_0x7a77('0x52')]){return db[_0x7a77('0x69')]['findAll']({'raw':!![]})['then'](function(_0x456614){_0x456614['forEach'](function(_0x429ca8){_0x38427f[_0x7a77('0x5c')](_0x429ca8['id']+0x15b38);});_0x30b878(_0x38427f);});}else{return db['UserProfileResource'][_0x7a77('0x41')]({'where':{'sectionId':_0x595c0c['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x3c8980){_0x3c8980[_0x7a77('0x67')](function(_0x43b20c){_0x38427f[_0x7a77('0x5c')](_0x43b20c[_0x7a77('0x68')]+0x15b38);});_0x30b878(_0x38427f);});}}catch(_0x1ae5b3){_0x3e4747(_0x1ae5b3);}});}exports['addResources']=function(_0x19602d,_0x3b9b76){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x19602d[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x3b9b76,null))[_0x7a77('0x27')](function(_0x8c7609){if(_0x8c7609){return db['sequelize'][_0x7a77('0x50')](function(_0x23ff79){return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x19602d['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4e0d9c){if(_0x4e0d9c){return db[_0x7a77('0x5b')]['destroy']({'where':{'userProfileId':_0x19602d[_0x7a77('0x44')]['id'],'id':_[_0x7a77('0x2d')](_0x4e0d9c,function(_0x3a2879){return _0x3a2879['id'];})},'transaction':_0x23ff79});}})[_0x7a77('0x27')](function(_0x5af588){var _0x26e8f9=_[_0x7a77('0x2d')](_0x19602d[_0x7a77('0x4e')],function(_0x8af969){_0x8af969[_0x7a77('0x56')]=_0x19602d['params']['id'];return _0x8af969;});return db[_0x7a77('0x5b')][_0x7a77('0x6a')](_0x26e8f9,{'raw':!![],'transaction':_0x23ff79});})['then'](function(_0x57ecb2){var _0x3421dd=_[_0x7a77('0x3b')](_[_0x7a77('0x2d')](_0x57ecb2,function(_0x3d1963){return _0x3d1963[_0x7a77('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x3421dd){return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x19602d[_0x7a77('0x44')]['id'],'sectionId':_[_0x7a77('0x2d')](_0x3421dd,function(_0x2967c3){return _0x2967c3[_0x7a77('0x55')];})},'attributes':['id',_0x7a77('0x55')],'raw':!![]})[_0x7a77('0x27')](function(_0x14ef51){var _0x13e59e=_[_0x7a77('0x2d')](_0x19602d[_0x7a77('0x4e')],function(_0x3ac94a){_0x3ac94a[_0x7a77('0x56')]=_0x19602d[_0x7a77('0x44')]['id'];return _0x3ac94a;});return db[_0x7a77('0x53')]['bulkCreate'](_0x13e59e,{'raw':!![],'transaction':_0x23ff79});});}})[_0x7a77('0x47')](handleError(_0x3b9b76,null));});}})['then'](function(_0x4cfea1){var _0x2d9c8c=_[_0x7a77('0x2d')](_0x4cfea1,function(_0x54eb63){return _0x54eb63[_0x7a77('0x4a')]({'plain':!![]});});})[_0x7a77('0x27')](respondWithResult(_0x3b9b76,null))[_0x7a77('0x47')](handleError(_0x3b9b76,null));};exports[_0x7a77('0x6b')]=function(_0x4830ec,_0x2ea606,_0x30da48){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x4830ec[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x2ea606,null))[_0x7a77('0x27')](function(_0x19d00b){if(_0x19d00b){return _0x19d00b['removeResources'](_0x4830ec[_0x7a77('0x32')]['ids']);}})[_0x7a77('0x27')](respondWithStatusCode(_0x2ea606,null))[_0x7a77('0x47')](handleError(_0x2ea606,null));};exports[_0x7a77('0x6c')]=function(_0x43a00e,_0x4cf50c){var _0x49addf={};if(!_0x43a00e[_0x7a77('0x32')][_0x7a77('0x6d')])throw new Error(_0x7a77('0x6e'));if(!_0x43a00e['query'][_0x7a77('0x37')](_0x7a77('0x6f'))){_0x49addf[_0x7a77('0x22')]=qs['limit'](_0x43a00e[_0x7a77('0x32')]['limit']);_0x49addf[_0x7a77('0x20')]=qs[_0x7a77('0x20')](_0x43a00e[_0x7a77('0x32')][_0x7a77('0x20')]);}return db[_0x7a77('0x2e')]['find']({'where':{'id':_0x43a00e[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](function(_0x575ed8){if(!_0x575ed8)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x43a00e[_0x7a77('0x44')]['id']);return db['UserProfile']['getResources'](_0x43a00e);})[_0x7a77('0x27')](respondWithFilteredResult(_0x4cf50c,_0x49addf))['catch'](handleError(_0x4cf50c,null));}; \ No newline at end of file +var _0x6fe9=['include','findAll','then','rows','params','find','catch','create','body','get','createdAt','crudPermissions','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','omit','sectionId','Resources','UserProfileSection','destroy','describe','addSections','userProfileId','push','removeSections','getSections','isEmpty','includes','subsections','enabled','concat','findOne','Dashboard','forEach','Plugin','bulkCreate','removeResources','ids','getResources','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll'];(function(_0x17a6ec,_0x46c667){var _0x2582c8=function(_0x4b8c87){while(--_0x4b8c87){_0x17a6ec['push'](_0x17a6ec['shift']());}};_0x2582c8(++_0x46c667);}(_0x6fe9,0x110));var _0x96fe=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6fe9[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x96fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96fe('0x1'));var jsonpatch=require(_0x96fe('0x2'));var rp=require(_0x96fe('0x3'));var moment=require(_0x96fe('0x4'));var BPromise=require(_0x96fe('0x5'));var Mustache=require('mustache');var util=require(_0x96fe('0x6'));var path=require(_0x96fe('0x7'));var sox=require(_0x96fe('0x8'));var csv=require(_0x96fe('0x9'));var ejs=require(_0x96fe('0xa'));var fs=require('fs');var fs_extra=require(_0x96fe('0xb'));var _=require(_0x96fe('0xc'));var squel=require(_0x96fe('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x96fe('0xe'));var toCsv=require(_0x96fe('0x9'));var querystring=require('querystring');var Papa=require(_0x96fe('0xf'));var Redis=require(_0x96fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x96fe('0x11'));var as=require(_0x96fe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96fe('0x13'))('api');var utils=require(_0x96fe('0x14'));var config=require(_0x96fe('0x15'));var licenseUtil=require(_0x96fe('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x96fe('0x17')](config[_0x96fe('0x18')],{'host':_0x96fe('0x19'),'port':0x18eb});var socket=require(_0x96fe('0x1a'))(new Redis(config[_0x96fe('0x18')]));require(_0x96fe('0x1b'))[_0x96fe('0x1c')](socket);function respondWithStatusCode(_0x10d74e,_0x4c89dd){_0x4c89dd=_0x4c89dd||0xcc;return function(_0x4be8b3){if(_0x4be8b3){return _0x10d74e[_0x96fe('0x1d')](_0x4c89dd);}return _0x10d74e[_0x96fe('0x1e')](_0x4c89dd)['end']();};}function respondWithResult(_0x20ddf2,_0x3b35c4){_0x3b35c4=_0x3b35c4||0xc8;return function(_0x1469b6){if(_0x1469b6){return _0x20ddf2['status'](_0x3b35c4)[_0x96fe('0x1f')](_0x1469b6);}};}function respondWithFilteredResult(_0x502f0c,_0x3145e7){return function(_0x5e6726){if(_0x5e6726){var _0x1bbb19=typeof _0x3145e7[_0x96fe('0x20')]===_0x96fe('0x21')&&typeof _0x3145e7[_0x96fe('0x22')]===_0x96fe('0x21');var _0x51552b=_0x5e6726[_0x96fe('0x23')];var _0x5079e=_0x1bbb19?0x0:_0x3145e7['offset'];var _0x473a6f=_0x1bbb19?_0x5e6726[_0x96fe('0x23')]:_0x3145e7[_0x96fe('0x20')]+_0x3145e7[_0x96fe('0x22')];var _0x11f72e;if(_0x473a6f>=_0x51552b){_0x473a6f=_0x51552b;_0x11f72e=0xc8;}else{_0x11f72e=0xce;}_0x502f0c[_0x96fe('0x1e')](_0x11f72e);return _0x502f0c[_0x96fe('0x24')](_0x96fe('0x25'),_0x5079e+'-'+_0x473a6f+'/'+_0x51552b)[_0x96fe('0x1f')](_0x5e6726);}return null;};}function patchUpdates(_0x405839){return function(_0x401c95){try{jsonpatch[_0x96fe('0x26')](_0x401c95,_0x405839,!![]);}catch(_0x2417a1){return BPromise[_0x96fe('0x27')](_0x2417a1);}return _0x401c95[_0x96fe('0x28')]();};}function saveUpdates(_0x1c8600,_0x39df75){return function(_0x2c8d5a){if(_0x2c8d5a){return _0x2c8d5a[_0x96fe('0x29')](_0x1c8600)['then'](function(_0x23418f){return _0x23418f;});}return null;};}function removeEntity(_0x529f6,_0x34b149){return function(_0xce3324){if(_0xce3324){return _0xce3324['destroy']()['then'](function(){_0x529f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb791,_0x3fdf3f){return function(_0x4aedf6){if(!_0x4aedf6){_0x3cb791[_0x96fe('0x1d')](0x194);}return _0x4aedf6;};}function handleError(_0x542ac2,_0x5b646f){_0x5b646f=_0x5b646f||0x1f4;return function(_0x248323){logger[_0x96fe('0x2a')](_0x248323[_0x96fe('0x2b')]);if(_0x248323[_0x96fe('0x2c')]){delete _0x248323['name'];}_0x542ac2['status'](_0x5b646f)[_0x96fe('0x2d')](_0x248323);};}exports[_0x96fe('0x2e')]=function(_0x2f654e,_0x2ffe32){var _0x29e704={},_0x322815={},_0x5a5513={'count':0x0,'rows':[]};var _0x4b6705=_['map'](db[_0x96fe('0x2f')][_0x96fe('0x30')],function(_0x2248d3){return{'name':_0x2248d3[_0x96fe('0x31')],'type':_0x2248d3[_0x96fe('0x32')][_0x96fe('0x33')]};});_0x322815[_0x96fe('0x34')]=_['map'](_0x4b6705,_0x96fe('0x2c'));_0x322815[_0x96fe('0x35')]=_[_0x96fe('0x36')](_0x2f654e[_0x96fe('0x35')]);_0x322815[_0x96fe('0x37')]=_['intersection'](_0x322815[_0x96fe('0x34')],_0x322815[_0x96fe('0x35')]);_0x29e704['attributes']=_[_0x96fe('0x38')](_0x322815['model'],qs[_0x96fe('0x39')](_0x2f654e[_0x96fe('0x35')][_0x96fe('0x39')]));_0x29e704[_0x96fe('0x3a')]=_0x29e704[_0x96fe('0x3a')][_0x96fe('0x3b')]?_0x29e704[_0x96fe('0x3a')]:_0x322815[_0x96fe('0x34')];if(!_0x2f654e['query'][_0x96fe('0x3c')]('nolimit')){_0x29e704[_0x96fe('0x22')]=qs[_0x96fe('0x22')](_0x2f654e[_0x96fe('0x35')][_0x96fe('0x22')]);_0x29e704[_0x96fe('0x20')]=qs[_0x96fe('0x20')](_0x2f654e[_0x96fe('0x35')][_0x96fe('0x20')]);}_0x29e704['order']=qs[_0x96fe('0x3d')](_0x2f654e[_0x96fe('0x35')]['sort']);_0x29e704[_0x96fe('0x3e')]=qs[_0x96fe('0x37')](_[_0x96fe('0x3f')](_0x2f654e[_0x96fe('0x35')],_0x322815[_0x96fe('0x37')]),_0x4b6705);if(_0x2f654e[_0x96fe('0x35')][_0x96fe('0x40')]){_0x29e704[_0x96fe('0x3e')]=_[_0x96fe('0x41')](_0x29e704[_0x96fe('0x3e')],{'$or':_[_0x96fe('0x42')](_0x4b6705,function(_0x2e4e67){if(_0x2e4e67[_0x96fe('0x32')]!==_0x96fe('0x43')){var _0xda1638={};_0xda1638[_0x2e4e67[_0x96fe('0x2c')]]={'$like':'%'+_0x2f654e[_0x96fe('0x35')][_0x96fe('0x40')]+'%'};return _0xda1638;}})});}_0x29e704=_[_0x96fe('0x41')]({},_0x29e704,_0x2f654e[_0x96fe('0x44')]);var _0x193016={'where':_0x29e704['where']};return db[_0x96fe('0x2f')][_0x96fe('0x23')](_0x193016)['then'](function(_0x116516){_0x5a5513['count']=_0x116516;if(_0x2f654e[_0x96fe('0x35')][_0x96fe('0x45')]){_0x29e704[_0x96fe('0x46')]=[{'all':!![]}];}return db[_0x96fe('0x2f')][_0x96fe('0x47')](_0x29e704);})[_0x96fe('0x48')](function(_0x1e6336){_0x5a5513[_0x96fe('0x49')]=_0x1e6336;return _0x5a5513;})[_0x96fe('0x48')](respondWithFilteredResult(_0x2ffe32,_0x29e704))['catch'](handleError(_0x2ffe32,null));};exports['show']=function(_0x4aeb0a,_0x1be44a){var _0x415835={'raw':![],'where':{'id':_0x4aeb0a[_0x96fe('0x4a')]['id']}},_0x46984b={};_0x46984b[_0x96fe('0x34')]=_[_0x96fe('0x36')](db[_0x96fe('0x2f')][_0x96fe('0x30')]);_0x46984b['query']=_['keys'](_0x4aeb0a[_0x96fe('0x35')]);_0x46984b[_0x96fe('0x37')]=_[_0x96fe('0x38')](_0x46984b[_0x96fe('0x34')],_0x46984b[_0x96fe('0x35')]);_0x415835[_0x96fe('0x3a')]=_[_0x96fe('0x38')](_0x46984b[_0x96fe('0x34')],qs[_0x96fe('0x39')](_0x4aeb0a[_0x96fe('0x35')][_0x96fe('0x39')]));_0x415835['attributes']=_0x415835['attributes'][_0x96fe('0x3b')]?_0x415835[_0x96fe('0x3a')]:_0x46984b['model'];if(_0x4aeb0a['query'][_0x96fe('0x45')]){_0x415835[_0x96fe('0x46')]=[{'all':!![]}];}_0x415835=_[_0x96fe('0x41')]({},_0x415835,_0x4aeb0a[_0x96fe('0x44')]);return db[_0x96fe('0x2f')][_0x96fe('0x4b')](_0x415835)[_0x96fe('0x48')](handleEntityNotFound(_0x1be44a,null))['then'](respondWithResult(_0x1be44a,null))[_0x96fe('0x4c')](handleError(_0x1be44a,null));};exports[_0x96fe('0x4d')]=function(_0x2cc388,_0x97da82){return db[_0x96fe('0x2f')][_0x96fe('0x4d')](_0x2cc388[_0x96fe('0x4e')],{})[_0x96fe('0x48')](respondWithResult(_0x97da82,0xc9))[_0x96fe('0x4c')](handleError(_0x97da82,null));};exports['clone']=function(_0x265ecd,_0x4cec50){var _0x5d6ab3={'where':{'id':_0x265ecd[_0x96fe('0x4a')]['id']}},_0xf017a={};_0xf017a[_0x96fe('0x34')]=_[_0x96fe('0x36')](db[_0x96fe('0x2f')][_0x96fe('0x30')]);_0x5d6ab3['attributes']=_[_0x96fe('0x38')](_0xf017a[_0x96fe('0x34')],qs[_0x96fe('0x39')](_0x265ecd[_0x96fe('0x35')][_0x96fe('0x39')]));_0x5d6ab3[_0x96fe('0x3a')]=_0x5d6ab3[_0x96fe('0x3a')][_0x96fe('0x3b')]?_0x5d6ab3[_0x96fe('0x3a')]:_0xf017a[_0x96fe('0x34')];if(_0x265ecd[_0x96fe('0x35')][_0x96fe('0x45')]){_0x5d6ab3[_0x96fe('0x46')]=[{'all':!![]}];}_0x5d6ab3=_[_0x96fe('0x41')]({},_0x5d6ab3,_0x265ecd[_0x96fe('0x44')]);return db['UserProfile'][_0x96fe('0x4b')](_0x5d6ab3)[_0x96fe('0x48')](handleEntityNotFound(_0x4cec50,null))[_0x96fe('0x48')](function(_0x5a5b8a){if(_0x5a5b8a){var _0x470f1e=_0x5a5b8a[_0x96fe('0x4f')]({'plain':!![]});_0x470f1e=qs['omit'](_0x470f1e,['id',_0x96fe('0x50'),'updatedAt',_0x96fe('0x51')]);_0x265ecd['body']=_['omit'](_0x265ecd[_0x96fe('0x4e')],['id',_0x96fe('0x50'),_0x96fe('0x52')]);return db[_0x96fe('0x53')][_0x96fe('0x54')](function(_0x16929f){return db['UserProfile']['create'](_[_0x96fe('0x41')](_0x470f1e,_0x265ecd[_0x96fe('0x4e')]),{'include':_0x265ecd['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x16929f})[_0x96fe('0x48')](function(_0x2aa89e){var _0x46cb79=_0x2aa89e[_0x96fe('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0x96fe('0x47')]({'where':{'userProfileId':_0x265ecd[_0x96fe('0x4a')]['id']},'raw':!![]})[_0x96fe('0x48')](function(_0x29698e){if(_0x29698e){return BPromise[_0x96fe('0x55')](_0x29698e,function(_0x27d6d7){return new BPromise(function(_0x5e315f,_0x395ea9){if(_0x27d6d7[_0x96fe('0x56')]===null||_0x27d6d7[_0x96fe('0x56')]===0x1)_0x5e315f(null);return db[_0x96fe('0x57')][_0x96fe('0x47')]({'where':{'sectionId':_0x27d6d7['id']},'raw':!![]})[_0x96fe('0x48')](function(_0x589db0){var _0x5e2e14=_['map'](_0x589db0,function(_0x359732){return qs[_0x96fe('0x58')](_0x359732,['id','createdAt',_0x96fe('0x52'),_0x96fe('0x59')]);});_0x5e315f(_0x5e2e14);})[_0x96fe('0x4c')](function(_0x441c39){_0x395ea9(_0x441c39);});})[_0x96fe('0x48')](function(_0x4c2669){var _0x41b0a3=qs[_0x96fe('0x58')](_0x27d6d7,['id',_0x96fe('0x50'),_0x96fe('0x52')]);_0x41b0a3['userProfileId']=_0x46cb79['id'];if(_0x4c2669)_0x41b0a3[_0x96fe('0x5a')]=_0x4c2669;return _0x41b0a3;})[_0x96fe('0x48')](function(_0x14fac7){return db[_0x96fe('0x5b')]['create'](_0x14fac7,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x16929f});});})[_0x96fe('0x48')](function(){return _0x46cb79;});}});});});}})[_0x96fe('0x48')](respondWithResult(_0x4cec50,0xc9))[_0x96fe('0x4c')](handleError(_0x4cec50,null));};exports[_0x96fe('0x29')]=function(_0x34ad7e,_0x140236){if(_0x34ad7e[_0x96fe('0x4e')]['id']){delete _0x34ad7e[_0x96fe('0x4e')]['id'];}return db[_0x96fe('0x2f')][_0x96fe('0x4b')]({'where':{'id':_0x34ad7e[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](handleEntityNotFound(_0x140236,null))['then'](saveUpdates(_0x34ad7e['body'],null))[_0x96fe('0x48')](respondWithResult(_0x140236,null))[_0x96fe('0x4c')](handleError(_0x140236,null));};exports[_0x96fe('0x5c')]=function(_0x140eb8,_0x5c0770){return db['UserProfile']['find']({'where':{'id':_0x140eb8[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](handleEntityNotFound(_0x5c0770,null))[_0x96fe('0x48')](removeEntity(_0x5c0770,null))[_0x96fe('0x4c')](handleError(_0x5c0770,null));};exports[_0x96fe('0x5d')]=function(_0x327e58,_0x5efe00){return db[_0x96fe('0x2f')][_0x96fe('0x5d')]()[_0x96fe('0x48')](respondWithResult(_0x5efe00,null))[_0x96fe('0x4c')](handleError(_0x5efe00,null));};exports[_0x96fe('0x5e')]=function(_0x287983,_0x108588){var _0x3aa792=_0x287983['body'];return db[_0x96fe('0x2f')][_0x96fe('0x4b')]({'where':{'id':_0x287983[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](handleEntityNotFound(_0x108588,null))[_0x96fe('0x48')](function(_0x32eb71){if(_0x32eb71){return db[_0x96fe('0x53')][_0x96fe('0x54')](function(_0x1ab4e1){return db[_0x96fe('0x5b')]['destroy']({'where':{'userProfileId':_0x287983[_0x96fe('0x4a')]['id'],'sectionId':_[_0x96fe('0x42')](_0x3aa792,function(_0x2e4753){return _0x2e4753[_0x96fe('0x59')];})},'transaction':_0x1ab4e1})['then'](function(){var _0x82b853=_[_0x96fe('0x42')](_0x3aa792,function(_0x314665){_0x314665[_0x96fe('0x5f')]=_0x287983[_0x96fe('0x4a')]['id'];return _0x314665;});var _0xee9eb0=[];return BPromise[_0x96fe('0x55')](_0x82b853,function(_0x2eee33){return db['UserProfileSection']['create'](_0x2eee33,{'include':[{'model':db[_0x96fe('0x57')],'as':_0x96fe('0x5a')}],'raw':!![],'transaction':_0x1ab4e1})['then'](function(_0x29b740){_0xee9eb0[_0x96fe('0x60')](_0x29b740['get']({'plain':!![]}));});})[_0x96fe('0x48')](function(){return _0xee9eb0;});});});}})[_0x96fe('0x48')](function(_0x3f8950){return _0x3f8950;})[_0x96fe('0x48')](respondWithResult(_0x108588,null))['catch'](handleError(_0x108588,null));};exports[_0x96fe('0x61')]=function(_0x5135d7,_0x142f6e){var _0x4213a9;return db[_0x96fe('0x2f')][_0x96fe('0x4b')]({'where':{'id':_0x5135d7[_0x96fe('0x4a')]['id']},'attributes':['id',_0x96fe('0x2c')]})['then'](handleEntityNotFound(_0x142f6e,null))[_0x96fe('0x48')](function(_0x7c82f4){if(_0x7c82f4){_0x4213a9=_0x7c82f4;return db[_0x96fe('0x5b')][_0x96fe('0x5c')]({'where':{'userProfileId':_0x5135d7[_0x96fe('0x4a')]['id'],'sectionId':_0x5135d7['query']['ids']}});}})['then'](function(){return _0x4213a9;})[_0x96fe('0x48')](respondWithStatusCode(_0x142f6e,null))[_0x96fe('0x4c')](handleError(_0x142f6e,null));};exports[_0x96fe('0x62')]=function(_0x53294d,_0x4257a0){var _0x2dfaa2=[];var _0x2adfe9=[];return db[_0x96fe('0x5b')]['findAll']({'where':{'userProfileId':_0x53294d[_0x96fe('0x4a')]['id']},'raw':!![]})[_0x96fe('0x48')](function(_0x2e65be){_0x2dfaa2=_[_0x96fe('0x40')](_0x2e65be,function(_0x4f91c6){return _0x4f91c6['enabled']===0x1||_['includes']([0x3eb,0x709],_0x4f91c6[_0x96fe('0x59')]);});if(!_[_0x96fe('0x63')](_0x2dfaa2)){return _[_0x96fe('0x42')](_0x2dfaa2,function(_0x554052){return _0x554052[_0x96fe('0x59')];});}else{return;}})[_0x96fe('0x48')](function(_0x498ac6){if(_0x498ac6)_0x2adfe9=_0x498ac6;if(_[_0x96fe('0x64')](_0x2adfe9,0x64)){var _0x17cf86=_[_0x96fe('0x4b')](_0x2dfaa2,{'sectionId':0x64});return hasDefaultDashboard(_0x17cf86)[_0x96fe('0x48')](function(_0x4384c3){return _[_0x96fe('0x42')](_0x2dfaa2,function(_0x57de55){if(_0x57de55[_0x96fe('0x59')]===0x64){_0x57de55[_0x96fe('0x65')]=_0x4384c3;}return _0x57de55;});});}else{return;}})['then'](function(_0x27a119){if(_0x27a119)_0x2dfaa2=_0x27a119;if(_['includes'](_0x2adfe9,0x3eb)){var _0x2f7d25=_[_0x96fe('0x4b')](_0x2dfaa2,{'sectionId':0x3eb});return getCustomDashboards(_0x2f7d25)[_0x96fe('0x48')](function(_0x8d014c){return _['map'](_0x2dfaa2,function(_0x305bac){if(_0x2f7d25[_0x96fe('0x66')]){if(_0x305bac[_0x96fe('0x59')]===0x3eb){_0x305bac[_0x96fe('0x65')]=_0x8d014c;}}else{if(_0x305bac['sectionId']===0x64){if(!_0x305bac[_0x96fe('0x65')]){_0x305bac['subsections']=[];}_0x305bac[_0x96fe('0x65')]=_0x305bac[_0x96fe('0x65')][_0x96fe('0x67')](_0x8d014c);}}return _0x305bac;});});}else{return;}})[_0x96fe('0x48')](function(_0x273ce0){if(_0x273ce0)_0x2dfaa2=_0x273ce0;if(_[_0x96fe('0x64')](_0x2adfe9,0x709)){var _0x3fbf1d=_[_0x96fe('0x4b')](_0x2dfaa2,{'sectionId':0x709});return getPlugins(_0x3fbf1d)[_0x96fe('0x48')](function(_0x4bdfaf){if(_0x3fbf1d['enabled']){return _[_0x96fe('0x42')](_0x2dfaa2,function(_0x48b5f7){if(_0x48b5f7['sectionId']===0x709){_0x48b5f7[_0x96fe('0x65')]=_0x4bdfaf;}return _0x48b5f7;});}else{var _0x52c7d9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4bdfaf};var _0x42daeb=_[_0x96fe('0x42')](_0x2dfaa2);_0x42daeb[_0x96fe('0x60')](_0x52c7d9);return _0x42daeb;}});}else{return;}})[_0x96fe('0x48')](function(_0x4e7923){if(_0x4e7923)_0x2dfaa2=_0x4e7923;return _['filter'](_0x2dfaa2,['enabled',0x1]);})[_0x96fe('0x48')](respondWithResult(_0x4257a0,null))[_0x96fe('0x4c')](handleError(_0x4257a0,null));};function hasDefaultDashboard(_0x2d2d47){var _0xaa8dbf=[0x65];return new BPromise(function(_0x13408a,_0xfcfcf3){try{if(_0x2d2d47[_0x96fe('0x56')]){_0x13408a(_0xaa8dbf);}else{return db[_0x96fe('0x57')][_0x96fe('0x68')]({'where':{'sectionId':_0x2d2d47['id']},'raw':!![]})['then'](function(_0x4f712c){_0x4f712c?_0x13408a(_0xaa8dbf):_0x13408a();});}}catch(_0x9a45a8){_0xfcfcf3(_0x9a45a8);}});}function getCustomDashboards(_0x4cae43){var _0x33a5b9=[];return new BPromise(function(_0x2454ff,_0x58061d){try{if(_0x4cae43[_0x96fe('0x56')]){return db[_0x96fe('0x69')][_0x96fe('0x47')]({'raw':!![]})[_0x96fe('0x48')](function(_0x3938f4){_0x3938f4[_0x96fe('0x6a')](function(_0x10bf61){_0x33a5b9[_0x96fe('0x60')](_0x10bf61['id']+0x1869f);});_0x2454ff(_0x33a5b9);});}else{return db['UserProfileResource'][_0x96fe('0x47')]({'where':{'sectionId':_0x4cae43['id']},'raw':!![]})[_0x96fe('0x48')](function(_0x4073c0){_0x4073c0['forEach'](function(_0x50c2d1){_0x33a5b9['push'](_0x50c2d1['resourceId']+0x1869f);});_0x2454ff(_0x33a5b9);});}}catch(_0x33bae2){_0x58061d(_0x33bae2);}});}function getPlugins(_0x1bf8c6){var _0x5c633e=[];return new BPromise(function(_0x5ed8bd,_0x5d1d43){try{if(_0x1bf8c6[_0x96fe('0x56')]){return db[_0x96fe('0x6b')]['findAll']({'raw':!![]})[_0x96fe('0x48')](function(_0x16c7eb){_0x16c7eb[_0x96fe('0x6a')](function(_0x17baff){_0x5c633e[_0x96fe('0x60')](_0x17baff['id']+0x15b38);});_0x5ed8bd(_0x5c633e);});}else{return db[_0x96fe('0x57')][_0x96fe('0x47')]({'where':{'sectionId':_0x1bf8c6['id']},'raw':!![]})['then'](function(_0x5a8d0f){_0x5a8d0f[_0x96fe('0x6a')](function(_0x9dd223){_0x5c633e[_0x96fe('0x60')](_0x9dd223['resourceId']+0x15b38);});_0x5ed8bd(_0x5c633e);});}}catch(_0x5492f8){_0x5d1d43(_0x5492f8);}});}exports['addResources']=function(_0x9cd6c,_0x1db3dd){return db[_0x96fe('0x2f')]['find']({'where':{'id':_0x9cd6c[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](handleEntityNotFound(_0x1db3dd,null))['then'](function(_0x380c69){if(_0x380c69){return db[_0x96fe('0x53')][_0x96fe('0x54')](function(_0x242357){return db['UserProfileSection'][_0x96fe('0x47')]({'where':{'userProfileId':_0x9cd6c[_0x96fe('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x96fe('0x48')](function(_0x2a27f4){if(_0x2a27f4){return db[_0x96fe('0x5b')][_0x96fe('0x5c')]({'where':{'userProfileId':_0x9cd6c['params']['id'],'id':_[_0x96fe('0x42')](_0x2a27f4,function(_0x24ef33){return _0x24ef33['id'];})},'transaction':_0x242357});}})['then'](function(_0x9dc38e){var _0xd1bc5a=_[_0x96fe('0x42')](_0x9cd6c[_0x96fe('0x4e')],function(_0x555c54){_0x555c54['userProfileId']=_0x9cd6c[_0x96fe('0x4a')]['id'];return _0x555c54;});return db[_0x96fe('0x5b')][_0x96fe('0x6c')](_0xd1bc5a,{'raw':!![],'transaction':_0x242357});})[_0x96fe('0x48')](function(_0x48e14a){var _0x1807ca=_['filter'](_[_0x96fe('0x42')](_0x48e14a,function(_0x4ef683){return _0x4ef683[_0x96fe('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1807ca){return db[_0x96fe('0x5b')][_0x96fe('0x47')]({'where':{'userProfileId':_0x9cd6c[_0x96fe('0x4a')]['id'],'sectionId':_[_0x96fe('0x42')](_0x1807ca,function(_0x1d46d4){return _0x1d46d4[_0x96fe('0x59')];})},'attributes':['id',_0x96fe('0x59')],'raw':!![]})[_0x96fe('0x48')](function(_0x119a4c){var _0x553646=_[_0x96fe('0x42')](_0x9cd6c[_0x96fe('0x4e')],function(_0x5392c0){_0x5392c0[_0x96fe('0x5f')]=_0x9cd6c[_0x96fe('0x4a')]['id'];return _0x5392c0;});return db['UserProfileResource'][_0x96fe('0x6c')](_0x553646,{'raw':!![],'transaction':_0x242357});});}})[_0x96fe('0x4c')](handleError(_0x1db3dd,null));});}})[_0x96fe('0x48')](function(_0x59803f){var _0x4672d3=_['map'](_0x59803f,function(_0x345a29){return _0x345a29['get']({'plain':!![]});});})[_0x96fe('0x48')](respondWithResult(_0x1db3dd,null))['catch'](handleError(_0x1db3dd,null));};exports[_0x96fe('0x6d')]=function(_0x2c3993,_0xec83fd,_0x1ca995){return db['UserProfile']['find']({'where':{'id':_0x2c3993[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](handleEntityNotFound(_0xec83fd,null))[_0x96fe('0x48')](function(_0xb43e11){if(_0xb43e11){return _0xb43e11[_0x96fe('0x6d')](_0x2c3993[_0x96fe('0x35')][_0x96fe('0x6e')]);}})[_0x96fe('0x48')](respondWithStatusCode(_0xec83fd,null))[_0x96fe('0x4c')](handleError(_0xec83fd,null));};exports[_0x96fe('0x6f')]=function(_0x367f69,_0x898ad1){var _0x34ede7={};if(!_0x367f69[_0x96fe('0x35')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x367f69[_0x96fe('0x35')][_0x96fe('0x3c')](_0x96fe('0x70'))){_0x34ede7[_0x96fe('0x22')]=qs[_0x96fe('0x22')](_0x367f69['query'][_0x96fe('0x22')]);_0x34ede7[_0x96fe('0x20')]=qs[_0x96fe('0x20')](_0x367f69[_0x96fe('0x35')][_0x96fe('0x20')]);}return db[_0x96fe('0x2f')][_0x96fe('0x4b')]({'where':{'id':_0x367f69[_0x96fe('0x4a')]['id']}})[_0x96fe('0x48')](function(_0x3198f7){if(!_0x3198f7)throw new Error(_0x96fe('0x71')+_0x367f69[_0x96fe('0x4a')]['id']);return db[_0x96fe('0x2f')][_0x96fe('0x6f')](_0x367f69);})[_0x96fe('0x48')](respondWithFilteredResult(_0x898ad1,_0x34ede7))[_0x96fe('0x4c')](handleError(_0x898ad1,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 79959eb..9e84ca4 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 _0x5fab=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0xc9c555,_0x5d8de7){var _0x5109d9=function(_0x2f5a9d){while(--_0x2f5a9d){_0xc9c555['push'](_0xc9c555['shift']());}};_0x5109d9(++_0x5d8de7);}(_0x5fab,0x177));var _0xb5fa=function(_0x4671a5,_0x1db5f4){_0x4671a5=_0x4671a5-0x0;var _0x12f1ac=_0x5fab[_0x4671a5];return _0x12f1ac;};'use strict';var EventEmitter=require(_0xb5fa('0x0'));var UserProfile=require(_0xb5fa('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb5fa('0x2')](0x0);var events={'afterCreate':_0xb5fa('0x3'),'afterUpdate':_0xb5fa('0x4'),'afterDestroy':_0xb5fa('0x5')};function emitEvent(_0x67e8e8){return function(_0x595d8b,_0x29390a,_0x4341d3){UserProfileEvents[_0xb5fa('0x6')](_0x67e8e8+':'+_0x595d8b['id'],_0x595d8b);UserProfileEvents[_0xb5fa('0x6')](_0x67e8e8,_0x595d8b);_0x4341d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb5fa('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x27a0=['hook','exports','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xdf5df0,_0x3b2f7b){var _0x41285e=function(_0x21e533){while(--_0x21e533){_0xdf5df0['push'](_0xdf5df0['shift']());}};_0x41285e(++_0x3b2f7b);}(_0x27a0,0xbf));var _0x027a=function(_0x137d29,_0x368001){_0x137d29=_0x137d29-0x0;var _0x7190b4=_0x27a0[_0x137d29];return _0x7190b4;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x027a('0x0'))['db'][_0x027a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x027a('0x2')](0x0);var events={'afterCreate':_0x027a('0x3'),'afterUpdate':_0x027a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58a58b){return function(_0x4e8d6b,_0x47cd65,_0x30a54d){UserProfileEvents[_0x027a('0x5')](_0x58a58b+':'+_0x4e8d6b['id'],_0x4e8d6b);UserProfileEvents[_0x027a('0x5')](_0x58a58b,_0x4e8d6b);_0x30a54d(null);};}for(var e in events){if(events[_0x027a('0x6')](e)){var event=events[e];UserProfile[_0x027a('0x7')](e,emitEvent(event));}}module[_0x027a('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 6163d25..f69db23 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 _0xc7ba=['params','all','ignore','union','length','autoAssociation','push','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','VIRTUAL','foreignKey','forEach','merge','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareRecording','parentSections','projectName','projects','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','reportId','toUpperCase','slice','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','find'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc7ba,0x1b1));var _0xac7b=function(_0x1da907,_0x44795f){_0x1da907=_0x1da907-0x0;var _0x4c9cca=_0xc7ba[_0x1da907];return _0x4c9cca;};'use strict';var _=require(_0xac7b('0x0'));var attributes=require(_0xac7b('0x1'));var squel=require(_0xac7b('0x2'));module[_0xac7b('0x3')]=function(_0x3a4ea3){var _0x1671d7=_0x3a4ea3[_0xac7b('0x4')];function _0x7f656d(_0x21367a,_0xe72920){return new Promise(function(_0xf0073e,_0x2fb273){if(!_0xe72920)return _0xf0073e(null);var _0x2e02c2=_0xe72920[_0xac7b('0x5')]?{[_0xe72920['filter'][_0xac7b('0x6')]]:_0xe72920[_0xac7b('0x5')][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x21367a]['findAll']({'where':_0x2e02c2,'raw':!![]})[_0xac7b('0x8')](function(_0x52452f){_0xe72920[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x52452f,'id');_0xf0073e(_0xe72920);})['catch'](function(_0xce0e3d){_0x2fb273(_0xce0e3d);});});}function _0x24e696(_0x1591a1,_0x13617e){return new Promise(function(_0x5662b2,_0x1dc9a5){var _0x3e68d7=_0x1591a1[_0xac7b('0x5')]?{[_0x1591a1['filter']['field']]:_0x1591a1['filter'][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x1591a1[_0xac7b('0xb')]][_0xac7b('0xc')]({'where':_0x3e68d7,'raw':!![]})[_0xac7b('0x8')](function(_0x3304aa){_0x13617e[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x3304aa,function(_0x160dcc){return _0x160dcc[_0xac7b('0xd')];});_0x5662b2(_0x13617e);})[_0xac7b('0xe')](function(_0x39087f){_0x1dc9a5(_0x39087f);});});}function _0x4373c1(_0xa742cd,_0x250006,_0x3fc6a9){if(!_0x250006)return Promise[_0xac7b('0xf')](null);return new Promise(function(_0x58e185,_0xd47e99){return _0x1671d7[_0xac7b('0x10')][_0xac7b('0xc')]({'where':{'sectionId':_0x250006['id']},'raw':!![]})[_0xac7b('0x8')](function(_0x15508d){if(_0xa742cd[_0xac7b('0x6')]&&_0xa742cd['field']!=='id'){_0x250006[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x15508d,function(_0x38e206){return _0x38e206[_0xa742cd[_0xac7b('0x6')]];});}else{if(_0x3fc6a9==='AnalyticExtractedReport'){_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x257101){return{'id':_0x257101[_0xac7b('0x11')],'type':_0x257101[_0xac7b('0x12')]};});}else{_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x236866){return _0x236866[_0xac7b('0x11')];});}}_0x58e185(_0x250006);})[_0xac7b('0xe')](function(_0x383a43){_0xd47e99(_0x383a43);});});}function _0x50d370(_0xf0a6c5,_0x578ba9){var _0x54769b={'parentSections':[]};switch(_0xf0a6c5[_0xac7b('0x13')]()){case _0xac7b('0x14'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x16');break;case'odbc':_0x54769b[_0xac7b('0x15')]='SquareOdbc';break;case'squarerecordings':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x17');_0x54769b[_0xac7b('0x18')]=[{'name':'SquareProjects','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x19')}];break;case _0xac7b('0x1a'):_0x54769b[_0xac7b('0x15')]='JscriptyProject';break;case'contacts':_0x54769b[_0xac7b('0x15')]='CmContact';_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x1b'),'field':'id','foreignKey':_0xac7b('0x1c')}];break;case _0xac7b('0x1d'):_0x54769b[_0xac7b('0x15')]='CmList';break;case _0xac7b('0x1e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x1f');break;case'globalcustomfields':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x20');break;case _0xac7b('0x21'):_0x54769b[_0xac7b('0x15')]='ChatQueue';break;case'chatwebsites':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x22');break;case _0xac7b('0x23'):_0x54769b['childModel']=_0xac7b('0x24');break;case _0xac7b('0x25'):_0x54769b['childModel']=_0xac7b('0x26');break;case'inboundroutes':case _0xac7b('0x27'):case _0xac7b('0x28'):_0x54769b[_0xac7b('0x15')]='VoiceExtension';break;case'contexts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x29');break;case'voicemails':_0x54769b['childModel']=_0xac7b('0x2a');break;case _0xac7b('0x2b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2c');_0x54769b[_0xac7b('0x18')]=[{'name':'Agents','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x30')]}},{'name':_0xac7b('0x31'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x32')]}},{'name':_0xac7b('0x33'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x34'),'model':'VoiceQueue','filter':{'field':_0xac7b('0x12'),'value':[_0xac7b('0x35')]}},{'name':_0xac7b('0x36'),'field':'name','foreignKey':_0xac7b('0x34'),'model':_0xac7b('0x37'),'filter':{'field':'type','value':[_0xac7b('0x38')]}}];break;case _0xac7b('0x39'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3a');break;case _0xac7b('0x3b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3c');break;case _0xac7b('0x3d'):_0x54769b['childModel']=_0xac7b('0x3e');break;case'ivrcampaigns':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3f');break;case _0xac7b('0x40'):_0x54769b['childModel']=_0xac7b('0x41');break;case _0xac7b('0x42'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x43');break;case _0xac7b('0x44'):_0x54769b['childModel']=_0xac7b('0x45');break;case _0xac7b('0x46'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x47');break;case _0xac7b('0x48'):_0x54769b['childModel']=_0xac7b('0x49');break;case _0xac7b('0x4a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4b');break;case'smsaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4c');break;case'whatsappqueues':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4d');break;case _0xac7b('0x4e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4f');break;case _0xac7b('0x50'):_0x54769b['childModel']=_0xac7b('0x51');break;case _0xac7b('0x52'):case _0xac7b('0x53'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x37');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':'VoiceQueues'},{'name':_0xac7b('0x36')}];}break;case _0xac7b('0x54'):case _0xac7b('0x55'):case _0xac7b('0x56'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x57'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x58'),_0xac7b('0x59')]},'ignore':!![]},{'name':_0xac7b('0x5a')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x54769b['childModel']=_0xac7b('0x5b');break;case _0xac7b('0x5c'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5d');break;case _0xac7b('0x5e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5f');break;case'sugarcrmaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x60');break;case _0xac7b('0x61'):_0x54769b['childModel']='DeskAccount';break;case _0xac7b('0x62'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x63');break;case _0xac7b('0x64'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');break;case _0xac7b('0x65'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x66');break;case _0xac7b('0x67'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x68');break;case _0xac7b('0x69'):_0x54769b['childModel']=_0xac7b('0x6a');break;case'intervals':_0x54769b['childModel']=_0xac7b('0x6b');break;case'pauses':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6c');break;case _0xac7b('0x6d'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6e');break;case _0xac7b('0x6f'):_0x54769b['childModel']='Sound';break;case _0xac7b('0x70'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x71');break;case _0xac7b('0x72'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x73');break;case _0xac7b('0x74'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x75');break;case _0xac7b('0x76'):_0x54769b['childModel']=_0xac7b('0x77');break;case'variables':_0x54769b['childModel']=_0xac7b('0x78');break;case'plugins':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x79');break;case _0xac7b('0x7a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x7b');_0x54769b[_0xac7b('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xac7b('0x7c')}];break;case'metrics':_0x54769b['childModel']='AnalyticMetric';break;}return _0x54769b;}function _0x616678(_0x35a45e,_0x3a40a9){var _0x40ff6c=_0x35a45e['charAt'](0x0)[_0xac7b('0x7d')]()+_0x35a45e[_0xac7b('0x7e')](0x1);var _0x2f1448={'type':_0x1671d7['Sequelize'][_0xac7b('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x3ede66,_0x366a1a){var _0x4392fa=squel['select']()[_0xac7b('0x6')](_0xac7b('0x80')+_0x40ff6c+_0xac7b('0x81'),'id')[_0xac7b('0x6')](_0xac7b('0x82'))[_0xac7b('0x83')](_0xac7b('0x84')+_0x35a45e+'_interactions','ui')[_0xac7b('0x85')](_0xac7b('0x86'),_0x3a40a9['id']);return _0x1671d7['sequelize']['query'](_0x4392fa[_0xac7b('0x87')](),_0x2f1448)[_0xac7b('0x8')](function(_0x483312){_0x3a40a9[_0x40ff6c+_0xac7b('0x88')]=_0x483312;_0x3ede66(_0x483312);})['catch'](function(_0x5ee276){_0x366a1a(_0x5ee276);});});}return _0x3a4ea3[_0xac7b('0x89')]('UserProfile',attributes,{'tableName':_0xac7b('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2145e8){var _0x77afa3=require(_0xac7b('0x8b'));var _0x29d341={'raw':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8d')],'where':{}};var _0x231b7f={};var _0x37969f={'count':0x0,'rows':[]};var _0x21842d=_0x2145e8[_0xac7b('0x8c')]['section'];var _0x303945=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8e')]||![];var _0x5c7873=_0x50d370(_0x21842d,_0x303945);if(!_0x5c7873[_0xac7b('0x15')])throw new Error(_0xac7b('0x8f')+_0x21842d+'\x27');var _0x21d17d=[{'name':_0x21842d}];if(!_[_0xac7b('0x90')](_0x5c7873[_0xac7b('0x18')]))_0x21d17d=_0x5c7873[_0xac7b('0x18')];var _0x1337fe=[];for(var _0x3aee0d=0x0;_0x3aee0d<_0x21d17d['length'];_0x3aee0d++){_0x1337fe['push'](_0x1671d7['UserProfileSection'][_0xac7b('0x91')]({'where':{'userProfileId':_0x2145e8[_0xac7b('0x92')]['id'],'name':_0x21d17d[_0x3aee0d][_0xac7b('0xd')]},'raw':!![]}));}return Promise[_0xac7b('0x93')](_0x1337fe)[_0xac7b('0x8')](function(_0x3ee4f0){var _0x427c63=_['filter'](_0x3ee4f0,function(_0x504a59){return _0x504a59?_0x504a59:undefined;});var _0x29d74d=_[_0xac7b('0x5')](_0x21d17d,[_0xac7b('0x94'),!![]]);var _0x1c0a03=_['isEmpty'](_0x427c63)&&_[_0xac7b('0x90')](_0x29d74d)?null:_[_0xac7b('0x95')](_0x29d74d,_0x427c63);if(!_0x1c0a03)return null;var _0xca6e30=[];for(var _0x1dda09=0x0;_0x1dda09<_0x1c0a03[_0xac7b('0x96')];_0x1dda09++){var _0x14f5e3=_[_0xac7b('0x91')](_0x21d17d,function(_0x3849e6){return _0x1c0a03[_0x1dda09]?_0x3849e6[_0xac7b('0xd')]===_0x1c0a03[_0x1dda09][_0xac7b('0xd')]:null;});if(_0x14f5e3){if(_0x1c0a03[_0x1dda09][_0xac7b('0x94')]){_0xca6e30['push'](_0x7f656d(_0x5c7873[_0xac7b('0x15')],_0x1c0a03[_0x1dda09]));}else{if(!_0x1c0a03[_0x1dda09][_0xac7b('0x97')]){_0xca6e30[_0xac7b('0x98')](_0x4373c1(_0x14f5e3,_0x1c0a03[_0x1dda09],_0x5c7873[_0xac7b('0x15')]));}else{if(_0x14f5e3[_0xac7b('0xb')]){_0xca6e30[_0xac7b('0x98')](_0x24e696(_0x14f5e3,_0x1c0a03[_0x1dda09]));}}}}}return Promise[_0xac7b('0x93')](_0xca6e30);})[_0xac7b('0x8')](function(_0x3219bf){var _0x734297=_0x3219bf;var _0x3e176c=null;if(_0x734297){_0x3e176c=_0x734297[_0xac7b('0x96')]===0x1?_0x734297[0x0]:null;}if(!_0x3e176c&&!_0x734297)return _0x37969f;var _0x1d1662=_0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0x99')];_0x231b7f['model']=_[_0xac7b('0x9a')](_0x1d1662);_0x231b7f[_0xac7b('0x8c')]=_['keys'](_0x2145e8[_0xac7b('0x8c')]);_0x231b7f[_0xac7b('0x9b')]=_[_0xac7b('0x9c')](_0x231b7f['model'],_0x231b7f[_0xac7b('0x8c')]);_0x29d341[_0xac7b('0x9d')]=_[_0xac7b('0x9c')](_0x231b7f[_0xac7b('0xb')],_0x77afa3[_0xac7b('0x9e')](_0x2145e8['query'][_0xac7b('0x9e')]));_0x29d341['attributes']=_0x29d341[_0xac7b('0x9d')][_0xac7b('0x96')]?_0x29d341[_0xac7b('0x9d')]:_0x231b7f['model'];if(!_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x9f')](_0xac7b('0xa0'))){_0x29d341['limit']=_0x77afa3[_0xac7b('0xa1')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa1')]);_0x29d341['offset']=_0x77afa3[_0xac7b('0xa2')](_0x2145e8['query'][_0xac7b('0xa2')]);}_0x29d341[_0xac7b('0xa3')]=_0x77afa3[_0xac7b('0xa4')](_0x2145e8[_0xac7b('0x8c')]['sort']);_0x29d341[_0xac7b('0x85')]=_0x77afa3['filters'](_['pick'](_0x2145e8[_0xac7b('0x8c')],_0x231b7f[_0xac7b('0x9b')]));if(_0x2145e8[_0xac7b('0x8c')]['filter']){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$or':_[_0xac7b('0xa')](_0x1d1662,function(_0x92652e){if(_0x92652e['type']['key']!==_0xac7b('0xa5')){var _0x25d1a9={};_0x25d1a9[_0x92652e[_0xac7b('0x6')]]={'$like':'%'+_0x2145e8[_0xac7b('0x8c')]['filter']+'%'};return _0x25d1a9;}})});}var _0x2db8d2=[];var _0x520650=null;var _0x2d55e1={};if(_0x3e176c){_0x520650=_['find'](_0x21d17d,[_0xac7b('0xd'),_0x3e176c[_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0x7b')){_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_[_0xac7b('0xa')](_0x3e176c['associatedResources'],'id');}else{_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x3e176c['associatedResources'];}_0x2db8d2[_0xac7b('0x98')](_0x2d55e1);}else{_0x29d341[_0xac7b('0x85')]['id']=_0x3e176c[_0xac7b('0x9')];}}else{for(var _0x344b6f=0x0;_0x344b6f<_0x734297[_0xac7b('0x96')];_0x344b6f++){_0x520650=_[_0xac7b('0x91')](_0x21d17d,['name',_0x734297[_0x344b6f][_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x734297[_0x344b6f][_0xac7b('0x9')];_0x2db8d2['push'](_0x2d55e1);}else{if(!_0x29d341[_0xac7b('0x85')]['id'])_0x29d341[_0xac7b('0x85')]['id']=[];_0x734297[_0x344b6f][_0xac7b('0x9')][_0xac7b('0xa7')](function(_0x1ebd77){_0x29d341['where']['id']['push'](_0x1ebd77);});}}}if(!_['isEmpty'](_0x2db8d2)){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$and':{'$or':_0x2db8d2}});}_0x29d341=_[_0xac7b('0xa8')]({},_0x29d341,_0x2145e8['options']);if(_0x3e176c&&!_0x3e176c[_0xac7b('0x97')]&&_0x5c7873['childModel']===_0xac7b('0x7b')){if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa9')]){_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341)[_0xac7b('0x8')](function(_0x347061){var _0x360a78=[];_0x347061[_0xac7b('0xa7')](function(_0x8aca6){var _0x1b0013;switch(_0x8aca6[_0xac7b('0xab')]){case'default':_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x29380f){return _0x29380f['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x29380f[_0xac7b('0x12')]===_0xac7b('0xac');});break;case _0xac7b('0xad'):_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x473908){return _0x473908['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x473908[_0xac7b('0x12')]===_0xac7b('0xae');});break;}if(_0x1b0013)_0x360a78[_0xac7b('0x98')](_0x8aca6);});_0x37969f[_0xac7b('0xaf')]=_0x360a78[_0xac7b('0x96')];_0x37969f[_0xac7b('0xb0')]=_0x360a78;return _0x37969f;});}else{if(!_[_0xac7b('0x90')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')])){_0x29d341[_0xac7b('0x85')]['id']=_0x29d341['where']['id']?_[_0xac7b('0x9c')](_0x29d341['where']['id'],_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')]):_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')];if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')]){_0x29d341[_0xac7b('0xa3')]=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')];}}if(_0x2145e8[_0xac7b('0x8c')]['extraQueryConditions']){_0x29d341['where']=_[_0xac7b('0xa8')](_0x29d341[_0xac7b('0x85')],{'$and':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb3')]});}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]]['count']({'where':_0x29d341[_0xac7b('0x85')]})['then'](function(_0x423cec){_0x37969f[_0xac7b('0xaf')]=_0x423cec;if(_0x2145e8[_0xac7b('0x8c')]['includeAll']){if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0xb4')){_0x29d341['include']=[{'model':_0x1671d7['Tag'],'as':_0xac7b('0xb5'),'attributes':['id','name','color'],'required':_0x2145e8['query'][_0xac7b('0xb6')]?!![]:![]},{'model':_0x1671d7[_0xac7b('0x71')],'as':_0xac7b('0xb7'),'attributes':['id','name',_0xac7b('0xb8')],'through':_0x2145e8['query']['tag']?{'attributes':[],'where':{'TagId':_0x2145e8['query'][_0xac7b('0xb6')]||undefined}}:{},'required':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb6')]?!![]:![]}];}else{_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341);})['then'](function(_0x363633){_0x37969f[_0xac7b('0xb0')]=_0x363633;if(_0x21842d===_0xac7b('0x5a')&&_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb9')]===_0xac7b('0xba')){var _0x431240=[];for(var _0x27182f=0x0;_0x27182f<_0x37969f['rows'][_0xac7b('0x96')];_0x27182f++){_0x431240[_0xac7b('0x98')](_0x616678('chat',_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbc'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbd'),_0x37969f['rows'][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbe'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbf'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xc0'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));}return Promise[_0xac7b('0x93')](_0x431240)['then'](function(){return _0x37969f;});}return _0x37969f;});}});}}});}; \ No newline at end of file +var _0x1fa0=['openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','users','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','push','find','all','ignore','isEmpty','union','length','autoAssociation','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','forEach','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','color','Tag','ThroughTags','tag','include','openTabs','true','chat','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','value','findAll','then','associatedResources','field','map','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','name','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','agent','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue'];(function(_0x4f7603,_0x34d53d){var _0x199ad8=function(_0x1bf498){while(--_0x1bf498){_0x4f7603['push'](_0x4f7603['shift']());}};_0x199ad8(++_0x34d53d);}(_0x1fa0,0x133));var _0x01fa=function(_0x4face0,_0x186326){_0x4face0=_0x4face0-0x0;var _0x8d2401=_0x1fa0[_0x4face0];return _0x8d2401;};'use strict';var _=require(_0x01fa('0x0'));var attributes=require(_0x01fa('0x1'));var squel=require(_0x01fa('0x2'));module['exports']=function(_0x5d4993){var _0x5e69c1=_0x5d4993[_0x01fa('0x3')];function _0x2f2819(_0x370374,_0x348f88){return new Promise(function(_0x5ee2a3,_0x5dccd9){if(!_0x348f88)return _0x5ee2a3(null);var _0x2475fc=_0x348f88[_0x01fa('0x4')]?{[_0x348f88[_0x01fa('0x4')]['field']]:_0x348f88[_0x01fa('0x4')][_0x01fa('0x5')]}:undefined;return _0x5e69c1[_0x370374][_0x01fa('0x6')]({'where':_0x2475fc,'raw':!![]})[_0x01fa('0x7')](function(_0x5bab83){_0x348f88[_0x01fa('0x8')]=_['map'](_0x5bab83,'id');_0x5ee2a3(_0x348f88);})['catch'](function(_0x8ac6b9){_0x5dccd9(_0x8ac6b9);});});}function _0x3533aa(_0xcc25ac,_0x1ce734){return new Promise(function(_0x237e69,_0x475360){var _0x8375a4=_0xcc25ac[_0x01fa('0x4')]?{[_0xcc25ac[_0x01fa('0x4')][_0x01fa('0x9')]]:_0xcc25ac[_0x01fa('0x4')]['value']}:undefined;return _0x5e69c1[_0xcc25ac['model']]['findAll']({'where':_0x8375a4,'raw':!![]})[_0x01fa('0x7')](function(_0xa0ab80){_0x1ce734[_0x01fa('0x8')]=_[_0x01fa('0xa')](_0xa0ab80,function(_0x1a7b76){return _0x1a7b76['name'];});_0x237e69(_0x1ce734);})[_0x01fa('0xb')](function(_0x36d3c2){_0x475360(_0x36d3c2);});});}function _0x523441(_0x3f2666,_0x30ee21,_0x41ebc7){if(!_0x30ee21)return Promise[_0x01fa('0xc')](null);return new Promise(function(_0x783a55,_0x51f08e){return _0x5e69c1[_0x01fa('0xd')][_0x01fa('0x6')]({'where':{'sectionId':_0x30ee21['id']},'raw':!![]})[_0x01fa('0x7')](function(_0x4dc3cc){if(_0x3f2666[_0x01fa('0x9')]&&_0x3f2666[_0x01fa('0x9')]!=='id'){_0x30ee21[_0x01fa('0x8')]=_['map'](_0x4dc3cc,function(_0x95b6b2){return _0x95b6b2[_0x3f2666[_0x01fa('0x9')]];});}else{if(_0x41ebc7===_0x01fa('0xe')){_0x30ee21[_0x01fa('0x8')]=_['map'](_0x4dc3cc,function(_0x245b7c){return{'id':_0x245b7c[_0x01fa('0xf')],'type':_0x245b7c['type']};});}else{_0x30ee21['associatedResources']=_['map'](_0x4dc3cc,function(_0x31a360){return _0x31a360[_0x01fa('0xf')];});}}_0x783a55(_0x30ee21);})['catch'](function(_0x314b99){_0x51f08e(_0x314b99);});});}function _0x3dfe0a(_0x2e129b,_0x2d140d){var _0x2ebb3c={'parentSections':[]};switch(_0x2e129b[_0x01fa('0x10')]()){case _0x01fa('0x11'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x13');break;case'odbc':_0x2ebb3c[_0x01fa('0x12')]='SquareOdbc';break;case _0x01fa('0x14'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x15');_0x2ebb3c[_0x01fa('0x16')]=[{'name':'SquareProjects','field':_0x01fa('0x17'),'foreignKey':'projectName'}];break;case _0x01fa('0x18'):_0x2ebb3c['childModel']=_0x01fa('0x19');break;case _0x01fa('0x1a'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x1b');_0x2ebb3c['parentSections']=[{'name':_0x01fa('0x1c'),'field':'id','foreignKey':_0x01fa('0x1d')}];break;case _0x01fa('0x1e'):_0x2ebb3c['childModel']=_0x01fa('0x1f');break;case _0x01fa('0x20'):_0x2ebb3c['childModel']=_0x01fa('0x21');break;case'globalcustomfields':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x22');break;case _0x01fa('0x23'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x24');break;case _0x01fa('0x25'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x26');break;case _0x01fa('0x27'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x28');break;case _0x01fa('0x29'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x2a');break;case'inboundroutes':case'internalroutes':case _0x01fa('0x2b'):_0x2ebb3c[_0x01fa('0x12')]='VoiceExtension';break;case _0x01fa('0x2c'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x2d');break;case _0x01fa('0x2e'):_0x2ebb3c['childModel']=_0x01fa('0x2f');break;case'voicerecordings':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x30');_0x2ebb3c[_0x01fa('0x16')]=[{'name':'Agents','field':_0x01fa('0x17'),'foreignKey':_0x01fa('0x31'),'model':'User','filter':{'field':'role','value':[_0x01fa('0x32')]}},{'name':_0x01fa('0x33'),'field':_0x01fa('0x17'),'foreignKey':_0x01fa('0x31'),'model':_0x01fa('0x34'),'filter':{'field':_0x01fa('0x35'),'value':[_0x01fa('0x36')]}},{'name':_0x01fa('0x37'),'field':'name','foreignKey':_0x01fa('0x38'),'model':_0x01fa('0x39'),'filter':{'field':_0x01fa('0x3a'),'value':['inbound']}},{'name':_0x01fa('0x3b'),'field':_0x01fa('0x17'),'foreignKey':_0x01fa('0x38'),'model':_0x01fa('0x39'),'filter':{'field':_0x01fa('0x3a'),'value':[_0x01fa('0x3c')]}}];break;case'musiconholds':_0x2ebb3c['childModel']=_0x01fa('0x3d');break;case'chanspies':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x3e');break;case _0x01fa('0x3f'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x40');break;case _0x01fa('0x41'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x42');break;case _0x01fa('0x43'):_0x2ebb3c['childModel']=_0x01fa('0x44');break;case'mailaccounts':_0x2ebb3c['childModel']='MailAccount';break;case'mailsubstatuses':_0x2ebb3c[_0x01fa('0x12')]='MailSubstatus';break;case _0x01fa('0x45'):_0x2ebb3c[_0x01fa('0x12')]='OpenchannelQueue';break;case _0x01fa('0x46'):_0x2ebb3c['childModel']=_0x01fa('0x47');break;case _0x01fa('0x48'):_0x2ebb3c['childModel']='SmsQueue';break;case _0x01fa('0x49'):_0x2ebb3c['childModel']=_0x01fa('0x4a');break;case'whatsappqueues':_0x2ebb3c['childModel']=_0x01fa('0x4b');break;case'whatsappaccounts':_0x2ebb3c['childModel']=_0x01fa('0x4c');break;case _0x01fa('0x4d'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x4e');break;case'voicequeues':case _0x01fa('0x4f'):_0x2ebb3c[_0x01fa('0x12')]='VoiceQueue';if(_0x2d140d){_0x2ebb3c['parentSections']=[{'name':_0x01fa('0x37')},{'name':_0x01fa('0x3b')}];}break;case _0x01fa('0x50'):case'agents':case'telephones':_0x2ebb3c[_0x01fa('0x12')]='User';if(_0x2d140d){_0x2ebb3c[_0x01fa('0x16')]=[{'name':_0x01fa('0x51'),'filter':{'field':'role','value':[_0x01fa('0x52'),_0x01fa('0x53')]},'ignore':!![]},{'name':_0x01fa('0x54')},{'name':_0x01fa('0x33')}];}break;case _0x01fa('0x55'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x56');break;case _0x01fa('0x57'):_0x2ebb3c['childModel']='SalesforceAccount';break;case _0x01fa('0x58'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x59');break;case _0x01fa('0x5a'):_0x2ebb3c[_0x01fa('0x12')]='SugarcrmAccount';break;case _0x01fa('0x5b'):_0x2ebb3c['childModel']='DeskAccount';break;case _0x01fa('0x5c'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x5d');break;case _0x01fa('0x5e'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x34');break;case'cannedanswers':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x5f');break;case _0x01fa('0x60'):_0x2ebb3c['childModel']=_0x01fa('0x61');break;case _0x01fa('0x62'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x63');break;case'intervals':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x64');break;case'pauses':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x65');break;case _0x01fa('0x66'):_0x2ebb3c[_0x01fa('0x12')]='Schedule';break;case'sounds':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x67');break;case _0x01fa('0x68'):_0x2ebb3c[_0x01fa('0x12')]='Tag';break;case _0x01fa('0x69'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x6a');break;case _0x01fa('0x6b'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x6c');break;case _0x01fa('0x6d'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x6e');break;case _0x01fa('0x6f'):_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x70');break;case _0x01fa('0x71'):_0x2ebb3c['childModel']=_0x01fa('0x72');break;case'extractedreports':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0xe');_0x2ebb3c[_0x01fa('0x16')]=[{'name':_0x01fa('0x73'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x2ebb3c[_0x01fa('0x12')]=_0x01fa('0x74');break;}return _0x2ebb3c;}function _0x48c494(_0x1b3d07,_0x2fef12){var _0x28a525=_0x1b3d07[_0x01fa('0x75')](0x0)[_0x01fa('0x76')]()+_0x1b3d07['slice'](0x1);var _0x3b6a2f={'type':_0x5e69c1[_0x01fa('0x77')][_0x01fa('0x78')][_0x01fa('0x79')],'raw':!![]};return new Promise(function(_0x5b5850,_0xdf9354){var _0x1c3c6c=squel[_0x01fa('0x7a')]()[_0x01fa('0x9')](_0x01fa('0x7b')+_0x28a525+_0x01fa('0x7c'),'id')['field']('ui.createdAt')['from'](_0x01fa('0x7d')+_0x1b3d07+_0x01fa('0x7e'),'ui')[_0x01fa('0x7f')](_0x01fa('0x80'),_0x2fef12['id']);return _0x5e69c1['sequelize'][_0x01fa('0x81')](_0x1c3c6c[_0x01fa('0x82')](),_0x3b6a2f)[_0x01fa('0x7')](function(_0x338043){_0x2fef12[_0x28a525+_0x01fa('0x83')]=_0x338043;_0x5b5850(_0x338043);})[_0x01fa('0xb')](function(_0xd7dccb){_0xdf9354(_0xd7dccb);});});}return _0x5d4993[_0x01fa('0x84')](_0x01fa('0x85'),attributes,{'tableName':_0x01fa('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x273836){var _0x8f2fe4=require(_0x01fa('0x87'));var _0x3af5fe={'raw':_0x273836[_0x01fa('0x81')][_0x01fa('0x88')],'where':{}};var _0x260774={};var _0x57382b={'count':0x0,'rows':[]};var _0x49148d=_0x273836[_0x01fa('0x81')][_0x01fa('0x89')];var _0x5e6a35=_0x273836[_0x01fa('0x81')][_0x01fa('0x8a')]||![];var _0x4199d5=_0x3dfe0a(_0x49148d,_0x5e6a35);if(!_0x4199d5['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x49148d+'\x27');var _0x10ad58=[{'name':_0x49148d}];if(!_['isEmpty'](_0x4199d5[_0x01fa('0x16')]))_0x10ad58=_0x4199d5['parentSections'];var _0x57c569=[];for(var _0x440a2b=0x0;_0x440a2b<_0x10ad58['length'];_0x440a2b++){_0x57c569[_0x01fa('0x8b')](_0x5e69c1['UserProfileSection'][_0x01fa('0x8c')]({'where':{'userProfileId':_0x273836['params']['id'],'name':_0x10ad58[_0x440a2b]['name']},'raw':!![]}));}return Promise[_0x01fa('0x8d')](_0x57c569)['then'](function(_0x211372){var _0x2d5f25=_['filter'](_0x211372,function(_0x4027bb){return _0x4027bb?_0x4027bb:undefined;});var _0x108038=_['filter'](_0x10ad58,[_0x01fa('0x8e'),!![]]);var _0x462aa1=_[_0x01fa('0x8f')](_0x2d5f25)&&_['isEmpty'](_0x108038)?null:_[_0x01fa('0x90')](_0x108038,_0x2d5f25);if(!_0x462aa1)return null;var _0x1c7e9f=[];for(var _0x47294f=0x0;_0x47294f<_0x462aa1[_0x01fa('0x91')];_0x47294f++){var _0x52c4a3=_[_0x01fa('0x8c')](_0x10ad58,function(_0x15d0af){return _0x462aa1[_0x47294f]?_0x15d0af['name']===_0x462aa1[_0x47294f][_0x01fa('0x17')]:null;});if(_0x52c4a3){if(_0x462aa1[_0x47294f]['ignore']){_0x1c7e9f[_0x01fa('0x8b')](_0x2f2819(_0x4199d5[_0x01fa('0x12')],_0x462aa1[_0x47294f]));}else{if(!_0x462aa1[_0x47294f][_0x01fa('0x92')]){_0x1c7e9f[_0x01fa('0x8b')](_0x523441(_0x52c4a3,_0x462aa1[_0x47294f],_0x4199d5[_0x01fa('0x12')]));}else{if(_0x52c4a3['model']){_0x1c7e9f[_0x01fa('0x8b')](_0x3533aa(_0x52c4a3,_0x462aa1[_0x47294f]));}}}}}return Promise['all'](_0x1c7e9f);})[_0x01fa('0x7')](function(_0x4d1a64){var _0xf99a9=_0x4d1a64;var _0xd2412b=null;if(_0xf99a9){_0xd2412b=_0xf99a9['length']===0x1?_0xf99a9[0x0]:null;}if(!_0xd2412b&&!_0xf99a9)return _0x57382b;var _0x1175ef=_0x5e69c1[_0x4199d5[_0x01fa('0x12')]]['rawAttributes'];_0x260774['model']=_[_0x01fa('0x93')](_0x1175ef);_0x260774['query']=_[_0x01fa('0x93')](_0x273836[_0x01fa('0x81')]);_0x260774[_0x01fa('0x94')]=_[_0x01fa('0x95')](_0x260774['model'],_0x260774[_0x01fa('0x81')]);_0x3af5fe[_0x01fa('0x96')]=_[_0x01fa('0x95')](_0x260774[_0x01fa('0x97')],_0x8f2fe4[_0x01fa('0x98')](_0x273836[_0x01fa('0x81')][_0x01fa('0x98')]));_0x3af5fe[_0x01fa('0x96')]=_0x3af5fe[_0x01fa('0x96')][_0x01fa('0x91')]?_0x3af5fe['attributes']:_0x260774[_0x01fa('0x97')];if(!_0x273836[_0x01fa('0x81')][_0x01fa('0x99')](_0x01fa('0x9a'))){_0x3af5fe[_0x01fa('0x9b')]=_0x8f2fe4[_0x01fa('0x9b')](_0x273836[_0x01fa('0x81')]['limit']);_0x3af5fe[_0x01fa('0x9c')]=_0x8f2fe4['offset'](_0x273836['query'][_0x01fa('0x9c')]);}_0x3af5fe[_0x01fa('0x9d')]=_0x8f2fe4[_0x01fa('0x9e')](_0x273836[_0x01fa('0x81')][_0x01fa('0x9e')]);_0x3af5fe[_0x01fa('0x7f')]=_0x8f2fe4[_0x01fa('0x94')](_['pick'](_0x273836[_0x01fa('0x81')],_0x260774['filters']));if(_0x273836['query']['filter']){_0x3af5fe[_0x01fa('0x7f')]=_[_0x01fa('0x9f')](_0x3af5fe['where'],{'$or':_[_0x01fa('0xa')](_0x1175ef,function(_0x356f35){if(_0x356f35[_0x01fa('0x3a')][_0x01fa('0xa0')]!==_0x01fa('0xa1')){var _0x37f5b8={};_0x37f5b8[_0x356f35[_0x01fa('0x9')]]={'$like':'%'+_0x273836[_0x01fa('0x81')][_0x01fa('0x4')]+'%'};return _0x37f5b8;}})});}var _0x56b332=[];var _0x54da1f=null;var _0x3ebdf5={};if(_0xd2412b){_0x54da1f=_[_0x01fa('0x8c')](_0x10ad58,['name',_0xd2412b['name']]);if(_0x54da1f[_0x01fa('0x9')]){_0x3ebdf5={};if(_0x4199d5[_0x01fa('0x12')]==='AnalyticExtractedReport'){_0x3ebdf5[_0x54da1f['foreignKey']]=_[_0x01fa('0xa')](_0xd2412b['associatedResources'],'id');}else{_0x3ebdf5[_0x54da1f['foreignKey']]=_0xd2412b[_0x01fa('0x8')];}_0x56b332[_0x01fa('0x8b')](_0x3ebdf5);}else{_0x3af5fe[_0x01fa('0x7f')]['id']=_0xd2412b[_0x01fa('0x8')];}}else{for(var _0x3b28ed=0x0;_0x3b28ed<_0xf99a9[_0x01fa('0x91')];_0x3b28ed++){_0x54da1f=_[_0x01fa('0x8c')](_0x10ad58,[_0x01fa('0x17'),_0xf99a9[_0x3b28ed][_0x01fa('0x17')]]);if(_0x54da1f['field']){_0x3ebdf5={};_0x3ebdf5[_0x54da1f[_0x01fa('0xa2')]]=_0xf99a9[_0x3b28ed][_0x01fa('0x8')];_0x56b332[_0x01fa('0x8b')](_0x3ebdf5);}else{if(!_0x3af5fe[_0x01fa('0x7f')]['id'])_0x3af5fe['where']['id']=[];_0xf99a9[_0x3b28ed]['associatedResources']['forEach'](function(_0x5d7b71){_0x3af5fe['where']['id'][_0x01fa('0x8b')](_0x5d7b71);});}}}if(!_[_0x01fa('0x8f')](_0x56b332)){_0x3af5fe[_0x01fa('0x7f')]=_[_0x01fa('0x9f')](_0x3af5fe[_0x01fa('0x7f')],{'$and':{'$or':_0x56b332}});}_0x3af5fe=_[_0x01fa('0x9f')]({},_0x3af5fe,_0x273836[_0x01fa('0xa3')]);if(_0xd2412b&&!_0xd2412b['autoAssociation']&&_0x4199d5['childModel']===_0x01fa('0xe')){if(_0x273836[_0x01fa('0x81')][_0x01fa('0xa4')]){_0x3af5fe['include']=[{'all':!![]}];}return _0x5e69c1[_0x4199d5[_0x01fa('0x12')]][_0x01fa('0x6')](_0x3af5fe)['then'](function(_0xb66f01){var _0x2a9413=[];_0xb66f01[_0x01fa('0xa5')](function(_0x55e75a){var _0x52e12c;switch(_0x55e75a['reportType']){case _0x01fa('0xa6'):_0x52e12c=_[_0x01fa('0x8c')](_0xd2412b[_0x01fa('0x8')],function(_0xc287c1){return _0xc287c1['id']===_0x55e75a[_0x01fa('0xa7')]&&_0xc287c1[_0x01fa('0x3a')]===_0x01fa('0xa8');});break;case _0x01fa('0xa9'):_0x52e12c=_[_0x01fa('0x8c')](_0xd2412b[_0x01fa('0x8')],function(_0x138750){return _0x138750['id']===_0x55e75a[_0x01fa('0xa7')]&&_0x138750[_0x01fa('0x3a')]===_0x01fa('0xaa');});break;}if(_0x52e12c)_0x2a9413[_0x01fa('0x8b')](_0x55e75a);});_0x57382b['count']=_0x2a9413[_0x01fa('0x91')];_0x57382b[_0x01fa('0xab')]=_0x2a9413;return _0x57382b;});}else{if(!_[_0x01fa('0x8f')](_0x273836['query']['ids'])){_0x3af5fe[_0x01fa('0x7f')]['id']=_0x3af5fe[_0x01fa('0x7f')]['id']?_[_0x01fa('0x95')](_0x3af5fe[_0x01fa('0x7f')]['id'],_0x273836[_0x01fa('0x81')]['ids']):_0x273836[_0x01fa('0x81')][_0x01fa('0xac')];if(_0x273836['query'][_0x01fa('0xad')]){_0x3af5fe[_0x01fa('0x9d')]=_0x273836[_0x01fa('0x81')][_0x01fa('0xad')];}}if(_0x273836[_0x01fa('0x81')]['extraQueryConditions']){_0x3af5fe['where']=_['merge'](_0x3af5fe[_0x01fa('0x7f')],{'$and':_0x273836['query'][_0x01fa('0xae')]});}return _0x5e69c1[_0x4199d5[_0x01fa('0x12')]][_0x01fa('0xaf')]({'where':_0x3af5fe['where']})[_0x01fa('0x7')](function(_0x19bf73){_0x57382b['count']=_0x19bf73;if(_0x273836[_0x01fa('0x81')]['includeAll']){if(_0x4199d5[_0x01fa('0x12')]===_0x01fa('0x1b')){_0x3af5fe['include']=[{'model':_0x5e69c1['Tag'],'as':'Tags','attributes':['id',_0x01fa('0x17'),_0x01fa('0xb0')],'required':_0x273836[_0x01fa('0x81')]['tag']?!![]:![]},{'model':_0x5e69c1[_0x01fa('0xb1')],'as':_0x01fa('0xb2'),'attributes':['id','name',_0x01fa('0xb0')],'through':_0x273836[_0x01fa('0x81')][_0x01fa('0xb3')]?{'attributes':[],'where':{'TagId':_0x273836[_0x01fa('0x81')]['tag']||undefined}}:{},'required':_0x273836['query'][_0x01fa('0xb3')]?!![]:![]}];}else{_0x3af5fe[_0x01fa('0xb4')]=[{'all':!![]}];}}return _0x5e69c1[_0x4199d5[_0x01fa('0x12')]][_0x01fa('0x6')](_0x3af5fe);})[_0x01fa('0x7')](function(_0xaccd16){_0x57382b[_0x01fa('0xab')]=_0xaccd16;if(_0x49148d==='Agents'&&_0x273836[_0x01fa('0x81')][_0x01fa('0xb5')]===_0x01fa('0xb6')){var _0x14b8e9=[];for(var _0xfa7092=0x0;_0xfa7092<_0x57382b[_0x01fa('0xab')]['length'];_0xfa7092++){_0x14b8e9[_0x01fa('0x8b')](_0x48c494(_0x01fa('0xb7'),_0x57382b[_0x01fa('0xab')][_0xfa7092][_0x01fa('0xb8')]));_0x14b8e9['push'](_0x48c494('sms',_0x57382b['rows'][_0xfa7092][_0x01fa('0xb8')]));_0x14b8e9[_0x01fa('0x8b')](_0x48c494(_0x01fa('0xb9'),_0x57382b[_0x01fa('0xab')][_0xfa7092][_0x01fa('0xb8')]));_0x14b8e9[_0x01fa('0x8b')](_0x48c494('mail',_0x57382b[_0x01fa('0xab')][_0xfa7092][_0x01fa('0xb8')]));_0x14b8e9[_0x01fa('0x8b')](_0x48c494(_0x01fa('0xba'),_0x57382b[_0x01fa('0xab')][_0xfa7092][_0x01fa('0xb8')]));_0x14b8e9['push'](_0x48c494(_0x01fa('0xbb'),_0x57382b[_0x01fa('0xab')][_0xfa7092][_0x01fa('0xb8')]));}return Promise['all'](_0x14b8e9)[_0x01fa('0x7')](function(){return _0x57382b;});}return _0x57382b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3e127ff..9ce5609 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 _0x7af9=['rpc','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27b0b3,_0x5c69cf){var _0x3489c0=function(_0x4e6112){while(--_0x4e6112){_0x27b0b3['push'](_0x27b0b3['shift']());}};_0x3489c0(++_0x5c69cf);}(_0x7af9,0x95));var _0x97af=function(_0x550c99,_0x45f541){_0x550c99=_0x550c99-0x0;var _0x273815=_0x7af9[_0x550c99];return _0x273815;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});config[_0x97af('0x9')]=_[_0x97af('0xa')](config[_0x97af('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x97af('0xb'))(new Redis(config[_0x97af('0x9')]));require(_0x97af('0xc'))['register'](socket);function respondWithRpcPromise(_0x175bbc,_0x5cd1e0,_0x46ac08){return new BPromise(function(_0x19ad23,_0x18a9e5){return client[_0x97af('0xd')](_0x175bbc,_0x46ac08)[_0x97af('0xe')](function(_0x3cc156){logger[_0x97af('0xf')](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));logger[_0x97af('0x12')](_0x97af('0x13'),_0x5cd1e0,'request\x20sent',JSON[_0x97af('0x14')](_0x3cc156));if(_0x3cc156['error']){if(_0x3cc156['error'][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);return _0x18a9e5(_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);}logger['error'](_0x97af('0x10'),_0x5cd1e0,_0x3cc156['error'][_0x97af('0x17')]);return _0x19ad23(_0x3cc156['error'][_0x97af('0x17')]);}else{logger['info'](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));_0x19ad23(_0x3cc156[_0x97af('0x18')][_0x97af('0x17')]);}})[_0x97af('0x19')](function(_0x5ad2bc){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x5ad2bc);_0x18a9e5(_0x5ad2bc);});});} \ No newline at end of file +var _0x6869=['jayson/promise','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x335be0,_0x27550d){var _0x32c20a=function(_0x2b3c6c){while(--_0x2b3c6c){_0x335be0['push'](_0x335be0['shift']());}};_0x32c20a(++_0x27550d);}(_0x6869,0xe2));var _0x9686=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6869[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var moment=require(_0x9686('0x2'));var BPromise=require('bluebird');var rs=require(_0x9686('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9686('0x4'));var logger=require(_0x9686('0x5'))(_0x9686('0x6'));var config=require(_0x9686('0x7'));var jayson=require(_0x9686('0x8'));var client=jayson['client'][_0x9686('0x9')]({'port':0x232a});config[_0x9686('0xa')]=_[_0x9686('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9686('0xc'))(new Redis(config[_0x9686('0xa')]));require(_0x9686('0xd'))[_0x9686('0xe')](socket);function respondWithRpcPromise(_0x4db745,_0x464155,_0x2a62e8){return new BPromise(function(_0x155de1,_0x2088aa){return client[_0x9686('0xf')](_0x4db745,_0x2a62e8)['then'](function(_0x58d9b6){logger['info'](_0x9686('0x10'),_0x464155,_0x9686('0x11'));logger[_0x9686('0x12')](_0x9686('0x13'),_0x464155,_0x9686('0x11'),JSON[_0x9686('0x14')](_0x58d9b6));if(_0x58d9b6['error']){if(_0x58d9b6[_0x9686('0x15')][_0x9686('0x16')]===0x1f4){logger['error'](_0x9686('0x10'),_0x464155,_0x58d9b6[_0x9686('0x15')][_0x9686('0x17')]);return _0x2088aa(_0x58d9b6[_0x9686('0x15')][_0x9686('0x17')]);}logger[_0x9686('0x15')]('UserProfile,\x20%s,\x20%s',_0x464155,_0x58d9b6[_0x9686('0x15')][_0x9686('0x17')]);return _0x155de1(_0x58d9b6[_0x9686('0x15')][_0x9686('0x17')]);}else{logger[_0x9686('0x18')](_0x9686('0x10'),_0x464155,_0x9686('0x11'));_0x155de1(_0x58d9b6[_0x9686('0x19')][_0x9686('0x17')]);}})['catch'](function(_0x31b688){logger[_0x9686('0x15')](_0x9686('0x10'),_0x464155,_0x31b688);_0x2088aa(_0x31b688);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ece6e05..46ff31c 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 _0x43c2=['length','userProfile:','save','remove','update','emit','register'];(function(_0x28faf1,_0x1e3645){var _0x543379=function(_0x5ea002){while(--_0x5ea002){_0x28faf1['push'](_0x28faf1['shift']());}};_0x543379(++_0x1e3645);}(_0x43c2,0xd4));var _0x243c=function(_0x27e28f,_0x518a75){_0x27e28f=_0x27e28f-0x0;var _0x249c6=_0x43c2[_0x27e28f];return _0x249c6;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x243c('0x0'),_0x243c('0x1'),_0x243c('0x2')];function createListener(_0x20d426,_0x3c4337){return function(_0x333819){_0x3c4337[_0x243c('0x3')](_0x20d426,_0x333819);};}function removeListener(_0x1f09e4,_0x28bf8f){return function(){UserProfileEvents['removeListener'](_0x1f09e4,_0x28bf8f);};}exports[_0x243c('0x4')]=function(_0xe46096){for(var _0xe69fa8=0x0,_0x4debdc=events[_0x243c('0x5')];_0xe69fa8<_0x4debdc;_0xe69fa8++){var _0x525d81=events[_0xe69fa8];var _0x1e802c=createListener(_0x243c('0x6')+_0x525d81,_0xe46096);UserProfileEvents['on'](_0x525d81,_0x1e802c);}}; \ No newline at end of file +var _0xf883=['save','update','emit','removeListener','length','userProfile:','./userProfile.events'];(function(_0x45e08e,_0x4e2af0){var _0x366232=function(_0x46a720){while(--_0x46a720){_0x45e08e['push'](_0x45e08e['shift']());}};_0x366232(++_0x4e2af0);}(_0xf883,0x1c6));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x3f88('0x0'));var events=[_0x3f88('0x1'),'remove',_0x3f88('0x2')];function createListener(_0x15acb9,_0x3e06cb){return function(_0x5a2597){_0x3e06cb[_0x3f88('0x3')](_0x15acb9,_0x5a2597);};}function removeListener(_0x55e999,_0x5904aa){return function(){UserProfileEvents[_0x3f88('0x4')](_0x55e999,_0x5904aa);};}exports['register']=function(_0x2831e2){for(var _0x3b54b9=0x0,_0x26fb88=events[_0x3f88('0x5')];_0x3b54b9<_0x26fb88;_0x3b54b9++){var _0x156406=events[_0x3b54b9];var _0x452868=createListener(_0x3f88('0x6')+_0x156406,_0x2831e2);UserProfileEvents['on'](_0x156406,_0x452868);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 275698c..c43bbdd 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 _0x1d8f=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x4cffae,_0x1d23eb){var _0x58bc5d=function(_0x583bed){while(--_0x583bed){_0x4cffae['push'](_0x4cffae['shift']());}};_0x58bc5d(++_0x1d23eb);}(_0x1d8f,0xde));var _0xf1d8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1d8f[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xf1d8('0x0'));var util=require(_0xf1d8('0x1'));var path=require(_0xf1d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1d8('0x3'));var router=express['Router']();var fs_extra=require(_0xf1d8('0x4'));var auth=require(_0xf1d8('0x5'));var interaction=require(_0xf1d8('0x6'));var config=require(_0xf1d8('0x7'));var controller=require(_0xf1d8('0x8'));router[_0xf1d8('0x9')]('/',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xb')]);router[_0xf1d8('0x9')](_0xf1d8('0xc'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xd')]);router[_0xf1d8('0x9')](_0xf1d8('0xe'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xf')]);router[_0xf1d8('0x10')]('/',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x11')]);router['put']('/:id',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x12')]);router[_0xf1d8('0x13')](_0xf1d8('0xe'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x14')]);module[_0xf1d8('0x15')]=router; \ No newline at end of file +var _0x6a9b=['describe','create','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe'];(function(_0x19cce8,_0x23a814){var _0x575f93=function(_0x515f8b){while(--_0x515f8b){_0x19cce8['push'](_0x19cce8['shift']());}};_0x575f93(++_0x23a814);}(_0x6a9b,0x136));var _0xb6a9=function(_0x8f371d,_0x5b146a){_0x8f371d=_0x8f371d-0x0;var _0x3bcc37=_0x6a9b[_0x8f371d];return _0x3bcc37;};'use strict';var multer=require(_0xb6a9('0x0'));var util=require(_0xb6a9('0x1'));var path=require(_0xb6a9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6a9('0x3'));var router=express[_0xb6a9('0x4')]();var fs_extra=require(_0xb6a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6a9('0x6'));var config=require(_0xb6a9('0x7'));var controller=require(_0xb6a9('0x8'));router[_0xb6a9('0x9')]('/',auth[_0xb6a9('0xa')](),controller[_0xb6a9('0xb')]);router[_0xb6a9('0x9')](_0xb6a9('0xc'),auth['isAuthenticated'](),controller[_0xb6a9('0xd')]);router['get']('/:id',auth[_0xb6a9('0xa')](),controller['show']);router['post']('/',auth[_0xb6a9('0xa')](),controller[_0xb6a9('0xe')]);router[_0xb6a9('0xf')](_0xb6a9('0x10'),auth[_0xb6a9('0xa')](),controller['update']);router['delete'](_0xb6a9('0x10'),auth['isAuthenticated'](),controller[_0xb6a9('0x11')]);module[_0xb6a9('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 89c0b42..b425f96 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 _0x39fe=['sequelize','STRING'];(function(_0x1c8567,_0x5180c6){var _0x5309fd=function(_0x257c5f){while(--_0x257c5f){_0x1c8567['push'](_0x1c8567['shift']());}};_0x5309fd(++_0x5180c6);}(_0x39fe,0x1e2));var _0xe39f=function(_0x123f2b,_0x46c143){_0x123f2b=_0x123f2b-0x0;var _0x3e1efd=_0x39fe[_0x123f2b];return _0x3e1efd;};'use strict';var Sequelize=require(_0xe39f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe39f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x472b=['STRING','sequelize','exports'];(function(_0xd75b98,_0x15ad99){var _0xdd720e=function(_0x326b38){while(--_0x326b38){_0xd75b98['push'](_0xd75b98['shift']());}};_0xdd720e(++_0x15ad99);}(_0x472b,0x1f0));var _0xb472=function(_0x3b743f,_0x59fc6f){_0x3b743f=_0x3b743f-0x0;var _0x1ab3f1=_0x472b[_0x3b743f];return _0x1ab3f1;};'use strict';var Sequelize=require(_0xb472('0x0'));module[_0xb472('0x1')]={'name':{'type':Sequelize[_0xb472('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xb472('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 fd66f0c..ea67b06 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x7a54,0x106));var _0x47a5=function(_0x35f9aa,_0x597649){_0x35f9aa=_0x35f9aa-0x0;var _0x6156a9=_0x7a54[_0x35f9aa];return _0x6156a9;};'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['UserProfileResource'][_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['UserProfileResource']['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['UserProfileResource']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x4abbc1,_0xb3bb50){var _0xde3a18=function(_0x56e2a0){while(--_0x56e2a0){_0x4abbc1['push'](_0x4abbc1['shift']());}};_0xde3a18(++_0xb3bb50);}(_0xd943,0x15d));var _0x3d94=function(_0x102265,_0x161c55){_0x102265=_0x102265-0x0;var _0x176cbe=_0xd943[_0x102265];return _0x176cbe;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index fbd405f..30dfb7b 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 _0xe319=['sectionId','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4e0d72,_0x45b1dc){var _0x11c4b1=function(_0x2b5788){while(--_0x2b5788){_0x4e0d72['push'](_0x4e0d72['shift']());}};_0x11c4b1(++_0x45b1dc);}(_0xe319,0xaa));var _0x9e31=function(_0x17984e,_0x512296){_0x17984e=_0x17984e-0x0;var _0x210b21=_0xe319[_0x17984e];return _0x210b21;};'use strict';var _=require(_0x9e31('0x0'));var util=require(_0x9e31('0x1'));var logger=require(_0x9e31('0x2'))('api');var moment=require(_0x9e31('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e31('0x4'));var rimraf=require(_0x9e31('0x5'));var config=require(_0x9e31('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x564b6e,_0x256b5b){return _0x564b6e[_0x9e31('0x7')](_0x9e31('0x8'),attributes,{'tableName':_0x9e31('0x9'),'paranoid':![],'indexes':[{'name':_0x9e31('0xa'),'fields':[_0x9e31('0xb'),_0x9e31('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d61=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x205e9b,_0x11a7d7){var _0x59d4dd=function(_0x76455f){while(--_0x76455f){_0x205e9b['push'](_0x205e9b['shift']());}};_0x59d4dd(++_0x11a7d7);}(_0x9d61,0x168));var _0x19d6=function(_0x50534b,_0x527492){_0x50534b=_0x50534b-0x0;var _0x1ea547=_0x9d61[_0x50534b];return _0x1ea547;};'use strict';var _=require(_0x19d6('0x0'));var util=require(_0x19d6('0x1'));var logger=require(_0x19d6('0x2'))(_0x19d6('0x3'));var moment=require('moment');var BPromise=require(_0x19d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19d6('0x5'));var rimraf=require(_0x19d6('0x6'));var config=require(_0x19d6('0x7'));var attributes=require(_0x19d6('0x8'));module[_0x19d6('0x9')]=function(_0x359ef6,_0x75d68f){return _0x359ef6[_0x19d6('0xa')](_0x19d6('0xb'),attributes,{'tableName':_0x19d6('0xc'),'paranoid':![],'indexes':[{'name':_0x19d6('0xd'),'fields':[_0x19d6('0xe'),_0x19d6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d0b0da5..83ed1f3 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 _0xc129=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc129,0x197));var _0x9c12=function(_0x211907,_0x5486fe){_0x211907=_0x211907-0x0;var _0x2cc002=_0xc129[_0x211907];return _0x2cc002;};'use strict';var _=require(_0x9c12('0x0'));var util=require(_0x9c12('0x1'));var moment=require(_0x9c12('0x2'));var BPromise=require(_0x9c12('0x3'));var rs=require(_0x9c12('0x4'));var fs=require('fs');var Redis=require(_0x9c12('0x5'));var db=require(_0x9c12('0x6'))['db'];var utils=require(_0x9c12('0x7'));var logger=require(_0x9c12('0x8'))(_0x9c12('0x9'));var config=require('../../config/environment');var jayson=require(_0x9c12('0xa'));var client=jayson['client'][_0x9c12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238655,_0x32e919,_0x20d934){return new BPromise(function(_0x578122,_0x3ef7b7){return client[_0x9c12('0xc')](_0x238655,_0x20d934)[_0x9c12('0xd')](function(_0x2919f8){logger['info'](_0x9c12('0xe'),_0x32e919,_0x9c12('0xf'));logger[_0x9c12('0x10')](_0x9c12('0x11'),_0x32e919,_0x9c12('0xf'),JSON[_0x9c12('0x12')](_0x2919f8));if(_0x2919f8[_0x9c12('0x13')]){if(_0x2919f8[_0x9c12('0x13')][_0x9c12('0x14')]===0x1f4){logger['error'](_0x9c12('0xe'),_0x32e919,_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);return _0x3ef7b7(_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);}logger[_0x9c12('0x13')](_0x9c12('0xe'),_0x32e919,_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);return _0x578122(_0x2919f8['error'][_0x9c12('0x15')]);}else{logger[_0x9c12('0x16')]('UserProfileResource,\x20%s,\x20%s',_0x32e919,_0x9c12('0xf'));_0x578122(_0x2919f8[_0x9c12('0x17')][_0x9c12('0x15')]);}})[_0x9c12('0x18')](function(_0x2184ae){logger[_0x9c12('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x32e919,_0x2184ae);_0x3ef7b7(_0x2184ae);});});} \ No newline at end of file +var _0x6144=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring'];(function(_0x5c63dd,_0x47fe21){var _0xd44abd=function(_0x204fc5){while(--_0x204fc5){_0x5c63dd['push'](_0x5c63dd['shift']());}};_0xd44abd(++_0x47fe21);}(_0x6144,0x81));var _0x4614=function(_0x202313,_0x355031){_0x202313=_0x202313-0x0;var _0x46fafd=_0x6144[_0x202313];return _0x46fafd;};'use strict';var _=require('lodash');var util=require(_0x4614('0x0'));var moment=require('moment');var BPromise=require(_0x4614('0x1'));var rs=require(_0x4614('0x2'));var fs=require('fs');var Redis=require(_0x4614('0x3'));var db=require(_0x4614('0x4'))['db'];var utils=require(_0x4614('0x5'));var logger=require(_0x4614('0x6'))(_0x4614('0x7'));var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4694af,_0x531ac1,_0x3be9ec){return new BPromise(function(_0xb3208c,_0x3e1ef3){return client['request'](_0x4694af,_0x3be9ec)[_0x4614('0xb')](function(_0x23dca6){logger['info'](_0x4614('0xc'),_0x531ac1,_0x4614('0xd'));logger['debug'](_0x4614('0xe'),_0x531ac1,_0x4614('0xd'),JSON[_0x4614('0xf')](_0x23dca6));if(_0x23dca6[_0x4614('0x10')]){if(_0x23dca6['error'][_0x4614('0x11')]===0x1f4){logger[_0x4614('0x10')](_0x4614('0xc'),_0x531ac1,_0x23dca6[_0x4614('0x10')][_0x4614('0x12')]);return _0x3e1ef3(_0x23dca6[_0x4614('0x10')][_0x4614('0x12')]);}logger[_0x4614('0x10')](_0x4614('0xc'),_0x531ac1,_0x23dca6[_0x4614('0x10')][_0x4614('0x12')]);return _0xb3208c(_0x23dca6[_0x4614('0x10')]['message']);}else{logger[_0x4614('0x13')](_0x4614('0xc'),_0x531ac1,_0x4614('0xd'));_0xb3208c(_0x23dca6[_0x4614('0x14')][_0x4614('0x12')]);}})[_0x4614('0x15')](function(_0x4d25a5){logger['error'](_0x4614('0xc'),_0x531ac1,_0x4d25a5);_0x3e1ef3(_0x4d25a5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b9c1dd0..e074940 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 _0xbfbe=['destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0x46d684,_0x410baa){var _0x3a1107=function(_0x463f80){while(--_0x463f80){_0x46d684['push'](_0x46d684['shift']());}};_0x3a1107(++_0x410baa);}(_0xbfbe,0x65));var _0xebfb=function(_0x158876,_0x8600fe){_0x158876=_0x158876-0x0;var _0x51c285=_0xbfbe[_0x158876];return _0x51c285;};'use strict';var multer=require('multer');var util=require(_0xebfb('0x0'));var path=require(_0xebfb('0x1'));var timeout=require('connect-timeout');var express=require(_0xebfb('0x2'));var router=express[_0xebfb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xebfb('0x4'));var interaction=require(_0xebfb('0x5'));var config=require(_0xebfb('0x6'));var controller=require(_0xebfb('0x7'));router[_0xebfb('0x8')]('/',auth[_0xebfb('0x9')](),controller[_0xebfb('0xa')]);router[_0xebfb('0x8')](_0xebfb('0xb'),auth[_0xebfb('0x9')](),controller[_0xebfb('0xc')]);router['get']('/:id',auth[_0xebfb('0x9')](),controller[_0xebfb('0xd')]);router[_0xebfb('0xe')]('/',auth['isAuthenticated'](),controller[_0xebfb('0xf')]);router[_0xebfb('0x10')](_0xebfb('0x11'),auth[_0xebfb('0x9')](),controller[_0xebfb('0x12')]);router['delete']('/:id',auth[_0xebfb('0x9')](),controller[_0xebfb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb59a=['multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x24cab9,_0x16f221){var _0x3f6230=function(_0x531e41){while(--_0x531e41){_0x24cab9['push'](_0x24cab9['shift']());}};_0x3f6230(++_0x16f221);}(_0xb59a,0xe1));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xab59('0x0'));var util=require(_0xab59('0x1'));var path=require('path');var timeout=require(_0xab59('0x2'));var express=require('express');var router=express[_0xab59('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab59('0x4'));var config=require(_0xab59('0x5'));var controller=require(_0xab59('0x6'));router[_0xab59('0x7')]('/',auth[_0xab59('0x8')](),controller[_0xab59('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xab59('0x7')](_0xab59('0xa'),auth[_0xab59('0x8')](),controller[_0xab59('0xb')]);router[_0xab59('0xc')]('/',auth[_0xab59('0x8')](),controller['create']);router[_0xab59('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xab59('0xa'),auth[_0xab59('0x8')](),controller[_0xab59('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 836f487..67168f7 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x26ceb2,_0x25917d){var _0x550797=function(_0x4a431e){while(--_0x4a431e){_0x26ceb2['push'](_0x26ceb2['shift']());}};_0x550797(++_0x25917d);}(_0x6cb4,0xff));var _0x46cb=function(_0x399329,_0xa4114f){_0x399329=_0x399329-0x0;var _0x5c3001=_0x6cb4[_0x399329];return _0x5c3001;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0xdb94=['INTEGER','BOOLEAN','crudPermissions','sequelize','exports','STRING'];(function(_0x518d82,_0x3a1d83){var _0x41306b=function(_0x3bd7ed){while(--_0x3bd7ed){_0x518d82['push'](_0x518d82['shift']());}};_0x41306b(++_0x3a1d83);}(_0xdb94,0xab));var _0x4db9=function(_0x2b5d2a,_0x24f2d7){_0x2b5d2a=_0x2b5d2a-0x0;var _0x50991c=_0xdb94[_0x2b5d2a];return _0x50991c;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4db9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4db9('0x2')],'set':function(_0x554bd5){this['setDataValue'](_0x4db9('0x5'),_0x554bd5?_0x554bd5['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4db9('0x5'))?this['getDataValue'](_0x4db9('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 58e4765..a3520ec 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 _0x6614=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','attributes'];(function(_0x3b13e1,_0x2ee7eb){var _0x2a1202=function(_0x1fd230){while(--_0x1fd230){_0x3b13e1['push'](_0x3b13e1['shift']());}};_0x2a1202(++_0x2ee7eb);}(_0x6614,0x139));var _0x4661=function(_0x239a98,_0x288178){_0x239a98=_0x239a98-0x0;var _0x16d789=_0x6614[_0x239a98];return _0x16d789;};'use strict';var emlformat=require(_0x4661('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4661('0x1'));var jsonpatch=require(_0x4661('0x2'));var rp=require('request-promise');var moment=require(_0x4661('0x3'));var BPromise=require(_0x4661('0x4'));var Mustache=require(_0x4661('0x5'));var util=require(_0x4661('0x6'));var path=require('path');var sox=require(_0x4661('0x7'));var csv=require(_0x4661('0x8'));var ejs=require(_0x4661('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4661('0xa'));var squel=require('squel');var crypto=require(_0x4661('0xb'));var jsforce=require(_0x4661('0xc'));var deskjs=require(_0x4661('0xd'));var toCsv=require(_0x4661('0x8'));var querystring=require(_0x4661('0xe'));var Papa=require('papaparse');var Redis=require(_0x4661('0xf'));var authService=require(_0x4661('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4661('0x11'));var hardwareService=require(_0x4661('0x12'));var logger=require(_0x4661('0x13'))(_0x4661('0x14'));var utils=require(_0x4661('0x15'));var config=require(_0x4661('0x16'));var licenseUtil=require(_0x4661('0x17'));var db=require(_0x4661('0x18'))['db'];function respondWithStatusCode(_0x5907c1,_0xd3ba15){_0xd3ba15=_0xd3ba15||0xcc;return function(_0x1ac346){if(_0x1ac346){return _0x5907c1[_0x4661('0x19')](_0xd3ba15);}return _0x5907c1['status'](_0xd3ba15)[_0x4661('0x1a')]();};}function respondWithResult(_0x4c5454,_0x134da6){_0x134da6=_0x134da6||0xc8;return function(_0x2bedd3){if(_0x2bedd3){return _0x4c5454[_0x4661('0x1b')](_0x134da6)['json'](_0x2bedd3);}};}function respondWithFilteredResult(_0x2d8588,_0x5b2059){return function(_0x291e86){if(_0x291e86){var _0x8df841=typeof _0x5b2059['offset']===_0x4661('0x1c')&&typeof _0x5b2059[_0x4661('0x1d')]==='undefined';var _0x1ed9fc=_0x291e86['count'];var _0x23088d=_0x8df841?0x0:_0x5b2059[_0x4661('0x1e')];var _0x47f852=_0x8df841?_0x291e86[_0x4661('0x1f')]:_0x5b2059[_0x4661('0x1e')]+_0x5b2059[_0x4661('0x1d')];var _0x17e4f1;if(_0x47f852>=_0x1ed9fc){_0x47f852=_0x1ed9fc;_0x17e4f1=0xc8;}else{_0x17e4f1=0xce;}_0x2d8588[_0x4661('0x1b')](_0x17e4f1);return _0x2d8588[_0x4661('0x20')](_0x4661('0x21'),_0x23088d+'-'+_0x47f852+'/'+_0x1ed9fc)[_0x4661('0x22')](_0x291e86);}return null;};}function patchUpdates(_0x3bde04){return function(_0x57c4f0){try{jsonpatch[_0x4661('0x23')](_0x57c4f0,_0x3bde04,!![]);}catch(_0x38f2e2){return BPromise['reject'](_0x38f2e2);}return _0x57c4f0[_0x4661('0x24')]();};}function saveUpdates(_0xb5eba7,_0x21a3af){return function(_0xebc05c){if(_0xebc05c){return _0xebc05c[_0x4661('0x25')](_0xb5eba7)[_0x4661('0x26')](function(_0x2bb8ee){return _0x2bb8ee;});}return null;};}function removeEntity(_0x46cc75,_0x4de698){return function(_0x359077){if(_0x359077){return _0x359077[_0x4661('0x27')]()[_0x4661('0x26')](function(){_0x46cc75[_0x4661('0x1b')](0xcc)[_0x4661('0x1a')]();});}};}function handleEntityNotFound(_0x74720c,_0x5b0384){return function(_0x1ad7ad){if(!_0x1ad7ad){_0x74720c[_0x4661('0x19')](0x194);}return _0x1ad7ad;};}function handleError(_0xffbbba,_0x2a0f2b){_0x2a0f2b=_0x2a0f2b||0x1f4;return function(_0x12e346){logger['error'](_0x12e346['stack']);if(_0x12e346[_0x4661('0x28')]){delete _0x12e346['name'];}_0xffbbba[_0x4661('0x1b')](_0x2a0f2b)[_0x4661('0x29')](_0x12e346);};}exports[_0x4661('0x2a')]=function(_0x9066a3,_0x27436e){var _0x2d85ac={},_0x449858={},_0x307d51={'count':0x0,'rows':[]};var _0x2e9e86=_[_0x4661('0x2b')](db[_0x4661('0x2c')][_0x4661('0x2d')],function(_0x4bbef9){return{'name':_0x4bbef9['fieldName'],'type':_0x4bbef9[_0x4661('0x2e')]['key']};});_0x449858[_0x4661('0x2f')]=_[_0x4661('0x2b')](_0x2e9e86,_0x4661('0x28'));_0x449858[_0x4661('0x30')]=_[_0x4661('0x31')](_0x9066a3[_0x4661('0x30')]);_0x449858[_0x4661('0x32')]=_['intersection'](_0x449858[_0x4661('0x2f')],_0x449858[_0x4661('0x30')]);_0x2d85ac[_0x4661('0x33')]=_[_0x4661('0x34')](_0x449858[_0x4661('0x2f')],qs[_0x4661('0x35')](_0x9066a3[_0x4661('0x30')][_0x4661('0x35')]));_0x2d85ac[_0x4661('0x33')]=_0x2d85ac[_0x4661('0x33')]['length']?_0x2d85ac[_0x4661('0x33')]:_0x449858['model'];if(!_0x9066a3[_0x4661('0x30')][_0x4661('0x36')](_0x4661('0x37'))){_0x2d85ac[_0x4661('0x1d')]=qs[_0x4661('0x1d')](_0x9066a3['query'][_0x4661('0x1d')]);_0x2d85ac[_0x4661('0x1e')]=qs[_0x4661('0x1e')](_0x9066a3['query'][_0x4661('0x1e')]);}_0x2d85ac[_0x4661('0x38')]=qs[_0x4661('0x39')](_0x9066a3[_0x4661('0x30')][_0x4661('0x39')]);_0x2d85ac[_0x4661('0x3a')]=qs[_0x4661('0x32')](_[_0x4661('0x3b')](_0x9066a3[_0x4661('0x30')],_0x449858[_0x4661('0x32')]),_0x2e9e86);if(_0x9066a3[_0x4661('0x30')][_0x4661('0x3c')]){_0x2d85ac['where']=_[_0x4661('0x3d')](_0x2d85ac[_0x4661('0x3a')],{'$or':_[_0x4661('0x2b')](_0x2e9e86,function(_0x3044d7){if(_0x3044d7['type']!=='VIRTUAL'){var _0xd11261={};_0xd11261[_0x3044d7[_0x4661('0x28')]]={'$like':'%'+_0x9066a3[_0x4661('0x30')][_0x4661('0x3c')]+'%'};return _0xd11261;}})});}_0x2d85ac=_['merge']({},_0x2d85ac,_0x9066a3[_0x4661('0x3e')]);var _0x191680={'where':_0x2d85ac[_0x4661('0x3a')]};return db['UserProfileSection']['count'](_0x191680)[_0x4661('0x26')](function(_0x20c5ff){_0x307d51[_0x4661('0x1f')]=_0x20c5ff;if(_0x9066a3['query'][_0x4661('0x3f')]){_0x2d85ac[_0x4661('0x40')]=[{'all':!![]}];}return db[_0x4661('0x2c')]['findAll'](_0x2d85ac);})[_0x4661('0x26')](function(_0x25597c){_0x307d51[_0x4661('0x41')]=_0x25597c;return _0x307d51;})[_0x4661('0x26')](respondWithFilteredResult(_0x27436e,_0x2d85ac))[_0x4661('0x42')](handleError(_0x27436e,null));};exports['show']=function(_0x239b50,_0x49133c){var _0x481470={'raw':![],'where':{'id':_0x239b50[_0x4661('0x43')]['id']}},_0x16ad5b={};_0x16ad5b[_0x4661('0x2f')]=_[_0x4661('0x31')](db[_0x4661('0x2c')][_0x4661('0x2d')]);_0x16ad5b[_0x4661('0x30')]=_[_0x4661('0x31')](_0x239b50[_0x4661('0x30')]);_0x16ad5b['filters']=_[_0x4661('0x34')](_0x16ad5b['model'],_0x16ad5b['query']);_0x481470[_0x4661('0x33')]=_[_0x4661('0x34')](_0x16ad5b[_0x4661('0x2f')],qs[_0x4661('0x35')](_0x239b50[_0x4661('0x30')][_0x4661('0x35')]));_0x481470[_0x4661('0x33')]=_0x481470[_0x4661('0x33')][_0x4661('0x44')]?_0x481470[_0x4661('0x33')]:_0x16ad5b['model'];if(_0x239b50['query'][_0x4661('0x3f')]){_0x481470[_0x4661('0x40')]=[{'all':!![]}];}_0x481470=_[_0x4661('0x3d')]({},_0x481470,_0x239b50['options']);return db[_0x4661('0x2c')][_0x4661('0x45')](_0x481470)[_0x4661('0x26')](handleEntityNotFound(_0x49133c,null))[_0x4661('0x26')](respondWithResult(_0x49133c,null))[_0x4661('0x42')](handleError(_0x49133c,null));};exports[_0x4661('0x46')]=function(_0x1cc9cd,_0x439a06){return db[_0x4661('0x2c')][_0x4661('0x46')](_0x1cc9cd[_0x4661('0x47')],{})[_0x4661('0x26')](respondWithResult(_0x439a06,0xc9))['catch'](handleError(_0x439a06,null));};exports[_0x4661('0x25')]=function(_0x22474a,_0x25cae7){if(_0x22474a[_0x4661('0x47')]['id']){delete _0x22474a['body']['id'];}return db[_0x4661('0x2c')][_0x4661('0x45')]({'where':{'id':_0x22474a[_0x4661('0x43')]['id']}})[_0x4661('0x26')](handleEntityNotFound(_0x25cae7,null))[_0x4661('0x26')](saveUpdates(_0x22474a['body'],null))[_0x4661('0x26')](respondWithResult(_0x25cae7,null))[_0x4661('0x42')](handleError(_0x25cae7,null));};exports[_0x4661('0x27')]=function(_0x5df4a6,_0x9d4f4c){return db[_0x4661('0x2c')][_0x4661('0x45')]({'where':{'id':_0x5df4a6[_0x4661('0x43')]['id']}})['then'](handleEntityNotFound(_0x9d4f4c,null))[_0x4661('0x26')](removeEntity(_0x9d4f4c,null))[_0x4661('0x42')](handleError(_0x9d4f4c,null));};exports[_0x4661('0x48')]=function(_0x69ded7,_0x377a20){return db[_0x4661('0x2c')]['describe']()[_0x4661('0x26')](respondWithResult(_0x377a20,null))['catch'](handleError(_0x377a20,null));}; \ No newline at end of file +var _0x4cd4=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x4cd4,0x1be));var _0x44cd=function(_0x98032f,_0x46b52d){_0x98032f=_0x98032f-0x0;var _0x1dee59=_0x4cd4[_0x98032f];return _0x1dee59;};'use strict';var emlformat=require(_0x44cd('0x0'));var rimraf=require(_0x44cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44cd('0x3'));var Mustache=require(_0x44cd('0x4'));var util=require(_0x44cd('0x5'));var path=require(_0x44cd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44cd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x44cd('0x8'));var crypto=require(_0x44cd('0x9'));var jsforce=require(_0x44cd('0xa'));var deskjs=require(_0x44cd('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44cd('0xc'));var Redis=require(_0x44cd('0xd'));var authService=require(_0x44cd('0xe'));var qs=require(_0x44cd('0xf'));var as=require(_0x44cd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44cd('0x11'))(_0x44cd('0x12'));var utils=require(_0x44cd('0x13'));var config=require(_0x44cd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x44cd('0x15'))['db'];function respondWithStatusCode(_0x22e4d1,_0x26488f){_0x26488f=_0x26488f||0xcc;return function(_0x53ec62){if(_0x53ec62){return _0x22e4d1[_0x44cd('0x16')](_0x26488f);}return _0x22e4d1[_0x44cd('0x17')](_0x26488f)[_0x44cd('0x18')]();};}function respondWithResult(_0xdab504,_0x355b72){_0x355b72=_0x355b72||0xc8;return function(_0x15ed7b){if(_0x15ed7b){return _0xdab504[_0x44cd('0x17')](_0x355b72)[_0x44cd('0x19')](_0x15ed7b);}};}function respondWithFilteredResult(_0x486791,_0x481aea){return function(_0x22e884){if(_0x22e884){var _0x44db23=typeof _0x481aea['offset']==='undefined'&&typeof _0x481aea[_0x44cd('0x1a')]==='undefined';var _0x4404d5=_0x22e884[_0x44cd('0x1b')];var _0x2f341b=_0x44db23?0x0:_0x481aea['offset'];var _0xa27f42=_0x44db23?_0x22e884[_0x44cd('0x1b')]:_0x481aea[_0x44cd('0x1c')]+_0x481aea[_0x44cd('0x1a')];var _0x9bd01b;if(_0xa27f42>=_0x4404d5){_0xa27f42=_0x4404d5;_0x9bd01b=0xc8;}else{_0x9bd01b=0xce;}_0x486791[_0x44cd('0x17')](_0x9bd01b);return _0x486791[_0x44cd('0x1d')]('Content-Range',_0x2f341b+'-'+_0xa27f42+'/'+_0x4404d5)[_0x44cd('0x19')](_0x22e884);}return null;};}function patchUpdates(_0x3e6537){return function(_0x43f25c){try{jsonpatch[_0x44cd('0x1e')](_0x43f25c,_0x3e6537,!![]);}catch(_0x5f4cba){return BPromise[_0x44cd('0x1f')](_0x5f4cba);}return _0x43f25c[_0x44cd('0x20')]();};}function saveUpdates(_0x1c2650,_0x4aec6c){return function(_0x188b73){if(_0x188b73){return _0x188b73[_0x44cd('0x21')](_0x1c2650)[_0x44cd('0x22')](function(_0x1ab161){return _0x1ab161;});}return null;};}function removeEntity(_0x1d14dd,_0x460c18){return function(_0x254091){if(_0x254091){return _0x254091[_0x44cd('0x23')]()['then'](function(){_0x1d14dd[_0x44cd('0x17')](0xcc)[_0x44cd('0x18')]();});}};}function handleEntityNotFound(_0xa0b1c3,_0x2e3268){return function(_0x353082){if(!_0x353082){_0xa0b1c3[_0x44cd('0x16')](0x194);}return _0x353082;};}function handleError(_0x140b3c,_0x4c89ef){_0x4c89ef=_0x4c89ef||0x1f4;return function(_0x57eb4a){logger[_0x44cd('0x24')](_0x57eb4a[_0x44cd('0x25')]);if(_0x57eb4a[_0x44cd('0x26')]){delete _0x57eb4a[_0x44cd('0x26')];}_0x140b3c[_0x44cd('0x17')](_0x4c89ef)['send'](_0x57eb4a);};}exports[_0x44cd('0x27')]=function(_0x312085,_0x324f32){var _0x29dd31={},_0x516f2d={},_0x3045b1={'count':0x0,'rows':[]};var _0x2bafa3=_[_0x44cd('0x28')](db[_0x44cd('0x29')][_0x44cd('0x2a')],function(_0x5440f4){return{'name':_0x5440f4[_0x44cd('0x2b')],'type':_0x5440f4[_0x44cd('0x2c')][_0x44cd('0x2d')]};});_0x516f2d[_0x44cd('0x2e')]=_[_0x44cd('0x28')](_0x2bafa3,_0x44cd('0x26'));_0x516f2d[_0x44cd('0x2f')]=_[_0x44cd('0x30')](_0x312085[_0x44cd('0x2f')]);_0x516f2d[_0x44cd('0x31')]=_['intersection'](_0x516f2d[_0x44cd('0x2e')],_0x516f2d[_0x44cd('0x2f')]);_0x29dd31[_0x44cd('0x32')]=_[_0x44cd('0x33')](_0x516f2d[_0x44cd('0x2e')],qs[_0x44cd('0x34')](_0x312085[_0x44cd('0x2f')][_0x44cd('0x34')]));_0x29dd31[_0x44cd('0x32')]=_0x29dd31['attributes'][_0x44cd('0x35')]?_0x29dd31[_0x44cd('0x32')]:_0x516f2d[_0x44cd('0x2e')];if(!_0x312085[_0x44cd('0x2f')][_0x44cd('0x36')](_0x44cd('0x37'))){_0x29dd31[_0x44cd('0x1a')]=qs[_0x44cd('0x1a')](_0x312085['query']['limit']);_0x29dd31[_0x44cd('0x1c')]=qs[_0x44cd('0x1c')](_0x312085['query'][_0x44cd('0x1c')]);}_0x29dd31['order']=qs[_0x44cd('0x38')](_0x312085[_0x44cd('0x2f')][_0x44cd('0x38')]);_0x29dd31[_0x44cd('0x39')]=qs[_0x44cd('0x31')](_[_0x44cd('0x3a')](_0x312085['query'],_0x516f2d['filters']),_0x2bafa3);if(_0x312085['query'][_0x44cd('0x3b')]){_0x29dd31[_0x44cd('0x39')]=_[_0x44cd('0x3c')](_0x29dd31[_0x44cd('0x39')],{'$or':_[_0x44cd('0x28')](_0x2bafa3,function(_0x724986){if(_0x724986[_0x44cd('0x2c')]!==_0x44cd('0x3d')){var _0x2245ad={};_0x2245ad[_0x724986['name']]={'$like':'%'+_0x312085[_0x44cd('0x2f')][_0x44cd('0x3b')]+'%'};return _0x2245ad;}})});}_0x29dd31=_['merge']({},_0x29dd31,_0x312085['options']);var _0x8f6275={'where':_0x29dd31[_0x44cd('0x39')]};return db['UserProfileSection'][_0x44cd('0x1b')](_0x8f6275)[_0x44cd('0x22')](function(_0x188e82){_0x3045b1[_0x44cd('0x1b')]=_0x188e82;if(_0x312085[_0x44cd('0x2f')]['includeAll']){_0x29dd31[_0x44cd('0x3e')]=[{'all':!![]}];}return db[_0x44cd('0x29')][_0x44cd('0x3f')](_0x29dd31);})[_0x44cd('0x22')](function(_0x5d3b85){_0x3045b1['rows']=_0x5d3b85;return _0x3045b1;})[_0x44cd('0x22')](respondWithFilteredResult(_0x324f32,_0x29dd31))['catch'](handleError(_0x324f32,null));};exports[_0x44cd('0x40')]=function(_0x4f6bd3,_0x4692ee){var _0x21a1e2={'raw':![],'where':{'id':_0x4f6bd3[_0x44cd('0x41')]['id']}},_0x1e1cca={};_0x1e1cca[_0x44cd('0x2e')]=_[_0x44cd('0x30')](db[_0x44cd('0x29')]['rawAttributes']);_0x1e1cca[_0x44cd('0x2f')]=_[_0x44cd('0x30')](_0x4f6bd3[_0x44cd('0x2f')]);_0x1e1cca[_0x44cd('0x31')]=_[_0x44cd('0x33')](_0x1e1cca[_0x44cd('0x2e')],_0x1e1cca['query']);_0x21a1e2[_0x44cd('0x32')]=_['intersection'](_0x1e1cca[_0x44cd('0x2e')],qs[_0x44cd('0x34')](_0x4f6bd3[_0x44cd('0x2f')]['fields']));_0x21a1e2[_0x44cd('0x32')]=_0x21a1e2[_0x44cd('0x32')][_0x44cd('0x35')]?_0x21a1e2[_0x44cd('0x32')]:_0x1e1cca[_0x44cd('0x2e')];if(_0x4f6bd3[_0x44cd('0x2f')]['includeAll']){_0x21a1e2[_0x44cd('0x3e')]=[{'all':!![]}];}_0x21a1e2=_[_0x44cd('0x3c')]({},_0x21a1e2,_0x4f6bd3['options']);return db[_0x44cd('0x29')][_0x44cd('0x42')](_0x21a1e2)['then'](handleEntityNotFound(_0x4692ee,null))[_0x44cd('0x22')](respondWithResult(_0x4692ee,null))[_0x44cd('0x43')](handleError(_0x4692ee,null));};exports[_0x44cd('0x44')]=function(_0x54ef88,_0x129ccf){return db[_0x44cd('0x29')][_0x44cd('0x44')](_0x54ef88['body'],{})[_0x44cd('0x22')](respondWithResult(_0x129ccf,0xc9))[_0x44cd('0x43')](handleError(_0x129ccf,null));};exports['update']=function(_0x5787de,_0x5344b0){if(_0x5787de[_0x44cd('0x45')]['id']){delete _0x5787de['body']['id'];}return db['UserProfileSection'][_0x44cd('0x42')]({'where':{'id':_0x5787de[_0x44cd('0x41')]['id']}})[_0x44cd('0x22')](handleEntityNotFound(_0x5344b0,null))['then'](saveUpdates(_0x5787de[_0x44cd('0x45')],null))['then'](respondWithResult(_0x5344b0,null))[_0x44cd('0x43')](handleError(_0x5344b0,null));};exports[_0x44cd('0x23')]=function(_0x300958,_0x5d8e42){return db[_0x44cd('0x29')][_0x44cd('0x42')]({'where':{'id':_0x300958[_0x44cd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d8e42,null))[_0x44cd('0x22')](removeEntity(_0x5d8e42,null))[_0x44cd('0x43')](handleError(_0x5d8e42,null));};exports[_0x44cd('0x46')]=function(_0x1a5e82,_0x4cd17e){return db[_0x44cd('0x29')]['describe']()[_0x44cd('0x22')](respondWithResult(_0x4cd17e,null))[_0x44cd('0x43')](handleError(_0x4cd17e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b144e3b..bcff5ac 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 _0xece1=['path','rimraf','../../config/environment','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xece1,0x89));var _0x1ece=function(_0x2ff8af,_0xd48e8){_0x2ff8af=_0x2ff8af-0x0;var _0x1d7758=_0xece1[_0x2ff8af];return _0x1d7758;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var logger=require(_0x1ece('0x2'))(_0x1ece('0x3'));var moment=require(_0x1ece('0x4'));var BPromise=require(_0x1ece('0x5'));var rp=require(_0x1ece('0x6'));var fs=require('fs');var path=require(_0x1ece('0x7'));var rimraf=require(_0x1ece('0x8'));var config=require(_0x1ece('0x9'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x219f3a,_0xb621f9){return _0x219f3a['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1ece('0xa'),_0x1ece('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01a0=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','util','../../config/logger','moment'];(function(_0x5b2afe,_0x3c9ea6){var _0x21d589=function(_0x3ce5e2){while(--_0x3ce5e2){_0x5b2afe['push'](_0x5b2afe['shift']());}};_0x21d589(++_0x3c9ea6);}(_0x01a0,0x128));var _0x001a=function(_0x323677,_0x5eec02){_0x323677=_0x323677-0x0;var _0x46c799=_0x01a0[_0x323677];return _0x46c799;};'use strict';var _=require('lodash');var util=require(_0x001a('0x0'));var logger=require(_0x001a('0x1'))('api');var moment=require(_0x001a('0x2'));var BPromise=require(_0x001a('0x3'));var rp=require(_0x001a('0x4'));var fs=require('fs');var path=require(_0x001a('0x5'));var rimraf=require(_0x001a('0x6'));var config=require(_0x001a('0x7'));var attributes=require(_0x001a('0x8'));module[_0x001a('0x9')]=function(_0x2cfc7a,_0x268531){return _0x2cfc7a['define'](_0x001a('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x001a('0xb'),'fields':[_0x001a('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6dde3d5..a452869 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 _0x8b7c=['message','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b7c,0x1a4));var _0xc8b7=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0x8b7c[_0x54fdd8];return _0x4f6f8a;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var moment=require('moment');var BPromise=require(_0xc8b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8b7('0x3'));var db=require(_0xc8b7('0x4'))['db'];var utils=require(_0xc8b7('0x5'));var logger=require(_0xc8b7('0x6'))(_0xc8b7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc8b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e8b20,_0x36699f,_0x9cf0a){return new BPromise(function(_0x2f4bc5,_0x6957dc){return client[_0xc8b7('0x9')](_0x2e8b20,_0x9cf0a)[_0xc8b7('0xa')](function(_0x4a57d5){logger['info'](_0xc8b7('0xb'),_0x36699f,_0xc8b7('0xc'));logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x36699f,_0xc8b7('0xc'),JSON['stringify'](_0x4a57d5));if(_0x4a57d5[_0xc8b7('0xf')]){if(_0x4a57d5['error'][_0xc8b7('0x10')]===0x1f4){logger[_0xc8b7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x36699f,_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);return _0x6957dc(_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);}logger[_0xc8b7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x36699f,_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);return _0x2f4bc5(_0x4a57d5['error'][_0xc8b7('0x11')]);}else{logger[_0xc8b7('0x12')](_0xc8b7('0xb'),_0x36699f,'request\x20sent');_0x2f4bc5(_0x4a57d5['result'][_0xc8b7('0x11')]);}})['catch'](function(_0x5b03d9){logger[_0xc8b7('0xf')](_0xc8b7('0xb'),_0x36699f,_0x5b03d9);_0x6957dc(_0x5b03d9);});});} \ No newline at end of file +var _0x8649=['error','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','message'];(function(_0x2e06af,_0x392923){var _0x5a46d3=function(_0x441d45){while(--_0x441d45){_0x2e06af['push'](_0x2e06af['shift']());}};_0x5a46d3(++_0x392923);}(_0x8649,0x159));var _0x9864=function(_0x463c6e,_0x47ed93){_0x463c6e=_0x463c6e-0x0;var _0x746905=_0x8649[_0x463c6e];return _0x746905;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9864('0x0'));var BPromise=require(_0x9864('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9864('0x2'));var db=require(_0x9864('0x3'))['db'];var utils=require(_0x9864('0x4'));var logger=require(_0x9864('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9864('0x6')][_0x9864('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x231b88,_0x3a9c1d,_0x3c4372){return new BPromise(function(_0x5b3215,_0x2b2fcf){return client['request'](_0x231b88,_0x3c4372)[_0x9864('0x8')](function(_0x5e2cab){logger[_0x9864('0x9')](_0x9864('0xa'),_0x3a9c1d,_0x9864('0xb'));logger[_0x9864('0xc')](_0x9864('0xd'),_0x3a9c1d,_0x9864('0xb'),JSON['stringify'](_0x5e2cab));if(_0x5e2cab['error']){if(_0x5e2cab['error']['code']===0x1f4){logger['error'](_0x9864('0xa'),_0x3a9c1d,_0x5e2cab['error'][_0x9864('0xe')]);return _0x2b2fcf(_0x5e2cab[_0x9864('0xf')][_0x9864('0xe')]);}logger[_0x9864('0xf')](_0x9864('0xa'),_0x3a9c1d,_0x5e2cab[_0x9864('0xf')][_0x9864('0xe')]);return _0x5b3215(_0x5e2cab[_0x9864('0xf')][_0x9864('0xe')]);}else{logger[_0x9864('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x3a9c1d,'request\x20sent');_0x5b3215(_0x5e2cab[_0x9864('0x10')]['message']);}})[_0x9864('0x11')](function(_0xac1b46){logger[_0x9864('0xf')](_0x9864('0xa'),_0x3a9c1d,_0xac1b46);_0x2b2fcf(_0xac1b46);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3c78a8c..56d98e3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xbe5e12,_0x267c66){var _0x255547=function(_0x1ed314){while(--_0x1ed314){_0xbe5e12['push'](_0xbe5e12['shift']());}};_0x255547(++_0x267c66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x50a651,_0x276aaf){var _0x429c51=function(_0x41e3e9){while(--_0x41e3e9){_0x50a651['push'](_0x50a651['shift']());}};_0x429c51(++_0x276aaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index dd82c52..c7958f1 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 _0x337e=['exports'];(function(_0x5eb17b,_0x1643f7){var _0x6c2689=function(_0x241f2b){while(--_0x241f2b){_0x5eb17b['push'](_0x5eb17b['shift']());}};_0x6c2689(++_0x1643f7);}(_0x337e,0xb6));var _0xe337=function(_0x55849b,_0x2229c1){_0x55849b=_0x55849b-0x0;var _0x4a7713=_0x337e[_0x55849b];return _0x4a7713;};'use strict';var Sequelize=require('sequelize');module[_0xe337('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b83=['INTEGER','exports'];(function(_0x403890,_0x584019){var _0x980b30=function(_0x23a7af){while(--_0x23a7af){_0x403890['push'](_0x403890['shift']());}};_0x980b30(++_0x584019);}(_0x2b83,0x1d3));var _0x32b8=function(_0xc0a38e,_0x1907cc){_0xc0a38e=_0xc0a38e-0x0;var _0x3eaeee=_0x2b83[_0xc0a38e];return _0x3eaeee;};'use strict';var Sequelize=require('sequelize');module[_0x32b8('0x0')]={'penalty':{'type':Sequelize[_0x32b8('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c638615..c0e753a 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 _0x9505=['request-promise','path','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9505,0x1e5));var _0x5950=function(_0x5ac90a,_0xb14416){_0x5ac90a=_0x5ac90a-0x0;var _0x226a9b=_0x9505[_0x5ac90a];return _0x226a9b;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('UserSmsQueue',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7524=['../../config/logger','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','user_has_sms_queues','util'];(function(_0x4a0cc5,_0x2d6c16){var _0x24133d=function(_0x53b131){while(--_0x53b131){_0x4a0cc5['push'](_0x4a0cc5['shift']());}};_0x24133d(++_0x2d6c16);}(_0x7524,0xce));var _0x4752=function(_0xf71685,_0x28c386){_0xf71685=_0xf71685-0x0;var _0x502051=_0x7524[_0xf71685];return _0x502051;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('UserSmsQueue',attributes,{'tableName':_0x4752('0x8'),'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 2e65875..1c55113 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 _0x133b=['then','info','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x133b,0x7e));var _0xb133=function(_0x46c8d6,_0x16fa9b){_0x46c8d6=_0x46c8d6-0x0;var _0x2084ec=_0x133b[_0x46c8d6];return _0x2084ec;};'use strict';var _=require(_0xb133('0x0'));var util=require('util');var moment=require(_0xb133('0x1'));var BPromise=require(_0xb133('0x2'));var rs=require(_0xb133('0x3'));var fs=require('fs');var Redis=require(_0xb133('0x4'));var db=require(_0xb133('0x5'))['db'];var utils=require(_0xb133('0x6'));var logger=require(_0xb133('0x7'))('rpc');var config=require(_0xb133('0x8'));var jayson=require(_0xb133('0x9'));var client=jayson[_0xb133('0xa')][_0xb133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c1fce,_0x594d16,_0x1cdbae){return new BPromise(function(_0x39b9d2,_0x4e0a95){return client['request'](_0x3c1fce,_0x1cdbae)[_0xb133('0xc')](function(_0x445c5f){logger[_0xb133('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x594d16,_0xb133('0xe'));logger[_0xb133('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x594d16,'request\x20sent',JSON[_0xb133('0x10')](_0x445c5f));if(_0x445c5f['error']){if(_0x445c5f[_0xb133('0x11')][_0xb133('0x12')]===0x1f4){logger[_0xb133('0x11')](_0xb133('0x13'),_0x594d16,_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);return _0x4e0a95(_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);}logger[_0xb133('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x594d16,_0x445c5f['error'][_0xb133('0x14')]);return _0x39b9d2(_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);}else{logger[_0xb133('0xd')](_0xb133('0x13'),_0x594d16,_0xb133('0xe'));_0x39b9d2(_0x445c5f[_0xb133('0x15')][_0xb133('0x14')]);}})[_0xb133('0x16')](function(_0x13bb58){logger[_0xb133('0x11')](_0xb133('0x13'),_0x594d16,_0x13bb58);_0x4e0a95(_0x13bb58);});});} \ No newline at end of file +var _0x02ff=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x24ab61,_0x19dd70){var _0x38cf83=function(_0x2ecc9d){while(--_0x2ecc9d){_0x24ab61['push'](_0x24ab61['shift']());}};_0x38cf83(++_0x19dd70);}(_0x02ff,0x161));var _0xf02f=function(_0x2c3034,_0x3b8518){_0x2c3034=_0x2c3034-0x0;var _0x1b2f75=_0x02ff[_0x2c3034];return _0x1b2f75;};'use strict';var _=require('lodash');var util=require(_0xf02f('0x0'));var moment=require(_0xf02f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf02f('0x2'));var fs=require('fs');var Redis=require(_0xf02f('0x3'));var db=require(_0xf02f('0x4'))['db'];var utils=require(_0xf02f('0x5'));var logger=require(_0xf02f('0x6'))('rpc');var config=require(_0xf02f('0x7'));var jayson=require(_0xf02f('0x8'));var client=jayson['client'][_0xf02f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d420c,_0x383456,_0x1a11c5){return new BPromise(function(_0x3ebc30,_0x3fed4a){return client[_0xf02f('0xa')](_0x2d420c,_0x1a11c5)[_0xf02f('0xb')](function(_0xc94fbd){logger[_0xf02f('0xc')](_0xf02f('0xd'),_0x383456,_0xf02f('0xe'));logger[_0xf02f('0xf')](_0xf02f('0x10'),_0x383456,_0xf02f('0xe'),JSON[_0xf02f('0x11')](_0xc94fbd));if(_0xc94fbd[_0xf02f('0x12')]){if(_0xc94fbd[_0xf02f('0x12')][_0xf02f('0x13')]===0x1f4){logger['error'](_0xf02f('0xd'),_0x383456,_0xc94fbd[_0xf02f('0x12')]['message']);return _0x3fed4a(_0xc94fbd[_0xf02f('0x12')][_0xf02f('0x14')]);}logger[_0xf02f('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x383456,_0xc94fbd['error'][_0xf02f('0x14')]);return _0x3ebc30(_0xc94fbd[_0xf02f('0x12')][_0xf02f('0x14')]);}else{logger[_0xf02f('0xc')](_0xf02f('0xd'),_0x383456,_0xf02f('0xe'));_0x3ebc30(_0xc94fbd[_0xf02f('0x15')][_0xf02f('0x14')]);}})[_0xf02f('0x16')](function(_0x2cd581){logger['error'](_0xf02f('0xd'),_0x383456,_0x2cd581);_0x3fed4a(_0x2cd581);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6a78bae..ae3e2f4 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 _0x0507=['exports','sequelize'];(function(_0x506389,_0x48a163){var _0x417922=function(_0x4fcf80){while(--_0x4fcf80){_0x506389['push'](_0x506389['shift']());}};_0x417922(++_0x48a163);}(_0x0507,0x85));var _0x7050=function(_0xbfc4d7,_0x1a0757){_0xbfc4d7=_0xbfc4d7-0x0;var _0x3dbcb2=_0x0507[_0xbfc4d7];return _0x3dbcb2;};'use strict';var Sequelize=require(_0x7050('0x0'));module[_0x7050('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x07b2=['sequelize','exports','INTEGER'];(function(_0x59b6a9,_0x39b52e){var _0x2696c1=function(_0x4666c2){while(--_0x4666c2){_0x59b6a9['push'](_0x59b6a9['shift']());}};_0x2696c1(++_0x39b52e);}(_0x07b2,0xd5));var _0x207b=function(_0x393484,_0xe29bab){_0x393484=_0x393484-0x0;var _0x3aff47=_0x07b2[_0x393484];return _0x3aff47;};'use strict';var Sequelize=require(_0x207b('0x0'));module[_0x207b('0x1')]={'UserId':{'type':Sequelize[_0x207b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x207b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b70785a..93276d0 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(_0x2d6c87,_0x1c9c8c){var _0x2d8715=function(_0x26120b){while(--_0x26120b){_0x2d6c87['push'](_0x2d6c87['shift']());}};_0x2d8715(++_0x1c9c8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x241ca1,_0x2cbc03){var _0x5b846c=function(_0x37ee77){while(--_0x37ee77){_0x241ca1['push'](_0x241ca1['shift']());}};_0x5b846c(++_0x2cbc03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 027d273..61220be 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4cf3b3,_0xf78d5b){var _0xe21965=function(_0x5447ee){while(--_0x5447ee){_0x4cf3b3['push'](_0x4cf3b3['shift']());}};_0xe21965(++_0xf78d5b);}(_0xedd9,0xfc));var _0x9edd=function(_0x8efe25,_0x23a546){_0x8efe25=_0x8efe25-0x0;var _0xe0067=_0xedd9[_0x8efe25];return _0xe0067;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5a6ef9,_0x1c56d3){var _0x133ba2=function(_0x556eea){while(--_0x556eea){_0x5a6ef9['push'](_0x5a6ef9['shift']());}};_0x133ba2(++_0x1c56d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6e5d471..de55c1d 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 _0x8134=['exports','INTEGER'];(function(_0x481952,_0x5014be){var _0x40c8b5=function(_0x5ee5b2){while(--_0x5ee5b2){_0x481952['push'](_0x481952['shift']());}};_0x40c8b5(++_0x5014be);}(_0x8134,0x78));var _0x4813=function(_0xd0f2a,_0x3abff7){_0xd0f2a=_0xd0f2a-0x0;var _0x32ba01=_0x8134[_0xd0f2a];return _0x32ba01;};'use strict';var Sequelize=require('sequelize');module[_0x4813('0x0')]={'penalty':{'type':Sequelize[_0x4813('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b5b=['exports','sequelize'];(function(_0x2d953a,_0x4d762c){var _0x8e49c5=function(_0x41eaa0){while(--_0x41eaa0){_0x2d953a['push'](_0x2d953a['shift']());}};_0x8e49c5(++_0x4d762c);}(_0x9b5b,0x1e1));var _0xb9b5=function(_0x37897f,_0x2ee284){_0x37897f=_0x37897f-0x0;var _0x310cdb=_0x9b5b[_0x37897f];return _0x310cdb;};'use strict';var Sequelize=require(_0xb9b5('0x0'));module[_0xb9b5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 3972633..809ee46 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 _0xc585=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util'];(function(_0x48c6e6,_0x48473d){var _0x21e8b4=function(_0xeba3e3){while(--_0xeba3e3){_0x48c6e6['push'](_0x48c6e6['shift']());}};_0x21e8b4(++_0x48473d);}(_0xc585,0x1ba));var _0x5c58=function(_0x150e13,_0x31b36a){_0x150e13=_0x150e13-0x0;var _0x2b2a5a=_0xc585[_0x150e13];return _0x2b2a5a;};'use strict';var _=require(_0x5c58('0x0'));var util=require(_0x5c58('0x1'));var logger=require(_0x5c58('0x2'))(_0x5c58('0x3'));var moment=require('moment');var BPromise=require(_0x5c58('0x4'));var rp=require(_0x5c58('0x5'));var fs=require('fs');var path=require(_0x5c58('0x6'));var rimraf=require('rimraf');var config=require(_0x5c58('0x7'));var attributes=require(_0x5c58('0x8'));module[_0x5c58('0x9')]=function(_0x482e4f,_0xf98b8e){return _0x482e4f[_0x5c58('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x5c58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb296=['define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x3e2936,_0x1d57a9){var _0x35d87a=function(_0x19dd6a){while(--_0x19dd6a){_0x3e2936['push'](_0x3e2936['shift']());}};_0x35d87a(++_0x1d57a9);}(_0xb296,0x13b));var _0x6b29=function(_0x156a31,_0x95ada0){_0x156a31=_0x156a31-0x0;var _0x5bd8c3=_0xb296[_0x156a31];return _0x5bd8c3;};'use strict';var _=require(_0x6b29('0x0'));var util=require('util');var logger=require(_0x6b29('0x1'))(_0x6b29('0x2'));var moment=require(_0x6b29('0x3'));var BPromise=require(_0x6b29('0x4'));var rp=require(_0x6b29('0x5'));var fs=require('fs');var path=require(_0x6b29('0x6'));var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x6b29('0x8')]=function(_0x1c2f87,_0x4cf546){return _0x1c2f87[_0x6b29('0x9')](_0x6b29('0xa'),attributes,{'tableName':_0x6b29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 7ad9896..532eace 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 _0x0a07=['client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x19ab8e,_0xa72634){var _0x430315=function(_0x53acd0){while(--_0x53acd0){_0x19ab8e['push'](_0x19ab8e['shift']());}};_0x430315(++_0xa72634);}(_0x0a07,0x1ac));var _0x70a0=function(_0x255af9,_0xf891fe){_0x255af9=_0x255af9-0x0;var _0x35bf86=_0x0a07[_0x255af9];return _0x35bf86;};'use strict';var _=require(_0x70a0('0x0'));var util=require('util');var moment=require(_0x70a0('0x1'));var BPromise=require(_0x70a0('0x2'));var rs=require(_0x70a0('0x3'));var fs=require('fs');var Redis=require(_0x70a0('0x4'));var db=require(_0x70a0('0x5'))['db'];var utils=require(_0x70a0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x70a0('0x7'));var jayson=require(_0x70a0('0x8'));var client=jayson[_0x70a0('0x9')][_0x70a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227bbd,_0x5f2102,_0x5487fe){return new BPromise(function(_0x34ff09,_0x119050){return client[_0x70a0('0xb')](_0x227bbd,_0x5487fe)['then'](function(_0x5ac718){logger[_0x70a0('0xc')](_0x70a0('0xd'),_0x5f2102,_0x70a0('0xe'));logger[_0x70a0('0xf')](_0x70a0('0x10'),_0x5f2102,_0x70a0('0xe'),JSON[_0x70a0('0x11')](_0x5ac718));if(_0x5ac718[_0x70a0('0x12')]){if(_0x5ac718[_0x70a0('0x12')][_0x70a0('0x13')]===0x1f4){logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x5ac718[_0x70a0('0x12')][_0x70a0('0x14')]);return _0x119050(_0x5ac718[_0x70a0('0x12')]['message']);}logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x5ac718[_0x70a0('0x12')][_0x70a0('0x14')]);return _0x34ff09(_0x5ac718['error']['message']);}else{logger[_0x70a0('0xc')](_0x70a0('0xd'),_0x5f2102,'request\x20sent');_0x34ff09(_0x5ac718[_0x70a0('0x15')][_0x70a0('0x14')]);}})[_0x70a0('0x16')](function(_0x166157){logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x166157);_0x119050(_0x166157);});});} \ No newline at end of file +var _0x44cc=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client'];(function(_0x30b40a,_0x1d6286){var _0x55dd43=function(_0x3b57b2){while(--_0x3b57b2){_0x30b40a['push'](_0x30b40a['shift']());}};_0x55dd43(++_0x1d6286);}(_0x44cc,0x188));var _0xc44c=function(_0x1543bb,_0x1334dd){_0x1543bb=_0x1543bb-0x0;var _0x365427=_0x44cc[_0x1543bb];return _0x365427;};'use strict';var _=require(_0xc44c('0x0'));var util=require(_0xc44c('0x1'));var moment=require(_0xc44c('0x2'));var BPromise=require(_0xc44c('0x3'));var rs=require(_0xc44c('0x4'));var fs=require('fs');var Redis=require(_0xc44c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc44c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc44c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd047b6,_0x366de5,_0x27a2f0){return new BPromise(function(_0x545067,_0x1df86c){return client[_0xc44c('0x8')](_0xd047b6,_0x27a2f0)[_0xc44c('0x9')](function(_0x2b84b5){logger[_0xc44c('0xa')](_0xc44c('0xb'),_0x366de5,_0xc44c('0xc'));logger[_0xc44c('0xd')](_0xc44c('0xe'),_0x366de5,_0xc44c('0xc'),JSON['stringify'](_0x2b84b5));if(_0x2b84b5[_0xc44c('0xf')]){if(_0x2b84b5[_0xc44c('0xf')][_0xc44c('0x10')]===0x1f4){logger[_0xc44c('0xf')](_0xc44c('0xb'),_0x366de5,_0x2b84b5[_0xc44c('0xf')][_0xc44c('0x11')]);return _0x1df86c(_0x2b84b5['error'][_0xc44c('0x11')]);}logger[_0xc44c('0xf')](_0xc44c('0xb'),_0x366de5,_0x2b84b5[_0xc44c('0xf')][_0xc44c('0x11')]);return _0x545067(_0x2b84b5[_0xc44c('0xf')]['message']);}else{logger[_0xc44c('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x366de5,_0xc44c('0xc'));_0x545067(_0x2b84b5[_0xc44c('0x12')][_0xc44c('0x11')]);}})[_0xc44c('0x13')](function(_0x533ab9){logger[_0xc44c('0xf')](_0xc44c('0xb'),_0x366de5,_0x533ab9);_0x1df86c(_0x533ab9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 466be8d..120f52d 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35b8c6,_0x6962b2){var _0x40ef44=function(_0x59d5a2){while(--_0x59d5a2){_0x35b8c6['push'](_0x35b8c6['shift']());}};_0x40ef44(++_0x6962b2);}(_0xedd9,0xfc));var _0x9edd=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xedd9[_0x27650e];return _0x28fe08;};'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(_0x1a1f82,_0x16e88b){var _0x152427=function(_0xcddcba){while(--_0xcddcba){_0x1a1f82['push'](_0x1a1f82['shift']());}};_0x152427(++_0x16e88b);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ee9fb0b..38d0edb 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 _0xc830=['STRING','INTEGER','queue_interface','sequelize','Required\x20by\x20Asterisk'];(function(_0x319a5d,_0x2ed886){var _0x51e9e7=function(_0x4858fc){while(--_0x4858fc){_0x319a5d['push'](_0x319a5d['shift']());}};_0x51e9e7(++_0x2ed886);}(_0xc830,0x85));var _0x0c83=function(_0xdd0b24,_0x5b3634){_0xdd0b24=_0xdd0b24-0x0;var _0x343dba=_0xc830[_0xdd0b24];return _0x343dba;};'use strict';var Sequelize=require(_0x0c83('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0c83('0x1')},'membername':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'comment':_0x0c83('0x1')},'UserId':{'type':Sequelize[_0x0c83('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'unique':_0x0c83('0x4'),'comment':_0x0c83('0x1')},'VoiceQueueId':{'type':Sequelize[_0x0c83('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'unique':_0x0c83('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x0c83('0x3')](0xb),'defaultValue':0x0,'comment':_0x0c83('0x1')},'paused':{'type':Sequelize[_0x0c83('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x5734=['sequelize','exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk'];(function(_0x414967,_0x57b168){var _0x39cd83=function(_0x392e80){while(--_0x392e80){_0x414967['push'](_0x414967['shift']());}};_0x39cd83(++_0x57b168);}(_0x5734,0x1c8));var _0x4573=function(_0x59cd35,_0x5a9053){_0x59cd35=_0x59cd35-0x0;var _0x26e325=_0x5734[_0x59cd35];return _0x26e325;};'use strict';var Sequelize=require(_0x4573('0x0'));module[_0x4573('0x1')]={'uniqueid':{'type':Sequelize[_0x4573('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x4573('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4573('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4573('0x3')],'allowNull':![],'unique':_0x4573('0x4'),'comment':_0x4573('0x5')},'VoiceQueueId':{'type':Sequelize[_0x4573('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4573('0x3')],'allowNull':![],'unique':_0x4573('0x4'),'comment':_0x4573('0x5')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x4573('0x5')},'paused':{'type':Sequelize[_0x4573('0x2')](0xb),'defaultValue':0x0,'comment':_0x4573('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e7ff93d..e5c2418 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 _0x1608=['remove','hasOwnProperty','hook','events','UserVoiceQueueRt','save','update'];(function(_0x486e64,_0x1e1eb2){var _0x404b49=function(_0x2cd3be){while(--_0x2cd3be){_0x486e64['push'](_0x486e64['shift']());}};_0x404b49(++_0x1e1eb2);}(_0x1608,0x1ae));var _0x8160=function(_0x385ba1,_0x380b3c){_0x385ba1=_0x385ba1-0x0;var _0x5472b6=_0x1608[_0x385ba1];return _0x5472b6;};'use strict';var EventEmitter=require(_0x8160('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x8160('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8160('0x2'),'afterUpdate':_0x8160('0x3'),'afterDestroy':_0x8160('0x4')};function emitEvent(_0x1e32f7){return function(_0x4afcc0,_0x138efd,_0x2bc314){UserVoiceQueueRtEvents['emit'](_0x1e32f7+':'+_0x4afcc0['id'],_0x4afcc0);UserVoiceQueueRtEvents['emit'](_0x1e32f7,_0x4afcc0);_0x2bc314(null);};}for(var e in events){if(events[_0x8160('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x8160('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4426=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x818002,_0x157da0){var _0x50b651=function(_0x53deb0){while(--_0x53deb0){_0x818002['push'](_0x818002['shift']());}};_0x50b651(++_0x157da0);}(_0x4426,0x79));var _0x6442=function(_0x51f80b,_0x2afae3){_0x51f80b=_0x51f80b-0x0;var _0x26ffdd=_0x4426[_0x51f80b];return _0x26ffdd;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x6442('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6442('0x1')](0x0);var events={'afterCreate':_0x6442('0x2'),'afterUpdate':'update','afterDestroy':_0x6442('0x3')};function emitEvent(_0x1e1982){return function(_0x3ad18c,_0xd79e0,_0x51bd97){UserVoiceQueueRtEvents[_0x6442('0x4')](_0x1e1982+':'+_0x3ad18c['id'],_0x3ad18c);UserVoiceQueueRtEvents['emit'](_0x1e1982,_0x3ad18c);_0x51bd97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x6442('0x5')](e,emitEvent(event));}}module[_0x6442('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7371855..bf330fc 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 _0x1d20=['user_has_voice_queues_rt','lodash','api','moment','bluebird','request-promise','rimraf','UserVoiceQueueRt'];(function(_0xc44bc,_0x443875){var _0x1c2635=function(_0x5dfa6a){while(--_0x5dfa6a){_0xc44bc['push'](_0xc44bc['shift']());}};_0x1c2635(++_0x443875);}(_0x1d20,0x149));var _0x01d2=function(_0x1ce5cd,_0x5383ba){_0x1ce5cd=_0x1ce5cd-0x0;var _0x557a63=_0x1d20[_0x1ce5cd];return _0x557a63;};'use strict';var _=require(_0x01d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x01d2('0x1'));var moment=require(_0x01d2('0x2'));var BPromise=require(_0x01d2('0x3'));var rp=require(_0x01d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01d2('0x5'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x44f3d1,_0x2a4686){return _0x44f3d1['define'](_0x01d2('0x6'),attributes,{'tableName':_0x01d2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb53=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xdb53,0xca));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 logger=require(_0x3db5('0x2'))(_0x3db5('0x3'));var moment=require('moment');var BPromise=require(_0x3db5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3db5('0x5'));var rimraf=require(_0x3db5('0x6'));var config=require(_0x3db5('0x7'));var attributes=require(_0x3db5('0x8'));module[_0x3db5('0x9')]=function(_0x4de95c,_0x4be523){return _0x4de95c['define'](_0x3db5('0xa'),attributes,{'tableName':_0x3db5('0xb'),'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 4514125..a2b6878 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 _0xde00=['error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xde00,0xdb));var _0x0de0=function(_0x1f7962,_0x181f16){_0x1f7962=_0x1f7962-0x0;var _0x3af491=_0xde00[_0x1f7962];return _0x3af491;};'use strict';var _=require('lodash');var util=require(_0x0de0('0x0'));var moment=require(_0x0de0('0x1'));var BPromise=require(_0x0de0('0x2'));var rs=require(_0x0de0('0x3'));var fs=require('fs');var Redis=require(_0x0de0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de0('0x5'));var logger=require(_0x0de0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0de0('0x7'));var client=jayson['client'][_0x0de0('0x8')]({'port':0x232a});config['redis']=_[_0x0de0('0x9')](config['redis'],{'host':_0x0de0('0xa'),'port':0x18eb});var socket=require(_0x0de0('0xb'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x0de0('0xc')](socket);function respondWithRpcPromise(_0x5818f6,_0x107440,_0x37b497){return new BPromise(function(_0x526940,_0x404b69){return client[_0x0de0('0xd')](_0x5818f6,_0x37b497)[_0x0de0('0xe')](function(_0x5a2c4e){logger[_0x0de0('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x0de0('0x10'));logger[_0x0de0('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x107440,'request\x20sent',JSON[_0x0de0('0x12')](_0x5a2c4e));if(_0x5a2c4e[_0x0de0('0x13')]){if(_0x5a2c4e['error'][_0x0de0('0x14')]===0x1f4){logger[_0x0de0('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);return _0x404b69(_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);}logger[_0x0de0('0x13')](_0x0de0('0x16'),_0x107440,_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);return _0x526940(_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);}else{logger[_0x0de0('0xf')](_0x0de0('0x16'),_0x107440,_0x0de0('0x10'));_0x526940(_0x5a2c4e[_0x0de0('0x17')][_0x0de0('0x15')]);}})[_0x0de0('0x18')](function(_0x3e91c4){logger[_0x0de0('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x3e91c4);_0x404b69(_0x3e91c4);});});}exports['GetVoiceQueueRtPauses']=function(_0x178493){var _0x3426f2=this;return new Promise(function(_0x2593bb,_0x21b156){return db['UserVoiceQueueRt'][_0x0de0('0x19')]({'raw':_0x178493[_0x0de0('0x1a')]?_0x178493[_0x0de0('0x1a')][_0x0de0('0x1b')]===undefined?!![]:![]:!![],'where':_0x178493['options']?_0x178493['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x0de0('0x1c'),db[_0x0de0('0x1d')]['fn']('IF',db[_0x0de0('0x1d')][_0x0de0('0x1e')](_0x0de0('0x1f')))),_0x0de0('0x20')]]})[_0x0de0('0xe')](function(_0x38d6ce){logger[_0x0de0('0xf')](_0x0de0('0x21'),_0x178493);logger[_0x0de0('0x11')](_0x0de0('0x21'),_0x178493,JSON['stringify'](_0x38d6ce));_0x2593bb(_0x38d6ce);})['catch'](function(_0xfea0bc){logger[_0x0de0('0x13')](_0x0de0('0x21'),_0xfea0bc[_0x0de0('0x15')],_0x178493);_0x21b156(_0x3426f2[_0x0de0('0x13')](0x1f4,_0xfea0bc['message']));});});}; \ No newline at end of file +var _0xfb61=['request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','./userVoiceQueueRt.socket','register'];(function(_0x1ec139,_0x1f7532){var _0x1a659a=function(_0x1fa0c){while(--_0x1fa0c){_0x1ec139['push'](_0x1ec139['shift']());}};_0x1a659a(++_0x1f7532);}(_0xfb61,0xcf));var _0x1fb6=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0xfb61[_0x1ee5be];return _0x177140;};'use strict';var _=require(_0x1fb6('0x0'));var util=require(_0x1fb6('0x1'));var moment=require(_0x1fb6('0x2'));var BPromise=require(_0x1fb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb6('0x5'));var logger=require(_0x1fb6('0x6'))('rpc');var config=require(_0x1fb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1fb6('0x8')][_0x1fb6('0x9')]({'port':0x232a});config['redis']=_[_0x1fb6('0xa')](config[_0x1fb6('0xb')],{'host':_0x1fb6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fb6('0xb')]));require(_0x1fb6('0xd'))[_0x1fb6('0xe')](socket);function respondWithRpcPromise(_0x5171af,_0x220e0f,_0x284ae4){return new BPromise(function(_0x1d1eb2,_0x3e0084){return client[_0x1fb6('0xf')](_0x5171af,_0x284ae4)['then'](function(_0x26ca39){logger['info'](_0x1fb6('0x10'),_0x220e0f,_0x1fb6('0x11'));logger['debug'](_0x1fb6('0x12'),_0x220e0f,_0x1fb6('0x11'),JSON[_0x1fb6('0x13')](_0x26ca39));if(_0x26ca39[_0x1fb6('0x14')]){if(_0x26ca39[_0x1fb6('0x14')][_0x1fb6('0x15')]===0x1f4){logger[_0x1fb6('0x14')](_0x1fb6('0x10'),_0x220e0f,_0x26ca39[_0x1fb6('0x14')][_0x1fb6('0x16')]);return _0x3e0084(_0x26ca39[_0x1fb6('0x14')][_0x1fb6('0x16')]);}logger[_0x1fb6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x220e0f,_0x26ca39[_0x1fb6('0x14')][_0x1fb6('0x16')]);return _0x1d1eb2(_0x26ca39[_0x1fb6('0x14')][_0x1fb6('0x16')]);}else{logger[_0x1fb6('0x17')](_0x1fb6('0x10'),_0x220e0f,_0x1fb6('0x11'));_0x1d1eb2(_0x26ca39[_0x1fb6('0x18')][_0x1fb6('0x16')]);}})[_0x1fb6('0x19')](function(_0xbcb6b9){logger[_0x1fb6('0x14')](_0x1fb6('0x10'),_0x220e0f,_0xbcb6b9);_0x3e0084(_0xbcb6b9);});});}exports[_0x1fb6('0x1a')]=function(_0x57db68){var _0x4356a4=this;return new Promise(function(_0x12d861,_0x48c8bf){return db[_0x1fb6('0x1b')][_0x1fb6('0x1c')]({'raw':_0x57db68[_0x1fb6('0x1d')]?_0x57db68[_0x1fb6('0x1d')][_0x1fb6('0x1e')]===undefined?!![]:![]:!![],'where':_0x57db68[_0x1fb6('0x1d')]?_0x57db68[_0x1fb6('0x1d')][_0x1fb6('0x1f')]||null:null,'attributes':[[db[_0x1fb6('0x20')]['fn']('COUNT',db[_0x1fb6('0x20')]['fn']('IF',db['sequelize'][_0x1fb6('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x1fb6('0x22')]]})[_0x1fb6('0x23')](function(_0x4175fc){logger[_0x1fb6('0x17')]('GetVoiceQueueRtPauses',_0x57db68);logger[_0x1fb6('0x24')](_0x1fb6('0x1a'),_0x57db68,JSON['stringify'](_0x4175fc));_0x12d861(_0x4175fc);})[_0x1fb6('0x19')](function(_0x4cebe3){logger[_0x1fb6('0x14')](_0x1fb6('0x1a'),_0x4cebe3[_0x1fb6('0x16')],_0x57db68);_0x48c8bf(_0x4356a4[_0x1fb6('0x14')](0x1f4,_0x4cebe3[_0x1fb6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 491979d..2acf6b2 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 _0x0024=['save','update','length','userVoiceQueueRt:'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x0024,0xa8));var _0x4002=function(_0x1f6895,_0x3193e7){_0x1f6895=_0x1f6895-0x0;var _0x27d864=_0x0024[_0x1f6895];return _0x27d864;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x4002('0x0'),'remove',_0x4002('0x1')];function createListener(_0x4a4ac0,_0x3db8e9){return function(_0x5d7431){_0x3db8e9['emit'](_0x4a4ac0,_0x5d7431);};}function removeListener(_0x423907,_0x1190e7){return function(){UserVoiceQueueRtEvents['removeListener'](_0x423907,_0x1190e7);};}exports['register']=function(_0x36c011){for(var _0x144717=0x0,_0x15d53a=events[_0x4002('0x2')];_0x144717<_0x15d53a;_0x144717++){var _0x47b0bb=events[_0x144717];var _0x41ed1e=createListener(_0x4002('0x3')+_0x47b0bb,_0x36c011);UserVoiceQueueRtEvents['on'](_0x47b0bb,_0x41ed1e);}}; \ No newline at end of file +var _0x31f0=['emit','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x215470,_0x3ea215){var _0x489b22=function(_0x28195d){while(--_0x28195d){_0x215470['push'](_0x215470['shift']());}};_0x489b22(++_0x3ea215);}(_0x31f0,0xb7));var _0x031f=function(_0x9b82b8,_0x1d3d63){_0x9b82b8=_0x9b82b8-0x0;var _0x353562=_0x31f0[_0x9b82b8];return _0x353562;};'use strict';var UserVoiceQueueRtEvents=require(_0x031f('0x0'));var events=['save',_0x031f('0x1'),'update'];function createListener(_0x3747a5,_0x2021ea){return function(_0x2b04d4){_0x2021ea[_0x031f('0x2')](_0x3747a5,_0x2b04d4);};}function removeListener(_0x526a45,_0x3c0612){return function(){UserVoiceQueueRtEvents[_0x031f('0x3')](_0x526a45,_0x3c0612);};}exports['register']=function(_0x4c0f94){for(var _0x56328c=0x0,_0x3dc98e=events['length'];_0x56328c<_0x3dc98e;_0x56328c++){var _0x365f59=events[_0x56328c];var _0x4300b4=createListener(_0x031f('0x4')+_0x365f59,_0x4c0f94);UserVoiceQueueRtEvents['on'](_0x365f59,_0x4300b4);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b1deee5..eda65ce 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5169b9,_0x4933ce){var _0x388646=function(_0xb8d21){while(--_0xb8d21){_0x5169b9['push'](_0x5169b9['shift']());}};_0x388646(++_0x4933ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e09ff,_0x361bf3){_0x5e09ff=_0x5e09ff-0x0;var _0x294004=_0xedd9[_0x5e09ff];return _0x294004;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x117f2d,_0x232e7a){var _0x2603d9=function(_0x1c54da){while(--_0x1c54da){_0x117f2d['push'](_0x117f2d['shift']());}};_0x2603d9(++_0x232e7a);}(_0x70e0,0x17b));var _0x070e=function(_0x5939c6,_0x2f3a24){_0x5939c6=_0x5939c6-0x0;var _0x56b554=_0x70e0[_0x5939c6];return _0x56b554;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 2435fb3..52564e8 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 _0xe211=['sequelize','exports','INTEGER'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe211,0x19e));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1e21('0x0'));module[_0x1e21('0x1')]={'penalty':{'type':Sequelize[_0x1e21('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20c4=['INTEGER','sequelize'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x20c4,0xb5));var _0x420c=function(_0x56afab,_0x1e0887){_0x56afab=_0x56afab-0x0;var _0x57f2f6=_0x20c4[_0x56afab];return _0x57f2f6;};'use strict';var Sequelize=require(_0x420c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x420c('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 ee811c5..21a96d3 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 _0x8e61=['UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x3d2ad6,_0x2d96cb){var _0x8d0bca=function(_0x516f7f){while(--_0x516f7f){_0x3d2ad6['push'](_0x3d2ad6['shift']());}};_0x8d0bca(++_0x2d96cb);}(_0x8e61,0x65));var _0x18e6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8e61[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18e6('0x0'))('api');var moment=require(_0x18e6('0x1'));var BPromise=require(_0x18e6('0x2'));var rp=require(_0x18e6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18e6('0x4'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x18e6('0x5')]=function(_0x3e3a27,_0x1c0939){return _0x3e3a27[_0x18e6('0x6')](_0x18e6('0x7'),attributes,{'tableName':_0x18e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbce=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xecd63b,_0x45a7dc){var _0x148981=function(_0x491863){while(--_0x491863){_0xecd63b['push'](_0xecd63b['shift']());}};_0x148981(++_0x45a7dc);}(_0xdbce,0x1b3));var _0xedbc=function(_0x2ca185,_0x34fbe7){_0x2ca185=_0x2ca185-0x0;var _0x2749e4=_0xdbce[_0x2ca185];return _0x2749e4;};'use strict';var _=require('lodash');var util=require(_0xedbc('0x0'));var logger=require('../../config/logger')(_0xedbc('0x1'));var moment=require(_0xedbc('0x2'));var BPromise=require(_0xedbc('0x3'));var rp=require(_0xedbc('0x4'));var fs=require('fs');var path=require(_0xedbc('0x5'));var rimraf=require(_0xedbc('0x6'));var config=require(_0xedbc('0x7'));var attributes=require(_0xedbc('0x8'));module[_0xedbc('0x9')]=function(_0x40c6d8,_0x577aef){return _0x40c6d8[_0xedbc('0xa')](_0xedbc('0xb'),attributes,{'tableName':_0xedbc('0xc'),'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 918fd3f..0d12f4c 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 _0xbef0=['request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0xbef0,0x197));var _0x0bef=function(_0xf0c2d,_0x37915e){_0xf0c2d=_0xf0c2d-0x0;var _0x2994dc=_0xbef0[_0xf0c2d];return _0x2994dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bef('0x0'));var BPromise=require(_0x0bef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bef('0x3'));var logger=require('../../config/logger')(_0x0bef('0x4'));var config=require(_0x0bef('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0bef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5f5461,_0x327926,_0xcf097b){return new BPromise(function(_0x57f293,_0x559adc){return client[_0x0bef('0x7')](_0x5f5461,_0xcf097b)[_0x0bef('0x8')](function(_0x397b6d){logger['info'](_0x0bef('0x9'),_0x327926,_0x0bef('0xa'));logger['debug'](_0x0bef('0xb'),_0x327926,'request\x20sent',JSON[_0x0bef('0xc')](_0x397b6d));if(_0x397b6d[_0x0bef('0xd')]){if(_0x397b6d['error'][_0x0bef('0xe')]===0x1f4){logger[_0x0bef('0xd')](_0x0bef('0x9'),_0x327926,_0x397b6d[_0x0bef('0xd')]['message']);return _0x559adc(_0x397b6d[_0x0bef('0xd')][_0x0bef('0xf')]);}logger[_0x0bef('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x327926,_0x397b6d[_0x0bef('0xd')][_0x0bef('0xf')]);return _0x57f293(_0x397b6d[_0x0bef('0xd')]['message']);}else{logger[_0x0bef('0x10')](_0x0bef('0x9'),_0x327926,_0x0bef('0xa'));_0x57f293(_0x397b6d['result'][_0x0bef('0xf')]);}})[_0x0bef('0x11')](function(_0x458dc8){logger[_0x0bef('0xd')](_0x0bef('0x9'),_0x327926,_0x458dc8);_0x559adc(_0x458dc8);});});} \ No newline at end of file +var _0xbfb4=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x5be82a,_0x543426){var _0x578cee=function(_0x441860){while(--_0x441860){_0x5be82a['push'](_0x5be82a['shift']());}};_0x578cee(++_0x543426);}(_0xbfb4,0x130));var _0x4bfb=function(_0x48cf51,_0x3cc874){_0x48cf51=_0x48cf51-0x0;var _0x1e2b71=_0xbfb4[_0x48cf51];return _0x1e2b71;};'use strict';var _=require(_0x4bfb('0x0'));var util=require(_0x4bfb('0x1'));var moment=require('moment');var BPromise=require(_0x4bfb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bfb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bfb('0x4'));var logger=require('../../config/logger')(_0x4bfb('0x5'));var config=require(_0x4bfb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4bfb('0x7')][_0x4bfb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x303bf8,_0x9c57fb,_0x60a2c7){return new BPromise(function(_0x15605b,_0x84a995){return client['request'](_0x303bf8,_0x60a2c7)['then'](function(_0x10407b){logger[_0x4bfb('0x9')](_0x4bfb('0xa'),_0x9c57fb,'request\x20sent');logger[_0x4bfb('0xb')](_0x4bfb('0xc'),_0x9c57fb,_0x4bfb('0xd'),JSON['stringify'](_0x10407b));if(_0x10407b[_0x4bfb('0xe')]){if(_0x10407b[_0x4bfb('0xe')][_0x4bfb('0xf')]===0x1f4){logger['error'](_0x4bfb('0xa'),_0x9c57fb,_0x10407b[_0x4bfb('0xe')][_0x4bfb('0x10')]);return _0x84a995(_0x10407b[_0x4bfb('0xe')][_0x4bfb('0x10')]);}logger[_0x4bfb('0xe')](_0x4bfb('0xa'),_0x9c57fb,_0x10407b[_0x4bfb('0xe')][_0x4bfb('0x10')]);return _0x15605b(_0x10407b['error'][_0x4bfb('0x10')]);}else{logger[_0x4bfb('0x9')](_0x4bfb('0xa'),_0x9c57fb,_0x4bfb('0xd'));_0x15605b(_0x10407b[_0x4bfb('0x11')]['message']);}})[_0x4bfb('0x12')](function(_0x51effe){logger[_0x4bfb('0xe')](_0x4bfb('0xa'),_0x9c57fb,_0x51effe);_0x84a995(_0x51effe);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ca71bc7..23389b0 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 _0x692c=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show'];(function(_0x53933b,_0x1be31d){var _0x1e8224=function(_0x531406){while(--_0x531406){_0x53933b['push'](_0x53933b['shift']());}};_0x1e8224(++_0x1be31d);}(_0x692c,0x6a));var _0xc692=function(_0x54ca24,_0x42419e){_0x54ca24=_0x54ca24-0x0;var _0x1db15e=_0x692c[_0x54ca24];return _0x1db15e;};'use strict';var multer=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var path=require(_0xc692('0x2'));var timeout=require(_0xc692('0x3'));var express=require(_0xc692('0x4'));var router=express[_0xc692('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc692('0x6'));var interaction=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var controller=require(_0xc692('0x9'));router[_0xc692('0xa')]('/',auth[_0xc692('0xb')](),controller['index']);router['get'](_0xc692('0xc'),auth[_0xc692('0xb')](),controller[_0xc692('0xd')]);router[_0xc692('0xe')]('/',auth[_0xc692('0xb')](),controller[_0xc692('0xf')]);router[_0xc692('0x10')]('/:id',auth[_0xc692('0xb')](),controller[_0xc692('0x11')]);router[_0xc692('0x12')](_0xc692('0xc'),auth[_0xc692('0xb')](),controller['destroy']);module[_0xc692('0x13')]=router; \ No newline at end of file +var _0x6108=['isAuthenticated','index','post','create','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x161df6,_0x285d45){var _0x4f3a23=function(_0x2bc352){while(--_0x2bc352){_0x161df6['push'](_0x161df6['shift']());}};_0x4f3a23(++_0x285d45);}(_0x6108,0xbc));var _0x8610=function(_0x3bb08a,_0x301439){_0x3bb08a=_0x3bb08a-0x0;var _0x44c499=_0x6108[_0x3bb08a];return _0x44c499;};'use strict';var multer=require(_0x8610('0x0'));var util=require('util');var path=require(_0x8610('0x1'));var timeout=require(_0x8610('0x2'));var express=require(_0x8610('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8610('0x4'));var interaction=require(_0x8610('0x5'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x8610('0x6')]('/',auth[_0x8610('0x7')](),controller[_0x8610('0x8')]);router[_0x8610('0x6')]('/:id',auth[_0x8610('0x7')](),controller['show']);router[_0x8610('0x9')]('/',auth[_0x8610('0x7')](),controller[_0x8610('0xa')]);router['put'](_0x8610('0xb'),auth[_0x8610('0x7')](),controller[_0x8610('0xc')]);router[_0x8610('0xd')](_0x8610('0xb'),auth[_0x8610('0x7')](),controller['destroy']);module[_0x8610('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c15433b..a122df8 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 _0x1228=['STRING','name','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1228,0x7a));var _0x8122=function(_0x41be90,_0x982c24){_0x41be90=_0x41be90-0x0;var _0xee1c82=_0x1228[_0x41be90];return _0xee1c82;};'use strict';var Sequelize=require('sequelize');module[_0x8122('0x0')]={'name':{'type':Sequelize[_0x8122('0x1')],'unique':_0x8122('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8122('0x1')]}}; \ No newline at end of file +var _0xc7c0=['exports','STRING','name'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xc7c0,0x1c8));var _0x0c7c=function(_0x457790,_0x1c5b87){_0x457790=_0x457790-0x0;var _0x26318b=_0xc7c0[_0x457790];return _0x26318b;};'use strict';var Sequelize=require('sequelize');module[_0x0c7c('0x0')]={'name':{'type':Sequelize[_0x0c7c('0x1')],'unique':_0x0c7c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index aa6b42d..c9f44ab 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 _0xc060=['undefined','count','limit','set','json','apply','save','then','Variables','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','error','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0xbb9b40,_0x51b63a){var _0x4cd1b3=function(_0x4c0343){while(--_0x4c0343){_0xbb9b40['push'](_0xbb9b40['shift']());}};_0x4cd1b3(++_0x51b63a);}(_0xc060,0xee));var _0x0c06=function(_0x44b5c1,_0x103513){_0x44b5c1=_0x44b5c1-0x0;var _0x4b5734=_0xc060[_0x44b5c1];return _0x4b5734;};'use strict';var emlformat=require(_0x0c06('0x0'));var rimraf=require(_0x0c06('0x1'));var zipdir=require(_0x0c06('0x2'));var jsonpatch=require(_0x0c06('0x3'));var rp=require(_0x0c06('0x4'));var moment=require(_0x0c06('0x5'));var BPromise=require(_0x0c06('0x6'));var Mustache=require(_0x0c06('0x7'));var util=require(_0x0c06('0x8'));var path=require(_0x0c06('0x9'));var sox=require('sox');var csv=require(_0x0c06('0xa'));var ejs=require(_0x0c06('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c06('0xc'));var squel=require(_0x0c06('0xd'));var crypto=require(_0x0c06('0xe'));var jsforce=require(_0x0c06('0xf'));var deskjs=require(_0x0c06('0x10'));var toCsv=require(_0x0c06('0xa'));var querystring=require(_0x0c06('0x11'));var Papa=require(_0x0c06('0x12'));var Redis=require(_0x0c06('0x13'));var authService=require(_0x0c06('0x14'));var qs=require(_0x0c06('0x15'));var as=require(_0x0c06('0x16'));var hardwareService=require(_0x0c06('0x17'));var logger=require(_0x0c06('0x18'))(_0x0c06('0x19'));var utils=require('../../config/utils');var config=require(_0x0c06('0x1a'));var licenseUtil=require(_0x0c06('0x1b'));var db=require(_0x0c06('0x1c'))['db'];function respondWithStatusCode(_0x296835,_0x10f370){_0x10f370=_0x10f370||0xcc;return function(_0xc3dd71){if(_0xc3dd71){return _0x296835['sendStatus'](_0x10f370);}return _0x296835[_0x0c06('0x1d')](_0x10f370)[_0x0c06('0x1e')]();};}function respondWithResult(_0x4f35de,_0x38ec3f){_0x38ec3f=_0x38ec3f||0xc8;return function(_0x1e2281){if(_0x1e2281){return _0x4f35de[_0x0c06('0x1d')](_0x38ec3f)['json'](_0x1e2281);}};}function respondWithFilteredResult(_0x7b01f6,_0x4d55dc){return function(_0x2b86a5){if(_0x2b86a5){var _0x3451ff=typeof _0x4d55dc[_0x0c06('0x1f')]===_0x0c06('0x20')&&typeof _0x4d55dc['limit']===_0x0c06('0x20');var _0x333abd=_0x2b86a5[_0x0c06('0x21')];var _0x1a5870=_0x3451ff?0x0:_0x4d55dc[_0x0c06('0x1f')];var _0x33bbb1=_0x3451ff?_0x2b86a5['count']:_0x4d55dc[_0x0c06('0x1f')]+_0x4d55dc[_0x0c06('0x22')];var _0x3f6cfb;if(_0x33bbb1>=_0x333abd){_0x33bbb1=_0x333abd;_0x3f6cfb=0xc8;}else{_0x3f6cfb=0xce;}_0x7b01f6[_0x0c06('0x1d')](_0x3f6cfb);return _0x7b01f6[_0x0c06('0x23')]('Content-Range',_0x1a5870+'-'+_0x33bbb1+'/'+_0x333abd)[_0x0c06('0x24')](_0x2b86a5);}return null;};}function patchUpdates(_0x14dd89){return function(_0x34658d){try{jsonpatch[_0x0c06('0x25')](_0x34658d,_0x14dd89,!![]);}catch(_0x1e25bc){return BPromise['reject'](_0x1e25bc);}return _0x34658d[_0x0c06('0x26')]();};}function saveUpdates(_0xc90bca,_0x2900a1){return function(_0x46aeb1){if(_0x46aeb1){return _0x46aeb1['update'](_0xc90bca)['then'](function(_0x1f2831){return _0x1f2831;});}return null;};}function removeEntity(_0x4f2ee0,_0x336fe9){return function(_0x55cd3e){if(_0x55cd3e){return _0x55cd3e['destroy']()[_0x0c06('0x27')](function(){var _0x23ef57=_0x55cd3e['get']({'plain':!![]});var _0xb0c225=_0x0c06('0x28');return db[_0x0c06('0x29')]['destroy']({'where':{'type':_0xb0c225,'resourceId':_0x23ef57['id']}})[_0x0c06('0x27')](function(){return _0x55cd3e;});})[_0x0c06('0x27')](function(){_0x4f2ee0['status'](0xcc)[_0x0c06('0x1e')]();});}};}function handleEntityNotFound(_0x337343,_0x4dbff8){return function(_0x577667){if(!_0x577667){_0x337343['sendStatus'](0x194);}return _0x577667;};}function handleError(_0x3203f4,_0x73c041){_0x73c041=_0x73c041||0x1f4;return function(_0x1bdf09){logger['error'](_0x1bdf09[_0x0c06('0x2a')]);if(_0x1bdf09[_0x0c06('0x2b')]){delete _0x1bdf09[_0x0c06('0x2b')];}_0x3203f4[_0x0c06('0x1d')](_0x73c041)[_0x0c06('0x2c')](_0x1bdf09);};}exports[_0x0c06('0x2d')]=function(_0x479f47,_0x5ecd7c){var _0x2a4181={},_0x20a413={},_0x14ca0c={'count':0x0,'rows':[]};var _0x474b6d=_['map'](db[_0x0c06('0x2e')][_0x0c06('0x2f')],function(_0x3f7e21){return{'name':_0x3f7e21[_0x0c06('0x30')],'type':_0x3f7e21['type'][_0x0c06('0x31')]};});_0x20a413[_0x0c06('0x32')]=_[_0x0c06('0x33')](_0x474b6d,_0x0c06('0x2b'));_0x20a413[_0x0c06('0x34')]=_['keys'](_0x479f47['query']);_0x20a413[_0x0c06('0x35')]=_[_0x0c06('0x36')](_0x20a413[_0x0c06('0x32')],_0x20a413[_0x0c06('0x34')]);_0x2a4181[_0x0c06('0x37')]=_['intersection'](_0x20a413['model'],qs[_0x0c06('0x38')](_0x479f47['query']['fields']));_0x2a4181['attributes']=_0x2a4181[_0x0c06('0x37')][_0x0c06('0x39')]?_0x2a4181[_0x0c06('0x37')]:_0x20a413[_0x0c06('0x32')];if(!_0x479f47[_0x0c06('0x34')][_0x0c06('0x3a')](_0x0c06('0x3b'))){_0x2a4181['limit']=qs['limit'](_0x479f47[_0x0c06('0x34')][_0x0c06('0x22')]);_0x2a4181[_0x0c06('0x1f')]=qs[_0x0c06('0x1f')](_0x479f47[_0x0c06('0x34')][_0x0c06('0x1f')]);}_0x2a4181[_0x0c06('0x3c')]=qs['sort'](_0x479f47[_0x0c06('0x34')][_0x0c06('0x3d')]);_0x2a4181[_0x0c06('0x3e')]=qs[_0x0c06('0x35')](_[_0x0c06('0x3f')](_0x479f47['query'],_0x20a413[_0x0c06('0x35')]),_0x474b6d);if(_0x479f47[_0x0c06('0x34')][_0x0c06('0x40')]){_0x2a4181[_0x0c06('0x3e')]=_[_0x0c06('0x41')](_0x2a4181[_0x0c06('0x3e')],{'$or':_['map'](_0x474b6d,function(_0x40b756){if(_0x40b756[_0x0c06('0x42')]!==_0x0c06('0x43')){var _0x33dbc8={};_0x33dbc8[_0x40b756['name']]={'$like':'%'+_0x479f47[_0x0c06('0x34')][_0x0c06('0x40')]+'%'};return _0x33dbc8;}})});}_0x2a4181=_[_0x0c06('0x41')]({},_0x2a4181,_0x479f47[_0x0c06('0x44')]);var _0x43cc1c={'where':_0x2a4181[_0x0c06('0x3e')]};return db[_0x0c06('0x2e')][_0x0c06('0x21')](_0x43cc1c)[_0x0c06('0x27')](function(_0x28e23a){_0x14ca0c[_0x0c06('0x21')]=_0x28e23a;if(_0x479f47[_0x0c06('0x34')][_0x0c06('0x45')]){_0x2a4181[_0x0c06('0x46')]=[{'all':!![]}];}return db[_0x0c06('0x2e')][_0x0c06('0x47')](_0x2a4181);})['then'](function(_0x4fc1c6){_0x14ca0c[_0x0c06('0x48')]=_0x4fc1c6;return _0x14ca0c;})['then'](respondWithFilteredResult(_0x5ecd7c,_0x2a4181))['catch'](handleError(_0x5ecd7c,null));};exports[_0x0c06('0x49')]=function(_0x295c6d,_0x5191ef){var _0x39383d={'raw':!![],'where':{'id':_0x295c6d[_0x0c06('0x4a')]['id']}},_0x177393={};_0x177393['model']=_[_0x0c06('0x4b')](db[_0x0c06('0x2e')][_0x0c06('0x2f')]);_0x177393[_0x0c06('0x34')]=_['keys'](_0x295c6d[_0x0c06('0x34')]);_0x177393['filters']=_[_0x0c06('0x36')](_0x177393['model'],_0x177393[_0x0c06('0x34')]);_0x39383d['attributes']=_[_0x0c06('0x36')](_0x177393[_0x0c06('0x32')],qs['fields'](_0x295c6d[_0x0c06('0x34')][_0x0c06('0x38')]));_0x39383d[_0x0c06('0x37')]=_0x39383d['attributes'][_0x0c06('0x39')]?_0x39383d[_0x0c06('0x37')]:_0x177393[_0x0c06('0x32')];if(_0x295c6d[_0x0c06('0x34')][_0x0c06('0x45')]){_0x39383d[_0x0c06('0x46')]=[{'all':!![]}];}_0x39383d=_[_0x0c06('0x41')]({},_0x39383d,_0x295c6d[_0x0c06('0x44')]);return db[_0x0c06('0x2e')][_0x0c06('0x4c')](_0x39383d)[_0x0c06('0x27')](handleEntityNotFound(_0x5191ef,null))[_0x0c06('0x27')](respondWithResult(_0x5191ef,null))['catch'](handleError(_0x5191ef,null));};exports[_0x0c06('0x4d')]=function(_0x5833c7,_0x58e2e0){return db['Variable']['create'](_0x5833c7['body'],{})[_0x0c06('0x27')](function(_0x221415){var _0x3fd49c=_0x5833c7['user'][_0x0c06('0x4e')]({'plain':!![]});if(!_0x3fd49c)throw new Error(_0x0c06('0x4f'));if(_0x3fd49c[_0x0c06('0x50')]===_0x0c06('0x51')){var _0x3a75dc=_0x221415[_0x0c06('0x4e')]({'plain':!![]});var _0x5d985a=_0x0c06('0x28');return db[_0x0c06('0x52')][_0x0c06('0x4c')]({'where':{'name':_0x5d985a,'userProfileId':_0x3fd49c[_0x0c06('0x53')]},'raw':!![]})['then'](function(_0x5b2473){if(_0x5b2473&&_0x5b2473[_0x0c06('0x54')]===0x0){return db[_0x0c06('0x29')][_0x0c06('0x4d')]({'name':_0x3a75dc[_0x0c06('0x2b')],'resourceId':_0x3a75dc['id'],'type':_0x5b2473['name'],'sectionId':_0x5b2473['id']},{})[_0x0c06('0x27')](function(){return _0x221415;});}else{return _0x221415;}})[_0x0c06('0x55')](function(_0x4b6420){logger[_0x0c06('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b6420);throw _0x4b6420;});}return _0x221415;})[_0x0c06('0x27')](respondWithResult(_0x58e2e0,0xc9))[_0x0c06('0x55')](handleError(_0x58e2e0,null));};exports[_0x0c06('0x57')]=function(_0x28146b,_0x3a6473){if(_0x28146b['body']['id']){delete _0x28146b[_0x0c06('0x58')]['id'];}return db[_0x0c06('0x2e')][_0x0c06('0x4c')]({'where':{'id':_0x28146b[_0x0c06('0x4a')]['id']}})[_0x0c06('0x27')](handleEntityNotFound(_0x3a6473,null))[_0x0c06('0x27')](saveUpdates(_0x28146b[_0x0c06('0x58')],null))['then'](respondWithResult(_0x3a6473,null))[_0x0c06('0x55')](handleError(_0x3a6473,null));};exports[_0x0c06('0x59')]=function(_0x2ea541,_0x422ddb){return db['Variable'][_0x0c06('0x4c')]({'where':{'id':_0x2ea541['params']['id']}})[_0x0c06('0x27')](handleEntityNotFound(_0x422ddb,null))[_0x0c06('0x27')](removeEntity(_0x422ddb,null))[_0x0c06('0x55')](handleError(_0x422ddb,null));}; \ No newline at end of file +var _0x3cf4=['catch','show','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','name','send','Variable','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','rows'];(function(_0x98417d,_0x2d249c){var _0x51ee3c=function(_0x270644){while(--_0x270644){_0x98417d['push'](_0x98417d['shift']());}};_0x51ee3c(++_0x2d249c);}(_0x3cf4,0x1e2));var _0x43cf=function(_0x135b0d,_0x11e701){_0x135b0d=_0x135b0d-0x0;var _0x13cf57=_0x3cf4[_0x135b0d];return _0x13cf57;};'use strict';var emlformat=require(_0x43cf('0x0'));var rimraf=require(_0x43cf('0x1'));var zipdir=require(_0x43cf('0x2'));var jsonpatch=require(_0x43cf('0x3'));var rp=require('request-promise');var moment=require(_0x43cf('0x4'));var BPromise=require(_0x43cf('0x5'));var Mustache=require(_0x43cf('0x6'));var util=require(_0x43cf('0x7'));var path=require(_0x43cf('0x8'));var sox=require(_0x43cf('0x9'));var csv=require(_0x43cf('0xa'));var ejs=require(_0x43cf('0xb'));var fs=require('fs');var fs_extra=require(_0x43cf('0xc'));var _=require(_0x43cf('0xd'));var squel=require('squel');var crypto=require(_0x43cf('0xe'));var jsforce=require(_0x43cf('0xf'));var deskjs=require(_0x43cf('0x10'));var toCsv=require(_0x43cf('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x43cf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x43cf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43cf('0x13'));var logger=require(_0x43cf('0x14'))(_0x43cf('0x15'));var utils=require('../../config/utils');var config=require(_0x43cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x43cf('0x17'))['db'];function respondWithStatusCode(_0x15c178,_0x48090f){_0x48090f=_0x48090f||0xcc;return function(_0x1c3293){if(_0x1c3293){return _0x15c178['sendStatus'](_0x48090f);}return _0x15c178[_0x43cf('0x18')](_0x48090f)['end']();};}function respondWithResult(_0x2e2c8e,_0x38dd8c){_0x38dd8c=_0x38dd8c||0xc8;return function(_0x300a41){if(_0x300a41){return _0x2e2c8e['status'](_0x38dd8c)[_0x43cf('0x19')](_0x300a41);}};}function respondWithFilteredResult(_0x2c31b8,_0x4f9d3e){return function(_0x47bdb3){if(_0x47bdb3){var _0x53ff85=typeof _0x4f9d3e[_0x43cf('0x1a')]===_0x43cf('0x1b')&&typeof _0x4f9d3e[_0x43cf('0x1c')]===_0x43cf('0x1b');var _0xb12a5f=_0x47bdb3[_0x43cf('0x1d')];var _0x5a458a=_0x53ff85?0x0:_0x4f9d3e[_0x43cf('0x1a')];var _0x4504e3=_0x53ff85?_0x47bdb3['count']:_0x4f9d3e[_0x43cf('0x1a')]+_0x4f9d3e['limit'];var _0x2f1c3b;if(_0x4504e3>=_0xb12a5f){_0x4504e3=_0xb12a5f;_0x2f1c3b=0xc8;}else{_0x2f1c3b=0xce;}_0x2c31b8['status'](_0x2f1c3b);return _0x2c31b8[_0x43cf('0x1e')](_0x43cf('0x1f'),_0x5a458a+'-'+_0x4504e3+'/'+_0xb12a5f)[_0x43cf('0x19')](_0x47bdb3);}return null;};}function patchUpdates(_0x31ec32){return function(_0xc0e90e){try{jsonpatch[_0x43cf('0x20')](_0xc0e90e,_0x31ec32,!![]);}catch(_0x458efc){return BPromise['reject'](_0x458efc);}return _0xc0e90e[_0x43cf('0x21')]();};}function saveUpdates(_0x4c73a7,_0x19cfa5){return function(_0x404008){if(_0x404008){return _0x404008[_0x43cf('0x22')](_0x4c73a7)[_0x43cf('0x23')](function(_0x5792ab){return _0x5792ab;});}return null;};}function removeEntity(_0x18616e,_0x16e756){return function(_0x12ea64){if(_0x12ea64){return _0x12ea64[_0x43cf('0x24')]()[_0x43cf('0x23')](function(){var _0x51fcd3=_0x12ea64[_0x43cf('0x25')]({'plain':!![]});var _0x4f5548=_0x43cf('0x26');return db[_0x43cf('0x27')]['destroy']({'where':{'type':_0x4f5548,'resourceId':_0x51fcd3['id']}})[_0x43cf('0x23')](function(){return _0x12ea64;});})[_0x43cf('0x23')](function(){_0x18616e[_0x43cf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e4a3,_0x566b5c){return function(_0x1e8cbf){if(!_0x1e8cbf){_0x18e4a3[_0x43cf('0x28')](0x194);}return _0x1e8cbf;};}function handleError(_0x46cc13,_0x50fb7b){_0x50fb7b=_0x50fb7b||0x1f4;return function(_0x4e91f9){logger[_0x43cf('0x29')](_0x4e91f9['stack']);if(_0x4e91f9[_0x43cf('0x2a')]){delete _0x4e91f9[_0x43cf('0x2a')];}_0x46cc13[_0x43cf('0x18')](_0x50fb7b)[_0x43cf('0x2b')](_0x4e91f9);};}exports['index']=function(_0x31f732,_0x1b345e){var _0x127079={},_0x31b84b={},_0x255d15={'count':0x0,'rows':[]};var _0x47a748=_['map'](db[_0x43cf('0x2c')]['rawAttributes'],function(_0x2bf99c){return{'name':_0x2bf99c['fieldName'],'type':_0x2bf99c[_0x43cf('0x2d')]['key']};});_0x31b84b['model']=_[_0x43cf('0x2e')](_0x47a748,_0x43cf('0x2a'));_0x31b84b[_0x43cf('0x2f')]=_['keys'](_0x31f732[_0x43cf('0x2f')]);_0x31b84b[_0x43cf('0x30')]=_[_0x43cf('0x31')](_0x31b84b[_0x43cf('0x32')],_0x31b84b[_0x43cf('0x2f')]);_0x127079['attributes']=_[_0x43cf('0x31')](_0x31b84b[_0x43cf('0x32')],qs[_0x43cf('0x33')](_0x31f732['query'][_0x43cf('0x33')]));_0x127079[_0x43cf('0x34')]=_0x127079[_0x43cf('0x34')][_0x43cf('0x35')]?_0x127079['attributes']:_0x31b84b[_0x43cf('0x32')];if(!_0x31f732[_0x43cf('0x2f')][_0x43cf('0x36')](_0x43cf('0x37'))){_0x127079[_0x43cf('0x1c')]=qs[_0x43cf('0x1c')](_0x31f732[_0x43cf('0x2f')][_0x43cf('0x1c')]);_0x127079[_0x43cf('0x1a')]=qs[_0x43cf('0x1a')](_0x31f732[_0x43cf('0x2f')][_0x43cf('0x1a')]);}_0x127079[_0x43cf('0x38')]=qs[_0x43cf('0x39')](_0x31f732['query'][_0x43cf('0x39')]);_0x127079[_0x43cf('0x3a')]=qs[_0x43cf('0x30')](_['pick'](_0x31f732[_0x43cf('0x2f')],_0x31b84b['filters']),_0x47a748);if(_0x31f732[_0x43cf('0x2f')]['filter']){_0x127079[_0x43cf('0x3a')]=_[_0x43cf('0x3b')](_0x127079[_0x43cf('0x3a')],{'$or':_[_0x43cf('0x2e')](_0x47a748,function(_0x34b4a0){if(_0x34b4a0[_0x43cf('0x2d')]!=='VIRTUAL'){var _0x2d69f3={};_0x2d69f3[_0x34b4a0[_0x43cf('0x2a')]]={'$like':'%'+_0x31f732[_0x43cf('0x2f')]['filter']+'%'};return _0x2d69f3;}})});}_0x127079=_[_0x43cf('0x3b')]({},_0x127079,_0x31f732[_0x43cf('0x3c')]);var _0x1b7bd6={'where':_0x127079[_0x43cf('0x3a')]};return db[_0x43cf('0x2c')][_0x43cf('0x1d')](_0x1b7bd6)[_0x43cf('0x23')](function(_0x1ca0ac){_0x255d15['count']=_0x1ca0ac;if(_0x31f732[_0x43cf('0x2f')][_0x43cf('0x3d')]){_0x127079[_0x43cf('0x3e')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x127079);})[_0x43cf('0x23')](function(_0x4b2485){_0x255d15[_0x43cf('0x3f')]=_0x4b2485;return _0x255d15;})[_0x43cf('0x23')](respondWithFilteredResult(_0x1b345e,_0x127079))[_0x43cf('0x40')](handleError(_0x1b345e,null));};exports[_0x43cf('0x41')]=function(_0x42f50b,_0x34feba){var _0x4621a3={'raw':!![],'where':{'id':_0x42f50b['params']['id']}},_0x4b3ec1={};_0x4b3ec1[_0x43cf('0x32')]=_[_0x43cf('0x42')](db['Variable'][_0x43cf('0x43')]);_0x4b3ec1[_0x43cf('0x2f')]=_[_0x43cf('0x42')](_0x42f50b['query']);_0x4b3ec1['filters']=_[_0x43cf('0x31')](_0x4b3ec1[_0x43cf('0x32')],_0x4b3ec1[_0x43cf('0x2f')]);_0x4621a3[_0x43cf('0x34')]=_[_0x43cf('0x31')](_0x4b3ec1[_0x43cf('0x32')],qs[_0x43cf('0x33')](_0x42f50b[_0x43cf('0x2f')][_0x43cf('0x33')]));_0x4621a3[_0x43cf('0x34')]=_0x4621a3[_0x43cf('0x34')][_0x43cf('0x35')]?_0x4621a3[_0x43cf('0x34')]:_0x4b3ec1['model'];if(_0x42f50b['query'][_0x43cf('0x3d')]){_0x4621a3[_0x43cf('0x3e')]=[{'all':!![]}];}_0x4621a3=_[_0x43cf('0x3b')]({},_0x4621a3,_0x42f50b[_0x43cf('0x3c')]);return db[_0x43cf('0x2c')][_0x43cf('0x44')](_0x4621a3)[_0x43cf('0x23')](handleEntityNotFound(_0x34feba,null))[_0x43cf('0x23')](respondWithResult(_0x34feba,null))['catch'](handleError(_0x34feba,null));};exports[_0x43cf('0x45')]=function(_0x2e8139,_0x7ff9e5){return db[_0x43cf('0x2c')][_0x43cf('0x45')](_0x2e8139[_0x43cf('0x46')],{})[_0x43cf('0x23')](function(_0x793ee3){var _0x5c3e29=_0x2e8139[_0x43cf('0x47')][_0x43cf('0x25')]({'plain':!![]});if(!_0x5c3e29)throw new Error(_0x43cf('0x48'));if(_0x5c3e29[_0x43cf('0x49')]==='user'){var _0x185814=_0x793ee3[_0x43cf('0x25')]({'plain':!![]});var _0xc876e5=_0x43cf('0x26');return db[_0x43cf('0x4a')][_0x43cf('0x44')]({'where':{'name':_0xc876e5,'userProfileId':_0x5c3e29['userProfileId']},'raw':!![]})['then'](function(_0x4937d8){if(_0x4937d8&&_0x4937d8[_0x43cf('0x4b')]===0x0){return db[_0x43cf('0x27')][_0x43cf('0x45')]({'name':_0x185814[_0x43cf('0x2a')],'resourceId':_0x185814['id'],'type':_0x4937d8['name'],'sectionId':_0x4937d8['id']},{})[_0x43cf('0x23')](function(){return _0x793ee3;});}else{return _0x793ee3;}})[_0x43cf('0x40')](function(_0x1afe74){logger[_0x43cf('0x29')](_0x43cf('0x4c'),_0x1afe74);throw _0x1afe74;});}return _0x793ee3;})[_0x43cf('0x23')](respondWithResult(_0x7ff9e5,0xc9))['catch'](handleError(_0x7ff9e5,null));};exports[_0x43cf('0x22')]=function(_0x1b4a34,_0x5daa5c){if(_0x1b4a34[_0x43cf('0x46')]['id']){delete _0x1b4a34[_0x43cf('0x46')]['id'];}return db[_0x43cf('0x2c')][_0x43cf('0x44')]({'where':{'id':_0x1b4a34['params']['id']}})[_0x43cf('0x23')](handleEntityNotFound(_0x5daa5c,null))[_0x43cf('0x23')](saveUpdates(_0x1b4a34[_0x43cf('0x46')],null))['then'](respondWithResult(_0x5daa5c,null))['catch'](handleError(_0x5daa5c,null));};exports[_0x43cf('0x24')]=function(_0x3f98aa,_0x29be5d){return db['Variable']['find']({'where':{'id':_0x3f98aa[_0x43cf('0x4d')]['id']}})[_0x43cf('0x23')](handleEntityNotFound(_0x29be5d,null))[_0x43cf('0x23')](removeEntity(_0x29be5d,null))[_0x43cf('0x40')](handleError(_0x29be5d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9aa9edc..07014d9 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 _0xdb6d=['rimraf','../../config/environment','./variable.attributes','define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x32d541,_0xb9712a){var _0x34101f=function(_0x4871dc){while(--_0x4871dc){_0x32d541['push'](_0x32d541['shift']());}};_0x34101f(++_0xb9712a);}(_0xdb6d,0xa1));var _0xddb6=function(_0x16cd9e,_0x518fee){_0x16cd9e=_0x16cd9e-0x0;var _0x431642=_0xdb6d[_0x16cd9e];return _0x431642;};'use strict';var _=require(_0xddb6('0x0'));var util=require(_0xddb6('0x1'));var logger=require(_0xddb6('0x2'))(_0xddb6('0x3'));var moment=require(_0xddb6('0x4'));var BPromise=require(_0xddb6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddb6('0x6'));var rimraf=require(_0xddb6('0x7'));var config=require(_0xddb6('0x8'));var attributes=require(_0xddb6('0x9'));module['exports']=function(_0x19008c,_0x35ba1d){return _0x19008c[_0xddb6('0xa')]('Variable',attributes,{'tableName':_0xddb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5665=['bluebird','request-promise','path','rimraf','./variable.attributes','define','tools_variables','lodash','../../config/logger','moment'];(function(_0x2b356a,_0x558fb0){var _0x4cc1d9=function(_0x547f59){while(--_0x547f59){_0x2b356a['push'](_0x2b356a['shift']());}};_0x4cc1d9(++_0x558fb0);}(_0x5665,0x183));var _0x5566=function(_0x299ab8,_0x37f688){_0x299ab8=_0x299ab8-0x0;var _0x4435d1=_0x5665[_0x299ab8];return _0x4435d1;};'use strict';var _=require(_0x5566('0x0'));var util=require('util');var logger=require(_0x5566('0x1'))('api');var moment=require(_0x5566('0x2'));var BPromise=require(_0x5566('0x3'));var rp=require(_0x5566('0x4'));var fs=require('fs');var path=require(_0x5566('0x5'));var rimraf=require(_0x5566('0x6'));var config=require('../../config/environment');var attributes=require(_0x5566('0x7'));module['exports']=function(_0x1509d7,_0x59c1af){return _0x1509d7[_0x5566('0x8')]('Variable',attributes,{'tableName':_0x5566('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index a9bdcc8..af59e14 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x218a2a,_0x590565){_0x218a2a=_0x218a2a-0x0;var _0x58a012=_0x1cb9[_0x218a2a];return _0x58a012;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0xe14b,0x93));var _0xbe14=function(_0x5f32ab,_0x38674f){_0x5f32ab=_0x5f32ab-0x0;var _0x33d38c=_0xe14b[_0x5f32ab];return _0x33d38c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index db26591..2f37734 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 _0x6a1e=['isAuthenticated','/pull','/restart','restart','/migrations','migrations','express','./version.controller','get','/fetch','canUpdate','fetch'];(function(_0x70d06a,_0x49ae66){var _0x464b4b=function(_0x2ad93e){while(--_0x2ad93e){_0x70d06a['push'](_0x70d06a['shift']());}};_0x464b4b(++_0x49ae66);}(_0x6a1e,0x66));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xe6a1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe6a1('0x1'));router[_0xe6a1('0x2')]('/',controller['index']);router[_0xe6a1('0x2')](_0xe6a1('0x3'),auth['isAuthenticated'](),auth[_0xe6a1('0x4')](),controller[_0xe6a1('0x5')]);router[_0xe6a1('0x2')]('/reset',auth[_0xe6a1('0x6')](),auth['canUpdate'](),controller['reset']);router['get'](_0xe6a1('0x7'),auth[_0xe6a1('0x6')](),auth[_0xe6a1('0x4')](),controller['pull']);router['get'](_0xe6a1('0x8'),auth[_0xe6a1('0x6')](),controller[_0xe6a1('0x9')]);router[_0xe6a1('0x2')](_0xe6a1('0xa'),controller[_0xe6a1('0xb')]);module['exports']=router; \ No newline at end of file +var _0x9bbf=['reset','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get','isAuthenticated','canUpdate','fetch'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x9bbf,0x6e));var _0xf9bb=function(_0x2ce3dd,_0xa12ba){_0x2ce3dd=_0x2ce3dd-0x0;var _0x51e005=_0x9bbf[_0x2ce3dd];return _0x51e005;};'use strict';var express=require(_0xf9bb('0x0'));var router=express[_0xf9bb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf9bb('0x2'));router[_0xf9bb('0x3')]('/',controller['index']);router['get']('/fetch',auth[_0xf9bb('0x4')](),auth[_0xf9bb('0x5')](),controller[_0xf9bb('0x6')]);router[_0xf9bb('0x3')]('/reset',auth['isAuthenticated'](),auth[_0xf9bb('0x5')](),controller[_0xf9bb('0x7')]);router['get']('/pull',auth[_0xf9bb('0x4')](),auth[_0xf9bb('0x5')](),controller['pull']);router[_0xf9bb('0x3')](_0xf9bb('0x8'),auth[_0xf9bb('0x4')](),controller[_0xf9bb('0x9')]);router[_0xf9bb('0x3')](_0xf9bb('0xa'),controller[_0xf9bb('0xb')]);module[_0xf9bb('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index bf167b0..9d4f3eb 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 _0x6cda=['git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','motion2','then','catch','migrations','readdirSync','root','server','length','replace','.js','push','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','fetch','status','json','origin','info','git\x20fetch'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x6cda,0xbb));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0xa6cd('0x0'));var path=require(_0xa6cd('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xa6cd('0x2'))(module,_0xa6cd('0x3'));var compareVersions=require(_0xa6cd('0x4'));var exec=require(_0xa6cd('0x5'))[_0xa6cd('0x6')];var db=require(_0xa6cd('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xa6cd('0x8'));var logger=require(_0xa6cd('0x9'))(_0xa6cd('0xa'));var git=require(_0xa6cd('0xb'))(config['root']);exports['index']=function(_0x2849c8,_0x5cadf9){var _0x6013e1={'current':module[_0xa6cd('0xc')][_0xa6cd('0x3')],'phonebar':0x2};if(_0x2849c8[_0xa6cd('0xd')]&&_0x2849c8[_0xa6cd('0xd')][_0xa6cd('0xe')]){return git[_0xa6cd('0xf')]()['tags'](function(_0xa4bdb9,_0x179199){_0x6013e1['latest']=(_0xa4bdb9?module[_0xa6cd('0xc')][_0xa6cd('0x3')]:_0x179199['latest'])||'2.0.0';return _0x5cadf9[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')](_0x6013e1);});}else{return _0x5cadf9[_0xa6cd('0x10')](0xc8)['json'](_0x6013e1);}};exports['fetch']=function(_0x3eea67,_0x1750eb){return git[_0xa6cd('0xf')]([_0xa6cd('0x12'),'master'],function(_0x34a211){if(_0x34a211){logger['error'](_0x34a211);return _0x1750eb[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x34a211);}logger[_0xa6cd('0x13')](_0xa6cd('0x14'));return _0x1750eb[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x15')});});};exports['reset']=function(_0x2fffae,_0xfe9d5e){return git[_0xa6cd('0x16')](['--hard','FETCH_HEAD'],function(_0x4f4d09){if(_0x4f4d09){logger['error'](_0x4f4d09);return _0xfe9d5e['status'](0x1f4)[_0xa6cd('0x11')](_0x4f4d09);}logger[_0xa6cd('0x13')](_0xa6cd('0x17'));return _0xfe9d5e[_0xa6cd('0x10')](0xc8)['json']({'output':_0xa6cd('0x18')});});};exports[_0xa6cd('0x19')]=function(_0x28a205,_0x5d9356){exec(_0xa6cd('0x1a'),function(_0x52aec2,_0x5993af,_0x4977b8){logger[_0xa6cd('0x13')](_0x5993af);logger[_0xa6cd('0x13')](_0x4977b8);if(_0x52aec2){logger[_0xa6cd('0x1b')](_0x52aec2);return _0x5d9356[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x52aec2);}return _0x5d9356[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0x5993af});});};exports['restart']=function(_0x3f3a48,_0x358eb7){return pm2['restart'](_0xa6cd('0x1c'))[_0xa6cd('0x1d')](function(_0x56ae88){logger['info']('pm2\x20restart\x20motion\x20%s',_0x56ae88);return _0x358eb7[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xa6cd('0x1e')](function(_0x216c68){logger[_0xa6cd('0x1b')](_0x216c68);return _0x358eb7[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x216c68);});};exports[_0xa6cd('0x1f')]=function(_0x303249,_0xe90f8f){var _0x258dbf=fs[_0xa6cd('0x20')](path['join'](config[_0xa6cd('0x21')],_0xa6cd('0x22'),_0xa6cd('0x1f')));var _0x1d81b6=[];for(var _0x5dabb0=0x0;_0x5dabb0<_0x258dbf[_0xa6cd('0x23')];_0x5dabb0++){var _0x53f5d6=_0x258dbf[_0x5dabb0][_0xa6cd('0x24')](_0xa6cd('0x25'),'');if(compareVersions(module[_0xa6cd('0xc')][_0xa6cd('0x3')],_0x53f5d6)===-0x1){_0x1d81b6[_0xa6cd('0x26')](_0x53f5d6);}}if(_0x1d81b6[_0xa6cd('0x23')]){var _0x17963b=_0x1d81b6[_0xa6cd('0x27')](compareVersions);var _0x1a4a30=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xa6cd('0x28'),'columnName':_0xa6cd('0x3')},'migrations':{'params':[db['sequelize'][_0xa6cd('0x29')](),db[_0xa6cd('0x2a')][_0xa6cd('0x2b')],function(){throw new Error(_0xa6cd('0x2c'));}],'path':path[_0xa6cd('0x2d')](config[_0xa6cd('0x21')],'server',_0xa6cd('0x1f')),'pattern':/\.js$/}});_0x1a4a30['up']({'migrations':_[_0xa6cd('0x2e')](_0x17963b,function(_0x2b2586){return _0x2b2586+_0xa6cd('0x25');})})[_0xa6cd('0x1d')](function(){return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x2f')+module[_0xa6cd('0xc')][_0xa6cd('0x3')]+_0xa6cd('0x30')+_[_0xa6cd('0x31')](_0x17963b),'migrations':_[_0xa6cd('0x2d')](_0x17963b)});})[_0xa6cd('0x1e')](function(_0x371177){if(_0x371177 instanceof db[_0xa6cd('0x2a')][_0xa6cd('0x32')]){return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x33')});}else{return _0xe90f8f[_0xa6cd('0x10')](0x1f4)['json'](_0x371177);}});}else{return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x33')});}}; \ No newline at end of file +var _0xaafe=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','exports','sort','Migration','getQueryInterface','constructor','join','map','.js','\x20to\x20','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','version','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then'];(function(_0xd01ac5,_0x3067c1){var _0x48db6f=function(_0x1b66ae){while(--_0x1b66ae){_0xd01ac5['push'](_0xd01ac5['shift']());}};_0x48db6f(++_0x3067c1);}(_0xaafe,0xe3));var _0xeaaf=function(_0x55fe73,_0x1edc4c){_0x55fe73=_0x55fe73-0x0;var _0x1305ae=_0xaafe[_0x55fe73];return _0x1305ae;};'use strict';var Umzug=require(_0xeaaf('0x0'));var path=require(_0xeaaf('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xeaaf('0x2'))(module,'version');var compareVersions=require(_0xeaaf('0x3'));var exec=require(_0xeaaf('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xeaaf('0x5'));var pm2=require(_0xeaaf('0x6'));var logger=require(_0xeaaf('0x7'))(_0xeaaf('0x8'));var git=require(_0xeaaf('0x9'))(config[_0xeaaf('0xa')]);exports[_0xeaaf('0xb')]=function(_0x5820e5,_0x26e2f5){var _0x45455d={'current':module['exports'][_0xeaaf('0xc')],'phonebar':0x2};if(_0x5820e5[_0xeaaf('0xd')]&&_0x5820e5[_0xeaaf('0xd')][_0xeaaf('0xe')]){return git[_0xeaaf('0xf')]()[_0xeaaf('0x10')](function(_0x34cae4,_0x220fab){_0x45455d['latest']=(_0x34cae4?module['exports']['version']:_0x220fab[_0xeaaf('0xe')])||_0xeaaf('0x11');return _0x26e2f5[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')](_0x45455d);});}else{return _0x26e2f5[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')](_0x45455d);}};exports[_0xeaaf('0xf')]=function(_0x3e89ac,_0x142208){return git['fetch']([_0xeaaf('0x14'),'master'],function(_0x38a65d){if(_0x38a65d){logger[_0xeaaf('0x15')](_0x38a65d);return _0x142208[_0xeaaf('0x12')](0x1f4)[_0xeaaf('0x13')](_0x38a65d);}logger[_0xeaaf('0x16')](_0xeaaf('0x17'));return _0x142208['status'](0xc8)['json']({'output':_0xeaaf('0x18')});});};exports[_0xeaaf('0x19')]=function(_0x569844,_0x3d9669){return git[_0xeaaf('0x19')]([_0xeaaf('0x1a'),_0xeaaf('0x1b')],function(_0x119e42){if(_0x119e42){logger[_0xeaaf('0x15')](_0x119e42);return _0x3d9669[_0xeaaf('0x12')](0x1f4)[_0xeaaf('0x13')](_0x119e42);}logger['info'](_0xeaaf('0x1c'));return _0x3d9669[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')]({'output':_0xeaaf('0x1d')});});};exports['pull']=function(_0x172b7c,_0x27fc25){exec('npm\x20install\x20--production',function(_0x43042b,_0xda91ea,_0x5d4e69){logger[_0xeaaf('0x16')](_0xda91ea);logger[_0xeaaf('0x16')](_0x5d4e69);if(_0x43042b){logger[_0xeaaf('0x15')](_0x43042b);return _0x27fc25[_0xeaaf('0x12')](0x1f4)[_0xeaaf('0x13')](_0x43042b);}return _0x27fc25[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')]({'output':_0xda91ea});});};exports[_0xeaaf('0x1e')]=function(_0x48fdf3,_0x13b64a){return pm2[_0xeaaf('0x1e')](_0xeaaf('0x1f'))[_0xeaaf('0x20')](function(_0x35ad58){logger[_0xeaaf('0x16')](_0xeaaf('0x21'),_0x35ad58);return _0x13b64a[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')]({'output':_0xeaaf('0x22')});})[_0xeaaf('0x23')](function(_0x55977c){logger[_0xeaaf('0x15')](_0x55977c);return _0x13b64a['status'](0x1f4)[_0xeaaf('0x13')](_0x55977c);});};exports[_0xeaaf('0x24')]=function(_0x103193,_0x301d2c){var _0x1133dd=fs['readdirSync'](path['join'](config[_0xeaaf('0xa')],_0xeaaf('0x25'),_0xeaaf('0x24')));var _0x1c0bf5=[];for(var _0x33ef52=0x0;_0x33ef52<_0x1133dd[_0xeaaf('0x26')];_0x33ef52++){var _0x4f1eaa=_0x1133dd[_0x33ef52][_0xeaaf('0x27')]('.js','');if(compareVersions(module[_0xeaaf('0x28')][_0xeaaf('0xc')],_0x4f1eaa)===-0x1){_0x1c0bf5['push'](_0x4f1eaa);}}if(_0x1c0bf5[_0xeaaf('0x26')]){var _0x481c2f=_0x1c0bf5[_0xeaaf('0x29')](compareVersions);var _0x268d14=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xeaaf('0x2a'),'columnName':_0xeaaf('0xc')},'migrations':{'params':[db['sequelize'][_0xeaaf('0x2b')](),db['sequelize'][_0xeaaf('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xeaaf('0x2d')](config[_0xeaaf('0xa')],'server',_0xeaaf('0x24')),'pattern':/\.js$/}});_0x268d14['up']({'migrations':_[_0xeaaf('0x2e')](_0x481c2f,function(_0x241a26){return _0x241a26+_0xeaaf('0x2f');})})[_0xeaaf('0x20')](function(){return _0x301d2c[_0xeaaf('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xeaaf('0x28')][_0xeaaf('0xc')]+_0xeaaf('0x30')+_['last'](_0x481c2f),'migrations':_[_0xeaaf('0x2d')](_0x481c2f)});})[_0xeaaf('0x23')](function(_0x4e2388){if(_0x4e2388 instanceof db[_0xeaaf('0x31')][_0xeaaf('0x32')]){return _0x301d2c[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x301d2c[_0xeaaf('0x12')](0x1f4)[_0xeaaf('0x13')](_0x4e2388);}});}else{return _0x301d2c[_0xeaaf('0x12')](0xc8)[_0xeaaf('0x13')]({'output':_0xeaaf('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 154cfb1..3f61b81 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 _0x0bd2=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x1f43ab,_0x389191){var _0x2f8025=function(_0x45f07c){while(--_0x45f07c){_0x1f43ab['push'](_0x1f43ab['shift']());}};_0x2f8025(++_0x389191);}(_0x0bd2,0x16c));var _0x20bd=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x0bd2[_0x1eda20];return _0x31b953;};'use strict';var multer=require('multer');var util=require(_0x20bd('0x0'));var path=require('path');var timeout=require(_0x20bd('0x1'));var express=require(_0x20bd('0x2'));var router=express[_0x20bd('0x3')]();var fs_extra=require(_0x20bd('0x4'));var auth=require(_0x20bd('0x5'));var interaction=require(_0x20bd('0x6'));var config=require(_0x20bd('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x20bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x20bd('0x9')]);router[_0x20bd('0x8')](_0x20bd('0xa'),auth[_0x20bd('0xb')](),controller['describe']);router[_0x20bd('0x8')](_0x20bd('0xc'),auth['isAuthenticated'](),controller[_0x20bd('0xd')]);router['post']('/',auth[_0x20bd('0xb')](),controller[_0x20bd('0xe')]);router[_0x20bd('0xf')]('/:id',auth[_0x20bd('0xb')](),controller[_0x20bd('0x10')]);router[_0x20bd('0x11')](_0x20bd('0xc'),auth[_0x20bd('0xb')](),controller[_0x20bd('0x12')]);module[_0x20bd('0x13')]=router; \ No newline at end of file +var _0x2af3=['util','path','express','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports'];(function(_0x20cf28,_0x324bb8){var _0x4af1e2=function(_0xa6bcb8){while(--_0xa6bcb8){_0x20cf28['push'](_0x20cf28['shift']());}};_0x4af1e2(++_0x324bb8);}(_0x2af3,0x1a0));var _0x32af=function(_0x7f4e44,_0x5b88e9){_0x7f4e44=_0x7f4e44-0x0;var _0x4235c8=_0x2af3[_0x7f4e44];return _0x4235c8;};'use strict';var multer=require('multer');var util=require(_0x32af('0x0'));var path=require(_0x32af('0x1'));var timeout=require('connect-timeout');var express=require(_0x32af('0x2'));var router=express[_0x32af('0x3')]();var fs_extra=require(_0x32af('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32af('0x5'));var controller=require(_0x32af('0x6'));router[_0x32af('0x7')]('/',auth[_0x32af('0x8')](),controller[_0x32af('0x9')]);router[_0x32af('0x7')]('/describe',auth[_0x32af('0x8')](),controller['describe']);router[_0x32af('0x7')](_0x32af('0xa'),auth[_0x32af('0x8')](),controller['show']);router[_0x32af('0xb')]('/',auth[_0x32af('0x8')](),controller[_0x32af('0xc')]);router['put'](_0x32af('0xa'),auth[_0x32af('0x8')](),controller['update']);router[_0x32af('0xd')](_0x32af('0xa'),auth['isAuthenticated'](),controller[_0x32af('0xe')]);module[_0x32af('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 7a4882d..1a3b069 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 _0x4bde=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x485c00,_0x47f062){var _0x209ebb=function(_0x1fa838){while(--_0x1fa838){_0x485c00['push'](_0x485c00['shift']());}};_0x209ebb(++_0x47f062);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x394eaa,_0x3157c3){_0x394eaa=_0x394eaa-0x0;var _0xdd6a6c=_0x4bde[_0x394eaa];return _0xdd6a6c;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'type':{'type':Sequelize[_0xe4bd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'calleridname':{'type':Sequelize[_0xe4bd('0x2')]},'queue':{'type':Sequelize[_0xe4bd('0x2')]},'interface':{'type':Sequelize[_0xe4bd('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe4bd('0x3')]},'holdtime':{'type':Sequelize[_0xe4bd('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe4bd('0x4')]},'agentacw':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe4bd('0x4')]},'reason':{'type':Sequelize[_0xe4bd('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'context':{'type':Sequelize[_0xe4bd('0x2')]},'exten':{'type':Sequelize[_0xe4bd('0x2')]},'priority':{'type':Sequelize[_0xe4bd('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe4bd('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'destlanguage':{'type':Sequelize[_0xe4bd('0x2')]},'destaccountcode':{'type':Sequelize[_0xe4bd('0x2')]},'destcontext':{'type':Sequelize[_0xe4bd('0x2')]},'destexten':{'type':Sequelize[_0xe4bd('0x2')]},'destpriority':{'type':Sequelize[_0xe4bd('0x2')]},'destuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe4bd('0x2')]},'transfer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe4bd('0x2')],'comment':_0xe4bd('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'agententerreason':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x896e=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0x896e,0x1e9));var _0xe896=function(_0x51b4c0,_0x30158f){_0x51b4c0=_0x51b4c0-0x0;var _0x509ec7=_0x896e[_0x51b4c0];return _0x509ec7;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'type':{'type':Sequelize[_0xe896('0x2')]},'uniqueid':{'type':Sequelize[_0xe896('0x2')]},'calleridnum':{'type':Sequelize[_0xe896('0x2')]},'calleridname':{'type':Sequelize[_0xe896('0x2')]},'queue':{'type':Sequelize[_0xe896('0x2')]},'interface':{'type':Sequelize[_0xe896('0x2')]},'membername':{'type':Sequelize[_0xe896('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe896('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe896('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe896('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe896('0x3')]},'holdtime':{'type':Sequelize[_0xe896('0x4')]},'agentcomplete':{'type':Sequelize[_0xe896('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe896('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe896('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe896('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe896('0x4')]},'reason':{'type':Sequelize[_0xe896('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe896('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe896('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe896('0x2')]},'language':{'type':Sequelize[_0xe896('0x2')]},'accountcode':{'type':Sequelize[_0xe896('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe896('0x2')]},'priority':{'type':Sequelize[_0xe896('0x2')]},'destchannel':{'type':Sequelize[_0xe896('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xe896('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe896('0x2')]},'destcalleridname':{'type':Sequelize[_0xe896('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe896('0x2')]},'destlanguage':{'type':Sequelize[_0xe896('0x2')]},'destaccountcode':{'type':Sequelize[_0xe896('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe896('0x2')]},'destuniqueid':{'type':Sequelize[_0xe896('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe896('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe896('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe896('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe896('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1b6bda0..cda8f0c 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(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 1d44f57..fdb4880 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 _0x9f5a=['../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5c499a,_0x11649b){var _0x36a572=function(_0xdeee9c){while(--_0xdeee9c){_0x5c499a['push'](_0x5c499a['shift']());}};_0x36a572(++_0x11649b);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x36387e,_0x2523d2){_0x36387e=_0x36387e-0x0;var _0x97c3e=_0x9f5a[_0x36387e];return _0x97c3e;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))(_0xa9f5('0x3'));var moment=require('moment');var BPromise=require(_0xa9f5('0x4'));var rp=require(_0xa9f5('0x5'));var fs=require('fs');var path=require(_0xa9f5('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f5('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0xa9f5('0x8')]=function(_0x219e89,_0x49e337){return _0x219e89[_0xa9f5('0x9')](_0xa9f5('0xa'),attributes,{'tableName':_0xa9f5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa9f5('0xc'),_0xa9f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x975850,_0x3d0b64){var _0x63b399=function(_0x4fccdf){while(--_0x4fccdf){_0x975850['push'](_0x975850['shift']());}};_0x63b399(++_0x3d0b64);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2719ac,_0x30991d){_0x2719ac=_0x2719ac-0x0;var _0x492662=_0xd6d6[_0x2719ac];return _0x492662;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6d6d('0xe'),_0x6d6d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 38d3b4f..12edc8a 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 _0xcef9=['stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0xcef9,0xb4));var _0x9cef=function(_0xcd3127,_0x304d36){_0xcd3127=_0xcd3127-0x0;var _0x3497cf=_0xcef9[_0xcd3127];return _0x3497cf;};'use strict';var _=require(_0x9cef('0x0'));var util=require(_0x9cef('0x1'));var moment=require('moment');var BPromise=require(_0x9cef('0x2'));var rs=require(_0x9cef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cef('0x4'))['db'];var utils=require(_0x9cef('0x5'));var logger=require(_0x9cef('0x6'))('rpc');var config=require(_0x9cef('0x7'));var jayson=require(_0x9cef('0x8'));var client=jayson[_0x9cef('0x9')][_0x9cef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3687cc,_0x584300,_0x4d5c87){return new BPromise(function(_0x1444fb,_0x5c5ad4){return client[_0x9cef('0xb')](_0x3687cc,_0x4d5c87)[_0x9cef('0xc')](function(_0x270813){logger[_0x9cef('0xd')](_0x9cef('0xe'),_0x584300,_0x9cef('0xf'));logger[_0x9cef('0x10')](_0x9cef('0x11'),_0x584300,_0x9cef('0xf'),JSON[_0x9cef('0x12')](_0x270813));if(_0x270813[_0x9cef('0x13')]){if(_0x270813[_0x9cef('0x13')]['code']===0x1f4){logger[_0x9cef('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x584300,_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);return _0x5c5ad4(_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);}logger['error'](_0x9cef('0xe'),_0x584300,_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);return _0x1444fb(_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);}else{logger[_0x9cef('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x584300,'request\x20sent');_0x1444fb(_0x270813['result'][_0x9cef('0x14')]);}})[_0x9cef('0x15')](function(_0x352663){logger['error'](_0x9cef('0xe'),_0x584300,_0x352663);_0x5c5ad4(_0x352663);});});}exports[_0x9cef('0x16')]=function(_0x480ecd){var _0x1d9805=this;return new Promise(function(_0x433a84,_0xd5355e){return db[_0x9cef('0x17')][_0x9cef('0x18')](_0x480ecd['body'],{'raw':_0x480ecd[_0x9cef('0x19')]?_0x480ecd[_0x9cef('0x19')][_0x9cef('0x1a')]===undefined?!![]:![]:!![]})[_0x9cef('0xc')](function(_0x4a633f){logger[_0x9cef('0xd')](_0x9cef('0x16'),_0x480ecd);logger[_0x9cef('0x10')](_0x9cef('0x16'),_0x480ecd,JSON[_0x9cef('0x12')](_0x4a633f));_0x433a84(_0x4a633f);})[_0x9cef('0x15')](function(_0x1a8bd8){logger[_0x9cef('0x13')](_0x9cef('0x16'),_0x1a8bd8['message'],_0x480ecd);_0xd5355e(_0x1d9805[_0x9cef('0x13')](0x1f4,_0x1a8bd8[_0x9cef('0x14')]));});});};exports[_0x9cef('0x1b')]=function(_0x5af5e6){var _0x404894=this;return new Promise(function(_0x48e244,_0x524470){return db[_0x9cef('0x17')][_0x9cef('0x1c')](_0x5af5e6[_0x9cef('0x1d')],{'raw':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x1e')]||null:null,'attributes':_0x5af5e6['options']?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x1f')]||null:null,'limit':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x20')]||null:null})[_0x9cef('0xc')](function(_0x164029){logger[_0x9cef('0xd')](_0x9cef('0x1b'),_0x5af5e6);logger['debug'](_0x9cef('0x1b'),_0x5af5e6,JSON[_0x9cef('0x12')](_0x164029));_0x48e244(_0x164029);})[_0x9cef('0x15')](function(_0x5a4c75){logger['error'](_0x9cef('0x1b'),_0x5a4c75[_0x9cef('0x14')],_0x5af5e6);_0x524470(_0x404894[_0x9cef('0x13')](0x1f4,_0x5a4c75['message']));});});}; \ No newline at end of file +var _0xa877=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','options','raw','VoiceAgentReport','update','body','where','attributes','limit','UpdateVoiceAgentReport','util','moment','randomstring'];(function(_0xe977c7,_0x54adb1){var _0x587ab0=function(_0x4d9878){while(--_0x4d9878){_0xe977c7['push'](_0xe977c7['shift']());}};_0x587ab0(++_0x54adb1);}(_0xa877,0x1dd));var _0x7a87=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa877[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x7a87('0x0'));var moment=require(_0x7a87('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a87('0x2'));var fs=require('fs');var Redis=require(_0x7a87('0x3'));var db=require(_0x7a87('0x4'))['db'];var utils=require(_0x7a87('0x5'));var logger=require(_0x7a87('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a87('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26fd97,_0x4f9a96,_0x471cc8){return new BPromise(function(_0x53bf4b,_0x146ded){return client[_0x7a87('0x8')](_0x26fd97,_0x471cc8)[_0x7a87('0x9')](function(_0x2d3b06){logger[_0x7a87('0xa')](_0x7a87('0xb'),_0x4f9a96,'request\x20sent');logger[_0x7a87('0xc')](_0x7a87('0xd'),_0x4f9a96,_0x7a87('0xe'),JSON[_0x7a87('0xf')](_0x2d3b06));if(_0x2d3b06[_0x7a87('0x10')]){if(_0x2d3b06[_0x7a87('0x10')][_0x7a87('0x11')]===0x1f4){logger['error'](_0x7a87('0xb'),_0x4f9a96,_0x2d3b06[_0x7a87('0x10')]['message']);return _0x146ded(_0x2d3b06['error']['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x4f9a96,_0x2d3b06[_0x7a87('0x10')][_0x7a87('0x12')]);return _0x53bf4b(_0x2d3b06[_0x7a87('0x10')]['message']);}else{logger['info'](_0x7a87('0xb'),_0x4f9a96,_0x7a87('0xe'));_0x53bf4b(_0x2d3b06['result'][_0x7a87('0x12')]);}})[_0x7a87('0x13')](function(_0x50ef59){logger[_0x7a87('0x10')](_0x7a87('0xb'),_0x4f9a96,_0x50ef59);_0x146ded(_0x50ef59);});});}exports['CreateVoiceAgentReport']=function(_0x3585ac){var _0xba897=this;return new Promise(function(_0x5b3324,_0x34e72f){return db['VoiceAgentReport'][_0x7a87('0x14')](_0x3585ac['body'],{'raw':_0x3585ac[_0x7a87('0x15')]?_0x3585ac['options'][_0x7a87('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x154a15){logger[_0x7a87('0xa')]('CreateVoiceAgentReport',_0x3585ac);logger[_0x7a87('0xc')]('CreateVoiceAgentReport',_0x3585ac,JSON['stringify'](_0x154a15));_0x5b3324(_0x154a15);})['catch'](function(_0xea4d44){logger[_0x7a87('0x10')]('CreateVoiceAgentReport',_0xea4d44['message'],_0x3585ac);_0x34e72f(_0xba897[_0x7a87('0x10')](0x1f4,_0xea4d44[_0x7a87('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x387812){var _0x517b99=this;return new Promise(function(_0x11271f,_0x1ca590){return db[_0x7a87('0x17')][_0x7a87('0x18')](_0x387812[_0x7a87('0x19')],{'raw':_0x387812[_0x7a87('0x15')]?_0x387812['options'][_0x7a87('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x387812['options']?_0x387812[_0x7a87('0x15')][_0x7a87('0x1a')]||null:null,'attributes':_0x387812[_0x7a87('0x15')]?_0x387812['options'][_0x7a87('0x1b')]||null:null,'limit':_0x387812[_0x7a87('0x15')]?_0x387812[_0x7a87('0x15')][_0x7a87('0x1c')]||null:null})[_0x7a87('0x9')](function(_0x3fbb36){logger['info']('UpdateVoiceAgentReport',_0x387812);logger[_0x7a87('0xc')](_0x7a87('0x1d'),_0x387812,JSON[_0x7a87('0xf')](_0x3fbb36));_0x11271f(_0x3fbb36);})['catch'](function(_0x332873){logger[_0x7a87('0x10')](_0x7a87('0x1d'),_0x332873[_0x7a87('0x12')],_0x387812);_0x1ca590(_0x517b99['error'](0x1f4,_0x332873[_0x7a87('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 21650c2..f90d5c3 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 _0xfb22=['put','update','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0xfb22,0x186));var _0x2fb2=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0xfb22[_0x399849];return _0xfbb04;};'use strict';var express=require(_0x2fb2('0x0'));var router=express[_0x2fb2('0x1')]();var auth=require(_0x2fb2('0x2'));var controller=require(_0x2fb2('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2fb2('0x4')]('/describe',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0x6')]);router[_0x2fb2('0x4')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller['show']);router[_0x2fb2('0x8')]('/',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0x9')]);router[_0x2fb2('0xa')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xb')]);router['put']('/with-retry/:id',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xc')]);router[_0x2fb2('0xd')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xe')]);module[_0x2fb2('0xf')]=router; \ No newline at end of file +var _0xce6f=['isAuthenticated','describe','get','/:id','show','post','create','put','update','/with-retry/:id','destroy','exports','express','Router','../../components/auth/service','index','/describe'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0xce6f,0x160));var _0xfce6=function(_0x2d1174,_0x536886){_0x2d1174=_0x2d1174-0x0;var _0x26195f=_0xce6f[_0x2d1174];return _0x26195f;};'use strict';var express=require(_0xfce6('0x0'));var router=express[_0xfce6('0x1')]();var auth=require(_0xfce6('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfce6('0x3')]);router['get'](_0xfce6('0x4'),auth[_0xfce6('0x5')](),controller[_0xfce6('0x6')]);router[_0xfce6('0x7')](_0xfce6('0x8'),auth[_0xfce6('0x5')](),controller[_0xfce6('0x9')]);router[_0xfce6('0xa')]('/',auth[_0xfce6('0x5')](),controller[_0xfce6('0xb')]);router[_0xfce6('0xc')](_0xfce6('0x8'),auth[_0xfce6('0x5')](),controller[_0xfce6('0xd')]);router[_0xfce6('0xc')](_0xfce6('0xe'),auth[_0xfce6('0x5')](),controller['updateWithRetry']);router['delete'](_0xfce6('0x8'),auth[_0xfce6('0x5')](),controller[_0xfce6('0xf')]);module[_0xfce6('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 97f57c5..c1b8539 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 _0x33c4=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x16f073,_0x5888d4){var _0x4594d5=function(_0x31a564){while(--_0x31a564){_0x16f073['push'](_0x16f073['shift']());}};_0x4594d5(++_0x5888d4);}(_0x33c4,0xef));var _0x433c=function(_0x454d6c,_0x4ae444){_0x454d6c=_0x454d6c-0x0;var _0x410af9=_0x33c4[_0x454d6c];return _0x410af9;};'use strict';var Sequelize=require(_0x433c('0x0'));module[_0x433c('0x1')]={'uniqueid':{'type':Sequelize[_0x433c('0x2')]},'type':{'type':Sequelize[_0x433c('0x3')](_0x433c('0x4'),_0x433c('0x5'),_0x433c('0x6'),_0x433c('0x7'),'outbound-fax',_0x433c('0x8'))},'tag':{'type':Sequelize[_0x433c('0x2')]},'accountcode':{'type':Sequelize[_0x433c('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x433c('0x2')]},'destinationcontext':{'type':Sequelize[_0x433c('0x2')]},'callerid':{'type':Sequelize[_0x433c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x433c('0x2')]},'lastapplication':{'type':Sequelize[_0x433c('0x2')]},'lastdata':{'type':Sequelize[_0x433c('0x9')]},'starttime':{'type':Sequelize[_0x433c('0xa')]},'systemanswertime':{'type':Sequelize[_0x433c('0xa')]},'answertime':{'type':Sequelize[_0x433c('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x433c('0xb')]},'billableseconds':{'type':Sequelize[_0x433c('0xb')]},'mohtime':{'type':Sequelize[_0x433c('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x433c('0x2')]},'userfield':{'type':Sequelize[_0x433c('0x2')]},'userDisposition':{'type':Sequelize[_0x433c('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x433c('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x433c('0x2')]},'note':{'type':Sequelize[_0x433c('0x2')]},'prefix':{'type':Sequelize[_0x433c('0x2')]},'routeid':{'type':Sequelize[_0x433c('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7a1=['inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4a7bc8,_0x45dbd4){var _0x1ba04c=function(_0x253e2f){while(--_0x253e2f){_0x4a7bc8['push'](_0x4a7bc8['shift']());}};_0x1ba04c(++_0x45dbd4);}(_0xb7a1,0xe6));var _0x1b7a=function(_0x558767,_0x3a95fe){_0x558767=_0x558767-0x0;var _0x3d37b5=_0xb7a1[_0x558767];return _0x3d37b5;};'use strict';var Sequelize=require(_0x1b7a('0x0'));module[_0x1b7a('0x1')]={'uniqueid':{'type':Sequelize[_0x1b7a('0x2')]},'type':{'type':Sequelize[_0x1b7a('0x3')](_0x1b7a('0x4'),_0x1b7a('0x5'),_0x1b7a('0x6'),_0x1b7a('0x7'),_0x1b7a('0x8'),_0x1b7a('0x9'))},'tag':{'type':Sequelize[_0x1b7a('0x2')]},'accountcode':{'type':Sequelize[_0x1b7a('0x2')]},'source':{'type':Sequelize[_0x1b7a('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1b7a('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x1b7a('0x2')]},'lastdata':{'type':Sequelize[_0x1b7a('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1b7a('0xb')]},'answertime':{'type':Sequelize[_0x1b7a('0xb')]},'endtime':{'type':Sequelize[_0x1b7a('0xb')]},'duration':{'type':Sequelize[_0x1b7a('0xc')]},'billableseconds':{'type':Sequelize[_0x1b7a('0xc')]},'mohtime':{'type':Sequelize[_0x1b7a('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1b7a('0x2')]},'amaflags':{'type':Sequelize[_0x1b7a('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1b7a('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1b7a('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1b7a('0x2')]},'routeid':{'type':Sequelize[_0x1b7a('0xc')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index dbbda54..12440dd 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 _0xa9e0=['create','body','describe','user','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','promise-retry','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','alias','User','findAll','rows','catch','show','params'];(function(_0x37175d,_0x335612){var _0x33dadc=function(_0x2ee0ef){while(--_0x2ee0ef){_0x37175d['push'](_0x37175d['shift']());}};_0x33dadc(++_0x335612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var qs=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x0a9e('0x3'));function respondWithResult(_0x4ce2f1,_0x333808){_0x333808=_0x333808||0xc8;return function(_0x432180){if(_0x432180){return _0x4ce2f1[_0x0a9e('0x4')](_0x333808)[_0x0a9e('0x5')](_0x432180);}};}function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x6')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x7');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x6')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x8')]:_0x57b080[_0x0a9e('0x6')]+_0x57b080[_0x0a9e('0x9')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0x5')](_0x219af0);}return null;};}function saveUpdates(_0x36471c){return function(_0xd5b662){if(_0xd5b662){return _0xd5b662[_0x0a9e('0xa')](_0x36471c)[_0x0a9e('0xb')](function(_0x69aeb7){return _0x69aeb7;});}return null;};}function removeEntity(_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){return _0x4283ce[_0x0a9e('0xc')]()[_0x0a9e('0xb')](function(){_0x5db4b0[_0x0a9e('0x4')](0xcc)[_0x0a9e('0xd')]();});}};}function handleEntityNotFound(_0x4d5611){return function(_0x52a03d){if(!_0x52a03d){_0x4d5611[_0x0a9e('0xe')](0x194);}return _0x52a03d;};}function handleError(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0x1f4;return function(_0x519dfd){logger[_0x0a9e('0xf')](_0x519dfd[_0x0a9e('0x10')]);if(_0x519dfd['name']){delete _0x519dfd[_0x0a9e('0x11')];}_0x5d0880['status'](_0x1985b6)[_0x0a9e('0x12')](_0x519dfd);};}exports[_0x0a9e('0x13')]=function(_0x106033,_0x205fd6){var _0x31b1ca={},_0x2eb11f={},_0x530eb7={'count':0x0,'rows':[]};var _0x20559e=_[_0x0a9e('0x14')](db[_0x0a9e('0x15')][_0x0a9e('0x16')],function(_0x105080){return{'name':_0x105080['fieldName'],'type':_0x105080[_0x0a9e('0x17')][_0x0a9e('0x18')]};});_0x2eb11f['model']=_[_0x0a9e('0x14')](_0x20559e,'name');_0x2eb11f['query']=_[_0x0a9e('0x19')](_0x106033[_0x0a9e('0x1a')]);_0x2eb11f[_0x0a9e('0x1b')]=_[_0x0a9e('0x1c')](_0x2eb11f['model'],_0x2eb11f[_0x0a9e('0x1a')]);_0x31b1ca[_0x0a9e('0x1d')]=_[_0x0a9e('0x1c')](_0x2eb11f[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x1f')]));_0x31b1ca['attributes']=_0x31b1ca['attributes'][_0x0a9e('0x20')]?_0x31b1ca[_0x0a9e('0x1d')]:_0x2eb11f[_0x0a9e('0x1e')];if(!_0x106033[_0x0a9e('0x1a')]['hasOwnProperty'](_0x0a9e('0x21'))){_0x31b1ca['limit']=qs[_0x0a9e('0x9')](_0x106033['query'][_0x0a9e('0x9')]);_0x31b1ca[_0x0a9e('0x6')]=qs[_0x0a9e('0x6')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x6')]);}_0x31b1ca[_0x0a9e('0x22')]=qs[_0x0a9e('0x23')](_0x106033[_0x0a9e('0x1a')]['sort']);_0x31b1ca[_0x0a9e('0x24')]=qs[_0x0a9e('0x1b')](_[_0x0a9e('0x25')](_0x106033[_0x0a9e('0x1a')],_0x2eb11f['filters']),_0x20559e);if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x26')]){_0x31b1ca[_0x0a9e('0x24')]=_[_0x0a9e('0x27')](_0x31b1ca[_0x0a9e('0x24')],{'$or':_[_0x0a9e('0x14')](_0x20559e,function(_0x296f41){if(_0x296f41[_0x0a9e('0x17')]!==_0x0a9e('0x28')){var _0x540530={};_0x540530[_0x296f41[_0x0a9e('0x11')]]={'$like':'%'+_0x106033['query'][_0x0a9e('0x26')]+'%'};return _0x540530;}})});}_0x31b1ca=_[_0x0a9e('0x27')]({},_0x31b1ca,_0x106033[_0x0a9e('0x29')]);var _0x33bdb7={'where':_0x31b1ca[_0x0a9e('0x24')]};return db['VoiceCallReport'][_0x0a9e('0x8')](_0x33bdb7)[_0x0a9e('0xb')](function(_0x40cb85){_0x530eb7[_0x0a9e('0x8')]=_0x40cb85;if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x31b1ca[_0x0a9e('0x2b')]=[{'attributes':['id',_0x0a9e('0x11'),'fullname',_0x0a9e('0x2c')],'model':db['User'],'as':_0x0a9e('0x2d')}];}return db[_0x0a9e('0x15')][_0x0a9e('0x2e')](_0x31b1ca);})[_0x0a9e('0xb')](function(_0x567193){_0x530eb7[_0x0a9e('0x2f')]=_0x567193;return _0x530eb7;})[_0x0a9e('0xb')](respondWithFilteredResult(_0x205fd6,_0x31b1ca))[_0x0a9e('0x30')](handleError(_0x205fd6,null));};exports[_0x0a9e('0x31')]=function(_0x4853b1,_0x54135e){var _0x1e8694={'raw':!![],'where':{'id':_0x4853b1[_0x0a9e('0x32')]['id']}},_0x5640eb={};_0x5640eb[_0x0a9e('0x1e')]=_[_0x0a9e('0x19')](db[_0x0a9e('0x15')]['rawAttributes']);_0x5640eb[_0x0a9e('0x1a')]=_[_0x0a9e('0x19')](_0x4853b1[_0x0a9e('0x1a')]);_0x5640eb['filters']=_[_0x0a9e('0x1c')](_0x5640eb[_0x0a9e('0x1e')],_0x5640eb[_0x0a9e('0x1a')]);_0x1e8694['attributes']=_['intersection'](_0x5640eb[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x4853b1['query'][_0x0a9e('0x1f')]));_0x1e8694[_0x0a9e('0x1d')]=_0x1e8694[_0x0a9e('0x1d')][_0x0a9e('0x20')]?_0x1e8694['attributes']:_0x5640eb['model'];if(_0x4853b1[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x1e8694['include']=[{'all':!![]}];}_0x1e8694=_[_0x0a9e('0x27')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x29')]);return db[_0x0a9e('0x15')]['find'](_0x1e8694)[_0x0a9e('0xb')](handleEntityNotFound(_0x54135e,null))[_0x0a9e('0xb')](respondWithResult(_0x54135e,null))[_0x0a9e('0x30')](handleError(_0x54135e,null));};exports[_0x0a9e('0x33')]=function(_0x13cb1f,_0xeaa5e5){return db[_0x0a9e('0x15')][_0x0a9e('0x33')](_0x13cb1f[_0x0a9e('0x34')],{})[_0x0a9e('0xb')](respondWithResult(_0xeaa5e5,0xc9))[_0x0a9e('0x30')](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0xc')]=function(_0x1a7bce,_0x11ca30){return db[_0x0a9e('0x15')]['find']({'where':{'id':_0x1a7bce['params']['id']}})[_0x0a9e('0xb')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0xb')](removeEntity(_0x11ca30,null))[_0x0a9e('0x30')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x35')]=function(_0x1a69dd,_0xc9a702){return db[_0x0a9e('0x15')][_0x0a9e('0x35')]()[_0x0a9e('0xb')](respondWithResult(_0xc9a702,null))[_0x0a9e('0x30')](handleError(_0xc9a702,null));};function findForUpdate(_0x2c2cb0){return db[_0x0a9e('0x15')]['find']({'where':{'uniqueid':_0x2c2cb0[_0x0a9e('0x32')]['id'],'UserId':{'$or':[null,_0x2c2cb0[_0x0a9e('0x36')]['id']]}}});}exports[_0x0a9e('0xa')]=function(_0xfbd5ad,_0x2e8caf){if(_0xfbd5ad[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0xfbd5ad[_0x0a9e('0x34')]['uniqueid'];}return findForUpdate(_0xfbd5ad)[_0x0a9e('0xb')](handleEntityNotFound(_0x2e8caf,null))['then'](saveUpdates(_0xfbd5ad[_0x0a9e('0x34')],null))[_0x0a9e('0xb')](respondWithResult(_0x2e8caf,null))[_0x0a9e('0x30')](handleError(_0x2e8caf,null));};exports['updateWithRetry']=function(_0x14bec2,_0x7f6eb1){if(_0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')];}promiseRetry(function(_0x45bf7f){return findForUpdate(_0x14bec2)['then'](function(_0x13f44d){if(_0x13f44d!==null){return _0x13f44d;}else{_0x45bf7f(new Error(_0x0a9e('0x38')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x0a9e('0xb')](function(_0x16f976){return _0x16f976[_0x0a9e('0xa')](_0x14bec2[_0x0a9e('0x34')])[_0x0a9e('0xb')](function(_0x19383e){return respondWithResult(_0x7f6eb1)(_0x19383e);});},function(){handleEntityNotFound(_0x7f6eb1)();})[_0x0a9e('0x30')](function(){handleEntityNotFound(_0x7f6eb1)();});}; \ No newline at end of file +var _0xf06c=['intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','alias','User','rows','show','rawAttributes','options','find','catch','create','describe','params','user','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','undefined','offset','limit','status','Content-Range','update','then','destroy','error','name','index','map','VoiceCallReport','fieldName','key','model','query','keys','filters'];(function(_0x56f55e,_0x3b07d4){var _0x2e2ee3=function(_0x31e62a){while(--_0x31e62a){_0x56f55e['push'](_0x56f55e['shift']());}};_0x2e2ee3(++_0x3b07d4);}(_0xf06c,0xc7));var _0xcf06=function(_0x5dc81f,_0x20eb12){_0x5dc81f=_0x5dc81f-0x0;var _0x3076c2=_0xf06c[_0x5dc81f];return _0x3076c2;};'use strict';var _=require(_0xcf06('0x0'));var qs=require(_0xcf06('0x1'));var logger=require(_0xcf06('0x2'))(_0xcf06('0x3'));var db=require(_0xcf06('0x4'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x46cadb,_0x2b98f4){_0x2b98f4=_0x2b98f4||0xc8;return function(_0x1d0c26){if(_0x1d0c26){return _0x46cadb['status'](_0x2b98f4)[_0xcf06('0x5')](_0x1d0c26);}};}function respondWithFilteredResult(_0x33e492,_0x3de2dc){return function(_0x4e6799){if(_0x4e6799){var _0x22ac40=typeof _0x3de2dc['offset']===_0xcf06('0x6')&&typeof _0x3de2dc['limit']==='undefined';var _0x4b9c65=_0x4e6799['count'];var _0x6ecf1a=_0x22ac40?0x0:_0x3de2dc[_0xcf06('0x7')];var _0x41dea0=_0x22ac40?_0x4e6799['count']:_0x3de2dc['offset']+_0x3de2dc[_0xcf06('0x8')];var _0x4a4e61;if(_0x41dea0>=_0x4b9c65){_0x41dea0=_0x4b9c65;_0x4a4e61=0xc8;}else{_0x4a4e61=0xce;}_0x33e492[_0xcf06('0x9')](_0x4a4e61);return _0x33e492['set'](_0xcf06('0xa'),_0x6ecf1a+'-'+_0x41dea0+'/'+_0x4b9c65)['json'](_0x4e6799);}return null;};}function saveUpdates(_0x1f2d68){return function(_0x570965){if(_0x570965){return _0x570965[_0xcf06('0xb')](_0x1f2d68)[_0xcf06('0xc')](function(_0x4e7a57){return _0x4e7a57;});}return null;};}function removeEntity(_0x4e62aa){return function(_0x46ab38){if(_0x46ab38){return _0x46ab38[_0xcf06('0xd')]()[_0xcf06('0xc')](function(){_0x4e62aa[_0xcf06('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4f89){return function(_0x4aa0d){if(!_0x4aa0d){_0xd4f89['sendStatus'](0x194);}return _0x4aa0d;};}function handleError(_0x584d2c,_0x15a795){_0x15a795=_0x15a795||0x1f4;return function(_0x4130ce){logger[_0xcf06('0xe')](_0x4130ce['stack']);if(_0x4130ce[_0xcf06('0xf')]){delete _0x4130ce[_0xcf06('0xf')];}_0x584d2c[_0xcf06('0x9')](_0x15a795)['send'](_0x4130ce);};}exports[_0xcf06('0x10')]=function(_0x2a5ef5,_0x24b658){var _0x1aad31={},_0x9117a9={},_0x48886d={'count':0x0,'rows':[]};var _0x471b39=_[_0xcf06('0x11')](db[_0xcf06('0x12')]['rawAttributes'],function(_0x465eed){return{'name':_0x465eed[_0xcf06('0x13')],'type':_0x465eed['type'][_0xcf06('0x14')]};});_0x9117a9[_0xcf06('0x15')]=_['map'](_0x471b39,_0xcf06('0xf'));_0x9117a9[_0xcf06('0x16')]=_[_0xcf06('0x17')](_0x2a5ef5[_0xcf06('0x16')]);_0x9117a9[_0xcf06('0x18')]=_[_0xcf06('0x19')](_0x9117a9[_0xcf06('0x15')],_0x9117a9[_0xcf06('0x16')]);_0x1aad31[_0xcf06('0x1a')]=_[_0xcf06('0x19')](_0x9117a9[_0xcf06('0x15')],qs[_0xcf06('0x1b')](_0x2a5ef5['query']['fields']));_0x1aad31[_0xcf06('0x1a')]=_0x1aad31[_0xcf06('0x1a')][_0xcf06('0x1c')]?_0x1aad31[_0xcf06('0x1a')]:_0x9117a9[_0xcf06('0x15')];if(!_0x2a5ef5[_0xcf06('0x16')]['hasOwnProperty']('nolimit')){_0x1aad31[_0xcf06('0x8')]=qs['limit'](_0x2a5ef5[_0xcf06('0x16')][_0xcf06('0x8')]);_0x1aad31[_0xcf06('0x7')]=qs[_0xcf06('0x7')](_0x2a5ef5[_0xcf06('0x16')][_0xcf06('0x7')]);}_0x1aad31[_0xcf06('0x1d')]=qs[_0xcf06('0x1e')](_0x2a5ef5[_0xcf06('0x16')]['sort']);_0x1aad31[_0xcf06('0x1f')]=qs['filters'](_[_0xcf06('0x20')](_0x2a5ef5[_0xcf06('0x16')],_0x9117a9[_0xcf06('0x18')]),_0x471b39);if(_0x2a5ef5[_0xcf06('0x16')][_0xcf06('0x21')]){_0x1aad31[_0xcf06('0x1f')]=_['merge'](_0x1aad31[_0xcf06('0x1f')],{'$or':_[_0xcf06('0x11')](_0x471b39,function(_0x3b032b){if(_0x3b032b[_0xcf06('0x22')]!==_0xcf06('0x23')){var _0x44d65b={};_0x44d65b[_0x3b032b[_0xcf06('0xf')]]={'$like':'%'+_0x2a5ef5[_0xcf06('0x16')][_0xcf06('0x21')]+'%'};return _0x44d65b;}})});}_0x1aad31=_[_0xcf06('0x24')]({},_0x1aad31,_0x2a5ef5['options']);var _0x3d6a06={'where':_0x1aad31[_0xcf06('0x1f')]};return db[_0xcf06('0x12')][_0xcf06('0x25')](_0x3d6a06)[_0xcf06('0xc')](function(_0x215694){_0x48886d[_0xcf06('0x25')]=_0x215694;if(_0x2a5ef5[_0xcf06('0x16')][_0xcf06('0x26')]){_0x1aad31[_0xcf06('0x27')]=[{'attributes':['id',_0xcf06('0xf'),'fullname',_0xcf06('0x28')],'model':db[_0xcf06('0x29')],'as':'User'}];}return db[_0xcf06('0x12')]['findAll'](_0x1aad31);})[_0xcf06('0xc')](function(_0x3afe27){_0x48886d[_0xcf06('0x2a')]=_0x3afe27;return _0x48886d;})[_0xcf06('0xc')](respondWithFilteredResult(_0x24b658,_0x1aad31))['catch'](handleError(_0x24b658,null));};exports[_0xcf06('0x2b')]=function(_0x1cefe7,_0x442d66){var _0x12350a={'raw':!![],'where':{'id':_0x1cefe7['params']['id']}},_0x3cb9ca={};_0x3cb9ca[_0xcf06('0x15')]=_[_0xcf06('0x17')](db[_0xcf06('0x12')][_0xcf06('0x2c')]);_0x3cb9ca[_0xcf06('0x16')]=_[_0xcf06('0x17')](_0x1cefe7[_0xcf06('0x16')]);_0x3cb9ca[_0xcf06('0x18')]=_[_0xcf06('0x19')](_0x3cb9ca[_0xcf06('0x15')],_0x3cb9ca[_0xcf06('0x16')]);_0x12350a[_0xcf06('0x1a')]=_[_0xcf06('0x19')](_0x3cb9ca[_0xcf06('0x15')],qs[_0xcf06('0x1b')](_0x1cefe7[_0xcf06('0x16')][_0xcf06('0x1b')]));_0x12350a['attributes']=_0x12350a[_0xcf06('0x1a')]['length']?_0x12350a[_0xcf06('0x1a')]:_0x3cb9ca[_0xcf06('0x15')];if(_0x1cefe7[_0xcf06('0x16')]['includeAll']){_0x12350a[_0xcf06('0x27')]=[{'all':!![]}];}_0x12350a=_[_0xcf06('0x24')]({},_0x12350a,_0x1cefe7[_0xcf06('0x2d')]);return db[_0xcf06('0x12')][_0xcf06('0x2e')](_0x12350a)['then'](handleEntityNotFound(_0x442d66,null))['then'](respondWithResult(_0x442d66,null))[_0xcf06('0x2f')](handleError(_0x442d66,null));};exports['create']=function(_0x120dae,_0x40735b){return db[_0xcf06('0x12')][_0xcf06('0x30')](_0x120dae['body'],{})[_0xcf06('0xc')](respondWithResult(_0x40735b,0xc9))[_0xcf06('0x2f')](handleError(_0x40735b,null));};exports[_0xcf06('0xd')]=function(_0x55e56e,_0x2be5ed){return db['VoiceCallReport'][_0xcf06('0x2e')]({'where':{'id':_0x55e56e['params']['id']}})[_0xcf06('0xc')](handleEntityNotFound(_0x2be5ed,null))['then'](removeEntity(_0x2be5ed,null))[_0xcf06('0x2f')](handleError(_0x2be5ed,null));};exports[_0xcf06('0x31')]=function(_0x1927f9,_0x4d6eb2){return db[_0xcf06('0x12')][_0xcf06('0x31')]()[_0xcf06('0xc')](respondWithResult(_0x4d6eb2,null))['catch'](handleError(_0x4d6eb2,null));};function findForUpdate(_0x150555){return db['VoiceCallReport'][_0xcf06('0x2e')]({'where':{'uniqueid':_0x150555[_0xcf06('0x32')]['id'],'UserId':{'$or':[null,_0x150555[_0xcf06('0x33')]['id']]}}});}exports[_0xcf06('0xb')]=function(_0x599ff5,_0x453e48){if(_0x599ff5[_0xcf06('0x34')][_0xcf06('0x35')]){delete _0x599ff5['body'][_0xcf06('0x35')];}return findForUpdate(_0x599ff5)[_0xcf06('0xc')](handleEntityNotFound(_0x453e48,null))['then'](saveUpdates(_0x599ff5[_0xcf06('0x34')],null))[_0xcf06('0xc')](respondWithResult(_0x453e48,null))[_0xcf06('0x2f')](handleError(_0x453e48,null));};exports[_0xcf06('0x36')]=function(_0x3b63cf,_0x4e49ca,_0xdb7e9a){if(_0x3b63cf[_0xcf06('0x34')][_0xcf06('0x35')]){delete _0x3b63cf[_0xcf06('0x34')][_0xcf06('0x35')];}promiseRetry(function(_0x58e6e5){return findForUpdate(_0x3b63cf)[_0xcf06('0xc')](function(_0x49b768){if(_0x49b768!==null){return _0x49b768;}else{_0x58e6e5(new Error(_0xcf06('0x37')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xcf06('0xc')](function(_0x44733f){if(!_0x44733f){return new Promise(function(_0x2c8c72){_0x2c8c72(handleEntityNotFound(_0x4e49ca)());});}else{return _0x44733f[_0xcf06('0xb')](_0x3b63cf['body'])[_0xcf06('0xc')](function(_0x4e45dd){return respondWithResult(_0x4e49ca)(_0x4e45dd);});}},function(){handleEntityNotFound(_0x4e49ca)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c6ad13e..5fd5edc 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 _0x81a5=['path','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9b77f7,_0x285fed){var _0x202162=function(_0x55dfdf){while(--_0x55dfdf){_0x9b77f7['push'](_0x9b77f7['shift']());}};_0x202162(++_0x285fed);}(_0x81a5,0x1c8));var _0x581a=function(_0x4cfca9,_0x5afaf1){_0x4cfca9=_0x4cfca9-0x0;var _0x55f768=_0x81a5[_0x4cfca9];return _0x55f768;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var logger=require(_0x581a('0x2'))(_0x581a('0x3'));var moment=require(_0x581a('0x4'));var BPromise=require(_0x581a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x581a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x21fea7,_0x56065e){return _0x21fea7[_0x581a('0x7')](_0x581a('0x8'),attributes,{'tableName':_0x581a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x581a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ea=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceCallReport.attributes'];(function(_0x11c4b6,_0x572fdb){var _0x2cb405=function(_0xf12cc4){while(--_0xf12cc4){_0x11c4b6['push'](_0x11c4b6['shift']());}};_0x2cb405(++_0x572fdb);}(_0xd8ea,0x10c));var _0xad8e=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0xd8ea[_0x47fa10];return _0x204f30;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var logger=require(_0xad8e('0x2'))(_0xad8e('0x3'));var moment=require('moment');var BPromise=require(_0xad8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad8e('0x5'));var rimraf=require(_0xad8e('0x6'));var config=require('../../config/environment');var attributes=require(_0xad8e('0x7'));module['exports']=function(_0x4307bf,_0x326976){return _0x4307bf[_0xad8e('0x8')](_0xad8e('0x9'),attributes,{'tableName':_0xad8e('0xa'),'paranoid':![],'indexes':[{'fields':[_0xad8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1b43cd9..bbcbeb9 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 _0x1856=['model','attributes','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','findAll','options','raw','limit','include','map'];(function(_0x7bf378,_0x3d2794){var _0xeaaeb4=function(_0x4c0f1d){while(--_0x4c0f1d){_0x7bf378['push'](_0x7bf378['shift']());}};_0xeaaeb4(++_0x3d2794);}(_0x1856,0x121));var _0x6185=function(_0xe42e8,_0x5f38f7){_0xe42e8=_0xe42e8-0x0;var _0x1b4182=_0x1856[_0xe42e8];return _0x1b4182;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var moment=require(_0x6185('0x2'));var BPromise=require('bluebird');var rs=require(_0x6185('0x3'));var fs=require('fs');var Redis=require(_0x6185('0x4'));var db=require(_0x6185('0x5'))['db'];var utils=require(_0x6185('0x6'));var logger=require(_0x6185('0x7'))(_0x6185('0x8'));var config=require(_0x6185('0x9'));var jayson=require(_0x6185('0xa'));var client=jayson[_0x6185('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29dab7,_0x4f3734,_0x2a2788){return new BPromise(function(_0x1e61b0,_0x587f53){return client[_0x6185('0xc')](_0x29dab7,_0x2a2788)[_0x6185('0xd')](function(_0x3aa4d0){logger[_0x6185('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,'request\x20sent');logger[_0x6185('0xf')](_0x6185('0x10'),_0x4f3734,_0x6185('0x11'),JSON[_0x6185('0x12')](_0x3aa4d0));if(_0x3aa4d0[_0x6185('0x13')]){if(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x14')]===0x1f4){logger[_0x6185('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,_0x3aa4d0['error'][_0x6185('0x15')]);return _0x587f53(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);}logger[_0x6185('0x13')](_0x6185('0x16'),_0x4f3734,_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);return _0x1e61b0(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);}else{logger[_0x6185('0xe')](_0x6185('0x16'),_0x4f3734,'request\x20sent');_0x1e61b0(_0x3aa4d0[_0x6185('0x17')][_0x6185('0x15')]);}})[_0x6185('0x18')](function(_0x812ee0){logger[_0x6185('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,_0x812ee0);_0x587f53(_0x812ee0);});});}exports['GetVoiceCallReport']=function(_0x20b08e){var _0x444025=this;return new Promise(function(_0x9bf2de,_0x12c6a4){return db['VoiceCallReport'][_0x6185('0x19')]({'raw':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![],'where':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')]['where']||null:null,'attributes':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')]['attributes']||null:null,'limit':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')][_0x6185('0x1c')]||null:null,'include':_0x20b08e[_0x6185('0x1a')]?_0x20b08e['options'][_0x6185('0x1d')]?_[_0x6185('0x1e')](_0x20b08e[_0x6185('0x1a')][_0x6185('0x1d')],function(_0x4e92fa){return{'model':db[_0x4e92fa[_0x6185('0x1f')]],'as':_0x4e92fa['as'],'attributes':_0x4e92fa[_0x6185('0x20')],'include':_0x4e92fa[_0x6185('0x1d')]?_[_0x6185('0x1e')](_0x4e92fa[_0x6185('0x1d')],function(_0x5d9f45){return{'model':db[_0x5d9f45[_0x6185('0x1f')]],'as':_0x5d9f45['as'],'attributes':_0x5d9f45[_0x6185('0x20')],'include':_0x5d9f45[_0x6185('0x1d')]?_['map'](_0x5d9f45[_0x6185('0x1d')],function(_0x2ff34b){return{'model':db[_0x2ff34b[_0x6185('0x1f')]],'as':_0x2ff34b['as'],'attributes':_0x2ff34b[_0x6185('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6185('0xd')](function(_0x3ae4e7){logger['info'](_0x6185('0x21'),_0x20b08e);logger[_0x6185('0xf')](_0x6185('0x21'),_0x20b08e,JSON[_0x6185('0x12')](_0x3ae4e7));_0x9bf2de(_0x3ae4e7);})[_0x6185('0x18')](function(_0x3f2d34){logger[_0x6185('0x13')](_0x6185('0x21'),_0x3f2d34['message'],_0x20b08e);_0x12c6a4(_0x444025[_0x6185('0x13')](0x1f4,_0x3f2d34[_0x6185('0x15')]));});});};exports[_0x6185('0x22')]=function(_0x3a032a){var _0x69a0a4=this;return new Promise(function(_0x42098f,_0x3202f4){return db[_0x6185('0x23')][_0x6185('0x24')](_0x3a032a[_0x6185('0x25')],{'raw':_0x3a032a[_0x6185('0x1a')]?_0x3a032a[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4105de){logger[_0x6185('0xe')](_0x6185('0x22'),_0x3a032a);logger[_0x6185('0xf')](_0x6185('0x22'),_0x3a032a,JSON[_0x6185('0x12')](_0x4105de));_0x42098f(_0x4105de);})[_0x6185('0x18')](function(_0x3ffb8c){logger[_0x6185('0x13')]('CreateVoiceCallReport',_0x3ffb8c['message'],_0x3a032a);_0x3202f4(_0x69a0a4[_0x6185('0x13')](0x1f4,_0x3ffb8c[_0x6185('0x15')]));});});};exports[_0x6185('0x26')]=function(_0xff92fb){var _0x34e580=this;return new Promise(function(_0x59074b,_0x47d1dc){return db[_0x6185('0x23')]['update'](_0xff92fb[_0x6185('0x25')],{'raw':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x27')]||null:null,'attributes':_0xff92fb['options']?_0xff92fb[_0x6185('0x1a')][_0x6185('0x20')]||null:null,'limit':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x1c')]||null:null})[_0x6185('0xd')](function(_0x1bc86c){logger[_0x6185('0xe')](_0x6185('0x26'),_0xff92fb);logger[_0x6185('0xf')](_0x6185('0x26'),_0xff92fb,JSON['stringify'](_0x1bc86c));_0x59074b(_0x1bc86c);})[_0x6185('0x18')](function(_0xd14b8){logger[_0x6185('0x13')](_0x6185('0x26'),_0xd14b8[_0x6185('0x15')],_0xff92fb);_0x47d1dc(_0x34e580[_0x6185('0x13')](0x1f4,_0xd14b8['message']));});});}; \ No newline at end of file +var _0xace5=['limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','raw','util','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','where','attributes'];(function(_0x5a3feb,_0x76fbd4){var _0x318009=function(_0x125b76){while(--_0x125b76){_0x5a3feb['push'](_0x5a3feb['shift']());}};_0x318009(++_0x76fbd4);}(_0xace5,0x1df));var _0x5ace=function(_0x38e89e,_0x2993f6){_0x38e89e=_0x38e89e-0x0;var _0x105232=_0xace5[_0x38e89e];return _0x105232;};'use strict';var _=require('lodash');var util=require(_0x5ace('0x0'));var moment=require(_0x5ace('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ace('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ace('0x3'))('rpc');var config=require(_0x5ace('0x4'));var jayson=require(_0x5ace('0x5'));var client=jayson[_0x5ace('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c22e1,_0x335fce,_0xf5a570){return new BPromise(function(_0x4cf63e,_0x40dce8){return client[_0x5ace('0x7')](_0x2c22e1,_0xf5a570)[_0x5ace('0x8')](function(_0x2ed91a){logger[_0x5ace('0x9')](_0x5ace('0xa'),_0x335fce,'request\x20sent');logger[_0x5ace('0xb')](_0x5ace('0xc'),_0x335fce,_0x5ace('0xd'),JSON[_0x5ace('0xe')](_0x2ed91a));if(_0x2ed91a[_0x5ace('0xf')]){if(_0x2ed91a[_0x5ace('0xf')][_0x5ace('0x10')]===0x1f4){logger[_0x5ace('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x335fce,_0x2ed91a['error'][_0x5ace('0x11')]);return _0x40dce8(_0x2ed91a[_0x5ace('0xf')][_0x5ace('0x11')]);}logger['error'](_0x5ace('0xa'),_0x335fce,_0x2ed91a[_0x5ace('0xf')][_0x5ace('0x11')]);return _0x4cf63e(_0x2ed91a[_0x5ace('0xf')][_0x5ace('0x11')]);}else{logger[_0x5ace('0x9')](_0x5ace('0xa'),_0x335fce,'request\x20sent');_0x4cf63e(_0x2ed91a[_0x5ace('0x12')][_0x5ace('0x11')]);}})[_0x5ace('0x13')](function(_0x194771){logger[_0x5ace('0xf')](_0x5ace('0xa'),_0x335fce,_0x194771);_0x40dce8(_0x194771);});});}exports['GetVoiceCallReport']=function(_0x365fed){var _0x1b497c=this;return new Promise(function(_0x324cdb,_0x3cb246){return db[_0x5ace('0x14')][_0x5ace('0x15')]({'raw':_0x365fed[_0x5ace('0x16')]?_0x365fed[_0x5ace('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x365fed[_0x5ace('0x16')]?_0x365fed['options'][_0x5ace('0x17')]||null:null,'attributes':_0x365fed['options']?_0x365fed[_0x5ace('0x16')][_0x5ace('0x18')]||null:null,'limit':_0x365fed[_0x5ace('0x16')]?_0x365fed[_0x5ace('0x16')][_0x5ace('0x19')]||null:null,'include':_0x365fed[_0x5ace('0x16')]?_0x365fed[_0x5ace('0x16')][_0x5ace('0x1a')]?_[_0x5ace('0x1b')](_0x365fed[_0x5ace('0x16')][_0x5ace('0x1a')],function(_0x1db9dd){return{'model':db[_0x1db9dd[_0x5ace('0x1c')]],'as':_0x1db9dd['as'],'attributes':_0x1db9dd[_0x5ace('0x18')],'include':_0x1db9dd[_0x5ace('0x1a')]?_['map'](_0x1db9dd[_0x5ace('0x1a')],function(_0x4e8a1e){return{'model':db[_0x4e8a1e[_0x5ace('0x1c')]],'as':_0x4e8a1e['as'],'attributes':_0x4e8a1e['attributes'],'include':_0x4e8a1e[_0x5ace('0x1a')]?_[_0x5ace('0x1b')](_0x4e8a1e[_0x5ace('0x1a')],function(_0x60135a){return{'model':db[_0x60135a[_0x5ace('0x1c')]],'as':_0x60135a['as'],'attributes':_0x60135a[_0x5ace('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5ace('0x8')](function(_0x22eecf){logger['info'](_0x5ace('0x1d'),_0x365fed);logger[_0x5ace('0xb')]('GetVoiceCallReport',_0x365fed,JSON['stringify'](_0x22eecf));_0x324cdb(_0x22eecf);})[_0x5ace('0x13')](function(_0x3e8f28){logger[_0x5ace('0xf')](_0x5ace('0x1d'),_0x3e8f28[_0x5ace('0x11')],_0x365fed);_0x3cb246(_0x1b497c[_0x5ace('0xf')](0x1f4,_0x3e8f28[_0x5ace('0x11')]));});});};exports[_0x5ace('0x1e')]=function(_0x336a31){var _0x251b53=this;return new Promise(function(_0x145f9c,_0x40e92f){return db['VoiceCallReport'][_0x5ace('0x1f')](_0x336a31[_0x5ace('0x20')],{'raw':_0x336a31['options']?_0x336a31[_0x5ace('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5ace('0x8')](function(_0x748615){logger['info'](_0x5ace('0x1e'),_0x336a31);logger['debug']('CreateVoiceCallReport',_0x336a31,JSON['stringify'](_0x748615));_0x145f9c(_0x748615);})[_0x5ace('0x13')](function(_0x3360f5){logger[_0x5ace('0xf')](_0x5ace('0x1e'),_0x3360f5[_0x5ace('0x11')],_0x336a31);_0x40e92f(_0x251b53[_0x5ace('0xf')](0x1f4,_0x3360f5['message']));});});};exports[_0x5ace('0x21')]=function(_0x1767d4){var _0x236119=this;return new Promise(function(_0x21483f,_0x2214a5){return db[_0x5ace('0x14')][_0x5ace('0x22')](_0x1767d4['body'],{'raw':_0x1767d4[_0x5ace('0x16')]?_0x1767d4[_0x5ace('0x16')][_0x5ace('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1767d4[_0x5ace('0x16')]?_0x1767d4[_0x5ace('0x16')]['where']||null:null,'attributes':_0x1767d4['options']?_0x1767d4[_0x5ace('0x16')][_0x5ace('0x18')]||null:null,'limit':_0x1767d4[_0x5ace('0x16')]?_0x1767d4[_0x5ace('0x16')][_0x5ace('0x19')]||null:null})[_0x5ace('0x8')](function(_0x27cff9){logger['info'](_0x5ace('0x21'),_0x1767d4);logger['debug'](_0x5ace('0x21'),_0x1767d4,JSON['stringify'](_0x27cff9));_0x21483f(_0x27cff9);})[_0x5ace('0x13')](function(_0x25fa5e){logger[_0x5ace('0xf')](_0x5ace('0x21'),_0x25fa5e[_0x5ace('0x11')],_0x1767d4);_0x2214a5(_0x236119[_0x5ace('0xf')](0x1f4,_0x25fa5e[_0x5ace('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 352a9d7..965fee4 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 _0x5a03=['isAuthenticated','index','/:id','show','post','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x5a03,0xe5));var _0x35a0=function(_0x33add1,_0x45a7ea){_0x33add1=_0x33add1-0x0;var _0x56aca9=_0x5a03[_0x33add1];return _0x56aca9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35a0('0x0'));var timeout=require(_0x35a0('0x1'));var express=require(_0x35a0('0x2'));var router=express[_0x35a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35a0('0x4'));var interaction=require(_0x35a0('0x5'));var config=require(_0x35a0('0x6'));var controller=require(_0x35a0('0x7'));router[_0x35a0('0x8')]('/',auth[_0x35a0('0x9')](),controller[_0x35a0('0xa')]);router[_0x35a0('0x8')](_0x35a0('0xb'),auth[_0x35a0('0x9')](),controller[_0x35a0('0xc')]);router[_0x35a0('0xd')]('/',auth[_0x35a0('0x9')](),controller['create']);router['put']('/:id',auth[_0x35a0('0x9')](),controller['update']);router[_0x35a0('0xe')](_0x35a0('0xb'),auth[_0x35a0('0x9')](),controller[_0x35a0('0xf')]);module[_0x35a0('0x10')]=router; \ No newline at end of file +var _0xa9e7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x85953f,_0x2decd2){var _0x35a9c5=function(_0x474e91){while(--_0x474e91){_0x85953f['push'](_0x85953f['shift']());}};_0x35a9c5(++_0x2decd2);}(_0xa9e7,0x92));var _0x7a9e=function(_0x13b37c,_0x4f616b){_0x13b37c=_0x13b37c-0x0;var _0x2d13fa=_0xa9e7[_0x13b37c];return _0x2d13fa;};'use strict';var multer=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var path=require(_0x7a9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a9e('0x3'));var router=express[_0x7a9e('0x4')]();var fs_extra=require(_0x7a9e('0x5'));var auth=require(_0x7a9e('0x6'));var interaction=require(_0x7a9e('0x7'));var config=require(_0x7a9e('0x8'));var controller=require(_0x7a9e('0x9'));router[_0x7a9e('0xa')]('/',auth[_0x7a9e('0xb')](),controller[_0x7a9e('0xc')]);router[_0x7a9e('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7a9e('0xb')](),controller[_0x7a9e('0xd')]);router[_0x7a9e('0xe')](_0x7a9e('0xf'),auth[_0x7a9e('0xb')](),controller[_0x7a9e('0x10')]);router[_0x7a9e('0x11')](_0x7a9e('0xf'),auth['isAuthenticated'](),controller[_0x7a9e('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 f0b77fa..56097a1 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 _0x2d51=['options','join','getDataValue','BOOLEAN','STRING','name','setDataValue'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2d51,0x100));var _0x12d5=function(_0x3f771e,_0x3027ec){_0x3f771e=_0x3f771e-0x0;var _0x2436fd=_0x2d51[_0x3f771e];return _0x2436fd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x12d5('0x0')]},'prefix':{'type':Sequelize[_0x12d5('0x0')],'unique':_0x12d5('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x12d5('0x0')],'set':function(_0x525d29){this[_0x12d5('0x2')](_0x12d5('0x3'),_0x525d29?_0x525d29[_0x12d5('0x4')](''):[]);},'get':function(){return this[_0x12d5('0x5')](_0x12d5('0x3'))?this[_0x12d5('0x5')](_0x12d5('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x12d5('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x12d5('0x0')]},'record':{'type':Sequelize[_0x12d5('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x12d5('0x0')]},'description':{'type':Sequelize[_0x12d5('0x0')]}}; \ No newline at end of file +var _0x8d6e=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x8d6e,0x15c));var _0xe8d6=function(_0x4d9248,_0x21e42c){_0x4d9248=_0x4d9248-0x0;var _0x558ecb=_0x8d6e[_0x4d9248];return _0x558ecb;};'use strict';var Sequelize=require(_0xe8d6('0x0'));module[_0xe8d6('0x1')]={'name':{'type':Sequelize[_0xe8d6('0x2')]},'prefix':{'type':Sequelize[_0xe8d6('0x2')],'unique':_0xe8d6('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe8d6('0x2')],'set':function(_0x33c67a){this[_0xe8d6('0x4')](_0xe8d6('0x5'),_0x33c67a?_0x33c67a[_0xe8d6('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xe8d6('0x5'))?this[_0xe8d6('0x7')](_0xe8d6('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0xe8d6('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe8d6('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe8d6('0x2')]},'description':{'type':Sequelize[_0xe8d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5d47423..8a251c2 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 _0x0713=['fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VoiceChanSpy','rows','catch','show','params','keys','fields','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','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','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','index','map'];(function(_0x956671,_0x10d4b5){var _0x460fcd=function(_0x1ca84e){while(--_0x1ca84e){_0x956671['push'](_0x956671['shift']());}};_0x460fcd(++_0x10d4b5);}(_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(){var _0x2793ef=_0xb05b1d[_0x3071('0x29')]({'plain':!![]});var _0x7a4cb4=_0x3071('0x2a');return db[_0x3071('0x2b')]['destroy']({'where':{'type':_0x7a4cb4,'resourceId':_0x2793ef['id']}})[_0x3071('0x27')](function(){return _0xb05b1d;});})[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb1ca,_0x28792d){return function(_0x163604){if(!_0x163604){_0x4fb1ca[_0x3071('0x2c')](0x194);}return _0x163604;};}function handleError(_0x3fa3b8,_0x25b96b){_0x25b96b=_0x25b96b||0x1f4;return function(_0x177b5f){logger[_0x3071('0x2d')](_0x177b5f[_0x3071('0x2e')]);if(_0x177b5f[_0x3071('0x2f')]){delete _0x177b5f[_0x3071('0x2f')];}_0x3fa3b8['status'](_0x25b96b)['send'](_0x177b5f);};}exports[_0x3071('0x30')]=function(_0x149e0d,_0x6ddf96){var _0x40be95={},_0x3f6d90={},_0x29538c={'count':0x0,'rows':[]};var _0x32b6b1=_[_0x3071('0x31')](db['VoiceChanSpy']['rawAttributes'],function(_0x4ab983){return{'name':_0x4ab983[_0x3071('0x32')],'type':_0x4ab983[_0x3071('0x33')]['key']};});_0x3f6d90[_0x3071('0x34')]=_[_0x3071('0x31')](_0x32b6b1,_0x3071('0x2f'));_0x3f6d90[_0x3071('0x35')]=_['keys'](_0x149e0d[_0x3071('0x35')]);_0x3f6d90[_0x3071('0x36')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],_0x3f6d90[_0x3071('0x35')]);_0x40be95[_0x3071('0x38')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],qs['fields'](_0x149e0d[_0x3071('0x35')]['fields']));_0x40be95['attributes']=_0x40be95[_0x3071('0x38')][_0x3071('0x39')]?_0x40be95['attributes']:_0x3f6d90[_0x3071('0x34')];if(!_0x149e0d[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x40be95[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x149e0d['query'][_0x3071('0x20')]);_0x40be95[_0x3071('0x1e')]=qs['offset'](_0x149e0d[_0x3071('0x35')]['offset']);}_0x40be95[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x149e0d['query']['sort']);_0x40be95[_0x3071('0x3e')]=qs[_0x3071('0x36')](_[_0x3071('0x3f')](_0x149e0d['query'],_0x3f6d90[_0x3071('0x36')]),_0x32b6b1);if(_0x149e0d['query'][_0x3071('0x40')]){_0x40be95['where']=_[_0x3071('0x41')](_0x40be95[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x32b6b1,function(_0x3113ef){if(_0x3113ef[_0x3071('0x33')]!=='VIRTUAL'){var _0x53ed25={};_0x53ed25[_0x3113ef[_0x3071('0x2f')]]={'$like':'%'+_0x149e0d[_0x3071('0x35')][_0x3071('0x40')]+'%'};return _0x53ed25;}})});}_0x40be95=_[_0x3071('0x41')]({},_0x40be95,_0x149e0d['options']);var _0x3cfc05={'where':_0x40be95[_0x3071('0x3e')]};return db[_0x3071('0x42')][_0x3071('0x21')](_0x3cfc05)[_0x3071('0x27')](function(_0xb9a4b8){_0x29538c['count']=_0xb9a4b8;if(_0x149e0d[_0x3071('0x35')]['includeAll']){_0x40be95['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x40be95);})[_0x3071('0x27')](function(_0x1be8b6){_0x29538c[_0x3071('0x43')]=_0x1be8b6;return _0x29538c;})[_0x3071('0x27')](respondWithFilteredResult(_0x6ddf96,_0x40be95))[_0x3071('0x44')](handleError(_0x6ddf96,null));};exports[_0x3071('0x45')]=function(_0xa711b5,_0x2e6c70){var _0x56589e={'raw':![],'where':{'id':_0xa711b5[_0x3071('0x46')]['id']}},_0x1e8222={};_0x1e8222[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x42')]['rawAttributes']);_0x1e8222['query']=_[_0x3071('0x47')](_0xa711b5[_0x3071('0x35')]);_0x1e8222[_0x3071('0x36')]=_[_0x3071('0x37')](_0x1e8222[_0x3071('0x34')],_0x1e8222['query']);_0x56589e[_0x3071('0x38')]=_['intersection'](_0x1e8222[_0x3071('0x34')],qs['fields'](_0xa711b5['query'][_0x3071('0x48')]));_0x56589e['attributes']=_0x56589e[_0x3071('0x38')]['length']?_0x56589e[_0x3071('0x38')]:_0x1e8222[_0x3071('0x34')];if(_0xa711b5[_0x3071('0x35')][_0x3071('0x49')]){_0x56589e['include']=[{'all':!![]}];}_0x56589e=_[_0x3071('0x41')]({},_0x56589e,_0xa711b5['options']);return db[_0x3071('0x42')]['find'](_0x56589e)[_0x3071('0x27')](handleEntityNotFound(_0x2e6c70,null))[_0x3071('0x27')](respondWithResult(_0x2e6c70,null))['catch'](handleError(_0x2e6c70,null));};exports[_0x3071('0x4a')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x42')][_0x3071('0x4a')](_0x117e73[_0x3071('0x4b')],{})[_0x3071('0x27')](function(_0x577060){var _0x2c6e4c=_0x117e73[_0x3071('0x4c')][_0x3071('0x29')]({'plain':!![]});if(!_0x2c6e4c)throw new Error(_0x3071('0x4d'));if(_0x2c6e4c['role']===_0x3071('0x4c')){var _0x2aea37=_0x577060[_0x3071('0x29')]({'plain':!![]});var _0x2307dd=_0x3071('0x2a');return db[_0x3071('0x4e')][_0x3071('0x4f')]({'where':{'name':_0x2307dd,'userProfileId':_0x2c6e4c[_0x3071('0x50')]},'raw':!![]})[_0x3071('0x27')](function(_0x886f7){if(_0x886f7&&_0x886f7[_0x3071('0x51')]===0x0){return db[_0x3071('0x2b')][_0x3071('0x4a')]({'name':_0x2aea37[_0x3071('0x2f')],'resourceId':_0x2aea37['id'],'type':_0x886f7[_0x3071('0x2f')],'sectionId':_0x886f7['id']},{})[_0x3071('0x27')](function(){return _0x577060;});}else{return _0x577060;}})['catch'](function(_0x47a438){logger[_0x3071('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a438);throw _0x47a438;});}return _0x577060;})[_0x3071('0x27')](respondWithResult(_0x224a70,0xc9))[_0x3071('0x44')](handleError(_0x224a70,null));};exports[_0x3071('0x26')]=function(_0x514821,_0x1ec428){if(_0x514821[_0x3071('0x4b')]['id']){delete _0x514821['body']['id'];}return db['VoiceChanSpy'][_0x3071('0x4f')]({'where':{'id':_0x514821[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1ec428,null))[_0x3071('0x27')](saveUpdates(_0x514821['body'],null))[_0x3071('0x27')](respondWithResult(_0x1ec428,null))[_0x3071('0x44')](handleError(_0x1ec428,null));};exports[_0x3071('0x28')]=function(_0x41f02a,_0x123323){return db['VoiceChanSpy'][_0x3071('0x4f')]({'where':{'id':_0x41f02a[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x123323,null))[_0x3071('0x27')](removeEntity(_0x123323,null))[_0x3071('0x44')](handleError(_0x123323,null));}; \ No newline at end of file +var _0xbc9d=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','get','UserProfileResource','stack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','name','options','include','VoiceChanSpy','findAll','rows','params','fields','includeAll','find'];(function(_0x58c713,_0x26549e){var _0x4e7afa=function(_0x1b72a1){while(--_0x1b72a1){_0x58c713['push'](_0x58c713['shift']());}};_0x4e7afa(++_0x26549e);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x36f284,_0x24cbd1){_0x36f284=_0x36f284-0x0;var _0x4ea099=_0xbc9d[_0x36f284];return _0x4ea099;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){var _0x32822f=_0x119230[_0xdbc9('0x27')]({'plain':!![]});var _0x3c8c1d='ChanSpies';return db[_0xdbc9('0x28')][_0xdbc9('0x25')]({'where':{'type':_0x3c8c1d,'resourceId':_0x32822f['id']}})[_0xdbc9('0x26')](function(){return _0x119230;});})[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf121e9,_0x2ee00a){return function(_0x5300bd){if(!_0x5300bd){_0xf121e9['sendStatus'](0x194);}return _0x5300bd;};}function handleError(_0x45aebe,_0x278db2){_0x278db2=_0x278db2||0x1f4;return function(_0x473430){logger['error'](_0x473430[_0xdbc9('0x29')]);if(_0x473430['name']){delete _0x473430['name'];}_0x45aebe[_0xdbc9('0x1a')](_0x278db2)['send'](_0x473430);};}exports['index']=function(_0x417b17,_0x20eb4f){var _0x1cb557={},_0x4db824={},_0x35eaf8={'count':0x0,'rows':[]};var _0x22f8aa=_['map'](db['VoiceChanSpy'][_0xdbc9('0x2a')],function(_0x245496){return{'name':_0x245496[_0xdbc9('0x2b')],'type':_0x245496[_0xdbc9('0x2c')][_0xdbc9('0x2d')]};});_0x4db824[_0xdbc9('0x2e')]=_[_0xdbc9('0x2f')](_0x22f8aa,'name');_0x4db824[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x417b17[_0xdbc9('0x30')]);_0x4db824[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x4db824[_0xdbc9('0x2e')],_0x4db824['query']);_0x1cb557[_0xdbc9('0x34')]=_['intersection'](_0x4db824['model'],qs['fields'](_0x417b17['query']['fields']));_0x1cb557[_0xdbc9('0x34')]=_0x1cb557[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1cb557['attributes']:_0x4db824[_0xdbc9('0x2e')];if(!_0x417b17[_0xdbc9('0x30')][_0xdbc9('0x36')](_0xdbc9('0x37'))){_0x1cb557[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x417b17['query'][_0xdbc9('0x1e')]);_0x1cb557[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x417b17['query'][_0xdbc9('0x20')]);}_0x1cb557[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x417b17[_0xdbc9('0x30')]['sort']);_0x1cb557['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x417b17[_0xdbc9('0x30')],_0x4db824[_0xdbc9('0x32')]),_0x22f8aa);if(_0x417b17['query'][_0xdbc9('0x3b')]){_0x1cb557[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1cb557['where'],{'$or':_[_0xdbc9('0x2f')](_0x22f8aa,function(_0x38a2a7){if(_0x38a2a7[_0xdbc9('0x2c')]!=='VIRTUAL'){var _0xa11bc8={};_0xa11bc8[_0x38a2a7[_0xdbc9('0x3e')]]={'$like':'%'+_0x417b17['query']['filter']+'%'};return _0xa11bc8;}})});}_0x1cb557=_[_0xdbc9('0x3d')]({},_0x1cb557,_0x417b17[_0xdbc9('0x3f')]);var _0x387b57={'where':_0x1cb557[_0xdbc9('0x3c')]};return db['VoiceChanSpy'][_0xdbc9('0x1f')](_0x387b57)[_0xdbc9('0x26')](function(_0x577725){_0x35eaf8[_0xdbc9('0x1f')]=_0x577725;if(_0x417b17[_0xdbc9('0x30')]['includeAll']){_0x1cb557[_0xdbc9('0x40')]=[{'all':!![]}];}return db[_0xdbc9('0x41')][_0xdbc9('0x42')](_0x1cb557);})[_0xdbc9('0x26')](function(_0x3ed4de){_0x35eaf8[_0xdbc9('0x43')]=_0x3ed4de;return _0x35eaf8;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x20eb4f,_0x1cb557))['catch'](handleError(_0x20eb4f,null));};exports['show']=function(_0x768856,_0x3b8437){var _0xc77676={'raw':![],'where':{'id':_0x768856[_0xdbc9('0x44')]['id']}},_0x41f56a={};_0x41f56a[_0xdbc9('0x2e')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x41')][_0xdbc9('0x2a')]);_0x41f56a[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x768856['query']);_0x41f56a['filters']=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],_0x41f56a[_0xdbc9('0x30')]);_0xc77676[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],qs[_0xdbc9('0x45')](_0x768856[_0xdbc9('0x30')]['fields']));_0xc77676['attributes']=_0xc77676[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0xc77676[_0xdbc9('0x34')]:_0x41f56a[_0xdbc9('0x2e')];if(_0x768856[_0xdbc9('0x30')][_0xdbc9('0x46')]){_0xc77676[_0xdbc9('0x40')]=[{'all':!![]}];}_0xc77676=_[_0xdbc9('0x3d')]({},_0xc77676,_0x768856[_0xdbc9('0x3f')]);return db['VoiceChanSpy'][_0xdbc9('0x47')](_0xc77676)[_0xdbc9('0x26')](handleEntityNotFound(_0x3b8437,null))['then'](respondWithResult(_0x3b8437,null))['catch'](handleError(_0x3b8437,null));};exports[_0xdbc9('0x48')]=function(_0xc3db3c,_0x133a13){return db['VoiceChanSpy'][_0xdbc9('0x48')](_0xc3db3c[_0xdbc9('0x49')],{})[_0xdbc9('0x26')](function(_0x274607){var _0x5aee83=_0xc3db3c[_0xdbc9('0x4a')][_0xdbc9('0x27')]({'plain':!![]});if(!_0x5aee83)throw new Error(_0xdbc9('0x4b'));if(_0x5aee83[_0xdbc9('0x4c')]==='user'){var _0x3e89f5=_0x274607[_0xdbc9('0x27')]({'plain':!![]});var _0x3f49b7=_0xdbc9('0x4d');return db[_0xdbc9('0x4e')][_0xdbc9('0x47')]({'where':{'name':_0x3f49b7,'userProfileId':_0x5aee83[_0xdbc9('0x4f')]},'raw':!![]})[_0xdbc9('0x26')](function(_0x4b34dd){if(_0x4b34dd&&_0x4b34dd[_0xdbc9('0x50')]===0x0){return db['UserProfileResource'][_0xdbc9('0x48')]({'name':_0x3e89f5[_0xdbc9('0x3e')],'resourceId':_0x3e89f5['id'],'type':_0x4b34dd['name'],'sectionId':_0x4b34dd['id']},{})['then'](function(){return _0x274607;});}else{return _0x274607;}})[_0xdbc9('0x51')](function(_0x4b55df){logger[_0xdbc9('0x52')](_0xdbc9('0x53'),_0x4b55df);throw _0x4b55df;});}return _0x274607;})[_0xdbc9('0x26')](respondWithResult(_0x133a13,0xc9))['catch'](handleError(_0x133a13,null));};exports[_0xdbc9('0x24')]=function(_0x1c52e6,_0x3d8b01){if(_0x1c52e6[_0xdbc9('0x49')]['id']){delete _0x1c52e6[_0xdbc9('0x49')]['id'];}return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x1c52e6[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d8b01,null))['then'](saveUpdates(_0x1c52e6['body'],null))[_0xdbc9('0x26')](respondWithResult(_0x3d8b01,null))[_0xdbc9('0x51')](handleError(_0x3d8b01,null));};exports[_0xdbc9('0x25')]=function(_0x55d8ba,_0x519ac9){return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x55d8ba['params']['id']}})['then'](handleEntityNotFound(_0x519ac9,null))[_0xdbc9('0x26')](removeEntity(_0x519ac9,null))[_0xdbc9('0x51')](handleError(_0x519ac9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 724f5de..9c05815 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 _0x04c5=['auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x25eebd,_0x258e68){var _0x52790b=function(_0x45db39){while(--_0x45db39){_0x25eebd['push'](_0x25eebd['shift']());}};_0x52790b(++_0x258e68);}(_0x04c5,0x102));var _0x504c=function(_0x405ebd,_0x5d56c6){_0x405ebd=_0x405ebd-0x0;var _0x1aada5=_0x04c5[_0x405ebd];return _0x1aada5;};'use strict';var _=require(_0x504c('0x0'));var util=require(_0x504c('0x1'));var BPromise=require('bluebird');var attributes=require(_0x504c('0x2'));var getUserApplications=function(_0x20639b,_0x5aeb80,_0x3d5449){var _0x4ea1cf=0x1;var _0x20b025=[];var _0x1fc09e={'context':_0x5aeb80['context']||'from-sip','exten':util[_0x504c('0x3')](_0x504c('0x4'),_0x20639b[_0x504c('0x5')],_0x3d5449),'type':_0x504c('0x6'),'isApp':![],'ChanSpyId':_0x20639b['id'],'UserId':_0x5aeb80['id']};_0x20b025[_0x504c('0x7')](_['merge']({'app':'Set','appdata':util['format'](_0x504c('0x8'),_0x504c('0x9')),'priority':_0x4ea1cf++},_0x1fc09e));if(_0x20639b[_0x504c('0xa')]){_0x20b025[_0x504c('0x7')](_[_0x504c('0xb')]({'app':_0x504c('0xc'),'appdata':util['format'](_0x504c('0xd'),_0x20639b[_0x504c('0xe')]),'priority':_0x4ea1cf++},_0x1fc09e));}if(_0x20639b[_0x504c('0xf')]){_0x20b025['push'](_[_0x504c('0xb')]({'app':_0x504c('0x10'),'appdata':_0x20639b[_0x504c('0x11')],'priority':_0x4ea1cf++},_0x1fc09e));}_0x20b025[_0x504c('0x7')](_['merge']({'app':'ChanSpy','appdata':util[_0x504c('0x3')](_0x504c('0x12'),_0x5aeb80[_0x504c('0x13')],_0x20639b[_0x504c('0x14')]?_0x20639b[_0x504c('0x14')][_0x504c('0x15')](''):''),'priority':_0x4ea1cf++},_0x1fc09e));if(_0x20639b[_0x504c('0xa')]){_0x20b025['push'](_[_0x504c('0xb')]({'app':_0x504c('0x16'),'priority':_0x4ea1cf++},_0x1fc09e));}return _0x20b025;};var getChanSpyApplications=function(_0x5e49d8,_0x12aab2){var _0x73e0b1=[];for(var _0x430a49=0x0,_0x5941d1=0x1;_0x430a49<_0x12aab2[_0x504c('0x17')];_0x430a49++,_0x5941d1=0x1){_0x73e0b1=_0x73e0b1[_0x504c('0x18')](getUserApplications(_0x5e49d8,_0x12aab2[_0x430a49],_0x12aab2[_0x430a49][_0x504c('0x19')]));if(_0x12aab2[_0x430a49]['internal']!=_0x12aab2[_0x430a49]['name']){_0x73e0b1=_0x73e0b1['concat'](getUserApplications(_0x5e49d8,_0x12aab2[_0x430a49],_0x12aab2[_0x430a49][_0x504c('0x13')]));}}return _0x73e0b1;};var getChanSpyPromise=function(_0x390915,_0x597c1f){return new BPromise(function(_0x42ca96,_0x242c36){return _0x390915[_0x504c('0x1a')][_0x504c('0x1b')]({'attributes':['id',_0x504c('0x13'),_0x504c('0x19')],'where':{'role':_0x504c('0x1c'),'chanspy':!![]},'raw':!![]})[_0x504c('0x1d')](function(_0x323ab1){if(_0x323ab1){return _0x42ca96(getChanSpyApplications(_0x597c1f,_0x323ab1));}return _0x42ca96([]);})[_0x504c('0x1e')](function(_0x47515){_0x242c36(_0x47515);});});};module[_0x504c('0x1f')]=function(_0x2a59be,_0x1e814a){var _0x5b3f51=_0x2a59be[_0x504c('0x20')];return _0x2a59be[_0x504c('0x21')](_0x504c('0x22'),attributes,{'tableName':_0x504c('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x184ba3,_0x24586f,_0x3198b6){return getChanSpyPromise(_0x5b3f51,_0x184ba3)['then'](function(_0x1de49f){if(_0x1de49f&&_0x1de49f['length']){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x25')](_0x1de49f);}})['then'](function(){_0x3198b6();})[_0x504c('0x1e')](function(_0x47514a){_0x3198b6(_0x47514a);});},'afterUpdate':function(_0xa7f691,_0x58e70b,_0x4bdb28){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x26')]({'where':{'ChanSpyId':_0xa7f691['id']}})[_0x504c('0x1d')](function(){return getChanSpyPromise(_0x5b3f51,_0xa7f691);})[_0x504c('0x1d')](function(_0x31fac8){if(_0x31fac8&&_0x31fac8['length']){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x25')](_0x31fac8);}})['then'](function(){_0x4bdb28();})[_0x504c('0x1e')](function(_0x5dfad4){_0x4bdb28(_0x5dfad4);});},'afterDestroy':function(_0x7dac33,_0x52e4cf,_0x3986ae){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x26')]({'where':{'ChanSpyId':_0x7dac33['id']}})[_0x504c('0x1d')](function(){_0x3986ae();})[_0x504c('0x1e')](function(_0xd85e8d){_0x3986ae(_0xd85e8d);});}}});}; \ No newline at end of file +var _0xe6ae=['Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','length','internal','User','findAll','agent','exports','voice_chanspy','then','VoiceExtension','catch','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge'];(function(_0x3393ae,_0x424b2c){var _0xe7fe5=function(_0x38ee3a){while(--_0x38ee3a){_0x3393ae['push'](_0x3393ae['shift']());}};_0xe7fe5(++_0x424b2c);}(_0xe6ae,0xc7));var _0xee6a=function(_0xaf835b,_0x3831bd){_0xaf835b=_0xaf835b-0x0;var _0x54258b=_0xe6ae[_0xaf835b];return _0x54258b;};'use strict';var _=require(_0xee6a('0x0'));var util=require(_0xee6a('0x1'));var BPromise=require(_0xee6a('0x2'));var attributes=require(_0xee6a('0x3'));var getUserApplications=function(_0x149d09,_0x3155d8,_0x36a985){var _0x50b7e4=0x1;var _0x4527cf=[];var _0x7f418d={'context':_0x3155d8[_0xee6a('0x4')]||'from-sip','exten':util[_0xee6a('0x5')](_0xee6a('0x6'),_0x149d09[_0xee6a('0x7')],_0x36a985),'type':_0xee6a('0x8'),'isApp':![],'ChanSpyId':_0x149d09['id'],'UserId':_0x3155d8['id']};_0x4527cf[_0xee6a('0x9')](_[_0xee6a('0xa')]({'app':_0xee6a('0xb'),'appdata':util[_0xee6a('0x5')](_0xee6a('0xc'),_0xee6a('0xd')),'priority':_0x50b7e4++},_0x7f418d));if(_0x149d09[_0xee6a('0xe')]){_0x4527cf[_0xee6a('0x9')](_[_0xee6a('0xa')]({'app':'MixMonitor','appdata':util['format'](_0xee6a('0xf'),_0x149d09[_0xee6a('0x10')]),'priority':_0x50b7e4++},_0x7f418d));}if(_0x149d09[_0xee6a('0x11')]){_0x4527cf[_0xee6a('0x9')](_['merge']({'app':_0xee6a('0x12'),'appdata':_0x149d09[_0xee6a('0x13')],'priority':_0x50b7e4++},_0x7f418d));}_0x4527cf['push'](_[_0xee6a('0xa')]({'app':_0xee6a('0x14'),'appdata':util[_0xee6a('0x5')](_0xee6a('0x15'),_0x3155d8[_0xee6a('0x16')],_0x149d09['options']?_0x149d09['options']['join'](''):''),'priority':_0x50b7e4++},_0x7f418d));if(_0x149d09[_0xee6a('0xe')]){_0x4527cf[_0xee6a('0x9')](_[_0xee6a('0xa')]({'app':'StopMixMonitor','priority':_0x50b7e4++},_0x7f418d));}return _0x4527cf;};var getChanSpyApplications=function(_0x2e700f,_0x12b4ba){var _0x42c369=[];for(var _0xbf2256=0x0,_0x51af1e=0x1;_0xbf2256<_0x12b4ba[_0xee6a('0x17')];_0xbf2256++,_0x51af1e=0x1){_0x42c369=_0x42c369['concat'](getUserApplications(_0x2e700f,_0x12b4ba[_0xbf2256],_0x12b4ba[_0xbf2256]['internal']));if(_0x12b4ba[_0xbf2256][_0xee6a('0x18')]!=_0x12b4ba[_0xbf2256][_0xee6a('0x16')]){_0x42c369=_0x42c369['concat'](getUserApplications(_0x2e700f,_0x12b4ba[_0xbf2256],_0x12b4ba[_0xbf2256][_0xee6a('0x16')]));}}return _0x42c369;};var getChanSpyPromise=function(_0x442cd1,_0x41c3be){return new BPromise(function(_0x3260b1,_0x2939d9){return _0x442cd1[_0xee6a('0x19')][_0xee6a('0x1a')]({'attributes':['id',_0xee6a('0x16'),_0xee6a('0x18')],'where':{'role':_0xee6a('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2b098e){if(_0x2b098e){return _0x3260b1(getChanSpyApplications(_0x41c3be,_0x2b098e));}return _0x3260b1([]);})['catch'](function(_0x2fbc1e){_0x2939d9(_0x2fbc1e);});});};module[_0xee6a('0x1c')]=function(_0x485ce3,_0x125e59){var _0x1c9ffc=_0x485ce3['models'];return _0x485ce3['define']('VoiceChanSpy',attributes,{'tableName':_0xee6a('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5464c7,_0x2fb39f,_0x328cf6){return getChanSpyPromise(_0x1c9ffc,_0x5464c7)[_0xee6a('0x1e')](function(_0x3ef192){if(_0x3ef192&&_0x3ef192['length']){return _0x1c9ffc[_0xee6a('0x1f')]['bulkCreate'](_0x3ef192);}})[_0xee6a('0x1e')](function(){_0x328cf6();})[_0xee6a('0x20')](function(_0x59cfde){_0x328cf6(_0x59cfde);});},'afterUpdate':function(_0x28d64c,_0x577acf,_0x28f299){return _0x1c9ffc[_0xee6a('0x1f')][_0xee6a('0x21')]({'where':{'ChanSpyId':_0x28d64c['id']}})[_0xee6a('0x1e')](function(){return getChanSpyPromise(_0x1c9ffc,_0x28d64c);})[_0xee6a('0x1e')](function(_0x265f8f){if(_0x265f8f&&_0x265f8f['length']){return _0x1c9ffc[_0xee6a('0x1f')][_0xee6a('0x22')](_0x265f8f);}})[_0xee6a('0x1e')](function(){_0x28f299();})['catch'](function(_0x4e8feb){_0x28f299(_0x4e8feb);});},'afterDestroy':function(_0x5d90c0,_0x34ba64,_0x1ce6a1){return _0x1c9ffc[_0xee6a('0x1f')][_0xee6a('0x21')]({'where':{'ChanSpyId':_0x5d90c0['id']}})[_0xee6a('0x1e')](function(){_0x1ce6a1();})[_0xee6a('0x20')](function(_0x26fa60){_0x1ce6a1(_0x26fa60);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3d0892b..fde250d 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 _0x91a7=['message','VoiceChanSpy,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x40ebdb,_0x342055){var _0x1b6544=function(_0x408e46){while(--_0x408e46){_0x40ebdb['push'](_0x40ebdb['shift']());}};_0x1b6544(++_0x342055);}(_0x91a7,0xe7));var _0x791a=function(_0x19794a,_0x44b935){_0x19794a=_0x19794a-0x0;var _0x5a3210=_0x91a7[_0x19794a];return _0x5a3210;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file +var _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x699013,_0x70c42){var _0x3a847e=function(_0x5bfd31){while(--_0x5bfd31){_0x699013['push'](_0x699013['shift']());}};_0x3a847e(++_0x70c42);}(_0x235a,0x1ef));var _0xa235=function(_0x52244f,_0x45830c){_0x52244f=_0x52244f-0x0;var _0x294ef0=_0x235a[_0x52244f];return _0x294ef0;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f258e72..48f7085 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 _0xa3d1=['path','connect-timeout','express','Router','fs-extra','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','util'];(function(_0x4767bf,_0x97cf46){var _0x5e9c95=function(_0x23f670){while(--_0x23f670){_0x4767bf['push'](_0x4767bf['shift']());}};_0x5e9c95(++_0x97cf46);}(_0xa3d1,0x164));var _0x1a3d=function(_0x50c53c,_0x297688){_0x50c53c=_0x50c53c-0x0;var _0x836d51=_0xa3d1[_0x50c53c];return _0x836d51;};'use strict';var multer=require('multer');var util=require(_0x1a3d('0x0'));var path=require(_0x1a3d('0x1'));var timeout=require(_0x1a3d('0x2'));var express=require(_0x1a3d('0x3'));var router=express[_0x1a3d('0x4')]();var fs_extra=require(_0x1a3d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a3d('0x6'));router[_0x1a3d('0x7')]('/',auth[_0x1a3d('0x8')](),controller[_0x1a3d('0x9')]);router[_0x1a3d('0x7')](_0x1a3d('0xa'),auth['isAuthenticated'](),controller[_0x1a3d('0xb')]);router[_0x1a3d('0xc')]('/',auth[_0x1a3d('0x8')](),controller['create']);router[_0x1a3d('0xd')](_0x1a3d('0xa'),auth[_0x1a3d('0x8')](),controller[_0x1a3d('0xe')]);router[_0x1a3d('0xf')](_0x1a3d('0xa'),auth['isAuthenticated'](),controller[_0x1a3d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f7f=['create','/:id','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x45f231,_0xfd8999){var _0x2fcfb1=function(_0xf7dc55){while(--_0xf7dc55){_0x45f231['push'](_0x45f231['shift']());}};_0x2fcfb1(++_0xfd8999);}(_0x9f7f,0x103));var _0xf9f7=function(_0xe82641,_0x3fef45){_0xe82641=_0xe82641-0x0;var _0x318896=_0x9f7f[_0xe82641];return _0x318896;};'use strict';var multer=require('multer');var util=require(_0xf9f7('0x0'));var path=require(_0xf9f7('0x1'));var timeout=require(_0xf9f7('0x2'));var express=require(_0xf9f7('0x3'));var router=express[_0xf9f7('0x4')]();var fs_extra=require(_0xf9f7('0x5'));var auth=require(_0xf9f7('0x6'));var interaction=require(_0xf9f7('0x7'));var config=require(_0xf9f7('0x8'));var controller=require('./voiceContext.controller');router[_0xf9f7('0x9')]('/',auth[_0xf9f7('0xa')](),controller[_0xf9f7('0xb')]);router[_0xf9f7('0x9')]('/:id',auth[_0xf9f7('0xa')](),controller[_0xf9f7('0xc')]);router['post']('/',auth[_0xf9f7('0xa')](),controller[_0xf9f7('0xd')]);router['put'](_0xf9f7('0xe'),auth[_0xf9f7('0xa')](),controller[_0xf9f7('0xf')]);router['delete'](_0xf9f7('0xe'),auth['isAuthenticated'](),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 6158781..beed68d 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 _0x4bbe=['exports','STRING','name','sequelize'];(function(_0x15ca55,_0x541d1a){var _0xaeabff=function(_0x1b0032){while(--_0x1b0032){_0x15ca55['push'](_0x15ca55['shift']());}};_0xaeabff(++_0x541d1a);}(_0x4bbe,0x18f));var _0xe4bb=function(_0x320e93,_0x1381a0){_0x320e93=_0x320e93-0x0;var _0x120f9c=_0x4bbe[_0x320e93];return _0x120f9c;};'use strict';var Sequelize=require(_0xe4bb('0x0'));module[_0xe4bb('0x1')]={'name':{'type':Sequelize[_0xe4bb('0x2')],'unique':_0xe4bb('0x3')},'description':{'type':Sequelize[_0xe4bb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x84fa=['sequelize','exports','STRING','BOOLEAN'];(function(_0x453343,_0x23bd95){var _0x57061c=function(_0x540b4b){while(--_0x540b4b){_0x453343['push'](_0x453343['shift']());}};_0x57061c(++_0x23bd95);}(_0x84fa,0x98));var _0xa84f=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x84fa[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xa84f('0x0'));module[_0xa84f('0x1')]={'name':{'type':Sequelize[_0xa84f('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xa84f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa84f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index e77b748..80495e3 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 _0x1ce6=['message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','readFileSync','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','utf8','render','writeFileSync','root','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0x1ce6,0xb0));var _0x61ce=function(_0x4902ff,_0x383317){_0x4902ff=_0x4902ff-0x0;var _0x3dda9b=_0x1ce6[_0x4902ff];return _0x3dda9b;};'use strict';var emlformat=require(_0x61ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x61ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61ce('0x2'));var BPromise=require(_0x61ce('0x3'));var Mustache=require(_0x61ce('0x4'));var util=require(_0x61ce('0x5'));var path=require(_0x61ce('0x6'));var sox=require('sox');var csv=require(_0x61ce('0x7'));var ejs=require(_0x61ce('0x8'));var fs=require('fs');var fs_extra=require(_0x61ce('0x9'));var _=require(_0x61ce('0xa'));var squel=require('squel');var crypto=require(_0x61ce('0xb'));var jsforce=require(_0x61ce('0xc'));var deskjs=require(_0x61ce('0xd'));var toCsv=require(_0x61ce('0x7'));var querystring=require(_0x61ce('0xe'));var Papa=require(_0x61ce('0xf'));var Redis=require(_0x61ce('0x10'));var authService=require(_0x61ce('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61ce('0x12'));var logger=require(_0x61ce('0x13'))('api');var utils=require(_0x61ce('0x14'));var config=require(_0x61ce('0x15'));var licenseUtil=require(_0x61ce('0x16'));var db=require(_0x61ce('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x61ce('0x18')][_0x61ce('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33ca25,_0x33d5cb,_0x382679,_0x4b4e26){return new BPromise(function(_0x1db75e,_0x25b977){var _0x11ac48=_0x4b4e26||client;return _0x11ac48[_0x61ce('0x1a')](_0x33ca25,_0x382679)[_0x61ce('0x1b')](function(_0x13e882){logger[_0x61ce('0x1c')](_0x61ce('0x1d'),_0x33d5cb,_0x61ce('0x1e'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x33d5cb,_0x61ce('0x1e'),JSON[_0x61ce('0x1f')](_0x13e882));if(_0x13e882[_0x61ce('0x20')]){if(_0x13e882[_0x61ce('0x20')][_0x61ce('0x21')]===0x1f4){logger[_0x61ce('0x20')](_0x61ce('0x1d'),_0x33d5cb,_0x13e882[_0x61ce('0x20')]['message']);return _0x25b977(_0x13e882[_0x61ce('0x20')][_0x61ce('0x22')]);}logger[_0x61ce('0x20')](_0x61ce('0x1d'),_0x33d5cb,_0x13e882[_0x61ce('0x20')]['message']);return _0x1db75e(_0x13e882['error']['message']);}else{logger[_0x61ce('0x1c')](_0x61ce('0x1d'),_0x33d5cb,'request\x20sent');_0x1db75e(_0x13e882[_0x61ce('0x23')]['message']);}})['catch'](function(_0x3987ce){logger['error'](_0x61ce('0x1d'),_0x33d5cb,_0x3987ce);_0x25b977(_0x3987ce);});});}function respondWithStatusCode(_0x28ca69,_0x274401){_0x274401=_0x274401||0xcc;return function(_0x5b554d){if(_0x5b554d){return _0x28ca69[_0x61ce('0x24')](_0x274401);}return _0x28ca69[_0x61ce('0x25')](_0x274401)[_0x61ce('0x26')]();};}function respondWithResult(_0x10e957,_0x103471){_0x103471=_0x103471||0xc8;return function(_0x268ad4){if(_0x268ad4){return _0x10e957[_0x61ce('0x25')](_0x103471)[_0x61ce('0x27')](_0x268ad4);}};}function respondWithFilteredResult(_0x44c3dd,_0x248760){return function(_0x35fcde){if(_0x35fcde){var _0x2bca85=typeof _0x248760[_0x61ce('0x28')]==='undefined'&&typeof _0x248760[_0x61ce('0x29')]===_0x61ce('0x2a');var _0x130129=_0x35fcde[_0x61ce('0x2b')];var _0x1ec538=_0x2bca85?0x0:_0x248760[_0x61ce('0x28')];var _0x2f2484=_0x2bca85?_0x35fcde[_0x61ce('0x2b')]:_0x248760[_0x61ce('0x28')]+_0x248760[_0x61ce('0x29')];var _0x4f5e38;if(_0x2f2484>=_0x130129){_0x2f2484=_0x130129;_0x4f5e38=0xc8;}else{_0x4f5e38=0xce;}_0x44c3dd[_0x61ce('0x25')](_0x4f5e38);return _0x44c3dd[_0x61ce('0x2c')](_0x61ce('0x2d'),_0x1ec538+'-'+_0x2f2484+'/'+_0x130129)['json'](_0x35fcde);}return null;};}function patchUpdates(_0x56c7be){return function(_0xe1f800){try{jsonpatch[_0x61ce('0x2e')](_0xe1f800,_0x56c7be,!![]);}catch(_0x5d2dd7){return BPromise[_0x61ce('0x2f')](_0x5d2dd7);}return _0xe1f800[_0x61ce('0x30')]();};}function saveUpdates(_0x2054b,_0xb51fd9){return function(_0x5ac725){if(_0x5ac725){return _0x5ac725[_0x61ce('0x31')](_0x2054b)[_0x61ce('0x1b')](function(_0x8cfc7f){return _0x8cfc7f;});}return null;};}function removeEntity(_0x5c569a,_0x239599){return function(_0x4d47b6){if(_0x4d47b6){return _0x4d47b6[_0x61ce('0x32')]()[_0x61ce('0x1b')](function(){var _0x240f9f=_0x4d47b6[_0x61ce('0x33')]({'plain':!![]});var _0x1345c3='Contexts';return db[_0x61ce('0x34')][_0x61ce('0x32')]({'where':{'type':_0x1345c3,'resourceId':_0x240f9f['id']}})[_0x61ce('0x1b')](function(){return _0x4d47b6;});})[_0x61ce('0x1b')](function(){_0x5c569a[_0x61ce('0x25')](0xcc)[_0x61ce('0x26')]();});}};}function handleEntityNotFound(_0x377993,_0x251e32){return function(_0x54c231){if(!_0x54c231){_0x377993[_0x61ce('0x24')](0x194);}return _0x54c231;};}function handleError(_0x151a15,_0x197de8){_0x197de8=_0x197de8||0x1f4;return function(_0x2b2967){logger[_0x61ce('0x20')](_0x2b2967[_0x61ce('0x35')]);if(_0x2b2967['name']){delete _0x2b2967[_0x61ce('0x36')];}_0x151a15['status'](_0x197de8)[_0x61ce('0x37')](_0x2b2967);};}exports[_0x61ce('0x38')]=function(_0xcb992d,_0x4858a6){var _0x1e06aa={},_0x43664d={},_0x31c2ca={'count':0x0,'rows':[]};var _0x50be0e=_[_0x61ce('0x39')](db[_0x61ce('0x3a')]['rawAttributes'],function(_0x5a993e){return{'name':_0x5a993e[_0x61ce('0x3b')],'type':_0x5a993e['type'][_0x61ce('0x3c')]};});_0x43664d[_0x61ce('0x3d')]=_[_0x61ce('0x39')](_0x50be0e,_0x61ce('0x36'));_0x43664d[_0x61ce('0x3e')]=_[_0x61ce('0x3f')](_0xcb992d[_0x61ce('0x3e')]);_0x43664d['filters']=_[_0x61ce('0x40')](_0x43664d[_0x61ce('0x3d')],_0x43664d[_0x61ce('0x3e')]);_0x1e06aa['attributes']=_[_0x61ce('0x40')](_0x43664d['model'],qs['fields'](_0xcb992d['query'][_0x61ce('0x41')]));_0x1e06aa[_0x61ce('0x42')]=_0x1e06aa[_0x61ce('0x42')][_0x61ce('0x43')]?_0x1e06aa[_0x61ce('0x42')]:_0x43664d[_0x61ce('0x3d')];if(!_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x44')]('nolimit')){_0x1e06aa[_0x61ce('0x29')]=qs[_0x61ce('0x29')](_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x29')]);_0x1e06aa[_0x61ce('0x28')]=qs[_0x61ce('0x28')](_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x28')]);}_0x1e06aa[_0x61ce('0x45')]=qs[_0x61ce('0x46')](_0xcb992d['query'][_0x61ce('0x46')]);_0x1e06aa[_0x61ce('0x47')]=qs['filters'](_['pick'](_0xcb992d['query'],_0x43664d[_0x61ce('0x48')]),_0x50be0e);if(_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x49')]){_0x1e06aa[_0x61ce('0x47')]=_[_0x61ce('0x4a')](_0x1e06aa[_0x61ce('0x47')],{'$or':_[_0x61ce('0x39')](_0x50be0e,function(_0x16813f){if(_0x16813f[_0x61ce('0x4b')]!==_0x61ce('0x4c')){var _0x569d6e={};_0x569d6e[_0x16813f['name']]={'$like':'%'+_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x49')]+'%'};return _0x569d6e;}})});}_0x1e06aa=_['merge']({},_0x1e06aa,_0xcb992d[_0x61ce('0x4d')]);var _0x533906={'where':_0x1e06aa[_0x61ce('0x47')]};return db[_0x61ce('0x3a')]['count'](_0x533906)[_0x61ce('0x1b')](function(_0x164cfe){_0x31c2ca[_0x61ce('0x2b')]=_0x164cfe;if(_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x4e')]){_0x1e06aa[_0x61ce('0x4f')]=[{'all':!![]}];}return db[_0x61ce('0x3a')][_0x61ce('0x50')](_0x1e06aa);})['then'](function(_0x38dae8){_0x31c2ca[_0x61ce('0x51')]=_0x38dae8;return _0x31c2ca;})['then'](respondWithFilteredResult(_0x4858a6,_0x1e06aa))[_0x61ce('0x52')](handleError(_0x4858a6,null));};exports[_0x61ce('0x53')]=function(_0x156b0d,_0x2ec876){var _0x3500a4={'raw':![],'where':{'id':_0x156b0d['params']['id']}},_0x108bc5={};_0x108bc5['model']=_[_0x61ce('0x3f')](db[_0x61ce('0x3a')][_0x61ce('0x54')]);_0x108bc5[_0x61ce('0x3e')]=_[_0x61ce('0x3f')](_0x156b0d[_0x61ce('0x3e')]);_0x108bc5[_0x61ce('0x48')]=_[_0x61ce('0x40')](_0x108bc5[_0x61ce('0x3d')],_0x108bc5[_0x61ce('0x3e')]);_0x3500a4['attributes']=_['intersection'](_0x108bc5['model'],qs[_0x61ce('0x41')](_0x156b0d[_0x61ce('0x3e')][_0x61ce('0x41')]));_0x3500a4[_0x61ce('0x42')]=_0x3500a4[_0x61ce('0x42')][_0x61ce('0x43')]?_0x3500a4[_0x61ce('0x42')]:_0x108bc5[_0x61ce('0x3d')];if(_0x156b0d[_0x61ce('0x3e')][_0x61ce('0x4e')]){_0x3500a4[_0x61ce('0x4f')]=[{'all':!![]}];}_0x3500a4=_['merge']({},_0x3500a4,_0x156b0d['options']);return db['VoiceContext'][_0x61ce('0x55')](_0x3500a4)['then'](handleEntityNotFound(_0x2ec876,null))['then'](respondWithResult(_0x2ec876,null))[_0x61ce('0x52')](handleError(_0x2ec876,null));};exports['create']=function(_0x3ef9c1,_0x3c25fd,_0x31364e){var _0x1ccadc;return db[_0x61ce('0x3a')][_0x61ce('0x56')](_0x3ef9c1[_0x61ce('0x57')],{'raw':!![]})[_0x61ce('0x1b')](function(_0x4105bd){_0x1ccadc=_0x4105bd;return db[_0x61ce('0x3a')][_0x61ce('0x50')]({'raw':!![]});})[_0x61ce('0x1b')](function(_0x49c281){var _0x3b528c=fs[_0x61ce('0x58')](path['join'](config['root'],_0x61ce('0x59')),'utf8');var _0x4ddc88=ejs['render'](_0x3b528c,{'contexts':_0x49c281||[]});fs['writeFileSync'](_0x61ce('0x5a'),_0x4ddc88);})[_0x61ce('0x1b')](function(){return respondWithRpcPromise(_0x61ce('0x5b'),_0x61ce('0x56'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x1b')](function(){var _0x588be4=_0x3ef9c1[_0x61ce('0x5d')][_0x61ce('0x33')]({'plain':!![]});if(!_0x588be4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x588be4[_0x61ce('0x5e')]==='user'){var _0x58e201=_0x1ccadc[_0x61ce('0x33')]({'plain':!![]});return db[_0x61ce('0x5f')][_0x61ce('0x55')]({'where':{'name':_0x61ce('0x60'),'userProfileId':_0x588be4[_0x61ce('0x61')]},'raw':!![]})[_0x61ce('0x1b')](function(_0x875a36){if(_0x875a36&&_0x875a36['autoAssociation']===0x0){return db[_0x61ce('0x34')][_0x61ce('0x56')]({'name':_0x58e201[_0x61ce('0x36')],'resourceId':_0x58e201['id'],'type':_0x875a36['name'],'sectionId':_0x875a36['id']},{})[_0x61ce('0x1b')](function(){return _0x1ccadc;});}else{return _0x1ccadc;}})[_0x61ce('0x52')](function(_0x283be8){logger[_0x61ce('0x20')](_0x61ce('0x62'),_0x283be8);throw _0x283be8;});}return _0x1ccadc;})[_0x61ce('0x1b')](respondWithResult(_0x3c25fd,0xc9))[_0x61ce('0x52')](handleError(_0x3c25fd,null));};exports['update']=function(_0x25e455,_0x6a20de,_0x479ad9){var _0x48a48a;return db[_0x61ce('0x3a')]['find']({'where':{'id':_0x25e455[_0x61ce('0x63')]['id']}})[_0x61ce('0x1b')](handleEntityNotFound(_0x6a20de,null))[_0x61ce('0x1b')](saveUpdates(_0x25e455['body'],null))[_0x61ce('0x1b')](function(_0x30f6c9){if(_0x30f6c9){_0x48a48a=_0x30f6c9;return db['VoiceContext'][_0x61ce('0x50')]({'raw':!![]});}})['then'](function(_0x104a22){var _0x370caf=fs[_0x61ce('0x58')](path[_0x61ce('0x64')](config['root'],_0x61ce('0x59')),_0x61ce('0x65'));var _0x3a1062=ejs[_0x61ce('0x66')](_0x370caf,{'contexts':_0x104a22||[]});fs[_0x61ce('0x67')](_0x61ce('0x5a'),_0x3a1062);})['then'](function(){return respondWithRpcPromise('Reload',_0x61ce('0x31'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x1b')](function(){return _0x48a48a;})[_0x61ce('0x1b')](respondWithResult(_0x6a20de,null))['catch'](handleError(_0x6a20de,null));};exports[_0x61ce('0x32')]=function(_0x230139,_0x4ac28a,_0x9b23f5){var _0x1fd33f;return db[_0x61ce('0x3a')][_0x61ce('0x55')]({'where':{'id':_0x230139[_0x61ce('0x63')]['id']}})[_0x61ce('0x1b')](handleEntityNotFound(_0x4ac28a,null))[_0x61ce('0x1b')](removeEntity(_0x4ac28a,null))['then'](function(){return db[_0x61ce('0x3a')][_0x61ce('0x50')]({'raw':!![]});})[_0x61ce('0x1b')](function(_0x505831){var _0x105c8c=fs[_0x61ce('0x58')](path['join'](config[_0x61ce('0x68')],_0x61ce('0x59')),_0x61ce('0x65'));var _0x2135d4=ejs[_0x61ce('0x66')](_0x105c8c,{'contexts':_0x505831});fs[_0x61ce('0x67')](_0x61ce('0x5a'),_0x2135d4);return respondWithRpcPromise(_0x61ce('0x5b'),_0x61ce('0x32'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x52')](handleError(_0x4ac28a,null));}; \ No newline at end of file +var _0x430b=['where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','intersection','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','root','writeFileSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0xb8fa8d,_0x478e1b){var _0x5884ad=function(_0x34bbe3){while(--_0x34bbe3){_0xb8fa8d['push'](_0xb8fa8d['shift']());}};_0x5884ad(++_0x478e1b);}(_0x430b,0x14d));var _0xb430=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x430b[_0x48cb1f];return _0x172c4d;};'use strict';var emlformat=require(_0xb430('0x0'));var rimraf=require(_0xb430('0x1'));var zipdir=require(_0xb430('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb430('0x3'));var moment=require(_0xb430('0x4'));var BPromise=require(_0xb430('0x5'));var Mustache=require(_0xb430('0x6'));var util=require(_0xb430('0x7'));var path=require('path');var sox=require(_0xb430('0x8'));var csv=require('to-csv');var ejs=require(_0xb430('0x9'));var fs=require('fs');var fs_extra=require(_0xb430('0xa'));var _=require('lodash');var squel=require(_0xb430('0xb'));var crypto=require(_0xb430('0xc'));var jsforce=require(_0xb430('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb430('0xe'));var Papa=require('papaparse');var Redis=require(_0xb430('0xf'));var authService=require(_0xb430('0x10'));var qs=require(_0xb430('0x11'));var as=require(_0xb430('0x12'));var hardwareService=require(_0xb430('0x13'));var logger=require(_0xb430('0x14'))(_0xb430('0x15'));var utils=require(_0xb430('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb430('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb430('0x18'));var client=jayson[_0xb430('0x19')][_0xb430('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3b0703,_0x5304f9,_0x3f6358,_0x212e80){return new BPromise(function(_0x2f740f,_0x1ec039){var _0x3b92d7=_0x212e80||client;return _0x3b92d7['request'](_0x3b0703,_0x3f6358)[_0xb430('0x1b')](function(_0x555168){logger['info'](_0xb430('0x1c'),_0x5304f9,_0xb430('0x1d'));logger['debug'](_0xb430('0x1e'),_0x5304f9,'request\x20sent',JSON['stringify'](_0x555168));if(_0x555168[_0xb430('0x1f')]){if(_0x555168['error']['code']===0x1f4){logger[_0xb430('0x1f')](_0xb430('0x1c'),_0x5304f9,_0x555168['error'][_0xb430('0x20')]);return _0x1ec039(_0x555168['error']['message']);}logger[_0xb430('0x1f')](_0xb430('0x1c'),_0x5304f9,_0x555168['error'][_0xb430('0x20')]);return _0x2f740f(_0x555168[_0xb430('0x1f')]['message']);}else{logger[_0xb430('0x21')](_0xb430('0x1c'),_0x5304f9,_0xb430('0x1d'));_0x2f740f(_0x555168[_0xb430('0x22')][_0xb430('0x20')]);}})[_0xb430('0x23')](function(_0x1db305){logger[_0xb430('0x1f')](_0xb430('0x1c'),_0x5304f9,_0x1db305);_0x1ec039(_0x1db305);});});}function respondWithStatusCode(_0xa659ba,_0x1cf18b){_0x1cf18b=_0x1cf18b||0xcc;return function(_0x168c88){if(_0x168c88){return _0xa659ba[_0xb430('0x24')](_0x1cf18b);}return _0xa659ba['status'](_0x1cf18b)[_0xb430('0x25')]();};}function respondWithResult(_0x86cd2c,_0x5224ee){_0x5224ee=_0x5224ee||0xc8;return function(_0x42cc71){if(_0x42cc71){return _0x86cd2c[_0xb430('0x26')](_0x5224ee)[_0xb430('0x27')](_0x42cc71);}};}function respondWithFilteredResult(_0x289b9d,_0x2d9a77){return function(_0x2b7e2b){if(_0x2b7e2b){var _0x19db52=typeof _0x2d9a77[_0xb430('0x28')]===_0xb430('0x29')&&typeof _0x2d9a77[_0xb430('0x2a')]==='undefined';var _0x10843a=_0x2b7e2b[_0xb430('0x2b')];var _0x423f66=_0x19db52?0x0:_0x2d9a77[_0xb430('0x28')];var _0xb08c47=_0x19db52?_0x2b7e2b['count']:_0x2d9a77[_0xb430('0x28')]+_0x2d9a77['limit'];var _0x4b14d9;if(_0xb08c47>=_0x10843a){_0xb08c47=_0x10843a;_0x4b14d9=0xc8;}else{_0x4b14d9=0xce;}_0x289b9d[_0xb430('0x26')](_0x4b14d9);return _0x289b9d[_0xb430('0x2c')](_0xb430('0x2d'),_0x423f66+'-'+_0xb08c47+'/'+_0x10843a)[_0xb430('0x27')](_0x2b7e2b);}return null;};}function patchUpdates(_0x3ef0c7){return function(_0x33b8a3){try{jsonpatch[_0xb430('0x2e')](_0x33b8a3,_0x3ef0c7,!![]);}catch(_0x408a38){return BPromise[_0xb430('0x2f')](_0x408a38);}return _0x33b8a3['save']();};}function saveUpdates(_0x1344f6,_0x5470a7){return function(_0x16452b){if(_0x16452b){return _0x16452b[_0xb430('0x30')](_0x1344f6)[_0xb430('0x1b')](function(_0x397f72){return _0x397f72;});}return null;};}function removeEntity(_0x2b9716,_0x5436e4){return function(_0x42039e){if(_0x42039e){return _0x42039e['destroy']()[_0xb430('0x1b')](function(){var _0x3e82b3=_0x42039e[_0xb430('0x31')]({'plain':!![]});var _0x5128f7=_0xb430('0x32');return db['UserProfileResource'][_0xb430('0x33')]({'where':{'type':_0x5128f7,'resourceId':_0x3e82b3['id']}})[_0xb430('0x1b')](function(){return _0x42039e;});})['then'](function(){_0x2b9716[_0xb430('0x26')](0xcc)[_0xb430('0x25')]();});}};}function handleEntityNotFound(_0x145ff0,_0x150a58){return function(_0x3e42e1){if(!_0x3e42e1){_0x145ff0['sendStatus'](0x194);}return _0x3e42e1;};}function handleError(_0x2fd75a,_0x3cdd15){_0x3cdd15=_0x3cdd15||0x1f4;return function(_0x579eae){logger[_0xb430('0x1f')](_0x579eae[_0xb430('0x34')]);if(_0x579eae[_0xb430('0x35')]){delete _0x579eae[_0xb430('0x35')];}_0x2fd75a[_0xb430('0x26')](_0x3cdd15)[_0xb430('0x36')](_0x579eae);};}exports[_0xb430('0x37')]=function(_0x4e5b2f,_0x421eb5){var _0x5b5659={},_0x32e2bf={},_0x2f5190={'count':0x0,'rows':[]};var _0x497765=_[_0xb430('0x38')](db[_0xb430('0x39')][_0xb430('0x3a')],function(_0x366640){return{'name':_0x366640[_0xb430('0x3b')],'type':_0x366640['type'][_0xb430('0x3c')]};});_0x32e2bf[_0xb430('0x3d')]=_[_0xb430('0x38')](_0x497765,'name');_0x32e2bf[_0xb430('0x3e')]=_[_0xb430('0x3f')](_0x4e5b2f[_0xb430('0x3e')]);_0x32e2bf['filters']=_['intersection'](_0x32e2bf[_0xb430('0x3d')],_0x32e2bf[_0xb430('0x3e')]);_0x5b5659[_0xb430('0x40')]=_['intersection'](_0x32e2bf[_0xb430('0x3d')],qs[_0xb430('0x41')](_0x4e5b2f['query']['fields']));_0x5b5659['attributes']=_0x5b5659[_0xb430('0x40')][_0xb430('0x42')]?_0x5b5659['attributes']:_0x32e2bf['model'];if(!_0x4e5b2f[_0xb430('0x3e')][_0xb430('0x43')](_0xb430('0x44'))){_0x5b5659[_0xb430('0x2a')]=qs[_0xb430('0x2a')](_0x4e5b2f[_0xb430('0x3e')][_0xb430('0x2a')]);_0x5b5659[_0xb430('0x28')]=qs['offset'](_0x4e5b2f[_0xb430('0x3e')][_0xb430('0x28')]);}_0x5b5659[_0xb430('0x45')]=qs[_0xb430('0x46')](_0x4e5b2f['query']['sort']);_0x5b5659[_0xb430('0x47')]=qs[_0xb430('0x48')](_[_0xb430('0x49')](_0x4e5b2f[_0xb430('0x3e')],_0x32e2bf[_0xb430('0x48')]),_0x497765);if(_0x4e5b2f[_0xb430('0x3e')][_0xb430('0x4a')]){_0x5b5659[_0xb430('0x47')]=_['merge'](_0x5b5659['where'],{'$or':_[_0xb430('0x38')](_0x497765,function(_0x675fcb){if(_0x675fcb[_0xb430('0x4b')]!=='VIRTUAL'){var _0x5ae1c9={};_0x5ae1c9[_0x675fcb[_0xb430('0x35')]]={'$like':'%'+_0x4e5b2f[_0xb430('0x3e')]['filter']+'%'};return _0x5ae1c9;}})});}_0x5b5659=_[_0xb430('0x4c')]({},_0x5b5659,_0x4e5b2f[_0xb430('0x4d')]);var _0x3ed1bf={'where':_0x5b5659[_0xb430('0x47')]};return db[_0xb430('0x39')][_0xb430('0x2b')](_0x3ed1bf)[_0xb430('0x1b')](function(_0x22045e){_0x2f5190['count']=_0x22045e;if(_0x4e5b2f[_0xb430('0x3e')][_0xb430('0x4e')]){_0x5b5659[_0xb430('0x4f')]=[{'all':!![]}];}return db[_0xb430('0x39')][_0xb430('0x50')](_0x5b5659);})[_0xb430('0x1b')](function(_0x43fc3f){_0x2f5190[_0xb430('0x51')]=_0x43fc3f;return _0x2f5190;})['then'](respondWithFilteredResult(_0x421eb5,_0x5b5659))[_0xb430('0x23')](handleError(_0x421eb5,null));};exports['show']=function(_0x44c385,_0x39842c){var _0x4a4ca8={'raw':![],'where':{'id':_0x44c385[_0xb430('0x52')]['id']}},_0x47f618={};_0x47f618[_0xb430('0x3d')]=_[_0xb430('0x3f')](db[_0xb430('0x39')][_0xb430('0x3a')]);_0x47f618[_0xb430('0x3e')]=_[_0xb430('0x3f')](_0x44c385[_0xb430('0x3e')]);_0x47f618[_0xb430('0x48')]=_['intersection'](_0x47f618[_0xb430('0x3d')],_0x47f618[_0xb430('0x3e')]);_0x4a4ca8[_0xb430('0x40')]=_[_0xb430('0x53')](_0x47f618[_0xb430('0x3d')],qs[_0xb430('0x41')](_0x44c385[_0xb430('0x3e')]['fields']));_0x4a4ca8[_0xb430('0x40')]=_0x4a4ca8[_0xb430('0x40')][_0xb430('0x42')]?_0x4a4ca8[_0xb430('0x40')]:_0x47f618['model'];if(_0x44c385['query'][_0xb430('0x4e')]){_0x4a4ca8[_0xb430('0x4f')]=[{'all':!![]}];}_0x4a4ca8=_[_0xb430('0x4c')]({},_0x4a4ca8,_0x44c385[_0xb430('0x4d')]);return db['VoiceContext']['find'](_0x4a4ca8)['then'](handleEntityNotFound(_0x39842c,null))['then'](respondWithResult(_0x39842c,null))[_0xb430('0x23')](handleError(_0x39842c,null));};exports[_0xb430('0x54')]=function(_0x2fbb87,_0x12973b,_0x331e2f){var _0x7abf3d;return db['VoiceContext'][_0xb430('0x54')](_0x2fbb87[_0xb430('0x55')],{'raw':!![]})[_0xb430('0x1b')](function(_0x34835c){_0x7abf3d=_0x34835c;return db[_0xb430('0x39')][_0xb430('0x50')]({'raw':!![]});})[_0xb430('0x1b')](function(_0x14e9d5){var _0x16a10f=fs[_0xb430('0x56')](path[_0xb430('0x57')](config['root'],_0xb430('0x58')),_0xb430('0x59'));var _0x18ef8d=ejs[_0xb430('0x5a')](_0x16a10f,{'contexts':_0x14e9d5||[]});fs['writeFileSync'](_0xb430('0x5b'),_0x18ef8d);})[_0xb430('0x1b')](function(){return respondWithRpcPromise(_0xb430('0x5c'),_0xb430('0x54'),{'module':_0xb430('0x5d')});})[_0xb430('0x1b')](function(){var _0x350e52=_0x2fbb87[_0xb430('0x5e')]['get']({'plain':!![]});if(!_0x350e52)throw new Error(_0xb430('0x5f'));if(_0x350e52[_0xb430('0x60')]==='user'){var _0x168992=_0x7abf3d[_0xb430('0x31')]({'plain':!![]});return db['UserProfileSection'][_0xb430('0x61')]({'where':{'name':_0xb430('0x32'),'userProfileId':_0x350e52[_0xb430('0x62')]},'raw':!![]})[_0xb430('0x1b')](function(_0xcc25de){if(_0xcc25de&&_0xcc25de['autoAssociation']===0x0){return db['UserProfileResource'][_0xb430('0x54')]({'name':_0x168992['name'],'resourceId':_0x168992['id'],'type':_0xcc25de[_0xb430('0x35')],'sectionId':_0xcc25de['id']},{})[_0xb430('0x1b')](function(){return _0x7abf3d;});}else{return _0x7abf3d;}})[_0xb430('0x23')](function(_0x175496){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x175496);throw _0x175496;});}return _0x7abf3d;})['then'](respondWithResult(_0x12973b,0xc9))[_0xb430('0x23')](handleError(_0x12973b,null));};exports['update']=function(_0x4a7438,_0xb91553,_0x2e07b7){var _0x476396;return db[_0xb430('0x39')]['find']({'where':{'id':_0x4a7438[_0xb430('0x52')]['id']}})[_0xb430('0x1b')](handleEntityNotFound(_0xb91553,null))[_0xb430('0x1b')](saveUpdates(_0x4a7438[_0xb430('0x55')],null))[_0xb430('0x1b')](function(_0x4ece10){if(_0x4ece10){_0x476396=_0x4ece10;return db[_0xb430('0x39')][_0xb430('0x50')]({'raw':!![]});}})['then'](function(_0x3781e6){var _0xb40005=fs[_0xb430('0x56')](path[_0xb430('0x57')](config[_0xb430('0x63')],_0xb430('0x58')),_0xb430('0x59'));var _0x183342=ejs[_0xb430('0x5a')](_0xb40005,{'contexts':_0x3781e6||[]});fs[_0xb430('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x183342);})[_0xb430('0x1b')](function(){return respondWithRpcPromise('Reload',_0xb430('0x30'),{'module':_0xb430('0x5d')});})[_0xb430('0x1b')](function(){return _0x476396;})['then'](respondWithResult(_0xb91553,null))[_0xb430('0x23')](handleError(_0xb91553,null));};exports[_0xb430('0x33')]=function(_0x423fb4,_0x247bd4,_0x469c45){var _0x1c4f2c;return db['VoiceContext'][_0xb430('0x61')]({'where':{'id':_0x423fb4['params']['id']}})[_0xb430('0x1b')](handleEntityNotFound(_0x247bd4,null))[_0xb430('0x1b')](removeEntity(_0x247bd4,null))['then'](function(){return db[_0xb430('0x39')][_0xb430('0x50')]({'raw':!![]});})[_0xb430('0x1b')](function(_0x5dd3df){var _0x2a39dd=fs[_0xb430('0x56')](path[_0xb430('0x57')](config[_0xb430('0x63')],'server/files/templates/context.ejs'),_0xb430('0x59'));var _0x4bdc4a=ejs['render'](_0x2a39dd,{'contexts':_0x5dd3df});fs[_0xb430('0x64')](_0xb430('0x5b'),_0x4bdc4a);return respondWithRpcPromise(_0xb430('0x5c'),_0xb430('0x33'),{'module':_0xb430('0x5d')});})[_0xb430('0x23')](handleError(_0x247bd4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6912528..0c2f8fc 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 _0xb846=['request-promise','../../config/environment','./voiceContext.attributes','exports','voice_contexts','lodash','api','moment','bluebird'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xb846,0x1d0));var _0x6b84=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb846[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rp=require(_0x6b84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x5'));var attributes=require(_0x6b84('0x6'));module[_0x6b84('0x7')]=function(_0x3448d0,_0x31856c){return _0x3448d0['define']('VoiceContext',attributes,{'tableName':_0x6b84('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32e9=['voice_contexts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x32e9,0x199));var _0x932e=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x32e9[_0x3a9635];return _0x10d08c;};'use strict';var _=require(_0x932e('0x0'));var util=require(_0x932e('0x1'));var logger=require(_0x932e('0x2'))(_0x932e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x932e('0x4'));var fs=require('fs');var path=require(_0x932e('0x5'));var rimraf=require(_0x932e('0x6'));var config=require(_0x932e('0x7'));var attributes=require(_0x932e('0x8'));module['exports']=function(_0x4acbef,_0x7b45f0){return _0x4acbef[_0x932e('0x9')](_0x932e('0xa'),attributes,{'tableName':_0x932e('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 d7cb9a7..e07ceea 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 _0x98ef=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','lodash'];(function(_0x46d770,_0x35b338){var _0x4033e6=function(_0x448e02){while(--_0x448e02){_0x46d770['push'](_0x46d770['shift']());}};_0x4033e6(++_0x35b338);}(_0x98ef,0x197));var _0xf98e=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x98ef[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var moment=require(_0xf98e('0x2'));var BPromise=require(_0xf98e('0x3'));var rs=require(_0xf98e('0x4'));var fs=require('fs');var Redis=require(_0xf98e('0x5'));var db=require(_0xf98e('0x6'))['db'];var utils=require(_0xf98e('0x7'));var logger=require(_0xf98e('0x8'))(_0xf98e('0x9'));var config=require(_0xf98e('0xa'));var jayson=require(_0xf98e('0xb'));var client=jayson[_0xf98e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8573,_0xa223b9,_0x55f71d){return new BPromise(function(_0x161912,_0x2c6598){return client[_0xf98e('0xd')](_0x3e8573,_0x55f71d)[_0xf98e('0xe')](function(_0xb2d232){logger[_0xf98e('0xf')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xf98e('0x10'));logger[_0xf98e('0x11')](_0xf98e('0x12'),_0xa223b9,_0xf98e('0x10'),JSON['stringify'](_0xb2d232));if(_0xb2d232[_0xf98e('0x13')]){if(_0xb2d232['error'][_0xf98e('0x14')]===0x1f4){logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232['error'][_0xf98e('0x15')]);return _0x2c6598(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);return _0x161912(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}else{logger[_0xf98e('0xf')](_0xf98e('0x16'),_0xa223b9,_0xf98e('0x10'));_0x161912(_0xb2d232[_0xf98e('0x17')][_0xf98e('0x15')]);}})['catch'](function(_0x14f93f){logger[_0xf98e('0x13')](_0xf98e('0x16'),_0xa223b9,_0x14f93f);_0x2c6598(_0x14f93f);});});} \ No newline at end of file +var _0xbcff=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbcff,0xbb));var _0xfbcf=function(_0x2c1c58,_0x434128){_0x2c1c58=_0x2c1c58-0x0;var _0x274efe=_0xbcff[_0x2c1c58];return _0x274efe;};'use strict';var _=require(_0xfbcf('0x0'));var util=require('util');var moment=require(_0xfbcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbcf('0x2'));var fs=require('fs');var Redis=require(_0xfbcf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbcf('0x4'))(_0xfbcf('0x5'));var config=require('../../config/environment');var jayson=require(_0xfbcf('0x6'));var client=jayson[_0xfbcf('0x7')][_0xfbcf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e7584,_0x2ec56a,_0x217f28){return new BPromise(function(_0x55cd4e,_0x2cbd96){return client[_0xfbcf('0x9')](_0x1e7584,_0x217f28)[_0xfbcf('0xa')](function(_0x5784ee){logger[_0xfbcf('0xb')](_0xfbcf('0xc'),_0x2ec56a,_0xfbcf('0xd'));logger[_0xfbcf('0xe')](_0xfbcf('0xf'),_0x2ec56a,_0xfbcf('0xd'),JSON[_0xfbcf('0x10')](_0x5784ee));if(_0x5784ee['error']){if(_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x12')]===0x1f4){logger[_0xfbcf('0x11')](_0xfbcf('0xc'),_0x2ec56a,_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);return _0x2cbd96(_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);}logger[_0xfbcf('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2ec56a,_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);return _0x55cd4e(_0x5784ee['error']['message']);}else{logger['info'](_0xfbcf('0xc'),_0x2ec56a,_0xfbcf('0xd'));_0x55cd4e(_0x5784ee[_0xfbcf('0x14')][_0xfbcf('0x13')]);}})[_0xfbcf('0x15')](function(_0x39b81d){logger[_0xfbcf('0x11')](_0xfbcf('0xc'),_0x2ec56a,_0x39b81d);_0x2cbd96(_0x39b81d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3ebd02a..6cee4b0 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 _0xb575=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb575,0x1a8));var _0x5b57=function(_0x309a11,_0x33f77e){_0x309a11=_0x309a11-0x0;var _0x22bdf8=_0xb575[_0x309a11];return _0x22bdf8;};'use strict';var multer=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var path=require(_0x5b57('0x2'));var timeout=require(_0x5b57('0x3'));var express=require(_0x5b57('0x4'));var router=express[_0x5b57('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b57('0x6'));var interaction=require(_0x5b57('0x7'));var config=require('../../config/environment');var controller=require(_0x5b57('0x8'));router[_0x5b57('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b57('0x9')](_0x5b57('0xa'),auth[_0x5b57('0xb')](),controller[_0x5b57('0xc')]);router[_0x5b57('0x9')](_0x5b57('0xd'),auth[_0x5b57('0xb')](),controller[_0x5b57('0xe')]);router[_0x5b57('0xf')]('/',auth[_0x5b57('0xb')](),controller[_0x5b57('0x10')]);router[_0x5b57('0x11')](_0x5b57('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5b57('0x12')](_0x5b57('0xd'),auth[_0x5b57('0xb')](),controller[_0x5b57('0x13')]);module[_0x5b57('0x14')]=router; \ No newline at end of file +var _0xd6ef=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x54ec52,_0x11d651){var _0x4515d6=function(_0x229774){while(--_0x229774){_0x54ec52['push'](_0x54ec52['shift']());}};_0x4515d6(++_0x11d651);}(_0xd6ef,0xfb));var _0xfd6e=function(_0x25ca4a,_0xaf04a6){_0x25ca4a=_0x25ca4a-0x0;var _0x37ea37=_0xd6ef[_0x25ca4a];return _0x37ea37;};'use strict';var multer=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var path=require('path');var timeout=require(_0xfd6e('0x2'));var express=require(_0xfd6e('0x3'));var router=express[_0xfd6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd6e('0x5'));var interaction=require(_0xfd6e('0x6'));var config=require(_0xfd6e('0x7'));var controller=require(_0xfd6e('0x8'));router[_0xfd6e('0x9')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xb')]);router[_0xfd6e('0x9')](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xd')]);router[_0xfd6e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfd6e('0xe')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xf')]);router[_0xfd6e('0x10')](_0xfd6e('0x11'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x12')]);router['delete'](_0xfd6e('0x11'),auth['isAuthenticated'](),controller[_0xfd6e('0x13')]);module[_0xfd6e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a8c82c9..c557e13 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 _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x36bb37,_0x17323b){_0x36bb37=_0x36bb37-0x0;var _0x2c0d4b=_0xd6d6[_0x36bb37];return _0x2c0d4b;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x9f62,0x154));var _0x29f6=function(_0x397731,_0x19ab1a){_0x397731=_0x397731-0x0;var _0x535652=_0x9f62[_0x397731];return _0x535652;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 74b140c..c3120bb 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 _0x7da5=['destroy','stack','name','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','include','VoiceDialReport','findAll','catch','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x2cc8cd,_0x44cc3c){var _0x5b63d7=function(_0x3cfa50){while(--_0x3cfa50){_0x2cc8cd['push'](_0x2cc8cd['shift']());}};_0x5b63d7(++_0x44cc3c);}(_0x7da5,0x1cb));var _0x57da=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7da5[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x57da('0x0'));var rimraf=require(_0x57da('0x1'));var zipdir=require(_0x57da('0x2'));var jsonpatch=require(_0x57da('0x3'));var rp=require(_0x57da('0x4'));var moment=require(_0x57da('0x5'));var BPromise=require(_0x57da('0x6'));var Mustache=require('mustache');var util=require(_0x57da('0x7'));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(_0x57da('0x8'));var _=require(_0x57da('0x9'));var squel=require(_0x57da('0xa'));var crypto=require(_0x57da('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57da('0xc'));var querystring=require('querystring');var Papa=require(_0x57da('0xd'));var Redis=require(_0x57da('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x57da('0xf'));var as=require(_0x57da('0x10'));var hardwareService=require(_0x57da('0x11'));var logger=require(_0x57da('0x12'))(_0x57da('0x13'));var utils=require(_0x57da('0x14'));var config=require(_0x57da('0x15'));var licenseUtil=require(_0x57da('0x16'));var db=require(_0x57da('0x17'))['db'];function respondWithStatusCode(_0x45ad8d,_0x24b5bc){_0x24b5bc=_0x24b5bc||0xcc;return function(_0x23df9b){if(_0x23df9b){return _0x45ad8d[_0x57da('0x18')](_0x24b5bc);}return _0x45ad8d[_0x57da('0x19')](_0x24b5bc)[_0x57da('0x1a')]();};}function respondWithResult(_0x52643f,_0x4af1f1){_0x4af1f1=_0x4af1f1||0xc8;return function(_0x49fde3){if(_0x49fde3){return _0x52643f[_0x57da('0x19')](_0x4af1f1)[_0x57da('0x1b')](_0x49fde3);}};}function respondWithFilteredResult(_0x141fbe,_0x3b2fa9){return function(_0x49359c){if(_0x49359c){var _0x3975b3=typeof _0x3b2fa9[_0x57da('0x1c')]==='undefined'&&typeof _0x3b2fa9[_0x57da('0x1d')]===_0x57da('0x1e');var _0xa7818d=_0x49359c[_0x57da('0x1f')];var _0x2fc785=_0x3975b3?0x0:_0x3b2fa9[_0x57da('0x1c')];var _0x34df25=_0x3975b3?_0x49359c[_0x57da('0x1f')]:_0x3b2fa9['offset']+_0x3b2fa9[_0x57da('0x1d')];var _0x229ccd;if(_0x34df25>=_0xa7818d){_0x34df25=_0xa7818d;_0x229ccd=0xc8;}else{_0x229ccd=0xce;}_0x141fbe[_0x57da('0x19')](_0x229ccd);return _0x141fbe[_0x57da('0x20')](_0x57da('0x21'),_0x2fc785+'-'+_0x34df25+'/'+_0xa7818d)[_0x57da('0x1b')](_0x49359c);}return null;};}function patchUpdates(_0x39ac82){return function(_0x52cc31){try{jsonpatch[_0x57da('0x22')](_0x52cc31,_0x39ac82,!![]);}catch(_0x2ca815){return BPromise[_0x57da('0x23')](_0x2ca815);}return _0x52cc31[_0x57da('0x24')]();};}function saveUpdates(_0x589850,_0x5558c5){return function(_0x1f5761){if(_0x1f5761){return _0x1f5761['update'](_0x589850)[_0x57da('0x25')](function(_0x1aa8a){return _0x1aa8a;});}return null;};}function removeEntity(_0x393d16,_0x5a535e){return function(_0x3b5421){if(_0x3b5421){return _0x3b5421[_0x57da('0x26')]()[_0x57da('0x25')](function(){_0x393d16['status'](0xcc)[_0x57da('0x1a')]();});}};}function handleEntityNotFound(_0x329c32,_0x12975a){return function(_0x41c3fd){if(!_0x41c3fd){_0x329c32['sendStatus'](0x194);}return _0x41c3fd;};}function handleError(_0x248c28,_0x20af9b){_0x20af9b=_0x20af9b||0x1f4;return function(_0x462a24){logger['error'](_0x462a24[_0x57da('0x27')]);if(_0x462a24[_0x57da('0x28')]){delete _0x462a24['name'];}_0x248c28[_0x57da('0x19')](_0x20af9b)['send'](_0x462a24);};}exports[_0x57da('0x29')]=function(_0x1f463c,_0x160757){var _0x5b01d9={},_0x4d7ada={},_0x46a287={'count':0x0,'rows':[]};var _0x296d42=_['map'](db['VoiceDialReport'][_0x57da('0x2a')],function(_0x2040c3){return{'name':_0x2040c3[_0x57da('0x2b')],'type':_0x2040c3['type']['key']};});_0x4d7ada[_0x57da('0x2c')]=_['map'](_0x296d42,'name');_0x4d7ada[_0x57da('0x2d')]=_[_0x57da('0x2e')](_0x1f463c[_0x57da('0x2d')]);_0x4d7ada[_0x57da('0x2f')]=_[_0x57da('0x30')](_0x4d7ada[_0x57da('0x2c')],_0x4d7ada[_0x57da('0x2d')]);_0x5b01d9['attributes']=_[_0x57da('0x30')](_0x4d7ada[_0x57da('0x2c')],qs[_0x57da('0x31')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x31')]));_0x5b01d9['attributes']=_0x5b01d9[_0x57da('0x32')][_0x57da('0x33')]?_0x5b01d9[_0x57da('0x32')]:_0x4d7ada[_0x57da('0x2c')];if(!_0x1f463c[_0x57da('0x2d')][_0x57da('0x34')](_0x57da('0x35'))){_0x5b01d9[_0x57da('0x1d')]=qs[_0x57da('0x1d')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x1d')]);_0x5b01d9[_0x57da('0x1c')]=qs[_0x57da('0x1c')](_0x1f463c[_0x57da('0x2d')]['offset']);}_0x5b01d9[_0x57da('0x36')]=qs[_0x57da('0x37')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x37')]);_0x5b01d9[_0x57da('0x38')]=qs[_0x57da('0x2f')](_[_0x57da('0x39')](_0x1f463c[_0x57da('0x2d')],_0x4d7ada[_0x57da('0x2f')]),_0x296d42);if(_0x1f463c[_0x57da('0x2d')]['filter']){_0x5b01d9['where']=_[_0x57da('0x3a')](_0x5b01d9[_0x57da('0x38')],{'$or':_[_0x57da('0x3b')](_0x296d42,function(_0x9caf68){if(_0x9caf68[_0x57da('0x3c')]!=='VIRTUAL'){var _0x7192bc={};_0x7192bc[_0x9caf68[_0x57da('0x28')]]={'$like':'%'+_0x1f463c['query']['filter']+'%'};return _0x7192bc;}})});}_0x5b01d9=_[_0x57da('0x3a')]({},_0x5b01d9,_0x1f463c['options']);var _0x446c50={'where':_0x5b01d9[_0x57da('0x38')]};return db['VoiceDialReport']['count'](_0x446c50)['then'](function(_0x5b93f8){_0x46a287[_0x57da('0x1f')]=_0x5b93f8;if(_0x1f463c[_0x57da('0x2d')]['includeAll']){_0x5b01d9[_0x57da('0x3d')]=[{'all':!![]}];}return db[_0x57da('0x3e')][_0x57da('0x3f')](_0x5b01d9);})[_0x57da('0x25')](function(_0x5b08ea){_0x46a287['rows']=_0x5b08ea;return _0x46a287;})[_0x57da('0x25')](respondWithFilteredResult(_0x160757,_0x5b01d9))[_0x57da('0x40')](handleError(_0x160757,null));};exports['show']=function(_0x512911,_0x481b4b){var _0x1aaa64={'raw':!![],'where':{'id':_0x512911['params']['id']}},_0x3abaa8={};_0x3abaa8[_0x57da('0x2c')]=_[_0x57da('0x2e')](db[_0x57da('0x3e')][_0x57da('0x2a')]);_0x3abaa8['query']=_[_0x57da('0x2e')](_0x512911['query']);_0x3abaa8[_0x57da('0x2f')]=_[_0x57da('0x30')](_0x3abaa8[_0x57da('0x2c')],_0x3abaa8['query']);_0x1aaa64[_0x57da('0x32')]=_[_0x57da('0x30')](_0x3abaa8[_0x57da('0x2c')],qs['fields'](_0x512911['query']['fields']));_0x1aaa64[_0x57da('0x32')]=_0x1aaa64[_0x57da('0x32')][_0x57da('0x33')]?_0x1aaa64['attributes']:_0x3abaa8['model'];if(_0x512911[_0x57da('0x2d')][_0x57da('0x41')]){_0x1aaa64[_0x57da('0x3d')]=[{'all':!![]}];}_0x1aaa64=_[_0x57da('0x3a')]({},_0x1aaa64,_0x512911['options']);return db[_0x57da('0x3e')][_0x57da('0x42')](_0x1aaa64)[_0x57da('0x25')](handleEntityNotFound(_0x481b4b,null))[_0x57da('0x25')](respondWithResult(_0x481b4b,null))[_0x57da('0x40')](handleError(_0x481b4b,null));};exports[_0x57da('0x43')]=function(_0x3df10b,_0x4ea422){return db['VoiceDialReport'][_0x57da('0x43')](_0x3df10b[_0x57da('0x44')],{})[_0x57da('0x25')](respondWithResult(_0x4ea422,0xc9))[_0x57da('0x40')](handleError(_0x4ea422,null));};exports['update']=function(_0x191d63,_0x4b31be){if(_0x191d63[_0x57da('0x44')]['id']){delete _0x191d63['body']['id'];}return db[_0x57da('0x3e')][_0x57da('0x42')]({'where':{'id':_0x191d63[_0x57da('0x45')]['id']}})[_0x57da('0x25')](handleEntityNotFound(_0x4b31be,null))[_0x57da('0x25')](saveUpdates(_0x191d63[_0x57da('0x44')],null))['then'](respondWithResult(_0x4b31be,null))['catch'](handleError(_0x4b31be,null));};exports['destroy']=function(_0x4e04b8,_0x14b95d){return db[_0x57da('0x3e')][_0x57da('0x42')]({'where':{'id':_0x4e04b8['params']['id']}})[_0x57da('0x25')](handleEntityNotFound(_0x14b95d,null))[_0x57da('0x25')](removeEntity(_0x14b95d,null))[_0x57da('0x40')](handleError(_0x14b95d,null));};exports[_0x57da('0x46')]=function(_0x4d07f4,_0x1f16fb){return db[_0x57da('0x3e')]['describe']()[_0x57da('0x25')](respondWithResult(_0x1f16fb,null))[_0x57da('0x40')](handleError(_0x1f16fb,null));}; \ No newline at end of file +var _0x5519=['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','count','set','apply','reject','save','update','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0xc22eb3,_0x1f00d8){var _0x4ecb5a=function(_0x12b67a){while(--_0x12b67a){_0xc22eb3['push'](_0xc22eb3['shift']());}};_0x4ecb5a(++_0x1f00d8);}(_0x5519,0x11b));var _0x9551=function(_0xfb8e9c,_0x4bfaec){_0xfb8e9c=_0xfb8e9c-0x0;var _0x432968=_0x5519[_0xfb8e9c];return _0x432968;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9551('0x0'));var jsonpatch=require(_0x9551('0x1'));var rp=require(_0x9551('0x2'));var moment=require(_0x9551('0x3'));var BPromise=require(_0x9551('0x4'));var Mustache=require(_0x9551('0x5'));var util=require(_0x9551('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9551('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9551('0x8'));var _=require(_0x9551('0x9'));var squel=require(_0x9551('0xa'));var crypto=require(_0x9551('0xb'));var jsforce=require(_0x9551('0xc'));var deskjs=require(_0x9551('0xd'));var toCsv=require(_0x9551('0x7'));var querystring=require(_0x9551('0xe'));var Papa=require(_0x9551('0xf'));var Redis=require(_0x9551('0x10'));var authService=require(_0x9551('0x11'));var qs=require(_0x9551('0x12'));var as=require(_0x9551('0x13'));var hardwareService=require(_0x9551('0x14'));var logger=require(_0x9551('0x15'))(_0x9551('0x16'));var utils=require(_0x9551('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9551('0x18'));var db=require(_0x9551('0x19'))['db'];function respondWithStatusCode(_0x229cb2,_0x362c7c){_0x362c7c=_0x362c7c||0xcc;return function(_0x4cac1d){if(_0x4cac1d){return _0x229cb2[_0x9551('0x1a')](_0x362c7c);}return _0x229cb2[_0x9551('0x1b')](_0x362c7c)[_0x9551('0x1c')]();};}function respondWithResult(_0x5210fa,_0x32e756){_0x32e756=_0x32e756||0xc8;return function(_0x265d37){if(_0x265d37){return _0x5210fa[_0x9551('0x1b')](_0x32e756)[_0x9551('0x1d')](_0x265d37);}};}function respondWithFilteredResult(_0x1dbfe0,_0x1ef51d){return function(_0x3e1e35){if(_0x3e1e35){var _0x5dfada=typeof _0x1ef51d[_0x9551('0x1e')]===_0x9551('0x1f')&&typeof _0x1ef51d[_0x9551('0x20')]===_0x9551('0x1f');var _0x3009db=_0x3e1e35[_0x9551('0x21')];var _0x53ac42=_0x5dfada?0x0:_0x1ef51d[_0x9551('0x1e')];var _0xaf15ef=_0x5dfada?_0x3e1e35[_0x9551('0x21')]:_0x1ef51d[_0x9551('0x1e')]+_0x1ef51d[_0x9551('0x20')];var _0x391881;if(_0xaf15ef>=_0x3009db){_0xaf15ef=_0x3009db;_0x391881=0xc8;}else{_0x391881=0xce;}_0x1dbfe0[_0x9551('0x1b')](_0x391881);return _0x1dbfe0[_0x9551('0x22')]('Content-Range',_0x53ac42+'-'+_0xaf15ef+'/'+_0x3009db)[_0x9551('0x1d')](_0x3e1e35);}return null;};}function patchUpdates(_0x5cc84f){return function(_0x2d2024){try{jsonpatch[_0x9551('0x23')](_0x2d2024,_0x5cc84f,!![]);}catch(_0x500f44){return BPromise[_0x9551('0x24')](_0x500f44);}return _0x2d2024[_0x9551('0x25')]();};}function saveUpdates(_0x3c8975,_0x371d78){return function(_0x317ad6){if(_0x317ad6){return _0x317ad6[_0x9551('0x26')](_0x3c8975)[_0x9551('0x27')](function(_0x226e3d){return _0x226e3d;});}return null;};}function removeEntity(_0x346313,_0x5ecf3e){return function(_0x562fa1){if(_0x562fa1){return _0x562fa1['destroy']()[_0x9551('0x27')](function(){_0x346313[_0x9551('0x1b')](0xcc)[_0x9551('0x1c')]();});}};}function handleEntityNotFound(_0x11eda6,_0x187b8d){return function(_0x63e27a){if(!_0x63e27a){_0x11eda6[_0x9551('0x1a')](0x194);}return _0x63e27a;};}function handleError(_0x10b2b4,_0x24d13e){_0x24d13e=_0x24d13e||0x1f4;return function(_0x54a8a4){logger[_0x9551('0x28')](_0x54a8a4[_0x9551('0x29')]);if(_0x54a8a4[_0x9551('0x2a')]){delete _0x54a8a4[_0x9551('0x2a')];}_0x10b2b4['status'](_0x24d13e)['send'](_0x54a8a4);};}exports[_0x9551('0x2b')]=function(_0x568327,_0x3c4be2){var _0x152a4e={},_0xbfa7df={},_0x18a96a={'count':0x0,'rows':[]};var _0x2c27a3=_[_0x9551('0x2c')](db[_0x9551('0x2d')][_0x9551('0x2e')],function(_0x41aca7){return{'name':_0x41aca7[_0x9551('0x2f')],'type':_0x41aca7[_0x9551('0x30')][_0x9551('0x31')]};});_0xbfa7df[_0x9551('0x32')]=_[_0x9551('0x2c')](_0x2c27a3,'name');_0xbfa7df[_0x9551('0x33')]=_[_0x9551('0x34')](_0x568327[_0x9551('0x33')]);_0xbfa7df[_0x9551('0x35')]=_['intersection'](_0xbfa7df['model'],_0xbfa7df[_0x9551('0x33')]);_0x152a4e[_0x9551('0x36')]=_[_0x9551('0x37')](_0xbfa7df[_0x9551('0x32')],qs[_0x9551('0x38')](_0x568327[_0x9551('0x33')]['fields']));_0x152a4e[_0x9551('0x36')]=_0x152a4e[_0x9551('0x36')]['length']?_0x152a4e[_0x9551('0x36')]:_0xbfa7df[_0x9551('0x32')];if(!_0x568327[_0x9551('0x33')][_0x9551('0x39')]('nolimit')){_0x152a4e[_0x9551('0x20')]=qs[_0x9551('0x20')](_0x568327[_0x9551('0x33')][_0x9551('0x20')]);_0x152a4e[_0x9551('0x1e')]=qs['offset'](_0x568327[_0x9551('0x33')][_0x9551('0x1e')]);}_0x152a4e[_0x9551('0x3a')]=qs[_0x9551('0x3b')](_0x568327[_0x9551('0x33')]['sort']);_0x152a4e[_0x9551('0x3c')]=qs[_0x9551('0x35')](_['pick'](_0x568327[_0x9551('0x33')],_0xbfa7df[_0x9551('0x35')]),_0x2c27a3);if(_0x568327[_0x9551('0x33')][_0x9551('0x3d')]){_0x152a4e[_0x9551('0x3c')]=_[_0x9551('0x3e')](_0x152a4e[_0x9551('0x3c')],{'$or':_[_0x9551('0x2c')](_0x2c27a3,function(_0x5e8068){if(_0x5e8068[_0x9551('0x30')]!==_0x9551('0x3f')){var _0x4237f7={};_0x4237f7[_0x5e8068[_0x9551('0x2a')]]={'$like':'%'+_0x568327[_0x9551('0x33')][_0x9551('0x3d')]+'%'};return _0x4237f7;}})});}_0x152a4e=_[_0x9551('0x3e')]({},_0x152a4e,_0x568327[_0x9551('0x40')]);var _0x35bdd6={'where':_0x152a4e['where']};return db['VoiceDialReport'][_0x9551('0x21')](_0x35bdd6)[_0x9551('0x27')](function(_0x5c1f07){_0x18a96a[_0x9551('0x21')]=_0x5c1f07;if(_0x568327['query']['includeAll']){_0x152a4e[_0x9551('0x41')]=[{'all':!![]}];}return db[_0x9551('0x2d')][_0x9551('0x42')](_0x152a4e);})[_0x9551('0x27')](function(_0x11acdb){_0x18a96a['rows']=_0x11acdb;return _0x18a96a;})[_0x9551('0x27')](respondWithFilteredResult(_0x3c4be2,_0x152a4e))[_0x9551('0x43')](handleError(_0x3c4be2,null));};exports['show']=function(_0x1d5074,_0x433409){var _0x2c83d0={'raw':!![],'where':{'id':_0x1d5074[_0x9551('0x44')]['id']}},_0xe309ce={};_0xe309ce[_0x9551('0x32')]=_[_0x9551('0x34')](db[_0x9551('0x2d')][_0x9551('0x2e')]);_0xe309ce[_0x9551('0x33')]=_['keys'](_0x1d5074[_0x9551('0x33')]);_0xe309ce[_0x9551('0x35')]=_[_0x9551('0x37')](_0xe309ce['model'],_0xe309ce[_0x9551('0x33')]);_0x2c83d0['attributes']=_['intersection'](_0xe309ce['model'],qs['fields'](_0x1d5074['query']['fields']));_0x2c83d0[_0x9551('0x36')]=_0x2c83d0['attributes']['length']?_0x2c83d0[_0x9551('0x36')]:_0xe309ce['model'];if(_0x1d5074[_0x9551('0x33')][_0x9551('0x45')]){_0x2c83d0[_0x9551('0x41')]=[{'all':!![]}];}_0x2c83d0=_[_0x9551('0x3e')]({},_0x2c83d0,_0x1d5074[_0x9551('0x40')]);return db[_0x9551('0x2d')]['find'](_0x2c83d0)[_0x9551('0x27')](handleEntityNotFound(_0x433409,null))[_0x9551('0x27')](respondWithResult(_0x433409,null))[_0x9551('0x43')](handleError(_0x433409,null));};exports['create']=function(_0x42248d,_0x557609){return db[_0x9551('0x2d')][_0x9551('0x46')](_0x42248d[_0x9551('0x47')],{})[_0x9551('0x27')](respondWithResult(_0x557609,0xc9))['catch'](handleError(_0x557609,null));};exports['update']=function(_0x2b65b7,_0x1738d6){if(_0x2b65b7[_0x9551('0x47')]['id']){delete _0x2b65b7[_0x9551('0x47')]['id'];}return db[_0x9551('0x2d')]['find']({'where':{'id':_0x2b65b7[_0x9551('0x44')]['id']}})['then'](handleEntityNotFound(_0x1738d6,null))[_0x9551('0x27')](saveUpdates(_0x2b65b7[_0x9551('0x47')],null))[_0x9551('0x27')](respondWithResult(_0x1738d6,null))['catch'](handleError(_0x1738d6,null));};exports['destroy']=function(_0x21e46e,_0x5a4602){return db[_0x9551('0x2d')][_0x9551('0x48')]({'where':{'id':_0x21e46e[_0x9551('0x44')]['id']}})[_0x9551('0x27')](handleEntityNotFound(_0x5a4602,null))[_0x9551('0x27')](removeEntity(_0x5a4602,null))[_0x9551('0x43')](handleError(_0x5a4602,null));};exports[_0x9551('0x49')]=function(_0x113a21,_0x5b49a9){return db[_0x9551('0x2d')][_0x9551('0x49')]()[_0x9551('0x27')](respondWithResult(_0x5b49a9,null))[_0x9551('0x43')](handleError(_0x5b49a9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2703a83..3621b0b 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 _0x5813=['moment','bluebird','path','rimraf','../../config/environment','uniqueid','util','../../config/logger'];(function(_0x31477f,_0x35dc14){var _0x5f35ca=function(_0x352845){while(--_0x352845){_0x31477f['push'](_0x31477f['shift']());}};_0x5f35ca(++_0x35dc14);}(_0x5813,0x17e));var _0x3581=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5813[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3581('0x0'));var logger=require(_0x3581('0x1'))('api');var moment=require(_0x3581('0x2'));var BPromise=require(_0x3581('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3581('0x4'));var rimraf=require(_0x3581('0x5'));var config=require(_0x3581('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x338159,_0x165413){return _0x338159['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x3581('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad6=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0x5ad6,0xfd));var _0x65ad=function(_0x1d0cba,_0x2731b1){_0x1d0cba=_0x1d0cba-0x0;var _0xdc3278=_0x5ad6[_0x1d0cba];return _0xdc3278;};'use strict';var _=require(_0x65ad('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x65ad('0x1'));var BPromise=require(_0x65ad('0x2'));var rp=require(_0x65ad('0x3'));var fs=require('fs');var path=require(_0x65ad('0x4'));var rimraf=require(_0x65ad('0x5'));var config=require(_0x65ad('0x6'));var attributes=require(_0x65ad('0x7'));module['exports']=function(_0x577aac,_0x569b64){return _0x577aac['define'](_0x65ad('0x8'),attributes,{'tableName':_0x65ad('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65ad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 33ec687..60ee7fb 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 _0x2669=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x2669,0x1eb));var _0x9266=function(_0x2fec96,_0x336634){_0x2fec96=_0x2fec96-0x0;var _0x4bebc0=_0x2669[_0x2fec96];return _0x4bebc0;};'use strict';var _=require(_0x9266('0x0'));var util=require('util');var moment=require(_0x9266('0x1'));var BPromise=require(_0x9266('0x2'));var rs=require(_0x9266('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9266('0x4'));var logger=require(_0x9266('0x5'))('rpc');var config=require(_0x9266('0x6'));var jayson=require(_0x9266('0x7'));var client=jayson['client'][_0x9266('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24806c,_0x3b47a4,_0x1f1424){return new BPromise(function(_0x35f768,_0xcdfea5){return client[_0x9266('0x9')](_0x24806c,_0x1f1424)[_0x9266('0xa')](function(_0x2e6fa3){logger[_0x9266('0xb')](_0x9266('0xc'),_0x3b47a4,_0x9266('0xd'));logger[_0x9266('0xe')](_0x9266('0xf'),_0x3b47a4,'request\x20sent',JSON[_0x9266('0x10')](_0x2e6fa3));if(_0x2e6fa3[_0x9266('0x11')]){if(_0x2e6fa3[_0x9266('0x11')][_0x9266('0x12')]===0x1f4){logger[_0x9266('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3b47a4,_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);return _0xcdfea5(_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);}logger[_0x9266('0x11')](_0x9266('0xc'),_0x3b47a4,_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);return _0x35f768(_0x2e6fa3[_0x9266('0x11')]['message']);}else{logger[_0x9266('0xb')](_0x9266('0xc'),_0x3b47a4,_0x9266('0xd'));_0x35f768(_0x2e6fa3[_0x9266('0x14')][_0x9266('0x13')]);}})[_0x9266('0x15')](function(_0x46faf1){logger[_0x9266('0x11')](_0x9266('0xc'),_0x3b47a4,_0x46faf1);_0xcdfea5(_0x46faf1);});});}exports[_0x9266('0x16')]=function(_0x34186e){var _0xf7101b=this;return new Promise(function(_0x47a998,_0x50d6d3){return db[_0x9266('0x17')][_0x9266('0x18')](_0x34186e['body'],{'raw':_0x34186e[_0x9266('0x19')]?_0x34186e[_0x9266('0x19')][_0x9266('0x1a')]===undefined?!![]:![]:!![]})[_0x9266('0xa')](function(_0x55ae64){logger[_0x9266('0xb')]('CreateVoiceDialReport',_0x34186e);logger['debug'](_0x9266('0x16'),_0x34186e,JSON['stringify'](_0x55ae64));_0x47a998(_0x55ae64);})['catch'](function(_0x2a48f8){logger[_0x9266('0x11')](_0x9266('0x16'),_0x2a48f8[_0x9266('0x13')],_0x34186e);_0x50d6d3(_0xf7101b[_0x9266('0x11')](0x1f4,_0x2a48f8[_0x9266('0x13')]));});});};exports[_0x9266('0x1b')]=function(_0x27a9d0){var _0x16ca7d=this;return new Promise(function(_0x5088cc,_0x4dfc49){return db[_0x9266('0x17')][_0x9266('0x1c')](_0x27a9d0[_0x9266('0x1d')],{'raw':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0['options'][_0x9266('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27a9d0['options']?_0x27a9d0[_0x9266('0x19')][_0x9266('0x1e')]||null:null,'attributes':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0[_0x9266('0x19')][_0x9266('0x1f')]||null:null,'limit':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0['options'][_0x9266('0x20')]||null:null})['then'](function(_0x62e410){logger[_0x9266('0xb')](_0x9266('0x1b'),_0x27a9d0);logger[_0x9266('0xe')](_0x9266('0x1b'),_0x27a9d0,JSON[_0x9266('0x10')](_0x62e410));_0x5088cc(_0x62e410);})['catch'](function(_0x4708f0){logger[_0x9266('0x11')](_0x9266('0x1b'),_0x4708f0[_0x9266('0x13')],_0x27a9d0);_0x4dfc49(_0x16ca7d[_0x9266('0x11')](0x1f4,_0x4708f0[_0x9266('0x13')]));});});}; \ No newline at end of file +var _0xba7b=['bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','debug','UpdateVoiceDialReport','raw','where','attributes','lodash','moment'];(function(_0x4463eb,_0x3cd3fb){var _0x1d20d5=function(_0x18e495){while(--_0x18e495){_0x4463eb['push'](_0x4463eb['shift']());}};_0x1d20d5(++_0x3cd3fb);}(_0xba7b,0xa6));var _0xbba7=function(_0x5e395f,_0x45199e){_0x5e395f=_0x5e395f-0x0;var _0xd6929d=_0xba7b[_0x5e395f];return _0xd6929d;};'use strict';var _=require(_0xbba7('0x0'));var util=require('util');var moment=require(_0xbba7('0x1'));var BPromise=require(_0xbba7('0x2'));var rs=require(_0xbba7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbba7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbba7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbba7('0x6'));var client=jayson[_0xbba7('0x7')][_0xbba7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ce0c9,_0x2f55bc,_0x1edf9d){return new BPromise(function(_0x356891,_0x4a84d5){return client[_0xbba7('0x9')](_0x4ce0c9,_0x1edf9d)[_0xbba7('0xa')](function(_0x17611c){logger[_0xbba7('0xb')](_0xbba7('0xc'),_0x2f55bc,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2f55bc,_0xbba7('0xd'),JSON[_0xbba7('0xe')](_0x17611c));if(_0x17611c['error']){if(_0x17611c[_0xbba7('0xf')][_0xbba7('0x10')]===0x1f4){logger[_0xbba7('0xf')](_0xbba7('0xc'),_0x2f55bc,_0x17611c[_0xbba7('0xf')][_0xbba7('0x11')]);return _0x4a84d5(_0x17611c[_0xbba7('0xf')][_0xbba7('0x11')]);}logger[_0xbba7('0xf')](_0xbba7('0xc'),_0x2f55bc,_0x17611c[_0xbba7('0xf')]['message']);return _0x356891(_0x17611c[_0xbba7('0xf')][_0xbba7('0x11')]);}else{logger['info'](_0xbba7('0xc'),_0x2f55bc,_0xbba7('0xd'));_0x356891(_0x17611c['result']['message']);}})[_0xbba7('0x12')](function(_0x53055d){logger[_0xbba7('0xf')](_0xbba7('0xc'),_0x2f55bc,_0x53055d);_0x4a84d5(_0x53055d);});});}exports[_0xbba7('0x13')]=function(_0x2d346d){var _0x451f9f=this;return new Promise(function(_0x256cd6,_0x48e7d1){return db[_0xbba7('0x14')]['create'](_0x2d346d[_0xbba7('0x15')],{'raw':_0x2d346d[_0xbba7('0x16')]?_0x2d346d['options']['raw']===undefined?!![]:![]:!![]})[_0xbba7('0xa')](function(_0x5339e5){logger[_0xbba7('0xb')](_0xbba7('0x13'),_0x2d346d);logger[_0xbba7('0x17')](_0xbba7('0x13'),_0x2d346d,JSON['stringify'](_0x5339e5));_0x256cd6(_0x5339e5);})[_0xbba7('0x12')](function(_0x2a76a9){logger[_0xbba7('0xf')]('CreateVoiceDialReport',_0x2a76a9[_0xbba7('0x11')],_0x2d346d);_0x48e7d1(_0x451f9f[_0xbba7('0xf')](0x1f4,_0x2a76a9[_0xbba7('0x11')]));});});};exports[_0xbba7('0x18')]=function(_0x4a3fe6){var _0x384b64=this;return new Promise(function(_0x1c62d8,_0x3e89b7){return db[_0xbba7('0x14')]['update'](_0x4a3fe6[_0xbba7('0x15')],{'raw':_0x4a3fe6[_0xbba7('0x16')]?_0x4a3fe6[_0xbba7('0x16')][_0xbba7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a3fe6[_0xbba7('0x16')]?_0x4a3fe6[_0xbba7('0x16')][_0xbba7('0x1a')]||null:null,'attributes':_0x4a3fe6[_0xbba7('0x16')]?_0x4a3fe6['options'][_0xbba7('0x1b')]||null:null,'limit':_0x4a3fe6['options']?_0x4a3fe6[_0xbba7('0x16')]['limit']||null:null})[_0xbba7('0xa')](function(_0x543784){logger[_0xbba7('0xb')]('UpdateVoiceDialReport',_0x4a3fe6);logger[_0xbba7('0x17')](_0xbba7('0x18'),_0x4a3fe6,JSON[_0xbba7('0xe')](_0x543784));_0x1c62d8(_0x543784);})[_0xbba7('0x12')](function(_0x21494b){logger[_0xbba7('0xf')](_0xbba7('0x18'),_0x21494b[_0xbba7('0x11')],_0x4a3fe6);_0x3e89b7(_0x384b64[_0xbba7('0xf')](0x1f4,_0x21494b[_0xbba7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1fd5e5f..59b51b0 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 _0xfa45=['exports','util','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','post','create','/:id/applications','addApplications','/:id','update','destroy'];(function(_0xfa847c,_0x444a8c){var _0x3b22bf=function(_0x32de11){while(--_0x32de11){_0xfa847c['push'](_0xfa847c['shift']());}};_0x3b22bf(++_0x444a8c);}(_0xfa45,0xc1));var _0x5fa4=function(_0x432461,_0x4ec44d){_0x432461=_0x432461-0x0;var _0x3db739=_0xfa45[_0x432461];return _0x3db739;};'use strict';var multer=require('multer');var util=require(_0x5fa4('0x0'));var path=require('path');var timeout=require(_0x5fa4('0x1'));var express=require(_0x5fa4('0x2'));var router=express[_0x5fa4('0x3')]();var fs_extra=require(_0x5fa4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x5fa4('0x5')]('/',auth[_0x5fa4('0x6')](),controller[_0x5fa4('0x7')]);router[_0x5fa4('0x5')]('/:id',auth[_0x5fa4('0x6')](),controller['show']);router[_0x5fa4('0x8')]('/',auth[_0x5fa4('0x6')](),controller[_0x5fa4('0x9')]);router[_0x5fa4('0x8')](_0x5fa4('0xa'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xb')]);router['put'](_0x5fa4('0xc'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xd')]);router['delete'](_0x5fa4('0xc'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xe')]);module[_0x5fa4('0xf')]=router; \ No newline at end of file +var _0xb839=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','show','create','post','/:id/applications','update','delete','/:id'];(function(_0x3b0e97,_0x52a018){var _0x200b84=function(_0x37da17){while(--_0x37da17){_0x3b0e97['push'](_0x3b0e97['shift']());}};_0x200b84(++_0x52a018);}(_0xb839,0x1bb));var _0x9b83=function(_0x1cef49,_0x24d2ce){_0x1cef49=_0x1cef49-0x0;var _0x477132=_0xb839[_0x1cef49];return _0x477132;};'use strict';var multer=require('multer');var util=require(_0x9b83('0x0'));var path=require(_0x9b83('0x1'));var timeout=require(_0x9b83('0x2'));var express=require(_0x9b83('0x3'));var router=express[_0x9b83('0x4')]();var fs_extra=require(_0x9b83('0x5'));var auth=require(_0x9b83('0x6'));var interaction=require(_0x9b83('0x7'));var config=require(_0x9b83('0x8'));var controller=require(_0x9b83('0x9'));router['get']('/',auth[_0x9b83('0xa')](),controller['index']);router[_0x9b83('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9b83('0xc')]);router['post']('/',auth[_0x9b83('0xa')](),controller[_0x9b83('0xd')]);router[_0x9b83('0xe')](_0x9b83('0xf'),auth[_0x9b83('0xa')](),controller['addApplications']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9b83('0x10')]);router[_0x9b83('0x11')](_0x9b83('0x12'),auth[_0x9b83('0xa')](),controller[_0x9b83('0x13')]);module[_0x9b83('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 12541bb..5f1290d 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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x287468,_0x331ffc){var _0x5bf263=function(_0x37168a){while(--_0x37168a){_0x287468['push'](_0x287468['shift']());}};_0x5bf263(++_0x331ffc);}(_0xe706,0xa3));var _0x6e70=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0xe706[_0x77e7e8];return _0x205a3e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x4c2b40,_0x3c89de){var _0x60c094=function(_0x55a909){while(--_0x55a909){_0x4c2b40['push'](_0x4c2b40['shift']());}};_0x60c094(++_0x3c89de);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index fff7f33..817705a 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 _0x953d=['InternalRoutes','internal','ignore','map','value','includes','find','end','error','name','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','show','rawAttributes','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','context','description','cutdigits','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x953d,0x15e));var _0xd953=function(_0x2a7b2d,_0x4ef7ca){_0x2a7b2d=_0x2a7b2d-0x0;var _0x606a57=_0x953d[_0x2a7b2d];return _0x606a57;};'use strict';var _=require(_0xd953('0x0'));var Redis=require(_0xd953('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd953('0x2'))(_0xd953('0x3'));var config=require(_0xd953('0x4'));var db=require(_0xd953('0x5'))['db'];config[_0xd953('0x6')]=_[_0xd953('0x7')](config[_0xd953('0x6')],{'host':_0xd953('0x8'),'port':0x18eb});var socket=require(_0xd953('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xd953('0xa')](socket);function respondWithStatusCode(_0x2e2542,_0x4a0104){_0x4a0104=_0x4a0104||0xcc;return function(_0x205433){if(_0x205433){return _0x2e2542[_0xd953('0xb')](_0x4a0104);}return _0x2e2542[_0xd953('0xc')](_0x4a0104)['end']();};}function respondWithResult(_0x23970e,_0x22eb7e){_0x22eb7e=_0x22eb7e||0xc8;return function(_0x419ab2){if(_0x419ab2){return _0x23970e[_0xd953('0xc')](_0x22eb7e)[_0xd953('0xd')](_0x419ab2);}};}function respondWithFilteredResult(_0x474672,_0x2d6158){return function(_0x18354b){if(_0x18354b){var _0x7ca8a1=typeof _0x2d6158[_0xd953('0xe')]===_0xd953('0xf')&&typeof _0x2d6158[_0xd953('0x10')]==='undefined';var _0x1dd3a4=_0x18354b[_0xd953('0x11')];var _0x46b7db=_0x7ca8a1?0x0:_0x2d6158[_0xd953('0xe')];var _0xb775ec=_0x7ca8a1?_0x18354b[_0xd953('0x11')]:_0x2d6158[_0xd953('0xe')]+_0x2d6158[_0xd953('0x10')];var _0x4b7ed3;if(_0xb775ec>=_0x1dd3a4){_0xb775ec=_0x1dd3a4;_0x4b7ed3=0xc8;}else{_0x4b7ed3=0xce;}_0x474672[_0xd953('0xc')](_0x4b7ed3);return _0x474672[_0xd953('0x12')](_0xd953('0x13'),_0x46b7db+'-'+_0xb775ec+'/'+_0x1dd3a4)['json'](_0x18354b);}return null;};}function removeEntity(_0x3c54f4){return function(_0x34c611){if(_0x34c611){return _0x34c611[_0xd953('0x14')]()[_0xd953('0x15')](function(){var _0xe53cf0=_0x34c611[_0xd953('0x16')]({'plain':!![]});var _0x2cad09=[{'name':'InboundRoutes','value':_0xd953('0x17'),'ignore':![]},{'name':_0xd953('0x18'),'value':_0xd953('0x19'),'ignore':![]},{'name':_0xd953('0x1a'),'value':_0xd953('0x1b'),'ignore':![]}];var _0x16346e=_(_0x2cad09)['filter'](_0xd953('0x1c'))[_0xd953('0x1d')](_0xd953('0x1e'))[_0xd953('0x1e')]();if(_[_0xd953('0x1f')](_0x16346e,_0xe53cf0['type'])){return;}var _0x531f4e=_[_0xd953('0x20')](_0x2cad09,[_0xd953('0x1e'),_0xe53cf0['type']])['name'];return db['UserProfileResource'][_0xd953('0x14')]({'where':{'type':_0x531f4e,'resourceId':_0xe53cf0['id']}})[_0xd953('0x15')](function(){return _0x34c611;});})[_0xd953('0x15')](function(){_0x3c54f4['status'](0xcc)[_0xd953('0x21')]();});}};}function handleEntityNotFound(_0x6da868){return function(_0x38afbc){if(!_0x38afbc){_0x6da868[_0xd953('0xb')](0x194);}return _0x38afbc;};}function handleError(_0x1e8971,_0x579ab4){_0x579ab4=_0x579ab4||0x1f4;return function(_0x4822ce){logger[_0xd953('0x22')](_0x4822ce['stack']);if(_0x4822ce['name']){delete _0x4822ce[_0xd953('0x23')];}_0x1e8971[_0xd953('0xc')](_0x579ab4)[_0xd953('0x24')](_0x4822ce);};}exports[_0xd953('0x25')]=function(_0x4b48dc,_0x2a5e8b){var _0x39f2cd={},_0x1eaa0b={},_0x26a069={'count':0x0,'rows':[]};var _0x1f72e1=_[_0xd953('0x1d')](db[_0xd953('0x26')]['rawAttributes'],function(_0x5751db){return{'name':_0x5751db[_0xd953('0x27')],'type':_0x5751db['type'][_0xd953('0x28')]};});_0x1eaa0b[_0xd953('0x29')]=_[_0xd953('0x1d')](_0x1f72e1,_0xd953('0x23'));_0x1eaa0b[_0xd953('0x2a')]=_[_0xd953('0x2b')](_0x4b48dc[_0xd953('0x2a')]);_0x1eaa0b[_0xd953('0x2c')]=_[_0xd953('0x2d')](_0x1eaa0b[_0xd953('0x29')],_0x1eaa0b['query']);_0x39f2cd['attributes']=_['intersection'](_0x1eaa0b['model'],qs[_0xd953('0x2e')](_0x4b48dc['query'][_0xd953('0x2e')]));_0x39f2cd[_0xd953('0x2f')]=_0x39f2cd[_0xd953('0x2f')][_0xd953('0x30')]?_0x39f2cd[_0xd953('0x2f')]:_0x1eaa0b['model'];if(!_0x4b48dc[_0xd953('0x2a')][_0xd953('0x31')](_0xd953('0x32'))){_0x39f2cd[_0xd953('0x10')]=qs['limit'](_0x4b48dc[_0xd953('0x2a')][_0xd953('0x10')]);_0x39f2cd['offset']=qs['offset'](_0x4b48dc['query'][_0xd953('0xe')]);}_0x39f2cd[_0xd953('0x33')]=qs[_0xd953('0x34')](_0x4b48dc['query'][_0xd953('0x34')]);_0x39f2cd[_0xd953('0x35')]=qs[_0xd953('0x2c')](_['pick'](_0x4b48dc['query'],_0x1eaa0b['filters']),_0x1f72e1);if(_0x4b48dc[_0xd953('0x2a')][_0xd953('0x36')]){_0x39f2cd[_0xd953('0x35')]=_[_0xd953('0x37')](_0x39f2cd[_0xd953('0x35')],{'$or':_['map'](_0x1f72e1,function(_0x2c3b96){if(_0x2c3b96[_0xd953('0x38')]!==_0xd953('0x39')){var _0x428007={};_0x428007[_0x2c3b96[_0xd953('0x23')]]={'$like':'%'+_0x4b48dc['query'][_0xd953('0x36')]+'%'};return _0x428007;}})});}_0x39f2cd=_['merge']({},_0x39f2cd,_0x4b48dc[_0xd953('0x3a')]);var _0x16b426={'where':_0x39f2cd[_0xd953('0x35')]};return db['VoiceExtension'][_0xd953('0x11')](_0x16b426)[_0xd953('0x15')](function(_0x3965aa){_0x26a069[_0xd953('0x11')]=_0x3965aa;if(_0x4b48dc[_0xd953('0x2a')]['includeAll']){_0x39f2cd[_0xd953('0x3b')]=[{'all':!![]}];}return db[_0xd953('0x26')]['findAll'](_0x39f2cd);})[_0xd953('0x15')](function(_0x29ba8f){_0x26a069[_0xd953('0x3c')]=_0x29ba8f;return _0x26a069;})['then'](respondWithFilteredResult(_0x2a5e8b,_0x39f2cd))[_0xd953('0x3d')](handleError(_0x2a5e8b,null));};exports[_0xd953('0x3e')]=function(_0x2319ef,_0x2cccdb){var _0x17deb0={'raw':![],'where':{'id':_0x2319ef['params']['id']}},_0x1a1660={};_0x1a1660[_0xd953('0x29')]=_['keys'](db[_0xd953('0x26')][_0xd953('0x3f')]);_0x1a1660[_0xd953('0x2a')]=_[_0xd953('0x2b')](_0x2319ef[_0xd953('0x2a')]);_0x1a1660[_0xd953('0x2c')]=_[_0xd953('0x2d')](_0x1a1660['model'],_0x1a1660[_0xd953('0x2a')]);_0x17deb0[_0xd953('0x2f')]=_[_0xd953('0x2d')](_0x1a1660[_0xd953('0x29')],qs[_0xd953('0x2e')](_0x2319ef['query'][_0xd953('0x2e')]));_0x17deb0[_0xd953('0x2f')]=_0x17deb0[_0xd953('0x2f')][_0xd953('0x30')]?_0x17deb0[_0xd953('0x2f')]:_0x1a1660[_0xd953('0x29')];if(_0x2319ef[_0xd953('0x2a')]['includeAll']){_0x17deb0[_0xd953('0x3b')]=[{'all':!![]}];}_0x17deb0=_[_0xd953('0x37')]({},_0x17deb0,_0x2319ef[_0xd953('0x3a')]);return db['VoiceExtension'][_0xd953('0x20')](_0x17deb0)[_0xd953('0x15')](handleEntityNotFound(_0x2cccdb,null))['then'](respondWithResult(_0x2cccdb,null))[_0xd953('0x3d')](handleError(_0x2cccdb,null));};exports['destroy']=function(_0x6f6013,_0x5979bb){return db[_0xd953('0x26')][_0xd953('0x20')]({'where':{'id':_0x6f6013['params']['id']}})[_0xd953('0x15')](handleEntityNotFound(_0x5979bb,null))[_0xd953('0x15')](removeEntity(_0x5979bb,null))[_0xd953('0x3d')](handleError(_0x5979bb,null));};exports[_0xd953('0x40')]=function(_0x4fdd85,_0x23d975){if(_0x4fdd85[_0xd953('0x41')]['type']===_0xd953('0x19')&&!_[_0xd953('0x42')](_0x4fdd85['body'][_0xd953('0x43')],'_')){_0x4fdd85[_0xd953('0x41')][_0xd953('0x43')]='_'[_0xd953('0x44')](_0x4fdd85[_0xd953('0x41')]['exten']);}return db[_0xd953('0x26')]['create'](_0x4fdd85['body'],{'raw':![]})[_0xd953('0x15')](function(_0x1efcdb){var _0x357a98=_0x4fdd85[_0xd953('0x45')][_0xd953('0x16')]({'plain':!![]});if(!_0x357a98)throw new Error(_0xd953('0x46'));if(_0x357a98[_0xd953('0x47')]===_0xd953('0x45')){var _0x2049bf=_0x1efcdb['get']({'plain':!![]});var _0x554a60=[{'name':'InboundRoutes','value':_0xd953('0x17')},{'name':_0xd953('0x18'),'value':'outbound'},{'name':_0xd953('0x1a'),'value':_0xd953('0x1b')}];var _0xbc25e6=_['find'](_0x554a60,[_0xd953('0x1e'),_0x2049bf['type']])[_0xd953('0x23')];return db[_0xd953('0x48')][_0xd953('0x20')]({'where':{'name':_0xbc25e6,'userProfileId':_0x357a98['userProfileId']},'raw':!![]})['then'](function(_0x1d5bb1){if(_0x1d5bb1&&_0x1d5bb1[_0xd953('0x49')]===0x0){return db[_0xd953('0x4a')][_0xd953('0x40')]({'name':_0x2049bf[_0xd953('0x23')],'resourceId':_0x2049bf['id'],'type':_0x1d5bb1[_0xd953('0x23')],'sectionId':_0x1d5bb1['id']},{})['then'](function(){return _0x1efcdb;});}else{return _0x1efcdb;}})['catch'](function(_0x343196){logger[_0xd953('0x22')](_0xd953('0x4b'),_0x343196);throw _0x343196;});}return _0x1efcdb;})[_0xd953('0x15')](respondWithResult(_0x23d975,0xc9))[_0xd953('0x3d')](handleError(_0x23d975,null));};exports[_0xd953('0x4c')]=function(_0x5ae855,_0x31c95f){if(_0x5ae855['body']['id']){delete _0x5ae855['body']['id'];}return db[_0xd953('0x26')][_0xd953('0x20')]({'where':{'id':_0x5ae855[_0xd953('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31c95f,null))[_0xd953('0x15')](function(_0x20d5f7){if(_0x20d5f7){return db[_0xd953('0x26')][_0xd953('0x4c')](_['pick'](_0x5ae855[_0xd953('0x41')],[_0xd953('0x43'),_0xd953('0x4e'),_0xd953('0x4f'),'recordingFormat',_0xd953('0x50'),'mandatoryDisposition','alias']),{'where':{'context':_0x20d5f7[_0xd953('0x4e')],'exten':_0x20d5f7[_0xd953('0x43')]},'individualHooks':!![]})[_0xd953('0x15')](function(_0x12d865){return _0x12d865;});}return null;})['then'](respondWithStatusCode(_0x31c95f,null))['catch'](handleError(_0x31c95f,null));};exports[_0xd953('0x51')]=function(_0x355f3e,_0x1918a8){var _0x28de9a=_0x355f3e['params']['id'];var _0x5c5aae=_0x355f3e[_0xd953('0x41')];var _0x562216=0xc8;var _0x4b3df3=null;return db[_0xd953('0x52')][_0xd953('0x53')]({'isolationLevel':db['sequelize'][_0xd953('0x54')]['ISOLATION_LEVELS'][_0xd953('0x55')]},function(_0x4a7617){return db['VoiceExtension'][_0xd953('0x56')]({'where':{'id':_0x28de9a},'transaction':_0x4a7617})[_0xd953('0x15')](function(_0x417ebc){if(_0x417ebc){return db[_0xd953('0x26')][_0xd953('0x14')]({'where':{'VoiceExtensionId':_0x28de9a},'transaction':_0x4a7617})[_0xd953('0x15')](function(){var _0x396e79=_[_0xd953('0x1d')](_0x5c5aae,function(_0xf436ba){_0xf436ba[_0xd953('0x57')]=_0x28de9a;_0xf436ba[_0xd953('0x58')]=!![];return _0xf436ba;});return _0x417ebc[_0xd953('0x59')](_0x396e79);})[_0xd953('0x15')](function(_0x48d43a){return db['VoiceExtension']['bulkCreate'](_0x48d43a,{'transaction':_0x4a7617});});}else{_0x562216=0x194;_0x4b3df3=[];}});})['then'](function(){if(_0x562216!==0x194){return db[_0xd953('0x26')][_0xd953('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x28de9a},'order':_0xd953('0x5b')})[_0xd953('0x15')](function(_0x570ddf){_0x4b3df3=_0x570ddf;});}})['catch'](function(_0x54adfe){_0x562216=0x1f4;logger['error'](_0x54adfe[_0xd953('0x5c')]);if(_0x54adfe[_0xd953('0x23')]){delete _0x54adfe[_0xd953('0x23')];}_0x4b3df3=_0x54adfe;})[_0xd953('0x5d')](function(){if(_0x4b3df3===null){_0x1918a8['sendStatus'](_0x562216);}else{if(_0x562216===0x1f4){_0x1918a8[_0xd953('0xc')](_0x562216)[_0xd953('0x24')](_0x4b3df3);}else{_0x1918a8['status'](_0x562216)[_0xd953('0xd')](_0x4b3df3);}}});}; \ No newline at end of file +var _0x086b=['then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','destroy','error','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','create','body','startsWith','exten','concat','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0xd58ee8,_0x2ecdc0){var _0x13c09f=function(_0x160507){while(--_0x160507){_0xd58ee8['push'](_0xd58ee8['shift']());}};_0x13c09f(++_0x2ecdc0);}(_0x086b,0x160));var _0xb086=function(_0x5271e3,_0x448707){_0x5271e3=_0x5271e3-0x0;var _0x54ffdf=_0x086b[_0x5271e3];return _0x54ffdf;};'use strict';var _=require(_0xb086('0x0'));var Redis=require(_0xb086('0x1'));var qs=require(_0xb086('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xb086('0x3'));var db=require(_0xb086('0x4'))['db'];config['redis']=_['defaults'](config[_0xb086('0x5')],{'host':_0xb086('0x6'),'port':0x18eb});var socket=require(_0xb086('0x7'))(new Redis(config[_0xb086('0x5')]));require(_0xb086('0x8'))[_0xb086('0x9')](socket);function respondWithStatusCode(_0x4a6aa5,_0x252973){_0x252973=_0x252973||0xcc;return function(_0x181ce9){if(_0x181ce9){return _0x4a6aa5[_0xb086('0xa')](_0x252973);}return _0x4a6aa5[_0xb086('0xb')](_0x252973)[_0xb086('0xc')]();};}function respondWithResult(_0x860a42,_0x54595e){_0x54595e=_0x54595e||0xc8;return function(_0x554c87){if(_0x554c87){return _0x860a42[_0xb086('0xb')](_0x54595e)[_0xb086('0xd')](_0x554c87);}};}function respondWithFilteredResult(_0x409e59,_0x3651e5){return function(_0x37183a){if(_0x37183a){var _0x56ba09=typeof _0x3651e5[_0xb086('0xe')]==='undefined'&&typeof _0x3651e5[_0xb086('0xf')]===_0xb086('0x10');var _0x5887a2=_0x37183a['count'];var _0x3d5e51=_0x56ba09?0x0:_0x3651e5[_0xb086('0xe')];var _0x1139a8=_0x56ba09?_0x37183a[_0xb086('0x11')]:_0x3651e5[_0xb086('0xe')]+_0x3651e5['limit'];var _0xfd3bf0;if(_0x1139a8>=_0x5887a2){_0x1139a8=_0x5887a2;_0xfd3bf0=0xc8;}else{_0xfd3bf0=0xce;}_0x409e59[_0xb086('0xb')](_0xfd3bf0);return _0x409e59[_0xb086('0x12')](_0xb086('0x13'),_0x3d5e51+'-'+_0x1139a8+'/'+_0x5887a2)['json'](_0x37183a);}return null;};}function removeEntity(_0x19806d){return function(_0x574750){if(_0x574750){return _0x574750['destroy']()[_0xb086('0x14')](function(){var _0x13b139=_0x574750[_0xb086('0x15')]({'plain':!![]});var _0x1f3214=[{'name':_0xb086('0x16'),'value':_0xb086('0x17'),'ignore':![]},{'name':_0xb086('0x18'),'value':_0xb086('0x19'),'ignore':![]},{'name':_0xb086('0x1a'),'value':_0xb086('0x1b'),'ignore':![]}];var _0x1355e4=_(_0x1f3214)[_0xb086('0x1c')](_0xb086('0x1d'))[_0xb086('0x1e')]('value')[_0xb086('0x1f')]();if(_[_0xb086('0x20')](_0x1355e4,_0x13b139['type'])){return;}var _0x1dbbcf=_[_0xb086('0x21')](_0x1f3214,['value',_0x13b139[_0xb086('0x22')]])[_0xb086('0x23')];return db[_0xb086('0x24')][_0xb086('0x25')]({'where':{'type':_0x1dbbcf,'resourceId':_0x13b139['id']}})[_0xb086('0x14')](function(){return _0x574750;});})[_0xb086('0x14')](function(){_0x19806d[_0xb086('0xb')](0xcc)[_0xb086('0xc')]();});}};}function handleEntityNotFound(_0x505d16){return function(_0x2fbafb){if(!_0x2fbafb){_0x505d16[_0xb086('0xa')](0x194);}return _0x2fbafb;};}function handleError(_0x551d14,_0x4080ee){_0x4080ee=_0x4080ee||0x1f4;return function(_0x43e4fe){logger[_0xb086('0x26')](_0x43e4fe[_0xb086('0x27')]);if(_0x43e4fe[_0xb086('0x23')]){delete _0x43e4fe['name'];}_0x551d14[_0xb086('0xb')](_0x4080ee)['send'](_0x43e4fe);};}exports[_0xb086('0x28')]=function(_0x3131a9,_0x231c3b){var _0x403c9e={},_0x1df457={},_0x535b48={'count':0x0,'rows':[]};var _0x542b8b=_[_0xb086('0x1e')](db[_0xb086('0x29')][_0xb086('0x2a')],function(_0x31860f){return{'name':_0x31860f[_0xb086('0x2b')],'type':_0x31860f[_0xb086('0x22')][_0xb086('0x2c')]};});_0x1df457[_0xb086('0x2d')]=_[_0xb086('0x1e')](_0x542b8b,'name');_0x1df457[_0xb086('0x2e')]=_[_0xb086('0x2f')](_0x3131a9[_0xb086('0x2e')]);_0x1df457[_0xb086('0x30')]=_[_0xb086('0x31')](_0x1df457[_0xb086('0x2d')],_0x1df457[_0xb086('0x2e')]);_0x403c9e[_0xb086('0x32')]=_[_0xb086('0x31')](_0x1df457[_0xb086('0x2d')],qs['fields'](_0x3131a9[_0xb086('0x2e')][_0xb086('0x33')]));_0x403c9e[_0xb086('0x32')]=_0x403c9e['attributes']['length']?_0x403c9e['attributes']:_0x1df457[_0xb086('0x2d')];if(!_0x3131a9[_0xb086('0x2e')][_0xb086('0x34')](_0xb086('0x35'))){_0x403c9e[_0xb086('0xf')]=qs['limit'](_0x3131a9[_0xb086('0x2e')][_0xb086('0xf')]);_0x403c9e[_0xb086('0xe')]=qs[_0xb086('0xe')](_0x3131a9['query'][_0xb086('0xe')]);}_0x403c9e[_0xb086('0x36')]=qs['sort'](_0x3131a9[_0xb086('0x2e')]['sort']);_0x403c9e['where']=qs[_0xb086('0x30')](_[_0xb086('0x37')](_0x3131a9[_0xb086('0x2e')],_0x1df457[_0xb086('0x30')]),_0x542b8b);if(_0x3131a9['query'][_0xb086('0x1c')]){_0x403c9e[_0xb086('0x38')]=_[_0xb086('0x39')](_0x403c9e[_0xb086('0x38')],{'$or':_['map'](_0x542b8b,function(_0x434828){if(_0x434828[_0xb086('0x22')]!==_0xb086('0x3a')){var _0x384afe={};_0x384afe[_0x434828[_0xb086('0x23')]]={'$like':'%'+_0x3131a9[_0xb086('0x2e')][_0xb086('0x1c')]+'%'};return _0x384afe;}})});}_0x403c9e=_['merge']({},_0x403c9e,_0x3131a9[_0xb086('0x3b')]);var _0x3fb01d={'where':_0x403c9e[_0xb086('0x38')]};return db[_0xb086('0x29')][_0xb086('0x11')](_0x3fb01d)['then'](function(_0x2837b6){_0x535b48[_0xb086('0x11')]=_0x2837b6;if(_0x3131a9['query']['includeAll']){_0x403c9e['include']=[{'all':!![]}];}return db[_0xb086('0x29')][_0xb086('0x3c')](_0x403c9e);})[_0xb086('0x14')](function(_0x3c9846){_0x535b48[_0xb086('0x3d')]=_0x3c9846;return _0x535b48;})[_0xb086('0x14')](respondWithFilteredResult(_0x231c3b,_0x403c9e))[_0xb086('0x3e')](handleError(_0x231c3b,null));};exports[_0xb086('0x3f')]=function(_0x1c6483,_0x48976a){var _0x400e29={'raw':![],'where':{'id':_0x1c6483[_0xb086('0x40')]['id']}},_0x27e228={};_0x27e228['model']=_[_0xb086('0x2f')](db['VoiceExtension'][_0xb086('0x2a')]);_0x27e228[_0xb086('0x2e')]=_[_0xb086('0x2f')](_0x1c6483['query']);_0x27e228[_0xb086('0x30')]=_[_0xb086('0x31')](_0x27e228[_0xb086('0x2d')],_0x27e228[_0xb086('0x2e')]);_0x400e29[_0xb086('0x32')]=_[_0xb086('0x31')](_0x27e228[_0xb086('0x2d')],qs[_0xb086('0x33')](_0x1c6483[_0xb086('0x2e')][_0xb086('0x33')]));_0x400e29[_0xb086('0x32')]=_0x400e29[_0xb086('0x32')][_0xb086('0x41')]?_0x400e29[_0xb086('0x32')]:_0x27e228[_0xb086('0x2d')];if(_0x1c6483['query'][_0xb086('0x42')]){_0x400e29['include']=[{'all':!![]}];}_0x400e29=_[_0xb086('0x39')]({},_0x400e29,_0x1c6483['options']);return db[_0xb086('0x29')][_0xb086('0x21')](_0x400e29)[_0xb086('0x14')](handleEntityNotFound(_0x48976a,null))[_0xb086('0x14')](respondWithResult(_0x48976a,null))[_0xb086('0x3e')](handleError(_0x48976a,null));};exports[_0xb086('0x25')]=function(_0x3f9c5a,_0xeedc5e){return db[_0xb086('0x29')][_0xb086('0x21')]({'where':{'id':_0x3f9c5a[_0xb086('0x40')]['id']}})[_0xb086('0x14')](handleEntityNotFound(_0xeedc5e,null))[_0xb086('0x14')](removeEntity(_0xeedc5e,null))['catch'](handleError(_0xeedc5e,null));};exports[_0xb086('0x43')]=function(_0x2653e1,_0x47e8c1){if(_0x2653e1[_0xb086('0x44')][_0xb086('0x22')]===_0xb086('0x19')&&!_[_0xb086('0x45')](_0x2653e1[_0xb086('0x44')][_0xb086('0x46')],'_')){_0x2653e1[_0xb086('0x44')][_0xb086('0x46')]='_'[_0xb086('0x47')](_0x2653e1['body'][_0xb086('0x46')]);}return db[_0xb086('0x29')][_0xb086('0x43')](_0x2653e1[_0xb086('0x44')],{'raw':![]})['then'](function(_0x121ca1){var _0x563cb5=_0x2653e1[_0xb086('0x48')][_0xb086('0x15')]({'plain':!![]});if(!_0x563cb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x563cb5[_0xb086('0x49')]===_0xb086('0x48')){var _0x2a7872=_0x121ca1['get']({'plain':!![]});var _0x5e8103=[{'name':_0xb086('0x16'),'value':_0xb086('0x17')},{'name':_0xb086('0x18'),'value':_0xb086('0x19')},{'name':_0xb086('0x1a'),'value':_0xb086('0x1b')}];var _0x246ea1=_['find'](_0x5e8103,[_0xb086('0x1f'),_0x2a7872[_0xb086('0x22')]])[_0xb086('0x23')];return db['UserProfileSection'][_0xb086('0x21')]({'where':{'name':_0x246ea1,'userProfileId':_0x563cb5['userProfileId']},'raw':!![]})[_0xb086('0x14')](function(_0x161636){if(_0x161636&&_0x161636[_0xb086('0x4a')]===0x0){return db[_0xb086('0x24')]['create']({'name':_0x2a7872['name'],'resourceId':_0x2a7872['id'],'type':_0x161636[_0xb086('0x23')],'sectionId':_0x161636['id']},{})[_0xb086('0x14')](function(){return _0x121ca1;});}else{return _0x121ca1;}})[_0xb086('0x3e')](function(_0xe0ab0c){logger[_0xb086('0x26')](_0xb086('0x4b'),_0xe0ab0c);throw _0xe0ab0c;});}return _0x121ca1;})[_0xb086('0x14')](respondWithResult(_0x47e8c1,0xc9))[_0xb086('0x3e')](handleError(_0x47e8c1,null));};exports[_0xb086('0x4c')]=function(_0x46b895,_0x20d7c5){if(_0x46b895[_0xb086('0x44')]['id']){delete _0x46b895[_0xb086('0x44')]['id'];}return db[_0xb086('0x29')][_0xb086('0x21')]({'where':{'id':_0x46b895['params']['id']}})['then'](handleEntityNotFound(_0x20d7c5,null))['then'](function(_0x4ea070){if(_0x4ea070){return db['VoiceExtension']['update'](_[_0xb086('0x37')](_0x46b895[_0xb086('0x44')],[_0xb086('0x46'),_0xb086('0x4d'),'description',_0xb086('0x4e'),'cutdigits',_0xb086('0x4f'),'alias']),{'where':{'context':_0x4ea070[_0xb086('0x4d')],'exten':_0x4ea070[_0xb086('0x46')]},'individualHooks':!![]})[_0xb086('0x14')](function(_0x346100){return _0x346100;});}return null;})[_0xb086('0x14')](respondWithStatusCode(_0x20d7c5,null))[_0xb086('0x3e')](handleError(_0x20d7c5,null));};exports['addApplications']=function(_0x2f5077,_0x22bba5){var _0x4e3df9=_0x2f5077[_0xb086('0x40')]['id'];var _0x2ab2d0=_0x2f5077[_0xb086('0x44')];var _0x280012=0xc8;var _0x438e46=null;return db[_0xb086('0x50')][_0xb086('0x51')]({'isolationLevel':db[_0xb086('0x50')][_0xb086('0x52')][_0xb086('0x53')][_0xb086('0x54')]},function(_0x518621){return db[_0xb086('0x29')][_0xb086('0x55')]({'where':{'id':_0x4e3df9},'transaction':_0x518621})[_0xb086('0x14')](function(_0x16f009){if(_0x16f009){return db[_0xb086('0x29')][_0xb086('0x25')]({'where':{'VoiceExtensionId':_0x4e3df9},'transaction':_0x518621})[_0xb086('0x14')](function(){var _0x470f8e=_[_0xb086('0x1e')](_0x2ab2d0,function(_0x1014a5){_0x1014a5[_0xb086('0x56')]=_0x4e3df9;_0x1014a5[_0xb086('0x57')]=!![];return _0x1014a5;});return _0x16f009[_0xb086('0x58')](_0x470f8e);})[_0xb086('0x14')](function(_0x34d11a){return db[_0xb086('0x29')][_0xb086('0x59')](_0x34d11a,{'transaction':_0x518621});});}else{_0x280012=0x194;_0x438e46=[];}});})[_0xb086('0x14')](function(){if(_0x280012!==0x194){return db[_0xb086('0x29')][_0xb086('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4e3df9},'order':_0xb086('0x5b')})[_0xb086('0x14')](function(_0x28ff46){_0x438e46=_0x28ff46;});}})['catch'](function(_0x578af5){_0x280012=0x1f4;logger[_0xb086('0x26')](_0x578af5['stack']);if(_0x578af5[_0xb086('0x23')]){delete _0x578af5[_0xb086('0x23')];}_0x438e46=_0x578af5;})[_0xb086('0x5c')](function(){if(_0x438e46===null){_0x22bba5[_0xb086('0xa')](_0x280012);}else{if(_0x280012===0x1f4){_0x22bba5['status'](_0x280012)['send'](_0x438e46);}else{_0x22bba5[_0xb086('0xb')](_0x280012)[_0xb086('0xd')](_0x438e46);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ae00b27..a85de65 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 _0x806e=['setMaxListeners','save','emit','hook','exports','../../mysqldb','VoiceExtension'];(function(_0x414d4c,_0x2b0ddb){var _0x167700=function(_0x522599){while(--_0x522599){_0x414d4c['push'](_0x414d4c['shift']());}};_0x167700(++_0x2b0ddb);}(_0x806e,0x12b));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xe806('0x0'))['db'][_0xe806('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe806('0x2')](0x0);var events={'afterCreate':_0xe806('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ca5e0){return function(_0x515e69,_0x53e97c,_0x2d85fa){VoiceExtensionEvents['emit'](_0x4ca5e0+':'+_0x515e69['id'],_0x515e69);VoiceExtensionEvents[_0xe806('0x4')](_0x4ca5e0,_0x515e69);_0x2d85fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xe806('0x5')](e,emitEvent(event));}}module[_0xe806('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x05a7=['setMaxListeners','remove','emit','hook','events','VoiceExtension'];(function(_0x51272f,_0x230483){var _0x3b06cc=function(_0xef8f94){while(--_0xef8f94){_0x51272f['push'](_0x51272f['shift']());}};_0x3b06cc(++_0x230483);}(_0x05a7,0xe8));var _0x705a=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x05a7[_0x53b594];return _0x1e616f;};'use strict';var EventEmitter=require(_0x705a('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x705a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x705a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x705a('0x3')};function emitEvent(_0x32a45b){return function(_0x46a483,_0x2881c6,_0x50a1a8){VoiceExtensionEvents[_0x705a('0x4')](_0x32a45b+':'+_0x46a483['id'],_0x46a483);VoiceExtensionEvents[_0x705a('0x4')](_0x32a45b,_0x46a483);_0x50a1a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x705a('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6649def..c4e8610 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 _0x6b54=['trunk','timeout','options','split','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','length','*,*,*,*','intervals','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','voice_extensions','get','then','concat','lodash','models','type','Set','CDR(type)=','context','inbound','push','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6b54,0xd0));var _0x46b5=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x6b54[_0x3a7455];return _0x216c72;};'use strict';var _=require(_0x46b5('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x20ac33){var _0x15aabe=_0x20ac33[_0x46b5('0x1')];function _0x1852f5(_0x29f21a){var _0x3ba090=0x2;var _0x4f6e50=[{'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':_0x46b5('0x4')+_0x29f21a[_0x46b5('0x2')],'context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']}];if(_0x29f21a[_0x46b5('0x2')]===_0x46b5('0x6')){_0x4f6e50[_0x46b5('0x7')]({'type':_0x46b5('0x6'),'app':_0x46b5('0x3'),'appdata':'CDR(routeid)='+_0x29f21a['id'],'context':_0x29f21a['context'],'exten':_0x29f21a[_0x46b5('0x8')],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']});}_0x4f6e50['push']({'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']},{'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':_0x46b5('0x9'),'context':_0x29f21a['context'],'exten':_0x29f21a[_0x46b5('0x8')],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']},{'type':_0x29f21a[_0x46b5('0x2')],'app':'Set','appdata':_0x46b5('0xa'),'context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']});return _0x4f6e50;}function _0x2fbf2d(_0xd8b226){var _0x23f0e2=0x2;var _0x284a14=[{'type':_0x46b5('0xb'),'app':'Set','appdata':_0x46b5('0xc'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0xd')+(_0xd8b226['cutdigits']?_0x46b5('0xe')+_0xd8b226[_0x46b5('0xf')]+'}':_0x46b5('0x10')),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':'Set','appdata':'CDR(routeid)='+_0xd8b226['id'],'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x11'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x23f0e2+0x2)+_0x46b5('0x12')+(_0x23f0e2+0x1)+')','context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':'Set','appdata':_0xd8b226[_0x46b5('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xd8b226[_0x46b5('0xf')]+'}':_0x46b5('0x13'),'context':_0xd8b226['context'],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':'Set','appdata':_0x46b5('0x14'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x9'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x3'),'appdata':_0x46b5('0xa'),'context':_0xd8b226['context'],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0xd8b226['id'],'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']}];if(_0xd8b226['hasOwnProperty'](_0x46b5('0x15'))&&_0xd8b226[_0x46b5('0x15')]!==_0x46b5('0x16')){_0x284a14[_0x46b5('0x7')]({'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x17'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x3'),'appdata':_0x46b5('0x18')+_0xd8b226['recordingFormat']||_0x46b5('0x19'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']});}return _0x284a14;}function _0x28b04d(_0x134bad,_0x36df25){var _0x4c776c=[{'name':_0x46b5('0x1a'),'param':0x0},{'name':_0x46b5('0x1b'),'param':0x1},{'name':_0x46b5('0x1c'),'param':0x2},{'name':'url','param':0x3}];var _0x65b4bd={};var _0x2d59d1=_0x36df25[_0x46b5('0x1d')](',');var _0x2508c6=[];for(var _0x25f0ed=0x0;_0x25f0ed<_0x4c776c['length'];_0x25f0ed++){switch(_0x4c776c[_0x25f0ed]['name']){case'trunk':_0x65b4bd[_0x46b5('0x1a')]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]][_0x46b5('0x1d')]('/')[0x1];_0x65b4bd[_0x46b5('0x1f')]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]]['split']('/')[0x2];_0x65b4bd[_0x46b5('0x20')]=_0x65b4bd[_0x46b5('0x1f')]?_0x65b4bd[_0x46b5('0x1f')][_0x46b5('0x1d')]('$')[0x0]:undefined;_0x65b4bd['phone']=_0x134bad[_0x46b5('0xf')]?(_0x65b4bd[_0x46b5('0x20')]||'')+_0x46b5('0xe')+_0x134bad[_0x46b5('0xf')]+'}':(_0x65b4bd[_0x46b5('0x20')]||'')+_0x46b5('0x10');_0x2508c6[_0x4c776c[_0x25f0ed]['param']]=[_0x46b5('0x21'),_0x65b4bd[_0x46b5('0x1a')],_0x65b4bd[_0x46b5('0x1f')]][_0x46b5('0x22')]('/');break;case _0x46b5('0x1c'):_0x65b4bd[_0x46b5('0x1c')]=_0x2d59d1[_0x4c776c[_0x25f0ed]['param']];if(_0x134bad[_0x46b5('0x15')]!==_0x46b5('0x16')){if(_0x65b4bd[_0x46b5('0x1c')][_0x46b5('0x23')](_0x46b5('0x24'))<0x0){_0x65b4bd[_0x46b5('0x1c')]+='U(xcally-mixmonitor-context)';}}else{_0x65b4bd[_0x46b5('0x1c')]=_0x65b4bd['options'][_0x46b5('0x25')](_0x46b5('0x24'),'');}_0x2508c6[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]]=_0x65b4bd[_0x46b5('0x1c')];break;default:_0x2508c6[_0x4c776c[_0x25f0ed]['param']]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]];}}return _0x2508c6[_0x46b5('0x22')](',');}function _0x4bace3(_0x3300da,_0x1f02ea,_0x1e5d3b){return new Promise(function(_0x49dc11,_0x25f15e){var _0x281db7=[];if(_[_0x46b5('0x26')](_0x1f02ea))return _0x49dc11(_0x281db7);_0x15aabe['Interval'][_0x46b5('0x27')]({'attributes':['id',_0x46b5('0x28'),_0x46b5('0x29')],'raw':!![]})['then'](function(_0x404e30){for(var _0x134d33=0x0,_0xf1cbfc=0x0;_0x134d33<_0x1f02ea[_0x46b5('0x2a')];_0x134d33++,_0xf1cbfc=0x0){var _0x23a8dc=_0x1f02ea[_0x134d33];var _0x3b9661=[];var _0x33a46c=[];delete _0x23a8dc['id'];if(_0x23a8dc[_0x46b5('0x28')]!==_0x46b5('0x2b')){_0x23a8dc[_0x46b5('0x2c')]=[_0x23a8dc[_0x46b5('0x28')]];}else{_0x23a8dc[_0x46b5('0x2c')]=_0x23a8dc[_0x46b5('0x29')]?_['map'](_[_0x46b5('0x2d')](_0x404e30,{'IntervalId':_0x23a8dc[_0x46b5('0x29')]}),'interval'):[];}_0x23a8dc['context']=_0x3300da[_0x46b5('0x5')];_0x23a8dc[_0x46b5('0x8')]=_0x3300da[_0x46b5('0x8')];if(_0x23a8dc['type'])_0x23a8dc[_0x46b5('0x2')]=_0x23a8dc[_0x46b5('0x2')]['toLowerCase']();if(_0x3300da[_0x46b5('0x2')]===_0x46b5('0xb')){if(_0x23a8dc[_0x46b5('0x2e')](_0x46b5('0x2f'))&&_0x23a8dc[_0x46b5('0x2f')]&&_0x23a8dc[_0x46b5('0x2f')]!=='--'){_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x31')+_0x23a8dc[_0x46b5('0x2f')],'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc['intervals'][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x32')+(_0x23a8dc[_0x46b5('0x33')]?_0x46b5('0x34')+_0x23a8dc[_0x46b5('0x33')]+')':_0x46b5('0x35')),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc['intervals']['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}else{if(_0x23a8dc[_0x46b5('0x2e')](_0x46b5('0x36'))){if([_0x46b5('0x37'),'playback'][_0x46b5('0x38')](_0x23a8dc['app'][_0x46b5('0x30')]())&&_0x23a8dc[_0x46b5('0x39')]!==_0x46b5('0x3a')){if(_0x23a8dc['answer']){_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x3b'),'context':_0x3300da['context'],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':'Set','appdata':_0x46b5('0x3c'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}else{_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x3d'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}}}}for(var _0x547cf3=0x0;_0x547cf3<_0x23a8dc[_0x46b5('0x2c')]['length'];_0x547cf3++){var _0x11e353=_0x1e5d3b+_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')];var _0x2cc5ef=_0x547cf3===_0x23a8dc['intervals'][_0x46b5('0x2a')]-0x1?_0x1e5d3b+_0x3b9661[_0x46b5('0x2a')]+_0x33a46c['length']+0x2:_0x1e5d3b+_0x547cf3+0x1;_0x3b9661[_0x46b5('0x3e')](_0x547cf3,0x0,{'type':_0x3300da[_0x46b5('0x2')],'app':_0x46b5('0x3f'),'appdata':_0x23a8dc[_0x46b5('0x2c')][_0x547cf3]+'?'+_0x3300da['context']+_0x46b5('0x40')+_0x11e353+':'+_0x3300da[_0x46b5('0x5')]+',${EXTEN},'+_0x2cc5ef,'exten':_0x3300da['exten'],'context':_0x3300da[_0x46b5('0x5')],'priority':_0x1e5d3b+_0x547cf3,'VoiceExtensionId':_0x3300da['id']});}if(_0x23a8dc[_0x46b5('0x39')]===_0x46b5('0x41')){_0x23a8dc[_0x46b5('0x42')]=_0x28b04d(_0x3300da,_0x23a8dc[_0x46b5('0x42')]);}if(_0x23a8dc[_0x46b5('0x39')]===_0x46b5('0x43')){_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')]['toLowerCase'](),'app':'Set','appdata':_0x46b5('0x44'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da['exten'],'priority':_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}_0x23a8dc[_0x46b5('0x45')]=_0x3b9661['length']?_[_0x46b5('0x46')](_0x3b9661)[_0x46b5('0x45')]+0x1:_0x1e5d3b;_0x281db7=_['concat'](_0x281db7,_0x3b9661,[_0x23a8dc],_0x33a46c);_0x1e5d3b=_[_0x46b5('0x46')](_0x281db7)[_0x46b5('0x45')]+0x1;}return _0x49dc11(_0x281db7);})[_0x46b5('0x47')](function(_0x484459){_0x25f15e(_0x484459);});});}return _0x20ac33[_0x46b5('0x48')](_0x46b5('0x49'),attributes,{'tableName':_0x46b5('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x307b6a){var _0x2f4ea5=this[_0x46b5('0x4b')]({'plain':!![]});var _0xda6cb5=_0x2f4ea5[_0x46b5('0x2')]===_0x46b5('0xb')?_0x2fbf2d(_0x2f4ea5):_0x1852f5(_0x2f4ea5);return _0x4bace3(_0x2f4ea5,_0x307b6a,_['last'](_0xda6cb5)[_0x46b5('0x45')]+0x1)[_0x46b5('0x4c')](function(_0x2571a2){var _0x510744=_[_0x46b5('0x4d')](_0xda6cb5,_0x2571a2);_0x510744[_0x46b5('0x7')]({'type':_0x2f4ea5[_0x46b5('0x2')],'app':'Hangup','exten':_0x2f4ea5[_0x46b5('0x8')],'context':_0x2f4ea5[_0x46b5('0x5')],'priority':_['last'](_0x510744)[_0x46b5('0x45')]+0x1,'VoiceExtensionId':_0x2f4ea5['id']});return _0x510744;});}}});}; \ No newline at end of file +var _0xef29=['prefix','${EXTEN}','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','interval','then','IntervalId','map','filter','toLowerCase','tag','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','push','inbound','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(destination)=','${EXTEN:','ExecIf','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','split','length','param','phone'];(function(_0x2e95a8,_0x209296){var _0x516c51=function(_0x3687c9){while(--_0x3687c9){_0x2e95a8['push'](_0x2e95a8['shift']());}};_0x516c51(++_0x209296);}(_0xef29,0x150));var _0x9ef2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xef29[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9ef2('0x0'));var attributes=require(_0x9ef2('0x1'));module[_0x9ef2('0x2')]=function(_0x21f600){var _0x2b5b97=_0x21f600[_0x9ef2('0x3')];function _0x24b8bb(_0x2249d5){var _0x360ed9=0x2;var _0x51cd72=[{'type':_0x2249d5[_0x9ef2('0x4')],'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0x6')+_0x2249d5[_0x9ef2('0x4')],'context':_0x2249d5['context'],'exten':_0x2249d5[_0x9ef2('0x7')],'priority':_0x360ed9++,'VoiceExtensionId':_0x2249d5['id']}];if(_0x2249d5[_0x9ef2('0x4')]==='inbound'){_0x51cd72[_0x9ef2('0x8')]({'type':_0x9ef2('0x9'),'app':_0x9ef2('0x5'),'appdata':'CDR(routeid)='+_0x2249d5['id'],'context':_0x2249d5[_0x9ef2('0xa')],'exten':_0x2249d5[_0x9ef2('0x7')],'priority':_0x360ed9++,'VoiceExtensionId':_0x2249d5['id']});}_0x51cd72[_0x9ef2('0x8')]({'type':_0x2249d5[_0x9ef2('0x4')],'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0xb'),'context':_0x2249d5[_0x9ef2('0xa')],'exten':_0x2249d5['exten'],'priority':_0x360ed9++,'VoiceExtensionId':_0x2249d5['id']},{'type':_0x2249d5['type'],'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0xc'),'context':_0x2249d5[_0x9ef2('0xa')],'exten':_0x2249d5[_0x9ef2('0x7')],'priority':_0x360ed9++,'VoiceExtensionId':_0x2249d5['id']},{'type':_0x2249d5['type'],'app':_0x9ef2('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2249d5[_0x9ef2('0xa')],'exten':_0x2249d5['exten'],'priority':_0x360ed9++,'VoiceExtensionId':_0x2249d5['id']});return _0x51cd72;}function _0x345e6b(_0x3f0808){var _0x3d1a37=0x2;var _0x16a4cb=[{'type':_0x9ef2('0xd'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':_0x9ef2('0xd'),'app':'Set','appdata':_0x9ef2('0xe')+(_0x3f0808['cutdigits']?_0x9ef2('0xf')+_0x3f0808['cutdigits']+'}':'${EXTEN}'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':'outbound','app':_0x9ef2('0x5'),'appdata':'CDR(routeid)='+_0x3f0808['id'],'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':_0x9ef2('0xd'),'app':_0x9ef2('0x10'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d1a37+0x2)+'):Goto('+(_0x3d1a37+0x1)+')','context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':_0x9ef2('0xd'),'app':'Set','appdata':_0x3f0808[_0x9ef2('0x11')]?_0x9ef2('0x12')+_0x3f0808[_0x9ef2('0x11')]+'}':_0x9ef2('0x13'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':'outbound','app':_0x9ef2('0x5'),'appdata':_0x9ef2('0xb'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':'outbound','app':_0x9ef2('0x5'),'appdata':_0x9ef2('0xc'),'context':_0x3f0808['context'],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':_0x9ef2('0xd'),'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0x14'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808['exten'],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':'outbound','app':'Set','appdata':_0x9ef2('0x15')+_0x3f0808['id'],'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']}];if(_0x3f0808[_0x9ef2('0x16')](_0x9ef2('0x17'))&&_0x3f0808[_0x9ef2('0x17')]!==_0x9ef2('0x18')){_0x16a4cb[_0x9ef2('0x8')]({'type':_0x9ef2('0xd'),'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0x19'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808[_0x9ef2('0x7')],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']},{'type':_0x9ef2('0xd'),'app':_0x9ef2('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3f0808[_0x9ef2('0x17')]||_0x9ef2('0x1a'),'context':_0x3f0808[_0x9ef2('0xa')],'exten':_0x3f0808['exten'],'priority':_0x3d1a37++,'VoiceExtensionId':_0x3f0808['id']});}return _0x16a4cb;}function _0x343256(_0x2d31c7,_0x3cb147){var _0x1cb85e=[{'name':_0x9ef2('0x1b'),'param':0x0},{'name':_0x9ef2('0x1c'),'param':0x1},{'name':_0x9ef2('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x231305={};var _0x869fc4=_0x3cb147[_0x9ef2('0x1e')](',');var _0x37d461=[];for(var _0x1b88fc=0x0;_0x1b88fc<_0x1cb85e[_0x9ef2('0x1f')];_0x1b88fc++){switch(_0x1cb85e[_0x1b88fc]['name']){case _0x9ef2('0x1b'):_0x231305[_0x9ef2('0x1b')]=_0x869fc4[_0x1cb85e[_0x1b88fc][_0x9ef2('0x20')]][_0x9ef2('0x1e')]('/')[0x1];_0x231305[_0x9ef2('0x21')]=_0x869fc4[_0x1cb85e[_0x1b88fc][_0x9ef2('0x20')]][_0x9ef2('0x1e')]('/')[0x2];_0x231305['prefix']=_0x231305[_0x9ef2('0x21')]?_0x231305['phone']['split']('$')[0x0]:undefined;_0x231305[_0x9ef2('0x21')]=_0x2d31c7['cutdigits']?(_0x231305[_0x9ef2('0x22')]||'')+_0x9ef2('0xf')+_0x2d31c7['cutdigits']+'}':(_0x231305[_0x9ef2('0x22')]||'')+_0x9ef2('0x23');_0x37d461[_0x1cb85e[_0x1b88fc]['param']]=[_0x9ef2('0x24'),_0x231305['trunk'],_0x231305[_0x9ef2('0x21')]]['join']('/');break;case'options':_0x231305['options']=_0x869fc4[_0x1cb85e[_0x1b88fc]['param']];if(_0x2d31c7['recordingFormat']!==_0x9ef2('0x18')){if(_0x231305[_0x9ef2('0x1d')][_0x9ef2('0x25')](_0x9ef2('0x26'))<0x0){_0x231305[_0x9ef2('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x231305[_0x9ef2('0x1d')]=_0x231305[_0x9ef2('0x1d')][_0x9ef2('0x27')](_0x9ef2('0x26'),'');}_0x37d461[_0x1cb85e[_0x1b88fc]['param']]=_0x231305[_0x9ef2('0x1d')];break;default:_0x37d461[_0x1cb85e[_0x1b88fc][_0x9ef2('0x20')]]=_0x869fc4[_0x1cb85e[_0x1b88fc][_0x9ef2('0x20')]];}}return _0x37d461[_0x9ef2('0x28')](',');}function _0x24b030(_0x5f37e0,_0x30e5c8,_0x414ccb){return new Promise(function(_0x32f9a0,_0x2ed961){var _0x2c5c01=[];if(_[_0x9ef2('0x29')](_0x30e5c8))return _0x32f9a0(_0x2c5c01);_0x2b5b97[_0x9ef2('0x2a')]['findAll']({'attributes':['id',_0x9ef2('0x2b'),'IntervalId'],'raw':!![]})[_0x9ef2('0x2c')](function(_0x55d03c){for(var _0x487136=0x0,_0x561446=0x0;_0x487136<_0x30e5c8[_0x9ef2('0x1f')];_0x487136++,_0x561446=0x0){var _0x80625b=_0x30e5c8[_0x487136];var _0x4b2190=[];var _0x5db0ae=[];delete _0x80625b['id'];if(_0x80625b[_0x9ef2('0x2b')]!=='*,*,*,*'){_0x80625b['intervals']=[_0x80625b[_0x9ef2('0x2b')]];}else{_0x80625b['intervals']=_0x80625b[_0x9ef2('0x2d')]?_[_0x9ef2('0x2e')](_[_0x9ef2('0x2f')](_0x55d03c,{'IntervalId':_0x80625b[_0x9ef2('0x2d')]}),_0x9ef2('0x2b')):[];}_0x80625b[_0x9ef2('0xa')]=_0x5f37e0['context'];_0x80625b[_0x9ef2('0x7')]=_0x5f37e0['exten'];if(_0x80625b[_0x9ef2('0x4')])_0x80625b['type']=_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')]();if(_0x5f37e0[_0x9ef2('0x4')]===_0x9ef2('0xd')){if(_0x80625b[_0x9ef2('0x16')](_0x9ef2('0x31'))&&_0x80625b[_0x9ef2('0x31')]&&_0x80625b[_0x9ef2('0x31')]!=='--'){_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')](),'app':'Set','appdata':'CDR(tag)='+_0x80625b[_0x9ef2('0x31')],'context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b[_0x9ef2('0x32')]['length']+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});}_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')](),'app':_0x9ef2('0x10'),'appdata':_0x9ef2('0x33')+(_0x80625b['callerID']?_0x9ef2('0x34')+_0x80625b['callerID']+')':_0x9ef2('0x35')),'context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b[_0x9ef2('0x32')][_0x9ef2('0x1f')]+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});}else{if(_0x80625b[_0x9ef2('0x16')](_0x9ef2('0x36'))){if(['queue','playback'][_0x9ef2('0x37')](_0x80625b[_0x9ef2('0x38')][_0x9ef2('0x30')]())&&_0x80625b[_0x9ef2('0x39')]!==_0x9ef2('0x3a')){if(_0x80625b[_0x9ef2('0x36')]){_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')](),'app':_0x9ef2('0x10'),'appdata':_0x9ef2('0x3b'),'context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b['intervals']['length']+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b['type'][_0x9ef2('0x30')](),'app':_0x9ef2('0x5'),'appdata':_0x9ef2('0x3c'),'context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b[_0x9ef2('0x32')][_0x9ef2('0x1f')]+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});}else{_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')]['toLowerCase'](),'app':_0x9ef2('0x10'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b[_0x9ef2('0x32')][_0x9ef2('0x1f')]+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')](),'app':'Set','appdata':_0x9ef2('0x3d'),'context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0['exten'],'priority':_0x80625b['intervals'][_0x9ef2('0x1f')]+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});}}}}for(var _0xfc33b6=0x0;_0xfc33b6<_0x80625b['intervals'][_0x9ef2('0x1f')];_0xfc33b6++){var _0x401347=_0x414ccb+_0x80625b[_0x9ef2('0x32')][_0x9ef2('0x1f')];var _0x5bcc54=_0xfc33b6===_0x80625b[_0x9ef2('0x32')][_0x9ef2('0x1f')]-0x1?_0x414ccb+_0x4b2190[_0x9ef2('0x1f')]+_0x5db0ae[_0x9ef2('0x1f')]+0x2:_0x414ccb+_0xfc33b6+0x1;_0x4b2190[_0x9ef2('0x3e')](_0xfc33b6,0x0,{'type':_0x5f37e0[_0x9ef2('0x4')],'app':'GotoIfTime','appdata':_0x80625b[_0x9ef2('0x32')][_0xfc33b6]+'?'+_0x5f37e0[_0x9ef2('0xa')]+',${EXTEN},'+_0x401347+':'+_0x5f37e0[_0x9ef2('0xa')]+_0x9ef2('0x3f')+_0x5bcc54,'exten':_0x5f37e0[_0x9ef2('0x7')],'context':_0x5f37e0[_0x9ef2('0xa')],'priority':_0x414ccb+_0xfc33b6,'VoiceExtensionId':_0x5f37e0['id']});}if(_0x80625b['appType']===_0x9ef2('0x40')){_0x80625b[_0x9ef2('0x41')]=_0x343256(_0x5f37e0,_0x80625b['appdata']);}if(_0x80625b[_0x9ef2('0x39')]==='agi'){_0x4b2190[_0x9ef2('0x8')]({'type':_0x80625b[_0x9ef2('0x4')][_0x9ef2('0x30')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x5f37e0[_0x9ef2('0xa')],'exten':_0x5f37e0[_0x9ef2('0x7')],'priority':_0x80625b[_0x9ef2('0x32')]['length']+_0x414ccb+_0x561446++,'VoiceExtensionId':_0x5f37e0['id']});}_0x80625b['priority']=_0x4b2190[_0x9ef2('0x1f')]?_[_0x9ef2('0x42')](_0x4b2190)[_0x9ef2('0x43')]+0x1:_0x414ccb;_0x2c5c01=_[_0x9ef2('0x44')](_0x2c5c01,_0x4b2190,[_0x80625b],_0x5db0ae);_0x414ccb=_[_0x9ef2('0x42')](_0x2c5c01)[_0x9ef2('0x43')]+0x1;}return _0x32f9a0(_0x2c5c01);})[_0x9ef2('0x45')](function(_0x15fa13){_0x2ed961(_0x15fa13);});});}return _0x21f600[_0x9ef2('0x46')]('VoiceExtension',attributes,{'tableName':_0x9ef2('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2fb2ed){var _0x72a643=this[_0x9ef2('0x48')]({'plain':!![]});var _0xc8791f=_0x72a643[_0x9ef2('0x4')]===_0x9ef2('0xd')?_0x345e6b(_0x72a643):_0x24b8bb(_0x72a643);return _0x24b030(_0x72a643,_0x2fb2ed,_[_0x9ef2('0x42')](_0xc8791f)[_0x9ef2('0x43')]+0x1)[_0x9ef2('0x2c')](function(_0x42792a){var _0xe8cc9e=_[_0x9ef2('0x44')](_0xc8791f,_0x42792a);_0xe8cc9e[_0x9ef2('0x8')]({'type':_0x72a643[_0x9ef2('0x4')],'app':_0x9ef2('0x49'),'exten':_0x72a643[_0x9ef2('0x7')],'context':_0x72a643[_0x9ef2('0xa')],'priority':_['last'](_0xe8cc9e)['priority']+0x1,'VoiceExtensionId':_0x72a643['id']});return _0xe8cc9e;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 156422d..8a7b440 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 _0xfd50=['VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xfd50,0x178));var _0x0fd5=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xfd50[_0x5834bc];return _0x3e183a;};'use strict';var _=require('lodash');var util=require(_0x0fd5('0x0'));var moment=require(_0x0fd5('0x1'));var BPromise=require(_0x0fd5('0x2'));var rs=require(_0x0fd5('0x3'));var fs=require('fs');var Redis=require(_0x0fd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd5('0x5'));var logger=require(_0x0fd5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fd5('0x7'));var client=jayson[_0x0fd5('0x8')][_0x0fd5('0x9')]({'port':0x232a});config[_0x0fd5('0xa')]=_['defaults'](config[_0x0fd5('0xa')],{'host':_0x0fd5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fd5('0xa')]));require(_0x0fd5('0xc'))[_0x0fd5('0xd')](socket);function respondWithRpcPromise(_0x4705b2,_0x39eda9,_0x1dfd3f){return new BPromise(function(_0x27bfa9,_0x4e4733){return client[_0x0fd5('0xe')](_0x4705b2,_0x1dfd3f)[_0x0fd5('0xf')](function(_0x47c900){logger[_0x0fd5('0x10')](_0x0fd5('0x11'),_0x39eda9,_0x0fd5('0x12'));logger[_0x0fd5('0x13')](_0x0fd5('0x14'),_0x39eda9,_0x0fd5('0x12'),JSON[_0x0fd5('0x15')](_0x47c900));if(_0x47c900['error']){if(_0x47c900['error'][_0x0fd5('0x16')]===0x1f4){logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);return _0x4e4733(_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);}logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);return _0x27bfa9(_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);}else{logger[_0x0fd5('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x39eda9,_0x0fd5('0x12'));_0x27bfa9(_0x47c900[_0x0fd5('0x19')][_0x0fd5('0x18')]);}})[_0x0fd5('0x1a')](function(_0x1d86f4){logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x1d86f4);_0x4e4733(_0x1d86f4);});});}exports[_0x0fd5('0x1b')]=function(_0x132df5){var _0x25ed9d=this;return new Promise(function(_0x118d34,_0x50af04){return db[_0x0fd5('0x1c')]['findAll']({'raw':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x1e')]||null:null,'attributes':_0x132df5[_0x0fd5('0x1d')]?_0x132df5['options'][_0x0fd5('0x1f')]||null:null,'limit':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x20')]||null:null,'include':_0x132df5['options']?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x21')]?_[_0x0fd5('0x22')](_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x21')],function(_0xc38f30){return{'model':db[_0xc38f30[_0x0fd5('0x23')]],'as':_0xc38f30['as'],'attributes':_0xc38f30[_0x0fd5('0x1f')],'include':_0xc38f30[_0x0fd5('0x21')]?_[_0x0fd5('0x22')](_0xc38f30[_0x0fd5('0x21')],function(_0x2b0991){return{'model':db[_0x2b0991[_0x0fd5('0x23')]],'as':_0x2b0991['as'],'attributes':_0x2b0991['attributes'],'include':_0x2b0991['include']?_['map'](_0x2b0991[_0x0fd5('0x21')],function(_0x4547dd){return{'model':db[_0x4547dd['model']],'as':_0x4547dd['as'],'attributes':_0x4547dd[_0x0fd5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0fd5('0xf')](function(_0x23c6b9){logger[_0x0fd5('0x10')]('GetVoiceExtension',_0x132df5);logger[_0x0fd5('0x13')](_0x0fd5('0x1b'),_0x132df5,JSON[_0x0fd5('0x15')](_0x23c6b9));_0x118d34(_0x23c6b9);})['catch'](function(_0x3e41d4){logger[_0x0fd5('0x17')](_0x0fd5('0x1b'),_0x3e41d4[_0x0fd5('0x18')],_0x132df5);_0x50af04(_0x25ed9d[_0x0fd5('0x17')](0x1f4,_0x3e41d4['message']));});});}; \ No newline at end of file +var _0x7dfd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});config[_0xd7df('0xe')]=_[_0xd7df('0xf')](config[_0xd7df('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7df('0x10'))(new Redis(config[_0xd7df('0xe')]));require(_0xd7df('0x11'))[_0xd7df('0x12')](socket);function respondWithRpcPromise(_0x5e59c3,_0x32c5b5,_0x532c14){return new BPromise(function(_0x183ace,_0x567e83){return client[_0xd7df('0x13')](_0x5e59c3,_0x532c14)[_0xd7df('0x14')](function(_0x28d358){logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,_0xd7df('0x17'));logger[_0xd7df('0x18')](_0xd7df('0x19'),_0x32c5b5,_0xd7df('0x17'),JSON[_0xd7df('0x1a')](_0x28d358));if(_0x28d358[_0xd7df('0x1b')]){if(_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1c')]===0x1f4){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x567e83(_0x28d358['error'][_0xd7df('0x1d')]);}logger[_0xd7df('0x1b')]('VoiceExtension,\x20%s,\x20%s',_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x183ace(_0x28d358['error'][_0xd7df('0x1d')]);}else{logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,'request\x20sent');_0x183ace(_0x28d358[_0xd7df('0x1e')][_0xd7df('0x1d')]);}})[_0xd7df('0x1f')](function(_0x5ba653){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x5ba653);_0x567e83(_0x5ba653);});});}exports[_0xd7df('0x20')]=function(_0x5acb0a){var _0x4188af=this;return new Promise(function(_0x5aecbb,_0x225e33){return db['VoiceExtension'][_0xd7df('0x21')]({'raw':_0x5acb0a[_0xd7df('0x22')]?_0x5acb0a[_0xd7df('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x5acb0a[_0xd7df('0x22')]?_0x5acb0a['options'][_0xd7df('0x23')]||null:null,'attributes':_0x5acb0a[_0xd7df('0x22')]?_0x5acb0a[_0xd7df('0x22')][_0xd7df('0x24')]||null:null,'limit':_0x5acb0a[_0xd7df('0x22')]?_0x5acb0a[_0xd7df('0x22')][_0xd7df('0x25')]||null:null,'include':_0x5acb0a['options']?_0x5acb0a['options'][_0xd7df('0x26')]?_[_0xd7df('0x27')](_0x5acb0a[_0xd7df('0x22')][_0xd7df('0x26')],function(_0x13f190){return{'model':db[_0x13f190[_0xd7df('0x28')]],'as':_0x13f190['as'],'attributes':_0x13f190[_0xd7df('0x24')],'include':_0x13f190[_0xd7df('0x26')]?_[_0xd7df('0x27')](_0x13f190['include'],function(_0xe53f53){return{'model':db[_0xe53f53[_0xd7df('0x28')]],'as':_0xe53f53['as'],'attributes':_0xe53f53[_0xd7df('0x24')],'include':_0xe53f53[_0xd7df('0x26')]?_[_0xd7df('0x27')](_0xe53f53[_0xd7df('0x26')],function(_0x3f78fa){return{'model':db[_0x3f78fa[_0xd7df('0x28')]],'as':_0x3f78fa['as'],'attributes':_0x3f78fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52b56a){logger['info']('GetVoiceExtension',_0x5acb0a);logger[_0xd7df('0x18')]('GetVoiceExtension',_0x5acb0a,JSON[_0xd7df('0x1a')](_0x52b56a));_0x5aecbb(_0x52b56a);})[_0xd7df('0x1f')](function(_0x503a90){logger[_0xd7df('0x1b')](_0xd7df('0x20'),_0x503a90['message'],_0x5acb0a);_0x225e33(_0x4188af[_0xd7df('0x1b')](0x1f4,_0x503a90[_0xd7df('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4873748..8d3478a 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x2b0cf2,_0x5aa063){var _0x3d5c8b=function(_0x4fff51){while(--_0x4fff51){_0x2b0cf2['push'](_0x2b0cf2['shift']());}};_0x3d5c8b(++_0x5aa063);}(_0x326f,0xd1));var _0xf326=function(_0x4d5455,_0x56ecbb){_0x4d5455=_0x4d5455-0x0;var _0x2d9ecd=_0x326f[_0x4d5455];return _0x2d9ecd;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x814b,0x1a2));var _0xb814=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x814b[_0x134192];return _0x3cd080;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ac84fae..6299e3d 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 _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x2a07,0x74));var _0x72a0=function(_0x50d2db,_0x47481f){_0x50d2db=_0x50d2db-0x0;var _0x1c7e27=_0x2a07[_0x50d2db];return _0x1c7e27;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','show','getMessages','post','isAuthenticated','put','delete','exports'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x44a71e,_0x335a2f){_0x44a71e=_0x44a71e-0x0;var _0x3f1fa4=_0xd8fb[_0x44a71e];return _0x3f1fa4;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0xc')]('/',auth[_0xbd8f('0xd')](),controller['create']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbd8f('0xf')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['destroy']);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 694984f..60e0367 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 _0x5740=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x5740,0x95));var _0x0574=function(_0x1b24cb,_0x26e0fe){_0x1b24cb=_0x1b24cb-0x0;var _0x4160b2=_0x5740[_0x1b24cb];return _0x4160b2;};'use strict';var Sequelize=require(_0x0574('0x0'));module[_0x0574('0x1')]={'customer_id':{'type':Sequelize[_0x0574('0x2')]},'context':{'type':Sequelize[_0x0574('0x2')],'defaultValue':_0x0574('0x3'),'unique':_0x0574('0x4')},'mailbox':{'type':Sequelize[_0x0574('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0574('0x2')]},'fullname':{'type':Sequelize[_0x0574('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x43c29e){this[_0x0574('0x5')](_0x0574('0x6'),typeof _0x43c29e==='string'&&_0x43c29e[_0x0574('0x7')]()?_0x43c29e[_0x0574('0x7')]():null);}},'pager':{'type':Sequelize[_0x0574('0x2')]},'tz':{'type':Sequelize[_0x0574('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':_0x0574('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0574('0x2')]},'callback':{'type':Sequelize[_0x0574('0x2')]},'review':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0574('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':_0x0574('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0574('0xb')},'emailsubject':{'type':Sequelize[_0x0574('0x2')]},'emailbody':{'type':Sequelize[_0x0574('0x2')]},'maxsecs':{'type':Sequelize[_0x0574('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0574('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0574('0xd')],'get':function(){return this[_0x0574('0xe')](_0x0574('0xf'))+_0x0574('0x10')+this[_0x0574('0xe')](_0x0574('0x11'));}}}; \ No newline at end of file +var _0x8c46=['trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string'];(function(_0x2f606e,_0x575bf6){var _0x539d6e=function(_0x4b5b9d){while(--_0x4b5b9d){_0x2f606e['push'](_0x2f606e['shift']());}};_0x539d6e(++_0x575bf6);}(_0x8c46,0x1aa));var _0x68c4=function(_0x208c67,_0x26b3db){_0x208c67=_0x208c67-0x0;var _0x1aaeb5=_0x8c46[_0x208c67];return _0x1aaeb5;};'use strict';var Sequelize=require(_0x68c4('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x68c4('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x68c4('0x2'),'unique':_0x68c4('0x3')},'mailbox':{'type':Sequelize[_0x68c4('0x1')],'defaultValue':'','allowNull':![],'unique':_0x68c4('0x3')},'password':{'type':Sequelize[_0x68c4('0x1')]},'fullname':{'type':Sequelize[_0x68c4('0x1')]},'email':{'type':Sequelize[_0x68c4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x11995d){this[_0x68c4('0x4')]('email',typeof _0x11995d===_0x68c4('0x5')&&_0x11995d[_0x68c4('0x6')]()?_0x11995d[_0x68c4('0x6')]():null);}},'pager':{'type':Sequelize[_0x68c4('0x1')]},'tz':{'type':Sequelize[_0x68c4('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x68c4('0x7')](_0x68c4('0x8'),'no'),'defaultValue':_0x68c4('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x68c4('0x7')](_0x68c4('0x8'),'no'),'defaultValue':_0x68c4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x68c4('0x1')]},'callback':{'type':Sequelize[_0x68c4('0x1')]},'review':{'type':Sequelize['ENUM'](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x68c4('0x7')](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x68c4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x68c4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x68c4('0x7')](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x68c4('0x7')]('yes','no'),'defaultValue':_0x68c4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x68c4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x68c4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x68c4('0x7')](_0x68c4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x68c4('0xa')},'emailsubject':{'type':Sequelize[_0x68c4('0x1')]},'emailbody':{'type':Sequelize[_0x68c4('0x1')]},'maxsecs':{'type':Sequelize[_0x68c4('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x68c4('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x68c4('0xc')],'get':function(){return this['getDataValue'](_0x68c4('0xd'))+_0x68c4('0xe')+this[_0x68c4('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index bc1fa8c..7c40aab 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 _0xb58b=['destroy','then','get','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4937c6,_0x5f40d9){_0x4937c6=_0x4937c6-0x0;var _0x51d83b=_0xb58b[_0x4937c6];return _0x51d83b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){var _0x2d111c=_0x287822[_0xbb58('0x27')]({'plain':!![]});var _0x2d556a=_0xbb58('0x28');return db['UserProfileResource'][_0xbb58('0x25')]({'where':{'type':_0x2d556a,'resourceId':_0x2d111c['id']}})[_0xbb58('0x26')](function(){return _0x287822;});})[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x521d0c,_0x3608dc){return function(_0x2ce7c3){if(!_0x2ce7c3){_0x521d0c[_0xbb58('0x18')](0x194);}return _0x2ce7c3;};}function handleError(_0x2d5b39,_0xf6687e){_0xf6687e=_0xf6687e||0x1f4;return function(_0x28b3a3){logger[_0xbb58('0x29')](_0x28b3a3[_0xbb58('0x2a')]);if(_0x28b3a3[_0xbb58('0x2b')]){delete _0x28b3a3['name'];}_0x2d5b39[_0xbb58('0x19')](_0xf6687e)[_0xbb58('0x2c')](_0x28b3a3);};}exports[_0xbb58('0x2d')]=function(_0x3c9cee,_0x3304b9){var _0x9d379f={},_0x1ba526={},_0x643e0e={'count':0x0,'rows':[]};var _0x3f8db3=_['map'](db[_0xbb58('0x2e')][_0xbb58('0x2f')],function(_0x3edc34){return{'name':_0x3edc34[_0xbb58('0x30')],'type':_0x3edc34[_0xbb58('0x31')][_0xbb58('0x32')]};});_0x1ba526[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x3f8db3,_0xbb58('0x2b'));_0x1ba526[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3c9cee[_0xbb58('0x35')]);_0x1ba526[_0xbb58('0x37')]=_['intersection'](_0x1ba526['model'],_0x1ba526['query']);_0x9d379f[_0xbb58('0x38')]=_[_0xbb58('0x39')](_0x1ba526[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3a')]));_0x9d379f[_0xbb58('0x38')]=_0x9d379f[_0xbb58('0x38')]['length']?_0x9d379f[_0xbb58('0x38')]:_0x1ba526[_0xbb58('0x33')];if(!_0x3c9cee['query'][_0xbb58('0x3b')]('nolimit')){_0x9d379f[_0xbb58('0x1e')]=qs['limit'](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1e')]);_0x9d379f['offset']=qs[_0xbb58('0x1c')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1c')]);}_0x9d379f[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3d')]);_0x9d379f[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3c9cee[_0xbb58('0x35')],_0x1ba526[_0xbb58('0x37')]),_0x3f8db3);if(_0x3c9cee['query']['filter']){_0x9d379f[_0xbb58('0x3e')]=_['merge'](_0x9d379f[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x3f8db3,function(_0x2ab2d8){if(_0x2ab2d8['type']!=='VIRTUAL'){var _0xc29171={};_0xc29171[_0x2ab2d8[_0xbb58('0x2b')]]={'$like':'%'+_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x40')]+'%'};return _0xc29171;}})});}_0x9d379f=_[_0xbb58('0x41')]({},_0x9d379f,_0x3c9cee[_0xbb58('0x42')]);var _0x5797e7={'where':_0x9d379f[_0xbb58('0x3e')]};return db[_0xbb58('0x2e')][_0xbb58('0x1d')](_0x5797e7)[_0xbb58('0x26')](function(_0x1185b3){_0x643e0e[_0xbb58('0x1d')]=_0x1185b3;if(_0x3c9cee['query'][_0xbb58('0x43')]){_0x9d379f['include']=[{'all':!![]}];}return db[_0xbb58('0x2e')][_0xbb58('0x44')](_0x9d379f);})[_0xbb58('0x26')](function(_0x45817f){_0x643e0e['rows']=_0x45817f;return _0x643e0e;})[_0xbb58('0x26')](respondWithFilteredResult(_0x3304b9,_0x9d379f))[_0xbb58('0x45')](handleError(_0x3304b9,null));};exports[_0xbb58('0x46')]=function(_0x3a732c,_0x5b95f7){var _0x2ecc1b={'raw':!![],'where':{'id':_0x3a732c[_0xbb58('0x47')]['id']}},_0x5250e0={};_0x5250e0[_0xbb58('0x33')]=_[_0xbb58('0x36')](db[_0xbb58('0x2e')][_0xbb58('0x2f')]);_0x5250e0[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3a732c[_0xbb58('0x35')]);_0x5250e0[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x5250e0[_0xbb58('0x33')],_0x5250e0[_0xbb58('0x35')]);_0x2ecc1b[_0xbb58('0x38')]=_['intersection'](_0x5250e0[_0xbb58('0x33')],qs['fields'](_0x3a732c['query'][_0xbb58('0x3a')]));_0x2ecc1b[_0xbb58('0x38')]=_0x2ecc1b[_0xbb58('0x38')][_0xbb58('0x48')]?_0x2ecc1b[_0xbb58('0x38')]:_0x5250e0[_0xbb58('0x33')];if(_0x3a732c[_0xbb58('0x35')][_0xbb58('0x43')]){_0x2ecc1b[_0xbb58('0x49')]=[{'all':!![]}];}_0x2ecc1b=_[_0xbb58('0x41')]({},_0x2ecc1b,_0x3a732c[_0xbb58('0x42')]);return db['VoiceMail'][_0xbb58('0x4a')](_0x2ecc1b)[_0xbb58('0x26')](handleEntityNotFound(_0x5b95f7,null))['then'](respondWithResult(_0x5b95f7,null))[_0xbb58('0x45')](handleError(_0x5b95f7,null));};exports[_0xbb58('0x4b')]=function(_0xf94897,_0xdb0ff7){return db['VoiceMail'][_0xbb58('0x4b')](_0xf94897['body'],{})[_0xbb58('0x26')](function(_0x336598){var _0x471917=_0xf94897['user'][_0xbb58('0x27')]({'plain':!![]});if(!_0x471917)throw new Error(_0xbb58('0x4c'));if(_0x471917['role']===_0xbb58('0x4d')){var _0x4ca201=_0x336598[_0xbb58('0x27')]({'plain':!![]});var _0x2d81e0=_0xbb58('0x28');return db[_0xbb58('0x4e')][_0xbb58('0x4a')]({'where':{'name':_0x2d81e0,'userProfileId':_0x471917[_0xbb58('0x4f')]},'raw':!![]})[_0xbb58('0x26')](function(_0x4cb975){if(_0x4cb975&&_0x4cb975[_0xbb58('0x50')]===0x0){return db[_0xbb58('0x51')]['create']({'name':_0x4ca201[_0xbb58('0x2b')],'resourceId':_0x4ca201['id'],'type':_0x4cb975[_0xbb58('0x2b')],'sectionId':_0x4cb975['id']},{})['then'](function(){return _0x336598;});}else{return _0x336598;}})[_0xbb58('0x45')](function(_0x44636b){logger[_0xbb58('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44636b);throw _0x44636b;});}return _0x336598;})[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,0xc9))[_0xbb58('0x45')](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x24')]=function(_0x592879,_0x537ed5){if(_0x592879['body']['id']){delete _0x592879[_0xbb58('0x52')]['id'];}return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x592879['params']['id']}})['then'](handleEntityNotFound(_0x537ed5,null))[_0xbb58('0x26')](saveUpdates(_0x592879[_0xbb58('0x52')],null))[_0xbb58('0x26')](respondWithResult(_0x537ed5,null))[_0xbb58('0x45')](handleError(_0x537ed5,null));};exports[_0xbb58('0x25')]=function(_0x5290be,_0x362b91){return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x5290be['params']['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x362b91,null))[_0xbb58('0x26')](removeEntity(_0x362b91,null))[_0xbb58('0x45')](handleError(_0x362b91,null));};exports[_0xbb58('0x53')]=function(_0x3f5add,_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x2e')][_0xbb58('0x54')]({'where':{'id':_0x3f5add[_0xbb58('0x47')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x5e7ae0,null))[_0xbb58('0x26')](function(_0x85278c){var _0x58ced2;var _0x55d5be={},_0x344b0d={};_0x344b0d['model']=_[_0xbb58('0x36')](db[_0xbb58('0x55')][_0xbb58('0x2f')]);_0x344b0d[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3f5add[_0xbb58('0x35')]);_0x344b0d[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x344b0d[_0xbb58('0x33')],_0x344b0d[_0xbb58('0x35')]);_0x55d5be[_0xbb58('0x38')]=_['intersection'](_0x344b0d[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3f5add[_0xbb58('0x35')]['fields']));_0x55d5be[_0xbb58('0x38')]=_0x55d5be['attributes'][_0xbb58('0x48')]?_0x55d5be[_0xbb58('0x38')]:_0x344b0d['model'];if(!_0x3f5add[_0xbb58('0x35')][_0xbb58('0x3b')](_0xbb58('0x56'))){_0x55d5be[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x3f5add['query']['limit']);_0x55d5be[_0xbb58('0x1c')]=qs[_0xbb58('0x1c')](_0x3f5add[_0xbb58('0x35')]['offset']);}_0x55d5be[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3f5add['query'][_0xbb58('0x3d')]);_0x55d5be[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3f5add[_0xbb58('0x35')],_0x344b0d[_0xbb58('0x37')]));if(_0x3f5add[_0xbb58('0x35')][_0xbb58('0x40')]){_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x55d5be[_0xbb58('0x38')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x3f5add['query'][_0xbb58('0x40')]+'%'};return _0x5e17fc;})});}_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'mailboxuser':_0x85278c[_0xbb58('0x57')]});_0x55d5be=_[_0xbb58('0x41')]({},_0x55d5be,_0x3f5add[_0xbb58('0x42')]);return db[_0xbb58('0x55')][_0xbb58('0x58')](_0x55d5be)[_0xbb58('0x26')](respondWithFilteredResult(_0x5e7ae0,_0x55d5be));})[_0xbb58('0x45')](handleError(_0x5e7ae0,null));}; \ No newline at end of file +var _0xd914=['limit','order','sort','where','filters','pick','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','params','merge','find','create','body','get','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','filter','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','Voicemails','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5d9317,_0xe517a2){var _0x4901b8=function(_0x2cb456){while(--_0x2cb456){_0x5d9317['push'](_0x5d9317['shift']());}};_0x4901b8(++_0xe517a2);}(_0xd914,0x17f));var _0x4d91=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0xd914[_0x57643b];return _0x53a35b;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){var _0x55356b=_0x12b722['get']({'plain':!![]});var _0x1ee6b3=_0x4d91('0x28');return db[_0x4d91('0x29')][_0x4d91('0x27')]({'where':{'type':_0x1ee6b3,'resourceId':_0x55356b['id']}})[_0x4d91('0x26')](function(){return _0x12b722;});})[_0x4d91('0x26')](function(){_0x9cb864[_0x4d91('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc353,_0xda9802){return function(_0x12ac74){if(!_0x12ac74){_0x3dc353['sendStatus'](0x194);}return _0x12ac74;};}function handleError(_0x480a56,_0x299f27){_0x299f27=_0x299f27||0x1f4;return function(_0x470079){logger['error'](_0x470079['stack']);if(_0x470079[_0x4d91('0x2a')]){delete _0x470079[_0x4d91('0x2a')];}_0x480a56[_0x4d91('0x1b')](_0x299f27)[_0x4d91('0x2b')](_0x470079);};}exports['index']=function(_0x2587a1,_0x31bbf8){var _0x468e95={},_0xee7535={},_0xa63422={'count':0x0,'rows':[]};var _0x3466f3=_[_0x4d91('0x2c')](db['VoiceMail'][_0x4d91('0x2d')],function(_0x4f44ff){return{'name':_0x4f44ff['fieldName'],'type':_0x4f44ff[_0x4d91('0x2e')][_0x4d91('0x2f')]};});_0xee7535['model']=_[_0x4d91('0x2c')](_0x3466f3,_0x4d91('0x2a'));_0xee7535[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x2587a1[_0x4d91('0x30')]);_0xee7535['filters']=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],_0xee7535[_0x4d91('0x30')]);_0x468e95[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],qs['fields'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x35')]));_0x468e95['attributes']=_0x468e95[_0x4d91('0x34')][_0x4d91('0x36')]?_0x468e95[_0x4d91('0x34')]:_0xee7535['model'];if(!_0x2587a1[_0x4d91('0x30')][_0x4d91('0x37')](_0x4d91('0x38'))){_0x468e95[_0x4d91('0x39')]=qs['limit'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x39')]);_0x468e95[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x2587a1['query']['offset']);}_0x468e95[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x2587a1['query'][_0x4d91('0x3b')]);_0x468e95[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x2587a1['query'],_0xee7535[_0x4d91('0x3d')]),_0x3466f3);if(_0x2587a1[_0x4d91('0x30')]['filter']){_0x468e95[_0x4d91('0x3c')]=_['merge'](_0x468e95[_0x4d91('0x3c')],{'$or':_['map'](_0x3466f3,function(_0x2dc892){if(_0x2dc892['type']!==_0x4d91('0x3f')){var _0x2782d2={};_0x2782d2[_0x2dc892[_0x4d91('0x2a')]]={'$like':'%'+_0x2587a1[_0x4d91('0x30')]['filter']+'%'};return _0x2782d2;}})});}_0x468e95=_['merge']({},_0x468e95,_0x2587a1[_0x4d91('0x40')]);var _0x55c8d0={'where':_0x468e95[_0x4d91('0x3c')]};return db[_0x4d91('0x41')]['count'](_0x55c8d0)[_0x4d91('0x26')](function(_0x2ae356){_0xa63422[_0x4d91('0x20')]=_0x2ae356;if(_0x2587a1[_0x4d91('0x30')][_0x4d91('0x42')]){_0x468e95[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x41')]['findAll'](_0x468e95);})[_0x4d91('0x26')](function(_0x4c70af){_0xa63422[_0x4d91('0x44')]=_0x4c70af;return _0xa63422;})[_0x4d91('0x26')](respondWithFilteredResult(_0x31bbf8,_0x468e95))[_0x4d91('0x45')](handleError(_0x31bbf8,null));};exports[_0x4d91('0x46')]=function(_0x20ec78,_0x1fc884){var _0x4b8e12={'raw':!![],'where':{'id':_0x20ec78[_0x4d91('0x47')]['id']}},_0x4ffc08={};_0x4ffc08[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x4ffc08[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x20ec78[_0x4d91('0x30')]);_0x4ffc08[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x4ffc08[_0x4d91('0x33')],_0x4ffc08[_0x4d91('0x30')]);_0x4b8e12['attributes']=_['intersection'](_0x4ffc08[_0x4d91('0x33')],qs['fields'](_0x20ec78[_0x4d91('0x30')][_0x4d91('0x35')]));_0x4b8e12[_0x4d91('0x34')]=_0x4b8e12[_0x4d91('0x34')]['length']?_0x4b8e12[_0x4d91('0x34')]:_0x4ffc08['model'];if(_0x20ec78['query'][_0x4d91('0x42')]){_0x4b8e12[_0x4d91('0x43')]=[{'all':!![]}];}_0x4b8e12=_[_0x4d91('0x48')]({},_0x4b8e12,_0x20ec78[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x4b8e12)['then'](handleEntityNotFound(_0x1fc884,null))[_0x4d91('0x26')](respondWithResult(_0x1fc884,null))[_0x4d91('0x45')](handleError(_0x1fc884,null));};exports[_0x4d91('0x4a')]=function(_0x449dd8,_0x106e5b){return db[_0x4d91('0x41')][_0x4d91('0x4a')](_0x449dd8[_0x4d91('0x4b')],{})[_0x4d91('0x26')](function(_0x145dfd){var _0x16f776=_0x449dd8['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x16f776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f776[_0x4d91('0x4d')]===_0x4d91('0x4e')){var _0x195e65=_0x145dfd[_0x4d91('0x4c')]({'plain':!![]});var _0x436a3d=_0x4d91('0x28');return db[_0x4d91('0x4f')][_0x4d91('0x49')]({'where':{'name':_0x436a3d,'userProfileId':_0x16f776['userProfileId']},'raw':!![]})[_0x4d91('0x26')](function(_0x43e72c){if(_0x43e72c&&_0x43e72c[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0x195e65[_0x4d91('0x2a')],'resourceId':_0x195e65['id'],'type':_0x43e72c[_0x4d91('0x2a')],'sectionId':_0x43e72c['id']},{})['then'](function(){return _0x145dfd;});}else{return _0x145dfd;}})[_0x4d91('0x45')](function(_0x2159e4){logger[_0x4d91('0x51')](_0x4d91('0x52'),_0x2159e4);throw _0x2159e4;});}return _0x145dfd;})[_0x4d91('0x26')](respondWithResult(_0x106e5b,0xc9))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x25')]=function(_0x4138c5,_0x645923){if(_0x4138c5[_0x4d91('0x4b')]['id']){delete _0x4138c5[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))[_0x4d91('0x26')](saveUpdates(_0x4138c5[_0x4d91('0x4b')],null))['then'](respondWithResult(_0x645923,null))['catch'](handleError(_0x645923,null));};exports['destroy']=function(_0x45cf4e,_0x10c1dd){return db[_0x4d91('0x41')]['find']({'where':{'id':_0x45cf4e[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x10c1dd,null))[_0x4d91('0x26')](removeEntity(_0x10c1dd,null))['catch'](handleError(_0x10c1dd,null));};exports['getMessages']=function(_0x5bc877,_0x75aa6d,_0x26bfde){return db[_0x4d91('0x41')][_0x4d91('0x53')]({'where':{'id':_0x5bc877[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x75aa6d,null))[_0x4d91('0x26')](function(_0x20c0f2){var _0x4d9b87;var _0x563558={},_0x3f4f24={};_0x3f4f24['model']=_[_0x4d91('0x31')](db[_0x4d91('0x54')][_0x4d91('0x2d')]);_0x3f4f24['query']=_[_0x4d91('0x31')](_0x5bc877[_0x4d91('0x30')]);_0x3f4f24[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x3f4f24[_0x4d91('0x33')],_0x3f4f24[_0x4d91('0x30')]);_0x563558[_0x4d91('0x34')]=_['intersection'](_0x3f4f24['model'],qs['fields'](_0x5bc877['query'][_0x4d91('0x35')]));_0x563558[_0x4d91('0x34')]=_0x563558[_0x4d91('0x34')]['length']?_0x563558[_0x4d91('0x34')]:_0x3f4f24['model'];if(!_0x5bc877[_0x4d91('0x30')][_0x4d91('0x37')]('nolimit')){_0x563558['limit']=qs[_0x4d91('0x39')](_0x5bc877[_0x4d91('0x30')][_0x4d91('0x39')]);_0x563558[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x5bc877[_0x4d91('0x30')][_0x4d91('0x1e')]);}_0x563558[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x5bc877[_0x4d91('0x30')]['sort']);_0x563558['where']=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x5bc877[_0x4d91('0x30')],_0x3f4f24[_0x4d91('0x3d')]));if(_0x5bc877[_0x4d91('0x30')][_0x4d91('0x55')]){_0x563558[_0x4d91('0x3c')]=_[_0x4d91('0x48')](_0x563558[_0x4d91('0x3c')],{'$or':_['map'](_0x563558['attributes'],function(_0x515574){var _0x51156f={};_0x51156f[_0x515574]={'$like':'%'+_0x5bc877[_0x4d91('0x30')][_0x4d91('0x55')]+'%'};return _0x51156f;})});}_0x563558[_0x4d91('0x3c')]=_[_0x4d91('0x48')](_0x563558[_0x4d91('0x3c')],{'mailboxuser':_0x20c0f2[_0x4d91('0x56')]});_0x563558=_[_0x4d91('0x48')]({},_0x563558,_0x5bc877[_0x4d91('0x40')]);return db[_0x4d91('0x54')][_0x4d91('0x57')](_0x563558)[_0x4d91('0x26')](respondWithFilteredResult(_0x75aa6d,_0x563558));})[_0x4d91('0x45')](handleError(_0x75aa6d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 141ddd6..c42d136 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 _0xe2bb=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xe2bb,0xad));var _0xbe2b=function(_0x21afde,_0x4454ce){_0x21afde=_0x21afde-0x0;var _0x33cde=_0xe2bb[_0x21afde];return _0x33cde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe2b('0x0'))(_0xbe2b('0x1'));var moment=require(_0xbe2b('0x2'));var BPromise=require(_0xbe2b('0x3'));var rp=require(_0xbe2b('0x4'));var fs=require('fs');var path=require(_0xbe2b('0x5'));var rimraf=require('rimraf');var config=require(_0xbe2b('0x6'));var attributes=require(_0xbe2b('0x7'));module[_0xbe2b('0x8')]=function(_0xb3d2e5,_0x46b8bd){return _0xb3d2e5['define'](_0xbe2b('0x9'),attributes,{'tableName':_0xbe2b('0xa'),'paranoid':![],'indexes':[{'name':_0xbe2b('0xb'),'fields':[_0xbe2b('0xc'),_0xbe2b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1a3=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x44afca,_0x58d28b){var _0x380bc4=function(_0x2f17dc){while(--_0x2f17dc){_0x44afca['push'](_0x44afca['shift']());}};_0x380bc4(++_0x58d28b);}(_0xe1a3,0x1a6));var _0x3e1a=function(_0x13d17b,_0x308581){_0x13d17b=_0x13d17b-0x0;var _0x16d0a5=_0xe1a3[_0x13d17b];return _0x16d0a5;};'use strict';var _=require(_0x3e1a('0x0'));var util=require(_0x3e1a('0x1'));var logger=require(_0x3e1a('0x2'))(_0x3e1a('0x3'));var moment=require(_0x3e1a('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e1a('0x5'));var fs=require('fs');var path=require(_0x3e1a('0x6'));var rimraf=require(_0x3e1a('0x7'));var config=require(_0x3e1a('0x8'));var attributes=require(_0x3e1a('0x9'));module[_0x3e1a('0xa')]=function(_0x4fc327,_0x3b172f){return _0x4fc327[_0x3e1a('0xb')](_0x3e1a('0xc'),attributes,{'tableName':_0x3e1a('0xd'),'paranoid':![],'indexes':[{'name':_0x3e1a('0xe'),'fields':[_0x3e1a('0xf'),_0x3e1a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2ea06e6..a23189a 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 _0xa26b=['http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xd05659,_0x4d7e49){var _0x20c9f2=function(_0x330e5c){while(--_0x330e5c){_0xd05659['push'](_0xd05659['shift']());}};_0x20c9f2(++_0x4d7e49);}(_0xa26b,0xad));var _0xba26=function(_0x3b146a,_0x40f083){_0x3b146a=_0x3b146a-0x0;var _0x4d25dd=_0xa26b[_0x3b146a];return _0x4d25dd;};'use strict';var _=require(_0xba26('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba26('0x1'));var rs=require(_0xba26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba26('0x3'))['db'];var utils=require(_0xba26('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xba26('0x5'));var jayson=require(_0xba26('0x6'));var client=jayson['client'][_0xba26('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dcfa6,_0x34b607,_0x35a126){return new BPromise(function(_0x4d0333,_0x5ab72a){return client['request'](_0x4dcfa6,_0x35a126)[_0xba26('0x8')](function(_0x287ce6){logger['info'](_0xba26('0x9'),_0x34b607,_0xba26('0xa'));logger[_0xba26('0xb')](_0xba26('0xc'),_0x34b607,_0xba26('0xa'),JSON[_0xba26('0xd')](_0x287ce6));if(_0x287ce6[_0xba26('0xe')]){if(_0x287ce6['error'][_0xba26('0xf')]===0x1f4){logger['error'](_0xba26('0x9'),_0x34b607,_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);return _0x5ab72a(_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);}logger[_0xba26('0xe')](_0xba26('0x9'),_0x34b607,_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);return _0x4d0333(_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);}else{logger[_0xba26('0x11')](_0xba26('0x9'),_0x34b607,'request\x20sent');_0x4d0333(_0x287ce6[_0xba26('0x12')][_0xba26('0x10')]);}})[_0xba26('0x13')](function(_0x5f3fba){logger[_0xba26('0xe')](_0xba26('0x9'),_0x34b607,_0x5f3fba);_0x5ab72a(_0x5f3fba);});});} \ No newline at end of file +var _0x1189=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x19b05f,_0x455a23){var _0x367471=function(_0x1df257){while(--_0x1df257){_0x19b05f['push'](_0x19b05f['shift']());}};_0x367471(++_0x455a23);}(_0x1189,0x155));var _0x9118=function(_0x180aca,_0x33f7c0){_0x180aca=_0x180aca-0x0;var _0x2fb3e7=_0x1189[_0x180aca];return _0x2fb3e7;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var moment=require(_0x9118('0x2'));var BPromise=require(_0x9118('0x3'));var rs=require(_0x9118('0x4'));var fs=require('fs');var Redis=require(_0x9118('0x5'));var db=require(_0x9118('0x6'))['db'];var utils=require(_0x9118('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9118('0x8'));var jayson=require(_0x9118('0x9'));var client=jayson['client'][_0x9118('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x593b03,_0x9c736d,_0x5e8a93){return new BPromise(function(_0xcf58c3,_0x248b23){return client['request'](_0x593b03,_0x5e8a93)[_0x9118('0xb')](function(_0x79a368){logger[_0x9118('0xc')](_0x9118('0xd'),_0x9c736d,_0x9118('0xe'));logger[_0x9118('0xf')](_0x9118('0x10'),_0x9c736d,_0x9118('0xe'),JSON[_0x9118('0x11')](_0x79a368));if(_0x79a368[_0x9118('0x12')]){if(_0x79a368[_0x9118('0x12')][_0x9118('0x13')]===0x1f4){logger[_0x9118('0x12')](_0x9118('0xd'),_0x9c736d,_0x79a368['error'][_0x9118('0x14')]);return _0x248b23(_0x79a368[_0x9118('0x12')][_0x9118('0x14')]);}logger[_0x9118('0x12')]('VoiceMail,\x20%s,\x20%s',_0x9c736d,_0x79a368['error'][_0x9118('0x14')]);return _0xcf58c3(_0x79a368[_0x9118('0x12')][_0x9118('0x14')]);}else{logger[_0x9118('0xc')]('VoiceMail,\x20%s,\x20%s',_0x9c736d,_0x9118('0xe'));_0xcf58c3(_0x79a368[_0x9118('0x15')]['message']);}})[_0x9118('0x16')](function(_0x176184){logger['error'](_0x9118('0xd'),_0x9c736d,_0x176184);_0x248b23(_0x176184);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f5d1cd9..c7e77e0 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 _0x36de=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','delete','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x10aaa6,_0x2637bf){var _0x123eb3=function(_0x16fcac){while(--_0x16fcac){_0x10aaa6['push'](_0x10aaa6['shift']());}};_0x123eb3(++_0x2637bf);}(_0x36de,0xa5));var _0xe36d=function(_0x760f83,_0x318445){_0x760f83=_0x760f83-0x0;var _0x1f0120=_0x36de[_0x760f83];return _0x1f0120;};'use strict';var multer=require(_0xe36d('0x0'));var util=require(_0xe36d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe36d('0x2')]();var fs_extra=require(_0xe36d('0x3'));var auth=require(_0xe36d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe36d('0x5'));var controller=require(_0xe36d('0x6'));router[_0xe36d('0x7')]('/',auth[_0xe36d('0x8')](),controller[_0xe36d('0x9')]);router[_0xe36d('0x7')](_0xe36d('0xa'),auth[_0xe36d('0x8')](),controller[_0xe36d('0xb')]);router['get'](_0xe36d('0xc'),auth[_0xe36d('0x8')](),controller[_0xe36d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe36d('0xe')]);router['put']('/:id',auth[_0xe36d('0x8')](),controller[_0xe36d('0xf')]);router[_0xe36d('0x10')](_0xe36d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x821a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x821a,0xfa));var _0xa821=function(_0x14f4b7,_0xd86c92){_0x14f4b7=_0x14f4b7-0x0;var _0x3a3c23=_0x821a[_0x14f4b7];return _0x3a3c23;};'use strict';var multer=require(_0xa821('0x0'));var util=require(_0xa821('0x1'));var path=require('path');var timeout=require(_0xa821('0x2'));var express=require(_0xa821('0x3'));var router=express[_0xa821('0x4')]();var fs_extra=require(_0xa821('0x5'));var auth=require(_0xa821('0x6'));var interaction=require(_0xa821('0x7'));var config=require(_0xa821('0x8'));var controller=require('./voiceMailMessage.controller');router[_0xa821('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa821('0x9')]('/:id',auth[_0xa821('0xa')](),controller[_0xa821('0xb')]);router['get']('/:id/download',auth[_0xa821('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xa821('0xc')]);router[_0xa821('0xd')](_0xa821('0xe'),auth[_0xa821('0xa')](),controller[_0xa821('0xf')]);router[_0xa821('0x10')]('/:id',auth[_0xa821('0xa')](),controller[_0xa821('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 286d354..8f4e264 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 _0x68ca=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','literal'];(function(_0x499ae9,_0x59c5f9){var _0x7f5632=function(_0x3af95f){while(--_0x3af95f){_0x499ae9['push'](_0x499ae9['shift']());}};_0x7f5632(++_0x59c5f9);}(_0x68ca,0x1f0));var _0xa68c=function(_0x175707,_0x1e9edb){_0x175707=_0x175707-0x0;var _0x2bd9b9=_0x68ca[_0x175707];return _0x2bd9b9;};'use strict';var Sequelize=require('sequelize');module[_0xa68c('0x0')]={'name':{'type':Sequelize[_0xa68c('0x1')],'get':function(_0x3722c8){return this[_0xa68c('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa68c('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa68c('0x5')](_0xa68c('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa68c('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x4b7b=['getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x2781be,_0x44ce07){var _0x202974=function(_0x100de2){while(--_0x100de2){_0x2781be['push'](_0x2781be['shift']());}};_0x202974(++_0x44ce07);}(_0x4b7b,0xd6));var _0xb4b7=function(_0x10c635,_0x160cb4){_0x10c635=_0x10c635-0x0;var _0x31a4e7=_0x4b7b[_0x10c635];return _0x31a4e7;};'use strict';var Sequelize=require(_0xb4b7('0x0'));module[_0xb4b7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2319d7){return this[_0xb4b7('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb4b7('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xb4b7('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb4b7('0x4')],'defaultValue':''},'stamp':{'type':_0xb4b7('0x6'),'defaultValue':Sequelize[_0xb4b7('0x7')](_0xb4b7('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 36a70ef..cb11ae7 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 _0xbe41=['squel','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbe41,0x96));var _0x1be4=function(_0x1297d2,_0x2f38bf){_0x1297d2=_0x1297d2-0x0;var _0x4b3489=_0xbe41[_0x1297d2];return _0x4b3489;};'use strict';var emlformat=require(_0x1be4('0x0'));var rimraf=require(_0x1be4('0x1'));var zipdir=require(_0x1be4('0x2'));var jsonpatch=require(_0x1be4('0x3'));var rp=require(_0x1be4('0x4'));var moment=require(_0x1be4('0x5'));var BPromise=require(_0x1be4('0x6'));var Mustache=require(_0x1be4('0x7'));var util=require(_0x1be4('0x8'));var path=require(_0x1be4('0x9'));var sox=require(_0x1be4('0xa'));var csv=require(_0x1be4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1be4('0xc'));var _=require(_0x1be4('0xd'));var squel=require(_0x1be4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1be4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1be4('0xf'));var authService=require(_0x1be4('0x10'));var qs=require(_0x1be4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1be4('0x12'));var utils=require(_0x1be4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1be4('0x14'));var db=require(_0x1be4('0x15'))['db'];function respondWithStatusCode(_0x167dc2,_0x1992a8){_0x1992a8=_0x1992a8||0xcc;return function(_0x15f0f3){if(_0x15f0f3){return _0x167dc2[_0x1be4('0x16')](_0x1992a8);}return _0x167dc2[_0x1be4('0x17')](_0x1992a8)[_0x1be4('0x18')]();};}function respondWithResult(_0xeb16e5,_0x3a3b3f){_0x3a3b3f=_0x3a3b3f||0xc8;return function(_0x3f6727){if(_0x3f6727){return _0xeb16e5[_0x1be4('0x17')](_0x3a3b3f)[_0x1be4('0x19')](_0x3f6727);}};}function respondWithFilteredResult(_0x5866e8,_0x57fb72){return function(_0x13f4f0){if(_0x13f4f0){var _0x530cfa=typeof _0x57fb72[_0x1be4('0x1a')]===_0x1be4('0x1b')&&typeof _0x57fb72['limit']===_0x1be4('0x1b');var _0x51cc30=_0x13f4f0[_0x1be4('0x1c')];var _0x4de86d=_0x530cfa?0x0:_0x57fb72[_0x1be4('0x1a')];var _0x193662=_0x530cfa?_0x13f4f0[_0x1be4('0x1c')]:_0x57fb72[_0x1be4('0x1a')]+_0x57fb72[_0x1be4('0x1d')];var _0x3ad94c;if(_0x193662>=_0x51cc30){_0x193662=_0x51cc30;_0x3ad94c=0xc8;}else{_0x3ad94c=0xce;}_0x5866e8[_0x1be4('0x17')](_0x3ad94c);return _0x5866e8[_0x1be4('0x1e')]('Content-Range',_0x4de86d+'-'+_0x193662+'/'+_0x51cc30)[_0x1be4('0x19')](_0x13f4f0);}return null;};}function patchUpdates(_0x14c53f){return function(_0x4b29a3){try{jsonpatch['apply'](_0x4b29a3,_0x14c53f,!![]);}catch(_0x352a9a){return BPromise[_0x1be4('0x1f')](_0x352a9a);}return _0x4b29a3[_0x1be4('0x20')]();};}function saveUpdates(_0x3ed80e,_0x5289d2){return function(_0x24855e){if(_0x24855e){return _0x24855e[_0x1be4('0x21')](_0x3ed80e)[_0x1be4('0x22')](function(_0x41db06){return _0x41db06;});}return null;};}function removeEntity(_0x401fb2,_0x89734e){return function(_0x14433f){if(_0x14433f){return _0x14433f[_0x1be4('0x23')]()['then'](function(){_0x401fb2[_0x1be4('0x17')](0xcc)[_0x1be4('0x18')]();});}};}function handleEntityNotFound(_0x2dd520,_0x4e8a61){return function(_0x1c2ea6){if(!_0x1c2ea6){_0x2dd520[_0x1be4('0x16')](0x194);}return _0x1c2ea6;};}function handleError(_0x1814fc,_0x29abda){_0x29abda=_0x29abda||0x1f4;return function(_0x3b63e2){logger[_0x1be4('0x24')](_0x3b63e2[_0x1be4('0x25')]);if(_0x3b63e2['name']){delete _0x3b63e2['name'];}_0x1814fc[_0x1be4('0x17')](_0x29abda)[_0x1be4('0x26')](_0x3b63e2);};}exports[_0x1be4('0x27')]=function(_0x434a00,_0xc7bc18){var _0x260488={},_0x1f29c6={},_0x1be9d4={'count':0x0,'rows':[]};var _0x2bfc9d=_[_0x1be4('0x28')](db[_0x1be4('0x29')][_0x1be4('0x2a')],function(_0x5ed492){return{'name':_0x5ed492[_0x1be4('0x2b')],'type':_0x5ed492[_0x1be4('0x2c')]['key']};});_0x1f29c6['model']=_[_0x1be4('0x2d')](_[_0x1be4('0x28')](_0x2bfc9d,_0x1be4('0x2e')),[_0x1be4('0x2e')]);_0x1f29c6[_0x1be4('0x2f')]=_['keys'](_0x434a00[_0x1be4('0x2f')]);_0x1f29c6[_0x1be4('0x30')]=_[_0x1be4('0x31')](_0x1f29c6[_0x1be4('0x32')],_0x1f29c6['query']);_0x260488[_0x1be4('0x33')]=_[_0x1be4('0x31')](_0x1f29c6['model'],qs[_0x1be4('0x34')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x34')]));_0x260488[_0x1be4('0x33')]=_0x260488[_0x1be4('0x33')][_0x1be4('0x35')]?_0x260488['attributes']:_0x1f29c6['model'];if(!_0x434a00['query'][_0x1be4('0x36')](_0x1be4('0x37'))){_0x260488[_0x1be4('0x1d')]=qs[_0x1be4('0x1d')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x1d')]);_0x260488['offset']=qs[_0x1be4('0x1a')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x1a')]);}_0x260488[_0x1be4('0x38')]=qs[_0x1be4('0x39')](_0x434a00['query'][_0x1be4('0x39')]);_0x260488[_0x1be4('0x3a')]=qs[_0x1be4('0x30')](_['pick'](_0x434a00['query'],_0x1f29c6[_0x1be4('0x30')]),_0x2bfc9d);if(_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3b')]){_0x260488[_0x1be4('0x3a')]=_[_0x1be4('0x3c')](_0x260488[_0x1be4('0x3a')],{'$or':_['map'](_0x2bfc9d,function(_0x45536e){if(_0x45536e[_0x1be4('0x2c')]!==_0x1be4('0x3d')){var _0x44ddf0={};_0x44ddf0[_0x45536e[_0x1be4('0x2e')]]={'$like':'%'+_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3b')]+'%'};return _0x44ddf0;}})});}_0x260488=_[_0x1be4('0x3c')]({},_0x260488,_0x434a00['options']);var _0x540e6c={'where':_0x260488[_0x1be4('0x3a')]};return db[_0x1be4('0x29')][_0x1be4('0x1c')](_0x540e6c)['then'](function(_0x24328c){_0x1be9d4[_0x1be4('0x1c')]=_0x24328c;if(_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3e')]){_0x260488[_0x1be4('0x3f')]=[{'all':!![]}];}return db[_0x1be4('0x29')][_0x1be4('0x40')](_0x260488);})[_0x1be4('0x22')](function(_0xb04a2f){_0x1be9d4[_0x1be4('0x41')]=_0xb04a2f;return _0x1be9d4;})[_0x1be4('0x22')](respondWithFilteredResult(_0xc7bc18,_0x260488))[_0x1be4('0x42')](handleError(_0xc7bc18,null));};exports[_0x1be4('0x43')]=function(_0x3fa707,_0x41ab8c){var _0x394e9a={'raw':!![],'where':{'id':_0x3fa707[_0x1be4('0x44')]['id']}},_0x331e4d={};_0x331e4d[_0x1be4('0x32')]=_['keys'](db[_0x1be4('0x29')][_0x1be4('0x2a')]);_0x331e4d[_0x1be4('0x2f')]=_[_0x1be4('0x45')](_0x3fa707[_0x1be4('0x2f')]);_0x331e4d[_0x1be4('0x30')]=_[_0x1be4('0x31')](_0x331e4d[_0x1be4('0x32')],_0x331e4d[_0x1be4('0x2f')]);_0x394e9a[_0x1be4('0x33')]=_[_0x1be4('0x31')](_0x331e4d[_0x1be4('0x32')],qs[_0x1be4('0x34')](_0x3fa707[_0x1be4('0x2f')][_0x1be4('0x34')]));_0x394e9a[_0x1be4('0x33')]=_0x394e9a[_0x1be4('0x33')]['length']?_0x394e9a[_0x1be4('0x33')]:_0x331e4d[_0x1be4('0x32')];if(_0x3fa707['query'][_0x1be4('0x3e')]){_0x394e9a['include']=[{'all':!![]}];}_0x394e9a=_[_0x1be4('0x3c')]({},_0x394e9a,_0x3fa707[_0x1be4('0x46')]);return db[_0x1be4('0x29')][_0x1be4('0x47')](_0x394e9a)[_0x1be4('0x22')](handleEntityNotFound(_0x41ab8c,null))[_0x1be4('0x22')](respondWithResult(_0x41ab8c,null))[_0x1be4('0x42')](handleError(_0x41ab8c,null));};exports[_0x1be4('0x48')]=function(_0x13920f,_0x30504b){return db[_0x1be4('0x29')][_0x1be4('0x48')](_0x13920f['body'],{})[_0x1be4('0x22')](respondWithResult(_0x30504b,0xc9))[_0x1be4('0x42')](handleError(_0x30504b,null));};exports['update']=function(_0xa36d7a,_0x34034c){if(_0xa36d7a['body']['id']){delete _0xa36d7a['body']['id'];}return db[_0x1be4('0x29')]['find']({'where':{'id':_0xa36d7a[_0x1be4('0x44')]['id']}})[_0x1be4('0x22')](handleEntityNotFound(_0x34034c,null))[_0x1be4('0x22')](saveUpdates(_0xa36d7a[_0x1be4('0x49')],null))[_0x1be4('0x22')](respondWithResult(_0x34034c,null))['catch'](handleError(_0x34034c,null));};exports[_0x1be4('0x23')]=function(_0x5b4cac,_0x58e005){return db[_0x1be4('0x29')][_0x1be4('0x47')]({'where':{'id':_0x5b4cac['params']['id']}})[_0x1be4('0x22')](handleEntityNotFound(_0x58e005,null))['then'](removeEntity(_0x58e005,null))[_0x1be4('0x42')](handleError(_0x58e005,null));};exports[_0x1be4('0x4a')]=function(_0x58db67,_0x23c7bc,_0x57679c){return db[_0x1be4('0x29')][_0x1be4('0x47')]({'where':{'id':_0x58db67[_0x1be4('0x44')]['id']},'attributes':['id','recording','msg_id']})[_0x1be4('0x22')](handleEntityNotFound(_0x23c7bc,null))[_0x1be4('0x22')](function(_0x3804ef){if(_0x3804ef){if(!_0x3804ef[_0x1be4('0x4b')]){throw new db['Sequelize'][(_0x1be4('0x4c'))](_0x1be4('0x4d'));}var _0x4707ed={'Content-Type':_0x1be4('0x4e'),'Content-Disposition':'attachment'};if(_0x3804ef[_0x1be4('0x4f')]){_0x4707ed[_0x1be4('0x50')]='attachment;\x20filename=\x22'+_0x3804ef[_0x1be4('0x4f')]+_0x1be4('0x51');}_0x23c7bc['set'](_0x4707ed);return _0x23c7bc[_0x1be4('0x26')](new Buffer(_0x3804ef[_0x1be4('0x4b')]));}})[_0x1be4('0x42')](handleError(_0x23c7bc,null));}; \ No newline at end of file +var _0x1020=['json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','VoiceMailMessage','model','keys','query','filters','intersection','attributes','fields','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','length','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','status','end'];(function(_0x156ca8,_0x21f713){var _0xc19cc=function(_0x13c546){while(--_0x13c546){_0x156ca8['push'](_0x156ca8['shift']());}};_0xc19cc(++_0x21f713);}(_0x1020,0x1c4));var _0x0102=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x1020[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x0102('0x0'));var rimraf=require(_0x0102('0x1'));var zipdir=require(_0x0102('0x2'));var jsonpatch=require(_0x0102('0x3'));var rp=require(_0x0102('0x4'));var moment=require(_0x0102('0x5'));var BPromise=require(_0x0102('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0102('0x7'));var csv=require(_0x0102('0x8'));var ejs=require(_0x0102('0x9'));var fs=require('fs');var fs_extra=require(_0x0102('0xa'));var _=require('lodash');var squel=require(_0x0102('0xb'));var crypto=require(_0x0102('0xc'));var jsforce=require(_0x0102('0xd'));var deskjs=require(_0x0102('0xe'));var toCsv=require(_0x0102('0x8'));var querystring=require(_0x0102('0xf'));var Papa=require(_0x0102('0x10'));var Redis=require(_0x0102('0x11'));var authService=require(_0x0102('0x12'));var qs=require(_0x0102('0x13'));var as=require(_0x0102('0x14'));var hardwareService=require(_0x0102('0x15'));var logger=require(_0x0102('0x16'))(_0x0102('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0102('0x18'))['db'];function respondWithStatusCode(_0x3a4efb,_0x276c37){_0x276c37=_0x276c37||0xcc;return function(_0x32f07c){if(_0x32f07c){return _0x3a4efb[_0x0102('0x19')](_0x276c37);}return _0x3a4efb[_0x0102('0x1a')](_0x276c37)[_0x0102('0x1b')]();};}function respondWithResult(_0x1cb63f,_0x147a62){_0x147a62=_0x147a62||0xc8;return function(_0x4c3228){if(_0x4c3228){return _0x1cb63f[_0x0102('0x1a')](_0x147a62)[_0x0102('0x1c')](_0x4c3228);}};}function respondWithFilteredResult(_0x26d1db,_0xfd6394){return function(_0x44fcd5){if(_0x44fcd5){var _0x352a08=typeof _0xfd6394['offset']==='undefined'&&typeof _0xfd6394[_0x0102('0x1d')]===_0x0102('0x1e');var _0x46db9c=_0x44fcd5[_0x0102('0x1f')];var _0x1a8403=_0x352a08?0x0:_0xfd6394[_0x0102('0x20')];var _0x528a0c=_0x352a08?_0x44fcd5[_0x0102('0x1f')]:_0xfd6394['offset']+_0xfd6394['limit'];var _0x229077;if(_0x528a0c>=_0x46db9c){_0x528a0c=_0x46db9c;_0x229077=0xc8;}else{_0x229077=0xce;}_0x26d1db['status'](_0x229077);return _0x26d1db[_0x0102('0x21')](_0x0102('0x22'),_0x1a8403+'-'+_0x528a0c+'/'+_0x46db9c)[_0x0102('0x1c')](_0x44fcd5);}return null;};}function patchUpdates(_0xa5d08a){return function(_0x557421){try{jsonpatch[_0x0102('0x23')](_0x557421,_0xa5d08a,!![]);}catch(_0x434835){return BPromise[_0x0102('0x24')](_0x434835);}return _0x557421[_0x0102('0x25')]();};}function saveUpdates(_0xad895f,_0x2cf935){return function(_0x46bc29){if(_0x46bc29){return _0x46bc29[_0x0102('0x26')](_0xad895f)[_0x0102('0x27')](function(_0x552b46){return _0x552b46;});}return null;};}function removeEntity(_0x426e26,_0x372ba5){return function(_0x392cd8){if(_0x392cd8){return _0x392cd8[_0x0102('0x28')]()[_0x0102('0x27')](function(){_0x426e26[_0x0102('0x1a')](0xcc)[_0x0102('0x1b')]();});}};}function handleEntityNotFound(_0x5490f5,_0x5f0e9b){return function(_0x4a2c38){if(!_0x4a2c38){_0x5490f5['sendStatus'](0x194);}return _0x4a2c38;};}function handleError(_0x395112,_0x5cac6d){_0x5cac6d=_0x5cac6d||0x1f4;return function(_0x3611e1){logger[_0x0102('0x29')](_0x3611e1['stack']);if(_0x3611e1[_0x0102('0x2a')]){delete _0x3611e1[_0x0102('0x2a')];}_0x395112['status'](_0x5cac6d)[_0x0102('0x2b')](_0x3611e1);};}exports['index']=function(_0x2cd6e2,_0x5b9520){var _0x58dd18={},_0x5051a9={},_0x5be16b={'count':0x0,'rows':[]};var _0x39ab4a=_[_0x0102('0x2c')](db[_0x0102('0x2d')]['rawAttributes'],function(_0x316afe){return{'name':_0x316afe['fieldName'],'type':_0x316afe['type']['key']};});_0x5051a9[_0x0102('0x2e')]=_['differenceBy'](_[_0x0102('0x2c')](_0x39ab4a,_0x0102('0x2a')),['name']);_0x5051a9['query']=_[_0x0102('0x2f')](_0x2cd6e2[_0x0102('0x30')]);_0x5051a9[_0x0102('0x31')]=_[_0x0102('0x32')](_0x5051a9[_0x0102('0x2e')],_0x5051a9[_0x0102('0x30')]);_0x58dd18[_0x0102('0x33')]=_[_0x0102('0x32')](_0x5051a9[_0x0102('0x2e')],qs[_0x0102('0x34')](_0x2cd6e2[_0x0102('0x30')]['fields']));_0x58dd18['attributes']=_0x58dd18[_0x0102('0x33')]['length']?_0x58dd18['attributes']:_0x5051a9[_0x0102('0x2e')];if(!_0x2cd6e2['query']['hasOwnProperty']('nolimit')){_0x58dd18[_0x0102('0x1d')]=qs[_0x0102('0x1d')](_0x2cd6e2[_0x0102('0x30')]['limit']);_0x58dd18[_0x0102('0x20')]=qs[_0x0102('0x20')](_0x2cd6e2[_0x0102('0x30')][_0x0102('0x20')]);}_0x58dd18['order']=qs[_0x0102('0x35')](_0x2cd6e2[_0x0102('0x30')][_0x0102('0x35')]);_0x58dd18['where']=qs[_0x0102('0x31')](_[_0x0102('0x36')](_0x2cd6e2[_0x0102('0x30')],_0x5051a9[_0x0102('0x31')]),_0x39ab4a);if(_0x2cd6e2[_0x0102('0x30')][_0x0102('0x37')]){_0x58dd18[_0x0102('0x38')]=_[_0x0102('0x39')](_0x58dd18[_0x0102('0x38')],{'$or':_[_0x0102('0x2c')](_0x39ab4a,function(_0x95197a){if(_0x95197a[_0x0102('0x3a')]!==_0x0102('0x3b')){var _0x19bca5={};_0x19bca5[_0x95197a[_0x0102('0x2a')]]={'$like':'%'+_0x2cd6e2[_0x0102('0x30')][_0x0102('0x37')]+'%'};return _0x19bca5;}})});}_0x58dd18=_['merge']({},_0x58dd18,_0x2cd6e2[_0x0102('0x3c')]);var _0x481e35={'where':_0x58dd18[_0x0102('0x38')]};return db[_0x0102('0x2d')]['count'](_0x481e35)['then'](function(_0x2ec7fe){_0x5be16b['count']=_0x2ec7fe;if(_0x2cd6e2[_0x0102('0x30')][_0x0102('0x3d')]){_0x58dd18[_0x0102('0x3e')]=[{'all':!![]}];}return db[_0x0102('0x2d')]['findAll'](_0x58dd18);})['then'](function(_0x406072){_0x5be16b['rows']=_0x406072;return _0x5be16b;})[_0x0102('0x27')](respondWithFilteredResult(_0x5b9520,_0x58dd18))[_0x0102('0x3f')](handleError(_0x5b9520,null));};exports['show']=function(_0x329080,_0x4e38e3){var _0x3d44a4={'raw':!![],'where':{'id':_0x329080[_0x0102('0x40')]['id']}},_0x16a988={};_0x16a988[_0x0102('0x2e')]=_[_0x0102('0x2f')](db['VoiceMailMessage'][_0x0102('0x41')]);_0x16a988['query']=_[_0x0102('0x2f')](_0x329080['query']);_0x16a988[_0x0102('0x31')]=_[_0x0102('0x32')](_0x16a988['model'],_0x16a988[_0x0102('0x30')]);_0x3d44a4[_0x0102('0x33')]=_[_0x0102('0x32')](_0x16a988[_0x0102('0x2e')],qs[_0x0102('0x34')](_0x329080['query'][_0x0102('0x34')]));_0x3d44a4['attributes']=_0x3d44a4[_0x0102('0x33')][_0x0102('0x42')]?_0x3d44a4[_0x0102('0x33')]:_0x16a988['model'];if(_0x329080[_0x0102('0x30')][_0x0102('0x3d')]){_0x3d44a4[_0x0102('0x3e')]=[{'all':!![]}];}_0x3d44a4=_['merge']({},_0x3d44a4,_0x329080[_0x0102('0x3c')]);return db['VoiceMailMessage'][_0x0102('0x43')](_0x3d44a4)[_0x0102('0x27')](handleEntityNotFound(_0x4e38e3,null))[_0x0102('0x27')](respondWithResult(_0x4e38e3,null))[_0x0102('0x3f')](handleError(_0x4e38e3,null));};exports['create']=function(_0x4bfe9b,_0x45163f){return db[_0x0102('0x2d')][_0x0102('0x44')](_0x4bfe9b[_0x0102('0x45')],{})[_0x0102('0x27')](respondWithResult(_0x45163f,0xc9))[_0x0102('0x3f')](handleError(_0x45163f,null));};exports['update']=function(_0x36b5ca,_0x31b39d){if(_0x36b5ca['body']['id']){delete _0x36b5ca[_0x0102('0x45')]['id'];}return db[_0x0102('0x2d')][_0x0102('0x43')]({'where':{'id':_0x36b5ca['params']['id']}})['then'](handleEntityNotFound(_0x31b39d,null))[_0x0102('0x27')](saveUpdates(_0x36b5ca[_0x0102('0x45')],null))[_0x0102('0x27')](respondWithResult(_0x31b39d,null))[_0x0102('0x3f')](handleError(_0x31b39d,null));};exports[_0x0102('0x28')]=function(_0x5b1770,_0x4f6663){return db['VoiceMailMessage'][_0x0102('0x43')]({'where':{'id':_0x5b1770[_0x0102('0x40')]['id']}})[_0x0102('0x27')](handleEntityNotFound(_0x4f6663,null))['then'](removeEntity(_0x4f6663,null))[_0x0102('0x3f')](handleError(_0x4f6663,null));};exports[_0x0102('0x46')]=function(_0x14ff77,_0x3e5545,_0x5c2c54){return db[_0x0102('0x2d')]['find']({'where':{'id':_0x14ff77['params']['id']},'attributes':['id',_0x0102('0x47'),_0x0102('0x48')]})[_0x0102('0x27')](handleEntityNotFound(_0x3e5545,null))[_0x0102('0x27')](function(_0x36ae23){if(_0x36ae23){if(!_0x36ae23['recording']){throw new db[(_0x0102('0x49'))][(_0x0102('0x4a'))]('VoiceMailMessage\x20not\x20found');}var _0x538aa9={'Content-Type':_0x0102('0x4b'),'Content-Disposition':_0x0102('0x4c')};if(_0x36ae23['msg_id']){_0x538aa9[_0x0102('0x4d')]=_0x0102('0x4e')+_0x36ae23[_0x0102('0x48')]+_0x0102('0x4f');}_0x3e5545[_0x0102('0x21')](_0x538aa9);return _0x3e5545[_0x0102('0x2b')](new Buffer(_0x36ae23[_0x0102('0x47')]));}})[_0x0102('0x3f')](handleError(_0x3e5545,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3d2847a..f9a1207 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 _0x023c=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash'];(function(_0x1c9a61,_0xdb42b4){var _0x30fef2=function(_0x3406bc){while(--_0x3406bc){_0x1c9a61['push'](_0x1c9a61['shift']());}};_0x30fef2(++_0xdb42b4);}(_0x023c,0x15e));var _0xc023=function(_0x1c953a,_0x3174cf){_0x1c953a=_0x1c953a-0x0;var _0x4fdf02=_0x023c[_0x1c953a];return _0x4fdf02;};'use strict';var _=require(_0xc023('0x0'));var util=require(_0xc023('0x1'));var logger=require('../../config/logger')(_0xc023('0x2'));var moment=require(_0xc023('0x3'));var BPromise=require(_0xc023('0x4'));var rp=require(_0xc023('0x5'));var fs=require('fs');var path=require(_0xc023('0x6'));var rimraf=require(_0xc023('0x7'));var config=require('../../config/environment');var attributes=require(_0xc023('0x8'));module[_0xc023('0x9')]=function(_0xf8fc52,_0x3440e9){return _0xf8fc52[_0xc023('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xc023('0xb'),'paranoid':![],'indexes':[{'name':_0xc023('0xc'),'fields':[_0xc023('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6c7e=['./voiceMailMessage.attributes','exports','define','dir','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2b9536,_0x4ddb75){var _0x12f58e=function(_0x988c7a){while(--_0x988c7a){_0x2b9536['push'](_0x2b9536['shift']());}};_0x12f58e(++_0x4ddb75);}(_0x6c7e,0x1cc));var _0xe6c7=function(_0x214fe8,_0x3eea5e){_0x214fe8=_0x214fe8-0x0;var _0x405a51=_0x6c7e[_0x214fe8];return _0x405a51;};'use strict';var _=require(_0xe6c7('0x0'));var util=require(_0xe6c7('0x1'));var logger=require(_0xe6c7('0x2'))(_0xe6c7('0x3'));var moment=require(_0xe6c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6c7('0x5'));var rimraf=require(_0xe6c7('0x6'));var config=require(_0xe6c7('0x7'));var attributes=require(_0xe6c7('0x8'));module[_0xe6c7('0x9')]=function(_0x163ed9,_0x5b234b){return _0x163ed9[_0xe6c7('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xe6c7('0xb'),'fields':[_0xe6c7('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2ac388d..db128b3 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 _0xcc96=['../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x368c09,_0x29b826){var _0x27eb34=function(_0x1f6794){while(--_0x1f6794){_0x368c09['push'](_0x368c09['shift']());}};_0x27eb34(++_0x29b826);}(_0xcc96,0x17f));var _0x6cc9=function(_0x405f6b,_0x33125d){_0x405f6b=_0x405f6b-0x0;var _0x12f6d3=_0xcc96[_0x405f6b];return _0x12f6d3;};'use strict';var _=require('lodash');var util=require(_0x6cc9('0x0'));var moment=require(_0x6cc9('0x1'));var BPromise=require(_0x6cc9('0x2'));var rs=require(_0x6cc9('0x3'));var fs=require('fs');var Redis=require(_0x6cc9('0x4'));var db=require(_0x6cc9('0x5'))['db'];var utils=require(_0x6cc9('0x6'));var logger=require(_0x6cc9('0x7'))('rpc');var config=require(_0x6cc9('0x8'));var jayson=require(_0x6cc9('0x9'));var client=jayson[_0x6cc9('0xa')][_0x6cc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e751,_0x4840b2,_0x2cd6ce){return new BPromise(function(_0x21f6e6,_0x449eb7){return client[_0x6cc9('0xc')](_0x41e751,_0x2cd6ce)['then'](function(_0x3bef1d){logger[_0x6cc9('0xd')](_0x6cc9('0xe'),_0x4840b2,'request\x20sent');logger[_0x6cc9('0xf')](_0x6cc9('0x10'),_0x4840b2,_0x6cc9('0x11'),JSON[_0x6cc9('0x12')](_0x3bef1d));if(_0x3bef1d[_0x6cc9('0x13')]){if(_0x3bef1d['error'][_0x6cc9('0x14')]===0x1f4){logger[_0x6cc9('0x13')](_0x6cc9('0xe'),_0x4840b2,_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);return _0x449eb7(_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);}logger['error'](_0x6cc9('0xe'),_0x4840b2,_0x3bef1d[_0x6cc9('0x13')]['message']);return _0x21f6e6(_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);}else{logger['info'](_0x6cc9('0xe'),_0x4840b2,_0x6cc9('0x11'));_0x21f6e6(_0x3bef1d[_0x6cc9('0x16')][_0x6cc9('0x15')]);}})['catch'](function(_0xa4615d){logger[_0x6cc9('0x13')](_0x6cc9('0xe'),_0x4840b2,_0xa4615d);_0x449eb7(_0xa4615d);});});} \ No newline at end of file +var _0x8eec=['info','request\x20sent','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x23b506,_0x2b5838){var _0xffef93=function(_0x2a5167){while(--_0x2a5167){_0x23b506['push'](_0x23b506['shift']());}};_0xffef93(++_0x2b5838);}(_0x8eec,0x80));var _0xc8ee=function(_0x219d1e,_0x3065a6){_0x219d1e=_0x219d1e-0x0;var _0xbc51e9=_0x8eec[_0x219d1e];return _0xbc51e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8ee('0x0'));var BPromise=require(_0xc8ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8ee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8ee('0x3'));var logger=require(_0xc8ee('0x4'))(_0xc8ee('0x5'));var config=require(_0xc8ee('0x6'));var jayson=require(_0xc8ee('0x7'));var client=jayson[_0xc8ee('0x8')][_0xc8ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7b89f,_0x99ee14,_0x26130c){return new BPromise(function(_0x195da9,_0x192436){return client[_0xc8ee('0xa')](_0x7b89f,_0x26130c)[_0xc8ee('0xb')](function(_0x463d52){logger[_0xc8ee('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x99ee14,_0xc8ee('0xd'));logger[_0xc8ee('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x99ee14,_0xc8ee('0xd'),JSON[_0xc8ee('0xf')](_0x463d52));if(_0x463d52[_0xc8ee('0x10')]){if(_0x463d52[_0xc8ee('0x10')]['code']===0x1f4){logger[_0xc8ee('0x10')](_0xc8ee('0x11'),_0x99ee14,_0x463d52[_0xc8ee('0x10')][_0xc8ee('0x12')]);return _0x192436(_0x463d52[_0xc8ee('0x10')][_0xc8ee('0x12')]);}logger[_0xc8ee('0x10')](_0xc8ee('0x11'),_0x99ee14,_0x463d52['error']['message']);return _0x195da9(_0x463d52[_0xc8ee('0x10')]['message']);}else{logger['info'](_0xc8ee('0x11'),_0x99ee14,_0xc8ee('0xd'));_0x195da9(_0x463d52['result']['message']);}})[_0xc8ee('0x13')](function(_0x18ce39){logger['error'](_0xc8ee('0x11'),_0x99ee14,_0x18ce39);_0x192436(_0x18ce39);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 03c24d7..23589a9 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 _0x7265=['/:id/sounds/:id2','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','create','addSound','put','delete','destroy'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7265,0x17c));var _0x5726=function(_0x4551f2,_0x4483f9){_0x4551f2=_0x4551f2-0x0;var _0x2a14e0=_0x7265[_0x4551f2];return _0x2a14e0;};'use strict';var multer=require(_0x5726('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5726('0x1'));var router=express[_0x5726('0x2')]();var fs_extra=require(_0x5726('0x3'));var auth=require(_0x5726('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5726('0x5'));var controller=require(_0x5726('0x6'));router[_0x5726('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5726('0x7')](_0x5726('0x8'),auth['isAuthenticated'](),controller[_0x5726('0x9')]);router[_0x5726('0x7')](_0x5726('0xa'),auth[_0x5726('0xb')](),controller[_0x5726('0xc')]);router[_0x5726('0xd')]('/',auth[_0x5726('0xb')](),controller[_0x5726('0xe')]);router['post'](_0x5726('0xa'),auth['isAuthenticated'](),controller[_0x5726('0xf')]);router[_0x5726('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5726('0x11')](_0x5726('0x8'),auth[_0x5726('0xb')](),controller[_0x5726('0x12')]);router[_0x5726('0x11')](_0x5726('0x13'),auth[_0x5726('0xb')](),controller['removeSound']);module[_0x5726('0x14')]=router; \ No newline at end of file +var _0x14f3=['isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x9948e2,_0xee3196){var _0x42baba=function(_0x22561c){while(--_0x22561c){_0x9948e2['push'](_0x9948e2['shift']());}};_0x42baba(++_0xee3196);}(_0x14f3,0x7c));var _0x314f=function(_0xd8abcc,_0x2e4ff0){_0xd8abcc=_0xd8abcc-0x0;var _0xdd7207=_0x14f3[_0xd8abcc];return _0xdd7207;};'use strict';var multer=require(_0x314f('0x0'));var util=require('util');var path=require(_0x314f('0x1'));var timeout=require('connect-timeout');var express=require(_0x314f('0x2'));var router=express[_0x314f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x314f('0x4'));var interaction=require(_0x314f('0x5'));var config=require(_0x314f('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x314f('0x7')]('/',auth[_0x314f('0x8')](),controller[_0x314f('0x9')]);router[_0x314f('0x7')](_0x314f('0xa'),auth[_0x314f('0x8')](),controller[_0x314f('0xb')]);router['get'](_0x314f('0xc'),auth[_0x314f('0x8')](),controller[_0x314f('0xd')]);router['post']('/',auth[_0x314f('0x8')](),controller[_0x314f('0xe')]);router['post'](_0x314f('0xc'),auth[_0x314f('0x8')](),controller[_0x314f('0xf')]);router[_0x314f('0x10')](_0x314f('0xa'),auth[_0x314f('0x8')](),controller[_0x314f('0x11')]);router[_0x314f('0x12')](_0x314f('0xa'),auth[_0x314f('0x8')](),controller[_0x314f('0x13')]);router[_0x314f('0x12')](_0x314f('0x14'),auth[_0x314f('0x8')](),controller['removeSound']);module[_0x314f('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f7359d1..f2b21ba 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 _0x6bf8=['quietmp3','mp3','files','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb'];(function(_0x3995e9,_0x111598){var _0x583920=function(_0x3e355b){while(--_0x3e355b){_0x3995e9['push'](_0x3995e9['shift']());}};_0x583920(++_0x111598);}(_0x6bf8,0x1bf));var _0x86bf=function(_0x534621,_0x4b9879){_0x534621=_0x534621-0x0;var _0x3c6624=_0x6bf8[_0x534621];return _0x3c6624;};'use strict';var Sequelize=require(_0x86bf('0x0'));module[_0x86bf('0x1')]={'name':{'type':Sequelize[_0x86bf('0x2')],'allowNull':![],'unique':_0x86bf('0x3')},'mode':{'type':Sequelize[_0x86bf('0x4')](_0x86bf('0x5'),'files',_0x86bf('0x6'),_0x86bf('0x7'),_0x86bf('0x8'),_0x86bf('0x9')),'allowNull':!![],'defaultValue':_0x86bf('0xa')},'directory':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'stamp':{'type':_0x86bf('0xb')},'defaultEntry':{'type':Sequelize[_0x86bf('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa08a=['BOOLEAN','exports','ENUM','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING','alpha','TIMESTAMP'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa08a,0x109));var _0xaa08=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0xa08a[_0x4f3cd1];return _0x4f304d;};'use strict';var Sequelize=require('sequelize');module[_0xaa08('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xaa08('0x1')]('custom','files',_0xaa08('0x2'),_0xaa08('0x3'),_0xaa08('0x4'),_0xaa08('0x5')),'allowNull':!![],'defaultValue':_0xaa08('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xaa08('0x7')],'allowNull':!![],'defaultValue':_0xaa08('0x8')},'format':{'type':Sequelize[_0xaa08('0x7')],'allowNull':!![]},'stamp':{'type':_0xaa08('0x9')},'defaultEntry':{'type':Sequelize[_0xaa08('0xa')],'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 ee11f0c..341f4d6 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 _0xea72=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','VoiceMusicOnHold','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','update','body','catch','create','transaction','mode','files','directory','join','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','unlinkSync','getSounds','Sound','order','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x2e5a71,_0x10713a){var _0x353b4c=function(_0x29e075){while(--_0x29e075){_0x2e5a71['push'](_0x2e5a71['shift']());}};_0x353b4c(++_0x10713a);}(_0xea72,0x1a5));var _0x2ea7=function(_0x3ebf6c,_0x52e062){_0x3ebf6c=_0x3ebf6c-0x0;var _0x1dc737=_0xea72[_0x3ebf6c];return _0x1dc737;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ea7('0x0'));var jsonpatch=require(_0x2ea7('0x1'));var rp=require(_0x2ea7('0x2'));var moment=require(_0x2ea7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ea7('0x4'));var path=require('path');var sox=require(_0x2ea7('0x5'));var csv=require('to-csv');var ejs=require(_0x2ea7('0x6'));var fs=require('fs');var fs_extra=require(_0x2ea7('0x7'));var _=require(_0x2ea7('0x8'));var squel=require(_0x2ea7('0x9'));var crypto=require(_0x2ea7('0xa'));var jsforce=require(_0x2ea7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ea7('0xc'));var querystring=require(_0x2ea7('0xd'));var Papa=require(_0x2ea7('0xe'));var Redis=require('ioredis');var authService=require(_0x2ea7('0xf'));var qs=require(_0x2ea7('0x10'));var as=require(_0x2ea7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ea7('0x12'))(_0x2ea7('0x13'));var utils=require(_0x2ea7('0x14'));var config=require(_0x2ea7('0x15'));var licenseUtil=require(_0x2ea7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dcf9,_0x34cb8d){_0x34cb8d=_0x34cb8d||0xcc;return function(_0x2dcb16){if(_0x2dcb16){return _0x51dcf9['sendStatus'](_0x34cb8d);}return _0x51dcf9[_0x2ea7('0x17')](_0x34cb8d)[_0x2ea7('0x18')]();};}function respondWithResult(_0x17b45b,_0x3335c7){_0x3335c7=_0x3335c7||0xc8;return function(_0x5c6932){if(_0x5c6932){return _0x17b45b['status'](_0x3335c7)[_0x2ea7('0x19')](_0x5c6932);}};}function respondWithFilteredResult(_0x41accf,_0x4d9704){return function(_0x57144d){if(_0x57144d){var _0x9ad68=typeof _0x4d9704[_0x2ea7('0x1a')]===_0x2ea7('0x1b')&&typeof _0x4d9704[_0x2ea7('0x1c')]===_0x2ea7('0x1b');var _0x5d1d79=_0x57144d[_0x2ea7('0x1d')];var _0x394914=_0x9ad68?0x0:_0x4d9704['offset'];var _0x50b248=_0x9ad68?_0x57144d[_0x2ea7('0x1d')]:_0x4d9704[_0x2ea7('0x1a')]+_0x4d9704[_0x2ea7('0x1c')];var _0x2b4947;if(_0x50b248>=_0x5d1d79){_0x50b248=_0x5d1d79;_0x2b4947=0xc8;}else{_0x2b4947=0xce;}_0x41accf[_0x2ea7('0x17')](_0x2b4947);return _0x41accf[_0x2ea7('0x1e')]('Content-Range',_0x394914+'-'+_0x50b248+'/'+_0x5d1d79)[_0x2ea7('0x19')](_0x57144d);}return null;};}function patchUpdates(_0x468959){return function(_0x5ea0e){try{jsonpatch[_0x2ea7('0x1f')](_0x5ea0e,_0x468959,!![]);}catch(_0x150816){return BPromise[_0x2ea7('0x20')](_0x150816);}return _0x5ea0e[_0x2ea7('0x21')]();};}function saveUpdates(_0x29d854,_0x274608){return function(_0xffb02d){if(_0xffb02d){return _0xffb02d['update'](_0x29d854)[_0x2ea7('0x22')](function(_0x445866){return _0x445866;});}return null;};}function removeEntity(_0x213f8e,_0x892930){return function(_0x492120){if(_0x492120){return _0x492120[_0x2ea7('0x23')]()['then'](function(){var _0x2c5e01=_0x492120[_0x2ea7('0x24')]({'plain':!![]});var _0x7898b8=_0x2ea7('0x25');return db[_0x2ea7('0x26')]['destroy']({'where':{'type':_0x7898b8,'resourceId':_0x2c5e01['id']}})[_0x2ea7('0x22')](function(){return _0x492120;});})[_0x2ea7('0x22')](function(){_0x213f8e[_0x2ea7('0x17')](0xcc)[_0x2ea7('0x18')]();});}};}function handleEntityNotFound(_0x5312a9,_0x2768b0){return function(_0x141a47){if(!_0x141a47){_0x5312a9[_0x2ea7('0x27')](0x194);}return _0x141a47;};}function handleError(_0x476e85,_0x23eea5){_0x23eea5=_0x23eea5||0x1f4;return function(_0x12f044){logger[_0x2ea7('0x28')](_0x12f044['stack']);if(_0x12f044[_0x2ea7('0x29')]){delete _0x12f044['name'];}_0x476e85[_0x2ea7('0x17')](_0x23eea5)['send'](_0x12f044);};}exports['index']=function(_0x141773,_0x4ba8aa){var _0x24b0e2={},_0xf7308={},_0x3991e1={'count':0x0,'rows':[]};var _0x5105ae=_['map'](db[_0x2ea7('0x2a')]['rawAttributes'],function(_0x407c86){return{'name':_0x407c86['fieldName'],'type':_0x407c86['type'][_0x2ea7('0x2b')]};});_0xf7308[_0x2ea7('0x2c')]=_[_0x2ea7('0x2d')](_0x5105ae,_0x2ea7('0x29'));_0xf7308[_0x2ea7('0x2e')]=_[_0x2ea7('0x2f')](_0x141773['query']);_0xf7308[_0x2ea7('0x30')]=_[_0x2ea7('0x31')](_0xf7308[_0x2ea7('0x2c')],_0xf7308[_0x2ea7('0x2e')]);_0x24b0e2['attributes']=_[_0x2ea7('0x31')](_0xf7308[_0x2ea7('0x2c')],qs['fields'](_0x141773['query'][_0x2ea7('0x32')]));_0x24b0e2[_0x2ea7('0x33')]=_0x24b0e2[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0x24b0e2[_0x2ea7('0x33')]:_0xf7308['model'];if(!_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x35')](_0x2ea7('0x36'))){_0x24b0e2['limit']=qs[_0x2ea7('0x1c')](_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x1c')]);_0x24b0e2[_0x2ea7('0x1a')]=qs[_0x2ea7('0x1a')](_0x141773[_0x2ea7('0x2e')]['offset']);}_0x24b0e2['order']=qs['sort'](_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x37')]);delete _0x141773['query'][_0x2ea7('0x37')];_0x24b0e2[_0x2ea7('0x38')]=qs[_0x2ea7('0x30')](_[_0x2ea7('0x39')](_0x141773[_0x2ea7('0x2e')],_0xf7308[_0x2ea7('0x30')]),_0x5105ae);if(_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x3a')]){_0x24b0e2[_0x2ea7('0x38')]=_[_0x2ea7('0x3b')](_0x24b0e2['where'],{'$or':_[_0x2ea7('0x2d')](_0x5105ae,function(_0x2f3f9a){if(_0x2f3f9a[_0x2ea7('0x3c')]!=='VIRTUAL'){var _0x35f4f5={};_0x35f4f5[_0x2f3f9a[_0x2ea7('0x29')]]={'$like':'%'+_0x141773[_0x2ea7('0x2e')]['filter']+'%'};return _0x35f4f5;}})});}_0x24b0e2=_[_0x2ea7('0x3b')]({},_0x24b0e2,_0x141773['options']);var _0x10eae5={'where':_0x24b0e2[_0x2ea7('0x38')]};return db[_0x2ea7('0x2a')][_0x2ea7('0x1d')](_0x10eae5)['then'](function(_0x297090){_0x3991e1[_0x2ea7('0x1d')]=_0x297090;if(_0x141773['query'][_0x2ea7('0x3d')]){_0x24b0e2[_0x2ea7('0x3e')]=[{'all':!![]}];}return db[_0x2ea7('0x2a')][_0x2ea7('0x3f')](_0x24b0e2);})['then'](function(_0x1552f1){_0x3991e1[_0x2ea7('0x40')]=_0x1552f1;return _0x3991e1;})[_0x2ea7('0x22')](respondWithFilteredResult(_0x4ba8aa,_0x24b0e2))['catch'](handleError(_0x4ba8aa,null));};exports[_0x2ea7('0x41')]=function(_0x1551b3,_0x147f5a){var _0xa09ddc={'raw':![],'where':{'id':_0x1551b3[_0x2ea7('0x42')]['id']}},_0x1afdc4={};_0x1afdc4[_0x2ea7('0x2c')]=_['keys'](db[_0x2ea7('0x2a')][_0x2ea7('0x43')]);_0x1afdc4['query']=_[_0x2ea7('0x2f')](_0x1551b3[_0x2ea7('0x2e')]);_0x1afdc4['filters']=_[_0x2ea7('0x31')](_0x1afdc4[_0x2ea7('0x2c')],_0x1afdc4['query']);_0xa09ddc[_0x2ea7('0x33')]=_[_0x2ea7('0x31')](_0x1afdc4[_0x2ea7('0x2c')],qs[_0x2ea7('0x32')](_0x1551b3[_0x2ea7('0x2e')][_0x2ea7('0x32')]));_0xa09ddc[_0x2ea7('0x33')]=_0xa09ddc[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0xa09ddc[_0x2ea7('0x33')]:_0x1afdc4[_0x2ea7('0x2c')];if(_0x1551b3[_0x2ea7('0x2e')][_0x2ea7('0x3d')]){_0xa09ddc[_0x2ea7('0x3e')]=[{'all':!![]}];}_0xa09ddc=_[_0x2ea7('0x3b')]({},_0xa09ddc,_0x1551b3[_0x2ea7('0x44')]);return db[_0x2ea7('0x2a')][_0x2ea7('0x45')](_0xa09ddc)['then'](handleEntityNotFound(_0x147f5a,null))[_0x2ea7('0x22')](respondWithResult(_0x147f5a,null))['catch'](handleError(_0x147f5a,null));};exports[_0x2ea7('0x46')]=function(_0x34cf41,_0x7f75a7){if(_0x34cf41[_0x2ea7('0x47')]['id']){delete _0x34cf41[_0x2ea7('0x47')]['id'];}return db[_0x2ea7('0x2a')][_0x2ea7('0x45')]({'where':{'id':_0x34cf41['params']['id']}})['then'](handleEntityNotFound(_0x7f75a7,null))[_0x2ea7('0x22')](saveUpdates(_0x34cf41[_0x2ea7('0x47')],null))[_0x2ea7('0x22')](respondWithResult(_0x7f75a7,null))[_0x2ea7('0x48')](handleError(_0x7f75a7,null));};exports[_0x2ea7('0x49')]=function(_0x2c7b64,_0x4f0bdd,_0x2e7bf7){return db['sequelize'][_0x2ea7('0x4a')](function(_0x516d22){if(_0x2c7b64[_0x2ea7('0x47')][_0x2ea7('0x4b')]===_0x2ea7('0x4c')){_0x2c7b64[_0x2ea7('0x47')][_0x2ea7('0x4d')]=path[_0x2ea7('0x4e')](config['root'],'server/files/moh',_0x2c7b64['body'][_0x2ea7('0x29')]);}return db[_0x2ea7('0x2a')][_0x2ea7('0x49')](_0x2c7b64['body'],{'transaction':_0x516d22})[_0x2ea7('0x22')](function(_0xa2c2ff){if(_0x2c7b64['body'][_0x2ea7('0x4b')]===_0x2ea7('0x4c')){fs['mkdirSync'](_0xa2c2ff[_0x2ea7('0x4d')],parseInt(_0x2ea7('0x4f'),0x8));}var _0x159edb=_0x2c7b64['user']['get']({'plain':!![]});if(!_0x159edb)throw new Error(_0x2ea7('0x50'));if(_0x159edb[_0x2ea7('0x51')]==='user'){var _0x358df6=_0xa2c2ff[_0x2ea7('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x2ea7('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x159edb[_0x2ea7('0x52')]},'raw':!![]})[_0x2ea7('0x22')](function(_0x567d45){if(_0x567d45&&_0x567d45[_0x2ea7('0x53')]===0x0){return db['UserProfileResource'][_0x2ea7('0x49')]({'name':_0x358df6[_0x2ea7('0x29')],'resourceId':_0x358df6['id'],'type':_0x567d45[_0x2ea7('0x29')],'sectionId':_0x567d45['id']},{})[_0x2ea7('0x22')](function(){return _0xa2c2ff;});}else{return _0xa2c2ff;}})['catch'](function(_0x2f3557){logger[_0x2ea7('0x28')](_0x2ea7('0x54'),_0x2f3557);});}return _0xa2c2ff;});})[_0x2ea7('0x22')](respondWithResult(_0x4f0bdd,0xc9))[_0x2ea7('0x48')](handleError(_0x4f0bdd,null));};exports[_0x2ea7('0x23')]=function(_0x875bea,_0x410b68,_0x50caca){var _0x23c216;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x875bea['params']['id']}})[_0x2ea7('0x22')](function(_0x3127c6){if(_0x3127c6){return db[_0x2ea7('0x55')]['transaction'](function(_0x529ee8){return _0x3127c6[_0x2ea7('0x23')]({'transaction':_0x529ee8,'raw':!![]})[_0x2ea7('0x22')](function(_0x55b84d){if(_0x55b84d[_0x2ea7('0x4d')]){fs[_0x2ea7('0x56')](_0x55b84d['directory'])[_0x2ea7('0x57')](function(_0x3ca9b9){fs['unlinkSync'](path[_0x2ea7('0x4e')](_0x55b84d[_0x2ea7('0x4d')],_0x3ca9b9));});fs['rmdirSync'](_0x55b84d[_0x2ea7('0x4d')]);}return _0x55b84d;});})['catch'](function(_0x5d1cf3){throw new db[(_0x2ea7('0x58'))][(_0x2ea7('0x59'))](_0x5d1cf3[_0x2ea7('0x5a')]);});}})['then'](handleEntityNotFound(_0x410b68,null))['then'](removeEntity(_0x410b68,null))[_0x2ea7('0x48')](handleError(_0x410b68,null));};exports[_0x2ea7('0x5b')]=function(_0x45f608,_0xecedf1,_0x4c848f){return db[_0x2ea7('0x55')][_0x2ea7('0x4a')](function(_0x2097f2){var _0x4d9a45;return db[_0x2ea7('0x2a')][_0x2ea7('0x45')]({'where':{'id':_0x45f608[_0x2ea7('0x42')]['id']}})['then'](function(_0x5da46c){if(_0x5da46c){_0x4d9a45=_0x5da46c;return _0x5da46c[_0x2ea7('0x5b')](_0x45f608[_0x2ea7('0x47')]['id'],{'transaction':_0x2097f2});}})[_0x2ea7('0x22')](function(_0x16530a){if(_0x16530a){return db['Sound'][_0x2ea7('0x5c')]({'where':{'id':_0x45f608[_0x2ea7('0x47')]['id']},'attributes':['id',_0x2ea7('0x29'),_0x2ea7('0x5d'),_0x2ea7('0x5e'),'createdAt'],'raw':!![]});}})[_0x2ea7('0x22')](function(_0x22475c){if(_0x22475c){var _0x9c3b49=path[_0x2ea7('0x4e')](config[_0x2ea7('0x5f')],_0x2ea7('0x60'),util[_0x2ea7('0x61')](_0x2ea7('0x62'),path[_0x2ea7('0x63')](_0x22475c[_0x2ea7('0x5d')],path[_0x2ea7('0x64')](_0x22475c[_0x2ea7('0x5d')])),_0x22475c[_0x2ea7('0x5e')]));var _0x5df60b=path[_0x2ea7('0x4e')](config[_0x2ea7('0x5f')],'server/files/moh',_0x4d9a45['name'],util[_0x2ea7('0x61')](_0x2ea7('0x62'),_0x22475c[_0x2ea7('0x29')],_0x22475c[_0x2ea7('0x5e')]));fs[_0x2ea7('0x65')](_0x9c3b49,_0x5df60b);return _0x22475c;}})['catch'](function(_0x2ed412){throw new db['Sequelize'][(_0x2ea7('0x59'))](_0x2ed412['message']);});})[_0x2ea7('0x22')](handleEntityNotFound(_0xecedf1,null))[_0x2ea7('0x22')](respondWithResult(_0xecedf1,0xc9))[_0x2ea7('0x48')](handleError(_0xecedf1,null));};exports['removeSound']=function(_0xfa533d,_0x4f747c,_0x3445ea){return db['sequelize'][_0x2ea7('0x4a')](function(_0x389009){var _0x29cfd2;return db[_0x2ea7('0x2a')][_0x2ea7('0x5c')]({'where':{'id':_0xfa533d[_0x2ea7('0x42')]['id']}})[_0x2ea7('0x22')](handleEntityNotFound(_0x4f747c,null))[_0x2ea7('0x22')](function(_0x475c39){if(_0x475c39){_0x29cfd2=_0x475c39;return _0x475c39[_0x2ea7('0x66')](_0xfa533d[_0x2ea7('0x42')]['id2']);}})[_0x2ea7('0x22')](function(_0x5a96da){if(_0x5a96da){return db['Sound'][_0x2ea7('0x5c')]({'where':{'id':_0xfa533d[_0x2ea7('0x42')][_0x2ea7('0x67')]},'attributes':['id',_0x2ea7('0x29'),_0x2ea7('0x5d'),_0x2ea7('0x5e'),_0x2ea7('0x68')],'raw':!![]});}})[_0x2ea7('0x22')](function(_0x36b824){if(_0x36b824){fs[_0x2ea7('0x69')](path[_0x2ea7('0x4e')](_0x29cfd2[_0x2ea7('0x4d')],util[_0x2ea7('0x61')](_0x2ea7('0x62'),_0x36b824[_0x2ea7('0x29')],_0x36b824[_0x2ea7('0x5e')])));return _0x36b824;}})[_0x2ea7('0x48')](function(_0x421e28){throw new db[(_0x2ea7('0x58'))][(_0x2ea7('0x59'))](_0x421e28[_0x2ea7('0x5a')]);});})[_0x2ea7('0x22')](handleEntityNotFound(_0x4f747c,null))[_0x2ea7('0x22')](respondWithStatusCode(_0x4f747c,0xcc))[_0x2ea7('0x48')](handleError(_0x4f747c,null));};exports[_0x2ea7('0x6a')]=function(_0x256012,_0x3ea577,_0x14890b){var _0x588f5d={};var _0x5acf17={};var _0x68cc4e;var _0x4abcac;return db[_0x2ea7('0x2a')][_0x2ea7('0x5c')]({'where':{'id':_0x256012[_0x2ea7('0x42')]['id']}})[_0x2ea7('0x22')](handleEntityNotFound(_0x3ea577,null))[_0x2ea7('0x22')](function(_0x123009){if(_0x123009){_0x68cc4e=_0x123009;_0x5acf17[_0x2ea7('0x2c')]=_['keys'](db[_0x2ea7('0x6b')]['rawAttributes']);_0x5acf17[_0x2ea7('0x2e')]=_[_0x2ea7('0x2f')](_0x256012[_0x2ea7('0x2e')]);_0x5acf17[_0x2ea7('0x30')]=_['intersection'](_0x5acf17[_0x2ea7('0x2c')],_0x5acf17[_0x2ea7('0x2e')]);_0x588f5d['attributes']=_[_0x2ea7('0x31')](_0x5acf17[_0x2ea7('0x2c')],qs[_0x2ea7('0x32')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x32')]));_0x588f5d[_0x2ea7('0x33')]=_0x588f5d[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0x588f5d[_0x2ea7('0x33')]:_0x5acf17[_0x2ea7('0x2c')];_0x588f5d[_0x2ea7('0x6c')]=qs[_0x2ea7('0x37')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x37')]);_0x588f5d[_0x2ea7('0x38')]=qs[_0x2ea7('0x30')](_[_0x2ea7('0x39')](_0x256012['query'],_0x5acf17['filters']));if(_0x256012[_0x2ea7('0x2e')]['filter']){_0x588f5d[_0x2ea7('0x38')]=_[_0x2ea7('0x3b')](_0x588f5d[_0x2ea7('0x38')],{'$or':_[_0x2ea7('0x2d')](_0x588f5d[_0x2ea7('0x33')],function(_0x220540){var _0x10c4d1={};_0x10c4d1[_0x220540]={'$like':'%'+_0x256012['query'][_0x2ea7('0x3a')]+'%'};return _0x10c4d1;})});}_0x588f5d=_['merge']({},_0x588f5d,_0x256012[_0x2ea7('0x44')]);return _0x68cc4e[_0x2ea7('0x6a')](_0x588f5d);}})[_0x2ea7('0x22')](function(_0x49a14c){if(_0x49a14c){_0x4abcac=_0x49a14c[_0x2ea7('0x34')];if(!_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x35')](_0x2ea7('0x36'))){_0x588f5d[_0x2ea7('0x1c')]=qs[_0x2ea7('0x1c')](_0x256012['query']['limit']);_0x588f5d[_0x2ea7('0x1a')]=qs[_0x2ea7('0x1a')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x1a')]);}return _0x68cc4e[_0x2ea7('0x6a')](_0x588f5d);}})[_0x2ea7('0x22')](function(_0x1a39e7){if(_0x1a39e7){return _0x1a39e7?{'count':_0x4abcac,'rows':_0x1a39e7}:null;}})[_0x2ea7('0x22')](respondWithResult(_0x3ea577,null))['catch'](handleError(_0x3ea577,null));}; \ No newline at end of file +var _0x5b54=['hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','unlinkSync','Sequelize','ValidationError','message','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','findOne','id2','getSounds'];(function(_0x86d32e,_0x3a0bf1){var _0x50a35e=function(_0x414a12){while(--_0x414a12){_0x86d32e['push'](_0x86d32e['shift']());}};_0x50a35e(++_0x3a0bf1);}(_0x5b54,0x1c5));var _0x45b5=function(_0x5f203a,_0x15cb6f){_0x5f203a=_0x5f203a-0x0;var _0x226c9a=_0x5b54[_0x5f203a];return _0x226c9a;};'use strict';var emlformat=require(_0x45b5('0x0'));var rimraf=require(_0x45b5('0x1'));var zipdir=require(_0x45b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45b5('0x3'));var moment=require(_0x45b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45b5('0x5'));var util=require(_0x45b5('0x6'));var path=require(_0x45b5('0x7'));var sox=require(_0x45b5('0x8'));var csv=require(_0x45b5('0x9'));var ejs=require(_0x45b5('0xa'));var fs=require('fs');var fs_extra=require(_0x45b5('0xb'));var _=require(_0x45b5('0xc'));var squel=require(_0x45b5('0xd'));var crypto=require(_0x45b5('0xe'));var jsforce=require(_0x45b5('0xf'));var deskjs=require(_0x45b5('0x10'));var toCsv=require(_0x45b5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x45b5('0x11'));var authService=require(_0x45b5('0x12'));var qs=require(_0x45b5('0x13'));var as=require(_0x45b5('0x14'));var hardwareService=require(_0x45b5('0x15'));var logger=require(_0x45b5('0x16'))(_0x45b5('0x17'));var utils=require(_0x45b5('0x18'));var config=require(_0x45b5('0x19'));var licenseUtil=require(_0x45b5('0x1a'));var db=require(_0x45b5('0x1b'))['db'];function respondWithStatusCode(_0x5868f7,_0x395559){_0x395559=_0x395559||0xcc;return function(_0x592ebe){if(_0x592ebe){return _0x5868f7['sendStatus'](_0x395559);}return _0x5868f7[_0x45b5('0x1c')](_0x395559)[_0x45b5('0x1d')]();};}function respondWithResult(_0x395bf1,_0x59ad2c){_0x59ad2c=_0x59ad2c||0xc8;return function(_0x113de2){if(_0x113de2){return _0x395bf1[_0x45b5('0x1c')](_0x59ad2c)[_0x45b5('0x1e')](_0x113de2);}};}function respondWithFilteredResult(_0x5d433f,_0x161eaa){return function(_0x551b55){if(_0x551b55){var _0x160dac=typeof _0x161eaa[_0x45b5('0x1f')]===_0x45b5('0x20')&&typeof _0x161eaa['limit']===_0x45b5('0x20');var _0x40b36a=_0x551b55[_0x45b5('0x21')];var _0x46d283=_0x160dac?0x0:_0x161eaa[_0x45b5('0x1f')];var _0x53aeae=_0x160dac?_0x551b55[_0x45b5('0x21')]:_0x161eaa[_0x45b5('0x1f')]+_0x161eaa['limit'];var _0x3a7536;if(_0x53aeae>=_0x40b36a){_0x53aeae=_0x40b36a;_0x3a7536=0xc8;}else{_0x3a7536=0xce;}_0x5d433f[_0x45b5('0x1c')](_0x3a7536);return _0x5d433f[_0x45b5('0x22')](_0x45b5('0x23'),_0x46d283+'-'+_0x53aeae+'/'+_0x40b36a)[_0x45b5('0x1e')](_0x551b55);}return null;};}function patchUpdates(_0x542da4){return function(_0x20fe35){try{jsonpatch[_0x45b5('0x24')](_0x20fe35,_0x542da4,!![]);}catch(_0x49403d){return BPromise[_0x45b5('0x25')](_0x49403d);}return _0x20fe35[_0x45b5('0x26')]();};}function saveUpdates(_0x226223,_0x23730d){return function(_0x81297){if(_0x81297){return _0x81297[_0x45b5('0x27')](_0x226223)[_0x45b5('0x28')](function(_0x3ee9a5){return _0x3ee9a5;});}return null;};}function removeEntity(_0x89b458,_0x4f2962){return function(_0x13e452){if(_0x13e452){return _0x13e452[_0x45b5('0x29')]()[_0x45b5('0x28')](function(){var _0x92c350=_0x13e452['get']({'plain':!![]});var _0x30a1f3='MusicOnHolds';return db[_0x45b5('0x2a')]['destroy']({'where':{'type':_0x30a1f3,'resourceId':_0x92c350['id']}})['then'](function(){return _0x13e452;});})[_0x45b5('0x28')](function(){_0x89b458['status'](0xcc)[_0x45b5('0x1d')]();});}};}function handleEntityNotFound(_0x9d4cb8,_0x321184){return function(_0x5f50bd){if(!_0x5f50bd){_0x9d4cb8[_0x45b5('0x2b')](0x194);}return _0x5f50bd;};}function handleError(_0x4cce9b,_0x9aab89){_0x9aab89=_0x9aab89||0x1f4;return function(_0x3ddb50){logger['error'](_0x3ddb50[_0x45b5('0x2c')]);if(_0x3ddb50[_0x45b5('0x2d')]){delete _0x3ddb50[_0x45b5('0x2d')];}_0x4cce9b[_0x45b5('0x1c')](_0x9aab89)['send'](_0x3ddb50);};}exports['index']=function(_0x3f5238,_0xe46a9){var _0x488000={},_0x41d980={},_0x5a3c17={'count':0x0,'rows':[]};var _0x4056a3=_[_0x45b5('0x2e')](db[_0x45b5('0x2f')][_0x45b5('0x30')],function(_0x122ffb){return{'name':_0x122ffb[_0x45b5('0x31')],'type':_0x122ffb['type'][_0x45b5('0x32')]};});_0x41d980['model']=_[_0x45b5('0x2e')](_0x4056a3,_0x45b5('0x2d'));_0x41d980[_0x45b5('0x33')]=_[_0x45b5('0x34')](_0x3f5238['query']);_0x41d980[_0x45b5('0x35')]=_[_0x45b5('0x36')](_0x41d980[_0x45b5('0x37')],_0x41d980[_0x45b5('0x33')]);_0x488000['attributes']=_['intersection'](_0x41d980[_0x45b5('0x37')],qs[_0x45b5('0x38')](_0x3f5238[_0x45b5('0x33')][_0x45b5('0x38')]));_0x488000[_0x45b5('0x39')]=_0x488000['attributes'][_0x45b5('0x3a')]?_0x488000[_0x45b5('0x39')]:_0x41d980['model'];if(!_0x3f5238[_0x45b5('0x33')]['hasOwnProperty'](_0x45b5('0x3b'))){_0x488000['limit']=qs[_0x45b5('0x3c')](_0x3f5238[_0x45b5('0x33')]['limit']);_0x488000[_0x45b5('0x1f')]=qs[_0x45b5('0x1f')](_0x3f5238[_0x45b5('0x33')][_0x45b5('0x1f')]);}_0x488000[_0x45b5('0x3d')]=qs[_0x45b5('0x3e')](_0x3f5238[_0x45b5('0x33')][_0x45b5('0x3e')]);delete _0x3f5238[_0x45b5('0x33')][_0x45b5('0x3e')];_0x488000[_0x45b5('0x3f')]=qs[_0x45b5('0x35')](_['pick'](_0x3f5238['query'],_0x41d980['filters']),_0x4056a3);if(_0x3f5238[_0x45b5('0x33')][_0x45b5('0x40')]){_0x488000[_0x45b5('0x3f')]=_[_0x45b5('0x41')](_0x488000[_0x45b5('0x3f')],{'$or':_[_0x45b5('0x2e')](_0x4056a3,function(_0x5b23aa){if(_0x5b23aa[_0x45b5('0x42')]!=='VIRTUAL'){var _0x5932da={};_0x5932da[_0x5b23aa[_0x45b5('0x2d')]]={'$like':'%'+_0x3f5238[_0x45b5('0x33')][_0x45b5('0x40')]+'%'};return _0x5932da;}})});}_0x488000=_[_0x45b5('0x41')]({},_0x488000,_0x3f5238[_0x45b5('0x43')]);var _0xca141={'where':_0x488000[_0x45b5('0x3f')]};return db['VoiceMusicOnHold'][_0x45b5('0x21')](_0xca141)['then'](function(_0x452ff1){_0x5a3c17[_0x45b5('0x21')]=_0x452ff1;if(_0x3f5238['query'][_0x45b5('0x44')]){_0x488000[_0x45b5('0x45')]=[{'all':!![]}];}return db[_0x45b5('0x2f')][_0x45b5('0x46')](_0x488000);})[_0x45b5('0x28')](function(_0x48bac0){_0x5a3c17[_0x45b5('0x47')]=_0x48bac0;return _0x5a3c17;})[_0x45b5('0x28')](respondWithFilteredResult(_0xe46a9,_0x488000))[_0x45b5('0x48')](handleError(_0xe46a9,null));};exports[_0x45b5('0x49')]=function(_0x443ead,_0x55ac4b){var _0x4b5269={'raw':![],'where':{'id':_0x443ead[_0x45b5('0x4a')]['id']}},_0x38a07a={};_0x38a07a[_0x45b5('0x37')]=_[_0x45b5('0x34')](db[_0x45b5('0x2f')]['rawAttributes']);_0x38a07a['query']=_[_0x45b5('0x34')](_0x443ead[_0x45b5('0x33')]);_0x38a07a[_0x45b5('0x35')]=_[_0x45b5('0x36')](_0x38a07a[_0x45b5('0x37')],_0x38a07a['query']);_0x4b5269['attributes']=_['intersection'](_0x38a07a[_0x45b5('0x37')],qs['fields'](_0x443ead[_0x45b5('0x33')][_0x45b5('0x38')]));_0x4b5269[_0x45b5('0x39')]=_0x4b5269[_0x45b5('0x39')][_0x45b5('0x3a')]?_0x4b5269[_0x45b5('0x39')]:_0x38a07a[_0x45b5('0x37')];if(_0x443ead[_0x45b5('0x33')][_0x45b5('0x44')]){_0x4b5269[_0x45b5('0x45')]=[{'all':!![]}];}_0x4b5269=_[_0x45b5('0x41')]({},_0x4b5269,_0x443ead[_0x45b5('0x43')]);return db[_0x45b5('0x2f')][_0x45b5('0x4b')](_0x4b5269)['then'](handleEntityNotFound(_0x55ac4b,null))[_0x45b5('0x28')](respondWithResult(_0x55ac4b,null))['catch'](handleError(_0x55ac4b,null));};exports[_0x45b5('0x27')]=function(_0x5d40d1,_0x5ac9df){if(_0x5d40d1[_0x45b5('0x4c')]['id']){delete _0x5d40d1[_0x45b5('0x4c')]['id'];}return db[_0x45b5('0x2f')][_0x45b5('0x4b')]({'where':{'id':_0x5d40d1[_0x45b5('0x4a')]['id']}})[_0x45b5('0x28')](handleEntityNotFound(_0x5ac9df,null))[_0x45b5('0x28')](saveUpdates(_0x5d40d1[_0x45b5('0x4c')],null))[_0x45b5('0x28')](respondWithResult(_0x5ac9df,null))[_0x45b5('0x48')](handleError(_0x5ac9df,null));};exports[_0x45b5('0x4d')]=function(_0x384577,_0x4f7d86,_0x124944){return db['sequelize'][_0x45b5('0x4e')](function(_0x4aed7d){if(_0x384577[_0x45b5('0x4c')][_0x45b5('0x4f')]===_0x45b5('0x50')){_0x384577['body'][_0x45b5('0x51')]=path[_0x45b5('0x52')](config[_0x45b5('0x53')],_0x45b5('0x54'),_0x384577[_0x45b5('0x4c')][_0x45b5('0x2d')]);}return db[_0x45b5('0x2f')][_0x45b5('0x4d')](_0x384577[_0x45b5('0x4c')],{'transaction':_0x4aed7d})[_0x45b5('0x28')](function(_0x1cbee3){if(_0x384577[_0x45b5('0x4c')]['mode']===_0x45b5('0x50')){fs[_0x45b5('0x55')](_0x1cbee3['directory'],parseInt(_0x45b5('0x56'),0x8));}var _0xa23a8b=_0x384577[_0x45b5('0x57')][_0x45b5('0x58')]({'plain':!![]});if(!_0xa23a8b)throw new Error(_0x45b5('0x59'));if(_0xa23a8b['role']===_0x45b5('0x57')){var _0x1f4fa8=_0x1cbee3[_0x45b5('0x58')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x45b5('0x5a'),'userProfileId':_0xa23a8b[_0x45b5('0x5b')]},'raw':!![]})[_0x45b5('0x28')](function(_0x397693){if(_0x397693&&_0x397693[_0x45b5('0x5c')]===0x0){return db[_0x45b5('0x2a')][_0x45b5('0x4d')]({'name':_0x1f4fa8[_0x45b5('0x2d')],'resourceId':_0x1f4fa8['id'],'type':_0x397693[_0x45b5('0x2d')],'sectionId':_0x397693['id']},{})['then'](function(){return _0x1cbee3;});}else{return _0x1cbee3;}})[_0x45b5('0x48')](function(_0x28d0ee){logger['error'](_0x45b5('0x5d'),_0x28d0ee);});}return _0x1cbee3;});})['then'](respondWithResult(_0x4f7d86,0xc9))[_0x45b5('0x48')](handleError(_0x4f7d86,null));};exports['destroy']=function(_0x393e60,_0xd5234c,_0x14313c){var _0x2ec87c;return db[_0x45b5('0x2f')][_0x45b5('0x4b')]({'where':{'id':_0x393e60[_0x45b5('0x4a')]['id']}})[_0x45b5('0x28')](function(_0x2abfa1){if(_0x2abfa1){return db[_0x45b5('0x5e')]['transaction'](function(_0x138853){return _0x2abfa1[_0x45b5('0x29')]({'transaction':_0x138853,'raw':!![]})['then'](function(_0x2925b1){if(_0x2925b1[_0x45b5('0x51')]){fs['readdirSync'](_0x2925b1[_0x45b5('0x51')])['forEach'](function(_0xf65682){fs[_0x45b5('0x5f')](path[_0x45b5('0x52')](_0x2925b1['directory'],_0xf65682));});fs['rmdirSync'](_0x2925b1[_0x45b5('0x51')]);}return _0x2925b1;});})[_0x45b5('0x48')](function(_0x13eba7){throw new db[(_0x45b5('0x60'))][(_0x45b5('0x61'))](_0x13eba7[_0x45b5('0x62')]);});}})[_0x45b5('0x28')](handleEntityNotFound(_0xd5234c,null))[_0x45b5('0x28')](removeEntity(_0xd5234c,null))[_0x45b5('0x48')](handleError(_0xd5234c,null));};exports['addSound']=function(_0x2bdeb5,_0x1e4a72,_0x204f03){return db[_0x45b5('0x5e')][_0x45b5('0x4e')](function(_0x2bd222){var _0x1cfac8;return db[_0x45b5('0x2f')][_0x45b5('0x4b')]({'where':{'id':_0x2bdeb5['params']['id']}})[_0x45b5('0x28')](function(_0x2d79ee){if(_0x2d79ee){_0x1cfac8=_0x2d79ee;return _0x2d79ee['addSound'](_0x2bdeb5[_0x45b5('0x4c')]['id'],{'transaction':_0x2bd222});}})[_0x45b5('0x28')](function(_0x3a4340){if(_0x3a4340){return db[_0x45b5('0x63')]['findOne']({'where':{'id':_0x2bdeb5[_0x45b5('0x4c')]['id']},'attributes':['id',_0x45b5('0x2d'),_0x45b5('0x64'),_0x45b5('0x65'),_0x45b5('0x66')],'raw':!![]});}})[_0x45b5('0x28')](function(_0x17deb2){if(_0x17deb2){var _0x3a8520=path['join'](config[_0x45b5('0x53')],_0x45b5('0x67'),util[_0x45b5('0x68')](_0x45b5('0x69'),path[_0x45b5('0x6a')](_0x17deb2[_0x45b5('0x64')],path[_0x45b5('0x6b')](_0x17deb2[_0x45b5('0x64')])),_0x17deb2[_0x45b5('0x65')]));var _0xbf37ff=path[_0x45b5('0x52')](config[_0x45b5('0x53')],_0x45b5('0x54'),_0x1cfac8[_0x45b5('0x2d')],util['format'](_0x45b5('0x69'),_0x17deb2['name'],_0x17deb2[_0x45b5('0x65')]));fs['symlinkSync'](_0x3a8520,_0xbf37ff);return _0x17deb2;}})[_0x45b5('0x48')](function(_0x386679){throw new db[(_0x45b5('0x60'))][(_0x45b5('0x61'))](_0x386679['message']);});})[_0x45b5('0x28')](handleEntityNotFound(_0x1e4a72,null))[_0x45b5('0x28')](respondWithResult(_0x1e4a72,0xc9))[_0x45b5('0x48')](handleError(_0x1e4a72,null));};exports[_0x45b5('0x6c')]=function(_0x206fe5,_0x240746,_0x585d8e){return db[_0x45b5('0x5e')][_0x45b5('0x4e')](function(_0x174696){var _0x2dbe3d;return db[_0x45b5('0x2f')][_0x45b5('0x6d')]({'where':{'id':_0x206fe5[_0x45b5('0x4a')]['id']}})[_0x45b5('0x28')](handleEntityNotFound(_0x240746,null))[_0x45b5('0x28')](function(_0x326399){if(_0x326399){_0x2dbe3d=_0x326399;return _0x326399[_0x45b5('0x6c')](_0x206fe5[_0x45b5('0x4a')][_0x45b5('0x6e')]);}})['then'](function(_0x1a28d4){if(_0x1a28d4){return db[_0x45b5('0x63')]['findOne']({'where':{'id':_0x206fe5[_0x45b5('0x4a')][_0x45b5('0x6e')]},'attributes':['id',_0x45b5('0x2d'),_0x45b5('0x64'),_0x45b5('0x65'),_0x45b5('0x66')],'raw':!![]});}})['then'](function(_0x2bc3b4){if(_0x2bc3b4){fs[_0x45b5('0x5f')](path[_0x45b5('0x52')](_0x2dbe3d[_0x45b5('0x51')],util['format'](_0x45b5('0x69'),_0x2bc3b4[_0x45b5('0x2d')],_0x2bc3b4[_0x45b5('0x65')])));return _0x2bc3b4;}})[_0x45b5('0x48')](function(_0x26ea7d){throw new db[(_0x45b5('0x60'))]['ValidationError'](_0x26ea7d[_0x45b5('0x62')]);});})['then'](handleEntityNotFound(_0x240746,null))[_0x45b5('0x28')](respondWithStatusCode(_0x240746,0xcc))[_0x45b5('0x48')](handleError(_0x240746,null));};exports[_0x45b5('0x6f')]=function(_0x1d1957,_0x1aa5fb,_0x5ceee7){var _0x4d5eb9={};var _0x29216f={};var _0xa2edb6;var _0x2db461;return db[_0x45b5('0x2f')][_0x45b5('0x6d')]({'where':{'id':_0x1d1957[_0x45b5('0x4a')]['id']}})[_0x45b5('0x28')](handleEntityNotFound(_0x1aa5fb,null))['then'](function(_0xe5e0f7){if(_0xe5e0f7){_0xa2edb6=_0xe5e0f7;_0x29216f[_0x45b5('0x37')]=_[_0x45b5('0x34')](db[_0x45b5('0x63')][_0x45b5('0x30')]);_0x29216f[_0x45b5('0x33')]=_[_0x45b5('0x34')](_0x1d1957[_0x45b5('0x33')]);_0x29216f[_0x45b5('0x35')]=_[_0x45b5('0x36')](_0x29216f[_0x45b5('0x37')],_0x29216f['query']);_0x4d5eb9[_0x45b5('0x39')]=_[_0x45b5('0x36')](_0x29216f['model'],qs[_0x45b5('0x38')](_0x1d1957[_0x45b5('0x33')][_0x45b5('0x38')]));_0x4d5eb9[_0x45b5('0x39')]=_0x4d5eb9[_0x45b5('0x39')][_0x45b5('0x3a')]?_0x4d5eb9[_0x45b5('0x39')]:_0x29216f[_0x45b5('0x37')];_0x4d5eb9['order']=qs[_0x45b5('0x3e')](_0x1d1957[_0x45b5('0x33')][_0x45b5('0x3e')]);_0x4d5eb9['where']=qs['filters'](_['pick'](_0x1d1957[_0x45b5('0x33')],_0x29216f[_0x45b5('0x35')]));if(_0x1d1957['query']['filter']){_0x4d5eb9[_0x45b5('0x3f')]=_[_0x45b5('0x41')](_0x4d5eb9['where'],{'$or':_['map'](_0x4d5eb9[_0x45b5('0x39')],function(_0x27abd4){var _0x167ac9={};_0x167ac9[_0x27abd4]={'$like':'%'+_0x1d1957[_0x45b5('0x33')]['filter']+'%'};return _0x167ac9;})});}_0x4d5eb9=_[_0x45b5('0x41')]({},_0x4d5eb9,_0x1d1957['options']);return _0xa2edb6[_0x45b5('0x6f')](_0x4d5eb9);}})[_0x45b5('0x28')](function(_0xe5ec56){if(_0xe5ec56){_0x2db461=_0xe5ec56[_0x45b5('0x3a')];if(!_0x1d1957['query'][_0x45b5('0x70')](_0x45b5('0x3b'))){_0x4d5eb9['limit']=qs[_0x45b5('0x3c')](_0x1d1957['query'][_0x45b5('0x3c')]);_0x4d5eb9['offset']=qs[_0x45b5('0x1f')](_0x1d1957['query'][_0x45b5('0x1f')]);}return _0xa2edb6['getSounds'](_0x4d5eb9);}})[_0x45b5('0x28')](function(_0x1ed21e){if(_0x1ed21e){return _0x1ed21e?{'count':_0x2db461,'rows':_0x1ed21e}:null;}})[_0x45b5('0x28')](respondWithResult(_0x1aa5fb,null))[_0x45b5('0x48')](handleError(_0x1aa5fb,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d2e5f3b..fd0f77c 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 _0xc7d1=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util'];(function(_0x21ad96,_0x351509){var _0xa41e65=function(_0x17be59){while(--_0x17be59){_0x21ad96['push'](_0x21ad96['shift']());}};_0xa41e65(++_0x351509);}(_0xc7d1,0x1b6));var _0x1c7d=function(_0x23c825,_0x400749){_0x23c825=_0x23c825-0x0;var _0x51a6d7=_0xc7d1[_0x23c825];return _0x51a6d7;};'use strict';var _=require(_0x1c7d('0x0'));var util=require(_0x1c7d('0x1'));var logger=require(_0x1c7d('0x2'))(_0x1c7d('0x3'));var moment=require(_0x1c7d('0x4'));var BPromise=require(_0x1c7d('0x5'));var rp=require(_0x1c7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c7d('0x7'));var attributes=require(_0x1c7d('0x8'));module['exports']=function(_0x8f3f74,_0xe9cc11){return _0x8f3f74[_0x1c7d('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x1c7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25a5=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4b8f58,_0x2443ad){var _0x34802a=function(_0x424f14){while(--_0x424f14){_0x4b8f58['push'](_0x4b8f58['shift']());}};_0x34802a(++_0x2443ad);}(_0x25a5,0xda));var _0x525a=function(_0x41961b,_0x177e28){_0x41961b=_0x41961b-0x0;var _0x3ae345=_0x25a5[_0x41961b];return _0x3ae345;};'use strict';var _=require(_0x525a('0x0'));var util=require(_0x525a('0x1'));var logger=require(_0x525a('0x2'))(_0x525a('0x3'));var moment=require(_0x525a('0x4'));var BPromise=require(_0x525a('0x5'));var rp=require(_0x525a('0x6'));var fs=require('fs');var path=require(_0x525a('0x7'));var rimraf=require(_0x525a('0x8'));var config=require(_0x525a('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x525a('0xa')]=function(_0x34f775,_0x160a94){return _0x34f775[_0x525a('0xb')](_0x525a('0xc'),attributes,{'tableName':_0x525a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 7a399b1..41a9d83 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d88da,_0x50d5d6){var _0x234c06=function(_0x1f1181){while(--_0x1f1181){_0x5d88da['push'](_0x5d88da['shift']());}};_0x234c06(++_0x50d5d6);}(_0xe706,0xa3));var _0x6e70=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xe706[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x232033,_0x3f8534){var _0x2d496d=function(_0x64145e){while(--_0x64145e){_0x232033['push'](_0x232033['shift']());}};_0x2d496d(++_0x3f8534);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4cde511..365c5bd 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 _0xfb92=['/:id','update','destroy','removeAgents','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','post','create','addAgents','/:id/teams','addTeams','put'];(function(_0x4cb23e,_0x588d15){var _0x54184a=function(_0x5bd568){while(--_0x5bd568){_0x4cb23e['push'](_0x4cb23e['shift']());}};_0x54184a(++_0x588d15);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x5e854c,_0x59f76a){_0x5e854c=_0x5e854c-0x0;var _0x54c6b8=_0xfb92[_0x5e854c];return _0x54c6b8;};'use strict';var multer=require(_0x2fb9('0x0'));var util=require('util');var path=require(_0x2fb9('0x1'));var timeout=require(_0x2fb9('0x2'));var express=require(_0x2fb9('0x3'));var router=express[_0x2fb9('0x4')]();var fs_extra=require(_0x2fb9('0x5'));var auth=require(_0x2fb9('0x6'));var interaction=require(_0x2fb9('0x7'));var config=require(_0x2fb9('0x8'));var controller=require(_0x2fb9('0x9'));router[_0x2fb9('0xa')]('/',auth[_0x2fb9('0xb')](),controller['index']);router['get']('/describe',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0xc')]);router[_0x2fb9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0xd')]);router[_0x2fb9('0xa')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller['getAgents']);router[_0x2fb9('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2fb9('0xf')]('/',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x10')]);router[_0x2fb9('0xf')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x11')]);router[_0x2fb9('0xf')](_0x2fb9('0x12'),auth['isAuthenticated'](),controller[_0x2fb9('0x13')]);router[_0x2fb9('0x14')](_0x2fb9('0x15'),auth['isAuthenticated'](),controller[_0x2fb9('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2fb9('0x18')]);router[_0x2fb9('0x19')](_0x2fb9('0x12'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x1a')]);module[_0x2fb9('0x1b')]=router; \ No newline at end of file +var _0x7250=['create','post','addAgents','put','update','delete','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','index','/describe','isAuthenticated','get','/:id','show','/:id/users','/:id/teams'];(function(_0x58c882,_0x487257){var _0x145f90=function(_0x2978a8){while(--_0x2978a8){_0x58c882['push'](_0x58c882['shift']());}};_0x145f90(++_0x487257);}(_0x7250,0x1b1));var _0x0725=function(_0x2f2a97,_0x18246a){_0x2f2a97=_0x2f2a97-0x0;var _0x172685=_0x7250[_0x2f2a97];return _0x172685;};'use strict';var multer=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var path=require('path');var timeout=require(_0x0725('0x2'));var express=require(_0x0725('0x3'));var router=express[_0x0725('0x4')]();var fs_extra=require(_0x0725('0x5'));var auth=require(_0x0725('0x6'));var interaction=require(_0x0725('0x7'));var config=require('../../config/environment');var controller=require(_0x0725('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0725('0x9')]);router['get'](_0x0725('0xa'),auth[_0x0725('0xb')](),controller['describe']);router[_0x0725('0xc')](_0x0725('0xd'),auth[_0x0725('0xb')](),controller[_0x0725('0xe')]);router[_0x0725('0xc')](_0x0725('0xf'),auth[_0x0725('0xb')](),controller['getAgents']);router[_0x0725('0xc')](_0x0725('0x10'),auth[_0x0725('0xb')](),controller['getTeams']);router['post']('/',auth[_0x0725('0xb')](),controller[_0x0725('0x11')]);router[_0x0725('0x12')](_0x0725('0xf'),auth[_0x0725('0xb')](),controller[_0x0725('0x13')]);router[_0x0725('0x12')](_0x0725('0x10'),auth[_0x0725('0xb')](),controller['addTeams']);router[_0x0725('0x14')](_0x0725('0xd'),auth[_0x0725('0xb')](),controller[_0x0725('0x15')]);router[_0x0725('0x16')](_0x0725('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x0725('0x16')]('/:id/users',auth[_0x0725('0xb')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0x0725('0xb')](),controller[_0x0725('0x17')]);module[_0x0725('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 ce4d1d3..5a0c657 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 _0x4b75=['STRING','INTEGER','sequelize','name','VIRTUAL','system-','getDataValue'];(function(_0x1315df,_0xff128c){var _0x4ecda5=function(_0x33adc1){while(--_0x33adc1){_0x1315df['push'](_0x1315df['shift']());}};_0x4ecda5(++_0xff128c);}(_0x4b75,0xa3));var _0x54b7=function(_0x3a911f,_0x324db1){_0x3a911f=_0x3a911f-0x0;var _0x279f5d=_0x4b75[_0x3a911f];return _0x279f5d;};'use strict';var Sequelize=require(_0x54b7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54b7('0x1')},'prefix':{'type':Sequelize[_0x54b7('0x2')],'get':function(_0x1d337f){return _0x54b7('0x3')+this[_0x54b7('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x54b7('0x5')]},'callerIdAll':{'type':Sequelize[_0x54b7('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x54b7('0x6')]}}; \ No newline at end of file +var _0x7ad7=['INTEGER','sequelize','name','VIRTUAL','system-','getDataValue','STRING'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x7ad7,0x17b));var _0x77ad=function(_0x260ef9,_0x8794da){_0x260ef9=_0x260ef9-0x0;var _0x5699ff=_0x7ad7[_0x260ef9];return _0x5699ff;};'use strict';var Sequelize=require(_0x77ad('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77ad('0x1')},'prefix':{'type':Sequelize[_0x77ad('0x2')],'get':function(_0x15f658){return _0x77ad('0x3')+this[_0x77ad('0x4')](_0x77ad('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x77ad('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x77ad('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5e56c33..9e9ce21 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb4=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','filters','filter','where','merge','VoicePrefix','catch','show','params','include','find','describe','sequelize','transaction','create','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','body','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','sort','pick','hasOwnProperty','getTeams','Team','options','addTeams','findAll','Agents','online','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index'];(function(_0x1fcbf6,_0x1aee59){var _0x4244ce=function(_0x5eac5f){while(--_0x5eac5f){_0x1fcbf6['push'](_0x1fcbf6['shift']());}};_0x4244ce(++_0x1aee59);}(_0x6cb4,0xff));var _0x46cb=function(_0x41fab1,_0x39ec37){_0x41fab1=_0x41fab1-0x0;var _0x170e2d=_0x6cb4[_0x41fab1];return _0x170e2d;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];config[_0x46cb('0x18')]=_[_0x46cb('0x19')](config[_0x46cb('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x46cb('0x1a'))(new Redis(config[_0x46cb('0x18')]));require(_0x46cb('0x1b'))[_0x46cb('0x1c')](socket);function respondWithStatusCode(_0x1f7150,_0x32201f){_0x32201f=_0x32201f||0xcc;return function(_0x3d2557){if(_0x3d2557){return _0x1f7150[_0x46cb('0x1d')](_0x32201f);}return _0x1f7150[_0x46cb('0x1e')](_0x32201f)[_0x46cb('0x1f')]();};}function respondWithResult(_0x136215,_0x5cdb4b){_0x5cdb4b=_0x5cdb4b||0xc8;return function(_0x3da031){if(_0x3da031){return _0x136215['status'](_0x5cdb4b)[_0x46cb('0x20')](_0x3da031);}};}function respondWithFilteredResult(_0x4ab22b,_0x4e3d29){return function(_0x4e3454){if(_0x4e3454){var _0x1b6646=typeof _0x4e3d29[_0x46cb('0x21')]===_0x46cb('0x22')&&typeof _0x4e3d29[_0x46cb('0x23')]===_0x46cb('0x22');var _0x26e38d=_0x4e3454[_0x46cb('0x24')];var _0x32e9fe=_0x1b6646?0x0:_0x4e3d29[_0x46cb('0x21')];var _0xfc9064=_0x1b6646?_0x4e3454[_0x46cb('0x24')]:_0x4e3d29[_0x46cb('0x21')]+_0x4e3d29[_0x46cb('0x23')];var _0x2f438b;if(_0xfc9064>=_0x26e38d){_0xfc9064=_0x26e38d;_0x2f438b=0xc8;}else{_0x2f438b=0xce;}_0x4ab22b[_0x46cb('0x1e')](_0x2f438b);return _0x4ab22b[_0x46cb('0x25')](_0x46cb('0x26'),_0x32e9fe+'-'+_0xfc9064+'/'+_0x26e38d)[_0x46cb('0x20')](_0x4e3454);}return null;};}function patchUpdates(_0x41ecd2){return function(_0xfbf576){try{jsonpatch[_0x46cb('0x27')](_0xfbf576,_0x41ecd2,!![]);}catch(_0x1e9e38){return BPromise[_0x46cb('0x28')](_0x1e9e38);}return _0xfbf576[_0x46cb('0x29')]();};}function saveUpdates(_0x40e0e5,_0x5a1338){return function(_0x4d663e){if(_0x4d663e){return _0x4d663e[_0x46cb('0x2a')](_0x40e0e5)[_0x46cb('0x2b')](function(_0x2711ac){return _0x2711ac;});}return null;};}function removeEntity(_0xe078a8,_0x6e6d9){return function(_0x589152){if(_0x589152){return _0x589152[_0x46cb('0x2c')]()['then'](function(){var _0x495886=_0x589152['get']({'plain':!![]});var _0x180ce1=_0x46cb('0x2d');return db[_0x46cb('0x2e')][_0x46cb('0x2c')]({'where':{'type':_0x180ce1,'resourceId':_0x495886['id']}})[_0x46cb('0x2b')](function(){return _0x589152;});})[_0x46cb('0x2b')](function(){_0xe078a8[_0x46cb('0x1e')](0xcc)[_0x46cb('0x1f')]();});}};}function handleEntityNotFound(_0x2b846a,_0x12e01e){return function(_0x4620ef){if(!_0x4620ef){_0x2b846a['sendStatus'](0x194);}return _0x4620ef;};}function handleError(_0x1ce88f,_0xf3d376){_0xf3d376=_0xf3d376||0x1f4;return function(_0x4c73bd){logger['error'](_0x4c73bd[_0x46cb('0x2f')]);if(_0x4c73bd['name']){delete _0x4c73bd[_0x46cb('0x30')];}_0x1ce88f[_0x46cb('0x1e')](_0xf3d376)[_0x46cb('0x31')](_0x4c73bd);};}exports[_0x46cb('0x32')]=function(_0x9b9d03,_0x33c248){var _0x5dc551={},_0x2e2d36={},_0x49ffc5={'count':0x0,'rows':[]};var _0x2661d6=_[_0x46cb('0x33')](db['VoicePrefix'][_0x46cb('0x34')],function(_0x3f0eb4){return{'name':_0x3f0eb4[_0x46cb('0x35')],'type':_0x3f0eb4[_0x46cb('0x36')][_0x46cb('0x37')]};});_0x2e2d36['model']=_[_0x46cb('0x33')](_0x2661d6,'name');_0x2e2d36[_0x46cb('0x38')]=_[_0x46cb('0x39')](_0x9b9d03[_0x46cb('0x38')]);_0x2e2d36['filters']=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],_0x2e2d36['query']);_0x5dc551[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x3d')]));_0x5dc551[_0x46cb('0x3c')]=_0x5dc551[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0x5dc551[_0x46cb('0x3c')]:_0x2e2d36[_0x46cb('0x3b')];if(!_0x9b9d03['query']['hasOwnProperty']('nolimit')){_0x5dc551[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5dc551[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x9b9d03['query'][_0x46cb('0x21')]);}_0x5dc551['order']=qs['sort'](_0x9b9d03[_0x46cb('0x38')]['sort']);_0x5dc551['where']=qs[_0x46cb('0x3f')](_['pick'](_0x9b9d03['query'],_0x2e2d36[_0x46cb('0x3f')]),_0x2661d6);if(_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5dc551[_0x46cb('0x41')]=_[_0x46cb('0x42')](_0x5dc551[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x2661d6,function(_0x56efa8){if(_0x56efa8[_0x46cb('0x36')]!=='VIRTUAL'){var _0x391a6b={};_0x391a6b[_0x56efa8['name']]={'$like':'%'+_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]+'%'};return _0x391a6b;}})});}_0x5dc551=_[_0x46cb('0x42')]({},_0x5dc551,_0x9b9d03['options']);var _0x43b5d2={'where':_0x5dc551[_0x46cb('0x41')]};return db['VoicePrefix'][_0x46cb('0x24')](_0x43b5d2)[_0x46cb('0x2b')](function(_0x1f67af){_0x49ffc5[_0x46cb('0x24')]=_0x1f67af;if(_0x9b9d03[_0x46cb('0x38')]['includeAll']){_0x5dc551['include']=[{'all':!![]}];}return db[_0x46cb('0x43')]['findAll'](_0x5dc551);})[_0x46cb('0x2b')](function(_0x41f76c){_0x49ffc5['rows']=_0x41f76c;return _0x49ffc5;})[_0x46cb('0x2b')](respondWithFilteredResult(_0x33c248,_0x5dc551))[_0x46cb('0x44')](handleError(_0x33c248,null));};exports[_0x46cb('0x45')]=function(_0x5d94db,_0x4f957b){var _0x5cbdad={'raw':![],'where':{'id':_0x5d94db[_0x46cb('0x46')]['id']}},_0x57fedd={};_0x57fedd[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x43')][_0x46cb('0x34')]);_0x57fedd['query']=_['keys'](_0x5d94db[_0x46cb('0x38')]);_0x57fedd[_0x46cb('0x3f')]=_['intersection'](_0x57fedd[_0x46cb('0x3b')],_0x57fedd[_0x46cb('0x38')]);_0x5cbdad[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x57fedd[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x5d94db[_0x46cb('0x38')]['fields']));_0x5cbdad['attributes']=_0x5cbdad[_0x46cb('0x3c')]['length']?_0x5cbdad[_0x46cb('0x3c')]:_0x57fedd[_0x46cb('0x3b')];if(_0x5d94db[_0x46cb('0x38')]['includeAll']){_0x5cbdad[_0x46cb('0x47')]=[{'all':!![]}];}_0x5cbdad=_['merge']({},_0x5cbdad,_0x5d94db['options']);return db[_0x46cb('0x43')][_0x46cb('0x48')](_0x5cbdad)[_0x46cb('0x2b')](handleEntityNotFound(_0x4f957b,null))[_0x46cb('0x2b')](respondWithResult(_0x4f957b,null))[_0x46cb('0x44')](handleError(_0x4f957b,null));};exports[_0x46cb('0x2c')]=function(_0xb75519,_0x58887b){return db['VoicePrefix'][_0x46cb('0x48')]({'where':{'id':_0xb75519[_0x46cb('0x46')]['id']}})['then'](handleEntityNotFound(_0x58887b,null))[_0x46cb('0x2b')](removeEntity(_0x58887b,null))[_0x46cb('0x44')](handleError(_0x58887b,null));};exports[_0x46cb('0x49')]=function(_0x3b8ae1,_0x2bef6f){return db['VoicePrefix'][_0x46cb('0x49')]()[_0x46cb('0x2b')](respondWithResult(_0x2bef6f,null))[_0x46cb('0x44')](handleError(_0x2bef6f,null));};exports['create']=function(_0x1f5c71,_0x56ad38){var _0x48b994;return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x2fe0b1){return db[_0x46cb('0x43')][_0x46cb('0x4c')](_0x1f5c71['body'],{'transaction':_0x2fe0b1})[_0x46cb('0x2b')](function(_0xd51a75){_0x48b994=_0xd51a75['get']({'plain':!![]});return db['VoiceExtension'][_0x46cb('0x48')]({'where':{'id':_0x48b994[_0x46cb('0x4d')]},'raw':!![]})[_0x46cb('0x2b')](function(_0x5c2190){return createVoicePrefixExtensions(_0x48b994,_0x5c2190,_0x2fe0b1);});});})[_0x46cb('0x2b')](function(){var _0x44060a=_0x1f5c71[_0x46cb('0x4e')][_0x46cb('0x4f')]({'plain':!![]});if(!_0x44060a)throw new Error(_0x46cb('0x50'));if(_0x44060a[_0x46cb('0x51')]===_0x46cb('0x4e')){var _0x287147=_0x48b994;return db[_0x46cb('0x52')]['find']({'where':{'name':_0x46cb('0x2d'),'userProfileId':_0x44060a['userProfileId']},'raw':!![]})[_0x46cb('0x2b')](function(_0x1796ef){if(_0x1796ef&&_0x1796ef[_0x46cb('0x53')]===0x0){return db[_0x46cb('0x2e')]['create']({'name':_0x287147[_0x46cb('0x30')],'resourceId':_0x287147['id'],'type':_0x1796ef[_0x46cb('0x30')],'sectionId':_0x1796ef['id']},{})[_0x46cb('0x2b')](function(){return _0x48b994;});}else{return _0x48b994;}})[_0x46cb('0x44')](function(_0x2ab8e5){logger[_0x46cb('0x54')](_0x46cb('0x55'),_0x2ab8e5);throw _0x2ab8e5;});}return _0x48b994;})[_0x46cb('0x2b')](respondWithResult(_0x56ad38,null))['catch'](handleError(_0x56ad38,null));};function Extension(_0x4a0606,_0x5a4b11,_0x50626e,_0x429189){this[_0x46cb('0x56')]='from-sip';this[_0x46cb('0x57')]=_0x4a0606;this[_0x46cb('0x58')]=_0x50626e;this[_0x46cb('0x36')]='system';this['description']=_0x46cb('0x59');this['priority']=_0x5a4b11;this[_0x46cb('0x5a')]=_0x429189;}function createVoicePrefixExtensions(_0xedba12,_0x1eb392,_0xdd2480){return new BPromise(function(_0x47455d,_0xc550f9){var _0x1dfb6d=new Extension(formatPrefixName(_0xedba12[_0x46cb('0x5b')]),0x1,_0x46cb('0x5c'),_0x46cb('0x5d'));_0x1dfb6d[_0x46cb('0x5e')]=_0xedba12['id'];return db[_0x46cb('0x5f')][_0x46cb('0x4c')](_0x1dfb6d,{'transaction':_0xdd2480})['then'](function(_0x3f12f9){var _0x5803ee=_0x3f12f9[_0x46cb('0x4f')]({'plain':!![]});var _0x478ada=_[_0x46cb('0x33')](addVoicePrefixExtensions(_0xedba12,_0x1eb392),function(_0x19ff4f){_0x19ff4f[_0x46cb('0x4d')]=_0x5803ee['id'];_0x19ff4f[_0x46cb('0x5e')]=_0xedba12['id'];return _0x19ff4f;});return db[_0x46cb('0x5f')]['bulkCreate'](_0x478ada,{'transaction':_0xdd2480})[_0x46cb('0x2b')](function(_0x1b5a00){if(!_0x1b5a00){return _0xc550f9(_0x46cb('0x60'));}else{return _0x47455d(_0x1b5a00);}})[_0x46cb('0x44')](function(_0x4f65f9){return _0xc550f9(_0x4f65f9);});});;});};function addVoicePrefixExtensions(_0x11184e,_0x3ace61){var _0x6dc790=[];var _0x1b810a=formatPrefixName(_0x11184e[_0x46cb('0x5b')]);_0x6dc790['push'](new Extension(_0x1b810a,0x2,_0x46cb('0x61'),_0x46cb('0x62')+_0x11184e[_0x46cb('0x30')]));if(_0x11184e[_0x46cb('0x63')]){_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x3,_0x46cb('0x61'),_0x46cb('0x65')+_0x11184e[_0x46cb('0x63')]));}else{_0x6dc790['push'](new Extension(_0x1b810a,0x3,'NoOp','No\x20callerid\x20available'));}_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x4,_0x46cb('0x66'),_0x3ace61[_0x46cb('0x56')]+','+_0x46cb('0x67')+(0x8+_0x11184e[_0x46cb('0x30')][_0x46cb('0x3e')])+'}'+','+0x1));return _0x6dc790;}function formatPrefixName(_0x199e45){var _0x257d92='_';for(var _0x1bb26b=0x0;_0x1bb26b<_0x199e45[_0x46cb('0x3e')];_0x1bb26b++){if(_0x199e45[_0x46cb('0x68')](_0x1bb26b)=='-'){_0x257d92+=_0x199e45[_0x46cb('0x68')](_0x1bb26b);}else{_0x257d92+='['+_0x199e45[_0x46cb('0x68')](_0x1bb26b)+']';}}_0x257d92+='.';return _0x257d92;}exports[_0x46cb('0x2a')]=function(_0x5c9f3c,_0x2e23e4,_0x5ab62f){var _0x42e9de=_0x5c9f3c['body'];_0x42e9de[_0x46cb('0x5b')]=_0x46cb('0x69')+_0x42e9de[_0x46cb('0x30')]+'-';return db[_0x46cb('0x4a')]['transaction'](function(_0xa7d3ab){return db[_0x46cb('0x43')]['update'](_0x42e9de,{'where':{'id':_0x42e9de['id']},'transaction':_0xa7d3ab})['then'](function(){return db[_0x46cb('0x5f')][_0x46cb('0x2c')]({'where':{'VoicePrefixId':_0x42e9de['id']},'transaction':_0xa7d3ab})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x5f')][_0x46cb('0x48')]({'where':{'id':_0x42e9de['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b427b){return createVoicePrefixExtensions(_0x42e9de,_0x4b427b,_0xa7d3ab);});});});})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x43')][_0x46cb('0x6a')](_0x42e9de['id']);})[_0x46cb('0x2b')](respondWithResult(_0x2e23e4,null))[_0x46cb('0x44')](handleError(_0x2e23e4,null));};exports[_0x46cb('0x6b')]=function(_0x218663,_0x145b3d,_0xd9f049){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x218663['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x145b3d,null))[_0x46cb('0x2b')](function(_0x84534){if(_0x84534){return _0x84534[_0x46cb('0x6b')](_0x218663['body'][_0x46cb('0x6c')],_[_0x46cb('0x6d')](_0x218663[_0x46cb('0x6e')],[_0x46cb('0x6c'),'id'])||{})['spread'](function(_0x2f87ed){for(var _0x19d6a8=0x0;_0x19d6a8<_0x218663[_0x46cb('0x6e')][_0x46cb('0x6c')]['length'];_0x19d6a8+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x218663[_0x46cb('0x6e')]['ids'][_0x19d6a8]),'VoicePrefixId':Number(_0x218663[_0x46cb('0x46')]['id'])});}return _0x2f87ed;});}})['then'](respondWithResult(_0x145b3d,null))[_0x46cb('0x44')](handleError(_0x145b3d,null));};exports[_0x46cb('0x6f')]=function(_0x29566a,_0x323db7,_0x57256a){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x29566a[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x323db7,null))['then'](function(_0x555efa){if(_0x555efa){return _0x555efa[_0x46cb('0x6f')](_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')])[_0x46cb('0x2b')](function(){if(_[_0x46cb('0x70')](_0x29566a[_0x46cb('0x38')]['ids'])){for(var _0x53f307=0x0;_0x53f307<_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')]['length'];_0x53f307+=0x1){socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')][_0x53f307]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}}else{socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a['query'][_0x46cb('0x6c')]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x323db7,null))[_0x46cb('0x44')](handleError(_0x323db7,null));};exports[_0x46cb('0x73')]=function(_0x11003d,_0x465296,_0x3e4cec){var _0x5567cc={};var _0x51315a={};var _0x3cb612;var _0xbe8e16;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x11003d['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x465296,null))['then'](function(_0x52afba){if(_0x52afba){_0x3cb612=_0x52afba;_0x51315a[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x75')][_0x46cb('0x34')]);_0x51315a['query']=_[_0x46cb('0x39')](_0x11003d['query']);_0x51315a[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x51315a[_0x46cb('0x3b')],_0x51315a[_0x46cb('0x38')]);_0x5567cc[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x51315a['model'],qs['fields'](_0x11003d[_0x46cb('0x38')]['fields']));_0x5567cc[_0x46cb('0x3c')]=_0x5567cc['attributes'][_0x46cb('0x3e')]?_0x5567cc[_0x46cb('0x3c')]:_0x51315a[_0x46cb('0x3b')];_0x5567cc['order']=qs[_0x46cb('0x76')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x76')]);_0x5567cc[_0x46cb('0x41')]=qs[_0x46cb('0x3f')](_[_0x46cb('0x77')](_0x11003d[_0x46cb('0x38')],_0x51315a[_0x46cb('0x3f')]));if(_0x11003d[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5567cc['where']=_['merge'](_0x5567cc[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x5567cc['attributes'],function(_0x191c9b){var _0x4a529b={};_0x4a529b[_0x191c9b]={'$like':'%'+_0x11003d['query'][_0x46cb('0x40')]+'%'};return _0x4a529b;})});}_0x5567cc=_[_0x46cb('0x42')]({},_0x5567cc,_0x11003d['options']);return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x1e7f26){if(_0x1e7f26){_0xbe8e16=_0x1e7f26[_0x46cb('0x3e')];if(!_0x11003d[_0x46cb('0x38')][_0x46cb('0x78')]('nolimit')){_0x5567cc[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5567cc[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x11003d[_0x46cb('0x38')]['offset']);}return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x3ffe97){if(_0x3ffe97){return _0x3ffe97?{'count':_0xbe8e16,'rows':_0x3ffe97}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x465296,null))[_0x46cb('0x44')](handleError(_0x465296,null));};exports[_0x46cb('0x79')]=function(_0x3715c6,_0x500896,_0x4c8666){var _0xf82b6d={};var _0x36cc75={};var _0x2ef7d8;var _0x99a2b1;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x3715c6[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x500896,null))['then'](function(_0x33e6aa){if(_0x33e6aa){_0x2ef7d8=_0x33e6aa;_0x36cc75[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x7a')][_0x46cb('0x34')]);_0x36cc75['query']=_['keys'](_0x3715c6[_0x46cb('0x38')]);_0x36cc75[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x36cc75['model'],_0x36cc75['query']);_0xf82b6d[_0x46cb('0x3c')]=_['intersection'](_0x36cc75[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x3715c6['query'][_0x46cb('0x3d')]));_0xf82b6d[_0x46cb('0x3c')]=_0xf82b6d[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0xf82b6d[_0x46cb('0x3c')]:_0x36cc75[_0x46cb('0x3b')];_0xf82b6d['order']=qs['sort'](_0x3715c6['query'][_0x46cb('0x76')]);_0xf82b6d[_0x46cb('0x41')]=qs['filters'](_[_0x46cb('0x77')](_0x3715c6['query'],_0x36cc75[_0x46cb('0x3f')]));if(_0x3715c6[_0x46cb('0x38')][_0x46cb('0x40')]){_0xf82b6d[_0x46cb('0x41')]=_['merge'](_0xf82b6d[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0xf82b6d[_0x46cb('0x3c')],function(_0x3e37e3){var _0x2ea71c={};_0x2ea71c[_0x3e37e3]={'$like':'%'+_0x3715c6[_0x46cb('0x38')]['filter']+'%'};return _0x2ea71c;})});}_0xf82b6d=_['merge']({},_0xf82b6d,_0x3715c6[_0x46cb('0x7b')]);return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})['then'](function(_0x5d1366){if(_0x5d1366){_0x99a2b1=_0x5d1366[_0x46cb('0x3e')];if(!_0x3715c6['query'][_0x46cb('0x78')]('nolimit')){_0xf82b6d[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x3715c6['query']['limit']);_0xf82b6d[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x3715c6[_0x46cb('0x38')]['offset']);}return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})[_0x46cb('0x2b')](function(_0x4f1805){if(_0x4f1805){return _0x4f1805?{'count':_0x99a2b1,'rows':_0x4f1805}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x500896,null))[_0x46cb('0x44')](handleError(_0x500896,null));};exports[_0x46cb('0x7c')]=function(_0x43abb4,_0x194dc8,_0x217e65){var _0x45dc8e=_0x43abb4['body'][_0x46cb('0x6c')];var _0x4b233d;return db[_0x46cb('0x7a')][_0x46cb('0x7d')]({'where':{'id':_0x45dc8e},'attributes':['id'],'include':[{'model':db[_0x46cb('0x75')],'as':_0x46cb('0x7e'),'attributes':['id',_0x46cb('0x30'),_0x46cb('0x7f'),'voicePause',_0x46cb('0x80')],'raw':!![]}]})[_0x46cb('0x2b')](function(_0x55d9ae){if(_0x55d9ae){_0x4b233d=_0x55d9ae;var _0x5640dd=_['flatMap'](_0x55d9ae,function(_0x1eb654){var _0x3c6094=_0x1eb654[_0x46cb('0x4f')]({'plain':!![]});return _0x3c6094[_0x46cb('0x7e')];});return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x43abb4[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x349f95){return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x1b5624){return _0x349f95[_0x46cb('0x7c')](_0x45dc8e,{'transaction':_0x1b5624})[_0x46cb('0x2b')](function(){return BPromise[_0x46cb('0x81')](_0x4b233d,function(_0xf2766f){return db[_0x46cb('0x82')][_0x46cb('0x83')]({'TeamId':_0xf2766f['id'],'VoicePrefixId':_0x43abb4['params']['id']},{'transaction':_0x1b5624});});})['then'](function(){return BPromise['each'](_0x5640dd,function(_0x686d2b){return db[_0x46cb('0x84')][_0x46cb('0x85')]({'where':{'UserId':_0x686d2b['id'],'VoicePrefixId':_0x43abb4[_0x46cb('0x46')]['id']},'transaction':_0x1b5624});});})[_0x46cb('0x2b')](function(){_0x5640dd[_0x46cb('0x86')](function(_0xfdb016){socket[_0x46cb('0x71')](_0x46cb('0x87'),{'UserId':_0xfdb016['id'],'VoicePrefixId':_0x349f95['id']});});});});});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x194dc8,null))[_0x46cb('0x44')](handleError(_0x194dc8,null));};exports['removeTeams']=function(_0x257d26,_0x3a3acf,_0x592a54){return db['Team'][_0x46cb('0x7d')]({'where':{'id':_0x257d26[_0x46cb('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x46cb('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x46cb('0x2b')](handleEntityNotFound(_0x3a3acf,null))[_0x46cb('0x2b')](function(_0x22838d){var _0x311d75=_[_0x46cb('0x33')](_0x22838d,'id');var _0x30dad4=[];var _0x21a550=[];var _0x484b26=squel[_0x46cb('0x88')]();_0x484b26['field'](_0x46cb('0x89'))[_0x46cb('0x8a')](_0x46cb('0x8b'),'tq')[_0x46cb('0x8c')](_0x46cb('0x8d'),'ut',_0x46cb('0x8e'))[_0x46cb('0x41')](_0x46cb('0x8f'),_0x257d26[_0x46cb('0x46')]['id']);for(var _0x471f08=0x0;_0x471f08<_0x22838d[_0x46cb('0x3e')];_0x471f08+=0x1){let _0x51bd7a=_0x22838d[_0x471f08];for(var _0x4a22c1=0x0;_0x4a22c1<_0x51bd7a[_0x46cb('0x7e')][_0x46cb('0x3e')];_0x4a22c1+=0x1){let _0x4481d6=_0x51bd7a['Agents'][_0x4a22c1];var _0x2e875b=_0x484b26['clone']();_0x2e875b[_0x46cb('0x41')](_0x46cb('0x90'),_0x4481d6['id']);_0x21a550['push'](db['sequelize'][_0x46cb('0x38')](_0x2e875b[_0x46cb('0x91')](),{'type':db['sequelize'][_0x46cb('0x92')]['SELECT']})[_0x46cb('0x2b')](function(_0x2cf5f3){if(_0x2cf5f3[_0x46cb('0x3e')]===0x1){return _0x4481d6['id'];}else{var _0x4f4a7b=_['every'](_[_0x46cb('0x33')](_0x2cf5f3,_0x46cb('0x93')),function(_0x1c7ffb){return _[_0x46cb('0x94')](_0x311d75,_0x1c7ffb);});if(_0x4f4a7b){return _0x4481d6['id'];}}}));}}return BPromise[_0x46cb('0x95')](_0x21a550)[_0x46cb('0x2b')](function(_0x11c28a){_0x30dad4=_(_0x30dad4)[_0x46cb('0x96')](_0x11c28a)['compact']()['value']();return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x257d26[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x196557){return db[_0x46cb('0x4a')]['transaction'](function(_0x250e79){return _0x196557[_0x46cb('0x97')](_0x257d26[_0x46cb('0x38')][_0x46cb('0x6c')],{'transaction':_0x250e79})['then'](function(){if(!_[_0x46cb('0x98')](_0x30dad4)){return _0x196557['removeAgents'](_0x30dad4,{'transaction':_0x250e79});}})[_0x46cb('0x2b')](function(){_0x30dad4[_0x46cb('0x86')](function(_0xfbbc9c){socket[_0x46cb('0x71')]('userVoicePrefix:remove',{'UserId':_0xfbbc9c,'VoicePrefixId':_0x196557['id']});});});});});});})[_0x46cb('0x2b')](respondWithStatusCode(_0x3a3acf,null))['catch'](handleError(_0x3a3acf,null));}; \ No newline at end of file +var _0x5f66=['map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','rows','catch','find','destroy','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','charAt','system-','findById','params','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','getAgents','hasOwnProperty','getTeams','Team','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','from','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','update','get','VoicePrefixes','UserProfileResource','then','error','stack','send'];(function(_0x5d4876,_0x11e6b0){var _0x6927ac=function(_0x2e9a3a){while(--_0x2e9a3a){_0x5d4876['push'](_0x5d4876['shift']());}};_0x6927ac(++_0x11e6b0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];config[_0x65f6('0x14')]=_['defaults'](config[_0x65f6('0x14')],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x14')]));require(_0x65f6('0x17'))[_0x65f6('0x18')](socket);function respondWithStatusCode(_0x44144b,_0xb1d40a){_0xb1d40a=_0xb1d40a||0xcc;return function(_0x46dbc6){if(_0x46dbc6){return _0x44144b[_0x65f6('0x19')](_0xb1d40a);}return _0x44144b['status'](_0xb1d40a)[_0x65f6('0x1a')]();};}function respondWithResult(_0x49a913,_0x5dd324){_0x5dd324=_0x5dd324||0xc8;return function(_0x1693e6){if(_0x1693e6){return _0x49a913[_0x65f6('0x1b')](_0x5dd324)[_0x65f6('0x1c')](_0x1693e6);}};}function respondWithFilteredResult(_0x1c955c,_0x1b1cbb){return function(_0x1f974c){if(_0x1f974c){var _0xc8660c=typeof _0x1b1cbb[_0x65f6('0x1d')]==='undefined'&&typeof _0x1b1cbb['limit']===_0x65f6('0x1e');var _0x5b4055=_0x1f974c['count'];var _0x5c5b91=_0xc8660c?0x0:_0x1b1cbb[_0x65f6('0x1d')];var _0x21ea88=_0xc8660c?_0x1f974c['count']:_0x1b1cbb[_0x65f6('0x1d')]+_0x1b1cbb[_0x65f6('0x1f')];var _0xbee6a4;if(_0x21ea88>=_0x5b4055){_0x21ea88=_0x5b4055;_0xbee6a4=0xc8;}else{_0xbee6a4=0xce;}_0x1c955c[_0x65f6('0x1b')](_0xbee6a4);return _0x1c955c[_0x65f6('0x20')](_0x65f6('0x21'),_0x5c5b91+'-'+_0x21ea88+'/'+_0x5b4055)['json'](_0x1f974c);}return null;};}function patchUpdates(_0x197a49){return function(_0x4bb39e){try{jsonpatch['apply'](_0x4bb39e,_0x197a49,!![]);}catch(_0x212247){return BPromise[_0x65f6('0x22')](_0x212247);}return _0x4bb39e['save']();};}function saveUpdates(_0x1eeaaa,_0x471a33){return function(_0x2317ce){if(_0x2317ce){return _0x2317ce[_0x65f6('0x23')](_0x1eeaaa)['then'](function(_0x9d7bb0){return _0x9d7bb0;});}return null;};}function removeEntity(_0x59ea32,_0x20a161){return function(_0x5963e0){if(_0x5963e0){return _0x5963e0['destroy']()['then'](function(){var _0x29abdb=_0x5963e0[_0x65f6('0x24')]({'plain':!![]});var _0x4b2292=_0x65f6('0x25');return db[_0x65f6('0x26')]['destroy']({'where':{'type':_0x4b2292,'resourceId':_0x29abdb['id']}})[_0x65f6('0x27')](function(){return _0x5963e0;});})[_0x65f6('0x27')](function(){_0x59ea32[_0x65f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac04b,_0x488d36){return function(_0x266cfe){if(!_0x266cfe){_0x4ac04b[_0x65f6('0x19')](0x194);}return _0x266cfe;};}function handleError(_0x4344b3,_0x408ccc){_0x408ccc=_0x408ccc||0x1f4;return function(_0x518cac){logger[_0x65f6('0x28')](_0x518cac[_0x65f6('0x29')]);if(_0x518cac['name']){delete _0x518cac['name'];}_0x4344b3[_0x65f6('0x1b')](_0x408ccc)[_0x65f6('0x2a')](_0x518cac);};}exports['index']=function(_0x4e50c0,_0x10b368){var _0x1ce43c={},_0x11fe3b={},_0xc53cb7={'count':0x0,'rows':[]};var _0x1217fd=_[_0x65f6('0x2b')](db['VoicePrefix'][_0x65f6('0x2c')],function(_0x38f3c6){return{'name':_0x38f3c6[_0x65f6('0x2d')],'type':_0x38f3c6['type'][_0x65f6('0x2e')]};});_0x11fe3b[_0x65f6('0x2f')]=_[_0x65f6('0x2b')](_0x1217fd,_0x65f6('0x30'));_0x11fe3b[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4e50c0['query']);_0x11fe3b[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x11fe3b['model'],_0x11fe3b[_0x65f6('0x31')]);_0x1ce43c['attributes']=_[_0x65f6('0x34')](_0x11fe3b['model'],qs[_0x65f6('0x35')](_0x4e50c0[_0x65f6('0x31')]['fields']));_0x1ce43c[_0x65f6('0x36')]=_0x1ce43c[_0x65f6('0x36')][_0x65f6('0x37')]?_0x1ce43c['attributes']:_0x11fe3b['model'];if(!_0x4e50c0[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x38'))){_0x1ce43c['limit']=qs[_0x65f6('0x1f')](_0x4e50c0[_0x65f6('0x31')]['limit']);_0x1ce43c[_0x65f6('0x1d')]=qs['offset'](_0x4e50c0['query'][_0x65f6('0x1d')]);}_0x1ce43c[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3a')]);_0x1ce43c[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4e50c0['query'],_0x11fe3b[_0x65f6('0x33')]),_0x1217fd);if(_0x4e50c0['query'][_0x65f6('0x3d')]){_0x1ce43c[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x1ce43c[_0x65f6('0x3b')],{'$or':_['map'](_0x1217fd,function(_0x32148f){if(_0x32148f[_0x65f6('0x3f')]!==_0x65f6('0x40')){var _0x3fb1c6={};_0x3fb1c6[_0x32148f[_0x65f6('0x30')]]={'$like':'%'+_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x3fb1c6;}})});}_0x1ce43c=_[_0x65f6('0x3e')]({},_0x1ce43c,_0x4e50c0[_0x65f6('0x41')]);var _0x5d8e48={'where':_0x1ce43c[_0x65f6('0x3b')]};return db[_0x65f6('0x42')][_0x65f6('0x43')](_0x5d8e48)[_0x65f6('0x27')](function(_0x83e2d9){_0xc53cb7[_0x65f6('0x43')]=_0x83e2d9;if(_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x44')]){_0x1ce43c[_0x65f6('0x45')]=[{'all':!![]}];}return db[_0x65f6('0x42')][_0x65f6('0x46')](_0x1ce43c);})[_0x65f6('0x27')](function(_0x6c4d94){_0xc53cb7[_0x65f6('0x47')]=_0x6c4d94;return _0xc53cb7;})[_0x65f6('0x27')](respondWithFilteredResult(_0x10b368,_0x1ce43c))[_0x65f6('0x48')](handleError(_0x10b368,null));};exports['show']=function(_0x2dd16c,_0x37cd36){var _0x2d8c45={'raw':![],'where':{'id':_0x2dd16c['params']['id']}},_0x3828c9={};_0x3828c9[_0x65f6('0x2f')]=_[_0x65f6('0x32')](db[_0x65f6('0x42')]['rawAttributes']);_0x3828c9[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x2dd16c[_0x65f6('0x31')]);_0x3828c9[_0x65f6('0x33')]=_['intersection'](_0x3828c9[_0x65f6('0x2f')],_0x3828c9['query']);_0x2d8c45[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x3828c9['model'],qs[_0x65f6('0x35')](_0x2dd16c['query'][_0x65f6('0x35')]));_0x2d8c45[_0x65f6('0x36')]=_0x2d8c45[_0x65f6('0x36')][_0x65f6('0x37')]?_0x2d8c45[_0x65f6('0x36')]:_0x3828c9[_0x65f6('0x2f')];if(_0x2dd16c['query']['includeAll']){_0x2d8c45[_0x65f6('0x45')]=[{'all':!![]}];}_0x2d8c45=_[_0x65f6('0x3e')]({},_0x2d8c45,_0x2dd16c[_0x65f6('0x41')]);return db[_0x65f6('0x42')][_0x65f6('0x49')](_0x2d8c45)[_0x65f6('0x27')](handleEntityNotFound(_0x37cd36,null))[_0x65f6('0x27')](respondWithResult(_0x37cd36,null))[_0x65f6('0x48')](handleError(_0x37cd36,null));};exports[_0x65f6('0x4a')]=function(_0x517a47,_0x1f16cf){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x517a47['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x1f16cf,null))[_0x65f6('0x27')](removeEntity(_0x1f16cf,null))['catch'](handleError(_0x1f16cf,null));};exports[_0x65f6('0x4b')]=function(_0x253d52,_0x57eb04){return db[_0x65f6('0x42')]['describe']()[_0x65f6('0x27')](respondWithResult(_0x57eb04,null))[_0x65f6('0x48')](handleError(_0x57eb04,null));};exports[_0x65f6('0x4c')]=function(_0x4b9f0a,_0x1646c5){var _0x43a52e;return db['sequelize'][_0x65f6('0x4d')](function(_0x34312c){return db['VoicePrefix'][_0x65f6('0x4c')](_0x4b9f0a[_0x65f6('0x4e')],{'transaction':_0x34312c})[_0x65f6('0x27')](function(_0x25d504){_0x43a52e=_0x25d504[_0x65f6('0x24')]({'plain':!![]});return db[_0x65f6('0x4f')][_0x65f6('0x49')]({'where':{'id':_0x43a52e[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x52c5a4){return createVoicePrefixExtensions(_0x43a52e,_0x52c5a4,_0x34312c);});});})['then'](function(){var _0x19f40c=_0x4b9f0a[_0x65f6('0x51')][_0x65f6('0x24')]({'plain':!![]});if(!_0x19f40c)throw new Error(_0x65f6('0x52'));if(_0x19f40c['role']===_0x65f6('0x51')){var _0x2032b9=_0x43a52e;return db[_0x65f6('0x53')]['find']({'where':{'name':_0x65f6('0x25'),'userProfileId':_0x19f40c[_0x65f6('0x54')]},'raw':!![]})[_0x65f6('0x27')](function(_0x4e289e){if(_0x4e289e&&_0x4e289e['autoAssociation']===0x0){return db[_0x65f6('0x26')][_0x65f6('0x4c')]({'name':_0x2032b9[_0x65f6('0x30')],'resourceId':_0x2032b9['id'],'type':_0x4e289e[_0x65f6('0x30')],'sectionId':_0x4e289e['id']},{})[_0x65f6('0x27')](function(){return _0x43a52e;});}else{return _0x43a52e;}})[_0x65f6('0x48')](function(_0x35d77f){logger[_0x65f6('0x28')](_0x65f6('0x55'),_0x35d77f);throw _0x35d77f;});}return _0x43a52e;})[_0x65f6('0x27')](respondWithResult(_0x1646c5,null))[_0x65f6('0x48')](handleError(_0x1646c5,null));};function Extension(_0x141fcc,_0x30adee,_0x3e3143,_0x5ba9c6){this[_0x65f6('0x56')]=_0x65f6('0x57');this[_0x65f6('0x58')]=_0x141fcc;this['app']=_0x3e3143;this[_0x65f6('0x3f')]=_0x65f6('0x59');this[_0x65f6('0x5a')]=_0x65f6('0x5b');this['priority']=_0x30adee;this[_0x65f6('0x5c')]=_0x5ba9c6;}function createVoicePrefixExtensions(_0x4227f5,_0xe5fc65,_0x3e0d8b){return new BPromise(function(_0x553ff0,_0x2923ff){var _0x2fc20f=new Extension(formatPrefixName(_0x4227f5['prefix']),0x1,_0x65f6('0x5d'),_0x65f6('0x5e'));_0x2fc20f[_0x65f6('0x5f')]=_0x4227f5['id'];return db['VoiceExtension'][_0x65f6('0x4c')](_0x2fc20f,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0x3974ef){var _0x3c23e3=_0x3974ef[_0x65f6('0x24')]({'plain':!![]});var _0x334fa1=_['map'](addVoicePrefixExtensions(_0x4227f5,_0xe5fc65),function(_0x4ee8bd){_0x4ee8bd['VoiceExtensionId']=_0x3c23e3['id'];_0x4ee8bd[_0x65f6('0x5f')]=_0x4227f5['id'];return _0x4ee8bd;});return db[_0x65f6('0x4f')][_0x65f6('0x60')](_0x334fa1,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0xab6f0){if(!_0xab6f0){return _0x2923ff(_0x65f6('0x61'));}else{return _0x553ff0(_0xab6f0);}})['catch'](function(_0xfbfebc){return _0x2923ff(_0xfbfebc);});});;});};function addVoicePrefixExtensions(_0x1d1532,_0x54b569){var _0x225aeb=[];var _0x39c244=formatPrefixName(_0x1d1532[_0x65f6('0x62')]);_0x225aeb['push'](new Extension(_0x39c244,0x2,_0x65f6('0x63'),_0x65f6('0x64')+_0x1d1532['name']));if(_0x1d1532[_0x65f6('0x65')]){_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x63'),_0x65f6('0x67')+_0x1d1532[_0x65f6('0x65')]));}else{_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x5d'),'No\x20callerid\x20available'));}_0x225aeb['push'](new Extension(_0x39c244,0x4,_0x65f6('0x68'),_0x54b569[_0x65f6('0x56')]+','+'${EXTEN:'+(0x8+_0x1d1532[_0x65f6('0x30')]['length'])+'}'+','+0x1));return _0x225aeb;}function formatPrefixName(_0x3a483b){var _0x4e0450='_';for(var _0x440df1=0x0;_0x440df1<_0x3a483b[_0x65f6('0x37')];_0x440df1++){if(_0x3a483b[_0x65f6('0x69')](_0x440df1)=='-'){_0x4e0450+=_0x3a483b[_0x65f6('0x69')](_0x440df1);}else{_0x4e0450+='['+_0x3a483b[_0x65f6('0x69')](_0x440df1)+']';}}_0x4e0450+='.';return _0x4e0450;}exports[_0x65f6('0x23')]=function(_0x1aaf75,_0x1cc66a,_0x2405a7){var _0x4b7ecd=_0x1aaf75['body'];_0x4b7ecd[_0x65f6('0x62')]=_0x65f6('0x6a')+_0x4b7ecd[_0x65f6('0x30')]+'-';return db['sequelize']['transaction'](function(_0x2dbec2){return db[_0x65f6('0x42')][_0x65f6('0x23')](_0x4b7ecd,{'where':{'id':_0x4b7ecd['id']},'transaction':_0x2dbec2})[_0x65f6('0x27')](function(){return db[_0x65f6('0x4f')][_0x65f6('0x4a')]({'where':{'VoicePrefixId':_0x4b7ecd['id']},'transaction':_0x2dbec2})['then'](function(){return db['VoiceExtension'][_0x65f6('0x49')]({'where':{'id':_0x4b7ecd[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x219bf8){return createVoicePrefixExtensions(_0x4b7ecd,_0x219bf8,_0x2dbec2);});});});})['then'](function(){return db[_0x65f6('0x42')][_0x65f6('0x6b')](_0x4b7ecd['id']);})[_0x65f6('0x27')](respondWithResult(_0x1cc66a,null))[_0x65f6('0x48')](handleError(_0x1cc66a,null));};exports['addAgents']=function(_0x34ab7b,_0x351d43,_0x11411c){return db['VoicePrefix']['find']({'where':{'id':_0x34ab7b[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0x351d43,null))[_0x65f6('0x27')](function(_0xf6de){if(_0xf6de){return _0xf6de[_0x65f6('0x6d')](_0x34ab7b[_0x65f6('0x4e')]['ids'],_['omit'](_0x34ab7b['body'],[_0x65f6('0x6e'),'id'])||{})[_0x65f6('0x6f')](function(_0x161fb2){for(var _0x57464e=0x0;_0x57464e<_0x34ab7b[_0x65f6('0x4e')][_0x65f6('0x6e')][_0x65f6('0x37')];_0x57464e+=0x1){socket['emit'](_0x65f6('0x70'),{'UserId':Number(_0x34ab7b[_0x65f6('0x4e')]['ids'][_0x57464e]),'VoicePrefixId':Number(_0x34ab7b[_0x65f6('0x6c')]['id'])});}return _0x161fb2;});}})[_0x65f6('0x27')](respondWithResult(_0x351d43,null))['catch'](handleError(_0x351d43,null));};exports[_0x65f6('0x71')]=function(_0x5ef825,_0xe8449b,_0x55ea91){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x5ef825['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0xe8449b,null))[_0x65f6('0x27')](function(_0x2a700b){if(_0x2a700b){return _0x2a700b[_0x65f6('0x71')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])[_0x65f6('0x27')](function(){if(_[_0x65f6('0x72')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])){for(var _0x288eb0=0x0;_0x288eb0<_0x5ef825['query'][_0x65f6('0x6e')][_0x65f6('0x37')];_0x288eb0+=0x1){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')][_0x288eb0]),'VoicePrefixId':Number(_0x5ef825[_0x65f6('0x6c')]['id'])});}}else{socket['emit'](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')]),'VoicePrefixId':Number(_0x5ef825['params']['id'])});}});}})[_0x65f6('0x27')](respondWithStatusCode(_0xe8449b,null))[_0x65f6('0x48')](handleError(_0xe8449b,null));};exports['getAgents']=function(_0x4946c7,_0xa4a742,_0x413c21){var _0x5158c9={};var _0x2d86c8={};var _0x3b3bd5;var _0x73d359;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x4946c7[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0xa4a742,null))[_0x65f6('0x27')](function(_0x504b39){if(_0x504b39){_0x3b3bd5=_0x504b39;_0x2d86c8[_0x65f6('0x2f')]=_['keys'](db['User'][_0x65f6('0x2c')]);_0x2d86c8[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4946c7[_0x65f6('0x31')]);_0x2d86c8[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x2d86c8[_0x65f6('0x2f')],_0x2d86c8[_0x65f6('0x31')]);_0x5158c9['attributes']=_['intersection'](_0x2d86c8[_0x65f6('0x2f')],qs['fields'](_0x4946c7[_0x65f6('0x31')][_0x65f6('0x35')]));_0x5158c9[_0x65f6('0x36')]=_0x5158c9[_0x65f6('0x36')][_0x65f6('0x37')]?_0x5158c9['attributes']:_0x2d86c8[_0x65f6('0x2f')];_0x5158c9[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4946c7['query'][_0x65f6('0x3a')]);_0x5158c9[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4946c7[_0x65f6('0x31')],_0x2d86c8[_0x65f6('0x33')]));if(_0x4946c7['query']['filter']){_0x5158c9[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x5158c9[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0x5158c9['attributes'],function(_0x4bda86){var _0x336076={};_0x336076[_0x4bda86]={'$like':'%'+_0x4946c7[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x336076;})});}_0x5158c9=_[_0x65f6('0x3e')]({},_0x5158c9,_0x4946c7[_0x65f6('0x41')]);return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x4d607a){if(_0x4d607a){_0x73d359=_0x4d607a['length'];if(!_0x4946c7[_0x65f6('0x31')][_0x65f6('0x77')](_0x65f6('0x38'))){_0x5158c9[_0x65f6('0x1f')]=qs['limit'](_0x4946c7['query'][_0x65f6('0x1f')]);_0x5158c9[_0x65f6('0x1d')]=qs['offset'](_0x4946c7[_0x65f6('0x31')]['offset']);}return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x3a30ed){if(_0x3a30ed){return _0x3a30ed?{'count':_0x73d359,'rows':_0x3a30ed}:null;}})[_0x65f6('0x27')](respondWithResult(_0xa4a742,null))['catch'](handleError(_0xa4a742,null));};exports[_0x65f6('0x78')]=function(_0x330e18,_0x13c03b,_0x9f6e0c){var _0xec6a56={};var _0x144db0={};var _0x584ea4;var _0x45b3e6;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x330e18['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x13c03b,null))[_0x65f6('0x27')](function(_0xdf396c){if(_0xdf396c){_0x584ea4=_0xdf396c;_0x144db0[_0x65f6('0x2f')]=_['keys'](db[_0x65f6('0x79')][_0x65f6('0x2c')]);_0x144db0[_0x65f6('0x31')]=_['keys'](_0x330e18['query']);_0x144db0[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x144db0['model'],_0x144db0[_0x65f6('0x31')]);_0xec6a56[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x144db0['model'],qs[_0x65f6('0x35')](_0x330e18[_0x65f6('0x31')]['fields']));_0xec6a56[_0x65f6('0x36')]=_0xec6a56[_0x65f6('0x36')][_0x65f6('0x37')]?_0xec6a56['attributes']:_0x144db0[_0x65f6('0x2f')];_0xec6a56[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x330e18['query'][_0x65f6('0x3a')]);_0xec6a56['where']=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x330e18[_0x65f6('0x31')],_0x144db0[_0x65f6('0x33')]));if(_0x330e18[_0x65f6('0x31')][_0x65f6('0x3d')]){_0xec6a56['where']=_[_0x65f6('0x3e')](_0xec6a56[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0xec6a56[_0x65f6('0x36')],function(_0x207d15){var _0x59407d={};_0x59407d[_0x207d15]={'$like':'%'+_0x330e18['query']['filter']+'%'};return _0x59407d;})});}_0xec6a56=_[_0x65f6('0x3e')]({},_0xec6a56,_0x330e18[_0x65f6('0x41')]);return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})['then'](function(_0x151cee){if(_0x151cee){_0x45b3e6=_0x151cee['length'];if(!_0x330e18['query'][_0x65f6('0x77')](_0x65f6('0x38'))){_0xec6a56['limit']=qs[_0x65f6('0x1f')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1f')]);_0xec6a56[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1d')]);}return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})[_0x65f6('0x27')](function(_0x350641){if(_0x350641){return _0x350641?{'count':_0x45b3e6,'rows':_0x350641}:null;}})[_0x65f6('0x27')](respondWithResult(_0x13c03b,null))[_0x65f6('0x48')](handleError(_0x13c03b,null));};exports['addTeams']=function(_0x349af7,_0x52dc75,_0x55355f){var _0x24d524=_0x349af7[_0x65f6('0x4e')][_0x65f6('0x6e')];var _0x3727f9;return db['Team'][_0x65f6('0x46')]({'where':{'id':_0x24d524},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x65f6('0x30'),_0x65f6('0x7a'),_0x65f6('0x7b'),_0x65f6('0x7c')],'raw':!![]}]})[_0x65f6('0x27')](function(_0xcdfebe){if(_0xcdfebe){_0x3727f9=_0xcdfebe;var _0x5a33cf=_[_0x65f6('0x7d')](_0xcdfebe,function(_0x56bf49){var _0x1ef2a0=_0x56bf49[_0x65f6('0x24')]({'plain':!![]});return _0x1ef2a0[_0x65f6('0x7e')];});return db['VoicePrefix'][_0x65f6('0x49')]({'where':{'id':_0x349af7['params']['id']}})['then'](function(_0x377d5e){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0xf364a9){return _0x377d5e[_0x65f6('0x80')](_0x24d524,{'transaction':_0xf364a9})['then'](function(){return BPromise[_0x65f6('0x81')](_0x3727f9,function(_0x400633){return db[_0x65f6('0x82')][_0x65f6('0x83')]({'TeamId':_0x400633['id'],'VoicePrefixId':_0x349af7['params']['id']},{'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){return BPromise[_0x65f6('0x81')](_0x5a33cf,function(_0x344163){return db[_0x65f6('0x84')][_0x65f6('0x85')]({'where':{'UserId':_0x344163['id'],'VoicePrefixId':_0x349af7[_0x65f6('0x6c')]['id']},'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){_0x5a33cf[_0x65f6('0x86')](function(_0x558410){socket[_0x65f6('0x73')](_0x65f6('0x70'),{'UserId':_0x558410['id'],'VoicePrefixId':_0x377d5e['id']});});});});});}})[_0x65f6('0x27')](respondWithStatusCode(_0x52dc75,null))[_0x65f6('0x48')](handleError(_0x52dc75,null));};exports[_0x65f6('0x87')]=function(_0x4171a1,_0x57667e,_0x3fd6ee){return db[_0x65f6('0x79')]['findAll']({'where':{'id':_0x4171a1[_0x65f6('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x65f6('0x88')],'as':_0x65f6('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x27')](handleEntityNotFound(_0x57667e,null))[_0x65f6('0x27')](function(_0x2177f1){var _0x55c9bd=_[_0x65f6('0x2b')](_0x2177f1,'id');var _0x395642=[];var _0x2394eb=[];var _0x31870f=squel[_0x65f6('0x89')]();_0x31870f['field']('tq.TeamId')[_0x65f6('0x8a')](_0x65f6('0x8b'),'tq')[_0x65f6('0x8c')](_0x65f6('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x4171a1[_0x65f6('0x6c')]['id']);for(var _0x3b0a97=0x0;_0x3b0a97<_0x2177f1[_0x65f6('0x37')];_0x3b0a97+=0x1){let _0x50e159=_0x2177f1[_0x3b0a97];for(var _0x12730b=0x0;_0x12730b<_0x50e159[_0x65f6('0x7e')][_0x65f6('0x37')];_0x12730b+=0x1){let _0x18c6a8=_0x50e159[_0x65f6('0x7e')][_0x12730b];var _0x54e258=_0x31870f[_0x65f6('0x8e')]();_0x54e258[_0x65f6('0x3b')]('ut.UserId\x20=\x20?',_0x18c6a8['id']);_0x2394eb['push'](db[_0x65f6('0x7f')][_0x65f6('0x31')](_0x54e258[_0x65f6('0x8f')](),{'type':db[_0x65f6('0x7f')][_0x65f6('0x90')]['SELECT']})[_0x65f6('0x27')](function(_0x4b080a){if(_0x4b080a[_0x65f6('0x37')]===0x1){return _0x18c6a8['id'];}else{var _0x5d181a=_[_0x65f6('0x91')](_['map'](_0x4b080a,_0x65f6('0x92')),function(_0x48a9df){return _[_0x65f6('0x93')](_0x55c9bd,_0x48a9df);});if(_0x5d181a){return _0x18c6a8['id'];}}}));}}return BPromise[_0x65f6('0x94')](_0x2394eb)['then'](function(_0x4f2f43){_0x395642=_(_0x395642)[_0x65f6('0x95')](_0x4f2f43)[_0x65f6('0x96')]()[_0x65f6('0x97')]();return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x4171a1[_0x65f6('0x6c')]['id']}})[_0x65f6('0x27')](function(_0x1b5957){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0x4a90e3){return _0x1b5957[_0x65f6('0x87')](_0x4171a1[_0x65f6('0x31')][_0x65f6('0x6e')],{'transaction':_0x4a90e3})[_0x65f6('0x27')](function(){if(!_[_0x65f6('0x98')](_0x395642)){return _0x1b5957[_0x65f6('0x71')](_0x395642,{'transaction':_0x4a90e3});}})['then'](function(){_0x395642[_0x65f6('0x86')](function(_0x91d7bf){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':_0x91d7bf,'VoicePrefixId':_0x1b5957['id']});});});});});});})[_0x65f6('0x27')](respondWithStatusCode(_0x57667e,null))[_0x65f6('0x48')](handleError(_0x57667e,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8cb66ad..0baa59f 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 _0xd9e0=['VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x33b3e7,_0x306ade){var _0x274ab4=function(_0x59ff2b){while(--_0x59ff2b){_0x33b3e7['push'](_0x33b3e7['shift']());}};_0x274ab4(++_0x306ade);}(_0xd9e0,0xc6));var _0x0d9e=function(_0x99251c,_0x1ea4ca){_0x99251c=_0x99251c-0x0;var _0xf893cb=_0xd9e0[_0x99251c];return _0xf893cb;};'use strict';var EventEmitter=require(_0x0d9e('0x0'));var VoicePrefix=require(_0x0d9e('0x1'))['db'][_0x0d9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0d9e('0x3')](0x0);var events={'afterCreate':_0x0d9e('0x4'),'afterUpdate':'update','afterDestroy':_0x0d9e('0x5')};function emitEvent(_0x23fd6a){return function(_0x58dea9,_0x32b60c,_0x4b29c2){VoicePrefixEvents[_0x0d9e('0x6')](_0x23fd6a+':'+_0x58dea9['id'],_0x58dea9);VoicePrefixEvents[_0x0d9e('0x6')](_0x23fd6a,_0x58dea9);_0x4b29c2(null);};}for(var e in events){if(events[_0x0d9e('0x7')](e)){var event=events[e];VoicePrefix[_0x0d9e('0x8')](e,emitEvent(event));}}module[_0x0d9e('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xa724=['setMaxListeners','emit','hasOwnProperty','hook','events','VoicePrefix'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xa724,0x1d8));var _0x4a72=function(_0x71b0f7,_0x4fdb1a){_0x71b0f7=_0x71b0f7-0x0;var _0x395473=_0xa724[_0x71b0f7];return _0x395473;};'use strict';var EventEmitter=require(_0x4a72('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4a72('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4a72('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x56838a){return function(_0x5b9d40,_0x2b5135,_0x65d43){VoicePrefixEvents[_0x4a72('0x3')](_0x56838a+':'+_0x5b9d40['id'],_0x5b9d40);VoicePrefixEvents[_0x4a72('0x3')](_0x56838a,_0x5b9d40);_0x65d43(null);};}for(var e in events){if(events[_0x4a72('0x4')](e)){var event=events[e];VoicePrefix[_0x4a72('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 51f6c04..34fe45d 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 _0xf657=['path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','moment','bluebird'];(function(_0x3c984e,_0x164d5b){var _0x547f7=function(_0xebe7aa){while(--_0xebe7aa){_0x3c984e['push'](_0x3c984e['shift']());}};_0x547f7(++_0x164d5b);}(_0xf657,0x146));var _0x7f65=function(_0x6eac03,_0x41d4a0){_0x6eac03=_0x6eac03-0x0;var _0x1c5c4a=_0xf657[_0x6eac03];return _0x1c5c4a;};'use strict';var _=require(_0x7f65('0x0'));var util=require('util');var logger=require(_0x7f65('0x1'))('api');var moment=require(_0x7f65('0x2'));var BPromise=require(_0x7f65('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f65('0x4'));var rimraf=require(_0x7f65('0x5'));var config=require('../../config/environment');var attributes=require(_0x7f65('0x6'));module[_0x7f65('0x7')]=function(_0x255be8,_0x29591e){return _0x255be8[_0x7f65('0x8')](_0x7f65('0x9'),attributes,{'tableName':_0x7f65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ad4=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash'];(function(_0x1f2dc3,_0x88986d){var _0x20c752=function(_0x26b309){while(--_0x26b309){_0x1f2dc3['push'](_0x1f2dc3['shift']());}};_0x20c752(++_0x88986d);}(_0x4ad4,0x16a));var _0x44ad=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x4ad4[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x44ad('0x0'));var util=require(_0x44ad('0x1'));var logger=require(_0x44ad('0x2'))(_0x44ad('0x3'));var moment=require(_0x44ad('0x4'));var BPromise=require('bluebird');var rp=require(_0x44ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44ad('0x6'));var config=require(_0x44ad('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x44ad('0x8')]=function(_0x50bb9c,_0x2a2f8b){return _0x50bb9c['define'](_0x44ad('0x9'),attributes,{'tableName':_0x44ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 5e19947..4e0278f 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 _0xa24d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa24d,0x1c1));var _0xda24=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0xa24d[_0x593f03];return _0x178299;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var moment=require(_0xda24('0x2'));var BPromise=require(_0xda24('0x3'));var rs=require(_0xda24('0x4'));var fs=require('fs');var Redis=require(_0xda24('0x5'));var db=require(_0xda24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda24('0x7'))(_0xda24('0x8'));var config=require(_0xda24('0x9'));var jayson=require(_0xda24('0xa'));var client=jayson['client'][_0xda24('0xb')]({'port':0x232a});config[_0xda24('0xc')]=_['defaults'](config[_0xda24('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xda24('0xd'))(new Redis(config[_0xda24('0xc')]));require(_0xda24('0xe'))[_0xda24('0xf')](socket);function respondWithRpcPromise(_0x54f108,_0x243fc8,_0x3374a7){return new BPromise(function(_0x22776c,_0x3a508b){return client[_0xda24('0x10')](_0x54f108,_0x3374a7)['then'](function(_0x32c867){logger['info'](_0xda24('0x11'),_0x243fc8,_0xda24('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x243fc8,_0xda24('0x12'),JSON[_0xda24('0x13')](_0x32c867));if(_0x32c867[_0xda24('0x14')]){if(_0x32c867[_0xda24('0x14')]['code']===0x1f4){logger[_0xda24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x243fc8,_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);return _0x3a508b(_0x32c867['error']['message']);}logger[_0xda24('0x14')](_0xda24('0x11'),_0x243fc8,_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);return _0x22776c(_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);}else{logger[_0xda24('0x16')](_0xda24('0x11'),_0x243fc8,_0xda24('0x12'));_0x22776c(_0x32c867['result'][_0xda24('0x15')]);}})[_0xda24('0x17')](function(_0x52b393){logger[_0xda24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x243fc8,_0x52b393);_0x3a508b(_0x52b393);});});} \ No newline at end of file +var _0x543b=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x552833,_0x17f3d3){var _0x29f292=function(_0x5a280c){while(--_0x5a280c){_0x552833['push'](_0x552833['shift']());}};_0x29f292(++_0x17f3d3);}(_0x543b,0x18d));var _0xb543=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x543b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});config[_0xb543('0xc')]=_[_0xb543('0xd')](config[_0xb543('0xc')],{'host':_0xb543('0xe'),'port':0x18eb});var socket=require(_0xb543('0xf'))(new Redis(config[_0xb543('0xc')]));require('./voicePrefix.socket')[_0xb543('0x10')](socket);function respondWithRpcPromise(_0x48c727,_0x1f4cf0,_0x3a45e3){return new BPromise(function(_0x1e6d97,_0x1243fa){return client[_0xb543('0x11')](_0x48c727,_0x3a45e3)[_0xb543('0x12')](function(_0x5f4cef){logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));logger['debug'](_0xb543('0x16'),_0x1f4cf0,_0xb543('0x15'),JSON[_0xb543('0x17')](_0x5f4cef));if(_0x5f4cef['error']){if(_0x5f4cef['error'][_0xb543('0x18')]===0x1f4){logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef[_0xb543('0x19')]['message']);return _0x1243fa(_0x5f4cef[_0xb543('0x19')][_0xb543('0x1a')]);}logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef['error'][_0xb543('0x1a')]);return _0x1e6d97(_0x5f4cef['error'][_0xb543('0x1a')]);}else{logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));_0x1e6d97(_0x5f4cef['result'][_0xb543('0x1a')]);}})[_0xb543('0x1b')](function(_0x45cd55){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1f4cf0,_0x45cd55);_0x1243fa(_0x45cd55);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b03624e..fba969b 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 _0xb921=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x3f2ef7,_0x48d9cb){var _0x587c06=function(_0x448af0){while(--_0x448af0){_0x3f2ef7['push'](_0x3f2ef7['shift']());}};_0x587c06(++_0x48d9cb);}(_0xb921,0x16a));var _0x1b92=function(_0x511723,_0x4db8e2){_0x511723=_0x511723-0x0;var _0x25add0=_0xb921[_0x511723];return _0x25add0;};'use strict';var VoicePrefixEvents=require(_0x1b92('0x0'));var events=[_0x1b92('0x1'),_0x1b92('0x2'),_0x1b92('0x3')];function createListener(_0x87553a,_0x4de8de){return function(_0x51e457){_0x4de8de[_0x1b92('0x4')](_0x87553a,_0x51e457);};}function removeListener(_0xc3832e,_0x1e49a8){return function(){VoicePrefixEvents[_0x1b92('0x5')](_0xc3832e,_0x1e49a8);};}exports[_0x1b92('0x6')]=function(_0x29a1db){for(var _0x4358e3=0x0,_0x8a6282=events[_0x1b92('0x7')];_0x4358e3<_0x8a6282;_0x4358e3++){var _0x352406=events[_0x4358e3];var _0x1545f9=createListener(_0x1b92('0x8')+_0x352406,_0x29a1db);VoicePrefixEvents['on'](_0x352406,_0x1545f9);}}; \ No newline at end of file +var _0xd136=['voicePrefix:','save','remove','emit','removeListener','register','length'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd136,0x94));var _0x6d13=function(_0x1def5d,_0x4edc40){_0x1def5d=_0x1def5d-0x0;var _0x5a9d03=_0xd136[_0x1def5d];return _0x5a9d03;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x6d13('0x0'),_0x6d13('0x1'),'update'];function createListener(_0x56824,_0x2d8f30){return function(_0x12b9d6){_0x2d8f30[_0x6d13('0x2')](_0x56824,_0x12b9d6);};}function removeListener(_0xec09ab,_0x387947){return function(){VoicePrefixEvents[_0x6d13('0x3')](_0xec09ab,_0x387947);};}exports[_0x6d13('0x4')]=function(_0x147026){for(var _0x4aabef=0x0,_0x335482=events[_0x6d13('0x5')];_0x4aabef<_0x335482;_0x4aabef++){var _0x4c563a=events[_0x4aabef];var _0x598021=createListener(_0x6d13('0x6')+_0x4c563a,_0x147026);VoicePrefixEvents['on'](_0x4c563a,_0x598021);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4f3190f..be384bd 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xb10b,0x12a));var _0xbb10=function(_0x34bff6,_0x36f01d){_0x34bff6=_0x34bff6-0x0;var _0x2704ee=_0xb10b[_0x34bff6];return _0x2704ee;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4db6d7,_0x5f4e37){var _0x32ab94=function(_0x29d868){while(--_0x29d868){_0x4db6d7['push'](_0x4db6d7['shift']());}};_0x32ab94(++_0x5f4e37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 855b72b..203196a 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 _0x230a=['wrapuptime','power','predictive','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','inbound','outbound','ENUM','ringall','fewestcalls','random','rrmemory','wrandom','setDataValue','strategy','type','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN'];(function(_0x217f7d,_0x480545){var _0x4fb160=function(_0x2c6464){while(--_0x2c6464){_0x217f7d['push'](_0x217f7d['shift']());}};_0x4fb160(++_0x480545);}(_0x230a,0x15a));var _0xa230=function(_0x5b34a7,_0x4a6f65){_0x5b34a7=_0x5b34a7-0x0;var _0x20f2b6=_0x230a[_0x5b34a7];return _0x20f2b6;};'use strict';var Sequelize=require(_0xa230('0x0'));module['exports']={'name':{'type':Sequelize[_0xa230('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xa230('0x2'),_0xa230('0x3')),'allowNull':![],'defaultValue':_0xa230('0x2')},'musiconhold':{'type':Sequelize[_0xa230('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xa230('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa230('0x4')]('rr',_0xa230('0x5'),'leastrecent',_0xa230('0x6'),_0xa230('0x7'),_0xa230('0x8'),'linear',_0xa230('0x9'),'rrordered'),'allowNull':![],'defaultValue':_0xa230('0x5'),'set':function(_0x1f7f70){this[_0xa230('0xa')](_0xa230('0xb'),_0x1f7f70?_0x1f7f70:_0xa230('0x8'));},'get':function(){var _0x1b5f0d=this['getDataValue'](_0xa230('0xc'));var _0x647a80=this[_0xa230('0xd')](_0xa230('0xe'));var _0x1d503d=this[_0xa230('0xd')](_0xa230('0xb'));if(_0x1b5f0d===_0xa230('0x3')){if(_0x647a80===_0xa230('0xf')){return null;}if(_0x647a80==='booked'&&![_0xa230('0x8'),_0xa230('0x10')][_0xa230('0x11')](_0x1d503d)){this[_0xa230('0xa')](_0xa230('0xb'),_0xa230('0x8'));}}return _0x1d503d;}},'servicelevel':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa230('0x12')](0xb)},'timeout':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa230('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no',_0xa230('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa230('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xa230('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa230('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa230('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa230('0x13'),'no'),'defaultValue':_0xa230('0x13')},'announce_holdtime':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no',_0xa230('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa230('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xa230('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa230('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa230('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa230('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa230('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xa230('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xa230('0x1')]},'queue_less_than':{'type':Sequelize[_0xa230('0x1')]},'periodic_announce':{'type':Sequelize[_0xa230('0x16')],'set':function(_0x32ab37){this[_0xa230('0xa')](_0xa230('0x17'),_0x32ab37?_0x32ab37[_0xa230('0x18')](','):[]);},'get':function(){return this[_0xa230('0xd')](_0xa230('0x17'))?this[_0xa230('0xd')](_0xa230('0x17'))[_0xa230('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x13'),'set':function(_0x1f062b){this[_0xa230('0xa')](_0xa230('0x1a'),_0x1f062b?_0x1f062b[_0xa230('0x18')](','):undefined);},'get':function(){return this[_0xa230('0xd')]('joinempty')?this[_0xa230('0xd')](_0xa230('0x1a'))[_0xa230('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x158773){this['setDataValue']('leavewhenempty',_0x158773?_0x158773[_0xa230('0x18')](','):undefined);},'get':function(){return this[_0xa230('0xd')](_0xa230('0x1b'))?this['getDataValue'](_0xa230('0x1b'))[_0xa230('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa230('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa230('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'set':function(_0x4ce79d){this[_0xa230('0xa')]('acw',_0x4ce79d);if(_0x4ce79d){if(this[_0xa230('0xd')](_0xa230('0x1d'))<0x2){this[_0xa230('0xa')](_0xa230('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xa230('0xf'),'progressive',_0xa230('0x1e'),_0xa230('0x1f'),_0xa230('0x20')),'defaultValue':_0xa230('0x21'),'comment':_0xa230('0x22')},'dialLimitChannel':{'type':Sequelize[_0xa230('0x12')](0x4)[_0xa230('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xa230('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa230('0x24')},'dialPowerLevel':{'type':Sequelize[_0xa230('0x25')](0x2)[_0xa230('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa230('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xa230('0x4')]('agentBusyFactor',_0xa230('0x27')),'defaultValue':'dropRate','comment':_0xa230('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa230('0x25')](0x2)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa230('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa230('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa230('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x2c'),'comment':_0xa230('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa230('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa230('0x30')},'dialTimezone':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x31')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x32'),_0xa230('0x33'),'onlyIfOpen'),'defaultValue':_0xa230('0x32')},'dialAMDActive':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'comment':_0xa230('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xa230('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa230('0x35')},'dialAMDGreeting':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa230('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa230('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa230('0x37')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa230('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa230('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa230('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xa230('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa230('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa230('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x3c'),'ASC'),'defaultValue':_0xa230('0x3c')},'dialQueueProject2':{'type':Sequelize[_0xa230('0x1')],'comment':_0xa230('0x3d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa230('0x3e')},'dialCutDigit':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa230('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa230('0x12')],'allowNull':!![],'comment':_0xa230('0x48')},'mandatoryDisposition':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e0058){if(!_0x4e0058)this[_0xa230('0xa')](_0xa230('0x49'),null);this[_0xa230('0xa')](_0xa230('0x4a'),_0x4e0058);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0xecba=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','default','ringall','leastrecent','fewestcalls','linear','wrandom','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.'];(function(_0xb11807,_0x3ad4d8){var _0x4e0025=function(_0xd04f36){while(--_0xd04f36){_0xb11807['push'](_0xb11807['shift']());}};_0x4e0025(++_0x3ad4d8);}(_0xecba,0xbc));var _0xaecb=function(_0x4fb35c,_0x30adb4){_0x4fb35c=_0x4fb35c-0x0;var _0x12cdaf=_0xecba[_0x4fb35c];return _0x12cdaf;};'use strict';var Sequelize=require(_0xaecb('0x0'));module[_0xaecb('0x1')]={'name':{'type':Sequelize[_0xaecb('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xaecb('0x4')},'musiconhold':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':_0xaecb('0x5')},'announce':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xaecb('0x6'),_0xaecb('0x7'),_0xaecb('0x8'),'random','rrmemory',_0xaecb('0x9'),_0xaecb('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0xaecb('0x6'),'set':function(_0x4d2774){this[_0xaecb('0xb')](_0xaecb('0xc'),_0x4d2774?_0x4d2774:_0xaecb('0xd'));},'get':function(){var _0x1ced18=this[_0xaecb('0xe')](_0xaecb('0xf'));var _0x3b2a64=this[_0xaecb('0xe')](_0xaecb('0x10'));var _0x37f916=this[_0xaecb('0xe')](_0xaecb('0xc'));if(_0x1ced18==='outbound'){if(_0x3b2a64===_0xaecb('0x11')){return null;}if(_0x3b2a64===_0xaecb('0x12')&&![_0xaecb('0xd'),_0xaecb('0x13')]['includes'](_0x37f916)){this[_0xaecb('0xb')](_0xaecb('0xc'),_0xaecb('0xd'));}}return _0x37f916;}},'servicelevel':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaecb('0x14')](0xb)},'timeout':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xaecb('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':_0xaecb('0x15')},'autopause':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xaecb('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xaecb('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaecb('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xaecb('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xaecb('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':_0xaecb('0x15')},'announce_holdtime':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xaecb('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xaecb('0x2')]},'queue_youarenext':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xaecb('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xaecb('0x2')]},'queue_quantity1':{'type':Sequelize[_0xaecb('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xaecb('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xaecb('0x16')],'set':function(_0x4b5d83){this[_0xaecb('0xb')]('periodic_announce',_0x4b5d83?_0x4b5d83[_0xaecb('0x17')](','):[]);},'get':function(){return this[_0xaecb('0xe')](_0xaecb('0x18'))?this[_0xaecb('0xe')](_0xaecb('0x18'))[_0xaecb('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':_0xaecb('0x15'),'set':function(_0x4a9831){this[_0xaecb('0xb')](_0xaecb('0x1a'),_0x4a9831?_0x4a9831['join'](','):undefined);},'get':function(){return this[_0xaecb('0xe')](_0xaecb('0x1a'))?this[_0xaecb('0xe')](_0xaecb('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':'no','set':function(_0x522160){this['setDataValue'](_0xaecb('0x1b'),_0x522160?_0x522160[_0xaecb('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0xaecb('0x1b'))?this['getDataValue'](_0xaecb('0x1b'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xaecb('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':0x0,'set':function(_0x424207){this['setDataValue'](_0xaecb('0x1d'),_0x424207);if(_0x424207){if(this['getDataValue'](_0xaecb('0x1e'))<0x2){this['setDataValue'](_0xaecb('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaecb('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xaecb('0x3')]('preview',_0xaecb('0x1f'),_0xaecb('0x20'),_0xaecb('0x21'),_0xaecb('0x12')),'defaultValue':_0xaecb('0x1f'),'comment':_0xaecb('0x22')},'dialLimitChannel':{'type':Sequelize[_0xaecb('0x14')](0x4)[_0xaecb('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaecb('0x24')},'dialLimitQueue':{'type':Sequelize[_0xaecb('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaecb('0x25')},'dialPowerLevel':{'type':Sequelize[_0xaecb('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaecb('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x28'),_0xaecb('0x29')),'defaultValue':'dropRate','comment':_0xaecb('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xaecb('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xaecb('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xaecb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaecb('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':'tTxX','comment':_0xaecb('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xaecb('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaecb('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaecb('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':_0xaecb('0x34')},'dialPrefix':{'type':Sequelize[_0xaecb('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xaecb('0x35'),_0xaecb('0x36'),_0xaecb('0x37')),'defaultValue':_0xaecb('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaecb('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaecb('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaecb('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaecb('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaecb('0x14')](0x9)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaecb('0x14')](0x5)[_0xaecb('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaecb('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaecb('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xaecb('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':0x0,'comment':_0xaecb('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaecb('0x3')](_0xaecb('0x3e'),_0xaecb('0x3f')),'defaultValue':_0xaecb('0x3e')},'dialQueueProject2':{'type':Sequelize[_0xaecb('0x2')],'comment':_0xaecb('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaecb('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaecb('0x40')},'dialCutDigit':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaecb('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaecb('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)[_0xaecb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaecb('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaecb('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaecb('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaecb('0x14')],'allowNull':!![],'comment':_0xaecb('0x49')},'mandatoryDisposition':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':![],'comment':_0xaecb('0x4a'),'set':function(_0xcec95f){if(!_0xcec95f)this[_0xaecb('0xb')](_0xaecb('0x4b'),null);this[_0xaecb('0xb')](_0xaecb('0x4c'),_0xcec95f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xaecb('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xaecb('0x14')](0x3)[_0xaecb('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xaecb('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 87cff03..1a8a652 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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x2e0f70,_0x18264a){var _0x403ba3=function(_0x3f2f24){while(--_0x3f2f24){_0x2e0f70['push'](_0x2e0f70['shift']());}};_0x403ba3(++_0x18264a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6aa7,0x178));var _0x76aa=function(_0x30efbc,_0x344bef){_0x30efbc=_0x30efbc-0x0;var _0x29f2bf=_0x6aa7[_0x30efbc];return _0x29f2bf;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c3946c9..e0e3b6d 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 _0xca87=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1d7966,_0x359208){var _0x27bbf7=function(_0x4ea9dc){while(--_0x4ea9dc){_0x1d7966['push'](_0x1d7966['shift']());}};_0x27bbf7(++_0x359208);}(_0xca87,0x165));var _0x7ca8=function(_0x2ac1f2,_0x56819b){_0x2ac1f2=_0x2ac1f2-0x0;var _0x12f64d=_0xca87[_0x2ac1f2];return _0x12f64d;};'use strict';var EventEmitter=require(_0x7ca8('0x0'));var VoiceQueue=require(_0x7ca8('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7ca8('0x2')](0x0);var events={'afterCreate':_0x7ca8('0x3'),'afterUpdate':_0x7ca8('0x4'),'afterDestroy':_0x7ca8('0x5')};function emitEvent(_0x3a3043){return function(_0x57690b,_0x47d889,_0x15b550){VoiceQueueEvents[_0x7ca8('0x6')](_0x3a3043+':'+_0x57690b['id'],_0x57690b);VoiceQueueEvents[_0x7ca8('0x6')](_0x3a3043,_0x57690b);_0x15b550(null);};}for(var e in events){if(events[_0x7ca8('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7ca8('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x895e=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x38e133,_0x2322cd){var _0x1f2bd6=function(_0x5bbfb2){while(--_0x5bbfb2){_0x38e133['push'](_0x38e133['shift']());}};_0x1f2bd6(++_0x2322cd);}(_0x895e,0x1ca));var _0xe895=function(_0x520d57,_0x574113){_0x520d57=_0x520d57-0x0;var _0x4677d9=_0x895e[_0x520d57];return _0x4677d9;};'use strict';var EventEmitter=require(_0xe895('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xe895('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe895('0x2')](0x0);var events={'afterCreate':_0xe895('0x3'),'afterUpdate':_0xe895('0x4'),'afterDestroy':_0xe895('0x5')};function emitEvent(_0x1caa29){return function(_0x311972,_0xce2d4f,_0x41d808){VoiceQueueEvents[_0xe895('0x6')](_0x1caa29+':'+_0x311972['id'],_0x311972);VoiceQueueEvents[_0xe895('0x6')](_0x1caa29,_0x311972);_0x41d808(null);};}for(var e in events){if(events[_0xe895('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xe895('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 cf23366..ebac947 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1e8b87,_0x5cbcc0){var _0x178e0f=function(_0x27fd2b){while(--_0x27fd2b){_0x1e8b87['push'](_0x1e8b87['shift']());}};_0x178e0f(++_0x5cbcc0);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x39f9f2,_0x37fc06){var _0x3febf8=function(_0x2811f2){while(--_0x2811f2){_0x39f9f2['push'](_0x39f9f2['shift']());}};_0x3febf8(++_0x37fc06);}(_0x3e74,0x175));var _0x43e7=function(_0x131596,_0x3efe){_0x131596=_0x131596-0x0;var _0x55cacb=_0x3e74[_0x131596];return _0x55cacb;};'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 97bdfe7..951479d 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 _0xa6bc=['localhost','./voiceQueue.socket','register','request','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowVoiceQueue','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x40b92f,_0x39dbb5){var _0x25b785=function(_0x459592){while(--_0x459592){_0x40b92f['push'](_0x40b92f['shift']());}};_0x25b785(++_0x39dbb5);}(_0xa6bc,0x75));var _0xca6b=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0xa6bc[_0x56fd29];return _0x2a0bf7;};'use strict';var _=require(_0xca6b('0x0'));var util=require('util');var moment=require(_0xca6b('0x1'));var BPromise=require(_0xca6b('0x2'));var rs=require(_0xca6b('0x3'));var fs=require('fs');var Redis=require(_0xca6b('0x4'));var db=require(_0xca6b('0x5'))['db'];var utils=require(_0xca6b('0x6'));var logger=require(_0xca6b('0x7'))(_0xca6b('0x8'));var config=require(_0xca6b('0x9'));var jayson=require(_0xca6b('0xa'));var client=jayson[_0xca6b('0xb')][_0xca6b('0xc')]({'port':0x232a});config[_0xca6b('0xd')]=_[_0xca6b('0xe')](config[_0xca6b('0xd')],{'host':_0xca6b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca6b('0xd')]));require(_0xca6b('0x10'))[_0xca6b('0x11')](socket);function respondWithRpcPromise(_0x1b8c73,_0x335a72,_0x1a351d){return new BPromise(function(_0x49ecd0,_0x20b83b){return client[_0xca6b('0x12')](_0x1b8c73,_0x1a351d)['then'](function(_0x2f4f0e){logger[_0xca6b('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x335a72,'request\x20sent');logger[_0xca6b('0x14')](_0xca6b('0x15'),_0x335a72,_0xca6b('0x16'),JSON[_0xca6b('0x17')](_0x2f4f0e));if(_0x2f4f0e[_0xca6b('0x18')]){if(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x19')]===0x1f4){logger[_0xca6b('0x18')](_0xca6b('0x1a'),_0x335a72,_0x2f4f0e[_0xca6b('0x18')]['message']);return _0x20b83b(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x1b')]);}logger[_0xca6b('0x18')](_0xca6b('0x1a'),_0x335a72,_0x2f4f0e['error']['message']);return _0x49ecd0(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x1b')]);}else{logger[_0xca6b('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x335a72,_0xca6b('0x16'));_0x49ecd0(_0x2f4f0e[_0xca6b('0x1c')][_0xca6b('0x1b')]);}})[_0xca6b('0x1d')](function(_0x4ea66e){logger['error'](_0xca6b('0x1a'),_0x335a72,_0x4ea66e);_0x20b83b(_0x4ea66e);});});}exports[_0xca6b('0x1e')]=function(_0x1d6d98){var _0x10b571=this;return new Promise(function(_0x132269,_0x1ba9fe){return db[_0xca6b('0x1f')][_0xca6b('0x20')]({'raw':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x22')]===undefined?!![]:![]:!![],'where':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x23')]||null:null,'attributes':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x24')]||null:null,'limit':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x25')]||null:null,'include':_0x1d6d98['options']?_0x1d6d98['options']['include']?_[_0xca6b('0x26')](_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x27')],function(_0x29610d){return{'model':db[_0x29610d['model']],'as':_0x29610d['as'],'attributes':_0x29610d[_0xca6b('0x24')],'include':_0x29610d[_0xca6b('0x27')]?_[_0xca6b('0x26')](_0x29610d[_0xca6b('0x27')],function(_0x3ea0eb){return{'model':db[_0x3ea0eb[_0xca6b('0x28')]],'as':_0x3ea0eb['as'],'attributes':_0x3ea0eb[_0xca6b('0x24')],'include':_0x3ea0eb['include']?_['map'](_0x3ea0eb[_0xca6b('0x27')],function(_0x8a1925){return{'model':db[_0x8a1925[_0xca6b('0x28')]],'as':_0x8a1925['as'],'attributes':_0x8a1925[_0xca6b('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2650df){logger[_0xca6b('0x13')](_0xca6b('0x1e'),_0x1d6d98);logger[_0xca6b('0x14')](_0xca6b('0x1e'),_0x1d6d98,JSON[_0xca6b('0x17')](_0x2650df));_0x132269(_0x2650df);})['catch'](function(_0xdb791){logger[_0xca6b('0x18')](_0xca6b('0x1e'),_0xdb791['message'],_0x1d6d98);_0x1ba9fe(_0x10b571[_0xca6b('0x18')](0x1f4,_0xdb791['message']));});});};exports[_0xca6b('0x29')]=function(_0x32c170){var _0xeca890=this;return new Promise(function(_0x7f8f5,_0x5bc4f8){return db[_0xca6b('0x1f')][_0xca6b('0x2a')]({'raw':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x22')]===undefined?!![]:![]:!![],'where':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x23')]||null:null,'attributes':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x24')]||null:null,'include':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x27')]?_['map'](_0x32c170[_0xca6b('0x21')][_0xca6b('0x27')],function(_0x23d26a){return{'model':db[_0x23d26a[_0xca6b('0x28')]],'as':_0x23d26a['as'],'attributes':_0x23d26a[_0xca6b('0x24')],'include':_0x23d26a[_0xca6b('0x27')]?_[_0xca6b('0x26')](_0x23d26a[_0xca6b('0x27')],function(_0x3c1d7c){return{'model':db[_0x3c1d7c[_0xca6b('0x28')]],'as':_0x3c1d7c['as'],'attributes':_0x3c1d7c[_0xca6b('0x24')],'include':_0x3c1d7c[_0xca6b('0x27')]?_['map'](_0x3c1d7c[_0xca6b('0x27')],function(_0x4064fd){return{'model':db[_0x4064fd['model']],'as':_0x4064fd['as'],'attributes':_0x4064fd[_0xca6b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xca6b('0x2b')](function(_0x2f9225){logger[_0xca6b('0x13')](_0xca6b('0x29'),_0x32c170);logger['debug']('ShowVoiceQueue',_0x32c170,JSON[_0xca6b('0x17')](_0x2f9225));_0x7f8f5(_0x2f9225);})[_0xca6b('0x1d')](function(_0x3f4f8b){logger[_0xca6b('0x18')](_0xca6b('0x29'),_0x3f4f8b[_0xca6b('0x1b')],_0x32c170);_0x5bc4f8(_0xeca890[_0xca6b('0x18')](0x1f4,_0x3f4f8b['message']));});});}; \ No newline at end of file +var _0x5c4e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowVoiceQueue','find','then','lodash','moment','bluebird'];(function(_0xdc5d93,_0x594c9c){var _0x8455e7=function(_0x2e7078){while(--_0x2e7078){_0xdc5d93['push'](_0xdc5d93['shift']());}};_0x8455e7(++_0x594c9c);}(_0x5c4e,0x72));var _0xe5c4=function(_0x26c7c4,_0x10aad0){_0x26c7c4=_0x26c7c4-0x0;var _0x7a9aa2=_0x5c4e[_0x26c7c4];return _0x7a9aa2;};'use strict';var _=require(_0xe5c4('0x0'));var util=require('util');var moment=require(_0xe5c4('0x1'));var BPromise=require(_0xe5c4('0x2'));var rs=require(_0xe5c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5c4('0x4'))['db'];var utils=require(_0xe5c4('0x5'));var logger=require(_0xe5c4('0x6'))(_0xe5c4('0x7'));var config=require(_0xe5c4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe5c4('0x9')]({'port':0x232a});config[_0xe5c4('0xa')]=_['defaults'](config[_0xe5c4('0xa')],{'host':_0xe5c4('0xb'),'port':0x18eb});var socket=require(_0xe5c4('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2050cf,_0x1cbadf,_0x37242e){return new BPromise(function(_0x488950,_0x2b84e0){return client[_0xe5c4('0xd')](_0x2050cf,_0x37242e)['then'](function(_0x5259b7){logger['info'](_0xe5c4('0xe'),_0x1cbadf,_0xe5c4('0xf'));logger[_0xe5c4('0x10')](_0xe5c4('0x11'),_0x1cbadf,'request\x20sent',JSON[_0xe5c4('0x12')](_0x5259b7));if(_0x5259b7[_0xe5c4('0x13')]){if(_0x5259b7[_0xe5c4('0x13')][_0xe5c4('0x14')]===0x1f4){logger[_0xe5c4('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x1cbadf,_0x5259b7[_0xe5c4('0x13')][_0xe5c4('0x15')]);return _0x2b84e0(_0x5259b7[_0xe5c4('0x13')]['message']);}logger[_0xe5c4('0x13')](_0xe5c4('0xe'),_0x1cbadf,_0x5259b7[_0xe5c4('0x13')][_0xe5c4('0x15')]);return _0x488950(_0x5259b7[_0xe5c4('0x13')][_0xe5c4('0x15')]);}else{logger[_0xe5c4('0x16')](_0xe5c4('0xe'),_0x1cbadf,_0xe5c4('0xf'));_0x488950(_0x5259b7[_0xe5c4('0x17')][_0xe5c4('0x15')]);}})[_0xe5c4('0x18')](function(_0x3b3077){logger['error'](_0xe5c4('0xe'),_0x1cbadf,_0x3b3077);_0x2b84e0(_0x3b3077);});});}exports[_0xe5c4('0x19')]=function(_0x4a2b98){var _0x29c771=this;return new Promise(function(_0x5f477f,_0x1b97aa){return db[_0xe5c4('0x1a')][_0xe5c4('0x1b')]({'raw':_0x4a2b98[_0xe5c4('0x1c')]?_0x4a2b98['options'][_0xe5c4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a2b98[_0xe5c4('0x1c')]?_0x4a2b98[_0xe5c4('0x1c')][_0xe5c4('0x1e')]||null:null,'attributes':_0x4a2b98[_0xe5c4('0x1c')]?_0x4a2b98[_0xe5c4('0x1c')]['attributes']||null:null,'limit':_0x4a2b98[_0xe5c4('0x1c')]?_0x4a2b98[_0xe5c4('0x1c')][_0xe5c4('0x1f')]||null:null,'include':_0x4a2b98[_0xe5c4('0x1c')]?_0x4a2b98['options'][_0xe5c4('0x20')]?_[_0xe5c4('0x21')](_0x4a2b98[_0xe5c4('0x1c')]['include'],function(_0x20367d){return{'model':db[_0x20367d[_0xe5c4('0x22')]],'as':_0x20367d['as'],'attributes':_0x20367d[_0xe5c4('0x23')],'include':_0x20367d[_0xe5c4('0x20')]?_['map'](_0x20367d['include'],function(_0x53a878){return{'model':db[_0x53a878[_0xe5c4('0x22')]],'as':_0x53a878['as'],'attributes':_0x53a878['attributes'],'include':_0x53a878[_0xe5c4('0x20')]?_[_0xe5c4('0x21')](_0x53a878[_0xe5c4('0x20')],function(_0x5e139c){return{'model':db[_0x5e139c['model']],'as':_0x5e139c['as'],'attributes':_0x5e139c[_0xe5c4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13fda8){logger[_0xe5c4('0x16')](_0xe5c4('0x19'),_0x4a2b98);logger[_0xe5c4('0x10')](_0xe5c4('0x19'),_0x4a2b98,JSON['stringify'](_0x13fda8));_0x5f477f(_0x13fda8);})[_0xe5c4('0x18')](function(_0x1f8549){logger[_0xe5c4('0x13')](_0xe5c4('0x19'),_0x1f8549[_0xe5c4('0x15')],_0x4a2b98);_0x1b97aa(_0x29c771['error'](0x1f4,_0x1f8549[_0xe5c4('0x15')]));});});};exports[_0xe5c4('0x24')]=function(_0x309632){var _0x5371cb=this;return new Promise(function(_0x609fc,_0x2d525c){return db['VoiceQueue'][_0xe5c4('0x25')]({'raw':_0x309632['options']?_0x309632[_0xe5c4('0x1c')][_0xe5c4('0x1d')]===undefined?!![]:![]:!![],'where':_0x309632[_0xe5c4('0x1c')]?_0x309632[_0xe5c4('0x1c')][_0xe5c4('0x1e')]||null:null,'attributes':_0x309632['options']?_0x309632['options']['attributes']||null:null,'include':_0x309632['options']?_0x309632[_0xe5c4('0x1c')][_0xe5c4('0x20')]?_[_0xe5c4('0x21')](_0x309632[_0xe5c4('0x1c')][_0xe5c4('0x20')],function(_0x24f47b){return{'model':db[_0x24f47b[_0xe5c4('0x22')]],'as':_0x24f47b['as'],'attributes':_0x24f47b['attributes'],'include':_0x24f47b[_0xe5c4('0x20')]?_[_0xe5c4('0x21')](_0x24f47b[_0xe5c4('0x20')],function(_0x1aee13){return{'model':db[_0x1aee13[_0xe5c4('0x22')]],'as':_0x1aee13['as'],'attributes':_0x1aee13[_0xe5c4('0x23')],'include':_0x1aee13[_0xe5c4('0x20')]?_[_0xe5c4('0x21')](_0x1aee13[_0xe5c4('0x20')],function(_0x41f661){return{'model':db[_0x41f661[_0xe5c4('0x22')]],'as':_0x41f661['as'],'attributes':_0x41f661[_0xe5c4('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe5c4('0x26')](function(_0x35b282){logger['info'](_0xe5c4('0x24'),_0x309632);logger[_0xe5c4('0x10')](_0xe5c4('0x24'),_0x309632,JSON['stringify'](_0x35b282));_0x609fc(_0x35b282);})['catch'](function(_0x1f810f){logger[_0xe5c4('0x13')](_0xe5c4('0x24'),_0x1f810f[_0xe5c4('0x15')],_0x309632);_0x2d525c(_0x5371cb['error'](0x1f4,_0x1f810f[_0xe5c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f9d390d..3530bcd 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 _0x1668=['register','length','voiceQueue:','./voiceQueue.events','removeListener'];(function(_0x2b2ae0,_0xf2d050){var _0x28a66d=function(_0x20cf45){while(--_0x20cf45){_0x2b2ae0['push'](_0x2b2ae0['shift']());}};_0x28a66d(++_0xf2d050);}(_0x1668,0xee));var _0x8166=function(_0x46f5ea,_0x1af440){_0x46f5ea=_0x46f5ea-0x0;var _0x4ef12d=_0x1668[_0x46f5ea];return _0x4ef12d;};'use strict';var VoiceQueueEvents=require(_0x8166('0x0'));var events=['save','remove','update'];function createListener(_0x49ade5,_0x1c28cc){return function(_0x42cac2){_0x1c28cc['emit'](_0x49ade5,_0x42cac2);};}function removeListener(_0x4ae3e1,_0x40a176){return function(){VoiceQueueEvents[_0x8166('0x1')](_0x4ae3e1,_0x40a176);};}exports[_0x8166('0x2')]=function(_0x2ac9bb){for(var _0x817d9d=0x0,_0x23bc74=events[_0x8166('0x3')];_0x817d9d<_0x23bc74;_0x817d9d++){var _0x385751=events[_0x817d9d];var _0x5ecf7e=createListener(_0x8166('0x4')+_0x385751,_0x2ac9bb);VoiceQueueEvents['on'](_0x385751,_0x5ecf7e);}}; \ No newline at end of file +var _0x0625=['./voiceQueue.events','save','remove','emit','removeListener','length'];(function(_0x2797ca,_0x437402){var _0x1ea55f=function(_0x373cf1){while(--_0x373cf1){_0x2797ca['push'](_0x2797ca['shift']());}};_0x1ea55f(++_0x437402);}(_0x0625,0x7e));var _0x5062=function(_0x159cdc,_0x4a239d){_0x159cdc=_0x159cdc-0x0;var _0x560f0d=_0x0625[_0x159cdc];return _0x560f0d;};'use strict';var VoiceQueueEvents=require(_0x5062('0x0'));var events=[_0x5062('0x1'),_0x5062('0x2'),'update'];function createListener(_0x358aa5,_0x363afb){return function(_0x184ee4){_0x363afb[_0x5062('0x3')](_0x358aa5,_0x184ee4);};}function removeListener(_0x311068,_0x2a305d){return function(){VoiceQueueEvents[_0x5062('0x4')](_0x311068,_0x2a305d);};}exports['register']=function(_0x8e4631){for(var _0x4d329b=0x0,_0x2bc083=events[_0x5062('0x5')];_0x4d329b<_0x2bc083;_0x4d329b++){var _0x3aa7b7=events[_0x4d329b];var _0x55d952=createListener('voiceQueue:'+_0x3aa7b7,_0x8e4631);VoiceQueueEvents['on'](_0x3aa7b7,_0x55d952);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 67968ab..b022ae9 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 _0xcfa7=['destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','show','post','create','put','update','delete'];(function(_0x563d85,_0x5164ec){var _0x128f7f=function(_0x529ba2){while(--_0x529ba2){_0x563d85['push'](_0x563d85['shift']());}};_0x128f7f(++_0x5164ec);}(_0xcfa7,0xdd));var _0x7cfa=function(_0x5a49ae,_0x1f6582){_0x5a49ae=_0x5a49ae-0x0;var _0x225918=_0xcfa7[_0x5a49ae];return _0x225918;};'use strict';var multer=require(_0x7cfa('0x0'));var util=require(_0x7cfa('0x1'));var path=require(_0x7cfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7cfa('0x4'));var interaction=require(_0x7cfa('0x5'));var config=require(_0x7cfa('0x6'));var controller=require(_0x7cfa('0x7'));router[_0x7cfa('0x8')]('/',auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xa')]);router[_0x7cfa('0x8')]('/describe',auth[_0x7cfa('0x9')](),controller['describe']);router[_0x7cfa('0x8')](_0x7cfa('0xb'),auth[_0x7cfa('0x9')](),controller['getVoiceQueuesReport']);router['get'](_0x7cfa('0xc'),auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xd')]);router[_0x7cfa('0xe')]('/',auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xf')]);router[_0x7cfa('0x10')](_0x7cfa('0xc'),auth[_0x7cfa('0x9')](),controller[_0x7cfa('0x11')]);router[_0x7cfa('0x12')](_0x7cfa('0xc'),auth['isAuthenticated'](),controller[_0x7cfa('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe9a6=['/:id','delete','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','post','put'];(function(_0x5a4526,_0x521684){var _0x4d5f94=function(_0x240bd6){while(--_0x240bd6){_0x5a4526['push'](_0x5a4526['shift']());}};_0x4d5f94(++_0x521684);}(_0xe9a6,0x7b));var _0x6e9a=function(_0xba9ce3,_0xe1816d){_0xba9ce3=_0xba9ce3-0x0;var _0x580c36=_0xe9a6[_0xba9ce3];return _0x580c36;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require('util');var path=require(_0x6e9a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e9a('0x2')]();var fs_extra=require(_0x6e9a('0x3'));var auth=require(_0x6e9a('0x4'));var interaction=require(_0x6e9a('0x5'));var config=require(_0x6e9a('0x6'));var controller=require(_0x6e9a('0x7'));router[_0x6e9a('0x8')]('/',auth[_0x6e9a('0x9')](),controller[_0x6e9a('0xa')]);router[_0x6e9a('0x8')](_0x6e9a('0xb'),auth[_0x6e9a('0x9')](),controller[_0x6e9a('0xc')]);router[_0x6e9a('0x8')]('/index',auth['isAuthenticated'](),controller[_0x6e9a('0xd')]);router[_0x6e9a('0x8')]('/:id',auth[_0x6e9a('0x9')](),controller[_0x6e9a('0xe')]);router[_0x6e9a('0xf')]('/',auth[_0x6e9a('0x9')](),controller['create']);router[_0x6e9a('0x10')](_0x6e9a('0x11'),auth[_0x6e9a('0x9')](),controller['update']);router[_0x6e9a('0x12')](_0x6e9a('0x11'),auth[_0x6e9a('0x9')](),controller[_0x6e9a('0x13')]);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 8dedb32..e0ce73d 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 _0x2440=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x770601,_0x5af16a){var _0x37632c=function(_0x4f1476){while(--_0x4f1476){_0x770601['push'](_0x770601['shift']());}};_0x37632c(++_0x5af16a);}(_0x2440,0x9b));var _0x0244=function(_0x46909b,_0xb8582e){_0x46909b=_0x46909b-0x0;var _0x6d3521=_0x2440[_0x46909b];return _0x6d3521;};'use strict';var Sequelize=require(_0x0244('0x0'));var moment=require(_0x0244('0x1'));module[_0x0244('0x2')]={'type':{'type':Sequelize[_0x0244('0x3')]},'uniqueid':{'type':Sequelize[_0x0244('0x3')]},'calleridnum':{'type':Sequelize[_0x0244('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0244('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0244('0x4')],'set':function(_0x26903e){var _0x365be5=moment(_0x26903e);var _0x338633=moment(this[_0x0244('0x5')](_0x0244('0x6')))[_0x0244('0x7')](_0x0244('0x8'));var _0x3b0ec4=_0x365be5[_0x0244('0x9')](_0x338633,_0x0244('0xa'));this[_0x0244('0xb')](_0x0244('0xc'),_0x26903e);this[_0x0244('0xb')](_0x0244('0xd'),_0x3b0ec4||null);}},'position':{'type':Sequelize[_0x0244('0xe')]},'count':{'type':Sequelize[_0x0244('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerexit':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0244('0x3')],'comment':_0x0244('0x10')},'originalposition':{'type':Sequelize[_0x0244('0xe')]},'channel':{'type':Sequelize[_0x0244('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0244('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0244('0x3')]},'context':{'type':Sequelize[_0x0244('0x3')]},'exten':{'type':Sequelize[_0x0244('0x3')]},'priority':{'type':Sequelize[_0x0244('0x3')]},'holdtime':{'type':Sequelize[_0x0244('0xe')]},'mohtime':{'type':Sequelize[_0x0244('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0244('0x3')]},'transfer':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0244('0x3')],'comment':_0x0244('0x11')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x0244('0x3')]},'disposition':{'type':Sequelize[_0x0244('0x3')]},'secondDisposition':{'type':Sequelize[_0x0244('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x0244('0x3')]}}; \ No newline at end of file +var _0xf38d=['sequelize','moment','STRING','DATE','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xf38d,0x118));var _0xdf38=function(_0x1d40db,_0x10940c){_0x1d40db=_0x1d40db-0x0;var _0x71a571=_0xf38d[_0x1d40db];return _0x71a571;};'use strict';var Sequelize=require(_0xdf38('0x0'));var moment=require(_0xdf38('0x1'));module['exports']={'type':{'type':Sequelize[_0xdf38('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf38('0x2')]},'queue':{'type':Sequelize[_0xdf38('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xdf38('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x58da9d){var _0x22d98d=moment(_0x58da9d);var _0x462d8d=moment(this['getDataValue'](_0xdf38('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2e0c7b=_0x22d98d[_0xdf38('0x5')](_0x462d8d,_0xdf38('0x6'));this[_0xdf38('0x7')](_0xdf38('0x8'),_0x58da9d);this[_0xdf38('0x7')](_0xdf38('0x9'),_0x2e0c7b||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xdf38('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xdf38('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xdf38('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xdf38('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xdf38('0x2')],'comment':_0xdf38('0xc')},'originalposition':{'type':Sequelize[_0xdf38('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xdf38('0x2')]},'accountcode':{'type':Sequelize[_0xdf38('0x2')]},'context':{'type':Sequelize[_0xdf38('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdf38('0x2')]},'holdtime':{'type':Sequelize[_0xdf38('0xa')]},'mohtime':{'type':Sequelize[_0xdf38('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdf38('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xdf38('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdf38('0x2')],'comment':_0xdf38('0xd')},'transferexten':{'type':Sequelize[_0xdf38('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xdf38('0x2')]},'secondDisposition':{'type':Sequelize[_0xdf38('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xdf38('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5ffa3d5..d6eaa51 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 _0xd31f=['VoiceQueueReport','findAll','rows','show','params','keys','length','include','find','catch','create','update','body','describe','getVoiceQueuesReport','rawAttributes','order','pick','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x5755ff,_0x4ba487){var _0xd361ad=function(_0x34ba60){while(--_0x34ba60){_0x5755ff['push'](_0x5755ff['shift']());}};_0xd361ad(++_0x4ba487);}(_0xd31f,0x1a7));var _0xfd31=function(_0x9b243d,_0x344c5d){_0x9b243d=_0x9b243d-0x0;var _0x375c79=_0xd31f[_0x9b243d];return _0x375c79;};'use strict';var emlformat=require(_0xfd31('0x0'));var rimraf=require(_0xfd31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd31('0x2'));var moment=require('moment');var BPromise=require(_0xfd31('0x3'));var Mustache=require(_0xfd31('0x4'));var util=require('util');var path=require(_0xfd31('0x5'));var sox=require(_0xfd31('0x6'));var csv=require(_0xfd31('0x7'));var ejs=require(_0xfd31('0x8'));var fs=require('fs');var fs_extra=require(_0xfd31('0x9'));var _=require(_0xfd31('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfd31('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfd31('0xc'));var Papa=require(_0xfd31('0xd'));var Redis=require(_0xfd31('0xe'));var authService=require(_0xfd31('0xf'));var qs=require(_0xfd31('0x10'));var as=require(_0xfd31('0x11'));var hardwareService=require(_0xfd31('0x12'));var logger=require(_0xfd31('0x13'))('api');var utils=require(_0xfd31('0x14'));var config=require(_0xfd31('0x15'));var licenseUtil=require(_0xfd31('0x16'));var db=require('../../mysqldb')['db'];config[_0xfd31('0x17')]=_[_0xfd31('0x18')](config[_0xfd31('0x17')],{'host':_0xfd31('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd31('0x17')]));require(_0xfd31('0x1a'))[_0xfd31('0x1b')](socket);function respondWithStatusCode(_0x3a8f34,_0x1668f7){_0x1668f7=_0x1668f7||0xcc;return function(_0x48a4b3){if(_0x48a4b3){return _0x3a8f34[_0xfd31('0x1c')](_0x1668f7);}return _0x3a8f34[_0xfd31('0x1d')](_0x1668f7)[_0xfd31('0x1e')]();};}function respondWithResult(_0x1c4fa3,_0xb024f7){_0xb024f7=_0xb024f7||0xc8;return function(_0x1fc256){if(_0x1fc256){return _0x1c4fa3['status'](_0xb024f7)[_0xfd31('0x1f')](_0x1fc256);}};}function respondWithFilteredResult(_0x244e4a,_0x499cd6){return function(_0x28c628){if(_0x28c628){var _0x248151=typeof _0x499cd6[_0xfd31('0x20')]===_0xfd31('0x21')&&typeof _0x499cd6[_0xfd31('0x22')]==='undefined';var _0x2e46d3=_0x28c628[_0xfd31('0x23')];var _0x4e77da=_0x248151?0x0:_0x499cd6['offset'];var _0x98b8df=_0x248151?_0x28c628[_0xfd31('0x23')]:_0x499cd6[_0xfd31('0x20')]+_0x499cd6[_0xfd31('0x22')];var _0x172584;if(_0x98b8df>=_0x2e46d3){_0x98b8df=_0x2e46d3;_0x172584=0xc8;}else{_0x172584=0xce;}_0x244e4a[_0xfd31('0x1d')](_0x172584);return _0x244e4a['set'](_0xfd31('0x24'),_0x4e77da+'-'+_0x98b8df+'/'+_0x2e46d3)['json'](_0x28c628);}return null;};}function patchUpdates(_0x5c5769){return function(_0xb471c8){try{jsonpatch['apply'](_0xb471c8,_0x5c5769,!![]);}catch(_0x3b08a4){return BPromise[_0xfd31('0x25')](_0x3b08a4);}return _0xb471c8['save']();};}function saveUpdates(_0x371a38,_0x2ae6bd){return function(_0xa8ce72){if(_0xa8ce72){return _0xa8ce72['update'](_0x371a38)[_0xfd31('0x26')](function(_0x482c5a){return _0x482c5a;});}return null;};}function removeEntity(_0x59004c,_0x32e9c9){return function(_0x241f29){if(_0x241f29){return _0x241f29[_0xfd31('0x27')]()[_0xfd31('0x26')](function(){_0x59004c[_0xfd31('0x1d')](0xcc)[_0xfd31('0x1e')]();});}};}function handleEntityNotFound(_0x1747ba,_0xda5c81){return function(_0x44ef08){if(!_0x44ef08){_0x1747ba[_0xfd31('0x1c')](0x194);}return _0x44ef08;};}function handleError(_0xd88041,_0x43abe6){_0x43abe6=_0x43abe6||0x1f4;return function(_0x4421cf){logger[_0xfd31('0x28')](_0x4421cf['stack']);if(_0x4421cf[_0xfd31('0x29')]){delete _0x4421cf[_0xfd31('0x29')];}_0xd88041[_0xfd31('0x1d')](_0x43abe6)[_0xfd31('0x2a')](_0x4421cf);};}exports[_0xfd31('0x2b')]=function(_0x54ceef,_0x501f77){var _0x2a8815={},_0x2c0b54={},_0x11956c={'count':0x0,'rows':[]};var _0x3f1a1f=_[_0xfd31('0x2c')](db['VoiceQueueReport']['rawAttributes'],function(_0x511ce9){return{'name':_0x511ce9[_0xfd31('0x2d')],'type':_0x511ce9[_0xfd31('0x2e')][_0xfd31('0x2f')]};});_0x2c0b54[_0xfd31('0x30')]=_[_0xfd31('0x2c')](_0x3f1a1f,_0xfd31('0x29'));_0x2c0b54['query']=_['keys'](_0x54ceef[_0xfd31('0x31')]);_0x2c0b54[_0xfd31('0x32')]=_[_0xfd31('0x33')](_0x2c0b54[_0xfd31('0x30')],_0x2c0b54[_0xfd31('0x31')]);_0x2a8815[_0xfd31('0x34')]=_['intersection'](_0x2c0b54['model'],qs[_0xfd31('0x35')](_0x54ceef[_0xfd31('0x31')]['fields']));_0x2a8815[_0xfd31('0x34')]=_0x2a8815[_0xfd31('0x34')]['length']?_0x2a8815[_0xfd31('0x34')]:_0x2c0b54[_0xfd31('0x30')];if(!_0x54ceef[_0xfd31('0x31')][_0xfd31('0x36')](_0xfd31('0x37'))){_0x2a8815['limit']=qs[_0xfd31('0x22')](_0x54ceef[_0xfd31('0x31')]['limit']);_0x2a8815['offset']=qs[_0xfd31('0x20')](_0x54ceef['query']['offset']);}_0x2a8815['order']=qs[_0xfd31('0x38')](_0x54ceef[_0xfd31('0x31')]['sort']);_0x2a8815[_0xfd31('0x39')]=qs[_0xfd31('0x32')](_['pick'](_0x54ceef[_0xfd31('0x31')],_0x2c0b54[_0xfd31('0x32')]),_0x3f1a1f);if(_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3a')]){_0x2a8815['where']=_[_0xfd31('0x3b')](_0x2a8815[_0xfd31('0x39')],{'$or':_['map'](_0x3f1a1f,function(_0x6cdb6){if(_0x6cdb6['type']!==_0xfd31('0x3c')){var _0x5399c2={};_0x5399c2[_0x6cdb6[_0xfd31('0x29')]]={'$like':'%'+_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3a')]+'%'};return _0x5399c2;}})});}_0x2a8815=_[_0xfd31('0x3b')]({},_0x2a8815,_0x54ceef[_0xfd31('0x3d')]);var _0x3074df={'where':_0x2a8815[_0xfd31('0x39')]};return db['VoiceQueueReport'][_0xfd31('0x23')](_0x3074df)[_0xfd31('0x26')](function(_0x44a5b5){_0x11956c[_0xfd31('0x23')]=_0x44a5b5;if(_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3e')]){_0x2a8815['include']=[{'all':!![]}];}return db[_0xfd31('0x3f')][_0xfd31('0x40')](_0x2a8815);})['then'](function(_0x22b219){_0x11956c[_0xfd31('0x41')]=_0x22b219;return _0x11956c;})[_0xfd31('0x26')](respondWithFilteredResult(_0x501f77,_0x2a8815))['catch'](handleError(_0x501f77,null));};exports[_0xfd31('0x42')]=function(_0x4ece61,_0x4c1524){var _0x10a979={'raw':![],'where':{'id':_0x4ece61[_0xfd31('0x43')]['id']}},_0x56b43c={};_0x56b43c['model']=_[_0xfd31('0x44')](db[_0xfd31('0x3f')]['rawAttributes']);_0x56b43c[_0xfd31('0x31')]=_[_0xfd31('0x44')](_0x4ece61['query']);_0x56b43c['filters']=_['intersection'](_0x56b43c['model'],_0x56b43c[_0xfd31('0x31')]);_0x10a979[_0xfd31('0x34')]=_[_0xfd31('0x33')](_0x56b43c[_0xfd31('0x30')],qs[_0xfd31('0x35')](_0x4ece61[_0xfd31('0x31')]['fields']));_0x10a979[_0xfd31('0x34')]=_0x10a979['attributes'][_0xfd31('0x45')]?_0x10a979[_0xfd31('0x34')]:_0x56b43c[_0xfd31('0x30')];if(_0x4ece61[_0xfd31('0x31')]['includeAll']){_0x10a979[_0xfd31('0x46')]=[{'all':!![]}];}_0x10a979=_[_0xfd31('0x3b')]({},_0x10a979,_0x4ece61['options']);return db[_0xfd31('0x3f')][_0xfd31('0x47')](_0x10a979)[_0xfd31('0x26')](handleEntityNotFound(_0x4c1524,null))[_0xfd31('0x26')](respondWithResult(_0x4c1524,null))[_0xfd31('0x48')](handleError(_0x4c1524,null));};exports[_0xfd31('0x49')]=function(_0x394a06,_0x1a7ce2){return db[_0xfd31('0x3f')][_0xfd31('0x49')](_0x394a06['body'],{})['then'](respondWithResult(_0x1a7ce2,0xc9))[_0xfd31('0x48')](handleError(_0x1a7ce2,null));};exports[_0xfd31('0x4a')]=function(_0x1f43c5,_0x58f98c){if(_0x1f43c5[_0xfd31('0x4b')]['id']){delete _0x1f43c5[_0xfd31('0x4b')]['id'];}return db[_0xfd31('0x3f')][_0xfd31('0x47')]({'where':{'id':_0x1f43c5[_0xfd31('0x43')]['id']}})['then'](handleEntityNotFound(_0x58f98c,null))[_0xfd31('0x26')](saveUpdates(_0x1f43c5[_0xfd31('0x4b')],null))['then'](respondWithResult(_0x58f98c,null))[_0xfd31('0x48')](handleError(_0x58f98c,null));};exports['destroy']=function(_0x45acea,_0x50e0c7){return db[_0xfd31('0x3f')][_0xfd31('0x47')]({'where':{'id':_0x45acea['params']['id']}})[_0xfd31('0x26')](handleEntityNotFound(_0x50e0c7,null))[_0xfd31('0x26')](removeEntity(_0x50e0c7,null))['catch'](handleError(_0x50e0c7,null));};exports[_0xfd31('0x4c')]=function(_0x31d735,_0x4126d8){return db['VoiceQueueReport'][_0xfd31('0x4c')]()[_0xfd31('0x26')](respondWithResult(_0x4126d8,null))[_0xfd31('0x48')](handleError(_0x4126d8,null));};exports[_0xfd31('0x4d')]=function(_0x561ab3,_0x4e430e){var _0x8f17fb={},_0x5b4c79={},_0x565b2d={'count':0x0,'rows':[]};_0x5b4c79[_0xfd31('0x30')]=_[_0xfd31('0x44')](db[_0xfd31('0x3f')][_0xfd31('0x4e')]);_0x5b4c79[_0xfd31('0x31')]=_[_0xfd31('0x44')](_0x561ab3['query']);_0x5b4c79['filters']=_['intersection'](_0x5b4c79['model'],_0x5b4c79[_0xfd31('0x31')]);_0x8f17fb[_0xfd31('0x34')]=_['intersection'](_0x5b4c79[_0xfd31('0x30')],qs[_0xfd31('0x35')](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x35')]));_0x8f17fb[_0xfd31('0x34')]=_0x8f17fb['attributes'][_0xfd31('0x45')]?_0x8f17fb[_0xfd31('0x34')]:_0x5b4c79[_0xfd31('0x30')];if(!_0x561ab3[_0xfd31('0x31')]['hasOwnProperty'](_0xfd31('0x37'))){_0x8f17fb[_0xfd31('0x22')]=qs['limit'](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x22')]);_0x8f17fb[_0xfd31('0x20')]=qs[_0xfd31('0x20')](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x20')]);}_0x8f17fb[_0xfd31('0x4f')]=qs['sort'](_0x561ab3['query'][_0xfd31('0x38')]);_0x8f17fb[_0xfd31('0x39')]=qs[_0xfd31('0x32')](_[_0xfd31('0x50')](_0x561ab3[_0xfd31('0x31')],_0x5b4c79[_0xfd31('0x32')]));if(_0x561ab3[_0xfd31('0x31')][_0xfd31('0x3a')]){_0x8f17fb[_0xfd31('0x39')]=_[_0xfd31('0x3b')](_0x8f17fb['where'],{'$or':_['map'](_0x8f17fb[_0xfd31('0x34')],function(_0x37bc1a){var _0x14d416={};_0x14d416[_0x37bc1a]={'$like':'%'+_0x561ab3['query'][_0xfd31('0x3a')]+'%'};return _0x14d416;})});}_0x8f17fb=_[_0xfd31('0x3b')]({},_0x8f17fb,_0x561ab3[_0xfd31('0x3d')]);var _0xf5366e={'where':_0x8f17fb['where']};return db[_0xfd31('0x3f')][_0xfd31('0x23')](_0xf5366e)[_0xfd31('0x26')](function(_0x574d49){_0x565b2d['count']=_0x574d49;if(_0x561ab3[_0xfd31('0x31')][_0xfd31('0x3e')]){_0x8f17fb[_0xfd31('0x46')]=[{'all':!![]}];}return db[_0xfd31('0x3f')][_0xfd31('0x40')](_0x8f17fb);})[_0xfd31('0x26')](function(_0x207a39){_0x565b2d['rows']=_0x207a39;return _0x565b2d;})['then'](respondWithFilteredResult(_0x4e430e,_0x8f17fb,_0xfd31('0x4d')))[_0xfd31('0x48')](handleError(_0x4e430e,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x0357=['util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','end','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','params','find','catch','create','update','body','describe','getVoiceQueuesReport','nolimit','rows','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x31bd8b,_0x56fa02){var _0x1506e4=function(_0x51e54d){while(--_0x51e54d){_0x31bd8b['push'](_0x31bd8b['shift']());}};_0x1506e4(++_0x56fa02);}(_0x0357,0x142));var _0x7035=function(_0xf97383,_0x242f75){_0xf97383=_0xf97383-0x0;var _0x506e4e=_0x0357[_0xf97383];return _0x506e4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7035('0x0'));var zipdir=require(_0x7035('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7035('0x2'));var moment=require(_0x7035('0x3'));var BPromise=require(_0x7035('0x4'));var Mustache=require(_0x7035('0x5'));var util=require(_0x7035('0x6'));var path=require(_0x7035('0x7'));var sox=require(_0x7035('0x8'));var csv=require(_0x7035('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7035('0xa'));var _=require('lodash');var squel=require(_0x7035('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7035('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7035('0xd'));var Papa=require(_0x7035('0xe'));var Redis=require(_0x7035('0xf'));var authService=require(_0x7035('0x10'));var qs=require(_0x7035('0x11'));var as=require(_0x7035('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7035('0x13'))(_0x7035('0x14'));var utils=require(_0x7035('0x15'));var config=require(_0x7035('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7035('0x17'))['db'];config[_0x7035('0x18')]=_[_0x7035('0x19')](config[_0x7035('0x18')],{'host':_0x7035('0x1a'),'port':0x18eb});var socket=require(_0x7035('0x1b'))(new Redis(config[_0x7035('0x18')]));require(_0x7035('0x1c'))['register'](socket);function respondWithStatusCode(_0x2d96e2,_0x48b10a){_0x48b10a=_0x48b10a||0xcc;return function(_0x1282a4){if(_0x1282a4){return _0x2d96e2[_0x7035('0x1d')](_0x48b10a);}return _0x2d96e2['status'](_0x48b10a)['end']();};}function respondWithResult(_0x21aca1,_0x3affe3){_0x3affe3=_0x3affe3||0xc8;return function(_0x5c1b70){if(_0x5c1b70){return _0x21aca1[_0x7035('0x1e')](_0x3affe3)[_0x7035('0x1f')](_0x5c1b70);}};}function respondWithFilteredResult(_0x363212,_0x2d65dc){return function(_0x417436){if(_0x417436){var _0x125dd7=typeof _0x2d65dc['offset']===_0x7035('0x20')&&typeof _0x2d65dc[_0x7035('0x21')]==='undefined';var _0x5cdbf7=_0x417436[_0x7035('0x22')];var _0x21f47d=_0x125dd7?0x0:_0x2d65dc[_0x7035('0x23')];var _0x5a0cf1=_0x125dd7?_0x417436[_0x7035('0x22')]:_0x2d65dc[_0x7035('0x23')]+_0x2d65dc[_0x7035('0x21')];var _0x5a9425;if(_0x5a0cf1>=_0x5cdbf7){_0x5a0cf1=_0x5cdbf7;_0x5a9425=0xc8;}else{_0x5a9425=0xce;}_0x363212[_0x7035('0x1e')](_0x5a9425);return _0x363212[_0x7035('0x24')]('Content-Range',_0x21f47d+'-'+_0x5a0cf1+'/'+_0x5cdbf7)[_0x7035('0x1f')](_0x417436);}return null;};}function patchUpdates(_0x1688ec){return function(_0x41935c){try{jsonpatch[_0x7035('0x25')](_0x41935c,_0x1688ec,!![]);}catch(_0x589a52){return BPromise[_0x7035('0x26')](_0x589a52);}return _0x41935c[_0x7035('0x27')]();};}function saveUpdates(_0x5be33b,_0xddd9f1){return function(_0x2b89a0){if(_0x2b89a0){return _0x2b89a0['update'](_0x5be33b)[_0x7035('0x28')](function(_0x37c625){return _0x37c625;});}return null;};}function removeEntity(_0x1acb4a,_0x1b1d55){return function(_0x42c210){if(_0x42c210){return _0x42c210['destroy']()[_0x7035('0x28')](function(){_0x1acb4a[_0x7035('0x1e')](0xcc)[_0x7035('0x29')]();});}};}function handleEntityNotFound(_0x348e6e,_0x457072){return function(_0xef3033){if(!_0xef3033){_0x348e6e[_0x7035('0x1d')](0x194);}return _0xef3033;};}function handleError(_0x353ec8,_0x2c08ba){_0x2c08ba=_0x2c08ba||0x1f4;return function(_0x42deae){logger[_0x7035('0x2a')](_0x42deae[_0x7035('0x2b')]);if(_0x42deae[_0x7035('0x2c')]){delete _0x42deae[_0x7035('0x2c')];}_0x353ec8[_0x7035('0x1e')](_0x2c08ba)['send'](_0x42deae);};}exports[_0x7035('0x2d')]=function(_0x4ae3c6,_0x5e97bc){var _0x15ce71={},_0x3e08a9={},_0x4c4bd3={'count':0x0,'rows':[]};var _0x14c038=_[_0x7035('0x2e')](db[_0x7035('0x2f')][_0x7035('0x30')],function(_0x3fb1ed){return{'name':_0x3fb1ed[_0x7035('0x31')],'type':_0x3fb1ed[_0x7035('0x32')][_0x7035('0x33')]};});_0x3e08a9[_0x7035('0x34')]=_['map'](_0x14c038,_0x7035('0x2c'));_0x3e08a9[_0x7035('0x35')]=_[_0x7035('0x36')](_0x4ae3c6[_0x7035('0x35')]);_0x3e08a9['filters']=_[_0x7035('0x37')](_0x3e08a9['model'],_0x3e08a9[_0x7035('0x35')]);_0x15ce71[_0x7035('0x38')]=_[_0x7035('0x37')](_0x3e08a9[_0x7035('0x34')],qs['fields'](_0x4ae3c6[_0x7035('0x35')][_0x7035('0x39')]));_0x15ce71[_0x7035('0x38')]=_0x15ce71[_0x7035('0x38')][_0x7035('0x3a')]?_0x15ce71['attributes']:_0x3e08a9['model'];if(!_0x4ae3c6['query'][_0x7035('0x3b')]('nolimit')){_0x15ce71['limit']=qs[_0x7035('0x21')](_0x4ae3c6['query'][_0x7035('0x21')]);_0x15ce71[_0x7035('0x23')]=qs[_0x7035('0x23')](_0x4ae3c6['query'][_0x7035('0x23')]);}_0x15ce71[_0x7035('0x3c')]=qs[_0x7035('0x3d')](_0x4ae3c6['query'][_0x7035('0x3d')]);_0x15ce71['where']=qs[_0x7035('0x3e')](_[_0x7035('0x3f')](_0x4ae3c6['query'],_0x3e08a9['filters']),_0x14c038);if(_0x4ae3c6[_0x7035('0x35')][_0x7035('0x40')]){_0x15ce71[_0x7035('0x41')]=_[_0x7035('0x42')](_0x15ce71[_0x7035('0x41')],{'$or':_[_0x7035('0x2e')](_0x14c038,function(_0x2d4ab4){if(_0x2d4ab4[_0x7035('0x32')]!==_0x7035('0x43')){var _0x1978e4={};_0x1978e4[_0x2d4ab4[_0x7035('0x2c')]]={'$like':'%'+_0x4ae3c6['query'][_0x7035('0x40')]+'%'};return _0x1978e4;}})});}_0x15ce71=_[_0x7035('0x42')]({},_0x15ce71,_0x4ae3c6[_0x7035('0x44')]);var _0x437bab={'where':_0x15ce71[_0x7035('0x41')]};return db[_0x7035('0x2f')]['count'](_0x437bab)['then'](function(_0x3e14f2){_0x4c4bd3[_0x7035('0x22')]=_0x3e14f2;if(_0x4ae3c6[_0x7035('0x35')][_0x7035('0x45')]){_0x15ce71[_0x7035('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x15ce71);})[_0x7035('0x28')](function(_0x4723c2){_0x4c4bd3['rows']=_0x4723c2;return _0x4c4bd3;})[_0x7035('0x28')](respondWithFilteredResult(_0x5e97bc,_0x15ce71))['catch'](handleError(_0x5e97bc,null));};exports[_0x7035('0x47')]=function(_0x6a7e2d,_0x26a053){var _0x149d02={'raw':![],'where':{'id':_0x6a7e2d[_0x7035('0x48')]['id']}},_0x2c80cd={};_0x2c80cd['model']=_[_0x7035('0x36')](db[_0x7035('0x2f')]['rawAttributes']);_0x2c80cd[_0x7035('0x35')]=_[_0x7035('0x36')](_0x6a7e2d['query']);_0x2c80cd[_0x7035('0x3e')]=_['intersection'](_0x2c80cd[_0x7035('0x34')],_0x2c80cd[_0x7035('0x35')]);_0x149d02[_0x7035('0x38')]=_[_0x7035('0x37')](_0x2c80cd[_0x7035('0x34')],qs[_0x7035('0x39')](_0x6a7e2d[_0x7035('0x35')][_0x7035('0x39')]));_0x149d02['attributes']=_0x149d02[_0x7035('0x38')][_0x7035('0x3a')]?_0x149d02[_0x7035('0x38')]:_0x2c80cd[_0x7035('0x34')];if(_0x6a7e2d[_0x7035('0x35')]['includeAll']){_0x149d02['include']=[{'all':!![]}];}_0x149d02=_[_0x7035('0x42')]({},_0x149d02,_0x6a7e2d[_0x7035('0x44')]);return db[_0x7035('0x2f')][_0x7035('0x49')](_0x149d02)['then'](handleEntityNotFound(_0x26a053,null))[_0x7035('0x28')](respondWithResult(_0x26a053,null))[_0x7035('0x4a')](handleError(_0x26a053,null));};exports[_0x7035('0x4b')]=function(_0x16758a,_0x19e2bb){return db[_0x7035('0x2f')][_0x7035('0x4b')](_0x16758a['body'],{})[_0x7035('0x28')](respondWithResult(_0x19e2bb,0xc9))[_0x7035('0x4a')](handleError(_0x19e2bb,null));};exports[_0x7035('0x4c')]=function(_0x72e581,_0x45e599){if(_0x72e581[_0x7035('0x4d')]['id']){delete _0x72e581['body']['id'];}return db[_0x7035('0x2f')]['find']({'where':{'id':_0x72e581[_0x7035('0x48')]['id']}})[_0x7035('0x28')](handleEntityNotFound(_0x45e599,null))[_0x7035('0x28')](saveUpdates(_0x72e581[_0x7035('0x4d')],null))[_0x7035('0x28')](respondWithResult(_0x45e599,null))[_0x7035('0x4a')](handleError(_0x45e599,null));};exports['destroy']=function(_0x3e2417,_0x345fe3){return db[_0x7035('0x2f')]['find']({'where':{'id':_0x3e2417[_0x7035('0x48')]['id']}})[_0x7035('0x28')](handleEntityNotFound(_0x345fe3,null))['then'](removeEntity(_0x345fe3,null))[_0x7035('0x4a')](handleError(_0x345fe3,null));};exports[_0x7035('0x4e')]=function(_0x3ec165,_0xdf7171){return db[_0x7035('0x2f')][_0x7035('0x4e')]()[_0x7035('0x28')](respondWithResult(_0xdf7171,null))[_0x7035('0x4a')](handleError(_0xdf7171,null));};exports[_0x7035('0x4f')]=function(_0x42a762,_0x4c59c5){var _0x5aca9d={},_0x5d03f9={},_0x3f310c={'count':0x0,'rows':[]};_0x5d03f9['model']=_['keys'](db['VoiceQueueReport'][_0x7035('0x30')]);_0x5d03f9[_0x7035('0x35')]=_[_0x7035('0x36')](_0x42a762['query']);_0x5d03f9[_0x7035('0x3e')]=_['intersection'](_0x5d03f9[_0x7035('0x34')],_0x5d03f9[_0x7035('0x35')]);_0x5aca9d[_0x7035('0x38')]=_['intersection'](_0x5d03f9[_0x7035('0x34')],qs[_0x7035('0x39')](_0x42a762[_0x7035('0x35')][_0x7035('0x39')]));_0x5aca9d[_0x7035('0x38')]=_0x5aca9d[_0x7035('0x38')]['length']?_0x5aca9d[_0x7035('0x38')]:_0x5d03f9[_0x7035('0x34')];if(!_0x42a762[_0x7035('0x35')][_0x7035('0x3b')](_0x7035('0x50'))){_0x5aca9d[_0x7035('0x21')]=qs[_0x7035('0x21')](_0x42a762['query'][_0x7035('0x21')]);_0x5aca9d[_0x7035('0x23')]=qs[_0x7035('0x23')](_0x42a762['query']['offset']);}_0x5aca9d[_0x7035('0x3c')]=qs[_0x7035('0x3d')](_0x42a762['query'][_0x7035('0x3d')]);_0x5aca9d[_0x7035('0x41')]=qs[_0x7035('0x3e')](_['pick'](_0x42a762['query'],_0x5d03f9[_0x7035('0x3e')]));if(_0x42a762['query'][_0x7035('0x40')]){_0x5aca9d[_0x7035('0x41')]=_[_0x7035('0x42')](_0x5aca9d['where'],{'$or':_[_0x7035('0x2e')](_0x5aca9d['attributes'],function(_0x223043){var _0x110703={};_0x110703[_0x223043]={'$like':'%'+_0x42a762[_0x7035('0x35')][_0x7035('0x40')]+'%'};return _0x110703;})});}_0x5aca9d=_[_0x7035('0x42')]({},_0x5aca9d,_0x42a762[_0x7035('0x44')]);var _0x5a1319={'where':_0x5aca9d[_0x7035('0x41')]};return db['VoiceQueueReport'][_0x7035('0x22')](_0x5a1319)[_0x7035('0x28')](function(_0x519e16){_0x3f310c[_0x7035('0x22')]=_0x519e16;if(_0x42a762[_0x7035('0x35')][_0x7035('0x45')]){_0x5aca9d[_0x7035('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5aca9d);})[_0x7035('0x28')](function(_0x226f35){_0x3f310c[_0x7035('0x51')]=_0x226f35;return _0x3f310c;})[_0x7035('0x28')](respondWithFilteredResult(_0x4c59c5,_0x5aca9d,'getVoiceQueuesReport'))['catch'](handleError(_0x4c59c5,null,_0x7035('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ad406bd..86244c6 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 _0x378e=['remove','emit','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3dff38,_0x120e42){var _0x3d8ca1=function(_0x2e2e1a){while(--_0x2e2e1a){_0x3dff38['push'](_0x3dff38['shift']());}};_0x3d8ca1(++_0x120e42);}(_0x378e,0x133));var _0xe378=function(_0xeb74f,_0x16c8b5){_0xeb74f=_0xeb74f-0x0;var _0x3ab646=_0x378e[_0xeb74f];return _0x3ab646;};'use strict';var EventEmitter=require(_0xe378('0x0'));var VoiceQueueReport=require(_0xe378('0x1'))['db'][_0xe378('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe378('0x3')](0x0);var events={'afterCreate':_0xe378('0x4'),'afterUpdate':'update','afterDestroy':_0xe378('0x5')};function emitEvent(_0x19c0f9){return function(_0x201a56,_0x243902,_0x416ae6){VoiceQueueReportEvents['emit'](_0x19c0f9+':'+_0x201a56['id'],_0x201a56);VoiceQueueReportEvents[_0xe378('0x6')](_0x19c0f9,_0x201a56);_0x416ae6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe378('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xbdd1=['events','VoiceQueueReport','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0xd41f6c,_0x2ee0b2){var _0x4db302=function(_0x1446d9){while(--_0x1446d9){_0xd41f6c['push'](_0xd41f6c['shift']());}};_0x4db302(++_0x2ee0b2);}(_0xbdd1,0xf5));var _0x1bdd=function(_0x4f5f97,_0x1d80c2){_0x4f5f97=_0x4f5f97-0x0;var _0x2c6b94=_0xbdd1[_0x4f5f97];return _0x2c6b94;};'use strict';var EventEmitter=require(_0x1bdd('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1bdd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1bdd('0x2')](0x0);var events={'afterCreate':_0x1bdd('0x3'),'afterUpdate':'update','afterDestroy':_0x1bdd('0x4')};function emitEvent(_0x243f2a){return function(_0x46481c,_0x12ee8b,_0x456b54){VoiceQueueReportEvents['emit'](_0x243f2a+':'+_0x46481c['id'],_0x46481c);VoiceQueueReportEvents['emit'](_0x243f2a,_0x46481c);_0x456b54(null);};}for(var e in events){if(events[_0x1bdd('0x5')](e)){var event=events[e];VoiceQueueReport[_0x1bdd('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 800da18..b3d9974 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 _0x0579=['calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x1b801a,_0x361869){var _0x369776=function(_0x3862fb){while(--_0x3862fb){_0x1b801a['push'](_0x1b801a['shift']());}};_0x369776(++_0x361869);}(_0x0579,0x111));var _0x9057=function(_0x47768a,_0x372ebf){_0x47768a=_0x47768a-0x0;var _0x5252db=_0x0579[_0x47768a];return _0x5252db;};'use strict';var _=require(_0x9057('0x0'));var util=require(_0x9057('0x1'));var logger=require(_0x9057('0x2'))(_0x9057('0x3'));var moment=require(_0x9057('0x4'));var BPromise=require(_0x9057('0x5'));var rp=require(_0x9057('0x6'));var fs=require('fs');var path=require(_0x9057('0x7'));var rimraf=require(_0x9057('0x8'));var config=require(_0x9057('0x9'));var attributes=require(_0x9057('0xa'));module[_0x9057('0xb')]=function(_0x345fc2,_0x2fb7e3){return _0x345fc2[_0x9057('0xc')](_0x9057('0xd'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9057('0xe')]},{'fields':[_0x9057('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a4e=['exports','VoiceQueueReport','report_queue','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x354b61,_0x3a611d){var _0x1aedb4=function(_0x45e8e8){while(--_0x45e8e8){_0x354b61['push'](_0x354b61['shift']());}};_0x1aedb4(++_0x3a611d);}(_0x9a4e,0x1cb));var _0xe9a4=function(_0x294e2c,_0x15b0f6){_0x294e2c=_0x294e2c-0x0;var _0x4501d0=_0x9a4e[_0x294e2c];return _0x4501d0;};'use strict';var _=require(_0xe9a4('0x0'));var util=require(_0xe9a4('0x1'));var logger=require('../../config/logger')(_0xe9a4('0x2'));var moment=require(_0xe9a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9a4('0x4'));var fs=require('fs');var path=require(_0xe9a4('0x5'));var rimraf=require(_0xe9a4('0x6'));var config=require(_0xe9a4('0x7'));var attributes=require(_0xe9a4('0x8'));module[_0xe9a4('0x9')]=function(_0x309805,_0x6da441){return _0x309805['define'](_0xe9a4('0xa'),attributes,{'tableName':_0xe9a4('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7fda385..f4fd72c 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 _0xbc8c=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','stringify','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe0a9d7,_0x334412){var _0x3a820b=function(_0x555cfc){while(--_0x555cfc){_0xe0a9d7['push'](_0xe0a9d7['shift']());}};_0x3a820b(++_0x334412);}(_0xbc8c,0xdf));var _0xcbc8=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xbc8c[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0xcbc8('0x0'));var util=require(_0xcbc8('0x1'));var moment=require('moment');var BPromise=require(_0xcbc8('0x2'));var rs=require(_0xcbc8('0x3'));var fs=require('fs');var Redis=require(_0xcbc8('0x4'));var db=require(_0xcbc8('0x5'))['db'];var utils=require(_0xcbc8('0x6'));var logger=require(_0xcbc8('0x7'))(_0xcbc8('0x8'));var config=require('../../config/environment');var jayson=require(_0xcbc8('0x9'));var client=jayson[_0xcbc8('0xa')][_0xcbc8('0xb')]({'port':0x232a});config[_0xcbc8('0xc')]=_[_0xcbc8('0xd')](config[_0xcbc8('0xc')],{'host':_0xcbc8('0xe'),'port':0x18eb});var socket=require(_0xcbc8('0xf'))(new Redis(config[_0xcbc8('0xc')]));require('./voiceQueueReport.socket')[_0xcbc8('0x10')](socket);function respondWithRpcPromise(_0xefc6f0,_0x297b87,_0x2c6122){return new BPromise(function(_0x50559e,_0xf530f9){return client[_0xcbc8('0x11')](_0xefc6f0,_0x2c6122)['then'](function(_0x4ba5bc){logger[_0xcbc8('0x12')](_0xcbc8('0x13'),_0x297b87,_0xcbc8('0x14'));logger[_0xcbc8('0x15')](_0xcbc8('0x16'),_0x297b87,_0xcbc8('0x14'),JSON['stringify'](_0x4ba5bc));if(_0x4ba5bc[_0xcbc8('0x17')]){if(_0x4ba5bc[_0xcbc8('0x17')][_0xcbc8('0x18')]===0x1f4){logger[_0xcbc8('0x17')](_0xcbc8('0x13'),_0x297b87,_0x4ba5bc['error'][_0xcbc8('0x19')]);return _0xf530f9(_0x4ba5bc['error']['message']);}logger[_0xcbc8('0x17')](_0xcbc8('0x13'),_0x297b87,_0x4ba5bc[_0xcbc8('0x17')][_0xcbc8('0x19')]);return _0x50559e(_0x4ba5bc['error'][_0xcbc8('0x19')]);}else{logger[_0xcbc8('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x297b87,'request\x20sent');_0x50559e(_0x4ba5bc[_0xcbc8('0x1a')]['message']);}})[_0xcbc8('0x1b')](function(_0x1bd97f){logger[_0xcbc8('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x297b87,_0x1bd97f);_0xf530f9(_0x1bd97f);});});}exports[_0xcbc8('0x1c')]=function(_0x3535d0){var _0x22a14b=this;return new Promise(function(_0x45252c,_0x1e02de){return db[_0xcbc8('0x1d')][_0xcbc8('0x1e')]({'raw':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x20')]===undefined?!![]:![]:!![],'where':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')]['where']||null:null,'attributes':_0x3535d0['options']?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x21')]||null:null,'limit':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')]['limit']||null:null,'include':_0x3535d0['options']?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x22')]?_[_0xcbc8('0x23')](_0x3535d0[_0xcbc8('0x1f')]['include'],function(_0x481014){return{'model':db[_0x481014[_0xcbc8('0x24')]],'as':_0x481014['as'],'attributes':_0x481014[_0xcbc8('0x21')],'include':_0x481014[_0xcbc8('0x22')]?_[_0xcbc8('0x23')](_0x481014[_0xcbc8('0x22')],function(_0x2753a0){return{'model':db[_0x2753a0[_0xcbc8('0x24')]],'as':_0x2753a0['as'],'attributes':_0x2753a0[_0xcbc8('0x21')],'include':_0x2753a0[_0xcbc8('0x22')]?_['map'](_0x2753a0['include'],function(_0x5dab8b){return{'model':db[_0x5dab8b[_0xcbc8('0x24')]],'as':_0x5dab8b['as'],'attributes':_0x5dab8b[_0xcbc8('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c92ca){logger['info'](_0xcbc8('0x1c'),_0x3535d0);logger[_0xcbc8('0x15')](_0xcbc8('0x1c'),_0x3535d0,JSON[_0xcbc8('0x25')](_0x4c92ca));_0x45252c(_0x4c92ca);})['catch'](function(_0x3f03a7){logger[_0xcbc8('0x17')](_0xcbc8('0x1c'),_0x3f03a7[_0xcbc8('0x19')],_0x3535d0);_0x1e02de(_0x22a14b[_0xcbc8('0x17')](0x1f4,_0x3f03a7[_0xcbc8('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x51d9fa){var _0x2a7d70=this;return new Promise(function(_0x558119,_0x269d35){return db[_0xcbc8('0x1d')][_0xcbc8('0x26')](_0x51d9fa[_0xcbc8('0x27')],{'raw':_0x51d9fa[_0xcbc8('0x1f')]?_0x51d9fa[_0xcbc8('0x1f')][_0xcbc8('0x20')]===undefined?!![]:![]:!![]})[_0xcbc8('0x28')](function(_0x3c348e){logger[_0xcbc8('0x12')]('CreateVoiceQueueReport',_0x51d9fa);logger[_0xcbc8('0x15')]('CreateVoiceQueueReport',_0x51d9fa,JSON[_0xcbc8('0x25')](_0x3c348e));_0x558119(_0x3c348e);})[_0xcbc8('0x1b')](function(_0x22aa87){logger[_0xcbc8('0x17')](_0xcbc8('0x29'),_0x22aa87[_0xcbc8('0x19')],_0x51d9fa);_0x269d35(_0x2a7d70[_0xcbc8('0x17')](0x1f4,_0x22aa87[_0xcbc8('0x19')]));});});};exports[_0xcbc8('0x2a')]=function(_0x2c2f5b){var _0x5c1f4=this;return new Promise(function(_0x4a50ac,_0x6098bc){return db[_0xcbc8('0x1d')][_0xcbc8('0x2b')](_0x2c2f5b[_0xcbc8('0x27')],{'raw':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b['options'][_0xcbc8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')][_0xcbc8('0x2c')]||null:null,'attributes':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')]['attributes']||null:null,'limit':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')][_0xcbc8('0x2d')]||null:null})[_0xcbc8('0x28')](function(_0x117e4f){logger[_0xcbc8('0x12')](_0xcbc8('0x2a'),_0x2c2f5b);logger[_0xcbc8('0x15')](_0xcbc8('0x2a'),_0x2c2f5b,JSON[_0xcbc8('0x25')](_0x117e4f));_0x4a50ac(_0x117e4f);})['catch'](function(_0x2b81e1){logger[_0xcbc8('0x17')]('UpdateVoiceQueueReport',_0x2b81e1[_0xcbc8('0x19')],_0x2c2f5b);_0x6098bc(_0x5c1f4[_0xcbc8('0x17')](0x1f4,_0x2b81e1[_0xcbc8('0x19')]));});});}; \ No newline at end of file +var _0xcd28=['limit','include','model','attributes','map','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where'];(function(_0x43b8c8,_0x24ec19){var _0x512d79=function(_0x15f834){while(--_0x15f834){_0x43b8c8['push'](_0x43b8c8['shift']());}};_0x512d79(++_0x24ec19);}(_0xcd28,0x1b7));var _0x8cd2=function(_0x3cebfc,_0xf10f3c){_0x3cebfc=_0x3cebfc-0x0;var _0xee50b9=_0xcd28[_0x3cebfc];return _0xee50b9;};'use strict';var _=require(_0x8cd2('0x0'));var util=require('util');var moment=require(_0x8cd2('0x1'));var BPromise=require(_0x8cd2('0x2'));var rs=require(_0x8cd2('0x3'));var fs=require('fs');var Redis=require(_0x8cd2('0x4'));var db=require(_0x8cd2('0x5'))['db'];var utils=require(_0x8cd2('0x6'));var logger=require(_0x8cd2('0x7'))(_0x8cd2('0x8'));var config=require(_0x8cd2('0x9'));var jayson=require(_0x8cd2('0xa'));var client=jayson['client'][_0x8cd2('0xb')]({'port':0x232a});config[_0x8cd2('0xc')]=_['defaults'](config[_0x8cd2('0xc')],{'host':_0x8cd2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd2('0xc')]));require(_0x8cd2('0xe'))[_0x8cd2('0xf')](socket);function respondWithRpcPromise(_0xfe61b7,_0x5b97d4,_0x3b36e6){return new BPromise(function(_0x38ff94,_0x108dca){return client[_0x8cd2('0x10')](_0xfe61b7,_0x3b36e6)[_0x8cd2('0x11')](function(_0x20e9da){logger[_0x8cd2('0x12')](_0x8cd2('0x13'),_0x5b97d4,_0x8cd2('0x14'));logger[_0x8cd2('0x15')](_0x8cd2('0x16'),_0x5b97d4,'request\x20sent',JSON[_0x8cd2('0x17')](_0x20e9da));if(_0x20e9da[_0x8cd2('0x18')]){if(_0x20e9da[_0x8cd2('0x18')][_0x8cd2('0x19')]===0x1f4){logger[_0x8cd2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b97d4,_0x20e9da[_0x8cd2('0x18')][_0x8cd2('0x1a')]);return _0x108dca(_0x20e9da[_0x8cd2('0x18')][_0x8cd2('0x1a')]);}logger[_0x8cd2('0x18')](_0x8cd2('0x13'),_0x5b97d4,_0x20e9da[_0x8cd2('0x18')][_0x8cd2('0x1a')]);return _0x38ff94(_0x20e9da[_0x8cd2('0x18')][_0x8cd2('0x1a')]);}else{logger[_0x8cd2('0x12')](_0x8cd2('0x13'),_0x5b97d4,_0x8cd2('0x14'));_0x38ff94(_0x20e9da['result'][_0x8cd2('0x1a')]);}})[_0x8cd2('0x1b')](function(_0x41ac06){logger[_0x8cd2('0x18')](_0x8cd2('0x13'),_0x5b97d4,_0x41ac06);_0x108dca(_0x41ac06);});});}exports[_0x8cd2('0x1c')]=function(_0x488248){var _0x3b3b81=this;return new Promise(function(_0x172353,_0x30ce78){return db[_0x8cd2('0x1d')][_0x8cd2('0x1e')]({'raw':_0x488248[_0x8cd2('0x1f')]?_0x488248['options'][_0x8cd2('0x20')]===undefined?!![]:![]:!![],'where':_0x488248[_0x8cd2('0x1f')]?_0x488248[_0x8cd2('0x1f')][_0x8cd2('0x21')]||null:null,'attributes':_0x488248[_0x8cd2('0x1f')]?_0x488248[_0x8cd2('0x1f')]['attributes']||null:null,'limit':_0x488248[_0x8cd2('0x1f')]?_0x488248[_0x8cd2('0x1f')][_0x8cd2('0x22')]||null:null,'include':_0x488248[_0x8cd2('0x1f')]?_0x488248[_0x8cd2('0x1f')][_0x8cd2('0x23')]?_['map'](_0x488248[_0x8cd2('0x1f')]['include'],function(_0x26b603){return{'model':db[_0x26b603[_0x8cd2('0x24')]],'as':_0x26b603['as'],'attributes':_0x26b603[_0x8cd2('0x25')],'include':_0x26b603[_0x8cd2('0x23')]?_[_0x8cd2('0x26')](_0x26b603['include'],function(_0x2f5401){return{'model':db[_0x2f5401['model']],'as':_0x2f5401['as'],'attributes':_0x2f5401[_0x8cd2('0x25')],'include':_0x2f5401['include']?_[_0x8cd2('0x26')](_0x2f5401[_0x8cd2('0x23')],function(_0x5d0b59){return{'model':db[_0x5d0b59['model']],'as':_0x5d0b59['as'],'attributes':_0x5d0b59[_0x8cd2('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a9c8e){logger[_0x8cd2('0x12')](_0x8cd2('0x1c'),_0x488248);logger[_0x8cd2('0x15')](_0x8cd2('0x1c'),_0x488248,JSON[_0x8cd2('0x17')](_0x2a9c8e));_0x172353(_0x2a9c8e);})[_0x8cd2('0x1b')](function(_0x4f00b0){logger[_0x8cd2('0x18')](_0x8cd2('0x1c'),_0x4f00b0[_0x8cd2('0x1a')],_0x488248);_0x30ce78(_0x3b3b81[_0x8cd2('0x18')](0x1f4,_0x4f00b0[_0x8cd2('0x1a')]));});});};exports[_0x8cd2('0x27')]=function(_0x8b536c){var _0x4bbda8=this;return new Promise(function(_0x2bac3a,_0x5d0a83){return db[_0x8cd2('0x1d')]['create'](_0x8b536c[_0x8cd2('0x28')],{'raw':_0x8b536c[_0x8cd2('0x1f')]?_0x8b536c[_0x8cd2('0x1f')][_0x8cd2('0x20')]===undefined?!![]:![]:!![]})[_0x8cd2('0x11')](function(_0x3d7e61){logger[_0x8cd2('0x12')]('CreateVoiceQueueReport',_0x8b536c);logger[_0x8cd2('0x15')](_0x8cd2('0x27'),_0x8b536c,JSON[_0x8cd2('0x17')](_0x3d7e61));_0x2bac3a(_0x3d7e61);})[_0x8cd2('0x1b')](function(_0x3602fa){logger[_0x8cd2('0x18')](_0x8cd2('0x27'),_0x3602fa[_0x8cd2('0x1a')],_0x8b536c);_0x5d0a83(_0x4bbda8['error'](0x1f4,_0x3602fa[_0x8cd2('0x1a')]));});});};exports[_0x8cd2('0x29')]=function(_0x36611d){var _0x5a16c3=this;return new Promise(function(_0x3360f5,_0x3842c6){return db[_0x8cd2('0x1d')][_0x8cd2('0x2a')](_0x36611d[_0x8cd2('0x28')],{'raw':_0x36611d[_0x8cd2('0x1f')]?_0x36611d['options'][_0x8cd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36611d[_0x8cd2('0x1f')]?_0x36611d['options']['where']||null:null,'attributes':_0x36611d['options']?_0x36611d[_0x8cd2('0x1f')][_0x8cd2('0x25')]||null:null,'limit':_0x36611d['options']?_0x36611d[_0x8cd2('0x1f')]['limit']||null:null})[_0x8cd2('0x11')](function(_0x48afc7){logger[_0x8cd2('0x12')]('UpdateVoiceQueueReport',_0x36611d);logger[_0x8cd2('0x15')](_0x8cd2('0x29'),_0x36611d,JSON[_0x8cd2('0x17')](_0x48afc7));_0x3360f5(_0x48afc7);})[_0x8cd2('0x1b')](function(_0x410345){logger[_0x8cd2('0x18')]('UpdateVoiceQueueReport',_0x410345[_0x8cd2('0x1a')],_0x36611d);_0x3842c6(_0x5a16c3[_0x8cd2('0x18')](0x1f4,_0x410345[_0x8cd2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 340a50a..9eae44b 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 _0x5024=['removeListener','register','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x53bef4,_0x3faddf){var _0xc5c4f0=function(_0x48b61d){while(--_0x48b61d){_0x53bef4['push'](_0x53bef4['shift']());}};_0xc5c4f0(++_0x3faddf);}(_0x5024,0xf7));var _0x4502=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x5024[_0x3f3f40];return _0x403b7a;};'use strict';var VoiceQueueReportEvents=require(_0x4502('0x0'));var events=[_0x4502('0x1'),_0x4502('0x2'),_0x4502('0x3')];function createListener(_0x52d140,_0x2360b0){return function(_0x3c81c6){_0x2360b0[_0x4502('0x4')](_0x52d140,_0x3c81c6);};}function removeListener(_0x2c91c6,_0x7b4655){return function(){VoiceQueueReportEvents[_0x4502('0x5')](_0x2c91c6,_0x7b4655);};}exports[_0x4502('0x6')]=function(_0x5eddab){for(var _0x548459=0x0,_0x429d5f=events['length'];_0x548459<_0x429d5f;_0x548459++){var _0x45d2eb=events[_0x548459];var _0x254536=createListener('voiceQueueReport:'+_0x45d2eb,_0x5eddab);VoiceQueueReportEvents['on'](_0x45d2eb,_0x254536);}}; \ No newline at end of file +var _0x63be=['update','emit','register','length','voiceQueueReport:','remove'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x63be,0xd7));var _0xe63b=function(_0x4a1ba5,_0x4d0f7c){_0x4a1ba5=_0x4a1ba5-0x0;var _0x1eb04b=_0x63be[_0x4a1ba5];return _0x1eb04b;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xe63b('0x0'),_0xe63b('0x1')];function createListener(_0x560c0d,_0x296b99){return function(_0x134001){_0x296b99[_0xe63b('0x2')](_0x560c0d,_0x134001);};}function removeListener(_0x542a19,_0x19cacd){return function(){VoiceQueueReportEvents['removeListener'](_0x542a19,_0x19cacd);};}exports[_0xe63b('0x3')]=function(_0x19cf80){for(var _0x3cc298=0x0,_0x4ef8f1=events[_0xe63b('0x4')];_0x3cc298<_0x4ef8f1;_0x3cc298++){var _0x1b5b02=events[_0x3cc298];var _0x2127e2=createListener(_0xe63b('0x5')+_0x1b5b02,_0x19cf80);VoiceQueueReportEvents['on'](_0x1b5b02,_0x2127e2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1b01b24..78bcf11 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 _0x002e=['connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x447eef,_0x2666c3){var _0x23c503=function(_0x4c83d7){while(--_0x4c83d7){_0x447eef['push'](_0x447eef['shift']());}};_0x23c503(++_0x2666c3);}(_0x002e,0xb8));var _0xe002=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x002e[_0x35b195];return _0x2433bf;};'use strict';var multer=require(_0xe002('0x0'));var util=require(_0xe002('0x1'));var path=require(_0xe002('0x2'));var timeout=require(_0xe002('0x3'));var express=require('express');var router=express[_0xe002('0x4')]();var fs_extra=require(_0xe002('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe002('0x6'));var config=require('../../config/environment');var controller=require(_0xe002('0x7'));router['get']('/',auth[_0xe002('0x8')](),controller[_0xe002('0x9')]);router['get'](_0xe002('0xa'),auth[_0xe002('0x8')](),controller[_0xe002('0xb')]);router[_0xe002('0xc')]('/',auth['isAuthenticated'](),controller[_0xe002('0xd')]);router[_0xe002('0xe')](_0xe002('0xa'),auth[_0xe002('0x8')](),controller['update']);router[_0xe002('0xf')]('/:id',auth[_0xe002('0x8')](),controller['destroy']);module[_0xe002('0x10')]=router; \ No newline at end of file +var _0xe42c=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe42c,0x149));var _0xce42=function(_0x59c9bb,_0xc4d3d6){_0x59c9bb=_0x59c9bb-0x0;var _0x5d50f0=_0xe42c[_0x59c9bb];return _0x5d50f0;};'use strict';var multer=require(_0xce42('0x0'));var util=require(_0xce42('0x1'));var path=require(_0xce42('0x2'));var timeout=require(_0xce42('0x3'));var express=require(_0xce42('0x4'));var router=express[_0xce42('0x5')]();var fs_extra=require(_0xce42('0x6'));var auth=require(_0xce42('0x7'));var interaction=require(_0xce42('0x8'));var config=require('../../config/environment');var controller=require(_0xce42('0x9'));router[_0xce42('0xa')]('/',auth[_0xce42('0xb')](),controller[_0xce42('0xc')]);router[_0xce42('0xa')](_0xce42('0xd'),auth[_0xce42('0xb')](),controller[_0xce42('0xe')]);router[_0xce42('0xf')]('/',auth[_0xce42('0xb')](),controller[_0xce42('0x10')]);router[_0xce42('0x11')](_0xce42('0xd'),auth[_0xce42('0xb')](),controller[_0xce42('0x12')]);router[_0xce42('0x13')]('/:id',auth[_0xce42('0xb')](),controller['destroy']);module[_0xce42('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 17ee8b4..51b6a94 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 _0xdf67=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x33009c,_0x5920b8){var _0x2c41e1=function(_0x1d60d6){while(--_0x1d60d6){_0x33009c['push'](_0x33009c['shift']());}};_0x2c41e1(++_0x5920b8);}(_0xdf67,0x1eb));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7df6('0x0'));module[_0x7df6('0x1')]={'time':{'type':Sequelize[_0x7df6('0x2')]},'callid':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7df6('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x7df6('0x4')](_0x7df6('0x5'))}}; \ No newline at end of file +var _0xf3df=['exports','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0xc4dc1c,_0x47a3ce){var _0xdb10ea=function(_0x3f32f7){while(--_0x3f32f7){_0xc4dc1c['push'](_0xc4dc1c['shift']());}};_0xdb10ea(++_0x47a3ce);}(_0xf3df,0xe1));var _0xff3d=function(_0x2d66a8,_0x1625a2){_0x2d66a8=_0x2d66a8-0x0;var _0x374b6e=_0xf3df[_0x2d66a8];return _0x374b6e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xff3d('0x0')]={'time':{'type':Sequelize[_0xff3d('0x1')]},'callid':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xff3d('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0xff3d('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d2e9910..803ee09 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 _0xd48f=['fs-extra','lodash','crypto','jsforce','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','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','rimraf','zip-dir','path','sox','to-csv','ejs'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd48f,0xd2));var _0xfd48=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd48f[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd48('0x0'));var zipdir=require(_0xfd48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfd48('0x2'));var sox=require(_0xfd48('0x3'));var csv=require(_0xfd48('0x4'));var ejs=require(_0xfd48('0x5'));var fs=require('fs');var fs_extra=require(_0xfd48('0x6'));var _=require(_0xfd48('0x7'));var squel=require('squel');var crypto=require(_0xfd48('0x8'));var jsforce=require(_0xfd48('0x9'));var deskjs=require(_0xfd48('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfd48('0xb'));var Papa=require(_0xfd48('0xc'));var Redis=require(_0xfd48('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfd48('0xe'));var hardwareService=require(_0xfd48('0xf'));var logger=require(_0xfd48('0x10'))(_0xfd48('0x11'));var utils=require(_0xfd48('0x12'));var config=require(_0xfd48('0x13'));var licenseUtil=require(_0xfd48('0x14'));var db=require(_0xfd48('0x15'))['db'];function respondWithStatusCode(_0x1e911a,_0x26b424){_0x26b424=_0x26b424||0xcc;return function(_0xb03446){if(_0xb03446){return _0x1e911a[_0xfd48('0x16')](_0x26b424);}return _0x1e911a[_0xfd48('0x17')](_0x26b424)['end']();};}function respondWithResult(_0x297ece,_0x59ad43){_0x59ad43=_0x59ad43||0xc8;return function(_0x20789a){if(_0x20789a){return _0x297ece[_0xfd48('0x17')](_0x59ad43)[_0xfd48('0x18')](_0x20789a);}};}function respondWithFilteredResult(_0xcde2cd,_0x3a39ff){return function(_0x3d4102){if(_0x3d4102){var _0x115d71=typeof _0x3a39ff[_0xfd48('0x19')]==='undefined'&&typeof _0x3a39ff['limit']===_0xfd48('0x1a');var _0x11be92=_0x3d4102[_0xfd48('0x1b')];var _0x3a67b9=_0x115d71?0x0:_0x3a39ff['offset'];var _0x153216=_0x115d71?_0x3d4102[_0xfd48('0x1b')]:_0x3a39ff[_0xfd48('0x19')]+_0x3a39ff['limit'];var _0x31da09;if(_0x153216>=_0x11be92){_0x153216=_0x11be92;_0x31da09=0xc8;}else{_0x31da09=0xce;}_0xcde2cd[_0xfd48('0x17')](_0x31da09);return _0xcde2cd[_0xfd48('0x1c')](_0xfd48('0x1d'),_0x3a67b9+'-'+_0x153216+'/'+_0x11be92)['json'](_0x3d4102);}return null;};}function patchUpdates(_0x2e9a39){return function(_0x46ebd9){try{jsonpatch['apply'](_0x46ebd9,_0x2e9a39,!![]);}catch(_0x50544d){return BPromise[_0xfd48('0x1e')](_0x50544d);}return _0x46ebd9[_0xfd48('0x1f')]();};}function saveUpdates(_0x3eca1a,_0x14e29f){return function(_0x33b50c){if(_0x33b50c){return _0x33b50c[_0xfd48('0x20')](_0x3eca1a)[_0xfd48('0x21')](function(_0x117bea){return _0x117bea;});}return null;};}function removeEntity(_0x59e39e,_0x324973){return function(_0x42e469){if(_0x42e469){return _0x42e469[_0xfd48('0x22')]()[_0xfd48('0x21')](function(){_0x59e39e[_0xfd48('0x17')](0xcc)[_0xfd48('0x23')]();});}};}function handleEntityNotFound(_0x3d0c3d,_0x59387b){return function(_0x26ae00){if(!_0x26ae00){_0x3d0c3d[_0xfd48('0x16')](0x194);}return _0x26ae00;};}function handleError(_0x3c9977,_0x2a3ff9){_0x2a3ff9=_0x2a3ff9||0x1f4;return function(_0xaea78d){logger['error'](_0xaea78d[_0xfd48('0x24')]);if(_0xaea78d['name']){delete _0xaea78d[_0xfd48('0x25')];}_0x3c9977[_0xfd48('0x17')](_0x2a3ff9)[_0xfd48('0x26')](_0xaea78d);};}exports[_0xfd48('0x27')]=function(_0x242d90,_0x3eac7d){var _0x510c5a={},_0x42d5de={},_0x26b588={'count':0x0,'rows':[]};var _0x10e797=_['map'](db['VoiceQueuesLog'][_0xfd48('0x28')],function(_0x35373f){return{'name':_0x35373f[_0xfd48('0x29')],'type':_0x35373f['type'][_0xfd48('0x2a')]};});_0x42d5de[_0xfd48('0x2b')]=_[_0xfd48('0x2c')](_0x10e797,_0xfd48('0x25'));_0x42d5de[_0xfd48('0x2d')]=_[_0xfd48('0x2e')](_0x242d90[_0xfd48('0x2d')]);_0x42d5de[_0xfd48('0x2f')]=_['intersection'](_0x42d5de[_0xfd48('0x2b')],_0x42d5de[_0xfd48('0x2d')]);_0x510c5a[_0xfd48('0x30')]=_[_0xfd48('0x31')](_0x42d5de[_0xfd48('0x2b')],qs[_0xfd48('0x32')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x32')]));_0x510c5a[_0xfd48('0x30')]=_0x510c5a[_0xfd48('0x30')][_0xfd48('0x33')]?_0x510c5a[_0xfd48('0x30')]:_0x42d5de[_0xfd48('0x2b')];if(!_0x242d90['query'][_0xfd48('0x34')](_0xfd48('0x35'))){_0x510c5a['limit']=qs[_0xfd48('0x36')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x36')]);_0x510c5a[_0xfd48('0x19')]=qs[_0xfd48('0x19')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x19')]);}_0x510c5a['order']=qs[_0xfd48('0x37')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x37')]);_0x510c5a[_0xfd48('0x38')]=qs['filters'](_[_0xfd48('0x39')](_0x242d90[_0xfd48('0x2d')],_0x42d5de['filters']),_0x10e797);if(_0x242d90['query'][_0xfd48('0x3a')]){_0x510c5a['where']=_[_0xfd48('0x3b')](_0x510c5a[_0xfd48('0x38')],{'$or':_[_0xfd48('0x2c')](_0x10e797,function(_0x4b19af){if(_0x4b19af['type']!=='VIRTUAL'){var _0x5c5c01={};_0x5c5c01[_0x4b19af[_0xfd48('0x25')]]={'$like':'%'+_0x242d90[_0xfd48('0x2d')][_0xfd48('0x3a')]+'%'};return _0x5c5c01;}})});}_0x510c5a=_['merge']({},_0x510c5a,_0x242d90['options']);var _0x26377d={'where':_0x510c5a[_0xfd48('0x38')]};return db[_0xfd48('0x3c')][_0xfd48('0x1b')](_0x26377d)[_0xfd48('0x21')](function(_0xb82ea6){_0x26b588[_0xfd48('0x1b')]=_0xb82ea6;if(_0x242d90['query'][_0xfd48('0x3d')]){_0x510c5a[_0xfd48('0x3e')]=[{'all':!![]}];}return db[_0xfd48('0x3c')][_0xfd48('0x3f')](_0x510c5a);})[_0xfd48('0x21')](function(_0x44fe32){_0x26b588[_0xfd48('0x40')]=_0x44fe32;return _0x26b588;})[_0xfd48('0x21')](respondWithFilteredResult(_0x3eac7d,_0x510c5a))['catch'](handleError(_0x3eac7d,null));};exports[_0xfd48('0x41')]=function(_0x211f65,_0x1d77fd){var _0x520f0b={'raw':!![],'where':{'id':_0x211f65[_0xfd48('0x42')]['id']}},_0x2bd861={};_0x2bd861[_0xfd48('0x2b')]=_[_0xfd48('0x2e')](db['VoiceQueuesLog'][_0xfd48('0x28')]);_0x2bd861[_0xfd48('0x2d')]=_['keys'](_0x211f65[_0xfd48('0x2d')]);_0x2bd861[_0xfd48('0x2f')]=_['intersection'](_0x2bd861[_0xfd48('0x2b')],_0x2bd861[_0xfd48('0x2d')]);_0x520f0b[_0xfd48('0x30')]=_[_0xfd48('0x31')](_0x2bd861[_0xfd48('0x2b')],qs[_0xfd48('0x32')](_0x211f65[_0xfd48('0x2d')][_0xfd48('0x32')]));_0x520f0b[_0xfd48('0x30')]=_0x520f0b['attributes'][_0xfd48('0x33')]?_0x520f0b[_0xfd48('0x30')]:_0x2bd861['model'];if(_0x211f65[_0xfd48('0x2d')][_0xfd48('0x3d')]){_0x520f0b[_0xfd48('0x3e')]=[{'all':!![]}];}_0x520f0b=_[_0xfd48('0x3b')]({},_0x520f0b,_0x211f65[_0xfd48('0x43')]);return db['VoiceQueuesLog'][_0xfd48('0x44')](_0x520f0b)[_0xfd48('0x21')](handleEntityNotFound(_0x1d77fd,null))[_0xfd48('0x21')](respondWithResult(_0x1d77fd,null))['catch'](handleError(_0x1d77fd,null));};exports[_0xfd48('0x45')]=function(_0x23ef38,_0x35f657){return db['VoiceQueuesLog'][_0xfd48('0x45')](_0x23ef38[_0xfd48('0x46')],{})[_0xfd48('0x21')](respondWithResult(_0x35f657,0xc9))[_0xfd48('0x47')](handleError(_0x35f657,null));};exports[_0xfd48('0x20')]=function(_0x1d3891,_0x2dfdb8){if(_0x1d3891['body']['id']){delete _0x1d3891[_0xfd48('0x46')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1d3891[_0xfd48('0x42')]['id']}})[_0xfd48('0x21')](handleEntityNotFound(_0x2dfdb8,null))[_0xfd48('0x21')](saveUpdates(_0x1d3891[_0xfd48('0x46')],null))[_0xfd48('0x21')](respondWithResult(_0x2dfdb8,null))['catch'](handleError(_0x2dfdb8,null));};exports[_0xfd48('0x22')]=function(_0x5b03a7,_0xc0861b){return db[_0xfd48('0x3c')][_0xfd48('0x44')]({'where':{'id':_0x5b03a7[_0xfd48('0x42')]['id']}})[_0xfd48('0x21')](handleEntityNotFound(_0xc0861b,null))['then'](removeEntity(_0xc0861b,null))[_0xfd48('0x47')](handleError(_0xc0861b,null));}; \ No newline at end of file +var _0x8f57=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','VoiceQueuesLog','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rawAttributes','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2776c0,_0x3bdc05){var _0x42b7b7=function(_0x94d837){while(--_0x94d837){_0x2776c0['push'](_0x2776c0['shift']());}};_0x42b7b7(++_0x3bdc05);}(_0x8f57,0x11f));var _0x78f5=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x8f57[_0x390733];return _0x33beb9;};'use strict';var emlformat=require(_0x78f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78f5('0x1'));var jsonpatch=require(_0x78f5('0x2'));var rp=require(_0x78f5('0x3'));var moment=require(_0x78f5('0x4'));var BPromise=require(_0x78f5('0x5'));var Mustache=require(_0x78f5('0x6'));var util=require(_0x78f5('0x7'));var path=require(_0x78f5('0x8'));var sox=require(_0x78f5('0x9'));var csv=require(_0x78f5('0xa'));var ejs=require(_0x78f5('0xb'));var fs=require('fs');var fs_extra=require(_0x78f5('0xc'));var _=require('lodash');var squel=require(_0x78f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x78f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x78f5('0xa'));var querystring=require(_0x78f5('0xf'));var Papa=require(_0x78f5('0x10'));var Redis=require(_0x78f5('0x11'));var authService=require(_0x78f5('0x12'));var qs=require(_0x78f5('0x13'));var as=require(_0x78f5('0x14'));var hardwareService=require(_0x78f5('0x15'));var logger=require(_0x78f5('0x16'))(_0x78f5('0x17'));var utils=require('../../config/utils');var config=require(_0x78f5('0x18'));var licenseUtil=require(_0x78f5('0x19'));var db=require(_0x78f5('0x1a'))['db'];function respondWithStatusCode(_0x39bc5e,_0x23dc27){_0x23dc27=_0x23dc27||0xcc;return function(_0x53645c){if(_0x53645c){return _0x39bc5e[_0x78f5('0x1b')](_0x23dc27);}return _0x39bc5e[_0x78f5('0x1c')](_0x23dc27)[_0x78f5('0x1d')]();};}function respondWithResult(_0x5a7fb8,_0x1331cd){_0x1331cd=_0x1331cd||0xc8;return function(_0x12c56d){if(_0x12c56d){return _0x5a7fb8[_0x78f5('0x1c')](_0x1331cd)['json'](_0x12c56d);}};}function respondWithFilteredResult(_0x1c87c6,_0x2051be){return function(_0x196ebc){if(_0x196ebc){var _0x1d00de=typeof _0x2051be[_0x78f5('0x1e')]===_0x78f5('0x1f')&&typeof _0x2051be[_0x78f5('0x20')]===_0x78f5('0x1f');var _0x2e65e7=_0x196ebc['count'];var _0xef9e71=_0x1d00de?0x0:_0x2051be['offset'];var _0x389dec=_0x1d00de?_0x196ebc[_0x78f5('0x21')]:_0x2051be[_0x78f5('0x1e')]+_0x2051be[_0x78f5('0x20')];var _0xf8e4c9;if(_0x389dec>=_0x2e65e7){_0x389dec=_0x2e65e7;_0xf8e4c9=0xc8;}else{_0xf8e4c9=0xce;}_0x1c87c6[_0x78f5('0x1c')](_0xf8e4c9);return _0x1c87c6[_0x78f5('0x22')](_0x78f5('0x23'),_0xef9e71+'-'+_0x389dec+'/'+_0x2e65e7)['json'](_0x196ebc);}return null;};}function patchUpdates(_0x3599fc){return function(_0x1df91e){try{jsonpatch['apply'](_0x1df91e,_0x3599fc,!![]);}catch(_0x4d8ec2){return BPromise[_0x78f5('0x24')](_0x4d8ec2);}return _0x1df91e[_0x78f5('0x25')]();};}function saveUpdates(_0x4f1905,_0x54fae4){return function(_0x552cc4){if(_0x552cc4){return _0x552cc4['update'](_0x4f1905)[_0x78f5('0x26')](function(_0x3cc6d0){return _0x3cc6d0;});}return null;};}function removeEntity(_0x3099fa,_0x20b269){return function(_0x4258ae){if(_0x4258ae){return _0x4258ae[_0x78f5('0x27')]()['then'](function(){_0x3099fa[_0x78f5('0x1c')](0xcc)[_0x78f5('0x1d')]();});}};}function handleEntityNotFound(_0x5f1469,_0x4086af){return function(_0x3cb892){if(!_0x3cb892){_0x5f1469['sendStatus'](0x194);}return _0x3cb892;};}function handleError(_0x1b297e,_0x376da4){_0x376da4=_0x376da4||0x1f4;return function(_0x2487ac){logger[_0x78f5('0x28')](_0x2487ac[_0x78f5('0x29')]);if(_0x2487ac['name']){delete _0x2487ac[_0x78f5('0x2a')];}_0x1b297e[_0x78f5('0x1c')](_0x376da4)[_0x78f5('0x2b')](_0x2487ac);};}exports[_0x78f5('0x2c')]=function(_0x1a8403,_0x35bbd3){var _0x5789f5={},_0x565fb6={},_0x4fc766={'count':0x0,'rows':[]};var _0x165c17=_['map'](db[_0x78f5('0x2d')]['rawAttributes'],function(_0x15cb68){return{'name':_0x15cb68[_0x78f5('0x2e')],'type':_0x15cb68[_0x78f5('0x2f')][_0x78f5('0x30')]};});_0x565fb6[_0x78f5('0x31')]=_[_0x78f5('0x32')](_0x165c17,_0x78f5('0x2a'));_0x565fb6[_0x78f5('0x33')]=_[_0x78f5('0x34')](_0x1a8403[_0x78f5('0x33')]);_0x565fb6[_0x78f5('0x35')]=_[_0x78f5('0x36')](_0x565fb6[_0x78f5('0x31')],_0x565fb6[_0x78f5('0x33')]);_0x5789f5[_0x78f5('0x37')]=_[_0x78f5('0x36')](_0x565fb6[_0x78f5('0x31')],qs[_0x78f5('0x38')](_0x1a8403['query'][_0x78f5('0x38')]));_0x5789f5[_0x78f5('0x37')]=_0x5789f5[_0x78f5('0x37')][_0x78f5('0x39')]?_0x5789f5['attributes']:_0x565fb6[_0x78f5('0x31')];if(!_0x1a8403['query'][_0x78f5('0x3a')](_0x78f5('0x3b'))){_0x5789f5[_0x78f5('0x20')]=qs['limit'](_0x1a8403[_0x78f5('0x33')][_0x78f5('0x20')]);_0x5789f5['offset']=qs[_0x78f5('0x1e')](_0x1a8403[_0x78f5('0x33')][_0x78f5('0x1e')]);}_0x5789f5[_0x78f5('0x3c')]=qs[_0x78f5('0x3d')](_0x1a8403[_0x78f5('0x33')]['sort']);_0x5789f5[_0x78f5('0x3e')]=qs[_0x78f5('0x35')](_['pick'](_0x1a8403[_0x78f5('0x33')],_0x565fb6[_0x78f5('0x35')]),_0x165c17);if(_0x1a8403[_0x78f5('0x33')][_0x78f5('0x3f')]){_0x5789f5[_0x78f5('0x3e')]=_[_0x78f5('0x40')](_0x5789f5[_0x78f5('0x3e')],{'$or':_[_0x78f5('0x32')](_0x165c17,function(_0xac55c7){if(_0xac55c7[_0x78f5('0x2f')]!==_0x78f5('0x41')){var _0x86bdf0={};_0x86bdf0[_0xac55c7[_0x78f5('0x2a')]]={'$like':'%'+_0x1a8403['query']['filter']+'%'};return _0x86bdf0;}})});}_0x5789f5=_[_0x78f5('0x40')]({},_0x5789f5,_0x1a8403[_0x78f5('0x42')]);var _0x10b125={'where':_0x5789f5[_0x78f5('0x3e')]};return db[_0x78f5('0x2d')][_0x78f5('0x21')](_0x10b125)[_0x78f5('0x26')](function(_0x54e8b5){_0x4fc766['count']=_0x54e8b5;if(_0x1a8403[_0x78f5('0x33')][_0x78f5('0x43')]){_0x5789f5['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x78f5('0x44')](_0x5789f5);})['then'](function(_0x5370ad){_0x4fc766[_0x78f5('0x45')]=_0x5370ad;return _0x4fc766;})[_0x78f5('0x26')](respondWithFilteredResult(_0x35bbd3,_0x5789f5))[_0x78f5('0x46')](handleError(_0x35bbd3,null));};exports['show']=function(_0xfdfceb,_0x2ca9bb){var _0x483c2b={'raw':!![],'where':{'id':_0xfdfceb['params']['id']}},_0x253dd8={};_0x253dd8[_0x78f5('0x31')]=_[_0x78f5('0x34')](db[_0x78f5('0x2d')][_0x78f5('0x47')]);_0x253dd8['query']=_['keys'](_0xfdfceb[_0x78f5('0x33')]);_0x253dd8[_0x78f5('0x35')]=_[_0x78f5('0x36')](_0x253dd8[_0x78f5('0x31')],_0x253dd8['query']);_0x483c2b[_0x78f5('0x37')]=_[_0x78f5('0x36')](_0x253dd8[_0x78f5('0x31')],qs[_0x78f5('0x38')](_0xfdfceb[_0x78f5('0x33')][_0x78f5('0x38')]));_0x483c2b[_0x78f5('0x37')]=_0x483c2b[_0x78f5('0x37')][_0x78f5('0x39')]?_0x483c2b['attributes']:_0x253dd8[_0x78f5('0x31')];if(_0xfdfceb[_0x78f5('0x33')][_0x78f5('0x43')]){_0x483c2b['include']=[{'all':!![]}];}_0x483c2b=_['merge']({},_0x483c2b,_0xfdfceb[_0x78f5('0x42')]);return db[_0x78f5('0x2d')][_0x78f5('0x48')](_0x483c2b)[_0x78f5('0x26')](handleEntityNotFound(_0x2ca9bb,null))[_0x78f5('0x26')](respondWithResult(_0x2ca9bb,null))[_0x78f5('0x46')](handleError(_0x2ca9bb,null));};exports['create']=function(_0x230cf2,_0x420e8d){return db[_0x78f5('0x2d')][_0x78f5('0x49')](_0x230cf2[_0x78f5('0x4a')],{})['then'](respondWithResult(_0x420e8d,0xc9))[_0x78f5('0x46')](handleError(_0x420e8d,null));};exports[_0x78f5('0x4b')]=function(_0x469c23,_0x4d5945){if(_0x469c23[_0x78f5('0x4a')]['id']){delete _0x469c23['body']['id'];}return db[_0x78f5('0x2d')][_0x78f5('0x48')]({'where':{'id':_0x469c23[_0x78f5('0x4c')]['id']}})[_0x78f5('0x26')](handleEntityNotFound(_0x4d5945,null))[_0x78f5('0x26')](saveUpdates(_0x469c23[_0x78f5('0x4a')],null))[_0x78f5('0x26')](respondWithResult(_0x4d5945,null))[_0x78f5('0x46')](handleError(_0x4d5945,null));};exports[_0x78f5('0x27')]=function(_0x879147,_0x3ec719){return db[_0x78f5('0x2d')][_0x78f5('0x48')]({'where':{'id':_0x879147[_0x78f5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ec719,null))[_0x78f5('0x26')](removeEntity(_0x3ec719,null))['catch'](handleError(_0x3ec719,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cca1fa5..ef3c4c5 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 _0x5460=['define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x3df5cb,_0x11f3a0){var _0x32b8d3=function(_0x115bc0){while(--_0x115bc0){_0x3df5cb['push'](_0x3df5cb['shift']());}};_0x32b8d3(++_0x11f3a0);}(_0x5460,0x1e5));var _0x0546=function(_0x167544,_0x34f43a){_0x167544=_0x167544-0x0;var _0x4c976b=_0x5460[_0x167544];return _0x4c976b;};'use strict';var _=require(_0x0546('0x0'));var util=require(_0x0546('0x1'));var logger=require(_0x0546('0x2'))(_0x0546('0x3'));var moment=require(_0x0546('0x4'));var BPromise=require(_0x0546('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0546('0x6'));var rimraf=require('rimraf');var config=require(_0x0546('0x7'));var attributes=require(_0x0546('0x8'));module['exports']=function(_0x4f85c7,_0x1094e7){return _0x4f85c7[_0x0546('0x9')](_0x0546('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0546('0xb'),_0x0546('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3f59=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x209f4b,_0x6325be){var _0x498ae1=function(_0x2ad6d6){while(--_0x2ad6d6){_0x209f4b['push'](_0x209f4b['shift']());}};_0x498ae1(++_0x6325be);}(_0x3f59,0x1b0));var _0x93f5=function(_0x1c2bc3,_0x5755a1){_0x1c2bc3=_0x1c2bc3-0x0;var _0x4330d7=_0x3f59[_0x1c2bc3];return _0x4330d7;};'use strict';var _=require(_0x93f5('0x0'));var util=require(_0x93f5('0x1'));var logger=require('../../config/logger')(_0x93f5('0x2'));var moment=require(_0x93f5('0x3'));var BPromise=require(_0x93f5('0x4'));var rp=require(_0x93f5('0x5'));var fs=require('fs');var path=require(_0x93f5('0x6'));var rimraf=require(_0x93f5('0x7'));var config=require(_0x93f5('0x8'));var attributes=require(_0x93f5('0x9'));module[_0x93f5('0xa')]=function(_0x4dd06b,_0x565ad3){return _0x4dd06b[_0x93f5('0xb')](_0x93f5('0xc'),attributes,{'tableName':_0x93f5('0xd'),'paranoid':![],'indexes':[{'name':_0x93f5('0xe'),'fields':[_0x93f5('0xf'),'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 74fec62..86ea9a5 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 _0x7b79=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x7b79,0x1b6));var _0x97b7=function(_0x15923d,_0x37c6e7){_0x15923d=_0x15923d-0x0;var _0x319ab9=_0x7b79[_0x15923d];return _0x319ab9;};'use strict';var _=require(_0x97b7('0x0'));var util=require(_0x97b7('0x1'));var moment=require(_0x97b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x97b7('0x3'));var fs=require('fs');var Redis=require(_0x97b7('0x4'));var db=require(_0x97b7('0x5'))['db'];var utils=require(_0x97b7('0x6'));var logger=require('../../config/logger')(_0x97b7('0x7'));var config=require(_0x97b7('0x8'));var jayson=require(_0x97b7('0x9'));var client=jayson[_0x97b7('0xa')][_0x97b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43390b,_0x54d06e,_0x58d79a){return new BPromise(function(_0x59cbc1,_0x5e7124){return client[_0x97b7('0xc')](_0x43390b,_0x58d79a)[_0x97b7('0xd')](function(_0x3d245c){logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');logger[_0x97b7('0x10')](_0x97b7('0x11'),_0x54d06e,'request\x20sent',JSON[_0x97b7('0x12')](_0x3d245c));if(_0x3d245c[_0x97b7('0x13')]){if(_0x3d245c['error'][_0x97b7('0x14')]===0x1f4){logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c['error'][_0x97b7('0x15')]);return _0x5e7124(_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);}logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);return _0x59cbc1(_0x3d245c[_0x97b7('0x13')]['message']);}else{logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');_0x59cbc1(_0x3d245c[_0x97b7('0x16')][_0x97b7('0x15')]);}})[_0x97b7('0x17')](function(_0x3afd52){logger[_0x97b7('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x54d06e,_0x3afd52);_0x5e7124(_0x3afd52);});});} \ No newline at end of file +var _0xe1ee=['request\x20sent','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xe1ee,0x158));var _0xee1e=function(_0x4575e4,_0x47a667){_0x4575e4=_0x4575e4-0x0;var _0x18702f=_0xe1ee[_0x4575e4];return _0x18702f;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var moment=require('moment');var BPromise=require(_0xee1e('0x2'));var rs=require(_0xee1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee1e('0x6'));var client=jayson[_0xee1e('0x7')][_0xee1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbd99,_0x4dcff2,_0x335d60){return new BPromise(function(_0x5d549e,_0x575700){return client['request'](_0x3dbd99,_0x335d60)[_0xee1e('0x9')](function(_0x14d58b){logger[_0xee1e('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4dcff2,'request\x20sent');logger[_0xee1e('0xb')](_0xee1e('0xc'),_0x4dcff2,'request\x20sent',JSON['stringify'](_0x14d58b));if(_0x14d58b[_0xee1e('0xd')]){if(_0x14d58b[_0xee1e('0xd')][_0xee1e('0xe')]===0x1f4){logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x14d58b['error'][_0xee1e('0x10')]);return _0x575700(_0x14d58b[_0xee1e('0xd')][_0xee1e('0x10')]);}logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x14d58b[_0xee1e('0xd')]['message']);return _0x5d549e(_0x14d58b[_0xee1e('0xd')]['message']);}else{logger[_0xee1e('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4dcff2,_0xee1e('0x11'));_0x5d549e(_0x14d58b['result'][_0xee1e('0x10')]);}})[_0xee1e('0x12')](function(_0x3f579f){logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x3f579f);_0x575700(_0x3f579f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8f63eb7..7629f02 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 _0xb507=['delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe'];(function(_0x1fb86d,_0xc5978a){var _0x3f7334=function(_0x4b74b9){while(--_0x4b74b9){_0x1fb86d['push'](_0x1fb86d['shift']());}};_0x3f7334(++_0xc5978a);}(_0xb507,0xb1));var _0x7b50=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xb507[_0x7fd9e9];return _0x285d92;};'use strict';var multer=require('multer');var util=require(_0x7b50('0x0'));var path=require(_0x7b50('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b50('0x2'));var router=express['Router']();var fs_extra=require(_0x7b50('0x3'));var auth=require(_0x7b50('0x4'));var interaction=require(_0x7b50('0x5'));var config=require(_0x7b50('0x6'));var controller=require('./voiceRecording.controller');router[_0x7b50('0x7')]('/',auth[_0x7b50('0x8')](),controller[_0x7b50('0x9')]);router['get'](_0x7b50('0xa'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xb')]);router[_0x7b50('0x7')](_0x7b50('0xc'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xd')]);router['get'](_0x7b50('0xe'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xf')]);router[_0x7b50('0x7')](_0x7b50('0x10'),controller[_0x7b50('0x11')]);router[_0x7b50('0x7')](_0x7b50('0x12'),auth['isAuthenticated'](),controller[_0x7b50('0x13')]);router[_0x7b50('0x14')]('/',auth[_0x7b50('0x8')](),controller[_0x7b50('0x15')]);router[_0x7b50('0x14')]('/:id/transcribe',auth[_0x7b50('0x8')](),controller[_0x7b50('0x16')]);router['put']('/:id',auth[_0x7b50('0x8')](),controller['update']);router[_0x7b50('0x17')](_0x7b50('0xc'),auth[_0x7b50('0x8')](),controller[_0x7b50('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf8a1=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads'];(function(_0x8fceb,_0x3ffa0b){var _0x51ceda=function(_0x27042b){while(--_0x27042b){_0x8fceb['push'](_0x8fceb['shift']());}};_0x51ceda(++_0x3ffa0b);}(_0xf8a1,0x19d));var _0x1f8a=function(_0x36a11b,_0x2e0b27){_0x36a11b=_0x36a11b-0x0;var _0x55f414=_0xf8a1[_0x36a11b];return _0x55f414;};'use strict';var multer=require(_0x1f8a('0x0'));var util=require(_0x1f8a('0x1'));var path=require(_0x1f8a('0x2'));var timeout=require(_0x1f8a('0x3'));var express=require(_0x1f8a('0x4'));var router=express[_0x1f8a('0x5')]();var fs_extra=require(_0x1f8a('0x6'));var auth=require(_0x1f8a('0x7'));var interaction=require(_0x1f8a('0x8'));var config=require(_0x1f8a('0x9'));var controller=require(_0x1f8a('0xa'));router[_0x1f8a('0xb')]('/',auth[_0x1f8a('0xc')](),controller[_0x1f8a('0xd')]);router['get'](_0x1f8a('0xe'),auth['isAuthenticated'](),controller[_0x1f8a('0xf')]);router['get'](_0x1f8a('0x10'),auth['isAuthenticated'](),controller[_0x1f8a('0x11')]);router[_0x1f8a('0xb')](_0x1f8a('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x1f8a('0xb')](_0x1f8a('0x13'),controller[_0x1f8a('0x14')]);router['get'](_0x1f8a('0x15'),auth[_0x1f8a('0xc')](),controller[_0x1f8a('0x16')]);router[_0x1f8a('0x17')]('/',auth[_0x1f8a('0xc')](),controller[_0x1f8a('0x18')]);router[_0x1f8a('0x17')]('/:id/transcribe',auth[_0x1f8a('0xc')](),controller[_0x1f8a('0x19')]);router[_0x1f8a('0x1a')]('/:id',auth[_0x1f8a('0xc')](),controller[_0x1f8a('0x1b')]);router[_0x1f8a('0x1c')]('/:id',auth[_0x1f8a('0xc')](),controller[_0x1f8a('0x1d')]);module[_0x1f8a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 304ff8a..6de4c6b 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 42a28c1..675afd8 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 _0xf859=['startTranscriptionJob','readFileSync','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','runSentiment','sentimentRegion','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll','rows','show','params','rawAttributes','filters','include','options','find','catch','create','body','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','Sequelize','ValidationError','filename','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf859,0xb8));var _0x9f85=function(_0x3ad5fc,_0x45a830){_0x3ad5fc=_0x3ad5fc-0x0;var _0x23aa52=_0xf859[_0x3ad5fc];return _0x23aa52;};'use strict';var emlformat=require(_0x9f85('0x0'));var rimraf=require(_0x9f85('0x1'));var zipdir=require(_0x9f85('0x2'));var jsonpatch=require(_0x9f85('0x3'));var rp=require('request-promise');var moment=require(_0x9f85('0x4'));var BPromise=require(_0x9f85('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9f85('0x6'));var sox=require(_0x9f85('0x7'));var csv=require('to-csv');var ejs=require(_0x9f85('0x8'));var fs=require('fs');var fs_extra=require(_0x9f85('0x9'));var _=require(_0x9f85('0xa'));var squel=require('squel');var crypto=require(_0x9f85('0xb'));var jsforce=require(_0x9f85('0xc'));var deskjs=require(_0x9f85('0xd'));var toCsv=require(_0x9f85('0xe'));var querystring=require(_0x9f85('0xf'));var Papa=require(_0x9f85('0x10'));var AWS=require(_0x9f85('0x11'));var uuidv4=require(_0x9f85('0x12'));var Redis=require(_0x9f85('0x13'));var authService=require(_0x9f85('0x14'));var qs=require(_0x9f85('0x15'));var as=require(_0x9f85('0x16'));var hardwareService=require(_0x9f85('0x17'));var logger=require(_0x9f85('0x18'))(_0x9f85('0x19'));var utils=require('../../config/utils');var config=require(_0x9f85('0x1a'));var licenseUtil=require(_0x9f85('0x1b'));var db=require(_0x9f85('0x1c'))['db'];function respondWithStatusCode(_0x38ac7a,_0x10c70d){_0x10c70d=_0x10c70d||0xcc;return function(_0x1ce556){if(_0x1ce556){return _0x38ac7a[_0x9f85('0x1d')](_0x10c70d);}return _0x38ac7a[_0x9f85('0x1e')](_0x10c70d)[_0x9f85('0x1f')]();};}function respondWithResult(_0x69521,_0x10a3a0){_0x10a3a0=_0x10a3a0||0xc8;return function(_0x2ccfaf){if(_0x2ccfaf){return _0x69521[_0x9f85('0x1e')](_0x10a3a0)[_0x9f85('0x20')](_0x2ccfaf);}};}function respondWithFilteredResult(_0xe5d522,_0x37017d){return function(_0x3776ba){if(_0x3776ba){var _0x466afe=typeof _0x37017d[_0x9f85('0x21')]===_0x9f85('0x22')&&typeof _0x37017d['limit']==='undefined';var _0x348bd6=_0x3776ba['count'];var _0x5e2dad=_0x466afe?0x0:_0x37017d[_0x9f85('0x21')];var _0x15d37c=_0x466afe?_0x3776ba[_0x9f85('0x23')]:_0x37017d[_0x9f85('0x21')]+_0x37017d[_0x9f85('0x24')];var _0x1040a7;if(_0x15d37c>=_0x348bd6){_0x15d37c=_0x348bd6;_0x1040a7=0xc8;}else{_0x1040a7=0xce;}_0xe5d522[_0x9f85('0x1e')](_0x1040a7);return _0xe5d522[_0x9f85('0x25')](_0x9f85('0x26'),_0x5e2dad+'-'+_0x15d37c+'/'+_0x348bd6)['json'](_0x3776ba);}return null;};}function patchUpdates(_0x1bf7b3){return function(_0x59e6c6){try{jsonpatch[_0x9f85('0x27')](_0x59e6c6,_0x1bf7b3,!![]);}catch(_0x3b2b66){return BPromise[_0x9f85('0x28')](_0x3b2b66);}return _0x59e6c6[_0x9f85('0x29')]();};}function saveUpdates(_0xb1124d,_0x21643b){return function(_0xd62f4e){if(_0xd62f4e){return _0xd62f4e[_0x9f85('0x2a')](_0xb1124d)[_0x9f85('0x2b')](function(_0x1ca0eb){return _0x1ca0eb;});}return null;};}function removeEntity(_0x18311f,_0x2f4243){return function(_0xf88ff6){if(_0xf88ff6){return _0xf88ff6[_0x9f85('0x2c')]()[_0x9f85('0x2b')](function(){_0x18311f[_0x9f85('0x1e')](0xcc)[_0x9f85('0x1f')]();});}};}function handleEntityNotFound(_0x3952ea,_0x46b043){return function(_0x47bb77){if(!_0x47bb77){_0x3952ea[_0x9f85('0x1d')](0x194);}return _0x47bb77;};}function handleError(_0x20d766,_0x1d86b9){_0x1d86b9=_0x1d86b9||0x1f4;return function(_0x4ef5e1){logger['error'](_0x4ef5e1['stack']);if(_0x4ef5e1['name']){delete _0x4ef5e1[_0x9f85('0x2d')];}_0x20d766[_0x9f85('0x1e')](_0x1d86b9)[_0x9f85('0x2e')](_0x4ef5e1);};}exports[_0x9f85('0x2f')]=function(_0x257619,_0x275feb){var _0xadfe41={},_0x13d1e6={},_0xec3299={'count':0x0,'rows':[]};var _0x49601b=_[_0x9f85('0x30')](db[_0x9f85('0x31')]['rawAttributes'],function(_0x2e26c6){return{'name':_0x2e26c6[_0x9f85('0x32')],'type':_0x2e26c6[_0x9f85('0x33')][_0x9f85('0x34')]};});_0x13d1e6[_0x9f85('0x35')]=_[_0x9f85('0x36')](_[_0x9f85('0x30')](_0x49601b,_0x9f85('0x2d')),['format']);_0x13d1e6['query']=_[_0x9f85('0x37')](_0x257619['query']);_0x13d1e6['filters']=_[_0x9f85('0x38')](_0x13d1e6['model'],_0x13d1e6[_0x9f85('0x39')]);_0xadfe41[_0x9f85('0x3a')]=_['intersection'](_0x13d1e6[_0x9f85('0x35')],qs[_0x9f85('0x3b')](_0x257619[_0x9f85('0x39')][_0x9f85('0x3b')]));_0xadfe41['attributes']=_0xadfe41[_0x9f85('0x3a')][_0x9f85('0x3c')]?_0xadfe41['attributes']:_0x13d1e6[_0x9f85('0x35')];if(!_0x257619['query'][_0x9f85('0x3d')](_0x9f85('0x3e'))){_0xadfe41[_0x9f85('0x24')]=qs[_0x9f85('0x24')](_0x257619[_0x9f85('0x39')][_0x9f85('0x24')]);_0xadfe41[_0x9f85('0x21')]=qs[_0x9f85('0x21')](_0x257619[_0x9f85('0x39')]['offset']);}_0xadfe41[_0x9f85('0x3f')]=qs[_0x9f85('0x40')](_0x257619[_0x9f85('0x39')][_0x9f85('0x40')]);_0xadfe41['where']=qs['filters'](_['pick'](_0x257619[_0x9f85('0x39')],_0x13d1e6['filters']),_0x49601b);if(_0x257619[_0x9f85('0x39')][_0x9f85('0x41')]){_0xadfe41[_0x9f85('0x42')]=_[_0x9f85('0x43')](_0xadfe41['where'],{'$or':_[_0x9f85('0x30')](_0x49601b,function(_0x1f6a2d){if(_0x1f6a2d['type']!==_0x9f85('0x44')){var _0x3e22c2={};_0x3e22c2[_0x1f6a2d['name']]={'$like':'%'+_0x257619[_0x9f85('0x39')]['filter']+'%'};return _0x3e22c2;}})});}_0xadfe41=_[_0x9f85('0x43')]({},_0xadfe41,_0x257619['options']);var _0x5c2a0a={'where':_0xadfe41['where']};return db['VoiceRecording'][_0x9f85('0x23')](_0x5c2a0a)[_0x9f85('0x2b')](function(_0x3e7117){_0xec3299[_0x9f85('0x23')]=_0x3e7117;if(_0x257619[_0x9f85('0x39')]['includeAll']){_0xadfe41['include']=[{'all':!![]}];}return db[_0x9f85('0x31')][_0x9f85('0x45')](_0xadfe41);})[_0x9f85('0x2b')](function(_0x466f6e){_0xec3299[_0x9f85('0x46')]=_0x466f6e;return _0xec3299;})[_0x9f85('0x2b')](respondWithFilteredResult(_0x275feb,_0xadfe41))['catch'](handleError(_0x275feb,null));};exports[_0x9f85('0x47')]=function(_0x469f48,_0x57429e){var _0x19aaf0={'raw':![],'where':{'id':_0x469f48[_0x9f85('0x48')]['id']}},_0xfaf415={};_0xfaf415[_0x9f85('0x35')]=_[_0x9f85('0x37')](db[_0x9f85('0x31')][_0x9f85('0x49')]);_0xfaf415['query']=_['keys'](_0x469f48['query']);_0xfaf415[_0x9f85('0x4a')]=_[_0x9f85('0x38')](_0xfaf415['model'],_0xfaf415[_0x9f85('0x39')]);_0x19aaf0['attributes']=_[_0x9f85('0x38')](_0xfaf415['model'],qs[_0x9f85('0x3b')](_0x469f48[_0x9f85('0x39')][_0x9f85('0x3b')]));_0x19aaf0[_0x9f85('0x3a')]=_0x19aaf0[_0x9f85('0x3a')][_0x9f85('0x3c')]?_0x19aaf0[_0x9f85('0x3a')]:_0xfaf415['model'];if(_0x469f48[_0x9f85('0x39')]['includeAll']){_0x19aaf0[_0x9f85('0x4b')]=[{'all':!![]}];}_0x19aaf0=_[_0x9f85('0x43')]({},_0x19aaf0,_0x469f48[_0x9f85('0x4c')]);return db[_0x9f85('0x31')][_0x9f85('0x4d')](_0x19aaf0)[_0x9f85('0x2b')](handleEntityNotFound(_0x57429e,null))[_0x9f85('0x2b')](respondWithResult(_0x57429e,null))[_0x9f85('0x4e')](handleError(_0x57429e,null));};exports[_0x9f85('0x4f')]=function(_0x1129d2,_0x58cc9b){return db[_0x9f85('0x31')][_0x9f85('0x4f')](_0x1129d2[_0x9f85('0x50')],{})['then'](respondWithResult(_0x58cc9b,0xc9))[_0x9f85('0x4e')](handleError(_0x58cc9b,null));};exports[_0x9f85('0x2a')]=function(_0x194b4e,_0x1dc92c){if(_0x194b4e[_0x9f85('0x50')]['id']){delete _0x194b4e[_0x9f85('0x50')]['id'];}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':{'id':_0x194b4e['params']['id']}})[_0x9f85('0x2b')](handleEntityNotFound(_0x1dc92c,null))[_0x9f85('0x2b')](saveUpdates(_0x194b4e[_0x9f85('0x50')],null))[_0x9f85('0x2b')](respondWithResult(_0x1dc92c,null))[_0x9f85('0x4e')](handleError(_0x1dc92c,null));};exports[_0x9f85('0x51')]=function(_0x1e19e6,_0x47728d){return db[_0x9f85('0x31')][_0x9f85('0x51')]()['then'](respondWithResult(_0x47728d,null))[_0x9f85('0x4e')](handleError(_0x47728d,null));};exports[_0x9f85('0x52')]=function(_0x2260e4,_0x446271,_0x236fbe){var _0x3a90fb=require('../../components/encryptor');var _0x16280c=![];var _0x182c6d={};if(_0x2260e4['query'][_0x9f85('0x33')]&&_0x2260e4['query'][_0x9f85('0x33')]==='uniqueid'){_0x182c6d[_0x9f85('0x53')]=_0x2260e4[_0x9f85('0x48')]['id'];}else{_0x182c6d['id']=_0x2260e4[_0x9f85('0x48')]['id'];}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':_0x182c6d,'attributes':['id',_0x9f85('0x54')],'raw':!![]})[_0x9f85('0x2b')](handleEntityNotFound(_0x446271,null))[_0x9f85('0x2b')](function(_0x23c8b9){if(_0x23c8b9){var _0x1e23ba=_0x23c8b9[_0x9f85('0x54')];var _0x22f2dc=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x1e23ba);if(fs[_0x9f85('0x57')](_0x22f2dc)){_0x16280c=!![];return _0x3a90fb[_0x9f85('0x58')](_0x22f2dc,_0x1e23ba,config[_0x9f85('0x59')][_0x9f85('0x5a')])[_0x9f85('0x2b')](function(){return _0x23c8b9;});}return _0x23c8b9;}})['then'](function(_0x5205d3){if(_0x5205d3){var _0x52fccb=_0x5205d3['value'];if(!fs[_0x9f85('0x57')](_0x52fccb)){throw new db['Sequelize']['ValidationError'](_0x9f85('0x5b'));}if(_0x5205d3['filename']){return _0x446271[_0x9f85('0x52')](_0x52fccb,_0x5205d3['filename']+path[_0x9f85('0x5c')](_0x52fccb),function(){if(_0x16280c){fs[_0x9f85('0x5d')](_0x52fccb);}});}else{return _0x446271[_0x9f85('0x52')](_0x52fccb,function(_0xed4d45){if(_0x16280c){fs[_0x9f85('0x5d')](_0x52fccb);}});}}})[_0x9f85('0x4e')](function(_0x3e3cce){if(_0x3e3cce[_0x9f85('0x5e')]==='VoiceRecording\x20not\x20found'){_0x446271[_0x9f85('0x1e')](0x194)[_0x9f85('0x2e')](_0x9f85('0x5f'));}else{return handleError(_0x446271,null);}});};exports[_0x9f85('0x60')]=function(_0x1a4dac,_0x1ab770,_0x2ff085){var _0x7298b1=require('../../components/encryptor');var _0x59abf1=![];var _0x509d8f={'$and':[db['sequelize'][_0x9f85('0x42')](db[_0x9f85('0x61')]['fn'](_0x9f85('0x62'),db['sequelize'][_0x9f85('0x63')](_0x9f85('0x53'))),_0x1a4dac['query'][_0x9f85('0x64')])]};if(_0x1a4dac[_0x9f85('0x39')][_0x9f85('0x33')]&&_0x1a4dac['query'][_0x9f85('0x33')]===_0x9f85('0x53')){_0x509d8f['$and']['push']({'uniqueid':_0x1a4dac[_0x9f85('0x48')]['id']});}else{_0x509d8f[_0x9f85('0x65')]['push']({'id':_0x1a4dac[_0x9f85('0x48')]['id']});}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':_0x509d8f,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1ab770,null))['then'](function(_0x5e73b8){if(_0x5e73b8){var _0x5928e1=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x5e73b8[_0x9f85('0x54')]);if(fs['existsSync'](_0x5928e1)){_0x59abf1=!![];return _0x7298b1['decryptFile'](_0x5928e1,_0x5e73b8[_0x9f85('0x54')],config[_0x9f85('0x59')][_0x9f85('0x5a')])[_0x9f85('0x2b')](function(){return _0x5e73b8;});}return _0x5e73b8;}})['then'](function(_0x584098){if(_0x584098){if(!fs[_0x9f85('0x57')](_0x584098[_0x9f85('0x54')])){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('VoiceRecording\x20not\x20found');}if(_0x584098['filename']){return _0x1ab770['download'](_0x584098[_0x9f85('0x54')],_0x584098[_0x9f85('0x68')]+path[_0x9f85('0x5c')](_0x584098[_0x9f85('0x54')]),function(){if(_0x59abf1){fs[_0x9f85('0x5d')](_0x584098[_0x9f85('0x54')]);}});}else{return _0x1ab770[_0x9f85('0x52')](_0x584098[_0x9f85('0x54')],function(_0x3b89bd){if(_0x59abf1){fs['unlink'](_0x584098[_0x9f85('0x54')]);}});}}})[_0x9f85('0x4e')](handleError(_0x1ab770,null));};exports[_0x9f85('0x2c')]=function(_0x23a080,_0xb04d4b){return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':{'id':_0x23a080[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](function(_0x3041fe){if(_[_0x9f85('0x69')](_0x3041fe)){throw new ReferenceError(_0x9f85('0x6a'));}return _0x3041fe;})[_0x9f85('0x2b')](function(_0x3d9917){var _0x298f2b=_0x3d9917[_0x9f85('0x54')];logger[_0x9f85('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0x298f2b);if(!_[_0x9f85('0x69')](_0x3d9917[_0x9f85('0x54')])&&fs['existsSync'](_0x298f2b)){logger[_0x9f85('0x6b')](_0x9f85('0x6c')+_0x298f2b+_0x9f85('0x6d'));fs[_0x9f85('0x6e')](_0x298f2b);}_0x298f2b=_0x298f2b+'.cypher';if(!_[_0x9f85('0x69')](_0x3d9917[_0x9f85('0x54')])&&fs[_0x9f85('0x57')](_0x298f2b)){logger['info']('File:\x20\x22'+_0x298f2b+_0x9f85('0x6d'));fs[_0x9f85('0x6e')](_0x298f2b);}return _0x3d9917;})[_0x9f85('0x2b')](function(_0x13a61e){if(!_0x13a61e)throw new InternalError();return _0x13a61e[_0x9f85('0x2c')]();})[_0x9f85('0x2b')](function(){_0xb04d4b[_0x9f85('0x1e')](0xcc)['end']();})[_0x9f85('0x4e')](handleError(_0xb04d4b,null));};function getBucketslist(_0x3d8d89,_0x824cf1,_0x3977a8){return new Promise(function(_0x5d55b0,_0xa634dd){var _0x274727=new AWS['S3']({'accessKeyId':_0x824cf1,'secretAccessKey':_0x3d8d89,'region':_0x3977a8});_0x274727[_0x9f85('0x6f')]({},function(_0x3e9125,_0x3a9721){if(_0x3e9125){return _0xa634dd(_0x3e9125);}else{return _0x5d55b0(_0x3a9721);}});});}function createBucket(_0x3697bc,_0x380af9,_0x55697e,_0x262079){return new Promise(function(_0x4d1785,_0x5720d9){var _0x3fcdd8=new AWS['S3']({'accessKeyId':_0x380af9,'secretAccessKey':_0x3697bc,'region':_0x55697e});_0x3fcdd8[_0x9f85('0x70')]({'Bucket':_0x262079},function(_0x2973bf,_0x236795){if(_0x2973bf){return _0x5720d9(_0x2973bf);}else{return _0x4d1785(_0x236795);}});});}function uploadFile(_0x27a3d5,_0x5b6831,_0x166fbc,_0x549676,_0x4bd88d,_0x49ed8e){return new Promise(function(_0x4593ec,_0x5bc088){var _0x119c57=new AWS['S3']({'accessKeyId':_0x5b6831,'secretAccessKey':_0x27a3d5,'region':_0x166fbc});_0x119c57['upload']({'Bucket':_0x549676,'Key':_0x4bd88d,'Body':_0x49ed8e},function(_0x50cfa2,_0x3d4854){if(_0x50cfa2){return _0x5bc088(_0x50cfa2);}else{return _0x4593ec(_0x3d4854);}});});}function startTranscribe(_0x4b2206,_0x5aa764,_0x30bab0,_0x5b64ea,_0x4a8eec,_0x53ef7b){return new Promise(function(_0x3b1468,_0x253391){var _0x204448=new AWS[(_0x9f85('0x71'))]({'accessKeyId':_0x5aa764,'secretAccessKey':_0x4b2206,'region':_0x30bab0});_0x204448[_0x9f85('0x72')]({'TranscriptionJobName':_0x5b64ea,'LanguageCode':_0x4a8eec,'Media':{'MediaFileUri':_0x53ef7b}},function(_0x55f1e9,_0x48a747){if(_0x55f1e9){return _0x253391(_0x55f1e9);}else{return _0x3b1468(_0x48a747);}});});}function transcribe(_0x1f7f78,_0x1d878e,_0x53df27,_0x208a0b,_0x1e5d99,_0x149ef3,_0x28f6f7){return new Promise(function(_0x35d9cf,_0x4fae9d){var _0x2a06a0={};logger[_0x9f85('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1f7f78,_0x1e5d99));return uploadFile(_0x1d878e,_0x53df27,_0x208a0b,_0x1e5d99,path['basename'](_0x149ef3),fs[_0x9f85('0x73')](_0x149ef3))['then'](function(_0x453e33){logger[_0x9f85('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1f7f78,_0x1e5d99,_0x453e33['Location']));_0x2a06a0[_0x9f85('0x74')]=_0x453e33[_0x9f85('0x75')];_0x2a06a0['location']=_0x453e33[_0x9f85('0x76')];logger['info'](util['format'](_0x9f85('0x77'),_0x1f7f78));return startTranscribe(_0x1d878e,_0x53df27,_0x208a0b,uuidv4(),_0x28f6f7,_0x453e33[_0x9f85('0x76')]);})['then'](function(_0x131075){logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x78'),_0x1f7f78,_0x131075['TranscriptionJob'][_0x9f85('0x79')]));_0x2a06a0['transcribeName']=_0x131075[_0x9f85('0x7a')]['TranscriptionJobName'];_0x2a06a0['transcribeStatus']=_0x131075[_0x9f85('0x7a')][_0x9f85('0x7b')];return _0x35d9cf(_0x2a06a0);})[_0x9f85('0x4e')](function(_0x500a9b){return _0x4fae9d(_0x500a9b);});});}exports[_0x9f85('0x7c')]=function(_0x567619,_0x692133,_0x33cb82){var _0x342c48;var _0x55034c;var _0x121cc9;var _0x2c83a9=require('../../components/encryptor');return db[_0x9f85('0x31')][_0x9f85('0x7d')]({'where':{'id':_0x567619[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](function(_0x229c2f){if(_0x229c2f){var _0x110ad5=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x229c2f[_0x9f85('0x54')]);if(fs['existsSync'](_0x110ad5)){cypher=!![];return _0x2c83a9[_0x9f85('0x58')](_0x110ad5,_0x229c2f[_0x9f85('0x54')],config[_0x9f85('0x59')][_0x9f85('0x5a')])['then'](function(){return _0x229c2f;});}return _0x229c2f;}})['then'](function(_0xe0c749){if(!_0xe0c749){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))](_0x9f85('0x7e'));}_0x55034c=_0xe0c749;return db[_0x9f85('0x7f')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x692133,null))[_0x9f85('0x2b')](function(_0xfa410c){if(_0xfa410c){_0x342c48=_0xfa410c;if(!_0x342c48['transcribe']||!_0x342c48[_0x9f85('0x80')]||!_0x342c48['transcribeRegion']||!_0x342c48[_0x9f85('0x81')]||!_0x342c48[_0x9f85('0x74')]){throw new db[(_0x9f85('0x66'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x567619[_0x9f85('0x50')][_0x9f85('0x82')]&&(!_0x342c48['sentiment']||!_0x342c48['sentimentAccountId']||!_0x342c48[_0x9f85('0x83')]||!_0x342c48[_0x9f85('0x81')]||!_0x342c48['bucket'])){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x9f85('0x84')]['findOne']({'where':{'id':_0x342c48[_0x9f85('0x80')]}});}})['then'](function(_0x4e9c5f){if(!_0x4e9c5f){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4e9c5f[_0x9f85('0x85')]||!_0x4e9c5f['data2']){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Cloud\x20Provider\x20not\x20configured');}_0x121cc9=_0x4e9c5f;return getBucketslist(_0x121cc9['data1'],_0x121cc9[_0x9f85('0x86')],_0x342c48['transcribeRegion']);})[_0x9f85('0x2b')](function(_0x1b42ee){if(_0x1b42ee&&_0x1b42ee[_0x9f85('0x87')]){var _0x4cdd23=_[_0x9f85('0x4d')](_0x1b42ee[_0x9f85('0x87')],function(_0x2c7b64){return _0x2c7b64[_0x9f85('0x88')]===_0x342c48[_0x9f85('0x74')];});if(!_0x4cdd23){logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x89'),_0x567619[_0x9f85('0x48')]['id'],_0x342c48[_0x9f85('0x74')]));return createBucket(_0x121cc9[_0x9f85('0x85')],_0x121cc9[_0x9f85('0x86')],_0x342c48[_0x9f85('0x8a')],_0x342c48[_0x9f85('0x74')]);}logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x8b'),_0x567619[_0x9f85('0x48')]['id'],_0x342c48[_0x9f85('0x74')]));return;}})[_0x9f85('0x2b')](function(_0x3091f9){if(_0x55034c[_0x9f85('0x8c')]===_0x9f85('0x8d')){return transcribe(_0x567619[_0x9f85('0x48')]['id'],_0x121cc9['data1'],_0x121cc9[_0x9f85('0x86')],_0x342c48[_0x9f85('0x8a')],_0x342c48[_0x9f85('0x74')],_0x55034c[_0x9f85('0x54')],_0x342c48[_0x9f85('0x81')]);}else{logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x8e'),_0x567619[_0x9f85('0x48')]['id']));return{'transcribeStatus':_0x9f85('0x8f')};}})['then'](function(_0x3803c1){if(_0x3803c1){_0x3803c1[_0x9f85('0x90')]=_0x567619[_0x9f85('0x50')][_0x9f85('0x82')];return _0x55034c[_0x9f85('0x91')](_0x3803c1);}})[_0x9f85('0x2b')](respondWithResult(_0x692133,null))['catch'](handleError(_0x692133,null));};function writeFile(_0xd36871,_0x90349a){return new Promise(function(_0x3bb2cb,_0x17fcc6){fs[_0x9f85('0x92')](_0x90349a,_0xd36871,function(_0x324777,_0x35b076){if(_0x324777){return _0x17fcc6(_0x324777);}else{return _0x3bb2cb(_0x35b076);}});});}exports['downloadTranscribe']=function(_0x11f5da,_0x10e101,_0x1f58cf){return db[_0x9f85('0x31')][_0x9f85('0x7d')]({'where':{'id':_0x11f5da[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](handleEntityNotFound(_0x10e101))[_0x9f85('0x2b')](function(_0x2294bc){if(_0x2294bc&&_0x2294bc[_0x9f85('0x93')]){var _0x3d163b=_0x2294bc[_0x9f85('0x93')];var _0x5cd029=config['root']+'/server/files/transcribes/transcribe_'+_0x2294bc['id']+'.txt';if(fs[_0x9f85('0x57')](_0x5cd029)){return _0x5cd029;}return writeFile(_0x3d163b,_0x5cd029)[_0x9f85('0x2b')](function(){return _0x5cd029;});}else{throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))](_0x9f85('0x94'));}})[_0x9f85('0x2b')](function(_0x1abcbc){return _0x10e101[_0x9f85('0x52')](_0x1abcbc);})[_0x9f85('0x4e')](handleError(_0x10e101));}; \ No newline at end of file +var _0x6870=['aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','stack','name','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','filters','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','downloads','sequelize','col','token','$and','push','decryptFile','secrets','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','recording','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','runSentiment','downloadTranscribe','fileText','root','.txt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x6870,0x1b2));var _0x0687=function(_0x5d869e,_0x1731bd){_0x5d869e=_0x5d869e-0x0;var _0x13a90b=_0x6870[_0x5d869e];return _0x13a90b;};'use strict';var emlformat=require(_0x0687('0x0'));var rimraf=require(_0x0687('0x1'));var zipdir=require(_0x0687('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0687('0x3'));var moment=require(_0x0687('0x4'));var BPromise=require(_0x0687('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0687('0x6'));var csv=require(_0x0687('0x7'));var ejs=require(_0x0687('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0687('0x9'));var squel=require(_0x0687('0xa'));var crypto=require(_0x0687('0xb'));var jsforce=require(_0x0687('0xc'));var deskjs=require(_0x0687('0xd'));var toCsv=require(_0x0687('0x7'));var querystring=require(_0x0687('0xe'));var Papa=require(_0x0687('0xf'));var AWS=require(_0x0687('0x10'));var uuidv4=require(_0x0687('0x11'));var Redis=require(_0x0687('0x12'));var authService=require(_0x0687('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0687('0x14'));var hardwareService=require(_0x0687('0x15'));var logger=require('../../config/logger')(_0x0687('0x16'));var utils=require(_0x0687('0x17'));var config=require(_0x0687('0x18'));var licenseUtil=require(_0x0687('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9063d9,_0x187f34){_0x187f34=_0x187f34||0xcc;return function(_0x362154){if(_0x362154){return _0x9063d9[_0x0687('0x1a')](_0x187f34);}return _0x9063d9[_0x0687('0x1b')](_0x187f34)['end']();};}function respondWithResult(_0x123525,_0x1c13d8){_0x1c13d8=_0x1c13d8||0xc8;return function(_0x3f6eb5){if(_0x3f6eb5){return _0x123525[_0x0687('0x1b')](_0x1c13d8)[_0x0687('0x1c')](_0x3f6eb5);}};}function respondWithFilteredResult(_0x223b92,_0x2b64d0){return function(_0x596f0b){if(_0x596f0b){var _0x254729=typeof _0x2b64d0[_0x0687('0x1d')]==='undefined'&&typeof _0x2b64d0[_0x0687('0x1e')]===_0x0687('0x1f');var _0x25469e=_0x596f0b[_0x0687('0x20')];var _0x5bb5e9=_0x254729?0x0:_0x2b64d0[_0x0687('0x1d')];var _0x5df260=_0x254729?_0x596f0b['count']:_0x2b64d0[_0x0687('0x1d')]+_0x2b64d0['limit'];var _0x46a240;if(_0x5df260>=_0x25469e){_0x5df260=_0x25469e;_0x46a240=0xc8;}else{_0x46a240=0xce;}_0x223b92[_0x0687('0x1b')](_0x46a240);return _0x223b92['set'](_0x0687('0x21'),_0x5bb5e9+'-'+_0x5df260+'/'+_0x25469e)['json'](_0x596f0b);}return null;};}function patchUpdates(_0x549fa2){return function(_0x36e759){try{jsonpatch[_0x0687('0x22')](_0x36e759,_0x549fa2,!![]);}catch(_0x3795c1){return BPromise[_0x0687('0x23')](_0x3795c1);}return _0x36e759[_0x0687('0x24')]();};}function saveUpdates(_0x452f3b,_0x59ac36){return function(_0x4474f1){if(_0x4474f1){return _0x4474f1[_0x0687('0x25')](_0x452f3b)[_0x0687('0x26')](function(_0x16da76){return _0x16da76;});}return null;};}function removeEntity(_0x3c5eeb,_0xca9ce8){return function(_0x1d6185){if(_0x1d6185){return _0x1d6185['destroy']()['then'](function(){_0x3c5eeb[_0x0687('0x1b')](0xcc)[_0x0687('0x27')]();});}};}function handleEntityNotFound(_0x288553,_0x315aa3){return function(_0xd133af){if(!_0xd133af){_0x288553[_0x0687('0x1a')](0x194);}return _0xd133af;};}function handleError(_0x4cf1bb,_0x2209e6){_0x2209e6=_0x2209e6||0x1f4;return function(_0x665b4b){logger['error'](_0x665b4b[_0x0687('0x28')]);if(_0x665b4b[_0x0687('0x29')]){delete _0x665b4b['name'];}_0x4cf1bb[_0x0687('0x1b')](_0x2209e6)['send'](_0x665b4b);};}exports[_0x0687('0x2a')]=function(_0x432ed4,_0x3c5860){var _0x42c450={},_0x36cce5={},_0x194222={'count':0x0,'rows':[]};var _0x2538eb=_['map'](db[_0x0687('0x2b')][_0x0687('0x2c')],function(_0x3c7256){return{'name':_0x3c7256[_0x0687('0x2d')],'type':_0x3c7256['type'][_0x0687('0x2e')]};});_0x36cce5[_0x0687('0x2f')]=_[_0x0687('0x30')](_['map'](_0x2538eb,_0x0687('0x29')),[_0x0687('0x31')]);_0x36cce5[_0x0687('0x32')]=_[_0x0687('0x33')](_0x432ed4[_0x0687('0x32')]);_0x36cce5['filters']=_[_0x0687('0x34')](_0x36cce5[_0x0687('0x2f')],_0x36cce5[_0x0687('0x32')]);_0x42c450[_0x0687('0x35')]=_[_0x0687('0x34')](_0x36cce5[_0x0687('0x2f')],qs[_0x0687('0x36')](_0x432ed4[_0x0687('0x32')][_0x0687('0x36')]));_0x42c450[_0x0687('0x35')]=_0x42c450[_0x0687('0x35')][_0x0687('0x37')]?_0x42c450['attributes']:_0x36cce5[_0x0687('0x2f')];if(!_0x432ed4[_0x0687('0x32')][_0x0687('0x38')]('nolimit')){_0x42c450[_0x0687('0x1e')]=qs[_0x0687('0x1e')](_0x432ed4[_0x0687('0x32')][_0x0687('0x1e')]);_0x42c450[_0x0687('0x1d')]=qs[_0x0687('0x1d')](_0x432ed4[_0x0687('0x32')][_0x0687('0x1d')]);}_0x42c450[_0x0687('0x39')]=qs['sort'](_0x432ed4[_0x0687('0x32')]['sort']);_0x42c450['where']=qs[_0x0687('0x3a')](_[_0x0687('0x3b')](_0x432ed4['query'],_0x36cce5[_0x0687('0x3a')]),_0x2538eb);if(_0x432ed4[_0x0687('0x32')]['filter']){_0x42c450[_0x0687('0x3c')]=_[_0x0687('0x3d')](_0x42c450[_0x0687('0x3c')],{'$or':_[_0x0687('0x3e')](_0x2538eb,function(_0x211fdd){if(_0x211fdd[_0x0687('0x3f')]!==_0x0687('0x40')){var _0x184954={};_0x184954[_0x211fdd['name']]={'$like':'%'+_0x432ed4[_0x0687('0x32')][_0x0687('0x41')]+'%'};return _0x184954;}})});}_0x42c450=_['merge']({},_0x42c450,_0x432ed4[_0x0687('0x42')]);var _0x5bdd6b={'where':_0x42c450[_0x0687('0x3c')]};return db[_0x0687('0x2b')]['count'](_0x5bdd6b)[_0x0687('0x26')](function(_0x1f5e07){_0x194222[_0x0687('0x20')]=_0x1f5e07;if(_0x432ed4[_0x0687('0x32')][_0x0687('0x43')]){_0x42c450[_0x0687('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0x0687('0x45')](_0x42c450);})['then'](function(_0x5a4af9){_0x194222['rows']=_0x5a4af9;return _0x194222;})[_0x0687('0x26')](respondWithFilteredResult(_0x3c5860,_0x42c450))[_0x0687('0x46')](handleError(_0x3c5860,null));};exports[_0x0687('0x47')]=function(_0x3136b,_0x5c0d96){var _0x1f2715={'raw':![],'where':{'id':_0x3136b['params']['id']}},_0x537ce8={};_0x537ce8[_0x0687('0x2f')]=_[_0x0687('0x33')](db[_0x0687('0x2b')]['rawAttributes']);_0x537ce8[_0x0687('0x32')]=_[_0x0687('0x33')](_0x3136b['query']);_0x537ce8[_0x0687('0x3a')]=_[_0x0687('0x34')](_0x537ce8[_0x0687('0x2f')],_0x537ce8[_0x0687('0x32')]);_0x1f2715[_0x0687('0x35')]=_[_0x0687('0x34')](_0x537ce8[_0x0687('0x2f')],qs[_0x0687('0x36')](_0x3136b[_0x0687('0x32')][_0x0687('0x36')]));_0x1f2715[_0x0687('0x35')]=_0x1f2715['attributes'][_0x0687('0x37')]?_0x1f2715['attributes']:_0x537ce8[_0x0687('0x2f')];if(_0x3136b[_0x0687('0x32')][_0x0687('0x43')]){_0x1f2715[_0x0687('0x44')]=[{'all':!![]}];}_0x1f2715=_[_0x0687('0x3d')]({},_0x1f2715,_0x3136b['options']);return db['VoiceRecording']['find'](_0x1f2715)['then'](handleEntityNotFound(_0x5c0d96,null))[_0x0687('0x26')](respondWithResult(_0x5c0d96,null))[_0x0687('0x46')](handleError(_0x5c0d96,null));};exports['create']=function(_0x55963b,_0x125558){return db[_0x0687('0x2b')][_0x0687('0x48')](_0x55963b[_0x0687('0x49')],{})[_0x0687('0x26')](respondWithResult(_0x125558,0xc9))[_0x0687('0x46')](handleError(_0x125558,null));};exports[_0x0687('0x25')]=function(_0x5bbe84,_0xfd39d9){if(_0x5bbe84[_0x0687('0x49')]['id']){delete _0x5bbe84[_0x0687('0x49')]['id'];}return db[_0x0687('0x2b')][_0x0687('0x4a')]({'where':{'id':_0x5bbe84[_0x0687('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfd39d9,null))[_0x0687('0x26')](saveUpdates(_0x5bbe84[_0x0687('0x49')],null))[_0x0687('0x26')](respondWithResult(_0xfd39d9,null))[_0x0687('0x46')](handleError(_0xfd39d9,null));};exports[_0x0687('0x4c')]=function(_0x2d2eb7,_0x27163f){return db['VoiceRecording'][_0x0687('0x4c')]()['then'](respondWithResult(_0x27163f,null))['catch'](handleError(_0x27163f,null));};exports[_0x0687('0x4d')]=function(_0xa20254,_0x4af9c8,_0x42f97a){var _0xc6b4c8=require(_0x0687('0x4e'));var _0x499855=![];var _0x2e7383={};if(_0xa20254[_0x0687('0x32')][_0x0687('0x3f')]&&_0xa20254[_0x0687('0x32')][_0x0687('0x3f')]===_0x0687('0x4f')){_0x2e7383[_0x0687('0x4f')]=_0xa20254['params']['id'];}else{_0x2e7383['id']=_0xa20254[_0x0687('0x4b')]['id'];}return db[_0x0687('0x2b')]['find']({'where':_0x2e7383,'attributes':['id','value'],'raw':!![]})[_0x0687('0x26')](handleEntityNotFound(_0x4af9c8,null))[_0x0687('0x26')](function(_0xd35b03){if(_0xd35b03){var _0x58c6ad=_0xd35b03[_0x0687('0x50')];var _0x3905f9=util[_0x0687('0x31')](_0x0687('0x51'),_0x58c6ad);if(fs['existsSync'](_0x3905f9)){_0x499855=!![];return _0xc6b4c8['decryptFile'](_0x3905f9,_0x58c6ad,config['secrets']['recording'])[_0x0687('0x26')](function(){return _0xd35b03;});}return _0xd35b03;}})[_0x0687('0x26')](function(_0x3afd82){if(_0x3afd82){var _0x5be5bd=_0x3afd82[_0x0687('0x50')];if(!fs[_0x0687('0x52')](_0x5be5bd)){throw new db[(_0x0687('0x53'))][(_0x0687('0x54'))](_0x0687('0x55'));}if(_0x3afd82[_0x0687('0x56')]){return _0x4af9c8['download'](_0x5be5bd,_0x3afd82[_0x0687('0x56')]+path[_0x0687('0x57')](_0x5be5bd),function(){if(_0x499855){fs['unlink'](_0x5be5bd);}});}else{return _0x4af9c8[_0x0687('0x4d')](_0x5be5bd,function(_0x57fccd){if(_0x499855){fs[_0x0687('0x58')](_0x5be5bd);}});}}})[_0x0687('0x46')](function(_0x2624f0){if(_0x2624f0['message']===_0x0687('0x55')){_0x4af9c8[_0x0687('0x1b')](0x194)[_0x0687('0x59')](_0x0687('0x5a'));}else{return handleError(_0x4af9c8,null);}});};exports[_0x0687('0x5b')]=function(_0x39a500,_0x527dbf,_0x302aa9){var _0x20d63e=require(_0x0687('0x4e'));var _0x5622e2=![];var _0x3137e4={'$and':[db[_0x0687('0x5c')]['where'](db[_0x0687('0x5c')]['fn']('MD5',db[_0x0687('0x5c')][_0x0687('0x5d')](_0x0687('0x4f'))),_0x39a500[_0x0687('0x32')][_0x0687('0x5e')])]};if(_0x39a500['query'][_0x0687('0x3f')]&&_0x39a500[_0x0687('0x32')][_0x0687('0x3f')]===_0x0687('0x4f')){_0x3137e4[_0x0687('0x5f')][_0x0687('0x60')]({'uniqueid':_0x39a500[_0x0687('0x4b')]['id']});}else{_0x3137e4[_0x0687('0x5f')][_0x0687('0x60')]({'id':_0x39a500[_0x0687('0x4b')]['id']});}return db[_0x0687('0x2b')][_0x0687('0x4a')]({'where':_0x3137e4,'attributes':['id','value'],'raw':!![]})[_0x0687('0x26')](handleEntityNotFound(_0x527dbf,null))[_0x0687('0x26')](function(_0x2089e3){if(_0x2089e3){var _0xaeae7f=util[_0x0687('0x31')]('%s.cypher',_0x2089e3[_0x0687('0x50')]);if(fs[_0x0687('0x52')](_0xaeae7f)){_0x5622e2=!![];return _0x20d63e[_0x0687('0x61')](_0xaeae7f,_0x2089e3[_0x0687('0x50')],config[_0x0687('0x62')]['recording'])[_0x0687('0x26')](function(){return _0x2089e3;});}return _0x2089e3;}})[_0x0687('0x26')](function(_0x4e704c){if(_0x4e704c){if(!fs[_0x0687('0x52')](_0x4e704c[_0x0687('0x50')])){throw new db[(_0x0687('0x53'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x4e704c[_0x0687('0x56')]){return _0x527dbf[_0x0687('0x4d')](_0x4e704c[_0x0687('0x50')],_0x4e704c[_0x0687('0x56')]+path[_0x0687('0x57')](_0x4e704c[_0x0687('0x50')]),function(){if(_0x5622e2){fs['unlink'](_0x4e704c[_0x0687('0x50')]);}});}else{return _0x527dbf['download'](_0x4e704c[_0x0687('0x50')],function(_0x3e7454){if(_0x5622e2){fs[_0x0687('0x58')](_0x4e704c[_0x0687('0x50')]);}});}}})['catch'](handleError(_0x527dbf,null));};exports[_0x0687('0x63')]=function(_0x167927,_0x285970){return db['VoiceRecording'][_0x0687('0x4a')]({'where':{'id':_0x167927[_0x0687('0x4b')]['id']}})[_0x0687('0x26')](function(_0x13595e){if(_[_0x0687('0x64')](_0x13595e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x13595e;})['then'](function(_0x2eca03){var _0x38901e=_0x2eca03[_0x0687('0x50')];logger[_0x0687('0x65')](_0x0687('0x66'),_0x38901e);if(!_['isNil'](_0x2eca03[_0x0687('0x50')])&&fs[_0x0687('0x52')](_0x38901e)){logger[_0x0687('0x65')](_0x0687('0x67')+_0x38901e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38901e);}_0x38901e=_0x38901e+'.cypher';if(!_[_0x0687('0x64')](_0x2eca03[_0x0687('0x50')])&&fs[_0x0687('0x52')](_0x38901e)){logger[_0x0687('0x65')](_0x0687('0x67')+_0x38901e+_0x0687('0x68'));fs[_0x0687('0x69')](_0x38901e);}return _0x2eca03;})[_0x0687('0x26')](function(_0x290b85){if(!_0x290b85)throw new InternalError();return _0x290b85['destroy']();})[_0x0687('0x26')](function(){_0x285970[_0x0687('0x1b')](0xcc)[_0x0687('0x27')]();})['catch'](handleError(_0x285970,null));};function getBucketslist(_0x2cc313,_0x5ad569,_0x46817c){return new Promise(function(_0x488a34,_0x54a110){var _0x60beb4=new AWS['S3']({'accessKeyId':_0x5ad569,'secretAccessKey':_0x2cc313,'region':_0x46817c});_0x60beb4[_0x0687('0x6a')]({},function(_0x49eb9b,_0x16153e){if(_0x49eb9b){return _0x54a110(_0x49eb9b);}else{return _0x488a34(_0x16153e);}});});}function createBucket(_0x25866d,_0x26697f,_0x4022cd,_0x3653ce){return new Promise(function(_0x13c36f,_0x157ca0){var _0x51b301=new AWS['S3']({'accessKeyId':_0x26697f,'secretAccessKey':_0x25866d,'region':_0x4022cd});_0x51b301['createBucket']({'Bucket':_0x3653ce},function(_0x3ac103,_0x347c4f){if(_0x3ac103){return _0x157ca0(_0x3ac103);}else{return _0x13c36f(_0x347c4f);}});});}function uploadFile(_0xc0f5f9,_0x2c9d75,_0x5ca3bb,_0x42baaf,_0x947dd0,_0x13da96){return new Promise(function(_0x5a777a,_0x4c6b72){var _0x3be246=new AWS['S3']({'accessKeyId':_0x2c9d75,'secretAccessKey':_0xc0f5f9,'region':_0x5ca3bb});_0x3be246[_0x0687('0x6b')]({'Bucket':_0x42baaf,'Key':_0x947dd0,'Body':_0x13da96},function(_0x3bcfe6,_0x45f1a8){if(_0x3bcfe6){return _0x4c6b72(_0x3bcfe6);}else{return _0x5a777a(_0x45f1a8);}});});}function startTranscribe(_0x12ae6c,_0x2623c7,_0x340702,_0x13ddf3,_0x55010a,_0x105b71){return new Promise(function(_0x80fbb1,_0x3a18bb){var _0x31f41f=new AWS[(_0x0687('0x6c'))]({'accessKeyId':_0x2623c7,'secretAccessKey':_0x12ae6c,'region':_0x340702});_0x31f41f[_0x0687('0x6d')]({'TranscriptionJobName':_0x13ddf3,'LanguageCode':_0x55010a,'Media':{'MediaFileUri':_0x105b71}},function(_0x2e657b,_0x2b4efc){if(_0x2e657b){return _0x3a18bb(_0x2e657b);}else{return _0x80fbb1(_0x2b4efc);}});});}function transcribe(_0x13ec07,_0x35c889,_0x3b92ae,_0x21651d,_0x2d81ba,_0x2c8c91,_0x314db5){return new Promise(function(_0x3f121d,_0x289e29){var _0x3ac94b={};logger[_0x0687('0x65')](util[_0x0687('0x31')](_0x0687('0x6e'),_0x13ec07,_0x2d81ba));return uploadFile(_0x35c889,_0x3b92ae,_0x21651d,_0x2d81ba,path[_0x0687('0x6f')](_0x2c8c91),fs['readFileSync'](_0x2c8c91))['then'](function(_0x5c9e77){logger[_0x0687('0x65')](util[_0x0687('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x13ec07,_0x2d81ba,_0x5c9e77['Location']));_0x3ac94b['bucket']=_0x5c9e77[_0x0687('0x70')];_0x3ac94b[_0x0687('0x71')]=_0x5c9e77[_0x0687('0x72')];logger[_0x0687('0x65')](util[_0x0687('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x13ec07));return startTranscribe(_0x35c889,_0x3b92ae,_0x21651d,uuidv4(),_0x314db5,_0x5c9e77['Location']);})[_0x0687('0x26')](function(_0x3d8ddc){logger[_0x0687('0x65')](util[_0x0687('0x31')](_0x0687('0x73'),_0x13ec07,_0x3d8ddc[_0x0687('0x74')][_0x0687('0x75')]));_0x3ac94b['transcribeName']=_0x3d8ddc['TranscriptionJob']['TranscriptionJobName'];_0x3ac94b['transcribeStatus']=_0x3d8ddc[_0x0687('0x74')]['TranscriptionJobStatus'];return _0x3f121d(_0x3ac94b);})[_0x0687('0x46')](function(_0x10149a){return _0x289e29(_0x10149a);});});}exports[_0x0687('0x76')]=function(_0x12e714,_0x4120b3,_0x5f44ce){var _0x1c415f;var _0x464595;var _0x4f3af2;var _0x5a494d=require('../../components/encryptor');return db[_0x0687('0x2b')]['findOne']({'where':{'id':_0x12e714[_0x0687('0x4b')]['id']}})[_0x0687('0x26')](function(_0x399d89){if(_0x399d89){var _0x58908c=util[_0x0687('0x31')](_0x0687('0x51'),_0x399d89[_0x0687('0x50')]);if(fs[_0x0687('0x52')](_0x58908c)){cypher=!![];return _0x5a494d[_0x0687('0x61')](_0x58908c,_0x399d89[_0x0687('0x50')],config[_0x0687('0x62')][_0x0687('0x77')])['then'](function(){return _0x399d89;});}return _0x399d89;}})[_0x0687('0x26')](function(_0x2d43e6){if(!_0x2d43e6){throw new db['Sequelize'][(_0x0687('0x54'))](_0x0687('0x78'));}_0x464595=_0x2d43e6;return db[_0x0687('0x79')][_0x0687('0x7a')]({'where':{'id':0x1}});})[_0x0687('0x26')](handleEntityNotFound(_0x4120b3,null))['then'](function(_0x562569){if(_0x562569){_0x1c415f=_0x562569;if(!_0x1c415f[_0x0687('0x7b')]||!_0x1c415f[_0x0687('0x7c')]||!_0x1c415f[_0x0687('0x7d')]||!_0x1c415f[_0x0687('0x7e')]||!_0x1c415f['bucket']){throw new db['Sequelize'][(_0x0687('0x54'))](_0x0687('0x7f'));}if(_0x12e714[_0x0687('0x49')]['runSentiment']&&(!_0x1c415f[_0x0687('0x80')]||!_0x1c415f[_0x0687('0x81')]||!_0x1c415f[_0x0687('0x82')]||!_0x1c415f[_0x0687('0x7e')]||!_0x1c415f[_0x0687('0x83')])){throw new db[(_0x0687('0x53'))][(_0x0687('0x54'))](_0x0687('0x84'));}return db[_0x0687('0x85')]['findOne']({'where':{'id':_0x1c415f['transcribeAccountId']}});}})[_0x0687('0x26')](function(_0x228a6b){if(!_0x228a6b){throw new db[(_0x0687('0x53'))][(_0x0687('0x54'))](_0x0687('0x86'));}if(!_0x228a6b[_0x0687('0x87')]||!_0x228a6b[_0x0687('0x88')]){throw new db[(_0x0687('0x53'))][(_0x0687('0x54'))](_0x0687('0x89'));}_0x4f3af2=_0x228a6b;return getBucketslist(_0x4f3af2[_0x0687('0x87')],_0x4f3af2[_0x0687('0x88')],_0x1c415f[_0x0687('0x7d')]);})['then'](function(_0x3b229a){if(_0x3b229a&&_0x3b229a[_0x0687('0x8a')]){var _0x35a52a=_[_0x0687('0x4a')](_0x3b229a[_0x0687('0x8a')],function(_0x363df1){return _0x363df1[_0x0687('0x8b')]===_0x1c415f[_0x0687('0x83')];});if(!_0x35a52a){logger[_0x0687('0x65')](util[_0x0687('0x31')](_0x0687('0x8c'),_0x12e714[_0x0687('0x4b')]['id'],_0x1c415f['bucket']));return createBucket(_0x4f3af2['data1'],_0x4f3af2['data2'],_0x1c415f[_0x0687('0x7d')],_0x1c415f[_0x0687('0x83')]);}logger['info'](util[_0x0687('0x31')](_0x0687('0x8d'),_0x12e714[_0x0687('0x4b')]['id'],_0x1c415f[_0x0687('0x83')]));return;}})['then'](function(_0x4b1e59){if(_0x464595[_0x0687('0x8e')]===_0x0687('0x8f')){return transcribe(_0x12e714[_0x0687('0x4b')]['id'],_0x4f3af2['data1'],_0x4f3af2[_0x0687('0x88')],_0x1c415f['transcribeRegion'],_0x1c415f[_0x0687('0x83')],_0x464595[_0x0687('0x50')],_0x1c415f[_0x0687('0x7e')]);}else{logger[_0x0687('0x65')](util[_0x0687('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x12e714[_0x0687('0x4b')]['id']));return{'transcribeStatus':_0x0687('0x90')};}})[_0x0687('0x26')](function(_0x3f732d){if(_0x3f732d){_0x3f732d['tempSentiment']=_0x12e714[_0x0687('0x49')][_0x0687('0x91')];return _0x464595['updateAttributes'](_0x3f732d);}})[_0x0687('0x26')](respondWithResult(_0x4120b3,null))[_0x0687('0x46')](handleError(_0x4120b3,null));};function writeFile(_0x541ca9,_0x3f93f5){return new Promise(function(_0x94e538,_0x72d538){fs['writeFile'](_0x3f93f5,_0x541ca9,function(_0x3f394d,_0x1d70fe){if(_0x3f394d){return _0x72d538(_0x3f394d);}else{return _0x94e538(_0x1d70fe);}});});}exports[_0x0687('0x92')]=function(_0x22a69c,_0x3f5c59,_0xb1aa09){return db[_0x0687('0x2b')][_0x0687('0x7a')]({'where':{'id':_0x22a69c[_0x0687('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f5c59))['then'](function(_0x1fc59e){if(_0x1fc59e&&_0x1fc59e[_0x0687('0x93')]){var _0x4051e6=_0x1fc59e[_0x0687('0x93')];var _0x1f04a1=config[_0x0687('0x94')]+'/server/files/transcribes/transcribe_'+_0x1fc59e['id']+_0x0687('0x95');if(fs[_0x0687('0x52')](_0x1f04a1)){return _0x1f04a1;}return writeFile(_0x4051e6,_0x1f04a1)[_0x0687('0x26')](function(){return _0x1f04a1;});}else{throw new db[(_0x0687('0x53'))][(_0x0687('0x54'))]('Transcript\x20not\x20available');}})[_0x0687('0x26')](function(_0x5440ef){return _0x3f5c59[_0x0687('0x4d')](_0x5440ef);})[_0x0687('0x46')](handleError(_0x3f5c59));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5566c4b..934b99e 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 _0x6ce9=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6ce9,0x76));var _0x96ce=function(_0x52a35c,_0x428a26){_0x52a35c=_0x52a35c-0x0;var _0x5c9744=_0x6ce9[_0x52a35c];return _0x5c9744;};'use strict';var attributes=require(_0x96ce('0x0'));module[_0x96ce('0x1')]=function(_0x1d736b,_0x59dbfa){return _0x1d736b['define'](_0x96ce('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x96ce('0x3'),'fields':[_0x96ce('0x3')]},{'name':_0x96ce('0x4'),'fields':[_0x96ce('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeedf=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','transcribeStatus'];(function(_0x290a92,_0x3a8e7b){var _0x60fb42=function(_0x4af84f){while(--_0x4af84f){_0x290a92['push'](_0x290a92['shift']());}};_0x60fb42(++_0x3a8e7b);}(_0xeedf,0x12c));var _0xfeed=function(_0x420de9,_0x3e82ef){_0x420de9=_0x420de9-0x0;var _0x8710e3=_0xeedf[_0x420de9];return _0x8710e3;};'use strict';var attributes=require(_0xfeed('0x0'));module[_0xfeed('0x1')]=function(_0x195e7b,_0x4d5201){return _0x195e7b[_0xfeed('0x2')]('VoiceRecording',attributes,{'tableName':_0xfeed('0x3'),'paranoid':![],'indexes':[{'name':_0xfeed('0x4'),'fields':[_0xfeed('0x4')]},{'name':_0xfeed('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d2f06c1..61d3e91 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 _0x627e=['VoiceRecording','create','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','update','options','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption'];(function(_0x165b43,_0x3de42d){var _0x39e8b8=function(_0x48c8d6){while(--_0x48c8d6){_0x165b43['push'](_0x165b43['shift']());}};_0x39e8b8(++_0x3de42d);}(_0x627e,0x14a));var _0xe627=function(_0x59a595,_0x204da9){_0x59a595=_0x59a595-0x0;var _0x29bf1f=_0x627e[_0x59a595];return _0x29bf1f;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['VoiceRecording'][_0xe627('0x15')](_0x56559b['body'],{'raw':_0x56559b['options']?_0x56559b[_0xe627('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56559b[_0xe627('0x16')]?_0x56559b[_0xe627('0x16')]['where']||null:null,'attributes':_0x56559b['options']?_0x56559b['options'][_0xe627('0x17')]||null:null,'limit':_0x56559b[_0xe627('0x16')]?_0x56559b['options'][_0xe627('0x18')]||null:null})[_0xe627('0x19')](function(_0x4873e6){logger[_0xe627('0xb')](_0xe627('0x14'),_0x56559b);logger['debug'](_0xe627('0x14'),_0x56559b,JSON[_0xe627('0xf')](_0x4873e6));_0x538b22(_0x4873e6);})[_0xe627('0x13')](function(_0x536b02){logger[_0xe627('0x10')](_0xe627('0x14'),_0x536b02[_0xe627('0x12')],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0x536b02['message']));});});};exports[_0xe627('0x1a')]=function(_0x1fe192){var _0x1635a0=this;return new Promise(function(_0x29eb8e,_0xda614){var _0x40ab91=require(_0xe627('0x1b'));var _0x44c9f7;return db[_0xe627('0x1c')]['findOne']({'attributes':['id',_0xe627('0x1d')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5cd7c8){_0x44c9f7=_0x5cd7c8;return db[_0xe627('0x1e')][_0xe627('0x1f')](_0x1fe192['body']);})[_0xe627('0x19')](function(_0x54029d){if(_0x44c9f7[_0xe627('0x1d')]&&fs['existsSync'](_0x54029d[_0xe627('0x20')])){var _0x26833a=util['format'](_0xe627('0x21'),_0x54029d['value']);return _0x40ab91[_0xe627('0x22')](_0x54029d[_0xe627('0x20')],_0x26833a,config[_0xe627('0x23')][_0xe627('0x24')])[_0xe627('0x19')](function(){fs[_0xe627('0x25')](_0x54029d[_0xe627('0x20')]);logger[_0xe627('0xb')](_0xe627('0x26'));return _0x54029d;});}return _0x54029d;})[_0xe627('0x19')](function(_0x12ebc9){logger['info']('CreateVoiceRecording',_0x1fe192);logger[_0xe627('0x27')]('CreateVoiceRecording',_0x1fe192,JSON[_0xe627('0xf')](_0x12ebc9));_0x29eb8e(_0x12ebc9);})['catch'](function(_0x56d1d7){logger[_0xe627('0x10')]('CreateVoiceRecording',_0x56d1d7['message'],_0x1fe192);_0xda614(_0x1635a0[_0xe627('0x10')](0x1f4,_0x56d1d7[_0xe627('0x12')]));});});}; \ No newline at end of file +var _0x1a85=['existsSync','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create'];(function(_0x26f5ce,_0x266b8f){var _0x5cf90d=function(_0x4e935f){while(--_0x4e935f){_0x26f5ce['push'](_0x26f5ce['shift']());}};_0x5cf90d(++_0x266b8f);}(_0x1a85,0x178));var _0x51a8=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0x1a85[_0x40348a];return _0x290d46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['update'](_0x45a433[_0x51a8('0x15')],{'raw':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x18')]||null:null,'attributes':_0x45a433[_0x51a8('0x16')]?_0x45a433['options'][_0x51a8('0x19')]||null:null,'limit':_0x45a433['options']?_0x45a433[_0x51a8('0x16')][_0x51a8('0x1a')]||null:null})[_0x51a8('0x1b')](function(_0x3759d6){logger['info'](_0x51a8('0x13'),_0x45a433);logger['debug']('UpdateVoiceRecording',_0x45a433,JSON[_0x51a8('0xd')](_0x3759d6));_0x23539e(_0x3759d6);})['catch'](function(_0x384d25){logger[_0x51a8('0xe')](_0x51a8('0x13'),_0x384d25[_0x51a8('0x10')],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x384d25[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1c')]=function(_0x1326a2){var _0x5b3f49=this;return new Promise(function(_0x273ce2,_0x1b7577){var _0xca5746=require(_0x51a8('0x1d'));var _0x1c150d;return db[_0x51a8('0x1e')][_0x51a8('0x1f')]({'attributes':['id',_0x51a8('0x20')],'where':{'id':0x1},'raw':!![]})[_0x51a8('0x1b')](function(_0x4b5cda){_0x1c150d=_0x4b5cda;return db[_0x51a8('0x14')][_0x51a8('0x21')](_0x1326a2['body']);})[_0x51a8('0x1b')](function(_0x58cba0){if(_0x1c150d[_0x51a8('0x20')]&&fs[_0x51a8('0x22')](_0x58cba0[_0x51a8('0x23')])){var _0x41df56=util[_0x51a8('0x24')]('%s.cypher',_0x58cba0[_0x51a8('0x23')]);return _0xca5746['encryptFile'](_0x58cba0[_0x51a8('0x23')],_0x41df56,config[_0x51a8('0x25')][_0x51a8('0x26')])['then'](function(){fs[_0x51a8('0x27')](_0x58cba0['value']);logger[_0x51a8('0x8')](_0x51a8('0x28'));return _0x58cba0;});}return _0x58cba0;})[_0x51a8('0x1b')](function(_0x224099){logger[_0x51a8('0x8')]('CreateVoiceRecording',_0x1326a2);logger[_0x51a8('0xb')]('CreateVoiceRecording',_0x1326a2,JSON[_0x51a8('0xd')](_0x224099));_0x273ce2(_0x224099);})[_0x51a8('0x12')](function(_0x41561a){logger['error'](_0x51a8('0x1c'),_0x41561a[_0x51a8('0x10')],_0x1326a2);_0x1b7577(_0x5b3f49[_0x51a8('0xe')](0x1f4,_0x41561a[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 52a4534..79eb12c 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 _0xc85e=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','show','create','put','update','delete','/:id','exports'];(function(_0x20b7aa,_0x3a5091){var _0x392922=function(_0x3f60b3){while(--_0x3f60b3){_0x20b7aa['push'](_0x20b7aa['shift']());}};_0x392922(++_0x3a5091);}(_0xc85e,0x90));var _0xec85=function(_0x44135a,_0x51b809){_0x44135a=_0x44135a-0x0;var _0x418199=_0xc85e[_0x44135a];return _0x418199;};'use strict';var multer=require('multer');var util=require(_0xec85('0x0'));var path=require(_0xec85('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xec85('0x2')]();var fs_extra=require(_0xec85('0x3'));var auth=require(_0xec85('0x4'));var interaction=require(_0xec85('0x5'));var config=require(_0xec85('0x6'));var controller=require(_0xec85('0x7'));router[_0xec85('0x8')]('/',auth[_0xec85('0x9')](),controller[_0xec85('0xa')]);router[_0xec85('0x8')]('/describe',auth[_0xec85('0x9')](),controller['describe']);router[_0xec85('0x8')]('/:id',auth[_0xec85('0x9')](),controller[_0xec85('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec85('0xc')]);router[_0xec85('0xd')]('/:id',auth[_0xec85('0x9')](),controller[_0xec85('0xe')]);router[_0xec85('0xf')](_0xec85('0x10'),auth[_0xec85('0x9')](),controller['destroy']);module[_0xec85('0x11')]=router; \ No newline at end of file +var _0x9a1c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x9a1c,0x19e));var _0xc9a1=function(_0x2c7be6,_0x505dc9){_0x2c7be6=_0x2c7be6-0x0;var _0xc1110f=_0x9a1c[_0x2c7be6];return _0xc1110f;};'use strict';var multer=require(_0xc9a1('0x0'));var util=require(_0xc9a1('0x1'));var path=require(_0xc9a1('0x2'));var timeout=require(_0xc9a1('0x3'));var express=require(_0xc9a1('0x4'));var router=express[_0xc9a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc9a1('0x6'));var interaction=require(_0xc9a1('0x7'));var config=require(_0xc9a1('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xc9a1('0x9')]('/',auth[_0xc9a1('0xa')](),controller[_0xc9a1('0xb')]);router[_0xc9a1('0x9')](_0xc9a1('0xc'),auth[_0xc9a1('0xa')](),controller[_0xc9a1('0xd')]);router[_0xc9a1('0x9')](_0xc9a1('0xe'),auth['isAuthenticated'](),controller[_0xc9a1('0xf')]);router[_0xc9a1('0x10')]('/',auth[_0xc9a1('0xa')](),controller[_0xc9a1('0x11')]);router['put'](_0xc9a1('0xe'),auth[_0xc9a1('0xa')](),controller[_0xc9a1('0x12')]);router[_0xc9a1('0x13')](_0xc9a1('0xe'),auth['isAuthenticated'](),controller[_0xc9a1('0x14')]);module[_0xc9a1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index cfe2042..347c051 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 _0x33c8=['sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x44c882,_0x37b7dd){var _0x5cd976=function(_0xcc6884){while(--_0xcc6884){_0x44c882['push'](_0x44c882['shift']());}};_0x5cd976(++_0x37b7dd);}(_0x33c8,0xc6));var _0x833c=function(_0x442f16,_0x4ed123){_0x442f16=_0x442f16-0x0;var _0x94ae3f=_0x33c8[_0x442f16];return _0x94ae3f;};'use strict';var Sequelize=require(_0x833c('0x0'));var moment=require('moment');module[_0x833c('0x1')]={'type':{'type':Sequelize[_0x833c('0x2')](_0x833c('0x3'),_0x833c('0x4'))},'result':{'type':Sequelize[_0x833c('0x5')]},'transfererchannel':{'type':Sequelize[_0x833c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x833c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x833c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x833c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x833c('0x5')]},'transferercontext':{'type':Sequelize[_0x833c('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x833c('0x5')]},'transfereechannel':{'type':Sequelize[_0x833c('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x833c('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x833c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x833c('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x833c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x833c('0x5')]},'isexternal':{'type':Sequelize[_0x833c('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x833c('0x5')]}}; \ No newline at end of file +var _0xe2bb=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x3f8ab5,_0x1f3612){var _0x4115af=function(_0x136484){while(--_0x136484){_0x3f8ab5['push'](_0x3f8ab5['shift']());}};_0x4115af(++_0x1f3612);}(_0xe2bb,0x133));var _0xbe2b=function(_0x58b3d5,_0x5584f8){_0x58b3d5=_0x58b3d5-0x0;var _0x2f6de9=_0xe2bb[_0x58b3d5];return _0x2f6de9;};'use strict';var Sequelize=require(_0xbe2b('0x0'));var moment=require(_0xbe2b('0x1'));module[_0xbe2b('0x2')]={'type':{'type':Sequelize[_0xbe2b('0x3')](_0xbe2b('0x4'),_0xbe2b('0x5'))},'result':{'type':Sequelize[_0xbe2b('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xbe2b('0x6')]},'transferercalleridname':{'type':Sequelize[_0xbe2b('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbe2b('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xbe2b('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xbe2b('0x6')]},'transferercontext':{'type':Sequelize[_0xbe2b('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xbe2b('0x6')]},'transfereechannel':{'type':Sequelize[_0xbe2b('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xbe2b('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xbe2b('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbe2b('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xbe2b('0x6')]},'transfereeexten':{'type':Sequelize[_0xbe2b('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xbe2b('0x6')]},'isexternal':{'type':Sequelize[_0xbe2b('0x3')](_0xbe2b('0x7'),'No')},'context':{'type':Sequelize[_0xbe2b('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9aff060..e7a39fe 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 _0x4c1f=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','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/license/util','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','status','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','VoiceTransferReport','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','eml-format','rimraf'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x4c1f,0x92));var _0xf4c1=function(_0x45be44,_0x295880){_0x45be44=_0x45be44-0x0;var _0x12e2e6=_0x4c1f[_0x45be44];return _0x12e2e6;};'use strict';var emlformat=require(_0xf4c1('0x0'));var rimraf=require(_0xf4c1('0x1'));var zipdir=require(_0xf4c1('0x2'));var jsonpatch=require(_0xf4c1('0x3'));var rp=require(_0xf4c1('0x4'));var moment=require('moment');var BPromise=require(_0xf4c1('0x5'));var Mustache=require(_0xf4c1('0x6'));var util=require('util');var path=require(_0xf4c1('0x7'));var sox=require('sox');var csv=require(_0xf4c1('0x8'));var ejs=require(_0xf4c1('0x9'));var fs=require('fs');var fs_extra=require(_0xf4c1('0xa'));var _=require(_0xf4c1('0xb'));var squel=require(_0xf4c1('0xc'));var crypto=require(_0xf4c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4c1('0x8'));var querystring=require(_0xf4c1('0xe'));var Papa=require('papaparse');var Redis=require(_0xf4c1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4c1('0x10'));var as=require(_0xf4c1('0x11'));var hardwareService=require(_0xf4c1('0x12'));var logger=require(_0xf4c1('0x13'))(_0xf4c1('0x14'));var utils=require(_0xf4c1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf4c1('0x16'));var db=require(_0xf4c1('0x17'))['db'];function respondWithStatusCode(_0x2c8f0f,_0x238473){_0x238473=_0x238473||0xcc;return function(_0x580ea3){if(_0x580ea3){return _0x2c8f0f['sendStatus'](_0x238473);}return _0x2c8f0f['status'](_0x238473)[_0xf4c1('0x18')]();};}function respondWithResult(_0x5a4510,_0xfd5076){_0xfd5076=_0xfd5076||0xc8;return function(_0x5527da){if(_0x5527da){return _0x5a4510['status'](_0xfd5076)[_0xf4c1('0x19')](_0x5527da);}};}function respondWithFilteredResult(_0x39b13b,_0x490da5){return function(_0x51086d){if(_0x51086d){var _0x43b74d=typeof _0x490da5['offset']===_0xf4c1('0x1a')&&typeof _0x490da5[_0xf4c1('0x1b')]==='undefined';var _0x5db159=_0x51086d[_0xf4c1('0x1c')];var _0x123514=_0x43b74d?0x0:_0x490da5[_0xf4c1('0x1d')];var _0x4ce0d0=_0x43b74d?_0x51086d[_0xf4c1('0x1c')]:_0x490da5[_0xf4c1('0x1d')]+_0x490da5['limit'];var _0x43937f;if(_0x4ce0d0>=_0x5db159){_0x4ce0d0=_0x5db159;_0x43937f=0xc8;}else{_0x43937f=0xce;}_0x39b13b['status'](_0x43937f);return _0x39b13b[_0xf4c1('0x1e')](_0xf4c1('0x1f'),_0x123514+'-'+_0x4ce0d0+'/'+_0x5db159)[_0xf4c1('0x19')](_0x51086d);}return null;};}function patchUpdates(_0x4bc072){return function(_0x562ae5){try{jsonpatch['apply'](_0x562ae5,_0x4bc072,!![]);}catch(_0x52a428){return BPromise[_0xf4c1('0x20')](_0x52a428);}return _0x562ae5[_0xf4c1('0x21')]();};}function saveUpdates(_0x506166,_0x28603e){return function(_0x5c76d8){if(_0x5c76d8){return _0x5c76d8[_0xf4c1('0x22')](_0x506166)[_0xf4c1('0x23')](function(_0x1898e2){return _0x1898e2;});}return null;};}function removeEntity(_0x112667,_0x4cbde7){return function(_0x841b1c){if(_0x841b1c){return _0x841b1c[_0xf4c1('0x24')]()['then'](function(){_0x112667[_0xf4c1('0x25')](0xcc)[_0xf4c1('0x18')]();});}};}function handleEntityNotFound(_0x2bfd36,_0x169874){return function(_0x1e8696){if(!_0x1e8696){_0x2bfd36[_0xf4c1('0x26')](0x194);}return _0x1e8696;};}function handleError(_0xbdbb3c,_0x18ea34){_0x18ea34=_0x18ea34||0x1f4;return function(_0x4131e3){logger['error'](_0x4131e3[_0xf4c1('0x27')]);if(_0x4131e3[_0xf4c1('0x28')]){delete _0x4131e3[_0xf4c1('0x28')];}_0xbdbb3c[_0xf4c1('0x25')](_0x18ea34)[_0xf4c1('0x29')](_0x4131e3);};}exports['index']=function(_0x24d9d8,_0x408e94){var _0x364132={},_0x29c95e={},_0x2f2ce3={'count':0x0,'rows':[]};var _0x5f392e=_[_0xf4c1('0x2a')](db['VoiceTransferReport'][_0xf4c1('0x2b')],function(_0x44ae1b){return{'name':_0x44ae1b[_0xf4c1('0x2c')],'type':_0x44ae1b[_0xf4c1('0x2d')]['key']};});_0x29c95e[_0xf4c1('0x2e')]=_[_0xf4c1('0x2a')](_0x5f392e,_0xf4c1('0x28'));_0x29c95e[_0xf4c1('0x2f')]=_['keys'](_0x24d9d8[_0xf4c1('0x2f')]);_0x29c95e['filters']=_['intersection'](_0x29c95e['model'],_0x29c95e['query']);_0x364132[_0xf4c1('0x30')]=_[_0xf4c1('0x31')](_0x29c95e['model'],qs[_0xf4c1('0x32')](_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x32')]));_0x364132[_0xf4c1('0x30')]=_0x364132[_0xf4c1('0x30')][_0xf4c1('0x33')]?_0x364132['attributes']:_0x29c95e[_0xf4c1('0x2e')];if(!_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x34')](_0xf4c1('0x35'))){_0x364132[_0xf4c1('0x1b')]=qs[_0xf4c1('0x1b')](_0x24d9d8['query'][_0xf4c1('0x1b')]);_0x364132['offset']=qs[_0xf4c1('0x1d')](_0x24d9d8['query']['offset']);}_0x364132[_0xf4c1('0x36')]=qs[_0xf4c1('0x37')](_0x24d9d8[_0xf4c1('0x2f')]['sort']);_0x364132[_0xf4c1('0x38')]=qs[_0xf4c1('0x39')](_['pick'](_0x24d9d8[_0xf4c1('0x2f')],_0x29c95e[_0xf4c1('0x39')]),_0x5f392e);if(_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x3a')]){_0x364132[_0xf4c1('0x38')]=_['merge'](_0x364132[_0xf4c1('0x38')],{'$or':_['map'](_0x5f392e,function(_0x479325){if(_0x479325[_0xf4c1('0x2d')]!==_0xf4c1('0x3b')){var _0xe672fa={};_0xe672fa[_0x479325[_0xf4c1('0x28')]]={'$like':'%'+_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x3a')]+'%'};return _0xe672fa;}})});}_0x364132=_[_0xf4c1('0x3c')]({},_0x364132,_0x24d9d8['options']);var _0x150af0={'where':_0x364132[_0xf4c1('0x38')]};return db[_0xf4c1('0x3d')][_0xf4c1('0x1c')](_0x150af0)['then'](function(_0x4155f3){_0x2f2ce3[_0xf4c1('0x1c')]=_0x4155f3;if(_0x24d9d8[_0xf4c1('0x2f')]['includeAll']){_0x364132[_0xf4c1('0x3e')]=[{'all':!![]}];}return db[_0xf4c1('0x3d')][_0xf4c1('0x3f')](_0x364132);})[_0xf4c1('0x23')](function(_0x525665){_0x2f2ce3[_0xf4c1('0x40')]=_0x525665;return _0x2f2ce3;})[_0xf4c1('0x23')](respondWithFilteredResult(_0x408e94,_0x364132))[_0xf4c1('0x41')](handleError(_0x408e94,null));};exports[_0xf4c1('0x42')]=function(_0x3ba1a0,_0x3680fe){var _0x5cd4c3={'raw':!![],'where':{'id':_0x3ba1a0[_0xf4c1('0x43')]['id']}},_0x5b6395={};_0x5b6395[_0xf4c1('0x2e')]=_[_0xf4c1('0x44')](db['VoiceTransferReport'][_0xf4c1('0x2b')]);_0x5b6395[_0xf4c1('0x2f')]=_['keys'](_0x3ba1a0[_0xf4c1('0x2f')]);_0x5b6395[_0xf4c1('0x39')]=_[_0xf4c1('0x31')](_0x5b6395[_0xf4c1('0x2e')],_0x5b6395[_0xf4c1('0x2f')]);_0x5cd4c3['attributes']=_[_0xf4c1('0x31')](_0x5b6395[_0xf4c1('0x2e')],qs['fields'](_0x3ba1a0[_0xf4c1('0x2f')][_0xf4c1('0x32')]));_0x5cd4c3[_0xf4c1('0x30')]=_0x5cd4c3[_0xf4c1('0x30')][_0xf4c1('0x33')]?_0x5cd4c3['attributes']:_0x5b6395['model'];if(_0x3ba1a0[_0xf4c1('0x2f')]['includeAll']){_0x5cd4c3[_0xf4c1('0x3e')]=[{'all':!![]}];}_0x5cd4c3=_['merge']({},_0x5cd4c3,_0x3ba1a0[_0xf4c1('0x45')]);return db[_0xf4c1('0x3d')]['find'](_0x5cd4c3)['then'](handleEntityNotFound(_0x3680fe,null))[_0xf4c1('0x23')](respondWithResult(_0x3680fe,null))['catch'](handleError(_0x3680fe,null));};exports['create']=function(_0x2c0674,_0x3ad1a5){return db[_0xf4c1('0x3d')][_0xf4c1('0x46')](_0x2c0674[_0xf4c1('0x47')],{})[_0xf4c1('0x23')](respondWithResult(_0x3ad1a5,0xc9))[_0xf4c1('0x41')](handleError(_0x3ad1a5,null));};exports[_0xf4c1('0x22')]=function(_0x77daae,_0x4e1366){if(_0x77daae[_0xf4c1('0x47')]['id']){delete _0x77daae[_0xf4c1('0x47')]['id'];}return db[_0xf4c1('0x3d')][_0xf4c1('0x48')]({'where':{'id':_0x77daae[_0xf4c1('0x43')]['id']}})[_0xf4c1('0x23')](handleEntityNotFound(_0x4e1366,null))[_0xf4c1('0x23')](saveUpdates(_0x77daae[_0xf4c1('0x47')],null))[_0xf4c1('0x23')](respondWithResult(_0x4e1366,null))[_0xf4c1('0x41')](handleError(_0x4e1366,null));};exports[_0xf4c1('0x24')]=function(_0x5b9c5c,_0x4ff6c2){return db[_0xf4c1('0x3d')][_0xf4c1('0x48')]({'where':{'id':_0x5b9c5c['params']['id']}})[_0xf4c1('0x23')](handleEntityNotFound(_0x4ff6c2,null))[_0xf4c1('0x23')](removeEntity(_0x4ff6c2,null))[_0xf4c1('0x41')](handleError(_0x4ff6c2,null));};exports[_0xf4c1('0x49')]=function(_0x1a37a5,_0x4870bd){return db[_0xf4c1('0x3d')][_0xf4c1('0x49')]()[_0xf4c1('0x23')](respondWithResult(_0x4870bd,null))['catch'](handleError(_0x4870bd,null));}; \ No newline at end of file +var _0x178c=['keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model'];(function(_0x2e7397,_0x3739cd){var _0x3f4996=function(_0x47543c){while(--_0x47543c){_0x2e7397['push'](_0x2e7397['shift']());}};_0x3f4996(++_0x3739cd);}(_0x178c,0xf9));var _0xc178=function(_0x5a3881,_0x79294){_0x5a3881=_0x5a3881-0x0;var _0x3633f1=_0x178c[_0x5a3881];return _0x3633f1;};'use strict';var emlformat=require(_0xc178('0x0'));var rimraf=require(_0xc178('0x1'));var zipdir=require(_0xc178('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc178('0x3'));var moment=require(_0xc178('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc178('0x5'));var util=require(_0xc178('0x6'));var path=require(_0xc178('0x7'));var sox=require(_0xc178('0x8'));var csv=require(_0xc178('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc178('0xa'));var _=require('lodash');var squel=require(_0xc178('0xb'));var crypto=require(_0xc178('0xc'));var jsforce=require(_0xc178('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc178('0x9'));var querystring=require(_0xc178('0xe'));var Papa=require(_0xc178('0xf'));var Redis=require(_0xc178('0x10'));var authService=require(_0xc178('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc178('0x12'));var hardwareService=require(_0xc178('0x13'));var logger=require(_0xc178('0x14'))(_0xc178('0x15'));var utils=require(_0xc178('0x16'));var config=require(_0xc178('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc178('0x18'))['db'];function respondWithStatusCode(_0x4fa79f,_0x7ff38c){_0x7ff38c=_0x7ff38c||0xcc;return function(_0x49fcdc){if(_0x49fcdc){return _0x4fa79f[_0xc178('0x19')](_0x7ff38c);}return _0x4fa79f[_0xc178('0x1a')](_0x7ff38c)[_0xc178('0x1b')]();};}function respondWithResult(_0x41b898,_0x38320b){_0x38320b=_0x38320b||0xc8;return function(_0x42c826){if(_0x42c826){return _0x41b898[_0xc178('0x1a')](_0x38320b)[_0xc178('0x1c')](_0x42c826);}};}function respondWithFilteredResult(_0x5b905a,_0x169c69){return function(_0x73715a){if(_0x73715a){var _0x1329e6=typeof _0x169c69[_0xc178('0x1d')]===_0xc178('0x1e')&&typeof _0x169c69[_0xc178('0x1f')]==='undefined';var _0x70cf60=_0x73715a[_0xc178('0x20')];var _0x4503de=_0x1329e6?0x0:_0x169c69[_0xc178('0x1d')];var _0x4ac50e=_0x1329e6?_0x73715a['count']:_0x169c69['offset']+_0x169c69['limit'];var _0x59b2aa;if(_0x4ac50e>=_0x70cf60){_0x4ac50e=_0x70cf60;_0x59b2aa=0xc8;}else{_0x59b2aa=0xce;}_0x5b905a['status'](_0x59b2aa);return _0x5b905a[_0xc178('0x21')](_0xc178('0x22'),_0x4503de+'-'+_0x4ac50e+'/'+_0x70cf60)['json'](_0x73715a);}return null;};}function patchUpdates(_0x518fd9){return function(_0x301be5){try{jsonpatch[_0xc178('0x23')](_0x301be5,_0x518fd9,!![]);}catch(_0x205b4b){return BPromise['reject'](_0x205b4b);}return _0x301be5[_0xc178('0x24')]();};}function saveUpdates(_0x28c296,_0x476ab5){return function(_0x4fe097){if(_0x4fe097){return _0x4fe097[_0xc178('0x25')](_0x28c296)[_0xc178('0x26')](function(_0x37d25c){return _0x37d25c;});}return null;};}function removeEntity(_0x5d2c58,_0x4dad2d){return function(_0x4c17d9){if(_0x4c17d9){return _0x4c17d9[_0xc178('0x27')]()[_0xc178('0x26')](function(){_0x5d2c58['status'](0xcc)[_0xc178('0x1b')]();});}};}function handleEntityNotFound(_0x569c4f,_0x23c21d){return function(_0x3e1828){if(!_0x3e1828){_0x569c4f[_0xc178('0x19')](0x194);}return _0x3e1828;};}function handleError(_0x3faf9d,_0x3e4949){_0x3e4949=_0x3e4949||0x1f4;return function(_0x2b65d4){logger[_0xc178('0x28')](_0x2b65d4[_0xc178('0x29')]);if(_0x2b65d4[_0xc178('0x2a')]){delete _0x2b65d4['name'];}_0x3faf9d[_0xc178('0x1a')](_0x3e4949)[_0xc178('0x2b')](_0x2b65d4);};}exports[_0xc178('0x2c')]=function(_0x4b28e1,_0x43b0de){var _0xc73523={},_0x45b1c0={},_0x51fc23={'count':0x0,'rows':[]};var _0x556342=_[_0xc178('0x2d')](db[_0xc178('0x2e')][_0xc178('0x2f')],function(_0x35a9d4){return{'name':_0x35a9d4['fieldName'],'type':_0x35a9d4[_0xc178('0x30')][_0xc178('0x31')]};});_0x45b1c0[_0xc178('0x32')]=_[_0xc178('0x2d')](_0x556342,_0xc178('0x2a'));_0x45b1c0['query']=_[_0xc178('0x33')](_0x4b28e1[_0xc178('0x34')]);_0x45b1c0[_0xc178('0x35')]=_[_0xc178('0x36')](_0x45b1c0[_0xc178('0x32')],_0x45b1c0[_0xc178('0x34')]);_0xc73523['attributes']=_[_0xc178('0x36')](_0x45b1c0[_0xc178('0x32')],qs[_0xc178('0x37')](_0x4b28e1[_0xc178('0x34')][_0xc178('0x37')]));_0xc73523[_0xc178('0x38')]=_0xc73523['attributes']['length']?_0xc73523[_0xc178('0x38')]:_0x45b1c0[_0xc178('0x32')];if(!_0x4b28e1[_0xc178('0x34')]['hasOwnProperty'](_0xc178('0x39'))){_0xc73523[_0xc178('0x1f')]=qs['limit'](_0x4b28e1[_0xc178('0x34')][_0xc178('0x1f')]);_0xc73523[_0xc178('0x1d')]=qs[_0xc178('0x1d')](_0x4b28e1[_0xc178('0x34')][_0xc178('0x1d')]);}_0xc73523['order']=qs[_0xc178('0x3a')](_0x4b28e1[_0xc178('0x34')][_0xc178('0x3a')]);_0xc73523[_0xc178('0x3b')]=qs[_0xc178('0x35')](_[_0xc178('0x3c')](_0x4b28e1[_0xc178('0x34')],_0x45b1c0[_0xc178('0x35')]),_0x556342);if(_0x4b28e1[_0xc178('0x34')][_0xc178('0x3d')]){_0xc73523[_0xc178('0x3b')]=_[_0xc178('0x3e')](_0xc73523['where'],{'$or':_['map'](_0x556342,function(_0x55c02e){if(_0x55c02e[_0xc178('0x30')]!==_0xc178('0x3f')){var _0x2eca1d={};_0x2eca1d[_0x55c02e[_0xc178('0x2a')]]={'$like':'%'+_0x4b28e1['query'][_0xc178('0x3d')]+'%'};return _0x2eca1d;}})});}_0xc73523=_[_0xc178('0x3e')]({},_0xc73523,_0x4b28e1['options']);var _0x20a567={'where':_0xc73523[_0xc178('0x3b')]};return db[_0xc178('0x2e')][_0xc178('0x20')](_0x20a567)[_0xc178('0x26')](function(_0x1976ba){_0x51fc23[_0xc178('0x20')]=_0x1976ba;if(_0x4b28e1['query']['includeAll']){_0xc73523[_0xc178('0x40')]=[{'all':!![]}];}return db[_0xc178('0x2e')][_0xc178('0x41')](_0xc73523);})[_0xc178('0x26')](function(_0x5095f2){_0x51fc23[_0xc178('0x42')]=_0x5095f2;return _0x51fc23;})[_0xc178('0x26')](respondWithFilteredResult(_0x43b0de,_0xc73523))[_0xc178('0x43')](handleError(_0x43b0de,null));};exports[_0xc178('0x44')]=function(_0x4192fe,_0x1433c4){var _0x38446b={'raw':!![],'where':{'id':_0x4192fe[_0xc178('0x45')]['id']}},_0x1d45d5={};_0x1d45d5[_0xc178('0x32')]=_['keys'](db[_0xc178('0x2e')][_0xc178('0x2f')]);_0x1d45d5[_0xc178('0x34')]=_[_0xc178('0x33')](_0x4192fe[_0xc178('0x34')]);_0x1d45d5[_0xc178('0x35')]=_[_0xc178('0x36')](_0x1d45d5[_0xc178('0x32')],_0x1d45d5[_0xc178('0x34')]);_0x38446b[_0xc178('0x38')]=_[_0xc178('0x36')](_0x1d45d5[_0xc178('0x32')],qs['fields'](_0x4192fe['query'][_0xc178('0x37')]));_0x38446b[_0xc178('0x38')]=_0x38446b[_0xc178('0x38')]['length']?_0x38446b[_0xc178('0x38')]:_0x1d45d5['model'];if(_0x4192fe['query'][_0xc178('0x46')]){_0x38446b[_0xc178('0x40')]=[{'all':!![]}];}_0x38446b=_['merge']({},_0x38446b,_0x4192fe[_0xc178('0x47')]);return db[_0xc178('0x2e')][_0xc178('0x48')](_0x38446b)[_0xc178('0x26')](handleEntityNotFound(_0x1433c4,null))[_0xc178('0x26')](respondWithResult(_0x1433c4,null))[_0xc178('0x43')](handleError(_0x1433c4,null));};exports['create']=function(_0x387b43,_0x260f5c){return db[_0xc178('0x2e')][_0xc178('0x49')](_0x387b43[_0xc178('0x4a')],{})[_0xc178('0x26')](respondWithResult(_0x260f5c,0xc9))[_0xc178('0x43')](handleError(_0x260f5c,null));};exports[_0xc178('0x25')]=function(_0x4ce436,_0x1885fa){if(_0x4ce436[_0xc178('0x4a')]['id']){delete _0x4ce436[_0xc178('0x4a')]['id'];}return db[_0xc178('0x2e')][_0xc178('0x48')]({'where':{'id':_0x4ce436['params']['id']}})['then'](handleEntityNotFound(_0x1885fa,null))[_0xc178('0x26')](saveUpdates(_0x4ce436[_0xc178('0x4a')],null))['then'](respondWithResult(_0x1885fa,null))['catch'](handleError(_0x1885fa,null));};exports[_0xc178('0x27')]=function(_0x5f1108,_0x5a9c49){return db['VoiceTransferReport']['find']({'where':{'id':_0x5f1108[_0xc178('0x45')]['id']}})[_0xc178('0x26')](handleEntityNotFound(_0x5a9c49,null))[_0xc178('0x26')](removeEntity(_0x5a9c49,null))[_0xc178('0x43')](handleError(_0x5a9c49,null));};exports['describe']=function(_0x18b454,_0x4bc3b8){return db['VoiceTransferReport']['describe']()[_0xc178('0x26')](respondWithResult(_0x4bc3b8,null))[_0xc178('0x43')](handleError(_0x4bc3b8,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7087662..1d38a39 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 _0x7729=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x479bd7,_0x2c44aa){var _0x4e8635=function(_0x512093){while(--_0x512093){_0x479bd7['push'](_0x479bd7['shift']());}};_0x4e8635(++_0x2c44aa);}(_0x7729,0x18b));var _0x9772=function(_0x3b6a5d,_0x2676cf){_0x3b6a5d=_0x3b6a5d-0x0;var _0x4126a9=_0x7729[_0x3b6a5d];return _0x4126a9;};'use strict';var _=require('lodash');var util=require(_0x9772('0x0'));var logger=require(_0x9772('0x1'))(_0x9772('0x2'));var moment=require(_0x9772('0x3'));var BPromise=require('bluebird');var rp=require(_0x9772('0x4'));var fs=require('fs');var path=require(_0x9772('0x5'));var rimraf=require(_0x9772('0x6'));var config=require(_0x9772('0x7'));var attributes=require(_0x9772('0x8'));module[_0x9772('0x9')]=function(_0x5172e1,_0x305db8){return _0x5172e1[_0x9772('0xa')](_0x9772('0xb'),attributes,{'tableName':_0x9772('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb9e=['define','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x978fac,_0x34a4a3){var _0x1c2515=function(_0x4a48ca){while(--_0x4a48ca){_0x978fac['push'](_0x978fac['shift']());}};_0x1c2515(++_0x34a4a3);}(_0xbb9e,0xc7));var _0xebb9=function(_0x48868e,_0x26e3d1){_0x48868e=_0x48868e-0x0;var _0x2d925f=_0xbb9e[_0x48868e];return _0x2d925f;};'use strict';var _=require(_0xebb9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xebb9('0x1'));var moment=require(_0xebb9('0x2'));var BPromise=require('bluebird');var rp=require(_0xebb9('0x3'));var fs=require('fs');var path=require(_0xebb9('0x4'));var rimraf=require(_0xebb9('0x5'));var config=require(_0xebb9('0x6'));var attributes=require(_0xebb9('0x7'));module['exports']=function(_0x3786bd,_0x5e29e7){return _0x3786bd[_0xebb9('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 5aea89d..a00a63d 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 _0xabf6=['request\x20sent','debug','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xabf6,0x13f));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var moment=require(_0x6abf('0x2'));var BPromise=require(_0x6abf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6abf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6abf('0x5'))(_0x6abf('0x6'));var config=require('../../config/environment');var jayson=require(_0x6abf('0x7'));var client=jayson['client'][_0x6abf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58de84,_0x2d7abc,_0xb60e6){return new BPromise(function(_0x274a8d,_0x19d321){return client[_0x6abf('0x9')](_0x58de84,_0xb60e6)['then'](function(_0x198ae8){logger[_0x6abf('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x2d7abc,_0x6abf('0xb'));logger[_0x6abf('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2d7abc,_0x6abf('0xb'),JSON[_0x6abf('0xd')](_0x198ae8));if(_0x198ae8['error']){if(_0x198ae8[_0x6abf('0xe')]['code']===0x1f4){logger[_0x6abf('0xe')](_0x6abf('0xf'),_0x2d7abc,_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);return _0x19d321(_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);}logger[_0x6abf('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x2d7abc,_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);return _0x274a8d(_0x198ae8['error'][_0x6abf('0x10')]);}else{logger[_0x6abf('0xa')](_0x6abf('0xf'),_0x2d7abc,_0x6abf('0xb'));_0x274a8d(_0x198ae8['result']['message']);}})[_0x6abf('0x11')](function(_0x290f53){logger[_0x6abf('0xe')](_0x6abf('0xf'),_0x2d7abc,_0x290f53);_0x19d321(_0x290f53);});});}exports[_0x6abf('0x12')]=function(_0x195f0){var _0x35ce55=this;return new Promise(function(_0x16e326,_0x13f23f){return db[_0x6abf('0x13')][_0x6abf('0x14')](_0x195f0['body'],{'raw':_0x195f0['options']?_0x195f0[_0x6abf('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24fc2a){logger[_0x6abf('0xa')](_0x6abf('0x12'),_0x195f0);logger[_0x6abf('0xc')]('CreateVoiceTransferReport',_0x195f0,JSON[_0x6abf('0xd')](_0x24fc2a));_0x16e326(_0x24fc2a);})[_0x6abf('0x11')](function(_0x5e9911){logger[_0x6abf('0xe')]('CreateVoiceTransferReport',_0x5e9911['message'],_0x195f0);_0x13f23f(_0x35ce55[_0x6abf('0xe')](0x1f4,_0x5e9911[_0x6abf('0x10')]));});});}; \ No newline at end of file +var _0x9fcb=['request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x320839,_0x3a18a5){var _0x29387e=function(_0x4f52ad){while(--_0x4f52ad){_0x320839['push'](_0x320839['shift']());}};_0x29387e(++_0x3a18a5);}(_0x9fcb,0x1d7));var _0xb9fc=function(_0x6869f8,_0x2dc867){_0x6869f8=_0x6869f8-0x0;var _0x45f616=_0x9fcb[_0x6869f8];return _0x45f616;};'use strict';var _=require(_0xb9fc('0x0'));var util=require(_0xb9fc('0x1'));var moment=require(_0xb9fc('0x2'));var BPromise=require(_0xb9fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9fc('0x4'));var db=require(_0xb9fc('0x5'))['db'];var utils=require(_0xb9fc('0x6'));var logger=require(_0xb9fc('0x7'))(_0xb9fc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d05dd,_0x18abd4,_0x4011d4){return new BPromise(function(_0x40cafd,_0x1b2b86){return client[_0xb9fc('0x9')](_0x3d05dd,_0x4011d4)['then'](function(_0x31c272){logger[_0xb9fc('0xa')](_0xb9fc('0xb'),_0x18abd4,_0xb9fc('0xc'));logger[_0xb9fc('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x18abd4,_0xb9fc('0xc'),JSON[_0xb9fc('0xe')](_0x31c272));if(_0x31c272[_0xb9fc('0xf')]){if(_0x31c272[_0xb9fc('0xf')][_0xb9fc('0x10')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x18abd4,_0x31c272[_0xb9fc('0xf')][_0xb9fc('0x11')]);return _0x1b2b86(_0x31c272[_0xb9fc('0xf')]['message']);}logger[_0xb9fc('0xf')](_0xb9fc('0xb'),_0x18abd4,_0x31c272[_0xb9fc('0xf')][_0xb9fc('0x11')]);return _0x40cafd(_0x31c272[_0xb9fc('0xf')][_0xb9fc('0x11')]);}else{logger[_0xb9fc('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x18abd4,_0xb9fc('0xc'));_0x40cafd(_0x31c272['result'][_0xb9fc('0x11')]);}})[_0xb9fc('0x12')](function(_0x3d8ebc){logger[_0xb9fc('0xf')](_0xb9fc('0xb'),_0x18abd4,_0x3d8ebc);_0x1b2b86(_0x3d8ebc);});});}exports[_0xb9fc('0x13')]=function(_0x5eaccb){var _0x409827=this;return new Promise(function(_0xa0b0c,_0x114d7c){return db[_0xb9fc('0x14')]['create'](_0x5eaccb[_0xb9fc('0x15')],{'raw':_0x5eaccb[_0xb9fc('0x16')]?_0x5eaccb[_0xb9fc('0x16')][_0xb9fc('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x42d9d2){logger[_0xb9fc('0xa')]('CreateVoiceTransferReport',_0x5eaccb);logger[_0xb9fc('0xd')](_0xb9fc('0x13'),_0x5eaccb,JSON[_0xb9fc('0xe')](_0x42d9d2));_0xa0b0c(_0x42d9d2);})[_0xb9fc('0x12')](function(_0x38fa00){logger[_0xb9fc('0xf')]('CreateVoiceTransferReport',_0x38fa00[_0xb9fc('0x11')],_0x5eaccb);_0x114d7c(_0x409827['error'](0x1f4,_0x38fa00[_0xb9fc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index cd11efa..57d29c1 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x341ee8,_0x1f054b){_0x341ee8=_0x341ee8-0x0;var _0x51085a=_0xb43b[_0x341ee8];return _0x51085a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x3f1b62,_0x385ee8){var _0x34fc3a=function(_0x302242){while(--_0x302242){_0x3f1b62['push'](_0x3f1b62['shift']());}};_0x34fc3a(++_0x385ee8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1dad4e,_0x3ab382){_0x1dad4e=_0x1dad4e-0x0;var _0x3bf9cd=_0x6f0d[_0x1dad4e];return _0x3bf9cd;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('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 f57dc08..cac0e55 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 _0x9234=['client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','stringify','emit','error','name','send','status','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','json','length','hangup\x20executed!','answer','answer\x20fired:','entityFound:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x9234,0x1bd));var _0x4923=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x9234[_0x55c485];return _0x6bb521;};'use strict';var path=require(_0x4923('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4923('0x1'))['db'];var config=require(_0x4923('0x2'));var util=require(_0x4923('0x3'));var BPromise=require(_0x4923('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x4923('0x5')][_0x4923('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x4923('0x7'));var Redis=require(_0x4923('0x8'));config[_0x4923('0x9')]=_[_0x4923('0xa')](config[_0x4923('0x9')],{'host':_0x4923('0xb'),'port':0x18eb});var io=require(_0x4923('0xc'))(new Redis(config['redis']));var Schema=require(_0x4923('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4923('0xe')]},'callNumber':{'type':_0x4923('0xf'),'required':[!![],_0x4923('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4923('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x4923('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]}});function emit(_0x2897da,_0x2e9944,_0x3fedc7){logger['info'](_0x2897da,_0x2e9944,JSON[_0x4923('0x13')](_0x3fedc7));io['to'](_0x2897da)[_0x4923('0x14')](_0x2e9944,_0x3fedc7);}function handleError(_0x5dbb86){return function(_0x1be04d){console['log']('handleError:',_0x1be04d,_0x1be04d instanceof RangeError);logger[_0x4923('0x15')](_0x1be04d['stack']);if(_0x1be04d instanceof RangeError){if(_0x1be04d[_0x4923('0x16')]){delete _0x1be04d[_0x4923('0x16')];}_0x5dbb86['status'](0x194)[_0x4923('0x17')](_0x1be04d);}else{if(_0x1be04d[_0x4923('0x16')]){delete _0x1be04d[_0x4923('0x16')];}_0x5dbb86[_0x4923('0x18')](0x1f4)['send'](_0x1be04d);}};}function checkError(){return function(_0x3742d0){if(!_0x3742d0){throw new RangeError(_0x4923('0x19'));}return _0x3742d0;};}function respondWithRpcPromise(_0x5f4d43,_0x43326e){return new BPromise(function(_0x522753,_0x3de8f5){var _0x168bb4=amiClient;return _0x168bb4['request'](_0x5f4d43,_0x43326e)[_0x4923('0x1a')](function(_0xb1b3d3){if(_0xb1b3d3[_0x4923('0x15')]){if(_0xb1b3d3[_0x4923('0x15')][_0x4923('0x1b')]===0x1f4){return _0x3de8f5(_0xb1b3d3[_0x4923('0x15')][_0x4923('0x1c')]);}return _0x522753(_0xb1b3d3['error']['message']);}else{_0x522753(_0xb1b3d3[_0x4923('0x1d')]);}})[_0x4923('0x1e')](function(_0xdb893b){_0x3de8f5(_0xdb893b);});});}function getAgent(_0x32d508){return db[_0x4923('0x1f')][_0x4923('0x20')]({'where':{'id':_0x32d508,'role':_0x4923('0x21')}})[_0x4923('0x1a')](checkError());}function getAgentCheckSession(_0x9982e8,_0x18fc90){return new BPromise(function(_0x3a7852,_0x52b433){var _0x1cc7c4=respondWithRpcPromise(_0x4923('0x22'));var _0x7944b2=getAgent(_0x9982e8);Promise[_0x4923('0x23')]([_0x1cc7c4,_0x7944b2])[_0x4923('0x1a')](function(_0x47158c){var _0x158a30=_0x47158c[0x0];var _0x7a97f3=_0x47158c[0x1];var _0xb88ca4=_[_0x4923('0x24')](_0x158a30[_0x4923('0x25')],function(_0x425b3c){return _0x425b3c[_0x4923('0x26')]==_0x7a97f3['id']&&_0x425b3c[_0x4923('0x27')]==_0x18fc90;});if(_0xb88ca4['length']==0x1){_0x3a7852(_0x7a97f3);}else{_0x52b433(new RangeError(_0x4923('0x28')+_0x18fc90+_0x4923('0x29')));}});});}exports[_0x4923('0x2a')]=function(_0x3c92bd,_0xf3bc52){logger[_0x4923('0x2b')](_0x4923('0x2c'),_0x3c92bd[_0x4923('0x2d')]);var _0x557756=originateValidation['validate'](_0x3c92bd[_0x4923('0x2d')]);if(_0x557756['length']>0x0){return _0xf3bc52['status'](0x190)['json'](_0x557756);}var _0x207392=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x2e')];var _0x25a9f7=_0x3c92bd['body'][_0x4923('0x2f')];var _0x58b0c1=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x30')];var _0x368d50=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x31')];return getAgent(_0x207392)['then'](function(_0x43ed8e){logger['info']('entityFound:',_0x43ed8e[_0x4923('0x16')]);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0x43ed8e[_0x4923('0x16')]),_0x4923('0x34'),{'callNumber':_0x25a9f7,'callerId':_0x58b0c1,'callbackUrl':_0x368d50});return _0xf3bc52[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':'originate\x20executed!'});})[_0x4923('0x1e')](handleError(_0xf3bc52));};exports['hangup']=function(_0x4b01da,_0x35eaea){logger[_0x4923('0x2b')]('hangup\x20fired:',_0x4b01da[_0x4923('0x2d')]);var _0x306436=hangupValidation['validate'](_0x4b01da['body']);if(_0x306436[_0x4923('0x36')]>0x0){return _0x35eaea[_0x4923('0x18')](0x190)['json'](_0x306436);}var _0x51cb0e=_0x4b01da[_0x4923('0x2d')][_0x4923('0x2e')];var _0x3345e1=_0x4b01da[_0x4923('0x2d')][_0x4923('0x27')];return getAgent(_0x51cb0e)['then'](function(_0x2a02e0){logger[_0x4923('0x2b')]('entityFound:',_0x2a02e0[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x2a02e0[_0x4923('0x16')]),'webbar:hangup',{'sessionId':_0x3345e1});return _0x35eaea[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x37')});})[_0x4923('0x1e')](handleError(_0x35eaea));};exports[_0x4923('0x38')]=function(_0x3ea276,_0x580092){logger[_0x4923('0x2b')](_0x4923('0x39'),_0x3ea276['body']);var _0x2a7355=answerValidation['validate'](_0x3ea276[_0x4923('0x2d')]);if(_0x2a7355[_0x4923('0x36')]>0x0){return _0x580092[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x2a7355);}var _0x120a77=_0x3ea276[_0x4923('0x2d')][_0x4923('0x2e')];var _0x1de781=_0x3ea276['body'][_0x4923('0x27')];return getAgent(_0x120a77)[_0x4923('0x1a')](function(_0xbab297){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0xbab297[_0x4923('0x16')]);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0xbab297[_0x4923('0x16')]),'webbar:answer',{'sessionId':_0x1de781});return _0x580092[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':'answer\x20executed!'});})[_0x4923('0x1e')](handleError(_0x580092));};exports[_0x4923('0x3b')]=function(_0x456fd7,_0xf092a1){logger[_0x4923('0x2b')](_0x4923('0x3c'),_0x456fd7[_0x4923('0x2d')]);var _0x2fb017=holdValidation[_0x4923('0xd')](_0x456fd7['body']);if(_0x2fb017['length']>0x0){return _0xf092a1['status'](0x190)[_0x4923('0x35')](_0x2fb017);}var _0x58c1c7=_0x456fd7[_0x4923('0x2d')]['userId'];var _0x278ccc=_0x456fd7[_0x4923('0x2d')][_0x4923('0x27')];return getAgent(_0x58c1c7)[_0x4923('0x1a')](function(_0x2b89be){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0x2b89be[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x2b89be[_0x4923('0x16')]),_0x4923('0x3d'),{'sessionId':_0x278ccc});return _0xf092a1[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x3e')});})[_0x4923('0x1e')](handleError(_0xf092a1));};exports[_0x4923('0x3f')]=function(_0x4eb38f,_0x218f49){logger[_0x4923('0x2b')](_0x4923('0x40'),_0x4eb38f[_0x4923('0x2d')]);var _0x5a092d=unholdValidation[_0x4923('0xd')](_0x4eb38f[_0x4923('0x2d')]);if(_0x5a092d[_0x4923('0x36')]>0x0){return _0x218f49[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x5a092d);}var _0x2ee03b=_0x4eb38f[_0x4923('0x2d')]['userId'];var _0x4527da=_0x4eb38f['body']['sessionId'];return getAgent(_0x2ee03b)[_0x4923('0x1a')](function(_0x36a27c){logger[_0x4923('0x2b')]('entityFound:',_0x36a27c[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x36a27c['name']),_0x4923('0x41'),{'sessionId':_0x4527da});return _0x218f49[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x42')});})[_0x4923('0x1e')](handleError(_0x218f49));};exports['calls']=function(_0x2d0a14,_0x103a7e){logger[_0x4923('0x2b')](_0x4923('0x43'),_0x103a7e[_0x4923('0x2d')]);var _0xff2e1d=callsValidation['validate'](_0x2d0a14[_0x4923('0x2d')]);if(_0xff2e1d[_0x4923('0x36')]>0x0){return _0x103a7e[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0xff2e1d);}var _0x125421=_0x2d0a14[_0x4923('0x2d')][_0x4923('0x2e')];var _0x4ea676=respondWithRpcPromise(_0x4923('0x22'));var _0xf7fdfe=getAgent(_0x125421);return Promise[_0x4923('0x23')]([_0x4ea676,_0xf7fdfe])[_0x4923('0x1a')](function(_0x3b59e6){var _0x3a75d2=_0x3b59e6[0x0];var _0x338613=_0x3b59e6[0x1];var _0x59ac29=_[_0x4923('0x24')](_0x3a75d2[_0x4923('0x25')],function(_0x618948){return _0x618948['UserId']==_0x338613['id'];});return _0x103a7e[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'count':_0x59ac29['length'],'rows':_0x59ac29});})['catch'](handleError(_0x103a7e));};exports[_0x4923('0x44')]=function(_0x3d9df9,_0x2e60c3){logger[_0x4923('0x2b')](_0x4923('0x45'),_0x3d9df9[_0x4923('0x2d')]);var _0x224e30=conferenceValidation[_0x4923('0xd')](_0x3d9df9['body']);if(_0x224e30[_0x4923('0x36')]>0x0){return _0x2e60c3[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x224e30);}var _0x36ede5=_0x3d9df9[_0x4923('0x2d')]['userId'];return getAgent(_0x36ede5)[_0x4923('0x1a')](function(_0x1d2724){logger[_0x4923('0x2b')]('entityFound:',_0x1d2724['name']);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0x1d2724['name']),'webbar:conference');return _0x2e60c3[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x46')});})['catch'](handleError(_0x2e60c3));};exports[_0x4923('0x47')]=function(_0x2c5f79,_0x52e228){logger['info']('transfer\x20fired:',_0x2c5f79[_0x4923('0x2d')]);var _0x520df2=transferValidation[_0x4923('0xd')](_0x2c5f79[_0x4923('0x2d')]);if(_0x520df2[_0x4923('0x36')]>0x0){return _0x52e228[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x520df2);}var _0x5b54b4=_0x2c5f79[_0x4923('0x2d')]['userId'];var _0x1fc770=_0x2c5f79[_0x4923('0x2d')][_0x4923('0x27')];var _0x497e63=_0x2c5f79[_0x4923('0x2d')][_0x4923('0x48')];return getAgent(_0x5b54b4)['then'](function(_0x1adc05){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0x1adc05[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x1adc05['name']),_0x4923('0x49'),{'sessionId':_0x1fc770,'transferNumber':_0x497e63});return _0x52e228[_0x4923('0x18')](0xc8)['json']({'error':![],'message':_0x4923('0x4a')});})['catch'](handleError(_0x52e228));}; \ No newline at end of file +var _0x26a3=['transferNumber\x20is\x20required','stringify','log','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','length','sessionId\x20','\x20not\x20found!','originate','info','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','user:%s','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x26a3,0x94));var _0x326a=function(_0x3bd422,_0x3297c8){_0x3bd422=_0x3bd422-0x0;var _0x1a402c=_0x26a3[_0x3bd422];return _0x1a402c;};'use strict';var path=require(_0x326a('0x0'));var fs=require('fs');var _=require(_0x326a('0x1'));var db=require(_0x326a('0x2'))['db'];var config=require(_0x326a('0x3'));var util=require(_0x326a('0x4'));var BPromise=require(_0x326a('0x5'));var jayson=require(_0x326a('0x6'));var amiClient=jayson[_0x326a('0x7')][_0x326a('0x8')]({'port':0x232a});var logger=require(_0x326a('0x9'))(_0x326a('0xa'));var Redis=require('ioredis');config[_0x326a('0xb')]=_[_0x326a('0xc')](config[_0x326a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x326a('0xd'))(new Redis(config[_0x326a('0xb')]));var Schema=require(_0x326a('0xe'));var originateValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],_0x326a('0x10')]},'callNumber':{'type':_0x326a('0x11'),'required':[!![],_0x326a('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x326a('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x326a('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x326a('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x326a('0x11'),'required':[!![],_0x326a('0x13')]},'transferNumber':{'type':_0x326a('0x11'),'required':[!![],_0x326a('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],_0x326a('0x10')]},'sessionId':{'type':_0x326a('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],_0x326a('0x10')]},'sessionId':{'type':_0x326a('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],_0x326a('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x326a('0xf'),'required':[!![],_0x326a('0x10')]}});function emit(_0x5b5130,_0x3fb99c,_0x369e8e){logger['info'](_0x5b5130,_0x3fb99c,JSON[_0x326a('0x15')](_0x369e8e));io['to'](_0x5b5130)['emit'](_0x3fb99c,_0x369e8e);}function handleError(_0x439ce2){return function(_0x6166d){console[_0x326a('0x16')]('handleError:',_0x6166d,_0x6166d instanceof RangeError);logger[_0x326a('0x17')](_0x6166d[_0x326a('0x18')]);if(_0x6166d instanceof RangeError){if(_0x6166d[_0x326a('0x19')]){delete _0x6166d[_0x326a('0x19')];}_0x439ce2[_0x326a('0x1a')](0x194)[_0x326a('0x1b')](_0x6166d);}else{if(_0x6166d['name']){delete _0x6166d[_0x326a('0x19')];}_0x439ce2[_0x326a('0x1a')](0x1f4)['send'](_0x6166d);}};}function checkError(){return function(_0x579da5){if(!_0x579da5){throw new RangeError(_0x326a('0x1c'));}return _0x579da5;};}function respondWithRpcPromise(_0x763550,_0x1b0ccb){return new BPromise(function(_0x2001d0,_0x54363d){var _0x253206=amiClient;return _0x253206['request'](_0x763550,_0x1b0ccb)[_0x326a('0x1d')](function(_0x382fad){if(_0x382fad[_0x326a('0x17')]){if(_0x382fad[_0x326a('0x17')][_0x326a('0x1e')]===0x1f4){return _0x54363d(_0x382fad['error'][_0x326a('0x1f')]);}return _0x2001d0(_0x382fad[_0x326a('0x17')][_0x326a('0x1f')]);}else{_0x2001d0(_0x382fad[_0x326a('0x20')]);}})[_0x326a('0x21')](function(_0x3d06c8){_0x54363d(_0x3d06c8);});});}function getAgent(_0x582ae5){return db[_0x326a('0x22')][_0x326a('0x23')]({'where':{'id':_0x582ae5,'role':_0x326a('0x24')}})[_0x326a('0x1d')](checkError());}function getAgentCheckSession(_0x4e701b,_0x58c4d8){return new BPromise(function(_0x1cd0ac,_0x537973){var _0x29ec71=respondWithRpcPromise(_0x326a('0x25'));var _0x7db1b6=getAgent(_0x4e701b);Promise['all']([_0x29ec71,_0x7db1b6])['then'](function(_0x40c5db){var _0x2a3b13=_0x40c5db[0x0];var _0x2f20f7=_0x40c5db[0x1];var _0xb27abb=_[_0x326a('0x26')](_0x2a3b13[_0x326a('0x27')],function(_0x57e225){return _0x57e225['UserId']==_0x2f20f7['id']&&_0x57e225['sessionId']==_0x58c4d8;});if(_0xb27abb[_0x326a('0x28')]==0x1){_0x1cd0ac(_0x2f20f7);}else{_0x537973(new RangeError(_0x326a('0x29')+_0x58c4d8+_0x326a('0x2a')));}});});}exports[_0x326a('0x2b')]=function(_0x3a4f86,_0x5b87f5){logger[_0x326a('0x2c')]('originate\x20fired:',_0x3a4f86['body']);var _0x4bbea1=originateValidation[_0x326a('0xe')](_0x3a4f86[_0x326a('0x2d')]);if(_0x4bbea1['length']>0x0){return _0x5b87f5[_0x326a('0x1a')](0x190)['json'](_0x4bbea1);}var _0x1d75ea=_0x3a4f86[_0x326a('0x2d')][_0x326a('0x2e')];var _0x15c5d4=_0x3a4f86[_0x326a('0x2d')][_0x326a('0x2f')];var _0x472453=_0x3a4f86['body'][_0x326a('0x30')];var _0x234490=_0x3a4f86[_0x326a('0x2d')][_0x326a('0x31')];return getAgent(_0x1d75ea)['then'](function(_0x645f97){logger['info'](_0x326a('0x32'),_0x645f97['name']);emit(util[_0x326a('0x33')]('user:%s',_0x645f97[_0x326a('0x19')]),_0x326a('0x34'),{'callNumber':_0x15c5d4,'callerId':_0x472453,'callbackUrl':_0x234490});return _0x5b87f5['status'](0xc8)[_0x326a('0x35')]({'error':![],'message':_0x326a('0x36')});})[_0x326a('0x21')](handleError(_0x5b87f5));};exports[_0x326a('0x37')]=function(_0x4b79f9,_0x10d412){logger[_0x326a('0x2c')](_0x326a('0x38'),_0x4b79f9[_0x326a('0x2d')]);var _0x3e09d9=hangupValidation[_0x326a('0xe')](_0x4b79f9['body']);if(_0x3e09d9[_0x326a('0x28')]>0x0){return _0x10d412['status'](0x190)[_0x326a('0x35')](_0x3e09d9);}var _0x5d2acc=_0x4b79f9['body']['userId'];var _0x192fd2=_0x4b79f9['body'][_0x326a('0x39')];return getAgent(_0x5d2acc)[_0x326a('0x1d')](function(_0x548980){logger[_0x326a('0x2c')]('entityFound:',_0x548980[_0x326a('0x19')]);emit(util[_0x326a('0x33')]('user:%s',_0x548980['name']),_0x326a('0x3a'),{'sessionId':_0x192fd2});return _0x10d412[_0x326a('0x1a')](0xc8)['json']({'error':![],'message':_0x326a('0x3b')});})['catch'](handleError(_0x10d412));};exports[_0x326a('0x3c')]=function(_0x1a3f87,_0x4643e1){logger[_0x326a('0x2c')](_0x326a('0x3d'),_0x1a3f87[_0x326a('0x2d')]);var _0x47fac0=answerValidation[_0x326a('0xe')](_0x1a3f87[_0x326a('0x2d')]);if(_0x47fac0[_0x326a('0x28')]>0x0){return _0x4643e1['status'](0x190)[_0x326a('0x35')](_0x47fac0);}var _0x35fc05=_0x1a3f87[_0x326a('0x2d')][_0x326a('0x2e')];var _0x72fc5b=_0x1a3f87[_0x326a('0x2d')][_0x326a('0x39')];return getAgent(_0x35fc05)['then'](function(_0x5f361c){logger[_0x326a('0x2c')]('entityFound:',_0x5f361c[_0x326a('0x19')]);emit(util[_0x326a('0x33')](_0x326a('0x3e'),_0x5f361c['name']),_0x326a('0x3f'),{'sessionId':_0x72fc5b});return _0x4643e1[_0x326a('0x1a')](0xc8)[_0x326a('0x35')]({'error':![],'message':'answer\x20executed!'});})[_0x326a('0x21')](handleError(_0x4643e1));};exports[_0x326a('0x40')]=function(_0x4a9dfe,_0x31c316){logger['info'](_0x326a('0x41'),_0x4a9dfe['body']);var _0x23af68=holdValidation['validate'](_0x4a9dfe[_0x326a('0x2d')]);if(_0x23af68['length']>0x0){return _0x31c316[_0x326a('0x1a')](0x190)[_0x326a('0x35')](_0x23af68);}var _0x123337=_0x4a9dfe['body'][_0x326a('0x2e')];var _0x35d3c5=_0x4a9dfe[_0x326a('0x2d')][_0x326a('0x39')];return getAgent(_0x123337)[_0x326a('0x1d')](function(_0x50fe56){logger['info'](_0x326a('0x32'),_0x50fe56[_0x326a('0x19')]);emit(util[_0x326a('0x33')](_0x326a('0x3e'),_0x50fe56[_0x326a('0x19')]),'webbar:hold',{'sessionId':_0x35d3c5});return _0x31c316[_0x326a('0x1a')](0xc8)['json']({'error':![],'message':_0x326a('0x42')});})['catch'](handleError(_0x31c316));};exports[_0x326a('0x43')]=function(_0x47c698,_0x9eb2b7){logger[_0x326a('0x2c')](_0x326a('0x44'),_0x47c698[_0x326a('0x2d')]);var _0x5dac11=unholdValidation[_0x326a('0xe')](_0x47c698['body']);if(_0x5dac11[_0x326a('0x28')]>0x0){return _0x9eb2b7[_0x326a('0x1a')](0x190)['json'](_0x5dac11);}var _0x3ddf57=_0x47c698[_0x326a('0x2d')][_0x326a('0x2e')];var _0x24fdc4=_0x47c698['body'][_0x326a('0x39')];return getAgent(_0x3ddf57)['then'](function(_0x1b8d70){logger['info'](_0x326a('0x32'),_0x1b8d70['name']);emit(util['format'](_0x326a('0x3e'),_0x1b8d70['name']),_0x326a('0x45'),{'sessionId':_0x24fdc4});return _0x9eb2b7[_0x326a('0x1a')](0xc8)['json']({'error':![],'message':_0x326a('0x46')});})[_0x326a('0x21')](handleError(_0x9eb2b7));};exports[_0x326a('0x47')]=function(_0xb191f5,_0x464e20){logger[_0x326a('0x2c')](_0x326a('0x48'),_0x464e20['body']);var _0x3e77a8=callsValidation[_0x326a('0xe')](_0xb191f5[_0x326a('0x2d')]);if(_0x3e77a8['length']>0x0){return _0x464e20['status'](0x190)[_0x326a('0x35')](_0x3e77a8);}var _0x1180c1=_0xb191f5[_0x326a('0x2d')][_0x326a('0x2e')];var _0x1e1e7c=respondWithRpcPromise(_0x326a('0x25'));var _0xd323ae=getAgent(_0x1180c1);return Promise[_0x326a('0x49')]([_0x1e1e7c,_0xd323ae])[_0x326a('0x1d')](function(_0x2c7838){var _0xcd71ea=_0x2c7838[0x0];var _0x3a588a=_0x2c7838[0x1];var _0x4ed8f5=_['filter'](_0xcd71ea[_0x326a('0x27')],function(_0x37dac0){return _0x37dac0[_0x326a('0x4a')]==_0x3a588a['id'];});return _0x464e20[_0x326a('0x1a')](0xc8)[_0x326a('0x35')]({'count':_0x4ed8f5['length'],'rows':_0x4ed8f5});})[_0x326a('0x21')](handleError(_0x464e20));};exports[_0x326a('0x4b')]=function(_0x53b801,_0x164250){logger[_0x326a('0x2c')](_0x326a('0x4c'),_0x53b801[_0x326a('0x2d')]);var _0x3a4323=conferenceValidation['validate'](_0x53b801['body']);if(_0x3a4323['length']>0x0){return _0x164250['status'](0x190)[_0x326a('0x35')](_0x3a4323);}var _0x4bd165=_0x53b801['body'][_0x326a('0x2e')];return getAgent(_0x4bd165)[_0x326a('0x1d')](function(_0x4e254c){logger[_0x326a('0x2c')](_0x326a('0x32'),_0x4e254c[_0x326a('0x19')]);emit(util['format'](_0x326a('0x3e'),_0x4e254c['name']),_0x326a('0x4d'));return _0x164250['status'](0xc8)['json']({'error':![],'message':_0x326a('0x4e')});})[_0x326a('0x21')](handleError(_0x164250));};exports[_0x326a('0x4f')]=function(_0x1753a2,_0x2af30a){logger[_0x326a('0x2c')](_0x326a('0x50'),_0x1753a2[_0x326a('0x2d')]);var _0x594eca=transferValidation[_0x326a('0xe')](_0x1753a2['body']);if(_0x594eca[_0x326a('0x28')]>0x0){return _0x2af30a[_0x326a('0x1a')](0x190)[_0x326a('0x35')](_0x594eca);}var _0x31d72c=_0x1753a2['body'][_0x326a('0x2e')];var _0x25ade0=_0x1753a2[_0x326a('0x2d')][_0x326a('0x39')];var _0x29e352=_0x1753a2['body'][_0x326a('0x51')];return getAgent(_0x31d72c)[_0x326a('0x1d')](function(_0x4502f7){logger[_0x326a('0x2c')]('entityFound:',_0x4502f7[_0x326a('0x19')]);emit(util[_0x326a('0x33')](_0x326a('0x3e'),_0x4502f7[_0x326a('0x19')]),_0x326a('0x52'),{'sessionId':_0x25ade0,'transferNumber':_0x29e352});return _0x2af30a[_0x326a('0x1a')](0xc8)[_0x326a('0x35')]({'error':![],'message':_0x326a('0x53')});})[_0x326a('0x21')](handleError(_0x2af30a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b17361a..1ee03b8 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 _0x23af=['addAgents','addApplications','/:id/notify','send','put','update','delete','destroy','removeAnswers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer'];(function(_0x43d18d,_0x104718){var _0x5026ff=function(_0x178d71){while(--_0x178d71){_0x43d18d['push'](_0x43d18d['shift']());}};_0x5026ff(++_0x104718);}(_0x23af,0x1d1));var _0xf23a=function(_0x4b01ae,_0x4ec3fe){_0x4b01ae=_0x4b01ae-0x0;var _0x32086b=_0x23af[_0x4b01ae];return _0x32086b;};'use strict';var multer=require(_0xf23a('0x0'));var util=require(_0xf23a('0x1'));var path=require(_0xf23a('0x2'));var timeout=require(_0xf23a('0x3'));var express=require(_0xf23a('0x4'));var router=express['Router']();var fs_extra=require(_0xf23a('0x5'));var auth=require(_0xf23a('0x6'));var interaction=require(_0xf23a('0x7'));var config=require(_0xf23a('0x8'));var controller=require(_0xf23a('0x9'));router[_0xf23a('0xa')]('/',auth['isAuthenticated'](),controller[_0xf23a('0xb')]);router['get'](_0xf23a('0xc'),auth['isAuthenticated'](),controller[_0xf23a('0xd')]);router['get'](_0xf23a('0xe'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x10')]);router[_0xf23a('0xa')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x12')]);router[_0xf23a('0xa')](_0xf23a('0x13'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x14')]);router[_0xf23a('0xa')](_0xf23a('0x15'),auth['isAuthenticated'](),controller[_0xf23a('0x16')]);router[_0xf23a('0xa')](_0xf23a('0x17'),auth['isAuthenticated'](),controller[_0xf23a('0x18')]);router[_0xf23a('0x19')]('/',auth[_0xf23a('0xf')](),controller[_0xf23a('0x1a')]);router[_0xf23a('0x19')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1b')]);router[_0xf23a('0x19')](_0xf23a('0x13'),auth['isAuthenticated'](),controller[_0xf23a('0x1c')]);router[_0xf23a('0x19')](_0xf23a('0x15'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1d')]);router[_0xf23a('0x19')](_0xf23a('0x17'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1e')]);router[_0xf23a('0x19')](_0xf23a('0x1f'),controller['notify']);router['post']('/:id/send',auth[_0xf23a('0xf')](),controller[_0xf23a('0x20')]);router[_0xf23a('0x21')](_0xf23a('0xe'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x22')]);router[_0xf23a('0x23')]('/:id',auth[_0xf23a('0xf')](),controller[_0xf23a('0x24')]);router[_0xf23a('0x23')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller['removeDispositions']);router['delete'](_0xf23a('0x13'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x25')]);router['delete'](_0xf23a('0x15'),auth[_0xf23a('0xf')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd39e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','post','create','addAgents','addApplications','/:id/notify','notify','/:id/send','put','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xd39e,0x64));var _0xed39=function(_0x34b71e,_0x58f44d){_0x34b71e=_0x34b71e-0x0;var _0x2cb29b=_0xd39e[_0x34b71e];return _0x2cb29b;};'use strict';var multer=require('multer');var util=require(_0xed39('0x0'));var path=require(_0xed39('0x1'));var timeout=require(_0xed39('0x2'));var express=require(_0xed39('0x3'));var router=express[_0xed39('0x4')]();var fs_extra=require(_0xed39('0x5'));var auth=require(_0xed39('0x6'));var interaction=require(_0xed39('0x7'));var config=require(_0xed39('0x8'));var controller=require(_0xed39('0x9'));router[_0xed39('0xa')]('/',auth[_0xed39('0xb')](),controller[_0xed39('0xc')]);router[_0xed39('0xa')](_0xed39('0xd'),auth['isAuthenticated'](),controller[_0xed39('0xe')]);router['get'](_0xed39('0xf'),auth[_0xed39('0xb')](),controller[_0xed39('0x10')]);router['get'](_0xed39('0x11'),auth['isAuthenticated'](),controller[_0xed39('0x12')]);router['get'](_0xed39('0x13'),auth['isAuthenticated'](),controller[_0xed39('0x14')]);router[_0xed39('0xa')](_0xed39('0x15'),auth[_0xed39('0xb')](),controller['getAgents']);router[_0xed39('0xa')]('/:id/applications',auth[_0xed39('0xb')](),controller['getApplications']);router[_0xed39('0x16')]('/',auth[_0xed39('0xb')](),controller[_0xed39('0x17')]);router[_0xed39('0x16')](_0xed39('0x11'),auth[_0xed39('0xb')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xed39('0xb')](),controller['addAnswer']);router['post'](_0xed39('0x15'),auth['isAuthenticated'](),controller[_0xed39('0x18')]);router[_0xed39('0x16')]('/:id/applications',auth[_0xed39('0xb')](),controller[_0xed39('0x19')]);router[_0xed39('0x16')](_0xed39('0x1a'),controller[_0xed39('0x1b')]);router[_0xed39('0x16')](_0xed39('0x1c'),auth[_0xed39('0xb')](),controller['send']);router[_0xed39('0x1d')](_0xed39('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xed39('0x1e')]('/:id',auth[_0xed39('0xb')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xed39('0xb')](),controller[_0xed39('0x1f')]);router[_0xed39('0x1e')](_0xed39('0x13'),auth[_0xed39('0xb')](),controller[_0xed39('0x20')]);router[_0xed39('0x1e')](_0xed39('0x15'),auth[_0xed39('0xb')](),controller[_0xed39('0x21')]);module[_0xed39('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f08f7ee..4051a2e 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 _0xea4a=['mandatoryDispositionPauseId','setDataValue','sequelize','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea4a,0xf0));var _0xaea4=function(_0x5e71d4,_0x5a3f20){_0x5e71d4=_0x5e71d4-0x0;var _0x38373d=_0xea4a[_0x5e71d4];return _0x38373d;};'use strict';var Sequelize=require(_0xaea4('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xaea4('0x1')],'unique':_0xaea4('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xaea4('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xaea4('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaea4('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xaea4('0x4')](_0xaea4('0x5'),_0xaea4('0x6'))},'accountSid':{'type':Sequelize[_0xaea4('0x1')]},'baseUrl':{'type':Sequelize[_0xaea4('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaea4('0x7')],'defaultValue':function(){return _0xaea4('0x8');}},'notificationSound':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaea4('0xa')],'comment':_0xaea4('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19e400){if(!_0x19e400){this['setDataValue'](_0xaea4('0xc'),null);}this[_0xaea4('0xd')]('mandatoryDisposition',_0x19e400);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1bc0=['exports','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring'];(function(_0x3b6617,_0x479502){var _0x3cdcab=function(_0x14c6df){while(--_0x14c6df){_0x3b6617['push'](_0x3b6617['shift']());}};_0x3cdcab(++_0x479502);}(_0x1bc0,0x12a));var _0x01bc=function(_0x43e42d,_0x4cf705){_0x43e42d=_0x43e42d-0x0;var _0x22e8ed=_0x1bc0[_0x43e42d];return _0x22e8ed;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x01bc('0x0'));module[_0x01bc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x01bc('0x2')],'defaultValue':function(){return rs[_0x01bc('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x01bc('0x4')](_0x01bc('0x5'),_0x01bc('0x6'))},'accountSid':{'type':Sequelize[_0x01bc('0x2')]},'baseUrl':{'type':Sequelize[_0x01bc('0x2')]},'authToken':{'type':Sequelize[_0x01bc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x01bc('0x7')],'defaultValue':function(){return _0x01bc('0x8');}},'notificationSound':{'type':Sequelize[_0x01bc('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x01bc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x01bc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x01bc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x01bc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x01bc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x01bc('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x01bc('0xb'),'set':function(_0x46cc51){if(!_0x46cc51){this[_0x01bc('0xc')]('mandatoryDispositionPauseId',null);}this[_0x01bc('0xc')]('mandatoryDisposition',_0x46cc51);}},'description':{'type':Sequelize[_0x01bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bdaf5a3..c77e0f9 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 _0xa72d=['sinch','from','notifications','messageId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','CmContact','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','get','WhatsappAccounts','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','WhatsappAccount','findAll','params','intersection','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','message_id','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','whatsapp:','MessageSid'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa72d,0x1bf));var _0xda72=function(_0x36a328,_0xb08213){_0x36a328=_0x36a328-0x0;var _0x56442e=_0xa72d[_0x36a328];return _0x56442e;};'use strict';var emlformat=require(_0xda72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda72('0x1'));var rp=require(_0xda72('0x2'));var moment=require(_0xda72('0x3'));var BPromise=require(_0xda72('0x4'));var Mustache=require(_0xda72('0x5'));var util=require(_0xda72('0x6'));var path=require(_0xda72('0x7'));var sox=require(_0xda72('0x8'));var csv=require('to-csv');var ejs=require(_0xda72('0x9'));var fs=require('fs');var fs_extra=require(_0xda72('0xa'));var _=require(_0xda72('0xb'));var squel=require('squel');var crypto=require(_0xda72('0xc'));var jsforce=require(_0xda72('0xd'));var deskjs=require(_0xda72('0xe'));var toCsv=require(_0xda72('0xf'));var querystring=require(_0xda72('0x10'));var Papa=require(_0xda72('0x11'));var Redis=require(_0xda72('0x12'));var authService=require(_0xda72('0x13'));var qs=require(_0xda72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda72('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xda72('0x16'));var licenseUtil=require(_0xda72('0x17'));var db=require('../../mysqldb')['db'];config[_0xda72('0x18')]=_[_0xda72('0x19')](config[_0xda72('0x18')],{'host':_0xda72('0x1a'),'port':0x18eb});var socket=require(_0xda72('0x1b'))(new Redis(config['redis']));require(_0xda72('0x1c'))[_0xda72('0x1d')](socket);var jayson=require(_0xda72('0x1e'));var client=jayson[_0xda72('0x1f')][_0xda72('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x145ff0,_0x12a2ed,_0x251236,_0x4e14d3){return new BPromise(function(_0x4dbe31,_0x461ca7){var _0x1aa4fe=_0x4e14d3||client;return _0x1aa4fe[_0xda72('0x21')](_0x145ff0,_0x251236)[_0xda72('0x22')](function(_0x128e26){logger[_0xda72('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x12a2ed,_0xda72('0x24'));logger[_0xda72('0x25')](_0xda72('0x26'),_0x12a2ed,_0xda72('0x24'),JSON[_0xda72('0x27')](_0x128e26));if(_0x128e26[_0xda72('0x28')]){if(_0x128e26[_0xda72('0x28')]['code']===0x1f4){logger[_0xda72('0x28')](_0xda72('0x29'),_0x12a2ed,_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);return _0x461ca7(_0x128e26['error'][_0xda72('0x2a')]);}logger['error'](_0xda72('0x29'),_0x12a2ed,_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);return _0x4dbe31(_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);}else{logger['info'](_0xda72('0x29'),_0x12a2ed,'request\x20sent');_0x4dbe31(_0x128e26['result']['message']);}})[_0xda72('0x2b')](function(_0xf986f3){logger[_0xda72('0x28')](_0xda72('0x29'),_0x12a2ed,_0xf986f3);_0x461ca7(_0xf986f3);});});}function respondWithStatusCode(_0x2ffa30,_0x1eb770){_0x1eb770=_0x1eb770||0xcc;return function(_0x4abc33){if(_0x4abc33){return _0x2ffa30[_0xda72('0x2c')](_0x1eb770);}return _0x2ffa30[_0xda72('0x2d')](_0x1eb770)['end']();};}function respondWithResult(_0x3a9f1d,_0x257775){_0x257775=_0x257775||0xc8;return function(_0x55071f){if(_0x55071f){return _0x3a9f1d['status'](_0x257775)[_0xda72('0x2e')](_0x55071f);}};}function respondWithFilteredResult(_0x453f9b,_0x5172ba){return function(_0x4c7be5){if(_0x4c7be5){var _0x52ddc1=typeof _0x5172ba['offset']==='undefined'&&typeof _0x5172ba['limit']===_0xda72('0x2f');var _0x3bd907=_0x4c7be5[_0xda72('0x30')];var _0x30b207=_0x52ddc1?0x0:_0x5172ba[_0xda72('0x31')];var _0x5908cf=_0x52ddc1?_0x4c7be5[_0xda72('0x30')]:_0x5172ba[_0xda72('0x31')]+_0x5172ba[_0xda72('0x32')];var _0x2c4b85;if(_0x5908cf>=_0x3bd907){_0x5908cf=_0x3bd907;_0x2c4b85=0xc8;}else{_0x2c4b85=0xce;}_0x453f9b[_0xda72('0x2d')](_0x2c4b85);return _0x453f9b[_0xda72('0x33')](_0xda72('0x34'),_0x30b207+'-'+_0x5908cf+'/'+_0x3bd907)['json'](_0x4c7be5);}return null;};}function patchUpdates(_0x3805d4){return function(_0x59f739){try{jsonpatch['apply'](_0x59f739,_0x3805d4,!![]);}catch(_0x6633d9){return BPromise['reject'](_0x6633d9);}return _0x59f739[_0xda72('0x35')]();};}function saveUpdates(_0x4ba23a,_0x36ea9c){return function(_0x539815){if(_0x539815){return _0x539815[_0xda72('0x36')](_0x4ba23a)[_0xda72('0x22')](function(_0x3b43e7){return _0x3b43e7;});}return null;};}function removeEntity(_0x29838e,_0x2bcb7d){return function(_0x361def){if(_0x361def){return _0x361def['destroy']()[_0xda72('0x22')](function(){var _0x5773e5=_0x361def[_0xda72('0x37')]({'plain':!![]});var _0x473dce=_0xda72('0x38');return db['UserProfileResource'][_0xda72('0x39')]({'where':{'type':_0x473dce,'resourceId':_0x5773e5['id']}})[_0xda72('0x22')](function(){return _0x361def;});})[_0xda72('0x22')](function(){_0x29838e[_0xda72('0x2d')](0xcc)[_0xda72('0x3a')]();});}};}function handleEntityNotFound(_0x38ce39,_0x2b371c){return function(_0x42831d){if(!_0x42831d){_0x38ce39['sendStatus'](0x194);}return _0x42831d;};}function handleError(_0x4d3aee,_0x338188){_0x338188=_0x338188||0x1f4;return function(_0x7f4de0){logger[_0xda72('0x28')](_0x7f4de0[_0xda72('0x3b')]);if(_0x7f4de0[_0xda72('0x3c')]){delete _0x7f4de0['name'];}_0x4d3aee['status'](_0x338188)[_0xda72('0x3d')](_0x7f4de0);};}exports[_0xda72('0x3e')]=function(_0x1d3ea3,_0x12888b){var _0x422b76={'include':[{'model':db[_0xda72('0x3f')],'as':_0xda72('0x40')}]},_0x314f8b={},_0x1b7477={'count':0x0,'rows':[]};var _0x49ab41=_['map'](db['WhatsappAccount'][_0xda72('0x41')],function(_0x2a6e53){return{'name':_0x2a6e53[_0xda72('0x42')],'type':_0x2a6e53[_0xda72('0x43')]['key']};});_0x314f8b['model']=_[_0xda72('0x44')](_0x49ab41,_0xda72('0x3c'));_0x314f8b[_0xda72('0x45')]=_[_0xda72('0x46')](_0x1d3ea3['query']);_0x314f8b[_0xda72('0x47')]=_['intersection'](_0x314f8b[_0xda72('0x48')],_0x314f8b[_0xda72('0x45')]);_0x422b76[_0xda72('0x49')]=_['intersection'](_0x314f8b['model'],qs['fields'](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4a')]));_0x422b76['attributes']=_0x422b76[_0xda72('0x49')][_0xda72('0x4b')]?_0x422b76['attributes']:_0x314f8b[_0xda72('0x48')];if(!_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x422b76[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x32')]);_0x422b76[_0xda72('0x31')]=qs[_0xda72('0x31')](_0x1d3ea3[_0xda72('0x45')]['offset']);}_0x422b76['order']=qs['sort'](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4e')]);_0x422b76[_0xda72('0x4f')]=qs['filters'](_['pick'](_0x1d3ea3[_0xda72('0x45')],_0x314f8b[_0xda72('0x47')]),_0x49ab41);if(_0x1d3ea3[_0xda72('0x45')][_0xda72('0x50')]){_0x422b76[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x422b76['where'],{'$or':_[_0xda72('0x44')](_0x49ab41,function(_0x34628d){if(_0x34628d['type']!==_0xda72('0x52')){var _0x200b28={};_0x200b28[_0x34628d[_0xda72('0x3c')]]={'$like':'%'+_0x1d3ea3[_0xda72('0x45')]['filter']+'%'};return _0x200b28;}})});}_0x422b76=_[_0xda72('0x51')]({},_0x422b76,_0x1d3ea3[_0xda72('0x53')]);var _0x4efb56={'where':_0x422b76['where']};return db['WhatsappAccount'][_0xda72('0x30')](_0x4efb56)[_0xda72('0x22')](function(_0x3eb874){_0x1b7477['count']=_0x3eb874;if(_0x1d3ea3[_0xda72('0x45')][_0xda72('0x54')]){_0x422b76[_0xda72('0x55')]=[{'all':!![]}];}return db[_0xda72('0x56')][_0xda72('0x57')](_0x422b76);})[_0xda72('0x22')](function(_0xf726fb){_0x1b7477['rows']=_0xf726fb;return _0x1b7477;})[_0xda72('0x22')](respondWithFilteredResult(_0x12888b,_0x422b76))[_0xda72('0x2b')](handleError(_0x12888b,null));};exports['show']=function(_0x598ade,_0xceb538){var _0x4e2f36={'raw':![],'where':{'id':_0x598ade[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0x3f')],'as':_0xda72('0x40')}]},_0x4f7722={};_0x4f7722[_0xda72('0x48')]=_[_0xda72('0x46')](db[_0xda72('0x56')][_0xda72('0x41')]);_0x4f7722[_0xda72('0x45')]=_['keys'](_0x598ade[_0xda72('0x45')]);_0x4f7722['filters']=_[_0xda72('0x59')](_0x4f7722[_0xda72('0x48')],_0x4f7722[_0xda72('0x45')]);_0x4e2f36[_0xda72('0x49')]=_[_0xda72('0x59')](_0x4f7722[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x598ade['query'][_0xda72('0x4a')]));_0x4e2f36['attributes']=_0x4e2f36[_0xda72('0x49')]['length']?_0x4e2f36[_0xda72('0x49')]:_0x4f7722[_0xda72('0x48')];if(_0x598ade['query'][_0xda72('0x54')]){_0x4e2f36['include']=[{'all':!![]}];}_0x4e2f36=_[_0xda72('0x51')]({},_0x4e2f36,_0x598ade[_0xda72('0x53')]);return db[_0xda72('0x56')]['find'](_0x4e2f36)[_0xda72('0x22')](handleEntityNotFound(_0xceb538,null))[_0xda72('0x22')](respondWithResult(_0xceb538,null))[_0xda72('0x2b')](handleError(_0xceb538,null));};exports[_0xda72('0x5a')]=function(_0xad1a41,_0x56bfa1){return db[_0xda72('0x56')][_0xda72('0x5a')](_0xad1a41[_0xda72('0x5b')],{})[_0xda72('0x22')](function(_0x989e70){var _0x566c81=_0xad1a41[_0xda72('0x5c')][_0xda72('0x37')]({'plain':!![]});if(!_0x566c81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x566c81[_0xda72('0x5d')]===_0xda72('0x5c')){var _0x1755e4=_0x989e70[_0xda72('0x37')]({'plain':!![]});var _0x41ff0c='WhatsappAccounts';return db[_0xda72('0x5e')][_0xda72('0x5f')]({'where':{'name':_0x41ff0c,'userProfileId':_0x566c81[_0xda72('0x60')]},'raw':!![]})['then'](function(_0x48f47e){if(_0x48f47e&&_0x48f47e[_0xda72('0x61')]===0x0){return db[_0xda72('0x62')][_0xda72('0x5a')]({'name':_0x1755e4['name'],'resourceId':_0x1755e4['id'],'type':_0x48f47e[_0xda72('0x3c')],'sectionId':_0x48f47e['id']},{})[_0xda72('0x22')](function(){return _0x989e70;});}else{return _0x989e70;}})['catch'](function(_0xc5da89){logger[_0xda72('0x28')](_0xda72('0x63'),_0xc5da89);throw _0xc5da89;});}return _0x989e70;})[_0xda72('0x22')](respondWithResult(_0x56bfa1,0xc9))[_0xda72('0x2b')](handleError(_0x56bfa1,null));};exports[_0xda72('0x36')]=function(_0x5ecd60,_0x27fc44){if(_0x5ecd60[_0xda72('0x5b')]['id']){delete _0x5ecd60[_0xda72('0x5b')]['id'];}return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x5ecd60[_0xda72('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xda72('0x40')}]})[_0xda72('0x22')](handleEntityNotFound(_0x27fc44,null))[_0xda72('0x22')](saveUpdates(_0x5ecd60[_0xda72('0x5b')],null))[_0xda72('0x22')](respondWithResult(_0x27fc44,null))['catch'](handleError(_0x27fc44,null));};exports[_0xda72('0x39')]=function(_0x437991,_0x3d9d94){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x437991['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x3d9d94,null))[_0xda72('0x22')](removeEntity(_0x3d9d94,null))[_0xda72('0x2b')](handleError(_0x3d9d94,null));};exports[_0xda72('0x64')]=function(_0x463b40,_0xf3f89a){return db[_0xda72('0x56')][_0xda72('0x64')]()[_0xda72('0x22')](respondWithResult(_0xf3f89a,null))[_0xda72('0x2b')](handleError(_0xf3f89a,null));};exports[_0xda72('0x65')]=function(_0x57090d,_0x599099,_0x90d8df){if(_0x57090d[_0xda72('0x5b')]['id']){delete _0x57090d['body']['id'];}return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0x57090d[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x599099,null))[_0xda72('0x22')](function(_0x525f79){if(_0x525f79){_0x57090d['body'][_0xda72('0x66')]=_0x525f79['id'];return db[_0xda72('0x67')][_0xda72('0x5a')](_0x57090d[_0xda72('0x5b')]);}})[_0xda72('0x22')](respondWithResult(_0x599099,null))['catch'](handleError(_0x599099,null));};exports['getDispositions']=function(_0x276394,_0x2397a9,_0x549c75){var _0x2bb04c={'raw':![],'where':{}};var _0x25a7a5={};var _0x36397e={'count':0x0,'rows':[]};return db[_0xda72('0x56')]['findOne']({'where':{'id':_0x276394[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x2397a9,null))[_0xda72('0x22')](function(_0x174d51){if(_0x174d51){_0x25a7a5[_0xda72('0x48')]=_[_0xda72('0x46')](db[_0xda72('0x67')]['rawAttributes']);_0x25a7a5[_0xda72('0x45')]=_[_0xda72('0x46')](_0x276394[_0xda72('0x45')]);_0x25a7a5[_0xda72('0x47')]=_[_0xda72('0x59')](_0x25a7a5[_0xda72('0x48')],_0x25a7a5[_0xda72('0x45')]);_0x2bb04c[_0xda72('0x49')]=_['intersection'](_0x25a7a5[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x276394[_0xda72('0x45')][_0xda72('0x4a')]));_0x2bb04c[_0xda72('0x49')]=_0x2bb04c['attributes'][_0xda72('0x4b')]?_0x2bb04c[_0xda72('0x49')]:_0x25a7a5[_0xda72('0x48')];if(!_0x276394[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x2bb04c[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x276394['query'][_0xda72('0x32')]);_0x2bb04c[_0xda72('0x31')]=qs[_0xda72('0x31')](_0x276394[_0xda72('0x45')][_0xda72('0x31')]);}_0x2bb04c[_0xda72('0x68')]=qs['sort'](_0x276394[_0xda72('0x45')]['sort']);_0x2bb04c[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x276394[_0xda72('0x45')],_0x25a7a5['filters']));_0x2bb04c[_0xda72('0x4f')][_0xda72('0x66')]=_0x174d51['id'];if(_0x276394[_0xda72('0x45')][_0xda72('0x50')]){_0x2bb04c[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x2bb04c[_0xda72('0x4f')],{'$or':_['map'](_0x2bb04c['attributes'],function(_0x5ead38){var _0x4a8510={};_0x4a8510[_0x5ead38]={'$like':'%'+_0x276394['query'][_0xda72('0x50')]+'%'};return _0x4a8510;})});}_0x2bb04c=_['merge']({},_0x2bb04c,_0x276394['options']);return db[_0xda72('0x67')]['count']({'where':_0x2bb04c[_0xda72('0x4f')]})[_0xda72('0x22')](function(_0x2a5a84){_0x36397e[_0xda72('0x30')]=_0x2a5a84;if(_0x276394[_0xda72('0x45')][_0xda72('0x54')]){_0x2bb04c[_0xda72('0x55')]=[{'all':!![]}];}return db[_0xda72('0x67')][_0xda72('0x57')](_0x2bb04c);})[_0xda72('0x22')](function(_0x9cee51){_0x36397e[_0xda72('0x6a')]=_0x9cee51;return _0x36397e;});}})['then'](respondWithFilteredResult(_0x2397a9,_0x2bb04c))[_0xda72('0x2b')](handleError(_0x2397a9,null));};exports[_0xda72('0x6b')]=function(_0x1dfbd7,_0x23f5da,_0xdf6df0){return db[_0xda72('0x56')]['find']({'where':{'id':_0x1dfbd7[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x23f5da,null))[_0xda72('0x22')](function(_0x3286c5){if(_0x3286c5){return _0x3286c5[_0xda72('0x6b')](_0x1dfbd7[_0xda72('0x45')][_0xda72('0x6c')]);}})[_0xda72('0x22')](respondWithStatusCode(_0x23f5da,null))[_0xda72('0x2b')](handleError(_0x23f5da,null));};exports[_0xda72('0x6d')]=function(_0x48d9ca,_0x1dc7bf,_0x1d2179){if(_0x48d9ca['body']['id']){delete _0x48d9ca[_0xda72('0x5b')]['id'];}return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0x48d9ca[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x1dc7bf,null))[_0xda72('0x22')](function(_0x7f7435){if(_0x7f7435){_0x48d9ca[_0xda72('0x5b')][_0xda72('0x66')]=_0x7f7435['id'];return db[_0xda72('0x6e')][_0xda72('0x5a')](_0x48d9ca[_0xda72('0x5b')]);}})[_0xda72('0x22')](respondWithResult(_0x1dc7bf,null))[_0xda72('0x2b')](handleError(_0x1dc7bf,null));};exports['getAnswers']=function(_0x85ef4e,_0x201627,_0x1953b4){var _0x5a5aa9={'raw':![],'where':{}};var _0x1c9a61={};var _0x5c3385={'count':0x0,'rows':[]};return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x85ef4e['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x201627,null))[_0xda72('0x22')](function(_0x332718){if(_0x332718){_0x1c9a61['model']=_['keys'](db[_0xda72('0x6e')][_0xda72('0x41')]);_0x1c9a61[_0xda72('0x45')]=_['keys'](_0x85ef4e[_0xda72('0x45')]);_0x1c9a61['filters']=_[_0xda72('0x59')](_0x1c9a61[_0xda72('0x48')],_0x1c9a61[_0xda72('0x45')]);_0x5a5aa9[_0xda72('0x49')]=_[_0xda72('0x59')](_0x1c9a61[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x4a')]));_0x5a5aa9[_0xda72('0x49')]=_0x5a5aa9['attributes'][_0xda72('0x4b')]?_0x5a5aa9['attributes']:_0x1c9a61[_0xda72('0x48')];if(!_0x85ef4e[_0xda72('0x45')][_0xda72('0x4c')]('nolimit')){_0x5a5aa9[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x32')]);_0x5a5aa9[_0xda72('0x31')]=qs['offset'](_0x85ef4e[_0xda72('0x45')][_0xda72('0x31')]);}_0x5a5aa9[_0xda72('0x68')]=qs[_0xda72('0x4e')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x4e')]);_0x5a5aa9[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x85ef4e[_0xda72('0x45')],_0x1c9a61[_0xda72('0x47')]));_0x5a5aa9[_0xda72('0x4f')][_0xda72('0x66')]=_0x332718['id'];if(_0x85ef4e['query'][_0xda72('0x50')]){_0x5a5aa9[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x5a5aa9[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x5a5aa9[_0xda72('0x49')],function(_0x513bc9){var _0x3d2e31={};_0x3d2e31[_0x513bc9]={'$like':'%'+_0x85ef4e[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x3d2e31;})});}_0x5a5aa9=_[_0xda72('0x51')]({},_0x5a5aa9,_0x85ef4e['options']);return db['CannedAnswer'][_0xda72('0x30')]({'where':_0x5a5aa9[_0xda72('0x4f')]})['then'](function(_0x39e93f){_0x5c3385[_0xda72('0x30')]=_0x39e93f;if(_0x85ef4e['query'][_0xda72('0x54')]){_0x5a5aa9[_0xda72('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xda72('0x57')](_0x5a5aa9);})[_0xda72('0x22')](function(_0x391a13){_0x5c3385[_0xda72('0x6a')]=_0x391a13;return _0x5c3385;});}})[_0xda72('0x22')](respondWithFilteredResult(_0x201627,_0x5a5aa9))[_0xda72('0x2b')](handleError(_0x201627,null));};exports['removeAnswers']=function(_0xe6523,_0x2c7dc8,_0x1370b1){return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0xe6523[_0xda72('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c7dc8,null))[_0xda72('0x22')](function(_0x455392){if(_0x455392){return _0x455392[_0xda72('0x70')](_0xe6523[_0xda72('0x45')][_0xda72('0x6c')]);}})[_0xda72('0x22')](respondWithStatusCode(_0x2c7dc8,null))[_0xda72('0x2b')](handleError(_0x2c7dc8,null));};exports[_0xda72('0x71')]=function(_0x2637dd,_0x1f572c,_0x589120){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x2637dd[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x1f572c,null))['then'](function(_0xab6d97){if(_0xab6d97){return _0xab6d97[_0xda72('0x71')](_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')],_['omit'](_0x2637dd['body'],[_0xda72('0x6c'),'id'])||{})[_0xda72('0x72')](function(_0x33c3cd){for(var _0x3b5fa1=0x0;_0x3b5fa1<_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')][_0xda72('0x4b')];_0x3b5fa1+=0x1){socket['emit'](_0xda72('0x73'),{'UserId':Number(_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')][_0x3b5fa1]),'WhatsappAccountId':Number(_0x2637dd[_0xda72('0x58')]['id'])});}return _0x33c3cd;});}})['then'](respondWithResult(_0x1f572c,null))['catch'](handleError(_0x1f572c,null));};exports[_0xda72('0x74')]=function(_0x3f19f7,_0x5caef3,_0x16df17){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x3f19f7['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x5caef3,null))[_0xda72('0x22')](function(_0x3459b1){if(_0x3459b1){return _0x3459b1['removeAgents'](_0x3f19f7[_0xda72('0x45')]['ids'])[_0xda72('0x22')](function(){if(_['isArray'](_0x3f19f7[_0xda72('0x45')][_0xda72('0x6c')])){for(var _0x5259ae=0x0;_0x5259ae<_0x3f19f7['query'][_0xda72('0x6c')]['length'];_0x5259ae+=0x1){socket[_0xda72('0x75')](_0xda72('0x76'),{'UserId':Number(_0x3f19f7[_0xda72('0x45')][_0xda72('0x6c')][_0x5259ae]),'WhatsappAccountId':Number(_0x3f19f7[_0xda72('0x58')]['id'])});}}else{socket[_0xda72('0x75')](_0xda72('0x76'),{'UserId':Number(_0x3f19f7[_0xda72('0x45')]['ids']),'WhatsappAccountId':Number(_0x3f19f7[_0xda72('0x58')]['id'])});}});}})[_0xda72('0x22')](respondWithStatusCode(_0x5caef3,null))[_0xda72('0x2b')](handleError(_0x5caef3,null));};exports[_0xda72('0x77')]=function(_0x13f4b7,_0x361d9a,_0x3a7e72){var _0x583522={};var _0x994e6f={};var _0x392c31;var _0x236c51;return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x13f4b7[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x361d9a,null))['then'](function(_0x11f937){if(_0x11f937){_0x392c31=_0x11f937;_0x994e6f[_0xda72('0x48')]=_['keys'](db['User']['rawAttributes']);_0x994e6f[_0xda72('0x45')]=_[_0xda72('0x46')](_0x13f4b7[_0xda72('0x45')]);_0x994e6f['filters']=_[_0xda72('0x59')](_0x994e6f[_0xda72('0x48')],_0x994e6f[_0xda72('0x45')]);_0x583522[_0xda72('0x49')]=_[_0xda72('0x59')](_0x994e6f['model'],qs[_0xda72('0x4a')](_0x13f4b7[_0xda72('0x45')][_0xda72('0x4a')]));_0x583522['attributes']=_0x583522[_0xda72('0x49')][_0xda72('0x4b')]?_0x583522[_0xda72('0x49')]:_0x994e6f[_0xda72('0x48')];_0x583522['order']=qs[_0xda72('0x4e')](_0x13f4b7['query'][_0xda72('0x4e')]);_0x583522[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x13f4b7[_0xda72('0x45')],_0x994e6f[_0xda72('0x47')]));if(_0x13f4b7[_0xda72('0x45')][_0xda72('0x50')]){_0x583522[_0xda72('0x4f')]=_['merge'](_0x583522[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x583522[_0xda72('0x49')],function(_0x5c510c){var _0x4da6cf={};_0x4da6cf[_0x5c510c]={'$like':'%'+_0x13f4b7[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x4da6cf;})});}_0x583522=_['merge']({},_0x583522,_0x13f4b7[_0xda72('0x53')]);return _0x392c31[_0xda72('0x77')](_0x583522);}})[_0xda72('0x22')](function(_0x48d1b0){if(_0x48d1b0){_0x236c51=_0x48d1b0[_0xda72('0x4b')];if(!_0x13f4b7[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x583522[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x13f4b7[_0xda72('0x45')][_0xda72('0x32')]);_0x583522[_0xda72('0x31')]=qs['offset'](_0x13f4b7[_0xda72('0x45')][_0xda72('0x31')]);}return _0x392c31[_0xda72('0x77')](_0x583522);}})[_0xda72('0x22')](function(_0xe74e9a){if(_0xe74e9a){return _0xe74e9a?{'count':_0x236c51,'rows':_0xe74e9a}:null;}})[_0xda72('0x22')](respondWithResult(_0x361d9a,null))['catch'](handleError(_0x361d9a,null));};exports[_0xda72('0x78')]=function(_0x208afd,_0x2d3ff7){var _0x135df5=_0x208afd[_0xda72('0x58')]['id'];var _0x13484e=_0x208afd[_0xda72('0x5b')];var _0x459daf=0xc8;var _0x50f4d8=null;return db[_0xda72('0x79')][_0xda72('0x7a')]({'isolationLevel':db[_0xda72('0x79')][_0xda72('0x7b')]['ISOLATION_LEVELS'][_0xda72('0x7c')]},function(_0x653d43){return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x135df5},'transaction':_0x653d43})[_0xda72('0x22')](function(_0xf154d3){if(_0xf154d3){return db[_0xda72('0x7d')][_0xda72('0x39')]({'where':{'WhatsappAccountId':_0x135df5},'transaction':_0x653d43})['then'](function(){var _0x26e963=_[_0xda72('0x44')](_0x13484e,function(_0x3b3be3){_0x3b3be3['WhatsappAccountId']=_0x135df5;return _0x3b3be3;});return db[_0xda72('0x7d')][_0xda72('0x7e')](_0x26e963,{'transaction':_0x653d43});});}else{_0x459daf=0x194;_0x50f4d8=[];}});})['then'](function(){if(_0x459daf!==0x194){return db[_0xda72('0x7d')][_0xda72('0x7f')]({'where':{'WhatsappAccountId':_0x135df5},'order':_0xda72('0x80')})['then'](function(_0x1bdf42){_0x50f4d8=_0x1bdf42;});}})[_0xda72('0x2b')](function(_0x3cf5d5){_0x459daf=0x1f4;logger[_0xda72('0x28')](_0x3cf5d5[_0xda72('0x3b')]);if(_0x3cf5d5[_0xda72('0x3c')]){delete _0x3cf5d5['name'];}_0x50f4d8=_0x3cf5d5;})[_0xda72('0x81')](function(){if(_0x50f4d8===null){_0x2d3ff7[_0xda72('0x2c')](_0x459daf);}else{if(_0x459daf===0x1f4){_0x2d3ff7[_0xda72('0x2d')](_0x459daf)[_0xda72('0x3d')](_0x50f4d8);}else{_0x2d3ff7[_0xda72('0x2d')](_0x459daf)[_0xda72('0x2e')](_0x50f4d8);}}});};exports['getApplications']=function(_0xecae83,_0x180ddd,_0x3147ec){var _0x39f19e={};var _0x202901={};var _0x38650c;var _0x45db93;return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0xecae83[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x180ddd,null))[_0xda72('0x22')](function(_0xa80b4b){if(_0xa80b4b){_0x38650c=_0xa80b4b;_0x202901[_0xda72('0x48')]=_['keys'](db['WhatsappApplication'][_0xda72('0x41')]);_0x202901[_0xda72('0x45')]=_[_0xda72('0x46')](_0xecae83['query']);_0x202901[_0xda72('0x47')]=_[_0xda72('0x59')](_0x202901['model'],_0x202901[_0xda72('0x45')]);_0x39f19e[_0xda72('0x49')]=_[_0xda72('0x59')](_0x202901[_0xda72('0x48')],qs[_0xda72('0x4a')](_0xecae83[_0xda72('0x45')][_0xda72('0x4a')]));_0x39f19e['attributes']=_0x39f19e[_0xda72('0x49')][_0xda72('0x4b')]?_0x39f19e[_0xda72('0x49')]:_0x202901['model'];_0x39f19e[_0xda72('0x68')]=qs[_0xda72('0x4e')](_0xecae83[_0xda72('0x45')][_0xda72('0x4e')]);_0x39f19e[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0xecae83[_0xda72('0x45')],_0x202901[_0xda72('0x47')]));if(_0xecae83[_0xda72('0x45')][_0xda72('0x50')]){_0x39f19e[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x39f19e[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x39f19e[_0xda72('0x49')],function(_0x4ae2cc){var _0x14af8f={};_0x14af8f[_0x4ae2cc]={'$like':'%'+_0xecae83[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x14af8f;})});}_0x39f19e=_['merge']({},_0x39f19e,_0xecae83['options']);return _0x38650c[_0xda72('0x82')](_0x39f19e);}})[_0xda72('0x22')](function(_0x264fcc){if(_0x264fcc){_0x45db93=_0x264fcc[_0xda72('0x4b')];if(!_0xecae83['query']['hasOwnProperty'](_0xda72('0x4d'))){_0x39f19e[_0xda72('0x32')]=qs[_0xda72('0x32')](_0xecae83[_0xda72('0x45')][_0xda72('0x32')]);_0x39f19e['offset']=qs[_0xda72('0x31')](_0xecae83[_0xda72('0x45')][_0xda72('0x31')]);}return _0x38650c[_0xda72('0x82')](_0x39f19e);}})[_0xda72('0x22')](function(_0x4ea680){if(_0x4ea680){return _0x4ea680?{'count':_0x45db93,'rows':_0x4ea680}:null;}})[_0xda72('0x22')](respondWithResult(_0x180ddd,null))[_0xda72('0x2b')](handleError(_0x180ddd,null));};exports[_0xda72('0x83')]=function(_0x2a341f,_0x37a7e9,_0x559402){var _0x4920e5={'channel':_0xda72('0x84')};var _0x40d409=[];var _0x5186c1=[];var _0x4ec426={};return db[_0xda72('0x56')]['find']({'where':{'id':_0x2a341f[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0x7d')],'as':_0xda72('0x85')}]})['then'](handleEntityNotFound(_0x37a7e9,null))[_0xda72('0x22')](function(_0x19be5c){_0x4920e5[_0xda72('0x86')]=_0x19be5c;if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]==='sinch'&&_0x2a341f['body'][_0xda72('0x87')]){if(_0x2a341f[_0xda72('0x5b')]['statuses'][_0xda72('0x4b')]===0x0)return;if(_0x2a341f[_0xda72('0x5b')][_0xda72('0x87')][0x0]['state']!==_0xda72('0x88'))return;return db['WhatsappMessage'][_0xda72('0x36')]({'read':!![],'readAt':_0x2a341f['body'][_0xda72('0x87')][0x0]['timestamp']},{'where':{'messageId':_0x2a341f['body'][_0xda72('0x87')][0x0][_0xda72('0x89')]},'individualHooks':!![]})[_0xda72('0x22')](function(_0xc61304){return _0x37a7e9[_0xda72('0x2d')](0xc8)[_0xda72('0x2e')](_0xc61304);});}_0x4920e5[_0xda72('0x8a')]=_[_0xda72('0x8b')](_0x19be5c[_0xda72('0x85')],[_0xda72('0x80')],['asc']);if(_0x4920e5[_0xda72('0x86')][_0xda72('0x85')]){delete _0x4920e5[_0xda72('0x86')][_0xda72('0x85')];}return db['CmContact'][_0xda72('0x64')]()['then'](function(_0x5ffb9d){if(!_0x5ffb9d){throw new db[(_0xda72('0x8c'))]['ValidationError'](_0xda72('0x8d'));}_0x40d409=_[_0xda72('0x8e')](_[_0xda72('0x46')](_0x5ffb9d),[_0xda72('0x8f'),_0xda72('0x90')]);_0x5186c1=_[_0xda72('0x8e')](_[_0xda72('0x46')](_0x5ffb9d),['createdAt',_0xda72('0x90'),_0xda72('0x91'),_0xda72('0x92')]);_0x4920e5[_0xda72('0x5b')]={'mapKey':_0xda72('0x93')};if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]==='twilio'){_0x4920e5[_0xda72('0x5b')]['from']=_0x2a341f[_0xda72('0x5b')]['From']['replace'](_0xda72('0x94'),'');_0x4920e5['body']['body']=_0x2a341f[_0xda72('0x5b')]['Body'];_0x4920e5[_0xda72('0x5b')]['messageId']=_0x2a341f[_0xda72('0x5b')][_0xda72('0x95')];}if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]===_0xda72('0x96')){_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')]=_0x2a341f[_0xda72('0x5b')]['notifications'][0x0][_0xda72('0x97')];_0x4920e5[_0xda72('0x5b')][_0xda72('0x5b')]=_0x2a341f[_0xda72('0x5b')][_0xda72('0x98')][0x0][_0xda72('0x2a')]['body'];_0x4920e5[_0xda72('0x5b')][_0xda72('0x99')]=_0x2a341f[_0xda72('0x5b')]['notifications'][0x0][_0xda72('0x89')];}if(_0x4920e5[_0xda72('0x5b')]['id']){delete _0x4920e5[_0xda72('0x5b')]['id'];}if(_[_0xda72('0x9a')](_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')])){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0x9c'));}if(_[_0xda72('0x9a')](_0x4920e5['body'][_0xda72('0x5b')])||_0x4920e5[_0xda72('0x5b')][_0xda72('0x5b')]===''){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0x9d'));}if(_[_0xda72('0x9a')](_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')])){throw new db['Sequelize'][(_0xda72('0x9b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5186c1);}if(!_[_0xda72('0x9f')](_0x5186c1,_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')])){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0xa0')+_0x5186c1);}_0x4ec426[_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')]]=_0x4920e5['body'][_0xda72('0x97')];return db[_0xda72('0xa1')][_0xda72('0x5f')]({'where':{'id':_0x4920e5[_0xda72('0x86')][_0xda72('0x92')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ec426,'limit':0x1,'order':[[_0xda72('0x90'),_0xda72('0xa2')]]}]});})['then'](handleEntityNotFound(_0x37a7e9,null))['then'](function(_0x2358d0){if(_0x2358d0){_0x4920e5[_0xda72('0xa3')]=_[_0xda72('0xa4')](_0x2358d0,[_0xda72('0xa5')]);if(_0x2358d0[_0xda72('0xa5')][_0xda72('0x4b')]){return _0x2358d0[_0xda72('0xa5')][0x0];}var _0x6f955f=_[_0xda72('0x19')](_0x4920e5[_0xda72('0x5b')],{'firstName':_0x4920e5[_0xda72('0x5b')]['from'],'ListId':_0x2358d0['id']});_0x6f955f[_0x4920e5['body'][_0xda72('0x9e')]]=_0x4920e5[_0xda72('0x5b')]['from'];return db[_0xda72('0xa6')][_0xda72('0x5a')](_0x6f955f,{'fields':_0x40d409,'raw':!![]});}})['then'](handleEntityNotFound(_0x37a7e9,null))[_0xda72('0x22')](function(_0x403b84){if(_0x403b84){_0x4920e5[_0xda72('0xa7')]=_0x403b84;var _0x8c9b2c={'ContactId':_0x403b84['id'],'phone':_0x4920e5[_0xda72('0x5b')]['from'],'WhatsappAccountId':_0x2a341f['params']['id']};var _0x3e1abf={'ContactId':_0x403b84['id'],'WhatsappAccountId':_0x2a341f['params']['id'],'closed':![]};return db[_0xda72('0xa8')]['find']({'where':_0x3e1abf})[_0xda72('0x22')](function(_0x159e52){if(_0x159e52){return[_0x159e52,![]];}return db[_0xda72('0xa8')][_0xda72('0x5a')](_0x8c9b2c)['then'](function(_0x410251){return[_0x410251,!![]];});});}})[_0xda72('0x72')](function(_0x24648b,_0x19997f){_0x4920e5[_0xda72('0xa9')]=_0x24648b[_0xda72('0x37')]({'plain':!![]});_0x4920e5[_0xda72('0xa9')]['created']=![];if(_0x19997f){if(_0x4920e5['account'][_0xda72('0xaa')]){_0x4920e5[_0xda72('0x8a')]['push']({'id':0x0,'priority':_0x4920e5['applications'][_0xda72('0x4b')]+0x1,'app':_0xda72('0xab'),'appdata':_0xda72('0xac'),'interval':_0xda72('0xad')});}_0x4920e5[_0xda72('0xa9')][_0xda72('0xae')]=!![];}return db[_0xda72('0xaf')]['create']({'phone':_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')],'messageId':_0x4920e5['body'][_0xda72('0x99')],'body':_0x4920e5['body'][_0xda72('0x5b')],'WhatsappAccountId':_0x2a341f[_0xda72('0x58')]['id'],'WhatsappInteractionId':_0x24648b['id'],'direction':'in','ContactId':_0x24648b[_0xda72('0xb0')],'AttachmentId':_0x4920e5['body'][_0xda72('0xb1')]});})['then'](function(_0x36d08d){_0x4920e5[_0xda72('0x2a')]=_0x36d08d;if(!_0x4920e5['interaction']['UserId'])return;return db[_0xda72('0xb2')]['find']({'attributes':['id',_0xda72('0x3c')],'where':{'id':_0x4920e5[_0xda72('0xa9')][_0xda72('0xb3')]}});})['then'](function(_0x327b6e){if(_0x327b6e){_0x4920e5[_0xda72('0x8a')][_0xda72('0xb4')]({'id':0x0,'priority':0x0,'app':_0xda72('0xb5'),'appdata':_0x327b6e[_0xda72('0x3c')]+','+(_0x4920e5['account'][_0xda72('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0x4920e5[_0xda72('0xa9')][_0xda72('0xb7')])return;return db[_0xda72('0xb8')][_0xda72('0x5f')]({'attributes':['id','name'],'where':{'id':_0x4920e5[_0xda72('0xa9')]['queueId']}});})[_0xda72('0x22')](function(_0x322018){if(_0x322018){_0x4920e5[_0xda72('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xda72('0xb9'),'appdata':_0x322018[_0xda72('0x3c')]+','+(_0x4920e5[_0xda72('0x86')][_0xda72('0xba')]||0x12c),'interval':_0xda72('0xad')});}return respondWithRpcPromise('Start',_0xda72('0xbb'),_0x4920e5);})[_0xda72('0x22')](function(_0x4cf7e9){if(_0x4cf7e9){var _0x265f84=0xc8;var _0x2867a9=_0xda72('0xbc');logger[_0xda72('0x23')](_0xda72('0x26'),_0x2867a9,_0x265f84,_0xda72('0xbd'));logger[_0xda72('0x25')](_0xda72('0xbe'),_0x2867a9,_0x265f84,_0xda72('0xbd'),JSON['stringify'](_0x4cf7e9));if(_0x4920e5['account']['type']===_0xda72('0xbf')){return _0x37a7e9['status'](_0x265f84)[_0xda72('0x33')](_0xda72('0xc0'),'text/xml')['send'](_0xda72('0xc1'));}else{return _0x37a7e9[_0xda72('0x2d')](_0x265f84)[_0xda72('0x2e')](_0x4cf7e9);}}});})[_0xda72('0x2b')](handleError(_0x37a7e9,null));};exports[_0xda72('0x3d')]=function(_0x46c173,_0x32c613,_0x9ee8b9){var _0xf7147a,_0x4bb2af,_0x177850;if(_[_0xda72('0x9a')](_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')])||_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')]===''){throw new db[(_0xda72('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x46c173['body']['to'])){throw new db['Sequelize'][(_0xda72('0x9b'))](_0xda72('0xc2'));}_0xf7147a=_0x46c173[_0xda72('0x5b')]['to'];return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x46c173[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0xa1')],'as':_0xda72('0xc3'),'include':[{'model':db[_0xda72('0xa6')],'as':_0xda72('0xa5'),'where':{'mobile':_0xf7147a},'limit':0x1,'order':[[_0xda72('0x90'),_0xda72('0xa2')]]}]}]})[_0xda72('0x22')](handleEntityNotFound(_0x32c613,null))[_0xda72('0x22')](function(_0x129e27){if(_0x129e27&&_0x129e27[_0xda72('0xc3')]){_0x4bb2af=_0x129e27['get']({'plain':!![]});if(_0x4bb2af[_0xda72('0xc3')]&&_0x4bb2af[_0xda72('0xc3')][_0xda72('0xa5')]['length']){return _0x4bb2af[_0xda72('0xc3')][_0xda72('0xa5')][0x0];}return db[_0xda72('0xa6')][_0xda72('0x5a')](_[_0xda72('0x19')](_0x46c173[_0xda72('0x5b')],{'firstName':_0xf7147a,'mobile':_0xf7147a,'phone':_0xf7147a,'ListId':_0x4bb2af[_0xda72('0x92')]}));}})[_0xda72('0x22')](handleEntityNotFound(_0x32c613,null))[_0xda72('0x22')](function(_0x5b9d78){if(_0x5b9d78){_0x177850=_0x5b9d78;return db[_0xda72('0xa8')]['find']({'where':{'ContactId':_0x177850['id'],'closed':![],'WhatsappAccountId':_0x4bb2af['id']}})[_0xda72('0x22')](function(_0x54ff9a){if(_0x54ff9a){return[_0x54ff9a,![]];}return db[_0xda72('0xa8')][_0xda72('0x5a')]({'UserId':_0x46c173['user']['id'],'ContactId':_0x177850['id'],'WhatsappAccountId':_0x4bb2af['id'],'phone':_0xf7147a,'firstMsgDirection':_0xda72('0xc4'),'Messages':[_[_0xda72('0x51')](_0x46c173['body'],{'read':![],'body':_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')],'phone':_0xf7147a,'WhatsappAccountId':_0x4bb2af['id'],'UserId':_0x46c173[_0xda72('0x5c')]['id'],'ContactId':_0x177850['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xda72('0xc5')}]})[_0xda72('0x22')](function(_0x532c68){return[_0x532c68,!![]];});});}})[_0xda72('0x72')](function(_0x24029d,_0xe824ae){if(_0xe824ae){return _0x24029d;}return db[_0xda72('0xaf')][_0xda72('0x5a')](_[_0xda72('0x51')](_0x46c173[_0xda72('0x5b')],{'read':![],'body':_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')],'phone':_0xf7147a,'WhatsappAccountId':_0x4bb2af['id'],'WhatsappInteractionId':_0x24029d['id'],'UserId':_0x46c173[_0xda72('0x5c')]['id'],'ContactId':_0x177850['id']}))[_0xda72('0x22')](function(_0x1fb792){_0x24029d[_0xda72('0xc6')]['Messages']=[];_0x24029d[_0xda72('0xc6')][_0xda72('0xc5')]['push'](_0x1fb792[_0xda72('0xc6')]);return _0x24029d;});})[_0xda72('0x22')](respondWithResult(_0x32c613,null))[_0xda72('0x2b')](handleError(_0x32c613,null));}; \ No newline at end of file +var _0xfc25=['../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','end','stack','name','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','count','includeAll','findAll','rows','show','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','keys','Disposition','hasOwnProperty','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','READ_COMMITTED','bulkCreate','WhatsappApplication','priority','finally','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','applications','orderBy','asc','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x20a021,_0x22dee9){var _0x3c9bc8=function(_0x5822d7){while(--_0x5822d7){_0x20a021['push'](_0x20a021['shift']());}};_0x3c9bc8(++_0x22dee9);}(_0xfc25,0x163));var _0x5fc2=function(_0x1b92dd,_0x192bbe){_0x1b92dd=_0x1b92dd-0x0;var _0xf5aee6=_0xfc25[_0x1b92dd];return _0xf5aee6;};'use strict';var emlformat=require(_0x5fc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fc2('0x1'));var jsonpatch=require(_0x5fc2('0x2'));var rp=require(_0x5fc2('0x3'));var moment=require(_0x5fc2('0x4'));var BPromise=require(_0x5fc2('0x5'));var Mustache=require(_0x5fc2('0x6'));var util=require(_0x5fc2('0x7'));var path=require(_0x5fc2('0x8'));var sox=require(_0x5fc2('0x9'));var csv=require(_0x5fc2('0xa'));var ejs=require(_0x5fc2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fc2('0xc'));var squel=require(_0x5fc2('0xd'));var crypto=require(_0x5fc2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5fc2('0xf'));var toCsv=require(_0x5fc2('0xa'));var querystring=require(_0x5fc2('0x10'));var Papa=require(_0x5fc2('0x11'));var Redis=require(_0x5fc2('0x12'));var authService=require(_0x5fc2('0x13'));var qs=require(_0x5fc2('0x14'));var as=require(_0x5fc2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fc2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5fc2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5fc2('0x18')]=_['defaults'](config[_0x5fc2('0x18')],{'host':_0x5fc2('0x19'),'port':0x18eb});var socket=require(_0x5fc2('0x1a'))(new Redis(config[_0x5fc2('0x18')]));require('./whatsappAccount.socket')[_0x5fc2('0x1b')](socket);var jayson=require(_0x5fc2('0x1c'));var client=jayson[_0x5fc2('0x1d')][_0x5fc2('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x31d99f,_0x4827be,_0x373dfa,_0x47a645){return new BPromise(function(_0x2f34b7,_0x3c874e){var _0x461b3f=_0x47a645||client;return _0x461b3f[_0x5fc2('0x1f')](_0x31d99f,_0x373dfa)[_0x5fc2('0x20')](function(_0x5995a1){logger['info'](_0x5fc2('0x21'),_0x4827be,_0x5fc2('0x22'));logger[_0x5fc2('0x23')](_0x5fc2('0x24'),_0x4827be,_0x5fc2('0x22'),JSON['stringify'](_0x5995a1));if(_0x5995a1[_0x5fc2('0x25')]){if(_0x5995a1[_0x5fc2('0x25')][_0x5fc2('0x26')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4827be,_0x5995a1[_0x5fc2('0x25')]['message']);return _0x3c874e(_0x5995a1['error'][_0x5fc2('0x27')]);}logger[_0x5fc2('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4827be,_0x5995a1['error']['message']);return _0x2f34b7(_0x5995a1[_0x5fc2('0x25')]['message']);}else{logger[_0x5fc2('0x28')](_0x5fc2('0x21'),_0x4827be,'request\x20sent');_0x2f34b7(_0x5995a1[_0x5fc2('0x29')]['message']);}})[_0x5fc2('0x2a')](function(_0x16f655){logger[_0x5fc2('0x25')](_0x5fc2('0x21'),_0x4827be,_0x16f655);_0x3c874e(_0x16f655);});});}function respondWithStatusCode(_0x4b8d81,_0x23be65){_0x23be65=_0x23be65||0xcc;return function(_0x5f30f7){if(_0x5f30f7){return _0x4b8d81[_0x5fc2('0x2b')](_0x23be65);}return _0x4b8d81[_0x5fc2('0x2c')](_0x23be65)['end']();};}function respondWithResult(_0x570396,_0x479622){_0x479622=_0x479622||0xc8;return function(_0x5a18d1){if(_0x5a18d1){return _0x570396[_0x5fc2('0x2c')](_0x479622)[_0x5fc2('0x2d')](_0x5a18d1);}};}function respondWithFilteredResult(_0x343fca,_0x14249f){return function(_0x3e7e3b){if(_0x3e7e3b){var _0x15225c=typeof _0x14249f[_0x5fc2('0x2e')]===_0x5fc2('0x2f')&&typeof _0x14249f[_0x5fc2('0x30')]===_0x5fc2('0x2f');var _0x4aec9d=_0x3e7e3b['count'];var _0x211672=_0x15225c?0x0:_0x14249f[_0x5fc2('0x2e')];var _0x78aacb=_0x15225c?_0x3e7e3b['count']:_0x14249f[_0x5fc2('0x2e')]+_0x14249f[_0x5fc2('0x30')];var _0x15a42d;if(_0x78aacb>=_0x4aec9d){_0x78aacb=_0x4aec9d;_0x15a42d=0xc8;}else{_0x15a42d=0xce;}_0x343fca[_0x5fc2('0x2c')](_0x15a42d);return _0x343fca['set'](_0x5fc2('0x31'),_0x211672+'-'+_0x78aacb+'/'+_0x4aec9d)[_0x5fc2('0x2d')](_0x3e7e3b);}return null;};}function patchUpdates(_0x35380f){return function(_0x377993){try{jsonpatch['apply'](_0x377993,_0x35380f,!![]);}catch(_0x1e15f8){return BPromise[_0x5fc2('0x32')](_0x1e15f8);}return _0x377993[_0x5fc2('0x33')]();};}function saveUpdates(_0x1473c3,_0x3a2fec){return function(_0x3d59c5){if(_0x3d59c5){return _0x3d59c5[_0x5fc2('0x34')](_0x1473c3)[_0x5fc2('0x20')](function(_0x16f3e4){return _0x16f3e4;});}return null;};}function removeEntity(_0xa13fde,_0x5b4b27){return function(_0x3574c1){if(_0x3574c1){return _0x3574c1[_0x5fc2('0x35')]()[_0x5fc2('0x20')](function(){var _0x30333e=_0x3574c1['get']({'plain':!![]});var _0x52ff65='WhatsappAccounts';return db['UserProfileResource'][_0x5fc2('0x35')]({'where':{'type':_0x52ff65,'resourceId':_0x30333e['id']}})['then'](function(){return _0x3574c1;});})['then'](function(){_0xa13fde[_0x5fc2('0x2c')](0xcc)[_0x5fc2('0x36')]();});}};}function handleEntityNotFound(_0x1a062a,_0x2b6b43){return function(_0x58ab55){if(!_0x58ab55){_0x1a062a['sendStatus'](0x194);}return _0x58ab55;};}function handleError(_0x357e11,_0x3d782a){_0x3d782a=_0x3d782a||0x1f4;return function(_0x5afffc){logger[_0x5fc2('0x25')](_0x5afffc[_0x5fc2('0x37')]);if(_0x5afffc[_0x5fc2('0x38')]){delete _0x5afffc[_0x5fc2('0x38')];}_0x357e11[_0x5fc2('0x2c')](_0x3d782a)['send'](_0x5afffc);};}exports['index']=function(_0x884d9f,_0x1b49b1){var _0x5419b9={'include':[{'model':db[_0x5fc2('0x39')],'as':_0x5fc2('0x3a')}]},_0x4a5130={},_0x4cba49={'count':0x0,'rows':[]};var _0x203278=_['map'](db[_0x5fc2('0x3b')][_0x5fc2('0x3c')],function(_0x298ebc){return{'name':_0x298ebc[_0x5fc2('0x3d')],'type':_0x298ebc[_0x5fc2('0x3e')]['key']};});_0x4a5130[_0x5fc2('0x3f')]=_['map'](_0x203278,_0x5fc2('0x38'));_0x4a5130[_0x5fc2('0x40')]=_['keys'](_0x884d9f[_0x5fc2('0x40')]);_0x4a5130[_0x5fc2('0x41')]=_['intersection'](_0x4a5130[_0x5fc2('0x3f')],_0x4a5130['query']);_0x5419b9[_0x5fc2('0x42')]=_[_0x5fc2('0x43')](_0x4a5130[_0x5fc2('0x3f')],qs[_0x5fc2('0x44')](_0x884d9f[_0x5fc2('0x40')]['fields']));_0x5419b9[_0x5fc2('0x42')]=_0x5419b9[_0x5fc2('0x42')][_0x5fc2('0x45')]?_0x5419b9['attributes']:_0x4a5130[_0x5fc2('0x3f')];if(!_0x884d9f[_0x5fc2('0x40')]['hasOwnProperty'](_0x5fc2('0x46'))){_0x5419b9['limit']=qs[_0x5fc2('0x30')](_0x884d9f['query']['limit']);_0x5419b9[_0x5fc2('0x2e')]=qs['offset'](_0x884d9f['query'][_0x5fc2('0x2e')]);}_0x5419b9[_0x5fc2('0x47')]=qs['sort'](_0x884d9f['query'][_0x5fc2('0x48')]);_0x5419b9['where']=qs[_0x5fc2('0x41')](_[_0x5fc2('0x49')](_0x884d9f['query'],_0x4a5130[_0x5fc2('0x41')]),_0x203278);if(_0x884d9f[_0x5fc2('0x40')][_0x5fc2('0x4a')]){_0x5419b9[_0x5fc2('0x4b')]=_[_0x5fc2('0x4c')](_0x5419b9[_0x5fc2('0x4b')],{'$or':_[_0x5fc2('0x4d')](_0x203278,function(_0xfec276){if(_0xfec276['type']!==_0x5fc2('0x4e')){var _0x2d0a99={};_0x2d0a99[_0xfec276[_0x5fc2('0x38')]]={'$like':'%'+_0x884d9f[_0x5fc2('0x40')][_0x5fc2('0x4a')]+'%'};return _0x2d0a99;}})});}_0x5419b9=_[_0x5fc2('0x4c')]({},_0x5419b9,_0x884d9f['options']);var _0x28b019={'where':_0x5419b9[_0x5fc2('0x4b')]};return db['WhatsappAccount'][_0x5fc2('0x4f')](_0x28b019)[_0x5fc2('0x20')](function(_0x22fb76){_0x4cba49['count']=_0x22fb76;if(_0x884d9f[_0x5fc2('0x40')][_0x5fc2('0x50')]){_0x5419b9['include']=[{'all':!![]}];}return db[_0x5fc2('0x3b')][_0x5fc2('0x51')](_0x5419b9);})[_0x5fc2('0x20')](function(_0x80c692){_0x4cba49[_0x5fc2('0x52')]=_0x80c692;return _0x4cba49;})[_0x5fc2('0x20')](respondWithFilteredResult(_0x1b49b1,_0x5419b9))[_0x5fc2('0x2a')](handleError(_0x1b49b1,null));};exports[_0x5fc2('0x53')]=function(_0x52aa43,_0x37371e){var _0x345e72={'raw':![],'where':{'id':_0x52aa43['params']['id']},'include':[{'model':db[_0x5fc2('0x39')],'as':_0x5fc2('0x3a')}]},_0x2c0135={};_0x2c0135[_0x5fc2('0x3f')]=_['keys'](db[_0x5fc2('0x3b')][_0x5fc2('0x3c')]);_0x2c0135[_0x5fc2('0x40')]=_['keys'](_0x52aa43[_0x5fc2('0x40')]);_0x2c0135[_0x5fc2('0x41')]=_[_0x5fc2('0x43')](_0x2c0135[_0x5fc2('0x3f')],_0x2c0135['query']);_0x345e72[_0x5fc2('0x42')]=_[_0x5fc2('0x43')](_0x2c0135[_0x5fc2('0x3f')],qs['fields'](_0x52aa43[_0x5fc2('0x40')]['fields']));_0x345e72[_0x5fc2('0x42')]=_0x345e72[_0x5fc2('0x42')][_0x5fc2('0x45')]?_0x345e72[_0x5fc2('0x42')]:_0x2c0135[_0x5fc2('0x3f')];if(_0x52aa43[_0x5fc2('0x40')]['includeAll']){_0x345e72[_0x5fc2('0x54')]=[{'all':!![]}];}_0x345e72=_[_0x5fc2('0x4c')]({},_0x345e72,_0x52aa43[_0x5fc2('0x55')]);return db[_0x5fc2('0x3b')]['find'](_0x345e72)[_0x5fc2('0x20')](handleEntityNotFound(_0x37371e,null))['then'](respondWithResult(_0x37371e,null))[_0x5fc2('0x2a')](handleError(_0x37371e,null));};exports['create']=function(_0x2eaf99,_0x2bc4d8){return db['WhatsappAccount'][_0x5fc2('0x56')](_0x2eaf99[_0x5fc2('0x57')],{})[_0x5fc2('0x20')](function(_0x50382c){var _0x2dd067=_0x2eaf99[_0x5fc2('0x58')]['get']({'plain':!![]});if(!_0x2dd067)throw new Error(_0x5fc2('0x59'));if(_0x2dd067['role']===_0x5fc2('0x58')){var _0x31e924=_0x50382c[_0x5fc2('0x5a')]({'plain':!![]});var _0x625535='WhatsappAccounts';return db['UserProfileSection'][_0x5fc2('0x5b')]({'where':{'name':_0x625535,'userProfileId':_0x2dd067['userProfileId']},'raw':!![]})[_0x5fc2('0x20')](function(_0x41571e){if(_0x41571e&&_0x41571e[_0x5fc2('0x5c')]===0x0){return db['UserProfileResource'][_0x5fc2('0x56')]({'name':_0x31e924['name'],'resourceId':_0x31e924['id'],'type':_0x41571e[_0x5fc2('0x38')],'sectionId':_0x41571e['id']},{})[_0x5fc2('0x20')](function(){return _0x50382c;});}else{return _0x50382c;}})[_0x5fc2('0x2a')](function(_0x51ca6e){logger['error'](_0x5fc2('0x5d'),_0x51ca6e);throw _0x51ca6e;});}return _0x50382c;})[_0x5fc2('0x20')](respondWithResult(_0x2bc4d8,0xc9))[_0x5fc2('0x2a')](handleError(_0x2bc4d8,null));};exports[_0x5fc2('0x34')]=function(_0xc678ee,_0x15e0c9){if(_0xc678ee[_0x5fc2('0x57')]['id']){delete _0xc678ee[_0x5fc2('0x57')]['id'];}return db['WhatsappAccount'][_0x5fc2('0x5b')]({'where':{'id':_0xc678ee[_0x5fc2('0x5e')]['id']},'include':[{'model':db[_0x5fc2('0x39')],'as':_0x5fc2('0x3a')}]})['then'](handleEntityNotFound(_0x15e0c9,null))[_0x5fc2('0x20')](saveUpdates(_0xc678ee['body'],null))[_0x5fc2('0x20')](respondWithResult(_0x15e0c9,null))[_0x5fc2('0x2a')](handleError(_0x15e0c9,null));};exports['destroy']=function(_0x176287,_0x2fd3f6){return db[_0x5fc2('0x3b')]['find']({'where':{'id':_0x176287['params']['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x2fd3f6,null))[_0x5fc2('0x20')](removeEntity(_0x2fd3f6,null))[_0x5fc2('0x2a')](handleError(_0x2fd3f6,null));};exports[_0x5fc2('0x5f')]=function(_0x36013a,_0x3df0a4){return db['WhatsappAccount']['describe']()[_0x5fc2('0x20')](respondWithResult(_0x3df0a4,null))[_0x5fc2('0x2a')](handleError(_0x3df0a4,null));};exports['addDisposition']=function(_0x2e3de0,_0xb32439,_0x230c65){if(_0x2e3de0[_0x5fc2('0x57')]['id']){delete _0x2e3de0[_0x5fc2('0x57')]['id'];}return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x2e3de0[_0x5fc2('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb32439,null))[_0x5fc2('0x20')](function(_0x1b7080){if(_0x1b7080){_0x2e3de0[_0x5fc2('0x57')]['WhatsappAccountId']=_0x1b7080['id'];return db['Disposition']['create'](_0x2e3de0[_0x5fc2('0x57')]);}})[_0x5fc2('0x20')](respondWithResult(_0xb32439,null))['catch'](handleError(_0xb32439,null));};exports['getDispositions']=function(_0x24e870,_0x20e6db,_0x355c19){var _0x3839e6={'raw':![],'where':{}};var _0x49d23c={};var _0x1a218e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5fc2('0x60')]({'where':{'id':_0x24e870[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x20e6db,null))[_0x5fc2('0x20')](function(_0x13e581){if(_0x13e581){_0x49d23c[_0x5fc2('0x3f')]=_[_0x5fc2('0x61')](db[_0x5fc2('0x62')][_0x5fc2('0x3c')]);_0x49d23c[_0x5fc2('0x40')]=_[_0x5fc2('0x61')](_0x24e870[_0x5fc2('0x40')]);_0x49d23c[_0x5fc2('0x41')]=_[_0x5fc2('0x43')](_0x49d23c[_0x5fc2('0x3f')],_0x49d23c[_0x5fc2('0x40')]);_0x3839e6[_0x5fc2('0x42')]=_[_0x5fc2('0x43')](_0x49d23c[_0x5fc2('0x3f')],qs[_0x5fc2('0x44')](_0x24e870[_0x5fc2('0x40')]['fields']));_0x3839e6[_0x5fc2('0x42')]=_0x3839e6[_0x5fc2('0x42')][_0x5fc2('0x45')]?_0x3839e6[_0x5fc2('0x42')]:_0x49d23c[_0x5fc2('0x3f')];if(!_0x24e870['query'][_0x5fc2('0x63')](_0x5fc2('0x46'))){_0x3839e6[_0x5fc2('0x30')]=qs[_0x5fc2('0x30')](_0x24e870[_0x5fc2('0x40')][_0x5fc2('0x30')]);_0x3839e6[_0x5fc2('0x2e')]=qs[_0x5fc2('0x2e')](_0x24e870['query'][_0x5fc2('0x2e')]);}_0x3839e6[_0x5fc2('0x47')]=qs[_0x5fc2('0x48')](_0x24e870['query'][_0x5fc2('0x48')]);_0x3839e6[_0x5fc2('0x4b')]=qs['filters'](_[_0x5fc2('0x49')](_0x24e870[_0x5fc2('0x40')],_0x49d23c[_0x5fc2('0x41')]));_0x3839e6[_0x5fc2('0x4b')][_0x5fc2('0x64')]=_0x13e581['id'];if(_0x24e870[_0x5fc2('0x40')][_0x5fc2('0x4a')]){_0x3839e6[_0x5fc2('0x4b')]=_['merge'](_0x3839e6[_0x5fc2('0x4b')],{'$or':_[_0x5fc2('0x4d')](_0x3839e6[_0x5fc2('0x42')],function(_0xe5eb73){var _0x2da5e7={};_0x2da5e7[_0xe5eb73]={'$like':'%'+_0x24e870[_0x5fc2('0x40')][_0x5fc2('0x4a')]+'%'};return _0x2da5e7;})});}_0x3839e6=_[_0x5fc2('0x4c')]({},_0x3839e6,_0x24e870['options']);return db['Disposition'][_0x5fc2('0x4f')]({'where':_0x3839e6[_0x5fc2('0x4b')]})[_0x5fc2('0x20')](function(_0x5549dd){_0x1a218e[_0x5fc2('0x4f')]=_0x5549dd;if(_0x24e870[_0x5fc2('0x40')][_0x5fc2('0x50')]){_0x3839e6[_0x5fc2('0x54')]=[{'all':!![]}];}return db[_0x5fc2('0x62')][_0x5fc2('0x51')](_0x3839e6);})[_0x5fc2('0x20')](function(_0x4adcd1){_0x1a218e['rows']=_0x4adcd1;return _0x1a218e;});}})[_0x5fc2('0x20')](respondWithFilteredResult(_0x20e6db,_0x3839e6))[_0x5fc2('0x2a')](handleError(_0x20e6db,null));};exports['removeDispositions']=function(_0x1a3497,_0x1b699a,_0x3d9a4b){return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x1a3497[_0x5fc2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b699a,null))['then'](function(_0x2bf41b){if(_0x2bf41b){return _0x2bf41b[_0x5fc2('0x65')](_0x1a3497[_0x5fc2('0x40')][_0x5fc2('0x66')]);}})['then'](respondWithStatusCode(_0x1b699a,null))[_0x5fc2('0x2a')](handleError(_0x1b699a,null));};exports[_0x5fc2('0x67')]=function(_0x58c9ba,_0xe15e41,_0x1ce589){if(_0x58c9ba[_0x5fc2('0x57')]['id']){delete _0x58c9ba[_0x5fc2('0x57')]['id'];}return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x58c9ba[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0xe15e41,null))['then'](function(_0x25ba62){if(_0x25ba62){_0x58c9ba['body']['WhatsappAccountId']=_0x25ba62['id'];return db['CannedAnswer'][_0x5fc2('0x56')](_0x58c9ba[_0x5fc2('0x57')]);}})[_0x5fc2('0x20')](respondWithResult(_0xe15e41,null))[_0x5fc2('0x2a')](handleError(_0xe15e41,null));};exports['getAnswers']=function(_0x3751a1,_0x5e72a4,_0xa4de88){var _0x15f3ae={'raw':![],'where':{}};var _0x1a71e4={};var _0x17a0d3={'count':0x0,'rows':[]};return db[_0x5fc2('0x3b')][_0x5fc2('0x60')]({'where':{'id':_0x3751a1[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x5e72a4,null))[_0x5fc2('0x20')](function(_0xa43ce0){if(_0xa43ce0){_0x1a71e4['model']=_[_0x5fc2('0x61')](db[_0x5fc2('0x68')]['rawAttributes']);_0x1a71e4['query']=_[_0x5fc2('0x61')](_0x3751a1['query']);_0x1a71e4['filters']=_['intersection'](_0x1a71e4['model'],_0x1a71e4[_0x5fc2('0x40')]);_0x15f3ae[_0x5fc2('0x42')]=_[_0x5fc2('0x43')](_0x1a71e4[_0x5fc2('0x3f')],qs[_0x5fc2('0x44')](_0x3751a1['query'][_0x5fc2('0x44')]));_0x15f3ae['attributes']=_0x15f3ae[_0x5fc2('0x42')]['length']?_0x15f3ae['attributes']:_0x1a71e4[_0x5fc2('0x3f')];if(!_0x3751a1[_0x5fc2('0x40')]['hasOwnProperty'](_0x5fc2('0x46'))){_0x15f3ae[_0x5fc2('0x30')]=qs[_0x5fc2('0x30')](_0x3751a1['query'][_0x5fc2('0x30')]);_0x15f3ae[_0x5fc2('0x2e')]=qs[_0x5fc2('0x2e')](_0x3751a1[_0x5fc2('0x40')][_0x5fc2('0x2e')]);}_0x15f3ae['order']=qs[_0x5fc2('0x48')](_0x3751a1['query'][_0x5fc2('0x48')]);_0x15f3ae[_0x5fc2('0x4b')]=qs['filters'](_[_0x5fc2('0x49')](_0x3751a1['query'],_0x1a71e4['filters']));_0x15f3ae[_0x5fc2('0x4b')][_0x5fc2('0x64')]=_0xa43ce0['id'];if(_0x3751a1['query'][_0x5fc2('0x4a')]){_0x15f3ae[_0x5fc2('0x4b')]=_[_0x5fc2('0x4c')](_0x15f3ae[_0x5fc2('0x4b')],{'$or':_[_0x5fc2('0x4d')](_0x15f3ae['attributes'],function(_0x5ed944){var _0x348bf0={};_0x348bf0[_0x5ed944]={'$like':'%'+_0x3751a1[_0x5fc2('0x40')][_0x5fc2('0x4a')]+'%'};return _0x348bf0;})});}_0x15f3ae=_[_0x5fc2('0x4c')]({},_0x15f3ae,_0x3751a1['options']);return db['CannedAnswer']['count']({'where':_0x15f3ae[_0x5fc2('0x4b')]})[_0x5fc2('0x20')](function(_0x73f563){_0x17a0d3[_0x5fc2('0x4f')]=_0x73f563;if(_0x3751a1['query'][_0x5fc2('0x50')]){_0x15f3ae[_0x5fc2('0x54')]=[{'all':!![]}];}return db[_0x5fc2('0x68')]['findAll'](_0x15f3ae);})[_0x5fc2('0x20')](function(_0x23547f){_0x17a0d3[_0x5fc2('0x52')]=_0x23547f;return _0x17a0d3;});}})[_0x5fc2('0x20')](respondWithFilteredResult(_0x5e72a4,_0x15f3ae))[_0x5fc2('0x2a')](handleError(_0x5e72a4,null));};exports[_0x5fc2('0x69')]=function(_0x21b2b3,_0x47af2c,_0x2c4492){return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x21b2b3[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x47af2c,null))[_0x5fc2('0x20')](function(_0x181649){if(_0x181649){return _0x181649['removeAnswers'](_0x21b2b3[_0x5fc2('0x40')][_0x5fc2('0x66')]);}})[_0x5fc2('0x20')](respondWithStatusCode(_0x47af2c,null))[_0x5fc2('0x2a')](handleError(_0x47af2c,null));};exports['addAgents']=function(_0x26c9c4,_0x4fd932,_0x3a9723){return db[_0x5fc2('0x3b')]['find']({'where':{'id':_0x26c9c4['params']['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x4fd932,null))[_0x5fc2('0x20')](function(_0x2aa0d7){if(_0x2aa0d7){return _0x2aa0d7[_0x5fc2('0x6a')](_0x26c9c4[_0x5fc2('0x57')][_0x5fc2('0x66')],_['omit'](_0x26c9c4[_0x5fc2('0x57')],[_0x5fc2('0x66'),'id'])||{})[_0x5fc2('0x6b')](function(_0x5a40cc){for(var _0x20bd3b=0x0;_0x20bd3b<_0x26c9c4['body'][_0x5fc2('0x66')][_0x5fc2('0x45')];_0x20bd3b+=0x1){socket[_0x5fc2('0x6c')](_0x5fc2('0x6d'),{'UserId':Number(_0x26c9c4['body']['ids'][_0x20bd3b]),'WhatsappAccountId':Number(_0x26c9c4['params']['id'])});}return _0x5a40cc;});}})[_0x5fc2('0x20')](respondWithResult(_0x4fd932,null))[_0x5fc2('0x2a')](handleError(_0x4fd932,null));};exports[_0x5fc2('0x6e')]=function(_0x2c19c5,_0x4371b,_0x3a4213){return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x2c19c5[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x4371b,null))[_0x5fc2('0x20')](function(_0x1d6f0f){if(_0x1d6f0f){return _0x1d6f0f['removeAgents'](_0x2c19c5['query'][_0x5fc2('0x66')])[_0x5fc2('0x20')](function(){if(_['isArray'](_0x2c19c5[_0x5fc2('0x40')]['ids'])){for(var _0x338b67=0x0;_0x338b67<_0x2c19c5[_0x5fc2('0x40')]['ids'][_0x5fc2('0x45')];_0x338b67+=0x1){socket[_0x5fc2('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x2c19c5[_0x5fc2('0x40')][_0x5fc2('0x66')][_0x338b67]),'WhatsappAccountId':Number(_0x2c19c5['params']['id'])});}}else{socket[_0x5fc2('0x6c')](_0x5fc2('0x6f'),{'UserId':Number(_0x2c19c5[_0x5fc2('0x40')][_0x5fc2('0x66')]),'WhatsappAccountId':Number(_0x2c19c5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4371b,null))[_0x5fc2('0x2a')](handleError(_0x4371b,null));};exports[_0x5fc2('0x70')]=function(_0x229143,_0x3d38c2,_0x4151c2){var _0x3e23e7={};var _0x2fb567={};var _0x4d31fc;var _0x49f0f0;return db[_0x5fc2('0x3b')][_0x5fc2('0x60')]({'where':{'id':_0x229143[_0x5fc2('0x5e')]['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x3d38c2,null))[_0x5fc2('0x20')](function(_0x1b3b71){if(_0x1b3b71){_0x4d31fc=_0x1b3b71;_0x2fb567['model']=_[_0x5fc2('0x61')](db['User'][_0x5fc2('0x3c')]);_0x2fb567[_0x5fc2('0x40')]=_[_0x5fc2('0x61')](_0x229143[_0x5fc2('0x40')]);_0x2fb567[_0x5fc2('0x41')]=_[_0x5fc2('0x43')](_0x2fb567[_0x5fc2('0x3f')],_0x2fb567[_0x5fc2('0x40')]);_0x3e23e7[_0x5fc2('0x42')]=_[_0x5fc2('0x43')](_0x2fb567['model'],qs[_0x5fc2('0x44')](_0x229143[_0x5fc2('0x40')][_0x5fc2('0x44')]));_0x3e23e7[_0x5fc2('0x42')]=_0x3e23e7['attributes']['length']?_0x3e23e7[_0x5fc2('0x42')]:_0x2fb567['model'];_0x3e23e7[_0x5fc2('0x47')]=qs[_0x5fc2('0x48')](_0x229143[_0x5fc2('0x40')]['sort']);_0x3e23e7[_0x5fc2('0x4b')]=qs['filters'](_['pick'](_0x229143['query'],_0x2fb567['filters']));if(_0x229143[_0x5fc2('0x40')][_0x5fc2('0x4a')]){_0x3e23e7[_0x5fc2('0x4b')]=_[_0x5fc2('0x4c')](_0x3e23e7[_0x5fc2('0x4b')],{'$or':_[_0x5fc2('0x4d')](_0x3e23e7['attributes'],function(_0x3ac4fb){var _0x4d91ab={};_0x4d91ab[_0x3ac4fb]={'$like':'%'+_0x229143['query'][_0x5fc2('0x4a')]+'%'};return _0x4d91ab;})});}_0x3e23e7=_[_0x5fc2('0x4c')]({},_0x3e23e7,_0x229143[_0x5fc2('0x55')]);return _0x4d31fc[_0x5fc2('0x70')](_0x3e23e7);}})[_0x5fc2('0x20')](function(_0x21e6d5){if(_0x21e6d5){_0x49f0f0=_0x21e6d5[_0x5fc2('0x45')];if(!_0x229143[_0x5fc2('0x40')][_0x5fc2('0x63')](_0x5fc2('0x46'))){_0x3e23e7['limit']=qs[_0x5fc2('0x30')](_0x229143[_0x5fc2('0x40')]['limit']);_0x3e23e7['offset']=qs[_0x5fc2('0x2e')](_0x229143[_0x5fc2('0x40')]['offset']);}return _0x4d31fc['getAgents'](_0x3e23e7);}})[_0x5fc2('0x20')](function(_0x33f579){if(_0x33f579){return _0x33f579?{'count':_0x49f0f0,'rows':_0x33f579}:null;}})['then'](respondWithResult(_0x3d38c2,null))[_0x5fc2('0x2a')](handleError(_0x3d38c2,null));};exports['addApplications']=function(_0x1edddd,_0x1c768c){var _0x3b9d2=_0x1edddd['params']['id'];var _0x5eea26=_0x1edddd[_0x5fc2('0x57')];var _0x4f11ba=0xc8;var _0x7499ac=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x5fc2('0x71')]},function(_0x1e0e03){return db['WhatsappAccount'][_0x5fc2('0x60')]({'where':{'id':_0x3b9d2},'transaction':_0x1e0e03})[_0x5fc2('0x20')](function(_0x30efe5){if(_0x30efe5){return db['WhatsappApplication'][_0x5fc2('0x35')]({'where':{'WhatsappAccountId':_0x3b9d2},'transaction':_0x1e0e03})[_0x5fc2('0x20')](function(){var _0x2bb9fc=_['map'](_0x5eea26,function(_0x2a45e5){_0x2a45e5[_0x5fc2('0x64')]=_0x3b9d2;return _0x2a45e5;});return db['WhatsappApplication'][_0x5fc2('0x72')](_0x2bb9fc,{'transaction':_0x1e0e03});});}else{_0x4f11ba=0x194;_0x7499ac=[];}});})[_0x5fc2('0x20')](function(){if(_0x4f11ba!==0x194){return db[_0x5fc2('0x73')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3b9d2},'order':_0x5fc2('0x74')})['then'](function(_0x3a071d){_0x7499ac=_0x3a071d;});}})[_0x5fc2('0x2a')](function(_0x46b6ad){_0x4f11ba=0x1f4;logger[_0x5fc2('0x25')](_0x46b6ad[_0x5fc2('0x37')]);if(_0x46b6ad[_0x5fc2('0x38')]){delete _0x46b6ad[_0x5fc2('0x38')];}_0x7499ac=_0x46b6ad;})[_0x5fc2('0x75')](function(){if(_0x7499ac===null){_0x1c768c[_0x5fc2('0x2b')](_0x4f11ba);}else{if(_0x4f11ba===0x1f4){_0x1c768c[_0x5fc2('0x2c')](_0x4f11ba)['send'](_0x7499ac);}else{_0x1c768c['status'](_0x4f11ba)[_0x5fc2('0x2d')](_0x7499ac);}}});};exports[_0x5fc2('0x76')]=function(_0x435065,_0x484577,_0x36036b){var _0x227cb6={};var _0x53359={};var _0x47f7c4;var _0x26fdcd;return db[_0x5fc2('0x3b')][_0x5fc2('0x60')]({'where':{'id':_0x435065['params']['id']}})[_0x5fc2('0x20')](handleEntityNotFound(_0x484577,null))[_0x5fc2('0x20')](function(_0x34a149){if(_0x34a149){_0x47f7c4=_0x34a149;_0x53359[_0x5fc2('0x3f')]=_[_0x5fc2('0x61')](db['WhatsappApplication'][_0x5fc2('0x3c')]);_0x53359[_0x5fc2('0x40')]=_['keys'](_0x435065['query']);_0x53359[_0x5fc2('0x41')]=_[_0x5fc2('0x43')](_0x53359[_0x5fc2('0x3f')],_0x53359[_0x5fc2('0x40')]);_0x227cb6['attributes']=_[_0x5fc2('0x43')](_0x53359['model'],qs[_0x5fc2('0x44')](_0x435065[_0x5fc2('0x40')][_0x5fc2('0x44')]));_0x227cb6[_0x5fc2('0x42')]=_0x227cb6[_0x5fc2('0x42')][_0x5fc2('0x45')]?_0x227cb6[_0x5fc2('0x42')]:_0x53359[_0x5fc2('0x3f')];_0x227cb6[_0x5fc2('0x47')]=qs[_0x5fc2('0x48')](_0x435065[_0x5fc2('0x40')][_0x5fc2('0x48')]);_0x227cb6[_0x5fc2('0x4b')]=qs['filters'](_['pick'](_0x435065[_0x5fc2('0x40')],_0x53359[_0x5fc2('0x41')]));if(_0x435065[_0x5fc2('0x40')][_0x5fc2('0x4a')]){_0x227cb6[_0x5fc2('0x4b')]=_[_0x5fc2('0x4c')](_0x227cb6[_0x5fc2('0x4b')],{'$or':_[_0x5fc2('0x4d')](_0x227cb6[_0x5fc2('0x42')],function(_0x28f270){var _0x3fca2a={};_0x3fca2a[_0x28f270]={'$like':'%'+_0x435065[_0x5fc2('0x40')][_0x5fc2('0x4a')]+'%'};return _0x3fca2a;})});}_0x227cb6=_[_0x5fc2('0x4c')]({},_0x227cb6,_0x435065[_0x5fc2('0x55')]);return _0x47f7c4[_0x5fc2('0x76')](_0x227cb6);}})['then'](function(_0x38aab2){if(_0x38aab2){_0x26fdcd=_0x38aab2['length'];if(!_0x435065['query'][_0x5fc2('0x63')](_0x5fc2('0x46'))){_0x227cb6[_0x5fc2('0x30')]=qs['limit'](_0x435065[_0x5fc2('0x40')][_0x5fc2('0x30')]);_0x227cb6[_0x5fc2('0x2e')]=qs['offset'](_0x435065[_0x5fc2('0x40')][_0x5fc2('0x2e')]);}return _0x47f7c4[_0x5fc2('0x76')](_0x227cb6);}})['then'](function(_0x2bafe8){if(_0x2bafe8){return _0x2bafe8?{'count':_0x26fdcd,'rows':_0x2bafe8}:null;}})[_0x5fc2('0x20')](respondWithResult(_0x484577,null))[_0x5fc2('0x2a')](handleError(_0x484577,null));};exports['notify']=function(_0x20a843,_0x3db135,_0x126fc9){var _0x4f13ca={'channel':'whatsapp'};var _0x9fa416=[];var _0x181c43=[];var _0x3f80b6={};return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x20a843[_0x5fc2('0x5e')]['id']},'include':[{'model':db[_0x5fc2('0x73')],'as':_0x5fc2('0x77')}]})['then'](handleEntityNotFound(_0x3db135,null))[_0x5fc2('0x20')](function(_0x4e2713){_0x4f13ca[_0x5fc2('0x78')]=_0x4e2713;if(_0x4f13ca[_0x5fc2('0x78')]&&_0x4f13ca[_0x5fc2('0x78')]['type']===_0x5fc2('0x79')&&_0x20a843[_0x5fc2('0x57')][_0x5fc2('0x7a')]){if(_0x20a843[_0x5fc2('0x57')][_0x5fc2('0x7a')][_0x5fc2('0x45')]===0x0)return;if(_0x20a843[_0x5fc2('0x57')]['statuses'][0x0][_0x5fc2('0x7b')]!==_0x5fc2('0x7c'))return;return db[_0x5fc2('0x7d')]['update']({'read':!![],'readAt':_0x20a843[_0x5fc2('0x57')][_0x5fc2('0x7a')][0x0]['timestamp']},{'where':{'messageId':_0x20a843['body'][_0x5fc2('0x7a')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x3b6a56){return _0x3db135[_0x5fc2('0x2c')](0xc8)[_0x5fc2('0x2d')](_0x3b6a56);});}_0x4f13ca[_0x5fc2('0x7e')]=_[_0x5fc2('0x7f')](_0x4e2713[_0x5fc2('0x77')],[_0x5fc2('0x74')],[_0x5fc2('0x80')]);if(_0x4f13ca[_0x5fc2('0x78')][_0x5fc2('0x77')]){delete _0x4f13ca['account'][_0x5fc2('0x77')];}return db[_0x5fc2('0x81')]['describe']()['then'](function(_0x3a7e4f){if(!_0x3a7e4f){throw new db[(_0x5fc2('0x82'))][(_0x5fc2('0x83'))]('no\x20available\x20attributes');}_0x9fa416=_['difference'](_[_0x5fc2('0x61')](_0x3a7e4f),['createdAt',_0x5fc2('0x84')]);_0x181c43=_[_0x5fc2('0x85')](_['keys'](_0x3a7e4f),[_0x5fc2('0x86'),_0x5fc2('0x84'),_0x5fc2('0x87'),_0x5fc2('0x88')]);_0x4f13ca['body']={'mapKey':_0x5fc2('0x89')};if(_0x4f13ca[_0x5fc2('0x78')]&&_0x4f13ca[_0x5fc2('0x78')]['type']===_0x5fc2('0x8a')){_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x8b')]=_0x20a843[_0x5fc2('0x57')][_0x5fc2('0x8c')][_0x5fc2('0x8d')](_0x5fc2('0x8e'),'');_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x57')]=_0x20a843['body'][_0x5fc2('0x8f')];_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x90')]=_0x20a843[_0x5fc2('0x57')]['MessageSid'];}if(_0x4f13ca['account']&&_0x4f13ca[_0x5fc2('0x78')][_0x5fc2('0x3e')]==='sinch'){_0x4f13ca['body'][_0x5fc2('0x8b')]=_0x20a843[_0x5fc2('0x57')]['notifications'][0x0][_0x5fc2('0x8b')];_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x57')]=_0x20a843['body']['notifications'][0x0]['message'][_0x5fc2('0x57')];_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x90')]=_0x20a843[_0x5fc2('0x57')][_0x5fc2('0x91')][0x0]['message_id'];}if(_0x4f13ca[_0x5fc2('0x57')]['id']){delete _0x4f13ca[_0x5fc2('0x57')]['id'];}if(_[_0x5fc2('0x92')](_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x8b')])){throw new db[(_0x5fc2('0x82'))][(_0x5fc2('0x83'))](_0x5fc2('0x93'));}if(_['isNil'](_0x4f13ca[_0x5fc2('0x57')]['body'])||_0x4f13ca[_0x5fc2('0x57')]['body']===''){throw new db[(_0x5fc2('0x82'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x94')])){throw new db[(_0x5fc2('0x82'))]['ValidationError'](_0x5fc2('0x95')+_0x181c43);}if(!_[_0x5fc2('0x96')](_0x181c43,_0x4f13ca['body'][_0x5fc2('0x94')])){throw new db[(_0x5fc2('0x82'))]['ValidationError'](_0x5fc2('0x97')+_0x181c43);}_0x3f80b6[_0x4f13ca[_0x5fc2('0x57')]['mapKey']]=_0x4f13ca[_0x5fc2('0x57')]['from'];return db[_0x5fc2('0x98')][_0x5fc2('0x5b')]({'where':{'id':_0x4f13ca[_0x5fc2('0x78')][_0x5fc2('0x88')]},'include':[{'model':db['CmContact'],'as':_0x5fc2('0x99'),'where':_0x3f80b6,'limit':0x1,'order':[[_0x5fc2('0x84'),'DESC']]}]});})[_0x5fc2('0x20')](handleEntityNotFound(_0x3db135,null))[_0x5fc2('0x20')](function(_0x3119e1){if(_0x3119e1){_0x4f13ca['list']=_[_0x5fc2('0x9a')](_0x3119e1,[_0x5fc2('0x99')]);if(_0x3119e1[_0x5fc2('0x99')][_0x5fc2('0x45')]){return _0x3119e1[_0x5fc2('0x99')][0x0];}var _0x51c90d=_[_0x5fc2('0x9b')](_0x4f13ca[_0x5fc2('0x57')],{'firstName':_0x4f13ca['body']['from'],'ListId':_0x3119e1['id']});_0x51c90d[_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x94')]]=_0x4f13ca[_0x5fc2('0x57')]['from'];return db[_0x5fc2('0x81')]['create'](_0x51c90d,{'fields':_0x9fa416,'raw':!![]});}})[_0x5fc2('0x20')](handleEntityNotFound(_0x3db135,null))['then'](function(_0x1a0964){if(_0x1a0964){_0x4f13ca[_0x5fc2('0x9c')]=_0x1a0964;var _0x3e7d90={'ContactId':_0x1a0964['id'],'phone':_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x8b')],'WhatsappAccountId':_0x20a843[_0x5fc2('0x5e')]['id']};var _0x2fa6d3={'ContactId':_0x1a0964['id'],'WhatsappAccountId':_0x20a843[_0x5fc2('0x5e')]['id'],'closed':![]};return db[_0x5fc2('0x9d')][_0x5fc2('0x5b')]({'where':_0x2fa6d3})[_0x5fc2('0x20')](function(_0xaf34ba){if(_0xaf34ba){return[_0xaf34ba,![]];}return db[_0x5fc2('0x9d')]['create'](_0x3e7d90)[_0x5fc2('0x20')](function(_0x2797bf){return[_0x2797bf,!![]];});});}})[_0x5fc2('0x6b')](function(_0x1489c5,_0x161d56){_0x4f13ca[_0x5fc2('0x9e')]=_0x1489c5[_0x5fc2('0x5a')]({'plain':!![]});_0x4f13ca['interaction'][_0x5fc2('0x9f')]=![];if(_0x161d56){if(_0x4f13ca[_0x5fc2('0x78')][_0x5fc2('0xa0')]){_0x4f13ca['applications'][_0x5fc2('0xa1')]({'id':0x0,'priority':_0x4f13ca[_0x5fc2('0x7e')]['length']+0x1,'app':'close','appdata':_0x5fc2('0xa2'),'interval':_0x5fc2('0xa3')});}_0x4f13ca[_0x5fc2('0x9e')][_0x5fc2('0x9f')]=!![];}return db[_0x5fc2('0x7d')][_0x5fc2('0x56')]({'phone':_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0x8b')],'messageId':_0x4f13ca['body'][_0x5fc2('0x90')],'body':_0x4f13ca['body']['body'],'WhatsappAccountId':_0x20a843[_0x5fc2('0x5e')]['id'],'WhatsappInteractionId':_0x1489c5['id'],'direction':'in','ContactId':_0x1489c5[_0x5fc2('0xa4')],'AttachmentId':_0x4f13ca[_0x5fc2('0x57')][_0x5fc2('0xa5')]});})[_0x5fc2('0x20')](function(_0x510f4c){_0x4f13ca[_0x5fc2('0x27')]=_0x510f4c;if(!_0x4f13ca[_0x5fc2('0x9e')][_0x5fc2('0xa6')])return;return db['User'][_0x5fc2('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4f13ca[_0x5fc2('0x9e')]['UserId']}});})['then'](function(_0x28695b){if(_0x28695b){_0x4f13ca[_0x5fc2('0x7e')][_0x5fc2('0xa7')]({'id':0x0,'priority':0x0,'app':_0x5fc2('0xa8'),'appdata':_0x28695b[_0x5fc2('0x38')]+','+(_0x4f13ca['account'][_0x5fc2('0xa9')]||0xa),'interval':_0x5fc2('0xa3')});}if(!_0x4f13ca[_0x5fc2('0x9e')][_0x5fc2('0xaa')])return;return db[_0x5fc2('0xab')][_0x5fc2('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4f13ca[_0x5fc2('0x9e')][_0x5fc2('0xaa')]}});})['then'](function(_0x12f668){if(_0x12f668){_0x4f13ca[_0x5fc2('0x7e')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12f668['name']+','+(_0x4f13ca[_0x5fc2('0x78')][_0x5fc2('0xac')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x5fc2('0xad'),_0x4f13ca);})[_0x5fc2('0x20')](function(_0x954b75){if(_0x954b75){var _0x1c781c=0xc8;var _0x2d0b55=_0x5fc2('0xae');logger[_0x5fc2('0x28')](_0x5fc2('0x24'),_0x2d0b55,_0x1c781c,_0x5fc2('0xaf'));logger[_0x5fc2('0x23')](_0x5fc2('0xb0'),_0x2d0b55,_0x1c781c,'entity\x20found',JSON[_0x5fc2('0xb1')](_0x954b75));if(_0x4f13ca[_0x5fc2('0x78')]['type']==='twilio'){return _0x3db135[_0x5fc2('0x2c')](_0x1c781c)['set'](_0x5fc2('0xb2'),_0x5fc2('0xb3'))[_0x5fc2('0xb4')](_0x5fc2('0xb5'));}else{return _0x3db135[_0x5fc2('0x2c')](_0x1c781c)[_0x5fc2('0x2d')](_0x954b75);}}});})[_0x5fc2('0x2a')](handleError(_0x3db135,null));};exports[_0x5fc2('0xb4')]=function(_0x56b7c9,_0x4f19af,_0x4be135){var _0x408c24,_0xb84b26,_0x2b9de1;if(_[_0x5fc2('0x92')](_0x56b7c9['body'][_0x5fc2('0x57')])||_0x56b7c9[_0x5fc2('0x57')]['body']===''){throw new db[(_0x5fc2('0x82'))]['ValidationError'](_0x5fc2('0xb6'));}if(_[_0x5fc2('0x92')](_0x56b7c9[_0x5fc2('0x57')]['to'])){throw new db[(_0x5fc2('0x82'))][(_0x5fc2('0x83'))](_0x5fc2('0xb7'));}_0x408c24=_0x56b7c9[_0x5fc2('0x57')]['to'];return db[_0x5fc2('0x3b')][_0x5fc2('0x5b')]({'where':{'id':_0x56b7c9[_0x5fc2('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x5fc2('0xb8'),'include':[{'model':db[_0x5fc2('0x81')],'as':'Contacts','where':{'mobile':_0x408c24},'limit':0x1,'order':[[_0x5fc2('0x84'),_0x5fc2('0xb9')]]}]}]})[_0x5fc2('0x20')](handleEntityNotFound(_0x4f19af,null))['then'](function(_0x501aff){if(_0x501aff&&_0x501aff[_0x5fc2('0xb8')]){_0xb84b26=_0x501aff['get']({'plain':!![]});if(_0xb84b26[_0x5fc2('0xb8')]&&_0xb84b26[_0x5fc2('0xb8')]['Contacts'][_0x5fc2('0x45')]){return _0xb84b26[_0x5fc2('0xb8')]['Contacts'][0x0];}return db[_0x5fc2('0x81')][_0x5fc2('0x56')](_[_0x5fc2('0x9b')](_0x56b7c9[_0x5fc2('0x57')],{'firstName':_0x408c24,'mobile':_0x408c24,'phone':_0x408c24,'ListId':_0xb84b26[_0x5fc2('0x88')]}));}})[_0x5fc2('0x20')](handleEntityNotFound(_0x4f19af,null))['then'](function(_0x56b039){if(_0x56b039){_0x2b9de1=_0x56b039;return db[_0x5fc2('0x9d')][_0x5fc2('0x5b')]({'where':{'ContactId':_0x2b9de1['id'],'closed':![],'WhatsappAccountId':_0xb84b26['id']}})[_0x5fc2('0x20')](function(_0x19a116){if(_0x19a116){return[_0x19a116,![]];}return db[_0x5fc2('0x9d')][_0x5fc2('0x56')]({'UserId':_0x56b7c9[_0x5fc2('0x58')]['id'],'ContactId':_0x2b9de1['id'],'WhatsappAccountId':_0xb84b26['id'],'phone':_0x408c24,'firstMsgDirection':_0x5fc2('0xba'),'Messages':[_[_0x5fc2('0x4c')](_0x56b7c9['body'],{'read':![],'body':_0x56b7c9[_0x5fc2('0x57')][_0x5fc2('0x57')],'phone':_0x408c24,'WhatsappAccountId':_0xb84b26['id'],'UserId':_0x56b7c9[_0x5fc2('0x58')]['id'],'ContactId':_0x2b9de1['id']})]},{'include':[{'model':db[_0x5fc2('0x7d')],'as':_0x5fc2('0xbb')}]})[_0x5fc2('0x20')](function(_0x268521){return[_0x268521,!![]];});});}})[_0x5fc2('0x6b')](function(_0x495671,_0x4df7d7){if(_0x4df7d7){return _0x495671;}return db['WhatsappMessage'][_0x5fc2('0x56')](_[_0x5fc2('0x4c')](_0x56b7c9[_0x5fc2('0x57')],{'read':![],'body':_0x56b7c9[_0x5fc2('0x57')][_0x5fc2('0x57')],'phone':_0x408c24,'WhatsappAccountId':_0xb84b26['id'],'WhatsappInteractionId':_0x495671['id'],'UserId':_0x56b7c9[_0x5fc2('0x58')]['id'],'ContactId':_0x2b9de1['id']}))[_0x5fc2('0x20')](function(_0x538803){_0x495671[_0x5fc2('0xbc')]['Messages']=[];_0x495671['dataValues'][_0x5fc2('0xbb')]['push'](_0x538803[_0x5fc2('0xbc')]);return _0x495671;});})[_0x5fc2('0x20')](respondWithResult(_0x4f19af,null))[_0x5fc2('0x2a')](handleError(_0x4f19af,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e1f3bd9..1098930 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 _0x9277=['events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x94db91,_0x9549f2){var _0x481783=function(_0x4d6343){while(--_0x4d6343){_0x94db91['push'](_0x94db91['shift']());}};_0x481783(++_0x9549f2);}(_0x9277,0x110));var _0x7927=function(_0x5a7188,_0x2ec5ad){_0x5a7188=_0x5a7188-0x0;var _0x805ef=_0x9277[_0x5a7188];return _0x805ef;};'use strict';var EventEmitter=require(_0x7927('0x0'));var WhatsappAccount=require(_0x7927('0x1'))['db'][_0x7927('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7927('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7927('0x4')};function emitEvent(_0x24b3eb){return function(_0xe86455,_0x37e5e7,_0x1e8bf8){WhatsappAccountEvents['emit'](_0x24b3eb+':'+_0xe86455['id'],_0xe86455);WhatsappAccountEvents[_0x7927('0x5')](_0x24b3eb,_0xe86455);_0x1e8bf8(null);};}for(var e in events){if(events[_0x7927('0x6')](e)){var event=events[e];WhatsappAccount[_0x7927('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x3275=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x2db74b,_0x31aa33){var _0x3f56c9=function(_0x3c6057){while(--_0x3c6057){_0x2db74b['push'](_0x2db74b['shift']());}};_0x3f56c9(++_0x31aa33);}(_0x3275,0xf9));var _0x5327=function(_0x543aad,_0xfcdc21){_0x543aad=_0x543aad-0x0;var _0x2593d8=_0x3275[_0x543aad];return _0x2593d8;};'use strict';var EventEmitter=require(_0x5327('0x0'));var WhatsappAccount=require(_0x5327('0x1'))['db'][_0x5327('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5327('0x3')](0x0);var events={'afterCreate':_0x5327('0x4'),'afterUpdate':_0x5327('0x5'),'afterDestroy':_0x5327('0x6')};function emitEvent(_0x193ec5){return function(_0x578d11,_0x40331f,_0x149d59){WhatsappAccountEvents[_0x5327('0x7')](_0x193ec5+':'+_0x578d11['id'],_0x578d11);WhatsappAccountEvents['emit'](_0x193ec5,_0x578d11);_0x149d59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5327('0x8')](e,emitEvent(event));}}module[_0x5327('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 9e86732..6e00177 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 _0x98a6=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1966eb,_0x5a5a16){var _0x4b6220=function(_0x2cff24){while(--_0x2cff24){_0x1966eb['push'](_0x1966eb['shift']());}};_0x4b6220(++_0x5a5a16);}(_0x98a6,0x195));var _0x698a=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x98a6[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x698a('0x0'));var util=require(_0x698a('0x1'));var logger=require(_0x698a('0x2'))(_0x698a('0x3'));var moment=require(_0x698a('0x4'));var BPromise=require(_0x698a('0x5'));var rp=require(_0x698a('0x6'));var fs=require('fs');var path=require(_0x698a('0x7'));var rimraf=require(_0x698a('0x8'));var config=require(_0x698a('0x9'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x191a8d,_0x22ddbc){return _0x191a8d[_0x698a('0xa')](_0x698a('0xb'),attributes,{'tableName':_0x698a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x960c=['exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x206b6e,_0x29ec1d){var _0x206322=function(_0x91d1bf){while(--_0x91d1bf){_0x206b6e['push'](_0x206b6e['shift']());}};_0x206322(++_0x29ec1d);}(_0x960c,0xc3));var _0xc960=function(_0x37cfcf,_0x54450e){_0x37cfcf=_0x37cfcf-0x0;var _0x17057e=_0x960c[_0x37cfcf];return _0x17057e;};'use strict';var _=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var logger=require(_0xc960('0x2'))(_0xc960('0x3'));var moment=require(_0xc960('0x4'));var BPromise=require(_0xc960('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc960('0x6'));var rimraf=require('rimraf');var config=require(_0xc960('0x7'));var attributes=require(_0xc960('0x8'));module[_0xc960('0x9')]=function(_0x528d75,_0x2841af){return _0x528d75[_0xc960('0xa')]('WhatsappAccount',attributes,{'tableName':_0xc960('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 05c116a..e325ab2 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 _0x88b5=['options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x22b61b,_0x1de239){var _0x437ce8=function(_0x1b9cdb){while(--_0x1b9cdb){_0x22b61b['push'](_0x22b61b['shift']());}};_0x437ce8(++_0x1de239);}(_0x88b5,0x167));var _0x588b=function(_0x4ec51e,_0x2ce800){_0x4ec51e=_0x4ec51e-0x0;var _0x148029=_0x88b5[_0x4ec51e];return _0x148029;};'use strict';var _=require(_0x588b('0x0'));var util=require(_0x588b('0x1'));var moment=require(_0x588b('0x2'));var BPromise=require(_0x588b('0x3'));var rs=require(_0x588b('0x4'));var fs=require('fs');var Redis=require(_0x588b('0x5'));var db=require(_0x588b('0x6'))['db'];var utils=require(_0x588b('0x7'));var logger=require(_0x588b('0x8'))(_0x588b('0x9'));var config=require(_0x588b('0xa'));var jayson=require(_0x588b('0xb'));var client=jayson[_0x588b('0xc')]['http']({'port':0x232a});config[_0x588b('0xd')]=_[_0x588b('0xe')](config[_0x588b('0xd')],{'host':_0x588b('0xf'),'port':0x18eb});var socket=require(_0x588b('0x10'))(new Redis(config[_0x588b('0xd')]));require(_0x588b('0x11'))['register'](socket);function respondWithRpcPromise(_0x17ade2,_0x875406,_0x15db9c){return new BPromise(function(_0x2423ab,_0xb28e92){return client['request'](_0x17ade2,_0x15db9c)[_0x588b('0x12')](function(_0xd858c9){logger['info'](_0x588b('0x13'),_0x875406,_0x588b('0x14'));logger[_0x588b('0x15')](_0x588b('0x16'),_0x875406,_0x588b('0x14'),JSON['stringify'](_0xd858c9));if(_0xd858c9[_0x588b('0x17')]){if(_0xd858c9[_0x588b('0x17')][_0x588b('0x18')]===0x1f4){logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0xd858c9['error'][_0x588b('0x19')]);return _0xb28e92(_0xd858c9['error'][_0x588b('0x19')]);}logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0xd858c9[_0x588b('0x17')][_0x588b('0x19')]);return _0x2423ab(_0xd858c9['error'][_0x588b('0x19')]);}else{logger[_0x588b('0x1a')](_0x588b('0x13'),_0x875406,_0x588b('0x14'));_0x2423ab(_0xd858c9[_0x588b('0x1b')][_0x588b('0x19')]);}})['catch'](function(_0x556804){logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0x556804);_0xb28e92(_0x556804);});});}exports[_0x588b('0x1c')]=function(_0x5f387c){var _0x15471b=this;return new Promise(function(_0xc0ede9,_0x1dc14a){return db[_0x588b('0x1d')][_0x588b('0x1e')]({'raw':_0x5f387c[_0x588b('0x1f')]?_0x5f387c[_0x588b('0x1f')][_0x588b('0x20')]===undefined?!![]:![]:!![],'where':_0x5f387c[_0x588b('0x1f')]?_0x5f387c[_0x588b('0x1f')][_0x588b('0x21')]||null:null,'attributes':_0x5f387c['options']?_0x5f387c[_0x588b('0x1f')]['attributes']||null:null,'include':_0x5f387c['options']?_0x5f387c['options'][_0x588b('0x22')]?_[_0x588b('0x23')](_0x5f387c[_0x588b('0x1f')][_0x588b('0x22')],function(_0x4e0294){return{'model':db[_0x4e0294[_0x588b('0x24')]],'as':_0x4e0294['as'],'attributes':_0x4e0294['attributes'],'include':_0x4e0294[_0x588b('0x22')]?_[_0x588b('0x23')](_0x4e0294[_0x588b('0x22')],function(_0x59e306){return{'model':db[_0x59e306[_0x588b('0x24')]],'as':_0x59e306['as'],'attributes':_0x59e306[_0x588b('0x25')],'include':_0x59e306[_0x588b('0x22')]?_['map'](_0x59e306[_0x588b('0x22')],function(_0x150c38){return{'model':db[_0x150c38[_0x588b('0x24')]],'as':_0x150c38['as'],'attributes':_0x150c38[_0x588b('0x25')]};}):[]};}):[]};}):[]:[]})[_0x588b('0x12')](function(_0x37f5ae){logger[_0x588b('0x1a')](_0x588b('0x1c'),_0x5f387c);logger[_0x588b('0x15')](_0x588b('0x1c'),_0x5f387c,JSON['stringify'](_0x37f5ae));_0xc0ede9(_0x37f5ae);})[_0x588b('0x26')](function(_0x5b1b08){logger['error'](_0x588b('0x1c'),_0x5b1b08[_0x588b('0x19')],_0x5f387c);_0x1dc14a(_0x15471b[_0x588b('0x17')](0x1f4,_0x5b1b08[_0x588b('0x19')]));});});}; \ No newline at end of file +var _0xcfa5=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','model','map','debug','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x235d80,_0x481eae){var _0x59eed9=function(_0x30a014){while(--_0x30a014){_0x235d80['push'](_0x235d80['shift']());}};_0x59eed9(++_0x481eae);}(_0xcfa5,0xbb));var _0x5cfa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcfa5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5cfa('0x0'));var util=require(_0x5cfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5cfa('0x2'));var logger=require(_0x5cfa('0x3'))(_0x5cfa('0x4'));var config=require(_0x5cfa('0x5'));var jayson=require(_0x5cfa('0x6'));var client=jayson['client'][_0x5cfa('0x7')]({'port':0x232a});config['redis']=_[_0x5cfa('0x8')](config[_0x5cfa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cfa('0xa'))(new Redis(config['redis']));require(_0x5cfa('0xb'))[_0x5cfa('0xc')](socket);function respondWithRpcPromise(_0x52dc8a,_0x5b1c7a,_0x19dea3){return new BPromise(function(_0x1a3bcf,_0x368894){return client['request'](_0x52dc8a,_0x19dea3)[_0x5cfa('0xd')](function(_0x34b1c9){logger[_0x5cfa('0xe')](_0x5cfa('0xf'),_0x5b1c7a,_0x5cfa('0x10'));logger['debug'](_0x5cfa('0x11'),_0x5b1c7a,_0x5cfa('0x10'),JSON[_0x5cfa('0x12')](_0x34b1c9));if(_0x34b1c9['error']){if(_0x34b1c9['error']['code']===0x1f4){logger['error'](_0x5cfa('0xf'),_0x5b1c7a,_0x34b1c9[_0x5cfa('0x13')][_0x5cfa('0x14')]);return _0x368894(_0x34b1c9[_0x5cfa('0x13')][_0x5cfa('0x14')]);}logger[_0x5cfa('0x13')](_0x5cfa('0xf'),_0x5b1c7a,_0x34b1c9[_0x5cfa('0x13')][_0x5cfa('0x14')]);return _0x1a3bcf(_0x34b1c9['error'][_0x5cfa('0x14')]);}else{logger[_0x5cfa('0xe')](_0x5cfa('0xf'),_0x5b1c7a,_0x5cfa('0x10'));_0x1a3bcf(_0x34b1c9[_0x5cfa('0x15')][_0x5cfa('0x14')]);}})[_0x5cfa('0x16')](function(_0x5806fb){logger[_0x5cfa('0x13')](_0x5cfa('0xf'),_0x5b1c7a,_0x5806fb);_0x368894(_0x5806fb);});});}exports[_0x5cfa('0x17')]=function(_0x1ccd6e){var _0xbf5ba6=this;return new Promise(function(_0x46cd72,_0x11a7b3){return db[_0x5cfa('0x18')][_0x5cfa('0x19')]({'raw':_0x1ccd6e['options']?_0x1ccd6e['options'][_0x5cfa('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ccd6e[_0x5cfa('0x1b')]?_0x1ccd6e[_0x5cfa('0x1b')][_0x5cfa('0x1c')]||null:null,'attributes':_0x1ccd6e[_0x5cfa('0x1b')]?_0x1ccd6e[_0x5cfa('0x1b')][_0x5cfa('0x1d')]||null:null,'include':_0x1ccd6e[_0x5cfa('0x1b')]?_0x1ccd6e[_0x5cfa('0x1b')][_0x5cfa('0x1e')]?_['map'](_0x1ccd6e[_0x5cfa('0x1b')][_0x5cfa('0x1e')],function(_0x207a0a){return{'model':db[_0x207a0a[_0x5cfa('0x1f')]],'as':_0x207a0a['as'],'attributes':_0x207a0a[_0x5cfa('0x1d')],'include':_0x207a0a['include']?_[_0x5cfa('0x20')](_0x207a0a[_0x5cfa('0x1e')],function(_0x2484ad){return{'model':db[_0x2484ad[_0x5cfa('0x1f')]],'as':_0x2484ad['as'],'attributes':_0x2484ad[_0x5cfa('0x1d')],'include':_0x2484ad[_0x5cfa('0x1e')]?_[_0x5cfa('0x20')](_0x2484ad[_0x5cfa('0x1e')],function(_0xf36e85){return{'model':db[_0xf36e85[_0x5cfa('0x1f')]],'as':_0xf36e85['as'],'attributes':_0xf36e85[_0x5cfa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5cfa('0xd')](function(_0x1ea1dc){logger[_0x5cfa('0xe')](_0x5cfa('0x17'),_0x1ccd6e);logger[_0x5cfa('0x21')]('ShowWhatsappAccount',_0x1ccd6e,JSON['stringify'](_0x1ea1dc));_0x46cd72(_0x1ea1dc);})[_0x5cfa('0x16')](function(_0x5257e8){logger[_0x5cfa('0x13')](_0x5cfa('0x17'),_0x5257e8[_0x5cfa('0x14')],_0x1ccd6e);_0x11a7b3(_0xbf5ba6['error'](0x1f4,_0x5257e8[_0x5cfa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 97e6dff..f111d9c 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 _0x58e0=['save','emit','removeListener','whatsappAccount:','./whatsappAccount.events'];(function(_0x23e5b5,_0x4d8e1b){var _0x1afbb1=function(_0x51083d){while(--_0x51083d){_0x23e5b5['push'](_0x23e5b5['shift']());}};_0x1afbb1(++_0x4d8e1b);}(_0x58e0,0x11c));var _0x058e=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x58e0[_0x4b7895];return _0x264180;};'use strict';var WhatsappAccountEvents=require(_0x058e('0x0'));var events=[_0x058e('0x1'),'remove','update'];function createListener(_0x1c857b,_0x583c3a){return function(_0x5e487f){_0x583c3a[_0x058e('0x2')](_0x1c857b,_0x5e487f);};}function removeListener(_0xe6a6ac,_0x35c411){return function(){WhatsappAccountEvents[_0x058e('0x3')](_0xe6a6ac,_0x35c411);};}exports['register']=function(_0xcbfc20){for(var _0x66032d=0x0,_0x5d051e=events['length'];_0x66032d<_0x5d051e;_0x66032d++){var _0x2a61e4=events[_0x66032d];var _0x20b800=createListener(_0x058e('0x4')+_0x2a61e4,_0xcbfc20);WhatsappAccountEvents['on'](_0x2a61e4,_0x20b800);}}; \ No newline at end of file +var _0x7d80=['./whatsappAccount.events','save','remove','update','emit','length','whatsappAccount:'];(function(_0x2baf91,_0x2327de){var _0x3117c0=function(_0x1b4770){while(--_0x1b4770){_0x2baf91['push'](_0x2baf91['shift']());}};_0x3117c0(++_0x2327de);}(_0x7d80,0x85));var _0x07d8=function(_0x24f252,_0x592841){_0x24f252=_0x24f252-0x0;var _0x5af865=_0x7d80[_0x24f252];return _0x5af865;};'use strict';var WhatsappAccountEvents=require(_0x07d8('0x0'));var events=[_0x07d8('0x1'),_0x07d8('0x2'),_0x07d8('0x3')];function createListener(_0x44f1e8,_0x41cfb2){return function(_0x1a676d){_0x41cfb2[_0x07d8('0x4')](_0x44f1e8,_0x1a676d);};}function removeListener(_0x598cac,_0x3a4c67){return function(){WhatsappAccountEvents['removeListener'](_0x598cac,_0x3a4c67);};}exports['register']=function(_0x286522){for(var _0x319feb=0x0,_0x47f9dd=events[_0x07d8('0x5')];_0x319feb<_0x47f9dd;_0x319feb++){var _0xf8bdce=events[_0x319feb];var _0x5ecfa2=createListener(_0x07d8('0x6')+_0xf8bdce,_0x286522);WhatsappAccountEvents['on'](_0xf8bdce,_0x5ecfa2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b13a00d..37bd43a 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 _0xc5db=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5bf38a,_0x5a298e){var _0x7f29cd=function(_0x5c7c51){while(--_0x5c7c51){_0x5bf38a['push'](_0x5bf38a['shift']());}};_0x7f29cd(++_0x5a298e);}(_0xc5db,0x188));var _0xbc5d=function(_0x59d84c,_0x5005d2){_0x59d84c=_0x59d84c-0x0;var _0x32ac58=_0xc5db[_0x59d84c];return _0x32ac58;};'use strict';var multer=require(_0xbc5d('0x0'));var util=require(_0xbc5d('0x1'));var path=require(_0xbc5d('0x2'));var timeout=require(_0xbc5d('0x3'));var express=require(_0xbc5d('0x4'));var router=express[_0xbc5d('0x5')]();var fs_extra=require(_0xbc5d('0x6'));var auth=require(_0xbc5d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbc5d('0x8'));var controller=require(_0xbc5d('0x9'));router[_0xbc5d('0xa')]('/',auth[_0xbc5d('0xb')](),controller[_0xbc5d('0xc')]);router[_0xbc5d('0xa')](_0xbc5d('0xd'),auth[_0xbc5d('0xb')](),controller[_0xbc5d('0xe')]);router[_0xbc5d('0xf')]('/',auth[_0xbc5d('0xb')](),controller[_0xbc5d('0x10')]);router[_0xbc5d('0x11')](_0xbc5d('0xd'),auth[_0xbc5d('0xb')](),controller[_0xbc5d('0x12')]);router[_0xbc5d('0x13')](_0xbc5d('0xd'),auth['isAuthenticated'](),controller[_0xbc5d('0x14')]);module[_0xbc5d('0x15')]=router; \ No newline at end of file +var _0x333d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x333d,0x19a));var _0xd333=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x333d[_0x934425];return _0x31d596;};'use strict';var multer=require(_0xd333('0x0'));var util=require(_0xd333('0x1'));var path=require(_0xd333('0x2'));var timeout=require('connect-timeout');var express=require(_0xd333('0x3'));var router=express[_0xd333('0x4')]();var fs_extra=require(_0xd333('0x5'));var auth=require(_0xd333('0x6'));var interaction=require(_0xd333('0x7'));var config=require('../../config/environment');var controller=require(_0xd333('0x8'));router['get']('/',auth[_0xd333('0x9')](),controller[_0xd333('0xa')]);router[_0xd333('0xb')](_0xd333('0xc'),auth[_0xd333('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd333('0xd')]);router[_0xd333('0xe')]('/:id',auth[_0xd333('0x9')](),controller[_0xd333('0xf')]);router[_0xd333('0x10')](_0xd333('0xc'),auth[_0xd333('0x9')](),controller[_0xd333('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5c7e74a..167b5f8 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 _0x9e8d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9e8d,0x184));var _0xd9e8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9e8d[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xd9e8('0x0'));module[_0xd9e8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd9e8('0x2')],'allowNull':![],'defaultValue':_0xd9e8('0x3')},'appdata':{'type':Sequelize[_0xd9e8('0x4')]()},'description':{'type':Sequelize[_0xd9e8('0x2')]},'interval':{'type':Sequelize[_0xd9e8('0x2')],'defaultValue':_0xd9e8('0x5')}}; \ No newline at end of file +var _0x6baf=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0x6baf,0xc3));var _0xf6ba=function(_0x158cc6,_0x366e50){_0x158cc6=_0x158cc6-0x0;var _0x4930dc=_0x6baf[_0x158cc6];return _0x4930dc;};'use strict';var Sequelize=require(_0xf6ba('0x0'));module[_0xf6ba('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf6ba('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf6ba('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf6ba('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4f1ca57..b42bb6a 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 _0x0b78=['WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x17d9fd,_0x4b2b91){var _0x4aa02e=function(_0x757a1f){while(--_0x757a1f){_0x17d9fd['push'](_0x17d9fd['shift']());}};_0x4aa02e(++_0x4b2b91);}(_0x0b78,0x1d6));var _0x80b7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0b78[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80b7('0x0'));var zipdir=require(_0x80b7('0x1'));var jsonpatch=require(_0x80b7('0x2'));var rp=require('request-promise');var moment=require(_0x80b7('0x3'));var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x80b7('0x5'));var csv=require(_0x80b7('0x6'));var ejs=require(_0x80b7('0x7'));var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require(_0x80b7('0x9'));var squel=require(_0x80b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require(_0x80b7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0xe'));var as=require(_0x80b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80b7('0x10'))(_0x80b7('0x11'));var utils=require(_0x80b7('0x12'));var config=require(_0x80b7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac007,_0x1bbe9f){_0x1bbe9f=_0x1bbe9f||0xcc;return function(_0x16976c){if(_0x16976c){return _0x3ac007[_0x80b7('0x14')](_0x1bbe9f);}return _0x3ac007[_0x80b7('0x15')](_0x1bbe9f)[_0x80b7('0x16')]();};}function respondWithResult(_0x3d71a0,_0x32cecc){_0x32cecc=_0x32cecc||0xc8;return function(_0x416d32){if(_0x416d32){return _0x3d71a0['status'](_0x32cecc)['json'](_0x416d32);}};}function respondWithFilteredResult(_0x5c64df,_0x57e428){return function(_0x2c6bff){if(_0x2c6bff){var _0x459f67=typeof _0x57e428[_0x80b7('0x17')]===_0x80b7('0x18')&&typeof _0x57e428[_0x80b7('0x19')]===_0x80b7('0x18');var _0x262cd5=_0x2c6bff[_0x80b7('0x1a')];var _0x22abaa=_0x459f67?0x0:_0x57e428[_0x80b7('0x17')];var _0x25b5e9=_0x459f67?_0x2c6bff[_0x80b7('0x1a')]:_0x57e428[_0x80b7('0x17')]+_0x57e428['limit'];var _0x2165df;if(_0x25b5e9>=_0x262cd5){_0x25b5e9=_0x262cd5;_0x2165df=0xc8;}else{_0x2165df=0xce;}_0x5c64df[_0x80b7('0x15')](_0x2165df);return _0x5c64df[_0x80b7('0x1b')](_0x80b7('0x1c'),_0x22abaa+'-'+_0x25b5e9+'/'+_0x262cd5)[_0x80b7('0x1d')](_0x2c6bff);}return null;};}function patchUpdates(_0x3ebdd6){return function(_0x220133){try{jsonpatch[_0x80b7('0x1e')](_0x220133,_0x3ebdd6,!![]);}catch(_0x3da240){return BPromise[_0x80b7('0x1f')](_0x3da240);}return _0x220133[_0x80b7('0x20')]();};}function saveUpdates(_0x1ef249,_0x53046f){return function(_0x55bf6e){if(_0x55bf6e){return _0x55bf6e[_0x80b7('0x21')](_0x1ef249)[_0x80b7('0x22')](function(_0x158b65){return _0x158b65;});}return null;};}function removeEntity(_0x5e8093,_0x9fccdc){return function(_0x390d8a){if(_0x390d8a){return _0x390d8a[_0x80b7('0x23')]()[_0x80b7('0x22')](function(){_0x5e8093[_0x80b7('0x15')](0xcc)[_0x80b7('0x16')]();});}};}function handleEntityNotFound(_0x44ab49,_0xea1ea0){return function(_0x23a876){if(!_0x23a876){_0x44ab49[_0x80b7('0x14')](0x194);}return _0x23a876;};}function handleError(_0x1221c7,_0x4cb8c9){_0x4cb8c9=_0x4cb8c9||0x1f4;return function(_0x328c15){logger[_0x80b7('0x24')](_0x328c15[_0x80b7('0x25')]);if(_0x328c15[_0x80b7('0x26')]){delete _0x328c15[_0x80b7('0x26')];}_0x1221c7[_0x80b7('0x15')](_0x4cb8c9)[_0x80b7('0x27')](_0x328c15);};}exports[_0x80b7('0x28')]=function(_0x479335,_0x42e7a6){var _0x23958b={},_0x1dc2df={},_0x396144={'count':0x0,'rows':[]};var _0x46b76b=_['map'](db[_0x80b7('0x29')][_0x80b7('0x2a')],function(_0x2cc6f7){return{'name':_0x2cc6f7[_0x80b7('0x2b')],'type':_0x2cc6f7[_0x80b7('0x2c')][_0x80b7('0x2d')]};});_0x1dc2df[_0x80b7('0x2e')]=_['map'](_0x46b76b,_0x80b7('0x26'));_0x1dc2df[_0x80b7('0x2f')]=_['keys'](_0x479335[_0x80b7('0x2f')]);_0x1dc2df[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1dc2df[_0x80b7('0x2e')],_0x1dc2df[_0x80b7('0x2f')]);_0x23958b[_0x80b7('0x32')]=_['intersection'](_0x1dc2df[_0x80b7('0x2e')],qs[_0x80b7('0x33')](_0x479335[_0x80b7('0x2f')]['fields']));_0x23958b[_0x80b7('0x32')]=_0x23958b[_0x80b7('0x32')][_0x80b7('0x34')]?_0x23958b['attributes']:_0x1dc2df[_0x80b7('0x2e')];if(!_0x479335[_0x80b7('0x2f')][_0x80b7('0x35')](_0x80b7('0x36'))){_0x23958b[_0x80b7('0x19')]=qs[_0x80b7('0x19')](_0x479335[_0x80b7('0x2f')][_0x80b7('0x19')]);_0x23958b['offset']=qs['offset'](_0x479335[_0x80b7('0x2f')][_0x80b7('0x17')]);}_0x23958b[_0x80b7('0x37')]=qs[_0x80b7('0x38')](_0x479335['query']['sort']);_0x23958b[_0x80b7('0x39')]=qs[_0x80b7('0x30')](_[_0x80b7('0x3a')](_0x479335[_0x80b7('0x2f')],_0x1dc2df['filters']),_0x46b76b);if(_0x479335[_0x80b7('0x2f')][_0x80b7('0x3b')]){_0x23958b['where']=_[_0x80b7('0x3c')](_0x23958b['where'],{'$or':_[_0x80b7('0x3d')](_0x46b76b,function(_0x490b91){if(_0x490b91['type']!==_0x80b7('0x3e')){var _0x76ffba={};_0x76ffba[_0x490b91[_0x80b7('0x26')]]={'$like':'%'+_0x479335[_0x80b7('0x2f')]['filter']+'%'};return _0x76ffba;}})});}_0x23958b=_['merge']({},_0x23958b,_0x479335[_0x80b7('0x3f')]);var _0x4f50ca={'where':_0x23958b[_0x80b7('0x39')]};return db[_0x80b7('0x29')]['count'](_0x4f50ca)['then'](function(_0x15fe0d){_0x396144[_0x80b7('0x1a')]=_0x15fe0d;if(_0x479335[_0x80b7('0x2f')]['includeAll']){_0x23958b[_0x80b7('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x23958b);})[_0x80b7('0x22')](function(_0x1b2fda){_0x396144[_0x80b7('0x41')]=_0x1b2fda;return _0x396144;})[_0x80b7('0x22')](respondWithFilteredResult(_0x42e7a6,_0x23958b))[_0x80b7('0x42')](handleError(_0x42e7a6,null));};exports[_0x80b7('0x43')]=function(_0xa12f05,_0x2070fc){var _0xa5d1bf={'raw':!![],'where':{'id':_0xa12f05[_0x80b7('0x44')]['id']}},_0x190d41={};_0x190d41[_0x80b7('0x2e')]=_['keys'](db[_0x80b7('0x29')][_0x80b7('0x2a')]);_0x190d41[_0x80b7('0x2f')]=_[_0x80b7('0x45')](_0xa12f05[_0x80b7('0x2f')]);_0x190d41[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x190d41[_0x80b7('0x2e')],_0x190d41[_0x80b7('0x2f')]);_0xa5d1bf[_0x80b7('0x32')]=_[_0x80b7('0x31')](_0x190d41['model'],qs[_0x80b7('0x33')](_0xa12f05['query'][_0x80b7('0x33')]));_0xa5d1bf[_0x80b7('0x32')]=_0xa5d1bf[_0x80b7('0x32')][_0x80b7('0x34')]?_0xa5d1bf['attributes']:_0x190d41[_0x80b7('0x2e')];if(_0xa12f05[_0x80b7('0x2f')]['includeAll']){_0xa5d1bf[_0x80b7('0x40')]=[{'all':!![]}];}_0xa5d1bf=_[_0x80b7('0x3c')]({},_0xa5d1bf,_0xa12f05['options']);return db[_0x80b7('0x29')][_0x80b7('0x46')](_0xa5d1bf)['then'](handleEntityNotFound(_0x2070fc,null))['then'](respondWithResult(_0x2070fc,null))[_0x80b7('0x42')](handleError(_0x2070fc,null));};exports[_0x80b7('0x47')]=function(_0xb75a61,_0x29bee7){return db[_0x80b7('0x29')][_0x80b7('0x47')](_0xb75a61[_0x80b7('0x48')],{})['then'](respondWithResult(_0x29bee7,0xc9))['catch'](handleError(_0x29bee7,null));};exports['update']=function(_0x599205,_0x52fd0b){if(_0x599205['body']['id']){delete _0x599205[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x29')][_0x80b7('0x46')]({'where':{'id':_0x599205['params']['id']}})[_0x80b7('0x22')](handleEntityNotFound(_0x52fd0b,null))[_0x80b7('0x22')](saveUpdates(_0x599205[_0x80b7('0x48')],null))['then'](respondWithResult(_0x52fd0b,null))[_0x80b7('0x42')](handleError(_0x52fd0b,null));};exports['destroy']=function(_0x1e7536,_0x2a642e){return db[_0x80b7('0x29')]['find']({'where':{'id':_0x1e7536[_0x80b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a642e,null))['then'](removeEntity(_0x2a642e,null))[_0x80b7('0x42')](handleError(_0x2a642e,null));}; \ No newline at end of file +var _0x9e6d=['attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','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','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x1a67a6,_0x134d93){_0x1a67a6=_0x1a67a6-0x0;var _0x11f660=_0x9e6d[_0x1a67a6];return _0x11f660;};'use strict';var emlformat=require(_0xd9e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9e6('0x1'));var jsonpatch=require(_0xd9e6('0x2'));var rp=require(_0xd9e6('0x3'));var moment=require('moment');var BPromise=require(_0xd9e6('0x4'));var Mustache=require(_0xd9e6('0x5'));var util=require(_0xd9e6('0x6'));var path=require(_0xd9e6('0x7'));var sox=require('sox');var csv=require(_0xd9e6('0x8'));var ejs=require(_0xd9e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd9e6('0xa'));var crypto=require(_0xd9e6('0xb'));var jsforce=require(_0xd9e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd9e6('0x8'));var querystring=require(_0xd9e6('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9e6('0xe'));var authService=require(_0xd9e6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e6('0x10'));var logger=require(_0xd9e6('0x11'))(_0xd9e6('0x12'));var utils=require(_0xd9e6('0x13'));var config=require(_0xd9e6('0x14'));var licenseUtil=require(_0xd9e6('0x15'));var db=require(_0xd9e6('0x16'))['db'];function respondWithStatusCode(_0x350b53,_0x3bb322){_0x3bb322=_0x3bb322||0xcc;return function(_0x590c7b){if(_0x590c7b){return _0x350b53[_0xd9e6('0x17')](_0x3bb322);}return _0x350b53[_0xd9e6('0x18')](_0x3bb322)['end']();};}function respondWithResult(_0x51e0b2,_0x1b32bb){_0x1b32bb=_0x1b32bb||0xc8;return function(_0x5a9940){if(_0x5a9940){return _0x51e0b2[_0xd9e6('0x18')](_0x1b32bb)[_0xd9e6('0x19')](_0x5a9940);}};}function respondWithFilteredResult(_0x1404d6,_0x1591d5){return function(_0x79ce6a){if(_0x79ce6a){var _0x4eb591=typeof _0x1591d5['offset']===_0xd9e6('0x1a')&&typeof _0x1591d5['limit']===_0xd9e6('0x1a');var _0x232770=_0x79ce6a[_0xd9e6('0x1b')];var _0x2db831=_0x4eb591?0x0:_0x1591d5[_0xd9e6('0x1c')];var _0xa7fa90=_0x4eb591?_0x79ce6a[_0xd9e6('0x1b')]:_0x1591d5[_0xd9e6('0x1c')]+_0x1591d5[_0xd9e6('0x1d')];var _0x2604a0;if(_0xa7fa90>=_0x232770){_0xa7fa90=_0x232770;_0x2604a0=0xc8;}else{_0x2604a0=0xce;}_0x1404d6['status'](_0x2604a0);return _0x1404d6['set'](_0xd9e6('0x1e'),_0x2db831+'-'+_0xa7fa90+'/'+_0x232770)[_0xd9e6('0x19')](_0x79ce6a);}return null;};}function patchUpdates(_0x19dfd7){return function(_0x4a6e39){try{jsonpatch[_0xd9e6('0x1f')](_0x4a6e39,_0x19dfd7,!![]);}catch(_0x106026){return BPromise[_0xd9e6('0x20')](_0x106026);}return _0x4a6e39[_0xd9e6('0x21')]();};}function saveUpdates(_0x4f8db1,_0x4e7873){return function(_0x162e67){if(_0x162e67){return _0x162e67[_0xd9e6('0x22')](_0x4f8db1)[_0xd9e6('0x23')](function(_0x5dc0bd){return _0x5dc0bd;});}return null;};}function removeEntity(_0x33158e,_0x370c64){return function(_0x2393b9){if(_0x2393b9){return _0x2393b9[_0xd9e6('0x24')]()[_0xd9e6('0x23')](function(){_0x33158e[_0xd9e6('0x18')](0xcc)[_0xd9e6('0x25')]();});}};}function handleEntityNotFound(_0x5e2eef,_0x3a8c62){return function(_0x3b17f9){if(!_0x3b17f9){_0x5e2eef[_0xd9e6('0x17')](0x194);}return _0x3b17f9;};}function handleError(_0x3ea715,_0x147a4f){_0x147a4f=_0x147a4f||0x1f4;return function(_0x3e8b29){logger['error'](_0x3e8b29[_0xd9e6('0x26')]);if(_0x3e8b29[_0xd9e6('0x27')]){delete _0x3e8b29[_0xd9e6('0x27')];}_0x3ea715[_0xd9e6('0x18')](_0x147a4f)[_0xd9e6('0x28')](_0x3e8b29);};}exports[_0xd9e6('0x29')]=function(_0x105831,_0x2b2f4b){var _0x3e98d6={},_0x874243={},_0x3470f5={'count':0x0,'rows':[]};var _0x3c4043=_[_0xd9e6('0x2a')](db[_0xd9e6('0x2b')]['rawAttributes'],function(_0x339d5f){return{'name':_0x339d5f[_0xd9e6('0x2c')],'type':_0x339d5f[_0xd9e6('0x2d')][_0xd9e6('0x2e')]};});_0x874243[_0xd9e6('0x2f')]=_[_0xd9e6('0x2a')](_0x3c4043,_0xd9e6('0x27'));_0x874243[_0xd9e6('0x30')]=_['keys'](_0x105831[_0xd9e6('0x30')]);_0x874243[_0xd9e6('0x31')]=_[_0xd9e6('0x32')](_0x874243['model'],_0x874243[_0xd9e6('0x30')]);_0x3e98d6['attributes']=_[_0xd9e6('0x32')](_0x874243[_0xd9e6('0x2f')],qs['fields'](_0x105831['query'][_0xd9e6('0x33')]));_0x3e98d6[_0xd9e6('0x34')]=_0x3e98d6['attributes'][_0xd9e6('0x35')]?_0x3e98d6['attributes']:_0x874243[_0xd9e6('0x2f')];if(!_0x105831[_0xd9e6('0x30')][_0xd9e6('0x36')](_0xd9e6('0x37'))){_0x3e98d6[_0xd9e6('0x1d')]=qs[_0xd9e6('0x1d')](_0x105831[_0xd9e6('0x30')][_0xd9e6('0x1d')]);_0x3e98d6['offset']=qs['offset'](_0x105831[_0xd9e6('0x30')][_0xd9e6('0x1c')]);}_0x3e98d6[_0xd9e6('0x38')]=qs[_0xd9e6('0x39')](_0x105831[_0xd9e6('0x30')][_0xd9e6('0x39')]);_0x3e98d6[_0xd9e6('0x3a')]=qs[_0xd9e6('0x31')](_['pick'](_0x105831[_0xd9e6('0x30')],_0x874243[_0xd9e6('0x31')]),_0x3c4043);if(_0x105831[_0xd9e6('0x30')]['filter']){_0x3e98d6[_0xd9e6('0x3a')]=_[_0xd9e6('0x3b')](_0x3e98d6[_0xd9e6('0x3a')],{'$or':_[_0xd9e6('0x2a')](_0x3c4043,function(_0x3012f6){if(_0x3012f6[_0xd9e6('0x2d')]!==_0xd9e6('0x3c')){var _0x5f2f98={};_0x5f2f98[_0x3012f6['name']]={'$like':'%'+_0x105831['query'][_0xd9e6('0x3d')]+'%'};return _0x5f2f98;}})});}_0x3e98d6=_['merge']({},_0x3e98d6,_0x105831['options']);var _0x452b7b={'where':_0x3e98d6[_0xd9e6('0x3a')]};return db[_0xd9e6('0x2b')]['count'](_0x452b7b)[_0xd9e6('0x23')](function(_0x9d22ea){_0x3470f5[_0xd9e6('0x1b')]=_0x9d22ea;if(_0x105831['query'][_0xd9e6('0x3e')]){_0x3e98d6[_0xd9e6('0x3f')]=[{'all':!![]}];}return db[_0xd9e6('0x2b')][_0xd9e6('0x40')](_0x3e98d6);})[_0xd9e6('0x23')](function(_0x4b874e){_0x3470f5[_0xd9e6('0x41')]=_0x4b874e;return _0x3470f5;})['then'](respondWithFilteredResult(_0x2b2f4b,_0x3e98d6))['catch'](handleError(_0x2b2f4b,null));};exports['show']=function(_0xad2935,_0x101350){var _0x5f339f={'raw':!![],'where':{'id':_0xad2935[_0xd9e6('0x42')]['id']}},_0x2e3fa8={};_0x2e3fa8[_0xd9e6('0x2f')]=_[_0xd9e6('0x43')](db[_0xd9e6('0x2b')][_0xd9e6('0x44')]);_0x2e3fa8[_0xd9e6('0x30')]=_[_0xd9e6('0x43')](_0xad2935['query']);_0x2e3fa8[_0xd9e6('0x31')]=_[_0xd9e6('0x32')](_0x2e3fa8[_0xd9e6('0x2f')],_0x2e3fa8[_0xd9e6('0x30')]);_0x5f339f[_0xd9e6('0x34')]=_[_0xd9e6('0x32')](_0x2e3fa8[_0xd9e6('0x2f')],qs[_0xd9e6('0x33')](_0xad2935[_0xd9e6('0x30')]['fields']));_0x5f339f[_0xd9e6('0x34')]=_0x5f339f[_0xd9e6('0x34')][_0xd9e6('0x35')]?_0x5f339f[_0xd9e6('0x34')]:_0x2e3fa8[_0xd9e6('0x2f')];if(_0xad2935[_0xd9e6('0x30')][_0xd9e6('0x3e')]){_0x5f339f[_0xd9e6('0x3f')]=[{'all':!![]}];}_0x5f339f=_['merge']({},_0x5f339f,_0xad2935[_0xd9e6('0x45')]);return db[_0xd9e6('0x2b')][_0xd9e6('0x46')](_0x5f339f)[_0xd9e6('0x23')](handleEntityNotFound(_0x101350,null))[_0xd9e6('0x23')](respondWithResult(_0x101350,null))[_0xd9e6('0x47')](handleError(_0x101350,null));};exports[_0xd9e6('0x48')]=function(_0x1f2265,_0x1b9973){return db['WhatsappApplication'][_0xd9e6('0x48')](_0x1f2265[_0xd9e6('0x49')],{})[_0xd9e6('0x23')](respondWithResult(_0x1b9973,0xc9))['catch'](handleError(_0x1b9973,null));};exports[_0xd9e6('0x22')]=function(_0x324fe8,_0x14719a){if(_0x324fe8[_0xd9e6('0x49')]['id']){delete _0x324fe8[_0xd9e6('0x49')]['id'];}return db[_0xd9e6('0x2b')][_0xd9e6('0x46')]({'where':{'id':_0x324fe8[_0xd9e6('0x42')]['id']}})[_0xd9e6('0x23')](handleEntityNotFound(_0x14719a,null))[_0xd9e6('0x23')](saveUpdates(_0x324fe8[_0xd9e6('0x49')],null))['then'](respondWithResult(_0x14719a,null))['catch'](handleError(_0x14719a,null));};exports[_0xd9e6('0x24')]=function(_0x37ae2d,_0x3a3325){return db[_0xd9e6('0x2b')][_0xd9e6('0x46')]({'where':{'id':_0x37ae2d[_0xd9e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a3325,null))[_0xd9e6('0x23')](removeEntity(_0x3a3325,null))['catch'](handleError(_0x3a3325,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index dbc1202..7dda868 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 _0x3685=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4b9e00,_0x41a27e){var _0x53040e=function(_0x5e607e){while(--_0x5e607e){_0x4b9e00['push'](_0x4b9e00['shift']());}};_0x53040e(++_0x41a27e);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5368('0xe')});}; \ No newline at end of file +var _0x9b9b=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x8d9bf,_0x31e39e){var _0x276920=function(_0x147e55){while(--_0x147e55){_0x8d9bf['push'](_0x8d9bf['shift']());}};_0x276920(++_0x31e39e);}(_0x9b9b,0x114));var _0xb9b9=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0x9b9b[_0x17e69b];return _0x55eea8;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 00939aa..ebb20e7 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 _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x562163,_0x264e2a){var _0x551eed=function(_0x5ecde8){while(--_0x5ecde8){_0x562163['push'](_0x562163['shift']());}};_0x551eed(++_0x264e2a);}(_0x2d17,0x17e));var _0x72d1=function(_0x1080b1,_0x966ac6){_0x1080b1=_0x1080b1-0x0;var _0x542181=_0x2d17[_0x1080b1];return _0x542181;};'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});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x008c,0x188));var _0xc008=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0x008c[_0x47199b];return _0x390911;};'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 4a4ad6c..ddb1215 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 _0x8d0a=['whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp'];(function(_0x22aabe,_0x1667d4){var _0x7ae05=function(_0x3c3440){while(--_0x3c3440){_0x22aabe['push'](_0x22aabe['shift']());}};_0x7ae05(++_0x1667d4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x5d41b7,_0x275630){_0x5d41b7=_0x5d41b7-0x0;var _0x755243=_0x8d0a[_0x5d41b7];return _0x755243;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['get']('/:id/messages',auth[_0xa8d0('0xa')](),controller['getMessages']);router[_0xa8d0('0xc')](_0xa8d0('0xf'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')]('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);router[_0xa8d0('0x11')](_0xa8d0('0x13'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x14')]);router['post'](_0xa8d0('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xa8d0('0x16'),_0xa8d0('0x17')),controller['addTags']);router[_0xa8d0('0x18')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),_0xa8d0('0x1a')),controller['update']);router[_0xa8d0('0x1b')](_0xa8d0('0xe'),auth['isAuthenticated'](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),'whatsappinteraction:destroy'),controller[_0xa8d0('0x1c')]);router[_0xa8d0('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa8d0('0x1d')]);module[_0xa8d0('0x1e')]=router; \ No newline at end of file +var _0x4317=['./whatsappInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x894158,_0x8c76c1){var _0x3715b4=function(_0x4447a6){while(--_0x4447a6){_0x894158['push'](_0x894158['shift']());}};_0x3715b4(++_0x8c76c1);}(_0x4317,0x7c));var _0x7431=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4317[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xa')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0xa')](_0x7431('0x10'),auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0xa')](_0x7431('0x12'),auth[_0x7431('0xc')](),controller[_0x7431('0x13')]);router[_0x7431('0x14')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0x15')]);router[_0x7431('0x14')](_0x7431('0x10'),auth[_0x7431('0xc')](),controller[_0x7431('0x16')]);router['post'](_0x7431('0x17'),auth[_0x7431('0xc')](),interaction[_0x7431('0x18')]('whatsapp',_0x7431('0x19')),controller[_0x7431('0x1a')]);router[_0x7431('0x1b')]('/:id',auth[_0x7431('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x7431('0x1c')]);router[_0x7431('0x1d')](_0x7431('0xe'),auth[_0x7431('0xc')](),interaction['tracked']('whatsapp',_0x7431('0x1e')),controller[_0x7431('0x1f')]);router[_0x7431('0x1d')](_0x7431('0x17'),auth[_0x7431('0xc')](),controller[_0x7431('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f8a6660..7f6a207 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 _0x3cae=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x5e753f,_0x460beb){var _0x59abbb=function(_0xff4437){while(--_0xff4437){_0x5e753f['push'](_0x5e753f['shift']());}};_0x59abbb(++_0x460beb);}(_0x3cae,0x117));var _0xe3ca=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x3cae[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require(_0xe3ca('0x0'));var moment=require(_0xe3ca('0x1'));module[_0xe3ca('0x2')]={'closed':{'type':Sequelize[_0xe3ca('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3ca('0x4')]},'disposition':{'type':Sequelize[_0xe3ca('0x5')]},'secondDisposition':{'type':Sequelize[_0xe3ca('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe3ca('0x5')]},'phone':{'type':Sequelize[_0xe3ca('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe3ca('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe3ca('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe3ca('0x6')]('in',_0xe3ca('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe3ca('0x8')]}}; \ No newline at end of file +var _0x6739=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x1a05cd,_0x3d03a7){var _0x240f31=function(_0x327e2e){while(--_0x327e2e){_0x1a05cd['push'](_0x1a05cd['shift']());}};_0x240f31(++_0x3d03a7);}(_0x6739,0xd3));var _0x9673=function(_0x240670,_0x40a573){_0x240670=_0x240670-0x0;var _0x4c1016=_0x6739[_0x240670];return _0x4c1016;};'use strict';var Sequelize=require(_0x9673('0x0'));var moment=require(_0x9673('0x1'));module[_0x9673('0x2')]={'closed':{'type':Sequelize[_0x9673('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9673('0x4')]},'disposition':{'type':Sequelize[_0x9673('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9673('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9673('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9673('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9673('0x6')]('in',_0x9673('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a7a200d..3baec71 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 _0xd0cd=['offset','undefined','count','limit','Content-Range','update','then','destroy','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','describe','addMessage','WhatsappMessage','params','ids','omit','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','Owner','get','mkdirSync','Whatsapp','Account','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','disposition','existsSync','createReadStream','createWriteStream','basename','direction','out','System','read','value','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xd0cd,0xe7));var _0xdd0c=function(_0x3c6456,_0x3be8db){_0x3c6456=_0x3c6456-0x0;var _0x258853=_0xd0cd[_0x3c6456];return _0x258853;};'use strict';var rimraf=require(_0xdd0c('0x0'));var zipdir=require(_0xdd0c('0x1'));var moment=require(_0xdd0c('0x2'));var BPromise=require(_0xdd0c('0x3'));var util=require('util');var path=require(_0xdd0c('0x4'));var ejs=require(_0xdd0c('0x5'));var fs=require('fs');var _=require(_0xdd0c('0x6'));var Redis=require(_0xdd0c('0x7'));var interaction=require(_0xdd0c('0x8'));var qs=require(_0xdd0c('0x9'));var pdf=require(_0xdd0c('0xa'));var logger=require(_0xdd0c('0xb'))('api');var config=require('../../config/environment');var db=require(_0xdd0c('0xc'))['db'];config[_0xdd0c('0xd')]=_[_0xdd0c('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdd0c('0xf'))(new Redis(config[_0xdd0c('0xd')]));require(_0xdd0c('0x10'))['register'](socket);function respondWithStatusCode(_0x135571,_0x36660f){_0x36660f=_0x36660f||0xcc;return function(_0x478fbc){if(_0x478fbc){return _0x135571[_0xdd0c('0x11')](_0x36660f);}return _0x135571[_0xdd0c('0x12')](_0x36660f)[_0xdd0c('0x13')]();};}function respondWithResult(_0x25e9eb,_0x567962){_0x567962=_0x567962||0xc8;return function(_0x17d9b7){if(_0x17d9b7){return _0x25e9eb[_0xdd0c('0x12')](_0x567962)[_0xdd0c('0x14')](_0x17d9b7);}};}function respondWithFilteredResult(_0x35cfca,_0x42379b){return function(_0x50f6e5){if(_0x50f6e5){var _0x830e43=typeof _0x42379b[_0xdd0c('0x15')]===_0xdd0c('0x16')&&typeof _0x42379b['limit']===_0xdd0c('0x16');var _0x5b3ae6=_0x50f6e5[_0xdd0c('0x17')];var _0x206f1c=_0x830e43?0x0:_0x42379b[_0xdd0c('0x15')];var _0x5c05e1=_0x830e43?_0x50f6e5['count']:_0x42379b['offset']+_0x42379b[_0xdd0c('0x18')];var _0x151844;if(_0x5c05e1>=_0x5b3ae6){_0x5c05e1=_0x5b3ae6;_0x151844=0xc8;}else{_0x151844=0xce;}_0x35cfca[_0xdd0c('0x12')](_0x151844);return _0x35cfca['set'](_0xdd0c('0x19'),_0x206f1c+'-'+_0x5c05e1+'/'+_0x5b3ae6)[_0xdd0c('0x14')](_0x50f6e5);}return null;};}function saveUpdates(_0x1c959b){return function(_0x27d5ab){if(_0x27d5ab){return _0x27d5ab[_0xdd0c('0x1a')](_0x1c959b)[_0xdd0c('0x1b')](function(_0x1362a0){return _0x1362a0;});}return null;};}function removeEntity(_0x2ae969){return function(_0x3a9997){if(_0x3a9997){return _0x3a9997[_0xdd0c('0x1c')]()[_0xdd0c('0x1b')](function(){_0x2ae969[_0xdd0c('0x12')](0xcc)[_0xdd0c('0x13')]();});}};}function handleEntityNotFound(_0x4fd59c){return function(_0x3b5de9){if(!_0x3b5de9){_0x4fd59c[_0xdd0c('0x11')](0x194);}return _0x3b5de9;};}function handleError(_0x5c0f08,_0x4d46a1){_0x4d46a1=_0x4d46a1||0x1f4;return function(_0x3a8bb0){logger['error'](_0x3a8bb0[_0xdd0c('0x1d')]);if(_0x3a8bb0[_0xdd0c('0x1e')]){delete _0x3a8bb0[_0xdd0c('0x1e')];}_0x5c0f08['status'](_0x4d46a1)['send'](_0x3a8bb0);};}exports[_0xdd0c('0x1f')]=function(_0x3eff30,_0x568b0f){var _0x195988={};var _0xae0ee1=_[_0xdd0c('0x20')](db[_0xdd0c('0x21')][_0xdd0c('0x22')],function(_0x4bf380){return{'name':_0x4bf380[_0xdd0c('0x23')],'type':_0x4bf380[_0xdd0c('0x24')][_0xdd0c('0x25')]};});_0x195988=qs[_0xdd0c('0x26')](_0xae0ee1,_0x3eff30);return interaction[_0xdd0c('0x27')](_0xdd0c('0x28'),_0x3eff30[_0xdd0c('0x29')],_0x3eff30[_0xdd0c('0x2a')],_0x195988,_0xae0ee1)[_0xdd0c('0x1b')](respondWithFilteredResult(_0x568b0f,_0x195988))['catch'](handleError(_0x568b0f,null));};exports['show']=function(_0xe91a4f,_0x49e480){var _0x13b18f={'raw':![],'where':{'id':_0xe91a4f['params']['id']}},_0x13d80e={};_0x13d80e[_0xdd0c('0x2b')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x13d80e[_0xdd0c('0x29')]=_[_0xdd0c('0x2c')](_0xe91a4f[_0xdd0c('0x29')]);_0x13d80e[_0xdd0c('0x2d')]=_[_0xdd0c('0x2e')](_0x13d80e[_0xdd0c('0x2b')],_0x13d80e[_0xdd0c('0x29')]);_0x13b18f[_0xdd0c('0x2f')]=_[_0xdd0c('0x2e')](_0x13d80e[_0xdd0c('0x2b')],qs[_0xdd0c('0x30')](_0xe91a4f[_0xdd0c('0x29')][_0xdd0c('0x30')]));_0x13b18f[_0xdd0c('0x2f')]=_0x13b18f[_0xdd0c('0x2f')][_0xdd0c('0x31')]?_0x13b18f['attributes']:_0x13d80e['model'];if(_0xe91a4f[_0xdd0c('0x29')][_0xdd0c('0x32')]){_0x13b18f[_0xdd0c('0x33')]=[{'all':!![]}];}_0x13b18f=_[_0xdd0c('0x34')]({},_0x13b18f,_0xe91a4f[_0xdd0c('0x35')]);return db['WhatsappInteraction'][_0xdd0c('0x36')](_0x13b18f)[_0xdd0c('0x1b')](handleEntityNotFound(_0x49e480,null))[_0xdd0c('0x1b')](respondWithResult(_0x49e480,null))['catch'](handleError(_0x49e480,null));};exports[_0xdd0c('0x37')]=function(_0x2e4e79,_0xa38e06){return db['WhatsappInteraction']['create'](_0x2e4e79[_0xdd0c('0x38')],{})['then'](respondWithResult(_0xa38e06,0xc9))[_0xdd0c('0x39')](handleError(_0xa38e06,null));};exports[_0xdd0c('0x1a')]=function(_0x5aa213,_0x224a5a){if(_0x5aa213[_0xdd0c('0x38')]['id']){delete _0x5aa213['body']['id'];}return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x5aa213['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x224a5a,null))[_0xdd0c('0x1b')](saveUpdates(_0x5aa213['body'],null))[_0xdd0c('0x1b')](respondWithResult(_0x224a5a,null))[_0xdd0c('0x39')](handleError(_0x224a5a,null));};exports[_0xdd0c('0x1c')]=function(_0x266bab,_0x3477c7){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x266bab['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x3477c7,null))['then'](removeEntity(_0x3477c7,null))[_0xdd0c('0x39')](handleError(_0x3477c7,null));};exports[_0xdd0c('0x3a')]=function(_0xe1e84b,_0x27b607){return db[_0xdd0c('0x21')][_0xdd0c('0x3a')]()[_0xdd0c('0x1b')](respondWithResult(_0x27b607,null))[_0xdd0c('0x39')](handleError(_0x27b607,null));};exports[_0xdd0c('0x3b')]=function(_0x3d806e,_0x3972f9){return db[_0xdd0c('0x3c')]['find']({'where':{'id':_0x3d806e[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x3972f9,null))['then'](function(_0x54080a){if(_0x54080a){return _0x54080a[_0xdd0c('0x3b')](_0x3d806e[_0xdd0c('0x38')][_0xdd0c('0x3e')],_[_0xdd0c('0x3f')](_0x3d806e[_0xdd0c('0x38')],[_0xdd0c('0x3e'),'id'])||{});}})[_0xdd0c('0x1b')](respondWithResult(_0x3972f9,null))[_0xdd0c('0x39')](handleError(_0x3972f9,null));};exports['getMessages']=function(_0x30d596,_0x8fdbb7){var _0x20c76b={'raw':![],'where':{}};var _0xf877d8={};var _0x2d140b={'count':0x0,'rows':[]};return db[_0xdd0c('0x21')]['findOne']({'where':{'id':_0x30d596[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x8fdbb7,null))[_0xdd0c('0x1b')](function(_0x5e84d2){if(_0x5e84d2){_0xf877d8[_0xdd0c('0x2b')]=_[_0xdd0c('0x2c')](db[_0xdd0c('0x3c')][_0xdd0c('0x22')]);_0xf877d8[_0xdd0c('0x29')]=_[_0xdd0c('0x2c')](_0x30d596['query']);_0xf877d8[_0xdd0c('0x2d')]=_['intersection'](_0xf877d8[_0xdd0c('0x2b')],_0xf877d8['query']);_0x20c76b[_0xdd0c('0x2f')]=_[_0xdd0c('0x2e')](_0xf877d8[_0xdd0c('0x2b')],qs[_0xdd0c('0x30')](_0x30d596[_0xdd0c('0x29')]['fields']));_0x20c76b[_0xdd0c('0x2f')]=_0x20c76b['attributes'][_0xdd0c('0x31')]?_0x20c76b['attributes']:_0xf877d8[_0xdd0c('0x2b')];if(!_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x40')](_0xdd0c('0x41'))){_0x20c76b['limit']=qs['limit'](_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x18')]);_0x20c76b[_0xdd0c('0x15')]=qs[_0xdd0c('0x15')](_0x30d596['query'][_0xdd0c('0x15')]);}_0x20c76b[_0xdd0c('0x42')]=qs['sort'](_0x30d596['query'][_0xdd0c('0x43')]);_0x20c76b[_0xdd0c('0x44')]=qs[_0xdd0c('0x2d')](_['pick'](_0x30d596[_0xdd0c('0x29')],_0xf877d8[_0xdd0c('0x2d')]));_0x20c76b['where'][_0xdd0c('0x45')]=_0x5e84d2['id'];if(_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x46')]){_0x20c76b[_0xdd0c('0x44')]=_['merge'](_0x20c76b[_0xdd0c('0x44')],{'$or':_['map'](_0x20c76b[_0xdd0c('0x2f')],function(_0x1c4c5d){var _0x1a01f7={};_0x1a01f7[_0x1c4c5d]={'$like':'%'+_0x30d596['query'][_0xdd0c('0x46')]+'%'};return _0x1a01f7;})});}if(_0x30d596['query'][_0xdd0c('0x47')]){var _0x3a3110=_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x47')][_0xdd0c('0x48')](',');var _0x417fa9={};_0x417fa9[_0x3a3110[0x0]]={'$gte':moment(_0x3a3110[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x20c76b['where']=_[_0xdd0c('0x34')](_0x20c76b[_0xdd0c('0x44')],_0x417fa9);}_0x20c76b=_['merge']({},_0x20c76b,_0x30d596[_0xdd0c('0x35')]);return db['WhatsappMessage'][_0xdd0c('0x17')]({'where':_0x20c76b[_0xdd0c('0x44')]})[_0xdd0c('0x1b')](function(_0x3e8a10){_0x2d140b[_0xdd0c('0x17')]=_0x3e8a10;if(_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x32')]){_0x20c76b['include']=[{'all':!![]}];}return db[_0xdd0c('0x3c')][_0xdd0c('0x27')](_0x20c76b);})['then'](function(_0xd2c98){_0x2d140b[_0xdd0c('0x49')]=_0xd2c98;return _0x2d140b;});}})[_0xdd0c('0x1b')](respondWithFilteredResult(_0x8fdbb7,_0x20c76b))[_0xdd0c('0x39')](handleError(_0x8fdbb7,null));};exports[_0xdd0c('0x4a')]=function(_0x4c3423,_0xca343c){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x4c3423['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0xca343c,null))['then'](function(_0x34e2e4){if(_0x34e2e4){return _0x34e2e4[_0xdd0c('0x4b')](_0x4c3423[_0xdd0c('0x38')][_0xdd0c('0x3e')],_[_0xdd0c('0x3f')](_0x4c3423[_0xdd0c('0x38')],[_0xdd0c('0x3e'),'id'])||{})['spread'](function(){return db[_0xdd0c('0x4c')][_0xdd0c('0x27')]({'attributes':['id','name','color'],'where':{'id':_0x4c3423['body']['ids']}});})['then'](function(_0x178577){socket[_0xdd0c('0x4d')](_0xdd0c('0x4e'),{'id':Number(_0x4c3423['params']['id']),'tags':_0x178577||[]});return{'id':Number(_0x4c3423[_0xdd0c('0x3d')]['id']),'tags':_0x178577||[]};});}})[_0xdd0c('0x1b')](respondWithResult(_0xca343c,null))[_0xdd0c('0x39')](handleError(_0xca343c,null));};exports[_0xdd0c('0x4f')]=function(_0x44d6b3,_0x4796b9){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x44d6b3[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x4796b9,null))[_0xdd0c('0x1b')](function(_0x5a1f8e){if(_0x5a1f8e){return _0x5a1f8e[_0xdd0c('0x4f')](_0x44d6b3[_0xdd0c('0x29')][_0xdd0c('0x3e')]);}})[_0xdd0c('0x1b')](respondWithStatusCode(_0x4796b9,null))[_0xdd0c('0x39')](handleError(_0x4796b9,null));};exports['download']=function(_0x4aaaaa,_0x32a254){var _0x1448f2=moment()[_0xdd0c('0x50')]()['toString']();var _0x1854be=path[_0xdd0c('0x51')](config[_0xdd0c('0x52')],_0xdd0c('0x53'),'files',_0xdd0c('0x54'));var _0x4431cf=path[_0xdd0c('0x51')](config['root'],_0xdd0c('0x53'),_0xdd0c('0x55'),_0xdd0c('0x56'));var _0x485b9c=path[_0xdd0c('0x51')](_0x1854be,_0x1448f2);var _0x18adb1=util[_0xdd0c('0x57')]('transcript-%d-%s.zip',_0x4aaaaa[_0xdd0c('0x3d')]['id'],_0x1448f2);var _0x477741=path[_0xdd0c('0x51')](_0x1854be,_0x18adb1);var _0x4941a4=[];_0x4941a4[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x59')],'as':_0xdd0c('0x59'),'attributes':['id',_0xdd0c('0x5a')],'raw':!![]});_0x4941a4['push']({'model':db[_0xdd0c('0x5b')],'as':_0xdd0c('0x5c'),'attributes':['id',_0xdd0c('0x5d'),_0xdd0c('0x5e')],'raw':!![]});if(_0x4aaaaa[_0xdd0c('0x29')][_0xdd0c('0x56')]){_0x4941a4[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x5f')],'as':_0xdd0c('0x5f'),'raw':!![]});}var _0x35d9e7=[{'model':db[_0xdd0c('0x3c')],'as':_0xdd0c('0x60'),'attributes':['id',_0xdd0c('0x38'),'createdAt','direction',_0xdd0c('0x61'),'read'],'include':_0x4941a4}];_0x35d9e7[_0xdd0c('0x58')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xdd0c('0x1e')]});_0x35d9e7[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x59')],'as':_0xdd0c('0x62'),'attributes':['id',_0xdd0c('0x5a')]});return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x4aaaaa[_0xdd0c('0x3d')]['id']},'include':_0x35d9e7})['then'](handleEntityNotFound(_0x32a254,null))[_0xdd0c('0x1b')](function(_0x27e851){if(_0x27e851){var _0x532439=_0x27e851[_0xdd0c('0x63')]({'plain':!![]});fs[_0xdd0c('0x64')](_0x485b9c);var _0x21131a={'channel':_0xdd0c('0x65'),'account':_0x532439[_0xdd0c('0x66')][_0xdd0c('0x1e')],'agent':_0x532439['Owner']?_0x532439[_0xdd0c('0x62')]['fullname']:_0xdd0c('0x67'),'createdAt':moment(_0x532439[_0xdd0c('0x68')])['format'](_0xdd0c('0x69'))['toString'](),'closedAt':_0x532439['closed']?moment(_0x532439[_0xdd0c('0x6a')])[_0xdd0c('0x57')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd0c('0x6b')]():'','disposition':_0x532439[_0xdd0c('0x6c')],'messages':_(_0x532439[_0xdd0c('0x60')])[_0xdd0c('0x46')]({'secret':![]})['map'](function(_0x5c70cf){if(_0x5c70cf[_0xdd0c('0x5f')]){var _0x4bd1b8=path[_0xdd0c('0x51')](_0x4431cf,_0x5c70cf[_0xdd0c('0x5f')]['basename']);if(fs[_0xdd0c('0x6d')](_0x4bd1b8)){fs[_0xdd0c('0x6e')](_0x4bd1b8)['pipe'](fs[_0xdd0c('0x6f')](path[_0xdd0c('0x51')](_0x485b9c,_0x5c70cf[_0xdd0c('0x5f')][_0xdd0c('0x70')])));}}return{'date':moment(_0x5c70cf['createdAt'])[_0xdd0c('0x57')](_0xdd0c('0x69'))[_0xdd0c('0x6b')](),'sender':_0x5c70cf[_0xdd0c('0x71')]===_0xdd0c('0x72')?_0x5c70cf[_0xdd0c('0x59')]?_0x5c70cf[_0xdd0c('0x59')][_0xdd0c('0x5a')]:_0xdd0c('0x73'):_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5d')]+(_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5e')]?'\x20'+_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5e')]:''),'body':_0x5c70cf['Attachment']?_0x5c70cf[_0xdd0c('0x5f')][_0xdd0c('0x70')]:_0x5c70cf['body'],'direction':_0x5c70cf['direction']===_0xdd0c('0x72')?'A':'C','secret':_0x5c70cf['secret'],'read':_0x5c70cf[_0xdd0c('0x74')],'attachment':_0x5c70cf['Attachment']};})[_0xdd0c('0x75')]()};return ejs['renderFile'](path[_0xdd0c('0x51')](config[_0xdd0c('0x52')],_0xdd0c('0x53'),_0xdd0c('0x76'),'downloadInteraction.ejs'),{'interaction':_0x21131a})['then'](function(_0xbe0809){var _0x42b8e1=path[_0xdd0c('0x51')](_0x485b9c,_0xdd0c('0x77')+_0x532439['id']+'-'+_0x1448f2+_0xdd0c('0x78'));var _0x226b3e={'path':_0x42b8e1,'channel':_0xdd0c('0x65'),'interactionId':_0x532439['id']};return pdf[_0xdd0c('0x79')](_0xbe0809,_0x226b3e);})[_0xdd0c('0x1b')](function(){return new BPromise(function(_0x38ebf2,_0x4ce568){zipdir(_0x485b9c,{'saveTo':_0x477741},function(_0xb5a7f5,_0x5dd5a9){if(_0xb5a7f5)return _0x4ce568(_0xb5a7f5);return _0x38ebf2(_0x5dd5a9);});})[_0xdd0c('0x1b')](function(){return new BPromise(function(_0x3f7aaa,_0x466f1d){rimraf(_0x485b9c,function(_0x4ba87d){if(_0x4ba87d)_0x466f1d(_0x4ba87d);return _0x3f7aaa();});});})['then'](function(){return _0x32a254[_0xdd0c('0x7a')](_0x477741,_0x18adb1,function(_0x282f65){if(_0x282f65){console[_0xdd0c('0x7b')](_0xdd0c('0x7c'),_0x282f65);}else{fs[_0xdd0c('0x7d')](_0x477741);}});});});}else{return _0x32a254[_0xdd0c('0x11')](0xc8);}})['catch'](handleError(_0x32a254,null));}; \ No newline at end of file +var _0xd5d8=['basename','existsSync','createWriteStream','System','value','downloadInteraction.ejs','transcript-','.pdf','log','unlinkSync','rimraf','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','update','then','destroy','end','error','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','catch','params','model','keys','intersection','fields','attributes','length','merge','options','find','create','body','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','include','rows','addTags','setTags','Tag','color','emit','removeTags','download','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition'];(function(_0x168443,_0x4c02a1){var _0x55ab9a=function(_0x2d6f6e){while(--_0x2d6f6e){_0x168443['push'](_0x168443['shift']());}};_0x55ab9a(++_0x4c02a1);}(_0xd5d8,0x85));var _0x8d5d=function(_0x1982f5,_0x106eb8){_0x1982f5=_0x1982f5-0x0;var _0x147068=_0xd5d8[_0x1982f5];return _0x147068;};'use strict';var rimraf=require(_0x8d5d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8d5d('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x8d5d('0x2'));var ejs=require(_0x8d5d('0x3'));var fs=require('fs');var _=require(_0x8d5d('0x4'));var Redis=require(_0x8d5d('0x5'));var interaction=require(_0x8d5d('0x6'));var qs=require(_0x8d5d('0x7'));var pdf=require(_0x8d5d('0x8'));var logger=require('../../config/logger')(_0x8d5d('0x9'));var config=require(_0x8d5d('0xa'));var db=require(_0x8d5d('0xb'))['db'];config['redis']=_[_0x8d5d('0xc')](config[_0x8d5d('0xd')],{'host':_0x8d5d('0xe'),'port':0x18eb});var socket=require(_0x8d5d('0xf'))(new Redis(config[_0x8d5d('0xd')]));require(_0x8d5d('0x10'))[_0x8d5d('0x11')](socket);function respondWithStatusCode(_0x450f76,_0x58821a){_0x58821a=_0x58821a||0xcc;return function(_0x25c38e){if(_0x25c38e){return _0x450f76[_0x8d5d('0x12')](_0x58821a);}return _0x450f76[_0x8d5d('0x13')](_0x58821a)['end']();};}function respondWithResult(_0xd3d33e,_0x506f1d){_0x506f1d=_0x506f1d||0xc8;return function(_0x45e879){if(_0x45e879){return _0xd3d33e[_0x8d5d('0x13')](_0x506f1d)[_0x8d5d('0x14')](_0x45e879);}};}function respondWithFilteredResult(_0x74ba81,_0x23596d){return function(_0x74acc2){if(_0x74acc2){var _0x2cf8a9=typeof _0x23596d[_0x8d5d('0x15')]==='undefined'&&typeof _0x23596d[_0x8d5d('0x16')]==='undefined';var _0x45b1d1=_0x74acc2['count'];var _0x46091c=_0x2cf8a9?0x0:_0x23596d[_0x8d5d('0x15')];var _0x57f8bd=_0x2cf8a9?_0x74acc2['count']:_0x23596d[_0x8d5d('0x15')]+_0x23596d[_0x8d5d('0x16')];var _0x42c179;if(_0x57f8bd>=_0x45b1d1){_0x57f8bd=_0x45b1d1;_0x42c179=0xc8;}else{_0x42c179=0xce;}_0x74ba81['status'](_0x42c179);return _0x74ba81[_0x8d5d('0x17')](_0x8d5d('0x18'),_0x46091c+'-'+_0x57f8bd+'/'+_0x45b1d1)[_0x8d5d('0x14')](_0x74acc2);}return null;};}function saveUpdates(_0x1e15bd){return function(_0x51f0b3){if(_0x51f0b3){return _0x51f0b3[_0x8d5d('0x19')](_0x1e15bd)[_0x8d5d('0x1a')](function(_0x3e22b7){return _0x3e22b7;});}return null;};}function removeEntity(_0x436dd7){return function(_0x502fb6){if(_0x502fb6){return _0x502fb6[_0x8d5d('0x1b')]()[_0x8d5d('0x1a')](function(){_0x436dd7[_0x8d5d('0x13')](0xcc)[_0x8d5d('0x1c')]();});}};}function handleEntityNotFound(_0x472039){return function(_0x1d6512){if(!_0x1d6512){_0x472039[_0x8d5d('0x12')](0x194);}return _0x1d6512;};}function handleError(_0x48b9c6,_0x4809c0){_0x4809c0=_0x4809c0||0x1f4;return function(_0x1b574c){logger[_0x8d5d('0x1d')](_0x1b574c['stack']);if(_0x1b574c[_0x8d5d('0x1e')]){delete _0x1b574c['name'];}_0x48b9c6['status'](_0x4809c0)[_0x8d5d('0x1f')](_0x1b574c);};}exports[_0x8d5d('0x20')]=function(_0x596982,_0x2099ed){var _0x3ad139={};var _0x147135=_[_0x8d5d('0x21')](db[_0x8d5d('0x22')][_0x8d5d('0x23')],function(_0x1be80b){return{'name':_0x1be80b['fieldName'],'type':_0x1be80b[_0x8d5d('0x24')][_0x8d5d('0x25')]};});_0x3ad139=qs[_0x8d5d('0x26')](_0x147135,_0x596982);return interaction[_0x8d5d('0x27')](_0x8d5d('0x28'),_0x596982[_0x8d5d('0x29')],_0x596982[_0x8d5d('0x2a')],_0x3ad139,_0x147135)[_0x8d5d('0x1a')](respondWithFilteredResult(_0x2099ed,_0x3ad139))[_0x8d5d('0x2b')](handleError(_0x2099ed,null));};exports['show']=function(_0x2756e0,_0x444803){var _0x79b086={'raw':![],'where':{'id':_0x2756e0[_0x8d5d('0x2c')]['id']}},_0x485043={};_0x485043[_0x8d5d('0x2d')]=_[_0x8d5d('0x2e')](db[_0x8d5d('0x22')][_0x8d5d('0x23')]);_0x485043[_0x8d5d('0x29')]=_['keys'](_0x2756e0[_0x8d5d('0x29')]);_0x485043['filters']=_[_0x8d5d('0x2f')](_0x485043[_0x8d5d('0x2d')],_0x485043[_0x8d5d('0x29')]);_0x79b086['attributes']=_['intersection'](_0x485043[_0x8d5d('0x2d')],qs['fields'](_0x2756e0[_0x8d5d('0x29')][_0x8d5d('0x30')]));_0x79b086[_0x8d5d('0x31')]=_0x79b086[_0x8d5d('0x31')][_0x8d5d('0x32')]?_0x79b086[_0x8d5d('0x31')]:_0x485043[_0x8d5d('0x2d')];if(_0x2756e0[_0x8d5d('0x29')]['includeAll']){_0x79b086['include']=[{'all':!![]}];}_0x79b086=_[_0x8d5d('0x33')]({},_0x79b086,_0x2756e0[_0x8d5d('0x34')]);return db[_0x8d5d('0x22')][_0x8d5d('0x35')](_0x79b086)[_0x8d5d('0x1a')](handleEntityNotFound(_0x444803,null))[_0x8d5d('0x1a')](respondWithResult(_0x444803,null))['catch'](handleError(_0x444803,null));};exports[_0x8d5d('0x36')]=function(_0x5ab9a1,_0x3de922){return db[_0x8d5d('0x22')][_0x8d5d('0x36')](_0x5ab9a1[_0x8d5d('0x37')],{})[_0x8d5d('0x1a')](respondWithResult(_0x3de922,0xc9))[_0x8d5d('0x2b')](handleError(_0x3de922,null));};exports[_0x8d5d('0x19')]=function(_0x2462a5,_0x3a57ff){if(_0x2462a5['body']['id']){delete _0x2462a5[_0x8d5d('0x37')]['id'];}return db['WhatsappInteraction'][_0x8d5d('0x35')]({'where':{'id':_0x2462a5[_0x8d5d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3a57ff,null))[_0x8d5d('0x1a')](saveUpdates(_0x2462a5[_0x8d5d('0x37')],null))['then'](respondWithResult(_0x3a57ff,null))[_0x8d5d('0x2b')](handleError(_0x3a57ff,null));};exports[_0x8d5d('0x1b')]=function(_0x391a1c,_0x417869){return db[_0x8d5d('0x22')][_0x8d5d('0x35')]({'where':{'id':_0x391a1c[_0x8d5d('0x2c')]['id']}})[_0x8d5d('0x1a')](handleEntityNotFound(_0x417869,null))[_0x8d5d('0x1a')](removeEntity(_0x417869,null))[_0x8d5d('0x2b')](handleError(_0x417869,null));};exports[_0x8d5d('0x38')]=function(_0x14d0e9,_0x5dca44){return db[_0x8d5d('0x22')][_0x8d5d('0x38')]()['then'](respondWithResult(_0x5dca44,null))[_0x8d5d('0x2b')](handleError(_0x5dca44,null));};exports['addMessage']=function(_0x3a4f20,_0x2ea83f){return db[_0x8d5d('0x39')][_0x8d5d('0x35')]({'where':{'id':_0x3a4f20[_0x8d5d('0x2c')]['id']}})[_0x8d5d('0x1a')](handleEntityNotFound(_0x2ea83f,null))['then'](function(_0xf6dc73){if(_0xf6dc73){return _0xf6dc73[_0x8d5d('0x3a')](_0x3a4f20[_0x8d5d('0x37')][_0x8d5d('0x3b')],_[_0x8d5d('0x3c')](_0x3a4f20['body'],['ids','id'])||{});}})[_0x8d5d('0x1a')](respondWithResult(_0x2ea83f,null))[_0x8d5d('0x2b')](handleError(_0x2ea83f,null));};exports[_0x8d5d('0x3d')]=function(_0x9ac8bc,_0x59e892){var _0x599d9a={'raw':![],'where':{}};var _0x52f887={};var _0x2b46ec={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x8d5d('0x3e')]({'where':{'id':_0x9ac8bc[_0x8d5d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x59e892,null))[_0x8d5d('0x1a')](function(_0xd67501){if(_0xd67501){_0x52f887[_0x8d5d('0x2d')]=_[_0x8d5d('0x2e')](db[_0x8d5d('0x39')][_0x8d5d('0x23')]);_0x52f887[_0x8d5d('0x29')]=_['keys'](_0x9ac8bc[_0x8d5d('0x29')]);_0x52f887[_0x8d5d('0x3f')]=_[_0x8d5d('0x2f')](_0x52f887[_0x8d5d('0x2d')],_0x52f887['query']);_0x599d9a[_0x8d5d('0x31')]=_[_0x8d5d('0x2f')](_0x52f887[_0x8d5d('0x2d')],qs[_0x8d5d('0x30')](_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x30')]));_0x599d9a[_0x8d5d('0x31')]=_0x599d9a[_0x8d5d('0x31')]['length']?_0x599d9a[_0x8d5d('0x31')]:_0x52f887[_0x8d5d('0x2d')];if(!_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x40')](_0x8d5d('0x41'))){_0x599d9a['limit']=qs[_0x8d5d('0x16')](_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x16')]);_0x599d9a[_0x8d5d('0x15')]=qs[_0x8d5d('0x15')](_0x9ac8bc['query'][_0x8d5d('0x15')]);}_0x599d9a['order']=qs[_0x8d5d('0x42')](_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x42')]);_0x599d9a[_0x8d5d('0x43')]=qs['filters'](_[_0x8d5d('0x44')](_0x9ac8bc['query'],_0x52f887[_0x8d5d('0x3f')]));_0x599d9a[_0x8d5d('0x43')][_0x8d5d('0x45')]=_0xd67501['id'];if(_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x46')]){_0x599d9a['where']=_[_0x8d5d('0x33')](_0x599d9a[_0x8d5d('0x43')],{'$or':_[_0x8d5d('0x21')](_0x599d9a['attributes'],function(_0x301a27){var _0x2dbc0d={};_0x2dbc0d[_0x301a27]={'$like':'%'+_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x46')]+'%'};return _0x2dbc0d;})});}if(_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x47')]){var _0x2d4efc=_0x9ac8bc['query'][_0x8d5d('0x47')]['split'](',');var _0x1dd182={};_0x1dd182[_0x2d4efc[0x0]]={'$gte':moment(_0x2d4efc[0x1])[_0x8d5d('0x48')](_0x8d5d('0x49'))};_0x599d9a[_0x8d5d('0x43')]=_[_0x8d5d('0x33')](_0x599d9a[_0x8d5d('0x43')],_0x1dd182);}_0x599d9a=_['merge']({},_0x599d9a,_0x9ac8bc[_0x8d5d('0x34')]);return db[_0x8d5d('0x39')][_0x8d5d('0x4a')]({'where':_0x599d9a[_0x8d5d('0x43')]})[_0x8d5d('0x1a')](function(_0x13c794){_0x2b46ec['count']=_0x13c794;if(_0x9ac8bc[_0x8d5d('0x29')][_0x8d5d('0x4b')]){_0x599d9a[_0x8d5d('0x4c')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8d5d('0x27')](_0x599d9a);})[_0x8d5d('0x1a')](function(_0x48fa9b){_0x2b46ec[_0x8d5d('0x4d')]=_0x48fa9b;return _0x2b46ec;});}})['then'](respondWithFilteredResult(_0x59e892,_0x599d9a))[_0x8d5d('0x2b')](handleError(_0x59e892,null));};exports[_0x8d5d('0x4e')]=function(_0x20dd08,_0x165371){return db['WhatsappInteraction'][_0x8d5d('0x35')]({'where':{'id':_0x20dd08[_0x8d5d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x165371,null))[_0x8d5d('0x1a')](function(_0x3db5e1){if(_0x3db5e1){return _0x3db5e1[_0x8d5d('0x4f')](_0x20dd08[_0x8d5d('0x37')][_0x8d5d('0x3b')],_['omit'](_0x20dd08[_0x8d5d('0x37')],[_0x8d5d('0x3b'),'id'])||{})['spread'](function(){return db[_0x8d5d('0x50')][_0x8d5d('0x27')]({'attributes':['id',_0x8d5d('0x1e'),_0x8d5d('0x51')],'where':{'id':_0x20dd08[_0x8d5d('0x37')]['ids']}});})[_0x8d5d('0x1a')](function(_0x431453){socket[_0x8d5d('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x20dd08['params']['id']),'tags':_0x431453||[]});return{'id':Number(_0x20dd08[_0x8d5d('0x2c')]['id']),'tags':_0x431453||[]};});}})['then'](respondWithResult(_0x165371,null))[_0x8d5d('0x2b')](handleError(_0x165371,null));};exports[_0x8d5d('0x53')]=function(_0x40a9a2,_0x4effc0){return db[_0x8d5d('0x22')][_0x8d5d('0x35')]({'where':{'id':_0x40a9a2[_0x8d5d('0x2c')]['id']}})[_0x8d5d('0x1a')](handleEntityNotFound(_0x4effc0,null))['then'](function(_0x13ffef){if(_0x13ffef){return _0x13ffef[_0x8d5d('0x53')](_0x40a9a2[_0x8d5d('0x29')]['ids']);}})[_0x8d5d('0x1a')](respondWithStatusCode(_0x4effc0,null))[_0x8d5d('0x2b')](handleError(_0x4effc0,null));};exports[_0x8d5d('0x54')]=function(_0x1a4994,_0x2ad917){var _0x4f5904=moment()['unix']()[_0x8d5d('0x55')]();var _0x4c6010=path[_0x8d5d('0x56')](config[_0x8d5d('0x57')],'server',_0x8d5d('0x58'),_0x8d5d('0x59'));var _0x221e4f=path[_0x8d5d('0x56')](config['root'],_0x8d5d('0x5a'),_0x8d5d('0x58'),_0x8d5d('0x5b'));var _0x370b88=path['join'](_0x4c6010,_0x4f5904);var _0x502968=util[_0x8d5d('0x48')](_0x8d5d('0x5c'),_0x1a4994[_0x8d5d('0x2c')]['id'],_0x4f5904);var _0x3b90ea=path['join'](_0x4c6010,_0x502968);var _0xf439a0=[];_0xf439a0['push']({'model':db['User'],'as':_0x8d5d('0x5d'),'attributes':['id',_0x8d5d('0x5e')],'raw':!![]});_0xf439a0[_0x8d5d('0x5f')]({'model':db['CmContact'],'as':_0x8d5d('0x60'),'attributes':['id',_0x8d5d('0x61'),_0x8d5d('0x62')],'raw':!![]});if(_0x1a4994[_0x8d5d('0x29')][_0x8d5d('0x5b')]){_0xf439a0[_0x8d5d('0x5f')]({'model':db[_0x8d5d('0x63')],'as':_0x8d5d('0x63'),'raw':!![]});}var _0x52ca0b=[{'model':db['WhatsappMessage'],'as':_0x8d5d('0x64'),'attributes':['id',_0x8d5d('0x37'),_0x8d5d('0x65'),_0x8d5d('0x66'),_0x8d5d('0x67'),'read'],'include':_0xf439a0}];_0x52ca0b[_0x8d5d('0x5f')]({'model':db[_0x8d5d('0x68')],'as':'Account','attributes':['id',_0x8d5d('0x1e')]});_0x52ca0b[_0x8d5d('0x5f')]({'model':db[_0x8d5d('0x5d')],'as':'Owner','attributes':['id',_0x8d5d('0x5e')]});return db[_0x8d5d('0x22')]['find']({'where':{'id':_0x1a4994[_0x8d5d('0x2c')]['id']},'include':_0x52ca0b})[_0x8d5d('0x1a')](handleEntityNotFound(_0x2ad917,null))['then'](function(_0x55c830){if(_0x55c830){var _0x49862f=_0x55c830[_0x8d5d('0x69')]({'plain':!![]});fs[_0x8d5d('0x6a')](_0x370b88);var _0x708231={'channel':_0x8d5d('0x6b'),'account':_0x49862f['Account']['name'],'agent':_0x49862f[_0x8d5d('0x6c')]?_0x49862f['Owner']['fullname']:_0x8d5d('0x6d'),'createdAt':moment(_0x49862f['createdAt'])[_0x8d5d('0x48')](_0x8d5d('0x49'))[_0x8d5d('0x55')](),'closedAt':_0x49862f[_0x8d5d('0x6e')]?moment(_0x49862f[_0x8d5d('0x6f')])[_0x8d5d('0x48')](_0x8d5d('0x49'))[_0x8d5d('0x55')]():'','disposition':_0x49862f[_0x8d5d('0x70')],'messages':_(_0x49862f[_0x8d5d('0x64')])[_0x8d5d('0x46')]({'secret':![]})[_0x8d5d('0x21')](function(_0x311e84){if(_0x311e84[_0x8d5d('0x63')]){var _0x4bf77e=path[_0x8d5d('0x56')](_0x221e4f,_0x311e84[_0x8d5d('0x63')][_0x8d5d('0x71')]);if(fs[_0x8d5d('0x72')](_0x4bf77e)){fs['createReadStream'](_0x4bf77e)['pipe'](fs[_0x8d5d('0x73')](path['join'](_0x370b88,_0x311e84[_0x8d5d('0x63')][_0x8d5d('0x71')])));}}return{'date':moment(_0x311e84[_0x8d5d('0x65')])['format'](_0x8d5d('0x49'))[_0x8d5d('0x55')](),'sender':_0x311e84[_0x8d5d('0x66')]==='out'?_0x311e84[_0x8d5d('0x5d')]?_0x311e84[_0x8d5d('0x5d')][_0x8d5d('0x5e')]:_0x8d5d('0x74'):_0x311e84['Contact'][_0x8d5d('0x61')]+(_0x311e84['Contact'][_0x8d5d('0x62')]?'\x20'+_0x311e84[_0x8d5d('0x60')][_0x8d5d('0x62')]:''),'body':_0x311e84[_0x8d5d('0x63')]?_0x311e84[_0x8d5d('0x63')]['basename']:_0x311e84[_0x8d5d('0x37')],'direction':_0x311e84[_0x8d5d('0x66')]==='out'?'A':'C','secret':_0x311e84[_0x8d5d('0x67')],'read':_0x311e84['read'],'attachment':_0x311e84[_0x8d5d('0x63')]};})[_0x8d5d('0x75')]()};return ejs['renderFile'](path[_0x8d5d('0x56')](config['root'],_0x8d5d('0x5a'),'views',_0x8d5d('0x76')),{'interaction':_0x708231})[_0x8d5d('0x1a')](function(_0x2b9c2c){var _0x3e804f=path['join'](_0x370b88,_0x8d5d('0x77')+_0x49862f['id']+'-'+_0x4f5904+_0x8d5d('0x78'));var _0x4087af={'path':_0x3e804f,'channel':'Whatsapp','interactionId':_0x49862f['id']};return pdf['createPdfFromHTML'](_0x2b9c2c,_0x4087af);})[_0x8d5d('0x1a')](function(){return new BPromise(function(_0x37d5cb,_0x48a370){zipdir(_0x370b88,{'saveTo':_0x3b90ea},function(_0x3d8169,_0xf1a371){if(_0x3d8169)return _0x48a370(_0x3d8169);return _0x37d5cb(_0xf1a371);});})[_0x8d5d('0x1a')](function(){return new BPromise(function(_0x208d18,_0x5677ef){rimraf(_0x370b88,function(_0x385ecc){if(_0x385ecc)_0x5677ef(_0x385ecc);return _0x208d18();});});})[_0x8d5d('0x1a')](function(){return _0x2ad917[_0x8d5d('0x54')](_0x3b90ea,_0x502968,function(_0x1554c1){if(_0x1554c1){console[_0x8d5d('0x79')]('err',_0x1554c1);}else{fs[_0x8d5d('0x7a')](_0x3b90ea);}});});});}else{return _0x2ad917['sendStatus'](0xc8);}})['catch'](handleError(_0x2ad917,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index df69513..e1805d9 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 _0xcbe1=['update','then','setDataValue','Users','map','findAll','length','emit','catch','hook','../../mysqldb','save'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0xe2c665,_0x5467a0){_0xe2c665=_0xe2c665-0x0;var _0x5bcbb7=_0xcbe1[_0xe2c665];return _0x5bcbb7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1cbe('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cbe('0x1'),'afterUpdate':_0x1cbe('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ba56c){return function(_0x563162,_0x940654,_0x168121){_0x563162['getUsers']({'attributes':['id'],'raw':!![]})[_0x1cbe('0x3')](function(_0x21342a){_0x563162[_0x1cbe('0x4')](_0x1cbe('0x5'),_0x21342a[_0x1cbe('0x6')](function(_0x3e72a0){return{'id':_0x3e72a0['id']};}));return WhatsappMessage[_0x1cbe('0x7')]({'where':{'WhatsappInteractionId':_0x563162['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cbe('0x3')](function(_0x5af288){_0x563162[_0x1cbe('0x4')]('unreadMessages',_0x5af288[_0x1cbe('0x8')]);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c+':'+_0x563162['id'],_0x563162);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c,_0x563162);_0x168121(null);})[_0x1cbe('0xa')](_0x168121(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1cbe('0xb')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x4e5c=['emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x218143,_0xecf86f){var _0x300796=function(_0x471050){while(--_0x471050){_0x218143['push'](_0x218143['shift']());}};_0x300796(++_0xecf86f);}(_0x4e5c,0x149));var _0xc4e5=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x4e5c[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0xc4e5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xc4e5('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xc4e5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc4e5('0x3')](0x0);var events={'afterCreate':_0xc4e5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ecd96){return function(_0x2897d3,_0x36da77,_0x3b4b2c){_0x2897d3[_0xc4e5('0x5')]({'attributes':['id'],'raw':!![]})[_0xc4e5('0x6')](function(_0x1a7dac){_0x2897d3[_0xc4e5('0x7')](_0xc4e5('0x8'),_0x1a7dac[_0xc4e5('0x9')](function(_0x1b165d){return{'id':_0x1b165d['id']};}));return WhatsappMessage[_0xc4e5('0xa')]({'where':{'WhatsappInteractionId':_0x2897d3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc4e5('0x6')](function(_0x47f71b){_0x2897d3[_0xc4e5('0x7')](_0xc4e5('0xb'),_0x47f71b[_0xc4e5('0xc')]);WhatsappInteractionEvents[_0xc4e5('0xd')](_0x4ecd96+':'+_0x2897d3['id'],_0x2897d3);WhatsappInteractionEvents['emit'](_0x4ecd96,_0x2897d3);_0x3b4b2c(null);})[_0xc4e5('0xe')](_0x3b4b2c(null));};}for(var e in events){if(events[_0xc4e5('0xf')](e)){var event=events[e];WhatsappInteraction[_0xc4e5('0x10')](e,emitEvent(event));}}module[_0xc4e5('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 72dbf1f..67cd971 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 _0xf944=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x175a95,_0x5c9701){var _0x39e134=function(_0x48d93f){while(--_0x48d93f){_0x175a95['push'](_0x175a95['shift']());}};_0x39e134(++_0x5c9701);}(_0xf944,0x1a9));var _0x4f94=function(_0xd04bfe,_0x4307b7){_0xd04bfe=_0xd04bfe-0x0;var _0x44d6f9=_0xf944[_0xd04bfe];return _0x44d6f9;};'use strict';var _=require(_0x4f94('0x0'));var util=require(_0x4f94('0x1'));var logger=require('../../config/logger')(_0x4f94('0x2'));var moment=require(_0x4f94('0x3'));var BPromise=require(_0x4f94('0x4'));var rp=require(_0x4f94('0x5'));var fs=require('fs');var path=require(_0x4f94('0x6'));var rimraf=require('rimraf');var config=require(_0x4f94('0x7'));var attributes=require(_0x4f94('0x8'));module['exports']=function(_0x114068,_0x2a80d7){return _0x114068[_0x4f94('0x9')](_0x4f94('0xa'),attributes,{'tableName':_0x4f94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34e65a,_0x17a608,_0x5ba50a){if(_0x34e65a[_0x4f94('0xc')](_0x4f94('0xd'))){_0x34e65a[_0x4f94('0xe')]=moment()[_0x4f94('0xf')](_0x4f94('0x10'));}_0x5ba50a(null,_0x34e65a);}}});}; \ No newline at end of file +var _0x8db2=['./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x8db2,0x12d));var _0x28db=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x8db2[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x28db('0x0'));var util=require(_0x28db('0x1'));var logger=require('../../config/logger')(_0x28db('0x2'));var moment=require(_0x28db('0x3'));var BPromise=require(_0x28db('0x4'));var rp=require(_0x28db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x28db('0x6'));var attributes=require(_0x28db('0x7'));module['exports']=function(_0x33a886,_0x274ab3){return _0x33a886[_0x28db('0x8')](_0x28db('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28bb8e,_0x423960,_0x2bb057){if(_0x28bb8e[_0x28db('0xa')](_0x28db('0xb'))){_0x28bb8e[_0x28db('0xc')]=moment()['format'](_0x28db('0xd'));}_0x2bb057(null,_0x28bb8e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 85a51df..bdc6b3f 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 _0x8305=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x324720,_0x57ef04){var _0x5a6b14=function(_0x59b309){while(--_0x59b309){_0x324720['push'](_0x324720['shift']());}};_0x5a6b14(++_0x57ef04);}(_0x8305,0x1d3));var _0x5830=function(_0x11cf50,_0x5e60e2){_0x11cf50=_0x11cf50-0x0;var _0x11da0f=_0x8305[_0x11cf50];return _0x11da0f;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5830('0x9')],{'host':_0x5830('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5830('0x9')]));require(_0x5830('0xb'))[_0x5830('0xc')](socket);function respondWithRpcPromise(_0x55658a,_0x24f6e0,_0x589979){return new BPromise(function(_0x2ac30f,_0x48773e){return client['request'](_0x55658a,_0x589979)['then'](function(_0x1c0f70){logger[_0x5830('0xd')](_0x5830('0xe'),_0x24f6e0,_0x5830('0xf'));logger[_0x5830('0x10')](_0x5830('0x11'),_0x24f6e0,_0x5830('0xf'),JSON[_0x5830('0x12')](_0x1c0f70));if(_0x1c0f70[_0x5830('0x13')]){if(_0x1c0f70[_0x5830('0x13')][_0x5830('0x14')]===0x1f4){logger[_0x5830('0x13')](_0x5830('0xe'),_0x24f6e0,_0x1c0f70[_0x5830('0x13')]['message']);return _0x48773e(_0x1c0f70[_0x5830('0x13')]['message']);}logger[_0x5830('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x24f6e0,_0x1c0f70[_0x5830('0x13')][_0x5830('0x15')]);return _0x2ac30f(_0x1c0f70[_0x5830('0x13')]['message']);}else{logger[_0x5830('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x24f6e0,_0x5830('0xf'));_0x2ac30f(_0x1c0f70['result'][_0x5830('0x15')]);}})[_0x5830('0x16')](function(_0xf70922){logger['error'](_0x5830('0xe'),_0x24f6e0,_0xf70922);_0x48773e(_0xf70922);});});}exports[_0x5830('0x17')]=function(_0x2c3526){var _0x2e710f=this;return new Promise(function(_0x94fa55,_0x155c22){return db[_0x5830('0x18')][_0x5830('0x19')](_0x2c3526[_0x5830('0x1a')],{'raw':_0x2c3526[_0x5830('0x1b')]?_0x2c3526['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1c')]||null:null,'attributes':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1d')]||null:null,'limit':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1e')]||null:null})[_0x5830('0x1f')](function(_0x1fcf2f){logger[_0x5830('0xd')](_0x5830('0x17'),_0x2c3526);logger[_0x5830('0x10')](_0x5830('0x17'),_0x2c3526,JSON[_0x5830('0x12')](_0x1fcf2f));_0x94fa55(_0x1fcf2f);})[_0x5830('0x16')](function(_0x4ffa39){logger[_0x5830('0x13')](_0x5830('0x17'),_0x4ffa39[_0x5830('0x15')],_0x2c3526);_0x155c22(_0x2e710f[_0x5830('0x13')](0x1f4,_0x4ffa39[_0x5830('0x15')]));});});};exports[_0x5830('0x20')]=function(_0x383e40){return new Promise(function(_0x38b381,_0x5e3345){return db[_0x5830('0x18')][_0x5830('0x21')]({'where':_0x383e40[_0x5830('0x1b')]?_0x383e40['options']['where']||null:null})[_0x5830('0x1f')](function(_0x5a5ed5){if(_0x5a5ed5){return _0x5a5ed5[_0x5830('0x22')](_0x383e40[_0x5830('0x1a')][_0x5830('0x23')],_[_0x5830('0x24')](_0x383e40[_0x5830('0x1a')],[_0x5830('0x23'),'id'])||{});}})[_0x5830('0x25')](function(_0x59db5a){logger[_0x5830('0xd')](_0x5830('0x26'),_0x383e40);logger[_0x5830('0x10')](_0x5830('0x26'),_0x383e40,JSON[_0x5830('0x12')](_0x59db5a));_0x38b381(_0x59db5a);})[_0x5830('0x16')](function(_0x367438){logger[_0x5830('0x13')](_0x5830('0x26'),_0x367438[_0x5830('0x15')],_0x383e40);_0x5e3345(_this[_0x5830('0x13')](0x1f4,_0x367438[_0x5830('0x15')]));});});}; \ No newline at end of file +var _0x6f51=['update','body','options','where','limit','then','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x38399c,_0x5eb6c3){var _0x42f19c=function(_0x47b0c7){while(--_0x47b0c7){_0x38399c['push'](_0x38399c['shift']());}};_0x42f19c(++_0x5eb6c3);}(_0x6f51,0x164));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x16f5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16f5('0x1'));var rs=require(_0x16f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16f5('0x3'));var config=require(_0x16f5('0x4'));var jayson=require(_0x16f5('0x5'));var client=jayson[_0x16f5('0x6')]['http']({'port':0x232a});config[_0x16f5('0x7')]=_[_0x16f5('0x8')](config[_0x16f5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x16f5('0x9'))(new Redis(config['redis']));require(_0x16f5('0xa'))[_0x16f5('0xb')](socket);function respondWithRpcPromise(_0x28ecb0,_0x2c7464,_0x16b875){return new BPromise(function(_0x42697f,_0x36abcc){return client[_0x16f5('0xc')](_0x28ecb0,_0x16b875)['then'](function(_0x294674){logger[_0x16f5('0xd')](_0x16f5('0xe'),_0x2c7464,_0x16f5('0xf'));logger['debug'](_0x16f5('0x10'),_0x2c7464,_0x16f5('0xf'),JSON[_0x16f5('0x11')](_0x294674));if(_0x294674[_0x16f5('0x12')]){if(_0x294674[_0x16f5('0x12')]['code']===0x1f4){logger[_0x16f5('0x12')](_0x16f5('0xe'),_0x2c7464,_0x294674['error'][_0x16f5('0x13')]);return _0x36abcc(_0x294674[_0x16f5('0x12')][_0x16f5('0x13')]);}logger[_0x16f5('0x12')](_0x16f5('0xe'),_0x2c7464,_0x294674[_0x16f5('0x12')][_0x16f5('0x13')]);return _0x42697f(_0x294674[_0x16f5('0x12')][_0x16f5('0x13')]);}else{logger[_0x16f5('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c7464,'request\x20sent');_0x42697f(_0x294674[_0x16f5('0x14')][_0x16f5('0x13')]);}})[_0x16f5('0x15')](function(_0x522e31){logger[_0x16f5('0x12')](_0x16f5('0xe'),_0x2c7464,_0x522e31);_0x36abcc(_0x522e31);});});}exports[_0x16f5('0x16')]=function(_0x1ce4a1){var _0x5101e4=this;return new Promise(function(_0x4bf139,_0x4c5f50){return db[_0x16f5('0x17')][_0x16f5('0x18')](_0x1ce4a1[_0x16f5('0x19')],{'raw':_0x1ce4a1[_0x16f5('0x1a')]?_0x1ce4a1[_0x16f5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce4a1[_0x16f5('0x1a')]?_0x1ce4a1[_0x16f5('0x1a')][_0x16f5('0x1b')]||null:null,'attributes':_0x1ce4a1['options']?_0x1ce4a1[_0x16f5('0x1a')]['attributes']||null:null,'limit':_0x1ce4a1[_0x16f5('0x1a')]?_0x1ce4a1[_0x16f5('0x1a')][_0x16f5('0x1c')]||null:null})[_0x16f5('0x1d')](function(_0x214808){logger['info'](_0x16f5('0x16'),_0x1ce4a1);logger['debug'](_0x16f5('0x16'),_0x1ce4a1,JSON['stringify'](_0x214808));_0x4bf139(_0x214808);})[_0x16f5('0x15')](function(_0x14eec9){logger['error'](_0x16f5('0x16'),_0x14eec9[_0x16f5('0x13')],_0x1ce4a1);_0x4c5f50(_0x5101e4[_0x16f5('0x12')](0x1f4,_0x14eec9[_0x16f5('0x13')]));});});};exports[_0x16f5('0x1e')]=function(_0x1ad4fd){return new Promise(function(_0x41d975,_0x10cd80){return db['WhatsappInteraction'][_0x16f5('0x1f')]({'where':_0x1ad4fd[_0x16f5('0x1a')]?_0x1ad4fd['options'][_0x16f5('0x1b')]||null:null})[_0x16f5('0x1d')](function(_0x4889a1){if(_0x4889a1){return _0x4889a1[_0x16f5('0x20')](_0x1ad4fd[_0x16f5('0x19')][_0x16f5('0x21')],_[_0x16f5('0x22')](_0x1ad4fd[_0x16f5('0x19')],['ids','id'])||{});}})[_0x16f5('0x23')](function(_0x374f9a){logger[_0x16f5('0xd')](_0x16f5('0x24'),_0x1ad4fd);logger[_0x16f5('0x25')](_0x16f5('0x24'),_0x1ad4fd,JSON[_0x16f5('0x11')](_0x374f9a));_0x41d975(_0x374f9a);})[_0x16f5('0x15')](function(_0x2fb15f){logger[_0x16f5('0x12')](_0x16f5('0x24'),_0x2fb15f[_0x16f5('0x13')],_0x1ad4fd);_0x10cd80(_this[_0x16f5('0x12')](0x1f4,_0x2fb15f[_0x16f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6253b28..2785b72 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 _0x5232=['removeListener','register','./whatsappInteraction.events','save','remove','emit'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x5232,0xf2));var _0x2523=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x5232[_0xd1b4d7];return _0x3002ec;};'use strict';var WhatsappInteractionEvents=require(_0x2523('0x0'));var events=[_0x2523('0x1'),_0x2523('0x2'),'update'];function createListener(_0x40a780,_0x2fbadf){return function(_0x53dd79){_0x2fbadf[_0x2523('0x3')](_0x40a780,_0x53dd79);};}function removeListener(_0x40a06c,_0xc3a045){return function(){WhatsappInteractionEvents[_0x2523('0x4')](_0x40a06c,_0xc3a045);};}exports[_0x2523('0x5')]=function(_0x3009b5){for(var _0x48d18e=0x0,_0x1a13f5=events['length'];_0x48d18e<_0x1a13f5;_0x48d18e++){var _0x5601c5=events[_0x48d18e];var _0x328164=createListener('whatsappInteraction:'+_0x5601c5,_0x3009b5);WhatsappInteractionEvents['on'](_0x5601c5,_0x328164);}}; \ No newline at end of file +var _0x3095=['remove','update','emit','removeListener','register','./whatsappInteraction.events','save'];(function(_0x217620,_0x341eef){var _0x4c35cf=function(_0x19f591){while(--_0x19f591){_0x217620['push'](_0x217620['shift']());}};_0x4c35cf(++_0x341eef);}(_0x3095,0x67));var _0x5309=function(_0x526bbe,_0x4b63a2){_0x526bbe=_0x526bbe-0x0;var _0x5c74fc=_0x3095[_0x526bbe];return _0x5c74fc;};'use strict';var WhatsappInteractionEvents=require(_0x5309('0x0'));var events=[_0x5309('0x1'),_0x5309('0x2'),_0x5309('0x3')];function createListener(_0x240179,_0xa97c8d){return function(_0x1b727f){_0xa97c8d[_0x5309('0x4')](_0x240179,_0x1b727f);};}function removeListener(_0x5bff95,_0x135c93){return function(){WhatsappInteractionEvents[_0x5309('0x5')](_0x5bff95,_0x135c93);};}exports[_0x5309('0x6')]=function(_0x1e77ce){for(var _0x1a730c=0x0,_0x60cf3c=events['length'];_0x1a730c<_0x60cf3c;_0x1a730c++){var _0x1c7d59=events[_0x1a730c];var _0x1f1c21=createListener('whatsappInteraction:'+_0x1c7d59,_0x1e77ce);WhatsappInteractionEvents['on'](_0x1c7d59,_0x1f1c21);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a071e79..02586fe 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 _0xb904=['/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x2992cb,_0x102ca6){var _0x499699=function(_0x25d001){while(--_0x25d001){_0x2992cb['push'](_0x2992cb['shift']());}};_0x499699(++_0x102ca6);}(_0xb904,0xcf));var _0x4b90=function(_0x180c86,_0x36de15){_0x180c86=_0x180c86-0x0;var _0x37a672=_0xb904[_0x180c86];return _0x37a672;};'use strict';var multer=require(_0x4b90('0x0'));var util=require('util');var path=require(_0x4b90('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b90('0x2'));var router=express[_0x4b90('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b90('0x4'));var config=require(_0x4b90('0x5'));var controller=require(_0x4b90('0x6'));router[_0x4b90('0x7')]('/',auth[_0x4b90('0x8')](),controller['index']);router[_0x4b90('0x7')](_0x4b90('0x9'),auth[_0x4b90('0x8')](),controller[_0x4b90('0xa')]);router[_0x4b90('0x7')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0xc')]);router[_0x4b90('0xd')]('/',auth[_0x4b90('0x8')](),interaction[_0x4b90('0xe')](_0x4b90('0xf'),_0x4b90('0x10')),controller[_0x4b90('0x11')]);router[_0x4b90('0xd')]('/:id/status',controller['status']);router[_0x4b90('0x12')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x13')]);router[_0x4b90('0x12')](_0x4b90('0x14'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x15')]);router[_0x4b90('0x12')](_0x4b90('0x16'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x17')]);router[_0x4b90('0x18')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x19')]);module[_0x4b90('0x1a')]=router; \ No newline at end of file +var _0x0f40=['/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x1b8c37,_0x424a3f){var _0x214f5e=function(_0x1d1485){while(--_0x1d1485){_0x1b8c37['push'](_0x1b8c37['shift']());}};_0x214f5e(++_0x424a3f);}(_0x0f40,0xb9));var _0x00f4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0f40[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x00f4('0x0'));var util=require(_0x00f4('0x1'));var path=require(_0x00f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x00f4('0x3'));var router=express['Router']();var fs_extra=require(_0x00f4('0x4'));var auth=require(_0x00f4('0x5'));var interaction=require(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var controller=require(_0x00f4('0x8'));router[_0x00f4('0x9')]('/',auth[_0x00f4('0xa')](),controller['index']);router[_0x00f4('0x9')](_0x00f4('0xb'),auth['isAuthenticated'](),controller[_0x00f4('0xc')]);router[_0x00f4('0x9')](_0x00f4('0xd'),auth['isAuthenticated'](),controller[_0x00f4('0xe')]);router[_0x00f4('0xf')]('/',auth['isAuthenticated'](),interaction[_0x00f4('0x10')](_0x00f4('0x11'),_0x00f4('0x12')),controller[_0x00f4('0x13')]);router[_0x00f4('0xf')](_0x00f4('0x14'),controller[_0x00f4('0x15')]);router[_0x00f4('0x16')](_0x00f4('0xd'),auth[_0x00f4('0xa')](),controller['update']);router[_0x00f4('0x16')](_0x00f4('0x17'),auth[_0x00f4('0xa')](),controller['accept']);router['put'](_0x00f4('0x18'),auth[_0x00f4('0xa')](),controller[_0x00f4('0x19')]);router[_0x00f4('0x1a')]('/:id',auth[_0x00f4('0xa')](),controller[_0x00f4('0x1b')]);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 c238344..66ac0f3 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 _0x4c50=['BOOLEAN','exports','TEXT','medium','out','STRING'];(function(_0x57a5da,_0x445680){var _0x37fde7=function(_0x157d23){while(--_0x157d23){_0x57a5da['push'](_0x57a5da['shift']());}};_0x37fde7(++_0x445680);}(_0x4c50,0xf7));var _0x04c5=function(_0xb8db3e,_0x1efca5){_0xb8db3e=_0xb8db3e-0x0;var _0x52b0ee=_0x4c50[_0xb8db3e];return _0x52b0ee;};'use strict';var Sequelize=require('sequelize');module[_0x04c5('0x0')]={'body':{'type':Sequelize[_0x04c5('0x1')](_0x04c5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x04c5('0x3')),'defaultValue':_0x04c5('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x04c5('0x4')](0xbe)},'phone':{'type':Sequelize[_0x04c5('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x04c5('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x04c5('0x4')]},'providerResponse':{'type':Sequelize[_0x04c5('0x1')]}}; \ No newline at end of file +var _0x221f=['BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x1f930e,_0x24c403){var _0x5bfa2b=function(_0x2e4893){while(--_0x2e4893){_0x1f930e['push'](_0x1f930e['shift']());}};_0x5bfa2b(++_0x24c403);}(_0x221f,0x14e));var _0xf221=function(_0x170b20,_0x49fc52){_0x170b20=_0x170b20-0x0;var _0xbe0395=_0x221f[_0x170b20];return _0xbe0395;};'use strict';var Sequelize=require(_0xf221('0x0'));module[_0xf221('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf221('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf221('0x3')]('in',_0xf221('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf221('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xf221('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf221('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index bde011f..afd5762 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 _0x9960=['hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','WhatsappMessage','includeAll','include','findAll','rows','show','rawAttributes','options','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE: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','SELECT','User','fullname','email','manual','interface','SIP/%s','event','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','channel','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9960,0x1e3));var _0x0996=function(_0x3c5445,_0x450cbb){_0x3c5445=_0x3c5445-0x0;var _0xda5931=_0x9960[_0x3c5445];return _0xda5931;};'use strict';var emlformat=require(_0x0996('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0996('0x1'));var jsonpatch=require(_0x0996('0x2'));var rp=require(_0x0996('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0996('0x4'));var util=require(_0x0996('0x5'));var path=require(_0x0996('0x6'));var sox=require('sox');var csv=require(_0x0996('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0996('0x8'));var _=require('lodash');var squel=require(_0x0996('0x9'));var crypto=require(_0x0996('0xa'));var jsforce=require(_0x0996('0xb'));var deskjs=require(_0x0996('0xc'));var toCsv=require(_0x0996('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0996('0xd'));var authService=require(_0x0996('0xe'));var qs=require(_0x0996('0xf'));var as=require(_0x0996('0x10'));var hardwareService=require(_0x0996('0x11'));var logger=require(_0x0996('0x12'))('api');var utils=require(_0x0996('0x13'));var config=require(_0x0996('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0996('0x15')]=_[_0x0996('0x16')](config[_0x0996('0x15')],{'host':_0x0996('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0996('0x15')]));require('./whatsappMessage.socket')[_0x0996('0x18')](socket);var jayson=require(_0x0996('0x19'));var client=jayson[_0x0996('0x1a')][_0x0996('0x1b')]({'port':0x232c});var client9002=jayson[_0x0996('0x1a')][_0x0996('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e138c,_0x5c460a,_0x1d3ff3,_0x584334){return new BPromise(function(_0x19bb7f,_0x6aa0eb){var _0x597379=_0x584334||client;return _0x597379[_0x0996('0x1c')](_0x3e138c,_0x1d3ff3)['then'](function(_0x11ba1c){logger[_0x0996('0x1d')](_0x0996('0x1e'),_0x5c460a,_0x0996('0x1f'));logger[_0x0996('0x20')](_0x0996('0x21'),_0x5c460a,_0x0996('0x1f'),JSON['stringify'](_0x11ba1c));if(_0x11ba1c[_0x0996('0x22')]){if(_0x11ba1c[_0x0996('0x22')]['code']===0x1f4){logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x11ba1c[_0x0996('0x22')]['message']);return _0x6aa0eb(_0x11ba1c[_0x0996('0x22')][_0x0996('0x23')]);}logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x11ba1c['error'][_0x0996('0x23')]);return _0x19bb7f(_0x11ba1c[_0x0996('0x22')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5c460a,'request\x20sent');_0x19bb7f(_0x11ba1c[_0x0996('0x24')][_0x0996('0x23')]);}})[_0x0996('0x25')](function(_0x4b4184){logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x4b4184);_0x6aa0eb(_0x4b4184);});});}function respondWithStatusCode(_0x5af04f,_0x28dbc8){_0x28dbc8=_0x28dbc8||0xcc;return function(_0x3f4223){if(_0x3f4223){return _0x5af04f[_0x0996('0x26')](_0x28dbc8);}return _0x5af04f[_0x0996('0x27')](_0x28dbc8)[_0x0996('0x28')]();};}function respondWithResult(_0x30a7d0,_0x28a45f){_0x28a45f=_0x28a45f||0xc8;return function(_0x622978){if(_0x622978){return _0x30a7d0[_0x0996('0x27')](_0x28a45f)[_0x0996('0x29')](_0x622978);}};}function respondWithFilteredResult(_0x542683,_0x56a71d){return function(_0xac42e){if(_0xac42e){var _0x1289bd=typeof _0x56a71d[_0x0996('0x2a')]==='undefined'&&typeof _0x56a71d['limit']===_0x0996('0x2b');var _0x15bca2=_0xac42e['count'];var _0x1bcf1e=_0x1289bd?0x0:_0x56a71d['offset'];var _0x144ef3=_0x1289bd?_0xac42e[_0x0996('0x2c')]:_0x56a71d['offset']+_0x56a71d[_0x0996('0x2d')];var _0x768a0d;if(_0x144ef3>=_0x15bca2){_0x144ef3=_0x15bca2;_0x768a0d=0xc8;}else{_0x768a0d=0xce;}_0x542683[_0x0996('0x27')](_0x768a0d);return _0x542683['set']('Content-Range',_0x1bcf1e+'-'+_0x144ef3+'/'+_0x15bca2)[_0x0996('0x29')](_0xac42e);}return null;};}function patchUpdates(_0x559066){return function(_0x13fe89){try{jsonpatch[_0x0996('0x2e')](_0x13fe89,_0x559066,!![]);}catch(_0xeb14d3){return BPromise[_0x0996('0x2f')](_0xeb14d3);}return _0x13fe89['save']();};}function saveUpdates(_0x59fe69,_0x149b80){return function(_0x59309a){if(_0x59309a){return _0x59309a[_0x0996('0x30')](_0x59fe69)[_0x0996('0x31')](function(_0x56a0fd){return _0x56a0fd;});}return null;};}function removeEntity(_0x4c275c,_0x123307){return function(_0x3de867){if(_0x3de867){return _0x3de867[_0x0996('0x32')]()[_0x0996('0x31')](function(){_0x4c275c['status'](0xcc)[_0x0996('0x28')]();});}};}function handleEntityNotFound(_0x38c894,_0x50769){return function(_0xa599e0){if(!_0xa599e0){_0x38c894[_0x0996('0x26')](0x194);}return _0xa599e0;};}function handleError(_0x1cafae,_0x348570){_0x348570=_0x348570||0x1f4;return function(_0x1dde45){logger[_0x0996('0x22')](_0x1dde45[_0x0996('0x33')]);if(_0x1dde45[_0x0996('0x34')]){delete _0x1dde45['name'];}_0x1cafae[_0x0996('0x27')](_0x348570)[_0x0996('0x35')](_0x1dde45);};}exports[_0x0996('0x36')]=function(_0x1b0e1f,_0x3975a8){var _0x3f25d5={},_0x3c961d={},_0x36f3be={'count':0x0,'rows':[]};var _0x277d94=_[_0x0996('0x37')](db['WhatsappMessage']['rawAttributes'],function(_0x2e0f84){return{'name':_0x2e0f84['fieldName'],'type':_0x2e0f84[_0x0996('0x38')][_0x0996('0x39')]};});_0x3c961d['model']=_[_0x0996('0x37')](_0x277d94,'name');_0x3c961d[_0x0996('0x3a')]=_['keys'](_0x1b0e1f[_0x0996('0x3a')]);_0x3c961d[_0x0996('0x3b')]=_[_0x0996('0x3c')](_0x3c961d[_0x0996('0x3d')],_0x3c961d[_0x0996('0x3a')]);_0x3f25d5[_0x0996('0x3e')]=_[_0x0996('0x3c')](_0x3c961d[_0x0996('0x3d')],qs[_0x0996('0x3f')](_0x1b0e1f[_0x0996('0x3a')]['fields']));_0x3f25d5[_0x0996('0x3e')]=_0x3f25d5['attributes'][_0x0996('0x40')]?_0x3f25d5['attributes']:_0x3c961d[_0x0996('0x3d')];if(!_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x41')](_0x0996('0x42'))){_0x3f25d5[_0x0996('0x2d')]=qs['limit'](_0x1b0e1f['query'][_0x0996('0x2d')]);_0x3f25d5[_0x0996('0x2a')]=qs[_0x0996('0x2a')](_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x2a')]);}_0x3f25d5[_0x0996('0x43')]=qs[_0x0996('0x44')](_0x1b0e1f['query'][_0x0996('0x44')]);_0x3f25d5['where']=qs['filters'](_['pick'](_0x1b0e1f[_0x0996('0x3a')],_0x3c961d[_0x0996('0x3b')]),_0x277d94);if(_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x45')]){_0x3f25d5[_0x0996('0x46')]=_[_0x0996('0x47')](_0x3f25d5[_0x0996('0x46')],{'$or':_[_0x0996('0x37')](_0x277d94,function(_0x579f0d){if(_0x579f0d[_0x0996('0x38')]!==_0x0996('0x48')){var _0x3527e0={};_0x3527e0[_0x579f0d['name']]={'$like':'%'+_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x45')]+'%'};return _0x3527e0;}})});}_0x3f25d5=_[_0x0996('0x47')]({},_0x3f25d5,_0x1b0e1f['options']);var _0x226b70={'where':_0x3f25d5[_0x0996('0x46')]};return db[_0x0996('0x49')][_0x0996('0x2c')](_0x226b70)['then'](function(_0x3fc3a0){_0x36f3be[_0x0996('0x2c')]=_0x3fc3a0;if(_0x1b0e1f['query'][_0x0996('0x4a')]){_0x3f25d5[_0x0996('0x4b')]=[{'all':!![]}];}return db[_0x0996('0x49')][_0x0996('0x4c')](_0x3f25d5);})[_0x0996('0x31')](function(_0x4cd736){_0x36f3be[_0x0996('0x4d')]=_0x4cd736;return _0x36f3be;})[_0x0996('0x31')](respondWithFilteredResult(_0x3975a8,_0x3f25d5))[_0x0996('0x25')](handleError(_0x3975a8,null));};exports[_0x0996('0x4e')]=function(_0xaec0ad,_0x518d55){var _0x5b6b2a={'raw':!![],'where':{'id':_0xaec0ad['params']['id']}},_0x1e7920={};_0x1e7920[_0x0996('0x3d')]=_['keys'](db[_0x0996('0x49')][_0x0996('0x4f')]);_0x1e7920[_0x0996('0x3a')]=_['keys'](_0xaec0ad[_0x0996('0x3a')]);_0x1e7920[_0x0996('0x3b')]=_[_0x0996('0x3c')](_0x1e7920[_0x0996('0x3d')],_0x1e7920[_0x0996('0x3a')]);_0x5b6b2a[_0x0996('0x3e')]=_[_0x0996('0x3c')](_0x1e7920['model'],qs[_0x0996('0x3f')](_0xaec0ad[_0x0996('0x3a')][_0x0996('0x3f')]));_0x5b6b2a[_0x0996('0x3e')]=_0x5b6b2a[_0x0996('0x3e')][_0x0996('0x40')]?_0x5b6b2a[_0x0996('0x3e')]:_0x1e7920['model'];if(_0xaec0ad[_0x0996('0x3a')][_0x0996('0x4a')]){_0x5b6b2a[_0x0996('0x4b')]=[{'all':!![]}];}_0x5b6b2a=_[_0x0996('0x47')]({},_0x5b6b2a,_0xaec0ad[_0x0996('0x50')]);return db[_0x0996('0x49')]['find'](_0x5b6b2a)[_0x0996('0x31')](handleEntityNotFound(_0x518d55,null))['then'](respondWithResult(_0x518d55,null))[_0x0996('0x25')](handleError(_0x518d55,null));};exports[_0x0996('0x51')]=function(_0x46d047,_0x4653f9){return db[_0x0996('0x49')][_0x0996('0x51')](_0x46d047[_0x0996('0x52')],{})[_0x0996('0x31')](respondWithResult(_0x4653f9,0xc9))[_0x0996('0x25')](handleError(_0x4653f9,null));};exports[_0x0996('0x30')]=function(_0x1b8168,_0x26ae6c){if(_0x1b8168[_0x0996('0x52')]['id']){delete _0x1b8168[_0x0996('0x52')]['id'];}return db[_0x0996('0x49')][_0x0996('0x53')]({'where':{'id':_0x1b8168[_0x0996('0x54')]['id']}})['then'](handleEntityNotFound(_0x26ae6c,null))[_0x0996('0x31')](saveUpdates(_0x1b8168[_0x0996('0x52')],null))[_0x0996('0x31')](respondWithResult(_0x26ae6c,null))['catch'](handleError(_0x26ae6c,null));};exports['destroy']=function(_0x4f4cca,_0xe3f7ec){return db[_0x0996('0x49')][_0x0996('0x53')]({'where':{'id':_0x4f4cca['params']['id']}})[_0x0996('0x31')](handleEntityNotFound(_0xe3f7ec,null))[_0x0996('0x31')](removeEntity(_0xe3f7ec,null))[_0x0996('0x25')](handleError(_0xe3f7ec,null));};exports[_0x0996('0x55')]=function(_0x53361d,_0x475e2a){return db[_0x0996('0x49')]['describe']()[_0x0996('0x31')](respondWithResult(_0x475e2a,null))['catch'](handleError(_0x475e2a,null));};var interaction_log=require(_0x0996('0x12'))(_0x0996('0x56'));exports[_0x0996('0x57')]=function(_0x5ed646,_0x368e90,_0x149001){var _0x1960f3={'agent':{},'channel':_0x0996('0x58')};if(_0x5ed646[_0x0996('0x52')]['id']){delete _0x5ed646[_0x0996('0x52')]['id'];}_0x5ed646[_0x0996('0x52')]['read']=!![];_0x5ed646[_0x0996('0x52')][_0x0996('0x59')]=moment()[_0x0996('0x5a')](_0x0996('0x5b'));_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')]=_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')]||_0x5ed646[_0x0996('0x5d')]['id'];_0x1960f3[_0x0996('0x5e')]['id']=_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')];return db[_0x0996('0x49')]['find']({'where':{'id':_0x5ed646['params']['id'],'UserId':null}})[_0x0996('0x31')](handleEntityNotFound(_0x368e90,null))[_0x0996('0x31')](saveUpdates(_0x5ed646['body'],null))[_0x0996('0x31')](function(_0x429258){if(_0x429258){_0x1960f3[_0x0996('0x23')]=_0x429258[_0x0996('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x429258['WhatsappInteractionId']}});}return null;})[_0x0996('0x31')](handleEntityNotFound(_0x368e90,null))[_0x0996('0x31')](function(_0xc7bc01){if(_0xc7bc01){return _0xc7bc01['update']({'UserId':_0x5ed646[_0x0996('0x52')]['UserId'],'read1stAt':_[_0x0996('0x60')](_0xc7bc01[_0x0996('0x61')])?moment()[_0x0996('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0996('0x31')](function(_0x20f192){if(_0x20f192){_0x1960f3[_0x0996('0x62')]=_0x20f192[_0x0996('0x5f')]({'plain':!![]});interaction_log['info'](_0x0996('0x63'),_0x5ed646[_0x0996('0x5d')]['id'],_0x5ed646[_0x0996('0x5d')][_0x0996('0x34')],_0x5ed646[_0x0996('0x5d')][_0x0996('0x64')],_0x1960f3[_0x0996('0x62')]['id'],_0x5ed646[_0x0996('0x52')]?JSON['stringify'](_0x5ed646[_0x0996('0x52')]):_0x0996('0x65'));return respondWithRpcPromise(_0x0996('0x66'),_0x0996('0x67'),_0x1960f3);}return null;})[_0x0996('0x31')](function(_0x4b3031){var _0xa4cd64=_0x0996('0x68')+_0x4b3031[_0x0996('0x23')][_0x0996('0x69')];return db['sequelize']['query'](_0xa4cd64,{'type':db[_0x0996('0x6a')]['QueryTypes'][_0x0996('0x6b')],'raw':!![]})[_0x0996('0x31')](function(_0x5c45da){return _0x5c45da;});})[_0x0996('0x31')](function(_0x5f18b1){if(_0x5f18b1){_0x1960f3[_0x0996('0x23')]['contact']=_0x5f18b1[0x0];if(!_0x5ed646['body'][_0x0996('0x5c')])return;return db[_0x0996('0x6c')]['find']({'where':{'id':_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')],'role':_0x0996('0x5e')},'attributes':['id',_0x0996('0x34'),_0x0996('0x6d'),_0x0996('0x6e'),'internal'],'raw':!![]});}return null;})[_0x0996('0x31')](function(_0x51ba39){if(!_0x51ba39)return null;_0x1960f3['message'][_0x0996('0x5e')]=_0x51ba39;return _0x1960f3;})['then'](function(_0x4c122a){if(_0x4c122a){if(_0x5ed646[_0x0996('0x52')][_0x0996('0x6f')]){_0x1960f3[_0x0996('0x23')][_0x0996('0x70')]=util[_0x0996('0x5a')](_0x0996('0x71'),_0x5ed646['user']['name']);_0x1960f3[_0x0996('0x23')]['channel']=_0x1960f3['channel'];_0x1960f3['message']['motionChannel']=_0x1960f3['channel'];_0x1960f3['message'][_0x0996('0x72')]=_0x0996('0x57');return respondWithRpcPromise(_0x0996('0x73'),_0x0996('0x73'),{'event':'acceptmessage','message':_0x1960f3[_0x0996('0x23')]},client9002)[_0x0996('0x31')](function(){return _0x1960f3;});}return _0x1960f3;}return null;})[_0x0996('0x31')](respondWithResult(_0x368e90,null))[_0x0996('0x25')](handleError(_0x368e90,null));};var interaction_log=require(_0x0996('0x12'))(_0x0996('0x56'));exports['reject']=function(_0x4c78ef,_0x328e1c,_0x36aa43){var _0x3ac46b={'agent':{},'channel':_0x0996('0x58')};if(_0x4c78ef[_0x0996('0x52')]['id']){delete _0x4c78ef['body']['id'];}_0x4c78ef['body'][_0x0996('0x5c')]=_0x4c78ef['body'][_0x0996('0x5c')]||_0x4c78ef['user']['id'];_0x3ac46b['agent']['id']=_0x4c78ef['body'][_0x0996('0x5c')];return db[_0x0996('0x49')]['find']({'where':{'id':_0x4c78ef['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x328e1c,null))[_0x0996('0x31')](function(_0x1920ac){if(_0x1920ac){_0x3ac46b['message']=_0x1920ac[_0x0996('0x5f')]({'plain':!![]});return db[_0x0996('0x74')]['find']({'where':{'id':_0x1920ac[_0x0996('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x328e1c,null))['then'](function(_0x2034bb){if(_0x2034bb){_0x3ac46b[_0x0996('0x62')]=_0x2034bb['get']({'plain':!![]});interaction_log[_0x0996('0x1d')](_0x0996('0x76'),_0x4c78ef[_0x0996('0x5d')]['id'],_0x4c78ef[_0x0996('0x5d')][_0x0996('0x34')],_0x4c78ef[_0x0996('0x5d')][_0x0996('0x64')],_0x3ac46b[_0x0996('0x62')]['id'],_0x4c78ef[_0x0996('0x52')]?JSON['stringify'](_0x4c78ef['body']):_0x0996('0x65'));return respondWithRpcPromise(_0x0996('0x77'),_0x0996('0x78'),_0x3ac46b);}return null;})[_0x0996('0x31')](function(_0x2e24e9){var _0xf67e61='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e24e9[_0x0996('0x23')][_0x0996('0x69')];return db[_0x0996('0x79')][_0x0996('0x3a')](_0xf67e61,{'type':db[_0x0996('0x6a')][_0x0996('0x7a')][_0x0996('0x6b')],'raw':!![]})[_0x0996('0x31')](function(_0x328323){return _0x328323;});})[_0x0996('0x31')](function(_0x1121e4){if(_0x1121e4){_0x3ac46b['message'][_0x0996('0x7b')]=_0x1121e4[0x0];if(!_0x4c78ef[_0x0996('0x52')][_0x0996('0x5c')])return;return db[_0x0996('0x6c')][_0x0996('0x53')]({'where':{'id':_0x4c78ef[_0x0996('0x52')]['UserId'],'role':_0x0996('0x5e')},'attributes':['id',_0x0996('0x34'),'fullname',_0x0996('0x6e'),'internal'],'raw':!![]});}return null;})[_0x0996('0x31')](function(_0x45b2cc){if(!_0x45b2cc)return null;_0x3ac46b['message']['agent']=_0x45b2cc;return _0x3ac46b;})[_0x0996('0x31')](function(_0x27b033){if(_0x27b033){_0x27b033[_0x0996('0x23')]['interface']=util[_0x0996('0x5a')](_0x0996('0x71'),_0x4c78ef[_0x0996('0x5d')][_0x0996('0x34')]);_0x27b033[_0x0996('0x23')][_0x0996('0x7c')]=_0x3ac46b[_0x0996('0x7c')];_0x27b033[_0x0996('0x23')][_0x0996('0x7d')]=_0x3ac46b[_0x0996('0x7c')];_0x27b033[_0x0996('0x23')][_0x0996('0x72')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x0996('0x7e'),'message':_0x27b033[_0x0996('0x23')]},client9002);return _0x3ac46b;}return null;})[_0x0996('0x31')](respondWithResult(_0x328e1c,null))['catch'](handleError(_0x328e1c,null));};exports[_0x0996('0x27')]=function(_0x1aa4de,_0x317418,_0x35b960){if(_0x1aa4de['body']['id']){delete _0x1aa4de[_0x0996('0x52')]['id'];}var _0x36b2fe;return db['WhatsappMessage']['find']({'where':{'id':_0x1aa4de[_0x0996('0x54')]['id']}})[_0x0996('0x31')](handleEntityNotFound(_0x317418,null))[_0x0996('0x31')](function(_0x9c9598){if(_0x9c9598){_0x36b2fe=_0x9c9598;return db['WhatsappAccount'][_0x0996('0x53')]({'where':{'id':_0x9c9598[_0x0996('0x7f')]}});}})[_0x0996('0x31')](handleEntityNotFound(_0x317418,null))['then'](function(_0x2792bd){if(_0x2792bd){logger[_0x0996('0x20')](_0x0996('0x80'),_0x0996('0x27'),_0x0996('0x81'),_0x2792bd[_0x0996('0x38')],util[_0x0996('0x82')](_0x1aa4de[_0x0996('0x52')],{'showHidden':![],'depth':null}));switch(_0x2792bd[_0x0996('0x38')]){case'twilio':if(_0x1aa4de[_0x0996('0x52')][_0x0996('0x83')]&&_0x1aa4de[_0x0996('0x52')]['MessageSid']===_0x36b2fe[_0x0996('0x84')]&&_0x1aa4de['body'][_0x0996('0x85')]&&_0x1aa4de[_0x0996('0x52')][_0x0996('0x85')]===_0x0996('0x86')){return _0x36b2fe[_0x0996('0x30')]({'read':!![]});}else{logger['error'](_0x0996('0x87'),'status',_0x0996('0x88'),util[_0x0996('0x82')](_0x1aa4de[_0x0996('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x36b2fe;}})[_0x0996('0x31')](respondWithResult(_0x317418,null))[_0x0996('0x25')](handleError(_0x317418,null));}; \ No newline at end of file +var _0x3746=['whatsapp-interactions','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','MessageStatus','inspect','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage'];(function(_0x4bf0a1,_0x3f5aee){var _0x33c121=function(_0x4008e7){while(--_0x4008e7){_0x4bf0a1['push'](_0x4bf0a1['shift']());}};_0x33c121(++_0x3f5aee);}(_0x3746,0x97));var _0x6374=function(_0x455658,_0x109cf8){_0x455658=_0x455658-0x0;var _0x54bab5=_0x3746[_0x455658];return _0x54bab5;};'use strict';var emlformat=require(_0x6374('0x0'));var rimraf=require(_0x6374('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6374('0x2'));var moment=require(_0x6374('0x3'));var BPromise=require(_0x6374('0x4'));var Mustache=require(_0x6374('0x5'));var util=require(_0x6374('0x6'));var path=require(_0x6374('0x7'));var sox=require(_0x6374('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6374('0x9'));var _=require('lodash');var squel=require(_0x6374('0xa'));var crypto=require(_0x6374('0xb'));var jsforce=require(_0x6374('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6374('0xd'));var querystring=require('querystring');var Papa=require(_0x6374('0xe'));var Redis=require(_0x6374('0xf'));var authService=require(_0x6374('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6374('0x11'));var hardwareService=require(_0x6374('0x12'));var logger=require(_0x6374('0x13'))(_0x6374('0x14'));var utils=require('../../config/utils');var config=require(_0x6374('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6374('0x16'))['db'];config[_0x6374('0x17')]=_['defaults'](config[_0x6374('0x17')],{'host':_0x6374('0x18'),'port':0x18eb});var socket=require(_0x6374('0x19'))(new Redis(config[_0x6374('0x17')]));require(_0x6374('0x1a'))[_0x6374('0x1b')](socket);var jayson=require(_0x6374('0x1c'));var client=jayson[_0x6374('0x1d')][_0x6374('0x1e')]({'port':0x232c});var client9002=jayson[_0x6374('0x1d')][_0x6374('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xf6bbe5,_0x564e2c,_0x59ca22,_0x1b8bcc){return new BPromise(function(_0x2f3da3,_0x393187){var _0x58483f=_0x1b8bcc||client;return _0x58483f[_0x6374('0x1f')](_0xf6bbe5,_0x59ca22)[_0x6374('0x20')](function(_0x38d152){logger[_0x6374('0x21')](_0x6374('0x22'),_0x564e2c,_0x6374('0x23'));logger[_0x6374('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x564e2c,'request\x20sent',JSON[_0x6374('0x25')](_0x38d152));if(_0x38d152[_0x6374('0x26')]){if(_0x38d152['error'][_0x6374('0x27')]===0x1f4){logger['error'](_0x6374('0x22'),_0x564e2c,_0x38d152[_0x6374('0x26')]['message']);return _0x393187(_0x38d152[_0x6374('0x26')][_0x6374('0x28')]);}logger[_0x6374('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x564e2c,_0x38d152[_0x6374('0x26')][_0x6374('0x28')]);return _0x2f3da3(_0x38d152['error'][_0x6374('0x28')]);}else{logger[_0x6374('0x21')](_0x6374('0x22'),_0x564e2c,_0x6374('0x23'));_0x2f3da3(_0x38d152[_0x6374('0x29')][_0x6374('0x28')]);}})['catch'](function(_0x5d366f){logger[_0x6374('0x26')](_0x6374('0x22'),_0x564e2c,_0x5d366f);_0x393187(_0x5d366f);});});}function respondWithStatusCode(_0x40bd91,_0x20d492){_0x20d492=_0x20d492||0xcc;return function(_0x49191e){if(_0x49191e){return _0x40bd91[_0x6374('0x2a')](_0x20d492);}return _0x40bd91[_0x6374('0x2b')](_0x20d492)[_0x6374('0x2c')]();};}function respondWithResult(_0x199191,_0x1709d1){_0x1709d1=_0x1709d1||0xc8;return function(_0x25d656){if(_0x25d656){return _0x199191[_0x6374('0x2b')](_0x1709d1)['json'](_0x25d656);}};}function respondWithFilteredResult(_0x118cfa,_0xf11f5f){return function(_0x179c19){if(_0x179c19){var _0x3fdbce=typeof _0xf11f5f[_0x6374('0x2d')]===_0x6374('0x2e')&&typeof _0xf11f5f[_0x6374('0x2f')]===_0x6374('0x2e');var _0x44f893=_0x179c19[_0x6374('0x30')];var _0x583564=_0x3fdbce?0x0:_0xf11f5f[_0x6374('0x2d')];var _0x517f97=_0x3fdbce?_0x179c19['count']:_0xf11f5f[_0x6374('0x2d')]+_0xf11f5f[_0x6374('0x2f')];var _0x39bae8;if(_0x517f97>=_0x44f893){_0x517f97=_0x44f893;_0x39bae8=0xc8;}else{_0x39bae8=0xce;}_0x118cfa[_0x6374('0x2b')](_0x39bae8);return _0x118cfa['set']('Content-Range',_0x583564+'-'+_0x517f97+'/'+_0x44f893)[_0x6374('0x31')](_0x179c19);}return null;};}function patchUpdates(_0x192a7f){return function(_0x1237d9){try{jsonpatch[_0x6374('0x32')](_0x1237d9,_0x192a7f,!![]);}catch(_0x5aadd4){return BPromise[_0x6374('0x33')](_0x5aadd4);}return _0x1237d9['save']();};}function saveUpdates(_0x433081,_0x2b8033){return function(_0x2fceef){if(_0x2fceef){return _0x2fceef['update'](_0x433081)[_0x6374('0x20')](function(_0xb58bb3){return _0xb58bb3;});}return null;};}function removeEntity(_0x38ea75,_0x99186d){return function(_0x5bc3f0){if(_0x5bc3f0){return _0x5bc3f0[_0x6374('0x34')]()[_0x6374('0x20')](function(){_0x38ea75['status'](0xcc)[_0x6374('0x2c')]();});}};}function handleEntityNotFound(_0x3fb18d,_0x4702bf){return function(_0x3a8522){if(!_0x3a8522){_0x3fb18d[_0x6374('0x2a')](0x194);}return _0x3a8522;};}function handleError(_0x900de7,_0x5a92a5){_0x5a92a5=_0x5a92a5||0x1f4;return function(_0x2a3ec1){logger['error'](_0x2a3ec1[_0x6374('0x35')]);if(_0x2a3ec1[_0x6374('0x36')]){delete _0x2a3ec1['name'];}_0x900de7[_0x6374('0x2b')](_0x5a92a5)[_0x6374('0x37')](_0x2a3ec1);};}exports[_0x6374('0x38')]=function(_0x24e17a,_0x229df6){var _0x1ec8f2={},_0x23cada={},_0x11cf4a={'count':0x0,'rows':[]};var _0xc6251f=_[_0x6374('0x39')](db[_0x6374('0x3a')][_0x6374('0x3b')],function(_0x114165){return{'name':_0x114165[_0x6374('0x3c')],'type':_0x114165[_0x6374('0x3d')][_0x6374('0x3e')]};});_0x23cada[_0x6374('0x3f')]=_[_0x6374('0x39')](_0xc6251f,_0x6374('0x36'));_0x23cada[_0x6374('0x40')]=_[_0x6374('0x41')](_0x24e17a[_0x6374('0x40')]);_0x23cada[_0x6374('0x42')]=_[_0x6374('0x43')](_0x23cada['model'],_0x23cada[_0x6374('0x40')]);_0x1ec8f2[_0x6374('0x44')]=_['intersection'](_0x23cada[_0x6374('0x3f')],qs[_0x6374('0x45')](_0x24e17a[_0x6374('0x40')]['fields']));_0x1ec8f2[_0x6374('0x44')]=_0x1ec8f2['attributes'][_0x6374('0x46')]?_0x1ec8f2[_0x6374('0x44')]:_0x23cada[_0x6374('0x3f')];if(!_0x24e17a['query'][_0x6374('0x47')]('nolimit')){_0x1ec8f2[_0x6374('0x2f')]=qs['limit'](_0x24e17a['query']['limit']);_0x1ec8f2[_0x6374('0x2d')]=qs[_0x6374('0x2d')](_0x24e17a[_0x6374('0x40')]['offset']);}_0x1ec8f2[_0x6374('0x48')]=qs['sort'](_0x24e17a[_0x6374('0x40')][_0x6374('0x49')]);_0x1ec8f2['where']=qs[_0x6374('0x42')](_['pick'](_0x24e17a[_0x6374('0x40')],_0x23cada[_0x6374('0x42')]),_0xc6251f);if(_0x24e17a[_0x6374('0x40')][_0x6374('0x4a')]){_0x1ec8f2['where']=_[_0x6374('0x4b')](_0x1ec8f2['where'],{'$or':_[_0x6374('0x39')](_0xc6251f,function(_0x107850){if(_0x107850[_0x6374('0x3d')]!==_0x6374('0x4c')){var _0x457e88={};_0x457e88[_0x107850[_0x6374('0x36')]]={'$like':'%'+_0x24e17a[_0x6374('0x40')][_0x6374('0x4a')]+'%'};return _0x457e88;}})});}_0x1ec8f2=_['merge']({},_0x1ec8f2,_0x24e17a[_0x6374('0x4d')]);var _0xf7d1f3={'where':_0x1ec8f2[_0x6374('0x4e')]};return db['WhatsappMessage'][_0x6374('0x30')](_0xf7d1f3)['then'](function(_0x54a73b){_0x11cf4a[_0x6374('0x30')]=_0x54a73b;if(_0x24e17a[_0x6374('0x40')][_0x6374('0x4f')]){_0x1ec8f2[_0x6374('0x50')]=[{'all':!![]}];}return db[_0x6374('0x3a')][_0x6374('0x51')](_0x1ec8f2);})[_0x6374('0x20')](function(_0x582cfc){_0x11cf4a[_0x6374('0x52')]=_0x582cfc;return _0x11cf4a;})[_0x6374('0x20')](respondWithFilteredResult(_0x229df6,_0x1ec8f2))[_0x6374('0x53')](handleError(_0x229df6,null));};exports[_0x6374('0x54')]=function(_0xc69663,_0x4e28cc){var _0x3d82fe={'raw':!![],'where':{'id':_0xc69663[_0x6374('0x55')]['id']}},_0xeb3608={};_0xeb3608['model']=_[_0x6374('0x41')](db['WhatsappMessage'][_0x6374('0x3b')]);_0xeb3608['query']=_[_0x6374('0x41')](_0xc69663['query']);_0xeb3608[_0x6374('0x42')]=_['intersection'](_0xeb3608[_0x6374('0x3f')],_0xeb3608[_0x6374('0x40')]);_0x3d82fe[_0x6374('0x44')]=_['intersection'](_0xeb3608[_0x6374('0x3f')],qs[_0x6374('0x45')](_0xc69663[_0x6374('0x40')]['fields']));_0x3d82fe['attributes']=_0x3d82fe[_0x6374('0x44')][_0x6374('0x46')]?_0x3d82fe['attributes']:_0xeb3608['model'];if(_0xc69663['query']['includeAll']){_0x3d82fe[_0x6374('0x50')]=[{'all':!![]}];}_0x3d82fe=_[_0x6374('0x4b')]({},_0x3d82fe,_0xc69663[_0x6374('0x4d')]);return db[_0x6374('0x3a')][_0x6374('0x56')](_0x3d82fe)['then'](handleEntityNotFound(_0x4e28cc,null))[_0x6374('0x20')](respondWithResult(_0x4e28cc,null))[_0x6374('0x53')](handleError(_0x4e28cc,null));};exports[_0x6374('0x57')]=function(_0x564873,_0x5b1df6){return db[_0x6374('0x3a')][_0x6374('0x57')](_0x564873['body'],{})['then'](respondWithResult(_0x5b1df6,0xc9))[_0x6374('0x53')](handleError(_0x5b1df6,null));};exports[_0x6374('0x58')]=function(_0x16fa92,_0x3d5906){if(_0x16fa92[_0x6374('0x59')]['id']){delete _0x16fa92[_0x6374('0x59')]['id'];}return db[_0x6374('0x3a')][_0x6374('0x56')]({'where':{'id':_0x16fa92[_0x6374('0x55')]['id']}})[_0x6374('0x20')](handleEntityNotFound(_0x3d5906,null))['then'](saveUpdates(_0x16fa92[_0x6374('0x59')],null))['then'](respondWithResult(_0x3d5906,null))['catch'](handleError(_0x3d5906,null));};exports[_0x6374('0x34')]=function(_0x592ceb,_0x41e50c){return db[_0x6374('0x3a')][_0x6374('0x56')]({'where':{'id':_0x592ceb[_0x6374('0x55')]['id']}})[_0x6374('0x20')](handleEntityNotFound(_0x41e50c,null))['then'](removeEntity(_0x41e50c,null))[_0x6374('0x53')](handleError(_0x41e50c,null));};exports['describe']=function(_0x31614b,_0x1c510d){return db[_0x6374('0x3a')][_0x6374('0x5a')]()['then'](respondWithResult(_0x1c510d,null))[_0x6374('0x53')](handleError(_0x1c510d,null));};var interaction_log=require(_0x6374('0x13'))('whatsapp-interactions');exports['accept']=function(_0x2a499e,_0x7ae007,_0x2a4a78){var _0x888406={'agent':{},'channel':'whatsapp'};if(_0x2a499e['body']['id']){delete _0x2a499e[_0x6374('0x59')]['id'];}_0x2a499e[_0x6374('0x59')][_0x6374('0x5b')]=!![];_0x2a499e[_0x6374('0x59')][_0x6374('0x5c')]=moment()['format'](_0x6374('0x5d'));_0x2a499e[_0x6374('0x59')][_0x6374('0x5e')]=_0x2a499e[_0x6374('0x59')][_0x6374('0x5e')]||_0x2a499e[_0x6374('0x5f')]['id'];_0x888406[_0x6374('0x60')]['id']=_0x2a499e['body'][_0x6374('0x5e')];return db[_0x6374('0x3a')][_0x6374('0x56')]({'where':{'id':_0x2a499e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7ae007,null))[_0x6374('0x20')](saveUpdates(_0x2a499e[_0x6374('0x59')],null))[_0x6374('0x20')](function(_0x57bb08){if(_0x57bb08){_0x888406[_0x6374('0x28')]=_0x57bb08[_0x6374('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x6374('0x56')]({'where':{'id':_0x57bb08['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7ae007,null))[_0x6374('0x20')](function(_0x234260){if(_0x234260){return _0x234260[_0x6374('0x58')]({'UserId':_0x2a499e[_0x6374('0x59')]['UserId'],'read1stAt':_[_0x6374('0x62')](_0x234260['read1stAt'])?moment()[_0x6374('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6374('0x20')](function(_0x16490a){if(_0x16490a){_0x888406[_0x6374('0x64')]=_0x16490a[_0x6374('0x61')]({'plain':!![]});interaction_log['info'](_0x6374('0x65'),_0x2a499e['user']['id'],_0x2a499e['user'][_0x6374('0x36')],_0x2a499e[_0x6374('0x5f')][_0x6374('0x66')],_0x888406[_0x6374('0x64')]['id'],_0x2a499e[_0x6374('0x59')]?JSON['stringify'](_0x2a499e['body']):_0x6374('0x67'));return respondWithRpcPromise(_0x6374('0x68'),'acceptMessage',_0x888406);}return null;})[_0x6374('0x20')](function(_0x1badd9){var _0x13280c=_0x6374('0x69')+_0x1badd9['message']['ContactId'];return db['sequelize'][_0x6374('0x40')](_0x13280c,{'type':db['Sequelize'][_0x6374('0x6a')][_0x6374('0x6b')],'raw':!![]})[_0x6374('0x20')](function(_0x255c24){return _0x255c24;});})[_0x6374('0x20')](function(_0x344825){if(_0x344825){_0x888406[_0x6374('0x28')][_0x6374('0x6c')]=_0x344825[0x0];if(!_0x2a499e[_0x6374('0x59')][_0x6374('0x5e')])return;return db[_0x6374('0x6d')]['find']({'where':{'id':_0x2a499e[_0x6374('0x59')][_0x6374('0x5e')],'role':_0x6374('0x60')},'attributes':['id',_0x6374('0x36'),_0x6374('0x6e'),_0x6374('0x6f'),_0x6374('0x70')],'raw':!![]});}return null;})[_0x6374('0x20')](function(_0x1f9123){if(!_0x1f9123)return null;_0x888406[_0x6374('0x28')][_0x6374('0x60')]=_0x1f9123;return _0x888406;})[_0x6374('0x20')](function(_0x40f2fe){if(_0x40f2fe){if(_0x2a499e[_0x6374('0x59')][_0x6374('0x71')]){_0x888406['message'][_0x6374('0x72')]=util[_0x6374('0x63')](_0x6374('0x73'),_0x2a499e['user'][_0x6374('0x36')]);_0x888406['message'][_0x6374('0x74')]=_0x888406[_0x6374('0x74')];_0x888406[_0x6374('0x28')][_0x6374('0x75')]=_0x888406[_0x6374('0x74')];_0x888406[_0x6374('0x28')]['event']=_0x6374('0x76');return respondWithRpcPromise(_0x6374('0x77'),_0x6374('0x77'),{'event':_0x6374('0x78'),'message':_0x888406[_0x6374('0x28')]},client9002)[_0x6374('0x20')](function(){return _0x888406;});}return _0x888406;}return null;})[_0x6374('0x20')](respondWithResult(_0x7ae007,null))[_0x6374('0x53')](handleError(_0x7ae007,null));};var interaction_log=require(_0x6374('0x13'))(_0x6374('0x79'));exports['reject']=function(_0xed2174,_0x557fc1,_0x30aed8){var _0x4c99f3={'agent':{},'channel':'whatsapp'};if(_0xed2174[_0x6374('0x59')]['id']){delete _0xed2174[_0x6374('0x59')]['id'];}_0xed2174[_0x6374('0x59')]['UserId']=_0xed2174[_0x6374('0x59')]['UserId']||_0xed2174[_0x6374('0x5f')]['id'];_0x4c99f3[_0x6374('0x60')]['id']=_0xed2174[_0x6374('0x59')]['UserId'];return db['WhatsappMessage'][_0x6374('0x56')]({'where':{'id':_0xed2174['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x557fc1,null))[_0x6374('0x20')](function(_0x5bd8bf){if(_0x5bd8bf){_0x4c99f3['message']=_0x5bd8bf[_0x6374('0x61')]({'plain':!![]});return db[_0x6374('0x7a')][_0x6374('0x56')]({'where':{'id':_0x5bd8bf[_0x6374('0x7b')]}});}return null;})[_0x6374('0x20')](handleEntityNotFound(_0x557fc1,null))[_0x6374('0x20')](function(_0x27de7e){if(_0x27de7e){_0x4c99f3[_0x6374('0x64')]=_0x27de7e[_0x6374('0x61')]({'plain':!![]});interaction_log[_0x6374('0x21')](_0x6374('0x7c'),_0xed2174['user']['id'],_0xed2174[_0x6374('0x5f')][_0x6374('0x36')],_0xed2174[_0x6374('0x5f')][_0x6374('0x66')],_0x4c99f3[_0x6374('0x64')]['id'],_0xed2174['body']?JSON['stringify'](_0xed2174[_0x6374('0x59')]):_0x6374('0x67'));return respondWithRpcPromise(_0x6374('0x7d'),_0x6374('0x7e'),_0x4c99f3);}return null;})[_0x6374('0x20')](function(_0x5501ae){var _0x18e775=_0x6374('0x69')+_0x5501ae[_0x6374('0x28')][_0x6374('0x7f')];return db[_0x6374('0x80')][_0x6374('0x40')](_0x18e775,{'type':db[_0x6374('0x81')][_0x6374('0x6a')]['SELECT'],'raw':!![]})[_0x6374('0x20')](function(_0x2458b7){return _0x2458b7;});})[_0x6374('0x20')](function(_0x2ac8e2){if(_0x2ac8e2){_0x4c99f3[_0x6374('0x28')][_0x6374('0x6c')]=_0x2ac8e2[0x0];if(!_0xed2174[_0x6374('0x59')][_0x6374('0x5e')])return;return db[_0x6374('0x6d')]['find']({'where':{'id':_0xed2174[_0x6374('0x59')][_0x6374('0x5e')],'role':_0x6374('0x60')},'attributes':['id','name',_0x6374('0x6e'),_0x6374('0x6f'),_0x6374('0x70')],'raw':!![]});}return null;})[_0x6374('0x20')](function(_0x320de0){if(!_0x320de0)return null;_0x4c99f3[_0x6374('0x28')][_0x6374('0x60')]=_0x320de0;return _0x4c99f3;})[_0x6374('0x20')](function(_0x45f9b4){if(_0x45f9b4){_0x45f9b4[_0x6374('0x28')][_0x6374('0x72')]=util[_0x6374('0x63')]('SIP/%s',_0xed2174[_0x6374('0x5f')][_0x6374('0x36')]);_0x45f9b4[_0x6374('0x28')][_0x6374('0x74')]=_0x4c99f3[_0x6374('0x74')];_0x45f9b4[_0x6374('0x28')][_0x6374('0x75')]=_0x4c99f3[_0x6374('0x74')];_0x45f9b4[_0x6374('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0x6374('0x77'),{'event':'rejectmessage','message':_0x45f9b4[_0x6374('0x28')]},client9002);return _0x4c99f3;}return null;})[_0x6374('0x20')](respondWithResult(_0x557fc1,null))[_0x6374('0x53')](handleError(_0x557fc1,null));};exports[_0x6374('0x2b')]=function(_0xfd35ed,_0xe30da,_0x8a1d57){if(_0xfd35ed[_0x6374('0x59')]['id']){delete _0xfd35ed['body']['id'];}var _0x1188e9;return db[_0x6374('0x3a')][_0x6374('0x56')]({'where':{'id':_0xfd35ed['params']['id']}})[_0x6374('0x20')](handleEntityNotFound(_0xe30da,null))[_0x6374('0x20')](function(_0x5b2eb9){if(_0x5b2eb9){_0x1188e9=_0x5b2eb9;return db[_0x6374('0x82')]['find']({'where':{'id':_0x5b2eb9['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xe30da,null))[_0x6374('0x20')](function(_0x359025){if(_0x359025){logger[_0x6374('0x24')](_0x6374('0x83'),_0x6374('0x2b'),'received\x20delivery\x20report\x20from',_0x359025[_0x6374('0x3d')],util['inspect'](_0xfd35ed[_0x6374('0x59')],{'showHidden':![],'depth':null}));switch(_0x359025['type']){case _0x6374('0x84'):if(_0xfd35ed[_0x6374('0x59')][_0x6374('0x85')]&&_0xfd35ed['body'][_0x6374('0x85')]===_0x1188e9['messageId']&&_0xfd35ed[_0x6374('0x59')][_0x6374('0x86')]&&_0xfd35ed[_0x6374('0x59')]['MessageStatus']===_0x6374('0x5b')){return _0x1188e9['update']({'read':!![]});}else{logger[_0x6374('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6374('0x2b'),_0x6374('0x84'),util[_0x6374('0x87')](_0xfd35ed[_0x6374('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1188e9;}})['then'](respondWithResult(_0xe30da,null))[_0x6374('0x53')](handleError(_0xe30da,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 253969e..de67558 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 _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3a420f,_0x8f3a3b){var _0x5c96b9=function(_0xe1c2b1){while(--_0xe1c2b1){_0x3a420f['push'](_0x3a420f['shift']());}};_0x5c96b9(++_0x8f3a3b);}(_0xed3c,0x1a6));var _0xced3=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xed3c[_0x294b6];return _0x38bb97;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xa902=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xa902,0x8d));var _0x2a90=function(_0xa86251,_0x535ced){_0xa86251=_0xa86251-0x0;var _0x300ffe=_0xa902[_0xa86251];return _0x300ffe;};'use strict';var EventEmitter=require(_0x2a90('0x0'));var WhatsappMessage=require(_0x2a90('0x1'))['db'][_0x2a90('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2a90('0x3')](0x0);var events={'afterCreate':_0x2a90('0x4'),'afterUpdate':'update','afterDestroy':_0x2a90('0x5')};function emitEvent(_0x5b4a40){return function(_0x4961c2,_0x169808,_0x2b40c0){WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40+':'+_0x4961c2['id'],_0x4961c2);WhatsappMessageEvents[_0x2a90('0x6')](_0x5b4a40,_0x4961c2);_0x2b40c0(null);};}for(var e in events){if(events[_0x2a90('0x7')](e)){var event=events[e];WhatsappMessage[_0x2a90('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index b6f6a88..6202864 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 _0x7266=['sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','node-fetch','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','out','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x5d1f9a,_0x3c75fd){var _0x864ff7=function(_0x388bdc){while(--_0x388bdc){_0x5d1f9a['push'](_0x5d1f9a['shift']());}};_0x864ff7(++_0x3c75fd);}(_0x7266,0xec));var _0x6726=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7266[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var logger=require(_0x6726('0x2'))(_0x6726('0x3'));var moment=require(_0x6726('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x6726('0x5'));var fs=require('fs');var path=require(_0x6726('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6726('0x7'));module[_0x6726('0x8')]=function(_0x1c2cfd,_0x180502){return _0x1c2cfd[_0x6726('0x9')](_0x6726('0xa'),attributes,{'tableName':_0x6726('0xb'),'paranoid':![],'indexes':[{'name':_0x6726('0xc'),'fields':[_0x6726('0xc')]},{'name':_0x6726('0xd'),'fields':[_0x6726('0xe')],'type':_0x6726('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdda3e6,_0x5e8efb,_0x44ff0c){var _0x1265e8=_0x1c2cfd[_0x6726('0x10')];var _0x16786f=_0xdda3e6['get']({'plain':!![]});if(_0x16786f[_0x6726('0x11')]['toLowerCase']()==='in'||_0x16786f[_0x6726('0x11')][_0x6726('0x12')]()==='out'&&!_0x16786f[_0x6726('0x13')]&&!_[_0x6726('0x14')](_0x16786f[_0x6726('0x15')])){_0x1265e8[_0x6726('0x16')]['findOne']({'where':{'id':_0x16786f[_0x6726('0x17')]}})[_0x6726('0x18')](function(_0x4dc47d){if(_0x4dc47d){_0x4dc47d[_0x6726('0x19')]({'lastMsgAt':_0x16786f['createdAt'],'lastMsgDirection':_0x16786f[_0x6726('0x11')][_0x6726('0x12')]()});}})[_0x6726('0x1a')](function(_0x3a3b6a){console['error'](_0x3a3b6a);});}if(_0x16786f[_0x6726('0x11')]===_0x6726('0x1b')&&!_0x16786f['secret']){var _0x153832;_0x1265e8['WhatsappAccount']['find']({'where':{'id':_0x16786f['WhatsappAccountId']},'raw':!![]})[_0x6726('0x18')](function(_0x2e9d00){_0x153832=_0x2e9d00;if(_0x153832&&_0x153832['type']){switch(_0x153832[_0x6726('0x1c')]){case _0x6726('0x1d'):var _0x27562c=require(_0x6726('0x1d'));if(_0x153832[_0x6726('0x1e')]&&_0x153832[_0x6726('0x1f')]&&_0x153832['phone']){var _0x300e56=new _0x27562c(_0x153832['accountSid'],_0x153832[_0x6726('0x1f')]);_0x300e56[_0x6726('0x20')][_0x6726('0x21')]({'body':_0x16786f[_0x6726('0xe')],'to':_0x6726('0x22')+_0x16786f[_0x6726('0x23')],'from':'whatsapp:'+_0x153832[_0x6726('0x23')],'statusCallback':_0x153832[_0x6726('0x24')]+_0x6726('0x25')+_0x16786f['id']+_0x6726('0x26')+_0x153832['token']})[_0x6726('0x18')](function(_0x48373b){if(_0x48373b['sid']){return _0xdda3e6[_0x6726('0x19')]({'messageId':_0x48373b[_0x6726('0x27')]});}})[_0x6726('0x1a')](function(_0x3b0abf){logger['error'](_0x6726('0x28'),_0x6726('0x29'),_0x6726('0x1d'),util['inspect'](_0x3b0abf,{'showHidden':![],'depth':null}));});}else{logger[_0x6726('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x6726('0x2b'));}break;case _0x6726('0x2c'):var _0x199af0=_0x153832[_0x6726('0x1e')];var _0x5156ae=_0x153832[_0x6726('0x1f')];var _0x119cb0=_0x153832[_0x6726('0x2d')]+'/whatsapp/v1/'+_0x199af0+_0x6726('0x2e');var _0xcf8209={'to':[_0x16786f['phone']],'message':{'type':_0x6726('0x2f'),'text':_0x16786f[_0x6726('0xe')]}};var _0x385bda={'method':_0x6726('0x30'),'uri':_0x119cb0,'headers':{'Authorization':_0x6726('0x31')+_0x5156ae,'Content-Type':_0x6726('0x32')},'body':_0xcf8209,'json':!![]};rp(_0x385bda)[_0x6726('0x18')](function(_0x4a3cf){if(_0x4a3cf['statuses'][0x0][_0x6726('0x33')]){return _0xdda3e6[_0x6726('0x19')]({'messageId':_0x4a3cf[_0x6726('0x34')][0x0][_0x6726('0x33')]});}})[_0x6726('0x1a')](function(_0x2b1c64){logger[_0x6726('0x35')](_0x6726('0x36'),_0x2b1c64);});break;}}})['finally'](function(){_0x44ff0c();});}else{_0x44ff0c();}}},'charset':'utf8mb4','collate':_0x6726('0x37')});}; \ No newline at end of file +var _0x412a=['toLowerCase','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','out','WhatsappAccount','find','then','type','twilio','authToken','accountSid','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction'];(function(_0x383eb8,_0x19785e){var _0x5d266=function(_0x1c15fa){while(--_0x1c15fa){_0x383eb8['push'](_0x383eb8['shift']());}};_0x5d266(++_0x19785e);}(_0x412a,0x114));var _0xa412=function(_0x50570c,_0x50565c){_0x50570c=_0x50570c-0x0;var _0x4159df=_0x412a[_0x50570c];return _0x4159df;};'use strict';var _=require(_0xa412('0x0'));var util=require(_0xa412('0x1'));var logger=require(_0xa412('0x2'))('api');var moment=require(_0xa412('0x3'));var BPromise=require(_0xa412('0x4'));var rp=require(_0xa412('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xa412('0x6'));var rimraf=require(_0xa412('0x7'));var config=require(_0xa412('0x8'));var attributes=require(_0xa412('0x9'));module[_0xa412('0xa')]=function(_0x17fe60,_0x14efad){return _0x17fe60[_0xa412('0xb')](_0xa412('0xc'),attributes,{'tableName':_0xa412('0xd'),'paranoid':![],'indexes':[{'name':_0xa412('0xe'),'fields':[_0xa412('0xe')]},{'name':_0xa412('0xf'),'fields':['body'],'type':_0xa412('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34deae,_0x415ecf,_0x43132b){var _0x59ec11=_0x17fe60['models'];var _0x4b1c4c=_0x34deae[_0xa412('0x11')]({'plain':!![]});if(_0x4b1c4c[_0xa412('0x12')][_0xa412('0x13')]()==='in'||_0x4b1c4c['direction'][_0xa412('0x13')]()==='out'&&!_0x4b1c4c[_0xa412('0x14')]&&!_[_0xa412('0x15')](_0x4b1c4c['UserId'])){_0x59ec11[_0xa412('0x16')][_0xa412('0x17')]({'where':{'id':_0x4b1c4c[_0xa412('0x18')]}})['then'](function(_0x4fadcd){if(_0x4fadcd){_0x4fadcd[_0xa412('0x19')]({'lastMsgAt':_0x4b1c4c[_0xa412('0x1a')],'lastMsgDirection':_0x4b1c4c[_0xa412('0x12')][_0xa412('0x13')]()});}})[_0xa412('0x1b')](function(_0x10d0a0){console[_0xa412('0x1c')](_0x10d0a0);});}if(_0x4b1c4c[_0xa412('0x12')]===_0xa412('0x1d')&&!_0x4b1c4c['secret']){var _0x2e2049;_0x59ec11[_0xa412('0x1e')][_0xa412('0x1f')]({'where':{'id':_0x4b1c4c['WhatsappAccountId']},'raw':!![]})[_0xa412('0x20')](function(_0x370262){_0x2e2049=_0x370262;if(_0x2e2049&&_0x2e2049[_0xa412('0x21')]){switch(_0x2e2049[_0xa412('0x21')]){case'twilio':var _0x3b31f6=require(_0xa412('0x22'));if(_0x2e2049['accountSid']&&_0x2e2049[_0xa412('0x23')]&&_0x2e2049['phone']){var _0x48d65f=new _0x3b31f6(_0x2e2049[_0xa412('0x24')],_0x2e2049[_0xa412('0x23')]);_0x48d65f['messages'][_0xa412('0x25')]({'body':_0x4b1c4c['body'],'to':_0xa412('0x26')+_0x4b1c4c[_0xa412('0x27')],'from':'whatsapp:'+_0x2e2049[_0xa412('0x27')],'statusCallback':_0x2e2049[_0xa412('0x28')]+_0xa412('0x29')+_0x4b1c4c['id']+'/status?token='+_0x2e2049[_0xa412('0x2a')]})[_0xa412('0x20')](function(_0x5b8507){if(_0x5b8507[_0xa412('0x2b')]){return _0x34deae[_0xa412('0x19')]({'messageId':_0x5b8507[_0xa412('0x2b')]});}})[_0xa412('0x1b')](function(_0x466335){logger[_0xa412('0x1c')](_0xa412('0x2c'),'afterCreate','twilio',util[_0xa412('0x2d')](_0x466335,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa412('0x2c'),_0xa412('0x2e'),_0xa412('0x22'),_0xa412('0x2f'));}break;case _0xa412('0x30'):var _0x4ff57=_0x2e2049[_0xa412('0x24')];var _0x223135=_0x2e2049[_0xa412('0x23')];var _0x5dc910=_0x2e2049[_0xa412('0x31')]+_0xa412('0x32')+_0x4ff57+_0xa412('0x33');var _0x2e4e05={'to':[_0x4b1c4c[_0xa412('0x27')]],'message':{'type':'text','text':_0x4b1c4c['body']}};var _0x48495b={'method':'POST','uri':_0x5dc910,'headers':{'Authorization':_0xa412('0x34')+_0x223135,'Content-Type':'application/json'},'body':_0x2e4e05,'json':!![]};rp(_0x48495b)[_0xa412('0x20')](function(_0x4ee5f0){if(_0x4ee5f0[_0xa412('0x35')][0x0][_0xa412('0x36')]){return _0x34deae[_0xa412('0x19')]({'messageId':_0x4ee5f0[_0xa412('0x35')][0x0][_0xa412('0x36')]});}})['catch'](function(_0x5be2a5){logger['err'](_0xa412('0x37'),_0x5be2a5);});break;}}})[_0xa412('0x38')](function(){_0x43132b();});}else{_0x43132b();}}},'charset':_0xa412('0x39'),'collate':_0xa412('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cb4f21a..ddd8892 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 _0x8421=['lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x25061e,_0xf822a9){var _0xc65a3c=function(_0x19baa7){while(--_0x19baa7){_0x25061e['push'](_0x25061e['shift']());}};_0xc65a3c(++_0xf822a9);}(_0x8421,0x70));var _0x1842=function(_0x1a06ab,_0x3e8061){_0x1a06ab=_0x1a06ab-0x0;var _0x1ebd32=_0x8421[_0x1a06ab];return _0x1ebd32;};'use strict';var _=require(_0x1842('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1842('0x1'));var fs=require('fs');var Redis=require(_0x1842('0x2'));var db=require(_0x1842('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1842('0x4'))('rpc');var config=require(_0x1842('0x5'));var jayson=require(_0x1842('0x6'));var client=jayson[_0x1842('0x7')]['http']({'port':0x232a});config[_0x1842('0x8')]=_['defaults'](config[_0x1842('0x8')],{'host':_0x1842('0x9'),'port':0x18eb});var socket=require(_0x1842('0xa'))(new Redis(config[_0x1842('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a3792,_0x45646c,_0x3cc38d){return new BPromise(function(_0x524ed1,_0x59b8c1){return client['request'](_0x2a3792,_0x3cc38d)[_0x1842('0xb')](function(_0xbfffeb){logger[_0x1842('0xc')]('WhatsappMessage,\x20%s,\x20%s',_0x45646c,'request\x20sent');logger[_0x1842('0xd')](_0x1842('0xe'),_0x45646c,_0x1842('0xf'),JSON[_0x1842('0x10')](_0xbfffeb));if(_0xbfffeb[_0x1842('0x11')]){if(_0xbfffeb[_0x1842('0x11')][_0x1842('0x12')]===0x1f4){logger[_0x1842('0x11')](_0x1842('0x13'),_0x45646c,_0xbfffeb[_0x1842('0x11')]['message']);return _0x59b8c1(_0xbfffeb[_0x1842('0x11')][_0x1842('0x14')]);}logger[_0x1842('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x45646c,_0xbfffeb[_0x1842('0x11')]['message']);return _0x524ed1(_0xbfffeb[_0x1842('0x11')][_0x1842('0x14')]);}else{logger['info'](_0x1842('0x13'),_0x45646c,'request\x20sent');_0x524ed1(_0xbfffeb[_0x1842('0x15')]['message']);}})[_0x1842('0x16')](function(_0x519a24){logger[_0x1842('0x11')](_0x1842('0x13'),_0x45646c,_0x519a24);_0x59b8c1(_0x519a24);});});}exports[_0x1842('0x17')]=function(_0xbb34f5){var _0x26d294=this;return new Promise(function(_0x6f9fe8,_0x3a776f){return db[_0x1842('0x18')][_0x1842('0x19')](_0xbb34f5[_0x1842('0x1a')],{'raw':_0xbb34f5[_0x1842('0x1b')]?_0xbb34f5[_0x1842('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51325d){logger[_0x1842('0xc')](_0x1842('0x17'),_0xbb34f5);logger[_0x1842('0xd')](_0x1842('0x17'),_0xbb34f5,JSON[_0x1842('0x10')](_0x51325d));_0x6f9fe8(_0x51325d);})[_0x1842('0x16')](function(_0x5db623){logger[_0x1842('0x11')](_0x1842('0x17'),_0x5db623[_0x1842('0x14')],_0xbb34f5);_0x3a776f(_0x26d294[_0x1842('0x11')](0x1f4,_0x5db623[_0x1842('0x14')]));});});}; \ No newline at end of file +var _0x2205=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','info','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2205,0xd4));var _0x5220=function(_0x371eba,_0x5c9b2a){_0x371eba=_0x371eba-0x0;var _0x34d91c=_0x2205[_0x371eba];return _0x34d91c;};'use strict';var _=require(_0x5220('0x0'));var util=require(_0x5220('0x1'));var moment=require(_0x5220('0x2'));var BPromise=require('bluebird');var rs=require(_0x5220('0x3'));var fs=require('fs');var Redis=require(_0x5220('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5220('0x5'))(_0x5220('0x6'));var config=require(_0x5220('0x7'));var jayson=require(_0x5220('0x8'));var client=jayson[_0x5220('0x9')][_0x5220('0xa')]({'port':0x232a});config['redis']=_[_0x5220('0xb')](config[_0x5220('0xc')],{'host':_0x5220('0xd'),'port':0x18eb});var socket=require(_0x5220('0xe'))(new Redis(config[_0x5220('0xc')]));require('./whatsappMessage.socket')[_0x5220('0xf')](socket);function respondWithRpcPromise(_0x173923,_0x3d020e,_0x1a54ff){return new BPromise(function(_0x34454a,_0x4f61d8){return client['request'](_0x173923,_0x1a54ff)[_0x5220('0x10')](function(_0xe69372){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3d020e,'request\x20sent');logger[_0x5220('0x11')](_0x5220('0x12'),_0x3d020e,_0x5220('0x13'),JSON[_0x5220('0x14')](_0xe69372));if(_0xe69372[_0x5220('0x15')]){if(_0xe69372['error'][_0x5220('0x16')]===0x1f4){logger[_0x5220('0x15')](_0x5220('0x17'),_0x3d020e,_0xe69372['error'][_0x5220('0x18')]);return _0x4f61d8(_0xe69372[_0x5220('0x15')][_0x5220('0x18')]);}logger[_0x5220('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x3d020e,_0xe69372['error'][_0x5220('0x18')]);return _0x34454a(_0xe69372[_0x5220('0x15')][_0x5220('0x18')]);}else{logger['info'](_0x5220('0x17'),_0x3d020e,_0x5220('0x13'));_0x34454a(_0xe69372[_0x5220('0x19')][_0x5220('0x18')]);}})[_0x5220('0x1a')](function(_0x4ee601){logger['error'](_0x5220('0x17'),_0x3d020e,_0x4ee601);_0x4f61d8(_0x4ee601);});});}exports[_0x5220('0x1b')]=function(_0x4617b4){var _0xcc4ec9=this;return new Promise(function(_0x44327b,_0x56f196){return db[_0x5220('0x1c')][_0x5220('0x1d')](_0x4617b4[_0x5220('0x1e')],{'raw':_0x4617b4[_0x5220('0x1f')]?_0x4617b4[_0x5220('0x1f')][_0x5220('0x20')]===undefined?!![]:![]:!![]})[_0x5220('0x10')](function(_0x4ffc66){logger[_0x5220('0x21')](_0x5220('0x1b'),_0x4617b4);logger['debug'](_0x5220('0x1b'),_0x4617b4,JSON[_0x5220('0x14')](_0x4ffc66));_0x44327b(_0x4ffc66);})[_0x5220('0x1a')](function(_0x2182f1){logger[_0x5220('0x15')](_0x5220('0x1b'),_0x2182f1[_0x5220('0x18')],_0x4617b4);_0x56f196(_0xcc4ec9[_0x5220('0x15')](0x1f4,_0x2182f1[_0x5220('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 74661ff..d347aa8 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 _0xf95e=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x8d1720,_0x1abeaa){var _0xee362a=function(_0x58e6ac){while(--_0x58e6ac){_0x8d1720['push'](_0x8d1720['shift']());}};_0xee362a(++_0x1abeaa);}(_0xf95e,0x125));var _0xef95=function(_0x48c069,_0x553ea7){_0x48c069=_0x48c069-0x0;var _0xf7514c=_0xf95e[_0x48c069];return _0xf7514c;};'use strict';var WhatsappMessageEvents=require(_0xef95('0x0'));var events=[_0xef95('0x1'),_0xef95('0x2'),_0xef95('0x3')];function createListener(_0x5a93fb,_0x27235b){return function(_0x52c6c7){_0x27235b[_0xef95('0x4')](_0x5a93fb,_0x52c6c7);};}function removeListener(_0x5e2630,_0x34ccf3){return function(){WhatsappMessageEvents[_0xef95('0x5')](_0x5e2630,_0x34ccf3);};}exports[_0xef95('0x6')]=function(_0x413fea){for(var _0xfdf2d3=0x0,_0x3fc229=events[_0xef95('0x7')];_0xfdf2d3<_0x3fc229;_0xfdf2d3++){var _0x47013a=events[_0xfdf2d3];var _0x367e54=createListener(_0xef95('0x8')+_0x47013a,_0x413fea);WhatsappMessageEvents['on'](_0x47013a,_0x367e54);}}; \ No newline at end of file +var _0x91fa=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','emit'];(function(_0x287360,_0x18dd9b){var _0x5e4bef=function(_0xf640f5){while(--_0xf640f5){_0x287360['push'](_0x287360['shift']());}};_0x5e4bef(++_0x18dd9b);}(_0x91fa,0x1d9));var _0xa91f=function(_0xe0c564,_0x2ff569){_0xe0c564=_0xe0c564-0x0;var _0x32e0f6=_0x91fa[_0xe0c564];return _0x32e0f6;};'use strict';var WhatsappMessageEvents=require(_0xa91f('0x0'));var events=[_0xa91f('0x1'),'remove','update'];function createListener(_0x5f5a52,_0x25b554){return function(_0x19a9d5){_0x25b554[_0xa91f('0x2')](_0x5f5a52,_0x19a9d5);};}function removeListener(_0x21a73c,_0x2a4397){return function(){WhatsappMessageEvents[_0xa91f('0x3')](_0x21a73c,_0x2a4397);};}exports[_0xa91f('0x4')]=function(_0x594090){for(var _0x51d8a9=0x0,_0x2bcbde=events[_0xa91f('0x5')];_0x51d8a9<_0x2bcbde;_0x51d8a9++){var _0x3982bc=events[_0x51d8a9];var _0x209f1a=createListener(_0xa91f('0x6')+_0x3982bc,_0x594090);WhatsappMessageEvents['on'](_0x3982bc,_0x209f1a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 340584b..0c96f3b 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 _0x8486=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addAgents','/:id','update','delete','destroy','removeTeams','exports'];(function(_0x523671,_0x4657fc){var _0x5b0bdc=function(_0x301007){while(--_0x301007){_0x523671['push'](_0x523671['shift']());}};_0x5b0bdc(++_0x4657fc);}(_0x8486,0x70));var _0x6848=function(_0x207ba8,_0x343c30){_0x207ba8=_0x207ba8-0x0;var _0x1f933d=_0x8486[_0x207ba8];return _0x1f933d;};'use strict';var multer=require(_0x6848('0x0'));var util=require(_0x6848('0x1'));var path=require(_0x6848('0x2'));var timeout=require('connect-timeout');var express=require(_0x6848('0x3'));var router=express[_0x6848('0x4')]();var fs_extra=require(_0x6848('0x5'));var auth=require(_0x6848('0x6'));var interaction=require(_0x6848('0x7'));var config=require(_0x6848('0x8'));var controller=require('./whatsappQueue.controller');router[_0x6848('0x9')]('/',auth[_0x6848('0xa')](),controller[_0x6848('0xb')]);router['get'](_0x6848('0xc'),auth[_0x6848('0xa')](),controller[_0x6848('0xd')]);router[_0x6848('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6848('0xe')]);router['get'](_0x6848('0xf'),auth[_0x6848('0xa')](),controller['getMembers']);router[_0x6848('0x9')](_0x6848('0x10'),auth[_0x6848('0xa')](),controller['getTeams']);router['get'](_0x6848('0x11'),auth[_0x6848('0xa')](),controller[_0x6848('0x12')]);router[_0x6848('0x13')]('/',auth[_0x6848('0xa')](),controller[_0x6848('0x14')]);router[_0x6848('0x13')](_0x6848('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6848('0x13')]('/:id/users',auth[_0x6848('0xa')](),controller[_0x6848('0x15')]);router['put'](_0x6848('0x16'),auth[_0x6848('0xa')](),controller[_0x6848('0x17')]);router[_0x6848('0x18')](_0x6848('0x16'),auth[_0x6848('0xa')](),controller[_0x6848('0x19')]);router[_0x6848('0x18')](_0x6848('0x10'),auth[_0x6848('0xa')](),controller[_0x6848('0x1a')]);router['delete'](_0x6848('0x11'),auth[_0x6848('0xa')](),controller['removeAgents']);module[_0x6848('0x1b')]=router; \ No newline at end of file +var _0x194e=['getAgents','post','addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x284145,_0x5a7ef0){var _0x24c78c=function(_0x377a99){while(--_0x377a99){_0x284145['push'](_0x284145['shift']());}};_0x24c78c(++_0x5a7ef0);}(_0x194e,0x1a2));var _0xe194=function(_0x1938ea,_0x314076){_0x1938ea=_0x1938ea-0x0;var _0x3b4f1e=_0x194e[_0x1938ea];return _0x3b4f1e;};'use strict';var multer=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var path=require(_0xe194('0x2'));var timeout=require(_0xe194('0x3'));var express=require('express');var router=express[_0xe194('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe194('0x5'));var config=require(_0xe194('0x6'));var controller=require(_0xe194('0x7'));router[_0xe194('0x8')]('/',auth[_0xe194('0x9')](),controller[_0xe194('0xa')]);router[_0xe194('0x8')](_0xe194('0xb'),auth[_0xe194('0x9')](),controller['describe']);router['get']('/:id',auth[_0xe194('0x9')](),controller[_0xe194('0xc')]);router[_0xe194('0x8')](_0xe194('0xd'),auth[_0xe194('0x9')](),controller[_0xe194('0xe')]);router['get'](_0xe194('0xf'),auth[_0xe194('0x9')](),controller['getTeams']);router[_0xe194('0x8')](_0xe194('0x10'),auth[_0xe194('0x9')](),controller[_0xe194('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe194('0x12')](_0xe194('0xf'),auth['isAuthenticated'](),controller[_0xe194('0x13')]);router[_0xe194('0x12')]('/:id/users',auth[_0xe194('0x9')](),controller[_0xe194('0x14')]);router[_0xe194('0x15')](_0xe194('0x16'),auth[_0xe194('0x9')](),controller[_0xe194('0x17')]);router['delete'](_0xe194('0x16'),auth[_0xe194('0x9')](),controller[_0xe194('0x18')]);router['delete']('/:id/teams',auth[_0xe194('0x9')](),controller[_0xe194('0x19')]);router[_0xe194('0x1a')](_0xe194('0x10'),auth[_0xe194('0x9')](),controller[_0xe194('0x1b')]);module[_0xe194('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6f01ce4..5942373 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 _0xf403=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x34ee31,_0x3d0de8){var _0x5e1fea=function(_0x1b54e1){while(--_0x1b54e1){_0x34ee31['push'](_0x34ee31['shift']());}};_0x5e1fea(++_0x3d0de8);}(_0xf403,0x1d3));var _0x3f40=function(_0x56f271,_0x26ff95){_0x56f271=_0x56f271-0x0;var _0x2c58bd=_0xf403[_0x56f271];return _0x2c58bd;};'use strict';var Sequelize=require(_0x3f40('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f40('0x1')],'unique':_0x3f40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3f40('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f40('0x4')](_0x3f40('0x5'),_0x3f40('0x6'),_0x3f40('0x7'))},'description':{'type':Sequelize[_0x3f40('0x1')]}}; \ No newline at end of file +var _0xf194=['sequelize','exports','STRING','name','ENUM'];(function(_0x27e76d,_0x5709cc){var _0x40ea12=function(_0x599ee1){while(--_0x599ee1){_0x27e76d['push'](_0x27e76d['shift']());}};_0x40ea12(++_0x5709cc);}(_0xf194,0x91));var _0x4f19=function(_0xe1fe44,_0x4745f6){_0xe1fe44=_0xe1fe44-0x0;var _0x29d043=_0xf194[_0xe1fe44];return _0x29d043;};'use strict';var Sequelize=require(_0x4f19('0x0'));module[_0x4f19('0x1')]={'name':{'type':Sequelize[_0x4f19('0x2')],'unique':_0x4f19('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f19('0x4')]('rrmemory','beepall','roundrobin')},'description':{'type':Sequelize[_0x4f19('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a037aa3..fbe9e3f 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 _0x4b68=['show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','SIP','whatsappPause','getTeams','findOne','Team','options','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','includes','union','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','include','query','findAll','catch'];(function(_0x5a0d79,_0x17aed4){var _0x5bee8d=function(_0x12a468){while(--_0x12a468){_0x5a0d79['push'](_0x5a0d79['shift']());}};_0x5bee8d(++_0x17aed4);}(_0x4b68,0xc3));var _0x84b6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b68[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0x84b6('0x0'));var util=require(_0x84b6('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x84b6('0x2'));var qs=require(_0x84b6('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x84b6('0x4'));var db=require(_0x84b6('0x5'))['db'];config['redis']=_['defaults'](config[_0x84b6('0x6')],{'host':_0x84b6('0x7'),'port':0x18eb});var socket=require(_0x84b6('0x8'))(new Redis(config[_0x84b6('0x6')]));require('./whatsappQueue.socket')[_0x84b6('0x9')](socket);function respondWithStatusCode(_0x39c567,_0x52914c){_0x52914c=_0x52914c||0xcc;return function(_0x1fc329){if(_0x1fc329){return _0x39c567[_0x84b6('0xa')](_0x52914c);}return _0x39c567[_0x84b6('0xb')](_0x52914c)[_0x84b6('0xc')]();};}function respondWithResult(_0x28f1b2,_0x5b83d5){_0x5b83d5=_0x5b83d5||0xc8;return function(_0x349cc5){if(_0x349cc5){return _0x28f1b2['status'](_0x5b83d5)[_0x84b6('0xd')](_0x349cc5);}};}function respondWithFilteredResult(_0x1d5e8e,_0x27a10c){return function(_0x173db6){if(_0x173db6){var _0x53e877=typeof _0x27a10c['offset']===_0x84b6('0xe')&&typeof _0x27a10c[_0x84b6('0xf')]===_0x84b6('0xe');var _0x2a6705=_0x173db6[_0x84b6('0x10')];var _0x15bd68=_0x53e877?0x0:_0x27a10c['offset'];var _0x5f1fbd=_0x53e877?_0x173db6['count']:_0x27a10c[_0x84b6('0x11')]+_0x27a10c[_0x84b6('0xf')];var _0x52732b;if(_0x5f1fbd>=_0x2a6705){_0x5f1fbd=_0x2a6705;_0x52732b=0xc8;}else{_0x52732b=0xce;}_0x1d5e8e[_0x84b6('0xb')](_0x52732b);return _0x1d5e8e[_0x84b6('0x12')](_0x84b6('0x13'),_0x15bd68+'-'+_0x5f1fbd+'/'+_0x2a6705)[_0x84b6('0xd')](_0x173db6);}return null;};}function saveUpdates(_0x41e940){return function(_0x114f48){if(_0x114f48){return _0x114f48[_0x84b6('0x14')](_0x41e940)['then'](function(_0x1de4ea){return _0x1de4ea;});}return null;};}function removeEntity(_0x5f3b71){return function(_0x286c26){if(_0x286c26){return _0x286c26[_0x84b6('0x15')]()[_0x84b6('0x16')](function(){var _0x2cf0e6=_0x286c26[_0x84b6('0x17')]({'plain':!![]});var _0x46b9d3=_0x84b6('0x18');return db[_0x84b6('0x19')]['destroy']({'where':{'type':_0x46b9d3,'resourceId':_0x2cf0e6['id']}})[_0x84b6('0x16')](function(){return _0x286c26;});})[_0x84b6('0x16')](function(){_0x5f3b71[_0x84b6('0xb')](0xcc)[_0x84b6('0xc')]();});}};}function handleEntityNotFound(_0x2802b5){return function(_0x2f22ff){if(!_0x2f22ff){_0x2802b5[_0x84b6('0xa')](0x194);}return _0x2f22ff;};}function handleError(_0x5b0432,_0x6a1c1d){_0x6a1c1d=_0x6a1c1d||0x1f4;return function(_0x4a588f){logger[_0x84b6('0x1a')](_0x4a588f[_0x84b6('0x1b')]);if(_0x4a588f[_0x84b6('0x1c')]){delete _0x4a588f[_0x84b6('0x1c')];}_0x5b0432['status'](_0x6a1c1d)[_0x84b6('0x1d')](_0x4a588f);};}exports[_0x84b6('0x1e')]=function(_0x258ed9,_0x2b9ef9){var _0x421495={};var _0x561364={'count':0x0,'rows':[]};var _0x222074=_[_0x84b6('0x1f')](db[_0x84b6('0x20')][_0x84b6('0x21')],function(_0x18bc34){return{'name':_0x18bc34[_0x84b6('0x22')],'type':_0x18bc34[_0x84b6('0x23')][_0x84b6('0x24')]};});_0x421495=qs['getOptions'](_0x222074,_0x258ed9);var _0x5cbf06={'where':_0x421495['where']};return db[_0x84b6('0x20')][_0x84b6('0x10')](_0x5cbf06)['then'](function(_0x5355ab){_0x561364[_0x84b6('0x10')]=_0x5355ab;_0x421495[_0x84b6('0x25')]=qs['include'](_0x258ed9[_0x84b6('0x26')]);return db['WhatsappQueue'][_0x84b6('0x27')](_0x421495);})['then'](function(_0x3c2f7a){_0x561364['rows']=_0x3c2f7a;return _0x561364;})[_0x84b6('0x16')](respondWithFilteredResult(_0x2b9ef9,_0x421495))[_0x84b6('0x28')](handleError(_0x2b9ef9,null));};exports[_0x84b6('0x29')]=function(_0xd3a60e,_0x3c598d){var _0xaea1e0={'raw':!![],'where':{'id':_0xd3a60e[_0x84b6('0x2a')]['id']}},_0x1e8797={};_0x1e8797[_0x84b6('0x2b')]=_['keys'](db[_0x84b6('0x20')][_0x84b6('0x21')]);_0x1e8797[_0x84b6('0x26')]=_[_0x84b6('0x2c')](_0xd3a60e[_0x84b6('0x26')]);_0x1e8797['filters']=_[_0x84b6('0x2d')](_0x1e8797[_0x84b6('0x2b')],_0x1e8797[_0x84b6('0x26')]);_0xaea1e0[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x1e8797['model'],qs['fields'](_0xd3a60e[_0x84b6('0x26')][_0x84b6('0x2f')]));_0xaea1e0[_0x84b6('0x2e')]=_0xaea1e0[_0x84b6('0x2e')][_0x84b6('0x30')]?_0xaea1e0[_0x84b6('0x2e')]:_0x1e8797[_0x84b6('0x2b')];if(_0xd3a60e[_0x84b6('0x26')][_0x84b6('0x31')]){_0xaea1e0[_0x84b6('0x25')]=[{'all':!![]}];}_0xaea1e0=_[_0x84b6('0x32')]({},_0xaea1e0,_0xd3a60e['options']);return db[_0x84b6('0x20')][_0x84b6('0x33')](_0xaea1e0)[_0x84b6('0x16')](handleEntityNotFound(_0x3c598d,null))[_0x84b6('0x16')](respondWithResult(_0x3c598d,null))['catch'](handleError(_0x3c598d,null));};exports[_0x84b6('0x34')]=function(_0x4d6132,_0x190013){return db['WhatsappQueue'][_0x84b6('0x34')](_0x4d6132['body'],{})['then'](function(_0x5042a6){var _0x259d3f=_0x4d6132[_0x84b6('0x35')]['get']({'plain':!![]});if(!_0x259d3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x259d3f[_0x84b6('0x36')]==='user'){var _0x3001bd=_0x5042a6[_0x84b6('0x17')]({'plain':!![]});var _0xdbbcd9=_0x84b6('0x18');return db[_0x84b6('0x37')][_0x84b6('0x33')]({'where':{'name':_0xdbbcd9,'userProfileId':_0x259d3f[_0x84b6('0x38')]},'raw':!![]})[_0x84b6('0x16')](function(_0x3983f9){if(_0x3983f9&&_0x3983f9[_0x84b6('0x39')]===0x0){return db[_0x84b6('0x19')][_0x84b6('0x34')]({'name':_0x3001bd[_0x84b6('0x1c')],'resourceId':_0x3001bd['id'],'type':_0x3983f9['name'],'sectionId':_0x3983f9['id']},{})[_0x84b6('0x16')](function(){return _0x5042a6;});}else{return _0x5042a6;}})[_0x84b6('0x28')](function(_0x44a828){logger[_0x84b6('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44a828);throw _0x44a828;});}return _0x5042a6;})[_0x84b6('0x16')](respondWithResult(_0x190013,0xc9))['catch'](handleError(_0x190013,null));};exports[_0x84b6('0x14')]=function(_0x48b043,_0x31931d){if(_0x48b043[_0x84b6('0x3a')]['id']){delete _0x48b043[_0x84b6('0x3a')]['id'];}return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x48b043['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x31931d,null))[_0x84b6('0x16')](saveUpdates(_0x48b043[_0x84b6('0x3a')],null))[_0x84b6('0x16')](respondWithResult(_0x31931d,null))[_0x84b6('0x28')](handleError(_0x31931d,null));};exports[_0x84b6('0x15')]=function(_0x179e74,_0x2cea2e){return db['WhatsappQueue'][_0x84b6('0x33')]({'where':{'id':_0x179e74['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x2cea2e,null))[_0x84b6('0x16')](removeEntity(_0x2cea2e,null))['catch'](handleError(_0x2cea2e,null));};exports['describe']=function(_0x56f3a0,_0x543a56){return db[_0x84b6('0x20')][_0x84b6('0x3b')]()['then'](respondWithResult(_0x543a56,null))[_0x84b6('0x28')](handleError(_0x543a56,null));};exports[_0x84b6('0x3c')]=function(_0x1aa127,_0x555bf8){var _0x443618={'raw':!![],'where':{}},_0x32e100={},_0x507f9f;return db[_0x84b6('0x20')]['findOne']({'where':{'id':_0x1aa127['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x555bf8,null))['then'](function(_0x24176b){if(_0x24176b){_0x507f9f=_0x24176b['get']({'plain':!![]});_0x32e100[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x3d')][_0x84b6('0x21')]);_0x32e100[_0x84b6('0x26')]=_[_0x84b6('0x2c')](_0x1aa127['query']);_0x32e100[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x32e100['model'],_0x32e100['query']);_0x443618['attributes']=_[_0x84b6('0x2d')](_0x32e100[_0x84b6('0x2b')],qs[_0x84b6('0x2f')](_0x1aa127['query']['fields']));_0x443618['attributes']=_0x443618['attributes']['length']?_0x443618['attributes']:_0x32e100[_0x84b6('0x2b')];if(!_0x1aa127[_0x84b6('0x26')][_0x84b6('0x3f')](_0x84b6('0x40'))){_0x443618[_0x84b6('0xf')]=qs[_0x84b6('0xf')](_0x1aa127[_0x84b6('0x26')]['limit']);_0x443618['offset']=qs[_0x84b6('0x11')](_0x1aa127[_0x84b6('0x26')][_0x84b6('0x11')]);}_0x443618[_0x84b6('0x41')]=qs[_0x84b6('0x42')](_0x1aa127[_0x84b6('0x26')][_0x84b6('0x42')]);_0x443618['where']=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x1aa127[_0x84b6('0x26')],_0x32e100[_0x84b6('0x3e')]));_0x443618[_0x84b6('0x44')][_0x84b6('0x45')]=_0x24176b['id'];if(_0x1aa127[_0x84b6('0x26')][_0x84b6('0x46')]){_0x443618[_0x84b6('0x44')]=_['merge'](_0x443618[_0x84b6('0x44')],{'$or':_[_0x84b6('0x1f')](_0x443618['attributes'],function(_0xc6c1bd){var _0x2059e8={};_0x2059e8[_0xc6c1bd]={'$like':'%'+_0x1aa127[_0x84b6('0x26')][_0x84b6('0x46')]+'%'};return _0x2059e8;})});}_0x443618=_[_0x84b6('0x32')]({},_0x443618,_0x1aa127['options']);return db['UserWhatsappQueue'][_0x84b6('0x27')](_0x443618);}})[_0x84b6('0x16')](function(_0x103a6b){if(_0x103a6b){return db[_0x84b6('0x47')][_0x84b6('0x48')]({'where':{'id':_['map'](_0x103a6b,_0x84b6('0x49')),'role':_0x84b6('0x4a')},'attributes':['id',_0x84b6('0x1c'),'whatsappPause',_0x84b6('0x4b'),_0x84b6('0x4c')]});}})[_0x84b6('0x16')](function(_0x551512){if(_0x551512){return{'count':_0x551512['count'],'rows':_[_0x84b6('0x1f')](_0x551512[_0x84b6('0x4d')],function(_0x5ba181){return{'membername':_0x5ba181[_0x84b6('0x1c')],'UserId':_0x5ba181['id'],'queue_name':_0x507f9f[_0x84b6('0x1c')],'WhatsappQueueId':_0x507f9f['id'],'interface':util[_0x84b6('0x4e')]('%s/%s',_0x84b6('0x4f'),_0x5ba181[_0x84b6('0x1c')]),'penalty':0x0,'paused':_0x5ba181[_0x84b6('0x50')],'createdAt':_0x5ba181[_0x84b6('0x4c')],'updatedAt':_0x5ba181[_0x84b6('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x555bf8,_0x443618))['catch'](handleError(_0x555bf8,null));};exports[_0x84b6('0x51')]=function(_0x56b1d0,_0x327373){var _0x30b3cb={};var _0x3cafad={};var _0x2e6ec9;var _0x34898f;return db[_0x84b6('0x20')][_0x84b6('0x52')]({'where':{'id':_0x56b1d0[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x327373,null))[_0x84b6('0x16')](function(_0x1e7dc7){if(_0x1e7dc7){_0x2e6ec9=_0x1e7dc7;_0x3cafad[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x53')][_0x84b6('0x21')]);_0x3cafad[_0x84b6('0x26')]=_['keys'](_0x56b1d0['query']);_0x3cafad[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x3cafad[_0x84b6('0x2b')],_0x3cafad[_0x84b6('0x26')]);_0x30b3cb[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x3cafad[_0x84b6('0x2b')],qs[_0x84b6('0x2f')](_0x56b1d0['query'][_0x84b6('0x2f')]));_0x30b3cb[_0x84b6('0x2e')]=_0x30b3cb['attributes'][_0x84b6('0x30')]?_0x30b3cb['attributes']:_0x3cafad[_0x84b6('0x2b')];_0x30b3cb[_0x84b6('0x41')]=qs[_0x84b6('0x42')](_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x42')]);_0x30b3cb[_0x84b6('0x44')]=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x56b1d0[_0x84b6('0x26')],_0x3cafad[_0x84b6('0x3e')]));if(_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x46')]){_0x30b3cb[_0x84b6('0x44')]=_[_0x84b6('0x32')](_0x30b3cb['where'],{'$or':_[_0x84b6('0x1f')](_0x30b3cb[_0x84b6('0x2e')],function(_0x15978e){var _0x4f405b={};_0x4f405b[_0x15978e]={'$like':'%'+_0x56b1d0[_0x84b6('0x26')]['filter']+'%'};return _0x4f405b;})});}_0x30b3cb=_[_0x84b6('0x32')]({},_0x30b3cb,_0x56b1d0[_0x84b6('0x54')]);return _0x2e6ec9[_0x84b6('0x51')](_0x30b3cb);}})[_0x84b6('0x16')](function(_0x13c886){if(_0x13c886){_0x34898f=_0x13c886[_0x84b6('0x30')];if(!_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x3f')](_0x84b6('0x40'))){_0x30b3cb['limit']=qs['limit'](_0x56b1d0[_0x84b6('0x26')][_0x84b6('0xf')]);_0x30b3cb[_0x84b6('0x11')]=qs[_0x84b6('0x11')](_0x56b1d0['query']['offset']);}return _0x2e6ec9[_0x84b6('0x51')](_0x30b3cb);}})['then'](function(_0x5e1f3b){if(_0x5e1f3b){return _0x5e1f3b?{'count':_0x34898f,'rows':_0x5e1f3b}:null;}})[_0x84b6('0x16')](respondWithResult(_0x327373,null))['catch'](handleError(_0x327373,null));};exports['addTeams']=function(_0x5b912f,_0x12d1bd){var _0x10ffcb=_0x5b912f[_0x84b6('0x3a')][_0x84b6('0x55')];return db['Team'][_0x84b6('0x27')]({'where':{'id':_0x10ffcb},'attributes':['id'],'include':[{'model':db[_0x84b6('0x47')],'as':_0x84b6('0x56'),'attributes':['id',_0x84b6('0x1c'),_0x84b6('0x57'),_0x84b6('0x58'),_0x84b6('0x59')],'raw':!![]}]})[_0x84b6('0x16')](function(_0x24bc88){if(_0x24bc88){var _0x35cbbb=_[_0x84b6('0x5a')](_0x24bc88,function(_0x3a660e){var _0x5d05eb=_0x3a660e[_0x84b6('0x17')]({'plain':!![]});return _0x5d05eb[_0x84b6('0x56')];});return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x5b912f[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](function(_0x3f1250){return db[_0x84b6('0x5b')]['transaction'](function(_0x50ca9b){return _0x3f1250[_0x84b6('0x5c')](_0x10ffcb,{'transaction':_0x50ca9b})['then'](function(){return BPromise['each'](_0x35cbbb,function(_0x2e7244){return db[_0x84b6('0x3d')]['findOrCreate']({'where':{'UserId':_0x2e7244['id'],'WhatsappQueueId':_0x5b912f['params']['id']},'transaction':_0x50ca9b});});})['then'](function(){_0x35cbbb['forEach'](function(_0x449e99){socket[_0x84b6('0x5d')](_0x84b6('0x5e'),{'UserId':_0x449e99['id'],'WhatsappQueueId':_0x3f1250['id']});});});});});}})[_0x84b6('0x16')](respondWithStatusCode(_0x12d1bd,null))[_0x84b6('0x28')](handleError(_0x12d1bd,null));};exports[_0x84b6('0x5f')]=function(_0x4f5a10,_0x259df5){return db[_0x84b6('0x53')]['findAll']({'where':{'id':_0x4f5a10['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x84b6('0x47')],'as':_0x84b6('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x259df5,null))[_0x84b6('0x16')](function(_0x55b24f){var _0x4f45fd=_[_0x84b6('0x1f')](_0x55b24f,'id');var _0x3f47e4=[];var _0x81a01f=[];var _0x2b64a6=squel[_0x84b6('0x60')]();_0x2b64a6[_0x84b6('0x61')]('tq.TeamId')[_0x84b6('0x62')](_0x84b6('0x63'),'tq')[_0x84b6('0x64')](_0x84b6('0x65'),'ut',_0x84b6('0x66'))[_0x84b6('0x44')]('WhatsappQueueId\x20=\x20?',_0x4f5a10['params']['id']);for(var _0xc4016f=0x0;_0xc4016f<_0x55b24f['length'];_0xc4016f+=0x1){let _0x396dfb=_0x55b24f[_0xc4016f];for(var _0x4a0ede=0x0;_0x4a0ede<_0x396dfb['Agents'][_0x84b6('0x30')];_0x4a0ede+=0x1){let _0x306add=_0x396dfb[_0x84b6('0x56')][_0x4a0ede];var _0x595b93=_0x2b64a6['clone']();_0x595b93[_0x84b6('0x44')](_0x84b6('0x67'),_0x306add['id']);_0x81a01f[_0x84b6('0x68')](db[_0x84b6('0x5b')][_0x84b6('0x26')](_0x595b93['toString'](),{'type':db[_0x84b6('0x5b')]['QueryTypes'][_0x84b6('0x69')]})[_0x84b6('0x16')](function(_0x86dc97){if(_0x86dc97[_0x84b6('0x30')]===0x1){return _0x306add['id'];}else{var _0x30176a=_['every'](_['map'](_0x86dc97,'TeamId'),function(_0x39ca12){return _[_0x84b6('0x6a')](_0x4f45fd,_0x39ca12);});if(_0x30176a){return _0x306add['id'];}}}));}}return BPromise['all'](_0x81a01f)['then'](function(_0xbdb3c6){_0x3f47e4=_(_0x3f47e4)[_0x84b6('0x6b')](_0xbdb3c6)[_0x84b6('0x6c')]()[_0x84b6('0x6d')]();return db['WhatsappQueue'][_0x84b6('0x33')]({'where':{'id':_0x4f5a10['params']['id']}})['then'](function(_0x22c05f){return db['sequelize']['transaction'](function(_0x5820ea){return _0x22c05f[_0x84b6('0x5f')](_0x4f5a10[_0x84b6('0x26')]['ids'],{'transaction':_0x5820ea})['then'](function(){if(!_['isEmpty'](_0x3f47e4)){return _0x22c05f[_0x84b6('0x6e')](_0x3f47e4,{'transaction':_0x5820ea});}})[_0x84b6('0x16')](function(){_0x3f47e4[_0x84b6('0x6f')](function(_0x5f08f5){socket[_0x84b6('0x5d')](_0x84b6('0x70'),{'UserId':_0x5f08f5,'WhatsappQueueId':_0x22c05f['id']});});});});});});})['then'](respondWithStatusCode(_0x259df5,null))[_0x84b6('0x28')](handleError(_0x259df5,null));};exports[_0x84b6('0x71')]=function(_0x557308,_0x4aff96){return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x557308[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x4aff96,null))[_0x84b6('0x16')](function(_0x53a950){if(_0x53a950){return _0x53a950[_0x84b6('0x71')](_0x557308['body'][_0x84b6('0x55')],_[_0x84b6('0x72')](_0x557308[_0x84b6('0x3a')],[_0x84b6('0x55'),'id'])||{})[_0x84b6('0x73')](function(_0x1569a4){for(var _0x274a03=0x0;_0x274a03<_0x557308['body']['ids'][_0x84b6('0x30')];_0x274a03+=0x1){socket[_0x84b6('0x5d')](_0x84b6('0x5e'),{'UserId':Number(_0x557308[_0x84b6('0x3a')][_0x84b6('0x55')][_0x274a03]),'WhatsappQueueId':Number(_0x557308[_0x84b6('0x2a')]['id'])});}return _0x1569a4;});}})[_0x84b6('0x16')](respondWithResult(_0x4aff96,null))[_0x84b6('0x28')](handleError(_0x4aff96,null));};exports[_0x84b6('0x6e')]=function(_0x22ecd9,_0x513dd5){return db['WhatsappQueue']['find']({'where':{'id':_0x22ecd9[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x513dd5,null))['then'](function(_0x4ed80a){if(_0x4ed80a){return _0x4ed80a[_0x84b6('0x6e')](_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')])['then'](function(){if(_[_0x84b6('0x74')](_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')])){for(var _0x2df815=0x0;_0x2df815<_0x22ecd9[_0x84b6('0x26')]['ids']['length'];_0x2df815+=0x1){socket[_0x84b6('0x5d')](_0x84b6('0x70'),{'UserId':Number(_0x22ecd9[_0x84b6('0x26')]['ids'][_0x2df815]),'WhatsappQueueId':Number(_0x22ecd9['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')]),'WhatsappQueueId':Number(_0x22ecd9['params']['id'])});}});}})[_0x84b6('0x16')](respondWithStatusCode(_0x513dd5,null))['catch'](handleError(_0x513dd5,null));};exports[_0x84b6('0x75')]=function(_0x509ec9,_0x3a2006){var _0xe3e134={};var _0x49eb61={};var _0x513bab;var _0x5d53f7;return db[_0x84b6('0x20')][_0x84b6('0x52')]({'where':{'id':_0x509ec9[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x3a2006,null))[_0x84b6('0x16')](function(_0x891965){if(_0x891965){_0x513bab=_0x891965;_0x49eb61[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x47')][_0x84b6('0x21')]);_0x49eb61[_0x84b6('0x26')]=_['keys'](_0x509ec9['query']);_0x49eb61[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x49eb61['model'],_0x49eb61[_0x84b6('0x26')]);_0xe3e134[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x49eb61[_0x84b6('0x2b')],qs['fields'](_0x509ec9[_0x84b6('0x26')]['fields']));_0xe3e134[_0x84b6('0x2e')]=_0xe3e134[_0x84b6('0x2e')][_0x84b6('0x30')]?_0xe3e134[_0x84b6('0x2e')]:_0x49eb61[_0x84b6('0x2b')];_0xe3e134['order']=qs[_0x84b6('0x42')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0x42')]);_0xe3e134[_0x84b6('0x44')]=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x509ec9[_0x84b6('0x26')],_0x49eb61[_0x84b6('0x3e')]));if(_0x509ec9[_0x84b6('0x26')]['filter']){_0xe3e134[_0x84b6('0x44')]=_[_0x84b6('0x32')](_0xe3e134[_0x84b6('0x44')],{'$or':_[_0x84b6('0x1f')](_0xe3e134[_0x84b6('0x2e')],function(_0x1fc642){var _0x74e3c1={};_0x74e3c1[_0x1fc642]={'$like':'%'+_0x509ec9['query'][_0x84b6('0x46')]+'%'};return _0x74e3c1;})});}_0xe3e134=_[_0x84b6('0x32')]({},_0xe3e134,_0x509ec9[_0x84b6('0x54')]);return _0x513bab[_0x84b6('0x75')](_0xe3e134);}})[_0x84b6('0x16')](function(_0x308c13){if(_0x308c13){_0x5d53f7=_0x308c13[_0x84b6('0x30')];if(!_0x509ec9[_0x84b6('0x26')]['hasOwnProperty'](_0x84b6('0x40'))){_0xe3e134[_0x84b6('0xf')]=qs[_0x84b6('0xf')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0xf')]);_0xe3e134[_0x84b6('0x11')]=qs[_0x84b6('0x11')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0x11')]);}return _0x513bab['getAgents'](_0xe3e134);}})[_0x84b6('0x16')](function(_0x40b65d){if(_0x40b65d){return _0x40b65d?{'count':_0x5d53f7,'rows':_0x40b65d}:null;}})['then'](respondWithResult(_0x3a2006,null))[_0x84b6('0x28')](handleError(_0x3a2006,null));}; \ No newline at end of file +var _0xc62c=['includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','options','findAll','User','findAndCountAll','UserId','createdAt','format','%s/%s','whatsappPause','updatedAt','getTeams','addTeams','ids','Team','online','flatMap','Agents','sequelize','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','addAgents','omit','userWhatsappQueue:remove','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','UserProfileResource','error','stack','send','map','WhatsappQueue','fieldName','type','key','where','include','query','rows','catch','params','keys','filters','intersection','model','attributes','fields','length'];(function(_0x3dd0d6,_0x77920c){var _0x1da283=function(_0x3d8f1e){while(--_0x3d8f1e){_0x3dd0d6['push'](_0x3dd0d6['shift']());}};_0x1da283(++_0x77920c);}(_0xc62c,0xba));var _0xcc62=function(_0x225d99,_0x2d175e){_0x225d99=_0x225d99-0x0;var _0x649734=_0xc62c[_0x225d99];return _0x649734;};'use strict';var BPromise=require(_0xcc62('0x0'));var util=require('util');var _=require(_0xcc62('0x1'));var squel=require(_0xcc62('0x2'));var Redis=require('ioredis');var qs=require(_0xcc62('0x3'));var logger=require(_0xcc62('0x4'))(_0xcc62('0x5'));var config=require('../../config/environment');var db=require(_0xcc62('0x6'))['db'];config[_0xcc62('0x7')]=_['defaults'](config[_0xcc62('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc62('0x8'))(new Redis(config[_0xcc62('0x7')]));require(_0xcc62('0x9'))[_0xcc62('0xa')](socket);function respondWithStatusCode(_0x2db313,_0x3e4e2a){_0x3e4e2a=_0x3e4e2a||0xcc;return function(_0x17bbe8){if(_0x17bbe8){return _0x2db313[_0xcc62('0xb')](_0x3e4e2a);}return _0x2db313[_0xcc62('0xc')](_0x3e4e2a)[_0xcc62('0xd')]();};}function respondWithResult(_0x88b386,_0x1ab637){_0x1ab637=_0x1ab637||0xc8;return function(_0x170c94){if(_0x170c94){return _0x88b386['status'](_0x1ab637)[_0xcc62('0xe')](_0x170c94);}};}function respondWithFilteredResult(_0xc4afdb,_0x11ddbe){return function(_0xbb7a51){if(_0xbb7a51){var _0x1be4b8=typeof _0x11ddbe['offset']===_0xcc62('0xf')&&typeof _0x11ddbe[_0xcc62('0x10')]==='undefined';var _0x4cf36d=_0xbb7a51[_0xcc62('0x11')];var _0x18766e=_0x1be4b8?0x0:_0x11ddbe['offset'];var _0x4f9709=_0x1be4b8?_0xbb7a51[_0xcc62('0x11')]:_0x11ddbe[_0xcc62('0x12')]+_0x11ddbe[_0xcc62('0x10')];var _0x42c296;if(_0x4f9709>=_0x4cf36d){_0x4f9709=_0x4cf36d;_0x42c296=0xc8;}else{_0x42c296=0xce;}_0xc4afdb[_0xcc62('0xc')](_0x42c296);return _0xc4afdb[_0xcc62('0x13')](_0xcc62('0x14'),_0x18766e+'-'+_0x4f9709+'/'+_0x4cf36d)[_0xcc62('0xe')](_0xbb7a51);}return null;};}function saveUpdates(_0x53dc6a){return function(_0x5cedbf){if(_0x5cedbf){return _0x5cedbf[_0xcc62('0x15')](_0x53dc6a)[_0xcc62('0x16')](function(_0x1ccdf4){return _0x1ccdf4;});}return null;};}function removeEntity(_0x2493c6){return function(_0xd06f2f){if(_0xd06f2f){return _0xd06f2f[_0xcc62('0x17')]()[_0xcc62('0x16')](function(){var _0x535e15=_0xd06f2f['get']({'plain':!![]});var _0x3b0588='WhatsappQueues';return db[_0xcc62('0x18')][_0xcc62('0x17')]({'where':{'type':_0x3b0588,'resourceId':_0x535e15['id']}})[_0xcc62('0x16')](function(){return _0xd06f2f;});})[_0xcc62('0x16')](function(){_0x2493c6[_0xcc62('0xc')](0xcc)[_0xcc62('0xd')]();});}};}function handleEntityNotFound(_0x2816d6){return function(_0x35e7b4){if(!_0x35e7b4){_0x2816d6[_0xcc62('0xb')](0x194);}return _0x35e7b4;};}function handleError(_0x43c8e2,_0x3fab9c){_0x3fab9c=_0x3fab9c||0x1f4;return function(_0x599065){logger[_0xcc62('0x19')](_0x599065[_0xcc62('0x1a')]);if(_0x599065['name']){delete _0x599065['name'];}_0x43c8e2[_0xcc62('0xc')](_0x3fab9c)[_0xcc62('0x1b')](_0x599065);};}exports['index']=function(_0x5922bc,_0x37bb33){var _0x5914bc={};var _0x1236e9={'count':0x0,'rows':[]};var _0x5c77cb=_[_0xcc62('0x1c')](db[_0xcc62('0x1d')]['rawAttributes'],function(_0x5cb0b1){return{'name':_0x5cb0b1[_0xcc62('0x1e')],'type':_0x5cb0b1[_0xcc62('0x1f')][_0xcc62('0x20')]};});_0x5914bc=qs['getOptions'](_0x5c77cb,_0x5922bc);var _0x44c8b8={'where':_0x5914bc[_0xcc62('0x21')]};return db[_0xcc62('0x1d')][_0xcc62('0x11')](_0x44c8b8)[_0xcc62('0x16')](function(_0x3f4e30){_0x1236e9[_0xcc62('0x11')]=_0x3f4e30;_0x5914bc[_0xcc62('0x22')]=qs[_0xcc62('0x22')](_0x5922bc[_0xcc62('0x23')]);return db[_0xcc62('0x1d')]['findAll'](_0x5914bc);})['then'](function(_0x17cf59){_0x1236e9[_0xcc62('0x24')]=_0x17cf59;return _0x1236e9;})[_0xcc62('0x16')](respondWithFilteredResult(_0x37bb33,_0x5914bc))[_0xcc62('0x25')](handleError(_0x37bb33,null));};exports['show']=function(_0xaf086e,_0x3124ba){var _0x1a7265={'raw':!![],'where':{'id':_0xaf086e[_0xcc62('0x26')]['id']}},_0x1993a6={};_0x1993a6['model']=_[_0xcc62('0x27')](db[_0xcc62('0x1d')]['rawAttributes']);_0x1993a6[_0xcc62('0x23')]=_['keys'](_0xaf086e['query']);_0x1993a6[_0xcc62('0x28')]=_[_0xcc62('0x29')](_0x1993a6[_0xcc62('0x2a')],_0x1993a6['query']);_0x1a7265[_0xcc62('0x2b')]=_[_0xcc62('0x29')](_0x1993a6[_0xcc62('0x2a')],qs['fields'](_0xaf086e['query'][_0xcc62('0x2c')]));_0x1a7265['attributes']=_0x1a7265[_0xcc62('0x2b')][_0xcc62('0x2d')]?_0x1a7265[_0xcc62('0x2b')]:_0x1993a6[_0xcc62('0x2a')];if(_0xaf086e[_0xcc62('0x23')][_0xcc62('0x2e')]){_0x1a7265[_0xcc62('0x22')]=[{'all':!![]}];}_0x1a7265=_[_0xcc62('0x2f')]({},_0x1a7265,_0xaf086e['options']);return db[_0xcc62('0x1d')][_0xcc62('0x30')](_0x1a7265)[_0xcc62('0x16')](handleEntityNotFound(_0x3124ba,null))[_0xcc62('0x16')](respondWithResult(_0x3124ba,null))[_0xcc62('0x25')](handleError(_0x3124ba,null));};exports[_0xcc62('0x31')]=function(_0x1bcf21,_0x200f8e){return db[_0xcc62('0x1d')][_0xcc62('0x31')](_0x1bcf21[_0xcc62('0x32')],{})[_0xcc62('0x16')](function(_0xaf954a){var _0x251e54=_0x1bcf21[_0xcc62('0x33')][_0xcc62('0x34')]({'plain':!![]});if(!_0x251e54)throw new Error(_0xcc62('0x35'));if(_0x251e54[_0xcc62('0x36')]===_0xcc62('0x33')){var _0x57396e=_0xaf954a['get']({'plain':!![]});var _0x4e515e=_0xcc62('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x4e515e,'userProfileId':_0x251e54[_0xcc62('0x38')]},'raw':!![]})[_0xcc62('0x16')](function(_0x151daa){if(_0x151daa&&_0x151daa['autoAssociation']===0x0){return db[_0xcc62('0x18')][_0xcc62('0x31')]({'name':_0x57396e[_0xcc62('0x39')],'resourceId':_0x57396e['id'],'type':_0x151daa[_0xcc62('0x39')],'sectionId':_0x151daa['id']},{})[_0xcc62('0x16')](function(){return _0xaf954a;});}else{return _0xaf954a;}})[_0xcc62('0x25')](function(_0x4011e3){logger[_0xcc62('0x19')](_0xcc62('0x3a'),_0x4011e3);throw _0x4011e3;});}return _0xaf954a;})[_0xcc62('0x16')](respondWithResult(_0x200f8e,0xc9))[_0xcc62('0x25')](handleError(_0x200f8e,null));};exports['update']=function(_0xb37eba,_0x56915d){if(_0xb37eba[_0xcc62('0x32')]['id']){delete _0xb37eba[_0xcc62('0x32')]['id'];}return db[_0xcc62('0x1d')][_0xcc62('0x30')]({'where':{'id':_0xb37eba[_0xcc62('0x26')]['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x56915d,null))[_0xcc62('0x16')](saveUpdates(_0xb37eba[_0xcc62('0x32')],null))[_0xcc62('0x16')](respondWithResult(_0x56915d,null))[_0xcc62('0x25')](handleError(_0x56915d,null));};exports[_0xcc62('0x17')]=function(_0x275b2f,_0x183267){return db[_0xcc62('0x1d')][_0xcc62('0x30')]({'where':{'id':_0x275b2f[_0xcc62('0x26')]['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x183267,null))['then'](removeEntity(_0x183267,null))[_0xcc62('0x25')](handleError(_0x183267,null));};exports[_0xcc62('0x3b')]=function(_0x571527,_0x2ad895){return db[_0xcc62('0x1d')][_0xcc62('0x3b')]()[_0xcc62('0x16')](respondWithResult(_0x2ad895,null))['catch'](handleError(_0x2ad895,null));};exports['getMembers']=function(_0x2b9534,_0x4234de){var _0x268428={'raw':!![],'where':{}},_0x109a82={},_0x550ffb;return db[_0xcc62('0x1d')][_0xcc62('0x3c')]({'where':{'id':_0x2b9534['params']['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x4234de,null))['then'](function(_0x46c5f1){if(_0x46c5f1){_0x550ffb=_0x46c5f1[_0xcc62('0x34')]({'plain':!![]});_0x109a82[_0xcc62('0x2a')]=_['keys'](db[_0xcc62('0x3d')][_0xcc62('0x3e')]);_0x109a82[_0xcc62('0x23')]=_['keys'](_0x2b9534[_0xcc62('0x23')]);_0x109a82[_0xcc62('0x28')]=_['intersection'](_0x109a82[_0xcc62('0x2a')],_0x109a82[_0xcc62('0x23')]);_0x268428['attributes']=_[_0xcc62('0x29')](_0x109a82[_0xcc62('0x2a')],qs['fields'](_0x2b9534[_0xcc62('0x23')][_0xcc62('0x2c')]));_0x268428['attributes']=_0x268428[_0xcc62('0x2b')][_0xcc62('0x2d')]?_0x268428[_0xcc62('0x2b')]:_0x109a82[_0xcc62('0x2a')];if(!_0x2b9534[_0xcc62('0x23')][_0xcc62('0x3f')](_0xcc62('0x40'))){_0x268428[_0xcc62('0x10')]=qs[_0xcc62('0x10')](_0x2b9534[_0xcc62('0x23')]['limit']);_0x268428['offset']=qs[_0xcc62('0x12')](_0x2b9534[_0xcc62('0x23')]['offset']);}_0x268428[_0xcc62('0x41')]=qs['sort'](_0x2b9534[_0xcc62('0x23')][_0xcc62('0x42')]);_0x268428[_0xcc62('0x21')]=qs[_0xcc62('0x28')](_[_0xcc62('0x43')](_0x2b9534['query'],_0x109a82['filters']));_0x268428[_0xcc62('0x21')][_0xcc62('0x44')]=_0x46c5f1['id'];if(_0x2b9534[_0xcc62('0x23')][_0xcc62('0x45')]){_0x268428[_0xcc62('0x21')]=_[_0xcc62('0x2f')](_0x268428[_0xcc62('0x21')],{'$or':_[_0xcc62('0x1c')](_0x268428[_0xcc62('0x2b')],function(_0x4d06d0){var _0x2fbfe6={};_0x2fbfe6[_0x4d06d0]={'$like':'%'+_0x2b9534['query']['filter']+'%'};return _0x2fbfe6;})});}_0x268428=_[_0xcc62('0x2f')]({},_0x268428,_0x2b9534[_0xcc62('0x46')]);return db[_0xcc62('0x3d')][_0xcc62('0x47')](_0x268428);}})[_0xcc62('0x16')](function(_0x13aea7){if(_0x13aea7){return db[_0xcc62('0x48')][_0xcc62('0x49')]({'where':{'id':_[_0xcc62('0x1c')](_0x13aea7,_0xcc62('0x4a')),'role':'agent'},'attributes':['id',_0xcc62('0x39'),'whatsappPause','updatedAt',_0xcc62('0x4b')]});}})[_0xcc62('0x16')](function(_0x5d5575){if(_0x5d5575){return{'count':_0x5d5575[_0xcc62('0x11')],'rows':_['map'](_0x5d5575[_0xcc62('0x24')],function(_0x5b4ca3){return{'membername':_0x5b4ca3[_0xcc62('0x39')],'UserId':_0x5b4ca3['id'],'queue_name':_0x550ffb[_0xcc62('0x39')],'WhatsappQueueId':_0x550ffb['id'],'interface':util[_0xcc62('0x4c')](_0xcc62('0x4d'),'SIP',_0x5b4ca3[_0xcc62('0x39')]),'penalty':0x0,'paused':_0x5b4ca3[_0xcc62('0x4e')],'createdAt':_0x5b4ca3[_0xcc62('0x4b')],'updatedAt':_0x5b4ca3[_0xcc62('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4234de,_0x268428))['catch'](handleError(_0x4234de,null));};exports['getTeams']=function(_0x413d57,_0x37a525){var _0x474f4d={};var _0x2d7c74={};var _0x34ab03;var _0x37cb69;return db[_0xcc62('0x1d')][_0xcc62('0x3c')]({'where':{'id':_0x413d57['params']['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x37a525,null))[_0xcc62('0x16')](function(_0x20fe47){if(_0x20fe47){_0x34ab03=_0x20fe47;_0x2d7c74[_0xcc62('0x2a')]=_[_0xcc62('0x27')](db['Team'][_0xcc62('0x3e')]);_0x2d7c74[_0xcc62('0x23')]=_[_0xcc62('0x27')](_0x413d57[_0xcc62('0x23')]);_0x2d7c74[_0xcc62('0x28')]=_['intersection'](_0x2d7c74[_0xcc62('0x2a')],_0x2d7c74[_0xcc62('0x23')]);_0x474f4d['attributes']=_['intersection'](_0x2d7c74[_0xcc62('0x2a')],qs['fields'](_0x413d57[_0xcc62('0x23')]['fields']));_0x474f4d[_0xcc62('0x2b')]=_0x474f4d[_0xcc62('0x2b')][_0xcc62('0x2d')]?_0x474f4d[_0xcc62('0x2b')]:_0x2d7c74[_0xcc62('0x2a')];_0x474f4d[_0xcc62('0x41')]=qs[_0xcc62('0x42')](_0x413d57['query'][_0xcc62('0x42')]);_0x474f4d[_0xcc62('0x21')]=qs[_0xcc62('0x28')](_[_0xcc62('0x43')](_0x413d57[_0xcc62('0x23')],_0x2d7c74[_0xcc62('0x28')]));if(_0x413d57[_0xcc62('0x23')][_0xcc62('0x45')]){_0x474f4d[_0xcc62('0x21')]=_[_0xcc62('0x2f')](_0x474f4d[_0xcc62('0x21')],{'$or':_[_0xcc62('0x1c')](_0x474f4d['attributes'],function(_0x733bcb){var _0x28e75e={};_0x28e75e[_0x733bcb]={'$like':'%'+_0x413d57['query'][_0xcc62('0x45')]+'%'};return _0x28e75e;})});}_0x474f4d=_['merge']({},_0x474f4d,_0x413d57[_0xcc62('0x46')]);return _0x34ab03['getTeams'](_0x474f4d);}})[_0xcc62('0x16')](function(_0xcb93a6){if(_0xcb93a6){_0x37cb69=_0xcb93a6['length'];if(!_0x413d57[_0xcc62('0x23')][_0xcc62('0x3f')]('nolimit')){_0x474f4d[_0xcc62('0x10')]=qs['limit'](_0x413d57[_0xcc62('0x23')][_0xcc62('0x10')]);_0x474f4d[_0xcc62('0x12')]=qs[_0xcc62('0x12')](_0x413d57[_0xcc62('0x23')]['offset']);}return _0x34ab03[_0xcc62('0x50')](_0x474f4d);}})['then'](function(_0x544d5c){if(_0x544d5c){return _0x544d5c?{'count':_0x37cb69,'rows':_0x544d5c}:null;}})[_0xcc62('0x16')](respondWithResult(_0x37a525,null))['catch'](handleError(_0x37a525,null));};exports[_0xcc62('0x51')]=function(_0x5ef023,_0x3b539b){var _0x1033db=_0x5ef023[_0xcc62('0x32')][_0xcc62('0x52')];return db[_0xcc62('0x53')]['findAll']({'where':{'id':_0x1033db},'attributes':['id'],'include':[{'model':db[_0xcc62('0x48')],'as':'Agents','attributes':['id','name',_0xcc62('0x54'),'voicePause','interface'],'raw':!![]}]})[_0xcc62('0x16')](function(_0xd34d57){if(_0xd34d57){var _0x126f88=_[_0xcc62('0x55')](_0xd34d57,function(_0x96a27f){var _0x434883=_0x96a27f['get']({'plain':!![]});return _0x434883[_0xcc62('0x56')];});return db['WhatsappQueue'][_0xcc62('0x30')]({'where':{'id':_0x5ef023['params']['id']}})[_0xcc62('0x16')](function(_0x4c5b17){return db[_0xcc62('0x57')]['transaction'](function(_0xbae111){return _0x4c5b17['addTeams'](_0x1033db,{'transaction':_0xbae111})['then'](function(){return BPromise['each'](_0x126f88,function(_0x4ff5bb){return db['UserWhatsappQueue'][_0xcc62('0x58')]({'where':{'UserId':_0x4ff5bb['id'],'WhatsappQueueId':_0x5ef023[_0xcc62('0x26')]['id']},'transaction':_0xbae111});});})[_0xcc62('0x16')](function(){_0x126f88['forEach'](function(_0x1408eb){socket[_0xcc62('0x59')](_0xcc62('0x5a'),{'UserId':_0x1408eb['id'],'WhatsappQueueId':_0x4c5b17['id']});});});});});}})[_0xcc62('0x16')](respondWithStatusCode(_0x3b539b,null))[_0xcc62('0x25')](handleError(_0x3b539b,null));};exports[_0xcc62('0x5b')]=function(_0x47dcbc,_0x39a7f8){return db[_0xcc62('0x53')]['findAll']({'where':{'id':_0x47dcbc[_0xcc62('0x23')][_0xcc62('0x52')]},'attributes':['id'],'include':[{'model':db[_0xcc62('0x48')],'as':_0xcc62('0x56'),'attributes':['id'],'raw':!![]}]})[_0xcc62('0x16')](handleEntityNotFound(_0x39a7f8,null))['then'](function(_0x22aa28){var _0x3d9be9=_[_0xcc62('0x1c')](_0x22aa28,'id');var _0x415cb2=[];var _0x3b78e3=[];var _0x118bb6=squel[_0xcc62('0x5c')]();_0x118bb6[_0xcc62('0x5d')]('tq.TeamId')[_0xcc62('0x5e')](_0xcc62('0x5f'),'tq')[_0xcc62('0x60')](_0xcc62('0x61'),'ut',_0xcc62('0x62'))['where']('WhatsappQueueId\x20=\x20?',_0x47dcbc[_0xcc62('0x26')]['id']);for(var _0x551d4b=0x0;_0x551d4b<_0x22aa28['length'];_0x551d4b+=0x1){let _0x19b151=_0x22aa28[_0x551d4b];for(var _0x531ce3=0x0;_0x531ce3<_0x19b151[_0xcc62('0x56')][_0xcc62('0x2d')];_0x531ce3+=0x1){let _0x231a7e=_0x19b151['Agents'][_0x531ce3];var _0xb455a5=_0x118bb6[_0xcc62('0x63')]();_0xb455a5[_0xcc62('0x21')](_0xcc62('0x64'),_0x231a7e['id']);_0x3b78e3[_0xcc62('0x65')](db[_0xcc62('0x57')][_0xcc62('0x23')](_0xb455a5[_0xcc62('0x66')](),{'type':db[_0xcc62('0x57')]['QueryTypes'][_0xcc62('0x67')]})[_0xcc62('0x16')](function(_0xcf3d15){if(_0xcf3d15['length']===0x1){return _0x231a7e['id'];}else{var _0x48f478=_[_0xcc62('0x68')](_[_0xcc62('0x1c')](_0xcf3d15,_0xcc62('0x69')),function(_0x3d3218){return _[_0xcc62('0x6a')](_0x3d9be9,_0x3d3218);});if(_0x48f478){return _0x231a7e['id'];}}}));}}return BPromise['all'](_0x3b78e3)[_0xcc62('0x16')](function(_0x5b8d54){_0x415cb2=_(_0x415cb2)[_0xcc62('0x6b')](_0x5b8d54)[_0xcc62('0x6c')]()['value']();return db[_0xcc62('0x1d')][_0xcc62('0x30')]({'where':{'id':_0x47dcbc[_0xcc62('0x26')]['id']}})['then'](function(_0x42d398){return db[_0xcc62('0x57')][_0xcc62('0x6d')](function(_0x45a98a){return _0x42d398[_0xcc62('0x5b')](_0x47dcbc['query'][_0xcc62('0x52')],{'transaction':_0x45a98a})[_0xcc62('0x16')](function(){if(!_[_0xcc62('0x6e')](_0x415cb2)){return _0x42d398[_0xcc62('0x6f')](_0x415cb2,{'transaction':_0x45a98a});}})['then'](function(){_0x415cb2['forEach'](function(_0x5a3cf9){socket[_0xcc62('0x59')]('userWhatsappQueue:remove',{'UserId':_0x5a3cf9,'WhatsappQueueId':_0x42d398['id']});});});});});});})[_0xcc62('0x16')](respondWithStatusCode(_0x39a7f8,null))['catch'](handleError(_0x39a7f8,null));};exports[_0xcc62('0x70')]=function(_0x36045c,_0x5099bf){return db[_0xcc62('0x1d')][_0xcc62('0x30')]({'where':{'id':_0x36045c[_0xcc62('0x26')]['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x5099bf,null))[_0xcc62('0x16')](function(_0x2d008a){if(_0x2d008a){return _0x2d008a[_0xcc62('0x70')](_0x36045c[_0xcc62('0x32')][_0xcc62('0x52')],_[_0xcc62('0x71')](_0x36045c[_0xcc62('0x32')],[_0xcc62('0x52'),'id'])||{})['spread'](function(_0x24f2db){for(var _0x352496=0x0;_0x352496<_0x36045c['body']['ids'][_0xcc62('0x2d')];_0x352496+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x36045c['body'][_0xcc62('0x52')][_0x352496]),'WhatsappQueueId':Number(_0x36045c[_0xcc62('0x26')]['id'])});}return _0x24f2db;});}})[_0xcc62('0x16')](respondWithResult(_0x5099bf,null))[_0xcc62('0x25')](handleError(_0x5099bf,null));};exports[_0xcc62('0x6f')]=function(_0x5ce486,_0x2abdc9){return db['WhatsappQueue'][_0xcc62('0x30')]({'where':{'id':_0x5ce486[_0xcc62('0x26')]['id']}})['then'](handleEntityNotFound(_0x2abdc9,null))[_0xcc62('0x16')](function(_0xf85fd4){if(_0xf85fd4){return _0xf85fd4[_0xcc62('0x6f')](_0x5ce486[_0xcc62('0x23')][_0xcc62('0x52')])[_0xcc62('0x16')](function(){if(_['isArray'](_0x5ce486[_0xcc62('0x23')][_0xcc62('0x52')])){for(var _0x5613ce=0x0;_0x5613ce<_0x5ce486['query'][_0xcc62('0x52')][_0xcc62('0x2d')];_0x5613ce+=0x1){socket[_0xcc62('0x59')]('userWhatsappQueue:remove',{'UserId':Number(_0x5ce486[_0xcc62('0x23')][_0xcc62('0x52')][_0x5613ce]),'WhatsappQueueId':Number(_0x5ce486[_0xcc62('0x26')]['id'])});}}else{socket[_0xcc62('0x59')](_0xcc62('0x72'),{'UserId':Number(_0x5ce486['query']['ids']),'WhatsappQueueId':Number(_0x5ce486[_0xcc62('0x26')]['id'])});}});}})[_0xcc62('0x16')](respondWithStatusCode(_0x2abdc9,null))[_0xcc62('0x25')](handleError(_0x2abdc9,null));};exports[_0xcc62('0x73')]=function(_0x5101ea,_0x30e3c8){var _0x466570={};var _0x1afcd3={};var _0x1aa67f;var _0x5aa56b;return db['WhatsappQueue'][_0xcc62('0x3c')]({'where':{'id':_0x5101ea[_0xcc62('0x26')]['id']}})[_0xcc62('0x16')](handleEntityNotFound(_0x30e3c8,null))[_0xcc62('0x16')](function(_0x589537){if(_0x589537){_0x1aa67f=_0x589537;_0x1afcd3['model']=_[_0xcc62('0x27')](db[_0xcc62('0x48')][_0xcc62('0x3e')]);_0x1afcd3[_0xcc62('0x23')]=_[_0xcc62('0x27')](_0x5101ea[_0xcc62('0x23')]);_0x1afcd3[_0xcc62('0x28')]=_['intersection'](_0x1afcd3[_0xcc62('0x2a')],_0x1afcd3[_0xcc62('0x23')]);_0x466570[_0xcc62('0x2b')]=_[_0xcc62('0x29')](_0x1afcd3['model'],qs['fields'](_0x5101ea[_0xcc62('0x23')]['fields']));_0x466570[_0xcc62('0x2b')]=_0x466570['attributes']['length']?_0x466570[_0xcc62('0x2b')]:_0x1afcd3[_0xcc62('0x2a')];_0x466570[_0xcc62('0x41')]=qs[_0xcc62('0x42')](_0x5101ea[_0xcc62('0x23')][_0xcc62('0x42')]);_0x466570['where']=qs[_0xcc62('0x28')](_[_0xcc62('0x43')](_0x5101ea[_0xcc62('0x23')],_0x1afcd3[_0xcc62('0x28')]));if(_0x5101ea[_0xcc62('0x23')][_0xcc62('0x45')]){_0x466570[_0xcc62('0x21')]=_['merge'](_0x466570[_0xcc62('0x21')],{'$or':_[_0xcc62('0x1c')](_0x466570[_0xcc62('0x2b')],function(_0x112455){var _0x51950e={};_0x51950e[_0x112455]={'$like':'%'+_0x5101ea[_0xcc62('0x23')][_0xcc62('0x45')]+'%'};return _0x51950e;})});}_0x466570=_[_0xcc62('0x2f')]({},_0x466570,_0x5101ea[_0xcc62('0x46')]);return _0x1aa67f[_0xcc62('0x73')](_0x466570);}})[_0xcc62('0x16')](function(_0x5b14ca){if(_0x5b14ca){_0x5aa56b=_0x5b14ca[_0xcc62('0x2d')];if(!_0x5101ea[_0xcc62('0x23')][_0xcc62('0x3f')]('nolimit')){_0x466570[_0xcc62('0x10')]=qs[_0xcc62('0x10')](_0x5101ea[_0xcc62('0x23')][_0xcc62('0x10')]);_0x466570[_0xcc62('0x12')]=qs[_0xcc62('0x12')](_0x5101ea['query'][_0xcc62('0x12')]);}return _0x1aa67f['getAgents'](_0x466570);}})[_0xcc62('0x16')](function(_0xf059a1){if(_0xf059a1){return _0xf059a1?{'count':_0x5aa56b,'rows':_0xf059a1}:null;}})[_0xcc62('0x16')](respondWithResult(_0x30e3c8,null))[_0xcc62('0x25')](handleError(_0x30e3c8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4b50428..570c5c2 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 _0x6e18=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','save','remove'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0x6e18,0x19b));var _0x86e1=function(_0x263c65,_0x22e763){_0x263c65=_0x263c65-0x0;var _0x37f042=_0x6e18[_0x263c65];return _0x37f042;};'use strict';var EventEmitter=require(_0x86e1('0x0'));var WhatsappQueue=require(_0x86e1('0x1'))['db'][_0x86e1('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x86e1('0x3'),'afterUpdate':'update','afterDestroy':_0x86e1('0x4')};function emitEvent(_0x5df3e7){return function(_0x4f7913,_0x5e899b,_0x1608fb){WhatsappQueueEvents[_0x86e1('0x5')](_0x5df3e7+':'+_0x4f7913['id'],_0x4f7913);WhatsappQueueEvents[_0x86e1('0x5')](_0x5df3e7,_0x4f7913);_0x1608fb(null);};}for(var e in events){if(events[_0x86e1('0x6')](e)){var event=events[e];WhatsappQueue[_0x86e1('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x98cf=['hook','exports','events','../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98cf,0x1c4));var _0xf98c=function(_0x1e2b4a,_0x5c756d){_0x1e2b4a=_0x1e2b4a-0x0;var _0x39482c=_0x98cf[_0x1e2b4a];return _0x39482c;};'use strict';var EventEmitter=require(_0xf98c('0x0'));var WhatsappQueue=require(_0xf98c('0x1'))['db'][_0xf98c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf98c('0x3'),'afterUpdate':_0xf98c('0x4'),'afterDestroy':_0xf98c('0x5')};function emitEvent(_0x12d198){return function(_0x24f701,_0x2c41a0,_0x333036){WhatsappQueueEvents[_0xf98c('0x6')](_0x12d198+':'+_0x24f701['id'],_0x24f701);WhatsappQueueEvents[_0xf98c('0x6')](_0x12d198,_0x24f701);_0x333036(null);};}for(var e in events){if(events[_0xf98c('0x7')](e)){var event=events[e];WhatsappQueue[_0xf98c('0x8')](e,emitEvent(event));}}module[_0xf98c('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 908ff3d..04c93bf 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 _0x735f=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','util','api'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x735f,0x166));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf735('0x0'));var logger=require('../../config/logger')(_0xf735('0x1'));var moment=require(_0xf735('0x2'));var BPromise=require(_0xf735('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf735('0x4'));var rimraf=require(_0xf735('0x5'));var config=require(_0xf735('0x6'));var attributes=require(_0xf735('0x7'));module[_0xf735('0x8')]=function(_0x488e2f,_0x52bc63){return _0x488e2f['define']('WhatsappQueue',attributes,{'tableName':_0xf735('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe57=['api','moment','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','../../config/logger'];(function(_0x2f6816,_0x3b76fe){var _0x275636=function(_0x421038){while(--_0x421038){_0x2f6816['push'](_0x2f6816['shift']());}};_0x275636(++_0x3b76fe);}(_0xfe57,0x18f));var _0x7fe5=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xfe57[_0x2c9b79];return _0x265032;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7fe5('0x0'))(_0x7fe5('0x1'));var moment=require(_0x7fe5('0x2'));var BPromise=require('bluebird');var rp=require(_0x7fe5('0x3'));var fs=require('fs');var path=require(_0x7fe5('0x4'));var rimraf=require('rimraf');var config=require(_0x7fe5('0x5'));var attributes=require(_0x7fe5('0x6'));module[_0x7fe5('0x7')]=function(_0x6f0383,_0x390e97){return _0x6f0383['define'](_0x7fe5('0x8'),attributes,{'tableName':_0x7fe5('0x9'),'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 16ad8ca..7f89b46 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 _0x87c2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash'];(function(_0x4a8f49,_0x13d58f){var _0x16bfde=function(_0x423e44){while(--_0x423e44){_0x4a8f49['push'](_0x4a8f49['shift']());}};_0x16bfde(++_0x13d58f);}(_0x87c2,0x157));var _0x287c=function(_0x3bc06b,_0x398fb4){_0x3bc06b=_0x3bc06b-0x0;var _0x5743d6=_0x87c2[_0x3bc06b];return _0x5743d6;};'use strict';var _=require(_0x287c('0x0'));var util=require('util');var moment=require(_0x287c('0x1'));var BPromise=require(_0x287c('0x2'));var rs=require(_0x287c('0x3'));var fs=require('fs');var Redis=require(_0x287c('0x4'));var db=require(_0x287c('0x5'))['db'];var utils=require(_0x287c('0x6'));var logger=require(_0x287c('0x7'))(_0x287c('0x8'));var config=require(_0x287c('0x9'));var jayson=require(_0x287c('0xa'));var client=jayson[_0x287c('0xb')][_0x287c('0xc')]({'port':0x232a});config[_0x287c('0xd')]=_[_0x287c('0xe')](config['redis'],{'host':_0x287c('0xf'),'port':0x18eb});var socket=require(_0x287c('0x10'))(new Redis(config[_0x287c('0xd')]));require(_0x287c('0x11'))[_0x287c('0x12')](socket);function respondWithRpcPromise(_0x189e97,_0x198a5d,_0xf6bd88){return new BPromise(function(_0x2754a4,_0x211a5f){return client[_0x287c('0x13')](_0x189e97,_0xf6bd88)[_0x287c('0x14')](function(_0x29111d){logger['info'](_0x287c('0x15'),_0x198a5d,_0x287c('0x16'));logger[_0x287c('0x17')](_0x287c('0x18'),_0x198a5d,_0x287c('0x16'),JSON[_0x287c('0x19')](_0x29111d));if(_0x29111d['error']){if(_0x29111d[_0x287c('0x1a')][_0x287c('0x1b')]===0x1f4){logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);return _0x211a5f(_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);}logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);return _0x2754a4(_0x29111d[_0x287c('0x1a')]['message']);}else{logger[_0x287c('0x1d')](_0x287c('0x15'),_0x198a5d,_0x287c('0x16'));_0x2754a4(_0x29111d[_0x287c('0x1e')][_0x287c('0x1c')]);}})[_0x287c('0x1f')](function(_0x443956){logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x443956);_0x211a5f(_0x443956);});});}exports[_0x287c('0x20')]=function(_0x29dbb1){var _0x5f1681=this;return new Promise(function(_0x57bd1f,_0x1b7942){return db[_0x287c('0x21')]['findAll']({'raw':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1['options']['raw']===undefined?!![]:![]:!![],'where':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x23')]||null:null,'attributes':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x24')]||null:null,'limit':_0x29dbb1['options']?_0x29dbb1[_0x287c('0x22')][_0x287c('0x25')]||null:null,'include':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x26')]?_[_0x287c('0x27')](_0x29dbb1['options'][_0x287c('0x26')],function(_0x6dbe27){return{'model':db[_0x6dbe27['model']],'as':_0x6dbe27['as'],'attributes':_0x6dbe27[_0x287c('0x24')],'include':_0x6dbe27[_0x287c('0x26')]?_['map'](_0x6dbe27[_0x287c('0x26')],function(_0x1a4f1d){return{'model':db[_0x1a4f1d['model']],'as':_0x1a4f1d['as'],'attributes':_0x1a4f1d['attributes'],'include':_0x1a4f1d[_0x287c('0x26')]?_[_0x287c('0x27')](_0x1a4f1d[_0x287c('0x26')],function(_0x3b2a8f){return{'model':db[_0x3b2a8f[_0x287c('0x28')]],'as':_0x3b2a8f['as'],'attributes':_0x3b2a8f[_0x287c('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x579e34){logger[_0x287c('0x1d')](_0x287c('0x20'),_0x29dbb1);logger[_0x287c('0x17')](_0x287c('0x20'),_0x29dbb1,JSON['stringify'](_0x579e34));_0x57bd1f(_0x579e34);})[_0x287c('0x1f')](function(_0x3eb88a){logger[_0x287c('0x1a')](_0x287c('0x20'),_0x3eb88a[_0x287c('0x1c')],_0x29dbb1);_0x1b7942(_0x5f1681['error'](0x1f4,_0x3eb88a['message']));});});};exports[_0x287c('0x29')]=function(_0x34b18d){var _0x5f0aa8=this;return new Promise(function(_0x11adf3,_0x55dde6){return db[_0x287c('0x21')][_0x287c('0x2a')]({'raw':_0x34b18d[_0x287c('0x22')]?_0x34b18d[_0x287c('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x34b18d[_0x287c('0x22')]?_0x34b18d['options'][_0x287c('0x23')]||null:null,'attributes':_0x34b18d[_0x287c('0x22')]?_0x34b18d['options'][_0x287c('0x24')]||null:null,'include':_0x34b18d[_0x287c('0x22')]?_0x34b18d[_0x287c('0x22')]['include']?_[_0x287c('0x27')](_0x34b18d[_0x287c('0x22')]['include'],function(_0x217638){return{'model':db[_0x217638['model']],'as':_0x217638['as'],'attributes':_0x217638['attributes'],'include':_0x217638[_0x287c('0x26')]?_[_0x287c('0x27')](_0x217638['include'],function(_0x5d5033){return{'model':db[_0x5d5033[_0x287c('0x28')]],'as':_0x5d5033['as'],'attributes':_0x5d5033[_0x287c('0x24')],'include':_0x5d5033['include']?_[_0x287c('0x27')](_0x5d5033[_0x287c('0x26')],function(_0x41826a){return{'model':db[_0x41826a[_0x287c('0x28')]],'as':_0x41826a['as'],'attributes':_0x41826a[_0x287c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x287c('0x14')](function(_0x427452){logger[_0x287c('0x1d')](_0x287c('0x29'),_0x34b18d);logger[_0x287c('0x17')](_0x287c('0x29'),_0x34b18d,JSON[_0x287c('0x19')](_0x427452));_0x11adf3(_0x427452);})[_0x287c('0x1f')](function(_0x3f6b70){logger[_0x287c('0x1a')](_0x287c('0x29'),_0x3f6b70[_0x287c('0x1c')],_0x34b18d);_0x55dde6(_0x5f0aa8[_0x287c('0x1a')](0x1f4,_0x3f6b70[_0x287c('0x1c')]));});});}; \ No newline at end of file +var _0xc23d=['map','stringify','ShowWhatsappQueue','WhatsappQueue','find','debug','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','include','model'];(function(_0x5a6742,_0x59b7f2){var _0x415bce=function(_0x179b1b){while(--_0x179b1b){_0x5a6742['push'](_0x5a6742['shift']());}};_0x415bce(++_0x59b7f2);}(_0xc23d,0x72));var _0xdc23=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xc23d[_0x261b8a];return _0x3455e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc23('0x0'));var BPromise=require(_0xdc23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc23('0x2'));var logger=require('../../config/logger')(_0xdc23('0x3'));var config=require(_0xdc23('0x4'));var jayson=require(_0xdc23('0x5'));var client=jayson['client'][_0xdc23('0x6')]({'port':0x232a});config[_0xdc23('0x7')]=_[_0xdc23('0x8')](config['redis'],{'host':_0xdc23('0x9'),'port':0x18eb});var socket=require(_0xdc23('0xa'))(new Redis(config[_0xdc23('0x7')]));require(_0xdc23('0xb'))[_0xdc23('0xc')](socket);function respondWithRpcPromise(_0x3f980f,_0xa223a9,_0x2f6772){return new BPromise(function(_0x27a66a,_0x395a7f){return client[_0xdc23('0xd')](_0x3f980f,_0x2f6772)[_0xdc23('0xe')](function(_0x397b77){logger[_0xdc23('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0xa223a9,_0xdc23('0x10'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xa223a9,_0xdc23('0x10'),JSON['stringify'](_0x397b77));if(_0x397b77['error']){if(_0x397b77['error'][_0xdc23('0x11')]===0x1f4){logger[_0xdc23('0x12')](_0xdc23('0x13'),_0xa223a9,_0x397b77['error'][_0xdc23('0x14')]);return _0x395a7f(_0x397b77[_0xdc23('0x12')][_0xdc23('0x14')]);}logger[_0xdc23('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0xa223a9,_0x397b77[_0xdc23('0x12')][_0xdc23('0x14')]);return _0x27a66a(_0x397b77[_0xdc23('0x12')]['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xa223a9,_0xdc23('0x10'));_0x27a66a(_0x397b77[_0xdc23('0x15')][_0xdc23('0x14')]);}})[_0xdc23('0x16')](function(_0x10ceae){logger[_0xdc23('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0xa223a9,_0x10ceae);_0x395a7f(_0x10ceae);});});}exports[_0xdc23('0x17')]=function(_0x2e6002){var _0x12ae35=this;return new Promise(function(_0x14cf1b,_0x15dac6){return db['WhatsappQueue']['findAll']({'raw':_0x2e6002[_0xdc23('0x18')]?_0x2e6002[_0xdc23('0x18')][_0xdc23('0x19')]===undefined?!![]:![]:!![],'where':_0x2e6002[_0xdc23('0x18')]?_0x2e6002[_0xdc23('0x18')][_0xdc23('0x1a')]||null:null,'attributes':_0x2e6002['options']?_0x2e6002[_0xdc23('0x18')][_0xdc23('0x1b')]||null:null,'limit':_0x2e6002[_0xdc23('0x18')]?_0x2e6002[_0xdc23('0x18')]['limit']||null:null,'include':_0x2e6002['options']?_0x2e6002[_0xdc23('0x18')][_0xdc23('0x1c')]?_['map'](_0x2e6002['options'][_0xdc23('0x1c')],function(_0x468af){return{'model':db[_0x468af[_0xdc23('0x1d')]],'as':_0x468af['as'],'attributes':_0x468af[_0xdc23('0x1b')],'include':_0x468af[_0xdc23('0x1c')]?_[_0xdc23('0x1e')](_0x468af[_0xdc23('0x1c')],function(_0x58cfb6){return{'model':db[_0x58cfb6[_0xdc23('0x1d')]],'as':_0x58cfb6['as'],'attributes':_0x58cfb6[_0xdc23('0x1b')],'include':_0x58cfb6[_0xdc23('0x1c')]?_['map'](_0x58cfb6['include'],function(_0x474ccb){return{'model':db[_0x474ccb['model']],'as':_0x474ccb['as'],'attributes':_0x474ccb[_0xdc23('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdc23('0xe')](function(_0x590d91){logger[_0xdc23('0xf')](_0xdc23('0x17'),_0x2e6002);logger['debug'](_0xdc23('0x17'),_0x2e6002,JSON[_0xdc23('0x1f')](_0x590d91));_0x14cf1b(_0x590d91);})[_0xdc23('0x16')](function(_0x4b0f13){logger[_0xdc23('0x12')]('GetWhatsappQueue',_0x4b0f13[_0xdc23('0x14')],_0x2e6002);_0x15dac6(_0x12ae35[_0xdc23('0x12')](0x1f4,_0x4b0f13[_0xdc23('0x14')]));});});};exports[_0xdc23('0x20')]=function(_0x282eb9){var _0x1cb329=this;return new Promise(function(_0xf10562,_0x50eb6f){return db[_0xdc23('0x21')][_0xdc23('0x22')]({'raw':_0x282eb9[_0xdc23('0x18')]?_0x282eb9[_0xdc23('0x18')][_0xdc23('0x19')]===undefined?!![]:![]:!![],'where':_0x282eb9['options']?_0x282eb9[_0xdc23('0x18')]['where']||null:null,'attributes':_0x282eb9[_0xdc23('0x18')]?_0x282eb9['options'][_0xdc23('0x1b')]||null:null,'include':_0x282eb9[_0xdc23('0x18')]?_0x282eb9[_0xdc23('0x18')][_0xdc23('0x1c')]?_[_0xdc23('0x1e')](_0x282eb9['options'][_0xdc23('0x1c')],function(_0x19a241){return{'model':db[_0x19a241[_0xdc23('0x1d')]],'as':_0x19a241['as'],'attributes':_0x19a241[_0xdc23('0x1b')],'include':_0x19a241[_0xdc23('0x1c')]?_[_0xdc23('0x1e')](_0x19a241[_0xdc23('0x1c')],function(_0xf10a5f){return{'model':db[_0xf10a5f[_0xdc23('0x1d')]],'as':_0xf10a5f['as'],'attributes':_0xf10a5f['attributes'],'include':_0xf10a5f[_0xdc23('0x1c')]?_[_0xdc23('0x1e')](_0xf10a5f['include'],function(_0x495340){return{'model':db[_0x495340[_0xdc23('0x1d')]],'as':_0x495340['as'],'attributes':_0x495340[_0xdc23('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdc23('0xe')](function(_0x5c03db){logger[_0xdc23('0xf')](_0xdc23('0x20'),_0x282eb9);logger[_0xdc23('0x23')](_0xdc23('0x20'),_0x282eb9,JSON['stringify'](_0x5c03db));_0xf10562(_0x5c03db);})[_0xdc23('0x16')](function(_0x5ba249){logger[_0xdc23('0x12')](_0xdc23('0x20'),_0x5ba249['message'],_0x282eb9);_0x50eb6f(_0x1cb329[_0xdc23('0x12')](0x1f4,_0x5ba249[_0xdc23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 18d567a..918fc70 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 _0x1b57=['length','./whatsappQueue.events','update','emit','removeListener'];(function(_0x143078,_0x29a590){var _0x1ff4b4=function(_0x4e7aa9){while(--_0x4e7aa9){_0x143078['push'](_0x143078['shift']());}};_0x1ff4b4(++_0x29a590);}(_0x1b57,0x74));var _0x71b5=function(_0x5df794,_0x1eff57){_0x5df794=_0x5df794-0x0;var _0x35376e=_0x1b57[_0x5df794];return _0x35376e;};'use strict';var WhatsappQueueEvents=require(_0x71b5('0x0'));var events=['save','remove',_0x71b5('0x1')];function createListener(_0x55229b,_0x4182c1){return function(_0x32bb23){_0x4182c1[_0x71b5('0x2')](_0x55229b,_0x32bb23);};}function removeListener(_0x46450d,_0x5057bc){return function(){WhatsappQueueEvents[_0x71b5('0x3')](_0x46450d,_0x5057bc);};}exports['register']=function(_0x410ffd){for(var _0x3c84d4=0x0,_0x11f74e=events[_0x71b5('0x4')];_0x3c84d4<_0x11f74e;_0x3c84d4++){var _0x12c28e=events[_0x3c84d4];var _0x26ec65=createListener('whatsappQueue:'+_0x12c28e,_0x410ffd);WhatsappQueueEvents['on'](_0x12c28e,_0x26ec65);}}; \ No newline at end of file +var _0x9191=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x47a756,_0xc38065){var _0x4db04c=function(_0x5c1a72){while(--_0x5c1a72){_0x47a756['push'](_0x47a756['shift']());}};_0x4db04c(++_0xc38065);}(_0x9191,0x158));var _0x1919=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0x9191[_0x53b199];return _0x1ba42d;};'use strict';var WhatsappQueueEvents=require(_0x1919('0x0'));var events=[_0x1919('0x1'),_0x1919('0x2'),_0x1919('0x3')];function createListener(_0x283250,_0x5b903e){return function(_0x6c3b47){_0x5b903e['emit'](_0x283250,_0x6c3b47);};}function removeListener(_0x1dd677,_0x235a8f){return function(){WhatsappQueueEvents[_0x1919('0x4')](_0x1dd677,_0x235a8f);};}exports[_0x1919('0x5')]=function(_0x110612){for(var _0x5c5c3b=0x0,_0x2f2d42=events['length'];_0x5c5c3b<_0x2f2d42;_0x5c5c3b++){var _0x1cb287=events[_0x5c5c3b];var _0x1746c0=createListener(_0x1919('0x6')+_0x1cb287,_0x110612);WhatsappQueueEvents['on'](_0x1cb287,_0x1746c0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9b2f8d8..de162c4 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 _0x57ce=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','update','/:id','exports','multer','util'];(function(_0x55164c,_0x45bf65){var _0xf5c283=function(_0x2b9223){while(--_0x2b9223){_0x55164c['push'](_0x55164c['shift']());}};_0xf5c283(++_0x45bf65);}(_0x57ce,0x166));var _0xe57c=function(_0x378381,_0x5dbba9){_0x378381=_0x378381-0x0;var _0x5d4378=_0x57ce[_0x378381];return _0x5d4378;};'use strict';var multer=require(_0xe57c('0x0'));var util=require(_0xe57c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe57c('0x2'));var router=express[_0xe57c('0x3')]();var fs_extra=require(_0xe57c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe57c('0x5'));var config=require(_0xe57c('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xe57c('0x7')]('/',auth[_0xe57c('0x8')](),controller[_0xe57c('0x9')]);router[_0xe57c('0x7')](_0xe57c('0xa'),auth[_0xe57c('0x8')](),controller[_0xe57c('0xb')]);router['get']('/:id',auth[_0xe57c('0x8')](),controller[_0xe57c('0xc')]);router[_0xe57c('0xd')]('/',auth[_0xe57c('0x8')](),controller[_0xe57c('0xe')]);router['put']('/:id',auth[_0xe57c('0x8')](),controller[_0xe57c('0xf')]);router['delete'](_0xe57c('0x10'),auth[_0xe57c('0x8')](),controller['destroy']);module[_0xe57c('0x11')]=router; \ No newline at end of file +var _0x932d=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0xe78015,_0xd60f5d){var _0x3fa910=function(_0x180c14){while(--_0x180c14){_0xe78015['push'](_0xe78015['shift']());}};_0x3fa910(++_0xd60f5d);}(_0x932d,0x103));var _0xd932=function(_0x4bdae7,_0x4897d5){_0x4bdae7=_0x4bdae7-0x0;var _0x1fc5db=_0x932d[_0x4bdae7];return _0x1fc5db;};'use strict';var multer=require(_0xd932('0x0'));var util=require(_0xd932('0x1'));var path=require('path');var timeout=require(_0xd932('0x2'));var express=require(_0xd932('0x3'));var router=express[_0xd932('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd932('0x5'));var interaction=require(_0xd932('0x6'));var config=require(_0xd932('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xd932('0x8')]('/',auth[_0xd932('0x9')](),controller[_0xd932('0xa')]);router[_0xd932('0x8')](_0xd932('0xb'),auth[_0xd932('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd932('0xc')]);router[_0xd932('0xd')]('/',auth[_0xd932('0x9')](),controller[_0xd932('0xe')]);router[_0xd932('0xf')](_0xd932('0x10'),auth['isAuthenticated'](),controller[_0xd932('0x11')]);router[_0xd932('0x12')](_0xd932('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xd932('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 50b3b89..8eafaa1 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1deb5f,_0x2fdb8f){var _0x3729a3=function(_0x5def81){while(--_0x5def81){_0x1deb5f['push'](_0x1deb5f['shift']());}};_0x3729a3(++_0x2fdb8f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3cca3c,_0x39082a){var _0x5c4045=function(_0x38c1c5){while(--_0x38c1c5){_0x3cca3c['push'](_0x3cca3c['shift']());}};_0x5c4045(++_0x39082a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 300e54c..d827939 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 _0xb688=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','show','includeAll','include','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26cb44,_0x19d68a){var _0x3ba86c=function(_0xdf5f39){while(--_0xdf5f39){_0x26cb44['push'](_0x26cb44['shift']());}};_0x3ba86c(++_0x19d68a);}(_0xb688,0xcf));var _0x8b68=function(_0x1d8927,_0x3a6c9a){_0x1d8927=_0x1d8927-0x0;var _0x73fb01=_0xb688[_0x1d8927];return _0x73fb01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['index']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={},_0x494ce4={},_0x357635={'count':0x0,'rows':[]};var _0x1cd230=_[_0x8b68('0x2b')](db[_0x8b68('0x2c')][_0x8b68('0x2d')],function(_0x2ad2df){return{'name':_0x2ad2df[_0x8b68('0x2e')],'type':_0x2ad2df['type'][_0x8b68('0x2f')]};});_0x494ce4['model']=_[_0x8b68('0x2b')](_0x1cd230,_0x8b68('0x29'));_0x494ce4['query']=_[_0x8b68('0x30')](_0x26cad7[_0x8b68('0x31')]);_0x494ce4[_0x8b68('0x32')]=_['intersection'](_0x494ce4['model'],_0x494ce4[_0x8b68('0x31')]);_0x48e2c8[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x494ce4[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x36')]));_0x48e2c8[_0x8b68('0x33')]=_0x48e2c8[_0x8b68('0x33')][_0x8b68('0x37')]?_0x48e2c8[_0x8b68('0x33')]:_0x494ce4[_0x8b68('0x35')];if(!_0x26cad7[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x48e2c8[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x1f')]);_0x48e2c8[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x26cad7[_0x8b68('0x31')]['offset']);}_0x48e2c8['order']=qs[_0x8b68('0x3a')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3a')]);_0x48e2c8[_0x8b68('0x3b')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3c')](_0x26cad7[_0x8b68('0x31')],_0x494ce4[_0x8b68('0x32')]),_0x1cd230);if(_0x26cad7['query'][_0x8b68('0x3d')]){_0x48e2c8[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x48e2c8[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x2b')](_0x1cd230,function(_0x3e0032){if(_0x3e0032[_0x8b68('0x3f')]!==_0x8b68('0x40')){var _0x517571={};_0x517571[_0x3e0032[_0x8b68('0x29')]]={'$like':'%'+_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3d')]+'%'};return _0x517571;}})});}_0x48e2c8=_[_0x8b68('0x3e')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x41')]);var _0x3b3394={'where':_0x48e2c8[_0x8b68('0x3b')]};return db['WhatsappQueueReport'][_0x8b68('0x21')](_0x3b3394)[_0x8b68('0x25')](function(_0x48f159){_0x357635[_0x8b68('0x21')]=_0x48f159;if(_0x26cad7[_0x8b68('0x31')]['includeAll']){_0x48e2c8['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x48e2c8);})[_0x8b68('0x25')](function(_0x23d24a){_0x357635['rows']=_0x23d24a;return _0x357635;})[_0x8b68('0x25')](respondWithFilteredResult(_0x3ac356,_0x48e2c8))['catch'](handleError(_0x3ac356,null));};exports[_0x8b68('0x42')]=function(_0x3841d2,_0x5a3193){var _0x2f90d9={'raw':!![],'where':{'id':_0x3841d2['params']['id']}},_0x5ae345={};_0x5ae345['model']=_[_0x8b68('0x30')](db[_0x8b68('0x2c')][_0x8b68('0x2d')]);_0x5ae345[_0x8b68('0x31')]=_['keys'](_0x3841d2[_0x8b68('0x31')]);_0x5ae345['filters']=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],_0x5ae345['query']);_0x2f90d9[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x3841d2['query'][_0x8b68('0x36')]));_0x2f90d9[_0x8b68('0x33')]=_0x2f90d9[_0x8b68('0x33')][_0x8b68('0x37')]?_0x2f90d9[_0x8b68('0x33')]:_0x5ae345[_0x8b68('0x35')];if(_0x3841d2[_0x8b68('0x31')][_0x8b68('0x43')]){_0x2f90d9[_0x8b68('0x44')]=[{'all':!![]}];}_0x2f90d9=_[_0x8b68('0x3e')]({},_0x2f90d9,_0x3841d2[_0x8b68('0x41')]);return db[_0x8b68('0x2c')][_0x8b68('0x45')](_0x2f90d9)[_0x8b68('0x25')](handleEntityNotFound(_0x5a3193,null))[_0x8b68('0x25')](respondWithResult(_0x5a3193,null))[_0x8b68('0x46')](handleError(_0x5a3193,null));};exports['create']=function(_0x3b7b06,_0x20681a){return db['WhatsappQueueReport'][_0x8b68('0x47')](_0x3b7b06['body'],{})['then'](respondWithResult(_0x20681a,0xc9))['catch'](handleError(_0x20681a,null));};exports[_0x8b68('0x24')]=function(_0x35874b,_0x34047c){if(_0x35874b[_0x8b68('0x48')]['id']){delete _0x35874b['body']['id'];}return db['WhatsappQueueReport'][_0x8b68('0x45')]({'where':{'id':_0x35874b[_0x8b68('0x49')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))['then'](saveUpdates(_0x35874b[_0x8b68('0x48')],null))[_0x8b68('0x25')](respondWithResult(_0x34047c,null))['catch'](handleError(_0x34047c,null));};exports[_0x8b68('0x26')]=function(_0xacac82,_0x595942){return db[_0x8b68('0x2c')][_0x8b68('0x45')]({'where':{'id':_0xacac82['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x595942,null))[_0x8b68('0x25')](removeEntity(_0x595942,null))['catch'](handleError(_0x595942,null));};exports['describe']=function(_0x5e3e99,_0x28f82d){return db[_0x8b68('0x2c')][_0x8b68('0x4a')]()[_0x8b68('0x25')](respondWithResult(_0x28f82d,null))['catch'](handleError(_0x28f82d,null));}; \ No newline at end of file +var _0xae60=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x60b97,_0x3baaa9){var _0x2bf06e=function(_0x3e1bcb){while(--_0x3e1bcb){_0x60b97['push'](_0x60b97['shift']());}};_0x2bf06e(++_0x3baaa9);}(_0xae60,0x1c7));var _0x0ae6=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xae60[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['WhatsappQueueReport'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));};exports[_0x0ae6('0x4e')]=function(_0x327b55,_0x173acd){return db[_0x0ae6('0x2e')][_0x0ae6('0x4e')]()[_0x0ae6('0x29')](respondWithResult(_0x173acd,null))[_0x0ae6('0x48')](handleError(_0x173acd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 6d7a34c..4817b25 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 _0xdd84=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x138e50,_0x4c6de7){var _0x11bd9d=function(_0x19d90a){while(--_0x19d90a){_0x138e50['push'](_0x138e50['shift']());}};_0x11bd9d(++_0x4c6de7);}(_0xdd84,0x1bb));var _0x4dd8=function(_0x1d8472,_0x4d166){_0x1d8472=_0x1d8472-0x0;var _0x10dc38=_0xdd84[_0x1d8472];return _0x10dc38;};'use strict';var _=require(_0x4dd8('0x0'));var util=require(_0x4dd8('0x1'));var logger=require(_0x4dd8('0x2'))('api');var moment=require(_0x4dd8('0x3'));var BPromise=require(_0x4dd8('0x4'));var rp=require(_0x4dd8('0x5'));var fs=require('fs');var path=require(_0x4dd8('0x6'));var rimraf=require(_0x4dd8('0x7'));var config=require(_0x4dd8('0x8'));var attributes=require(_0x4dd8('0x9'));module[_0x4dd8('0xa')]=function(_0x2da053,_0x13835d){return _0x2da053[_0x4dd8('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x4dd8('0xc'),'paranoid':![],'indexes':[{'name':_0x4dd8('0xd'),'fields':[_0x4dd8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb059=['exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x550947,_0x26116c){var _0x4f06b3=function(_0x314cd4){while(--_0x314cd4){_0x550947['push'](_0x550947['shift']());}};_0x4f06b3(++_0x26116c);}(_0xb059,0x1f0));var _0x9b05=function(_0x3bb379,_0xcbdc23){_0x3bb379=_0x3bb379-0x0;var _0x16fb70=_0xb059[_0x3bb379];return _0x16fb70;};'use strict';var _=require(_0x9b05('0x0'));var util=require(_0x9b05('0x1'));var logger=require(_0x9b05('0x2'))(_0x9b05('0x3'));var moment=require(_0x9b05('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b05('0x5'));var rimraf=require('rimraf');var config=require(_0x9b05('0x6'));var attributes=require(_0x9b05('0x7'));module[_0x9b05('0x8')]=function(_0x5496a0,_0x3723cd){return _0x5496a0[_0x9b05('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x9b05('0xa'),'paranoid':![],'indexes':[{'name':_0x9b05('0xb'),'fields':[_0x9b05('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ca6758c..07ab809 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 _0x6d3f=['info','result','catch','WhatsappQueueReport','create','body','options','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message'];(function(_0x16ffe9,_0x26b266){var _0x440b0d=function(_0x875847){while(--_0x875847){_0x16ffe9['push'](_0x16ffe9['shift']());}};_0x440b0d(++_0x26b266);}(_0x6d3f,0x72));var _0xf6d3=function(_0x375892,_0x1bead7){_0x375892=_0x375892-0x0;var _0x3ed844=_0x6d3f[_0x375892];return _0x3ed844;};'use strict';var _=require(_0xf6d3('0x0'));var util=require(_0xf6d3('0x1'));var moment=require(_0xf6d3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6d3('0x3'))['db'];var utils=require(_0xf6d3('0x4'));var logger=require(_0xf6d3('0x5'))(_0xf6d3('0x6'));var config=require(_0xf6d3('0x7'));var jayson=require(_0xf6d3('0x8'));var client=jayson[_0xf6d3('0x9')][_0xf6d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb43f,_0xd3f434,_0x174ff4){return new BPromise(function(_0x13b174,_0x3a60d4){return client['request'](_0x2eb43f,_0x174ff4)['then'](function(_0x8e9ab6){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xd3f434,_0xf6d3('0xb'));logger[_0xf6d3('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd3f434,_0xf6d3('0xb'),JSON[_0xf6d3('0xd')](_0x8e9ab6));if(_0x8e9ab6[_0xf6d3('0xe')]){if(_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0xf')]===0x1f4){logger[_0xf6d3('0xe')](_0xf6d3('0x10'),_0xd3f434,_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);return _0x3a60d4(_0x8e9ab6['error'][_0xf6d3('0x11')]);}logger['error'](_0xf6d3('0x10'),_0xd3f434,_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);return _0x13b174(_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);}else{logger[_0xf6d3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd3f434,'request\x20sent');_0x13b174(_0x8e9ab6[_0xf6d3('0x13')][_0xf6d3('0x11')]);}})[_0xf6d3('0x14')](function(_0x3935a6){logger[_0xf6d3('0xe')](_0xf6d3('0x10'),_0xd3f434,_0x3935a6);_0x3a60d4(_0x3935a6);});});}exports['CreateWhatsappQueueReport']=function(_0x1e5852){var _0x1fbbe4=this;return new Promise(function(_0xf0de71,_0x41ac83){return db[_0xf6d3('0x15')][_0xf6d3('0x16')](_0x1e5852[_0xf6d3('0x17')],{'raw':_0x1e5852[_0xf6d3('0x18')]?_0x1e5852[_0xf6d3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf6d3('0x19')](function(_0x2ef325){logger[_0xf6d3('0x12')](_0xf6d3('0x1a'),_0x1e5852);logger[_0xf6d3('0xc')](_0xf6d3('0x1a'),_0x1e5852,JSON[_0xf6d3('0xd')](_0x2ef325));_0xf0de71(_0x2ef325);})['catch'](function(_0x246657){logger[_0xf6d3('0xe')](_0xf6d3('0x1a'),_0x246657[_0xf6d3('0x11')],_0x1e5852);_0x41ac83(_0x1fbbe4[_0xf6d3('0xe')](0x1f4,_0x246657['message']));});});};exports[_0xf6d3('0x1b')]=function(_0x2d38bc){var _0x1fa97a=this;return new Promise(function(_0x2e6fe8,_0x53c1e4){return db[_0xf6d3('0x15')][_0xf6d3('0x1c')](_0x2d38bc['body'],{'raw':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc['options'][_0xf6d3('0x1e')]||null:null,'attributes':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x1f')]||null:null,'limit':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x20')]||null:null})[_0xf6d3('0x19')](function(_0x217c83){logger[_0xf6d3('0x12')](_0xf6d3('0x1b'),_0x2d38bc);logger[_0xf6d3('0xc')](_0xf6d3('0x1b'),_0x2d38bc,JSON['stringify'](_0x217c83));_0x2e6fe8(_0x217c83);})[_0xf6d3('0x14')](function(_0x1a4b88){logger[_0xf6d3('0xe')](_0xf6d3('0x1b'),_0x1a4b88[_0xf6d3('0x11')],_0x2d38bc);_0x53c1e4(_0x1fa97a[_0xf6d3('0xe')](0x1f4,_0x1a4b88['message']));});});}; \ No newline at end of file +var _0x66f1=['result','CreateWhatsappQueueReport','WhatsappQueueReport','body','raw','UpdateWhatsappQueueReport','update','options','where','attributes','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3c0ea0,_0x38d2ea){var _0xc6d7cb=function(_0x4a29f9){while(--_0x4a29f9){_0x3c0ea0['push'](_0x3c0ea0['shift']());}};_0xc6d7cb(++_0x38d2ea);}(_0x66f1,0x1dc));var _0x166f=function(_0x3625e4,_0x2efee3){_0x3625e4=_0x3625e4-0x0;var _0x5efcb3=_0x66f1[_0x3625e4];return _0x5efcb3;};'use strict';var _=require(_0x166f('0x0'));var util=require(_0x166f('0x1'));var moment=require(_0x166f('0x2'));var BPromise=require(_0x166f('0x3'));var rs=require(_0x166f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x166f('0x5'));var logger=require(_0x166f('0x6'))(_0x166f('0x7'));var config=require('../../config/environment');var jayson=require(_0x166f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31cbf6,_0x429eee,_0x25a0da){return new BPromise(function(_0x38e601,_0x460951){return client['request'](_0x31cbf6,_0x25a0da)[_0x166f('0x9')](function(_0x12c773){logger[_0x166f('0xa')](_0x166f('0xb'),_0x429eee,_0x166f('0xc'));logger['debug'](_0x166f('0xd'),_0x429eee,_0x166f('0xc'),JSON[_0x166f('0xe')](_0x12c773));if(_0x12c773[_0x166f('0xf')]){if(_0x12c773[_0x166f('0xf')]['code']===0x1f4){logger['error'](_0x166f('0xb'),_0x429eee,_0x12c773[_0x166f('0xf')][_0x166f('0x10')]);return _0x460951(_0x12c773[_0x166f('0xf')][_0x166f('0x10')]);}logger['error'](_0x166f('0xb'),_0x429eee,_0x12c773[_0x166f('0xf')][_0x166f('0x10')]);return _0x38e601(_0x12c773['error'][_0x166f('0x10')]);}else{logger[_0x166f('0xa')](_0x166f('0xb'),_0x429eee,_0x166f('0xc'));_0x38e601(_0x12c773[_0x166f('0x11')][_0x166f('0x10')]);}})['catch'](function(_0x5bde88){logger[_0x166f('0xf')](_0x166f('0xb'),_0x429eee,_0x5bde88);_0x460951(_0x5bde88);});});}exports[_0x166f('0x12')]=function(_0x57ff8d){var _0x3303eb=this;return new Promise(function(_0x49610d,_0x3b802d){return db[_0x166f('0x13')]['create'](_0x57ff8d[_0x166f('0x14')],{'raw':_0x57ff8d['options']?_0x57ff8d['options'][_0x166f('0x15')]===undefined?!![]:![]:!![]})[_0x166f('0x9')](function(_0x51d16e){logger['info'](_0x166f('0x12'),_0x57ff8d);logger['debug']('CreateWhatsappQueueReport',_0x57ff8d,JSON['stringify'](_0x51d16e));_0x49610d(_0x51d16e);})['catch'](function(_0xe84e67){logger[_0x166f('0xf')](_0x166f('0x12'),_0xe84e67[_0x166f('0x10')],_0x57ff8d);_0x3b802d(_0x3303eb['error'](0x1f4,_0xe84e67[_0x166f('0x10')]));});});};exports[_0x166f('0x16')]=function(_0x44c51f){var _0x58c255=this;return new Promise(function(_0x12d9e8,_0x58f4f7){return db['WhatsappQueueReport'][_0x166f('0x17')](_0x44c51f[_0x166f('0x14')],{'raw':_0x44c51f[_0x166f('0x18')]?_0x44c51f[_0x166f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c51f['options']?_0x44c51f[_0x166f('0x18')][_0x166f('0x19')]||null:null,'attributes':_0x44c51f[_0x166f('0x18')]?_0x44c51f[_0x166f('0x18')][_0x166f('0x1a')]||null:null,'limit':_0x44c51f[_0x166f('0x18')]?_0x44c51f[_0x166f('0x18')]['limit']||null:null})[_0x166f('0x9')](function(_0x1a4837){logger[_0x166f('0xa')]('UpdateWhatsappQueueReport',_0x44c51f);logger[_0x166f('0x1b')](_0x166f('0x16'),_0x44c51f,JSON[_0x166f('0xe')](_0x1a4837));_0x12d9e8(_0x1a4837);})[_0x166f('0x1c')](function(_0x2e611c){logger[_0x166f('0xf')]('UpdateWhatsappQueueReport',_0x2e611c[_0x166f('0x10')],_0x44c51f);_0x58f4f7(_0x58c255[_0x166f('0xf')](0x1f4,_0x2e611c[_0x166f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9d1acb9..e6b412b 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 _0x09d9=['/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x550ece,_0x2e6bd4){var _0x3ae2f6=function(_0x14b402){while(--_0x14b402){_0x550ece['push'](_0x550ece['shift']());}};_0x3ae2f6(++_0x2e6bd4);}(_0x09d9,0xcf));var _0x909d=function(_0x497497,_0x4135a8){_0x497497=_0x497497-0x0;var _0x41eeff=_0x09d9[_0x497497];return _0x41eeff;};'use strict';var multer=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var path=require(_0x909d('0x2'));var timeout=require(_0x909d('0x3'));var express=require('express');var router=express[_0x909d('0x4')]();var fs_extra=require(_0x909d('0x5'));var auth=require(_0x909d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x909d('0x7'));var controller=require(_0x909d('0x8'));router[_0x909d('0x9')]('/',auth[_0x909d('0xa')](),controller[_0x909d('0xb')]);router[_0x909d('0x9')](_0x909d('0xc'),auth[_0x909d('0xa')](),controller['describe']);router[_0x909d('0x9')](_0x909d('0xd'),auth[_0x909d('0xa')](),controller[_0x909d('0xe')]);router[_0x909d('0xf')]('/',auth[_0x909d('0xa')](),controller['create']);router[_0x909d('0x10')](_0x909d('0xd'),auth[_0x909d('0xa')](),controller[_0x909d('0x11')]);router['delete'](_0x909d('0xd'),auth['isAuthenticated'](),controller[_0x909d('0x12')]);module[_0x909d('0x13')]=router; \ No newline at end of file +var _0x114e=['isAuthenticated','index','/describe','describe','get','/:id','post','create','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x2a352d,_0x355e99){var _0x329aa2=function(_0x37d9d1){while(--_0x37d9d1){_0x2a352d['push'](_0x2a352d['shift']());}};_0x329aa2(++_0x355e99);}(_0x114e,0x77));var _0xe114=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x114e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe114('0x0'));var util=require(_0xe114('0x1'));var path=require('path');var timeout=require(_0xe114('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe114('0x3'));var auth=require(_0xe114('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe114('0x5'));var controller=require(_0xe114('0x6'));router['get']('/',auth[_0xe114('0x7')](),controller[_0xe114('0x8')]);router['get'](_0xe114('0x9'),auth['isAuthenticated'](),controller[_0xe114('0xa')]);router[_0xe114('0xb')](_0xe114('0xc'),auth[_0xe114('0x7')](),controller['show']);router[_0xe114('0xd')]('/',auth[_0xe114('0x7')](),controller[_0xe114('0xe')]);router['put']('/:id',auth[_0xe114('0x7')](),controller[_0xe114('0xf')]);router['delete'](_0xe114('0xc'),auth['isAuthenticated'](),controller[_0xe114('0x10')]);module[_0xe114('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index b2d3e9c..b467961 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 _0xa3b7=['queue','DATE','sequelize','STRING','account','agent'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xa3b7[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require(_0x7a3b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7a3b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7a3b('0x2'),_0x7a3b('0x3'),_0x7a3b('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7a3b('0x5')]}}; \ No newline at end of file +var _0x6132=['ENUM','account','agent','exports'];(function(_0x15a603,_0x480042){var _0x4776fe=function(_0x3d2393){while(--_0x3d2393){_0x15a603['push'](_0x15a603['shift']());}};_0x4776fe(++_0x480042);}(_0x6132,0xf3));var _0x2613=function(_0x430292,_0x45ea6c){_0x430292=_0x430292-0x0;var _0x37acc8=_0x6132[_0x430292];return _0x37acc8;};'use strict';var Sequelize=require('sequelize');module[_0x2613('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2613('0x1')](_0x2613('0x2'),_0x2613('0x3'),'queue'),'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 2ef5f51..e94bd3c 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 _0xab40=['describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','stack','name','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','WhatsappTransferReport','findAll','rows','show','params','include','catch','create','body','update','find'];(function(_0xf25cf8,_0x1b0383){var _0x316dd9=function(_0x1d4b43){while(--_0x1d4b43){_0xf25cf8['push'](_0xf25cf8['shift']());}};_0x316dd9(++_0x1b0383);}(_0xab40,0xcd));var _0x0ab4=function(_0x232a38,_0x1cb94d){_0x232a38=_0x232a38-0x0;var _0x1c7a65=_0xab40[_0x232a38];return _0x1c7a65;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){_0x14087f[_0x0ab4('0x16')](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x4ea9aa,_0x4c5caf){return function(_0x176ff1){if(!_0x176ff1){_0x4ea9aa[_0x0ab4('0x15')](0x194);}return _0x176ff1;};}function handleError(_0x1a17ce,_0x4ae515){_0x4ae515=_0x4ae515||0x1f4;return function(_0x519b23){logger['error'](_0x519b23[_0x0ab4('0x20')]);if(_0x519b23['name']){delete _0x519b23[_0x0ab4('0x21')];}_0x1a17ce[_0x0ab4('0x16')](_0x4ae515)['send'](_0x519b23);};}exports['index']=function(_0x4d0cc1,_0x3d38a4){var _0x183bac={},_0x1cfdad={},_0x3f61cb={'count':0x0,'rows':[]};var _0x25385e=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x2e7a97){return{'name':_0x2e7a97[_0x0ab4('0x22')],'type':_0x2e7a97[_0x0ab4('0x23')][_0x0ab4('0x24')]};});_0x1cfdad[_0x0ab4('0x25')]=_['map'](_0x25385e,'name');_0x1cfdad[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x4d0cc1[_0x0ab4('0x26')]);_0x1cfdad['filters']=_['intersection'](_0x1cfdad[_0x0ab4('0x25')],_0x1cfdad['query']);_0x183bac[_0x0ab4('0x28')]=_[_0x0ab4('0x29')](_0x1cfdad[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x183bac['attributes']=_0x183bac[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x183bac[_0x0ab4('0x28')]:_0x1cfdad[_0x0ab4('0x25')];if(!_0x4d0cc1['query']['hasOwnProperty'](_0x0ab4('0x2c'))){_0x183bac[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x4d0cc1['query']['limit']);_0x183bac['offset']=qs[_0x0ab4('0x19')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x19')]);}_0x183bac['order']=qs['sort'](_0x4d0cc1['query'][_0x0ab4('0x2d')]);_0x183bac[_0x0ab4('0x2e')]=qs[_0x0ab4('0x2f')](_[_0x0ab4('0x30')](_0x4d0cc1[_0x0ab4('0x26')],_0x1cfdad[_0x0ab4('0x2f')]),_0x25385e);if(_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]){_0x183bac[_0x0ab4('0x2e')]=_[_0x0ab4('0x32')](_0x183bac['where'],{'$or':_[_0x0ab4('0x33')](_0x25385e,function(_0x31e234){if(_0x31e234[_0x0ab4('0x23')]!==_0x0ab4('0x34')){var _0x2e1da9={};_0x2e1da9[_0x31e234[_0x0ab4('0x21')]]={'$like':'%'+_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]+'%'};return _0x2e1da9;}})});}_0x183bac=_[_0x0ab4('0x32')]({},_0x183bac,_0x4d0cc1[_0x0ab4('0x35')]);var _0x449437={'where':_0x183bac[_0x0ab4('0x2e')]};return db['WhatsappTransferReport'][_0x0ab4('0x36')](_0x449437)[_0x0ab4('0x1f')](function(_0x1cee1c){_0x3f61cb[_0x0ab4('0x36')]=_0x1cee1c;if(_0x4d0cc1['query'][_0x0ab4('0x37')]){_0x183bac['include']=[{'all':!![]}];}return db[_0x0ab4('0x38')][_0x0ab4('0x39')](_0x183bac);})[_0x0ab4('0x1f')](function(_0x245021){_0x3f61cb[_0x0ab4('0x3a')]=_0x245021;return _0x3f61cb;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3d38a4,_0x183bac))['catch'](handleError(_0x3d38a4,null));};exports[_0x0ab4('0x3b')]=function(_0x3cc364,_0xe3df73){var _0x48029f={'raw':!![],'where':{'id':_0x3cc364[_0x0ab4('0x3c')]['id']}},_0x395e0b={};_0x395e0b[_0x0ab4('0x25')]=_[_0x0ab4('0x27')](db[_0x0ab4('0x38')]['rawAttributes']);_0x395e0b['query']=_['keys'](_0x3cc364[_0x0ab4('0x26')]);_0x395e0b[_0x0ab4('0x2f')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],_0x395e0b['query']);_0x48029f[_0x0ab4('0x28')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x48029f[_0x0ab4('0x28')]=_0x48029f[_0x0ab4('0x28')]['length']?_0x48029f[_0x0ab4('0x28')]:_0x395e0b[_0x0ab4('0x25')];if(_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x37')]){_0x48029f[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x48029f=_[_0x0ab4('0x32')]({},_0x48029f,_0x3cc364['options']);return db[_0x0ab4('0x38')]['find'](_0x48029f)[_0x0ab4('0x1f')](handleEntityNotFound(_0xe3df73,null))[_0x0ab4('0x1f')](respondWithResult(_0xe3df73,null))[_0x0ab4('0x3e')](handleError(_0xe3df73,null));};exports['create']=function(_0x5b09e,_0x1fcc3b){return db[_0x0ab4('0x38')][_0x0ab4('0x3f')](_0x5b09e[_0x0ab4('0x40')],{})[_0x0ab4('0x1f')](respondWithResult(_0x1fcc3b,0xc9))['catch'](handleError(_0x1fcc3b,null));};exports[_0x0ab4('0x41')]=function(_0xdcc118,_0x302894){if(_0xdcc118[_0x0ab4('0x40')]['id']){delete _0xdcc118[_0x0ab4('0x40')]['id'];}return db[_0x0ab4('0x38')][_0x0ab4('0x42')]({'where':{'id':_0xdcc118[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x302894,null))[_0x0ab4('0x1f')](saveUpdates(_0xdcc118[_0x0ab4('0x40')],null))[_0x0ab4('0x1f')](respondWithResult(_0x302894,null))[_0x0ab4('0x3e')](handleError(_0x302894,null));};exports['destroy']=function(_0x2c3a0a,_0x354bc){return db['WhatsappTransferReport'][_0x0ab4('0x42')]({'where':{'id':_0x2c3a0a['params']['id']}})['then'](handleEntityNotFound(_0x354bc,null))[_0x0ab4('0x1f')](removeEntity(_0x354bc,null))[_0x0ab4('0x3e')](handleError(_0x354bc,null));};exports[_0x0ab4('0x43')]=function(_0x4966bc,_0x12a2df){return db[_0x0ab4('0x38')][_0x0ab4('0x43')]()[_0x0ab4('0x1f')](respondWithResult(_0x12a2df,null))[_0x0ab4('0x3e')](handleError(_0x12a2df,null));}; \ No newline at end of file +var _0xa0d1=['rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','WhatsappTransferReport','findAll','rows','show','params','includeAll','catch','create','body','find','describe','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map'];(function(_0x21e0cc,_0x2094c4){var _0x3a29a9=function(_0x1a02ce){while(--_0x1a02ce){_0x21e0cc['push'](_0x21e0cc['shift']());}};_0x3a29a9(++_0x2094c4);}(_0xa0d1,0x144));var _0x1a0d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa0d1[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a0d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0d('0x1'));var moment=require(_0x1a0d('0x2'));var BPromise=require(_0x1a0d('0x3'));var Mustache=require(_0x1a0d('0x4'));var util=require(_0x1a0d('0x5'));var path=require('path');var sox=require(_0x1a0d('0x6'));var csv=require(_0x1a0d('0x7'));var ejs=require(_0x1a0d('0x8'));var fs=require('fs');var fs_extra=require(_0x1a0d('0x9'));var _=require(_0x1a0d('0xa'));var squel=require(_0x1a0d('0xb'));var crypto=require(_0x1a0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a0d('0x7'));var querystring=require(_0x1a0d('0xd'));var Papa=require(_0x1a0d('0xe'));var Redis=require('ioredis');var authService=require(_0x1a0d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1a0d('0x10'));var hardwareService=require(_0x1a0d('0x11'));var logger=require(_0x1a0d('0x12'))(_0x1a0d('0x13'));var utils=require('../../config/utils');var config=require(_0x1a0d('0x14'));var licenseUtil=require(_0x1a0d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412f34,_0x1920aa){_0x1920aa=_0x1920aa||0xcc;return function(_0x5b537a){if(_0x5b537a){return _0x412f34[_0x1a0d('0x16')](_0x1920aa);}return _0x412f34[_0x1a0d('0x17')](_0x1920aa)[_0x1a0d('0x18')]();};}function respondWithResult(_0x5e0c35,_0x35a4eb){_0x35a4eb=_0x35a4eb||0xc8;return function(_0x281689){if(_0x281689){return _0x5e0c35[_0x1a0d('0x17')](_0x35a4eb)[_0x1a0d('0x19')](_0x281689);}};}function respondWithFilteredResult(_0x1b228f,_0x4acabd){return function(_0x39eb09){if(_0x39eb09){var _0x85758f=typeof _0x4acabd[_0x1a0d('0x1a')]==='undefined'&&typeof _0x4acabd[_0x1a0d('0x1b')]==='undefined';var _0x134bd0=_0x39eb09['count'];var _0xfe6334=_0x85758f?0x0:_0x4acabd[_0x1a0d('0x1a')];var _0x264453=_0x85758f?_0x39eb09[_0x1a0d('0x1c')]:_0x4acabd[_0x1a0d('0x1a')]+_0x4acabd[_0x1a0d('0x1b')];var _0xdf846;if(_0x264453>=_0x134bd0){_0x264453=_0x134bd0;_0xdf846=0xc8;}else{_0xdf846=0xce;}_0x1b228f[_0x1a0d('0x17')](_0xdf846);return _0x1b228f[_0x1a0d('0x1d')](_0x1a0d('0x1e'),_0xfe6334+'-'+_0x264453+'/'+_0x134bd0)[_0x1a0d('0x19')](_0x39eb09);}return null;};}function patchUpdates(_0x5acc91){return function(_0x176c2b){try{jsonpatch['apply'](_0x176c2b,_0x5acc91,!![]);}catch(_0x200c38){return BPromise[_0x1a0d('0x1f')](_0x200c38);}return _0x176c2b[_0x1a0d('0x20')]();};}function saveUpdates(_0x44da82,_0x27f6c7){return function(_0xd58a5f){if(_0xd58a5f){return _0xd58a5f[_0x1a0d('0x21')](_0x44da82)[_0x1a0d('0x22')](function(_0x2546a1){return _0x2546a1;});}return null;};}function removeEntity(_0x26531b,_0x357a81){return function(_0x537c7f){if(_0x537c7f){return _0x537c7f[_0x1a0d('0x23')]()[_0x1a0d('0x22')](function(){_0x26531b[_0x1a0d('0x17')](0xcc)[_0x1a0d('0x18')]();});}};}function handleEntityNotFound(_0xb9bcee,_0x340fa7){return function(_0x1de4fb){if(!_0x1de4fb){_0xb9bcee['sendStatus'](0x194);}return _0x1de4fb;};}function handleError(_0x149685,_0x5746fe){_0x5746fe=_0x5746fe||0x1f4;return function(_0x51b2c0){logger[_0x1a0d('0x24')](_0x51b2c0['stack']);if(_0x51b2c0[_0x1a0d('0x25')]){delete _0x51b2c0['name'];}_0x149685[_0x1a0d('0x17')](_0x5746fe)[_0x1a0d('0x26')](_0x51b2c0);};}exports[_0x1a0d('0x27')]=function(_0x425164,_0x59612e){var _0x453e8d={},_0x45896c={},_0x4fb64a={'count':0x0,'rows':[]};var _0x21863e=_[_0x1a0d('0x28')](db['WhatsappTransferReport'][_0x1a0d('0x29')],function(_0xc8c0fd){return{'name':_0xc8c0fd[_0x1a0d('0x2a')],'type':_0xc8c0fd[_0x1a0d('0x2b')][_0x1a0d('0x2c')]};});_0x45896c['model']=_[_0x1a0d('0x28')](_0x21863e,'name');_0x45896c[_0x1a0d('0x2d')]=_['keys'](_0x425164[_0x1a0d('0x2d')]);_0x45896c[_0x1a0d('0x2e')]=_[_0x1a0d('0x2f')](_0x45896c['model'],_0x45896c[_0x1a0d('0x2d')]);_0x453e8d['attributes']=_[_0x1a0d('0x2f')](_0x45896c[_0x1a0d('0x30')],qs[_0x1a0d('0x31')](_0x425164[_0x1a0d('0x2d')]['fields']));_0x453e8d[_0x1a0d('0x32')]=_0x453e8d['attributes'][_0x1a0d('0x33')]?_0x453e8d['attributes']:_0x45896c[_0x1a0d('0x30')];if(!_0x425164[_0x1a0d('0x2d')][_0x1a0d('0x34')](_0x1a0d('0x35'))){_0x453e8d[_0x1a0d('0x1b')]=qs[_0x1a0d('0x1b')](_0x425164['query'][_0x1a0d('0x1b')]);_0x453e8d[_0x1a0d('0x1a')]=qs[_0x1a0d('0x1a')](_0x425164[_0x1a0d('0x2d')][_0x1a0d('0x1a')]);}_0x453e8d[_0x1a0d('0x36')]=qs['sort'](_0x425164[_0x1a0d('0x2d')]['sort']);_0x453e8d[_0x1a0d('0x37')]=qs[_0x1a0d('0x2e')](_[_0x1a0d('0x38')](_0x425164[_0x1a0d('0x2d')],_0x45896c[_0x1a0d('0x2e')]),_0x21863e);if(_0x425164[_0x1a0d('0x2d')][_0x1a0d('0x39')]){_0x453e8d[_0x1a0d('0x37')]=_[_0x1a0d('0x3a')](_0x453e8d[_0x1a0d('0x37')],{'$or':_[_0x1a0d('0x28')](_0x21863e,function(_0x12794a){if(_0x12794a['type']!==_0x1a0d('0x3b')){var _0xf9df1b={};_0xf9df1b[_0x12794a[_0x1a0d('0x25')]]={'$like':'%'+_0x425164['query'][_0x1a0d('0x39')]+'%'};return _0xf9df1b;}})});}_0x453e8d=_['merge']({},_0x453e8d,_0x425164[_0x1a0d('0x3c')]);var _0x200134={'where':_0x453e8d[_0x1a0d('0x37')]};return db['WhatsappTransferReport'][_0x1a0d('0x1c')](_0x200134)['then'](function(_0x4ab8de){_0x4fb64a['count']=_0x4ab8de;if(_0x425164['query']['includeAll']){_0x453e8d[_0x1a0d('0x3d')]=[{'all':!![]}];}return db[_0x1a0d('0x3e')][_0x1a0d('0x3f')](_0x453e8d);})[_0x1a0d('0x22')](function(_0x1b8699){_0x4fb64a[_0x1a0d('0x40')]=_0x1b8699;return _0x4fb64a;})['then'](respondWithFilteredResult(_0x59612e,_0x453e8d))['catch'](handleError(_0x59612e,null));};exports[_0x1a0d('0x41')]=function(_0x447914,_0x26f690){var _0x444aa5={'raw':!![],'where':{'id':_0x447914[_0x1a0d('0x42')]['id']}},_0x3c4a02={};_0x3c4a02['model']=_['keys'](db['WhatsappTransferReport'][_0x1a0d('0x29')]);_0x3c4a02[_0x1a0d('0x2d')]=_['keys'](_0x447914[_0x1a0d('0x2d')]);_0x3c4a02[_0x1a0d('0x2e')]=_['intersection'](_0x3c4a02['model'],_0x3c4a02[_0x1a0d('0x2d')]);_0x444aa5[_0x1a0d('0x32')]=_[_0x1a0d('0x2f')](_0x3c4a02['model'],qs[_0x1a0d('0x31')](_0x447914['query'][_0x1a0d('0x31')]));_0x444aa5[_0x1a0d('0x32')]=_0x444aa5[_0x1a0d('0x32')][_0x1a0d('0x33')]?_0x444aa5[_0x1a0d('0x32')]:_0x3c4a02[_0x1a0d('0x30')];if(_0x447914[_0x1a0d('0x2d')][_0x1a0d('0x43')]){_0x444aa5[_0x1a0d('0x3d')]=[{'all':!![]}];}_0x444aa5=_[_0x1a0d('0x3a')]({},_0x444aa5,_0x447914['options']);return db[_0x1a0d('0x3e')]['find'](_0x444aa5)[_0x1a0d('0x22')](handleEntityNotFound(_0x26f690,null))['then'](respondWithResult(_0x26f690,null))[_0x1a0d('0x44')](handleError(_0x26f690,null));};exports['create']=function(_0xe26f7f,_0x2a6713){return db[_0x1a0d('0x3e')][_0x1a0d('0x45')](_0xe26f7f[_0x1a0d('0x46')],{})[_0x1a0d('0x22')](respondWithResult(_0x2a6713,0xc9))[_0x1a0d('0x44')](handleError(_0x2a6713,null));};exports[_0x1a0d('0x21')]=function(_0xe6a4d,_0x17ffdb){if(_0xe6a4d[_0x1a0d('0x46')]['id']){delete _0xe6a4d['body']['id'];}return db[_0x1a0d('0x3e')][_0x1a0d('0x47')]({'where':{'id':_0xe6a4d['params']['id']}})['then'](handleEntityNotFound(_0x17ffdb,null))[_0x1a0d('0x22')](saveUpdates(_0xe6a4d[_0x1a0d('0x46')],null))[_0x1a0d('0x22')](respondWithResult(_0x17ffdb,null))[_0x1a0d('0x44')](handleError(_0x17ffdb,null));};exports['destroy']=function(_0x4c5cb8,_0x2f1dd2){return db[_0x1a0d('0x3e')][_0x1a0d('0x47')]({'where':{'id':_0x4c5cb8[_0x1a0d('0x42')]['id']}})[_0x1a0d('0x22')](handleEntityNotFound(_0x2f1dd2,null))['then'](removeEntity(_0x2f1dd2,null))[_0x1a0d('0x44')](handleError(_0x2f1dd2,null));};exports['describe']=function(_0x410fdf,_0x19af6d){return db[_0x1a0d('0x3e')][_0x1a0d('0x48')]()['then'](respondWithResult(_0x19af6d,null))[_0x1a0d('0x44')](handleError(_0x19af6d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 359f55c..c7a56ff 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 _0xe0dc=['uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','WhatsappTransferReport'];(function(_0x14937c,_0x4cb94e){var _0x4fa8bf=function(_0x49d1ae){while(--_0x49d1ae){_0x14937c['push'](_0x14937c['shift']());}};_0x4fa8bf(++_0x4cb94e);}(_0xe0dc,0x1cd));var _0xce0d=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0xe0dc[_0x2ba054];return _0x5d2153;};'use strict';var _=require(_0xce0d('0x0'));var util=require(_0xce0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce0d('0x2'));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('./whatsappTransferReport.attributes');module[_0xce0d('0x7')]=function(_0x9fc975,_0x596603){return _0x9fc975['define'](_0xce0d('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xce0d('0x9'),'fields':[_0xce0d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbf5=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x34865f,_0x554e0a){var _0x2ebbaa=function(_0x5533a7){while(--_0x5533a7){_0x34865f['push'](_0x34865f['shift']());}};_0x2ebbaa(++_0x554e0a);}(_0xcbf5,0x12f));var _0x5cbf=function(_0x2e6b6c,_0x2539bd){_0x2e6b6c=_0x2e6b6c-0x0;var _0x4be1bc=_0xcbf5[_0x2e6b6c];return _0x4be1bc;};'use strict';var _=require(_0x5cbf('0x0'));var util=require(_0x5cbf('0x1'));var logger=require(_0x5cbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5cbf('0x3'));var rp=require(_0x5cbf('0x4'));var fs=require('fs');var path=require(_0x5cbf('0x5'));var rimraf=require(_0x5cbf('0x6'));var config=require(_0x5cbf('0x7'));var attributes=require(_0x5cbf('0x8'));module[_0x5cbf('0x9')]=function(_0x5ebf72,_0x36d5af){return _0x5ebf72[_0x5cbf('0xa')](_0x5cbf('0xb'),attributes,{'tableName':_0x5cbf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5cbf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cc84ece..f179ce6 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 _0x5c65=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1da193,_0x150541){var _0x2e9d1e=function(_0x399e1a){while(--_0x399e1a){_0x1da193['push'](_0x1da193['shift']());}};_0x2e9d1e(++_0x150541);}(_0x5c65,0xd3));var _0x55c6=function(_0x2359a0,_0x51ab9c){_0x2359a0=_0x2359a0-0x0;var _0x269f47=_0x5c65[_0x2359a0];return _0x269f47;};'use strict';var _=require(_0x55c6('0x0'));var util=require('util');var moment=require(_0x55c6('0x1'));var BPromise=require(_0x55c6('0x2'));var rs=require(_0x55c6('0x3'));var fs=require('fs');var Redis=require(_0x55c6('0x4'));var db=require(_0x55c6('0x5'))['db'];var utils=require(_0x55c6('0x6'));var logger=require(_0x55c6('0x7'))(_0x55c6('0x8'));var config=require(_0x55c6('0x9'));var jayson=require(_0x55c6('0xa'));var client=jayson[_0x55c6('0xb')][_0x55c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7c2f,_0x506af9,_0xea3041){return new BPromise(function(_0x104095,_0x59a496){return client['request'](_0x3c7c2f,_0xea3041)[_0x55c6('0xd')](function(_0x4a73f1){logger[_0x55c6('0xe')](_0x55c6('0xf'),_0x506af9,_0x55c6('0x10'));logger[_0x55c6('0x11')](_0x55c6('0x12'),_0x506af9,_0x55c6('0x10'),JSON[_0x55c6('0x13')](_0x4a73f1));if(_0x4a73f1[_0x55c6('0x14')]){if(_0x4a73f1['error']['code']===0x1f4){logger[_0x55c6('0x14')](_0x55c6('0xf'),_0x506af9,_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);return _0x59a496(_0x4a73f1[_0x55c6('0x14')]['message']);}logger['error'](_0x55c6('0xf'),_0x506af9,_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);return _0x104095(_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);}else{logger[_0x55c6('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x506af9,_0x55c6('0x10'));_0x104095(_0x4a73f1[_0x55c6('0x16')][_0x55c6('0x15')]);}})[_0x55c6('0x17')](function(_0xb20f0){logger[_0x55c6('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x506af9,_0xb20f0);_0x59a496(_0xb20f0);});});} \ No newline at end of file +var _0x3fc4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird'];(function(_0x8295d6,_0x263216){var _0x4fa9aa=function(_0x4779de){while(--_0x4779de){_0x8295d6['push'](_0x8295d6['shift']());}};_0x4fa9aa(++_0x263216);}(_0x3fc4,0x18e));var _0x43fc=function(_0x4b6ad8,_0x1b3a6c){_0x4b6ad8=_0x4b6ad8-0x0;var _0x4ad7e3=_0x3fc4[_0x4b6ad8];return _0x4ad7e3;};'use strict';var _=require(_0x43fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43fc('0x2'));var db=require(_0x43fc('0x3'))['db'];var utils=require(_0x43fc('0x4'));var logger=require(_0x43fc('0x5'))(_0x43fc('0x6'));var config=require(_0x43fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43fc('0x8')][_0x43fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ff36f,_0x232c0e,_0x26f4a8){return new BPromise(function(_0x53c97c,_0x537c89){return client[_0x43fc('0xa')](_0x2ff36f,_0x26f4a8)[_0x43fc('0xb')](function(_0x8f905b){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x232c0e,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x232c0e,_0x43fc('0xc'),JSON['stringify'](_0x8f905b));if(_0x8f905b[_0x43fc('0xd')]){if(_0x8f905b[_0x43fc('0xd')][_0x43fc('0xe')]===0x1f4){logger[_0x43fc('0xd')](_0x43fc('0xf'),_0x232c0e,_0x8f905b[_0x43fc('0xd')]['message']);return _0x537c89(_0x8f905b[_0x43fc('0xd')][_0x43fc('0x10')]);}logger[_0x43fc('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x232c0e,_0x8f905b['error'][_0x43fc('0x10')]);return _0x53c97c(_0x8f905b[_0x43fc('0xd')][_0x43fc('0x10')]);}else{logger[_0x43fc('0x11')](_0x43fc('0xf'),_0x232c0e,_0x43fc('0xc'));_0x53c97c(_0x8f905b[_0x43fc('0x12')][_0x43fc('0x10')]);}})[_0x43fc('0x13')](function(_0x12f993){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x232c0e,_0x12f993);_0x537c89(_0x12f993);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4f7cb71..0136045 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bc3=['./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','Offline\x20apps:','status','online','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./rpc','./config/environment','app','./config/pm2'];(function(_0x38a45d,_0x4398b9){var _0x59ca4b=function(_0x294ec4){while(--_0x294ec4){_0x38a45d['push'](_0x38a45d['shift']());}};_0x59ca4b(++_0x4398b9);}(_0x8bc3,0x82));var _0x38bc=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x8bc3[_0x408de5];return _0x2015a1;};'use strict';var _=require(_0x38bc('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x38bc('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x38bc('0x2'));var config=require(_0x38bc('0x3'));var logger=require('./config/logger')(_0x38bc('0x4'));var pm2=require(_0x38bc('0x5'));var pm2Config=require(_0x38bc('0x6'));var schedule=require(_0x38bc('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x38bc('0x8'));var transcribe=require(_0x38bc('0x9'));var provider=require(_0x38bc('0xa'));function main(){return db[_0x38bc('0xb')][_0x38bc('0xc')]()['then'](function(){if(config['seedDB']){return seedDb[_0x38bc('0xd')]();}})[_0x38bc('0xe')](function(){return checkLicense[_0x38bc('0xd')]();})[_0x38bc('0xe')](function(){return rpc[_0x38bc('0xf')]();})[_0x38bc('0xe')](function(_0x122a46){logger[_0x38bc('0x10')](_0x122a46);return chat[_0x38bc('0x11')]();})[_0x38bc('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x38bc('0x11')]();})['then'](function(){return provider['start']();})['then'](function(_0x4fd437){logger[_0x38bc('0x10')](_0x4fd437);return pm2[_0x38bc('0x11')](pm2Config);})[_0x38bc('0xe')](function(_0x5d4997){var _0x22f87b=_0x5d4997[_0x38bc('0x12')](function(_0x1ff95d){return typeof _0x1ff95d[_0x38bc('0x13')]===_0x38bc('0x14')&&_0x1ff95d[_0x38bc('0x13')]>=0x0;});if(_0x22f87b[_0x38bc('0x15')]>0x0){throw new Error(_0x22f87b[_0x38bc('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x38bc('0x16')](_0x22f87b,function(_0x55940b){return'\x22'+_0x55940b[_0x38bc('0x17')][_0x38bc('0x18')]+'\x22';}));}logger[_0x38bc('0x10')](_0x38bc('0x19'),_[_0x38bc('0x16')](_[_0x38bc('0x12')](_0x5d4997,{'status':'online'}),_0x38bc('0x18'))['join']());logger['info'](_0x38bc('0x1a'),_[_0x38bc('0x16')](_[_0x38bc('0x12')](_0x5d4997,function(_0x19f3af){return _0x19f3af[_0x38bc('0x1b')]!==_0x38bc('0x1c');}),_0x38bc('0x18'))['join']()||'None');console[_0x38bc('0x1d')](_0x38bc('0x1e'));})['catch'](function(_0x2d32fe){console['log'](_0x38bc('0x1f'),_0x2d32fe);logger[_0x38bc('0x20')](_0x38bc('0x21'),_0x2d32fe);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x812d=['map','pm2_env','name','filter','Offline\x20apps:','status','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','seedDB','default','then','listen','start','info','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x259d11,_0x222597){var _0x34f70c=function(_0x5b6321){while(--_0x5b6321){_0x259d11['push'](_0x259d11['shift']());}};_0x34f70c(++_0x222597);}(_0x812d,0x6e));var _0xd812=function(_0x47b8ef,_0x557dd9){_0x47b8ef=_0x47b8ef-0x0;var _0x240c8d=_0x812d[_0x47b8ef];return _0x240c8d;};'use strict';var _=require('lodash');var db=require(_0xd812('0x0'))['db'];var seedDb=require(_0xd812('0x1'));var checkLicense=require(_0xd812('0x2'));var rpc=require(_0xd812('0x3'));var config=require(_0xd812('0x4'));var logger=require(_0xd812('0x5'))(_0xd812('0x6'));var pm2=require(_0xd812('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xd812('0x8'));var chat=require(_0xd812('0x9'));var whatsapp=require(_0xd812('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xd812('0xb')][_0xd812('0xc')]()['then'](function(){if(config[_0xd812('0xd')]){return seedDb[_0xd812('0xe')]();}})['then'](function(){return checkLicense[_0xd812('0xe')]();})[_0xd812('0xf')](function(){return rpc[_0xd812('0x10')]();})['then'](function(_0x42afff){logger['info'](_0x42afff);return chat['start']();})[_0xd812('0xf')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xd812('0x11')]();})[_0xd812('0xf')](function(){return transcribe[_0xd812('0x11')]();})['then'](function(){return provider[_0xd812('0x11')]();})[_0xd812('0xf')](function(_0x2a7060){logger[_0xd812('0x12')](_0x2a7060);return pm2[_0xd812('0x11')](pm2Config);})[_0xd812('0xf')](function(_0x2bc66b){var _0x30feb1=_0x2bc66b['filter'](function(_0x566a84){return typeof _0x566a84['exitCode']===_0xd812('0x13')&&_0x566a84['exitCode']>=0x0;});if(_0x30feb1['length']>0x0){throw new Error(_0x30feb1[_0xd812('0x14')]+_0xd812('0x15')+_[_0xd812('0x16')](_0x30feb1,function(_0x24c4e4){return'\x22'+_0x24c4e4[_0xd812('0x17')][_0xd812('0x18')]+'\x22';}));}logger[_0xd812('0x12')]('Online\x20apps:',_['map'](_[_0xd812('0x19')](_0x2bc66b,{'status':'online'}),_0xd812('0x18'))['join']());logger['info'](_0xd812('0x1a'),_[_0xd812('0x16')](_[_0xd812('0x19')](_0x2bc66b,function(_0x342752){return _0x342752[_0xd812('0x1b')]!=='online';}),'name')['join']()||'None');console[_0xd812('0x1c')](_0xd812('0x1d'));})['catch'](function(_0x44f5f9){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x44f5f9);logger[_0xd812('0x1e')](_0xd812('0x1f'),_0x44f5f9);process[_0xd812('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4c2f82d..0f5f4b9 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 _0xf2f9=['emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','User','name','startsWith','authorization','Bearer','apikey','getUuid','find','Setting','blockDuration','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','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.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','splice','join','payload','promisify','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','crypto','bluebird','secrets','role','fullname','internal','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay'];(function(_0x157236,_0x4c22c5){var _0x3f5cd8=function(_0x30e756){while(--_0x30e756){_0x157236['push'](_0x157236['shift']());}};_0x3f5cd8(++_0x4c22c5);}(_0xf2f9,0x1e2));var _0x9f2f=function(_0x482d06,_0x1c7c4a){_0x482d06=_0x482d06-0x0;var _0x3bdd88=_0xf2f9[_0x482d06];return _0x3bdd88;};'use strict';var db=require(_0x9f2f('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9f2f('0x1'));var licenseUtil=require(_0x9f2f('0x2'));var encryptor=require(_0x9f2f('0x3'));var _=require(_0x9f2f('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x9f2f('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x9f2f('0x6'));var BPromise=require(_0x9f2f('0x7'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x9f2f('0x8')]['session']});var userAttributes=['id',_0x9f2f('0x9'),_0x9f2f('0xa'),'name',_0x9f2f('0xb'),'email',_0x9f2f('0xc'),_0x9f2f('0xd'),_0x9f2f('0xe'),_0x9f2f('0xf'),'chatPause',_0x9f2f('0x10'),_0x9f2f('0x11'),_0x9f2f('0x12'),_0x9f2f('0x13'),'pauseType','showWebBar',_0x9f2f('0x14'),_0x9f2f('0x15'),'crudPermissions',_0x9f2f('0x16'),'passwordResetAt',_0x9f2f('0x17'),_0x9f2f('0x18'),_0x9f2f('0x19'),_0x9f2f('0x1a'),_0x9f2f('0x1b'),_0x9f2f('0x1c'),'phoneBarEnableSettings',_0x9f2f('0x1d'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x9f2f('0x1e'),_0x9f2f('0x1f'),_0x9f2f('0x20'),_0x9f2f('0x21'),_0x9f2f('0x22'),'settingsEnabled',_0x9f2f('0x23'),'downloadVoiceRecordings',_0x9f2f('0x24'),_0x9f2f('0x25'),_0x9f2f('0x26'),_0x9f2f('0x27'),_0x9f2f('0x28'),_0x9f2f('0x29'),_0x9f2f('0x2a'),_0x9f2f('0x2b'),_0x9f2f('0x2c'),_0x9f2f('0x2d'),'openchannelAutoanswer',_0x9f2f('0x2e'),_0x9f2f('0x2f'),_0x9f2f('0x30'),_0x9f2f('0x31'),_0x9f2f('0x32'),_0x9f2f('0x33')];exports[_0x9f2f('0x34')]=function(){return this[_0x9f2f('0x35')](!![])['use'](function(_0x2304e6,_0xf8ebed,_0x271ca4){if(_0x2304e6[_0x9f2f('0x36')]){_0x271ca4();}else{return db[_0x9f2f('0x37')][_0x9f2f('0x38')]({'where':{'id':_0x2304e6['params']['id']},'attributes':['id',_0x9f2f('0x39'),_0x9f2f('0x3a')],'raw':!![]})[_0x9f2f('0x3b')](function(_0x1d91dd){if(_0x1d91dd&&_0x1d91dd[_0x9f2f('0x39')]&&!_0x2304e6[_0x9f2f('0x3c')][_0x9f2f('0x3d')]){return _0xf8ebed[_0x9f2f('0x3e')](_0x1d91dd[_0x9f2f('0x3a')]===_0x9f2f('0x3f')?0x195:0x193)[_0x9f2f('0x40')]({'message':_0x1d91dd[_0x9f2f('0x3a')]==='unmanaged'?_0x9f2f('0x41'):_0x9f2f('0x42')});}else{_0x271ca4();}})[_0x9f2f('0x43')](function(_0x704581){_0x271ca4(_0x704581);});}});};exports[_0x9f2f('0x35')]=function isAuthenticated(_0x2030f1){return compose()[_0x9f2f('0x44')](function(_0x18a359,_0x1198ea,_0x1f20ab){var _0x2670d7;if(_0x18a359[_0x9f2f('0x45')]['authorization']){if(_['startsWith'](_0x18a359['headers']['authorization'],'Basic')){var _0x10df80=basicAuth(_0x18a359);db[_0x9f2f('0x46')]['find']({'where':{'name':_0x10df80[_0x9f2f('0x47')]}})[_0x9f2f('0x3b')](function(_0x537f3a){if(!_0x537f3a||!_0x537f3a['authenticate'](_0x10df80['pass'])){return _0x1198ea['status'](0x191)[_0x9f2f('0x40')]({'message':'Wrong\x20credentials.'});}_0x18a359[_0x9f2f('0x36')]={'id':_0x537f3a['id']};_0x1f20ab();})[_0x9f2f('0x43')](function(_0x8959d8){_0x1f20ab(_0x8959d8);});}else if(_[_0x9f2f('0x48')](_0x18a359[_0x9f2f('0x45')][_0x9f2f('0x49')],_0x9f2f('0x4a'))){validateJwt(_0x18a359,_0x1198ea,_0x1f20ab);}else{if(_0x2030f1){_0x1f20ab();}else{return _0x1198ea[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x18a359[_0x9f2f('0x3c')][_0x9f2f('0x4b')]){try{var _0x5e9457={'audience':hardwareConf[_0x9f2f('0x4c')](),'issuer':hardwareConf[_0x9f2f('0x4c')]()};verifyJwt(_0x18a359[_0x9f2f('0x3c')][_0x9f2f('0x4b')],_0x5e9457)[_0x9f2f('0x3b')](function(_0x4963d1){return db['User'][_0x9f2f('0x4d')]({'where':{'id':_0x4963d1['sub']}})[_0x9f2f('0x3b')](function(_0x53beba){_0x2670d7=_0x53beba;return db[_0x9f2f('0x4e')][_0x9f2f('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9f2f('0x4f')],'raw':!![]});})[_0x9f2f('0x3b')](function(_0x250c8f){if(!_0x2670d7||!_['isEqual'](_0x2670d7['apiKeyNonce'],_0x4963d1[_0x9f2f('0x50')])){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2670d7[_0x9f2f('0x51')]){return _0x1198ea[_0x9f2f('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2670d7['blocked']){if(_0x250c8f[_0x9f2f('0x4f')]>0x0){if(moment(_0x2670d7[_0x9f2f('0x52')])[_0x9f2f('0x53')](_0x250c8f[_0x9f2f('0x4f')],_0x9f2f('0x54'))>moment()){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x18a359[_0x9f2f('0x36')]={'id':_0x2670d7['id']};_0x1f20ab();});})[_0x9f2f('0x43')](function(){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':_0x9f2f('0x55')});});}catch(_0x5d2f59){_0x1f20ab(_0x5d2f59);}}else if(_0x2030f1){_0x1f20ab();}else{return _0x1198ea[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':_0x9f2f('0x56')});}})[_0x9f2f('0x44')](function(_0x4c92fe,_0x98d034,_0xfa67ee){if(_0x4c92fe['user']){db['User'][_0x9f2f('0x4d')]({'where':{'id':_0x4c92fe[_0x9f2f('0x36')]['id']},'attributes':userAttributes})['then'](function(_0x47c93b){if(!_0x47c93b){return _0x98d034['status'](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x57')});}_0x4c92fe[_0x9f2f('0x36')]=_0x47c93b;_0xfa67ee();})[_0x9f2f('0x43')](function(_0x2a8072){_0xfa67ee(_0x2a8072);});}else if(_0x2030f1){_0xfa67ee();}else{return _0x98d034[_0x9f2f('0x3e')](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x58')});}});};exports[_0x9f2f('0x59')]=function canUpdate(){return compose()[_0x9f2f('0x44')](function(_0x452e88,_0x28b5c5,_0x5ad3d4){return licenseUtil[_0x9f2f('0x5a')]()[_0x9f2f('0x3b')](function(_0x2296ee){if(_0x2296ee[_0x9f2f('0x5b')]){_0x5ad3d4();}else{return _0x28b5c5[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':_0x9f2f('0x5c')});}})[_0x9f2f('0x43')](function(_0x25898b){_0x5ad3d4(_0x25898b);});});};exports[_0x9f2f('0x5d')]=function isWebrtcLicence(){return compose()[_0x9f2f('0x44')](function(_0x50073c,_0x29303a,_0x53d7ff){return licenseUtil[_0x9f2f('0x5a')]()[_0x9f2f('0x3b')](function(_0xea6c4b){if(_0xea6c4b[_0x9f2f('0x5e')]){_0x53d7ff();}else{return _0x29303a['status'](0x193)['json']({'message':_0x9f2f('0x5c')});}})[_0x9f2f('0x43')](function(_0x5e025e){_0x53d7ff(_0x5e025e);});});};exports[_0x9f2f('0x5f')]=function(_0x267d56,_0x4903b6,_0x1e0656){_0x267d56[_0x9f2f('0x5f')]=!![];return _0x1e0656();};exports[_0x9f2f('0x60')]=function signToken(_0x3b2812){return signJwt(_0x3b2812);};exports[_0x9f2f('0x61')]=function(_0x409178,_0x5b0fbe){if(!_0x409178[_0x9f2f('0x36')]){return _0x5b0fbe[_0x9f2f('0x3e')](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x62')});}var _0x10a2a0={'payload':{'id':_0x409178['user']['id'],'role':_0x409178[_0x9f2f('0x36')][_0x9f2f('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x10a2a0)[_0x9f2f('0x3b')](function(_0x5ab9d1){_0x5b0fbe[_0x9f2f('0x63')](_0x9f2f('0x64'),_0x5ab9d1);_0x5b0fbe[_0x9f2f('0x65')](_0x9f2f('0x66'));})['catch'](function(_0x1fb080){return _0x5b0fbe['status'](0x1f4)['send'](_0x1fb080);});};exports[_0x9f2f('0x67')]=function(_0x2f6949){if(_[_0x9f2f('0x68')](_0x2f6949[_0x9f2f('0x69')])||_['isNil'](_0x2f6949[_0x9f2f('0x6a')])){return null;}else{return createJwt(_0x2f6949);}};exports[_0x9f2f('0x6b')]=function(_0x226cb2){_0x226cb2['apiKeyNonce']=generateNonce();_0x226cb2[_0x9f2f('0x6a')]=generateIssuedAt();return createJwt(_0x226cb2);};exports[_0x9f2f('0x6c')]=function(_0x3878b8,_0x3e8df1){var _0x450751=_0x3878b8[_0x9f2f('0x3c')]['apikey'];if(_0x450751){var _0x28d29e={'nonce':_0x3e8df1['apiKeyNonce'],'iat':_0x3e8df1[_0x9f2f('0x6a')],'audience':hardwareConf[_0x9f2f('0x4c')](),'issuer':hardwareConf[_0x9f2f('0x4c')]()};return verifyJwt(_0x450751,_0x28d29e)['then'](function(){return generateApiKey(_0x3e8df1);});}else{throw{'message':_0x9f2f('0x6d')};}};exports[_0x9f2f('0x6e')]=function(_0x1702b5){var _0x4f2811=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4f2811['test'](_0x1702b5))throw new db[(_0x9f2f('0x6f'))][(_0x9f2f('0x70'))](_0x9f2f('0x71'));return;};exports[_0x9f2f('0x72')]=function(_0x51c074,_0x35fd02,_0x28b452){var _0x3d2a58=encryptor['decryptString'](_0x35fd02)[_0x9f2f('0x73')](',');for(var _0x35447f=0x0;_0x35447f<_0x28b452;_0x35447f++){if(!_0x3d2a58[_0x35447f])break;if(_0x51c074[_0x9f2f('0x74')]()===_0x3d2a58[_0x35447f][_0x9f2f('0x74')]()){var _0x4c49ae=util[_0x9f2f('0x75')](_0x9f2f('0x76'),_0x28b452);if(_0x28b452===0x1){_0x4c49ae=_0x9f2f('0x77');}throw new db[(_0x9f2f('0x6f'))][(_0x9f2f('0x70'))](_0x4c49ae);}}return;};exports[_0x9f2f('0x78')]=function(_0x2b08b5,_0x423200){var _0xd2abf5=_0x423200?encryptor[_0x9f2f('0x79')](_0x423200)[_0x9f2f('0x73')](','):[];if(_0xd2abf5['length']===0x5){_0xd2abf5[_0x9f2f('0x7a')](-0x1,0x1);}_0xd2abf5['unshift'](_0x2b08b5);return encryptor['encryptString'](_0xd2abf5[_0x9f2f('0x7b')](','));};function signJwt(_0x47b2d6){var _0x4e3fbb=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x31422c=_0x47b2d6['secret']||config['secrets']['session'];return new BPromise(function(_0x563271,_0x29351e){_0x4e3fbb(_0x47b2d6[_0x9f2f('0x7c')],_0x31422c,_0x47b2d6['options'])[_0x9f2f('0x3b')](function(_0x60139e){_0x563271(_0x60139e);})[_0x9f2f('0x43')](function(_0x5cd809){_0x29351e(_0x5cd809);});});}function verifyJwt(_0x4ca60b,_0x28d278,_0x31a7f1){var _0x537d8f=BPromise[_0x9f2f('0x7d')](jwt[_0x9f2f('0x7e')],{'context':jwt});var _0x34a24a=_0x31a7f1||config[_0x9f2f('0x8')]['session'];return new BPromise(function(_0x2d1fb5,_0x35d211){_0x537d8f(_0x4ca60b,_0x34a24a,_0x28d278)[_0x9f2f('0x3b')](function(_0x2577f7){_0x2d1fb5(_0x2577f7);})['catch'](function(_0x491f77){_0x35d211(_0x491f77);});});}function generateNonce(){return crypto[_0x9f2f('0x7f')](0x10)[_0x9f2f('0x80')](_0x9f2f('0x81'));}function generateIssuedAt(){return Math['floor'](Date[_0x9f2f('0x82')]()/0x3e8)[_0x9f2f('0x80')]();}function createJwt(_0x5b0529){var _0x35ce26={'payload':{'iat':_0x5b0529[_0x9f2f('0x6a')],'nonce':_0x5b0529['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x5b0529['id']['toString'](),'issuer':hardwareConf[_0x9f2f('0x4c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x35ce26)[_0x9f2f('0x3b')](function(_0x4d2b7e){return{'iat':_0x5b0529[_0x9f2f('0x6a')],'nonce':_0x5b0529[_0x9f2f('0x69')],'token':_0x4d2b7e};});} \ No newline at end of file +var _0x708f=['phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','then','forceDownload','status','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','getUuid','Setting','findOne','allowedLoginAttempts','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','apiKeyNonce','isNil','apiKeyIat','apikey','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','crypto','util','moment','secrets','session','role','name','internal','email','userpic','md5secret','mailPause','faxPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired'];(function(_0x26067b,_0xe01d0){var _0x4d4bfc=function(_0x360d96){while(--_0x360d96){_0x26067b['push'](_0x26067b['shift']());}};_0x4d4bfc(++_0xe01d0);}(_0x708f,0xe6));var _0xf708=function(_0x2fd200,_0x3e22b7){_0x2fd200=_0x2fd200-0x0;var _0x176d6e=_0x708f[_0x2fd200];return _0x176d6e;};'use strict';var db=require(_0xf708('0x0'))['db'];var config=require(_0xf708('0x1'));var hardwareConf=require(_0xf708('0x2'));var licenseUtil=require(_0xf708('0x3'));var encryptor=require(_0xf708('0x4'));var _=require(_0xf708('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xf708('0x6'));var basicAuth=require(_0xf708('0x7'));var crypto=require(_0xf708('0x8'));var BPromise=require('bluebird');var util=require(_0xf708('0x9'));var moment=require(_0xf708('0xa'));var validateJwt=expressJwt({'secret':config[_0xf708('0xb')][_0xf708('0xc')]});var userAttributes=['id',_0xf708('0xd'),'fullname',_0xf708('0xe'),_0xf708('0xf'),_0xf708('0x10'),_0xf708('0x11'),'permissions',_0xf708('0x12'),'voicePause','chatPause',_0xf708('0x13'),_0xf708('0x14'),'smsPause',_0xf708('0x15'),'pauseType',_0xf708('0x16'),_0xf708('0x17'),_0xf708('0x18'),_0xf708('0x19'),'allowmessenger','passwordResetAt','alias',_0xf708('0x1a'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xf708('0x1b'),_0xf708('0x1c'),'phoneBarEnableSettings','phoneBarExpires',_0xf708('0x1d'),_0xf708('0x1e'),_0xf708('0x1f'),_0xf708('0x20'),'interface','userProfileId',_0xf708('0x21'),_0xf708('0x22'),_0xf708('0x23'),'downloadVoiceRecordings',_0xf708('0x24'),'downloadAttachments',_0xf708('0x25'),'selectRecallMeCampaign',_0xf708('0x26'),_0xf708('0x27'),'emailAutoanswer',_0xf708('0x28'),_0xf708('0x29'),_0xf708('0x2a'),'openchannelAutoanswer',_0xf708('0x2b'),_0xf708('0x2c'),'faxAutoanswerDelay',_0xf708('0x2d'),_0xf708('0x2e'),_0xf708('0x2f')];exports[_0xf708('0x30')]=function(){return this[_0xf708('0x31')](!![])[_0xf708('0x32')](function(_0x46eae2,_0x525c79,_0x59942c){if(_0x46eae2[_0xf708('0x33')]){_0x59942c();}else{return db[_0xf708('0x34')]['findOne']({'where':{'id':_0x46eae2['params']['id']},'attributes':['id',_0xf708('0x35'),'disposition'],'raw':!![]})[_0xf708('0x36')](function(_0x232408){if(_0x232408&&_0x232408['closed']&&!_0x46eae2['query'][_0xf708('0x37')]){return _0x525c79[_0xf708('0x38')](_0x232408[_0xf708('0x39')]===_0xf708('0x3a')?0x195:0x193)[_0xf708('0x3b')]({'message':_0x232408['disposition']===_0xf708('0x3a')?'Unmanaged.':_0xf708('0x3c')});}else{_0x59942c();}})['catch'](function(_0x2d9d1b){_0x59942c(_0x2d9d1b);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc6a489){return compose()['use'](function(_0x152e9e,_0x1c863e,_0x239163){var _0x35c281;if(_0x152e9e[_0xf708('0x3d')][_0xf708('0x3e')]){if(_[_0xf708('0x3f')](_0x152e9e['headers'][_0xf708('0x3e')],_0xf708('0x40'))){var _0x11bbfc=basicAuth(_0x152e9e);db[_0xf708('0x41')][_0xf708('0x42')]({'where':{'name':_0x11bbfc[_0xf708('0xe')]}})['then'](function(_0x4d535e){if(!_0x4d535e||!_0x4d535e[_0xf708('0x43')](_0x11bbfc[_0xf708('0x44')])){return _0x1c863e['status'](0x191)[_0xf708('0x3b')]({'message':_0xf708('0x45')});}_0x152e9e[_0xf708('0x33')]={'id':_0x4d535e['id']};_0x239163();})[_0xf708('0x46')](function(_0x558ac7){_0x239163(_0x558ac7);});}else if(_['startsWith'](_0x152e9e[_0xf708('0x3d')]['authorization'],_0xf708('0x47'))){validateJwt(_0x152e9e,_0x1c863e,_0x239163);}else{if(_0xc6a489){_0x239163();}else{return _0x1c863e[_0xf708('0x38')](0x193)['json']({'message':_0xf708('0x48')});}}}else if(_0x152e9e[_0xf708('0x49')]['apikey']){try{var _0x1b898d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xf708('0x4a')]()};verifyJwt(_0x152e9e[_0xf708('0x49')]['apikey'],_0x1b898d)['then'](function(_0x34bba7){return db[_0xf708('0x41')][_0xf708('0x42')]({'where':{'id':_0x34bba7['sub']}})[_0xf708('0x36')](function(_0x1bd3ae){_0x35c281=_0x1bd3ae;return db[_0xf708('0x4b')][_0xf708('0x4c')]({'where':{'id':0x1},'attributes':[_0xf708('0x4d'),'blockDuration'],'raw':!![]});})[_0xf708('0x36')](function(_0x5e209e){if(!_0x35c281||!_[_0xf708('0x4e')](_0x35c281['apiKeyNonce'],_0x34bba7[_0xf708('0x4f')])){return _0x1c863e[_0xf708('0x38')](0x191)['json']({'message':_0xf708('0x50')});}if(_0x35c281[_0xf708('0x51')]){return _0x1c863e[_0xf708('0x38')](0x191)['json']({'message':_0xf708('0x52')});}if(_0x35c281[_0xf708('0x53')]){if(_0x5e209e[_0xf708('0x54')]>0x0){if(moment(_0x35c281[_0xf708('0x55')])['add'](_0x5e209e[_0xf708('0x54')],_0xf708('0x56'))>moment()){return _0x1c863e[_0xf708('0x38')](0x191)['json']({'message':_0xf708('0x52')});}}else{return _0x1c863e['status'](0x191)[_0xf708('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x152e9e[_0xf708('0x33')]={'id':_0x35c281['id']};_0x239163();});})[_0xf708('0x46')](function(){return _0x1c863e[_0xf708('0x38')](0x191)[_0xf708('0x3b')]({'message':_0xf708('0x52')});});}catch(_0x1ce4d0){_0x239163(_0x1ce4d0);}}else if(_0xc6a489){_0x239163();}else{return _0x1c863e[_0xf708('0x38')](0x193)[_0xf708('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf708('0x32')](function(_0x362e8e,_0x213c5c,_0xcb9ac7){if(_0x362e8e[_0xf708('0x33')]){db['User'][_0xf708('0x42')]({'where':{'id':_0x362e8e[_0xf708('0x33')]['id']},'attributes':userAttributes})['then'](function(_0x3409aa){if(!_0x3409aa){return _0x213c5c[_0xf708('0x38')](0x194)[_0xf708('0x3b')]({'message':_0xf708('0x57')});}_0x362e8e['user']=_0x3409aa;_0xcb9ac7();})[_0xf708('0x46')](function(_0x18d69d){_0xcb9ac7(_0x18d69d);});}else if(_0xc6a489){_0xcb9ac7();}else{return _0x213c5c[_0xf708('0x38')](0x194)[_0xf708('0x3b')]({'message':_0xf708('0x58')});}});};exports[_0xf708('0x59')]=function canUpdate(){return compose()[_0xf708('0x32')](function(_0xa196e7,_0x3694d3,_0x4b400d){return licenseUtil[_0xf708('0x5a')]()[_0xf708('0x36')](function(_0x1d0c42){if(_0x1d0c42[_0xf708('0x5b')]){_0x4b400d();}else{return _0x3694d3[_0xf708('0x38')](0x193)[_0xf708('0x3b')]({'message':_0xf708('0x5c')});}})[_0xf708('0x46')](function(_0x76c1bb){_0x4b400d(_0x76c1bb);});});};exports[_0xf708('0x5d')]=function isWebrtcLicence(){return compose()[_0xf708('0x32')](function(_0x14f1c6,_0x4568ff,_0x3c47ab){return licenseUtil[_0xf708('0x5a')]()[_0xf708('0x36')](function(_0x3d1420){if(_0x3d1420[_0xf708('0x5e')]){_0x3c47ab();}else{return _0x4568ff[_0xf708('0x38')](0x193)['json']({'message':_0xf708('0x5c')});}})[_0xf708('0x46')](function(_0x126c36){_0x3c47ab(_0x126c36);});});};exports['isMiddleware']=function(_0x27c046,_0x4ed918,_0x9ab91){_0x27c046[_0xf708('0x5f')]=!![];return _0x9ab91();};exports['signToken']=function signToken(_0x2e9fc5){return signJwt(_0x2e9fc5);};exports[_0xf708('0x60')]=function(_0x29032c,_0x27bc2f){if(!_0x29032c['user']){return _0x27bc2f[_0xf708('0x38')](0x194)[_0xf708('0x3b')]({'message':_0xf708('0x61')});}var _0x2e3299={'payload':{'id':_0x29032c['user']['id'],'role':_0x29032c[_0xf708('0x33')][_0xf708('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2e3299)[_0xf708('0x36')](function(_0x4ed55e){_0x27bc2f['cookie'](_0xf708('0x62'),_0x4ed55e);_0x27bc2f[_0xf708('0x63')](_0xf708('0x64'));})[_0xf708('0x46')](function(_0x289eb4){return _0x27bc2f[_0xf708('0x38')](0x1f4)[_0xf708('0x65')](_0x289eb4);});};exports['retrieveApiKey']=function(_0x560177){if(_['isNil'](_0x560177[_0xf708('0x66')])||_[_0xf708('0x67')](_0x560177[_0xf708('0x68')])){return null;}else{return createJwt(_0x560177);}};exports['generateApiKey']=function(_0x3ba162){_0x3ba162['apiKeyNonce']=generateNonce();_0x3ba162[_0xf708('0x68')]=generateIssuedAt();return createJwt(_0x3ba162);};exports['regenerateApiKey']=function(_0x4adad6,_0x4851a1){var _0x16f37c=_0x4adad6['query'][_0xf708('0x69')];if(_0x16f37c){var _0xb245b={'nonce':_0x4851a1['apiKeyNonce'],'iat':_0x4851a1[_0xf708('0x68')],'audience':hardwareConf[_0xf708('0x4a')](),'issuer':hardwareConf[_0xf708('0x4a')]()};return verifyJwt(_0x16f37c,_0xb245b)[_0xf708('0x36')](function(){return generateApiKey(_0x4851a1);});}else{throw{'message':_0xf708('0x6a')};}};exports[_0xf708('0x6b')]=function(_0x5b5031){var _0x2bf17f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2bf17f[_0xf708('0x6c')](_0x5b5031))throw new db['Sequelize']['ValidationError'](_0xf708('0x6d'));return;};exports[_0xf708('0x6e')]=function(_0x1e3462,_0xe2195c,_0x253e37){var _0x1e7e81=encryptor[_0xf708('0x6f')](_0xe2195c)[_0xf708('0x70')](',');for(var _0x384ad0=0x0;_0x384ad0<_0x253e37;_0x384ad0++){if(!_0x1e7e81[_0x384ad0])break;if(_0x1e3462[_0xf708('0x71')]()===_0x1e7e81[_0x384ad0][_0xf708('0x71')]()){var _0x584c30=util[_0xf708('0x72')](_0xf708('0x73'),_0x253e37);if(_0x253e37===0x1){_0x584c30='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xf708('0x74'))]['ValidationError'](_0x584c30);}}return;};exports[_0xf708('0x75')]=function(_0x2980df,_0x5be2e0){var _0x33325b=_0x5be2e0?encryptor[_0xf708('0x6f')](_0x5be2e0)['split'](','):[];if(_0x33325b['length']===0x5){_0x33325b[_0xf708('0x76')](-0x1,0x1);}_0x33325b[_0xf708('0x77')](_0x2980df);return encryptor[_0xf708('0x78')](_0x33325b[_0xf708('0x79')](','));};function signJwt(_0x27f22e){var _0xe45b7b=BPromise[_0xf708('0x7a')](jwt[_0xf708('0x7b')],{'context':jwt});var _0x696a3=_0x27f22e[_0xf708('0x7c')]||config[_0xf708('0xb')][_0xf708('0xc')];return new BPromise(function(_0x159e15,_0xb111d6){_0xe45b7b(_0x27f22e[_0xf708('0x7d')],_0x696a3,_0x27f22e[_0xf708('0x7e')])['then'](function(_0x22e911){_0x159e15(_0x22e911);})[_0xf708('0x46')](function(_0x509aa9){_0xb111d6(_0x509aa9);});});}function verifyJwt(_0x480abf,_0x383748,_0x522469){var _0x2737ba=BPromise[_0xf708('0x7a')](jwt['verify'],{'context':jwt});var _0x2582d2=_0x522469||config[_0xf708('0xb')][_0xf708('0xc')];return new BPromise(function(_0x593a84,_0x263553){_0x2737ba(_0x480abf,_0x2582d2,_0x383748)[_0xf708('0x36')](function(_0x377923){_0x593a84(_0x377923);})['catch'](function(_0x489176){_0x263553(_0x489176);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf708('0x7f')](_0xf708('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0xf708('0x81')]()/0x3e8)['toString']();}function createJwt(_0x21f825){var _0x1fbd1d={'payload':{'iat':_0x21f825[_0xf708('0x68')],'nonce':_0x21f825['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x21f825['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xf708('0x4a')]()}};return signJwt(_0x1fbd1d)[_0xf708('0x36')](function(_0x1a9c8b){return{'iat':_0x21f825[_0xf708('0x68')],'nonce':_0x21f825[_0xf708('0x66')],'token':_0x1a9c8b};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b94f9c0..1414646 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a38=['default','fields','user','clause','checkListsRestrictions','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','filter','startsWith','CmCustomField','slice','all','length','cf_','fieldType','map','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','search','parseQueryParameters','where'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x0a38,0x139));var _0x80a3=function(_0x396cd1,_0x2eb368){_0x396cd1=_0x396cd1-0x0;var _0x59dd4a=_0x0a38[_0x396cd1];return _0x59dd4a;};'use strict';var _=require(_0x80a3('0x0'));var sqlUtils=require(_0x80a3('0x1'));var db=require(_0x80a3('0x2'))['db'];exports[_0x80a3('0x3')]=function(_0x5bf6c9,_0x46b4d7,_0xc5a584,_0x390dd1){var _0x56c3f5={'count':0x0,'rows':[]};var _0x4bf28e=sqlUtils[_0x80a3('0x4')](_0x46b4d7,_0x5bf6c9);if(_0x4bf28e){return Promise['resolve'](_0x56c3f5);}var _0x544dfd=sqlUtils[_0x80a3('0x5')]();var _0x1d8034={};var _0x924213=![];var _0x4269c5=![];return Promise[_0x80a3('0x6')]()[_0x80a3('0x7')](function(){if(_0x5bf6c9['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x5bf6c9[_0x80a3('0x8')],_0x390dd1);}else{return sqlUtils[_0x80a3('0x9')](_0x5bf6c9,_0x390dd1);}})[_0x80a3('0x7')](function(_0x142cc8){_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xb')]);_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xc')]);_0x544dfd[_0x80a3('0xa')](_0x142cc8['filter']);_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xd')][_0x80a3('0xe')]);_0x1d8034=_0x142cc8['tags'];_0x4269c5=_0x142cc8[_0x80a3('0xd')]['skip'];return sqlUtils[_0x80a3('0xf')](_0x46b4d7,_0x5bf6c9,_0x4269c5);})[_0x80a3('0x7')](function(_0x2fc89d){_0x544dfd['where'](_0x2fc89d);var _0x50517b=_0x5bf6c9[_0x80a3('0x8')]?_0x1d8034['ids']:_0x5bf6c9[_0x80a3('0x10')];_0x924213=_0x50517b?!![]:![];return sqlUtils[_0x80a3('0x11')](_0x544dfd,_0x50517b);})[_0x80a3('0x7')](function(_0x245867){_0x56c3f5[_0x80a3('0x12')]=_0x245867;if(_0x56c3f5[_0x80a3('0x12')]===0x0){return;}if(_0x5bf6c9['User']){_0x4269c5=!![];}return sqlUtils[_0x80a3('0x13')](_0x544dfd,_0x5bf6c9[_0x80a3('0xc')],_0xc5a584,_0x924213,_0x1d8034[_0x80a3('0xe')],_0x4269c5);})[_0x80a3('0x7')](function(_0x549309){if(!_0x549309){return[];}return sqlUtils[_0x80a3('0x14')](_0x549309,_0x5bf6c9,_0xc5a584);})[_0x80a3('0x7')](function(_0x3cfee5){_0x56c3f5[_0x80a3('0x15')]=_0x3cfee5;return _0x56c3f5;})[_0x80a3('0x16')](function(_0x2a1231){throw _0x2a1231;});};exports[_0x80a3('0x17')]=function(){var _0x17a669={};var _0x1ae810=[];return db[_0x80a3('0x18')][_0x80a3('0x17')]()[_0x80a3('0x7')](function(_0x591456){_0x17a669=_0x591456;var _0xc0b73b=Object[_0x80a3('0x19')](_0x17a669)[_0x80a3('0x1a')](function(_0x1e261f){return _[_0x80a3('0x1b')](_0x1e261f,'cf_')?_0x1e261f:undefined;});var _0x2d4c44=_0xc0b73b['map'](function(_0x4c1805){return db[_0x80a3('0x1c')]['findOne']({'where':{'id':_0x4c1805[_0x80a3('0x1d')](0x3)},'raw':!![]});});return Promise[_0x80a3('0x1e')](_0x2d4c44);})[_0x80a3('0x7')](function(_0x3d9af5){for(var _0x67ae9=0x0;_0x67ae9<_0x3d9af5[_0x80a3('0x1f')];_0x67ae9++){if(_0x3d9af5[_0x67ae9]){var _0x5f521a=_0x80a3('0x20')+_0x3d9af5[_0x67ae9]['id'];_0x17a669[_0x5f521a][_0x80a3('0x21')]=_0x3d9af5[_0x67ae9]['type'];}}_0x1ae810=_[_0x80a3('0x22')](Object['keys'](_0x17a669),function(_0x125c2d){return{'name':_0x125c2d,'type':_0x17a669[_0x125c2d][_0x80a3('0x23')]};});return _0x1ae810;})['catch'](function(_0xb17dc8){throw _0xb17dc8;});}; \ No newline at end of file +var _0xce5b=['cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','keys','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','describe','CmContact','startsWith'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xce5b,0x1df));var _0xbce5=function(_0xa8f020,_0x487d50){_0xa8f020=_0xa8f020-0x0;var _0x128edc=_0xce5b[_0xa8f020];return _0x128edc;};'use strict';var _=require(_0xbce5('0x0'));var sqlUtils=require(_0xbce5('0x1'));var db=require(_0xbce5('0x2'))['db'];exports[_0xbce5('0x3')]=function(_0x403125,_0x449cb2,_0x31361a,_0x5da181){var _0x186a0f={'count':0x0,'rows':[]};var _0x4ce579=sqlUtils[_0xbce5('0x4')](_0x449cb2,_0x403125);if(_0x4ce579){return Promise[_0xbce5('0x5')](_0x186a0f);}var _0x76b015=sqlUtils[_0xbce5('0x6')]();var _0x2362db={};var _0xfab73=![];var _0x8a5ab8=![];return Promise[_0xbce5('0x5')]()['then'](function(){if(_0x403125[_0xbce5('0x7')]){return sqlUtils[_0xbce5('0x8')](_0x403125[_0xbce5('0x7')],_0x5da181);}else{return sqlUtils[_0xbce5('0x9')](_0x403125,_0x5da181);}})[_0xbce5('0xa')](function(_0x18dc31){_0x76b015[_0xbce5('0xb')](_0x18dc31[_0xbce5('0xc')]);_0x76b015['where'](_0x18dc31[_0xbce5('0xd')]);_0x76b015[_0xbce5('0xb')](_0x18dc31[_0xbce5('0xe')]);_0x76b015[_0xbce5('0xb')](_0x18dc31[_0xbce5('0xf')][_0xbce5('0x10')]);_0x2362db=_0x18dc31[_0xbce5('0x11')];_0x8a5ab8=_0x18dc31[_0xbce5('0xf')][_0xbce5('0x12')];return sqlUtils[_0xbce5('0x13')](_0x449cb2,_0x403125,_0x8a5ab8);})[_0xbce5('0xa')](function(_0x1fa493){_0x76b015[_0xbce5('0xb')](_0x1fa493);var _0xb718c7=_0x403125[_0xbce5('0x7')]?_0x2362db['ids']:_0x403125['tag'];_0xfab73=_0xb718c7?!![]:![];return sqlUtils[_0xbce5('0x14')](_0x76b015,_0xb718c7);})[_0xbce5('0xa')](function(_0xb954e4){_0x186a0f[_0xbce5('0x15')]=_0xb954e4;if(_0x186a0f[_0xbce5('0x15')]===0x0){return;}if(_0x403125['User']){_0x8a5ab8=!![];}return sqlUtils[_0xbce5('0x16')](_0x76b015,_0x403125['fields'],_0x31361a,_0xfab73,_0x2362db[_0xbce5('0x10')],_0x8a5ab8);})[_0xbce5('0xa')](function(_0x427987){if(!_0x427987){return[];}return sqlUtils[_0xbce5('0x17')](_0x427987,_0x403125,_0x31361a);})[_0xbce5('0xa')](function(_0xb5714a){_0x186a0f[_0xbce5('0x18')]=_0xb5714a;return _0x186a0f;})['catch'](function(_0x3d6f6e){throw _0x3d6f6e;});};exports[_0xbce5('0x19')]=function(){var _0xac9ea5={};var _0x455e72=[];return db[_0xbce5('0x1a')][_0xbce5('0x19')]()[_0xbce5('0xa')](function(_0x3c4062){_0xac9ea5=_0x3c4062;var _0x39f389=Object['keys'](_0xac9ea5)['filter'](function(_0x529da0){return _[_0xbce5('0x1b')](_0x529da0,_0xbce5('0x1c'))?_0x529da0:undefined;});var _0x52a2d9=_0x39f389[_0xbce5('0x1d')](function(_0x3f4f5b){return db[_0xbce5('0x1e')][_0xbce5('0x1f')]({'where':{'id':_0x3f4f5b[_0xbce5('0x20')](0x3)},'raw':!![]});});return Promise[_0xbce5('0x21')](_0x52a2d9);})[_0xbce5('0xa')](function(_0x5af7d6){for(var _0x591b0d=0x0;_0x591b0d<_0x5af7d6[_0xbce5('0x22')];_0x591b0d++){if(_0x5af7d6[_0x591b0d]){var _0x961cfc=_0xbce5('0x1c')+_0x5af7d6[_0x591b0d]['id'];_0xac9ea5[_0x961cfc][_0xbce5('0x23')]=_0x5af7d6[_0x591b0d][_0xbce5('0x24')];}}_0x455e72=_['map'](Object[_0xbce5('0x25')](_0xac9ea5),function(_0x1cc996){return{'name':_0x1cc996,'type':_0xac9ea5[_0x1cc996][_0xbce5('0x24')]};});return _0x455e72;})[_0xbce5('0x26')](function(_0x19dc94){throw _0x19dc94;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index c9b7f69..b14127d 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d85=['c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','value','end','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','map','some','Contact','ListId','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','limit','offset','subqry.id','order','subqry.','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','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'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7d85,0xb4));var _0x57d8=function(_0x50dc6c,_0x2de62c){_0x50dc6c=_0x50dc6c-0x0;var _0x392e67=_0x7d85[_0x50dc6c];return _0x392e67;};'use strict';var _=require(_0x57d8('0x0'));var squel=require(_0x57d8('0x1'));var as=require(_0x57d8('0x2'));var qs=require(_0x57d8('0x3'));var utils=require(_0x57d8('0x4'));var db=require(_0x57d8('0x5'))['db'];function skipContactsQuery(_0x47ea70,_0x4d0443){var _0x5631c0=![];if(_0x47ea70['role']===_0x57d8('0x6')&&!_0x4d0443[_0x57d8('0x7')]&&!_0x4d0443['ListId']&&_0x4d0443[_0x57d8('0x8')]!==_0x57d8('0x9')){_0x5631c0=!![];}return _0x5631c0;}function getContactsSubquery(){return squel['select']()[_0x57d8('0xa')](_0x57d8('0xb'),'c')[_0x57d8('0xc')](_0x57d8('0xd'));}function applyJoinClauses(_0x503163,_0x4f7b91){var _0x39d480=_0x4f7b91?'c':_0x57d8('0xe');_0x503163[_0x57d8('0xf')](_0x57d8('0x10'),'uc',_0x57d8('0x11')+_0x39d480+_0x57d8('0x12'))['left_join'](_0x57d8('0x13'),'ct',_0x57d8('0x14')+_0x39d480+_0x57d8('0x12'))[_0x57d8('0xf')](_0x57d8('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x503163;}function addFieldsToQuery(_0xe824fc,_0x39b462,_0x3afe94,_0x53e6d4,_0x3f8f58){var _0x2551bf=_0x3f8f58?'c':'subqry';if(!_0x39b462){_0x39b462=['id',_0x57d8('0x16'),'lastName','phone',_0x57d8('0x17'),_0x57d8('0x18'),_0x57d8('0x19'),'ListId',_0x57d8('0x1a'),_0x57d8('0x1b'),_0x57d8('0x1c'),_0x57d8('0x1d'),_0x57d8('0x1e')];}else if(!_0x39b462[_0x57d8('0x1f')]('id')){_0x39b462[_0x57d8('0x20')]('id');}var _0x275d4c=_0x3afe94&&_0x3f8f58||!_0x3afe94&&!_0x3f8f58;if(_0x53e6d4){_0x275d4c=_0x53e6d4&&_0x3f8f58||!_0x53e6d4&&!_0x3f8f58;}_0x39b462[_0x57d8('0x21')](function(_0x5843c3){if(_0x5843c3===_0x57d8('0x1e')){if(_0x275d4c){_0xe824fc[_0x57d8('0x22')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5843c3);}else if(_0x3afe94||_0x53e6d4){_0xe824fc[_0x57d8('0x22')](_0x2551bf+'.'+_0x5843c3);}}else{_0xe824fc[_0x57d8('0x22')](_0x2551bf+'.'+_0x5843c3);}});return _0xe824fc;}function getSqlClauses(){var _0x185864={'default':squel[_0x57d8('0x23')](),'fields':squel[_0x57d8('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x57d8('0x23')](),'ids':null},'user':{'clause':squel[_0x57d8('0x23')](),'skip':![]}};return _0x185864;}function parseTagParameter(_0x39539b){var _0x43c7a1=squel[_0x57d8('0x23')]();if(_0x39539b){var _0x222e49=utils[_0x57d8('0x24')](_0x39539b);_0x222e49[_0x57d8('0x21')](function(_0x352592){_0x43c7a1['or'](_0x57d8('0x25'),'%,'+_0x352592+',%');});}return _0x43c7a1;}function parseSearchFilter(_0x4e136b){var _0x1bd654=squel[_0x57d8('0x23')]();if(_0x4e136b){var _0x2f3f7b=_0x4e136b[_0x57d8('0x26')]('\x5c','\x5c\x5c')[_0x57d8('0x26')](/'/g,'\x27\x27');if(_0x2f3f7b[_0x57d8('0x27')]('\x20')[_0x57d8('0x28')]>0x1){_0x1bd654['or'](_0x57d8('0x29'),qs[_0x57d8('0x2a')](_0x2f3f7b,!![]),null);}else{if(qs[_0x57d8('0x2b')](_0x2f3f7b)){_0x1bd654['or'](_0x57d8('0x2c'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2d'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2e'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2f'),_0x2f3f7b+'%');}else if(qs['isEmail'](_0x2f3f7b)){_0x1bd654['or'](_0x57d8('0x30'),_0x2f3f7b+'%');}else{_0x1bd654['or'](_0x57d8('0x31'),'%'+_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x32'),'%'+_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x30'),'%'+_0x2f3f7b+'%');}}}return _0x1bd654;}function parseAdvancedSearchFilter(_0x524880,_0x266cd0){var _0x175e64=getSqlClauses();var _0x339b1e=as['parseSearch'](_0x524880);var _0x27c3d5=_0x339b1e[_0x57d8('0x33')];for(var _0x8c5f71=0x0;_0x8c5f71<_0x339b1e[_0x57d8('0x34')][_0x57d8('0x28')];_0x8c5f71++){var _0x2cd5d6=_0x339b1e[_0x57d8('0x34')][_0x8c5f71];var _0x5a66da='c';var _0x3b98e5=_['find'](_0x266cd0,[_0x57d8('0x35'),_0x2cd5d6[_0x57d8('0x22')]]);if(_0x3b98e5){if(_0x2cd5d6[_0x57d8('0x22')]===_0x57d8('0x36')||_0x3b98e5[_0x57d8('0x37')]===_0x57d8('0x38')){_0x2cd5d6[_0x57d8('0x39')]=_0x57d8('0x3a');}var _0x18d747=as['buildExpression'](_0x5a66da,_0x3b98e5[_0x57d8('0x3b')],_0x2cd5d6);_0x175e64[_0x57d8('0x3c')][_0x27c3d5](_0x18d747['text'],_0x18d747[_0x57d8('0x3d')]['start'],_0x18d747[_0x57d8('0x3d')][_0x57d8('0x3e')]);}else{if(_0x2cd5d6[_0x57d8('0x22')]==='Tag'){var _0x5b7fa6=_0x2cd5d6[_0x57d8('0x3d')][_0x57d8('0x27')](',')['map'](function(_0x218839){return Number(_0x218839);});var _0x54436b=parseTagParameter(_0x5b7fa6);_0x175e64[_0x57d8('0x3f')][_0x57d8('0x40')][_0x57d8('0x41')](_0x54436b);_0x175e64[_0x57d8('0x3f')][_0x57d8('0x42')]=_0x5b7fa6;}else if(_0x2cd5d6[_0x57d8('0x22')]===_0x57d8('0x43')){_0x175e64[_0x57d8('0x44')]['clause'][_0x57d8('0x41')](_0x57d8('0x45'),_0x2cd5d6['value']);_0x175e64[_0x57d8('0x44')][_0x57d8('0x46')]=!![];}}}return _0x175e64;}function parseModelFields(_0x30e69e,_0x2e1852){var _0x52abb1=squel[_0x57d8('0x23')]();var _0x5c4ba7=_(_0x30e69e)[_0x57d8('0x47')]()[_0x57d8('0x48')](function(_0x597403){return _[_0x57d8('0x49')](_0x2e1852,[_0x57d8('0x35'),_0x597403])?_0x597403:undefined;})['compact']()['value']();if(_0x30e69e['Contact']){_0x5c4ba7['push'](_0x57d8('0x4a'));}if(_0x30e69e['User']){_0x5c4ba7['push'](_0x57d8('0x43'));}if(_0x5c4ba7[_0x57d8('0x28')]>0x0){_0x5c4ba7['forEach'](function(_0x4b8241){if(_0x4b8241===_0x57d8('0x4b')){_0x52abb1[_0x57d8('0x41')](_0x57d8('0x4c'),[]['concat'](_0x30e69e[_0x4b8241]));}else if(_0x4b8241===_0x57d8('0x4a')){var _0x26adbe='%'+_0x30e69e[_0x4b8241]+'%';_0x52abb1[_0x57d8('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x26adbe);}else if(_0x4b8241==='User'){_0x52abb1[_0x57d8('0x41')](_0x57d8('0x45'),_0x30e69e[_0x4b8241]);}else{_0x52abb1[_0x57d8('0x41')]('c.'+_0x4b8241+_0x57d8('0x4d'),_0x30e69e[_0x4b8241]);}});}return _0x52abb1;}function parseQueryParameters(_0x3ac976,_0x4a6388){var _0x1998a7=getSqlClauses();return Promise[_0x57d8('0x4e')]()['then'](function(){return parseModelFields(_0x3ac976,_0x4a6388);})[_0x57d8('0x4f')](function(_0xe53ff4){_0x1998a7[_0x57d8('0x50')][_0x57d8('0x41')](_0xe53ff4);return parseTagParameter(_0x3ac976[_0x57d8('0x51')]);})[_0x57d8('0x4f')](function(_0x3f6740){_0x1998a7[_0x57d8('0x3f')]['clause'][_0x57d8('0x41')](_0x3f6740);return parseSearchFilter(_0x3ac976[_0x57d8('0x52')]);})[_0x57d8('0x4f')](function(_0x18e410){_0x1998a7[_0x57d8('0x52')]=_0x18e410;return _0x1998a7;});}function checkListsRestrictions(_0x619ecf,_0x54a746,_0x2efdc7){var _0x569212=squel[_0x57d8('0x23')]();return Promise[_0x57d8('0x4e')]()[_0x57d8('0x4f')](function(){if(_0x54a746[_0x57d8('0x7')]&&_0x619ecf['role']===_0x57d8('0x6')&&!_0x2efdc7){return _0x619ecf[_0x57d8('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x57d8('0x4f')](function(_0x11fcb5){if(_0x11fcb5){if(_0x11fcb5[_0x57d8('0x28')]===0x0){_0x569212[_0x57d8('0x41')](_0x57d8('0x54'));}else{_0x569212['and']('c.ListId\x20IN\x20?',_[_0x57d8('0x48')](_0x11fcb5,'id'));}}})[_0x57d8('0x4f')](function(){return _0x569212;});}function buildContactsQuery(_0x54053c,_0x2e3b04,_0x13fc0f,_0xc2cb17,_0x193bb6,_0x5994ce){if(_0x2e3b04){_0x2e3b04=_0x13fc0f[_0x57d8('0x55')];}_0x54053c=addFieldsToQuery(_0x54053c,_0x2e3b04,_0xc2cb17,_0x5994ce,!![]);var _0x574dd9=squel[_0x57d8('0x56')]();_0x574dd9=addFieldsToQuery(_0x574dd9,_0x2e3b04,_0xc2cb17,_0x5994ce,![]);if(_0xc2cb17||_0x5994ce){_0x54053c=applyJoinClauses(_0x54053c,!![]);_0x54053c[_0x57d8('0x57')]('c.id');if(_0x13fc0f['limit']){_0x574dd9['limit'](_0x13fc0f[_0x57d8('0x58')]);}if(_0x13fc0f[_0x57d8('0x59')]){_0x574dd9['offset'](_0x13fc0f['offset']);}}else{_0x574dd9=applyJoinClauses(_0x574dd9,![]);_0x574dd9[_0x57d8('0x57')](_0x57d8('0x5a'));if(_0x13fc0f[_0x57d8('0x58')]){_0x54053c['limit'](_0x13fc0f[_0x57d8('0x58')]);}if(_0x13fc0f[_0x57d8('0x59')]){_0x54053c[_0x57d8('0x59')](_0x13fc0f[_0x57d8('0x59')]);}}_0x574dd9['having'](_0x193bb6);if(_0x13fc0f[_0x57d8('0x5b')]){_0x13fc0f[_0x57d8('0x5b')]['forEach'](function(_0x3c7cfb){_0x54053c[_0x57d8('0x5b')]('c.'+_0x3c7cfb[0x0],_0x3c7cfb[0x1]==='DESC'?![]:!![]);_0x574dd9[_0x57d8('0x5b')](_0x57d8('0x5c')+_0x3c7cfb[0x0],_0x3c7cfb[0x1]===_0x57d8('0x5d')?![]:!![]);});}_0x574dd9[_0x57d8('0xa')](_0x54053c,_0x57d8('0xe'));return _0x574dd9;}function getFilteredContacts(_0x345de0){var _0x711419=[];return db[_0x57d8('0x5e')][_0x57d8('0x5f')]({'attributes':['id',_0x57d8('0x35'),_0x57d8('0x60')],'raw':!![]})[_0x57d8('0x4f')](function(_0x170808){_0x711419=_[_0x57d8('0x61')](_0x170808,'id');var _0x1b4335={'type':db[_0x57d8('0x62')]['QueryTypes'][_0x57d8('0x63')],'model':db[_0x57d8('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x57d8('0x65')][_0x57d8('0x66')](_0x345de0[_0x57d8('0x67')](),_0x1b4335);})[_0x57d8('0x4f')](function(_0x354ec1){_0x354ec1[_0x57d8('0x21')](function(_0x11ea0e){if(_0x11ea0e['TagIds']){_0x11ea0e[_0x57d8('0x68')]=[];_0x11ea0e[_0x57d8('0x1e')]['split'](',')[_0x57d8('0x21')](function(_0x240b4f){_0x11ea0e['Tags'][_0x57d8('0x20')](_0x711419[_0x240b4f]);});}delete _0x11ea0e[_0x57d8('0x1e')];});return _0x354ec1;});}function countFilteredContacts(_0x1a07c3,_0x1b4d5f){var _0x29ab63=_0x1a07c3[_0x57d8('0x69')]();_0x29ab63[_0x57d8('0x22')](_0x57d8('0x6a'));_0x29ab63=applyJoinClauses(_0x29ab63,!![]);_0x1a07c3[_0x57d8('0x57')](_0x57d8('0x6b'));var _0x1a2460=utils[_0x57d8('0x24')](_0x1b4d5f);if(!_[_0x57d8('0x6c')](_0x1a2460)){_0x29ab63[_0x57d8('0xc')](_0x57d8('0x6d'),_0x1a2460);}var _0x190ca6={'type':db['Sequelize'][_0x57d8('0x6e')][_0x57d8('0x63')],'raw':!![]};return db['sequelize']['query'](_0x29ab63[_0x57d8('0x67')](),_0x190ca6)[_0x57d8('0x4f')](function(_0x480c9b){return _0x480c9b[0x0]['COUNT(*)'];});}module[_0x57d8('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x58e5=['conditions','length','find','name','dateOfBirth','datetime','castTo','DATE','type','default','text','value','end','Tag','map','tags','and','ids','User','user','clause','uc.UserId\x20=\x20?','keys','some','compact','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','agent','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','toString','Tags','clone','isEmpty','where','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','ListId','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','subqry','firstName','lastName','phone','mobile','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','sqlOperator'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x58e5,0xa7));var _0x558e=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x58e5[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var squel=require(_0x558e('0x0'));var as=require(_0x558e('0x1'));var qs=require(_0x558e('0x2'));var utils=require(_0x558e('0x3'));var db=require(_0x558e('0x4'))['db'];function skipContactsQuery(_0x558570,_0x116569){var _0x93c185=![];if(_0x558570[_0x558e('0x5')]==='agent'&&!_0x116569['search']&&!_0x116569[_0x558e('0x6')]&&_0x116569['autocomplete']!==_0x558e('0x7')){_0x93c185=!![];}return _0x93c185;}function getContactsSubquery(){return squel[_0x558e('0x8')]()['from'](_0x558e('0x9'),'c')['where'](_0x558e('0xa'));}function applyJoinClauses(_0x2d47f0,_0x59f392){var _0x25da13=_0x59f392?'c':'subqry';_0x2d47f0[_0x558e('0xb')](_0x558e('0xc'),'uc','uc.CmContactId\x20=\x20'+_0x25da13+'.id')[_0x558e('0xb')](_0x558e('0xd'),'ct',_0x558e('0xe')+_0x25da13+_0x558e('0xf'))[_0x558e('0xb')](_0x558e('0x10'),'t','t.id\x20=\x20ct.TagId');return _0x2d47f0;}function addFieldsToQuery(_0x273427,_0x2cc9e7,_0x221564,_0x2a357f,_0x3e924c){var _0x49a274=_0x3e924c?'c':_0x558e('0x11');if(!_0x2cc9e7){_0x2cc9e7=['id',_0x558e('0x12'),_0x558e('0x13'),_0x558e('0x14'),_0x558e('0x15'),'fax','email',_0x558e('0x6'),_0x558e('0x16'),_0x558e('0x17'),_0x558e('0x18'),_0x558e('0x19'),_0x558e('0x1a')];}else if(!_0x2cc9e7['includes']('id')){_0x2cc9e7['push']('id');}var _0x4fb826=_0x221564&&_0x3e924c||!_0x221564&&!_0x3e924c;if(_0x2a357f){_0x4fb826=_0x2a357f&&_0x3e924c||!_0x2a357f&&!_0x3e924c;}_0x2cc9e7[_0x558e('0x1b')](function(_0x2ca1ef){if(_0x2ca1ef===_0x558e('0x1a')){if(_0x4fb826){_0x273427[_0x558e('0x1c')](_0x558e('0x1d'),_0x2ca1ef);}else if(_0x221564||_0x2a357f){_0x273427[_0x558e('0x1c')](_0x49a274+'.'+_0x2ca1ef);}}else{_0x273427[_0x558e('0x1c')](_0x49a274+'.'+_0x2ca1ef);}});return _0x273427;}function getSqlClauses(){var _0x224d8b={'default':squel[_0x558e('0x1e')](),'fields':squel[_0x558e('0x1e')](),'filter':squel[_0x558e('0x1e')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x224d8b;}function parseTagParameter(_0x5653e2){var _0x1a2de7=squel[_0x558e('0x1e')]();if(_0x5653e2){var _0x3113db=utils[_0x558e('0x1f')](_0x5653e2);_0x3113db[_0x558e('0x1b')](function(_0x37ca65){_0x1a2de7['or'](_0x558e('0x20'),'%,'+_0x37ca65+',%');});}return _0x1a2de7;}function parseSearchFilter(_0x168751){var _0x1be6dd=squel[_0x558e('0x1e')]();if(_0x168751){var _0x3f1807=_0x168751[_0x558e('0x21')]('\x5c','\x5c\x5c')[_0x558e('0x21')](/'/g,'\x27\x27');if(_0x3f1807[_0x558e('0x22')]('\x20')['length']>0x1){_0x1be6dd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x558e('0x23')](_0x3f1807,!![]),null);}else{if(qs[_0x558e('0x24')](_0x3f1807)){_0x1be6dd['or'](_0x558e('0x25'),_0x3f1807+'%');_0x1be6dd['or'](_0x558e('0x26'),_0x3f1807+'%');_0x1be6dd['or'](_0x558e('0x27'),_0x3f1807+'%');_0x1be6dd['or'](_0x558e('0x28'),_0x3f1807+'%');}else if(qs[_0x558e('0x29')](_0x3f1807)){_0x1be6dd['or'](_0x558e('0x2a'),_0x3f1807+'%');}else{_0x1be6dd['or'](_0x558e('0x2b'),'%'+_0x3f1807+'%');_0x1be6dd['or']('c.lastName\x20LIKE\x20?','%'+_0x3f1807+'%');_0x1be6dd['or'](_0x558e('0x2a'),'%'+_0x3f1807+'%');}}}return _0x1be6dd;}function parseAdvancedSearchFilter(_0x1a62ba,_0xc93520){var _0xc2fcd1=getSqlClauses();var _0x6159d8=as['parseSearch'](_0x1a62ba);var _0x915686=_0x6159d8[_0x558e('0x2c')];for(var _0x18e512=0x0;_0x18e512<_0x6159d8[_0x558e('0x2d')][_0x558e('0x2e')];_0x18e512++){var _0x3fffa2=_0x6159d8[_0x558e('0x2d')][_0x18e512];var _0x3eeec2='c';var _0x367de6=_[_0x558e('0x2f')](_0xc93520,[_0x558e('0x30'),_0x3fffa2[_0x558e('0x1c')]]);if(_0x367de6){if(_0x3fffa2[_0x558e('0x1c')]===_0x558e('0x31')||_0x367de6['fieldType']===_0x558e('0x32')){_0x3fffa2[_0x558e('0x33')]=_0x558e('0x34');}var _0x2ac6f5=as['buildExpression'](_0x3eeec2,_0x367de6[_0x558e('0x35')],_0x3fffa2);_0xc2fcd1[_0x558e('0x36')][_0x915686](_0x2ac6f5[_0x558e('0x37')],_0x2ac6f5[_0x558e('0x38')]['start'],_0x2ac6f5['value'][_0x558e('0x39')]);}else{if(_0x3fffa2[_0x558e('0x1c')]===_0x558e('0x3a')){var _0xc7b0c1=_0x3fffa2['value'][_0x558e('0x22')](',')[_0x558e('0x3b')](function(_0x1a61ea){return Number(_0x1a61ea);});var _0x49d154=parseTagParameter(_0xc7b0c1);_0xc2fcd1[_0x558e('0x3c')]['clause'][_0x558e('0x3d')](_0x49d154);_0xc2fcd1['tags'][_0x558e('0x3e')]=_0xc7b0c1;}else if(_0x3fffa2[_0x558e('0x1c')]===_0x558e('0x3f')){_0xc2fcd1[_0x558e('0x40')][_0x558e('0x41')]['and'](_0x558e('0x42'),_0x3fffa2['value']);_0xc2fcd1[_0x558e('0x40')]['skip']=!![];}}}return _0xc2fcd1;}function parseModelFields(_0x4ec1db,_0x39900f){var _0x3b1238=squel[_0x558e('0x1e')]();var _0x255cea=_(_0x4ec1db)[_0x558e('0x43')]()[_0x558e('0x3b')](function(_0x1f1f20){return _[_0x558e('0x44')](_0x39900f,[_0x558e('0x30'),_0x1f1f20])?_0x1f1f20:undefined;})[_0x558e('0x45')]()[_0x558e('0x38')]();if(_0x4ec1db['Contact']){_0x255cea['push'](_0x558e('0x46'));}if(_0x4ec1db['User']){_0x255cea[_0x558e('0x47')]('User');}if(_0x255cea[_0x558e('0x2e')]>0x0){_0x255cea['forEach'](function(_0x2fd0e0){if(_0x2fd0e0===_0x558e('0x6')){_0x3b1238[_0x558e('0x3d')]('c.ListId\x20IN\x20?',[][_0x558e('0x48')](_0x4ec1db[_0x2fd0e0]));}else if(_0x2fd0e0===_0x558e('0x46')){var _0x5671a4='%'+_0x4ec1db[_0x2fd0e0]+'%';_0x3b1238['and'](_0x558e('0x49'),_0x5671a4);}else if(_0x2fd0e0===_0x558e('0x3f')){_0x3b1238[_0x558e('0x3d')](_0x558e('0x42'),_0x4ec1db[_0x2fd0e0]);}else{_0x3b1238[_0x558e('0x3d')]('c.'+_0x2fd0e0+_0x558e('0x4a'),_0x4ec1db[_0x2fd0e0]);}});}return _0x3b1238;}function parseQueryParameters(_0x3f5382,_0x56a2aa){var _0x45b01c=getSqlClauses();return Promise[_0x558e('0x4b')]()[_0x558e('0x4c')](function(){return parseModelFields(_0x3f5382,_0x56a2aa);})['then'](function(_0x2538d1){_0x45b01c[_0x558e('0x4d')][_0x558e('0x3d')](_0x2538d1);return parseTagParameter(_0x3f5382[_0x558e('0x4e')]);})[_0x558e('0x4c')](function(_0xd31a9b){_0x45b01c[_0x558e('0x3c')][_0x558e('0x41')][_0x558e('0x3d')](_0xd31a9b);return parseSearchFilter(_0x3f5382[_0x558e('0x4f')]);})[_0x558e('0x4c')](function(_0x7533e7){_0x45b01c[_0x558e('0x4f')]=_0x7533e7;return _0x45b01c;});}function checkListsRestrictions(_0x28c87e,_0x1aee1b,_0x51c6db){var _0x3b1a15=squel[_0x558e('0x1e')]();return Promise[_0x558e('0x4b')]()['then'](function(){if(_0x1aee1b[_0x558e('0x50')]&&_0x28c87e[_0x558e('0x5')]===_0x558e('0x51')&&!_0x51c6db){return _0x28c87e['getLists']({'attributes':['id'],'raw':!![]});}})[_0x558e('0x4c')](function(_0x18ae51){if(_0x18ae51){if(_0x18ae51[_0x558e('0x2e')]===0x0){_0x3b1a15[_0x558e('0x3d')](_0x558e('0x52'));}else{_0x3b1a15[_0x558e('0x3d')]('c.ListId\x20IN\x20?',_['map'](_0x18ae51,'id'));}}})[_0x558e('0x4c')](function(){return _0x3b1a15;});}function buildContactsQuery(_0x2e727b,_0x5d5c3f,_0xfc5a3f,_0x1386a3,_0x317bf2,_0x1c4784){if(_0x5d5c3f){_0x5d5c3f=_0xfc5a3f[_0x558e('0x53')];}_0x2e727b=addFieldsToQuery(_0x2e727b,_0x5d5c3f,_0x1386a3,_0x1c4784,!![]);var _0x23c1e1=squel[_0x558e('0x8')]();_0x23c1e1=addFieldsToQuery(_0x23c1e1,_0x5d5c3f,_0x1386a3,_0x1c4784,![]);if(_0x1386a3||_0x1c4784){_0x2e727b=applyJoinClauses(_0x2e727b,!![]);_0x2e727b['group'](_0x558e('0x54'));if(_0xfc5a3f[_0x558e('0x55')]){_0x23c1e1[_0x558e('0x55')](_0xfc5a3f[_0x558e('0x55')]);}if(_0xfc5a3f[_0x558e('0x56')]){_0x23c1e1[_0x558e('0x56')](_0xfc5a3f['offset']);}}else{_0x23c1e1=applyJoinClauses(_0x23c1e1,![]);_0x23c1e1[_0x558e('0x57')]('subqry.id');if(_0xfc5a3f['limit']){_0x2e727b[_0x558e('0x55')](_0xfc5a3f['limit']);}if(_0xfc5a3f[_0x558e('0x56')]){_0x2e727b[_0x558e('0x56')](_0xfc5a3f[_0x558e('0x56')]);}}_0x23c1e1[_0x558e('0x58')](_0x317bf2);if(_0xfc5a3f[_0x558e('0x59')]){_0xfc5a3f[_0x558e('0x59')][_0x558e('0x1b')](function(_0x48c806){_0x2e727b[_0x558e('0x59')]('c.'+_0x48c806[0x0],_0x48c806[0x1]===_0x558e('0x5a')?![]:!![]);_0x23c1e1[_0x558e('0x59')](_0x558e('0x5b')+_0x48c806[0x0],_0x48c806[0x1]===_0x558e('0x5a')?![]:!![]);});}_0x23c1e1[_0x558e('0x5c')](_0x2e727b,_0x558e('0x11'));return _0x23c1e1;}function getFilteredContacts(_0x430356){var _0x50fc91=[];return db['Tag'][_0x558e('0x5d')]({'attributes':['id',_0x558e('0x30'),_0x558e('0x5e')],'raw':!![]})[_0x558e('0x4c')](function(_0x55daf0){_0x50fc91=_[_0x558e('0x5f')](_0x55daf0,'id');var _0x3d8771={'type':db[_0x558e('0x60')][_0x558e('0x61')][_0x558e('0x62')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize']['query'](_0x430356[_0x558e('0x63')](),_0x3d8771);})[_0x558e('0x4c')](function(_0x75f647){_0x75f647[_0x558e('0x1b')](function(_0x1ceeb3){if(_0x1ceeb3[_0x558e('0x1a')]){_0x1ceeb3[_0x558e('0x64')]=[];_0x1ceeb3[_0x558e('0x1a')][_0x558e('0x22')](',')[_0x558e('0x1b')](function(_0x45f369){_0x1ceeb3[_0x558e('0x64')][_0x558e('0x47')](_0x50fc91[_0x45f369]);});}delete _0x1ceeb3[_0x558e('0x1a')];});return _0x75f647;});}function countFilteredContacts(_0x28ea07,_0x4fc6cb){var _0x4385cc=_0x28ea07[_0x558e('0x65')]();_0x4385cc[_0x558e('0x1c')]('COUNT(*)');_0x4385cc=applyJoinClauses(_0x4385cc,!![]);_0x28ea07[_0x558e('0x57')](_0x558e('0x54'));var _0x3555de=utils['getSelectedTags'](_0x4fc6cb);if(!_[_0x558e('0x66')](_0x3555de)){_0x4385cc[_0x558e('0x67')](_0x558e('0x68'),_0x3555de);}var _0x5149b4={'type':db['Sequelize'][_0x558e('0x61')][_0x558e('0x62')],'raw':!![]};return db['sequelize']['query'](_0x4385cc[_0x558e('0x63')](),_0x5149b4)['then'](function(_0x5c8a95){return _0x5c8a95[0x0]['COUNT(*)'];});}module[_0x558e('0x69')]={'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 f3e1fe4..d5343b1 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 _0xc0d7=['update','binary','write','close','unlink','createDecipher','final','end','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data'];(function(_0x4ebbf9,_0x33921c){var _0x21cb48=function(_0x4d1008){while(--_0x4d1008){_0x4ebbf9['push'](_0x4ebbf9['shift']());}};_0x21cb48(++_0x33921c);}(_0xc0d7,0x1e1));var _0x7c0d=function(_0x108759,_0x48d8c4){_0x108759=_0x108759-0x0;var _0x229633=_0xc0d7[_0x108759];return _0x229633;};'use strict';var crypto=require(_0x7c0d('0x0'));var fs=require('fs');var BPromise=require(_0x7c0d('0x1'));var _=require(_0x7c0d('0x2'));var config=require(_0x7c0d('0x3'));var logger=require('../../config/logger')(_0x7c0d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7c0d('0x5')][_0x7c0d('0x6')],'algorithm':_0x7c0d('0x7')};const fileOptions={'algorithm':_0x7c0d('0x8')};if(config[_0x7c0d('0x9')]&&config[_0x7c0d('0x9')][_0x7c0d('0xa')]){var isSupported=isAlgorithmSupported(config[_0x7c0d('0x9')][_0x7c0d('0xa')]);if(isSupported){fileOptions[_0x7c0d('0xa')]=config[_0x7c0d('0x9')][_0x7c0d('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7c0d('0xb')](',\x20');logger[_0x7c0d('0xc')](config[_0x7c0d('0x9')][_0x7c0d('0xa')],_0x7c0d('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x2faca9){return AES_SUPPORTED_RX['test'](_0x2faca9);}function getSupportedCiphers(){return crypto[_0x7c0d('0xe')]()[_0x7c0d('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xd668d8){return getSupportedCiphers()[_0x7c0d('0x10')](_0xd668d8)>-0x1;}function combineOptions(_0x5ae6cf){var _0x4c53fb={};for(var _0xa31749 in fileOptions){if(fileOptions[_0x7c0d('0x11')](_0xa31749)){_0x4c53fb[_0xa31749]=fileOptions[_0xa31749];}}if(_0x5ae6cf){for(var _0x849bb1 in _0x5ae6cf){if(_0x5ae6cf['hasOwnProperty'](_0x849bb1)){_0x4c53fb[_0x849bb1]=_0x5ae6cf[_0x849bb1];}}}return _0x4c53fb;}exports[_0x7c0d('0x12')]=function(_0x4af857,_0x5a4abf,_0x4dcc95,_0x55f1e7){return new BPromise(function(_0x45feba,_0x377859){_0x55f1e7=combineOptions(_0x55f1e7);var _0x53eac3=new Buffer(_0x4dcc95);var _0x4cc8eb=fs[_0x7c0d('0x13')](_0x4af857);var _0x11ee52=fs[_0x7c0d('0x14')](_0x5a4abf);var _0x508f57=crypto[_0x7c0d('0x15')](_0x55f1e7[_0x7c0d('0xa')],_0x53eac3);_0x4cc8eb['on'](_0x7c0d('0x16'),function(_0x56cf54){var _0x5580da=new Buffer(_0x508f57[_0x7c0d('0x17')](_0x56cf54),_0x7c0d('0x18'));_0x11ee52[_0x7c0d('0x19')](_0x5580da);});_0x4cc8eb['on']('end',function(){try{var _0xd17ab4=new Buffer(_0x508f57['final'](_0x7c0d('0x18')),_0x7c0d('0x18'));_0x11ee52[_0x7c0d('0x19')](_0xd17ab4);_0x11ee52['end']();_0x11ee52['on'](_0x7c0d('0x1a'),function(){return _0x45feba(_0x5a4abf);});}catch(_0x219bf4){fs[_0x7c0d('0x1b')](_0x5a4abf);return _0x377859(_0x219bf4);}});});};exports['decryptFile']=function(_0x1d5fdf,_0x1bfd44,_0x2576b9,_0x1a36dc){return new BPromise(function(_0x297310,_0x5696a5){_0x1a36dc=combineOptions(_0x1a36dc);var _0x5abfc4=new Buffer(_0x2576b9);var _0x253768=fs[_0x7c0d('0x13')](_0x1d5fdf);var _0x3c8de6=fs['createWriteStream'](_0x1bfd44);var _0x189641=crypto[_0x7c0d('0x1c')](_0x1a36dc[_0x7c0d('0xa')],_0x5abfc4);_0x253768['on'](_0x7c0d('0x16'),function(_0x18fc7f){var _0x2b053a=new Buffer(_0x189641[_0x7c0d('0x17')](_0x18fc7f),_0x7c0d('0x18'));_0x3c8de6[_0x7c0d('0x19')](_0x2b053a);});_0x253768['on']('end',function(){try{var _0x1fe9e7=new Buffer(_0x189641[_0x7c0d('0x1d')](_0x7c0d('0x18')),_0x7c0d('0x18'));_0x3c8de6[_0x7c0d('0x19')](_0x1fe9e7);_0x3c8de6[_0x7c0d('0x1e')]();_0x3c8de6['on'](_0x7c0d('0x1a'),function(){return _0x297310(_0x1bfd44);});}catch(_0x20d998){fs[_0x7c0d('0x1b')](_0x1bfd44);return _0x5696a5(_0x20d998);}});});};exports[_0x7c0d('0x1f')]=function(_0x13aad4,_0x36348e,_0x3eb82b){var _0x7d1937=_0x3eb82b||stringOptions[_0x7c0d('0xa')];var _0x161dbf=_0x36348e||stringOptions[_0x7c0d('0x20')];var _0x3995c4=crypto[_0x7c0d('0x15')](_0x7d1937,_0x161dbf);var _0x55193a=_0x3995c4[_0x7c0d('0x17')](_0x13aad4,_0x7c0d('0x21'),_0x7c0d('0x22'));_0x55193a+=_0x3995c4['final'](_0x7c0d('0x22'));return _0x55193a;};exports[_0x7c0d('0x23')]=function(_0x3787c3,_0x31142d,_0x4c6ed5){var _0x16bfec=_0x4c6ed5||stringOptions[_0x7c0d('0xa')];var _0x4abacf=_0x31142d||stringOptions[_0x7c0d('0x20')];var _0x42de82=crypto['createDecipher'](_0x16bfec,_0x4abacf);var _0x18f68f=_0x42de82[_0x7c0d('0x17')](_0x3787c3,_0x7c0d('0x22'),'utf8');_0x18f68f+=_0x42de82[_0x7c0d('0x1d')]('utf8');return _0x18f68f;}; \ No newline at end of file +var _0x635a=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createDecipher','encryptString','utf8','base64','lodash','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x14c180,_0xdffe24){var _0x45620a=function(_0x3c7875){while(--_0x3c7875){_0x14c180['push'](_0x14c180['shift']());}};_0x45620a(++_0xdffe24);}(_0x635a,0x1ba));var _0xa635=function(_0xd4763d,_0x17db94){_0xd4763d=_0xd4763d-0x0;var _0x1a975c=_0x635a[_0xd4763d];return _0x1a975c;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xa635('0x0'));var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xa635('0x1')],'algorithm':_0xa635('0x2')};const fileOptions={'algorithm':_0xa635('0x3')};if(config['encrypt']&&config[_0xa635('0x4')][_0xa635('0x5')]){var isSupported=isAlgorithmSupported(config[_0xa635('0x4')][_0xa635('0x5')]);if(isSupported){fileOptions[_0xa635('0x5')]=config[_0xa635('0x4')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa635('0x6')](',\x20');logger[_0xa635('0x7')](config[_0xa635('0x4')][_0xa635('0x5')],_0xa635('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x47b93b){return AES_SUPPORTED_RX[_0xa635('0x9')](_0x47b93b);}function getSupportedCiphers(){return crypto[_0xa635('0xa')]()[_0xa635('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x1d3616){return getSupportedCiphers()[_0xa635('0xc')](_0x1d3616)>-0x1;}function combineOptions(_0x33d2d1){var _0x121e76={};for(var _0x53ae63 in fileOptions){if(fileOptions[_0xa635('0xd')](_0x53ae63)){_0x121e76[_0x53ae63]=fileOptions[_0x53ae63];}}if(_0x33d2d1){for(var _0x42aee2 in _0x33d2d1){if(_0x33d2d1[_0xa635('0xd')](_0x42aee2)){_0x121e76[_0x42aee2]=_0x33d2d1[_0x42aee2];}}}return _0x121e76;}exports[_0xa635('0xe')]=function(_0x304d5f,_0x90e9a,_0x31c504,_0x47ff8d){return new BPromise(function(_0x40188e,_0x20cec5){_0x47ff8d=combineOptions(_0x47ff8d);var _0x414e5c=new Buffer(_0x31c504);var _0x59daed=fs[_0xa635('0xf')](_0x304d5f);var _0x59d631=fs[_0xa635('0x10')](_0x90e9a);var _0x143e1c=crypto[_0xa635('0x11')](_0x47ff8d['algorithm'],_0x414e5c);_0x59daed['on'](_0xa635('0x12'),function(_0x5a9e52){var _0x53526f=new Buffer(_0x143e1c[_0xa635('0x13')](_0x5a9e52),_0xa635('0x14'));_0x59d631[_0xa635('0x15')](_0x53526f);});_0x59daed['on'](_0xa635('0x16'),function(){try{var _0x1fb4d1=new Buffer(_0x143e1c[_0xa635('0x17')]('binary'),_0xa635('0x14'));_0x59d631['write'](_0x1fb4d1);_0x59d631['end']();_0x59d631['on']('close',function(){return _0x40188e(_0x90e9a);});}catch(_0x4fee24){fs[_0xa635('0x18')](_0x90e9a);return _0x20cec5(_0x4fee24);}});});};exports[_0xa635('0x19')]=function(_0x515f62,_0x4b68c8,_0x4f990c,_0x4debef){return new BPromise(function(_0x57e624,_0x587850){_0x4debef=combineOptions(_0x4debef);var _0x58dba5=new Buffer(_0x4f990c);var _0x4dd0a8=fs[_0xa635('0xf')](_0x515f62);var _0x289de0=fs[_0xa635('0x10')](_0x4b68c8);var _0x327f64=crypto[_0xa635('0x1a')](_0x4debef['algorithm'],_0x58dba5);_0x4dd0a8['on']('data',function(_0x3bc555){var _0x227828=new Buffer(_0x327f64[_0xa635('0x13')](_0x3bc555),'binary');_0x289de0[_0xa635('0x15')](_0x227828);});_0x4dd0a8['on'](_0xa635('0x16'),function(){try{var _0x31066f=new Buffer(_0x327f64[_0xa635('0x17')](_0xa635('0x14')),_0xa635('0x14'));_0x289de0[_0xa635('0x15')](_0x31066f);_0x289de0['end']();_0x289de0['on']('close',function(){return _0x57e624(_0x4b68c8);});}catch(_0x27289a){fs[_0xa635('0x18')](_0x4b68c8);return _0x587850(_0x27289a);}});});};exports[_0xa635('0x1b')]=function(_0x244e7b,_0x13ac84,_0x373d31){var _0x59b89e=_0x373d31||stringOptions['algorithm'];var _0x39a447=_0x13ac84||stringOptions['secret'];var _0x5ac1b5=crypto[_0xa635('0x11')](_0x59b89e,_0x39a447);var _0x21a90a=_0x5ac1b5[_0xa635('0x13')](_0x244e7b,_0xa635('0x1c'),'base64');_0x21a90a+=_0x5ac1b5[_0xa635('0x17')](_0xa635('0x1d'));return _0x21a90a;};exports['decryptString']=function(_0x3c0247,_0x46e662,_0xbf30ad){var _0x35637a=_0xbf30ad||stringOptions[_0xa635('0x5')];var _0x1dfac7=_0x46e662||stringOptions['secret'];var _0x441097=crypto[_0xa635('0x1a')](_0x35637a,_0x1dfac7);var _0x206989=_0x441097[_0xa635('0x13')](_0x3c0247,_0xa635('0x1d'),_0xa635('0x1c'));_0x206989+=_0x441097[_0xa635('0x17')](_0xa635('0x1c'));return _0x206989;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 01e7ce9..ae51127 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 _0x4b59=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','length','join','mkdirSync','each','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','isInteger','push','SELECT'];(function(_0x4dcfbd,_0x10a2f8){var _0x12c261=function(_0x56420b){while(--_0x56420b){_0x4dcfbd['push'](_0x4dcfbd['shift']());}};_0x12c261(++_0x10a2f8);}(_0x4b59,0x1e6));var _0x94b5=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x4b59[_0x4ee9cd];return _0x328a5b;};'use strict';var util=require(_0x94b5('0x0'));var path=require(_0x94b5('0x1'));var _=require(_0x94b5('0x2'));var csv=require(_0x94b5('0x3'));var fs=require('fs');var BPromise=require(_0x94b5('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x94b5('0x5'))['db'];var dbH=require(_0x94b5('0x5'))[_0x94b5('0x6')];var logger=require(_0x94b5('0x7'))(_0x94b5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x94b5('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x287fe4,_0x4e395a){var _0xef9705={'status':_0x287fe4};var _0x1f7e6a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e395a){_0xef9705[_0x94b5('0xa')]=_0x4e395a;}return db[_0x94b5('0xb')][_0x94b5('0xc')](_0xef9705,_0x1f7e6a);}function main(){var _0x77edbc=0x1388;var _0x2e7ed4;logger[_0x94b5('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x94b5('0xe')));return db[_0x94b5('0xf')][_0x94b5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x94b5('0x11'),_0x94b5('0x12')]})[_0x94b5('0x13')](function(_0x32649f){if(_0x32649f){_0x2e7ed4=_0x32649f;_0x77edbc=_0x2e7ed4[_0x94b5('0x12')]||0x1388;}})[_0x94b5('0x13')](function(){return dbH[_0x94b5('0x14')][_0x94b5('0x15')](util[_0x94b5('0x16')](_0x94b5('0x17'),QUERY),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')]['SELECT']});})[_0x94b5('0x13')](function(_0x417e38){if(!_0x417e38[0x0][_0x94b5('0x19')]){return analyticExtractedReport(_0x94b5('0x1a'));}var _0x3f132b=[];var _0x5d6b7c=0x0;if(_0x2e7ed4['split']){if(_0x417e38&&_0x417e38['length']){var _0xb114b4=_[_0x94b5('0x1b')](_0x417e38[0x0]['num']/_0x77edbc);var _0x2ac96d=Number[_0x94b5('0x1c')](_0x417e38[0x0][_0x94b5('0x19')]/_0x77edbc)?_0x417e38[0x0][_0x94b5('0x19')]%_0x77edbc:0x0;_0xb114b4['forEach'](function(_0x39ce93){if(_0x39ce93>0x0){_0x5d6b7c+=_0x77edbc;}_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](util[_0x94b5('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x77edbc,_0x5d6b7c),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')][_0x94b5('0x1e')]}));});if(_0x2ac96d>0x0){_0x5d6b7c+=_0x77edbc;_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](util['format'](_0x94b5('0x1f'),QUERY,_0x2ac96d,_0x5d6b7c),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')]['SELECT']}));}}}else{_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](QUERY,{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')][_0x94b5('0x1e')]}));}var _0x487879=path[_0x94b5('0x20')](PATH);var _0x2c1d64=path['basename'](PATH,_0x94b5('0x21'));var _0xedd072=_0x2e7ed4[_0x94b5('0x11')]&&_0x3f132b[_0x94b5('0x22')]>0x1;var _0x546716=[];if(!fs['existsSync'](path[_0x94b5('0x23')](_0x487879,_0x2c1d64))&&_0xedd072){fs[_0x94b5('0x24')](path[_0x94b5('0x23')](_0x487879,_0x2c1d64));}return BPromise[_0x94b5('0x25')](_0x3f132b,function(_0xb2f71d){_0x546716[_0x94b5('0x1d')](_0xb2f71d);})['then'](function(){for(var _0xd6986d=0x0;_0xd6986d<_0x546716[_0x94b5('0x22')];_0xd6986d+=0x1){var _0x5a1b29;var _0x5bbf4e=_0x546716[_0xd6986d];if(_0xedd072){_0x5a1b29=path[_0x94b5('0x23')](_0x487879,_0x2c1d64,util['format']('%s%d.%s',_0x2c1d64,_0xd6986d,_0x94b5('0x26')));}else{_0x5a1b29=path['join'](_0x487879,util['format'](_0x94b5('0x27'),_0x2c1d64,_0x94b5('0x26')));}fs['writeFileSync'](_0x5a1b29,csv(_0x5bbf4e));}})[_0x94b5('0x13')](function(){if(_0xedd072){return new Promise(function(_0x4c92dc){zipdir(path[_0x94b5('0x23')](_0x487879,_0x2c1d64),{'saveTo':path[_0x94b5('0x23')](_0x487879,util['format']('%s.%s',_0x2c1d64,_0x94b5('0x28')))},function(_0x50c3ad,_0x445193){rimraf(path[_0x94b5('0x23')](_0x487879,_0x2c1d64),function(){});_0x4c92dc(_0x94b5('0x29'));});});}})[_0x94b5('0x13')](function(){logger[_0x94b5('0xd')](util['format'](_0x94b5('0x2a'),EXTRACTED_REPORT_ID,_0x94b5('0xe')));return analyticExtractedReport(_0x94b5('0x2b'),_0xedd072?util[_0x94b5('0x16')](_0x94b5('0x27'),_0x2c1d64,_0xedd072?_0x94b5('0x28'):_0x94b5('0x26')):null);});})['catch'](function(_0x11c6fc){logger['info'](util[_0x94b5('0x16')](_0x94b5('0x2c'),EXTRACTED_REPORT_ID,_0x94b5('0xe')),util[_0x94b5('0x2d')](_0x11c6fc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x94b5('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb0c9=['dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb'];(function(_0x4997d3,_0x22bf80){var _0x38fcc9=function(_0x3a9427){while(--_0x3a9427){_0x4997d3['push'](_0x4997d3['shift']());}};_0x38fcc9(++_0x22bf80);}(_0xb0c9,0x1bb));var _0x9b0c=function(_0x59e8c6,_0x847c24){_0x59e8c6=_0x59e8c6-0x0;var _0x4e6c5b=_0xb0c9[_0x59e8c6];return _0x4e6c5b;};'use strict';var util=require(_0x9b0c('0x0'));var path=require(_0x9b0c('0x1'));var _=require(_0x9b0c('0x2'));var csv=require(_0x9b0c('0x3'));var fs=require('fs');var BPromise=require(_0x9b0c('0x4'));var zipdir=require(_0x9b0c('0x5'));var rimraf=require('rimraf');var db=require(_0x9b0c('0x6'))['db'];var dbH=require(_0x9b0c('0x6'))[_0x9b0c('0x7')];var logger=require(_0x9b0c('0x8'))(_0x9b0c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x9b0c('0xa')][0x2]);var QUERY=process[_0x9b0c('0xa')][0x3];var PATH=process[_0x9b0c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1423d4,_0x1b26a1){var _0x5f2702={'status':_0x1423d4};var _0x51251c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b26a1){_0x5f2702[_0x9b0c('0xb')]=_0x1b26a1;}return db[_0x9b0c('0xc')][_0x9b0c('0xd')](_0x5f2702,_0x51251c);}function main(){var _0x26eba4=0x1388;var _0x3bc63b;logger[_0x9b0c('0xe')](util[_0x9b0c('0xf')](_0x9b0c('0x10'),EXTRACTED_REPORT_ID,_0x9b0c('0x11')));return db[_0x9b0c('0x12')][_0x9b0c('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b0c('0x14'),'splitSizeCsv']})['then'](function(_0x3037de){if(_0x3037de){_0x3bc63b=_0x3037de;_0x26eba4=_0x3bc63b[_0x9b0c('0x15')]||0x1388;}})[_0x9b0c('0x16')](function(){return dbH[_0x9b0c('0x17')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9b0c('0x17')][_0x9b0c('0x18')][_0x9b0c('0x19')]});})[_0x9b0c('0x16')](function(_0x2801d6){if(!_0x2801d6[0x0][_0x9b0c('0x1a')]){return analyticExtractedReport(_0x9b0c('0x1b'));}var _0x24639b=[];var _0x12c295=0x0;if(_0x3bc63b[_0x9b0c('0x14')]){if(_0x2801d6&&_0x2801d6[_0x9b0c('0x1c')]){var _0x47c616=_['range'](_0x2801d6[0x0][_0x9b0c('0x1a')]/_0x26eba4);var _0x901f0a=Number[_0x9b0c('0x1d')](_0x2801d6[0x0]['num']/_0x26eba4)?_0x2801d6[0x0][_0x9b0c('0x1a')]%_0x26eba4:0x0;_0x47c616[_0x9b0c('0x1e')](function(_0x305b0e){if(_0x305b0e>0x0){_0x12c295+=_0x26eba4;}_0x24639b[_0x9b0c('0x1f')](dbH[_0x9b0c('0x17')][_0x9b0c('0x20')](util[_0x9b0c('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x26eba4,_0x12c295),{'type':dbH[_0x9b0c('0x17')]['QueryTypes']['SELECT']}));});if(_0x901f0a>0x0){_0x12c295+=_0x26eba4;_0x24639b[_0x9b0c('0x1f')](dbH[_0x9b0c('0x17')]['query'](util[_0x9b0c('0xf')](_0x9b0c('0x21'),QUERY,_0x901f0a,_0x12c295),{'type':dbH[_0x9b0c('0x17')]['QueryTypes'][_0x9b0c('0x19')]}));}}}else{_0x24639b[_0x9b0c('0x1f')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x9b0c('0x18')]['SELECT']}));}var _0x4a240b=path['dirname'](PATH);var _0x3b8081=path['basename'](PATH,_0x9b0c('0x22'));var _0x2c0297=_0x3bc63b[_0x9b0c('0x14')]&&_0x24639b[_0x9b0c('0x1c')]>0x1;var _0xf46567=[];if(!fs[_0x9b0c('0x23')](path[_0x9b0c('0x24')](_0x4a240b,_0x3b8081))&&_0x2c0297){fs[_0x9b0c('0x25')](path[_0x9b0c('0x24')](_0x4a240b,_0x3b8081));}return BPromise['each'](_0x24639b,function(_0x10bf25){_0xf46567['push'](_0x10bf25);})[_0x9b0c('0x16')](function(){for(var _0x17eb66=0x0;_0x17eb66<_0xf46567[_0x9b0c('0x1c')];_0x17eb66+=0x1){var _0x24403f;var _0x53d9b8=_0xf46567[_0x17eb66];if(_0x2c0297){_0x24403f=path['join'](_0x4a240b,_0x3b8081,util[_0x9b0c('0xf')](_0x9b0c('0x26'),_0x3b8081,_0x17eb66,_0x9b0c('0x27')));}else{_0x24403f=path[_0x9b0c('0x24')](_0x4a240b,util['format']('%s.%s',_0x3b8081,_0x9b0c('0x27')));}fs[_0x9b0c('0x28')](_0x24403f,csv(_0x53d9b8));}})[_0x9b0c('0x16')](function(){if(_0x2c0297){return new Promise(function(_0x18c151){zipdir(path[_0x9b0c('0x24')](_0x4a240b,_0x3b8081),{'saveTo':path[_0x9b0c('0x24')](_0x4a240b,util[_0x9b0c('0xf')](_0x9b0c('0x29'),_0x3b8081,_0x9b0c('0x2a')))},function(_0x2f1083,_0x271051){rimraf(path[_0x9b0c('0x24')](_0x4a240b,_0x3b8081),function(){});_0x18c151(_0x9b0c('0x2b'));});});}})[_0x9b0c('0x16')](function(){logger[_0x9b0c('0xe')](util['format'](_0x9b0c('0x2c'),EXTRACTED_REPORT_ID,_0x9b0c('0x11')));return analyticExtractedReport('Completed',_0x2c0297?util[_0x9b0c('0xf')](_0x9b0c('0x29'),_0x3b8081,_0x2c0297?_0x9b0c('0x2a'):'csv'):null);});})[_0x9b0c('0x2d')](function(_0x556c2c){logger[_0x9b0c('0xe')](util['format'](_0x9b0c('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x9b0c('0x2f')](_0x556c2c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9b0c('0x30'));})[_0x9b0c('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3e1ee74..1798730 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 _0x2b97=['auto','body','push','concat','chunk','keys','forEach','format','startDate','endDate','header','pageBreak','before','landscape','toString','footer','Arial','black','num','Empty','find','split','splitSizePdf','then','range','isInteger','sequelize','QueryTypes','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','info','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','value','length'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x2b97,0x1df));var _0x72b9=function(_0x45a2a6,_0x1291f0){_0x45a2a6=_0x45a2a6-0x0;var _0x3d848d=_0x2b97[_0x45a2a6];return _0x3d848d;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x72b9('0x0'));var moment=require(_0x72b9('0x1'));var htmlToPdfmake=require(_0x72b9('0x2'));var PdfPrinter=require(_0x72b9('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x72b9('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x72b9('0x5')];var BPromise=require(_0x72b9('0x6'));var db=require(_0x72b9('0x7'))['db'];var dbH=require(_0x72b9('0x7'))[_0x72b9('0x8')];var logger=require('../../config/logger')(_0x72b9('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x72b9('0xa')][0x2]);var QUERY=process[_0x72b9('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x72b9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b06df,_0x277972){var _0x491834={'status':_0x2b06df};var _0x24c94a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x277972){_0x491834[_0x72b9('0xc')]=_0x277972;}return db[_0x72b9('0xd')]['update'](_0x491834,_0x24c94a);}function getHeaders(_0x4a9a3b){return _[_0x72b9('0xe')](_0x4a9a3b,function(_0x1b2712){return{'text':_0x1b2712,'style':_0x72b9('0xf')};});}function getRows(_0x4ad8f3,_0x5ccd7c){return _[_0x72b9('0xe')](_0x5ccd7c,function(_0x438938){return _(_0x438938)[_0x72b9('0x10')](_0x4ad8f3)['map'](function(_0x4d599d){return _0x4d599d?_['toString'](_0x4d599d):'';})[_0x72b9('0x11')]();});}function createTable(_0x429e92,_0x2f0b8b){var _0x2a7a6c={'widths':_['fill'](Array(_0x429e92[_0x72b9('0x12')]),0x91),'heights':function(_0x2635eb){return _0x2635eb===0x0?_0x72b9('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2ae008=getHeaders(_0x429e92);_0x2a7a6c[_0x72b9('0x14')][_0x72b9('0x15')](_0x2ae008);var _0x53af44=getRows(_0x429e92,_0x2f0b8b);_0x2a7a6c[_0x72b9('0x14')]=_0x2a7a6c['body'][_0x72b9('0x16')](_0x53af44);return _0x2a7a6c;}function createTables(_0x46679e){var _0xf20b9e=[];var _0x2813ee=_[_0x72b9('0x17')](Object[_0x72b9('0x18')](_0x46679e[0x0]),0x5);_0x2813ee[_0x72b9('0x19')](function(_0x546d2a){_0xf20b9e[_0x72b9('0x15')](createTable(_0x546d2a,_0x46679e));});return _0xf20b9e;}function getPDFDocDefinition(_0x5e917f){var _0x358e1b=util[_0x72b9('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x72b9('0x1b')])[_0x72b9('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x72b9('0x1c')])[_0x72b9('0x1a')](FORMAT));var _0x35e78d=[];for(var _0x392d8d=0x0;_0x392d8d<_0x5e917f[_0x72b9('0x12')];_0x392d8d++){var _0x440448=[];if(_0x392d8d===0x0){_0x440448['push']({'text':_0x358e1b,'style':_0x72b9('0x1d')});}var _0x2464d0={'table':_0x5e917f[_0x392d8d]};if(_0x392d8d>0x0){_0x2464d0[_0x72b9('0x1e')]=_0x72b9('0x1f');_0x2464d0['margin']=[0x0,0x46,0x0,0x0];}_0x440448[_0x72b9('0x15')](_0x2464d0);_0x35e78d[_0x72b9('0x15')](_0x440448);}return{'pageSize':'A4','pageOrientation':_0x72b9('0x20'),'content':_0x35e78d,'footer':function(_0x42a141,_0x8e34f2){return{'text':_0x42a141[_0x72b9('0x21')]()+'\x20/\x20'+_0x8e34f2,'style':_0x72b9('0x22')};},'defaultStyle':{'font':_0x72b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x72b9('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1aafe0){var _0x25b69c=0x1388;var _0x250f3a;if(!_0x1aafe0[0x0][_0x72b9('0x25')]){return analyticExtractedReport(_0x72b9('0x26'));}return db['Setting'][_0x72b9('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x72b9('0x28'),_0x72b9('0x29')]})[_0x72b9('0x2a')](function(_0x415da2){if(_0x415da2){_0x250f3a=_0x415da2;_0x25b69c=_0x250f3a[_0x72b9('0x29')]||0x3e8;}})[_0x72b9('0x2a')](function(){var _0x314ae1=[];var _0xc1166c=0x0;if(_0x250f3a[_0x72b9('0x28')]){if(_0x1aafe0&&_0x1aafe0[_0x72b9('0x12')]){var _0x2b6ab1=_[_0x72b9('0x2b')](_0x1aafe0[0x0][_0x72b9('0x25')]/_0x25b69c);var _0x5c304f=Number[_0x72b9('0x2c')](_0x1aafe0[0x0][_0x72b9('0x25')]/_0x25b69c)?_0x1aafe0[0x0][_0x72b9('0x25')]%_0x25b69c:0x0;_0x2b6ab1[_0x72b9('0x19')](function(_0x5766d8){if(_0x5766d8>0x0){_0xc1166c+=_0x25b69c;}_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x25b69c,_0xc1166c),{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')]['SELECT']}));});if(_0x5c304f>0x0){_0xc1166c+=_0x25b69c;_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](util[_0x72b9('0x1a')](_0x72b9('0x30'),QUERY,_0x5c304f,_0xc1166c),{'type':dbH['sequelize']['QueryTypes'][_0x72b9('0x31')]}));}}}else{_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](QUERY,{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')][_0x72b9('0x31')]}));}var _0x54e4c6=path[_0x72b9('0x32')](PATH);var _0x58f70e=path['basename'](PATH,_0x72b9('0x33'));var _0x56e4c=_0x250f3a[_0x72b9('0x28')]&&_0x314ae1[_0x72b9('0x12')]>0x1;var _0x54710d=[];if(!fs[_0x72b9('0x34')](path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e))&&_0x56e4c){fs[_0x72b9('0x36')](path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e));}return BPromise[_0x72b9('0x37')](_0x314ae1,function(_0x5b8740){_0x54710d[_0x72b9('0x15')](_0x5b8740);})['then'](function(){var _0x37b85d=[];for(var _0x2a8454=0x0;_0x2a8454<_0x54710d[_0x72b9('0x12')];_0x2a8454+=0x1){var _0x1e8f91=_0x54710d[_0x2a8454];var _0x1a7587=createTables(_[_0x72b9('0x38')](_0x1e8f91));var _0x3882a9;var _0x26cff1=getPDFDocDefinition(_0x1a7587);var _0x3a9580=getPDFPrinter();var _0x3ac994=_0x3a9580[_0x72b9('0x39')](_0x26cff1);if(_0x56e4c){_0x3882a9=path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e,util[_0x72b9('0x1a')](_0x72b9('0x3a'),_0x58f70e,_0x2a8454,'pdf'));}else{_0x3882a9=path[_0x72b9('0x35')](_0x54e4c6,util['format'](_0x72b9('0x3b'),_0x58f70e,'pdf'));}_0x37b85d[_0x72b9('0x15')](writePDFDocument(_0x3ac994,_0x3882a9));}return Promise[_0x72b9('0x3c')](_0x37b85d);})[_0x72b9('0x2a')](function(){if(_0x56e4c){return new Promise(function(_0x1962a0){zipdir(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),{'saveTo':path[_0x72b9('0x35')](_0x54e4c6,util['format'](_0x72b9('0x3b'),_0x58f70e,_0x72b9('0x3d')))},function(){rimraf(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),function(){});_0x1962a0('zip\x20finished');});});}})['then'](function(){if(!_0x56e4c)return;rimraf(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),function(){});})[_0x72b9('0x2a')](function(){logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x72b9('0x3f')));return analyticExtractedReport(_0x72b9('0x40'),_0x56e4c?util['format'](_0x72b9('0x3b'),_0x58f70e,_0x56e4c?_0x72b9('0x3d'):_0x72b9('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')](_0x72b9('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x72b9('0xd')][_0x72b9('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x72b9('0x2a')](function(_0xee61b6){EXTRACTED_REPORT=_0xee61b6;return dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](util[_0x72b9('0x1a')](_0x72b9('0x44'),QUERY),{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')]['SELECT']});})[_0x72b9('0x2a')](extractReport)[_0x72b9('0x45')](function(_0x110f80){logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')](_0x72b9('0x46'),EXTRACTED_REPORT_ID,_0x72b9('0x3f')),util['inspect'](_0x110f80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x72b9('0x47'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x136364=new PdfPrinter({'Arial':{'normal':__dirname+_0x72b9('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x72b9('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x136364;}function getPDFDocDefinitionFromHTML(_0x98eb32,_0x3e1030){var _0x549158=util[_0x72b9('0x1a')]('%s\x20#%d',_0x3e1030['channel'],_0x3e1030[_0x72b9('0x4a')]);var _0x3fe8a2=moment()['format'](_0x72b9('0x4b'))[_0x72b9('0x21')]();var _0x5b8587=htmlToPdfmake(_0x98eb32,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5b8587],'defaultStyle':{'font':_0x72b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x72b9('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x72b9('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x72b9('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x72b9('0x1d')}];},'footer':function(_0xca85da,_0x194888){return[{'text':util[_0x72b9('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x549158,_0xca85da,_0x194888,_0x3fe8a2),'style':_0x72b9('0x22')}];}};}function writePDFDocument(_0x2b6383,_0x135797){return new Promise(function(_0x3531ce,_0x60a0d){var _0x4c5054=_0x2b6383[_0x72b9('0x4d')](fs[_0x72b9('0x4e')](_0x135797));_0x4c5054['on'](_0x72b9('0x4f'),function(){_0x3531ce(_0x72b9('0x4f'));});_0x4c5054['on'](_0x72b9('0x50'),function(_0x578113){_0x60a0d(_0x578113);});_0x2b6383[_0x72b9('0x51')]();});}exports[_0x72b9('0x52')]=function(_0x9e47dc,_0x7d2148){var _0x290b01=getPDFPrinter();var _0x29bb67=getPDFDocDefinitionFromHTML(_0x9e47dc,_0x7d2148);var _0x110082=_0x290b01[_0x72b9('0x39')](_0x29bb67);return writePDFDocument(_0x110082,_0x7d2148[_0x72b9('0x0')])[_0x72b9('0x45')](function(_0x4186fc){throw _0x4186fc;});}; \ No newline at end of file +var _0x65d5=['/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','util','moment','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','body','push','chunk','keys','forEach','format','endDate','header','pageBreak','before','margin','landscape','footer','Arial','right','Setting','find','splitSizePdf','then','split','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','flatten','pdf','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','exit','/fonts/arial-bold.ttf'];(function(_0x21d532,_0x4552a4){var _0x37bda1=function(_0x134a6f){while(--_0x134a6f){_0x21d532['push'](_0x21d532['shift']());}};_0x37bda1(++_0x4552a4);}(_0x65d5,0x106));var _0x565d=function(_0x547698,_0x2e3b76){_0x547698=_0x547698-0x0;var _0x108bd5=_0x65d5[_0x547698];return _0x108bd5;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x565d('0x0'));var path=require('path');var moment=require(_0x565d('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x565d('0x2'));var JSDOM=require(_0x565d('0x3'))[_0x565d('0x4')];var window=new JSDOM('')[_0x565d('0x5')];var BPromise=require(_0x565d('0x6'));var db=require(_0x565d('0x7'))['db'];var dbH=require('../../mysqldb')[_0x565d('0x8')];var logger=require(_0x565d('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x565d('0xa')][0x2]);var QUERY=process[_0x565d('0xa')][0x3];var PATH=process[_0x565d('0xa')][0x4];var NAME=process[_0x565d('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x45e188,_0x2d073e){var _0x26ca4c={'status':_0x45e188};var _0x5f524a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d073e){_0x26ca4c[_0x565d('0xb')]=_0x2d073e;}return db[_0x565d('0xc')][_0x565d('0xd')](_0x26ca4c,_0x5f524a);}function getHeaders(_0x117d0c){return _[_0x565d('0xe')](_0x117d0c,function(_0x144971){return{'text':_0x144971,'style':_0x565d('0xf')};});}function getRows(_0x32ef61,_0x2ea6f3){return _[_0x565d('0xe')](_0x2ea6f3,function(_0xb07e23){return _(_0xb07e23)[_0x565d('0x10')](_0x32ef61)['map'](function(_0x256aba){return _0x256aba?_[_0x565d('0x11')](_0x256aba):'';})[_0x565d('0x12')]();});}function createTable(_0x525e31,_0x1dfabd){var _0x56e1dc={'widths':_['fill'](Array(_0x525e31[_0x565d('0x13')]),0x91),'heights':function(_0x587a1f){return _0x587a1f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f81e5=getHeaders(_0x525e31);_0x56e1dc[_0x565d('0x14')][_0x565d('0x15')](_0x3f81e5);var _0x4d4ab6=getRows(_0x525e31,_0x1dfabd);_0x56e1dc[_0x565d('0x14')]=_0x56e1dc[_0x565d('0x14')]['concat'](_0x4d4ab6);return _0x56e1dc;}function createTables(_0x3ed361){var _0x4101d6=[];var _0x42d1ca=_[_0x565d('0x16')](Object[_0x565d('0x17')](_0x3ed361[0x0]),0x5);_0x42d1ca[_0x565d('0x18')](function(_0x356ea8){_0x4101d6[_0x565d('0x15')](createTable(_0x356ea8,_0x3ed361));});return _0x4101d6;}function getPDFDocDefinition(_0xd5fc75){var _0x4e7d3f=util[_0x565d('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x565d('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x565d('0x1a')])[_0x565d('0x19')](FORMAT));var _0x382269=[];for(var _0x5daf5a=0x0;_0x5daf5a<_0xd5fc75[_0x565d('0x13')];_0x5daf5a++){var _0x107566=[];if(_0x5daf5a===0x0){_0x107566[_0x565d('0x15')]({'text':_0x4e7d3f,'style':_0x565d('0x1b')});}var _0x7ad80e={'table':_0xd5fc75[_0x5daf5a]};if(_0x5daf5a>0x0){_0x7ad80e[_0x565d('0x1c')]=_0x565d('0x1d');_0x7ad80e[_0x565d('0x1e')]=[0x0,0x46,0x0,0x0];}_0x107566[_0x565d('0x15')](_0x7ad80e);_0x382269[_0x565d('0x15')](_0x107566);}return{'pageSize':'A4','pageOrientation':_0x565d('0x1f'),'content':_0x382269,'footer':function(_0x2b6381,_0x4f598b){return{'text':_0x2b6381[_0x565d('0x11')]()+'\x20/\x20'+_0x4f598b,'style':_0x565d('0x20')};},'defaultStyle':{'font':_0x565d('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x565d('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x395fa3){var _0x5324f5=0x1388;var _0x5b245f;if(!_0x395fa3[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0x565d('0x23')][_0x565d('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x565d('0x25')]})[_0x565d('0x26')](function(_0x31e4c6){if(_0x31e4c6){_0x5b245f=_0x31e4c6;_0x5324f5=_0x5b245f[_0x565d('0x25')]||0x3e8;}})[_0x565d('0x26')](function(){var _0x56c976=[];var _0x4987af=0x0;if(_0x5b245f[_0x565d('0x27')]){if(_0x395fa3&&_0x395fa3['length']){var _0x44e4d9=_[_0x565d('0x28')](_0x395fa3[0x0][_0x565d('0x29')]/_0x5324f5);var _0x33f5b2=Number[_0x565d('0x2a')](_0x395fa3[0x0][_0x565d('0x29')]/_0x5324f5)?_0x395fa3[0x0][_0x565d('0x29')]%_0x5324f5:0x0;_0x44e4d9[_0x565d('0x18')](function(_0x296c71){if(_0x296c71>0x0){_0x4987af+=_0x5324f5;}_0x56c976[_0x565d('0x15')](dbH[_0x565d('0x2b')][_0x565d('0x2c')](util['format'](_0x565d('0x2d'),QUERY,_0x5324f5,_0x4987af),{'type':dbH[_0x565d('0x2b')][_0x565d('0x2e')]['SELECT']}));});if(_0x33f5b2>0x0){_0x4987af+=_0x5324f5;_0x56c976['push'](dbH['sequelize'][_0x565d('0x2c')](util[_0x565d('0x19')](_0x565d('0x2d'),QUERY,_0x33f5b2,_0x4987af),{'type':dbH[_0x565d('0x2b')][_0x565d('0x2e')]['SELECT']}));}}}else{_0x56c976['push'](dbH['sequelize'][_0x565d('0x2c')](QUERY,{'type':dbH[_0x565d('0x2b')][_0x565d('0x2e')][_0x565d('0x2f')]}));}var _0x126d3f=path[_0x565d('0x30')](PATH);var _0x50adc4=path['basename'](PATH,_0x565d('0x31'));var _0x3351f9=_0x5b245f[_0x565d('0x27')]&&_0x56c976[_0x565d('0x13')]>0x1;var _0x528980=[];if(!fs['existsSync'](path[_0x565d('0x32')](_0x126d3f,_0x50adc4))&&_0x3351f9){fs[_0x565d('0x33')](path['join'](_0x126d3f,_0x50adc4));}return BPromise['each'](_0x56c976,function(_0x54e109){_0x528980[_0x565d('0x15')](_0x54e109);})[_0x565d('0x26')](function(){var _0x1ae08c=[];for(var _0x434f6b=0x0;_0x434f6b<_0x528980[_0x565d('0x13')];_0x434f6b+=0x1){var _0x353626=_0x528980[_0x434f6b];var _0x40c612=createTables(_[_0x565d('0x34')](_0x353626));var _0x4d5446;var _0x1001fa=getPDFDocDefinition(_0x40c612);var _0x3a3740=getPDFPrinter();var _0x622b13=_0x3a3740['createPdfKitDocument'](_0x1001fa);if(_0x3351f9){_0x4d5446=path['join'](_0x126d3f,_0x50adc4,util[_0x565d('0x19')]('%s%d.%s',_0x50adc4,_0x434f6b,_0x565d('0x35')));}else{_0x4d5446=path[_0x565d('0x32')](_0x126d3f,util[_0x565d('0x19')](_0x565d('0x36'),_0x50adc4,_0x565d('0x35')));}_0x1ae08c[_0x565d('0x15')](writePDFDocument(_0x622b13,_0x4d5446));}return Promise['all'](_0x1ae08c);})[_0x565d('0x26')](function(){if(_0x3351f9){return new Promise(function(_0x2f4781){zipdir(path['join'](_0x126d3f,_0x50adc4),{'saveTo':path[_0x565d('0x32')](_0x126d3f,util[_0x565d('0x19')](_0x565d('0x36'),_0x50adc4,'zip'))},function(){rimraf(path[_0x565d('0x32')](_0x126d3f,_0x50adc4),function(){});_0x2f4781('zip\x20finished');});});}})[_0x565d('0x26')](function(){if(!_0x3351f9)return;rimraf(path[_0x565d('0x32')](_0x126d3f,_0x50adc4),function(){});})[_0x565d('0x26')](function(){logger[_0x565d('0x37')](util[_0x565d('0x19')](_0x565d('0x38'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x565d('0x39'),_0x3351f9?util[_0x565d('0x19')]('%s.%s',_0x50adc4,_0x3351f9?_0x565d('0x3a'):_0x565d('0x35')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x565d('0x37')](util[_0x565d('0x19')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x565d('0x3b')));return db[_0x565d('0xc')][_0x565d('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x565d('0x26')](function(_0x5325b2){EXTRACTED_REPORT=_0x5325b2;return dbH[_0x565d('0x2b')]['query'](util[_0x565d('0x19')](_0x565d('0x3d'),QUERY),{'type':dbH[_0x565d('0x2b')][_0x565d('0x2e')]['SELECT']});})['then'](extractReport)[_0x565d('0x3e')](function(_0x5d7ddf){logger[_0x565d('0x37')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x5d7ddf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x565d('0x3f'));})['finally'](function(){process[_0x565d('0x40')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x11a4c7=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x565d('0x41'),'italics':__dirname+_0x565d('0x42'),'bolditalics':__dirname+_0x565d('0x43')}});return _0x11a4c7;}function getPDFDocDefinitionFromHTML(_0x1a7c48,_0x7a613c){var _0x99af26=util['format']('%s\x20#%d',_0x7a613c[_0x565d('0x44')],_0x7a613c[_0x565d('0x45')]);var _0x17c3b7=moment()[_0x565d('0x19')](_0x565d('0x46'))['toString']();var _0x391a51=htmlToPdfmake(_0x1a7c48,{'window':window,'tableAutoSize':!![]});return{'content':[_0x391a51],'defaultStyle':{'font':_0x565d('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x565d('0x47'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x565d('0x47')}},'header':function(){return[{'text':_0x565d('0x48'),'style':_0x565d('0x1b')}];},'footer':function(_0xf86a0c,_0x1f1533){return[{'text':util[_0x565d('0x19')](_0x565d('0x49'),_0x99af26,_0xf86a0c,_0x1f1533,_0x17c3b7),'style':_0x565d('0x20')}];}};}function writePDFDocument(_0x5f4cfa,_0x3b7d49){return new Promise(function(_0x1eb664,_0x4723b9){var _0xff326=_0x5f4cfa[_0x565d('0x4a')](fs[_0x565d('0x4b')](_0x3b7d49));_0xff326['on'](_0x565d('0x4c'),function(){_0x1eb664(_0x565d('0x4c'));});_0xff326['on'](_0x565d('0x4d'),function(_0x415eba){_0x4723b9(_0x415eba);});_0x5f4cfa[_0x565d('0x4e')]();});}exports[_0x565d('0x4f')]=function(_0x18ce4b,_0x3f324b){var _0x56bbe6=getPDFPrinter();var _0x5f554b=getPDFDocDefinitionFromHTML(_0x18ce4b,_0x3f324b);var _0x41c21d=_0x56bbe6[_0x565d('0x50')](_0x5f554b);return writePDFDocument(_0x41c21d,_0x3f324b[_0x565d('0x51')])[_0x565d('0x3e')](function(_0x323823){throw _0x323823;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ed379bd..14343ae 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 _0x0e5b=['writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','split','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx'];(function(_0x26c802,_0x204b2a){var _0x266dd1=function(_0x307b91){while(--_0x307b91){_0x26c802['push'](_0x26c802['shift']());}};_0x266dd1(++_0x204b2a);}(_0x0e5b,0x9d));var _0xb0e5=function(_0x4eb1b5,_0x44a3c5){_0x4eb1b5=_0x4eb1b5-0x0;var _0x341cf7=_0x0e5b[_0x4eb1b5];return _0x341cf7;};'use strict';var util=require('util');var path=require(_0xb0e5('0x0'));var _=require(_0xb0e5('0x1'));var fs=require('fs');var json2xls=require(_0xb0e5('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xb0e5('0x3'));var rimraf=require(_0xb0e5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb0e5('0x5'))[_0xb0e5('0x6')];var logger=require(_0xb0e5('0x7'))(_0xb0e5('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb0e5('0x9')][0x3];var PATH=process[_0xb0e5('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52b427,_0x2109a7){var _0x86616d={'status':_0x52b427};var _0x559a09={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2109a7){_0x86616d['savename']=_0x2109a7;}return db['AnalyticExtractedReport'][_0xb0e5('0xa')](_0x86616d,_0x559a09);}function main(){var _0x122612=0x1388;var _0x1847da;logger[_0xb0e5('0xb')](util[_0xb0e5('0xc')](_0xb0e5('0xd'),EXTRACTED_REPORT_ID,_0xb0e5('0xe')));return db[_0xb0e5('0xf')][_0xb0e5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb0e5('0x11')]})[_0xb0e5('0x12')](function(_0x32e3cd){if(_0x32e3cd){_0x1847da=_0x32e3cd;_0x122612=_0x1847da['splitSizeXlsx']||0x1388;}})[_0xb0e5('0x12')](function(){return dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util[_0xb0e5('0xc')](_0xb0e5('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xb0e5('0x12')](function(_0x57171e){if(!_0x57171e[0x0][_0xb0e5('0x16')]){return analyticExtractedReport('Empty');}var _0x4a76b2=[];var _0x184443=0x0;if(_0x1847da[_0xb0e5('0x17')]){if(_0x57171e&&_0x57171e[_0xb0e5('0x18')]){var _0x3e6368=_[_0xb0e5('0x19')](_0x57171e[0x0]['num']/_0x122612);var _0x4dafbf=Number['isInteger'](_0x57171e[0x0][_0xb0e5('0x16')]/_0x122612)?_0x57171e[0x0]['num']%_0x122612:0x0;_0x3e6368['forEach'](function(_0x1a6b46){if(_0x1a6b46>0x0){_0x184443+=_0x122612;}_0x4a76b2[_0xb0e5('0x1a')](dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util['format'](_0xb0e5('0x1b'),QUERY,_0x122612,_0x184443),{'type':dbH[_0xb0e5('0x13')]['QueryTypes'][_0xb0e5('0x1c')]}));});if(_0x4dafbf>0x0){_0x184443+=_0x122612;_0x4a76b2[_0xb0e5('0x1a')](dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util['format'](_0xb0e5('0x1b'),QUERY,_0x4dafbf,_0x184443),{'type':dbH[_0xb0e5('0x13')][_0xb0e5('0x1d')][_0xb0e5('0x1c')]}));}}}else{_0x4a76b2[_0xb0e5('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xb0e5('0x13')]['QueryTypes'][_0xb0e5('0x1c')]}));}var _0x452bfc=path[_0xb0e5('0x1e')](PATH);var _0xec456e=path[_0xb0e5('0x1f')](PATH,_0xb0e5('0x20'));var _0x1650ff=_0x1847da['split']&&_0x4a76b2['length']>0x1;var _0x17ee8f=[];if(!fs[_0xb0e5('0x21')](path[_0xb0e5('0x22')](_0x452bfc,_0xec456e))&&_0x1650ff){fs[_0xb0e5('0x23')](path[_0xb0e5('0x22')](_0x452bfc,_0xec456e));}return BPromise[_0xb0e5('0x24')](_0x4a76b2,function(_0x560f84){_0x17ee8f[_0xb0e5('0x1a')](_0x560f84);})[_0xb0e5('0x12')](function(){for(var _0xa8abfd=0x0;_0xa8abfd<_0x17ee8f[_0xb0e5('0x18')];_0xa8abfd+=0x1){var _0x2dd470;var _0x33900b=_0x17ee8f[_0xa8abfd];if(_0x1650ff){_0x2dd470=path[_0xb0e5('0x22')](_0x452bfc,_0xec456e,util[_0xb0e5('0xc')](_0xb0e5('0x25'),_0xec456e,_0xa8abfd,'xlsx'));}else{_0x2dd470=path[_0xb0e5('0x22')](_0x452bfc,util[_0xb0e5('0xc')]('%s.%s',_0xec456e,_0xb0e5('0x26')));}fs[_0xb0e5('0x27')](_0x2dd470,json2xls(_0x33900b),_0xb0e5('0x28'));}})[_0xb0e5('0x12')](function(){if(_0x1650ff){return new Promise(function(_0x2d5836){zipdir(path[_0xb0e5('0x22')](_0x452bfc,_0xec456e),{'saveTo':path[_0xb0e5('0x22')](_0x452bfc,util[_0xb0e5('0xc')]('%s.%s',_0xec456e,_0xb0e5('0x29')))},function(_0x1631b6,_0x5b2a73){rimraf(path[_0xb0e5('0x22')](_0x452bfc,_0xec456e),function(){});_0x2d5836(_0xb0e5('0x2a'));});});}})[_0xb0e5('0x12')](function(){logger[_0xb0e5('0xb')](util['format'](_0xb0e5('0x2b'),EXTRACTED_REPORT_ID,_0xb0e5('0xe')));return analyticExtractedReport(_0xb0e5('0x2c'),_0x1650ff?util['format'](_0xb0e5('0x2d'),_0xec456e,_0x1650ff?'zip':_0xb0e5('0x26')):null);});})['catch'](function(_0x4a710c){logger[_0xb0e5('0xb')](util[_0xb0e5('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb0e5('0xe')),util['inspect'](_0x4a710c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb0e5('0x2e'));})[_0xb0e5('0x2f')](function(){process[_0xb0e5('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd38f=['basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd38f,0xa3));var _0xfd38=function(_0x321a24,_0x1da123){_0x321a24=_0x321a24-0x0;var _0xcc42ed=_0xd38f[_0x321a24];return _0xcc42ed;};'use strict';var util=require(_0xfd38('0x0'));var path=require(_0xfd38('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xfd38('0x2'));var rimraf=require(_0xfd38('0x3'));var db=require(_0xfd38('0x4'))['db'];var dbH=require(_0xfd38('0x4'))[_0xfd38('0x5')];var logger=require(_0xfd38('0x6'))(_0xfd38('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xfd38('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xfd38('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x9e8238,_0x433783){var _0xd0d6d8={'status':_0x9e8238};var _0x57ffcb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x433783){_0xd0d6d8['savename']=_0x433783;}return db[_0xfd38('0x9')][_0xfd38('0xa')](_0xd0d6d8,_0x57ffcb);}function main(){var _0x5141bc=0x1388;var _0x15f16a;logger[_0xfd38('0xb')](util[_0xfd38('0xc')](_0xfd38('0xd'),EXTRACTED_REPORT_ID,_0xfd38('0xe')));return db[_0xfd38('0xf')][_0xfd38('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfd38('0x11'),_0xfd38('0x12')]})[_0xfd38('0x13')](function(_0x54cee5){if(_0x54cee5){_0x15f16a=_0x54cee5;_0x5141bc=_0x15f16a[_0xfd38('0x12')]||0x1388;}})['then'](function(){return dbH[_0xfd38('0x14')][_0xfd38('0x15')](util[_0xfd38('0xc')](_0xfd38('0x16'),QUERY),{'type':dbH[_0xfd38('0x14')]['QueryTypes']['SELECT']});})[_0xfd38('0x13')](function(_0x53a2b7){if(!_0x53a2b7[0x0][_0xfd38('0x17')]){return analyticExtractedReport(_0xfd38('0x18'));}var _0x5d7f99=[];var _0x338eec=0x0;if(_0x15f16a[_0xfd38('0x11')]){if(_0x53a2b7&&_0x53a2b7[_0xfd38('0x19')]){var _0x1e94d3=_[_0xfd38('0x1a')](_0x53a2b7[0x0][_0xfd38('0x17')]/_0x5141bc);var _0x42f337=Number['isInteger'](_0x53a2b7[0x0][_0xfd38('0x17')]/_0x5141bc)?_0x53a2b7[0x0][_0xfd38('0x17')]%_0x5141bc:0x0;_0x1e94d3[_0xfd38('0x1b')](function(_0xeab4e3){if(_0xeab4e3>0x0){_0x338eec+=_0x5141bc;}_0x5d7f99['push'](dbH[_0xfd38('0x14')]['query'](util[_0xfd38('0xc')](_0xfd38('0x1c'),QUERY,_0x5141bc,_0x338eec),{'type':dbH['sequelize'][_0xfd38('0x1d')]['SELECT']}));});if(_0x42f337>0x0){_0x338eec+=_0x5141bc;_0x5d7f99['push'](dbH[_0xfd38('0x14')][_0xfd38('0x15')](util[_0xfd38('0xc')](_0xfd38('0x1c'),QUERY,_0x42f337,_0x338eec),{'type':dbH[_0xfd38('0x14')][_0xfd38('0x1d')][_0xfd38('0x1e')]}));}}}else{_0x5d7f99[_0xfd38('0x1f')](dbH[_0xfd38('0x14')][_0xfd38('0x15')](QUERY,{'type':dbH[_0xfd38('0x14')][_0xfd38('0x1d')][_0xfd38('0x1e')]}));}var _0x3a562a=path[_0xfd38('0x20')](PATH);var _0x1b5b98=path[_0xfd38('0x21')](PATH,_0xfd38('0x22'));var _0x10ea1f=_0x15f16a[_0xfd38('0x11')]&&_0x5d7f99['length']>0x1;var _0x4c831c=[];if(!fs[_0xfd38('0x23')](path[_0xfd38('0x24')](_0x3a562a,_0x1b5b98))&&_0x10ea1f){fs[_0xfd38('0x25')](path[_0xfd38('0x24')](_0x3a562a,_0x1b5b98));}return BPromise['each'](_0x5d7f99,function(_0x57e495){_0x4c831c[_0xfd38('0x1f')](_0x57e495);})['then'](function(){for(var _0x629c44=0x0;_0x629c44<_0x4c831c[_0xfd38('0x19')];_0x629c44+=0x1){var _0x508f87;var _0x58d716=_0x4c831c[_0x629c44];if(_0x10ea1f){_0x508f87=path['join'](_0x3a562a,_0x1b5b98,util[_0xfd38('0xc')](_0xfd38('0x26'),_0x1b5b98,_0x629c44,_0xfd38('0x27')));}else{_0x508f87=path[_0xfd38('0x24')](_0x3a562a,util['format'](_0xfd38('0x28'),_0x1b5b98,_0xfd38('0x27')));}fs['writeFileSync'](_0x508f87,json2xls(_0x58d716),'binary');}})[_0xfd38('0x13')](function(){if(_0x10ea1f){return new Promise(function(_0x37ed51){zipdir(path[_0xfd38('0x24')](_0x3a562a,_0x1b5b98),{'saveTo':path[_0xfd38('0x24')](_0x3a562a,util[_0xfd38('0xc')]('%s.%s',_0x1b5b98,_0xfd38('0x29')))},function(_0x5db4d2,_0x14b4a9){rimraf(path['join'](_0x3a562a,_0x1b5b98),function(){});_0x37ed51(_0xfd38('0x2a'));});});}})['then'](function(){logger[_0xfd38('0xb')](util[_0xfd38('0xc')](_0xfd38('0x2b'),EXTRACTED_REPORT_ID,_0xfd38('0xe')));return analyticExtractedReport(_0xfd38('0x2c'),_0x10ea1f?util['format'](_0xfd38('0x28'),_0x1b5b98,_0x10ea1f?'zip':_0xfd38('0x27')):null);});})['catch'](function(_0x4d2d0e){logger[_0xfd38('0xb')](util['format'](_0xfd38('0x2d'),EXTRACTED_REPORT_ID,_0xfd38('0xe')),util['inspect'](_0x4d2d0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfd38('0x2e'));})[_0xfd38('0x2f')](function(){process[_0xfd38('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4f2a75e..650b1f2 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 _0xf0b5=['XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','hasOwnProperty','priority','extension','find','extensions','format','CDR(type)=%s','context','VoiceExtensionId','type','push','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','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','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x2fe977,_0x36c636){var _0x27de25=function(_0x2d394a){while(--_0x2d394a){_0x2fe977['push'](_0x2fe977['shift']());}};_0x27de25(++_0x36c636);}(_0xf0b5,0x19e));var _0x5f0b=function(_0x57b4ed,_0x35a4ab){_0x57b4ed=_0x57b4ed-0x0;var _0x2af230=_0xf0b5[_0x57b4ed];return _0x2af230;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3ad0aa,_0x484b2e){var _0x54ee63=this;return _0x3ad0aa['models'][_0x5f0b('0x0')][_0x5f0b('0x1')]({'raw':!![]})[_0x5f0b('0x2')](function(_0x2dc72d){_0x54ee63[_0x5f0b('0x3')]=_0x2dc72d;return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')]['findAll']({'where':{'IntervalId':_0x484b2e[_0x5f0b('0x6')]},'raw':!![]});})[_0x5f0b('0x2')](function(_0x44dc79){return _0x3ad0aa['models']['VoiceExtension'][_0x5f0b('0x1')]({'where':{'exten':{'$in':_[_0x5f0b('0x7')](_[_0x5f0b('0x8')](_0x44dc79,_0x5f0b('0x9')))}},'order':[{'raw':_0x5f0b('0xa')}],'raw':!![]});})[_0x5f0b('0x2')](function(_0x2d4120){var _0x4032e8=_['filter'](_0x2d4120,{'priority':'1'});var _0x5ab3ab=_['filter'](_0x2d4120,{'isApp':0x1});var _0x5c379e=_[_0x5f0b('0xb')](_0x5ab3ab,_0x5f0b('0x9'));var _0x52deca=['queue','playback'];var _0x18a6ef=[];var _0x32245e=[];for(var _0x5e36fe in _0x5c379e){if(_0x5c379e[_0x5f0b('0xc')](_0x5e36fe)){_0x54ee63[_0x5f0b('0xd')]=0x2;_0x54ee63['extensions']=[];_0x54ee63[_0x5f0b('0xe')]=_[_0x5f0b('0xf')](_0x4032e8,{'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')]});_0x54ee63[_0x5f0b('0x10')]['push']({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':util[_0x5f0b('0x11')](_0x5f0b('0x12'),_0x5c379e[_0x5e36fe][0x0]['type']),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});if(_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')]==='inbound'){_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x18')+_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')],'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId']});}else if(_0x5c379e[_0x5e36fe][0x0]['type']===_0x5f0b('0x19')){if(_0x54ee63[_0x5f0b('0xe')]){_0x54ee63[_0x5f0b('0x10')]['push']({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':'Set','appdata':'CDR(destination)='+(_0x54ee63['extension'][_0x5f0b('0x1a')]?'${EXTEN:'+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x1a')]+'}':_0x5f0b('0x1b')),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x18')+_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')],'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});var _0x32bfb4=_0x54ee63['priority']++;_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x1d')+(_0x32bfb4+0x2)+_0x5f0b('0x1e')+(_0x32bfb4+0x1)+')','context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x32bfb4,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId']});if(_0x54ee63[_0x5f0b('0xe')]){_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':_0x54ee63[_0x5f0b('0xe')]['cutdigits']?_0x5f0b('0x1f')+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x20')+_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId'],'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});if(_0x54ee63[_0x5f0b('0xe')]&&_0x54ee63[_0x5f0b('0xe')]['hasOwnProperty'](_0x5f0b('0x21'))&&_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x21')]!=='none'){_0x54ee63['extensions']['push']({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x22'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x23')+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x21')]||_0x5f0b('0x24'),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}}_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x25'),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':_0x5f0b('0x26'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x27'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});for(var _0xb04269=0x0,_0xeea35a=0x0;_0xb04269<_0x5c379e[_0x5e36fe]['length'];_0xb04269+=0x1,_0xeea35a=0x0){var _0x2dd323=_0x5c379e[_0x5e36fe][_0xb04269];if(_0x2dd323[_0x5f0b('0x15')]){_0x2dd323['type']=_0x2dd323[_0x5f0b('0x15')][_0x5f0b('0x28')]();}var _0x12ce56=[];var _0x1eeefd=[];delete _0x2dd323['id'];delete _0x2dd323[_0x5f0b('0x29')];delete _0x2dd323[_0x5f0b('0x2a')];var _0x5ede3a=_0x2dd323[_0x5f0b('0x2b')]!==_0x5f0b('0x2c')?[_0x2dd323['interval']]:_0x2dd323[_0x5f0b('0x6')]?_[_0x5f0b('0x8')](_['filter'](_0x54ee63[_0x5f0b('0x3')],{'IntervalId':_0x2dd323[_0x5f0b('0x6')]}),_0x5f0b('0x2b')):[];if(_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x2d'))){if(_0x2dd323[_0x5f0b('0x2d')]&&_0x2dd323[_0x5f0b('0x2d')]!=='--'){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x2e')+_0x2dd323[_0x5f0b('0x2d')],'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323['VoiceExtensionId']});}}if(_0x2dd323[_0x5f0b('0x15')]===_0x5f0b('0x19')&&_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x30'))){if(_0x2dd323[_0x5f0b('0x30')]){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x31')+_0x2dd323['callerID']+')','context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}else{_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x32'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}}if(_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x33'))){if(_0x52deca['indexOf'](_0x2dd323['app'][_0x5f0b('0x28')]())>=0x0&&_0x2dd323[_0x5f0b('0x34')]!=='custom'){if(_0x2dd323[_0x5f0b('0x33')]){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323['exten'],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63['priority']+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x35'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}else{_0x12ce56['push']({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x36'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a['length']+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});_0x12ce56['push']({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x37'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a['length']+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}}}for(var _0x388601=0x0;_0x388601<_0x5ede3a[_0x5f0b('0x2f')];_0x388601+=0x1){var _0x32b44c=_0x54ee63[_0x5f0b('0xd')]+_0x5ede3a['length'];var _0x86580=_0x388601===_0x5ede3a['length']-0x1?_0x54ee63['priority']+_0x12ce56[_0x5f0b('0x2f')]+_0x1eeefd[_0x5f0b('0x2f')]+0x2:_0x54ee63[_0x5f0b('0xd')]+_0x388601+0x1;_0x12ce56['splice'](_0x388601,0x0,{'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x38'),'appdata':_0x5ede3a[_0x388601]+'?'+_0x2dd323[_0x5f0b('0x13')]+_0x5f0b('0x39')+_0x32b44c+':'+_0x2dd323[_0x5f0b('0x13')]+',${EXTEN},'+_0x86580,'exten':_0x2dd323['exten'],'context':_0x2dd323[_0x5f0b('0x13')],'priority':_0x54ee63[_0x5f0b('0xd')]+_0x388601,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x2dd323[_0x5f0b('0xd')]=_0x12ce56[_0x5f0b('0x2f')]?_[_0x5f0b('0x3a')](_0x12ce56)[_0x5f0b('0xd')]+0x1:_0x54ee63[_0x5f0b('0xd')];_0x54ee63['priority']=(_0x1eeefd[_0x5f0b('0x2f')]?_[_0x5f0b('0x3a')](_0x1eeefd)[_0x5f0b('0xd')]:_0x2dd323[_0x5f0b('0xd')])+0x1;_0x54ee63['extensions']=_[_0x5f0b('0x3b')](_0x54ee63[_0x5f0b('0x10')],_0x12ce56,[_0x2dd323],_0x1eeefd);}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x3c'),'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'priority':_0x54ee63['priority'],'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x18a6ef[_0x5f0b('0x16')](_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]);_0x32245e=_[_0x5f0b('0x3b')](_0x32245e,_0x54ee63['extensions']);}}return _0x3ad0aa[_0x5f0b('0x3d')](function(_0x54d75a){return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')][_0x5f0b('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x18a6ef}},'transaction':_0x54d75a})[_0x5f0b('0x2')](function(_0x4413b2){return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')][_0x5f0b('0x3f')](_[_0x5f0b('0x40')](_0x32245e,_0x5f0b('0xd')),{'transaction':_0x54d75a});});});})[_0x5f0b('0x41')](function(_0xb8b1f8){console[_0x5f0b('0x42')](_0xb8b1f8);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x10b9=['${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','*,*,*,*','interval','tag','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','CDR(type)=%s','type','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits'];(function(_0x40aa75,_0x2c8a58){var _0x43adcb=function(_0x49147a){while(--_0x49147a){_0x40aa75['push'](_0x40aa75['shift']());}};_0x43adcb(++_0x2c8a58);}(_0x10b9,0x1ca));var _0x910b=function(_0x17b1c0,_0x5f48f5){_0x17b1c0=_0x17b1c0-0x0;var _0x5b0ff5=_0x10b9[_0x17b1c0];return _0x5b0ff5;};'use strict';var _=require(_0x910b('0x0'));var util=require(_0x910b('0x1'));function rewrite(_0xda82a9,_0x45871d){var _0x1aaea7=this;return _0xda82a9[_0x910b('0x2')][_0x910b('0x3')][_0x910b('0x4')]({'raw':!![]})['then'](function(_0x2e0a34){_0x1aaea7[_0x910b('0x5')]=_0x2e0a34;return _0xda82a9['models'][_0x910b('0x6')]['findAll']({'where':{'IntervalId':_0x45871d[_0x910b('0x7')]},'raw':!![]});})[_0x910b('0x8')](function(_0x468282){return _0xda82a9[_0x910b('0x2')][_0x910b('0x6')][_0x910b('0x4')]({'where':{'exten':{'$in':_[_0x910b('0x9')](_[_0x910b('0xa')](_0x468282,_0x910b('0xb')))}},'order':[{'raw':_0x910b('0xc')}],'raw':!![]});})[_0x910b('0x8')](function(_0x1efc04){var _0x4cd224=_[_0x910b('0xd')](_0x1efc04,{'priority':'1'});var _0x10ba37=_[_0x910b('0xd')](_0x1efc04,{'isApp':0x1});var _0x501d68=_[_0x910b('0xe')](_0x10ba37,_0x910b('0xb'));var _0x437b7e=[_0x910b('0xf'),_0x910b('0x10')];var _0x6488cc=[];var _0x3f4386=[];for(var _0x4038c5 in _0x501d68){if(_0x501d68[_0x910b('0x11')](_0x4038c5)){_0x1aaea7[_0x910b('0x12')]=0x2;_0x1aaea7[_0x910b('0x13')]=[];_0x1aaea7[_0x910b('0x14')]=_[_0x910b('0x15')](_0x4cd224,{'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')]});_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0]['type'],'app':_0x910b('0x17'),'appdata':util['format'](_0x910b('0x18'),_0x501d68[_0x4038c5][0x0][_0x910b('0x19')]),'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});if(_0x501d68[_0x4038c5][0x0][_0x910b('0x19')]===_0x910b('0x1c')){_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':'CDR(routeid)='+_0x501d68[_0x4038c5][0x0]['VoiceExtensionId'],'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0]['VoiceExtensionId']});}else if(_0x501d68[_0x4038c5][0x0][_0x910b('0x19')]===_0x910b('0x1d')){if(_0x1aaea7['extension']){_0x1aaea7[_0x910b('0x13')]['push']({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':'Set','appdata':_0x910b('0x1e')+(_0x1aaea7[_0x910b('0x14')][_0x910b('0x1f')]?_0x910b('0x20')+_0x1aaea7['extension'][_0x910b('0x1f')]+'}':'${EXTEN}'),'context':_0x501d68[_0x4038c5][0x0]['context'],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});}_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':'CDR(routeid)='+_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')],'context':_0x501d68[_0x4038c5][0x0]['context'],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});var _0x3cba91=_0x1aaea7[_0x910b('0x12')]++;_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x21'),'appdata':_0x910b('0x22')+(_0x3cba91+0x2)+'):Goto('+(_0x3cba91+0x1)+')','context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x3cba91,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});if(_0x1aaea7[_0x910b('0x14')]){_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':_0x1aaea7[_0x910b('0x14')]['cutdigits']?_0x910b('0x23')+_0x1aaea7[_0x910b('0x14')]['cutdigits']+'}':_0x910b('0x24'),'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});}_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':'Set','appdata':_0x910b('0x25')+_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')],'context':_0x501d68[_0x4038c5][0x0]['context'],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0]['VoiceExtensionId']});if(_0x1aaea7[_0x910b('0x14')]&&_0x1aaea7[_0x910b('0x14')][_0x910b('0x11')](_0x910b('0x26'))&&_0x1aaea7[_0x910b('0x14')][_0x910b('0x26')]!==_0x910b('0x27')){_0x1aaea7['extensions'][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});_0x1aaea7['extensions'][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0]['type'],'app':'Set','appdata':_0x910b('0x28')+_0x1aaea7['extension'][_0x910b('0x26')]||_0x910b('0x29'),'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});}}_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':_0x910b('0x2a'),'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0]['exten'],'priority':_0x1aaea7['priority']++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});_0x1aaea7['extensions'][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0]['type'],'app':_0x910b('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':_0x910b('0x2b'),'context':_0x501d68[_0x4038c5][0x0]['context'],'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'priority':_0x1aaea7[_0x910b('0x12')]++,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});for(var _0x9625e=0x0,_0x46260c=0x0;_0x9625e<_0x501d68[_0x4038c5]['length'];_0x9625e+=0x1,_0x46260c=0x0){var _0x413b04=_0x501d68[_0x4038c5][_0x9625e];if(_0x413b04[_0x910b('0x19')]){_0x413b04['type']=_0x413b04['type'][_0x910b('0x2c')]();}var _0x482b2d=[];var _0x465327=[];delete _0x413b04['id'];delete _0x413b04[_0x910b('0x2d')];delete _0x413b04['updatedAt'];var _0x3e370b=_0x413b04['interval']!==_0x910b('0x2e')?[_0x413b04[_0x910b('0x2f')]]:_0x413b04[_0x910b('0x7')]?_['map'](_['filter'](_0x1aaea7[_0x910b('0x5')],{'IntervalId':_0x413b04[_0x910b('0x7')]}),_0x910b('0x2f')):[];if(_0x413b04[_0x910b('0x11')](_0x910b('0x30'))){if(_0x413b04[_0x910b('0x30')]&&_0x413b04['tag']!=='--'){_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':'CDR(tag)='+_0x413b04[_0x910b('0x30')],'context':_0x413b04[_0x910b('0x1a')],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b['length']+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04['VoiceExtensionId']});}}if(_0x413b04['type']==='outbound'&&_0x413b04[_0x910b('0x11')](_0x910b('0x31'))){if(_0x413b04['callerID']){_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x413b04['callerID']+')','context':_0x413b04[_0x910b('0x1a')],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b[_0x910b('0x32')]+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04[_0x910b('0x1b')]});}else{_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x21'),'appdata':_0x910b('0x33'),'context':_0x413b04['context'],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b['length']+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04[_0x910b('0x1b')]});}}if(_0x413b04[_0x910b('0x11')](_0x910b('0x34'))){if(_0x437b7e[_0x910b('0x35')](_0x413b04[_0x910b('0x36')]['toLowerCase']())>=0x0&&_0x413b04['appType']!==_0x910b('0x37')){if(_0x413b04[_0x910b('0x34')]){_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x21'),'appdata':_0x910b('0x38'),'context':_0x413b04[_0x910b('0x1a')],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b[_0x910b('0x32')]+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04[_0x910b('0x1b')]});_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':_0x910b('0x39'),'context':_0x413b04[_0x910b('0x1a')],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b[_0x910b('0x32')]+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04[_0x910b('0x1b')]});}else{_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x21'),'appdata':_0x910b('0x3a'),'context':_0x413b04['context'],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b[_0x910b('0x32')]+_0x1aaea7[_0x910b('0x12')]+_0x46260c++,'VoiceExtensionId':_0x413b04[_0x910b('0x1b')]});_0x482b2d[_0x910b('0x16')]({'type':_0x413b04[_0x910b('0x19')],'app':_0x910b('0x17'),'appdata':_0x910b('0x3b'),'context':_0x413b04[_0x910b('0x1a')],'exten':_0x413b04[_0x910b('0xb')],'priority':_0x3e370b[_0x910b('0x32')]+_0x1aaea7['priority']+_0x46260c++,'VoiceExtensionId':_0x413b04['VoiceExtensionId']});}}}for(var _0x52b53e=0x0;_0x52b53e<_0x3e370b[_0x910b('0x32')];_0x52b53e+=0x1){var _0x24600d=_0x1aaea7[_0x910b('0x12')]+_0x3e370b[_0x910b('0x32')];var _0x4a10a0=_0x52b53e===_0x3e370b[_0x910b('0x32')]-0x1?_0x1aaea7[_0x910b('0x12')]+_0x482b2d[_0x910b('0x32')]+_0x465327['length']+0x2:_0x1aaea7[_0x910b('0x12')]+_0x52b53e+0x1;_0x482b2d[_0x910b('0x3c')](_0x52b53e,0x0,{'type':_0x413b04[_0x910b('0x19')],'app':'GotoIfTime','appdata':_0x3e370b[_0x52b53e]+'?'+_0x413b04[_0x910b('0x1a')]+_0x910b('0x3d')+_0x24600d+':'+_0x413b04[_0x910b('0x1a')]+_0x910b('0x3d')+_0x4a10a0,'exten':_0x413b04[_0x910b('0xb')],'context':_0x413b04['context'],'priority':_0x1aaea7[_0x910b('0x12')]+_0x52b53e,'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});}_0x413b04[_0x910b('0x12')]=_0x482b2d[_0x910b('0x32')]?_[_0x910b('0x3e')](_0x482b2d)[_0x910b('0x12')]+0x1:_0x1aaea7[_0x910b('0x12')];_0x1aaea7['priority']=(_0x465327['length']?_[_0x910b('0x3e')](_0x465327)[_0x910b('0x12')]:_0x413b04[_0x910b('0x12')])+0x1;_0x1aaea7[_0x910b('0x13')]=_['concat'](_0x1aaea7[_0x910b('0x13')],_0x482b2d,[_0x413b04],_0x465327);}_0x1aaea7[_0x910b('0x13')][_0x910b('0x16')]({'type':_0x501d68[_0x4038c5][0x0][_0x910b('0x19')],'app':_0x910b('0x3f'),'exten':_0x501d68[_0x4038c5][0x0][_0x910b('0xb')],'context':_0x501d68[_0x4038c5][0x0][_0x910b('0x1a')],'priority':_0x1aaea7[_0x910b('0x12')],'VoiceExtensionId':_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]});_0x6488cc[_0x910b('0x16')](_0x501d68[_0x4038c5][0x0][_0x910b('0x1b')]);_0x3f4386=_[_0x910b('0x40')](_0x3f4386,_0x1aaea7[_0x910b('0x13')]);}}return _0xda82a9[_0x910b('0x41')](function(_0x4eae2b){return _0xda82a9[_0x910b('0x2')][_0x910b('0x6')][_0x910b('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x6488cc}},'transaction':_0x4eae2b})[_0x910b('0x8')](function(_0x2ccf3a){return _0xda82a9['models'][_0x910b('0x6')]['bulkCreate'](_['sortBy'](_0x3f4386,'priority'),{'transaction':_0x4eae2b});});});})[_0x910b('0x43')](function(_0x2fa5c3){console[_0x910b('0x44')](_0x2fa5c3);});}exports[_0x910b('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f57ec7f..b8a12ca 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 _0x338a=['finally','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','message','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','createdAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','into','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify'];(function(_0x53f33a,_0x361a3b){var _0x14dabf=function(_0x4f51ca){while(--_0x4f51ca){_0x53f33a['push'](_0x53f33a['shift']());}};_0x14dabf(++_0x361a3b);}(_0x338a,0x7e));var _0xa338=function(_0x57dc44,_0x480aaa){_0x57dc44=_0x57dc44-0x0;var _0x19f5bf=_0x338a[_0x57dc44];return _0x19f5bf;};'use strict';var BPromise=require('bluebird');var util=require(_0xa338('0x0'));var _=require(_0xa338('0x1'));var fs=require('fs');var squel=require(_0xa338('0x2'));var Papa=require(_0xa338('0x3'));var Redis=require(_0xa338('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xa338('0x5'));var logger=require(_0xa338('0x6'))(_0xa338('0x7'));config[_0xa338('0x8')]=_[_0xa338('0x9')](config['redis'],{'host':_0xa338('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa338('0xb'))['register'](socket);try{if(!process[_0xa338('0xc')][0x2]||process['argv'][0x2]===_0xa338('0xd')||process['argv'][0x2]===_0xa338('0xe')){throw new Error(_0xa338('0xf'));}var FILEPATH=process[_0xa338('0xc')][0x2];if(!process[_0xa338('0xc')][0x3]||process[_0xa338('0xc')][0x3]==='undefined'||process['argv'][0x3]===_0xa338('0xe')||!process[_0xa338('0xc')][0x4]||process[_0xa338('0xc')][0x4]==='undefined'||process[_0xa338('0xc')][0x4]==='null'){throw new Error(_0xa338('0x10'));}var FIELDS=_['zipObject'](process[_0xa338('0xc')][0x3][_0xa338('0x11')](','),process[_0xa338('0xc')][0x4][_0xa338('0x11')](','));if(!process[_0xa338('0xc')][0x5]||process[_0xa338('0xc')][0x5]===_0xa338('0xd')||process[_0xa338('0xc')][0x5]===_0xa338('0xe')){throw new Error(_0xa338('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xa338('0xc')][0x6]&&process[_0xa338('0xc')][0x6]!=='undefined'&&process[_0xa338('0xc')][0x6]!==_0xa338('0xe')?process[_0xa338('0xc')][0x6]:null;var DUPLICATES=process[_0xa338('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xa338('0xc')][0x7]!=='null'?process[_0xa338('0xc')][0x7]:null;if(!process[_0xa338('0xc')][0x8]||process[_0xa338('0xc')][0x8]===_0xa338('0xd')||process['argv'][0x8]===_0xa338('0xe')){throw new Error(_0xa338('0x13'));}var SOCKET_TIMESTAMP=process[_0xa338('0xc')][0x8];}catch(_0x16b199){logger[_0xa338('0x14')](_0x16b199);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(_0x14bb26,_0x2e9a67,_0x38e911,_0x4ef014){var _0x2db216={'message':_0x2e9a67};_0x2db216[_0x14bb26]=!![];if(_0x38e911){_0x2db216['contact']=_0x38e911;}if(_0x4ef014){_0x2db216[_0xa338('0x15')]=_0x4ef014;}return _0x2db216;}function isEmail(_0x3e1bcf){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))*$/[_0xa338('0x16')](_0x3e1bcf);}function checkRow(_0x5ee162,_0x52c2fc,_0xcf7e62){return new BPromise(function(_0x4f1985,_0x2aaaf5){if(_[_0xa338('0x17')](_0x5ee162)){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x18'),null,_0xcf7e62));}if(_0x5ee162[_0xa338('0x19')]&&_0x5ee162['errors'][_0xa338('0x1a')]){var _0x525914=_[_0xa338('0x1b')](_0x5ee162[_0xa338('0x19')],'message')['join'](';');return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0x525914,null,_0xcf7e62));}var _0x2edde3={};for(var _0x5d54dd in FIELDS){if(FIELDS[_0xa338('0x1c')](_0x5d54dd)&&FIELDS[_0x5d54dd]){_0x2edde3[_0x5d54dd]=_0x5ee162['data'][0x0][FIELDS[_0x5d54dd]]||_0x5ee162[_0xa338('0x1d')][0x0]['\ufeff'+FIELDS[_0x5d54dd]];}}if(!_0x2edde3['firstName']){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'firstName\x20not\x20specified!',null,_0xcf7e62));}if(!_0x2edde3[_0xa338('0x1e')]){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'phone\x20not\x20specified!',null,_0xcf7e62));}if(_0x2edde3[_0xa338('0x1f')]){var _0x2352c3=moment(_0x2edde3['birthDate'],_0xa338('0x20'));if(!_0x2352c3['isValid']()){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x21'),null,_0xcf7e62));}}if(_0x2edde3['email']){if(!isEmail(_0x2edde3[_0xa338('0x22')])){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x23'),null,_0xcf7e62));}}_0x2edde3['ListId']=LISTID;_0x2edde3[_0xa338('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa338('0x1a')]&&_0x52c2fc){var _0x469e34={};for(var _0x44da8f=0x0,_0x135a96=DUPLICATES[_0xa338('0x1a')];_0x44da8f<_0x135a96;_0x44da8f+=0x1){_0x469e34[DUPLICATES[_0x44da8f]]=_0x2edde3[DUPLICATES[_0x44da8f]];}var _0x156308=_[_0xa338('0x25')](_0x52c2fc,_0x469e34);if(_0x156308){return _0x2aaaf5(handleCheckRowError('duplicate',_0xa338('0x26'),_0x156308,_0xcf7e62));}}return db[_0xa338('0x27')][_0xa338('0x28')](_0x2edde3,{'raw':!![],'hooks':![],'fields':_[_0xa338('0x29')](_0x2edde3)})[_0xa338('0x2a')](function(_0x139a00){if(DUPLICATES&&DUPLICATES[_0xa338('0x1a')]&&_0x52c2fc){_0x52c2fc[_0xa338('0x2b')](_['pick'](_0x2edde3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x139a00['id'];return _0x4f1985();})['catch'](function(_0x1b99ec){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1b99ec[_0xa338('0x2c')]||JSON['stringify'](_0x1b99ec)),null,_0xcf7e62));});});}function checkHopper(){function _0x4e9a28(){return function(_0xb47b1f){logger[_0xa338('0x14')](_0xa338('0x2d'),_0xa338('0x2e'),util['inspect'](_0xb47b1f,{'showHidden':![],'depth':null}));};}var _0x3c96ff=function(_0x361898,_0x15e843){var _0x44bcd6=squel[_0xa338('0x2f')]()['into'](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),_0xa338('0x33'),_0xa338('0x34'),_0x15e843,'createdAt','updatedAt'],squel[_0xa338('0x35')]()[_0xa338('0x36')](_0xa338('0x1e'),_0xa338('0x1e'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x32'))[_0xa338('0x36')]('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),_0xa338('0x34'))['field'](_0x361898['id'][_0xa338('0x38')](),_0x15e843)[_0xa338('0x36')](_0xa338('0x37'),'createdAt')['field']('NOW()',_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))[_0xa338('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xa338('0x38')]())[_0xa338('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xa338('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa338('0x35')]()[_0xa338('0x36')](_0xa338('0x1e'))[_0xa338('0x3a')](_0xa338('0x30'))[_0xa338('0x3c')](_0x15e843+'\x20=\x20?',_0x361898['id'][_0xa338('0x38')]())))[_0xa338('0x38')]();return _0x44bcd6;};var _0x194e22=function(_0x1f215f,_0x3fcd43){var _0xae00b9=squel[_0xa338('0x2f')]()['into'](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),'ContactId',_0xa338('0x34'),_0x3fcd43,'createdAt','updatedAt'],squel[_0xa338('0x35')]()['field'](_0xa338('0x1e'),_0xa338('0x1e'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x32'))[_0xa338('0x36')]('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),_0xa338('0x34'))[_0xa338('0x36')](_0x1f215f['id'][_0xa338('0x38')](),_0x3fcd43)[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x3d'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x39'))['from'](_0xa338('0x3b'))['where'](_0xa338('0x3e'))['where'](_0xa338('0x3f'),LISTID['toString']())[_0xa338('0x3c')](_0xa338('0x40'),squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42'))[_0xa338('0x3c')](_0xa338('0x43'),squel[_0xa338('0x35')]()['field']('calleridnum')[_0xa338('0x3a')](_0xa338('0x44'))['where'](_0x3fcd43+_0xa338('0x45'),_0x1f215f['id'][_0xa338('0x38')]()))[_0xa338('0x3c')](_0xa338('0x43'),squel['select']()[_0xa338('0x36')]('phone')[_0xa338('0x3a')](_0xa338('0x30'))[_0xa338('0x3c')](_0x3fcd43+'\x20=\x20?',_0x1f215f['id']['toString']())))['toString']();return _0xae00b9;};function _0x301f68(_0x84f4ba,_0x3adfba){var _0x42ec8b=squel[_0xa338('0x2f')]()[_0xa338('0x46')](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),'ContactId','ListId',_0x3adfba,_0xa338('0x3d'),_0xa338('0x39')],squel[_0xa338('0x35')]()['field'](_0xa338('0x1e'),'phone')[_0xa338('0x36')](_0xa338('0x37'),'scheduledAt')[_0xa338('0x36')]('id',_0xa338('0x33'))['field'](LISTID['toString'](),_0xa338('0x34'))[_0xa338('0x36')](_0x84f4ba['id']['toString'](),_0x3adfba)[_0xa338('0x36')]('NOW()',_0xa338('0x3d'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))[_0xa338('0x3c')]('deletedAt\x20IS\x20NULL')[_0xa338('0x3c')]('ListId\x20=\x20?',LISTID[_0xa338('0x38')]())[_0xa338('0x3c')](_0xa338('0x40'),squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42')))[_0xa338('0x38')]();return _0x42ec8b;}function _0x3baf91(_0x36b594,_0x476d8b){var _0x32e363=squel[_0xa338('0x2f')]()[_0xa338('0x46')](_0xa338('0x47'))['fromQuery']([_0xa338('0x1e'),_0xa338('0x33'),'ListId',_0x476d8b,_0xa338('0x3d'),_0xa338('0x39')],squel['select']()[_0xa338('0x36')](_0xa338('0x1e'),_0xa338('0x1e'))['field']('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),'ListId')[_0xa338('0x36')](_0x36b594['id']['toString'](),_0x476d8b)[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x3d'))['field'](_0xa338('0x37'),_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))['where'](_0xa338('0x3e'))[_0xa338('0x3c')](_0xa338('0x3f'),LISTID[_0xa338('0x38')]())[_0xa338('0x3c')]('id\x20IN\x20?',squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42')))['toString']();return _0x32e363;}return db[_0xa338('0x48')][_0xa338('0x49')]({'where':{'type':_0xa338('0x4a')},'attributes':['id',_0xa338('0x4b')],'include':[{'model':db[_0xa338('0x4c')],'as':_0xa338('0x4d'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x571b9c){var _0x3c2d54=[];if(_0x571b9c){var _0x29d186;for(var _0x5acc6c=0x0,_0x4c791c;_0x5acc6c<_0x571b9c[_0xa338('0x1a')];_0x5acc6c+=0x1){_0x4c791c=_0x571b9c[_0x5acc6c][_0xa338('0x4e')]({'plain':!![]});switch(_0x4c791c[_0xa338('0x4b')]){case _0xa338('0x4f'):_0x3c2d54[_0xa338('0x2b')](db[_0xa338('0x50')]['query'](_0x194e22(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;case _0xa338('0x53'):_0x3c2d54['push'](db[_0xa338('0x50')][_0xa338('0x54')](_0x3c96ff(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;default:_0x3c2d54[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x301f68(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));}}}return _0x3c2d54;})[_0xa338('0x55')]()[_0xa338('0x2a')](function(){return db[_0xa338('0x48')][_0xa338('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa338('0x56'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x4030a6){var _0x3e6823=[];if(_0x4030a6){var _0x2916b9;for(var _0x49e579=0x0,_0x5164e8;_0x49e579<_0x4030a6[_0xa338('0x1a')];_0x49e579+=0x1){_0x5164e8=_0x4030a6[_0x49e579][_0xa338('0x4e')]({'plain':!![]});_0x3e6823[_0xa338('0x2b')](db['sequelize'][_0xa338('0x54')](_0x3baf91(_0x5164e8,'VoiceQueueId'))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));}}return _0x3e6823;})[_0xa338('0x55')]();})[_0xa338('0x2a')](function(){return db[_0xa338('0x57')][_0xa338('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa338('0x4c')],'as':_0xa338('0x4d'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x4765f7){var _0x1f223c=[];if(_0x4765f7){for(var _0x31599e=0x0,_0x1ce75d;_0x31599e<_0x4765f7[_0xa338('0x1a')];_0x31599e+=0x1){_0x1ce75d=_0x4765f7[_0x31599e][_0xa338('0x4e')]({'plain':!![]});switch(_0x1ce75d[_0xa338('0x4b')]){case _0xa338('0x4f'):_0x1f223c[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x194e22(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));break;case _0xa338('0x53'):_0x1f223c[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x3c96ff(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;default:_0x1f223c['push'](db[_0xa338('0x50')]['query'](_0x301f68(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));}}}return _0x1f223c;})['all']();})[_0xa338('0x2a')](function(){return db[_0xa338('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa338('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x2d77c6){var _0x3f0554=[];if(_0x2d77c6){for(var _0x37b8bb=0x0,_0x5561fc;_0x37b8bb<_0x2d77c6[_0xa338('0x1a')];_0x37b8bb+=0x1){_0x5561fc=_0x2d77c6[_0x37b8bb][_0xa338('0x4e')]({'plain':!![]});_0x3f0554[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x3baf91(_0x5561fc,_0xa338('0x58')))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));}}return _0x3f0554;})[_0xa338('0x55')]();})['catch'](function(_0x17077b){logger[_0xa338('0x14')](_0xa338('0x59'),'generalCheckHopper',_0x17077b[_0xa338('0x2c')]);});}var processPromises=function(_0x18edae){return BPromise[_0xa338('0x55')](promises)[_0xa338('0x2a')](function(_0x70dafb){})[_0xa338('0x52')](function(_0x3481ec){logger[_0xa338('0x14')](_0xa338('0x5a'),JSON[_0xa338('0x5b')](_0x3481ec));})[_0xa338('0x5c')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x18edae){return _0x18edae[_0xa338('0x5d')]();}});};var endCsv=function(){return BPromise[_0xa338('0x5e')]()[_0xa338('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xa338('0x2a')](function(){socket['emit'](_0xa338('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa338('0x60')](FILEPATH);}catch(_0x509131){logger['error'](_0xa338('0x61'),JSON[_0xa338('0x5b')](_0x509131));}finally{process[_0xa338('0x62')](0x0);}});};process['on'](_0xa338('0x63'),function(){logger[_0xa338('0x64')](_0xa338('0x65'));endCsv();});function main(){return BPromise[_0xa338('0x5e')]()[_0xa338('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa338('0x27')][_0xa338('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa338('0x2a')](function(_0x4db32b){var _0x4579df=fs[_0xa338('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa338('0x67')](_0x4579df,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4b0ad1,_0x4dd4a6){total+=0x1;var _0x5396f6=total;promises['push'](checkRow(_0x4b0ad1,_0x4db32b,_0x5396f6)[_0xa338('0x2a')](function(){success+=0x1;})['catch'](function(_0xc234a7){if(_0xc234a7[_0xa338('0x14')]){errors+=0x1;delete _0xc234a7[_0xa338('0x14')];}else if(_0xc234a7['duplicate']){duplicates+=0x1;delete _0xc234a7[_0xa338('0x68')];}rows['push'](_0xc234a7);}));if(total%0xc8===0x0){_0x4dd4a6[_0xa338('0x69')]();return processPromises(_0x4dd4a6);}},'complete':function(){return processPromises()[_0xa338('0x2a')](function(){logger[_0xa338('0x64')](_0xa338('0x6a'));endCsv();});},'error':function(_0x55656e,_0x5caa8c){logger['info'](_0xa338('0x6b'),JSON[_0xa338('0x5b')](_0x55656e));endCsv();}});})[_0xa338('0x52')](function(_0x5f3c66){logger[_0xa338('0x14')](_0xa338('0x6c'),JSON[_0xa338('0x5b')](_0x5f3c66));});}main(); \ No newline at end of file +var _0xd5af=['contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','get','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','../../../mysqldb','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20binding\x20parameters!','split','null','Missing\x20socket_timestamp\x20parameter!','error'];(function(_0x112abe,_0x2e0935){var _0x4f9d7d=function(_0x7de49e){while(--_0x7de49e){_0x112abe['push'](_0x112abe['shift']());}};_0x4f9d7d(++_0x2e0935);}(_0xd5af,0xc3));var _0xfd5a=function(_0x37397f,_0x336885){_0x37397f=_0x37397f-0x0;var _0x94a125=_0xd5af[_0x37397f];return _0x94a125;};'use strict';var BPromise=require(_0xfd5a('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xfd5a('0x1'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xfd5a('0x2'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfd5a('0x3'));config[_0xfd5a('0x4')]=_['defaults'](config[_0xfd5a('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd5a('0x5'))(new Redis(config[_0xfd5a('0x4')]));require(_0xfd5a('0x6'))[_0xfd5a('0x7')](socket);try{if(!process[_0xfd5a('0x8')][0x2]||process[_0xfd5a('0x8')][0x2]===_0xfd5a('0x9')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xfd5a('0x8')][0x3]||process[_0xfd5a('0x8')][0x3]===_0xfd5a('0x9')||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0xfd5a('0x8')][0x4]===_0xfd5a('0x9')||process['argv'][0x4]==='null'){throw new Error(_0xfd5a('0xa'));}var FIELDS=_['zipObject'](process[_0xfd5a('0x8')][0x3][_0xfd5a('0xb')](','),process['argv'][0x4]['split'](','));if(!process[_0xfd5a('0x8')][0x5]||process['argv'][0x5]===_0xfd5a('0x9')||process[_0xfd5a('0x8')][0x5]===_0xfd5a('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xfd5a('0x8')][0x5];var COMPANYID=process[_0xfd5a('0x8')][0x6]&&process['argv'][0x6]!==_0xfd5a('0x9')&&process[_0xfd5a('0x8')][0x6]!==_0xfd5a('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0xfd5a('0x8')][0x7]&&process[_0xfd5a('0x8')][0x7]!==_0xfd5a('0x9')&&process[_0xfd5a('0x8')][0x7]!==_0xfd5a('0xc')?process[_0xfd5a('0x8')][0x7]:null;if(!process[_0xfd5a('0x8')][0x8]||process[_0xfd5a('0x8')][0x8]===_0xfd5a('0x9')||process[_0xfd5a('0x8')][0x8]==='null'){throw new Error(_0xfd5a('0xd'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x23a1b1){logger[_0xfd5a('0xe')](_0x23a1b1);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(_0x3887e3,_0x55ba8d,_0x335c60,_0x189d75){var _0x1cfb51={'message':_0x55ba8d};_0x1cfb51[_0x3887e3]=!![];if(_0x335c60){_0x1cfb51[_0xfd5a('0xf')]=_0x335c60;}if(_0x189d75){_0x1cfb51[_0xfd5a('0x10')]=_0x189d75;}return _0x1cfb51;}function isEmail(_0x2d802c){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))*$/[_0xfd5a('0x11')](_0x2d802c);}function checkRow(_0x566e4f,_0x202601,_0x22207c){return new BPromise(function(_0x1e4957,_0x45e707){if(_[_0xfd5a('0x12')](_0x566e4f)){return _0x45e707(handleCheckRowError('error',_0xfd5a('0x13'),null,_0x22207c));}if(_0x566e4f['errors']&&_0x566e4f[_0xfd5a('0x14')][_0xfd5a('0x15')]){var _0x3373b0=_[_0xfd5a('0x16')](_0x566e4f[_0xfd5a('0x14')],_0xfd5a('0x17'))['join'](';');return _0x45e707(handleCheckRowError(_0xfd5a('0xe'),_0x3373b0,null,_0x22207c));}var _0x2ed76e={};for(var _0x256b6c in FIELDS){if(FIELDS[_0xfd5a('0x18')](_0x256b6c)&&FIELDS[_0x256b6c]){_0x2ed76e[_0x256b6c]=_0x566e4f['data'][0x0][FIELDS[_0x256b6c]]||_0x566e4f['data'][0x0]['\ufeff'+FIELDS[_0x256b6c]];}}if(!_0x2ed76e[_0xfd5a('0x19')]){return _0x45e707(handleCheckRowError(_0xfd5a('0xe'),_0xfd5a('0x1a'),null,_0x22207c));}if(!_0x2ed76e[_0xfd5a('0x1b')]){return _0x45e707(handleCheckRowError('error',_0xfd5a('0x1c'),null,_0x22207c));}if(_0x2ed76e['birthDate']){var _0xff5821=moment(_0x2ed76e[_0xfd5a('0x1d')],_0xfd5a('0x1e'));if(!_0xff5821[_0xfd5a('0x1f')]()){return _0x45e707(handleCheckRowError(_0xfd5a('0xe'),_0xfd5a('0x20'),null,_0x22207c));}}if(_0x2ed76e['email']){if(!isEmail(_0x2ed76e[_0xfd5a('0x21')])){return _0x45e707(handleCheckRowError(_0xfd5a('0xe'),_0xfd5a('0x22'),null,_0x22207c));}}_0x2ed76e[_0xfd5a('0x23')]=LISTID;_0x2ed76e[_0xfd5a('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xfd5a('0x15')]&&_0x202601){var _0x316e4a={};for(var _0x92a9a0=0x0,_0x2e0301=DUPLICATES[_0xfd5a('0x15')];_0x92a9a0<_0x2e0301;_0x92a9a0+=0x1){_0x316e4a[DUPLICATES[_0x92a9a0]]=_0x2ed76e[DUPLICATES[_0x92a9a0]];}var _0x4529b1=_[_0xfd5a('0x25')](_0x202601,_0x316e4a);if(_0x4529b1){return _0x45e707(handleCheckRowError(_0xfd5a('0x26'),_0xfd5a('0x27'),_0x4529b1,_0x22207c));}}return db[_0xfd5a('0x28')]['create'](_0x2ed76e,{'raw':!![],'hooks':![],'fields':_[_0xfd5a('0x29')](_0x2ed76e)})[_0xfd5a('0x2a')](function(_0x540eb0){if(DUPLICATES&&DUPLICATES['length']&&_0x202601){_0x202601[_0xfd5a('0x2b')](_['pick'](_0x2ed76e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x540eb0['id'];return _0x1e4957();})[_0xfd5a('0x2c')](function(_0x2c99eb){return _0x45e707(handleCheckRowError(_0xfd5a('0xe'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2c99eb[_0xfd5a('0x17')]||JSON[_0xfd5a('0x2d')](_0x2c99eb)),null,_0x22207c));});});}function checkHopper(){function _0x383621(){return function(_0x2410bc){logger[_0xfd5a('0xe')]('cmContact',_0xfd5a('0x2e'),util[_0xfd5a('0x2f')](_0x2410bc,{'showHidden':![],'depth':null}));};}var _0x44cdef=function(_0x7783cb,_0x195467){var _0x38e31e=squel[_0xfd5a('0x30')]()[_0xfd5a('0x31')](_0xfd5a('0x32'))[_0xfd5a('0x33')]([_0xfd5a('0x1b'),'scheduledAt',_0xfd5a('0x34'),_0xfd5a('0x23'),_0x195467,_0xfd5a('0x35'),'updatedAt'],squel[_0xfd5a('0x36')]()['field']('phone',_0xfd5a('0x1b'))[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x39'))[_0xfd5a('0x37')]('id',_0xfd5a('0x34'))[_0xfd5a('0x37')](LISTID['toString'](),_0xfd5a('0x23'))[_0xfd5a('0x37')](_0x7783cb['id'][_0xfd5a('0x3a')](),_0x195467)[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x35'))[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x3b'))[_0xfd5a('0x3c')](_0xfd5a('0x3d'))[_0xfd5a('0x3e')](_0xfd5a('0x3f'))[_0xfd5a('0x3e')](_0xfd5a('0x40'),LISTID[_0xfd5a('0x3a')]())[_0xfd5a('0x3e')](_0xfd5a('0x41'))[_0xfd5a('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfd5a('0x36')]()[_0xfd5a('0x37')]('phone')[_0xfd5a('0x3c')]('cm_hopper')[_0xfd5a('0x3e')](_0x195467+'\x20=\x20?',_0x7783cb['id'][_0xfd5a('0x3a')]())))['toString']();return _0x38e31e;};var _0x17a3d2=function(_0x2559b7,_0x59812e){var _0x5925e1=squel[_0xfd5a('0x30')]()[_0xfd5a('0x31')](_0xfd5a('0x32'))[_0xfd5a('0x33')]([_0xfd5a('0x1b'),'scheduledAt',_0xfd5a('0x34'),_0xfd5a('0x23'),_0x59812e,_0xfd5a('0x35'),_0xfd5a('0x3b')],squel[_0xfd5a('0x36')]()[_0xfd5a('0x37')](_0xfd5a('0x1b'),_0xfd5a('0x1b'))['field'](_0xfd5a('0x38'),'scheduledAt')['field']('id',_0xfd5a('0x34'))['field'](LISTID[_0xfd5a('0x3a')](),_0xfd5a('0x23'))[_0xfd5a('0x37')](_0x2559b7['id'][_0xfd5a('0x3a')](),_0x59812e)[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x35'))[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x3b'))[_0xfd5a('0x3c')](_0xfd5a('0x3d'))[_0xfd5a('0x3e')]('deletedAt\x20IS\x20NULL')[_0xfd5a('0x3e')]('ListId\x20=\x20?',LISTID[_0xfd5a('0x3a')]())['where'](_0xfd5a('0x42'),squel[_0xfd5a('0x43')](hopperContacts))[_0xfd5a('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xfd5a('0x3e')](_0xfd5a('0x44'),squel[_0xfd5a('0x36')]()[_0xfd5a('0x37')](_0xfd5a('0x45'))['from']('cm_hopper_final')[_0xfd5a('0x3e')](_0x59812e+_0xfd5a('0x46'),_0x2559b7['id'][_0xfd5a('0x3a')]()))[_0xfd5a('0x3e')](_0xfd5a('0x44'),squel[_0xfd5a('0x36')]()['field'](_0xfd5a('0x1b'))[_0xfd5a('0x3c')](_0xfd5a('0x32'))['where'](_0x59812e+_0xfd5a('0x46'),_0x2559b7['id']['toString']())))[_0xfd5a('0x3a')]();return _0x5925e1;};function _0x203087(_0x362c23,_0xab52e4){var _0x1935b7=squel[_0xfd5a('0x30')]()[_0xfd5a('0x31')](_0xfd5a('0x32'))[_0xfd5a('0x33')]([_0xfd5a('0x1b'),'scheduledAt',_0xfd5a('0x34'),_0xfd5a('0x23'),_0xab52e4,_0xfd5a('0x35'),'updatedAt'],squel[_0xfd5a('0x36')]()['field'](_0xfd5a('0x1b'),_0xfd5a('0x1b'))[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x39'))['field']('id',_0xfd5a('0x34'))[_0xfd5a('0x37')](LISTID[_0xfd5a('0x3a')](),'ListId')[_0xfd5a('0x37')](_0x362c23['id']['toString'](),_0xab52e4)[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x35'))[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x3b'))[_0xfd5a('0x3c')](_0xfd5a('0x3d'))[_0xfd5a('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0xfd5a('0x40'),LISTID[_0xfd5a('0x3a')]())[_0xfd5a('0x3e')](_0xfd5a('0x42'),squel[_0xfd5a('0x43')](hopperContacts))[_0xfd5a('0x3e')](_0xfd5a('0x41')))[_0xfd5a('0x3a')]();return _0x1935b7;}function _0x270f09(_0x2d7088,_0x384e85){var _0x44dce3=squel['insert']()[_0xfd5a('0x31')](_0xfd5a('0x47'))[_0xfd5a('0x33')](['phone',_0xfd5a('0x34'),_0xfd5a('0x23'),_0x384e85,_0xfd5a('0x35'),_0xfd5a('0x3b')],squel[_0xfd5a('0x36')]()[_0xfd5a('0x37')]('phone',_0xfd5a('0x1b'))[_0xfd5a('0x37')]('id',_0xfd5a('0x34'))[_0xfd5a('0x37')](LISTID['toString'](),'ListId')[_0xfd5a('0x37')](_0x2d7088['id']['toString'](),_0x384e85)[_0xfd5a('0x37')](_0xfd5a('0x38'),_0xfd5a('0x35'))['field'](_0xfd5a('0x38'),_0xfd5a('0x3b'))[_0xfd5a('0x3c')](_0xfd5a('0x3d'))['where'](_0xfd5a('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0xfd5a('0x3a')]())['where']('id\x20IN\x20?',squel[_0xfd5a('0x43')](hopperContacts))[_0xfd5a('0x3e')](_0xfd5a('0x41')))['toString']();return _0x44dce3;}return db[_0xfd5a('0x48')][_0xfd5a('0x49')]({'where':{'type':_0xfd5a('0x4a')},'attributes':['id',_0xfd5a('0x4b')],'include':[{'model':db[_0xfd5a('0x4c')],'as':_0xfd5a('0x4d'),'where':{'id':LISTID}}]})[_0xfd5a('0x2a')](function(_0x3ff51a){var _0x348bfb=[];if(_0x3ff51a){var _0x5831b6;for(var _0x5e622a=0x0,_0x1b51d9;_0x5e622a<_0x3ff51a[_0xfd5a('0x15')];_0x5e622a+=0x1){_0x1b51d9=_0x3ff51a[_0x5e622a]['get']({'plain':!![]});switch(_0x1b51d9[_0xfd5a('0x4b')]){case _0xfd5a('0x4e'):_0x348bfb[_0xfd5a('0x2b')](db['sequelize'][_0xfd5a('0x4f')](_0x17a3d2(_0x1b51d9,_0xfd5a('0x50')))[_0xfd5a('0x2a')](function(){})[_0xfd5a('0x2c')](_0x383621()));break;case _0xfd5a('0x51'):_0x348bfb[_0xfd5a('0x2b')](db[_0xfd5a('0x52')]['query'](_0x44cdef(_0x1b51d9,_0xfd5a('0x50')))[_0xfd5a('0x2a')](function(){})['catch'](_0x383621()));break;default:_0x348bfb[_0xfd5a('0x2b')](db[_0xfd5a('0x52')][_0xfd5a('0x4f')](_0x203087(_0x1b51d9,_0xfd5a('0x50')))[_0xfd5a('0x2a')](function(){})['catch'](_0x383621()));}}}return _0x348bfb;})[_0xfd5a('0x53')]()[_0xfd5a('0x2a')](function(){return db[_0xfd5a('0x48')][_0xfd5a('0x49')]({'where':{'type':_0xfd5a('0x4a')},'attributes':['id'],'include':[{'model':db[_0xfd5a('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xfd5a('0x2a')](function(_0x5de6e7){var _0x61c3b7=[];if(_0x5de6e7){var _0x232444;for(var _0x3ee943=0x0,_0x4f7c93;_0x3ee943<_0x5de6e7[_0xfd5a('0x15')];_0x3ee943+=0x1){_0x4f7c93=_0x5de6e7[_0x3ee943][_0xfd5a('0x54')]({'plain':!![]});_0x61c3b7[_0xfd5a('0x2b')](db[_0xfd5a('0x52')]['query'](_0x270f09(_0x4f7c93,_0xfd5a('0x50')))[_0xfd5a('0x2a')](function(){})[_0xfd5a('0x2c')](_0x383621()));}}return _0x61c3b7;})[_0xfd5a('0x53')]();})['then'](function(){return db[_0xfd5a('0x55')][_0xfd5a('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xfd5a('0x4c')],'as':_0xfd5a('0x4d'),'where':{'id':LISTID}}]})[_0xfd5a('0x2a')](function(_0x342faa){var _0x4c2b6c=[];if(_0x342faa){for(var _0x2897fa=0x0,_0x176599;_0x2897fa<_0x342faa[_0xfd5a('0x15')];_0x2897fa+=0x1){_0x176599=_0x342faa[_0x2897fa][_0xfd5a('0x54')]({'plain':!![]});switch(_0x176599['dialCheckDuplicateType']){case _0xfd5a('0x4e'):_0x4c2b6c[_0xfd5a('0x2b')](db['sequelize'][_0xfd5a('0x4f')](_0x17a3d2(_0x176599,_0xfd5a('0x56')))[_0xfd5a('0x2a')](function(){})['catch'](_0x383621()));break;case _0xfd5a('0x51'):_0x4c2b6c[_0xfd5a('0x2b')](db[_0xfd5a('0x52')][_0xfd5a('0x4f')](_0x44cdef(_0x176599,_0xfd5a('0x56')))[_0xfd5a('0x2a')](function(){})['catch'](_0x383621()));break;default:_0x4c2b6c[_0xfd5a('0x2b')](db[_0xfd5a('0x52')][_0xfd5a('0x4f')](_0x203087(_0x176599,'CampaignId'))[_0xfd5a('0x2a')](function(){})[_0xfd5a('0x2c')](_0x383621()));}}}return _0x4c2b6c;})['all']();})[_0xfd5a('0x2a')](function(){return db[_0xfd5a('0x55')][_0xfd5a('0x49')]({'attributes':['id'],'include':[{'model':db[_0xfd5a('0x4c')],'as':_0xfd5a('0x57'),'where':{'id':LISTID}}]})[_0xfd5a('0x2a')](function(_0x5d6a09){var _0x307d6b=[];if(_0x5d6a09){for(var _0x25f78e=0x0,_0x565509;_0x25f78e<_0x5d6a09[_0xfd5a('0x15')];_0x25f78e+=0x1){_0x565509=_0x5d6a09[_0x25f78e][_0xfd5a('0x54')]({'plain':!![]});_0x307d6b['push'](db[_0xfd5a('0x52')]['query'](_0x270f09(_0x565509,_0xfd5a('0x56')))[_0xfd5a('0x2a')](function(){})['catch'](_0x383621()));}}return _0x307d6b;})['all']();})[_0xfd5a('0x2c')](function(_0x37abfd){logger[_0xfd5a('0xe')](_0xfd5a('0x58'),_0xfd5a('0x59'),_0x37abfd[_0xfd5a('0x17')]);});}var processPromises=function(_0x36040f){return BPromise[_0xfd5a('0x53')](promises)[_0xfd5a('0x2a')](function(_0x3cdd02){})['catch'](function(_0x171c16){logger[_0xfd5a('0xe')](_0xfd5a('0x5a'),JSON[_0xfd5a('0x2d')](_0x171c16));})[_0xfd5a('0x5b')](function(){socket['emit'](_0xfd5a('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x36040f){return _0x36040f[_0xfd5a('0x5d')]();}});};var endCsv=function(){return BPromise[_0xfd5a('0x5e')]()[_0xfd5a('0x2a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xfd5a('0x5f')](_0xfd5a('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xfd5a('0x60')](FILEPATH);}catch(_0x13bfa7){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xfd5a('0x2d')](_0x13bfa7));}finally{process[_0xfd5a('0x61')](0x0);}});};process['on'](_0xfd5a('0x62'),function(){logger[_0xfd5a('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xfd5a('0x5e')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xfd5a('0xb')](',');return db['CmContact'][_0xfd5a('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfd5a('0x2a')](function(_0x5ae041){var _0x3e1611=fs[_0xfd5a('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfd5a('0x65')](_0x3e1611,{'header':!![],'skipEmptyLines':!![],'step':function(_0xa5b7b4,_0x36cbb7){total+=0x1;var _0x3af709=total;promises['push'](checkRow(_0xa5b7b4,_0x5ae041,_0x3af709)['then'](function(){success+=0x1;})[_0xfd5a('0x2c')](function(_0x283f37){if(_0x283f37[_0xfd5a('0xe')]){errors+=0x1;delete _0x283f37[_0xfd5a('0xe')];}else if(_0x283f37[_0xfd5a('0x26')]){duplicates+=0x1;delete _0x283f37[_0xfd5a('0x26')];}rows[_0xfd5a('0x2b')](_0x283f37);}));if(total%0xc8===0x0){_0x36cbb7[_0xfd5a('0x66')]();return processPromises(_0x36cbb7);}},'complete':function(){return processPromises()[_0xfd5a('0x2a')](function(){logger[_0xfd5a('0x63')](_0xfd5a('0x67'));endCsv();});},'error':function(_0x32b7b7,_0x341a7e){logger[_0xfd5a('0x63')]('CSV\x20parse\x20error',JSON['stringify'](_0x32b7b7));endCsv();}});})['catch'](function(_0x1a18ec){logger[_0xfd5a('0xe')](_0xfd5a('0x68'),JSON['stringify'](_0x1a18ec));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d32bcd7..85fc39e 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 _0xb22c=['voice_queues_has_cm_lists.CmListId=','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','find','_description','hasOwnProperty','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','trim','replace','itemTypeId','description','appendFileSync','rows','emit','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','split','then','isNil','filter','findOne','update','updated','CmContactHasItem','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','ListId\x20=\x20?','priority','.CmListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','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?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0xb22c,0x108));var _0xcb22=function(_0x55aa8a,_0x1bbae4){_0x55aa8a=_0x55aa8a-0x0;var _0x2e4710=_0xb22c[_0x55aa8a];return _0x2e4710;};'use strict';var fs=require('fs');var path=require(_0xcb22('0x0'));var _=require(_0xcb22('0x1'));var Papa=require(_0xcb22('0x2'));var util=require(_0xcb22('0x3'));var BPromise=require(_0xcb22('0x4'));var moment=require(_0xcb22('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xcb22('0x6'))['db'];var config=require(_0xcb22('0x7'));var shared=require(_0xcb22('0x8'));var logger=require(_0xcb22('0x9'))(_0xcb22('0xa'));config[_0xcb22('0xb')]=_[_0xcb22('0xc')](config['redis'],{'host':_0xcb22('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb22('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xcb22('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xcb22('0xf')](_0xcb22('0xe'));function isEmail(_0x464117){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))*$/[_0xcb22('0x10')](_0x464117);}function selectNotIn(_0x5e4633,_0x3ba3c7,_0x5362d0,_0x2082b5,_0x4d41b5){return squel[_0xcb22('0x11')]()[_0xcb22('0x12')](_0xcb22('0x13'))['from'](_0x2082b5)[_0xcb22('0x14')](_0x3ba3c7,null,_0x3ba3c7+_0xcb22('0x15')+_0x2082b5+'.'+_0x5362d0)[_0xcb22('0x16')](_0x2082b5+'.'+_0x5362d0+_0xcb22('0x17')+_0x5e4633+'.'+_0x5362d0)[_0xcb22('0x16')](_0x3ba3c7+_0xcb22('0x18')+_0x4d41b5['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x51a846,_0x4a29c4){promisesAdditionalPhones=[];return db[_0xcb22('0x19')][_0xcb22('0x1a')]({'raw':!![],'attributes':['id',_0xcb22('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4a23c4){if(_0x4a23c4!==null){var _0x2f08bf=[];for(var _0x1969cd=0x0;_0x1969cd<_0x4a23c4[_0xcb22('0x1c')];_0x1969cd++){var _0x355212=_0x4a23c4[_0x1969cd];_0x2f08bf[_0xcb22('0x1d')](insertAdditionalPhones(_0x355212));}}Promise[_0xcb22('0x1e')](_0x2f08bf)['then'](function(){_0x51a846({'val':0x1});});});});}function insertAdditionalPhones(_0x1902cb){return new Promise(function(_0x282c56,_0x42ed7b){var _0x4041fb=_0x1902cb[_0xcb22('0x1b')];var _0x2e9f78=_0x4041fb[_0xcb22('0x1f')](';');var _0x5d4109=[];orderBy=0x0;for(var _0x1cffe3=0x0;_0x1cffe3<_0x2e9f78[_0xcb22('0x1c')];_0x1cffe3++){_0x5d4109[_0xcb22('0x1d')](splitAdditionalPhone(_0x1902cb['id'],_0x2e9f78[_0x1cffe3]));}Promise[_0xcb22('0x1e')](_0x5d4109)[_0xcb22('0x20')](function(){_0x282c56({'val':_0x2e9f78['length']});});});}function splitAdditionalPhone(_0x6bb31b,_0x4804a8){return new Promise(function(_0x45ec05,_0x3e6b47){var _0x78021f=_0x4804a8[_0xcb22('0x1f')](':');var _0x48f580=_0x78021f[0x0];var _0x3ea145=_0x78021f[0x1];if(!_[_0xcb22('0x21')](_0x3ea145)){var _0x37a218=_0x3ea145[_0xcb22('0x1f')]('|');var _0x4dc271=[];for(var _0x97fc6e=0x0;_0x97fc6e<_0x37a218[_0xcb22('0x1c')];_0x97fc6e++){if(_0x37a218[_0x97fc6e]!==''){var _0x56895c=_[_0xcb22('0x22')](promisesAdditionalPhones,{'contactId':_0x6bb31b,'phone':_0x37a218[_0x97fc6e]});if(_0x56895c['length']==0x0){orderBy++;promisesAdditionalPhones[_0xcb22('0x1d')]({'contactId':_0x6bb31b,'contactTypeId':_0x48f580,'phone':_0x37a218[_0x97fc6e],'orderBy':orderBy});}}}_0x45ec05({'ok':0x1});}else _0x45ec05({'res':0x0});});}function createAdditionalPhone(_0x382ae1,_0x1818fd,_0x4833a4,_0x474abf){var _0x93ceec='';var _0x168998='';var _0x144b91=_0x4833a4[_0xcb22('0x1f')]('§');_0x93ceec=_0x144b91[0x0];if(_0x144b91[_0xcb22('0x1c')]==0x2)_0x168998=_0x144b91[0x1];return new Promise(function(_0x5b9316,_0x18456e){return db['CmContactHasItem'][_0xcb22('0x23')]({'where':{'CmContactId':_0x382ae1,'item':_0x93ceec}})[_0xcb22('0x20')](function(_0xd7e779){if(_0xd7e779){return db['CmContactHasItem'][_0xcb22('0x24')]({'ItemTypeId':_0x1818fd,'description':_0x168998,'OrderBy':_0x474abf},{'where':{'CmContactId':_0x382ae1,'item':_0x93ceec}})['then'](function(_0x3aefdd){_0x5b9316({'res':_0xcb22('0x25')});});}else{return db[_0xcb22('0x26')]['create']({'CmContactId':_0x382ae1,'item':_0x93ceec,'description':_0x168998,'ItemTypeId':_0x1818fd,'OrderBy':_0x474abf,'ItemClass':_0xcb22('0x27')})[_0xcb22('0x20')](function(_0x393fa){_0x5b9316({'res':_0xcb22('0x28')});});}});});}function insertCmHopper(_0x193020,_0x44a618,_0x1b4ae7,_0x1ccb75,_0x16f3c3){var _0x5b6842=[_0xcb22('0x29'),'cm_contacts.scheduledat','cm_contacts.id',_0xcb22('0x2a'),_0x44a618+'.'+_0x1ccb75,_0xcb22('0x2b'),_0xcb22('0x2c'),_0xcb22('0x2d'),_0xcb22('0x2e'),'\x22'+_0x16f3c3+'\x22'];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x31'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x33'),_0xcb22('0x34'),_0xcb22('0x35'),_0x1ccb75,_0xcb22('0x36'),_0xcb22('0x37'),'priority',_0xcb22('0x38'),_0xcb22('0x39')],squel['select']()[_0xcb22('0x3a')](_0x5b6842)[_0xcb22('0x3b')](_0x44a618)[_0xcb22('0x14')](_0xcb22('0x3c'),null,_0xcb22('0x3d')+_0x44a618+_0xcb22('0x3e'))[_0xcb22('0x14')](_0x1b4ae7,null,_0x1b4ae7+_0xcb22('0x15')+_0x44a618+'.'+_0x1ccb75)[_0xcb22('0x16')](_0x44a618+'.CmListId\x20=\x20?',_0x193020)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x44a618,_0x1b4ae7,_0x1ccb75,_0xcb22('0x31'),[_0xcb22('0x41'),_0xcb22('0x42')]))[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x44a618,_0x1b4ae7,_0x1ccb75,_0xcb22('0x31'),[_0xcb22('0x41')])))[_0xcb22('0x43')]();}function insertCmHopperBlack(_0x27b13a,_0x5a7b7b,_0x36dcca,_0x43a81b){var _0x21cbf3=[_0xcb22('0x29'),_0xcb22('0x44'),_0xcb22('0x2a'),_0x5a7b7b+'.'+_0x43a81b,_0xcb22('0x2b'),_0xcb22('0x2c')];return squel['insert']()['into'](_0xcb22('0x45'))[_0xcb22('0x32')]([_0xcb22('0x13'),'ContactId','ListId',_0x43a81b,_0xcb22('0x36'),'updatedAt'],squel['select']()[_0xcb22('0x3a')](_0x21cbf3)['from'](_0x5a7b7b)[_0xcb22('0x14')](_0xcb22('0x3c'),null,_0xcb22('0x3d')+_0x5a7b7b+_0xcb22('0x3e'))['join'](_0x36dcca,null,_0x36dcca+'.id\x20=\x20'+_0x5a7b7b+'.'+_0x43a81b)['where'](_0x5a7b7b+'.CmListId\x20=\x20?',_0x27b13a)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')](_0xcb22('0x40'),squel[_0xcb22('0x11')]()['field'](_0xcb22('0x13'))[_0xcb22('0x3b')](_0xcb22('0x45'))[_0xcb22('0x16')](_0xcb22('0x46'),_0x27b13a)[_0xcb22('0x16')](_0x43a81b+_0xcb22('0x17')+_0x5a7b7b+'.'+_0x43a81b)))[_0xcb22('0x43')]();}function insertTzCmHopper(_0x13f82d,_0x47df32,_0x188651,_0x3bc17e,_0x11e743,_0x4aef67){var _0x23b7b4=[_0xcb22('0x29'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4aef67+'.offset-cm_contacts.utcOffset\x20minute)',_0xcb22('0x44'),_0xcb22('0x2a'),_0x47df32+'.'+_0x3bc17e,_0xcb22('0x2b'),_0xcb22('0x2c'),_0xcb22('0x2d'),_0xcb22('0x2e'),'\x22'+_0x11e743+'\x22'];var _0x4d6a2f=squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x31'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x33'),_0xcb22('0x34'),_0xcb22('0x35'),_0x3bc17e,_0xcb22('0x36'),_0xcb22('0x37'),_0xcb22('0x47'),_0xcb22('0x38'),_0xcb22('0x39')],squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](_0x23b7b4)['from'](_0x47df32)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x47df32+_0xcb22('0x3e'))[_0xcb22('0x14')](_0x188651,null,_0x188651+'.id\x20=\x20'+_0x47df32+'.'+_0x3bc17e)[_0xcb22('0x14')](_0x4aef67,null,_0x4aef67+_0xcb22('0x15')+_0x47df32+'.'+_0x3bc17e)[_0xcb22('0x16')](_0x47df32+_0xcb22('0x48'),_0x13f82d)[_0xcb22('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xcb22('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x47df32,_0x188651,_0x3bc17e,'cm_hopper',[_0xcb22('0x41'),_0xcb22('0x42')]))[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x47df32,_0x188651,_0x3bc17e,'cm_hopper',[_0xcb22('0x41')])))[_0xcb22('0x43')]();return _0x4d6a2f;}function insertTzCmHopperBlack(_0x32689b,_0x3dc565,_0x218ec4,_0x94f2a3){var _0x80000a=[_0xcb22('0x29'),_0xcb22('0x44'),_0xcb22('0x2a'),_0x3dc565+'.'+_0x94f2a3,'cm_contacts.createdAt',_0xcb22('0x2c')];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x45'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x34'),'ListId',_0x94f2a3,_0xcb22('0x36'),_0xcb22('0x37')],squel[_0xcb22('0x11')]()['fields'](_0x80000a)[_0xcb22('0x3b')](_0x3dc565)['join']('cm_contacts',null,_0xcb22('0x3d')+_0x3dc565+_0xcb22('0x3e'))['join'](_0x218ec4,null,_0x218ec4+_0xcb22('0x15')+_0x3dc565+'.'+_0x94f2a3)[_0xcb22('0x16')](_0x3dc565+_0xcb22('0x48'),_0x32689b)['where'](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcb22('0x12')](_0xcb22('0x13'))[_0xcb22('0x3b')](_0xcb22('0x45'))[_0xcb22('0x16')](_0xcb22('0x46'),_0x32689b)[_0xcb22('0x16')](_0x94f2a3+'\x20=\x20'+_0x3dc565+'.'+_0x94f2a3)))[_0xcb22('0x43')]();}function insertCmHopperAdditionalPhones(_0x5b4166){var _0x17cc0a=[_0xcb22('0x49'),_0xcb22('0x4a'),_0xcb22('0x4b'),_0xcb22('0x4c'),_0xcb22('0x4d')];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')]('cm_hopper_additional_phones')['fromQuery']([_0xcb22('0x4e'),'phone','OrderBy',_0xcb22('0x36'),_0xcb22('0x37')],squel[_0xcb22('0x11')]()['fields'](_0x17cc0a)[_0xcb22('0x3b')](_0xcb22('0x31'))[_0xcb22('0x14')]('cm_contacts',null,_0xcb22('0x4f'))[_0xcb22('0x14')](_0xcb22('0x50'),null,_0xcb22('0x51'))[_0xcb22('0x16')](_0xcb22('0x52'),_0x5b4166)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW))[_0xcb22('0x43')]();}function insertCmContact(_0x371435,_0x3d596f,_0x554c6f,_0x5b3600){var _0x3f246b=_[_0xcb22('0x53')](_[_0xcb22('0x54')](_0x5b3600),['ListId',_0xcb22('0x55'),_0xcb22('0x36'),_0xcb22('0x37'),_0xcb22('0x56')]);return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x3c'))[_0xcb22('0x32')](_0x3f246b,squel['select']()['fields'](_0x3f246b)['from'](_0x3d596f)[_0xcb22('0x16')]('('+_0x554c6f[_0xcb22('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](_0x554c6f)[_0xcb22('0x3b')]('cm_contacts')[_0xcb22('0x16')](_0xcb22('0x46'),_0x371435)[_0xcb22('0x16')](_0xcb22('0x57')))['where'](_0xcb22('0x58'),squel[_0xcb22('0x11')]()[_0xcb22('0x12')](_0xcb22('0x59'),'min_id')[_0xcb22('0x3b')](_0x3d596f)[_0xcb22('0x5a')](_0x554c6f[_0xcb22('0x14')](','))))[_0xcb22('0x43')]();}function handleStop(){logger[_0xcb22('0x5b')](_0xcb22('0x5c'));stopped=!![];}function handleUncaughtException(_0x1ad81f){logger[_0xcb22('0x5d')](_0x1ad81f[_0xcb22('0x5e')]);process[_0xcb22('0x5f')](0x1);}function handleError(_0x49ee19,_0x3c7e6e){stats[_0xcb22('0x60')]['push']({'name':_0x3c7e6e[_0xcb22('0x61')],'message':_0x3c7e6e['message'],'row':_0x49ee19});}function handleQuery(_0x24d65b){logger[_0xcb22('0x5b')](_0x24d65b);return db[_0xcb22('0x62')][_0xcb22('0x63')](_0x24d65b)[_0xcb22('0x64')](function(_0x471a1f){results[_0xcb22('0x1d')](_0x471a1f);})[_0xcb22('0x65')](function(_0x285216){logger[_0xcb22('0x5d')](_0x285216['message']);});}function updateTzCampaigns(_0x249f6f){return new Promise(function(_0x5ab3d6,_0x2dc087){var _0x30e329=squel[_0xcb22('0x11')]()['fields']([_0xcb22('0x66'),_0xcb22('0x67')])['from'](_0xcb22('0x68'))['join']('campaigns_has_cm_lists',null,_0xcb22('0x69'))['where'](_0xcb22('0x6a')+_0x249f6f);db['sequelize'][_0xcb22('0x63')](_0x30e329[_0xcb22('0x43')]())[_0xcb22('0x64')](function(_0x40106c){var _0x4b0e54=[];for(var _0x4bf52e=0x0;_0x4bf52e<_0x40106c['length'];_0x4bf52e++){_0x4b0e54[_0xcb22('0x1d')](getTimezoneData(_0x40106c[_0x4bf52e],tmp_campaigns));}BPromise[_0xcb22('0x1e')](_0x4b0e54)['then'](function(){_0x5ab3d6({'val':0x1});});})['catch'](function(_0x21362c){logger[_0xcb22('0x5d')](_0x21362c[_0xcb22('0x5e')]);_0x5ab3d6({'val':0x0});});});}function updateTzVoiceQueues(_0x5808fa){return new Promise(function(_0x1bba36,_0x4ec494){var _0x2c83f9=squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](['voice_queues.id',_0xcb22('0x6b')])[_0xcb22('0x3b')](_0xcb22('0x6c'))[_0xcb22('0x14')](_0xcb22('0x6d'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xcb22('0x16')](_0xcb22('0x6e')+_0x5808fa);db[_0xcb22('0x62')]['query'](_0x2c83f9[_0xcb22('0x43')]())[_0xcb22('0x64')](function(_0x515c05){var _0x4b47ce=[];for(var _0xdac442=0x0;_0xdac442<_0x515c05[_0xcb22('0x1c')];_0xdac442++){_0x4b47ce[_0xcb22('0x1d')](getTimezoneData(_0x515c05[_0xdac442],tmp_voice_queues));}BPromise[_0xcb22('0x1e')](_0x4b47ce)[_0xcb22('0x20')](function(){_0x1bba36({'val':0x1});});})[_0xcb22('0x65')](function(_0x49809d){logger['error'](_0x49809d[_0xcb22('0x5e')]);_0x1bba36({'val':0x0});});});}function getTimezoneData(_0x4eb171,_0x1ec6ef){return new Promise(function(_0x3054c3,_0x8525f9){var _0x5a3f45=shared['timezones'];var _0x14e15b=_0x5a3f45[_0x4eb171['dialTimezone']];if(_[_0xcb22('0x21')](_0x14e15b)){_0x3054c3({'ret':0x1});}else{var _0x109543=_0x14e15b[_0xcb22('0x6f')];var _0x14b66b=squel['insert']()['into'](_0x1ec6ef)[_0xcb22('0x70')]('id',_0x4eb171['id'])[_0xcb22('0x70')](_0xcb22('0x71'),_0x109543)['set']('dialTimezone',_0x4eb171[_0xcb22('0x72')])['toString']();return db[_0xcb22('0x62')][_0xcb22('0x63')](_0x14b66b)['spread'](function(_0x171d53){_0x3054c3({'ret':0x1});})['catch'](function(_0x4cff6f){logger[_0xcb22('0x5d')](_0x4cff6f[_0xcb22('0x5e')]);_0x8525f9({'ret':0x1});});}});}function handleTZQuery(_0x30c3a9){logger['info'](_0x30c3a9);return db['sequelize']['query'](_0x30c3a9)[_0xcb22('0x64')](function(_0x990992){})['catch'](function(_0x4cd288){logger[_0xcb22('0x5d')](_0x4cd288[_0xcb22('0x5e')]);});}function main(_0x34a392,_0x4f898a,_0x3309b0,_0x4605b6){logger[_0xcb22('0x5b')](_0xcb22('0x73'),_0x34a392,JSON[_0xcb22('0x74')](_0x4f898a));process[_0xcb22('0x75')](_0xcb22('0x76'));var _0x23b049=_0x4f898a[_0xcb22('0x77')];var _0x4d4e49=_[_0xcb22('0x78')](_0x23b049);var _0x561e98=_0x4f898a[_0xcb22('0x79')];var _0x12e5ed=path[_0xcb22('0x14')](config[_0xcb22('0x7a')],_0xcb22('0x7b'),_0x561e98+'.csv');hasTZ=_[_0xcb22('0x54')](_0x23b049)[_0xcb22('0x7c')](_0xcb22('0x72'));var _0x431407=_['keys'](_0x23b049)[_0xcb22('0x14')]();logger[_0xcb22('0x5b')](_0xcb22('0x7d'),_0x431407);db[_0xcb22('0x7e')][_0xcb22('0x1a')]({'raw':!![],'attributes':['id',_0xcb22('0x7f')]})[_0xcb22('0x20')](function(_0x45b912){for(var _0xd07b4f=0x0;_0xd07b4f<_0x45b912['length'];_0xd07b4f++){if(_0x45b912[_0xd07b4f]['name']in _0x23b049){contactItemTypes[_0xcb22('0x1d')](_0x45b912[_0xd07b4f]);delete _0x4d4e49[_0x45b912[_0xd07b4f][_0xcb22('0x7f')]];hasAdditionalPhones=!![];}for(var _0x38ef8b in _0x23b049){if(_0x45b912[_0xd07b4f][_0xcb22('0x7f')]+'_description'===_0x38ef8b){phoneDescriptions[_0xcb22('0x1d')]({'itemTypeId':_0x45b912[_0xd07b4f]['id'],'description':_0x38ef8b});delete _0x4d4e49[_0x38ef8b];}}}if(hasAdditionalPhones)_0x4d4e49[_0xcb22('0x1b')]='';var _0x367511=_[_0xcb22('0x54')](_0x4d4e49)[_0xcb22('0x14')]();logger[_0xcb22('0x5b')](_0xcb22('0x7d'),_0x367511);fs[_0xcb22('0x80')](_0x12e5ed,_0x367511+'\x0a');Papa[_0xcb22('0x81')](fs[_0xcb22('0x82')](_0x34a392),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29f20d,_0x52bbdd){try{for(var _0xc44340=0x0,_0x2b4637=[];_0xc44340<_0x29f20d[_0xcb22('0x83')][_0xcb22('0x1c')];_0xc44340++){stats['rows']+=0x1;if(_0x29f20d[_0xcb22('0x60')][_0xc44340]){handleError(_0x29f20d[_0xcb22('0x83')][_0xc44340],_0x29f20d[_0xcb22('0x60')][_0xc44340]);}else{var _0x24e843=[];var _0x58c858=[];var _0x63e724={};for(var _0x5139a8 in _0x23b049){let _0x15232a=contactItemTypes[_0xcb22('0x84')](_0xc73950=>_0xc73950[_0xcb22('0x7f')]===_0x5139a8);let _0x1dc3dc=contactItemTypes[_0xcb22('0x84')](_0x2a04e1=>_0x2a04e1[_0xcb22('0x7f')]+_0xcb22('0x85')===_0x5139a8);if(_[_0xcb22('0x21')](_0x15232a)&&_['isNil'](_0x1dc3dc)){if(_0x23b049[_0xcb22('0x86')](_0x5139a8)){if(_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]]){var _0x3af75f=_['trim'](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]]['replace'](/"/g,'\x27'));switch(_0x5139a8){case'scheduledat':var _0x597720=moment(_0x3af75f,_0xcb22('0xe'),!![]);if(_0x597720['isValid']()){_0x2b4637['push']('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x87'));}break;case _0xcb22('0x47'):var _0x4f23ed=parseInt(_0x3af75f);_0x3af75f=_[_0xcb22('0x88')](_0x4f23ed)||_0x4f23ed<0x0||_0x4f23ed>0x4?_0x4605b6?0x3:0x2:_0x4f23ed;_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');break;case _0xcb22('0x38'):var _0x50945a=parseInt(_0x3af75f);if(_[_0xcb22('0x89')](_0x50945a)&&_[_0xcb22('0x7c')](_0x3309b0,_0x50945a)){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x50945a+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x8a'));}break;case _0xcb22('0x8b'):if(isEmail(_0x3af75f)){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x8c'));}break;case _0xcb22('0x8d'):var _0x26047c=moment(_0x3af75f,_0xcb22('0x8e'),!![]);if(_0x26047c[_0xcb22('0x8f')]()){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x90'));}break;case _0xcb22('0x72'):var _0xdc07d0=shared[_0xcb22('0x91')];var _0x536f48=_0xdc07d0[_0x3af75f];if(!_[_0xcb22('0x21')](_0x536f48)){var _0x43527b=_0x536f48['utcOffset'];_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x43527b+'\x22');}break;default:_0x2b4637['push']('\x22'+_0x3af75f+'\x22');}}else{switch(_0x5139a8){case _0xcb22('0x92'):case _0xcb22('0x13'):_0x24e843[_0xcb22('0x1d')](_0x5139a8+_0xcb22('0x93'));break;default:_0x2b4637[_0xcb22('0x1d')]('\x22\x22');}}}}else{var _0x29b101='';if(!_[_0xcb22('0x21')](_0x15232a)){if(!_0x63e724[_0xcb22('0x86')](_0x15232a['id'])){if(!_[_0xcb22('0x21')](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]])){var _0x3af75f=_[_0xcb22('0x94')](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]][_0xcb22('0x95')](/"/g,'\x27'));var _0xa7d1c6=phoneDescriptions[_0xcb22('0x84')](_0xbc06de=>_0xbc06de[_0xcb22('0x96')]===_0x15232a['id']);if(!_[_0xcb22('0x21')](_0xa7d1c6)){var _0x2ed6d6=_['trim'](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0xa7d1c6[_0xcb22('0x97')]]][_0xcb22('0x95')](/"/g,'\x27'));if(!_[_0xcb22('0x21')](_0x2ed6d6))_0x3af75f=_0x3af75f+'§'+_0x2ed6d6;}if(_0x29b101=='')_0x29b101=_0x3af75f;else _0x29b101+='|'+_0x3af75f;}_0x58c858[_0xcb22('0x1d')](_0x15232a['id']+':'+_0x29b101);_0x63e724[_0x15232a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b4637['push']('\x22'+_0x58c858['join'](';')+'\x22');}if(_0x24e843[_0xcb22('0x1c')]){handleError(_0x29f20d[_0xcb22('0x83')][_0xc44340],{'code':'SystemRow','message':_0x24e843['join']()});}else{fs[_0xcb22('0x98')](_0x12e5ed,_0x2b4637[_0xcb22('0x14')]()+'\x0a');}_0x2b4637=[];}if(!(stats[_0xcb22('0x99')]%0xc8)){socket[_0xcb22('0x9a')]('contact:import:'+_0x561e98,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xcb22('0x9b'));_0x52bbdd[_0xcb22('0x9c')]();}}catch(_0x10c87d){handleError(_0x29f20d['data'][_0xc44340],{'code':_0xcb22('0x9d'),'message':_0x10c87d[_0xcb22('0x5e')]});logger[_0xcb22('0x5d')](_0xcb22('0x9e'),_0x10c87d['message']);}},'complete':function(){try{var _0x1bae0b=[];var _0xaff53c=[];var _0x4c16ed=_0xcb22('0x3c');if(_0x4f898a[_0xcb22('0x9f')]&&_0x4f898a[_0xcb22('0x9f')]['length']){_0x4c16ed='cm_contacts_'+_0x561e98;_0x1bae0b['push'](_0xcb22('0xa0')+_0x4c16ed+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x561e98;tmp_voice_queues=_0xcb22('0xa1')+_0x561e98;_0xaff53c['push'](_0xcb22('0xa0')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0xaff53c[_0xcb22('0x1d')](_0xcb22('0xa0')+tmp_voice_queues+_0xcb22('0xa2'));BPromise[_0xcb22('0xa3')](_0xaff53c,handleTZQuery)[_0xcb22('0x20')](function(_0x438774){updateTzCampaigns(_0x4f898a['ListId'])['then'](function(_0x48d93d){updateTzVoiceQueues(_0x4f898a['ListId'])['then'](function(_0x2257f1){if(hasTZ)_0x367511=_0x367511['replace'](_0xcb22('0x72'),_0xcb22('0xa4'));var _0x2f533f=util[_0xcb22('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x12e5ed,_0x4c16ed,_0x367511,_0x4f898a[_0xcb22('0x35')],_0x4f898a['CompanyId']||null,NOW,NOW);if(_[_0xcb22('0x21')](_0x23b049[_0xcb22('0x33')])){_0x2f533f+=_0xcb22('0xa5');}_0x1bae0b[_0xcb22('0x1d')](_0x2f533f);if(_0x4f898a['duplicates']&&_0x4f898a[_0xcb22('0x9f')]['length']){_0x1bae0b[_0xcb22('0x1d')](insertCmContact(_0x4f898a[_0xcb22('0x35')],_0x4c16ed,_0x4f898a[_0xcb22('0x9f')],_0x23b049));_0x1bae0b['push'](_0xcb22('0xa6')+_0x4c16ed+';');}BPromise[_0xcb22('0xa3')](_0x1bae0b,handleQuery)['then'](function(_0xf9dd67){BPromise[_0xcb22('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x1bae0b=[];for(var _0x4b3486=0x0;_0x4b3486\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','defaults','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','findOne','update','updated','CmContactHasItem','create','PHONE','inserted'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb748,0x8f));var _0x8b74=function(_0x47c2b4,_0x249c9f){_0x47c2b4=_0x47c2b4-0x0;var _0xd7fb74=_0xb748[_0x47c2b4];return _0xd7fb74;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8b74('0x0'));var Papa=require(_0x8b74('0x1'));var util=require('util');var BPromise=require(_0x8b74('0x2'));var moment=require(_0x8b74('0x3'));var squel=require(_0x8b74('0x4'));var Redis=require('ioredis');var db=require(_0x8b74('0x5'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x8b74('0x6'))(_0x8b74('0x7'));config['redis']=_[_0x8b74('0x8')](config[_0x8b74('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b74('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8b74('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8b74('0xa')](_0x8b74('0xb'));function isEmail(_0x6e7600){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))*$/[_0x8b74('0xc')](_0x6e7600);}function selectNotIn(_0x4453f3,_0x112c44,_0x975914,_0x542d61,_0x4ace7d){return squel[_0x8b74('0xd')]()[_0x8b74('0xe')](_0x8b74('0xf'))[_0x8b74('0x10')](_0x542d61)[_0x8b74('0x11')](_0x112c44,null,_0x112c44+_0x8b74('0x12')+_0x542d61+'.'+_0x975914)['where'](_0x542d61+'.'+_0x975914+_0x8b74('0x13')+_0x4453f3+'.'+_0x975914)[_0x8b74('0x14')](_0x112c44+_0x8b74('0x15')+_0x4ace7d[_0x8b74('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x420ae0,_0x38e95a){promisesAdditionalPhones=[];return db[_0x8b74('0x16')][_0x8b74('0x17')]({'raw':!![],'attributes':['id',_0x8b74('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8b74('0x19')](function(_0x1a9c19){if(_0x1a9c19!==null){var _0x3caf06=[];for(var _0x125aac=0x0;_0x125aac<_0x1a9c19['length'];_0x125aac++){var _0x4c5ae0=_0x1a9c19[_0x125aac];_0x3caf06[_0x8b74('0x1a')](insertAdditionalPhones(_0x4c5ae0));}}Promise[_0x8b74('0x1b')](_0x3caf06)[_0x8b74('0x19')](function(){_0x420ae0({'val':0x1});});});});}function insertAdditionalPhones(_0x205012){return new Promise(function(_0x52eeed,_0x1797a8){var _0x12ad8e=_0x205012['AdditionalPhones'];var _0x2be977=_0x12ad8e[_0x8b74('0x1c')](';');var _0x5ce16e=[];orderBy=0x0;for(var _0x3172b8=0x0;_0x3172b8<_0x2be977[_0x8b74('0x1d')];_0x3172b8++){_0x5ce16e[_0x8b74('0x1a')](splitAdditionalPhone(_0x205012['id'],_0x2be977[_0x3172b8]));}Promise[_0x8b74('0x1b')](_0x5ce16e)['then'](function(){_0x52eeed({'val':_0x2be977[_0x8b74('0x1d')]});});});}function splitAdditionalPhone(_0x30742a,_0x2c2a6d){return new Promise(function(_0x8b3b67,_0x4d2f28){var _0x1725f3=_0x2c2a6d[_0x8b74('0x1c')](':');var _0x32a74f=_0x1725f3[0x0];var _0x5e0d8c=_0x1725f3[0x1];if(!_[_0x8b74('0x1e')](_0x5e0d8c)){var _0x2cc902=_0x5e0d8c[_0x8b74('0x1c')]('|');var _0x4e2f46=[];for(var _0xdda8a7=0x0;_0xdda8a7<_0x2cc902[_0x8b74('0x1d')];_0xdda8a7++){if(_0x2cc902[_0xdda8a7]!==''){var _0x3ed480=_['filter'](promisesAdditionalPhones,{'contactId':_0x30742a,'phone':_0x2cc902[_0xdda8a7]});if(_0x3ed480[_0x8b74('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x8b74('0x1a')]({'contactId':_0x30742a,'contactTypeId':_0x32a74f,'phone':_0x2cc902[_0xdda8a7],'orderBy':orderBy});}}}_0x8b3b67({'ok':0x1});}else _0x8b3b67({'res':0x0});});}function createAdditionalPhone(_0x2745,_0xba1701,_0x1649e3,_0x596fa7){var _0x2fd8ba='';var _0x5b99c7='';var _0x50d124=_0x1649e3[_0x8b74('0x1c')]('§');_0x2fd8ba=_0x50d124[0x0];if(_0x50d124[_0x8b74('0x1d')]==0x2)_0x5b99c7=_0x50d124[0x1];return new Promise(function(_0x106399,_0x1f71a9){return db['CmContactHasItem'][_0x8b74('0x1f')]({'where':{'CmContactId':_0x2745,'item':_0x2fd8ba}})[_0x8b74('0x19')](function(_0x40454a){if(_0x40454a){return db['CmContactHasItem'][_0x8b74('0x20')]({'ItemTypeId':_0xba1701,'description':_0x5b99c7,'OrderBy':_0x596fa7},{'where':{'CmContactId':_0x2745,'item':_0x2fd8ba}})['then'](function(_0x4bf736){_0x106399({'res':_0x8b74('0x21')});});}else{return db[_0x8b74('0x22')][_0x8b74('0x23')]({'CmContactId':_0x2745,'item':_0x2fd8ba,'description':_0x5b99c7,'ItemTypeId':_0xba1701,'OrderBy':_0x596fa7,'ItemClass':_0x8b74('0x24')})[_0x8b74('0x19')](function(_0x2f43b8){_0x106399({'res':_0x8b74('0x25')});});}});});}function insertCmHopper(_0x409533,_0x34124e,_0x492abe,_0x2ae0e9,_0x28cefd){var _0x2b05d8=[_0x8b74('0x26'),_0x8b74('0x27'),_0x8b74('0x28'),_0x8b74('0x29'),_0x34124e+'.'+_0x2ae0e9,_0x8b74('0x2a'),'cm_contacts.updatedAt','cm_contacts.priority',_0x8b74('0x2b'),'\x22'+_0x28cefd+'\x22'];return squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')](_0x8b74('0x2e'))['fromQuery']([_0x8b74('0xf'),_0x8b74('0x2f'),_0x8b74('0x30'),'ListId',_0x2ae0e9,_0x8b74('0x31'),_0x8b74('0x32'),'priority',_0x8b74('0x33'),_0x8b74('0x34')],squel[_0x8b74('0xd')]()[_0x8b74('0x35')](_0x2b05d8)[_0x8b74('0x10')](_0x34124e)[_0x8b74('0x11')](_0x8b74('0x36'),null,_0x8b74('0x37')+_0x34124e+_0x8b74('0x38'))['join'](_0x492abe,null,_0x492abe+_0x8b74('0x12')+_0x34124e+'.'+_0x2ae0e9)[_0x8b74('0x14')](_0x34124e+_0x8b74('0x39'),_0x409533)[_0x8b74('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8b74('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x34124e,_0x492abe,_0x2ae0e9,_0x8b74('0x2e'),[_0x8b74('0x3a'),_0x8b74('0x3b')]))['where'](_0x8b74('0x3c'),selectNotIn(_0x34124e,_0x492abe,_0x2ae0e9,_0x8b74('0x2e'),[_0x8b74('0x3a')])))[_0x8b74('0x3d')]();}function insertCmHopperBlack(_0x4bfb23,_0x7d47fa,_0x1675c6,_0x16ce70){var _0x4eb2e2=['cm_contacts.phone',_0x8b74('0x28'),_0x8b74('0x29'),_0x7d47fa+'.'+_0x16ce70,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')]('cm_hopper_black')[_0x8b74('0x3e')](['phone',_0x8b74('0x30'),_0x8b74('0x3f'),_0x16ce70,_0x8b74('0x31'),_0x8b74('0x32')],squel[_0x8b74('0xd')]()[_0x8b74('0x35')](_0x4eb2e2)['from'](_0x7d47fa)[_0x8b74('0x11')]('cm_contacts',null,_0x8b74('0x37')+_0x7d47fa+_0x8b74('0x38'))[_0x8b74('0x11')](_0x1675c6,null,_0x1675c6+_0x8b74('0x12')+_0x7d47fa+'.'+_0x16ce70)[_0x8b74('0x14')](_0x7d47fa+_0x8b74('0x39'),_0x4bfb23)['where'](_0x8b74('0x40'),NOW)['where'](_0x8b74('0x3c'),squel[_0x8b74('0xd')]()[_0x8b74('0xe')]('phone')[_0x8b74('0x10')](_0x8b74('0x41'))['where']('ListId\x20=\x20?',_0x4bfb23)[_0x8b74('0x14')](_0x16ce70+_0x8b74('0x13')+_0x7d47fa+'.'+_0x16ce70)))[_0x8b74('0x3d')]();}function insertTzCmHopper(_0x8492fe,_0x3c49ea,_0x3fd46e,_0x148bee,_0x8e5843,_0x464e99){var _0x39177a=['cm_contacts.phone',_0x8b74('0x42')+_0x464e99+_0x8b74('0x43'),_0x8b74('0x28'),_0x8b74('0x29'),_0x3c49ea+'.'+_0x148bee,_0x8b74('0x2a'),_0x8b74('0x44'),_0x8b74('0x45'),_0x8b74('0x2b'),'\x22'+_0x8e5843+'\x22'];var _0x5b8202=squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')]('cm_hopper')[_0x8b74('0x3e')]([_0x8b74('0xf'),_0x8b74('0x2f'),_0x8b74('0x30'),'ListId',_0x148bee,'createdAt',_0x8b74('0x32'),'priority',_0x8b74('0x33'),'recallme'],squel[_0x8b74('0xd')]()['fields'](_0x39177a)[_0x8b74('0x10')](_0x3c49ea)['join'](_0x8b74('0x36'),null,_0x8b74('0x37')+_0x3c49ea+_0x8b74('0x38'))[_0x8b74('0x11')](_0x3fd46e,null,_0x3fd46e+_0x8b74('0x12')+_0x3c49ea+'.'+_0x148bee)[_0x8b74('0x11')](_0x464e99,null,_0x464e99+_0x8b74('0x12')+_0x3c49ea+'.'+_0x148bee)[_0x8b74('0x14')](_0x3c49ea+'.CmListId\x20=\x20?',_0x8492fe)[_0x8b74('0x14')](_0x8b74('0x40'),NOW)[_0x8b74('0x14')](_0x8b74('0x3c'),selectNotIn(_0x3c49ea,_0x3fd46e,_0x148bee,_0x8b74('0x2e'),[_0x8b74('0x3a'),'\x22onlyIfOpen\x22']))[_0x8b74('0x14')](_0x8b74('0x3c'),selectNotIn(_0x3c49ea,_0x3fd46e,_0x148bee,_0x8b74('0x2e'),[_0x8b74('0x3a')])))['toString']();return _0x5b8202;}function insertTzCmHopperBlack(_0x2d2f96,_0x3518f4,_0x2c3aa5,_0x4c7d8a){var _0x367b14=[_0x8b74('0x26'),_0x8b74('0x28'),'cm_contacts.ListId',_0x3518f4+'.'+_0x4c7d8a,_0x8b74('0x2a'),_0x8b74('0x44')];return squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')](_0x8b74('0x41'))['fromQuery']([_0x8b74('0xf'),_0x8b74('0x30'),_0x8b74('0x3f'),_0x4c7d8a,'createdAt',_0x8b74('0x32')],squel[_0x8b74('0xd')]()['fields'](_0x367b14)[_0x8b74('0x10')](_0x3518f4)['join'](_0x8b74('0x36'),null,_0x8b74('0x37')+_0x3518f4+'.CmListId')[_0x8b74('0x11')](_0x2c3aa5,null,_0x2c3aa5+_0x8b74('0x12')+_0x3518f4+'.'+_0x4c7d8a)[_0x8b74('0x14')](_0x3518f4+_0x8b74('0x39'),_0x2d2f96)[_0x8b74('0x14')](_0x8b74('0x40'),NOW)[_0x8b74('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8b74('0xd')]()[_0x8b74('0xe')](_0x8b74('0xf'))['from'](_0x8b74('0x41'))[_0x8b74('0x14')]('ListId\x20=\x20?',_0x2d2f96)[_0x8b74('0x14')](_0x4c7d8a+_0x8b74('0x13')+_0x3518f4+'.'+_0x4c7d8a)))[_0x8b74('0x3d')]();}function insertCmHopperAdditionalPhones(_0x468713){var _0x33e993=[_0x8b74('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x8b74('0x47')];return squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')](_0x8b74('0x48'))['fromQuery']([_0x8b74('0x49'),_0x8b74('0xf'),_0x8b74('0x4a'),_0x8b74('0x31'),'updatedAt'],squel[_0x8b74('0xd')]()['fields'](_0x33e993)['from'](_0x8b74('0x2e'))[_0x8b74('0x11')](_0x8b74('0x36'),null,_0x8b74('0x4b'))[_0x8b74('0x11')](_0x8b74('0x4c'),null,_0x8b74('0x4d'))[_0x8b74('0x14')]('cm_hopper.ListId\x20=\x20?',_0x468713)[_0x8b74('0x14')](_0x8b74('0x40'),NOW))[_0x8b74('0x3d')]();}function insertCmContact(_0x3c977e,_0x17b58a,_0x19cb68,_0x3d6830){var _0x189a70=_['concat'](_[_0x8b74('0x4e')](_0x3d6830),[_0x8b74('0x3f'),_0x8b74('0x4f'),_0x8b74('0x31'),_0x8b74('0x32'),_0x8b74('0x50')]);return squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')](_0x8b74('0x36'))[_0x8b74('0x3e')](_0x189a70,squel[_0x8b74('0xd')]()['fields'](_0x189a70)[_0x8b74('0x10')](_0x17b58a)[_0x8b74('0x14')]('('+_0x19cb68[_0x8b74('0x11')](',')+_0x8b74('0x51'),squel[_0x8b74('0xd')]()[_0x8b74('0x35')](_0x19cb68)['from'](_0x8b74('0x36'))[_0x8b74('0x14')](_0x8b74('0x52'),_0x3c977e)[_0x8b74('0x14')](_0x8b74('0x53')))[_0x8b74('0x14')](_0x8b74('0x54'),squel['select']()[_0x8b74('0xe')](_0x8b74('0x55'),'min_id')[_0x8b74('0x10')](_0x17b58a)[_0x8b74('0x56')](_0x19cb68[_0x8b74('0x11')](','))))[_0x8b74('0x3d')]();}function handleStop(){logger[_0x8b74('0x57')](_0x8b74('0x58'));stopped=!![];}function handleUncaughtException(_0x1fcd5a){logger[_0x8b74('0x59')](_0x1fcd5a[_0x8b74('0x5a')]);process[_0x8b74('0x5b')](0x1);}function handleError(_0x4b5c06,_0x534039){stats[_0x8b74('0x5c')][_0x8b74('0x1a')]({'name':_0x534039[_0x8b74('0x5d')],'message':_0x534039[_0x8b74('0x5a')],'row':_0x4b5c06});}function handleQuery(_0x8404e6){logger[_0x8b74('0x57')](_0x8404e6);return db[_0x8b74('0x5e')][_0x8b74('0x5f')](_0x8404e6)[_0x8b74('0x60')](function(_0x37f4ba){results[_0x8b74('0x1a')](_0x37f4ba);})[_0x8b74('0x61')](function(_0x343f56){logger['error'](_0x343f56[_0x8b74('0x5a')]);});}function updateTzCampaigns(_0x28bb52){return new Promise(function(_0x28c1b3,_0x301b25){var _0x3dd633=squel[_0x8b74('0xd')]()[_0x8b74('0x35')](['campaigns.id',_0x8b74('0x62')])[_0x8b74('0x10')](_0x8b74('0x63'))['join'](_0x8b74('0x64'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x8b74('0x65')+_0x28bb52);db[_0x8b74('0x5e')]['query'](_0x3dd633[_0x8b74('0x3d')]())[_0x8b74('0x60')](function(_0x572a2c){var _0x4b4c51=[];for(var _0x49f185=0x0;_0x49f185<_0x572a2c[_0x8b74('0x1d')];_0x49f185++){_0x4b4c51[_0x8b74('0x1a')](getTimezoneData(_0x572a2c[_0x49f185],tmp_campaigns));}BPromise[_0x8b74('0x1b')](_0x4b4c51)['then'](function(){_0x28c1b3({'val':0x1});});})[_0x8b74('0x61')](function(_0x3c73ab){logger[_0x8b74('0x59')](_0x3c73ab[_0x8b74('0x5a')]);_0x28c1b3({'val':0x0});});});}function updateTzVoiceQueues(_0x2242cc){return new Promise(function(_0x4f2668,_0x5d366f){var _0x22673b=squel[_0x8b74('0xd')]()[_0x8b74('0x35')](['voice_queues.id',_0x8b74('0x66')])[_0x8b74('0x10')](_0x8b74('0x67'))[_0x8b74('0x11')](_0x8b74('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x8b74('0x14')](_0x8b74('0x69')+_0x2242cc);db[_0x8b74('0x5e')]['query'](_0x22673b['toString']())['spread'](function(_0x2377a9){var _0x2333ac=[];for(var _0x25b437=0x0;_0x25b437<_0x2377a9[_0x8b74('0x1d')];_0x25b437++){_0x2333ac[_0x8b74('0x1a')](getTimezoneData(_0x2377a9[_0x25b437],tmp_voice_queues));}BPromise[_0x8b74('0x1b')](_0x2333ac)[_0x8b74('0x19')](function(){_0x4f2668({'val':0x1});});})[_0x8b74('0x61')](function(_0x13fc30){logger[_0x8b74('0x59')](_0x13fc30[_0x8b74('0x5a')]);_0x4f2668({'val':0x0});});});}function getTimezoneData(_0x460998,_0x225146){return new Promise(function(_0x4df85b,_0x59d3c0){var _0x32c230=shared['timezones'];var _0xac60fb=_0x32c230[_0x460998['dialTimezone']];if(_[_0x8b74('0x1e')](_0xac60fb)){_0x4df85b({'ret':0x1});}else{var _0xb0a253=_0xac60fb['utcOffset'];var _0x3f2017=squel[_0x8b74('0x2c')]()[_0x8b74('0x2d')](_0x225146)['set']('id',_0x460998['id'])[_0x8b74('0x6a')](_0x8b74('0x6b'),_0xb0a253)[_0x8b74('0x6a')]('dialTimezone',_0x460998['dialTimezone'])[_0x8b74('0x3d')]();return db['sequelize']['query'](_0x3f2017)['spread'](function(_0xbd0c37){_0x4df85b({'ret':0x1});})[_0x8b74('0x61')](function(_0x35e836){logger['error'](_0x35e836[_0x8b74('0x5a')]);_0x59d3c0({'ret':0x1});});}});}function handleTZQuery(_0x3cb45b){logger[_0x8b74('0x57')](_0x3cb45b);return db['sequelize'][_0x8b74('0x5f')](_0x3cb45b)[_0x8b74('0x60')](function(_0x41b714){})['catch'](function(_0x8db0e8){logger[_0x8b74('0x59')](_0x8db0e8[_0x8b74('0x5a')]);});}function main(_0x5b30ce,_0x1fdef2,_0xd296fe,_0x2a90e9){logger[_0x8b74('0x57')](_0x8b74('0x6c'),_0x5b30ce,JSON[_0x8b74('0x6d')](_0x1fdef2));process[_0x8b74('0x6e')](_0x8b74('0x6f'));var _0x2f82d7=_0x1fdef2[_0x8b74('0x70')];var _0x5e29c3=_[_0x8b74('0x71')](_0x2f82d7);var _0x5ad104=_0x1fdef2[_0x8b74('0x72')];var _0x3265cf=path[_0x8b74('0x11')](config[_0x8b74('0x73')],_0x8b74('0x74'),_0x5ad104+_0x8b74('0x75'));hasTZ=_[_0x8b74('0x4e')](_0x2f82d7)['includes']('dialTimezone');var _0x126248=_[_0x8b74('0x4e')](_0x2f82d7)[_0x8b74('0x11')]();logger[_0x8b74('0x57')]('header',_0x126248);db[_0x8b74('0x76')][_0x8b74('0x17')]({'raw':!![],'attributes':['id',_0x8b74('0x77')]})['then'](function(_0x1a56ac){for(var _0x4f3a11=0x0;_0x4f3a11<_0x1a56ac[_0x8b74('0x1d')];_0x4f3a11++){if(_0x1a56ac[_0x4f3a11][_0x8b74('0x77')]in _0x2f82d7){contactItemTypes[_0x8b74('0x1a')](_0x1a56ac[_0x4f3a11]);delete _0x5e29c3[_0x1a56ac[_0x4f3a11][_0x8b74('0x77')]];hasAdditionalPhones=!![];}for(var _0x5cbbc8 in _0x2f82d7){if(_0x1a56ac[_0x4f3a11][_0x8b74('0x77')]+_0x8b74('0x78')===_0x5cbbc8){phoneDescriptions[_0x8b74('0x1a')]({'itemTypeId':_0x1a56ac[_0x4f3a11]['id'],'description':_0x5cbbc8});delete _0x5e29c3[_0x5cbbc8];}}}if(hasAdditionalPhones)_0x5e29c3['AdditionalPhones']='';var _0x59a35d=_[_0x8b74('0x4e')](_0x5e29c3)[_0x8b74('0x11')]();logger[_0x8b74('0x57')](_0x8b74('0x79'),_0x59a35d);fs[_0x8b74('0x7a')](_0x3265cf,_0x59a35d+'\x0a');Papa[_0x8b74('0x7b')](fs[_0x8b74('0x7c')](_0x5b30ce),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4ddd9b,_0x44f65){try{for(var _0x1b1841=0x0,_0x501962=[];_0x1b1841<_0x4ddd9b[_0x8b74('0x7d')][_0x8b74('0x1d')];_0x1b1841++){stats[_0x8b74('0x7e')]+=0x1;if(_0x4ddd9b['errors'][_0x1b1841]){handleError(_0x4ddd9b[_0x8b74('0x7d')][_0x1b1841],_0x4ddd9b[_0x8b74('0x5c')][_0x1b1841]);}else{var _0x4cdac1=[];var _0x561f4f=[];var _0x2b6f04={};for(var _0x1e92bf in _0x2f82d7){let _0x4aaeba=contactItemTypes['find'](_0x57ee7e=>_0x57ee7e['name']===_0x1e92bf);let _0x7f4bb=contactItemTypes['find'](_0x3c1b40=>_0x3c1b40[_0x8b74('0x77')]+_0x8b74('0x78')===_0x1e92bf);if(_[_0x8b74('0x1e')](_0x4aaeba)&&_['isNil'](_0x7f4bb)){if(_0x2f82d7[_0x8b74('0x7f')](_0x1e92bf)){if(_0x4ddd9b[_0x8b74('0x7d')][_0x1b1841][_0x2f82d7[_0x1e92bf]]){var _0x403b47=_[_0x8b74('0x80')](_0x4ddd9b['data'][_0x1b1841][_0x2f82d7[_0x1e92bf]]['replace'](/"/g,'\x27'));switch(_0x1e92bf){case _0x8b74('0x2f'):var _0x23f83e=moment(_0x403b47,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x23f83e[_0x8b74('0x81')]()){_0x501962[_0x8b74('0x1a')]('\x22'+_0x403b47+'\x22');}else{_0x4cdac1[_0x8b74('0x1a')](_0x8b74('0x82'));}break;case'priority':var _0x4a623a=parseInt(_0x403b47);_0x403b47=_[_0x8b74('0x83')](_0x4a623a)||_0x4a623a<0x0||_0x4a623a>0x4?_0x2a90e9?0x3:0x2:_0x4a623a;_0x501962[_0x8b74('0x1a')]('\x22'+_0x403b47+'\x22');break;case'UserId':var _0x4e599=parseInt(_0x403b47);if(_[_0x8b74('0x84')](_0x4e599)&&_[_0x8b74('0x85')](_0xd296fe,_0x4e599)){_0x501962[_0x8b74('0x1a')]('\x22'+_0x4e599+'\x22');}else{_0x4cdac1['push'](_0x8b74('0x86'));}break;case _0x8b74('0x87'):if(isEmail(_0x403b47)){_0x501962[_0x8b74('0x1a')]('\x22'+_0x403b47+'\x22');}else{_0x4cdac1['push'](_0x8b74('0x88'));}break;case _0x8b74('0x89'):var _0x5576d5=moment(_0x403b47,_0x8b74('0x8a'),!![]);if(_0x5576d5['isValid']()){_0x501962[_0x8b74('0x1a')]('\x22'+_0x403b47+'\x22');}else{_0x4cdac1[_0x8b74('0x1a')](_0x8b74('0x8b'));}break;case _0x8b74('0x8c'):var _0xbef478=shared[_0x8b74('0x8d')];var _0x553bee=_0xbef478[_0x403b47];if(!_[_0x8b74('0x1e')](_0x553bee)){var _0x5e9763=_0x553bee[_0x8b74('0x8e')];_0x501962[_0x8b74('0x1a')]('\x22'+_0x403b47+'\x22');_0x501962[_0x8b74('0x1a')]('\x22'+_0x5e9763+'\x22');}break;default:_0x501962['push']('\x22'+_0x403b47+'\x22');}}else{switch(_0x1e92bf){case'firstName':case _0x8b74('0xf'):_0x4cdac1[_0x8b74('0x1a')](_0x1e92bf+_0x8b74('0x8f'));break;default:_0x501962['push']('\x22\x22');}}}}else{var _0x4a16ca='';if(!_['isNil'](_0x4aaeba)){if(!_0x2b6f04['hasOwnProperty'](_0x4aaeba['id'])){if(!_[_0x8b74('0x1e')](_0x4ddd9b[_0x8b74('0x7d')][_0x1b1841][_0x2f82d7[_0x1e92bf]])){var _0x403b47=_[_0x8b74('0x80')](_0x4ddd9b[_0x8b74('0x7d')][_0x1b1841][_0x2f82d7[_0x1e92bf]]['replace'](/"/g,'\x27'));var _0xbab812=phoneDescriptions[_0x8b74('0x90')](_0xe49295=>_0xe49295[_0x8b74('0x91')]===_0x4aaeba['id']);if(!_[_0x8b74('0x1e')](_0xbab812)){var _0x32d0fb=_[_0x8b74('0x80')](_0x4ddd9b['data'][_0x1b1841][_0x2f82d7[_0xbab812[_0x8b74('0x92')]]]['replace'](/"/g,'\x27'));if(!_[_0x8b74('0x1e')](_0x32d0fb))_0x403b47=_0x403b47+'§'+_0x32d0fb;}if(_0x4a16ca=='')_0x4a16ca=_0x403b47;else _0x4a16ca+='|'+_0x403b47;}_0x561f4f[_0x8b74('0x1a')](_0x4aaeba['id']+':'+_0x4a16ca);_0x2b6f04[_0x4aaeba['id']]=0x1;}}}}if(hasAdditionalPhones){_0x501962[_0x8b74('0x1a')]('\x22'+_0x561f4f[_0x8b74('0x11')](';')+'\x22');}if(_0x4cdac1['length']){handleError(_0x4ddd9b[_0x8b74('0x7d')][_0x1b1841],{'code':_0x8b74('0x93'),'message':_0x4cdac1['join']()});}else{fs[_0x8b74('0x94')](_0x3265cf,_0x501962[_0x8b74('0x11')]()+'\x0a');}_0x501962=[];}if(!(stats[_0x8b74('0x7e')]%0xc8)){socket[_0x8b74('0x95')](_0x8b74('0x96')+_0x5ad104,stats);stats[_0x8b74('0x5c')]=[];}}if(stopped){logger[_0x8b74('0x57')](_0x8b74('0x97'));_0x44f65['abort']();}}catch(_0x195640){handleError(_0x4ddd9b['data'][_0x1b1841],{'code':'SystemError','message':_0x195640[_0x8b74('0x5a')]});logger[_0x8b74('0x59')]('step',_0x195640[_0x8b74('0x5a')]);}},'complete':function(){try{var _0x36c64b=[];var _0x589716=[];var _0xe75619=_0x8b74('0x36');if(_0x1fdef2[_0x8b74('0x98')]&&_0x1fdef2[_0x8b74('0x98')][_0x8b74('0x1d')]){_0xe75619=_0x8b74('0x99')+_0x5ad104;_0x36c64b[_0x8b74('0x1a')]('CREATE\x20TABLE\x20'+_0xe75619+_0x8b74('0x9a'));}tmp_campaigns=_0x8b74('0x9b')+_0x5ad104;tmp_voice_queues=_0x8b74('0x9c')+_0x5ad104;_0x589716[_0x8b74('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x8b74('0x9d'));_0x589716[_0x8b74('0x1a')](_0x8b74('0x9e')+tmp_voice_queues+_0x8b74('0x9d'));BPromise[_0x8b74('0x9f')](_0x589716,handleTZQuery)[_0x8b74('0x19')](function(_0x1ab183){updateTzCampaigns(_0x1fdef2[_0x8b74('0x3f')])['then'](function(_0x36195f){updateTzVoiceQueues(_0x1fdef2['ListId'])[_0x8b74('0x19')](function(_0x2bf436){if(hasTZ)_0x59a35d=_0x59a35d[_0x8b74('0xa0')]('dialTimezone',_0x8b74('0xa1'));var _0x27b5d5=util[_0x8b74('0xa')]('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',_0x3265cf,_0xe75619,_0x59a35d,_0x1fdef2[_0x8b74('0x3f')],_0x1fdef2[_0x8b74('0x4f')]||null,NOW,NOW);if(_[_0x8b74('0x1e')](_0x2f82d7['scheduledat'])){_0x27b5d5+=_0x8b74('0xa2');}_0x36c64b[_0x8b74('0x1a')](_0x27b5d5);if(_0x1fdef2[_0x8b74('0x98')]&&_0x1fdef2[_0x8b74('0x98')][_0x8b74('0x1d')]){_0x36c64b[_0x8b74('0x1a')](insertCmContact(_0x1fdef2['ListId'],_0xe75619,_0x1fdef2[_0x8b74('0x98')],_0x2f82d7));_0x36c64b['push']('DROP\x20TABLE\x20'+_0xe75619+';');}BPromise[_0x8b74('0x9f')](_0x36c64b,handleQuery)[_0x8b74('0x19')](function(_0x283976){BPromise[_0x8b74('0x1b')]([handleAdditionalPhones()])[_0x8b74('0x19')](function(){_0x36c64b=[];for(var _0x148bb3=0x0;_0x148bb3_0xb028b3[_0x458a('0x70')]===_0x2ea9ce);let _0x494710=contactItemTypes[_0x458a('0x78')](_0xed002=>_0xed002[_0x458a('0x70')]+_0x458a('0x71')===_0x2ea9ce);if(_[_0x458a('0x1d')](_0x48d7f2)&&_[_0x458a('0x1d')](_0x494710)){if(_0x5779cb['hasOwnProperty'](_0x2ea9ce)){if(_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce]]){var _0x239e2f=_['trim'](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce]][_0x458a('0x79')](/"/g,'\x27'));switch(_0x2ea9ce){case _0x458a('0x39'):var _0x5e01af=moment(_0x239e2f,_0x458a('0x10'),!![]);if(_0x5e01af[_0x458a('0x7a')]()){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e[_0x458a('0x1f')](_0x458a('0x7b'));}break;case _0x458a('0x3d'):var _0x38cff5=parseInt(_0x239e2f);_0x239e2f=_[_0x458a('0x7c')](_0x38cff5)||_0x38cff5<0x0||_0x38cff5>0x4?_0x4c97b4?0x3:0x2:_0x38cff5;_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');break;case _0x458a('0x3e'):var _0x486687=parseInt(_0x239e2f);if(_['isNumber'](_0x486687)&&_['includes'](_0xbd36cc,_0x486687)){_0x31074e[_0x458a('0x1f')]('\x22'+_0x486687+'\x22');}else{_0x120b8e['push'](_0x458a('0x7d'));}break;case _0x458a('0x7e'):if(isEmail(_0x239e2f)){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e[_0x458a('0x1f')](_0x458a('0x7f'));}break;case _0x458a('0x80'):var _0x46df7c=moment(_0x239e2f,'YYYY-MM-DD',!![]);if(_0x46df7c[_0x458a('0x7a')]()){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e['push'](_0x458a('0x81'));}break;default:_0x31074e['push']('\x22'+_0x239e2f+'\x22');}}else{switch(_0x2ea9ce){case _0x458a('0x82'):case'phone':_0x120b8e[_0x458a('0x1f')](_0x2ea9ce+_0x458a('0x83'));break;default:_0x31074e[_0x458a('0x1f')]('\x22\x22');}}}}else{var _0x1fe8a1='';if(!_['isNil'](_0x48d7f2)){if(!_0x10dde3[_0x458a('0x84')](_0x48d7f2['id'])){for(var _0x14b95e=0x0;_0x14b95e<_0x5779cb[_0x2ea9ce][_0x458a('0x1c')];_0x14b95e++){var _0x239e2f=_[_0x458a('0x85')](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce][_0x14b95e]][_0x458a('0x79')](/"/g,'\x27'));var _0x259ab5=phoneDescriptions['find'](_0x3674f8=>_0x3674f8[_0x458a('0x86')]===_0x48d7f2['id']);if(!_[_0x458a('0x1d')](_0x259ab5)){var _0x4212af=_['trim'](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x259ab5[_0x458a('0x87')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x458a('0x1d')](_0x4212af))_0x239e2f=_0x239e2f+'§'+_0x4212af;}if(_0x1fe8a1=='')_0x1fe8a1=_0x239e2f;else _0x1fe8a1+='|'+_0x239e2f;}_0x573089[_0x458a('0x1f')](_0x48d7f2['id']+':'+_0x1fe8a1);_0x10dde3[_0x48d7f2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x31074e[_0x458a('0x1f')]('\x22'+_0x573089[_0x458a('0x16')](';')+'\x22');}if(_0x120b8e[_0x458a('0x1c')]){handleError(_0x3745d5['data'][_0x413d7c],{'code':_0x458a('0x88'),'message':_0x120b8e[_0x458a('0x16')]()});}else{fs[_0x458a('0x89')](_0x582ff7,_0x31074e[_0x458a('0x16')]()+'\x0a');}_0x31074e=[];}if(!(stats[_0x458a('0x77')]%0xc8)){socket[_0x458a('0x8a')](_0x458a('0x8b')+_0x17b611,stats);stats['errors']=[];}}if(stopped){logger[_0x458a('0x60')]('Abort\x20parser');_0x2b67dd[_0x458a('0x8c')]();}}catch(_0x36e650){handleError(_0x3745d5[_0x458a('0x76')][_0x413d7c],{'code':'SystemError','message':_0x36e650[_0x458a('0x22')]});logger['error']('step',_0x36e650[_0x458a('0x22')]);}},'complete':function(){try{var _0x400601=[];var _0x5464a5=tempTableName;_0x400601['push'](_0x458a('0x8d')+_0x5464a5+_0x458a('0x8e'));logger[_0x458a('0x60')](_0x458a('0x8f'),contactItemTypes[_0x458a('0x1c')]);var _0x50f1e0=util[_0x458a('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x582ff7,_0x5464a5,_0x527c09,_0x2e187b[_0x458a('0x3b')],_0x2e187b[_0x458a('0x5b')]||null,NOW,NOW);if(_[_0x458a('0x1d')](_0x5779cb['scheduledat'])){_0x50f1e0+=_0x458a('0x90');}_0x400601[_0x458a('0x1f')](_0x50f1e0);BPromise['each'](_0x400601,handleQuery)[_0x458a('0x24')](function(_0x5bf72f){BPromise[_0x458a('0x91')]([handleAdditionalPhones()])[_0x458a('0x24')](function(){_0x400601=[];for(var _0x470a3f=0x0;_0x470a3f\x20\x20');}var _0x4f29d3=path[_0x458a('0x16')](config[_0x458a('0x6a')],_0x458a('0x6b'),process[_0x458a('0x9a')][0x2]);if(!fs[_0x458a('0x9b')](_0x4f29d3)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x35d808={};try{_0x35d808=JSON[_0x458a('0x74')](process[_0x458a('0x9a')][0x3]);if(!_0x35d808[_0x458a('0x68')]){throw new Error(_0x458a('0x9c'));}var _0x2fa49e=0x0;if(_0x35d808[_0x458a('0x68')][_0x458a('0x3e')]){_0x2fa49e=0x1;}if(!_0x35d808['ListId']){throw new Error(_0x458a('0x9d'));}}catch(_0x3ec574){throw new Error(_0x458a('0x9e'));}var _0x45a134=[];try{_0x45a134=_[_0x458a('0x9f')](JSON[_0x458a('0x74')](process[_0x458a('0x9a')][0x4]),'id');}catch(_0x483a96){logger['info']('No\x20agent\x20available');}main(_0x4f29d3,_0x35d808,_0x45a134,_0x2fa49e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x458a('0xa0'),handleUncaughtException); \ No newline at end of file +var _0x90d0=['findOne','then','updated','create','PHONE','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','fromQuery','scheduledat','priority','UserId','recallme','select','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_hopper','toString','cm_contacts.ListId','cm_contacts.updatedAt','insert','into','cm_hopper_black','ListId','createdAt','updatedAt','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','fields',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','errors','code','info','main','stringify','clone','server/files/tmp','.csv','body','name','_description','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','dateOfBirth','isValid','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','exit','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','catch','message','split','CmContactHasItem'];(function(_0x5434c0,_0x2241c4){var _0x2a524c=function(_0x4679b8){while(--_0x4679b8){_0x5434c0['push'](_0x5434c0['shift']());}};_0x2a524c(++_0x2241c4);}(_0x90d0,0x10f));var _0x090d=function(_0x549443,_0x2e04c8){_0x549443=_0x549443-0x0;var _0x372ed3=_0x90d0[_0x549443];return _0x372ed3;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x090d('0x0'));var util=require(_0x090d('0x1'));var BPromise=require('bluebird');var moment=require(_0x090d('0x2'));var squel=require(_0x090d('0x3'));var Redis=require(_0x090d('0x4'));var db=require(_0x090d('0x5'))['db'];var config=require(_0x090d('0x6'));var logger=require(_0x090d('0x7'))(_0x090d('0x8'));config[_0x090d('0x9')]=_[_0x090d('0xa')](config[_0x090d('0x9')],{'host':_0x090d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));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()[_0x090d('0xc')](_0x090d('0xd'));var tempTableName=_0x090d('0xe')+moment()[_0x090d('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4d5ae1){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))*$/[_0x090d('0xf')](_0x4d5ae1);}function selectNotIn(_0x5e1f7c,_0x5d623e,_0x36a15e,_0x2817bb,_0x54118b){return squel['select']()[_0x090d('0x10')](_0x090d('0x11'))[_0x090d('0x12')](_0x2817bb)[_0x090d('0x13')](_0x5d623e,null,_0x5d623e+_0x090d('0x14')+_0x2817bb+'.'+_0x36a15e)['where'](_0x2817bb+'.'+_0x36a15e+'\x20=\x20'+_0x5e1f7c+'.'+_0x36a15e)[_0x090d('0x15')](_0x5d623e+_0x090d('0x16')+_0x54118b[_0x090d('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3bb0ad,_0x7c3033){promisesAdditionalPhones=[];promisesContact=[];return db[_0x090d('0x17')][_0x090d('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x090d('0x19')](function(_0x375772){if(_0x375772!==null){var _0x48eb74=[];for(var _0x2a6b07=0x0;_0x2a6b07<_0x375772[_0x090d('0x1a')];_0x2a6b07++){var _0x23ed2f=_0x375772[_0x2a6b07];if(!_[_0x090d('0x1b')](_0x23ed2f[_0x090d('0x11')])){if(!_[_0x090d('0x1b')](_0x23ed2f[_0x090d('0x1c')]))_0x48eb74[_0x090d('0x1d')](insertAdditionalPhones(_0x23ed2f));promisesContact[_0x090d('0x1d')]({'contact':_0x23ed2f});}}}Promise[_0x090d('0x1e')](_0x48eb74)['then'](function(){_0x3bb0ad({'val':0x1});});})[_0x090d('0x1f')](function(_0x19ad0f){logger['error'](_0x19ad0f[_0x090d('0x20')]);});});}function insertAdditionalPhones(_0x1e9693){return new Promise(function(_0x3ccc02,_0x184b36){var _0x5164ad=_0x1e9693[_0x090d('0x1c')];if(_[_0x090d('0x1b')](_0x5164ad))_0x184b36({'val':0x0});else{var _0x2169a5=_0x5164ad[_0x090d('0x21')](';');var _0x139c4a=[];orderBy=0x0;for(var _0x157766=0x0;_0x157766<_0x2169a5['length'];_0x157766++){_0x139c4a['push'](splitAdditionalPhone(_0x1e9693['id'],_0x2169a5[_0x157766]));}Promise[_0x090d('0x1e')](_0x139c4a)['then'](function(){_0x3ccc02({'val':_0x2169a5['length']});});}});}function splitAdditionalPhone(_0x6086b1,_0x288d94){return new Promise(function(_0x1b0253,_0x334994){var _0x41b596=_0x288d94['split'](':');var _0x5625de=_0x41b596[0x0];var _0x213ee3=_0x41b596[0x1];if(_0x213ee3!==''){var _0x2ee5cb=_0x213ee3[_0x090d('0x21')]('|');var _0x4fc4ea=[];for(var _0x46af8a=0x0;_0x46af8a<_0x2ee5cb[_0x090d('0x1a')];_0x46af8a++){if(_0x2ee5cb[_0x46af8a]!==''){var _0x28e64b=_['filter'](promisesAdditionalPhones,{'contactId':_0x6086b1,'phone':_0x2ee5cb[_0x46af8a]});if(_0x28e64b[_0x090d('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x090d('0x1d')]({'contactId':_0x6086b1,'contactTypeId':_0x5625de,'phone':_0x2ee5cb[_0x46af8a],'orderBy':orderBy});}}}_0x1b0253({'ok':0x1});}else _0x1b0253({'res':0x0});});}function createAdditionalPhone(_0x2376f2,_0x5a563a,_0x3d0811,_0x48f858){var _0x476292='';var _0x3b2527='';var _0x4fb603=_0x3d0811['split']('§');_0x476292=_0x4fb603[0x0];if(_0x4fb603['length']==0x2)_0x3b2527=_0x4fb603[0x1];return new Promise(function(_0xabceb,_0x4895fa){return db[_0x090d('0x22')][_0x090d('0x23')]({'where':{'CmContactId':_0x2376f2,'item':_0x476292}})[_0x090d('0x24')](function(_0xd017c4){if(_0xd017c4){return db[_0x090d('0x22')]['update']({'ItemTypeId':_0x5a563a,'description':_0x3b2527,'OrderBy':_0x48f858},{'where':{'CmContactId':_0x2376f2,'item':_0x476292}})[_0x090d('0x24')](function(_0x38a8c6){_0xabceb({'res':_0x090d('0x25')});});}else{return db[_0x090d('0x22')][_0x090d('0x26')]({'CmContactId':_0x2376f2,'item':_0x476292,'ItemTypeId':_0x5a563a,'description':_0x3b2527,'OrderBy':_0x48f858,'ItemClass':_0x090d('0x27')})['then'](function(_0x2a2c23){_0xabceb({'res':'inserted'});});}});});}function updateContact(_0xe42ef8){return new Promise(function(_0x3aa3f2,_0x497e7b){var _0x4df65a=_0xe42ef8['id'];delete _0xe42ef8['id'];return db['CmContact'][_0x090d('0x28')](_0xe42ef8,{'where':{'id':_0x4df65a}})['then'](function(_0x4c00a2){updatedRows+=0x1;return db[_0x090d('0x29')][_0x090d('0x28')]({'phone':_0xe42ef8[_0x090d('0x11')]},{'where':{'ContactId':_0x4df65a}})['then'](function(_0xc4af3f){_0x3aa3f2({'ret':'OK'});});});});}function insertCmHopper(_0x2425dd,_0x923ce8,_0x563901,_0x55d18d,_0x4eee88){var _0x5094e8=[_0x090d('0x2a'),_0x090d('0x2b'),_0x090d('0x2c'),'cm_contacts.ListId',_0x923ce8+'.'+_0x55d18d,_0x090d('0x2d'),'cm_contacts.updatedAt',_0x090d('0x2e'),_0x090d('0x2f'),'\x22'+_0x4eee88+'\x22'];return squel['insert']()['into']('cm_hopper')[_0x090d('0x30')]([_0x090d('0x11'),_0x090d('0x31'),'ContactId','ListId',_0x55d18d,'createdAt','updatedAt',_0x090d('0x32'),_0x090d('0x33'),_0x090d('0x34')],squel[_0x090d('0x35')]()['fields'](_0x5094e8)['from'](_0x923ce8)[_0x090d('0x13')](_0x090d('0x36'),null,_0x090d('0x37')+_0x923ce8+_0x090d('0x38'))[_0x090d('0x13')](_0x563901,null,_0x563901+'.id\x20=\x20'+_0x923ce8+'.'+_0x55d18d)[_0x090d('0x15')](_0x923ce8+_0x090d('0x39'),_0x2425dd)[_0x090d('0x15')](_0x090d('0x3a'),NOW)[_0x090d('0x15')](_0x090d('0x3b'),selectNotIn(_0x923ce8,_0x563901,_0x55d18d,'cm_hopper',[_0x090d('0x3c'),'\x22onlyIfOpen\x22']))[_0x090d('0x15')](_0x090d('0x3b'),selectNotIn(_0x923ce8,_0x563901,_0x55d18d,_0x090d('0x3d'),[_0x090d('0x3c')])))[_0x090d('0x3e')]();}function insertCmHopperBlack(_0x13aa45,_0x56db60,_0x8c29e3,_0x10dc48){var _0x41c8ad=['cm_contacts.phone',_0x090d('0x2c'),_0x090d('0x3f'),_0x56db60+'.'+_0x10dc48,_0x090d('0x2d'),_0x090d('0x40')];return squel[_0x090d('0x41')]()[_0x090d('0x42')](_0x090d('0x43'))[_0x090d('0x30')]([_0x090d('0x11'),'ContactId',_0x090d('0x44'),_0x10dc48,_0x090d('0x45'),_0x090d('0x46')],squel[_0x090d('0x35')]()['fields'](_0x41c8ad)[_0x090d('0x12')](_0x56db60)[_0x090d('0x13')](_0x090d('0x36'),null,_0x090d('0x37')+_0x56db60+_0x090d('0x38'))[_0x090d('0x13')](_0x8c29e3,null,_0x8c29e3+'.id\x20=\x20'+_0x56db60+'.'+_0x10dc48)[_0x090d('0x15')](_0x56db60+_0x090d('0x39'),_0x13aa45)[_0x090d('0x15')](_0x090d('0x3a'),NOW)[_0x090d('0x15')](_0x090d('0x3b'),squel[_0x090d('0x35')]()[_0x090d('0x10')](_0x090d('0x11'))[_0x090d('0x12')]('cm_hopper_black')[_0x090d('0x15')](_0x090d('0x47'),_0x13aa45)['where'](_0x10dc48+_0x090d('0x48'),_0x56db60+'.'+_0x10dc48)))[_0x090d('0x3e')]();}function insertCmHopperAdditionalPhones(_0x83f08){var _0x305426=[_0x090d('0x49'),_0x090d('0x4a'),_0x090d('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x090d('0x42')](_0x090d('0x4c'))[_0x090d('0x30')]([_0x090d('0x4d'),_0x090d('0x11'),_0x090d('0x4e'),_0x090d('0x45'),_0x090d('0x46')],squel['select']()['fields'](_0x305426)[_0x090d('0x12')](_0x090d('0x3d'))['join'](_0x090d('0x36'),null,_0x090d('0x4f'))[_0x090d('0x13')](_0x090d('0x50'),null,_0x090d('0x51'))['where'](_0x090d('0x52'),_0x83f08)[_0x090d('0x15')](_0x090d('0x3a'),NOW))[_0x090d('0x3e')]();}function insertCmContact(_0x2b7353,_0x5e182f,_0x1cc634,_0x368e08){var _0x5e135d=_[_0x090d('0x53')](_[_0x090d('0x54')](_0x368e08),[_0x090d('0x44'),_0x090d('0x55'),_0x090d('0x45'),_0x090d('0x46')]);return squel[_0x090d('0x41')]()[_0x090d('0x42')]('cm_contacts')['fromQuery'](_0x5e135d,squel['select']()[_0x090d('0x56')](_0x5e135d)[_0x090d('0x12')](_0x5e182f)[_0x090d('0x15')]('('+_0x1cc634[_0x090d('0x13')](',')+_0x090d('0x57'),squel[_0x090d('0x35')]()['fields'](_0x1cc634)['from'](_0x090d('0x36'))[_0x090d('0x15')]('ListId\x20=\x20?',_0x2b7353))[_0x090d('0x15')](_0x090d('0x58'),squel[_0x090d('0x35')]()[_0x090d('0x10')](_0x090d('0x59'),_0x090d('0x5a'))[_0x090d('0x12')](_0x5e182f)[_0x090d('0x5b')](_0x1cc634[_0x090d('0x13')](','))))[_0x090d('0x3e')]();}function handleStop(){logger['info'](_0x090d('0x5c'));stopped=!![];}function handleUncaughtException(_0x242261){logger[_0x090d('0x5d')](_0x242261[_0x090d('0x20')]);process['exit'](0x1);}function handleError(_0x1fc4f6,_0x3652bf){stats[_0x090d('0x5e')][_0x090d('0x1d')]({'name':_0x3652bf[_0x090d('0x5f')],'message':_0x3652bf['message'],'row':_0x1fc4f6});}function handleQuery(_0x1a741a){logger['info'](_0x1a741a);return db['sequelize'][_0x090d('0x18')](_0x1a741a)[_0x090d('0x19')](function(_0x119259){results[_0x090d('0x1d')](_0x119259);})[_0x090d('0x1f')](function(_0x4e960a){logger['error'](_0x4e960a[_0x090d('0x20')]);});}function main(_0x371e51,_0x19811a,_0x3ca73a,_0x3596e6){logger[_0x090d('0x60')](_0x090d('0x61'),_0x371e51,JSON[_0x090d('0x62')](_0x19811a));process['send']('start');var _0x4345fe=_0x19811a['binding'];var _0x403f35=_[_0x090d('0x63')](_0x4345fe);var _0xbd1ae2=_0x19811a['socket_timestamp'];var _0x5922e2=path[_0x090d('0x13')](config['root'],_0x090d('0x64'),_0xbd1ae2+_0x090d('0x65'));logger[_0x090d('0x60')](_0x090d('0x66'),_0x19811a);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x090d('0x67')]})['then'](function(_0x177016){for(var _0x38ccb4=0x0;_0x38ccb4<_0x177016[_0x090d('0x1a')];_0x38ccb4++){if(_0x177016[_0x38ccb4]['name']in _0x4345fe){contactItemTypes[_0x090d('0x1d')](_0x177016[_0x38ccb4]);delete _0x403f35[_0x177016[_0x38ccb4][_0x090d('0x67')]];hasAdditionalPhones=!![];}for(var _0x25d779 in _0x4345fe){if(_0x177016[_0x38ccb4][_0x090d('0x67')]+_0x090d('0x68')===_0x25d779){phoneDescriptions[_0x090d('0x1d')]({'itemTypeId':_0x177016[_0x38ccb4]['id'],'description':_0x25d779});delete _0x403f35[_0x25d779];}}}if(hasAdditionalPhones)_0x403f35[_0x090d('0x1c')]='';var _0x4fc1f2=_[_0x090d('0x54')](_0x403f35)[_0x090d('0x13')]();logger['info'](_0x090d('0x69'),_0x4fc1f2);fs[_0x090d('0x6a')](_0x5922e2,_0x4fc1f2+'\x0a');Papa['parse'](fs[_0x090d('0x6b')](_0x371e51),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fee7e,_0x1ba234){try{for(var _0x34d0d8=0x0,_0x397dfb=[];_0x34d0d8<_0x2fee7e[_0x090d('0x6c')]['length'];_0x34d0d8++){stats[_0x090d('0x6d')]+=0x1;if(_0x2fee7e[_0x090d('0x5e')][_0x34d0d8]){handleError(_0x2fee7e[_0x090d('0x6c')][_0x34d0d8],_0x2fee7e['errors'][_0x34d0d8]);}else{var _0x4a4e70=[];var _0x17f8ba=[];var _0x54962a={};for(var _0x334ec6 in _0x4345fe){let _0x254dc2=contactItemTypes[_0x090d('0x6e')](_0x353ce4=>_0x353ce4['name']===_0x334ec6);let _0x6d5a88=contactItemTypes['find'](_0x566c22=>_0x566c22[_0x090d('0x67')]+_0x090d('0x68')===_0x334ec6);if(_[_0x090d('0x1b')](_0x254dc2)&&_['isNil'](_0x6d5a88)){if(_0x4345fe[_0x090d('0x6f')](_0x334ec6)){if(_0x2fee7e[_0x090d('0x6c')][_0x34d0d8][_0x4345fe[_0x334ec6]]){var _0x4a4a77=_[_0x090d('0x70')](_0x2fee7e[_0x090d('0x6c')][_0x34d0d8][_0x4345fe[_0x334ec6]][_0x090d('0x71')](/"/g,'\x27'));switch(_0x334ec6){case'scheduledat':var _0x5de183=moment(_0x4a4a77,_0x090d('0xd'),!![]);if(_0x5de183['isValid']()){_0x397dfb[_0x090d('0x1d')]('\x22'+_0x4a4a77+'\x22');}else{_0x4a4e70[_0x090d('0x1d')](_0x090d('0x72'));}break;case _0x090d('0x32'):var _0x420576=parseInt(_0x4a4a77);_0x4a4a77=_[_0x090d('0x73')](_0x420576)||_0x420576<0x0||_0x420576>0x4?_0x3596e6?0x3:0x2:_0x420576;_0x397dfb[_0x090d('0x1d')]('\x22'+_0x4a4a77+'\x22');break;case'UserId':var _0x4ef476=parseInt(_0x4a4a77);if(_[_0x090d('0x74')](_0x4ef476)&&_[_0x090d('0x75')](_0x3ca73a,_0x4ef476)){_0x397dfb[_0x090d('0x1d')]('\x22'+_0x4ef476+'\x22');}else{_0x4a4e70[_0x090d('0x1d')](_0x090d('0x76'));}break;case'email':if(isEmail(_0x4a4a77)){_0x397dfb[_0x090d('0x1d')]('\x22'+_0x4a4a77+'\x22');}else{_0x4a4e70[_0x090d('0x1d')]('email\x20wrong\x20format');}break;case _0x090d('0x77'):var _0x54f8a3=moment(_0x4a4a77,'YYYY-MM-DD',!![]);if(_0x54f8a3[_0x090d('0x78')]()){_0x397dfb[_0x090d('0x1d')]('\x22'+_0x4a4a77+'\x22');}else{_0x4a4e70['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x397dfb['push']('\x22'+_0x4a4a77+'\x22');}}else{switch(_0x334ec6){case _0x090d('0x79'):case'phone':_0x4a4e70['push'](_0x334ec6+_0x090d('0x7a'));break;default:_0x397dfb[_0x090d('0x1d')]('\x22\x22');}}}}else{var _0x3e01fb='';if(!_[_0x090d('0x1b')](_0x254dc2)){if(!_0x54962a[_0x090d('0x6f')](_0x254dc2['id'])){for(var _0x5083b5=0x0;_0x5083b5<_0x4345fe[_0x334ec6][_0x090d('0x1a')];_0x5083b5++){var _0x4a4a77=_['trim'](_0x2fee7e[_0x090d('0x6c')][_0x34d0d8][_0x4345fe[_0x334ec6][_0x5083b5]][_0x090d('0x71')](/"/g,'\x27'));var _0xb81878=phoneDescriptions[_0x090d('0x6e')](_0x316aa9=>_0x316aa9[_0x090d('0x7b')]===_0x254dc2['id']);if(!_[_0x090d('0x1b')](_0xb81878)){var _0x431c26=_[_0x090d('0x70')](_0x2fee7e['data'][_0x34d0d8][_0x4345fe[_0xb81878['description']][0x0]][_0x090d('0x71')](/"/g,'\x27'));if(!_[_0x090d('0x1b')](_0x431c26))_0x4a4a77=_0x4a4a77+'§'+_0x431c26;}if(_0x3e01fb=='')_0x3e01fb=_0x4a4a77;else _0x3e01fb+='|'+_0x4a4a77;}_0x17f8ba[_0x090d('0x1d')](_0x254dc2['id']+':'+_0x3e01fb);_0x54962a[_0x254dc2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x397dfb['push']('\x22'+_0x17f8ba[_0x090d('0x13')](';')+'\x22');}if(_0x4a4e70[_0x090d('0x1a')]){handleError(_0x2fee7e[_0x090d('0x6c')][_0x34d0d8],{'code':_0x090d('0x7c'),'message':_0x4a4e70[_0x090d('0x13')]()});}else{fs[_0x090d('0x7d')](_0x5922e2,_0x397dfb[_0x090d('0x13')]()+'\x0a');}_0x397dfb=[];}if(!(stats['rows']%0xc8)){socket[_0x090d('0x7e')](_0x090d('0x7f')+_0xbd1ae2,stats);stats[_0x090d('0x5e')]=[];}}if(stopped){logger[_0x090d('0x60')]('Abort\x20parser');_0x1ba234[_0x090d('0x80')]();}}catch(_0x17038b){handleError(_0x2fee7e[_0x090d('0x6c')][_0x34d0d8],{'code':_0x090d('0x81'),'message':_0x17038b[_0x090d('0x20')]});logger[_0x090d('0x5d')](_0x090d('0x82'),_0x17038b['message']);}},'complete':function(){try{var _0x87a958=[];var _0x5b7e19=tempTableName;_0x87a958[_0x090d('0x1d')]('CREATE\x20TABLE\x20'+_0x5b7e19+_0x090d('0x83'));logger[_0x090d('0x60')]('CIS\x20len',contactItemTypes[_0x090d('0x1a')]);var _0xd29fec=util[_0x090d('0xc')](_0x090d('0x84'),_0x5922e2,_0x5b7e19,_0x4fc1f2,_0x19811a['ListId'],_0x19811a[_0x090d('0x55')]||null,NOW,NOW);if(_[_0x090d('0x1b')](_0x4345fe[_0x090d('0x31')])){_0xd29fec+=_0x090d('0x85');}_0x87a958[_0x090d('0x1d')](_0xd29fec);BPromise[_0x090d('0x86')](_0x87a958,handleQuery)[_0x090d('0x24')](function(_0x3f42a6){BPromise[_0x090d('0x1e')]([handleAdditionalPhones()])[_0x090d('0x24')](function(){_0x87a958=[];for(var _0x4631c8=0x0;_0x4631c8\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','select','field','name','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','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','sms','whatsapp','i.phone\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','value','end','unreadMessages','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','split','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','buildExpression','plainBody','body','some','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','Websites','Accounts','resolve','agent','i.thirdDisposition'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2dc3,0x183));var _0x32dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dc3[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var squel=require(_0x32dc('0x0'));var as=require(_0x32dc('0x1'));var qs=require(_0x32dc('0x2'));var updateInteraction=require(_0x32dc('0x3'))[_0x32dc('0x4')];var utils=require(_0x32dc('0x5'));var db=require(_0x32dc('0x6'))['db'];function skipInteractionsQuery(_0x2534ba,_0x2ed11d,_0x39dbf8){var _0x1f74d5=![];var _0x10dc57=utils[_0x32dc('0x7')](_0x2534ba);if(_0x2ed11d['role']==='agent'&&!_0x39dbf8['search']&&!_0x39dbf8[_0x10dc57]){_0x1f74d5=!![];}return _0x1f74d5;}function getTagsQuery(){return squel[_0x32dc('0x8')]()[_0x32dc('0x9')]('id')[_0x32dc('0x9')](_0x32dc('0xa'))[_0x32dc('0x9')]('color')['from'](_0x32dc('0xb'));}function getUsersQuery(_0x24e2f2,_0x459919){var _0x2dd7f6=utils[_0x32dc('0xc')](_0x24e2f2);var _0x3fdcd1=_0x32dc('0xd')+_0x24e2f2+_0x32dc('0xe');var _0x41de5a=squel['select']()[_0x32dc('0x9')]('u.id')[_0x32dc('0x9')](_0x32dc('0xf'))[_0x32dc('0x9')](_0x32dc('0x10')+_0x2dd7f6)[_0x32dc('0x11')](_0x3fdcd1,'ui')[_0x32dc('0x12')](_0x32dc('0x13'),'u',_0x32dc('0x14'));if(_0x459919[_0x32dc('0x15')]>0x0){_0x41de5a[_0x32dc('0x16')](_0x32dc('0x10')+_0x2dd7f6+_0x32dc('0x17'),_[_0x32dc('0x18')](_0x459919,'id'));}return _0x41de5a;}function getInteractionsQuery(_0x3700cb){var _0x32954b=utils[_0x32dc('0x19')](_0x3700cb);var _0x217349=utils[_0x32dc('0x7')](_0x3700cb);var _0x7184c9=utils['getInteractionFK'](_0x3700cb);return squel['select']()[_0x32dc('0x11')](_0x32954b['interactions'],'i')[_0x32dc('0x12')](_0x32dc('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x32dc('0x13'),'o',_0x32dc('0x1b'))[_0x32dc('0x12')](_0x32954b['accounts'],'a',_0x32dc('0x1c')+_0x217349)['left_join'](_0x32954b[_0x32dc('0x1d')],'me',_0x32dc('0x1e')+_0x7184c9+_0x32dc('0x1f'))['left_join'](_0x32954b['interactionsTags'],'it',_0x32dc('0x20')+_0x7184c9+_0x32dc('0x1f'))[_0x32dc('0x12')]('tools_tags','t',_0x32dc('0x21'));}function getSqlClauses(){var _0xac7d3a={'body':squel['expr'](),'contact':squel[_0x32dc('0x22')](),'default':squel[_0x32dc('0x22')](),'fields':squel[_0x32dc('0x22')](),'filter':squel[_0x32dc('0x22')](),'read':squel[_0x32dc('0x22')](),'tags':{'clause':squel[_0x32dc('0x22')](),'ids':null},'user':squel['expr']()};return _0xac7d3a;}function parseTagParameter(_0x499192){var _0x9a7a87=squel['expr']();if(_0x499192){var _0x20e5d5=utils[_0x32dc('0x23')](_0x499192);_0x20e5d5[_0x32dc('0x24')](function(_0x5e90f3){_0x9a7a87['or'](_0x32dc('0x25'),'%,'+_0x5e90f3+',%');});}return _0x9a7a87;}function parseReadParameter(_0x783847){var _0x4bf063='';if(_0x783847){_0x4bf063=_0x32dc('0x26');if(_0x783847==='1'){_0x4bf063=_0x4bf063['replace']('{OPERATOR}','=');}else{_0x4bf063=_0x4bf063[_0x32dc('0x27')](_0x32dc('0x28'),'>');}}return _0x4bf063;}function parseSearchFilter(_0x220ba6,_0x26a810){var _0x30104a=squel[_0x32dc('0x22')]();if(_0x26a810){var _0x5a7c5c=_0x26a810[_0x32dc('0x27')]('\x5c','\x5c\x5c')[_0x32dc('0x27')](/'/g,'\x27\x27');if(qs[_0x32dc('0x29')](_0x5a7c5c)){_0x30104a['or']('i.id\x20LIKE\x20?',_0x5a7c5c+'%');switch(_0x220ba6){case _0x32dc('0x2a'):case _0x32dc('0x2b'):_0x30104a['or'](_0x32dc('0x2c'),_0x5a7c5c+'%');break;case'fax':_0x30104a['or']('i.fax\x20LIKE\x20?',_0x5a7c5c+'%');break;case _0x32dc('0x2d'):_0x30104a['or'](_0x32dc('0x2e'),_0x5a7c5c+'%');break;case _0x32dc('0x2f'):_0x30104a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x5a7c5c,!![]))['or'](_0x32dc('0x31'),qs['getFullTextValue'](_0x5a7c5c));break;}}else if(_0x220ba6===_0x32dc('0x2f')&&qs['isEmail'](_0x5a7c5c)){_0x30104a['or'](_0x32dc('0x32'),_0x5a7c5c+'%');}else{if(_0x220ba6===_0x32dc('0x2f')){_0x30104a['or'](_0x32dc('0x33'),qs[_0x32dc('0x30')](_0x5a7c5c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x5a7c5c));}else if(_0x220ba6!==_0x32dc('0x34')){_0x30104a['or'](_0x32dc('0x35'),qs[_0x32dc('0x30')](_0x5a7c5c));}_0x30104a['or'](_0x32dc('0x36'),qs['getFullTextValue'](_0x5a7c5c,!![]),null);}}return _0x30104a;}function parseAdvancedSearchFilter(_0x4951a6,_0x2b23c9){var _0x7511dc=getSqlClauses();var _0x471b0e=as[_0x32dc('0x37')](_0x4951a6);var _0x2e93f0=_0x471b0e[_0x32dc('0x38')];for(var _0x53cb98=0x0;_0x53cb98<_0x471b0e[_0x32dc('0x39')][_0x32dc('0x15')];_0x53cb98++){var _0x159d37=_0x471b0e[_0x32dc('0x39')][_0x53cb98];var _0x366abf='i';var _0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),_0x159d37[_0x32dc('0x9')]]);if(_0x4fc9f3){var _0x5c657d=as['buildExpression'](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x3c')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')]['start'],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);}else{switch(_0x159d37[_0x32dc('0x9')]){case _0x32dc('0x40'):var _0x33b245=parseReadParameter(_0x159d37[_0x32dc('0x3e')]);_0x7511dc[_0x32dc('0x41')][_0x32dc('0x42')](_0x33b245);break;case _0x32dc('0x43'):if(_0x159d37[_0x32dc('0x44')]===_0x32dc('0x45')){if(_0x159d37[_0x32dc('0x3e')]['split']('\x20')[_0x32dc('0x15')]>0x1){_0x7511dc[_0x32dc('0x46')][_0x2e93f0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x159d37[_0x32dc('0x3e')],!![]),null);}else{var _0x9dce3b='%'+_0x159d37[_0x32dc('0x3e')]+'%';_0x7511dc[_0x32dc('0x46')][_0x2e93f0](_0x32dc('0x47'),_0x9dce3b,_0x9dce3b,_0x9dce3b);}}else{_0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),'ContactId']);_0x159d37[_0x32dc('0x9')]=_0x32dc('0x48');_0x5c657d=as['buildExpression'](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x46')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x49')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);}break;case _0x32dc('0x4a'):var _0x3f4093=_0x159d37[_0x32dc('0x3e')][_0x32dc('0x4b')](',')[_0x32dc('0x18')](function(_0x1ecbda){return Number(_0x1ecbda);});var _0x2160b7=parseTagParameter(_0x3f4093);_0x7511dc[_0x32dc('0x4c')][_0x32dc('0x4d')]['and'](_0x2160b7);_0x7511dc[_0x32dc('0x4c')][_0x32dc('0x4e')]=_0x3f4093;break;case _0x32dc('0x4f'):if(_0x159d37[_0x32dc('0x44')]===_0x32dc('0x45')){_0x7511dc[_0x32dc('0x50')][_0x2e93f0](_0x32dc('0x51'),'%'+_0x159d37[_0x32dc('0x3e')]+'%',null);}else{_0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),_0x32dc('0x52')]);_0x159d37['field']=_0x32dc('0x52');_0x5c657d=as[_0x32dc('0x53')](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x50')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x49')],_0x5c657d[_0x32dc('0x3e')]['end']);}break;case'body':case _0x32dc('0x54'):_0x5c657d=as[_0x32dc('0x53')]('me',null,_0x159d37);_0x7511dc[_0x32dc('0x55')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')]['start'],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);break;}}}return _0x7511dc;}function parseModelFields(_0x106ce7,_0x9157d6,_0x5df39e){var _0x45efeb=utils[_0x32dc('0x7')](_0x106ce7);var _0x5ac4d8=squel[_0x32dc('0x22')]();var _0x5f4147=_(_0x9157d6)['keys']()[_0x32dc('0x18')](function(_0x182377){return _[_0x32dc('0x56')](_0x5df39e,[_0x32dc('0xa'),_0x182377])?_0x182377:undefined;})['compact']()['value']();if(_0x5f4147['length']>0x0){_0x5f4147[_0x32dc('0x24')](function(_0x397da5){if(_0x397da5===_0x45efeb){_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x45efeb+'\x20IN\x20?',[][_0x32dc('0x57')](_0x9157d6[_0x397da5]));}else if(_0x397da5===_0x32dc('0x58')){var _0x4a887e=JSON['parse'](_0x9157d6[_0x397da5])[_0x32dc('0x59')];var _0x58a3f1=JSON[_0x32dc('0x5a')](_0x9157d6[_0x397da5])[_0x32dc('0x5b')];_0x5ac4d8['and'](_0x32dc('0x5c'),_0x4a887e,_0x58a3f1);}else{if(_0x9157d6[_0x397da5]==='null'){_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x397da5+_0x32dc('0x5d'));}else{_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x397da5+_0x32dc('0x5e'),_0x9157d6[_0x397da5]);}}});}return _0x5ac4d8;}function parseQueryParameters(_0x1c130f,_0x295a59,_0x3a6bac){var _0x44084f=getSqlClauses();return Promise['resolve']()[_0x32dc('0x5f')](function(){return parseModelFields(_0x1c130f,_0x295a59,_0x3a6bac);})[_0x32dc('0x5f')](function(_0x5ce180){_0x44084f[_0x32dc('0x60')][_0x32dc('0x42')](_0x5ce180);return parseReadParameter(_0x295a59['read']);})[_0x32dc('0x5f')](function(_0x316d6c){_0x44084f[_0x32dc('0x41')]['and'](_0x316d6c);return parseTagParameter(_0x295a59[_0x32dc('0x61')]);})[_0x32dc('0x5f')](function(_0x3c193a){_0x44084f[_0x32dc('0x4c')][_0x32dc('0x4d')][_0x32dc('0x42')](_0x3c193a);return parseSearchFilter(_0x1c130f,_0x295a59[_0x32dc('0x62')]);})[_0x32dc('0x5f')](function(_0x5de78e){_0x44084f[_0x32dc('0x62')]=_0x5de78e;return _0x44084f;});}function checkAccountsRestrictions(_0x2200f8,_0x50ec92,_0x2e0fab){var _0x3298c1=utils[_0x32dc('0x7')](_0x2200f8);var _0x17eb10=_0x32dc('0x63')+_['capitalize'](_0x2200f8)+(_0x2200f8==='chat'?_0x32dc('0x64'):_0x32dc('0x65'));var _0x56e9d6=squel[_0x32dc('0x22')]();return Promise[_0x32dc('0x66')]()[_0x32dc('0x5f')](function(){if(_0x2e0fab['search']&&_0x50ec92['role']===_0x32dc('0x67')){return _0x50ec92[_0x17eb10]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x21b4e8){if(_0x21b4e8){if(_0x21b4e8[_0x32dc('0x15')]===0x0){_0x56e9d6['and']('i.'+_0x3298c1+_0x32dc('0x5d'));}else{_0x56e9d6[_0x32dc('0x42')]('i.'+_0x3298c1+_0x32dc('0x17'),_[_0x32dc('0x18')](_0x21b4e8,'id'));}}else if(!_0x2e0fab[_0x3298c1]){_0x56e9d6[_0x32dc('0x42')]('i.'+_0x3298c1+'\x20IS\x20NOT\x20NULL');}})[_0x32dc('0x5f')](function(){return _0x56e9d6;});}function getClosedOrderClause(_0x5c882d,_0x335d39){var _0x28f206='';var _0x26f3d1=[_0x32dc('0x68'),_0x32dc('0x69'),_0x32dc('0x6a')];if(_0x5c882d==='mail'){_0x26f3d1[_0x32dc('0x6b')](_0x32dc('0x6c'));}if(_0x335d39[_0x32dc('0x6d')]==='0'&&_0x5c882d===_0x32dc('0x2f')){_0x28f206='i.substatus';}else{if(_0x335d39[_0x32dc('0x6d')]==='1'){_0x26f3d1['shift']();}_0x28f206=_0x32dc('0x6e')+_0x26f3d1['join'](',\x20')+')';}return _0x28f206;}function getFilteredInteractions(_0x4208b5,_0x3aeff8,_0x5de883,_0x486349){var _0x87f387=utils[_0x32dc('0xc')](_0x4208b5);var _0x1b1ebc=_[_0x32dc('0x6f')](_0x4208b5)+'Interaction';var _0x3aa663=[];var _0x27f643=getTagsQuery();var _0x39758f={'type':db[_0x32dc('0x70')][_0x32dc('0x71')][_0x32dc('0x72')],'raw':!![]};var _0x2bb7d2=[];var _0xd79d0d=[];return db['sequelize'][_0x32dc('0x73')](_0x27f643[_0x32dc('0x74')](),_0x39758f)[_0x32dc('0x5f')](function(_0x2f4e00){_0x3aa663=_[_0x32dc('0x75')](_0x2f4e00,'id');_0x39758f=_[_0x32dc('0x76')](_0x39758f,{'model':db[_0x1b1ebc],'mapToModel':!![],'nest':!![]});if(_0x5de883[_0x32dc('0x60')]){_0x486349[_0x32dc('0x77')][_0x32dc('0x24')](function(_0x36d9f1){_0x3aeff8['field']('i.'+_0x36d9f1);});}else{_0x3aeff8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32dc('0x40'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x78'),'Account.key');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x79'),_0x32dc('0x7a'));if(_0x4208b5==='mail'){_0x3aeff8[_0x32dc('0x9')]('a.email','Account.email');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7b'),_0x32dc('0x7c'));_0x3aeff8[_0x32dc('0x9')]('i.id');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7d'));_0x3aeff8['field'](_0x32dc('0x7e'));_0x3aeff8[_0x32dc('0x9')]('i.closed');_0x3aeff8[_0x32dc('0x9')]('i.closedAt');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7f'));_0x3aeff8['field'](_0x32dc('0x80'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x81'));_0x3aeff8['field'](_0x32dc('0x82'));_0x3aeff8[_0x32dc('0x9')]('i.disposition');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x69'));_0x3aeff8['field'](_0x32dc('0x68'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x6c'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x83'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x84'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x85'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x86'));}else if(_0x4208b5===_0x32dc('0x2d')){_0x3aeff8[_0x32dc('0x9')]('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',_0x32dc('0x7c'));}else{_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x87'),'contactName');}if(_0x4208b5!==_0x32dc('0x2f')){_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x88'));}_0x3aeff8[_0x32dc('0x9')]('c.firstName',_0x32dc('0x89'));_0x3aeff8[_0x32dc('0x9')]('c.lastName',_0x32dc('0x8a'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x8b'),_0x32dc('0x8c'));_0x3aeff8[_0x32dc('0x9')]('c.phone',_0x32dc('0x8d'));_0x3aeff8[_0x32dc('0x9')]('c.mobile',_0x32dc('0x8e'));_0x3aeff8['field'](_0x32dc('0x8f'),_0x32dc('0x90'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x91'),_0x32dc('0x92'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x93'),_0x32dc('0x94'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x95'),'TagIds');}if(_0x486349['limit']){_0x3aeff8[_0x32dc('0x96')](_0x486349[_0x32dc('0x96')]);}if(_0x486349[_0x32dc('0x97')]){_0x3aeff8[_0x32dc('0x97')](_0x486349['offset']);}return db[_0x32dc('0x98')][_0x32dc('0x73')](_0x3aeff8[_0x32dc('0x74')](),_0x39758f);})[_0x32dc('0x5f')](function(_0x52ba2d){_0x2bb7d2=_0x52ba2d;var _0x2e18ae=getUsersQuery(_0x4208b5,_0x2bb7d2);return db['sequelize'][_0x32dc('0x73')](_0x2e18ae['toString'](),_0x39758f);})['then'](function(_0x3f3864){_0xd79d0d=_[_0x32dc('0x99')](_0x3f3864,_0x87f387);if(_0x4208b5===_0x32dc('0x2f')){return db[_0x32dc('0x9a')][_0x32dc('0x9b')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x32dc('0x5f')](function(_0xad1505){var _0x1f212d=_0xad1505?_0xad1505[_0x32dc('0x9c')]:undefined;var _0x86d5a1=_0x2bb7d2[_0x32dc('0x18')](function(_0xaf2677){return updateInteraction(_0xaf2677,_0x3aa663,_0xd79d0d,_0x1f212d);});return Promise[_0x32dc('0x9d')](_0x86d5a1);});}function countFilteredInteractions(_0x1d2082,_0x2bbc8c){var _0x351d9a=_0x1d2082[_0x32dc('0x9e')]();_0x351d9a[_0x32dc('0x9')](_0x32dc('0x9f'));_0x351d9a['field'](_0x32dc('0xa0'),_0x32dc('0x40'));var _0xf41f9f=utils['getSelectedTags'](_0x2bbc8c);if(!_[_0x32dc('0xa1')](_0xf41f9f)){_0x351d9a[_0x32dc('0x16')](_0x32dc('0xa2'),_0xf41f9f);}var _0x3e0378={'type':db['Sequelize'][_0x32dc('0x71')][_0x32dc('0x72')],'raw':!![]};return db['sequelize'][_0x32dc('0x73')](_0x351d9a[_0x32dc('0x74')](),_0x3e0378);}module[_0x32dc('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd3f2=['o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.id','u.fullname','ui.','left_join','length','where','getInteractionsTables','getInteractionFK','interactions','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','default','text','value','end','unreadMessages','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','Tag','map','tags','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','keys','compact','forEach','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','clause','filter','get','capitalize','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Sequelize','SELECT','sequelize','query','keyBy','attributes','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xd3f2,0xb4));var _0x2d3f=function(_0x2e8874,_0x13cd6c){_0x2e8874=_0x2e8874-0x0;var _0x4ca0cb=_0xd3f2[_0x2e8874];return _0x4ca0cb;};'use strict';var _=require(_0x2d3f('0x0'));var squel=require('squel');var as=require(_0x2d3f('0x1'));var qs=require(_0x2d3f('0x2'));var updateInteraction=require(_0x2d3f('0x3'))[_0x2d3f('0x4')];var utils=require(_0x2d3f('0x5'));var db=require(_0x2d3f('0x6'))['db'];function skipInteractionsQuery(_0x9f5543,_0x446334,_0x224c04){var _0x5d2b95=![];var _0x1ab7db=utils[_0x2d3f('0x7')](_0x9f5543);if(_0x446334[_0x2d3f('0x8')]===_0x2d3f('0x9')&&!_0x224c04[_0x2d3f('0xa')]&&!_0x224c04[_0x1ab7db]){_0x5d2b95=!![];}return _0x5d2b95;}function getTagsQuery(){return squel[_0x2d3f('0xb')]()[_0x2d3f('0xc')]('id')[_0x2d3f('0xc')](_0x2d3f('0xd'))[_0x2d3f('0xc')](_0x2d3f('0xe'))[_0x2d3f('0xf')](_0x2d3f('0x10'));}function getUsersQuery(_0x2744fd,_0x5ae9c6){var _0x32afa7=utils['getInteractionFK'](_0x2744fd);var _0x24eb2a=_0x2d3f('0x11')+_0x2744fd+_0x2d3f('0x12');var _0x4f7607=squel[_0x2d3f('0xb')]()[_0x2d3f('0xc')](_0x2d3f('0x13'))['field'](_0x2d3f('0x14'))[_0x2d3f('0xc')](_0x2d3f('0x15')+_0x32afa7)[_0x2d3f('0xf')](_0x24eb2a,'ui')[_0x2d3f('0x16')]('users','u','u.id\x20=\x20ui.UserId');if(_0x5ae9c6[_0x2d3f('0x17')]>0x0){_0x4f7607[_0x2d3f('0x18')](_0x2d3f('0x15')+_0x32afa7+'\x20IN\x20?',_['map'](_0x5ae9c6,'id'));}return _0x4f7607;}function getInteractionsQuery(_0x3c6a3c){var _0x4e5de0=utils[_0x2d3f('0x19')](_0x3c6a3c);var _0x278a8d=utils[_0x2d3f('0x7')](_0x3c6a3c);var _0x4a1fae=utils[_0x2d3f('0x1a')](_0x3c6a3c);return squel[_0x2d3f('0xb')]()['from'](_0x4e5de0[_0x2d3f('0x1b')],'i')[_0x2d3f('0x16')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2d3f('0x16')](_0x2d3f('0x1c'),'o',_0x2d3f('0x1d'))[_0x2d3f('0x16')](_0x4e5de0['accounts'],'a',_0x2d3f('0x1e')+_0x278a8d)[_0x2d3f('0x16')](_0x4e5de0[_0x2d3f('0x1f')],'me','me.'+_0x4a1fae+'\x20=\x20i.id')[_0x2d3f('0x16')](_0x4e5de0[_0x2d3f('0x20')],'it',_0x2d3f('0x21')+_0x4a1fae+_0x2d3f('0x22'))[_0x2d3f('0x16')](_0x2d3f('0x10'),'t',_0x2d3f('0x23'));}function getSqlClauses(){var _0x26a8d3={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x2d3f('0x24')](),'fields':squel[_0x2d3f('0x24')](),'filter':squel[_0x2d3f('0x24')](),'read':squel[_0x2d3f('0x24')](),'tags':{'clause':squel[_0x2d3f('0x24')](),'ids':null},'user':squel[_0x2d3f('0x24')]()};return _0x26a8d3;}function parseTagParameter(_0x526d6d){var _0x52050e=squel[_0x2d3f('0x24')]();if(_0x526d6d){var _0x1b7291=utils[_0x2d3f('0x25')](_0x526d6d);_0x1b7291['forEach'](function(_0x18bc6d){_0x52050e['or'](_0x2d3f('0x26'),'%,'+_0x18bc6d+',%');});}return _0x52050e;}function parseReadParameter(_0x1d2438){var _0x146e91='';if(_0x1d2438){_0x146e91=_0x2d3f('0x27');if(_0x1d2438==='1'){_0x146e91=_0x146e91[_0x2d3f('0x28')]('{OPERATOR}','=');}else{_0x146e91=_0x146e91[_0x2d3f('0x28')](_0x2d3f('0x29'),'>');}}return _0x146e91;}function parseSearchFilter(_0x4907c8,_0x471cba){var _0x566a88=squel['expr']();if(_0x471cba){var _0x50af9c=_0x471cba[_0x2d3f('0x28')]('\x5c','\x5c\x5c')[_0x2d3f('0x28')](/'/g,'\x27\x27');if(qs[_0x2d3f('0x2a')](_0x50af9c)){_0x566a88['or'](_0x2d3f('0x2b'),_0x50af9c+'%');switch(_0x4907c8){case'sms':case _0x2d3f('0x2c'):_0x566a88['or'](_0x2d3f('0x2d'),_0x50af9c+'%');break;case _0x2d3f('0x2e'):_0x566a88['or']('i.fax\x20LIKE\x20?',_0x50af9c+'%');break;case'openchannel':_0x566a88['or'](_0x2d3f('0x2f'),_0x50af9c+'%');break;case _0x2d3f('0x30'):_0x566a88['or'](_0x2d3f('0x31'),qs['getFullTextValue'](_0x50af9c,!![]))['or'](_0x2d3f('0x32'),qs[_0x2d3f('0x33')](_0x50af9c));break;}}else if(_0x4907c8===_0x2d3f('0x30')&&qs['isEmail'](_0x50af9c)){_0x566a88['or']('c.email\x20LIKE\x20?',_0x50af9c+'%');}else{if(_0x4907c8===_0x2d3f('0x30')){_0x566a88['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2d3f('0x33')](_0x50af9c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2d3f('0x33')](_0x50af9c));}else if(_0x4907c8!==_0x2d3f('0x2e')){_0x566a88['or'](_0x2d3f('0x34'),qs[_0x2d3f('0x33')](_0x50af9c));}_0x566a88['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2d3f('0x33')](_0x50af9c,!![]),null);}}return _0x566a88;}function parseAdvancedSearchFilter(_0x4a9ec9,_0x1e9e29){var _0x4e314a=getSqlClauses();var _0x2fa970=as[_0x2d3f('0x35')](_0x4a9ec9);var _0x379356=_0x2fa970[_0x2d3f('0x36')];for(var _0x46f3b4=0x0;_0x46f3b4<_0x2fa970[_0x2d3f('0x37')][_0x2d3f('0x17')];_0x46f3b4++){var _0x1b4511=_0x2fa970[_0x2d3f('0x37')][_0x46f3b4];var _0x7e9739='i';var _0x466d8c=_['find'](_0x1e9e29,[_0x2d3f('0xd'),_0x1b4511[_0x2d3f('0xc')]]);if(_0x466d8c){var _0x1566b5=as['buildExpression'](_0x7e9739,_0x466d8c['type'],_0x1b4511);_0x4e314a[_0x2d3f('0x38')][_0x379356](_0x1566b5[_0x2d3f('0x39')],_0x1566b5[_0x2d3f('0x3a')]['start'],_0x1566b5[_0x2d3f('0x3a')][_0x2d3f('0x3b')]);}else{switch(_0x1b4511[_0x2d3f('0xc')]){case _0x2d3f('0x3c'):var _0x4f56cd=parseReadParameter(_0x1b4511[_0x2d3f('0x3a')]);_0x4e314a[_0x2d3f('0x3d')]['and'](_0x4f56cd);break;case _0x2d3f('0x3e'):if(_0x1b4511[_0x2d3f('0x3f')]===_0x2d3f('0x40')){if(_0x1b4511[_0x2d3f('0x3a')][_0x2d3f('0x41')]('\x20')['length']>0x1){_0x4e314a[_0x2d3f('0x42')][_0x379356]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2d3f('0x33')](_0x1b4511[_0x2d3f('0x3a')],!![]),null);}else{var _0x5d1413='%'+_0x1b4511[_0x2d3f('0x3a')]+'%';_0x4e314a['contact'][_0x379356](_0x2d3f('0x43'),_0x5d1413,_0x5d1413,_0x5d1413);}}else{_0x466d8c=_[_0x2d3f('0x44')](_0x1e9e29,[_0x2d3f('0xd'),_0x2d3f('0x45')]);_0x1b4511[_0x2d3f('0xc')]=_0x2d3f('0x45');_0x1566b5=as[_0x2d3f('0x46')](_0x7e9739,_0x466d8c[_0x2d3f('0x47')],_0x1b4511);_0x4e314a[_0x2d3f('0x42')][_0x379356](_0x1566b5[_0x2d3f('0x39')],_0x1566b5[_0x2d3f('0x3a')]['start'],_0x1566b5[_0x2d3f('0x3a')][_0x2d3f('0x3b')]);}break;case _0x2d3f('0x48'):var _0x394a99=_0x1b4511['value'][_0x2d3f('0x41')](',')[_0x2d3f('0x49')](function(_0x5a57a8){return Number(_0x5a57a8);});var _0x245866=parseTagParameter(_0x394a99);_0x4e314a[_0x2d3f('0x4a')]['clause'][_0x2d3f('0x4b')](_0x245866);_0x4e314a['tags'][_0x2d3f('0x4c')]=_0x394a99;break;case _0x2d3f('0x4d'):if(_0x1b4511['operator']===_0x2d3f('0x40')){_0x4e314a[_0x2d3f('0x4e')][_0x379356](_0x2d3f('0x4f'),'%'+_0x1b4511['value']+'%',null);}else{_0x466d8c=_[_0x2d3f('0x44')](_0x1e9e29,[_0x2d3f('0xd'),_0x2d3f('0x50')]);_0x1b4511[_0x2d3f('0xc')]=_0x2d3f('0x50');_0x1566b5=as[_0x2d3f('0x46')](_0x7e9739,_0x466d8c[_0x2d3f('0x47')],_0x1b4511);_0x4e314a['user'][_0x379356](_0x1566b5[_0x2d3f('0x39')],_0x1566b5[_0x2d3f('0x3a')]['start'],_0x1566b5[_0x2d3f('0x3a')][_0x2d3f('0x3b')]);}break;case'body':case'plainBody':_0x1566b5=as[_0x2d3f('0x46')]('me',null,_0x1b4511);_0x4e314a['body'][_0x379356](_0x1566b5['text'],_0x1566b5[_0x2d3f('0x3a')]['start'],_0x1566b5[_0x2d3f('0x3a')][_0x2d3f('0x3b')]);break;}}}return _0x4e314a;}function parseModelFields(_0x2d150a,_0x5d626d,_0x3bb428){var _0x2563c9=utils['getAccountFK'](_0x2d150a);var _0x9780ea=squel['expr']();var _0x3a7d27=_(_0x5d626d)[_0x2d3f('0x51')]()[_0x2d3f('0x49')](function(_0x5a86d2){return _['some'](_0x3bb428,[_0x2d3f('0xd'),_0x5a86d2])?_0x5a86d2:undefined;})[_0x2d3f('0x52')]()[_0x2d3f('0x3a')]();if(_0x3a7d27[_0x2d3f('0x17')]>0x0){_0x3a7d27[_0x2d3f('0x53')](function(_0x47169b){if(_0x47169b===_0x2563c9){_0x9780ea[_0x2d3f('0x4b')]('i.'+_0x2563c9+_0x2d3f('0x54'),[][_0x2d3f('0x55')](_0x5d626d[_0x47169b]));}else if(_0x47169b===_0x2d3f('0x56')){var _0xd3fe24=JSON[_0x2d3f('0x57')](_0x5d626d[_0x47169b])[_0x2d3f('0x58')];var _0x5bf74b=JSON[_0x2d3f('0x57')](_0x5d626d[_0x47169b])[_0x2d3f('0x59')];_0x9780ea[_0x2d3f('0x4b')](_0x2d3f('0x5a'),_0xd3fe24,_0x5bf74b);}else{if(_0x5d626d[_0x47169b]===_0x2d3f('0x5b')){_0x9780ea['and']('i.'+_0x47169b+_0x2d3f('0x5c'));}else{_0x9780ea[_0x2d3f('0x4b')]('i.'+_0x47169b+'\x20=\x20?',_0x5d626d[_0x47169b]);}}});}return _0x9780ea;}function parseQueryParameters(_0x453d2f,_0x2855be,_0x969e72){var _0x78d62d=getSqlClauses();return Promise[_0x2d3f('0x5d')]()['then'](function(){return parseModelFields(_0x453d2f,_0x2855be,_0x969e72);})[_0x2d3f('0x5e')](function(_0x31f914){_0x78d62d[_0x2d3f('0x5f')][_0x2d3f('0x4b')](_0x31f914);return parseReadParameter(_0x2855be[_0x2d3f('0x3d')]);})[_0x2d3f('0x5e')](function(_0x5e0350){_0x78d62d[_0x2d3f('0x3d')]['and'](_0x5e0350);return parseTagParameter(_0x2855be[_0x2d3f('0x60')]);})[_0x2d3f('0x5e')](function(_0x19c3c1){_0x78d62d[_0x2d3f('0x4a')][_0x2d3f('0x61')]['and'](_0x19c3c1);return parseSearchFilter(_0x453d2f,_0x2855be[_0x2d3f('0x62')]);})[_0x2d3f('0x5e')](function(_0x2191bb){_0x78d62d[_0x2d3f('0x62')]=_0x2191bb;return _0x78d62d;});}function checkAccountsRestrictions(_0x485ed2,_0x2bb64a,_0x306aae){var _0x27d4cb=utils[_0x2d3f('0x7')](_0x485ed2);var _0x39cd90=_0x2d3f('0x63')+_[_0x2d3f('0x64')](_0x485ed2)+(_0x485ed2==='chat'?'Websites':_0x2d3f('0x65'));var _0x24e12a=squel[_0x2d3f('0x24')]();return Promise['resolve']()['then'](function(){if(_0x306aae['search']&&_0x2bb64a['role']==='agent'){return _0x2bb64a[_0x39cd90]({'attributes':['id'],'raw':!![]});}})[_0x2d3f('0x5e')](function(_0x522d1c){if(_0x522d1c){if(_0x522d1c[_0x2d3f('0x17')]===0x0){_0x24e12a[_0x2d3f('0x4b')]('i.'+_0x27d4cb+_0x2d3f('0x5c'));}else{_0x24e12a[_0x2d3f('0x4b')]('i.'+_0x27d4cb+_0x2d3f('0x54'),_[_0x2d3f('0x49')](_0x522d1c,'id'));}}else if(!_0x306aae[_0x27d4cb]){_0x24e12a['and']('i.'+_0x27d4cb+_0x2d3f('0x66'));}})[_0x2d3f('0x5e')](function(){return _0x24e12a;});}function getClosedOrderClause(_0x13de23,_0x2d1e6d){var _0x3b0b16='';var _0x9029de=[_0x2d3f('0x67'),'i.secondDisposition',_0x2d3f('0x68')];if(_0x13de23===_0x2d3f('0x30')){_0x9029de[_0x2d3f('0x69')](_0x2d3f('0x6a'));}if(_0x2d1e6d[_0x2d3f('0x6b')]==='0'&&_0x13de23===_0x2d3f('0x30')){_0x3b0b16=_0x2d3f('0x6a');}else{if(_0x2d1e6d[_0x2d3f('0x6b')]==='1'){_0x9029de[_0x2d3f('0x6c')]();}_0x3b0b16='CONCAT_WS(\x27\x27,\x20'+_0x9029de[_0x2d3f('0x6d')](',\x20')+')';}return _0x3b0b16;}function getFilteredInteractions(_0x14677d,_0x46f0f5,_0x483144,_0x48e361){var _0x8c88fe=utils[_0x2d3f('0x1a')](_0x14677d);var _0x44d6e2=_['capitalize'](_0x14677d)+'Interaction';var _0x2bf7d4=[];var _0x54e517=getTagsQuery();var _0x334709={'type':db[_0x2d3f('0x6e')]['QueryTypes'][_0x2d3f('0x6f')],'raw':!![]};var _0x20101b=[];var _0xdc4757=[];return db[_0x2d3f('0x70')][_0x2d3f('0x71')](_0x54e517['toString'](),_0x334709)[_0x2d3f('0x5e')](function(_0x1eed8d){_0x2bf7d4=_[_0x2d3f('0x72')](_0x1eed8d,'id');_0x334709=_['merge'](_0x334709,{'model':db[_0x44d6e2],'mapToModel':!![],'nest':!![]});if(_0x483144[_0x2d3f('0x5f')]){_0x48e361[_0x2d3f('0x73')]['forEach'](function(_0x1a9856){_0x46f0f5[_0x2d3f('0xc')]('i.'+_0x1a9856);});}else{_0x46f0f5[_0x2d3f('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2d3f('0x3c'));_0x46f0f5['field']('a.key',_0x2d3f('0x74'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x75'),_0x2d3f('0x76'));if(_0x14677d==='mail'){_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x77'),'Account.email');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x78'),_0x2d3f('0x79'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x7a'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x7b'));_0x46f0f5[_0x2d3f('0xc')]('i.updatedAt');_0x46f0f5['field'](_0x2d3f('0x7c'));_0x46f0f5[_0x2d3f('0xc')]('i.closedAt');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x7d'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x7e'));_0x46f0f5['field'](_0x2d3f('0x7f'));_0x46f0f5[_0x2d3f('0xc')]('i.subject');_0x46f0f5[_0x2d3f('0xc')]('i.disposition');_0x46f0f5['field']('i.secondDisposition');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x67'));_0x46f0f5['field']('i.substatus');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x80'));_0x46f0f5['field'](_0x2d3f('0x81'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x82'));_0x46f0f5[_0x2d3f('0xc')]('i.UserId');}else if(_0x14677d===_0x2d3f('0x83')){_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x84'),'contactName');}else{_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x85'),_0x2d3f('0x79'));}if(_0x14677d!==_0x2d3f('0x30')){_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x86'));}_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x87'),'Contact.firstName');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x88'),'Contact.lastName');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x89'),'Contact.email');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x8a'),_0x2d3f('0x8b'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x8c'),_0x2d3f('0x8d'));_0x46f0f5['field'](_0x2d3f('0x8e'),_0x2d3f('0x8f'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x90'),_0x2d3f('0x91'));_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x92'),'Owner.internal');_0x46f0f5[_0x2d3f('0xc')](_0x2d3f('0x93'),_0x2d3f('0x94'));}if(_0x48e361[_0x2d3f('0x95')]){_0x46f0f5[_0x2d3f('0x95')](_0x48e361[_0x2d3f('0x95')]);}if(_0x48e361[_0x2d3f('0x96')]){_0x46f0f5['offset'](_0x48e361['offset']);}return db['sequelize'][_0x2d3f('0x71')](_0x46f0f5[_0x2d3f('0x97')](),_0x334709);})[_0x2d3f('0x5e')](function(_0x4de135){_0x20101b=_0x4de135;var _0x3501a3=getUsersQuery(_0x14677d,_0x20101b);return db[_0x2d3f('0x70')][_0x2d3f('0x71')](_0x3501a3[_0x2d3f('0x97')](),_0x334709);})[_0x2d3f('0x5e')](function(_0x5a47de){_0xdc4757=_[_0x2d3f('0x98')](_0x5a47de,_0x8c88fe);if(_0x14677d==='mail'){return db['Setting'][_0x2d3f('0x99')]({'attributes':[_0x2d3f('0x9a')],'raw':!![]});}})[_0x2d3f('0x5e')](function(_0x34b43f){var _0x3b8a9a=_0x34b43f?_0x34b43f['enableEmailPreview']:undefined;var _0x351ef0=_0x20101b[_0x2d3f('0x49')](function(_0x2edbe5){return updateInteraction(_0x2edbe5,_0x2bf7d4,_0xdc4757,_0x3b8a9a);});return Promise[_0x2d3f('0x9b')](_0x351ef0);});}function countFilteredInteractions(_0x193d3b,_0x36aa0e){var _0x334e46=_0x193d3b[_0x2d3f('0x9c')]();_0x334e46['field'](_0x2d3f('0x9d'));_0x334e46[_0x2d3f('0xc')](_0x2d3f('0x9e'),'unreadMessages');var _0x4237ef=utils[_0x2d3f('0x25')](_0x36aa0e);if(!_[_0x2d3f('0x9f')](_0x4237ef)){_0x334e46[_0x2d3f('0x18')](_0x2d3f('0xa0'),_0x4237ef);}var _0x504478={'type':db[_0x2d3f('0x6e')][_0x2d3f('0xa1')][_0x2d3f('0x6f')],'raw':!![]};return db['sequelize'][_0x2d3f('0x71')](_0x334e46[_0x2d3f('0x97')](),_0x504478);}module[_0x2d3f('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 c572848..c9851a6 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 _0xc561=['catch','then','TagIds','lodash','../../mysqldb','fullname','split','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','MailMessage','findOne','out','plainBody','trimStart'];(function(_0x45943c,_0x292e90){var _0xe1cf98=function(_0x4ba1ae){while(--_0x4ba1ae){_0x45943c['push'](_0x45943c['shift']());}};_0xe1cf98(++_0x292e90);}(_0xc561,0x153));var _0x1c56=function(_0x570e73,_0x538538){_0x570e73=_0x570e73-0x0;var _0x13134b=_0xc561[_0x570e73];return _0x13134b;};'use strict';var _=require(_0x1c56('0x0'));var db=require(_0x1c56('0x1'))['db'];function getInteractionUsers(_0x3d1ed8,_0x364c46){return new Promise(function(_0x5bc88d,_0x34408b){try{var _0x592912=[];if(_0x364c46[_0x3d1ed8]){_0x592912=_0x364c46[_0x3d1ed8]['map'](function(_0x251f8a){return{'id':_0x251f8a['id'],'fullname':_0x251f8a[_0x1c56('0x2')]};});}return _0x5bc88d(_0x592912);}catch(_0x2240f5){_0x34408b(_0x2240f5);}});}function getInteractionTags(_0x3e567d,_0x295fbc){var _0x163147=[];if(_0x3e567d){_0x3e567d[_0x1c56('0x3')](',')['forEach'](function(_0xe0c284){_0x163147['push'](_0x295fbc[_0xe0c284]);});}return _0x163147;}function updateWaitingCounter(_0x43e821){if(_0x43e821['waiting']){_0x43e821[_0x1c56('0x4')]-=0x1;}}function updateInteractionCounters(_0x2ffa05){_0x2ffa05[_0x1c56('0x4')]=0x0;_0x2ffa05[_0x1c56('0x5')]=0x0;_0x2ffa05[_0x1c56('0x6')]=0x0;_0x2ffa05[_0x1c56('0x7')]=0x0;_0x2ffa05[_0x1c56('0x8')]=0x0;_0x2ffa05['total']=0x0;if(_0x2ffa05[_0x1c56('0x9')]){if(_0x2ffa05[_0x1c56('0xa')]===_0x1c56('0x8')){_0x2ffa05['abandoned']+=0x1;updateWaitingCounter(_0x2ffa05);}if(_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05[_0x1c56('0x6')]+=0x1;if(_0x2ffa05['talking']){_0x2ffa05[_0x1c56('0x5')]-=0x1;}}else{if(_0x2ffa05[_0x1c56('0xa')]){_0x2ffa05['unmanaged']+=0x1;updateWaitingCounter(_0x2ffa05);}}}else{if(!_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05['waiting']+=0x1;}if(_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05[_0x1c56('0x5')]+=0x1;updateWaitingCounter(_0x2ffa05);}}_0x2ffa05[_0x1c56('0xc')]+=0x1;return _0x2ffa05;}function getLastMessageText(_0x2ef6c7){return db[_0x1c56('0xd')][_0x1c56('0xe')]({'where':{'$and':[{'MailInteractionId':_0x2ef6c7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1c56('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1c56('0x10')],'order':'-id','raw':!![]})['then'](function(_0x388907){if(_0x388907&&_0x388907[_0x1c56('0x10')]){_0x2ef6c7['lastMsgText']=_[_0x1c56('0x11')](_0x388907[_0x1c56('0x10')]);}return _0x2ef6c7;})[_0x1c56('0x12')](function(_0x2efc66){throw _0x2efc66;});}exports['updateInteraction']=function(_0x2d1b7f,_0x5d61d7,_0x50800e,_0x1d7dd6){return new Promise(function(_0x5fc6ce,_0x4b44f9){return getInteractionUsers(_0x2d1b7f['id'],_0x50800e)[_0x1c56('0x13')](function(_0xc9bbae){_0x2d1b7f['Users']=_0xc9bbae;return getInteractionTags(_0x2d1b7f[_0x1c56('0x14')],_0x5d61d7);})['then'](function(_0xa8989a){_0x2d1b7f['Tags']=_0xa8989a;delete _0x2d1b7f[_0x1c56('0x14')];return updateInteractionCounters(_0x2d1b7f);})['then'](function(_0x377979){if(_0x1d7dd6){return getLastMessageText(_0x377979);}else{return _0x377979;}})[_0x1c56('0x13')](function(_0x440ea6){_0x5fc6ce(_0x440ea6);})[_0x1c56('0x12')](function(_0x5c7462){_0x4b44f9(_0x5c7462);});});}; \ No newline at end of file +var _0x8968=['push','waiting','talking','unmanaged','abandoned','total','disposition','UserId','answered','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','TagIds','Tags','then','map','split','forEach'];(function(_0x3ad97d,_0x57e59f){var _0x336086=function(_0x48002b){while(--_0x48002b){_0x3ad97d['push'](_0x3ad97d['shift']());}};_0x336086(++_0x57e59f);}(_0x8968,0x97));var _0x8896=function(_0x959591,_0x5aa72b){_0x959591=_0x959591-0x0;var _0xc85623=_0x8968[_0x959591];return _0xc85623;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x105f56,_0x1dca14){return new Promise(function(_0x515159,_0x1fe8f3){try{var _0x4ab1d5=[];if(_0x1dca14[_0x105f56]){_0x4ab1d5=_0x1dca14[_0x105f56][_0x8896('0x0')](function(_0x3b115c){return{'id':_0x3b115c['id'],'fullname':_0x3b115c['fullname']};});}return _0x515159(_0x4ab1d5);}catch(_0x519269){_0x1fe8f3(_0x519269);}});}function getInteractionTags(_0x1599d7,_0x33e3bf){var _0x13cf42=[];if(_0x1599d7){_0x1599d7[_0x8896('0x1')](',')[_0x8896('0x2')](function(_0x4e71bb){_0x13cf42[_0x8896('0x3')](_0x33e3bf[_0x4e71bb]);});}return _0x13cf42;}function updateWaitingCounter(_0x21cd42){if(_0x21cd42[_0x8896('0x4')]){_0x21cd42[_0x8896('0x4')]-=0x1;}}function updateInteractionCounters(_0x549563){_0x549563[_0x8896('0x4')]=0x0;_0x549563[_0x8896('0x5')]=0x0;_0x549563['answered']=0x0;_0x549563[_0x8896('0x6')]=0x0;_0x549563[_0x8896('0x7')]=0x0;_0x549563[_0x8896('0x8')]=0x0;if(_0x549563['closed']){if(_0x549563[_0x8896('0x9')]===_0x8896('0x7')){_0x549563[_0x8896('0x7')]+=0x1;updateWaitingCounter(_0x549563);}if(_0x549563[_0x8896('0xa')]){_0x549563[_0x8896('0xb')]+=0x1;if(_0x549563[_0x8896('0x5')]){_0x549563[_0x8896('0x5')]-=0x1;}}else{if(_0x549563[_0x8896('0x9')]){_0x549563[_0x8896('0x6')]+=0x1;updateWaitingCounter(_0x549563);}}}else{if(!_0x549563[_0x8896('0xa')]){_0x549563[_0x8896('0x4')]+=0x1;}if(_0x549563[_0x8896('0xa')]){_0x549563[_0x8896('0x5')]+=0x1;updateWaitingCounter(_0x549563);}}_0x549563[_0x8896('0x8')]+=0x1;return _0x549563;}function getLastMessageText(_0x5a8536){return db['MailMessage'][_0x8896('0xc')]({'where':{'$and':[{'MailInteractionId':_0x5a8536['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8896('0xd')],'order':_0x8896('0xe'),'raw':!![]})['then'](function(_0x571ab8){if(_0x571ab8&&_0x571ab8[_0x8896('0xd')]){_0x5a8536[_0x8896('0xf')]=_[_0x8896('0x10')](_0x571ab8['plainBody']);}return _0x5a8536;})[_0x8896('0x11')](function(_0x7f1115){throw _0x7f1115;});}exports[_0x8896('0x12')]=function(_0xc5922e,_0x2a53a1,_0x510bc3,_0x280707){return new Promise(function(_0x130b0f,_0x319825){return getInteractionUsers(_0xc5922e['id'],_0x510bc3)['then'](function(_0x4ae665){_0xc5922e['Users']=_0x4ae665;return getInteractionTags(_0xc5922e[_0x8896('0x13')],_0x2a53a1);})['then'](function(_0x88d2c6){_0xc5922e[_0x8896('0x14')]=_0x88d2c6;delete _0xc5922e[_0x8896('0x13')];return updateInteractionCounters(_0xc5922e);})['then'](function(_0x323566){if(_0x280707){return getLastMessageText(_0x323566);}else{return _0x323566;}})[_0x8896('0x15')](function(_0x3086da){_0x130b0f(_0x3086da);})[_0x8896('0x11')](function(_0x3b60fd){_0x319825(_0x3b60fd);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d29584a..464de52 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 _0x3a3d=['info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','then'];(function(_0xc6e4ea,_0x35edbe){var _0x76c775=function(_0x7dbd2b){while(--_0x7dbd2b){_0xc6e4ea['push'](_0xc6e4ea['shift']());}};_0x76c775(++_0x35edbe);}(_0x3a3d,0x159));var _0xd3a3=function(_0x5d0b8a,_0x2c191){_0x5d0b8a=_0x5d0b8a-0x0;var _0x480785=_0x3a3d[_0x5d0b8a];return _0x480785;};'use strict';var _=require(_0xd3a3('0x0'));var db=require(_0xd3a3('0x1'))['db'];var loggers={'openchannel':require(_0xd3a3('0x2'))(_0xd3a3('0x3')),'mail':require(_0xd3a3('0x2'))('mail-interactions'),'fax':require(_0xd3a3('0x2'))(_0xd3a3('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xd3a3('0x2'))(_0xd3a3('0x5')),'whatsapp':require(_0xd3a3('0x2'))(_0xd3a3('0x6'))};function getAccountFK(_0x497d72){return _[_0xd3a3('0x7')](_0x497d72)+(_0x497d72===_0xd3a3('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x500a6a){return _[_0xd3a3('0x7')](_0x500a6a)+'InteractionId';}function getInteractionId(_0x342404,_0x17f554,_0x251987){if(_0x342404&&_0x342404[_[_0xd3a3('0x9')](_0x251987)+'InteractionId']){return _0x342404[_['upperFirst'](_0x251987)+_0xd3a3('0xa')];}else if(_0x342404&&_0x342404['id']){return _0x342404['id'];}else if(_0x17f554&&_0x17f554['id']){return _0x17f554['id'];}else{return _0xd3a3('0xb');}}function getInteractionsTables(_0x5ef69f){return{'accounts':_0x5ef69f+'_'+(_0x5ef69f===_0xd3a3('0x8')?_0xd3a3('0xc'):_0xd3a3('0xd')),'interactions':_0x5ef69f+_0xd3a3('0xe'),'interactionsTags':_0x5ef69f+_0xd3a3('0xf'),'messages':_0x5ef69f+_0xd3a3('0x10'),'userInteractions':_0xd3a3('0x11')+_0x5ef69f+_0xd3a3('0xe')};}function getSelectedTags(_0x27f0cd){var _0xe1e145=[];if(_0x27f0cd){_0xe1e145=Array[_0xd3a3('0x12')](_0x27f0cd)?_0x27f0cd:[_0x27f0cd];}return _0xe1e145;}function log(_0x2668a0,_0x5d77c5,_0x2c0e57,_0x15acc6,_0x18366,_0xe93358){loggers[_0x18366[_0xd3a3('0x13')]()][_0x2668a0](_0xd3a3('0x14'),_0xe93358['toUpperCase'](),_0x5d77c5?_0x5d77c5['id']:null,_0x5d77c5?_0x5d77c5[_0xd3a3('0x15')]:null,_0x5d77c5?_0x5d77c5[_0xd3a3('0x16')]:null,getInteractionId(_0x2c0e57,_0x15acc6,_0x18366),_0x2c0e57?JSON['stringify'](_0x2c0e57):_0xd3a3('0x17'));}function updateUser(_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e){db[_[_0xd3a3('0x9')](_0x13a552)+_0xd3a3('0x18')][_0xd3a3('0x19')]({'where':{'id':getInteractionId(_0x974c01,_0x17bc5e,_0x13a552)}})[_0xd3a3('0x1a')](function(_0x5dfefc){if(_0x5dfefc){return _0x5dfefc['update']({'UserId':_0x1faafe?_0x1faafe['id']:null});}})[_0xd3a3('0x1a')](function(_0x5c89ef){if(_0x5c89ef){log(_0xd3a3('0x1b'),_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e);}})[_0xd3a3('0x1c')](function(){log(_0xd3a3('0x1d'),_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e);});}module[_0xd3a3('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x12ef=['upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','info','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId'];(function(_0x216a3d,_0x30a719){var _0xfb63d4=function(_0x5b6a10){while(--_0x5b6a10){_0x216a3d['push'](_0x216a3d['shift']());}};_0xfb63d4(++_0x30a719);}(_0x12ef,0x195));var _0xf12e=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x12ef[_0x5bf2b3];return _0x5e8a9b;};'use strict';var _=require(_0xf12e('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xf12e('0x1'))(_0xf12e('0x2')),'mail':require('../../config/logger')(_0xf12e('0x3')),'fax':require(_0xf12e('0x1'))(_0xf12e('0x4')),'sms':require(_0xf12e('0x1'))(_0xf12e('0x5')),'chat':require(_0xf12e('0x1'))('chat-interactions'),'whatsapp':require(_0xf12e('0x1'))(_0xf12e('0x6'))};function getAccountFK(_0x1619d8){return _[_0xf12e('0x7')](_0x1619d8)+(_0x1619d8===_0xf12e('0x8')?'Website':_0xf12e('0x9'))+'Id';}function getInteractionFK(_0x2e5146){return _[_0xf12e('0x7')](_0x2e5146)+_0xf12e('0xa');}function getInteractionId(_0x21cf40,_0x51e983,_0x441e78){if(_0x21cf40&&_0x21cf40[_[_0xf12e('0xb')](_0x441e78)+_0xf12e('0xa')]){return _0x21cf40[_[_0xf12e('0xb')](_0x441e78)+_0xf12e('0xa')];}else if(_0x21cf40&&_0x21cf40['id']){return _0x21cf40['id'];}else if(_0x51e983&&_0x51e983['id']){return _0x51e983['id'];}else{return _0xf12e('0xc');}}function getInteractionsTables(_0x52e9da){return{'accounts':_0x52e9da+'_'+(_0x52e9da===_0xf12e('0x8')?_0xf12e('0xd'):_0xf12e('0xe')),'interactions':_0x52e9da+_0xf12e('0xf'),'interactionsTags':_0x52e9da+_0xf12e('0x10'),'messages':_0x52e9da+_0xf12e('0x11'),'userInteractions':'user_has_'+_0x52e9da+_0xf12e('0xf')};}function getSelectedTags(_0x569482){var _0x23a873=[];if(_0x569482){_0x23a873=Array[_0xf12e('0x12')](_0x569482)?_0x569482:[_0x569482];}return _0x23a873;}function log(_0x5654d4,_0x111bd0,_0xfd81,_0x3b6d43,_0x40cb23,_0x1af1a0){loggers[_0x40cb23[_0xf12e('0x13')]()][_0x5654d4](_0xf12e('0x14'),_0x1af1a0['toUpperCase'](),_0x111bd0?_0x111bd0['id']:null,_0x111bd0?_0x111bd0[_0xf12e('0x15')]:null,_0x111bd0?_0x111bd0[_0xf12e('0x16')]:null,getInteractionId(_0xfd81,_0x3b6d43,_0x40cb23),_0xfd81?JSON[_0xf12e('0x17')](_0xfd81):_0xf12e('0x18'));}function updateUser(_0x71471a,_0x271571,_0x381d95,_0x1c442a,_0x14fdbb){db[_[_0xf12e('0xb')](_0x1c442a)+_0xf12e('0x19')][_0xf12e('0x1a')]({'where':{'id':getInteractionId(_0x271571,_0x381d95,_0x1c442a)}})[_0xf12e('0x1b')](function(_0x2c8e98){if(_0x2c8e98){return _0x2c8e98[_0xf12e('0x1c')]({'UserId':_0x71471a?_0x71471a['id']:null});}})[_0xf12e('0x1b')](function(_0x413ee9){if(_0x413ee9){log(_0xf12e('0x1d'),_0x71471a,_0x271571,_0x381d95,_0x1c442a,_0x14fdbb);}})['catch'](function(){log(_0xf12e('0x1e'),_0x71471a,_0x271571,_0x381d95,_0x1c442a,_0x14fdbb);});}module[_0xf12e('0x1f')]={'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 81edc9a..c846ce2 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 _0x4d45=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update','base64','utf8','final','parse','use','License'];(function(_0x297524,_0x1f308e){var _0x9bb17e=function(_0x116ef0){while(--_0x116ef0){_0x297524['push'](_0x297524['shift']());}};_0x9bb17e(++_0x1f308e);}(_0x4d45,0x14e));var _0x54d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d45[_0x3b380d];return _0x54502b;};'use strict';var crypto=require(_0x54d4('0x0'));var util=require('util');var compose=require(_0x54d4('0x1'));var db=require(_0x54d4('0x2'))['db'];var config=require(_0x54d4('0x3'));function getValueFromLicense(_0x251a0a,_0x2bc9aa){if(_0x251a0a&&_0x2bc9aa){if(_0x2bc9aa[_0x54d4('0x4')]&&_0x2bc9aa[_0x54d4('0x5')]){var _0x4a9efb=_0x2bc9aa[_0x54d4('0x4')];var _0x3ee04b=_0x2bc9aa['license'];var _0x45ef6c=_0x4a9efb[_0x54d4('0x6')]('-')[0x4];var _0x3fee9b=_0x4a9efb[_0x54d4('0x6')]('-')[0x0];var _0x3d9bb9=crypto[_0x54d4('0x7')]('aes-256-ctr',util[_0x54d4('0x8')]('%s:%s:%s',_0x45ef6c,_0x4a9efb,_0x3fee9b));var _0x88c6af=_0x3d9bb9[_0x54d4('0x9')](_0x3ee04b,_0x54d4('0xa'),_0x54d4('0xb'));_0x88c6af+=_0x3d9bb9[_0x54d4('0xc')]('utf8');var _0xd56d93=JSON[_0x54d4('0xd')](_0x88c6af);return _0xd56d93['hasOwnProperty'](_0x251a0a)?_0xd56d93[_0x251a0a]:null;}}return null;}function isLimit(_0x3829dc,_0xb5610b,_0x31aff9,_0x295afe){var _0x6b920a=_0xb5610b;return compose()[_0x54d4('0xe')](function(_0x35e6dd,_0x56df9c,_0xc53795){return db[_0x54d4('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x54d4('0x10')](function(_0x112bf1){var _0x4d885c=getValueFromLicense(_0x3829dc,_0x112bf1);return _0x4d885c?_0x4d885c:_0x6b920a;})['then'](function(_0x6390bd){_0x6b920a=_0x6390bd;return _0x31aff9[_0x54d4('0x11')](_0x295afe);})[_0x54d4('0x10')](function(_0x563713){if(_0x563713>=_0x6b920a){return _0x56df9c[_0x54d4('0x12')](0x193)[_0x54d4('0x13')]({'message':util[_0x54d4('0x8')](_0x54d4('0x14'),_0x3829dc)});}_0xc53795();})[_0x54d4('0x15')](function(_0x1db093){_0xc53795(_0x1db093);});});}function isUserLimit(){return isLimit(_0x54d4('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x54d4('0x17')},{'role':_0x54d4('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x529e=['catch','users','User','admin','crypto','util','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x529e,0x68));var _0xe529=function(_0x38df1b,_0x1a25e6){_0x38df1b=_0x38df1b-0x0;var _0xa7ab86=_0x529e[_0x38df1b];return _0xa7ab86;};'use strict';var crypto=require(_0xe529('0x0'));var util=require(_0xe529('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xe529('0x2'));function getValueFromLicense(_0x3b23ed,_0x470f62){if(_0x3b23ed&&_0x470f62){if(_0x470f62[_0xe529('0x3')]&&_0x470f62[_0xe529('0x4')]){var _0x15f0ae=_0x470f62[_0xe529('0x3')];var _0x59a556=_0x470f62[_0xe529('0x4')];var _0x5384eb=_0x15f0ae[_0xe529('0x5')]('-')[0x4];var _0x4000d2=_0x15f0ae[_0xe529('0x5')]('-')[0x0];var _0x32cac7=crypto[_0xe529('0x6')](_0xe529('0x7'),util['format'](_0xe529('0x8'),_0x5384eb,_0x15f0ae,_0x4000d2));var _0x53a3fb=_0x32cac7[_0xe529('0x9')](_0x59a556,_0xe529('0xa'),_0xe529('0xb'));_0x53a3fb+=_0x32cac7['final']('utf8');var _0x3775a0=JSON[_0xe529('0xc')](_0x53a3fb);return _0x3775a0[_0xe529('0xd')](_0x3b23ed)?_0x3775a0[_0x3b23ed]:null;}}return null;}function isLimit(_0x2febbf,_0x6c2b8,_0x57ad15,_0x35890f){var _0x55b9ed=_0x6c2b8;return compose()[_0xe529('0xe')](function(_0x3b40fa,_0x150e27,_0x12ccba){return db[_0xe529('0xf')][_0xe529('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xe529('0x11')](function(_0x2e9533){var _0x681863=getValueFromLicense(_0x2febbf,_0x2e9533);return _0x681863?_0x681863:_0x55b9ed;})[_0xe529('0x11')](function(_0x45734f){_0x55b9ed=_0x45734f;return _0x57ad15['count'](_0x35890f);})[_0xe529('0x11')](function(_0x2c0a3d){if(_0x2c0a3d>=_0x55b9ed){return _0x150e27[_0xe529('0x12')](0x193)[_0xe529('0x13')]({'message':util['format'](_0xe529('0x14'),_0x2febbf)});}_0x12ccba();})[_0xe529('0x15')](function(_0x4cdfea){_0x12ccba(_0x4cdfea);});});}function isUserLimit(){return isLimit(_0xe529('0x16'),0x1,db[_0xe529('0x17')],{'where':{'$or':[{'role':_0xe529('0x18')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 1520acb..aa87857 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 _0xba3c=['$eq','value','$gt','$lte','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','operator','text','includes','$ne','\x20OR\x20','IN\x20?','$notIn','=\x20?','<>\x20?','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$startsWith','$between','shift','pop','DATE','utcOffset','add','minutes','seconds','lodash','moment','[$or]','replace','split','length','slice','forEach','indexOf','map','conditions','push'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xba3c,0x1de));var _0xcba3=function(_0x40f170,_0x4e26c6){_0x40f170=_0x40f170-0x0;var _0x5ed0a4=_0xba3c[_0x40f170];return _0x5ed0a4;};'use strict';var _=require(_0xcba3('0x0'));var moment=require(_0xcba3('0x1'));exports['parseSearch']=function(_0x187c1e){var _0x2ce731={'conditions':[]};_0x2ce731['sqlOperator']=_['startsWith'](_0x187c1e,_0xcba3('0x2'))?'or':'and';var _0x242ec8=_0x187c1e[_0xcba3('0x3')]('[$and]','')['replace'](_0xcba3('0x2'),'')[_0xcba3('0x4')]('||');for(var _0x4cc330=0x0;_0x4cc330<_0x242ec8[_0xcba3('0x5')];_0x4cc330++){var _0x2a296a=_0x242ec8[_0x4cc330][_0xcba3('0x4')](':=');var _0x1b7e22=_0x2a296a[0x0];var _0x127ab2=_0x2a296a[_0xcba3('0x6')](0x1);_0x127ab2['forEach'](function(_0x16ed3a){var _0x5bc8d9=_0x16ed3a[_0xcba3('0x4')]('[')['shift']();var _0x17a7e8=_0x16ed3a['match'](/\[(.*?)\]/g);_0x17a7e8[_0xcba3('0x7')](function(_0x19b119){var _0x578661=_0x19b119[_0xcba3('0x4')]('[')['filter'](function(_0x2c4e43){return _0x2c4e43[_0xcba3('0x8')](']')>-0x1;})[_0xcba3('0x9')](function(_0x5523a2){return _0x5523a2[_0xcba3('0x4')](']')[0x0];})[0x0];_0x2ce731[_0xcba3('0xa')][_0xcba3('0xb')]({'field':_0x1b7e22,'operator':_0x5bc8d9,'value':_0x578661});});});}return _0x2ce731;};exports['buildExpression']=function(_0x56a24b,_0x57530a,_0x27c175){var _0x2c6e07={};if(_0x57530a==='DATE'){if(_0x27c175['operator']===_0xcba3('0xc')){_0x27c175['operator']='$between';_0x27c175[_0xcba3('0xd')]+=','+_0x27c175[_0xcba3('0xd')];}else if(_['includes']([_0xcba3('0xe'),_0xcba3('0xf')],_0x27c175['operator'])){_0x27c175[_0xcba3('0xd')]=moment(_0x27c175[_0xcba3('0xd')])['add'](0x1,'days')[_0xcba3('0x10')](_0xcba3('0x11'));}}if(_0x27c175[_0xcba3('0x12')]){_0x57530a=_0x27c175['castTo'];_0x2c6e07['text']=_0xcba3('0x13')+_0x56a24b+'.'+_0x27c175[_0xcba3('0x14')]+_0xcba3('0x15')+_0x27c175[_0xcba3('0x12')]+')\x20'+parseOperator(_0x27c175[_0xcba3('0x16')]);}else{_0x2c6e07[_0xcba3('0x17')]=_0x56a24b+'.'+_0x27c175['field']+'\x20'+parseOperator(_0x27c175[_0xcba3('0x16')]);}if(_[_0xcba3('0x18')]([_0xcba3('0x19'),'$notIn'],_0x27c175['operator']))_0x2c6e07[_0xcba3('0x17')]='('+_0x2c6e07[_0xcba3('0x17')]+_0xcba3('0x1a')+_0x56a24b+'.'+_0x27c175[_0xcba3('0x14')]+'\x20IS\x20NULL)';_0x2c6e07[_0xcba3('0xd')]=parseValue(_0x57530a,_0x27c175[_0xcba3('0x16')],_0x27c175[_0xcba3('0xd')]);return _0x2c6e07;};function parseOperator(_0xebae26){var _0x19c85a;switch(_0xebae26){case'$in':_0x19c85a=_0xcba3('0x1b');break;case _0xcba3('0x1c'):_0x19c85a='NOT\x20IN\x20?';break;case _0xcba3('0xc'):_0x19c85a=_0xcba3('0x1d');break;case _0xcba3('0x19'):_0x19c85a=_0xcba3('0x1e');break;case'$substring':case'$startsWith':case _0xcba3('0x1f'):_0x19c85a='LIKE\x20?';break;case'$lt':_0x19c85a=_0xcba3('0x20');break;case _0xcba3('0xe'):_0x19c85a=_0xcba3('0x21');break;case'$lte':_0x19c85a=_0xcba3('0x22');break;case _0xcba3('0x23'):_0x19c85a='>=\x20?';break;case'$between':_0x19c85a=_0xcba3('0x24');break;}return _0x19c85a;}function parseValue(_0x3a6e8a,_0x27e5e4,_0x1beee4){var _0xa622e2={'start':undefined,'end':undefined};switch(_0x27e5e4){case _0xcba3('0x25'):case _0xcba3('0x1c'):_0xa622e2[_0xcba3('0x26')]=_0x1beee4[_0xcba3('0x4')](',');break;case _0xcba3('0x27'):_0xa622e2[_0xcba3('0x26')]='%'+_0x1beee4+'%';break;case _0xcba3('0x28'):_0xa622e2['start']=_0x1beee4+'%';break;case'$endsWith':_0xa622e2[_0xcba3('0x26')]='%'+_0x1beee4;break;case _0xcba3('0x29'):var _0x4a9f54=_0x1beee4[_0xcba3('0x4')](',');var _0x1beee4=_0x4a9f54[_0xcba3('0x2a')]();var _0x5ff952=_0x4a9f54[_0xcba3('0x2b')]();if(_0x3a6e8a===_0xcba3('0x2c')){_0x1beee4=moment(_0x1beee4)['utcOffset'](0x0,!![])['format']();_0x5ff952=moment(_0x5ff952)[_0xcba3('0x2d')](0x0,!![])['add'](0x17,'hours')[_0xcba3('0x2e')](0x3b,_0xcba3('0x2f'))[_0xcba3('0x2e')](0x3b,_0xcba3('0x30'))['format']();}_0xa622e2={'start':_0x1beee4,'end':_0x5ff952};break;default:_0xa622e2[_0xcba3('0x26')]=_0x1beee4;break;}return _0xa622e2;} \ No newline at end of file +var _0xd38f=['$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','$in','start','pop','utcOffset','add','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x1588c0,_0x47e0bd){var _0x53f93d=function(_0x2de67c){while(--_0x2de67c){_0x1588c0['push'](_0x1588c0['shift']());}};_0x53f93d(++_0x47e0bd);}(_0xd38f,0x1c9));var _0xfd38=function(_0x447780,_0x82d1ff){_0x447780=_0x447780-0x0;var _0x12c3c2=_0xd38f[_0x447780];return _0x12c3c2;};'use strict';var _=require(_0xfd38('0x0'));var moment=require('moment');exports[_0xfd38('0x1')]=function(_0x42d580){var _0x3eebd5={'conditions':[]};_0x3eebd5[_0xfd38('0x2')]=_[_0xfd38('0x3')](_0x42d580,_0xfd38('0x4'))?'or':_0xfd38('0x5');var _0x5f55ea=_0x42d580[_0xfd38('0x6')]('[$and]','')[_0xfd38('0x6')](_0xfd38('0x4'),'')[_0xfd38('0x7')]('||');for(var _0x3bf464=0x0;_0x3bf464<_0x5f55ea['length'];_0x3bf464++){var _0x2e9c0d=_0x5f55ea[_0x3bf464][_0xfd38('0x7')](':=');var _0x54d139=_0x2e9c0d[0x0];var _0x2b402d=_0x2e9c0d[_0xfd38('0x8')](0x1);_0x2b402d[_0xfd38('0x9')](function(_0x61e63){var _0x4e1d0f=_0x61e63['split']('[')[_0xfd38('0xa')]();var _0x4c620c=_0x61e63[_0xfd38('0xb')](/\[(.*?)\]/g);_0x4c620c[_0xfd38('0x9')](function(_0x4e9700){var _0x2bfa5c=_0x4e9700[_0xfd38('0x7')]('[')[_0xfd38('0xc')](function(_0x5d3803){return _0x5d3803[_0xfd38('0xd')](']')>-0x1;})[_0xfd38('0xe')](function(_0x108612){return _0x108612[_0xfd38('0x7')](']')[0x0];})[0x0];_0x3eebd5[_0xfd38('0xf')][_0xfd38('0x10')]({'field':_0x54d139,'operator':_0x4e1d0f,'value':_0x2bfa5c});});});}return _0x3eebd5;};exports[_0xfd38('0x11')]=function(_0x47419f,_0x2d2c0a,_0x289721){var _0x26f32b={};if(_0x2d2c0a===_0xfd38('0x12')){if(_0x289721[_0xfd38('0x13')]===_0xfd38('0x14')){_0x289721[_0xfd38('0x13')]=_0xfd38('0x15');_0x289721[_0xfd38('0x16')]+=','+_0x289721[_0xfd38('0x16')];}else if(_[_0xfd38('0x17')](['$gt',_0xfd38('0x18')],_0x289721[_0xfd38('0x13')])){_0x289721[_0xfd38('0x16')]=moment(_0x289721[_0xfd38('0x16')])['add'](0x1,_0xfd38('0x19'))[_0xfd38('0x1a')](_0xfd38('0x1b'));}}if(_0x289721[_0xfd38('0x1c')]){_0x2d2c0a=_0x289721[_0xfd38('0x1c')];_0x26f32b['text']='CAST('+_0x47419f+'.'+_0x289721[_0xfd38('0x1d')]+_0xfd38('0x1e')+_0x289721[_0xfd38('0x1c')]+')\x20'+parseOperator(_0x289721[_0xfd38('0x13')]);}else{_0x26f32b[_0xfd38('0x1f')]=_0x47419f+'.'+_0x289721['field']+'\x20'+parseOperator(_0x289721[_0xfd38('0x13')]);}if(_[_0xfd38('0x17')]([_0xfd38('0x20'),_0xfd38('0x21')],_0x289721[_0xfd38('0x13')]))_0x26f32b[_0xfd38('0x1f')]='('+_0x26f32b[_0xfd38('0x1f')]+_0xfd38('0x22')+_0x47419f+'.'+_0x289721[_0xfd38('0x1d')]+'\x20IS\x20NULL)';_0x26f32b[_0xfd38('0x16')]=parseValue(_0x2d2c0a,_0x289721[_0xfd38('0x13')],_0x289721['value']);return _0x26f32b;};function parseOperator(_0x3802c0){var _0xa04237;switch(_0x3802c0){case'$in':_0xa04237=_0xfd38('0x23');break;case'$notIn':_0xa04237=_0xfd38('0x24');break;case _0xfd38('0x14'):_0xa04237=_0xfd38('0x25');break;case _0xfd38('0x20'):_0xa04237='<>\x20?';break;case _0xfd38('0x26'):case _0xfd38('0x27'):case _0xfd38('0x28'):_0xa04237=_0xfd38('0x29');break;case'$lt':_0xa04237=_0xfd38('0x2a');break;case _0xfd38('0x2b'):_0xa04237=_0xfd38('0x2c');break;case _0xfd38('0x18'):_0xa04237=_0xfd38('0x2d');break;case'$gte':_0xa04237=_0xfd38('0x2e');break;case _0xfd38('0x15'):_0xa04237='BETWEEN\x20?\x20AND\x20?';break;}return _0xa04237;}function parseValue(_0x459ac5,_0x52d086,_0x28d6b5){var _0x2e9e13={'start':undefined,'end':undefined};switch(_0x52d086){case _0xfd38('0x2f'):case'$notIn':_0x2e9e13[_0xfd38('0x30')]=_0x28d6b5['split'](',');break;case _0xfd38('0x26'):_0x2e9e13[_0xfd38('0x30')]='%'+_0x28d6b5+'%';break;case _0xfd38('0x27'):_0x2e9e13['start']=_0x28d6b5+'%';break;case _0xfd38('0x28'):_0x2e9e13[_0xfd38('0x30')]='%'+_0x28d6b5;break;case _0xfd38('0x15'):var _0xd1a36c=_0x28d6b5[_0xfd38('0x7')](',');var _0x28d6b5=_0xd1a36c[_0xfd38('0xa')]();var _0x424319=_0xd1a36c[_0xfd38('0x31')]();if(_0x459ac5===_0xfd38('0x12')){_0x28d6b5=moment(_0x28d6b5)['utcOffset'](0x0,!![])[_0xfd38('0x1a')]();_0x424319=moment(_0x424319)[_0xfd38('0x32')](0x0,!![])[_0xfd38('0x33')](0x17,_0xfd38('0x34'))[_0xfd38('0x33')](0x3b,_0xfd38('0x35'))[_0xfd38('0x33')](0x3b,_0xfd38('0x36'))[_0xfd38('0x1a')]();}_0x2e9e13={'start':_0x28d6b5,'end':_0x424319};break;default:_0x2e9e13[_0xfd38('0x30')]=_0x28d6b5;break;}return _0x2e9e13;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0a8f536..cdfa1e7 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 _0x70a1=['VIRTUAL','lower','options','includeAll','include','lodash','sequelize','moment','parse','includes','fields','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','join','getOptions','$id','query','model','keys','attributes','intersection','hasOwnProperty','where','pick','filter','object','value','merge'];(function(_0x3c5313,_0x256745){var _0x42a7ae=function(_0xc8b959){while(--_0xc8b959){_0x3c5313['push'](_0x3c5313['shift']());}};_0x42a7ae(++_0x256745);}(_0x70a1,0x154));var _0x170a=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x70a1[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0x170a('0x0'));var sequelize=require(_0x170a('0x1'));var moment=require(_0x170a('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4c0f14){var _0x496cee=['ne'];try{var _0x278333=JSON[_0x170a('0x3')](_0x4c0f14);var _0x1dcca8=Object['keys'](_0x278333)[0x0];return _0x496cee[_0x170a('0x4')](_0x1dcca8);}catch(_0x30977b){return![];}}function getOperatorValue(_0x21c8f2){var _0x1d6e4f=JSON[_0x170a('0x3')](_0x21c8f2);var _0x407d3f=Object['keys'](_0x1d6e4f)[0x0];var _0x53c135=_0x1d6e4f[_0x407d3f];return{['$'+_0x407d3f]:_0x53c135};}function parseIncludeModel(_0x460606){var _0x2db3f7=JSON[_0x170a('0x3')](_0x460606);return{'model':db[_0x2db3f7['model']],'as':_0x2db3f7['alias'],'attributes':_0x2db3f7[_0x170a('0x5')],'raw':_0x2db3f7[_0x170a('0x6')]};}exports[_0x170a('0x5')]=function(_0x45a0e5){var _0x7c9473=null;if(_0x45a0e5){_0x7c9473=_0x45a0e5['split'](',');}return _0x7c9473;};exports[_0x170a('0x7')]=function(_0x3201a6,_0x74e59){var _0x1d5d53={};if(!_[_0x170a('0x8')](_0x3201a6)){_[_0x170a('0x9')](_0x3201a6,function(_0x1c8480,_0x5c873e){try{if(_0x74e59){var _0x34c2b3=_[_0x170a('0xa')](_0x74e59,{'name':_0x5c873e})||{};if(hasSequelizeOperator(_0x1c8480)){_0x1d5d53[_0x5c873e]=getOperatorValue(_0x1c8480);}else if(_0x34c2b3[_0x170a('0xb')]===_0x170a('0xc')&&_[_0x170a('0xd')](_0x1c8480)){var _0x488137=JSON[_0x170a('0x3')](_0x1c8480);var _0x1b752e={'$gte':moment(moment(_0x488137[_0x170a('0xe')])[_0x170a('0xf')](_0x170a('0x10')))[_0x170a('0x11')]()[_0x170a('0xf')](),'$lte':moment(moment(_0x488137[_0x170a('0x12')])['format'](_0x170a('0x10')))[_0x170a('0x11')]()[_0x170a('0x13')](0x1,'s')[_0x170a('0xf')]()};_0x1d5d53[_0x5c873e]=_0x1b752e;}else if(_0x34c2b3[_0x170a('0x14')]==='uniqueid'){_0x1d5d53[_0x5c873e]=_0x1c8480;}else{_0x1d5d53[_0x5c873e]=_[_0x170a('0x15')](_0x1c8480)?_0x1c8480:JSON[_0x170a('0x3')](_0x1c8480);}}else{_0x1d5d53[_0x5c873e]=_['isArray'](_0x1c8480)?_0x1c8480:JSON[_0x170a('0x3')](_0x1c8480);}}catch(_0x153084){_0x1d5d53[_0x5c873e]=_0x1c8480[_0x170a('0x16')](',');}});}return _0x1d5d53;};exports[_0x170a('0x17')]=function(_0x3a86e5){_0x3a86e5=parseInt(_0x3a86e5,0xa);if(!_0x3a86e5||_0x3a86e5<0x0){_0x3a86e5=LIMIT_VALUE;}return _0x3a86e5;};exports[_0x170a('0x18')]=function(_0x2622b0){_0x2622b0=parseInt(_0x2622b0,0xa);if(!_0x2622b0||_0x2622b0<0x0){_0x2622b0=0x0;}return _0x2622b0;};exports[_0x170a('0x19')]=function(_0x444098){var _0x391775,_0x2fc3d1=null;if(_0x444098){_0x391775=_0x444098[_0x170a('0x16')](',');_0x2fc3d1=_[_0x170a('0x1a')](_0x391775,function(_0x1649eb){if(_0x1649eb[_0x170a('0x1b')]('-')===0x0){return[_0x1649eb===_0x170a('0x1c')?sequelize[_0x170a('0x1d')](sequelize[_0x170a('0x1e')](_0x170a('0x1c')),_0x170a('0x1f')):_0x1649eb[_0x170a('0x20')](0x1),'DESC'];}else{return[_0x1649eb===_0x170a('0x1c')?sequelize['cast'](sequelize[_0x170a('0x1e')](_0x170a('0x1c')),_0x170a('0x1f')):_0x1649eb,'ASC'];}});}return _0x2fc3d1;};exports[_0x170a('0x21')]=function(_0x3f540e,_0x14b0f8){if(_[_0x170a('0x8')](_0x3f540e)){return _0x3f540e;}if(_[_0x170a('0x15')](_0x3f540e)){for(var _0x1d5562=0x0;_0x1d5562<_0x3f540e[_0x170a('0x22')];_0x1d5562+=0x1){_0x3f540e[_0x1d5562]=this[_0x170a('0x21')](_0x3f540e[_0x1d5562],_0x14b0f8);}return _0x3f540e;}if(!_[_0x170a('0x23')](_0x3f540e)){return _0x3f540e;}if(_[_0x170a('0x24')](_0x14b0f8)){_0x14b0f8=[_0x14b0f8];}if(!_['isArray'](_0x14b0f8)){return _0x3f540e;}for(var _0x53aaea=0x0;_0x53aaea<_0x14b0f8[_0x170a('0x22')];_0x53aaea+=0x1){_[_0x170a('0x25')](_0x3f540e,_0x14b0f8[_0x53aaea]);}for(var _0x5a797f in _0x3f540e){if(_0x3f540e['hasOwnProperty'](_0x5a797f)){_0x3f540e[_0x5a797f]=this['omit'](_0x3f540e[_0x5a797f],_0x14b0f8);}}return _0x3f540e;};exports[_0x170a('0x26')]=function(_0x458cb7){return _0x458cb7[_0x170a('0x27')](RegExp(_0x170a('0x28')))?!![]:![];};exports[_0x170a('0x29')]=function(_0x4fde12){return _0x4fde12[_0x170a('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x170a('0x2a')]=function(_0x46c40a,_0x3b546e){var _0x29f81b=[];var _0xf2aa7b=/[ `!@#$%^&*()_\-?~]/;var _0x959b51=_0x3b546e?_0x170a('0x2b'):'{EXPR}';_0x46c40a[_0x170a('0x16')](/[ ,]+/)[_0x170a('0x2c')](function(_0x5d5b46){_0x5d5b46=_0x5d5b46[_0x170a('0x2d')](/([^:]")"+/g,'$1');_0x5d5b46='+'+_0x5d5b46+'*';var _0x10044e=_0x5d5b46[_0x170a('0x27')](_0xf2aa7b);if(_0x10044e){_0x5d5b46='\x22'+_0x5d5b46+'\x22';}_0x29f81b[_0x170a('0x2e')](_0x5d5b46);});_0x959b51=_0x959b51[_0x170a('0x2d')]('{EXPR}',_0x29f81b[_0x170a('0x2f')]('\x20'));return _0x959b51;};exports[_0x170a('0x30')]=function(_0x2f0dda,_0x1773e5,_0xcb33be){var _0x7c95c9={},_0xe302fb={};if(_0x1773e5['query'][_0x170a('0x31')]){_0x1773e5[_0x170a('0x32')]['id']=_0x1773e5[_0x170a('0x32')][_0x170a('0x31')];delete _0x1773e5['query']['$id'];}_0x7c95c9[_0x170a('0x33')]=_[_0x170a('0x1a')](_0x2f0dda,'name');_0x7c95c9[_0x170a('0x32')]=_[_0x170a('0x34')](_0x1773e5[_0x170a('0x32')]);_0x7c95c9[_0x170a('0x7')]=_['intersection'](_0x7c95c9[_0x170a('0x33')],_0x7c95c9[_0x170a('0x32')]);_0xe302fb[_0x170a('0x35')]=_[_0x170a('0x36')](_0x7c95c9[_0x170a('0x33')],this[_0x170a('0x5')](_0x1773e5[_0x170a('0x32')][_0x170a('0x5')]));_0xe302fb[_0x170a('0x35')]=_0xe302fb[_0x170a('0x35')][_0x170a('0x22')]?_0xe302fb['attributes']:_0x7c95c9['model'];if(!_0x1773e5[_0x170a('0x32')][_0x170a('0x37')]('nolimit')){_0xe302fb[_0x170a('0x17')]=this[_0x170a('0x17')](_0x1773e5['query'][_0x170a('0x17')]);_0xe302fb[_0x170a('0x18')]=this[_0x170a('0x18')](_0x1773e5[_0x170a('0x32')]['offset']);}_0xe302fb['order']=this['sort'](_0x1773e5[_0x170a('0x32')][_0x170a('0x19')]);_0xe302fb[_0x170a('0x38')]=this[_0x170a('0x7')](_[_0x170a('0x39')](_0x1773e5[_0x170a('0x32')],_0x7c95c9[_0x170a('0x7')]),_0x2f0dda);if(_0x1773e5[_0x170a('0x32')][_0x170a('0x3a')]){var _0x3ca395=_0x2f0dda;var _0x2aa6b5=_0x1773e5[_0x170a('0x32')]['filter'];if(typeof _0x2aa6b5===_0x170a('0x3b')){_0x3ca395=_['filter'](_0x2f0dda,function(_0x2e8375){return _[_0x170a('0x4')](_0x2aa6b5['columns'],_0x2e8375['name']);});_0x2aa6b5=_0x2aa6b5[_0x170a('0x3c')];}_0xe302fb[_0x170a('0x38')]=_[_0x170a('0x3d')](_0xe302fb[_0x170a('0x38')],{'$or':_[_0x170a('0x1a')](_0x3ca395,function(_0x15f2eb){if(_0x15f2eb[_0x170a('0xb')]!==_0x170a('0x3e')){if(_0xcb33be){return sequelize[_0x170a('0x38')](sequelize['fn'](_0x170a('0x3f'),sequelize[_0x170a('0x1e')](_0x15f2eb[_0x170a('0x14')])),{'$like':sequelize['fn'](_0x170a('0x3f'),'%'+_0x1773e5[_0x170a('0x32')]['filter']+'%')});}else{var _0x3e3630={};_0x3e3630[_0x15f2eb[_0x170a('0x14')]]={'$like':'%'+_0x1773e5['query'][_0x170a('0x3a')]+'%'};return _0x3e3630;}}})});}_0xe302fb=_[_0x170a('0x3d')]({},_0xe302fb,_0x1773e5[_0x170a('0x40')]);return _0xe302fb;};exports['include']=function(_0x225666){var _0x2ab535=[];if(_0x225666[_0x170a('0x41')]){_0x2ab535['push']({'all':!![]});}else if(_0x225666[_0x170a('0x42')]){if(Array[_0x170a('0x15')](_0x225666[_0x170a('0x42')])){_0x2ab535=Object['keys'](_0x225666[_0x170a('0x42')])['map'](function(_0x3ef1e5){return parseIncludeModel(_0x225666[_0x170a('0x42')][_0x3ef1e5]);});}else{var _0x4a27da=parseIncludeModel(_0x225666[_0x170a('0x42')]);_0x2ab535['push'](_0x4a27da);}}return _0x2ab535;}; \ No newline at end of file +var _0x9fdc=['replace','push','getOptions','query','$id','intersection','model','attributes','fields','offset','where','pick','filter','columns','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','../../mysqldb','parse','keys','includes','alias','raw','split','filters','isEmpty','forOwn','find','type','DATE','$gte','YYYY-MM-DD','utc','$lte','format','subtract','name','isArray','limit','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','getFullTextValue','{EXPR}','forEach'];(function(_0x5003d1,_0x3f852c){var _0x217cba=function(_0x18e6b5){while(--_0x18e6b5){_0x5003d1['push'](_0x5003d1['shift']());}};_0x217cba(++_0x3f852c);}(_0x9fdc,0x18e));var _0xc9fd=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x9fdc[_0x492535];return _0x256620;};'use strict';var _=require(_0xc9fd('0x0'));var sequelize=require(_0xc9fd('0x1'));var moment=require('moment');var db=require(_0xc9fd('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x409a){var _0x4b9989=['ne'];try{var _0x1cbf19=JSON[_0xc9fd('0x3')](_0x409a);var _0x1b1b64=Object[_0xc9fd('0x4')](_0x1cbf19)[0x0];return _0x4b9989[_0xc9fd('0x5')](_0x1b1b64);}catch(_0x1b6c64){return![];}}function getOperatorValue(_0x40cbaa){var _0x4697b7=JSON[_0xc9fd('0x3')](_0x40cbaa);var _0x3eca75=Object['keys'](_0x4697b7)[0x0];var _0x48d3cc=_0x4697b7[_0x3eca75];return{['$'+_0x3eca75]:_0x48d3cc};}function parseIncludeModel(_0x3edf60){var _0x3f1741=JSON[_0xc9fd('0x3')](_0x3edf60);return{'model':db[_0x3f1741['model']],'as':_0x3f1741[_0xc9fd('0x6')],'attributes':_0x3f1741['fields'],'raw':_0x3f1741[_0xc9fd('0x7')]};}exports['fields']=function(_0x20304f){var _0x3e7e25=null;if(_0x20304f){_0x3e7e25=_0x20304f[_0xc9fd('0x8')](',');}return _0x3e7e25;};exports[_0xc9fd('0x9')]=function(_0x272ced,_0x47be4f){var _0x5d28ec={};if(!_[_0xc9fd('0xa')](_0x272ced)){_[_0xc9fd('0xb')](_0x272ced,function(_0x55faf6,_0x43514a){try{if(_0x47be4f){var _0x572039=_[_0xc9fd('0xc')](_0x47be4f,{'name':_0x43514a})||{};if(hasSequelizeOperator(_0x55faf6)){_0x5d28ec[_0x43514a]=getOperatorValue(_0x55faf6);}else if(_0x572039[_0xc9fd('0xd')]===_0xc9fd('0xe')&&_['isPlainObject'](_0x55faf6)){var _0xc97cd4=JSON[_0xc9fd('0x3')](_0x55faf6);var _0xf7287e={'$gte':moment(moment(_0xc97cd4[_0xc9fd('0xf')])['format'](_0xc9fd('0x10')))[_0xc9fd('0x11')]()['format'](),'$lte':moment(moment(_0xc97cd4[_0xc9fd('0x12')])[_0xc9fd('0x13')](_0xc9fd('0x10')))[_0xc9fd('0x11')]()[_0xc9fd('0x14')](0x1,'s')[_0xc9fd('0x13')]()};_0x5d28ec[_0x43514a]=_0xf7287e;}else if(_0x572039[_0xc9fd('0x15')]==='uniqueid'){_0x5d28ec[_0x43514a]=_0x55faf6;}else{_0x5d28ec[_0x43514a]=_[_0xc9fd('0x16')](_0x55faf6)?_0x55faf6:JSON['parse'](_0x55faf6);}}else{_0x5d28ec[_0x43514a]=_[_0xc9fd('0x16')](_0x55faf6)?_0x55faf6:JSON[_0xc9fd('0x3')](_0x55faf6);}}catch(_0x116287){_0x5d28ec[_0x43514a]=_0x55faf6[_0xc9fd('0x8')](',');}});}return _0x5d28ec;};exports[_0xc9fd('0x17')]=function(_0x1208ed){_0x1208ed=parseInt(_0x1208ed,0xa);if(!_0x1208ed||_0x1208ed<0x0){_0x1208ed=LIMIT_VALUE;}return _0x1208ed;};exports['offset']=function(_0xb8c209){_0xb8c209=parseInt(_0xb8c209,0xa);if(!_0xb8c209||_0xb8c209<0x0){_0xb8c209=0x0;}return _0xb8c209;};exports[_0xc9fd('0x18')]=function(_0x413fca){var _0x1bfb68,_0x55d112=null;if(_0x413fca){_0x1bfb68=_0x413fca['split'](',');_0x55d112=_[_0xc9fd('0x19')](_0x1bfb68,function(_0x1e005a){if(_0x1e005a[_0xc9fd('0x1a')]('-')===0x0){return[_0x1e005a==='priority'?sequelize[_0xc9fd('0x1b')](sequelize[_0xc9fd('0x1c')](_0xc9fd('0x1d')),_0xc9fd('0x1e')):_0x1e005a['substr'](0x1),_0xc9fd('0x1f')];}else{return[_0x1e005a==='priority'?sequelize['cast'](sequelize['col']('priority'),_0xc9fd('0x1e')):_0x1e005a,_0xc9fd('0x20')];}});}return _0x55d112;};exports['omit']=function(_0x40ffa7,_0x1cbb44){if(_[_0xc9fd('0xa')](_0x40ffa7)){return _0x40ffa7;}if(_[_0xc9fd('0x16')](_0x40ffa7)){for(var _0x4e9ef5=0x0;_0x4e9ef5<_0x40ffa7[_0xc9fd('0x21')];_0x4e9ef5+=0x1){_0x40ffa7[_0x4e9ef5]=this[_0xc9fd('0x22')](_0x40ffa7[_0x4e9ef5],_0x1cbb44);}return _0x40ffa7;}if(!_[_0xc9fd('0x23')](_0x40ffa7)){return _0x40ffa7;}if(_[_0xc9fd('0x24')](_0x1cbb44)){_0x1cbb44=[_0x1cbb44];}if(!_[_0xc9fd('0x16')](_0x1cbb44)){return _0x40ffa7;}for(var _0x381d43=0x0;_0x381d43<_0x1cbb44[_0xc9fd('0x21')];_0x381d43+=0x1){_['unset'](_0x40ffa7,_0x1cbb44[_0x381d43]);}for(var _0x33aee8 in _0x40ffa7){if(_0x40ffa7[_0xc9fd('0x25')](_0x33aee8)){_0x40ffa7[_0x33aee8]=this['omit'](_0x40ffa7[_0x33aee8],_0x1cbb44);}}return _0x40ffa7;};exports[_0xc9fd('0x26')]=function(_0x22054d){return _0x22054d[_0xc9fd('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x74507b){return _0x74507b[_0xc9fd('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xc9fd('0x28')]=function(_0x195a6b,_0x59a402){var _0x37c5e7=[];var _0x19d1cb=/[ `!@#$%^&*()_\-?~]/;var _0x133954=_0x59a402?'\x22{EXPR}\x22':_0xc9fd('0x29');_0x195a6b[_0xc9fd('0x8')](/[ ,]+/)[_0xc9fd('0x2a')](function(_0x4ab16e){_0x4ab16e=_0x4ab16e[_0xc9fd('0x2b')](/([^:]")"+/g,'$1');_0x4ab16e='+'+_0x4ab16e+'*';var _0x45c282=_0x4ab16e['match'](_0x19d1cb);if(_0x45c282){_0x4ab16e='\x22'+_0x4ab16e+'\x22';}_0x37c5e7[_0xc9fd('0x2c')](_0x4ab16e);});_0x133954=_0x133954[_0xc9fd('0x2b')]('{EXPR}',_0x37c5e7['join']('\x20'));return _0x133954;};exports[_0xc9fd('0x2d')]=function(_0x3c3b54,_0x240947,_0x381452){var _0x3083af={},_0xc6fb10={};if(_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x2f')]){_0x240947[_0xc9fd('0x2e')]['id']=_0x240947['query'][_0xc9fd('0x2f')];delete _0x240947[_0xc9fd('0x2e')][_0xc9fd('0x2f')];}_0x3083af['model']=_[_0xc9fd('0x19')](_0x3c3b54,_0xc9fd('0x15'));_0x3083af[_0xc9fd('0x2e')]=_[_0xc9fd('0x4')](_0x240947[_0xc9fd('0x2e')]);_0x3083af['filters']=_[_0xc9fd('0x30')](_0x3083af[_0xc9fd('0x31')],_0x3083af['query']);_0xc6fb10[_0xc9fd('0x32')]=_[_0xc9fd('0x30')](_0x3083af[_0xc9fd('0x31')],this['fields'](_0x240947['query'][_0xc9fd('0x33')]));_0xc6fb10[_0xc9fd('0x32')]=_0xc6fb10[_0xc9fd('0x32')][_0xc9fd('0x21')]?_0xc6fb10[_0xc9fd('0x32')]:_0x3083af[_0xc9fd('0x31')];if(!_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x25')]('nolimit')){_0xc6fb10['limit']=this[_0xc9fd('0x17')](_0x240947[_0xc9fd('0x2e')]['limit']);_0xc6fb10['offset']=this['offset'](_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x34')]);}_0xc6fb10['order']=this[_0xc9fd('0x18')](_0x240947['query'][_0xc9fd('0x18')]);_0xc6fb10[_0xc9fd('0x35')]=this[_0xc9fd('0x9')](_[_0xc9fd('0x36')](_0x240947['query'],_0x3083af[_0xc9fd('0x9')]),_0x3c3b54);if(_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x37')]){var _0x34eed4=_0x3c3b54;var _0x1205b2=_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x37')];if(typeof _0x1205b2==='object'){_0x34eed4=_[_0xc9fd('0x37')](_0x3c3b54,function(_0x34c8a4){return _[_0xc9fd('0x5')](_0x1205b2[_0xc9fd('0x38')],_0x34c8a4[_0xc9fd('0x15')]);});_0x1205b2=_0x1205b2['value'];}_0xc6fb10['where']=_[_0xc9fd('0x39')](_0xc6fb10[_0xc9fd('0x35')],{'$or':_[_0xc9fd('0x19')](_0x34eed4,function(_0x11a125){if(_0x11a125[_0xc9fd('0xd')]!==_0xc9fd('0x3a')){if(_0x381452){return sequelize[_0xc9fd('0x35')](sequelize['fn'](_0xc9fd('0x3b'),sequelize[_0xc9fd('0x1c')](_0x11a125['name'])),{'$like':sequelize['fn'](_0xc9fd('0x3b'),'%'+_0x240947[_0xc9fd('0x2e')][_0xc9fd('0x37')]+'%')});}else{var _0x5632bc={};_0x5632bc[_0x11a125['name']]={'$like':'%'+_0x240947['query']['filter']+'%'};return _0x5632bc;}}})});}_0xc6fb10=_[_0xc9fd('0x39')]({},_0xc6fb10,_0x240947[_0xc9fd('0x3c')]);return _0xc6fb10;};exports[_0xc9fd('0x3d')]=function(_0x2b57a1){var _0x350c54=[];if(_0x2b57a1[_0xc9fd('0x3e')]){_0x350c54[_0xc9fd('0x2c')]({'all':!![]});}else if(_0x2b57a1[_0xc9fd('0x3d')]){if(Array[_0xc9fd('0x16')](_0x2b57a1[_0xc9fd('0x3d')])){_0x350c54=Object[_0xc9fd('0x4')](_0x2b57a1[_0xc9fd('0x3d')])[_0xc9fd('0x19')](function(_0x1f96fe){return parseIncludeModel(_0x2b57a1[_0xc9fd('0x3d')][_0x1f96fe]);});}else{var _0x42427e=parseIncludeModel(_0x2b57a1[_0xc9fd('0x3d')]);_0x350c54[_0xc9fd('0x2c')](_0x42427e);}}return _0x350c54;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 5636ead..1364123 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa49b=['phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','userpic','chatStatus','whatsappStatusTime','whatsappCurrentCapacity','onhold','queue','screenrecording','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','whatsappPause','every','length','unknown','unavailable','ringing','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','getRealtimeAgents','*pause','idle','busy','getAgentStatus','startCase','findOne','getAgents','all','map','uniq','value','filter','includes','findAll','name','fullname','openchannelPause','voicePause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','getUpdatedSortOptions','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent'];(function(_0x1276d5,_0x359954){var _0x3f52c9=function(_0x4a9c72){while(--_0x4a9c72){_0x1276d5['push'](_0x1276d5['shift']());}};_0x3f52c9(++_0x359954);}(_0xa49b,0x126));var _0xba49=function(_0x45fd0c,_0x258637){_0x45fd0c=_0x45fd0c-0x0;var _0x38227d=_0xa49b[_0x45fd0c];return _0x38227d;};'use strict';var _=require('lodash');var jayson=require(_0xba49('0x0'));var db=require(_0xba49('0x1'))['db'];var amiClient=jayson[_0xba49('0x2')][_0xba49('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xba49('0x3')]({'port':0x232c});function isAgentPaused(_0x1a1207,_0x26c4ef){var _0x5a2c15=[_0x1a1207[_0xba49('0x4')],_0x1a1207[_0xba49('0x5')],_0x1a1207[_0xba49('0x6')],_0x1a1207['openchannelPause'],_0x1a1207[_0xba49('0x7')],_0x1a1207['voicePause'],_0x1a1207[_0xba49('0x8')]];if(!_0x26c4ef)return _[_0xba49('0x9')](_0x5a2c15);var _0x2bfae5=_['filter'](_0x5a2c15);return _0x2bfae5[_0xba49('0xa')]>0x0&&_0x2bfae5[_0xba49('0xa')]<_0x5a2c15[_0xba49('0xa')]?!![]:![];}function isIdle(_0x5251e4){return _0x5251e4==='idle'||_0x5251e4===_0xba49('0xb')||_0x5251e4===_0xba49('0xc')||_0x5251e4===_0xba49('0xd')||_['isNil'](_0x5251e4);}function isAgentIdle(_0x5d0f30){if(_0x5d0f30[_0xba49('0xe')]!=='idle'&&_0x5d0f30['voicePause']){_0x5d0f30['voiceStatus']=_0xba49('0xf');return![];}return _['every']([_0x5d0f30['chatStatus'],_0x5d0f30[_0xba49('0x10')],_0x5d0f30[_0xba49('0x11')],_0x5d0f30[_0xba49('0x12')],_0x5d0f30[_0xba49('0x13')],_0x5d0f30['voiceStatus'],_0x5d0f30[_0xba49('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xba49('0x15')]('Agents',{})['then'](function(_0xc1053a){if(_0xc1053a[_0xba49('0x16')]){throw new Error(_0xba49('0x17'));}var _0x153b4c=_0xc1053a['result'];return routingClient[_0xba49('0x15')](_0xba49('0x18'),{})[_0xba49('0x19')](function(_0x5cc0fe){if(_0x5cc0fe[_0xba49('0x16')]){throw new Error(_0xba49('0x1a'));}var _0x2cb910=_0x5cc0fe[_0xba49('0x1b')];return _['merge']({},_0x153b4c,_0x2cb910);});})[_0xba49('0x1c')](function(_0x59af33){throw _0x59af33;});}exports[_0xba49('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x5cd475){var _0x2c6617=_0xba49('0xb');if(isAgentPaused(_0x5cd475))_0x2c6617=_0xba49('0xf');else if(isAgentPaused(_0x5cd475,!![]))_0x2c6617=_0xba49('0x1e');else if(isAgentIdle(_0x5cd475))_0x2c6617=_0xba49('0x1f');else _0x2c6617=_0xba49('0x20');return _0x2c6617;}exports[_0xba49('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x331ec2,_0x2abc3b){var _0x4f1f1d=_['isArray'](_0x331ec2)?_0x331ec2:[_0x331ec2];var _0x2a4d17=_[_0xba49('0x22')](_0x2abc3b)+'Queue';var _0x54c9cd=_['map'](_0x4f1f1d,function(_0x4e65c4){return db[_0x2a4d17][_0xba49('0x23')]({'where':{'id':_0x4e65c4}})[_0xba49('0x19')](function(_0x45ed70){if(!_0x45ed70)return[];return _0x45ed70[_0xba49('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xba49('0x25')](_0x54c9cd)[_0xba49('0x19')](function(_0x26e3d3){var _0x216e1e=_(_0x26e3d3)['flatten']()[_0xba49('0x26')]('id')[_0xba49('0x27')]()[_0xba49('0x28')]();return _0x216e1e;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x23d288,_0xf4d76c,_0x4b78fc){try{if(_0xf4d76c['length']>0x0){_0x23d288=_0x23d288[_0xba49('0x29')](function(_0x15f9ac){return _0xf4d76c['includes'](_0x15f9ac['id']);});}var _0x2c0854=_0x23d288[_0xba49('0x29')](function(_0x18e661){var _0x25b35d=_0xba49('0x20');if(isAgentIdle(_0x18e661)){_0x25b35d=_0xba49('0x1f');}return _0x25b35d===_0x4b78fc;});return _['map'](_0x2c0854,'id');}catch(_0x3a7708){throw _0x3a7708;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc64929,_0x3a1ef4,_0x321e59){return Promise['resolve']()[_0xba49('0x19')](function(){if(_0x3a1ef4[_0xba49('0xa')]>0x0){_0xc64929=_0xc64929[_0xba49('0x29')](function(_0x5281e2){return _0x3a1ef4[_0xba49('0x2a')](_0x5281e2['id']);});}return _0xc64929;})[_0xba49('0x19')](function(){return db['User'][_0xba49('0x2b')]({'attributes':['id',_0xba49('0x2c'),_0xba49('0x2d'),'chatPause','faxPause',_0xba49('0x6'),_0xba49('0x2e'),_0xba49('0x7'),_0xba49('0x2f'),_0xba49('0x8'),_0xba49('0x30')],'where':{'id':{'$in':_['map'](_0xc64929,'id')}},'raw':!![]});})[_0xba49('0x19')](function(_0x360cd6){return _0x360cd6['map'](function(_0x1636fd){var _0x5d103e=_['find'](_0xc64929,['id',_0x1636fd['id']]);var _0x34c3c4=filterAgentAttributes(_0x5d103e);_['merge'](_0x1636fd,_0x34c3c4);_0x1636fd[_0xba49('0x31')]=getAgentStatus(_0x1636fd);return _0x1636fd;});})[_0xba49('0x19')](function(_0x13bd5c){var _0x115aaf=sortAgentsByStatus(_0x13bd5c,_0x321e59);return _[_0xba49('0x26')](_0x115aaf,'id');})[_0xba49('0x1c')](function(_0x3b9cf4){throw _0x3b9cf4;});}exports[_0xba49('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3e7031){var _0x1e23b9={'fields':[],'order':null};var _0x49b294=_0x3e7031[_0xba49('0x33')](',');_0x1e23b9[_0xba49('0x34')]=_[_0xba49('0x29')](_0x49b294,function(_0x115168){if(!_0x115168[_0xba49('0x2a')](_0xba49('0x31'))){return!![];}_0x1e23b9[_0xba49('0x35')]=_['startsWith'](_0x115168,'-')?_0xba49('0x36'):'ASC';return![];});return _0x1e23b9;}exports[_0xba49('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x532c40){if(!_0x532c40){_0x532c40='fullname,internal';}if(_0x532c40[_0xba49('0x2a')](_0xba49('0x2d'))&&!_0x532c40[_0xba49('0x2a')]('internal')){var _0x5da01b=_0x532c40['substring'](0x0,_0x532c40[_0xba49('0x38')]('fullname'));_0x532c40+=','+_0x5da01b+_0xba49('0x39');}return _0x532c40;}exports[_0xba49('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x47ddfa,_0x1a9c77){var _0x402742=_0x47ddfa[_0xba49('0x3b')](function(_0x8ece29,_0x1911d1){if(_0x8ece29[_0xba49('0x31')]===_0x1911d1['globalStatus']){if(_0x8ece29['globalStatus']===_0xba49('0xf')){if(_0x1a9c77===_0xba49('0x36')){return(_0x8ece29[_0xba49('0x30')]||'')<(_0x1911d1[_0xba49('0x30')]||'')||_0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()>_0x1911d1[_0xba49('0x2d')][_0xba49('0x3c')]()?0x1:-0x1;}else{return(_0x8ece29[_0xba49('0x30')]||'')<(_0x1911d1[_0xba49('0x30')]||'')||_0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()>_0x1911d1[_0xba49('0x2d')][_0xba49('0x3c')]()?-0x1:0x1;}}else{if(_0x1a9c77==='DESC'){return _0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()<_0x1911d1[_0xba49('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()<_0x1911d1['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1a9c77===_0xba49('0x36')){return _0x8ece29['globalStatus']<_0x1911d1[_0xba49('0x31')]?0x1:-0x1;}else{return _0x8ece29[_0xba49('0x31')]<_0x1911d1[_0xba49('0x31')]?-0x1:0x1;}}});return _0x402742;}exports[_0xba49('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x10e0a8){var _0x759b1c=['userpic',_0xba49('0x3e'),_0xba49('0x3f'),_0xba49('0x40'),_0xba49('0x30'),'lastPauseAt',_0xba49('0x39'),_0xba49('0x41'),_0xba49('0x4'),'openchannelPause','mailPause',_0xba49('0x7'),_0xba49('0x8'),_0xba49('0x5'),'voicePause',_0xba49('0x42'),_0xba49('0x43'),_0xba49('0x44'),'smsCapacity',_0xba49('0x45'),_0xba49('0x46'),_0xba49('0x47'),_0xba49('0x48'),_0xba49('0x49'),_0xba49('0x4a'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0xba49('0x12'),_0xba49('0x11'),'smsStatus',_0xba49('0x14'),_0xba49('0x10'),_0xba49('0xe'),_0xba49('0x4b'),'openchannelStatusTime',_0xba49('0x4c'),_0xba49('0x4d'),'whatsappStatusTime',_0xba49('0x4e'),_0xba49('0x4f'),'queue',_0xba49('0x50'),'screenrecording',_0xba49('0x51'),_0xba49('0x52')];var _0xbd3bcb=[_0xba49('0x4'),_0xba49('0x2e'),_0xba49('0x6'),'smsPause',_0xba49('0x8'),_0xba49('0x5'),'voicePause','online'];var _0x122bd0=_(_0x10e0a8)[_0xba49('0x53')](_0xbd3bcb)[_0xba49('0x54')](_0x759b1c)[_0xba49('0x28')]();return _0x122bd0;}exports[_0xba49('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xba49('0x2c'),_0xba49('0x2d'),_0xba49('0x56'),_0xba49('0x39'),'online',_0xba49('0x31'),_0xba49('0x57'),_0xba49('0x3f'),_0xba49('0x30'),_0xba49('0x40'),_0xba49('0x5'),_0xba49('0x4'),_0xba49('0x6'),_0xba49('0x2e'),_0xba49('0x7'),_0xba49('0x2f'),'whatsappPause',_0xba49('0x58'),'faxStatus','mailStatus',_0xba49('0x12'),_0xba49('0x13'),'voiceStatus','whatsappStatus',_0xba49('0x4b'),_0xba49('0x4e'),'mailStatusTime','openchannelStatusTime',_0xba49('0x4d'),_0xba49('0x4f'),_0xba49('0x59'),_0xba49('0x42'),_0xba49('0x46'),'mailCapacity',_0xba49('0x43'),'smsCapacity',_0xba49('0x45'),'chatCurrentCapacity','faxCurrentCapacity',_0xba49('0x49'),_0xba49('0x48'),'smsCurrentCapacity',_0xba49('0x5a'),_0xba49('0x51'),_0xba49('0x52'),_0xba49('0x50'),_0xba49('0x5b'),_0xba49('0x5c'),_0xba49('0x5d')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x6ac2=['faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','mailStatusTime','faxCapacity','openchannelCapacity','lodash','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','sort','globalStatus','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','smsStatusTime','whatsappStatusTime'];(function(_0x73e4cf,_0x2a8375){var _0x1e1bf8=function(_0xca0967){while(--_0xca0967){_0x73e4cf['push'](_0x73e4cf['shift']());}};_0x1e1bf8(++_0x2a8375);}(_0x6ac2,0x184));var _0x26ac=function(_0x2868d0,_0xabe467){_0x2868d0=_0x2868d0-0x0;var _0xfc4e5b=_0x6ac2[_0x2868d0];return _0xfc4e5b;};'use strict';var _=require(_0x26ac('0x0'));var jayson=require('jayson/promise');var db=require(_0x26ac('0x1'))['db'];var amiClient=jayson[_0x26ac('0x2')][_0x26ac('0x3')]({'port':0x232a});var routingClient=jayson[_0x26ac('0x2')][_0x26ac('0x3')]({'port':0x232c});function isAgentPaused(_0x2a650c,_0x595aa9){var _0x40d8d0=[_0x2a650c['chatPause'],_0x2a650c[_0x26ac('0x4')],_0x2a650c[_0x26ac('0x5')],_0x2a650c[_0x26ac('0x6')],_0x2a650c[_0x26ac('0x7')],_0x2a650c[_0x26ac('0x8')],_0x2a650c[_0x26ac('0x9')]];if(!_0x595aa9)return _[_0x26ac('0xa')](_0x40d8d0);var _0xd8b1e5=_['filter'](_0x40d8d0);return _0xd8b1e5['length']>0x0&&_0xd8b1e5[_0x26ac('0xb')]<_0x40d8d0[_0x26ac('0xb')]?!![]:![];}function isIdle(_0x23b65b){return _0x23b65b===_0x26ac('0xc')||_0x23b65b==='unknown'||_0x23b65b===_0x26ac('0xd')||_0x23b65b===_0x26ac('0xe')||_[_0x26ac('0xf')](_0x23b65b);}function isAgentIdle(_0x11246b){if(_0x11246b['voiceStatus']!=='idle'&&_0x11246b[_0x26ac('0x8')]){_0x11246b[_0x26ac('0x10')]=_0x26ac('0x11');return![];}return _[_0x26ac('0xa')]([_0x11246b[_0x26ac('0x12')],_0x11246b[_0x26ac('0x13')],_0x11246b[_0x26ac('0x14')],_0x11246b['openchannelStatus'],_0x11246b[_0x26ac('0x15')],_0x11246b[_0x26ac('0x10')],_0x11246b[_0x26ac('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x26ac('0x17')]('Agents',{})[_0x26ac('0x18')](function(_0x1ae5aa){if(_0x1ae5aa['error']){throw new Error(_0x26ac('0x19'));}var _0x3b1300=_0x1ae5aa[_0x26ac('0x1a')];return routingClient[_0x26ac('0x17')]('Agents',{})[_0x26ac('0x18')](function(_0xb03bbc){if(_0xb03bbc['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x111613=_0xb03bbc[_0x26ac('0x1a')];return _['merge']({},_0x3b1300,_0x111613);});})[_0x26ac('0x1b')](function(_0x59788b){throw _0x59788b;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x55a4a6){var _0x21e456='unknown';if(isAgentPaused(_0x55a4a6))_0x21e456=_0x26ac('0x11');else if(isAgentPaused(_0x55a4a6,!![]))_0x21e456=_0x26ac('0x1c');else if(isAgentIdle(_0x55a4a6))_0x21e456=_0x26ac('0xc');else _0x21e456=_0x26ac('0x1d');return _0x21e456;}exports[_0x26ac('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x28b32a,_0x21b6ab){var _0x147721=_[_0x26ac('0x1f')](_0x28b32a)?_0x28b32a:[_0x28b32a];var _0x5da4eb=_[_0x26ac('0x20')](_0x21b6ab)+_0x26ac('0x21');var _0x2b8299=_[_0x26ac('0x22')](_0x147721,function(_0x346001){return db[_0x5da4eb][_0x26ac('0x23')]({'where':{'id':_0x346001}})[_0x26ac('0x18')](function(_0x414777){if(!_0x414777)return[];return _0x414777[_0x26ac('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x26ac('0x25')](_0x2b8299)['then'](function(_0x4cb76e){var _0x222e9d=_(_0x4cb76e)['flatten']()[_0x26ac('0x22')]('id')[_0x26ac('0x26')]()[_0x26ac('0x27')]();return _0x222e9d;});}exports[_0x26ac('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x31cb17,_0x162756,_0x53b73f){try{if(_0x162756['length']>0x0){_0x31cb17=_0x31cb17[_0x26ac('0x29')](function(_0x3e2c4d){return _0x162756[_0x26ac('0x2a')](_0x3e2c4d['id']);});}var _0x4d873e=_0x31cb17['filter'](function(_0x1812d5){var _0x3aaa16=_0x26ac('0x1d');if(isAgentIdle(_0x1812d5)){_0x3aaa16=_0x26ac('0xc');}return _0x3aaa16===_0x53b73f;});return _['map'](_0x4d873e,'id');}catch(_0x5e1cbc){throw _0x5e1cbc;}}exports[_0x26ac('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3e2148,_0x17691a,_0x1219fe){return Promise[_0x26ac('0x2c')]()[_0x26ac('0x18')](function(){if(_0x17691a[_0x26ac('0xb')]>0x0){_0x3e2148=_0x3e2148[_0x26ac('0x29')](function(_0x1c888a){return _0x17691a[_0x26ac('0x2a')](_0x1c888a['id']);});}return _0x3e2148;})['then'](function(){return db[_0x26ac('0x2d')][_0x26ac('0x2e')]({'attributes':['id','name',_0x26ac('0x2f'),_0x26ac('0x30'),_0x26ac('0x4'),_0x26ac('0x5'),_0x26ac('0x6'),_0x26ac('0x7'),_0x26ac('0x8'),_0x26ac('0x9'),_0x26ac('0x31')],'where':{'id':{'$in':_[_0x26ac('0x22')](_0x3e2148,'id')}},'raw':!![]});})[_0x26ac('0x18')](function(_0x2e4aaf){return _0x2e4aaf['map'](function(_0x3aa807){var _0x3f5533=_[_0x26ac('0x32')](_0x3e2148,['id',_0x3aa807['id']]);var _0x5d4375=filterAgentAttributes(_0x3f5533);_[_0x26ac('0x33')](_0x3aa807,_0x5d4375);_0x3aa807['globalStatus']=getAgentStatus(_0x3aa807);return _0x3aa807;});})[_0x26ac('0x18')](function(_0x38c20a){var _0x4b7499=sortAgentsByStatus(_0x38c20a,_0x1219fe);return _[_0x26ac('0x22')](_0x4b7499,'id');})[_0x26ac('0x1b')](function(_0x28850f){throw _0x28850f;});}exports[_0x26ac('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1784fb){var _0x31494c={'fields':[],'order':null};var _0x5a9793=_0x1784fb[_0x26ac('0x35')](',');_0x31494c['fields']=_[_0x26ac('0x29')](_0x5a9793,function(_0x4c277b){if(!_0x4c277b[_0x26ac('0x2a')]('globalStatus')){return!![];}_0x31494c['order']=_[_0x26ac('0x36')](_0x4c277b,'-')?_0x26ac('0x37'):_0x26ac('0x38');return![];});return _0x31494c;}exports[_0x26ac('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x14798d){if(!_0x14798d){_0x14798d=_0x26ac('0x3a');}if(_0x14798d['includes']('fullname')&&!_0x14798d[_0x26ac('0x2a')](_0x26ac('0x3b'))){var _0x2aafa5=_0x14798d['substring'](0x0,_0x14798d['indexOf'](_0x26ac('0x2f')));_0x14798d+=','+_0x2aafa5+_0x26ac('0x3b');}return _0x14798d;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x5ae9fe,_0x33361b){var _0x382de7=_0x5ae9fe[_0x26ac('0x3c')](function(_0x500ffa,_0x485258){if(_0x500ffa['globalStatus']===_0x485258['globalStatus']){if(_0x500ffa[_0x26ac('0x3d')]===_0x26ac('0x11')){if(_0x33361b===_0x26ac('0x37')){return(_0x500ffa[_0x26ac('0x31')]||'')<(_0x485258[_0x26ac('0x31')]||'')||_0x500ffa[_0x26ac('0x2f')][_0x26ac('0x3e')]()>_0x485258[_0x26ac('0x2f')][_0x26ac('0x3e')]()?0x1:-0x1;}else{return(_0x500ffa['pauseType']||'')<(_0x485258[_0x26ac('0x31')]||'')||_0x500ffa[_0x26ac('0x2f')][_0x26ac('0x3e')]()>_0x485258[_0x26ac('0x2f')][_0x26ac('0x3e')]()?-0x1:0x1;}}else{if(_0x33361b===_0x26ac('0x37')){return _0x500ffa[_0x26ac('0x2f')][_0x26ac('0x3e')]()<_0x485258[_0x26ac('0x2f')][_0x26ac('0x3e')]()?0x1:-0x1;}else{return _0x500ffa[_0x26ac('0x2f')][_0x26ac('0x3e')]()<_0x485258[_0x26ac('0x2f')][_0x26ac('0x3e')]()?-0x1:0x1;}}}else{if(_0x33361b==='DESC'){return _0x500ffa[_0x26ac('0x3d')]<_0x485258[_0x26ac('0x3d')]?0x1:-0x1;}else{return _0x500ffa[_0x26ac('0x3d')]<_0x485258['globalStatus']?-0x1:0x1;}}});return _0x382de7;}exports[_0x26ac('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x100c69){var _0x2aa0c0=[_0x26ac('0x40'),_0x26ac('0x41'),_0x26ac('0x42'),'lastPauseAt','pauseType',_0x26ac('0x43'),_0x26ac('0x3b'),_0x26ac('0x44'),_0x26ac('0x30'),_0x26ac('0x6'),_0x26ac('0x5'),_0x26ac('0x7'),_0x26ac('0x9'),_0x26ac('0x4'),_0x26ac('0x8'),'chatCapacity','openchannelCapacity',_0x26ac('0x45'),_0x26ac('0x46'),_0x26ac('0x47'),'faxCapacity',_0x26ac('0x48'),_0x26ac('0x49'),_0x26ac('0x4a'),_0x26ac('0x4b'),_0x26ac('0x4c'),_0x26ac('0x4d'),_0x26ac('0x12'),_0x26ac('0x4e'),_0x26ac('0x14'),_0x26ac('0x15'),_0x26ac('0x16'),_0x26ac('0x13'),_0x26ac('0x10'),_0x26ac('0x4f'),'openchannelStatusTime','mailStatusTime',_0x26ac('0x50'),_0x26ac('0x51'),_0x26ac('0x52'),'voiceStatusTime',_0x26ac('0x53'),_0x26ac('0x54'),_0x26ac('0x55'),_0x26ac('0x56'),_0x26ac('0x57')];var _0x1fc474=[_0x26ac('0x30'),_0x26ac('0x6'),_0x26ac('0x5'),_0x26ac('0x7'),_0x26ac('0x9'),_0x26ac('0x4'),_0x26ac('0x8'),_0x26ac('0x41')];var _0x128de2=_(_0x100c69)[_0x26ac('0x58')](_0x1fc474)[_0x26ac('0x59')](_0x2aa0c0)[_0x26ac('0x27')]();return _0x128de2;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x26ac('0x2f'),_0x26ac('0x5a'),_0x26ac('0x3b'),_0x26ac('0x41'),'globalStatus',_0x26ac('0x40'),'lastLoginAt',_0x26ac('0x31'),'lastPauseAt',_0x26ac('0x4'),_0x26ac('0x30'),'mailPause',_0x26ac('0x6'),'smsPause',_0x26ac('0x8'),_0x26ac('0x9'),_0x26ac('0x12'),'faxStatus',_0x26ac('0x14'),_0x26ac('0x4e'),_0x26ac('0x15'),'voiceStatus',_0x26ac('0x16'),_0x26ac('0x4f'),_0x26ac('0x52'),_0x26ac('0x5b'),'openchannelStatusTime',_0x26ac('0x50'),'voiceStatusTime',_0x26ac('0x51'),'chatCapacity',_0x26ac('0x5c'),'mailCapacity',_0x26ac('0x5d'),_0x26ac('0x46'),_0x26ac('0x47'),'chatCurrentCapacity',_0x26ac('0x4d'),'mailCurrentCapacity',_0x26ac('0x49'),'smsCurrentCapacity',_0x26ac('0x4c'),_0x26ac('0x56'),_0x26ac('0x57'),_0x26ac('0x54'),'onhold',_0x26ac('0x53'),_0x26ac('0x55')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 4b9b3bf..a65f750 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b35=['startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','result','catch','getRealtimeQueues','inbound','concat','map','busy','outbound','pTalking','find','pick','lodash','jayson/promise','http','client','available','loggedIn','paused','waiting','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b35,0xb8));var _0x57b3=function(_0x16badc,_0x1e1c50){_0x16badc=_0x16badc-0x0;var _0x27c4da=_0x7b35[_0x16badc];return _0x27c4da;};'use strict';var _=require(_0x57b3('0x0'));var jayson=require(_0x57b3('0x1'));var util=require('util');var amiClient=jayson['client'][_0x57b3('0x2')]({'port':0x232a});var routingClient=jayson[_0x57b3('0x3')][_0x57b3('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x57b3('0x4'),_0x57b3('0x5'),_0x57b3('0x6'),_0x57b3('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x57b3('0x8'),_0x57b3('0x9'),_0x57b3('0xa'),_0x57b3('0xb'),_0x57b3('0xc'),_0x57b3('0xd'),_0x57b3('0xe'),_0x57b3('0xf'),_0x57b3('0x10'),_0x57b3('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x57b3('0x12'),_0x57b3('0x13'),_0x57b3('0x14'),_0x57b3('0x15'),_0x57b3('0x16'),_0x57b3('0x17'),_0x57b3('0x18'),'startProgressive',_0x57b3('0x19'),_0x57b3('0x1a'),_0x57b3('0x1b'),'erlangBusyFactor',_0x57b3('0x1c'),_0x57b3('0x1d'),_0x57b3('0x1e'),'predictiveIntervalAvailable',_0x57b3('0x1f'),_0x57b3('0x20'),_0x57b3('0x21'),_0x57b3('0x22'),_0x57b3('0x23'),_0x57b3('0x24')];function getRealtimeQueues(_0x1e9607,_0x503c80){var _0x32dd3a=_0x503c80===_0x57b3('0x25')?amiClient:routingClient;return _0x32dd3a[_0x57b3('0x26')](_['startCase'](_0x503c80)+_0x57b3('0x27'),_0x1e9607)[_0x57b3('0x28')](function(_0x15d59a){if(_0x15d59a['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x503c80));return _0x15d59a[_0x57b3('0x29')];})[_0x57b3('0x2a')](function(_0x477480){throw _0x477480;});}exports[_0x57b3('0x2b')]=getRealtimeQueues;function initializeQueues(_0x53b512,_0x434f6a,_0x435263,_0x50bd78){var _0x231ebb=DEFAULT_QUEUE_ATTRIBUTES;if(_0x435263==='voice'){if(_0x50bd78===_0x57b3('0x2c')){_0x231ebb=_0x231ebb[_0x57b3('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50bd78==='outbound'){_0x231ebb=_0x231ebb[_0x57b3('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x53b512[_0x57b3('0x2e')](function(_0x1c00d3){var _0x2d10e9=_0x1c00d3['get']({'plain':!![]});_0x2d10e9[_0x57b3('0x6')]=0x0;_0x2d10e9[_0x57b3('0xa')]=0x0;_0x2d10e9[_0x57b3('0x5')]=0x0;_0x2d10e9[_0x57b3('0x4')]=0x0;_0x2d10e9[_0x57b3('0x7')]=0x0;if(_0x435263==='voice'){_0x2d10e9[_0x57b3('0xf')]=0x0;_0x2d10e9[_0x57b3('0x2f')]=0x0;if(_0x50bd78===_0x57b3('0x30')){_0x2d10e9[_0x57b3('0x31')]=0x0;_0x2d10e9[_0x57b3('0x12')]=0x0;}}var _0x31a648=_[_0x57b3('0x32')](_0x434f6a,['id',_0x2d10e9['id']]);if(_0x31a648){_['merge'](_0x2d10e9,_[_0x57b3('0x33')](_0x31a648,_0x231ebb));}return _0x2d10e9;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x301b=['loggedInDb','notInUse','onHold','ringing','talking','message','statusMessage','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','concat','outbound','map','busy','pTalking','find','merge','initializeQueues','jayson/promise','client','http','available','loggedIn','paused','waiting','inUse','invalid'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x301b,0x140));var _0xb301=function(_0x4d178f,_0x37c108){_0x4d178f=_0x4d178f-0x0;var _0x10cfe4=_0x301b[_0x4d178f];return _0x10cfe4;};'use strict';var _=require('lodash');var jayson=require(_0xb301('0x0'));var util=require('util');var amiClient=jayson[_0xb301('0x1')][_0xb301('0x2')]({'port':0x232a});var routingClient=jayson[_0xb301('0x1')][_0xb301('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xb301('0x3'),_0xb301('0x4'),_0xb301('0x5'),_0xb301('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xb301('0x7'),_0xb301('0x8'),_0xb301('0x9'),_0xb301('0xa'),_0xb301('0xb'),_0xb301('0xc'),'ringInUse',_0xb301('0xd'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0xb301('0xe'),_0xb301('0xf'),_0xb301('0x10'),'dialMethod',_0xb301('0x11'),_0xb301('0x12'),'startProgressive',_0xb301('0x13'),_0xb301('0x14'),_0xb301('0x15'),'erlangBusyFactor',_0xb301('0x16'),_0xb301('0x17'),_0xb301('0x18'),_0xb301('0x19'),_0xb301('0x1a'),_0xb301('0x1b'),_0xb301('0x1c'),'predictiveIntervalDroppedCallsCallersExit',_0xb301('0x1d'),_0xb301('0x1e')];function getRealtimeQueues(_0x9cee0b,_0x4bd602){var _0x2bb7a4=_0x4bd602===_0xb301('0x1f')?amiClient:routingClient;return _0x2bb7a4[_0xb301('0x20')](_[_0xb301('0x21')](_0x4bd602)+_0xb301('0x22'),_0x9cee0b)[_0xb301('0x23')](function(_0x1e196e){if(_0x1e196e[_0xb301('0x24')])throw new Error(util['format'](_0xb301('0x25'),_0x4bd602));return _0x1e196e['result'];})[_0xb301('0x26')](function(_0x4786de){throw _0x4786de;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x2f6ed1,_0x3cbe1c,_0x70e484,_0x9d4c10){var _0x52a042=DEFAULT_QUEUE_ATTRIBUTES;if(_0x70e484===_0xb301('0x1f')){if(_0x9d4c10==='inbound'){_0x52a042=_0x52a042[_0xb301('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x9d4c10===_0xb301('0x28')){_0x52a042=_0x52a042[_0xb301('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2f6ed1[_0xb301('0x29')](function(_0x4b7f97){var _0x599d49=_0x4b7f97['get']({'plain':!![]});_0x599d49['paused']=0x0;_0x599d49['loggedInDb']=0x0;_0x599d49[_0xb301('0x4')]=0x0;_0x599d49[_0xb301('0x3')]=0x0;_0x599d49[_0xb301('0x6')]=0x0;if(_0x70e484===_0xb301('0x1f')){_0x599d49[_0xb301('0xd')]=0x0;_0x599d49[_0xb301('0x2a')]=0x0;if(_0x9d4c10===_0xb301('0x28')){_0x599d49[_0xb301('0x2b')]=0x0;_0x599d49['originated']=0x0;}}var _0x5e11c2=_[_0xb301('0x2c')](_0x3cbe1c,['id',_0x599d49['id']]);if(_0x5e11c2){_[_0xb301('0x2d')](_0x599d49,_['pick'](_0x5e11c2,_0x52a042));}return _0x599d49;});}exports[_0xb301('0x2e')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 79b6822..5b8f7b7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _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(_0x784d87,_0x4f0284){var _0x22e453=function(_0x20eeea){while(--_0x20eeea){_0x784d87['push'](_0x784d87['shift']());}};_0x22e453(++_0x4f0284);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 21e5608..532c817 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 _0xf040=['createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf040,0x7a));var _0x0f04=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0xf040[_0x2fe689];return _0x35ea44;};'use strict';var _=require(_0x0f04('0x0'));var os=require('os');var crypto=require(_0x0f04('0x1'));var machine=require(_0x0f04('0x2'));var exec=require(_0x0f04('0x3'))['execSync'];var config=require(_0x0f04('0x4'));function getInterfaces(){var _0x2cf55d=[];var _0x3e9ab0=os[_0x0f04('0x5')]();var _0x452ae4=_[_0x0f04('0x6')](_[_0x0f04('0x7')](_0x3e9ab0));for(var _0x2cdb95=0x0;_0x2cdb95<_0x452ae4[_0x0f04('0x8')];_0x2cdb95++){var _0x10e380=_0x3e9ab0[_0x452ae4[_0x2cdb95]][_0x0f04('0x9')](function(_0x30aa28){return _0x30aa28[_0x0f04('0xa')]===_0x0f04('0xb')&&_0x30aa28[_0x0f04('0xc')]===![];});_0x2cf55d=_0x2cf55d[_0x0f04('0xd')](_0x10e380);}return _0x2cf55d;}function getFirstInterface(){var _0x1f48f7=_[_0x0f04('0xe')](getInterfaces());return{'macAddress':_0x1f48f7&&_0x1f48f7[_0x0f04('0xf')]?_0x1f48f7[_0x0f04('0xf')]:_0x0f04('0x10'),'ipAddress':_0x1f48f7&&_0x1f48f7['address']?_0x1f48f7[_0x0f04('0x11')]:'127.0.0.1'};}exports[_0x0f04('0x12')]=getFirstInterface;function getCPUhash(){var _0x32f7f9=_['orderBy'](os[_0x0f04('0x13')]()[_0x0f04('0x14')](function(_0xaf0718){return _0xaf0718[_0x0f04('0x15')];}))['join'](':');return crypto[_0x0f04('0x16')](_0x0f04('0x17'))[_0x0f04('0x18')](_0x32f7f9)[_0x0f04('0x19')](_0x0f04('0x1a'));}exports[_0x0f04('0x1b')]=function(){var _0x328f62=os[_0x0f04('0x1c')]();var _0x175701=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x175701[_0x0f04('0x1d')](config[_0x0f04('0x1e')])){return config[_0x0f04('0x1e')];}else if(_0x328f62===_0x0f04('0x1f')){return exec(_0x0f04('0x20'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x468490=getFirstInterface();var _0x43eb99=getCPUhash();var _0x5e361f=_0x43eb99+'|'+os[_0x0f04('0x21')]()+'|'+_0x468490['macAddress']+'|'+_0x468490[_0x0f04('0x22')];var _0x4623e5=crypto['createHash']('md5')[_0x0f04('0x18')](_0x5e361f)['digest'](_0x0f04('0x1a'));return _0x4623e5[_0x0f04('0x23')](0x0,0x8)+'-'+_0x4623e5[_0x0f04('0x23')](0x8,0xc)+'-'+_0x4623e5['substring'](0xc,0x10)+'-'+_0x4623e5[_0x0f04('0x23')](0x10,0x14)+'-'+_0x4623e5[_0x0f04('0x23')](0x14);}}; \ No newline at end of file +var _0x02d3=['mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head'];(function(_0x12fc88,_0x2e50f5){var _0xca1388=function(_0x2683df){while(--_0x2683df){_0x12fc88['push'](_0x12fc88['shift']());}};_0xca1388(++_0x2e50f5);}(_0x02d3,0x1ba));var _0x302d=function(_0xea3345,_0x3042ec){_0xea3345=_0xea3345-0x0;var _0x3f68b5=_0x02d3[_0xea3345];return _0x3f68b5;};'use strict';var _=require(_0x302d('0x0'));var os=require('os');var crypto=require(_0x302d('0x1'));var machine=require(_0x302d('0x2'));var exec=require(_0x302d('0x3'))[_0x302d('0x4')];var config=require('../environment');function getInterfaces(){var _0x23f16d=[];var _0x28b141=os[_0x302d('0x5')]();var _0xd558ae=_['orderBy'](_[_0x302d('0x6')](_0x28b141));for(var _0x866c68=0x0;_0x866c68<_0xd558ae[_0x302d('0x7')];_0x866c68++){var _0x59579e=_0x28b141[_0xd558ae[_0x866c68]][_0x302d('0x8')](function(_0x2b65d0){return _0x2b65d0[_0x302d('0x9')]===_0x302d('0xa')&&_0x2b65d0[_0x302d('0xb')]===![];});_0x23f16d=_0x23f16d[_0x302d('0xc')](_0x59579e);}return _0x23f16d;}function getFirstInterface(){var _0x20ae64=_[_0x302d('0xd')](getInterfaces());return{'macAddress':_0x20ae64&&_0x20ae64[_0x302d('0xe')]?_0x20ae64['mac']:'00:00:00:00:00:00','ipAddress':_0x20ae64&&_0x20ae64[_0x302d('0xf')]?_0x20ae64['address']:_0x302d('0x10')};}exports[_0x302d('0x11')]=getFirstInterface;function getCPUhash(){var _0x3781f4=_[_0x302d('0x12')](os[_0x302d('0x13')]()[_0x302d('0x14')](function(_0x529132){return _0x529132[_0x302d('0x15')];}))[_0x302d('0x16')](':');return crypto[_0x302d('0x17')](_0x302d('0x18'))[_0x302d('0x19')](_0x3781f4)[_0x302d('0x1a')](_0x302d('0x1b'));}exports['getUuid']=function(){var _0x22f2e9=os[_0x302d('0x1c')]();var _0x4bf41f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4bf41f[_0x302d('0x1d')](config['licenseToken'])){return config[_0x302d('0x1e')];}else if(_0x22f2e9===_0x302d('0x1f')){return exec(_0x302d('0x20'),{'encoding':_0x302d('0x21')})[_0x302d('0x22')]('\x0d\x0a','');}else{var _0x503f43=getFirstInterface();var _0x39eac7=getCPUhash();var _0x58b428=_0x39eac7+'|'+os['hostname']()+'|'+_0x503f43[_0x302d('0x23')]+'|'+_0x503f43[_0x302d('0x24')];var _0x15bf21=crypto[_0x302d('0x17')]('md5')[_0x302d('0x19')](_0x58b428)[_0x302d('0x1a')]('hex');return _0x15bf21[_0x302d('0x25')](0x0,0x8)+'-'+_0x15bf21['substring'](0x8,0xc)+'-'+_0x15bf21[_0x302d('0x25')](0xc,0x10)+'-'+_0x15bf21[_0x302d('0x25')](0x10,0x14)+'-'+_0x15bf21[_0x302d('0x25')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7aa4237..ea471b5 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 _0x0a04=['get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch'];(function(_0x4b3661,_0x1be781){var _0x582d0c=function(_0x1a1ee4){while(--_0x1a1ee4){_0x4b3661['push'](_0x4b3661['shift']());}};_0x582d0c(++_0x1be781);}(_0x0a04,0x194));var _0x40a0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0a04[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0x40a0('0x0'));var moment=require(_0x40a0('0x1'));var rp=require('request-promise');var BPromise=require(_0x40a0('0x2'));var pkginfo=require(_0x40a0('0x3'))(module,_0x40a0('0x4'));var db=require(_0x40a0('0x5'))['db'];var encryptor=require(_0x40a0('0x6'));var hardware=require(_0x40a0('0x7'));var logger=require(_0x40a0('0x8'))(_0x40a0('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x57aaa5){return new BPromise(function(_0x4cde13,_0x5a7099){var _0x5c97aa=util[_0x40a0('0xa')](_0x40a0('0xb'),HOST,_0x57aaa5,module['exports'][_0x40a0('0x4')]);if(oldToken){_0x5c97aa=util[_0x40a0('0xa')](_0x40a0('0xc'),HOST,_0x57aaa5,module[_0x40a0('0xd')][_0x40a0('0x4')],oldToken);}var _0x186975={'uri':_0x5c97aa,'method':_0x40a0('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x186975)['then'](function(_0x4d6fce){_0x4cde13(_0x4d6fce);})[_0x40a0('0xf')](function(_0x22f4eb){_0x5a7099(_0x22f4eb);});});}function manageLicense(_0x3d276e,_0x3c0c80){var _0x3ce571=_0x3c0c80[_0x40a0('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3ce571[_0x40a0('0x11')]!==_0x3d276e&&!_0x3ce571[_0x40a0('0x12')]){oldToken=_0x3ce571['data1'];}httpRequest(_0x3d276e)[_0x40a0('0x13')](function(_0x5d9a2f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5d9a2f[_0x40a0('0x14')]){isOldTokenSent=![];if(!_0x3ce571['license']&&_0x3ce571[_0x40a0('0x9')]!=_0x5d9a2f[_0x40a0('0x9')]||_0x3ce571[_0x40a0('0x9')]&&_0x3ce571['data2']){logger[_0x40a0('0x15')](_0x40a0('0x16'));}if(_0x3ce571[_0x40a0('0x9')]&&!_0x3ce571[_0x40a0('0x12')]&&_0x3ce571['license']!=_0x5d9a2f[_0x40a0('0x9')]){logger[_0x40a0('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3ce571[_0x40a0('0x9')]&&!_0x3ce571[_0x40a0('0x12')]&&_0x3ce571[_0x40a0('0x9')]==_0x5d9a2f[_0x40a0('0x9')]){return _0x3c0c80;}return _0x3c0c80['update']({'data1':_0x3d276e,'data2':null,'license':_0x5d9a2f['license']});}else{if(_0x5d9a2f['license']||_0x3ce571[_0x40a0('0x9')]){if(!_0x3ce571[_0x40a0('0x12')]){if(_0x3ce571[_0x40a0('0x11')]==_0x3d276e){GRAY_PERIOD_REASON=_0x40a0('0x17');logger[_0x40a0('0x15')](_0x40a0('0x18'));}else{GRAY_PERIOD_REASON=_0x40a0('0x19');logger[_0x40a0('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce571['data1'],_0x3d276e);}logger[_0x40a0('0x15')](_0x40a0('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x40a0('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x3c0c80[_0x40a0('0x1b')]({'data2':encryptor[_0x40a0('0x1c')](moment()[_0x40a0('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x40a0('0x1d')](encryptor[_0x40a0('0x1e')](_0x3ce571['data2']),_0x40a0('0x1f'))>DAYS){logger[_0x40a0('0x15')](_0x40a0('0x20'),moment()[_0x40a0('0xa')](_0x40a0('0x21')));isOldTokenSent=![];return _0x3c0c80['update']({'data1':_0x3d276e,'data2':null,'license':null});}}}else{if(_0x3ce571[_0x40a0('0x11')]!=_0x3d276e){logger[_0x40a0('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce571[_0x40a0('0x11')],_0x3d276e);return _0x3c0c80[_0x40a0('0x1b')]({'data1':_0x3d276e,'data2':null,'license':null});}}}return _0x3c0c80;})[_0x40a0('0x13')](function(_0x1749b0){_0x3c0c80=_0x1749b0;})[_0x40a0('0xf')](function(_0x388217){logger['error'](_0x388217['message']);})[_0x40a0('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x40a0('0x23')](),_0x3c0c80);},TIME);});}function defaultLicense(){var _0x37f778=hardware[_0x40a0('0x23')]();if(_0x37f778){return db[_0x40a0('0x24')][_0x40a0('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x37f778}})['spread'](function(_0x1bcb3e,_0x1e6464){logger[_0x40a0('0x15')](_0x40a0('0x26'),_0x37f778);manageLicense(_0x37f778,_0x1bcb3e);})[_0x40a0('0xf')](function(_0x2e417b){logger[_0x40a0('0x27')](_0x2e417b[_0x40a0('0x28')]);});}}exports[_0x40a0('0x29')]=defaultLicense; \ No newline at end of file +var _0xacbe=['License','spread','error','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','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','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','catch','message','finally','getUuid'];(function(_0x100813,_0x266b72){var _0x2fd39e=function(_0x1a1f70){while(--_0x1a1f70){_0x100813['push'](_0x100813['shift']());}};_0x2fd39e(++_0x266b72);}(_0xacbe,0x154));var _0xeacb=function(_0x76cef9,_0x5c81c7){_0x76cef9=_0x76cef9-0x0;var _0x5cba95=_0xacbe[_0x76cef9];return _0x5cba95;};'use strict';var util=require(_0xeacb('0x0'));var moment=require(_0xeacb('0x1'));var rp=require(_0xeacb('0x2'));var BPromise=require(_0xeacb('0x3'));var pkginfo=require(_0xeacb('0x4'))(module,'version');var db=require(_0xeacb('0x5'))['db'];var encryptor=require(_0xeacb('0x6'));var hardware=require(_0xeacb('0x7'));var logger=require(_0xeacb('0x8'))(_0xeacb('0x9'));var HOST=_0xeacb('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3b2bfc){return new BPromise(function(_0x59a653,_0x30b4d9){var _0x14315c=util[_0xeacb('0xb')](_0xeacb('0xc'),HOST,_0x3b2bfc,module[_0xeacb('0xd')][_0xeacb('0xe')]);if(oldToken){_0x14315c=util['format'](_0xeacb('0xf'),HOST,_0x3b2bfc,module[_0xeacb('0xd')][_0xeacb('0xe')],oldToken);}var _0x145306={'uri':_0x14315c,'method':_0xeacb('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x145306)[_0xeacb('0x11')](function(_0x264671){_0x59a653(_0x264671);})['catch'](function(_0xb8e6bc){_0x30b4d9(_0xb8e6bc);});});}function manageLicense(_0x226d83,_0xeb9ddc){var _0x47ccda=_0xeb9ddc[_0xeacb('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x47ccda[_0xeacb('0x13')]!==_0x226d83&&!_0x47ccda[_0xeacb('0x14')]){oldToken=_0x47ccda['data1'];}httpRequest(_0x226d83)['then'](function(_0x2a7b9f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2a7b9f[_0xeacb('0x15')]){isOldTokenSent=![];if(!_0x47ccda['license']&&_0x47ccda[_0xeacb('0x9')]!=_0x2a7b9f[_0xeacb('0x9')]||_0x47ccda[_0xeacb('0x9')]&&_0x47ccda[_0xeacb('0x14')]){logger[_0xeacb('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x47ccda[_0xeacb('0x9')]&&!_0x47ccda[_0xeacb('0x14')]&&_0x47ccda[_0xeacb('0x9')]!=_0x2a7b9f['license']){logger[_0xeacb('0x16')](_0xeacb('0x17'));}if(_0x47ccda[_0xeacb('0x9')]&&!_0x47ccda[_0xeacb('0x14')]&&_0x47ccda[_0xeacb('0x9')]==_0x2a7b9f[_0xeacb('0x9')]){return _0xeb9ddc;}return _0xeb9ddc[_0xeacb('0x18')]({'data1':_0x226d83,'data2':null,'license':_0x2a7b9f['license']});}else{if(_0x2a7b9f[_0xeacb('0x9')]||_0x47ccda[_0xeacb('0x9')]){if(!_0x47ccda[_0xeacb('0x14')]){if(_0x47ccda[_0xeacb('0x13')]==_0x226d83){GRAY_PERIOD_REASON=_0xeacb('0x19');logger[_0xeacb('0x16')](_0xeacb('0x1a'));}else{GRAY_PERIOD_REASON=_0xeacb('0x1b');logger[_0xeacb('0x16')](_0xeacb('0x1c'),_0x47ccda[_0xeacb('0x13')],_0x226d83);}logger[_0xeacb('0x16')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xeacb('0x1d')](),moment()['format'](_0xeacb('0x1e')));return _0xeb9ddc[_0xeacb('0x18')]({'data2':encryptor[_0xeacb('0x1f')](moment()[_0xeacb('0xb')](_0xeacb('0x1e')))});}else{if(moment()[_0xeacb('0x20')](encryptor['decryptString'](_0x47ccda['data2']),_0xeacb('0x21'))>DAYS){logger[_0xeacb('0x16')]('DEMO\x20START\x20AT\x20%s',moment()[_0xeacb('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xeb9ddc[_0xeacb('0x18')]({'data1':_0x226d83,'data2':null,'license':null});}}}else{if(_0x47ccda[_0xeacb('0x13')]!=_0x226d83){logger[_0xeacb('0x16')](_0xeacb('0x1c'),_0x47ccda[_0xeacb('0x13')],_0x226d83);return _0xeb9ddc[_0xeacb('0x18')]({'data1':_0x226d83,'data2':null,'license':null});}}}return _0xeb9ddc;})[_0xeacb('0x11')](function(_0x1fd322){_0xeb9ddc=_0x1fd322;})[_0xeacb('0x22')](function(_0x2cda4a){logger['error'](_0x2cda4a[_0xeacb('0x23')]);})[_0xeacb('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xeacb('0x25')](),_0xeb9ddc);},TIME);});}function defaultLicense(){var _0x54640f=hardware['getUuid']();if(_0x54640f){return db[_0xeacb('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x54640f}})[_0xeacb('0x27')](function(_0x3fe794,_0x4c86d1){logger[_0xeacb('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x54640f);manageLicense(_0x54640f,_0x3fe794);})[_0xeacb('0x22')](function(_0x19328a){logger[_0xeacb('0x28')](_0x19328a[_0xeacb('0x23')]);});}}exports[_0xeacb('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b088cf5..bff2f34 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 _0x180d=['demo','machineUuid','gray','add','days','disabled','message','User','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format'];(function(_0x5e56de,_0x189fa7){var _0x26c6ec=function(_0x2ed7cf){while(--_0x2ed7cf){_0x5e56de['push'](_0x5e56de['shift']());}};_0x26c6ec(++_0x189fa7);}(_0x180d,0x120));var _0xd180=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x180d[_0x1ccdf7];return _0x52a0ae;};'use strict';var util=require('util');var _=require(_0xd180('0x0'));var moment=require(_0xd180('0x1'));var BPromise=require(_0xd180('0x2'));var hardware=require(_0xd180('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xd180('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':_0xd180('0x5'),'machineUuid':hardware[_0xd180('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'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':![],'update':![],'description':_0xd180('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x350607){return new BPromise(function(_0x518e50,_0xa58fbf){return db['License'][_0xd180('0x8')](_[_0xd180('0x9')](_0x350607,{'raw':!![],'where':{'id':0x1}}))[_0xd180('0xa')](function(_0x2e82a5){return checkLicense(_0x2e82a5,null);})['then'](function(_0x468461){_0x518e50(_0x468461);return;})[_0xd180('0xb')](function(_0x14790f){_0xa58fbf(_0x14790f);});});}function checkLicense(_0x3e4f5a,_0x1884d7){if(!_0x3e4f5a){demoLicense[_0xd180('0xc')]=_0x3e4f5a[_0xd180('0xd')];return demoLicense;}try{var _0x12a8c8=_0x1884d7||_0x3e4f5a[_0xd180('0xe')];if(_[_0xd180('0xf')](_0x12a8c8)){throw new Error(_0xd180('0x10'));}var _0x1c0d34=_0x3e4f5a['data1'];var _0x20b0f2=_0x3e4f5a['data2'];var _0x375cfb=_0x1c0d34[_0xd180('0x11')]('-')[0x4];var _0x5ca9b5=_0x1c0d34[_0xd180('0x11')]('-')[0x0];var _0x257ffe=encryptor[_0xd180('0x12')](_0x12a8c8,util[_0xd180('0x13')]('%s:%s:%s',_0x375cfb,_0x1c0d34,_0x5ca9b5));var _0xf35175=JSON['parse'](_0x257ffe);_0xf35175[_0xd180('0x14')]=![];_0xf35175[_0xd180('0xc')]=_0x1c0d34;_0xf35175[_0xd180('0x15')]=hardware[_0xd180('0x6')]();if(_0x20b0f2){var _0x1f7dce=encryptor[_0xd180('0x12')](_0x20b0f2);_0xf35175[_0xd180('0x16')]=_0x1f7dce;_0xf35175['deadline']=moment(_0x1f7dce)[_0xd180('0x17')](0x7,_0xd180('0x18'))[_0xd180('0x13')]();_0xf35175['grayReason']=_0xf35175[_0xd180('0xc')]!=_0xf35175[_0xd180('0x15')]?'changed':_0xd180('0x19');}return _0xf35175;}catch(_0x140572){breakingLicense[_0xd180('0xc')]=_0x3e4f5a[_0xd180('0xd')];breakingLicense['message']=_0x140572[_0xd180('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe93030,_0x19a5fb){getLicense()['then'](function(_0xf7ef5e){return db[_0xd180('0x1b')]['findAll']({'attributes':[_0xd180('0x1c'),[db[_0xd180('0x1d')]['fn'](_0xd180('0x1e'),db[_0xd180('0x1d')][_0xd180('0x1f')](_0xd180('0x1c'))),_0xd180('0x20')]],'group':_0xd180('0x1c'),'where':{'role':{'$or':['admin',_0xd180('0x21'),_0xd180('0x22')]}},'raw':!![]})['then'](function(_0x19eb2d){var _0x2fc4f3={'user':_0xf7ef5e[_0xd180('0x23')]||0x0,'telephone':_0xf7ef5e[_0xd180('0x24')]||0x0};_0x19eb2d[_0xd180('0x25')](function(_0x1efe30){var _0xb3791d=_0x1efe30[_0xd180('0x1c')]===_0xd180('0x26')?_0xd180('0x21'):_0x1efe30['role'];_0x2fc4f3[_0xb3791d]-=_0x1efe30['count'];if(_0x2fc4f3[_0xb3791d]<0x0)_0x2fc4f3[_0xb3791d]=0x0;});_0xe93030(_0x2fc4f3);return;});})[_0xd180('0xb')](function(_0x2eca16){_0x19a5fb(_0x2eca16);});});}function checkUserLimits(_0x2270f7){return new BPromise(function(_0x20ab0d,_0x804205){getLimits()[_0xd180('0xa')](function(_0x29edc9){var _0x2075c=_[_0xd180('0x27')](_[_0xd180('0x28')](_0x2270f7,_0xd180('0x1c')),[_0xd180('0x26'),_0xd180('0x21'),'telephone']);var _0x2b32ce=(_0x2075c['admin']||0x0)+(_0x2075c[_0xd180('0x21')]||0x0);var _0x795aaa=_0x2075c['telephone']||0x0;if(_0x2b32ce>_0x29edc9[_0xd180('0x21')])return _0x804205(_0xd180('0x29'));if(_0x795aaa>_0x29edc9[_0xd180('0x22')])return _0x804205(_0xd180('0x2a'));return _0x20ab0d();})[_0xd180('0xb')](function(_0x459d56){_0x804205(_0x459d56);});});}module[_0xd180('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x46c3=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','decryptString','gray','add','grayReason','machineUuid','disabled','message','User','sequelize','COUNT','col','role','count','admin','user','telephone','users','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1'];(function(_0x4316a1,_0x434909){var _0x40138a=function(_0x162eb7){while(--_0x162eb7){_0x4316a1['push'](_0x4316a1['shift']());}};_0x40138a(++_0x434909);}(_0x46c3,0xd5));var _0x346c=function(_0x5715a9,_0x1d64bd){_0x5715a9=_0x5715a9-0x0;var _0x876a92=_0x46c3[_0x5715a9];return _0x876a92;};'use strict';var util=require(_0x346c('0x0'));var _=require(_0x346c('0x1'));var moment=require(_0x346c('0x2'));var BPromise=require(_0x346c('0x3'));var hardware=require(_0x346c('0x4'));var encryptor=require(_0x346c('0x5'));var db=require(_0x346c('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x346c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x346c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x346c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x346c('0x9'),'machineUuid':hardware[_0x346c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4e3f96){return new BPromise(function(_0x28ba8d,_0x536dea){return db[_0x346c('0xa')][_0x346c('0xb')](_[_0x346c('0xc')](_0x4e3f96,{'raw':!![],'where':{'id':0x1}}))[_0x346c('0xd')](function(_0x5ebc78){return checkLicense(_0x5ebc78,null);})[_0x346c('0xd')](function(_0x4a4ce3){_0x28ba8d(_0x4a4ce3);return;})[_0x346c('0xe')](function(_0xb577c4){_0x536dea(_0xb577c4);});});}function checkLicense(_0x263e25,_0xe2cfdb){if(!_0x263e25){demoLicense[_0x346c('0xf')]=_0x263e25[_0x346c('0x10')];return demoLicense;}try{var _0x5555b7=_0xe2cfdb||_0x263e25['license'];if(_[_0x346c('0x11')](_0x5555b7)){throw new Error(_0x346c('0x12'));}var _0x29f0c2=_0x263e25[_0x346c('0x10')];var _0x50f1fd=_0x263e25[_0x346c('0x13')];var _0x87a1e8=_0x29f0c2[_0x346c('0x14')]('-')[0x4];var _0x4fe928=_0x29f0c2['split']('-')[0x0];var _0x2c8420=encryptor['decryptString'](_0x5555b7,util[_0x346c('0x15')](_0x346c('0x16'),_0x87a1e8,_0x29f0c2,_0x4fe928));var _0x4cef87=JSON[_0x346c('0x17')](_0x2c8420);_0x4cef87[_0x346c('0x18')]=![];_0x4cef87['uuid']=_0x29f0c2;_0x4cef87['machineUuid']=hardware['getUuid']();if(_0x50f1fd){var _0x19f922=encryptor[_0x346c('0x19')](_0x50f1fd);_0x4cef87[_0x346c('0x1a')]=_0x19f922;_0x4cef87['deadline']=moment(_0x19f922)[_0x346c('0x1b')](0x7,'days')[_0x346c('0x15')]();_0x4cef87[_0x346c('0x1c')]=_0x4cef87[_0x346c('0xf')]!=_0x4cef87[_0x346c('0x1d')]?'changed':_0x346c('0x1e');}return _0x4cef87;}catch(_0x491983){breakingLicense['uuid']=_0x263e25[_0x346c('0x10')];breakingLicense['message']=_0x491983[_0x346c('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2d977e,_0x206cab){getLicense()['then'](function(_0x498eab){return db[_0x346c('0x20')]['findAll']({'attributes':['role',[db[_0x346c('0x21')]['fn'](_0x346c('0x22'),db[_0x346c('0x21')][_0x346c('0x23')](_0x346c('0x24'))),_0x346c('0x25')]],'group':_0x346c('0x24'),'where':{'role':{'$or':[_0x346c('0x26'),_0x346c('0x27'),_0x346c('0x28')]}},'raw':!![]})[_0x346c('0xd')](function(_0x30d163){var _0x2e5e0f={'user':_0x498eab[_0x346c('0x29')]||0x0,'telephone':_0x498eab['telephones']||0x0};_0x30d163[_0x346c('0x2a')](function(_0x398fc5){var _0x5273d6=_0x398fc5['role']===_0x346c('0x26')?_0x346c('0x27'):_0x398fc5['role'];_0x2e5e0f[_0x5273d6]-=_0x398fc5[_0x346c('0x25')];if(_0x2e5e0f[_0x5273d6]<0x0)_0x2e5e0f[_0x5273d6]=0x0;});_0x2d977e(_0x2e5e0f);return;});})[_0x346c('0xe')](function(_0x10c6a2){_0x206cab(_0x10c6a2);});});}function checkUserLimits(_0x1cdcb1){return new BPromise(function(_0x809daf,_0x3db07c){getLimits()['then'](function(_0x1df76b){var _0x346ba2=_[_0x346c('0x2b')](_['countBy'](_0x1cdcb1,_0x346c('0x24')),[_0x346c('0x26'),_0x346c('0x27'),_0x346c('0x28')]);var _0x100e8b=(_0x346ba2[_0x346c('0x26')]||0x0)+(_0x346ba2[_0x346c('0x27')]||0x0);var _0x3a5e03=_0x346ba2[_0x346c('0x28')]||0x0;if(_0x100e8b>_0x1df76b[_0x346c('0x27')])return _0x3db07c(_0x346c('0x2c'));if(_0x3a5e03>_0x1df76b[_0x346c('0x28')])return _0x3db07c(_0x346c('0x2d'));return _0x809daf();})['catch'](function(_0x237563){_0x3db07c(_0x237563);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 039e8f5..e71cd85 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 _0x7880=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4c9784,_0x299275){var _0x3db2bd=function(_0x5da8b3){while(--_0x5da8b3){_0x4c9784['push'](_0x4c9784['shift']());}};_0x3db2bd(++_0x299275);}(_0x7880,0x1f4));var _0x0788=function(_0x170d16,_0x443724){_0x170d16=_0x170d16-0x0;var _0x1bf864=_0x7880[_0x170d16];return _0x1bf864;};'use strict';module['exports']={'DOMAIN':_0x0788('0x0'),'SESSION_SECRET':_0x0788('0x1'),'GOOGLE_ID':_0x0788('0x2'),'GOOGLE_SECRET':_0x0788('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x8e3f=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x43dd25,_0x501bd6){var _0x21cf6d=function(_0x54cc0e){while(--_0x54cc0e){_0x43dd25['push'](_0x43dd25['shift']());}};_0x21cf6d(++_0x501bd6);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e3f[_0x2c91e9];return _0x13f0ff;};'use strict';module[_0xf8e3('0x0')]={'DOMAIN':_0xf8e3('0x1'),'SESSION_SECRET':_0xf8e3('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xf8e3('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0790547..1c5bfdd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x487b=['fileLogger','../utils/loggers'];(function(_0x4fef1b,_0x4fff32){var _0x2aa380=function(_0x458f91){while(--_0x458f91){_0x4fef1b['push'](_0x4fef1b['shift']());}};_0x2aa380(++_0x4fff32);}(_0x487b,0x1ed));var _0xb487=function(_0x204528,_0x35f523){_0x204528=_0x204528-0x0;var _0x4d853a=_0x487b[_0x204528];return _0x4d853a;};'use strict';var fileLogger=require(_0xb487('0x0'))[_0xb487('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x344a=['exports','../utils/loggers','fileLogger'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x344a,0x145));var _0xa344=function(_0x27dc3e,_0x1823a3){_0x27dc3e=_0x27dc3e-0x0;var _0x4f3b58=_0x344a[_0x27dc3e];return _0x4f3b58;};'use strict';var fileLogger=require(_0xa344('0x0'))[_0xa344('0x1')];module[_0xa344('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b6d0653..bfd6280 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 _0x39a8=['routing','../../services/routing/index.js','path','../../config/environment','resolve','root','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x14361d,_0x4aa821){var _0x518d84=function(_0x5a9e49){while(--_0x5a9e49){_0x14361d['push'](_0x14361d['shift']());}};_0x518d84(++_0x4aa821);}(_0x39a8,0x84));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x839a('0x0'));var cfg=require(_0x839a('0x1'));var env={'NODE_PATH':path[_0x839a('0x2')](path['join'](cfg[_0x839a('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x839a('0x4'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0x6')),'env':env},{'name':_0x839a('0x7'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x839a('0x8'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x839a('0x9'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0xa')),'env':env},{'name':_0x839a('0xb'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0xc')),'env':env},{'name':'xdr','script':path[_0x839a('0x5')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xe8a2=['../../services/routing/index.js','xdr','exports','path','resolve','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','email','routing'];(function(_0x4a2b82,_0x3887aa){var _0x5d7515=function(_0x263406){while(--_0x263406){_0x4a2b82['push'](_0x4a2b82['shift']());}};_0x5d7515(++_0x3887aa);}(_0xe8a2,0xb9));var _0x2e8a=function(_0x20a7aa,_0x159a66){_0x20a7aa=_0x20a7aa-0x0;var _0x25197d=_0xe8a2[_0x20a7aa];return _0x25197d;};'use strict';var path=require(_0x2e8a('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x2e8a('0x1')](path[_0x2e8a('0x2')](cfg[_0x2e8a('0x3')],_0x2e8a('0x4')))};var pm2config={'apps':[{'name':_0x2e8a('0x5'),'script':path[_0x2e8a('0x2')](__dirname,_0x2e8a('0x6')),'env':env},{'name':'ami','script':path[_0x2e8a('0x2')](__dirname,_0x2e8a('0x7')),'env':env},{'name':_0x2e8a('0x8'),'script':path[_0x2e8a('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2e8a('0x9'),'script':path[_0x2e8a('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x2e8a('0xa'),'script':path[_0x2e8a('0x2')](__dirname,_0x2e8a('0xb')),'env':env},{'name':_0x2e8a('0xc'),'script':path[_0x2e8a('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x2e8a('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7c116af..d0a82b4 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 _0xf967=['list','describe','delete','dump','pm2','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0xf967,0x1be));var _0x7f96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf967[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x7f96('0x0'));var BPromise=require('bluebird');var config=require(_0x7f96('0x1'));function connect(){return new BPromise(function(_0x632c8d,_0x2adc85){return pm2[_0x7f96('0x2')](function(_0x3a5c2a){if(_0x3a5c2a){return _0x2adc85(_0x3a5c2a);}return _0x632c8d(_0x7f96('0x3'));});});};exports[_0x7f96('0x4')]=function(_0xb97ca){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x3e0ece,_0x520a7d){return pm2[_0x7f96('0x4')](_0xb97ca,function(_0x56ec9e,_0x2157f6){if(_0x56ec9e){return _0x520a7d(_0x56ec9e);}pm2['disconnect']();return _0x3e0ece(_0x2157f6);});});});};exports[_0x7f96('0x6')]=function(_0x1aa398){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2dd8cd,_0x54031c){return pm2[_0x7f96('0x6')](_0x1aa398,function(_0x53abe0,_0x259860){if(_0x53abe0){return _0x54031c(_0x53abe0);}pm2[_0x7f96('0x7')]();return _0x2dd8cd(_0x259860);});});});};exports[_0x7f96('0x8')]=function(_0x4cd5c9){return connect()['then'](function(){return new BPromise(function(_0x2f062a,_0x35b82a){return pm2[_0x7f96('0x8')](_0x4cd5c9,function(_0x40ef85,_0x1cfb3d){if(_0x40ef85){return _0x35b82a(_0x40ef85);}pm2[_0x7f96('0x7')]();return _0x2f062a(_0x1cfb3d);});});});};exports[_0x7f96('0x9')]=function(){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2a5063,_0xc98756){return pm2[_0x7f96('0x9')](function(_0x3f50c0,_0x13bc71){if(_0x3f50c0){return _0xc98756(_0x3f50c0);}pm2['disconnect']();return _0x2a5063(_0x13bc71);});});});};exports[_0x7f96('0xa')]=function(_0x3603bb){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x34ce56,_0x4d7232){return pm2[_0x7f96('0xa')](_0x3603bb,function(_0x2a49e5,_0x26c135){if(_0x2a49e5){return _0x4d7232(_0x2a49e5);}pm2[_0x7f96('0x7')]();return _0x34ce56(_0x26c135);});});});};exports['delete']=function(_0x141131){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2adbae,_0x5c25f3){return pm2[_0x7f96('0xb')](_0x141131,function(_0xc63b16,_0x2cb9df){if(_0xc63b16){return _0x5c25f3(_0xc63b16);}pm2['disconnect']();return _0x2adbae(_0x2cb9df);});});});};exports[_0x7f96('0xc')]=function(){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0xe0fb6d,_0x7714fa){return pm2[_0x7f96('0xc')](function(_0x212ff9){if(_0x212ff9){return _0x7714fa(_0x212ff9);}return _0xe0fb6d('saved');});});});}; \ No newline at end of file +var _0xce06=['list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x3713db,_0x3d6359){var _0x39ed9e=function(_0x10e394){while(--_0x10e394){_0x3713db['push'](_0x3713db['shift']());}};_0x39ed9e(++_0x3d6359);}(_0xce06,0x6e));var _0x6ce0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce06[_0x321bb2];return _0x9c12ed;};'use strict';var pm2=require(_0x6ce0('0x0'));var BPromise=require(_0x6ce0('0x1'));var config=require(_0x6ce0('0x2'));function connect(){return new BPromise(function(_0x252b3d,_0x4e225b){return pm2[_0x6ce0('0x3')](function(_0x37acab){if(_0x37acab){return _0x4e225b(_0x37acab);}return _0x252b3d(_0x6ce0('0x4'));});});};exports[_0x6ce0('0x5')]=function(_0x3eb437){return connect()[_0x6ce0('0x6')](function(){return new BPromise(function(_0xef4201,_0x386b70){return pm2[_0x6ce0('0x5')](_0x3eb437,function(_0x1ac83c,_0x4c0b4d){if(_0x1ac83c){return _0x386b70(_0x1ac83c);}pm2['disconnect']();return _0xef4201(_0x4c0b4d);});});});};exports[_0x6ce0('0x7')]=function(_0x1d8834){return connect()[_0x6ce0('0x6')](function(){return new BPromise(function(_0x33e5e8,_0x3d722e){return pm2[_0x6ce0('0x7')](_0x1d8834,function(_0x14e29f,_0x3dcc9c){if(_0x14e29f){return _0x3d722e(_0x14e29f);}pm2[_0x6ce0('0x8')]();return _0x33e5e8(_0x3dcc9c);});});});};exports[_0x6ce0('0x9')]=function(_0x111008){return connect()['then'](function(){return new BPromise(function(_0x4df266,_0x45e53c){return pm2[_0x6ce0('0x9')](_0x111008,function(_0x5bc8bd,_0x3b0679){if(_0x5bc8bd){return _0x45e53c(_0x5bc8bd);}pm2['disconnect']();return _0x4df266(_0x3b0679);});});});};exports['list']=function(){return connect()[_0x6ce0('0x6')](function(){return new BPromise(function(_0x3ebec5,_0x4b7472){return pm2[_0x6ce0('0xa')](function(_0x165e6c,_0x49a3f1){if(_0x165e6c){return _0x4b7472(_0x165e6c);}pm2[_0x6ce0('0x8')]();return _0x3ebec5(_0x49a3f1);});});});};exports[_0x6ce0('0xb')]=function(_0x52ef80){return connect()[_0x6ce0('0x6')](function(){return new BPromise(function(_0x1d0fed,_0x4760f6){return pm2[_0x6ce0('0xb')](_0x52ef80,function(_0x1ce7f1,_0x326dbc){if(_0x1ce7f1){return _0x4760f6(_0x1ce7f1);}pm2[_0x6ce0('0x8')]();return _0x1d0fed(_0x326dbc);});});});};exports[_0x6ce0('0xc')]=function(_0x65b02c){return connect()[_0x6ce0('0x6')](function(){return new BPromise(function(_0x2ee35f,_0x1a6d56){return pm2[_0x6ce0('0xc')](_0x65b02c,function(_0x2ac98b,_0x2d8a75){if(_0x2ac98b){return _0x1a6d56(_0x2ac98b);}pm2[_0x6ce0('0x8')]();return _0x2ee35f(_0x2d8a75);});});});};exports[_0x6ce0('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4a2694,_0x4498ba){return pm2[_0x6ce0('0xd')](function(_0x4f348d){if(_0x4f348d){return _0x4498ba(_0x4f348d);}return _0x4a2694(_0x6ce0('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 174db53..dcac11d 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 _0xccec=['defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x3acdef,_0x2a7ae7){var _0x3a252a=function(_0x43b100){while(--_0x43b100){_0x3acdef['push'](_0x3acdef['shift']());}};_0x3a252a(++_0x2a7ae7);}(_0xccec,0x118));var _0xccce=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0xccec[_0x41010e];return _0x59e342;};'use strict';var _=require(_0xccce('0x0'));var moment=require(_0xccce('0x1'));var Redis=require(_0xccce('0x2'));var util=require(_0xccce('0x3'));var config=require(_0xccce('0x4'));var db=require(_0xccce('0x5'))['db'];var logger=require(_0xccce('0x6'))(_0xccce('0x7'));config['redis']=_[_0xccce('0x8')](config[_0xccce('0x9')],{'host':_0xccce('0xa'),'port':0x18eb});var io=require(_0xccce('0xb'))(new Redis(config[_0xccce('0x9')]));function closeInteractions(){var _0x24e1bd=0x0;var _0x95f579=[];return db[_0xccce('0xc')][_0xccce('0xd')]({'raw':!![],'attributes':['id',_0xccce('0xe')],'where':{'id':0x1}})[_0xccce('0xf')](function(_0x596cc4){_0x24e1bd=_0x596cc4[_0xccce('0xe')];if(_0x24e1bd){return db[_0xccce('0x10')][_0xccce('0x11')]({'raw':!![],'attributes':['id',_0xccce('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xccce('0x13')](_0x596cc4[_0xccce('0xe')],_0xccce('0x14'))}}});}else{return[];}})[_0xccce('0xf')](function(_0x26925a){if(_0x26925a&&_0x26925a[_0xccce('0x15')]){_0x95f579=_[_0xccce('0x16')](_0x26925a||[],'id');logger[_0xccce('0x17')](_0xccce('0x18'),_0x95f579[_0xccce('0x19')]());return db[_0xccce('0x10')]['update']({'closeReason':_0xccce('0x1a'),'disposition':_0xccce('0x1b'),'closed':!![],'closedAt':moment()[_0xccce('0x1c')](_0xccce('0x1d'))},{'where':{'id':_0x95f579}});}})[_0xccce('0xf')](function(){if(_0x95f579&&_0x95f579['length']){logger[_0xccce('0x17')](_0xccce('0x1e'),_0x95f579[_0xccce('0x19')]());for(var _0x5cb068=0x0;_0x5cb068<_0x95f579[_0xccce('0x15')];_0x5cb068++){io[_0xccce('0x1f')]('chatInteraction:update',{'id':_0x95f579[_0x5cb068],'closed':!![]});}}})[_0xccce('0x20')](function(_0x3c137c){logger['error'](_0xccce('0x21'),_0x3c137c?util[_0xccce('0x22')](_0x3c137c,{'showHidden':![],'depth':null}):'');});}exports[_0xccce('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0740=['../logger','schedule','defaults','redis','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb'];(function(_0x1eaa01,_0x1f3e68){var _0x585c17=function(_0x4773a9){while(--_0x4773a9){_0x1eaa01['push'](_0x1eaa01['shift']());}};_0x585c17(++_0x1f3e68);}(_0x0740,0x1ad));var _0x0074=function(_0x26b820,_0x4f66d0){_0x26b820=_0x26b820-0x0;var _0x39ff49=_0x0740[_0x26b820];return _0x39ff49;};'use strict';var _=require(_0x0074('0x0'));var moment=require(_0x0074('0x1'));var Redis=require(_0x0074('0x2'));var util=require(_0x0074('0x3'));var config=require('../../config/environment');var db=require(_0x0074('0x4'))['db'];var logger=require(_0x0074('0x5'))(_0x0074('0x6'));config['redis']=_[_0x0074('0x7')](config[_0x0074('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0074('0x8')]));function closeInteractions(){var _0x538051=0x0;var _0x20c79a=[];return db['Setting'][_0x0074('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x38c80a){_0x538051=_0x38c80a[_0x0074('0xa')];if(_0x538051){return db[_0x0074('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x0074('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0074('0xd')](_0x38c80a[_0x0074('0xa')],_0x0074('0xe'))}}});}else{return[];}})[_0x0074('0xf')](function(_0xf28baa){if(_0xf28baa&&_0xf28baa[_0x0074('0x10')]){_0x20c79a=_['map'](_0xf28baa||[],'id');logger['info'](_0x0074('0x11'),_0x20c79a[_0x0074('0x12')]());return db[_0x0074('0xb')]['update']({'closeReason':_0x0074('0x13'),'disposition':_0x0074('0x14'),'closed':!![],'closedAt':moment()['format'](_0x0074('0x15'))},{'where':{'id':_0x20c79a}});}})[_0x0074('0xf')](function(){if(_0x20c79a&&_0x20c79a[_0x0074('0x10')]){logger[_0x0074('0x16')](_0x0074('0x17'),_0x20c79a[_0x0074('0x12')]());for(var _0x599456=0x0;_0x599456<_0x20c79a['length'];_0x599456++){io[_0x0074('0x18')](_0x0074('0x19'),{'id':_0x20c79a[_0x599456],'closed':!![]});}}})[_0x0074('0x1a')](function(_0x564d6f){logger[_0x0074('0x1b')](_0x0074('0x1c'),_0x564d6f?util[_0x0074('0x1d')](_0x564d6f,{'showHidden':![],'depth':null}):'');});}exports[_0x0074('0x1e')]=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 39c6a03..5eab724 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 _0x4069=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x5a02c2,_0x27bda2){var _0xfd0566=function(_0x26980f){while(--_0x26980f){_0x5a02c2['push'](_0x5a02c2['shift']());}};_0xfd0566(++_0x27bda2);}(_0x4069,0x1f4));var _0x9406=function(_0x3694b2,_0x121f3a){_0x3694b2=_0x3694b2-0x0;var _0x4a18e0=_0x4069[_0x3694b2];return _0x4a18e0;};'use strict';function start(){var _0x551d1e=require(_0x9406('0x0'));return _0x551d1e[_0x9406('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x712a=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x5abb65,_0x19aef1){var _0x1cf9bc=function(_0x502bf5){while(--_0x502bf5){_0x5abb65['push'](_0x5abb65['shift']());}};_0x1cf9bc(++_0x19aef1);}(_0x712a,0xde));var _0xa712=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x712a[_0xcf5436];return _0xc4f5c8;};'use strict';function start(){var _0x13ab87=require(_0xa712('0x0'));return _0x13ab87[_0xa712('0x1')]();}module[_0xa712('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 e113185..e6cc817 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 _0x7a92=['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','attachments','Empty','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','job','operation','case\x20completed','data','case\x20empty','stop','case\x20failed','entity','dataValues','attempt','Job\x20ID\x20','report\x20status:','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','cron','active','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','existsSync','status','Sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a92,0xa8));var _0x27a9=function(_0x36d768,_0x4ac92e){_0x36d768=_0x36d768-0x0;var _0x255ea5=_0x7a92[_0x36d768];return _0x255ea5;};'use strict';var fs=require('fs');var util=require(_0x27a9('0x0'));var path=require(_0x27a9('0x1'));var _=require('lodash');var moment=require(_0x27a9('0x2'));var CronJobManager=require(_0x27a9('0x3'));var jayson=require(_0x27a9('0x4'));var BPromise=require(_0x27a9('0x5'));var logger=require(_0x27a9('0x6'))('schedule');var db=require(_0x27a9('0x7'))['db'];const retry=require(_0x27a9('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x27a9('0x9'));var client=jayson[_0x27a9('0xa')][_0x27a9('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x305339){const _0x38c122={};if(typeof _0x305339==='number'){_0x38c122['id']=_0x305339;}return db['AnalyticExtractedReport'][_0x27a9('0xc')]({'where':_0x38c122})[_0x27a9('0xd')](function(_0x2ba2f8){return _0x2ba2f8;})[_0x27a9('0xe')](function(_0x2f9bcd){logger[_0x27a9('0xf')](_0x2f9bcd);});}function handleSendEmail(_0x243138,_0x617061){logger[_0x27a9('0x10')](_0x27a9('0x11'),_0x243138[_0x27a9('0x12')]);var _0x87414b=!![];var _0x362089=_0x243138['MailAccount'][_0x27a9('0x13')]();var _0x2724a5={'account':_0x362089,'message':{'from':util[_0x27a9('0x14')](_0x27a9('0x15'),_0x243138[_0x27a9('0x16')]['name'],_0x243138[_0x27a9('0x16')][_0x27a9('0x12')]||_0x243138[_0x27a9('0x16')]['Smtp'][_0x27a9('0x17')]),'to':_0x243138[_0x27a9('0x12')],'cc':_0x243138['cc'],'bcc':_0x243138['bcc'],'subject':util['format'](_0x27a9('0x18'),_0x617061[_0x27a9('0x19')],_0x243138[_0x27a9('0x1a')],_0x243138[_0x27a9('0x1b')])}};var _0x193acf=path[_0x27a9('0x1c')](__dirname,_0x27a9('0x1d'));var _0x2e09c4=_0x617061[_0x27a9('0x1e')];var _0x98b3fa=util[_0x27a9('0x14')](_0x27a9('0x1f'),path[_0x27a9('0x20')](_0x617061[_0x27a9('0x1e')],path['extname'](_0x617061[_0x27a9('0x1e')])),'zip');var _0x5475d0=path[_0x27a9('0x1c')](_0x193acf,_0x2e09c4);var _0x1b82f3=path[_0x27a9('0x1c')](_0x193acf,_0x98b3fa);if(fs[_0x27a9('0x21')](_0x5475d0)){_0x617061[_0x27a9('0x22')]=_0x27a9('0x23');_0x2724a5[_0x27a9('0x24')]['attachments']=[{'filename':_0x2e09c4,'path':_0x5475d0}];_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]=util['format'](_0x27a9('0x26'),JSON[_0x27a9('0x27')](_0x617061,null,0x2));}else if(fs['existsSync'](_0x1b82f3)){_0x617061[_0x27a9('0x22')]='Sent';_0x2724a5[_0x27a9('0x24')][_0x27a9('0x28')]=[{'filename':_0x98b3fa,'path':_0x1b82f3}];}else{if(_0x617061[_0x27a9('0x22')]===_0x27a9('0x29')){_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x243138[_0x27a9('0x2a')]){_0x87414b=![];logger[_0x27a9('0x10')](_0x27a9('0x2b'));}}else if(_0x617061['status']===_0x27a9('0x2c')){_0x2724a5['message']['text']=_0x27a9('0x2d');}else if(_0x617061['status']===_0x27a9('0x2e')){_0x2724a5['message'][_0x27a9('0x25')]=_0x27a9('0x2f');}else if(_0x617061[_0x27a9('0x22')]==='Failed'){_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]=_0x27a9('0x30');}else{logger['error']('[handleSendEmail]\x20Unrecognized\x20status:',_0x617061[_0x27a9('0x22')]);}}if(_0x87414b){return client[_0x27a9('0x31')](_0x27a9('0x32'),_0x2724a5)['then'](function(_0x11451a){if(_0x11451a[_0x27a9('0xf')]){return logger[_0x27a9('0xf')](_0x27a9('0x33'),JSON['stringify'](_0x11451a));}return logger[_0x27a9('0x10')](_0x27a9('0x34'));})['catch'](function(_0x2b4217){return logger[_0x27a9('0xf')](_0x27a9('0x33'),JSON[_0x27a9('0x27')](_0x2b4217));});}}function handleError(){return function(_0x5113ed){return logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x5113ed));};}function loading(_0x48b6f8){logger[_0x27a9('0x10')](_0x27a9('0x35'));if(_0x48b6f8[_0x27a9('0x36')]===_0x48b6f8[_0x27a9('0x37')]['retries']){handleSendEmail(_0x48b6f8[_0x27a9('0x38')],_0x48b6f8['data']);_0x48b6f8[_0x27a9('0x39')]['stop']();}else{_0x48b6f8['operation'][_0x27a9('0x8')]('still\x20loading');}}function completed(_0x2893d5){logger[_0x27a9('0x10')](_0x27a9('0x3a'));handleSendEmail(_0x2893d5['job'],_0x2893d5[_0x27a9('0x3b')]);_0x2893d5[_0x27a9('0x39')]['stop']();}function empty(_0x2a1d60){logger[_0x27a9('0x10')](_0x27a9('0x3c'));handleSendEmail(_0x2a1d60[_0x27a9('0x38')],_0x2a1d60[_0x27a9('0x3b')]);_0x2a1d60['operation'][_0x27a9('0x3d')]();}function failed(_0x2d2d29){logger[_0x27a9('0x10')](_0x27a9('0x3e'));handleSendEmail(_0x2d2d29[_0x27a9('0x38')],_0x2d2d29[_0x27a9('0x3b')]);_0x2d2d29[_0x27a9('0x39')][_0x27a9('0x3d')]();}function urecognized(_0xe31df0){logger[_0x27a9('0xf')]('Unrecognized\x20status:',_0xe31df0[_0x27a9('0x3f')][_0x27a9('0x40')][_0x27a9('0x22')]);_0xe31df0[_0x27a9('0x39')][_0x27a9('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x27fd44,_0x29de9c){const _0x49ae0f={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x597d10=retry['operation'](_0x49ae0f);_0x597d10[_0x27a9('0x41')](_0x11744b=>{logger[_0x27a9('0x10')](_0x27a9('0x42')+_0x27fd44['id']+'\x20Attempt\x20#:'+_0x11744b);try{getReportData(_0x29de9c['id'])[_0x27a9('0xd')](function(_0x37e501){_0x29de9c=_0x37e501;logger[_0x27a9('0x10')](_0x27a9('0x43'),_0x37e501[_0x27a9('0x40')]['status']);if(!reportStatusStrategies[_0x37e501['dataValues']['status']]){logger[_0x27a9('0xf')](_0x27a9('0x43'),_0x37e501[_0x27a9('0x40')][_0x27a9('0x22')]);_0x597d10[_0x27a9('0x8')]();}reportStatusStrategies[_0x37e501['dataValues']['status']]({'operation':_0x597d10,'currentAttempt':_0x11744b,'retryOptions':_0x49ae0f,'job':_0x27fd44,'data':_0x29de9c,'entity':_0x37e501});});}catch(_0x5e0364){_0x597d10[_0x27a9('0x8')](_0x5e0364);}});}function handleResult(_0xc2460e){return function(_0x282da4){if(_0xc2460e[_0x27a9('0x44')]&&_0xc2460e[_0x27a9('0x16')]&&_0xc2460e[_0x27a9('0x16')][_0x27a9('0x45')]&&!_['isNil'](_0xc2460e[_0x27a9('0x12')])){retryer(_0xc2460e,_0x282da4);}};}function handleJob(_0x31d779){return function(){try{if(_[_0x27a9('0x46')](_0x31d779['subtractNumber'])){return logger[_0x27a9('0x10')](_0x27a9('0x47'));}if(_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x1b')])){return logger[_0x27a9('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x260d54={'startDate':moment()['subtract'](_0x31d779['subtractNumber'],_0x31d779[_0x27a9('0x1b')])[_0x27a9('0x14')](_0x27a9('0x48')),'endDate':moment()['format'](_0x27a9('0x48')),'type':_0x27a9('0x49'),'output':_0x31d779[_0x27a9('0x4a')],'name':_0x31d779[_0x27a9('0x19')]};if(!_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x4b')])){logger[_0x27a9('0x10')](_0x27a9('0x4c'),_0x31d779[_0x27a9('0x4b')]);return analyticDefaultReportController[_0x27a9('0x4d')]({'id':_0x31d779[_0x27a9('0x4b')]},_0x260d54)[_0x27a9('0xd')](handleResult(_0x31d779))[_0x27a9('0xe')](handleError());}if(!_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x4e')])){logger[_0x27a9('0x10')](_0x27a9('0x4f'),_0x31d779['CustomReportId']);return analyticCustomReportController[_0x27a9('0x4d')]({'id':_0x31d779[_0x27a9('0x4e')]},_0x260d54)['then'](handleResult(_0x31d779))[_0x27a9('0xe')](handleError());}}catch(_0x3c9ef9){logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x3c9ef9));}return logger[_0x27a9('0x10')]('no\x20report\x20id');};}function getJobs(_0x596a9d){var _0x5d92ed={};if(_0x596a9d){_0x5d92ed['id']=_0x596a9d;}return db['Schedule'][_0x27a9('0x50')]({'where':_0x5d92ed,'include':[{'model':db['MailAccount'],'attributes':['id',_0x27a9('0x19'),_0x27a9('0x12')],'include':[{'model':db[_0x27a9('0x51')],'as':_0x27a9('0x45'),'include':[{'model':db['CloudProvider'],'as':_0x27a9('0x52')}]}]}]})[_0x27a9('0xd')](function(_0x9a70b2){var _0x42719a=_['keys'](manager[_0x27a9('0x53')]);var _0xef71ca=_['map'](_0x9a70b2,function(_0x592f0f){return _0x592f0f['id']['toString']();});var _0x3000d=_[_0x27a9('0x54')](_0x9a70b2,function(_0x1504c2){return _0x1504c2['id'][_0x27a9('0x55')]();});var _0x39447f=_0x596a9d?_0xef71ca:_[_0x27a9('0x56')](_0xef71ca,_0x42719a);var _0x374cf9=_[_0x27a9('0x57')](_0xef71ca,_0x42719a);var _0x394ded=_['difference'](_0x42719a,_0xef71ca);var _0x481570;var _0x259b29;for(_0x481570=0x0;_0x481570<_0x394ded[_0x27a9('0x58')]&&!_0x596a9d;_0x481570+=0x1){_0x259b29=_0x394ded[_0x481570][_0x27a9('0x55')]();if(manager[_0x27a9('0x59')](_0x259b29)){manager[_0x27a9('0x3d')](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger['info'](_0x27a9('0x5b'),_0x259b29);}}logger[_0x27a9('0x10')](_0x27a9('0x5c'),JSON['stringify'](_0x39447f));for(_0x481570=0x0;_0x481570<_0x39447f['length'];_0x481570+=0x1){_0x259b29=_0x39447f[_0x481570][_0x27a9('0x55')]();if(_0x596a9d){logger[_0x27a9('0x10')](JSON[_0x27a9('0x27')](_0x3000d[_0x259b29]));BPromise['resolve']()['then'](handleJob(_0x3000d[_0x259b29]));logger[_0x27a9('0x10')]('run\x20job',_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else if(_0x3000d[_0x259b29][_0x27a9('0x5d')]&&_0x3000d[_0x259b29][_0x27a9('0x5e')]&&moment()['isBetween'](_0x3000d[_0x259b29][_0x27a9('0x5f')],_0x3000d[_0x259b29][_0x27a9('0x60')])){manager['add'](_0x259b29,_0x3000d[_0x259b29][_0x27a9('0x5d')],handleJob(_0x3000d[_0x259b29]));manager[_0x27a9('0x61')](_0x259b29);logger['info'](_0x27a9('0x62'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else if(manager[_0x27a9('0x59')](_0x259b29)){manager['stop'](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger[_0x27a9('0x10')](_0x27a9('0x63'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29]['cron']);}}for(_0x481570=0x0,_0x259b29;_0x481570<_0x374cf9[_0x27a9('0x58')]&&!_0x596a9d;_0x481570+=0x1){_0x259b29=_0x374cf9[_0x481570][_0x27a9('0x55')]();if(manager[_0x27a9('0x59')](_0x259b29)){if(_0x3000d[_0x259b29][_0x27a9('0x5d')]&&_0x3000d[_0x259b29][_0x27a9('0x5e')]&&moment()['isBetween'](_0x3000d[_0x259b29]['startAt'],_0x3000d[_0x259b29]['endAt'])){manager[_0x27a9('0x64')](_0x259b29,_0x3000d[_0x259b29][_0x27a9('0x5d')],handleJob(_0x3000d[_0x259b29]));logger[_0x27a9('0x10')](_0x27a9('0x65'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else{manager[_0x27a9('0x3d')](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger[_0x27a9('0x10')](_0x27a9('0x63'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}}}})['catch'](function(_0x1f73f3){logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x1f73f3));});}exports['run']=function(_0x43a1be){return getJobs(_0x43a1be);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2e24=['case\x20failed','dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','startAt','add','start','add\x20cron','endAt','update','update\x20cron','stop\x20cron','run','util','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','%s.%s','extname','savename','zip','join','existsSync','status','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retries','job','data','operation','stop'];(function(_0xbde3a5,_0xd28a33){var _0x304322=function(_0x515bb8){while(--_0x515bb8){_0xbde3a5['push'](_0xbde3a5['shift']());}};_0x304322(++_0xd28a33);}(_0x2e24,0xfe));var _0x42e2=function(_0x3519f2,_0x3304ac){_0x3519f2=_0x3519f2-0x0;var _0x4af7cd=_0x2e24[_0x3519f2];return _0x4af7cd;};'use strict';var fs=require('fs');var util=require(_0x42e2('0x0'));var path=require('path');var _=require(_0x42e2('0x1'));var moment=require('moment');var CronJobManager=require(_0x42e2('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x42e2('0x3'));var logger=require('../logger')(_0x42e2('0x4'));var db=require(_0x42e2('0x5'))['db'];const retry=require(_0x42e2('0x6'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x42e2('0x7'));var client=jayson[_0x42e2('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x395a0c){const _0x4627bf={};if(typeof _0x395a0c===_0x42e2('0x9')){_0x4627bf['id']=_0x395a0c;}return db[_0x42e2('0xa')][_0x42e2('0xb')]({'where':_0x4627bf})[_0x42e2('0xc')](function(_0x5317a2){return _0x5317a2;})[_0x42e2('0xd')](function(_0x325abb){logger[_0x42e2('0xe')](_0x325abb);});}function handleSendEmail(_0x30c033,_0x31a0c1){logger[_0x42e2('0xf')](_0x42e2('0x10'),_0x30c033[_0x42e2('0x11')]);var _0x16cb67=!![];var _0x407f8f=_0x30c033[_0x42e2('0x12')]['getSmtpOptions']();var _0x97b093={'account':_0x407f8f,'message':{'from':util[_0x42e2('0x13')]('\x22%s\x22\x20<%s>',_0x30c033[_0x42e2('0x12')]['name'],_0x30c033[_0x42e2('0x12')][_0x42e2('0x11')]||_0x30c033[_0x42e2('0x12')][_0x42e2('0x14')][_0x42e2('0x15')]),'to':_0x30c033[_0x42e2('0x11')],'cc':_0x30c033['cc'],'bcc':_0x30c033[_0x42e2('0x16')],'subject':util[_0x42e2('0x13')](_0x42e2('0x17'),_0x31a0c1[_0x42e2('0x18')],_0x30c033[_0x42e2('0x19')],_0x30c033[_0x42e2('0x1a')])}};var _0x2e74b2=path['join'](__dirname,_0x42e2('0x1b'));var _0x1ace10=_0x31a0c1['savename'];var _0x5a8252=util['format'](_0x42e2('0x1c'),path['basename'](_0x31a0c1['savename'],path[_0x42e2('0x1d')](_0x31a0c1[_0x42e2('0x1e')])),_0x42e2('0x1f'));var _0x4e0184=path[_0x42e2('0x20')](_0x2e74b2,_0x1ace10);var _0x389e7f=path[_0x42e2('0x20')](_0x2e74b2,_0x5a8252);if(fs[_0x42e2('0x21')](_0x4e0184)){_0x31a0c1[_0x42e2('0x22')]=_0x42e2('0x23');_0x97b093['message'][_0x42e2('0x24')]=[{'filename':_0x1ace10,'path':_0x4e0184}];_0x97b093[_0x42e2('0x25')]['text']=util['format'](_0x42e2('0x26'),JSON[_0x42e2('0x27')](_0x31a0c1,null,0x2));}else if(fs['existsSync'](_0x389e7f)){_0x31a0c1[_0x42e2('0x22')]=_0x42e2('0x23');_0x97b093[_0x42e2('0x25')]['attachments']=[{'filename':_0x5a8252,'path':_0x389e7f}];}else{if(_0x31a0c1['status']===_0x42e2('0x28')){_0x97b093['message'][_0x42e2('0x29')]=_0x42e2('0x2a');if(!_0x30c033['sendIfEmpty']){_0x16cb67=![];logger[_0x42e2('0xf')](_0x42e2('0x2b'));}}else if(_0x31a0c1[_0x42e2('0x22')]===_0x42e2('0x2c')){_0x97b093['message'][_0x42e2('0x29')]=_0x42e2('0x2d');}else if(_0x31a0c1['status']===_0x42e2('0x2e')){_0x97b093[_0x42e2('0x25')]['text']=_0x42e2('0x2f');}else if(_0x31a0c1[_0x42e2('0x22')]==='Failed'){_0x97b093[_0x42e2('0x25')][_0x42e2('0x29')]=_0x42e2('0x30');}else{logger[_0x42e2('0xe')](_0x42e2('0x31'),_0x31a0c1[_0x42e2('0x22')]);}}if(_0x16cb67){return client[_0x42e2('0x32')](_0x42e2('0x33'),_0x97b093)[_0x42e2('0xc')](function(_0x400b18){if(_0x400b18[_0x42e2('0xe')]){return logger['error'](_0x42e2('0x34'),JSON['stringify'](_0x400b18));}return logger[_0x42e2('0xf')](_0x42e2('0x35'));})['catch'](function(_0x4a40f7){return logger[_0x42e2('0xe')](_0x42e2('0x34'),JSON['stringify'](_0x4a40f7));});}}function handleError(){return function(_0x3fcac4){return logger['error'](JSON[_0x42e2('0x27')](_0x3fcac4));};}function loading(_0x49aa6c){logger['info'](_0x42e2('0x36'));if(_0x49aa6c[_0x42e2('0x37')]===_0x49aa6c['retryOptions'][_0x42e2('0x38')]){handleSendEmail(_0x49aa6c[_0x42e2('0x39')],_0x49aa6c[_0x42e2('0x3a')]);_0x49aa6c[_0x42e2('0x3b')][_0x42e2('0x3c')]();}else{_0x49aa6c[_0x42e2('0x3b')][_0x42e2('0x6')]('still\x20loading');}}function completed(_0x5ec3ae){logger[_0x42e2('0xf')]('case\x20completed');handleSendEmail(_0x5ec3ae[_0x42e2('0x39')],_0x5ec3ae[_0x42e2('0x3a')]);_0x5ec3ae[_0x42e2('0x3b')][_0x42e2('0x3c')]();}function empty(_0x462a06){logger[_0x42e2('0xf')]('case\x20empty');handleSendEmail(_0x462a06[_0x42e2('0x39')],_0x462a06[_0x42e2('0x3a')]);_0x462a06['operation'][_0x42e2('0x3c')]();}function failed(_0x44381d){logger[_0x42e2('0xf')](_0x42e2('0x3d'));handleSendEmail(_0x44381d[_0x42e2('0x39')],_0x44381d[_0x42e2('0x3a')]);_0x44381d['operation'][_0x42e2('0x3c')]();}function urecognized(_0x5e577d){logger[_0x42e2('0xe')]('Unrecognized\x20status:',_0x5e577d['entity'][_0x42e2('0x3e')][_0x42e2('0x22')]);_0x5e577d[_0x42e2('0x3b')][_0x42e2('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x857ec1,_0x2726ef){const _0x4c1030={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1d419a=retry[_0x42e2('0x3b')](_0x4c1030);_0x1d419a[_0x42e2('0x3f')](_0x43be7b=>{logger[_0x42e2('0xf')]('Job\x20ID\x20'+_0x857ec1['id']+_0x42e2('0x40')+_0x43be7b);try{getReportData(_0x2726ef['id'])[_0x42e2('0xc')](function(_0x51f17c){_0x2726ef=_0x51f17c;logger[_0x42e2('0xf')](_0x42e2('0x41'),_0x51f17c['dataValues']['status']);if(!reportStatusStrategies[_0x51f17c[_0x42e2('0x3e')][_0x42e2('0x22')]]){logger[_0x42e2('0xe')]('report\x20status:',_0x51f17c['dataValues'][_0x42e2('0x22')]);_0x1d419a['retry']();}reportStatusStrategies[_0x51f17c[_0x42e2('0x3e')][_0x42e2('0x22')]]({'operation':_0x1d419a,'currentAttempt':_0x43be7b,'retryOptions':_0x4c1030,'job':_0x857ec1,'data':_0x2726ef,'entity':_0x51f17c});});}catch(_0x2ef137){_0x1d419a[_0x42e2('0x6')](_0x2ef137);}});}function handleResult(_0x44d307){return function(_0x430641){if(_0x44d307[_0x42e2('0x42')]&&_0x44d307['MailAccount']&&_0x44d307['MailAccount'][_0x42e2('0x14')]&&!_['isNil'](_0x44d307[_0x42e2('0x11')])){retryer(_0x44d307,_0x430641);}};}function handleJob(_0x527075){return function(){try{if(_[_0x42e2('0x43')](_0x527075[_0x42e2('0x19')])){return logger['info'](_0x42e2('0x44'));}if(_[_0x42e2('0x43')](_0x527075['subtractUnit'])){return logger['info'](_0x42e2('0x45'));}var _0x5754ac={'startDate':moment()[_0x42e2('0x46')](_0x527075['subtractNumber'],_0x527075['subtractUnit'])[_0x42e2('0x13')](_0x42e2('0x47')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x42e2('0x48'),'output':_0x527075[_0x42e2('0x49')],'name':_0x527075['name']};if(!_[_0x42e2('0x43')](_0x527075[_0x42e2('0x4a')])){logger[_0x42e2('0xf')]('exec\x20defaul\x20report\x20id:%s',_0x527075[_0x42e2('0x4a')]);return analyticDefaultReportController[_0x42e2('0x4b')]({'id':_0x527075[_0x42e2('0x4a')]},_0x5754ac)[_0x42e2('0xc')](handleResult(_0x527075))[_0x42e2('0xd')](handleError());}if(!_[_0x42e2('0x43')](_0x527075['CustomReportId'])){logger[_0x42e2('0xf')](_0x42e2('0x4c'),_0x527075[_0x42e2('0x4d')]);return analyticCustomReportController['runReport']({'id':_0x527075[_0x42e2('0x4d')]},_0x5754ac)[_0x42e2('0xc')](handleResult(_0x527075))[_0x42e2('0xd')](handleError());}}catch(_0x1f3435){logger[_0x42e2('0xe')](JSON[_0x42e2('0x27')](_0x1f3435));}return logger['info'](_0x42e2('0x4e'));};}function getJobs(_0x56881f){var _0xf46fa1={};if(_0x56881f){_0xf46fa1['id']=_0x56881f;}return db['Schedule'][_0x42e2('0x4f')]({'where':_0xf46fa1,'include':[{'model':db[_0x42e2('0x12')],'attributes':['id','name','email'],'include':[{'model':db[_0x42e2('0x50')],'as':_0x42e2('0x14'),'include':[{'model':db[_0x42e2('0x51')],'as':'CloudProvider'}]}]}]})[_0x42e2('0xc')](function(_0x46f7dc){var _0x1fcadc=_[_0x42e2('0x52')](manager[_0x42e2('0x53')]);var _0x1d7ddc=_['map'](_0x46f7dc,function(_0x1d03df){return _0x1d03df['id']['toString']();});var _0x41662b=_['keyBy'](_0x46f7dc,function(_0x1f06df){return _0x1f06df['id'][_0x42e2('0x54')]();});var _0x3dfd79=_0x56881f?_0x1d7ddc:_[_0x42e2('0x55')](_0x1d7ddc,_0x1fcadc);var _0x33cf9b=_[_0x42e2('0x56')](_0x1d7ddc,_0x1fcadc);var _0x5084f0=_[_0x42e2('0x55')](_0x1fcadc,_0x1d7ddc);var _0x490ca8;var _0x58c9b2;for(_0x490ca8=0x0;_0x490ca8<_0x5084f0[_0x42e2('0x57')]&&!_0x56881f;_0x490ca8+=0x1){_0x58c9b2=_0x5084f0[_0x490ca8]['toString']();if(manager[_0x42e2('0x58')](_0x58c9b2)){manager['stop'](_0x58c9b2);manager[_0x42e2('0x59')](_0x58c9b2);logger[_0x42e2('0xf')](_0x42e2('0x5a'),_0x58c9b2);}}logger['info'](_0x42e2('0x5b'),JSON['stringify'](_0x3dfd79));for(_0x490ca8=0x0;_0x490ca8<_0x3dfd79[_0x42e2('0x57')];_0x490ca8+=0x1){_0x58c9b2=_0x3dfd79[_0x490ca8][_0x42e2('0x54')]();if(_0x56881f){logger[_0x42e2('0xf')](JSON[_0x42e2('0x27')](_0x41662b[_0x58c9b2]));BPromise[_0x42e2('0x5c')]()['then'](handleJob(_0x41662b[_0x58c9b2]));logger[_0x42e2('0xf')](_0x42e2('0x5d'),_0x41662b[_0x58c9b2]['name'],_0x41662b[_0x58c9b2][_0x42e2('0x5e')]);}else if(_0x41662b[_0x58c9b2]['cron']&&_0x41662b[_0x58c9b2][_0x42e2('0x5f')]&&moment()['isBetween'](_0x41662b[_0x58c9b2][_0x42e2('0x60')],_0x41662b[_0x58c9b2]['endAt'])){manager[_0x42e2('0x61')](_0x58c9b2,_0x41662b[_0x58c9b2]['cron'],handleJob(_0x41662b[_0x58c9b2]));manager[_0x42e2('0x62')](_0x58c9b2);logger[_0x42e2('0xf')](_0x42e2('0x63'),_0x41662b[_0x58c9b2]['name'],_0x41662b[_0x58c9b2][_0x42e2('0x5e')]);}else if(manager[_0x42e2('0x58')](_0x58c9b2)){manager[_0x42e2('0x3c')](_0x58c9b2);manager[_0x42e2('0x59')](_0x58c9b2);logger[_0x42e2('0xf')]('stop\x20cron',_0x41662b[_0x58c9b2][_0x42e2('0x18')],_0x41662b[_0x58c9b2]['cron']);}}for(_0x490ca8=0x0,_0x58c9b2;_0x490ca8<_0x33cf9b[_0x42e2('0x57')]&&!_0x56881f;_0x490ca8+=0x1){_0x58c9b2=_0x33cf9b[_0x490ca8][_0x42e2('0x54')]();if(manager[_0x42e2('0x58')](_0x58c9b2)){if(_0x41662b[_0x58c9b2][_0x42e2('0x5e')]&&_0x41662b[_0x58c9b2]['active']&&moment()['isBetween'](_0x41662b[_0x58c9b2][_0x42e2('0x60')],_0x41662b[_0x58c9b2][_0x42e2('0x64')])){manager[_0x42e2('0x65')](_0x58c9b2,_0x41662b[_0x58c9b2][_0x42e2('0x5e')],handleJob(_0x41662b[_0x58c9b2]));logger['info'](_0x42e2('0x66'),_0x41662b[_0x58c9b2]['name'],_0x41662b[_0x58c9b2][_0x42e2('0x5e')]);}else{manager[_0x42e2('0x3c')](_0x58c9b2);manager[_0x42e2('0x59')](_0x58c9b2);logger[_0x42e2('0xf')](_0x42e2('0x67'),_0x41662b[_0x58c9b2][_0x42e2('0x18')],_0x41662b[_0x58c9b2][_0x42e2('0x5e')]);}}}})['catch'](function(_0x118a4b){logger['error'](JSON[_0x42e2('0x27')](_0x118a4b));});}exports[_0x42e2('0x68')]=function(_0x21f749){return getJobs(_0x21f749);};exports[_0x42e2('0x62')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index f40443b..5033248 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 _0x8d08=['bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','transcribeName','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','start','lodash','aws-sdk','request-promise','util'];(function(_0x546678,_0x3d6285){var _0x108013=function(_0x3c845d){while(--_0x3c845d){_0x546678['push'](_0x546678['shift']());}};_0x108013(++_0x3d6285);}(_0x8d08,0x118));var _0x88d0=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0x8d08[_0x513f27];return _0xa316b7;};var _=require(_0x88d0('0x0'));var AWS=require(_0x88d0('0x1'));var rp=require(_0x88d0('0x2'));var util=require(_0x88d0('0x3'));var BPromise=require(_0x88d0('0x4'));var db=require(_0x88d0('0x5'))['db'];var logger=require(_0x88d0('0x6'))(_0x88d0('0x7'));function getTranscriptionJob(_0x3209a7,_0x7e0c16,_0x234e58,_0x47341c){return new Promise(function(_0x560c5b,_0x9897ca){var _0x14eafb=new AWS['TranscribeService']({'accessKeyId':_0x7e0c16,'secretAccessKey':_0x3209a7,'region':_0x234e58});_0x14eafb[_0x88d0('0x8')]({'TranscriptionJobName':_0x47341c},function(_0x511c4a,_0x473151){if(_0x511c4a){return _0x9897ca(_0x511c4a);}else{return _0x560c5b(_0x473151);}});});}function sentiment(_0x5c3aa7,_0x29f12e,_0x2fb116,_0x2c1e83,_0x48ad20){return new Promise(function(_0x36ec26,_0x35f14c){var _0x5307e8=new AWS[(_0x88d0('0x9'))]({'accessKeyId':_0x29f12e,'secretAccessKey':_0x5c3aa7,'region':_0x2fb116});_0x5307e8['detectSentiment']({'Text':_0x2c1e83,'LanguageCode':_0x48ad20[_0x88d0('0xa')](0x0,0x2)},function(_0x46b444,_0xfe67d8){if(_0x46b444){return _0x35f14c(_0x46b444);}else{return _0x36ec26(_0xfe67d8);}});});}function checkTranscribeJob(_0x592703,_0x5de471,_0x5da161){var _0x2854a5;return new BPromise(function(_0xacee29,_0x233d96){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x592703['id'],_0x592703[_0x88d0('0xb')]));return getTranscriptionJob(_0x5da161[_0x88d0('0xc')],_0x5da161['data2'],_0x5de471[_0x88d0('0xd')],_0x592703[_0x88d0('0xb')])[_0x88d0('0xe')](function(_0x37083a){logger['info'](util[_0x88d0('0xf')](_0x88d0('0x10'),_0x592703['id'],_0x592703[_0x88d0('0xb')],_0x37083a[_0x88d0('0x11')]['TranscriptionJobStatus']));if(!_0x592703[_0x88d0('0x12')]){switch(_0x37083a[_0x88d0('0x11')]['TranscriptionJobStatus']){case _0x88d0('0x13'):var _0x3cc775={'transcribeStatus':_0x37083a['TranscriptionJob'][_0x88d0('0x14')],'fileUri':_0x37083a['TranscriptionJob'][_0x88d0('0x15')][_0x88d0('0x16')]};logger['info'](util[_0x88d0('0xf')](_0x88d0('0x17'),_0x592703['id']));return rp({'uri':_0x37083a[_0x88d0('0x11')][_0x88d0('0x15')]['TranscriptFileUri'],'json':!![]})[_0x88d0('0xe')](function(_0xbeb2f9){logger[_0x88d0('0x18')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x592703['id']));if(_0xbeb2f9&&_0xbeb2f9[_0x88d0('0x19')]&&_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')]&&_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')][_0x88d0('0x1b')]){_0x3cc775[_0x88d0('0x12')]='';for(var _0x16cd98=0x0;_0x16cd98<_0xbeb2f9[_0x88d0('0x19')]['transcripts'][_0x88d0('0x1b')];_0x16cd98++){_0x3cc775[_0x88d0('0x12')]+=_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')][_0x16cd98][_0x88d0('0x1c')]+'';}}return _0x592703[_0x88d0('0x1d')](_0x3cc775);})['then'](function(){logger['info'](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));if(!_0x592703[_0x88d0('0x1f')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x22'));}if(!_0x5de471[_0x88d0('0x23')]||!_0x5de471['sentimentAccountId']||!_0x5de471[_0x88d0('0x24')]||!_0x5de471[_0x88d0('0x25')]||!_0x5de471[_0x88d0('0x26')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x27'));}if(!_0x3cc775[_0x88d0('0x12')]){throw new Error(_0x88d0('0x28'));}if(_0x5de471[_0x88d0('0x29')]===_0x5da161['id']){return _0x5da161;}else{return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_settings[_0x88d0('0x29')]}});}})[_0x88d0('0xe')](function(_0x133fce){if(!_0x133fce){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x2c'));}if(!_0x133fce[_0x88d0('0xc')]||!_0x133fce[_0x88d0('0x2d')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x2854a5=_0x133fce;logger[_0x88d0('0x18')](util[_0x88d0('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x592703['id']));return sentiment(_0x2854a5[_0x88d0('0xc')],_0x2854a5[_0x88d0('0x2d')],_0x5de471[_0x88d0('0x24')],_0x3cc775[_0x88d0('0x12')],_0x5de471[_0x88d0('0x25')]);})['then'](function(_0x429e30){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x2f'),_0x592703['id']));return _0x592703[_0x88d0('0x1d')]({'sentiment':_0x429e30[_0x88d0('0x30')],'sPositive':_0x429e30[_0x88d0('0x31')][_0x88d0('0x32')],'sNegative':_0x429e30[_0x88d0('0x31')][_0x88d0('0x33')],'sMixed':_0x429e30[_0x88d0('0x31')][_0x88d0('0x34')],'sNeutral':_0x429e30[_0x88d0('0x31')][_0x88d0('0x35')]});})['then'](function(){logger[_0x88d0('0x18')](util['format'](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});case'FAILED':return _0x592703[_0x88d0('0x1d')]({'transcribeStatus':_0x88d0('0x36'),'failureReason':_0x37083a[_0x88d0('0x11')]['FailureReason']})[_0x88d0('0xe')](function(){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});default:logger[_0x88d0('0x18')](util['format'](_0x88d0('0x37'),_0x592703['id']));break;}}else{return BPromise[_0x88d0('0x38')]()[_0x88d0('0xe')](function(){if(!_0x592703[_0x88d0('0x1f')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5de471[_0x88d0('0x23')]||!_0x5de471['sentimentAccountId']||!_0x5de471[_0x88d0('0x24')]||!_0x5de471['language']||!_0x5de471[_0x88d0('0x26')]){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x27'));}if(!_0x592703[_0x88d0('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x5de471[_0x88d0('0x29')]===_0x5da161['id']){return _0x5da161;}else{return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_settings[_0x88d0('0x29')]}});}})[_0x88d0('0xe')](function(_0x48e853){if(!_0x48e853){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2c'));}if(!_0x48e853[_0x88d0('0xc')]||!_0x48e853[_0x88d0('0x2d')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x2854a5=_0x48e853;logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x39'),_0x592703['id']));return sentiment(_0x2854a5['data1'],_0x2854a5[_0x88d0('0x2d')],_0x5de471['sentimentRegion'],_0x592703[_0x88d0('0x12')],_0x5de471['language']);})[_0x88d0('0xe')](function(_0x1543da){logger['info'](util[_0x88d0('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x592703['id']));return _0x592703[_0x88d0('0x1d')]({'sentiment':_0x1543da['Sentiment'],'sPositive':_0x1543da[_0x88d0('0x31')][_0x88d0('0x32')],'sNegative':_0x1543da['SentimentScore'][_0x88d0('0x33')],'sMixed':_0x1543da[_0x88d0('0x31')]['Mixed'],'sNeutral':_0x1543da[_0x88d0('0x31')]['Neutral'],'transcribeStatus':_0x88d0('0x13')});})['then'](function(){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});}})['catch'](function(_0x54e4f5){if(_0x54e4f5){if(!_0x54e4f5[_0x88d0('0x3a')]||_0x54e4f5[_0x88d0('0x3a')]!==_0x88d0('0x3b')){logger[_0x88d0('0x3c')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x592703['id']),util[_0x88d0('0x3d')](_0x54e4f5,{'showHidden':![],'depth':null}));}}_0xacee29();});});}function checkTranscribe(){var _0x1f043f;var _0x436100;var _0x353ecb;return db[_0x88d0('0x3e')][_0x88d0('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3ed26b){if(!_0x3ed26b||!_0x3ed26b['length']){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x40'));}_0x1f043f=_0x3ed26b;return db['Setting'][_0x88d0('0x2b')]({'where':{'id':0x1}});})[_0x88d0('0xe')](function(_0x3700b0){if(!_0x3700b0){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Settings\x20not\x20available');}_0x436100=_0x3700b0;if(!_0x436100[_0x88d0('0x7')]||!_0x436100[_0x88d0('0x41')]||!_0x436100[_0x88d0('0xd')]||!_0x436100[_0x88d0('0x25')]||!_0x436100[_0x88d0('0x26')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x42'));}return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_0x436100[_0x88d0('0x41')]}});})[_0x88d0('0xe')](function(_0x34abf7){if(!_0x34abf7){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x34abf7['data1']||!_0x34abf7[_0x88d0('0x2d')]){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x353ecb=_0x34abf7;var _0x33cc41=[];_0x1f043f['forEach'](function(_0x32ffc3){_0x33cc41[_0x88d0('0x43')](checkTranscribeJob(_0x32ffc3,_0x436100,_0x353ecb));});return BPromise[_0x88d0('0x44')](_0x33cc41);})[_0x88d0('0x45')](function(_0x206aad){if(_0x206aad){if(!_0x206aad['name']||_0x206aad[_0x88d0('0x3a')]!==_0x88d0('0x3b')){logger[_0x88d0('0x3c')](util['inspect'](_0x206aad,{'showHidden':![],'depth':null}));}}});}exports[_0x88d0('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x180d=['Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','FAILED','FailureReason','resolve','Transcript\x20not\x20available','Mixed','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Setting','transcribeAccountId','Transcribe\x20not\x20configured','findOne','forEach','SequelizeValidationError','error','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED'];(function(_0x37d888,_0x3c2718){var _0x3a003c=function(_0x2abab1){while(--_0x2abab1){_0x37d888['push'](_0x37d888['shift']());}};_0x3a003c(++_0x3c2718);}(_0x180d,0xf9));var _0xd180=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x180d[_0x465028];return _0xb783d4;};var _=require('lodash');var AWS=require(_0xd180('0x0'));var rp=require(_0xd180('0x1'));var util=require(_0xd180('0x2'));var BPromise=require(_0xd180('0x3'));var db=require(_0xd180('0x4'))['db'];var logger=require('../../config/logger')(_0xd180('0x5'));function getTranscriptionJob(_0x88504e,_0x2d418b,_0x438762,_0x456553){return new Promise(function(_0x44cf0b,_0x570b44){var _0x56d47d=new AWS[(_0xd180('0x6'))]({'accessKeyId':_0x2d418b,'secretAccessKey':_0x88504e,'region':_0x438762});_0x56d47d[_0xd180('0x7')]({'TranscriptionJobName':_0x456553},function(_0x345a39,_0x2bb664){if(_0x345a39){return _0x570b44(_0x345a39);}else{return _0x44cf0b(_0x2bb664);}});});}function sentiment(_0xd8fa8b,_0x42f372,_0x19f7b0,_0x3c66ff,_0x300540){return new Promise(function(_0x35e893,_0x1621a4){var _0x172bb4=new AWS[(_0xd180('0x8'))]({'accessKeyId':_0x42f372,'secretAccessKey':_0xd8fa8b,'region':_0x19f7b0});_0x172bb4[_0xd180('0x9')]({'Text':_0x3c66ff,'LanguageCode':_0x300540['substring'](0x0,0x2)},function(_0x3ec6ad,_0x19572c){if(_0x3ec6ad){return _0x1621a4(_0x3ec6ad);}else{return _0x35e893(_0x19572c);}});});}function checkTranscribeJob(_0x1384c9,_0x224bf4,_0xe4c3bb){var _0x51f9fe;return new BPromise(function(_0x5dd3f8,_0x2f759c){logger[_0xd180('0xa')](util[_0xd180('0xb')](_0xd180('0xc'),_0x1384c9['id'],_0x1384c9[_0xd180('0xd')]));return getTranscriptionJob(_0xe4c3bb[_0xd180('0xe')],_0xe4c3bb['data2'],_0x224bf4['transcribeRegion'],_0x1384c9[_0xd180('0xd')])['then'](function(_0x544a38){logger[_0xd180('0xa')](util['format'](_0xd180('0xf'),_0x1384c9['id'],_0x1384c9[_0xd180('0xd')],_0x544a38[_0xd180('0x10')][_0xd180('0x11')]));if(!_0x1384c9['fileText']){switch(_0x544a38[_0xd180('0x10')]['TranscriptionJobStatus']){case _0xd180('0x12'):var _0x24e5a4={'transcribeStatus':_0x544a38[_0xd180('0x10')][_0xd180('0x11')],'fileUri':_0x544a38[_0xd180('0x10')][_0xd180('0x13')][_0xd180('0x14')]};logger['info'](util[_0xd180('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x1384c9['id']));return rp({'uri':_0x544a38[_0xd180('0x10')][_0xd180('0x13')][_0xd180('0x14')],'json':!![]})[_0xd180('0x15')](function(_0x38c4f0){logger[_0xd180('0xa')](util[_0xd180('0xb')](_0xd180('0x16'),_0x1384c9['id']));if(_0x38c4f0&&_0x38c4f0[_0xd180('0x17')]&&_0x38c4f0[_0xd180('0x17')][_0xd180('0x18')]&&_0x38c4f0['results'][_0xd180('0x18')][_0xd180('0x19')]){_0x24e5a4['fileText']='';for(var _0x7118d2=0x0;_0x7118d2<_0x38c4f0[_0xd180('0x17')][_0xd180('0x18')]['length'];_0x7118d2++){_0x24e5a4[_0xd180('0x1a')]+=_0x38c4f0[_0xd180('0x17')][_0xd180('0x18')][_0x7118d2]['transcript']+'';}}return _0x1384c9[_0xd180('0x1b')](_0x24e5a4);})[_0xd180('0x15')](function(){logger['info'](util[_0xd180('0xb')](_0xd180('0x1c'),_0x1384c9['id']));if(!_0x1384c9[_0xd180('0x1d')]){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))](_0xd180('0x20'));}if(!_0x224bf4[_0xd180('0x21')]||!_0x224bf4['sentimentAccountId']||!_0x224bf4[_0xd180('0x22')]||!_0x224bf4[_0xd180('0x23')]||!_0x224bf4[_0xd180('0x24')]){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))](_0xd180('0x25'));}if(!_0x24e5a4[_0xd180('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x224bf4[_0xd180('0x26')]===_0xe4c3bb['id']){return _0xe4c3bb;}else{return db[_0xd180('0x27')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd180('0x15')](function(_0x15b023){if(!_0x15b023){throw new db['Sequelize'][(_0xd180('0x1f'))](_0xd180('0x28'));}if(!_0x15b023[_0xd180('0xe')]||!_0x15b023[_0xd180('0x29')]){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))](_0xd180('0x2a'));}_0x51f9fe=_0x15b023;logger['info'](util['format'](_0xd180('0x2b'),_0x1384c9['id']));return sentiment(_0x51f9fe[_0xd180('0xe')],_0x51f9fe[_0xd180('0x29')],_0x224bf4[_0xd180('0x22')],_0x24e5a4[_0xd180('0x1a')],_0x224bf4[_0xd180('0x23')]);})['then'](function(_0x56401b){logger[_0xd180('0xa')](util[_0xd180('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1384c9['id']));return _0x1384c9[_0xd180('0x1b')]({'sentiment':_0x56401b[_0xd180('0x2c')],'sPositive':_0x56401b[_0xd180('0x2d')][_0xd180('0x2e')],'sNegative':_0x56401b[_0xd180('0x2d')][_0xd180('0x2f')],'sMixed':_0x56401b[_0xd180('0x2d')]['Mixed'],'sNeutral':_0x56401b[_0xd180('0x2d')]['Neutral']});})['then'](function(){logger[_0xd180('0xa')](util[_0xd180('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1384c9['id']));_0x5dd3f8();});case _0xd180('0x30'):return _0x1384c9['update']({'transcribeStatus':_0xd180('0x30'),'failureReason':_0x544a38['TranscriptionJob'][_0xd180('0x31')]})[_0xd180('0x15')](function(){logger['info'](util['format'](_0xd180('0x1c'),_0x1384c9['id']));_0x5dd3f8();});default:logger['info'](util[_0xd180('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1384c9['id']));break;}}else{return BPromise[_0xd180('0x32')]()[_0xd180('0x15')](function(){if(!_0x1384c9['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xd180('0x20'));}if(!_0x224bf4['sentiment']||!_0x224bf4[_0xd180('0x26')]||!_0x224bf4[_0xd180('0x22')]||!_0x224bf4[_0xd180('0x23')]||!_0x224bf4[_0xd180('0x24')]){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))](_0xd180('0x25'));}if(!_0x1384c9[_0xd180('0x1a')]){throw new Error(_0xd180('0x33'));}if(_0x224bf4['sentimentAccountId']===_0xe4c3bb['id']){return _0xe4c3bb;}else{return db[_0xd180('0x27')]['findOne']({'where':{'id':_settings[_0xd180('0x26')]}});}})['then'](function(_0x2118f8){if(!_0x2118f8){throw new db['Sequelize'][(_0xd180('0x1f'))](_0xd180('0x28'));}if(!_0x2118f8[_0xd180('0xe')]||!_0x2118f8['data2']){throw new db[(_0xd180('0x1e'))]['ValidationError'](_0xd180('0x2a'));}_0x51f9fe=_0x2118f8;logger[_0xd180('0xa')](util['format'](_0xd180('0x2b'),_0x1384c9['id']));return sentiment(_0x51f9fe[_0xd180('0xe')],_0x51f9fe[_0xd180('0x29')],_0x224bf4[_0xd180('0x22')],_0x1384c9[_0xd180('0x1a')],_0x224bf4['language']);})[_0xd180('0x15')](function(_0x2127e9){logger[_0xd180('0xa')](util[_0xd180('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1384c9['id']));return _0x1384c9[_0xd180('0x1b')]({'sentiment':_0x2127e9[_0xd180('0x2c')],'sPositive':_0x2127e9[_0xd180('0x2d')][_0xd180('0x2e')],'sNegative':_0x2127e9['SentimentScore']['Negative'],'sMixed':_0x2127e9['SentimentScore'][_0xd180('0x34')],'sNeutral':_0x2127e9[_0xd180('0x2d')]['Neutral'],'transcribeStatus':_0xd180('0x12')});})[_0xd180('0x15')](function(){logger[_0xd180('0xa')](util[_0xd180('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1384c9['id']));_0x5dd3f8();});}})[_0xd180('0x35')](function(_0xc37da3){if(_0xc37da3){if(!_0xc37da3[_0xd180('0x36')]||_0xc37da3[_0xd180('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0xd180('0xb')](_0xd180('0x37'),_0x1384c9['id']),util[_0xd180('0x38')](_0xc37da3,{'showHidden':![],'depth':null}));}}_0x5dd3f8();});});}function checkTranscribe(){var _0x3e164b;var _0x4c2093;var _0x3a6b9a;return db['VoiceRecording'][_0xd180('0x39')]({'where':{'transcribeStatus':_0xd180('0x3a')}})[_0xd180('0x15')](function(_0x45ded4){if(!_0x45ded4||!_0x45ded4[_0xd180('0x19')]){throw new db[(_0xd180('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x3e164b=_0x45ded4;return db[_0xd180('0x3b')]['findOne']({'where':{'id':0x1}});})[_0xd180('0x15')](function(_0x3de6f1){if(!_0x3de6f1){throw new db['Sequelize'][(_0xd180('0x1f'))]('Settings\x20not\x20available');}_0x4c2093=_0x3de6f1;if(!_0x4c2093[_0xd180('0x5')]||!_0x4c2093[_0xd180('0x3c')]||!_0x4c2093['transcribeRegion']||!_0x4c2093[_0xd180('0x23')]||!_0x4c2093['bucket']){throw new db['Sequelize'][(_0xd180('0x1f'))](_0xd180('0x3d'));}return db['CloudProvider'][_0xd180('0x3e')]({'where':{'id':_0x4c2093[_0xd180('0x3c')]}});})[_0xd180('0x15')](function(_0x2ab70c){if(!_0x2ab70c){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ab70c[_0xd180('0xe')]||!_0x2ab70c[_0xd180('0x29')]){throw new db[(_0xd180('0x1e'))][(_0xd180('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a6b9a=_0x2ab70c;var _0x1bc3b6=[];_0x3e164b[_0xd180('0x3f')](function(_0x57504a){_0x1bc3b6['push'](checkTranscribeJob(_0x57504a,_0x4c2093,_0x3a6b9a));});return BPromise['all'](_0x1bc3b6);})[_0xd180('0x35')](function(_0xd9e31e){if(_0xd9e31e){if(!_0xd9e31e[_0xd180('0x36')]||_0xd9e31e['name']!==_0xd180('0x40')){logger[_0xd180('0x41')](util[_0xd180('0x38')](_0xd9e31e,{'showHidden':![],'depth':null}));}}});}exports[_0xd180('0x42')]=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 81dca02..0e20ba5 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 _0x9133=['ioredis','util','../../config/environment','../../mysqldb','redis','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','length','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment'];(function(_0x1a34f9,_0x5c8961){var _0x2ae688=function(_0x1f4a2a){while(--_0x1f4a2a){_0x1a34f9['push'](_0x1a34f9['shift']());}};_0x2ae688(++_0x5c8961);}(_0x9133,0x178));var _0x3913=function(_0x234514,_0x3f077d){_0x234514=_0x234514-0x0;var _0x16c5a2=_0x9133[_0x234514];return _0x16c5a2;};'use strict';var _=require(_0x3913('0x0'));var moment=require(_0x3913('0x1'));var Redis=require(_0x3913('0x2'));var util=require(_0x3913('0x3'));var config=require(_0x3913('0x4'));var db=require(_0x3913('0x5'))['db'];var logger=require('../logger')('schedule');config[_0x3913('0x6')]=_['defaults'](config[_0x3913('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3913('0x6')]));function closeInteractions(){var _0x351e11=[];return db['WhatsappInteraction'][_0x3913('0x7')]({'raw':!![],'attributes':['id',_0x3913('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3913('0x9')](0x18,_0x3913('0xa'))}}})[_0x3913('0xb')](function(_0x5cad68){if(_0x5cad68&&_0x5cad68['length']){_0x351e11=_[_0x3913('0xc')](_0x5cad68||[],'id');logger[_0x3913('0xd')](_0x3913('0xe'),_0x351e11[_0x3913('0xf')]());return db[_0x3913('0x10')][_0x3913('0x11')]({'closeReason':_0x3913('0x12'),'disposition':_0x3913('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x351e11}});}})[_0x3913('0xb')](function(){if(_0x351e11&&_0x351e11[_0x3913('0x14')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x351e11[_0x3913('0xf')]());for(var _0x37cf63=0x0;_0x37cf63<_0x351e11[_0x3913('0x14')];_0x37cf63++){io[_0x3913('0x15')](_0x3913('0x16'),{'id':_0x351e11[_0x37cf63],'closed':!![]});}}})[_0x3913('0x17')](function(_0x1f8a8f){logger[_0x3913('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1f8a8f?util[_0x3913('0x19')](_0x1f8a8f,{'showHidden':![],'depth':null}):'');});}exports[_0x3913('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd576=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract'];(function(_0x1c5b47,_0x25bbd4){var _0x29ee53=function(_0x47b3cd){while(--_0x47b3cd){_0x1c5b47['push'](_0x1c5b47['shift']());}};_0x29ee53(++_0x25bbd4);}(_0xd576,0xb1));var _0x6d57=function(_0x3a370a,_0x5beeff){_0x3a370a=_0x3a370a-0x0;var _0xcdeca8=_0xd576[_0x3a370a];return _0xcdeca8;};'use strict';var _=require(_0x6d57('0x0'));var moment=require(_0x6d57('0x1'));var Redis=require(_0x6d57('0x2'));var util=require('util');var config=require(_0x6d57('0x3'));var db=require(_0x6d57('0x4'))['db'];var logger=require(_0x6d57('0x5'))(_0x6d57('0x6'));config['redis']=_[_0x6d57('0x7')](config[_0x6d57('0x8')],{'host':_0x6d57('0x9'),'port':0x18eb});var io=require(_0x6d57('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x29a247=[];return db[_0x6d57('0xb')][_0x6d57('0xc')]({'raw':!![],'attributes':['id',_0x6d57('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6d57('0xe')](0x18,'hours')}}})['then'](function(_0x401e61){if(_0x401e61&&_0x401e61['length']){_0x29a247=_[_0x6d57('0xf')](_0x401e61||[],'id');logger[_0x6d57('0x10')](_0x6d57('0x11'),_0x29a247[_0x6d57('0x12')]());return db[_0x6d57('0xb')][_0x6d57('0x13')]({'closeReason':_0x6d57('0x14'),'disposition':_0x6d57('0x15'),'closed':!![],'closedAt':moment()[_0x6d57('0x16')](_0x6d57('0x17'))},{'where':{'id':_0x29a247}});}})[_0x6d57('0x18')](function(){if(_0x29a247&&_0x29a247[_0x6d57('0x19')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x29a247['join']());for(var _0x16e69c=0x0;_0x16e69c<_0x29a247[_0x6d57('0x19')];_0x16e69c++){io[_0x6d57('0x1a')](_0x6d57('0x1b'),{'id':_0x29a247[_0x16e69c],'closed':!![]});}}})[_0x6d57('0x1c')](function(_0x347100){logger[_0x6d57('0x1d')](_0x6d57('0x1e'),_0x347100?util[_0x6d57('0x1f')](_0x347100,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 59b293c..64362ee 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8246=['bulkCreate','hopper1','hopper2','catch','util','Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x8246,0x100));var _0x6824=function(_0x5b7425,_0x5be822){_0x5b7425=_0x5b7425-0x0;var _0xdfe51e=_0x8246[_0x5b7425];return _0xdfe51e;};'use strict';var util=require(_0x6824('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6824('0x1')+i,'lastName':_0x6824('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x6824('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6824('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x6824('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6824('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x6824('0x1')+i,'lastName':_0x6824('0x2')+i,'phone':0xf879fb460+i,'email':_0x6824('0x6')+i+_0x6824('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6824('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6824('0x5')]()});}db[_0x6824('0x7')][_0x6824('0x8')]({'where':{}})[_0x6824('0x9')](function(){return db[_0x6824('0x7')]['bulkCreate'](contacts);})[_0x6824('0x9')](function(){console[_0x6824('0xa')](_0x6824('0xb'),_0x6824('0xc'));return db[_0x6824('0xd')]['destroy']({'where':{}});})[_0x6824('0x9')](function(){return db[_0x6824('0xd')][_0x6824('0xe')](hopper);})[_0x6824('0x9')](function(){console[_0x6824('0xa')](_0x6824('0xb'),_0x6824('0xf'));return db[_0x6824('0x7')][_0x6824('0xe')](contacts2);})[_0x6824('0x9')](function(){console['log']('finished\x20populating','contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0x6824('0x9')](function(){console[_0x6824('0xa')]('finished\x20populating',_0x6824('0x10'));})[_0x6824('0x11')](function(_0xd806ec){console[_0x6824('0xa')](_0xd806ec);}); \ No newline at end of file +var _0x9d8f=['log','contacts1','bulkCreate','finished\x20populating','hopper1','contacts2','hopper2','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x9d8f,0xa0));var _0xf9d8=function(_0x5431dc,_0x5644a4){_0x5431dc=_0x5431dc-0x0;var _0x5809ea=_0x9d8f[_0x5431dc];return _0x5809ea;};'use strict';var util=require(_0xf9d8('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf9d8('0x1')]({'id':i,'firstName':_0xf9d8('0x2')+i,'lastName':_0xf9d8('0x3')+i,'phone':0xf879fb460+i,'email':_0xf9d8('0x4')+i+_0xf9d8('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf9d8('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf9d8('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf9d8('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf9d8('0x1')]({'id':i,'firstName':_0xf9d8('0x2')+i,'lastName':_0xf9d8('0x3')+i,'phone':0xf879fb460+i,'email':_0xf9d8('0x4')+i+_0xf9d8('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf9d8('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf9d8('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf9d8('0x6')](),'updatedAt':Date[_0xf9d8('0x6')]()});}db[_0xf9d8('0x7')][_0xf9d8('0x8')]({'where':{}})[_0xf9d8('0x9')](function(){return db[_0xf9d8('0x7')]['bulkCreate'](contacts);})[_0xf9d8('0x9')](function(){console[_0xf9d8('0xa')]('finished\x20populating',_0xf9d8('0xb'));return db['CmHopper'][_0xf9d8('0x8')]({'where':{}});})[_0xf9d8('0x9')](function(){return db['CmHopper'][_0xf9d8('0xc')](hopper);})[_0xf9d8('0x9')](function(){console['log'](_0xf9d8('0xd'),_0xf9d8('0xe'));return db[_0xf9d8('0x7')][_0xf9d8('0xc')](contacts2);})[_0xf9d8('0x9')](function(){console[_0xf9d8('0xa')](_0xf9d8('0xd'),_0xf9d8('0xf'));return db['CmHopper'][_0xf9d8('0xc')](hopper2);})[_0xf9d8('0x9')](function(){console[_0xf9d8('0xa')]('finished\x20populating',_0xf9d8('0x10'));})['catch'](function(_0x4a2916){console[_0xf9d8('0xa')](_0x4a2916);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index dc1f962..1c68843 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb386=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x22e777,_0x98b458){var _0x5c469b=function(_0x97e997){while(--_0x97e997){_0x22e777['push'](_0x22e777['shift']());}};_0x5c469b(++_0x98b458);}(_0xb386,0x170));var _0x6b38=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xb386[_0x5ddaac];return _0x2a9c58;};'use strict';var util=require('util');var db=require(_0x6b38('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x6b38('0x1'),_0x6b38('0x2'),i),'fullname':util[_0x6b38('0x3')](_0x6b38('0x1'),'agent',i),'email':util['format'](_0x6b38('0x4'),_0x6b38('0x2'),i),'role':'agent','password':_0x6b38('0x5'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x6b38('0x6')],'disallow':[_0x6b38('0x7')],'allow':[_0x6b38('0x8')],'defaultuser':util[_0x6b38('0x3')](_0x6b38('0x1'),'agent',i),'encryption':_0x6b38('0x9'),'avpf':'yes','force_avp':_0x6b38('0x9'),'icesupport':_0x6b38('0x9'),'dtlsenable':_0x6b38('0x9'),'dtlsverify':'no','dtlscertfile':_0x6b38('0xa'),'dtlsprivatekey':_0x6b38('0xb'),'dtlssetup':_0x6b38('0xc'),'callerid':util['format'](_0x6b38('0xd'),util[_0x6b38('0x3')](_0x6b38('0x1'),_0x6b38('0x2'),i),0xfa0+i)});}db[_0x6b38('0xe')][_0x6b38('0xf')](users)[_0x6b38('0x10')](function(){console['log'](_0x6b38('0x11'));})[_0x6b38('0x12')](function(_0xa5a4cd){console[_0x6b38('0x13')](_0xa5a4cd);}); \ No newline at end of file +var _0xd515=['yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log','util','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw'];(function(_0x1c26f0,_0x3901f7){var _0x52e0a2=function(_0x5d78a1){while(--_0x5d78a1){_0x1c26f0['push'](_0x1c26f0['shift']());}};_0x52e0a2(++_0x3901f7);}(_0xd515,0x1bd));var _0x5d51=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd515[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x5d51('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5d51('0x1')]({'name':util[_0x5d51('0x2')](_0x5d51('0x3'),_0x5d51('0x4'),i),'fullname':util[_0x5d51('0x2')](_0x5d51('0x3'),_0x5d51('0x4'),i),'email':util[_0x5d51('0x2')](_0x5d51('0x5'),_0x5d51('0x4'),i),'role':_0x5d51('0x4'),'password':_0x5d51('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x5d51('0x7'),'ws',_0x5d51('0x8')],'disallow':[_0x5d51('0x9')],'allow':[_0x5d51('0xa')],'defaultuser':util[_0x5d51('0x2')](_0x5d51('0x3'),_0x5d51('0x4'),i),'encryption':_0x5d51('0xb'),'avpf':_0x5d51('0xb'),'force_avp':_0x5d51('0xb'),'icesupport':'yes','dtlsenable':_0x5d51('0xb'),'dtlsverify':'no','dtlscertfile':_0x5d51('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5d51('0xd'),'callerid':util['format'](_0x5d51('0xe'),util[_0x5d51('0x2')](_0x5d51('0x3'),_0x5d51('0x4'),i),0xfa0+i)});}db['User'][_0x5d51('0xf')](users)[_0x5d51('0x10')](function(){console['log']('add\x20user');})[_0x5d51('0x11')](function(_0x27dbfd){console[_0x5d51('0x12')](_0x27dbfd);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 799719a..1f7d131 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ae0=['FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueue','Telephones','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','map','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','util','bluebird','./environment','name','User','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','role','Campaign','%s:queue:%s','length','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue'];(function(_0x2de1f6,_0x10026a){var _0x38de93=function(_0x103973){while(--_0x103973){_0x2de1f6['push'](_0x2de1f6['shift']());}};_0x38de93(++_0x10026a);}(_0x5ae0,0xf8));var _0x05ae=function(_0x24dc6a,_0x20300e){_0x24dc6a=_0x24dc6a-0x0;var _0x3ad56d=_0x5ae0[_0x24dc6a];return _0x3ad56d;};'use strict';var _=require('lodash');var util=require(_0x05ae('0x0'));var BPromise=require(_0x05ae('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x05ae('0x2'));var queryQueues={'attributes':['id',_0x05ae('0x3')],'include':[{'as':'Agents','model':db[_0x05ae('0x4')],'attributes':['id',_0x05ae('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x05ae('0x3')],'where':{'role':_0x05ae('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x05ae('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x05ae('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x05ae('0x3'),_0x05ae('0x7')],'where':{'type':_0x05ae('0x8')}};function getAssociatedResources(_0x315dd9,_0x34e318,_0x38cf72){return db[_0x05ae('0x9')][_0x05ae('0xa')]({'where':{'name':_0x315dd9,'userProfileId':_0x34e318},'raw':!![]})[_0x05ae('0xb')](function(_0x3e0498){if(_0x3e0498){if(_0x3e0498[_0x05ae('0xc')]){switch(_0x315dd9){case _0x05ae('0xd'):case _0x05ae('0xe'):case _0x05ae('0xf'):case _0x05ae('0x10'):case _0x05ae('0x11'):case _0x05ae('0x12'):case _0x05ae('0x13'):return db[_0x38cf72]['findAll'](queryQueues);case'Telephones':return db[_0x38cf72]['findAll'](queryTelephones);case'Trunks':return db[_0x38cf72][_0x05ae('0x14')](queryTrunks);case _0x05ae('0x15'):return db[_0x38cf72][_0x05ae('0x14')](queryCampaigns);}}else{return db[_0x05ae('0x16')][_0x05ae('0x14')]({'attributes':[_0x05ae('0x17')],'where':{'sectionId':_0x3e0498['id']},'raw':!![]})[_0x05ae('0xb')](function(_0x3de84b){if(_0x3de84b){var _0xf8a649={'where':{'id':_['map'](_0x3de84b,_0x05ae('0x17'))},'raw':!![]};switch(_0x38cf72){case _0x05ae('0x4'):_0xf8a649[_0x05ae('0x18')][_0x05ae('0x19')]=_0x05ae('0x5');break;case _0x05ae('0x1a'):_0xf8a649[_0x05ae('0x18')][_0x05ae('0x7')]=_0x05ae('0x8');break;}return db[_0x38cf72]['findAll'](_0xf8a649);}else{return[];}});}}else{return[];}})[_0x05ae('0xb')](function(_0x17ee83){return _0x17ee83;});}function joinOrLeaveQueues(_0x5a6fe6,_0x361bcc,_0x39f0ce,_0x506d50){_0x5a6fe6[_0x361bcc](util['format'](_0x05ae('0x1b'),_0x39f0ce,_0x506d50[_0x05ae('0x3')]));if(_0x506d50['Agents']){for(var _0x84b684=0x0;_0x84b684<_0x506d50['Agents'][_0x05ae('0x1c')];_0x84b684+=0x1){_0x5a6fe6[_0x361bcc](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x506d50['Agents'][_0x84b684][_0x05ae('0x3')]));}}}function joinOrLeave(_0x34e275,_0x4961c9,_0x5e6a27){var _0x39d71c;if(_0x34e275['handshake'][_0x05ae('0x1f')]['id']){db[_0x05ae('0x4')][_0x05ae('0x20')]({'attributes':['id','name','role',_0x05ae('0x21')],'where':{'id':_0x34e275[_0x05ae('0x22')][_0x05ae('0x1f')]['id']},'include':[{'model':db[_0x05ae('0x23')],'as':_0x05ae('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x05ae('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x05ae('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x28')],'as':_0x05ae('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x2a')],'as':_0x05ae('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x208c1b){if(_0x208c1b){_0x39d71c=_0x208c1b;_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x208c1b['name']));var _0x108bd8=[];switch(_0x208c1b[_0x05ae('0x19')]){case _0x05ae('0x2c'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));if(queryQueues[_0x05ae('0x2f')](_0x05ae('0x30'))){delete queryQueues[_0x05ae('0x30')];}_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x32')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x33')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x34')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x35')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db['MailQueue'][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x36')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x37')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x4')]['findAll'](queryTelephones));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x38')][_0x05ae('0x14')](queryTrunks));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x1a')]['findAll'](queryCampaigns));_0x108bd8[_0x05ae('0x31')](db['User']['findAll'](queryAgents));break;case _0x05ae('0x39'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));_0x108bd8['push'](getAssociatedResources(_0x05ae('0xd'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x32')));_0x108bd8['push'](getAssociatedResources(_0x05ae('0xe'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x33')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('FaxQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x34')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('SmsQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x35')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('MailQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x3a')));_0x108bd8['push'](getAssociatedResources('OpenchannelQueues',_0x208c1b[_0x05ae('0x21')],'OpenchannelQueue'));_0x108bd8[_0x05ae('0x31')](getAssociatedResources(_0x05ae('0x13'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x37')));_0x108bd8['push'](getAssociatedResources(_0x05ae('0x3b'),_0x208c1b[_0x05ae('0x21')],'User'));_0x108bd8['push'](getAssociatedResources(_0x05ae('0x3c'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x38')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('IvrCampaigns',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x1a')));_0x108bd8[_0x05ae('0x31')](db['User']['findAll'](queryAgents));break;case _0x05ae('0x6'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3d')]({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3e')]({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3f')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x40')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b['getMailQueues']({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8['push'](_0x208c1b[_0x05ae('0x41')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x42')]({'attributes':['id',_0x05ae('0x3')]}));break;}return BPromise[_0x05ae('0x43')](_0x108bd8);}})[_0x05ae('0xb')](function(_0x42f294){if(_0x42f294&&_0x42f294[_0x05ae('0x1c')]){for(var _0x3a002b=0x0;_0x3a002b<_0x42f294[_0x05ae('0x1c')];_0x3a002b+=0x1){for(var _0x11f71b=0x0;_0x11f71b<_0x42f294[_0x3a002b][_0x05ae('0x1c')];_0x11f71b+=0x1){switch(_0x3a002b){case 0x0:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x44'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x1:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x45'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x2:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x46'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x3:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x47'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x4:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x48'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x5:joinOrLeaveQueues(_0x34e275,_0x4961c9,'openchannel',_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x6:joinOrLeaveQueues(_0x34e275,_0x4961c9,'whatsapp',_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x7:if(_0x39d71c['role']!==_0x05ae('0x6'))_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x49'),_0x42f294[_0x3a002b][_0x11f71b]['name']));break;case 0x8:if(_0x39d71c[_0x05ae('0x19')]!==_0x05ae('0x6'))_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x4a'),_0x42f294[_0x3a002b][_0x11f71b][_0x05ae('0x3')]));break;case 0x9:if(_0x39d71c['role']!=='agent')_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x4b'),_0x42f294[_0x3a002b][_0x11f71b]['type'],_0x42f294[_0x3a002b][_0x11f71b]['name']));break;case 0xa:_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x42f294[_0x3a002b][_0x11f71b][_0x05ae('0x3')]));break;}}}}})[_0x05ae('0xb')](function(){if(_0x4961c9==='leave'){var _0x53cdcb=_[_0x05ae('0x4c')](_0x39d71c['ChatInteractions'],'id');return _0x39d71c['removeChatInteractions'](_0x53cdcb)[_0x05ae('0xb')](function(){for(var _0x4b405c=0x0;_0x4b405c<_0x53cdcb[_0x05ae('0x1c')];_0x4b405c+=0x1){_0x5e6a27[_0x05ae('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x53cdcb[_0x4b405c]),'UserId':Number(_0x39d71c['id'])});}});}})['then'](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x311032=_[_0x05ae('0x4c')](_0x39d71c['MailInteractions'],'id');return _0x39d71c[_0x05ae('0x4f')](_0x311032)[_0x05ae('0xb')](function(){for(var _0x2df17b=0x0;_0x2df17b<_0x311032[_0x05ae('0x1c')];_0x2df17b+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x50'),{'MailInteractionId':Number(_0x311032[_0x2df17b]),'UserId':Number(_0x39d71c['id'])});}});}})['then'](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x14819c=_[_0x05ae('0x4c')](_0x39d71c['FaxInteractions'],'id');return _0x39d71c[_0x05ae('0x51')](_0x14819c)[_0x05ae('0xb')](function(){for(var _0x1aa5fb=0x0;_0x1aa5fb<_0x14819c[_0x05ae('0x1c')];_0x1aa5fb+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x52'),{'FaxInteractionId':Number(_0x14819c[_0x1aa5fb]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x188353=_[_0x05ae('0x4c')](_0x39d71c[_0x05ae('0x53')],'id');return _0x39d71c[_0x05ae('0x54')](_0x188353)[_0x05ae('0xb')](function(){for(var _0x3f97df=0x0;_0x3f97df<_0x188353[_0x05ae('0x1c')];_0x3f97df+=0x1){_0x5e6a27['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x188353[_0x3f97df]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0xd252a1=_[_0x05ae('0x4c')](_0x39d71c['OpenchannelInteractions'],'id');return _0x39d71c[_0x05ae('0x55')](_0xd252a1)[_0x05ae('0xb')](function(){for(var _0x4f9a7d=0x0;_0x4f9a7d<_0xd252a1[_0x05ae('0x1c')];_0x4f9a7d+=0x1){_0x5e6a27['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xd252a1[_0x4f9a7d]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x2c1bd6=_[_0x05ae('0x4c')](_0x39d71c[_0x05ae('0x2b')],'id');return _0x39d71c[_0x05ae('0x56')](_0x2c1bd6)['then'](function(){for(var _0x417519=0x0;_0x417519<_0x2c1bd6['length'];_0x417519+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x57'),{'WhatsappInteractionId':Number(_0x2c1bd6[_0x417519]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0x58')](function(_0x349430){_0x34e275['log'](_0x349430);});}}function onDisconnect(_0x1df25a,_0x3eba49){joinOrLeave(_0x1df25a,_0x05ae('0x4e'),_0x3eba49);}function onConnect(_0x3cf8f4){joinOrLeave(_0x3cf8f4,_0x05ae('0x59'));}exports['default']=function(_0x542a4c){_0x542a4c['on']('connection',function(_0x4843d5){_0x4843d5['setMaxListeners'](0x0);_0x4843d5[_0x05ae('0x5a')]=_0x4843d5['request'][_0x05ae('0x5b')][_0x05ae('0x5c')]+':'+_0x4843d5[_0x05ae('0x5d')][_0x05ae('0x5b')][_0x05ae('0x5e')];_0x4843d5[_0x05ae('0x5f')]=new Date();_0x4843d5[_0x05ae('0x60')]=function(_0x2540ac){console[_0x05ae('0x60')](_0x05ae('0x61')+_0x4843d5['nsp'][_0x05ae('0x3')]+'['+_0x4843d5[_0x05ae('0x5a')]+']',_0x2540ac);};_0x4843d5['on'](_0x05ae('0x62'),function(){onDisconnect(_0x4843d5,_0x542a4c);_0x4843d5[_0x05ae('0x60')](_0x05ae('0x63'));});onConnect(_0x4843d5);_0x4843d5['log']('CONNECTED');});}; \ No newline at end of file +var _0x8fd4=['voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','ChatInteractions','removeChatInteractions','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x8fd4,0x178));var _0x48fd=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8fd4[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0x48fd('0x0'));var BPromise=require(_0x48fd('0x1'));var db=require(_0x48fd('0x2'))['db'];var config=require(_0x48fd('0x3'));var queryQueues={'attributes':['id',_0x48fd('0x4')],'include':[{'as':_0x48fd('0x5'),'model':db[_0x48fd('0x6')],'attributes':['id','name',_0x48fd('0x7')],'raw':!![],'where':{'role':_0x48fd('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x48fd('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x48fd('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x48fd('0x4')],'where':{'role':_0x48fd('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x48fd('0x4'),_0x48fd('0xa')],'where':{'type':_0x48fd('0xb')}};function getAssociatedResources(_0x1cfef7,_0x20802d,_0x4a3e64){return db[_0x48fd('0xc')]['findOne']({'where':{'name':_0x1cfef7,'userProfileId':_0x20802d},'raw':!![]})[_0x48fd('0xd')](function(_0x1e2a9d){if(_0x1e2a9d){if(_0x1e2a9d[_0x48fd('0xe')]){switch(_0x1cfef7){case _0x48fd('0xf'):case _0x48fd('0x10'):case _0x48fd('0x11'):case _0x48fd('0x12'):case _0x48fd('0x13'):case _0x48fd('0x14'):case _0x48fd('0x15'):return db[_0x4a3e64]['findAll'](queryQueues);case _0x48fd('0x16'):return db[_0x4a3e64][_0x48fd('0x17')](queryTelephones);case _0x48fd('0x18'):return db[_0x4a3e64][_0x48fd('0x17')](queryTrunks);case _0x48fd('0x19'):return db[_0x4a3e64][_0x48fd('0x17')](queryCampaigns);}}else{return db[_0x48fd('0x1a')][_0x48fd('0x17')]({'attributes':[_0x48fd('0x1b')],'where':{'sectionId':_0x1e2a9d['id']},'raw':!![]})[_0x48fd('0xd')](function(_0x52ce33){if(_0x52ce33){var _0x5a0abe={'where':{'id':_['map'](_0x52ce33,_0x48fd('0x1b'))},'raw':!![]};switch(_0x4a3e64){case _0x48fd('0x6'):_0x5a0abe[_0x48fd('0x1c')][_0x48fd('0x7')]=_0x48fd('0x9');break;case _0x48fd('0x1d'):_0x5a0abe[_0x48fd('0x1c')][_0x48fd('0xa')]=_0x48fd('0xb');break;}return db[_0x4a3e64][_0x48fd('0x17')](_0x5a0abe);}else{return[];}});}}else{return[];}})[_0x48fd('0xd')](function(_0x23f9a4){return _0x23f9a4;});}function joinOrLeaveQueues(_0x1a34c2,_0x18b96c,_0x28e654,_0x27c0f5){_0x1a34c2[_0x18b96c](util['format'](_0x48fd('0x1e'),_0x28e654,_0x27c0f5['name']));if(_0x27c0f5[_0x48fd('0x5')]){for(var _0x26175e=0x0;_0x26175e<_0x27c0f5[_0x48fd('0x5')][_0x48fd('0x1f')];_0x26175e+=0x1){_0x1a34c2[_0x18b96c](util[_0x48fd('0x20')](_0x48fd('0x21'),_0x27c0f5['Agents'][_0x26175e][_0x48fd('0x4')]));}}}function joinOrLeave(_0x453f61,_0x2ca93b,_0x2a4860){var _0x44bbb3;if(_0x453f61[_0x48fd('0x22')][_0x48fd('0x23')]['id']){db['User']['find']({'attributes':['id',_0x48fd('0x4'),_0x48fd('0x7'),_0x48fd('0x24')],'where':{'id':_0x453f61[_0x48fd('0x22')][_0x48fd('0x23')]['id']},'include':[{'model':db[_0x48fd('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x48fd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x48fd('0x27')],'as':_0x48fd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x48fd('0x29')],'as':_0x48fd('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x48fd('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x48fd('0x2c')],'as':_0x48fd('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x48fd('0xd')](function(_0x5b16d0){if(_0x5b16d0){_0x44bbb3=_0x5b16d0;_0x453f61[_0x2ca93b](util[_0x48fd('0x20')](_0x48fd('0x21'),_0x5b16d0[_0x48fd('0x4')]));var _0x559576=[];switch(_0x5b16d0[_0x48fd('0x7')]){case _0x48fd('0x2e'):_0x453f61[_0x2ca93b](_0x48fd('0x2f'));_0x453f61[_0x2ca93b](_0x48fd('0x30'));if(queryQueues[_0x48fd('0x31')](_0x48fd('0x32'))){delete queryQueues[_0x48fd('0x32')];}_0x559576[_0x48fd('0x33')](db[_0x48fd('0x34')][_0x48fd('0x17')](queryQueues));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x35')][_0x48fd('0x17')](queryQueues));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x36')]['findAll'](queryQueues));_0x559576['push'](db[_0x48fd('0x37')][_0x48fd('0x17')](queryQueues));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x38')][_0x48fd('0x17')](queryQueues));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x39')][_0x48fd('0x17')](queryQueues));_0x559576['push'](db[_0x48fd('0x3a')][_0x48fd('0x17')](queryQueues));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x6')][_0x48fd('0x17')](queryTelephones));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x3b')][_0x48fd('0x17')](queryTrunks));_0x559576[_0x48fd('0x33')](db['Campaign']['findAll'](queryCampaigns));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x6')][_0x48fd('0x17')](queryAgents));break;case'user':_0x453f61[_0x2ca93b](_0x48fd('0x2f'));_0x453f61[_0x2ca93b](_0x48fd('0x30'));_0x559576['push'](getAssociatedResources('VoiceQueues',_0x5b16d0[_0x48fd('0x24')],'VoiceQueue'));_0x559576['push'](getAssociatedResources(_0x48fd('0x10'),_0x5b16d0['userProfileId'],'ChatQueue'));_0x559576[_0x48fd('0x33')](getAssociatedResources('FaxQueues',_0x5b16d0[_0x48fd('0x24')],'FaxQueue'));_0x559576[_0x48fd('0x33')](getAssociatedResources(_0x48fd('0x12'),_0x5b16d0[_0x48fd('0x24')],'SmsQueue'));_0x559576[_0x48fd('0x33')](getAssociatedResources('MailQueues',_0x5b16d0[_0x48fd('0x24')],_0x48fd('0x38')));_0x559576[_0x48fd('0x33')](getAssociatedResources(_0x48fd('0x14'),_0x5b16d0[_0x48fd('0x24')],_0x48fd('0x39')));_0x559576[_0x48fd('0x33')](getAssociatedResources(_0x48fd('0x15'),_0x5b16d0['userProfileId'],_0x48fd('0x3a')));_0x559576[_0x48fd('0x33')](getAssociatedResources('Telephones',_0x5b16d0[_0x48fd('0x24')],_0x48fd('0x6')));_0x559576['push'](getAssociatedResources(_0x48fd('0x18'),_0x5b16d0[_0x48fd('0x24')],_0x48fd('0x3b')));_0x559576[_0x48fd('0x33')](getAssociatedResources('IvrCampaigns',_0x5b16d0[_0x48fd('0x24')],_0x48fd('0x1d')));_0x559576[_0x48fd('0x33')](db[_0x48fd('0x6')][_0x48fd('0x17')](queryAgents));break;case'agent':_0x453f61[_0x2ca93b](_0x48fd('0x2f'));_0x453f61[_0x2ca93b](_0x48fd('0x30'));_0x559576['push'](_0x5b16d0['getVoiceQueues']({'attributes':['id',_0x48fd('0x4')]}));_0x559576[_0x48fd('0x33')](_0x5b16d0[_0x48fd('0x3c')]({'attributes':['id','name']}));_0x559576[_0x48fd('0x33')](_0x5b16d0[_0x48fd('0x3d')]({'attributes':['id',_0x48fd('0x4')]}));_0x559576[_0x48fd('0x33')](_0x5b16d0[_0x48fd('0x3e')]({'attributes':['id','name']}));_0x559576['push'](_0x5b16d0[_0x48fd('0x3f')]({'attributes':['id','name']}));_0x559576[_0x48fd('0x33')](_0x5b16d0[_0x48fd('0x40')]({'attributes':['id','name']}));_0x559576['push'](_0x5b16d0[_0x48fd('0x41')]({'attributes':['id',_0x48fd('0x4')]}));break;}return BPromise['all'](_0x559576);}})[_0x48fd('0xd')](function(_0x2d4a0c){if(_0x2d4a0c&&_0x2d4a0c[_0x48fd('0x1f')]){for(var _0x1e3661=0x0;_0x1e3661<_0x2d4a0c['length'];_0x1e3661+=0x1){for(var _0x2ba5d1=0x0;_0x2ba5d1<_0x2d4a0c[_0x1e3661][_0x48fd('0x1f')];_0x2ba5d1+=0x1){switch(_0x1e3661){case 0x0:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x42'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x1:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x43'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x2:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x44'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x3:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x45'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x4:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x46'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x5:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x47'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x6:joinOrLeaveQueues(_0x453f61,_0x2ca93b,_0x48fd('0x48'),_0x2d4a0c[_0x1e3661][_0x2ba5d1]);break;case 0x7:if(_0x44bbb3[_0x48fd('0x7')]!=='agent')_0x453f61[_0x2ca93b](util[_0x48fd('0x20')](_0x48fd('0x49'),_0x2d4a0c[_0x1e3661][_0x2ba5d1][_0x48fd('0x4')]));break;case 0x8:if(_0x44bbb3[_0x48fd('0x7')]!==_0x48fd('0x8'))_0x453f61[_0x2ca93b](util[_0x48fd('0x20')](_0x48fd('0x4a'),_0x2d4a0c[_0x1e3661][_0x2ba5d1][_0x48fd('0x4')]));break;case 0x9:if(_0x44bbb3[_0x48fd('0x7')]!=='agent')_0x453f61[_0x2ca93b](util[_0x48fd('0x20')](_0x48fd('0x4b'),_0x2d4a0c[_0x1e3661][_0x2ba5d1][_0x48fd('0xa')],_0x2d4a0c[_0x1e3661][_0x2ba5d1][_0x48fd('0x4')]));break;case 0xa:_0x453f61[_0x2ca93b](util[_0x48fd('0x20')](_0x48fd('0x21'),_0x2d4a0c[_0x1e3661][_0x2ba5d1][_0x48fd('0x4')]));break;}}}}})[_0x48fd('0xd')](function(){if(_0x2ca93b==='leave'){var _0x3d58cd=_[_0x48fd('0x4c')](_0x44bbb3[_0x48fd('0x4d')],'id');return _0x44bbb3[_0x48fd('0x4e')](_0x3d58cd)[_0x48fd('0xd')](function(){for(var _0x4f88f6=0x0;_0x4f88f6<_0x3d58cd[_0x48fd('0x1f')];_0x4f88f6+=0x1){_0x2a4860['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3d58cd[_0x4f88f6]),'UserId':Number(_0x44bbb3['id'])});}});}})['then'](function(){if(_0x2ca93b==='leave'){var _0x7ae5a6=_['map'](_0x44bbb3['MailInteractions'],'id');return _0x44bbb3[_0x48fd('0x4f')](_0x7ae5a6)[_0x48fd('0xd')](function(){for(var _0x5c0c7f=0x0;_0x5c0c7f<_0x7ae5a6[_0x48fd('0x1f')];_0x5c0c7f+=0x1){_0x2a4860['emit'](_0x48fd('0x50'),{'MailInteractionId':Number(_0x7ae5a6[_0x5c0c7f]),'UserId':Number(_0x44bbb3['id'])});}});}})[_0x48fd('0xd')](function(){if(_0x2ca93b===_0x48fd('0x51')){var _0x1131b1=_['map'](_0x44bbb3[_0x48fd('0x28')],'id');return _0x44bbb3[_0x48fd('0x52')](_0x1131b1)[_0x48fd('0xd')](function(){for(var _0x574c48=0x0;_0x574c48<_0x1131b1[_0x48fd('0x1f')];_0x574c48+=0x1){_0x2a4860[_0x48fd('0x53')](_0x48fd('0x54'),{'FaxInteractionId':Number(_0x1131b1[_0x574c48]),'UserId':Number(_0x44bbb3['id'])});}});}})[_0x48fd('0xd')](function(){if(_0x2ca93b===_0x48fd('0x51')){var _0x43e68a=_[_0x48fd('0x4c')](_0x44bbb3[_0x48fd('0x2a')],'id');return _0x44bbb3[_0x48fd('0x55')](_0x43e68a)[_0x48fd('0xd')](function(){for(var _0x1c5c9c=0x0;_0x1c5c9c<_0x43e68a[_0x48fd('0x1f')];_0x1c5c9c+=0x1){_0x2a4860[_0x48fd('0x53')](_0x48fd('0x56'),{'SmsInteractionId':Number(_0x43e68a[_0x1c5c9c]),'UserId':Number(_0x44bbb3['id'])});}});}})['then'](function(){if(_0x2ca93b===_0x48fd('0x51')){var _0x2a8748=_[_0x48fd('0x4c')](_0x44bbb3[_0x48fd('0x57')],'id');return _0x44bbb3[_0x48fd('0x58')](_0x2a8748)[_0x48fd('0xd')](function(){for(var _0x1d7d33=0x0;_0x1d7d33<_0x2a8748[_0x48fd('0x1f')];_0x1d7d33+=0x1){_0x2a4860[_0x48fd('0x53')](_0x48fd('0x59'),{'OpenchannelInteractionId':Number(_0x2a8748[_0x1d7d33]),'UserId':Number(_0x44bbb3['id'])});}});}})['then'](function(){if(_0x2ca93b===_0x48fd('0x51')){var _0x2adeb1=_[_0x48fd('0x4c')](_0x44bbb3['WhatsappInteractions'],'id');return _0x44bbb3[_0x48fd('0x5a')](_0x2adeb1)[_0x48fd('0xd')](function(){for(var _0xad16da=0x0;_0xad16da<_0x2adeb1[_0x48fd('0x1f')];_0xad16da+=0x1){_0x2a4860[_0x48fd('0x53')](_0x48fd('0x5b'),{'WhatsappInteractionId':Number(_0x2adeb1[_0xad16da]),'UserId':Number(_0x44bbb3['id'])});}});}})[_0x48fd('0x5c')](function(_0x775383){_0x453f61[_0x48fd('0x5d')](_0x775383);});}}function onDisconnect(_0x4bc86b,_0x5b2b6a){joinOrLeave(_0x4bc86b,_0x48fd('0x51'),_0x5b2b6a);}function onConnect(_0x23e371){joinOrLeave(_0x23e371,_0x48fd('0x5e'));}exports['default']=function(_0x3235e7){_0x3235e7['on'](_0x48fd('0x5f'),function(_0x536a42){_0x536a42[_0x48fd('0x60')](0x0);_0x536a42['address']=_0x536a42[_0x48fd('0x61')][_0x48fd('0x5f')][_0x48fd('0x62')]+':'+_0x536a42[_0x48fd('0x61')][_0x48fd('0x5f')][_0x48fd('0x63')];_0x536a42[_0x48fd('0x64')]=new Date();_0x536a42[_0x48fd('0x5d')]=function(_0x402c71){console[_0x48fd('0x5d')](_0x48fd('0x65')+_0x536a42[_0x48fd('0x66')][_0x48fd('0x4')]+'['+_0x536a42[_0x48fd('0x67')]+']',_0x402c71);};_0x536a42['on'](_0x48fd('0x68'),function(){onDisconnect(_0x536a42,_0x3235e7);_0x536a42[_0x48fd('0x5d')]('DISCONNECTED');});onConnect(_0x536a42);_0x536a42['log'](_0x48fd('0x69'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7667f64..4a49f99 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 _0xeb56=['Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','event','direction','then','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','email','length','model','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','newinteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0xeb56,0x1ec));var _0x6eb5=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xeb56[_0x37756b];return _0x46efec;};'use strict';var util=require(_0x6eb5('0x0'));var db=require(_0x6eb5('0x1'))['db'];var jayson=require(_0x6eb5('0x2'));var logger=require(_0x6eb5('0x3'))('triggers');var client=jayson[_0x6eb5('0x4')][_0x6eb5('0x5')]({'port':0x232a});var triggers=[{'channel':_0x6eb5('0x6'),'model':_0x6eb5('0x7'),'event':_0x6eb5('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x6eb5('0x7'),'event':_0x6eb5('0x9'),'condition':_0x6eb5('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x6eb5('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6eb5('0x6'),'model':_0x6eb5('0xc'),'event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x6eb5('0xd'),'model':'SmsInteraction','event':_0x6eb5('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6eb5('0xd'),'model':_0x6eb5('0xe'),'event':_0x6eb5('0x9'),'condition':_0x6eb5('0xa'),'callback':afterUpdate},{'channel':_0x6eb5('0xd'),'model':_0x6eb5('0xf'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x10'),'callback':afterCreateMessage},{'channel':_0x6eb5('0x11'),'model':_0x6eb5('0x12'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x13'),'callback':afterCreate},{'channel':_0x6eb5('0x11'),'model':'WhatsappInteraction','event':_0x6eb5('0x9'),'condition':_0x6eb5('0xa'),'callback':afterUpdate},{'channel':_0x6eb5('0x11'),'model':_0x6eb5('0x14'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x10'),'callback':afterCreateMessage},{'channel':_0x6eb5('0x15'),'model':_0x6eb5('0x16'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x13'),'callback':afterCreate},{'channel':_0x6eb5('0x15'),'model':_0x6eb5('0x16'),'event':_0x6eb5('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6eb5('0x15'),'model':'FaxMessage','event':'afterCreate','condition':_0x6eb5('0x10'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':'afterCreate','condition':_0x6eb5('0x13'),'callback':afterCreate},{'channel':'Mail','model':_0x6eb5('0x17'),'event':_0x6eb5('0x9'),'condition':_0x6eb5('0xa'),'callback':afterUpdate},{'channel':_0x6eb5('0x18'),'model':_0x6eb5('0x19'),'event':_0x6eb5('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6eb5('0x1a'),'model':_0x6eb5('0x1b'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x13'),'callback':afterCreate},{'channel':'Openchannel','model':_0x6eb5('0x1b'),'event':_0x6eb5('0x9'),'condition':_0x6eb5('0xa'),'callback':afterUpdate},{'channel':_0x6eb5('0x1a'),'model':_0x6eb5('0x1c'),'event':_0x6eb5('0x8'),'condition':_0x6eb5('0x10'),'callback':afterCreateMessage}];function request(_0xeb1bdd){return client[_0x6eb5('0x1d')](_0x6eb5('0x1e'),_0xeb1bdd)['then'](function(_0x11fe69){logger['info']('Trigger,\x20%s','EventManager',_0x11fe69);if(_0x11fe69[_0x6eb5('0x1f')]){if(_0x11fe69[_0x6eb5('0x1f')][_0x6eb5('0x20')]===0x1f4){logger[_0x6eb5('0x1f')]('Trigger,\x20%s',_0x6eb5('0x1e'),_0x11fe69['error']);}}})[_0x6eb5('0x21')](function(_0x1b6b92){logger[_0x6eb5('0x1f')](_0x6eb5('0x22'),'EventManager',_0x1b6b92);});}function afterCreateMessage(_0x4cf35a){return function(_0xb440b){_0xb440b=_0xb440b[_0x6eb5('0x23')]({'plain':!![]});_0xb440b[_0x6eb5('0x24')]=_0x4cf35a;_0xb440b[_0x6eb5('0x25')]=_0x4cf35a;_0xb440b[_0x6eb5('0x26')]=_0xb440b[_0x6eb5('0x27')];Promise['resolve']()[_0x6eb5('0x28')](function(){if(typeof _0xb440b[_0x6eb5('0x29')]==='undefined')return null;var _0x59206a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb440b[_0x6eb5('0x29')];return db[_0x6eb5('0x2a')][_0x6eb5('0x2b')](_0x59206a,{'type':db[_0x6eb5('0x2c')][_0x6eb5('0x2d')][_0x6eb5('0x2e')],'raw':!![]});})[_0x6eb5('0x28')](function(_0xaf2b05){if(_0xaf2b05){_0xb440b[_0x6eb5('0x2f')]=_0xaf2b05[0x0];}if(typeof _0xb440b[_0x6eb5('0x30')]===_0x6eb5('0x31'))return;return getAgent(_0xb440b['UserId']);})[_0x6eb5('0x28')](function(_0x52d194){if(_0x52d194){_0xb440b[_0x6eb5('0x32')]=util[_0x6eb5('0x33')](_0x6eb5('0x34'),_0x52d194[_0x6eb5('0x35')]);_0xb440b[_0x6eb5('0x36')]=_0x52d194;_0xb440b[_0x6eb5('0x24')]=_0x4cf35a;return request({'event':_0x6eb5('0x37'),'message':_0xb440b});}else{return request({'event':'outgoingmessage','message':_0xb440b});}})['catch'](function(_0x131ae3){logger[_0x6eb5('0x1f')]('Trigger,\x20%s',_0x6eb5('0x38'),_0x131ae3);});};}function afterCreateOfflineMessage(_0x5c0c51){return function(_0x40d371){_0x40d371=_0x40d371[_0x6eb5('0x23')]({'plain':!![]});_0x40d371[_0x6eb5('0x24')]=_0x5c0c51;_0x40d371[_0x6eb5('0x25')]=_0x5c0c51;_0x40d371[_0x6eb5('0x26')]=_0x6eb5('0x39');return request({'event':_0x40d371['event'],'message':_0x40d371});};}function afterCreate(_0x3f1f04,_0x36adb1){return function(_0x424f5f){_0x424f5f=_0x424f5f[_0x6eb5('0x23')]({'plain':!![]});_0x424f5f[_0x6eb5('0x24')]=_0x3f1f04;_0x424f5f[_0x6eb5('0x25')]=_0x3f1f04;_0x424f5f['event']=_0x6eb5('0x3a');Promise[_0x6eb5('0x3b')]()[_0x6eb5('0x28')](function(){var _0x41882a=_0x6eb5('0x3c')+_0x424f5f['ContactId'];return db[_0x6eb5('0x2a')]['query'](_0x41882a,{'type':db[_0x6eb5('0x2c')]['QueryTypes'][_0x6eb5('0x2e')],'raw':!![]});})[_0x6eb5('0x28')](function(_0x289fa9){if(_0x289fa9){_0x424f5f['contact']=_0x289fa9[0x0];}if(typeof _0x424f5f[_0x6eb5('0x30')]===_0x6eb5('0x31'))return;return getAgent(_0x424f5f[_0x6eb5('0x30')]);})[_0x6eb5('0x28')](function(_0x1e8f42){if(_0x1e8f42){_0x424f5f[_0x6eb5('0x32')]=util[_0x6eb5('0x33')]('SIP/%s',_0x1e8f42[_0x6eb5('0x35')]);_0x424f5f['agent']=_0x1e8f42;}return request({'event':_0x36adb1,'message':_0x424f5f});})[_0x6eb5('0x21')](function(_0x40b239){logger['error']('Trigger,\x20%s',_0x6eb5('0x3d'),_0x40b239);});};}function afterUpdate(_0x530c1b){return function(_0x1c51c6){var _0x3dc7ab=_0x1c51c6[_0x6eb5('0x3e')](_0x6eb5('0x3f'))&&_0x1c51c6[_0x6eb5('0x3f')];var _0x35a9ab=_0x1c51c6['changed'](_0x6eb5('0x40'));if(_0x3dc7ab||_0x35a9ab){var _0x3055fd=_0x3dc7ab?_0x6eb5('0xa'):_0x6eb5('0x40');var _0x3209e2=_0x1c51c6[_0x6eb5('0x23')]({'plain':!![]});_0x3209e2[_0x6eb5('0x24')]=_0x530c1b;_0x3209e2[_0x6eb5('0x25')]=_0x530c1b;_0x3209e2[_0x6eb5('0x26')]=_0x3dc7ab?_0x6eb5('0x3f'):_0x6eb5('0x40');var _0x4dd45b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3209e2[_0x6eb5('0x29')];return db[_0x6eb5('0x2a')][_0x6eb5('0x2b')](_0x4dd45b,{'type':db[_0x6eb5('0x2c')][_0x6eb5('0x2d')][_0x6eb5('0x2e')],'raw':!![]})[_0x6eb5('0x28')](function(_0x3e07d5){if(_0x3e07d5){_0x3209e2['contact']=_0x3e07d5[0x0];}if(typeof _0x3209e2[_0x6eb5('0x30')]===_0x6eb5('0x31'))return;return getAgent(_0x3209e2['UserId']);})[_0x6eb5('0x28')](function(_0x1424c3){if(_0x1424c3){_0x3209e2['interface']=util[_0x6eb5('0x33')](_0x6eb5('0x34'),_0x1424c3[_0x6eb5('0x35')]);_0x3209e2[_0x6eb5('0x36')]=_0x1424c3;}return request({'event':_0x3055fd,'message':_0x3209e2});})[_0x6eb5('0x21')](function(_0x5f55df){logger[_0x6eb5('0x1f')](_0x6eb5('0x22'),_0x6eb5('0x41'),_0x5f55df);});}};}function getAgent(_0x23f248){return db[_0x6eb5('0x42')][_0x6eb5('0x43')]({'where':{'id':_0x23f248},'attributes':['id',_0x6eb5('0x35'),'fullname',_0x6eb5('0x44'),'internal'],'raw':!![]})[_0x6eb5('0x28')](function(_0x37cee2){return _0x37cee2;});}exports['default']=function(){for(var _0x3b46c2=0x0;_0x3b46c2=_0x21350e[_0xd499('0xf')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5d4a15(_0xa04e64);})[_0xd499('0x10')](function(_0x1a35d7){_0x3595ad(_0x1a35d7);});});}; \ No newline at end of file +var _0xa807=['updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt'];(function(_0x5968d3,_0x424ea3){var _0x3d7649=function(_0x34494d){while(--_0x34494d){_0x5968d3['push'](_0x5968d3['shift']());}};_0x3d7649(++_0x424ea3);}(_0xa807,0x104));var _0x7a80=function(_0x1586d3,_0xa8cc28){_0x1586d3=_0x1586d3-0x0;var _0x3cfa69=_0xa807[_0x1586d3];return _0x3cfa69;};'use strict';var _=require(_0x7a80('0x0'));var BPromise=require(_0x7a80('0x1'));var db=require(_0x7a80('0x2'))['db'];var util=require(_0x7a80('0x3'));var channels=[_0x7a80('0x4'),_0x7a80('0x5'),_0x7a80('0x6'),_0x7a80('0x7'),_0x7a80('0x8'),'whatsapp',_0x7a80('0x9')];exports[_0x7a80('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x2eec66){_0x2eec66=_0x2eec66[_0x7a80('0xb')]();return _[_0x7a80('0xc')](channels,_0x2eec66);};exports[_0x7a80('0xd')]=function(_0x528227,_0x1d6585,_0x5604e6,_0x4a34f8){var _0x591fa9={'loginAttempts':_0x1d6585,'blocked':_0x5604e6};if(!_['isUndefined'](_0x4a34f8)){_0x591fa9[_0x7a80('0xe')]=_0x4a34f8;}return _0x528227[_0x7a80('0xf')](_0x591fa9);};exports[_0x7a80('0x10')]=function(_0x16e2c2){return new BPromise(function(_0x50cdcb,_0x5bca9d){var _0x236de7=0x0;if(_0x16e2c2[_0x7a80('0x11')]!==_0x7a80('0x12')){_0x50cdcb(_0x16e2c2);}db[_0x7a80('0x13')][_0x7a80('0x14')]({'where':{'role':_0x7a80('0x12'),'online':!![],'id':{'$ne':_0x16e2c2['id']}}})[_0x7a80('0x15')](function(_0xb7e87c){_0x236de7=_0xb7e87c;return util[_0x7a80('0x10')]();})[_0x7a80('0x15')](function(_0x530f7d){if(_0x530f7d&&_0x530f7d['agents']&&_0x236de7>=_0x530f7d[_0x7a80('0x16')]){throw Error(_0x7a80('0x17'));}_0x50cdcb(_0x16e2c2);})[_0x7a80('0x18')](function(_0x2202a7){_0x5bca9d(_0x2202a7);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e1b5ce6..e9ec3eb 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5635=['statusMessage','status','send','exports','util','../config/logger','api','message','Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack'];(function(_0x473b5a,_0x17fa75){var _0x32dea3=function(_0x530019){while(--_0x530019){_0x473b5a['push'](_0x473b5a['shift']());}};_0x32dea3(++_0x17fa75);}(_0x5635,0x88));var _0x5563=function(_0x991b92,_0x7996d){_0x991b92=_0x991b92-0x0;var _0x16ff6a=_0x5635[_0x991b92];return _0x16ff6a;};'use strict';var util=require(_0x5563('0x0'));var logger=require(_0x5563('0x1'))(_0x5563('0x2'));var APIError=function(_0x37fcc0,_0x5f2931){this[_0x5563('0x3')]=_0x37fcc0||'Internal\x20Server\x20Error';this['name']=_0x5f2931||_0x5563('0x4');util[_0x5563('0x5')](APIError,Error);};var APIBadRequestError=function(_0x154e3a){this[_0x5563('0x3')]=_0x154e3a||_0x5563('0x6');this[_0x5563('0x7')]=_0x5563('0x6');util[_0x5563('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4d89fe){this[_0x5563('0x3')]=_0x4d89fe||_0x5563('0x8');this[_0x5563('0x7')]='Forbidden';util[_0x5563('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x24cb65){this['message']=_0x24cb65||_0x5563('0x9');this[_0x5563('0x7')]='Not\x20Found';util[_0x5563('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x376a6e){this[_0x5563('0x3')]=_0x376a6e||_0x5563('0xa');this[_0x5563('0x7')]=_0x5563('0xb');this[_0x5563('0xc')]=0x193;this[_0x5563('0xd')]={'type':_0x5563('0xe')};util[_0x5563('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1d1d25){this[_0x5563('0x3')]=_0x1d1d25||'Resource\x20Conflict';this['name']=_0x5563('0xf');util[_0x5563('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x2a17ed){switch(_0x2a17ed){case'Bad\x20Request':return 0x190;case _0x5563('0x8'),_0x5563('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x353d04){if(_0x353d04===_0x5563('0xb'))return _0x353d04;return null;}function handleError(_0x4ca27e){return function(_0x59ecdb){logger[_0x5563('0x10')](_0x59ecdb[_0x5563('0x11')]);var _0x3f18ec=getStatusCode(_0x59ecdb['name']);var _0x48804c=getCustomStatusMessage(_0x59ecdb['name']);if(_0x59ecdb[_0x5563('0x7')]){delete _0x59ecdb[_0x5563('0x7')];}if(_0x48804c){_0x4ca27e[_0x5563('0x12')]=_0x48804c;}return _0x4ca27e[_0x5563('0x13')](_0x3f18ec)[_0x5563('0x14')](_0x59ecdb);};}module[_0x5563('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x190a=['message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','send','util','../config/logger','api'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x190a,0x66));var _0xa190=function(_0x553662,_0x4a91aa){_0x553662=_0x553662-0x0;var _0x4d992f=_0x190a[_0x553662];return _0x4d992f;};'use strict';var util=require(_0xa190('0x0'));var logger=require(_0xa190('0x1'))(_0xa190('0x2'));var APIError=function(_0x58bd61,_0x404c7c){this[_0xa190('0x3')]=_0x58bd61||_0xa190('0x4');this[_0xa190('0x5')]=_0x404c7c||_0xa190('0x6');util[_0xa190('0x7')](APIError,Error);};var APIBadRequestError=function(_0x7d9e0b){this['message']=_0x7d9e0b||'Bad\x20Request';this[_0xa190('0x5')]=_0xa190('0x8');util[_0xa190('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xdd3e5){this[_0xa190('0x3')]=_0xdd3e5||_0xa190('0x9');this[_0xa190('0x5')]='Forbidden';util[_0xa190('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x343e74){this['message']=_0x343e74||'Entity\x20not\x20found';this[_0xa190('0x5')]='Not\x20Found';util[_0xa190('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4791a0){this['message']=_0x4791a0||_0xa190('0xa');this[_0xa190('0x5')]=_0xa190('0xb');this[_0xa190('0xc')]=0x193;this[_0xa190('0xd')]={'type':'OutOfInterval'};util[_0xa190('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1a26f1){this[_0xa190('0x3')]=_0x1a26f1||_0xa190('0xe');this['name']=_0xa190('0xf');util[_0xa190('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x588080){switch(_0x588080){case _0xa190('0x8'):return 0x190;case _0xa190('0x9'),_0xa190('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x20e39f){if(_0x20e39f==='Out\x20Of\x20Interval')return _0x20e39f;return null;}function handleError(_0x34ccba){return function(_0x42aad2){logger[_0xa190('0x10')](_0x42aad2[_0xa190('0x11')]);var _0x3007fb=getStatusCode(_0x42aad2[_0xa190('0x5')]);var _0x588fcd=getCustomStatusMessage(_0x42aad2[_0xa190('0x5')]);if(_0x42aad2[_0xa190('0x5')]){delete _0x42aad2[_0xa190('0x5')];}if(_0x588fcd){_0x34ccba[_0xa190('0x12')]=_0x588fcd;}return _0x34ccba[_0xa190('0x13')](_0x3007fb)[_0xa190('0x14')](_0x42aad2);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 20c5d9c..40c02cd 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb84e=['status','render','send','404'];(function(_0x442755,_0x176173){var _0xe2d9fe=function(_0x4710be){while(--_0x4710be){_0x442755['push'](_0x442755['shift']());}};_0xe2d9fe(++_0x176173);}(_0xb84e,0xbf));var _0xeb84=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xb84e[_0x5c38cd];return _0xc985ef;};'use strict';module['exports'][0x194]=function pageNotFound(_0xcb78a,_0x6bfa05){var _0x3b2c5c=_0xeb84('0x0');var _0x49570e=0x194;var _0x512746={'status':_0x49570e};_0x6bfa05[_0xeb84('0x1')](_0x512746[_0xeb84('0x1')]);_0x6bfa05[_0xeb84('0x2')](_0x3b2c5c,{},function(_0x3dca87,_0xb17f52){if(_0x3dca87){return _0x6bfa05[_0xeb84('0x1')](_0x512746['status'])['json'](_0x512746);}_0x6bfa05[_0xeb84('0x3')](_0xb17f52);});}; \ No newline at end of file +var _0x85d3=['json','send','exports','404','status','render'];(function(_0x2f2ae3,_0x5b8f7c){var _0x16283b=function(_0x208a63){while(--_0x208a63){_0x2f2ae3['push'](_0x2f2ae3['shift']());}};_0x16283b(++_0x5b8f7c);}(_0x85d3,0xc8));var _0x385d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x85d3[_0x6c993a];return _0x27f547;};'use strict';module[_0x385d('0x0')][0x194]=function pageNotFound(_0x1be5d3,_0x4cb27a){var _0x48de24=_0x385d('0x1');var _0x36a8d8=0x194;var _0x1529db={'status':_0x36a8d8};_0x4cb27a[_0x385d('0x2')](_0x1529db[_0x385d('0x2')]);_0x4cb27a[_0x385d('0x3')](_0x48de24,{},function(_0x57809f,_0x1db5f0){if(_0x57809f){return _0x4cb27a['status'](_0x1529db[_0x385d('0x2')])[_0x385d('0x4')](_0x1529db);}_0x4cb27a[_0x385d('0x5')](_0x1db5f0);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 914d0fd..0986f77 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6059=['../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../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','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','cascade','hasOne','userSetting','UserId','Recordings','hasMany','VoiceQueuesRt','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','WhatsappInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','CmList','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','Hoppers','CmHopperBlack','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Contact','Items','FaxAccountId','Exntensions','FaxMessage','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Members','ChatProactiveAction','CmCompany','CompanyId','Phones','HopperHistories','JscriptySessions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','AutomationAllId','AutomationAnyId','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','Mohs','moh_has_sounds','WhatsappInteraction','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','AnyConditions','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','WhatsappQueues','TeamVoicePrefix','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToAgent','ToQueue','ToAccount','ChatTransferReport','FromUserId','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition'];(function(_0x275472,_0x2c9de8){var _0x1490b8=function(_0x16a9a7){while(--_0x16a9a7){_0x275472['push'](_0x275472['shift']());}};_0x1490b8(++_0x2c9de8);}(_0x6059,0x186));var _0x9605=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x6059[_0x4ec3ab];return _0x229613;};'use strict';var config=require(_0x9605('0x0'));var Sequelize=require(_0x9605('0x1'));var _=require('lodash');var jstz=require(_0x9605('0x2'));var timezone=jstz[_0x9605('0x3')]();config[_0x9605('0x1')]=_[_0x9605('0x4')](config['sequelize'],{'database':_0x9605('0x5'),'username':_0x9605('0x6'),'password':_0x9605('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9605('0x8'),'dialectOptions':{'charset':_0x9605('0x9')},'logging':![],'timezone':timezone[_0x9605('0xa')](),'define':{'charset':'utf8','collate':_0x9605('0xb')}}});config[_0x9605('0xc')]=_[_0x9605('0x4')](config[_0x9605('0xc')],{'database':_0x9605('0x5'),'username':'xcall','password':_0x9605('0x7'),'options':{'host':_0x9605('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9605('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9605('0xe'),'collate':_0x9605('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9605('0x1')][_0x9605('0xf')],config['sequelize'][_0x9605('0x10')],config[_0x9605('0x1')][_0x9605('0x11')],config[_0x9605('0x1')][_0x9605('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9605('0xc')][_0x9605('0xf')],config['sequelizeHistory'][_0x9605('0x10')],config[_0x9605('0xc')][_0x9605('0x11')],config[_0x9605('0xc')]['options'])};db[_0x9605('0x13')]=db[_0x9605('0x1')]['import']('../api/user/user.model');db[_0x9605('0x14')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x16'));db[_0x9605('0x17')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/voiceContext/voiceContext.model');db[_0x9605('0x18')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x19'));db['VoiceMusicOnHold']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1a'));db[_0x9605('0x1b')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/voiceQueue/voiceQueue.model');db[_0x9605('0x1c')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1d'));db['ScreenRecording']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1e'));db[_0x9605('0x1f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x20'));db[_0x9605('0x21')]=db[_0x9605('0x1')]['import'](_0x9605('0x22'));db[_0x9605('0x23')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x24'));db[_0x9605('0x25')]=db[_0x9605('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x9605('0x1')]['import'](_0x9605('0x26'));db[_0x9605('0x27')]=db['sequelize']['import'](_0x9605('0x28'));db[_0x9605('0x29')]=db[_0x9605('0x1')]['import'](_0x9605('0x2a'));db['Trunk']=db['sequelize'][_0x9605('0x15')](_0x9605('0x2b'));db['VoiceTransferReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x2c'));db[_0x9605('0x2d')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x2e'));db[_0x9605('0x2f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x30'));db['UserChatQueue']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x31'));db[_0x9605('0x32')]=db[_0x9605('0x1')]['import'](_0x9605('0x33'));db[_0x9605('0x34')]=db[_0x9605('0x1')]['import'](_0x9605('0x35'));db[_0x9605('0x36')]=db['sequelize']['import'](_0x9605('0x37'));db[_0x9605('0x38')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x9605('0x39')]=db[_0x9605('0x1')]['import'](_0x9605('0x3a'));db['MailServerIn']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x3b'));db[_0x9605('0x3c')]=db['sequelize']['import'](_0x9605('0x3d'));db[_0x9605('0x3e')]=db[_0x9605('0x1')]['import'](_0x9605('0x3f'));db[_0x9605('0x40')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x41'));db[_0x9605('0x42')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9605('0x43')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x9605('0x44')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x45'));db[_0x9605('0x46')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x47'));db[_0x9605('0x48')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x49'));db[_0x9605('0x4a')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x4b'));db[_0x9605('0x4c')]=db[_0x9605('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x9605('0x15')](_0x9605('0x4d'));db[_0x9605('0x4e')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x4f'));db[_0x9605('0x50')]=db[_0x9605('0x1')]['import'](_0x9605('0x51'));db['FaxMessage']=db['sequelize'][_0x9605('0x15')](_0x9605('0x52'));db[_0x9605('0x53')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/faxQueue/faxQueue.model');db[_0x9605('0x54')]=db[_0x9605('0x1')]['import'](_0x9605('0x55'));db[_0x9605('0x56')]=db['sequelize'][_0x9605('0x15')]('../api/smsAccount/smsAccount.model');db[_0x9605('0x57')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x58'));db['SmsInteraction']=db[_0x9605('0x1')]['import'](_0x9605('0x59'));db[_0x9605('0x5a')]=db['sequelize']['import'](_0x9605('0x5b'));db[_0x9605('0x5c')]=db[_0x9605('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x9605('0x5d')]=db['sequelize'][_0x9605('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x9605('0x5e')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x9605('0x5f')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9605('0x60')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize']['import'](_0x9605('0x61'));db[_0x9605('0x62')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x63'));db[_0x9605('0x64')]=db[_0x9605('0x1')]['import'](_0x9605('0x65'));db['ChatApplication']=db[_0x9605('0x1')]['import'](_0x9605('0x66'));db[_0x9605('0x67')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0x9605('0x68')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x69'));db[_0x9605('0x6a')]=db['sequelize']['import'](_0x9605('0x6b'));db[_0x9605('0x6c')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x6d'));db[_0x9605('0x6e')]=db[_0x9605('0x1')]['import'](_0x9605('0x6f'));db['ChatProactiveAction']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x70'));db['CmCompany']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x71'));db[_0x9605('0x72')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x73'));db['CmHopper']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x74'));db['CmHopperBlack']=db[_0x9605('0x1')]['import'](_0x9605('0x75'));db['CmHopperFinal']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x76'));db[_0x9605('0x77')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x78'));db[_0x9605('0x79')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x7a'));db[_0x9605('0x7b')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x7c'));db[_0x9605('0x7d')]=db[_0x9605('0x1')]['import'](_0x9605('0x7e'));db[_0x9605('0x7f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x80'));db['CannedAnswer']=db[_0x9605('0x1')]['import'](_0x9605('0x81'));db[_0x9605('0x82')]=db['sequelize'][_0x9605('0x15')]('../api/disposition/disposition.model');db[_0x9605('0x83')]=db[_0x9605('0x1')]['import'](_0x9605('0x84'));db['Interval']=db['sequelize']['import'](_0x9605('0x85'));db['Pause']=db['sequelize'][_0x9605('0x15')](_0x9605('0x86'));db[_0x9605('0x87')]=db['sequelize'][_0x9605('0x15')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x9605('0x1')]['import'](_0x9605('0x88'));db['Schedule']=db['sequelize'][_0x9605('0x15')](_0x9605('0x89'));db[_0x9605('0x8a')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x8b'));db[_0x9605('0x8c')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x8d'));db[_0x9605('0x8e')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x8f'));db[_0x9605('0x90')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x91'));db[_0x9605('0x92')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x9605('0x93')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x94'));db[_0x9605('0x95')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x96'));db[_0x9605('0x97')]=db[_0x9605('0x1')]['import'](_0x9605('0x98'));db['Integration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x99'));db['IntegrationReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x9a'));db[_0x9605('0x9b')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x9c'));db[_0x9605('0x9d')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x9e'));db['AnalyticExtractedReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x9f'));db[_0x9605('0xa0')]=db[_0x9605('0x1')]['import'](_0x9605('0xa1'));db[_0x9605('0xa2')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa3'));db[_0x9605('0xa4')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa5'));db[_0x9605('0xa6')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa7'));db[_0x9605('0xa8')]=db['sequelize'][_0x9605('0x15')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x9605('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9605('0xa9')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x9605('0xaa')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xab'));db[_0x9605('0xac')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xad'));db['DeskConfiguration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xae'));db[_0x9605('0xaf')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb0'));db[_0x9605('0xb1')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb2'));db['ZohoConfiguration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb3'));db['ZohoField']=db[_0x9605('0x1')]['import'](_0x9605('0xb4'));db[_0x9605('0xb5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb6'));db[_0x9605('0xb7')]=db['sequelize']['import'](_0x9605('0xb8'));db[_0x9605('0xb9')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xba'));db[_0x9605('0xbb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xbc'));db[_0x9605('0xbd')]=db[_0x9605('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9605('0xbe')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xbf'));db[_0x9605('0xc0')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xc1'));db[_0x9605('0xc2')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc3'));db[_0x9605('0xc4')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc5'));db[_0x9605('0xc6')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc7'));db[_0x9605('0xc8')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc9'));db[_0x9605('0xca')]=db[_0x9605('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x9605('0xcb')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x9605('0xcc')]=db['sequelize'][_0x9605('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9605('0xcd')]=db[_0x9605('0x1')]['import'](_0x9605('0xce'));db[_0x9605('0xcf')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xd0'));db[_0x9605('0xd1')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xd2'));db[_0x9605('0xd3')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd4'));db[_0x9605('0xd5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x99'));db['Network']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd6'));db[_0x9605('0xd7')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd8'));db[_0x9605('0xd9')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xda'));db[_0x9605('0xdb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xdc'));db[_0x9605('0xdd')]=db['sequelize'][_0x9605('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x9605('0xde')]=db[_0x9605('0x1')]['import'](_0x9605('0xdf'));db[_0x9605('0xe0')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe1'));db[_0x9605('0xe2')]=db[_0x9605('0x1')]['import'](_0x9605('0xe3'));db[_0x9605('0xe4')]=db[_0x9605('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x9605('0xe5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe6'));db['Setting']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe7'));db[_0x9605('0xe8')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xe9'));db['SquareProject']=db['sequelize'][_0x9605('0x15')]('../api/squareProject/squareProject.model');db[_0x9605('0xea')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xeb'));db[_0x9605('0xec')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/squareMessage/squareMessage.model');db[_0x9605('0xed')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xee'));db[_0x9605('0xef')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/license/license.model');db['Campaign']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf0'));db[_0x9605('0xf1')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xf2'));db[_0x9605('0xf3')]=db['sequelize'][_0x9605('0x15')]('../api/attachment/attachment.model');db[_0x9605('0xf4')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/plugin/plugin.model');db[_0x9605('0xf5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf6'));db['ChatTransferReport']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf7'));db[_0x9605('0xf8')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x9605('0xf9')]=db[_0x9605('0x1')]['import'](_0x9605('0xfa'));db[_0x9605('0xfb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xfc'));db['CmList']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xfd'));db['VoicePrefix']=db[_0x9605('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x9605('0xfe')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xff'));db[_0x9605('0x100')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x101'));db['UserProfileResource']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x102'));db[_0x9605('0x103')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x104'));db['WhatsappAccount']=db['sequelize'][_0x9605('0x15')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x105'));db['WhatsappInteraction']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x106'));db['WhatsappMessage']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x107'));db[_0x9605('0x108')]=db[_0x9605('0x1')]['import'](_0x9605('0x109'));db[_0x9605('0x10a')]=db[_0x9605('0x1')]['import'](_0x9605('0x10b'));db[_0x9605('0x10c')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x10d'));db[_0x9605('0x10e')]=db['sequelize'][_0x9605('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x9605('0x1')][_0x9605('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x9605('0x10f')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x110'));db[_0x9605('0x111')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x112'));db['MailInteractionHasTag']=db['sequelize'][_0x9605('0x15')](_0x9605('0x113'));db[_0x9605('0x13')]['hasOne'](db['VoiceMail'],{'as':_0x9605('0x1f'),'onDelete':_0x9605('0x114'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x115')](db['UserSetting'],{'as':_0x9605('0x116'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x117')});db['User']['hasMany'](db[_0x9605('0x1c')],{'as':_0x9605('0x118'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x2d')],{'as':_0x9605('0x11a'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x18')],{'as':'Extensions','onDelete':_0x9605('0x114'),'hooks':!![]});db['User'][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':'HopperHistory','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':'UserId'});db['User'][_0x9605('0x119')](db[_0x9605('0x5f')],{'as':_0x9605('0x11d'),'foreignKey':_0x9605('0x117')});db['User']['hasMany'](db[_0x9605('0x67')],{'as':_0x9605('0x11e'),'foreignKey':_0x9605('0x117')});db['User'][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':'SmsInteractions','foreignKey':'UserId'});db['User'][_0x9605('0x119')](db[_0x9605('0x50')],{'as':'FaxInteractions','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')]['hasMany'](db[_0x9605('0x43')],{'as':'MailInteractions','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db['WhatsappInteraction'],{'as':_0x9605('0x120'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x13')]['hasMany'](db['UserNotification'],{'as':_0x9605('0x121'),'foreignKey':_0x9605('0x122')});db[_0x9605('0x13')]['hasMany'](db[_0x9605('0x123')],{'as':'Hoppers','foreignKey':_0x9605('0x117'),'onDelete':_0x9605('0x124')});db['User'][_0x9605('0x125')](db[_0x9605('0xfe')],{'as':'UserProfile','foreignKey':_0x9605('0x126')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x6e')],{'as':_0x9605('0x128'),'through':_0x9605('0x129')});db[_0x9605('0x13')][_0x9605('0x127')](db['CmContact'],{'as':_0x9605('0x12a'),'through':'cm_user_has_contacts'});db[_0x9605('0x13')][_0x9605('0x127')](db['CmList'],{'as':_0x9605('0x12b'),'through':_0x9605('0x12c')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x12d')});db[_0x9605('0x13')][_0x9605('0x127')](db['MailInteraction'],{'as':_0x9605('0x12e'),'through':_0x9605('0x12f')});db[_0x9605('0x13')][_0x9605('0x127')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x9605('0x130')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x50')],{'as':_0x9605('0x131'),'through':_0x9605('0x132')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x11f')],{'as':_0x9605('0x133'),'through':_0x9605('0x134')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x9605('0x135')});db[_0x9605('0x13')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x9605('0x120'),'through':_0x9605('0x136')});db['User'][_0x9605('0x127')](db[_0x9605('0x1b')],{'as':_0x9605('0x137'),'through':_0x9605('0x2f'),'required':![]});db['User'][_0x9605('0x127')](db[_0x9605('0x138')],{'as':'VoicePrefixes','through':_0x9605('0x10f'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db['MailQueue'],{'as':_0x9605('0x139'),'through':'UserMailQueue','required':![]});db[_0x9605('0x13')]['belongsToMany'](db[_0x9605('0x6c')],{'as':_0x9605('0x13a'),'through':_0x9605('0x13b'),'required':![],'hooks':!![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x53')],{'as':_0x9605('0x13c'),'through':_0x9605('0x34'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x5c')],{'as':_0x9605('0x13d'),'through':_0x9605('0x36'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x13e')],{'as':_0x9605('0x13f'),'through':_0x9605('0x38'),'required':![]});db['User'][_0x9605('0x127')](db[_0x9605('0x10c')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x140')],{'through':_0x9605('0x12c')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x141')],{'as':_0x9605('0x142'),'through':_0x9605('0x143')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x3e')],{'as':_0x9605('0x144'),'through':_0x9605('0x145')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x5d')],{'as':_0x9605('0x146'),'through':_0x9605('0x147')});db[_0x9605('0x13')][_0x9605('0x127')](db['SmsAccount'],{'as':_0x9605('0x148'),'through':_0x9605('0x149')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x14a')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x9605('0x14')][_0x9605('0x119')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x14b')});db[_0x9605('0x17')][_0x9605('0x119')](db[_0x9605('0x18')],{'onDelete':_0x9605('0x114')});db[_0x9605('0x18')]['hasMany'](db[_0x9605('0x18')],{'as':_0x9605('0x14c'),'onDelete':_0x9605('0x114')});db[_0x9605('0x14d')]['belongsToMany'](db[_0x9605('0x8a')],{'as':_0x9605('0x14e'),'through':'moh_has_sounds'});db[_0x9605('0x1b')][_0x9605('0x119')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x119')](db[_0x9605('0x123')],{'as':_0x9605('0x150'),'foreignKey':'VoiceQueueId'});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x14f')});db['VoiceQueue'][_0x9605('0x119')](db[_0x9605('0x77')],{'as':'HopperHistories','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0x151')],{'as':_0x9605('0x152'),'foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0xde')],{'as':'JscriptySessions','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':'Trunk','foreignKey':_0x9605('0x154')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':_0x9605('0x155'),'foreignKey':_0x9605('0x156')});db[_0x9605('0x1b')]['belongsTo'](db[_0x9605('0x157')],{'as':_0x9605('0x157'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x1b')][_0x9605('0x127')](db[_0x9605('0x140')],{'as':_0x9605('0x12b'),'through':_0x9605('0x15c')});db[_0x9605('0x1b')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x2f')});db[_0x9605('0x1b')]['belongsToMany'](db[_0x9605('0xed')],{'as':_0x9605('0x15d'),'through':_0x9605('0x10e')});db[_0x9605('0x1b')]['belongsToMany'](db[_0x9605('0x140')],{'as':_0x9605('0x15e'),'through':_0x9605('0x15f')});db[_0x9605('0x1c')][_0x9605('0x125')](db['User'],{'as':'User','foreignKey':_0x9605('0x117')});db[_0x9605('0x160')]['belongsTo'](db[_0x9605('0x13')],{'as':_0x9605('0x13'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x1f')][_0x9605('0x119')](db[_0x9605('0x21')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x9605('0x21')][_0x9605('0x125')](db[_0x9605('0x1f')],{'foreignKey':_0x9605('0x162'),'targetKey':_0x9605('0x163')});db[_0x9605('0x23')][_0x9605('0x119')](db[_0x9605('0x27')],{'as':_0x9605('0x164'),'foreignKey':_0x9605('0x165'),'constraints':![]});db['VoiceCallReport'][_0x9605('0x119')](db[_0x9605('0x166')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x9605('0x23')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x13'),'foreignKey':'UserId'});db[_0x9605('0x23')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x167')});db['MailServerIn'][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x3e'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x169')]['belongsTo'](db['CloudProvider'],{'as':_0x9605('0x16a'),'foreignKey':_0x9605('0x16b'),'onDelete':'restrict'});db[_0x9605('0x3c')][_0x9605('0x125')](db['MailAccount'],{'as':_0x9605('0x3e'),'foreignKey':'MailAccountId'});db[_0x9605('0x3c')][_0x9605('0x125')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x9605('0x16b'),'onDelete':_0x9605('0x16c')});db['MailAccount']['hasOne'](db[_0x9605('0x169')],{'as':_0x9605('0x16d'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x115')](db[_0x9605('0x3c')],{'as':_0x9605('0x16e'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')]['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x168'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':'MailAccountId'});db[_0x9605('0x3e')][_0x9605('0x119')](db['MailMessage'],{'as':_0x9605('0x161'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x9605('0x119')](db[_0x9605('0x43')],{'as':_0x9605('0x172')});db[_0x9605('0x3e')][_0x9605('0x119')](db[_0x9605('0x46')],{'as':_0x9605('0x14c'),'foreignKey':_0x9605('0x168'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x3e')][_0x9605('0x125')](db[_0x9605('0x93')],{'as':_0x9605('0x93'),'foreignKey':_0x9605('0x175')});db['MailAccount'][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9605('0x3e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x145')});db[_0x9605('0x40')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':'UserMailQueue'});db[_0x9605('0x40')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x177'),'as':_0x9605('0x15d')});db[_0x9605('0x43')][_0x9605('0x119')](db[_0x9605('0x44')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':_0x9605('0x178')});db[_0x9605('0x43')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':'Account','foreignKey':_0x9605('0x168')});db[_0x9605('0x43')][_0x9605('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x9605('0x167')});db[_0x9605('0x43')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x43')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x17a'),'as':'Tags'});db['MailInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x17a'),'as':_0x9605('0x17b')});db[_0x9605('0x43')]['belongsToMany'](db['User'],{'as':_0x9605('0x17c'),'through':_0x9605('0x12f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x9605('0x119')](db[_0x9605('0xf3')],{'as':_0x9605('0x17d'),'onDelete':_0x9605('0x114')});db[_0x9605('0x44')]['belongsTo'](db[_0x9605('0x13')],{'as':_0x9605('0x13')});db[_0x9605('0x44')][_0x9605('0x125')](db['CmContact'],{'onDelete':_0x9605('0x114'),'as':'Contact'});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x43')],{'as':_0x9605('0x17e'),'foreignKey':'MailInteractionId'});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':'ChatWebsite','foreignKey':_0x9605('0x180')});db['MailMessage']['belongsTo'](db[_0x9605('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x9605('0x181')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x40')],{'onDelete':'restrict'});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x3e')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x46')][_0x9605('0x125')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9605('0x158')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':'restrict','foreignKey':_0x9605('0x182')});db['MailQueueReport'][_0x9605('0x125')](db[_0x9605('0x3e')],{});db['MailQueueReport'][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x48')][_0x9605('0x125')](db['CmContact'],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x48')][_0x9605('0x125')](db['MailInteraction'],{});db[_0x9605('0x48')]['belongsTo'](db[_0x9605('0x44')],{});db[_0x9605('0x48')]['belongsTo'](db[_0x9605('0x13')],{});db[_0x9605('0x48')][_0x9605('0x125')](db['MailQueue'],{});db[_0x9605('0x4a')][_0x9605('0x119')](db[_0x9605('0x4c')],{'as':_0x9605('0x184'),'onDelete':_0x9605('0x114')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x185')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x50')],{'as':_0x9605('0x172')});db['FaxAccount']['hasMany'](db[_0x9605('0x4e')],{'as':'Applications','foreignKey':_0x9605('0x185'),'onDelete':_0x9605('0x114')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x18')],{'as':_0x9605('0x186'),'onDelete':'cascade'});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x187')],{'as':'Messages'});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':_0x9605('0x153')});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':'ListId'});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x141')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x143')});db['FaxApplication']['belongsTo'](db[_0x9605('0x13')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x53')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x141')],{'onDelete':'restrict'});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x50')][_0x9605('0x119')](db[_0x9605('0x187')],{'as':'Messages','onDelete':_0x9605('0x114'),'foreignKey':'FaxInteractionId'});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x141')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x185')});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db['FaxInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x188'),'as':_0x9605('0x189')});db['FaxInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x188'),'as':_0x9605('0x17b')});db[_0x9605('0x50')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x132'),'foreignKey':_0x9605('0x18a')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x13')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x50')],{'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x18a')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0xf3')],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x141')],{'as':'Account','foreignKey':_0x9605('0x185')});db[_0x9605('0x53')][_0x9605('0x127')](db['User'],{'as':'Agents','through':_0x9605('0x34')});db['FaxQueue'][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x18c'),'as':_0x9605('0x15d')});db['FaxQueueReport'][_0x9605('0x125')](db['FaxAccount'],{});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':'List','foreignKey':_0x9605('0x174')});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x50')],{});db[_0x9605('0x54')]['belongsTo'](db[_0x9605('0x187')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x9605('0x125')](db['FaxQueue'],{});db[_0x9605('0x56')][_0x9605('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9605('0x18d'),'onDelete':_0x9605('0x114')});db['SmsAccount'][_0x9605('0x119')](db['CannedAnswer'],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x18d')});db[_0x9605('0x56')][_0x9605('0x119')](db[_0x9605('0x5a')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x9605('0x56')][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':'Interactions'});db[_0x9605('0x56')]['hasMany'](db[_0x9605('0x57')],{'as':_0x9605('0x14c'),'foreignKey':'SmsAccountId','onDelete':_0x9605('0x114')});db[_0x9605('0x56')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x56')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9605('0x56')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x149')});db[_0x9605('0x57')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db[_0x9605('0x57')][_0x9605('0x125')](db['SmsQueue'],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x57')][_0x9605('0x125')](db['SmsAccount'],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x57')][_0x9605('0x125')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9605('0x158')});db[_0x9605('0x57')]['belongsTo'](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x11f')]['hasMany'](db[_0x9605('0x5a')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x56')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x18d')});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x11f')]['belongsToMany'](db[_0x9605('0x8c')],{'through':_0x9605('0x18e'),'as':_0x9605('0x189')});db[_0x9605('0x11f')]['belongsToMany'](db['Tag'],{'through':_0x9605('0x18e'),'as':_0x9605('0x17b')});db[_0x9605('0x11f')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x134'),'foreignKey':'SmsInteractionId'});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':'User'});db['SmsMessage'][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183')});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x11f')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x18f')});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x56')],{'as':'Account','foreignKey':_0x9605('0x18d')});db['SmsQueue'][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x36'),'foreignKey':_0x9605('0x190')});db[_0x9605('0x5c')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x191'),'as':'Teams'});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x192'),'onDelete':'cascade'});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x192')});db['OpenchannelAccount']['hasMany'](db[_0x9605('0x5f')],{'as':_0x9605('0x172'),'foreignKey':_0x9605('0x192')});db[_0x9605('0x5d')][_0x9605('0x119')](db['OpenchannelMessage'],{'as':_0x9605('0x161'),'foreignKey':_0x9605('0x192')});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x5e')],{'as':_0x9605('0x14c'),'foreignKey':_0x9605('0x192'),'onDelete':_0x9605('0x114')});db[_0x9605('0x5d')][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':'ListId'});db[_0x9605('0x5d')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9605('0x15b')});db[_0x9605('0x5d')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x147')});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db[_0x9605('0x5e')]['belongsTo'](db[_0x9605('0x13e')],{'onDelete':'restrict','foreignKey':_0x9605('0x193')});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x5d')],{'onDelete':'restrict','foreignKey':_0x9605('0x192')});db['OpenchannelApplication'][_0x9605('0x125')](db[_0x9605('0x157')],{'onDelete':_0x9605('0x16c'),'foreignKey':'IntervalId'});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db['OpenchannelInteraction'][_0x9605('0x119')](db['OpenchannelMessage'],{'as':_0x9605('0x161'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x194')});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x5d')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x192')});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x5f')][_0x9605('0x127')](db['Tag'],{'through':_0x9605('0x195'),'as':_0x9605('0x189')});db['OpenchannelInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x195'),'as':_0x9605('0x17b')});db['OpenchannelInteraction'][_0x9605('0x127')](db['User'],{'as':_0x9605('0x17c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x13')});db['OpenchannelMessage']['belongsTo'](db[_0x9605('0x72')],{'onDelete':'cascade','as':_0x9605('0x183')});db[_0x9605('0x60')]['belongsTo'](db[_0x9605('0x5f')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x194')});db['OpenchannelMessage'][_0x9605('0x125')](db['Attachment'],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x60')]['belongsTo'](db[_0x9605('0x5d')],{'as':'Account','foreignKey':_0x9605('0x192')});db[_0x9605('0x13e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x38'),'foreignKey':_0x9605('0x193')});db['OpenchannelQueue'][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x196'),'as':'Teams'});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':'ChatWebsiteId','onDelete':_0x9605('0x114')});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x9605('0x197')});db[_0x9605('0x62')]['hasMany'](db['ChatInteraction'],{'as':_0x9605('0x172')});db['ChatWebsite'][_0x9605('0x119')](db['ChatApplication'],{'as':_0x9605('0x14c'),'foreignKey':'ChatWebsiteId','onDelete':_0x9605('0x114')});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x68')],{'as':_0x9605('0x161')});db['ChatWebsite']['belongsTo'](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x62')][_0x9605('0x125')](db[_0x9605('0x157')],{'as':'Interval','foreignKey':_0x9605('0x158')});db[_0x9605('0x62')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x3e'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x62')][_0x9605('0x125')](db['Pause'],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x62')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x198')});db[_0x9605('0x64')][_0x9605('0x125')](db[_0x9605('0x5d')],{});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db[_0x9605('0x64')][_0x9605('0x125')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x60')],{});db[_0x9605('0x64')]['belongsTo'](db[_0x9605('0x13')],{});db[_0x9605('0x64')][_0x9605('0x125')](db['OpenchannelQueue'],{});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x19a'),'foreignKey':_0x9605('0x117'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x199')]['belongsTo'](db[_0x9605('0x6c')],{'as':_0x9605('0x19b'),'foreignKey':_0x9605('0x19c'),'onDelete':'restrict'});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x19d'),'foreignKey':_0x9605('0x180'),'onDelete':'restrict'});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db['ChatInteraction'][_0x9605('0x119')](db[_0x9605('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9605('0x19e')});db['ChatInteraction'][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x67')]['belongsTo'](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x67')][_0x9605('0x127')](db['Tag'],{'through':_0x9605('0x19f'),'as':_0x9605('0x189')});db[_0x9605('0x67')]['belongsToMany'](db['Tag'],{'through':_0x9605('0x19f'),'as':_0x9605('0x17b')});db[_0x9605('0x67')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x130'),'foreignKey':_0x9605('0x19e')});db[_0x9605('0x68')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':'User'});db[_0x9605('0x68')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':'Contact','foreignKey':_0x9605('0x167')});db['ChatMessage']['belongsTo'](db[_0x9605('0x67')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x19e')});db['ChatMessage'][_0x9605('0x125')](db[_0x9605('0xf3')],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x68')]['belongsTo'](db[_0x9605('0x62')],{'as':'Account','foreignKey':_0x9605('0x180')});db[_0x9605('0x6a')][_0x9605('0x119')](db[_0x9605('0xf3')],{'as':_0x9605('0x17d'),'foreignKey':_0x9605('0x181'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x6a')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x6a')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x6c')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':'UserChatQueue','hooks':!![]});db[_0x9605('0x6c')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x9605('0x6e')][_0x9605('0x119')](db[_0x9605('0xd9')],{'as':_0x9605('0x161'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x9605('0x6e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x1a0'),'through':_0x9605('0x129')});db[_0x9605('0x1a1')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x19d'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x1a2')][_0x9605('0x119')](db[_0x9605('0x72')],{'as':_0x9605('0x12a'),'foreignKey':_0x9605('0x1a3')});db[_0x9605('0x72')]['hasMany'](db[_0x9605('0x90')],{'as':_0x9605('0x1a4'),'foreignKey':'CmContactId'});db[_0x9605('0x72')]['hasMany'](db[_0x9605('0x123')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x9605('0x72')][_0x9605('0x119')](db['CmHopperFinal'],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':_0x9605('0x1a5'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x79')],{'as':'ReportAgentPreview','foreignKey':_0x9605('0x167')});db['CmContact'][_0x9605('0x119')](db[_0x9605('0xde')],{'as':_0x9605('0x1a6'),'foreignKey':'ContactId'});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x5f')],{'as':_0x9605('0x11d'),'foreignKey':'ContactId','onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x67')],{'as':'ChatInteractions','foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':_0x9605('0x133'),'foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x50')],{'as':_0x9605('0x131'),'foreignKey':'ContactId','onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x43')],{'as':'MailInteractions','foreignKey':_0x9605('0x167'),'onDelete':'restrict'});db[_0x9605('0x72')][_0x9605('0x125')](db[_0x9605('0x1a2')],{'as':_0x9605('0x1a7'),'foreignKey':'CompanyId'});db[_0x9605('0x72')][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':'ListId','onDelete':_0x9605('0x114')});db[_0x9605('0x72')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':'cm_user_has_contacts'});db[_0x9605('0x72')][_0x9605('0x127')](db['Tag'],{'as':_0x9605('0x189'),'through':_0x9605('0x1a8')});db['CmContact'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1a8'),'as':_0x9605('0x17b')});db[_0x9605('0x123')][_0x9605('0x119')](db['CmHopperAdditionalPhone'],{'as':_0x9605('0x1a9'),'foreignKey':_0x9605('0x1aa')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167'),'onDelete':'cascade'});db['CmHopper'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174'),'onDelete':'cascade'});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x19a'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x9605('0x114')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x1ab')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x9605('0x114')});db[_0x9605('0x123')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x9605('0x1ac')});db['CmHopperBlack'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')]['belongsTo'](db[_0x9605('0x1b')],{'as':_0x9605('0x19b'),'foreignKey':_0x9605('0x14f'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')][_0x9605('0x125')](db['Campaign'],{'as':_0x9605('0x1ab'),'foreignKey':_0x9605('0x1ad'),'onDelete':_0x9605('0x114')});db[_0x9605('0x7f')][_0x9605('0x119')](db['Condition'],{'as':{'plural':_0x9605('0x1ae'),'singular':'OneAll'},'foreignKey':_0x9605('0x1af'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x7f')]['hasMany'](db[_0x9605('0x83')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x9605('0x1b0'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x7f')]['hasMany'](db[_0x9605('0x7d')],{'as':'Actions','foreignKey':_0x9605('0x1b1'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x82')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x1b2'),'onDelete':'cascade'});db['Interval'][_0x9605('0x119')](db['Interval'],{'as':_0x9605('0x1b3'),'foreignKey':_0x9605('0x158'),'onDelete':_0x9605('0x114'),'hooks':!![],'required':![]});db['Interval'][_0x9605('0x119')](db[_0x9605('0x18')],{'as':_0x9605('0x1b4'),'foreignKey':_0x9605('0x158'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x157')]['hasMany'](db[_0x9605('0x46')],{'as':_0x9605('0x1b5'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x157')][_0x9605('0x119')](db[_0x9605('0x199')],{'as':_0x9605('0x1b6'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x157')]['hasMany'](db['FaxApplication'],{'as':_0x9605('0x1b7'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x9605('0x57')],{'as':_0x9605('0x1b8'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1b9')][_0x9605('0x125')](db['MailAccount'],{});db[_0x9605('0x1b9')][_0x9605('0x125')](db[_0x9605('0x9d')],{'foreignKey':_0x9605('0x1ba')});db[_0x9605('0x1b9')][_0x9605('0x125')](db[_0x9605('0x9b')],{'foreignKey':'CustomReportId'});db[_0x9605('0x8a')][_0x9605('0x127')](db['VoiceMusicOnHold'],{'as':_0x9605('0x1bb'),'through':_0x9605('0x1bc'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x72')],{'through':_0x9605('0x1a8')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x67')],{'through':_0x9605('0x19f')});db[_0x9605('0x8c')]['belongsToMany'](db[_0x9605('0x43')],{'through':'mail_interaction_has_tags'});db[_0x9605('0x8c')]['belongsToMany'](db['SmsInteraction'],{'through':_0x9605('0x18e')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x50')],{'through':_0x9605('0x188')});db[_0x9605('0x8c')]['belongsToMany'](db[_0x9605('0x5f')],{'through':_0x9605('0x195')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x1bd')],{'through':_0x9605('0x1be')});db[_0x9605('0x90')][_0x9605('0x125')](db[_0x9605('0x8e')],{'as':_0x9605('0x1bf'),'foreignKey':_0x9605('0x1c0')});db[_0x9605('0x92')]['belongsTo'](db[_0x9605('0x123')],{'as':_0x9605('0x1c1'),'foreignKey':_0x9605('0x1aa')});db[_0x9605('0x90')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x1c2')});db[_0x9605('0x95')]['hasMany'](db[_0x9605('0x83')],{'as':{'plural':_0x9605('0x1c3'),'singular':_0x9605('0x1c4')},'foreignKey':'TriggerAllId','onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x95')][_0x9605('0x119')](db[_0x9605('0x83')],{'as':{'plural':_0x9605('0x1c5'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x9605('0x114'),'hooks':!![]});db['Trigger'][_0x9605('0x119')](db[_0x9605('0x7d')],{'as':_0x9605('0x1c6'),'foreignKey':_0x9605('0x1c7'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x9b')][_0x9605('0x119')](db['AnalyticFieldReport'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x9605('0x9d')][_0x9605('0x119')](db[_0x9605('0xa2')],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1ba')});db[_0x9605('0xa0')][_0x9605('0x119')](db[_0x9605('0xa2')],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1c9')});db[_0x9605('0xa2')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x9605('0x1c9')});db[_0x9605('0xa4')][_0x9605('0x119')](db[_0x9605('0xa6')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xa6')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa6')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':_0x9605('0x1cf')});db['SalesforceConfiguration'][_0x9605('0x119')](db['SalesforceField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xa6')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x9605('0x1cb')});db['SalesforceField'][_0x9605('0x119')](db['SalesforceField'],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xa8')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xa8')]['belongsTo'](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['SugarcrmAccount'][_0x9605('0x119')](db['SugarcrmConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xa9')][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa9')][_0x9605('0x119')](db['SugarcrmField'],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':'Fields','onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x9605('0x125')](db[_0x9605('0x1d5')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db['SugarcrmField'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db['SugarcrmField'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1d2'),'foreignKey':'DescriptionId'});db[_0x9605('0xaa')][_0x9605('0x119')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db[_0x9605('0xac')][_0x9605('0x119')](db['DeskConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0x1d6')][_0x9605('0x119')](db[_0x9605('0xaf')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':'SubjectId'});db[_0x9605('0x1d6')][_0x9605('0x119')](db[_0x9605('0xaf')],{'as':_0x9605('0x1ce'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0x1d6')]['hasMany'](db['DeskField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x9605('0x125')](db[_0x9605('0xac')],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db[_0x9605('0x1d6')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1d7')});db[_0x9605('0xaf')][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xaf')][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d2'),'foreignKey':'DescriptionId'});db['DeskField'][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xaf')][_0x9605('0x125')](db['Variable'],{'as':_0x9605('0x97'),'foreignKey':'VariableId'});db[_0x9605('0xb1')][_0x9605('0x119')](db['ZohoConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db['ZohoConfiguration'][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0x1d9')][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x9605('0x119')](db['ZohoField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0x9605('0xb1')],{'as':'Account','foreignKey':_0x9605('0x1cb')});db['ZohoField'][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':'Subject','foreignKey':_0x9605('0x1cd')});db[_0x9605('0x1d8')]['hasMany'](db[_0x9605('0x1d8')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0x1d8')]['hasMany'](db[_0x9605('0x1d8')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0x1d8')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db[_0x9605('0xb5')][_0x9605('0x119')](db[_0x9605('0xb7')],{'as':'Configurations','onDelete':_0x9605('0x114'),'foreignKey':'AccountId'});db[_0x9605('0xb7')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xb7')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xb7')]['hasMany'](db['ZendeskField'],{'as':_0x9605('0x1c8'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xb7')][_0x9605('0x125')](db[_0x9605('0xb5')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xb7')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1da')});db['ZendeskField'][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xb9')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db[_0x9605('0xb9')][_0x9605('0x119')](db['ZendeskField'],{'as':'Field','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xb9')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db['FreshdeskAccount'][_0x9605('0x119')](db[_0x9605('0xbd')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db['FreshdeskConfiguration'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db['FreshdeskConfiguration'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':'Descriptions','onDelete':_0x9605('0x114'),'foreignKey':'DescriptionId'});db[_0x9605('0xbd')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xbd')][_0x9605('0x125')](db[_0x9605('0xbb')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x9605('0x1db')});db['FreshdeskField'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xbe')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xbe')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xbe')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':'VariableId'});db[_0x9605('0xc0')][_0x9605('0x119')](db[_0x9605('0xc2')],{'as':_0x9605('0x1ca'),'onDelete':'cascade','foreignKey':_0x9605('0x1cb')});db[_0x9605('0xc2')][_0x9605('0x119')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x9605('0xc2')][_0x9605('0x119')](db['VtigerField'],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xc2')][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':_0x9605('0x1c8'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xc2')][_0x9605('0x125')](db[_0x9605('0xc0')],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db['VtigerField'][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':_0x9605('0x1d1'),'foreignKey':'SubjectId'});db[_0x9605('0xc4')]['hasMany'](db[_0x9605('0xc4')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xc4')][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':'Field','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xc4')]['belongsTo'](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db['ServicenowAccount']['hasMany'](db[_0x9605('0xc8')],{'as':_0x9605('0x1ca'),'onDelete':'cascade','foreignKey':_0x9605('0x1cb')});db['ServicenowConfiguration'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xc8')][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db['ServicenowConfiguration'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x9605('0x125')](db['ServicenowAccount'],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db['ServicenowField'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xca')]['hasMany'](db[_0x9605('0xca')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db[_0x9605('0xca')][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xca')]['belongsTo'](db['Variable'],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['Dynamics365Account'][_0x9605('0x119')](db[_0x9605('0xcc')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':'AccountId'});db['Dynamics365Account']['belongsTo'](db[_0x9605('0x16a')],{'as':_0x9605('0x16a'),'foreignKey':'CloudProviderId'});db[_0x9605('0xcc')][_0x9605('0x119')](db[_0x9605('0xcd')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db['Dynamics365Configuration']['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1ce'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xcc')][_0x9605('0x119')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xcc')][_0x9605('0x125')](db[_0x9605('0xcb')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xcd')]['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1d1'),'foreignKey':'SubjectId'});db[_0x9605('0xcd')]['hasMany'](db[_0x9605('0xcd')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db['Dynamics365Field']['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db['Dynamics365Field'][_0x9605('0x125')](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db[_0x9605('0xcf')][_0x9605('0x119')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xd1')][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xd1')]['hasMany'](db[_0x9605('0xd3')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db['FreshsalesConfiguration'][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1c8'),'foreignKey':'FieldId'});db[_0x9605('0xd1')][_0x9605('0x125')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x9605('0x1cb')});db[_0x9605('0xd3')][_0x9605('0x119')](db[_0x9605('0xd3')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xd3')][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db['FreshsalesField'][_0x9605('0x119')](db[_0x9605('0xd3')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xd3')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['ChatQueueReport'][_0x9605('0x125')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x67')],{});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x68')],{});db[_0x9605('0xd7')][_0x9605('0x125')](db['User'],{});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x6c')],{});db[_0x9605('0xd9')][_0x9605('0x125')](db['User'],{'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1dc')});db[_0x9605('0xd9')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'cascade','foreignKey':_0x9605('0x1dd')});db['JscriptySessionReport'][_0x9605('0x119')](db[_0x9605('0xdd')],{'foreignKey':_0x9605('0x1de'),'onDelete':_0x9605('0x114')});db[_0x9605('0xde')][_0x9605('0x119')](db[_0x9605('0xdb')],{'foreignKey':_0x9605('0x1de'),'onDelete':_0x9605('0x114')});db[_0x9605('0xe0')]['belongsTo'](db['SmsAccount'],{});db[_0x9605('0xe0')]['belongsTo'](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0xe0')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0xe0')]['belongsTo'](db[_0x9605('0x11f')],{});db[_0x9605('0xe0')][_0x9605('0x125')](db[_0x9605('0x5a')],{});db[_0x9605('0xe0')][_0x9605('0x125')](db['User'],{});db[_0x9605('0xe0')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0x9605('0x119')](db[_0x9605('0xde')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x9605('0x119')](db[_0x9605('0xdd')],{'foreignKey':_0x9605('0x1df')});db[_0x9605('0xe5')][_0x9605('0x119')](db[_0x9605('0xdb')],{'foreignKey':_0x9605('0x1df')});db[_0x9605('0xed')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':_0x9605('0x12d')});db['Team'][_0x9605('0x127')](db[_0x9605('0x1b')],{'through':_0x9605('0x10e'),'as':_0x9605('0x137')});db[_0x9605('0xed')][_0x9605('0x127')](db[_0x9605('0x40')],{'through':_0x9605('0x177'),'as':_0x9605('0x139')});db[_0x9605('0xed')]['belongsToMany'](db[_0x9605('0x6c')],{'through':_0x9605('0x1e0'),'as':_0x9605('0x13a')});db[_0x9605('0xed')][_0x9605('0x127')](db[_0x9605('0x53')],{'through':'team_has_fax_queues','as':_0x9605('0x13c')});db[_0x9605('0xed')][_0x9605('0x127')](db['SmsQueue'],{'through':_0x9605('0x191'),'as':'SmsQueues'});db[_0x9605('0xed')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x9605('0x196'),'as':_0x9605('0x13f')});db['Team'][_0x9605('0x127')](db[_0x9605('0x10c')],{'through':'team_has_whatsapp_queues','as':_0x9605('0x1e1')});db[_0x9605('0xed')]['belongsToMany'](db['VoicePrefix'],{'through':_0x9605('0x1e2'),'as':'VoicePrefixes'});db[_0x9605('0x1ab')][_0x9605('0x119')](db[_0x9605('0x123')],{'as':_0x9605('0x150'),'foreignKey':'CampaignId'});db['Campaign'][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x1ad')});db['Campaign'][_0x9605('0x119')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x9605('0x1ad')});db[_0x9605('0x1ab')][_0x9605('0x119')](db[_0x9605('0x151')],{'as':_0x9605('0x152'),'foreignKey':_0x9605('0x1ad')});db[_0x9605('0x1ab')]['belongsTo'](db[_0x9605('0x153')],{'as':'Trunk','foreignKey':_0x9605('0x154')});db['Campaign']['belongsTo'](db[_0x9605('0x153')],{'as':_0x9605('0x155'),'foreignKey':_0x9605('0x156')});db[_0x9605('0x1ab')][_0x9605('0x125')](db[_0x9605('0x157')],{'as':_0x9605('0x157'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1ab')][_0x9605('0x125')](db[_0x9605('0x1e3')],{'as':_0x9605('0x1e3'),'foreignKey':_0x9605('0x1e4')});db[_0x9605('0x1ab')]['belongsToMany'](db['CmList'],{'as':_0x9605('0x12b'),'through':_0x9605('0x1e5')});db[_0x9605('0x1ab')][_0x9605('0x127')](db[_0x9605('0x140')],{'as':'BlackLists','through':_0x9605('0x1e6')});db['Attachment'][_0x9605('0x125')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x9605('0x181')});db[_0x9605('0xf5')]['belongsTo'](db[_0x9605('0x44')],{});db['MailTransferReport'][_0x9605('0x125')](db['MailInteraction'],{});db[_0x9605('0xf5')][_0x9605('0x125')](db[_0x9605('0x3e')],{'foreignKey':_0x9605('0x1e7'),'as':_0x9605('0x1e8')});db[_0x9605('0xf5')][_0x9605('0x125')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9605('0xf5')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':'ToUserId','as':_0x9605('0x1e9')});db[_0x9605('0xf5')]['belongsTo'](db[_0x9605('0x40')],{'foreignKey':'ToMailQueueId','as':_0x9605('0x1ea')});db[_0x9605('0xf5')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x9605('0x1eb')});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x68')],{});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x67')],{});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x62')],{'foreignKey':'FromChatWebsiteId','as':_0x9605('0x1e8')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x6c')],{'foreignKey':_0x9605('0x1f0'),'as':_0x9605('0x1ea')});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x62')],{'foreignKey':_0x9605('0x1f1'),'as':_0x9605('0x1eb')});db[_0x9605('0xf8')][_0x9605('0x125')](db['FaxMessage'],{});db['FaxTransferReport'][_0x9605('0x125')](db[_0x9605('0x50')],{});db[_0x9605('0xf8')]['belongsTo'](db[_0x9605('0x141')],{'foreignKey':_0x9605('0x1f2'),'as':_0x9605('0x1e8')});db[_0x9605('0xf8')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db['FaxTransferReport']['belongsTo'](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db['FaxTransferReport'][_0x9605('0x125')](db[_0x9605('0x53')],{'foreignKey':_0x9605('0x1f3'),'as':_0x9605('0x1ea')});db[_0x9605('0xf8')][_0x9605('0x125')](db[_0x9605('0x141')],{'foreignKey':_0x9605('0x1f4'),'as':_0x9605('0x1eb')});db[_0x9605('0xf9')][_0x9605('0x125')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x9605('0x125')](db[_0x9605('0x5f')],{});db['OpenchannelTransferReport'][_0x9605('0x125')](db['OpenchannelAccount'],{'foreignKey':_0x9605('0x1f5'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x9605('0x125')](db['User'],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db[_0x9605('0xf9')][_0x9605('0x125')](db['User'],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9605('0x13e')],{'foreignKey':_0x9605('0x1f6'),'as':'ToQueue'});db[_0x9605('0xf9')][_0x9605('0x125')](db[_0x9605('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9605('0x1eb')});db[_0x9605('0xfb')]['belongsTo'](db[_0x9605('0x5a')],{});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x11f')],{});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x56')],{'foreignKey':_0x9605('0x1f7'),'as':_0x9605('0x1e8')});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':'FromUserId','as':_0x9605('0x1ee')});db['SmsTransferReport'][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':'ToAgent'});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x5c')],{'foreignKey':_0x9605('0x1f8'),'as':_0x9605('0x1ea')});db[_0x9605('0xfb')]['belongsTo'](db[_0x9605('0x56')],{'foreignKey':_0x9605('0x1f9'),'as':_0x9605('0x1eb')});db[_0x9605('0x140')]['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x174'),'onDelete':'cascade'});db['CmList'][_0x9605('0x119')](db[_0x9605('0x7b')],{'as':_0x9605('0x1fa'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x72')],{'as':_0x9605('0x12a'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':_0x9605('0x1fb'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x140')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':_0x9605('0x174')});db['CmList'][_0x9605('0x127')](db[_0x9605('0x1b')],{'as':_0x9605('0x1fc'),'through':_0x9605('0x15c')});db[_0x9605('0x140')]['belongsToMany'](db['User'],{'as':_0x9605('0x176'),'through':'cm_user_has_lists'});db[_0x9605('0x138')]['hasMany'](db[_0x9605('0x18')],{'as':'Extensions','onDelete':_0x9605('0x114')});db['VoicePrefix'][_0x9605('0x127')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0x9605('0x138')][_0x9605('0x127')](db['Team'],{'through':_0x9605('0x1e2'),'as':_0x9605('0x15d')});db[_0x9605('0xfe')]['hasMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'foreignKey':_0x9605('0x126')});db[_0x9605('0xfe')][_0x9605('0x119')](db[_0x9605('0x100')],{'as':_0x9605('0x1fd'),'foreignKey':_0x9605('0x126'),'onDelete':'cascade'});db['UserProfileSection'][_0x9605('0x119')](db[_0x9605('0x1fe')],{'as':_0x9605('0x1ff'),'foreignKey':_0x9605('0x200'),'onDelete':_0x9605('0x114')});db['WhatsappAccount']['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x201'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x201')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x202')],{'as':_0x9605('0x161'),'foreignKey':_0x9605('0x201')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x1bd')],{'as':_0x9605('0x172')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x203')],{'as':_0x9605('0x14c'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x9605('0x14a')]['belongsTo'](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x14a')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':'mandatoryDispositionPause','foreignKey':_0x9605('0x15b')});db[_0x9605('0x14a')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':'user_has_whatsapp_accounts'});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9605('0x125')](db[_0x9605('0x10c')],{'onDelete':'restrict'});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x14a')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x157')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x1bd')][_0x9605('0x119')](db['WhatsappMessage'],{'as':_0x9605('0x161'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x204')});db[_0x9605('0x1bd')]['belongsTo'](db[_0x9605('0x14a')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x9605('0x1bd')][_0x9605('0x125')](db['CmContact'],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x1bd')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x9605('0x189')});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1be'),'as':_0x9605('0x17b')});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x136'),'foreignKey':_0x9605('0x204')});db[_0x9605('0x202')]['belongsTo'](db['User'],{'as':_0x9605('0x13')});db[_0x9605('0x202')]['belongsTo'](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':'Contact'});db[_0x9605('0x202')]['belongsTo'](db[_0x9605('0x1bd')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':'WhatsappInteractionId'});db[_0x9605('0x202')][_0x9605('0x125')](db[_0x9605('0x14a')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x201')});db['WhatsappQueueReport'][_0x9605('0x125')](db[_0x9605('0x14a')],{});db['WhatsappQueueReport'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':'List','foreignKey':'ListId'});db[_0x9605('0x108')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x167')});db[_0x9605('0x108')]['belongsTo'](db[_0x9605('0x1bd')],{});db[_0x9605('0x108')][_0x9605('0x125')](db[_0x9605('0x10c')],{});db[_0x9605('0x108')]['belongsTo'](db[_0x9605('0x202')],{});db['WhatsappQueueReport'][_0x9605('0x125')](db['User'],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x202')],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x1bd')],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x14a')],{'foreignKey':_0x9605('0x205'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x9605('0x125')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x9605('0x1eb')});db[_0x9605('0x10a')]['belongsTo'](db[_0x9605('0x10c')],{'foreignKey':_0x9605('0x206'),'as':'ToQueue'});db[_0x9605('0x10a')]['belongsTo'](db[_0x9605('0x13')],{'foreignKey':'FromUserId','as':_0x9605('0x1ee')});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db[_0x9605('0x10c')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x39'),'foreignKey':_0x9605('0x207')});db[_0x9605('0x10c')]['belongsToMany'](db[_0x9605('0xed')],{'through':_0x9605('0x208'),'as':_0x9605('0x15d')});db[_0x9605('0x111')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x209'),'foreignKey':'UserId','onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x16a')][_0x9605('0x115')](db['Dynamics365Account'],{'as':_0x9605('0xcb'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x16a')][_0x9605('0x115')](db[_0x9605('0x169')],{'as':'Imap','onDelete':_0x9605('0x16c')});db[_0x9605('0x16a')]['hasOne'](db[_0x9605('0x3c')],{'as':_0x9605('0x16e'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe206=['../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','../api/team/team.model','License','../api/campaign/campaign.model','Migration','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','userSetting','UserId','hasMany','VoiceRecording','Recordings','Extensions','HopperFinals','HopperHistory','ChatInteractions','SmsInteraction','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','CmHopper','Hoppers','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','CannedAnswer','Answers','Interactions','MailApplication','List','ListId','TemplateId','Account','Owner','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','MailInteractionId','Attachment','Interaction','ChatWebsiteId','ChatOfflineMessage','TagId','Items','Dispositions','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','Tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatApplication','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','Phones','CmContactId','SmsInteractions','FaxInteractions','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Queue','CampaignId','OwnerId','Campaign','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','Mohs','moh_has_sounds','sms_interaction_has_tags','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Fields','CustomReportId','AnalyticFieldReport','MetricId','SalesforceConfiguration','Configurations','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','AccountId','Subject','DeskField','ZohoField','VariableId','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowField','Dynamics365Configuration','ChatQueueReport','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_mail_queues','MailQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','VoicePrefixes','HopperHistories','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','UserWhatsappQueue','WhatsappQueueId','UserSetting','user','exports','sequelize','lodash','defaultsDeep','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','motion2','mysql','utf8mb4','database','username','options','sequelizeHistory','password','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue'];(function(_0x5a011c,_0x4f2f60){var _0x453370=function(_0x509bf7){while(--_0x509bf7){_0x5a011c['push'](_0x5a011c['shift']());}};_0x453370(++_0x4f2f60);}(_0xe206,0x1e4));var _0x6e20=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xe206[_0x50007c];return _0x5c1ec7;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x6e20('0x0'));var _=require(_0x6e20('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x6e20('0x0')]=_[_0x6e20('0x2')](config[_0x6e20('0x0')],{'database':'motion2','username':_0x6e20('0x3'),'password':_0x6e20('0x4'),'options':{'host':_0x6e20('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6e20('0x6')](),'define':{'charset':_0x6e20('0x7'),'collate':_0x6e20('0x8')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x6e20('0x9'),'username':_0x6e20('0x3'),'password':_0x6e20('0x4'),'options':{'host':_0x6e20('0x5'),'port':0xcea,'dialect':_0x6e20('0xa'),'dialectOptions':{'charset':_0x6e20('0xb')},'logging':![],'timezone':timezone[_0x6e20('0x6')](),'define':{'charset':_0x6e20('0x7'),'collate':_0x6e20('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6e20('0x0')][_0x6e20('0xc')],config[_0x6e20('0x0')][_0x6e20('0xd')],config[_0x6e20('0x0')]['password'],config['sequelize'][_0x6e20('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6e20('0xf')][_0x6e20('0xc')],config[_0x6e20('0xf')][_0x6e20('0xd')],config[_0x6e20('0xf')][_0x6e20('0x10')],config[_0x6e20('0xf')][_0x6e20('0xe')])};db['User']=db[_0x6e20('0x0')]['import'](_0x6e20('0x11'));db[_0x6e20('0x12')]=db['sequelize'][_0x6e20('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x6e20('0x14')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x15'));db[_0x6e20('0x16')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x17'));db[_0x6e20('0x18')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x19'));db[_0x6e20('0x1a')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x1b'));db['VoiceRecording']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x1c'));db[_0x6e20('0x1d')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x1e'));db[_0x6e20('0x1f')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x20'));db[_0x6e20('0x21')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x6e20('0x22')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x23'));db['VoiceAgentReport']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x24'));db[_0x6e20('0x25')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x6e20('0x26')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x27'));db[_0x6e20('0x28')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/trunk/trunk.model');db[_0x6e20('0x29')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6e20('0x2a')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x2b'));db[_0x6e20('0x2c')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x2d'));db[_0x6e20('0x2e')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x2f'));db[_0x6e20('0x30')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x31'));db[_0x6e20('0x32')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x33'));db[_0x6e20('0x34')]=db[_0x6e20('0x0')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x6e20('0x35')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x36'));db['UserWhatsappQueue']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x37'));db[_0x6e20('0x38')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x39'));db[_0x6e20('0x3a')]=db[_0x6e20('0x0')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x6e20('0x3b')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x3c'));db[_0x6e20('0x3d')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x3e'));db[_0x6e20('0x3f')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x40'));db['MailInteraction']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x41'));db[_0x6e20('0x42')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x43'));db['MailApplication']=db[_0x6e20('0x0')]['import']('../api/mailApplication/mailApplication.model');db[_0x6e20('0x44')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x45'));db[_0x6e20('0x46')]=db[_0x6e20('0x0')]['import']('../api/dashboard/dashboard.model');db[_0x6e20('0x47')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x6e20('0x48')]=db[_0x6e20('0x0')]['import']('../api/faxAccount/faxAccount.model');db[_0x6e20('0x49')]=db[_0x6e20('0x0')]['import']('../api/faxApplication/faxApplication.model');db[_0x6e20('0x4a')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x4b'));db[_0x6e20('0x4c')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x4d'));db[_0x6e20('0x4e')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x4f'));db[_0x6e20('0x50')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x51'));db[_0x6e20('0x52')]=db[_0x6e20('0x0')]['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x6e20('0x0')]['import'](_0x6e20('0x53'));db['SmsInteraction']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x54'));db[_0x6e20('0x55')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x6e20('0x56')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/smsQueue/smsQueue.model');db[_0x6e20('0x57')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x58'));db['OpenchannelApplication']=db[_0x6e20('0x0')]['import'](_0x6e20('0x59'));db[_0x6e20('0x5a')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x5b'));db[_0x6e20('0x5c')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x5d'));db[_0x6e20('0x5e')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x5f'));db[_0x6e20('0x60')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x61'));db[_0x6e20('0x62')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db[_0x6e20('0x63')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x64'));db[_0x6e20('0x65')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x66'));db[_0x6e20('0x67')]=db['sequelize'][_0x6e20('0x13')]('../api/chatQueue/chatQueue.model');db[_0x6e20('0x68')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x69'));db['ChatProactiveAction']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x6a'));db[_0x6e20('0x6b')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x6c'));db[_0x6e20('0x6d')]=db[_0x6e20('0x0')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x6e'));db[_0x6e20('0x6f')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x70'));db[_0x6e20('0x71')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6e20('0x72')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x73'));db[_0x6e20('0x74')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x75'));db[_0x6e20('0x76')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x6e20('0x77')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/action/action.model');db[_0x6e20('0x78')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x79'));db['CannedAnswer']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x7a'));db[_0x6e20('0x7b')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x7c'));db[_0x6e20('0x7d')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x7e'));db[_0x6e20('0x7f')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x80'));db['Pause']=db[_0x6e20('0x0')]['import'](_0x6e20('0x81'));db[_0x6e20('0x82')]=db[_0x6e20('0x0')]['import'](_0x6e20('0x83'));db[_0x6e20('0x84')]=db['sequelize']['import'](_0x6e20('0x85'));db[_0x6e20('0x86')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x87'));db[_0x6e20('0x88')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x89'));db[_0x6e20('0x8a')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x8b'));db['ContactItemType']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x8c'));db[_0x6e20('0x8d')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x8e'));db['CmHopperAdditionalPhone']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x8f'));db[_0x6e20('0x90')]=db['sequelize'][_0x6e20('0x13')]('../api/template/template.model');db[_0x6e20('0x91')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x92'));db[_0x6e20('0x93')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x94'));db[_0x6e20('0x95')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x96'));db[_0x6e20('0x97')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x98'));db['AnalyticCustomReport']=db[_0x6e20('0x0')]['import'](_0x6e20('0x99'));db['AnalyticDefaultReport']=db[_0x6e20('0x0')]['import'](_0x6e20('0x9a'));db['AnalyticExtractedReport']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x9b'));db[_0x6e20('0x9c')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0x9d'));db['AnalyticFieldReport']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x6e20('0x9e')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x9f'));db[_0x6e20('0xa0')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xa1'));db['SalesforceConfiguration']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xa2'));db[_0x6e20('0xa3')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xa4'));db[_0x6e20('0xa5')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6e20('0xa6')]=db[_0x6e20('0x0')]['import'](_0x6e20('0xa7'));db[_0x6e20('0xa8')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xa9'));db[_0x6e20('0xaa')]=db['sequelize']['import'](_0x6e20('0xab'));db['DeskField']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xac'));db[_0x6e20('0xad')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x6e20('0xae')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xaf'));db['ZohoField']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xb0'));db[_0x6e20('0xb1')]=db[_0x6e20('0x0')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xb2'));db[_0x6e20('0xb3')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x6e20('0xb4')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xb5'));db['VtigerAccount']=db['sequelize']['import'](_0x6e20('0xb6'));db[_0x6e20('0xb7')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xb8'));db[_0x6e20('0xb9')]=db['sequelize']['import'](_0x6e20('0xba'));db['ServicenowAccount']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xbb'));db[_0x6e20('0xbc')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xbd'));db['ServicenowField']=db[_0x6e20('0x0')]['import'](_0x6e20('0xbe'));db[_0x6e20('0xbf')]=db[_0x6e20('0x0')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xc0'));db[_0x6e20('0xc1')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xc2'));db[_0x6e20('0xc3')]=db['sequelize'][_0x6e20('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6e20('0xc4')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xc5'));db[_0x6e20('0xc6')]=db[_0x6e20('0x0')]['import'](_0x6e20('0xc7'));db['Integration']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/integration/integration.model');db[_0x6e20('0xc8')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xc9'));db['ChatQueueReport']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xca'));db['ChatInternalMessage']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x6e20('0xcb')]=db[_0x6e20('0x0')]['import'](_0x6e20('0xcc'));db[_0x6e20('0xcd')]=db[_0x6e20('0x0')]['import'](_0x6e20('0xce'));db[_0x6e20('0xcf')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xd0'));db['SmsQueueReport']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0x6e20('0xd1')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xd2'));db['SquareDetailsReport']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xd3'));db['JscriptyProject']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xd4'));db[_0x6e20('0xd5')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xd6'));db['SquareOdbc']=db[_0x6e20('0x0')]['import'](_0x6e20('0xd7'));db[_0x6e20('0xd8')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/squareProject/squareProject.model');db['SquareRecording']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xd9'));db['SquareMessage']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xda'));db[_0x6e20('0xdb')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/license/license.model');db['Campaign']=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xdc'));db[_0x6e20('0xdd')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0x6e20('0x0')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/plugin/plugin.model');db[_0x6e20('0xde')]=db[_0x6e20('0x0')]['import'](_0x6e20('0xdf'));db['ChatTransferReport']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x6e20('0xe0')]=db[_0x6e20('0x0')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize']['import'](_0x6e20('0xe1'));db[_0x6e20('0xe2')]=db['sequelize']['import'](_0x6e20('0xe3'));db[_0x6e20('0xe4')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x6e20('0xe5')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xe6'));db[_0x6e20('0xe7')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xe8'));db[_0x6e20('0xe9')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xea'));db[_0x6e20('0xeb')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xec'));db[_0x6e20('0xed')]=db['sequelize']['import'](_0x6e20('0xee'));db[_0x6e20('0xef')]=db['sequelize']['import'](_0x6e20('0xf0'));db[_0x6e20('0xf1')]=db['sequelize'][_0x6e20('0x13')](_0x6e20('0xf2'));db[_0x6e20('0xf3')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xf4'));db[_0x6e20('0xf5')]=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x6e20('0xf6')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xf7'));db['WhatsappTransferReport']=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xf8'));db['WhatsappQueue']=db[_0x6e20('0x0')]['import'](_0x6e20('0xf9'));db[_0x6e20('0xfa')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xfb'));db[_0x6e20('0xfc')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xfd'));db[_0x6e20('0xfe')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0xff'));db[_0x6e20('0x100')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x101'));db['UserSetting']=db[_0x6e20('0x0')][_0x6e20('0x13')]('../api/user-setting/user-setting.model');db[_0x6e20('0x102')]=db[_0x6e20('0x0')][_0x6e20('0x13')](_0x6e20('0x103'));db[_0x6e20('0x104')][_0x6e20('0x105')](db[_0x6e20('0x1f')],{'as':_0x6e20('0x1f'),'onDelete':_0x6e20('0x106'),'foreignKey':'UserId'});db[_0x6e20('0x104')][_0x6e20('0x105')](db['UserSetting'],{'as':_0x6e20('0x107'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x108')});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x10a')],{'as':_0x6e20('0x10b'),'foreignKey':_0x6e20('0x108')});db['User'][_0x6e20('0x109')](db[_0x6e20('0x2a')],{'as':'VoiceQueuesRt','foreignKey':_0x6e20('0x108')});db[_0x6e20('0x104')]['hasMany'](db[_0x6e20('0x16')],{'as':_0x6e20('0x10c'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x71')],{'as':_0x6e20('0x10d'),'foreignKey':_0x6e20('0x108')});db[_0x6e20('0x104')][_0x6e20('0x109')](db['CmHopperHistory'],{'as':_0x6e20('0x10e'),'foreignKey':_0x6e20('0x108')});db['User'][_0x6e20('0x109')](db[_0x6e20('0x74')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0x6e20('0x108')});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x63')],{'as':_0x6e20('0x10f'),'foreignKey':'UserId'});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x110')],{'as':'SmsInteractions','foreignKey':_0x6e20('0x108')});db[_0x6e20('0x104')][_0x6e20('0x109')](db[_0x6e20('0x4a')],{'as':'FaxInteractions','foreignKey':_0x6e20('0x108')});db['User'][_0x6e20('0x109')](db[_0x6e20('0x111')],{'as':'MailInteractions','foreignKey':_0x6e20('0x108')});db['User'][_0x6e20('0x109')](db['WhatsappInteraction'],{'as':_0x6e20('0x112'),'foreignKey':_0x6e20('0x108')});db['User'][_0x6e20('0x109')](db[_0x6e20('0xed')],{'as':_0x6e20('0x113'),'foreignKey':_0x6e20('0x114')});db[_0x6e20('0x104')]['hasMany'](db[_0x6e20('0x115')],{'as':_0x6e20('0x116'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x6e20('0x104')][_0x6e20('0x117')](db[_0x6e20('0xe7')],{'as':'UserProfile','foreignKey':_0x6e20('0x118')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x68')],{'as':_0x6e20('0x11a'),'through':_0x6e20('0x11b')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x11c'),'through':_0x6e20('0x11d')});db['User'][_0x6e20('0x119')](db[_0x6e20('0xe4')],{'as':'Lists','through':_0x6e20('0x11e')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x11f')],{'through':_0x6e20('0x120')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x111')],{'as':_0x6e20('0x121'),'through':'user_has_mail_interactions'});db[_0x6e20('0x104')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x6e20('0x122')});db['User'][_0x6e20('0x119')](db[_0x6e20('0x4a')],{'as':'FaxInteractions','through':_0x6e20('0x123')});db[_0x6e20('0x104')]['belongsToMany'](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x6e20('0x104')][_0x6e20('0x119')](db['OpenchannelInteraction'],{'as':_0x6e20('0x124'),'through':_0x6e20('0x125')});db['User'][_0x6e20('0x119')](db[_0x6e20('0xf3')],{'as':_0x6e20('0x112'),'through':_0x6e20('0x126')});db[_0x6e20('0x104')]['belongsToMany'](db[_0x6e20('0x1a')],{'as':'VoiceQueues','through':_0x6e20('0x2c'),'required':![]});db[_0x6e20('0x104')]['belongsToMany'](db[_0x6e20('0xe5')],{'as':'VoicePrefixes','through':_0x6e20('0x100'),'required':![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x3d')],{'as':'MailQueues','through':_0x6e20('0x30'),'required':![]});db['User'][_0x6e20('0x119')](db['ChatQueue'],{'as':_0x6e20('0x127'),'through':_0x6e20('0x2e'),'required':![],'hooks':!![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db['FaxQueue'],{'as':_0x6e20('0x128'),'through':_0x6e20('0x32'),'required':![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x56')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x5e')],{'as':_0x6e20('0x129'),'through':_0x6e20('0x35'),'required':![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x12a')],{'as':_0x6e20('0x12b'),'through':'UserWhatsappQueue','required':![]});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0xe4')],{'through':_0x6e20('0x11e')});db['User'][_0x6e20('0x119')](db[_0x6e20('0x60')],{'as':_0x6e20('0x12c'),'through':_0x6e20('0x12d')});db[_0x6e20('0x104')][_0x6e20('0x119')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x3b')],{'as':_0x6e20('0x12e'),'through':_0x6e20('0x12f')});db['User'][_0x6e20('0x119')](db['OpenchannelAccount'],{'as':_0x6e20('0x130'),'through':_0x6e20('0x131')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0x52')],{'as':'SmsAccounts','through':_0x6e20('0x132')});db[_0x6e20('0x104')][_0x6e20('0x119')](db[_0x6e20('0xef')],{'as':_0x6e20('0x133'),'through':'user_has_whatsapp_accounts'});db[_0x6e20('0x12')][_0x6e20('0x109')](db[_0x6e20('0x16')],{'as':_0x6e20('0x134'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x135')});db[_0x6e20('0x14')][_0x6e20('0x109')](db[_0x6e20('0x16')],{'onDelete':'cascade'});db['VoiceExtension'][_0x6e20('0x109')](db[_0x6e20('0x16')],{'as':_0x6e20('0x136'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x18')][_0x6e20('0x119')](db[_0x6e20('0x88')],{'as':_0x6e20('0x137'),'through':'moh_has_sounds'});db[_0x6e20('0x1a')][_0x6e20('0x109')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x6e20('0x138')});db['VoiceQueue'][_0x6e20('0x109')](db[_0x6e20('0x115')],{'as':'Hoppers','foreignKey':_0x6e20('0x138')});db['VoiceQueue'][_0x6e20('0x109')](db['CmHopperFinal'],{'as':_0x6e20('0x10d'),'foreignKey':_0x6e20('0x138')});db[_0x6e20('0x1a')][_0x6e20('0x109')](db[_0x6e20('0x72')],{'as':'HopperHistories','foreignKey':_0x6e20('0x138')});db[_0x6e20('0x1a')]['hasMany'](db[_0x6e20('0x74')],{'as':_0x6e20('0x74'),'foreignKey':'VoiceQueueId'});db[_0x6e20('0x1a')][_0x6e20('0x109')](db[_0x6e20('0x6f')],{'as':_0x6e20('0x139'),'foreignKey':_0x6e20('0x138')});db['VoiceQueue'][_0x6e20('0x109')](db[_0x6e20('0xcf')],{'as':_0x6e20('0x13a'),'foreignKey':'VoiceQueueId'});db[_0x6e20('0x1a')][_0x6e20('0x117')](db['Trunk'],{'as':_0x6e20('0x28'),'foreignKey':_0x6e20('0x13b')});db['VoiceQueue'][_0x6e20('0x117')](db['Trunk'],{'as':_0x6e20('0x13c'),'foreignKey':_0x6e20('0x13d')});db[_0x6e20('0x1a')]['belongsTo'](db['Interval'],{'as':_0x6e20('0x7f'),'foreignKey':_0x6e20('0x13e')});db['VoiceQueue']['belongsTo'](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':_0x6e20('0x141')});db[_0x6e20('0x1a')][_0x6e20('0x119')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x142'),'through':_0x6e20('0x143')});db[_0x6e20('0x1a')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x2c')});db['VoiceQueue'][_0x6e20('0x119')](db[_0x6e20('0x11f')],{'as':_0x6e20('0x145'),'through':_0x6e20('0xfc')});db['VoiceQueue']['belongsToMany'](db[_0x6e20('0xe4')],{'as':_0x6e20('0x146'),'through':'voice_queues_has_cm_blacklists'});db[_0x6e20('0x10a')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x104'),'foreignKey':_0x6e20('0x108')});db[_0x6e20('0x1d')]['belongsTo'](db['User'],{'as':_0x6e20('0x104'),'foreignKey':'UserId'});db['VoiceMail'][_0x6e20('0x109')](db[_0x6e20('0x147')],{'as':_0x6e20('0x148'),'onDelete':_0x6e20('0x106'),'foreignKey':'mailboxuser','sourceKey':_0x6e20('0x149')});db['VoiceMailMessage'][_0x6e20('0x117')](db[_0x6e20('0x1f')],{'foreignKey':_0x6e20('0x14a'),'targetKey':_0x6e20('0x149')});db[_0x6e20('0x21')][_0x6e20('0x109')](db['VoiceQueueReport'],{'as':_0x6e20('0x14b'),'foreignKey':_0x6e20('0x14c'),'constraints':![]});db[_0x6e20('0x21')][_0x6e20('0x109')](db['VoiceAgentReport'],{'as':_0x6e20('0x14d'),'foreignKey':'uniqueid','constraints':![]});db[_0x6e20('0x21')]['belongsTo'](db['User'],{'as':_0x6e20('0x104'),'foreignKey':_0x6e20('0x108')});db[_0x6e20('0x21')]['belongsTo'](db['CmContact'],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db['MailServerIn']['belongsTo'](db[_0x6e20('0x3b')],{'as':_0x6e20('0x3b'),'foreignKey':_0x6e20('0x150')});db[_0x6e20('0x38')][_0x6e20('0x117')](db['CloudProvider'],{'as':_0x6e20('0xfa'),'foreignKey':_0x6e20('0x151'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x3a')]['belongsTo'](db[_0x6e20('0x3b')],{'as':_0x6e20('0x3b'),'foreignKey':_0x6e20('0x150')});db[_0x6e20('0x3a')][_0x6e20('0x117')](db[_0x6e20('0xfa')],{'as':_0x6e20('0xfa'),'foreignKey':_0x6e20('0x151'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x3b')][_0x6e20('0x105')](db[_0x6e20('0x38')],{'as':_0x6e20('0x153'),'onDelete':_0x6e20('0x106')});db['MailAccount']['hasOne'](db[_0x6e20('0x3a')],{'as':_0x6e20('0x154'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x3b')][_0x6e20('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6e20('0x150'),'onDelete':'cascade'});db[_0x6e20('0x3b')][_0x6e20('0x109')](db[_0x6e20('0x155')],{'as':_0x6e20('0x156'),'foreignKey':'MailAccountId'});db[_0x6e20('0x3b')]['hasMany'](db[_0x6e20('0x42')],{'as':_0x6e20('0x148'),'foreignKey':_0x6e20('0x150')});db['MailAccount'][_0x6e20('0x109')](db[_0x6e20('0x111')],{'as':_0x6e20('0x157')});db[_0x6e20('0x3b')][_0x6e20('0x109')](db[_0x6e20('0x158')],{'as':_0x6e20('0x136'),'foreignKey':'MailAccountId','onDelete':_0x6e20('0x106')});db[_0x6e20('0x3b')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x3b')][_0x6e20('0x117')](db['Template'],{'as':_0x6e20('0x90'),'foreignKey':_0x6e20('0x15b')});db[_0x6e20('0x3b')][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x12f')});db[_0x6e20('0x3d')]['belongsToMany'](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x30')});db['MailQueue'][_0x6e20('0x119')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6e20('0x111')][_0x6e20('0x109')](db[_0x6e20('0x42')],{'as':'Messages','onDelete':_0x6e20('0x106'),'foreignKey':'MailInteractionId'});db[_0x6e20('0x111')][_0x6e20('0x117')](db['MailAccount'],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x150')});db[_0x6e20('0x111')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x111')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'as':_0x6e20('0x15d'),'foreignKey':'UserId'});db[_0x6e20('0x111')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x6e20('0x111')]['belongsToMany'](db[_0x6e20('0x8a')],{'through':_0x6e20('0x15e'),'as':_0x6e20('0x15f')});db['MailInteraction'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':'Users','through':_0x6e20('0x160'),'foreignKey':_0x6e20('0x161')});db[_0x6e20('0x42')][_0x6e20('0x109')](db[_0x6e20('0x162')],{'as':'Attachments','onDelete':_0x6e20('0x106')});db[_0x6e20('0x42')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x104')});db[_0x6e20('0x42')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'onDelete':_0x6e20('0x106'),'as':'Contact'});db[_0x6e20('0x42')][_0x6e20('0x117')](db[_0x6e20('0x111')],{'as':_0x6e20('0x163'),'foreignKey':'MailInteractionId'});db[_0x6e20('0x42')][_0x6e20('0x117')](db['MailAccount'],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x150')});db['MailMessage'][_0x6e20('0x117')](db[_0x6e20('0x60')],{'as':'ChatWebsite','foreignKey':_0x6e20('0x164')});db['MailMessage']['belongsTo'](db[_0x6e20('0x165')],{'as':_0x6e20('0x165'),'foreignKey':'ChatOfflineMessageId'});db[_0x6e20('0x158')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x158')][_0x6e20('0x117')](db['MailQueue'],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x158')][_0x6e20('0x117')](db[_0x6e20('0x3b')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x158')][_0x6e20('0x117')](db[_0x6e20('0x7f')],{'onDelete':_0x6e20('0x152'),'foreignKey':'IntervalId'});db[_0x6e20('0x158')][_0x6e20('0x117')](db[_0x6e20('0x8a')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x166')});db[_0x6e20('0x44')]['belongsTo'](db[_0x6e20('0x3b')],{});db[_0x6e20('0x44')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x44')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x6e20('0x44')][_0x6e20('0x117')](db[_0x6e20('0x111')],{});db[_0x6e20('0x44')][_0x6e20('0x117')](db[_0x6e20('0x42')],{});db[_0x6e20('0x44')][_0x6e20('0x117')](db[_0x6e20('0x104')],{});db[_0x6e20('0x44')][_0x6e20('0x117')](db['MailQueue'],{});db[_0x6e20('0x46')][_0x6e20('0x109')](db[_0x6e20('0x47')],{'as':_0x6e20('0x167'),'onDelete':_0x6e20('0x106')});db['FaxAccount'][_0x6e20('0x109')](db['Disposition'],{'as':_0x6e20('0x168'),'foreignKey':_0x6e20('0x169'),'onDelete':'cascade'});db[_0x6e20('0x48')]['hasMany'](db['CannedAnswer'],{'as':_0x6e20('0x156'),'foreignKey':_0x6e20('0x169')});db[_0x6e20('0x48')][_0x6e20('0x109')](db[_0x6e20('0x4a')],{'as':'Interactions'});db[_0x6e20('0x48')][_0x6e20('0x109')](db['FaxApplication'],{'as':_0x6e20('0x136'),'foreignKey':_0x6e20('0x169'),'onDelete':'cascade'});db[_0x6e20('0x48')][_0x6e20('0x109')](db[_0x6e20('0x16')],{'as':_0x6e20('0x16a'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x48')][_0x6e20('0x109')](db[_0x6e20('0x4c')],{'as':_0x6e20('0x148')});db['FaxAccount'][_0x6e20('0x117')](db[_0x6e20('0x28')],{'as':_0x6e20('0x28')});db[_0x6e20('0x48')]['belongsTo'](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db['FaxAccount'][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':'Agents','through':_0x6e20('0x16b')});db[_0x6e20('0x49')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':_0x6e20('0x152')});db['FaxApplication'][_0x6e20('0x117')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x6e20('0x49')][_0x6e20('0x117')](db[_0x6e20('0x48')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x49')]['belongsTo'](db['Tag'],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x166')});db[_0x6e20('0x4a')][_0x6e20('0x109')](db[_0x6e20('0x4c')],{'as':'Messages','onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x16c')});db[_0x6e20('0x4a')][_0x6e20('0x117')](db[_0x6e20('0x48')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x169')});db[_0x6e20('0x4a')]['belongsTo'](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x4a')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x15d'),'foreignKey':_0x6e20('0x108')});db['FaxInteraction'][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':_0x6e20('0x16d'),'as':'Tags'});db[_0x6e20('0x4a')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':'fax_interaction_has_tags','as':_0x6e20('0x15f')});db[_0x6e20('0x4a')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x16e'),'through':_0x6e20('0x123'),'foreignKey':_0x6e20('0x16c')});db[_0x6e20('0x4c')][_0x6e20('0x117')](db['User'],{'onDelete':_0x6e20('0x106'),'as':'User'});db[_0x6e20('0x4c')]['belongsTo'](db[_0x6e20('0x4a')],{'as':_0x6e20('0x163'),'foreignKey':_0x6e20('0x16c')});db[_0x6e20('0x4c')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x14e')});db[_0x6e20('0x4c')]['belongsTo'](db[_0x6e20('0x162')],{'as':_0x6e20('0x162'),'foreignKey':_0x6e20('0x16f')});db[_0x6e20('0x4c')][_0x6e20('0x117')](db[_0x6e20('0x48')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x169')});db[_0x6e20('0x4e')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':'Agents','through':_0x6e20('0x32')});db[_0x6e20('0x4e')][_0x6e20('0x119')](db['Team'],{'through':_0x6e20('0x170'),'as':_0x6e20('0x145')});db[_0x6e20('0x50')]['belongsTo'](db[_0x6e20('0x48')],{});db[_0x6e20('0x50')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x50')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db['FaxQueueReport']['belongsTo'](db['FaxInteraction'],{});db[_0x6e20('0x50')]['belongsTo'](db[_0x6e20('0x4c')],{});db[_0x6e20('0x50')][_0x6e20('0x117')](db[_0x6e20('0x104')],{});db[_0x6e20('0x50')][_0x6e20('0x117')](db[_0x6e20('0x4e')],{});db[_0x6e20('0x52')]['hasMany'](db[_0x6e20('0x7b')],{'as':'Dispositions','foreignKey':_0x6e20('0x171'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x52')]['hasMany'](db['CannedAnswer'],{'as':_0x6e20('0x156'),'foreignKey':_0x6e20('0x171')});db[_0x6e20('0x52')][_0x6e20('0x109')](db['SmsMessage'],{'as':_0x6e20('0x148'),'foreignKey':_0x6e20('0x171')});db[_0x6e20('0x52')][_0x6e20('0x109')](db[_0x6e20('0x110')],{'as':_0x6e20('0x157')});db[_0x6e20('0x52')][_0x6e20('0x109')](db[_0x6e20('0x172')],{'as':_0x6e20('0x136'),'foreignKey':_0x6e20('0x171'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x52')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':'List','foreignKey':'ListId'});db['SmsAccount'][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':_0x6e20('0x141')});db[_0x6e20('0x52')]['belongsToMany'](db['User'],{'as':_0x6e20('0x144'),'through':_0x6e20('0x132')});db[_0x6e20('0x172')]['belongsTo'](db[_0x6e20('0x104')],{'onDelete':'restrict'});db['SmsApplication'][_0x6e20('0x117')](db[_0x6e20('0x56')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x172')][_0x6e20('0x117')](db[_0x6e20('0x52')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0x172')]['belongsTo'](db[_0x6e20('0x7f')],{'onDelete':'restrict','foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x172')][_0x6e20('0x117')](db[_0x6e20('0x8a')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x166')});db[_0x6e20('0x110')][_0x6e20('0x109')](db[_0x6e20('0x55')],{'as':_0x6e20('0x148'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x173')});db[_0x6e20('0x110')][_0x6e20('0x117')](db[_0x6e20('0x52')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x171')});db[_0x6e20('0x110')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':_0x6e20('0x14f')});db['SmsInteraction'][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x15d'),'foreignKey':'UserId'});db[_0x6e20('0x110')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':'sms_interaction_has_tags','as':_0x6e20('0x174')});db[_0x6e20('0x110')][_0x6e20('0x119')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x6e20('0x15f')});db[_0x6e20('0x110')]['belongsToMany'](db[_0x6e20('0x104')],{'as':'Users','through':_0x6e20('0x175'),'foreignKey':_0x6e20('0x173')});db[_0x6e20('0x55')]['belongsTo'](db[_0x6e20('0x104')],{'as':'User'});db[_0x6e20('0x55')][_0x6e20('0x117')](db['CmContact'],{'onDelete':'cascade','as':_0x6e20('0x14e')});db['SmsMessage'][_0x6e20('0x117')](db[_0x6e20('0x110')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x163'),'foreignKey':'SmsInteractionId'});db[_0x6e20('0x55')][_0x6e20('0x117')](db[_0x6e20('0x52')],{'as':'Account','foreignKey':_0x6e20('0x171')});db[_0x6e20('0x56')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':'Agents','through':_0x6e20('0x34'),'foreignKey':_0x6e20('0x176')});db[_0x6e20('0x56')]['belongsToMany'](db[_0x6e20('0x11f')],{'through':'team_has_sms_queues','as':_0x6e20('0x145')});db[_0x6e20('0x57')][_0x6e20('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6e20('0x177'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x57')][_0x6e20('0x109')](db[_0x6e20('0x155')],{'as':_0x6e20('0x156'),'foreignKey':_0x6e20('0x177')});db[_0x6e20('0x57')][_0x6e20('0x109')](db[_0x6e20('0x5a')],{'as':_0x6e20('0x157'),'foreignKey':_0x6e20('0x177')});db[_0x6e20('0x57')][_0x6e20('0x109')](db[_0x6e20('0x5c')],{'as':'Messages','foreignKey':_0x6e20('0x177')});db[_0x6e20('0x57')][_0x6e20('0x109')](db[_0x6e20('0x178')],{'as':_0x6e20('0x136'),'foreignKey':_0x6e20('0x177'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x57')]['belongsTo'](db[_0x6e20('0xe4')],{'as':'List','foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x57')][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':_0x6e20('0x141')});db[_0x6e20('0x57')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':'user_has_openchannel_accounts'});db[_0x6e20('0x178')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':'restrict'});db[_0x6e20('0x178')][_0x6e20('0x117')](db[_0x6e20('0x5e')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x179')});db['OpenchannelApplication'][_0x6e20('0x117')](db[_0x6e20('0x57')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x177')});db[_0x6e20('0x178')][_0x6e20('0x117')](db[_0x6e20('0x7f')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x178')][_0x6e20('0x117')](db['Tag'],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x166')});db['OpenchannelInteraction'][_0x6e20('0x109')](db[_0x6e20('0x5c')],{'as':_0x6e20('0x148'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x17a')});db['OpenchannelInteraction'][_0x6e20('0x117')](db[_0x6e20('0x57')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x177')});db[_0x6e20('0x5a')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':'ContactId'});db[_0x6e20('0x5a')][_0x6e20('0x117')](db['User'],{'as':'Owner','foreignKey':_0x6e20('0x108')});db['OpenchannelInteraction'][_0x6e20('0x119')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x6e20('0x174')});db[_0x6e20('0x5a')]['belongsToMany'](db[_0x6e20('0x8a')],{'through':_0x6e20('0x17b'),'as':_0x6e20('0x15f')});db[_0x6e20('0x5a')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x16e'),'through':_0x6e20('0x125'),'foreignKey':'OpenchannelInteractionId'});db[_0x6e20('0x5c')][_0x6e20('0x117')](db['User'],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x104')});db[_0x6e20('0x5c')]['belongsTo'](db['CmContact'],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x14e')});db[_0x6e20('0x5c')][_0x6e20('0x117')](db[_0x6e20('0x5a')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x163'),'foreignKey':_0x6e20('0x17a')});db[_0x6e20('0x5c')][_0x6e20('0x117')](db['Attachment'],{'as':_0x6e20('0x162'),'foreignKey':_0x6e20('0x16f')});db[_0x6e20('0x5c')][_0x6e20('0x117')](db[_0x6e20('0x57')],{'as':_0x6e20('0x15c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x35'),'foreignKey':_0x6e20('0x179')});db[_0x6e20('0x5e')][_0x6e20('0x119')](db[_0x6e20('0x11f')],{'through':_0x6e20('0x17c'),'as':'Teams'});db[_0x6e20('0x60')][_0x6e20('0x109')](db[_0x6e20('0x7b')],{'as':_0x6e20('0x168'),'foreignKey':_0x6e20('0x164'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x60')][_0x6e20('0x109')](db['CannedAnswer'],{'as':_0x6e20('0x156'),'foreignKey':_0x6e20('0x164')});db[_0x6e20('0x60')][_0x6e20('0x109')](db[_0x6e20('0x17d')],{'as':_0x6e20('0x17e')});db['ChatWebsite']['hasMany'](db[_0x6e20('0x63')],{'as':_0x6e20('0x157')});db[_0x6e20('0x60')][_0x6e20('0x109')](db[_0x6e20('0x17f')],{'as':'Applications','foreignKey':_0x6e20('0x164'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x60')][_0x6e20('0x109')](db[_0x6e20('0x65')],{'as':'Messages'});db[_0x6e20('0x60')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x60')][_0x6e20('0x117')](db[_0x6e20('0x7f')],{'as':_0x6e20('0x7f'),'foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x60')][_0x6e20('0x117')](db[_0x6e20('0x3b')],{'as':_0x6e20('0x3b'),'foreignKey':_0x6e20('0x150')});db[_0x6e20('0x60')][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6e20('0x60')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x12d')});db[_0x6e20('0x62')][_0x6e20('0x117')](db['OpenchannelAccount'],{});db[_0x6e20('0x62')][_0x6e20('0x117')](db['CmList'],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db['OpenchannelQueueReport'][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':_0x6e20('0x14f')});db['OpenchannelQueueReport'][_0x6e20('0x117')](db[_0x6e20('0x5a')],{});db[_0x6e20('0x62')]['belongsTo'](db[_0x6e20('0x5c')],{});db[_0x6e20('0x62')]['belongsTo'](db[_0x6e20('0x104')],{});db['OpenchannelQueueReport'][_0x6e20('0x117')](db[_0x6e20('0x5e')],{});db['ChatApplication'][_0x6e20('0x117')](db[_0x6e20('0x104')],{'as':_0x6e20('0x180'),'foreignKey':_0x6e20('0x108'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x17f')][_0x6e20('0x117')](db[_0x6e20('0x67')],{'as':'Queue','foreignKey':_0x6e20('0x181'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x17f')][_0x6e20('0x117')](db[_0x6e20('0x60')],{'as':_0x6e20('0x182'),'foreignKey':_0x6e20('0x164'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x17f')][_0x6e20('0x117')](db[_0x6e20('0x8a')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x166')});db[_0x6e20('0x63')][_0x6e20('0x109')](db[_0x6e20('0x65')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x6e20('0x183')});db['ChatInteraction']['belongsTo'](db[_0x6e20('0x60')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x164')});db['ChatInteraction'][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x63')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x15d'),'foreignKey':_0x6e20('0x108')});db[_0x6e20('0x63')][_0x6e20('0x119')](db['Tag'],{'through':_0x6e20('0x184'),'as':_0x6e20('0x174')});db[_0x6e20('0x63')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':'chat_interaction_has_tags','as':_0x6e20('0x15f')});db['ChatInteraction']['belongsToMany'](db[_0x6e20('0x104')],{'as':_0x6e20('0x16e'),'through':'user_has_chat_interactions','foreignKey':_0x6e20('0x183')});db[_0x6e20('0x65')]['belongsTo'](db[_0x6e20('0x104')],{'onDelete':'cascade','as':'User'});db[_0x6e20('0x65')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x14e'),'foreignKey':'ContactId'});db[_0x6e20('0x65')][_0x6e20('0x117')](db['ChatInteraction'],{'onDelete':_0x6e20('0x106'),'as':'Interaction','foreignKey':_0x6e20('0x183')});db[_0x6e20('0x65')][_0x6e20('0x117')](db[_0x6e20('0x162')],{'as':'Attachment','foreignKey':_0x6e20('0x16f')});db[_0x6e20('0x65')][_0x6e20('0x117')](db[_0x6e20('0x60')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x164')});db['ChatOfflineMessage'][_0x6e20('0x109')](db[_0x6e20('0x162')],{'as':_0x6e20('0x185'),'foreignKey':_0x6e20('0x186'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x165')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x165')]['belongsTo'](db[_0x6e20('0x60')],{'as':_0x6e20('0x15c'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x2e'),'hooks':!![]});db['ChatQueue'][_0x6e20('0x119')](db['Team'],{'through':_0x6e20('0x187'),'as':_0x6e20('0x145')});db[_0x6e20('0x68')][_0x6e20('0x109')](db[_0x6e20('0x188')],{'as':'Messages','foreignKey':_0x6e20('0x189'),'onDelete':'cascade'});db['ChatGroup'][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x18a'),'through':_0x6e20('0x11b')});db['ChatProactiveAction'][_0x6e20('0x117')](db[_0x6e20('0x60')],{'as':_0x6e20('0x182'),'foreignKey':_0x6e20('0x164')});db['CmCompany']['hasMany'](db[_0x6e20('0x6d')],{'as':_0x6e20('0x11c'),'foreignKey':'CompanyId'});db[_0x6e20('0x6d')]['hasMany'](db['CmContactHasItem'],{'as':_0x6e20('0x18b'),'foreignKey':_0x6e20('0x18c')});db[_0x6e20('0x6d')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x71')],{'as':_0x6e20('0x10d'),'foreignKey':'ContactId'});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x72')],{'as':'HopperHistories','foreignKey':_0x6e20('0x14f')});db['CmContact'][_0x6e20('0x109')](db['ReportAgentPreview'],{'as':_0x6e20('0x74'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0xcf')],{'as':'JscriptySessions','foreignKey':_0x6e20('0x14f')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0x6e20('0x124'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x63')],{'as':_0x6e20('0x10f'),'foreignKey':_0x6e20('0x14f'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x110')],{'as':_0x6e20('0x18d'),'foreignKey':_0x6e20('0x14f'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x4a')],{'as':_0x6e20('0x18e'),'foreignKey':_0x6e20('0x14f'),'onDelete':'restrict'});db[_0x6e20('0x6d')][_0x6e20('0x109')](db[_0x6e20('0x111')],{'as':_0x6e20('0x121'),'foreignKey':_0x6e20('0x14f'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x6d')][_0x6e20('0x117')](db[_0x6e20('0x6b')],{'as':_0x6e20('0x18f'),'foreignKey':_0x6e20('0x190')});db[_0x6e20('0x6d')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x6d')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x16e'),'through':'cm_user_has_contacts'});db[_0x6e20('0x6d')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'as':_0x6e20('0x174'),'through':_0x6e20('0x191')});db[_0x6e20('0x6d')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':_0x6e20('0x191'),'as':_0x6e20('0x15f')});db['CmHopper']['hasMany'](db[_0x6e20('0x192')],{'as':_0x6e20('0x193'),'foreignKey':_0x6e20('0x194')});db[_0x6e20('0x115')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f'),'onDelete':'cascade'});db[_0x6e20('0x115')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x115')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'as':'Agent','foreignKey':_0x6e20('0x108')});db[_0x6e20('0x115')][_0x6e20('0x117')](db['VoiceQueue'],{'as':_0x6e20('0x195'),'foreignKey':_0x6e20('0x138'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x115')][_0x6e20('0x117')](db['Campaign'],{'as':'Campaign','foreignKey':_0x6e20('0x196'),'onDelete':'cascade'});db[_0x6e20('0x115')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'as':_0x6e20('0x15d'),'foreignKey':_0x6e20('0x197')});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0x6f')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a'),'onDelete':'cascade'});db[_0x6e20('0x6f')][_0x6e20('0x117')](db[_0x6e20('0x1a')],{'as':_0x6e20('0x195'),'foreignKey':'VoiceQueueId','onDelete':_0x6e20('0x106')});db[_0x6e20('0x6f')][_0x6e20('0x117')](db[_0x6e20('0x198')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x6e20('0x106')});db[_0x6e20('0x78')][_0x6e20('0x109')](db['Condition'],{'as':{'plural':'All','singular':_0x6e20('0x199')},'foreignKey':_0x6e20('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x6e20('0x78')][_0x6e20('0x109')](db['Condition'],{'as':{'plural':'Any','singular':_0x6e20('0x19b')},'foreignKey':_0x6e20('0x19c'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x78')][_0x6e20('0x109')](db[_0x6e20('0x77')],{'as':_0x6e20('0x19d'),'foreignKey':_0x6e20('0x19e'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x7b')]['hasMany'](db[_0x6e20('0x7b')],{'as':_0x6e20('0x168'),'foreignKey':_0x6e20('0x19f'),'onDelete':'cascade'});db[_0x6e20('0x7f')][_0x6e20('0x109')](db[_0x6e20('0x7f')],{'as':_0x6e20('0x1a0'),'foreignKey':'IntervalId','onDelete':_0x6e20('0x106'),'hooks':!![],'required':![]});db[_0x6e20('0x7f')][_0x6e20('0x109')](db[_0x6e20('0x16')],{'as':'Extensions','foreignKey':_0x6e20('0x13e'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x7f')]['hasMany'](db[_0x6e20('0x158')],{'as':'MailApplications','foreignKey':_0x6e20('0x13e')});db['Interval'][_0x6e20('0x109')](db[_0x6e20('0x17f')],{'as':_0x6e20('0x1a1'),'foreignKey':'IntervalId'});db[_0x6e20('0x7f')][_0x6e20('0x109')](db[_0x6e20('0x49')],{'as':_0x6e20('0x1a2'),'foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x7f')]['hasMany'](db[_0x6e20('0x172')],{'as':'SmsApplications','foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x86')][_0x6e20('0x117')](db[_0x6e20('0x3b')],{});db['Schedule'][_0x6e20('0x117')](db['AnalyticDefaultReport'],{'foreignKey':_0x6e20('0x1a3')});db[_0x6e20('0x86')][_0x6e20('0x117')](db[_0x6e20('0x1a4')],{'foreignKey':'CustomReportId'});db[_0x6e20('0x88')]['belongsToMany'](db[_0x6e20('0x18')],{'as':_0x6e20('0x1a5'),'through':_0x6e20('0x1a6'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0x8a')][_0x6e20('0x119')](db[_0x6e20('0x6d')],{'through':_0x6e20('0x191')});db[_0x6e20('0x8a')][_0x6e20('0x119')](db[_0x6e20('0x63')],{'through':_0x6e20('0x184')});db[_0x6e20('0x8a')][_0x6e20('0x119')](db[_0x6e20('0x111')],{'through':'mail_interaction_has_tags'});db[_0x6e20('0x8a')]['belongsToMany'](db[_0x6e20('0x110')],{'through':_0x6e20('0x1a7')});db['Tag']['belongsToMany'](db[_0x6e20('0x4a')],{'through':_0x6e20('0x16d')});db['Tag'][_0x6e20('0x119')](db[_0x6e20('0x5a')],{'through':_0x6e20('0x17b')});db[_0x6e20('0x8a')]['belongsToMany'](db[_0x6e20('0xf3')],{'through':_0x6e20('0x1a8')});db[_0x6e20('0x8d')]['belongsTo'](db[_0x6e20('0x1a9')],{'as':'ItemType','foreignKey':_0x6e20('0x1aa')});db['CmHopperAdditionalPhone'][_0x6e20('0x117')](db[_0x6e20('0x115')],{'as':_0x6e20('0x1ab'),'foreignKey':'CmHopperId'});db[_0x6e20('0x8d')][_0x6e20('0x117')](db['CmContact'],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x18c')});db[_0x6e20('0x91')][_0x6e20('0x109')](db[_0x6e20('0x7d')],{'as':{'plural':_0x6e20('0x1ac'),'singular':'AllCondition'},'foreignKey':_0x6e20('0x1ad'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x91')][_0x6e20('0x109')](db[_0x6e20('0x7d')],{'as':{'plural':'AnyConditions','singular':_0x6e20('0x1ae')},'foreignKey':_0x6e20('0x1af'),'onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x91')][_0x6e20('0x109')](db[_0x6e20('0x77')],{'as':_0x6e20('0x19d'),'foreignKey':'TriggerId','onDelete':_0x6e20('0x106'),'hooks':!![]});db[_0x6e20('0x1a4')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b1'),'hooks':!![]});db['AnalyticDefaultReport'][_0x6e20('0x109')](db[_0x6e20('0x1b2')],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':'DefaultReportId'});db[_0x6e20('0x9c')][_0x6e20('0x109')](db[_0x6e20('0x1b2')],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b3')});db['AnalyticFieldReport'][_0x6e20('0x117')](db[_0x6e20('0x9c')],{'foreignKey':'MetricId'});db[_0x6e20('0xa0')][_0x6e20('0x109')](db[_0x6e20('0x1b4')],{'as':_0x6e20('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6e20('0x1b4')][_0x6e20('0x109')](db[_0x6e20('0x1b6')],{'as':_0x6e20('0x1b7'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db['SalesforceConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1b6')],{'as':_0x6e20('0x1b9'),'onDelete':'cascade','foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0x1b4')][_0x6e20('0x109')](db[_0x6e20('0x1b6')],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1bb')});db['SalesforceConfiguration'][_0x6e20('0x117')](db['SalesforceAccount'],{'as':_0x6e20('0x15c'),'foreignKey':'AccountId'});db[_0x6e20('0x1b6')][_0x6e20('0x109')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x6e20('0x1b8')});db['SalesforceField'][_0x6e20('0x109')](db[_0x6e20('0x1b6')],{'as':_0x6e20('0x1bc'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x6e20('0x1b6')],{'as':_0x6e20('0x1bd'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0x1b6')][_0x6e20('0x117')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x6e20('0xa3')]['hasMany'](db[_0x6e20('0xa5')],{'as':'Configurations','onDelete':_0x6e20('0x106'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x6e20('0x109')](db['SugarcrmField'],{'as':_0x6e20('0x1b7'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xa5')][_0x6e20('0x109')](db[_0x6e20('0xa6')],{'as':_0x6e20('0x1b9'),'onDelete':'cascade','foreignKey':_0x6e20('0x1ba')});db['SugarcrmConfiguration'][_0x6e20('0x109')](db['SugarcrmField'],{'as':_0x6e20('0x1b0'),'onDelete':'cascade','foreignKey':_0x6e20('0x1bb')});db['SugarcrmConfiguration'][_0x6e20('0x117')](db[_0x6e20('0xa3')],{'as':'Account','foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xa6')][_0x6e20('0x109')](db[_0x6e20('0xa6')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xa6')][_0x6e20('0x109')](db[_0x6e20('0xa6')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db['SugarcrmField'][_0x6e20('0x109')](db[_0x6e20('0xa6')],{'as':'Field','foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xa6')][_0x6e20('0x117')](db[_0x6e20('0x93')],{'as':_0x6e20('0x93'),'foreignKey':'VariableId'});db[_0x6e20('0xa8')][_0x6e20('0x109')](db[_0x6e20('0xaa')],{'as':_0x6e20('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6e20('0xaa')][_0x6e20('0x109')](db[_0x6e20('0x1c0')],{'as':'Subjects','onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xaa')][_0x6e20('0x109')](db[_0x6e20('0x1c0')],{'as':'Descriptions','onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1ba')});db['DeskConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c0')],{'as':'Fields','onDelete':_0x6e20('0x106'),'foreignKey':'FieldId'});db[_0x6e20('0xaa')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xaa')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x6e20('0x109')](db['DeskField'],{'as':_0x6e20('0x1bf'),'foreignKey':'SubjectId'});db[_0x6e20('0x1c0')]['hasMany'](db[_0x6e20('0x1c0')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db['DeskField'][_0x6e20('0x109')](db['DeskField'],{'as':_0x6e20('0x1bd'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0x1c0')][_0x6e20('0x117')](db[_0x6e20('0x93')],{'as':_0x6e20('0x93'),'foreignKey':'VariableId'});db[_0x6e20('0xad')][_0x6e20('0x109')](db[_0x6e20('0xae')],{'as':_0x6e20('0x1b5'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1be')});db['ZohoConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c1')],{'as':'Subjects','onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db['ZohoConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c1')],{'as':_0x6e20('0x1b9'),'onDelete':'cascade','foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xae')]['hasMany'](db[_0x6e20('0x1c1')],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xae')][_0x6e20('0x117')](db[_0x6e20('0xad')],{'as':'Account','foreignKey':_0x6e20('0x1be')});db[_0x6e20('0x1c1')][_0x6e20('0x109')](db[_0x6e20('0x1c1')],{'as':_0x6e20('0x1bf'),'foreignKey':'SubjectId'});db[_0x6e20('0x1c1')][_0x6e20('0x109')](db[_0x6e20('0x1c1')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0x1c1')][_0x6e20('0x109')](db[_0x6e20('0x1c1')],{'as':_0x6e20('0x1bd'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0x6e20('0x93')],{'as':_0x6e20('0x93'),'foreignKey':_0x6e20('0x1c2')});db[_0x6e20('0xb1')]['hasMany'](db[_0x6e20('0x1c3')],{'as':'Configurations','onDelete':_0x6e20('0x106'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x6e20('0x109')](db['ZendeskField'],{'as':_0x6e20('0x1b7'),'foreignKey':_0x6e20('0x1b8')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x6e20('0x1b9'),'foreignKey':_0x6e20('0x1ba')});db['ZendeskConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c4')],{'as':_0x6e20('0x1b0'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0x1c3')][_0x6e20('0x117')](db[_0x6e20('0xb1')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x1be')});db[_0x6e20('0x1c3')]['belongsToMany'](db['Tag'],{'through':_0x6e20('0x1c5')});db[_0x6e20('0x1c4')][_0x6e20('0x109')](db[_0x6e20('0x1c4')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db['ZendeskField']['hasMany'](db[_0x6e20('0x1c4')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0x1c4')][_0x6e20('0x109')](db[_0x6e20('0x1c4')],{'as':_0x6e20('0x1bd'),'foreignKey':'FieldId'});db[_0x6e20('0x1c4')]['belongsTo'](db[_0x6e20('0x93')],{'as':'Variable','foreignKey':_0x6e20('0x1c2')});db[_0x6e20('0xb3')][_0x6e20('0x109')](db[_0x6e20('0xb4')],{'as':_0x6e20('0x1b5'),'onDelete':'cascade','foreignKey':_0x6e20('0x1be')});db['FreshdeskConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c6')],{'as':_0x6e20('0x1b7'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db['FreshdeskConfiguration'][_0x6e20('0x109')](db[_0x6e20('0x1c6')],{'as':'Descriptions','onDelete':_0x6e20('0x106'),'foreignKey':'DescriptionId'});db[_0x6e20('0xb4')]['hasMany'](db[_0x6e20('0x1c6')],{'as':_0x6e20('0x1b0'),'onDelete':'cascade','foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xb4')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x1be')});db['FreshdeskConfiguration'][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':_0x6e20('0x1c7')});db[_0x6e20('0x1c6')][_0x6e20('0x109')](db[_0x6e20('0x1c6')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db['FreshdeskField'][_0x6e20('0x109')](db[_0x6e20('0x1c6')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0x1c6')][_0x6e20('0x109')](db['FreshdeskField'],{'as':_0x6e20('0x1bd'),'foreignKey':'FieldId'});db[_0x6e20('0x1c6')][_0x6e20('0x117')](db['Variable'],{'as':'Variable','foreignKey':_0x6e20('0x1c2')});db['VtigerAccount'][_0x6e20('0x109')](db[_0x6e20('0xb7')],{'as':_0x6e20('0x1b5'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xb7')]['hasMany'](db[_0x6e20('0xb9')],{'as':_0x6e20('0x1b7'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xb7')][_0x6e20('0x109')](db['VtigerField'],{'as':_0x6e20('0x1b9'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xb7')][_0x6e20('0x109')](db[_0x6e20('0xb9')],{'as':_0x6e20('0x1b0'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x6e20('0x117')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x6e20('0x1be')});db['VtigerField'][_0x6e20('0x109')](db[_0x6e20('0xb9')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xb9')][_0x6e20('0x109')](db[_0x6e20('0xb9')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xb9')][_0x6e20('0x109')](db[_0x6e20('0xb9')],{'as':_0x6e20('0x1bd'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xb9')][_0x6e20('0x117')](db[_0x6e20('0x93')],{'as':_0x6e20('0x93'),'foreignKey':_0x6e20('0x1c2')});db[_0x6e20('0x1c8')]['hasMany'](db[_0x6e20('0xbc')],{'as':_0x6e20('0x1b5'),'onDelete':_0x6e20('0x106'),'foreignKey':'AccountId'});db[_0x6e20('0xbc')]['hasMany'](db[_0x6e20('0x1c9')],{'as':_0x6e20('0x1b7'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xbc')][_0x6e20('0x109')](db['ServicenowField'],{'as':_0x6e20('0x1b9'),'foreignKey':'DescriptionId'});db[_0x6e20('0xbc')][_0x6e20('0x109')](db['ServicenowField'],{'as':_0x6e20('0x1b0'),'foreignKey':_0x6e20('0x1bb')});db['ServicenowConfiguration'][_0x6e20('0x117')](db[_0x6e20('0x1c8')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x1be')});db[_0x6e20('0x1c9')][_0x6e20('0x109')](db[_0x6e20('0x1c9')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0x1c9')][_0x6e20('0x109')](db[_0x6e20('0x1c9')],{'as':_0x6e20('0x1bc'),'foreignKey':'DescriptionId'});db[_0x6e20('0x1c9')]['hasMany'](db['ServicenowField'],{'as':_0x6e20('0x1bd'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0x1c9')]['belongsTo'](db['Variable'],{'as':_0x6e20('0x93'),'foreignKey':'VariableId'});db[_0x6e20('0xbf')][_0x6e20('0x109')](db['Dynamics365Configuration'],{'as':_0x6e20('0x1b5'),'onDelete':_0x6e20('0x106'),'foreignKey':'AccountId'});db[_0x6e20('0xbf')][_0x6e20('0x117')](db['CloudProvider'],{'as':_0x6e20('0xfa'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x6e20('0x1b7'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1b8')});db['Dynamics365Configuration'][_0x6e20('0x109')](db[_0x6e20('0xc1')],{'as':_0x6e20('0x1b9'),'onDelete':_0x6e20('0x106'),'foreignKey':'DescriptionId'});db[_0x6e20('0x1ca')]['hasMany'](db['Dynamics365Field'],{'as':_0x6e20('0x1b0'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1bb')});db['Dynamics365Configuration'][_0x6e20('0x117')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xc1')]['hasMany'](db[_0x6e20('0xc1')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xc1')]['hasMany'](db[_0x6e20('0xc1')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xc1')]['hasMany'](db[_0x6e20('0xc1')],{'as':_0x6e20('0x1bd'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xc1')]['belongsTo'](db[_0x6e20('0x93')],{'as':_0x6e20('0x93'),'foreignKey':_0x6e20('0x1c2')});db[_0x6e20('0xc3')][_0x6e20('0x109')](db['FreshsalesConfiguration'],{'as':_0x6e20('0x1b5'),'onDelete':'cascade','foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xc4')][_0x6e20('0x109')](db[_0x6e20('0xc6')],{'as':'Subjects','foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xc4')][_0x6e20('0x109')](db[_0x6e20('0xc6')],{'as':_0x6e20('0x1b9'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xc4')][_0x6e20('0x109')](db[_0x6e20('0xc6')],{'as':_0x6e20('0x1b0'),'foreignKey':_0x6e20('0x1bb')});db[_0x6e20('0xc4')][_0x6e20('0x117')](db[_0x6e20('0xc3')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x1be')});db[_0x6e20('0xc6')][_0x6e20('0x109')](db[_0x6e20('0xc6')],{'as':_0x6e20('0x1bf'),'foreignKey':_0x6e20('0x1b8')});db[_0x6e20('0xc6')]['hasMany'](db[_0x6e20('0xc6')],{'as':_0x6e20('0x1bc'),'foreignKey':_0x6e20('0x1ba')});db[_0x6e20('0xc6')][_0x6e20('0x109')](db[_0x6e20('0xc6')],{'as':_0x6e20('0x1bd'),'foreignKey':'FieldId'});db[_0x6e20('0xc6')][_0x6e20('0x117')](db[_0x6e20('0x93')],{'as':'Variable','foreignKey':_0x6e20('0x1c2')});db[_0x6e20('0x1cb')]['belongsTo'](db['ChatWebsite'],{});db[_0x6e20('0x1cb')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':'List','foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x1cb')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x14e'),'foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x1cb')][_0x6e20('0x117')](db[_0x6e20('0x63')],{});db['ChatQueueReport'][_0x6e20('0x117')](db[_0x6e20('0x65')],{});db[_0x6e20('0x1cb')][_0x6e20('0x117')](db[_0x6e20('0x104')],{});db[_0x6e20('0x1cb')][_0x6e20('0x117')](db[_0x6e20('0x67')],{});db[_0x6e20('0x188')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':_0x6e20('0x106'),'foreignKey':'FromId'});db[_0x6e20('0x188')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x1cc')});db['JscriptySessionReport'][_0x6e20('0x109')](db['JscriptyQuestionReport'],{'foreignKey':_0x6e20('0x1cd'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0xcf')]['hasMany'](db[_0x6e20('0xcb')],{'foreignKey':_0x6e20('0x1cd'),'onDelete':'cascade'});db[_0x6e20('0x1ce')][_0x6e20('0x117')](db[_0x6e20('0x52')],{});db[_0x6e20('0x1ce')][_0x6e20('0x117')](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0x1ce')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':_0x6e20('0x14f')});db[_0x6e20('0x1ce')]['belongsTo'](db['SmsInteraction'],{});db['SmsQueueReport'][_0x6e20('0x117')](db[_0x6e20('0x55')],{});db[_0x6e20('0x1ce')]['belongsTo'](db['User'],{});db[_0x6e20('0x1ce')][_0x6e20('0x117')](db[_0x6e20('0x56')],{});db[_0x6e20('0x1cf')][_0x6e20('0x109')](db[_0x6e20('0xcf')],{'foreignKey':_0x6e20('0x1d0')});db[_0x6e20('0x1cf')]['hasMany'](db[_0x6e20('0xcd')],{'foreignKey':_0x6e20('0x1d0')});db[_0x6e20('0x1cf')][_0x6e20('0x109')](db[_0x6e20('0xcb')],{'foreignKey':_0x6e20('0x1d0')});db['Team']['belongsToMany'](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x120')});db[_0x6e20('0x11f')]['belongsToMany'](db['VoiceQueue'],{'through':_0x6e20('0xfc'),'as':'VoiceQueues'});db['Team'][_0x6e20('0x119')](db[_0x6e20('0x3d')],{'through':_0x6e20('0x1d1'),'as':_0x6e20('0x1d2')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x6e20('0x187'),'as':'ChatQueues'});db[_0x6e20('0x11f')]['belongsToMany'](db[_0x6e20('0x4e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x6e20('0x56')],{'through':_0x6e20('0x1d3'),'as':_0x6e20('0x1d4')});db[_0x6e20('0x11f')][_0x6e20('0x119')](db[_0x6e20('0x5e')],{'through':_0x6e20('0x17c'),'as':_0x6e20('0x129')});db[_0x6e20('0x11f')]['belongsToMany'](db[_0x6e20('0x12a')],{'through':_0x6e20('0x1d5'),'as':_0x6e20('0x12b')});db[_0x6e20('0x11f')]['belongsToMany'](db[_0x6e20('0xe5')],{'through':_0x6e20('0xfe'),'as':_0x6e20('0x1d6')});db[_0x6e20('0x198')][_0x6e20('0x109')](db['CmHopper'],{'as':_0x6e20('0x116'),'foreignKey':'CampaignId'});db[_0x6e20('0x198')][_0x6e20('0x109')](db[_0x6e20('0x71')],{'as':'HopperFinals','foreignKey':_0x6e20('0x196')});db[_0x6e20('0x198')][_0x6e20('0x109')](db[_0x6e20('0x72')],{'as':_0x6e20('0x1d7'),'foreignKey':_0x6e20('0x196')});db['Campaign']['hasMany'](db[_0x6e20('0x6f')],{'as':_0x6e20('0x139'),'foreignKey':'CampaignId'});db[_0x6e20('0x198')][_0x6e20('0x117')](db['Trunk'],{'as':_0x6e20('0x28'),'foreignKey':_0x6e20('0x13b')});db['Campaign'][_0x6e20('0x117')](db[_0x6e20('0x28')],{'as':_0x6e20('0x13c'),'foreignKey':'TrunkBackupId'});db[_0x6e20('0x198')][_0x6e20('0x117')](db[_0x6e20('0x7f')],{'as':'Interval','foreignKey':_0x6e20('0x13e')});db[_0x6e20('0x198')][_0x6e20('0x117')](db[_0x6e20('0xd8')],{'as':'SquareProject','foreignKey':_0x6e20('0x1d8')});db[_0x6e20('0x198')]['belongsToMany'](db[_0x6e20('0xe4')],{'as':'Lists','through':_0x6e20('0x1d9')});db[_0x6e20('0x198')][_0x6e20('0x119')](db['CmList'],{'as':_0x6e20('0x146'),'through':_0x6e20('0x1da')});db['Attachment']['belongsTo'](db[_0x6e20('0x165')],{'as':'ChatOfflineMessage','foreignKey':_0x6e20('0x186')});db[_0x6e20('0xde')][_0x6e20('0x117')](db[_0x6e20('0x42')],{});db[_0x6e20('0xde')][_0x6e20('0x117')](db[_0x6e20('0x111')],{});db[_0x6e20('0xde')][_0x6e20('0x117')](db['MailAccount'],{'foreignKey':_0x6e20('0x1db'),'as':_0x6e20('0x1dc')});db['MailTransferReport']['belongsTo'](db[_0x6e20('0x104')],{'foreignKey':'FromUserId','as':_0x6e20('0x1dd')});db[_0x6e20('0xde')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6e20('0xde')][_0x6e20('0x117')](db[_0x6e20('0x3d')],{'foreignKey':_0x6e20('0x1de'),'as':_0x6e20('0x1df')});db['MailTransferReport'][_0x6e20('0x117')](db[_0x6e20('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x6e20('0x1e0')});db[_0x6e20('0x1e1')]['belongsTo'](db[_0x6e20('0x65')],{});db[_0x6e20('0x1e1')][_0x6e20('0x117')](db[_0x6e20('0x63')],{});db[_0x6e20('0x1e1')][_0x6e20('0x117')](db[_0x6e20('0x60')],{'foreignKey':_0x6e20('0x1e2'),'as':_0x6e20('0x1dc')});db[_0x6e20('0x1e1')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'foreignKey':_0x6e20('0x1e3'),'as':'FromAgent'});db[_0x6e20('0x1e1')]['belongsTo'](db[_0x6e20('0x104')],{'foreignKey':'ToUserId','as':_0x6e20('0x1e4')});db[_0x6e20('0x1e1')][_0x6e20('0x117')](db[_0x6e20('0x67')],{'foreignKey':_0x6e20('0x1e5'),'as':_0x6e20('0x1df')});db[_0x6e20('0x1e1')][_0x6e20('0x117')](db[_0x6e20('0x60')],{'foreignKey':_0x6e20('0x1e6'),'as':_0x6e20('0x1e0')});db[_0x6e20('0xe0')][_0x6e20('0x117')](db['FaxMessage'],{});db['FaxTransferReport'][_0x6e20('0x117')](db[_0x6e20('0x4a')],{});db[_0x6e20('0xe0')][_0x6e20('0x117')](db[_0x6e20('0x48')],{'foreignKey':_0x6e20('0x1e7'),'as':'FromAccount'});db[_0x6e20('0xe0')][_0x6e20('0x117')](db['User'],{'foreignKey':_0x6e20('0x1e3'),'as':_0x6e20('0x1dd')});db[_0x6e20('0xe0')][_0x6e20('0x117')](db['User'],{'foreignKey':_0x6e20('0x1e8'),'as':_0x6e20('0x1e4')});db['FaxTransferReport'][_0x6e20('0x117')](db[_0x6e20('0x4e')],{'foreignKey':_0x6e20('0x1e9'),'as':'ToQueue'});db['FaxTransferReport']['belongsTo'](db[_0x6e20('0x48')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x6e20('0x1ea')][_0x6e20('0x117')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x6e20('0x117')](db[_0x6e20('0x5a')],{});db[_0x6e20('0x1ea')]['belongsTo'](db[_0x6e20('0x57')],{'foreignKey':_0x6e20('0x1eb'),'as':_0x6e20('0x1dc')});db[_0x6e20('0x1ea')]['belongsTo'](db[_0x6e20('0x104')],{'foreignKey':_0x6e20('0x1e3'),'as':_0x6e20('0x1dd')});db[_0x6e20('0x1ea')][_0x6e20('0x117')](db['User'],{'foreignKey':'ToUserId','as':_0x6e20('0x1e4')});db['OpenchannelTransferReport'][_0x6e20('0x117')](db['OpenchannelQueue'],{'foreignKey':_0x6e20('0x1ec'),'as':_0x6e20('0x1df')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6e20('0x57')],{'foreignKey':_0x6e20('0x1ed'),'as':_0x6e20('0x1e0')});db[_0x6e20('0xe2')][_0x6e20('0x117')](db[_0x6e20('0x55')],{});db[_0x6e20('0xe2')][_0x6e20('0x117')](db[_0x6e20('0x110')],{});db[_0x6e20('0xe2')]['belongsTo'](db[_0x6e20('0x52')],{'foreignKey':_0x6e20('0x1ee'),'as':_0x6e20('0x1dc')});db[_0x6e20('0xe2')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'foreignKey':'FromUserId','as':_0x6e20('0x1dd')});db[_0x6e20('0xe2')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'foreignKey':_0x6e20('0x1e8'),'as':_0x6e20('0x1e4')});db[_0x6e20('0xe2')]['belongsTo'](db[_0x6e20('0x56')],{'foreignKey':_0x6e20('0x1ef'),'as':_0x6e20('0x1df')});db[_0x6e20('0xe2')]['belongsTo'](db[_0x6e20('0x52')],{'foreignKey':_0x6e20('0x1f0'),'as':'ToAccount'});db[_0x6e20('0xe4')][_0x6e20('0x109')](db['Disposition'],{'as':_0x6e20('0x168'),'foreignKey':_0x6e20('0x15a'),'onDelete':'cascade'});db[_0x6e20('0xe4')]['hasMany'](db[_0x6e20('0x76')],{'as':_0x6e20('0x1f1'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0xe4')][_0x6e20('0x109')](db[_0x6e20('0x6d')],{'as':_0x6e20('0x11c'),'onDelete':_0x6e20('0x106'),'foreignKey':_0x6e20('0x15a')});db['CmList'][_0x6e20('0x109')](db[_0x6e20('0x71')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x6e20('0xe4')]['hasMany'](db[_0x6e20('0x72')],{'as':'HopperHistory','foreignKey':_0x6e20('0x15a')});db[_0x6e20('0xe4')]['hasMany'](db[_0x6e20('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x6e20('0x15a')});db[_0x6e20('0xe4')][_0x6e20('0x119')](db[_0x6e20('0x1a')],{'as':_0x6e20('0x1f2'),'through':'voice_queues_has_cm_lists'});db[_0x6e20('0xe4')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':'cm_user_has_lists'});db[_0x6e20('0xe5')][_0x6e20('0x109')](db['VoiceExtension'],{'as':_0x6e20('0x10c'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0xe5')][_0x6e20('0x119')](db['User'],{'as':_0x6e20('0x144'),'through':_0x6e20('0x100')});db[_0x6e20('0xe5')][_0x6e20('0x119')](db[_0x6e20('0x11f')],{'through':_0x6e20('0xfe'),'as':_0x6e20('0x145')});db['UserProfile'][_0x6e20('0x109')](db['User'],{'as':_0x6e20('0x16e'),'foreignKey':_0x6e20('0x118')});db[_0x6e20('0xe7')]['hasMany'](db[_0x6e20('0xe9')],{'as':'UserProfileSections','foreignKey':_0x6e20('0x118'),'onDelete':_0x6e20('0x106')});db[_0x6e20('0xe9')]['hasMany'](db['UserProfileResource'],{'as':_0x6e20('0x1f3'),'foreignKey':_0x6e20('0x1f4'),'onDelete':'cascade'});db['WhatsappAccount'][_0x6e20('0x109')](db[_0x6e20('0x7b')],{'as':_0x6e20('0x168'),'foreignKey':_0x6e20('0x1f5'),'onDelete':'cascade'});db[_0x6e20('0xef')]['hasMany'](db['CannedAnswer'],{'as':_0x6e20('0x156'),'foreignKey':_0x6e20('0x1f5')});db['WhatsappAccount'][_0x6e20('0x109')](db[_0x6e20('0xf5')],{'as':_0x6e20('0x148'),'foreignKey':_0x6e20('0x1f5')});db['WhatsappAccount'][_0x6e20('0x109')](db[_0x6e20('0xf3')],{'as':_0x6e20('0x157')});db[_0x6e20('0xef')]['hasMany'](db[_0x6e20('0xf1')],{'as':'Applications','foreignKey':_0x6e20('0x1f5'),'onDelete':_0x6e20('0x106')});db['WhatsappAccount']['belongsTo'](db[_0x6e20('0xe4')],{'as':'List','foreignKey':_0x6e20('0x15a')});db['WhatsappAccount'][_0x6e20('0x117')](db[_0x6e20('0x13f')],{'as':_0x6e20('0x140'),'foreignKey':_0x6e20('0x141')});db[_0x6e20('0xef')]['belongsToMany'](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':'user_has_whatsapp_accounts'});db[_0x6e20('0xf1')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'onDelete':'restrict'});db[_0x6e20('0xf1')][_0x6e20('0x117')](db[_0x6e20('0x12a')],{'onDelete':_0x6e20('0x152')});db[_0x6e20('0xf1')][_0x6e20('0x117')](db[_0x6e20('0xef')],{'onDelete':'restrict'});db[_0x6e20('0xf1')][_0x6e20('0x117')](db[_0x6e20('0x7f')],{'onDelete':_0x6e20('0x152'),'foreignKey':_0x6e20('0x13e')});db[_0x6e20('0xf1')]['belongsTo'](db[_0x6e20('0x8a')],{'onDelete':'restrict','foreignKey':_0x6e20('0x166')});db[_0x6e20('0xf3')][_0x6e20('0x109')](db[_0x6e20('0xf5')],{'as':_0x6e20('0x148'),'onDelete':'cascade','foreignKey':_0x6e20('0x1f6')});db[_0x6e20('0xf3')][_0x6e20('0x117')](db[_0x6e20('0xef')],{'as':'Account','foreignKey':_0x6e20('0x1f5')});db[_0x6e20('0xf3')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x6e20('0xf3')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x15d'),'foreignKey':'UserId'});db[_0x6e20('0xf3')]['belongsToMany'](db[_0x6e20('0x8a')],{'through':_0x6e20('0x1a8'),'as':'Tags'});db[_0x6e20('0xf3')][_0x6e20('0x119')](db[_0x6e20('0x8a')],{'through':_0x6e20('0x1a8'),'as':_0x6e20('0x15f')});db[_0x6e20('0xf3')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x16e'),'through':_0x6e20('0x126'),'foreignKey':_0x6e20('0x1f6')});db[_0x6e20('0xf5')]['belongsTo'](db[_0x6e20('0x104')],{'as':_0x6e20('0x104')});db[_0x6e20('0xf5')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'onDelete':'cascade','as':_0x6e20('0x14e')});db[_0x6e20('0xf5')][_0x6e20('0x117')](db[_0x6e20('0xf3')],{'onDelete':_0x6e20('0x106'),'as':_0x6e20('0x163'),'foreignKey':_0x6e20('0x1f6')});db['WhatsappMessage'][_0x6e20('0x117')](db[_0x6e20('0xef')],{'as':_0x6e20('0x15c'),'foreignKey':_0x6e20('0x1f5')});db[_0x6e20('0xf6')][_0x6e20('0x117')](db[_0x6e20('0xef')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x6e20('0xe4')],{'as':_0x6e20('0x159'),'foreignKey':_0x6e20('0x15a')});db[_0x6e20('0xf6')][_0x6e20('0x117')](db[_0x6e20('0x6d')],{'as':'Contact','foreignKey':_0x6e20('0x14f')});db[_0x6e20('0xf6')]['belongsTo'](db[_0x6e20('0xf3')],{});db[_0x6e20('0xf6')]['belongsTo'](db[_0x6e20('0x12a')],{});db['WhatsappQueueReport'][_0x6e20('0x117')](db[_0x6e20('0xf5')],{});db[_0x6e20('0xf6')][_0x6e20('0x117')](db[_0x6e20('0x104')],{});db[_0x6e20('0x1f7')]['belongsTo'](db[_0x6e20('0xf5')],{});db[_0x6e20('0x1f7')]['belongsTo'](db[_0x6e20('0xf3')],{});db[_0x6e20('0x1f7')][_0x6e20('0x117')](db[_0x6e20('0xef')],{'foreignKey':_0x6e20('0x1f8'),'as':_0x6e20('0x1dc')});db[_0x6e20('0x1f7')][_0x6e20('0x117')](db['WhatsappAccount'],{'foreignKey':_0x6e20('0x1f9'),'as':_0x6e20('0x1e0')});db[_0x6e20('0x1f7')][_0x6e20('0x117')](db[_0x6e20('0x12a')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x6e20('0x1f7')][_0x6e20('0x117')](db[_0x6e20('0x104')],{'foreignKey':_0x6e20('0x1e3'),'as':_0x6e20('0x1dd')});db[_0x6e20('0x1f7')]['belongsTo'](db[_0x6e20('0x104')],{'foreignKey':'ToUserId','as':_0x6e20('0x1e4')});db[_0x6e20('0x12a')][_0x6e20('0x119')](db[_0x6e20('0x104')],{'as':_0x6e20('0x144'),'through':_0x6e20('0x1fa'),'foreignKey':_0x6e20('0x1fb')});db[_0x6e20('0x12a')][_0x6e20('0x119')](db[_0x6e20('0x11f')],{'through':_0x6e20('0x1d5'),'as':_0x6e20('0x145')});db[_0x6e20('0x1fc')][_0x6e20('0x117')](db['User'],{'as':_0x6e20('0x1fd'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x6e20('0xfa')][_0x6e20('0x105')](db[_0x6e20('0xbf')],{'as':_0x6e20('0xbf'),'onDelete':_0x6e20('0x152')});db['CloudProvider']['hasOne'](db[_0x6e20('0x38')],{'as':_0x6e20('0x153'),'onDelete':_0x6e20('0x152')});db[_0x6e20('0xfa')]['hasOne'](db[_0x6e20('0x3a')],{'as':_0x6e20('0x154'),'onDelete':_0x6e20('0x152')});module[_0x6e20('0x1fe')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e336290..e752a4e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x294b=['/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','/api/system','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport'];(function(_0x59b482,_0x5470b0){var _0x4b8c93=function(_0x46df07){while(--_0x46df07){_0x59b482['push'](_0x59b482['shift']());}};_0x4b8c93(++_0x5470b0);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xb294('0x0'));var express=require('express');var errors=require(_0xb294('0x1'));var config=require(_0xb294('0x2'));var setupLoggers=require(_0xb294('0x3'))[_0xb294('0x4')];var clientSideLogs=require(_0xb294('0x5'));exports[_0xb294('0x6')]=function(_0x58fe24){return setupLoggers(_0x58fe24)['then'](function(){_0x58fe24[_0xb294('0x7')](_0xb294('0x8'),require(_0xb294('0x9')));_0x58fe24[_0xb294('0x7')](_0xb294('0xa'),require('./api/voiceChanSpy'));_0x58fe24[_0xb294('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x58fe24['use'](_0xb294('0xb'),require(_0xb294('0xc')));_0x58fe24[_0xb294('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x58fe24['use'](_0xb294('0xd'),require(_0xb294('0xe')));_0x58fe24[_0xb294('0x7')](_0xb294('0xf'),require(_0xb294('0x10')));_0x58fe24[_0xb294('0x7')](_0xb294('0x11'),require(_0xb294('0x12')));_0x58fe24[_0xb294('0x7')](_0xb294('0x13'),require('./api/voiceMail'));_0x58fe24['use'](_0xb294('0x14'),require('./api/voiceMailMessage'));_0x58fe24['use'](_0xb294('0x15'),require(_0xb294('0x16')));_0x58fe24[_0xb294('0x7')](_0xb294('0x17'),require(_0xb294('0x18')));_0x58fe24[_0xb294('0x7')](_0xb294('0x19'),require(_0xb294('0x1a')));_0x58fe24[_0xb294('0x7')](_0xb294('0x1b'),require(_0xb294('0x1c')));_0x58fe24['use'](_0xb294('0x1d'),require(_0xb294('0x1e')));_0x58fe24['use']('/api/trunks',require(_0xb294('0x1f')));_0x58fe24[_0xb294('0x7')](_0xb294('0x20'),require(_0xb294('0x21')));_0x58fe24[_0xb294('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x58fe24[_0xb294('0x7')](_0xb294('0x22'),require('./api/mailAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x23'),require('./api/mailQueue'));_0x58fe24[_0xb294('0x7')](_0xb294('0x24'),require(_0xb294('0x25')));_0x58fe24['use']('/api/mail/interactions',require(_0xb294('0x26')));_0x58fe24['use'](_0xb294('0x27'),require(_0xb294('0x28')));_0x58fe24[_0xb294('0x7')]('/api/mail/applications',require(_0xb294('0x29')));_0x58fe24['use'](_0xb294('0x2a'),require(_0xb294('0x2b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x2c'),require(_0xb294('0x2d')));_0x58fe24[_0xb294('0x7')](_0xb294('0x2e'),require(_0xb294('0x2f')));_0x58fe24[_0xb294('0x7')]('/api/fax/accounts',require('./api/faxAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x30'),require(_0xb294('0x31')));_0x58fe24[_0xb294('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x58fe24[_0xb294('0x7')](_0xb294('0x32'),require(_0xb294('0x33')));_0x58fe24[_0xb294('0x7')]('/api/fax/queues',require('./api/faxQueue'));_0x58fe24['use'](_0xb294('0x34'),require(_0xb294('0x35')));_0x58fe24[_0xb294('0x7')](_0xb294('0x36'),require(_0xb294('0x37')));_0x58fe24[_0xb294('0x7')](_0xb294('0x38'),require(_0xb294('0x39')));_0x58fe24[_0xb294('0x7')](_0xb294('0x3a'),require(_0xb294('0x3b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x3c'),require('./api/smsMessage'));_0x58fe24['use'](_0xb294('0x3d'),require('./api/smsQueue'));_0x58fe24[_0xb294('0x7')](_0xb294('0x3e'),require(_0xb294('0x3f')));_0x58fe24[_0xb294('0x7')]('/api/openchannel/applications',require(_0xb294('0x40')));_0x58fe24[_0xb294('0x7')](_0xb294('0x41'),require(_0xb294('0x42')));_0x58fe24[_0xb294('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x58fe24['use'](_0xb294('0x43'),require(_0xb294('0x44')));_0x58fe24[_0xb294('0x7')](_0xb294('0x45'),require(_0xb294('0x46')));_0x58fe24[_0xb294('0x7')](_0xb294('0x47'),require('./api/openchannelQueueReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0x48'),require(_0xb294('0x49')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4a'),require(_0xb294('0x4b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4c'),require('./api/chatMessage'));_0x58fe24['use'](_0xb294('0x4d'),require('./api/chatOfflineMessage'));_0x58fe24[_0xb294('0x7')]('/api/chat/queues',require(_0xb294('0x4e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4f'),require(_0xb294('0x50')));_0x58fe24[_0xb294('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x58fe24[_0xb294('0x7')](_0xb294('0x51'),require(_0xb294('0x52')));_0x58fe24[_0xb294('0x7')](_0xb294('0x53'),require(_0xb294('0x54')));_0x58fe24['use']('/api/cm/hopper',require(_0xb294('0x55')));_0x58fe24[_0xb294('0x7')](_0xb294('0x56'),require(_0xb294('0x57')));_0x58fe24['use']('/api/cm/hopper_final',require(_0xb294('0x58')));_0x58fe24['use'](_0xb294('0x59'),require(_0xb294('0x5a')));_0x58fe24['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x58fe24[_0xb294('0x7')](_0xb294('0x5b'),require(_0xb294('0x5c')));_0x58fe24['use'](_0xb294('0x5d'),require(_0xb294('0x5e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x5f'),require(_0xb294('0x60')));_0x58fe24[_0xb294('0x7')](_0xb294('0x61'),require('./api/disposition'));_0x58fe24['use'](_0xb294('0x62'),require(_0xb294('0x63')));_0x58fe24['use']('/api/intervals',require(_0xb294('0x64')));_0x58fe24[_0xb294('0x7')](_0xb294('0x65'),require(_0xb294('0x66')));_0x58fe24['use'](_0xb294('0x67'),require('./api/cdr'));_0x58fe24['use'](_0xb294('0x68'),require(_0xb294('0x69')));_0x58fe24[_0xb294('0x7')](_0xb294('0x6a'),require(_0xb294('0x6b')));_0x58fe24['use'](_0xb294('0x6c'),require(_0xb294('0x6d')));_0x58fe24[_0xb294('0x7')]('/api/tags',require('./api/tag'));_0x58fe24[_0xb294('0x7')](_0xb294('0x6e'),require(_0xb294('0x6f')));_0x58fe24[_0xb294('0x7')](_0xb294('0x70'),require('./api/cmContactHasItem'));_0x58fe24[_0xb294('0x7')](_0xb294('0x71'),require(_0xb294('0x72')));_0x58fe24[_0xb294('0x7')](_0xb294('0x73'),require(_0xb294('0x74')));_0x58fe24[_0xb294('0x7')](_0xb294('0x75'),require(_0xb294('0x76')));_0x58fe24[_0xb294('0x7')]('/api/variables',require(_0xb294('0x77')));_0x58fe24['use'](_0xb294('0x78'),require(_0xb294('0x79')));_0x58fe24[_0xb294('0x7')](_0xb294('0x7a'),require(_0xb294('0x7b')));_0x58fe24['use']('/api/analytics/custom_reports',require(_0xb294('0x7c')));_0x58fe24[_0xb294('0x7')](_0xb294('0x7d'),require(_0xb294('0x7e')));_0x58fe24['use'](_0xb294('0x7f'),require(_0xb294('0x80')));_0x58fe24[_0xb294('0x7')](_0xb294('0x81'),require(_0xb294('0x82')));_0x58fe24[_0xb294('0x7')]('/api/analytics/field_reports',require(_0xb294('0x83')));_0x58fe24[_0xb294('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x58fe24[_0xb294('0x7')]('/api/integrations/salesforce/accounts',require(_0xb294('0x84')));_0x58fe24['use']('/api/integrations/salesforce/configurations',require(_0xb294('0x85')));_0x58fe24[_0xb294('0x7')](_0xb294('0x86'),require(_0xb294('0x87')));_0x58fe24[_0xb294('0x7')](_0xb294('0x88'),require(_0xb294('0x89')));_0x58fe24['use']('/api/integrations/sugarcrm/configurations',require(_0xb294('0x8a')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8b'),require('./api/intSugarcrmField'));_0x58fe24[_0xb294('0x7')]('/api/integrations/desk/accounts',require(_0xb294('0x8c')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8d'),require(_0xb294('0x8e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8f'),require('./api/intDeskField'));_0x58fe24['use']('/api/integrations/zoho/accounts',require(_0xb294('0x90')));_0x58fe24[_0xb294('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x58fe24[_0xb294('0x7')](_0xb294('0x91'),require(_0xb294('0x92')));_0x58fe24[_0xb294('0x7')](_0xb294('0x93'),require('./api/intZendeskAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x94'),require(_0xb294('0x95')));_0x58fe24[_0xb294('0x7')](_0xb294('0x96'),require(_0xb294('0x97')));_0x58fe24['use'](_0xb294('0x98'),require(_0xb294('0x99')));_0x58fe24[_0xb294('0x7')](_0xb294('0x9a'),require(_0xb294('0x9b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x9c'),require('./api/intFreshdeskField'));_0x58fe24['use'](_0xb294('0x9d'),require('./api/intVtigerAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x9e'),require(_0xb294('0x9f')));_0x58fe24['use']('/api/integrations/vtiger/fields',require(_0xb294('0xa0')));_0x58fe24[_0xb294('0x7')](_0xb294('0xa1'),require(_0xb294('0xa2')));_0x58fe24['use'](_0xb294('0xa3'),require('./api/intServicenowConfiguration'));_0x58fe24['use'](_0xb294('0xa4'),require(_0xb294('0xa5')));_0x58fe24[_0xb294('0x7')]('/api/integrations/dynamics365/accounts',require(_0xb294('0xa6')));_0x58fe24['use'](_0xb294('0xa7'),require(_0xb294('0xa8')));_0x58fe24[_0xb294('0x7')]('/api/integrations/dynamics365/fields',require(_0xb294('0xa9')));_0x58fe24['use'](_0xb294('0xaa'),require('./api/intFreshsalesAccount'));_0x58fe24[_0xb294('0x7')]('/api/integrations/freshsales/configurations',require(_0xb294('0xab')));_0x58fe24[_0xb294('0x7')]('/api/integrations/freshsales/fields',require(_0xb294('0xac')));_0x58fe24['use']('/api/networks',require(_0xb294('0xad')));_0x58fe24[_0xb294('0x7')](_0xb294('0xae'),require('./api/chatQueueReport'));_0x58fe24[_0xb294('0x7')]('/api/chat/internal/messages',require(_0xb294('0xaf')));_0x58fe24[_0xb294('0x7')](_0xb294('0xb0'),require(_0xb294('0xb1')));_0x58fe24[_0xb294('0x7')]('/api/jscripty/questions/reports',require(_0xb294('0xb2')));_0x58fe24['use'](_0xb294('0xb3'),require(_0xb294('0xb4')));_0x58fe24['use'](_0xb294('0xb5'),require(_0xb294('0xb6')));_0x58fe24['use'](_0xb294('0xb7'),require(_0xb294('0xb8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xb9'),require(_0xb294('0xba')));_0x58fe24[_0xb294('0x7')]('/api/jscripty/projects',require(_0xb294('0xbb')));_0x58fe24[_0xb294('0x7')](_0xb294('0xbc'),require('./api/setting'));_0x58fe24[_0xb294('0x7')](_0xb294('0xbd'),require(_0xb294('0xbe')));_0x58fe24[_0xb294('0x7')](_0xb294('0xbf'),require(_0xb294('0xc0')));_0x58fe24['use'](_0xb294('0xc1'),require(_0xb294('0xc2')));_0x58fe24[_0xb294('0x7')]('/api/square/messages',require(_0xb294('0xc3')));_0x58fe24[_0xb294('0x7')]('/api/teams',require('./api/team'));_0x58fe24[_0xb294('0x7')](_0xb294('0xc4'),require('./api/license'));_0x58fe24[_0xb294('0x7')]('/api/campaigns',require(_0xb294('0xc5')));_0x58fe24[_0xb294('0x7')](_0xb294('0xc6'),require(_0xb294('0xc7')));_0x58fe24[_0xb294('0x7')]('/api/attachments',require(_0xb294('0xc8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xc9'),require(_0xb294('0xca')));_0x58fe24[_0xb294('0x7')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcb'),require('./api/chatTransferReport'));_0x58fe24['use'](_0xb294('0xcc'),require('./api/faxTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcd'),require(_0xb294('0xce')));_0x58fe24[_0xb294('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcf'),require(_0xb294('0xd0')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd1'),require('./api/voicePrefix'));_0x58fe24[_0xb294('0x7')](_0xb294('0xd2'),require('./api/userProfile'));_0x58fe24[_0xb294('0x7')](_0xb294('0xd3'),require(_0xb294('0xd4')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd5'),require(_0xb294('0xd6')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd7'),require(_0xb294('0xd8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd9'),require(_0xb294('0xda')));_0x58fe24['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x58fe24[_0xb294('0x7')](_0xb294('0xdb'),require(_0xb294('0xdc')));_0x58fe24[_0xb294('0x7')](_0xb294('0xdd'),require(_0xb294('0xde')));_0x58fe24[_0xb294('0x7')]('/api/whatsapp/reports/queue',require(_0xb294('0xdf')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe0'),require(_0xb294('0xe1')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe2'),require(_0xb294('0xe3')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe4'),require(_0xb294('0xe5')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe6'),require(_0xb294('0xe7')));_0x58fe24['use'](_0xb294('0xe8'),require(_0xb294('0xe9')));_0x58fe24['use'](_0xb294('0xea'),require(_0xb294('0xeb')));_0x58fe24[_0xb294('0x7')](_0xb294('0xec'),require(_0xb294('0xed')));_0x58fe24['use']('/api/auth/google',require('./api/authGoogle'));_0x58fe24[_0xb294('0x7')](_0xb294('0xee'),require(_0xb294('0xef')));_0x58fe24[_0xb294('0x7')]('/api/jira',require('./api/jira'));_0x58fe24[_0xb294('0x7')](_0xb294('0xf0'),require(_0xb294('0xf1')));_0x58fe24[_0xb294('0x7')](_0xb294('0xf2'),require('./api/version'));_0x58fe24['use'](_0xb294('0xf3'),require('./api/system'));_0x58fe24[_0xb294('0x7')]('/api/pm2',require('./api/pm2'));_0x58fe24[_0xb294('0x7')]('/api/webbar',require(_0xb294('0xf4')));_0x58fe24['use'](_0xb294('0xf5'),clientSideLogs);_0x58fe24[_0xb294('0x7')](_0xb294('0xf6'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config['root'],_0xb294('0xf6'))));_0x58fe24['use'](_0xb294('0xf9'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config[_0xb294('0xfa')],_0xb294('0xf9'))));_0x58fe24['use'](_0xb294('0xfb'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config[_0xb294('0xfa')],'/demo')));_0x58fe24[_0xb294('0x7')]('/snippet',express[_0xb294('0xf7')](path['join'](config['root'],_0xb294('0xfc'),_0xb294('0xfd'))));_0x58fe24[_0xb294('0x7')](_0xb294('0xfe'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config['root'],_0xb294('0xff'))));_0x58fe24[_0xb294('0x100')](_0xb294('0x101'))[_0xb294('0x102')](errors[0x194]);_0x58fe24[_0xb294('0x100')]('/*')[_0xb294('0x102')](function(_0x18b4d1,_0x32db0b){_0x32db0b['sendFile'](path['resolve'](_0x58fe24[_0xb294('0x102')](_0xb294('0x103'))+_0xb294('0x104')));});return _0x58fe24;});}; \ No newline at end of file +var _0x4317=['./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/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/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','/apidoc','/www','join','root','/demo','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/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/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/conditions','./api/condition','./api/interval','./api/pause','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./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/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts'];(function(_0x1322df,_0x114c31){var _0x507a3f=function(_0x869a08){while(--_0x869a08){_0x1322df['push'](_0x1322df['shift']());}};_0x507a3f(++_0x114c31);}(_0x4317,0x7c));var _0x7431=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4317[_0x465028];return _0xb783d4;};'use strict';var path=require('path');var express=require(_0x7431('0x0'));var errors=require(_0x7431('0x1'));var config=require(_0x7431('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x7431('0x3')];var clientSideLogs=require(_0x7431('0x4'));exports[_0x7431('0x5')]=function(_0xa4197b){return setupLoggers(_0xa4197b)[_0x7431('0x6')](function(){_0xa4197b[_0x7431('0x7')]('/api/users',require('./api/user'));_0xa4197b[_0x7431('0x7')](_0x7431('0x8'),require(_0x7431('0x9')));_0xa4197b[_0x7431('0x7')](_0x7431('0xa'),require(_0x7431('0xb')));_0xa4197b[_0x7431('0x7')](_0x7431('0xc'),require(_0x7431('0xd')));_0xa4197b[_0x7431('0x7')](_0x7431('0xe'),require(_0x7431('0xf')));_0xa4197b[_0x7431('0x7')](_0x7431('0x10'),require(_0x7431('0x11')));_0xa4197b[_0x7431('0x7')](_0x7431('0x12'),require(_0x7431('0x13')));_0xa4197b[_0x7431('0x7')](_0x7431('0x14'),require(_0x7431('0x15')));_0xa4197b[_0x7431('0x7')](_0x7431('0x16'),require(_0x7431('0x17')));_0xa4197b['use'](_0x7431('0x18'),require(_0x7431('0x19')));_0xa4197b[_0x7431('0x7')]('/api/voice/calls/reports',require(_0x7431('0x1a')));_0xa4197b[_0x7431('0x7')](_0x7431('0x1b'),require('./api/voiceDialReport'));_0xa4197b[_0x7431('0x7')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0xa4197b['use'](_0x7431('0x1c'),require(_0x7431('0x1d')));_0xa4197b[_0x7431('0x7')](_0x7431('0x1e'),require('./api/memberReport'));_0xa4197b['use'](_0x7431('0x1f'),require(_0x7431('0x20')));_0xa4197b[_0x7431('0x7')](_0x7431('0x21'),require(_0x7431('0x22')));_0xa4197b[_0x7431('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0xa4197b['use'](_0x7431('0x23'),require(_0x7431('0x24')));_0xa4197b['use'](_0x7431('0x25'),require(_0x7431('0x26')));_0xa4197b[_0x7431('0x7')]('/api/mail/substatuses',require(_0x7431('0x27')));_0xa4197b[_0x7431('0x7')](_0x7431('0x28'),require(_0x7431('0x29')));_0xa4197b['use'](_0x7431('0x2a'),require(_0x7431('0x2b')));_0xa4197b[_0x7431('0x7')](_0x7431('0x2c'),require(_0x7431('0x2d')));_0xa4197b[_0x7431('0x7')](_0x7431('0x2e'),require(_0x7431('0x2f')));_0xa4197b[_0x7431('0x7')](_0x7431('0x30'),require(_0x7431('0x31')));_0xa4197b[_0x7431('0x7')]('/api/dashboards/items',require(_0x7431('0x32')));_0xa4197b['use']('/api/fax/accounts',require(_0x7431('0x33')));_0xa4197b[_0x7431('0x7')]('/api/fax/applications',require(_0x7431('0x34')));_0xa4197b[_0x7431('0x7')](_0x7431('0x35'),require(_0x7431('0x36')));_0xa4197b[_0x7431('0x7')](_0x7431('0x37'),require(_0x7431('0x38')));_0xa4197b[_0x7431('0x7')](_0x7431('0x39'),require(_0x7431('0x3a')));_0xa4197b[_0x7431('0x7')](_0x7431('0x3b'),require('./api/faxQueueReport'));_0xa4197b[_0x7431('0x7')](_0x7431('0x3c'),require(_0x7431('0x3d')));_0xa4197b[_0x7431('0x7')]('/api/sms/applications',require(_0x7431('0x3e')));_0xa4197b[_0x7431('0x7')](_0x7431('0x3f'),require('./api/smsInteraction'));_0xa4197b['use'](_0x7431('0x40'),require('./api/smsMessage'));_0xa4197b['use'](_0x7431('0x41'),require('./api/smsQueue'));_0xa4197b[_0x7431('0x7')](_0x7431('0x42'),require('./api/openchannelAccount'));_0xa4197b[_0x7431('0x7')](_0x7431('0x43'),require('./api/openchannelApplication'));_0xa4197b[_0x7431('0x7')](_0x7431('0x44'),require(_0x7431('0x45')));_0xa4197b[_0x7431('0x7')](_0x7431('0x46'),require('./api/openchannelMessage'));_0xa4197b[_0x7431('0x7')]('/api/openchannel/queues',require(_0x7431('0x47')));_0xa4197b[_0x7431('0x7')](_0x7431('0x48'),require(_0x7431('0x49')));_0xa4197b[_0x7431('0x7')](_0x7431('0x4a'),require(_0x7431('0x4b')));_0xa4197b[_0x7431('0x7')](_0x7431('0x4c'),require(_0x7431('0x4d')));_0xa4197b[_0x7431('0x7')](_0x7431('0x4e'),require(_0x7431('0x4f')));_0xa4197b[_0x7431('0x7')](_0x7431('0x50'),require(_0x7431('0x51')));_0xa4197b[_0x7431('0x7')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0xa4197b[_0x7431('0x7')](_0x7431('0x52'),require('./api/chatQueue'));_0xa4197b['use'](_0x7431('0x53'),require(_0x7431('0x54')));_0xa4197b[_0x7431('0x7')](_0x7431('0x55'),require(_0x7431('0x56')));_0xa4197b[_0x7431('0x7')]('/api/cm/companies',require('./api/cmCompany'));_0xa4197b[_0x7431('0x7')](_0x7431('0x57'),require(_0x7431('0x58')));_0xa4197b['use']('/api/cm/hopper',require(_0x7431('0x59')));_0xa4197b[_0x7431('0x7')](_0x7431('0x5a'),require(_0x7431('0x5b')));_0xa4197b['use'](_0x7431('0x5c'),require('./api/cmHopperFinal'));_0xa4197b[_0x7431('0x7')](_0x7431('0x5d'),require('./api/cmHopperHistory'));_0xa4197b[_0x7431('0x7')](_0x7431('0x5e'),require(_0x7431('0x5f')));_0xa4197b['use'](_0x7431('0x60'),require(_0x7431('0x61')));_0xa4197b['use'](_0x7431('0x62'),require(_0x7431('0x63')));_0xa4197b[_0x7431('0x7')](_0x7431('0x64'),require('./api/cannedAnswer'));_0xa4197b[_0x7431('0x7')]('/api/dispositions',require('./api/disposition'));_0xa4197b[_0x7431('0x7')](_0x7431('0x65'),require(_0x7431('0x66')));_0xa4197b['use']('/api/intervals',require(_0x7431('0x67')));_0xa4197b[_0x7431('0x7')]('/api/pauses',require(_0x7431('0x68')));_0xa4197b[_0x7431('0x7')]('/api/cdr',require('./api/cdr'));_0xa4197b[_0x7431('0x7')]('/api/voiceQueuesLog',require(_0x7431('0x69')));_0xa4197b[_0x7431('0x7')](_0x7431('0x6a'),require('./api/schedule'));_0xa4197b[_0x7431('0x7')]('/api/sounds',require(_0x7431('0x6b')));_0xa4197b[_0x7431('0x7')](_0x7431('0x6c'),require(_0x7431('0x6d')));_0xa4197b[_0x7431('0x7')]('/api/contact_item_types',require('./api/contactItemType'));_0xa4197b[_0x7431('0x7')](_0x7431('0x6e'),require(_0x7431('0x6f')));_0xa4197b[_0x7431('0x7')](_0x7431('0x70'),require(_0x7431('0x71')));_0xa4197b[_0x7431('0x7')]('/api/templates',require(_0x7431('0x72')));_0xa4197b[_0x7431('0x7')](_0x7431('0x73'),require(_0x7431('0x74')));_0xa4197b[_0x7431('0x7')]('/api/variables',require(_0x7431('0x75')));_0xa4197b['use']('/api/integrations',require(_0x7431('0x76')));_0xa4197b[_0x7431('0x7')](_0x7431('0x77'),require(_0x7431('0x78')));_0xa4197b[_0x7431('0x7')](_0x7431('0x79'),require('./api/analyticCustomReport'));_0xa4197b[_0x7431('0x7')](_0x7431('0x7a'),require('./api/analyticDefaultReport'));_0xa4197b[_0x7431('0x7')](_0x7431('0x7b'),require(_0x7431('0x7c')));_0xa4197b[_0x7431('0x7')]('/api/analytics/metrics',require(_0x7431('0x7d')));_0xa4197b['use']('/api/analytics/field_reports',require(_0x7431('0x7e')));_0xa4197b[_0x7431('0x7')](_0x7431('0x7f'),require(_0x7431('0x80')));_0xa4197b[_0x7431('0x7')](_0x7431('0x81'),require(_0x7431('0x82')));_0xa4197b['use'](_0x7431('0x83'),require(_0x7431('0x84')));_0xa4197b['use'](_0x7431('0x85'),require(_0x7431('0x86')));_0xa4197b['use'](_0x7431('0x87'),require(_0x7431('0x88')));_0xa4197b[_0x7431('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0xa4197b[_0x7431('0x7')](_0x7431('0x89'),require(_0x7431('0x8a')));_0xa4197b['use'](_0x7431('0x8b'),require(_0x7431('0x8c')));_0xa4197b[_0x7431('0x7')](_0x7431('0x8d'),require(_0x7431('0x8e')));_0xa4197b[_0x7431('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0xa4197b[_0x7431('0x7')]('/api/integrations/zoho/accounts',require(_0x7431('0x8f')));_0xa4197b[_0x7431('0x7')]('/api/integrations/zoho/configurations',require(_0x7431('0x90')));_0xa4197b[_0x7431('0x7')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xa4197b[_0x7431('0x7')](_0x7431('0x91'),require(_0x7431('0x92')));_0xa4197b[_0x7431('0x7')](_0x7431('0x93'),require(_0x7431('0x94')));_0xa4197b[_0x7431('0x7')](_0x7431('0x95'),require('./api/intZendeskField'));_0xa4197b['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0xa4197b[_0x7431('0x7')](_0x7431('0x96'),require(_0x7431('0x97')));_0xa4197b['use'](_0x7431('0x98'),require(_0x7431('0x99')));_0xa4197b[_0x7431('0x7')](_0x7431('0x9a'),require(_0x7431('0x9b')));_0xa4197b[_0x7431('0x7')](_0x7431('0x9c'),require(_0x7431('0x9d')));_0xa4197b['use'](_0x7431('0x9e'),require(_0x7431('0x9f')));_0xa4197b['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0xa4197b[_0x7431('0x7')](_0x7431('0xa0'),require('./api/intServicenowConfiguration'));_0xa4197b[_0x7431('0x7')](_0x7431('0xa1'),require(_0x7431('0xa2')));_0xa4197b['use'](_0x7431('0xa3'),require(_0x7431('0xa4')));_0xa4197b[_0x7431('0x7')](_0x7431('0xa5'),require(_0x7431('0xa6')));_0xa4197b[_0x7431('0x7')]('/api/integrations/dynamics365/fields',require(_0x7431('0xa7')));_0xa4197b['use'](_0x7431('0xa8'),require(_0x7431('0xa9')));_0xa4197b[_0x7431('0x7')](_0x7431('0xaa'),require('./api/intFreshsalesConfiguration'));_0xa4197b[_0x7431('0x7')](_0x7431('0xab'),require(_0x7431('0xac')));_0xa4197b[_0x7431('0x7')](_0x7431('0xad'),require(_0x7431('0xae')));_0xa4197b[_0x7431('0x7')](_0x7431('0xaf'),require(_0x7431('0xb0')));_0xa4197b[_0x7431('0x7')](_0x7431('0xb1'),require(_0x7431('0xb2')));_0xa4197b[_0x7431('0x7')](_0x7431('0xb3'),require(_0x7431('0xb4')));_0xa4197b[_0x7431('0x7')](_0x7431('0xb5'),require(_0x7431('0xb6')));_0xa4197b[_0x7431('0x7')](_0x7431('0xb7'),require(_0x7431('0xb8')));_0xa4197b[_0x7431('0x7')](_0x7431('0xb9'),require(_0x7431('0xba')));_0xa4197b[_0x7431('0x7')]('/api/square/reports',require(_0x7431('0xbb')));_0xa4197b[_0x7431('0x7')](_0x7431('0xbc'),require(_0x7431('0xbd')));_0xa4197b[_0x7431('0x7')](_0x7431('0xbe'),require(_0x7431('0xbf')));_0xa4197b[_0x7431('0x7')](_0x7431('0xc0'),require(_0x7431('0xc1')));_0xa4197b['use'](_0x7431('0xc2'),require(_0x7431('0xc3')));_0xa4197b[_0x7431('0x7')](_0x7431('0xc4'),require(_0x7431('0xc5')));_0xa4197b[_0x7431('0x7')](_0x7431('0xc6'),require('./api/squareRecording'));_0xa4197b[_0x7431('0x7')](_0x7431('0xc7'),require(_0x7431('0xc8')));_0xa4197b[_0x7431('0x7')](_0x7431('0xc9'),require('./api/team'));_0xa4197b[_0x7431('0x7')](_0x7431('0xca'),require(_0x7431('0xcb')));_0xa4197b[_0x7431('0x7')]('/api/campaigns',require(_0x7431('0xcc')));_0xa4197b[_0x7431('0x7')](_0x7431('0xcd'),require('./api/migration'));_0xa4197b[_0x7431('0x7')](_0x7431('0xce'),require(_0x7431('0xcf')));_0xa4197b[_0x7431('0x7')](_0x7431('0xd0'),require(_0x7431('0xd1')));_0xa4197b[_0x7431('0x7')]('/api/mail/reports/transfer',require(_0x7431('0xd2')));_0xa4197b[_0x7431('0x7')](_0x7431('0xd3'),require(_0x7431('0xd4')));_0xa4197b['use'](_0x7431('0xd5'),require(_0x7431('0xd6')));_0xa4197b['use'](_0x7431('0xd7'),require(_0x7431('0xd8')));_0xa4197b[_0x7431('0x7')](_0x7431('0xd9'),require(_0x7431('0xda')));_0xa4197b[_0x7431('0x7')](_0x7431('0xdb'),require(_0x7431('0xdc')));_0xa4197b[_0x7431('0x7')](_0x7431('0xdd'),require('./api/voicePrefix'));_0xa4197b[_0x7431('0x7')](_0x7431('0xde'),require(_0x7431('0xdf')));_0xa4197b['use'](_0x7431('0xe0'),require(_0x7431('0xe1')));_0xa4197b[_0x7431('0x7')]('/api/userProfile/resources',require(_0x7431('0xe2')));_0xa4197b[_0x7431('0x7')](_0x7431('0xe3'),require(_0x7431('0xe4')));_0xa4197b[_0x7431('0x7')](_0x7431('0xe5'),require(_0x7431('0xe6')));_0xa4197b[_0x7431('0x7')](_0x7431('0xe7'),require(_0x7431('0xe8')));_0xa4197b[_0x7431('0x7')](_0x7431('0xe9'),require('./api/whatsappInteraction'));_0xa4197b[_0x7431('0x7')](_0x7431('0xea'),require(_0x7431('0xeb')));_0xa4197b[_0x7431('0x7')]('/api/whatsapp/reports/queue',require(_0x7431('0xec')));_0xa4197b[_0x7431('0x7')](_0x7431('0xed'),require(_0x7431('0xee')));_0xa4197b[_0x7431('0x7')](_0x7431('0xef'),require(_0x7431('0xf0')));_0xa4197b['use'](_0x7431('0xf1'),require('./api/cloudProvider'));_0xa4197b['use'](_0x7431('0xf2'),require(_0x7431('0xf3')));_0xa4197b[_0x7431('0x7')](_0x7431('0xf4'),require(_0x7431('0xf5')));_0xa4197b[_0x7431('0x7')](_0x7431('0xf6'),require(_0x7431('0xf7')));_0xa4197b[_0x7431('0x7')](_0x7431('0xf8'),require(_0x7431('0xf9')));_0xa4197b[_0x7431('0x7')]('/api/auth/google',require(_0x7431('0xfa')));_0xa4197b[_0x7431('0x7')](_0x7431('0xfb'),require(_0x7431('0xfc')));_0xa4197b[_0x7431('0x7')]('/api/jira',require('./api/jira'));_0xa4197b['use'](_0x7431('0xfd'),require(_0x7431('0xfe')));_0xa4197b['use'](_0x7431('0xff'),require(_0x7431('0x100')));_0xa4197b[_0x7431('0x7')](_0x7431('0x101'),require(_0x7431('0x102')));_0xa4197b[_0x7431('0x7')](_0x7431('0x103'),require(_0x7431('0x104')));_0xa4197b[_0x7431('0x7')](_0x7431('0x105'),require(_0x7431('0x106')));_0xa4197b['use']('/api/logs',clientSideLogs);_0xa4197b[_0x7431('0x7')]('/apidoc',express[_0x7431('0x107')](path['join'](config['root'],_0x7431('0x108'))));_0xa4197b['use'](_0x7431('0x109'),express[_0x7431('0x107')](path[_0x7431('0x10a')](config['root'],_0x7431('0x109'))));_0xa4197b[_0x7431('0x7')]('/demo',express['static'](path[_0x7431('0x10a')](config[_0x7431('0x10b')],_0x7431('0x10c'))));_0xa4197b[_0x7431('0x7')]('/snippet',express[_0x7431('0x107')](path[_0x7431('0x10a')](config[_0x7431('0x10b')],_0x7431('0x10d'),'3.10.1')));_0xa4197b[_0x7431('0x7')](_0x7431('0x10e'),express[_0x7431('0x107')](path[_0x7431('0x10a')](config['root'],_0x7431('0x10f'))));_0xa4197b['route'](_0x7431('0x110'))['get'](errors[0x194]);_0xa4197b[_0x7431('0x111')]('/*')[_0x7431('0x112')](function(_0x5a31ca,_0x5c9071){_0x5c9071[_0x7431('0x113')](path[_0x7431('0x114')](_0xa4197b[_0x7431('0x112')](_0x7431('0x115'))+_0x7431('0x116')));});return _0xa4197b;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fd4abe1..34101b7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd59=['../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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/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/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x343577,_0x38d27c){var _0x1ee35b=function(_0x3df59c){while(--_0x3df59c){_0x343577['push'](_0x343577['shift']());}};_0x1ee35b(++_0x38d27c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5ebf85,_0x598413){_0x5ebf85=_0x5ebf85-0x0;var _0x5b175a=_0xcd59[_0x5ebf85];return _0x5b175a;};'use strict';var jayson=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var config=require(_0x9cd5('0x2'));exports[_0x9cd5('0x3')]=function(){return new Promise(function(_0x271070,_0x302b21){var _0x4b93b9={};_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x5')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x6')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x7')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x8')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x9')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0xa')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xb')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xc')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xd')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/trunk/trunk.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xe')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xf')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/mailServerIn/mailServerIn.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x10')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x11')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x12')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x13')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x14')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x15')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/faxApplication/faxApplication.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x16')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/faxMessage/faxMessage.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x17')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x18')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x19')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x1a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1c')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x1d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1e')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1f')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x20')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x21')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x22')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x23')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/chatQueue/chatQueue.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x24')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x25')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x26')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x27')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x28')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/pause/pause.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x29')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2c')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2e')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2f')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x30')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x31')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x32')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x33')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x34')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x35')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x36')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x37')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x38')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x39')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/campaign/campaign.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/attachment/attachment.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x3b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3c')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3e')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x3f')));var _0x3f50de=jayson[_0x9cd5('0x40')](_0x4b93b9)[_0x9cd5('0x41')]();var _0x2c6626=config[_0x9cd5('0x42')]['port']||config[_0x9cd5('0x43')]+0x1;var _0x2cbc5f=config[_0x9cd5('0x42')]['ip']||_0x9cd5('0x44');_0x3f50de['on'](_0x9cd5('0x45'),function(_0x4182bd){return _0x302b21(_0x4182bd);});_0x3f50de[_0x9cd5('0x3')](_0x2c6626,_0x2cbc5f,function(){console[_0x9cd5('0x46')](_0x9cd5('0x47'),_0x2cbc5f,_0x2c6626);require(_0x9cd5('0x48'))[_0x9cd5('0x49')]();return _0x271070(_0x9cd5('0x4a')+_0x2cbc5f+':'+_0x2c6626);});});}; \ No newline at end of file +var _0x5ce1=['../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/userVoiceQueueRt/userVoiceQueueRt.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/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.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/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc'];(function(_0x1b988c,_0x1e1cf0){var _0x3a4e73=function(_0x200327){while(--_0x200327){_0x1b988c['push'](_0x1b988c['shift']());}};_0x3a4e73(++_0x1e1cf0);}(_0x5ce1,0xd4));var _0x15ce=function(_0x465fac,_0x442b2e){_0x465fac=_0x465fac-0x0;var _0x24282d=_0x5ce1[_0x465fac];return _0x24282d;};'use strict';var jayson=require('jayson/promise');var _=require(_0x15ce('0x0'));var config=require(_0x15ce('0x1'));exports[_0x15ce('0x2')]=function(){return new Promise(function(_0x59931c,_0x2ebe6b){var _0x21cd45={};_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x4')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x5')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/voiceQueue/voiceQueue.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x6')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x7')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x8')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x9')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0xa')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0xb')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0xc')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0xd')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/mailServerIn/mailServerIn.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0xe')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0xf')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x10')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x11')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x12')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x13')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x14')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x15')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x16')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x17')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x18')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x19')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/smsAccount/smsAccount.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x1a')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x1b')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x1c')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x1d')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x1e')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x1f')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x20')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x21')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x22')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x23')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x24')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x25')));_0x21cd45=_['merge'](_0x21cd45,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x26')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x27')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x28')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x29')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2a')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2b')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/template/template.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2c')));_0x21cd45=_['merge'](_0x21cd45,require('../api/variable/variable.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2d')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2e')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x2f')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x30')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x31')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x32')));_0x21cd45=_['merge'](_0x21cd45,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x33')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x34')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x35')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x36')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x37')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/squareOdbc/squareOdbc.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x38')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x39')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x3a')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x3b')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x3c')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x3d')));_0x21cd45=_['merge'](_0x21cd45,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x3e')));_0x21cd45=_['merge'](_0x21cd45,require(_0x15ce('0x3f')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require(_0x15ce('0x40')));_0x21cd45=_[_0x15ce('0x3')](_0x21cd45,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x45291b=jayson['server'](_0x21cd45)['http']();var _0x215c4b=config[_0x15ce('0x41')]['port']||config[_0x15ce('0x42')]+0x1;var _0x4d0132=config['rpc']['ip']||_0x15ce('0x43');_0x45291b['on'](_0x15ce('0x44'),function(_0x1dc09b){return _0x2ebe6b(_0x1dc09b);});_0x45291b[_0x15ce('0x2')](_0x215c4b,_0x4d0132,function(){console['log'](_0x15ce('0x45'),_0x4d0132,_0x215c4b);require(_0x15ce('0x46'))[_0x15ce('0x47')]();return _0x59931c(_0x15ce('0x48')+_0x4d0132+':'+_0x215c4b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e6902e5..155d523 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 _0x89d6=['code','close','emit','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sendRequest','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR'];(function(_0x43045e,_0xf8a854){var _0x267f39=function(_0x8fb6e6){while(--_0x8fb6e6){_0x43045e['push'](_0x43045e['shift']());}};_0x267f39(++_0xf8a854);}(_0x89d6,0x119));var _0x689d=function(_0x1517a4,_0x1db496){_0x1517a4=_0x1517a4-0x0;var _0x49c07c=_0x89d6[_0x1517a4];return _0x49c07c;};'use strict';var util=require(_0x689d('0x0'));var _=require(_0x689d('0x1'));var EventEmitter=require(_0x689d('0x2'))[_0x689d('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x689d('0x4'));function AGIChannel(_0x33b6ca){var _0x36ca6d=this,_0x48dd20=new AGIReply(),_0x2d9ee9=![],_0x3da648={};EventEmitter[_0x689d('0x5')](_0x36ca6d);_0x33b6ca[_0x689d('0x6')](_0x689d('0x7'));_0x33b6ca[_0x689d('0x8')](0x8*0x3c*0x3c*0x3e8);_0x48dd20['setEncoding'](_0x689d('0x7'));_0x48dd20['on'](_0x689d('0x9'),function(_0xaa8c77){for(var _0x5258ce in _0xaa8c77){_0x36ca6d[_0x5258ce]=_0xaa8c77[_0x5258ce];}_0x36ca6d['emit'](_0x689d('0xa'));});_0x48dd20['on'](_0x689d('0xb'),function(_0x46e636){if(_0x46e636[_0x689d('0xc')]()=='hangup'){_0x36ca6d['emit'](_0x689d('0xd'));return;}if(_0x46e636[_0x689d('0xe')](0x0,0xb)==_0x689d('0xf')){_0x2d9ee9=!![];}if(_0x2d9ee9){_0x3da648['rx']+=_0x46e636+'\x0a';if(_0x46e636[_0x689d('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x2d9ee9=![];}}else{_0x3da648['rx']=_0x46e636;}if(_0x2d9ee9){return;}if(typeof _0x3da648['cb']==_0x689d('0x11')){var _0x1e5c7a=_0x3da648['rx'][_0x689d('0xe')](0x0,0x3),_0x4a3284=null,_0x2f0f8=null;_0x1e5c7a=parseInt(_0x1e5c7a);if(isNaN(_0x1e5c7a)){_0x3da648['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x689d('0x12')});return;}if(_0x1e5c7a!=0xc8){_0x3da648['cb'](null,{'code':_0x1e5c7a,'result':-0x1,'extra':'KO'});return;}_0x4a3284=_0x3da648['rx'][_0x689d('0xe')](0x4)[_0x689d('0x13')]('result=','');if(_0x4a3284[_0x689d('0x14')]('\x20')!=-0x1){_0x4a3284=_0x4a3284[_0x689d('0x15')](0x0,_0x4a3284['indexOf']('\x20'));}if(_['startsWith'](_0x4a3284,'-1')){_0x4a3284=parseInt(_0x4a3284);}_0x2f0f8=_0x3da648['rx'][_0x689d('0x16')]('\x20');if(_0x2f0f8[_0x689d('0x17')]==0x3){_0x2f0f8=_0x2f0f8[0x2][_0x689d('0xe')](0x1,_0x2f0f8[0x2][_0x689d('0x17')]-0x1);}else if(_0x2f0f8[_0x689d('0x17')]>0x3){var _0x561301=/\((.+)\)/;var _0x1b0e8d=_0x3da648['rx'][_0x689d('0x18')](_0x561301);if(_0x1b0e8d){_0x2f0f8=_0x1b0e8d[0x1];}else{_0x2f0f8=null;}}else{_0x2f0f8=null;}_0x3da648['cb'](null,{'code':_0x1e5c7a,'result':_0x4a3284,'extra':_0x2f0f8});}});_0x33b6ca['on']('error',function(_0x3110df){_0x36ca6d['emit'](_0x689d('0x19'),new AGIError(_0x689d('0x1a'),_0x3110df[_0x689d('0x1b')]));});_0x33b6ca['on'](_0x689d('0x1c'),function(){_0x36ca6d[_0x689d('0x1d')](_0x689d('0x1c'),new AGIError(_0x689d('0x1e')));});_0x33b6ca['on']('timeout',function(){_0x36ca6d[_0x689d('0x1d')]('timeout',new AGIError(_0x689d('0x1f')));_0x33b6ca['destroy']();});_0x33b6ca[_0x689d('0x20')](_0x48dd20);this[_0x689d('0x21')]=function(_0x4469e4,_0x55ebc6){var _0x4469e4=_0x4469e4||'',_0x55ebc6=typeof _0x55ebc6==_0x689d('0x11')?_0x55ebc6:new Function();_0x3da648={'tx':_0x4469e4,'rx':'','cb':_0x55ebc6};_0x33b6ca[_0x689d('0x22')](_0x4469e4+'\x0a');},this[_0x689d('0x1c')]=function(){_0x33b6ca[_0x689d('0x23')]();};}util[_0x689d('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x689d('0x25')]=function(_0x22a3cf){return this[_0x689d('0x21')]['sync'](this,_0x22a3cf);};AGIChannel[_0x689d('0x26')][_0x689d('0x27')]=function(){return this[_0x689d('0x25')](_0x689d('0x28'));};AGIChannel[_0x689d('0x26')]['getData']=function(_0x477190,_0x4fc325,_0x22f0fc){_0x477190=_0x477190===undefined?_0x689d('0x29'):_0x477190;_0x4fc325=_0x4fc325===undefined?'5':_0x4fc325;_0x22f0fc=_0x22f0fc===undefined?'1':_0x22f0fc;return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2b'),_0x477190,_0x4fc325*0x3e8,_0x22f0fc));};AGIChannel['prototype'][_0x689d('0x2c')]=function(_0x539279){_0x539279=_0x539279||'NO\x20MESSAGE';return this['sendRequest'](util[_0x689d('0x2a')](_0x689d('0x2d'),_0x539279));};AGIChannel[_0x689d('0x26')][_0x689d('0x2e')]=function(_0x5057df,_0x5963cf){if(_['isArray'](_0x5963cf)){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2f'),_0x5057df,_0x5963cf[_0x689d('0x30')](',')));}return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2f'),_0x5057df,_0x5963cf));};AGIChannel['prototype'][_0x689d('0x31')]=function(_0x368fef){return this['sendRequest'](util[_0x689d('0x2a')](_0x689d('0x32'),_0x368fef));};AGIChannel['prototype'][_0x689d('0x33')]=function(_0x10f861){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x34'),_0x10f861));};AGIChannel[_0x689d('0x26')][_0x689d('0x35')]=function(_0x455183){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x36'),_0x455183));};AGIChannel[_0x689d('0x26')][_0x689d('0xd')]=function(){return this[_0x689d('0x25')](_0x689d('0x37'));};AGIChannel['prototype'][_0x689d('0x38')]=function(_0x9d169f,_0x26ebff){var _0x435827=_[_0x689d('0x39')](_0x26ebff)||_['isNumber'](_0x26ebff)?_0x26ebff[_0x689d('0x3a')]():_0x26ebff;return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x3b'),_0x9d169f,_0x435827?_0x435827[_0x689d('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x689d('0x3c')]=function(_0x8e73f,_0x3a4059){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x8e73f,_0x3a4059));};AGIChannel[_0x689d('0x26')]['sayDigits']=function(_0x1b0d16,_0x39ad63){return this[_0x689d('0x25')](util[_0x689d('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x1b0d16,_0x39ad63));};AGIChannel[_0x689d('0x26')][_0x689d('0x3d')]=function(_0x53d54b,_0x4a3844){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x53d54b,_0x4a3844));};AGIChannel[_0x689d('0x26')][_0x689d('0x3e')]=function(_0x54260e,_0x490a90,_0x31d6a3){_0x490a90=_0x490a90||this[_0x689d('0x3f')];_0x31d6a3=_0x31d6a3||0x1;this[_0x689d('0x31')](_0x54260e);this['setExtension'](_0x490a90);this['setPriority'](_0x31d6a3);return this['noop'](util[_0x689d('0x2a')](_0x689d('0x40'),_0x54260e,_0x490a90,_0x31d6a3));};AGIChannel[_0x689d('0x26')]['getVariable']=function(_0x202a79){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x41'),_0x202a79));};AGIChannel['prototype'][_0x689d('0x42')]=function(_0x39bf4e,_0xa03f8d,_0x30bee2,_0x2f5e21,_0x1a8680,_0x155d7d){_0xa03f8d=_0xa03f8d||_0x689d('0x43');_0x30bee2=_0x30bee2||'';_0x2f5e21=_0x2f5e21===undefined?-0x1:_0x2f5e21==='-1'?-0x1:_0x2f5e21*0x3e8;_0x1a8680=_0x1a8680===undefined?'':'s='+_0x1a8680;_0x155d7d=_0x155d7d?_0x689d('0x44'):'';return this[_0x689d('0x25')](util[_0x689d('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x39bf4e,_0xa03f8d,_0x30bee2,_0x2f5e21,_0x155d7d,_0x1a8680));};AGIChannel[_0x689d('0x26')][_0x689d('0x45')]=function(_0x38379d,_0x305db){_0x305db=_0x305db||'';return this['sendRequest'](util['format'](_0x689d('0x46'),_0x38379d,_0x305db));};AGIChannel[_0x689d('0x26')][_0x689d('0x47')]=function(_0x4cd7b9){return this['exec'](_0x689d('0x48'),_0x4cd7b9);};AGIChannel[_0x689d('0x26')]['wait']=function(_0x24822c){return this[_0x689d('0x2e')](_0x689d('0x49'),_0x24822c);};AGIChannel[_0x689d('0x26')][_0x689d('0x19')]=function(_0xf85bf6,_0x24167a){this[_0x689d('0x2c')](util[_0x689d('0x2a')](_0x689d('0x4a'),_0xf85bf6['id'],_0xf85bf6[_0x689d('0x4b')],_0x24167a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x689d('0x4c')]=AGIChannel; \ No newline at end of file +var _0x0a1c=['520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','exports','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x0a1c[_0x4d45c1];return _0x244478;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0xc0a1('0x0'))[_0xc0a1('0x1')];var AGIReply=require(_0xc0a1('0x2'));var AGIError=require('./error');function AGIChannel(_0x52e487){var _0x3e1b0a=this,_0x411ce9=new AGIReply(),_0x108afd=![],_0x1df4bf={};EventEmitter[_0xc0a1('0x3')](_0x3e1b0a);_0x52e487[_0xc0a1('0x4')](_0xc0a1('0x5'));_0x52e487[_0xc0a1('0x6')](0x8*0x3c*0x3c*0x3e8);_0x411ce9[_0xc0a1('0x4')](_0xc0a1('0x5'));_0x411ce9['on'](_0xc0a1('0x7'),function(_0x42c215){for(var _0x14e116 in _0x42c215){_0x3e1b0a[_0x14e116]=_0x42c215[_0x14e116];}_0x3e1b0a[_0xc0a1('0x8')](_0xc0a1('0x9'));});_0x411ce9['on'](_0xc0a1('0xa'),function(_0x1bb849){if(_0x1bb849['toLowerCase']()==_0xc0a1('0xb')){_0x3e1b0a[_0xc0a1('0x8')](_0xc0a1('0xb'));return;}if(_0x1bb849['substring'](0x0,0xb)==_0xc0a1('0xc')){_0x108afd=!![];}if(_0x108afd){_0x1df4bf['rx']+=_0x1bb849+'\x0a';if(_0x1bb849[_0xc0a1('0xd')](_0xc0a1('0xe'))!=-0x1){_0x108afd=![];}}else{_0x1df4bf['rx']=_0x1bb849;}if(_0x108afd){return;}if(typeof _0x1df4bf['cb']=='function'){var _0x1565f4=_0x1df4bf['rx'][_0xc0a1('0xf')](0x0,0x3),_0x138338=null,_0x4969b9=null;_0x1565f4=parseInt(_0x1565f4);if(isNaN(_0x1565f4)){_0x1df4bf['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc0a1('0x10')});return;}if(_0x1565f4!=0xc8){_0x1df4bf['cb'](null,{'code':_0x1565f4,'result':-0x1,'extra':'KO'});return;}_0x138338=_0x1df4bf['rx'][_0xc0a1('0xf')](0x4)[_0xc0a1('0x11')](_0xc0a1('0x12'),'');if(_0x138338['indexOf']('\x20')!=-0x1){_0x138338=_0x138338['substr'](0x0,_0x138338[_0xc0a1('0x13')]('\x20'));}if(_[_0xc0a1('0x14')](_0x138338,'-1')){_0x138338=parseInt(_0x138338);}_0x4969b9=_0x1df4bf['rx']['split']('\x20');if(_0x4969b9['length']==0x3){_0x4969b9=_0x4969b9[0x2][_0xc0a1('0xf')](0x1,_0x4969b9[0x2][_0xc0a1('0x15')]-0x1);}else if(_0x4969b9['length']>0x3){var _0x334cc4=/\((.+)\)/;var _0xcec062=_0x1df4bf['rx'][_0xc0a1('0x16')](_0x334cc4);if(_0xcec062){_0x4969b9=_0xcec062[0x1];}else{_0x4969b9=null;}}else{_0x4969b9=null;}_0x1df4bf['cb'](null,{'code':_0x1565f4,'result':_0x138338,'extra':_0x4969b9});}});_0x52e487['on'](_0xc0a1('0x17'),function(_0x234067){_0x3e1b0a[_0xc0a1('0x8')](_0xc0a1('0x17'),new AGIError(_0xc0a1('0x18'),_0x234067[_0xc0a1('0x19')]));});_0x52e487['on'](_0xc0a1('0x1a'),function(){_0x3e1b0a[_0xc0a1('0x8')](_0xc0a1('0x1a'),new AGIError(_0xc0a1('0x1b')));});_0x52e487['on'](_0xc0a1('0x1c'),function(){_0x3e1b0a[_0xc0a1('0x8')](_0xc0a1('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x52e487[_0xc0a1('0x1d')]();});_0x52e487['pipe'](_0x411ce9);this[_0xc0a1('0x1e')]=function(_0xc9d7b0,_0x19e24b){var _0xc9d7b0=_0xc9d7b0||'',_0x19e24b=typeof _0x19e24b=='function'?_0x19e24b:new Function();_0x1df4bf={'tx':_0xc9d7b0,'rx':'','cb':_0x19e24b};_0x52e487[_0xc0a1('0x1f')](_0xc9d7b0+'\x0a');},this[_0xc0a1('0x1a')]=function(){_0x52e487[_0xc0a1('0x1d')]();};}util[_0xc0a1('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x22')]=function(_0x273fa6){return this[_0xc0a1('0x1e')][_0xc0a1('0x23')](this,_0x273fa6);};AGIChannel[_0xc0a1('0x21')]['answer']=function(){return this['sendRequest'](_0xc0a1('0x24'));};AGIChannel[_0xc0a1('0x21')]['getData']=function(_0x52ba51,_0x240605,_0x9fc1d3){_0x52ba51=_0x52ba51===undefined?'beep':_0x52ba51;_0x240605=_0x240605===undefined?'5':_0x240605;_0x9fc1d3=_0x9fc1d3===undefined?'1':_0x9fc1d3;return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')](_0xc0a1('0x26'),_0x52ba51,_0x240605*0x3e8,_0x9fc1d3));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x27')]=function(_0x1814ac){_0x1814ac=_0x1814ac||_0xc0a1('0x28');return this[_0xc0a1('0x22')](util['format'](_0xc0a1('0x29'),_0x1814ac));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x2a')]=function(_0x185ee4,_0x254c32){if(_[_0xc0a1('0x2b')](_0x254c32)){return this['sendRequest'](util['format'](_0xc0a1('0x2c'),_0x185ee4,_0x254c32[_0xc0a1('0x2d')](',')));}return this['sendRequest'](util[_0xc0a1('0x25')]('EXEC\x20%s\x20%s',_0x185ee4,_0x254c32));};AGIChannel[_0xc0a1('0x21')]['setContext']=function(_0x44a1b6){return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')]('SET\x20CONTEXT\x20%s',_0x44a1b6));};AGIChannel[_0xc0a1('0x21')]['setExtension']=function(_0x26b613){return this[_0xc0a1('0x22')](util['format'](_0xc0a1('0x2e'),_0x26b613));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x2f')]=function(_0x3b4247){return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')]('SET\x20PRIORITY\x20%s',_0x3b4247));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0xb')]=function(){return this[_0xc0a1('0x22')](_0xc0a1('0x30'));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x31')]=function(_0x5f56a1,_0x5e1ac6){var _0x198c10=_[_0xc0a1('0x32')](_0x5e1ac6)||_[_0xc0a1('0x33')](_0x5e1ac6)?_0x5e1ac6['toString']():_0x5e1ac6;return this['sendRequest'](util[_0xc0a1('0x25')](_0xc0a1('0x34'),_0x5f56a1,_0x198c10?_0x198c10[_0xc0a1('0x35')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x36')]=function(_0x5893ab,_0x2cbeaa){return this[_0xc0a1('0x22')](util['format'](_0xc0a1('0x37'),_0x5893ab,_0x2cbeaa));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x38')]=function(_0x2b0f37,_0x442c1c){return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')](_0xc0a1('0x39'),_0x2b0f37,_0x442c1c));};AGIChannel['prototype']['sayPhonetic']=function(_0x300df9,_0x400e0d){return this['sendRequest'](util[_0xc0a1('0x25')](_0xc0a1('0x3a'),_0x300df9,_0x400e0d));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x3b')]=function(_0x418d2e,_0x7c3600,_0x5db7c2){_0x7c3600=_0x7c3600||this[_0xc0a1('0x3c')];_0x5db7c2=_0x5db7c2||0x1;this[_0xc0a1('0x3d')](_0x418d2e);this['setExtension'](_0x7c3600);this[_0xc0a1('0x2f')](_0x5db7c2);return this[_0xc0a1('0x27')](util[_0xc0a1('0x25')](_0xc0a1('0x3e'),_0x418d2e,_0x7c3600,_0x5db7c2));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x3f')]=function(_0x41d73d){return this['sendRequest'](util['format'](_0xc0a1('0x40'),_0x41d73d));};AGIChannel['prototype'][_0xc0a1('0x41')]=function(_0x4a5fd7,_0x5c5728,_0x1860b2,_0x41c8fa,_0x2ae366,_0x3d050e){_0x5c5728=_0x5c5728||_0xc0a1('0x42');_0x1860b2=_0x1860b2||'';_0x41c8fa=_0x41c8fa===undefined?-0x1:_0x41c8fa==='-1'?-0x1:_0x41c8fa*0x3e8;_0x2ae366=_0x2ae366===undefined?'':'s='+_0x2ae366;_0x3d050e=_0x3d050e?_0xc0a1('0x43'):'';return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')](_0xc0a1('0x44'),_0x4a5fd7,_0x5c5728,_0x1860b2,_0x41c8fa,_0x3d050e,_0x2ae366));};AGIChannel[_0xc0a1('0x21')][_0xc0a1('0x45')]=function(_0x3e0480,_0x1c987f){_0x1c987f=_0x1c987f||'';return this[_0xc0a1('0x22')](util[_0xc0a1('0x25')](_0xc0a1('0x46'),_0x3e0480,_0x1c987f));};AGIChannel['prototype'][_0xc0a1('0x47')]=function(_0x279d75){return this['exec']('AGI',_0x279d75);};AGIChannel[_0xc0a1('0x21')]['wait']=function(_0xbac6ae){return this[_0xc0a1('0x2a')](_0xc0a1('0x48'),_0xbac6ae);};AGIChannel['prototype'][_0xc0a1('0x17')]=function(_0x3256db,_0x5b1244){this[_0xc0a1('0x27')](util[_0xc0a1('0x25')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3256db['id'],_0x3256db['label'],_0x5b1244));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc0a1('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 8be8228..e4afc8c 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 _0xbd4d=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x1f0391,_0xa401fd){var _0x5729e0=function(_0xbabee2){while(--_0xbabee2){_0x1f0391['push'](_0x1f0391['shift']());}};_0x5729e0(++_0xa401fd);}(_0xbd4d,0xd8));var _0xdbd4=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xbd4d[_0x38ced4];return _0x547c07;};'use strict';var util=require(_0xdbd4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xdbd4('0x1'),'E_AGI_SERVER_ERROR':_0xdbd4('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xdbd4('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xdbd4('0x4'),'E_AGI_SOCKET_CLOSE':_0xdbd4('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xdbd4('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdbd4('0x7'),'E_AGI_IVR_ENTRY':_0xdbd4('0x8')};function AGIError(_0x34bb0b){var _0x34bb0b=_0x34bb0b||null,_0x46d4f1=_0x46d4f1||[],_0x4372cf=0x1,_0x37721e='';if(!error[_0x34bb0b]){_0x34bb0b=_0xdbd4('0x9');}_0x46d4f1['push'](error[_0x34bb0b]);while(arguments[_0x4372cf]){_0x46d4f1['push'](arguments[_0x4372cf]);_0x4372cf++;}_0x37721e=util[_0xdbd4('0xa')][_0xdbd4('0xb')](util,_0x46d4f1);this[_0xdbd4('0xc')]=_0x37721e;this[_0xdbd4('0xd')]=_0x34bb0b;}module['exports']=AGIError; \ No newline at end of file +var _0xee7d=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x37e283,_0x12bd1e){var _0x344757=function(_0x18f0dc){while(--_0x18f0dc){_0x37e283['push'](_0x37e283['shift']());}};_0x344757(++_0x12bd1e);}(_0xee7d,0xc6));var _0xdee7=function(_0xe2fdef,_0x2de9e9){_0xe2fdef=_0xe2fdef-0x0;var _0x1db545=_0xee7d[_0xe2fdef];return _0x1db545;};'use strict';var util=require(_0xdee7('0x0'));var error={'E_AGI_UNDEFINED':_0xdee7('0x1'),'E_AGI_ARGUMENT_PORT':_0xdee7('0x2'),'E_AGI_SERVER_ERROR':_0xdee7('0x3'),'E_AGI_SERVER_CLOSE':_0xdee7('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xdee7('0x5'),'E_AGI_SOCKET_ERROR':_0xdee7('0x6'),'E_AGI_SOCKET_CLOSE':_0xdee7('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xdee7('0x8'),'E_AGI_COMMAND_EMPTY':_0xdee7('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xdee7('0xa')};function AGIError(_0x1a18a9){var _0x1a18a9=_0x1a18a9||null,_0x1f9a10=_0x1f9a10||[],_0x2de8a3=0x1,_0x3ae6d3='';if(!error[_0x1a18a9]){_0x1a18a9=_0xdee7('0xb');}_0x1f9a10[_0xdee7('0xc')](error[_0x1a18a9]);while(arguments[_0x2de8a3]){_0x1f9a10[_0xdee7('0xc')](arguments[_0x2de8a3]);_0x2de8a3++;}_0x3ae6d3=util[_0xdee7('0xd')][_0xdee7('0xe')](util,_0x1f9a10);this['message']=_0x3ae6d3;this[_0xdee7('0xf')]=_0x1a18a9;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8ae2a66..7833aeb 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 _0x4159=['redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter','../../config/environment'];(function(_0x536a34,_0x2f63ee){var _0x48aaf6=function(_0x6a5dc3){while(--_0x6a5dc3){_0x536a34['push'](_0x536a34['shift']());}};_0x48aaf6(++_0x2f63ee);}(_0x4159,0x66));var _0x9415=function(_0x39a2a4,_0x2a7f6d){_0x39a2a4=_0x39a2a4-0x0;var _0x5b2f1b=_0x4159[_0x39a2a4];return _0x5b2f1b;};'use strict';var _=require(_0x9415('0x0'));var EventEmitter=require('events')[_0x9415('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x9415('0x2'));config[_0x9415('0x3')]=_[_0x9415('0x4')](config[_0x9415('0x3')],{'host':_0x9415('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x9415('0x3')]);sub[_0x9415('0x6')](_0x9415('0x7'),function(_0x33463d){if(_0x33463d)return eventEmitter[_0x9415('0x8')](_0x9415('0x9'),new AGIError(_0x9415('0xa'),_0x33463d));});sub['on'](_0x9415('0xb'),function(_0x19956f,_0x3532eb){if(_0x19956f!==_0x9415('0x7'))return;try{var _0x376d38=JSON[_0x9415('0xc')](_0x3532eb);eventEmitter[_0x9415('0x8')](_0x9415('0xd'),_0x376d38);}catch(_0x5c988a){eventEmitter[_0x9415('0x8')](_0x9415('0x9'),new AGIError(_0x9415('0xa'),_0x5c988a));}});module[_0x9415('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7e45=['agi','emit','E_AGI_SERVER_ERROR','message','parse','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe'];(function(_0xaf8429,_0x2d672b){var _0x144454=function(_0x18f16e){while(--_0x18f16e){_0xaf8429['push'](_0xaf8429['shift']());}};_0x144454(++_0x2d672b);}(_0x7e45,0xc7));var _0x57e4=function(_0x53f218,_0x27514c){_0x53f218=_0x53f218-0x0;var _0x21890a=_0x7e45[_0x53f218];return _0x21890a;};'use strict';var _=require(_0x57e4('0x0'));var EventEmitter=require(_0x57e4('0x1'))[_0x57e4('0x2')];var Redis=require(_0x57e4('0x3'));var AGIError=require(_0x57e4('0x4'));var config=require(_0x57e4('0x5'));config['redis']=_['defaults'](config[_0x57e4('0x6')],{'host':_0x57e4('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x57e4('0x6')]);sub[_0x57e4('0x8')](_0x57e4('0x9'),function(_0x11a63f){if(_0x11a63f)return eventEmitter[_0x57e4('0xa')]('error',new AGIError(_0x57e4('0xb'),_0x11a63f));});sub['on'](_0x57e4('0xc'),function(_0x201397,_0x32b780){if(_0x201397!==_0x57e4('0x9'))return;try{var _0x3225c1=JSON[_0x57e4('0xd')](_0x32b780);eventEmitter[_0x57e4('0xa')]('projectUpdate',_0x3225c1);}catch(_0x1cf728){eventEmitter[_0x57e4('0xa')](_0x57e4('0xe'),new AGIError(_0x57e4('0xb'),_0x1cf728));}});module[_0x57e4('0xf')]={'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 f05974b..4d200d9 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 _0xd37d=['size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push'];(function(_0x1dd362,_0x1efe77){var _0x390184=function(_0xb9fca7){while(--_0xb9fca7){_0x1dd362['push'](_0x1dd362['shift']());}};_0x390184(++_0x1efe77);}(_0xd37d,0x1a6));var _0xdd37=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0xd37d[_0x1be3b3];return _0x4f8b2d;};'use strict';var _=require(_0xdd37('0x0'));var logger=require(_0xdd37('0x1'))(_0xdd37('0x2'));var verticesWithRetry=[_0xdd37('0x3'),_0xdd37('0x4'),_0xdd37('0x5')];var Graph=function(){this[_0xdd37('0x6')]={};this[_0xdd37('0x7')]={};this[_0xdd37('0x8')]=0x0;};Graph[_0xdd37('0x9')]['addVertex']=function(_0xf9034){this[_0xdd37('0x6')][_0xf9034['id']]=_0xf9034;this[_0xdd37('0x7')][_0xf9034['id']]=[];};Graph[_0xdd37('0x9')][_0xdd37('0xa')]=function(_0x7d27ff,_0x523d3c,_0x54e170){this[_0xdd37('0x7')][_0x7d27ff][_0xdd37('0xb')]({'target':_0x523d3c,'condition':_0x54e170});this[_0xdd37('0x8')]+=0x1;};Graph[_0xdd37('0x9')][_0xdd37('0xc')]=function(){return _['size'](this[_0xdd37('0x6')]);};Graph[_0xdd37('0x9')][_0xdd37('0xd')]=function(){return this[_0xdd37('0x8')];};Graph[_0xdd37('0x9')][_0xdd37('0xe')]=function(_0x18025c){return this['vertices'][_0x18025c];};Graph[_0xdd37('0x9')][_0xdd37('0xf')]=function(_0x2cd82f,_0x2d7db1){if(!this['vertices'][_0x2cd82f]){return logger[_0xdd37('0x10')](_0xdd37('0x11'));}var _0x4cc72d=_0x2d7db1(this[_0xdd37('0x6')][_0x2cd82f]);if(!_0x4cc72d){return logger[_0xdd37('0x10')](_0xdd37('0x12'));}if(this[_0xdd37('0x7')][_0x2cd82f][_0xdd37('0x13')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0xfcbf1e=0x0,_0x4b975a=[],_0x4da01a=![];_0xfcbf1e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','projectUpdate','nextTick','findIndex','deleted','splice'];(function(_0x9334be,_0x2f75d7){var _0x5ab7a0=function(_0x311cf6){while(--_0x311cf6){_0x9334be['push'](_0x9334be['shift']());}};_0x5ab7a0(++_0x2f75d7);}(_0x0206,0x6c));var _0x6020=function(_0x532061,_0x57e2e0){_0x532061=_0x532061-0x0;var _0x3905ae=_0x0206[_0x532061];return _0x3905ae;};'use strict';var _=require(_0x6020('0x0'));var syncho=require(_0x6020('0x1'));var util=require(_0x6020('0x2'));var config=require(_0x6020('0x3'));var logger=require(_0x6020('0x4'))(_0x6020('0x5'));var utilLicense=require(_0x6020('0x6'));var rpc=require(_0x6020('0x7'));var Project=require(_0x6020('0x8'));var AGIEmitter=require(_0x6020('0x9'))['EventEmitter'];var projects=[];config[_0x6020('0x5')]=_[_0x6020('0xa')](config[_0x6020('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x6020('0xb'),projectUpdateHandler);function connectionHandler(_0x1e7063){process[_0x6020('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1e7063);agiHandler(_0x1e7063);}catch(_0x4e858c){logger['error'](_0x4e858c['stack']);}});});}function projectUpdateHandler(_0x7fc73e){try{var _0x535d41=_[_0x6020('0xd')](projects,['id',_0x7fc73e['id']]);if(_0x535d41>-0x1){if(_0x7fc73e[_0x6020('0xe')]===!![]){projects[_0x6020('0xf')](_0x535d41,0x1);}else{projects[_0x535d41]=_0x7fc73e;}}else{projects[_0x6020('0x10')](_0x7fc73e);}}catch(_0x35b520){logger[_0x6020('0x11')](_0x35b520['stack']);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6020('0x5')][_0x6020('0x12')]);logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x15'),config[_0x6020('0x5')]['ip'],config['agi'][_0x6020('0x12')]));}function errorHandler(_0x17745a){if(_0x17745a&&_0x17745a[_0x6020('0x16')]&&_0x17745a[_0x6020('0x17')]){logger[_0x6020('0x11')](util[_0x6020('0x14')]('[%s]\x20%s',_0x17745a[_0x6020('0x16')],_0x17745a['message']));}else{logger[_0x6020('0x11')](util[_0x6020('0x14')](_0x6020('0x18'),_0x17745a[_0x6020('0x19')]));}}function closeHandler(){logger[_0x6020('0x13')](util['format'](_0x6020('0x1a'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this[_0x6020('0x1d')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x1646d8){logger['error'](_0x1646d8[_0x6020('0x19')]);}}function timeoutHandler(){logger[_0x6020('0x13')](util['format'](_0x6020('0x1e'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this[_0x6020('0x1d')],this[_0x6020('0x1f')],this[_0x6020('0x20')]));}function hangupHandler(){logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x21'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this['callerid'],this['dnid'],this[_0x6020('0x20')]));this[_0x6020('0x22')]=!![];}function createSquareReport(_0x18941e,_0x5f206e){rpc['createSquareReport'](_0x18941e)[_0x6020('0x23')](function(_0x13fdf1){if(_0x5f206e){_0x5f206e(null,_0x13fdf1);}})[_0x6020('0x24')](function(_0x31f2bd){if(_0x5f206e){_0x5f206e(null,_0x31f2bd);}});}function setChannelVariables(_0x2dd1df){for(var _0x457493 in _0x2dd1df){if(_0x2dd1df[_0x6020('0x25')](_0x457493)){if(_0x457493[_0x6020('0x26')](_0x6020('0x27'))===0x0){_0x2dd1df[_0x457493[_0x6020('0x28')](0x4)]=_0x2dd1df[_0x457493];delete _0x2dd1df[_0x457493];}}}}function agiHandler(_0x1867e0){logger[_0x6020('0x29')](_0x6020('0x2a'),JSON[_0x6020('0x2b')](_0x1867e0,null,0x2));logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x2c'),_0x1867e0[_0x6020('0x1b')],_0x1867e0[_0x6020('0x1c')],_0x1867e0[_0x6020('0x1d')],_0x1867e0['dnid'],_0x1867e0['uniqueid']));_0x1867e0['on'](_0x6020('0x11'),errorHandler);_0x1867e0['on'](_0x6020('0x2d'),closeHandler);_0x1867e0['on'](_0x6020('0x2e'),timeoutHandler);_0x1867e0[_0x6020('0x22')]=![];_0x1867e0['on']('hangup',hangupHandler);var _0x20397a=_['find'](projects,[_0x6020('0x16'),_0x1867e0[_0x6020('0x1b')]]);if(!_0x20397a)return Project[_0x6020('0x2f')](_0x1867e0);if(!_0x20397a[_0x6020('0x30')])return Project[_0x6020('0x31')](_0x1867e0);return Project[_0x6020('0x32')](_0x20397a,_0x1867e0);}function main(){var _0x31bfa4;return utilLicense[_0x6020('0x33')]()[_0x6020('0x23')](function(_0x3fe85f){if(!_0x3fe85f)return;if(_0x3fe85f[_0x6020('0x34')]){if(_0x3fe85f[_0x6020('0x35')]&&_0x3fe85f[_0x6020('0x35')]>0x0){logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x36'),_0x3fe85f[_0x6020('0x35')]));_0x31bfa4=_0x3fe85f[_0x6020('0x35')];}else{logger['info'](_0x6020('0x37'));}}else{logger['info'](_0x6020('0x38'));_0x31bfa4=-0x1;}})['then'](function(){return Project[_0x6020('0x39')]();})[_0x6020('0x23')](function(_0x4618d7){projects=_0x4618d7;return;})[_0x6020('0x24')](function(_0x19307c){logger[_0x6020('0x11')]('[LICENSE]',_0x19307c['stack']);})[_0x6020('0x3a')](function(){var _0x3bf1b2=require(_0x6020('0x3b'))(config[_0x6020('0x5')]['port'],config['agi']['ip'],_0x31bfa4);_0x3bf1b2['on']('error',errorHandler);_0x3bf1b2['on'](_0x6020('0x3c'),listeningHandler);_0x3bf1b2['on'](_0x6020('0x3d'),connectionHandler);_0x3bf1b2['on'](_0x6020('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0xce43=['hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','connection','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex','deleted','splice','push','env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xce43,0xcc));var _0x3ce4=function(_0x398d6f,_0x52a6b3){_0x398d6f=_0x398d6f-0x0;var _0x1ea16d=_0xce43[_0x398d6f];return _0x1ea16d;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x3ce4('0x0'));var config=require('../../config/environment');var logger=require(_0x3ce4('0x1'))(_0x3ce4('0x2'));var utilLicense=require(_0x3ce4('0x3'));var rpc=require(_0x3ce4('0x4'));var Project=require(_0x3ce4('0x5'));var AGIEmitter=require(_0x3ce4('0x6'))[_0x3ce4('0x7')];var projects=[];config['agi']=_[_0x3ce4('0x8')](config[_0x3ce4('0x2')],{'ip':_0x3ce4('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x128abe){process[_0x3ce4('0xa')](function(){syncho(function(){try{setChannelVariables(_0x128abe);agiHandler(_0x128abe);}catch(_0x524141){logger[_0x3ce4('0xb')](_0x524141[_0x3ce4('0xc')]);}});});}function projectUpdateHandler(_0x26b7c8){try{var _0x3296e0=_[_0x3ce4('0xd')](projects,['id',_0x26b7c8['id']]);if(_0x3296e0>-0x1){if(_0x26b7c8[_0x3ce4('0xe')]===!![]){projects[_0x3ce4('0xf')](_0x3296e0,0x1);}else{projects[_0x3296e0]=_0x26b7c8;}}else{projects[_0x3ce4('0x10')](_0x26b7c8);}}catch(_0xb35bf9){logger[_0x3ce4('0xb')](_0xb35bf9[_0x3ce4('0xc')]);}}function listeningHandler(){var _0x149671=config[_0x3ce4('0x11')]===_0x3ce4('0x12')||![];console['log'](_0x3ce4('0x13'),config[_0x3ce4('0x2')][_0x3ce4('0x14')]);logger['info'](util[_0x3ce4('0x15')](_0x3ce4('0x16'),_0x149671?config[_0x3ce4('0x2')]['ip']:_0x3ce4('0x17'),config['agi'][_0x3ce4('0x14')]));}function errorHandler(_0x4aff8){if(_0x4aff8&&_0x4aff8['name']&&_0x4aff8[_0x3ce4('0x18')]){logger[_0x3ce4('0xb')](util[_0x3ce4('0x15')](_0x3ce4('0x19'),_0x4aff8['name'],_0x4aff8['message']));}else{logger['error'](util[_0x3ce4('0x15')](_0x3ce4('0x1a'),_0x4aff8[_0x3ce4('0xc')]));}}function closeHandler(){logger[_0x3ce4('0x1b')](util[_0x3ce4('0x15')](_0x3ce4('0x1c'),this[_0x3ce4('0x1d')],this[_0x3ce4('0x1e')],this[_0x3ce4('0x1f')],this[_0x3ce4('0x20')],this['uniqueid']));try{createSquareReport(this);}catch(_0x207988){logger[_0x3ce4('0xb')](_0x207988[_0x3ce4('0xc')]);}}function timeoutHandler(){logger[_0x3ce4('0x1b')](util['format'](_0x3ce4('0x21'),this['arg_1'],this['calleridname'],this[_0x3ce4('0x1f')],this[_0x3ce4('0x20')],this['uniqueid']));}function hangupHandler(){logger[_0x3ce4('0x1b')](util[_0x3ce4('0x15')](_0x3ce4('0x22'),this['arg_1'],this[_0x3ce4('0x1e')],this[_0x3ce4('0x1f')],this['dnid'],this[_0x3ce4('0x23')]));this[_0x3ce4('0x24')]=!![];}function createSquareReport(_0x2ddc4d,_0x34b44f){rpc[_0x3ce4('0x25')](_0x2ddc4d)[_0x3ce4('0x26')](function(_0x58de10){if(_0x34b44f){_0x34b44f(null,_0x58de10);}})[_0x3ce4('0x27')](function(_0x28cba2){if(_0x34b44f){_0x34b44f(null,_0x28cba2);}});}function setChannelVariables(_0x3b57d7){for(var _0x43082d in _0x3b57d7){if(_0x3b57d7[_0x3ce4('0x28')](_0x43082d)){if(_0x43082d[_0x3ce4('0x29')](_0x3ce4('0x2a'))===0x0){_0x3b57d7[_0x43082d['substring'](0x4)]=_0x3b57d7[_0x43082d];delete _0x3b57d7[_0x43082d];}}}}function agiHandler(_0x40d71c){logger[_0x3ce4('0x2b')](_0x3ce4('0x2c'),JSON[_0x3ce4('0x2d')](_0x40d71c,null,0x2));logger[_0x3ce4('0x1b')](util['format'](_0x3ce4('0x2e'),_0x40d71c[_0x3ce4('0x1d')],_0x40d71c[_0x3ce4('0x1e')],_0x40d71c[_0x3ce4('0x1f')],_0x40d71c[_0x3ce4('0x20')],_0x40d71c[_0x3ce4('0x23')]));_0x40d71c['on'](_0x3ce4('0xb'),errorHandler);_0x40d71c['on'](_0x3ce4('0x2f'),closeHandler);_0x40d71c['on']('timeout',timeoutHandler);_0x40d71c[_0x3ce4('0x24')]=![];_0x40d71c['on'](_0x3ce4('0x30'),hangupHandler);var _0x5ea77f=_[_0x3ce4('0x31')](projects,['name',_0x40d71c[_0x3ce4('0x1d')]]);if(!_0x5ea77f)return Project[_0x3ce4('0x32')](_0x40d71c);if(!_0x5ea77f[_0x3ce4('0x12')])return Project[_0x3ce4('0x33')](_0x40d71c);return Project[_0x3ce4('0x34')](_0x5ea77f,_0x40d71c);}function main(){var _0xd1c821;return utilLicense[_0x3ce4('0x35')]()[_0x3ce4('0x26')](function(_0x28edf3){if(!_0x28edf3)return;if(_0x28edf3[_0x3ce4('0x36')]){if(_0x28edf3[_0x3ce4('0x37')]&&_0x28edf3[_0x3ce4('0x37')]>0x0){logger[_0x3ce4('0x1b')](util[_0x3ce4('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x28edf3[_0x3ce4('0x37')]));_0xd1c821=_0x28edf3[_0x3ce4('0x37')];}else{logger[_0x3ce4('0x1b')](_0x3ce4('0x38'));}}else{logger[_0x3ce4('0x1b')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xd1c821=-0x1;}})[_0x3ce4('0x26')](function(){return Project[_0x3ce4('0x39')]();})[_0x3ce4('0x26')](function(_0x5d3021){projects=_0x5d3021;return;})[_0x3ce4('0x27')](function(_0x257d4c){logger[_0x3ce4('0xb')](_0x3ce4('0x3a'),_0x257d4c[_0x3ce4('0xc')]);})[_0x3ce4('0x3b')](function(){var _0x18fd39=require(_0x3ce4('0x3c'))(config[_0x3ce4('0x2')]['port'],config['agi']['ip'],_0xd1c821);_0x18fd39['on'](_0x3ce4('0xb'),errorHandler);_0x18fd39['on'](_0x3ce4('0x3d'),listeningHandler);_0x18fd39['on'](_0x3ce4('0x3e'),connectionHandler);_0x18fd39['on'](_0x3ce4('0x2f'),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 8cdb765..40e6f3c 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 _0x91b5=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','then'];(function(_0x2e69ff,_0x53eff9){var _0x1f1225=function(_0x2130d6){while(--_0x2130d6){_0x2e69ff['push'](_0x2e69ff['shift']());}};_0x1f1225(++_0x53eff9);}(_0x91b5,0xb9));var _0x591b=function(_0x453fdb,_0x4a5234){_0x453fdb=_0x453fdb-0x0;var _0x2732e4=_0x91b5[_0x453fdb];return _0x2732e4;};'use strict';var BPromise=require(_0x591b('0x0'));var jayson=require(_0x591b('0x1'));var client=jayson[_0x591b('0x2')]['http']({'port':0x232b});function request(_0xf11f1f,_0x11dea7){return new BPromise(function(_0x196540,_0x28cc8d){return client['request'](_0xf11f1f,_0x11dea7)[_0x591b('0x3')](function(_0x30d96a){if(_0x30d96a[_0x591b('0x4')]){return _0x28cc8d(_0x30d96a[_0x591b('0x4')][_0x591b('0x5')]);}else{return _0x196540(_0x30d96a[_0x591b('0x6')]);}})[_0x591b('0x7')](function(_0x163ed4){return _0x28cc8d(_0x163ed4);});});}exports[_0x591b('0x8')]=function(_0x3b75bd,_0x595460){return request('SendMail',{'account':_0x3b75bd,'message':_0x595460});}; \ No newline at end of file +var _0x7305=['result','catch','sendMailMessage','SendMail','bluebird','client','http','then','error','message'];(function(_0x17de36,_0x5b5061){var _0x3cd3e0=function(_0x4f1236){while(--_0x4f1236){_0x17de36['push'](_0x17de36['shift']());}};_0x3cd3e0(++_0x5b5061);}(_0x7305,0x90));var _0x5730=function(_0x21c14a,_0xf9e665){_0x21c14a=_0x21c14a-0x0;var _0x57f3d9=_0x7305[_0x21c14a];return _0x57f3d9;};'use strict';var BPromise=require(_0x5730('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5730('0x1')][_0x5730('0x2')]({'port':0x232b});function request(_0x146180,_0x33ef2d){return new BPromise(function(_0xf0460b,_0x1bd171){return client['request'](_0x146180,_0x33ef2d)[_0x5730('0x3')](function(_0x280315){if(_0x280315['error']){return _0x1bd171(_0x280315[_0x5730('0x4')][_0x5730('0x5')]);}else{return _0xf0460b(_0x280315[_0x5730('0x6')]);}})[_0x5730('0x7')](function(_0xd31e92){return _0x1bd171(_0xd31e92);});});}exports[_0x5730('0x8')]=function(_0x43ecc7,_0x78a738){return request(_0x5730('0x9'),{'account':_0x43ecc7,'message':_0x78a738});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d3aecd5..6217bbf 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 _0xd69d=['toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','../../config/logger','./rpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','source','target','addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','info','format','arg_1','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','context','extension','priority','response','code','result','evtHangup'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xd69d,0xad));var _0xdd69=function(_0x5d2af9,_0x350f19){_0x5d2af9=_0x5d2af9-0x0;var _0x11b3a0=_0xd69d[_0x5d2af9];return _0x11b3a0;};'use strict';var _=require(_0xdd69('0x0'));var moment=require(_0xdd69('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0xdd69('0x2'))('agi');var rpc=require(_0xdd69('0x3'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xdd69('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xdd69('0x5')](function(_0x168c7a){logger[_0xdd69('0x6')](_0xdd69('0x7'),_0x168c7a[_0xdd69('0x8')]);return[];});}function addVertex(_0x805696,_0x514a34,_0x226214){_0x514a34[_0xdd69('0x9')]=_0x226214;if(_0x514a34[_0xdd69('0xa')](_0xdd69('0xb'))){_0x514a34[_0xdd69('0xc')]=parseInt(_0x514a34[_0xdd69('0xb')],0xa);}_0x805696['addVertex'](_[_0xdd69('0xd')](_0x514a34,_0xdd69('0xe')));}function initGraph(_0x5f0d61,_0xc2a974){var _0x395b4e=new Graph();for(var _0x5afccb in _0x5f0d61){if(_0x5f0d61[_0xdd69('0xa')](_0x5afccb)){if(_[_0xdd69('0xf')](_0x5f0d61[_0x5afccb])){for(var _0x5dcc20=0x0;_0x5dcc20<_0x5f0d61[_0x5afccb]['length'];_0x5dcc20+=0x1){addVertex(_0x395b4e,_0x5f0d61[_0x5afccb][_0x5dcc20],_0x5afccb);}}else{addVertex(_0x395b4e,_0x5f0d61[_0x5afccb],_0x5afccb);}}}for(var _0x1b579c=0x0;_0x1b579c<_0xc2a974['length'];_0x1b579c+=0x1){if(_0xc2a974[_0x1b579c][_0xdd69('0x10')]&&_0xc2a974[_0x1b579c][_0xdd69('0x11')]){_0x395b4e[_0xdd69('0x12')](_0xc2a974[_0x1b579c]['source'],_0xc2a974[_0x1b579c][_0xdd69('0x11')],_0xc2a974[_0x1b579c][_0xdd69('0x13')]);}}return _0x395b4e;}function getRoot(_0x6f7cc6){return parser[_0xdd69('0x14')](_0x6f7cc6,{'object':!![]})['mxGraphModel'][_0xdd69('0x15')];}function inspect(_0x46e54d){return util[_0xdd69('0x16')](_0x46e54d,{'showHidden':![],'depth':null});}function initialize(_0x200a58,_0x59f534){var _0x451e43=getRoot(_0x200a58['production']);if(!_0x451e43||!_0x451e43[_0xdd69('0x17')])return;var _0x3424e0,_0x347259,_0x5a0e97;logger[_0xdd69('0x18')](_0xdd69('0x15'),JSON[_0xdd69('0x19')](_0x451e43,null,0x2));_0x59f534[_0xdd69('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3424e0=initGraph(_[_0xdd69('0xd')](_0x451e43,_0xdd69('0xe')),_0x451e43[_0xdd69('0xe')]);_0x347259=new Vertices(_0x59f534,rpc,mailRpc);logger[_0xdd69('0x1b')](util[_0xdd69('0x1c')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59f534[_0xdd69('0x1d')],_0x59f534['calleridname'],_0x59f534[_0xdd69('0x1e')],_0x59f534[_0xdd69('0x1f')],_0x59f534[_0xdd69('0x20')]));_0x3424e0[_0xdd69('0x21')](_0x451e43[_0xdd69('0x17')]['id'],function(_0x163086){try{_0x163086=_0x347259['clear'](_0x163086);logger[_0xdd69('0x18')](_0xdd69('0x22'),JSON[_0xdd69('0x19')](_0x163086,null,0x2));if(_0x163086['agicommand']===_0xdd69('0x23')){logger[_0xdd69('0x1b')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x59f534['context']=_0x163086[_0xdd69('0x24')]||_0x59f534[_0xdd69('0x24')];_0x59f534[_0xdd69('0x25')]=_0x163086[_0xdd69('0x25')];_0x59f534[_0xdd69('0x26')]=_0x163086[_0xdd69('0x26')]?_0x163086[_0xdd69('0x26')]-0x1:0x1;return null;}else if(_0x163086&&_0x347259[_0x163086[_0xdd69('0x9')]]){_0x5a0e97=_0x347259[_0x163086[_0xdd69('0x9')]](_0x163086);logger[_0xdd69('0x1b')](_0xdd69('0x27'),JSON[_0xdd69('0x19')](_0x5a0e97,null,0x2));if(_0x5a0e97&&_0x5a0e97[_0xdd69('0x28')]===AGI_CODE_SUCCESS&&_0x5a0e97[_0xdd69('0x29')]!==AGI_RESULT_ERROR&&!_0x59f534[_0xdd69('0x2a')]){logger[_0xdd69('0x18')](_0xdd69('0x27'),inspect(_0x5a0e97));return _['isUndefined'](_0x5a0e97['result'])?null:_0x5a0e97[_0xdd69('0x29')][_0xdd69('0x2b')]();}else{logger['error']('response',inspect(_0x5a0e97));return null;}}else{logger[_0xdd69('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x418e5b){logger['error'](_0x418e5b[_0xdd69('0x8')]);return null;}});if(_0x451e43['finally']){logger['info'](util[_0xdd69('0x1c')](_0xdd69('0x2c'),_0x59f534[_0xdd69('0x1d')],_0x59f534['calleridname'],_0x59f534[_0xdd69('0x1e')],_0x59f534[_0xdd69('0x1f')],_0x59f534[_0xdd69('0x20')]));_0x3424e0[_0xdd69('0x21')](_0x451e43['finally']['id'],function(_0x5437e9){try{_0x5437e9=_0x347259[_0xdd69('0x2d')](_0x5437e9);logger[_0xdd69('0x18')](_0xdd69('0x22'),JSON[_0xdd69('0x19')](_0x5437e9,null,0x2));if(_0x5437e9&&_0x347259[_0x5437e9[_0xdd69('0x9')]]){_0x5a0e97=_0x347259[_0x5437e9['agicommand']](_0x5437e9);if(_0x5a0e97){logger['debug'](_0xdd69('0x27'),inspect(_0x5a0e97));return _['isUndefined'](_0x5a0e97['result'])?null:_0x5a0e97[_0xdd69('0x29')]['toString']();}else{logger[_0xdd69('0x6')](_0xdd69('0x27'),inspect(_0x5a0e97));return null;}}else{logger[_0xdd69('0x6')](_0xdd69('0x2e'));return null;}}catch(_0xce3d03){logger['error'](_0xce3d03[_0xdd69('0x8')]);return null;}});}logger[_0xdd69('0x1b')](util['format'](_0xdd69('0x2f'),_0x59f534['arg_1'],_0x59f534[_0xdd69('0x30')],_0x59f534[_0xdd69('0x1e')],_0x59f534['dnid'],_0x59f534[_0xdd69('0x20')]));logger[_0xdd69('0x1b')](util[_0xdd69('0x1c')](_0xdd69('0x31'),_0x59f534[_0xdd69('0x24')],_0x59f534[_0xdd69('0x25')],parseInt(_0x59f534[_0xdd69('0x26')],0xa)+0x1));_0x59f534[_0xdd69('0x32')](_0x59f534[_0xdd69('0x24')],_0x59f534[_0xdd69('0x25')],parseInt(_0x59f534[_0xdd69('0x26')],0xa)+0x1);_0x59f534[_0xdd69('0x33')]();}function handleNotFound(_0x30a5ff){logger[_0xdd69('0x6')](util[_0xdd69('0x1c')](_0xdd69('0x34'),_0x30a5ff[_0xdd69('0x1d')]));_0x30a5ff[_0xdd69('0x32')](_0x30a5ff[_0xdd69('0x24')],_0x30a5ff[_0xdd69('0x25')],parseInt(_0x30a5ff[_0xdd69('0x26')],0xa)+0x1);_0x30a5ff[_0xdd69('0x33')]();}function handleUnpublished(_0x488bcb){logger[_0xdd69('0x6')](util[_0xdd69('0x1c')]('Project\x20%s\x20not\x20published',_0x488bcb[_0xdd69('0x1d')]));_0x488bcb[_0xdd69('0x32')](_0x488bcb[_0xdd69('0x24')],_0x488bcb[_0xdd69('0x25')],parseInt(_0x488bcb['priority'],0xa)+0x1);_0x488bcb[_0xdd69('0x33')]();}module[_0xdd69('0x35')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x15ee=['agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined'];(function(_0x57480a,_0x48929f){var _0x552894=function(_0x526676){while(--_0x526676){_0x57480a['push'](_0x57480a['shift']());}};_0x552894(++_0x48929f);}(_0x15ee,0x141));var _0xe15e=function(_0x3b8a26,_0x168cc4){_0x3b8a26=_0x3b8a26-0x0;var _0x31bafd=_0x15ee[_0x3b8a26];return _0x31bafd;};'use strict';var _=require('lodash');var moment=require(_0xe15e('0x0'));var parser=require(_0xe15e('0x1'));var util=require(_0xe15e('0x2'));var logger=require('../../config/logger')(_0xe15e('0x3'));var rpc=require(_0xe15e('0x4'));var mailRpc=require(_0xe15e('0x5'));var Graph=require(_0xe15e('0x6'));var Vertices=require(_0xe15e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe15e('0x8')]()[_0xe15e('0x9')](function(_0x14ec1f){logger[_0xe15e('0xa')](_0xe15e('0xb'),_0x14ec1f[_0xe15e('0xc')]);return[];});}function addVertex(_0x509ec3,_0x3b3b7e,_0x9cf7a2){_0x3b3b7e[_0xe15e('0xd')]=_0x9cf7a2;if(_0x3b3b7e[_0xe15e('0xe')](_0xe15e('0xf'))){_0x3b3b7e[_0xe15e('0x10')]=parseInt(_0x3b3b7e['retry'],0xa);}_0x509ec3['addVertex'](_[_0xe15e('0x11')](_0x3b3b7e,_0xe15e('0x12')));}function initGraph(_0x5e3c0e,_0x2a52){var _0x10c529=new Graph();for(var _0x2157a5 in _0x5e3c0e){if(_0x5e3c0e['hasOwnProperty'](_0x2157a5)){if(_[_0xe15e('0x13')](_0x5e3c0e[_0x2157a5])){for(var _0x4a71b4=0x0;_0x4a71b4<_0x5e3c0e[_0x2157a5]['length'];_0x4a71b4+=0x1){addVertex(_0x10c529,_0x5e3c0e[_0x2157a5][_0x4a71b4],_0x2157a5);}}else{addVertex(_0x10c529,_0x5e3c0e[_0x2157a5],_0x2157a5);}}}for(var _0x2ca3f2=0x0;_0x2ca3f2<_0x2a52[_0xe15e('0x14')];_0x2ca3f2+=0x1){if(_0x2a52[_0x2ca3f2][_0xe15e('0x15')]&&_0x2a52[_0x2ca3f2][_0xe15e('0x16')]){_0x10c529['addEdge'](_0x2a52[_0x2ca3f2][_0xe15e('0x15')],_0x2a52[_0x2ca3f2][_0xe15e('0x16')],_0x2a52[_0x2ca3f2][_0xe15e('0x17')]);}}return _0x10c529;}function getRoot(_0x5677d6){return parser[_0xe15e('0x18')](_0x5677d6,{'object':!![]})[_0xe15e('0x19')][_0xe15e('0x1a')];}function inspect(_0x10fa37){return util[_0xe15e('0x1b')](_0x10fa37,{'showHidden':![],'depth':null});}function initialize(_0x419c9e,_0x58a8ea){var _0x4229a1=getRoot(_0x419c9e[_0xe15e('0x1c')]);if(!_0x4229a1||!_0x4229a1[_0xe15e('0x1d')])return;var _0x24b101,_0x3e7019,_0x3e5348;logger['debug']('root',JSON['stringify'](_0x4229a1,null,0x2));_0x58a8ea['joinAt']=moment()[_0xe15e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x24b101=initGraph(_[_0xe15e('0x11')](_0x4229a1,_0xe15e('0x12')),_0x4229a1[_0xe15e('0x12')]);_0x3e7019=new Vertices(_0x58a8ea,rpc,mailRpc);logger[_0xe15e('0x1f')](util[_0xe15e('0x1e')](_0xe15e('0x20'),_0x58a8ea[_0xe15e('0x21')],_0x58a8ea[_0xe15e('0x22')],_0x58a8ea[_0xe15e('0x23')],_0x58a8ea[_0xe15e('0x24')],_0x58a8ea['uniqueid']));_0x24b101[_0xe15e('0x25')](_0x4229a1[_0xe15e('0x1d')]['id'],function(_0x25c810){try{_0x25c810=_0x3e7019[_0xe15e('0x26')](_0x25c810);logger[_0xe15e('0x27')](_0xe15e('0x28'),JSON[_0xe15e('0x29')](_0x25c810,null,0x2));if(_0x25c810[_0xe15e('0xd')]===_0xe15e('0x2a')){logger[_0xe15e('0x1f')](_0xe15e('0x2b'));_0x58a8ea[_0xe15e('0x2c')]=_0x25c810[_0xe15e('0x2c')]||_0x58a8ea[_0xe15e('0x2c')];_0x58a8ea[_0xe15e('0x2d')]=_0x25c810[_0xe15e('0x2d')];_0x58a8ea[_0xe15e('0x2e')]=_0x25c810[_0xe15e('0x2e')]?_0x25c810['priority']-0x1:0x1;return null;}else if(_0x25c810&&_0x3e7019[_0x25c810['agicommand']]){_0x3e5348=_0x3e7019[_0x25c810['agicommand']](_0x25c810);logger['info'](_0xe15e('0x2f'),JSON[_0xe15e('0x29')](_0x3e5348,null,0x2));if(_0x3e5348&&_0x3e5348['code']===AGI_CODE_SUCCESS&&_0x3e5348[_0xe15e('0x30')]!==AGI_RESULT_ERROR&&!_0x58a8ea[_0xe15e('0x31')]){logger[_0xe15e('0x27')]('response',inspect(_0x3e5348));return _[_0xe15e('0x32')](_0x3e5348['result'])?null:_0x3e5348[_0xe15e('0x30')]['toString']();}else{logger['error'](_0xe15e('0x2f'),inspect(_0x3e5348));return null;}}else{logger[_0xe15e('0xa')](_0xe15e('0x33'));return null;}}catch(_0x1f8827){logger[_0xe15e('0xa')](_0x1f8827[_0xe15e('0xc')]);return null;}});if(_0x4229a1[_0xe15e('0x34')]){logger[_0xe15e('0x1f')](util['format'](_0xe15e('0x35'),_0x58a8ea[_0xe15e('0x21')],_0x58a8ea[_0xe15e('0x22')],_0x58a8ea[_0xe15e('0x23')],_0x58a8ea[_0xe15e('0x24')],_0x58a8ea['uniqueid']));_0x24b101[_0xe15e('0x25')](_0x4229a1[_0xe15e('0x34')]['id'],function(_0x5ab13f){try{_0x5ab13f=_0x3e7019[_0xe15e('0x26')](_0x5ab13f);logger[_0xe15e('0x27')](_0xe15e('0x28'),JSON[_0xe15e('0x29')](_0x5ab13f,null,0x2));if(_0x5ab13f&&_0x3e7019[_0x5ab13f[_0xe15e('0xd')]]){_0x3e5348=_0x3e7019[_0x5ab13f[_0xe15e('0xd')]](_0x5ab13f);if(_0x3e5348){logger[_0xe15e('0x27')](_0xe15e('0x2f'),inspect(_0x3e5348));return _[_0xe15e('0x32')](_0x3e5348[_0xe15e('0x30')])?null:_0x3e5348[_0xe15e('0x30')]['toString']();}else{logger[_0xe15e('0xa')](_0xe15e('0x2f'),inspect(_0x3e5348));return null;}}else{logger[_0xe15e('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x4467ef){logger[_0xe15e('0xa')](_0x4467ef[_0xe15e('0xc')]);return null;}});}logger[_0xe15e('0x1f')](util[_0xe15e('0x1e')](_0xe15e('0x36'),_0x58a8ea[_0xe15e('0x21')],_0x58a8ea[_0xe15e('0x22')],_0x58a8ea[_0xe15e('0x23')],_0x58a8ea[_0xe15e('0x24')],_0x58a8ea[_0xe15e('0x37')]));logger[_0xe15e('0x1f')](util[_0xe15e('0x1e')](_0xe15e('0x38'),_0x58a8ea[_0xe15e('0x2c')],_0x58a8ea[_0xe15e('0x2d')],parseInt(_0x58a8ea[_0xe15e('0x2e')],0xa)+0x1));_0x58a8ea[_0xe15e('0x39')](_0x58a8ea[_0xe15e('0x2c')],_0x58a8ea[_0xe15e('0x2d')],parseInt(_0x58a8ea[_0xe15e('0x2e')],0xa)+0x1);_0x58a8ea[_0xe15e('0x3a')]();}function handleNotFound(_0x490eeb){logger[_0xe15e('0xa')](util[_0xe15e('0x1e')](_0xe15e('0x3b'),_0x490eeb[_0xe15e('0x21')]));_0x490eeb[_0xe15e('0x39')](_0x490eeb[_0xe15e('0x2c')],_0x490eeb[_0xe15e('0x2d')],parseInt(_0x490eeb['priority'],0xa)+0x1);_0x490eeb['close']();}function handleUnpublished(_0x558639){logger[_0xe15e('0xa')](util['format'](_0xe15e('0x3c'),_0x558639[_0xe15e('0x21')]));_0x558639[_0xe15e('0x39')](_0x558639[_0xe15e('0x2c')],_0x558639['extension'],parseInt(_0x558639[_0xe15e('0x2e')],0xa)+0x1);_0x558639[_0xe15e('0x3a')]();}module[_0xe15e('0x3d')]={'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 0298a15..46507dc 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 _0xe237=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','trim','length','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x2f6413,_0x9a71cc){var _0x2b03a5=function(_0x3039ab){while(--_0x3039ab){_0x2f6413['push'](_0x2f6413['shift']());}};_0x2b03a5(++_0x9a71cc);}(_0xe237,0xd4));var _0x7e23=function(_0x1a7dc,_0x45fb5f){_0x1a7dc=_0x1a7dc-0x0;var _0x13dcb6=_0xe237[_0x1a7dc];return _0x13dcb6;};'use strict';var util=require(_0x7e23('0x0'));var Transform=require(_0x7e23('0x1'))[_0x7e23('0x2')];function AGIReply(_0x3b4617){Transform[_0x7e23('0x3')](this,_0x3b4617);this[_0x7e23('0x4')]='';this[_0x7e23('0x5')]=![];}util[_0x7e23('0x6')](AGIReply,Transform);AGIReply[_0x7e23('0x7')][_0x7e23('0x8')]=function(_0x39dfbb,_0x50e9e1,_0xc8e200){var _0x596c92='\x0a',_0x30e6e7=['\x0a\x0a',_0x7e23('0x9')],_0x22e41d=-0x1,_0x16800d=-0x1,_0x2e18e9='',_0x82a49c=0x0,_0x4f6fab='',_0x24fa66='';this['_localBuffer']+=_0x39dfbb[_0x7e23('0xa')]();_0x4f6fab=this[_0x7e23('0x4')];if(!this['_inBody']){_0x82a49c=0x0;while(_0x30e6e7[_0x82a49c]){while((_0x16800d=_0x4f6fab[_0x7e23('0xb')](_0x30e6e7[_0x82a49c]))!=-0x1){_0x2e18e9=_0x30e6e7[_0x82a49c];_0x24fa66=_0x4f6fab['substring'](0x0,_0x16800d);_0x4f6fab=_0x4f6fab[_0x7e23('0xc')](_0x16800d+_0x2e18e9['length']);var _0x3bce2b=_0x24fa66[_0x7e23('0xd')](_0x596c92),_0x44e299=0x0,_0x4cf8e5={},_0xbcf674='',_0x3692d9='',_0x1f4c9e=-0x1;while(_0x3bce2b[_0x44e299]){_0x1f4c9e=_0x3bce2b[_0x44e299][_0x7e23('0xb')](':');if(_0x1f4c9e!=-0x1){_0xbcf674=_0x3bce2b[_0x44e299]['slice'](0x0,_0x1f4c9e)['trim']();_0x3692d9=_0x3bce2b[_0x44e299]['slice'](_0x1f4c9e+0x1)[_0x7e23('0xe')]();if(_0xbcf674[_0x7e23('0xf')]>0x0){_0x4cf8e5[_0xbcf674]=_0x3692d9;}}else{}_0x44e299++;}this[_0x7e23('0x10')](_0x7e23('0x11'),_0x4cf8e5);this['_inBody']=!![];}_0x82a49c++;}this[_0x7e23('0x4')]=_0x4f6fab;}else{while((_0x22e41d=_0x4f6fab[_0x7e23('0xb')](_0x596c92))!=-0x1){_0x24fa66=_0x4f6fab[_0x7e23('0xc')](0x0,_0x22e41d);this[_0x7e23('0x10')](_0x7e23('0x12'),_0x24fa66);_0x4f6fab=_0x4f6fab[_0x7e23('0xc')](_0x22e41d+_0x596c92[_0x7e23('0xf')]);}this['_localBuffer']=_0x4f6fab;}_0xc8e200();};module[_0x7e23('0x13')]=AGIReply; \ No newline at end of file +var _0x43bf=['_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','_inBody','indexOf','substring','split','trim','length','emit','headers','line','exports','util','call','inherits','prototype'];(function(_0x27290e,_0x39c76c){var _0xea64d1=function(_0x325730){while(--_0x325730){_0x27290e['push'](_0x27290e['shift']());}};_0xea64d1(++_0x39c76c);}(_0x43bf,0x1be));var _0xf43b=function(_0x1e7f41,_0x3a01d2){_0x1e7f41=_0x1e7f41-0x0;var _0x168b46=_0x43bf[_0x1e7f41];return _0x168b46;};'use strict';var util=require(_0xf43b('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x286f67){Transform[_0xf43b('0x1')](this,_0x286f67);this['_localBuffer']='';this['_inBody']=![];}util[_0xf43b('0x2')](AGIReply,Transform);AGIReply[_0xf43b('0x3')][_0xf43b('0x4')]=function(_0x1a786f,_0x747653,_0x52e1d7){var _0x4dd7a5='\x0a',_0x3d66b6=['\x0a\x0a',_0xf43b('0x5')],_0x54c447=-0x1,_0x487700=-0x1,_0x15bc89='',_0x1ced81=0x0,_0xb36134='',_0x169764='';this['_localBuffer']+=_0x1a786f[_0xf43b('0x6')]();_0xb36134=this[_0xf43b('0x7')];if(!this[_0xf43b('0x8')]){_0x1ced81=0x0;while(_0x3d66b6[_0x1ced81]){while((_0x487700=_0xb36134[_0xf43b('0x9')](_0x3d66b6[_0x1ced81]))!=-0x1){_0x15bc89=_0x3d66b6[_0x1ced81];_0x169764=_0xb36134[_0xf43b('0xa')](0x0,_0x487700);_0xb36134=_0xb36134[_0xf43b('0xa')](_0x487700+_0x15bc89['length']);var _0x4cd077=_0x169764[_0xf43b('0xb')](_0x4dd7a5),_0x546900=0x0,_0x25216c={},_0x3cfbb9='',_0x1e514e='',_0x3e6348=-0x1;while(_0x4cd077[_0x546900]){_0x3e6348=_0x4cd077[_0x546900][_0xf43b('0x9')](':');if(_0x3e6348!=-0x1){_0x3cfbb9=_0x4cd077[_0x546900]['slice'](0x0,_0x3e6348)[_0xf43b('0xc')]();_0x1e514e=_0x4cd077[_0x546900]['slice'](_0x3e6348+0x1)[_0xf43b('0xc')]();if(_0x3cfbb9[_0xf43b('0xd')]>0x0){_0x25216c[_0x3cfbb9]=_0x1e514e;}}else{}_0x546900++;}this[_0xf43b('0xe')](_0xf43b('0xf'),_0x25216c);this['_inBody']=!![];}_0x1ced81++;}this[_0xf43b('0x7')]=_0xb36134;}else{while((_0x54c447=_0xb36134[_0xf43b('0x9')](_0x4dd7a5))!=-0x1){_0x169764=_0xb36134['substring'](0x0,_0x54c447);this[_0xf43b('0xe')](_0xf43b('0x10'),_0x169764);_0xb36134=_0xb36134['substring'](_0x54c447+_0x4dd7a5[_0xf43b('0xd')]);}this['_localBuffer']=_0xb36134;}_0x52e1d7();};module[_0xf43b('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 d2d05fb..08c901d 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 _0xa7dc=['getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','getSoundById','ShowSound','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x5cbad4,_0x5aae44){var _0x106965=function(_0x583914){while(--_0x583914){_0x5cbad4['push'](_0x5cbad4['shift']());}};_0x106965(++_0x5aae44);}(_0xa7dc,0x11d));var _0xca7d=function(_0x1f8616,_0x26a9d2){_0x1f8616=_0x1f8616-0x0;var _0x327965=_0xa7dc[_0x1f8616];return _0x327965;};'use strict';var _=require(_0xca7d('0x0'));var moment=require(_0xca7d('0x1'));var jayson=require(_0xca7d('0x2'));var client=jayson['client'][_0xca7d('0x3')]({'port':0x2329});function request(_0x524adc,_0x3588cd){return new Promise(function(_0x75fca7,_0xc9d57a){return client[_0xca7d('0x4')](_0x524adc,_0x3588cd)[_0xca7d('0x5')](function(_0x40ae95){if(_0x40ae95[_0xca7d('0x6')]){return _0xc9d57a(_0x40ae95[_0xca7d('0x6')]['message']);}else{return _0x75fca7(_0x40ae95[_0xca7d('0x7')]);}})[_0xca7d('0x8')](function(_0x4d5bc7){return _0xc9d57a(_0x4d5bc7);});});}exports[_0xca7d('0x9')]=function(){return request(_0xca7d('0xa'),{'options':{'raw':![],'attributes':['id',_0xca7d('0xb'),'production']}});};exports[_0xca7d('0xc')]=function(_0x256e06){return request(_0xca7d('0xd'),{'options':{'raw':![],'where':{'name':_0x256e06},'attributes':[_0xca7d('0xe')]}});};exports[_0xca7d('0xf')]=function(_0x5b03b6){return request(_0xca7d('0x10'),{'options':{'raw':![],'where':{'id':_0x5b03b6},'include':[{'model':'MailServerOut','as':_0xca7d('0x11'),'include':[{'model':'CloudProvider','as':_0xca7d('0x12')}]}],'attributes':['id',_0xca7d('0xb'),_0xca7d('0x13')],'smtp':!![]}});};exports[_0xca7d('0x14')]=function(_0x4c1618){return request('ShowSquareProject',{'options':{'where':{'id':_0x4c1618},'attributes':['name']}});};exports[_0xca7d('0x15')]=function(_0x36f922){return request(_0xca7d('0x16'),{'options':{'where':{'id':_0x36f922},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x17')]=function(_0x1fc20b){return request(_0xca7d('0x18'),{'options':{'where':{'id':_0x1fc20b},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x19')]=function(_0x1a6cb7){return request(_0xca7d('0x1a'),{'options':{'where':{'id':_0x1a6cb7},'attributes':[_0xca7d('0x1b')]}});};exports['getUserById']=function(_0x536c28){return request(_0xca7d('0x1c'),{'options':{'where':{'id':_0x536c28},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x1d')]=function(_0x46eac1){return request(_0xca7d('0x1e'),{'options':{'where':{'phone':_0x46eac1['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0xcb2e83){return request('ShowTrunk',{'options':{'where':{'id':_0xcb2e83},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x1f')]=function(_0x5f06c5){return request(_0xca7d('0x20'),{'options':{'where':{'id':_0x5f06c5},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x408b07){return request(_0xca7d('0x21'),{'options':{'raw':![],'where':{'id':_0x408b07},'include':[{'model':_0xca7d('0x22'),'as':_0xca7d('0x23')}]}});};exports['getSmsAccountById']=function(_0x4121ce){return request(_0xca7d('0x24'),{'options':{'where':{'id':_0x4121ce},'attributes':['id',_0xca7d('0xb')]}});};exports[_0xca7d('0x25')]=function(_0x79fc7d){return request(_0xca7d('0x26'),{'body':_0x79fc7d});};exports[_0xca7d('0x27')]=function(_0x44e415){return request(_0xca7d('0x28'),{'body':_0x44e415});};exports[_0xca7d('0x29')]=function(_0x59c71a){return request(_0xca7d('0x2a'),{'body':_[_0xca7d('0x2b')](_0x59c71a,{'project_name':_0x59c71a[_0xca7d('0x2c')],'prev_project_name':_0x59c71a[_0xca7d('0x2d')]||'','is_subproject':_0x59c71a[_0xca7d('0x2d')]?!![]:![],'leaveAt':moment()[_0xca7d('0x2e')](_0xca7d('0x2f'))})});};exports[_0xca7d('0x30')]=function(_0xb08cfd){return request(_0xca7d('0x31'),{'body':_0xb08cfd});};exports['createSquareMessage']=function(_0x445fad){return request(_0xca7d('0x32'),{'body':_0x445fad});};exports['createCmContact']=function(_0x3a1082){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3a1082['phone'],'ListId':_0x3a1082[_0xca7d('0x33')]}}})['then'](function(_0x37c8a6){if(_0x37c8a6){return _0x37c8a6;}return request(_0xca7d('0x34'),{'body':_0x3a1082});});};exports[_0xca7d('0x35')]=function(_0x3071e5){return request(_0xca7d('0x36'),{'options':{'where':{'id':_0x3071e5},'attributes':[_0xca7d('0xb')]}});};exports['agentLogin']=function(_0x86cfac,_0x2a3b98){return request(_0xca7d('0x37'),{'body':{'interface':_0x2a3b98},'options':{'where':_0x86cfac}});};exports['agentPause']=function(_0x324eaf,_0x3d9356,_0x4487bd){return request(_0xca7d('0x38'),{'body':{'type':_0x3d9356,'uniqueid':_0x4487bd},'options':{'where':_0x324eaf}});};exports[_0xca7d('0x39')]=function(_0x382fb3){return request(_0xca7d('0x3a'),{'body':{},'options':{'where':_0x382fb3}});};exports[_0xca7d('0x3b')]=function(_0x5bba0f){return request('LogoutUser',{'body':{},'options':{'where':_0x5bba0f}});}; \ No newline at end of file +var _0xa44a=['ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','client','http','error','message','catch','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','MailServerOut','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0xa44a,0x9a));var _0xaa44=function(_0x52c53f,_0x26b4df){_0x52c53f=_0x52c53f-0x0;var _0x573e3b=_0xa44a[_0x52c53f];return _0x573e3b;};'use strict';var _=require(_0xaa44('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xaa44('0x1')][_0xaa44('0x2')]({'port':0x2329});function request(_0x4bceaa,_0x1ae2e3){return new Promise(function(_0x18c8ad,_0x3427a1){return client['request'](_0x4bceaa,_0x1ae2e3)['then'](function(_0x357211){if(_0x357211[_0xaa44('0x3')]){return _0x3427a1(_0x357211['error'][_0xaa44('0x4')]);}else{return _0x18c8ad(_0x357211['result']);}})[_0xaa44('0x5')](function(_0x37cdeb){return _0x3427a1(_0x37cdeb);});});}exports['getSquareProjects']=function(){return request(_0xaa44('0x6'),{'options':{'raw':![],'attributes':['id',_0xaa44('0x7'),'production']}});};exports[_0xaa44('0x8')]=function(_0x231a4f){return request(_0xaa44('0x9'),{'options':{'raw':![],'where':{'name':_0x231a4f},'attributes':[_0xaa44('0xa')]}});};exports['getMailAccountById']=function(_0x3b90c3){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3b90c3},'include':[{'model':_0xaa44('0xb'),'as':'Smtp','include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0xaa44('0x7'),_0xaa44('0xc')],'smtp':!![]}});};exports[_0xaa44('0xd')]=function(_0x58ac25){return request(_0xaa44('0x9'),{'options':{'where':{'id':_0x58ac25},'attributes':[_0xaa44('0x7')]}});};exports['getVoiceQueueById']=function(_0x57e11d){return request(_0xaa44('0xe'),{'options':{'where':{'id':_0x57e11d},'attributes':[_0xaa44('0x7')]}});};exports['getVariableById']=function(_0x5ab5be){return request(_0xaa44('0xf'),{'options':{'where':{'id':_0x5ab5be},'attributes':['name']}});};exports[_0xaa44('0x10')]=function(_0x5a5cab){return request(_0xaa44('0x11'),{'options':{'where':{'id':_0x5a5cab},'attributes':[_0xaa44('0x12')]}});};exports[_0xaa44('0x13')]=function(_0x23cbc7){return request(_0xaa44('0x14'),{'options':{'where':{'id':_0x23cbc7},'attributes':['name']}});};exports[_0xaa44('0x15')]=function(_0x16fa2c){return request(_0xaa44('0x16'),{'options':{'where':{'phone':_0x16fa2c[_0xaa44('0x17')]},'attributes':['id']}});};exports[_0xaa44('0x18')]=function(_0xd7f602){return request(_0xaa44('0x19'),{'options':{'where':{'id':_0xd7f602},'attributes':[_0xaa44('0x7')]}});};exports[_0xaa44('0x1a')]=function(_0x4b28b2){return request(_0xaa44('0x1b'),{'options':{'where':{'id':_0x4b28b2},'attributes':['save_name']}});};exports[_0xaa44('0x1c')]=function(_0x16fc0f){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x16fc0f},'include':[{'model':_0xaa44('0x1d'),'as':_0xaa44('0x1e')}]}});};exports[_0xaa44('0x1f')]=function(_0x1c4de8){return request(_0xaa44('0x20'),{'options':{'where':{'id':_0x1c4de8},'attributes':['id',_0xaa44('0x7')]}});};exports[_0xaa44('0x21')]=function(_0xf9d46e){return request(_0xaa44('0x22'),{'body':_0xf9d46e});};exports[_0xaa44('0x23')]=function(_0x557ff4){return request(_0xaa44('0x24'),{'body':_0x557ff4});};exports[_0xaa44('0x25')]=function(_0x20d62e){return request(_0xaa44('0x26'),{'body':_[_0xaa44('0x27')](_0x20d62e,{'project_name':_0x20d62e[_0xaa44('0x28')],'prev_project_name':_0x20d62e[_0xaa44('0x29')]||'','is_subproject':_0x20d62e['arg_2']?!![]:![],'leaveAt':moment()[_0xaa44('0x2a')](_0xaa44('0x2b'))})});};exports[_0xaa44('0x2c')]=function(_0x1e15e5){return request('CreateSquareRecording',{'body':_0x1e15e5});};exports[_0xaa44('0x2d')]=function(_0x3015ff){return request(_0xaa44('0x2e'),{'body':_0x3015ff});};exports[_0xaa44('0x2f')]=function(_0x34b2eb){return request(_0xaa44('0x30'),{'options':{'raw':![],'where':{'phone':_0x34b2eb[_0xaa44('0x17')],'ListId':_0x34b2eb[_0xaa44('0x31')]}}})[_0xaa44('0x32')](function(_0x1ee1c7){if(_0x1ee1c7){return _0x1ee1c7;}return request(_0xaa44('0x33'),{'body':_0x34b2eb});});};exports['getPauseById']=function(_0xe324dc){return request(_0xaa44('0x34'),{'options':{'where':{'id':_0xe324dc},'attributes':[_0xaa44('0x7')]}});};exports[_0xaa44('0x35')]=function(_0x417004,_0x42bca4){return request('LoginUser',{'body':{'interface':_0x42bca4},'options':{'where':_0x417004}});};exports[_0xaa44('0x36')]=function(_0x373ae3,_0x466ffa,_0x4e761d){return request(_0xaa44('0x37'),{'body':{'type':_0x466ffa,'uniqueid':_0x4e761d},'options':{'where':_0x373ae3}});};exports['agentUnpause']=function(_0x2c2628){return request(_0xaa44('0x38'),{'body':{},'options':{'where':_0x2c2628}});};exports['agentLogout']=function(_0x24ce78){return request(_0xaa44('0x39'),{'body':{},'options':{'where':_0x24ce78}});}; \ 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 b36630c..79109af 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 _0x1419=['exports','./polly','./lex'];(function(_0x1693c3,_0x633f4b){var _0x5b136b=function(_0x2e7968){while(--_0x2e7968){_0x1693c3['push'](_0x1693c3['shift']());}};_0x5b136b(++_0x633f4b);}(_0x1419,0x127));var _0x9141=function(_0x21d441,_0x35f8b2){_0x21d441=_0x21d441-0x0;var _0x19a70b=_0x1419[_0x21d441];return _0x19a70b;};var polly=require(_0x9141('0x0'));var lex=require(_0x9141('0x1'));module[_0x9141('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x18af=['exports','./polly'];(function(_0x226d66,_0x21505b){var _0x4a2799=function(_0x22044a){while(--_0x22044a){_0x226d66['push'](_0x226d66['shift']());}};_0x4a2799(++_0x21505b);}(_0x18af,0x8b));var _0xf18a=function(_0x4ea766,_0x3d3d89){_0x4ea766=_0x4ea766-0x0;var _0x18e697=_0x18af[_0x4ea766];return _0x18e697;};var polly=require(_0xf18a('0x0'));var lex=require('./lex');module[_0xf18a('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9e3c538..813ae2f 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 _0x4ea3=['./lib/api','exports'];(function(_0x384f38,_0x12f7fd){var _0x2c311b=function(_0x143bb5){while(--_0x143bb5){_0x384f38['push'](_0x384f38['shift']());}};_0x2c311b(++_0x12f7fd);}(_0x4ea3,0x70));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ No newline at end of file +var _0x4ea3=['./lib/api','exports'];(function(_0x464329,_0x173b6b){var _0x22edfb=function(_0x56918a){while(--_0x56918a){_0x464329['push'](_0x464329['shift']());}};_0x22edfb(++_0x173b6b);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ 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 1d6ed61..785ced1 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(_0x2845ad,_0x21bf4a){var _0x1a5985=function(_0x32ce9d){while(--_0x32ce9d){_0x2845ad['push'](_0x2845ad['shift']());}};_0x1a5985(++_0x21bf4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x556cdf,_0x36de89){var _0x55eb6e=function(_0x4403ea){while(--_0x4403ea){_0x556cdf['push'](_0x556cdf['shift']());}};_0x55eb6e(++_0x36de89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 6e52208..38a3e73 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 _0x6fe4=['./lib/api','exports'];(function(_0xfca4f9,_0x508b93){var _0x2334dd=function(_0x3b1554){while(--_0x3b1554){_0xfca4f9['push'](_0xfca4f9['shift']());}};_0x2334dd(++_0x508b93);}(_0x6fe4,0x14a));var _0x46fe=function(_0x4ef51c,_0x4e3a7d){_0x4ef51c=_0x4ef51c-0x0;var _0x4cc2e8=_0x6fe4[_0x4ef51c];return _0x4cc2e8;};'use strict';var polly=require(_0x46fe('0x0'));module[_0x46fe('0x1')]=function(_0x48ea67,_0x3c1dcf,_0x34ff98,_0x4098b9,_0xb2bb90,_0x53c170,_0xd3c20b){return polly(_0x48ea67,_0x3c1dcf,_0x34ff98,_0x4098b9,_0xb2bb90,_0x53c170,_0xd3c20b);}; \ No newline at end of file +var _0x071b=['./lib/api','exports'];(function(_0x407217,_0x36d62a){var _0x2dc211=function(_0x3cbe9a){while(--_0x3cbe9a){_0x407217['push'](_0x407217['shift']());}};_0x2dc211(++_0x36d62a);}(_0x071b,0x124));var _0xb071=function(_0x3b9834,_0x378e63){_0x3b9834=_0x3b9834-0x0;var _0x43f8b8=_0x071b[_0x3b9834];return _0x43f8b8;};'use strict';var polly=require(_0xb071('0x0'));module[_0xb071('0x1')]=function(_0x41ff24,_0x459cb2,_0x56030c,_0x63aeb,_0x45f2cd,_0x4517f6,_0x52f20b){return polly(_0x41ff24,_0x459cb2,_0x56030c,_0x63aeb,_0x45f2cd,_0x4517f6,_0x52f20b);}; \ 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 5ea04c5..7edb0a1 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 _0xcb45=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1f7f0d,_0x378063){var _0x545d6a=function(_0x34df7c){while(--_0x34df7c){_0x1f7f0d['push'](_0x1f7f0d['shift']());}};_0x545d6a(++_0x378063);}(_0xcb45,0xe9));var _0x5cb4=function(_0x34d8ab,_0x16029d){_0x34d8ab=_0x34d8ab-0x0;var _0x1b7ae5=_0xcb45[_0x34d8ab];return _0x1b7ae5;};'use strict';var fs=require('fs');var path=require(_0x5cb4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x5cb4('0x1'));function pollyResult(_0x3a1354,_0x2d5c0b,_0x480a8d){return new BPromise(function(_0x56a3b0,_0x28283d){_0x3a1354[_0x5cb4('0x2')](_0x2d5c0b,function(_0xb07c5,_0x391acc){if(_0xb07c5){_0x28283d(_0xb07c5);}else if(_0x391acc){if(_0x391acc[_0x5cb4('0x3')]instanceof Buffer){fs[_0x5cb4('0x4')](_0x480a8d,_0x391acc[_0x5cb4('0x3')],function(_0x358187){if(_0x358187){_0x28283d(_0x358187);}else{_0x56a3b0();}});}else{_0x28283d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x28283d(new Error(_0x5cb4('0x5')));}});});}module[_0x5cb4('0x6')]=function(_0x442d94,_0x5c62d6,_0x260029,_0x380f1c,_0x1c1e43,_0x52086f,_0x2535f4){var _0x55dd60=new AWS['Polly']({'accessKeyId':_0x442d94,'secretAccessKey':_0x5c62d6,'region':_0x260029});var _0xa5bd00={'Text':_0x1c1e43,'TextType':_0x52086f||'text','OutputFormat':'mp3','VoiceId':_0x380f1c};return pollyResult(_0x55dd60,_0xa5bd00,_0x2535f4);}; \ No newline at end of file +var _0xa4d4=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xa4d4,0xc8));var _0x4a4d=function(_0x1a74c3,_0x132768){_0x1a74c3=_0x1a74c3-0x0;var _0x26a463=_0xa4d4[_0x1a74c3];return _0x26a463;};'use strict';var fs=require('fs');var path=require(_0x4a4d('0x0'));var BPromise=require(_0x4a4d('0x1'));var rs=require(_0x4a4d('0x2'));var AWS=require(_0x4a4d('0x3'));function pollyResult(_0x13861a,_0x319390,_0x5999d1){return new BPromise(function(_0xf98e1c,_0x1b3463){_0x13861a[_0x4a4d('0x4')](_0x319390,function(_0x4ac992,_0x3eb221){if(_0x4ac992){_0x1b3463(_0x4ac992);}else if(_0x3eb221){if(_0x3eb221[_0x4a4d('0x5')]instanceof Buffer){fs['writeFile'](_0x5999d1,_0x3eb221[_0x4a4d('0x5')],function(_0x213411){if(_0x213411){_0x1b3463(_0x213411);}else{_0xf98e1c();}});}else{_0x1b3463(new Error(_0x4a4d('0x6')));}}else{_0x1b3463(new Error(_0x4a4d('0x7')));}});});}module[_0x4a4d('0x8')]=function(_0x59cd33,_0x57d012,_0x4778ad,_0x4a3a2f,_0x52f3c1,_0x5ad366,_0x8397d2){var _0x311866=new AWS[(_0x4a4d('0x9'))]({'accessKeyId':_0x59cd33,'secretAccessKey':_0x57d012,'region':_0x4778ad});var _0x574245={'Text':_0x52f3c1,'TextType':_0x5ad366||_0x4a4d('0xa'),'OutputFormat':_0x4a4d('0xb'),'VoiceId':_0x4a3a2f};return pollyResult(_0x311866,_0x574245,_0x8397d2);}; \ 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 6cc4669..21be5c4 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 _0x75cb=['./lib/api'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x75cb,0x1d2));var _0xb75c=function(_0x448a56,_0x3cd4d1){_0x448a56=_0x448a56-0x0;var _0x1ba466=_0x75cb[_0x448a56];return _0x1ba466;};'use strict';var asr=require(_0xb75c('0x0'));module['exports']=function(_0x12b767,_0x175c16,_0x207112,_0xb128b0){return asr(_0x12b767,_0x175c16,_0x207112);}; \ No newline at end of file +var _0xa310=['./lib/api','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa310,0xf0));var _0x0a31=function(_0x2ac5a4,_0xcaadbf){_0x2ac5a4=_0x2ac5a4-0x0;var _0x1afa19=_0xa310[_0x2ac5a4];return _0x1afa19;};'use strict';var asr=require(_0x0a31('0x0'));module[_0x0a31('0x1')]=function(_0xb36917,_0x12fd91,_0x283d9b,_0x5a05e6){return asr(_0xb36917,_0x12fd91,_0x283d9b);}; \ 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 54bc9b7..1cbb2ac 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 _0x524a=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x109f94,_0x5ab6e4){var _0x5ad1bd=function(_0x53ce8c){while(--_0x53ce8c){_0x109f94['push'](_0x109f94['shift']());}};_0x5ad1bd(++_0x5ab6e4);}(_0x524a,0xf5));var _0xa524=function(_0x4af4f3,_0x15af2d){_0x4af4f3=_0x4af4f3-0x0;var _0x155022=_0x524a[_0x4af4f3];return _0x155022;};'use strict';var url=require(_0xa524('0x0'));var BPromise=require(_0xa524('0x1'));var fs=require('fs');var host=_0xa524('0x2');module[_0xa524('0x3')]=function(_0x53c48c,_0x4a29b7,_0x2ef77c){return new BPromise(function(_0xa89d8c,_0x56ab08){var _0x50ec75;if(typeof _0x53c48c!==_0xa524('0x4')||_0x53c48c[_0xa524('0x5')]===0x0){return _0x56ab08(_0xa524('0x6'));}if(typeof _0x4a29b7!=='string'||_0x4a29b7[_0xa524('0x5')]===0x0){return _0x56ab08('key\x20should\x20be\x20a\x20string');}if(typeof _0x2ef77c!==_0xa524('0x7')&&(typeof _0x2ef77c!==_0xa524('0x4')||_0x2ef77c['length']===0x0)){return _0x56ab08(_0xa524('0x8'));}try{_0x50ec75=fs[_0xa524('0x9')](_0x53c48c)[_0xa524('0xa')](_0xa524('0xb'));}catch(_0x3b484b){return _0x56ab08(_0x3b484b);}return _0xa89d8c({'method':'POST','uri':host+_0xa524('0xc')+_0x4a29b7,'body':{'config':{'encoding':_0xa524('0xd'),'sampleRateHertz':'8000','languageCode':_0x2ef77c},'audio':{'content':_0x50ec75}},'json':!![]});});}; \ No newline at end of file +var _0xc577=['length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','8000','url','exports'];(function(_0x2697d9,_0x26806a){var _0x25e6ae=function(_0x4ff250){while(--_0x4ff250){_0x2697d9['push'](_0x2697d9['shift']());}};_0x25e6ae(++_0x26806a);}(_0xc577,0x172));var _0x7c57=function(_0x1c8567,_0x5180c6){_0x1c8567=_0x1c8567-0x0;var _0x5309fd=_0xc577[_0x1c8567];return _0x5309fd;};'use strict';var url=require(_0x7c57('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x7c57('0x1')]=function(_0x35af09,_0xe9a500,_0x2a2415){return new BPromise(function(_0x3abdb2,_0x304922){var _0x2ea08b;if(typeof _0x35af09!=='string'||_0x35af09[_0x7c57('0x2')]===0x0){return _0x304922(_0x7c57('0x3'));}if(typeof _0xe9a500!==_0x7c57('0x4')||_0xe9a500[_0x7c57('0x2')]===0x0){return _0x304922(_0x7c57('0x5'));}if(typeof _0x2a2415!=='undefined'&&(typeof _0x2a2415!=='string'||_0x2a2415['length']===0x0)){return _0x304922(_0x7c57('0x6'));}try{_0x2ea08b=fs['readFileSync'](_0x35af09)[_0x7c57('0x7')](_0x7c57('0x8'));}catch(_0x11dd41){return _0x304922(_0x11dd41);}return _0x3abdb2({'method':_0x7c57('0x9'),'uri':host+'/v1/speech:recognize?key='+_0xe9a500,'body':{'config':{'encoding':_0x7c57('0xa'),'sampleRateHertz':_0x7c57('0xb'),'languageCode':_0x2a2415},'audio':{'content':_0x2ea08b}},'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 026b053..092055b 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 _0x8825=['exports'];(function(_0x1e0cce,_0x4e2913){var _0x2f2a85=function(_0x1b5c08){while(--_0x1b5c08){_0x1e0cce['push'](_0x1e0cce['shift']());}};_0x2f2a85(++_0x4e2913);}(_0x8825,0x17e));var _0x5882=function(_0x447fdd,_0x21f753){_0x447fdd=_0x447fdd-0x0;var _0x3075e0=_0x8825[_0x447fdd];return _0x3075e0;};var asr=require('./asr');module[_0x5882('0x0')]={'asr':asr}; \ No newline at end of file +var _0x75db=['exports'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x75db,0x1e6));var _0xb75d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75db[_0x3dd15e];return _0x231fd0;};var asr=require('./asr');module[_0xb75d('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 8bb315d..eace65d 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 _0x5311=['score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','isFallback','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','md5','path','querystring','randomstring','sox','url','util','./aws','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','toString','base64','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','POST','tmp','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech'];(function(_0x3608b6,_0x200aa2){var _0x48c903=function(_0x209a5d){while(--_0x209a5d){_0x3608b6['push'](_0x3608b6['shift']());}};_0x48c903(++_0x200aa2);}(_0x5311,0x138));var _0x1531=function(_0x53fb27,_0x3f4c7e){_0x53fb27=_0x53fb27-0x0;var _0x41de0d=_0x5311[_0x53fb27];return _0x41de0d;};'use strict';var apiai=require(_0x1531('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1531('0x1'));var https=require(_0x1531('0x2'));var md5=require(_0x1531('0x3'));var path=require(_0x1531('0x4'));var querystring=require(_0x1531('0x5'));var rp=require('request-promise');var rs=require(_0x1531('0x6'));var sox=require(_0x1531('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x1531('0x8'))['parse'];var util=require(_0x1531('0x9'));var aws=require(_0x1531('0xa'));var google=require('./google');var sestek=require(_0x1531('0xb'));var tilde=require(_0x1531('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x1531('0xd');function downloadFile(_0x249da0,_0x5b29a3){return new BPromise(function(_0x5993a6,_0x3f0c31){var _0x4a17ef=urlParse(_0x249da0);var _0x5e169e=_0x4a17ef[_0x1531('0xe')]===_0x1531('0xf')?https:http;var _0x39b3e5={'host':_0x4a17ef[_0x1531('0x10')],'path':_0x4a17ef['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x5e169e[_0x1531('0x11')](_0x39b3e5,function(_0xf9ae09){if(_0xf9ae09[_0x1531('0x12')]!==0xc8){logger[_0x1531('0x13')]('request\x20to\x20'+_0x249da0+'\x20failed,\x20status\x20code\x20=\x20'+_0xf9ae09[_0x1531('0x12')]+'\x20('+_0xf9ae09['statusMessage']+')');_0x3f0c31(new Error(_0x1531('0x14')+_0x249da0+_0x1531('0x15')+_0xf9ae09[_0x1531('0x12')]+'\x20('+_0xf9ae09[_0x1531('0x16')]+')'));return;}var _0xeb98d7=fs[_0x1531('0x17')](_0x5b29a3);_0xeb98d7['on'](_0x1531('0x18'),function(){logger[_0x1531('0x19')]('finish\x20download\x20file');_0xeb98d7['close'](_0x5993a6);});_0xeb98d7['on'](_0x1531('0x13'),function(_0x42c27f){fs['unlink'](_0x5b29a3);logger['error'](_0x1531('0x1a'),_0x42c27f);_0x3f0c31(_0x42c27f);});_0xf9ae09[_0x1531('0x1b')](_0xeb98d7);})['on'](_0x1531('0x13'),function(_0x3a3602){logger['error'](_0x3a3602);_0x3f0c31(_0x3a3602);})[_0x1531('0x1c')]();});}function uploadFile(_0x30752a){return new BPromise(function(_0x432eca,_0x128358){var _0x4eaf31=urlParse(_0x30752a);var _0x36751a=_0x4eaf31[_0x1531('0xe')]===_0x1531('0xf')?https:http;var _0x2d47d8={'host':_0x4eaf31[_0x1531('0x10')],'path':_0x4eaf31['path'],'headers':{'user-agent':_0x1531('0x1d')}};_0x36751a[_0x1531('0x11')](_0x2d47d8,function(_0x44d9f5){if(_0x44d9f5[_0x1531('0x12')]!==0xc8){_0x128358(new Error(_0x1531('0x14')+_0x30752a+_0x1531('0x15')+_0x44d9f5[_0x1531('0x12')]+'\x20('+_0x44d9f5['statusMessage']+')'));return;}var _0x5290c9='';_0x44d9f5['on'](_0x1531('0x1e'),function(_0x2d26e1){_0x5290c9+=_0x2d26e1;});_0x44d9f5['on'](_0x1531('0x1c'),function(){_0x432eca(_0x5290c9);});})['on'](_0x1531('0x13'),function(_0xaa69e4){_0x128358(_0xaa69e4);})[_0x1531('0x1c')]();});}function convertFile(_0x583753,_0x299127){return new BPromise(function(_0x42ceea,_0x168b0d){var _0x26ba25=sox[_0x1531('0x1f')](_0x583753,_0x299127,{'sampleRate':0x1f40,'format':_0x1531('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26ba25['on'](_0x1531('0x13'),function(_0x96a6df){logger['error']('error\x20convert',_0x96a6df);_0x168b0d(_0x96a6df);});_0x26ba25['on'](_0x1531('0x1c'),function(){logger['info'](_0x1531('0x21'));_0x42ceea();});_0x26ba25[_0x1531('0x22')]();});}function base64Decode(_0x2c9508,_0x4bb1b5){var _0x545f1a=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));fs[_0x1531('0x26')](_0x545f1a,_0x2c9508,'base64');return convertFile(_0x545f1a,_0x4bb1b5)[_0x1531('0x27')](function(){try{fs[_0x1531('0x28')](_0x545f1a);fs[_0x1531('0x29')](_0x4bb1b5,_0x1531('0x2a'));}catch(_0x1a3f9c){logger[_0x1531('0x13')](_0x1a3f9c);}return _0x4bb1b5[_0x1531('0x2b')]('.')[0x0];});}function base64Encode(_0x5a5fde){var _0x4d3d2b=fs['readFileSync'](_0x5a5fde);return new Buffer(_0x4d3d2b)[_0x1531('0x2c')](_0x1531('0x2d'));}exports['googleCloudTTS']=function(_0x344f2d,_0x314c75,_0x5b950d,_0x436aa7,_0x21b0b4,_0x46fff4){var _0x21cc9d,_0x56ba75;var _0x2feb28=_0x1531('0x2e');var _0x527803='?key='+_0x344f2d;var _0x502154={};if(_0x314c75===_0x1531('0x2f')){_0x502154[_0x1531('0x30')]={'ssml':_0x5b950d};}else{_0x502154['input']={'text':_0x5b950d};};_0x502154['voice']={'languageCode':_0x436aa7,'ssmlGender':_0x21b0b4};_0x502154[_0x1531('0x31')]={'audioEncoding':_0x1531('0x32'),'sampleRateHertz':0x1f40};var _0x1cbb93={'url':_0x2feb28+'text:synthesize'+_0x527803,'method':_0x1531('0x33'),'json':!![],'body':_0x502154};return rp(_0x1cbb93)[_0x1531('0x27')](function(_0x4c83ca){return new BPromise(function(_0x397c13,_0x1d481c){_0x21cc9d=path['resolve'](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));var _0x3def3a=Buffer['from'](_0x4c83ca[_0x1531('0x36')],_0x1531('0x2d'));return fs[_0x1531('0x37')](_0x21cc9d,_0x3def3a,function(_0x28b5ea){_0x1d481c(_0x28b5ea);},function(_0xbccc4b){fs[_0x1531('0x29')](_0x21cc9d,_0x1531('0x2a'));_0x397c13(_0xbccc4b);});});})[_0x1531('0x27')](function(_0x3d3a1b){_0x56ba75=path[_0x1531('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x21cc9d,_0x56ba75);})[_0x1531('0x27')](function(){try{fs['unlink'](_0x21cc9d);fs[_0x1531('0x29')](_0x56ba75,_0x1531('0x2a'));}catch(_0x575bda){logger['error'](_0x575bda);}logger['info'](_0x1531('0x38'),_0x56ba75['split']('.')[0x0]);return _0x56ba75[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x39')]=function(_0x809dd3,_0x4b69eb){var _0x347651='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x47464e,_0x20cf12;var _0x48e578;var _0xa41a04={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x347651,'headers':{'Content-Type':_0x1531('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0x1531('0x3b')]([[[_0x1531('0x3c'),JSON[_0x1531('0x3b')]([_0x809dd3,_0x4b69eb||'en',![],_0x1531('0x3d')]),null,_0x1531('0x3e')]]]))};return rp(_0xa41a04)['then'](function(_0x3ece6a){try{_0x48e578=eval(_0x3ece6a[_0x1531('0x3f')](0x5))[0x0][0x2];}catch(_0x28fd9a){throw new Error('parse\x20response\x20failed:\x0a'+_0x3ece6a[_0x1531('0x1e')]);}if(!_0x48e578){if(_0x809dd3[_0x1531('0x40')]>0xc8){throw new Error(_0x1531('0x41'));}else{throw new Error('lang\x20\x22'+_0x4b69eb+_0x1531('0x42'));}}try{_0x48e578=eval(_0x48e578)[0x0];}catch(_0x37a142){throw new Error(_0x1531('0x43')+res[_0x1531('0x1e')]);}const _0x4fbe2d=_0x48e578;_0x47464e=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));fs[_0x1531('0x26')](_0x47464e,_0x48e578,{'encoding':_0x1531('0x2d')});_0x20cf12=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs['generate'](0x4)+'.wav');return convertFile(_0x47464e,_0x20cf12);})[_0x1531('0x27')](function(){try{fs[_0x1531('0x28')](_0x47464e);fs['chmodSync'](_0x20cf12,_0x1531('0x2a'));}catch(_0x587c63){logger[_0x1531('0x13')](_0x587c63);}logger[_0x1531('0x19')](_0x1531('0x44'),_0x20cf12[_0x1531('0x2b')]('.')[0x0]);return _0x20cf12[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x45')]=function(_0x1b4a1a,_0x1d3a6b,_0x4edaf2){return google[_0x1531('0x46')](_0x1b4a1a,_0x1d3a6b,_0x4edaf2)[_0x1531('0x27')](function(_0xee4819){logger['info'](_0xee4819[_0x1531('0x47')]);return rp(_0xee4819);})[_0x1531('0x27')](function(_0x3d3f7c){var _0x486ec3='';var _0x477f01=0x0;try{fs['unlink'](_0x1b4a1a);}catch(_0x45bb7e){logger['error'](_0x45bb7e);}if(_0x3d3f7c&&_0x3d3f7c[_0x1531('0x48')]){_0x486ec3=_0x3d3f7c['results']['map'](function(_0x3e5b5d){return _0x3e5b5d&&_0x3e5b5d[_0x1531('0x49')][0x0]&&_0x3e5b5d[_0x1531('0x49')][0x0]['transcript']?_0x3e5b5d['alternatives'][0x0][_0x1531('0x4a')]:'';})['join']('\x0a');_0x477f01=_0x3d3f7c[_0x1531('0x48')][_0x1531('0x4b')](function(_0x222a80){return _0x222a80&&_0x222a80[_0x1531('0x49')][0x0]&&_0x222a80[_0x1531('0x49')][0x0][_0x1531('0x4c')]?_0x222a80[_0x1531('0x49')][0x0][_0x1531('0x4c')]:0x0;})['join']('\x0a');}logger[_0x1531('0x19')]('googleASR\x20transcription',_0x486ec3);logger[_0x1531('0x19')]('googleASR\x20confidence',_0x477f01);return{'transcript':_0x486ec3,'confidence':_0x477f01};})['catch'](function(_0x3c57e8){logger[_0x1531('0x13')]('[%s]\x20%s:%s',_0x3c57e8[_0x1531('0x12')],_0x3c57e8['name'],_0x3c57e8[_0x1531('0x4d')]);});};exports[_0x1531('0x4e')]=function(_0x2f8edd,_0x2fe85c,_0x2357e1,_0x3535f8){var _0x88c76b=apiai(_0x2fe85c,{'language':_0x3535f8||'en'});return _0x88c76b[_0x1531('0x4f')](_0x2357e1,{'sessionId':md5(_0x2f8edd)})[_0x1531('0x27')](function(_0x12a2f1){logger[_0x1531('0x19')](JSON['stringify'](_0x12a2f1));return{'source':_0x12a2f1[_0x1531('0x50')][_0x1531('0x51')],'resolvedQuery':_0x12a2f1[_0x1531('0x50')][_0x1531('0x52')],'action':_0x12a2f1[_0x1531('0x50')][_0x1531('0x53')],'actionIncomplete':_0x12a2f1[_0x1531('0x50')][_0x1531('0x54')],'speech':_0x12a2f1['result'][_0x1531('0x55')][_0x1531('0x56')],'score':_0x12a2f1[_0x1531('0x50')][_0x1531('0x57')],'statusCode':_0x12a2f1['status'][_0x1531('0x58')],'endConversation':_0x12a2f1[_0x1531('0x50')][_0x1531('0x59')][_0x1531('0x5a')]||![],'isFallbackIntent':_0x12a2f1[_0x1531('0x50')]['metadata'][_0x1531('0x5b')]};});};exports[_0x1531('0x5c')]=function(_0x3c51bf,_0x416214,_0x92eabf,_0x19a64c,_0x16f999,_0x20c437){var _0x2c06dd=_0x19a64c[_0x1531('0x5d')](/\\n/g,'\x0a');var _0xa8d81={'credentials':{'private_key':_0x2c06dd,'client_email':_0x92eabf}};var _0x399c95=new dialogflow[(_0x1531('0x5e'))](_0xa8d81);var _0x392374=_0x399c95[_0x1531('0x5f')](_0x416214,md5(_0x3c51bf));var _0x28cb59={'session':_0x392374,'queryInput':{'text':{'text':_0x16f999,'languageCode':_0x20c437}}};return _0x399c95[_0x1531('0x60')](_0x28cb59)[_0x1531('0x27')](function(_0x2b1550){if(_0x2b1550&&_0x2b1550[_0x1531('0x40')]){logger['info'](_0x1531('0x61'),JSON['stringify'](_0x2b1550));var _0x322d35=_0x2b1550[0x0];if(_0x322d35){var _0xac5793={'action':_0x322d35[_0x1531('0x62')][_0x1531('0x53')],'allRequiredParamsPresent':_0x322d35['queryResult']['allRequiredParamsPresent'],'endConversation':_0x322d35[_0x1531('0x62')][_0x1531('0x63')]&&_0x322d35[_0x1531('0x62')][_0x1531('0x63')][_0x1531('0x64')]?_0x322d35['queryResult'][_0x1531('0x63')][_0x1531('0x64')][_0x1531('0x65')][_0x1531('0x66')]:![],'fulfillmentText':_0x322d35[_0x1531('0x62')]['fulfillmentText'],'intentName':_0x322d35[_0x1531('0x62')][_0x1531('0x67')]['name'],'intentDisplayName':_0x322d35[_0x1531('0x62')][_0x1531('0x67')]['displayName'],'isFallbackIntent':_0x322d35[_0x1531('0x62')][_0x1531('0x67')][_0x1531('0x68')],'languageCode':_0x322d35[_0x1531('0x62')][_0x1531('0x69')],'queryText':_0x322d35[_0x1531('0x62')]['queryText'],'responseId':_0x322d35[_0x1531('0x6a')],'score':_0x322d35[_0x1531('0x62')][_0x1531('0x6b')],'speech':_0x322d35[_0x1531('0x62')][_0x1531('0x6c')],'providerResponse':JSON['stringify'](_0x2b1550)};return _0xac5793;}}});};exports[_0x1531('0x6d')]=function(_0xc9621b,_0x17991e,_0x4219be,_0x4580c4){return tilde[_0x1531('0x46')](_0xc9621b,_0x17991e,_0x4219be,_0x4580c4)['then'](function(_0x1cfe63){try{fs['unlink'](_0xc9621b);}catch(_0x1b538f){logger['error'](_0x1b538f);}logger[_0x1531('0x19')](_0x1531('0x6e'),_0x1cfe63[_0x1531('0x4a')]);logger[_0x1531('0x19')](_0x1531('0x6f'),_0x1cfe63['confidence']);return _0x1cfe63;});};exports[_0x1531('0x70')]=function(_0xb1d020,_0x2e24a6,_0x48f912,_0x205328,_0x32127b,_0x3791d4){var _0x56612c=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x1f6a89;return aws[_0x1531('0x71')](_0xb1d020,_0x2e24a6,_0x48f912,_0x205328,_0x32127b,_0x3791d4,_0x56612c)['then'](function(){_0x1f6a89=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));return convertFile(_0x56612c,_0x1f6a89);})[_0x1531('0x27')](function(){try{fs['unlink'](_0x56612c);fs[_0x1531('0x29')](_0x1f6a89,'777');}catch(_0x40820a){logger[_0x1531('0x13')](_0x40820a);}return _0x1f6a89[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x72')]=function(_0x2c1c57,_0x26f7d7,_0x204c5f,_0x2b9eb7,_0x231d6b,_0x49cbac){return aws[_0x1531('0x73')](_0x2c1c57,_0x26f7d7,_0x204c5f,_0x2b9eb7,_0x231d6b,_0x49cbac)[_0x1531('0x27')](function(_0xbaa5e){logger['info'](JSON[_0x1531('0x3b')](_0xbaa5e));return _0xbaa5e;});};exports[_0x1531('0x74')]=function(_0x310059,_0x29609a,_0x35fb00,_0x358377){var _0x22baae=util[_0x1531('0x75')](_0x1531('0x76'),ISPEECH_API,_0x310059,encodeURIComponent(_0x29609a),_0x35fb00,_0x358377);var _0xffd7c6=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));var _0x27734b;return downloadFile(_0x22baae,_0xffd7c6)[_0x1531('0x27')](function(){_0x27734b=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));return convertFile(_0xffd7c6,_0x27734b);})['then'](function(){try{fs[_0x1531('0x28')](_0xffd7c6);fs[_0x1531('0x29')](_0x27734b,_0x1531('0x2a'));}catch(_0x578f90){logger[_0x1531('0x13')](_0x578f90);}return _0x27734b[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x77')]=function(_0x10946b,_0x49c7ef,_0x2e3d2,_0x2185bb){var _0x80996b=util[_0x1531('0x75')](_0x1531('0x78'),ISPEECH_API,_0x49c7ef,_0x2e3d2,base64Encode(_0x10946b),_0x2185bb?util['format'](_0x1531('0x79'),encodeURIComponent(_0x2185bb)):_0x1531('0x7a'));return uploadFile(_0x80996b)[_0x1531('0x27')](function(_0xa5d516){return querystring[_0x1531('0x7b')](_0xa5d516);});};exports[_0x1531('0x7c')]=function(_0x1f95c4,_0x222932){return sestek[_0x1531('0x7d')](_0x1f95c4,_0x222932)[_0x1531('0x27')](function(_0x1bd753){logger[_0x1531('0x19')](JSON[_0x1531('0x3b')](_0x1bd753));var _0x206f17={'speech':_0x1bd753[_0x1531('0x7e')],'action':_0x1bd753['channelData']?_0x1bd753[_0x1531('0x7f')][_0x1531('0x80')]:undefined,'actiondata':_0x1bd753[_0x1531('0x7f')]?_0x1bd753[_0x1531('0x7f')]['CustomActionData']:undefined};if(_0x1bd753[_0x1531('0x7f')]&&_0x1bd753['channelData']['AudioFromTts']){return base64Decode(_0x1bd753[_0x1531('0x7f')][_0x1531('0x81')][_0x1531('0x82')],path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs['generate'](0x4)+_0x1531('0x25')))['then'](function(_0x206f24){_0x206f17[_0x1531('0x83')]=_0x206f24;return _0x206f17;});}return _0x206f17;});};exports[_0x1531('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x054c=['result','source','resolvedQuery','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','replace','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','unlink','download\x20error','pipe','end','statusMessage','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','777','info','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify'];(function(_0x1ec98b,_0x541c11){var _0x257ea4=function(_0x3b7fde){while(--_0x3b7fde){_0x1ec98b['push'](_0x1ec98b['shift']());}};_0x257ea4(++_0x541c11);}(_0x054c,0xba));var _0xc054=function(_0x264d2b,_0x199fe7){_0x264d2b=_0x264d2b-0x0;var _0x46b945=_0x054c[_0x264d2b];return _0x46b945;};'use strict';var apiai=require(_0xc054('0x0'));var BPromise=require(_0xc054('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xc054('0x2'));var https=require(_0xc054('0x3'));var md5=require(_0xc054('0x4'));var path=require(_0xc054('0x5'));var querystring=require('querystring');var rp=require(_0xc054('0x6'));var rs=require(_0xc054('0x7'));var sox=require(_0xc054('0x8'));var tts=require(_0xc054('0x9'));var urlParse=require(_0xc054('0xa'))[_0xc054('0xb')];var util=require(_0xc054('0xc'));var aws=require(_0xc054('0xd'));var google=require(_0xc054('0xe'));var sestek=require(_0xc054('0xf'));var tilde=require(_0xc054('0x10'));var logger=require(_0xc054('0x11'))('agi');var ISPEECH_API=_0xc054('0x12');function downloadFile(_0x373e54,_0x15fb1f){return new BPromise(function(_0x26a523,_0x47b7fd){var _0x2284c9=urlParse(_0x373e54);var _0x103fb7=_0x2284c9[_0xc054('0x13')]===_0xc054('0x14')?https:http;var _0x2848ea={'host':_0x2284c9[_0xc054('0x15')],'path':_0x2284c9[_0xc054('0x5')],'headers':{'user-agent':_0xc054('0x16')}};_0x103fb7['get'](_0x2848ea,function(_0x4258f5){if(_0x4258f5['statusCode']!==0xc8){logger[_0xc054('0x17')]('request\x20to\x20'+_0x373e54+'\x20failed,\x20status\x20code\x20=\x20'+_0x4258f5[_0xc054('0x18')]+'\x20('+_0x4258f5['statusMessage']+')');_0x47b7fd(new Error(_0xc054('0x19')+_0x373e54+_0xc054('0x1a')+_0x4258f5[_0xc054('0x18')]+'\x20('+_0x4258f5['statusMessage']+')'));return;}var _0x48fbc8=fs[_0xc054('0x1b')](_0x15fb1f);_0x48fbc8['on'](_0xc054('0x1c'),function(){logger['info'](_0xc054('0x1d'));_0x48fbc8['close'](_0x26a523);});_0x48fbc8['on'](_0xc054('0x17'),function(_0x3a1e9c){fs[_0xc054('0x1e')](_0x15fb1f);logger[_0xc054('0x17')](_0xc054('0x1f'),_0x3a1e9c);_0x47b7fd(_0x3a1e9c);});_0x4258f5[_0xc054('0x20')](_0x48fbc8);})['on'](_0xc054('0x17'),function(_0x49636a){logger[_0xc054('0x17')](_0x49636a);_0x47b7fd(_0x49636a);})[_0xc054('0x21')]();});}function uploadFile(_0x2ce0b3){return new BPromise(function(_0x475040,_0x1ffc51){var _0x57132b=urlParse(_0x2ce0b3);var _0x19a5b9=_0x57132b[_0xc054('0x13')]==='https:'?https:http;var _0x288980={'host':_0x57132b[_0xc054('0x15')],'path':_0x57132b[_0xc054('0x5')],'headers':{'user-agent':_0xc054('0x16')}};_0x19a5b9['get'](_0x288980,function(_0x56bb2e){if(_0x56bb2e[_0xc054('0x18')]!==0xc8){_0x1ffc51(new Error(_0xc054('0x19')+_0x2ce0b3+_0xc054('0x1a')+_0x56bb2e[_0xc054('0x18')]+'\x20('+_0x56bb2e[_0xc054('0x22')]+')'));return;}var _0x355c9='';_0x56bb2e['on'](_0xc054('0x23'),function(_0x3f6f79){_0x355c9+=_0x3f6f79;});_0x56bb2e['on'](_0xc054('0x21'),function(){_0x475040(_0x355c9);});})['on'](_0xc054('0x17'),function(_0x1dad17){_0x1ffc51(_0x1dad17);})['end']();});}function convertFile(_0x139552,_0x3ce71c){return new BPromise(function(_0xfe2181,_0x1cb0ca){var _0x442520=sox[_0xc054('0x24')](_0x139552,_0x3ce71c,{'sampleRate':0x1f40,'format':_0xc054('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x442520['on']('error',function(_0x2bdd72){logger[_0xc054('0x17')](_0xc054('0x26'),_0x2bdd72);_0x1cb0ca(_0x2bdd72);});_0x442520['on']('end',function(){logger['info'](_0xc054('0x27'));_0xfe2181();});_0x442520[_0xc054('0x28')]();});}function base64Decode(_0x1f41b7,_0x624bc5){var _0x453f3c=path[_0xc054('0x29')](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+_0xc054('0x2c'));fs[_0xc054('0x2d')](_0x453f3c,_0x1f41b7,_0xc054('0x2e'));return convertFile(_0x453f3c,_0x624bc5)[_0xc054('0x2f')](function(){try{fs[_0xc054('0x1e')](_0x453f3c);fs[_0xc054('0x30')](_0x624bc5,'777');}catch(_0x8488ce){logger[_0xc054('0x17')](_0x8488ce);}return _0x624bc5[_0xc054('0x31')]('.')[0x0];});}function base64Encode(_0x3bb617){var _0x4cd2dc=fs['readFileSync'](_0x3bb617);return new Buffer(_0x4cd2dc)[_0xc054('0x32')]('base64');}exports[_0xc054('0x33')]=function(_0x4d1582,_0x4efcdf,_0x3a2ac4,_0x48d04b,_0x58da4a,_0xc07198){var _0x2c2ae9,_0x2aa3e9;var _0x2e8882='https://texttospeech.googleapis.com/v1/';var _0x503678=_0xc054('0x34')+_0x4d1582;var _0x5c187d={};if(_0x4efcdf===_0xc054('0x35')){_0x5c187d[_0xc054('0x36')]={'ssml':_0x3a2ac4};}else{_0x5c187d[_0xc054('0x36')]={'text':_0x3a2ac4};};_0x5c187d[_0xc054('0x37')]={'languageCode':_0x48d04b,'ssmlGender':_0x58da4a};_0x5c187d[_0xc054('0x38')]={'audioEncoding':_0xc054('0x39'),'sampleRateHertz':0x1f40};var _0x35d354={'url':_0x2e8882+_0xc054('0x3a')+_0x503678,'method':_0xc054('0x3b'),'json':!![],'body':_0x5c187d};return rp(_0x35d354)[_0xc054('0x2f')](function(_0x241873){return new BPromise(function(_0x46584e,_0x30898b){_0x2c2ae9=path[_0xc054('0x29')](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+'.mp3');var _0x1c04c6=Buffer[_0xc054('0x3c')](_0x241873[_0xc054('0x3d')],_0xc054('0x2e'));return fs[_0xc054('0x3e')](_0x2c2ae9,_0x1c04c6,function(_0x1c903e){_0x30898b(_0x1c903e);},function(_0xab57c8){fs[_0xc054('0x30')](_0x2c2ae9,_0xc054('0x3f'));_0x46584e(_0xab57c8);});});})['then'](function(_0x3577f2){_0x2aa3e9=path[_0xc054('0x29')](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+_0xc054('0x2c'));return convertFile(_0x2c2ae9,_0x2aa3e9);})['then'](function(){try{fs[_0xc054('0x1e')](_0x2c2ae9);fs[_0xc054('0x30')](_0x2aa3e9,'777');}catch(_0x179385){logger[_0xc054('0x17')](_0x179385);}logger[_0xc054('0x40')](_0xc054('0x41'),_0x2aa3e9[_0xc054('0x31')]('.')[0x0]);return _0x2aa3e9[_0xc054('0x31')]('.')[0x0];});};exports[_0xc054('0x42')]=function(_0x431700,_0x16988d){var _0x3b292f='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x455e1d,_0x3f54f6;var _0x1bead2;var _0x2d356f={'encoding':_0xc054('0x43'),'method':'POST','timeout':0x2710,'url':_0x3b292f,'headers':{'Content-Type':_0xc054('0x44')},'body':_0xc054('0x45')+encodeURIComponent(JSON['stringify']([[[_0xc054('0x46'),JSON['stringify']([_0x431700,_0x16988d||'en',![],_0xc054('0x47')]),null,'generic']]]))};return rp(_0x2d356f)[_0xc054('0x2f')](function(_0x851596){try{_0x1bead2=eval(_0x851596[_0xc054('0x48')](0x5))[0x0][0x2];}catch(_0x540526){throw new Error(_0xc054('0x49')+_0x851596[_0xc054('0x23')]);}if(!_0x1bead2){if(_0x431700[_0xc054('0x4a')]>0xc8){throw new Error(_0xc054('0x4b'));}else{throw new Error('lang\x20\x22'+_0x16988d+_0xc054('0x4c'));}}try{_0x1bead2=eval(_0x1bead2)[0x0];}catch(_0x4dc98f){throw new Error(_0xc054('0x49')+res[_0xc054('0x23')]);}const _0x401ee7=_0x1bead2;_0x455e1d=path[_0xc054('0x29')](__dirname,'tmp',rs[_0xc054('0x2b')](0x4)+_0xc054('0x4d'));fs[_0xc054('0x2d')](_0x455e1d,_0x1bead2,{'encoding':_0xc054('0x2e')});_0x3f54f6=path[_0xc054('0x29')](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+'.wav');return convertFile(_0x455e1d,_0x3f54f6);})[_0xc054('0x2f')](function(){try{fs[_0xc054('0x1e')](_0x455e1d);fs['chmodSync'](_0x3f54f6,_0xc054('0x3f'));}catch(_0x3ac58c){logger['error'](_0x3ac58c);}logger[_0xc054('0x40')]('goggleTTS\x20path',_0x3f54f6['split']('.')[0x0]);return _0x3f54f6[_0xc054('0x31')]('.')[0x0];});};exports['googleASR']=function(_0x3c13a7,_0xdcde0d,_0x325aec){return google[_0xc054('0x4e')](_0x3c13a7,_0xdcde0d,_0x325aec)['then'](function(_0xd1cda2){logger[_0xc054('0x40')](_0xd1cda2[_0xc054('0x4f')]);return rp(_0xd1cda2);})[_0xc054('0x2f')](function(_0x3032c0){var _0x450c47='';var _0x4ce3d4=0x0;try{fs[_0xc054('0x1e')](_0x3c13a7);}catch(_0x39330b){logger[_0xc054('0x17')](_0x39330b);}if(_0x3032c0&&_0x3032c0['results']){_0x450c47=_0x3032c0[_0xc054('0x50')][_0xc054('0x51')](function(_0x15c993){return _0x15c993&&_0x15c993[_0xc054('0x52')][0x0]&&_0x15c993[_0xc054('0x52')][0x0][_0xc054('0x53')]?_0x15c993[_0xc054('0x52')][0x0]['transcript']:'';})[_0xc054('0x54')]('\x0a');_0x4ce3d4=_0x3032c0[_0xc054('0x50')][_0xc054('0x51')](function(_0x18ac7b){return _0x18ac7b&&_0x18ac7b['alternatives'][0x0]&&_0x18ac7b['alternatives'][0x0]['confidence']?_0x18ac7b['alternatives'][0x0]['confidence']:0x0;})[_0xc054('0x54')]('\x0a');}logger['info'](_0xc054('0x55'),_0x450c47);logger['info'](_0xc054('0x56'),_0x4ce3d4);return{'transcript':_0x450c47,'confidence':_0x4ce3d4};})[_0xc054('0x57')](function(_0x41cfba){logger[_0xc054('0x17')](_0xc054('0x58'),_0x41cfba['statusCode'],_0x41cfba[_0xc054('0x59')],_0x41cfba[_0xc054('0x5a')]);});};exports[_0xc054('0x5b')]=function(_0x2e9ddd,_0xdc77ee,_0x4efc81,_0xb33146){var _0x5e0580=apiai(_0xdc77ee,{'language':_0xb33146||'en'});return _0x5e0580[_0xc054('0x5c')](_0x4efc81,{'sessionId':md5(_0x2e9ddd)})[_0xc054('0x2f')](function(_0x5a82f8){logger[_0xc054('0x40')](JSON[_0xc054('0x5d')](_0x5a82f8));return{'source':_0x5a82f8[_0xc054('0x5e')][_0xc054('0x5f')],'resolvedQuery':_0x5a82f8[_0xc054('0x5e')][_0xc054('0x60')],'action':_0x5a82f8[_0xc054('0x5e')][_0xc054('0x61')],'actionIncomplete':_0x5a82f8[_0xc054('0x5e')][_0xc054('0x62')],'speech':_0x5a82f8['result'][_0xc054('0x63')]['speech'],'score':_0x5a82f8[_0xc054('0x5e')]['score'],'statusCode':_0x5a82f8[_0xc054('0x64')][_0xc054('0x65')],'endConversation':_0x5a82f8[_0xc054('0x5e')][_0xc054('0x66')][_0xc054('0x67')]||![],'isFallbackIntent':_0x5a82f8[_0xc054('0x5e')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x3fa81d,_0x2bc3e9,_0x5288bb,_0x5100b6,_0x5dacdb,_0x33ef2a){var _0x11c4ff=_0x5100b6[_0xc054('0x68')](/\\n/g,'\x0a');var _0x3b9567={'credentials':{'private_key':_0x11c4ff,'client_email':_0x5288bb}};var _0x76ae1a=new dialogflow[(_0xc054('0x69'))](_0x3b9567);var _0xa14872=_0x76ae1a[_0xc054('0x6a')](_0x2bc3e9,md5(_0x3fa81d));var _0x471a8a={'session':_0xa14872,'queryInput':{'text':{'text':_0x5dacdb,'languageCode':_0x33ef2a}}};return _0x76ae1a['detectIntent'](_0x471a8a)['then'](function(_0x5d37c8){if(_0x5d37c8&&_0x5d37c8['length']){logger[_0xc054('0x40')]('Dialogflow\x20V2\x20response:',JSON[_0xc054('0x5d')](_0x5d37c8));var _0x577843=_0x5d37c8[0x0];if(_0x577843){var _0x35da92={'action':_0x577843['queryResult'][_0xc054('0x61')],'allRequiredParamsPresent':_0x577843[_0xc054('0x6b')][_0xc054('0x6c')],'endConversation':_0x577843[_0xc054('0x6b')][_0xc054('0x6d')]&&_0x577843[_0xc054('0x6b')][_0xc054('0x6d')]['fields']?_0x577843[_0xc054('0x6b')][_0xc054('0x6d')]['fields'][_0xc054('0x6e')][_0xc054('0x6f')]:![],'fulfillmentText':_0x577843[_0xc054('0x6b')][_0xc054('0x70')],'intentName':_0x577843[_0xc054('0x6b')]['intent'][_0xc054('0x59')],'intentDisplayName':_0x577843[_0xc054('0x6b')][_0xc054('0x71')][_0xc054('0x72')],'isFallbackIntent':_0x577843[_0xc054('0x6b')][_0xc054('0x71')][_0xc054('0x73')],'languageCode':_0x577843[_0xc054('0x6b')][_0xc054('0x74')],'queryText':_0x577843['queryResult'][_0xc054('0x75')],'responseId':_0x577843[_0xc054('0x76')],'score':_0x577843['queryResult']['intentDetectionConfidence'],'speech':_0x577843[_0xc054('0x6b')]['fulfillmentText'],'providerResponse':JSON[_0xc054('0x5d')](_0x5d37c8)};return _0x35da92;}}});};exports[_0xc054('0x77')]=function(_0x156ab5,_0x5c4b44,_0x4e6579,_0x20770a){return tilde[_0xc054('0x4e')](_0x156ab5,_0x5c4b44,_0x4e6579,_0x20770a)[_0xc054('0x2f')](function(_0x16e3a4){try{fs[_0xc054('0x1e')](_0x156ab5);}catch(_0x2e1a2e){logger['error'](_0x2e1a2e);}logger['info'](_0xc054('0x78'),_0x16e3a4[_0xc054('0x53')]);logger[_0xc054('0x40')](_0xc054('0x79'),_0x16e3a4[_0xc054('0x7a')]);return _0x16e3a4;});};exports['awsPolly']=function(_0x311dbd,_0x33a495,_0x433dd2,_0x4c178b,_0x5259d1,_0x134a64){var _0x3a56cf=path['resolve'](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+_0xc054('0x4d'));var _0x36d076;return aws[_0xc054('0x7b')](_0x311dbd,_0x33a495,_0x433dd2,_0x4c178b,_0x5259d1,_0x134a64,_0x3a56cf)[_0xc054('0x2f')](function(){_0x36d076=path[_0xc054('0x29')](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+'.wav');return convertFile(_0x3a56cf,_0x36d076);})[_0xc054('0x2f')](function(){try{fs[_0xc054('0x1e')](_0x3a56cf);fs[_0xc054('0x30')](_0x36d076,_0xc054('0x3f'));}catch(_0x5007b9){logger['error'](_0x5007b9);}return _0x36d076[_0xc054('0x31')]('.')[0x0];});};exports[_0xc054('0x7c')]=function(_0x3457b8,_0x2d42b8,_0x246eb8,_0x2e1104,_0x459ef3,_0x754e0e){return aws[_0xc054('0x7d')](_0x3457b8,_0x2d42b8,_0x246eb8,_0x2e1104,_0x459ef3,_0x754e0e)[_0xc054('0x2f')](function(_0x40fb67){logger[_0xc054('0x40')](JSON[_0xc054('0x5d')](_0x40fb67));return _0x40fb67;});};exports[_0xc054('0x7e')]=function(_0x24344f,_0x2dc075,_0x4f278f,_0x28b075){var _0x5e0df3=util[_0xc054('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x24344f,encodeURIComponent(_0x2dc075),_0x4f278f,_0x28b075);var _0x4e7c55=path['resolve'](__dirname,_0xc054('0x2a'),rs['generate'](0x4)+_0xc054('0x4d'));var _0x213366;return downloadFile(_0x5e0df3,_0x4e7c55)['then'](function(){_0x213366=path['resolve'](__dirname,_0xc054('0x2a'),rs[_0xc054('0x2b')](0x4)+_0xc054('0x2c'));return convertFile(_0x4e7c55,_0x213366);})[_0xc054('0x2f')](function(){try{fs[_0xc054('0x1e')](_0x4e7c55);fs[_0xc054('0x30')](_0x213366,'777');}catch(_0x2a181e){logger[_0xc054('0x17')](_0x2a181e);}return _0x213366['split']('.')[0x0];});};exports[_0xc054('0x80')]=function(_0x53bc0b,_0x2ee947,_0x3c1254,_0x305ba4){var _0x3f0358=util[_0xc054('0x7f')](_0xc054('0x81'),ISPEECH_API,_0x2ee947,_0x3c1254,base64Encode(_0x53bc0b),_0x305ba4?util[_0xc054('0x7f')]('model=%s',encodeURIComponent(_0x305ba4)):'freeform=3');return uploadFile(_0x3f0358)[_0xc054('0x2f')](function(_0x1a8fb0){return querystring[_0xc054('0xb')](_0x1a8fb0);});};exports[_0xc054('0x82')]=function(_0x4ed8cf,_0x5315a5){return sestek[_0xc054('0x83')](_0x4ed8cf,_0x5315a5)[_0xc054('0x2f')](function(_0x7d8ee8){logger[_0xc054('0x40')](JSON[_0xc054('0x5d')](_0x7d8ee8));var _0x25084d={'speech':_0x7d8ee8[_0xc054('0x84')],'action':_0x7d8ee8[_0xc054('0x85')]?_0x7d8ee8[_0xc054('0x85')][_0xc054('0x86')]:undefined,'actiondata':_0x7d8ee8[_0xc054('0x85')]?_0x7d8ee8[_0xc054('0x85')][_0xc054('0x87')]:undefined};if(_0x7d8ee8['channelData']&&_0x7d8ee8['channelData'][_0xc054('0x88')]){return base64Decode(_0x7d8ee8[_0xc054('0x85')]['AudioFromTts'][_0xc054('0x89')],path[_0xc054('0x29')](__dirname,'tmp',rs[_0xc054('0x2b')](0x4)+_0xc054('0x2c')))[_0xc054('0x2f')](function(_0x353175){_0x25084d[_0xc054('0x8a')]=_0x353175;return _0x25084d;});}return _0x25084d;});};exports[_0xc054('0x8b')]=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 192efa2..38c0e19 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 _0x76ff=['./nda'];(function(_0x3be78b,_0x59c0cd){var _0x3c50b4=function(_0x2105ee){while(--_0x2105ee){_0x3be78b['push'](_0x3be78b['shift']());}};_0x3c50b4(++_0x59c0cd);}(_0x76ff,0x1d1));var _0xf76f=function(_0x556a90,_0x4ca532){_0x556a90=_0x556a90-0x0;var _0x57e79d=_0x76ff[_0x556a90];return _0x57e79d;};var nda=require(_0xf76f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x0893=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0893,0x115));var _0x3089=function(_0x4b86af,_0x5b705f){_0x4b86af=_0x4b86af-0x0;var _0xc0bfc2=_0x0893[_0x4b86af];return _0xc0bfc2;};var nda=require('./nda');module[_0x3089('0x0')]={'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 cad51e8..1011b01 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 _0x131e=['body','AudioOutputSettings','audio/wav','custom_action','CustomActionData','stringify','agi','exports','POST','ndauth_url','/token','password','username','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','channelData','ProjectName','project','ndagenerate_audio'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x131e,0x1ec));var _0xe131=function(_0x1001cb,_0x3723ff){_0x1001cb=_0x1001cb-0x0;var _0x281685=_0x131e[_0x1001cb];return _0x281685;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0xe131('0x0'));module[_0xe131('0x1')]=function(_0x2615f2,_0x418ed5){var _0x30486b={'method':_0xe131('0x2'),'uri':url['resolve'](_0x418ed5[_0xe131('0x3')],_0xe131('0x4')),'form':{'grant_type':_0xe131('0x5'),'username':_0x418ed5[_0xe131('0x6')],'password':_0x418ed5[_0xe131('0x5')]},'json':!![]};return rp(_0x30486b)['then'](function(_0x5c4eb5){var _0x562617={'method':'POST','uri':url[_0xe131('0x7')](_0x418ed5[_0xe131('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x418ed5[_0xe131('0x9')]||'message','channelId':_0xe131('0xa'),'conversation':{'id':_0x2615f2[_0xe131('0xb')]},'from':{'id':_0x2615f2[_0xe131('0xc')],'name':_0x2615f2[_0xe131('0xd')]},'recipient':{'id':_0x2615f2[_0xe131('0xe')],'name':_0x2615f2[_0xe131('0xf')]},'text':_0x418ed5[_0xe131('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5c4eb5['access_token']},'json':!![]};if(_0x418ed5['project']){_0x562617['body'][_0xe131('0x11')][_0xe131('0x12')]=_0x418ed5[_0xe131('0x13')];}if(_0x418ed5[_0xe131('0x14')]=='1'){_0x562617[_0xe131('0x15')][_0xe131('0x11')][_0xe131('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe131('0x17')};}if(_0x418ed5[_0xe131('0x18')]){_0x562617['body']['channelData']['CustomAction']=_0x418ed5['custom_action'];if(_0x418ed5['custom_action_data']){_0x562617[_0xe131('0x15')][_0xe131('0x11')][_0xe131('0x19')]=_0x418ed5['custom_action_data'];}}logger['info'](JSON[_0xe131('0x1a')](_0x562617));return rp(_0x562617);});}; \ No newline at end of file +var _0x976a=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','extension','Bearer\x20'];(function(_0x14f3d4,_0x47e435){var _0x55f3b9=function(_0x4ae1ab){while(--_0x4ae1ab){_0x14f3d4['push'](_0x14f3d4['shift']());}};_0x55f3b9(++_0x47e435);}(_0x976a,0xf4));var _0xa976=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x976a[_0x1ceb7b];return _0x57c016;};'use strict';var rp=require(_0xa976('0x0'));var url=require(_0xa976('0x1'));var logger=require(_0xa976('0x2'))('agi');module[_0xa976('0x3')]=function(_0x24af33,_0x3324f4){var _0x3a593b={'method':_0xa976('0x4'),'uri':url[_0xa976('0x5')](_0x3324f4[_0xa976('0x6')],'/token'),'form':{'grant_type':'password','username':_0x3324f4['username'],'password':_0x3324f4[_0xa976('0x7')]},'json':!![]};return rp(_0x3a593b)[_0xa976('0x8')](function(_0x12a073){var _0x1a9983={'method':_0xa976('0x4'),'uri':url[_0xa976('0x5')](_0x3324f4[_0xa976('0x9')],_0xa976('0xa')),'body':{'type':_0x3324f4[_0xa976('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x24af33['uniqueid']},'from':{'id':_0x24af33[_0xa976('0xc')],'name':_0x24af33[_0xa976('0xd')]},'recipient':{'id':_0x24af33[_0xa976('0xe')],'name':_0x24af33[_0xa976('0xf')]},'text':_0x3324f4['text'],'channelData':{}},'headers':{'Authorization':_0xa976('0x10')+_0x12a073[_0xa976('0x11')]},'json':!![]};if(_0x3324f4[_0xa976('0x12')]){_0x1a9983[_0xa976('0x13')][_0xa976('0x14')][_0xa976('0x15')]=_0x3324f4['project'];}if(_0x3324f4[_0xa976('0x16')]=='1'){_0x1a9983[_0xa976('0x13')][_0xa976('0x14')][_0xa976('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa976('0x18')};}if(_0x3324f4[_0xa976('0x19')]){_0x1a9983[_0xa976('0x13')][_0xa976('0x14')][_0xa976('0x1a')]=_0x3324f4[_0xa976('0x19')];if(_0x3324f4[_0xa976('0x1b')]){_0x1a9983['body'][_0xa976('0x14')][_0xa976('0x1c')]=_0x3324f4[_0xa976('0x1b')];}}logger['info'](JSON['stringify'](_0x1a9983));return rp(_0x1a9983);});}; \ 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 06eb579..6fca8bd 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 _0x6fba=['./lib/api','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6fba,0x17c));var _0xa6fb=function(_0x42261d,_0x598eb6){_0x42261d=_0x42261d-0x0;var _0x434c32=_0x6fba[_0x42261d];return _0x434c32;};'use strict';var asr=require(_0xa6fb('0x0'));module[_0xa6fb('0x1')]=function(_0x5f50ab,_0x23fccb,_0x569ded,_0x254e92){return asr(_0x5f50ab,_0x23fccb,_0x569ded,_0x254e92);}; \ No newline at end of file +var _0x2cc1=['exports'];(function(_0x4f08da,_0x379e6d){var _0x3eaf15=function(_0x281a35){while(--_0x281a35){_0x4f08da['push'](_0x4f08da['shift']());}};_0x3eaf15(++_0x379e6d);}(_0x2cc1,0xe3));var _0x12cc=function(_0x134764,_0x112da5){_0x134764=_0x134764-0x0;var _0x2fe527=_0x2cc1[_0x134764];return _0x2fe527;};'use strict';var asr=require('./lib/api');module[_0x12cc('0x0')]=function(_0x54a020,_0x595e19,_0x14c034,_0x529cde){return asr(_0x54a020,_0x595e19,_0x14c034,_0x529cde);}; \ 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 676056a..60aeeda 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 _0xd219=['update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../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','sha1'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd219,0x77));var _0x9d21=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd219[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0x9d21('0x0'));var _=require(_0x9d21('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9d21('0x2'));var crypto=require(_0x9d21('0x3'));var logger=require(_0x9d21('0x4'))(_0x9d21('0x5'));module[_0x9d21('0x6')]=function(_0xe94496,_0x2e8e78,_0x4ba843,_0x4114e1){return new BPromise(function(_0x54bf70,_0x2ebef2){logger[_0x9d21('0x7')](_0x9d21('0x8'),_0x4114e1||_0x9d21('0x9'));var _0x51a61f=new WebSocket(_0x4114e1||_0x9d21('0x9'),{'perMessageDeflate':![]});var _0x5bb34a='';var _0x5c379a='0';var _0x511256='1';var _0xab0d81=_0x9d21('0xa');function _0x2522f3(_0x4e726d){var _0x46f899=crypto[_0x9d21('0xb')](_0x9d21('0xc'));_0x46f899[_0x9d21('0xd')](_0x4e726d);return _0x46f899[_0x9d21('0xe')](_0x9d21('0xf'));}function _0x15721f(){try{logger[_0x9d21('0x7')](_0x9d21('0x10'));var _0x3ec3b0=moment()[_0x9d21('0x11')]();var _0x5217eb=_0x2522f3(_0x3ec3b0+_0x2e8e78+_0x4ba843);_0x51a61f[_0x9d21('0x12')](JSON[_0x9d21('0x13')]({'appID':_0x2e8e78,'timestamp':_0x3ec3b0,'appKey':_0x5217eb}));var _0x54ca8f=fs[_0x9d21('0x14')](_0xe94496);_0x54ca8f['on'](_0x9d21('0x15'),function(_0x157b92){_0x51a61f[_0x9d21('0x12')](_0x157b92);});_0x54ca8f['on'](_0x9d21('0x16'),function(){_0x51a61f[_0x9d21('0x12')](_0x9d21('0x17'));});}catch(_0x35eb37){logger['error'](_0x9d21('0x18'),JSON[_0x9d21('0x13')](_0x35eb37));_0x51a61f[_0x9d21('0x19')]();}}function _0x3c154e(_0x30c6c9){try{if(_0x30c6c9){var _0x456bec=JSON['parse'](_0x30c6c9);switch(_0x456bec['status']){case 0x0:if(_0x456bec[_0x9d21('0x1a')]){if(_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1b')]){logger[_0x9d21('0x7')](_0x9d21('0x1c'),JSON[_0x9d21('0x13')](_0x456bec[_0x9d21('0x1a')]['hypotheses']));_0x5bb34a=_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1d')][0x0][_0x9d21('0x1e')];_0x5c379a=_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1d')][0x0][_0x9d21('0x1f')];_0x511256='0';_0xab0d81=_0x9d21('0x20');_0x51a61f[_0x9d21('0x19')]();}}break;case 0x1:logger[_0x9d21('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x511256='1';_0xab0d81='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x9d21('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x511256='2';_0xab0d81=_0x9d21('0x21');break;case 0x9:logger['info'](_0x9d21('0x22'));_0x511256='9';_0xab0d81=_0x9d21('0x22');break;case 0xa:logger[_0x9d21('0x7')](_0x9d21('0x23'));_0x511256='10';_0xab0d81=_0x9d21('0x23');break;case 0xb:logger[_0x9d21('0x7')](_0x9d21('0x24'));_0x511256='11';_0xab0d81='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x372c45){logger[_0x9d21('0x25')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9d21('0x13')](_0x372c45));_0x51a61f[_0x9d21('0x19')]();}}function _0x5cfcbf(){logger[_0x9d21('0x7')](_0x9d21('0x26'));_0x54bf70({'transcript':_0x5bb34a,'confidence':_0x5c379a,'status':_0x511256,'status_message':_0xab0d81});}function _0x24e595(_0x27ad61){logger[_0x9d21('0x25')](_0x9d21('0x27'));if(!_[_0x9d21('0x28')](_0x27ad61)){logger[_0x9d21('0x25')](_[_0x9d21('0x29')](_0x27ad61)?JSON[_0x9d21('0x13')](_0x27ad61):_0x27ad61);}}_0x51a61f['on'](_0x9d21('0x2a'),_0x15721f);_0x51a61f['on'](_0x9d21('0x2b'),_0x3c154e);_0x51a61f['on']('close',_0x5cfcbf);_0x51a61f['on'](_0x9d21('0x25'),_0x24e595);});}; \ No newline at end of file +var _0x44ab=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','error','stringify','terminate','parse','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0xf76b2f,_0x825abe){var _0x16e87a=function(_0x4ebec9){while(--_0x4ebec9){_0xf76b2f['push'](_0xf76b2f['shift']());}};_0x16e87a(++_0x825abe);}(_0x44ab,0x183));var _0xb44a=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x44ab[_0x2706da];return _0x3ba87e;};'use strict';var BPromise=require(_0xb44a('0x0'));var _=require(_0xb44a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xb44a('0x2'));var logger=require(_0xb44a('0x3'))(_0xb44a('0x4'));module[_0xb44a('0x5')]=function(_0x30f19a,_0x443897,_0x30a650,_0x35c0cf){return new BPromise(function(_0x41ea0e,_0x644422){logger[_0xb44a('0x6')](_0xb44a('0x7'),_0x35c0cf||_0xb44a('0x8'));var _0x5bc52f=new WebSocket(_0x35c0cf||_0xb44a('0x8'),{'perMessageDeflate':![]});var _0x373f33='';var _0x39f643='0';var _0x4a66c6='1';var _0x33861e=_0xb44a('0x9');function _0x409f33(_0x1170e2){var _0x5d7aba=crypto[_0xb44a('0xa')]('sha1');_0x5d7aba['update'](_0x1170e2);return _0x5d7aba[_0xb44a('0xb')](_0xb44a('0xc'));}function _0x10fddc(){try{logger[_0xb44a('0x6')](_0xb44a('0xd'));var _0x42b8d0=moment()[_0xb44a('0xe')]();var _0x528e47=_0x409f33(_0x42b8d0+_0x443897+_0x30a650);_0x5bc52f[_0xb44a('0xf')](JSON['stringify']({'appID':_0x443897,'timestamp':_0x42b8d0,'appKey':_0x528e47}));var _0x55cc17=fs[_0xb44a('0x10')](_0x30f19a);_0x55cc17['on']('data',function(_0x3a8278){_0x5bc52f[_0xb44a('0xf')](_0x3a8278);});_0x55cc17['on'](_0xb44a('0x11'),function(){_0x5bc52f[_0xb44a('0xf')]('EOS');});}catch(_0x1b7fe9){logger[_0xb44a('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb44a('0x13')](_0x1b7fe9));_0x5bc52f[_0xb44a('0x14')]();}}function _0x235017(_0x56d556){try{if(_0x56d556){var _0x2ba085=JSON[_0xb44a('0x15')](_0x56d556);switch(_0x2ba085['status']){case 0x0:if(_0x2ba085['result']){if(_0x2ba085[_0xb44a('0x16')][_0xb44a('0x17')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0xb44a('0x13')](_0x2ba085[_0xb44a('0x16')][_0xb44a('0x18')]));_0x373f33=_0x2ba085['result'][_0xb44a('0x18')][0x0][_0xb44a('0x19')];_0x39f643=_0x2ba085['result'][_0xb44a('0x18')][0x0]['likelihood'];_0x4a66c6='0';_0x33861e=_0xb44a('0x1a');_0x5bc52f[_0xb44a('0x14')]();}}break;case 0x1:logger[_0xb44a('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4a66c6='1';_0x33861e=_0xb44a('0x9');break;case 0x2:logger['info'](_0xb44a('0x1b'));_0x4a66c6='2';_0x33861e=_0xb44a('0x1b');break;case 0x9:logger[_0xb44a('0x6')](_0xb44a('0x1c'));_0x4a66c6='9';_0x33861e='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xb44a('0x6')](_0xb44a('0x1d'));_0x4a66c6='10';_0x33861e='Authentication\x20failed.';break;case 0xb:logger[_0xb44a('0x6')](_0xb44a('0x1e'));_0x4a66c6='11';_0x33861e=_0xb44a('0x1e');}}}catch(_0x1819cd){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x1819cd));_0x5bc52f[_0xb44a('0x14')]();}}function _0x20a17b(){logger[_0xb44a('0x6')](_0xb44a('0x1f'));_0x41ea0e({'transcript':_0x373f33,'confidence':_0x39f643,'status':_0x4a66c6,'status_message':_0x33861e});}function _0x265c7f(_0x2b01a0){logger[_0xb44a('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb44a('0x20')](_0x2b01a0)){logger[_0xb44a('0x12')](_[_0xb44a('0x21')](_0x2b01a0)?JSON[_0xb44a('0x13')](_0x2b01a0):_0x2b01a0);}}_0x5bc52f['on'](_0xb44a('0x22'),_0x10fddc);_0x5bc52f['on'](_0xb44a('0x23'),_0x235017);_0x5bc52f['on'](_0xb44a('0x11'),_0x20a17b);_0x5bc52f['on']('error',_0x265c7f);});}; \ 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 ac6c10f..675cf28 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 _0xfcae=['./asr','exports'];(function(_0x4ef4c2,_0x4b6a68){var _0x2c569d=function(_0x56c91c){while(--_0x56c91c){_0x4ef4c2['push'](_0x4ef4c2['shift']());}};_0x2c569d(++_0x4b6a68);}(_0xfcae,0x16a));var _0xefca=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfcae[_0x13d07a];return _0x5ee0ee;};var asr=require(_0xefca('0x0'));module[_0xefca('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe267=['exports','./asr'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xe267,0x13f));var _0x7e26=function(_0x5aaf54,_0x116458){_0x5aaf54=_0x5aaf54-0x0;var _0xfad324=_0xe267[_0x5aaf54];return _0xfad324;};var asr=require(_0x7e26('0x0'));module[_0x7e26('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9e0c596..030abe0 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(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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 _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(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2a3755a..438097e 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 _0xf2cb=['noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','key','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','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','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','menu','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','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','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','lodash','odbc','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','catch','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','createSquareRecording','callerid','calleridname','context','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','toUpperCase','body','parse','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','setVariable','%s.%s','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2cb,0x130));var _0xbf2c=function(_0x8dbb7c,_0x222938){_0x8dbb7c=_0x8dbb7c-0x0;var _0x5c8ed5=_0xf2cb[_0x8dbb7c];return _0x5c8ed5;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xbf2c('0x0'));var sh=require('shelljs');var odbc=require(_0xbf2c('0x1'))();var rs=require('randomstring');var moment=require(_0xbf2c('0x2'));var Mustache=require('mustache');var rp=require(_0xbf2c('0x3'));var logger=require(_0xbf2c('0x4'))('agi');var config=require('../../config/environment');var scripts=require(_0xbf2c('0x5'));var FILES_PATH=_0xbf2c('0x6');var recursiveMapAttributes=[_0xbf2c('0x7'),_0xbf2c('0x8')];var verticesWithRetry=['menu',_0xbf2c('0x9'),'getsecretdigits'];var AGIVertices=function(_0x25d0a6,_0x5e070d,_0x5f25ea){this[_0xbf2c('0xa')]=_0x25d0a6;this[_0xbf2c('0xb')]=_0x5e070d;this[_0xbf2c('0xc')]=_0x5f25ea;};AGIVertices['prototype'][_0xbf2c('0xd')]=function(_0x2fe412,_0x2da108){this[_0xbf2c('0xb')][_0xbf2c('0xe')](_0x2fe412)[_0xbf2c('0xf')](function(_0x20b260){_0x2da108(null,_0x20b260?_0x20b260[_0xbf2c('0x10')]:![]);})['catch'](function(_0x149235){_0x2da108(_0x149235);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x12')]=function(_0x2879de,_0x5220e2){this[_0xbf2c('0xb')]['getVoiceQueueById'](_0x2879de)['then'](function(_0x160fff){_0x5220e2(null,_0x160fff?_0x160fff['name']:![]);})['catch'](function(_0x3ed1c3){_0x5220e2(_0x3ed1c3);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x13')]=function(_0x334900,_0x2af371){this['rpc'][_0xbf2c('0x14')](_0x334900)['then'](function(_0x4ced7f){_0x2af371(null,_0x4ced7f?_0x4ced7f[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x32a44d){_0x2af371(_0x32a44d);});};AGIVertices[_0xbf2c('0x11')]['getSquareOdbc']=function(_0x31196d,_0x1fbfe8){this[_0xbf2c('0xb')][_0xbf2c('0x16')](_0x31196d)[_0xbf2c('0xf')](function(_0x102cef){_0x1fbfe8(null,_0x102cef?_0x102cef[_0xbf2c('0x17')]:![]);})['catch'](function(_0x61248b){_0x1fbfe8(_0x61248b);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x18')]=function(_0xe6dad9,_0x57873c){this[_0xbf2c('0xb')][_0xbf2c('0x19')](_0xe6dad9)['then'](function(_0x3f79fe){_0x57873c(null,_0x3f79fe?_0x3f79fe[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x52ecb4){_0x57873c(_0x52ecb4);});};AGIVertices['prototype'][_0xbf2c('0x1a')]=function(_0x3c546d,_0xae9c7){this[_0xbf2c('0xb')][_0xbf2c('0x1b')](_0x3c546d)[_0xbf2c('0xf')](function(_0x11ffbe){_0xae9c7(null,_0x11ffbe?_0x11ffbe['name']:![]);})['catch'](function(_0x169948){_0xae9c7(_0x169948);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1c')]=function(_0x4314d6,_0x3ed68d){var _0x4a0257=this;this[_0xbf2c('0xb')][_0xbf2c('0x1d')](_0x4314d6)[_0xbf2c('0xf')](function(_0x4f3191){_0x3ed68d(null,_0x4f3191?_0x4a0257[_0xbf2c('0x1e')](_0x4f3191['save_name']):![]);})[_0xbf2c('0x15')](function(_0x3442fa){_0x3ed68d(_0x3442fa);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1f')]=function(_0x7c6f3b,_0x502943){this[_0xbf2c('0xb')][_0xbf2c('0x20')](_0x7c6f3b)[_0xbf2c('0xf')](function(_0x13e238){_0x502943(null,_0x13e238?_0x13e238:![]);})[_0xbf2c('0x15')](function(_0x32d7e8){_0x502943(_0x32d7e8);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x21')]=function(_0x4d731d,_0x37cf35,_0x3dfe0e){this[_0xbf2c('0xc')]['sendMailMessage'](_0x4d731d,_0x37cf35)['then'](function(){_0x3dfe0e(null);})[_0xbf2c('0x15')](function(_0x24e3cf){_0x3dfe0e(_0x24e3cf);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x22')]=function(_0x286634,_0x45f743){this[_0xbf2c('0xb')][_0xbf2c('0x23')](_0x286634)[_0xbf2c('0xf')](function(_0x5ef32a){if(_0x5ef32a){if(_0x5ef32a[_0xbf2c('0x24')]){_0x45f743(null,[_0x5ef32a[_0xbf2c('0x25')]]);}else{_0x45f743(null,_[_0xbf2c('0x26')](_0x5ef32a[_0xbf2c('0x27')],_0xbf2c('0x25')));}}else{_0x45f743(null,![]);}})[_0xbf2c('0x15')](function(_0x18ddfb){_0x45f743(_0x18ddfb);});};AGIVertices[_0xbf2c('0x11')]['getSoundPath']=function(_0x3a9323){return util[_0xbf2c('0x28')](_0xbf2c('0x29'),FILES_PATH,_0x3a9323);};AGIVertices['prototype'][_0xbf2c('0x2a')]=function(_0x608bb4,_0x3b4d8a,_0x5402ff){odbc[_0xbf2c('0x2b')](_0x608bb4,function(_0x43f1ad){if(_0x43f1ad){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x43f1ad);_0x5402ff(_0x43f1ad);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x3b4d8a,function(_0x17f680,_0x13652a){if(_0x17f680){logger[_0xbf2c('0x2c')](_0xbf2c('0x2d'),_0x3b4d8a);_0x5402ff(_0x17f680);}else{logger[_0xbf2c('0x2c')](_0xbf2c('0x2e'),_0x3b4d8a);odbc[_0xbf2c('0x2f')](function(_0x325581){if(_0x325581){logger[_0xbf2c('0x30')](_0xbf2c('0x31'),_0x325581);}_0x5402ff(null,_0x13652a);});}});}});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x32')]=function(_0x3fbf90,_0x1eac50){this[_0xbf2c('0xb')][_0xbf2c('0x33')](_0x3fbf90)['then'](function(_0x294684){_0x1eac50(null,_0x294684?_0x294684:![]);})[_0xbf2c('0x15')](function(_0x6bbc64){_0x1eac50(_0x6bbc64);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x34')]=function(_0x458756,_0x43464f){this[_0xbf2c('0xb')]['createSmsMessage'](_0x458756)[_0xbf2c('0xf')](function(_0x2bccc2){_0x43464f(null,_0x2bccc2);})[_0xbf2c('0x15')](function(_0x3fe481){_0x43464f(_0x3fe481);});};AGIVertices['prototype'][_0xbf2c('0x35')]=function(_0x5067d2,_0x369bdc,_0x613b14){this[_0xbf2c('0xb')][_0xbf2c('0x35')]({'uniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'node':_0x5067d2['label'],'application':_0x5067d2[_0xbf2c('0x37')],'data':_0x369bdc||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xbf2c('0xa')]['callerid']})['then'](function(_0x7f696c){if(_0x613b14){_0x613b14(null,_0x7f696c);}})[_0xbf2c('0x15')](function(_0x56fc01){if(_0x613b14){_0x613b14(_0x56fc01);}});};AGIVertices[_0xbf2c('0x11')]['createSquareRecording']=function(_0x780c85,_0x4995e9,_0x467d00,_0x409377){this[_0xbf2c('0xb')][_0xbf2c('0x38')]({'uniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'callerid':this['channel'][_0xbf2c('0x39')],'calleridname':this[_0xbf2c('0xa')][_0xbf2c('0x3a')],'context':this[_0xbf2c('0xa')][_0xbf2c('0x3b')],'extension':this['channel']['extension'],'priority':this[_0xbf2c('0xa')]['priority'],'accountcode':this[_0xbf2c('0xa')][_0xbf2c('0x3c')],'dnid':this[_0xbf2c('0xa')][_0xbf2c('0x3d')],'projectName':this[_0xbf2c('0xa')][_0xbf2c('0x3e')],'saveName':_0x4995e9,'filename':_0x780c85[_0xbf2c('0x3f')]||_0x4995e9,'savePath':_0x467d00})[_0xbf2c('0xf')](function(_0x128e97){_0x409377(null,_0x128e97);})[_0xbf2c('0x15')](function(_0x31791b){_0x409377(_0x31791b);});};AGIVertices['prototype'][_0xbf2c('0x40')]=function(_0x22af02,_0x90276,_0x387d4a,_0x5d02d3,_0x4edca4){this['rpc'][_0xbf2c('0x40')]({'uniqueid':this[_0xbf2c('0xa')]['uniqueid'],'body':_0x22af02,'direction':_0x90276,'providerName':_0x387d4a,'providerResponse':_0x5d02d3})['then'](function(_0x4ab854){if(_0x4edca4){_0x4edca4(null,_0x4ab854);}})[_0xbf2c('0x15')](function(_0x314f7b){if(_0x4edca4){_0x4edca4(_0x314f7b);}});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x41')]=function(_0x3a8d9a,_0xd91a88){this['rpc'][_0xbf2c('0x41')]({'firstName':_[_0xbf2c('0x42')](_0x3a8d9a[_0xbf2c('0x10')])||_[_0xbf2c('0x43')](_0x3a8d9a[_0xbf2c('0x10')])?_0xbf2c('0x44')+Math[_0xbf2c('0x45')]():_0x3a8d9a[_0xbf2c('0x10')],'lastName':_['isEmpty'](_0x3a8d9a['lastName'])||_['isNil'](_0x3a8d9a[_0xbf2c('0x46')])?null:_0x3a8d9a[_0xbf2c('0x46')],'phone':_0x3a8d9a[_0xbf2c('0x47')],'ListId':_0x3a8d9a[_0xbf2c('0x48')],'scheduledat':_0x3a8d9a['scheduledAt'],'callbackUniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'tags':'callback','description':_0xbf2c('0x49')+_0x3a8d9a[_0xbf2c('0x4a')][_0xbf2c('0x4b')](),'priority':_0x3a8d9a['callback_priority']})['then'](function(_0x4b6253){_0xd91a88(null,_0x4b6253);})['catch'](function(_0x39c10e){_0xd91a88(_0x39c10e);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x4c')]=function(_0x195169,_0x46a0f6){this['rpc'][_0xbf2c('0x4d')](_0x195169)[_0xbf2c('0xf')](function(_0x58b66a){_0x46a0f6(null,_0x58b66a?_0x58b66a[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x4fe788){_0x46a0f6(_0x4fe788);});};AGIVertices['prototype']['agentPause']=function(_0x363f77,_0x5df133,_0x5cf1df){var _0x38b789={'role':_0xbf2c('0x4e')};_0x38b789[_0x363f77]=this[_0xbf2c('0xa')][_0xbf2c('0x39')];this['rpc']['agentPause'](_0x38b789,_0x5df133,this[_0xbf2c('0xa')][_0xbf2c('0x36')])[_0xbf2c('0xf')](function(_0x2960fc){_0x5cf1df(null,_[_0xbf2c('0x43')](_0x2960fc)?![]:!![]);})['catch'](function(_0x533be2){logger[_0xbf2c('0x30')](_0x533be2);_0x5cf1df(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x4f')]=function(_0x45b91c,_0x1f984e){var _0x13e5ba={'role':'agent'};_0x13e5ba[_0x45b91c]=this['channel'][_0xbf2c('0x39')];this[_0xbf2c('0xb')][_0xbf2c('0x4f')](_0x13e5ba)[_0xbf2c('0xf')](function(_0x2177b1){_0x1f984e(null,_[_0xbf2c('0x43')](_0x2177b1)?![]:!![]);})[_0xbf2c('0x15')](function(_0x38a5e6){logger[_0xbf2c('0x30')](_0x38a5e6);_0x1f984e(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2e4d40,_0x168f55){var _0x38ce66={'role':_0xbf2c('0x4e')};_0x38ce66[_0x2e4d40]=this['channel'][_0xbf2c('0x39')];this[_0xbf2c('0xb')][_0xbf2c('0x50')](_0x38ce66)['then'](function(_0x2d10a8){_0x168f55(null,_[_0xbf2c('0x43')](_0x2d10a8)?![]:!![]);})[_0xbf2c('0x15')](function(_0x7b8adc){logger['error'](_0x7b8adc);_0x168f55(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x51')]=function(_0x425a46,_0x531188){var _0x4feece={'role':_0xbf2c('0x4e')};_0x4feece[_0x425a46]=this['channel']['callerid'];var _0x1e2d67=_0x425a46!=_0xbf2c('0x52')?util[_0xbf2c('0x28')](_0xbf2c('0x53'),_0xbf2c('0x54'),this['channel']['callerid']):undefined;this[_0xbf2c('0xb')][_0xbf2c('0x51')](_0x4feece,_0x1e2d67)['then'](function(_0x396222){_0x531188(null,_[_0xbf2c('0x43')](_0x396222)?![]:!![]);})['catch'](function(_0x475637){logger['error'](_0x475637);_0x531188(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x55')]=function(_0x354591,_0x59516e){sh[_0xbf2c('0x56')](_[_0xbf2c('0x57')](_0x354591),function(_0xcbc240,_0xac22cf){var _0x16c94d=_0xac22cf[_0xbf2c('0x58')](/(\r\n|\n|\r)/gm,'');_0x59516e(null,_0x16c94d);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x59')]=function(_0x30a968,_0x4e5c26){scripts['googleCloudTTS'](_0x30a968[_0xbf2c('0x5a')],_0x30a968[_0xbf2c('0x5b')]||_0xbf2c('0x5c'),_0x30a968[_0xbf2c('0x5c')],_0x30a968[_0xbf2c('0x5d')]||_0xbf2c('0x5e'),_0x30a968[_0xbf2c('0x5f')]||'MALE',_0x30a968[_0xbf2c('0x60')]||_0xbf2c('0x61'))[_0xbf2c('0xf')](function(_0x9c91e6){_0x4e5c26(null,_0x9c91e6);})[_0xbf2c('0x15')](function(_0x4e82f3){_0x4e5c26(_0x4e82f3);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x62')]=function(_0x3cc51d,_0x2400ff){scripts['googleTTS'](_0x3cc51d[_0xbf2c('0x5c')],_0x3cc51d[_0xbf2c('0x63')]||'en',0x1)[_0xbf2c('0xf')](function(_0x26c94a){_0x2400ff(null,_0x26c94a);})[_0xbf2c('0x15')](function(_0x26897e){_0x2400ff(_0x26897e);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x64')]=function(_0x51617d,_0x79cc7){var _0x5440a8={'uri':_0x51617d[_0xbf2c('0x65')],'method':_0x51617d[_0xbf2c('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x51617d[_0xbf2c('0x67')])==='number'&&parseInt(_0x51617d[_0xbf2c('0x67')])>=0x1?parseInt(_0x51617d[_0xbf2c('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xbf2c('0x68'),'PUT'],_0x5440a8[_0xbf2c('0x66')][_0xbf2c('0x69')]())){try{_0x5440a8[_0xbf2c('0x6a')]=_0x51617d[_0xbf2c('0x8')]?JSON['parse'](_0x51617d['rawBody']):{};}catch(_0x464537){logger[_0xbf2c('0x30')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x464537);}}try{_0x5440a8['headers']=_0x51617d[_0xbf2c('0x7')]?JSON[_0xbf2c('0x6b')](_0x51617d[_0xbf2c('0x7')]):{};}catch(_0x195658){logger[_0xbf2c('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x195658);}if(_0x51617d[_0xbf2c('0x6c')]){try{var _0x2323f9=require(_0x51617d[_0xbf2c('0x6c')])[_0xbf2c('0x6d')](this,_0x5440a8);_0x5440a8[_0xbf2c('0x6e')]=Mustache[_0xbf2c('0x6f')](_0x51617d[_0xbf2c('0x65')],_0x2323f9,{},['$$','$$']);if(_0x5440a8[_0xbf2c('0x70')]){_0x5440a8[_0xbf2c('0x70')]=JSON[_0xbf2c('0x6b')](Mustache[_0xbf2c('0x6f')](JSON[_0xbf2c('0x71')](_0x5440a8['headers']),_0x2323f9,{},['$$','$$']));}if(_0x5440a8[_0xbf2c('0x6a')]){_0x5440a8[_0xbf2c('0x6a')]=JSON[_0xbf2c('0x6b')](Mustache[_0xbf2c('0x6f')](JSON[_0xbf2c('0x71')](_0x5440a8[_0xbf2c('0x6a')]),_0x2323f9,{},['$$','$$']));}}catch(_0x545447){logger[_0xbf2c('0x30')](_0xbf2c('0x72'),_0x545447);}}rp(_0x5440a8)['then'](function(_0x355f04){var _0x33d88c={'statusCode':_0x355f04[_0xbf2c('0x73')]||0xc8,'statusMessage':_0x355f04[_0xbf2c('0x74')]||'OK','headers':_0x355f04['headers']||{},'body':_0x355f04[_0xbf2c('0x6a')]||{}};_0x79cc7(null,_0x33d88c);})[_0xbf2c('0x15')](function(_0x4cd3da){var _0x241234={'statusCode':_0x4cd3da[_0xbf2c('0x73')]||0x1f4,'statusMessage':_0x4cd3da[_0xbf2c('0x75')]||_0xbf2c('0x76'),'headers':_0x4cd3da[_0xbf2c('0x77')][_0xbf2c('0x70')]||{},'body':_0x4cd3da['options'][_0xbf2c('0x6a')]||{}};_0x79cc7(null,_0x241234);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x78')]=function(_0x4fa011,_0x2aa3c3){scripts[_0xbf2c('0x78')](this[_0xbf2c('0xa')][_0xbf2c('0x36')],_0x4fa011['key'],_0x4fa011[_0xbf2c('0x5c')],_0x4fa011[_0xbf2c('0x79')]||'en')[_0xbf2c('0xf')](function(_0x2544fd){_0x2aa3c3(null,_0x2544fd);})[_0xbf2c('0x15')](function(_0x23a925){_0x2aa3c3(_0x23a925);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7a')]=function(_0x2fcb0a,_0x391208){scripts[_0xbf2c('0x7a')](this['channel'][_0xbf2c('0x36')],_0x2fcb0a['dialogflowV2_project_id'],_0x2fcb0a[_0xbf2c('0x7b')],_0x2fcb0a[_0xbf2c('0x7c')],_0x2fcb0a['text'],_0x2fcb0a[_0xbf2c('0x7d')]||'en')['then'](function(_0x3b7838){_0x391208(null,_0x3b7838);})[_0xbf2c('0x15')](function(_0x388cae){_0x391208(_0x388cae);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7e')]=function(_0x6340c1,_0x458971){scripts[_0xbf2c('0x7e')](this[_0xbf2c('0xa')],_0x6340c1)['then'](function(_0x2a28e2){_0x458971(null,_0x2a28e2);})[_0xbf2c('0x15')](function(_0x2ed748){_0x458971(_0x2ed748);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7f')]=function(_0x3a7900,_0x4e7b5a){scripts[_0xbf2c('0x7f')](_0x3a7900['key'],_0x3a7900['text'],_0x3a7900['ispeech_tts_language']||_0xbf2c('0x5e'),_0x3a7900[_0xbf2c('0x80')])['then'](function(_0x4e476a){_0x4e7b5a(null,_0x4e476a);})['catch'](function(_0x2f2308){_0x4e7b5a(_0x2f2308);});};AGIVertices['prototype'][_0xbf2c('0x81')]=function(_0x455c1a,_0x1e6e6b,_0x11c689){scripts[_0xbf2c('0x81')](_0x1e6e6b,_0x455c1a['key'],_0x455c1a[_0xbf2c('0x82')]||_0xbf2c('0x5e'),this[_0xbf2c('0x83')](_0x455c1a[_0xbf2c('0x84')])?_0x455c1a[_0xbf2c('0x84')]:undefined)['then'](function(_0x5e126b){_0x11c689(null,_0x5e126b);})[_0xbf2c('0x15')](function(_0x47d9bd){_0x11c689(_0x47d9bd);});};AGIVertices['prototype'][_0xbf2c('0x85')]=function(_0xe3b0be,_0x460624){scripts['awsPolly'](_0xe3b0be[_0xbf2c('0x86')],_0xe3b0be[_0xbf2c('0x87')],_0xe3b0be[_0xbf2c('0x88')],_0xe3b0be[_0xbf2c('0x89')]||_0xbf2c('0x8a'),_0xe3b0be[_0xbf2c('0x5c')],_0xe3b0be[_0xbf2c('0x8b')]||_0xbf2c('0x5c'))[_0xbf2c('0xf')](function(_0x23eb0f){_0x460624(null,_0x23eb0f);})['catch'](function(_0x3009cc){_0x460624(_0x3009cc);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x8c')]=function(_0x177627,_0x312df9){scripts[_0xbf2c('0x8c')](this[_0xbf2c('0xa')][_0xbf2c('0x36')],_0x177627[_0xbf2c('0x86')],_0x177627[_0xbf2c('0x87')],_0x177627['aws_lex_region'],_0x177627[_0xbf2c('0x5c')],_0x177627[_0xbf2c('0x8d')])[_0xbf2c('0xf')](function(_0x4e6347){_0x312df9(null,_0x4e6347);})['catch'](function(_0x5a9421){_0x312df9(_0x5a9421);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x8e')]=function(_0x314a66,_0x20dff1,_0x394297){scripts[_0xbf2c('0x8e')](_0x20dff1,_0x314a66['key'],_0x314a66[_0xbf2c('0x8f')]||'en-US')[_0xbf2c('0xf')](function(_0x99aff4){_0x394297(null,_0x99aff4);})['catch'](function(_0xa7b27f){_0x394297(_0xa7b27f);});};AGIVertices['prototype'][_0xbf2c('0x90')]=function(_0x5a029e,_0x13eabf,_0x25c3db){scripts[_0xbf2c('0x90')](_0x13eabf,_0x5a029e[_0xbf2c('0x91')],_0x5a029e[_0xbf2c('0x92')],_0x5a029e[_0xbf2c('0x6e')])[_0xbf2c('0xf')](function(_0x15410a){_0x25c3db(null,_0x15410a);})[_0xbf2c('0x15')](function(_0x371461){_0x25c3db(_0x371461);});};AGIVertices[_0xbf2c('0x11')]['clear']=function(_0x1fbbd6){var _0x2604b5=_[_0xbf2c('0x93')](verticesWithRetry,_0x1fbbd6[_0xbf2c('0x37')])?_0x1fbbd6:_[_0xbf2c('0x94')](_0x1fbbd6);for(var _0xe15450 in _0x2604b5){if(_0x2604b5[_0xbf2c('0x95')](_0xe15450)){if(_0x2604b5[_0xe15450]&&_[_0xbf2c('0x96')](_0x2604b5[_0xe15450])){if(_[_0xbf2c('0x93')](recursiveMapAttributes,_0xe15450)){_0x2604b5[_0xe15450]=this[_0xbf2c('0x97')](_0x2604b5[_0xe15450]);}else{_0x2604b5[_0xe15450]=this[_0xbf2c('0x98')](_0x2604b5[_0xe15450]);}}}}return _0x2604b5;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x99')]=function(_0x54bb51){for(var _0x4d5006 in _0x54bb51){if(_0x54bb51[_0xbf2c('0x95')](_0x4d5006)){if(_[_0xbf2c('0x9a')](_0x54bb51[_0x4d5006])){this[_0xbf2c('0x99')](_0x54bb51[_0x4d5006]);}else if(_[_0xbf2c('0x9b')](_0x54bb51[_0x4d5006])){for(var _0x231f50=0x0;_0x231f50<_0x54bb51[_0x4d5006][_0xbf2c('0x9c')];_0x231f50++){this[_0xbf2c('0x99')](_0x54bb51[_0x4d5006][_0x231f50]);}}else if(_[_0xbf2c('0x96')](_0x54bb51[_0x4d5006])){_0x54bb51[_0x4d5006]=this[_0xbf2c('0x98')](_0x54bb51[_0x4d5006]);}}}};AGIVertices['prototype'][_0xbf2c('0x9d')]=function(_0x531dfe,_0x26fe2b){for(var _0x2acdef in _0x531dfe){if(_0x531dfe[_0xbf2c('0x95')](_0x2acdef)){if(_[_0xbf2c('0x9a')](_0x531dfe[_0x2acdef])){if(!_[_0xbf2c('0x42')](_0x531dfe[_0x2acdef])){this[_0xbf2c('0x9d')](_0x531dfe[_0x2acdef],util[_0xbf2c('0x28')]('%s.%s',_0x26fe2b,_0x2acdef));}}else if(_[_0xbf2c('0x9b')](_0x531dfe[_0x2acdef])){for(var _0x52b509=0x0;_0x52b509<_0x531dfe[_0x2acdef][_0xbf2c('0x9c')];_0x52b509++){this[_0xbf2c('0x9d')](_0x531dfe[_0x2acdef][_0x52b509],util[_0xbf2c('0x28')]('%s.%s',_0x26fe2b,_0x2acdef+'['+_0x52b509+']'));}}else{if(!_[_0xbf2c('0x43')](_0x531dfe[_0x2acdef])){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util['format'](_0xbf2c('0x9f'),_0x26fe2b,_0x2acdef),_0x531dfe[_0x2acdef]);}}}}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x97')]=function(_0x588b65){try{var _0x2f2098=JSON['parse'](_0x588b65);this['recursiveNodeIndex'](_0x2f2098);return JSON[_0xbf2c('0x71')](_0x2f2098);}catch(_0x3a8165){return this['replaceAllVariables'](_0x588b65);}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x98')]=function(_0xa93660){var _0x1fb2d4=_0xa93660[_0xbf2c('0xa0')]('{');for(var _0x1f5ecb=0x1;_0x1f5ecb<_0x1fb2d4['length'];_0x1f5ecb+=0x1){var _0xd0f031=_0x1fb2d4[_0x1f5ecb][_0xbf2c('0xa0')]('}');if(_0xd0f031[_0xbf2c('0x9c')]>0x1){_0xa93660=_0xa93660['replaceAll']('{'+_0xd0f031[0x0]+'}',this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0xd0f031[0x0])[_0xbf2c('0xa1')]||_0xd0f031[0x0]);}}if(_0x1fb2d4[_0xbf2c('0x9c')]===0x1){return _0xa93660[_0xbf2c('0x4b')]();}return this['replaceAllVariables'](_0xa93660);};AGIVertices['prototype'][_0xbf2c('0xa2')]=function(_0x3ccc70,_0x46afec){var _0xe0191c=this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0x3ccc70);if(_0xe0191c[_0xbf2c('0xa3')]===-0x1){return _0xe0191c;}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xa4'),_0x46afec,_0xe0191c[_0xbf2c('0xa1')]));return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x46afec,_0xe0191c[_0xbf2c('0xa1')]);};AGIVertices[_0xbf2c('0x11')]['isConfigured']=function(_0x5e3fc8){return _0x5e3fc8&&_0x5e3fc8!=='0'&&_0x5e3fc8!=='-1'&&_0x5e3fc8!=='';};AGIVertices['prototype'][_0xbf2c('0xa5')]=function(_0xc1d33d){this[_0xbf2c('0x35')]['sync'](this,_0xc1d33d,'-');_0xc1d33d[_0xbf2c('0xa6')]=_0xc1d33d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xbf2c('0xa7')]=function(_0x22e4d2){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xa8'),_0x22e4d2[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x22e4d2[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}var _0x329850='\x22'+_0x22e4d2[_0xbf2c('0x5c')]+'\x22';if(this[_0xbf2c('0x83')](_0x22e4d2[_0xbf2c('0x77')])){_0x329850+=','+_0x22e4d2[_0xbf2c('0x77')];}var _0x46fe81=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xab'),_0x329850);if(_0x46fe81[_0xbf2c('0xa3')]===-0x1){return _0x46fe81;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x329850));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xad')]=function(_0xe2c49d){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xae'),_0xe2c49d['label']));if(!this[_0xbf2c('0x83')](_0xe2c49d[_0xbf2c('0xaf')])){return this['channel'][_0xbf2c('0xaa')]('no\x20grammar\x20configured');}var _0x19d7cd=_0xe2c49d[_0xbf2c('0xaf')];if(this[_0xbf2c('0x83')](_0xe2c49d[_0xbf2c('0x77')])){_0x19d7cd+=','+_0xe2c49d[_0xbf2c('0x77')];}var _0x58903d=this[_0xbf2c('0xa')][_0xbf2c('0x56')]('MRCPRecog',_0x19d7cd);if(_0x58903d[_0xbf2c('0xa3')]===-0x1){return _0x58903d;}var _0x1e01dd=this[_0xbf2c('0xa2')](_0xbf2c('0xb0'),_0xbf2c('0xb1'));if(_0x1e01dd[_0xbf2c('0xa3')]===-0x1){return _0x1e01dd;}var _0x12d073=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xb3'));if(_0x12d073[_0xbf2c('0xa3')]===-0x1){return _0x12d073;}var _0x5d9ff0=this['getAndSetVariable']('RECOG_INSTANCE()',_0xbf2c('0xb4'));if(_0x5d9ff0[_0xbf2c('0xa3')]===-0x1){return _0x5d9ff0;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x19d7cd));};AGIVertices[_0xbf2c('0x11')]['agi']=function(_0xe900e3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xb5'),_0xe900e3['label']));return this[_0xbf2c('0xa')][_0xbf2c('0xb6')]([_0xe900e3[_0xbf2c('0xb7')],_0xe900e3[_0xbf2c('0xb8')]]);};AGIVertices[_0xbf2c('0x11')]['answer']=function(_0x423363){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0xb9'),_0x423363[_0xbf2c('0xa9')]));if(this['isConfigured'](_0x423363[_0xbf2c('0x67')])){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xba'),_0x423363[_0xbf2c('0x67')]));var _0x2f996d=this[_0xbf2c('0xa')][_0xbf2c('0xbb')](_0x423363[_0xbf2c('0x67')]);if(_0x2f996d['result']===-0x1){return _0x2f996d;}}return this[_0xbf2c('0xa')]['answer']();};AGIVertices[_0xbf2c('0x11')]['callback']=function(_0x1aa6fa){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xbc'),_0x1aa6fa[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x1aa6fa[_0xbf2c('0x48')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1aa6fa,'no\x20list\x20selected');}_0x1aa6fa[_0xbf2c('0x4a')]=moment();if(this[_0xbf2c('0x83')](_0x1aa6fa[_0xbf2c('0xbd')])){_0x1aa6fa[_0xbf2c('0x4a')]=moment()[_0xbf2c('0xbe')](_0x1aa6fa['delay'],'minutes');}if(!this['isConfigured'](_0x1aa6fa[_0xbf2c('0xbf')])){_0x1aa6fa[_0xbf2c('0xbf')]=0x2;}this['createCmContact'][_0xbf2c('0x6d')](this,_0x1aa6fa);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc0'),_0x1aa6fa[_0xbf2c('0x47')],_0x1aa6fa[_0xbf2c('0x48')],_0x1aa6fa[_0xbf2c('0x4a')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc1')]=function(_0x13ce54){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0xc2'),_0x13ce54[_0xbf2c('0xa9')]));var _0x22cd78=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0x13ce54[_0xbf2c('0xc3')],_0x13ce54[_0xbf2c('0x77')]);if(_0x22cd78['result']===-0x1){return _0x22cd78;}return this['channel']['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0x13ce54['application'],_0x13ce54[_0xbf2c('0x77')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc5')]=function(_0x2e893d){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0xc6'),_0x2e893d[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x2e893d[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}var _0x1e2f41='\x22'+_0x2e893d['text']+'\x22';if(this[_0xbf2c('0x83')](_0x2e893d[_0xbf2c('0x77')])){_0x1e2f41+=','+_0x2e893d[_0xbf2c('0x77')];}var _0xb4138f=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xab'),_0x1e2f41);if(_0xb4138f[_0xbf2c('0xa3')]===-0x1){return _0xb4138f;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x1e2f41));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc8')]=function(_0x4a9ebe){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xc9'),_0x4a9ebe['label']));if(!this[_0xbf2c('0x83')](_0x4a9ebe['text'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}var _0x2fae4e='\x22'+_0x4a9ebe[_0xbf2c('0x5c')]+'\x22';if(this[_0xbf2c('0x83')](_0x4a9ebe[_0xbf2c('0x77')])){_0x2fae4e+=','+_0x4a9ebe[_0xbf2c('0x77')];}var _0x58a3e2=this[_0xbf2c('0xa')][_0xbf2c('0x56')]('MRCPSynth',_0x2fae4e);if(_0x58a3e2[_0xbf2c('0xa3')]===-0x1){return _0x58a3e2;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x2fae4e));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xca')]=function(_0xc417d1){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xcb'),_0xc417d1[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0xc417d1[_0xbf2c('0xaf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20grammar\x20configured');}var _0x1a8f9a=_0xc417d1[_0xbf2c('0xaf')];if(this[_0xbf2c('0x83')](_0xc417d1[_0xbf2c('0x77')])){_0x1a8f9a+=','+_0xc417d1['options'];}var _0x10d96a=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xcc'),_0x1a8f9a);if(_0x10d96a[_0xbf2c('0xa3')]===-0x1){return _0x10d96a;}var _0x24976d=this[_0xbf2c('0xa2')](_0xbf2c('0xb0'),_0xbf2c('0xcd'));if(_0x24976d[_0xbf2c('0xa3')]===-0x1){return _0x24976d;}var _0x45a0dc=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xce'));if(_0x45a0dc['result']===-0x1){return _0x45a0dc;}var _0xcce9be=this[_0xbf2c('0xa2')](_0xbf2c('0xcf'),_0xbf2c('0xd0'));if(_0xcce9be[_0xbf2c('0xa3')]===-0x1){return _0xcce9be;}return this['channel']['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xd1'),_0x1a8f9a));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xd2')]=function(_0x160bbf){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xd3'),_0x160bbf[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x160bbf['grammar'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xd4'));}var _0x5b6f66=_0x160bbf[_0xbf2c('0xaf')];if(this['isConfigured'](_0x160bbf[_0xbf2c('0x77')])){_0x5b6f66+=','+_0x160bbf[_0xbf2c('0x77')];}var _0x5d78df=this[_0xbf2c('0xa')]['exec'](_0xbf2c('0xcc'),_0x5b6f66);if(_0x5d78df[_0xbf2c('0xa3')]===-0x1){return _0x5d78df;}var _0xef9d1e=this['getAndSetVariable'](_0xbf2c('0xb0'),_0xbf2c('0xd5'));if(_0xef9d1e[_0xbf2c('0xa3')]===-0x1){return _0xef9d1e;}var _0x1e846d=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xd6'));if(_0x1e846d[_0xbf2c('0xa3')]===-0x1){return _0x1e846d;}var _0x4cedd9=this[_0xbf2c('0xa2')]('RECOG_INSTANCE()',_0xbf2c('0xd7'));if(_0x4cedd9[_0xbf2c('0xa3')]===-0x1){return _0x4cedd9;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5b6f66));};AGIVertices[_0xbf2c('0x11')]['database']=function(_0x31c9bf){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xd8'),_0x31c9bf[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x31c9bf[_0xbf2c('0xd9')])){return this['channel'][_0xbf2c('0x30')](_0x31c9bf,_0xbf2c('0xda'));}var _0x27e07e=this[_0xbf2c('0xdb')][_0xbf2c('0x6d')](this,_0x31c9bf[_0xbf2c('0xd9')]);if(!_0x27e07e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x31c9bf,_0xbf2c('0xdc'));}if(!this['isConfigured'](_0x31c9bf[_0xbf2c('0xdd')])){return this[_0xbf2c('0xa')]['error'](_0x31c9bf,'no\x20query\x20configured');}var _0x58ee7d=_0x31c9bf[_0xbf2c('0xdd')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xde'),_0x58ee7d));var _0x4d77ad=this['getQueryOdbc'][_0xbf2c('0x6d')](this,_0x27e07e,_0x58ee7d);this[_0xbf2c('0x35')]['sync'](this,_0x31c9bf,_0x58ee7d);if(!this['isConfigured'](_0x31c9bf[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1e6bce=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x31c9bf['variable_id']);if(!_0x1e6bce){return this['channel']['error'](_0x31c9bf,_0xbf2c('0xe0'));}var _0x5159db=this;_0x4d77ad['forEach'](function(_0x2594a9,_0x27ee3b){Object['keys'](_0x2594a9)[_0xbf2c('0xe1')](function(_0x4527d4){_0x5159db['channel']['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0xe2'),_0x1e6bce,_0x27ee3b,_0x4527d4),_0x2594a9[_0x4527d4]);});});this['channel']['setVariable'](util['format'](_0xbf2c('0xe3'),_0x1e6bce),_0x4d77ad[_0xbf2c('0x9c')]);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xe4'),_0x1e6bce));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xe5')]=function(_0x12dd7d){logger[_0xbf2c('0xe6')](util['format'](_0xbf2c('0xe7'),_0x12dd7d[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x12dd7d[_0xbf2c('0xe8')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x12dd7d,'no\x20user\x20selected');}var _0x143bd5=this[_0xbf2c('0x18')]['sync'](this,_0x12dd7d[_0xbf2c('0xe8')]);if(!_0x143bd5){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x12dd7d,'no\x20user\x20found');}var _0x5e8b20=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xe9'),[util['format'](_0xbf2c('0xea'),_0x143bd5),_0x12dd7d['timeout'],_0x12dd7d[_0xbf2c('0xeb')],_0x12dd7d[_0xbf2c('0x65')]]);if(_0x5e8b20[_0xbf2c('0xa3')]===-0x1){return _0x5e8b20;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xec'),_0xbf2c('0xe9')));};AGIVertices['prototype']['dialogflow']=function(_0x49f2b1){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x49f2b1[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x49f2b1[_0xbf2c('0xed')])){return this['channel']['noop'](_0xbf2c('0xee'));}if(!this[_0xbf2c('0x83')](_0x49f2b1[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x49f2b1);this['createSquareMessage'](_0x49f2b1['text'],'in','','');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xf0'),_0x49f2b1[_0xbf2c('0x5c')]));var _0x585ac3=this['googleDialogflow'][_0xbf2c('0x6d')](this,_0x49f2b1);if(_0x585ac3){for(var _0x4f5f15 in _0x585ac3){if(_0x585ac3[_0xbf2c('0x95')](_0x4f5f15)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('DIALOGFLOW_%s',_0x4f5f15[_0xbf2c('0x69')]()),_0x585ac3[_0x4f5f15]);}}this['createSquareMessage'](_0x585ac3['speech'],'out',_0xbf2c('0xf1'),'');return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xf2'),_0x585ac3[_0xbf2c('0xf3')]));}return this[_0xbf2c('0xa')]['error'](_0x49f2b1,_0xbf2c('0xf4'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xf5')]=function(_0x23fb7){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x23fb7[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0xf6')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf7'));}if(!this['isConfigured'](_0x23fb7[_0xbf2c('0x7b')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf8'));}if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0x7c')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf9'));}if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0x7d')])){return this['channel']['noop'](_0xbf2c('0xfa'));}if(!this['isConfigured'](_0x23fb7[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x23fb7);this[_0xbf2c('0x40')](_0x23fb7[_0xbf2c('0x5c')],'in','','');this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xfb'),_0x23fb7['text']));var _0x33441d=this[_0xbf2c('0x7a')][_0xbf2c('0x6d')](this,_0x23fb7);if(_0x33441d){for(var _0x245ca7 in _0x33441d){if(_0x33441d[_0xbf2c('0x95')](_0x245ca7)){if(_0x245ca7!==_0xbf2c('0xfc')){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')]('DIALOGFLOW_%s',_0x245ca7[_0xbf2c('0x69')]()),_0x33441d[_0x245ca7]);}}}this['createSquareMessage'](_0x33441d['speech'],'out',_0xbf2c('0xf5'),_0x33441d[_0xbf2c('0xfc')]);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xfd'),_0x33441d['speech']));}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x23fb7,_0xbf2c('0xfe'));};AGIVertices['prototype'][_0xbf2c('0xff')]=function(_0x107900){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x107900[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x107900['ndauth_url'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x100'));}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x101')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20username\x20configured');}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x102')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x103'));}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x104')])){return this['channel']['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')]['bot']=!![];this[_0xbf2c('0x35')](_0x107900);this[_0xbf2c('0x40')](_0x107900['text'],'in','','');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x105'),_0x107900['text']));var _0x3bef1b=this[_0xbf2c('0x7e')]['sync'](this,_0x107900);if(_0x3bef1b){for(var _0x3733a1 in _0x3bef1b){if(_0x3bef1b[_0xbf2c('0x95')](_0x3733a1)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x106'),_0x3733a1[_0xbf2c('0x69')]()),_0x3bef1b[_0x3733a1]);}}this[_0xbf2c('0x40')](_0x3bef1b[_0xbf2c('0xf3')],_0xbf2c('0x107'),_0xbf2c('0xff'),'');if(_0x3bef1b[_0xbf2c('0x108')]){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x109'),_0x3bef1b[_0xbf2c('0x108')]));var _0x2d17ad=this['channel'][_0xbf2c('0x10a')](_0x3bef1b[_0xbf2c('0x108')]);try{fs[_0xbf2c('0x10b')](_0x3bef1b[_0xbf2c('0x108')]+_0xbf2c('0x10c'));}catch(_0xdd33ed){logger['error'](_0xdd33ed);}return _0x2d17ad;}else{return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x10d'),_0x3bef1b[_0xbf2c('0xf3')]));}}return this[_0xbf2c('0xa')]['error'](_0x107900,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x10e')]=function(_0x31aba3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x31aba3['label']));return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x10e'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x10f')]=function(_0x36de13){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x110'),_0x36de13['label']));var _0x435f75='';if(_0x36de13[_0xbf2c('0x111')]){if(!this[_0xbf2c('0x83')](_0x36de13[_0xbf2c('0x111')])){return this['channel']['error'](_0x36de13,_0xbf2c('0x112'));}else{var _0x4ba605=parseInt(_0x36de13['trunk_id'],0xa);if(isNaN(_0x4ba605)){_0x435f75=_0x36de13[_0xbf2c('0x111')];}else{_0x435f75=this[_0xbf2c('0x1a')][_0xbf2c('0x6d')](this,_0x36de13[_0xbf2c('0x111')]);if(!_0x435f75){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36de13,'no\x20trunk\x20found');}}}}else if(_0x36de13[_0xbf2c('0x113')]){_0x435f75=_0x36de13[_0xbf2c('0x113')];}else{return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36de13,_0xbf2c('0x112'));}var _0x2533b7=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xe9'),[util['format'](_0xbf2c('0x114'),_0x435f75,_0x36de13[_0xbf2c('0x47')]),_0x36de13[_0xbf2c('0x67')],_0x36de13['opts'],_0x36de13['url']]);if(_0x2533b7[_0xbf2c('0xa3')]===-0x1){return _0x2533b7;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xec'),_0xbf2c('0xe9')));};AGIVertices[_0xbf2c('0x11')]['finally']=function(_0x2fb53e){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x115'),_0x2fb53e[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x116'));};AGIVertices['prototype'][_0xbf2c('0x9')]=function(_0x4805ce){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x117'),_0x4805ce['label']));if(_0x4805ce[_0xbf2c('0xa6')]===0x0){return this[_0xbf2c('0xa5')](_0x4805ce);}_0x4805ce[_0xbf2c('0xa6')]-=0x1;if(!this[_0xbf2c('0x83')](_0x4805ce[_0xbf2c('0x118')])){return this['channel'][_0xbf2c('0x30')](_0x4805ce,_0xbf2c('0x119'));}var _0x423782=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x4805ce[_0xbf2c('0x118')]);if(!_0x423782){return this[_0xbf2c('0xa')]['error'](_0x4805ce,_0xbf2c('0x11a'));}if(!this[_0xbf2c('0x83')](_0x4805ce[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xbf2c('0x11b'));}var _0x4ad19f=this[_0xbf2c('0xa')][_0xbf2c('0x11c')](_0x423782,_0x4805ce['response'],_0x4805ce[_0xbf2c('0x11d')]);var _0x50749b=_0x4ad19f[_0xbf2c('0xa3')]?_0x4ad19f[_0xbf2c('0xa3')][_0xbf2c('0x4b')]():'';logger[_0xbf2c('0x2c')](_0xbf2c('0x11e'),JSON['stringify'](_0x4ad19f));if(_0x4ad19f[_0xbf2c('0xa3')]===-0x1){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x50749b);return _0x4ad19f;}else if(_0x4ad19f[_0xbf2c('0xa1')]===_0xbf2c('0x67')){_0x4ad19f[_0xbf2c('0xa3')]=_0x50749b['length']>=parseInt(_0x4805ce[_0xbf2c('0x11f')])?'x':'i';}else{_0x4ad19f[_0xbf2c('0xa3')]=_0x50749b[_0xbf2c('0x9c')]>=parseInt(_0x4805ce['mindigit'])&&_0x50749b['length']<=parseInt(_0x4805ce[_0xbf2c('0x11d')])?'x':'i';}var _0x1c9bfa=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x4805ce[_0xbf2c('0xdf')]);if(!_0x1c9bfa){return this['channel']['error'](_0x4805ce,_0xbf2c('0xe0'));}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x1c9bfa,_0x50749b);if(this[_0xbf2c('0x83')](_0x4805ce['hiddendigitsnum'])){var _0x35f94e=parseInt(_0x4805ce[_0xbf2c('0x120')],0xa);var _0x4a3436=rs['generate']({'charset':'*','length':_0x35f94e});var _0xc947c3=_0x50749b['length'];if(_0xc947c3>0x0){if(_0xc947c3>_0x35f94e){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x4805ce[_0xbf2c('0x121')]===_0xbf2c('0x122')?_0x4a3436+_0x50749b[_0xbf2c('0x123')](_0x35f94e):_0x50749b[_0xbf2c('0x123')](0x0,_0xc947c3-_0x35f94e)+_0x4a3436);}else{this[_0xbf2c('0x35')]['sync'](this,_0x4805ce,rs[_0xbf2c('0x124')]({'charset':'*','length':_0xc947c3}));}}else{this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,'');}}else{this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x50749b);}return _0x4ad19f;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x125')]=function(_0x3f6110){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3f6110[_0xbf2c('0xa9')]));return this['getdigits'](_0x3f6110);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x126')]=function(_0x25b6d9){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x127'),_0x25b6d9['label']));this['createSquareDetailsReport'][_0xbf2c('0x6d')](this,_0x25b6d9,_0x25b6d9[_0xbf2c('0x128')]);return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x129'),_0x25b6d9[_0xbf2c('0x128')]));};AGIVertices['prototype']['awspolly']=function(_0x339aa3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x12a'),_0x339aa3[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x339aa3[_0xbf2c('0x86')])||!this[_0xbf2c('0x83')](_0x339aa3['aws_secret_access_key'])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x12b'));}if(!this[_0xbf2c('0x83')](_0x339aa3[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x12c'),_0x339aa3['text']));var _0x58a40a=this[_0xbf2c('0x85')][_0xbf2c('0x6d')](this,_0x339aa3);if(_0x58a40a){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x12d'),_0x58a40a));var _0x27b274=this[_0xbf2c('0xa')]['streamFile'](_0x58a40a);try{fs[_0xbf2c('0x10b')](_0x58a40a+_0xbf2c('0x10c'));}catch(_0x2d0e30){logger['error'](_0x2d0e30);}return _0x27b274;}return this['channel'][_0xbf2c('0x30')](_0x339aa3,_0xbf2c('0x12e'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x12f')]=function(_0x5627b7){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x130'),_0x5627b7[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x5627b7['aws_access_key_id'])||!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x87')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x12b'));}if(!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x8d')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x131'));}if(!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x5627b7);this[_0xbf2c('0x40')](_0x5627b7['text'],'in','','');this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x132'),_0x5627b7['text']));var _0x477a33=this[_0xbf2c('0x8c')][_0xbf2c('0x6d')](this,_0x5627b7);if(_0x477a33){for(var _0x2e735b in _0x477a33){if(_0x477a33[_0xbf2c('0x95')](_0x2e735b)&&_[_0xbf2c('0x96')](_0x477a33[_0x2e735b])){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')]('AWS_LEX_%s',_0x2e735b[_0xbf2c('0x69')]()),_0x477a33[_0x2e735b]);}}if(_[_0xbf2c('0x43')](_0x477a33[_0xbf2c('0x75')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xbf2c('0x40')](_0x477a33['message'],'out',_0xbf2c('0x133'),'');return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x134'),_0x477a33[_0xbf2c('0x75')]));}}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5627b7,_0xbf2c('0x135'));};AGIVertices['prototype'][_0xbf2c('0x136')]=function(_0xbb10d3){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xbb10d3[_0xbf2c('0xa9')],_0xbb10d3['timeout']));if(!this[_0xbf2c('0x83')](_0xbb10d3[_0xbf2c('0xed')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xee'));}var _0x15f135='wav';var _0x49c222=util[_0xbf2c('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xbf2c('0x124')](0x4));var _0x5e4a6d=util[_0xbf2c('0x28')](_0xbf2c('0x9f'),_0x49c222,_0x15f135);var _0x2d8d40=!![];if(_0xbb10d3['beep']===_0xbf2c('0x137')){_0x2d8d40=![];}var _0x5f101c=this['channel'][_0xbf2c('0x138')](_0x49c222,_0x15f135,_0xbb10d3[_0xbf2c('0x139')],_0xbb10d3[_0xbf2c('0x67')],undefined,_0x2d8d40);if(_0x5f101c[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x13a'),_0x5e4a6d));var _0x17e895=this[_0xbf2c('0x8e')][_0xbf2c('0x6d')](this,_0xbb10d3,_0x5e4a6d);if(_0x17e895){for(var _0x3b371c in _0x17e895){if(_0x17e895[_0xbf2c('0x95')](_0x3b371c)){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0x13b'),_0x3b371c['toUpperCase']()),_0x17e895[_0x3b371c]);}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x13c'),JSON['stringify'](_0x17e895)));}}return _0x5f101c;};AGIVertices[_0xbf2c('0x11')]['tildeasr']=function(_0x52092c){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x13d'),_0x52092c[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x52092c['appid'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x13e'));}if(!this[_0xbf2c('0x83')](_0x52092c[_0xbf2c('0x92')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x13f'));}var _0x3b7aba=_0xbf2c('0x140');var _0x52d27c=util[_0xbf2c('0x28')](_0xbf2c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x30caac=util[_0xbf2c('0x28')]('%s.%s',_0x52d27c,_0x3b7aba);var _0x1a00a7=!![];if(_0x52092c['beep']==='NOBEEP'){_0x1a00a7=![];}var _0x5e54c3=this[_0xbf2c('0xa')][_0xbf2c('0x138')](_0x52d27c,_0x3b7aba,_0x52092c[_0xbf2c('0x139')],_0x52092c[_0xbf2c('0x67')],undefined,_0x1a00a7);if(_0x5e54c3[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('tilde\x20%s\x20file\x20created',_0x30caac));var _0x26e26c=this[_0xbf2c('0x90')][_0xbf2c('0x6d')](this,_0x52092c,_0x30caac);if(_0x26e26c){for(var _0x522ae5 in _0x26e26c){if(_0x26e26c[_0xbf2c('0x95')](_0x522ae5)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x142'),_0x522ae5[_0xbf2c('0x69')]()),_0x26e26c[_0x522ae5]);}}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x143'),JSON['stringify'](_0x26e26c)));}}return _0x5e54c3;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x144')]=function(_0x5f1fad){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x145'),_0x5f1fad[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')][_0xbf2c('0x146')](_0x5f1fad[_0xbf2c('0x3b')],_0x5f1fad[_0xbf2c('0x147')],_0x5f1fad[_0xbf2c('0x148')]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x149')]=function(_0xadc128){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x14a'),_0xadc128[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0xadc128[_0xbf2c('0x14b')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xadc128,_0xbf2c('0x14c'));}try{var _0x5db225=eval(_0xadc128[_0xbf2c('0x14b')])?_0xbf2c('0x14d'):'false';this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x14e'),_0xadc128[_0xbf2c('0x14b')],_0x5db225));return{'code':0xc8,'result':_0x5db225};}catch(_0x3db097){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xbf2c('0x14f')]=function(_0xdb98a0){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x150'),_0xdb98a0[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0xdb98a0[_0xbf2c('0x151')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xdb98a0,_0xbf2c('0x152'));}var _0x4b8b3e=this[_0xbf2c('0x22')][_0xbf2c('0x6d')](this,_0xdb98a0[_0xbf2c('0x151')]);if(!_0x4b8b3e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xdb98a0,_0xbf2c('0x153'));}for(var _0x5eabfe=0x0;_0x5eabfe<_0x4b8b3e[_0xbf2c('0x9c')];_0x5eabfe+=0x1){var _0x131fce=this[_0xbf2c('0xa')][_0xbf2c('0xd')](util[_0xbf2c('0x28')]('IFTIME(%s?true:false)',_0x4b8b3e[_0x5eabfe]));if(_0x131fce[_0xbf2c('0xa3')]===-0x1){return _0x131fce;}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0x131fce[_0xbf2c('0xa1')]));if(_0x131fce[_0xbf2c('0xa1')]==='true'){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x14d')));this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')]('IFTIME\x20%s\x20%s',_0x4b8b3e[_0x5eabfe],_0xbf2c('0x14d')));return{'code':0xc8,'result':_0xbf2c('0x14d')};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x155')));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x155')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xbf2c('0x156')]=function(_0x71a955){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x157'),_0x71a955['label']));return this[_0xbf2c('0xa')][_0xbf2c('0x156')]();};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x158')]=function(_0x1d9e50){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1d9e50['label']));if(!this['isConfigured'](_0x1d9e50[_0xbf2c('0xed')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20key\x20configured');}var _0xeb8a4a=_0xbf2c('0x140');var _0x52d048=util['format'](_0xbf2c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x187999=util[_0xbf2c('0x28')](_0xbf2c('0x9f'),_0x52d048,_0xeb8a4a);var _0x2aebb7=!![];if(_0x1d9e50[_0xbf2c('0x159')]===_0xbf2c('0x137')){_0x2aebb7=![];}var _0x38bf99=this[_0xbf2c('0xa')]['recordFile'](_0x52d048,_0xeb8a4a,_0x1d9e50['intKey'],_0x1d9e50[_0xbf2c('0x67')],undefined,_0x2aebb7);if(_0x38bf99[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x15a'),_0x187999));var _0x50f3f8=this[_0xbf2c('0x81')][_0xbf2c('0x6d')](this,_0x1d9e50,_0x187999);if(_0x50f3f8){for(var _0x49b4d9 in _0x50f3f8){if(_0x50f3f8['hasOwnProperty'](_0x49b4d9)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x15b'),_0x49b4d9[_0xbf2c('0x69')]()),_0x50f3f8[_0x49b4d9]);}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0xbf2c('0x71')](_0x50f3f8)));}}return _0x38bf99;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x15c')]=function(_0x477c73){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x15d'),_0x477c73[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x477c73[_0xbf2c('0xed')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xee'));}if(!this[_0xbf2c('0x83')](_0x477c73['text'])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x15e'),_0x477c73[_0xbf2c('0x5c')]));var _0x3eb2d4=this['ispeechTTS'][_0xbf2c('0x6d')](this,_0x477c73);if(_0x3eb2d4){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('ispeech\x20%s\x20file\x20created',_0x3eb2d4));var _0x2bb820=this[_0xbf2c('0xa')][_0xbf2c('0x10a')](_0x3eb2d4,_0x477c73[_0xbf2c('0x139')]);try{fs[_0xbf2c('0x10b')](_0x3eb2d4+_0xbf2c('0x10c'));}catch(_0x49534d){logger[_0xbf2c('0x30')](_0x49534d);}return _0x2bb820;}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x477c73,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')]['login']=function(_0x584c87){logger['info'](util['format'](_0xbf2c('0x15f'),_0x584c87[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x584c87[_0xbf2c('0x160')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x584c87,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x162'),this[_0xbf2c('0xa')]['callerid'],_0x584c87[_0xbf2c('0x160')]));var _0xc887b3=this['agentLogin'][_0xbf2c('0x6d')](this,_0x584c87[_0xbf2c('0x160')]);if(_0xc887b3){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger[_0xbf2c('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this['channel'][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x166')]=function(_0x344a9a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x167'),_0x344a9a[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x344a9a[_0xbf2c('0x160')])){return this['channel'][_0xbf2c('0x30')](_0x344a9a,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));var _0x255a49=this['agentLogout'][_0xbf2c('0x6d')](this,_0x344a9a[_0xbf2c('0x160')]);if(_0x255a49){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x163'),this[_0xbf2c('0xa')]['callerid'],_0x344a9a[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger['info'](util[_0xbf2c('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices['prototype'][_0xbf2c('0x169')]=function(_0x4645b0){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x16a'),_0x4645b0['label']));if(!this[_0xbf2c('0x83')](_0x4645b0['operation'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4645b0,_0xbf2c('0x16b'));}this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('math\x20%s',_0x4645b0[_0xbf2c('0x16c')]));var _0x15635d=eval(_0x4645b0['operation']);if(!this['isConfigured'](_0x4645b0[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x11b'));}var _0xd33ce8=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x4645b0[_0xbf2c('0xdf')]);if(!_0xd33ce8){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4645b0,'no\x20variable\x20found');}if(_[_0xbf2c('0x9b')](_0x15635d)){var _0x6bee32=this;_0x15635d[_0xbf2c('0xe1')](function(_0x5239d7,_0x450929){_0x6bee32['channel'][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('%s[%s]',_0xd33ce8,_0x450929),_0x5239d7);});return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x16d'),_0xd33ce8));}else{return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0xd33ce8,_0x15635d);}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x16e')]=function(_0x366dee){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x366dee[_0xbf2c('0xa9')]));if(_0x366dee['retry']===0x0){return this['maxRetry'](_0x366dee);}_0x366dee[_0xbf2c('0xa6')]-=0x1;if(!this[_0xbf2c('0x83')](_0x366dee[_0xbf2c('0x118')])){return this[_0xbf2c('0xa')]['error'](_0x366dee,_0xbf2c('0x119'));}var _0x253fa4=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x366dee[_0xbf2c('0x118')]);if(!_0x253fa4){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x366dee,_0xbf2c('0x11a'));}var _0x13f9b0=this['channel'][_0xbf2c('0x11c')](_0x253fa4,_0x366dee[_0xbf2c('0x16f')],_0x366dee[_0xbf2c('0x170')]);var _0xc2d501=_0x13f9b0[_0xbf2c('0xa3')];if(_0x13f9b0[_0xbf2c('0xa3')]===-0x1){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x366dee,'-1');return _0x13f9b0;}else if(_0x13f9b0['extra']===_0xbf2c('0x67')){_0x13f9b0[_0xbf2c('0xa3')]=_0x13f9b0[_0xbf2c('0xa3')][_0xbf2c('0x9c')]>0x0?_0x13f9b0[_0xbf2c('0xa3')]:'t';}else if(_['isEmpty'](_0x13f9b0[_0xbf2c('0xa3')])){_0x13f9b0[_0xbf2c('0xa3')]='#';_0xc2d501='#';}if(!this[_0xbf2c('0x83')](_0x366dee[_0xbf2c('0xdf')])){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x11b'));}else{var _0x4dd09c=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x366dee[_0xbf2c('0xdf')]);if(!_0x4dd09c){return this[_0xbf2c('0xa')]['error'](_0x366dee,_0xbf2c('0xe0'));}this['channel'][_0xbf2c('0x9e')](_0x4dd09c,_0xc2d501);}this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x366dee,_0xc2d501);return _0x13f9b0;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xaa')]=function(_0x1147cc){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x171'),_0x1147cc['label']));return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0x1147cc[_0xbf2c('0x172')]||_0x1147cc[_0xbf2c('0xa9')]);};AGIVertices[_0xbf2c('0x11')]['pause']=function(_0x338046){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x173'),_0x338046['label']));if(!this[_0xbf2c('0x83')](_0x338046['findBy'])){return this[_0xbf2c('0xa')]['error'](_0x338046,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')]['callerid'],_0x338046[_0xbf2c('0x160')]));var _0x1e56a1=this[_0xbf2c('0x4c')][_0xbf2c('0x6d')](this,_0x338046['pause_id']);var _0x5c4110=this[_0xbf2c('0x174')][_0xbf2c('0x6d')](this,_0x338046['findBy'],_0x1e56a1);if(_0x5c4110){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x163'),this[_0xbf2c('0xa')]['callerid'],_0x338046[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046['findBy']));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x175')]=function(_0x16ca34){logger['info'](util['format'](_0xbf2c('0x176'),_0x16ca34[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x16ca34[_0xbf2c('0x118')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x16ca34,_0xbf2c('0x119'));}var _0x5d7e46=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x16ca34['file_id']);if(!_0x5d7e46){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x16ca34,_0xbf2c('0x11a'));}var _0x279159=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0x177'),[_0x5d7e46,_0x16ca34[_0xbf2c('0xeb')]]);if(_0x279159[_0xbf2c('0xa3')]===-0x1){return _0x279159;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x177'),_0x5d7e46));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x178')]=function(_0x4844df){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x179'),_0x4844df[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x4844df['queue_id'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4844df,'no\x20queue\x20selected');}var _0x58a56e='';var _0x230cbb=parseInt(_0x4844df[_0xbf2c('0x17a')],0xa);if(isNaN(_0x230cbb)){_0x58a56e=_0x4844df['queue_id'];}else{_0x58a56e=this[_0xbf2c('0x12')][_0xbf2c('0x6d')](this,_0x4844df[_0xbf2c('0x17a')]);if(!_0x58a56e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4844df,_0xbf2c('0x17b'));}}var _0x52f031='';if(this[_0xbf2c('0x83')](_0x4844df['file_id'])){var _0x572181=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x4844df[_0xbf2c('0x118')]);if(_0x572181){_0x52f031=_0x572181;}}this[_0xbf2c('0x35')]['sync'](this,_0x4844df,_0x58a56e);if(_0x4844df[_0xbf2c('0xeb')][_0xbf2c('0x17c')]('x')<0x0){_0x4844df[_0xbf2c('0xeb')]+='x';}if(_0x4844df[_0xbf2c('0xeb')]['indexOf']('X')<0x0){_0x4844df[_0xbf2c('0xeb')]+='X';}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0xbf2c('0x17d'),_0x58a56e?_0x58a56e[_0xbf2c('0x17e')]():'');var _0xdbc96e=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0x17f'),[_0x58a56e,_0x4844df[_0xbf2c('0xeb')],_0x4844df[_0xbf2c('0x65')],_0x52f031,_0x4844df[_0xbf2c('0x67')],_0x4844df[_0xbf2c('0xb6')],_0x4844df['macro'],_0x4844df[_0xbf2c('0x180')],'',_0x4844df[_0xbf2c('0x181')]]);if(_0xdbc96e[_0xbf2c('0xa3')]===-0x1){return _0xdbc96e;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x17f'),_0x58a56e));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x182')]=function(_0x3c3b99){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x183'),_0x3c3b99['label']));var _0x5d0623=_0x3c3b99[_0xbf2c('0x184')]||_0xbf2c('0x140');var _0x337ed4=util[_0xbf2c('0x28')](_0xbf2c('0x185'),this['channel'][_0xbf2c('0x36')],rs[_0xbf2c('0x124')](0x5));var _0x4cf345=util[_0xbf2c('0x28')](_0xbf2c('0x186'),FILES_PATH,_0x337ed4,_0x5d0623);var _0x38ca70=util['format'](_0xbf2c('0x141'),FILES_PATH,_0x337ed4);this[_0xbf2c('0x38')][_0xbf2c('0x6d')](this,_0x3c3b99,_0x337ed4,_0x4cf345);this[_0xbf2c('0xa')]['setVariable'](_0xbf2c('0x187'),_0x337ed4);logger[_0xbf2c('0x2c')](_0xbf2c('0x188'),_0x38ca70,_0x5d0623,_0x3c3b99['escape_digits'],_0x3c3b99[_0xbf2c('0x67')]);return this[_0xbf2c('0xa')]['recordFile'](_0x38ca70,_0x5d0623,_0x3c3b99[_0xbf2c('0x189')],_0x3c3b99['timeout'],undefined,!![]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x18a')]=function(_0x9aeb1a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x18b'),_0x9aeb1a['label']));if(!this['isConfigured'](_0x9aeb1a[_0xbf2c('0x65')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x18c'));}var _0x4202f2=this['restAPI'][_0xbf2c('0x6d')](this,_0x9aeb1a);logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x18d'),util[_0xbf2c('0x18e')](_0x4202f2,{'showHidden':![],'depth':null})));if(!this[_0xbf2c('0x83')](_0x9aeb1a[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x18f'));}var _0x4ee188=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x9aeb1a[_0xbf2c('0xdf')]);if(!_0x4ee188){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x9aeb1a,_0xbf2c('0xe0'));}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('%s_STATUS_CODE',_0x4ee188),_0x4202f2[_0xbf2c('0x73')]?_0x4202f2[_0xbf2c('0x73')]:_0xbf2c('0x190'));this['channel']['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0x191'),_0x4ee188),_0x4202f2[_0xbf2c('0x74')]?_0x4202f2[_0xbf2c('0x74')]:'OK');if(_0x4202f2['body']){try{this[_0xbf2c('0x9d')](_0x4202f2[_0xbf2c('0x6a')],_0x4ee188);}catch(_0x3c87fc){logger['error'](util[_0xbf2c('0x28')](_0xbf2c('0x192'),_0x4ee188));}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xe4'),_0x4ee188));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x193')]=function(_0x543e76){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x543e76['label']));return this[_0xbf2c('0xa')][_0xbf2c('0x194')](_0x543e76[_0xbf2c('0x195')][_0xbf2c('0x58')](/\s+/g,''),_0x543e76['escape_digits']);};AGIVertices[_0xbf2c('0x11')]['saynumber']=function(_0x3c6bed){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x196'),_0x3c6bed[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')]['sayNumber'](_0x3c6bed[_0xbf2c('0x197')][_0xbf2c('0x58')](/\s+/g,''),_0x3c6bed['escape_digits']);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x198')]=function(_0x348335){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x199'),_0x348335[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')][_0xbf2c('0x19a')](_0x348335['text'],_0x348335[_0xbf2c('0x189')]);};AGIVertices['prototype'][_0xbf2c('0x19b')]=function(_0x510f0d){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x19c'),_0x510f0d[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x510f0d[_0xbf2c('0x19d')])){return this['channel']['noop'](_0xbf2c('0x19e'));}var _0x4ce3ee=this[_0xbf2c('0x1f')]['sync'](this,_0x510f0d['account_id']);if(!_0x4ce3ee||!_0x4ce3ee[_0xbf2c('0x19f')]){return this['channel'][_0xbf2c('0x30')](_0x510f0d,_0xbf2c('0x1a0'));}var _0x3a3ce9={'from':util['format'](_0xbf2c('0x1a1'),_0x4ce3ee['name'],_0x4ce3ee[_0xbf2c('0x1a2')]||_0x4ce3ee[_0xbf2c('0x19f')]['user']),'to':_0x510f0d['to']||'','cc':_0x510f0d['cc']||'','bcc':_0x510f0d[_0xbf2c('0x1a3')]||'','subject':_0x510f0d[_0xbf2c('0x1a4')],'html':_0x510f0d['text'],'text':_0x510f0d[_0xbf2c('0x5c')]};if(this['isConfigured'](_0x510f0d[_0xbf2c('0x1a5')])){}logger[_0xbf2c('0xe6')](_0xbf2c('0x1a6'),JSON[_0xbf2c('0x71')](_0x3a3ce9));this[_0xbf2c('0x35')]['sync'](this,_0x510f0d,_0x510f0d[_0xbf2c('0x19d')]);this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4ce3ee[_0xbf2c('0x10')]));this[_0xbf2c('0x21')]['sync'](this,_0x4ce3ee[_0xbf2c('0x1a7')],_0x3a3ce9);return this['channel'][_0xbf2c('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xbf2c('0x1a8')]=function(_0xd888e5){logger[_0xbf2c('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xd888e5['label']));return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x1a9'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1aa')]=function(_0x5ee4c6){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1ab'),_0x5ee4c6['label']));if(!this[_0xbf2c('0x83')](_0x5ee4c6['sms_account_id'])){return this['channel']['noop'](_0xbf2c('0x1ac'));}var _0x14d72a=this[_0xbf2c('0x32')][_0xbf2c('0x6d')](this,_0x5ee4c6['sms_account_id']);if(!_0x14d72a){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5ee4c6,_0xbf2c('0x1ad'));}var _0x5714a7={'body':_0x5ee4c6[_0xbf2c('0x1ae')],'phone':_0x5ee4c6['to']||'','SmsAccountId':_0x14d72a['id']};logger[_0xbf2c('0xe6')](_0xbf2c('0x1af'),JSON[_0xbf2c('0x71')](_0x5714a7));this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x5ee4c6,_0x5ee4c6[_0xbf2c('0x1b0')]);this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x1b1'),_0x14d72a['name']));this[_0xbf2c('0x34')][_0xbf2c('0x6d')](this,_0x5714a7);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1b2'));};AGIVertices[_0xbf2c('0x11')]['set']=function(_0x36297d){logger['info'](util['format'](_0xbf2c('0x1b3'),_0x36297d['label']));if(!this[_0xbf2c('0x83')](_0x36297d[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36297d,_0xbf2c('0x1b4'));}var _0x4dc726=this[_0xbf2c('0xd')]['sync'](this,_0x36297d[_0xbf2c('0xdf')]);if(!_0x4dc726){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36297d,_0xbf2c('0xe0'));}return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x4dc726,_0x36297d[_0xbf2c('0x1b5')]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1b6')]=function(_0x4e83c6){logger['info'](util['format'](_0xbf2c('0x1b7'),_0x4e83c6['label']));this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x1b8'));var _0x4c4ee3=this['channel'][_0xbf2c('0xd')](_0xbf2c('0x1b9'));if(!_[_0xbf2c('0x42')](_0x4c4ee3[_0xbf2c('0xa1')])){this[_0xbf2c('0xa')][_0xbf2c('0x36')]=_0x4c4ee3[_0xbf2c('0xa1')];}if(_0x4e83c6['answer']===_0xbf2c('0x1ba')){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1bb'));return this[_0xbf2c('0xa')][_0xbf2c('0x1bc')]();}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1bd'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1be')]=function(_0x1c54d6){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1bf'),_0x1c54d6[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x1c54d6['project_id'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1c54d6,_0xbf2c('0x1c0'));}var _0x495538=this[_0xbf2c('0x13')]['sync'](this,_0x1c54d6[_0xbf2c('0x1c1')]);if(!this[_0xbf2c('0x83')](_0x495538)){return this[_0xbf2c('0xa')]['error'](_0x1c54d6,util[_0xbf2c('0x28')](_0xbf2c('0x1c2'),_0x1c54d6['project_id']));}if(_0x495538===this[_0xbf2c('0xa')][_0xbf2c('0x3e')]){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1c54d6,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x1c54d6,_0x495538);var _0x53bb39=this['channel'][_0xbf2c('0x56')](_0xbf2c('0x1c3'),util[_0xbf2c('0x28')](_0xbf2c('0x1c4'),config[_0xbf2c('0xb6')]['host']||_0xbf2c('0x1c5'),_0x495538,this[_0xbf2c('0xa')][_0xbf2c('0x3e')]));if(_0x53bb39[_0xbf2c('0xa3')]===-0x1){return _0x53bb39;}return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x1c3'),_0x495538));};AGIVertices['prototype'][_0xbf2c('0x1c6')]=function(_0x2dd74b){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2dd74b[_0xbf2c('0xa9')]));var _0x250522=this[_0xbf2c('0x55')][_0xbf2c('0x6d')](this,_0x2dd74b['command']);this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x2dd74b,_0x2dd74b['command']);if(this['isConfigured'](_0x2dd74b[_0xbf2c('0xdf')])){var _0x308e8b=this['getVariable'][_0xbf2c('0x6d')](this,_0x2dd74b[_0xbf2c('0xdf')]);if(_0x308e8b){this[_0xbf2c('0xa')]['setVariable'](_0x308e8b,_0x250522);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2dd74b['command'],_0x308e8b));}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x1c7'),_0x2dd74b[_0xbf2c('0xb7')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1c8')]=function(_0x5eb1cc){logger[_0xbf2c('0x2c')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5eb1cc[_0xbf2c('0xa9')]));_0x5eb1cc[_0xbf2c('0x5c')]=_0x5eb1cc[_0xbf2c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf2c('0x83')](_0x5eb1cc[_0xbf2c('0x5a')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1c9'));}if(!this[_0xbf2c('0x83')](_0x5eb1cc[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x1ca'),_0x5eb1cc[_0xbf2c('0x5c')]));var _0x3e17ad=this[_0xbf2c('0x59')]['sync'](this,_0x5eb1cc);if(_0x3e17ad){this[_0xbf2c('0xa')]['noop'](util['format'](_0xbf2c('0x1cb'),_0x3e17ad));var _0x4fe342=this[_0xbf2c('0xa')][_0xbf2c('0x10a')](_0x3e17ad);try{fs['unlink'](_0x3e17ad+_0xbf2c('0x10c'));}catch(_0x2162f3){logger[_0xbf2c('0x30')](_0x2162f3);}return _0x4fe342;}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5eb1cc,_0xbf2c('0x1cc'));};AGIVertices['prototype'][_0xbf2c('0x1cd')]=function(_0xbfad7d){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1ce'),_0xbfad7d[_0xbf2c('0xa9')]));_0xbfad7d[_0xbf2c('0x5c')]=_0xbfad7d[_0xbf2c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf2c('0x83')](_0xbfad7d[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Trying\x20Google\x20TTS\x20%s',_0xbfad7d[_0xbf2c('0x5c')]));var _0x366c7d=this['googleTTS'][_0xbf2c('0x6d')](this,_0xbfad7d);if(_0x366c7d){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x1cf'),_0x366c7d));var _0x4b7ec5=this['channel'][_0xbf2c('0x10a')](_0x366c7d);try{fs[_0xbf2c('0x10b')](_0x366c7d+_0xbf2c('0x10c'));}catch(_0x2afeea){logger[_0xbf2c('0x30')](_0x2afeea);}return _0x4b7ec5;}return this['channel'][_0xbf2c('0x30')](_0xbfad7d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1d0')]=function(_0x48a346){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x1d1'),_0x48a346[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x48a346[_0xbf2c('0x160')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x48a346,_0xbf2c('0x161'));}logger['info'](util[_0xbf2c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')]['callerid'],_0x48a346['findBy']));var _0x4547e6=this[_0xbf2c('0x4f')][_0xbf2c('0x6d')](this,_0x48a346[_0xbf2c('0x160')]);if(_0x4547e6){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x48a346['findBy']));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this['channel'][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices['prototype'][_0xbf2c('0x1d2')]=function(_0x21d416){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x21d416[_0xbf2c('0xa9')]));var _0x27ceea=this[_0xbf2c('0xa')]['exec'](_0xbf2c('0x1d3'),[_0x21d416[_0xbf2c('0x1d4')],_0x21d416[_0xbf2c('0x77')]]);if(_0x27ceea['result']===-0x1){return _0x27ceea;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20%s\x20%s',_0xbf2c('0x1d3'),_0x21d416[_0xbf2c('0x1d4')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1d5')]=function(_0x1bb25a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1d6'),_0x1bb25a[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x1bb25a[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')]['error'](_0x1bb25a,_0xbf2c('0x1b4'));}var _0x13e4f8=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x1bb25a[_0xbf2c('0xdf')]);if(!_0x13e4f8){return this['channel'][_0xbf2c('0x30')](_0x1bb25a,'no\x20variable\x20found');}var _0x2afcb0=this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0x13e4f8);return{'code':0xc8,'result':_0x2afcb0[_0xbf2c('0xa1')]?_0x2afcb0[_0xbf2c('0xa1')]:'-'};};String[_0xbf2c('0x11')][_0xbf2c('0x1d7')]=function(_0x5f5d6f,_0xb79022){return this[_0xbf2c('0xa0')](_0x5f5d6f)[_0xbf2c('0x1d8')](_0xb79022);};module[_0xbf2c('0x1d9')]=AGIVertices; \ No newline at end of file +var _0xae24=['scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','replaceAllVariables','%s.%s','saveRestApiResult','length','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20username\x20configured','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','extra','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','getData','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','shelljs','randomstring','moment','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','name','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0xae24,0x182));var _0x4ae2=function(_0xc4b255,_0x5ca1d9){_0xc4b255=_0xc4b255-0x0;var _0x312347=_0xae24[_0xc4b255];return _0x312347;};'use strict';var fs=require('fs');var util=require(_0x4ae2('0x0'));var _=require('lodash');var sh=require(_0x4ae2('0x1'));var odbc=require('odbc')();var rs=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x4ae2('0x4'))('agi');var config=require(_0x4ae2('0x5'));var scripts=require(_0x4ae2('0x6'));var FILES_PATH=_0x4ae2('0x7');var recursiveMapAttributes=[_0x4ae2('0x8'),_0x4ae2('0x9')];var verticesWithRetry=[_0x4ae2('0xa'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x41cdf1,_0x4d3d8a,_0x564ef9){this[_0x4ae2('0xb')]=_0x41cdf1;this[_0x4ae2('0xc')]=_0x4d3d8a;this['mailRpc']=_0x564ef9;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xe')]=function(_0x171449,_0xb70265){this['rpc'][_0x4ae2('0xf')](_0x171449)[_0x4ae2('0x10')](function(_0x4163ce){_0xb70265(null,_0x4163ce?_0x4163ce['name']:![]);})[_0x4ae2('0x11')](function(_0x22ac1e){_0xb70265(_0x22ac1e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x12')]=function(_0x24de98,_0x40954f){this[_0x4ae2('0xc')][_0x4ae2('0x13')](_0x24de98)[_0x4ae2('0x10')](function(_0x5e2bfd){_0x40954f(null,_0x5e2bfd?_0x5e2bfd['name']:![]);})['catch'](function(_0x2f3936){_0x40954f(_0x2f3936);});};AGIVertices[_0x4ae2('0xd')]['getSquareProject']=function(_0x463765,_0x9fb8db){this[_0x4ae2('0xc')][_0x4ae2('0x14')](_0x463765)[_0x4ae2('0x10')](function(_0x3b207c){_0x9fb8db(null,_0x3b207c?_0x3b207c[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x41b672){_0x9fb8db(_0x41b672);});};AGIVertices[_0x4ae2('0xd')]['getSquareOdbc']=function(_0x4a97af,_0x44a2d3){this[_0x4ae2('0xc')]['getSquareOdbcById'](_0x4a97af)[_0x4ae2('0x10')](function(_0x343db1){_0x44a2d3(null,_0x343db1?_0x343db1[_0x4ae2('0x16')]:![]);})[_0x4ae2('0x11')](function(_0x8732bb){_0x44a2d3(_0x8732bb);});};AGIVertices['prototype'][_0x4ae2('0x17')]=function(_0x53c686,_0x522165){this[_0x4ae2('0xc')][_0x4ae2('0x18')](_0x53c686)[_0x4ae2('0x10')](function(_0x17041e){_0x522165(null,_0x17041e?_0x17041e[_0x4ae2('0x15')]:![]);})['catch'](function(_0x1005e0){_0x522165(_0x1005e0);});};AGIVertices['prototype'][_0x4ae2('0x19')]=function(_0x12b5d2,_0x130239){this['rpc'][_0x4ae2('0x1a')](_0x12b5d2)[_0x4ae2('0x10')](function(_0x2454b3){_0x130239(null,_0x2454b3?_0x2454b3[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x255772){_0x130239(_0x255772);});};AGIVertices['prototype']['getSound']=function(_0x9508d7,_0x3030f8){var _0x3fa514=this;this[_0x4ae2('0xc')][_0x4ae2('0x1b')](_0x9508d7)[_0x4ae2('0x10')](function(_0x57a377){_0x3030f8(null,_0x57a377?_0x3fa514['getSoundPath'](_0x57a377[_0x4ae2('0x1c')]):![]);})['catch'](function(_0x554cff){_0x3030f8(_0x554cff);});};AGIVertices['prototype'][_0x4ae2('0x1d')]=function(_0x28bedd,_0x55fafd){this[_0x4ae2('0xc')][_0x4ae2('0x1e')](_0x28bedd)[_0x4ae2('0x10')](function(_0x146bc2){_0x55fafd(null,_0x146bc2?_0x146bc2:![]);})[_0x4ae2('0x11')](function(_0x23f954){_0x55fafd(_0x23f954);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1f')]=function(_0x2904f1,_0x3542df,_0x386687){this[_0x4ae2('0x20')][_0x4ae2('0x1f')](_0x2904f1,_0x3542df)[_0x4ae2('0x10')](function(){_0x386687(null);})[_0x4ae2('0x11')](function(_0x31017c){_0x386687(_0x31017c);});};AGIVertices[_0x4ae2('0xd')]['getIntervals']=function(_0xdcd11e,_0x516e8c){this[_0x4ae2('0xc')][_0x4ae2('0x21')](_0xdcd11e)['then'](function(_0x1516b8){if(_0x1516b8){if(_0x1516b8[_0x4ae2('0x22')]){_0x516e8c(null,[_0x1516b8[_0x4ae2('0x23')]]);}else{_0x516e8c(null,_[_0x4ae2('0x24')](_0x1516b8['Intervals'],_0x4ae2('0x23')));}}else{_0x516e8c(null,![]);}})[_0x4ae2('0x11')](function(_0x29458e){_0x516e8c(_0x29458e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x25')]=function(_0x142ce7){return util[_0x4ae2('0x26')](_0x4ae2('0x27'),FILES_PATH,_0x142ce7);};AGIVertices[_0x4ae2('0xd')]['getQueryOdbc']=function(_0x4275d5,_0x47ee5d,_0xe34b4c){odbc[_0x4ae2('0x28')](_0x4275d5,function(_0x2f566a){if(_0x2f566a){logger[_0x4ae2('0x29')](_0x4ae2('0x2a'),_0x2f566a);_0xe34b4c(_0x2f566a);}else{logger[_0x4ae2('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x4ae2('0x2c')](_0x47ee5d,function(_0x700f27,_0x20d755){if(_0x700f27){logger[_0x4ae2('0x2b')]('Error\x20executing\x20query\x20%s',_0x47ee5d);_0xe34b4c(_0x700f27);}else{logger[_0x4ae2('0x2b')](_0x4ae2('0x2d'),_0x47ee5d);odbc[_0x4ae2('0x2e')](function(_0x2a2dba){if(_0x2a2dba){logger[_0x4ae2('0x29')](_0x4ae2('0x2f'),_0x2a2dba);}_0xe34b4c(null,_0x20d755);});}});}});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x30')]=function(_0x1d5888,_0x1f4020){this[_0x4ae2('0xc')]['getSmsAccountById'](_0x1d5888)[_0x4ae2('0x10')](function(_0x3f0b3f){_0x1f4020(null,_0x3f0b3f?_0x3f0b3f:![]);})[_0x4ae2('0x11')](function(_0x1473e6){_0x1f4020(_0x1473e6);});};AGIVertices['prototype']['createSmsMessage']=function(_0xd46eed,_0x45527a){this[_0x4ae2('0xc')][_0x4ae2('0x31')](_0xd46eed)['then'](function(_0x3c0a56){_0x45527a(null,_0x3c0a56);})[_0x4ae2('0x11')](function(_0x5ca188){_0x45527a(_0x5ca188);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x32')]=function(_0x11a5d9,_0x5a9126,_0x2f6431){this[_0x4ae2('0xc')][_0x4ae2('0x32')]({'uniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'node':_0x11a5d9[_0x4ae2('0x34')],'application':_0x11a5d9[_0x4ae2('0x35')],'data':_0x5a9126||null,'project_name':this[_0x4ae2('0xb')]['arg_1'],'callerid':this[_0x4ae2('0xb')][_0x4ae2('0x36')]})['then'](function(_0x3d5015){if(_0x2f6431){_0x2f6431(null,_0x3d5015);}})[_0x4ae2('0x11')](function(_0x578b0e){if(_0x2f6431){_0x2f6431(_0x578b0e);}});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x37')]=function(_0x4e30ab,_0x21baf4,_0x2ab00f,_0x6ed809){this['rpc']['createSquareRecording']({'uniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'callerid':this[_0x4ae2('0xb')][_0x4ae2('0x36')],'calleridname':this['channel'][_0x4ae2('0x38')],'context':this[_0x4ae2('0xb')][_0x4ae2('0x39')],'extension':this['channel'][_0x4ae2('0x3a')],'priority':this[_0x4ae2('0xb')][_0x4ae2('0x3b')],'accountcode':this['channel'][_0x4ae2('0x3c')],'dnid':this[_0x4ae2('0xb')][_0x4ae2('0x3d')],'projectName':this[_0x4ae2('0xb')][_0x4ae2('0x3e')],'saveName':_0x21baf4,'filename':_0x4e30ab[_0x4ae2('0x3f')]||_0x21baf4,'savePath':_0x2ab00f})[_0x4ae2('0x10')](function(_0x2fe532){_0x6ed809(null,_0x2fe532);})[_0x4ae2('0x11')](function(_0xf6d12a){_0x6ed809(_0xf6d12a);});};AGIVertices['prototype'][_0x4ae2('0x40')]=function(_0x4a70c6,_0x10db30,_0x1c0898,_0x2292ec,_0x11a808){this[_0x4ae2('0xc')][_0x4ae2('0x40')]({'uniqueid':this['channel'][_0x4ae2('0x33')],'body':_0x4a70c6,'direction':_0x10db30,'providerName':_0x1c0898,'providerResponse':_0x2292ec})[_0x4ae2('0x10')](function(_0x57c9f4){if(_0x11a808){_0x11a808(null,_0x57c9f4);}})[_0x4ae2('0x11')](function(_0x3c5f8d){if(_0x11a808){_0x11a808(_0x3c5f8d);}});};AGIVertices['prototype'][_0x4ae2('0x41')]=function(_0x4d6560,_0x426d29){this['rpc'][_0x4ae2('0x41')]({'firstName':_[_0x4ae2('0x42')](_0x4d6560[_0x4ae2('0x15')])||_[_0x4ae2('0x43')](_0x4d6560[_0x4ae2('0x15')])?_0x4ae2('0x44')+Math[_0x4ae2('0x45')]():_0x4d6560[_0x4ae2('0x15')],'lastName':_[_0x4ae2('0x42')](_0x4d6560['lastName'])||_[_0x4ae2('0x43')](_0x4d6560[_0x4ae2('0x46')])?null:_0x4d6560[_0x4ae2('0x46')],'phone':_0x4d6560[_0x4ae2('0x47')],'ListId':_0x4d6560['list_id'],'scheduledat':_0x4d6560[_0x4ae2('0x48')],'callbackUniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x4d6560[_0x4ae2('0x48')][_0x4ae2('0x49')](),'priority':_0x4d6560[_0x4ae2('0x4a')]})[_0x4ae2('0x10')](function(_0x3cab08){_0x426d29(null,_0x3cab08);})[_0x4ae2('0x11')](function(_0x18a8e6){_0x426d29(_0x18a8e6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x4b')]=function(_0x53e815,_0x28d5bd){this['rpc'][_0x4ae2('0x4c')](_0x53e815)[_0x4ae2('0x10')](function(_0x28e7a8){_0x28d5bd(null,_0x28e7a8?_0x28e7a8[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x3d5b37){_0x28d5bd(_0x3d5b37);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x4d')]=function(_0x479156,_0x496f98,_0x33fb77){var _0x3ed1d5={'role':_0x4ae2('0x4e')};_0x3ed1d5[_0x479156]=this['channel']['callerid'];this[_0x4ae2('0xc')][_0x4ae2('0x4d')](_0x3ed1d5,_0x496f98,this[_0x4ae2('0xb')][_0x4ae2('0x33')])[_0x4ae2('0x10')](function(_0x4edaf3){_0x33fb77(null,_['isNil'](_0x4edaf3)?![]:!![]);})['catch'](function(_0x22501c){logger['error'](_0x22501c);_0x33fb77(null,![]);});};AGIVertices['prototype'][_0x4ae2('0x4f')]=function(_0x4e677f,_0x3efbaf){var _0x57df20={'role':_0x4ae2('0x4e')};_0x57df20[_0x4e677f]=this['channel'][_0x4ae2('0x36')];this['rpc'][_0x4ae2('0x4f')](_0x57df20)[_0x4ae2('0x10')](function(_0x3f46f3){_0x3efbaf(null,_[_0x4ae2('0x43')](_0x3f46f3)?![]:!![]);})[_0x4ae2('0x11')](function(_0x517494){logger['error'](_0x517494);_0x3efbaf(null,![]);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x50')]=function(_0x5103ef,_0x2ce4e0){var _0x29183d={'role':'agent'};_0x29183d[_0x5103ef]=this[_0x4ae2('0xb')][_0x4ae2('0x36')];this['rpc']['agentLogout'](_0x29183d)[_0x4ae2('0x10')](function(_0x42d994){_0x2ce4e0(null,_['isNil'](_0x42d994)?![]:!![]);})[_0x4ae2('0x11')](function(_0x449d5a){logger[_0x4ae2('0x29')](_0x449d5a);_0x2ce4e0(null,![]);});};AGIVertices[_0x4ae2('0xd')]['agentLogin']=function(_0xce7da,_0x2e4742){var _0x4c8b83={'role':_0x4ae2('0x4e')};_0x4c8b83[_0xce7da]=this[_0x4ae2('0xb')][_0x4ae2('0x36')];var _0x525cc5=_0xce7da!='internal'?util[_0x4ae2('0x26')]('%s/%s@from-sip/n',_0x4ae2('0x51'),this['channel'][_0x4ae2('0x36')]):undefined;this['rpc'][_0x4ae2('0x52')](_0x4c8b83,_0x525cc5)['then'](function(_0x17ab2f){_0x2e4742(null,_['isNil'](_0x17ab2f)?![]:!![]);})['catch'](function(_0x41873a){logger[_0x4ae2('0x29')](_0x41873a);_0x2e4742(null,![]);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x53')]=function(_0x44a298,_0x240a7a){sh[_0x4ae2('0x54')](_[_0x4ae2('0x55')](_0x44a298),function(_0x2d2acc,_0x977a24){var _0x38e296=_0x977a24[_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'');_0x240a7a(null,_0x38e296);});};AGIVertices['prototype'][_0x4ae2('0x57')]=function(_0x25a3d8,_0x2542b1){scripts[_0x4ae2('0x57')](_0x25a3d8['apiKey'],_0x25a3d8[_0x4ae2('0x58')]||'text',_0x25a3d8[_0x4ae2('0x59')],_0x25a3d8[_0x4ae2('0x5a')]||_0x4ae2('0x5b'),_0x25a3d8[_0x4ae2('0x5c')]||_0x4ae2('0x5d'),_0x25a3d8[_0x4ae2('0x5e')]||'MP3')[_0x4ae2('0x10')](function(_0x32194d){_0x2542b1(null,_0x32194d);})[_0x4ae2('0x11')](function(_0x59d612){_0x2542b1(_0x59d612);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x5f')]=function(_0x4082d4,_0x55c151){scripts[_0x4ae2('0x5f')](_0x4082d4[_0x4ae2('0x59')],_0x4082d4[_0x4ae2('0x60')]||'en',0x1)['then'](function(_0x2bb165){_0x55c151(null,_0x2bb165);})[_0x4ae2('0x11')](function(_0x662054){_0x55c151(_0x662054);});};AGIVertices[_0x4ae2('0xd')]['restAPI']=function(_0x390c71,_0x102cb8){var _0x411e0f={'uri':_0x390c71[_0x4ae2('0x61')],'method':_0x390c71[_0x4ae2('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x390c71[_0x4ae2('0x63')])===_0x4ae2('0x64')&&parseInt(_0x390c71['timeout'])>=0x1?parseInt(_0x390c71['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4ae2('0x65')]([_0x4ae2('0x66'),_0x4ae2('0x67')],_0x411e0f[_0x4ae2('0x62')][_0x4ae2('0x68')]())){try{_0x411e0f[_0x4ae2('0x69')]=_0x390c71['rawBody']?JSON[_0x4ae2('0x6a')](_0x390c71[_0x4ae2('0x9')]):{};}catch(_0x306c21){logger[_0x4ae2('0x29')](_0x4ae2('0x6b'),_0x306c21);}}try{_0x411e0f[_0x4ae2('0x6c')]=_0x390c71['rawHeaders']?JSON[_0x4ae2('0x6a')](_0x390c71[_0x4ae2('0x8')]):{};}catch(_0x2fa2d6){logger[_0x4ae2('0x29')](_0x4ae2('0x6d'),_0x2fa2d6);}if(_0x390c71[_0x4ae2('0x6e')]){try{var _0x5efbe9=require(_0x390c71['computedVariables'])[_0x4ae2('0x6f')](this,_0x411e0f);_0x411e0f[_0x4ae2('0x70')]=Mustache['render'](_0x390c71[_0x4ae2('0x61')],_0x5efbe9,{},['$$','$$']);if(_0x411e0f[_0x4ae2('0x6c')]){_0x411e0f[_0x4ae2('0x6c')]=JSON[_0x4ae2('0x6a')](Mustache[_0x4ae2('0x71')](JSON[_0x4ae2('0x72')](_0x411e0f[_0x4ae2('0x6c')]),_0x5efbe9,{},['$$','$$']));}if(_0x411e0f['body']){_0x411e0f[_0x4ae2('0x69')]=JSON[_0x4ae2('0x6a')](Mustache[_0x4ae2('0x71')](JSON[_0x4ae2('0x72')](_0x411e0f[_0x4ae2('0x69')]),_0x5efbe9,{},['$$','$$']));}}catch(_0x29b0d0){logger['error'](_0x4ae2('0x73'),_0x29b0d0);}}rp(_0x411e0f)[_0x4ae2('0x10')](function(_0x17f398){var _0x58474e={'statusCode':_0x17f398[_0x4ae2('0x74')]||0xc8,'statusMessage':_0x17f398['statusMessage']||'OK','headers':_0x17f398[_0x4ae2('0x6c')]||{},'body':_0x17f398[_0x4ae2('0x69')]||{}};_0x102cb8(null,_0x58474e);})[_0x4ae2('0x11')](function(_0x21fb2a){var _0x2b2577={'statusCode':_0x21fb2a['statusCode']||0x1f4,'statusMessage':_0x21fb2a[_0x4ae2('0x75')]||_0x4ae2('0x76'),'headers':_0x21fb2a[_0x4ae2('0x77')][_0x4ae2('0x6c')]||{},'body':_0x21fb2a['options'][_0x4ae2('0x69')]||{}};_0x102cb8(null,_0x2b2577);});};AGIVertices['prototype'][_0x4ae2('0x78')]=function(_0x356fd8,_0x4b7baf){scripts[_0x4ae2('0x78')](this[_0x4ae2('0xb')][_0x4ae2('0x33')],_0x356fd8[_0x4ae2('0x79')],_0x356fd8[_0x4ae2('0x59')],_0x356fd8[_0x4ae2('0x7a')]||'en')['then'](function(_0x2f97d7){_0x4b7baf(null,_0x2f97d7);})['catch'](function(_0x4a8d2c){_0x4b7baf(_0x4a8d2c);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x7b')]=function(_0x34855a,_0x1dd43c){scripts[_0x4ae2('0x7b')](this['channel']['uniqueid'],_0x34855a[_0x4ae2('0x7c')],_0x34855a[_0x4ae2('0x7d')],_0x34855a[_0x4ae2('0x7e')],_0x34855a[_0x4ae2('0x59')],_0x34855a[_0x4ae2('0x7f')]||'en')[_0x4ae2('0x10')](function(_0xa21d87){_0x1dd43c(null,_0xa21d87);})[_0x4ae2('0x11')](function(_0x5504d6){_0x1dd43c(_0x5504d6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x80')]=function(_0x1358e9,_0x45cf3f){scripts[_0x4ae2('0x80')](this[_0x4ae2('0xb')],_0x1358e9)[_0x4ae2('0x10')](function(_0x1deb7d){_0x45cf3f(null,_0x1deb7d);})[_0x4ae2('0x11')](function(_0x2d135b){_0x45cf3f(_0x2d135b);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x81')]=function(_0x2f9c83,_0x310f93){scripts[_0x4ae2('0x81')](_0x2f9c83[_0x4ae2('0x79')],_0x2f9c83[_0x4ae2('0x59')],_0x2f9c83['ispeech_tts_language']||_0x4ae2('0x5b'),_0x2f9c83[_0x4ae2('0x82')])[_0x4ae2('0x10')](function(_0x5d096e){_0x310f93(null,_0x5d096e);})['catch'](function(_0x381538){_0x310f93(_0x381538);});};AGIVertices[_0x4ae2('0xd')]['ispeechASR']=function(_0xf6f39c,_0x21c4ec,_0x5aa3f4){scripts[_0x4ae2('0x83')](_0x21c4ec,_0xf6f39c['key'],_0xf6f39c['ispeech_asr_language']||'en-US',this[_0x4ae2('0x84')](_0xf6f39c['model'])?_0xf6f39c[_0x4ae2('0x85')]:undefined)[_0x4ae2('0x10')](function(_0x616c8f){_0x5aa3f4(null,_0x616c8f);})[_0x4ae2('0x11')](function(_0x77ebb6){_0x5aa3f4(_0x77ebb6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x86')]=function(_0x26b5b6,_0x386c80){scripts['awsPolly'](_0x26b5b6[_0x4ae2('0x87')],_0x26b5b6[_0x4ae2('0x88')],_0x26b5b6[_0x4ae2('0x89')],_0x26b5b6[_0x4ae2('0x8a')]||'Amy',_0x26b5b6[_0x4ae2('0x59')],_0x26b5b6[_0x4ae2('0x8b')]||_0x4ae2('0x59'))['then'](function(_0x345792){_0x386c80(null,_0x345792);})[_0x4ae2('0x11')](function(_0x267ef5){_0x386c80(_0x267ef5);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x8c')]=function(_0x1a6d81,_0x1d8c55){scripts['awsLex'](this[_0x4ae2('0xb')][_0x4ae2('0x33')],_0x1a6d81[_0x4ae2('0x87')],_0x1a6d81[_0x4ae2('0x88')],_0x1a6d81[_0x4ae2('0x8d')],_0x1a6d81['text'],_0x1a6d81[_0x4ae2('0x8e')])[_0x4ae2('0x10')](function(_0x1ed168){_0x1d8c55(null,_0x1ed168);})['catch'](function(_0x3fc31b){_0x1d8c55(_0x3fc31b);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x8f')]=function(_0x40b840,_0x52521f,_0x3923e){scripts[_0x4ae2('0x8f')](_0x52521f,_0x40b840['key'],_0x40b840[_0x4ae2('0x90')]||_0x4ae2('0x5b'))['then'](function(_0x543524){_0x3923e(null,_0x543524);})[_0x4ae2('0x11')](function(_0x49d34e){_0x3923e(_0x49d34e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x91')]=function(_0x3dae41,_0x30c767,_0xa0be2c){scripts[_0x4ae2('0x91')](_0x30c767,_0x3dae41[_0x4ae2('0x92')],_0x3dae41['appsecret'],_0x3dae41['uri'])['then'](function(_0x114223){_0xa0be2c(null,_0x114223);})[_0x4ae2('0x11')](function(_0x5e74ef){_0xa0be2c(_0x5e74ef);});};AGIVertices['prototype'][_0x4ae2('0x93')]=function(_0x17e184){var _0x38b41b=_[_0x4ae2('0x65')](verticesWithRetry,_0x17e184[_0x4ae2('0x35')])?_0x17e184:_[_0x4ae2('0x94')](_0x17e184);for(var _0x5662e3 in _0x38b41b){if(_0x38b41b[_0x4ae2('0x95')](_0x5662e3)){if(_0x38b41b[_0x5662e3]&&_[_0x4ae2('0x96')](_0x38b41b[_0x5662e3])){if(_['includes'](recursiveMapAttributes,_0x5662e3)){_0x38b41b[_0x5662e3]=this[_0x4ae2('0x97')](_0x38b41b[_0x5662e3]);}else{_0x38b41b[_0x5662e3]=this['replaceAllVariables'](_0x38b41b[_0x5662e3]);}}}}return _0x38b41b;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x98')]=function(_0x300c2b){for(var _0x5590f5 in _0x300c2b){if(_0x300c2b[_0x4ae2('0x95')](_0x5590f5)){if(_[_0x4ae2('0x99')](_0x300c2b[_0x5590f5])){this[_0x4ae2('0x98')](_0x300c2b[_0x5590f5]);}else if(_[_0x4ae2('0x9a')](_0x300c2b[_0x5590f5])){for(var _0x44f785=0x0;_0x44f785<_0x300c2b[_0x5590f5]['length'];_0x44f785++){this[_0x4ae2('0x98')](_0x300c2b[_0x5590f5][_0x44f785]);}}else if(_[_0x4ae2('0x96')](_0x300c2b[_0x5590f5])){_0x300c2b[_0x5590f5]=this[_0x4ae2('0x9b')](_0x300c2b[_0x5590f5]);}}}};AGIVertices[_0x4ae2('0xd')]['saveRestApiResult']=function(_0x256ff6,_0x2a9530){for(var _0x33c27d in _0x256ff6){if(_0x256ff6[_0x4ae2('0x95')](_0x33c27d)){if(_['isPlainObject'](_0x256ff6[_0x33c27d])){if(!_[_0x4ae2('0x42')](_0x256ff6[_0x33c27d])){this['saveRestApiResult'](_0x256ff6[_0x33c27d],util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d));}}else if(_[_0x4ae2('0x9a')](_0x256ff6[_0x33c27d])){for(var _0xfe8aa8=0x0;_0xfe8aa8<_0x256ff6[_0x33c27d]['length'];_0xfe8aa8++){this[_0x4ae2('0x9d')](_0x256ff6[_0x33c27d][_0xfe8aa8],util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d+'['+_0xfe8aa8+']'));}}else{if(!_[_0x4ae2('0x43')](_0x256ff6[_0x33c27d])){this['channel']['setVariable'](util['format'](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d),_0x256ff6[_0x33c27d]);}}}}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x97')]=function(_0x1c9088){try{var _0x20ddd7=JSON['parse'](_0x1c9088);this[_0x4ae2('0x98')](_0x20ddd7);return JSON[_0x4ae2('0x72')](_0x20ddd7);}catch(_0x3b0bef){return this[_0x4ae2('0x9b')](_0x1c9088);}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x9b')]=function(_0x47e2f4){var _0xb79ba0=_0x47e2f4['split']('{');for(var _0x4d90e9=0x1;_0x4d90e9<_0xb79ba0[_0x4ae2('0x9e')];_0x4d90e9+=0x1){var _0xbe815b=_0xb79ba0[_0x4d90e9][_0x4ae2('0x9f')]('}');if(_0xbe815b[_0x4ae2('0x9e')]>0x1){_0x47e2f4=_0x47e2f4[_0x4ae2('0xa0')]('{'+_0xbe815b[0x0]+'}',this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0xbe815b[0x0])['extra']||_0xbe815b[0x0]);}}if(_0xb79ba0[_0x4ae2('0x9e')]===0x1){return _0x47e2f4[_0x4ae2('0x49')]();}return this[_0x4ae2('0x9b')](_0x47e2f4);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa1')]=function(_0x431bc3,_0xc0fa01){var _0x495a82=this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0x431bc3);if(_0x495a82[_0x4ae2('0xa2')]===-0x1){return _0x495a82;}logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0xa3'),_0xc0fa01,_0x495a82['extra']));return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0xc0fa01,_0x495a82['extra']);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x84')]=function(_0x32355b){return _0x32355b&&_0x32355b!=='0'&&_0x32355b!=='-1'&&_0x32355b!=='';};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa5')]=function(_0x2547ee){this[_0x4ae2('0x32')]['sync'](this,_0x2547ee,'-');_0x2547ee[_0x4ae2('0xa6')]=_0x2547ee[_0x4ae2('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa7')]=function(_0x49bc8c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xa8'),_0x49bc8c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x49bc8c[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}var _0x523624='\x22'+_0x49bc8c[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0x49bc8c[_0x4ae2('0x77')])){_0x523624+=','+_0x49bc8c[_0x4ae2('0x77')];}var _0x4938b6=this['channel']['exec'](_0x4ae2('0xab'),_0x523624);if(_0x4938b6[_0x4ae2('0xa2')]===-0x1){return _0x4938b6;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xac'),_0x523624));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xad')]=function(_0x31e955){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xae'),_0x31e955[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x31e955['grammar'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x585471=_0x31e955[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0x31e955[_0x4ae2('0x77')])){_0x585471+=','+_0x31e955['options'];}var _0x546573=this[_0x4ae2('0xb')]['exec'](_0x4ae2('0xb1'),_0x585471);if(_0x546573[_0x4ae2('0xa2')]===-0x1){return _0x546573;}var _0x120cbd=this[_0x4ae2('0xa1')]('RECOG_CONFIDENCE()',_0x4ae2('0xb2'));if(_0x120cbd[_0x4ae2('0xa2')]===-0x1){return _0x120cbd;}var _0x11396b=this[_0x4ae2('0xa1')](_0x4ae2('0xb3'),_0x4ae2('0xb4'));if(_0x11396b['result']===-0x1){return _0x11396b;}var _0x5a177d=this['getAndSetVariable'](_0x4ae2('0xb5'),_0x4ae2('0xb6'));if(_0x5a177d[_0x4ae2('0xa2')]===-0x1){return _0x5a177d;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0xb7'),_0x585471));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xb8')]=function(_0x2cd6da){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xb9'),_0x2cd6da[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xb8')]([_0x2cd6da[_0x4ae2('0xba')],_0x2cd6da['args']]);};AGIVertices['prototype'][_0x4ae2('0xbb')]=function(_0x451a76){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xbc'),_0x451a76[_0x4ae2('0x34')]));if(this['isConfigured'](_0x451a76['timeout'])){logger[_0x4ae2('0x2b')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x451a76[_0x4ae2('0x63')]));var _0x2329c6=this['channel'][_0x4ae2('0xbd')](_0x451a76['timeout']);if(_0x2329c6['result']===-0x1){return _0x2329c6;}}return this[_0x4ae2('0xb')][_0x4ae2('0xbb')]();};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xbe')]=function(_0x154b1c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xbf'),_0x154b1c['label']));if(!this[_0x4ae2('0x84')](_0x154b1c[_0x4ae2('0xc0')])){return this['channel'][_0x4ae2('0x29')](_0x154b1c,_0x4ae2('0xc1'));}_0x154b1c['scheduledAt']=moment();if(this['isConfigured'](_0x154b1c[_0x4ae2('0xc2')])){_0x154b1c[_0x4ae2('0x48')]=moment()['add'](_0x154b1c['delay'],'minutes');}if(!this[_0x4ae2('0x84')](_0x154b1c['callback_priority'])){_0x154b1c[_0x4ae2('0x4a')]=0x2;}this[_0x4ae2('0x41')][_0x4ae2('0x6f')](this,_0x154b1c);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xc3'),_0x154b1c[_0x4ae2('0x47')],_0x154b1c['list_id'],_0x154b1c[_0x4ae2('0x48')]));};AGIVertices['prototype'][_0x4ae2('0xc4')]=function(_0x1afc50){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xc5'),_0x1afc50['label']));var _0x31ddd4=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x1afc50[_0x4ae2('0xc6')],_0x1afc50[_0x4ae2('0x77')]);if(_0x31ddd4[_0x4ae2('0xa2')]===-0x1){return _0x31ddd4;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0xc7'),_0x1afc50[_0x4ae2('0xc6')],_0x1afc50[_0x4ae2('0x77')]));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xc8')]=function(_0xb86bf){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xb86bf['label']));if(!this[_0x4ae2('0x84')](_0xb86bf['text'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}var _0x39091a='\x22'+_0xb86bf[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0xb86bf['options'])){_0x39091a+=','+_0xb86bf[_0x4ae2('0x77')];}var _0x4be965=this[_0x4ae2('0xb')][_0x4ae2('0x54')]('MRCPSynth',_0x39091a);if(_0x4be965['result']===-0x1){return _0x4be965;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x39091a));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xc9')]=function(_0x46cde2){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xca'),_0x46cde2[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x46cde2[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xaa'));}var _0x4d5b69='\x22'+_0x46cde2[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0x46cde2['options'])){_0x4d5b69+=','+_0x46cde2[_0x4ae2('0x77')];}var _0xa5dfdd=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xab'),_0x4d5b69);if(_0xa5dfdd[_0x4ae2('0xa2')]===-0x1){return _0xa5dfdd;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xac'),_0x4d5b69));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xcb')]=function(_0x1fa114){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xcc'),_0x1fa114[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x1fa114['grammar'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x184c1c=_0x1fa114[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0x1fa114['options'])){_0x184c1c+=','+_0x1fa114[_0x4ae2('0x77')];}var _0x1689eb=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xb1'),_0x184c1c);if(_0x1689eb['result']===-0x1){return _0x1689eb;}var _0x42b50a=this[_0x4ae2('0xa1')](_0x4ae2('0xcd'),'LUMENVOX_ASR_CONFIDENCE');if(_0x42b50a[_0x4ae2('0xa2')]===-0x1){return _0x42b50a;}var _0x15bd95=this['getAndSetVariable']('RECOG_INPUT()',_0x4ae2('0xce'));if(_0x15bd95[_0x4ae2('0xa2')]===-0x1){return _0x15bd95;}var _0x35047a=this['getAndSetVariable']('RECOG_INSTANCE()',_0x4ae2('0xcf'));if(_0x35047a[_0x4ae2('0xa2')]===-0x1){return _0x35047a;}return this[_0x4ae2('0xb')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x184c1c));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xd0')]=function(_0xeea824){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xd1'),_0xeea824[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xeea824[_0x4ae2('0xb0')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x4fab5e=_0xeea824[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0xeea824['options'])){_0x4fab5e+=','+_0xeea824[_0x4ae2('0x77')];}var _0x29e5fa=this[_0x4ae2('0xb')][_0x4ae2('0x54')]('MRCPRecog',_0x4fab5e);if(_0x29e5fa[_0x4ae2('0xa2')]===-0x1){return _0x29e5fa;}var _0x1b934c=this['getAndSetVariable'](_0x4ae2('0xcd'),_0x4ae2('0xd2'));if(_0x1b934c[_0x4ae2('0xa2')]===-0x1){return _0x1b934c;}var _0x55a36e=this[_0x4ae2('0xa1')](_0x4ae2('0xb3'),_0x4ae2('0xd3'));if(_0x55a36e[_0x4ae2('0xa2')]===-0x1){return _0x55a36e;}var _0x302dfd=this[_0x4ae2('0xa1')](_0x4ae2('0xb5'),'SESTEK_ASR_INSTANCE');if(_0x302dfd[_0x4ae2('0xa2')]===-0x1){return _0x302dfd;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4fab5e));};AGIVertices[_0x4ae2('0xd')]['database']=function(_0x53bc7b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xd4'),_0x53bc7b[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x53bc7b[_0x4ae2('0xd5')])){return this[_0x4ae2('0xb')]['error'](_0x53bc7b,_0x4ae2('0xd6'));}var _0x9d1169=this[_0x4ae2('0xd7')][_0x4ae2('0x6f')](this,_0x53bc7b[_0x4ae2('0xd5')]);if(!_0x9d1169){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53bc7b,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x53bc7b[_0x4ae2('0x2c')])){return this[_0x4ae2('0xb')]['error'](_0x53bc7b,_0x4ae2('0xd8'));}var _0x1f4735=_0x53bc7b['query'][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('query:\x20%s',_0x1f4735));var _0x5008dd=this[_0x4ae2('0xd9')]['sync'](this,_0x9d1169,_0x1f4735);this[_0x4ae2('0x32')]['sync'](this,_0x53bc7b,_0x1f4735);if(!this[_0x4ae2('0x84')](_0x53bc7b[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xdb'));}var _0x2d2217=this['getVariable']['sync'](this,_0x53bc7b[_0x4ae2('0xda')]);if(!_0x2d2217){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53bc7b,_0x4ae2('0xdc'));}var _0x417a4d=this;_0x5008dd[_0x4ae2('0xdd')](function(_0x299add,_0x245e81){Object['keys'](_0x299add)[_0x4ae2('0xdd')](function(_0x119a3c){_0x417a4d[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0xde'),_0x2d2217,_0x245e81,_0x119a3c),_0x299add[_0x119a3c]);});});this['channel'][_0x4ae2('0xa4')](util['format'](_0x4ae2('0xdf'),_0x2d2217),_0x5008dd['length']);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xe0'),_0x2d2217));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xe1')]=function(_0x156da3){logger[_0x4ae2('0xe2')](util[_0x4ae2('0x26')](_0x4ae2('0xe3'),_0x156da3[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x156da3['sip_id'])){return this[_0x4ae2('0xb')]['error'](_0x156da3,_0x4ae2('0xe4'));}var _0x47f805=this[_0x4ae2('0x17')][_0x4ae2('0x6f')](this,_0x156da3[_0x4ae2('0xe5')]);if(!_0x47f805){return this['channel'][_0x4ae2('0x29')](_0x156da3,_0x4ae2('0xe6'));}var _0x588fb4=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xe7'),[util['format'](_0x4ae2('0xe8'),_0x47f805),_0x156da3[_0x4ae2('0x63')],_0x156da3[_0x4ae2('0xe9')],_0x156da3[_0x4ae2('0x61')]]);if(_0x588fb4[_0x4ae2('0xa2')]===-0x1){return _0x588fb4;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xea'),'DIAL'));};AGIVertices['prototype'][_0x4ae2('0xeb')]=function(_0x6cbfc7){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0xec'),_0x6cbfc7['label']));if(!this['isConfigured'](_0x6cbfc7[_0x4ae2('0x79')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xed'));}if(!this['isConfigured'](_0x6cbfc7[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this['channel'][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0x6cbfc7);this['createSquareMessage'](_0x6cbfc7[_0x4ae2('0x59')],'in','','');this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xef'),_0x6cbfc7['text']));var _0x2078ac=this[_0x4ae2('0x78')]['sync'](this,_0x6cbfc7);if(_0x2078ac){for(var _0x53eca8 in _0x2078ac){if(_0x2078ac[_0x4ae2('0x95')](_0x53eca8)){this['channel'][_0x4ae2('0xa4')](util['format']('DIALOGFLOW_%s',_0x53eca8[_0x4ae2('0x68')]()),_0x2078ac[_0x53eca8]);}}this['createSquareMessage'](_0x2078ac['speech'],_0x4ae2('0xf0'),_0x4ae2('0xeb'),'');return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Dialogflow\x20Result\x20%s',_0x2078ac[_0x4ae2('0xf1')]));}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x6cbfc7,_0x4ae2('0xf2'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xf3')]=function(_0x16b1f0){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xf4'),_0x16b1f0[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7c')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xf5'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7d')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xf6'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7e')])){return this[_0x4ae2('0xb')]['noop']('no\x20private_key\x20configured');}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7f')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xf7'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0x16b1f0);this[_0x4ae2('0x40')](_0x16b1f0['text'],'in','','');this['channel']['noop'](util[_0x4ae2('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x16b1f0['text']));var _0x52254f=this[_0x4ae2('0x7b')][_0x4ae2('0x6f')](this,_0x16b1f0);if(_0x52254f){for(var _0x41a737 in _0x52254f){if(_0x52254f['hasOwnProperty'](_0x41a737)){if(_0x41a737!==_0x4ae2('0xf8')){this[_0x4ae2('0xb')]['setVariable'](util[_0x4ae2('0x26')](_0x4ae2('0xf9'),_0x41a737[_0x4ae2('0x68')]()),_0x52254f[_0x41a737]);}}}this[_0x4ae2('0x40')](_0x52254f[_0x4ae2('0xf1')],_0x4ae2('0xf0'),_0x4ae2('0xf3'),_0x52254f['providerResponse']);return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xfa'),_0x52254f[_0x4ae2('0xf1')]));}return this['channel']['error'](_0x16b1f0,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x263345){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xfb'),_0x263345[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x263345['ndauth_url'])){return this['channel'][_0x4ae2('0xa9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4ae2('0x84')](_0x263345['username'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xfc'));}if(!this[_0x4ae2('0x84')](_0x263345['password'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20password\x20configured');}if(!this[_0x4ae2('0x84')](_0x263345['ndassistant_url'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this['createSquareDetailsReport'](_0x263345);this[_0x4ae2('0x40')](_0x263345[_0x4ae2('0x59')],'in','','');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Trying\x20SestekNDA:\x20%s',_0x263345[_0x4ae2('0x59')]));var _0x2f5760=this[_0x4ae2('0x80')]['sync'](this,_0x263345);if(_0x2f5760){for(var _0x470b66 in _0x2f5760){if(_0x2f5760[_0x4ae2('0x95')](_0x470b66)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0xfd'),_0x470b66['toUpperCase']()),_0x2f5760[_0x470b66]);}}this['createSquareMessage'](_0x2f5760[_0x4ae2('0xf1')],_0x4ae2('0xf0'),_0x4ae2('0xfe'),'');if(_0x2f5760[_0x4ae2('0xff')]){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x100'),_0x2f5760[_0x4ae2('0xff')]));var _0x2a2bbb=this[_0x4ae2('0xb')]['streamFile'](_0x2f5760['audiofile']);try{fs[_0x4ae2('0x101')](_0x2f5760[_0x4ae2('0xff')]+_0x4ae2('0x102'));}catch(_0x3acfc3){logger[_0x4ae2('0x29')](_0x3acfc3);}return _0x2a2bbb;}else{return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x103'),_0x2f5760[_0x4ae2('0xf1')]));}}return this[_0x4ae2('0xb')]['error'](_0x263345,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x104')]=function(_0x5072b9){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x105'),_0x5072b9[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xa9')]('end');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x106')]=function(_0x4c7a2b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4c7a2b['label']));var _0x46b6c0='';if(_0x4c7a2b['trunk_id']){if(!this[_0x4ae2('0x84')](_0x4c7a2b['trunk_id'])){return this['channel'][_0x4ae2('0x29')](_0x4c7a2b,_0x4ae2('0x107'));}else{var _0x14682e=parseInt(_0x4c7a2b[_0x4ae2('0x108')],0xa);if(isNaN(_0x14682e)){_0x46b6c0=_0x4c7a2b[_0x4ae2('0x108')];}else{_0x46b6c0=this['getTrunk'][_0x4ae2('0x6f')](this,_0x4c7a2b['trunk_id']);if(!_0x46b6c0){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4c7a2b,_0x4ae2('0x109'));}}}}else if(_0x4c7a2b['trunk_name']){_0x46b6c0=_0x4c7a2b[_0x4ae2('0x10a')];}else{return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4c7a2b,'no\x20trunk\x20selected');}var _0x3501a1=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xe7'),[util[_0x4ae2('0x26')](_0x4ae2('0x10b'),_0x46b6c0,_0x4c7a2b[_0x4ae2('0x47')]),_0x4c7a2b[_0x4ae2('0x63')],_0x4c7a2b[_0x4ae2('0xe9')],_0x4c7a2b[_0x4ae2('0x61')]]);if(_0x3501a1['result']===-0x1){return _0x3501a1;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xea'),_0x4ae2('0xe7')));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x10c')]=function(_0xee20b2){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x10d'),_0xee20b2[_0x4ae2('0x34')]));return this['channel']['noop'](_0x4ae2('0x10c'));};AGIVertices[_0x4ae2('0xd')]['getdigits']=function(_0x439add){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x439add[_0x4ae2('0x34')]));if(_0x439add[_0x4ae2('0xa6')]===0x0){return this[_0x4ae2('0xa5')](_0x439add);}_0x439add[_0x4ae2('0xa6')]-=0x1;if(!this[_0x4ae2('0x84')](_0x439add['file_id'])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x439add,_0x4ae2('0x10e'));}var _0x29a6de=this['getSound'][_0x4ae2('0x6f')](this,_0x439add[_0x4ae2('0x10f')]);if(!_0x29a6de){return this['channel']['error'](_0x439add,_0x4ae2('0x110'));}if(!this[_0x4ae2('0x84')](_0x439add['variable_id'])){return this['channel'][_0x4ae2('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2da93d=this[_0x4ae2('0xb')]['getData'](_0x29a6de,_0x439add[_0x4ae2('0x111')],_0x439add[_0x4ae2('0x112')]);var _0xf76740=_0x2da93d['result']?_0x2da93d[_0x4ae2('0xa2')]['toString']():'';logger[_0x4ae2('0x2b')](_0x4ae2('0x113'),JSON[_0x4ae2('0x72')](_0x2da93d));if(_0x2da93d[_0x4ae2('0xa2')]===-0x1){this[_0x4ae2('0x32')]['sync'](this,_0x439add,_0xf76740);return _0x2da93d;}else if(_0x2da93d[_0x4ae2('0x114')]==='timeout'){_0x2da93d[_0x4ae2('0xa2')]=_0xf76740[_0x4ae2('0x9e')]>=parseInt(_0x439add[_0x4ae2('0x115')])?'x':'i';}else{_0x2da93d[_0x4ae2('0xa2')]=_0xf76740['length']>=parseInt(_0x439add[_0x4ae2('0x115')])&&_0xf76740[_0x4ae2('0x9e')]<=parseInt(_0x439add[_0x4ae2('0x112')])?'x':'i';}var _0x550ccc=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x439add['variable_id']);if(!_0x550ccc){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x439add,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')]['setVariable'](_0x550ccc,_0xf76740);if(this[_0x4ae2('0x84')](_0x439add[_0x4ae2('0x116')])){var _0x1496f2=parseInt(_0x439add['hiddendigitsnum'],0xa);var _0x5a09ad=rs[_0x4ae2('0x117')]({'charset':'*','length':_0x1496f2});var _0x4836f9=_0xf76740[_0x4ae2('0x9e')];if(_0x4836f9>0x0){if(_0x4836f9>_0x1496f2){this[_0x4ae2('0x32')]['sync'](this,_0x439add,_0x439add[_0x4ae2('0x118')]===_0x4ae2('0x119')?_0x5a09ad+_0xf76740[_0x4ae2('0x11a')](_0x1496f2):_0xf76740[_0x4ae2('0x11a')](0x0,_0x4836f9-_0x1496f2)+_0x5a09ad);}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,rs[_0x4ae2('0x117')]({'charset':'*','length':_0x4836f9}));}}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,'');}}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,_0xf76740);}return _0x2da93d;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x11b')]=function(_0x570fba){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x11c'),_0x570fba[_0x4ae2('0x34')]));return this[_0x4ae2('0x11d')](_0x570fba);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x11e')]=function(_0x10137f){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x11f'),_0x10137f[_0x4ae2('0x34')]));this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x10137f,_0x10137f[_0x4ae2('0x120')]);return this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x121'),_0x10137f[_0x4ae2('0x120')]));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x122')]=function(_0x536d02){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x536d02['label']));if(!this[_0x4ae2('0x84')](_0x536d02[_0x4ae2('0x87')])||!this[_0x4ae2('0x84')](_0x536d02[_0x4ae2('0x88')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x123'));}if(!this['isConfigured'](_0x536d02[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x124'),_0x536d02[_0x4ae2('0x59')]));var _0xa80adc=this[_0x4ae2('0x86')]['sync'](this,_0x536d02);if(_0xa80adc){this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x125'),_0xa80adc));var _0xa7fd76=this[_0x4ae2('0xb')][_0x4ae2('0x126')](_0xa80adc);try{fs['unlink'](_0xa80adc+_0x4ae2('0x102'));}catch(_0x588c32){logger[_0x4ae2('0x29')](_0x588c32);}return _0xa7fd76;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x536d02,_0x4ae2('0x127'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x128')]=function(_0xda8e3c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xda8e3c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x87')])||!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x88')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0x123'));}if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x8e')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x129'));}if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x59')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0xda8e3c);this[_0x4ae2('0x40')](_0xda8e3c[_0x4ae2('0x59')],'in','','');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x12a'),_0xda8e3c[_0x4ae2('0x59')]));var _0x44dceb=this['awsLex'][_0x4ae2('0x6f')](this,_0xda8e3c);if(_0x44dceb){for(var _0x3b68c9 in _0x44dceb){if(_0x44dceb[_0x4ae2('0x95')](_0x3b68c9)&&_[_0x4ae2('0x96')](_0x44dceb[_0x3b68c9])){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x12b'),_0x3b68c9['toUpperCase']()),_0x44dceb[_0x3b68c9]);}}if(_[_0x4ae2('0x43')](_0x44dceb['message'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0x12c'));}else{this[_0x4ae2('0x40')](_0x44dceb[_0x4ae2('0x75')],_0x4ae2('0xf0'),'amazonlex','');return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x12d'),_0x44dceb[_0x4ae2('0x75')]));}}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0xda8e3c,_0x4ae2('0x12e'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x12f')]=function(_0x382cd4){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x130'),_0x382cd4[_0x4ae2('0x34')],_0x382cd4[_0x4ae2('0x63')]));if(!this['isConfigured'](_0x382cd4['key'])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xed'));}var _0x1e0828=_0x4ae2('0x131');var _0x421645=util[_0x4ae2('0x26')](_0x4ae2('0x132'),FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x467e67=util['format']('%s.%s',_0x421645,_0x1e0828);var _0x579a2b=!![];if(_0x382cd4[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x579a2b=![];}var _0x184123=this[_0x4ae2('0xb')][_0x4ae2('0x135')](_0x421645,_0x1e0828,_0x382cd4[_0x4ae2('0x136')],_0x382cd4[_0x4ae2('0x63')],undefined,_0x579a2b);if(_0x184123[_0x4ae2('0xa2')]!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('google\x20%s\x20file\x20created',_0x467e67));var _0x558c24=this[_0x4ae2('0x8f')]['sync'](this,_0x382cd4,_0x467e67);if(_0x558c24){for(var _0x1302ee in _0x558c24){if(_0x558c24[_0x4ae2('0x95')](_0x1302ee)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')]('GOOGLE_ASR_%s',_0x1302ee[_0x4ae2('0x68')]()),_0x558c24[_0x1302ee]);}}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x137'),JSON['stringify'](_0x558c24)));}}return _0x184123;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x138')]=function(_0x49d320){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x139'),_0x49d320[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x49d320[_0x4ae2('0x92')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x13a'));}if(!this[_0x4ae2('0x84')](_0x49d320['appsecret'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0x13b'));}var _0x4a9920=_0x4ae2('0x131');var _0x1faa75=util[_0x4ae2('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x47a654=util['format'](_0x4ae2('0x9c'),_0x1faa75,_0x4a9920);var _0x4f839c=!![];if(_0x49d320[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x4f839c=![];}var _0x1d30e1=this['channel'][_0x4ae2('0x135')](_0x1faa75,_0x4a9920,_0x49d320[_0x4ae2('0x136')],_0x49d320['timeout'],undefined,_0x4f839c);if(_0x1d30e1['result']!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x13c'),_0x47a654));var _0x1474ed=this[_0x4ae2('0x91')][_0x4ae2('0x6f')](this,_0x49d320,_0x47a654);if(_0x1474ed){for(var _0x5308f0 in _0x1474ed){if(_0x1474ed['hasOwnProperty'](_0x5308f0)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x13d'),_0x5308f0[_0x4ae2('0x68')]()),_0x1474ed[_0x5308f0]);}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x13e'),JSON[_0x4ae2('0x72')](_0x1474ed)));}}return _0x1d30e1;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x13f')]=function(_0x4263db){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4263db['label']));return this['channel'][_0x4ae2('0x140')](_0x4263db[_0x4ae2('0x39')],_0x4263db[_0x4ae2('0x3a')],_0x4263db['priority']);};AGIVertices[_0x4ae2('0xd')]['gotoif']=function(_0x13f45d){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x141'),_0x13f45d['label']));if(!this[_0x4ae2('0x84')](_0x13f45d[_0x4ae2('0x142')])){return this[_0x4ae2('0xb')]['error'](_0x13f45d,_0x4ae2('0x143'));}try{var _0x5664b2=eval(_0x13f45d[_0x4ae2('0x142')])?'true':_0x4ae2('0x144');this['channel']['noop'](util[_0x4ae2('0x26')](_0x4ae2('0x145'),_0x13f45d[_0x4ae2('0x142')],_0x5664b2));return{'code':0xc8,'result':_0x5664b2};}catch(_0x8bc4b2){return{'code':0xc8,'result':_0x4ae2('0x144')};}};AGIVertices[_0x4ae2('0xd')]['gotoiftime']=function(_0x18cd8f){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x146'),_0x18cd8f[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x18cd8f[_0x4ae2('0x147')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x18cd8f,'no\x20interval\x20configured');}var _0x2e89bd=this['getIntervals'][_0x4ae2('0x6f')](this,_0x18cd8f[_0x4ae2('0x147')]);if(!_0x2e89bd){return this['channel'][_0x4ae2('0x29')](_0x18cd8f,_0x4ae2('0x148'));}for(var _0x4787db=0x0;_0x4787db<_0x2e89bd[_0x4ae2('0x9e')];_0x4787db+=0x1){var _0x261a34=this['channel']['getVariable'](util['format'](_0x4ae2('0x149'),_0x2e89bd[_0x4787db]));if(_0x261a34[_0x4ae2('0xa2')]===-0x1){return _0x261a34;}logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x261a34['extra']));if(_0x261a34[_0x4ae2('0x114')]==='true'){logger['info'](util[_0x4ae2('0x26')]('IFTIME\x20%s\x20%s',_0x2e89bd[_0x4787db],_0x4ae2('0x14b')));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x4ae2('0x14b')));return{'code':0xc8,'result':_0x4ae2('0x14b')};}else{logger['info'](util['format'](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x4ae2('0x144')));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],'false'));}}return{'code':0xc8,'result':_0x4ae2('0x144')};};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x14c')]=function(_0x2d0a8a){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2d0a8a['label']));return this[_0x4ae2('0xb')][_0x4ae2('0x14c')]();};AGIVertices[_0x4ae2('0xd')]['ispeechasr']=function(_0x46fef6){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x14d'),_0x46fef6[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x46fef6['key'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xed'));}var _0x36dbed=_0x4ae2('0x131');var _0x3754fa=util[_0x4ae2('0x26')](_0x4ae2('0x132'),FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x2bf7c2=util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x3754fa,_0x36dbed);var _0x276a51=!![];if(_0x46fef6[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x276a51=![];}var _0x135819=this[_0x4ae2('0xb')]['recordFile'](_0x3754fa,_0x36dbed,_0x46fef6[_0x4ae2('0x136')],_0x46fef6[_0x4ae2('0x63')],undefined,_0x276a51);if(_0x135819['result']!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14e'),_0x2bf7c2));var _0x472755=this[_0x4ae2('0x83')]['sync'](this,_0x46fef6,_0x2bf7c2);if(_0x472755){for(var _0x5bc63d in _0x472755){if(_0x472755['hasOwnProperty'](_0x5bc63d)){this[_0x4ae2('0xb')]['setVariable'](util[_0x4ae2('0x26')]('ISPEECH_ASR_%s',_0x5bc63d[_0x4ae2('0x68')]()),_0x472755[_0x5bc63d]);}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14f'),JSON['stringify'](_0x472755)));}}return _0x135819;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x150')]=function(_0x53a2eb){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x151'),_0x53a2eb[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x53a2eb['key'])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xed'));}if(!this['isConfigured'](_0x53a2eb[_0x4ae2('0x59')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x152'),_0x53a2eb[_0x4ae2('0x59')]));var _0x5e7e96=this[_0x4ae2('0x81')][_0x4ae2('0x6f')](this,_0x53a2eb);if(_0x5e7e96){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14e'),_0x5e7e96));var _0x58de7a=this['channel'][_0x4ae2('0x126')](_0x5e7e96,_0x53a2eb[_0x4ae2('0x136')]);try{fs[_0x4ae2('0x101')](_0x5e7e96+_0x4ae2('0x102'));}catch(_0x35057a){logger[_0x4ae2('0x29')](_0x35057a);}return _0x58de7a;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53a2eb,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4ae2('0x153')]=function(_0x4d852c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x154'),_0x4d852c[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x4d852c[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4d852c,'no\x20find\x20by\x20configured');}logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x4d852c['findBy']));var _0x529d38=this[_0x4ae2('0x52')]['sync'](this,_0x4d852c[_0x4ae2('0x155')]);if(_0x529d38){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x157'),this[_0x4ae2('0xb')]['callerid'],_0x4d852c['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x4d852c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel'][_0x4ae2('0x36')],_0x4d852c['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel']['callerid'],_0x4d852c[_0x4ae2('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x4ae2('0x15a')]=function(_0x20473e){logger['info'](util[_0x4ae2('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x20473e[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x20473e[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x20473e,_0x4ae2('0x15b'));}logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));var _0x317c1b=this[_0x4ae2('0x50')][_0x4ae2('0x6f')](this,_0x20473e[_0x4ae2('0x155')]);if(_0x317c1b){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x19e861){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x19e861[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x19e861[_0x4ae2('0x15c')])){return this['channel'][_0x4ae2('0x29')](_0x19e861,_0x4ae2('0x15d'));}this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x15e'),_0x19e861['operation']));var _0x2b185a=eval(_0x19e861[_0x4ae2('0x15c')]);if(!this[_0x4ae2('0x84')](_0x19e861[_0x4ae2('0xda')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xdb'));}var _0x38a200=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x19e861[_0x4ae2('0xda')]);if(!_0x38a200){return this[_0x4ae2('0xb')]['error'](_0x19e861,_0x4ae2('0xdc'));}if(_['isArray'](_0x2b185a)){var _0x125036=this;_0x2b185a[_0x4ae2('0xdd')](function(_0x43eaee,_0x1ff72b){_0x125036[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x15f'),_0x38a200,_0x1ff72b),_0x43eaee);});return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('variable\x20%s[key]\x20set',_0x38a200));}else{return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x38a200,_0x2b185a);}};AGIVertices[_0x4ae2('0xd')]['menu']=function(_0x4944c0){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x160'),_0x4944c0['label']));if(_0x4944c0[_0x4ae2('0xa6')]===0x0){return this[_0x4ae2('0xa5')](_0x4944c0);}_0x4944c0[_0x4ae2('0xa6')]-=0x1;if(!this[_0x4ae2('0x84')](_0x4944c0[_0x4ae2('0x10f')])){return this[_0x4ae2('0xb')]['error'](_0x4944c0,_0x4ae2('0x10e'));}var _0x1b61e=this[_0x4ae2('0x161')][_0x4ae2('0x6f')](this,_0x4944c0[_0x4ae2('0x10f')]);if(!_0x1b61e){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4944c0,'no\x20file\x20audio\x20found');}var _0x33245a=this[_0x4ae2('0xb')][_0x4ae2('0x162')](_0x1b61e,_0x4944c0[_0x4ae2('0x111')],_0x4944c0[_0x4ae2('0x163')]);var _0x1376d9=_0x33245a['result'];if(_0x33245a[_0x4ae2('0xa2')]===-0x1){this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x4944c0,'-1');return _0x33245a;}else if(_0x33245a['extra']==='timeout'){_0x33245a['result']=_0x33245a['result']['length']>0x0?_0x33245a[_0x4ae2('0xa2')]:'t';}else if(_[_0x4ae2('0x42')](_0x33245a[_0x4ae2('0xa2')])){_0x33245a[_0x4ae2('0xa2')]='#';_0x1376d9='#';}if(!this[_0x4ae2('0x84')](_0x4944c0[_0x4ae2('0xda')])){this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x52d413=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x4944c0[_0x4ae2('0xda')]);if(!_0x52d413){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4944c0,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x52d413,_0x1376d9);}this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x4944c0,_0x1376d9);return _0x33245a;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa9')]=function(_0x259dfb){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x259dfb[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')]['noop'](_0x259dfb[_0x4ae2('0x164')]||_0x259dfb[_0x4ae2('0x34')]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x165')]=function(_0x322deb){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x166'),_0x322deb[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x322deb[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')]['error'](_0x322deb,_0x4ae2('0x15b'));}logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x322deb['findBy']));var _0x5442a1=this[_0x4ae2('0x4b')][_0x4ae2('0x6f')](this,_0x322deb[_0x4ae2('0x167')]);var _0x13fdd9=this[_0x4ae2('0x4d')][_0x4ae2('0x6f')](this,_0x322deb[_0x4ae2('0x155')],_0x5442a1);if(_0x13fdd9){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')]['callerid'],_0x322deb[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x168')};}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x169')]=function(_0x561dfc){logger[_0x4ae2('0x2b')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x561dfc['label']));if(!this[_0x4ae2('0x84')](_0x561dfc[_0x4ae2('0x10f')])){return this[_0x4ae2('0xb')]['error'](_0x561dfc,_0x4ae2('0x10e'));}var _0x9c6b89=this[_0x4ae2('0x161')][_0x4ae2('0x6f')](this,_0x561dfc[_0x4ae2('0x10f')]);if(!_0x9c6b89){return this[_0x4ae2('0xb')]['error'](_0x561dfc,'no\x20file\x20audio\x20found');}var _0x248fcd=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0x16a'),[_0x9c6b89,_0x561dfc[_0x4ae2('0xe9')]]);if(_0x248fcd[_0x4ae2('0xa2')]===-0x1){return _0x248fcd;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xc7'),_0x4ae2('0x16a'),_0x9c6b89));};AGIVertices['prototype'][_0x4ae2('0x16b')]=function(_0x4803b9){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x16c'),_0x4803b9[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x4803b9['queue_id'])){return this['channel'][_0x4ae2('0x29')](_0x4803b9,_0x4ae2('0x16d'));}var _0x3cc8d6='';var _0x508895=parseInt(_0x4803b9['queue_id'],0xa);if(isNaN(_0x508895)){_0x3cc8d6=_0x4803b9['queue_id'];}else{_0x3cc8d6=this[_0x4ae2('0x12')]['sync'](this,_0x4803b9['queue_id']);if(!_0x3cc8d6){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4803b9,_0x4ae2('0x16e'));}}var _0x5a6572='';if(this[_0x4ae2('0x84')](_0x4803b9[_0x4ae2('0x10f')])){var _0x311058=this[_0x4ae2('0x161')]['sync'](this,_0x4803b9[_0x4ae2('0x10f')]);if(_0x311058){_0x5a6572=_0x311058;}}this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x4803b9,_0x3cc8d6);if(_0x4803b9['opts']['indexOf']('x')<0x0){_0x4803b9[_0x4ae2('0xe9')]+='x';}if(_0x4803b9[_0x4ae2('0xe9')]['indexOf']('X')<0x0){_0x4803b9[_0x4ae2('0xe9')]+='X';}this[_0x4ae2('0xb')]['setVariable'](_0x4ae2('0x16f'),_0x3cc8d6?_0x3cc8d6[_0x4ae2('0x170')]():'');var _0x1dc8bf=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0x171'),[_0x3cc8d6,_0x4803b9[_0x4ae2('0xe9')],_0x4803b9[_0x4ae2('0x61')],_0x5a6572,_0x4803b9[_0x4ae2('0x63')],_0x4803b9[_0x4ae2('0xb8')],_0x4803b9['macro'],_0x4803b9[_0x4ae2('0x172')],'',_0x4803b9[_0x4ae2('0x173')]]);if(_0x1dc8bf['result']===-0x1){return _0x1dc8bf;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xc7'),_0x4ae2('0x171'),_0x3cc8d6));};AGIVertices['prototype'][_0x4ae2('0x174')]=function(_0x80bf5e){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x175'),_0x80bf5e[_0x4ae2('0x34')]));var _0x58d2a9=_0x80bf5e['recordingFormat']||_0x4ae2('0x131');var _0x54198e=util[_0x4ae2('0x26')]('%s_%s',this[_0x4ae2('0xb')][_0x4ae2('0x33')],rs[_0x4ae2('0x117')](0x5));var _0x1e4861=util[_0x4ae2('0x26')](_0x4ae2('0x176'),FILES_PATH,_0x54198e,_0x58d2a9);var _0x104d26=util['format'](_0x4ae2('0x132'),FILES_PATH,_0x54198e);this['createSquareRecording'][_0x4ae2('0x6f')](this,_0x80bf5e,_0x54198e,_0x1e4861);this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x4ae2('0x177'),_0x54198e);logger[_0x4ae2('0x2b')](_0x4ae2('0x178'),_0x104d26,_0x58d2a9,_0x80bf5e[_0x4ae2('0x179')],_0x80bf5e[_0x4ae2('0x63')]);return this[_0x4ae2('0xb')][_0x4ae2('0x135')](_0x104d26,_0x58d2a9,_0x80bf5e[_0x4ae2('0x179')],_0x80bf5e[_0x4ae2('0x63')],undefined,!![]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x17a')]=function(_0x21f044){logger['info'](util['format'](_0x4ae2('0x17b'),_0x21f044['label']));if(!this[_0x4ae2('0x84')](_0x21f044['url'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x17c'));}var _0x1094e8=this[_0x4ae2('0x17d')]['sync'](this,_0x21f044);logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Response:',util['inspect'](_0x1094e8,{'showHidden':![],'depth':null})));if(!this[_0x4ae2('0x84')](_0x21f044[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x17e'));}var _0x38b1f5=this['getVariable'][_0x4ae2('0x6f')](this,_0x21f044[_0x4ae2('0xda')]);if(!_0x38b1f5){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x21f044,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x17f'),_0x38b1f5),_0x1094e8[_0x4ae2('0x74')]?_0x1094e8[_0x4ae2('0x74')]:_0x4ae2('0x180'));this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x181'),_0x38b1f5),_0x1094e8[_0x4ae2('0x182')]?_0x1094e8['statusMessage']:'OK');if(_0x1094e8[_0x4ae2('0x69')]){try{this['saveRestApiResult'](_0x1094e8[_0x4ae2('0x69')],_0x38b1f5);}catch(_0x5a0f10){logger[_0x4ae2('0x29')](util[_0x4ae2('0x26')](_0x4ae2('0x183'),_0x38b1f5));}}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')]('variable\x20%s\x20set',_0x38b1f5));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x184')]=function(_0x4458fc){logger['info'](util['format'](_0x4ae2('0x185'),_0x4458fc['label']));return this[_0x4ae2('0xb')][_0x4ae2('0x186')](_0x4458fc[_0x4ae2('0x187')][_0x4ae2('0x56')](/\s+/g,''),_0x4458fc['escape_digits']);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x188')]=function(_0x435836){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x189'),_0x435836[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')][_0x4ae2('0x18a')](_0x435836[_0x4ae2('0x64')][_0x4ae2('0x56')](/\s+/g,''),_0x435836[_0x4ae2('0x179')]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x18b')]=function(_0x388f7b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x18c'),_0x388f7b[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')][_0x4ae2('0x18d')](_0x388f7b['text'],_0x388f7b[_0x4ae2('0x179')]);};AGIVertices['prototype'][_0x4ae2('0x18e')]=function(_0x469fe8){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x18f'),_0x469fe8['label']));if(!this[_0x4ae2('0x84')](_0x469fe8[_0x4ae2('0x190')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20mail\x20account\x20configured');}var _0x2c7551=this['getMailAccount'][_0x4ae2('0x6f')](this,_0x469fe8[_0x4ae2('0x190')]);if(!_0x2c7551||!_0x2c7551['Smtp']){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x469fe8,'no\x20mail\x20account\x20found');}var _0x1bee4f={'from':util['format'](_0x4ae2('0x191'),_0x2c7551['name'],_0x2c7551[_0x4ae2('0x192')]||_0x2c7551[_0x4ae2('0x193')][_0x4ae2('0x194')]),'to':_0x469fe8['to']||'','cc':_0x469fe8['cc']||'','bcc':_0x469fe8[_0x4ae2('0x195')]||'','subject':_0x469fe8[_0x4ae2('0x196')],'html':_0x469fe8[_0x4ae2('0x59')],'text':_0x469fe8['text']};if(this[_0x4ae2('0x84')](_0x469fe8['template_id'])){}logger[_0x4ae2('0xe2')](_0x4ae2('0x197'),JSON[_0x4ae2('0x72')](_0x1bee4f));this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x469fe8,_0x469fe8[_0x4ae2('0x190')]);this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x198'),_0x2c7551[_0x4ae2('0x15')]));this[_0x4ae2('0x1f')][_0x4ae2('0x6f')](this,_0x2c7551[_0x4ae2('0x199')],_0x1bee4f);return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0x19a'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x19b')]=function(_0x334188){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x19c'),_0x334188[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x19d')]=function(_0x5d2a55){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x19e'),_0x5d2a55[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x5d2a55[_0x4ae2('0x19f')])){return this['channel'][_0x4ae2('0xa9')]('no\x20sms\x20account\x20configured');}var _0x386ba1=this['getSmsAccount'][_0x4ae2('0x6f')](this,_0x5d2a55[_0x4ae2('0x19f')]);if(!_0x386ba1){return this[_0x4ae2('0xb')]['error'](_0x5d2a55,_0x4ae2('0x1a0'));}var _0x5ded5d={'body':_0x5d2a55[_0x4ae2('0x1a1')],'phone':_0x5d2a55['to']||'','SmsAccountId':_0x386ba1['id']};logger[_0x4ae2('0xe2')](_0x4ae2('0x1a2'),JSON['stringify'](_0x5ded5d));this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x5d2a55,_0x5d2a55[_0x4ae2('0x19f')]);this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1a3'),_0x386ba1['name']));this[_0x4ae2('0x31')][_0x4ae2('0x6f')](this,_0x5ded5d);return this[_0x4ae2('0xb')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1a4')]=function(_0x4deeb9){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4deeb9['label']));if(!this[_0x4ae2('0x84')](_0x4deeb9[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4deeb9,_0x4ae2('0x1a5'));}var _0x5150be=this['getVariable'][_0x4ae2('0x6f')](this,_0x4deeb9[_0x4ae2('0xda')]);if(!_0x5150be){return this['channel']['error'](_0x4deeb9,_0x4ae2('0xdc'));}return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x5150be,_0x4deeb9[_0x4ae2('0x1a6')]);};AGIVertices['prototype']['start']=function(_0x23aece){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1a7'),_0x23aece['label']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x1a8'));var _0x3f70ee=this[_0x4ae2('0xb')]['getVariable'](_0x4ae2('0x1a9'));if(!_[_0x4ae2('0x42')](_0x3f70ee[_0x4ae2('0x114')])){this['channel'][_0x4ae2('0x33')]=_0x3f70ee['extra'];}if(_0x23aece[_0x4ae2('0xbb')]===_0x4ae2('0x1aa')){this['channel']['noop']('Answer');return this[_0x4ae2('0xb')][_0x4ae2('0xbb')]();}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x4ae2('0x1ab')]=function(_0xcf8b3d){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x1ac'),_0xcf8b3d[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xcf8b3d[_0x4ae2('0x1ad')])){return this[_0x4ae2('0xb')]['error'](_0xcf8b3d,_0x4ae2('0x1ae'));}var _0x4f05bf=this[_0x4ae2('0x1af')]['sync'](this,_0xcf8b3d[_0x4ae2('0x1ad')]);if(!this[_0x4ae2('0x84')](_0x4f05bf)){return this[_0x4ae2('0xb')]['error'](_0xcf8b3d,util[_0x4ae2('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xcf8b3d[_0x4ae2('0x1ad')]));}if(_0x4f05bf===this[_0x4ae2('0xb')][_0x4ae2('0x3e')]){return this['channel'][_0x4ae2('0x29')](_0xcf8b3d,_0x4ae2('0x1b0'));}this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0xcf8b3d,_0x4f05bf);var _0x467954=this['channel'][_0x4ae2('0x54')](_0x4ae2('0x1b1'),util[_0x4ae2('0x26')](_0x4ae2('0x1b2'),config['agi'][_0x4ae2('0x1b3')]||_0x4ae2('0x1b4'),_0x4f05bf,this[_0x4ae2('0xb')][_0x4ae2('0x3e')]));if(_0x467954['result']===-0x1){return _0x467954;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x4f05bf));};AGIVertices['prototype']['system']=function(_0x9fb5c1){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1b5'),_0x9fb5c1[_0x4ae2('0x34')]));var _0x5dee4e=this['shellCommand'][_0x4ae2('0x6f')](this,_0x9fb5c1[_0x4ae2('0xba')]);this[_0x4ae2('0x32')]['sync'](this,_0x9fb5c1,_0x9fb5c1['command']);if(this['isConfigured'](_0x9fb5c1[_0x4ae2('0xda')])){var _0x29f26f=this['getVariable'][_0x4ae2('0x6f')](this,_0x9fb5c1[_0x4ae2('0xda')]);if(_0x29f26f){this['channel'][_0x4ae2('0xa4')](_0x29f26f,_0x5dee4e);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1b6'),_0x9fb5c1[_0x4ae2('0xba')],_0x29f26f));}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1b7'),_0x9fb5c1[_0x4ae2('0xba')]));};AGIVertices[_0x4ae2('0xd')]['google_cloud_tts']=function(_0x3ed83f){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1b8'),_0x3ed83f[_0x4ae2('0x34')]));_0x3ed83f[_0x4ae2('0x59')]=_0x3ed83f[_0x4ae2('0x59')][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4ae2('0x84')](_0x3ed83f['apiKey'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x1b9'));}if(!this['isConfigured'](_0x3ed83f[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1ba'),_0x3ed83f[_0x4ae2('0x59')]));var _0x2c5df2=this[_0x4ae2('0x57')][_0x4ae2('0x6f')](this,_0x3ed83f);if(_0x2c5df2){this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0x1bb'),_0x2c5df2));var _0x18c6c2=this['channel'][_0x4ae2('0x126')](_0x2c5df2);try{fs[_0x4ae2('0x101')](_0x2c5df2+_0x4ae2('0x102'));}catch(_0x2e5cc1){logger[_0x4ae2('0x29')](_0x2e5cc1);}return _0x18c6c2;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x3ed83f,_0x4ae2('0x1bc'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1bd')]=function(_0x9f0cbb){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1be'),_0x9f0cbb[_0x4ae2('0x34')]));_0x9f0cbb[_0x4ae2('0x59')]=_0x9f0cbb[_0x4ae2('0x59')][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x9f0cbb[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1bf'),_0x9f0cbb['text']));var _0x2e30af=this[_0x4ae2('0x5f')][_0x4ae2('0x6f')](this,_0x9f0cbb);if(_0x2e30af){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1c0'),_0x2e30af));var _0x12da42=this[_0x4ae2('0xb')]['streamFile'](_0x2e30af);try{fs[_0x4ae2('0x101')](_0x2e30af+'.wav');}catch(_0x3d1652){logger[_0x4ae2('0x29')](_0x3d1652);}return _0x12da42;}return this[_0x4ae2('0xb')]['error'](_0x9f0cbb,_0x4ae2('0x1c1'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1c2')]=function(_0x33e86c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c3'),_0x33e86c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x33e86c[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x33e86c,_0x4ae2('0x15b'));}logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x156'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));var _0x18e2ce=this[_0x4ae2('0x4f')][_0x4ae2('0x6f')](this,_0x33e86c['findBy']);if(_0x18e2ce){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')]['callerid'],_0x33e86c[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel']['callerid'],_0x33e86c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x168')};}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1c4')]=function(_0x5b524c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c5'),_0x5b524c[_0x4ae2('0x34')]));var _0x922fa7=this[_0x4ae2('0xb')]['exec'](_0x4ae2('0x1c6'),[_0x5b524c[_0x4ae2('0x1c7')],_0x5b524c[_0x4ae2('0x77')]]);if(_0x922fa7[_0x4ae2('0xa2')]===-0x1){return _0x922fa7;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xc7'),_0x4ae2('0x1c6'),_0x5b524c[_0x4ae2('0x1c7')]));};AGIVertices[_0x4ae2('0xd')]['vswitch']=function(_0x20191a){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c8'),_0x20191a[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x20191a['variable_id'])){return this['channel'][_0x4ae2('0x29')](_0x20191a,_0x4ae2('0x1a5'));}var _0x4053b0=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x20191a[_0x4ae2('0xda')]);if(!_0x4053b0){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x20191a,'no\x20variable\x20found');}var _0x36a91d=this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0x4053b0);return{'code':0xc8,'result':_0x36a91d[_0x4ae2('0x114')]?_0x36a91d[_0x4ae2('0x114')]:'-'};};String[_0x4ae2('0xd')][_0x4ae2('0xa0')]=function(_0x190c04,_0x50d868){return this[_0x4ae2('0x9f')](_0x190c04)['join'](_0x50d868);};module[_0x4ae2('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index de698b3..d6af072 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 _0x81f4=['isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','channels','queue','ACW','mandatoryDispositionPause','name','Action','agents','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','startAcw','linkedid'];(function(_0x156ae4,_0x5ce5af){var _0x282e46=function(_0x2e0372){while(--_0x2e0372){_0x156ae4['push'](_0x156ae4['shift']());}};_0x282e46(++_0x5ce5af);}(_0x81f4,0x19e));var _0x481f=function(_0x63c002,_0x55cbab){_0x63c002=_0x63c002-0x0;var _0x30e206=_0x81f4[_0x63c002];return _0x30e206;};'use strict';var _=require(_0x481f('0x0'));var moment=require(_0x481f('0x1'));var ami=require(_0x481f('0x2'));var logger=require(_0x481f('0x3'))(_0x481f('0x4'));var RpcUser=require(_0x481f('0x5'));var RpcVoiceAgentReport=require(_0x481f('0x6'));function Acw(_0x2a943a){this[_0x481f('0x7')]=_0x2a943a[_0x481f('0x7')];this['agents']=_0x2a943a['agents'];this[_0x481f('0x8')]=_0x2a943a[_0x481f('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x481f('0x9')]['bind'](this));ami['on'](_0x481f('0xa'),this[_0x481f('0xb')][_0x481f('0xc')](this));ami['on'](_0x481f('0xd'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x481f('0xc')](this));ami['on'](_0x481f('0xe'),this[_0x481f('0xf')][_0x481f('0xc')](this));ami['on']('blindtransfer',this[_0x481f('0x10')][_0x481f('0xc')](this));ami['on'](_0x481f('0x11'),this[_0x481f('0x12')][_0x481f('0xc')](this));}function getDiff(_0x1a63f1){var _0x4efbbb=moment()[_0x481f('0x13')](0x0);var _0x5d3f46=moment(_0x1a63f1)['milliseconds'](0x0);return _0x4efbbb['diff'](_0x5d3f46,_0x481f('0x14'));}Acw[_0x481f('0x15')][_0x481f('0x16')]=function(_0x164d0c,_0x38750f){var _0x4ff4b0=this;var _0x294ba2=getDiff(_0x4ff4b0['timers'][_0x164d0c]['lastPauseAt']);clearTimeout(_0x4ff4b0[_0x481f('0x8')][_0x164d0c][_0x481f('0x17')]);_0x4ff4b0['timers'][_0x164d0c][_0x481f('0x17')]=![];return RpcVoiceAgentReport[_0x481f('0x18')]({'acwtime':_0x294ba2},_0x4ff4b0[_0x481f('0x8')][_0x164d0c][_0x481f('0x19')],_0x164d0c)[_0x481f('0x1a')](function(_0x21c23f){logger[_0x481f('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x38750f,_0x294ba2,_0x21c23f);})[_0x481f('0x1c')](function(_0x31b0e9){logger[_0x481f('0x1d')](_0x481f('0x1e'),_0x38750f,_0x31b0e9);})[_0x481f('0x1f')](function(){delete _0x4ff4b0[_0x481f('0x8')][_0x164d0c];});};Acw[_0x481f('0x15')]['startAcw']=function(_0x369661){try{var _0x4794c1=this;var _0x4a18a7=this[_0x481f('0x20')][_0x369661]['interface'];var _0x361e9c=this[_0x481f('0x20')][_0x369661][_0x481f('0x21')];var _0x406d17=this[_0x481f('0x7')][_0x361e9c];var _0x1e5632=![];var _0x5f3734=_0x481f('0x22');if(_0x406d17['mandatoryDisposition']&&_0x406d17['mandatoryDispositionPause']['name']){_0x1e5632=!![];_0x5f3734=_0x406d17[_0x481f('0x23')][_0x481f('0x24')];}return ami[_0x481f('0x25')]({'action':'QueuePause','interface':_0x4a18a7,'paused':!![],'reason':_0x5f3734})[_0x481f('0x1a')](function(){if(_0x4794c1[_0x481f('0x26')][_0x4a18a7]){return RpcUser[_0x481f('0x27')](_0x4794c1[_0x481f('0x26')][_0x4a18a7]['id'])[_0x481f('0x1a')](function(_0x3ed43e){if(!_0x3ed43e||_0x3ed43e[_0x481f('0x28')]){logger['info'](_0x481f('0x29'),_0x369661,_0x4a18a7,_0x361e9c);return;}logger[_0x481f('0x1b')](_0x481f('0x2a'),_0x369661,_0x4a18a7,_0x361e9c);var _0x3880cd=_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2b')]&&_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2c')]?_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2c')]:_0x369661;return RpcUser['savePause'](_0x4794c1[_0x481f('0x26')][_0x4a18a7],_0x5f3734,_0x3880cd)[_0x481f('0x1a')](function(_0x19b856){_0x4794c1[_0x481f('0x7')][_0x361e9c][_0x481f('0x2d')]-=0x1;_0x4794c1[_0x481f('0x7')][_0x361e9c]['paused']+=0x1;return _0x19b856;});})['then'](function(_0x1e6ecc){if(_0x1e5632||!_0x1e6ecc){return;}_0x4794c1[_0x481f('0x8')][_0x4a18a7]={};logger[_0x481f('0x1b')](_0x481f('0x2e'),_0x369661,_0x4794c1[_0x481f('0x7')][_0x361e9c]['acwTimeout'],_0x4a18a7,_0x361e9c);_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x17')]=setTimeout(_0x4794c1[_0x481f('0x2f')][_0x481f('0xc')](_0x4794c1,_0x4a18a7),_0x4794c1[_0x481f('0x7')][_0x361e9c][_0x481f('0x30')]*0x3e8);_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x31')]=moment()['format'](_0x481f('0x32'));_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x19')]=_0x369661;_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x21')]=_0x361e9c;_0x4794c1['timers'][_0x4a18a7][_0x481f('0x16')]=_0x4794c1[_0x481f('0x16')]['bind'](_0x4794c1,_0x4a18a7,_0x369661);});}})['catch'](function(){logger[_0x481f('0x1d')](_0x481f('0x2e'),_0x369661,_0x4794c1[_0x481f('0x7')][_0x361e9c]['acwTimeout'],_0x4a18a7,_0x361e9c);})[_0x481f('0x1f')](function(){delete _0x4794c1['channels'][_0x369661];});}catch(_0x1673f7){logger[_0x481f('0x1d')]('[ACW][START]\x20%s',_0x1673f7[_0x481f('0x33')]);}};Acw['prototype']['stopAcw']=function(_0x18d8b9){try{var _0x27054d=this;if(_0x27054d['timers'][_0x18d8b9]){_0x27054d[_0x481f('0x8')][_0x18d8b9]['timer']=![];var _0x538cd7=_0x27054d['timers'][_0x18d8b9][_0x481f('0x19')];var _0x4394f0=_0x27054d[_0x481f('0x8')][_0x18d8b9][_0x481f('0x21')];var _0x1e23f0=_0x27054d[_0x481f('0x7')][_0x4394f0][_0x481f('0x30')];logger[_0x481f('0x1b')]('[%s][TIMER][STOP][AGENT:%s]',_0x538cd7,_0x18d8b9);RpcUser[_0x481f('0x27')](this[_0x481f('0x26')][_0x18d8b9]['id'])['then'](function(_0x107d1e){if(_0x107d1e['pauseType']===_0x481f('0x22')){return RpcUser[_0x481f('0x34')](_0x27054d['agents'][_0x18d8b9]);}});RpcVoiceAgentReport['update']({'acwtime':_0x1e23f0,'agentacw':!![]},_0x538cd7,_0x18d8b9)['then'](function(_0x30ef2e){logger[_0x481f('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x538cd7,_0x1e23f0,_0x30ef2e);})[_0x481f('0x1c')](function(_0x2156f4){logger[_0x481f('0x1d')](_0x481f('0x1e'),_0x538cd7,_0x2156f4);});}else{logger['error'](_0x481f('0x35'),_0x18d8b9);if(_0x27054d[_0x481f('0x8')]){logger[_0x481f('0x1b')](_0x481f('0x36'),JSON['stringify'](_0x27054d[_0x481f('0x8')]));}}}catch(_0x2aceae){logger[_0x481f('0x1d')]('[ACW][STOP]\x20%s',_0x2aceae[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x9')]=function(_0x1e29ce){try{if(this[_0x481f('0x7')][_0x1e29ce[_0x481f('0x21')]]&&(this['voiceQueues'][_0x1e29ce[_0x481f('0x21')]][_0x481f('0x4')]||this['voiceQueues'][_0x1e29ce[_0x481f('0x21')]][_0x481f('0x37')])){if(this[_0x481f('0x26')][_0x1e29ce[_0x481f('0x38')]]){this['channels'][_0x1e29ce[_0x481f('0x19')]]={'queue':_0x1e29ce[_0x481f('0x21')],'interface':_0x1e29ce[_0x481f('0x38')],'destlinkedid':_0x1e29ce[_0x481f('0x2c')]};}}}catch(_0x459b67){logger[_0x481f('0x1d')](_0x481f('0x39'),_0x459b67[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x12')]=function(_0xa368e4){try{if(this[_0x481f('0x7')][_0xa368e4[_0x481f('0x21')]]&&(this[_0x481f('0x7')][_0xa368e4[_0x481f('0x21')]][_0x481f('0x4')]||this['voiceQueues'][_0xa368e4[_0x481f('0x21')]][_0x481f('0x37')])){if(this['agents'][_0xa368e4['interface']]){this[_0x481f('0x20')][_0xa368e4[_0x481f('0x19')]]={'queue':_0xa368e4[_0x481f('0x21')],'interface':_0xa368e4['interface']};}}}catch(_0x47bbb8){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x47bbb8['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x1b69c5){try{if(this['channels'][_0x1b69c5['uniqueid']]&&_['isUndefined'](this[_0x481f('0x20')][_0x1b69c5[_0x481f('0x19')]][_0x481f('0x2b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x1b69c5['uniqueid']);this[_0x481f('0x3a')](_0x1b69c5[_0x481f('0x19')]);}else if(this['channels'][_0x1b69c5[_0x481f('0x3b')]]&&_[_0x481f('0x3c')](this[_0x481f('0x20')][_0x1b69c5['linkedid']][_0x481f('0x2b')])){logger[_0x481f('0x1b')](_0x481f('0x3d'),_0x1b69c5[_0x481f('0x3b')]);this[_0x481f('0x3a')](_0x1b69c5[_0x481f('0x3b')]);}}catch(_0x1494d1){logger[_0x481f('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x1494d1[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['syncHangup']=function(_0x1a7aeb){try{if(this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x19')]]&&this[_0x481f('0x20')][_0x1a7aeb['uniqueid']][_0x481f('0x2b')]){logger[_0x481f('0x1b')](_0x481f('0x3e'),_0x1a7aeb['uniqueid']);this['startAcw'](_0x1a7aeb[_0x481f('0x19')]);}else if(this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x3b')]]&&this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x3b')]][_0x481f('0x2b')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1a7aeb[_0x481f('0x3b')]);this[_0x481f('0x3a')](_0x1a7aeb['linkedid']);}}catch(_0x431a0e){logger[_0x481f('0x1d')]('[ACW][syncHangup]\x20%s',_0x431a0e[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['syncAttendedTransfer']=function(_0x1731cf){try{if(!_[_0x481f('0x3f')](this[_0x481f('0x20')][_0x1731cf[_0x481f('0x40')]])){this[_0x481f('0x3a')](_0x1731cf[_0x481f('0x40')]);if(this[_0x481f('0x20')][_0x1731cf[_0x481f('0x41')]]){this[_0x481f('0x20')][_0x1731cf[_0x481f('0x41')]][_0x481f('0x2b')]=!![];this[_0x481f('0x20')][_0x1731cf[_0x481f('0x42')]]=this[_0x481f('0x20')][_0x1731cf['secondtransfereruniqueid']];this[_0x481f('0x43')](_0x1731cf['secondtransfereruniqueid']);}}else if(!_[_0x481f('0x3f')](this[_0x481f('0x20')][_0x1731cf['transfertargetuniqueid']])){this['startAcw'](_0x1731cf[_0x481f('0x42')]);if(this['channels'][_0x1731cf[_0x481f('0x44')]]){this[_0x481f('0x20')][_0x1731cf[_0x481f('0x44')]]['attended']=!![];this[_0x481f('0x20')][_0x1731cf[_0x481f('0x40')]]=this[_0x481f('0x20')][_0x1731cf[_0x481f('0x44')]];this['deleteChannelAfterTimeout'](_0x1731cf[_0x481f('0x44')]);}}}catch(_0x5c0f29){logger[_0x481f('0x1d')](_0x481f('0x45'),_0x5c0f29['message']);}};Acw[_0x481f('0x15')][_0x481f('0x10')]=function(_0x22df09){try{if(this['channels'][_0x22df09[_0x481f('0x46')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x481f('0x47')](_0x22df09[_0x481f('0x46')]));this['startAcw'](_0x22df09['transfereruniqueid']);}else if(this[_0x481f('0x20')][_0x22df09[_0x481f('0x48')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x481f('0x47')](_0x22df09[_0x481f('0x48')]));this[_0x481f('0x3a')](_0x22df09['transfererlinkedid']);}}catch(_0x150a53){logger['error'](_0x481f('0x49'),_0x150a53[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x4a')]=function(_0x499d70){try{if(this[_0x481f('0x7')][_0x499d70[_0x481f('0x21')]]&&this[_0x481f('0x7')][_0x499d70[_0x481f('0x21')]]['autopause']==='all'){if(this[_0x481f('0x26')][_0x499d70[_0x481f('0x38')]]){logger['info'](_0x481f('0x4b'),_0x499d70[_0x481f('0x19')],_0x499d70[_0x481f('0x38')],_0x499d70[_0x481f('0x21')]);return RpcUser['savePause'](this[_0x481f('0x26')][_0x499d70[_0x481f('0x38')]],_0x481f('0x4c'),_0x499d70[_0x481f('0x19')]);}}}catch(_0xcb0b04){logger[_0x481f('0x1d')](_0x481f('0x4d'),_0xcb0b04[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['deleteChannelAfterTimeout']=function(_0x1d9b47,_0x15153f=0x2710){if(this['channels'][_0x1d9b47]){setTimeout(()=>{delete this['channels'][_0x1d9b47];},_0x15153f);}};module[_0x481f('0x4e')]=Acw; \ No newline at end of file +var _0x269c=['QueuePause','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','acwTimeout','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','acw','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','queue','ACW','mandatoryDispositionPause','name','Action'];(function(_0x5cb89a,_0x3f108e){var _0x39181f=function(_0xe78bbf){while(--_0xe78bbf){_0x5cb89a['push'](_0x5cb89a['shift']());}};_0x39181f(++_0x3f108e);}(_0x269c,0x1ef));var _0xc269=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x269c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc269('0x0'));var moment=require(_0xc269('0x1'));var ami=require('../ami');var logger=require(_0xc269('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xc269('0x3'));function Acw(_0x4be9a7){this[_0xc269('0x4')]=_0x4be9a7['voiceQueues'];this['agents']=_0x4be9a7[_0xc269('0x5')];this[_0xc269('0x6')]=_0x4be9a7[_0xc269('0x6')];this[_0xc269('0x7')]={};ami['on'](_0xc269('0x8'),this[_0xc269('0x9')][_0xc269('0xa')](this));ami['on'](_0xc269('0xb'),this[_0xc269('0xc')]['bind'](this));ami['on'](_0xc269('0xd'),this[_0xc269('0xe')][_0xc269('0xa')](this));ami['on'](_0xc269('0xf'),this[_0xc269('0x10')][_0xc269('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xc269('0x11'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xc269('0x12'),this['syncAgentConnectPreview'][_0xc269('0xa')](this));}function getDiff(_0x366561){var _0x37b325=moment()[_0xc269('0x13')](0x0);var _0xe60d56=moment(_0x366561)[_0xc269('0x13')](0x0);return _0x37b325[_0xc269('0x14')](_0xe60d56,_0xc269('0x15'));}Acw[_0xc269('0x16')][_0xc269('0x17')]=function(_0x1b74e7,_0x18b89b){var _0x329e7a=this;var _0x391cea=getDiff(_0x329e7a['timers'][_0x1b74e7][_0xc269('0x18')]);clearTimeout(_0x329e7a[_0xc269('0x6')][_0x1b74e7][_0xc269('0x19')]);_0x329e7a[_0xc269('0x6')][_0x1b74e7][_0xc269('0x19')]=![];return RpcVoiceAgentReport[_0xc269('0x1a')]({'acwtime':_0x391cea},_0x329e7a[_0xc269('0x6')][_0x1b74e7]['uniqueid'],_0x1b74e7)[_0xc269('0x1b')](function(_0x3bb219){logger['info'](_0xc269('0x1c'),_0x18b89b,_0x391cea,_0x3bb219);})[_0xc269('0x1d')](function(_0x38af59){logger[_0xc269('0x1e')](_0xc269('0x1f'),_0x18b89b,_0x38af59);})[_0xc269('0x20')](function(){delete _0x329e7a['timers'][_0x1b74e7];});};Acw['prototype'][_0xc269('0x21')]=function(_0x5de1fd){try{var _0x175a5a=this;var _0x46afb3=this['channels'][_0x5de1fd]['interface'];var _0x1cf120=this[_0xc269('0x7')][_0x5de1fd][_0xc269('0x22')];var _0x13643f=this[_0xc269('0x4')][_0x1cf120];var _0x4560b0=![];var _0x33cd6f=_0xc269('0x23');if(_0x13643f['mandatoryDisposition']&&_0x13643f[_0xc269('0x24')][_0xc269('0x25')]){_0x4560b0=!![];_0x33cd6f=_0x13643f[_0xc269('0x24')][_0xc269('0x25')];}return ami[_0xc269('0x26')]({'action':_0xc269('0x27'),'interface':_0x46afb3,'paused':!![],'reason':_0x33cd6f})[_0xc269('0x1b')](function(){if(_0x175a5a[_0xc269('0x5')][_0x46afb3]){return RpcUser[_0xc269('0x28')](_0x175a5a[_0xc269('0x5')][_0x46afb3]['id'])[_0xc269('0x1b')](function(_0xe8a7b2){if(!_0xe8a7b2||_0xe8a7b2[_0xc269('0x29')]){logger[_0xc269('0x2a')](_0xc269('0x2b'),_0x5de1fd,_0x46afb3,_0x1cf120);return;}logger[_0xc269('0x2a')](_0xc269('0x2c'),_0x5de1fd,_0x46afb3,_0x1cf120);var _0x3d64b8=_0x175a5a[_0xc269('0x7')][_0x5de1fd]['attended']&&_0x175a5a[_0xc269('0x7')][_0x5de1fd]['destlinkedid']?_0x175a5a['channels'][_0x5de1fd][_0xc269('0x2d')]:_0x5de1fd;return RpcUser[_0xc269('0x2e')](_0x175a5a[_0xc269('0x5')][_0x46afb3],_0x33cd6f,_0x3d64b8)[_0xc269('0x1b')](function(_0x484568){_0x175a5a['voiceQueues'][_0x1cf120]['available']-=0x1;_0x175a5a[_0xc269('0x4')][_0x1cf120][_0xc269('0x2f')]+=0x1;return _0x484568;});})[_0xc269('0x1b')](function(_0x6542a5){if(_0x4560b0||!_0x6542a5){return;}_0x175a5a[_0xc269('0x6')][_0x46afb3]={};logger[_0xc269('0x2a')](_0xc269('0x30'),_0x5de1fd,_0x175a5a[_0xc269('0x4')][_0x1cf120]['acwTimeout'],_0x46afb3,_0x1cf120);_0x175a5a[_0xc269('0x6')][_0x46afb3][_0xc269('0x19')]=setTimeout(_0x175a5a[_0xc269('0x31')][_0xc269('0xa')](_0x175a5a,_0x46afb3),_0x175a5a[_0xc269('0x4')][_0x1cf120]['acwTimeout']*0x3e8);_0x175a5a[_0xc269('0x6')][_0x46afb3][_0xc269('0x18')]=moment()[_0xc269('0x32')](_0xc269('0x33'));_0x175a5a[_0xc269('0x6')][_0x46afb3][_0xc269('0x34')]=_0x5de1fd;_0x175a5a[_0xc269('0x6')][_0x46afb3][_0xc269('0x22')]=_0x1cf120;_0x175a5a[_0xc269('0x6')][_0x46afb3][_0xc269('0x17')]=_0x175a5a['updateAcw'][_0xc269('0xa')](_0x175a5a,_0x46afb3,_0x5de1fd);});}})[_0xc269('0x1d')](function(){logger['error'](_0xc269('0x30'),_0x5de1fd,_0x175a5a[_0xc269('0x4')][_0x1cf120][_0xc269('0x35')],_0x46afb3,_0x1cf120);})[_0xc269('0x20')](function(){delete _0x175a5a['channels'][_0x5de1fd];});}catch(_0x20ebb2){logger[_0xc269('0x1e')]('[ACW][START]\x20%s',_0x20ebb2[_0xc269('0x36')]);}};Acw[_0xc269('0x16')][_0xc269('0x31')]=function(_0x4a41f5){try{var _0x271eeb=this;if(_0x271eeb[_0xc269('0x6')][_0x4a41f5]){_0x271eeb[_0xc269('0x6')][_0x4a41f5][_0xc269('0x19')]=![];var _0x1f7533=_0x271eeb[_0xc269('0x6')][_0x4a41f5][_0xc269('0x34')];var _0xe1f46d=_0x271eeb[_0xc269('0x6')][_0x4a41f5][_0xc269('0x22')];var _0x1fadb8=_0x271eeb[_0xc269('0x4')][_0xe1f46d][_0xc269('0x35')];logger['info'](_0xc269('0x37'),_0x1f7533,_0x4a41f5);RpcUser[_0xc269('0x28')](this[_0xc269('0x5')][_0x4a41f5]['id'])['then'](function(_0x5b2984){if(_0x5b2984[_0xc269('0x38')]===_0xc269('0x23')){return RpcUser[_0xc269('0x39')](_0x271eeb[_0xc269('0x5')][_0x4a41f5]);}});RpcVoiceAgentReport['update']({'acwtime':_0x1fadb8,'agentacw':!![]},_0x1f7533,_0x4a41f5)[_0xc269('0x1b')](function(_0x1b4420){logger[_0xc269('0x2a')](_0xc269('0x1c'),_0x1f7533,_0x1fadb8,_0x1b4420);})['catch'](function(_0x56f7af){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1f7533,_0x56f7af);});}else{logger[_0xc269('0x1e')](_0xc269('0x3a'),_0x4a41f5);if(_0x271eeb[_0xc269('0x6')]){logger[_0xc269('0x2a')](_0xc269('0x3b'),JSON['stringify'](_0x271eeb['timers']));}}}catch(_0x32a409){logger[_0xc269('0x1e')]('[ACW][STOP]\x20%s',_0x32a409[_0xc269('0x36')]);}};Acw[_0xc269('0x16')][_0xc269('0x9')]=function(_0x8404a){try{if(this[_0xc269('0x4')][_0x8404a[_0xc269('0x22')]]&&(this[_0xc269('0x4')][_0x8404a['queue']][_0xc269('0x3c')]||this[_0xc269('0x4')][_0x8404a['queue']][_0xc269('0x3d')])){if(this[_0xc269('0x5')][_0x8404a['interface']]){this[_0xc269('0x7')][_0x8404a[_0xc269('0x34')]]={'queue':_0x8404a[_0xc269('0x22')],'interface':_0x8404a[_0xc269('0x3e')],'destlinkedid':_0x8404a[_0xc269('0x2d')]};}}}catch(_0x240066){logger[_0xc269('0x1e')](_0xc269('0x3f'),_0x240066[_0xc269('0x36')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x263e42){try{if(this['voiceQueues'][_0x263e42[_0xc269('0x22')]]&&(this[_0xc269('0x4')][_0x263e42[_0xc269('0x22')]][_0xc269('0x3c')]||this['voiceQueues'][_0x263e42[_0xc269('0x22')]]['mandatoryDisposition'])){if(this[_0xc269('0x5')][_0x263e42[_0xc269('0x3e')]]){this[_0xc269('0x7')][_0x263e42[_0xc269('0x34')]]={'queue':_0x263e42['queue'],'interface':_0x263e42[_0xc269('0x3e')]};}}}catch(_0x4af85f){logger[_0xc269('0x1e')](_0xc269('0x40'),_0x4af85f[_0xc269('0x36')]);}};Acw['prototype'][_0xc269('0xc')]=function(_0x1a57cf){try{if(this['channels'][_0x1a57cf[_0xc269('0x34')]]&&_['isUndefined'](this['channels'][_0x1a57cf[_0xc269('0x34')]]['attended'])){logger[_0xc269('0x2a')]('[%s][HANGUP:UNIQUEID]',_0x1a57cf['uniqueid']);this[_0xc269('0x21')](_0x1a57cf[_0xc269('0x34')]);}else if(this['channels'][_0x1a57cf[_0xc269('0x41')]]&&_['isUndefined'](this['channels'][_0x1a57cf[_0xc269('0x41')]][_0xc269('0x42')])){logger['info'](_0xc269('0x43'),_0x1a57cf[_0xc269('0x41')]);this['startAcw'](_0x1a57cf['linkedid']);}}catch(_0x28e597){logger['error'](_0xc269('0x44'),_0x28e597[_0xc269('0x36')]);}};Acw[_0xc269('0x16')][_0xc269('0xe')]=function(_0x1acf76){try{if(this[_0xc269('0x7')][_0x1acf76[_0xc269('0x34')]]&&this[_0xc269('0x7')][_0x1acf76['uniqueid']][_0xc269('0x42')]){logger[_0xc269('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1acf76[_0xc269('0x34')]);this[_0xc269('0x21')](_0x1acf76[_0xc269('0x34')]);}else if(this[_0xc269('0x7')][_0x1acf76[_0xc269('0x41')]]&&this[_0xc269('0x7')][_0x1acf76[_0xc269('0x41')]][_0xc269('0x42')]){logger['info'](_0xc269('0x45'),_0x1acf76['linkedid']);this[_0xc269('0x21')](_0x1acf76[_0xc269('0x41')]);}}catch(_0xfe8e09){logger[_0xc269('0x1e')](_0xc269('0x46'),_0xfe8e09[_0xc269('0x36')]);}};Acw[_0xc269('0x16')][_0xc269('0x47')]=function(_0x4e4f23){try{if(!_[_0xc269('0x48')](this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x49')]])){this[_0xc269('0x21')](_0x4e4f23[_0xc269('0x49')]);if(this['channels'][_0x4e4f23[_0xc269('0x4a')]]){this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x4a')]][_0xc269('0x42')]=!![];this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x4b')]]=this['channels'][_0x4e4f23[_0xc269('0x4a')]];this['deleteChannelAfterTimeout'](_0x4e4f23[_0xc269('0x4a')]);}}else if(!_['isNil'](this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x4b')]])){this['startAcw'](_0x4e4f23[_0xc269('0x4b')]);if(this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x4c')]]){this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x4c')]][_0xc269('0x42')]=!![];this[_0xc269('0x7')][_0x4e4f23[_0xc269('0x49')]]=this['channels'][_0x4e4f23['origtransfereruniqueid']];this[_0xc269('0x4d')](_0x4e4f23[_0xc269('0x4c')]);}}}catch(_0x297837){logger[_0xc269('0x1e')](_0xc269('0x4e'),_0x297837['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x11c465){try{if(this['channels'][_0x11c465['transfereruniqueid']]){logger['info'](_0xc269('0x4f'),JSON['stringify'](_0x11c465[_0xc269('0x50')]));this[_0xc269('0x21')](_0x11c465[_0xc269('0x50')]);}else if(this[_0xc269('0x7')][_0x11c465[_0xc269('0x51')]]){logger['info'](_0xc269('0x52'),JSON['stringify'](_0x11c465[_0xc269('0x51')]));this[_0xc269('0x21')](_0x11c465[_0xc269('0x51')]);}}catch(_0x2f19d2){logger[_0xc269('0x1e')](_0xc269('0x53'),_0x2f19d2[_0xc269('0x36')]);}};Acw['prototype'][_0xc269('0x10')]=function(_0x30db49){try{if(this[_0xc269('0x4')][_0x30db49[_0xc269('0x22')]]&&this[_0xc269('0x4')][_0x30db49[_0xc269('0x22')]][_0xc269('0x54')]===_0xc269('0x55')){if(this[_0xc269('0x5')][_0x30db49[_0xc269('0x3e')]]){logger[_0xc269('0x2a')](_0xc269('0x56'),_0x30db49[_0xc269('0x34')],_0x30db49['interface'],_0x30db49[_0xc269('0x22')]);return RpcUser[_0xc269('0x2e')](this[_0xc269('0x5')][_0x30db49[_0xc269('0x3e')]],_0xc269('0x57'),_0x30db49[_0xc269('0x34')]);}}}catch(_0x4d6748){logger['error'](_0xc269('0x58'),_0x4d6748[_0xc269('0x36')]);}};Acw['prototype'][_0xc269('0x4d')]=function(_0x411aa9,_0x59e548=0x2710){if(this[_0xc269('0x7')][_0x411aa9]){setTimeout(()=>{delete this[_0xc269('0x7')][_0x411aa9];},_0x59e548);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 7eaaed3..e0734dc 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 _0x8dbc=['actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[ami.js][fullybooted]','asterisk-manager','util','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','devicestatelist','sippeerstatus','actionQueueSummary'];(function(_0x443939,_0x7946a7){var _0x511440=function(_0x29d34e){while(--_0x29d34e){_0x443939['push'](_0x443939['shift']());}};_0x511440(++_0x7946a7);}(_0x8dbc,0x1de));var _0xc8db=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x8dbc[_0x2cf2e9];return _0xd3670d;};'use strict';var Manager=require(_0xc8db('0x0'));var BPromise=require('bluebird');var util=require(_0xc8db('0x1'));var logger=require('../../config/logger')(_0xc8db('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xc8db('0x3')][_0xc8db('0x4')],config[_0xc8db('0x3')]['ip'],config['asterisk'][_0xc8db('0x5')],config[_0xc8db('0x3')][_0xc8db('0x6')],!![]);ami[_0xc8db('0x7')]();ami[_0xc8db('0x8')]=BPromise['promisify'](ami[_0xc8db('0x9')]);function error(_0x212088){logger[_0xc8db('0xa')](util[_0xc8db('0xb')](_0xc8db('0xc'),config[_0xc8db('0x3')]['username'],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')],util['inspect'](_0x212088,![],null)));}function close(){logger[_0xc8db('0xa')](util[_0xc8db('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xc8db('0x3')][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')]));}ami[_0xc8db('0xd')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0xe')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0xf')});};};ami[_0xc8db('0x10')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':'queuesummary'});};};ami[_0xc8db('0x11')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0x12')});};};function connect(){logger[_0xc8db('0x13')](util[_0xc8db('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc8db('0x3')][_0xc8db('0x5')],config['asterisk']['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')]));ami[_0xc8db('0x14')]('error',error);ami[_0xc8db('0x14')](_0xc8db('0x15'),close);}ami['on'](_0xc8db('0x16'),connect);ami['on']('shutdown',function(_0x105bd2){logger['info'](util[_0xc8db('0xb')](_0xc8db('0x17'),config['asterisk'][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')],util[_0xc8db('0x18')](_0x105bd2,![],null)));});ami['on'](_0xc8db('0x19'),function(){logger[_0xc8db('0x13')](util[_0xc8db('0xb')](_0xc8db('0x1a'),config[_0xc8db('0x3')][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')]['port']));return Promise[_0xc8db('0x1b')]()[_0xc8db('0x1c')](ami[_0xc8db('0xd')]())['then'](ami[_0xc8db('0x1d')]())[_0xc8db('0x1c')](ami[_0xc8db('0x1e')]())[_0xc8db('0x1c')](ami[_0xc8db('0x10')]())['then'](ami[_0xc8db('0x11')]())[_0xc8db('0x1f')](function(_0x588862){logger['error'](_0xc8db('0x20'),util[_0xc8db('0x18')](_0x588862,{'showHidden':![],'depth':null}));});});ami[_0xc8db('0x14')]('error',error);ami[_0xc8db('0x14')](_0xc8db('0x15'),close);module['exports']=ami; \ No newline at end of file +var _0xb8cb=['catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','asterisk','username','password','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','error','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xb8cb,0xe7));var _0xbb8c=function(_0x482fe3,_0x497a8e){_0x482fe3=_0x482fe3-0x0;var _0x25dd73=_0xb8cb[_0x482fe3];return _0x25dd73;};'use strict';var Manager=require(_0xbb8c('0x0'));var BPromise=require(_0xbb8c('0x1'));var util=require(_0xbb8c('0x2'));var logger=require('../../config/logger')(_0xbb8c('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xbb8c('0x4')]['port'],config[_0xbb8c('0x4')]['ip'],config[_0xbb8c('0x4')][_0xbb8c('0x5')],config['asterisk'][_0xbb8c('0x6')],!![]);ami['keepConnected']();ami[_0xbb8c('0x7')]=BPromise[_0xbb8c('0x8')](ami[_0xbb8c('0x9')]);function error(_0x3dda32){logger['error'](util[_0xbb8c('0xa')](_0xbb8c('0xb'),config[_0xbb8c('0x4')][_0xbb8c('0x5')],config[_0xbb8c('0x4')]['ip'],config[_0xbb8c('0x4')][_0xbb8c('0xc')],util['inspect'](_0x3dda32,![],null)));}function close(){logger[_0xbb8c('0xd')](util[_0xbb8c('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb8c('0x4')]['username'],config[_0xbb8c('0x4')]['ip'],config[_0xbb8c('0x4')]['port']));}ami[_0xbb8c('0xe')]=function(){return function(){return ami['Action']({'action':_0xbb8c('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xbb8c('0x10')});};};ami[_0xbb8c('0x11')]=function(){return function(){return ami[_0xbb8c('0x7')]({'action':_0xbb8c('0x12')});};};ami[_0xbb8c('0x13')]=function(){return function(){return ami[_0xbb8c('0x7')]({'action':_0xbb8c('0x14')});};};ami[_0xbb8c('0x15')]=function(){return function(){return ami[_0xbb8c('0x7')]({'action':'coreshowchannels'});};};function connect(){logger[_0xbb8c('0x16')](util[_0xbb8c('0xa')](_0xbb8c('0x17'),config[_0xbb8c('0x4')][_0xbb8c('0x5')],config[_0xbb8c('0x4')]['ip'],config[_0xbb8c('0x4')][_0xbb8c('0xc')]));ami[_0xbb8c('0x18')](_0xbb8c('0xd'),error);ami[_0xbb8c('0x18')](_0xbb8c('0x19'),close);}ami['on'](_0xbb8c('0x1a'),connect);ami['on'](_0xbb8c('0x1b'),function(_0x147082){logger['info'](util['format'](_0xbb8c('0x1c'),config[_0xbb8c('0x4')]['username'],config[_0xbb8c('0x4')]['ip'],config['asterisk'][_0xbb8c('0xc')],util[_0xbb8c('0x1d')](_0x147082,![],null)));});ami['on'](_0xbb8c('0x1e'),function(){logger['info'](util[_0xbb8c('0xa')](_0xbb8c('0x1f'),config[_0xbb8c('0x4')][_0xbb8c('0x5')],config['asterisk']['ip'],config[_0xbb8c('0x4')]['port']));return Promise[_0xbb8c('0x20')]()['then'](ami[_0xbb8c('0xe')]())[_0xbb8c('0x21')](ami[_0xbb8c('0x22')]())['then'](ami[_0xbb8c('0x11')]())[_0xbb8c('0x21')](ami[_0xbb8c('0x13')]())[_0xbb8c('0x21')](ami['actionCoreShowChannels']())[_0xbb8c('0x23')](function(_0xe561ef){logger[_0xbb8c('0xd')](_0xbb8c('0x24'),util[_0xbb8c('0x1d')](_0xe561ef,{'showHidden':![],'depth':null}));});});ami[_0xbb8c('0x18')]('error',error);ami[_0xbb8c('0x18')]('close',close);module[_0xbb8c('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 32733ad..785dd36 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcb91[_0x4b369d];return _0x571a98;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4342b0,_0x479475){_0x4342b0=_0x4342b0-0x0;var _0x5d59d2=_0xf4eb[_0x4342b0];return _0x5d59d2;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 32b4cbe..15db549 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 _0x78e7=['error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','Action','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','type','updateOriginated','answertime','ivr','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countglobal','callAdditionalPhoneAfterMin','additional','queueCallerAbandonCreateState','countdropretry','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','voiceQueue','dialAbandonedMaxRetry','rescheduleContact','[rescheduleContact][Abandoned]','calleridnum','createHistory','[syncAgentComplete][createHistory][11]','actions','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','push','idHopper','run','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countnoanswerretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','[syncHangupIvr][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','merge','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','Trunk','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','loggedIn','predictiveIntervalPauses','outboundQueuePauses','startMethodPredictive','erlangCallToSecond','one\x20call\x20every:','milliseconds','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','getSeconds','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78e7,0x1cb));var _0x778e=function(_0x2875ac,_0x481cac){_0x2875ac=_0x2875ac-0x0;var _0x1ec6ba=_0x78e7[_0x2875ac];return _0x1ec6ba;};'use strict';var util=require(_0x778e('0x0'));var _=require(_0x778e('0x1'));var uuid=require(_0x778e('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x778e('0x3'));var utils=require('./utils');var hopperUtils=require(_0x778e('0x4'));var ut=require(_0x778e('0x5'));var config=require('../../../config/environment/');var logger=require(_0x778e('0x6'))(_0x778e('0x7'));var loggerBooked=require(_0x778e('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0x778e('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x778e('0x9'));var loggerSyncQueueSummary=require(_0x778e('0x6'))('syncQueueSummary');var ami=require(_0x778e('0xa'));config[_0x778e('0xb')]=_[_0x778e('0xc')](config[_0x778e('0xb')],{'host':_0x778e('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x778e('0xb')]));var cmHopper=require(_0x778e('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x778e('0xf'));var Interval=require(_0x778e('0x10'));var Action=require(_0x778e('0x11'));var History=require(_0x778e('0x12'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x778e('0x13'));var Hangup=require(_0x778e('0x14'));var ipAgi=process[_0x778e('0x15')]['XCALLY_IP_AGI']||_0x778e('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x27765a){this[_0x778e('0x17')]=this[_0x778e('0x17')]?this[_0x778e('0x17')][_0x778e('0x18')](_0x27765a):_0x27765a();};function Dialer(_0x8f3e2b,_0x5ee40a){this['sequence']=new Sequence();this[_0x778e('0x19')]=_0x5ee40a;this['voiceQueues']=_0x8f3e2b[_0x778e('0x1a')];this[_0x778e('0x1b')]=_0x8f3e2b['campaigns'];this[_0x778e('0x1c')]=_0x8f3e2b[_0x778e('0x1c')];this[_0x778e('0x1d')]=_0x8f3e2b[_0x778e('0x1d')];this['maxNumberOriginate']=config[_0x778e('0x1e')]||0x2;this[_0x778e('0x1f')]={};this['actions']={};this[_0x778e('0x20')]={};this[_0x778e('0x21')]={};this[_0x778e('0x22')]={};this[_0x778e('0x23')]={};this[_0x778e('0x24')]={};this['ivrOriginated']={};this[_0x778e('0x25')]={};this[_0x778e('0x26')]={};this['queuesSummary']={};ami['on'](_0x778e('0x27'),this[_0x778e('0x28')][_0x778e('0x29')](this));ami['on']('queuecallerabandon',this[_0x778e('0x2a')]['bind'](this));ami['on'](_0x778e('0x2b'),this[_0x778e('0x2c')][_0x778e('0x29')](this));ami['on']('agentcomplete',this[_0x778e('0x2d')]['bind'](this));ami['on'](_0x778e('0x2e'),this[_0x778e('0x2f')]['bind'](this));ami['on'](_0x778e('0x30'),this[_0x778e('0x31')]['bind'](this));ami['on'](_0x778e('0x32'),this[_0x778e('0x33')][_0x778e('0x29')](this));ami['on'](_0x778e('0x34'),this[_0x778e('0x35')][_0x778e('0x29')](this));ami['on'](_0x778e('0x36'),this[_0x778e('0x37')]['bind'](this));ami['on'](_0x778e('0x38'),this[_0x778e('0x39')]['bind'](this));ami['on'](_0x778e('0x3a'),this[_0x778e('0x3b')][_0x778e('0x29')](this));this[_0x778e('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x778e('0x3d')]()['then'](function(_0x56167b){previewRecallmeReminderInterval=_0x56167b[_0x778e('0x3e')];});}function isNotNull(_0x3764b5){return _0x3764b5!==null&&!_['isUndefined'](_0x3764b5);}function msgResponse(_0x4de829,_0x5dd3f6,_0x2994cf){return{'action':_0x4de829,'response':_0x5dd3f6,'message':_0x2994cf,'stack':_0x2994cf};}function emit(_0x380cf5,_0x46791c,_0x54e838){io['to'](_0x380cf5)[_0x778e('0x3f')](_0x46791c,_0x54e838);}function emitOutboundVoiceQueueSummary(_0x49a7e5){if(_0x49a7e5['type']===_0x778e('0x40')){logger[_0x778e('0x41')](_0x778e('0x42'),util[_0x778e('0x43')](_0x49a7e5,{'showHidden':![],'depth':null}));emit(util['format'](_0x778e('0x44'),_0x49a7e5[_0x778e('0x45')]),_0x778e('0x46'),_0x49a7e5);}}function checkGetDataPredictive(_0x484714){if(isNotNull(_0x484714)&&!_['isEmpty'](_0x484714)){loggerPredictive['info'](_0x778e('0x47'));loggerPredictive[_0x778e('0x48')](_0x778e('0x49'),_0x484714[_0x778e('0x4a')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x4b'),_0x484714[_0x778e('0x4c')]);loggerPredictive['info'](_0x778e('0x4d'),_0x484714[_0x778e('0x4e')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x4f'),_0x484714[_0x778e('0x50')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x51'),_0x484714[_0x778e('0x52')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x53'),_0x484714['predictiveIntervalAvgTalktime']);loggerPredictive[_0x778e('0x48')]('---------------------------');if(_0x484714[_0x778e('0x4a')]>0x0){if(!_[_0x778e('0x54')](_0x484714[_0x778e('0x55')])&&_0x484714['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x778e('0x48')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x778e('0x54')](_0x484714['predictiveIntervalAvgHoldtime'])&&_0x484714[_0x778e('0x52')]>0x0){return!![];}loggerPredictive[_0x778e('0x48')](_0x778e('0x56'));}else{loggerPredictive['info'](_0x778e('0x57'));}}else{loggerPredictive[_0x778e('0x48')](_0x778e('0x58'));}return![];}function mergeDataErlangB(_0x24a6a4){return function(_0x3efb13){loggerPredictive[_0x778e('0x48')](_0x778e('0x59'));loggerPredictive[_0x778e('0x48')](_0x778e('0x5a'),_0x3efb13[_0x778e('0x5b')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x5c'),_0x3efb13['erlangCallToSecond']);loggerPredictive['info'](_0x778e('0x5d'),_0x3efb13[_0x778e('0x5e')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3efb13[_0x778e('0x5f')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x5d'),_0x3efb13[_0x778e('0x5e')]);loggerPredictive[_0x778e('0x48')]('---------------------------');_['merge'](_0x24a6a4,_0x3efb13);};}function ifInterval(_0x796951,_0x2dea4d){if(_['isUndefined'](_0x2dea4d)){return![];}return utils['getSeconds'](undefined,_0x2dea4d)<_0x796951*0x3c;}function clearPredictiveAttributes(_0x4f33a6){if(_0x4f33a6[_0x778e('0x24')]){_0x4f33a6[_0x778e('0x24')]=undefined;loggerPredictive[_0x778e('0x41')](_0x4f33a6[_0x778e('0x45')],_0x778e('0x60'));}if(_0x4f33a6[_0x778e('0x23')]){_0x4f33a6[_0x778e('0x23')]=undefined;loggerPredictive['debug'](_0x4f33a6['name'],_0x778e('0x61'));}if(_0x4f33a6[_0x778e('0x62')]){clearInterval(_0x4f33a6['handlePredictive']);_0x4f33a6[_0x778e('0x62')]=undefined;loggerPredictive[_0x778e('0x41')](_0x4f33a6[_0x778e('0x45')],_0x778e('0x63'));}}function loggerCatchPredictive(_0x8a0ed3,_0x2f0e65){return function(_0x5b6d78){loggerPredictive[_0x778e('0x64')](_0x2f0e65[_0x778e('0x45')],_0x8a0ed3);loggerPredictive[_0x778e('0x64')](_0x5b6d78[_0x778e('0x65')]);clearPredictiveAttributes(_0x2f0e65);};}function loggerCatch(_0x2191b8){return function(_0x223b62){logger[_0x778e('0x64')](_0x2191b8,util[_0x778e('0x43')](_0x223b62,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4fdb70,_0x14ae47,_0x5b1ba8){return function(_0x496371){utils[_0x778e('0x66')](_0x14ae47,_0x5b1ba8,0x0);_0x14ae47['temp']=0x0;logger['error'](_0x4fdb70,util[_0x778e('0x43')](_0x496371,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3c9387){return function(_0x1dc99b){if(isNotNull(_0x1dc99b)&&isNotNull(_0x1dc99b[0x0])){if(_0x1dc99b[0x0][_0x778e('0x67')]>0x0){_0x3c9387['message']=utils[_0x778e('0x68')][_0x778e('0x69')];logger[_0x778e('0x48')](_0x778e('0x6a')+_0x3c9387['name'],_0x1dc99b[0x0][_0x778e('0x67')],_0x778e('0x6b'));}else{_0x3c9387[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x6d')];logger[_0x778e('0x48')](_0x778e('0x6e')+_0x3c9387[_0x778e('0x45')]);}}};}function createObjHistory(_0xaebcf9,_0x24d075,_0x244dc7,_0x1eac4e,_0x458948){_0xaebcf9[_0x778e('0x6c')]=_0x244dc7;var _0x1ab025=new Action(_0xaebcf9,_0x24d075);var _0x552eac=new History(_0x1ab025);_0x552eac[_0x778e('0x6f')]=_0x1eac4e;_0x552eac[_0x778e('0x70')]=_0x458948;_0x552eac[_0x778e('0x71')]=_0x1ab025[_0x778e('0x72')];return _0x552eac;}function unlockQueueStatus(_0x42e294,_0x537b6d){setTimeout(function(){if(_[_0x778e('0x54')](_0x42e294[_0x778e('0x73')])){loggerBooked[_0x778e('0x64')](_0x778e('0x74'),_0x537b6d);}_0x42e294[_0x778e('0x73')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x537b6d,JSON[_0x778e('0x75')](_[_0x778e('0x76')](_0x42e294,[_0x778e('0x45'),_0x778e('0x73')])));},0x1f3);}function checkInterval(_0x2addcf){return function(){if(!isNotNull(_0x2addcf[_0x778e('0x77')])){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2addcf[_0x778e('0x77')][_0x778e('0x79')])){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+_0x778e('0x7a');}if(!isNotNull(_['isEmpty'](_0x2addcf['Interval'][_0x778e('0x79')]))){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+_0x778e('0x7a');}};}function checkIsIVRCampaignActive(_0x2c4f2c){return function(){if(!utils[_0x778e('0x7b')](_0x2c4f2c)){_0x2c4f2c['message']=utils['CAMPAIGN_STATUS'][_0x778e('0x7c')];throw _0x2c4f2c[_0x778e('0x45')]+_0x778e('0x7d');}};}function emitCampaignSummary(_0x5f4e23){if(utils[_0x778e('0x7e')](_0x5f4e23)){emit(util[_0x778e('0x7f')](_0x778e('0x80'),_0x5f4e23['name']),'campaign:save',_0x5f4e23);}}function loggerCatchQueueSummary(_0x4703e6,_0x240034){return function(_0x1b2699){clearPredictiveAttributes(_0x240034);emitCampaignSummary(_0x240034);loggerSyncQueueSummary['debug'](_0x4703e6,util[_0x778e('0x43')](_0x1b2699,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x28acf1){if(_0x28acf1[_0x778e('0x81')]){if(_0x28acf1[_0x778e('0x82')]===0x0){_0x28acf1[_0x778e('0x81')]=![];_0x28acf1['message']=utils[_0x778e('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x778e('0x83'),_0x28acf1[_0x778e('0x45')],_0x778e('0x84'));}else{_0x28acf1[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x85')];loggerSyncQueueSummary[_0x778e('0x41')](_0x778e('0x83'),_0x28acf1['name'],_0x778e('0x86'));}emitCampaignSummary(_0x28acf1);}}function myreject(_0x3e9595){return function(_0x55e1b0){return _0x3e9595(msgResponse(_0x778e('0x87'),_0x778e('0x88'),JSON[_0x778e('0x75')](_0x55e1b0)));};}Dialer[_0x778e('0x89')][_0x778e('0x8a')]=function(_0x376689){return!_[_0x778e('0x54')](_0x376689)&&_0x376689&&!_['isUndefined'](_0x376689[_0x778e('0x45')])&&!_['isUndefined'](_0x376689[_0x778e('0x8b')])&&_0x376689['active']&&(this[_0x778e('0x1d')][util[_0x778e('0x7f')](_0x778e('0x8c'),_0x376689[_0x778e('0x45')])][_0x778e('0x8d')]===_0x778e('0x8e')||this[_0x778e('0x1d')][util[_0x778e('0x7f')]('SIP/%s',_0x376689[_0x778e('0x45')])]['status']===_0x778e('0x8f'));};Dialer[_0x778e('0x89')][_0x778e('0x90')]=function(_0x5e36e1){var _0x34ea52=this;return function(){if(!_0x34ea52[_0x778e('0x8a')](_0x5e36e1['Trunk'])){if(!_0x34ea52[_0x778e('0x8a')](_0x5e36e1['TrunkBackup'])){_0x5e36e1['message']=utils[_0x778e('0x68')][_0x778e('0x91')];throw _0x5e36e1['name']+_0x778e('0x92');}}};};Dialer['prototype'][_0x778e('0x93')]=function(_0x417a01,_0x28a839,_0x1c2800,_0x2a12a9){var _0x5a3f70=this;return function(){var _0x305d97=!![];return _0x5a3f70[_0x778e('0x94')](_0x417a01,_0x28a839,_0x1c2800,_0x2a12a9,_0x305d97);};};Dialer[_0x778e('0x89')][_0x778e('0x95')]=function(_0x343086,_0x24acac,_0x353be3,_0xd2d5c0){var _0x11b51c=this;return function(){var _0x1a18ba=![];return _0x11b51c[_0x778e('0x94')](_0x343086[_0x778e('0x79')],_0x24acac,_0x353be3,_0xd2d5c0,_0x1a18ba);};};Dialer[_0x778e('0x89')][_0x778e('0x94')]=function(_0x580125,_0x5d7bbf,_0x32de7f,_0x2986c2,_0x25d63f){var _0x594483=[];return new Promise(function(_0x546cb3,_0x383899){if(!isNotNull(_0x580125)){_0x2986c2[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];return _0x383899(msgResponse(_0x778e('0x96'),'Failure',_0x32de7f+_0x778e('0x97')));}if(_[_0x778e('0x98')](_0x580125)){_0x2986c2[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x99')];return _0x383899(msgResponse(_0x778e('0x96'),_0x778e('0x9a'),_0x32de7f+_0x778e('0x9b')));}if(_0x5d7bbf&&_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])){_0x2986c2[_0x778e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x778e('0x9d')];return _0x383899(msgResponse('ifTime','Failure',_0x32de7f+_0x778e('0x9e')+_0x5d7bbf));}if(_[_0x778e('0x9f')](_0x580125)){for(var _0x41a02e=0x0;_0x41a02e<_0x580125[_0x778e('0xa0')];_0x41a02e+=0x1){_0x594483['push'](ami['Action']({'action':_0x778e('0xa1'),'command':util[_0x778e('0x7f')](_0x778e('0xa2'),_0x580125[_0x41a02e][_0x778e('0xa3')],!_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])?_0x5d7bbf:'')})[_0x778e('0xa4')](function(_0x3d5bcc){return _0x3d5bcc[_0x778e('0xa5')][_0x778e('0xa6')](_0x778e('0xa7'))>=0x0;})[_0x778e('0xa8')](myreject(_0x383899)));}}else{_0x594483['push'](ami[_0x778e('0xa9')]({'action':_0x778e('0xa1'),'command':util[_0x778e('0x7f')](_0x778e('0xa2'),_0x580125,!_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])?_0x5d7bbf:'')})[_0x778e('0xa4')](function(_0x43557e){return _0x43557e['content'][_0x778e('0xa6')]('true')>=0x0;})[_0x778e('0xa8')](myreject(_0x383899)));}Promise[_0x778e('0xaa')](_0x594483)['then'](function(_0x22726b){var _0x13b3f2=_[_0x778e('0xab')](_0x22726b);if(_0x13b3f2){return _0x546cb3(_0x13b3f2);}else{_0x2986c2[_0x778e('0x6c')]=_0x25d63f?utils[_0x778e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x778e('0x68')][_0x778e('0xac')];return _0x383899(msgResponse(_0x778e('0xad'),'Failure',_0x778e('0xae')+_0x25d63f+'\x20'+_0x32de7f+_0x778e('0xaf')+util[_0x778e('0x43')](_0x580125,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5d7bbf));}})[_0x778e('0xa8')](function(_0x26a068){return _0x383899(msgResponse(_0x778e('0x96'),_0x778e('0x9a'),JSON[_0x778e('0x75')](_0x26a068)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x1d0016=this;return cmHopper[_0x778e('0xb0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1d0016['syncCampaigns']();},0x3e8);});};Dialer[_0x778e('0x89')][_0x778e('0xb1')]=function(){var _0x491eda=this;var _0x1ea5df;for(var _0x1d4bd3 in this[_0x778e('0x1b')]){if(typeof this[_0x778e('0x1b')][_0x1d4bd3]!=='undefined'){_0x1ea5df=this[_0x778e('0x1b')][_0x1d4bd3];if(utils[_0x778e('0x7e')](_0x1ea5df)&&utils[_0x778e('0x7b')](_0x1ea5df)){_0x1ea5df[_0x778e('0x81')]=!![];Promise['resolve']()[_0x778e('0xa4')](checkIsIVRCampaignActive(_0x1ea5df))[_0x778e('0xa4')](checkInterval(_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0x90')](_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0x93')](_0x1ea5df['dialGlobalInterval'],_0x1ea5df[_0x778e('0xb2')],_0x1ea5df[_0x778e('0x45')],_0x1ea5df))['then'](_0x491eda[_0x778e('0x95')](_0x1ea5df[_0x778e('0x77')],_0x1ea5df['dialTimezone'],_0x1ea5df[_0x778e('0x45')],_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0xb3')](_0x1ea5df))[_0x778e('0xa8')](loggerCatchQueueSummary(_0x778e('0xb4'),_0x1ea5df));}else{notSendMessagesCampaign(_0x1ea5df);}}}};Dialer[_0x778e('0x89')]['checkDialMethod']=function(_0x373508){if(_0x373508[_0x778e('0xb5')]!==_0x778e('0x8')){clearPredictiveAttributes(_0x373508);}switch(_0x373508[_0x778e('0xb5')]){case _0x778e('0xb6'):this[_0x778e('0xb7')](_0x373508,0x1);break;case'power':this[_0x778e('0xb7')](_0x373508,_0x373508[_0x778e('0xb8')]);break;case _0x778e('0x8'):this['predictive'](_0x373508);break;case'booked':this[_0x778e('0xb7')](_0x373508,0x1);break;default:logger[_0x778e('0x64')](_0x778e('0xb9'),_0x373508[_0x778e('0x45')],_0x778e('0xba'));}};Dialer[_0x778e('0x89')]['ifTime']=function(_0x26ed66,_0x126189){var _0x50635d=_0x26ed66[_0x778e('0xb2')];var _0x32493c=_0x126189?_0x26ed66['dialGlobalInterval']:_0x26ed66[_0x778e('0x77')][_0x778e('0x79')];logger[_0x778e('0xbb')](_0x778e('0xbc'),_0x32493c,_0x50635d,_0x26ed66['name'],util[_0x778e('0x7f')](_0x778e('0xbd'),_0x26ed66[_0x778e('0x45')],_0x26ed66['id']));var _0x1d8a5c=null;return Interval[_0x778e('0xbe')](_0x32493c,_0x50635d)[_0x778e('0xa4')](function(_0xbf20f4){if(_0xbf20f4===!![]){return _0xbf20f4;}else{_0x26ed66[_0x778e('0x6c')]=_0x126189?utils[_0x778e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x778e('0xac')];_0x1d8a5c=msgResponse(_0x778e('0xad'),_0x778e('0x9a'),'Global:\x20'+_0x126189+'\x20'+_0x26ed66[_0x778e('0x45')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x778e('0x43')](_0x32493c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x50635d);}if(_0x1d8a5c!==null){logger[_0x778e('0xbb')](_0x778e('0xbf'),_0x1d8a5c);_0x1d8a5c[_0x778e('0xc0')]=_0x126189;throw _0x1d8a5c;}})[_0x778e('0xa8')](function(_0x4d77c2){logger['error']('AMI\x20IfTime',_0x4d77c2);throw msgResponse('[ifTime][Action]',_0x778e('0x88'),util[_0x778e('0x43')](_0x4d77c2,{'showHidden':![],'depth':null}));});};Dialer[_0x778e('0x89')][_0x778e('0x28')]=function(_0x24a20c){if(this[_0x778e('0x1a')][_0x24a20c[_0x778e('0xc1')]]){if(this[_0x778e('0x21')][_0x24a20c[_0x778e('0xc2')]]&&this['uniqueId'][_0x24a20c[_0x778e('0xc2')]][_0x778e('0xc3')]!=='ivr'){this[_0x778e('0xc4')](this[_0x778e('0x1a')][_0x24a20c[_0x778e('0xc1')]]);this[_0x778e('0x21')][_0x24a20c['uniqueid']][_0x778e('0xc5')]=moment()[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x778e('0x89')]['syncAgentComplete']=function(_0x261e23){var _0xc15f0e=this['uniqueId'][_0x261e23['uniqueid']];if(this[_0x778e('0x1a')][_0x261e23[_0x778e('0xc1')]]){if(_0xc15f0e&&_0xc15f0e['type']!==_0x778e('0xc6')){delete this[_0x778e('0x21')][_0x261e23['uniqueid']];this[_0x778e('0x1a')][_0x261e23['queue']][_0x778e('0xc7')]+=0x1;var _0x1019a2=new AgentComplete(_0xc15f0e,_0x261e23);if(_0x261e23['reason']===_0x778e('0xc8')){_0x1019a2['agiafterat']=this[_0x778e('0x1a')][_0x261e23[_0x778e('0xc1')]][_0x778e('0xc9')]&&this[_0x778e('0x1a')][_0x261e23['queue']][_0x778e('0xca')]?moment()[_0x778e('0x7f')](_0x778e('0xcb')):undefined;}hopperUtils['createHistory'](_0x1019a2)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x1019a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0xcd')));}}};Dialer[_0x778e('0x89')][_0x778e('0x2a')]=function(_0x30daea){var _0xbde01f=this['uniqueId'][_0x30daea[_0x778e('0xc2')]];var _0x7139a6=this;var _0x5cffe1=![];var _0x3b689e;var _0x35fab2;if(this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]){if(_0xbde01f&&_0xbde01f[_0x778e('0xc3')]!==_0x778e('0xc6')){delete this['uniqueId'][_0x30daea['uniqueid']];this['updateOriginated'](this[_0x778e('0x1a')][_0x30daea['queue']]);_0xbde01f[_0x778e('0xce')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));var _0x1c5a48=new QueueCallerAbandon(_0xbde01f,_0x30daea);if(utils['getSeconds'](_0xbde01f['droptime'],_0xbde01f[_0x778e('0xcf')])>=_0xbde01f[_0x778e('0xd0')]){this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0x4e')]+=0x1;this[_0x778e('0x1a')][_0x30daea['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xd1')]+=0x1;_0x1c5a48[_0x778e('0x6f')]=0xa;_0x1c5a48[_0x778e('0x70')]=_0x778e('0xd2');_0x1c5a48[_0x778e('0xd3')]='TIMEOUT';_0x1c5a48['agiafterat']=this['voiceQueues'][_0x30daea['queue']][_0x778e('0xc9')]?moment()['format'](_0x778e('0xcb')):undefined;_0x1c5a48['countdropretry']+=0x1;_0x1c5a48[_0x778e('0xd4')]+=0x1;_0x3b689e=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]['dialDropRetryFrequency'];_0x35fab2=this[_0x778e('0x1a')][_0x30daea['queue']][_0x778e('0xd5')];hopperUtils['verifyAdditionalPhones'](_0x1c5a48,_0x1c5a48[_0x778e('0x6f')],_0xbde01f['voiceQueue'])['then'](function(_0x3e9b74){_0x5cffe1=_0x3e9b74[_0x778e('0xd6')]==0x1;if(_0x1c5a48['countdropretry']>=_0x7139a6[_0x778e('0x1a')][_0x30daea['queue']]['dialDropMaxRetry']){_0x7139a6[_0x778e('0xd7')](_0x1c5a48,_0x3e9b74['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1c5a48[_0x778e('0xd8')],'scheduledat':moment()[_0x778e('0xd9')](_0x7139a6[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xda')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbde01f[_0x778e('0xdc')],'ListId':_0xbde01f[_0x778e('0xdd')],'VoiceQueueId':_0xbde01f[_0x778e('0xde')]||undefined,'CampaignId':_0xbde01f[_0x778e('0xdf')]||undefined})['catch'](loggerCatch(_0x778e('0xe0')));var _0x3cb838=new History(_0x1c5a48);_0x3cb838['state']=0xa;_0x3cb838[_0x778e('0x70')]=_0x778e('0xd2');_0x3cb838['starttime']=moment()[_0x778e('0x7f')](_0x778e('0xcb'));_0x3cb838['endtime']=_0x3cb838[_0x778e('0x72')];_0x3cb838['calleridname']=_0x1c5a48[_0x778e('0xe1')];_0x3cb838['calleridnum']=_0x1c5a48['calleridnum'];hopperUtils['createHistory'](_0x3cb838)[_0x778e('0xa8')](loggerCatch(_0x778e('0xe2')));}})['then'](function(){if(_0x5cffe1)hopperUtils[_0x778e('0xe3')](_0x1c5a48,_0x3b689e,_0x35fab2)[_0x778e('0xa4')](function(){return 0x1;});});}else{this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xe4')]+=0x1;_0x1c5a48[_0x778e('0x6f')]=0xb;_0x1c5a48[_0x778e('0x70')]=_0x778e('0xe5');_0x1c5a48[_0x778e('0xd3')]=_0x778e('0xe6');_0x1c5a48[_0x778e('0xe7')]+=0x1;_0x1c5a48['countglobal']+=0x1;_0x3b689e=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xe8')];_0x35fab2=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xd5')];hopperUtils[_0x778e('0xe9')](_0x1c5a48,_0x1c5a48[_0x778e('0x6f')],_0xbde01f[_0x778e('0xea')])['then'](function(_0x23483c){if(_0x1c5a48[_0x778e('0xe7')]>=_0x7139a6[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xeb')]){_0x7139a6[_0x778e('0xd7')](_0x1c5a48,_0x23483c[_0x778e('0xd6')]);}else{hopperUtils[_0x778e('0xec')]({'active':![],'countabandonedretry':_0x1c5a48[_0x778e('0xe7')],'scheduledat':moment()[_0x778e('0xd9')](_0x7139a6[_0x778e('0x1a')][_0x30daea['queue']][_0x778e('0xe8')],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0xbde01f[_0x778e('0xdc')],'ListId':_0xbde01f['ListId'],'VoiceQueueId':_0xbde01f[_0x778e('0xde')]||undefined,'CampaignId':_0xbde01f[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0xed')));var _0x1af204=new History(_0x1c5a48);_0x1af204[_0x778e('0x6f')]=0xb;_0x1af204['statedesc']=_0x778e('0xe5');_0x1af204['starttime']=moment()[_0x778e('0x7f')](_0x778e('0xcb'));_0x1af204[_0x778e('0x71')]=_0x1af204[_0x778e('0x72')];_0x1af204[_0x778e('0xe1')]=_0x1c5a48[_0x778e('0xe1')];_0x1af204[_0x778e('0xee')]=_0x1c5a48[_0x778e('0xee')];hopperUtils[_0x778e('0xef')](_0x1af204)[_0x778e('0xa8')](loggerCatch(_0x778e('0xf0')));}})[_0x778e('0xa4')](function(){if(_0x5cffe1)hopperUtils['swapAdditionalPhones'](_0x1c5a48,_0x3b689e,_0x35fab2)[_0x778e('0xa4')](function(){return 0x1;});});}}}};Dialer[_0x778e('0x89')][_0x778e('0x35')]=function(_0x1ab4e4){if(this[_0x778e('0xf1')][_0x1ab4e4['uniqueid']]){this[_0x778e('0xf1')][_0x1ab4e4[_0x778e('0xc2')]][_0x778e('0xf2')]=_0x1ab4e4['channel'];}if(this['uniqueId'][_0x1ab4e4[_0x778e('0xc2')]]){this['uniqueId'][_0x1ab4e4[_0x778e('0xc2')]][_0x778e('0xf2')]=_0x1ab4e4[_0x778e('0xf2')];}};Dialer[_0x778e('0x89')][_0x778e('0x39')]=function(_0xf021bf){if(!this['actions'][_0xf021bf[_0x778e('0xf3')]]){return;}var _0x3f89d5=this[_0x778e('0x1a')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]]['queue']]['strategy']||_0x778e('0xf4');if(_0x3f89d5===_0x778e('0xf5')){if(this[_0x778e('0xf1')][_0xf021bf['actionid']]&&_[_0x778e('0xf6')](this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf7')])&&_0xf021bf[_0x778e('0x8d')]==='1'&&_0xf021bf[_0x778e('0xf8')]==='0'){if(this[_0x778e('0x1c')][_0xf021bf[_0x778e('0xf9')]]){if(!this['agents'][_0xf021bf[_0x778e('0xf9')]][_0x778e('0xf7')]){this[_0x778e('0x1c')][_0xf021bf['stateinterface']][_0x778e('0xf7')]=!![];this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf7')]=!![];this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf9')]=_0xf021bf[_0x778e('0xf9')];}}}}else if(_0x3f89d5===_0x778e('0xf4')){if(this['actions'][_0xf021bf[_0x778e('0xf3')]]){if(this[_0x778e('0x1c')][_0xf021bf[_0x778e('0xf9')]]){this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf9')]=_0xf021bf[_0x778e('0xf9')];if(_[_0x778e('0xf6')](this[_0x778e('0x25')][this['actions'][_0xf021bf['actionid']]['queue']])){this[_0x778e('0x25')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xc1')]]=[];}this[_0x778e('0x25')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xc1')]][_0x778e('0xfa')](_['merge'](_[_0x778e('0x76')](this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]],[_0x778e('0xfb'),'stateinterface']),{'status':_0xf021bf[_0x778e('0x8d')],'paused':_0xf021bf[_0x778e('0xf8')]}));}}}};Dialer[_0x778e('0x89')][_0x778e('0x3b')]=function(_0x34c405){if(!this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]){return;}var _0x2b0f09=this;var _0x2c7fe8=this[_0x778e('0x1a')][this['actions'][_0x34c405[_0x778e('0xf3')]]['queue']];var _0x500857=_0x2c7fe8['strategy']||_0x778e('0xf4');if(_0x500857===_0x778e('0xf5')){if(this['actions'][_0x34c405[_0x778e('0xf3')]]&&this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')]){this[_0x778e('0x19')][_0x778e('0xfc')](this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['idHopper'],this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')])['catch'](function(_0x131982){logger[_0x778e('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x778e('0x43')](_0x131982,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2b0f09[_0x778e('0xc4')](_0x2b0f09['voiceQueues'][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]);_0x2b0f09[_0x778e('0x1c')][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')]]['locked']=![];delete _0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]];unlockQueueStatus(_0x2c7fe8);});}else{this[_0x778e('0xc4')](this[_0x778e('0x1a')][this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]);hopperUtils[_0x778e('0xec')]({'active':![],'ContactId':this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdc')],'ListId':this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdd')],'VoiceQueueId':this['actions'][_0x34c405['actionid']][_0x778e('0xde')]||undefined,'CampaignId':this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdf')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x778e('0xf1')][_0x34c405['actionid']];unlockQueueStatus(_0x2c7fe8);}}else if(_0x500857===_0x778e('0xf4')){var _0x47ed19;if(this['actions'][_0x34c405[_0x778e('0xf3')]]&&!_[_0x778e('0x98')](this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405['actionid']][_0x778e('0xc1')]])){if(this[_0x778e('0x26')][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]){this['queueBookedRR'][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]=this[_0x778e('0x26')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]?this['queueBookedRR'][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]:this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]?this[_0x778e('0x25')][this['actions'][_0x34c405['actionid']][_0x778e('0xc1')]][_0x778e('0xfd')]||0x0:0x0;}this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]][_0x778e('0xfd')]=this[_0x778e('0x26')][this['actions'][_0x34c405['actionid']][_0x778e('0xc1')]];for(var _0x55fcc5=0x0;_0x55fcc5=_0x132b3b['dialGlobalMaxRetry']){_0xa8e75d[_0x778e('0x124')](_0x22d1ff,_0x35f654,_0x17c959,_0x778e('0x125'));}else{if(_0x22d1ff[_0x778e('0x11f')]>=_0x132b3b[_0x778e('0x126')]){_0xa8e75d[_0x778e('0x127')](_0x22d1ff,_0x35f654,_0x17c959,'reason\x2019\x20machine....');}else{hopperUtils[_0x778e('0xec')]({'active':![],'countmachineretry':_0x22d1ff[_0x778e('0x11f')],'scheduledat':moment()['add'](_0x132b3b[_0x778e('0x128')],_0x778e('0xdb'))['format'](_0x778e('0xcb')),'ContactId':_0x22d1ff[_0x778e('0xdc')],'ListId':_0x22d1ff[_0x778e('0xdd')],'VoiceQueueId':_0x22d1ff[_0x778e('0xde')]||undefined,'CampaignId':_0x22d1ff[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));_0x35f654({'reschedule':0x1});}}});}if(_0x3e47b4[_0x778e('0xc3')]===_0x778e('0xc6')&&this[_0x778e('0x1b')][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0x112')]&&_0x1531d8[_0x778e('0x113')]===_0x778e('0x114')){delete this['uniqueId'][_0x1531d8['uniqueid']];this[_0x778e('0xc4')](this[_0x778e('0x1b')][_0x3e47b4['queue']]);_0x52bc5d=new Hangup(_0x3e47b4,_0x1531d8);_0x52bc5d[_0x778e('0x6f')]=0x12;_0x52bc5d[_0x778e('0x70')]=_0x778e('0x116');_0x52bc5d[_0x778e('0x117')]=_0x778e('0x118');ami[_0x778e('0x3f')](_0x778e('0x119'),ut[_0x778e('0x120')](_0x52bc5d,_0x778e('0x11a')));this[_0x778e('0x11b')](_0x52bc5d,_0x778e('0x12a'),_0x778e('0x12b'));}if(_0x3e47b4[_0x778e('0xc3')]===_0x778e('0xc6')&&this['campaigns'][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0x112')]&&_0x1531d8[_0x778e('0x113')]===_0x778e('0x11d')){return new Promise(function(_0x42f0e4,_0x4be50f){delete _0xa8e75d[_0x778e('0x21')][_0x1531d8[_0x778e('0xc2')]];_0xa8e75d[_0x778e('0xc4')](_0xa8e75d['campaigns'][_0x3e47b4[_0x778e('0xc1')]]);_0xa8e75d[_0x778e('0x1b')][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0xc7')]+=0x1;_0xa8e75d['campaigns'][_0x3e47b4['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x1755e7=_0xa8e75d[_0x778e('0x1b')][_0x3e47b4['queue']];var _0x101eac=new Hangup(_0x3e47b4,_0x1531d8);_0x101eac[_0x778e('0x6f')]=0x13;_0x101eac['statedesc']=_0x778e('0x11e');_0x101eac[_0x778e('0x117')]=_0x778e('0x118');_0x101eac[_0x778e('0x11f')]+=0x1;_0x101eac[_0x778e('0xd4')]+=0x1;_0x101eac[_0x778e('0x11a')]=!![];ami[_0x778e('0x3f')]('custom:amd',ut[_0x778e('0x120')](_0x101eac,_0x778e('0x11a')));hopperUtils['createHistory'](_0x101eac)[_0x778e('0xa8')](loggerCatch(_0x778e('0x121')));if(_0x101eac[_0x778e('0x12c')]+_0x101eac[_0x778e('0x12d')]+_0x101eac[_0x778e('0x122')]+_0x101eac[_0x778e('0x12e')]+_0x101eac[_0x778e('0xd8')]+_0x101eac[_0x778e('0xe7')]+_0x101eac[_0x778e('0x11f')]+_0x101eac[_0x778e('0x123')]>=_0x1755e7[_0x778e('0x12f')]){_0xa8e75d[_0x778e('0x124')](_0x101eac,_0x42f0e4,_0x4be50f,_0x778e('0x125'));}else{if(_0x101eac['countmachineretry']>=_0x1755e7['dialMachineMaxRetry']){_0xa8e75d[_0x778e('0x127')](_0x101eac,_0x42f0e4,_0x4be50f,_0x778e('0x130'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x101eac[_0x778e('0x11f')],'scheduledat':moment()[_0x778e('0xd9')](_0x1755e7[_0x778e('0x128')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101eac['ContactId'],'ListId':_0x101eac['ListId'],'VoiceQueueId':_0x101eac[_0x778e('0xde')]||undefined,'CampaignId':_0x101eac[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));_0x42f0e4({'reschedule':0x1});}}});}}};Dialer[_0x778e('0x89')][_0x778e('0x33')]=function(_0x4831b3){var _0x4d0149=this['uniqueId'][_0x4831b3['uniqueid']];var _0x4b09a2;if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]==='ivr'){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this[_0x778e('0xc4')](this[_0x778e('0x1b')][_0x4d0149[_0x778e('0xc1')]]);this[_0x778e('0x1b')][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x131')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);hopperUtils[_0x778e('0xef')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x132')));}if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]!==_0x778e('0xc6')&&isNotNull(this[_0x778e('0x1a')][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x133')])){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this[_0x778e('0xc4')](this[_0x778e('0x1a')][_0x4d0149['queue']]);this[_0x778e('0x1a')][_0x4d0149['queue']][_0x778e('0xc7')]+=0x1;this[_0x778e('0x1a')][_0x4d0149['queue']][_0x778e('0x115')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);_0x4b09a2[_0x778e('0x6f')]=0x10;_0x4b09a2['statedesc']=_0x778e('0x134');_0x4b09a2[_0x778e('0x117')]=_0x778e('0x135');hopperUtils[_0x778e('0xef')](_0x4b09a2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x132')));}if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]!==_0x778e('0xc6')&&!isNotNull(this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x133')])){if(_0x4831b3[_0x778e('0x136')]===_0x778e('0x137')){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this['voiceQueues'][_0x4d0149['queue']][_0x778e('0xc7')]+=0x1;const _0x13c7bc=new AgentComplete(_0x4d0149,_0x4831b3);_0x13c7bc[_0x778e('0xdf')]=this[_0x778e('0x1a')][_0x4d0149[_0x778e('0xc1')]]['id'];hopperUtils[_0x778e('0xef')](_0x13c7bc)[_0x778e('0xa8')](loggerCatch(_0x778e('0x138')));hopperUtils[_0x778e('0xcc')](_0x13c7bc)[_0x778e('0xa8')](loggerCatch(_0x778e('0xcd')));}else{delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this['updateOriginated'](this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]]);this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x139')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);_0x4b09a2[_0x778e('0x6f')]=0xc;_0x4b09a2[_0x778e('0x70')]=_0x4831b3[_0x778e('0x136')];_0x4b09a2['membername']=_0x778e('0x13a');hopperUtils[_0x778e('0xef')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x13b')));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x778e('0x89')][_0x778e('0x2f')]=function(_0xf2d280){var _0xda2ff=this;if(!_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']]){_0xda2ff[_0x778e('0x13c')][_0xf2d280[_0x778e('0x45')]]={'running':![]};}else if(_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']][_0x778e('0x13d')]===!![]){return;}else if(_0xda2ff[_0x778e('0x13c')][_0xf2d280[_0x778e('0x45')]][_0x778e('0x13d')]===![]){_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']]['running']=!![];}var _0xed070b=_0xda2ff[_0x778e('0x1a')][_0xf2d280[_0x778e('0x45')]];var _0x40631e=_0xed070b[_0x778e('0x6c')]!==utils[_0x778e('0x68')][_0x778e('0x7c')];var _0x2d711c=utils[_0x778e('0x13e')](_0xed070b);_0xed070b[_0x778e('0x13f')]=utils[_0x778e('0x140')](_0xed070b,_0xda2ff[_0x778e('0x1d')]);Promise[_0x778e('0x141')]()[_0x778e('0xa4')](function(){if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')][_0x778e('0x7c')]){if(_0x40631e){clearPredictiveAttributes(_0xed070b);_0xf2d280['startPredictive']=undefined;_0xf2d280[_0x778e('0x24')]=undefined;}if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')][_0x778e('0x7c')]){_0xf2d280[_0x778e('0x142')]=0x0;_0xf2d280[_0x778e('0xf8')]=0x0;_0xf2d280[_0x778e('0x143')]=0x0;_0xf2d280[_0x778e('0x144')]=0x0;_0xf2d280[_0x778e('0x145')]=0x0;}}else if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')]['ACTIVE']&&!_0x2d711c){return _0xda2ff[_0x778e('0x96')](_0xed070b,!![])[_0x778e('0xa4')](function(){return _0xda2ff[_0x778e('0x96')](_0xed070b,![]);})[_0x778e('0xa4')](function(){return _0xda2ff['checkDialMethod'](_0xed070b);})['catch'](function(_0x57f0c0){loggerSyncQueueSummary[_0x778e('0x41')](_0x778e('0x146'),util[_0x778e('0x43')](_0x57f0c0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xed070b);});}else{clearPredictiveAttributes(_0xed070b);}})[_0x778e('0xa4')](function(){var _0x2b51fa=_0xf2d280[_0x778e('0x147')](_0xed070b);if(_0x2b51fa||_0xed070b['queueSummaryCountersUpdated']){_0xed070b[_0x778e('0x148')]=![];_0xf2d280['updateReportFromOutboundQueue'](_0xed070b);Object['assign'](_0xed070b,_0xf2d280);emitOutboundVoiceQueueSummary(_0xf2d280);}_0xda2ff[_0x778e('0x13c')][_0xed070b['name']]['running']=![];})[_0x778e('0xa8')](function(_0x151f74){logger[_0x778e('0x64')]('[syncQueueSummary]',util[_0x778e('0x43')](_0x151f74,{'showHidden':![],'depth':null}));_0xda2ff[_0x778e('0x13c')][_0xed070b[_0x778e('0x45')]][_0x778e('0x13d')]=![];});};Dialer[_0x778e('0x89')]['syncQueueSummaryComplete']=_[_0x778e('0x149')](function(){var _0x59da6b=_['filter'](this[_0x778e('0x1a')],function(_0x47fccb){return _0x47fccb[_0x778e('0x14a')];});var _0x3e5738=_[_0x778e('0x14b')](this[_0x778e('0x1c')],function(_0x535202){return _0x535202[_0x778e('0x14c')]&&_0x535202[_0x778e('0x8d')]===_0x778e('0x8e');});if(_0x59da6b[_0x778e('0xa0')]>0x0&&_0x3e5738[_0x778e('0xa0')]>0x0){return Promise[_0x778e('0x141')]()[_0x778e('0xa4')](cmHopper[_0x778e('0x14d')](_[_0x778e('0x14e')](_0x59da6b,'id'),previewRecallmeReminderInterval,_['map'](_0x3e5738,'id')))[_0x778e('0xa4')](function(_0x4f5079){for(var _0x1e7ee8=0x0;_0x1e7ee8<_0x4f5079[_0x778e('0xa0')];_0x1e7ee8++){var _0xc2b958=_0x4f5079[_0x1e7ee8][_0x778e('0x14f')]['name'];if(_0xc2b958)io['to'](util[_0x778e('0x7f')](_0x778e('0x150'),_0xc2b958))[_0x778e('0x3f')]('user:dialPreviewRecallReminder',{'hopper':_0x4f5079[_0x1e7ee8]});}})[_0x778e('0xa8')](function(_0x2a569e){logger[_0x778e('0x64')]('checkPreviewRecallReminder',_0x2a569e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x778e('0x89')][_0x778e('0x151')]=function(){var _0x289ea9=this;setInterval(function(){_0x289ea9['clearZombieChannels'](_0x289ea9['uniqueId'],_0x778e('0x152'));_0x289ea9[_0x778e('0x153')](_0x289ea9[_0x778e('0xf1')],_0x778e('0x154'));},0x32c8);};Dialer[_0x778e('0x89')]['clearZombieChannels']=function(_0xa3d19e,_0x5ec2e2){var _0xdf89c1=this;for(var _0x60268a in _0xa3d19e){if(typeof _0xa3d19e[_0x60268a]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x778e('0xf6')](_0xa3d19e[_0x60268a])){return ami[_0x778e('0xa9')]({'action':_0x778e('0x8d'),'channel':_0xa3d19e[_0x60268a]['channel']})[_0x778e('0xa8')](function(_0x569530){if(_0x569530[_0x778e('0x6c')]===_0x778e('0x155')){setTimeout(function(){if(_0xa3d19e[_0x60268a]&&_0xa3d19e[_0x60268a][_0x778e('0xc3')]!=='ivr'){_0xdf89c1['updateOriginated'](_0xdf89c1[_0x778e('0x1a')][_0xa3d19e[_0x60268a]['queue']]);logger['error'](_0x778e('0x156'),_0x5ec2e2,_0x60268a,_0xa3d19e[_0x60268a][_0x778e('0xc1')]);delete _0xa3d19e[_0x60268a];}if(_0xa3d19e[_0x60268a]&&_0xa3d19e[_0x60268a][_0x778e('0xc3')]===_0x778e('0xc6')){_0xdf89c1['updateOriginated'](_0xdf89c1[_0x778e('0x1b')][_0xa3d19e[_0x60268a][_0x778e('0xc1')]]);logger[_0x778e('0x64')](_0x778e('0x157'),_0x5ec2e2,_0x60268a,_0xa3d19e[_0x60268a]['queue']);delete _0xa3d19e[_0x60268a];}},0x2328);}});}});}}};Dialer[_0x778e('0x89')][_0x778e('0x158')]=function(_0xfdb7e1){return Promise[_0x778e('0x141')]()['then'](voiceQueueRt[_0x778e('0x158')](_0xfdb7e1))[_0x778e('0xa8')](loggerCatch(_0x778e('0x159')));};Dialer['prototype']['updateOriginated']=function(_0x4a279c){if(!_['isUndefined'](_0x4a279c)&&_0x4a279c!==null){if(typeof _0x4a279c[_0x778e('0x82')]!==_0x778e('0x15a')){if(_0x4a279c['originated']>0x0){_0x4a279c['originated']-=0x1;}else{logger[_0x778e('0x64')](_0x778e('0x15b'));}}}else{logger['error'](_0x778e('0x15c'));}};Dialer[_0x778e('0x89')]['loggerHandler']=function(_0x46fe2a,_0x1c8b0a){var _0x7048b7=this;return function(_0x2494e7){_0x7048b7['updateOriginated'](_0x1c8b0a);logger[_0x778e('0x64')](_0x46fe2a,util[_0x778e('0x43')](_0x2494e7,{'showHidden':![],'depth':null}));};};Dialer[_0x778e('0x89')]['emptyContact']=function(_0x57c0fb,_0x35b8b7,_0x3885a8){var _0x588a0d={'state':0x19,'statedesc':_0x778e('0x15d')};this[_0x778e('0xc4')](_0x35b8b7);this[_0x778e('0x11b')](_[_0x778e('0x15e')](_0x588a0d,_[_0x778e('0x76')](_0x3885a8,['ContactId','ListId',_0x778e('0x15f'),_0x778e('0xde'),_0x778e('0xdf')])),_0x778e('0x160'),_0x778e('0x161'));logger[_0x778e('0x64')](_0x57c0fb);};Dialer[_0x778e('0x89')][_0x778e('0x11b')]=function(_0x45b929,_0x499e70,_0x1bd1cf){hopperUtils[_0x778e('0xef')](_0x45b929)['catch'](loggerCatch(_0x499e70));hopperUtils['moveContactManagedDialer'](_0x45b929)[_0x778e('0xa8')](loggerCatch(_0x1bd1cf));};Dialer[_0x778e('0x89')][_0x778e('0xd7')]=function(_0x13d130,_0xfc25e1){hopperUtils['createHistory'](_0x13d130)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0xfc25e1==0x0){hopperUtils[_0x778e('0xcc')](_0x13d130)[_0x778e('0xa8')](loggerCatch(_0x778e('0x162')));}};Dialer[_0x778e('0x89')]['checkPreviewRecallReminder']=function(_0x485092){return Promise[_0x778e('0x141')]()['then'](cmHopper[_0x778e('0x14d')](_0x485092['id'],previewRecallmeReminderInterval))[_0x778e('0xa4')](function(_0x4b8047){for(var _0x405034=0x0;_0x405034<_0x4b8047['length'];_0x405034++){var _0x2842ef=_0x4b8047[_0x405034]['Agent'][_0x778e('0x45')];if(_0x2842ef)io['to'](util['format'](_0x778e('0x150'),_0x2842ef))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x4b8047[_0x405034]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x424558){var _0x54705e=this;return function(){_0x54705e[_0x778e('0x163')](_0x424558);};};Dialer[_0x778e('0x89')][_0x778e('0x164')]=function(_0x36830a,_0x38763b){var _0x5941c4=this;var _0x41e2a2=uuid['v4']();this[_0x778e('0xf1')][_0x41e2a2]=new Action(_0x36830a,_0x38763b,_0x41e2a2);return new Promise(function(_0x4801ef,_0x487f26){if(_[_0x778e('0x54')](_0x36830a)&&typeof _0x36830a!==_0x778e('0x165')){return _0x487f26(msgResponse(_0x778e('0x166'),_0x778e('0x9a'),_0x778e('0x167')));}if(_[_0x778e('0x54')](_0x38763b[_0x778e('0x168')])||_0x38763b['phone']===null){return _0x487f26(msgResponse(_0x778e('0x166'),_0x778e('0x9a'),_0x778e('0x169')));}var _0x1a27e8={'XMD-CALLERID':_0x5941c4[_0x778e('0xf1')][_0x41e2a2]['getCaller'](),'XMD-AGI':_0x36830a['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x36830a[_0x778e('0x133')]):_0x778e('0x16a'),'XMD-AGIAFTER':_0x36830a['dialQueueProject2']?util[_0x778e('0x7f')](_0x778e('0x16b'),ipAgi,_0x36830a[_0x778e('0xc9')]):_0x778e('0x16a'),'XMD-QUEUE':utils[_0x778e('0x16c')](_0x36830a)?util['format'](_0x778e('0x16d'),_0x36830a[_0x778e('0x45')],_0x36830a[_0x778e('0x16e')]||'',_0x36830a[_0x778e('0xca')]?'c':'',_0x36830a[_0x778e('0xd0')]||0x3):'NONE','XMD-CONTACTID':_0x38763b['ContactId'],'XMD-CDRTYPE':_0x778e('0x7'),'CALLERID(all)':_0x5941c4[_0x778e('0xf1')][_0x41e2a2][_0x778e('0x16f')](),'XMD-AMD':_0x36830a[_0x778e('0x112')]?'ACTIVE':_0x778e('0x16a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x36830a[_0x778e('0x112')]){_0x1a27e8[_0x778e('0x170')]=_0x36830a['dialAMDInitialSilence']||0x9c4;_0x1a27e8['XMD-AMDGREETING']=_0x36830a[_0x778e('0x171')]||0x5dc;_0x1a27e8[_0x778e('0x172')]=_0x36830a[_0x778e('0x173')]||0x320;_0x1a27e8[_0x778e('0x174')]=_0x36830a[_0x778e('0x175')]||0x1388;_0x1a27e8['XMD-AMDMINWORDLENGTH']=_0x36830a[_0x778e('0x176')]||0x64;_0x1a27e8[_0x778e('0x177')]=_0x36830a[_0x778e('0x178')]||0x32;_0x1a27e8[_0x778e('0x179')]=_0x36830a['dialAMDMaximumNumberOfWords']||0x3;_0x1a27e8['XMD-AMDSILENCETHRESHOLD']=_0x36830a['dialAMDSilenceThreshold']||0x100;_0x1a27e8[_0x778e('0x17a')]=_0x36830a['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x778e('0x16c')](_0x36830a)){_0x1a27e8[_0x778e('0x17b')]=_0x38763b[_0x778e('0xde')];}else{_0x1a27e8[_0x778e('0x17c')]=_0x38763b[_0x778e('0xdf')];}var _0xebf88f=utils[_0x778e('0x17d')](_0x38763b[_0x778e('0x17e')]);Object[_0x778e('0x17f')](_0x1a27e8,_0xebf88f);var _0x7574ce=_0x5941c4[_0x778e('0x8a')](_0x36830a['Trunk'])?utils[_0x778e('0x180')](_0x36830a['Trunk'][_0x778e('0x181')],_0x36830a[_0x778e('0x182')],_0x36830a[_0x778e('0x183')]>0x0?utils['getCallerIdRandom'](_0x36830a[_0x778e('0x184')],_0x36830a[_0x778e('0x183')]):_0x36830a[_0x778e('0x184')]):utils[_0x778e('0x180')](_[_0x778e('0xf6')](_0x36830a[_0x778e('0x185')])?_0x36830a[_0x778e('0x186')]['callerid']:_0x36830a[_0x778e('0x185')][_0x778e('0x181')],_0x36830a['dialOriginateCallerIdName'],_0x36830a[_0x778e('0x183')]>0x0?utils[_0x778e('0x187')](_0x36830a['dialOriginateCallerIdNumber'],_0x36830a[_0x778e('0x183')]):_0x36830a[_0x778e('0x184')]);if(_0x7574ce){_0x1a27e8[_0x778e('0x188')]=_0x5941c4[_0x778e('0xf1')][_0x41e2a2]['originatecalleridname']=utils[_0x778e('0x189')](_0x7574ce);_0x1a27e8[_0x778e('0x18a')]=_0x38763b[_0x778e('0x168')];}_0x36830a[_0x778e('0x18b')]=_0x1a27e8;return ami[_0x778e('0xa9')]({'actionid':_0x41e2a2,'action':_0x778e('0x166'),'channel':_0x5941c4[_0x778e('0x8a')](_0x36830a[_0x778e('0x186')])?util['format']('SIP/%s/%s%s',_0x36830a[_0x778e('0x186')]['name'],isNotNull(_0x36830a[_0x778e('0x18c')])?_0x36830a[_0x778e('0x18c')][_0x778e('0x18d')]()||'':'',_0x36830a[_0x778e('0x18e')]>0x0?_0x38763b[_0x778e('0x168')][_0x778e('0x18f')](_0x36830a['dialCutDigit']):_0x38763b[_0x778e('0x168')]):util[_0x778e('0x7f')](_0x778e('0x190'),_['isNil'](_0x36830a['TrunkBackup'])?_0x36830a['Trunk'][_0x778e('0x45')]:_0x36830a['TrunkBackup']['name'],isNotNull(_0x36830a[_0x778e('0x18c')])?_0x36830a[_0x778e('0x18c')][_0x778e('0x18d')]()||'':'',_0x36830a['dialCutDigit']>0x0?_0x38763b[_0x778e('0x168')][_0x778e('0x18f')](_0x36830a[_0x778e('0x18e')]):_0x38763b[_0x778e('0x168')]),'callerid':_0x7574ce,'Exten':_0x778e('0x111'),'Context':_0x778e('0x191'),'Priority':'1','variable':_0x1a27e8,'timeout':(_0x36830a[_0x778e('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41e2a2})['then'](function(_0x239ad1){return _0x4801ef(_0x239ad1);})[_0x778e('0xa8')](function(_0x26dfb3){_0x36830a[_0x778e('0x193')]+=0x1;var _0x20bdaf=new History(_0x5941c4[_0x778e('0xf1')][_0x41e2a2]);logger['error'](util[_0x778e('0x7f')](_0x778e('0x194'),JSON[_0x778e('0x75')](_0x26dfb3)));_0x20bdaf[_0x778e('0x6f')]=0xe;_0x20bdaf['statedesc']=_0x778e('0x195');_0x20bdaf['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20bdaf[_0x778e('0x71')]=_0x20bdaf[_0x778e('0x72')];hopperUtils[_0x778e('0xef')](_0x20bdaf)[_0x778e('0xa8')](loggerCatch(_0x778e('0x196')));_0x5941c4[_0x778e('0xcc')](_0x20bdaf)['catch'](loggerCatch(_0x778e('0x196')))['finally'](function(){delete _0x5941c4['actions'][_0x41e2a2];return _0x487f26(msgResponse('originate',_0x778e('0x88'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x778e('0x197')]=function(_0x2d3b3c,_0x389a67,_0x3d7240){var _0x42a00d=new History(_0x389a67);if(_0x42a00d[_0x778e('0x12c')]+_0x42a00d[_0x778e('0x12d')]+_0x42a00d[_0x778e('0x122')]+_0x42a00d[_0x778e('0x12e')]+_0x42a00d['countdropretry']+_0x42a00d[_0x778e('0xe7')]+_0x42a00d['countmachineretry']+_0x42a00d[_0x778e('0x123')]>=_0x3d7240[_0x778e('0x12f')]-0x1){return!![];}switch(_0x2d3b3c){case 0x3:if(_0x42a00d[_0x778e('0x122')]>=_0x3d7240[_0x778e('0x198')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countnoanswerretry':_0x42a00d[_0x778e('0x122')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x199')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x42a00d[_0x778e('0x12c')]>=_0x3d7240['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x42a00d[_0x778e('0x12c')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x19a')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x19b')));break;case 0x8:if(_0x42a00d[_0x778e('0x12d')]>=_0x3d7240[_0x778e('0x19c')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countcongestionretry':_0x42a00d[_0x778e('0x12d')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240[_0x778e('0x19d')],'minutes')[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x19e')));break;case 0x0:if(_0x42a00d[_0x778e('0x12e')]>=_0x3d7240['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x778e('0xec')]({'active':![],'countnosuchnumberretry':_0x42a00d[_0x778e('0x12e')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240[_0x778e('0x19f')],_0x778e('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x42a00d['countdropretry']>=_0x3d7240[_0x778e('0x1a0')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countdropretry':_0x42a00d['countdropretry']+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240['dialDropRetryFrequency'],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d['ContactId'],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d['CampaignId']||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0xe0')));break;case 0xb:if(_0x42a00d['countabandonedretry']>=_0x3d7240[_0x778e('0xeb')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countabandonedretry':_0x42a00d['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x3d7240['dialAbandonedRetryFrequency'],_0x778e('0xdb'))['format'](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x42a00d[_0x778e('0x11f')]>=_0x3d7240[_0x778e('0x126')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countmachineretry':_0x42a00d[_0x778e('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x128')],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));break;case 0x14:if(_0x42a00d['countagentrejectretry']>=_0x3d7240[_0x778e('0x1a1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x42a00d[_0x778e('0x123')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1a2')));break;default:return!![];}};Dialer[_0x778e('0x89')][_0x778e('0x10c')]=function(_0x3897ba,_0x170cb7,_0x2f7e00){var _0x58e3af=this;var _0x46626e=new History(_0x3897ba);var _0x578bb5=![];var _0x3d33d6;var _0x1f1860;return new Promise(function(_0x54fa0e,_0x1adede){if(_[_0x778e('0x54')](_0x170cb7)&&typeof _0x170cb7!=='object'){return _0x1adede(msgResponse('[callProgressDetecting]',_0x778e('0x9a'),_0x778e('0x1a3')));}if(_['isUndefined'](_0x2f7e00)&&typeof _0x2f7e00!=='object'){return _0x1adede(msgResponse(_0x778e('0x1a4'),'Failure',_0x778e('0x1a5')));}hopperUtils[_0x778e('0xe9')](_0x46626e,_0x2f7e00[_0x778e('0x1a6')],_0x170cb7)[_0x778e('0xa4')](function(_0x3a3aee){if(_0x3a3aee[_0x778e('0xd6')]==0x1)_0x578bb5=!![];switch(_0x2f7e00[_0x778e('0x1a6')]){case'0':_0x170cb7[_0x778e('0x1a7')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x0;_0x46626e['statedesc']=_0x778e('0x1a8');_0x46626e[_0x778e('0x12e')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;ami[_0x778e('0x3f')](_0x778e('0x1a9'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1aa')));_0x3d33d6=_0x170cb7['dialNoSuchNumberRetryFrequency'];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0x121')));if(_0x58e3af['checkRetriveMax'](0x0,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e['countnosuchnumberretry']>=_0x170cb7['dialNoSuchNumberMaxRetry']){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ab'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x170cb7['outboundNoAnswerCallsDay']+=0x1;_0x46626e[_0x778e('0x6f')]=0x3;_0x46626e[_0x778e('0x70')]=_0x778e('0x1ac');_0x46626e[_0x778e('0x122')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;var _0x2373dc=ut[_0x778e('0x1ad')](_0x3897ba,_0x170cb7);ami['emit']('custom:agentnoanswer',_0x2373dc);_0x3d33d6=_0x170cb7[_0x778e('0x199')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ae')));if(_0x58e3af['checkRetriveMax'](0x3,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x122')]>=_0x170cb7[_0x778e('0x198')]){_0x58e3af['createStateFinal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x203\x20ringing\x20no\x20answer');}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1af'));}}break;case'5':_0x170cb7[_0x778e('0x1b0')]+=0x1;_0x46626e['state']=0x5;_0x46626e['statedesc']=_0x778e('0x1b1');_0x46626e[_0x778e('0x12c')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;ami[_0x778e('0x3f')](_0x778e('0x1b2'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1b3')));_0x3d33d6=_0x170cb7[_0x778e('0x19a')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)['catch'](loggerCatch(_0x778e('0x1b4')));if(_0x58e3af[_0x778e('0x197')](0x5,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12c')]>=_0x170cb7[_0x778e('0x1b5')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1b6'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1b6'));}}break;case'8':_0x170cb7[_0x778e('0x1b7')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x8;_0x46626e['statedesc']='Congestion';_0x46626e[_0x778e('0x12d')]+=0x1;_0x46626e['countglobal']+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0x19d')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];ami[_0x778e('0x3f')](_0x778e('0x1b8'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1b9')));hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x58e3af[_0x778e('0x197')](0x8,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12d')]>=_0x170cb7['dialCongestionMaxRetry']){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ba'));}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ba'));}}break;case'11':_0x170cb7['outboundAbandonedCallsDay']+=0x1;_0x46626e[_0x778e('0x6f')]=0xb;_0x46626e['statedesc']=_0x778e('0xe5');_0x46626e['countabandonedretry']+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0xe8')];_0x1f1860=_0x170cb7['callAdditionalPhoneAfterMin'];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0xf0')));if(_0x58e3af[_0x778e('0x197')](0xb,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0xe7')]>=_0x170cb7[_0x778e('0xeb')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1bb'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x2011\x20abandoned');}}break;case'20':_0x170cb7[_0x778e('0x1bc')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x14;_0x46626e['statedesc']=_0x778e('0x1bd');_0x46626e[_0x778e('0x123')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0x1be')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];ami[_0x778e('0x3f')](_0x778e('0x1bf'),ut['buildObj'](_0x3897ba,_0x778e('0x1c0')));hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x58e3af[_0x778e('0x197')](0x14,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e['countagentrejectretry']>=_0x170cb7[_0x778e('0x1a1')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1c1'));}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1c1'));}}break;default:_0x170cb7[_0x778e('0x139')]+=0x1;_0x46626e[_0x778e('0x6f')]=0xc;_0x46626e[_0x778e('0x70')]=_0x2f7e00[_0x778e('0x1a6')];_0x3d33d6=_0x170cb7[_0x778e('0x1be')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x58e3af['checkRetriveMax'](_0x2f7e00[_0x778e('0x1a6')],_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12c')]+_0x46626e['countcongestionretry']+_0x46626e[_0x778e('0x122')]+_0x46626e[_0x778e('0x12e')]+_0x46626e[_0x778e('0xd8')]+_0x46626e['countabandonedretry']+_0x46626e[_0x778e('0x11f')]+_0x46626e[_0x778e('0x123')]>=_0x170cb7[_0x778e('0x12f')]){_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x2f7e00[_0x778e('0x1a6')]);}else{_0x58e3af['createStateFinal'](_0x46626e,_0x54fa0e,_0x1adede,_0x2f7e00[_0x778e('0x1a6')]);}}}})['then'](function(){if(_0x578bb5){hopperUtils[_0x778e('0xe3')](_0x46626e,_0x3d33d6,_0x1f1860)[_0x778e('0xa4')](function(){return _0x54fa0e(0x1);});}});});};Dialer[_0x778e('0x89')][_0x778e('0x124')]=function(_0xb2268c,_0x14169b,_0x2701db,_0x1a1cf3){var _0x37097d=new Final(_0xb2268c);_0x37097d[_0x778e('0x6f')]=0xf;_0x37097d['statedesc']=_0x778e('0x1c2');this[_0x778e('0x127')](_0x37097d,_0x14169b,_0x2701db,_0x1a1cf3);};Dialer[_0x778e('0x89')][_0x778e('0x127')]=function(_0x889dcb,_0x32b173,_0x5be05c,_0x5e7a3e){hopperUtils['moveContactManagedDialer'](_0x889dcb)[_0x778e('0xa4')](function(){return _0x32b173(msgResponse('[callProgressDetecting]',_0x778e('0x10b'),_0x5e7a3e));})['catch'](function(){return _0x5be05c(msgResponse('[moveContactManagedDialer][0]',_0x778e('0x9a'),_0x778e('0x1c3')));});};Dialer['prototype'][_0x778e('0x8')]=function(_0x53dec7){var _0x139f75=_0x53dec7[_0x778e('0x1c4')]/0x64;var _0x17f8f2=_0x53dec7[_0x778e('0x1c5')]/(_0x53dec7[_0x778e('0x1c5')]+_0x53dec7[_0x778e('0xc7')]);var _0x551167=Math['round'](_0x53dec7[_0x778e('0x1c6')]*(_0x53dec7['predictiveIntervalMaxThreshold']/0x64));var _0x4d9450=Math[_0x778e('0x1c7')](_0x53dec7[_0x778e('0x1c6')]*(_0x53dec7[_0x778e('0x1c8')]/0x64));var _0x4e3882=_0x53dec7[_0x778e('0x142')]+_0x53dec7['talking'];var _0x25c9ec=Math['floor'](_0x53dec7[_0x778e('0x5b')]*_0x53dec7[_0x778e('0x5e')]*_0x53dec7['predictiveIntervalHitRate']*_0x53dec7[_0x778e('0x1c9')]);if(_[_0x778e('0x54')](_0x53dec7[_0x778e('0x24')])){if(!_['isUndefined'](_0x53dec7[_0x778e('0x23')])){_0x53dec7[_0x778e('0x23')]=undefined;loggerPredictive[_0x778e('0x64')](_0x778e('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x53dec7[_0x778e('0x62')])){loggerPredictive['error'](_0x778e('0x1ca'),_0x778e('0x1cb'));clearInterval(_0x53dec7[_0x778e('0x62')]);_0x53dec7[_0x778e('0x62')]=undefined;}_0x53dec7[_0x778e('0x24')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));loggerPredictive[_0x778e('0x48')](_0x53dec7['name'],_0x778e('0x1cc'),_0x53dec7[_0x778e('0x24')]);this[_0x778e('0xb7')](_0x53dec7,0x1);}else if(ifInterval(_0x53dec7[_0x778e('0x1cd')],_0x53dec7[_0x778e('0x24')])){this[_0x778e('0xb7')](_0x53dec7,0x1);loggerPredictiveCalls[_0x778e('0x48')](_0x778e('0x1ce'),_0x53dec7[_0x778e('0x24')],_0x53dec7[_0x778e('0x45')]);_0x53dec7[_0x778e('0x5b')]=0x0;_0x53dec7[_0x778e('0xd1')]=0x0;}else if(_0x139f75<_0x17f8f2&&_0x53dec7['dialPredictiveOptimization']===_0x778e('0x1cf')){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x778e('0x1d0'),_0x17f8f2,_0x778e('0x24'),_0x53dec7[_0x778e('0x45')]);}else if(_0x25c9ec<_0x53dec7[_0x778e('0xd1')]&&_0x53dec7[_0x778e('0x1d1')]===_0x778e('0x1cf')){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x778e('0x1d2'),_0x778e('0x1d3'),_0x25c9ec,_0x778e('0x1d4'),_0x53dec7[_0x778e('0xd1')],_0x778e('0x24'),_0x53dec7[_0x778e('0x45')]);}else if(!ifInterval(_0x53dec7['dialPredictiveInterval'],_0x53dec7[_0x778e('0x24')])&&_[_0x778e('0x54')](_0x53dec7[_0x778e('0x23')])&&!_[_0x778e('0x54')](_0x53dec7[_0x778e('0x24')])){_0x53dec7[_0x778e('0x23')]=moment()[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x53dec7[_0x778e('0x45')],'started\x20in\x20predictive\x20at',_0x53dec7[_0x778e('0x23')]);hopperUtils[_0x778e('0x1d5')](_0x53dec7['dialPredictiveInterval'])[_0x778e('0xa4')](this['getDataPredictive'](_0x53dec7))[_0x778e('0xa4')](mergeDataErlangB(_0x53dec7))[_0x778e('0xa4')](this['startMethodPredictive'](_0x53dec7))['catch'](loggerCatchPredictive(_0x778e('0x1d6'),_0x53dec7));}else if(!ifInterval(_0x53dec7[_0x778e('0x1cd')],_0x53dec7[_0x778e('0x23')])){_0x53dec7[_0x778e('0xd1')]=0x0;_0x53dec7[_0x778e('0x23')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));loggerPredictive['info'](_0x53dec7[_0x778e('0x45')],_0x778e('0x1d7'),_0x53dec7[_0x778e('0x23')]);clearInterval(_0x53dec7['handlePredictive']);_0x53dec7[_0x778e('0x62')]=undefined;hopperUtils[_0x778e('0x1d5')](_0x53dec7[_0x778e('0x1cd')])[_0x778e('0xa4')](this[_0x778e('0x1d8')](_0x53dec7))['then'](mergeDataErlangB(_0x53dec7))[_0x778e('0xa4')](this['startMethodPredictive'](_0x53dec7))['catch'](loggerCatchPredictive(_0x778e('0x1d9'),_0x53dec7));}else if(_0x53dec7[_0x778e('0x1c6')]&&_0x4e3882<_0x53dec7[_0x778e('0x1c6')]-_0x4d9450){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x53dec7[_0x778e('0x45')],_0x778e('0x1da'),_0x4e3882,_0x778e('0x1db'),_0x53dec7['predictiveIntervalAvailable'],'-',_0x4d9450,'=',_0x53dec7['predictiveIntervalAvailable']-_0x4d9450,')');}else if(_0x53dec7['predictiveIntervalAvailable']&&_0x4e3882>_0x53dec7[_0x778e('0x1c6')]+_0x551167){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x53dec7[_0x778e('0x45')],_0x778e('0x1da'),_0x4e3882,')\x20are\x20more\x20than\x20threshold\x20(',_0x53dec7[_0x778e('0x1c6')],'+',_0x551167,'=',_0x53dec7['predictiveIntervalAvailable']+_0x551167,')');}};Dialer[_0x778e('0x89')][_0x778e('0x1d8')]=function(_0x3e2f17){var _0x2afa50=this;return function(_0x32b023){return new Promise(function(_0x488514,_0x284236){_[_0x778e('0x15e')](_0x3e2f17,_0x32b023[0x0]);if(checkGetDataPredictive(_0x32b023[0x0])){var _0x18b5ba=_0x3e2f17[_0x778e('0x1c6')]=_0x3e2f17[_0x778e('0x144')]+_0x3e2f17['available'];var _0x4f531b=_0x3e2f17['dialPredictiveInterval']*0x3c;var _0xc2b7f4=_0x32b023[0x0][_0x778e('0x55')]+_0x32b023[0x0][_0x778e('0x52')];var _0x4b6920=(_0x32b023[0x0][_0x778e('0x4c')]+_0x32b023[0x0][_0x778e('0x4e')]+_0x32b023[0x0][_0x778e('0x50')])/_0x32b023[0x0][_0x778e('0x4a')];_0x3e2f17[_0x778e('0x1dc')]=_0x4b6920>0x0?_0x4b6920:0x1;switch(_0x3e2f17['dialPredictiveOptimization']){case'dropRate':var _0x33e95e=_0x3e2f17[_0x778e('0x1c4')]/0x64;return _0x2afa50[_0x778e('0x1dd')](_0x18b5ba,_0x4f531b,_0xc2b7f4,_0x4b6920,_0x33e95e)[_0x778e('0xa4')](function(_0x52de44){return _0x488514(_0x52de44);});case _0x778e('0x1de'):var _0x53dfdd=_0x3e2f17[_0x778e('0x1c4')]/0x64;return _0x2afa50[_0x778e('0x1df')](_0x18b5ba,_0x4f531b,_0xc2b7f4,_0x4b6920,_0x53dfdd)[_0x778e('0xa4')](function(_0x4e5769){return _0x488514(_0x4e5769);});default:return _0x284236(msgResponse(_0x778e('0x1e0'),_0x778e('0x9a'),'Unknown\x20Predictive'));}}else{return _0x284236(msgResponse(_0x778e('0x1e0'),'Failure',_0x778e('0x1e1')));}});};};Dialer[_0x778e('0x89')]['getDataPredictiveOld']=function(_0x42f100){var _0x1c411e=this;return function(_0x7e4105){return new Promise(function(_0x3c42bb,_0x3db313){_[_0x778e('0x15e')](_0x42f100,_0x7e4105[0x0]);if(checkGetDataPredictive(_0x7e4105[0x0])){loggerPredictive[_0x778e('0x48')](JSON[_0x778e('0x75')](_0x7e4105[0x0]));if(_0x42f100[_0x778e('0x1d1')]===_0x778e('0x1cf')){return _0x1c411e[_0x778e('0x158')](_0x42f100['id'])[_0x778e('0xa4')](function(_0x5d4f13){var _0x26a384=_0x42f100[_0x778e('0x1e2')]-_0x5d4f13[0x0]['outboundQueuePauses'];var _0x102556=_0x42f100[_0x778e('0x1cd')]*0x3c;var _0x14ab99=_0x7e4105[0x0][_0x778e('0x55')]+_0x7e4105[0x0]['predictiveIntervalAvgHoldtime'];var _0xb0f51d=(_0x7e4105[0x0]['predictiveIntervalAnsweredCalls']+_0x7e4105[0x0][_0x778e('0x4e')]+_0x7e4105[0x0][_0x778e('0x50')])/_0x7e4105[0x0][_0x778e('0x4a')];var _0x50febd=_0x42f100['dialPredictiveOptimizationPercentage']/0x64;_0x42f100[_0x778e('0x1e3')]=_0x5d4f13[0x0]['outboundQueuePauses']||0x0;_0x42f100[_0x778e('0x1dc')]=_0xb0f51d>0x0?_0xb0f51d:0x1;return _0x1c411e[_0x778e('0x1dd')](_0x26a384,_0x102556,_0x14ab99,_0xb0f51d,_0x50febd);})['then'](function(_0x11fd5c){return _0x3c42bb(_0x11fd5c);})[_0x778e('0xa8')](function(_0x1dabd4){return _0x3db313(msgResponse('[CatchErlangB]',_0x778e('0x9a'),JSON[_0x778e('0x75')](_0x1dabd4)));});}if(_0x42f100[_0x778e('0x1d1')]===_0x778e('0x1de')){return _0x1c411e['getVoiceQueueRtPauses'](_0x42f100['id'])['then'](function(_0x4f3514){var _0x402824=_0x42f100['loggedIn']-_0x4f3514[0x0]['outboundQueuePauses'];var _0x23b39f=_0x42f100[_0x778e('0x1cd')]*0x3c;var _0x72667c=_0x7e4105[0x0]['predictiveIntervalAvgTalktime']+_0x7e4105[0x0][_0x778e('0x52')];var _0x124cd2=(_0x7e4105[0x0]['predictiveIntervalAnsweredCalls']+_0x7e4105[0x0][_0x778e('0x4e')]+_0x7e4105[0x0][_0x778e('0x50')])/_0x7e4105[0x0][_0x778e('0x4a')];var _0x453e9f=_0x42f100['dialPredictiveOptimizationPercentage']/0x64;_0x42f100[_0x778e('0x1e3')]=_0x4f3514[0x0][_0x778e('0x1e4')]||0x0;_0x42f100[_0x778e('0x1dc')]=_0x124cd2>0x0?_0x124cd2:0x1;return _0x1c411e['busyFactor'](_0x402824,_0x23b39f,_0x72667c,_0x124cd2,_0x453e9f);})[_0x778e('0xa4')](function(_0x1174b4){return _0x3c42bb(_0x1174b4);})[_0x778e('0xa8')](function(_0x860cff){return _0x3db313(msgResponse('[CatchErlangB]',_0x778e('0x9a'),JSON['stringify'](_0x860cff)));});}}else{return _0x3db313(msgResponse(_0x778e('0x1e0'),'Failure','check\x20failure'));}});};};Dialer[_0x778e('0x89')][_0x778e('0x1e5')]=function(_0x3e116b){var _0xcb02a0=this;return function(){var _0x24cf67=0x0;var _0x283c6c=Math['floor'](_0x3e116b[_0x778e('0x1e6')]*0x3e8);if(_0x283c6c>0x0){_0x283c6c=_0x283c6c<0x64?0x64:_0x283c6c;loggerPredictive[_0x778e('0x48')](_0x3e116b[_0x778e('0x45')],_0x778e('0x1e7'),_0x283c6c,_0x778e('0x1e8'));_0x3e116b[_0x778e('0x62')]=setInterval(function(){_0xcb02a0[_0x778e('0x62')](_0x3e116b);loggerPredictiveCalls[_0x778e('0x48')]('[handlePredictive]',_0x24cf67+=0x1);},_0x283c6c);}else{loggerPredictive[_0x778e('0x48')](_0x3e116b[_0x778e('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x778e('0x89')]['checkContactBlack']=function(_0x5f4033,_0x4650f7){var _0x5d8eb9=this;return function(_0x19a21f){if(_[_0x778e('0x98')](_0x19a21f)){if(_[_0x778e('0xf6')](_0x4650f7[_0x778e('0x15f')])||!_0x4650f7[_0x778e('0x1e9')]){if(_0x5f4033[_0x778e('0xb5')]===_0x778e('0x1ea')){_0x5f4033[_0x778e('0x73')]=_[_0x778e('0x54')](_0x5f4033['queueStatusComplete'])?!![]:_0x5f4033[_0x778e('0x73')];var _0x370416=uuid['v4']();_0x5d8eb9[_0x778e('0xf1')][_0x370416]=new Action(_0x5f4033,_0x4650f7,_0x370416);loggerBooked[_0x778e('0x48')](_0x778e('0x1eb'),_0x370416,_0x778e('0x1ec'),JSON[_0x778e('0x75')](_0x5f4033[_0x778e('0x73')]),_0x778e('0x1ed'),_0x5f4033[_0x778e('0x45')]);if(_0x5f4033[_0x778e('0x73')]){_0x5f4033['queueStatusComplete']=![];_0x5d8eb9[_0x778e('0x25')][_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xc1')]]=[];ami[_0x778e('0xa9')]({'actionid':_0x370416,'action':_0x778e('0x1ee'),'queue':_0x5f4033[_0x778e('0x45')]})[_0x778e('0xa8')](function(){_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5d8eb9[_0x778e('0xf1')][_0x370416]['ContactId'],'ListId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdd')],'VoiceQueueId':_0x5d8eb9['actions'][_0x370416][_0x778e('0xde')]||undefined,'CampaignId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ef')));delete _0x5d8eb9['actions'][_0x370416];});}else{loggerBooked[_0x778e('0x48')](_0x778e('0x1f0'),JSON['stringify'](_0x5f4033[_0x778e('0x73')]),_0x778e('0x1ed'),_0x5f4033[_0x778e('0x45')]);_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdc')],'ListId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdd')],'VoiceQueueId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xde')]||undefined,'CampaignId':_0x5d8eb9[_0x778e('0xf1')][_0x370416]['CampaignId']||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ef')));delete _0x5d8eb9[_0x778e('0xf1')][_0x370416];}}else{return _0x5d8eb9['actionOriginate'](_0x5f4033,_0x4650f7);}}else{if(utils[_0x778e('0x1f1')](undefined,_0x4650f7['scheduledat'])<_0x5f4033[_0x778e('0x1f2')]*0x3c){if(_0x4650f7['Agent']&&!_0x4650f7['Agent'][_0x778e('0x1f3')]){_0x5d8eb9[_0x778e('0x19')][_0x778e('0xfc')](_0x4650f7['id'])['finally'](function(){_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);});}else{hopperUtils[_0x778e('0x1f4')]({'active':![]},_0x4650f7['id'],0x1)[_0x778e('0x18')](function(){_0x5d8eb9['updateOriginated'](_0x5f4033);});}}else{_0x5f4033[_0x778e('0x1f5')]+=0x1;_0x5d8eb9['updateOriginated'](_0x5f4033);if(_0x5f4033[_0x778e('0x1f6')]){hopperUtils[_0x778e('0xec')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4650f7[_0x778e('0xdc')],'ListId':_0x4650f7[_0x778e('0xdd')],'VoiceQueueId':_0x4650f7[_0x778e('0xde')]||undefined,'CampaignId':_0x4650f7[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1f7')));hopperUtils[_0x778e('0xef')](createObjHistory(_0x5f4033,_0x4650f7,utils['CAMPAIGN_STATUS'][_0x778e('0x1f8')],0x17,_0x778e('0x1f9')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5d8eb9['saveInDb'](createObjHistory(_0x5f4033,_0x4650f7,utils[_0x778e('0x68')][_0x778e('0x1fa')],0x16,_0x778e('0x1fb')),_0x778e('0x1fc'),_0x778e('0x1fd'));}}}}else{_0x5f4033['outboundBlacklistCallsDay']+=0x1;_0x5d8eb9['saveInDb'](createObjHistory(_0x5f4033,_0x4650f7,utils[_0x778e('0x68')][_0x778e('0x1fe')],0xd,'Blacklist'),_0x778e('0x1ff'),_0x778e('0x200'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x40bcbe){var _0x2501cc=this;var _0x42dac6=_0x40bcbe[_0x778e('0x201')]-_0x40bcbe[_0x778e('0x82')];emitCampaignSummary(_0x40bcbe);if(_0x42dac6>0x0&&_0x40bcbe['temp']==0x0){if(_0x42dac6>this[_0x778e('0x1e')]){_0x42dac6=this[_0x778e('0x1e')];}_0x40bcbe[_0x778e('0x202')]=0x1;hopperUtils[_0x778e('0x203')](_0x40bcbe,_0x42dac6)[_0x778e('0xa4')](function(_0x3215ca){_0x40bcbe['temp']=0x0;if(_0x3215ca){if(!utils[_0x778e('0x204')](_0x3215ca)){_0x40bcbe[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x6d')];logger[_0x778e('0x48')](_0x778e('0x205')+_0x40bcbe['name']);}else{_0x40bcbe[_0x778e('0x82')]+=_0x3215ca['length'];_0x40bcbe['message']=utils[_0x778e('0x68')][_0x778e('0x206')];for(var _0x5f4443=0x0;_0x5f4443<_0x3215ca[_0x778e('0xa0')];_0x5f4443+=0x1){_0x40bcbe[_0x778e('0x207')]+=0x1;if(_[_0x778e('0xf6')](_0x3215ca[_0x5f4443])||_[_0x778e('0xf6')](_0x3215ca[_0x5f4443][_0x778e('0x17e')])||_[_0x778e('0xf6')](_0x3215ca[_0x5f4443]['phone'])){_0x2501cc[_0x778e('0x208')](_0x778e('0x209'),_0x40bcbe,_0x3215ca[_0x5f4443]);}else{hopperUtils[_0x778e('0x20a')](_[_0x778e('0x76')](_0x3215ca[_0x5f4443],[_0x778e('0xdf'),_0x778e('0x168')]))[_0x778e('0xa4')](_0x2501cc[_0x778e('0x20b')](_0x40bcbe,_0x3215ca[_0x5f4443]))['catch'](_0x2501cc[_0x778e('0x20c')](_0x778e('0x20d'),_0x40bcbe));}}}}})[_0x778e('0xa8')](loggerGetContactDialer(_0x778e('0x20e'),_0x40bcbe,_0x42dac6));}};Dialer[_0x778e('0x89')][_0x778e('0xb7')]=function(_0x9c916a,_0x278f2f){var _0x3740a4=this;var _0x4163a9=[];if(_0x278f2f<0x1||_0x9c916a[_0x778e('0xb5')]==='booked'){_0x278f2f=0x1;}var _0x3ead66=Math[_0x778e('0x20f')](_0x9c916a[_0x778e('0x142')]*_0x278f2f)-_0x9c916a[_0x778e('0x82')];if(_0x9c916a[_0x778e('0x210')]>0x0){var _0x4af21b=_0x9c916a[_0x778e('0x210')]-_0x9c916a[_0x778e('0x82')]-_0x9c916a['talking']-_0x9c916a[_0x778e('0x145')];if(_0x3ead66>_0x4af21b){_0x3ead66=_0x4af21b;}}if(_0x3ead66>0x0&&_0x9c916a[_0x778e('0x202')]==0x0){if(_0x9c916a['dialMethod']===_0x778e('0x1ea')){_0x3ead66=0x1;}if(_0x3ead66>this[_0x778e('0x1e')]){_0x3ead66=this[_0x778e('0x1e')];}for(var _0x4df6a6 in this[_0x778e('0x1c')]){if(typeof this['agents'][_0x4df6a6]!==_0x778e('0x15a')){if(this['agents'][_0x4df6a6][_0x778e('0x6f')]==='not_inuse'&&this[_0x778e('0x1c')][_0x4df6a6][_0x778e('0x8d')]===_0x778e('0x8e')){_0x4163a9['push'](this[_0x778e('0x1c')][_0x4df6a6]['id']);}}}_0x9c916a['temp']=0x1;hopperUtils[_0x778e('0x211')](_0x9c916a,_0x4163a9,_0x3ead66)[_0x778e('0xa4')](function(_0x6be584){_0x9c916a['temp']=0x0;if(_0x6be584){if(!utils[_0x778e('0x204')](_0x6be584)){hopperUtils[_0x778e('0x212')](_0x9c916a)[_0x778e('0xa4')](sendMessageReschedule(_0x9c916a))['catch'](loggerCatch(_0x778e('0x213')));}else{_0x9c916a[_0x778e('0x82')]+=_0x6be584[_0x778e('0xa0')];_0x9c916a[_0x778e('0x6c')]=_0x9c916a['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x778e('0x214')]:utils[_0x778e('0x68')][_0x778e('0x206')];for(var _0x2fe9fa=0x0;_0x2fe9fa<_0x6be584['length'];_0x2fe9fa+=0x1){if(_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa])||_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa]['Contact'])||_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa][_0x778e('0x168')])){_0x3740a4[_0x778e('0x208')](_0x778e('0x209'),_0x9c916a,_0x6be584[_0x2fe9fa]);}else{hopperUtils[_0x778e('0x215')](_[_0x778e('0x76')](_0x6be584[_0x2fe9fa],['VoiceQueueId','phone']))['then'](_0x3740a4[_0x778e('0x20b')](_0x9c916a,_0x6be584[_0x2fe9fa]))['catch'](_0x3740a4[_0x778e('0x20c')](_0x778e('0x209'),_0x9c916a));}}}}})[_0x778e('0xa8')](loggerGetContactDialer(_0x778e('0x216'),_0x9c916a,_0x3ead66));}};Dialer[_0x778e('0x89')][_0x778e('0x62')]=function(_0x480b18){if(_0x480b18[_0x778e('0x210')]>0x0){var _0xefbf3=_0x480b18[_0x778e('0x210')]-_0x480b18[_0x778e('0x82')]-_0x480b18[_0x778e('0x144')];if(_0xefbf3>0x0&&_0x480b18['temp']==0x0){this[_0x778e('0x217')](_0x480b18);}else{loggerPredictiveCalls[_0x778e('0x48')](_0x778e('0x218'));}}else{this[_0x778e('0x217')](_0x480b18);}};Dialer[_0x778e('0x89')][_0x778e('0x217')]=function(_0x2be8ad){var _0x41d9ad=this;var _0x32c6bc=[];_0x2be8ad['originated']+=0x1;for(var _0x1f630d in this[_0x778e('0x1c')]){if(typeof this[_0x778e('0x1c')][_0x1f630d]!==_0x778e('0x15a')){if(this[_0x778e('0x1c')][_0x1f630d][_0x778e('0x6f')]===_0x778e('0x219')&&this['agents'][_0x1f630d][_0x778e('0x8d')]===_0x778e('0x8e')){_0x32c6bc['push'](this[_0x778e('0x1c')][_0x1f630d]['id']);}}}_0x2be8ad[_0x778e('0x202')]=0x1;return this[_0x778e('0x211')](_0x2be8ad['id'],_0x32c6bc,0x1,_0x2be8ad[_0x778e('0x21a')],_0x2be8ad)['then'](function(_0x2145e9){_0x2be8ad[_0x778e('0x202')]=0x1;if(_0x2145e9){if(!utils['checkContactEmpty'](_0x2145e9)){utils[_0x778e('0x66')](_0x2be8ad,0x1,0x0);return hopperUtils['countReScheduled'](_0x2be8ad)['then'](sendMessageReschedule(_0x2be8ad))[_0x778e('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x2be8ad[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x206')];if(_[_0x778e('0xf6')](_0x2145e9[0x0])||_['isNil'](_0x2145e9[0x0][_0x778e('0x17e')])||_['isNil'](_0x2145e9[0x0][_0x778e('0x168')])){_0x41d9ad[_0x778e('0x208')](_0x778e('0x209'),_0x2be8ad,_0x2145e9[0x0]);}else{return hopperUtils[_0x778e('0x215')](_[_0x778e('0x76')](_0x2145e9[0x0],[_0x778e('0xde'),_0x778e('0x168')]))[_0x778e('0xa4')](_0x41d9ad[_0x778e('0x20b')](_0x2be8ad,_0x2145e9[0x0]))[_0x778e('0xa8')](_0x41d9ad[_0x778e('0x20c')](_0x778e('0x21b'),_0x2be8ad));}}}})['catch'](loggerGetContactDialer(_0x778e('0x21c'),_0x2be8ad,0x1));};Dialer[_0x778e('0x89')][_0x778e('0x1dd')]=function(_0x1369a3,_0x1c96f9,_0x517995,_0x4914ba,_0x42fab6,_0x2d0c76){loggerPredictive[_0x778e('0x48')](_0x778e('0x21d'));loggerPredictive['info'](_0x778e('0x21e'),_0x1369a3);loggerPredictive['info'](_0x778e('0x21f'),_0x1c96f9);loggerPredictive[_0x778e('0x48')](_0x778e('0x220'),_0x517995);loggerPredictive['info'](_0x778e('0x221'),_0x4914ba);loggerPredictive['info'](_0x778e('0x222'),_0x42fab6);loggerPredictive['info'](_0x778e('0x223'));return new Promise(function(_0x4334ee,_0x5290c0){if(_0x1369a3<=0x0||isNaN(_0x1369a3)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),'m\x20=\x20'+_0x1369a3));}if(_0x517995<=0x0||isNaN(_0x517995)){return _0x5290c0(msgResponse(_0x778e('0x224'),'Error',_0x778e('0x225')+_0x517995));}if(_0x4914ba<=0x0||isNaN(_0x4914ba)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),_0x778e('0x226')+_0x4914ba));}if(_0x1c96f9<=0x0||isNaN(_0x1c96f9)){return _0x5290c0(msgResponse('[abandonmentRate]',_0x778e('0x88'),_0x778e('0x227')+_0x1c96f9));}if(_0x42fab6<=0x0||isNaN(_0x42fab6)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),_0x778e('0x228')+_0x42fab6));}_0x2d0c76=_0x2d0c76||0x0;var _0x226c88=0x1/_0x517995;var _0x473ce6=0x0;var _0x72193e=0x0;var _0x84b5fc=0x0;var _0xa74663=0x0;for(var _0x6b33d7=0x0;_0x84b5fc<_0x42fab6;_0x6b33d7+=0x1){_0x72193e=_0x6b33d7/_0x1c96f9;_0x473ce6=(_0x4914ba*_0x72193e+_0x2d0c76)/_0x226c88;_0x84b5fc=utils[_0x778e('0x229')](_0x473ce6,_0x1369a3);_0xa74663=_0x473ce6/_0x1369a3*(0x1-utils[_0x778e('0x229')](_0x473ce6,_0x1369a3));}return _0x4334ee({'erlangCalls':_0x6b33d7,'erlangCallToSecond':_0x1c96f9/_0x6b33d7,'erlangAbandonmentRate':_0x84b5fc,'erlangBusyFactor':_0xa74663});});};Dialer[_0x778e('0x89')]['busyFactor']=function(_0x41e71c,_0x207a2c,_0x390edb,_0x14d73c,_0x9e4d6f,_0x160873){loggerPredictive[_0x778e('0x48')](_0x778e('0x22a'));loggerPredictive[_0x778e('0x48')](_0x778e('0x21e'),_0x41e71c);loggerPredictive[_0x778e('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x207a2c);loggerPredictive[_0x778e('0x48')](_0x778e('0x220'),_0x390edb);loggerPredictive[_0x778e('0x48')](_0x778e('0x221'),_0x14d73c);loggerPredictive[_0x778e('0x48')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9e4d6f);loggerPredictive[_0x778e('0x48')]('---------------------------');return new Promise(function(_0x3ad406,_0x4b4556){if(_0x41e71c<=0x0||isNaN(_0x41e71c)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),_0x778e('0x22c')+_0x41e71c));}if(_0x390edb<=0x0||isNaN(_0x390edb)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),_0x778e('0x225')+_0x390edb));}if(_0x14d73c<=0x0||isNaN(_0x14d73c)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),'p\x20=\x20'+_0x14d73c));}if(_0x207a2c<=0x0||isNaN(_0x207a2c)){return _0x4b4556(msgResponse('[busyFactor]',_0x778e('0x88'),_0x778e('0x227')+_0x207a2c));}if(_0x9e4d6f<=0x0||isNaN(_0x9e4d6f)){return _0x4b4556(msgResponse(_0x778e('0x22b'),'Error',_0x778e('0x22d')+_0x9e4d6f));}_0x160873=_0x160873||0x0;var _0x4d11d1=0x1/_0x390edb;var _0x1aa945=0x0;var _0x1bbf43=0x0;var _0x5d91d7=0x0;var _0x5739e5=0x0;for(var _0x4e2257=0x0;_0x5739e5<_0x9e4d6f;_0x4e2257+=0x1){_0x1bbf43=_0x4e2257/_0x207a2c;_0x1aa945=(_0x14d73c*_0x1bbf43+_0x160873)/_0x4d11d1;_0x5d91d7=utils['erlangb'](_0x1aa945,_0x41e71c);_0x5739e5=_0x1aa945/_0x41e71c*(0x1-utils[_0x778e('0x229')](_0x1aa945,_0x41e71c));}return _0x3ad406({'erlangCalls':_0x4e2257,'erlangCallToSecond':_0x207a2c/_0x4e2257,'erlangAbandonmentRate':_0x5d91d7,'erlangBusyFactor':_0x5739e5});});};module[_0x778e('0x22e')]=Dialer; \ No newline at end of file +var _0x1c17=['TIMEOUT','dialQueueProject2','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','queueCallerAbandonCreateState','additional','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','agents','idHopper','syncQueueStatusComplete','preview','run','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','isNil','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countnosuchnumberretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','reachable','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:%s','handleIvr','object','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','predictiveIntervalHitRate','busyFactor','erlangCallToSecond','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','[checkContactBlack]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[handleIvr]','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','[getContactCampaign2]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','inspect','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20deactivated','[ifTime][Action]','Error','stringify','prototype','isTrunkReachable','active','SIP/%s','status','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','Action','iftime\x20%s,%s','timezones','content','indexOf','catch','command','true','all','some','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','decrementOriginate','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x50b2e0,_0x3c6182){var _0x15e27b=function(_0x5f5b27){while(--_0x5f5b27){_0x50b2e0['push'](_0x50b2e0['shift']());}};_0x15e27b(++_0x3c6182);}(_0x1c17,0x158));var _0x71c1=function(_0x35ed06,_0x64046e){_0x35ed06=_0x35ed06-0x0;var _0x1e5cdd=_0x1c17[_0x35ed06];return _0x1e5cdd;};'use strict';var util=require(_0x71c1('0x0'));var _=require(_0x71c1('0x1'));var uuid=require(_0x71c1('0x2'));var moment=require(_0x71c1('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x71c1('0x4'));var hopperUtils=require(_0x71c1('0x5'));var ut=require(_0x71c1('0x6'));var config=require('../../../config/environment/');var logger=require(_0x71c1('0x7'))(_0x71c1('0x8'));var loggerBooked=require(_0x71c1('0x7'))(_0x71c1('0x9'));var loggerPredictive=require('../../../config/logger')(_0x71c1('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x71c1('0x7'))(_0x71c1('0xb'));var ami=require(_0x71c1('0xc'));config[_0x71c1('0xd')]=_[_0x71c1('0xe')](config[_0x71c1('0xd')],{'host':_0x71c1('0xf'),'port':0x18eb});var io=require(_0x71c1('0x10'))(new Redis(config[_0x71c1('0xd')]));var cmHopper=require(_0x71c1('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x71c1('0x12'));var History=require(_0x71c1('0x13'));var Final=require(_0x71c1('0x14'));var AgentComplete=require(_0x71c1('0x15'));var QueueCallerAbandon=require(_0x71c1('0x16'));var Hangup=require(_0x71c1('0x17'));var ipAgi=process['env'][_0x71c1('0x18')]||_0x71c1('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x71c1('0x1a')]=function(_0x4fa1cb){this['tail']=this['tail']?this[_0x71c1('0x1b')][_0x71c1('0x1c')](_0x4fa1cb):_0x4fa1cb();};function Dialer(_0x5ac388,_0x38e5a7){this[_0x71c1('0x1d')]=new Sequence();this['preview']=_0x38e5a7;this[_0x71c1('0x1e')]=_0x5ac388['voiceQueues'];this[_0x71c1('0x1f')]=_0x5ac388['campaigns'];this['agents']=_0x5ac388['agents'];this[_0x71c1('0x20')]=_0x5ac388[_0x71c1('0x20')];this[_0x71c1('0x21')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x71c1('0x22')]={};this[_0x71c1('0x23')]={};this[_0x71c1('0x24')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x71c1('0x25')]={};this['ivrOriginated']={};this[_0x71c1('0x26')]={};this[_0x71c1('0x27')]={};this['queuesSummary']={};ami['on'](_0x71c1('0x28'),this['syncAgentConnect'][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x2a'),this['syncQueueCallerAbandon'][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x2b'),this['syncOriginateResponse'][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x2c'),this[_0x71c1('0x2d')][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x2e'),this[_0x71c1('0xb')]['bind'](this));ami['on'](_0x71c1('0x2f'),this[_0x71c1('0x30')][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x31'),this[_0x71c1('0x32')][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x33'),this['syncNewExten'][_0x71c1('0x29')](this));ami['on'](_0x71c1('0x34'),this['syncVarSet'][_0x71c1('0x29')](this));ami['on']('queuemember',this['syncQueueMember'][_0x71c1('0x29')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x71c1('0x29')](this));this[_0x71c1('0x35')]();this['loopClearZombieChannels']();RpcSetting[_0x71c1('0x36')]()[_0x71c1('0x37')](function(_0x1a37e9){previewRecallmeReminderInterval=_0x1a37e9[_0x71c1('0x38')];});}function isNotNull(_0x255357){return _0x255357!==null&&!_[_0x71c1('0x39')](_0x255357);}function msgResponse(_0x55703a,_0x56b531,_0x19a950){return{'action':_0x55703a,'response':_0x56b531,'message':_0x19a950,'stack':_0x19a950};}function emit(_0x56bb74,_0x53bd2c,_0x246c4a){io['to'](_0x56bb74)[_0x71c1('0x3a')](_0x53bd2c,_0x246c4a);}function emitOutboundVoiceQueueSummary(_0x3ce99b){if(_0x3ce99b[_0x71c1('0x3b')]===_0x71c1('0x3c')){logger[_0x71c1('0x3d')](_0x71c1('0x3e'),util['inspect'](_0x3ce99b,{'showHidden':![],'depth':null}));emit(util['format'](_0x71c1('0x3f'),_0x3ce99b[_0x71c1('0x40')]),_0x71c1('0x41'),_0x3ce99b);}}function checkGetDataPredictive(_0x979634){if(isNotNull(_0x979634)&&!_['isEmpty'](_0x979634)){loggerPredictive[_0x71c1('0x42')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x71c1('0x42')](_0x71c1('0x43'),_0x979634[_0x71c1('0x44')]);loggerPredictive[_0x71c1('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x979634[_0x71c1('0x45')]);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x46'),_0x979634[_0x71c1('0x47')]);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x48'),_0x979634[_0x71c1('0x49')]);loggerPredictive[_0x71c1('0x42')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x979634[_0x71c1('0x4a')]);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x4b'),_0x979634[_0x71c1('0x4c')]);loggerPredictive['info'](_0x71c1('0x4d'));if(_0x979634[_0x71c1('0x44')]>0x0){if(!_[_0x71c1('0x39')](_0x979634[_0x71c1('0x4c')])&&_0x979634[_0x71c1('0x4c')]>0x0){return!![];}loggerPredictive[_0x71c1('0x42')](_0x71c1('0x4e'));if(!_[_0x71c1('0x39')](_0x979634[_0x71c1('0x4a')])&&_0x979634['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x71c1('0x4f'));}}else{loggerPredictive[_0x71c1('0x42')](_0x71c1('0x50'));}return![];}function mergeDataErlangB(_0x4180de){return function(_0x37dab8){loggerPredictive[_0x71c1('0x42')](_0x71c1('0x51'));loggerPredictive[_0x71c1('0x42')](_0x71c1('0x52'),_0x37dab8[_0x71c1('0x53')]);loggerPredictive['info'](_0x71c1('0x54'),_0x37dab8['erlangCallToSecond']);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x55'),_0x37dab8[_0x71c1('0x56')]);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x57'),_0x37dab8[_0x71c1('0x58')]);loggerPredictive[_0x71c1('0x42')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37dab8[_0x71c1('0x56')]);loggerPredictive['info'](_0x71c1('0x4d'));_[_0x71c1('0x59')](_0x4180de,_0x37dab8);};}function ifInterval(_0x8c7b50,_0x7f0ec8){if(_[_0x71c1('0x39')](_0x7f0ec8)){return![];}return utils[_0x71c1('0x5a')](undefined,_0x7f0ec8)<_0x8c7b50*0x3c;}function clearPredictiveAttributes(_0x32b64c){if(_0x32b64c['startProgressive']){_0x32b64c[_0x71c1('0x25')]=undefined;loggerPredictive[_0x71c1('0x3d')](_0x32b64c['name'],_0x71c1('0x5b'));}if(_0x32b64c[_0x71c1('0x5c')]){_0x32b64c[_0x71c1('0x5c')]=undefined;loggerPredictive[_0x71c1('0x3d')](_0x32b64c[_0x71c1('0x40')],_0x71c1('0x5d'));}if(_0x32b64c['handlePredictive']){clearInterval(_0x32b64c[_0x71c1('0x5e')]);_0x32b64c[_0x71c1('0x5e')]=undefined;loggerPredictive[_0x71c1('0x3d')](_0x32b64c[_0x71c1('0x40')],_0x71c1('0x5f'));}}function loggerCatchPredictive(_0x4c7d38,_0xc83fe9){return function(_0x5395c9){loggerPredictive[_0x71c1('0x60')](_0xc83fe9[_0x71c1('0x40')],_0x4c7d38);loggerPredictive[_0x71c1('0x60')](_0x5395c9[_0x71c1('0x61')]);clearPredictiveAttributes(_0xc83fe9);};}function loggerCatch(_0x4a6b23){return function(_0x522522){logger['error'](_0x4a6b23,util['inspect'](_0x522522,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x477601){return function(_0x52746f){if(isNotNull(_0x52746f)&&isNotNull(_0x52746f[0x0])){if(_0x52746f[0x0][_0x71c1('0x62')]>0x0){_0x477601[_0x71c1('0x63')]=utils[_0x71c1('0x64')][_0x71c1('0x65')];logger[_0x71c1('0x42')](_0x71c1('0x66')+_0x477601[_0x71c1('0x40')],_0x52746f[0x0][_0x71c1('0x62')],_0x71c1('0x67'));}else{_0x477601[_0x71c1('0x63')]=utils['CAMPAIGN_STATUS'][_0x71c1('0x68')];logger[_0x71c1('0x42')](_0x71c1('0x69')+_0x477601['name']);}}};}function createObjHistory(_0x1b119f,_0x40d0b2,_0x4b50cc,_0x2d335d,_0x4abe54){_0x1b119f[_0x71c1('0x63')]=_0x4b50cc;var _0x42047b=new Action(_0x1b119f,_0x40d0b2);var _0x1d0ec9=new History(_0x42047b);_0x1d0ec9[_0x71c1('0x6a')]=_0x2d335d;_0x1d0ec9[_0x71c1('0x6b')]=_0x4abe54;_0x1d0ec9[_0x71c1('0x6c')]=_0x42047b['starttime'];return _0x1d0ec9;}function unlockQueueStatus(_0x3436b5,_0x4254a5){setTimeout(function(){if(_[_0x71c1('0x39')](_0x3436b5[_0x71c1('0x6d')])){loggerBooked[_0x71c1('0x60')](_0x71c1('0x6e'),_0x4254a5);}_0x3436b5['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x4254a5,JSON['stringify'](_[_0x71c1('0x6f')](_0x3436b5,[_0x71c1('0x40'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4575cd){return function(){if(!isNotNull(_0x4575cd[_0x71c1('0x70')])){_0x4575cd[_0x71c1('0x63')]=utils[_0x71c1('0x64')]['NULL_INTERVAL'];throw _0x4575cd[_0x71c1('0x40')]+_0x71c1('0x71');}if(!isNotNull(_0x4575cd['Interval'][_0x71c1('0x72')])){_0x4575cd['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4575cd[_0x71c1('0x40')]+_0x71c1('0x71');}if(!isNotNull(_[_0x71c1('0x73')](_0x4575cd[_0x71c1('0x70')][_0x71c1('0x72')]))){_0x4575cd[_0x71c1('0x63')]=utils[_0x71c1('0x64')][_0x71c1('0x74')];throw _0x4575cd[_0x71c1('0x40')]+_0x71c1('0x71');}};}function checkIsIVRCampaignActive(_0x4907f7){return function(){if(!utils['isIVRCampaignActive'](_0x4907f7)){_0x4907f7['message']=utils[_0x71c1('0x64')][_0x71c1('0x75')];throw _0x4907f7[_0x71c1('0x40')]+_0x71c1('0x76');}};}function emitCampaignSummary(_0x2d3636){if(utils[_0x71c1('0x77')](_0x2d3636)){emit(util[_0x71c1('0x78')](_0x71c1('0x79'),_0x2d3636[_0x71c1('0x40')]),_0x71c1('0x7a'),_0x2d3636);}}function loggerCatchQueueSummary(_0x4a7073,_0x3cef0d){return function(_0x535194){clearPredictiveAttributes(_0x3cef0d);emitCampaignSummary(_0x3cef0d);loggerSyncQueueSummary['debug'](_0x4a7073,util[_0x71c1('0x7b')](_0x535194,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x178973){if(_0x178973[_0x71c1('0x7c')]){if(_0x178973[_0x71c1('0x7d')]===0x0){_0x178973[_0x71c1('0x7c')]=![];_0x178973['message']=utils[_0x71c1('0x64')][_0x71c1('0x75')];loggerSyncQueueSummary[_0x71c1('0x3d')](_0x71c1('0x7e'),_0x178973[_0x71c1('0x40')],_0x71c1('0x7f'));}else{_0x178973['message']=utils[_0x71c1('0x64')]['DISACTIVED'];loggerSyncQueueSummary[_0x71c1('0x3d')](_0x71c1('0x7e'),_0x178973[_0x71c1('0x40')],_0x71c1('0x80'));}emitCampaignSummary(_0x178973);}}function myreject(_0x4a70bf){return function(_0x20c949){return _0x4a70bf(msgResponse(_0x71c1('0x81'),_0x71c1('0x82'),JSON[_0x71c1('0x83')](_0x20c949)));};}Dialer[_0x71c1('0x84')][_0x71c1('0x85')]=function(_0x1dd256){return!_[_0x71c1('0x39')](_0x1dd256)&&_0x1dd256&&!_[_0x71c1('0x39')](_0x1dd256[_0x71c1('0x40')])&&!_[_0x71c1('0x39')](_0x1dd256[_0x71c1('0x86')])&&_0x1dd256[_0x71c1('0x86')]&&(this[_0x71c1('0x20')][util[_0x71c1('0x78')](_0x71c1('0x87'),_0x1dd256[_0x71c1('0x40')])][_0x71c1('0x88')]==='reachable'||this[_0x71c1('0x20')][util['format'](_0x71c1('0x87'),_0x1dd256[_0x71c1('0x40')])][_0x71c1('0x88')]==='unmonitored');};Dialer['prototype'][_0x71c1('0x89')]=function(_0x26d672){var _0x1eff9f=this;return function(){if(!_0x1eff9f[_0x71c1('0x85')](_0x26d672[_0x71c1('0x8a')])){if(!_0x1eff9f[_0x71c1('0x85')](_0x26d672[_0x71c1('0x8b')])){_0x26d672[_0x71c1('0x63')]=utils[_0x71c1('0x64')][_0x71c1('0x8c')];throw _0x26d672[_0x71c1('0x40')]+_0x71c1('0x8d');}}};};Dialer[_0x71c1('0x84')][_0x71c1('0x8e')]=function(_0x30eb23,_0x34b37f,_0x43b8cb,_0x3959cc){var _0x3796a8=this;return function(){var _0x18ebd3=!![];return _0x3796a8['ifTimeIvr'](_0x30eb23,_0x34b37f,_0x43b8cb,_0x3959cc,_0x18ebd3);};};Dialer[_0x71c1('0x84')][_0x71c1('0x8f')]=function(_0x4e40c4,_0x3997eb,_0x36f6b1,_0x33cc51){var _0x38e0bb=this;return function(){var _0x39bb26=![];return _0x38e0bb['ifTimeIvr'](_0x4e40c4['Intervals'],_0x3997eb,_0x36f6b1,_0x33cc51,_0x39bb26);};};Dialer[_0x71c1('0x84')]['ifTimeIvr']=function(_0x109ff2,_0x3bb51a,_0xbd5a81,_0x3fe7bb,_0x4b5f43){var _0x4ba753=[];return new Promise(function(_0x1aef54,_0x1af690){if(!isNotNull(_0x109ff2)){_0x3fe7bb[_0x71c1('0x63')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x1af690(msgResponse('ifTime',_0x71c1('0x90'),_0xbd5a81+_0x71c1('0x91')));}if(_[_0x71c1('0x73')](_0x109ff2)){_0x3fe7bb[_0x71c1('0x63')]=utils['CAMPAIGN_STATUS'][_0x71c1('0x92')];return _0x1af690(msgResponse(_0x71c1('0x93'),_0x71c1('0x90'),_0xbd5a81+_0x71c1('0x94')));}if(_0x3bb51a&&_[_0x71c1('0x39')](config['timezones'][_0x3bb51a])){_0x3fe7bb[_0x71c1('0x63')]=utils[_0x71c1('0x64')][_0x71c1('0x95')];return _0x1af690(msgResponse(_0x71c1('0x93'),'Failure',_0xbd5a81+_0x71c1('0x96')+_0x3bb51a));}if(_['isArray'](_0x109ff2)){for(var _0x53754d=0x0;_0x53754d<_0x109ff2[_0x71c1('0x97')];_0x53754d+=0x1){_0x4ba753[_0x71c1('0x98')](ami[_0x71c1('0x99')]({'action':'command','command':util[_0x71c1('0x78')](_0x71c1('0x9a'),_0x109ff2[_0x53754d]['interval'],!_[_0x71c1('0x39')](config[_0x71c1('0x9b')][_0x3bb51a])?_0x3bb51a:'')})['then'](function(_0x470e5b){return _0x470e5b[_0x71c1('0x9c')][_0x71c1('0x9d')]('true')>=0x0;})[_0x71c1('0x9e')](myreject(_0x1af690)));}}else{_0x4ba753[_0x71c1('0x98')](ami[_0x71c1('0x99')]({'action':_0x71c1('0x9f'),'command':util[_0x71c1('0x78')](_0x71c1('0x9a'),_0x109ff2,!_['isUndefined'](config[_0x71c1('0x9b')][_0x3bb51a])?_0x3bb51a:'')})[_0x71c1('0x37')](function(_0x366aae){return _0x366aae[_0x71c1('0x9c')][_0x71c1('0x9d')](_0x71c1('0xa0'))>=0x0;})['catch'](myreject(_0x1af690)));}Promise[_0x71c1('0xa1')](_0x4ba753)[_0x71c1('0x37')](function(_0x375921){var _0x345f0a=_[_0x71c1('0xa2')](_0x375921);if(_0x345f0a){return _0x1aef54(_0x345f0a);}else{_0x3fe7bb[_0x71c1('0x63')]=_0x4b5f43?utils[_0x71c1('0x64')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x71c1('0x64')][_0x71c1('0xa3')];return _0x1af690(msgResponse('[ifTime][promiseAll]',_0x71c1('0x90'),_0x71c1('0xa4')+_0x4b5f43+'\x20'+_0xbd5a81+_0x71c1('0xa5')+util[_0x71c1('0x7b')](_0x109ff2,{'showHidden':![],'depth':null})+_0x71c1('0xa6')+_0x3bb51a));}})[_0x71c1('0x9e')](function(_0x5b0b97){return _0x1af690(msgResponse(_0x71c1('0x93'),'Failure',JSON[_0x71c1('0x83')](_0x5b0b97)));});});};Dialer[_0x71c1('0x84')][_0x71c1('0x35')]=function(){var _0x320aef=this;return cmHopper[_0x71c1('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0x71c1('0x37')](function(){setInterval(function(){_0x320aef[_0x71c1('0xa8')]();},0x3e8);});};Dialer[_0x71c1('0x84')][_0x71c1('0xa8')]=function(){var _0x1d9576=this;var _0xfc5893;for(var _0xed2515 in this['campaigns']){if(typeof this[_0x71c1('0x1f')][_0xed2515]!==_0x71c1('0xa9')){_0xfc5893=this['campaigns'][_0xed2515];if(utils[_0x71c1('0x77')](_0xfc5893)&&utils['isIVRCampaignActive'](_0xfc5893)){_0xfc5893[_0x71c1('0x7c')]=!![];Promise[_0x71c1('0xaa')]()[_0x71c1('0x37')](checkIsIVRCampaignActive(_0xfc5893))[_0x71c1('0x37')](checkInterval(_0xfc5893))[_0x71c1('0x37')](_0x1d9576[_0x71c1('0x89')](_0xfc5893))[_0x71c1('0x37')](_0x1d9576['checkIfTime'](_0xfc5893[_0x71c1('0xab')],_0xfc5893[_0x71c1('0xac')],_0xfc5893['name'],_0xfc5893))[_0x71c1('0x37')](_0x1d9576[_0x71c1('0x8f')](_0xfc5893[_0x71c1('0x70')],_0xfc5893[_0x71c1('0xac')],_0xfc5893[_0x71c1('0x40')],_0xfc5893))[_0x71c1('0x37')](_0x1d9576['launchHandleIvr'](_0xfc5893))[_0x71c1('0x9e')](loggerCatchQueueSummary('[syncCampaigns]',_0xfc5893));}else{notSendMessagesCampaign(_0xfc5893);}}}};Dialer[_0x71c1('0x84')][_0x71c1('0xad')]=function(_0x2b474f){if(_0x2b474f['dialMethod']!==_0x71c1('0xa')){clearPredictiveAttributes(_0x2b474f);}switch(_0x2b474f[_0x71c1('0xae')]){case _0x71c1('0xaf'):this[_0x71c1('0xb0')](_0x2b474f,0x1);break;case _0x71c1('0xb1'):this[_0x71c1('0xb0')](_0x2b474f,_0x2b474f[_0x71c1('0xb2')]);break;case _0x71c1('0xa'):this['predictive'](_0x2b474f);break;case _0x71c1('0x9'):this['handlePower'](_0x2b474f,0x1);break;default:logger[_0x71c1('0x60')](_0x71c1('0xb3'),_0x2b474f[_0x71c1('0x40')],_0x71c1('0xb4'));}};Dialer[_0x71c1('0x84')][_0x71c1('0x93')]=function(_0x488d00,_0x6117ae){var _0x2b465c=_0x488d00[_0x71c1('0xac')];var _0x3ea225=_0x6117ae?_0x488d00['dialGlobalInterval']:_0x488d00[_0x71c1('0x70')][_0x71c1('0x72')];logger[_0x71c1('0xb5')]('Dialer::ifTime()',_0x3ea225,_0x2b465c,_0x488d00['name'],util[_0x71c1('0x78')](_0x71c1('0xb6'),_0x488d00['name'],_0x488d00['id']));var _0x250159=null;return Interval['intervalIftime'](_0x3ea225,_0x2b465c)[_0x71c1('0x37')](function(_0x39a035){if(_0x39a035===!![]){return _0x39a035;}else{_0x488d00[_0x71c1('0x63')]=_0x6117ae?utils[_0x71c1('0x64')][_0x71c1('0xb7')]:utils[_0x71c1('0x64')][_0x71c1('0xa3')];_0x250159=msgResponse('[ifTime][promiseAll]',_0x71c1('0x90'),'Global:\x20'+_0x6117ae+'\x20'+_0x488d00['name']+_0x71c1('0xa5')+util[_0x71c1('0x7b')](_0x3ea225,{'showHidden':![],'depth':null})+_0x71c1('0xa6')+_0x2b465c);}if(_0x250159!==null){logger[_0x71c1('0xb5')](_0x71c1('0xb8'),_0x250159);_0x250159[_0x71c1('0xb9')]=_0x6117ae;throw _0x250159;}})[_0x71c1('0x9e')](function(_0x2941e1){logger['error'](_0x71c1('0xba'),_0x2941e1);throw msgResponse(_0x71c1('0x81'),_0x71c1('0x82'),util[_0x71c1('0x7b')](_0x2941e1,{'showHidden':![],'depth':null}));});};Dialer[_0x71c1('0x84')][_0x71c1('0xbb')]=function(_0x3a2718){if(this[_0x71c1('0x1e')][_0x3a2718[_0x71c1('0xbc')]]){if(this[_0x71c1('0x24')][_0x3a2718[_0x71c1('0xbd')]]&&this[_0x71c1('0x24')][_0x3a2718['uniqueid']]['type']!==_0x71c1('0xbe')){utils[_0x71c1('0xbf')](this[_0x71c1('0x1e')][_0x3a2718[_0x71c1('0xbc')]],'[syncAgentConnect]');this['uniqueId'][_0x3a2718['uniqueid']][_0x71c1('0xc0')]=moment()[_0x71c1('0x78')](_0x71c1('0xc1'));}}};Dialer[_0x71c1('0x84')][_0x71c1('0x2d')]=function(_0x163990){var _0x5968a9=this[_0x71c1('0x24')][_0x163990[_0x71c1('0xbd')]];if(this[_0x71c1('0x1e')][_0x163990['queue']]){if(_0x5968a9&&_0x5968a9[_0x71c1('0x3b')]!==_0x71c1('0xbe')){delete this[_0x71c1('0x24')][_0x163990['uniqueid']];this['voiceQueues'][_0x163990[_0x71c1('0xbc')]][_0x71c1('0xc2')]+=0x1;var _0x1a91c3=new AgentComplete(_0x5968a9,_0x163990);if(_0x163990[_0x71c1('0xc3')]===_0x71c1('0xc4')){_0x1a91c3[_0x71c1('0xc5')]=this['voiceQueues'][_0x163990[_0x71c1('0xbc')]]['dialQueueProject2']&&this[_0x71c1('0x1e')][_0x163990[_0x71c1('0xbc')]][_0x71c1('0xc6')]?moment()[_0x71c1('0x78')](_0x71c1('0xc1')):undefined;}hopperUtils[_0x71c1('0xc7')](_0x1a91c3)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xc8')));hopperUtils['moveContactManagedDialer'](_0x1a91c3)['catch'](loggerCatch(_0x71c1('0xc9')));}}};Dialer[_0x71c1('0x84')][_0x71c1('0xca')]=function(_0x2dc4d4){var _0x2ec830=this[_0x71c1('0x24')][_0x2dc4d4[_0x71c1('0xbd')]];var _0x312ae6=this;var _0x264bb8=![];var _0x4eb011;var _0x525890;if(this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]]){if(_0x2ec830&&_0x2ec830[_0x71c1('0x3b')]!=='ivr'){delete this[_0x71c1('0x24')][_0x2dc4d4[_0x71c1('0xbd')]];utils[_0x71c1('0xbf')](this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]],_0x71c1('0xcb'));_0x2ec830[_0x71c1('0xcc')]=moment()['format'](_0x71c1('0xc1'));var _0x5b8ad6=new QueueCallerAbandon(_0x2ec830,_0x2dc4d4);if(utils[_0x71c1('0x5a')](_0x2ec830[_0x71c1('0xcc')],_0x2ec830[_0x71c1('0xcd')])>=_0x2ec830[_0x71c1('0xce')]){this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0x47')]+=0x1;this['voiceQueues'][_0x2dc4d4['queue']][_0x71c1('0xcf')]+=0x1;this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xd0')]+=0x1;_0x5b8ad6[_0x71c1('0x6a')]=0xa;_0x5b8ad6[_0x71c1('0x6b')]='Drop';_0x5b8ad6['dropreason']=_0x71c1('0xd1');_0x5b8ad6[_0x71c1('0xc5')]=this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xd2')]?moment()['format'](_0x71c1('0xc1')):undefined;_0x5b8ad6[_0x71c1('0xd3')]+=0x1;_0x5b8ad6[_0x71c1('0xd4')]+=0x1;_0x4eb011=this['voiceQueues'][_0x2dc4d4['queue']]['dialDropRetryFrequency'];_0x525890=this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xd5')];hopperUtils['verifyAdditionalPhones'](_0x5b8ad6,_0x5b8ad6[_0x71c1('0x6a')],_0x2ec830[_0x71c1('0xd6')])[_0x71c1('0x37')](function(_0x382097){_0x264bb8=_0x382097['additional']==0x1;if(_0x5b8ad6[_0x71c1('0xd3')]>=_0x312ae6[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]]['dialDropMaxRetry']){_0x312ae6[_0x71c1('0xd7')](_0x5b8ad6,_0x382097[_0x71c1('0xd8')]);}else{hopperUtils[_0x71c1('0xd9')]({'active':![],'countdropretry':_0x5b8ad6[_0x71c1('0xd3')],'scheduledat':moment()[_0x71c1('0xda')](_0x312ae6[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]]['dialDropRetryFrequency'],_0x71c1('0xdb'))[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x2ec830[_0x71c1('0xdc')],'ListId':_0x2ec830[_0x71c1('0xdd')],'VoiceQueueId':_0x2ec830[_0x71c1('0xde')]||undefined,'CampaignId':_0x2ec830[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xe0')));var _0x5dd817=new History(_0x5b8ad6);_0x5dd817['state']=0xa;_0x5dd817[_0x71c1('0x6b')]=_0x71c1('0xe1');_0x5dd817[_0x71c1('0xe2')]=moment()[_0x71c1('0x78')](_0x71c1('0xc1'));_0x5dd817['endtime']=_0x5dd817['starttime'];_0x5dd817[_0x71c1('0xe3')]=_0x5b8ad6['calleridname'];_0x5dd817['calleridnum']=_0x5b8ad6['calleridnum'];hopperUtils[_0x71c1('0xc7')](_0x5dd817)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xe4')));}})[_0x71c1('0x37')](function(){if(_0x264bb8)hopperUtils[_0x71c1('0xe5')](_0x5b8ad6,_0x4eb011,_0x525890)[_0x71c1('0x37')](function(){return 0x1;});});}else{this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0x49')]+=0x1;this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xe6')]+=0x1;_0x5b8ad6[_0x71c1('0x6a')]=0xb;_0x5b8ad6['statedesc']=_0x71c1('0xe7');_0x5b8ad6[_0x71c1('0xe8')]=_0x71c1('0xe9');_0x5b8ad6['countabandonedretry']+=0x1;_0x5b8ad6[_0x71c1('0xd4')]+=0x1;_0x4eb011=this[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xea')];_0x525890=this[_0x71c1('0x1e')][_0x2dc4d4['queue']][_0x71c1('0xd5')];hopperUtils[_0x71c1('0xeb')](_0x5b8ad6,_0x5b8ad6['state'],_0x2ec830['voiceQueue'])['then'](function(_0x9c916f){if(_0x5b8ad6[_0x71c1('0xec')]>=_0x312ae6[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xed')]){_0x312ae6['queueCallerAbandonCreateState'](_0x5b8ad6,_0x9c916f[_0x71c1('0xd8')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5b8ad6[_0x71c1('0xec')],'scheduledat':moment()[_0x71c1('0xda')](_0x312ae6[_0x71c1('0x1e')][_0x2dc4d4[_0x71c1('0xbc')]][_0x71c1('0xea')],_0x71c1('0xdb'))[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x2ec830[_0x71c1('0xdc')],'ListId':_0x2ec830['ListId'],'VoiceQueueId':_0x2ec830[_0x71c1('0xde')]||undefined,'CampaignId':_0x2ec830[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xee')));var _0x4e84fc=new History(_0x5b8ad6);_0x4e84fc[_0x71c1('0x6a')]=0xb;_0x4e84fc[_0x71c1('0x6b')]=_0x71c1('0xe7');_0x4e84fc[_0x71c1('0xe2')]=moment()[_0x71c1('0x78')](_0x71c1('0xc1'));_0x4e84fc[_0x71c1('0x6c')]=_0x4e84fc[_0x71c1('0xe2')];_0x4e84fc[_0x71c1('0xe3')]=_0x5b8ad6[_0x71c1('0xe3')];_0x4e84fc[_0x71c1('0xef')]=_0x5b8ad6['calleridnum'];hopperUtils[_0x71c1('0xc7')](_0x4e84fc)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xf0')));}})[_0x71c1('0x37')](function(){if(_0x264bb8)hopperUtils[_0x71c1('0xe5')](_0x5b8ad6,_0x4eb011,_0x525890)[_0x71c1('0x37')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x5916c9){if(this[_0x71c1('0x22')][_0x5916c9['uniqueid']]){this[_0x71c1('0x22')][_0x5916c9[_0x71c1('0xbd')]][_0x71c1('0xf1')]=_0x5916c9['channel'];}if(this[_0x71c1('0x24')][_0x5916c9[_0x71c1('0xbd')]]){this[_0x71c1('0x24')][_0x5916c9[_0x71c1('0xbd')]][_0x71c1('0xf1')]=_0x5916c9[_0x71c1('0xf1')];}};Dialer[_0x71c1('0x84')][_0x71c1('0xf2')]=function(_0x5162b4){if(!this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]]){return;}var _0x382e9d=this[_0x71c1('0x1e')][this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xbc')]][_0x71c1('0xf4')]||_0x71c1('0xf5');if(_0x382e9d===_0x71c1('0xf6')){if(this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]]&&_['isNil'](this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xf7')])&&_0x5162b4['status']==='1'&&_0x5162b4[_0x71c1('0xf8')]==='0'){if(this['agents'][_0x5162b4[_0x71c1('0xf9')]]){if(!this['agents'][_0x5162b4[_0x71c1('0xf9')]][_0x71c1('0xf7')]){this[_0x71c1('0xfa')][_0x5162b4[_0x71c1('0xf9')]]['locked']=!![];this['actions'][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xf7')]=!![];this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xf9')]=_0x5162b4[_0x71c1('0xf9')];}}}}else if(_0x382e9d===_0x71c1('0xf5')){if(this[_0x71c1('0x22')][_0x5162b4['actionid']]){if(this[_0x71c1('0xfa')][_0x5162b4[_0x71c1('0xf9')]]){this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]]['stateinterface']=_0x5162b4['stateinterface'];if(_['isNil'](this[_0x71c1('0x26')][this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xbc')]])){this[_0x71c1('0x26')][this['actions'][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xbc')]]=[];}this[_0x71c1('0x26')][this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]][_0x71c1('0xbc')]][_0x71c1('0x98')](_[_0x71c1('0x59')](_[_0x71c1('0x6f')](this[_0x71c1('0x22')][_0x5162b4[_0x71c1('0xf3')]],[_0x71c1('0xfb'),_0x71c1('0xf9')]),{'status':_0x5162b4[_0x71c1('0x88')],'paused':_0x5162b4[_0x71c1('0xf8')]}));}}}};Dialer['prototype'][_0x71c1('0xfc')]=function(_0x8156f7){if(!this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]]){return;}var _0x78f1e0=this;var _0x2e5492=this['voiceQueues'][this['actions'][_0x8156f7[_0x71c1('0xf3')]]['queue']];var _0x49c472=_0x2e5492[_0x71c1('0xf4')]||'rrmemory';if(_0x49c472===_0x71c1('0xf6')){if(this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]]&&this['actions'][_0x8156f7['actionid']][_0x71c1('0xf9')]){this[_0x71c1('0xfd')][_0x71c1('0xfe')](this['actions'][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xfb')],this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xf9')])['catch'](function(_0x1a51f3){logger[_0x71c1('0x60')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x71c1('0x7b')](_0x1a51f3,{'showHidden':![],'depth':null}));})[_0x71c1('0x1c')](function(){utils[_0x71c1('0xbf')](_0x78f1e0['voiceQueues'][_0x78f1e0['actions'][_0x8156f7['actionid']][_0x71c1('0xbc')]],'[syncQueueStatusComplete]');_0x78f1e0[_0x71c1('0xfa')][_0x78f1e0[_0x71c1('0x22')][_0x8156f7['actionid']][_0x71c1('0xf9')]][_0x71c1('0xf7')]=![];delete _0x78f1e0[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]];unlockQueueStatus(_0x2e5492);});}else{utils[_0x71c1('0xbf')](this[_0x71c1('0x1e')][this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]],'[syncQueueStatusComplete]');hopperUtils[_0x71c1('0xd9')]({'active':![],'ContactId':this[_0x71c1('0x22')][_0x8156f7['actionid']][_0x71c1('0xdc')],'ListId':this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xdd')],'VoiceQueueId':this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xde')]||undefined,'CampaignId':this[_0x71c1('0x22')][_0x8156f7['actionid']][_0x71c1('0xdf')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x8156f7[_0x71c1('0xf3')]];unlockQueueStatus(_0x2e5492);}}else if(_0x49c472==='rrmemory'){var _0xd4fd3b;if(this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]]&&!_['isEmpty'](this[_0x71c1('0x26')][this['actions'][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]])){if(this[_0x71c1('0x27')][_0x78f1e0[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]]){this[_0x71c1('0x27')][_0x78f1e0[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]]=this['queueBookedRR'][this['actions'][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]]?this[_0x71c1('0x27')][this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]]['queue']]:this[_0x71c1('0x26')][this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]]['queue']]?this[_0x71c1('0x26')][this['actions'][_0x8156f7[_0x71c1('0xf3')]]['queue']][_0x71c1('0xff')]||0x0:0x0;}this[_0x71c1('0x26')][this[_0x71c1('0x22')][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]][_0x71c1('0xff')]=this[_0x71c1('0x27')][this['actions'][_0x8156f7[_0x71c1('0xf3')]][_0x71c1('0xbc')]];for(var _0x3a8841=0x0;_0x3a8841=_0x1d27b3[_0x71c1('0x129')]){_0x4849fd['stateGlobal'](_0x5b1ee7,_0x7b47ba,_0x76d104,_0x71c1('0x12a'));}else{if(_0x5b1ee7['countmachineretry']>=_0x1d27b3['dialMachineMaxRetry']){_0x4849fd['createStateFinal'](_0x5b1ee7,_0x7b47ba,_0x76d104,'reason\x2019\x20machine....');}else{hopperUtils[_0x71c1('0xd9')]({'active':![],'countmachineretry':_0x5b1ee7['countmachineretry'],'scheduledat':moment()[_0x71c1('0xda')](_0x1d27b3['dialMachineRetryFrequency'],_0x71c1('0xdb'))['format'](_0x71c1('0xc1')),'ContactId':_0x5b1ee7[_0x71c1('0xdc')],'ListId':_0x5b1ee7[_0x71c1('0xdd')],'VoiceQueueId':_0x5b1ee7['VoiceQueueId']||undefined,'CampaignId':_0x5b1ee7[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x12b')));_0x7b47ba({'reschedule':0x1});}}});}if(_0x37085b['type']==='ivr'&&this[_0x71c1('0x1f')][_0x37085b[_0x71c1('0xbc')]][_0x71c1('0x115')]&&_0x280890[_0x71c1('0x116')]==='HANGUP'){delete this[_0x71c1('0x24')][_0x280890[_0x71c1('0xbd')]];utils[_0x71c1('0xbf')](this[_0x71c1('0x1f')][_0x37085b[_0x71c1('0xbc')]],_0x71c1('0x117'));_0x4e0f86=new Hangup(_0x37085b,_0x280890);_0x4e0f86['state']=0x12;_0x4e0f86['statedesc']=_0x71c1('0x119');_0x4e0f86[_0x71c1('0x122')]=_0x71c1('0x11a');ami['emit'](_0x71c1('0x11b'),ut[_0x71c1('0x11c')](_0x4e0f86,'amd'));this['saveInDb'](_0x4e0f86,_0x71c1('0x12c'),_0x71c1('0x12d'));}if(_0x37085b[_0x71c1('0x3b')]===_0x71c1('0xbe')&&this[_0x71c1('0x1f')][_0x37085b[_0x71c1('0xbc')]]['dialAMDActive']&&_0x280890[_0x71c1('0x116')]===_0x71c1('0x12e')){return new Promise(function(_0xc8b5fa,_0x3610f8){delete _0x4849fd[_0x71c1('0x24')][_0x280890[_0x71c1('0xbd')]];utils['decrementOriginate'](_0x4849fd['campaigns'][_0x37085b['queue']],_0x71c1('0x117'));_0x4849fd['campaigns'][_0x37085b[_0x71c1('0xbc')]][_0x71c1('0xc2')]+=0x1;_0x4849fd[_0x71c1('0x1f')][_0x37085b[_0x71c1('0xbc')]][_0x71c1('0x118')]+=0x1;var _0x4b6df9=_0x4849fd[_0x71c1('0x1f')][_0x37085b['queue']];var _0x730ec2=new Hangup(_0x37085b,_0x280890);_0x730ec2[_0x71c1('0x6a')]=0x13;_0x730ec2[_0x71c1('0x6b')]=_0x71c1('0x121');_0x730ec2[_0x71c1('0x122')]=_0x71c1('0x11a');_0x730ec2[_0x71c1('0x123')]+=0x1;_0x730ec2[_0x71c1('0xd4')]+=0x1;_0x730ec2[_0x71c1('0x11d')]=!![];ami['emit'](_0x71c1('0x11b'),ut[_0x71c1('0x11c')](_0x730ec2,_0x71c1('0x11d')));hopperUtils[_0x71c1('0xc7')](_0x730ec2)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x124')));if(_0x730ec2[_0x71c1('0x125')]+_0x730ec2['countcongestionretry']+_0x730ec2['countnoanswerretry']+_0x730ec2[_0x71c1('0x12f')]+_0x730ec2[_0x71c1('0xd3')]+_0x730ec2['countabandonedretry']+_0x730ec2[_0x71c1('0x123')]+_0x730ec2['countagentrejectretry']>=_0x4b6df9[_0x71c1('0x129')]){_0x4849fd[_0x71c1('0x130')](_0x730ec2,_0xc8b5fa,_0x3610f8,_0x71c1('0x12a'));}else{if(_0x730ec2[_0x71c1('0x123')]>=_0x4b6df9[_0x71c1('0x131')]){_0x4849fd[_0x71c1('0x132')](_0x730ec2,_0xc8b5fa,_0x3610f8,_0x71c1('0x133'));}else{hopperUtils[_0x71c1('0xd9')]({'active':![],'countmachineretry':_0x730ec2['countmachineretry'],'scheduledat':moment()['add'](_0x4b6df9[_0x71c1('0x134')],_0x71c1('0xdb'))['format'](_0x71c1('0xc1')),'ContactId':_0x730ec2[_0x71c1('0xdc')],'ListId':_0x730ec2[_0x71c1('0xdd')],'VoiceQueueId':_0x730ec2[_0x71c1('0xde')]||undefined,'CampaignId':_0x730ec2[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0xc8b5fa({'reschedule':0x1});}}});}}};Dialer[_0x71c1('0x84')]['syncHangup']=function(_0x3355cd){var _0xeb47f6=this[_0x71c1('0x24')][_0x3355cd[_0x71c1('0xbd')]];var _0x4f43e2;if(!_0xeb47f6){return;}if(_0xeb47f6['type']===_0x71c1('0xbe')){delete this['uniqueId'][_0x3355cd[_0x71c1('0xbd')]];utils[_0x71c1('0xbf')](this[_0x71c1('0x1f')][_0xeb47f6[_0x71c1('0xbc')]],_0x71c1('0x135'));this[_0x71c1('0x1f')][_0xeb47f6[_0x71c1('0xbc')]][_0x71c1('0x136')]+=0x1;if(_0x3355cd[_0x71c1('0x137')]===_0x71c1('0x138')){const _0x564c7f=new AgentComplete(_0xeb47f6,_0x3355cd);_0x564c7f[_0x71c1('0xdf')]=this[_0x71c1('0x1f')][_0xeb47f6[_0x71c1('0xbc')]]['id'];hopperUtils['createHistory'](_0x564c7f)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x139')));hopperUtils[_0x71c1('0x13a')](_0x564c7f)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x13b')));}else{_0x4f43e2=new Hangup(_0xeb47f6,_0x3355cd);hopperUtils[_0x71c1('0xc7')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x13c')));hopperUtils[_0x71c1('0x13a')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x13d')));}}else{if(isNotNull(this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]][_0x71c1('0x13e')])){delete this[_0x71c1('0x24')][_0x3355cd[_0x71c1('0xbd')]];utils[_0x71c1('0xbf')](this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]],_0x71c1('0x135'));this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]][_0x71c1('0xc2')]+=0x1;this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4f43e2=new Hangup(_0xeb47f6,_0x3355cd);_0x4f43e2['state']=0x10;_0x4f43e2[_0x71c1('0x6b')]=_0x71c1('0x13f');_0x4f43e2['membername']=_0x71c1('0x140');hopperUtils[_0x71c1('0xc7')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x13c')));hopperUtils[_0x71c1('0x13a')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x3355cd[_0x71c1('0xbd')]];utils[_0x71c1('0xbf')](this['voiceQueues'][_0xeb47f6['queue']],'[syncHangup2]');if(_0x3355cd['cause-txt']==='Normal\x20Clearing'){this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]][_0x71c1('0xc2')]+=0x1;const _0x12f081=new AgentComplete(_0xeb47f6,_0x3355cd);_0x12f081[_0x71c1('0xde')]=this[_0x71c1('0x1e')][_0xeb47f6['queue']]['id'];hopperUtils[_0x71c1('0xc7')](_0x12f081)['catch'](loggerCatch(_0x71c1('0xc8')));hopperUtils[_0x71c1('0x13a')](_0x12f081)['catch'](loggerCatch(_0x71c1('0xc9')));}else{this[_0x71c1('0x1e')][_0xeb47f6[_0x71c1('0xbc')]]['outboundUnknownCallsDay']+=0x1;_0x4f43e2=new Hangup(_0xeb47f6,_0x3355cd);_0x4f43e2['state']=0xc;_0x4f43e2[_0x71c1('0x6b')]=_0x3355cd[_0x71c1('0x137')];_0x4f43e2['membername']='Unknown';hopperUtils[_0x71c1('0xc7')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0x71c1('0x13a')](_0x4f43e2)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x135')));}}}};Dialer[_0x71c1('0x84')][_0x71c1('0xb')]=function(_0x33371a){var _0x3b7bcf=this;if(!_0x3b7bcf['queuesSummary'][_0x33371a['name']]){_0x3b7bcf[_0x71c1('0x141')][_0x33371a['name']]={'running':![]};}else if(_0x3b7bcf[_0x71c1('0x141')][_0x33371a['name']]['running']===!![]){return;}else if(_0x3b7bcf[_0x71c1('0x141')][_0x33371a['name']]['running']===![]){_0x3b7bcf[_0x71c1('0x141')][_0x33371a[_0x71c1('0x40')]][_0x71c1('0x142')]=!![];}var _0x4e6d1d=_0x3b7bcf[_0x71c1('0x1e')][_0x33371a['name']];var _0xc9baab=_0x4e6d1d['message']!==utils[_0x71c1('0x64')]['INACTIVE'];var _0x393afb=utils[_0x71c1('0x143')](_0x4e6d1d);_0x4e6d1d[_0x71c1('0x144')]=utils[_0x71c1('0x145')](_0x4e6d1d,_0x3b7bcf['trunks']);Promise[_0x71c1('0xaa')]()[_0x71c1('0x37')](function(){if(_0x4e6d1d[_0x71c1('0x144')]===utils['CAMPAIGN_STATUS'][_0x71c1('0x75')]){if(_0xc9baab){clearPredictiveAttributes(_0x4e6d1d);_0x33371a['startPredictive']=undefined;_0x33371a['startProgressive']=undefined;}if(_0x4e6d1d[_0x71c1('0x144')]===utils[_0x71c1('0x64')][_0x71c1('0x75')]){_0x33371a[_0x71c1('0x146')]=0x0;_0x33371a[_0x71c1('0xf8')]=0x0;_0x33371a['inUse']=0x0;_0x33371a[_0x71c1('0x147')]=0x0;_0x33371a[_0x71c1('0x148')]=0x0;}}else if(_0x4e6d1d[_0x71c1('0x144')]===utils[_0x71c1('0x64')]['ACTIVE']&&!_0x393afb){return _0x3b7bcf[_0x71c1('0x93')](_0x4e6d1d,!![])['then'](function(){return _0x3b7bcf[_0x71c1('0x93')](_0x4e6d1d,![]);})[_0x71c1('0x37')](function(){return _0x3b7bcf[_0x71c1('0xad')](_0x4e6d1d);})['catch'](function(_0x577648){loggerSyncQueueSummary[_0x71c1('0x3d')](_0x71c1('0x149'),util[_0x71c1('0x7b')](_0x577648,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4e6d1d);});}else{clearPredictiveAttributes(_0x4e6d1d);}})[_0x71c1('0x37')](function(){var _0x59e82b=_0x33371a[_0x71c1('0x14a')](_0x4e6d1d);if(_0x59e82b||_0x4e6d1d['queueSummaryCountersUpdated']){_0x4e6d1d[_0x71c1('0x14b')]=![];_0x33371a[_0x71c1('0x14c')](_0x4e6d1d);Object[_0x71c1('0x14d')](_0x4e6d1d,_0x33371a);emitOutboundVoiceQueueSummary(_0x33371a);}_0x3b7bcf[_0x71c1('0x141')][_0x4e6d1d[_0x71c1('0x40')]][_0x71c1('0x142')]=![];})[_0x71c1('0x9e')](function(_0x6a47c9){logger[_0x71c1('0x60')](_0x71c1('0x149'),util[_0x71c1('0x7b')](_0x6a47c9,{'showHidden':![],'depth':null}));_0x3b7bcf['queuesSummary'][_0x4e6d1d[_0x71c1('0x40')]][_0x71c1('0x142')]=![];});};Dialer['prototype'][_0x71c1('0x30')]=_['throttle'](function(){var _0x54c823=_['filter'](this[_0x71c1('0x1e')],function(_0x107137){return _0x107137[_0x71c1('0x14e')];});var _0x45520e=_[_0x71c1('0x14f')](this['agents'],function(_0x29cb99){return _0x29cb99[_0x71c1('0x150')]&&_0x29cb99[_0x71c1('0x88')]===_0x71c1('0x151');});if(_0x54c823['length']>0x0&&_0x45520e[_0x71c1('0x97')]>0x0){return Promise[_0x71c1('0xaa')]()[_0x71c1('0x37')](cmHopper[_0x71c1('0x152')](_[_0x71c1('0x153')](_0x54c823,'id'),previewRecallmeReminderInterval,_[_0x71c1('0x153')](_0x45520e,'id')))['then'](function(_0x2036a7){for(var _0x5742d8=0x0;_0x5742d8<_0x2036a7[_0x71c1('0x97')];_0x5742d8++){var _0x64e6ef=_0x2036a7[_0x5742d8]['Agent']['name'];if(_0x64e6ef)io['to'](util[_0x71c1('0x78')]('user:%s',_0x64e6ef))[_0x71c1('0x3a')](_0x71c1('0x154'),{'hopper':_0x2036a7[_0x5742d8]});}})[_0x71c1('0x9e')](function(_0x3cd8ed){logger['error'](_0x71c1('0x155'),_0x3cd8ed);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x71c1('0x156')]=function(){var _0x1cbc14=this;setInterval(function(){_0x1cbc14[_0x71c1('0x157')](_0x1cbc14[_0x71c1('0x24')],_0x71c1('0x158'));_0x1cbc14[_0x71c1('0x157')](_0x1cbc14[_0x71c1('0x22')],_0x71c1('0x159'));},0x32c8);};Dialer[_0x71c1('0x84')]['clearZombieChannels']=function(_0x12855f,_0x506fc7){var _0x502910=this;for(var _0x541cf2 in _0x12855f){if(typeof _0x12855f[_0x541cf2]!==_0x71c1('0xa9')){this[_0x71c1('0x1d')][_0x71c1('0x1a')](function(){if(!_[_0x71c1('0x104')](_0x12855f[_0x541cf2])){return ami['Action']({'action':_0x71c1('0x88'),'channel':_0x12855f[_0x541cf2][_0x71c1('0xf1')]})['catch'](function(_0x3b381c){if(_0x3b381c[_0x71c1('0x63')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x12855f[_0x541cf2]&&_0x12855f[_0x541cf2][_0x71c1('0x3b')]!==_0x71c1('0xbe')){utils[_0x71c1('0xbf')](_0x502910[_0x71c1('0x1e')][_0x12855f[_0x541cf2][_0x71c1('0xbc')]],_0x71c1('0x15a'));logger['error']('[Dialer][checkChannel]',_0x506fc7,_0x541cf2,_0x12855f[_0x541cf2]['queue']);delete _0x12855f[_0x541cf2];}if(_0x12855f[_0x541cf2]&&_0x12855f[_0x541cf2]['type']===_0x71c1('0xbe')){utils['decrementOriginate'](_0x502910[_0x71c1('0x1f')][_0x12855f[_0x541cf2][_0x71c1('0xbc')]],_0x71c1('0x15a'));logger[_0x71c1('0x60')](_0x71c1('0x15b'),_0x506fc7,_0x541cf2,_0x12855f[_0x541cf2][_0x71c1('0xbc')]);delete _0x12855f[_0x541cf2];}},0x2328);}});}});}}};Dialer[_0x71c1('0x84')]['getVoiceQueueRtPauses']=function(_0x32b2c3){return Promise['resolve']()[_0x71c1('0x37')](voiceQueueRt[_0x71c1('0x15c')](_0x32b2c3))[_0x71c1('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x71c1('0x84')][_0x71c1('0x15d')]=function(_0x668530,_0x16dcc2,_0x26ebea){var _0x132c0e={'state':0x19,'statedesc':_0x71c1('0x15e')};utils[_0x71c1('0xbf')](_0x16dcc2,_0x71c1('0x15f')+_0x668530);this['saveInDb'](_[_0x71c1('0x59')](_0x132c0e,_['pick'](_0x26ebea,[_0x71c1('0xdc'),_0x71c1('0xdd'),_0x71c1('0x160'),_0x71c1('0xde'),_0x71c1('0xdf')])),_0x71c1('0x161'),'[emptyContact]');logger[_0x71c1('0x60')](_0x668530);};Dialer['prototype'][_0x71c1('0x11e')]=function(_0x3e8be0,_0x3bfbfe,_0x1d06a0){hopperUtils[_0x71c1('0xc7')](_0x3e8be0)[_0x71c1('0x9e')](loggerCatch(_0x3bfbfe));hopperUtils[_0x71c1('0x13a')](_0x3e8be0)[_0x71c1('0x9e')](loggerCatch(_0x1d06a0));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x22651d,_0x5bdc80){hopperUtils[_0x71c1('0xc7')](_0x22651d)[_0x71c1('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5bdc80==0x0){hopperUtils[_0x71c1('0x13a')](_0x22651d)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x162')));}};Dialer[_0x71c1('0x84')][_0x71c1('0x155')]=function(_0xf47147){return Promise[_0x71c1('0xaa')]()[_0x71c1('0x37')](cmHopper[_0x71c1('0x152')](_0xf47147['id'],previewRecallmeReminderInterval))[_0x71c1('0x37')](function(_0x4b3763){for(var _0x71b382=0x0;_0x71b382<_0x4b3763[_0x71c1('0x97')];_0x71b382++){var _0x17d711=_0x4b3763[_0x71b382][_0x71c1('0x163')][_0x71c1('0x40')];if(_0x17d711)io['to'](util[_0x71c1('0x78')](_0x71c1('0x164'),_0x17d711))[_0x71c1('0x3a')](_0x71c1('0x154'),{'hopper':_0x4b3763[_0x71b382]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x3efc97){var _0x16e5a7=this;return function(){_0x16e5a7[_0x71c1('0x165')](_0x3efc97);};};Dialer[_0x71c1('0x84')]['actionOriginate']=function(_0x231e03,_0x3637ca){var _0x3c4371=this;var _0x33e3e2=uuid['v4']();this[_0x71c1('0x22')][_0x33e3e2]=new Action(_0x231e03,_0x3637ca,_0x33e3e2);return new Promise(function(_0x3a1c58,_0x56a2ea){if(_[_0x71c1('0x39')](_0x231e03)&&typeof _0x231e03!==_0x71c1('0x166')){return _0x56a2ea(msgResponse(_0x71c1('0x167'),_0x71c1('0x90'),_0x71c1('0x168')));}if(_[_0x71c1('0x39')](_0x3637ca['phone'])||_0x3637ca['phone']===null){return _0x56a2ea(msgResponse('originate',_0x71c1('0x90'),_0x71c1('0x169')));}var _0x2885c8={'XMD-CALLERID':_0x3c4371[_0x71c1('0x22')][_0x33e3e2]['getCaller'](),'XMD-AGI':_0x231e03[_0x71c1('0x13e')]?util[_0x71c1('0x78')](_0x71c1('0x16a'),ipAgi,_0x231e03['dialQueueProject']):_0x71c1('0x16b'),'XMD-AGIAFTER':_0x231e03[_0x71c1('0xd2')]?util[_0x71c1('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x231e03[_0x71c1('0xd2')]):_0x71c1('0x16b'),'XMD-QUEUE':utils[_0x71c1('0x16c')](_0x231e03)?util[_0x71c1('0x78')]('\x22%s,%s%s,,,%s\x22',_0x231e03[_0x71c1('0x40')],_0x231e03[_0x71c1('0x16d')]||'',_0x231e03[_0x71c1('0xc6')]?'c':'',_0x231e03[_0x71c1('0xce')]||0x3):_0x71c1('0x16b'),'XMD-CONTACTID':_0x3637ca[_0x71c1('0xdc')],'XMD-CDRTYPE':_0x71c1('0x8'),'CALLERID(all)':_0x3c4371[_0x71c1('0x22')][_0x33e3e2]['getCaller'](),'XMD-AMD':_0x231e03[_0x71c1('0x115')]?_0x71c1('0x16e'):_0x71c1('0x16b'),'XMD-DESTINATION':_0x71c1('0x114')};if(_0x231e03['dialAMDActive']){_0x2885c8[_0x71c1('0x16f')]=_0x231e03[_0x71c1('0x170')]||0x9c4;_0x2885c8[_0x71c1('0x171')]=_0x231e03[_0x71c1('0x172')]||0x5dc;_0x2885c8[_0x71c1('0x173')]=_0x231e03['dialAMDAfterGreetingSilence']||0x320;_0x2885c8['XMD-AMDTOTALANALYSISTIME']=_0x231e03['dialAMDTotalAnalysisTime']||0x1388;_0x2885c8[_0x71c1('0x174')]=_0x231e03[_0x71c1('0x175')]||0x64;_0x2885c8['XMD-AMDBETWEENWORDSSILENCE']=_0x231e03['dialAMDBetweenWordsSilence']||0x32;_0x2885c8[_0x71c1('0x176')]=_0x231e03['dialAMDMaximumNumberOfWords']||0x3;_0x2885c8[_0x71c1('0x177')]=_0x231e03[_0x71c1('0x178')]||0x100;_0x2885c8[_0x71c1('0x179')]=_0x231e03[_0x71c1('0x17a')]||0x1388;}if(utils[_0x71c1('0x16c')](_0x231e03)){_0x2885c8[_0x71c1('0x17b')]=_0x3637ca[_0x71c1('0xde')];}else{_0x2885c8['XMD-CAMPAIGNID']=_0x3637ca[_0x71c1('0xdf')];}var _0x30818c=utils['setXMDContactVariables'](_0x3637ca[_0x71c1('0x17c')]);Object[_0x71c1('0x14d')](_0x2885c8,_0x30818c);var _0x385380=_0x3c4371[_0x71c1('0x85')](_0x231e03[_0x71c1('0x8a')])?utils[_0x71c1('0x17d')](_0x231e03[_0x71c1('0x8a')][_0x71c1('0x17e')],_0x231e03['dialOriginateCallerIdName'],_0x231e03[_0x71c1('0x17f')]>0x0?utils[_0x71c1('0x180')](_0x231e03[_0x71c1('0x181')],_0x231e03[_0x71c1('0x17f')]):_0x231e03['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0x71c1('0x104')](_0x231e03[_0x71c1('0x8b')])?_0x231e03[_0x71c1('0x8a')][_0x71c1('0x17e')]:_0x231e03[_0x71c1('0x8b')][_0x71c1('0x17e')],_0x231e03['dialOriginateCallerIdName'],_0x231e03['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x71c1('0x180')](_0x231e03[_0x71c1('0x181')],_0x231e03['dialRandomLastDigitCallerIdNumber']):_0x231e03[_0x71c1('0x181')]);if(_0x385380){_0x2885c8['XMD-ORIGINATECALLERIDNAME']=_0x3c4371[_0x71c1('0x22')][_0x33e3e2][_0x71c1('0x182')]=utils[_0x71c1('0x183')](_0x385380);_0x2885c8[_0x71c1('0x184')]=_0x3637ca[_0x71c1('0x185')];}_0x231e03['variables']=_0x2885c8;return ami[_0x71c1('0x99')]({'actionid':_0x33e3e2,'action':_0x71c1('0x167'),'channel':_0x3c4371[_0x71c1('0x85')](_0x231e03['Trunk'])?util[_0x71c1('0x78')](_0x71c1('0x186'),_0x231e03[_0x71c1('0x8a')]['name'],isNotNull(_0x231e03[_0x71c1('0x187')])?_0x231e03[_0x71c1('0x187')][_0x71c1('0x188')]()||'':'',_0x231e03[_0x71c1('0x189')]>0x0?_0x3637ca[_0x71c1('0x185')][_0x71c1('0x18a')](_0x231e03['dialCutDigit']):_0x3637ca['phone']):util[_0x71c1('0x78')](_0x71c1('0x186'),_[_0x71c1('0x104')](_0x231e03[_0x71c1('0x8b')])?_0x231e03['Trunk'][_0x71c1('0x40')]:_0x231e03['TrunkBackup'][_0x71c1('0x40')],isNotNull(_0x231e03[_0x71c1('0x187')])?_0x231e03[_0x71c1('0x187')][_0x71c1('0x188')]()||'':'',_0x231e03[_0x71c1('0x189')]>0x0?_0x3637ca[_0x71c1('0x185')]['substring'](_0x231e03['dialCutDigit']):_0x3637ca[_0x71c1('0x185')]),'callerid':_0x385380,'Exten':'xcally-motion-dialer','Context':_0x71c1('0x18b'),'Priority':'1','variable':_0x2885c8,'timeout':(_0x231e03[_0x71c1('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x33e3e2})[_0x71c1('0x37')](function(_0x3ac7b7){return _0x3a1c58(_0x3ac7b7);})[_0x71c1('0x9e')](function(_0x53dddc){_0x231e03['outboundOriginateFailureCallsDay']+=0x1;var _0x4bab4c=new History(_0x3c4371['actions'][_0x33e3e2]);logger[_0x71c1('0x60')](util[_0x71c1('0x78')](_0x71c1('0x18d'),JSON[_0x71c1('0x83')](_0x53dddc)));_0x4bab4c[_0x71c1('0x6a')]=0xe;_0x4bab4c[_0x71c1('0x6b')]=_0x71c1('0x18e');_0x4bab4c[_0x71c1('0xe2')]=moment()[_0x71c1('0x78')](_0x71c1('0xc1'));_0x4bab4c[_0x71c1('0x6c')]=_0x4bab4c[_0x71c1('0xe2')];hopperUtils[_0x71c1('0xc7')](_0x4bab4c)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x18f')));_0x3c4371[_0x71c1('0x13a')](_0x4bab4c)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x18f')))[_0x71c1('0x1c')](function(){delete _0x3c4371['actions'][_0x33e3e2];return _0x56a2ea(msgResponse(_0x71c1('0x167'),_0x71c1('0x82'),_0x71c1('0x190')));});});});};Dialer[_0x71c1('0x84')][_0x71c1('0x191')]=function(_0x5e30fe,_0x436590,_0x14b226){var _0x25467d=new History(_0x436590);if(_0x25467d['countbusyretry']+_0x25467d[_0x71c1('0x126')]+_0x25467d['countnoanswerretry']+_0x25467d['countnosuchnumberretry']+_0x25467d[_0x71c1('0xd3')]+_0x25467d[_0x71c1('0xec')]+_0x25467d['countmachineretry']+_0x25467d[_0x71c1('0x128')]>=_0x14b226['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5e30fe){case 0x3:if(_0x25467d[_0x71c1('0x127')]>=_0x14b226[_0x71c1('0x192')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countnoanswerretry':_0x25467d[_0x71c1('0x127')]+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226['dialNoAnswerRetryFrequency'],_0x71c1('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d['VoiceQueueId']||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x193')));break;case 0x5:if(_0x25467d['countbusyretry']>=_0x14b226['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countbusyretry':_0x25467d[_0x71c1('0x125')]+=0x1,'scheduledat':moment()['add'](_0x14b226[_0x71c1('0x194')],'minutes')[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d['VoiceQueueId']||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x195')));break;case 0x8:if(_0x25467d[_0x71c1('0x126')]>=_0x14b226[_0x71c1('0x196')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countcongestionretry':_0x25467d[_0x71c1('0x126')]+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226[_0x71c1('0x197')],_0x71c1('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d['VoiceQueueId']||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})['catch'](loggerCatch(_0x71c1('0x198')));break;case 0x0:if(_0x25467d[_0x71c1('0x12f')]>=_0x14b226['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x71c1('0xd9')]({'active':![],'countnosuchnumberretry':_0x25467d[_0x71c1('0x12f')]+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226[_0x71c1('0x199')],_0x71c1('0xdb'))[_0x71c1('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d['VoiceQueueId']||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x25467d['countdropretry']>=_0x14b226[_0x71c1('0x19a')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countdropretry':_0x25467d[_0x71c1('0xd3')]+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226[_0x71c1('0x19b')],_0x71c1('0xdb'))[_0x71c1('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25467d['ContactId'],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d[_0x71c1('0xde')]||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0xe0')));break;case 0xb:if(_0x25467d['countabandonedretry']>=_0x14b226[_0x71c1('0xed')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countabandonedretry':_0x25467d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226['dialAbandonedRetryFrequency'],_0x71c1('0xdb'))[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x25467d['ContactId'],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d[_0x71c1('0xde')]||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x25467d[_0x71c1('0x123')]>=_0x14b226[_0x71c1('0x131')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countmachineretry':_0x25467d[_0x71c1('0x123')]+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226['dialMachineRetryFrequency'],'minutes')[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d[_0x71c1('0xde')]||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x12b')));break;case 0x14:if(_0x25467d[_0x71c1('0x128')]>=_0x14b226[_0x71c1('0x19c')]-0x1){return!![];}hopperUtils[_0x71c1('0xd9')]({'active':![],'countagentrejectretry':_0x25467d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x71c1('0xda')](_0x14b226[_0x71c1('0x19d')],_0x71c1('0xdb'))[_0x71c1('0x78')](_0x71c1('0xc1')),'ContactId':_0x25467d[_0x71c1('0xdc')],'ListId':_0x25467d[_0x71c1('0xdd')],'VoiceQueueId':_0x25467d['VoiceQueueId']||undefined,'CampaignId':_0x25467d[_0x71c1('0xdf')]||undefined})['catch'](loggerCatch(_0x71c1('0x19e')));break;default:return!![];}};Dialer[_0x71c1('0x84')][_0x71c1('0x19f')]=function(_0x296331,_0x5e4022,_0x593cd0){var _0x38f01c=this;var _0x22b64a=new History(_0x296331);var _0x487b79=![];var _0x4e5f5c;var _0x46e67e;return new Promise(function(_0x520676,_0x3109a0){if(_[_0x71c1('0x39')](_0x5e4022)&&typeof _0x5e4022!==_0x71c1('0x166')){return _0x3109a0(msgResponse(_0x71c1('0x1a0'),_0x71c1('0x90'),_0x71c1('0x1a1')));}if(_[_0x71c1('0x39')](_0x593cd0)&&typeof _0x593cd0!==_0x71c1('0x166')){return _0x3109a0(msgResponse(_0x71c1('0x1a0'),_0x71c1('0x90'),_0x71c1('0x1a2')));}hopperUtils['verifyAdditionalPhones'](_0x22b64a,_0x593cd0['reason'],_0x5e4022)[_0x71c1('0x37')](function(_0x57109c){if(_0x57109c[_0x71c1('0xd8')]==0x1)_0x487b79=!![];switch(_0x593cd0['reason']){case'0':_0x5e4022[_0x71c1('0x1a3')]+=0x1;_0x22b64a[_0x71c1('0x6a')]=0x0;_0x22b64a[_0x71c1('0x6b')]=_0x71c1('0x1a4');_0x22b64a[_0x71c1('0x12f')]+=0x1;_0x22b64a[_0x71c1('0xd4')]+=0x1;ami[_0x71c1('0x3a')](_0x71c1('0x1a5'),ut['buildObj'](_0x296331,_0x71c1('0x1a6')));_0x4e5f5c=_0x5e4022[_0x71c1('0x199')];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];hopperUtils[_0x71c1('0xc7')](_0x22b64a)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x124')));if(_0x38f01c['checkRetriveMax'](0x0,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a[_0x71c1('0x12f')]>=_0x5e4022[_0x71c1('0x1a7')]){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,'reason\x200\x20no\x20such\x20number....');}else{_0x38f01c['stateGlobal'](_0x22b64a,_0x520676,_0x3109a0,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5e4022['outboundNoAnswerCallsDay']+=0x1;_0x22b64a[_0x71c1('0x6a')]=0x3;_0x22b64a[_0x71c1('0x6b')]=_0x71c1('0x1a8');_0x22b64a['countnoanswerretry']+=0x1;_0x22b64a[_0x71c1('0xd4')]+=0x1;var _0x5d90bd=ut[_0x71c1('0x1a9')](_0x296331,_0x5e4022);ami[_0x71c1('0x3a')](_0x71c1('0x1aa'),_0x5d90bd);_0x4e5f5c=_0x5e4022['dialNoAnswerRetryFrequency'];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];hopperUtils[_0x71c1('0xc7')](_0x22b64a)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1ab')));if(_0x38f01c[_0x71c1('0x191')](0x3,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a['countnoanswerretry']>=_0x5e4022[_0x71c1('0x192')]){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,'reason\x203\x20ringing\x20no\x20answer');}else{_0x38f01c[_0x71c1('0x130')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1ac'));}}break;case'5':_0x5e4022[_0x71c1('0x1ad')]+=0x1;_0x22b64a['state']=0x5;_0x22b64a['statedesc']=_0x71c1('0x1ae');_0x22b64a[_0x71c1('0x125')]+=0x1;_0x22b64a[_0x71c1('0xd4')]+=0x1;ami[_0x71c1('0x3a')](_0x71c1('0x1af'),ut[_0x71c1('0x11c')](_0x296331,_0x71c1('0x1b0')));_0x4e5f5c=_0x5e4022[_0x71c1('0x194')];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];hopperUtils[_0x71c1('0xc7')](_0x22b64a)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1b1')));if(_0x38f01c[_0x71c1('0x191')](0x5,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a['countbusyretry']>=_0x5e4022[_0x71c1('0x1b2')]){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,'reason\x205\x20busy');}else{_0x38f01c['stateGlobal'](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1b3'));}}break;case'8':_0x5e4022['outboundCongestionCallsDay']+=0x1;_0x22b64a[_0x71c1('0x6a')]=0x8;_0x22b64a['statedesc']=_0x71c1('0x1b4');_0x22b64a[_0x71c1('0x126')]+=0x1;_0x22b64a[_0x71c1('0xd4')]+=0x1;_0x4e5f5c=_0x5e4022[_0x71c1('0x197')];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];ami['emit'](_0x71c1('0x1b5'),ut[_0x71c1('0x11c')](_0x296331,_0x71c1('0x1b6')));hopperUtils[_0x71c1('0xc7')](_0x22b64a)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x38f01c[_0x71c1('0x191')](0x8,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a[_0x71c1('0x126')]>=_0x5e4022['dialCongestionMaxRetry']){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,'reason\x208\x20congestion');}else{_0x38f01c[_0x71c1('0x130')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1b7'));}}break;case'11':_0x5e4022['outboundAbandonedCallsDay']+=0x1;_0x22b64a['state']=0xb;_0x22b64a[_0x71c1('0x6b')]=_0x71c1('0xe7');_0x22b64a[_0x71c1('0xec')]+=0x1;_0x22b64a['countglobal']+=0x1;_0x4e5f5c=_0x5e4022[_0x71c1('0xea')];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];hopperUtils[_0x71c1('0xc7')](_0x22b64a)[_0x71c1('0x9e')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x38f01c[_0x71c1('0x191')](0xb,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a[_0x71c1('0xec')]>=_0x5e4022[_0x71c1('0xed')]){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1b8'));}else{_0x38f01c[_0x71c1('0x130')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1b8'));}}break;case'20':_0x5e4022[_0x71c1('0x1b9')]+=0x1;_0x22b64a[_0x71c1('0x6a')]=0x14;_0x22b64a[_0x71c1('0x6b')]=_0x71c1('0x1ba');_0x22b64a[_0x71c1('0x128')]+=0x1;_0x22b64a[_0x71c1('0xd4')]+=0x1;_0x4e5f5c=_0x5e4022[_0x71c1('0x19d')];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];ami[_0x71c1('0x3a')](_0x71c1('0x1bb'),ut[_0x71c1('0x11c')](_0x296331,_0x71c1('0x1bc')));hopperUtils['createHistory'](_0x22b64a)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1bd')));if(_0x38f01c['checkRetriveMax'](0x14,_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a[_0x71c1('0x128')]>=_0x5e4022['dialAgentRejectMaxRetry']){_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1be'));}else{_0x38f01c[_0x71c1('0x130')](_0x22b64a,_0x520676,_0x3109a0,_0x71c1('0x1be'));}}break;default:_0x5e4022[_0x71c1('0x1bf')]+=0x1;_0x22b64a[_0x71c1('0x6a')]=0xc;_0x22b64a['statedesc']=_0x593cd0['reason'];_0x4e5f5c=_0x5e4022['dialAgentRejectRetryFrequency'];_0x46e67e=_0x5e4022[_0x71c1('0xd5')];hopperUtils[_0x71c1('0xc7')](_0x22b64a)[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1c0')));if(_0x38f01c[_0x71c1('0x191')](_0x593cd0[_0x71c1('0xc3')],_0x296331,_0x5e4022)&&!_0x487b79){if(_0x22b64a['countbusyretry']+_0x22b64a['countcongestionretry']+_0x22b64a[_0x71c1('0x127')]+_0x22b64a['countnosuchnumberretry']+_0x22b64a['countdropretry']+_0x22b64a['countabandonedretry']+_0x22b64a[_0x71c1('0x123')]+_0x22b64a[_0x71c1('0x128')]>=_0x5e4022[_0x71c1('0x129')]){_0x38f01c[_0x71c1('0x130')](_0x22b64a,_0x520676,_0x3109a0,_0x593cd0[_0x71c1('0xc3')]);}else{_0x38f01c[_0x71c1('0x132')](_0x22b64a,_0x520676,_0x3109a0,_0x593cd0['reason']);}}}})[_0x71c1('0x37')](function(){if(_0x487b79){hopperUtils['swapAdditionalPhones'](_0x22b64a,_0x4e5f5c,_0x46e67e)[_0x71c1('0x37')](function(){return _0x520676(0x1);});}});});};Dialer[_0x71c1('0x84')][_0x71c1('0x130')]=function(_0x82ccec,_0x3e92d8,_0x135709,_0x2ef189){var _0x31d06f=new Final(_0x82ccec);_0x31d06f[_0x71c1('0x6a')]=0xf;_0x31d06f[_0x71c1('0x6b')]='Global';this[_0x71c1('0x132')](_0x31d06f,_0x3e92d8,_0x135709,_0x2ef189);};Dialer['prototype'][_0x71c1('0x132')]=function(_0x12f67b,_0x375a57,_0x55b0d2,_0x387b99){hopperUtils[_0x71c1('0x13a')](_0x12f67b)[_0x71c1('0x37')](function(){return _0x375a57(msgResponse('[callProgressDetecting]',_0x71c1('0x10e'),_0x387b99));})[_0x71c1('0x9e')](function(){return _0x55b0d2(msgResponse(_0x71c1('0x1c1'),_0x71c1('0x90'),_0x71c1('0x1c2')));});};Dialer[_0x71c1('0x84')][_0x71c1('0xa')]=function(_0x278dd3){var _0x2e505b=_0x278dd3['dialPredictiveOptimizationPercentage']/0x64;var _0x515a14=_0x278dd3[_0x71c1('0xcf')]/(_0x278dd3[_0x71c1('0xcf')]+_0x278dd3[_0x71c1('0xc2')]);var _0x304ef8=Math['round'](_0x278dd3['predictiveIntervalAvailable']*(_0x278dd3[_0x71c1('0x1c3')]/0x64));var _0x36d8e5=Math[_0x71c1('0x1c4')](_0x278dd3[_0x71c1('0x1c5')]*(_0x278dd3['predictiveIntervalMinThreshold']/0x64));var _0x581dc0=_0x278dd3['available']+_0x278dd3['talking'];var _0x4037bb=Math[_0x71c1('0x1c6')](_0x278dd3[_0x71c1('0x53')]*_0x278dd3[_0x71c1('0x56')]*_0x278dd3['predictiveIntervalHitRate']*_0x278dd3[_0x71c1('0x1c7')]);if(_['isUndefined'](_0x278dd3['startProgressive'])){if(!_[_0x71c1('0x39')](_0x278dd3['startPredictive'])){_0x278dd3[_0x71c1('0x5c')]=undefined;loggerPredictive['error'](_0x71c1('0x1c8'),_0x71c1('0x1c9'));}if(!_[_0x71c1('0x39')](_0x278dd3['handlePredictive'])){loggerPredictive[_0x71c1('0x60')](_0x71c1('0x1c8'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x278dd3[_0x71c1('0x5e')]);_0x278dd3[_0x71c1('0x5e')]=undefined;}_0x278dd3[_0x71c1('0x25')]=moment()['format'](_0x71c1('0xc1'));loggerPredictive[_0x71c1('0x42')](_0x278dd3['name'],_0x71c1('0x1ca'),_0x278dd3['startProgressive']);this[_0x71c1('0xb0')](_0x278dd3,0x1);}else if(ifInterval(_0x278dd3[_0x71c1('0x1cb')],_0x278dd3['startProgressive'])){this[_0x71c1('0xb0')](_0x278dd3,0x1);loggerPredictiveCalls[_0x71c1('0x42')](_0x71c1('0x1cc'),_0x278dd3[_0x71c1('0x25')],_0x278dd3[_0x71c1('0x40')]);_0x278dd3[_0x71c1('0x53')]=0x0;_0x278dd3[_0x71c1('0xd0')]=0x0;}else if(_0x2e505b<_0x515a14&&_0x278dd3[_0x71c1('0x1cd')]===_0x71c1('0x1ce')){clearPredictiveAttributes(_0x278dd3);loggerPredictive['info'](_0x71c1('0x1cf'),'Dropped\x20calls\x20day',_0x515a14,_0x71c1('0x25'),_0x278dd3['name']);}else if(_0x4037bb<_0x278dd3['predictiveIntervalErlangCallsDroppedCalls']&&_0x278dd3['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x278dd3);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x1d0'),_0x71c1('0x1d1'),_0x4037bb,'Drop\x20in\x20this\x20interval',_0x278dd3[_0x71c1('0xd0')],'startProgressive',_0x278dd3[_0x71c1('0x40')]);}else if(!ifInterval(_0x278dd3[_0x71c1('0x1cb')],_0x278dd3[_0x71c1('0x25')])&&_[_0x71c1('0x39')](_0x278dd3['startPredictive'])&&!_[_0x71c1('0x39')](_0x278dd3[_0x71c1('0x25')])){_0x278dd3[_0x71c1('0x5c')]=moment()[_0x71c1('0x78')](_0x71c1('0xc1'));loggerPredictive[_0x71c1('0x42')](_0x278dd3['name'],'started\x20in\x20predictive\x20at',_0x278dd3[_0x71c1('0x5c')]);hopperUtils[_0x71c1('0x1d2')](_0x278dd3[_0x71c1('0x1cb')])[_0x71c1('0x37')](this[_0x71c1('0x1d3')](_0x278dd3))['then'](mergeDataErlangB(_0x278dd3))[_0x71c1('0x37')](this[_0x71c1('0x1d4')](_0x278dd3))[_0x71c1('0x9e')](loggerCatchPredictive(_0x71c1('0x1d5'),_0x278dd3));}else if(!ifInterval(_0x278dd3['dialPredictiveInterval'],_0x278dd3['startPredictive'])){_0x278dd3['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x278dd3[_0x71c1('0x5c')]=moment()['format'](_0x71c1('0xc1'));loggerPredictive[_0x71c1('0x42')](_0x278dd3[_0x71c1('0x40')],'recalculate\x20predictive\x20at',_0x278dd3[_0x71c1('0x5c')]);clearInterval(_0x278dd3[_0x71c1('0x5e')]);_0x278dd3[_0x71c1('0x5e')]=undefined;hopperUtils[_0x71c1('0x1d2')](_0x278dd3['dialPredictiveInterval'])[_0x71c1('0x37')](this[_0x71c1('0x1d3')](_0x278dd3))[_0x71c1('0x37')](mergeDataErlangB(_0x278dd3))['then'](this[_0x71c1('0x1d4')](_0x278dd3))[_0x71c1('0x9e')](loggerCatchPredictive(_0x71c1('0x1d6'),_0x278dd3));}else if(_0x278dd3[_0x71c1('0x1c5')]&&_0x581dc0<_0x278dd3[_0x71c1('0x1c5')]-_0x36d8e5){clearPredictiveAttributes(_0x278dd3);loggerPredictive[_0x71c1('0x42')](_0x278dd3[_0x71c1('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x581dc0,_0x71c1('0x1d7'),_0x278dd3[_0x71c1('0x1c5')],'-',_0x36d8e5,'=',_0x278dd3[_0x71c1('0x1c5')]-_0x36d8e5,')');}else if(_0x278dd3[_0x71c1('0x1c5')]&&_0x581dc0>_0x278dd3[_0x71c1('0x1c5')]+_0x304ef8){clearPredictiveAttributes(_0x278dd3);loggerPredictive[_0x71c1('0x42')](_0x278dd3[_0x71c1('0x40')],_0x71c1('0x1d8'),_0x581dc0,_0x71c1('0x1d9'),_0x278dd3[_0x71c1('0x1c5')],'+',_0x304ef8,'=',_0x278dd3['predictiveIntervalAvailable']+_0x304ef8,')');}};Dialer['prototype']['getDataPredictive']=function(_0x38dcb4){var _0x500152=this;return function(_0x4d8b94){return new Promise(function(_0x532a3c,_0x4e152a){_[_0x71c1('0x59')](_0x38dcb4,_0x4d8b94[0x0]);if(checkGetDataPredictive(_0x4d8b94[0x0])){var _0x2ff771=_0x38dcb4[_0x71c1('0x1c5')]=_0x38dcb4[_0x71c1('0x147')]+_0x38dcb4[_0x71c1('0x146')];var _0x2c2722=_0x38dcb4['dialPredictiveInterval']*0x3c;var _0x5e36ad=_0x4d8b94[0x0]['predictiveIntervalAvgTalktime']+_0x4d8b94[0x0][_0x71c1('0x4a')];var _0x4a3e8f=(_0x4d8b94[0x0][_0x71c1('0x45')]+_0x4d8b94[0x0][_0x71c1('0x47')]+_0x4d8b94[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d8b94[0x0][_0x71c1('0x44')];_0x38dcb4['predictiveIntervalHitRate']=_0x4a3e8f>0x0?_0x4a3e8f:0x1;switch(_0x38dcb4['dialPredictiveOptimization']){case _0x71c1('0x1ce'):var _0x24e0ce=_0x38dcb4[_0x71c1('0x1da')]/0x64;return _0x500152[_0x71c1('0x1db')](_0x2ff771,_0x2c2722,_0x5e36ad,_0x4a3e8f,_0x24e0ce)[_0x71c1('0x37')](function(_0x49272d){return _0x532a3c(_0x49272d);});case _0x71c1('0x1dc'):var _0x40e11c=_0x38dcb4['dialPredictiveOptimizationPercentage']/0x64;return _0x500152['busyFactor'](_0x2ff771,_0x2c2722,_0x5e36ad,_0x4a3e8f,_0x40e11c)[_0x71c1('0x37')](function(_0xf3321e){return _0x532a3c(_0xf3321e);});default:return _0x4e152a(msgResponse(_0x71c1('0x1dd'),_0x71c1('0x90'),_0x71c1('0x1de')));}}else{return _0x4e152a(msgResponse(_0x71c1('0x1dd'),_0x71c1('0x90'),_0x71c1('0x1df')));}});};};Dialer['prototype'][_0x71c1('0x1e0')]=function(_0x12f91b){var _0x4d118a=this;return function(_0x239fc2){return new Promise(function(_0x5cf9ac,_0x4a5b1e){_[_0x71c1('0x59')](_0x12f91b,_0x239fc2[0x0]);if(checkGetDataPredictive(_0x239fc2[0x0])){loggerPredictive[_0x71c1('0x42')](JSON[_0x71c1('0x83')](_0x239fc2[0x0]));if(_0x12f91b[_0x71c1('0x1cd')]===_0x71c1('0x1ce')){return _0x4d118a['getVoiceQueueRtPauses'](_0x12f91b['id'])[_0x71c1('0x37')](function(_0x20bd12){var _0x988e8f=_0x12f91b[_0x71c1('0x1e1')]-_0x20bd12[0x0]['outboundQueuePauses'];var _0x261c12=_0x12f91b[_0x71c1('0x1cb')]*0x3c;var _0x465032=_0x239fc2[0x0][_0x71c1('0x4c')]+_0x239fc2[0x0][_0x71c1('0x4a')];var _0x15f1c7=(_0x239fc2[0x0][_0x71c1('0x45')]+_0x239fc2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x239fc2[0x0][_0x71c1('0x49')])/_0x239fc2[0x0]['predictiveIntervalTotalCalls'];var _0x31f190=_0x12f91b[_0x71c1('0x1da')]/0x64;_0x12f91b[_0x71c1('0x1e2')]=_0x20bd12[0x0][_0x71c1('0x1e3')]||0x0;_0x12f91b['predictiveIntervalHitRate']=_0x15f1c7>0x0?_0x15f1c7:0x1;return _0x4d118a['abandonmentRate'](_0x988e8f,_0x261c12,_0x465032,_0x15f1c7,_0x31f190);})['then'](function(_0x4dcd7d){return _0x5cf9ac(_0x4dcd7d);})[_0x71c1('0x9e')](function(_0x436d2c){return _0x4a5b1e(msgResponse(_0x71c1('0x1e4'),_0x71c1('0x90'),JSON[_0x71c1('0x83')](_0x436d2c)));});}if(_0x12f91b[_0x71c1('0x1cd')]==='agentBusyFactor'){return _0x4d118a[_0x71c1('0x15c')](_0x12f91b['id'])[_0x71c1('0x37')](function(_0x462d5c){var _0xa2732c=_0x12f91b[_0x71c1('0x1e1')]-_0x462d5c[0x0]['outboundQueuePauses'];var _0x47a940=_0x12f91b[_0x71c1('0x1cb')]*0x3c;var _0x1fb560=_0x239fc2[0x0][_0x71c1('0x4c')]+_0x239fc2[0x0]['predictiveIntervalAvgHoldtime'];var _0x53cdc8=(_0x239fc2[0x0][_0x71c1('0x45')]+_0x239fc2[0x0][_0x71c1('0x47')]+_0x239fc2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x239fc2[0x0][_0x71c1('0x44')];var _0x818fe9=_0x12f91b['dialPredictiveOptimizationPercentage']/0x64;_0x12f91b['predictiveIntervalPauses']=_0x462d5c[0x0][_0x71c1('0x1e3')]||0x0;_0x12f91b[_0x71c1('0x1e5')]=_0x53cdc8>0x0?_0x53cdc8:0x1;return _0x4d118a[_0x71c1('0x1e6')](_0xa2732c,_0x47a940,_0x1fb560,_0x53cdc8,_0x818fe9);})[_0x71c1('0x37')](function(_0x17b93f){return _0x5cf9ac(_0x17b93f);})[_0x71c1('0x9e')](function(_0x331d56){return _0x4a5b1e(msgResponse(_0x71c1('0x1e4'),_0x71c1('0x90'),JSON[_0x71c1('0x83')](_0x331d56)));});}}else{return _0x4a5b1e(msgResponse(_0x71c1('0x1dd'),_0x71c1('0x90'),'check\x20failure'));}});};};Dialer[_0x71c1('0x84')]['startMethodPredictive']=function(_0x57a26c){var _0x5cda2f=this;return function(){var _0xab04a7=0x0;var _0x580e71=Math[_0x71c1('0x1c6')](_0x57a26c[_0x71c1('0x1e7')]*0x3e8);if(_0x580e71>0x0){_0x580e71=_0x580e71<0x64?0x64:_0x580e71;loggerPredictive[_0x71c1('0x42')](_0x57a26c['name'],_0x71c1('0x1e8'),_0x580e71,_0x71c1('0x1e9'));_0x57a26c[_0x71c1('0x5e')]=setInterval(function(){_0x5cda2f[_0x71c1('0x5e')](_0x57a26c);loggerPredictiveCalls[_0x71c1('0x42')]('[handlePredictive]',_0xab04a7+=0x1);},_0x580e71);}else{loggerPredictive[_0x71c1('0x42')](_0x57a26c['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x71c1('0x1ea')]=function(_0x2857a8,_0x101b11){var _0x137926=this;return function(_0x227689){if(_[_0x71c1('0x73')](_0x227689)){if(_[_0x71c1('0x104')](_0x101b11[_0x71c1('0x160')])||!_0x101b11[_0x71c1('0x1eb')]){if(_0x2857a8[_0x71c1('0xae')]===_0x71c1('0x9')){_0x2857a8[_0x71c1('0x6d')]=_[_0x71c1('0x39')](_0x2857a8['queueStatusComplete'])?!![]:_0x2857a8[_0x71c1('0x6d')];var _0x326e58=uuid['v4']();_0x137926[_0x71c1('0x22')][_0x326e58]=new Action(_0x2857a8,_0x101b11,_0x326e58);loggerBooked['info'](_0x71c1('0x1ec'),_0x326e58,_0x71c1('0x1ed'),JSON[_0x71c1('0x83')](_0x2857a8['queueStatusComplete']),_0x71c1('0x1ee'),_0x2857a8['name']);if(_0x2857a8['queueStatusComplete']){_0x2857a8[_0x71c1('0x6d')]=![];_0x137926['queueBooked'][_0x137926[_0x71c1('0x22')][_0x326e58]['queue']]=[];ami['Action']({'actionid':_0x326e58,'action':_0x71c1('0x1ef'),'queue':_0x2857a8['name']})[_0x71c1('0x9e')](function(){utils[_0x71c1('0xbf')](_0x2857a8,'[checkContactBlack]');hopperUtils[_0x71c1('0xd9')]({'active':![],'ContactId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xdc')],'ListId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xdd')],'VoiceQueueId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xde')]||undefined,'CampaignId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1f0')));delete _0x137926[_0x71c1('0x22')][_0x326e58];});}else{loggerBooked[_0x71c1('0x42')](_0x71c1('0x1f1'),JSON[_0x71c1('0x83')](_0x2857a8[_0x71c1('0x6d')]),_0x71c1('0x1ee'),_0x2857a8[_0x71c1('0x40')]);utils[_0x71c1('0xbf')](_0x2857a8,_0x71c1('0x1f2'));hopperUtils[_0x71c1('0xd9')]({'active':![],'ContactId':_0x137926[_0x71c1('0x22')][_0x326e58]['ContactId'],'ListId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xdd')],'VoiceQueueId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xde')]||undefined,'CampaignId':_0x137926[_0x71c1('0x22')][_0x326e58][_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1f0')));delete _0x137926[_0x71c1('0x22')][_0x326e58];}}else{return _0x137926[_0x71c1('0x1f3')](_0x2857a8,_0x101b11);}}else{if(utils[_0x71c1('0x5a')](undefined,_0x101b11[_0x71c1('0x1f4')])<_0x2857a8[_0x71c1('0x1f5')]*0x3c){if(_0x101b11[_0x71c1('0x163')]&&!_0x101b11['Agent'][_0x71c1('0x1f6')]){_0x137926[_0x71c1('0xfd')][_0x71c1('0xfe')](_0x101b11['id'])[_0x71c1('0x1c')](function(){utils[_0x71c1('0xbf')](_0x2857a8,_0x71c1('0x1f2'));});}else{hopperUtils['unlockContact']({'active':![]},_0x101b11['id'],0x1)['finally'](function(){utils[_0x71c1('0xbf')](_0x2857a8,_0x71c1('0x1f2'));});}}else{_0x2857a8[_0x71c1('0x1f7')]+=0x1;utils[_0x71c1('0xbf')](_0x2857a8,_0x71c1('0x1f2'));if(_0x2857a8[_0x71c1('0x1f8')]){hopperUtils[_0x71c1('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x101b11[_0x71c1('0xdc')],'ListId':_0x101b11['ListId'],'VoiceQueueId':_0x101b11[_0x71c1('0xde')]||undefined,'CampaignId':_0x101b11[_0x71c1('0xdf')]||undefined})[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1f9')));hopperUtils['createHistory'](createObjHistory(_0x2857a8,_0x101b11,utils[_0x71c1('0x64')][_0x71c1('0x1fa')],0x17,_0x71c1('0x1fb')))[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x1fc')));}else{_0x137926[_0x71c1('0x11e')](createObjHistory(_0x2857a8,_0x101b11,utils[_0x71c1('0x64')][_0x71c1('0x1fd')],0x16,_0x71c1('0x1fe')),_0x71c1('0x1ff'),_0x71c1('0x200'));}}}}else{_0x2857a8['outboundBlacklistCallsDay']+=0x1;_0x137926[_0x71c1('0x11e')](createObjHistory(_0x2857a8,_0x101b11,utils[_0x71c1('0x64')]['BLACKLIST'],0xd,_0x71c1('0x201')),'[Originate][historyBlacklist]',_0x71c1('0x202'));throw'inBlackList';}};};Dialer['prototype'][_0x71c1('0x165')]=function(_0x310b84){var _0x190ceb=this;var _0x53e68f=_0x310b84[_0x71c1('0x203')]-_0x310b84[_0x71c1('0x7d')];emitCampaignSummary(_0x310b84);if(_0x53e68f>0x0&&_0x310b84[_0x71c1('0x204')]==0x0){if(_0x53e68f>this['maxNumberOriginate']){_0x53e68f=this['maxNumberOriginate'];}_0x310b84[_0x71c1('0x204')]=0x1;hopperUtils[_0x71c1('0x205')](_0x310b84,_0x53e68f)['then'](function(_0x3312dd){_0x310b84[_0x71c1('0x204')]=0x0;if(_0x3312dd){if(!utils[_0x71c1('0x206')](_0x3312dd)){_0x310b84['message']=utils['CAMPAIGN_STATUS'][_0x71c1('0x68')];logger['info'](_0x71c1('0x207')+_0x310b84[_0x71c1('0x40')]);}else{_0x310b84[_0x71c1('0x7d')]+=_0x3312dd[_0x71c1('0x97')];_0x310b84[_0x71c1('0x63')]=utils[_0x71c1('0x64')][_0x71c1('0x208')];for(var _0x55eaab=0x0;_0x55eaab<_0x3312dd['length'];_0x55eaab+=0x1){_0x310b84[_0x71c1('0x209')]+=0x1;if(_[_0x71c1('0x104')](_0x3312dd[_0x55eaab])||_['isNil'](_0x3312dd[_0x55eaab]['Contact'])||_[_0x71c1('0x104')](_0x3312dd[_0x55eaab][_0x71c1('0x185')])){_0x190ceb[_0x71c1('0x15d')](_0x71c1('0x20a'),_0x310b84,_0x3312dd[_0x55eaab]);}else{hopperUtils[_0x71c1('0x20b')](_[_0x71c1('0x6f')](_0x3312dd[_0x55eaab],['CampaignId','phone']))[_0x71c1('0x37')](_0x190ceb[_0x71c1('0x1ea')](_0x310b84,_0x3312dd[_0x55eaab]))['catch'](function(_0x264de6){logger[_0x71c1('0x60')]('[actionOriginateIvr]',_0x264de6);utils[_0x71c1('0xbf')](_0x310b84,_0x71c1('0x20c'));});}}}}})[_0x71c1('0x9e')](function(_0x2e9be2){_0x310b84['temp']=0x0;logger[_0x71c1('0x60')]('[getContactCampaign2]',_0x2e9be2);});}};Dialer[_0x71c1('0x84')]['handlePower']=function(_0x1f2029,_0x3b130f){var _0xc41d8=this;var _0x47c3be=[];if(_0x3b130f<0x1||_0x1f2029[_0x71c1('0xae')]===_0x71c1('0x9')){_0x3b130f=0x1;}var _0x288707=Math['floor'](_0x1f2029[_0x71c1('0x146')]*_0x3b130f)-_0x1f2029[_0x71c1('0x7d')];if(_0x1f2029[_0x71c1('0x20d')]>0x0){var _0xd26c9=_0x1f2029[_0x71c1('0x20d')]-_0x1f2029[_0x71c1('0x7d')]-_0x1f2029[_0x71c1('0x147')]-_0x1f2029[_0x71c1('0x148')];if(_0x288707>_0xd26c9){_0x288707=_0xd26c9;}}if(_0x288707>0x0&&_0x1f2029[_0x71c1('0x204')]==0x0){if(_0x1f2029[_0x71c1('0xae')]===_0x71c1('0x9')){_0x288707=0x1;}if(_0x288707>this['maxNumberOriginate']){_0x288707=this['maxNumberOriginate'];}for(var _0x415028 in this['agents']){if(typeof this[_0x71c1('0xfa')][_0x415028]!=='undefined'){if(this[_0x71c1('0xfa')][_0x415028][_0x71c1('0x6a')]==='not_inuse'&&this['agents'][_0x415028][_0x71c1('0x88')]==='reachable'){_0x47c3be['push'](this[_0x71c1('0xfa')][_0x415028]['id']);}}}_0x1f2029[_0x71c1('0x204')]=0x1;hopperUtils[_0x71c1('0x20e')](_0x1f2029,_0x47c3be,_0x288707)[_0x71c1('0x37')](function(_0x5b6110){_0x1f2029[_0x71c1('0x204')]=0x0;if(_0x5b6110){if(!utils[_0x71c1('0x206')](_0x5b6110)){hopperUtils[_0x71c1('0x20f')](_0x1f2029)[_0x71c1('0x37')](sendMessageReschedule(_0x1f2029))[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x210')));}else{_0x1f2029[_0x71c1('0x7d')]+=_0x5b6110[_0x71c1('0x97')];_0x1f2029[_0x71c1('0x63')]=_0x1f2029[_0x71c1('0xae')]===_0x71c1('0x9')?utils[_0x71c1('0x64')][_0x71c1('0x16e')]:utils['CAMPAIGN_STATUS'][_0x71c1('0x208')];for(var _0x4e9263=0x0;_0x4e9263<_0x5b6110[_0x71c1('0x97')];_0x4e9263+=0x1){if(_[_0x71c1('0x104')](_0x5b6110[_0x4e9263])||_[_0x71c1('0x104')](_0x5b6110[_0x4e9263][_0x71c1('0x17c')])||_[_0x71c1('0x104')](_0x5b6110[_0x4e9263]['phone'])){_0xc41d8[_0x71c1('0x15d')](_0x71c1('0x20a'),_0x1f2029,_0x5b6110[_0x4e9263]);}else{hopperUtils[_0x71c1('0x211')](_[_0x71c1('0x6f')](_0x5b6110[_0x4e9263],[_0x71c1('0xde'),_0x71c1('0x185')]))['then'](_0xc41d8[_0x71c1('0x1ea')](_0x1f2029,_0x5b6110[_0x4e9263]))[_0x71c1('0x9e')](function(_0xd701ba){logger[_0x71c1('0x60')](_0x71c1('0x212'),_0xd701ba);utils[_0x71c1('0xbf')](_0x1f2029,_0x71c1('0x213'));});}}}}})[_0x71c1('0x9e')](function(_0x2b8e12){_0x1f2029[_0x71c1('0x204')]=0x0;logger[_0x71c1('0x60')](_0x71c1('0x214'),_0x2b8e12);});}};Dialer['prototype'][_0x71c1('0x5e')]=function(_0x4c2d02){if(_0x4c2d02[_0x71c1('0x20d')]>0x0){var _0x4a62b7=_0x4c2d02['dialLimitQueue']-_0x4c2d02['originated']-_0x4c2d02[_0x71c1('0x147')];if(_0x4a62b7>0x0&&_0x4c2d02[_0x71c1('0x204')]==0x0){this[_0x71c1('0x215')](_0x4c2d02);}else{loggerPredictiveCalls[_0x71c1('0x42')]('[handlePredictive][limitChannel]');}}else{this[_0x71c1('0x215')](_0x4c2d02);}};Dialer[_0x71c1('0x84')]['tryOriginatePredictive']=function(_0x4c5d59){var _0x11c430=this;var _0x1b76b6=[];_0x4c5d59[_0x71c1('0x7d')]+=0x1;for(var _0x33fb78 in this[_0x71c1('0xfa')]){if(typeof this[_0x71c1('0xfa')][_0x33fb78]!=='undefined'){if(this[_0x71c1('0xfa')][_0x33fb78]['state']===_0x71c1('0x216')&&this['agents'][_0x33fb78]['status']===_0x71c1('0x151')){_0x1b76b6[_0x71c1('0x98')](this[_0x71c1('0xfa')][_0x33fb78]['id']);}}}_0x4c5d59[_0x71c1('0x204')]=0x1;return this[_0x71c1('0x20e')](_0x4c5d59['id'],_0x1b76b6,0x1,_0x4c5d59[_0x71c1('0x217')],_0x4c5d59)[_0x71c1('0x37')](function(_0x4268a4){_0x4c5d59[_0x71c1('0x204')]=0x1;if(_0x4268a4){if(!utils[_0x71c1('0x206')](_0x4268a4)){utils['checkContactLowerLimitOriginate'](_0x4c5d59,0x1,0x0);return hopperUtils[_0x71c1('0x20f')](_0x4c5d59)[_0x71c1('0x37')](sendMessageReschedule(_0x4c5d59))[_0x71c1('0x9e')](loggerCatch(_0x71c1('0x210')));}else{_0x4c5d59['message']=utils[_0x71c1('0x64')][_0x71c1('0x208')];if(_['isNil'](_0x4268a4[0x0])||_[_0x71c1('0x104')](_0x4268a4[0x0][_0x71c1('0x17c')])||_[_0x71c1('0x104')](_0x4268a4[0x0][_0x71c1('0x185')])){_0x11c430[_0x71c1('0x15d')](_0x71c1('0x20a'),_0x4c5d59,_0x4268a4[0x0]);}else{return hopperUtils[_0x71c1('0x211')](_[_0x71c1('0x6f')](_0x4268a4[0x0],[_0x71c1('0xde'),_0x71c1('0x185')]))[_0x71c1('0x37')](_0x11c430[_0x71c1('0x1ea')](_0x4c5d59,_0x4268a4[0x0]))['catch'](function(_0x56e79d){logger[_0x71c1('0x60')]('[actionOriginatePredictive]',_0x56e79d);utils[_0x71c1('0xbf')](_0x4c5d59,_0x71c1('0x218'));});}}}})['catch'](function(_0x477b88){_0x4c5d59['temp']=0x0;logger['error']('[getContactCampaign2]',_0x477b88);});};Dialer['prototype']['abandonmentRate']=function(_0xecd3f6,_0x2cc3ff,_0x4f683b,_0x5091cb,_0x455520,_0x1526cc){loggerPredictive['info'](_0x71c1('0x219'));loggerPredictive['info'](_0x71c1('0x21a'),_0xecd3f6);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x21b'),_0x2cc3ff);loggerPredictive[_0x71c1('0x42')]('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',_0x4f683b);loggerPredictive['info']('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',_0x5091cb);loggerPredictive[_0x71c1('0x42')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x455520);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x4d'));return new Promise(function(_0x4a8d78,_0x2a6296){if(_0xecd3f6<=0x0||isNaN(_0xecd3f6)){return _0x2a6296(msgResponse('[abandonmentRate]',_0x71c1('0x82'),_0x71c1('0x21c')+_0xecd3f6));}if(_0x4f683b<=0x0||isNaN(_0x4f683b)){return _0x2a6296(msgResponse(_0x71c1('0x21d'),'Error',_0x71c1('0x21e')+_0x4f683b));}if(_0x5091cb<=0x0||isNaN(_0x5091cb)){return _0x2a6296(msgResponse(_0x71c1('0x21d'),_0x71c1('0x82'),_0x71c1('0x21f')+_0x5091cb));}if(_0x2cc3ff<=0x0||isNaN(_0x2cc3ff)){return _0x2a6296(msgResponse(_0x71c1('0x21d'),_0x71c1('0x82'),_0x71c1('0x220')+_0x2cc3ff));}if(_0x455520<=0x0||isNaN(_0x455520)){return _0x2a6296(msgResponse(_0x71c1('0x21d'),_0x71c1('0x82'),_0x71c1('0x221')+_0x455520));}_0x1526cc=_0x1526cc||0x0;var _0x418d65=0x1/_0x4f683b;var _0x43ed5d=0x0;var _0x518246=0x0;var _0x50768e=0x0;var _0x26a635=0x0;for(var _0x51be1b=0x0;_0x50768e<_0x455520;_0x51be1b+=0x1){_0x518246=_0x51be1b/_0x2cc3ff;_0x43ed5d=(_0x5091cb*_0x518246+_0x1526cc)/_0x418d65;_0x50768e=utils[_0x71c1('0x222')](_0x43ed5d,_0xecd3f6);_0x26a635=_0x43ed5d/_0xecd3f6*(0x1-utils[_0x71c1('0x222')](_0x43ed5d,_0xecd3f6));}return _0x4a8d78({'erlangCalls':_0x51be1b,'erlangCallToSecond':_0x2cc3ff/_0x51be1b,'erlangAbandonmentRate':_0x50768e,'erlangBusyFactor':_0x26a635});});};Dialer[_0x71c1('0x84')][_0x71c1('0x1e6')]=function(_0x53620a,_0x1b84bc,_0xcb902e,_0x369107,_0x7d6880,_0x168828){loggerPredictive[_0x71c1('0x42')](_0x71c1('0x223'));loggerPredictive[_0x71c1('0x42')](_0x71c1('0x21a'),_0x53620a);loggerPredictive[_0x71c1('0x42')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b84bc);loggerPredictive[_0x71c1('0x42')](_0x71c1('0x224'),_0xcb902e);loggerPredictive[_0x71c1('0x42')]('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',_0x369107);loggerPredictive['info'](_0x71c1('0x225'),_0x7d6880);loggerPredictive['info'](_0x71c1('0x4d'));return new Promise(function(_0x40b6c0,_0x97cc32){if(_0x53620a<=0x0||isNaN(_0x53620a)){return _0x97cc32(msgResponse(_0x71c1('0x226'),_0x71c1('0x82'),_0x71c1('0x21c')+_0x53620a));}if(_0xcb902e<=0x0||isNaN(_0xcb902e)){return _0x97cc32(msgResponse(_0x71c1('0x226'),_0x71c1('0x82'),_0x71c1('0x21e')+_0xcb902e));}if(_0x369107<=0x0||isNaN(_0x369107)){return _0x97cc32(msgResponse(_0x71c1('0x226'),_0x71c1('0x82'),_0x71c1('0x21f')+_0x369107));}if(_0x1b84bc<=0x0||isNaN(_0x1b84bc)){return _0x97cc32(msgResponse('[busyFactor]',_0x71c1('0x82'),_0x71c1('0x220')+_0x1b84bc));}if(_0x7d6880<=0x0||isNaN(_0x7d6880)){return _0x97cc32(msgResponse(_0x71c1('0x226'),_0x71c1('0x82'),_0x71c1('0x227')+_0x7d6880));}_0x168828=_0x168828||0x0;var _0x4110c1=0x1/_0xcb902e;var _0x3c0773=0x0;var _0x256abd=0x0;var _0x3d33a0=0x0;var _0x4e4d08=0x0;for(var _0x17198c=0x0;_0x4e4d08<_0x7d6880;_0x17198c+=0x1){_0x256abd=_0x17198c/_0x1b84bc;_0x3c0773=(_0x369107*_0x256abd+_0x168828)/_0x4110c1;_0x3d33a0=utils[_0x71c1('0x222')](_0x3c0773,_0x53620a);_0x4e4d08=_0x3c0773/_0x53620a*(0x1-utils[_0x71c1('0x222')](_0x3c0773,_0x53620a));}return _0x40b6c0({'erlangCalls':_0x17198c,'erlangCallToSecond':_0x1b84bc/_0x17198c,'erlangAbandonmentRate':_0x3d33a0,'erlangBusyFactor':_0x4e4d08});});};module[_0x71c1('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 78abdfb..4ecfc89 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea47=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId'];(function(_0x141589,_0xa39315){var _0x30012a=function(_0x111ecf){while(--_0x111ecf){_0x141589['push'](_0x141589['shift']());}};_0x30012a(++_0xa39315);}(_0xea47,0x1ca));var _0x7ea4=function(_0x5e7b1a,_0x440b26){_0x5e7b1a=_0x5e7b1a-0x0;var _0x2a8f71=_0xea47[_0x5e7b1a];return _0x2a8f71;};'use strict';var util=require(_0x7ea4('0x0'));var _=require(_0x7ea4('0x1'));var moment=require(_0x7ea4('0x2'));function checkNameSurname(_0x162c74,_0x492f25,_0x9aecb9){var _0x204272='';if(!_[_0x7ea4('0x3')](_0x492f25)&&_0x7ea4('0x4')===typeof _0x492f25){_0x204272+=_0x492f25;}if(!_[_0x7ea4('0x3')](_0x9aecb9)&&_0x7ea4('0x4')===typeof _0x9aecb9){_0x204272+='\x20'+_0x9aecb9;}if(_0x204272!==''){return _0x204272;}return _0x162c74;}function Action(_0x505244,_0x486eb2,_0x562944){this['voiceQueue']=_0x505244;this[_0x7ea4('0x5')]=_0x562944||undefined;this[_0x7ea4('0x6')]=checkNameSurname(_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x8')],_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x9')],_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0xa')]);this[_0x7ea4('0xb')]=_0x486eb2['phone'];this['queue']=_0x505244[_0x7ea4('0x6')];this[_0x7ea4('0xc')]=_0x486eb2[_0x7ea4('0xc')]||![];this[_0x7ea4('0xd')]=_0x505244[_0x7ea4('0xd')];this[_0x7ea4('0xe')]=_0x505244['dialQueueTimeout']||0x3;this[_0x7ea4('0xf')]=_0x486eb2[_0x7ea4('0xf')];this[_0x7ea4('0x10')]=_0x486eb2[_0x7ea4('0x10')];this[_0x7ea4('0x11')]=_0x486eb2[_0x7ea4('0x11')];this[_0x7ea4('0x12')]=_0x486eb2['countnoanswerretry'];this[_0x7ea4('0x13')]=_0x486eb2[_0x7ea4('0x13')];this['countdropretry']=_0x486eb2[_0x7ea4('0x14')];this[_0x7ea4('0x15')]=_0x486eb2[_0x7ea4('0x15')];this['countmachineretry']=_0x486eb2[_0x7ea4('0x16')];this[_0x7ea4('0x17')]=_0x486eb2['countagentrejectretry'];this[_0x7ea4('0x18')]=_0x486eb2[_0x7ea4('0x18')];this['ListId']=_0x486eb2['ListId'];this[_0x7ea4('0x19')]=_0x486eb2['UserId'];this[_0x7ea4('0x1a')]=_0x486eb2[_0x7ea4('0x1a')];this[_0x7ea4('0x1b')]=_0x486eb2[_0x7ea4('0x1b')];this[_0x7ea4('0x1c')]=_0x486eb2['id'];this[_0x7ea4('0x1d')]=_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x9')]||'';this[_0x7ea4('0x1e')]=moment()['format'](_0x7ea4('0x1f'));this['callback']=_0x486eb2[_0x7ea4('0x20')];this[_0x7ea4('0x21')]=_0x486eb2['callbackuniqueid'];this['callbackat']=_0x486eb2[_0x7ea4('0x22')];this[_0x7ea4('0x23')]=_0x486eb2[_0x7ea4('0x23')];this['originatecalleridnum']='';this[_0x7ea4('0x24')]='';}Action[_0x7ea4('0x25')]['getCaller']=function(){return util[_0x7ea4('0x26')](_0x7ea4('0x27'),this[_0x7ea4('0x6')],this['voiceQueue'][_0x7ea4('0x28')]>0x0?this[_0x7ea4('0xb')][_0x7ea4('0x29')](this['voiceQueue']['dialCutDigit']):this['number']);};Action[_0x7ea4('0x25')][_0x7ea4('0x2a')]=function(){return this[_0x7ea4('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0x6392=['firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone'];(function(_0x11a383,_0x4e05ae){var _0x49f2bb=function(_0x52e0ee){while(--_0x52e0ee){_0x11a383['push'](_0x11a383['shift']());}};_0x49f2bb(++_0x4e05ae);}(_0x6392,0x148));var _0x2639=function(_0x22d2c8,_0x22f4e8){_0x22d2c8=_0x22d2c8-0x0;var _0x4b4b8b=_0x6392[_0x22d2c8];return _0x4b4b8b;};'use strict';var util=require('util');var _=require(_0x2639('0x0'));var moment=require(_0x2639('0x1'));function checkNameSurname(_0x197c77,_0x2e9bcf,_0x33cb7d){var _0x29d6ad='';if(!_[_0x2639('0x2')](_0x2e9bcf)&&_0x2639('0x3')===typeof _0x2e9bcf){_0x29d6ad+=_0x2e9bcf;}if(!_[_0x2639('0x2')](_0x33cb7d)&&_0x2639('0x3')===typeof _0x33cb7d){_0x29d6ad+='\x20'+_0x33cb7d;}if(_0x29d6ad!==''){return _0x29d6ad;}return _0x197c77;}function Action(_0x3bd4a9,_0x53d49f,_0x4f6eaf){this[_0x2639('0x4')]=_0x3bd4a9;this[_0x2639('0x5')]=_0x4f6eaf||undefined;this[_0x2639('0x6')]=checkNameSurname(_0x53d49f['Contact'][_0x2639('0x7')],_0x53d49f['Contact'][_0x2639('0x8')],_0x53d49f[_0x2639('0x9')][_0x2639('0xa')]);this[_0x2639('0xb')]=_0x53d49f[_0x2639('0x7')];this[_0x2639('0xc')]=_0x3bd4a9[_0x2639('0x6')];this[_0x2639('0xd')]=_0x53d49f['active']||![];this[_0x2639('0xe')]=_0x3bd4a9['type'];this['dialQueueTimeout']=_0x3bd4a9[_0x2639('0xf')]||0x3;this[_0x2639('0x10')]=_0x53d49f[_0x2639('0x10')];this[_0x2639('0x11')]=_0x53d49f[_0x2639('0x11')];this[_0x2639('0x12')]=_0x53d49f[_0x2639('0x12')];this[_0x2639('0x13')]=_0x53d49f['countnoanswerretry'];this[_0x2639('0x14')]=_0x53d49f['countnosuchnumberretry'];this[_0x2639('0x15')]=_0x53d49f[_0x2639('0x15')];this[_0x2639('0x16')]=_0x53d49f[_0x2639('0x16')];this[_0x2639('0x17')]=_0x53d49f[_0x2639('0x17')];this[_0x2639('0x18')]=_0x53d49f['countagentrejectretry'];this[_0x2639('0x19')]=_0x53d49f[_0x2639('0x19')];this[_0x2639('0x1a')]=_0x53d49f[_0x2639('0x1a')];this[_0x2639('0x1b')]=_0x53d49f[_0x2639('0x1b')];this[_0x2639('0x1c')]=_0x53d49f[_0x2639('0x1c')];this[_0x2639('0x1d')]=_0x53d49f[_0x2639('0x1d')];this['idHopper']=_0x53d49f['id'];this[_0x2639('0x1e')]=_0x53d49f[_0x2639('0x9')][_0x2639('0x8')]||'';this['starttime']=moment()[_0x2639('0x1f')](_0x2639('0x20'));this['callback']=_0x53d49f['callback'];this[_0x2639('0x21')]=_0x53d49f[_0x2639('0x21')];this[_0x2639('0x22')]=_0x53d49f['callbackat'];this[_0x2639('0x23')]=_0x53d49f[_0x2639('0x23')];this['originatecalleridnum']='';this[_0x2639('0x24')]='';}Action[_0x2639('0x25')][_0x2639('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x2639('0x6')],this[_0x2639('0x4')][_0x2639('0x27')]>0x0?this[_0x2639('0xb')][_0x2639('0x28')](this['voiceQueue'][_0x2639('0x27')]):this[_0x2639('0xb')]);};Action[_0x2639('0x25')][_0x2639('0x29')]=function(){return this[_0x2639('0xc')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index b6b0c9d..f544012 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x557b=['../utils','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','starttime','holdtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','agiafterat','exports'];(function(_0x118617,_0x24e482){var _0x2a7f46=function(_0xea56dc){while(--_0xea56dc){_0x118617['push'](_0x118617['shift']());}};_0x2a7f46(++_0x24e482);}(_0x557b,0xcd));var _0xb557=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x557b[_0x4e6ae6];return _0x23c108;};'use strict';var moment=require('moment');var utils=require(_0xb557('0x0'));function AgentComplete(_0x1e251f,_0x56487b){this['state']=0x4;this[_0xb557('0x1')]=_0xb557('0x2');this[_0xb557('0x3')]=_0x1e251f[_0xb557('0x3')];this['type']=_0x1e251f['type'];this[_0xb557('0x4')]=_0x1e251f[_0xb557('0x5')]===_0xb557('0x6')?_0xb557('0x7'):_0x1e251f[_0xb557('0x5')];this[_0xb557('0x8')]=_0x1e251f[_0xb557('0x8')];this[_0xb557('0x9')]=_0x1e251f['countcongestionretry'];this[_0xb557('0xa')]=_0x1e251f[_0xb557('0xa')];this[_0xb557('0xb')]=_0x1e251f['countbusyretry']+_0x1e251f[_0xb557('0x9')]+_0x1e251f[_0xb557('0xa')]+_0x1e251f['countnosuchnumberretry']+_0x1e251f[_0xb557('0xc')]+_0x1e251f[_0xb557('0xd')]+_0x1e251f[_0xb557('0xe')]+_0x1e251f['countagentrejectretry'];this['countnosuchnumberretry']=_0x1e251f[_0xb557('0xf')];this[_0xb557('0xc')]=_0x1e251f[_0xb557('0xc')];this['countabandonedretry']=_0x1e251f['countabandonedretry'];this['countmachineretry']=_0x1e251f[_0xb557('0xe')];this[_0xb557('0x10')]=_0x1e251f[_0xb557('0x10')];this[_0xb557('0x11')]=_0x56487b[_0xb557('0x11')];this[_0xb557('0x12')]=_0x1e251f[_0xb557('0x13')];this['calleridnum']=_0x1e251f[_0xb557('0x14')];this['starttime']=_0x1e251f['starttime'];this[_0xb557('0x15')]=_0x1e251f[_0xb557('0x15')];this[_0xb557('0x16')]=_0x1e251f[_0xb557('0x16')];this[_0xb557('0x17')]=moment()[_0xb557('0x18')](_0xb557('0x19'));this['ringtime']=utils[_0xb557('0x1a')](_0x1e251f[_0xb557('0x15')],_0x1e251f[_0xb557('0x1b')]);this[_0xb557('0x1c')]=utils[_0xb557('0x1a')](_0x1e251f[_0xb557('0x16')],_0x1e251f[_0xb557('0x15')]);this['talktime']=utils[_0xb557('0x1a')](this[_0xb557('0x17')],_0x1e251f[_0xb557('0x16')]);this[_0xb557('0x7')]=_0x56487b[_0xb557('0x7')];this[_0xb557('0x1d')]=_0x56487b[_0xb557('0x1d')];this[_0xb557('0x1e')]=_0x56487b['reason'];this['callback']=_0x1e251f['callback'];this[_0xb557('0x1f')]=_0x1e251f[_0xb557('0x1f')];this['callbackat']=_0x1e251f[_0xb557('0x20')];this[_0xb557('0x21')]=_0x1e251f[_0xb557('0x21')];this[_0xb557('0x22')]=_0x1e251f[_0xb557('0x22')];this['ListId']=_0x1e251f[_0xb557('0x23')];this['UserId']=_0x1e251f[_0xb557('0x24')];this['VoiceQueueId']=_0x1e251f['VoiceQueueId'];this['CampaignId']=_0x1e251f[_0xb557('0x25')];this['originatecalleridnum']=_0x1e251f[_0xb557('0x26')]||'';this['originatecalleridname']=_0x1e251f['originatecalleridname']||'';this['agiafterat']=_0x1e251f[_0xb557('0x27')];}module[_0xb557('0x28')]=AgentComplete; \ No newline at end of file +var _0x0e47=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId'];(function(_0x4ec920,_0x4b9ef0){var _0x518cf3=function(_0x1aa17a){while(--_0x1aa17a){_0x4ec920['push'](_0x4ec920['shift']());}};_0x518cf3(++_0x4b9ef0);}(_0x0e47,0xdd));var _0x70e4=function(_0x32eb94,_0xdb46e8){_0x32eb94=_0x32eb94-0x0;var _0x4f4810=_0x0e47[_0x32eb94];return _0x4f4810;};'use strict';var moment=require('moment');var utils=require(_0x70e4('0x0'));function AgentComplete(_0x5cd36a,_0x45b03f){this[_0x70e4('0x1')]=0x4;this[_0x70e4('0x2')]=_0x70e4('0x3');this[_0x70e4('0x4')]=_0x5cd36a[_0x70e4('0x4')];this[_0x70e4('0x5')]=_0x5cd36a['type'];this[_0x70e4('0x6')]=_0x5cd36a['type']==='outbound'?_0x70e4('0x7'):_0x5cd36a[_0x70e4('0x5')];this[_0x70e4('0x8')]=_0x5cd36a[_0x70e4('0x8')];this[_0x70e4('0x9')]=_0x5cd36a[_0x70e4('0x9')];this[_0x70e4('0xa')]=_0x5cd36a[_0x70e4('0xa')];this['countglobal']=_0x5cd36a['countbusyretry']+_0x5cd36a[_0x70e4('0x9')]+_0x5cd36a['countnoanswerretry']+_0x5cd36a[_0x70e4('0xb')]+_0x5cd36a['countdropretry']+_0x5cd36a[_0x70e4('0xc')]+_0x5cd36a[_0x70e4('0xd')]+_0x5cd36a[_0x70e4('0xe')];this[_0x70e4('0xb')]=_0x5cd36a[_0x70e4('0xb')];this[_0x70e4('0xf')]=_0x5cd36a['countdropretry'];this[_0x70e4('0xc')]=_0x5cd36a[_0x70e4('0xc')];this[_0x70e4('0xd')]=_0x5cd36a[_0x70e4('0xd')];this[_0x70e4('0xe')]=_0x5cd36a['countagentrejectretry'];this[_0x70e4('0x10')]=_0x45b03f['uniqueid'];this['calleridname']=_0x5cd36a[_0x70e4('0x11')];this[_0x70e4('0x12')]=_0x5cd36a[_0x70e4('0x13')];this[_0x70e4('0x14')]=_0x5cd36a['starttime'];this[_0x70e4('0x15')]=_0x5cd36a['responsetime'];this[_0x70e4('0x16')]=_0x5cd36a['answertime'];this[_0x70e4('0x17')]=moment()[_0x70e4('0x18')](_0x70e4('0x19'));this[_0x70e4('0x1a')]=utils[_0x70e4('0x1b')](_0x5cd36a[_0x70e4('0x15')],_0x5cd36a[_0x70e4('0x14')]);this[_0x70e4('0x1c')]=utils['getSeconds'](_0x5cd36a['answertime'],_0x5cd36a['responsetime']);this[_0x70e4('0x1d')]=utils[_0x70e4('0x1b')](this['endtime'],_0x5cd36a[_0x70e4('0x16')]);this['queue']=_0x45b03f[_0x70e4('0x7')];this['membername']=_0x45b03f[_0x70e4('0x1e')];this[_0x70e4('0x1f')]=_0x45b03f['reason'];this[_0x70e4('0x20')]=_0x5cd36a[_0x70e4('0x20')];this['callbackuniqueid']=_0x5cd36a[_0x70e4('0x21')];this[_0x70e4('0x22')]=_0x5cd36a['callbackat'];this[_0x70e4('0x23')]=_0x5cd36a['recallme'];this['ContactId']=_0x5cd36a['ContactId'];this['ListId']=_0x5cd36a[_0x70e4('0x24')];this[_0x70e4('0x25')]=_0x5cd36a[_0x70e4('0x25')];this[_0x70e4('0x26')]=_0x5cd36a[_0x70e4('0x26')];this[_0x70e4('0x27')]=_0x5cd36a[_0x70e4('0x27')];this[_0x70e4('0x28')]=_0x5cd36a[_0x70e4('0x28')]||'';this[_0x70e4('0x29')]=_0x5cd36a[_0x70e4('0x29')]||'';this[_0x70e4('0x2a')]=_0x5cd36a[_0x70e4('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 98ebe2c..832b74c 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5055=['CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3f7e42,_0x47fafe){var _0x3bfbe8=function(_0x415f62){while(--_0x415f62){_0x3f7e42['push'](_0x3f7e42['shift']());}};_0x3bfbe8(++_0x47fafe);}(_0x5055,0x1e1));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x6e0d24){this[_0x5505('0x0')]=_0x6e0d24['uniqueid'];this['scheduledat']=_0x6e0d24[_0x5505('0x1')];this[_0x5505('0x2')]=_0x6e0d24[_0x5505('0x2')];this['campaigntype']=_0x6e0d24[_0x5505('0x2')]===_0x5505('0x3')?_0x5505('0x4'):_0x6e0d24[_0x5505('0x2')];this[_0x5505('0x5')]=_0x6e0d24['countbusyretry'];this[_0x5505('0x6')]=_0x6e0d24[_0x5505('0x6')];this['countnoanswerretry']=_0x6e0d24['countnoanswerretry'];this[_0x5505('0x7')]=_0x6e0d24[_0x5505('0x5')]+_0x6e0d24[_0x5505('0x6')]+_0x6e0d24['countnoanswerretry']+_0x6e0d24[_0x5505('0x8')]+_0x6e0d24['countdropretry']+_0x6e0d24[_0x5505('0x9')]+_0x6e0d24['countmachineretry']+_0x6e0d24[_0x5505('0xa')];this[_0x5505('0x8')]=_0x6e0d24[_0x5505('0x8')];this[_0x5505('0xb')]=_0x6e0d24['countdropretry'];this[_0x5505('0x9')]=_0x6e0d24[_0x5505('0x9')];this[_0x5505('0xc')]=_0x6e0d24[_0x5505('0xc')];this[_0x5505('0xa')]=_0x6e0d24[_0x5505('0xa')];this[_0x5505('0x4')]=_0x6e0d24[_0x5505('0x4')];this[_0x5505('0xd')]=_0x6e0d24['calleridname'];this[_0x5505('0xe')]=_0x6e0d24[_0x5505('0xe')];this[_0x5505('0xf')]=_0x6e0d24['starttime'];this[_0x5505('0x10')]=_0x6e0d24[_0x5505('0x10')];this[_0x5505('0x11')]=_0x6e0d24[_0x5505('0x10')];this[_0x5505('0x12')]=_0x6e0d24[_0x5505('0x12')]||0x0;this['holdtime']=_0x6e0d24[_0x5505('0x13')]||0x0;this[_0x5505('0x14')]=_0x6e0d24[_0x5505('0x14')]||0x0;this[_0x5505('0x15')]=_0x6e0d24[_0x5505('0x15')];this[_0x5505('0x16')]=_0x6e0d24['callbackuniqueid'];this[_0x5505('0x17')]=_0x6e0d24[_0x5505('0x17')];this[_0x5505('0x18')]=_0x6e0d24['recallme'];this[_0x5505('0x19')]=_0x6e0d24[_0x5505('0x19')];this['ListId']=_0x6e0d24[_0x5505('0x1a')];this[_0x5505('0x1b')]=_0x6e0d24['UserId'];this[_0x5505('0x1c')]=_0x6e0d24[_0x5505('0x1c')];this[_0x5505('0x1d')]=_0x6e0d24[_0x5505('0x1d')];this[_0x5505('0x1e')]=_0x6e0d24[_0x5505('0x1e')]||'';this[_0x5505('0x1f')]=_0x6e0d24['originatecalleridname']||'';this['state']=_0x6e0d24[_0x5505('0x20')];this['statedesc']=_0x6e0d24['statedesc'];}module[_0x5505('0x21')]=Final; \ No newline at end of file +var _0xe420=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xe420,0x139));var _0x0e42=function(_0x3c7c79,_0x48d9bd){_0x3c7c79=_0x3c7c79-0x0;var _0x3a8b10=_0xe420[_0x3c7c79];return _0x3a8b10;};'use strict';function Final(_0x405250){this[_0x0e42('0x0')]=_0x405250[_0x0e42('0x0')];this[_0x0e42('0x1')]=_0x405250[_0x0e42('0x1')];this['type']=_0x405250[_0x0e42('0x2')];this[_0x0e42('0x3')]=_0x405250[_0x0e42('0x2')]===_0x0e42('0x4')?_0x0e42('0x5'):_0x405250[_0x0e42('0x2')];this['countbusyretry']=_0x405250[_0x0e42('0x6')];this['countcongestionretry']=_0x405250[_0x0e42('0x7')];this[_0x0e42('0x8')]=_0x405250[_0x0e42('0x8')];this[_0x0e42('0x9')]=_0x405250[_0x0e42('0x6')]+_0x405250['countcongestionretry']+_0x405250['countnoanswerretry']+_0x405250[_0x0e42('0xa')]+_0x405250['countdropretry']+_0x405250[_0x0e42('0xb')]+_0x405250[_0x0e42('0xc')]+_0x405250[_0x0e42('0xd')];this['countnosuchnumberretry']=_0x405250['countnosuchnumberretry'];this[_0x0e42('0xe')]=_0x405250['countdropretry'];this[_0x0e42('0xb')]=_0x405250['countabandonedretry'];this[_0x0e42('0xc')]=_0x405250[_0x0e42('0xc')];this[_0x0e42('0xd')]=_0x405250[_0x0e42('0xd')];this[_0x0e42('0x5')]=_0x405250[_0x0e42('0x5')];this[_0x0e42('0xf')]=_0x405250[_0x0e42('0xf')];this[_0x0e42('0x10')]=_0x405250[_0x0e42('0x10')];this['starttime']=_0x405250[_0x0e42('0x11')];this[_0x0e42('0x12')]=_0x405250[_0x0e42('0x12')];this[_0x0e42('0x13')]=_0x405250[_0x0e42('0x12')];this[_0x0e42('0x14')]=_0x405250[_0x0e42('0x14')]||0x0;this[_0x0e42('0x15')]=_0x405250[_0x0e42('0x15')]||0x0;this['talktime']=_0x405250[_0x0e42('0x16')]||0x0;this['callback']=_0x405250[_0x0e42('0x17')];this[_0x0e42('0x18')]=_0x405250[_0x0e42('0x18')];this['callbackat']=_0x405250[_0x0e42('0x19')];this[_0x0e42('0x1a')]=_0x405250[_0x0e42('0x1a')];this['ContactId']=_0x405250[_0x0e42('0x1b')];this[_0x0e42('0x1c')]=_0x405250[_0x0e42('0x1c')];this[_0x0e42('0x1d')]=_0x405250[_0x0e42('0x1d')];this[_0x0e42('0x1e')]=_0x405250[_0x0e42('0x1e')];this['CampaignId']=_0x405250['CampaignId'];this[_0x0e42('0x1f')]=_0x405250['originatecalleridnum']||'';this[_0x0e42('0x20')]=_0x405250[_0x0e42('0x20')]||'';this[_0x0e42('0x21')]=_0x405250[_0x0e42('0x21')];this[_0x0e42('0x22')]=_0x405250['statedesc'];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 9efb668..1f9d1d9 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a80=['statedesc','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3a80,0x166));var _0x03a8=function(_0xdc1eb,_0x37a9d2){_0xdc1eb=_0xdc1eb-0x0;var _0x27c55e=_0x3a80[_0xdc1eb];return _0x27c55e;};'use strict';var moment=require(_0x03a8('0x0'));var utils=require(_0x03a8('0x1'));function Hangup(_0x5c57bc,_0x3ffb70){this['state']=0x4;this[_0x03a8('0x2')]='Answer';this[_0x03a8('0x3')]=_0x5c57bc[_0x03a8('0x3')];this[_0x03a8('0x4')]=_0x5c57bc[_0x03a8('0x4')];this[_0x03a8('0x5')]=_0x5c57bc[_0x03a8('0x4')]===_0x03a8('0x6')?'queue':_0x5c57bc[_0x03a8('0x4')];this['amd']=_0x5c57bc[_0x03a8('0x7')]||![];this[_0x03a8('0x8')]=_0x5c57bc[_0x03a8('0x8')];this[_0x03a8('0x9')]=_0x5c57bc[_0x03a8('0x9')];this[_0x03a8('0xa')]=_0x5c57bc[_0x03a8('0xa')];this['countglobal']=_0x5c57bc[_0x03a8('0x8')]+_0x5c57bc[_0x03a8('0x9')]+_0x5c57bc[_0x03a8('0xa')]+_0x5c57bc[_0x03a8('0xb')]+_0x5c57bc[_0x03a8('0xc')]+_0x5c57bc[_0x03a8('0xd')]+_0x5c57bc[_0x03a8('0xe')]+_0x5c57bc[_0x03a8('0xf')];this[_0x03a8('0xb')]=_0x5c57bc[_0x03a8('0xb')];this[_0x03a8('0xc')]=_0x5c57bc[_0x03a8('0xc')];this[_0x03a8('0xd')]=_0x5c57bc[_0x03a8('0xd')];this[_0x03a8('0xe')]=_0x5c57bc[_0x03a8('0xe')];this[_0x03a8('0xf')]=_0x5c57bc[_0x03a8('0xf')];this[_0x03a8('0x10')]=_0x3ffb70[_0x03a8('0x10')];this[_0x03a8('0x11')]=_0x5c57bc[_0x03a8('0x12')];this[_0x03a8('0x13')]=_0x5c57bc[_0x03a8('0x14')];this[_0x03a8('0x15')]=_0x5c57bc[_0x03a8('0x15')];this['responsetime']=_0x5c57bc[_0x03a8('0x16')];this[_0x03a8('0x17')]=moment()[_0x03a8('0x18')](_0x03a8('0x19'));this[_0x03a8('0x1a')]=utils[_0x03a8('0x1b')](_0x5c57bc['responsetime'],_0x5c57bc[_0x03a8('0x15')]);this[_0x03a8('0x1c')]=0x0;this[_0x03a8('0x1d')]=utils['getSeconds'](this[_0x03a8('0x17')],_0x5c57bc[_0x03a8('0x16')]);this[_0x03a8('0x1e')]=_0x5c57bc[_0x03a8('0x1e')];this[_0x03a8('0x1f')]=_0x03a8('0x20');this[_0x03a8('0x21')]=_0x3ffb70[_0x03a8('0x22')];this['callback']=_0x5c57bc[_0x03a8('0x23')];this[_0x03a8('0x24')]=_0x5c57bc[_0x03a8('0x24')];this[_0x03a8('0x25')]=_0x5c57bc[_0x03a8('0x25')];this['recallme']=_0x5c57bc[_0x03a8('0x26')];this[_0x03a8('0x27')]=_0x5c57bc[_0x03a8('0x27')];this[_0x03a8('0x28')]=_0x5c57bc[_0x03a8('0x28')];this[_0x03a8('0x29')]=_0x5c57bc['UserId'];this[_0x03a8('0x2a')]=_0x5c57bc[_0x03a8('0x2a')];this[_0x03a8('0x2b')]=_0x5c57bc[_0x03a8('0x2b')];}module[_0x03a8('0x2c')]=Hangup; \ No newline at end of file +var _0x4cc8=['ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xb994ba,_0x1ab272){var _0x4b0d62=function(_0xcec71b){while(--_0xcec71b){_0xb994ba['push'](_0xb994ba['shift']());}};_0x4b0d62(++_0x1ab272);}(_0x4cc8,0x12f));var _0x84cc=function(_0xed1fa,_0x470511){_0xed1fa=_0xed1fa-0x0;var _0x867eb=_0x4cc8[_0xed1fa];return _0x867eb;};'use strict';var moment=require(_0x84cc('0x0'));var utils=require('../utils');function Hangup(_0x5b6d46,_0x3a95e2){this['state']=0x4;this[_0x84cc('0x1')]=_0x84cc('0x2');this['scheduledat']=_0x5b6d46[_0x84cc('0x3')];this['type']=_0x5b6d46[_0x84cc('0x4')];this['campaigntype']=_0x5b6d46[_0x84cc('0x4')]==='outbound'?_0x84cc('0x5'):_0x5b6d46[_0x84cc('0x4')];this['amd']=_0x5b6d46[_0x84cc('0x6')]||![];this[_0x84cc('0x7')]=_0x5b6d46['countbusyretry'];this[_0x84cc('0x8')]=_0x5b6d46[_0x84cc('0x8')];this['countnoanswerretry']=_0x5b6d46[_0x84cc('0x9')];this[_0x84cc('0xa')]=_0x5b6d46[_0x84cc('0x7')]+_0x5b6d46[_0x84cc('0x8')]+_0x5b6d46[_0x84cc('0x9')]+_0x5b6d46[_0x84cc('0xb')]+_0x5b6d46[_0x84cc('0xc')]+_0x5b6d46[_0x84cc('0xd')]+_0x5b6d46[_0x84cc('0xe')]+_0x5b6d46[_0x84cc('0xf')];this[_0x84cc('0xb')]=_0x5b6d46[_0x84cc('0xb')];this[_0x84cc('0xc')]=_0x5b6d46[_0x84cc('0xc')];this[_0x84cc('0xd')]=_0x5b6d46[_0x84cc('0xd')];this[_0x84cc('0xe')]=_0x5b6d46[_0x84cc('0xe')];this[_0x84cc('0xf')]=_0x5b6d46['countagentrejectretry'];this[_0x84cc('0x10')]=_0x3a95e2[_0x84cc('0x10')];this[_0x84cc('0x11')]=_0x5b6d46[_0x84cc('0x12')];this['calleridnum']=_0x5b6d46[_0x84cc('0x13')];this[_0x84cc('0x14')]=_0x5b6d46['starttime'];this[_0x84cc('0x15')]=_0x5b6d46['responsetime'];this[_0x84cc('0x16')]=moment()[_0x84cc('0x17')](_0x84cc('0x18'));this[_0x84cc('0x19')]=utils[_0x84cc('0x1a')](_0x5b6d46[_0x84cc('0x15')],_0x5b6d46['starttime']);this[_0x84cc('0x1b')]=0x0;this[_0x84cc('0x1c')]=utils[_0x84cc('0x1a')](this[_0x84cc('0x16')],_0x5b6d46[_0x84cc('0x15')]);this['queue']=_0x5b6d46[_0x84cc('0x5')];this[_0x84cc('0x1d')]=_0x84cc('0x1e');this[_0x84cc('0x1f')]=_0x3a95e2[_0x84cc('0x20')];this[_0x84cc('0x21')]=_0x5b6d46[_0x84cc('0x21')];this[_0x84cc('0x22')]=_0x5b6d46[_0x84cc('0x22')];this['callbackat']=_0x5b6d46['callbackat'];this[_0x84cc('0x23')]=_0x5b6d46[_0x84cc('0x23')];this[_0x84cc('0x24')]=_0x5b6d46[_0x84cc('0x24')];this[_0x84cc('0x25')]=_0x5b6d46['ListId'];this['UserId']=_0x5b6d46['UserId'];this[_0x84cc('0x26')]=_0x5b6d46[_0x84cc('0x26')];this['CampaignId']=_0x5b6d46[_0x84cc('0x27')];}module[_0x84cc('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index ce6fbe8..c436b88 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2be2=['statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0xd08465,_0x35e4fa){var _0x1046cf=function(_0x1b811a){while(--_0x1b811a){_0xd08465['push'](_0xd08465['shift']());}};_0x1046cf(++_0x35e4fa);}(_0x2be2,0x129));var _0x22be=function(_0x1173d0,_0x37fe43){_0x1173d0=_0x1173d0-0x0;var _0x24b2a3=_0x2be2[_0x1173d0];return _0x24b2a3;};'use strict';var utils=require(_0x22be('0x0'));function History(_0x20191c){this['uniqueid']=_0x20191c[_0x22be('0x1')];this['scheduledat']=_0x20191c[_0x22be('0x2')]||undefined;this['type']=_0x20191c[_0x22be('0x3')];this[_0x22be('0x4')]=_0x20191c[_0x22be('0x3')]===_0x22be('0x5')?_0x22be('0x6'):_0x20191c['type'];this[_0x22be('0x7')]=_0x20191c[_0x22be('0x7')];this[_0x22be('0x8')]=_0x20191c[_0x22be('0x8')];this['countnoanswerretry']=_0x20191c[_0x22be('0x9')];this[_0x22be('0xa')]=_0x20191c['countbusyretry']+_0x20191c[_0x22be('0x8')]+_0x20191c['countnoanswerretry']+_0x20191c[_0x22be('0xb')]+_0x20191c[_0x22be('0xc')]+_0x20191c[_0x22be('0xd')]+_0x20191c[_0x22be('0xe')]+_0x20191c[_0x22be('0xf')];this[_0x22be('0xb')]=_0x20191c[_0x22be('0xb')];this['countdropretry']=_0x20191c[_0x22be('0xc')];this['countabandonedretry']=_0x20191c[_0x22be('0xd')];this['countmachineretry']=_0x20191c[_0x22be('0xe')];this['countagentrejectretry']=_0x20191c[_0x22be('0xf')];this[_0x22be('0x6')]=_0x20191c[_0x22be('0x6')];this[_0x22be('0x10')]=_0x20191c[_0x22be('0x11')];this[_0x22be('0x12')]=_0x20191c[_0x22be('0x13')];this[_0x22be('0x14')]=_0x20191c[_0x22be('0x14')];this['responsetime']=_0x20191c['responsetime'];this[_0x22be('0x15')]=_0x20191c[_0x22be('0x16')];this['ringtime']=utils[_0x22be('0x17')](_0x20191c[_0x22be('0x16')],_0x20191c[_0x22be('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x22be('0x18')]=_0x20191c['callback'];this[_0x22be('0x19')]=_0x20191c[_0x22be('0x19')];this['callbackat']=_0x20191c[_0x22be('0x1a')];this[_0x22be('0x1b')]=_0x20191c['recallme'];this[_0x22be('0x1c')]=_0x20191c[_0x22be('0x1c')];this[_0x22be('0x1d')]=_0x20191c[_0x22be('0x1d')];this['UserId']=_0x20191c[_0x22be('0x1e')];this[_0x22be('0x1f')]=_0x20191c[_0x22be('0x1f')];this['CampaignId']=_0x20191c[_0x22be('0x20')];this[_0x22be('0x21')]=_0x20191c[_0x22be('0x21')]||'';this[_0x22be('0x22')]=_0x20191c['originatecalleridname']||'';this['state']=_0x20191c[_0x22be('0x23')];this[_0x22be('0x24')]=_0x20191c[_0x22be('0x24')];}module['exports']=History; \ No newline at end of file +var _0x11cc=['countmachineretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x2c09c5,_0x4c1ae3){var _0x4cc01d=function(_0x32bca0){while(--_0x32bca0){_0x2c09c5['push'](_0x2c09c5['shift']());}};_0x4cc01d(++_0x4c1ae3);}(_0x11cc,0xa1));var _0xc11c=function(_0xe6ce5f,_0x24a05a){_0xe6ce5f=_0xe6ce5f-0x0;var _0x2af5a9=_0x11cc[_0xe6ce5f];return _0x2af5a9;};'use strict';var utils=require(_0xc11c('0x0'));function History(_0x200957){this[_0xc11c('0x1')]=_0x200957[_0xc11c('0x1')];this[_0xc11c('0x2')]=_0x200957[_0xc11c('0x2')]||undefined;this[_0xc11c('0x3')]=_0x200957[_0xc11c('0x3')];this[_0xc11c('0x4')]=_0x200957[_0xc11c('0x3')]==='outbound'?_0xc11c('0x5'):_0x200957[_0xc11c('0x3')];this[_0xc11c('0x6')]=_0x200957[_0xc11c('0x6')];this['countcongestionretry']=_0x200957[_0xc11c('0x7')];this[_0xc11c('0x8')]=_0x200957[_0xc11c('0x8')];this[_0xc11c('0x9')]=_0x200957['countbusyretry']+_0x200957[_0xc11c('0x7')]+_0x200957[_0xc11c('0x8')]+_0x200957[_0xc11c('0xa')]+_0x200957[_0xc11c('0xb')]+_0x200957[_0xc11c('0xc')]+_0x200957['countmachineretry']+_0x200957[_0xc11c('0xd')];this[_0xc11c('0xa')]=_0x200957[_0xc11c('0xa')];this['countdropretry']=_0x200957[_0xc11c('0xb')];this['countabandonedretry']=_0x200957['countabandonedretry'];this['countmachineretry']=_0x200957[_0xc11c('0xe')];this[_0xc11c('0xd')]=_0x200957[_0xc11c('0xd')];this['queue']=_0x200957[_0xc11c('0x5')];this[_0xc11c('0xf')]=_0x200957[_0xc11c('0x10')];this['calleridnum']=_0x200957[_0xc11c('0x11')];this[_0xc11c('0x12')]=_0x200957['starttime'];this['responsetime']=_0x200957[_0xc11c('0x13')];this[_0xc11c('0x14')]=_0x200957[_0xc11c('0x13')];this[_0xc11c('0x15')]=utils[_0xc11c('0x16')](_0x200957[_0xc11c('0x13')],_0x200957['starttime']);this[_0xc11c('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x200957['callback'];this[_0xc11c('0x18')]=_0x200957[_0xc11c('0x18')];this[_0xc11c('0x19')]=_0x200957[_0xc11c('0x19')];this['recallme']=_0x200957[_0xc11c('0x1a')];this[_0xc11c('0x1b')]=_0x200957[_0xc11c('0x1b')];this[_0xc11c('0x1c')]=_0x200957['ListId'];this[_0xc11c('0x1d')]=_0x200957[_0xc11c('0x1d')];this[_0xc11c('0x1e')]=_0x200957[_0xc11c('0x1e')];this[_0xc11c('0x1f')]=_0x200957[_0xc11c('0x1f')];this[_0xc11c('0x20')]=_0x200957[_0xc11c('0x20')]||'';this['originatecalleridname']=_0x200957[_0xc11c('0x21')]||'';this['state']=_0x200957['state'];this[_0xc11c('0x22')]=_0x200957[_0xc11c('0x22')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 0d404dc..96466e7 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23c5=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','dropreason','droptime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x49b7ac,_0x1bd651){var _0x54f677=function(_0x553049){while(--_0x553049){_0x49b7ac['push'](_0x49b7ac['shift']());}};_0x54f677(++_0x1bd651);}(_0x23c5,0xfc));var _0x523c=function(_0x5508f7,_0x1a8b25){_0x5508f7=_0x5508f7-0x0;var _0x815f38=_0x23c5[_0x5508f7];return _0x815f38;};'use strict';var utils=require(_0x523c('0x0'));function QueueCallerAbandon(_0x49cbec,_0x2c5a8b){this[_0x523c('0x1')]=_0x49cbec[_0x523c('0x1')];this[_0x523c('0x2')]=_0x49cbec[_0x523c('0x2')];this[_0x523c('0x3')]=_0x49cbec[_0x523c('0x2')]==='outbound'?_0x523c('0x4'):_0x49cbec[_0x523c('0x2')];this[_0x523c('0x5')]=_0x49cbec['countbusyretry'];this[_0x523c('0x6')]=_0x49cbec[_0x523c('0x6')];this[_0x523c('0x7')]=_0x49cbec[_0x523c('0x7')];this[_0x523c('0x8')]=_0x49cbec[_0x523c('0x5')]+_0x49cbec[_0x523c('0x6')]+_0x49cbec[_0x523c('0x7')]+_0x49cbec[_0x523c('0x9')]+_0x49cbec[_0x523c('0xa')]+_0x49cbec[_0x523c('0xb')]+_0x49cbec['countmachineretry']+_0x49cbec[_0x523c('0xc')];this[_0x523c('0x9')]=_0x49cbec[_0x523c('0x9')];this[_0x523c('0xa')]=_0x49cbec['countdropretry'];this['countabandonedretry']=_0x49cbec[_0x523c('0xb')];this['countmachineretry']=_0x49cbec[_0x523c('0xd')];this[_0x523c('0xc')]=_0x49cbec[_0x523c('0xc')];this['uniqueid']=_0x2c5a8b[_0x523c('0xe')];this[_0x523c('0xf')]=_0x49cbec[_0x523c('0x10')];this[_0x523c('0x11')]=_0x49cbec[_0x523c('0x12')];this[_0x523c('0x13')]=_0x49cbec['starttime'];this[_0x523c('0x14')]=_0x49cbec['responsetime'];this['droptime']=_0x49cbec['droptime'];this[_0x523c('0x15')]=_0x49cbec[_0x523c('0x15')];this['endtime']=this[_0x523c('0x16')];this[_0x523c('0x17')]=utils[_0x523c('0x18')](_0x49cbec[_0x523c('0x14')],_0x49cbec['starttime']);this[_0x523c('0x19')]=utils['getSeconds'](this[_0x523c('0x16')],_0x49cbec[_0x523c('0x14')]);this[_0x523c('0x1a')]=0x0;this[_0x523c('0x4')]=_0x2c5a8b['queue'];this['membername']=_0x2c5a8b[_0x523c('0x1b')];this[_0x523c('0x1c')]=_0x2c5a8b[_0x523c('0x1c')];this[_0x523c('0x1d')]=_0x49cbec[_0x523c('0x1d')];this[_0x523c('0x1e')]=_0x49cbec[_0x523c('0x1e')];this['callbackat']=_0x49cbec[_0x523c('0x1f')];this['recallme']=_0x49cbec[_0x523c('0x20')];this[_0x523c('0x21')]=_0x49cbec[_0x523c('0x21')];this[_0x523c('0x22')]=_0x49cbec[_0x523c('0x22')];this[_0x523c('0x23')]=_0x49cbec['UserId'];this[_0x523c('0x24')]=_0x49cbec['VoiceQueueId'];this[_0x523c('0x25')]=_0x49cbec[_0x523c('0x25')];this[_0x523c('0x26')]=_0x49cbec[_0x523c('0x26')]||'';this['originatecalleridname']=_0x49cbec['originatecalleridname']||'';this['agiafterat']=_0x49cbec[_0x523c('0x27')];this[_0x523c('0x28')]=_0x49cbec[_0x523c('0x28')];this[_0x523c('0x29')]=_0x49cbec[_0x523c('0x29')];}module[_0x523c('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xe64e=['number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum'];(function(_0x54404d,_0x2f3a0f){var _0x16db20=function(_0x518522){while(--_0x518522){_0x54404d['push'](_0x54404d['shift']());}};_0x16db20(++_0x2f3a0f);}(_0xe64e,0x1b0));var _0xee64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe64e[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xee64('0x0'));function QueueCallerAbandon(_0x64b14f,_0x335aba){this[_0xee64('0x1')]=_0x64b14f[_0xee64('0x1')];this[_0xee64('0x2')]=_0x64b14f[_0xee64('0x2')];this[_0xee64('0x3')]=_0x64b14f[_0xee64('0x2')]===_0xee64('0x4')?_0xee64('0x5'):_0x64b14f['type'];this[_0xee64('0x6')]=_0x64b14f[_0xee64('0x6')];this[_0xee64('0x7')]=_0x64b14f[_0xee64('0x7')];this[_0xee64('0x8')]=_0x64b14f[_0xee64('0x8')];this[_0xee64('0x9')]=_0x64b14f[_0xee64('0x6')]+_0x64b14f['countcongestionretry']+_0x64b14f[_0xee64('0x8')]+_0x64b14f[_0xee64('0xa')]+_0x64b14f[_0xee64('0xb')]+_0x64b14f[_0xee64('0xc')]+_0x64b14f['countmachineretry']+_0x64b14f[_0xee64('0xd')];this[_0xee64('0xa')]=_0x64b14f[_0xee64('0xa')];this[_0xee64('0xb')]=_0x64b14f[_0xee64('0xb')];this[_0xee64('0xc')]=_0x64b14f[_0xee64('0xc')];this[_0xee64('0xe')]=_0x64b14f['countmachineretry'];this[_0xee64('0xd')]=_0x64b14f['countagentrejectretry'];this[_0xee64('0xf')]=_0x335aba[_0xee64('0xf')];this['calleridname']=_0x64b14f[_0xee64('0x10')];this[_0xee64('0x11')]=_0x64b14f[_0xee64('0x12')];this[_0xee64('0x13')]=_0x64b14f['starttime'];this[_0xee64('0x14')]=_0x64b14f[_0xee64('0x14')];this['droptime']=_0x64b14f[_0xee64('0x15')];this[_0xee64('0x16')]=_0x64b14f[_0xee64('0x16')];this[_0xee64('0x17')]=this[_0xee64('0x15')];this[_0xee64('0x18')]=utils[_0xee64('0x19')](_0x64b14f['responsetime'],_0x64b14f['starttime']);this[_0xee64('0x1a')]=utils[_0xee64('0x19')](this[_0xee64('0x15')],_0x64b14f[_0xee64('0x14')]);this[_0xee64('0x1b')]=0x0;this['queue']=_0x335aba[_0xee64('0x5')];this[_0xee64('0x1c')]=_0x335aba[_0xee64('0x1d')];this[_0xee64('0x1e')]=_0x335aba[_0xee64('0x1e')];this[_0xee64('0x1f')]=_0x64b14f[_0xee64('0x1f')];this[_0xee64('0x20')]=_0x64b14f[_0xee64('0x20')];this[_0xee64('0x21')]=_0x64b14f[_0xee64('0x21')];this[_0xee64('0x22')]=_0x64b14f[_0xee64('0x22')];this[_0xee64('0x23')]=_0x64b14f[_0xee64('0x23')];this['ListId']=_0x64b14f[_0xee64('0x24')];this['UserId']=_0x64b14f[_0xee64('0x25')];this[_0xee64('0x26')]=_0x64b14f[_0xee64('0x26')];this[_0xee64('0x27')]=_0x64b14f[_0xee64('0x27')];this[_0xee64('0x28')]=_0x64b14f[_0xee64('0x28')]||'';this[_0xee64('0x29')]=_0x64b14f[_0xee64('0x29')]||'';this[_0xee64('0x2a')]=_0x64b14f['agiafterat'];this[_0xee64('0x2b')]=_0x64b14f['state'];this[_0xee64('0x2c')]=_0x64b14f['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1d5b636..5471e3a 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x4819,0xcd));var _0x9481=function(_0x4eb0b1,_0x1621ac){_0x4eb0b1=_0x4eb0b1-0x0;var _0x1b58bd=_0x4819[_0x4eb0b1];return _0x1b58bd;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=createHistory; \ No newline at end of file +var _0x4bd3=['catch','error','[getContactDialer]','getContactDialerIvr','temp','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','inspect','getContactDialer'];(function(_0x3892de,_0xcf3567){var _0x54c098=function(_0x1a35cb){while(--_0x1a35cb){_0x3892de['push'](_0x3892de['shift']());}};_0x54c098(++_0xcf3567);}(_0x4bd3,0x174));var _0x34bd=function(_0x20c095,_0x504532){_0x20c095=_0x20c095-0x0;var _0x48b44d=_0x4bd3[_0x20c095];return _0x48b44d;};'use strict';var util=require(_0x34bd('0x0'));var logger=require('../../../../config/logger')(_0x34bd('0x1'));var cmHopper=require(_0x34bd('0x2'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x22b921){return util[_0x34bd('0x3')](_0x22b921,{'showHidden':![],'depth':null});}function getContactDialer(_0x1fc8eb,_0x5846f3,_0x2133c5){return cmHopper[_0x34bd('0x4')](_0x1fc8eb['id'],_0x5846f3,_0x2133c5,_0x1fc8eb['dialOrderByScheduledAt'])[_0x34bd('0x5')](function(_0x213716){_0x1fc8eb['temp']=0x0;logger[_0x34bd('0x6')](_0x34bd('0x7'),inspectError(_0x213716));});}exports[_0x34bd('0x4')]=getContactDialer;function getContactDialerIvr(_0xed6181,_0x1ac77f){return cmHopper[_0x34bd('0x8')](_0xed6181['id'],_0x1ac77f,_0xed6181['dialOrderByScheduledAt'])[_0x34bd('0x5')](function(_0x45322f){_0xed6181[_0x34bd('0x9')]=0x0;logger[_0x34bd('0x6')]('[getContactDialerIvr]',inspectError(_0x45322f));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3da7a0){return cmHopper['countReScheduled'](_0x3da7a0)['catch'](function(_0x275d80){logger[_0x34bd('0x6')](_0x34bd('0xa'),inspectError(_0x275d80));});}exports[_0x34bd('0xb')]=countReScheduled;function rescheduleContact(_0x2ee180){return cmHopper[_0x34bd('0xc')](_0x2ee180)[_0x34bd('0x5')](function(_0x236f6b){logger[_0x34bd('0x6')]('[rescheduleContact]',inspectError(_0x236f6b));});}exports[_0x34bd('0xc')]=rescheduleContact;function unlockContact(_0x4d4955,_0x4e3886,_0x6638ed){return cmHopper[_0x34bd('0xd')](_0x4d4955,_0x4e3886,_0x6638ed)[_0x34bd('0x5')](function(_0x2dc917){logger[_0x34bd('0x6')](_0x34bd('0xe'),inspectError(_0x2dc917));});}exports[_0x34bd('0xd')]=unlockContact;function moveContactManagedDialer(_0x1c12e8){return cmHopper[_0x34bd('0xf')](_0x1c12e8)[_0x34bd('0x5')](function(_0x4b5ebb){logger['error'](_0x34bd('0x10'),inspectError(_0x4b5ebb));});}exports[_0x34bd('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x265e70){return cmHopperBlack[_0x34bd('0x11')](_0x265e70)[_0x34bd('0x5')](function(_0x23a94a){logger[_0x34bd('0x6')](_0x34bd('0x12'),inspectError(_0x23a94a));});}exports[_0x34bd('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x55538e){return cmHopperBlack[_0x34bd('0x13')](_0x55538e)[_0x34bd('0x5')](function(_0x49f625){logger[_0x34bd('0x6')](_0x34bd('0x14'),inspectError(_0x49f625));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x582772,_0x5da62a,_0x4edf84){return cmHopperAdditionalPhone[_0x34bd('0x15')](_0x582772,_0x5da62a,_0x4edf84)['catch'](function(_0x10fc4b){logger[_0x34bd('0x6')](_0x34bd('0x16'),inspectError(_0x10fc4b));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x41bffd,_0x14479a,_0x4f0dff){return cmHopperAdditionalPhone[_0x34bd('0x17')](_0x41bffd,_0x14479a,_0x4f0dff)['catch'](function(_0x29bda8){logger[_0x34bd('0x6')](_0x34bd('0x18'),inspectError(_0x29bda8));});}exports[_0x34bd('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x56baf7){return cmHopperHistory[_0x34bd('0x19')](_0x56baf7)[_0x34bd('0x5')](function(_0x5d2e3d){logger[_0x34bd('0x6')](_0x34bd('0x1a'),inspectError(_0x5d2e3d));});}exports[_0x34bd('0x19')]=avgHandleTime;function createHistory(_0x3f675c){return cmHopperHistory[_0x34bd('0x1b')](_0x3f675c)[_0x34bd('0x5')](function(_0x177d43){logger['error'](_0x34bd('0x1c'),inspectError(_0x177d43));});}exports[_0x34bd('0x1b')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 61c8287..786d28e 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd78a=['loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','unmonitored','status','TrunkBackup','includes','INACTIVE','originated','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn'];(function(_0x414568,_0x38ea14){var _0x2bccba=function(_0x28e773){while(--_0x28e773){_0x414568['push'](_0x414568['shift']());}};_0x2bccba(++_0x38ea14);}(_0xd78a,0x13d));var _0xad78=function(_0x4b92cd,_0x382484){_0x4b92cd=_0x4b92cd-0x0;var _0x264e66=_0xd78a[_0x4b92cd];return _0x264e66;};'use strict';var _=require(_0xad78('0x0'));var moment=require(_0xad78('0x1'));var util=require(_0xad78('0x2'));var logger=require(_0xad78('0x3'))('dialer');var timezones=require(_0xad78('0x4'))[_0xad78('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xad78('0x6'),'BLACKLIST':_0xad78('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xad78('0x8'),'DISACTIVED':_0xad78('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xad78('0xa'),'NO_AGENTS_LOGGED':_0xad78('0xb'),'NO_AVAILABLE_CONTACTS':_0xad78('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xad78('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xad78('0xe'),'QUEUE_RECALL':_0xad78('0xf'),'RECALL_TIMEOUT':_0xad78('0x10'),'RUNNING':_0xad78('0x11'),'UNKNOWN_TIMEZONE':_0xad78('0x12'),'UNREACHABLE_TRUNK':_0xad78('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3f3e42){return _0x3f3e42[_0xad78('0x14')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x402650){return _0x402650[_0xad78('0x15')]===_0xad78('0x16');}exports[_0xad78('0x17')]=isIVRCampaign;function isOutboundQueue(_0x2d3265){return _0x2d3265[_0xad78('0x15')]==='outbound';}exports[_0xad78('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x3e7380){return _0x3e7380[_0xad78('0x19')];}exports[_0xad78('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5527c3){return _0x5527c3[_0xad78('0x1b')];}exports[_0xad78('0x1c')]=isIVRCampaignActive;function getSeconds(_0x235275,_0x5dcc47){var _0x3c8ef3=moment(_0x235275)['milliseconds'](0x0);var _0x1ceca8=moment(_0x5dcc47)[_0xad78('0x1d')](0x0);return _0x3c8ef3[_0xad78('0x1e')](_0x1ceca8,'seconds');}exports[_0xad78('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x53ad7b,_0xe2f554){var _0x3a2526=![];var _0x5b8c4b=_0x53ad7b[_0xad78('0x14')]!==_0xe2f554[_0xad78('0x14')]||_0x53ad7b['dialActive']!==_0xe2f554[_0xad78('0x19')]||_0x53ad7b[_0xad78('0x20')]!==_0xe2f554[_0xad78('0x20')];var _0x275191=_0x53ad7b[_0xad78('0x21')]!==_0xe2f554[_0xad78('0x21')]||_0x53ad7b[_0xad78('0x22')]!==_0xe2f554[_0xad78('0x22')]||_0x53ad7b[_0xad78('0x23')]!==_0xe2f554[_0xad78('0x23')]||_0x53ad7b[_0xad78('0x24')]!==_0xe2f554[_0xad78('0x24')]||_0x53ad7b[_0xad78('0x25')]!==_0xe2f554[_0xad78('0x25')]||_0x53ad7b['pTalking']!==_0xe2f554[_0xad78('0x26')]||_0x53ad7b[_0xad78('0x27')]!==_0xe2f554[_0xad78('0x27')]||_0x53ad7b[_0xad78('0x28')]!==_0xe2f554[_0xad78('0x28')]||_0x53ad7b['originated']!==_0xe2f554['originated'];if(_0x53ad7b[_0xad78('0x29')]&&_0xe2f554[_0xad78('0x29')]){_0x3a2526=_0x53ad7b['Trunk']['name']!==_0xe2f554[_0xad78('0x29')][_0xad78('0x2a')]||_0x53ad7b['Trunk'][_0xad78('0x1b')]!==_0xe2f554[_0xad78('0x29')]['active'];}return _0x5b8c4b||_0x275191||_0x3a2526;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1e2cc8){var _0x5c69a3=null;var _0x30f196=_0x1e2cc8[_0xad78('0x2b')];if(_[_0xad78('0x2c')](_0x1e2cc8[_0xad78('0x2d')])||_['isNil'](_0x1e2cc8[_0xad78('0x2e')])||_[_0xad78('0x2c')](_0x1e2cc8[_0xad78('0x2e')][_0xad78('0x2f')])){_0x5c69a3=CAMPAIGN_STATUS[_0xad78('0x30')];}else if(_[_0xad78('0x31')](_0x1e2cc8[_0xad78('0x2d')])||_['isEmpty'](_0x1e2cc8[_0xad78('0x2e')][_0xad78('0x2f')])){_0x5c69a3=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x30f196&&!timezones[_0x30f196]){_0x5c69a3=CAMPAIGN_STATUS[_0xad78('0x32')];}return _0x5c69a3;}function checkAnyValidTrunk(_0x25885f,_0x428657){var _0x4710cf=null;var _0xb5676c='SIP/';var _0xaf48ed=['reachable',_0xad78('0x33')];var _0x53053a=!![];if(_0x25885f[_0xad78('0x29')]&&_0x25885f[_0xad78('0x29')][_0xad78('0x1b')]){_0xb5676c+=_0x25885f[_0xad78('0x29')][_0xad78('0x2a')];_0x4710cf=_0x428657[_0xb5676c];_0x53053a=_0xaf48ed['includes'](_0x4710cf[_0xad78('0x34')]);}else if(_0x25885f[_0xad78('0x35')]&&_0x25885f[_0xad78('0x35')][_0xad78('0x1b')]){_0xb5676c+=_0x25885f[_0xad78('0x35')][_0xad78('0x2a')];_0x4710cf=_0x428657[_0xb5676c];_0x53053a=_0xaf48ed[_0xad78('0x36')](_0x4710cf['status']);}return _0x53053a;}function getQueueCampaignStatusMessage(_0x51d8af,_0x49a7f7){var _0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x6')];var _0x410d0f=isPreviewCampaign(_0x51d8af);if(!isQueueCampaignActive(_0x51d8af)){if(_0x410d0f){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x37')];}else{if(_0x51d8af[_0xad78('0x38')]===0x0&&_0x51d8af[_0xad78('0x25')]===0x0&&_0x51d8af[_0xad78('0x27')]===0x0&&(_0x51d8af[_0xad78('0x26')]||0x0)===0x0){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x37')];}else{_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x39')];}}}else if(_0x51d8af['loggedIn']===0x0){_0x4d72fe=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x51d8af,_0x49a7f7)){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x3a')];}else if(!isPreviewCampaign(_0x51d8af)){var _0x5a5b3e=checkAnyValidQueueCampaignInterval(_0x51d8af);if(_0x5a5b3e){_0x4d72fe=_0x5a5b3e;}}return _0x4d72fe;}exports[_0xad78('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1250d5){var _0x4242c1=CAMPAIGN_STATUS[_0xad78('0x39')];if(_0x1250d5['originated']===0x0&&_0x1250d5[_0xad78('0x25')]===0x0&&_0x1250d5[_0xad78('0x27')]===0x0&&(_0x1250d5[_0xad78('0x26')]||0x0)===0x0){_0x4242c1=CAMPAIGN_STATUS[_0xad78('0x37')];}return _0x4242c1;}exports[_0xad78('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x43ba29){var _0x542896=_0x43ba29[_0xad78('0x3d')](/"(.*?)"/);return _0x542896?_0x542896[0x1]:_0x43ba29;}exports[_0xad78('0x3e')]=extractCalleridName;function getCallerId(_0x1710da,_0x532368,_0x421691){if(!_[_0xad78('0x3f')](_0x421691)&&typeof _0x421691===_0xad78('0x40')&&!_[_0xad78('0x31')](_0x421691)){if(!_[_0xad78('0x3f')](_0x532368)&&typeof _0x532368==='string'&&!_[_0xad78('0x31')](_0x532368)){return util[_0xad78('0x41')](_0xad78('0x42'),_0x532368,_0x421691);}return util[_0xad78('0x41')](_0xad78('0x42'),_0x421691,_0x421691);}if(!_[_0xad78('0x3f')](_0x1710da)&&typeof _0x1710da===_0xad78('0x40')&&!_[_0xad78('0x31')](_0x1710da)){return _0x1710da;}return _0xad78('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x56b3a9,_0x97f62a){var _0x4f1915;var _0x1352b6;var _0x457574;if(_0x97f62a<=0x0){_0x97f62a=0x1;}_0x4f1915=new RegExp(_0xad78('0x44')+_0x97f62a+'}$');_0x1352b6=Math['pow'](0xa,_0x97f62a-0x1);_0x457574=Math[_0xad78('0x45')](0xa,_0x97f62a)-0x1;return util['format']('%s',_['replace'](_0x56b3a9,_0x4f1915,_[_0xad78('0x46')](_0x1352b6,_0x457574)[_0xad78('0x47')]()));}exports[_0xad78('0x48')]=getCallerIdRandom;function decrementOriginate(_0x14012d){if(_0x14012d[_0xad78('0x38')]&&_0x14012d[_0xad78('0x38')]>0x0){_0x14012d[_0xad78('0x38')]-=0x1;}else{logger[_0xad78('0x49')](_0xad78('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x57beec){return _0x57beec&&_0x57beec[_0xad78('0x4b')]>0x0;}exports[_0xad78('0x4c')]=checkContactEmpty;function erlangb(_0x3a646b,_0x32de18){if(_0x32de18===0x0){return 0x0;}var _0x1e96ad=0x1;for(var _0x116b85=0x1;_0x116b85<=_0x32de18;_0x116b85+=0x1){_0x1e96ad=0x1+_0x1e96ad*_0x116b85/_0x3a646b;}return 0x1/_0x1e96ad;}exports[_0xad78('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x42dc45,_0x1389fd,_0x5e2e21){if(_0x1389fd>_0x5e2e21){for(var _0x5f29e2=0x0;_0x5f29e2<_0x1389fd-_0x5e2e21;_0x5f29e2+=0x1){decrementOriginate(_0x42dc45);}}}exports[_0xad78('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x495096){var _0x7c904e={};var _0x1a74fc=['id',_0xad78('0x4f'),_0xad78('0x50'),_0xad78('0x51')];const _0x3266e7=0xfa;if(_0x495096){for(var _0x20c160 in _0x495096){if(typeof _0x495096[_0x20c160]!==_0xad78('0x52')){if(!_[_0xad78('0x2c')](_0x495096[_0x20c160])&&!_0x1a74fc[_0xad78('0x36')](_0x20c160)){if(_0x20c160===_0xad78('0x53')&&_0x495096[_0x20c160][_0xad78('0x4b')]>_0x3266e7){_0x7c904e[_0xad78('0x54')+_0x20c160[_0xad78('0x55')]()]=_0x495096[_0x20c160][_0xad78('0x47')]()[_0xad78('0x56')](0x0,_0x3266e7);}else{_0x7c904e[_0xad78('0x54')+_0x20c160['toUpperCase']()]=_0x495096[_0x20c160];}}}}}return _0x7c904e;}exports[_0xad78('0x57')]=setXMDContactVariables; \ No newline at end of file +var _0x8bfc=['substring','setXMDContactVariables','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','NULL_INTERVAL','isEmpty','Interval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','match','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','description','XMD-','toString'];(function(_0x4d9a48,_0x20bc50){var _0xef464d=function(_0x30e968){while(--_0x30e968){_0x4d9a48['push'](_0x4d9a48['shift']());}};_0xef464d(++_0x20bc50);}(_0x8bfc,0xaa));var _0xc8bf=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x8bfc[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var moment=require(_0xc8bf('0x0'));var util=require(_0xc8bf('0x1'));var logger=require('../../../../config/logger')(_0xc8bf('0x2'));var timezones=require(_0xc8bf('0x3'))[_0xc8bf('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xc8bf('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc8bf('0x6'),'DEACTIVATED':_0xc8bf('0x7'),'DISACTIVED':_0xc8bf('0x8'),'EMPTY_INTERVAL':_0xc8bf('0x9'),'INACTIVE':_0xc8bf('0xa'),'NO_AGENTS_LOGGED':_0xc8bf('0xb'),'NO_AVAILABLE_CONTACTS':_0xc8bf('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xc8bf('0xd'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc8bf('0xe'),'UNKNOWN_TIMEZONE':_0xc8bf('0xf'),'UNREACHABLE_TRUNK':_0xc8bf('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5ca85d){return _0x5ca85d[_0xc8bf('0x11')]==='preview';}exports[_0xc8bf('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x473e74){return _0x473e74[_0xc8bf('0x13')]===_0xc8bf('0x14');}exports[_0xc8bf('0x15')]=isIVRCampaign;function isOutboundQueue(_0x5d93ed){return _0x5d93ed[_0xc8bf('0x13')]==='outbound';}exports[_0xc8bf('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x14ad63){return _0x14ad63[_0xc8bf('0x17')];}exports[_0xc8bf('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x51bc32){return _0x51bc32[_0xc8bf('0x19')];}exports[_0xc8bf('0x1a')]=isIVRCampaignActive;function getSeconds(_0x1c9994,_0x584b60){var _0x4a365a=moment(_0x1c9994)[_0xc8bf('0x1b')](0x0);var _0x1d303c=moment(_0x584b60)[_0xc8bf('0x1b')](0x0);return _0x4a365a[_0xc8bf('0x1c')](_0x1d303c,_0xc8bf('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x35b7aa,_0x20ad83){var _0x5a458e=![];var _0x17264e=_0x35b7aa[_0xc8bf('0x11')]!==_0x20ad83[_0xc8bf('0x11')]||_0x35b7aa['dialActive']!==_0x20ad83[_0xc8bf('0x17')]||_0x35b7aa[_0xc8bf('0x1e')]!==_0x20ad83['message'];var _0x1fd168=_0x35b7aa[_0xc8bf('0x1f')]!==_0x20ad83['available']||_0x35b7aa[_0xc8bf('0x20')]!==_0x20ad83[_0xc8bf('0x20')]||_0x35b7aa['loggedInDb']!==_0x20ad83['loggedInDb']||_0x35b7aa['paused']!==_0x20ad83[_0xc8bf('0x21')]||_0x35b7aa['talking']!==_0x20ad83[_0xc8bf('0x22')]||_0x35b7aa[_0xc8bf('0x23')]!==_0x20ad83[_0xc8bf('0x23')]||_0x35b7aa[_0xc8bf('0x24')]!==_0x20ad83[_0xc8bf('0x24')]||_0x35b7aa['inUse']!==_0x20ad83[_0xc8bf('0x25')]||_0x35b7aa['originated']!==_0x20ad83[_0xc8bf('0x26')];if(_0x35b7aa[_0xc8bf('0x27')]&&_0x20ad83[_0xc8bf('0x27')]){_0x5a458e=_0x35b7aa['Trunk'][_0xc8bf('0x28')]!==_0x20ad83[_0xc8bf('0x27')][_0xc8bf('0x28')]||_0x35b7aa[_0xc8bf('0x27')][_0xc8bf('0x19')]!==_0x20ad83[_0xc8bf('0x27')][_0xc8bf('0x19')];}return _0x17264e||_0x1fd168||_0x5a458e;}exports[_0xc8bf('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x411e87){var _0x52b8d6=null;var _0x1afd93=_0x411e87[_0xc8bf('0x2a')];if(_[_0xc8bf('0x2b')](_0x411e87[_0xc8bf('0x2c')])||_['isNil'](_0x411e87['Interval'])||_[_0xc8bf('0x2b')](_0x411e87['Interval']['Intervals'])){_0x52b8d6=CAMPAIGN_STATUS[_0xc8bf('0x2d')];}else if(_['isEmpty'](_0x411e87['dialGlobalInterval'])||_[_0xc8bf('0x2e')](_0x411e87[_0xc8bf('0x2f')]['Intervals'])){_0x52b8d6=CAMPAIGN_STATUS[_0xc8bf('0x30')];}else if(_0x1afd93&&!timezones[_0x1afd93]){_0x52b8d6=CAMPAIGN_STATUS[_0xc8bf('0x31')];}return _0x52b8d6;}function checkAnyValidTrunk(_0x3167ab,_0x2ea758){var _0x30f0ca=null;var _0x496fbd='SIP/';var _0x59b004=[_0xc8bf('0x32'),_0xc8bf('0x33')];var _0x28c01d=!![];if(_0x3167ab[_0xc8bf('0x27')]&&_0x3167ab[_0xc8bf('0x27')][_0xc8bf('0x19')]){_0x496fbd+=_0x3167ab[_0xc8bf('0x27')]['name'];_0x30f0ca=_0x2ea758[_0x496fbd];_0x28c01d=_0x59b004[_0xc8bf('0x34')](_0x30f0ca['status']);}else if(_0x3167ab[_0xc8bf('0x35')]&&_0x3167ab[_0xc8bf('0x35')][_0xc8bf('0x19')]){_0x496fbd+=_0x3167ab[_0xc8bf('0x35')][_0xc8bf('0x28')];_0x30f0ca=_0x2ea758[_0x496fbd];_0x28c01d=_0x59b004['includes'](_0x30f0ca[_0xc8bf('0x36')]);}return _0x28c01d;}function getQueueCampaignStatusMessage(_0x202a1b,_0x2391fa){var _0x524027=CAMPAIGN_STATUS[_0xc8bf('0x5')];var _0x1eb563=isPreviewCampaign(_0x202a1b);if(!isQueueCampaignActive(_0x202a1b)){if(_0x1eb563){_0x524027=CAMPAIGN_STATUS[_0xc8bf('0x37')];}else{if(_0x202a1b[_0xc8bf('0x26')]===0x0&&_0x202a1b[_0xc8bf('0x22')]===0x0&&_0x202a1b[_0xc8bf('0x24')]===0x0&&(_0x202a1b[_0xc8bf('0x23')]||0x0)===0x0){_0x524027=CAMPAIGN_STATUS['INACTIVE'];}else{_0x524027=CAMPAIGN_STATUS[_0xc8bf('0x38')];}}}else if(_0x202a1b['loggedIn']===0x0){_0x524027=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x202a1b,_0x2391fa)){_0x524027=CAMPAIGN_STATUS[_0xc8bf('0x39')];}else if(!isPreviewCampaign(_0x202a1b)){var _0x4cf069=checkAnyValidQueueCampaignInterval(_0x202a1b);if(_0x4cf069){_0x524027=_0x4cf069;}}return _0x524027;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4776f7){var _0x4645ac=CAMPAIGN_STATUS[_0xc8bf('0x38')];if(_0x4776f7[_0xc8bf('0x26')]===0x0&&_0x4776f7[_0xc8bf('0x22')]===0x0&&_0x4776f7['waiting']===0x0&&(_0x4776f7[_0xc8bf('0x23')]||0x0)===0x0){_0x4645ac=CAMPAIGN_STATUS[_0xc8bf('0x37')];}return _0x4645ac;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x43ee0a){var _0x3a903f=_0x43ee0a[_0xc8bf('0x3a')](/"(.*?)"/);return _0x3a903f?_0x3a903f[0x1]:_0x43ee0a;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x41c8c5,_0x82118f,_0x13c50a){if(!_['isUndefined'](_0x13c50a)&&typeof _0x13c50a===_0xc8bf('0x3b')&&!_[_0xc8bf('0x2e')](_0x13c50a)){if(!_[_0xc8bf('0x3c')](_0x82118f)&&typeof _0x82118f==='string'&&!_[_0xc8bf('0x2e')](_0x82118f)){return util[_0xc8bf('0x3d')](_0xc8bf('0x3e'),_0x82118f,_0x13c50a);}return util[_0xc8bf('0x3d')](_0xc8bf('0x3e'),_0x13c50a,_0x13c50a);}if(!_['isUndefined'](_0x41c8c5)&&typeof _0x41c8c5==='string'&&!_[_0xc8bf('0x2e')](_0x41c8c5)){return _0x41c8c5;}return _0xc8bf('0x3f');}exports[_0xc8bf('0x40')]=getCallerId;function getCallerIdRandom(_0x362b45,_0x8e8d51){var _0x509043;var _0x55132c;var _0x23533b;if(_0x8e8d51<=0x0){_0x8e8d51=0x1;}_0x509043=new RegExp(_0xc8bf('0x41')+_0x8e8d51+'}$');_0x55132c=Math['pow'](0xa,_0x8e8d51-0x1);_0x23533b=Math[_0xc8bf('0x42')](0xa,_0x8e8d51)-0x1;return util[_0xc8bf('0x3d')]('%s',_[_0xc8bf('0x43')](_0x362b45,_0x509043,_[_0xc8bf('0x44')](_0x55132c,_0x23533b)['toString']()));}exports[_0xc8bf('0x45')]=getCallerIdRandom;function decrementOriginate(_0x4afdb9,_0x3eb759){if(_0x4afdb9[_0xc8bf('0x26')]&&_0x4afdb9[_0xc8bf('0x26')]>0x0){_0x4afdb9[_0xc8bf('0x26')]-=0x1;}else{logger['error'](_0xc8bf('0x46'),_0x3eb759);}}exports[_0xc8bf('0x47')]=decrementOriginate;function checkContactEmpty(_0x42be2e){return _0x42be2e&&_0x42be2e[_0xc8bf('0x48')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x244e4f,_0x143587){if(_0x143587===0x0){return 0x0;}var _0xb1ba8b=0x1;for(var _0x3944ec=0x1;_0x3944ec<=_0x143587;_0x3944ec+=0x1){_0xb1ba8b=0x1+_0xb1ba8b*_0x3944ec/_0x244e4f;}return 0x1/_0xb1ba8b;}exports[_0xc8bf('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x263dfb,_0x26c675,_0x4a2d09){if(_0x26c675>_0x4a2d09){for(var _0x5b7535=0x0;_0x5b7535<_0x26c675-_0x4a2d09;_0x5b7535+=0x1){decrementOriginate(_0x263dfb,_0xc8bf('0x4a'));}}}exports[_0xc8bf('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3f9e45){var _0x36816f={};var _0x4fc236=['id',_0xc8bf('0x4c'),_0xc8bf('0x4d'),_0xc8bf('0x4e')];const _0x531878=0xfa;if(_0x3f9e45){for(var _0x36481f in _0x3f9e45){if(typeof _0x3f9e45[_0x36481f]!=='undefined'){if(!_['isNil'](_0x3f9e45[_0x36481f])&&!_0x4fc236[_0xc8bf('0x34')](_0x36481f)){if(_0x36481f===_0xc8bf('0x4f')&&_0x3f9e45[_0x36481f][_0xc8bf('0x48')]>_0x531878){_0x36816f[_0xc8bf('0x50')+_0x36481f['toUpperCase']()]=_0x3f9e45[_0x36481f][_0xc8bf('0x51')]()[_0xc8bf('0x52')](0x0,_0x531878);}else{_0x36816f['XMD-'+_0x36481f['toUpperCase']()]=_0x3f9e45[_0x36481f];}}}}}return _0x36816f;}exports[_0xc8bf('0x53')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e751682..ea53351 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(_0xd09f34,_0x13d8db){var _0x283d91=function(_0x519d53){while(--_0x519d53){_0xd09f34['push'](_0xd09f34['shift']());}};_0x283d91(++_0x13d8db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x56e223,_0x5ecee6){var _0x42f597=function(_0x25ccec){while(--_0x25ccec){_0x56e223['push'](_0x56e223['shift']());}};_0x42f597(++_0x5ecee6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 88def32..d8d3e48 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 _0x24ba=['newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate'];(function(_0x2d585b,_0x3ae9f6){var _0x4a8321=function(_0x1e0aaf){while(--_0x1e0aaf){_0x2d585b['push'](_0x2d585b['shift']());}};_0x4a8321(++_0x3ae9f6);}(_0x24ba,0x15b));var _0xa24b=function(_0x29057b,_0xefa313){_0x29057b=_0x29057b-0x0;var _0x4fc5c7=_0x24ba[_0x29057b];return _0x4fc5c7;};'use strict';var util=require(_0xa24b('0x0'));var _=require('lodash');var BPromise=require(_0xa24b('0x1'));var uuid=require('uuid');var moment=require(_0xa24b('0x2'));var path=require(_0xa24b('0x3'));var tiff2pdf=require(_0xa24b('0x4'));var gs=require(_0xa24b('0x5'));var logger=require(_0xa24b('0x6'))(_0xa24b('0x7'));var ami=require(_0xa24b('0x8'));var rpcDb=require(_0xa24b('0x9'));var Channel=require(_0xa24b('0xa'));var ut=require(_0xa24b('0xb'));var Action=require('./action');var faxAccount=require(_0xa24b('0xc'));var attachment=require(_0xa24b('0xd'));var faxMessage=require(_0xa24b('0xe'));function Fax(_0x533d85){this[_0xa24b('0xf')]={};this[_0xa24b('0x10')]=_0x533d85['faxAccounts'];this[_0xa24b('0x11')]=_0x533d85[_0xa24b('0x11')];this[_0xa24b('0x12')]={};ami['on'](_0xa24b('0x13'),this[_0xa24b('0x14')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x16'),this[_0xa24b('0x17')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xa24b('0x19'),this[_0xa24b('0x1a')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x1b'),this['syncFaxStatus'][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x1c'),this[_0xa24b('0x1d')][_0xa24b('0x15')](this));ami['on']('hangup',this[_0xa24b('0x1e')]['bind'](this));ami['on'](_0xa24b('0x1f'),this['syncOriginateResponse'][_0xa24b('0x15')](this));}Fax[_0xa24b('0x20')][_0xa24b('0x14')]=function(_0x240aaa){if(_0x240aaa[_0xa24b('0x21')]==='from-voip-provider'){for(var _0x3978dc in this[_0xa24b('0x10')]){if(this[_0xa24b('0x10')][_0xa24b('0x22')](_0x3978dc)){if(_0x240aaa[_0xa24b('0x23')]===this['faxAccounts'][_0x3978dc][_0xa24b('0x24')]){this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]={};this['channels'][_0x240aaa[_0xa24b('0x25')]][_0xa24b('0x26')]=_0x240aaa['channel'];this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]['id']=this[_0xa24b('0x10')][_0x3978dc]['id'];this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]['name']=this['faxAccounts'][_0x3978dc][_0xa24b('0x27')];logger[_0xa24b('0x28')](_0x240aaa[_0xa24b('0x25')],_0xa24b('0x29'));}}}}if(this[_0xa24b('0x12')][_0x240aaa[_0xa24b('0x25')]]){this['channels'][_0x240aaa['uniqueid']]={};this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]][_0xa24b('0x26')]=_0x240aaa[_0xa24b('0x26')];logger['info'](_0x240aaa[_0xa24b('0x25')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xa24b('0x17')]=function(_0x5c8851){if(this[_0xa24b('0xf')][_0x5c8851[_0xa24b('0x25')]]){for(var _0x4975ab in _0x5c8851['variable']){if(_0x5c8851[_0xa24b('0x2a')][_0xa24b('0x22')](_0x4975ab)){this[_0xa24b('0xf')][_0x5c8851[_0xa24b('0x25')]][_0x4975ab]=_0x5c8851[_0xa24b('0x2b')];}}}};Fax[_0xa24b('0x20')][_0xa24b('0x2c')]=function(_0x28b09b){if(this[_0xa24b('0xf')][_0x28b09b['uniqueid']]){this['channels'][_0x28b09b[_0xa24b('0x25')]][_0xa24b('0x2d')]=_0x28b09b[_0xa24b('0x2d')];this[_0xa24b('0xf')][_0x28b09b[_0xa24b('0x25')]][_0xa24b('0x2e')]=_0x28b09b[_0xa24b('0x2e')];}};Fax[_0xa24b('0x20')][_0xa24b('0x1a')]=function(_0x43472e){if(this[_0xa24b('0xf')][_0x43472e[_0xa24b('0x25')]]){for(var _0x13a644 in _0x43472e[_0xa24b('0x2a')]){if(_0x43472e[_0xa24b('0x2a')][_0xa24b('0x22')](_0x13a644)){this['channels'][_0x43472e[_0xa24b('0x25')]][_0x13a644]=_0x43472e['value'];}}}};Fax[_0xa24b('0x20')]['syncFaxStatus']=function(_0x455d3c){if(this[_0xa24b('0xf')][_0x455d3c['uniqueid']]){this['channels'][_0x455d3c[_0xa24b('0x25')]][_0xa24b('0x2f')]=_0x455d3c[_0xa24b('0x2f')];this['channels'][_0x455d3c[_0xa24b('0x25')]]['status']=_0x455d3c['status'];this['channels'][_0x455d3c[_0xa24b('0x25')]][_0xa24b('0x24')]=_0x455d3c[_0xa24b('0x24')];this[_0xa24b('0xf')][_0x455d3c['uniqueid']][_0xa24b('0x30')]=_0x455d3c[_0xa24b('0x30')];logger[_0xa24b('0x28')](_0x455d3c[_0xa24b('0x25')],_0xa24b('0x31'));}};Fax['prototype'][_0xa24b('0x1d')]=function(_0x4fb01b){var _0x3910cd=this;if(this['channels'][_0x4fb01b[_0xa24b('0x25')]]){var _0x7857a3=this['channels'][_0x4fb01b[_0xa24b('0x25')]]['id'];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x32')]=_0x4fb01b[_0xa24b('0x32')];this[_0xa24b('0xf')][_0x4fb01b['uniqueid']][_0xa24b('0x33')]=_0x4fb01b[_0xa24b('0x33')];this[_0xa24b('0xf')][_0x4fb01b['uniqueid']]['localstationid']=_0x4fb01b[_0xa24b('0x24')];this['channels'][_0x4fb01b['uniqueid']]['resolution']=_0x4fb01b[_0xa24b('0x34')];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x35')]=_0x4fb01b[_0xa24b('0x35')];this['channels'][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x30')]=_0x4fb01b[_0xa24b('0x30')];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x36')]=_0x4fb01b[_0xa24b('0x36')];if(this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x4fb01b[_0xa24b('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x2738cb){logger[_0xa24b('0x28')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x37'),_0x2738cb[_0xa24b('0x38')]);attachment[_0xa24b('0x39')]({'name':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])['name'],'basename':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])[_0xa24b('0x27')]+_0xa24b('0x3b'),'type':'application/pdf'})[_0xa24b('0x3c')](function(_0x31c3f9){faxAccount[_0xa24b('0x3d')](_0x7857a3,{'from':_0x4fb01b[_0xa24b('0x36')],'mapKey':'fax','body':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])[_0xa24b('0x27')]+_0xa24b('0x3b'),'AttachmentId':_0x31c3f9['id']})['catch'](function(_0x1e9b06){logger[_0xa24b('0x3e')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x3f'),JSON[_0xa24b('0x40')](_0x1e9b06));});})[_0xa24b('0x41')](function(_0x8c3df8){logger[_0xa24b('0x3e')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x42'),JSON[_0xa24b('0x40')](_0x8c3df8));});});}logger[_0xa24b('0x28')](_0x4fb01b['uniqueid'],_0xa24b('0x42'));}};Fax[_0xa24b('0x20')][_0xa24b('0x43')]=function(_0x3d73a4){if(this[_0xa24b('0x12')][_0x3d73a4['uniqueid']]){_[_0xa24b('0x44')](this['channels'][_0x3d73a4[_0xa24b('0x25')]],_[_0xa24b('0x45')](_0x3d73a4,[_0xa24b('0x46'),_0xa24b('0x47')]));}};function updateStatus(_0x3eb125){if(_0x3eb125[_0xa24b('0x48')]){faxMessage[_0xa24b('0x49')](_0x3eb125[_0xa24b('0x48')],{'failMessage':_0xa24b('0x4a')})['then'](function(_0x477567){ut[_0xa24b('0x4b')](_0xa24b('0x4c'),_0x477567);})['catch'](function(_0xc16e1){ut[_0xa24b('0x4b')](_0xa24b('0x4d'),_0xc16e1);});}else{ut[_0xa24b('0x4b')](_0xa24b('0x4e'));}}Fax[_0xa24b('0x20')]['updateStatus']=function(_0x36cf5c,_0x39a448,_0x5bc94c){var _0x597d32=this;var _0x19ba33={};if(_0x39a448){_0x19ba33={'read':_0x39a448};}else{_0x19ba33={'failMessage':_0x5bc94c};}if(this[_0xa24b('0x12')][_0x36cf5c][_0xa24b('0x48')]){faxMessage[_0xa24b('0x49')](this[_0xa24b('0x12')][_0x36cf5c]['AttachmentId'],_0x19ba33)['then'](function(_0x2feab3){ut[_0xa24b('0x4b')](_0xa24b('0x4f'),_0x2feab3);})[_0xa24b('0x41')](function(_0x508ffc){ut['logger'](_0xa24b('0x50'),_0x508ffc);})[_0xa24b('0x51')](function(){delete _0x597d32[_0xa24b('0xf')][_0x36cf5c];delete _0x597d32[_0xa24b('0x12')][_0x36cf5c];});}else{ut[_0xa24b('0x4b')](_0xa24b('0x52'));this['deleteChannelAfterTimeout'](_0x36cf5c);delete this[_0xa24b('0x12')][_0x36cf5c];}};Fax[_0xa24b('0x20')]['syncHangup']=function(_0x2df0c9){var _0x2c0b9b=this;if(this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]){if(this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]]){this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]['id']=this['actions'][_0x2df0c9[_0xa24b('0x25')]]['id'];this['channels'][_0x2df0c9['uniqueid']][_0xa24b('0x27')]=this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x27')];}logger['info'](_0x2df0c9[_0xa24b('0x25')],this['actions'][_0x2df0c9[_0xa24b('0x25')]]?'\x20hangup\x20sendFile\x20':_0xa24b('0x53'),JSON[_0xa24b('0x40')](this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]));if(this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]]){if(this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x54')]>0x0&&this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x1b')]===_0xa24b('0x55')){this['updateStatus'](_0x2df0c9['uniqueid'],!![]);}else{this[_0xa24b('0x56')](_0x2df0c9[_0xa24b('0x25')],![],this['channels'][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x57')]?_0xa24b('0x58')+this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0xa24b('0x20')]['send']=function(_0x398cf1){var _0x22ada6=this;return new BPromise(function(_0x3d46eb,_0x2465e3){_0x22ada6[_0xa24b('0x59')](_0x398cf1,_0x22ada6[_0xa24b('0x10')][_0x398cf1[_0xa24b('0x5a')]])[_0xa24b('0x3c')](function(_0x499fd9){ut[_0xa24b('0x4b')](_0xa24b('0x5b'),_0x499fd9);_0x3d46eb(ut[_0xa24b('0x38')](_0xa24b('0x5c')));})[_0xa24b('0x41')](function(_0x53f664){ut[_0xa24b('0x4b')](_0xa24b('0x5d'),_0x53f664);updateStatus(_0x398cf1);_0x2465e3(ut[_0xa24b('0x38')](_0xa24b('0x5e')));});});};Fax[_0xa24b('0x20')]['checkAfterSend']=function(_0x4b2610){var _0x9a9030=this;return new BPromise(function(_0x84731,_0x4b39aa){var _0xab1bf2=_0x9a9030[_0xa24b('0x5f')](_0x9a9030['faxAccounts'][_0x4b2610[_0xa24b('0x5a')]][_0xa24b('0x60')],_0x4b2610);if(_0xab1bf2[_0xa24b('0x61')]){_0x84731(ut[_0xa24b('0x38')](_0xa24b('0x62')));}else{_0x4b39aa(ut['message'](_0xab1bf2[_0xa24b('0x38')]));}});};function originate(_0x445bba,_0x1b2b1a,_0x137116){return new BPromise(function(_0x4a8b4d,_0x1edcec){if(_0x137116){var _0x5d5ace=util['format'](_0xa24b('0x63'),path[_0xa24b('0x3a')](_0x445bba[_0xa24b('0x3')])[_0xa24b('0x27')],_0x445bba[_0xa24b('0x3')]);gs[_0xa24b('0x64')](_0x5d5ace)['then'](function(){_0x445bba[_0xa24b('0x3')]=util[_0xa24b('0x65')]('%s/%s.tif',path[_0xa24b('0x3a')](_0x445bba['path'])[_0xa24b('0x66')],path[_0xa24b('0x3a')](_0x445bba[_0xa24b('0x3')])[_0xa24b('0x27')]);_0x1b2b1a[_0xa24b('0x67')]=_0x445bba[_0xa24b('0x3')];ut[_0xa24b('0x4b')](_0xa24b('0x68'),'');ami[_0xa24b('0x69')](ut['variablesAction'](_0x445bba,_0x1b2b1a))[_0xa24b('0x3c')](function(_0x3c5016){_0x4a8b4d(_0x3c5016);})[_0xa24b('0x41')](function(_0xab9c15){_0x1edcec(_0xab9c15);});})[_0xa24b('0x41')](function(_0x18fb08){_0x1edcec(_0x18fb08);});}else{ami[_0xa24b('0x69')](ut[_0xa24b('0x6a')](_0x445bba,_0x1b2b1a))[_0xa24b('0x3c')](function(_0x17f284){_0x4a8b4d(_0x17f284);})[_0xa24b('0x41')](function(_0x3d6127){_0x1edcec(_0x3d6127);});}});}Fax['prototype'][_0xa24b('0x59')]=function(_0x52fb05,_0x5b1a87){var _0x2c2b86=this;return new BPromise(function(_0x1427eb,_0x990674){var _0x56b426=uuid['v4']();var _0x17287e=ut[_0xa24b('0x6b')](_0x52fb05,_0x5b1a87);_0x2c2b86[_0xa24b('0x12')][_0x56b426]=new Action(_0x56b426,_0x5b1a87,_0x52fb05);var _0x227169=_0x2c2b86[_0xa24b('0x12')][_0x56b426];if(path[_0xa24b('0x3a')](_0x52fb05[_0xa24b('0x3')])['ext']===_0xa24b('0x3b')){originate(_0x227169,_0x17287e,!![])[_0xa24b('0x3c')](function(_0x16be4a){_0x1427eb(_0x16be4a);})['catch'](function(_0x349488){_0x990674(_0x349488);});}else{originate(_0x227169,_0x17287e,![])[_0xa24b('0x3c')](function(_0x236688){_0x1427eb(_0x236688);})[_0xa24b('0x41')](function(_0x4ac8cd){_0x990674(_0x4ac8cd);});}});};Fax['prototype'][_0xa24b('0x6c')]=function(_0x1535fa){return!_[_0xa24b('0x6d')](_0x1535fa)&&!_[_0xa24b('0x6d')](_0x1535fa['name'])&&!_[_0xa24b('0x6d')](_0x1535fa['active'])&&_0x1535fa[_0xa24b('0x6e')]&&!_[_0xa24b('0x6d')](this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])])&&!_['isNil'](this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])]['status'])&&(this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])][_0xa24b('0x70')]===_0xa24b('0x71')||this['trunks'][util['format'](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])][_0xa24b('0x70')]===_0xa24b('0x72'));};Fax['prototype'][_0xa24b('0x5f')]=function(_0x33ce77,_0x1f7166){if(!this[_0xa24b('0x6c')](_0x33ce77)){ut['logger'](_0xa24b('0x73'),_[_0xa24b('0x6d')](_0x33ce77)?'':_0x33ce77[_0xa24b('0x27')]+_0xa24b('0x74'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xa24b('0x6d')](_0x1f7166[_0xa24b('0x7')])){ut[_0xa24b('0x4b')](_0xa24b('0x75'),JSON[_0xa24b('0x40')](_0x1f7166));return{'isValid':![],'message':_0xa24b('0x76')};}if(_['isNil'](_0x1f7166['path'])){ut['logger'](_0xa24b('0x77'),JSON[_0xa24b('0x40')](_0x1f7166));return{'isValid':![],'message':_0xa24b('0x78')};}return{'isValid':!![],'message':_0xa24b('0x79')};};Fax[_0xa24b('0x20')][_0xa24b('0x7a')]=function(_0x3c2b5d,_0x422e2a=0x2710){if(this[_0xa24b('0xf')][_0x3c2b5d]){setTimeout(()=>{delete this['channels'][_0x3c2b5d];},_0x422e2a);}};module[_0xa24b('0x7b')]=Fax; \ No newline at end of file +var _0x82e3=['tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','calleridnum','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','isValid','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','path'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x82e3,0x153));var _0x382e=function(_0x4ae89d,_0x5af74b){_0x4ae89d=_0x4ae89d-0x0;var _0x411fd7=_0x82e3[_0x4ae89d];return _0x411fd7;};'use strict';var util=require(_0x382e('0x0'));var _=require(_0x382e('0x1'));var BPromise=require(_0x382e('0x2'));var uuid=require(_0x382e('0x3'));var moment=require(_0x382e('0x4'));var path=require(_0x382e('0x5'));var tiff2pdf=require(_0x382e('0x6'));var gs=require(_0x382e('0x7'));var logger=require(_0x382e('0x8'))(_0x382e('0x9'));var ami=require(_0x382e('0xa'));var rpcDb=require('./rpcDb');var Channel=require(_0x382e('0xb'));var ut=require(_0x382e('0xc'));var Action=require(_0x382e('0xd'));var faxAccount=require(_0x382e('0xe'));var attachment=require(_0x382e('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x4ca0c5){this[_0x382e('0x10')]={};this['faxAccounts']=_0x4ca0c5[_0x382e('0x11')];this[_0x382e('0x12')]=_0x4ca0c5[_0x382e('0x12')];this[_0x382e('0x13')]={};ami['on'](_0x382e('0x14'),this['syncNewchannel']['bind'](this));ami['on'](_0x382e('0x15'),this[_0x382e('0x16')][_0x382e('0x17')](this));ami['on']('newstate',this[_0x382e('0x18')][_0x382e('0x17')](this));ami['on']('newexten',this[_0x382e('0x19')][_0x382e('0x17')](this));ami['on'](_0x382e('0x1a'),this[_0x382e('0x1b')][_0x382e('0x17')](this));ami['on']('receivefax',this[_0x382e('0x1c')][_0x382e('0x17')](this));ami['on']('hangup',this[_0x382e('0x1d')][_0x382e('0x17')](this));ami['on'](_0x382e('0x1e'),this[_0x382e('0x1f')][_0x382e('0x17')](this));}Fax[_0x382e('0x20')][_0x382e('0x21')]=function(_0x4c5e6c){if(_0x4c5e6c[_0x382e('0x22')]===_0x382e('0x23')){for(var _0x5cf2cc in this['faxAccounts']){if(this[_0x382e('0x11')][_0x382e('0x24')](_0x5cf2cc)){if(_0x4c5e6c[_0x382e('0x25')]===this[_0x382e('0x11')][_0x5cf2cc]['localstationid']){this[_0x382e('0x10')][_0x4c5e6c[_0x382e('0x26')]]={};this[_0x382e('0x10')][_0x4c5e6c['uniqueid']][_0x382e('0x27')]=_0x4c5e6c['channel'];this[_0x382e('0x10')][_0x4c5e6c[_0x382e('0x26')]]['id']=this[_0x382e('0x11')][_0x5cf2cc]['id'];this[_0x382e('0x10')][_0x4c5e6c['uniqueid']]['name']=this['faxAccounts'][_0x5cf2cc][_0x382e('0x28')];logger[_0x382e('0x29')](_0x4c5e6c['uniqueid'],_0x382e('0x2a'));}}}}if(this[_0x382e('0x13')][_0x4c5e6c[_0x382e('0x26')]]){this['channels'][_0x4c5e6c[_0x382e('0x26')]]={};this[_0x382e('0x10')][_0x4c5e6c[_0x382e('0x26')]]['channel']=_0x4c5e6c[_0x382e('0x27')];logger[_0x382e('0x29')](_0x4c5e6c['uniqueid'],_0x382e('0x2a'));}};Fax[_0x382e('0x20')][_0x382e('0x16')]=function(_0x1981c4){if(this['channels'][_0x1981c4[_0x382e('0x26')]]){for(var _0x3d2bfe in _0x1981c4['variable']){if(_0x1981c4[_0x382e('0x2b')][_0x382e('0x24')](_0x3d2bfe)){this[_0x382e('0x10')][_0x1981c4[_0x382e('0x26')]][_0x3d2bfe]=_0x1981c4[_0x382e('0x2c')];}}}};Fax[_0x382e('0x20')]['syncNewState']=function(_0xda6576){if(this[_0x382e('0x10')][_0xda6576[_0x382e('0x26')]]){this['channels'][_0xda6576[_0x382e('0x26')]][_0x382e('0x2d')]=_0xda6576[_0x382e('0x2d')];this[_0x382e('0x10')][_0xda6576[_0x382e('0x26')]][_0x382e('0x2e')]=_0xda6576[_0x382e('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x4d4b6e){if(this[_0x382e('0x10')][_0x4d4b6e['uniqueid']]){for(var _0x4c2d67 in _0x4d4b6e[_0x382e('0x2b')]){if(_0x4d4b6e['variable']['hasOwnProperty'](_0x4c2d67)){this[_0x382e('0x10')][_0x4d4b6e[_0x382e('0x26')]][_0x4c2d67]=_0x4d4b6e[_0x382e('0x2c')];}}}};Fax[_0x382e('0x20')]['syncFaxStatus']=function(_0x438b3d){if(this[_0x382e('0x10')][_0x438b3d[_0x382e('0x26')]]){this[_0x382e('0x10')][_0x438b3d[_0x382e('0x26')]]['operation']=_0x438b3d[_0x382e('0x2f')];this[_0x382e('0x10')][_0x438b3d[_0x382e('0x26')]][_0x382e('0x30')]=_0x438b3d[_0x382e('0x30')];this[_0x382e('0x10')][_0x438b3d['uniqueid']][_0x382e('0x31')]=_0x438b3d[_0x382e('0x31')];this[_0x382e('0x10')][_0x438b3d[_0x382e('0x26')]][_0x382e('0x32')]=_0x438b3d[_0x382e('0x32')];logger[_0x382e('0x29')](_0x438b3d[_0x382e('0x26')],_0x382e('0x33'));}};Fax['prototype'][_0x382e('0x1c')]=function(_0x474e29){var _0x23f468=this;if(this[_0x382e('0x10')][_0x474e29['uniqueid']]){var _0x23af6f=this[_0x382e('0x10')][_0x474e29[_0x382e('0x26')]]['id'];this[_0x382e('0x10')][_0x474e29[_0x382e('0x26')]][_0x382e('0x34')]=_0x474e29[_0x382e('0x34')];this[_0x382e('0x10')][_0x474e29[_0x382e('0x26')]][_0x382e('0x35')]=_0x474e29[_0x382e('0x35')];this[_0x382e('0x10')][_0x474e29['uniqueid']]['localstationid']=_0x474e29['localstationid'];this[_0x382e('0x10')][_0x474e29[_0x382e('0x26')]][_0x382e('0x36')]=_0x474e29['resolution'];this['channels'][_0x474e29[_0x382e('0x26')]][_0x382e('0x37')]=_0x474e29['transferrate'];this[_0x382e('0x10')][_0x474e29['uniqueid']][_0x382e('0x32')]=_0x474e29[_0x382e('0x32')];this[_0x382e('0x10')][_0x474e29[_0x382e('0x26')]]['calleridnum']=_0x474e29['calleridnum'];if(this['channels'][_0x474e29[_0x382e('0x26')]][_0x382e('0x35')]>0x0){tiff2pdf(_0x474e29[_0x382e('0x32')],_0x382e('0x38'),function(_0x1ca745){logger[_0x382e('0x29')](_0x474e29[_0x382e('0x26')],_0x382e('0x39'),_0x1ca745[_0x382e('0x3a')]);attachment[_0x382e('0x3b')]({'name':path[_0x382e('0x3c')](_0x474e29['filename'])[_0x382e('0x28')],'basename':path[_0x382e('0x3c')](_0x474e29[_0x382e('0x32')])[_0x382e('0x28')]+_0x382e('0x3d'),'type':'application/pdf'})[_0x382e('0x3e')](function(_0x2d4a63){faxAccount['notify'](_0x23af6f,{'from':_0x474e29[_0x382e('0x3f')],'mapKey':'fax','body':path[_0x382e('0x3c')](_0x474e29[_0x382e('0x32')])[_0x382e('0x28')]+_0x382e('0x3d'),'AttachmentId':_0x2d4a63['id']})['catch'](function(_0x527837){logger[_0x382e('0x40')](_0x474e29[_0x382e('0x26')],_0x382e('0x41'),JSON[_0x382e('0x42')](_0x527837));});})[_0x382e('0x43')](function(_0x3f687d){logger[_0x382e('0x40')](_0x474e29[_0x382e('0x26')],_0x382e('0x44'),JSON[_0x382e('0x42')](_0x3f687d));});});}logger['info'](_0x474e29[_0x382e('0x26')],_0x382e('0x44'));}};Fax['prototype'][_0x382e('0x1f')]=function(_0x47a011){if(this[_0x382e('0x13')][_0x47a011['uniqueid']]){_[_0x382e('0x45')](this[_0x382e('0x10')][_0x47a011[_0x382e('0x26')]],_['pick'](_0x47a011,[_0x382e('0x46'),_0x382e('0x47')]));}};function updateStatus(_0x2fe5d7){if(_0x2fe5d7['AttachmentId']){faxMessage[_0x382e('0x48')](_0x2fe5d7[_0x382e('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x382e('0x3e')](function(_0x5185fa){ut[_0x382e('0x4a')](_0x382e('0x4b'),_0x5185fa);})['catch'](function(_0x38212e){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x38212e);});}else{ut[_0x382e('0x4a')](_0x382e('0x4c'));}}Fax[_0x382e('0x20')][_0x382e('0x4d')]=function(_0x173118,_0x7056ab,_0x4595fe){var _0x1281b0=this;var _0x13b3e0={};if(_0x7056ab){_0x13b3e0={'read':_0x7056ab};}else{_0x13b3e0={'failMessage':_0x4595fe};}if(this[_0x382e('0x13')][_0x173118][_0x382e('0x49')]){faxMessage[_0x382e('0x48')](this[_0x382e('0x13')][_0x173118]['AttachmentId'],_0x13b3e0)[_0x382e('0x3e')](function(_0x17fbad){ut['logger'](_0x382e('0x4e'),_0x17fbad);})[_0x382e('0x43')](function(_0xf9454a){ut[_0x382e('0x4a')]('[Fax][Message][NoUpdate1]',_0xf9454a);})[_0x382e('0x4f')](function(){delete _0x1281b0['channels'][_0x173118];delete _0x1281b0[_0x382e('0x13')][_0x173118];});}else{ut[_0x382e('0x4a')](_0x382e('0x50'));this['deleteChannelAfterTimeout'](_0x173118);delete this['actions'][_0x173118];}};Fax[_0x382e('0x20')][_0x382e('0x1d')]=function(_0x1e7fe1){var _0x4f98eb=this;if(this[_0x382e('0x10')][_0x1e7fe1[_0x382e('0x26')]]){if(this[_0x382e('0x13')][_0x1e7fe1[_0x382e('0x26')]]){this[_0x382e('0x10')][_0x1e7fe1['uniqueid']]['id']=this[_0x382e('0x13')][_0x1e7fe1[_0x382e('0x26')]]['id'];this[_0x382e('0x10')][_0x1e7fe1[_0x382e('0x26')]][_0x382e('0x28')]=this['actions'][_0x1e7fe1['uniqueid']]['name'];}logger[_0x382e('0x29')](_0x1e7fe1[_0x382e('0x26')],this['actions'][_0x1e7fe1[_0x382e('0x26')]]?_0x382e('0x51'):_0x382e('0x52'),JSON[_0x382e('0x42')](this[_0x382e('0x10')][_0x1e7fe1['uniqueid']]));if(this[_0x382e('0x13')][_0x1e7fe1[_0x382e('0x26')]]){if(this['channels'][_0x1e7fe1[_0x382e('0x26')]][_0x382e('0x53')]>0x0&&this['channels'][_0x1e7fe1[_0x382e('0x26')]][_0x382e('0x1a')]==='SUCCESS'){this[_0x382e('0x4d')](_0x1e7fe1[_0x382e('0x26')],!![]);}else{this[_0x382e('0x4d')](_0x1e7fe1[_0x382e('0x26')],![],this['channels'][_0x1e7fe1['uniqueid']]['faxstatusstring']?_0x382e('0x54')+this[_0x382e('0x10')][_0x1e7fe1['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x382e('0x20')][_0x382e('0x55')]=function(_0x2dbb52){var _0x4cc82a=this;return new BPromise(function(_0x544131,_0xeccb52){_0x4cc82a[_0x382e('0x56')](_0x2dbb52,_0x4cc82a[_0x382e('0x11')][_0x2dbb52['FaxAccountId']])[_0x382e('0x3e')](function(_0x2650e5){ut[_0x382e('0x4a')](_0x382e('0x57'),_0x2650e5);_0x544131(ut['message'](_0x382e('0x58')));})[_0x382e('0x43')](function(_0x244446){ut['logger'](_0x382e('0x59'),_0x244446);updateStatus(_0x2dbb52);_0xeccb52(ut[_0x382e('0x3a')]('Fax\x20failed'));});});};Fax[_0x382e('0x20')]['checkAfterSend']=function(_0x360283){var _0x8e47b8=this;return new BPromise(function(_0x51c874,_0x39a77c){var _0x202784=_0x8e47b8['checkTrunk'](_0x8e47b8[_0x382e('0x11')][_0x360283['FaxAccountId']]['Trunk'],_0x360283);if(_0x202784[_0x382e('0x5a')]){_0x51c874(ut['message']('Trunk\x20Reachable'));}else{_0x39a77c(ut['message'](_0x202784[_0x382e('0x3a')]));}});};function originate(_0x5d2b7f,_0x26222f,_0x198368){return new BPromise(function(_0x8325bb,_0x539d98){if(_0x198368){var _0x4fe2e0=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[_0x382e('0x3c')](_0x5d2b7f[_0x382e('0x5')])[_0x382e('0x28')],_0x5d2b7f[_0x382e('0x5')]);gs[_0x382e('0x5b')](_0x4fe2e0)[_0x382e('0x3e')](function(){_0x5d2b7f[_0x382e('0x5')]=util['format'](_0x382e('0x5c'),path[_0x382e('0x3c')](_0x5d2b7f[_0x382e('0x5')])['dir'],path['parse'](_0x5d2b7f['path'])[_0x382e('0x28')]);_0x26222f['XMF-PATH']=_0x5d2b7f[_0x382e('0x5')];ut[_0x382e('0x4a')](_0x382e('0x5d'),'');ami[_0x382e('0x5e')](ut[_0x382e('0x5f')](_0x5d2b7f,_0x26222f))[_0x382e('0x3e')](function(_0xfb96f){_0x8325bb(_0xfb96f);})[_0x382e('0x43')](function(_0x5ee89a){_0x539d98(_0x5ee89a);});})[_0x382e('0x43')](function(_0x1a60e2){_0x539d98(_0x1a60e2);});}else{ami[_0x382e('0x5e')](ut[_0x382e('0x5f')](_0x5d2b7f,_0x26222f))[_0x382e('0x3e')](function(_0x51f561){_0x8325bb(_0x51f561);})[_0x382e('0x43')](function(_0x2365d4){_0x539d98(_0x2365d4);});}});}Fax[_0x382e('0x20')][_0x382e('0x56')]=function(_0x22ee51,_0x150c2d){var _0x117883=this;return new BPromise(function(_0x5f0e5d,_0x1be847){var _0x26b1cf=uuid['v4']();var _0x159740=ut[_0x382e('0x60')](_0x22ee51,_0x150c2d);_0x117883[_0x382e('0x13')][_0x26b1cf]=new Action(_0x26b1cf,_0x150c2d,_0x22ee51);var _0x1c2ba5=_0x117883['actions'][_0x26b1cf];if(path[_0x382e('0x3c')](_0x22ee51[_0x382e('0x5')])[_0x382e('0x61')]===_0x382e('0x3d')){originate(_0x1c2ba5,_0x159740,!![])[_0x382e('0x3e')](function(_0x2af602){_0x5f0e5d(_0x2af602);})[_0x382e('0x43')](function(_0x404325){_0x1be847(_0x404325);});}else{originate(_0x1c2ba5,_0x159740,![])[_0x382e('0x3e')](function(_0x515612){_0x5f0e5d(_0x515612);})['catch'](function(_0x11e163){_0x1be847(_0x11e163);});}});};Fax['prototype'][_0x382e('0x62')]=function(_0x347659){return!_[_0x382e('0x63')](_0x347659)&&!_[_0x382e('0x63')](_0x347659[_0x382e('0x28')])&&!_[_0x382e('0x63')](_0x347659[_0x382e('0x64')])&&_0x347659[_0x382e('0x64')]&&!_[_0x382e('0x63')](this[_0x382e('0x12')][util[_0x382e('0x65')](_0x382e('0x66'),_0x347659['name'])])&&!_[_0x382e('0x63')](this['trunks'][util[_0x382e('0x65')]('SIP/%s',_0x347659['name'])][_0x382e('0x30')])&&(this[_0x382e('0x12')][util[_0x382e('0x65')](_0x382e('0x66'),_0x347659[_0x382e('0x28')])][_0x382e('0x30')]===_0x382e('0x67')||this[_0x382e('0x12')][util['format']('SIP/%s',_0x347659[_0x382e('0x28')])]['status']===_0x382e('0x68'));};Fax[_0x382e('0x20')][_0x382e('0x69')]=function(_0x26c660,_0x36e894){if(!this[_0x382e('0x62')](_0x26c660)){ut['logger'](_0x382e('0x6a'),_[_0x382e('0x63')](_0x26c660)?'':_0x26c660['name']+_0x382e('0x6b'));return{'isValid':![],'message':_0x382e('0x6c')};}if(_[_0x382e('0x63')](_0x36e894[_0x382e('0x9')])){ut[_0x382e('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x382e('0x42')](_0x36e894));return{'isValid':![],'message':_0x382e('0x6d')};}if(_[_0x382e('0x63')](_0x36e894[_0x382e('0x5')])){ut[_0x382e('0x4a')](_0x382e('0x6e'),JSON['stringify'](_0x36e894));return{'isValid':![],'message':_0x382e('0x6f')};}return{'isValid':!![],'message':_0x382e('0x70')};};Fax['prototype'][_0x382e('0x71')]=function(_0x3bb66e,_0x26767e=0x2710){if(this['channels'][_0x3bb66e]){setTimeout(()=>{delete this['channels'][_0x3bb66e];},_0x26767e);}};module[_0x382e('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5489302..483fa47 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 _0xea64=['notify','catch','util','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0xea64,0xd4));var _0x4ea6=function(_0x29e5b8,_0xeb28de){_0x29e5b8=_0x29e5b8-0x0;var _0x18bbac=_0xea64[_0x29e5b8];return _0x18bbac;};'use strict';var util=require(_0x4ea6('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x4ea6('0x1'));var _=require(_0x4ea6('0x2'));var faxAccount=require(_0x4ea6('0x3'));function loggerCatch(_0x337e94){return function(_0x27ccfd){logger[_0x4ea6('0x4')](_0x337e94,util[_0x4ea6('0x5')](_0x27ccfd,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x555d39,_0x14824c){return BPromise[_0x4ea6('0x6')]()[_0x4ea6('0x7')](faxAccount[_0x4ea6('0x8')](_0x555d39,_0x14824c))[_0x4ea6('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x1350=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','preview'];(function(_0x4d39b6,_0x4d5da5){var _0x3ce9d7=function(_0x5f5524){while(--_0x5f5524){_0x4d39b6['push'](_0x4d39b6['shift']());}};_0x3ce9d7(++_0x4d5da5);}(_0x1350,0xbc));var _0x0135=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1350[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0135('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x0135('0x1'));var _=require(_0x0135('0x2'));var faxAccount=require(_0x0135('0x3'));function loggerCatch(_0x1db69c){return function(_0x2db015){logger[_0x0135('0x4')](_0x1db69c,util[_0x0135('0x5')](_0x2db015,{'showHidden':![],'depth':null}));};}exports[_0x0135('0x6')]=function(_0x149d6f,_0x5df374){return BPromise[_0x0135('0x7')]()[_0x0135('0x8')](faxAccount[_0x0135('0x6')](_0x149d6f,_0x5df374))['catch'](loggerCatch(_0x0135('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 907494e..bb8d080 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 _0x7ef2=['fax','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x4a6e77,_0x4a677c){var _0x1c137e=function(_0x3ecd59){while(--_0x3ecd59){_0x4a6e77['push'](_0x4a6e77['shift']());}};_0x1c137e(++_0x4a677c);}(_0x7ef2,0x1e4));var _0x27ef=function(_0x202201,_0x13db5b){_0x202201=_0x202201-0x0;var _0x19f36f=_0x7ef2[_0x202201];return _0x19f36f;};'use strict';var util=require(_0x27ef('0x0'));var logger=require(_0x27ef('0x1'))(_0x27ef('0x2'));var BPromise=require(_0x27ef('0x3'));var exec=require(_0x27ef('0x4'))['exec'];exports['execute']=function(_0x2daa88){return new BPromise(function(_0x9abea1,_0x5518be){exec(_0x2daa88,function(_0x559176,_0x20be11,_0xf227b8){logger[_0x27ef('0x5')](_0x27ef('0x6'),_0x20be11);if(_0x559176){logger[_0x27ef('0x5')](_0x27ef('0x6'),_0x27ef('0x7'),util[_0x27ef('0x8')](_0x559176,{'showHidden':![],'depth':null}),_0x20be11,_0xf227b8);_0x5518be(_0x559176);}_0x9abea1(_0x20be11);});});}; \ No newline at end of file +var _0x739d=['fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger'];(function(_0x8bc3e7,_0x108423){var _0x392c45=function(_0x8e21a2){while(--_0x8e21a2){_0x8bc3e7['push'](_0x8bc3e7['shift']());}};_0x392c45(++_0x108423);}(_0x739d,0x6a));var _0xd739=function(_0xe4c48b,_0x3c6790){_0xe4c48b=_0xe4c48b-0x0;var _0x51872b=_0x739d[_0xe4c48b];return _0x51872b;};'use strict';var util=require(_0xd739('0x0'));var logger=require(_0xd739('0x1'))(_0xd739('0x2'));var BPromise=require(_0xd739('0x3'));var exec=require(_0xd739('0x4'))[_0xd739('0x5')];exports['execute']=function(_0x2c0db2){return new BPromise(function(_0x5a0c3a,_0x3d30af){exec(_0x2c0db2,function(_0x213857,_0x274f09,_0x4c8b12){logger[_0xd739('0x6')](_0xd739('0x7'),_0x274f09);if(_0x213857){logger[_0xd739('0x6')](_0xd739('0x7'),_0xd739('0x8'),util['inspect'](_0x213857,{'showHidden':![],'depth':null}),_0x274f09,_0x4c8b12);_0x3d30af(_0x213857);}_0x5a0c3a(_0x274f09);});});}; \ 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 cfb9881..47c32a4 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 _0x6b60=['message','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','originate','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','lodash','../../../../config/logger','fax'];(function(_0x3e3e5e,_0x27ce4d){var _0x43a528=function(_0x4ced7d){while(--_0x4ced7d){_0x3e3e5e['push'](_0x3e3e5e['shift']());}};_0x43a528(++_0x27ce4d);}(_0x6b60,0x1be));var _0x06b6=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x6b60[_0x3fc97b];return _0x3a0c82;};'use strict';var util=require(_0x06b6('0x0'));var _=require(_0x06b6('0x1'));var moment=require('moment');var logger=require(_0x06b6('0x2'))(_0x06b6('0x3'));exports[_0x06b6('0x4')]=function(_0x15bdad){return{'message':_0x15bdad};};exports['logger']=function(_0x160af1,_0x501b34){logger['info'](_0x160af1,util[_0x06b6('0x5')](_0x501b34,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5a6ce4,_0x3085d1){var _0x119c0d={'XMF-ECM':_0x3085d1[_0x06b6('0x6')],'XMF-HEADERINFO':_0x3085d1['headerinfo'],'XMF-MINRATE':_0x3085d1[_0x06b6('0x7')],'XMF-MAXRATE':_0x3085d1[_0x06b6('0x8')],'XMF-MODEM':util[_0x06b6('0x9')](_0x06b6('0xa'),_0x3085d1[_0x06b6('0xb')]),'XMF-GATEWAY':_0x3085d1[_0x06b6('0xc')],'XMF-FAXDETECT':_0x3085d1['faxdetect'],'XMF-T38TIMEOUT':_0x3085d1['t38timeout'],'XMF-LOCALSTATIONID':_0x3085d1[_0x06b6('0xd')],'XMF-PATH':_0x5a6ce4['path']};return _0x119c0d;};exports['variablesAction']=function(_0x4d3d26,_0x168514){return{'actionid':_0x4d3d26['uniqueid'],'action':_0x06b6('0xe'),'channel':_0x4d3d26['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x06b6('0x9')](_0x06b6('0xf'),_0x4d3d26[_0x06b6('0x10')]?_0x4d3d26[_0x06b6('0x10')]:'',_0x4d3d26[_0x06b6('0xd')]),'variable':_0x168514,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d3d26[_0x06b6('0x11')]};}; \ No newline at end of file +var _0xe42e=['minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo'];(function(_0x2897db,_0x2f3a9f){var _0x526473=function(_0x4bf24f){while(--_0x4bf24f){_0x2897db['push'](_0x2897db['shift']());}};_0x526473(++_0x2f3a9f);}(_0xe42e,0x122));var _0xee42=function(_0x2814e8,_0x12ddbd){_0x2814e8=_0x2814e8-0x0;var _0x2d03cf=_0xe42e[_0x2814e8];return _0x2d03cf;};'use strict';var util=require(_0xee42('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xee42('0x1'))(_0xee42('0x2'));exports[_0xee42('0x3')]=function(_0x4694e1){return{'message':_0x4694e1};};exports[_0xee42('0x4')]=function(_0x5dc757,_0xa8ce90){logger[_0xee42('0x5')](_0x5dc757,util[_0xee42('0x6')](_0xa8ce90,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x152675,_0x16938c){var _0x677e1e={'XMF-ECM':_0x16938c[_0xee42('0x7')],'XMF-HEADERINFO':_0x16938c[_0xee42('0x8')],'XMF-MINRATE':_0x16938c[_0xee42('0x9')],'XMF-MAXRATE':_0x16938c[_0xee42('0xa')],'XMF-MODEM':util[_0xee42('0xb')](_0xee42('0xc'),_0x16938c['modem']),'XMF-GATEWAY':_0x16938c[_0xee42('0xd')],'XMF-FAXDETECT':_0x16938c[_0xee42('0xe')],'XMF-T38TIMEOUT':_0x16938c['t38timeout'],'XMF-LOCALSTATIONID':_0x16938c[_0xee42('0xf')],'XMF-PATH':_0x152675['path']};return _0x677e1e;};exports[_0xee42('0x10')]=function(_0x450b1e,_0x2f1da4){return{'actionid':_0x450b1e[_0xee42('0x11')],'action':_0xee42('0x12'),'channel':_0x450b1e[_0xee42('0x13')],'Exten':_0xee42('0x14'),'Context':_0xee42('0x15'),'Priority':'1','callerid':util[_0xee42('0xb')](_0xee42('0x16'),_0x450b1e[_0xee42('0x8')]?_0x450b1e['headerinfo']:'',_0x450b1e['localstationid']),'variable':_0x2f1da4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x450b1e[_0xee42('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a83ca47..497f2ec 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 _0x6b92=['inspect','moment','./realtime','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','listen','sync','catch','[index.js][main]'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x6b92,0x1cf));var _0x26b9=function(_0x144d3c,_0x1c8394){_0x144d3c=_0x144d3c-0x0;var _0x25af78=_0x6b92[_0x144d3c];return _0x25af78;};'use strict';var util=require('util');var moment=require(_0x26b9('0x0'));var server=require('./server');var Realtime=require(_0x26b9('0x1'));var Report=require('./report');var Acw=require(_0x26b9('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x26b9('0x3'));var Preview=require('./preview');var Fax=require(_0x26b9('0x4'));var user=require(_0x26b9('0x5'));var voiceQueue=require(_0x26b9('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x26b9('0x7'));var trigger=require(_0x26b9('0x8'));var template=require(_0x26b9('0x9'));var cmHopperHistory=require(_0x26b9('0xa'));var campaign=require(_0x26b9('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x26b9('0xc'));var zendesk=require(_0x26b9('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x26b9('0xe'));var freshdesk=require(_0x26b9('0xf'));var desk=require(_0x26b9('0x10'));var zoho=require(_0x26b9('0x11'));var vtiger=require(_0x26b9('0x12'));var freshsales=require(_0x26b9('0x13'));var servicenow=require(_0x26b9('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x26b9('0x15'))(_0x26b9('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x26b9('0x17')](_0x26b9('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x26b9('0x17')](_0x26b9('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x26b9('0x19')]()['then'](user[_0x26b9('0x1a')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x1c')]())[_0x26b9('0x1b')](user['getTelephones']())[_0x26b9('0x1b')](realtime['initTelephones']())['then'](trunk[_0x26b9('0x1d')]())[_0x26b9('0x1b')](realtime['initTrunks']())[_0x26b9('0x1b')](voiceQueue[_0x26b9('0x1e')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x1f')]())[_0x26b9('0x1b')](trigger['getTriggers']())[_0x26b9('0x1b')](realtime[_0x26b9('0x20')]())[_0x26b9('0x1b')](template[_0x26b9('0x21')]())[_0x26b9('0x1b')](realtime['initTemplates']())['then'](zendesk[_0x26b9('0x22')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x23')]())['then'](salesforce[_0x26b9('0x24')]())['then'](realtime[_0x26b9('0x25')]())[_0x26b9('0x1b')](sugarcrm[_0x26b9('0x26')]())['then'](realtime['initSugarcrmAccounts']())[_0x26b9('0x1b')](freshdesk[_0x26b9('0x27')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x28')]())[_0x26b9('0x1b')](desk[_0x26b9('0x29')]())['then'](realtime['initDeskAccounts']())[_0x26b9('0x1b')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x26b9('0x1b')](vtiger[_0x26b9('0x2a')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0x26b9('0x2b')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x2c')]())[_0x26b9('0x1b')](servicenow[_0x26b9('0x2d')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x2e')]())[_0x26b9('0x1b')](dynamics365[_0x26b9('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x26b9('0x1b')](campaign[_0x26b9('0x30')]())['then'](realtime[_0x26b9('0x31')]())[_0x26b9('0x1b')](voiceExtension['getVoiceExtensions']())[_0x26b9('0x1b')](realtime['initVoiceExtensions']())[_0x26b9('0x1b')](faxAccount[_0x26b9('0x32')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x33')]())[_0x26b9('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x26b9('0x19')]()[_0x26b9('0x1b')](voiceQueueReport[_0x26b9('0x34')]())['then'](realtime[_0x26b9('0x35')]())[_0x26b9('0x1b')](cmHopperHistory[_0x26b9('0x36')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x37')]())[_0x26b9('0x1b')](cmHopperHistory[_0x26b9('0x38')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x39')]())['then'](voiceCallReport[_0x26b9('0x3a')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x9f7436){logger[_0x26b9('0x3b')](_0x26b9('0x3c'),util['inspect'](_0x9f7436,{'showHidden':![],'depth':null}));});}function main(){return server[_0x26b9('0x3d')](realtime,preview,fax)[_0x26b9('0x1b')](function(){return initRealtime();})[_0x26b9('0x1b')](function(){return initParams();})[_0x26b9('0x1b')](function(){report[_0x26b9('0x3e')]();setInterval(initRealtime,0x1388);})[_0x26b9('0x3f')](function(_0xb395b0){logger[_0x26b9('0x3b')](_0x26b9('0x40'),util[_0x26b9('0x41')](_0xb395b0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x30f1=['getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','catch','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues'];(function(_0x2631ea,_0x5ce0b0){var _0x4c3808=function(_0x8e021d){while(--_0x8e021d){_0x2631ea['push'](_0x2631ea['shift']());}};_0x4c3808(++_0x5ce0b0);}(_0x30f1,0x6d));var _0x130f=function(_0x40f951,_0x253187){_0x40f951=_0x40f951-0x0;var _0x85155=_0x30f1[_0x40f951];return _0x85155;};'use strict';var util=require(_0x130f('0x0'));var moment=require(_0x130f('0x1'));var server=require(_0x130f('0x2'));var Realtime=require(_0x130f('0x3'));var Report=require(_0x130f('0x4'));var Acw=require(_0x130f('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x130f('0x6'));var Preview=require(_0x130f('0x7'));var Fax=require(_0x130f('0x8'));var user=require(_0x130f('0x9'));var voiceQueue=require(_0x130f('0xa'));var voiceQueueReport=require(_0x130f('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x130f('0xc'));var trigger=require(_0x130f('0xd'));var template=require(_0x130f('0xe'));var cmHopperHistory=require(_0x130f('0xf'));var campaign=require(_0x130f('0x10'));var voiceExtension=require(_0x130f('0x11'));var faxAccount=require(_0x130f('0x12'));var zendesk=require(_0x130f('0x13'));var salesforce=require(_0x130f('0x14'));var sugarcrm=require(_0x130f('0x15'));var freshdesk=require(_0x130f('0x16'));var desk=require(_0x130f('0x17'));var zoho=require(_0x130f('0x18'));var vtiger=require(_0x130f('0x19'));var freshsales=require(_0x130f('0x1a'));var servicenow=require(_0x130f('0x1b'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x130f('0x1c'))(_0x130f('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x130f('0x1e')](_0x130f('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x130f('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x130f('0x20')](user[_0x130f('0x21')]())['then'](realtime[_0x130f('0x22')]())[_0x130f('0x20')](user[_0x130f('0x23')]())[_0x130f('0x20')](realtime[_0x130f('0x24')]())[_0x130f('0x20')](trunk[_0x130f('0x25')]())[_0x130f('0x20')](realtime[_0x130f('0x26')]())[_0x130f('0x20')](voiceQueue[_0x130f('0x27')]())[_0x130f('0x20')](realtime[_0x130f('0x28')]())[_0x130f('0x20')](trigger[_0x130f('0x29')]())[_0x130f('0x20')](realtime[_0x130f('0x2a')]())[_0x130f('0x20')](template[_0x130f('0x2b')]())['then'](realtime[_0x130f('0x2c')]())[_0x130f('0x20')](zendesk[_0x130f('0x2d')]())[_0x130f('0x20')](realtime['initZendeskAccounts']())[_0x130f('0x20')](salesforce[_0x130f('0x2e')]())[_0x130f('0x20')](realtime[_0x130f('0x2f')]())[_0x130f('0x20')](sugarcrm[_0x130f('0x30')]())['then'](realtime[_0x130f('0x31')]())[_0x130f('0x20')](freshdesk[_0x130f('0x32')]())[_0x130f('0x20')](realtime['initFreshdeskAccounts']())[_0x130f('0x20')](desk[_0x130f('0x33')]())['then'](realtime['initDeskAccounts']())[_0x130f('0x20')](zoho['getZohoAccounts']())[_0x130f('0x20')](realtime['initZohoAccounts']())[_0x130f('0x20')](vtiger[_0x130f('0x34')]())['then'](realtime[_0x130f('0x35')]())['then'](freshsales[_0x130f('0x36')]())['then'](realtime[_0x130f('0x37')]())[_0x130f('0x20')](servicenow[_0x130f('0x38')]())[_0x130f('0x20')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x130f('0x39')]())[_0x130f('0x20')](realtime[_0x130f('0x3a')]())[_0x130f('0x20')](campaign[_0x130f('0x3b')]())[_0x130f('0x20')](realtime[_0x130f('0x3c')]())[_0x130f('0x20')](voiceExtension[_0x130f('0x3d')]())['then'](realtime[_0x130f('0x3e')]())['then'](faxAccount['getFaxAccounts']())[_0x130f('0x20')](realtime['initFaxAccounts']())[_0x130f('0x20')](function(){return realtime;});}function initParams(){return Promise[_0x130f('0x3f')]()[_0x130f('0x20')](voiceQueueReport[_0x130f('0x40')]())[_0x130f('0x20')](realtime[_0x130f('0x41')]())[_0x130f('0x20')](cmHopperHistory[_0x130f('0x42')]())[_0x130f('0x20')](realtime[_0x130f('0x43')]())['then'](cmHopperHistory[_0x130f('0x44')]())[_0x130f('0x20')](realtime[_0x130f('0x45')]())[_0x130f('0x20')](voiceCallReport[_0x130f('0x46')]())[_0x130f('0x20')](realtime[_0x130f('0x47')]())['catch'](function(_0x4294cf){logger['error'](_0x130f('0x48'),util[_0x130f('0x49')](_0x4294cf,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x130f('0x20')](function(){return initRealtime();})[_0x130f('0x20')](function(){return initParams();})[_0x130f('0x20')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x130f('0x4a')](function(_0x52cad6){logger['error']('[index.js][main]',util[_0x130f('0x49')](_0x52cad6,{'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 68eb85a..59f8e02 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 _0xa918=['inuse','talking','toNumber','format','onhold','stringify','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','idle'];(function(_0x7b2c5a,_0x486e8c){var _0x199677=function(_0x163137){while(--_0x163137){_0x7b2c5a['push'](_0x7b2c5a['shift']());}};_0x199677(++_0x486e8c);}(_0xa918,0x11c));var _0x8a91=function(_0x776dd3,_0x438790){_0x776dd3=_0x776dd3-0x0;var _0xcef491=_0xa918[_0x776dd3];return _0xcef491;};'use strict';var _=require(_0x8a91('0x0'));var util=require(_0x8a91('0x1'));var moment=require(_0x8a91('0x2'));var md5=require(_0x8a91('0x3'));var Redis=require(_0x8a91('0x4'));var config=require(_0x8a91('0x5'));config['redis']=_[_0x8a91('0x6')](config[_0x8a91('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8a91('0x8'))(new Redis(config[_0x8a91('0x7')]));function Agent(_0x427381){this['id']=_0x427381['id']||0x0;this[_0x8a91('0x9')]=_0x427381[_0x8a91('0x9')]||'';this[_0x8a91('0xa')]=_0x427381['email']||'';this[_0x8a91('0xb')]=_0x427381[_0x8a91('0xb')]||'';this[_0x8a91('0xc')]=_0x427381[_0x8a91('0xc')]||'';this[_0x8a91('0xd')]='unknown';this[_0x8a91('0xe')]=0x0;this[_0x8a91('0xf')]=_0x8a91('0x10');this[_0x8a91('0x11')]='';this['phone']='';this['mobile']='';this[_0x8a91('0x12')]='';this[_0x8a91('0x13')]=_0x427381[_0x8a91('0x13')]||![];this[_0x8a91('0x14')]=_0x8a91('0x10');this[_0x8a91('0x15')]=0x0;this[_0x8a91('0x16')]='';this[_0x8a91('0x17')]='';this['onhold']=![];this['local']=![];this[_0x8a91('0x3')]='';}Agent[_0x8a91('0x18')][_0x8a91('0x19')]=function(_0x39e82b){var _0x57b7b1;if(_0x39e82b&&_0x39e82b[_0x8a91('0xd')]){_0x57b7b1=_0x39e82b['state'][_0x8a91('0x1a')]();switch(_0x57b7b1){case'not_inuse':_0x57b7b1=_0x8a91('0x1b');break;case _0x8a91('0x1c'):_0x57b7b1=_0x8a91('0x1d');break;}}if(_0x57b7b1&&this[_0x8a91('0x14')]!==_0x57b7b1||_0x39e82b['statePause']){this[_0x8a91('0x15')]=_[_0x8a91('0x1e')](moment()[_0x8a91('0x1f')]('x'));}if(_0x57b7b1){this[_0x8a91('0x14')]=_0x57b7b1;}var _0x531f08={'id':this['id'],'name':this[_0x8a91('0x9')],'email':this[_0x8a91('0xa')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x8a91('0xd')],'stateTime':this[_0x8a91('0xe')],'status':this['status'],'address':this['address'],'online':this[_0x8a91('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x8a91('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8a91('0x17')],'interface':this[_0x8a91('0x12')],'onhold':this[_0x8a91('0x20')]};var _0x393956=md5(JSON[_0x8a91('0x21')](_0x531f08));if(this[_0x8a91('0x3')]!==_0x393956){this['md5']=_0x393956;io['to'](util[_0x8a91('0x1f')](_0x8a91('0x22'),_0x531f08[_0x8a91('0x9')]))[_0x8a91('0x23')](_0x8a91('0x24'),_['omit'](_0x531f08,[_0x8a91('0x13')]));io[_0x8a91('0x23')](_0x8a91('0x25'),_0x531f08);}};module[_0x8a91('0x26')]=Agent; \ No newline at end of file +var _0xb2e5=['voiceStatusTime','format','email','interface','user:%s','user:ami:update','omit','user:presence','exports','util','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','idle','talking','voiceStatus','statePause'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xb2e5,0x156));var _0x5b2e=function(_0x33687e,_0x2d8223){_0x33687e=_0x33687e-0x0;var _0x2c6ca8=_0xb2e5[_0x33687e];return _0x2c6ca8;};'use strict';var _=require('lodash');var util=require(_0x5b2e('0x0'));var moment=require('moment');var md5=require(_0x5b2e('0x1'));var Redis=require(_0x5b2e('0x2'));var config=require(_0x5b2e('0x3'));config[_0x5b2e('0x4')]=_[_0x5b2e('0x5')](config[_0x5b2e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5b2e('0x6'))(new Redis(config['redis']));function Agent(_0x1e7f27){this['id']=_0x1e7f27['id']||0x0;this[_0x5b2e('0x7')]=_0x1e7f27[_0x5b2e('0x7')]||'';this['email']=_0x1e7f27['email']||'';this['accountcode']=_0x1e7f27[_0x5b2e('0x8')]||'';this[_0x5b2e('0x9')]=_0x1e7f27[_0x5b2e('0x9')]||'';this['state']=_0x5b2e('0xa');this[_0x5b2e('0xb')]=0x0;this[_0x5b2e('0xc')]=_0x5b2e('0xa');this[_0x5b2e('0xd')]='';this[_0x5b2e('0xe')]='';this[_0x5b2e('0xf')]='';this['interface']='';this[_0x5b2e('0x10')]=_0x1e7f27[_0x5b2e('0x10')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this[_0x5b2e('0x11')]='';this['voiceStatusQueue']='';this[_0x5b2e('0x12')]=![];this[_0x5b2e('0x13')]=![];this[_0x5b2e('0x1')]='';}Agent[_0x5b2e('0x14')][_0x5b2e('0x15')]=function(_0x440d53){var _0x246e37;if(_0x440d53&&_0x440d53['state']){_0x246e37=_0x440d53[_0x5b2e('0x16')][_0x5b2e('0x17')]();switch(_0x246e37){case'not_inuse':_0x246e37=_0x5b2e('0x18');break;case'inuse':_0x246e37=_0x5b2e('0x19');break;}}if(_0x246e37&&this[_0x5b2e('0x1a')]!==_0x246e37||_0x440d53[_0x5b2e('0x1b')]){this[_0x5b2e('0x1c')]=_['toNumber'](moment()[_0x5b2e('0x1d')]('x'));}if(_0x246e37){this[_0x5b2e('0x1a')]=_0x246e37;}var _0x5d01a3={'id':this['id'],'name':this[_0x5b2e('0x7')],'email':this[_0x5b2e('0x1e')],'accountcode':this['accountcode'],'fullname':this[_0x5b2e('0x9')],'state':this['state'],'stateTime':this[_0x5b2e('0xb')],'status':this['status'],'address':this[_0x5b2e('0xd')],'online':this[_0x5b2e('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x5b2e('0x1c')],'voiceStatusCallerIdNumber':this[_0x5b2e('0x11')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x5b2e('0x1f')],'onhold':this[_0x5b2e('0x12')]};var _0x4a171e=md5(JSON['stringify'](_0x5d01a3));if(this[_0x5b2e('0x1')]!==_0x4a171e){this[_0x5b2e('0x1')]=_0x4a171e;io['to'](util[_0x5b2e('0x1d')](_0x5b2e('0x20'),_0x5d01a3[_0x5b2e('0x7')]))['emit'](_0x5b2e('0x21'),_[_0x5b2e('0x22')](_0x5d01a3,['online']));io['emit'](_0x5b2e('0x23'),_0x5d01a3);}};module[_0x5b2e('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cb79046..1a82661 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 _0xf55a=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x3ef6bb,_0x1bb97f){var _0xa5f12a=function(_0x23f548){while(--_0x23f548){_0x3ef6bb['push'](_0x3ef6bb['shift']());}};_0xa5f12a(++_0x1bb97f);}(_0xf55a,0x1c3));var _0xaf55=function(_0x5bd398,_0x49513f){_0x5bd398=_0x5bd398-0x0;var _0x3f9528=_0xf55a[_0x5bd398];return _0x3f9528;};'use strict';function Campaign(_0x308b5f){this['id']=_0x308b5f['id']||0x0;this[_0xaf55('0x0')]=_0x308b5f['name']||'';this[_0xaf55('0x1')]=_0x308b5f[_0xaf55('0x1')]||'campaign';this[_0xaf55('0x2')]=0x0;this['temp']=0x0;this[_0xaf55('0x3')]=0x0;this[_0xaf55('0x4')]=0x0;this[_0xaf55('0x5')]='';this[_0xaf55('0x6')]=!![];this[_0xaf55('0x7')]=_0x308b5f[_0xaf55('0x7')];this[_0xaf55('0x8')]=_0x308b5f['limitCalls'];this[_0xaf55('0x9')]=_0x308b5f['dialTimezone']||null;this['dialGlobalInterval']=_0x308b5f[_0xaf55('0xa')]?_0x308b5f[_0xaf55('0xa')]:null;this['dialOriginateCallerIdName']=_0x308b5f['dialOriginateCallerIdName'];this[_0xaf55('0xb')]=_0x308b5f[_0xaf55('0xb')];this[_0xaf55('0xc')]=_0x308b5f[_0xaf55('0xc')]||0x1e;this[_0xaf55('0xd')]=_0x308b5f[_0xaf55('0xd')];this[_0xaf55('0xe')]=_0x308b5f[_0xaf55('0xe')];this[_0xaf55('0xf')]=_0x308b5f[_0xaf55('0xf')];this['dialBusyRetryFrequency']=_0x308b5f[_0xaf55('0x10')];this[_0xaf55('0x11')]=_0x308b5f[_0xaf55('0x11')];this['dialNoAnswerRetryFrequency']=_0x308b5f[_0xaf55('0x12')];this[_0xaf55('0x13')]=_0x308b5f[_0xaf55('0x13')];this[_0xaf55('0x14')]=_0x308b5f['dialNoSuchNumberMaxRetry']||0x3;this[_0xaf55('0x15')]=_0x308b5f[_0xaf55('0x15')]||0x96;this[_0xaf55('0x16')]=_0x308b5f['dialDropMaxRetry']||0x3;this[_0xaf55('0x17')]=_0x308b5f[_0xaf55('0x17')]||0x96;this[_0xaf55('0x18')]=_0x308b5f[_0xaf55('0x18')]||0x3;this[_0xaf55('0x19')]=_0x308b5f[_0xaf55('0x19')]||0x96;this[_0xaf55('0x1a')]=_0x308b5f[_0xaf55('0x1a')]||0x3;this[_0xaf55('0x1b')]=_0x308b5f['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x308b5f[_0xaf55('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x308b5f[_0xaf55('0x1d')]||0x96;this[_0xaf55('0x1e')]=_0x308b5f['dialOrderByScheduledAt']||'DESC';this[_0xaf55('0x1f')]=_0x308b5f[_0xaf55('0x1f')]||undefined;this[_0xaf55('0x20')]=_0x308b5f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xaf55('0x21')]=_0x308b5f[_0xaf55('0x21')]||undefined;this['TrunkBackup']=_0x308b5f[_0xaf55('0x22')]?_0x308b5f[_0xaf55('0x22')]:undefined;this[_0xaf55('0x23')]=_0x308b5f[_0xaf55('0x23')]?_0x308b5f[_0xaf55('0x23')]:undefined;this[_0xaf55('0x24')]=_0x308b5f[_0xaf55('0x24')]?_0x308b5f['Interval']:undefined;this['SquareProject']=_0x308b5f[_0xaf55('0x25')]?_0x308b5f[_0xaf55('0x25')]:undefined;this['dialQueueProject']=_0x308b5f[_0xaf55('0x25')]?_0x308b5f[_0xaf55('0x25')]['name']:undefined;this['dialAMDActive']=_0x308b5f[_0xaf55('0x26')]||![];this['dialAMDInitialSilence']=_0x308b5f['dialAMDInitialSilence'];this[_0xaf55('0x27')]=_0x308b5f[_0xaf55('0x27')];this[_0xaf55('0x28')]=_0x308b5f['dialAMDAfterGreetingSilence'];this[_0xaf55('0x29')]=_0x308b5f[_0xaf55('0x29')];this[_0xaf55('0x2a')]=_0x308b5f[_0xaf55('0x2a')];this['dialAMDBetweenWordsSilence']=_0x308b5f['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x308b5f[_0xaf55('0x2b')];this[_0xaf55('0x2c')]=_0x308b5f[_0xaf55('0x2c')];this['dialAMDMaximumWordLength']=_0x308b5f[_0xaf55('0x2d')];}module[_0xaf55('0x2e')]=Campaign; \ No newline at end of file +var _0x557b=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x450040,_0x2b7c54){var _0x372561=function(_0x490a97){while(--_0x490a97){_0x450040['push'](_0x450040['shift']());}};_0x372561(++_0x2b7c54);}(_0x557b,0x1b9));var _0xb557=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x557b[_0x138f59];return _0x3d114d;};'use strict';function Campaign(_0x373b37){this['id']=_0x373b37['id']||0x0;this['name']=_0x373b37[_0xb557('0x0')]||'';this[_0xb557('0x1')]=_0x373b37[_0xb557('0x1')]||_0xb557('0x2');this[_0xb557('0x3')]=0x0;this['temp']=0x0;this[_0xb557('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xb557('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x373b37['active'];this[_0xb557('0x6')]=_0x373b37[_0xb557('0x6')];this[_0xb557('0x7')]=_0x373b37[_0xb557('0x7')]||null;this[_0xb557('0x8')]=_0x373b37[_0xb557('0x8')]?_0x373b37[_0xb557('0x8')]:null;this[_0xb557('0x9')]=_0x373b37[_0xb557('0x9')];this[_0xb557('0xa')]=_0x373b37[_0xb557('0xa')];this[_0xb557('0xb')]=_0x373b37['dialOriginateTimeout']||0x1e;this[_0xb557('0xc')]=_0x373b37[_0xb557('0xc')];this['dialCongestionRetryFrequency']=_0x373b37[_0xb557('0xd')];this[_0xb557('0xe')]=_0x373b37[_0xb557('0xe')];this['dialBusyRetryFrequency']=_0x373b37[_0xb557('0xf')];this['dialNoAnswerMaxRetry']=_0x373b37[_0xb557('0x10')];this[_0xb557('0x11')]=_0x373b37[_0xb557('0x11')];this['dialGlobalMaxRetry']=_0x373b37[_0xb557('0x12')];this[_0xb557('0x13')]=_0x373b37['dialNoSuchNumberMaxRetry']||0x3;this[_0xb557('0x14')]=_0x373b37[_0xb557('0x14')]||0x96;this['dialDropMaxRetry']=_0x373b37[_0xb557('0x15')]||0x3;this[_0xb557('0x16')]=_0x373b37[_0xb557('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x373b37[_0xb557('0x17')]||0x3;this[_0xb557('0x18')]=_0x373b37[_0xb557('0x18')]||0x96;this[_0xb557('0x19')]=_0x373b37[_0xb557('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x373b37[_0xb557('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x373b37[_0xb557('0x1b')]||0x3;this[_0xb557('0x1c')]=_0x373b37['dialAgentRejectRetryFrequency']||0x96;this[_0xb557('0x1d')]=_0x373b37[_0xb557('0x1d')]||'DESC';this[_0xb557('0x1e')]=_0x373b37['dialPrefix']||undefined;this[_0xb557('0x1f')]=_0x373b37[_0xb557('0x1f')]||undefined;this[_0xb557('0x20')]=_0x373b37[_0xb557('0x20')]||undefined;this[_0xb557('0x21')]=_0x373b37[_0xb557('0x21')]?_0x373b37[_0xb557('0x21')]:undefined;this[_0xb557('0x22')]=_0x373b37[_0xb557('0x22')]?_0x373b37[_0xb557('0x22')]:undefined;this[_0xb557('0x23')]=_0x373b37['Interval']?_0x373b37[_0xb557('0x23')]:undefined;this['SquareProject']=_0x373b37[_0xb557('0x24')]?_0x373b37[_0xb557('0x24')]:undefined;this['dialQueueProject']=_0x373b37['SquareProject']?_0x373b37[_0xb557('0x24')][_0xb557('0x0')]:undefined;this[_0xb557('0x25')]=_0x373b37['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x373b37[_0xb557('0x26')];this[_0xb557('0x27')]=_0x373b37[_0xb557('0x27')];this['dialAMDAfterGreetingSilence']=_0x373b37[_0xb557('0x28')];this[_0xb557('0x29')]=_0x373b37[_0xb557('0x29')];this[_0xb557('0x2a')]=_0x373b37[_0xb557('0x2a')];this[_0xb557('0x2b')]=_0x373b37[_0xb557('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x373b37[_0xb557('0x2c')];this[_0xb557('0x2d')]=_0x373b37[_0xb557('0x2d')];this[_0xb557('0x2e')]=_0x373b37[_0xb557('0x2e')];}module[_0xb557('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f329f85..2ab9322 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 _0x7d29=['exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','monitor','monitors','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','context','uniqueid','linkedid'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7d29,0x1a0));var _0x97d2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7d29[_0x465028];return _0xb783d4;};'use strict';function Channel(){this[_0x97d2('0x0')]=null;this[_0x97d2('0x1')]='';this[_0x97d2('0x2')]='';this[_0x97d2('0x3')]=0x0;this[_0x97d2('0x4')]='';this[_0x97d2('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x97d2('0x6')]='';this[_0x97d2('0x7')]=0x0;this[_0x97d2('0x8')]=0x0;this[_0x97d2('0x9')]=0x0;this[_0x97d2('0xa')]=![];this[_0x97d2('0xb')]=null;this[_0x97d2('0xc')]=null;this[_0x97d2('0xd')]=![];this[_0x97d2('0xe')]=![];this['lastapplication']='';this[_0x97d2('0xf')]='';this[_0x97d2('0x10')]=0x0;this[_0x97d2('0x11')]=0x0;this[_0x97d2('0x12')]=0x0;this['type']=null;this[_0x97d2('0x13')]=null;this['disposition']=null;this[_0x97d2('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x97d2('0x15')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x97d2('0x16')]=undefined;this[_0x97d2('0x17')]=0x0;}module[_0x97d2('0x18')]=Channel; \ No newline at end of file +var _0x554e=['accountcode','context','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x10346c,_0x183ce6){var _0x262bd4=function(_0x49ac96){while(--_0x49ac96){_0x10346c['push'](_0x10346c['shift']());}};_0x262bd4(++_0x183ce6);}(_0x554e,0xb6));var _0xe554=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0x554e[_0x3355c0];return _0x5a3288;};'use strict';function Channel(){this[_0xe554('0x0')]=null;this[_0xe554('0x1')]='';this[_0xe554('0x2')]='';this[_0xe554('0x3')]=0x0;this[_0xe554('0x4')]='';this[_0xe554('0x5')]=undefined;this[_0xe554('0x6')]=undefined;this[_0xe554('0x7')]=0x0;this[_0xe554('0x8')]='';this[_0xe554('0x9')]=0x0;this['linkedid']=0x0;this[_0xe554('0xa')]=0x0;this[_0xe554('0xb')]=![];this[_0xe554('0xc')]=null;this['endtime']=null;this[_0xe554('0xd')]=![];this[_0xe554('0xe')]=![];this[_0xe554('0xf')]='';this[_0xe554('0x10')]='';this['duration']=0x0;this[_0xe554('0x11')]=0x0;this[_0xe554('0x12')]=0x0;this['type']=null;this[_0xe554('0x13')]=null;this[_0xe554('0x14')]=null;this[_0xe554('0x15')]=![];this[_0xe554('0x16')]=null;this['queue']=null;this['monitors']=[];this[_0xe554('0x17')]=undefined;this[_0xe554('0x18')]=undefined;this[_0xe554('0x19')]=undefined;this['mohtime']=0x0;}module[_0xe554('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2440881..a32d923 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 _0xc9b4=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name','username'];(function(_0x516118,_0x26acb7){var _0x4922a8=function(_0x1780d6){while(--_0x1780d6){_0x516118['push'](_0x516118['shift']());}};_0x4922a8(++_0x26acb7);}(_0xc9b4,0x142));var _0x4c9b=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc9b4[_0x3c4f1f];return _0x19cb69;};'use strict';function DeskAccount(_0x3e0f51){this['id']=_0x3e0f51['id']||0x0;this[_0x4c9b('0x0')]=_0x3e0f51[_0x4c9b('0x0')]||'';this[_0x4c9b('0x1')]=_0x3e0f51[_0x4c9b('0x1')]||'';this[_0x4c9b('0x2')]=_0x3e0f51[_0x4c9b('0x2')]||'';this[_0x4c9b('0x3')]=_0x3e0f51['authType']||'';this[_0x4c9b('0x4')]=_0x3e0f51[_0x4c9b('0x4')]||'';this[_0x4c9b('0x5')]=_0x3e0f51[_0x4c9b('0x5')]||'';this[_0x4c9b('0x6')]=_0x3e0f51['consumerSecret']||'';this['token']=_0x3e0f51[_0x4c9b('0x7')]||'';this['tokenSecret']=_0x3e0f51[_0x4c9b('0x8')]||'';this['type']=_0x3e0f51[_0x4c9b('0x9')]||'';this['serverUrl']=_0x3e0f51['serverUrl']||'';this['Configurations']=_0x3e0f51[_0x4c9b('0xa')]||{};}module[_0x4c9b('0xb')]=DeskAccount; \ No newline at end of file +var _0x8ef3=['type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x5010ea,_0x2287dd){var _0x40a4be=function(_0x455e3c){while(--_0x455e3c){_0x5010ea['push'](_0x5010ea['shift']());}};_0x40a4be(++_0x2287dd);}(_0x8ef3,0x16c));var _0x38ef=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8ef3[_0x1facfa];return _0x9ec701;};'use strict';function DeskAccount(_0x1a026f){this['id']=_0x1a026f['id']||0x0;this['name']=_0x1a026f['name']||'';this[_0x38ef('0x0')]=_0x1a026f[_0x38ef('0x0')]||'';this[_0x38ef('0x1')]=_0x1a026f[_0x38ef('0x1')]||'';this['authType']=_0x1a026f[_0x38ef('0x2')]||'';this[_0x38ef('0x3')]=_0x1a026f['password']||'';this[_0x38ef('0x4')]=_0x1a026f[_0x38ef('0x4')]||'';this[_0x38ef('0x5')]=_0x1a026f[_0x38ef('0x5')]||'';this[_0x38ef('0x6')]=_0x1a026f[_0x38ef('0x6')]||'';this[_0x38ef('0x7')]=_0x1a026f[_0x38ef('0x7')]||'';this[_0x38ef('0x8')]=_0x1a026f[_0x38ef('0x8')]||'';this[_0x38ef('0x9')]=_0x1a026f[_0x38ef('0x9')]||'';this[_0x38ef('0xa')]=_0x1a026f[_0x38ef('0xa')]||{};}module[_0x38ef('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0f5fd45..e19b70e 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 _0x46d4=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3e5cb1,_0x4e998a){var _0x5056d9=function(_0x1650a9){while(--_0x1650a9){_0x3e5cb1['push'](_0x3e5cb1['shift']());}};_0x5056d9(++_0x4e998a);}(_0x46d4,0x1a9));var _0x446d=function(_0xacfd9e,_0xa9035c){_0xacfd9e=_0xacfd9e-0x0;var _0x39f473=_0x46d4[_0xacfd9e];return _0x39f473;};'use strict';function Dynamics365Account(_0x13e50f){this['id']=_0x13e50f['id']||0x0;this[_0x446d('0x0')]=_0x13e50f[_0x446d('0x0')]||'';this[_0x446d('0x1')]=_0x13e50f['username']||'';this[_0x446d('0x2')]=_0x13e50f[_0x446d('0x2')]||'';this['remoteUri']=_0x13e50f[_0x446d('0x3')]||'';this[_0x446d('0x4')]=_0x13e50f[_0x446d('0x4')]||'';this[_0x446d('0x5')]=_0x13e50f['clientId']||'';this[_0x446d('0x6')]=_0x13e50f[_0x446d('0x6')]||{};this[_0x446d('0x7')]=_0x13e50f['serverUrl']||'';this['modernAuthentication']=_0x13e50f[_0x446d('0x8')]||![];this[_0x446d('0x9')]=_0x13e50f['Configurations']||{};this[_0x446d('0xa')]=_0x13e50f[_0x446d('0xa')]||{};}module[_0x446d('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa47b=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xa47b,0x19a));var _0xba47=function(_0x37ad7e,_0x449e60){_0x37ad7e=_0x37ad7e-0x0;var _0x3a4069=_0xa47b[_0x37ad7e];return _0x3a4069;};'use strict';function Dynamics365Account(_0x471060){this['id']=_0x471060['id']||0x0;this[_0xba47('0x0')]=_0x471060[_0xba47('0x0')]||'';this[_0xba47('0x1')]=_0x471060[_0xba47('0x1')]||'';this[_0xba47('0x2')]=_0x471060['password']||'';this[_0xba47('0x3')]=_0x471060[_0xba47('0x3')]||'';this[_0xba47('0x4')]=_0x471060[_0xba47('0x4')]||'';this[_0xba47('0x5')]=_0x471060[_0xba47('0x5')]||'';this[_0xba47('0x6')]=_0x471060['clientSecret']||{};this[_0xba47('0x7')]=_0x471060[_0xba47('0x7')]||'';this['modernAuthentication']=_0x471060[_0xba47('0x8')]||![];this['Configurations']=_0x471060[_0xba47('0x9')]||{};this['CloudProvider']=_0x471060[_0xba47('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1037a77..f9a2911 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 _0x69d4=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x2dfba2,_0x46a178){var _0x66d228=function(_0x5727ee){while(--_0x5727ee){_0x2dfba2['push'](_0x2dfba2['shift']());}};_0x66d228(++_0x46a178);}(_0x69d4,0x1a6));var _0x469d=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x69d4[_0x1678c8];return _0x387aa9;};'use strict';function FaxAccount(_0x50c9d0){this['id']=_0x50c9d0['id']||0x0;this[_0x469d('0x0')]=_0x50c9d0['name']||'';this[_0x469d('0x1')]=_0x50c9d0[_0x469d('0x1')];this['ecm']=_0x50c9d0[_0x469d('0x2')];this[_0x469d('0x3')]=_0x50c9d0[_0x469d('0x3')];this['localstationid']=_0x50c9d0['localstationid'];this['minrate']=_0x50c9d0['minrate']||0x960;this[_0x469d('0x4')]=_0x50c9d0['maxrate']||0x3840;this['modem']=_0x50c9d0[_0x469d('0x5')]||_0x469d('0x6');this[_0x469d('0x7')]=_0x50c9d0['gateway']||'no';this[_0x469d('0x8')]=_0x50c9d0[_0x469d('0x8')]||'no';this[_0x469d('0x9')]=_0x50c9d0[_0x469d('0x9')]||0x1388;this[_0x469d('0xa')]=_0x50c9d0['tech']||_0x469d('0xb');this[_0x469d('0xc')]=_0x50c9d0[_0x469d('0xc')]?_0x50c9d0[_0x469d('0xc')]:undefined;this['ListId']=_0x50c9d0[_0x469d('0xd')];this[_0x469d('0xe')]=_0x50c9d0[_0x469d('0xe')];}module[_0x469d('0xf')]=FaxAccount; \ No newline at end of file +var _0x4f3b=['exports','name','description','ecm','headerinfo','localstationid','modem','v17,v27,v29','gateway','t38timeout','tech','Trunk','key'];(function(_0x5861d7,_0x3f9d0e){var _0x234f4e=function(_0x36b7d4){while(--_0x36b7d4){_0x5861d7['push'](_0x5861d7['shift']());}};_0x234f4e(++_0x3f9d0e);}(_0x4f3b,0x1a1));var _0xb4f3=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x4f3b[_0x468b0f];return _0x3e74d9;};'use strict';function FaxAccount(_0x43cc73){this['id']=_0x43cc73['id']||0x0;this[_0xb4f3('0x0')]=_0x43cc73['name']||'';this['description']=_0x43cc73[_0xb4f3('0x1')];this[_0xb4f3('0x2')]=_0x43cc73[_0xb4f3('0x2')];this[_0xb4f3('0x3')]=_0x43cc73[_0xb4f3('0x3')];this[_0xb4f3('0x4')]=_0x43cc73[_0xb4f3('0x4')];this['minrate']=_0x43cc73['minrate']||0x960;this['maxrate']=_0x43cc73['maxrate']||0x3840;this['modem']=_0x43cc73[_0xb4f3('0x5')]||_0xb4f3('0x6');this['gateway']=_0x43cc73[_0xb4f3('0x7')]||'no';this['faxdetect']=_0x43cc73['faxdetect']||'no';this[_0xb4f3('0x8')]=_0x43cc73[_0xb4f3('0x8')]||0x1388;this[_0xb4f3('0x9')]=_0x43cc73[_0xb4f3('0x9')]||'SIP';this['Trunk']=_0x43cc73[_0xb4f3('0xa')]?_0x43cc73[_0xb4f3('0xa')]:undefined;this['ListId']=_0x43cc73['ListId'];this[_0xb4f3('0xb')]=_0x43cc73[_0xb4f3('0xb')];}module[_0xb4f3('0xc')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 009e2a4..2663448 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 _0x810a=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x25b46a,_0x31e5fe){var _0x33d48d=function(_0x5bbfb1){while(--_0x5bbfb1){_0x25b46a['push'](_0x25b46a['shift']());}};_0x33d48d(++_0x31e5fe);}(_0x810a,0x1c1));var _0xa810=function(_0x37b9a8,_0x3b146d){_0x37b9a8=_0x37b9a8-0x0;var _0x301244=_0x810a[_0x37b9a8];return _0x301244;};'use strict';function FreshdeskAccount(_0x55ead3){this['id']=_0x55ead3['id']||0x0;this[_0xa810('0x0')]=_0x55ead3[_0xa810('0x0')]||'';this[_0xa810('0x1')]=_0x55ead3[_0xa810('0x1')]||'';this[_0xa810('0x2')]=_0x55ead3[_0xa810('0x3')]||'';this[_0xa810('0x4')]=_0x55ead3[_0xa810('0x4')]||'';this[_0xa810('0x5')]=_0x55ead3[_0xa810('0x5')]||'';this[_0xa810('0x6')]=_0x55ead3[_0xa810('0x6')]||{};}module[_0xa810('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x13db=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x39c73d,_0x1e51b9){var _0x4b11e8=function(_0x4be2d1){while(--_0x4be2d1){_0x39c73d['push'](_0x39c73d['shift']());}};_0x4b11e8(++_0x1e51b9);}(_0x13db,0x1b6));var _0xb13d=function(_0x3e2373,_0x53f7d6){_0x3e2373=_0x3e2373-0x0;var _0x306641=_0x13db[_0x3e2373];return _0x306641;};'use strict';function FreshdeskAccount(_0x23daa5){this['id']=_0x23daa5['id']||0x0;this[_0xb13d('0x0')]=_0x23daa5['name']||'';this[_0xb13d('0x1')]=_0x23daa5[_0xb13d('0x1')]||'';this['apiKey']=_0x23daa5[_0xb13d('0x2')]||'';this['remoteUri']=_0x23daa5[_0xb13d('0x3')]||'';this['serverUrl']=_0x23daa5[_0xb13d('0x4')]||'';this[_0xb13d('0x5')]=_0x23daa5['Configurations']||{};}module[_0xb13d('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 861472a..2490c25 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 _0x943c=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x62bc50){this['id']=_0x62bc50['id']||0x0;this[_0xc943('0x0')]=_0x62bc50[_0xc943('0x0')]||'';this[_0xc943('0x1')]=_0x62bc50['username']||'';this['apiKey']=_0x62bc50[_0xc943('0x2')]||'';this[_0xc943('0x3')]=_0x62bc50[_0xc943('0x3')]||'';this['serverUrl']=_0x62bc50[_0xc943('0x4')]||'';this[_0xc943('0x5')]=_0x62bc50[_0xc943('0x5')]||{};}module[_0xc943('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xdf70=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x3797d9,_0x1ce1c7){var _0x2d1c0d=function(_0xbc5158){while(--_0xbc5158){_0x3797d9['push'](_0x3797d9['shift']());}};_0x2d1c0d(++_0x1ce1c7);}(_0xdf70,0x86));var _0x0df7=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xdf70[_0x511bd1];return _0x4c48ec;};'use strict';function FreshsalesAccount(_0x307718){this['id']=_0x307718['id']||0x0;this[_0x0df7('0x0')]=_0x307718[_0x0df7('0x0')]||'';this['username']=_0x307718[_0x0df7('0x1')]||'';this[_0x0df7('0x2')]=_0x307718['token']||'';this[_0x0df7('0x3')]=_0x307718['remoteUri']||'';this[_0x0df7('0x4')]=_0x307718[_0x0df7('0x4')]||'';this['Configurations']=_0x307718[_0x0df7('0x5')]||{};}module[_0x0df7('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5b3e62c..c247f11 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 _0x97f9=['holdtime','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority'];(function(_0x42a318,_0x4d20ed){var _0x254625=function(_0x13b3c9){while(--_0x13b3c9){_0x42a318['push'](_0x42a318['shift']());}};_0x254625(++_0x4d20ed);}(_0x97f9,0x1e5));var _0x997f=function(_0x41bc32,_0x406204){_0x41bc32=_0x41bc32-0x0;var _0x33cc5b=_0x97f9[_0x41bc32];return _0x33cc5b;};'use strict';function QueueReport(){this[_0x997f('0x0')]='inbound';this[_0x997f('0x1')]='';this[_0x997f('0x2')]='';this[_0x997f('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x997f('0x4')]=null;this[_0x997f('0x5')]=0x1;this[_0x997f('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x997f('0x7')]=null;this[_0x997f('0x8')]=![];this[_0x997f('0x9')]=null;this[_0x997f('0xa')]=![];this[_0x997f('0xb')]=null;this[_0x997f('0xc')]=0x1;this[_0x997f('0xd')]='';this[_0x997f('0xe')]='';this[_0x997f('0xf')]='';this['accountcode']='';this[_0x997f('0x10')]='';this[_0x997f('0x11')]='';this[_0x997f('0x12')]='';this[_0x997f('0x13')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['motionChannel']=_0x997f('0x14');this[_0x997f('0x15')]=0x0;this[_0x997f('0x16')]={};}module[_0x997f('0x17')]=QueueReport; \ No newline at end of file +var _0x0624=['voice','mohtime','variables','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','lastAssignedTo','motionChannel'];(function(_0x7b1598,_0xbde280){var _0x1c144e=function(_0x40fbeb){while(--_0x40fbeb){_0x7b1598['push'](_0x7b1598['shift']());}};_0x1c144e(++_0xbde280);}(_0x0624,0x93));var _0x4062=function(_0x39df67,_0x3745b0){_0x39df67=_0x39df67-0x0;var _0x23b928=_0x0624[_0x39df67];return _0x23b928;};'use strict';function QueueReport(){this[_0x4062('0x0')]='inbound';this[_0x4062('0x1')]='';this[_0x4062('0x2')]='';this[_0x4062('0x3')]='';this['queue']='';this[_0x4062('0x4')]=null;this[_0x4062('0x5')]=null;this[_0x4062('0x6')]=0x1;this[_0x4062('0x7')]=0x1;this[_0x4062('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x4062('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x4062('0xa')]=![];this[_0x4062('0xb')]=null;this[_0x4062('0xc')]=0x1;this[_0x4062('0xd')]='';this[_0x4062('0xe')]='';this[_0x4062('0xf')]='';this['accountcode']='';this[_0x4062('0x10')]='';this['exten']='';this[_0x4062('0x11')]='';this[_0x4062('0x12')]=0x0;this['assigned']=![];this[_0x4062('0x13')]='';this[_0x4062('0x14')]=_0x4062('0x15');this[_0x4062('0x16')]=0x0;this[_0x4062('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 854027f..d391369 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 _0xda34=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','clientId','clientSecret','type'];(function(_0x1279f2,_0x428198){var _0x372389=function(_0xe5c416){while(--_0xe5c416){_0x1279f2['push'](_0x1279f2['shift']());}};_0x372389(++_0x428198);}(_0xda34,0x14e));var _0x4da3=function(_0x275f64,_0x499f01){_0x275f64=_0x275f64-0x0;var _0x23523a=_0xda34[_0x275f64];return _0x23523a;};'use strict';function SalesforceAccount(_0x5d3900){this['id']=_0x5d3900['id']||0x0;this['name']=_0x5d3900[_0x4da3('0x0')]||'';this[_0x4da3('0x1')]=_0x5d3900['username']||'';this[_0x4da3('0x2')]=_0x5d3900[_0x4da3('0x2')]||'';this['password']=_0x5d3900['password']||'';this[_0x4da3('0x3')]=_0x5d3900[_0x4da3('0x3')]||'';this[_0x4da3('0x4')]=_0x5d3900['clientSecret']||'';this['securityToken']=_0x5d3900['securityToken']||'';this['type']=_0x5d3900[_0x4da3('0x5')]||_0x4da3('0x6');this[_0x4da3('0x7')]=_0x5d3900['serverUrl']||'';this[_0x4da3('0x8')]=_0x5d3900['Configurations']||{};}module[_0x4da3('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xdebe=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','type','serverUrl'];(function(_0x2ba425,_0x58d262){var _0x5dee4f=function(_0x4f74a6){while(--_0x4f74a6){_0x2ba425['push'](_0x2ba425['shift']());}};_0x5dee4f(++_0x58d262);}(_0xdebe,0x142));var _0xedeb=function(_0x479502,_0x4b2a08){_0x479502=_0x479502-0x0;var _0x5c897b=_0xdebe[_0x479502];return _0x5c897b;};'use strict';function SalesforceAccount(_0x22f5e7){this['id']=_0x22f5e7['id']||0x0;this[_0xedeb('0x0')]=_0x22f5e7[_0xedeb('0x0')]||'';this[_0xedeb('0x1')]=_0x22f5e7['username']||'';this[_0xedeb('0x2')]=_0x22f5e7['remoteUri']||'';this[_0xedeb('0x3')]=_0x22f5e7[_0xedeb('0x3')]||'';this['clientId']=_0x22f5e7[_0xedeb('0x4')]||'';this[_0xedeb('0x5')]=_0x22f5e7['clientSecret']||'';this['securityToken']=_0x22f5e7['securityToken']||'';this[_0xedeb('0x6')]=_0x22f5e7[_0xedeb('0x6')]||'integrationTab';this[_0xedeb('0x7')]=_0x22f5e7['serverUrl']||'';this[_0xedeb('0x8')]=_0x22f5e7[_0xedeb('0x8')]||{};}module[_0xedeb('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index aae313c..af29dfb 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 _0x13ba=['name','username','password','serverUrl'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x13ba,0x90));var _0xa13b=function(_0x24ca1f,_0x3d2164){_0x24ca1f=_0x24ca1f-0x0;var _0x5f4222=_0x13ba[_0x24ca1f];return _0x5f4222;};'use strict';function ServicenowAccount(_0x2b7c05){this['id']=_0x2b7c05['id']||0x0;this[_0xa13b('0x0')]=_0x2b7c05[_0xa13b('0x0')]||'';this[_0xa13b('0x1')]=_0x2b7c05[_0xa13b('0x1')]||'';this[_0xa13b('0x2')]=_0x2b7c05[_0xa13b('0x2')]||'';this['remoteUri']=_0x2b7c05['remoteUri']||'';this[_0xa13b('0x3')]=_0x2b7c05[_0xa13b('0x3')]||'';this['Configurations']=_0x2b7c05['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7330=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x18fc9b,_0x201b23){var _0x1f1815=function(_0x5eda94){while(--_0x5eda94){_0x18fc9b['push'](_0x18fc9b['shift']());}};_0x1f1815(++_0x201b23);}(_0x7330,0x99));var _0x0733=function(_0x5c7290,_0x56b55f){_0x5c7290=_0x5c7290-0x0;var _0x132e60=_0x7330[_0x5c7290];return _0x132e60;};'use strict';function ServicenowAccount(_0x59b283){this['id']=_0x59b283['id']||0x0;this['name']=_0x59b283[_0x0733('0x0')]||'';this[_0x0733('0x1')]=_0x59b283[_0x0733('0x1')]||'';this[_0x0733('0x2')]=_0x59b283[_0x0733('0x2')]||'';this['remoteUri']=_0x59b283[_0x0733('0x3')]||'';this[_0x0733('0x4')]=_0x59b283[_0x0733('0x4')]||'';this[_0x0733('0x5')]=_0x59b283['Configurations']||{};}module[_0x0733('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e91aead..d0fdecf 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 _0xbc19=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x1f1159,_0x93c141){var _0x32e8fa=function(_0x44a1a9){while(--_0x44a1a9){_0x1f1159['push'](_0x1f1159['shift']());}};_0x32e8fa(++_0x93c141);}(_0xbc19,0x184));var _0x9bc1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc19[_0x321bb2];return _0x9c12ed;};'use strict';function SugarcrmAccount(_0x315773){this['id']=_0x315773['id']||0x0;this[_0x9bc1('0x0')]=_0x315773[_0x9bc1('0x0')]||'';this['username']=_0x315773['username']||'';this[_0x9bc1('0x1')]=_0x315773['password']||'';this[_0x9bc1('0x2')]=_0x315773[_0x9bc1('0x2')]||'';this[_0x9bc1('0x3')]=_0x315773[_0x9bc1('0x3')]||'';this[_0x9bc1('0x4')]=_0x315773[_0x9bc1('0x4')]||{};}module[_0x9bc1('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x39dc=['Configurations','exports','username','remoteUri','serverUrl'];(function(_0x49a975,_0x1d28d6){var _0x410d19=function(_0x3b6f60){while(--_0x3b6f60){_0x49a975['push'](_0x49a975['shift']());}};_0x410d19(++_0x1d28d6);}(_0x39dc,0x106));var _0xc39d=function(_0x5c52e6,_0x267012){_0x5c52e6=_0x5c52e6-0x0;var _0x25c3f9=_0x39dc[_0x5c52e6];return _0x25c3f9;};'use strict';function SugarcrmAccount(_0x1d1d6b){this['id']=_0x1d1d6b['id']||0x0;this['name']=_0x1d1d6b['name']||'';this[_0xc39d('0x0')]=_0x1d1d6b[_0xc39d('0x0')]||'';this['password']=_0x1d1d6b['password']||'';this[_0xc39d('0x1')]=_0x1d1d6b['remoteUri']||'';this[_0xc39d('0x2')]=_0x1d1d6b[_0xc39d('0x2')]||'';this[_0xc39d('0x3')]=_0x1d1d6b[_0xc39d('0x3')]||{};}module[_0xc39d('0x4')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d2fec8c..9d1bc57 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 _0xbc48=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0xbc48,0x16b));var _0x8bc4=function(_0x27e044,_0x103854){_0x27e044=_0x27e044-0x0;var _0x49f8b4=_0xbc48[_0x27e044];return _0x49f8b4;};'use strict';function Telephone(_0x3cfa93){this['id']=_0x3cfa93['id']||0x0;this[_0x8bc4('0x0')]=_0x3cfa93[_0x8bc4('0x0')]||'';this[_0x8bc4('0x1')]=_0x3cfa93['accountcode']||'';this[_0x8bc4('0x2')]='unknown';this[_0x8bc4('0x3')]=0x0;this[_0x8bc4('0x4')]=_0x8bc4('0x5');this[_0x8bc4('0x6')]='';}module[_0x8bc4('0x7')]=Telephone; \ No newline at end of file +var _0xf290=['state','unknown','stateTime','status','exports','name','accountcode'];(function(_0x211d6a,_0x491d28){var _0x592bed=function(_0x156312){while(--_0x156312){_0x211d6a['push'](_0x211d6a['shift']());}};_0x592bed(++_0x491d28);}(_0xf290,0xde));var _0x0f29=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xf290[_0x4bfade];return _0x272465;};'use strict';function Telephone(_0x1149f4){this['id']=_0x1149f4['id']||0x0;this[_0x0f29('0x0')]=_0x1149f4['name']||'';this[_0x0f29('0x1')]=_0x1149f4['accountcode']||'';this[_0x0f29('0x2')]=_0x0f29('0x3');this[_0x0f29('0x4')]=0x0;this[_0x0f29('0x5')]=_0x0f29('0x3');this['address']='';}module[_0x0f29('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0d2eb54..e021fb6 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(_0x3de587,_0x273d2c){var _0x2acc49=function(_0x382b9f){while(--_0x382b9f){_0x3de587['push'](_0x3de587['shift']());}};_0x2acc49(++_0x273d2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x4d9d22,_0x54cd23){var _0x6ff401=function(_0x43a540){while(--_0x43a540){_0x4d9d22['push'](_0x4d9d22['shift']());}};_0x6ff401(++_0x54cd23);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c6484,_0x4fe72c){_0x2c6484=_0x2c6484-0x0;var _0x3b9d94=_0xb10b[_0x2c6484];return _0x3b9d94;};'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 5f17b7f..feaea6b 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x2c00ac,_0x200c26){var _0x33e2f8=function(_0x257ab0){while(--_0x257ab0){_0x2c00ac['push'](_0x2c00ac['shift']());}};_0x33e2f8(++_0x200c26);}(_0xda2d,0x102));var _0xdda2=function(_0x348e1d,_0x3ad622){_0x348e1d=_0x348e1d-0x0;var _0x1fe9c2=_0xda2d[_0x348e1d];return _0x1fe9c2;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x212303,_0x209e10){var _0xbc6843=function(_0x3e9dac){while(--_0x3e9dac){_0x212303['push'](_0x212303['shift']());}};_0xbc6843(++_0x209e10);}(_0x2032,0xd9));var _0x2203=function(_0x2042c7,_0x29ac53){_0x2042c7=_0x2042c7-0x0;var _0x170250=_0x2032[_0x2042c7];return _0x170250;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index af8ddca..9c90683 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 _0xc683=['stateRegistry','address','defaultuser','active','name','state','unknown','stateTime','registry','split','host','port','domain','domainport','refresh'];(function(_0x30d119,_0x1f250b){var _0x4aad53=function(_0x4d6352){while(--_0x4d6352){_0x30d119['push'](_0x30d119['shift']());}};_0x4aad53(++_0x1f250b);}(_0xc683,0xe4));var _0x3c68=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xc683[_0x48b810];return _0x23c17d;};'use strict';function Trunk(_0xd9374d){this['id']=_0xd9374d['id']||0x0;this[_0x3c68('0x0')]=_0xd9374d[_0x3c68('0x0')]||![];this[_0x3c68('0x1')]=_0xd9374d['name']||'';this[_0x3c68('0x2')]=_0x3c68('0x3');this[_0x3c68('0x4')]=0x0;this['status']=_0x3c68('0x3');this[_0x3c68('0x5')]=_0xd9374d[_0x3c68('0x5')]&&_0xd9374d[_0x3c68('0x5')]['indexOf'](':')?_0xd9374d['registry'][_0x3c68('0x6')](':')[0x0]:'';this[_0x3c68('0x7')]='';this[_0x3c68('0x8')]='';this[_0x3c68('0x9')]='';this[_0x3c68('0xa')]='';this[_0x3c68('0xb')]='';this[_0x3c68('0xc')]=_0x3c68('0x3');this['registrationtime']='';this[_0x3c68('0xd')]='';this[_0x3c68('0xe')]=_0xd9374d[_0x3c68('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x4596=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','unknown'];(function(_0x3c4a91,_0x87bd76){var _0x5afdb1=function(_0x428566){while(--_0x428566){_0x3c4a91['push'](_0x3c4a91['shift']());}};_0x5afdb1(++_0x87bd76);}(_0x4596,0x1a6));var _0x6459=function(_0x26477a,_0x44ea6a){_0x26477a=_0x26477a-0x0;var _0x5ad90a=_0x4596[_0x26477a];return _0x5ad90a;};'use strict';function Trunk(_0x1003da){this['id']=_0x1003da['id']||0x0;this[_0x6459('0x0')]=_0x1003da[_0x6459('0x0')]||![];this[_0x6459('0x1')]=_0x1003da[_0x6459('0x1')]||'';this['state']=_0x6459('0x2');this[_0x6459('0x3')]=0x0;this[_0x6459('0x4')]=_0x6459('0x2');this[_0x6459('0x5')]=_0x1003da[_0x6459('0x5')]&&_0x1003da['registry'][_0x6459('0x6')](':')?_0x1003da['registry'][_0x6459('0x7')](':')[0x0]:'';this[_0x6459('0x8')]='';this[_0x6459('0x9')]='';this[_0x6459('0xa')]='';this[_0x6459('0xb')]='';this[_0x6459('0xc')]='';this[_0x6459('0xd')]='unknown';this[_0x6459('0xe')]='';this['address']='';this['defaultuser']=_0x1003da[_0x6459('0xf')]||'';}module[_0x6459('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ebf4749..d9bd6d3 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 _0x4937=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x11bbd5,_0x441a32){var _0x1d4986=function(_0x543f24){while(--_0x543f24){_0x11bbd5['push'](_0x11bbd5['shift']());}};_0x1d4986(++_0x441a32);}(_0x4937,0x1b2));var _0x7493=function(_0x3b1481,_0x52bcd4){_0x3b1481=_0x3b1481-0x0;var _0x1fe2a9=_0x4937[_0x3b1481];return _0x1fe2a9;};'use strict';function voiceExtension(_0x3aabc5){this['id']=_0x3aabc5['id']||0x0;this['exten']=_0x3aabc5['exten']||'';this[_0x7493('0x0')]=_0x3aabc5[_0x7493('0x0')]||_0x7493('0x1');this[_0x7493('0x2')]=_0x3aabc5[_0x7493('0x2')]||![];}module[_0x7493('0x3')]=voiceExtension; \ No newline at end of file +var _0x9423=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x326a59,_0x488ff0){var _0x375ea2=function(_0x163cf3){while(--_0x163cf3){_0x326a59['push'](_0x326a59['shift']());}};_0x375ea2(++_0x488ff0);}(_0x9423,0xd7));var _0x3942=function(_0x2f6edf,_0x2d7b63){_0x2f6edf=_0x2f6edf-0x0;var _0x23d237=_0x9423[_0x2f6edf];return _0x23d237;};'use strict';function voiceExtension(_0x17af37){this['id']=_0x17af37['id']||0x0;this[_0x3942('0x0')]=_0x17af37[_0x3942('0x0')]||'';this[_0x3942('0x1')]=_0x17af37[_0x3942('0x1')]||_0x3942('0x2');this[_0x3942('0x3')]=_0x17af37[_0x3942('0x3')]||![];}module[_0x3942('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 18e1a6d..38630b5 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 _0x559f=['ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','random'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x559f,0x102));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0xf559('0x0'),'wav49':'wav49','gsm':_0xf559('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xf559('0x2'),'linear':'linear','random':_0xf559('0x3'),'ringall':_0xf559('0x4'),'rr':_0xf559('0x5'),'rrmemory':_0xf559('0x6'),'rrordered':_0xf559('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x2bbd1a){this['id']=_0x2bbd1a['id']||0x0;this[_0xf559('0x8')]=_0x2bbd1a['name']||'';this['monitor_format']=_0x2bbd1a[_0xf559('0x9')]||'';this['type']=_0x2bbd1a[_0xf559('0xa')]||_0xf559('0xb');this[_0xf559('0xc')]=0x0;this[_0xf559('0xd')]=0x0;this[_0xf559('0xe')]=0x0;this[_0xf559('0xf')]=0x0;this[_0xf559('0x10')]=0x0;this[_0xf559('0x11')]=0x0;this['unmanaged']=0x0;this[_0xf559('0x12')]=0x0;this[_0xf559('0x13')]=0x0;this['busy']=0x0;this[_0xf559('0x14')]=0x0;this[_0xf559('0x15')]=0x0;this['loggedIn']=0x0;this[_0xf559('0x16')]=0x0;this[_0xf559('0x17')]=0x0;this[_0xf559('0x18')]=0x0;this['ringing']=0x0;this[_0xf559('0x19')]=0x0;this[_0xf559('0x1a')]=0x0;this[_0xf559('0x1b')]=0x0;this[_0xf559('0x1c')]=0x0;this[_0xf559('0x1d')]=_0x2bbd1a[_0xf559('0x1d')]||![];this[_0xf559('0x1e')]=_0x2bbd1a[_0xf559('0x1e')]||0xa;this[_0xf559('0x1f')]=_0x2bbd1a[_0xf559('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xf559('0x20')]='';this[_0xf559('0x21')]=0x0;this[_0xf559('0x22')]=0x0;this[_0xf559('0x23')]=_0x2bbd1a['dialTimezone']||null;this[_0xf559('0x24')]=_0x2bbd1a[_0xf559('0x24')]?_0x2bbd1a[_0xf559('0x24')]:null;this[_0xf559('0x25')]=_0x2bbd1a[_0xf559('0x25')];this['dialMethod']=_0x2bbd1a[_0xf559('0x26')]||'progressive';this[_0xf559('0x27')]=_0x2bbd1a['dialLimitChannel']||0x0;this[_0xf559('0x28')]=_0x2bbd1a[_0xf559('0x28')]||0x0;this[_0xf559('0x29')]=_0x2bbd1a[_0xf559('0x29')]||0x1;this[_0xf559('0x2a')]=_0x2bbd1a[_0xf559('0x2a')]||_0xf559('0x2b');this[_0xf559('0x2c')]=_0x2bbd1a[_0xf559('0x2c')]||0.03;this['dialPredictiveInterval']=_0x2bbd1a[_0xf559('0x2d')]||0x258;this['dialOriginateCallerIdName']=_0x2bbd1a[_0xf559('0x2e')]||_0xf559('0x2f');this[_0xf559('0x30')]=_0x2bbd1a['dialOriginateCallerIdNumber']||'anonymous';this[_0xf559('0x31')]=_0x2bbd1a[_0xf559('0x31')]||0x1e;this[_0xf559('0x32')]=_0x2bbd1a['dialQueueOptions']||_0xf559('0x33');this[_0xf559('0x34')]=_0x2bbd1a[_0xf559('0x34')]||0x3;this['dialQueueProject']=_0x2bbd1a[_0xf559('0x35')]||undefined;this[_0xf559('0x36')]=_0x2bbd1a[_0xf559('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x2bbd1a[_0xf559('0x37')]||0x96;this[_0xf559('0x38')]=_0x2bbd1a['dialBusyMaxRetry']||0x3;this[_0xf559('0x39')]=_0x2bbd1a[_0xf559('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x2bbd1a[_0xf559('0x3a')]||0x3;this[_0xf559('0x3b')]=_0x2bbd1a['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x2bbd1a['dialNoSuchNumberMaxRetry']||0x3;this[_0xf559('0x3c')]=_0x2bbd1a[_0xf559('0x3c')]||0x96;this['dialDropMaxRetry']=_0x2bbd1a[_0xf559('0x3d')]||0x3;this[_0xf559('0x3e')]=_0x2bbd1a[_0xf559('0x3e')]||0x96;this[_0xf559('0x3f')]=_0x2bbd1a[_0xf559('0x3f')]||0x3;this[_0xf559('0x40')]=_0x2bbd1a[_0xf559('0x40')]||0x96;this['dialMachineMaxRetry']=_0x2bbd1a[_0xf559('0x41')]||0x3;this[_0xf559('0x42')]=_0x2bbd1a[_0xf559('0x42')]||0x96;this[_0xf559('0x43')]=_0x2bbd1a[_0xf559('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2bbd1a[_0xf559('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2bbd1a[_0xf559('0x45')]||0x3;this[_0xf559('0x46')]=_0x2bbd1a[_0xf559('0x46')]||0x4;this[_0xf559('0x47')]=_0x2bbd1a[_0xf559('0x47')]?_0x2bbd1a[_0xf559('0x47')]:undefined;this[_0xf559('0x48')]=_0x2bbd1a[_0xf559('0x48')]?_0x2bbd1a[_0xf559('0x48')]:undefined;this[_0xf559('0x49')]=_0x2bbd1a[_0xf559('0x49')]||undefined;this['Interval']=_0x2bbd1a[_0xf559('0x4a')]?_0x2bbd1a['Interval']:undefined;this[_0xf559('0x4b')]=_0x2bbd1a[_0xf559('0x4b')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x2bbd1a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf559('0x4c')]=_0x2bbd1a[_0xf559('0x4c')]||undefined;this[_0xf559('0x4d')]=strategy[_0x2bbd1a[_0xf559('0x4d')]];this[_0xf559('0x4e')]=!![];this[_0xf559('0x4f')]=_0x2bbd1a['dialAMDActive']||![];this[_0xf559('0x50')]=_0x2bbd1a['dialAMDInitialSilence'];this[_0xf559('0x51')]=_0x2bbd1a['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2bbd1a[_0xf559('0x52')];this[_0xf559('0x53')]=_0x2bbd1a[_0xf559('0x53')];this[_0xf559('0x54')]=_0x2bbd1a[_0xf559('0x54')];this['dialAMDBetweenWordsSilence']=_0x2bbd1a[_0xf559('0x55')];this[_0xf559('0x56')]=_0x2bbd1a[_0xf559('0x56')];this[_0xf559('0x57')]=_0x2bbd1a[_0xf559('0x57')];this[_0xf559('0x58')]=_0x2bbd1a[_0xf559('0x58')];this[_0xf559('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x2bbd1a['timeout'];this[_0xf559('0x5a')]=0x0;this[_0xf559('0x5b')]=0x0;this[_0xf559('0x5c')]=0x0;this[_0xf559('0x5d')]=0x0;this[_0xf559('0x5e')]=0x0;this[_0xf559('0x5f')]=0x0;this[_0xf559('0x60')]=0x0;this[_0xf559('0x61')]=0x0;this[_0xf559('0x62')]=0x0;this[_0xf559('0x63')]=0x0;this[_0xf559('0x64')]=0x0;this[_0xf559('0x65')]=0x0;this[_0xf559('0x66')]=0x0;this[_0xf559('0x67')]=0x0;this[_0xf559('0x68')]=undefined;this[_0xf559('0x69')]=undefined;this[_0xf559('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf559('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xf559('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf559('0x6d')]=0x0;this[_0xf559('0x6e')]=0x0;this[_0xf559('0x6f')]=0x0;this[_0xf559('0x70')]=_0x2bbd1a[_0xf559('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x2bbd1a[_0xf559('0x71')]||0xa;this[_0xf559('0x72')]=0x0;this[_0xf559('0x73')]=0x0;this[_0xf559('0x74')]=0x1;this[_0xf559('0x75')]=0x0;this[_0xf559('0x76')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xf559('0x77')]=0x0;this['dialRecallMeTimeout']=_0x2bbd1a[_0xf559('0x78')]||0x1e;this[_0xf559('0x79')]=_0x2bbd1a[_0xf559('0x79')]||![];this['dialPreviewAutoRecallMe']=!!_0x2bbd1a[_0xf559('0x7a')]||![];this[_0xf559('0x7b')]=!!_0x2bbd1a['dialPreviewRecallmeReminder']||![];this[_0xf559('0x7c')]=_0x2bbd1a['dialQueueProject2']||undefined;this[_0xf559('0x7d')]=_0x2bbd1a[_0xf559('0x7d')]||![];this[_0xf559('0x7e')]=_0x2bbd1a[_0xf559('0x7e')]||![];this[_0xf559('0x9')]=monitorFormat[_0x2bbd1a[_0xf559('0x9')]]?monitorFormat[_0x2bbd1a[_0xf559('0x9')]]:undefined;this[_0xf559('0x7f')]=_0x2bbd1a[_0xf559('0x7f')]||![];this['mandatoryDispositionPause']=_0x2bbd1a[_0xf559('0x80')]?_0x2bbd1a[_0xf559('0x80')]:undefined;this[_0xf559('0x81')]=![];}module[_0xf559('0x82')]=VoiceQueue; \ No newline at end of file +var _0x81c6=['sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','sumDuration','sumBillable','unmanaged','abandoned','available','invalid','loggedIn','notInUse','paused','ringInUse','unavailable','unknown','acw','acwTimeout','autopause'];(function(_0x1ac4a6,_0x352e44){var _0x26b599=function(_0x32f36b){while(--_0x32f36b){_0x1ac4a6['push'](_0x1ac4a6['shift']());}};_0x26b599(++_0x352e44);}(_0x81c6,0x1d5));var _0x681c=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x81c6[_0x1064bc];return _0x5edc45;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x681c('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0x681c('0x1'),'random':_0x681c('0x2'),'ringall':_0x681c('0x3'),'rr':'roundrobin','rrmemory':_0x681c('0x4'),'rrordered':_0x681c('0x5'),'wrandom':_0x681c('0x6')};function VoiceQueue(_0x1d31c8){this['id']=_0x1d31c8['id']||0x0;this['name']=_0x1d31c8[_0x681c('0x7')]||'';this[_0x681c('0x8')]=_0x1d31c8['monitor_format']||'';this['type']=_0x1d31c8[_0x681c('0x9')]||_0x681c('0xa');this[_0x681c('0xb')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x681c('0xc')]=0x0;this['sumHoldTime']=0x0;this[_0x681c('0xd')]=0x0;this[_0x681c('0xe')]=0x0;this[_0x681c('0xf')]=0x0;this[_0x681c('0x10')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x681c('0x11')]=0x0;this[_0x681c('0x12')]=0x0;this[_0x681c('0x13')]=0x0;this['onHold']=0x0;this[_0x681c('0x14')]=0x0;this['ringing']=0x0;this[_0x681c('0x15')]=0x0;this['talking']=0x0;this[_0x681c('0x16')]=0x0;this[_0x681c('0x17')]=0x0;this[_0x681c('0x18')]=_0x1d31c8[_0x681c('0x18')]||![];this[_0x681c('0x19')]=_0x1d31c8[_0x681c('0x19')]||0xa;this['autopause']=_0x1d31c8[_0x681c('0x1a')]||'no';this[_0x681c('0x1b')]=!![];this[_0x681c('0x1c')]='';this[_0x681c('0x1d')]='';this[_0x681c('0x1e')]=0x0;this[_0x681c('0x1f')]=0x0;this['dialTimezone']=_0x1d31c8[_0x681c('0x20')]||null;this[_0x681c('0x21')]=_0x1d31c8[_0x681c('0x21')]?_0x1d31c8[_0x681c('0x21')]:null;this['dialActive']=_0x1d31c8[_0x681c('0x22')];this[_0x681c('0x23')]=_0x1d31c8['dialMethod']||_0x681c('0x24');this['dialLimitChannel']=_0x1d31c8[_0x681c('0x25')]||0x0;this[_0x681c('0x26')]=_0x1d31c8[_0x681c('0x26')]||0x0;this[_0x681c('0x27')]=_0x1d31c8[_0x681c('0x27')]||0x1;this['dialPredictiveOptimization']=_0x1d31c8['dialPredictiveOptimization']||'dropRate';this[_0x681c('0x28')]=_0x1d31c8[_0x681c('0x28')]||0.03;this[_0x681c('0x29')]=_0x1d31c8[_0x681c('0x29')]||0x258;this[_0x681c('0x2a')]=_0x1d31c8[_0x681c('0x2a')]||_0x681c('0x2b');this[_0x681c('0x2c')]=_0x1d31c8[_0x681c('0x2c')]||_0x681c('0x2b');this[_0x681c('0x2d')]=_0x1d31c8[_0x681c('0x2d')]||0x1e;this[_0x681c('0x2e')]=_0x1d31c8[_0x681c('0x2e')]||_0x681c('0x2f');this[_0x681c('0x30')]=_0x1d31c8['dialQueueTimeout']||0x3;this[_0x681c('0x31')]=_0x1d31c8['dialQueueProject']||undefined;this[_0x681c('0x32')]=_0x1d31c8['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x1d31c8[_0x681c('0x33')]||0x96;this[_0x681c('0x34')]=_0x1d31c8[_0x681c('0x34')]||0x3;this[_0x681c('0x35')]=_0x1d31c8['dialBusyRetryFrequency']||0x96;this[_0x681c('0x36')]=_0x1d31c8[_0x681c('0x36')]||0x3;this[_0x681c('0x37')]=_0x1d31c8[_0x681c('0x37')]||0x96;this[_0x681c('0x38')]=_0x1d31c8[_0x681c('0x38')]||0x3;this[_0x681c('0x39')]=_0x1d31c8['dialNoSuchNumberRetryFrequency']||0x96;this[_0x681c('0x3a')]=_0x1d31c8[_0x681c('0x3a')]||0x3;this[_0x681c('0x3b')]=_0x1d31c8['dialDropRetryFrequency']||0x96;this[_0x681c('0x3c')]=_0x1d31c8[_0x681c('0x3c')]||0x3;this[_0x681c('0x3d')]=_0x1d31c8['dialAbandonedRetryFrequency']||0x96;this[_0x681c('0x3e')]=_0x1d31c8['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1d31c8[_0x681c('0x3f')]||0x96;this[_0x681c('0x40')]=_0x1d31c8[_0x681c('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1d31c8[_0x681c('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1d31c8[_0x681c('0x42')]||0x3;this['dialGlobalMaxRetry']=_0x1d31c8['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x1d31c8[_0x681c('0x43')]?_0x1d31c8[_0x681c('0x43')]:undefined;this['TrunkBackup']=_0x1d31c8[_0x681c('0x44')]?_0x1d31c8['TrunkBackup']:undefined;this['dialPrefix']=_0x1d31c8[_0x681c('0x45')]||undefined;this['Interval']=_0x1d31c8[_0x681c('0x46')]?_0x1d31c8[_0x681c('0x46')]:undefined;this[_0x681c('0x47')]=_0x1d31c8['dialOrderByScheduledAt']||'DESC';this[_0x681c('0x48')]=_0x1d31c8[_0x681c('0x48')]||undefined;this['dialCutDigit']=_0x1d31c8[_0x681c('0x49')]||undefined;this[_0x681c('0x4a')]=strategy[_0x1d31c8[_0x681c('0x4a')]];this['queueStatusComplete']=!![];this[_0x681c('0x4b')]=_0x1d31c8[_0x681c('0x4b')]||![];this['dialAMDInitialSilence']=_0x1d31c8[_0x681c('0x4c')];this[_0x681c('0x4d')]=_0x1d31c8[_0x681c('0x4d')];this[_0x681c('0x4e')]=_0x1d31c8[_0x681c('0x4e')];this['dialAMDTotalAnalysisTime']=_0x1d31c8['dialAMDTotalAnalysisTime'];this[_0x681c('0x4f')]=_0x1d31c8[_0x681c('0x4f')];this['dialAMDBetweenWordsSilence']=_0x1d31c8[_0x681c('0x50')];this[_0x681c('0x51')]=_0x1d31c8['dialAMDMaximumNumberOfWords'];this[_0x681c('0x52')]=_0x1d31c8[_0x681c('0x52')];this[_0x681c('0x53')]=_0x1d31c8[_0x681c('0x53')];this[_0x681c('0x54')]=0x0;this[_0x681c('0x55')]=0x0;this[_0x681c('0x56')]=_0x1d31c8[_0x681c('0x56')];this[_0x681c('0x57')]=0x0;this[_0x681c('0x58')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x681c('0x59')]=0x0;this[_0x681c('0x5a')]=0x0;this[_0x681c('0x5b')]=0x0;this[_0x681c('0x5c')]=0x0;this[_0x681c('0x5d')]=0x0;this[_0x681c('0x5e')]=0x0;this[_0x681c('0x5f')]=0x0;this[_0x681c('0x60')]=0x0;this[_0x681c('0x61')]=0x0;this[_0x681c('0x62')]=0x0;this[_0x681c('0x63')]=0x0;this[_0x681c('0x64')]=undefined;this['startPredictive']=undefined;this[_0x681c('0x65')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x681c('0x66')]=0x0;this[_0x681c('0x67')]=0x0;this[_0x681c('0x68')]=0x0;this[_0x681c('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x681c('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x1d31c8[_0x681c('0x6b')]||0x14;this[_0x681c('0x6c')]=_0x1d31c8[_0x681c('0x6b')]||0xa;this[_0x681c('0x6d')]=0x0;this[_0x681c('0x6e')]=0x0;this[_0x681c('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x681c('0x70')]=0x0;this[_0x681c('0x71')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x1d31c8[_0x681c('0x72')]||0x1e;this['dialRecallInQueue']=_0x1d31c8[_0x681c('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x1d31c8['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x1d31c8[_0x681c('0x74')]||![];this[_0x681c('0x75')]=_0x1d31c8[_0x681c('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x1d31c8[_0x681c('0x76')]||![];this[_0x681c('0x77')]=_0x1d31c8['dialAgiAfterHangupAgent']||![];this[_0x681c('0x8')]=monitorFormat[_0x1d31c8[_0x681c('0x8')]]?monitorFormat[_0x1d31c8[_0x681c('0x8')]]:undefined;this[_0x681c('0x78')]=_0x1d31c8['mandatoryDisposition']||![];this[_0x681c('0x79')]=_0x1d31c8['mandatoryDispositionPause']?_0x1d31c8[_0x681c('0x79')]:undefined;this[_0x681c('0x7a')]=![];}module[_0x681c('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index b5f7fc9..5ddfff1 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9a=['dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','talking','waiting','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x36cb1e,_0x3ae2d0){_0x36cb1e=_0x36cb1e-0x0;var _0x253b39=_0x1c9a[_0x36cb1e];return _0x253b39;};'use strict';var INBOUND_COUNTERS=[_0xa1c9('0x0'),_0xa1c9('0x1'),'loggedInDb',_0xa1c9('0x2'),_0xa1c9('0x3'),_0xa1c9('0x4'),_0xa1c9('0x5')];var OUTBOUND_COUNTERS=[_0xa1c9('0x0'),'answered',_0xa1c9('0x6'),'loggedIn',_0xa1c9('0x7'),_0xa1c9('0x8'),_0xa1c9('0x9'),_0xa1c9('0xa'),_0xa1c9('0xb'),_0xa1c9('0xc'),_0xa1c9('0xd'),_0xa1c9('0xe'),_0xa1c9('0xf'),_0xa1c9('0x10'),_0xa1c9('0x11'),_0xa1c9('0x12'),'paused','pTalking',_0xa1c9('0x4'),'sumBillable',_0xa1c9('0x13'),_0xa1c9('0x14'),_0xa1c9('0x5')];function VoiceQueueSummary(_0x3ba437){this['id']=_0x3ba437['id'];this[_0xa1c9('0x15')]=_0x3ba437[_0xa1c9('0x15')];this[_0xa1c9('0x16')]=_0x3ba437[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3ba437[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3ba437[_0xa1c9('0x18')]||0x0;this[_0xa1c9('0x0')]=_0x3ba437[_0xa1c9('0x0')]||0x0;this[_0xa1c9('0x19')]=_0x3ba437[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x6')]=_0x3ba437[_0xa1c9('0x6')]||0x0;this[_0xa1c9('0x1a')]=_0x3ba437[_0xa1c9('0x1a')]||0x0;this['loggedIn']=_0x3ba437[_0xa1c9('0x1')]||0x0;this['loggedInDb']=_0x3ba437[_0xa1c9('0x7')]||0x0;this[_0xa1c9('0x1b')]=_0x3ba437[_0xa1c9('0x1b')]||0x0;this[_0xa1c9('0x1c')]=_0x3ba437[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x2')]=_0x3ba437[_0xa1c9('0x2')]||0x0;this[_0xa1c9('0x3')]=_0x3ba437[_0xa1c9('0x3')]||0x0;this[_0xa1c9('0x1d')]=_0x3ba437[_0xa1c9('0x1d')];this[_0xa1c9('0x1e')]=_0x3ba437['sumBillable'];this[_0xa1c9('0x13')]=_0x3ba437[_0xa1c9('0x13')];this[_0xa1c9('0x1f')]=_0x3ba437[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x4')]=_0x3ba437[_0xa1c9('0x4')]||0x0;this[_0xa1c9('0x14')]=_0x3ba437[_0xa1c9('0x14')]||0x0;this['type']=_0x3ba437[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3ba437['unavailable']||0x0;this[_0xa1c9('0x22')]=_0x3ba437[_0xa1c9('0x22')]||0x0;this[_0xa1c9('0x23')]=_0x3ba437[_0xa1c9('0x23')]||0x0;this[_0xa1c9('0x5')]=_0x3ba437['waiting']||0x0;if(_0x3ba437[_0xa1c9('0x20')]===_0xa1c9('0x24')){this[_0xa1c9('0x25')]=_0x3ba437['pTalking']||0x0;this[_0xa1c9('0x26')]=_0x3ba437[_0xa1c9('0x26')];this[_0xa1c9('0x27')]=_0x3ba437[_0xa1c9('0x27')];this[_0xa1c9('0x28')]=_0x3ba437[_0xa1c9('0x28')];this[_0xa1c9('0x29')]=_0x3ba437[_0xa1c9('0x29')];this[_0xa1c9('0x2a')]=_0x3ba437[_0xa1c9('0x2a')];this[_0xa1c9('0x2b')]=_0x3ba437[_0xa1c9('0x2b')];this[_0xa1c9('0x2c')]=_0x3ba437[_0xa1c9('0x2c')];this[_0xa1c9('0x2d')]=_0x3ba437[_0xa1c9('0x2d')];this['outboundAnswerCallsDay']=_0x3ba437[_0xa1c9('0xa')];this[_0xa1c9('0xb')]=_0x3ba437[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x3ba437[_0xa1c9('0xc')];this['outboundCongestionCallsDay']=_0x3ba437[_0xa1c9('0xd')];this[_0xa1c9('0x2e')]=_0x3ba437['outboundDropCallsDayACS'];this[_0xa1c9('0x2f')]=_0x3ba437[_0xa1c9('0x2f')];this[_0xa1c9('0x30')]=_0x3ba437[_0xa1c9('0x30')];this[_0xa1c9('0xe')]=_0x3ba437[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x3ba437[_0xa1c9('0xf')];this[_0xa1c9('0x31')]=_0x3ba437[_0xa1c9('0x31')];this[_0xa1c9('0x10')]=_0x3ba437[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x3ba437[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x3ba437['outboundUnknownCallsDay'];this[_0xa1c9('0x32')]=_0x3ba437[_0xa1c9('0x32')];this[_0xa1c9('0x33')]=_0x3ba437[_0xa1c9('0x33')];this['predictiveIntervalAvgTalktime']=_0x3ba437[_0xa1c9('0x34')];this[_0xa1c9('0x35')]=_0x3ba437['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x3ba437[_0xa1c9('0x36')];this[_0xa1c9('0x37')]=_0x3ba437[_0xa1c9('0x37')];this[_0xa1c9('0x38')]=_0x3ba437[_0xa1c9('0x38')];this[_0xa1c9('0x39')]=_0x3ba437[_0xa1c9('0x39')];this[_0xa1c9('0x3a')]=_0x3ba437[_0xa1c9('0x3a')];this[_0xa1c9('0x3b')]=_0x3ba437[_0xa1c9('0x3b')];this['predictiveIntervalAvailable']=_0x3ba437[_0xa1c9('0x3c')];this[_0xa1c9('0x3d')]=_0x3ba437[_0xa1c9('0x3d')];this[_0xa1c9('0x8')]=_0x3ba437[_0xa1c9('0x8')];this[_0xa1c9('0x3e')]=_0x3ba437[_0xa1c9('0x3e')];this[_0xa1c9('0x3f')]=_0x3ba437['erlangCallToSecond'];this[_0xa1c9('0x40')]=_0x3ba437[_0xa1c9('0x40')];this[_0xa1c9('0x41')]=_0x3ba437['erlangBusyFactor'];this[_0xa1c9('0x42')]=_0x3ba437[_0xa1c9('0x42')];this[_0xa1c9('0x43')]=_0x3ba437[_0xa1c9('0x43')];this[_0xa1c9('0x44')]=_0x3ba437[_0xa1c9('0x44')];this[_0xa1c9('0x45')]=_0x3ba437['statusMessage'];}if(_0x3ba437[_0xa1c9('0x46')]){this['Trunk']={'id':_0x3ba437[_0xa1c9('0x46')]['id'],'name':_0x3ba437['Trunk'][_0xa1c9('0x15')],'active':_0x3ba437[_0xa1c9('0x46')][_0xa1c9('0x47')],'callerid':_0x3ba437['Trunk'][_0xa1c9('0x48')]};}}VoiceQueueSummary['prototype'][_0xa1c9('0x49')]=function(_0x57ed69,_0x5c1cc6,_0x174f76,_0x5a6c4d){this[_0xa1c9('0x7')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0xa1c9('0x22')]=0x0;this[_0xa1c9('0x1c')]=0x0;this[_0xa1c9('0x6')]=0x0;this[_0xa1c9('0x19')]=0x0;this['invalid']=0x0;this[_0xa1c9('0x21')]=0x0;this['ringing']=0x0;this[_0xa1c9('0x1d')]=0x0;this[_0xa1c9('0x1b')]=0x0;if(_0x174f76){if(_0x174f76[_0xa1c9('0x0')]){this[_0xa1c9('0x0')]=Number(_0x174f76[_0xa1c9('0x0')]);}if(_0x174f76[_0xa1c9('0x4a')]){this[_0xa1c9('0x1')]=Number(_0x174f76[_0xa1c9('0x4a')]);}if(_0x174f76[_0xa1c9('0x4b')]){this[_0xa1c9('0x5')]=Number(_0x174f76['callers']);}}for(var _0x46b234=0x0;_0x46b234<_0x57ed69[_0xa1c9('0x4c')];_0x46b234++){var _0xf80047=_0x5c1cc6[_0xa1c9('0x4d')+_0x57ed69[_0x46b234][_0xa1c9('0x15')]];if(_0xf80047&&_0xf80047[_0xa1c9('0x4e')]){this[_0xa1c9('0x7')]+=0x1;}if(_0x57ed69[_0x46b234][_0xa1c9('0x4f')]==='1'){this[_0xa1c9('0x4')]+=0x1;}if(_0x57ed69[_0x46b234]['paused']==='1'&&!['2','7','8'][_0xa1c9('0x50')](_0x57ed69[_0x46b234][_0xa1c9('0x51')])){this['paused']+=0x1;}switch(_0x57ed69[_0x46b234][_0xa1c9('0x51')]){case'0':this[_0xa1c9('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xa1c9('0x6')]+=0x1;break;case'3':this[_0xa1c9('0x19')]+=0x1;break;case'4':this[_0xa1c9('0x1a')]+=0x1;break;case'5':this[_0xa1c9('0x21')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xa1c9('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xa1c9('0x27')]==='booked'){var _0x3656bd=Object[_0xa1c9('0x52')](_0x5a6c4d);for(var _0x6d28a1=0x0;_0x6d28a1<_0x3656bd[_0xa1c9('0x4c')];_0x6d28a1++){var _0x226a65=_0x3656bd[_0x6d28a1];var _0x3b530e=_0x5a6c4d[_0x226a65];if(_0x3b530e[_0xa1c9('0x53')]===this[_0xa1c9('0x15')]&&_0x3b530e[_0xa1c9('0x20')]===_0xa1c9('0x54')&&_0x3b530e[_0xa1c9('0x55')]===_0xa1c9('0x56')){this[_0xa1c9('0x4')]+=0x1;}}if(this[_0xa1c9('0x4')]>this[_0xa1c9('0x6')]){this['talking']=this[_0xa1c9('0x6')];}this[_0xa1c9('0x25')]=0x0;}return this;};VoiceQueueSummary[_0xa1c9('0x57')][_0xa1c9('0x58')]=function(_0x524a47){var _0x31f814=![];if(_0x524a47){_0x31f814=INBOUND_COUNTERS[_0xa1c9('0x59')](function(_0x2cfba4){return this[_0x2cfba4]!==_0x524a47[_0x2cfba4];},this);}return _0x31f814;};VoiceQueueSummary[_0xa1c9('0x57')]['compareToOutboundQueue']=function(_0x2aa6a1){var _0x1aadc5=![];var _0x143471=![];var _0xe6ce7c=![];if(_0x2aa6a1){_0x1aadc5=this[_0xa1c9('0x27')]!==_0x2aa6a1[_0xa1c9('0x27')]||this['dialActive']!==_0x2aa6a1[_0xa1c9('0x26')]||this[_0xa1c9('0x44')]!==_0x2aa6a1[_0xa1c9('0x44')]||this[_0xa1c9('0x45')]!==_0x2aa6a1[_0xa1c9('0x45')];_0x143471=OUTBOUND_COUNTERS[_0xa1c9('0x59')](function(_0x50448a){return this[_0x50448a]!==_0x2aa6a1[_0x50448a];},this);if(this['Trunk']&&_0x2aa6a1[_0xa1c9('0x46')]){_0xe6ce7c=this['Trunk']['name']!==_0x2aa6a1[_0xa1c9('0x46')][_0xa1c9('0x15')]||this[_0xa1c9('0x46')]['active']!==_0x2aa6a1['Trunk'][_0xa1c9('0x47')];}}return _0x1aadc5||_0x143471||_0xe6ce7c;};VoiceQueueSummary['prototype'][_0xa1c9('0x5a')]=function(_0x6a9ac5){this[_0xa1c9('0x18')]=_0x6a9ac5['answered'];this[_0xa1c9('0x44')]=_0x6a9ac5[_0xa1c9('0x44')];this[_0xa1c9('0x45')]=_0x6a9ac5[_0xa1c9('0x45')];this[_0xa1c9('0x8')]=_0x6a9ac5['originated'];this[_0xa1c9('0x9')]=_0x6a9ac5['outboundAbandonedCallsDay'];this[_0xa1c9('0xa')]=_0x6a9ac5['outboundAnswerCallsDay'];this[_0xa1c9('0xb')]=_0x6a9ac5[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x6a9ac5[_0xa1c9('0xc')];this['outboundCongestionCallsDay']=_0x6a9ac5[_0xa1c9('0xd')];this['outboundNoAnswerCallsDay']=_0x6a9ac5[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x6a9ac5[_0xa1c9('0xf')];this[_0xa1c9('0x10')]=_0x6a9ac5[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x6a9ac5[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x6a9ac5[_0xa1c9('0x12')];this[_0xa1c9('0x1e')]=_0x6a9ac5[_0xa1c9('0x1e')];this[_0xa1c9('0x13')]=_0x6a9ac5[_0xa1c9('0x13')];this[_0xa1c9('0x14')]=_0x6a9ac5['total'];if(this['dialMethod']===_0xa1c9('0x5b')){this[_0xa1c9('0x25')]=_0x6a9ac5[_0xa1c9('0x25')];}};module[_0xa1c9('0x5c')]=VoiceQueueSummary; \ No newline at end of file +var _0x6eed=['paused','ringing','waiting','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport','unavailable','callers','length','SIP/','incall','status','booked','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','active','preview','exports','available','loggedIn','loggedInDb'];(function(_0x5be167,_0x2ff2d0){var _0x8eb523=function(_0x2dd087){while(--_0x2dd087){_0x5be167['push'](_0x5be167['shift']());}};_0x8eb523(++_0x2ff2d0);}(_0x6eed,0xff));var _0xd6ee=function(_0x5d0720,_0x238fc5){_0x5d0720=_0x5d0720-0x0;var _0x2b98b5=_0x6eed[_0x5d0720];return _0x2b98b5;};'use strict';var INBOUND_COUNTERS=[_0xd6ee('0x0'),_0xd6ee('0x1'),_0xd6ee('0x2'),_0xd6ee('0x3'),_0xd6ee('0x4'),'talking',_0xd6ee('0x5')];var OUTBOUND_COUNTERS=[_0xd6ee('0x0'),'answered','inUse',_0xd6ee('0x1'),_0xd6ee('0x2'),_0xd6ee('0x6'),_0xd6ee('0x7'),_0xd6ee('0x8'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xd6ee('0x9'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay',_0xd6ee('0xa'),_0xd6ee('0xb'),'paused',_0xd6ee('0xc'),_0xd6ee('0xd'),_0xd6ee('0xe'),_0xd6ee('0xf'),'total',_0xd6ee('0x5')];function VoiceQueueSummary(_0x45b276){this['id']=_0x45b276['id'];this[_0xd6ee('0x10')]=_0x45b276[_0xd6ee('0x10')];this[_0xd6ee('0x11')]=_0x45b276[_0xd6ee('0x11')];this['abandoned']=_0x45b276[_0xd6ee('0x12')]||0x0;this[_0xd6ee('0x13')]=_0x45b276['answered']||0x0;this[_0xd6ee('0x0')]=_0x45b276[_0xd6ee('0x0')]||0x0;this[_0xd6ee('0x14')]=_0x45b276[_0xd6ee('0x14')]||0x0;this[_0xd6ee('0x15')]=_0x45b276[_0xd6ee('0x15')]||0x0;this['invalid']=_0x45b276[_0xd6ee('0x16')]||0x0;this[_0xd6ee('0x1')]=_0x45b276[_0xd6ee('0x1')]||0x0;this['loggedInDb']=_0x45b276[_0xd6ee('0x2')]||0x0;this['onHold']=_0x45b276[_0xd6ee('0x17')]||0x0;this[_0xd6ee('0x18')]=_0x45b276[_0xd6ee('0x18')]||0x0;this['paused']=_0x45b276[_0xd6ee('0x3')]||0x0;this['ringing']=_0x45b276[_0xd6ee('0x4')]||0x0;this['ringInUse']=_0x45b276[_0xd6ee('0x19')];this[_0xd6ee('0xe')]=_0x45b276[_0xd6ee('0xe')];this[_0xd6ee('0xf')]=_0x45b276[_0xd6ee('0xf')];this['sumHoldTime']=_0x45b276[_0xd6ee('0x1a')]||0x0;this['talking']=_0x45b276[_0xd6ee('0xd')]||0x0;this[_0xd6ee('0x1b')]=_0x45b276[_0xd6ee('0x1b')]||0x0;this[_0xd6ee('0x1c')]=_0x45b276[_0xd6ee('0x1c')];this['unavailable']=_0x45b276['unavailable']||0x0;this[_0xd6ee('0x1d')]=_0x45b276['unknown']||0x0;this[_0xd6ee('0x1e')]=_0x45b276['unmanaged']||0x0;this[_0xd6ee('0x5')]=_0x45b276[_0xd6ee('0x5')]||0x0;if(_0x45b276[_0xd6ee('0x1c')]===_0xd6ee('0x1f')){this[_0xd6ee('0xc')]=_0x45b276['pTalking']||0x0;this['dialActive']=_0x45b276[_0xd6ee('0x20')];this[_0xd6ee('0x21')]=_0x45b276['dialMethod'];this[_0xd6ee('0x22')]=_0x45b276[_0xd6ee('0x22')];this[_0xd6ee('0x23')]=_0x45b276[_0xd6ee('0x23')];this[_0xd6ee('0x24')]=_0x45b276[_0xd6ee('0x24')];this[_0xd6ee('0x25')]=_0x45b276['dialPrefix'];this[_0xd6ee('0x26')]=_0x45b276[_0xd6ee('0x26')];this['outboundAnswerAgiCallsDay']=_0x45b276['outboundAnswerAgiCallsDay'];this[_0xd6ee('0x8')]=_0x45b276[_0xd6ee('0x8')];this[_0xd6ee('0x27')]=_0x45b276[_0xd6ee('0x27')];this[_0xd6ee('0x28')]=_0x45b276['outboundBusyCallsDay'];this[_0xd6ee('0x9')]=_0x45b276[_0xd6ee('0x9')];this[_0xd6ee('0x29')]=_0x45b276['outboundDropCallsDayACS'];this[_0xd6ee('0x2a')]=_0x45b276[_0xd6ee('0x2a')];this[_0xd6ee('0x2b')]=_0x45b276['outboundDropCallsDayTimeout'];this[_0xd6ee('0x2c')]=_0x45b276[_0xd6ee('0x2c')];this[_0xd6ee('0x2d')]=_0x45b276[_0xd6ee('0x2d')];this[_0xd6ee('0x2e')]=_0x45b276[_0xd6ee('0x2e')];this['outboundReCallsDay']=_0x45b276[_0xd6ee('0x2f')];this[_0xd6ee('0xa')]=_0x45b276[_0xd6ee('0xa')];this[_0xd6ee('0xb')]=_0x45b276['outboundUnknownCallsDay'];this[_0xd6ee('0x30')]=_0x45b276[_0xd6ee('0x30')];this[_0xd6ee('0x31')]=_0x45b276['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x45b276[_0xd6ee('0x32')];this[_0xd6ee('0x33')]=_0x45b276[_0xd6ee('0x33')];this[_0xd6ee('0x34')]=_0x45b276[_0xd6ee('0x34')];this[_0xd6ee('0x35')]=_0x45b276[_0xd6ee('0x35')];this[_0xd6ee('0x36')]=_0x45b276[_0xd6ee('0x36')];this[_0xd6ee('0x37')]=_0x45b276[_0xd6ee('0x37')];this[_0xd6ee('0x38')]=_0x45b276[_0xd6ee('0x38')];this[_0xd6ee('0x39')]=_0x45b276[_0xd6ee('0x39')];this['predictiveIntervalAvailable']=_0x45b276[_0xd6ee('0x3a')];this[_0xd6ee('0x3b')]=_0x45b276[_0xd6ee('0x3b')];this['originated']=_0x45b276['originated'];this['erlangCalls']=_0x45b276['erlangCalls'];this[_0xd6ee('0x3c')]=_0x45b276[_0xd6ee('0x3c')];this[_0xd6ee('0x3d')]=_0x45b276[_0xd6ee('0x3d')];this[_0xd6ee('0x3e')]=_0x45b276[_0xd6ee('0x3e')];this[_0xd6ee('0x3f')]=_0x45b276['startPredictive'];this[_0xd6ee('0x40')]=_0x45b276[_0xd6ee('0x40')];this[_0xd6ee('0x41')]=_0x45b276[_0xd6ee('0x41')];this[_0xd6ee('0x42')]=_0x45b276[_0xd6ee('0x42')];}if(_0x45b276[_0xd6ee('0x43')]){this[_0xd6ee('0x43')]={'id':_0x45b276[_0xd6ee('0x43')]['id'],'name':_0x45b276[_0xd6ee('0x43')]['name'],'active':_0x45b276['Trunk']['active'],'callerid':_0x45b276[_0xd6ee('0x43')]['callerid']};}}VoiceQueueSummary[_0xd6ee('0x44')][_0xd6ee('0x45')]=function(_0x96aa7f,_0x45e974,_0xcf9ea1,_0x49174a){this['loggedInDb']=0x0;this['talking']=0x0;this['paused']=0x0;this[_0xd6ee('0x1d')]=0x0;this[_0xd6ee('0x18')]=0x0;this[_0xd6ee('0x15')]=0x0;this[_0xd6ee('0x14')]=0x0;this[_0xd6ee('0x16')]=0x0;this[_0xd6ee('0x46')]=0x0;this[_0xd6ee('0x4')]=0x0;this[_0xd6ee('0x19')]=0x0;this[_0xd6ee('0x17')]=0x0;if(_0xcf9ea1){if(_0xcf9ea1['available']){this[_0xd6ee('0x0')]=Number(_0xcf9ea1[_0xd6ee('0x0')]);}if(_0xcf9ea1['loggedin']){this[_0xd6ee('0x1')]=Number(_0xcf9ea1['loggedin']);}if(_0xcf9ea1['callers']){this[_0xd6ee('0x5')]=Number(_0xcf9ea1[_0xd6ee('0x47')]);}}for(var _0x409558=0x0;_0x409558<_0x96aa7f[_0xd6ee('0x48')];_0x409558++){var _0x371b1c=_0x45e974[_0xd6ee('0x49')+_0x96aa7f[_0x409558]['name']];if(_0x371b1c&&_0x371b1c['online']){this[_0xd6ee('0x2')]+=0x1;}if(_0x96aa7f[_0x409558][_0xd6ee('0x4a')]==='1'){this['talking']+=0x1;}if(_0x96aa7f[_0x409558][_0xd6ee('0x3')]==='1'&&!['2','7','8']['includes'](_0x96aa7f[_0x409558][_0xd6ee('0x4b')])){this[_0xd6ee('0x3')]+=0x1;}switch(_0x96aa7f[_0x409558][_0xd6ee('0x4b')]){case'0':this[_0xd6ee('0x1d')]+=0x1;break;case'1':this[_0xd6ee('0x18')]+=0x1;break;case'2':this[_0xd6ee('0x15')]+=0x1;break;case'3':this[_0xd6ee('0x14')]+=0x1;break;case'4':this[_0xd6ee('0x16')]+=0x1;break;case'5':this[_0xd6ee('0x46')]+=0x1;break;case'6':this[_0xd6ee('0x4')]+=0x1;break;case'7':this[_0xd6ee('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xd6ee('0x21')]===_0xd6ee('0x4c')){var _0x3a864e=Object[_0xd6ee('0x4d')](_0x49174a);for(var _0x418680=0x0;_0x418680<_0x3a864e[_0xd6ee('0x48')];_0x418680++){var _0x1c3088=_0x3a864e[_0x418680];var _0x225679=_0x49174a[_0x1c3088];if(_0x225679[_0xd6ee('0x4e')]===this[_0xd6ee('0x10')]&&_0x225679[_0xd6ee('0x1c')]===_0xd6ee('0x4f')&&_0x225679['exten']===_0xd6ee('0x50')){this[_0xd6ee('0xd')]+=0x1;}}if(this[_0xd6ee('0xd')]>this['inUse']){this[_0xd6ee('0xd')]=this['inUse'];}this[_0xd6ee('0xc')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xd6ee('0x51')]=function(_0x334d63){var _0x5c1fa3=![];if(_0x334d63){_0x5c1fa3=INBOUND_COUNTERS[_0xd6ee('0x52')](function(_0x164df4){return this[_0x164df4]!==_0x334d63[_0x164df4];},this);}return _0x5c1fa3;};VoiceQueueSummary[_0xd6ee('0x44')]['compareToOutboundQueue']=function(_0x212417){var _0x32c5be=![];var _0x4a7f5b=![];var _0x1373be=![];if(_0x212417){_0x32c5be=this['dialMethod']!==_0x212417[_0xd6ee('0x21')]||this[_0xd6ee('0x20')]!==_0x212417[_0xd6ee('0x20')]||this[_0xd6ee('0x41')]!==_0x212417['message']||this[_0xd6ee('0x42')]!==_0x212417['statusMessage'];_0x4a7f5b=OUTBOUND_COUNTERS[_0xd6ee('0x52')](function(_0x19f22e){return this[_0x19f22e]!==_0x212417[_0x19f22e];},this);if(this['Trunk']&&_0x212417[_0xd6ee('0x43')]){_0x1373be=this[_0xd6ee('0x43')][_0xd6ee('0x10')]!==_0x212417[_0xd6ee('0x43')][_0xd6ee('0x10')]||this[_0xd6ee('0x43')][_0xd6ee('0x53')]!==_0x212417[_0xd6ee('0x43')]['active'];}}return _0x32c5be||_0x4a7f5b||_0x1373be;};VoiceQueueSummary[_0xd6ee('0x44')]['updateReportFromOutboundQueue']=function(_0x1751b9){this[_0xd6ee('0x13')]=_0x1751b9[_0xd6ee('0x13')];this[_0xd6ee('0x41')]=_0x1751b9['message'];this[_0xd6ee('0x42')]=_0x1751b9['statusMessage'];this[_0xd6ee('0x6')]=_0x1751b9['originated'];this[_0xd6ee('0x7')]=_0x1751b9['outboundAbandonedCallsDay'];this[_0xd6ee('0x8')]=_0x1751b9[_0xd6ee('0x8')];this[_0xd6ee('0x27')]=_0x1751b9[_0xd6ee('0x27')];this[_0xd6ee('0x28')]=_0x1751b9[_0xd6ee('0x28')];this[_0xd6ee('0x9')]=_0x1751b9[_0xd6ee('0x9')];this[_0xd6ee('0x2c')]=_0x1751b9['outboundNoAnswerCallsDay'];this[_0xd6ee('0x2d')]=_0x1751b9['outboundNoSuchCallsDay'];this[_0xd6ee('0x2f')]=_0x1751b9[_0xd6ee('0x2f')];this['outboundRejectCallsDay']=_0x1751b9['outboundRejectCallsDay'];this[_0xd6ee('0xb')]=_0x1751b9[_0xd6ee('0xb')];this[_0xd6ee('0xe')]=_0x1751b9[_0xd6ee('0xe')];this[_0xd6ee('0xf')]=_0x1751b9[_0xd6ee('0xf')];this[_0xd6ee('0x1b')]=_0x1751b9[_0xd6ee('0x1b')];if(this['dialMethod']===_0xd6ee('0x54')){this[_0xd6ee('0xc')]=_0x1751b9['pTalking'];}};module[_0xd6ee('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 0df8f84..2be92ca 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 _0x8549=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x2eba76,_0xf6c299){var _0x4f1012=function(_0x4cdb25){while(--_0x4cdb25){_0x2eba76['push'](_0x2eba76['shift']());}};_0x4f1012(++_0xf6c299);}(_0x8549,0x1ad));var _0x9854=function(_0x58361c,_0x54c6a4){_0x58361c=_0x58361c-0x0;var _0x3d3860=_0x8549[_0x58361c];return _0x3d3860;};'use strict';function VtigerAccount(_0x17072c){this['id']=_0x17072c['id']||0x0;this[_0x9854('0x0')]=_0x17072c[_0x9854('0x0')]||'';this[_0x9854('0x1')]=_0x17072c['username']||'';this[_0x9854('0x2')]=_0x17072c[_0x9854('0x2')]||'';this[_0x9854('0x3')]=_0x17072c[_0x9854('0x3')]||'';this[_0x9854('0x4')]=_0x17072c[_0x9854('0x4')]||'';this[_0x9854('0x5')]=_0x17072c[_0x9854('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x23c0=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23c0,0xf1));var _0x023c=function(_0x24ed85,_0x44c519){_0x24ed85=_0x24ed85-0x0;var _0x82bcd5=_0x23c0[_0x24ed85];return _0x82bcd5;};'use strict';function VtigerAccount(_0xd320a6){this['id']=_0xd320a6['id']||0x0;this['name']=_0xd320a6[_0x023c('0x0')]||'';this['username']=_0xd320a6[_0x023c('0x1')]||'';this[_0x023c('0x2')]=_0xd320a6[_0x023c('0x2')]||'';this[_0x023c('0x3')]=_0xd320a6[_0x023c('0x3')]||'';this[_0x023c('0x4')]=_0xd320a6[_0x023c('0x4')]||'';this[_0x023c('0x5')]=_0xd320a6[_0x023c('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 0401c52..cdc76ed 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 _0x6a52=['password','token','remoteUri','authType','integrationTab','serverUrl','Configurations','name','username'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6a52,0xf1));var _0x26a5=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x6a52[_0x307086];return _0x699043;};'use strict';function ZendeskAccount(_0x3e20bc){this['id']=_0x3e20bc['id']||0x0;this[_0x26a5('0x0')]=_0x3e20bc[_0x26a5('0x0')]||'';this[_0x26a5('0x1')]=_0x3e20bc['username']||'';this[_0x26a5('0x2')]=_0x3e20bc[_0x26a5('0x2')]||'';this[_0x26a5('0x3')]=_0x3e20bc[_0x26a5('0x3')]||'';this[_0x26a5('0x4')]=_0x3e20bc[_0x26a5('0x4')]||'';this[_0x26a5('0x5')]=_0x3e20bc[_0x26a5('0x5')]||'';this['type']=_0x3e20bc['type']||_0x26a5('0x6');this[_0x26a5('0x7')]=_0x3e20bc[_0x26a5('0x7')]||'';this[_0x26a5('0x8')]=_0x3e20bc[_0x26a5('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x060a=['Configurations','exports','name','username','token','remoteUri','authType','type'];(function(_0x25cedc,_0x20c76f){var _0xbbfe8f=function(_0x1a7a88){while(--_0x1a7a88){_0x25cedc['push'](_0x25cedc['shift']());}};_0xbbfe8f(++_0x20c76f);}(_0x060a,0x18a));var _0xa060=function(_0x458898,_0x2f8735){_0x458898=_0x458898-0x0;var _0xebceec=_0x060a[_0x458898];return _0xebceec;};'use strict';function ZendeskAccount(_0x2d6a24){this['id']=_0x2d6a24['id']||0x0;this[_0xa060('0x0')]=_0x2d6a24['name']||'';this[_0xa060('0x1')]=_0x2d6a24['username']||'';this['password']=_0x2d6a24['password']||'';this[_0xa060('0x2')]=_0x2d6a24[_0xa060('0x2')]||'';this[_0xa060('0x3')]=_0x2d6a24[_0xa060('0x3')]||'';this[_0xa060('0x4')]=_0x2d6a24[_0xa060('0x4')]||'';this[_0xa060('0x5')]=_0x2d6a24['type']||'integrationTab';this['serverUrl']=_0x2d6a24['serverUrl']||'';this[_0xa060('0x6')]=_0x2d6a24[_0xa060('0x6')]||{};}module[_0xa060('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 23bf409..6767ac6 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 _0x1c15=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x2bcbf9,_0x237bcc){var _0x2e9992=function(_0x363433){while(--_0x363433){_0x2bcbf9['push'](_0x2bcbf9['shift']());}};_0x2e9992(++_0x237bcc);}(_0x1c15,0x1b8));var _0x51c1=function(_0x12a32a,_0x200871){_0x12a32a=_0x12a32a-0x0;var _0x45c462=_0x1c15[_0x12a32a];return _0x45c462;};'use strict';function ZohoAccount(_0x219a46){this['id']=_0x219a46['id']||0x0;this[_0x51c1('0x0')]=_0x219a46[_0x51c1('0x0')]||'';this[_0x51c1('0x1')]=_0x219a46[_0x51c1('0x1')]||'';this[_0x51c1('0x2')]=_0x219a46[_0x51c1('0x2')]||'';this[_0x51c1('0x3')]=_0x219a46['zone']||'';this[_0x51c1('0x4')]=_0x219a46[_0x51c1('0x4')]||'';this['clientSecret']=_0x219a46[_0x51c1('0x5')]||'';this[_0x51c1('0x6')]=_0x219a46[_0x51c1('0x6')]||'';this[_0x51c1('0x7')]=_0x219a46[_0x51c1('0x7')]||'';this[_0x51c1('0x8')]=_0x219a46[_0x51c1('0x8')]||'';this[_0x51c1('0x9')]=_0x219a46[_0x51c1('0x9')]||{};}module[_0x51c1('0xa')]=ZohoAccount; \ No newline at end of file +var _0xeb81=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeb81,0x162));var _0x1eb8=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xeb81[_0x1d426f];return _0x17f71a;};'use strict';function ZohoAccount(_0x722263){this['id']=_0x722263['id']||0x0;this[_0x1eb8('0x0')]=_0x722263[_0x1eb8('0x0')]||'';this[_0x1eb8('0x1')]=_0x722263['description']||'';this[_0x1eb8('0x2')]=_0x722263['host']||'';this['zone']=_0x722263[_0x1eb8('0x3')]||'';this[_0x1eb8('0x4')]=_0x722263[_0x1eb8('0x4')]||'';this[_0x1eb8('0x5')]=_0x722263[_0x1eb8('0x5')]||'';this['serverUrl']=_0x722263[_0x1eb8('0x6')]||'';this[_0x1eb8('0x7')]=_0x722263[_0x1eb8('0x7')]||'';this[_0x1eb8('0x8')]=_0x722263[_0x1eb8('0x8')]||'';this[_0x1eb8('0x9')]=_0x722263[_0x1eb8('0x9')]||{};}module[_0x1eb8('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 218a9b5..92f0aa7 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 _0x47c5=['originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5c2cfc,_0x225457){var _0x39ef01=function(_0x2b507b){while(--_0x2b507b){_0x5c2cfc['push'](_0x5c2cfc['shift']());}};_0x39ef01(++_0x225457);}(_0x47c5,0x165));var _0x547c=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x47c5[_0x99facc];return _0xd39ed0;};'use strict';var util=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));function checkNameSurname(_0x123697,_0x5fe74c,_0x3260c8){var _0x500b86='';if(!_[_0x547c('0x3')](_0x5fe74c)&&_0x547c('0x4')===typeof _0x5fe74c){_0x500b86+=_0x5fe74c;}if(!_['isNil'](_0x3260c8)&&_0x547c('0x4')===typeof _0x3260c8){_0x500b86+='\x20'+_0x3260c8;}if(_0x500b86!==''){return _0x500b86;}return _0x123697;}function Action(_0x468220,_0x51ab7f,_0x2e5b57,_0x439f25,_0x381f2e){this[_0x547c('0x5')]=_0x2e5b57||undefined;this[_0x547c('0x6')]=_0x468220['id'];this[_0x547c('0x7')]=_0x51ab7f[_0x547c('0x8')];this[_0x547c('0x9')]=_0x51ab7f[_0x547c('0x9')];this[_0x547c('0xa')]=_0x547c('0x7');this[_0x547c('0xb')]=![];this[_0x547c('0xc')]=_[_0x547c('0x3')](_0x468220[_0x547c('0xd')])?undefined:_0x468220[_0x547c('0xd')][_0x547c('0x8')];this['channelAgent']=this[_0x547c('0xc')]?util[_0x547c('0xe')]('SIP/%s',this[_0x547c('0xc')]):_0x439f25||undefined;this[_0x547c('0xf')]=checkNameSurname(_0x468220[_0x547c('0x10')][_0x547c('0x11')],_0x468220[_0x547c('0x10')][_0x547c('0x12')],_0x468220[_0x547c('0x10')][_0x547c('0x13')]);this[_0x547c('0x14')]=_0x468220[_0x547c('0x14')]||![];this[_0x547c('0x15')]=_0x468220[_0x547c('0x11')];this[_0x547c('0x16')]=_0x468220[_0x547c('0x16')];this[_0x547c('0x17')]=_0x468220[_0x547c('0x17')]||0x0;this[_0x547c('0x18')]=_0x468220[_0x547c('0x18')]||0x0;this['countnoanswerretry']=_0x468220['countnoanswerretry']||0x0;this[_0x547c('0x19')]=(_0x468220[_0x547c('0x17')]||0x0)+(_0x468220[_0x547c('0x18')]||0x0)+(_0x468220['countnoanswerretry']||0x0)+(_0x468220[_0x547c('0x1a')]||0x0)+(_0x468220[_0x547c('0x1b')]||0x0)+(_0x468220[_0x547c('0x1c')]||0x0)+(_0x468220['countmachineretry']||0x0)+(_0x468220[_0x547c('0x1d')]||0x0);this[_0x547c('0x1a')]=_0x468220['countnosuchnumberretry']||0x0;this['countdropretry']=_0x468220[_0x547c('0x1b')]||0x0;this[_0x547c('0x1c')]=_0x468220['countabandonedretry']||0x0;this[_0x547c('0x1e')]=_0x468220[_0x547c('0x1e')]||0x0;this['countagentrejectretry']=_0x468220[_0x547c('0x1d')]||0x0;this[_0x547c('0x1f')]=_0x468220[_0x547c('0x1f')];this['callbackuniqueid']=_0x468220[_0x547c('0x20')];this[_0x547c('0x21')]=_0x468220[_0x547c('0x21')];this[_0x547c('0x22')]=_0x468220[_0x547c('0x22')];this[_0x547c('0x23')]=_0x468220[_0x547c('0x23')];this[_0x547c('0x24')]=_0x468220['ListId'];this[_0x547c('0x25')]=_['isNil'](_0x468220['Agent'])?_0x468220['UserId']:_0x468220['Agent']['id'];this[_0x547c('0x26')]=_0x468220['VoiceQueueId'];this[_0x547c('0x27')]='';this['originatecalleridname']='';}Action[_0x547c('0x28')]['getCaller']=function(){return util[_0x547c('0xe')](_0x547c('0x29'),this[_0x547c('0xf')],this[_0x547c('0x2a')]);};module[_0x547c('0x2b')]=Action; \ No newline at end of file +var _0xe5af=['Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','lodash','moment','string','uniqueid','idContact','queue','type','dialAnswer','isNil','Agent','name','channelAgent','format','SIP/%s','membername','calleridname'];(function(_0x1a6b2f,_0x469a7e){var _0x1c5be6=function(_0x11cb39){while(--_0x11cb39){_0x1a6b2f['push'](_0x1a6b2f['shift']());}};_0x1c5be6(++_0x469a7e);}(_0xe5af,0x9c));var _0xfe5a=function(_0x104b1f,_0x1454f5){_0x104b1f=_0x104b1f-0x0;var _0x1c2ec6=_0xe5af[_0x104b1f];return _0x1c2ec6;};'use strict';var util=require('util');var _=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));function checkNameSurname(_0x4b1845,_0x9a3743,_0x1bad12){var _0x23b7f0='';if(!_['isNil'](_0x9a3743)&&_0xfe5a('0x2')===typeof _0x9a3743){_0x23b7f0+=_0x9a3743;}if(!_['isNil'](_0x1bad12)&&'string'===typeof _0x1bad12){_0x23b7f0+='\x20'+_0x1bad12;}if(_0x23b7f0!==''){return _0x23b7f0;}return _0x4b1845;}function Action(_0x37455d,_0x2039cd,_0x4e418f,_0x5eea2e,_0x356c69){this[_0xfe5a('0x3')]=_0x4e418f||undefined;this[_0xfe5a('0x4')]=_0x37455d['id'];this[_0xfe5a('0x5')]=_0x2039cd['name'];this[_0xfe5a('0x6')]=_0x2039cd['type'];this['campaigntype']=_0xfe5a('0x5');this[_0xfe5a('0x7')]=![];this['membername']=_[_0xfe5a('0x8')](_0x37455d[_0xfe5a('0x9')])?undefined:_0x37455d[_0xfe5a('0x9')][_0xfe5a('0xa')];this[_0xfe5a('0xb')]=this['membername']?util[_0xfe5a('0xc')](_0xfe5a('0xd'),this[_0xfe5a('0xe')]):_0x5eea2e||undefined;this[_0xfe5a('0xf')]=checkNameSurname(_0x37455d[_0xfe5a('0x10')]['phone'],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x11')],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x12')]);this[_0xfe5a('0x13')]=_0x37455d[_0xfe5a('0x13')]||![];this[_0xfe5a('0x14')]=_0x37455d[_0xfe5a('0x15')];this[_0xfe5a('0x16')]=_0x37455d[_0xfe5a('0x16')];this[_0xfe5a('0x17')]=_0x37455d[_0xfe5a('0x17')]||0x0;this[_0xfe5a('0x18')]=_0x37455d[_0xfe5a('0x18')]||0x0;this[_0xfe5a('0x19')]=_0x37455d[_0xfe5a('0x19')]||0x0;this['countglobal']=(_0x37455d[_0xfe5a('0x17')]||0x0)+(_0x37455d[_0xfe5a('0x18')]||0x0)+(_0x37455d['countnoanswerretry']||0x0)+(_0x37455d[_0xfe5a('0x1a')]||0x0)+(_0x37455d[_0xfe5a('0x1b')]||0x0)+(_0x37455d[_0xfe5a('0x1c')]||0x0)+(_0x37455d['countmachineretry']||0x0)+(_0x37455d['countagentrejectretry']||0x0);this[_0xfe5a('0x1a')]=_0x37455d[_0xfe5a('0x1a')]||0x0;this[_0xfe5a('0x1b')]=_0x37455d[_0xfe5a('0x1b')]||0x0;this[_0xfe5a('0x1c')]=_0x37455d[_0xfe5a('0x1c')]||0x0;this['countmachineretry']=_0x37455d[_0xfe5a('0x1d')]||0x0;this['countagentrejectretry']=_0x37455d[_0xfe5a('0x1e')]||0x0;this[_0xfe5a('0x1f')]=_0x37455d[_0xfe5a('0x1f')];this['callbackuniqueid']=_0x37455d['callbackuniqueid'];this[_0xfe5a('0x20')]=_0x37455d[_0xfe5a('0x20')];this['recallme']=_0x37455d[_0xfe5a('0x21')];this[_0xfe5a('0x22')]=_0x37455d['ContactId'];this[_0xfe5a('0x23')]=_0x37455d[_0xfe5a('0x23')];this[_0xfe5a('0x24')]=_[_0xfe5a('0x8')](_0x37455d['Agent'])?_0x37455d[_0xfe5a('0x24')]:_0x37455d[_0xfe5a('0x9')]['id'];this[_0xfe5a('0x25')]=_0x37455d[_0xfe5a('0x25')];this[_0xfe5a('0x26')]='';this[_0xfe5a('0x27')]='';}Action[_0xfe5a('0x28')][_0xfe5a('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xfe5a('0xf')],this['number']);};module[_0xfe5a('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 18890ca..3128d32 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x37845e,_0x21070e){var _0x452beb=function(_0x5f4355){while(--_0x5f4355){_0x37845e['push'](_0x37845e['shift']());}};_0x452beb(++_0x21070e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xb355=['execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','lookAgent','logLookAgent','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','syncHangupRequest','addVariable','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','pTalking','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','isNil','[clearZombieChannels][talking]','originated:\x20','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','loggedIn','isActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','idContact','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','mandatoryDisposition','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalking','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','additional','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','incrementPreviewCounters','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','outboundUnknownCallsDay','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated','ANSWER','destlinkedid','callProgressDetectingAgent','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','decrementOriginate','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','Queue','agents','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','validateContact','isValid','checkIsBlackList','phone','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid'];(function(_0x9060ee,_0x87d334){var _0x2b1fe4=function(_0x2b7eff){while(--_0x2b7eff){_0x9060ee['push'](_0x9060ee['shift']());}};_0x2b1fe4(++_0x87d334);}(_0xb355,0x16a));var _0x5b35=function(_0x4c3153,_0x2257fa){_0x4c3153=_0x4c3153-0x0;var _0x2306eb=_0xb355[_0x4c3153];return _0x2306eb;};'use strict';var util=require(_0x5b35('0x0'));var _=require(_0x5b35('0x1'));var uuid=require(_0x5b35('0x2'));var moment=require(_0x5b35('0x3'));var Redis=require(_0x5b35('0x4'));var config=require(_0x5b35('0x5'));var logger=require('../../../config/logger')(_0x5b35('0x6'));var loggerAction=require('../../../config/logger')(_0x5b35('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x5b35('0x8'));var Action=require('./action');var ut=require(_0x5b35('0x9'));var utils=require(_0x5b35('0xa'));config[_0x5b35('0xb')]=_[_0x5b35('0xc')](config[_0x5b35('0xb')],{'host':_0x5b35('0xd'),'port':0x18eb});var io=require(_0x5b35('0xe'))(new Redis(config[_0x5b35('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x5b35('0xf')]=function(_0x4a7004){this[_0x5b35('0x10')]=this[_0x5b35('0x10')]?this[_0x5b35('0x10')][_0x5b35('0x11')](_0x4a7004):_0x4a7004();};function Preview(_0x2ff142){this['sequence']=new Sequence();this[_0x5b35('0x12')]=_0x2ff142['voiceQueues'];this[_0x5b35('0x13')]=_0x2ff142[_0x5b35('0x13')];this[_0x5b35('0x14')]={};this['agents']=_0x2ff142['agents'];this[_0x5b35('0x15')]=0x0;ami['on']('originateresponse',this[_0x5b35('0x16')][_0x5b35('0x17')](this));ami['on'](_0x5b35('0x18'),this[_0x5b35('0x19')][_0x5b35('0x17')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x5b35('0x17')](this));ami['on'](_0x5b35('0x1a'),this[_0x5b35('0x1b')][_0x5b35('0x17')](this));ami['on'](_0x5b35('0x1c'),this['syncNewExten']['bind'](this));ami['on'](_0x5b35('0x1d'),this[_0x5b35('0x1e')][_0x5b35('0x17')](this));ami['on']('attendedtransfer',this[_0x5b35('0x1f')][_0x5b35('0x17')](this));ami['on'](_0x5b35('0x20'),this[_0x5b35('0x21')][_0x5b35('0x17')](this));this['loopCampaigns'](this[_0x5b35('0x12')]);}function emit(_0x16f5ad,_0x1c02d0,_0x43c61e){io['to'](_0x16f5ad)[_0x5b35('0x22')](_0x1c02d0,_0x43c61e);}function emitVoiceQueueChannelRemove(_0x36e958){logger[_0x5b35('0x23')](_0x5b35('0x24'),JSON[_0x5b35('0x25')](_0x36e958));emit(util[_0x5b35('0x26')](_0x5b35('0x27'),_0x36e958[_0x5b35('0x28')]),_0x5b35('0x29'),_0x36e958);io[_0x5b35('0x22')](_0x5b35('0x2a'),_0x36e958);}function notSendMessagesQueue(_0x5fdc36){if(_0x5fdc36['sendMessageOneNotActive']){if(_0x5fdc36['originated']===0x0&&_0x5fdc36[_0x5b35('0x2b')]===0x0){_0x5fdc36['sendMessageOneNotActive']=![];_0x5fdc36['available']=0x0;_0x5fdc36['paused']=0x0;_0x5fdc36[_0x5b35('0x2c')]=utils[_0x5b35('0x2d')]['INACTIVE'];ut[_0x5b35('0x2e')](_0x5b35('0x2f'),_0x5fdc36[_0x5b35('0x28')]+_0x5b35('0x30'));}else{_0x5fdc36['message']=utils['CAMPAIGN_STATUS']['DEACTIVATED'];ut[_0x5b35('0x2e')](_0x5b35('0x2f'),_0x5fdc36[_0x5b35('0x28')]+_0x5b35('0x31'));}}}Preview[_0x5b35('0x32')][_0x5b35('0x33')]=function(){var _0x3ada6e=this;setInterval(function(){_0x3ada6e[_0x5b35('0x34')]();},0x7cf);};Preview['prototype'][_0x5b35('0x34')]=function(){var _0xbffbec=this[_0x5b35('0x12')];this[_0x5b35('0x15')]+=0x1;for(var _0x504296 in _0xbffbec){if(_0xbffbec[_0x5b35('0x35')](_0x504296)&&(_0xbffbec[_0x504296][_0x5b35('0x36')]===_0x5b35('0x6')||_0xbffbec[_0x504296][_0x5b35('0x36')]===_0x5b35('0x37'))&&_0xbffbec[_0x504296][_0x5b35('0x38')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x5b35('0x15')]=0x0;this[_0x5b35('0x39')]();}}if(_0xbffbec[_0x5b35('0x35')](_0x504296)&&_0xbffbec[_0x504296][_0x5b35('0x36')]===_0x5b35('0x6')&&_0xbffbec[_0x504296][_0x5b35('0x38')]==='outbound'){if(_0xbffbec[_0x504296][_0x5b35('0x3a')]){this[_0x5b35('0x3b')](_0xbffbec[_0x504296]);if(_0xbffbec[_0x504296][_0x5b35('0x3c')])this[_0x5b35('0x3d')](_0xbffbec[_0x504296]);}else{notSendMessagesQueue(_0xbffbec[_0x504296]);}}}};Preview[_0x5b35('0x32')]['clearZombieChannel']=function(_0x5dd09f){var _0x4a53a0=this;this[_0x5b35('0x3e')][_0x5b35('0xf')](function(){if(!_[_0x5b35('0x3f')](_0x4a53a0['actions'][_0x5dd09f])){loggerAction[_0x5b35('0x23')](_0x5b35('0x40'),_0x5dd09f,'Queue',_0x4a53a0[_0x5b35('0x14')][_0x5dd09f]['queue'],_0x5b35('0x41'),JSON[_0x5b35('0x25')](_0x4a53a0[_0x5b35('0x12')][_0x4a53a0[_0x5b35('0x14')][_0x5dd09f]['queue']]['originated']),'pTalking:\x20',JSON[_0x5b35('0x25')](_0x4a53a0[_0x5b35('0x12')][_0x4a53a0['actions'][_0x5dd09f][_0x5b35('0x42')]][_0x5b35('0x2b')]),JSON[_0x5b35('0x25')](_0x4a53a0['actions'][_0x5dd09f][_0x5b35('0x43')]),JSON[_0x5b35('0x25')](_[_0x5b35('0x44')](_0x4a53a0['actions'][_0x5dd09f],['contactId',_0x5b35('0x45'),_0x5b35('0x46'),_0x5b35('0x47')])));return ami[_0x5b35('0x48')]({'action':_0x5b35('0x49'),'channel':_0x4a53a0[_0x5b35('0x14')][_0x5dd09f][_0x5b35('0x4a')]})[_0x5b35('0x4b')](function(_0x1dabcb){if(_0x1dabcb[_0x5b35('0x2c')]===_0x5b35('0x4c')){setTimeout(function(){if(_0x4a53a0['actions'][_0x5dd09f]){utils['decrementOriginate'](_0x4a53a0[_0x5b35('0x12')][_0x4a53a0[_0x5b35('0x14')][_0x5dd09f]['queue']],_0x5b35('0x4d'));if(_0x4a53a0[_0x5b35('0x14')][_0x5dd09f][_0x5b35('0x43')]===!![]){ut['decrementTalking'](_0x4a53a0[_0x5b35('0x12')][_0x4a53a0[_0x5b35('0x14')][_0x5dd09f][_0x5b35('0x42')]],_0x5b35('0x4d'));ut[_0x5b35('0x4e')](_0x5b35('0x4f')+_0x5dd09f,_0x4a53a0[_0x5b35('0x14')][_0x5dd09f][_0x5b35('0x42')]);}ut['loggerError'](_0x5b35('0x50')+_0x5dd09f,_0x4a53a0[_0x5b35('0x14')][_0x5dd09f]['queue']);delete _0x4a53a0['actions'][_0x5dd09f];}},0x2328);}});}});};Preview[_0x5b35('0x32')][_0x5b35('0x39')]=function(){var _0x3cf52f=this;loggerAction['info'](_0x5b35('0x51'),_[_0x5b35('0x52')](this[_0x5b35('0x14')]));for(var _0x5b15d5 in this[_0x5b35('0x14')]){if(_0x3cf52f[_0x5b35('0x14')]['hasOwnProperty'](_0x5b15d5)){_0x3cf52f[_0x5b35('0x53')](_0x5b15d5);}}};Preview[_0x5b35('0x32')][_0x5b35('0x3d')]=function(_0x4adf55){var _0x32ebf3=this;rpcDb[_0x5b35('0x54')](_0x4adf55['id'],ut['agentReadyId'](this['agents']))[_0x5b35('0x55')](function(_0x99a4c1){if(!_[_0x5b35('0x3f')](_0x99a4c1)){for(var _0x5831ce=0x0;_0x5831ce<_0x99a4c1[_0x5b35('0x56')];_0x5831ce+=0x1){if(ut[_0x5b35('0x57')](_0x99a4c1[_0x5831ce]['scheduledat'])<_0x4adf55[_0x5b35('0x58')]*0x3c){if(_0x99a4c1[_0x5831ce]['Agent']&&!_0x99a4c1[_0x5831ce][_0x5b35('0x59')][_0x5b35('0x5a')]){_0x32ebf3[_0x5b35('0x5b')](_0x99a4c1[_0x5831ce]['id'])['then'](ut[_0x5b35('0x5c')]('[RecallMe]'))[_0x5b35('0x4b')](ut['logger2'](_0x5b35('0x5d')));}else{rpcDb[_0x5b35('0x5e')](_0x99a4c1[_0x5831ce]['id']);}}else{var _0x4fbadd=new Action(_0x99a4c1[_0x5831ce],_0x4adf55);_0x4fbadd[_0x5b35('0x5f')]=moment()[_0x5b35('0x26')](_0x5b35('0x60'));_0x4adf55['outboundReCallsDay']+=0x1;ut[_0x5b35('0x61')](_0x4fbadd,0x17,_0x5b35('0x62'));if(_0x4adf55[_0x5b35('0x63')]){rpcDb[_0x5b35('0x64')](ut[_0x5b35('0x65')](_0x99a4c1[_0x5831ce]));rpcDb['createCustomerHistory'](_0x4fbadd,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x4fbadd,0x16,_0x5b35('0x66'));rpcDb[_0x5b35('0x67')](_0x4fbadd,_0x5b35('0x68'));rpcDb[_0x5b35('0x69')](_0x4fbadd,'[HistoryRecallClose]');}}}}})[_0x5b35('0x4b')](ut[_0x5b35('0x5c')](_0x5b35('0x6a')));};Preview['prototype'][_0x5b35('0x3b')]=function(_0x5b3bb4){_0x5b3bb4[_0x5b35('0x6b')]=!![];if(ut[_0x5b35('0x6c')](_0x5b3bb4[_0x5b35('0x6d')])){_0x5b3bb4[_0x5b35('0x2c')]=utils[_0x5b35('0x2d')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x5b35('0x6e')](_0x5b3bb4[_0x5b35('0x3a')])){_0x5b3bb4[_0x5b35('0x2c')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this['isTrunkReachable'](_0x5b3bb4[_0x5b35('0x6f')])){if(!this[_0x5b35('0x70')](_0x5b3bb4[_0x5b35('0x71')])){_0x5b3bb4['message']=utils[_0x5b35('0x2d')][_0x5b35('0x72')];}else{_0x5b3bb4[_0x5b35('0x2c')]=utils['CAMPAIGN_STATUS'][_0x5b35('0x73')];}}else{_0x5b3bb4[_0x5b35('0x2c')]=utils[_0x5b35('0x2d')][_0x5b35('0x73')];}};Preview[_0x5b35('0x32')][_0x5b35('0x74')]=function(_0x4f9180,_0x295ebc,_0x5822b1){var _0x8c0f9b=this;var _0x3243de=this[_0x5b35('0x14')][_0x295ebc];var _0x4a94bb=this[_0x5b35('0x12')][_0x3243de[_0x5b35('0x42')]];var _0x48adae;var _0x401035=![];var _0x55fc8e=0x2;var _0x42d58a=0x3;if(_0x4a94bb){switch(_0x5822b1){case'1':_0x4a94bb[_0x5b35('0x75')]+=0x1;_0x3243de[_0x5b35('0x76')]+=0x1;_0x3243de[_0x5b35('0x77')]=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x0,_0x5b35('0x79'));ami[_0x5b35('0x22')]('custom:agentnosuchnumber',ut[_0x5b35('0x7a')](_0x3243de,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x3243de,'[callProgressDetectingCustomer][logNoSuch]');_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'0',_0x4a94bb)[_0x5b35('0x55')](function(_0x286fcd){_0x401035=_0x286fcd['additional']==0x1;_0x55fc8e=_0x4a94bb[_0x5b35('0x7c')];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb['dialGlobalMaxRetry']){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,'Global');rpcDb[_0x5b35('0x69')](_0x48adae,_0x5b35('0x7f'));}else{if(_0x3243de['countnosuchnumberretry']>=_0x4a94bb[_0x5b35('0x80')]){rpcDb['createCustomerFinal'](_0x3243de,_0x5b35('0x7f'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,_0x5b35('0x76'),_0x4a94bb['dialNoSuchNumberRetryFrequency']),_0x3243de[_0x5b35('0x83')],_0x3243de[_0x5b35('0x84')]);}}delete this[_0x5b35('0x14')][_0x4f9180[_0x5b35('0x85')]];}else{_0x3243de[_0x5b35('0x76')]++;logger[_0x5b35('0x23')]('actioncountonusuch',_0x3243de[_0x5b35('0x76')]);logger[_0x5b35('0x23')]('id',_0x3243de['idContact']);_0x8c0f9b['incrementPreviewCounters']({'id':_0x3243de[_0x5b35('0x86')],'field':{'countnosuchnumberretry':_0x3243de['countnosuchnumberretry']}})[_0x5b35('0x55')](function(){_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case'ANSWER':var _0x4a8dcc=moment()[_0x5b35('0x26')](_0x5b35('0x60'));_0x3243de['responsetime']=_0x4a8dcc;_0x3243de[_0x5b35('0x88')]=_0x4a8dcc;_0x3243de[_0x5b35('0x43')]=!![];_0x4a94bb[_0x5b35('0x2b')]+=0x1;logger[_0x5b35('0x23')](_0x5b35('0x89'),_0x3243de[_0x5b35('0x8a')],_0x5b35('0x8b'),_0x4a94bb[_0x5b35('0x28')],_0x5b35('0x8c'),_0x4a94bb['pTalking']);ami['emit'](_0x5b35('0x8d'),ut['buildObj'](_0x3243de,'connect',this[_0x5b35('0x12')][_0x3243de[_0x5b35('0x42')]]));if(_0x4a94bb[_0x5b35('0x8e')]||_0x4a94bb[_0x5b35('0x8f')]){ami[_0x5b35('0x22')](_0x5b35('0x90'),{'queue':_0x3243de[_0x5b35('0x42')],'interface':_0x3243de['channelAgent'],'uniqueid':_0x3243de[_0x5b35('0x8a')]});}break;case'16':ami['emit'](_0x5b35('0x91'),ut[_0x5b35('0x7a')](_0x3243de,_0x5b35('0x92'),this['campaignsPreview'][_0x3243de['queue']]));emitVoiceQueueChannelRemove(ut[_0x5b35('0x7a')](_0x3243de,_0x5b35('0x92')));_0x4a94bb[_0x5b35('0x93')]+=0x1;_0x4a94bb[_0x5b35('0x94')]+=0x1;_0x4a94bb[_0x5b35('0x95')]+=0x1;ut[_0x5b35('0x96')](_0x4a94bb,_0x5b35('0x97'));_0x3243de[_0x5b35('0x77')]=ut['totalGlobal'](_0x3243de);ut['logCustomer'](_0x3243de,0x4,_0x5b35('0x98'));rpcDb[_0x5b35('0x67')](_0x3243de,_0x5b35('0x99'));rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0x9a'));rpcDb[_0x5b35('0x9b')](_0x3243de);_0x4a94bb[_0x5b35('0x9c')]+=_0x3243de['talktime'];_0x4a94bb[_0x5b35('0x9d')]+=_0x3243de['talktime'];logger[_0x5b35('0x23')](_0x5b35('0x9e'),_0x3243de[_0x5b35('0x8a')],_0x5b35('0x8b'),_0x4a94bb['name'],_0x5b35('0x8c'),_0x4a94bb[_0x5b35('0x2b')]);delete this[_0x5b35('0x14')][_0x4f9180[_0x5b35('0x85')]];break;case _0x5b35('0x9f'):_0x4a94bb['outboundBusyCallsDay']+=0x1;_0x3243de[_0x5b35('0xa0')]+=0x1;_0x3243de['countglobal']=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x5,'Busy');_0x55fc8e=_0x4a94bb['dialBusyRetryFrequency'];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];ami[_0x5b35('0x22')](_0x5b35('0xa1'),ut[_0x5b35('0x7a')](_0x3243de,'busy'));rpcDb['createCustomerHistory'](_0x3243de,'[callProgressDetectingCustomer][logBusy]');_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'5',_0x4a94bb)[_0x5b35('0x55')](function(_0x5a9c4b){_0x401035=_0x5a9c4b[_0x5b35('0xa2')]==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,_0x5b35('0xa4'));rpcDb[_0x5b35('0x69')](_0x48adae,_0x5b35('0xa5'));}else{if(_0x3243de['countbusyretry']>=_0x4a94bb[_0x5b35('0xa6')]){rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0xa7'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,'countbusyretry',_0x4a94bb['dialBusyRetryFrequency']),_0x3243de['unlockAgent'],_0x3243de['activeContact']);}}}else{_0x3243de[_0x5b35('0xa0')]++;_0x8c0f9b['incrementPreviewCounters']({'id':_0x3243de[_0x5b35('0x86')],'field':{'countbusyretry':_0x3243de['countbusyretry']}})['then'](function(){_0x8c0f9b['swapAdditionalPhones'](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case _0x5b35('0xa8'):_0x4a94bb[_0x5b35('0xa9')]+=0x1;_0x3243de[_0x5b35('0xaa')]+=0x1;_0x3243de['countglobal']=ut['totalGlobal'](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x3,_0x5b35('0xab'));_0x55fc8e=_0x4a94bb['dialNoAnswerRetryFrequency'];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];var _0x2f45ea=ut['buildNoAnswerEventPayload'](_0x3243de,_0x4a94bb);ami[_0x5b35('0x22')]('custom:agentnoanswer',_0x2f45ea);rpcDb['createCustomerHistory'](_0x3243de,_0x5b35('0xac'));_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'3',_0x4a94bb)['then'](function(_0x1e61d0){_0x401035=_0x1e61d0[_0x5b35('0xa2')]==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb['dialGlobalMaxRetry']){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,'Global');rpcDb[_0x5b35('0x69')](_0x48adae,_0x5b35('0xad'));}else{if(_0x3243de['countnoanswerretry']>=_0x4a94bb['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x3243de,_0x5b35('0xac'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,'countnoanswerretry',_0x4a94bb[_0x5b35('0xae')]),_0x3243de['unlockAgent'],_0x3243de[_0x5b35('0x84')]);}}}else{_0x3243de[_0x5b35('0xaa')]++;_0x8c0f9b[_0x5b35('0xaf')]({'id':_0x3243de[_0x5b35('0x86')],'field':{'countnoanswerretry':_0x3243de['countnoanswerretry']}})[_0x5b35('0x55')](function(){_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case'CONGESTION':_0x4a94bb[_0x5b35('0xb0')]+=0x1;_0x3243de[_0x5b35('0xb1')]+=0x1;_0x3243de['countglobal']=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x8,_0x5b35('0xb2'));_0x55fc8e=_0x4a94bb['dialCongestionRetryFrequency'];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];ami['emit'](_0x5b35('0xb3'),ut[_0x5b35('0x7a')](_0x3243de,_0x5b35('0xb4')));rpcDb['createCustomerHistory'](_0x3243de,_0x5b35('0xb5'));_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'8',_0x4a94bb)[_0x5b35('0x55')](function(_0x5edbce){_0x401035=_0x5edbce[_0x5b35('0xa2')]==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,'Global');rpcDb[_0x5b35('0x69')](_0x48adae,_0x5b35('0xb6'));}else{if(_0x3243de[_0x5b35('0xb1')]>=_0x4a94bb[_0x5b35('0xb7')]){rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0xb5'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,_0x5b35('0xb1'),_0x4a94bb['dialBusyRetryFrequency']),_0x3243de[_0x5b35('0x83')],_0x3243de['activeContact']);}}}else{_0x3243de[_0x5b35('0xb1')]++;_0x8c0f9b['incrementPreviewCounters']({'id':_0x3243de['idContact'],'field':{'countcongestionretry':_0x3243de[_0x5b35('0xb1')]}})[_0x5b35('0x55')](function(){_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case'CANCEL':_0x4a94bb[_0x5b35('0xb8')]+=0x1;_0x3243de[_0x5b35('0xb9')]+=0x1;_0x3243de[_0x5b35('0x77')]=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x14,_0x5b35('0xba'));_0x55fc8e=_0x4a94bb[_0x5b35('0xbb')];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];ami[_0x5b35('0x22')]('custom:agentreject',ut[_0x5b35('0x7a')](_0x3243de,_0x5b35('0xbc')));rpcDb[_0x5b35('0x67')](_0x3243de,_0x5b35('0xbd'));_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'20',_0x4a94bb)['then'](function(_0x2383d6){_0x401035=_0x2383d6[_0x5b35('0xa2')]==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb['dialGlobalMaxRetry']){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0x14,_0x5b35('0xba'));rpcDb['createCustomerFinal'](_0x48adae,_0x5b35('0xbe'));}else{if(_0x3243de[_0x5b35('0xb9')]>=_0x4a94bb[_0x5b35('0xbf')]){rpcDb['createCustomerFinal'](_0x3243de,_0x5b35('0xbe'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,'countagentrejectretry',_0x4a94bb['dialAgentRejectRetryFrequency']),_0x3243de[_0x5b35('0x83')],_0x3243de[_0x5b35('0x84')]);}}}else{_0x3243de['countnoanswerretry']++;_0x8c0f9b[_0x5b35('0xaf')]({'id':_0x3243de[_0x5b35('0x86')],'field':{'countnoanswerretry':_0x3243de[_0x5b35('0xaa')]}})['then'](function(){_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case _0x5b35('0xc0'):_0x4a94bb[_0x5b35('0xc1')]+=0x1;_0x3243de['countabandonedretry']+=0x1;_0x3243de[_0x5b35('0x77')]=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0xb,_0x5b35('0xc2'));rpcDb['createCustomerHistory'](_0x3243de,_0x5b35('0xc3'));_0x8c0f9b['verifyAdditionalPhones'](_0x3243de,'11',_0x4a94bb)[_0x5b35('0x55')](function(_0x1c420b){_0x401035=_0x1c420b['additional']==0x1;if(!_0x401035){if(ut['totalGlobal'](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,_0x5b35('0xa4'));rpcDb[_0x5b35('0x69')](_0x48adae,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3243de['countabandonedetry']>=_0x4a94bb[_0x5b35('0xc4')]){rpcDb['createCustomerFinal'](_0x3243de,_0x5b35('0xc3'));}else{rpcDb[_0x5b35('0x81')](ut[_0x5b35('0x82')](_0x3243de,_0x5b35('0xc5'),_0x4a94bb['dialAbandonedRetryFrequency']),_0x3243de[_0x5b35('0x83')],_0x3243de[_0x5b35('0x84')]);}}}else{_0x3243de['countnoanswerretry']++;_0x8c0f9b['incrementPreviewCounters']({'id':_0x3243de['idContact'],'field':{'countnoanswerretry':_0x3243de[_0x5b35('0xaa')]}})['then'](function(){_0x8c0f9b['swapAdditionalPhones'](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});break;case'18':_0x4a94bb[_0x5b35('0xc6')]+=0x1;_0x3243de['countmachineretry']+=0x1;_0x3243de[_0x5b35('0x77')]=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x12,_0x4f9180[_0x5b35('0xc7')]||_0x4f9180[_0x5b35('0xc8')]);ami[_0x5b35('0x22')]('custom:amd',ut[_0x5b35('0x7a')](_0x3243de,_0x5b35('0xc9')));rpcDb[_0x5b35('0x67')](_0x3243de,_0x5b35('0xca'));_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'18',_0x4a94bb)[_0x5b35('0x55')](function(_0x1bb227){_0x401035=_0x1bb227['additional']==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut['cloneAction'](_0x3243de,0x12,_0x5b35('0xa4'));rpcDb[_0x5b35('0x69')](_0x48adae,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0xca'));}}else{_0x3243de[_0x5b35('0xaa')]++;_0x8c0f9b[_0x5b35('0xaf')]({'id':_0x3243de[_0x5b35('0x86')],'field':{'countnoanswerretry':_0x3243de[_0x5b35('0xaa')]}})[_0x5b35('0x55')](function(){_0x8c0f9b['swapAdditionalPhones'](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});delete this[_0x5b35('0x14')][_0x4f9180['linkedid']];break;case'19':_0x4a94bb['outboundUnknownCallsDay']+=0x1;_0x3243de['countglobal']=ut[_0x5b35('0x78')](_0x3243de);ut[_0x5b35('0x61')](_0x3243de,0x13,_0x4f9180[_0x5b35('0xc7')]||_0x4f9180['dialstatus']);ami['emit'](_0x5b35('0xcb'),ut[_0x5b35('0x7a')](_0x3243de,'amd'));rpcDb[_0x5b35('0x67')](_0x3243de,_0x5b35('0xcc'));_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'18',_0x4a94bb)[_0x5b35('0x55')](function(_0x20e55d){_0x401035=_0x20e55d['additional']==0x1;if(!_0x401035){if(ut[_0x5b35('0x78')](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut['cloneAction'](_0x3243de,0xf,_0x5b35('0xa4'));rpcDb[_0x5b35('0x69')](_0x48adae,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0xcc'));}}else{_0x3243de[_0x5b35('0xaa')]++;_0x8c0f9b[_0x5b35('0xaf')]({'id':_0x3243de[_0x5b35('0x86')],'field':{'countnoanswerretry':_0x3243de[_0x5b35('0xaa')]}})['then'](function(){_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});});}});delete this[_0x5b35('0x14')][_0x4f9180['linkedid']];break;default:if(_0x3243de[_0x5b35('0x43')]){ut['decrementTalking'](_0x4a94bb,_0x5b35('0xcd'));ut[_0x5b35('0x4e')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x4a94bb[_0x5b35('0x28')],_0x4f9180);}_0x4a94bb['outboundUnknownCallsDay']+=0x1;_0x3243de[_0x5b35('0x77')]=ut[_0x5b35('0x78')](_0x3243de);ut['logCustomer'](_0x3243de,0xc,_0x4f9180[_0x5b35('0xc7')]||_0x4f9180[_0x5b35('0xc8')]);_0x55fc8e=_0x4a94bb[_0x5b35('0xbb')];_0x42d58a=_0x4a94bb[_0x5b35('0x7d')];rpcDb['createCustomerHistory'](_0x3243de,'[callProgressDetectingCustomer][logUnknown]');_0x8c0f9b[_0x5b35('0x7b')](_0x3243de,'20',_0x4a94bb)[_0x5b35('0x55')](function(_0x5d86b1){_0x401035=_0x5d86b1[_0x5b35('0xa2')]==0x1;if(!_0x401035){if(ut['totalGlobal'](_0x3243de)>=_0x4a94bb[_0x5b35('0xa3')]){_0x48adae=ut[_0x5b35('0x7e')](_0x3243de,0xf,_0x5b35('0xa4'));rpcDb['createCustomerFinal'](_0x48adae,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x5b35('0x69')](_0x3243de,_0x5b35('0xce'));}delete this['actions'][_0x4f9180[_0x5b35('0x85')]];}else{_0x8c0f9b[_0x5b35('0x87')](_0x3243de,_0x55fc8e,_0x42d58a)[_0x5b35('0x55')](function(){});}});}if(!(_0x3243de[_0x5b35('0x43')]&&_0x5822b1==='16')){utils['decrementOriginate'](_0x4a94bb,'[callProgressDetectingCustomer]');logger['info'](_0x5b35('0xcf'),_0x3243de[_0x5b35('0x8a')],_0x5b35('0x8b'),_0x4a94bb[_0x5b35('0x28')],'originated:\x20',_0x4a94bb[_0x5b35('0xd0')]);}if(_0x5822b1!==_0x5b35('0xd1')){delete this[_0x5b35('0x14')][_0x4f9180['linkedid']];delete this[_0x5b35('0x14')][_0x4f9180[_0x5b35('0xd2')]];}_0x4a94bb['queueSummaryCountersUpdated']=!![];}};Preview[_0x5b35('0x32')][_0x5b35('0xd3')]=function(_0x30a680,_0x4c4085,_0x148ec6){if(_['isUndefined'](_0x4c4085)&&_0x5b35('0xd4')!==typeof _0x4c4085){return;}if(_['isUndefined'](_0x148ec6)&&_0x5b35('0xd4')!==typeof _0x148ec6){return;}switch(_0x148ec6[_0x5b35('0xd5')]){case'0':ut[_0x5b35('0xd6')](_0x30a680,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x30a680,_0x5b35('0xd7'));break;case'3':ut[_0x5b35('0xd6')](_0x30a680,0x3,_0x5b35('0xab'));rpcDb[_0x5b35('0xd8')](_0x30a680,_0x5b35('0xd9'));break;case'5':ut[_0x5b35('0xd6')](_0x30a680,0x5,_0x5b35('0xda'));rpcDb[_0x5b35('0xd8')](_0x30a680,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x5b35('0xd6')](_0x30a680,0x8,_0x5b35('0xb2'));rpcDb[_0x5b35('0xd8')](_0x30a680,_0x5b35('0xdb'));break;case'22':ut['logAgent'](_0x30a680,0x16,_0x5b35('0xdc'));rpcDb[_0x5b35('0xd8')](_0x30a680,_0x5b35('0xdd'));break;default:ut[_0x5b35('0xd6')](_0x30a680,0xc,_0x148ec6[_0x5b35('0xd5')]);rpcDb[_0x5b35('0xd8')](_0x30a680,_0x5b35('0xdb'));}utils[_0x5b35('0xde')](_0x4c4085,_0x5b35('0xdf'));logger['info'](_0x5b35('0xe0'),_0x30a680[_0x5b35('0x8a')],_0x5b35('0x8b'),_0x4c4085[_0x5b35('0x28')],_0x5b35('0x41'),_0x4c4085[_0x5b35('0xd0')]);delete this[_0x5b35('0x14')][_0x30a680[_0x5b35('0x8a')]];};Preview[_0x5b35('0x32')][_0x5b35('0x7b')]=function(_0x99ee41,_0x1b41d3,_0x570e1e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x99ee41,_0x1b41d3,_0x570e1e)['catch'](logger[_0x5b35('0x23')]('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0x5b35('0x87')]=function(_0x1b5950,_0x219342,_0x292550){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1b5950,_0x219342,_0x292550)[_0x5b35('0x4b')](logger[_0x5b35('0x23')](_0x5b35('0xe1')));};Preview['prototype'][_0x5b35('0xaf')]=function(_0x1931a9){return Promise['resolve']()[_0x5b35('0x55')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1931a9))[_0x5b35('0x4b')](logger['info'](_0x5b35('0xe2')));};Preview[_0x5b35('0x32')]['checkInBlack']=function(_0x12c699,_0x109515,_0x78285,_0x1e6b40,_0x95900f){var _0x17551e=this;return new Promise(function(_0x4e1e0a,_0x4a5c05){if(_[_0x5b35('0x3f')](_0x109515)||_['isNil'](_0x109515[_0x5b35('0xe3')])||_['isNil'](_0x109515['phone'])||_[_0x5b35('0x3f')](_0x109515[_0x5b35('0x46')])){_0x4a5c05(ut[_0x5b35('0x2c')]('Contact\x20is\x20undefined',_0x1e6b40,_0x95900f));return;}var _0x136b45=uuid['v4']();var _0x3a5526=_0x17551e['campaignsPreview'][_0x109515[_0x5b35('0xe4')][_0x5b35('0x28')]];var _0x6ae222=_0x78285?_0x17551e[_0x5b35('0xe5')][_0x78285]['id']:undefined;_0x17551e[_0x5b35('0x14')][_0x136b45]=new Action(_0x109515,_0x3a5526,_0x136b45,_0x78285,_0x6ae222);var _0x1543b7=_0x17551e[_0x5b35('0x14')][_0x136b45];_0x1543b7[_0x5b35('0x83')]=_0x1e6b40;_0x1543b7[_0x5b35('0x84')]=_0x95900f;_0x1543b7['lookAgent']=_0x78285;if(_[_0x5b35('0xe6')](_0x12c699)){_0x17551e['execCall'](_0x1543b7,_0x3a5526,_0x109515,_0x78285)[_0x5b35('0x55')](function(_0x1a7abb){logger[_0x5b35('0x23')](_0x5b35('0xe7'),_0x5b35('0xe8')+_0x1543b7['queue']+'\x20IdHopper:\x20'+_0x1543b7[_0x5b35('0x86')],JSON[_0x5b35('0x25')](_0x1a7abb));ami['emit'](_0x5b35('0xe9'),ut[_0x5b35('0x7a')](_0x1543b7,_0x5b35('0xea'),_0x17551e[_0x5b35('0x12')][_0x1543b7[_0x5b35('0x42')]]));_0x4e1e0a(ut[_0x5b35('0x2c')]('Calling'));})[_0x5b35('0x4b')](function(_0x42d29d){ut['logger'](_0x5b35('0xeb'),_0x42d29d);_0x4a5c05(ut['message'](_0x5b35('0xec'),_0x1e6b40,_0x95900f));});}else{_0x3a5526[_0x5b35('0xed')]+=0x1;ut[_0x5b35('0xee')](_0x1543b7);rpcDb['createHistory'](_0x1543b7,_0x5b35('0xef'));delete _0x17551e[_0x5b35('0x14')][_0x136b45];_0x4a5c05(ut['message'](_0x5b35('0xf0'),_0x1e6b40,_0x95900f));}});};Preview[_0x5b35('0x32')]['isTrunkReachable']=function(_0x1d01d1){return!_[_0x5b35('0x3f')](_0x1d01d1)&&!_[_0x5b35('0x3f')](_0x1d01d1['name'])&&!_[_0x5b35('0x3f')](_0x1d01d1[_0x5b35('0xf1')])&&_0x1d01d1[_0x5b35('0xf1')]&&!_['isNil'](this[_0x5b35('0x13')][util['format']('SIP/%s',_0x1d01d1[_0x5b35('0x28')])])&&!_[_0x5b35('0x3f')](this['trunks'][util[_0x5b35('0x26')](_0x5b35('0xf2'),_0x1d01d1[_0x5b35('0x28')])][_0x5b35('0x49')])&&(this[_0x5b35('0x13')][util[_0x5b35('0x26')]('SIP/%s',_0x1d01d1[_0x5b35('0x28')])][_0x5b35('0x49')]===_0x5b35('0xf3')||this['trunks'][util[_0x5b35('0x26')]('SIP/%s',_0x1d01d1['name'])][_0x5b35('0x49')]===_0x5b35('0xf4'));};Preview[_0x5b35('0x32')][_0x5b35('0x5b')]=function(_0x1986f9,_0x3c4bbe){return this[_0x5b35('0xf5')](_0x1986f9,_0x3c4bbe)[_0x5b35('0x55')](function(_0x2d04d8){return _[_0x5b35('0x44')](_0x2d04d8,[_0x5b35('0x2c')]);})[_0x5b35('0x4b')](function(_0x441d25){if(_0x441d25[_0x5b35('0xf6')]){rpcDb[_0x5b35('0xf7')](_0x1986f9);}if(_0x441d25[_0x5b35('0xf1')]){rpcDb[_0x5b35('0x5e')](_0x1986f9);}throw _[_0x5b35('0x44')](_0x441d25,['message']);});};Preview[_0x5b35('0x32')]['execRun']=function(_0x16b327,_0x1380a6){var _0xf7793e=this;var _0x2fc1b8,_0x1b8a4d;return rpcDb[_0x5b35('0xf8')](_0x16b327)[_0x5b35('0x55')](function(_0x3a5f0a){if(!_[_0x5b35('0x3f')](_0x3a5f0a[0x0])){_0x1b8a4d=_0x3a5f0a[0x0]['recallme']?![]:!![];_0x2fc1b8=_0x3a5f0a[0x0]['recallme']?!![]:![];_0x2fc1b8=_0x1380a6?!![]:_0x2fc1b8;}var _0x1d255e=_0xf7793e[_0x5b35('0xf9')](_0x3a5f0a);if(_0x1d255e[_0x5b35('0xfa')]){rpcDb[_0x5b35('0xfb')](_[_0x5b35('0x44')](_0x3a5f0a[0x0],[_0x5b35('0x46'),_0x5b35('0xfc')]))[_0x5b35('0x55')](function(_0x5e004d){_0xf7793e['checkInBlack'](_0x5e004d,_0x3a5f0a[0x0],_0x1380a6,_0x1b8a4d,_0x2fc1b8)[_0x5b35('0x55')](function(_0x5be6bb){return _0x5be6bb;})[_0x5b35('0x4b')](function(_0x1b8a52){throw _0x1b8a52;});})[_0x5b35('0x4b')](function(_0x44f977){ut[_0x5b35('0x2e')]('[Preview][checkIsBlackList]',_0x44f977);throw ut[_0x5b35('0x2c')]('Call\x20unsuccessful',_0x1b8a4d,_0x2fc1b8);});}else{throw ut[_0x5b35('0x2c')](_0x1d255e[_0x5b35('0x2c')],_0x1b8a4d,_0x2fc1b8);}})[_0x5b35('0x4b')](function(_0x43dde8){ut[_0x5b35('0x2e')](_0x5b35('0xfd'),_0x43dde8);throw ut['message'](_0x5b35('0xfe'),![],!![]);});};Preview[_0x5b35('0x32')][_0x5b35('0xf9')]=function(_0x1dd11a){if(_[_0x5b35('0x3f')](_0x1dd11a)||_[_0x5b35('0xe6')](_0x1dd11a)||!_[_0x5b35('0x3f')](_0x1dd11a[0x0][_0x5b35('0x59')])&&_[_0x5b35('0x3f')](_0x1dd11a[0x0]['Agent'][_0x5b35('0x28')])){ut[_0x5b35('0x2e')](_0x5b35('0xff'),_0x1dd11a);return{'isValid':![],'message':_0x5b35('0x100')};}var _0x4d2f63=this[_0x5b35('0x12')][_0x1dd11a[0x0]['Queue'][_0x5b35('0x28')]];_0x4d2f63['message']=utils[_0x5b35('0x2d')][_0x5b35('0x73')];if(_[_0x5b35('0x3f')](_0x4d2f63)){ut['logger'](_0x5b35('0x101'),_0x4d2f63);return{'isValid':![],'message':_0x5b35('0x102')};}if(!this['isTrunkReachable'](_0x4d2f63['Trunk'])){ut[_0x5b35('0x2e')](_0x5b35('0x103'),'campaign\x20Name:\x20'+_0x4d2f63[_0x5b35('0x28')]+_0x5b35('0x104'));if(!this[_0x5b35('0x70')](_0x4d2f63[_0x5b35('0x71')])){ut[_0x5b35('0x2e')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d2f63[_0x5b35('0x28')]+_0x5b35('0x105'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x5b35('0x6e')](_0x4d2f63['dialActive'])){ut['logger'](_0x5b35('0x106'),_0x4d2f63[_0x5b35('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x5b35('0x107')+_0x4d2f63[_0x5b35('0x28')]+_0x5b35('0x108')};}return{'isValid':!![],'message':_0x5b35('0x109')};};Preview['prototype'][_0x5b35('0x10a')]=function(_0x2c9ca0,_0x5b1cad,_0x417495,_0x24e831){var _0x12c0c0=this;return new Promise(function(_0x270023,_0x2054c0){var _0x2b23c7=_0x2c9ca0[_0x5b35('0x8a')];var _0x54a9c2=_0x12c0c0[_0x5b35('0x70')](_0x5b1cad['Trunk'])?util[_0x5b35('0x26')](_0x5b35('0x10b'),_0x5b1cad['Trunk']['name'],_['isNil'](_0x5b1cad[_0x5b35('0x10c')])?'':_0x5b1cad['dialPrefix'][_0x5b35('0x10d')]()||'',_0x5b1cad['dialCutDigit']>0x0?_0x417495[_0x5b35('0xfc')][_0x5b35('0x10e')](_0x5b1cad[_0x5b35('0x10f')]):_0x417495[_0x5b35('0xfc')]):util[_0x5b35('0x26')](_0x5b35('0x10b'),_[_0x5b35('0x3f')](_0x5b1cad[_0x5b35('0x71')])?_0x5b1cad[_0x5b35('0x6f')]['name']:_0x5b1cad[_0x5b35('0x71')][_0x5b35('0x28')],_[_0x5b35('0x3f')](_0x5b1cad[_0x5b35('0x10c')])?'':_0x5b1cad[_0x5b35('0x10c')][_0x5b35('0x10d')]()||'',_0x5b1cad[_0x5b35('0x10f')]>0x0?_0x417495[_0x5b35('0xfc')][_0x5b35('0x10e')](_0x5b1cad[_0x5b35('0x10f')]):_0x417495[_0x5b35('0xfc')]);var _0x50e60d=_0x12c0c0[_0x5b35('0x70')](_0x5b1cad[_0x5b35('0x6f')])?ut[_0x5b35('0x110')](_0x5b1cad[_0x5b35('0x6f')]['callerid'],_0x5b1cad[_0x5b35('0x111')],_0x5b1cad[_0x5b35('0x112')]>0x0?ut['getCallerIdRandom'](_0x5b1cad['dialOriginateCallerIdNumber'],_0x5b1cad['dialRandomLastDigitCallerIdNumber']):_0x5b1cad['dialOriginateCallerIdNumber']):ut[_0x5b35('0x110')](_[_0x5b35('0x3f')](_0x5b1cad[_0x5b35('0x71')])?_0x5b1cad[_0x5b35('0x6f')][_0x5b35('0x113')]:_0x5b1cad[_0x5b35('0x71')][_0x5b35('0x113')],_0x5b1cad['dialOriginateCallerIdName'],_0x5b1cad[_0x5b35('0x112')]>0x0?ut[_0x5b35('0x114')](_0x5b1cad[_0x5b35('0x115')],_0x5b1cad['dialRandomLastDigitCallerIdNumber']):_0x5b1cad[_0x5b35('0x115')]);if(_0x50e60d){_0x2c9ca0[_0x5b35('0x116')]=ut[_0x5b35('0x117')](_0x50e60d);_0x2c9ca0['originatecalleridnum']=ut[_0x5b35('0x118')](_0x50e60d);}var _0x1628ef=ut[_0x5b35('0x119')](_0x5b1cad,_0x417495,_0x54a9c2,_0x50e60d,_0x2b23c7,_0x2c9ca0);var _0x4386c0=utils[_0x5b35('0x11a')](_0x417495[_0x5b35('0xe3')]);Object[_0x5b35('0x11b')](_0x1628ef,_0x4386c0);_['merge'](_0x2c9ca0,ut[_0x5b35('0x11c')](_0x1628ef));_0x2c9ca0[_0x5b35('0x5f')]=moment()[_0x5b35('0x26')](_0x5b35('0x60'));_0x5b1cad[_0x5b35('0x11d')]=_0x1628ef;var _0x38e5d9=ut[_0x5b35('0x11e')](_0x2c9ca0,_0x5b1cad,_0x1628ef,_0x2c9ca0[_0x5b35('0x84')],_0x24e831);return ami[_0x5b35('0x48')](_0x38e5d9)[_0x5b35('0x55')](function(_0x460ffd){_0x5b1cad['originated']+=0x1;logger[_0x5b35('0x23')](_0x5b35('0x11f'),_0x2b23c7,_0x5b35('0x8b'),_0x5b1cad[_0x5b35('0x28')],_0x5b35('0x41'),_0x5b1cad[_0x5b35('0xd0')]);_0x270023(_0x460ffd);})['catch'](function(_0x5bb357){ut[_0x5b35('0xd6')](_0x2c9ca0,0xe,'OriginateError');rpcDb[_0x5b35('0xd8')](_0x2c9ca0,'[originateFailure][logOriginateFailure]');_0x2054c0(_0x5bb357);});});};Preview[_0x5b35('0x32')]['syncNewExten']=function(_0xffc663){if(this[_0x5b35('0x14')][_0xffc663[_0x5b35('0x85')]]){this[_0x5b35('0x14')][_0xffc663['linkedid']][_0x5b35('0x4a')]=_0xffc663['channel'];}};Preview[_0x5b35('0x32')]['syncOriginateResponse']=function(_0x341610){var _0x5cf403=this;var _0x4ac831=this[_0x5b35('0x14')][_0x341610['actionid']];if(_0x4ac831){if(_0x4ac831['lookAgent']&&this[_0x5b35('0xe5')][_0x4ac831[_0x5b35('0x120')]]){ut[_0x5b35('0x121')](_0x4ac831,this['agents'][_0x4ac831[_0x5b35('0x120')]]['name'],this[_0x5b35('0xe5')][_0x4ac831[_0x5b35('0x120')]]['id']);}var _0x56520b=_['clone'](_0x4ac831);_0x56520b[_0x5b35('0x122')]=moment()['format'](_0x5b35('0x60'));var _0x4ebb1b=_0x5cf403['campaignsPreview'][_0x4ac831[_0x5b35('0x42')]];if(ut[_0x5b35('0x123')](_0x341610[_0x5b35('0x124')])){if(_0x4ac831[_0x5b35('0x83')]){rpcDb[_0x5b35('0xf7')](_0x4ac831['idContact']);}if(_0x4ac831[_0x5b35('0x84')]){rpcDb[_0x5b35('0x5e')](_0x4ac831[_0x5b35('0x86')]);}ami[_0x5b35('0x22')](_0x5b35('0x125'),ut[_0x5b35('0x7a')](_0x4ac831,_0x5b35('0x126'),this[_0x5b35('0x12')][_0x4ac831[_0x5b35('0x42')]]));this['callProgressDetectingAgent'](_0x56520b,_0x4ebb1b,_0x341610);}else{_0x4ac831[_0x5b35('0x5f')]=moment()[_0x5b35('0x26')](_0x5b35('0x60'));ut[_0x5b35('0xd6')](_0x56520b,0x4,_0x5b35('0x98'));rpcDb['createAgentHistory'](_0x56520b,_0x5b35('0x127'));}}};Preview[_0x5b35('0x32')]['syncHangup']=function(_0x51bd40){var _0x3b2848=this[_0x5b35('0x14')][_0x51bd40[_0x5b35('0x85')]];var _0x10c413;if(_0x3b2848){_0x10c413=this['campaignsPreview'][_0x3b2848[_0x5b35('0x42')]];logger[_0x5b35('0x23')](_0x5b35('0x128'),_0x51bd40['linkedid'],_0x5b35('0x8b'),_0x10c413[_0x5b35('0x28')],_0x5b35('0x8c'),_0x10c413['pTalking']);}if(this['actions'][_0x51bd40[_0x5b35('0x85')]]&&_0x51bd40[_0x5b35('0x85')]!==_0x51bd40['uniqueid']){if(_0x51bd40['cause']==='16'&&this[_0x5b35('0x14')][_0x51bd40[_0x5b35('0x85')]][_0x5b35('0x43')]){this[_0x5b35('0x74')](_0x51bd40,_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')]);}else if(this['actions'][_0x51bd40['linkedid']][_0x5b35('0x43')]){logger[_0x5b35('0x23')](_0x5b35('0x12a'),_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')],'\x20Queue',_0x10c413[_0x5b35('0x28')],'pTalking:\x20',_0x10c413['pTalking']);this['callProgressDetectingCustomer'](_0x51bd40,_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')]);}}else if(_0x3b2848&&_['isNil'](_0x3b2848[_0x5b35('0x12b')])&&_0x10c413[_0x5b35('0x12c')]&&_0x51bd40['linkedid']===_0x51bd40['uniqueid']&&_[_0x5b35('0x3f')](_0x51bd40['reason'])&&_0x51bd40[_0x5b35('0x129')]==='16'&&_0x51bd40[_0x5b35('0x12d')]==='6'&&_['isUndefined'](_0x3b2848[_0x5b35('0x12e')])){if(_0x3b2848[_0x5b35('0x83')]){rpcDb[_0x5b35('0xf7')](_0x3b2848[_0x5b35('0x86')]);}if(_0x3b2848['activeContact']){rpcDb[_0x5b35('0x5e')](_0x3b2848[_0x5b35('0x86')]);}_0x51bd40[_0x5b35('0xd5')]='22';this[_0x5b35('0xd3')](_0x3b2848,_0x10c413,_0x51bd40);}else if(_0x3b2848&&_0x3b2848[_0x5b35('0x12e')]){if(_0x51bd40[_0x5b35('0x129')]==='16'&&this[_0x5b35('0x14')][_0x51bd40[_0x5b35('0x85')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')],_0x5b35('0x8b'),_0x10c413[_0x5b35('0x28')],_0x5b35('0x8c'),_0x10c413[_0x5b35('0x2b')]);this['callProgressDetectingCustomer'](_0x51bd40,_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')]);}else if(this[_0x5b35('0x14')][_0x51bd40[_0x5b35('0x85')]][_0x5b35('0x43')]){logger['info'](_0x5b35('0x12a'),_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')],_0x5b35('0x8b'),_0x10c413[_0x5b35('0x28')],'pTalking:\x20',_0x10c413[_0x5b35('0x2b')]);this[_0x5b35('0x74')](_0x51bd40,_0x51bd40[_0x5b35('0x85')],_0x51bd40[_0x5b35('0x129')]);}}};Preview[_0x5b35('0x32')][_0x5b35('0x1b')]=function(_0xeeb7fd){if(this[_0x5b35('0x14')][_0xeeb7fd[_0x5b35('0xd2')]]&&_0xeeb7fd[_0x5b35('0xd2')]!==_0xeeb7fd[_0x5b35('0x12f')]){this[_0x5b35('0x74')](_0xeeb7fd,_0xeeb7fd[_0x5b35('0xd2')],_0xeeb7fd[_0x5b35('0xc8')]);}};Preview[_0x5b35('0x32')][_0x5b35('0x130')]=function(_0x3c00dd){if(this['actions'][_0x3c00dd[_0x5b35('0x85')]]&&_0x3c00dd[_0x5b35('0x85')]!==_0x3c00dd[_0x5b35('0x8a')]&&!this[_0x5b35('0x14')][_0x3c00dd[_0x5b35('0x85')]][_0x5b35('0x43')]){if(_0x3c00dd[_0x5b35('0x129')]==='1'){this['callProgressDetectingCustomer'](_0x3c00dd,_0x3c00dd[_0x5b35('0x85')],_0x3c00dd[_0x5b35('0x129')]);}}};Preview[_0x5b35('0x32')][_0x5b35('0x131')]=function(_0x4bf1c2,_0x11f4d6,_0x1635c5){if(this[_0x5b35('0x14')][_0x4bf1c2]){if(_[_0x5b35('0x3f')](this['actions'][_0x4bf1c2]['variables'])){this[_0x5b35('0x14')][_0x4bf1c2]['variables']={};}this[_0x5b35('0x14')][_0x4bf1c2]['variables'][_0x11f4d6]=_0x1635c5;}};Preview[_0x5b35('0x32')]['syncVarSet']=function(_0x2729c6){try{if(!_[_0x5b35('0x3f')](_0x2729c6)){if(ut['filterKey'](_[_0x5b35('0x132')](_0x2729c6[_0x5b35('0x133')])[0x0])){this['addVariable'](_0x2729c6[_0x5b35('0x8a')],_[_0x5b35('0x132')](_0x2729c6['variable'])[0x0],_0x2729c6[_0x5b35('0x134')]);}}}catch(_0x9054d0){logger['error'](_0x5b35('0x135'),util[_0x5b35('0x136')](_0x9054d0,{'showHidden':![],'depth':null}));}};Preview[_0x5b35('0x32')][_0x5b35('0x1f')]=function(_0x3b9227){if(_0x3b9227){if(this[_0x5b35('0x14')][_0x3b9227['transfertargetlinkedid']]){this[_0x5b35('0x14')][_0x3b9227[_0x5b35('0x137')]][_0x5b35('0x12e')]=!![];}}};Preview[_0x5b35('0x32')][_0x5b35('0x21')]=function(_0x5dbaa7){if(_0x5dbaa7){if(this[_0x5b35('0x14')][_0x5dbaa7[_0x5b35('0x138')]]){this['actions'][_0x5dbaa7[_0x5b35('0x138')]]['transfer']=!![];}}};module[_0x5b35('0x139')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 05d4d4e..777be49 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 _0x6250=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x28fa06,_0x351ff9){var _0x2e6b5f=function(_0x3f15ca){while(--_0x3f15ca){_0x28fa06['push'](_0x28fa06['shift']());}};_0x2e6b5f(++_0x351ff9);}(_0x6250,0x68));var _0x0625=function(_0x357e9e,_0x5d580f){_0x357e9e=_0x357e9e-0x0;var _0x11e0c5=_0x6250[_0x357e9e];return _0x11e0c5;};'use strict';var util=require(_0x0625('0x0'));var BPromise=require('bluebird');var logger=require(_0x0625('0x1'))(_0x0625('0x2'));var cmHopper=require(_0x0625('0x3'));var cmHopperHistory=require(_0x0625('0x4'));var cmHopperBlack=require(_0x0625('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0625('0x6'));function loggerCatch(_0x4b9e8c){return function(_0xdad4d6){logger[_0x0625('0x7')](_0x4b9e8c,util['inspect'](_0xdad4d6,{'showHidden':![],'depth':null}));};}function create(_0x13ba57){return cmHopperHistory[_0x0625('0x8')](_0x13ba57)[_0x0625('0x9')](loggerCatch(_0x0625('0xa')));}function createAgent(_0x4271a2){return BPromise[_0x0625('0xb')]()['then'](agentReportPreview[_0x0625('0x8')](_0x4271a2))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x57259c){return cmHopper[_0x0625('0xc')](_0x57259c,!![])[_0x0625('0x9')](loggerCatch(_0x0625('0xd')));}exports[_0x0625('0xe')]=function(_0x4b34e8){return cmHopperBlack[_0x0625('0xe')](_0x4b34e8)[_0x0625('0x9')](loggerCatch(_0x0625('0xf')));};exports[_0x0625('0x10')]=function(_0xd317dc){return BPromise[_0x0625('0xb')]()['then'](cmHopper['getContactPreview'](_0xd317dc))[_0x0625('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x0625('0x8')]=function(_0x30371d,_0x1bbfcd){create(_0x30371d)[_0x0625('0x9')](loggerCatch(_0x1bbfcd));moveContact(_0x30371d)[_0x0625('0x9')](loggerCatch(_0x1bbfcd));};exports[_0x0625('0x11')]=function(_0x229af6,_0x3d14f5){createAgent(_0x229af6)['catch'](loggerCatch(_0x3d14f5));};exports[_0x0625('0x12')]=function(_0x326a1a,_0x1c2ba2){create(_0x326a1a)[_0x0625('0x9')](loggerCatch(_0x1c2ba2));};exports[_0x0625('0x13')]=function(_0x4b344f,_0x3fe801){moveContact(_0x4b344f)[_0x0625('0x9')](loggerCatch(_0x3fe801));};exports[_0x0625('0x14')]=function(_0x120a79,_0x45c17c,_0x16ce4d){if(_0x45c17c){_0x120a79['UserId']=null;}if(_0x16ce4d){_0x120a79[_0x0625('0x15')]=![];}return cmHopper[_0x0625('0x14')](_0x120a79)[_0x0625('0x9')](loggerCatch(_0x0625('0x16')));};exports[_0x0625('0x17')]=function(_0xe948f7){return cmHopper['countReScheduled'](_0xe948f7)[_0x0625('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0x0625('0x18')]=function(_0x1dd831){return cmHopper[_0x0625('0x18')]({'UserId':null},_0x1dd831,0x1)[_0x0625('0x9')](loggerCatch(_0x0625('0x19')));};exports[_0x0625('0x1a')]=function(_0x4daabe){return cmHopper[_0x0625('0x18')]({'active':![]},_0x4daabe,0x1)['catch'](loggerCatch(_0x0625('0x1b')));};exports['crateCustomerReportQueue']=function(_0x5909b7){var _0x52ace2={};_0x52ace2[_0x0625('0x1c')]=_0x5909b7[_0x0625('0x1c')];_0x52ace2['uniqueid']=_0x5909b7[_0x0625('0x1d')];_0x52ace2['calleridnum']=_0x5909b7[_0x0625('0x1e')];_0x52ace2[_0x0625('0x1f')]=_0x5909b7[_0x0625('0x1f')];_0x52ace2[_0x0625('0x20')]=_0x5909b7['queue'];_0x52ace2[_0x0625('0x21')]=_0x5909b7[_0x0625('0x22')];_0x52ace2[_0x0625('0x23')]=_0x5909b7[_0x0625('0x22')];_0x52ace2[_0x0625('0x24')]=0x1;_0x52ace2['queuecallercompleteAt']=_0x5909b7['endtime'];_0x52ace2[_0x0625('0x25')]=_0x5909b7['membername'];_0x52ace2['context']=_0x0625('0x26');_0x52ace2[_0x0625('0x27')]=_0x0625('0x28');_0x52ace2['holdtime']=0x0;_0x52ace2[_0x0625('0x29')]=0x1;_0x52ace2[_0x0625('0x2a')]=_0x5909b7[_0x0625('0x2b')];_0x52ace2[_0x0625('0x2c')]=_0x0625('0x2d');return BPromise[_0x0625('0xb')]()['then'](voiceQueueReport[_0x0625('0x2e')](_0x52ace2))[_0x0625('0x9')](loggerCatch(_0x0625('0x2f')));};exports[_0x0625('0x30')]=function(_0x2a41ff,_0x56c152){return BPromise['resolve']()['then'](cmHopper[_0x0625('0x30')](_0x2a41ff,_0x56c152))['catch'](loggerCatch(_0x0625('0x31')));};exports[_0x0625('0x32')]=function(_0x2f79de){return cmHopper['rescheduleContact'](_0x2f79de,!![],!![])[_0x0625('0x9')](loggerCatch(_0x0625('0x33')));}; \ No newline at end of file +var _0x4943=['type','uniqueid','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x5abb7e,_0x4fc56e){var _0xee3848=function(_0x350d8e){while(--_0x350d8e){_0x5abb7e['push'](_0x5abb7e['shift']());}};_0xee3848(++_0x4fc56e);}(_0x4943,0x11e));var _0x3494=function(_0x5bf6f1,_0x5ab5b5){_0x5bf6f1=_0x5bf6f1-0x0;var _0x1488a3=_0x4943[_0x5bf6f1];return _0x1488a3;};'use strict';var util=require('util');var BPromise=require(_0x3494('0x0'));var logger=require(_0x3494('0x1'))('preview');var cmHopper=require(_0x3494('0x2'));var cmHopperHistory=require(_0x3494('0x3'));var cmHopperBlack=require(_0x3494('0x4'));var agentReportPreview=require(_0x3494('0x5'));var voiceQueueReport=require(_0x3494('0x6'));function loggerCatch(_0x345a10){return function(_0x2eefe6){logger[_0x3494('0x7')](_0x345a10,util[_0x3494('0x8')](_0x2eefe6,{'showHidden':![],'depth':null}));};}function create(_0x4e207c){return cmHopperHistory['createHistory'](_0x4e207c)[_0x3494('0x9')](loggerCatch(_0x3494('0xa')));}function createAgent(_0x1cd9b5){return BPromise[_0x3494('0xb')]()[_0x3494('0xc')](agentReportPreview['createHistory'](_0x1cd9b5))[_0x3494('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x555f7b){return cmHopper[_0x3494('0xd')](_0x555f7b,!![])[_0x3494('0x9')](loggerCatch(_0x3494('0xe')));}exports[_0x3494('0xf')]=function(_0x414af2){return cmHopperBlack['checkIsBlackList'](_0x414af2)[_0x3494('0x9')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x3494('0x10')]=function(_0xd822ba){return BPromise[_0x3494('0xb')]()[_0x3494('0xc')](cmHopper[_0x3494('0x10')](_0xd822ba))[_0x3494('0x9')](loggerCatch(_0x3494('0x11')));};exports['createHistory']=function(_0x1cec9e,_0x4d7810){create(_0x1cec9e)[_0x3494('0x9')](loggerCatch(_0x4d7810));moveContact(_0x1cec9e)['catch'](loggerCatch(_0x4d7810));};exports[_0x3494('0x12')]=function(_0x21ae34,_0x2a76fd){createAgent(_0x21ae34)[_0x3494('0x9')](loggerCatch(_0x2a76fd));};exports[_0x3494('0x13')]=function(_0x2cdec6,_0x4c8083){create(_0x2cdec6)[_0x3494('0x9')](loggerCatch(_0x4c8083));};exports[_0x3494('0x14')]=function(_0x3ca2fa,_0x2611b1){moveContact(_0x3ca2fa)[_0x3494('0x9')](loggerCatch(_0x2611b1));};exports[_0x3494('0x15')]=function(_0x243c74,_0x18ac6f,_0x38f936){if(_0x18ac6f){_0x243c74[_0x3494('0x16')]=null;}if(_0x38f936){_0x243c74[_0x3494('0x17')]=![];}return cmHopper['rescheduleContact'](_0x243c74)['catch'](loggerCatch(_0x3494('0x18')));};exports[_0x3494('0x19')]=function(_0x14ba4b){return cmHopper[_0x3494('0x19')](_0x14ba4b)[_0x3494('0x9')](loggerCatch(_0x3494('0x1a')));};exports[_0x3494('0x1b')]=function(_0x478fab){return cmHopper[_0x3494('0x1b')]({'UserId':null},_0x478fab,0x1)[_0x3494('0x9')](loggerCatch(_0x3494('0x1c')));};exports[_0x3494('0x1d')]=function(_0x168d50){return cmHopper[_0x3494('0x1b')]({'active':![]},_0x168d50,0x1)[_0x3494('0x9')](loggerCatch(_0x3494('0x1e')));};exports[_0x3494('0x1f')]=function(_0x463d61){var _0x26e35f={};_0x26e35f[_0x3494('0x20')]=_0x463d61[_0x3494('0x20')];_0x26e35f[_0x3494('0x21')]=_0x463d61[_0x3494('0x21')];_0x26e35f['calleridnum']=_0x463d61['calleridnum'];_0x26e35f['calleridname']=_0x463d61[_0x3494('0x22')];_0x26e35f[_0x3494('0x23')]=_0x463d61[_0x3494('0x23')];_0x26e35f['queuecallerjoinAt']=_0x463d61[_0x3494('0x24')];_0x26e35f[_0x3494('0x25')]=_0x463d61[_0x3494('0x24')];_0x26e35f[_0x3494('0x26')]=0x1;_0x26e35f[_0x3494('0x27')]=_0x463d61[_0x3494('0x28')];_0x26e35f[_0x3494('0x29')]=_0x463d61['membername'];_0x26e35f[_0x3494('0x2a')]=_0x3494('0x2b');_0x26e35f['exten']='xcally-motion-preview';_0x26e35f[_0x3494('0x2c')]=0x0;_0x26e35f['assigned']=0x1;_0x26e35f[_0x3494('0x2d')]=_0x463d61[_0x3494('0x2e')];_0x26e35f[_0x3494('0x2f')]='COMPLETED';return BPromise[_0x3494('0xb')]()[_0x3494('0xc')](voiceQueueReport[_0x3494('0x30')](_0x26e35f))['catch'](loggerCatch(_0x3494('0x31')));};exports[_0x3494('0x32')]=function(_0x40f5cd,_0x72dea2){return BPromise[_0x3494('0xb')]()[_0x3494('0xc')](cmHopper[_0x3494('0x32')](_0x40f5cd,_0x72dea2))[_0x3494('0x9')](loggerCatch(_0x3494('0x33')));};exports['rescheduleContactInQueue']=function(_0x71254d){return cmHopper[_0x3494('0x15')](_0x71254d,!![],!![])[_0x3494('0x9')](loggerCatch(_0x3494('0x34')));}; \ 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 8694f2c..2296d1b 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 _0xd494=['originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','starttime','responsetime','logAgent','state','ringtime','getSeconds','UserId','logCustomer','statedesc','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','hasOwnProperty','toLower','updateOriginated'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0xd494,0xdf));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var _=require(_0x4d49('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x4d49('0x1'));var ipAgi=process[_0x4d49('0x2')][_0x4d49('0x3')]||_0x4d49('0x4');var utils=require(_0x4d49('0x5'));exports[_0x4d49('0x6')]=function(_0x532888){return function(_0x2931ea){logger[_0x4d49('0x7')](_0x532888,util['inspect'](_0x2931ea,{'showHidden':![],'depth':null}));};};exports[_0x4d49('0x8')]=function(_0x64299a,_0x15cbcf){logger[_0x4d49('0x9')](_0x64299a,util[_0x4d49('0xa')](_0x15cbcf,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5c3917,_0x58947e){logger['error'](_0x5c3917,util[_0x4d49('0xa')](_0x58947e,{'showHidden':![],'depth':null}));};exports[_0x4d49('0xb')]=function(_0x35068a){return function(_0x57f9e8){logger[_0x4d49('0x9')](_0x35068a,util['inspect'](_0x57f9e8,{'showHidden':![],'depth':null}));};};exports[_0x4d49('0xc')]=function(_0x3c217a,_0x4a1c53,_0x251d81){return{'message':_0x3c217a,'unlock':_0x4a1c53,'active':_0x251d81};};exports[_0x4d49('0xd')]=function(_0x33e5a5,_0x43fbde,_0x2889ac){if(!_['isUndefined'](_0x2889ac)&&_0x4d49('0xe')===typeof _0x2889ac&&!_['isEmpty'](_0x2889ac)){if(!_[_0x4d49('0xf')](_0x43fbde)&&'string'===typeof _0x43fbde&&!_[_0x4d49('0x10')](_0x43fbde)){return util[_0x4d49('0x11')](_0x4d49('0x12'),_0x43fbde,_0x2889ac);}return util['format'](_0x4d49('0x12'),_0x2889ac,_0x2889ac);}if(!_[_0x4d49('0xf')](_0x33e5a5)&&_0x4d49('0xe')===typeof _0x33e5a5&&!_[_0x4d49('0x10')](_0x33e5a5)){return _0x33e5a5;}return _0x4d49('0x13');};exports[_0x4d49('0x14')]=function(_0x2adcf4){if(_[_0x4d49('0x15')](_0x2adcf4)){return![];}return _0x2adcf4;};exports[_0x4d49('0x16')]=function(_0x45f44a,_0x30d3e1,_0x14b734,_0x3e83c3,_0xc76a9e,_0x2f3fb9){var _0x50dce4={'XMD-QUEUE':_0x30d3e1[_0x4d49('0x17')]?_0x30d3e1[_0x4d49('0x17')][_0x4d49('0x18')]:'','XMD-CALLERID':_0x3e83c3,'XMD-CALLERID-PREVIEW':_0x2f3fb9?util[_0x4d49('0x11')](_0x4d49('0x12'),_0x2f3fb9[_0x4d49('0x19')],_0x2f3fb9[_0x4d49('0x1a')]):_0x3e83c3,'XMD-DIALID':_0xc76a9e,'XMD-CONTACTID':_0x30d3e1[_0x4d49('0x1b')],'XMD-CDRTYPE':_0x4d49('0x1c'),'CALLERID(all)':_0x3e83c3,'XMD-VOICEQUEUEID':_0x30d3e1[_0x4d49('0x1d')],'XMD-DIALCHANNEL':_0x14b734,'XMD-DIALTIMEOUT':_0x45f44a[_0x4d49('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x4d49('0x11')]('\x22rtTxX%s%s\x22',_0x45f44a[_0x4d49('0x1f')]?'g':'',_['isEmpty'](_0x45f44a[_0x4d49('0x20')])?'':_0x4d49('0x21')),'XMD-DIALURL':_0x45f44a[_0x4d49('0x22')]||'','XMD-AGI':_0x45f44a[_0x4d49('0x23')]?util[_0x4d49('0x11')](_0x4d49('0x24'),ipAgi,_0x45f44a[_0x4d49('0x23')]):_0x4d49('0x25'),'XMD-AGIAFTER':_0x45f44a[_0x4d49('0x1f')]?util[_0x4d49('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x45f44a[_0x4d49('0x1f')]):_0x4d49('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2f3fb9?_0x2f3fb9[_0x4d49('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f3fb9?_0x2f3fb9['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x4d49('0x27')};if(!_[_0x4d49('0x10')](_0x45f44a[_0x4d49('0x20')])){_0x50dce4[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x45f44a[_0x4d49('0x20')];_0x50dce4[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xc76a9e;}return _0x50dce4;};exports['toLowerVariables']=function(_0x269eb6){var _0x2e9acc={};for(var _0x552f0b in _0x269eb6){if(_0x269eb6[_0x4d49('0x28')](_0x552f0b)){_0x2e9acc[util[_0x4d49('0x11')]('%s',_[_0x4d49('0x29')](_0x552f0b))]=_0x269eb6[_0x552f0b];}}return{'variables':_0x2e9acc};};exports[_0x4d49('0x2a')]=function(_0x90b71b,_0xbe6a63){if(!_[_0x4d49('0x15')](_0x90b71b)){if(_0x90b71b[_0x4d49('0x28')]('originated')){if(_0x90b71b[_0x4d49('0x2b')]>0x0){_0x90b71b['originated']-=0x1;}else{logger[_0x4d49('0x7')](_0x4d49('0x2c'),_0xbe6a63);}}}else{logger[_0x4d49('0x7')](_0x4d49('0x2d'),_0xbe6a63);}};exports['logBlacklist']=function(_0x23ceaf){var _0x327123=moment()[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x23ceaf['state']=0xd;_0x23ceaf['statedesc']='Blacklist';_0x23ceaf[_0x4d49('0x2e')]=_0x327123;_0x23ceaf[_0x4d49('0x2f')]=_0x327123;_0x23ceaf['endtime']=_0x327123;};exports[_0x4d49('0x30')]=function(_0x275f14,_0x53fce1,_0x2cf593){var _0x4161b1=moment()[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x275f14[_0x4d49('0x31')]=_0x53fce1;_0x275f14['statedesc']=_0x2cf593;_0x275f14['responsetime']=_0x4161b1;_0x275f14[_0x4d49('0x32')]=utils[_0x4d49('0x33')](_0x275f14[_0x4d49('0x2f')],_0x275f14[_0x4d49('0x2e')]);};exports['logLookAgent']=function(_0x128518,_0x53917b,_0x1e92a7){_0x128518['membername']=_0x53917b;_0x128518[_0x4d49('0x34')]=_0x1e92a7;};exports[_0x4d49('0x35')]=function(_0x3dac49,_0x5f12d0,_0x241aea){var _0x1217b6=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3dac49[_0x4d49('0x31')]=_0x5f12d0;_0x3dac49[_0x4d49('0x36')]=_0x241aea;_0x3dac49[_0x4d49('0x2f')]=_0x3dac49['responsetime']?_0x3dac49['responsetime']:_0x1217b6;_0x3dac49[_0x4d49('0x37')]=_0x3dac49[_0x4d49('0x37')]?_0x3dac49['endtime']:_0x1217b6;_0x3dac49[_0x4d49('0x32')]=utils[_0x4d49('0x33')](_0x3dac49[_0x4d49('0x2f')]||0x0,_0x3dac49['starttime']||0x0);_0x3dac49[_0x4d49('0x38')]=_0x3dac49[_0x4d49('0x39')]?utils[_0x4d49('0x33')](_0x3dac49[_0x4d49('0x37')],_0x3dac49[_0x4d49('0x39')]):0x0;};exports['isFailure']=function(_0x1f062e){return _0x1f062e===_0x4d49('0x3a');};exports[_0x4d49('0x3b')]=function(_0x27b942,_0x54381a,_0x5db35e,_0x55a901,_0x5d566c){var _0x10d194=_0x55a901?_0x4d49('0x3c'):_0x27b942[_0x4d49('0x19')];_0x10d194=_0x5d566c?_0x4d49('0x3d'):_0x10d194;return{'actionid':_0x27b942[_0x4d49('0x3e')],'action':_0x4d49('0x3f'),'channel':_0x27b942[_0x4d49('0x40')],'callerid':util[_0x4d49('0x11')](_0x4d49('0x12'),_0x10d194,_0x27b942[_0x4d49('0x1a')]),'Exten':_0x4d49('0x41'),'Context':_0x4d49('0x42'),'Priority':'1','variable':_0x5db35e,'timeout':(_0x54381a[_0x4d49('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27b942[_0x4d49('0x3e')]};};exports['totalGlobal']=function(_0x2bb1d3){return _0x2bb1d3[_0x4d49('0x44')]+_0x2bb1d3[_0x4d49('0x45')]+_0x2bb1d3['countnoanswerretry']+_0x2bb1d3[_0x4d49('0x46')]+_0x2bb1d3[_0x4d49('0x47')];};exports['cloneAction']=function(_0x3789a3){var _0x38154e=_['clone'](_0x3789a3);_0x38154e['state']=0xf;_0x38154e[_0x4d49('0x36')]=_0x4d49('0x48');return _0x38154e;};exports[_0x4d49('0x49')]=function(_0x9534a7,_0x572ab0,_0x26bd4d){var _0x2f4f30={};_0x2f4f30[_0x572ab0]=_0x9534a7[_0x572ab0];_0x2f4f30['active']=![];_0x2f4f30[_0x4d49('0x4a')]=moment()[_0x4d49('0x4b')](_0x26bd4d,'minutes')[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f4f30[_0x4d49('0x1b')]=_0x9534a7['ContactId'];_0x2f4f30[_0x4d49('0x4c')]=_0x9534a7[_0x4d49('0x4c')];_0x2f4f30['VoiceQueueId']=_0x9534a7[_0x4d49('0x1d')]||undefined;return _0x2f4f30;};exports[_0x4d49('0x4d')]=function(_0x25d5eb,_0x161f60){if(!_['isNil'](_0x25d5eb)){if(_0x25d5eb['pTalking']>0x0){_0x25d5eb['pTalking']-=0x1;}else{logger[_0x4d49('0x7')](_0x161f60,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x4d49('0x7')](_0x161f60,_0x4d49('0x4e'));}};exports[_0x4d49('0x4f')]=function(_0x13ed2f){if(_0x13ed2f<=0x0){return!![];}return![];};function buildObj(_0x22240b,_0x46d0a3,_0x309964){_0x22240b['lastevent']=_0x46d0a3;_0x22240b[_0x4d49('0x18')]=_0x22240b[_0x4d49('0x50')];_0x22240b['interface']=_0x22240b[_0x4d49('0x40')];_0x22240b[_0x4d49('0x51')]=_0x4d49('0x52');if(_0x309964){_0x22240b['mandatoryDisposition']=_0x309964[_0x4d49('0x53')];}return _0x22240b;}exports[_0x4d49('0x54')]=buildObj;exports[_0x4d49('0x55')]=function(_0x23d59e){var _0xa7c53f=[];for(var _0x3e7102 in _0x23d59e){if(_0x23d59e[_0x4d49('0x28')](_0x3e7102)){if(!_[_0x4d49('0x15')](_0x23d59e[_0x3e7102])&&_0x23d59e[_0x3e7102][_0x4d49('0x31')]===_0x4d49('0x56')&&_0x23d59e[_0x3e7102][_0x4d49('0x57')]===_0x4d49('0x58')){_0xa7c53f[_0x4d49('0x59')](_0x23d59e[_0x3e7102]['id']);}}}return _0xa7c53f;};exports[_0x4d49('0x5a')]=function(_0x492d87){var _0x4088a0=moment()[_0x4d49('0x5b')](0x0);var _0x397282=moment(_0x492d87)[_0x4d49('0x5b')](0x0);return _0x4088a0['diff'](_0x397282,_0x4d49('0x5c'));};exports['createBody']=function(_0x36d1c1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x36d1c1[_0x4d49('0x1b')],'ListId':_0x36d1c1[_0x4d49('0x4c')],'VoiceQueueId':_0x36d1c1['VoiceQueueId']||undefined,'CampaignId':_0x36d1c1[_0x4d49('0x5d')]||undefined};};exports[_0x4d49('0x5e')]=function(_0x325e76){if(_0x325e76===_0x4d49('0x3e')||_0x325e76==='idContact'||_0x325e76===_0x4d49('0x50')||_0x325e76===_0x4d49('0x5f')||_0x325e76===_0x4d49('0x60')||_0x325e76===_0x4d49('0x61')||_0x325e76==='membername'||_0x325e76==='channelAgent'||_0x325e76==='calleridname'||_0x325e76===_0x4d49('0x62')||_0x325e76==='calleridnum'||_0x325e76===_0x4d49('0x4a')||_0x325e76===_0x4d49('0x44')||_0x325e76===_0x4d49('0x45')||_0x325e76==='countnoanswerretry'||_0x325e76===_0x4d49('0x63')||_0x325e76===_0x4d49('0x64')||_0x325e76===_0x4d49('0x65')||_0x325e76===_0x4d49('0x66')||_0x325e76===_0x4d49('0x67')||_0x325e76===_0x4d49('0x1b')||_0x325e76===_0x4d49('0x4c')||_0x325e76===_0x4d49('0x34')||_0x325e76==='VoiceQueueId'||_0x325e76===_0x4d49('0x68')||_0x325e76===_0x4d49('0x69')||_0x325e76==='xmd-queue'||_0x325e76==='xmd-phone'||_0x325e76==='xmd-listid'||_0x325e76==='xmd-dialurl'||_0x325e76==='xmd-dialtimeout'||_0x325e76===_0x4d49('0x6a')||_0x325e76===_0x4d49('0x6b')||_0x325e76==='xmd-dialchannel'||_0x325e76===_0x4d49('0x6c')||_0x325e76==='xmd-cdrtype'||_0x325e76===_0x4d49('0x6d')||_0x325e76===_0x4d49('0x6e')||_0x325e76===_0x4d49('0x6f')||_0x325e76===_0x4d49('0x70')||_0x325e76===_0x4d49('0x71')||_0x325e76===_0x4d49('0x72')||_0x325e76===_0x4d49('0x73')||_0x325e76===_0x4d49('0x74')||_0x325e76==='rtpaudioqoslossbridged'||_0x325e76===_0x4d49('0x75')||_0x325e76==='rtpaudioqosrttbridged'||_0x325e76===_0x4d49('0x70')||_0x325e76===_0x4d49('0x71')||_0x325e76===_0x4d49('0x72')||_0x325e76==='rtpaudioqosjitterbridged'||_0x325e76===_0x4d49('0x74')||_0x325e76===_0x4d49('0x76')||_0x325e76===_0x4d49('0x75')||_0x325e76===_0x4d49('0x77')||_0x325e76===_0x4d49('0x78')||_0x325e76==='bridgepvtcallid'||_0x325e76===_0x4d49('0x31')||_0x325e76==='statedesc'){return![];}return!![];};exports[_0x4d49('0x79')]=function(_0x36d21e,_0x351393){var _0x387e2f,_0x1591d3,_0x580bb4;if(_0x351393<=0x0){_0x351393=0x1;}_0x387e2f=new RegExp(_0x4d49('0x7a')+_0x351393+'}$');_0x1591d3=Math[_0x4d49('0x7b')](0xa,_0x351393-0x1);_0x580bb4=Math[_0x4d49('0x7b')](0xa,_0x351393)-0x1;return util[_0x4d49('0x11')]('%s',_[_0x4d49('0x7c')](_0x36d21e,_0x387e2f,_['random'](_0x1591d3,_0x580bb4)));};exports[_0x4d49('0x7d')]=function(_0x5134af){var _0x40eff0=_0x5134af[_0x4d49('0x7e')](/"(.*?)"/);return _0x40eff0?_0x40eff0[0x1]:_0x5134af;};exports['extractCalleridNumber']=function(_0x497993){var _0x263023=_0x497993[_0x4d49('0x7e')](/<(.*?)>/);return _0x263023?_0x263023[0x1]:_0x497993;};function buildNoAnswerEventPayload(_0x4d52d9,_0x44c202){var _0x4f80e1=buildObj(_0x4d52d9,_0x4d49('0x7f'));if(!_['isEmpty'](_0x44c202[_0x4d49('0x80')])){Object[_0x4d49('0x81')](_0x44c202[_0x4d49('0x80')])[_0x4d49('0x82')](function(_0x2b7b0f){_0x4f80e1[_0x2b7b0f[_0x4d49('0x83')]()]=_0x44c202[_0x4d49('0x80')][_0x2b7b0f];});}return _0x4f80e1;}exports[_0x4d49('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x7e2e=['xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','logLookAgent','membername','UserId','logCustomer','ringtime','getSeconds','talktime','answertime','variablesAction','RECALL','xcally-motion-preview','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','add','minutes','ContactId','ListId','decrementTalking','isNil','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','lastevent','name','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','filterKey','idContact','type','dialAnswer','active','scheduledat','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialurl'];(function(_0x3e7e88,_0x28a495){var _0x2658c0=function(_0xb3c9d7){while(--_0xb3c9d7){_0x3e7e88['push'](_0x3e7e88['shift']());}};_0x2658c0(++_0x28a495);}(_0x7e2e,0x136));var _0xe7e2=function(_0x221b03,_0x377b3d){_0x221b03=_0x221b03-0x0;var _0x319f06=_0x7e2e[_0x221b03];return _0x319f06;};'use strict';var util=require('util');var _=require(_0xe7e2('0x0'));var moment=require(_0xe7e2('0x1'));var logger=require(_0xe7e2('0x2'))(_0xe7e2('0x3'));var ipAgi=process[_0xe7e2('0x4')][_0xe7e2('0x5')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0xe7e2('0x6')]=function(_0x4be68f){return function(_0x372ce8){logger[_0xe7e2('0x7')](_0x4be68f,util[_0xe7e2('0x8')](_0x372ce8,{'showHidden':![],'depth':null}));};};exports[_0xe7e2('0x9')]=function(_0x56affd,_0x3efdd9){logger[_0xe7e2('0xa')](_0x56affd,util['inspect'](_0x3efdd9,{'showHidden':![],'depth':null}));};exports[_0xe7e2('0xb')]=function(_0x17afb4,_0x3285f8){logger['error'](_0x17afb4,util[_0xe7e2('0x8')](_0x3285f8,{'showHidden':![],'depth':null}));};exports[_0xe7e2('0xc')]=function(_0x587b21){return function(_0x38f5c3){logger[_0xe7e2('0xa')](_0x587b21,util[_0xe7e2('0x8')](_0x38f5c3,{'showHidden':![],'depth':null}));};};exports[_0xe7e2('0xd')]=function(_0x200a8a,_0x32b5ff,_0x40d8b4){return{'message':_0x200a8a,'unlock':_0x32b5ff,'active':_0x40d8b4};};exports[_0xe7e2('0xe')]=function(_0x6fba79,_0x4e3605,_0x42d446){if(!_[_0xe7e2('0xf')](_0x42d446)&&'string'===typeof _0x42d446&&!_['isEmpty'](_0x42d446)){if(!_[_0xe7e2('0xf')](_0x4e3605)&&_0xe7e2('0x10')===typeof _0x4e3605&&!_[_0xe7e2('0x11')](_0x4e3605)){return util[_0xe7e2('0x12')](_0xe7e2('0x13'),_0x4e3605,_0x42d446);}return util[_0xe7e2('0x12')](_0xe7e2('0x13'),_0x42d446,_0x42d446);}if(!_['isUndefined'](_0x6fba79)&&_0xe7e2('0x10')===typeof _0x6fba79&&!_['isEmpty'](_0x6fba79)){return _0x6fba79;}return _0xe7e2('0x14');};exports[_0xe7e2('0x15')]=function(_0x2e53a2){if(_['isNil'](_0x2e53a2)){return![];}return _0x2e53a2;};exports[_0xe7e2('0x16')]=function(_0x2d23cc,_0x4d052c,_0x32219d,_0x3e1eea,_0x28900d,_0x5aa31d){var _0x1cd57c={'XMD-QUEUE':_0x4d052c[_0xe7e2('0x17')]?_0x4d052c['Queue']['name']:'','XMD-CALLERID':_0x3e1eea,'XMD-CALLERID-PREVIEW':_0x5aa31d?util[_0xe7e2('0x12')](_0xe7e2('0x13'),_0x5aa31d[_0xe7e2('0x18')],_0x5aa31d[_0xe7e2('0x19')]):_0x3e1eea,'XMD-DIALID':_0x28900d,'XMD-CONTACTID':_0x4d052c['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3e1eea,'XMD-VOICEQUEUEID':_0x4d052c[_0xe7e2('0x1a')],'XMD-DIALCHANNEL':_0x32219d,'XMD-DIALTIMEOUT':_0x2d23cc[_0xe7e2('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xe7e2('0x12')]('\x22rtTxX%s%s\x22',_0x2d23cc[_0xe7e2('0x1c')]?'g':'',_['isEmpty'](_0x2d23cc[_0xe7e2('0x1d')])?'':_0xe7e2('0x1e')),'XMD-DIALURL':_0x2d23cc['dialPreviewUrl']||'','XMD-AGI':_0x2d23cc[_0xe7e2('0x1f')]?util[_0xe7e2('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2d23cc[_0xe7e2('0x1f')]):_0xe7e2('0x20'),'XMD-AGIAFTER':_0x2d23cc['dialQueueProject2']?util[_0xe7e2('0x12')](_0xe7e2('0x21'),ipAgi,_0x2d23cc[_0xe7e2('0x1c')]):_0xe7e2('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x5aa31d?_0x5aa31d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5aa31d?_0x5aa31d[_0xe7e2('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xe7e2('0x11')](_0x2d23cc['monitor_format'])){_0x1cd57c[util[_0xe7e2('0x12')]('%s',_0xe7e2('0x23'))]=_0x2d23cc[_0xe7e2('0x1d')];_0x1cd57c[util[_0xe7e2('0x12')]('%s',_0xe7e2('0x24'))]=_0x28900d;}return _0x1cd57c;};exports[_0xe7e2('0x25')]=function(_0x2dd805){var _0x1a8204={};for(var _0x358293 in _0x2dd805){if(_0x2dd805['hasOwnProperty'](_0x358293)){_0x1a8204[util[_0xe7e2('0x12')]('%s',_[_0xe7e2('0x26')](_0x358293))]=_0x2dd805[_0x358293];}}return{'variables':_0x1a8204};};exports[_0xe7e2('0x27')]=function(_0x54a659){var _0x31b98d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x54a659[_0xe7e2('0x28')]=0xd;_0x54a659[_0xe7e2('0x29')]=_0xe7e2('0x2a');_0x54a659['starttime']=_0x31b98d;_0x54a659[_0xe7e2('0x2b')]=_0x31b98d;_0x54a659[_0xe7e2('0x2c')]=_0x31b98d;};exports[_0xe7e2('0x2d')]=function(_0x388d8e,_0x5bf4e8,_0x4ee036){var _0x203e79=moment()[_0xe7e2('0x12')](_0xe7e2('0x2e'));_0x388d8e[_0xe7e2('0x28')]=_0x5bf4e8;_0x388d8e[_0xe7e2('0x29')]=_0x4ee036;_0x388d8e['responsetime']=_0x203e79;_0x388d8e['ringtime']=utils['getSeconds'](_0x388d8e[_0xe7e2('0x2b')],_0x388d8e[_0xe7e2('0x2f')]);};exports[_0xe7e2('0x30')]=function(_0x2691ad,_0xc5998a,_0x4407cd){_0x2691ad[_0xe7e2('0x31')]=_0xc5998a;_0x2691ad[_0xe7e2('0x32')]=_0x4407cd;};exports[_0xe7e2('0x33')]=function(_0x324c34,_0x15b481,_0x5ec3a8){var _0x484e0c=moment()[_0xe7e2('0x12')](_0xe7e2('0x2e'));_0x324c34['state']=_0x15b481;_0x324c34['statedesc']=_0x5ec3a8;_0x324c34[_0xe7e2('0x2b')]=_0x324c34[_0xe7e2('0x2b')]?_0x324c34['responsetime']:_0x484e0c;_0x324c34[_0xe7e2('0x2c')]=_0x324c34[_0xe7e2('0x2c')]?_0x324c34['endtime']:_0x484e0c;_0x324c34[_0xe7e2('0x34')]=utils[_0xe7e2('0x35')](_0x324c34['responsetime']||0x0,_0x324c34[_0xe7e2('0x2f')]||0x0);_0x324c34[_0xe7e2('0x36')]=_0x324c34[_0xe7e2('0x37')]?utils[_0xe7e2('0x35')](_0x324c34['endtime'],_0x324c34[_0xe7e2('0x37')]):0x0;};exports['isFailure']=function(_0x25c75e){return _0x25c75e==='Failure';};exports[_0xe7e2('0x38')]=function(_0xfcd29e,_0x56b213,_0x2cbbc3,_0x5e59e5,_0x33fdce){var _0x3a8c22=_0x5e59e5?_0xe7e2('0x39'):_0xfcd29e[_0xe7e2('0x18')];_0x3a8c22=_0x33fdce?'BOOKED':_0x3a8c22;return{'actionid':_0xfcd29e['uniqueid'],'action':'originate','channel':_0xfcd29e['channelAgent'],'callerid':util[_0xe7e2('0x12')](_0xe7e2('0x13'),_0x3a8c22,_0xfcd29e[_0xe7e2('0x19')]),'Exten':_0xe7e2('0x3a'),'Context':_0xe7e2('0x3b'),'Priority':'1','variable':_0x2cbbc3,'timeout':(_0x56b213[_0xe7e2('0x3c')]||0x1e)*0x3e8,'async':!![],'channelid':_0xfcd29e[_0xe7e2('0x3d')]};};exports[_0xe7e2('0x3e')]=function(_0xab8b13){return _0xab8b13[_0xe7e2('0x3f')]+_0xab8b13[_0xe7e2('0x40')]+_0xab8b13[_0xe7e2('0x41')]+_0xab8b13[_0xe7e2('0x42')]+_0xab8b13[_0xe7e2('0x43')];};exports[_0xe7e2('0x44')]=function(_0x52e1bf){var _0x57a4db=_[_0xe7e2('0x45')](_0x52e1bf);_0x57a4db[_0xe7e2('0x28')]=0xf;_0x57a4db['statedesc']=_0xe7e2('0x46');return _0x57a4db;};exports[_0xe7e2('0x47')]=function(_0x2ddf4f,_0x2e1242,_0xf71793){var _0x51bae3={};_0x51bae3[_0x2e1242]=_0x2ddf4f[_0x2e1242];_0x51bae3['active']=![];_0x51bae3['scheduledat']=moment()[_0xe7e2('0x48')](_0xf71793,_0xe7e2('0x49'))[_0xe7e2('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x51bae3[_0xe7e2('0x4a')]=_0x2ddf4f['ContactId'];_0x51bae3[_0xe7e2('0x4b')]=_0x2ddf4f[_0xe7e2('0x4b')];_0x51bae3[_0xe7e2('0x1a')]=_0x2ddf4f[_0xe7e2('0x1a')]||undefined;return _0x51bae3;};exports[_0xe7e2('0x4c')]=function(_0x543ef3,_0x4d89f4){if(!_[_0xe7e2('0x4d')](_0x543ef3)){if(_0x543ef3['pTalking']>0x0){_0x543ef3[_0xe7e2('0x4e')]-=0x1;}else{logger['info'](_0x4d89f4,_0xe7e2('0x4f'));}}else{logger[_0xe7e2('0x7')](_0x4d89f4,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1f24a5){if(_0x1f24a5<=0x0){return!![];}return![];};function buildObj(_0x239bc7,_0x237c94,_0x2384ae){_0x239bc7[_0xe7e2('0x50')]=_0x237c94;_0x239bc7[_0xe7e2('0x51')]=_0x239bc7[_0xe7e2('0x52')];_0x239bc7[_0xe7e2('0x53')]=_0x239bc7[_0xe7e2('0x54')];_0x239bc7[_0xe7e2('0x55')]=_0xe7e2('0x56');if(_0x2384ae){_0x239bc7[_0xe7e2('0x57')]=_0x2384ae[_0xe7e2('0x57')];}return _0x239bc7;}exports[_0xe7e2('0x58')]=buildObj;exports[_0xe7e2('0x59')]=function(_0x208405){var _0x26f9f6=[];for(var _0x31dad5 in _0x208405){if(_0x208405[_0xe7e2('0x5a')](_0x31dad5)){if(!_[_0xe7e2('0x4d')](_0x208405[_0x31dad5])&&_0x208405[_0x31dad5][_0xe7e2('0x28')]===_0xe7e2('0x5b')&&_0x208405[_0x31dad5][_0xe7e2('0x5c')]===_0xe7e2('0x5d')){_0x26f9f6[_0xe7e2('0x5e')](_0x208405[_0x31dad5]['id']);}}}return _0x26f9f6;};exports[_0xe7e2('0x5f')]=function(_0x31888c){var _0x49f641=moment()['milliseconds'](0x0);var _0x26e204=moment(_0x31888c)[_0xe7e2('0x60')](0x0);return _0x49f641['diff'](_0x26e204,_0xe7e2('0x61'));};exports[_0xe7e2('0x62')]=function(_0x281007){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x281007[_0xe7e2('0x4a')],'ListId':_0x281007[_0xe7e2('0x4b')],'VoiceQueueId':_0x281007[_0xe7e2('0x1a')]||undefined,'CampaignId':_0x281007['CampaignId']||undefined};};exports[_0xe7e2('0x63')]=function(_0x39308a){if(_0x39308a===_0xe7e2('0x3d')||_0x39308a===_0xe7e2('0x64')||_0x39308a===_0xe7e2('0x52')||_0x39308a===_0xe7e2('0x65')||_0x39308a==='campaigntype'||_0x39308a===_0xe7e2('0x66')||_0x39308a===_0xe7e2('0x31')||_0x39308a===_0xe7e2('0x54')||_0x39308a===_0xe7e2('0x18')||_0x39308a===_0xe7e2('0x67')||_0x39308a===_0xe7e2('0x19')||_0x39308a===_0xe7e2('0x68')||_0x39308a===_0xe7e2('0x3f')||_0x39308a===_0xe7e2('0x40')||_0x39308a===_0xe7e2('0x41')||_0x39308a===_0xe7e2('0x69')||_0x39308a===_0xe7e2('0x6a')||_0x39308a===_0xe7e2('0x6b')||_0x39308a==='callbackat'||_0x39308a===_0xe7e2('0x6c')||_0x39308a===_0xe7e2('0x4a')||_0x39308a===_0xe7e2('0x4b')||_0x39308a==='UserId'||_0x39308a===_0xe7e2('0x1a')||_0x39308a===_0xe7e2('0x6d')||_0x39308a==='xmd-voicequeueid'||_0x39308a==='xmd-queue'||_0x39308a===_0xe7e2('0x6e')||_0x39308a===_0xe7e2('0x6f')||_0x39308a===_0xe7e2('0x70')||_0x39308a===_0xe7e2('0x71')||_0x39308a===_0xe7e2('0x72')||_0x39308a===_0xe7e2('0x73')||_0x39308a===_0xe7e2('0x74')||_0x39308a===_0xe7e2('0x75')||_0x39308a===_0xe7e2('0x76')||_0x39308a===_0xe7e2('0x77')||_0x39308a==='xmd-agiafter'||_0x39308a===_0xe7e2('0x78')||_0x39308a===_0xe7e2('0x79')||_0x39308a===_0xe7e2('0x7a')||_0x39308a==='rtpaudioqosjitter'||_0x39308a===_0xe7e2('0x7b')||_0x39308a===_0xe7e2('0x7c')||_0x39308a===_0xe7e2('0x7d')||_0x39308a===_0xe7e2('0x7e')||_0x39308a===_0xe7e2('0x7f')||_0x39308a===_0xe7e2('0x79')||_0x39308a===_0xe7e2('0x7a')||_0x39308a===_0xe7e2('0x80')||_0x39308a===_0xe7e2('0x7b')||_0x39308a===_0xe7e2('0x7c')||_0x39308a===_0xe7e2('0x7d')||_0x39308a===_0xe7e2('0x7e')||_0x39308a==='rtpaudioqosrttbridged'||_0x39308a===_0xe7e2('0x81')||_0x39308a==='bridgepvtcallid'||_0x39308a==='state'||_0x39308a==='statedesc'){return![];}return!![];};exports[_0xe7e2('0x82')]=function(_0xfd1044,_0x192aea){var _0xa85bf7,_0x5c6156,_0xaf3a9b;if(_0x192aea<=0x0){_0x192aea=0x1;}_0xa85bf7=new RegExp(_0xe7e2('0x83')+_0x192aea+'}$');_0x5c6156=Math['pow'](0xa,_0x192aea-0x1);_0xaf3a9b=Math[_0xe7e2('0x84')](0xa,_0x192aea)-0x1;return util[_0xe7e2('0x12')]('%s',_['replace'](_0xfd1044,_0xa85bf7,_[_0xe7e2('0x85')](_0x5c6156,_0xaf3a9b)));};exports['extractCalleridName']=function(_0x55c18b){var _0x195238=_0x55c18b[_0xe7e2('0x86')](/"(.*?)"/);return _0x195238?_0x195238[0x1]:_0x55c18b;};exports['extractCalleridNumber']=function(_0x56bf65){var _0x3c2e69=_0x56bf65['match'](/<(.*?)>/);return _0x3c2e69?_0x3c2e69[0x1]:_0x56bf65;};function buildNoAnswerEventPayload(_0x56bc6b,_0x16feac){var _0x448192=buildObj(_0x56bc6b,_0xe7e2('0x87'));if(!_[_0xe7e2('0x11')](_0x16feac[_0xe7e2('0x88')])){Object[_0xe7e2('0x89')](_0x16feac[_0xe7e2('0x88')])[_0xe7e2('0x8a')](function(_0x589cbc){_0x448192[_0x589cbc[_0xe7e2('0x8b')]()]=_0x16feac['variables'][_0x589cbc];});}return _0x448192;}exports[_0xe7e2('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0f0a10f..3f3c1b3 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 _0x4925=['voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x139eeb,_0x1de53e){var _0x53bf0a=function(_0x55f6e0){while(--_0x55f6e0){_0x139eeb['push'](_0x139eeb['shift']());}};_0x53bf0a(++_0x1de53e);}(_0x4925,0x8d));var _0x5492=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x4925[_0x590b61];return _0x1a14dc;};'use strict';exports[_0x5492('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x5492('0x1'),'required':!![]},'penalty':{'type':_0x5492('0x2'),'required':![]},'paused':{'type':_0x5492('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x5492('0x1'),'required':!![]},'interface':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x5492('0x3')},'reason':{'type':_0x5492('0x1'),'required':![]}};exports[_0x5492('0x5')]={'module':{'type':'string','required':![]}};exports[_0x5492('0x6')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x7')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x5492('0x1')},'mixmonitorid':{'type':_0x5492('0x1')}};exports[_0x5492('0x8')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x9')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x5492('0x1')}}; \ No newline at end of file +var _0xa77f=['queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','queueremove'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0xa77f,0x15b));var _0xfa77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa77f[_0x20a584];return _0x4b41a8;};'use strict';exports['queueadd']={'queue':{'type':_0xfa77('0x0'),'required':!![]},'interface':{'type':_0xfa77('0x0'),'required':!![]},'membername':{'type':_0xfa77('0x0'),'required':!![]},'penalty':{'type':_0xfa77('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xfa77('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xfa77('0x3')]={'interface':{'type':_0xfa77('0x0'),'required':!![]},'paused':{'type':_0xfa77('0x4')},'reason':{'type':'string','required':![]}};exports[_0xfa77('0x5')]={'module':{'type':'string','required':![]}};exports[_0xfa77('0x6')]={'uniqueid':{'type':_0xfa77('0x0'),'required':!![]}};exports[_0xfa77('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xfa77('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0xfa77('0x0')}};exports[_0xfa77('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xfa77('0x9')]={'uniqueid':{'type':_0xfa77('0x0'),'required':!![]},'exten':{'type':_0xfa77('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6f44f3e..78829a4 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 _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x5d3a22,_0x59ffcd){var _0xefcb06=function(_0x45a634){while(--_0x45a634){_0x5d3a22['push'](_0x5d3a22['shift']());}};_0xefcb06(++_0x59ffcd);}(_0x757a,0xde));var _0xa757=function(_0x424c1a,_0x364333){_0x424c1a=_0x424c1a-0x0;var _0x543c7e=_0x757a[_0x424c1a];return _0x543c7e;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x47a2b0,_0x2ae226){var _0x5ea4ba=function(_0x4ee738){while(--_0x4ee738){_0x47a2b0['push'](_0x47a2b0['shift']());}};_0x5ea4ba(++_0x2ae226);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 9c2f5c6..e5c30db 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8975=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x2fe780,_0x3ff71b){var _0x3b67cc=function(_0xbb4782){while(--_0xbb4782){_0x2fe780['push'](_0x2fe780['shift']());}};_0x3b67cc(++_0x3ff71b);}(_0x8975,0xb0));var _0x5897=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8975[_0x1cc8fe];return _0x230054;};'use strict';function mergeDBDataToRealtime(_0x2fb38c,_0x4f6693){var _0xeb2cfc=Object[_0x5897('0x0')]({},_0x2fb38c);for(var _0x3ec850 in _0x4f6693){if(_0xeb2cfc[_0x5897('0x1')](_0x3ec850)){_0xeb2cfc[_0x3ec850]=_0x4f6693[_0x3ec850];}}return _0xeb2cfc;}exports[_0x5897('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xf916=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0xdc51f0,_0x13c7ec){var _0x33fd58=function(_0x171c9b){while(--_0x171c9b){_0xdc51f0['push'](_0xdc51f0['shift']());}};_0x33fd58(++_0x13c7ec);}(_0xf916,0xf3));var _0x6f91=function(_0x33549b,_0x5caf63){_0x33549b=_0x33549b-0x0;var _0x562cbe=_0xf916[_0x33549b];return _0x562cbe;};'use strict';function mergeDBDataToRealtime(_0x13f916,_0x48893d){var _0x475bb3=Object['assign']({},_0x13f916);for(var _0x565eff in _0x48893d){if(_0x475bb3[_0x6f91('0x0')](_0x565eff)){_0x475bb3[_0x565eff]=_0x48893d[_0x565eff];}}return _0x475bb3;}exports[_0x6f91('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1bf7c32..525fc5b 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 _0x4a63=['from-sip','xcally-motion-preview','calleridpreview','destinationchannel','callerid','originatecalleridnum','disposition','connectedlinenum','calleridname','transfers','linkedid','UserId','membername','create','monitor','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','context','from-voip-provider'];(function(_0x547d31,_0x4994e9){var _0x144af8=function(_0x3fd7ed){while(--_0x3fd7ed){_0x547d31['push'](_0x547d31['shift']());}};_0x144af8(++_0x4994e9);}(_0x4a63,0xd6));var _0x34a6=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x4a63[_0x369151];return _0x4292d5;};'use strict';var _=require('lodash');var moment=require(_0x34a6('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x34a6('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x34a6('0x2'));var RpcVoiceDialReport=require(_0x34a6('0x3'));var RpcMemberReport=require(_0x34a6('0x4'));var RpcVoiceQueueReport=require(_0x34a6('0x5'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x34a6('0x6'));var VoiceCallReport=require(_0x34a6('0x7'));var VoiceAgentReport=require(_0x34a6('0x8'));var VoiceDialReport=require(_0x34a6('0x9'));var UserReport=require(_0x34a6('0xa'));function Report(_0x5e6c8f){this[_0x34a6('0xb')]=_0x5e6c8f;this['agents']=_0x5e6c8f[_0x34a6('0xc')];this[_0x34a6('0xd')]=_0x5e6c8f['telephones'];}Report[_0x34a6('0xe')]['sync']=function(_0x4bf041){var _0x76c630=new VoiceQueueReport(this['realtime']);var _0x4cf150=new VoiceAgentReport(this[_0x34a6('0xb')]);var _0xbb62b9=new VoiceDialReport(this[_0x34a6('0xb')]);var _0x33d29f=new VoiceCallReport(this[_0x34a6('0xb')]);var _0x1aced2=new UserReport(this[_0x34a6('0xb')]);if(config[_0x34a6('0xf')]&&config[_0x34a6('0xf')][_0x34a6('0x10')]){ami['on']('custom:voiceQueueReport',this[_0x34a6('0x11')][_0x34a6('0x12')](this));ami['on'](_0x34a6('0x13'),this[_0x34a6('0x14')][_0x34a6('0x12')](this));ami['on'](_0x34a6('0x15'),this[_0x34a6('0x16')]['bind'](this));ami['on'](_0x34a6('0x17'),this[_0x34a6('0x18')][_0x34a6('0x12')](this));ami['on'](_0x34a6('0x19'),this[_0x34a6('0x1a')][_0x34a6('0x12')](this));ami['on'](_0x34a6('0x1b'),this[_0x34a6('0x1c')]['bind'](this));}};Report['prototype'][_0x34a6('0x1d')]=function(_0x1f6cec){var _0x1ce188;_0x1ce188=_[_0x34a6('0x1e')](this[_0x34a6('0xc')],function(_0x5ad5f2){return _0x5ad5f2[_0x34a6('0x1f')]==_0x1f6cec||_0x5ad5f2[_0x34a6('0x20')]==_0x1f6cec;});if(_[_0x34a6('0x21')](_0x1ce188)){var _0x2f22f8=_[_0x34a6('0x1e')](this['telephones'],function(_0x4cfbec){return _0x4cfbec[_0x34a6('0x1f')]==_0x1f6cec||_0x4cfbec[_0x34a6('0x20')]==_0x1f6cec;});if(_0x2f22f8){_0x1ce188=_[_0x34a6('0x1e')](this['agents'],function(_0x36d702){return _0x36d702[_0x34a6('0x22')]==util[_0x34a6('0x23')]('SIP/%s',_0x2f22f8['name']);});}}return _0x1ce188;};Report['prototype'][_0x34a6('0x11')]=function(_0x2e90e4){for(var _0x4a957c=0x0;_0x4a957c<_0x2e90e4[_0x34a6('0x24')];_0x4a957c+=0x1){var _0xa81098=this['findAgent'](_0x2e90e4[_0x4a957c]['connectedlinenum']);if(_0xa81098){_0x2e90e4[_0x4a957c]['accountcode']=_0xa81098['accountcode'];_0x2e90e4[_0x4a957c][_0x34a6('0x25')]=!![];_0x2e90e4[_0x4a957c][_0x34a6('0x26')]=_0xa81098[_0x34a6('0x20')];_0x2e90e4[_0x4a957c][_0x34a6('0x22')]=_[_0x34a6('0x21')](_0xa81098[_0x34a6('0x22')])?util[_0x34a6('0x23')](_0x34a6('0x27'),_0xa81098['name']):_0xa81098[_0x34a6('0x22')];if(_0x2e90e4[_0x4a957c][_0x34a6('0x28')]){_0x2e90e4[_0x4a957c][_0x34a6('0x29')]=moment()[_0x34a6('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e90e4[_0x4a957c]['queuecallerexit']){_0x2e90e4[_0x4a957c]['queuecallerexitAt']=moment()['format'](_0x34a6('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x2e90e4[_0x4a957c]);}RpcVoiceQueueReport['create'](_0x2e90e4[_0x4a957c]);}};function extractCalleridNumber(_0x2c2f3b){var _0x2e7637=_0x2c2f3b[_0x34a6('0x2b')](/<(.*?)>/);return _0x2e7637?_0x2e7637[0x1]:_0x2c2f3b;}Report['prototype'][_0x34a6('0x2c')]=function(_0x47f477){for(var _0x19d19f=0x0;_0x19d19f',_0x1f67aa[_0x34a6('0x43')],_0x1f67aa[_0x34a6('0x31')]);}if(RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa[_0x34a6('0x45')]]){var _0x231ac4=RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa[_0x34a6('0x45')]];_0x231ac4['transfereelinkedid']=_0x1f67aa['uniqueid'];RpcVoiceTransferReport[_0x34a6('0x1a')](_0x231ac4);delete RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa['linkedid']];}if(_['isNil'](_0x1f67aa[_0x34a6('0x35')])){_0x1f67aa[_0x34a6('0x35')]=this[_0x34a6('0x2e')](_0x1f67aa);}if(_[_0x34a6('0x21')](_0x1f67aa[_0x34a6('0x46')])){var _0x18b103=_0x1f67aa['channel'][_0x34a6('0x30')]('-')[0x0];var _0x2ba453=this[_0x34a6('0xc')][_0x18b103];if(!_0x2ba453)_0x2ba453=this[_0x34a6('0x2c')](_0x1f67aa[_0x34a6('0x1f')]);if(_0x2ba453){_0x1f67aa['UserId']=_0x2ba453['id'];_0x1f67aa[_0x34a6('0x47')]=_0x2ba453[_0x34a6('0x20')];}}RpcVoiceCallReport[_0x34a6('0x48')](_0x1f67aa);if(_0x1f67aa[_0x34a6('0x49')]){for(var _0x19b90f=0x0;_0x19b90f<_0x1f67aa[_0x34a6('0x4a')][_0x34a6('0x24')];_0x19b90f+=0x1){_0x1f67aa['monitorFilename']=_0x1f67aa[_0x34a6('0x4a')][_0x19b90f][_0x34a6('0x4b')];_0x1f67aa[_0x34a6('0x4c')]=_0x1f67aa[_0x34a6('0x4a')][_0x19b90f]['createdAt'];if(_0x1f67aa[_0x34a6('0x4d')]==_0x34a6('0x3c')){_0x1f67aa[_0x34a6('0x31')]=_0x1f67aa['connectedlinenum'];_0x1f67aa[_0x34a6('0x43')]=_0x1f67aa['connectedlinename'];_0x1f67aa[_0x34a6('0x42')]=_0x1f67aa[_0x34a6('0x1f')];_0x1f67aa[_0x34a6('0x4e')]=_0x1f67aa[_0x34a6('0x47')];_0x1f67aa['exten']=_0x1f67aa['originatecalleridnum'];}else if(_0x1f67aa['exten']==_0x34a6('0x4f')){_0x1f67aa[_0x34a6('0x31')]=_0x1f67aa[_0x34a6('0x34')];_0x1f67aa[_0x34a6('0x4d')]=_0x1f67aa[_0x34a6('0x40')];}RpcVoiceRecording[_0x34a6('0x48')](_0x1f67aa);}}};Report[_0x34a6('0xe')][_0x34a6('0x16')]=function(_0x470085){if(_[_0x34a6('0x50')](_0x470085)){_0x470085[_0x34a6('0x51')](function(_0xeb7e33){RpcVoiceAgentReport[_0x34a6('0x48')](_0xeb7e33);});}else{RpcVoiceAgentReport[_0x34a6('0x48')](_0x470085);}};Report[_0x34a6('0xe')][_0x34a6('0x18')]=function(_0x3f3a79){RpcVoiceDialReport[_0x34a6('0x48')](_0x3f3a79);var _0x104520;var _0x17d0e9;var _0x1093d3=_0x3f3a79[_0x34a6('0x2f')];if(_[_0x34a6('0x52')](_0x1093d3,_0x34a6('0x53'))){_0x17d0e9=_0x1093d3[_0x34a6('0x54')](_0x1093d3[_0x34a6('0x55')]('/')+0x1,_0x1093d3[_0x34a6('0x55')]('@'));_0x104520=_[_0x34a6('0x1e')](this[_0x34a6('0xc')],function(_0x11d89e){return _0x11d89e[_0x34a6('0x56')]==_0x17d0e9||_0x11d89e[_0x34a6('0x57')]==_0x17d0e9||_0x11d89e[_0x34a6('0x1f')]==_0x17d0e9;});}else{_0x17d0e9=_0x1093d3[_0x34a6('0x54')](_0x1093d3[_0x34a6('0x55')]('/')+0x1,_0x1093d3[_0x34a6('0x58')]('-'));_0x104520=this[_0x34a6('0x1d')](_0x17d0e9);}if(_0x104520){_0x3f3a79['interface']=_[_0x34a6('0x21')](_0x104520[_0x34a6('0x22')])?util[_0x34a6('0x23')](_0x34a6('0x27'),_0x104520[_0x34a6('0x20')]):_0x104520['interface'];_0x3f3a79['membername']=_0x104520[_0x34a6('0x20')];_0x3f3a79[_0x34a6('0x1f')]=_0x104520[_0x34a6('0x1f')];RpcMemberReport[_0x34a6('0x18')](_0x3f3a79);}};Report[_0x34a6('0xe')][_0x34a6('0x1a')]=function(_0x289799){RpcVoiceTransferReport['transfers'][_0x289799[_0x34a6('0x59')]]=_0x289799;};Report[_0x34a6('0xe')]['attendedTransfer']=function(_0x3c021c){RpcVoiceTransferReport['attendedTransfer'](_0x3c021c);};module[_0x34a6('0x5a')]=Report; \ No newline at end of file +var _0x9195=['monitorFilename','filename','createdAt','calleridname','connectedlinename','voiceAgentReport','isArray','voiceDialReport','startsWith','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','find','accountcode','name','format','SIP/%s','findAgent','connectedlinenum','assigned','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','getAgentByInternal','length','keys','getCallType','channel','calleridnum','outbound','destination','exten','lastapplication','queue','callerid','context','from-sip','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','uniqueid','isNil','type','split','UserId','membername','create','monitor','monitors'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x9195,0x67));var _0x5919=function(_0x4d7714,_0x18ce8b){_0x4d7714=_0x4d7714-0x0;var _0x59e3c6=_0x9195[_0x4d7714];return _0x59e3c6;};'use strict';var _=require(_0x5919('0x0'));var moment=require(_0x5919('0x1'));var util=require('util');var config=require(_0x5919('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x5919('0x3'));var RpcVoiceDialReport=require(_0x5919('0x4'));var RpcMemberReport=require(_0x5919('0x5'));var RpcVoiceQueueReport=require(_0x5919('0x6'));var RpcVoiceRecording=require(_0x5919('0x7'));var RpcVoiceTransferReport=require(_0x5919('0x8'));var VoiceQueueReport=require(_0x5919('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x5919('0xa'));var VoiceDialReport=require(_0x5919('0xb'));var UserReport=require(_0x5919('0xc'));function Report(_0x17655a){this[_0x5919('0xd')]=_0x17655a;this[_0x5919('0xe')]=_0x17655a[_0x5919('0xe')];this['telephones']=_0x17655a[_0x5919('0xf')];}Report[_0x5919('0x10')][_0x5919('0x11')]=function(_0x16a988){var _0x2843b0=new VoiceQueueReport(this['realtime']);var _0xdd07d5=new VoiceAgentReport(this[_0x5919('0xd')]);var _0xd3f55a=new VoiceDialReport(this[_0x5919('0xd')]);var _0xf2cb39=new VoiceCallReport(this[_0x5919('0xd')]);var _0x57ecb0=new UserReport(this[_0x5919('0xd')]);if(config[_0x5919('0x12')]&&config[_0x5919('0x12')][_0x5919('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x5919('0x14')][_0x5919('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x5919('0x16')]['bind'](this));ami['on'](_0x5919('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x5919('0x18'),this['voiceDialReport'][_0x5919('0x15')](this));ami['on'](_0x5919('0x19'),this[_0x5919('0x1a')][_0x5919('0x15')](this));ami['on'](_0x5919('0x1b'),this['attendedTransfer']['bind'](this));}};Report[_0x5919('0x10')]['findAgent']=function(_0x32c0ae){var _0x5ac35c;_0x5ac35c=_[_0x5919('0x1c')](this['agents'],function(_0xaa5772){return _0xaa5772[_0x5919('0x1d')]==_0x32c0ae||_0xaa5772['name']==_0x32c0ae;});if(_['isNil'](_0x5ac35c)){var _0x4b47e4=_[_0x5919('0x1c')](this[_0x5919('0xf')],function(_0x4286bd){return _0x4286bd[_0x5919('0x1d')]==_0x32c0ae||_0x4286bd[_0x5919('0x1e')]==_0x32c0ae;});if(_0x4b47e4){_0x5ac35c=_[_0x5919('0x1c')](this['agents'],function(_0x3ad764){return _0x3ad764['interface']==util[_0x5919('0x1f')](_0x5919('0x20'),_0x4b47e4[_0x5919('0x1e')]);});}}return _0x5ac35c;};Report[_0x5919('0x10')][_0x5919('0x14')]=function(_0x29dbf2){for(var _0x50673d=0x0;_0x50673d<_0x29dbf2['length'];_0x50673d+=0x1){var _0x147f12=this[_0x5919('0x21')](_0x29dbf2[_0x50673d][_0x5919('0x22')]);if(_0x147f12){_0x29dbf2[_0x50673d][_0x5919('0x1d')]=_0x147f12[_0x5919('0x1d')];_0x29dbf2[_0x50673d][_0x5919('0x23')]=!![];_0x29dbf2[_0x50673d]['lastAssignedTo']=_0x147f12[_0x5919('0x1e')];_0x29dbf2[_0x50673d][_0x5919('0x24')]=_['isNil'](_0x147f12[_0x5919('0x24')])?util['format'](_0x5919('0x20'),_0x147f12[_0x5919('0x1e')]):_0x147f12[_0x5919('0x24')];if(_0x29dbf2[_0x50673d][_0x5919('0x25')]){_0x29dbf2[_0x50673d][_0x5919('0x26')]=moment()[_0x5919('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x29dbf2[_0x50673d]['queuecallerexit']){_0x29dbf2[_0x50673d][_0x5919('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x5919('0x14')](_0x29dbf2[_0x50673d]);}RpcVoiceQueueReport['create'](_0x29dbf2[_0x50673d]);}};function extractCalleridNumber(_0x218c90){var _0x4be37c=_0x218c90['match'](/<(.*?)>/);return _0x4be37c?_0x4be37c[0x1]:_0x218c90;}Report[_0x5919('0x10')][_0x5919('0x28')]=function(_0x67be62){for(var _0x40a9cf=0x0;_0x40a9cf',_0x4ebef0['calleridname'],_0x4ebef0['calleridnum']);}if(RpcVoiceTransferReport[_0x5919('0x3b')][_0x4ebef0[_0x5919('0x3c')]]){var _0x4d8d45=RpcVoiceTransferReport[_0x5919('0x3b')][_0x4ebef0[_0x5919('0x3c')]];_0x4d8d45[_0x5919('0x3d')]=_0x4ebef0[_0x5919('0x3e')];RpcVoiceTransferReport[_0x5919('0x1a')](_0x4d8d45);delete RpcVoiceTransferReport[_0x5919('0x3b')][_0x4ebef0[_0x5919('0x3c')]];}if(_[_0x5919('0x3f')](_0x4ebef0['type'])){_0x4ebef0[_0x5919('0x40')]=this[_0x5919('0x2b')](_0x4ebef0);}if(_[_0x5919('0x3f')](_0x4ebef0['UserId'])){var _0x127a96=_0x4ebef0[_0x5919('0x2c')][_0x5919('0x41')]('-')[0x0];var _0x121c13=this['agents'][_0x127a96];if(!_0x121c13)_0x121c13=this['getAgentByInternal'](_0x4ebef0[_0x5919('0x1d')]);if(_0x121c13){_0x4ebef0[_0x5919('0x42')]=_0x121c13['id'];_0x4ebef0[_0x5919('0x43')]=_0x121c13[_0x5919('0x1e')];}}RpcVoiceCallReport[_0x5919('0x44')](_0x4ebef0);if(_0x4ebef0[_0x5919('0x45')]){for(var _0x539194=0x0;_0x539194<_0x4ebef0[_0x5919('0x46')][_0x5919('0x29')];_0x539194+=0x1){_0x4ebef0[_0x5919('0x47')]=_0x4ebef0['monitors'][_0x539194][_0x5919('0x48')];_0x4ebef0[_0x5919('0x49')]=_0x4ebef0[_0x5919('0x46')][_0x539194]['createdAt'];if(_0x4ebef0[_0x5919('0x30')]=='xcally-motion-preview'){_0x4ebef0[_0x5919('0x2d')]=_0x4ebef0[_0x5919('0x22')];_0x4ebef0[_0x5919('0x4a')]=_0x4ebef0[_0x5919('0x4b')];_0x4ebef0['connectedlinenum']=_0x4ebef0[_0x5919('0x1d')];_0x4ebef0[_0x5919('0x4b')]=_0x4ebef0[_0x5919('0x43')];_0x4ebef0[_0x5919('0x30')]=_0x4ebef0[_0x5919('0x37')];}else if(_0x4ebef0[_0x5919('0x30')]=='xcally-motion-dialer'){_0x4ebef0[_0x5919('0x2d')]=_0x4ebef0[_0x5919('0x2f')];_0x4ebef0['exten']=_0x4ebef0[_0x5919('0x37')];}RpcVoiceRecording[_0x5919('0x44')](_0x4ebef0);}}};Report[_0x5919('0x10')][_0x5919('0x4c')]=function(_0x9769b5){if(_[_0x5919('0x4d')](_0x9769b5)){_0x9769b5['forEach'](function(_0x4b80d2){RpcVoiceAgentReport[_0x5919('0x44')](_0x4b80d2);});}else{RpcVoiceAgentReport[_0x5919('0x44')](_0x9769b5);}};Report['prototype'][_0x5919('0x4e')]=function(_0x33dc61){RpcVoiceDialReport['create'](_0x33dc61);var _0x2af23c;var _0x524d76;var _0x262f1a=_0x33dc61[_0x5919('0x2c')];if(_[_0x5919('0x4f')](_0x262f1a,'Local')){_0x524d76=_0x262f1a['substring'](_0x262f1a[_0x5919('0x50')]('/')+0x1,_0x262f1a['indexOf']('@'));_0x2af23c=_[_0x5919('0x1c')](this[_0x5919('0xe')],function(_0x262de8){return _0x262de8[_0x5919('0x51')]==_0x524d76||_0x262de8[_0x5919('0x52')]==_0x524d76||_0x262de8['accountcode']==_0x524d76;});}else{_0x524d76=_0x262f1a['substring'](_0x262f1a[_0x5919('0x50')]('/')+0x1,_0x262f1a[_0x5919('0x53')]('-'));_0x2af23c=this[_0x5919('0x21')](_0x524d76);}if(_0x2af23c){_0x33dc61['interface']=_[_0x5919('0x3f')](_0x2af23c[_0x5919('0x24')])?util[_0x5919('0x1f')](_0x5919('0x20'),_0x2af23c[_0x5919('0x1e')]):_0x2af23c['interface'];_0x33dc61[_0x5919('0x43')]=_0x2af23c[_0x5919('0x1e')];_0x33dc61[_0x5919('0x1d')]=_0x2af23c[_0x5919('0x1d')];RpcMemberReport[_0x5919('0x4e')](_0x33dc61);}};Report[_0x5919('0x10')][_0x5919('0x1a')]=function(_0x2560f3){RpcVoiceTransferReport['transfers'][_0x2560f3[_0x5919('0x54')]]=_0x2560f3;};Report[_0x5919('0x10')][_0x5919('0x55')]=function(_0x2a58a3){RpcVoiceTransferReport[_0x5919('0x55')](_0x2a58a3);};module[_0x5919('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 299d3ae..d652500 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32d8=['toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','[userReport][sipshowregistry]','actionDeviceStateList','catch','error','[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','state','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local'];(function(_0x4ac005,_0x551222){var _0x36b43a=function(_0x23c0a9){while(--_0x23c0a9){_0x4ac005['push'](_0x4ac005['shift']());}};_0x36b43a(++_0x551222);}(_0x32d8,0x1e6));var _0x832d=function(_0x7fd4eb,_0x3a3d90){_0x7fd4eb=_0x7fd4eb-0x0;var _0x42e5e3=_0x32d8[_0x7fd4eb];return _0x42e5e3;};'use strict';var _=require(_0x832d('0x0'));var moment=require(_0x832d('0x1'));var util=require(_0x832d('0x2'));var Redis=require(_0x832d('0x3'));var BPromise=require(_0x832d('0x4'));var config=require('../../../config/environment');var logger=require(_0x832d('0x5'))(_0x832d('0x6'));var ami=require(_0x832d('0x7'));config['redis']=_[_0x832d('0x8')](config[_0x832d('0x9')],{'host':_0x832d('0xa'),'port':0x18eb});var io=require(_0x832d('0xb'))(new Redis(config[_0x832d('0x9')]));function UserReport(_0xa9cb58){this[_0x832d('0xc')]=_0xa9cb58[_0x832d('0xc')];this[_0x832d('0xd')]=_0xa9cb58['agents'];this[_0x832d('0xe')]=_0xa9cb58[_0x832d('0xe')];ami['on']('registryentry',this[_0x832d('0xf')][_0x832d('0x10')](this));ami['on'](_0x832d('0x11'),this[_0x832d('0xf')][_0x832d('0x10')](this));ami['on'](_0x832d('0x12'),this[_0x832d('0x13')]['bind'](this));ami['on'](_0x832d('0x14'),this[_0x832d('0x15')][_0x832d('0x10')](this));return this[_0x832d('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0x832d('0x17')](ami[_0x832d('0x18')]())['catch'](function(_0x272555){logger['error'](_0x832d('0x19'),util['inspect'](_0x272555,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x832d('0x1a')]())[_0x832d('0x1b')](function(_0xee1d09){logger[_0x832d('0x1c')](_0x832d('0x1d'),util[_0x832d('0x1e')](_0xee1d09,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x832d('0x17')](ami['actionSipPeerStatus']())[_0x832d('0x1b')](function(_0x4d396c){logger[_0x832d('0x1c')](_0x832d('0x1f'),util[_0x832d('0x1e')](_0x4d396c,{'showHidden':![],'depth':null}));});}UserReport[_0x832d('0x20')][_0x832d('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0x832d('0x17')](showSipRegistrations())[_0x832d('0x17')](listDeviceStates())[_0x832d('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x832d('0x20')][_0x832d('0x21')]=function(_0x36b6b0){return _0x36b6b0!==null&&!_['isUndefined'](_0x36b6b0);};UserReport[_0x832d('0x20')]['emit']=function(_0x2e9b7a,_0x3f90eb,_0x3dfe41){io['to'](_0x2e9b7a)[_0x832d('0x22')](_0x3f90eb,_0x3dfe41);};UserReport[_0x832d('0x20')][_0x832d('0xf')]=function(_0x3d91b8){try{if(this[_0x832d('0x21')](_0x3d91b8)){logger[_0x832d('0x23')](_0x832d('0x24'),_0x3d91b8[_0x832d('0x25')],_0x3d91b8['state']);logger[_0x832d('0x26')](_0x832d('0x27'),util[_0x832d('0x1e')](_0x3d91b8,{'showHidden':![],'depth':null}));var _0x12ce52=_['find'](this['trunks'],{'defaultuser':_0x3d91b8[_0x832d('0x25')]});if(_0x12ce52){_0x3d91b8['stateRegistry']=_0x3d91b8[_0x832d('0x28')];_[_0x832d('0x29')](_0x12ce52,_['omit'](_0x3d91b8,[_0x832d('0x2a'),_0x832d('0x2b'),'username',_0x832d('0x28')]));logger[_0x832d('0x26')](_0x832d('0x2c'),util['inspect'](_0x12ce52,{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x2e'),_0x12ce52[_0x832d('0x2f')]),_0x832d('0x30'),_0x12ce52);}}}catch(_0x2b3f93){logger[_0x832d('0x1c')](_0x832d('0x27'),util[_0x832d('0x1e')](_0x2b3f93,{'showHidden':![],'depth':null}));}};UserReport[_0x832d('0x20')][_0x832d('0x13')]=function(_0x595e3f){try{if(this[_0x832d('0x21')](_0x595e3f)){logger[_0x832d('0x23')](_0x832d('0x31'),_0x595e3f['device'],_0x595e3f[_0x832d('0x28')]);logger[_0x832d('0x26')](_0x832d('0x32'),util[_0x832d('0x1e')](_0x595e3f,{'showHidden':![],'depth':null}));if(this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]]){if(!this[_0x832d('0xd')][_0x595e3f['device']][_0x832d('0x34')]||_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]()==_0x832d('0x36')){this['agents'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x34')]=![];if(this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]]['state']!==_0x595e3f[_0x832d('0x28')]['toLowerCase']()){this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()[_0x832d('0x2d')]('x'));}this['agents'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x28')]=_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]();this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x39')](_0x595e3f);}}else if(this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]]){if(this[_0x832d('0xe')][_0x595e3f['device']][_0x832d('0x28')]!==_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]()){this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()['format']('x'));}this['telephones'][_0x595e3f[_0x832d('0x33')]]['state']=_0x595e3f[_0x832d('0x28')]['toLowerCase']();logger[_0x832d('0x26')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x832d('0x1e')](this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x3a'),this['telephones'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x2f')]),'telephone:save',this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]]);}else if(this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]]){if(this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x28')]!==_0x595e3f['state'][_0x832d('0x35')]()){this['trunks'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()[_0x832d('0x2d')]('x'));}this['trunks'][_0x595e3f['device']][_0x832d('0x28')]=_0x595e3f['state'][_0x832d('0x35')]();logger[_0x832d('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x595e3f['device']],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x2e'),this['trunks'][_0x595e3f[_0x832d('0x33')]]['name']),'trunk:save',this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]]);}else if(_[_0x832d('0x3b')](_0x595e3f[_0x832d('0x33')],_0x832d('0x3c'))){var _0x496161=_0x595e3f[_0x832d('0x33')];var _0x175edf=_0x496161[_0x832d('0x3d')](_0x496161[_0x832d('0x3e')]('/')+0x1,_0x496161[_0x832d('0x3e')]('@'));var _0x72d337=_[_0x832d('0x3f')](this[_0x832d('0xd')],function(_0xc89b5f){return _0xc89b5f[_0x832d('0x40')]==_0x175edf||_0xc89b5f[_0x832d('0x41')]==_0x175edf||_0xc89b5f[_0x832d('0x42')]==_0x175edf;});if(_0x72d337){if(_0x72d337[_0x832d('0x28')]!==_0x595e3f[_0x832d('0x28')]['toLowerCase']()){_0x72d337[_0x832d('0x37')]=_[_0x832d('0x38')](moment()['format']('x'));}_0x72d337[_0x832d('0x28')]=_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]();_0x72d337[_0x832d('0x34')]=!![];_0x72d337[_0x832d('0x39')](_0x595e3f);}}}}catch(_0x342fdd){logger[_0x832d('0x1c')](_0x832d('0x32'),util['inspect'](_0x342fdd,{'showHidden':![],'depth':null}));}};UserReport[_0x832d('0x20')][_0x832d('0x15')]=function(_0x2513c2){try{if(this['isNotNull'](_0x2513c2)&&this[_0x832d('0x21')](_0x2513c2[_0x832d('0x14')])){logger[_0x832d('0x23')](_0x832d('0x43'),_0x2513c2['peer'],_0x2513c2['address'],_0x2513c2[_0x832d('0x14')]);logger[_0x832d('0x26')](_0x832d('0x44'),util[_0x832d('0x1e')](_0x2513c2,{'showHidden':![],'depth':null}));if(this[_0x832d('0xd')][_0x2513c2[_0x832d('0x45')]]){if(!this[_0x832d('0xd')][_0x2513c2['peer']][_0x832d('0x34')]||_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]()==_0x832d('0x46')){this['agents'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x34')]=![];this[_0x832d('0xd')][_0x2513c2['peer']][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this[_0x832d('0xd')][_0x2513c2['peer']]['address']=_0x2513c2[_0x832d('0x48')];this[_0x832d('0xd')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x39')](_0x2513c2);}}else if(this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]]){this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this['telephones'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x48')]=_0x2513c2[_0x832d('0x48')];logger[_0x832d('0x26')](_0x832d('0x49'),util[_0x832d('0x1e')](this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x3a'),this['telephones'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x2f')]),_0x832d('0x4a'),this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]]);}else if(this[_0x832d('0xc')][_0x2513c2['peer']]){this[_0x832d('0xc')][_0x2513c2['peer']][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this[_0x832d('0xc')][_0x2513c2['peer']][_0x832d('0x48')]=_0x2513c2[_0x832d('0x48')];logger[_0x832d('0x26')](_0x832d('0x4b'),util[_0x832d('0x1e')](this['trunks'][_0x2513c2[_0x832d('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x832d('0x2d')](_0x832d('0x2e'),this[_0x832d('0xc')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x2f')]),_0x832d('0x30'),this[_0x832d('0xc')][_0x2513c2[_0x832d('0x45')]]);}}}catch(_0x1a19a8){logger[_0x832d('0x1c')](_0x832d('0x44'),util['inspect'](_0x1a19a8,{'showHidden':![],'depth':null}));}};module[_0x832d('0x4c')]=UserReport; \ No newline at end of file +var _0x2868=['debug','[userReport][registry]','find','merge','omit','event','actionid','trunk:%s','name','trunk:save','isNotNull','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','exports','lodash','moment','ioredis','../../../config/environment','ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state'];(function(_0x2483e7,_0x41351f){var _0x224252=function(_0x4450b1){while(--_0x4450b1){_0x2483e7['push'](_0x2483e7['shift']());}};_0x224252(++_0x41351f);}(_0x2868,0x198));var _0x8286=function(_0x3c3ade,_0x74b340){_0x3c3ade=_0x3c3ade-0x0;var _0x264b20=_0x2868[_0x3c3ade];return _0x264b20;};'use strict';var _=require(_0x8286('0x0'));var moment=require(_0x8286('0x1'));var util=require('util');var Redis=require(_0x8286('0x2'));var BPromise=require('bluebird');var config=require(_0x8286('0x3'));var logger=require('../../../config/logger')(_0x8286('0x4'));var ami=require('../ami');config[_0x8286('0x5')]=_['defaults'](config[_0x8286('0x5')],{'host':_0x8286('0x6'),'port':0x18eb});var io=require(_0x8286('0x7'))(new Redis(config[_0x8286('0x5')]));function UserReport(_0x43eecc){this[_0x8286('0x8')]=_0x43eecc[_0x8286('0x8')];this[_0x8286('0x9')]=_0x43eecc['agents'];this['telephones']=_0x43eecc[_0x8286('0xa')];ami['on'](_0x8286('0xb'),this['syncRegistry'][_0x8286('0xc')](this));ami['on']('registry',this[_0x8286('0xd')][_0x8286('0xc')](this));ami['on'](_0x8286('0xe'),this[_0x8286('0xf')][_0x8286('0xc')](this));ami['on']('peerstatus',this[_0x8286('0x10')][_0x8286('0xc')](this));return this[_0x8286('0x11')]();}function showSipRegistrations(){Promise[_0x8286('0x12')]()[_0x8286('0x13')](ami[_0x8286('0x14')]())['catch'](function(_0x5dc64e){logger[_0x8286('0x15')](_0x8286('0x16'),util[_0x8286('0x17')](_0x5dc64e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8286('0x12')]()[_0x8286('0x13')](ami[_0x8286('0x18')]())[_0x8286('0x19')](function(_0x2da15a){logger[_0x8286('0x15')](_0x8286('0x1a'),util[_0x8286('0x17')](_0x2da15a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8286('0x12')]()['then'](ami[_0x8286('0x1b')]())[_0x8286('0x19')](function(_0x5f4371){logger['error'](_0x8286('0x1c'),util[_0x8286('0x17')](_0x5f4371,{'showHidden':![],'depth':null}));});}UserReport[_0x8286('0x1d')][_0x8286('0x11')]=function(){setInterval(function(){BPromise[_0x8286('0x12')]()['then'](showSipRegistrations())[_0x8286('0x13')](listDeviceStates())[_0x8286('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x8286('0x1d')]['isNotNull']=function(_0x3a396c){return _0x3a396c!==null&&!_[_0x8286('0x1e')](_0x3a396c);};UserReport[_0x8286('0x1d')][_0x8286('0x1f')]=function(_0x22b06a,_0x10b2e4,_0x51ed96){io['to'](_0x22b06a)[_0x8286('0x1f')](_0x10b2e4,_0x51ed96);};UserReport[_0x8286('0x1d')]['syncRegistry']=function(_0x59281){try{if(this['isNotNull'](_0x59281)){logger[_0x8286('0x20')](_0x8286('0x21'),_0x59281[_0x8286('0x22')],_0x59281[_0x8286('0x23')]);logger[_0x8286('0x24')](_0x8286('0x25'),util[_0x8286('0x17')](_0x59281,{'showHidden':![],'depth':null}));var _0x18132c=_[_0x8286('0x26')](this[_0x8286('0x8')],{'defaultuser':_0x59281[_0x8286('0x22')]});if(_0x18132c){_0x59281['stateRegistry']=_0x59281[_0x8286('0x23')];_[_0x8286('0x27')](_0x18132c,_[_0x8286('0x28')](_0x59281,[_0x8286('0x29'),_0x8286('0x2a'),_0x8286('0x22'),'state']));logger[_0x8286('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x8286('0x17')](_0x18132c,{'showHidden':![],'depth':null}));this[_0x8286('0x1f')](util['format'](_0x8286('0x2b'),_0x18132c[_0x8286('0x2c')]),_0x8286('0x2d'),_0x18132c);}}}catch(_0x7cbc9e){logger[_0x8286('0x15')](_0x8286('0x25'),util[_0x8286('0x17')](_0x7cbc9e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x8286('0xf')]=function(_0x14b914){try{if(this[_0x8286('0x2e')](_0x14b914)){logger[_0x8286('0x20')](_0x8286('0x2f'),_0x14b914[_0x8286('0x30')],_0x14b914['state']);logger['debug']('[userReport][devicestatechange]',util[_0x8286('0x17')](_0x14b914,{'showHidden':![],'depth':null}));if(this[_0x8286('0x9')][_0x14b914[_0x8286('0x30')]]){if(!this[_0x8286('0x9')][_0x14b914['device']][_0x8286('0x31')]||_0x14b914[_0x8286('0x23')][_0x8286('0x32')]()==_0x8286('0x33')){this['agents'][_0x14b914['device']][_0x8286('0x31')]=![];if(this[_0x8286('0x9')][_0x14b914[_0x8286('0x30')]][_0x8286('0x23')]!==_0x14b914[_0x8286('0x23')][_0x8286('0x32')]()){this[_0x8286('0x9')][_0x14b914['device']]['stateTime']=_[_0x8286('0x34')](moment()[_0x8286('0x35')]('x'));}this['agents'][_0x14b914[_0x8286('0x30')]][_0x8286('0x23')]=_0x14b914[_0x8286('0x23')][_0x8286('0x32')]();this[_0x8286('0x9')][_0x14b914[_0x8286('0x30')]][_0x8286('0x36')](_0x14b914);}}else if(this[_0x8286('0xa')][_0x14b914[_0x8286('0x30')]]){if(this[_0x8286('0xa')][_0x14b914['device']][_0x8286('0x23')]!==_0x14b914[_0x8286('0x23')]['toLowerCase']()){this['telephones'][_0x14b914[_0x8286('0x30')]][_0x8286('0x37')]=_[_0x8286('0x34')](moment()[_0x8286('0x35')]('x'));}this['telephones'][_0x14b914[_0x8286('0x30')]][_0x8286('0x23')]=_0x14b914[_0x8286('0x23')][_0x8286('0x32')]();logger[_0x8286('0x24')](_0x8286('0x38'),util[_0x8286('0x17')](this[_0x8286('0xa')][_0x14b914[_0x8286('0x30')]],{'showHidden':![],'depth':null}));this[_0x8286('0x1f')](util['format']('telephone:%s',this[_0x8286('0xa')][_0x14b914['device']][_0x8286('0x2c')]),_0x8286('0x39'),this[_0x8286('0xa')][_0x14b914[_0x8286('0x30')]]);}else if(this[_0x8286('0x8')][_0x14b914['device']]){if(this['trunks'][_0x14b914[_0x8286('0x30')]][_0x8286('0x23')]!==_0x14b914[_0x8286('0x23')][_0x8286('0x32')]()){this[_0x8286('0x8')][_0x14b914[_0x8286('0x30')]][_0x8286('0x37')]=_[_0x8286('0x34')](moment()[_0x8286('0x35')]('x'));}this['trunks'][_0x14b914['device']][_0x8286('0x23')]=_0x14b914['state'][_0x8286('0x32')]();logger[_0x8286('0x24')](_0x8286('0x3a'),util[_0x8286('0x17')](this[_0x8286('0x8')][_0x14b914[_0x8286('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x8286('0x35')]('trunk:%s',this[_0x8286('0x8')][_0x14b914['device']][_0x8286('0x2c')]),_0x8286('0x2d'),this['trunks'][_0x14b914[_0x8286('0x30')]]);}else if(_['startsWith'](_0x14b914[_0x8286('0x30')],_0x8286('0x3b'))){var _0x1d85a7=_0x14b914['device'];var _0x34d5f9=_0x1d85a7[_0x8286('0x3c')](_0x1d85a7[_0x8286('0x3d')]('/')+0x1,_0x1d85a7[_0x8286('0x3d')]('@'));var _0x4d31cf=_[_0x8286('0x26')](this[_0x8286('0x9')],function(_0x2ab577){return _0x2ab577[_0x8286('0x3e')]==_0x34d5f9||_0x2ab577['phone']==_0x34d5f9||_0x2ab577['accountcode']==_0x34d5f9;});if(_0x4d31cf){if(_0x4d31cf['state']!==_0x14b914[_0x8286('0x23')][_0x8286('0x32')]()){_0x4d31cf['stateTime']=_[_0x8286('0x34')](moment()[_0x8286('0x35')]('x'));}_0x4d31cf[_0x8286('0x23')]=_0x14b914[_0x8286('0x23')][_0x8286('0x32')]();_0x4d31cf[_0x8286('0x31')]=!![];_0x4d31cf[_0x8286('0x36')](_0x14b914);}}}}catch(_0x29c8e8){logger[_0x8286('0x15')](_0x8286('0x3f'),util[_0x8286('0x17')](_0x29c8e8,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x32354c){try{if(this['isNotNull'](_0x32354c)&&this[_0x8286('0x2e')](_0x32354c[_0x8286('0x40')])){logger[_0x8286('0x20')](_0x8286('0x41'),_0x32354c[_0x8286('0x42')],_0x32354c[_0x8286('0x43')],_0x32354c[_0x8286('0x40')]);logger[_0x8286('0x24')](_0x8286('0x44'),util[_0x8286('0x17')](_0x32354c,{'showHidden':![],'depth':null}));if(this['agents'][_0x32354c['peer']]){if(!this[_0x8286('0x9')][_0x32354c[_0x8286('0x42')]][_0x8286('0x31')]||_0x32354c[_0x8286('0x40')][_0x8286('0x32')]()==_0x8286('0x45')){this[_0x8286('0x9')][_0x32354c[_0x8286('0x42')]]['local']=![];this[_0x8286('0x9')][_0x32354c['peer']][_0x8286('0x46')]=_0x32354c[_0x8286('0x40')][_0x8286('0x32')]();this[_0x8286('0x9')][_0x32354c[_0x8286('0x42')]]['address']=_0x32354c['address'];this[_0x8286('0x9')][_0x32354c[_0x8286('0x42')]][_0x8286('0x36')](_0x32354c);}}else if(this['telephones'][_0x32354c['peer']]){this[_0x8286('0xa')][_0x32354c[_0x8286('0x42')]][_0x8286('0x46')]=_0x32354c[_0x8286('0x40')]['toLowerCase']();this[_0x8286('0xa')][_0x32354c['peer']][_0x8286('0x43')]=_0x32354c[_0x8286('0x43')];logger[_0x8286('0x24')](_0x8286('0x47'),util['inspect'](this['telephones'][_0x32354c[_0x8286('0x42')]],{'showHidden':![],'depth':null}));this[_0x8286('0x1f')](util[_0x8286('0x35')](_0x8286('0x48'),this[_0x8286('0xa')][_0x32354c[_0x8286('0x42')]][_0x8286('0x2c')]),_0x8286('0x39'),this[_0x8286('0xa')][_0x32354c[_0x8286('0x42')]]);}else if(this[_0x8286('0x8')][_0x32354c['peer']]){this[_0x8286('0x8')][_0x32354c[_0x8286('0x42')]][_0x8286('0x46')]=_0x32354c[_0x8286('0x40')][_0x8286('0x32')]();this[_0x8286('0x8')][_0x32354c[_0x8286('0x42')]][_0x8286('0x43')]=_0x32354c[_0x8286('0x43')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x8286('0x17')](this[_0x8286('0x8')][_0x32354c[_0x8286('0x42')]],{'showHidden':![],'depth':null}));this[_0x8286('0x1f')](util[_0x8286('0x35')](_0x8286('0x2b'),this[_0x8286('0x8')][_0x32354c[_0x8286('0x42')]]['name']),_0x8286('0x2d'),this[_0x8286('0x8')][_0x32354c[_0x8286('0x42')]]);}}}catch(_0x7bdd9){logger[_0x8286('0x15')](_0x8286('0x44'),util[_0x8286('0x17')](_0x7bdd9,{'showHidden':![],'depth':null}));}};module[_0x8286('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 6d05aa0..3285c5f 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2f0=['custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','uniqueid','inspect','interface','destuniqueid','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','emit','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0xd2f0,0x183));var _0x0d2f=function(_0x4aa480,_0x9561ce){_0x4aa480=_0x4aa480-0x0;var _0x3ba7cc=_0xd2f0[_0x4aa480];return _0x3ba7cc;};'use strict';var _=require('lodash');var moment=require(_0x0d2f('0x0'));var util=require(_0x0d2f('0x1'));var Redis=require(_0x0d2f('0x2'));var config=require(_0x0d2f('0x3'));var logger=require(_0x0d2f('0x4'))(_0x0d2f('0x5'));var ami=require(_0x0d2f('0x6'));config[_0x0d2f('0x7')]=_[_0x0d2f('0x8')](config[_0x0d2f('0x7')],{'host':_0x0d2f('0x9'),'port':0x18eb});var io=require(_0x0d2f('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x1a09e8){this[_0x0d2f('0xb')]={};this[_0x0d2f('0xc')]=_0x1a09e8[_0x0d2f('0xb')];this[_0x0d2f('0xd')]=_0x1a09e8['voiceQueues'];this['agents']=_0x1a09e8[_0x0d2f('0xe')];this[_0x0d2f('0xf')]={};ami['on'](_0x0d2f('0x10'),this[_0x0d2f('0x11')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x13'),this['syncAgentConnect'][_0x0d2f('0x12')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x14'),this[_0x0d2f('0x15')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x16'),this[_0x0d2f('0x17')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x18'),this['syncVarSet'][_0x0d2f('0x12')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('musiconholdstart',this[_0x0d2f('0x19')]['bind'](this));ami['on'](_0x0d2f('0x1a'),this[_0x0d2f('0x1b')]['bind'](this));ami['on'](_0x0d2f('0x1c'),this[_0x0d2f('0x1d')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x1e'),this[_0x0d2f('0x1f')]['bind'](this));}VoiceAgentReport[_0x0d2f('0x20')]['emit']=function(_0x57e8ff,_0x37eb6c,_0x22fede){io['to'](_0x57e8ff)['emit'](_0x37eb6c,_0x22fede);};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x21')]=function(_0x5cd5e9){return _0x5cd5e9!==null&&!_[_0x0d2f('0x22')](_0x5cd5e9);};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x11')]=function(_0x2872f7){try{if(this[_0x0d2f('0x21')](_0x2872f7)){logger[_0x0d2f('0x23')](_0x0d2f('0x24'),_0x2872f7['uniqueid'],_0x2872f7[_0x0d2f('0x25')],_0x2872f7['destuniqueid']);logger[_0x0d2f('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2872f7,{'showHidden':![],'depth':null}));if(_[_0x0d2f('0x22')](this[_0x0d2f('0xb')][_0x2872f7[_0x0d2f('0x27')]])){this['channels'][_0x2872f7[_0x0d2f('0x27')]]={};}var _0xb228d5=this[_0x0d2f('0xe')][_0x2872f7[_0x0d2f('0x29')]];var _0x2f4fb2=this['channels'][_0x2872f7['uniqueid']][_0x2872f7[_0x0d2f('0x2a')]];var _0x33c8ee=this[_0x0d2f('0xd')][_0x2872f7[_0x0d2f('0x2b')]];var _0x454d61=this[_0x0d2f('0xf')][_0x2872f7[_0x0d2f('0x27')]];if(_['isUndefined'](_0x2f4fb2)){_0x2f4fb2={'agentcalledAt':moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d')),'lastevent':_0x0d2f('0x2e'),'mandatoryDisposition':_0x33c8ee&&_0x33c8ee[_0x0d2f('0x2f')]?_0x33c8ee[_0x0d2f('0x2f')]:![],'type':_0x33c8ee&&_0x33c8ee[_0x0d2f('0x30')]?_0x33c8ee[_0x0d2f('0x30')]:_0x0d2f('0x31'),'variables':_0x454d61,'motionChannel':'voice'};}Object[_0x0d2f('0x32')](_0x2f4fb2,_[_0x0d2f('0x33')](_0x2872f7,[_0x0d2f('0x34'),_0x0d2f('0x35')]));this['channels'][_0x2872f7['uniqueid']][_0x2872f7['destuniqueid']]=_0x2f4fb2;logger['debug'](_0x0d2f('0x36'),_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2f4fb2,{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')]('custom:agentcalled',_0x2f4fb2);var _0x45c67f={'id':_0xb228d5['id'],'calleridnum':_0x2f4fb2['calleridnum'],'queue':_0x2f4fb2[_0x0d2f('0x2b')],'variables':_0x2f4fb2[_0x0d2f('0xf')],'uniqueid':_0x2872f7['uniqueid']};logger[_0x0d2f('0x26')](_0x0d2f('0x38'),_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x45c67f,{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')](_0x0d2f('0x39'),_0x2872f7[_0x0d2f('0x25')]),'user:called',_0x45c67f);}}catch(_0x36ab03){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][agentcalled]',_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x36ab03,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')]['syncAgentConnect']=function(_0x26e229){try{if(this[_0x0d2f('0x21')](_0x26e229)){if(this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]]){for(var _0x1d96e1 in this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x0d2f('0x3b')](_0x1d96e1)){if(_0x26e229[_0x0d2f('0x2a')]===_0x1d96e1){logger['info'](_0x0d2f('0x3c'),_0x26e229[_0x0d2f('0x27')],_0x26e229[_0x0d2f('0x25')],_0x26e229[_0x0d2f('0x2a')]);this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3d')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3e')]=_0x26e229['connectedlinename'];this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3f')]=_0x26e229['connectedlinenum'];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1]['destchannelstate']=_0x26e229['destchannelstate'];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x40')]=_0x26e229['destchannelstatedesc'];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x41')]=_0x26e229['holdtime'];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x42')]=_0x0d2f('0x43');_[_0x0d2f('0x44')](this[_0x0d2f('0xe')][_0x26e229[_0x0d2f('0x29')]],_[_0x0d2f('0x45')](_0x26e229,[_0x0d2f('0x2b'),_0x0d2f('0x46')]));var _0xde113d=this[_0x0d2f('0xe')][_0x26e229['interface']];var _0xe7a338={'id':_0xde113d['id'],'name':_0xde113d['name'],'agentconnected':!![],'destaccountcode':_0xde113d[_0x0d2f('0x47')],'destconnectedlinenum':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229[_0x0d2f('0x2a')]][_0x0d2f('0x48')],'queue':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229['destuniqueid']][_0x0d2f('0x2b')],'uniqueid':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229['destuniqueid']]['uniqueid']};ami['emit'](_0x0d2f('0x49'),this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x26e229[_0x0d2f('0x2a')]]);this[_0x0d2f('0x37')](util['format'](_0x0d2f('0x39'),_0x26e229[_0x0d2f('0x25')]),_0x0d2f('0x4a'),_0xe7a338);}else if(!this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4b')]&&!this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x4c'),_0x26e229[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x25')],_0x1d96e1);this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4b')]=!![];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x4d')]=moment()['format'](_0x0d2f('0x2d'));this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4e')]=_0x26e229[_0x0d2f('0x2a')];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x4f')]=_0x26e229[_0x0d2f('0x25')];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x42')]=_0x0d2f('0x50');this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x51')]=_0x0d2f('0x50');logger[_0x0d2f('0x26')](_0x0d2f('0x52'),_0x26e229[_0x0d2f('0x27')],util[_0x0d2f('0x28')](this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x53'),this['channels'][_0x26e229['uniqueid']][_0x1d96e1]);}else{logger[_0x0d2f('0x26')](_0x0d2f('0x54'),_0x26e229['uniqueid']);}}}}}}catch(_0x1fbd3e){logger[_0x0d2f('0x3a')](_0x0d2f('0x55'),_0x26e229[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x1fbd3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x56')]=function(_0x401a52){try{if(this['isNotNull'](_0x401a52)){logger['debug'](_0x0d2f('0x57'),_0x401a52[_0x0d2f('0x27')],util['inspect'](_0x401a52,{'showHidden':![],'depth':null}));if(this['channels'][_0x401a52['uniqueid']]&&this['channels'][_0x401a52[_0x0d2f('0x27')]][_0x401a52[_0x0d2f('0x2a')]]){logger[_0x0d2f('0x23')](_0x0d2f('0x58'),_0x401a52[_0x0d2f('0x27')],_0x401a52[_0x0d2f('0x25')],_0x401a52[_0x0d2f('0x2a')]);var _0x49c2bf=this['agents'][_0x401a52[_0x0d2f('0x29')]];var _0x4937c9=this[_0x0d2f('0xb')][_0x401a52[_0x0d2f('0x27')]][_0x401a52[_0x0d2f('0x2a')]];_0x4937c9['agentringnoanswer']=!![];_0x4937c9[_0x0d2f('0x4d')]=moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d'));_0x4937c9[_0x0d2f('0x42')]=_0x0d2f('0x59');_0x4937c9[_0x0d2f('0x51')]=_0x0d2f('0x59');var _0x4558ee={'id':_0x49c2bf['id'],'name':_0x49c2bf[_0x0d2f('0x5a')],'queue':_0x4937c9['queue'],'uniqueid':_0x4937c9[_0x0d2f('0x27')]};logger[_0x0d2f('0x26')](_0x0d2f('0x5b'),_0x401a52[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x4558ee,{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')]('user:%s',_0x49c2bf[_0x0d2f('0x5a')]),_0x0d2f('0x5c'),_0x4558ee);ami[_0x0d2f('0x37')](_0x0d2f('0x5d'),_0x4937c9);this[_0x0d2f('0xb')][_0x401a52['uniqueid']][_0x401a52[_0x0d2f('0x2a')]]=Object[_0x0d2f('0x32')]({},_0x4937c9);}}}catch(_0x2e1c8c){logger['error'](_0x0d2f('0x5e'),_0x401a52[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2e1c8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x15')]=function(_0x37eca0){try{if(this[_0x0d2f('0x21')](_0x37eca0)){logger['debug'](_0x0d2f('0x5f'),_0x37eca0[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x37eca0,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]]){for(var _0x56ae42 in this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x0d2f('0x3b')](_0x56ae42)&&!this[_0x0d2f('0xb')][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x4b')]&&!this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x60'),_0x37eca0['uniqueid'],this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]['membername'],_0x56ae42);this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42][_0x0d2f('0x4b')]=!![];this['channels'][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x4d')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x42')]='abandoned';this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]['reason']=_0x0d2f('0x61');logger[_0x0d2f('0x26')](_0x0d2f('0x62'),_0x37eca0[_0x0d2f('0x27')],util[_0x0d2f('0x28')](this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x63'),this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]);}}}}}catch(_0x2649e3){logger[_0x0d2f('0x3a')](_0x0d2f('0x64'),_0x37eca0['uniqueid'],util[_0x0d2f('0x28')](_0x2649e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x17')]=function(_0x47afc1){try{if(this[_0x0d2f('0x21')](_0x47afc1)){logger[_0x0d2f('0x26')](_0x0d2f('0x65'),_0x47afc1[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x47afc1,{'showHidden':![],'depth':null}));if(this['channels'][_0x47afc1['uniqueid']]){for(var _0x2604e9 in this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x0d2f('0x3b')](_0x2604e9)){if(this['channels'][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x3d')]&&!this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x66'),_0x47afc1[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x25')],_0x2604e9);this[_0x0d2f('0xb')][_0x47afc1['uniqueid']][_0x2604e9]['agentcomplete']=!![];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x67')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9]['lastevent']='complete';this[_0x0d2f('0xb')][_0x47afc1['uniqueid']][_0x2604e9][_0x0d2f('0x51')]=_0x47afc1[_0x0d2f('0x51')]==_0x0d2f('0x68')?_0x0d2f('0x69'):_0x47afc1[_0x0d2f('0x51')];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6a')]=_0x47afc1[_0x0d2f('0x6a')];if(this[_0x0d2f('0xd')][_0x47afc1[_0x0d2f('0x2b')]]&&this[_0x0d2f('0xd')][_0x47afc1['queue']]['acw']){this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6b')]=this['voiceQueues'][_0x47afc1['queue']]['acwTimeout'];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6c')]=!![];}this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]]=_[_0x0d2f('0x33')](this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]],[_0x0d2f('0x2b'),_0x0d2f('0x46')]);logger['debug'](_0x0d2f('0x6d'),_0x47afc1[_0x0d2f('0x27')],util['inspect'](this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x6e'),this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x47afc1[_0x0d2f('0x27')],util[_0x0d2f('0x28')]({'id':this[_0x0d2f('0xe')][_0x47afc1['interface']]['id'],'destaccountcode':_0x47afc1[_0x0d2f('0x6f')]},{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')]('user:%s',_0x47afc1['membername']),_0x0d2f('0x70'),{'id':this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]]['id'],'destaccountcode':Number(_0x47afc1['destaccountcode'])});}}}}}}catch(_0x2fe60e){logger['error'](_0x0d2f('0x71'),_0x47afc1['uniqueid'],util['inspect'](_0x2fe60e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x72')]=function(_0x24731e){try{if(this['isNotNull'](_0x24731e)){logger[_0x0d2f('0x26')](_0x0d2f('0x73'),_0x24731e['uniqueid'],util['inspect'](_0x24731e,{'showHidden':![],'depth':null}));this[_0x0d2f('0x74')](_0x24731e[_0x0d2f('0x27')],_[_0x0d2f('0x75')](_0x24731e[_0x0d2f('0x76')])[0x0],_0x24731e[_0x0d2f('0x77')]);if(this[_0x0d2f('0xb')][_0x24731e[_0x0d2f('0x27')]]){for(var _0xad193a in this[_0x0d2f('0xb')][_0x24731e[_0x0d2f('0x27')]]){if(this['channels'][_0x24731e[_0x0d2f('0x27')]]['hasOwnProperty'](_0xad193a)){logger[_0x0d2f('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x24731e['uniqueid'],_0xad193a,_[_0x0d2f('0x75')](_0x24731e[_0x0d2f('0x76')])[0x0],_0x24731e[_0x0d2f('0x77')]);if(_[_0x0d2f('0x22')](this['channels'][_0x24731e[_0x0d2f('0x27')]][_0xad193a]['variables'])){this[_0x0d2f('0xb')][_0x24731e['uniqueid']][_0xad193a][_0x0d2f('0xf')]={};}this[_0x0d2f('0xb')][_0x24731e['uniqueid']][_0xad193a][_0x0d2f('0xf')]=this[_0x0d2f('0xf')][_0x24731e[_0x0d2f('0x27')]];}}}}}catch(_0x3869b9){logger[_0x0d2f('0x3a')](_0x0d2f('0x78'),_0x24731e[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x3869b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x56c751,_0x422b70,_0x379a3b){var _0x471f30=[_0x0d2f('0x79'),_0x0d2f('0x7a'),'rtpaudioqosjitter',_0x0d2f('0x7b'),'rtpaudioqosloss',_0x0d2f('0x7c'),_0x0d2f('0x7d'),'rtpaudioqosrttbridged',_0x0d2f('0x7e'),_0x0d2f('0x7f'),_0x0d2f('0x80'),'bridgepvtcallid','membercalls','memberdynamic',_0x0d2f('0x81'),_0x0d2f('0x82'),_0x0d2f('0x25'),_0x0d2f('0x83'),_0x0d2f('0x84')];if(!_['isNil'](_0x422b70)&&!_[_0x0d2f('0x85')](_0x471f30,_0x422b70)){if(_[_0x0d2f('0x22')](this[_0x0d2f('0xf')][_0x56c751])){this[_0x0d2f('0xf')][_0x56c751]={};}this[_0x0d2f('0xf')][_0x56c751][_0x422b70]=_0x379a3b;}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x86')]=function(_0x54a860){try{if(this[_0x0d2f('0x21')](_0x54a860)){logger[_0x0d2f('0x26')](_0x0d2f('0x87'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x54a860,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x54a860['uniqueid']]){for(var _0x5a0e88 in this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]['hasOwnProperty'](_0x5a0e88)){if(this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88][_0x0d2f('0x51')]==_0x0d2f('0x68')&&this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88]['agentcomplete']){logger[_0x0d2f('0x23')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x54a860[_0x0d2f('0x27')],_0x5a0e88);this['channels'][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88][_0x0d2f('0x67')]=moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d'));}}}logger['debug'](_0x0d2f('0x88'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_[_0x0d2f('0x89')](this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x8a'),_[_0x0d2f('0x89')](this[_0x0d2f('0xb')][_0x54a860['uniqueid']]));this[_0x0d2f('0x8b')](_0x54a860[_0x0d2f('0x27')]);}if(this['variables'][_0x54a860[_0x0d2f('0x27')]]){delete this['variables'][_0x54a860[_0x0d2f('0x27')]];}}}catch(_0x48a254){logger[_0x0d2f('0x3a')](_0x0d2f('0x8c'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x48a254,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x1d')]=function(_0x1204cd){try{if(this['isNotNull'](_0x1204cd)){logger[_0x0d2f('0x26')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1204cd[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x1204cd,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]]){for(var _0x313763 in this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]]){if(this[_0x0d2f('0xb')][_0x1204cd['transfereeuniqueid']]['hasOwnProperty'](_0x313763)){if(_0x1204cd[_0x0d2f('0x8e')]===_0x313763){logger[_0x0d2f('0x23')](_0x0d2f('0x8f'),_0x1204cd[_0x0d2f('0x27')],this['channels'][_0x1204cd[_0x0d2f('0x8d')]][_0x313763]['membername'],_0x313763);var _0x1cee6d=moment();this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x16')]=!![];this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x67')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x42')]=_0x0d2f('0x90');this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x51')]='transfer';this['channels'][_0x1204cd['transfereeuniqueid']][_0x313763][_0x0d2f('0x6a')]=_0x1cee6d[_0x0d2f('0x91')](this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x3d')],_0x0d2f('0x92'));}}}}if(this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x93')]]){var _0x3a7006=this[_0x0d2f('0xb')][_0x1204cd['secondtransfereruniqueid']];this[_0x0d2f('0xb')][_0x1204cd['secondtransfereruniqueid']]=this['channels'][_0x1204cd[_0x0d2f('0x8d')]];this['channels'][_0x1204cd[_0x0d2f('0x8d')]]=_0x3a7006;}}}catch(_0x2291fa){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x1204cd['uniqueid'],util[_0x0d2f('0x28')](_0x2291fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x1f')]=function(_0x223a93){try{if(this[_0x0d2f('0x21')](_0x223a93)){logger['debug'](_0x0d2f('0x94'),_0x223a93[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x223a93,{'showHidden':![],'depth':null}));if(this['channels'][_0x223a93[_0x0d2f('0x8d')]]){for(var _0x471d5c in this['channels'][_0x223a93[_0x0d2f('0x8d')]]){if(this['channels'][_0x223a93[_0x0d2f('0x8d')]][_0x0d2f('0x3b')](_0x471d5c)){if(_0x223a93[_0x0d2f('0x95')]===_0x471d5c){logger[_0x0d2f('0x23')](_0x0d2f('0x96'),_0x223a93[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['membername'],_0x471d5c);var _0x343eef=moment();this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['agentcomplete']=!![];this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x67')]=_0x343eef;this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x42')]=_0x0d2f('0x90');this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x51')]=_0x0d2f('0x68');this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['talktime']=_0x343eef[_0x0d2f('0x91')](this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x3d')],_0x0d2f('0x92'));}}}}}}catch(_0x1033e0){logger['error'](_0x0d2f('0x97'),_0x223a93[_0x0d2f('0x27')],util['inspect'](_0x1033e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x19')]=function(_0x520931){var _0x7b8574='';try{if(this[_0x0d2f('0x21')](_0x520931)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x520931['uniqueid'],util['inspect'](_0x520931,{'showHidden':![],'depth':null}));if(_0x520931[_0x0d2f('0x98')]){_0x7b8574=_0x520931[_0x0d2f('0x98')]['substring'](0x0,_0x520931[_0x0d2f('0x98')][_0x0d2f('0x99')]('-'));if(this[_0x0d2f('0xe')][_0x7b8574]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x520931['uniqueid'],_0x7b8574);this['agents'][_0x7b8574][_0x0d2f('0x9a')]=!![];}}}}catch(_0x146c67){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][musiconholdstart]',_0x520931['uniqueid'],util[_0x0d2f('0x28')](_0x146c67,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x1b')]=function(_0x38d0a7){var _0xa87e70='';try{if(this[_0x0d2f('0x21')](_0x38d0a7)){logger['debug'](_0x0d2f('0x9b'),_0x38d0a7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x38d0a7,{'showHidden':![],'depth':null}));if(_0x38d0a7[_0x0d2f('0x98')]){_0xa87e70=_0x38d0a7['channel'][_0x0d2f('0x9c')](0x0,_0x38d0a7[_0x0d2f('0x98')][_0x0d2f('0x99')]('-'));if(this[_0x0d2f('0xe')][_0xa87e70]){logger['info'](_0x0d2f('0x9d'),_0x38d0a7['uniqueid'],_0xa87e70);this[_0x0d2f('0xe')][_0xa87e70][_0x0d2f('0x9a')]=![];}}}}catch(_0x58b3c2){logger[_0x0d2f('0x3a')](_0x0d2f('0x9e'),_0x38d0a7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x58b3c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x8b')]=function(_0x5a3bda,_0x220693=0x2710){if(this[_0x0d2f('0xb')][_0x5a3bda]){setTimeout(()=>{delete this[_0x0d2f('0xb')][_0x5a3bda];},_0x220693);}};module[_0x0d2f('0x9f')]=VoiceAgentReport; \ No newline at end of file +var _0xdc16=['channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','voice','assign','privilege','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','hasOwnProperty','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:'];(function(_0xd8419,_0x5c0aea){var _0x50dc7a=function(_0x2dd303){while(--_0x2dd303){_0xd8419['push'](_0xd8419['shift']());}};_0x50dc7a(++_0x5c0aea);}(_0xdc16,0x155));var _0x6dc1=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0xdc16[_0xd67723];return _0x53b62b;};'use strict';var _=require(_0x6dc1('0x0'));var moment=require(_0x6dc1('0x1'));var util=require(_0x6dc1('0x2'));var Redis=require(_0x6dc1('0x3'));var config=require(_0x6dc1('0x4'));var logger=require(_0x6dc1('0x5'))(_0x6dc1('0x6'));var ami=require(_0x6dc1('0x7'));config[_0x6dc1('0x8')]=_[_0x6dc1('0x9')](config['redis'],{'host':_0x6dc1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6dc1('0x8')]));function VoiceAgentReport(_0x65a5b5){this[_0x6dc1('0xb')]={};this['voiceChannels']=_0x65a5b5[_0x6dc1('0xb')];this[_0x6dc1('0xc')]=_0x65a5b5['voiceQueues'];this[_0x6dc1('0xd')]=_0x65a5b5['agents'];this[_0x6dc1('0xe')]={};ami['on'](_0x6dc1('0xf'),this[_0x6dc1('0x10')][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x12'),this[_0x6dc1('0x13')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x6dc1('0x11')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x14'),this[_0x6dc1('0x15')][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x16'),this[_0x6dc1('0x17')][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x18'),this[_0x6dc1('0x19')][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x1a'),this['syncMusicOnHoldStart'][_0x6dc1('0x11')](this));ami['on']('musiconholdstop',this[_0x6dc1('0x1b')][_0x6dc1('0x11')](this));ami['on'](_0x6dc1('0x1c'),this[_0x6dc1('0x1d')]['bind'](this));ami['on'](_0x6dc1('0x1e'),this[_0x6dc1('0x1f')]['bind'](this));}VoiceAgentReport['prototype'][_0x6dc1('0x20')]=function(_0x108831,_0xa6af9e,_0x22e838){io['to'](_0x108831)['emit'](_0xa6af9e,_0x22e838);};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x22')]=function(_0x447547){return _0x447547!==null&&!_[_0x6dc1('0x23')](_0x447547);};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x10')]=function(_0x45becd){try{if(this[_0x6dc1('0x22')](_0x45becd)){logger[_0x6dc1('0x24')](_0x6dc1('0x25'),_0x45becd['uniqueid'],_0x45becd[_0x6dc1('0x26')],_0x45becd[_0x6dc1('0x27')]);logger[_0x6dc1('0x28')](_0x6dc1('0x29'),_0x45becd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x45becd,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6dc1('0xb')][_0x45becd[_0x6dc1('0x2a')]])){this['channels'][_0x45becd[_0x6dc1('0x2a')]]={};}var _0x5760d0=this['agents'][_0x45becd[_0x6dc1('0x2c')]];var _0x116261=this[_0x6dc1('0xb')][_0x45becd['uniqueid']][_0x45becd[_0x6dc1('0x27')]];var _0x4bd7e4=this[_0x6dc1('0xc')][_0x45becd[_0x6dc1('0x2d')]];var _0x4fa409=this['variables'][_0x45becd[_0x6dc1('0x2a')]];if(_[_0x6dc1('0x23')](_0x116261)){_0x116261={'agentcalledAt':moment()['format'](_0x6dc1('0x2e')),'lastevent':'called','mandatoryDisposition':_0x4bd7e4&&_0x4bd7e4[_0x6dc1('0x2f')]?_0x4bd7e4[_0x6dc1('0x2f')]:![],'type':_0x4bd7e4&&_0x4bd7e4[_0x6dc1('0x30')]?_0x4bd7e4[_0x6dc1('0x30')]:'inbound','variables':_0x4fa409,'motionChannel':_0x6dc1('0x31')};}Object[_0x6dc1('0x32')](_0x116261,_['omit'](_0x45becd,['event',_0x6dc1('0x33')]));this['channels'][_0x45becd['uniqueid']][_0x45becd['destuniqueid']]=_0x116261;logger[_0x6dc1('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x45becd['uniqueid'],util[_0x6dc1('0x2b')](_0x116261,{'showHidden':![],'depth':null}));ami[_0x6dc1('0x20')](_0x6dc1('0x34'),_0x116261);var _0x27522e={'id':_0x5760d0['id'],'calleridnum':_0x116261[_0x6dc1('0x35')],'queue':_0x116261[_0x6dc1('0x2d')],'variables':_0x116261[_0x6dc1('0xe')],'uniqueid':_0x45becd['uniqueid']};logger[_0x6dc1('0x28')](_0x6dc1('0x36'),_0x45becd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x27522e,{'showHidden':![],'depth':null}));this[_0x6dc1('0x20')](util[_0x6dc1('0x37')](_0x6dc1('0x38'),_0x45becd[_0x6dc1('0x26')]),'user:called',_0x27522e);}}catch(_0xc808ab){logger[_0x6dc1('0x39')](_0x6dc1('0x3a'),_0x45becd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0xc808ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x13')]=function(_0x5447de){try{if(this[_0x6dc1('0x22')](_0x5447de)){if(this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]]){for(var _0x501ece in this[_0x6dc1('0xb')][_0x5447de['uniqueid']]){if(this['channels'][_0x5447de[_0x6dc1('0x2a')]]['hasOwnProperty'](_0x501ece)){if(_0x5447de['destuniqueid']===_0x501ece){logger['info'](_0x6dc1('0x3b'),_0x5447de[_0x6dc1('0x2a')],_0x5447de['membername'],_0x5447de[_0x6dc1('0x27')]);this['channels'][_0x5447de['uniqueid']][_0x501ece][_0x6dc1('0x3c')]=moment()[_0x6dc1('0x37')](_0x6dc1('0x2e'));this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece]['connectedlinename']=_0x5447de[_0x6dc1('0x3d')];this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece]['connectedlinenum']=_0x5447de[_0x6dc1('0x3e')];this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x3f')]=_0x5447de[_0x6dc1('0x3f')];this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x40')]=_0x5447de[_0x6dc1('0x40')];this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x41')]=_0x5447de['holdtime'];this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x42')]=_0x6dc1('0x43');_[_0x6dc1('0x44')](this[_0x6dc1('0xd')][_0x5447de[_0x6dc1('0x2c')]],_[_0x6dc1('0x45')](_0x5447de,[_0x6dc1('0x2d'),_0x6dc1('0x46')]));var _0x5a7487=this[_0x6dc1('0xd')][_0x5447de[_0x6dc1('0x2c')]];var _0x16c835={'id':_0x5a7487['id'],'name':_0x5a7487[_0x6dc1('0x47')],'agentconnected':!![],'destaccountcode':_0x5a7487[_0x6dc1('0x48')],'destconnectedlinenum':this[_0x6dc1('0xb')][_0x5447de['uniqueid']][_0x5447de[_0x6dc1('0x27')]]['exten'],'queue':this[_0x6dc1('0xb')][_0x5447de['uniqueid']][_0x5447de[_0x6dc1('0x27')]][_0x6dc1('0x2d')],'uniqueid':this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x5447de[_0x6dc1('0x27')]][_0x6dc1('0x2a')]};ami['emit'](_0x6dc1('0x49'),this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x5447de[_0x6dc1('0x27')]]);this[_0x6dc1('0x20')](util[_0x6dc1('0x37')](_0x6dc1('0x38'),_0x5447de[_0x6dc1('0x26')]),_0x6dc1('0x4a'),_0x16c835);}else if(!this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x4b')]&&!this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece]['agentcomplete']){logger[_0x6dc1('0x24')](_0x6dc1('0x4c'),_0x5447de[_0x6dc1('0x2a')],this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x26')],_0x501ece);this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x4b')]=!![];this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x4d')]=moment()['format'](_0x6dc1('0x2e'));this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x4e')]=_0x5447de['destuniqueid'];this[_0x6dc1('0xb')][_0x5447de['uniqueid']][_0x501ece][_0x6dc1('0x4f')]=_0x5447de[_0x6dc1('0x26')];this[_0x6dc1('0xb')][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x42')]=_0x6dc1('0x50');this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece][_0x6dc1('0x51')]=_0x6dc1('0x50');logger[_0x6dc1('0x28')](_0x6dc1('0x52'),_0x5447de[_0x6dc1('0x2a')],util['inspect'](this[_0x6dc1('0xb')][_0x5447de['uniqueid']][_0x501ece],{'showHidden':![],'depth':null}));ami['emit'](_0x6dc1('0x53'),this['channels'][_0x5447de[_0x6dc1('0x2a')]][_0x501ece]);}else{logger['debug']('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x5447de[_0x6dc1('0x2a')]);}}}}}}catch(_0x23c9c5){logger['error'](_0x6dc1('0x54'),_0x5447de[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x23c9c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x55')]=function(_0x33fd6c){try{if(this[_0x6dc1('0x22')](_0x33fd6c)){logger[_0x6dc1('0x28')](_0x6dc1('0x56'),_0x33fd6c[_0x6dc1('0x2a')],util['inspect'](_0x33fd6c,{'showHidden':![],'depth':null}));if(this[_0x6dc1('0xb')][_0x33fd6c['uniqueid']]&&this[_0x6dc1('0xb')][_0x33fd6c[_0x6dc1('0x2a')]][_0x33fd6c[_0x6dc1('0x27')]]){logger[_0x6dc1('0x24')](_0x6dc1('0x57'),_0x33fd6c[_0x6dc1('0x2a')],_0x33fd6c[_0x6dc1('0x26')],_0x33fd6c[_0x6dc1('0x27')]);var _0x403cd8=this[_0x6dc1('0xd')][_0x33fd6c[_0x6dc1('0x2c')]];var _0x1487c6=this[_0x6dc1('0xb')][_0x33fd6c['uniqueid']][_0x33fd6c[_0x6dc1('0x27')]];_0x1487c6['agentringnoanswer']=!![];_0x1487c6[_0x6dc1('0x4d')]=moment()[_0x6dc1('0x37')]('YYYY-MM-DD\x20HH:mm:ss');_0x1487c6[_0x6dc1('0x42')]=_0x6dc1('0x58');_0x1487c6[_0x6dc1('0x51')]='rejected';var _0x77f709={'id':_0x403cd8['id'],'name':_0x403cd8[_0x6dc1('0x47')],'queue':_0x1487c6[_0x6dc1('0x2d')],'uniqueid':_0x1487c6[_0x6dc1('0x2a')]};logger['debug'](_0x6dc1('0x59'),_0x33fd6c[_0x6dc1('0x2a')],util['inspect'](_0x77f709,{'showHidden':![],'depth':null}));this[_0x6dc1('0x20')](util['format']('user:%s',_0x403cd8[_0x6dc1('0x47')]),_0x6dc1('0x5a'),_0x77f709);ami[_0x6dc1('0x20')](_0x6dc1('0x5b'),_0x1487c6);this[_0x6dc1('0xb')][_0x33fd6c[_0x6dc1('0x2a')]][_0x33fd6c['destuniqueid']]=Object[_0x6dc1('0x32')]({},_0x1487c6);}}}catch(_0x4f07b6){logger[_0x6dc1('0x39')](_0x6dc1('0x5c'),_0x33fd6c['uniqueid'],util[_0x6dc1('0x2b')](_0x4f07b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x5d')]=function(_0x444fdd){try{if(this[_0x6dc1('0x22')](_0x444fdd)){logger['debug'](_0x6dc1('0x5e'),_0x444fdd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x444fdd,{'showHidden':![],'depth':null}));if(this['channels'][_0x444fdd[_0x6dc1('0x2a')]]){for(var _0x231355 in this[_0x6dc1('0xb')][_0x444fdd['uniqueid']]){if(this['channels'][_0x444fdd[_0x6dc1('0x2a')]]['hasOwnProperty'](_0x231355)&&!this['channels'][_0x444fdd[_0x6dc1('0x2a')]][_0x231355]['agentringnoanswer']&&!this[_0x6dc1('0xb')][_0x444fdd[_0x6dc1('0x2a')]][_0x231355][_0x6dc1('0x14')]){logger[_0x6dc1('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x444fdd[_0x6dc1('0x2a')],this['channels'][_0x444fdd['uniqueid']][_0x231355][_0x6dc1('0x26')],_0x231355);this['channels'][_0x444fdd[_0x6dc1('0x2a')]][_0x231355][_0x6dc1('0x4b')]=!![];this[_0x6dc1('0xb')][_0x444fdd['uniqueid']][_0x231355][_0x6dc1('0x4d')]=moment()[_0x6dc1('0x37')](_0x6dc1('0x2e'));this[_0x6dc1('0xb')][_0x444fdd['uniqueid']][_0x231355][_0x6dc1('0x42')]='abandoned';this[_0x6dc1('0xb')][_0x444fdd[_0x6dc1('0x2a')]][_0x231355][_0x6dc1('0x51')]=_0x6dc1('0x5f');logger[_0x6dc1('0x28')](_0x6dc1('0x60'),_0x444fdd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](this[_0x6dc1('0xb')][_0x444fdd[_0x6dc1('0x2a')]][_0x231355],{'showHidden':![],'depth':null}));ami[_0x6dc1('0x20')](_0x6dc1('0x61'),this[_0x6dc1('0xb')][_0x444fdd[_0x6dc1('0x2a')]][_0x231355]);}}}}}catch(_0x1a93af){logger[_0x6dc1('0x39')](_0x6dc1('0x62'),_0x444fdd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x1a93af,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x15')]=function(_0x28366c){try{if(this[_0x6dc1('0x22')](_0x28366c)){logger['debug'](_0x6dc1('0x63'),_0x28366c['uniqueid'],util[_0x6dc1('0x2b')](_0x28366c,{'showHidden':![],'depth':null}));if(this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]]){for(var _0x17e396 in this[_0x6dc1('0xb')][_0x28366c['uniqueid']]){if(this['channels'][_0x28366c[_0x6dc1('0x2a')]]['hasOwnProperty'](_0x17e396)){if(this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396][_0x6dc1('0x3c')]&&!this['channels'][_0x28366c[_0x6dc1('0x2a')]][_0x17e396][_0x6dc1('0x14')]){logger[_0x6dc1('0x24')](_0x6dc1('0x64'),_0x28366c['uniqueid'],this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396]['membername'],_0x17e396);this[_0x6dc1('0xb')][_0x28366c['uniqueid']][_0x17e396][_0x6dc1('0x14')]=!![];this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396][_0x6dc1('0x65')]=moment()[_0x6dc1('0x37')](_0x6dc1('0x2e'));this['channels'][_0x28366c[_0x6dc1('0x2a')]][_0x17e396][_0x6dc1('0x42')]=_0x6dc1('0x66');this['channels'][_0x28366c[_0x6dc1('0x2a')]][_0x17e396]['reason']=_0x28366c[_0x6dc1('0x51')]==_0x6dc1('0x67')?'agent':_0x28366c['reason'];this[_0x6dc1('0xb')][_0x28366c['uniqueid']][_0x17e396][_0x6dc1('0x68')]=_0x28366c[_0x6dc1('0x68')];if(this[_0x6dc1('0xc')][_0x28366c[_0x6dc1('0x2d')]]&&this['voiceQueues'][_0x28366c[_0x6dc1('0x2d')]][_0x6dc1('0x69')]){this['channels'][_0x28366c['uniqueid']][_0x17e396][_0x6dc1('0x6a')]=this['voiceQueues'][_0x28366c[_0x6dc1('0x2d')]][_0x6dc1('0x6b')];this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396][_0x6dc1('0x6c')]=!![];}this['agents'][_0x28366c[_0x6dc1('0x2c')]]=_[_0x6dc1('0x6d')](this['agents'][_0x28366c[_0x6dc1('0x2c')]],[_0x6dc1('0x2d'),_0x6dc1('0x46')]);logger[_0x6dc1('0x28')](_0x6dc1('0x6e'),_0x28366c['uniqueid'],util[_0x6dc1('0x2b')](this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396],{'showHidden':![],'depth':null}));ami[_0x6dc1('0x20')](_0x6dc1('0x6f'),this[_0x6dc1('0xb')][_0x28366c[_0x6dc1('0x2a')]][_0x17e396]);logger[_0x6dc1('0x28')](_0x6dc1('0x70'),_0x28366c[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')]({'id':this['agents'][_0x28366c[_0x6dc1('0x2c')]]['id'],'destaccountcode':_0x28366c[_0x6dc1('0x71')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x6dc1('0x37')](_0x6dc1('0x38'),_0x28366c[_0x6dc1('0x26')]),_0x6dc1('0x72'),{'id':this['agents'][_0x28366c[_0x6dc1('0x2c')]]['id'],'destaccountcode':Number(_0x28366c['destaccountcode'])});}}}}}}catch(_0x1b8851){logger[_0x6dc1('0x39')](_0x6dc1('0x73'),_0x28366c[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x1b8851,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x17')]=function(_0x1c7e69){try{if(this[_0x6dc1('0x22')](_0x1c7e69)){logger[_0x6dc1('0x28')](_0x6dc1('0x74'),_0x1c7e69['uniqueid'],util['inspect'](_0x1c7e69,{'showHidden':![],'depth':null}));this['addVariable'](_0x1c7e69[_0x6dc1('0x2a')],_[_0x6dc1('0x75')](_0x1c7e69['variable'])[0x0],_0x1c7e69['value']);if(this[_0x6dc1('0xb')][_0x1c7e69['uniqueid']]){for(var _0x460887 in this[_0x6dc1('0xb')][_0x1c7e69['uniqueid']]){if(this[_0x6dc1('0xb')][_0x1c7e69[_0x6dc1('0x2a')]][_0x6dc1('0x76')](_0x460887)){logger[_0x6dc1('0x24')](_0x6dc1('0x77'),_0x1c7e69[_0x6dc1('0x2a')],_0x460887,_[_0x6dc1('0x75')](_0x1c7e69['variable'])[0x0],_0x1c7e69[_0x6dc1('0x78')]);if(_[_0x6dc1('0x23')](this['channels'][_0x1c7e69['uniqueid']][_0x460887]['variables'])){this['channels'][_0x1c7e69[_0x6dc1('0x2a')]][_0x460887][_0x6dc1('0xe')]={};}this[_0x6dc1('0xb')][_0x1c7e69['uniqueid']][_0x460887]['variables']=this[_0x6dc1('0xe')][_0x1c7e69[_0x6dc1('0x2a')]];}}}}}catch(_0x522fcd){logger[_0x6dc1('0x39')](_0x6dc1('0x79'),_0x1c7e69[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x522fcd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x7a')]=function(_0x41abf5,_0x25b83c,_0x46b63c){var _0x2e055d=['rtpaudioqos',_0x6dc1('0x7b'),_0x6dc1('0x7c'),_0x6dc1('0x7d'),_0x6dc1('0x7e'),_0x6dc1('0x7f'),_0x6dc1('0x80'),_0x6dc1('0x81'),_0x6dc1('0x82'),_0x6dc1('0x83'),'bridgepeer','bridgepvtcallid',_0x6dc1('0x84'),'memberdynamic',_0x6dc1('0x85'),_0x6dc1('0x86'),'membername',_0x6dc1('0x87'),_0x6dc1('0x88')];if(!_['isNil'](_0x25b83c)&&!_[_0x6dc1('0x89')](_0x2e055d,_0x25b83c)){if(_[_0x6dc1('0x23')](this[_0x6dc1('0xe')][_0x41abf5])){this[_0x6dc1('0xe')][_0x41abf5]={};}this[_0x6dc1('0xe')][_0x41abf5][_0x25b83c]=_0x46b63c;}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x19')]=function(_0x4516cd){try{if(this[_0x6dc1('0x22')](_0x4516cd)){logger[_0x6dc1('0x28')](_0x6dc1('0x8a'),_0x4516cd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x4516cd,{'showHidden':![],'depth':null}));if(this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]]){for(var _0x3bbca6 in this['channels'][_0x4516cd['uniqueid']]){if(this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]][_0x6dc1('0x76')](_0x3bbca6)){if(this['channels'][_0x4516cd[_0x6dc1('0x2a')]][_0x3bbca6][_0x6dc1('0x51')]==_0x6dc1('0x67')&&this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]][_0x3bbca6][_0x6dc1('0x14')]){logger[_0x6dc1('0x24')](_0x6dc1('0x8b'),_0x4516cd[_0x6dc1('0x2a')],_0x3bbca6);this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]][_0x3bbca6][_0x6dc1('0x65')]=moment()[_0x6dc1('0x37')](_0x6dc1('0x2e'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x4516cd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_[_0x6dc1('0x8c')](this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]]),{'showHidden':![],'depth':null}));ami[_0x6dc1('0x20')](_0x6dc1('0x8d'),_[_0x6dc1('0x8c')](this[_0x6dc1('0xb')][_0x4516cd[_0x6dc1('0x2a')]]));this['deleteChannelAfterTimeout'](_0x4516cd['uniqueid']);}if(this['variables'][_0x4516cd['uniqueid']]){delete this[_0x6dc1('0xe')][_0x4516cd[_0x6dc1('0x2a')]];}}}catch(_0x1f743d){logger['error'](_0x6dc1('0x8e'),_0x4516cd['uniqueid'],util[_0x6dc1('0x2b')](_0x1f743d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')]['syncAttendedTransfer']=function(_0x158f73){try{if(this['isNotNull'](_0x158f73)){logger[_0x6dc1('0x28')](_0x6dc1('0x8f'),_0x158f73[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x158f73,{'showHidden':![],'depth':null}));if(this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]]){for(var _0x1c39b9 in this['channels'][_0x158f73[_0x6dc1('0x90')]]){if(this[_0x6dc1('0xb')][_0x158f73['transfereeuniqueid']][_0x6dc1('0x76')](_0x1c39b9)){if(_0x158f73[_0x6dc1('0x91')]===_0x1c39b9){logger[_0x6dc1('0x24')](_0x6dc1('0x92'),_0x158f73[_0x6dc1('0x2a')],this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]][_0x1c39b9][_0x6dc1('0x26')],_0x1c39b9);var _0x191c21=moment();this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]][_0x1c39b9][_0x6dc1('0x14')]=!![];this[_0x6dc1('0xb')][_0x158f73['transfereeuniqueid']][_0x1c39b9][_0x6dc1('0x65')]=moment()[_0x6dc1('0x37')](_0x6dc1('0x2e'));this[_0x6dc1('0xb')][_0x158f73['transfereeuniqueid']][_0x1c39b9][_0x6dc1('0x42')]='complete';this['channels'][_0x158f73['transfereeuniqueid']][_0x1c39b9][_0x6dc1('0x51')]=_0x6dc1('0x67');this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]][_0x1c39b9][_0x6dc1('0x68')]=_0x191c21[_0x6dc1('0x93')](this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]][_0x1c39b9][_0x6dc1('0x3c')],_0x6dc1('0x94'));}}}}if(this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x95')]]){var _0x351479=this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x95')]];this['channels'][_0x158f73[_0x6dc1('0x95')]]=this[_0x6dc1('0xb')][_0x158f73[_0x6dc1('0x90')]];this['channels'][_0x158f73[_0x6dc1('0x90')]]=_0x351479;}}}catch(_0x3aa688){logger[_0x6dc1('0x39')](_0x6dc1('0x96'),_0x158f73[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x3aa688,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')]['syncBlindTransfer']=function(_0x1aed12){try{if(this['isNotNull'](_0x1aed12)){logger[_0x6dc1('0x28')](_0x6dc1('0x97'),_0x1aed12[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x1aed12,{'showHidden':![],'depth':null}));if(this[_0x6dc1('0xb')][_0x1aed12[_0x6dc1('0x90')]]){for(var _0x2f4c39 in this[_0x6dc1('0xb')][_0x1aed12['transfereeuniqueid']]){if(this[_0x6dc1('0xb')][_0x1aed12['transfereeuniqueid']]['hasOwnProperty'](_0x2f4c39)){if(_0x1aed12[_0x6dc1('0x98')]===_0x2f4c39){logger[_0x6dc1('0x24')](_0x6dc1('0x99'),_0x1aed12[_0x6dc1('0x2a')],this[_0x6dc1('0xb')][_0x1aed12[_0x6dc1('0x90')]][_0x2f4c39][_0x6dc1('0x26')],_0x2f4c39);var _0x5449d9=moment();this[_0x6dc1('0xb')][_0x1aed12[_0x6dc1('0x90')]][_0x2f4c39]['agentcomplete']=!![];this[_0x6dc1('0xb')][_0x1aed12['transfereeuniqueid']][_0x2f4c39][_0x6dc1('0x65')]=_0x5449d9;this['channels'][_0x1aed12['transfereeuniqueid']][_0x2f4c39]['lastevent']=_0x6dc1('0x66');this['channels'][_0x1aed12[_0x6dc1('0x90')]][_0x2f4c39][_0x6dc1('0x51')]='transfer';this[_0x6dc1('0xb')][_0x1aed12[_0x6dc1('0x90')]][_0x2f4c39]['talktime']=_0x5449d9['diff'](this[_0x6dc1('0xb')][_0x1aed12[_0x6dc1('0x90')]][_0x2f4c39][_0x6dc1('0x3c')],_0x6dc1('0x94'));}}}}}}catch(_0x57eb08){logger[_0x6dc1('0x39')](_0x6dc1('0x9a'),_0x1aed12[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x57eb08,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x9b')]=function(_0x24adcd){var _0xfdcda0='';try{if(this[_0x6dc1('0x22')](_0x24adcd)){logger[_0x6dc1('0x28')](_0x6dc1('0x9c'),_0x24adcd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x24adcd,{'showHidden':![],'depth':null}));if(_0x24adcd[_0x6dc1('0x9d')]){_0xfdcda0=_0x24adcd[_0x6dc1('0x9d')][_0x6dc1('0x9e')](0x0,_0x24adcd[_0x6dc1('0x9d')][_0x6dc1('0x9f')]('-'));if(this[_0x6dc1('0xd')][_0xfdcda0]){logger[_0x6dc1('0x24')](_0x6dc1('0xa0'),_0x24adcd['uniqueid'],_0xfdcda0);this[_0x6dc1('0xd')][_0xfdcda0][_0x6dc1('0xa1')]=!![];}}}}catch(_0xeb6918){logger['error'](_0x6dc1('0xa2'),_0x24adcd[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0xeb6918,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6dc1('0x21')][_0x6dc1('0x1b')]=function(_0x2ac046){var _0x552f20='';try{if(this[_0x6dc1('0x22')](_0x2ac046)){logger[_0x6dc1('0x28')](_0x6dc1('0xa3'),_0x2ac046[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0x2ac046,{'showHidden':![],'depth':null}));if(_0x2ac046['channel']){_0x552f20=_0x2ac046[_0x6dc1('0x9d')]['substring'](0x0,_0x2ac046[_0x6dc1('0x9d')][_0x6dc1('0x9f')]('-'));if(this['agents'][_0x552f20]){logger[_0x6dc1('0x24')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x2ac046[_0x6dc1('0x2a')],_0x552f20);this['agents'][_0x552f20][_0x6dc1('0xa1')]=![];}}}}catch(_0xe31c9a){logger[_0x6dc1('0x39')](_0x6dc1('0xa4'),_0x2ac046[_0x6dc1('0x2a')],util[_0x6dc1('0x2b')](_0xe31c9a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['deleteChannelAfterTimeout']=function(_0x5501e9,_0x37528e=0x2710){if(this[_0x6dc1('0xb')][_0x5501e9]){setTimeout(()=>{delete this[_0x6dc1('0xb')][_0x5501e9];},_0x37528e);}};module[_0x6dc1('0xa5')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 939ba1b..0a8e72f 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda40=['queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','toNumber','destinationchannel','UserId','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','xmd-phone','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','omit','user:agentcomplete','resolve','then','transferType','undefined','transferToInternal','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','merge','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata'];(function(_0x440e2e,_0x1e7080){var _0x15e54a=function(_0x31ed15){while(--_0x31ed15){_0x440e2e['push'](_0x440e2e['shift']());}};_0x15e54a(++_0x1e7080);}(_0xda40,0x134));var _0x0da4=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0xda40[_0x5fe7ce];return _0x3b5793;};'use strict';var _=require('lodash');var moment=require(_0x0da4('0x0'));var util=require(_0x0da4('0x1'));var path=require(_0x0da4('0x2'));var Redis=require('ioredis');var config=require(_0x0da4('0x3'));var logger=require(_0x0da4('0x4'))(_0x0da4('0x5'));var ami=require(_0x0da4('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x0da4('0x7'));var applications=[_0x0da4('0x8'),'queue',_0x0da4('0x9'),_0x0da4('0xa'),_0x0da4('0xb'),_0x0da4('0xc')];var dispositions=[_0x0da4('0xd'),_0x0da4('0xe'),_0x0da4('0xe'),_0x0da4('0xd'),_0x0da4('0xd'),_0x0da4('0xd'),_0x0da4('0xf'),_0x0da4('0x10'),'FAILED',_0x0da4('0xe'),_0x0da4('0xe')];config[_0x0da4('0x11')]=_[_0x0da4('0x12')](config['redis'],{'host':_0x0da4('0x13'),'port':0x18eb});var io=require(_0x0da4('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0x4a7716){this[_0x0da4('0x15')]=_0x4a7716[_0x0da4('0x15')];this[_0x0da4('0x16')]=_0x4a7716[_0x0da4('0x16')];this[_0x0da4('0x17')]={};ami['on'](_0x0da4('0x18'),this[_0x0da4('0x19')][_0x0da4('0x1a')](this));ami['on']('newexten',this[_0x0da4('0x19')][_0x0da4('0x1a')](this));ami['on']('newchannel',this[_0x0da4('0x1b')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x1c'),this[_0x0da4('0x1d')][_0x0da4('0x1a')](this));ami['on']('varset',this[_0x0da4('0x1e')]['bind'](this));ami['on'](_0x0da4('0x1f'),this['syncHangup']['bind'](this));ami['on'](_0x0da4('0x20'),this[_0x0da4('0x21')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x22'),this[_0x0da4('0x23')][_0x0da4('0x1a')](this));ami['on']('blindtransfer',this[_0x0da4('0x24')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x25'),this[_0x0da4('0x26')]['bind'](this));ami['on'](_0x0da4('0x27'),this['syncMusicOnHoldStop'][_0x0da4('0x1a')](this));try{logger[_0x0da4('0x28')](_0x0da4('0x29'));ami['actionCoreShowChannels']();}catch(_0x26e980){logger[_0x0da4('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0x0da4('0x2b')](_0x26e980,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x2d')]=function(_0x1ba5a6){return _0x1ba5a6!==null&&!_[_0x0da4('0x2e')](_0x1ba5a6);};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x2f')]=function(_0x29cbad,_0x4ead66,_0x1c590e){io['to'](_0x29cbad)[_0x0da4('0x2f')](_0x4ead66,_0x1c590e);};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x21')]=function(_0x5a9b34){try{if(this['isNotNull'](_0x5a9b34)){logger[_0x0da4('0x28')](_0x0da4('0x30'),_0x5a9b34[_0x0da4('0x31')],_0x5a9b34[_0x0da4('0x32')],_0x5a9b34['calleridnum']);logger[_0x0da4('0x33')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5a9b34['uniqueid'],util[_0x0da4('0x2b')](_0x5a9b34,{'showHidden':![],'depth':null}));if(_0x5a9b34[_0x0da4('0x31')]===_0x5a9b34[_0x0da4('0x34')]){if(!_[_0x0da4('0x2e')](this['channels'][_0x5a9b34[_0x0da4('0x31')]])){_[_0x0da4('0x35')](this[_0x0da4('0x15')][_0x5a9b34[_0x0da4('0x31')]],_['pick'](_0x5a9b34,_[_0x0da4('0x36')](this[_0x0da4('0x15')][_0x5a9b34[_0x0da4('0x31')]])));}}if(_0x5a9b34[_0x0da4('0x37')]==='from-sip'){var _0x5c878d=this[_0x0da4('0x16')][_0x5a9b34[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x5c878d){if(_0x5a9b34[_0x0da4('0x3a')]==_0x0da4('0x3b')){_0x5c878d[_0x0da4('0x3c')]=_0x5a9b34[_0x0da4('0x3d')];this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),_0x5c878d[_0x0da4('0x40')]),_0x0da4('0x41'),{'id':_0x5c878d['id'],'destaccountcode':_0x5c878d[_0x0da4('0x42')],'destconnectedlinenum':_0x5a9b34[_0x0da4('0x3d')]});}}}}}catch(_0x161774){logger[_0x0da4('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x5a9b34['uniqueid'],util[_0x0da4('0x2b')](_0x161774,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x1b')]=function(_0x25afa8){try{if(this['isNotNull'](_0x25afa8)){logger['debug'](_0x0da4('0x43'),_0x25afa8[_0x0da4('0x31')],util['inspect'](_0x25afa8,{'showHidden':![],'depth':null}));if(this['channels'][_0x25afa8[_0x0da4('0x31')]]){return;}if(_0x25afa8[_0x0da4('0x38')]==='OutgoingSpoolFailed'){return;}if(_0x25afa8['uniqueid']!==_0x25afa8[_0x0da4('0x34')]&&!this[_0x0da4('0x17')][_0x25afa8[_0x0da4('0x34')]]){return;}logger['info'](_0x0da4('0x44'),_0x25afa8['uniqueid'],_0x25afa8[_0x0da4('0x37')],_0x25afa8[_0x0da4('0x3a')]);this[_0x0da4('0x15')][_0x25afa8[_0x0da4('0x31')]]=new Channel();this[_0x0da4('0x15')][_0x25afa8['uniqueid']][_0x0da4('0x45')]=moment()[_0x0da4('0x3e')](_0x0da4('0x46'));this['channels'][_0x25afa8[_0x0da4('0x31')]][_0x0da4('0x47')]=dispositions[_['toNumber'](_0x25afa8[_0x0da4('0x48')])];_[_0x0da4('0x35')](this[_0x0da4('0x15')][_0x25afa8['uniqueid']],_[_0x0da4('0x49')](_0x25afa8,_[_0x0da4('0x36')](this[_0x0da4('0x15')][_0x25afa8[_0x0da4('0x31')]])));if(_0x25afa8['context']==='from-sip'){var _0x1f95bb=this[_0x0da4('0x16')][_0x25afa8[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x1f95bb&&typeof _0x1f95bb[_0x0da4('0x3c')]==='undefined'){_0x1f95bb['destconnectedlinenum']=_0x25afa8[_0x0da4('0x3a')];logger[_0x0da4('0x33')](_0x0da4('0x4a'),_0x25afa8[_0x0da4('0x31')],util['inspect']({'id':_0x1f95bb['id'],'destaccountcode':_0x1f95bb[_0x0da4('0x42')],'destconnectedlinenum':_0x25afa8[_0x0da4('0x3a')]},{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util['format'](_0x0da4('0x3f'),_0x1f95bb[_0x0da4('0x40')]),_0x0da4('0x41'),{'id':_0x1f95bb['id'],'destaccountcode':_0x1f95bb[_0x0da4('0x42')],'destconnectedlinenum':_0x25afa8[_0x0da4('0x3a')]});}}}}catch(_0x689a25){logger[_0x0da4('0x2a')](_0x0da4('0x4b'),_0x25afa8[_0x0da4('0x31')],util['inspect'](_0x689a25,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x19')]=function(_0x17db8e){try{if(this['isNotNull'](_0x17db8e)){logger['debug'](_0x0da4('0x4c'),_0x17db8e[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x17db8e,{'showHidden':![],'depth':null}));if(_0x17db8e[_0x0da4('0x38')]===_0x0da4('0x4d')||_0x17db8e[_0x0da4('0x3a')]==='h')return;if(_0x17db8e[_0x0da4('0x31')]===_0x17db8e[_0x0da4('0x34')]||this[_0x0da4('0x17')][_0x17db8e[_0x0da4('0x34')]]){_0x17db8e[_0x0da4('0x4e')]=_0x17db8e[_0x0da4('0x4e')]?_0x17db8e[_0x0da4('0x4e')][_0x0da4('0x4f')]():undefined;_0x17db8e[_0x0da4('0x50')]=_0x17db8e['appdata']||_0x17db8e[_0x0da4('0x50')];if(_0x17db8e[_0x0da4('0x51')]&&_0x17db8e[_0x0da4('0x4e')]!==_0x0da4('0x52')){_0x17db8e['applicationdata']=_0x17db8e[_0x0da4('0x50')][_0x0da4('0x4f')]();}logger[_0x0da4('0x28')](_0x0da4('0x53'),_0x17db8e[_0x0da4('0x31')],_0x17db8e[_0x0da4('0x4e')],_0x17db8e[_0x0da4('0x50')]);if(_[_0x0da4('0x2e')](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]])){this['channels'][_0x17db8e[_0x0da4('0x31')]]=new Channel();this[_0x0da4('0x15')][_0x17db8e['uniqueid']][_0x0da4('0x45')]=_0x17db8e['duration']?moment()[_0x0da4('0x54')](moment['duration'](_0x17db8e[_0x0da4('0x55')])[_0x0da4('0x56')](),_0x0da4('0x56'))['format'](_0x0da4('0x46')):moment()[_0x0da4('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0da4('0x15')][_0x17db8e['uniqueid']]['disposition']=_0x0da4('0xd');}_['merge'](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]],_[_0x0da4('0x49')](_0x17db8e,_['keys'](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]])));if(_[_0x0da4('0x57')](applications,_0x17db8e[_0x0da4('0x4e')])){this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x58')]=_0x17db8e[_0x0da4('0x4e')];this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x59')]=_0x17db8e[_0x0da4('0x50')];if(_0x17db8e[_0x0da4('0x4e')]==='set'&&_[_0x0da4('0x5a')](_0x17db8e[_0x0da4('0x50')][_0x0da4('0x4f')](),_0x0da4('0x5b'))){var _0x1ab520=_0x17db8e[_0x0da4('0x50')][_0x0da4('0x39')]('=');var _0x1622a3=_0x1ab520[0x0][_0x0da4('0x4f')]()[_0x0da4('0x5c')](/cdr\((.*)\)/);if(_0x1622a3){if(_0x1622a3[0x1]===_0x0da4('0x5d')&&!_[_0x0da4('0x5e')](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x1622a3[0x1]]))return;this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x1622a3[0x1]]=_0x1ab520[0x1];}}else if(_0x17db8e[_0x0da4('0x4e')]===_0x0da4('0x52')){this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x17db8e[_0x0da4('0x50')]['split'](',')[0x0];}}}}}catch(_0x5032ee){logger[_0x0da4('0x2a')](_0x0da4('0x5f'),_0x17db8e[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x5032ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x1d')]=function(_0x56f5a6){try{if(this[_0x0da4('0x2d')](_0x56f5a6)){logger[_0x0da4('0x28')](_0x0da4('0x60'),_0x56f5a6[_0x0da4('0x31')],_0x56f5a6[_0x0da4('0x34')],_0x56f5a6[_0x0da4('0x32')],_0x56f5a6[_0x0da4('0x61')]);logger[_0x0da4('0x33')](_0x0da4('0x62'),_0x56f5a6[_0x0da4('0x31')],util['inspect'](_0x56f5a6,{'showHidden':![],'depth':null}));if(_0x56f5a6['channelstate']!=='6')return;var _0xa5c2c=this['agents'][_0x56f5a6[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x56f5a6['uniqueid']!==_0x56f5a6[_0x0da4('0x34')]){var _0x1d60b4=moment();if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]){if(!this['channels'][_0x56f5a6[_0x0da4('0x34')]]['answered']){this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x63')]=!![];this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x64')]=_0x1d60b4['format'](_0x0da4('0x46'));if(this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x45')]){this['channels'][_0x56f5a6['linkedid']][_0x0da4('0x65')]=_0x1d60b4[_0x0da4('0x66')](this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x45')],_0x0da4('0x56'));}}this[_0x0da4('0x15')][_0x56f5a6['linkedid']][_0x0da4('0x34')]=_0x56f5a6[_0x0da4('0x31')];if(_0x56f5a6['calleridnum']!==_0x0da4('0x3b')){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x3d')]=_0x56f5a6[_0x0da4('0x61')];}this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x67')]=_0x56f5a6[_0x0da4('0x32')];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['destinationchannel']=_0x56f5a6[_0x0da4('0x38')];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['disposition']=dispositions[_[_0x0da4('0x68')](_0x56f5a6[_0x0da4('0x48')])];if(_0xa5c2c){this['channels'][_0x56f5a6['linkedid']]['UserId']=_0xa5c2c['id'];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['membername']=_0xa5c2c[_0x0da4('0x40')];}}if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){if(!this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x63')]){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x63')]=!![];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x64')]=_0x1d60b4[_0x0da4('0x3e')](_0x0da4('0x46'));if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x45')]){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x65')]=_0x1d60b4['diff'](this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x45')],_0x0da4('0x56'));}}if(_0x56f5a6[_0x0da4('0x61')]!==_0x0da4('0x3b')){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x3d')]=_0x56f5a6[_0x0da4('0x61')];}this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x67')]=_0x56f5a6[_0x0da4('0x32')];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']][_0x0da4('0x69')]=_0x56f5a6[_0x0da4('0x38')];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']][_0x0da4('0x47')]=dispositions[_['toNumber'](_0x56f5a6[_0x0da4('0x48')])];}}else{if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){if(_0xa5c2c){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x6a')]=_0xa5c2c['id'];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']]['membername']=_0xa5c2c[_0x0da4('0x40')];}}}if(_0x56f5a6['context']===_0x0da4('0x6b')){if(_0xa5c2c){_0xa5c2c[_0x0da4('0x3c')]=_0x56f5a6[_0x0da4('0x3a')];var _0x71e331;if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){_0x71e331=this['channels'][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x52')];}else if(this[_0x0da4('0x15')][_0x56f5a6['linkedid']]){_0x71e331=this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['queue'];}_0xa5c2c['queue']=_0x71e331;var _0x173297={'id':_0xa5c2c['id'],'name':_0xa5c2c[_0x0da4('0x40')],'agentconnected':!![],'destaccountcode':_0xa5c2c[_0x0da4('0x42')],'destconnectedlinenum':_0x56f5a6[_0x0da4('0x3a')],'queue':_0x71e331||undefined,'uniqueid':_0x56f5a6[_0x0da4('0x34')]};logger['debug'](_0x0da4('0x6c'),_0x56f5a6[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x173297,{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),_0xa5c2c['name']),_0x0da4('0x41'),_0x173297);}}}}catch(_0x1ca005){logger[_0x0da4('0x2a')](_0x0da4('0x6d'),_0x56f5a6[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x1ca005,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x6e')]=function(_0x5e3790,_0x1a3489){try{if(this[_0x0da4('0x15')][_0x5e3790]){logger[_0x0da4('0x28')](_0x0da4('0x6f'),_0x5e3790,_0x1a3489);this[_0x0da4('0x15')][_0x5e3790][_0x0da4('0x70')]=!![];if(_[_0x0da4('0x71')](_0x1a3489,_0x0da4('0x72'))){_0x1a3489=_0x1a3489[_0x0da4('0x73')]('.wav49',_0x0da4('0x74'));}this[_0x0da4('0x15')][_0x5e3790][_0x0da4('0x75')]=_0x1a3489;var _0x405155=_[_0x0da4('0x76')](this['channels'][_0x5e3790][_0x0da4('0x77')],{'filename':_0x1a3489});if(_[_0x0da4('0x5e')](_0x405155)){this['channels'][_0x5e3790]['monitors']['push']({'filename':_0x1a3489,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x342a45){logger[_0x0da4('0x2a')](_0x0da4('0x78'),_0x5e3790,util[_0x0da4('0x2b')](_0x342a45,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x1e')]=function(_0x4ba138){try{if(this['isNotNull'](_0x4ba138)){logger[_0x0da4('0x33')](_0x0da4('0x79'),_0x4ba138[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x4ba138,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ba138[_0x0da4('0x31')]]&&_0x4ba138[_0x0da4('0x38')]!=_0x0da4('0x4d')){if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')])){if(this[_0x0da4('0x2d')](_0x4ba138['variable'][_0x0da4('0x7b')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this['syncMixMonitorFilename'](_0x4ba138['uniqueid'],_0x4ba138['value']);}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x7c')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this['channels'][_0x4ba138[_0x0da4('0x31')]]['calleridnum']=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x7e')])){logger[_0x0da4('0x28')](_0x0da4('0x7f'),_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x80')]=_0x4ba138[_0x0da4('0x7d')];}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x81')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138['uniqueid']][_0x0da4('0x5d')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x82')])){logger[_0x0da4('0x28')](_0x0da4('0x83'),_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]['split'](',')[0x0]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x4ba138['value'][_0x0da4('0x39')](',')[0x0];}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x84')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]]['originatecalleridnum']=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['xmd-destination'])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x85')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['xmd-callerid-preview'])){logger[_0x0da4('0x28')](_0x0da4('0x86'),_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]]['calleridpreview']=_0x4ba138[_0x0da4('0x7d')];}else if(this['isNotNull'](_0x4ba138['variable'][_0x0da4('0x87')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x88')])){logger[_0x0da4('0x28')](_0x0da4('0x89'),_0x4ba138['uniqueid'],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x8a')]=_0x4ba138['value'];}}}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')]['mixmonitor_filename'])){if(_0x4ba138['value']){var _0x21771d=path[_0x0da4('0x8b')](_0x4ba138[_0x0da4('0x7d')])[_0x0da4('0x40')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x21771d,_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x6e')](_0x21771d,_0x4ba138[_0x0da4('0x7d')]);}}else if(this['channels'][_0x4ba138[_0x0da4('0x34')]]){if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')])){if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['sipcallid'])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4ba138[_0x0da4('0x34')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x34')]][_0x0da4('0x8c')]=_0x4ba138['value'];}}}}}catch(_0x2c0340){logger['error'](_0x0da4('0x8d'),_0x4ba138[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x2c0340,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x192688){try{if(this['isNotNull'](_0x192688)){logger[_0x0da4('0x33')](_0x0da4('0x8e'),_0x192688['uniqueid'],util['inspect'](_0x192688,{'showHidden':![],'depth':null}));if(this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]){if(this['channels'][this['blindTransfers'][_0x192688[_0x0da4('0x34')]]['linkedid']]){this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x31')]=_0x192688[_0x0da4('0x31')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']][_0x0da4('0x34')]][_0x0da4('0x63')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['answered'];this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x64')]=this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x64')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x69')]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]['linkedid']]['channel'];this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x47')]=this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x47')];this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x34')]];this[_0x0da4('0x8f')](this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]);}else if(this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]]){this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]]['uniqueid']=[this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x31')]][_0x0da4('0x34')],this['channels'][this['blindTransfers'][_0x192688['linkedid']]['uniqueid']][_0x0da4('0x34')]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x31')]][0x0];this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x63')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['answered'];this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]['uniqueid']]['answertime']=this['channels'][_0x192688['uniqueid']][_0x0da4('0x64')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']]['uniqueid']][_0x0da4('0x69')]=this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x38')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']][_0x0da4('0x31')]]['disposition']=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x47')];this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]=this[_0x0da4('0x15')][this['blindTransfers'][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]];this[_0x0da4('0x8f')](this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x31')]);}}if(this['channels'][_0x192688['uniqueid']]){logger['info'](_0x0da4('0x90'),_0x192688[_0x0da4('0x31')],_0x192688[_0x0da4('0x91')]);var _0x24359b=moment();this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x92')]=_0x24359b[_0x0da4('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x55')]=_0x24359b['diff'](this['channels'][_0x192688[_0x0da4('0x31')]]['starttime'],_0x0da4('0x56'));if(this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x63')]){this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['billableseconds']=_0x24359b['diff'](this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x64')],_0x0da4('0x56'));this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x65')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x55')]-this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['billableseconds'];}if(_0x192688[_0x0da4('0x37')]===_0x0da4('0x6b')){if(this['agents'][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]){this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]=_[_0x0da4('0x93')](this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]],[_0x0da4('0x3c')]);logger[_0x0da4('0x33')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x192688['uniqueid'],util[_0x0da4('0x2b')]({'id':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x192688['channel'][_0x0da4('0x39')]('-')[0x0]][_0x0da4('0x42')]},{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]][_0x0da4('0x40')]),'user:agentcomplete',{'id':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')]['split']('-')[0x0]][_0x0da4('0x42')]});for(var _0x255e8a=0x0;_0x255e8a{delete this[_0x0da4('0x15')][_0x1f69af];},_0x444aff);}};module[_0x0da4('0xc2')]=VoiceCallReport; \ No newline at end of file +var _0xdad9=['value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','then','resolve','Action','catch','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','context','from-sip','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','debug','[%s][voiceCallReport][newexten]\x20event:','blindTransfers','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','keys','includes','lastapplication','lastdata','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','diff','connectedlinename','destinationchannel','disposition','UserId','holdtime','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s'];(function(_0x3dae65,_0x4884f){var _0x48a30d=function(_0x981c57){while(--_0x981c57){_0x3dae65['push'](_0x3dae65['shift']());}};_0x48a30d(++_0x4884f);}(_0xdad9,0x112));var _0x9dad=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdad9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9dad('0x0'));var moment=require(_0x9dad('0x1'));var util=require(_0x9dad('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x9dad('0x3'));var logger=require(_0x9dad('0x4'))('ami');var ami=require(_0x9dad('0x5'));var Channel=require(_0x9dad('0x6'));var RpcSetting=require(_0x9dad('0x7'));var applications=[_0x9dad('0x8'),_0x9dad('0x9'),_0x9dad('0xa'),_0x9dad('0xb'),_0x9dad('0xc'),_0x9dad('0xd')];var dispositions=['NO\x20ANSWER',_0x9dad('0xe'),'FAILED',_0x9dad('0xf'),_0x9dad('0xf'),'NO\x20ANSWER',_0x9dad('0x10'),_0x9dad('0x11'),_0x9dad('0xe'),'FAILED',_0x9dad('0xe')];config[_0x9dad('0x12')]=_[_0x9dad('0x13')](config[_0x9dad('0x12')],{'host':_0x9dad('0x14'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9dad('0x12')]));function VoiceCallReport(_0x16ca30){this[_0x9dad('0x15')]=_0x16ca30[_0x9dad('0x15')];this[_0x9dad('0x16')]=_0x16ca30[_0x9dad('0x16')];this['blindTransfers']={};ami['on'](_0x9dad('0x17'),this['syncNewExten'][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x19'),this[_0x9dad('0x1a')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x1b'),this[_0x9dad('0x1c')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x1d'),this[_0x9dad('0x1e')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x1f'),this[_0x9dad('0x20')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x21'),this[_0x9dad('0x22')]['bind'](this));ami['on'](_0x9dad('0x23'),this[_0x9dad('0x24')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x25'),this[_0x9dad('0x26')]['bind'](this));ami['on'](_0x9dad('0x27'),this[_0x9dad('0x28')][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x29'),this['syncMusicOnHoldStart'][_0x9dad('0x18')](this));ami['on'](_0x9dad('0x2a'),this[_0x9dad('0x2b')]['bind'](this));try{logger[_0x9dad('0x2c')](_0x9dad('0x2d'));ami[_0x9dad('0x2e')]();}catch(_0x591203){logger[_0x9dad('0x2f')](_0x9dad('0x30'),util[_0x9dad('0x31')](_0x591203,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x33')]=function(_0x3c5461){return _0x3c5461!==null&&!_[_0x9dad('0x34')](_0x3c5461);};VoiceCallReport['prototype']['emit']=function(_0x4216bd,_0x2a5216,_0x3745f8){io['to'](_0x4216bd)[_0x9dad('0x35')](_0x2a5216,_0x3745f8);};VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x24')]=function(_0x236e89){try{if(this[_0x9dad('0x33')](_0x236e89)){logger[_0x9dad('0x2c')](_0x9dad('0x36'),_0x236e89[_0x9dad('0x37')],_0x236e89[_0x9dad('0x38')],_0x236e89[_0x9dad('0x39')]);logger['debug'](_0x9dad('0x3a'),_0x236e89['uniqueid'],util[_0x9dad('0x31')](_0x236e89,{'showHidden':![],'depth':null}));if(_0x236e89[_0x9dad('0x37')]===_0x236e89[_0x9dad('0x3b')]){if(!_[_0x9dad('0x34')](this[_0x9dad('0x15')][_0x236e89[_0x9dad('0x37')]])){_[_0x9dad('0x3c')](this[_0x9dad('0x15')][_0x236e89[_0x9dad('0x37')]],_[_0x9dad('0x3d')](_0x236e89,_['keys'](this[_0x9dad('0x15')][_0x236e89[_0x9dad('0x37')]])));}}if(_0x236e89[_0x9dad('0x3e')]===_0x9dad('0x3f')){var _0x50f7c4=this[_0x9dad('0x16')][_0x236e89['channel'][_0x9dad('0x40')]('-')[0x0]];if(_0x50f7c4){if(_0x236e89[_0x9dad('0x41')]==_0x9dad('0x42')){_0x50f7c4[_0x9dad('0x43')]=_0x236e89[_0x9dad('0x44')];this[_0x9dad('0x35')](util[_0x9dad('0x45')](_0x9dad('0x46'),_0x50f7c4[_0x9dad('0x47')]),_0x9dad('0x48'),{'id':_0x50f7c4['id'],'destaccountcode':_0x50f7c4[_0x9dad('0x49')],'destconnectedlinenum':_0x236e89[_0x9dad('0x44')]});}}}}}catch(_0x1a9d45){logger[_0x9dad('0x2f')](_0x9dad('0x4a'),_0x236e89[_0x9dad('0x37')],util['inspect'](_0x1a9d45,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x1c')]=function(_0x9fea51){try{if(this[_0x9dad('0x33')](_0x9fea51)){logger['debug'](_0x9dad('0x4b'),_0x9fea51[_0x9dad('0x37')],util['inspect'](_0x9fea51,{'showHidden':![],'depth':null}));if(this['channels'][_0x9fea51['uniqueid']]){return;}if(_0x9fea51[_0x9dad('0x4c')]===_0x9dad('0x4d')){return;}if(_0x9fea51[_0x9dad('0x37')]!==_0x9fea51['linkedid']&&!this['blindTransfers'][_0x9fea51['linkedid']]){return;}logger['info'](_0x9dad('0x4e'),_0x9fea51['uniqueid'],_0x9fea51['context'],_0x9fea51['exten']);this['channels'][_0x9fea51[_0x9dad('0x37')]]=new Channel();this[_0x9dad('0x15')][_0x9fea51[_0x9dad('0x37')]]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x9fea51[_0x9dad('0x37')]]['disposition']=dispositions[_[_0x9dad('0x4f')](_0x9fea51[_0x9dad('0x50')])];_['merge'](this['channels'][_0x9fea51['uniqueid']],_[_0x9dad('0x3d')](_0x9fea51,_['keys'](this['channels'][_0x9fea51[_0x9dad('0x37')]])));if(_0x9fea51['context']===_0x9dad('0x3f')){var _0x36e63a=this[_0x9dad('0x16')][_0x9fea51[_0x9dad('0x4c')]['split']('-')[0x0]];if(_0x36e63a&&typeof _0x36e63a[_0x9dad('0x43')]===_0x9dad('0x51')){_0x36e63a[_0x9dad('0x43')]=_0x9fea51[_0x9dad('0x41')];logger['debug'](_0x9dad('0x52'),_0x9fea51['uniqueid'],util[_0x9dad('0x31')]({'id':_0x36e63a['id'],'destaccountcode':_0x36e63a[_0x9dad('0x49')],'destconnectedlinenum':_0x9fea51[_0x9dad('0x41')]},{'showHidden':![],'depth':null}));this[_0x9dad('0x35')](util[_0x9dad('0x45')](_0x9dad('0x46'),_0x36e63a[_0x9dad('0x47')]),_0x9dad('0x48'),{'id':_0x36e63a['id'],'destaccountcode':_0x36e63a[_0x9dad('0x49')],'destconnectedlinenum':_0x9fea51['exten']});}}}}catch(_0x22b5f4){logger['error'](_0x9dad('0x53'),_0x9fea51[_0x9dad('0x37')],util['inspect'](_0x22b5f4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x1a')]=function(_0x4ce89c){try{if(this['isNotNull'](_0x4ce89c)){logger[_0x9dad('0x54')](_0x9dad('0x55'),_0x4ce89c[_0x9dad('0x37')],util[_0x9dad('0x31')](_0x4ce89c,{'showHidden':![],'depth':null}));if(_0x4ce89c['channel']==='OutgoingSpoolFailed'||_0x4ce89c['exten']==='h')return;if(_0x4ce89c[_0x9dad('0x37')]===_0x4ce89c[_0x9dad('0x3b')]||this[_0x9dad('0x56')][_0x4ce89c[_0x9dad('0x3b')]]){_0x4ce89c[_0x9dad('0x57')]=_0x4ce89c['application']?_0x4ce89c[_0x9dad('0x57')]['toLowerCase']():undefined;_0x4ce89c[_0x9dad('0x58')]=_0x4ce89c[_0x9dad('0x59')]||_0x4ce89c['applicationdata'];if(_0x4ce89c[_0x9dad('0x59')]&&_0x4ce89c['application']!=='queue'){_0x4ce89c[_0x9dad('0x58')]=_0x4ce89c[_0x9dad('0x58')][_0x9dad('0x5a')]();}logger['info'](_0x9dad('0x5b'),_0x4ce89c['uniqueid'],_0x4ce89c[_0x9dad('0x57')],_0x4ce89c['applicationdata']);if(_[_0x9dad('0x34')](this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]])){this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]]=new Channel();this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]][_0x9dad('0x5c')]=_0x4ce89c[_0x9dad('0x5d')]?moment()['subtract'](moment[_0x9dad('0x5d')](_0x4ce89c[_0x9dad('0x5d')])[_0x9dad('0x5e')](),_0x9dad('0x5e'))['format'](_0x9dad('0x5f')):moment()[_0x9dad('0x45')](_0x9dad('0x5f'));this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]]['disposition']=_0x9dad('0xf');}_[_0x9dad('0x3c')](this['channels'][_0x4ce89c[_0x9dad('0x37')]],_['pick'](_0x4ce89c,_[_0x9dad('0x60')](this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]])));if(_[_0x9dad('0x61')](applications,_0x4ce89c[_0x9dad('0x57')])){this[_0x9dad('0x15')][_0x4ce89c['uniqueid']][_0x9dad('0x62')]=_0x4ce89c[_0x9dad('0x57')];this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]][_0x9dad('0x63')]=_0x4ce89c['applicationdata'];if(_0x4ce89c[_0x9dad('0x57')]==='set'&&_['startsWith'](_0x4ce89c[_0x9dad('0x58')][_0x9dad('0x5a')](),_0x9dad('0x64'))){var _0x1beeaa=_0x4ce89c['applicationdata'][_0x9dad('0x40')]('=');var _0x36cd1d=_0x1beeaa[0x0][_0x9dad('0x5a')]()['match'](/cdr\((.*)\)/);if(_0x36cd1d){if(_0x36cd1d[0x1]===_0x9dad('0x65')&&!_[_0x9dad('0x66')](this[_0x9dad('0x15')][_0x4ce89c['uniqueid']][_0x36cd1d[0x1]]))return;this[_0x9dad('0x15')][_0x4ce89c['uniqueid']][_0x36cd1d[0x1]]=_0x1beeaa[0x1];}}else if(_0x4ce89c['application']===_0x9dad('0x9')){this[_0x9dad('0x15')][_0x4ce89c[_0x9dad('0x37')]][_0x9dad('0x9')]=_0x4ce89c['applicationdata']['split'](',')[0x0];}}}}}catch(_0x288ae0){logger['error'](_0x9dad('0x67'),_0x4ce89c['uniqueid'],util[_0x9dad('0x31')](_0x288ae0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x1e')]=function(_0x1ece44){try{if(this['isNotNull'](_0x1ece44)){logger[_0x9dad('0x2c')](_0x9dad('0x68'),_0x1ece44['uniqueid'],_0x1ece44[_0x9dad('0x3b')],_0x1ece44[_0x9dad('0x38')],_0x1ece44[_0x9dad('0x39')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x1ece44[_0x9dad('0x37')],util[_0x9dad('0x31')](_0x1ece44,{'showHidden':![],'depth':null}));if(_0x1ece44[_0x9dad('0x50')]!=='6')return;var _0x3086ce=this[_0x9dad('0x16')][_0x1ece44[_0x9dad('0x4c')]['split']('-')[0x0]];if(_0x1ece44[_0x9dad('0x37')]!==_0x1ece44[_0x9dad('0x3b')]){var _0x47ce59=moment();if(this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]]){if(!this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x69')]){this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x69')]=!![];this['channels'][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x6a')]=_0x47ce59['format'](_0x9dad('0x5f'));if(this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x5c')]){this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]]['holdtime']=_0x47ce59[_0x9dad('0x6b')](this[_0x9dad('0x15')][_0x1ece44['linkedid']][_0x9dad('0x5c')],'seconds');}}this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]]['linkedid']=_0x1ece44[_0x9dad('0x37')];if(_0x1ece44[_0x9dad('0x39')]!==_0x9dad('0x42')){this['channels'][_0x1ece44['linkedid']][_0x9dad('0x44')]=_0x1ece44[_0x9dad('0x39')];}this[_0x9dad('0x15')][_0x1ece44['linkedid']][_0x9dad('0x6c')]=_0x1ece44[_0x9dad('0x38')];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x6d')]=_0x1ece44[_0x9dad('0x4c')];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x6e')]=dispositions[_['toNumber'](_0x1ece44[_0x9dad('0x50')])];if(_0x3086ce){this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]][_0x9dad('0x6f')]=_0x3086ce['id'];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]]['membername']=_0x3086ce[_0x9dad('0x47')];}}if(this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]]){if(!this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x69')]){this['channels'][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x69')]=!![];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x6a')]=_0x47ce59[_0x9dad('0x45')](_0x9dad('0x5f'));if(this[_0x9dad('0x15')][_0x1ece44['uniqueid']][_0x9dad('0x5c')]){this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x70')]=_0x47ce59[_0x9dad('0x6b')](this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]]['starttime'],'seconds');}}if(_0x1ece44[_0x9dad('0x39')]!=='xcally-motion-preview'){this['channels'][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x44')]=_0x1ece44[_0x9dad('0x39')];}this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x6c')]=_0x1ece44[_0x9dad('0x38')];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x6d')]=_0x1ece44[_0x9dad('0x4c')];this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x6e')]=dispositions[_['toNumber'](_0x1ece44['channelstate'])];}}else{if(this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]]){if(_0x3086ce){this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x6f')]=_0x3086ce['id'];this['channels'][_0x1ece44[_0x9dad('0x37')]][_0x9dad('0x71')]=_0x3086ce[_0x9dad('0x47')];}}}if(_0x1ece44[_0x9dad('0x3e')]===_0x9dad('0x3f')){if(_0x3086ce){_0x3086ce[_0x9dad('0x43')]=_0x1ece44['exten'];var _0x33b8bf;if(this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]]){_0x33b8bf=this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x37')]]['queue'];}else if(this[_0x9dad('0x15')][_0x1ece44['linkedid']]){_0x33b8bf=this[_0x9dad('0x15')][_0x1ece44[_0x9dad('0x3b')]]['queue'];}_0x3086ce[_0x9dad('0x9')]=_0x33b8bf;var _0x1d49c5={'id':_0x3086ce['id'],'name':_0x3086ce['name'],'agentconnected':!![],'destaccountcode':_0x3086ce[_0x9dad('0x49')],'destconnectedlinenum':_0x1ece44[_0x9dad('0x41')],'queue':_0x33b8bf||undefined,'uniqueid':_0x1ece44[_0x9dad('0x3b')]};logger[_0x9dad('0x54')](_0x9dad('0x72'),_0x1ece44['uniqueid'],util[_0x9dad('0x31')](_0x1d49c5,{'showHidden':![],'depth':null}));this['emit'](util[_0x9dad('0x45')](_0x9dad('0x46'),_0x3086ce[_0x9dad('0x47')]),_0x9dad('0x48'),_0x1d49c5);}}}}catch(_0x130d97){logger[_0x9dad('0x2f')]('[%s][voiceCallReport][newstate]',_0x1ece44['uniqueid'],util[_0x9dad('0x31')](_0x130d97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9dad('0x32')][_0x9dad('0x73')]=function(_0x3e3045,_0x3221e6){try{if(this[_0x9dad('0x15')][_0x3e3045]){logger[_0x9dad('0x2c')](_0x9dad('0x74'),_0x3e3045,_0x3221e6);this[_0x9dad('0x15')][_0x3e3045]['monitor']=!![];if(_['endsWith'](_0x3221e6,'.wav49')){_0x3221e6=_0x3221e6['replace'](_0x9dad('0x75'),_0x9dad('0x76'));}this[_0x9dad('0x15')][_0x3e3045][_0x9dad('0x77')]=_0x3221e6;var _0x28a361=_['find'](this[_0x9dad('0x15')][_0x3e3045]['monitors'],{'filename':_0x3221e6});if(_[_0x9dad('0x66')](_0x28a361)){this['channels'][_0x3e3045][_0x9dad('0x78')][_0x9dad('0x79')]({'filename':_0x3221e6,'createdAt':moment()['format'](_0x9dad('0x5f')),'mixmonitorid':'','status':_0x9dad('0x7a')});}}}catch(_0x5e8e02){logger['error'](_0x9dad('0x7b'),_0x3e3045,util[_0x9dad('0x31')](_0x5e8e02,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9dad('0x20')]=function(_0x23e771){try{if(this[_0x9dad('0x33')](_0x23e771)){logger[_0x9dad('0x54')](_0x9dad('0x7c'),_0x23e771['uniqueid'],util[_0x9dad('0x31')](_0x23e771,{'showHidden':![],'depth':null}));if(this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]]&&_0x23e771[_0x9dad('0x4c')]!='OutgoingSpoolFailed'){if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')])){if(this['isNotNull'](_0x23e771['variable'][_0x9dad('0x7e')])){logger[_0x9dad('0x2c')](_0x9dad('0x7f'),_0x23e771['uniqueid'],_0x23e771[_0x9dad('0x80')]);this['syncMixMonitorFilename'](_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);}else if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')]['xmd-phone'])){logger[_0x9dad('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x39')]=_0x23e771[_0x9dad('0x80')];}else if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x81')])){logger[_0x9dad('0x2c')](_0x9dad('0x82'),_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);this['channels'][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x83')]=_0x23e771[_0x9dad('0x80')];}else if(this['isNotNull'](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x84')])){logger['info'](_0x9dad('0x85'),_0x23e771['uniqueid'],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x65')]=_0x23e771['value'];}else if(this[_0x9dad('0x33')](_0x23e771['variable'][_0x9dad('0x86')])){logger[_0x9dad('0x2c')](_0x9dad('0x87'),_0x23e771['uniqueid'],_0x23e771['value'][_0x9dad('0x40')](',')[0x0]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x9')]=_0x23e771[_0x9dad('0x80')][_0x9dad('0x40')](',')[0x0];}else if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x88')])){logger[_0x9dad('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x89')]=_0x23e771[_0x9dad('0x80')];}else if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x8a')])){logger[_0x9dad('0x2c')](_0x9dad('0x8b'),_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]]['destination']=_0x23e771['value'];}else if(this[_0x9dad('0x33')](_0x23e771['variable'][_0x9dad('0x8c')])){logger[_0x9dad('0x2c')](_0x9dad('0x8d'),_0x23e771['uniqueid'],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771[_0x9dad('0x37')]][_0x9dad('0x8e')]=_0x23e771['value'];}else if(this[_0x9dad('0x33')](_0x23e771['variable'][_0x9dad('0x8f')])){logger[_0x9dad('0x2c')](_0x9dad('0x90'),_0x23e771[_0x9dad('0x37')],_0x23e771['value']);this['channels'][_0x23e771[_0x9dad('0x37')]]['queue']=_0x23e771['value'];}else if(this['isNotNull'](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x91')])){logger[_0x9dad('0x2c')](_0x9dad('0x92'),_0x23e771[_0x9dad('0x37')],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771['uniqueid']][_0x9dad('0x93')]=_0x23e771['value'];}}}else if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')]['mixmonitor_filename'])){if(_0x23e771[_0x9dad('0x80')]){var _0x557ced=path[_0x9dad('0x94')](_0x23e771[_0x9dad('0x80')])['name'];logger[_0x9dad('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x557ced,_0x23e771[_0x9dad('0x80')]);this['syncMixMonitorFilename'](_0x557ced,_0x23e771[_0x9dad('0x80')]);}}else if(this['channels'][_0x23e771['linkedid']]){if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')])){if(this[_0x9dad('0x33')](_0x23e771[_0x9dad('0x7d')][_0x9dad('0x91')])){logger['info'](_0x9dad('0x92'),_0x23e771[_0x9dad('0x3b')],_0x23e771[_0x9dad('0x80')]);this[_0x9dad('0x15')][_0x23e771['linkedid']][_0x9dad('0x95')]=_0x23e771['value'];}}}}}catch(_0x345cdd){logger['error'](_0x9dad('0x96'),_0x23e771['uniqueid'],util[_0x9dad('0x31')](_0x345cdd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9dad('0x22')]=function(_0x38b16c){try{if(this[_0x9dad('0x33')](_0x38b16c)){logger[_0x9dad('0x54')](_0x9dad('0x97'),_0x38b16c['uniqueid'],util[_0x9dad('0x31')](_0x38b16c,{'showHidden':![],'depth':null}));if(this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]]){if(this[_0x9dad('0x15')][this['blindTransfers'][_0x38b16c['linkedid']][_0x9dad('0x3b')]]){this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x3b')]][_0x9dad('0x37')]=_0x38b16c[_0x9dad('0x37')];this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x3b')]][_0x9dad('0x69')]=this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x69')];this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x3b')]][_0x9dad('0x6a')]=this[_0x9dad('0x15')][_0x38b16c['uniqueid']][_0x9dad('0x6a')];this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c['linkedid']][_0x9dad('0x3b')]][_0x9dad('0x6d')]=this[_0x9dad('0x15')][this['blindTransfers'][_0x38b16c[_0x9dad('0x3b')]]['linkedid']]['channel'];this['channels'][this[_0x9dad('0x56')][_0x38b16c['linkedid']]['linkedid']][_0x9dad('0x6e')]=this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x6e')];this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]]=this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x3b')]];this[_0x9dad('0x98')](this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]]['linkedid']);}else if(this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c['linkedid']][_0x9dad('0x37')]]){this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]]['uniqueid']=[this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c['linkedid']][_0x9dad('0x37')]][_0x9dad('0x3b')],this[_0x9dad('0x15')][this['blindTransfers'][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x3b')]=this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x37')]][0x0];this['channels'][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x69')]=this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x69')];this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x6a')]=this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]]['answertime'];this['channels'][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x6d')]=this['channels'][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]][_0x9dad('0x37')]][_0x9dad('0x4c')];this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c[_0x9dad('0x3b')]]['uniqueid']][_0x9dad('0x6e')]=this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x6e')];this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]]=this[_0x9dad('0x15')][this[_0x9dad('0x56')][_0x38b16c['linkedid']][_0x9dad('0x37')]];this[_0x9dad('0x98')](this['blindTransfers'][_0x38b16c['linkedid']][_0x9dad('0x37')]);}}if(this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]]){logger[_0x9dad('0x2c')](_0x9dad('0x99'),_0x38b16c[_0x9dad('0x37')],_0x38b16c[_0x9dad('0x9a')]);var _0xbaaf39=moment();this['channels'][_0x38b16c[_0x9dad('0x37')]]['endtime']=_0xbaaf39[_0x9dad('0x45')](_0x9dad('0x5f'));this[_0x9dad('0x15')][_0x38b16c['uniqueid']][_0x9dad('0x5d')]=_0xbaaf39[_0x9dad('0x6b')](this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x5c')],_0x9dad('0x5e'));if(this['channels'][_0x38b16c['uniqueid']][_0x9dad('0x69')]){this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x9b')]=_0xbaaf39[_0x9dad('0x6b')](this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x6a')],_0x9dad('0x5e'));this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x70')]=this[_0x9dad('0x15')][_0x38b16c['uniqueid']]['duration']-this[_0x9dad('0x15')][_0x38b16c[_0x9dad('0x37')]][_0x9dad('0x9b')];}if(_0x38b16c['context']==='from-sip'){if(this[_0x9dad('0x16')][_0x38b16c[_0x9dad('0x4c')]['split']('-')[0x0]]){this[_0x9dad('0x16')][_0x38b16c[_0x9dad('0x4c')][_0x9dad('0x40')]('-')[0x0]]=_[_0x9dad('0x9c')](this['agents'][_0x38b16c['channel'][_0x9dad('0x40')]('-')[0x0]],[_0x9dad('0x43')]);logger[_0x9dad('0x54')](_0x9dad('0x9d'),_0x38b16c[_0x9dad('0x37')],util[_0x9dad('0x31')]({'id':this[_0x9dad('0x16')][_0x38b16c['channel'][_0x9dad('0x40')]('-')[0x0]]['id'],'destaccountcode':this[_0x9dad('0x16')][_0x38b16c[_0x9dad('0x4c')][_0x9dad('0x40')]('-')[0x0]][_0x9dad('0x49')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x9dad('0x45')](_0x9dad('0x46'),this[_0x9dad('0x16')][_0x38b16c[_0x9dad('0x4c')]['split']('-')[0x0]][_0x9dad('0x47')]),_0x9dad('0x9e'),{'id':this[_0x9dad('0x16')][_0x38b16c['channel'][_0x9dad('0x40')]('-')[0x0]]['id'],'destaccountcode':this[_0x9dad('0x16')][_0x38b16c[_0x9dad('0x4c')][_0x9dad('0x40')]('-')[0x0]][_0x9dad('0x49')]});for(var _0xf1fcac=0x0;_0xf1fcac{delete this[_0x9dad('0x15')][_0x10638d];},_0x2c1f60);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1917315..2364fcc 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2080=['syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','keys','value','variable','outboundrouteid','variables','voice','voice_outbound_channel:save','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','complete','total','answertime','answered','starttime','seconds','sumHoldTime','holdtime','billableseconds','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','deleteChannelAfterTimeout','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd'];(function(_0x32ced1,_0x3dbc12){var _0x1b3cb=function(_0x24efb6){while(--_0x24efb6){_0x32ced1['push'](_0x32ced1['shift']());}};_0x1b3cb(++_0x3dbc12);}(_0x2080,0x1c6));var _0x0208=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x2080[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x0208('0x0'));var moment=require(_0x0208('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x0208('0x2'));var logger=require(_0x0208('0x3'))(_0x0208('0x4'));var ami=require(_0x0208('0x5'));config[_0x0208('0x6')]=_[_0x0208('0x7')](config[_0x0208('0x6')],{'host':_0x0208('0x8'),'port':0x18eb});var io=require(_0x0208('0x9'))(new Redis(config[_0x0208('0x6')]));function VoiceDialReport(_0x1e1dea){this[_0x0208('0xa')]=_0x1e1dea['outboundChannels'];this[_0x0208('0xb')]=_0x1e1dea[_0x0208('0xb')];this[_0x0208('0xc')]={};this['variables']={};ami['on'](_0x0208('0xd'),this[_0x0208('0xe')][_0x0208('0xf')](this));ami['on'](_0x0208('0x10'),this[_0x0208('0x11')]['bind'](this));ami['on']('varset',this[_0x0208('0x12')]['bind'](this));ami['on'](_0x0208('0x13'),this[_0x0208('0x14')][_0x0208('0xf')](this));}VoiceDialReport['prototype'][_0x0208('0x15')]=function(_0x5df728){return _0x5df728!==null&&!_[_0x0208('0x16')](_0x5df728);};VoiceDialReport[_0x0208('0x17')]['emit']=function(_0xc26fe9,_0x2d2e2b,_0x115d2b){io['to'](_0xc26fe9)[_0x0208('0x18')](_0x2d2e2b,_0x115d2b);};VoiceDialReport[_0x0208('0x17')][_0x0208('0xe')]=function(_0x410bba){try{if(this[_0x0208('0x15')](_0x410bba)){logger[_0x0208('0x19')](_0x0208('0x1a'),_0x410bba['uniqueid'],util['inspect'](_0x410bba,{'showHidden':![],'depth':null}));if(this['channels'][_0x410bba['uniqueid']]){_[_0x0208('0x1b')](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],{'starttime':moment()[_0x0208('0x1d')](_0x0208('0x1e')),'lastevent':'called','interface':_0x410bba[_0x0208('0x1f')][_0x0208('0x20')](0x0,_0x410bba[_0x0208('0x1f')][_0x0208('0x21')]('-')),'membername':_0x410bba['channel']['substring'](_0x410bba[_0x0208('0x1f')][_0x0208('0x21')]('/')+0x1,_0x410bba['channel'][_0x0208('0x21')]('-'))},_[_0x0208('0x22')](_0x410bba,[_0x0208('0x23'),_0x0208('0x24')]));logger['info'](_0x0208('0x25'),_0x410bba[_0x0208('0x1c')],this[_0x0208('0xa')][_0x410bba['uniqueid']]['membername'],this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]][_0x0208('0x26')]);logger[_0x0208('0x19')](_0x0208('0x27'),_0x410bba[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x410bba['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x0208('0xc')][_0x410bba['uniqueid']])_['merge'](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],this[_0x0208('0xc')][_0x410bba[_0x0208('0x1c')]]);this[_0x0208('0x18')]('voice:outbound','voice_outbound_channel:save',this[_0x0208('0xa')][_0x410bba['uniqueid']]);logger[_0x0208('0x19')](_0x0208('0x29'),_0x410bba[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x2a'),this[_0x0208('0xa')][_0x410bba['uniqueid']]);}}}catch(_0x12ae5f){logger[_0x0208('0x2b')]('[%s][voiceDialReport][dialbegin]',_0x410bba[_0x0208('0x1c')],util['inspect'](_0x12ae5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x11')]=function(_0x55a33b){try{if(this[_0x0208('0x15')](_0x55a33b)){logger['debug'](_0x0208('0x2c'),_0x55a33b['uniqueid'],util[_0x0208('0x28')](_0x55a33b,{'showHidden':![],'depth':null}));if(this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]){this['channels'][_0x55a33b['uniqueid']][_0x0208('0x2d')]=_0x55a33b[_0x0208('0x2d')];if(_0x55a33b[_0x0208('0x2d')]==='ANSWER'){this[_0x0208('0xa')][_0x55a33b['uniqueid']]['connectedlinenum']=_0x55a33b[_0x0208('0x2e')];this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]['connectedlinename']=_0x55a33b[_0x0208('0x2f')];this[_0x0208('0xa')][_0x55a33b['uniqueid']]['answertime']=moment()[_0x0208('0x1d')](_0x0208('0x1e'));this['channels'][_0x55a33b[_0x0208('0x1c')]][_0x0208('0x30')]=_0x0208('0x31');logger[_0x0208('0x32')](_0x0208('0x33'),_0x55a33b[_0x0208('0x1c')],_0x55a33b[_0x0208('0x1f')]['substring'](_0x55a33b['channel'][_0x0208('0x21')]('/')+0x1,_0x55a33b[_0x0208('0x1f')][_0x0208('0x21')]('-')));logger['debug'](_0x0208('0x34'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x55a33b['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x35'),this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]);}logger['debug'](_0x0208('0x36'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x0208('0x37'),'voice_outbound_channel:save',this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]);}}}catch(_0x1d335b){logger[_0x0208('0x2b')](_0x0208('0x38'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](_0x1d335b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0208('0x12')]=function(_0x41948a){try{if(this[_0x0208('0x15')](_0x41948a)){logger[_0x0208('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x41948a,{'showHidden':![],'depth':null}));this['addVariable'](_0x41948a['uniqueid'],_[_0x0208('0x39')](_0x41948a['variable'])[0x0],_0x41948a[_0x0208('0x3a')]);if(this[_0x0208('0x15')](_0x41948a[_0x0208('0x3b')])&&this['isNotNull'](_0x41948a[_0x0208('0x3b')][_0x0208('0x3c')])){if(_[_0x0208('0x16')](this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]])){this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]]={'routeId':_0x41948a[_0x0208('0x3a')],'variables':this[_0x0208('0x3d')][_0x41948a[_0x0208('0x1c')]],'motionChannel':_0x0208('0x3e')};logger[_0x0208('0x32')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x41948a['uniqueid'],_0x41948a['variable']['outboundrouteid'],_[_0x0208('0x39')](_0x41948a[_0x0208('0x3b')])[0x0],_0x41948a[_0x0208('0x3a')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')](_0x0208('0x37'),_0x0208('0x3f'),this['channels'][_0x41948a['uniqueid']]);}}}}catch(_0x10fe2e){logger[_0x0208('0x2b')](_0x0208('0x40'),_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x10fe2e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x41')]=function(_0x1f60bc,_0x27e52a,_0x5d2597){var _0x260f5d=[_0x0208('0x42'),_0x0208('0x43'),_0x0208('0x44'),'rtpaudioqosjitterbridged',_0x0208('0x45'),_0x0208('0x46'),_0x0208('0x47'),_0x0208('0x48'),'sipcallid','sipuri',_0x0208('0x49'),_0x0208('0x4a'),_0x0208('0x4b'),_0x0208('0x4c'),_0x0208('0x4d'),_0x0208('0x4e'),_0x0208('0x4f'),_0x0208('0x50'),_0x0208('0x51')];if(!_[_0x0208('0x52')](_0x27e52a)&&!_[_0x0208('0x53')](_0x260f5d,_0x27e52a)){if(_[_0x0208('0x16')](this['variables'][_0x1f60bc])){this['variables'][_0x1f60bc]={};}this[_0x0208('0x3d')][_0x1f60bc][_0x27e52a]=_0x5d2597;}};VoiceDialReport[_0x0208('0x17')]['syncHangup']=function(_0x54c2b2){try{if(this['isNotNull'](_0x54c2b2)){logger['debug'](_0x0208('0x54'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](_0x54c2b2,{'showHidden':![],'depth':null}));if(this[_0x0208('0xa')][_0x54c2b2['uniqueid']]){logger[_0x0208('0x32')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x54c2b2['uniqueid'],_0x54c2b2[_0x0208('0x55')]);this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x56')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['duration']=moment(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['endtime'])[_0x0208('0x57')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['starttime'],'seconds');this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x30')]=_0x0208('0x58');this[_0x0208('0xb')][_0x0208('0x59')]+=0x1;if(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')]){this[_0x0208('0xb')][_0x0208('0x5b')]+=0x1;this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['holdtime']=moment(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')])['diff'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5c')],_0x0208('0x5d'));this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['billableseconds']=moment(this['channels'][_0x54c2b2[_0x0208('0x1c')]]['endtime'])[_0x0208('0x57')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')],_0x0208('0x5d'));this[_0x0208('0xb')][_0x0208('0x5e')]+=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5f')]||0x0;this['outbound']['sumBillable']+=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x60')];}this[_0x0208('0xb')][_0x0208('0x61')]+=this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x62')];logger['debug'](_0x0208('0x63'),_0x54c2b2[_0x0208('0x1c')],util['inspect'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')]('custom:voiceDialReport',this['channels'][_0x54c2b2['uniqueid']]);logger[_0x0208('0x19')](_0x0208('0x64'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x65'),this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]);logger[_0x0208('0x19')](_0x0208('0x66'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](this['channels'][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')](_0x0208('0x37'),'voice_outbound:save',this['outbound']);logger[_0x0208('0x32')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]));logger[_0x0208('0x19')](_0x0208('0x67'),_0x54c2b2['uniqueid'],util[_0x0208('0x28')](this['channels'][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')]('voice:outbound',_0x0208('0x68'),this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]);this['deleteChannelAfterTimeout'](_0x54c2b2[_0x0208('0x1c')]);}else if(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]){this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]['uniqueid']=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]['destuniqueid'];}if(this[_0x0208('0x3d')][_0x54c2b2[_0x0208('0x1c')]]){delete this[_0x0208('0x3d')][_0x54c2b2[_0x0208('0x1c')]];}}}catch(_0x363da7){logger['error']('[%s][voiceDialReport][hangup]',_0x54c2b2[_0x0208('0x1c')],util['inspect'](_0x363da7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x6a')]=function(_0x272d8a){try{if(this[_0x0208('0x15')](_0x272d8a)){logger[_0x0208('0x19')](_0x0208('0x6b'),_0x272d8a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x272d8a,{'showHidden':![],'depth':null}));if(_0x272d8a[_0x0208('0x6c')]['toLowerCase']()==='set'){_0x272d8a[_0x0208('0x6d')]=(_0x272d8a[_0x0208('0x6e')]||_0x272d8a['applicationdata'])['toLowerCase']();if(_[_0x0208('0x6f')](_0x272d8a[_0x0208('0x6d')],_0x0208('0x70'))){if(_['isUndefined'](this['applications'][_0x272d8a[_0x0208('0x1c')]]))this['applications'][_0x272d8a[_0x0208('0x1c')]]={};logger[_0x0208('0x32')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x272d8a[_0x0208('0x1c')],_0x272d8a[_0x0208('0x6c')],_0x272d8a[_0x0208('0x6d')]);var _0x3b2617=_0x272d8a[_0x0208('0x6d')][_0x0208('0x71')]('=');var _0x4d3e40=_0x3b2617[0x0][_0x0208('0x72')](/cdr\((.*)\)/);if(_0x4d3e40)this[_0x0208('0xc')][_0x272d8a[_0x0208('0x1c')]][_0x4d3e40[0x1]]=_0x3b2617[0x1];}}}}catch(_0x5c9086){logger['error'](_0x0208('0x73'),_0x272d8a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x5c9086,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x74')]=function(_0xc85d0b,_0x5a6fd6=0x2710){if(this[_0x0208('0xa')][_0xc85d0b]){setTimeout(()=>{delete this[_0x0208('0xa')][_0xc85d0b];},_0x5a6fd6);}};module[_0x0208('0x75')]=VoiceDialReport; \ No newline at end of file +var _0xb871=['dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','format','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','uniqueid','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answertime','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xb871,0x6b));var _0x1b87=function(_0x280604,_0x528d29){_0x280604=_0x280604-0x0;var _0x1f659b=_0xb871[_0x280604];return _0x1f659b;};'use strict';var _=require('lodash');var moment=require(_0x1b87('0x0'));var util=require(_0x1b87('0x1'));var Redis=require(_0x1b87('0x2'));var config=require(_0x1b87('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x1b87('0x4'));config[_0x1b87('0x5')]=_[_0x1b87('0x6')](config[_0x1b87('0x5')],{'host':_0x1b87('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x26178d){this[_0x1b87('0x8')]=_0x26178d[_0x1b87('0x9')];this[_0x1b87('0xa')]=_0x26178d[_0x1b87('0xa')];this[_0x1b87('0xb')]={};this[_0x1b87('0xc')]={};ami['on'](_0x1b87('0xd'),this[_0x1b87('0xe')][_0x1b87('0xf')](this));ami['on'](_0x1b87('0x10'),this[_0x1b87('0x11')][_0x1b87('0xf')](this));ami['on'](_0x1b87('0x12'),this[_0x1b87('0x13')][_0x1b87('0xf')](this));ami['on'](_0x1b87('0x14'),this[_0x1b87('0x15')]['bind'](this));}VoiceDialReport[_0x1b87('0x16')]['isNotNull']=function(_0x50993c){return _0x50993c!==null&&!_[_0x1b87('0x17')](_0x50993c);};VoiceDialReport[_0x1b87('0x16')][_0x1b87('0x18')]=function(_0x519833,_0x27a538,_0x5eb657){io['to'](_0x519833)[_0x1b87('0x18')](_0x27a538,_0x5eb657);};VoiceDialReport[_0x1b87('0x16')][_0x1b87('0xe')]=function(_0xd0d763){try{if(this[_0x1b87('0x19')](_0xd0d763)){logger[_0x1b87('0x1a')](_0x1b87('0x1b'),_0xd0d763['uniqueid'],util[_0x1b87('0x1c')](_0xd0d763,{'showHidden':![],'depth':null}));if(this['channels'][_0xd0d763['uniqueid']]){_[_0x1b87('0x1d')](this['channels'][_0xd0d763['uniqueid']],{'starttime':moment()[_0x1b87('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0xd0d763[_0x1b87('0x1f')][_0x1b87('0x20')](0x0,_0xd0d763[_0x1b87('0x1f')][_0x1b87('0x21')]('-')),'membername':_0xd0d763[_0x1b87('0x1f')][_0x1b87('0x20')](_0xd0d763[_0x1b87('0x1f')][_0x1b87('0x21')]('/')+0x1,_0xd0d763[_0x1b87('0x1f')][_0x1b87('0x21')]('-'))},_[_0x1b87('0x22')](_0xd0d763,[_0x1b87('0x23'),_0x1b87('0x24')]));logger[_0x1b87('0x25')](_0x1b87('0x26'),_0xd0d763['uniqueid'],this['channels'][_0xd0d763[_0x1b87('0x27')]][_0x1b87('0x28')],this[_0x1b87('0x8')][_0xd0d763[_0x1b87('0x27')]][_0x1b87('0x29')]);logger[_0x1b87('0x1a')](_0x1b87('0x2a'),_0xd0d763[_0x1b87('0x27')],util['inspect'](this[_0x1b87('0x8')][_0xd0d763[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));if(this[_0x1b87('0xb')][_0xd0d763[_0x1b87('0x27')]])_['merge'](this[_0x1b87('0x8')][_0xd0d763[_0x1b87('0x27')]],this[_0x1b87('0xb')][_0xd0d763['uniqueid']]);this[_0x1b87('0x18')](_0x1b87('0x2b'),_0x1b87('0x2c'),this[_0x1b87('0x8')][_0xd0d763[_0x1b87('0x27')]]);logger[_0x1b87('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0xd0d763[_0x1b87('0x27')],util[_0x1b87('0x1c')](this['channels'][_0xd0d763[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));ami[_0x1b87('0x18')](_0x1b87('0x2d'),this[_0x1b87('0x8')][_0xd0d763[_0x1b87('0x27')]]);}}}catch(_0x2fb7b3){logger[_0x1b87('0x2e')](_0x1b87('0x2f'),_0xd0d763['uniqueid'],util[_0x1b87('0x1c')](_0x2fb7b3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1b87('0x11')]=function(_0x5880e5){try{if(this[_0x1b87('0x19')](_0x5880e5)){logger[_0x1b87('0x1a')]('[%s][voiceDialReport][dialend]\x20event:',_0x5880e5['uniqueid'],util[_0x1b87('0x1c')](_0x5880e5,{'showHidden':![],'depth':null}));if(this[_0x1b87('0x8')][_0x5880e5[_0x1b87('0x27')]]){this['channels'][_0x5880e5['uniqueid']][_0x1b87('0x30')]=_0x5880e5[_0x1b87('0x30')];if(_0x5880e5[_0x1b87('0x30')]===_0x1b87('0x31')){this[_0x1b87('0x8')][_0x5880e5['uniqueid']][_0x1b87('0x32')]=_0x5880e5[_0x1b87('0x32')];this['channels'][_0x5880e5[_0x1b87('0x27')]][_0x1b87('0x33')]=_0x5880e5['connectedlinename'];this[_0x1b87('0x8')][_0x5880e5['uniqueid']]['answertime']=moment()[_0x1b87('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1b87('0x8')][_0x5880e5[_0x1b87('0x27')]][_0x1b87('0x34')]='connect';logger[_0x1b87('0x25')](_0x1b87('0x35'),_0x5880e5[_0x1b87('0x27')],_0x5880e5['channel'][_0x1b87('0x20')](_0x5880e5[_0x1b87('0x1f')][_0x1b87('0x21')]('/')+0x1,_0x5880e5[_0x1b87('0x1f')]['lastIndexOf']('-')));logger[_0x1b87('0x1a')](_0x1b87('0x36'),_0x5880e5['uniqueid'],util[_0x1b87('0x1c')](this[_0x1b87('0x8')][_0x5880e5[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1b87('0x37'),this[_0x1b87('0x8')][_0x5880e5['uniqueid']]);}logger[_0x1b87('0x1a')](_0x1b87('0x38'),_0x5880e5['uniqueid'],util[_0x1b87('0x1c')](this['channels'][_0x5880e5[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));this[_0x1b87('0x18')](_0x1b87('0x2b'),'voice_outbound_channel:save',this[_0x1b87('0x8')][_0x5880e5['uniqueid']]);}}}catch(_0x55ea6e){logger['error']('[%s][voiceDialReport][dialend]',_0x5880e5['uniqueid'],util[_0x1b87('0x1c')](_0x55ea6e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1b87('0x16')]['syncVarSet']=function(_0x19795b){try{if(this['isNotNull'](_0x19795b)){logger[_0x1b87('0x1a')](_0x1b87('0x39'),_0x19795b['uniqueid'],util[_0x1b87('0x1c')](_0x19795b,{'showHidden':![],'depth':null}));this[_0x1b87('0x3a')](_0x19795b[_0x1b87('0x27')],_[_0x1b87('0x3b')](_0x19795b[_0x1b87('0x3c')])[0x0],_0x19795b[_0x1b87('0x3d')]);if(this[_0x1b87('0x19')](_0x19795b[_0x1b87('0x3c')])&&this[_0x1b87('0x19')](_0x19795b['variable'][_0x1b87('0x3e')])){if(_['isUndefined'](this[_0x1b87('0x8')][_0x19795b[_0x1b87('0x27')]])){this['channels'][_0x19795b[_0x1b87('0x27')]]={'routeId':_0x19795b[_0x1b87('0x3d')],'variables':this[_0x1b87('0xc')][_0x19795b[_0x1b87('0x27')]],'motionChannel':_0x1b87('0x3f')};logger[_0x1b87('0x25')](_0x1b87('0x40'),_0x19795b[_0x1b87('0x27')],_0x19795b[_0x1b87('0x3c')]['outboundrouteid'],_[_0x1b87('0x3b')](_0x19795b['variable'])[0x0],_0x19795b[_0x1b87('0x3d')]);logger['debug'](_0x1b87('0x41'),_0x19795b['uniqueid'],util['inspect'](this[_0x1b87('0x8')][_0x19795b['uniqueid']],{'showHidden':![],'depth':null}));this[_0x1b87('0x18')](_0x1b87('0x2b'),_0x1b87('0x2c'),this[_0x1b87('0x8')][_0x19795b[_0x1b87('0x27')]]);}}}}catch(_0x35786c){logger[_0x1b87('0x2e')](_0x1b87('0x42'),_0x19795b[_0x1b87('0x27')],util[_0x1b87('0x1c')](_0x35786c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1b87('0x16')][_0x1b87('0x3a')]=function(_0x4c0672,_0x4c9a71,_0x584d19){var _0x151e76=[_0x1b87('0x43'),'rtpaudioqosbridged',_0x1b87('0x44'),_0x1b87('0x45'),_0x1b87('0x46'),_0x1b87('0x47'),_0x1b87('0x48'),'rtpaudioqosrttbridged',_0x1b87('0x49'),_0x1b87('0x4a'),'bridgepeer',_0x1b87('0x4b'),_0x1b87('0x4c'),_0x1b87('0x4d'),_0x1b87('0x4e'),_0x1b87('0x4f'),_0x1b87('0x28'),_0x1b87('0x50'),'memberrealtime'];if(!_['isNil'](_0x4c9a71)&&!_[_0x1b87('0x51')](_0x151e76,_0x4c9a71)){if(_[_0x1b87('0x17')](this[_0x1b87('0xc')][_0x4c0672])){this[_0x1b87('0xc')][_0x4c0672]={};}this[_0x1b87('0xc')][_0x4c0672][_0x4c9a71]=_0x584d19;}};VoiceDialReport[_0x1b87('0x16')]['syncHangup']=function(_0x39d9ff){try{if(this[_0x1b87('0x19')](_0x39d9ff)){logger[_0x1b87('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x39d9ff[_0x1b87('0x27')],util[_0x1b87('0x1c')](_0x39d9ff,{'showHidden':![],'depth':null}));if(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]]){logger['info'](_0x1b87('0x52'),_0x39d9ff['uniqueid'],_0x39d9ff[_0x1b87('0x53')]);this[_0x1b87('0x8')][_0x39d9ff['uniqueid']][_0x1b87('0x54')]=moment()[_0x1b87('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x55')]=moment(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x54')])[_0x1b87('0x56')](this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x57')],_0x1b87('0x58'));this['channels'][_0x39d9ff['uniqueid']][_0x1b87('0x34')]=_0x1b87('0x59');this['outbound'][_0x1b87('0x5a')]+=0x1;if(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x5b')]){this[_0x1b87('0xa')]['answered']+=0x1;this[_0x1b87('0x8')][_0x39d9ff['uniqueid']][_0x1b87('0x5c')]=moment(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x5b')])['diff'](this['channels'][_0x39d9ff[_0x1b87('0x27')]]['starttime'],'seconds');this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x5d')]=moment(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x54')])[_0x1b87('0x56')](this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x5b')],_0x1b87('0x58'));this[_0x1b87('0xa')][_0x1b87('0x5e')]+=this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x5c')]||0x0;this['outbound'][_0x1b87('0x5f')]+=this['channels'][_0x39d9ff['uniqueid']]['billableseconds'];}this['outbound'][_0x1b87('0x60')]+=this['channels'][_0x39d9ff[_0x1b87('0x27')]][_0x1b87('0x55')];logger[_0x1b87('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x39d9ff['uniqueid'],util[_0x1b87('0x1c')](this['channels'][_0x39d9ff[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));ami[_0x1b87('0x18')](_0x1b87('0x61'),this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]]);logger[_0x1b87('0x1a')](_0x1b87('0x62'),_0x39d9ff[_0x1b87('0x27')],util['inspect'](this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1b87('0x63'),this['channels'][_0x39d9ff[_0x1b87('0x27')]]);logger[_0x1b87('0x1a')](_0x1b87('0x64'),_0x39d9ff[_0x1b87('0x27')],util[_0x1b87('0x1c')](this['channels'][_0x39d9ff[_0x1b87('0x27')]],{'showHidden':![],'depth':null}));this[_0x1b87('0x18')]('voice:outbound',_0x1b87('0x65'),this['outbound']);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x1b87('0x8')][_0x39d9ff['uniqueid']]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x39d9ff[_0x1b87('0x27')],util[_0x1b87('0x1c')](this[_0x1b87('0x8')][_0x39d9ff['uniqueid']],{'showHidden':![],'depth':null}));this[_0x1b87('0x18')]('voice:outbound',_0x1b87('0x66'),this[_0x1b87('0x8')][_0x39d9ff['uniqueid']]);this[_0x1b87('0x67')](_0x39d9ff['uniqueid']);}else if(this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x68')]]){this[_0x1b87('0x8')][_0x39d9ff['linkedid']][_0x1b87('0x27')]=this[_0x1b87('0x8')][_0x39d9ff[_0x1b87('0x68')]][_0x1b87('0x69')];}if(this['variables'][_0x39d9ff[_0x1b87('0x27')]]){delete this[_0x1b87('0xc')][_0x39d9ff[_0x1b87('0x27')]];}}}catch(_0x11fdc6){logger['error'](_0x1b87('0x6a'),_0x39d9ff[_0x1b87('0x27')],util[_0x1b87('0x1c')](_0x11fdc6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1b87('0x16')]['syncNewExten']=function(_0x461026){try{if(this['isNotNull'](_0x461026)){logger[_0x1b87('0x1a')](_0x1b87('0x6b'),_0x461026[_0x1b87('0x27')],util[_0x1b87('0x1c')](_0x461026,{'showHidden':![],'depth':null}));if(_0x461026[_0x1b87('0x6c')][_0x1b87('0x6d')]()===_0x1b87('0x6e')){_0x461026['applicationdata']=(_0x461026[_0x1b87('0x6f')]||_0x461026['applicationdata'])[_0x1b87('0x6d')]();if(_[_0x1b87('0x70')](_0x461026['applicationdata'],_0x1b87('0x71'))){if(_[_0x1b87('0x17')](this[_0x1b87('0xb')][_0x461026[_0x1b87('0x27')]]))this[_0x1b87('0xb')][_0x461026[_0x1b87('0x27')]]={};logger[_0x1b87('0x25')](_0x1b87('0x72'),_0x461026['uniqueid'],_0x461026[_0x1b87('0x6c')],_0x461026['applicationdata']);var _0x4a77e7=_0x461026[_0x1b87('0x73')][_0x1b87('0x74')]('=');var _0x538805=_0x4a77e7[0x0][_0x1b87('0x75')](/cdr\((.*)\)/);if(_0x538805)this[_0x1b87('0xb')][_0x461026[_0x1b87('0x27')]][_0x538805[0x1]]=_0x4a77e7[0x1];}}}}catch(_0x85e949){logger[_0x1b87('0x2e')](_0x1b87('0x76'),_0x461026[_0x1b87('0x27')],util['inspect'](_0x85e949,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1b87('0x67')]=function(_0x2e6894,_0xe9148e=0x2710){if(this['channels'][_0x2e6894]){setTimeout(()=>{delete this[_0x1b87('0x8')][_0x2e6894];},_0xe9148e);}};module[_0x1b87('0x77')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 6cb0709..f9547c1 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1d8=['queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queuecallerleaveAt','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','handleHangup','length','diff','total','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','assign','custom:voiceQueueReport','deleteChannelAfterTimeout','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','ioredis','../../../config/environment','ami','../ami','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','queuecallerabandon','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','format','voice:queue:%s','queue','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','isRunning','then','summary','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','handleInboundQueueSummaryReport','compareToInboundQueue','type','outbound','custom:queuesummary','statusRequests','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexit'];(function(_0x68da0b,_0x470a6a){var _0x2671a4=function(_0x5975f1){while(--_0x5975f1){_0x68da0b['push'](_0x68da0b['shift']());}};_0x2671a4(++_0x470a6a);}(_0xe1d8,0x71));var _0x8e1d=function(_0x438e21,_0x340aad){_0x438e21=_0x438e21-0x0;var _0xd8845d=_0xe1d8[_0x438e21];return _0xd8845d;};'use strict';var _=require(_0x8e1d('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x8e1d('0x1'));var config=require(_0x8e1d('0x2'));var logger=require('../../../config/logger')(_0x8e1d('0x3'));var ami=require(_0x8e1d('0x4'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x8e1d('0x5'));config[_0x8e1d('0x6')]=_[_0x8e1d('0x7')](config[_0x8e1d('0x6')],{'host':_0x8e1d('0x8'),'port':0x18eb});var io=require(_0x8e1d('0x9'))(new Redis(config[_0x8e1d('0x6')]));var Sequence=function(){};Sequence[_0x8e1d('0xa')][_0x8e1d('0xb')]=function(_0x8ecd04){this['tail']=this[_0x8e1d('0xc')]?this[_0x8e1d('0xc')][_0x8e1d('0xd')](_0x8ecd04):_0x8ecd04();};function VoiceQueueReport(_0x5d24c2){this[_0x8e1d('0xe')]=new Sequence();this[_0x8e1d('0xf')]={};this[_0x8e1d('0x10')]=_0x5d24c2;this[_0x8e1d('0x11')]=_0x5d24c2[_0x8e1d('0x11')];this['channels']=_0x5d24c2[_0x8e1d('0x12')];this[_0x8e1d('0x13')]=_0x5d24c2[_0x8e1d('0x13')];this['campaigns']=_0x5d24c2[_0x8e1d('0x14')];this['summary']=initializeSummary();this[_0x8e1d('0x15')]={};ami['on']('queuesummary',this[_0x8e1d('0x16')][_0x8e1d('0x17')](this));ami['on']('queuesummarycomplete',this[_0x8e1d('0x18')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x19'),this[_0x8e1d('0x1a')][_0x8e1d('0x17')](this));ami['on']('queuestatuscomplete',this[_0x8e1d('0x1b')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x1c'),this[_0x8e1d('0x1d')][_0x8e1d('0x17')](this));ami['on']('queuecallerabandon',this[_0x8e1d('0x1e')][_0x8e1d('0x17')](this));ami['on']('queuecallerleave',this[_0x8e1d('0x1f')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x20'),this[_0x8e1d('0x21')]['bind'](this));ami['on'](_0x8e1d('0x22'),this[_0x8e1d('0x23')][_0x8e1d('0x17')](this));ami['on']('varset',this[_0x8e1d('0x24')]['bind'](this));ami['on'](_0x8e1d('0x25'),this['syncHangup']['bind'](this));ami['on'](_0x8e1d('0x26'),this[_0x8e1d('0x27')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x28'),this[_0x8e1d('0x29')][_0x8e1d('0x17')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x2a'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0x8e1d('0x2b')]();this[_0x8e1d('0x2c')]();}function clearChannels(_0x1947c0){if(!_[_0x8e1d('0x2d')](_0x1947c0)){for(var _0x1e6833 in _0x1947c0){if(_0x1947c0[_0x8e1d('0x2e')](_0x1e6833)){delete _0x1947c0[_0x1e6833];}}}}function clearCampaigns(_0x313e6b){if(!_['isEmpty'](_0x313e6b)){for(var _0x56a984 in _0x313e6b){if(_0x313e6b[_0x8e1d('0x2e')](_0x56a984)){_0x313e6b[_0x56a984][_0x8e1d('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x5918f0){if(!_['isEmpty'](_0x5918f0)){for(var _0x522beb in _0x5918f0){if(_0x5918f0[_0x8e1d('0x2e')](_0x522beb)){_0x5918f0[_0x522beb][_0x8e1d('0x2f')]=0x0;_0x5918f0[_0x522beb]['talking']=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x30')]=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x31')]=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x32')]=!![];}}}}function clearAgentBooked(_0x4e8f24){if(!_[_0x8e1d('0x2d')](_0x4e8f24)){for(var _0x16d585 in _0x4e8f24){if(_0x4e8f24[_0x8e1d('0x2e')](_0x16d585)){_0x4e8f24[_0x16d585]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x26d391){return _0x26d391['queuecallerexit']||_0x26d391[_0x8e1d('0x33')]||_0x26d391[_0x8e1d('0x34')];}VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x35')]=function(){var _0xff1299=this;for(var _0x4b93f1 in this[_0x8e1d('0x36')]){if(this[_0x8e1d('0x36')][_0x8e1d('0x2e')](_0x4b93f1)&&!this[_0x8e1d('0x36')][_0x4b93f1][_0x8e1d('0x37')]){this['sequence']['enqueue'](function(){if(!_[_0x8e1d('0x38')](_0xff1299[_0x8e1d('0x36')][_0x4b93f1])){return ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x3a'),'channel':_0xff1299[_0x8e1d('0x36')][_0x4b93f1][_0x8e1d('0x3b')]})[_0x8e1d('0x3c')](function(_0x4c3f8a){if(_0x4c3f8a[_0x8e1d('0x3d')]===_0x8e1d('0x3e')){setTimeout(function(){if(_0xff1299[_0x8e1d('0x36')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0x36')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x40'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}if(_0xff1299[_0x8e1d('0xf')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0xf')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x42'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}if(_0xff1299[_0x8e1d('0x15')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0x15')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x43'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8e1d('0xa')]['syncFullyBooted']=function(){logger[_0x8e1d('0x3f')](_0x8e1d('0x44'));clearChannels(this['channels']);this[_0x8e1d('0x45')](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x8e1d('0x13')]);clearCampaigns(this[_0x8e1d('0x14')]);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0x8e1d('0x45')]=function(_0x27c946){var _0x4f58c2=this;if(!_[_0x8e1d('0x2d')](_0x27c946)){for(var _0x383ae3 in _0x27c946){if(_0x27c946[_0x8e1d('0x2e')](_0x383ae3)){_0x4f58c2[_0x8e1d('0x46')](_0x27c946[_0x383ae3],_0x8e1d('0x47'));delete _0x27c946[_0x383ae3];}}}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x48')]=function(_0xd8db3c,_0x4323f6,_0x495e4e){io['to'](_0xd8db3c)[_0x8e1d('0x48')](_0x4323f6,_0x495e4e);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x4e1c2a,_0x4d0106){logger['debug']('[%s][voiceQueueReport]['+_0x4d0106+']\x20sending\x20voice_queue_channel:save\x20event:',_0x4e1c2a['uniqueid'],util['inspect'](_0x4e1c2a,{'showHidden':![],'depth':null}));this[_0x8e1d('0x48')](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x4e1c2a[_0x8e1d('0x4b')]),'voice_queue_channel:save',_0x4e1c2a);io[_0x8e1d('0x48')](_0x8e1d('0x4c'),_0x4e1c2a);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x46')]=function(_0x583931,_0x392786){logger[_0x8e1d('0x4d')]('[%s][voiceQueueReport]['+_0x392786+_0x8e1d('0x4e'),_0x583931[_0x8e1d('0x4f')],util['inspect'](_0x583931,{'showHidden':![],'depth':null}));if(_0x583931[_0x8e1d('0x50')]===_0x8e1d('0x51')){return;}this[_0x8e1d('0x48')](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x583931[_0x8e1d('0x4b')]),_0x8e1d('0x52'),_0x583931);io[_0x8e1d('0x48')]('voice_queue_presence:remove',_0x583931);};VoiceQueueReport['prototype'][_0x8e1d('0x53')]=function(_0x431c5a){if(_0x431c5a['type']===_0x8e1d('0x54')){logger[_0x8e1d('0x4d')](_0x8e1d('0x55'),util[_0x8e1d('0x41')](_0x431c5a,{'showHidden':![],'depth':null}));this['emit'](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x431c5a[_0x8e1d('0x56')]),_0x8e1d('0x57'),_0x431c5a);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x58')]=function(_0x46a373){return _0x46a373!==null&&!_[_0x8e1d('0x59')](_0x46a373);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x2c')]=function(){var _0x323d81=this;setInterval(function(){_0x323d81['clearZombieChannels']();ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x5a')})[_0x8e1d('0x3c')](function(_0x1580c9){logger[_0x8e1d('0x3f')]('[voiceQueueReport][queues]',util[_0x8e1d('0x41')](_0x1580c9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8e1d('0xa')]['loopQueueSummary']=function(){var _0x91b4a=this;setInterval(function(){if(!_0x91b4a['summary'][_0x8e1d('0x5b')]){return ami[_0x8e1d('0x39')]({'action':'queuesummary'})[_0x8e1d('0x5c')](function(_0x2cb955){_0x91b4a[_0x8e1d('0x5d')]['id']=_0x2cb955[_0x8e1d('0x5e')];_0x91b4a[_0x8e1d('0x5d')]['isRunning']=!![];_0x91b4a[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x2cb955[_0x8e1d('0x5e')]]={};})['catch'](function(_0x170478){logger[_0x8e1d('0x3f')](_0x8e1d('0x60'),util[_0x8e1d('0x41')](_0x170478,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x61')]=function(_0x2177de,_0x5ea955){var _0x3de98c;if(this[_0x8e1d('0x5d')]&&this[_0x8e1d('0x5d')][_0x8e1d('0x5a')]&&this[_0x8e1d('0x5d')][_0x8e1d('0x5a')][_0x2177de[_0x8e1d('0x56')]]){_0x3de98c=this[_0x8e1d('0x5d')]['queues'][_0x2177de[_0x8e1d('0x56')]][_0x8e1d('0x62')];}var _0x197e86=new VoiceQueueSummary(_0x2177de);return _0x197e86['createReport'](_0x5ea955[_0x8e1d('0x11')],this[_0x8e1d('0x11')],_0x3de98c,this[_0x8e1d('0x10')][_0x8e1d('0x36')]);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x63')]=function(_0xa5d1f2,_0x2149cc){var _0x34f00b=this[_0x8e1d('0x61')](_0xa5d1f2,_0x2149cc);var _0x4b46db=![];_0x4b46db=_0x34f00b[_0x8e1d('0x64')](_0xa5d1f2);if(_0x4b46db){Object['assign'](_0xa5d1f2,_0x34f00b);this[_0x8e1d('0x10')][_0x8e1d('0x13')][_0xa5d1f2[_0x8e1d('0x56')]]=_0xa5d1f2;this['emitInboundVoiceQueueSummary'](_0x34f00b);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1b')]=function(_0xf66e8e){var _0x447dc1=null;var _0x2d89a0=this[_0x8e1d('0x5d')]['id'];if(this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x2d89a0]){_0x447dc1=this['summary']['queuestatus'][_0x2d89a0][_0xf66e8e[_0x8e1d('0x5e')]];}if(!_0x447dc1){this['summary']=initializeSummary();return;}var _0xd41517=this[_0x8e1d('0x13')][_0x447dc1[_0x8e1d('0x4b')]];if(_0xd41517[_0x8e1d('0x65')]===_0x8e1d('0x54')){this['handleInboundQueueSummaryReport'](_0xd41517,_0x447dc1);}else if(_0xd41517[_0x8e1d('0x65')]===_0x8e1d('0x66')){var _0x39c0a7=this[_0x8e1d('0x61')](_0xd41517,_0x447dc1);ami[_0x8e1d('0x48')](_0x8e1d('0x67'),_0x39c0a7);}this[_0x8e1d('0x5d')][_0x8e1d('0x68')]-=0x1;var _0x1f8511=this[_0x8e1d('0x5d')]['statusRequests']>0x0?!![]:![];if(!_0x1f8511){return this[_0x8e1d('0x18')](this[_0x8e1d('0x5d')]['completeEvent']);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1a')]=function(_0x483941){var _0xd9c01a=this['summary']['id'];if(this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0xd9c01a]&&this[_0x8e1d('0x5d')]['queuestatus'][_0xd9c01a][_0x483941[_0x8e1d('0x5e')]]){this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0xd9c01a][_0x483941[_0x8e1d('0x5e')]][_0x8e1d('0x11')]['push'](_0x483941);}};VoiceQueueReport[_0x8e1d('0xa')]['syncQueueSummary']=function(_0x6e8c1a){var _0x12be76=this;try{if(this[_0x8e1d('0x58')](_0x6e8c1a)&&this[_0x8e1d('0x58')](_0x6e8c1a['queue'])){logger['debug'](_0x8e1d('0x69'),util[_0x8e1d('0x41')](_0x6e8c1a,{'showHidden':![],'depth':null}));var _0x28f04b=this[_0x8e1d('0x13')][_0x6e8c1a[_0x8e1d('0x4b')]];if(_0x28f04b){logger['debug'](_0x8e1d('0x6a'),_0x28f04b[_0x8e1d('0x56')]);this[_0x8e1d('0x5d')][_0x8e1d('0x5a')][_0x28f04b['name']]={'summaryEvent':_0x6e8c1a};this[_0x8e1d('0x5d')][_0x8e1d('0x68')]+=0x1;return ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x5f'),'queue':_0x28f04b[_0x8e1d('0x56')]})['then'](function(_0x4323aa){if(!_0x12be76[_0x8e1d('0x5d')]['queuestatus'][_0x6e8c1a[_0x8e1d('0x5e')]]){_0x12be76[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x6e8c1a[_0x8e1d('0x5e')]]={};}_0x12be76[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x6e8c1a[_0x8e1d('0x5e')]][_0x4323aa[_0x8e1d('0x5e')]]={'queue':_0x28f04b[_0x8e1d('0x56')],'agents':[]};})[_0x8e1d('0x3c')](function(_0x4039b7){throw _0x4039b7;});}}}catch(_0x5dcf20){logger[_0x8e1d('0x3f')](_0x8e1d('0x60'),util[_0x8e1d('0x41')](_0x5dcf20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x18')]=function(_0x4b88db){if(this['summary'][_0x8e1d('0x68')]>0x0){this[_0x8e1d('0x5d')]['completeEvent']=_0x4b88db;return;}logger[_0x8e1d('0x4d')](_0x8e1d('0x6b'),util[_0x8e1d('0x41')](_0x4b88db,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0x8e1d('0x6c'),{});};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1d')]=function(_0x2a2a7b){try{if(this['isNotNull'](_0x2a2a7b)){logger[_0x8e1d('0x4d')](_0x8e1d('0x6d'),_0x2a2a7b['uniqueid'],util[_0x8e1d('0x41')](_0x2a2a7b,{'showHidden':![],'depth':null}));if(_[_0x8e1d('0x59')](this[_0x8e1d('0xf')][_0x2a2a7b['uniqueid']])){this[_0x8e1d('0xf')][_0x2a2a7b[_0x8e1d('0x4f')]]=[];}if(_[_0x8e1d('0x59')](this['channels'][_0x2a2a7b[_0x8e1d('0x4f')]])){this[_0x8e1d('0x36')][_0x2a2a7b['uniqueid']]={};}var _0x3f4e75=new QueueReport();_0x3f4e75['queue']=_0x2a2a7b['queue'];_0x3f4e75[_0x8e1d('0x65')]=this[_0x8e1d('0x13')][_0x3f4e75[_0x8e1d('0x4b')]]&&this['voiceQueues'][_0x3f4e75[_0x8e1d('0x4b')]]['type']?this[_0x8e1d('0x13')][_0x3f4e75[_0x8e1d('0x4b')]][_0x8e1d('0x65')]||'inbound':_0x8e1d('0x54');_0x3f4e75[_0x8e1d('0x6e')]=moment()['format'](_0x8e1d('0x6f'));_0x3f4e75[_0x8e1d('0x70')]=_0x2a2a7b['position'];_0x3f4e75[_0x8e1d('0x71')]=_0x2a2a7b[_0x8e1d('0x71')];_0x3f4e75['uniqueid']=_0x2a2a7b[_0x8e1d('0x4f')];logger[_0x8e1d('0x72')](_0x8e1d('0x73'),_0x3f4e75[_0x8e1d('0x4b')],_0x3f4e75[_0x8e1d('0x65')]);Object['assign'](_0x3f4e75,_['pick'](_0x2a2a7b,_['keys'](_0x3f4e75)));this[_0x8e1d('0xf')][_0x2a2a7b[_0x8e1d('0x4f')]][_0x8e1d('0x74')](_0x3f4e75);this['channels'][_0x2a2a7b['uniqueid']]=_0x3f4e75;this[_0x8e1d('0x75')](_0x3f4e75,_0x8e1d('0x1c'));}}catch(_0x187f7c){logger[_0x8e1d('0x3f')](_0x8e1d('0x6d'),_0x2a2a7b[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x187f7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1e')]=function(_0x31b790){try{if(this[_0x8e1d('0x58')](_0x31b790)){logger[_0x8e1d('0x4d')](_0x8e1d('0x76'),_0x31b790[_0x8e1d('0x4f')],util['inspect'](_0x31b790,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0x31b790[_0x8e1d('0x4f')]]){var _0x333075=_[_0x8e1d('0x77')](this['queueReports'][_0x31b790[_0x8e1d('0x4f')]]);_0x333075[_0x8e1d('0x34')]=![];_0x333075[_0x8e1d('0x78')]=null;_0x333075[_0x8e1d('0x79')]=_0x31b790[_0x8e1d('0x79')];_0x333075[_0x8e1d('0x7a')]=_0x31b790[_0x8e1d('0x7a')];_0x333075['queuecallerabandon']=!![];_0x333075[_0x8e1d('0x7b')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x333075[_0x8e1d('0x50')]=_0x8e1d('0x7c');_0x333075['lastAssignedTo']=null;logger['info'](_0x8e1d('0x7d'),_0x333075[_0x8e1d('0x4b')],_0x333075[_0x8e1d('0x65')]);this[_0x8e1d('0x36')][_0x31b790[_0x8e1d('0x4f')]]=_0x333075;this[_0x8e1d('0x46')](_0x333075,_0x8e1d('0x33'));}}}catch(_0x9a7e49){logger[_0x8e1d('0x3f')](_0x8e1d('0x76'),_0x31b790[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x9a7e49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1f')]=function(_0xc06701){try{if(this['isNotNull'](_0xc06701)){logger['debug'](_0x8e1d('0x7e'),_0xc06701[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xc06701,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0xc06701[_0x8e1d('0x4f')]]){var _0x32ab27=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xc06701['uniqueid']]);_0x32ab27['queuecallerleaveAt']=moment()[_0x8e1d('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x32ab27[_0x8e1d('0x7f')]=_0xc06701[_0x8e1d('0x7f')];_0x32ab27[_0x8e1d('0x80')]=_0xc06701[_0x8e1d('0x80')];logger[_0x8e1d('0x72')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x32ab27['queue'],_0x32ab27[_0x8e1d('0x65')],_0xc06701[_0x8e1d('0x7f')],_0xc06701['connectedlinename']);this[_0x8e1d('0x36')][_0xc06701[_0x8e1d('0x4f')]]=_0x32ab27;this[_0x8e1d('0x75')](_0x32ab27,_0x8e1d('0x81'));}}}catch(_0x38822b){logger[_0x8e1d('0x3f')](_0x8e1d('0x7e'),_0xc06701['uniqueid'],util[_0x8e1d('0x41')](_0x38822b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')]['syncAgentConnect']=function(_0x447a31){try{if(this['isNotNull'](_0x447a31)){logger[_0x8e1d('0x4d')](_0x8e1d('0x82'),_0x447a31[_0x8e1d('0x4f')],util['inspect'](_0x447a31,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0x447a31[_0x8e1d('0x4f')]]){var _0xf58193=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0x447a31[_0x8e1d('0x4f')]]);_0xf58193[_0x8e1d('0x34')]=!![];_0xf58193[_0x8e1d('0x50')]=_0x8e1d('0x83');logger[_0x8e1d('0x72')](_0x8e1d('0x84'),_0xf58193['queue'],_0xf58193[_0x8e1d('0x65')]);}}}catch(_0xc11ed0){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x447a31[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xc11ed0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x21')]=function(_0xfb528a){try{if(this[_0x8e1d('0x58')](_0xfb528a)){logger[_0x8e1d('0x4d')](_0x8e1d('0x85'),_0xfb528a[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xfb528a,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0xfb528a['uniqueid']]){var _0x1efa04=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]]);_0x1efa04[_0x8e1d('0x33')]=![];_0x1efa04[_0x8e1d('0x7b')]=null;_0x1efa04[_0x8e1d('0x86')]=!![];_0x1efa04['lastAssignedTo']=_0xfb528a['membername'];_0x1efa04[_0x8e1d('0x79')]=_0xfb528a[_0x8e1d('0x79')];_0x1efa04[_0x8e1d('0x34')]=!![];_0x1efa04[_0x8e1d('0x87')]=![];_0x1efa04[_0x8e1d('0x88')]=null;if(!_0x1efa04[_0x8e1d('0x89')]){if(_0xfb528a[_0x8e1d('0x8a')]==_0x8e1d('0x89')){_0x1efa04[_0x8e1d('0x50')]=_0x8e1d('0x8b');logger[_0x8e1d('0x72')](_0x8e1d('0x8c'),_0x1efa04[_0x8e1d('0x4b')],_0x1efa04['type']);}else{if(_[_0x8e1d('0x8d')](_0xfb528a[_0x8e1d('0x3b')]['toLowerCase'](),_0x8e1d('0x8e'))){if(this['queueReports'][_0xfb528a[_0x8e1d('0x8f')]]){var _0x25059d=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xfb528a['linkedid']]);_0x25059d[_0x8e1d('0x34')]=![];_0x25059d[_0x8e1d('0x87')]=!![];_0x25059d['queuecallerexitAt']=moment(_0x1efa04[_0x8e1d('0x6e')])['add'](_0xfb528a[_0x8e1d('0x79')],_0x8e1d('0x90'))[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x25059d['queuecallerexitreason']=_0x8e1d('0x91');_0x25059d[_0x8e1d('0x89')]=!![];_0x25059d[_0x8e1d('0x92')]=_0x8e1d('0x93');_0x25059d[_0x8e1d('0x94')]=_0xfb528a['destexten'];_0x25059d[_0x8e1d('0x95')]=_0xfb528a[_0x8e1d('0x4f')];logger['info'](_0x8e1d('0x96'),_0x25059d['queue'],_0x25059d[_0x8e1d('0x65')]);var _0x4762cd=this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x8f')]];this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x8f')]]=this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]];this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]]=_0x4762cd;}}else{_0x1efa04[_0x8e1d('0x50')]='COMPLETEDBY'+_0xfb528a[_0x8e1d('0x8a')][_0x8e1d('0x97')]();logger[_0x8e1d('0x72')](_0x8e1d('0x98'),_0x1efa04[_0x8e1d('0x4b')],_0x1efa04[_0x8e1d('0x65')],_0x1efa04[_0x8e1d('0x50')]);}}}this['channels'][_0xfb528a[_0x8e1d('0x4f')]]=_0x1efa04;}}}catch(_0x305134){logger[_0x8e1d('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0xfb528a[_0x8e1d('0x4f')],util['inspect'](_0x305134,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8e1d('0x24')]=function(_0x2c3b41){try{if(this[_0x8e1d('0x58')](_0x2c3b41)){logger['debug'](_0x8e1d('0x99'),_0x2c3b41[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x2c3b41,{'showHidden':![],'depth':null}));this['addVariable'](_0x2c3b41['uniqueid'],_[_0x8e1d('0x9a')](_0x2c3b41['variable'])[0x0],_0x2c3b41[_0x8e1d('0x9b')]);if(this[_0x8e1d('0xf')][_0x2c3b41['uniqueid']]){var _0x9768c5=_[_0x8e1d('0x77')](this['queueReports'][_0x2c3b41[_0x8e1d('0x4f')]]);if(_0x9768c5){if(this['isNotNull'](_0x2c3b41['variable'])&&this['isNotNull'](_0x2c3b41[_0x8e1d('0x9c')][_0x8e1d('0x5f')])){switch(_0x2c3b41[_0x8e1d('0x9b')]){case _0x8e1d('0x9d'):_0x9768c5[_0x8e1d('0x87')]=![];_0x9768c5['queuecallerexitAt']=null;break;case _0x8e1d('0x9e'):_0x9768c5[_0x8e1d('0x9f')]=_0x8e1d('0xa0');_0x9768c5['queuecallerexit']=!![];_0x9768c5[_0x8e1d('0x88')]=moment()['format'](_0x8e1d('0x6f'));_0x9768c5['queuecallerleaveAt']=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));logger[_0x8e1d('0x4d')](_0x8e1d('0xa1'),_0x2c3b41['uniqueid'],util['inspect'](_0x9768c5,{'showHidden':![],'depth':null}));ami[_0x8e1d('0x48')](_0x8e1d('0xa2'),_0x9768c5);break;default:_0x9768c5[_0x8e1d('0x87')]=!![];_0x9768c5[_0x8e1d('0x88')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x9768c5[_0x8e1d('0xa3')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));}_0x9768c5[_0x8e1d('0x33')]=![];_0x9768c5[_0x8e1d('0x7b')]=null;_0x9768c5[_0x8e1d('0x50')]=_0x2c3b41[_0x8e1d('0x9b')];this['channels'][_0x2c3b41['uniqueid']]=_0x9768c5;this[_0x8e1d('0x46')](_0x9768c5,_0x8e1d('0xa4'));}else if(this['isNotNull'](_0x2c3b41[_0x8e1d('0x9c')])&&this[_0x8e1d('0x58')](_0x2c3b41[_0x8e1d('0x9c')][_0x8e1d('0xa5')])){if(!_0x9768c5[_0x8e1d('0x33')]){_0x9768c5['queuecallerexit']=!![];_0x9768c5[_0x8e1d('0x88')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x9768c5[_0x8e1d('0x50')]=_0x8e1d('0xa6');_0x9768c5[_0x8e1d('0xa3')]=moment()['format'](_0x8e1d('0x6f'));this[_0x8e1d('0x36')][_0x2c3b41[_0x8e1d('0x4f')]]=_0x9768c5;}}logger[_0x8e1d('0x72')](_0x8e1d('0xa7'),_0x2c3b41['uniqueid'],_0x9768c5[_0x8e1d('0x4b')],_0x9768c5['type'],_[_0x8e1d('0x9a')](_0x2c3b41['variable'])[0x0],_0x2c3b41[_0x8e1d('0x9b')]);_0x9768c5[_0x8e1d('0x15')]=this[_0x8e1d('0x15')][_0x2c3b41[_0x8e1d('0x4f')]];}}}}catch(_0x46ac1c){logger['error']('[%s][voiceQueueReport][varset]',_0x2c3b41[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x46ac1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0xa8')]=function(_0x2b0511,_0x12c133,_0x27f519){var _0x570b46=[_0x8e1d('0xa9'),_0x8e1d('0xaa'),_0x8e1d('0xab'),_0x8e1d('0xac'),_0x8e1d('0xad'),_0x8e1d('0xae'),_0x8e1d('0xaf'),_0x8e1d('0xb0'),'sipcallid',_0x8e1d('0xb1'),_0x8e1d('0xb2'),_0x8e1d('0xb3'),_0x8e1d('0xb4'),_0x8e1d('0xb5'),_0x8e1d('0xb6'),_0x8e1d('0xb7'),_0x8e1d('0xb8'),_0x8e1d('0xb9'),_0x8e1d('0xba')];if(!_['isNil'](_0x12c133)&&!_[_0x8e1d('0xbb')](_0x570b46,_0x12c133)){if(_['isUndefined'](this[_0x8e1d('0x15')][_0x2b0511])){this[_0x8e1d('0x15')][_0x2b0511]={};}this[_0x8e1d('0x15')][_0x2b0511][_0x12c133]=_0x27f519;}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0xbc')]=function(_0x1571c1,_0x522278,_0x1f520f){try{var _0x183a4d={};if(this['queueReports'][_0x1571c1]){for(var _0x4529f8=0x0;_0x4529f8{delete this[_0x8e1d('0x36')][_0x207529];},_0x426503);}};module[_0x8e1d('0xf8')]=VoiceQueueReport; \ No newline at end of file +var _0x9e6a=[']\x20sending\x20voice_queue_channel:remove\x20event:','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','isRunning','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','summaryEvent','compareToInboundQueue','assign','syncQueueStatusComplete','queuestatus','type','handleInboundQueueSummaryReport','outbound','syncQueueSummaryComplete','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','queuecallerjoin','last','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','queuecallerabandonAt','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','transferexten','destexten','transferuniqueid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','handleHangup','length','diff','seconds','sumDuration','milliseconds','total','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','queuemember','syncQueueMember','syncQueueCallerAbandon','agentcomplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','talking','pTalking','waiting','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','clearQueueReport','summary','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save'];(function(_0x2b333c,_0x42ab6a){var _0x4323e8=function(_0x1ae83e){while(--_0x1ae83e){_0x2b333c['push'](_0x2b333c['shift']());}};_0x4323e8(++_0x42ab6a);}(_0x9e6a,0x9c));var _0xa9e6=function(_0x399f3f,_0x4bd01b){_0x399f3f=_0x399f3f-0x0;var _0xb636e2=_0x9e6a[_0x399f3f];return _0xb636e2;};'use strict';var _=require(_0xa9e6('0x0'));var moment=require(_0xa9e6('0x1'));var util=require(_0xa9e6('0x2'));var Redis=require('ioredis');var config=require(_0xa9e6('0x3'));var logger=require(_0xa9e6('0x4'))(_0xa9e6('0x5'));var ami=require('../ami');var QueueReport=require(_0xa9e6('0x6'));var VoiceQueueSummary=require(_0xa9e6('0x7'));config[_0xa9e6('0x8')]=_[_0xa9e6('0x9')](config[_0xa9e6('0x8')],{'host':_0xa9e6('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa9e6('0xb')][_0xa9e6('0xc')]=function(_0x1573d8){this[_0xa9e6('0xd')]=this[_0xa9e6('0xd')]?this[_0xa9e6('0xd')][_0xa9e6('0xe')](_0x1573d8):_0x1573d8();};function VoiceQueueReport(_0x36496a){this[_0xa9e6('0xf')]=new Sequence();this[_0xa9e6('0x10')]={};this[_0xa9e6('0x11')]=_0x36496a;this[_0xa9e6('0x12')]=_0x36496a['agents'];this['channels']=_0x36496a[_0xa9e6('0x13')];this[_0xa9e6('0x14')]=_0x36496a[_0xa9e6('0x14')];this[_0xa9e6('0x15')]=_0x36496a[_0xa9e6('0x15')];this['summary']=initializeSummary();this[_0xa9e6('0x16')]={};ami['on'](_0xa9e6('0x17'),this['syncQueueSummary'][_0xa9e6('0x18')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x19'),this[_0xa9e6('0x1a')][_0xa9e6('0x18')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xa9e6('0x18')](this));ami['on']('queuecallerjoin',this['syncQueueCallerJoin'][_0xa9e6('0x18')](this));ami['on']('queuecallerabandon',this[_0xa9e6('0x1b')][_0xa9e6('0x18')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x1c'),this['syncAgentComplete']['bind'](this));ami['on'](_0xa9e6('0x1d'),this[_0xa9e6('0x1e')][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x1f'),this['syncVarSet'][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x20'),this[_0xa9e6('0x21')][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x22'),this[_0xa9e6('0x23')][_0xa9e6('0x18')](this));ami['on']('musiconholdstart',this[_0xa9e6('0x24')][_0xa9e6('0x18')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xa9e6('0x18')](this));ami['on']('attendedtransfer',this[_0xa9e6('0x25')][_0xa9e6('0x18')](this));ami['on'](_0xa9e6('0x26'),this['syncBlindTransfer'][_0xa9e6('0x18')](this));this[_0xa9e6('0x27')]();this[_0xa9e6('0x28')]();}function clearChannels(_0x4f6cd6){if(!_[_0xa9e6('0x29')](_0x4f6cd6)){for(var _0xf59bef in _0x4f6cd6){if(_0x4f6cd6[_0xa9e6('0x2a')](_0xf59bef)){delete _0x4f6cd6[_0xf59bef];}}}}function clearCampaigns(_0x9ccb68){if(!_[_0xa9e6('0x29')](_0x9ccb68)){for(var _0x4e8b08 in _0x9ccb68){if(_0x9ccb68['hasOwnProperty'](_0x4e8b08)){_0x9ccb68[_0x4e8b08]['originated']=0x0;}}}}function clearVoiceQueues(_0x1cba6f){if(!_[_0xa9e6('0x29')](_0x1cba6f)){for(var _0x2d476e in _0x1cba6f){if(_0x1cba6f[_0xa9e6('0x2a')](_0x2d476e)){_0x1cba6f[_0x2d476e]['originated']=0x0;_0x1cba6f[_0x2d476e][_0xa9e6('0x2b')]=0x0;_0x1cba6f[_0x2d476e][_0xa9e6('0x2c')]=0x0;_0x1cba6f[_0x2d476e][_0xa9e6('0x2d')]=0x0;_0x1cba6f[_0x2d476e]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x3d6dd0){if(!_[_0xa9e6('0x29')](_0x3d6dd0)){for(var _0x1bbf80 in _0x3d6dd0){if(_0x3d6dd0[_0xa9e6('0x2a')](_0x1bbf80)){_0x3d6dd0[_0x1bbf80][_0xa9e6('0x2e')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x3c5dbe){return _0x3c5dbe[_0xa9e6('0x2f')]||_0x3c5dbe[_0xa9e6('0x30')]||_0x3c5dbe[_0xa9e6('0x31')];}VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x32')]=function(){var _0x1080d5=this;for(var _0x126e06 in this['channels']){if(this[_0xa9e6('0x33')][_0xa9e6('0x2a')](_0x126e06)&&!this[_0xa9e6('0x33')][_0x126e06][_0xa9e6('0x34')]){this['sequence'][_0xa9e6('0xc')](function(){if(!_[_0xa9e6('0x35')](_0x1080d5[_0xa9e6('0x33')][_0x126e06])){return ami[_0xa9e6('0x36')]({'action':_0xa9e6('0x37'),'channel':_0x1080d5[_0xa9e6('0x33')][_0x126e06][_0xa9e6('0x38')]})[_0xa9e6('0x39')](function(_0x1dec0d){if(_0x1dec0d['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x1080d5['channels'][_0x126e06]){delete _0x1080d5[_0xa9e6('0x33')][_0x126e06];logger[_0xa9e6('0x3a')](_0xa9e6('0x3b'),_0x126e06,util[_0xa9e6('0x3c')](_0x1dec0d,{'showHidden':![],'depth':null}));}if(_0x1080d5[_0xa9e6('0x10')][_0x126e06]){delete _0x1080d5[_0xa9e6('0x10')][_0x126e06];logger['error']('[%s][voiceQueueReport][checkQueueReport]',_0x126e06,util[_0xa9e6('0x3c')](_0x1dec0d,{'showHidden':![],'depth':null}));}if(_0x1080d5[_0xa9e6('0x16')][_0x126e06]){delete _0x1080d5[_0xa9e6('0x16')][_0x126e06];logger[_0xa9e6('0x3a')](_0xa9e6('0x3d'),_0x126e06,util[_0xa9e6('0x3c')](_0x1dec0d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x23')]=function(){logger[_0xa9e6('0x3a')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xa9e6('0x33')]);this[_0xa9e6('0x3e')](this[_0xa9e6('0x10')]);clearAgentBooked(this[_0xa9e6('0x12')]);clearVoiceQueues(this[_0xa9e6('0x14')]);clearCampaigns(this[_0xa9e6('0x15')]);this[_0xa9e6('0x3f')]=initializeSummary();};VoiceQueueReport[_0xa9e6('0xb')]['clearQueueReport']=function(_0x32dc7b){var _0x347b1b=this;if(!_['isEmpty'](_0x32dc7b)){for(var _0x2af493 in _0x32dc7b){if(_0x32dc7b[_0xa9e6('0x2a')](_0x2af493)){_0x347b1b[_0xa9e6('0x40')](_0x32dc7b[_0x2af493],_0xa9e6('0x41'));delete _0x32dc7b[_0x2af493];}}}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x42')]=function(_0xc9fdcd,_0x311865,_0x147a38){io['to'](_0xc9fdcd)[_0xa9e6('0x42')](_0x311865,_0x147a38);};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x43')]=function(_0x324dfc,_0x332591){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport]['+_0x332591+_0xa9e6('0x45'),_0x324dfc[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x324dfc,{'showHidden':![],'depth':null}));this[_0xa9e6('0x42')](util[_0xa9e6('0x47')](_0xa9e6('0x48'),_0x324dfc[_0xa9e6('0x49')]),_0xa9e6('0x4a'),_0x324dfc);io[_0xa9e6('0x42')]('voice_queue_presence:save',_0x324dfc);};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x40')]=function(_0xcf70d6,_0x144e8c){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport]['+_0x144e8c+_0xa9e6('0x4b'),_0xcf70d6[_0xa9e6('0x46')],util['inspect'](_0xcf70d6,{'showHidden':![],'depth':null}));if(_0xcf70d6['queuecallerexitreason']===_0xa9e6('0x4c')){return;}this[_0xa9e6('0x42')](util[_0xa9e6('0x47')](_0xa9e6('0x48'),_0xcf70d6[_0xa9e6('0x49')]),_0xa9e6('0x4d'),_0xcf70d6);io[_0xa9e6('0x42')](_0xa9e6('0x4e'),_0xcf70d6);};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x4f')]=function(_0x469a74){if(_0x469a74['type']===_0xa9e6('0x50')){logger[_0xa9e6('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xa9e6('0x3c')](_0x469a74,{'showHidden':![],'depth':null}));this[_0xa9e6('0x42')](util[_0xa9e6('0x47')](_0xa9e6('0x48'),_0x469a74['name']),_0xa9e6('0x51'),_0x469a74);}};VoiceQueueReport[_0xa9e6('0xb')]['isNotNull']=function(_0x203ad0){return _0x203ad0!==null&&!_[_0xa9e6('0x52')](_0x203ad0);};VoiceQueueReport['prototype'][_0xa9e6('0x28')]=function(){var _0x5551d1=this;setInterval(function(){_0x5551d1[_0xa9e6('0x32')]();ami[_0xa9e6('0x36')]({'action':_0xa9e6('0x53')})[_0xa9e6('0x39')](function(_0x17959c){logger['error'](_0xa9e6('0x54'),util[_0xa9e6('0x3c')](_0x17959c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0xa9e6('0x27')]=function(){var _0x743ead=this;setInterval(function(){if(!_0x743ead[_0xa9e6('0x3f')][_0xa9e6('0x55')]){return ami[_0xa9e6('0x36')]({'action':_0xa9e6('0x17')})[_0xa9e6('0x56')](function(_0x427c88){_0x743ead[_0xa9e6('0x3f')]['id']=_0x427c88[_0xa9e6('0x57')];_0x743ead[_0xa9e6('0x3f')][_0xa9e6('0x55')]=!![];_0x743ead[_0xa9e6('0x3f')]['queuestatus'][_0x427c88[_0xa9e6('0x57')]]={};})[_0xa9e6('0x39')](function(_0x2c1b6d){logger[_0xa9e6('0x3a')](_0xa9e6('0x58'),util['inspect'](_0x2c1b6d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x59')]=function(_0x5d9b03,_0x4576f7){var _0xd5ffd2;if(this[_0xa9e6('0x3f')]&&this[_0xa9e6('0x3f')][_0xa9e6('0x53')]&&this['summary'][_0xa9e6('0x53')][_0x5d9b03[_0xa9e6('0x5a')]]){_0xd5ffd2=this[_0xa9e6('0x3f')][_0xa9e6('0x53')][_0x5d9b03[_0xa9e6('0x5a')]][_0xa9e6('0x5b')];}var _0x1aecd9=new VoiceQueueSummary(_0x5d9b03);return _0x1aecd9['createReport'](_0x4576f7[_0xa9e6('0x12')],this[_0xa9e6('0x12')],_0xd5ffd2,this[_0xa9e6('0x11')]['channels']);};VoiceQueueReport['prototype']['handleInboundQueueSummaryReport']=function(_0x301c9e,_0x35dd0b){var _0x1871b5=this[_0xa9e6('0x59')](_0x301c9e,_0x35dd0b);var _0x266498=![];_0x266498=_0x1871b5[_0xa9e6('0x5c')](_0x301c9e);if(_0x266498){Object[_0xa9e6('0x5d')](_0x301c9e,_0x1871b5);this[_0xa9e6('0x11')]['voiceQueues'][_0x301c9e[_0xa9e6('0x5a')]]=_0x301c9e;this[_0xa9e6('0x4f')](_0x1871b5);}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x5e')]=function(_0x5a1a0d){var _0x16197d=null;var _0x249cb5=this[_0xa9e6('0x3f')]['id'];if(this['summary'][_0xa9e6('0x5f')][_0x249cb5]){_0x16197d=this[_0xa9e6('0x3f')]['queuestatus'][_0x249cb5][_0x5a1a0d[_0xa9e6('0x57')]];}if(!_0x16197d){this[_0xa9e6('0x3f')]=initializeSummary();return;}var _0x2858c8=this[_0xa9e6('0x14')][_0x16197d[_0xa9e6('0x49')]];if(_0x2858c8[_0xa9e6('0x60')]==='inbound'){this[_0xa9e6('0x61')](_0x2858c8,_0x16197d);}else if(_0x2858c8[_0xa9e6('0x60')]===_0xa9e6('0x62')){var _0x507605=this[_0xa9e6('0x59')](_0x2858c8,_0x16197d);ami[_0xa9e6('0x42')]('custom:queuesummary',_0x507605);}this[_0xa9e6('0x3f')]['statusRequests']-=0x1;var _0x4a570b=this[_0xa9e6('0x3f')]['statusRequests']>0x0?!![]:![];if(!_0x4a570b){return this[_0xa9e6('0x63')](this[_0xa9e6('0x3f')][_0xa9e6('0x64')]);}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x1a')]=function(_0x32eea2){var _0x2d9325=this['summary']['id'];if(this[_0xa9e6('0x3f')][_0xa9e6('0x5f')][_0x2d9325]&&this[_0xa9e6('0x3f')][_0xa9e6('0x5f')][_0x2d9325][_0x32eea2[_0xa9e6('0x57')]]){this['summary'][_0xa9e6('0x5f')][_0x2d9325][_0x32eea2[_0xa9e6('0x57')]][_0xa9e6('0x12')][_0xa9e6('0x65')](_0x32eea2);}};VoiceQueueReport[_0xa9e6('0xb')]['syncQueueSummary']=function(_0x2984e2){var _0xddd49a=this;try{if(this[_0xa9e6('0x66')](_0x2984e2)&&this[_0xa9e6('0x66')](_0x2984e2['queue'])){logger[_0xa9e6('0x44')](_0xa9e6('0x67'),util[_0xa9e6('0x3c')](_0x2984e2,{'showHidden':![],'depth':null}));var _0x503d59=this['voiceQueues'][_0x2984e2['queue']];if(_0x503d59){logger[_0xa9e6('0x44')](_0xa9e6('0x68'),_0x503d59[_0xa9e6('0x5a')]);this['summary'][_0xa9e6('0x53')][_0x503d59['name']]={'summaryEvent':_0x2984e2};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x503d59[_0xa9e6('0x5a')]})['then'](function(_0x140339){if(!_0xddd49a['summary'][_0xa9e6('0x5f')][_0x2984e2['actionid']]){_0xddd49a[_0xa9e6('0x3f')][_0xa9e6('0x5f')][_0x2984e2['actionid']]={};}_0xddd49a[_0xa9e6('0x3f')]['queuestatus'][_0x2984e2[_0xa9e6('0x57')]][_0x140339['actionid']]={'queue':_0x503d59[_0xa9e6('0x5a')],'agents':[]};})[_0xa9e6('0x39')](function(_0x6c7193){throw _0x6c7193;});}}}catch(_0x43e67c){logger[_0xa9e6('0x3a')](_0xa9e6('0x58'),util['inspect'](_0x43e67c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')]['syncQueueSummaryComplete']=function(_0x39761b){if(this[_0xa9e6('0x3f')][_0xa9e6('0x69')]>0x0){this[_0xa9e6('0x3f')][_0xa9e6('0x64')]=_0x39761b;return;}logger[_0xa9e6('0x44')](_0xa9e6('0x6a'),util[_0xa9e6('0x3c')](_0x39761b,{'showHidden':![],'depth':null}));this[_0xa9e6('0x3f')]=initializeSummary();ami[_0xa9e6('0x42')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xa9e6('0xb')]['syncQueueCallerJoin']=function(_0x4664fe){try{if(this[_0xa9e6('0x66')](_0x4664fe)){logger[_0xa9e6('0x44')](_0xa9e6('0x6b'),_0x4664fe[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x4664fe,{'showHidden':![],'depth':null}));if(_[_0xa9e6('0x52')](this[_0xa9e6('0x10')][_0x4664fe[_0xa9e6('0x46')]])){this[_0xa9e6('0x10')][_0x4664fe[_0xa9e6('0x46')]]=[];}if(_['isUndefined'](this[_0xa9e6('0x33')][_0x4664fe[_0xa9e6('0x46')]])){this[_0xa9e6('0x33')][_0x4664fe[_0xa9e6('0x46')]]={};}var _0x1bd0b8=new QueueReport();_0x1bd0b8['queue']=_0x4664fe[_0xa9e6('0x49')];_0x1bd0b8['type']=this['voiceQueues'][_0x1bd0b8['queue']]&&this[_0xa9e6('0x14')][_0x1bd0b8['queue']][_0xa9e6('0x60')]?this[_0xa9e6('0x14')][_0x1bd0b8[_0xa9e6('0x49')]][_0xa9e6('0x60')]||_0xa9e6('0x50'):'inbound';_0x1bd0b8[_0xa9e6('0x6c')]=moment()[_0xa9e6('0x47')](_0xa9e6('0x6d'));_0x1bd0b8['position']=_0x4664fe[_0xa9e6('0x6e')];_0x1bd0b8[_0xa9e6('0x6f')]=_0x4664fe[_0xa9e6('0x6f')];_0x1bd0b8[_0xa9e6('0x46')]=_0x4664fe[_0xa9e6('0x46')];logger[_0xa9e6('0x70')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1bd0b8['queue'],_0x1bd0b8[_0xa9e6('0x60')]);Object['assign'](_0x1bd0b8,_[_0xa9e6('0x71')](_0x4664fe,_[_0xa9e6('0x72')](_0x1bd0b8)));this[_0xa9e6('0x10')][_0x4664fe[_0xa9e6('0x46')]][_0xa9e6('0x65')](_0x1bd0b8);this['channels'][_0x4664fe[_0xa9e6('0x46')]]=_0x1bd0b8;this[_0xa9e6('0x43')](_0x1bd0b8,_0xa9e6('0x73'));}}catch(_0x51fa7b){logger['error'](_0xa9e6('0x6b'),_0x4664fe[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x51fa7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x1b')]=function(_0xf9252d){try{if(this[_0xa9e6('0x66')](_0xf9252d)){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0xf9252d[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0xf9252d,{'showHidden':![],'depth':null}));if(this[_0xa9e6('0x10')][_0xf9252d['uniqueid']]){var _0x520e6=_[_0xa9e6('0x74')](this[_0xa9e6('0x10')][_0xf9252d[_0xa9e6('0x46')]]);_0x520e6[_0xa9e6('0x31')]=![];_0x520e6[_0xa9e6('0x75')]=null;_0x520e6[_0xa9e6('0x76')]=_0xf9252d[_0xa9e6('0x76')];_0x520e6[_0xa9e6('0x77')]=_0xf9252d[_0xa9e6('0x77')];_0x520e6[_0xa9e6('0x30')]=!![];_0x520e6['queuecallerabandonAt']=moment()['format'](_0xa9e6('0x6d'));_0x520e6[_0xa9e6('0x78')]=_0xa9e6('0x79');_0x520e6[_0xa9e6('0x7a')]=null;logger[_0xa9e6('0x70')](_0xa9e6('0x7b'),_0x520e6[_0xa9e6('0x49')],_0x520e6[_0xa9e6('0x60')]);this[_0xa9e6('0x33')][_0xf9252d[_0xa9e6('0x46')]]=_0x520e6;this[_0xa9e6('0x40')](_0x520e6,_0xa9e6('0x30'));}}}catch(_0x204eae){logger[_0xa9e6('0x3a')]('[%s][voiceQueueReport][queuecallerabandon]',_0xf9252d[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x204eae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x7c')]=function(_0x42c095){try{if(this[_0xa9e6('0x66')](_0x42c095)){logger[_0xa9e6('0x44')](_0xa9e6('0x7d'),_0x42c095[_0xa9e6('0x46')],util['inspect'](_0x42c095,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x42c095[_0xa9e6('0x46')]]){var _0x4a73e9=_[_0xa9e6('0x74')](this[_0xa9e6('0x10')][_0x42c095['uniqueid']]);_0x4a73e9['queuecallerleaveAt']=moment()['format'](_0xa9e6('0x6d'));_0x4a73e9[_0xa9e6('0x7e')]=_0x42c095[_0xa9e6('0x7e')];_0x4a73e9[_0xa9e6('0x7f')]=_0x42c095['connectedlinename'];logger[_0xa9e6('0x70')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4a73e9[_0xa9e6('0x49')],_0x4a73e9[_0xa9e6('0x60')],_0x42c095[_0xa9e6('0x7e')],_0x42c095[_0xa9e6('0x7f')]);this['channels'][_0x42c095[_0xa9e6('0x46')]]=_0x4a73e9;this['emitVoiceQueueChannelSave'](_0x4a73e9,_0xa9e6('0x80'));}}}catch(_0xde1e32){logger[_0xa9e6('0x3a')](_0xa9e6('0x7d'),_0x42c095[_0xa9e6('0x46')],util['inspect'](_0xde1e32,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa9e6('0x1e')]=function(_0x5eb5a2){try{if(this[_0xa9e6('0x66')](_0x5eb5a2)){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x5eb5a2[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x5eb5a2,{'showHidden':![],'depth':null}));if(this[_0xa9e6('0x10')][_0x5eb5a2[_0xa9e6('0x46')]]){var _0x53fd3e=_[_0xa9e6('0x74')](this[_0xa9e6('0x10')][_0x5eb5a2[_0xa9e6('0x46')]]);_0x53fd3e['queuecallercomplete']=!![];_0x53fd3e['queuecallerexitreason']=_0xa9e6('0x81');logger['info'](_0xa9e6('0x82'),_0x53fd3e[_0xa9e6('0x49')],_0x53fd3e[_0xa9e6('0x60')]);}}}catch(_0x29a344){logger['error'](_0xa9e6('0x83'),_0x5eb5a2[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x29a344,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')]['syncAgentComplete']=function(_0x59c64c){try{if(this['isNotNull'](_0x59c64c)){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x59c64c[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x59c64c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x59c64c[_0xa9e6('0x46')]]){var _0x36c004=_[_0xa9e6('0x74')](this['queueReports'][_0x59c64c['uniqueid']]);_0x36c004['queuecallerabandon']=![];_0x36c004[_0xa9e6('0x84')]=null;_0x36c004[_0xa9e6('0x85')]=!![];_0x36c004[_0xa9e6('0x7a')]=_0x59c64c[_0xa9e6('0x86')];_0x36c004[_0xa9e6('0x76')]=_0x59c64c['holdtime'];_0x36c004[_0xa9e6('0x31')]=!![];_0x36c004['queuecallerexit']=![];_0x36c004[_0xa9e6('0x87')]=null;if(!_0x36c004[_0xa9e6('0x88')]){if(_0x59c64c['reason']==_0xa9e6('0x88')){_0x36c004[_0xa9e6('0x78')]='COMPLETED';logger[_0xa9e6('0x70')](_0xa9e6('0x89'),_0x36c004[_0xa9e6('0x49')],_0x36c004[_0xa9e6('0x60')]);}else{if(_[_0xa9e6('0x8a')](_0x59c64c[_0xa9e6('0x38')][_0xa9e6('0x8b')](),'local/')){if(this['queueReports'][_0x59c64c[_0xa9e6('0x8c')]]){var _0x1cf3c1=_[_0xa9e6('0x74')](this['queueReports'][_0x59c64c[_0xa9e6('0x8c')]]);_0x1cf3c1['queuecallercomplete']=![];_0x1cf3c1['queuecallerexit']=!![];_0x1cf3c1[_0xa9e6('0x87')]=moment(_0x36c004[_0xa9e6('0x6c')])['add'](_0x59c64c[_0xa9e6('0x76')],'seconds')[_0xa9e6('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cf3c1[_0xa9e6('0x78')]='FORWARDTRANSFER';_0x1cf3c1[_0xa9e6('0x88')]=!![];_0x1cf3c1['transfertype']='FORWARD';_0x1cf3c1[_0xa9e6('0x8d')]=_0x59c64c[_0xa9e6('0x8e')];_0x1cf3c1[_0xa9e6('0x8f')]=_0x59c64c['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1cf3c1[_0xa9e6('0x49')],_0x1cf3c1['type']);var _0xc9c422=this[_0xa9e6('0x10')][_0x59c64c[_0xa9e6('0x8c')]];this[_0xa9e6('0x10')][_0x59c64c[_0xa9e6('0x8c')]]=this[_0xa9e6('0x10')][_0x59c64c[_0xa9e6('0x46')]];this[_0xa9e6('0x10')][_0x59c64c['uniqueid']]=_0xc9c422;}}else{_0x36c004['queuecallerexitreason']=_0xa9e6('0x90')+_0x59c64c['reason']['toUpperCase']();logger[_0xa9e6('0x70')](_0xa9e6('0x91'),_0x36c004[_0xa9e6('0x49')],_0x36c004[_0xa9e6('0x60')],_0x36c004[_0xa9e6('0x78')]);}}}this['channels'][_0x59c64c[_0xa9e6('0x46')]]=_0x36c004;}}}catch(_0x2a2c66){logger[_0xa9e6('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x59c64c[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x2a2c66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x92')]=function(_0x30f555){try{if(this[_0xa9e6('0x66')](_0x30f555)){logger[_0xa9e6('0x44')]('[%s][voiceQueueReport][varset]',_0x30f555[_0xa9e6('0x46')],util[_0xa9e6('0x3c')](_0x30f555,{'showHidden':![],'depth':null}));this[_0xa9e6('0x93')](_0x30f555[_0xa9e6('0x46')],_[_0xa9e6('0x72')](_0x30f555[_0xa9e6('0x94')])[0x0],_0x30f555[_0xa9e6('0x95')]);if(this[_0xa9e6('0x10')][_0x30f555[_0xa9e6('0x46')]]){var _0x1efe32=_[_0xa9e6('0x74')](this[_0xa9e6('0x10')][_0x30f555[_0xa9e6('0x46')]]);if(_0x1efe32){if(this['isNotNull'](_0x30f555[_0xa9e6('0x94')])&&this[_0xa9e6('0x66')](_0x30f555[_0xa9e6('0x94')][_0xa9e6('0x5f')])){switch(_0x30f555[_0xa9e6('0x95')]){case _0xa9e6('0x96'):_0x1efe32[_0xa9e6('0x2f')]=![];_0x1efe32[_0xa9e6('0x87')]=null;break;case _0xa9e6('0x97'):_0x1efe32[_0xa9e6('0x98')]='timeout';_0x1efe32[_0xa9e6('0x2f')]=!![];_0x1efe32[_0xa9e6('0x87')]=moment()[_0xa9e6('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1efe32[_0xa9e6('0x99')]=moment()[_0xa9e6('0x47')](_0xa9e6('0x6d'));logger['debug'](_0xa9e6('0x9a'),_0x30f555[_0xa9e6('0x46')],util['inspect'](_0x1efe32,{'showHidden':![],'depth':null}));ami[_0xa9e6('0x42')](_0xa9e6('0x9b'),_0x1efe32);break;default:_0x1efe32[_0xa9e6('0x2f')]=!![];_0x1efe32[_0xa9e6('0x87')]=moment()[_0xa9e6('0x47')](_0xa9e6('0x6d'));_0x1efe32['queuecallerleaveAt']=moment()[_0xa9e6('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1efe32['queuecallerabandon']=![];_0x1efe32['queuecallerabandonAt']=null;_0x1efe32[_0xa9e6('0x78')]=_0x30f555[_0xa9e6('0x95')];this[_0xa9e6('0x33')][_0x30f555[_0xa9e6('0x46')]]=_0x1efe32;this[_0xa9e6('0x40')](_0x1efe32,_0xa9e6('0x1f'));}else if(this['isNotNull'](_0x30f555[_0xa9e6('0x94')])&&this[_0xa9e6('0x66')](_0x30f555[_0xa9e6('0x94')][_0xa9e6('0x9c')])){if(!_0x1efe32[_0xa9e6('0x30')]){_0x1efe32['queuecallerexit']=!![];_0x1efe32[_0xa9e6('0x87')]=moment()['format'](_0xa9e6('0x6d'));_0x1efe32[_0xa9e6('0x78')]='EXITWITHKEY';_0x1efe32[_0xa9e6('0x99')]=moment()[_0xa9e6('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa9e6('0x33')][_0x30f555['uniqueid']]=_0x1efe32;}}logger[_0xa9e6('0x70')](_0xa9e6('0x9d'),_0x30f555['uniqueid'],_0x1efe32[_0xa9e6('0x49')],_0x1efe32[_0xa9e6('0x60')],_[_0xa9e6('0x72')](_0x30f555[_0xa9e6('0x94')])[0x0],_0x30f555[_0xa9e6('0x95')]);_0x1efe32[_0xa9e6('0x16')]=this[_0xa9e6('0x16')][_0x30f555[_0xa9e6('0x46')]];}}}}catch(_0x55d67f){logger['error'](_0xa9e6('0x9e'),_0x30f555[_0xa9e6('0x46')],util['inspect'](_0x55d67f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0x93')]=function(_0x1f95fd,_0x246200,_0x34954d){var _0x5014b6=[_0xa9e6('0x9f'),_0xa9e6('0xa0'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xa9e6('0xa1'),_0xa9e6('0xa2'),_0xa9e6('0xa3'),_0xa9e6('0xa4'),_0xa9e6('0xa5'),_0xa9e6('0xa6'),_0xa9e6('0xa7'),_0xa9e6('0xa8'),_0xa9e6('0xa9'),_0xa9e6('0xaa'),_0xa9e6('0xab'),_0xa9e6('0xac'),'membername','memberpenalty',_0xa9e6('0xad')];if(!_[_0xa9e6('0x35')](_0x246200)&&!_[_0xa9e6('0xae')](_0x5014b6,_0x246200)){if(_['isUndefined'](this[_0xa9e6('0x16')][_0x1f95fd])){this['variables'][_0x1f95fd]={};}this[_0xa9e6('0x16')][_0x1f95fd][_0x246200]=_0x34954d;}};VoiceQueueReport[_0xa9e6('0xb')][_0xa9e6('0xaf')]=function(_0x5b7667,_0x15896b,_0x22c9bc){try{var _0x197532={};if(this[_0xa9e6('0x10')][_0x5b7667]){for(var _0x4365c8=0x0;_0x4365c8{delete this[_0xa9e6('0x33')][_0x5587bf];},_0x12cb87);}};module[_0xa9e6('0xe6')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index db5ab99..f727a26 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53e1=['CreateReportAgentPreview','createHistory','campaign','queue','Request'];(function(_0x4cbdb7,_0x1b82f6){var _0x4ecb18=function(_0x48271f){while(--_0x48271f){_0x4cbdb7['push'](_0x4cbdb7['shift']());}};_0x4ecb18(++_0x1b82f6);}(_0x53e1,0x128));var _0x153e=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x53e1[_0x2a1b33];return _0x4c50e7;};'use strict';var client=require('../client');exports[_0x153e('0x0')]=function(_0x137443){return function(){_0x137443[_0x153e('0x1')]=_0x137443[_0x153e('0x2')];return client[_0x153e('0x3')]('CreateReportAgentPreview',{'body':_0x137443,'log':_0x153e('0x4')});};}; \ No newline at end of file +var _0xe97d=['Request','CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0x59bdd0,_0x300555){var _0x1b6ab6=function(_0x14d233){while(--_0x14d233){_0x59bdd0['push'](_0x59bdd0['shift']());}};_0x1b6ab6(++_0x300555);}(_0xe97d,0x182));var _0xde97=function(_0x52ecb7,_0x3b7be9){_0x52ecb7=_0x52ecb7-0x0;var _0x81156c=_0xe97d[_0x52ecb7];return _0x81156c;};'use strict';var client=require(_0xde97('0x0'));exports[_0xde97('0x1')]=function(_0xd0248e){return function(){_0xd0248e[_0xde97('0x2')]=_0xd0248e[_0xde97('0x3')];return client[_0xde97('0x4')](_0xde97('0x5'),{'body':_0xd0248e,'log':_0xde97('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index ba58508..293b72a 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdff=['../client','create','Request','CreateAttachment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbdff,0x114));var _0xfbdf=function(_0x1313e9,_0x5775bd){_0x1313e9=_0x1313e9-0x0;var _0x2d8856=_0xbdff[_0x1313e9];return _0x2d8856;};'use strict';var client=require(_0xfbdf('0x0'));exports[_0xfbdf('0x1')]=function(_0x399a18){return client[_0xfbdf('0x2')](_0xfbdf('0x3'),{'body':_0x399a18,'log':_0xfbdf('0x3')});}; \ No newline at end of file +var _0x849a=['Request','CreateAttachment','../client','create'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x849a,0x1ba));var _0xa849=function(_0x5862b1,_0x57b961){_0x5862b1=_0x5862b1-0x0;var _0x54de2f=_0x849a[_0x5862b1];return _0x54de2f;};'use strict';var client=require(_0xa849('0x0'));exports[_0xa849('0x1')]=function(_0x2536a3){return client[_0xa849('0x2')](_0xa849('0x3'),{'body':_0x2536a3,'log':'CreateAttachment'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index ebe7bb4..8294ae7 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x57f803,_0x20c22c){var _0x200ae3=function(_0x3f8728){while(--_0x3f8728){_0x57f803['push'](_0x57f803['shift']());}};_0x200ae3(++_0x20c22c);}(_0xdb28,0x106));var _0x8db2=function(_0xf8ab66,_0x3e8c0e){_0xf8ab66=_0xf8ab66-0x0;var _0x526281=_0xdb28[_0xf8ab66];return _0x526281;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file +var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x31b0ec,_0x2b8a02){var _0x40d3cd=function(_0x3d473){while(--_0x3d473){_0x31b0ec['push'](_0x31b0ec['shift']());}};_0x40d3cd(++_0x2b8a02);}(_0x1261,0x144));var _0x1126=function(_0x5d24c1,_0xf7cd20){_0x5d24c1=_0x5d24c1-0x0;var _0x89701b=_0x1261[_0x5d24c1];return _0x89701b;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 6fb076a..bd02cb3 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1379=['Request','getContacts','GetCmContact','../client','createContact'];(function(_0x50cc5c,_0x53af09){var _0x55cfc1=function(_0x335faa){while(--_0x335faa){_0x50cc5c['push'](_0x50cc5c['shift']());}};_0x55cfc1(++_0x53af09);}(_0x1379,0x1e3));var _0x9137=function(_0x5a18ed,_0x9936d2){_0x5a18ed=_0x5a18ed-0x0;var _0x12d357=_0x1379[_0x5a18ed];return _0x12d357;};'use strict';var client=require(_0x9137('0x0'));exports[_0x9137('0x1')]=function(_0x5adf98){return function(){return client[_0x9137('0x2')]('CreateCmContact',{'body':_0x5adf98,'log':'CreateCmContact'});};};exports[_0x9137('0x3')]=function(_0x5b9bf5){return function(){return client[_0x9137('0x2')](_0x9137('0x4'),{'options':_0x5b9bf5,'log':'GetCmContact'});};}; \ No newline at end of file +var _0x7e6f=['GetCmContact','createContact','Request','CreateCmContact','getContacts'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7e6f,0xb0));var _0xf7e6=function(_0x50612e,_0xf56548){_0x50612e=_0x50612e-0x0;var _0x8fd4bf=_0x7e6f[_0x50612e];return _0x8fd4bf;};'use strict';var client=require('../client');exports[_0xf7e6('0x0')]=function(_0x3130a4){return function(){return client[_0xf7e6('0x1')](_0xf7e6('0x2'),{'body':_0x3130a4,'log':_0xf7e6('0x2')});};};exports[_0xf7e6('0x3')]=function(_0x341939){return function(){return client['Request'](_0xf7e6('0x4'),{'options':_0x341939,'log':_0xf7e6('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index f1d6b92..f7cb82d 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2087=['Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User'];(function(_0x141d2e,_0x4d5885){var _0x535b21=function(_0x4554cd){while(--_0x4554cd){_0x141d2e['push'](_0x141d2e['shift']());}};_0x535b21(++_0x4d5885);}(_0x2087,0xf3));var _0x7208=function(_0x3b5e9f,_0x11a60b){_0x3b5e9f=_0x3b5e9f-0x0;var _0x3a6998=_0x2087[_0x3b5e9f];return _0x3a6998;};'use strict';var client=require(_0x7208('0x0'));var moment=require(_0x7208('0x1'));exports[_0x7208('0x2')]=function(_0x1773d0,_0x5eea11){return function(){return client[_0x7208('0x3')](_0x7208('0x4'),{'options':{'where':{'VoiceQueueId':_0x1773d0},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')}],'limit':_0x5eea11,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x232693,_0x5cc93f,_0x3c7d9d){return function(){return client['Request'](_0x7208('0x7'),{'body':_0x232693,'options':{'where':{'VoiceQueueId':_0x5cc93f,'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))}},'limit':_0x3c7d9d},'log':_0x7208('0x7')});};};exports[_0x7208('0xa')]=function(_0x25b01b){return client[_0x7208('0x3')]('UpdateCmHopper',{'body':_0x25b01b,'options':{'where':{'ContactId':_0x25b01b[_0x7208('0xb')],'ListId':_0x25b01b[_0x7208('0xc')],'VoiceQueueId':_0x25b01b[_0x7208('0xd')],'CampaignId':_0x25b01b[_0x7208('0xe')]}},'log':_0x7208('0xa')});};exports[_0x7208('0xf')]=function(_0x5b30f8,_0x330d9f,_0x26de84){return function(){return client[_0x7208('0x3')](_0x7208('0x10'),{'options':{'where':{'VoiceQueueId':_0x5b30f8,'ListId':_0x330d9f,'ContactId':_0x26de84}},'log':_0x7208('0x10')});};};exports[_0x7208('0x11')]=function(_0x4e59c1,_0xde3407,_0x415e8e,_0x234927){return client[_0x7208('0x3')](_0x7208('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4e59c1,'active':![],'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0xde3407}}]},'order':[[_0x7208('0x13'),_0x7208('0x14')],[_0x7208('0x15'),_0x234927],['id',_0x7208('0x16')]],'raw':!![],'limit':_0x415e8e},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x5a7b8d,_0x476598,_0x5b22d6){return client[_0x7208('0x3')](_0x7208('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5a7b8d,'active':![],'scheduledat':{'$lte':moment()['format'](_0x7208('0x9'))}},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')}],'order':[[_0x7208('0x13'),_0x7208('0x14')],[_0x7208('0x15'),_0x5b22d6],['id',_0x7208('0x16')]],'raw':!![],'limit':_0x476598},'log':_0x7208('0x17')});};exports[_0x7208('0x18')]=function(_0x41cd3a,_0x3c17db){_0x41cd3a[_0x7208('0x19')]=_0x41cd3a[_0x7208('0x1a')];return client[_0x7208('0x3')](_0x7208('0x1b'),{'body':_0x41cd3a,'options':{'where':{'ContactId':_0x41cd3a['ContactId'],'ListId':_0x41cd3a['ListId'],'VoiceQueueId':_0x41cd3a[_0x7208('0xd')],'CampaignId':_0x41cd3a[_0x7208('0xe')],'active':_0x3c17db?undefined:!![]}},'log':_0x7208('0x1b')});};exports['countReScheduled']=function(_0x1b95dc){return client[_0x7208('0x3')](_0x7208('0x1c'),{'options':{'where':{'VoiceQueueId':_0x1b95dc['id']?_0x1b95dc['id']||null:null}},'log':_0x7208('0x1d')});};exports[_0x7208('0x1e')]=function(_0x245ee8){return function(){return client[_0x7208('0x3')](_0x7208('0x1f'),{'options':{'where':{'id':_0x245ee8},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')},{'model':_0x7208('0x20'),'as':_0x7208('0x21'),'attributes':['id',_0x7208('0x22')]},{'model':_0x7208('0x23'),'as':_0x7208('0x24'),'attributes':['id',_0x7208('0x22')]}],'raw':!![]},'log':_0x7208('0x25')});};};exports[_0x7208('0x26')]=function(_0x1416a4,_0x51bec2,_0x1c8c3f){return client['Request']('UpdateCmHopper',{'body':_0x1416a4,'options':{'where':{'id':_0x51bec2},'limit':_0x1c8c3f},'log':_0x7208('0x7')});};exports[_0x7208('0x27')]=function(_0x480ce3,_0x21f63d){return function(){return client[_0x7208('0x3')](_0x7208('0x28'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x480ce3,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))},'UserId':{'$in':_0x21f63d}},'order':[[_0x7208('0x13'),_0x7208('0x14')],['scheduledat',_0x7208('0x14')],['id',_0x7208('0x16')]],'include':[{'model':_0x7208('0x5'),'as':'Contact'},{'model':'User','as':_0x7208('0x21'),'attributes':['id',_0x7208('0x22'),_0x7208('0x29')]}],'group':_0x7208('0x2a'),'raw':!![]},'log':_0x7208('0x12')});};};exports[_0x7208('0x2b')]=function(_0x212a67,_0x5b7da4){return client['Request']('ResetActiveCalls',{'body':_0x212a67,'options':_0x5b7da4||{},'log':_0x7208('0x2c')});};exports[_0x7208('0x2d')]=function(_0xb6da62,_0x31432e,_0x3d449e){return function(){return client[_0x7208('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xb6da62,'interval':_0x31432e,'availableAgentsIds':_0x3d449e}},'log':_0x7208('0x2d')});};}; \ No newline at end of file +var _0xfb82=['voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','DESC','scheduledat','ASC','priority','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','countReScheduled','getContactPreview','GetCmHopperPreview','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','GetContactRecallMe','User'];(function(_0x3a315a,_0x5cadfa){var _0x5241da=function(_0x4b51c9){while(--_0x4b51c9){_0x3a315a['push'](_0x3a315a['shift']());}};_0x5241da(++_0x5cadfa);}(_0xfb82,0x17f));var _0x2fb8=function(_0x521027,_0x666437){_0x521027=_0x521027-0x0;var _0x11bab4=_0xfb82[_0x521027];return _0x11bab4;};'use strict';var client=require(_0x2fb8('0x0'));var moment=require(_0x2fb8('0x1'));exports[_0x2fb8('0x2')]=function(_0x5893e0,_0x316a4d){return function(){return client[_0x2fb8('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x5893e0},'include':[{'model':_0x2fb8('0x4'),'as':_0x2fb8('0x5')}],'limit':_0x316a4d,'raw':![]},'log':_0x2fb8('0x6')});};};exports[_0x2fb8('0x7')]=function(_0x996707,_0xe9a5b5,_0x3e6900){return function(){return client[_0x2fb8('0x3')](_0x2fb8('0x8'),{'body':_0x996707,'options':{'where':{'VoiceQueueId':_0xe9a5b5,'scheduledat':{'$lte':moment()[_0x2fb8('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x3e6900},'log':_0x2fb8('0x8')});};};exports[_0x2fb8('0xa')]=function(_0x428626){return client[_0x2fb8('0x3')](_0x2fb8('0x8'),{'body':_0x428626,'options':{'where':{'ContactId':_0x428626[_0x2fb8('0xb')],'ListId':_0x428626[_0x2fb8('0xc')],'VoiceQueueId':_0x428626[_0x2fb8('0xd')],'CampaignId':_0x428626[_0x2fb8('0xe')]}},'log':_0x2fb8('0xa')});};exports[_0x2fb8('0xf')]=function(_0x55bcfc,_0x1d49d4,_0xd07c60){return function(){return client[_0x2fb8('0x3')](_0x2fb8('0x10'),{'options':{'where':{'VoiceQueueId':_0x55bcfc,'ListId':_0x1d49d4,'ContactId':_0xd07c60}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x35e23b,_0x50f36f,_0x17fea6,_0x4e70f9){return client['Request'](_0x2fb8('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x35e23b,'active':![],'scheduledat':{'$lte':moment()[_0x2fb8('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x50f36f}}]},'order':[['priority',_0x2fb8('0x12')],[_0x2fb8('0x13'),_0x4e70f9],['id',_0x2fb8('0x14')]],'raw':!![],'limit':_0x17fea6},'log':_0x2fb8('0x11')});};exports['getContactDialerIvr']=function(_0x3fda1b,_0x34f43b,_0x48296c){return client[_0x2fb8('0x3')](_0x2fb8('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3fda1b,'active':![],'scheduledat':{'$lte':moment()[_0x2fb8('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':_0x2fb8('0x5')}],'order':[[_0x2fb8('0x15'),_0x2fb8('0x12')],[_0x2fb8('0x13'),_0x48296c],['id','ASC']],'raw':!![],'limit':_0x34f43b},'log':_0x2fb8('0x16')});};exports[_0x2fb8('0x17')]=function(_0x1aa17e,_0x18f5ed){_0x1aa17e[_0x2fb8('0x18')]=_0x1aa17e['queue'];return client[_0x2fb8('0x3')](_0x2fb8('0x19'),{'body':_0x1aa17e,'options':{'where':{'ContactId':_0x1aa17e[_0x2fb8('0xb')],'ListId':_0x1aa17e['ListId'],'VoiceQueueId':_0x1aa17e['VoiceQueueId'],'CampaignId':_0x1aa17e[_0x2fb8('0xe')],'active':_0x18f5ed?undefined:!![]}},'log':_0x2fb8('0x19')});};exports[_0x2fb8('0x1a')]=function(_0x2f8cc9){return client[_0x2fb8('0x3')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x2f8cc9['id']?_0x2f8cc9['id']||null:null}},'log':_0x2fb8('0x1a')});};exports[_0x2fb8('0x1b')]=function(_0x3f3399){return function(){return client[_0x2fb8('0x3')](_0x2fb8('0x1c'),{'options':{'where':{'id':_0x3f3399},'include':[{'model':_0x2fb8('0x4'),'as':_0x2fb8('0x5')},{'model':'User','as':_0x2fb8('0x1d'),'attributes':['id','name']},{'model':_0x2fb8('0x1e'),'as':_0x2fb8('0x1f'),'attributes':['id',_0x2fb8('0x20')]}],'raw':!![]},'log':_0x2fb8('0x6')});};};exports[_0x2fb8('0x21')]=function(_0x2b779c,_0x98892e,_0x1a3394){return client[_0x2fb8('0x3')](_0x2fb8('0x8'),{'body':_0x2b779c,'options':{'where':{'id':_0x98892e},'limit':_0x1a3394},'log':_0x2fb8('0x8')});};exports[_0x2fb8('0x22')]=function(_0x462937,_0x3ddafb){return function(){return client[_0x2fb8('0x3')](_0x2fb8('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x462937,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x3ddafb}},'order':[[_0x2fb8('0x15'),_0x2fb8('0x12')],['scheduledat','DESC'],['id',_0x2fb8('0x14')]],'include':[{'model':'CmContact','as':'Contact'},{'model':_0x2fb8('0x24'),'as':_0x2fb8('0x1d'),'attributes':['id',_0x2fb8('0x20'),_0x2fb8('0x25')]}],'group':_0x2fb8('0x26'),'raw':!![]},'log':_0x2fb8('0x11')});};};exports[_0x2fb8('0x27')]=function(_0x3df324,_0x4a9e3b){return client['Request'](_0x2fb8('0x28'),{'body':_0x3df324,'options':_0x4a9e3b||{},'log':_0x2fb8('0x28')});};exports[_0x2fb8('0x29')]=function(_0x3aa43a,_0x19d360,_0x21ee52){return function(){return client[_0x2fb8('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3aa43a,'interval':_0x19d360,'availableAgentsIds':_0x21ee52}},'log':_0x2fb8('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 4f06590..5f2ffa6 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b0a=['SwapAdditionalPhones','incrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9b0a,0x144));var _0xa9b0=function(_0x216e07,_0x59581a){_0x216e07=_0x216e07-0x0;var _0x73b29f=_0x9b0a[_0x216e07];return _0x73b29f;};'use strict';var client=require(_0xa9b0('0x0'));exports[_0xa9b0('0x1')]=function(_0x416442,_0x365b59,_0x11e9d3){return client[_0xa9b0('0x2')](_0xa9b0('0x3'),{'body':_0x416442,'reason':_0x365b59,'entity':_0x11e9d3,'log':'VerifyAdditionalPhones'});};exports[_0xa9b0('0x4')]=function(_0x1481fb,_0x319f1c,_0x1d882c){return client[_0xa9b0('0x2')](_0xa9b0('0x5'),{'body':_0x1481fb,'duration':_0x319f1c,'waitTime':_0x1d882c,'log':_0xa9b0('0x5')});};exports[_0xa9b0('0x6')]=function(_0x59237b){return function(){return client[_0xa9b0('0x2')]('IncrementPreviewCounters',{'body':_0x59237b,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0x0085=['IncrementPreviewCounters','../client','Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0085,0x79));var _0x5008=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x0085[_0x22f75e];return _0x1f6ab3;};'use strict';var client=require(_0x5008('0x0'));exports['verifyAdditionalPhones']=function(_0x9b41e6,_0x3db307,_0x4efc7c){return client[_0x5008('0x1')](_0x5008('0x2'),{'body':_0x9b41e6,'reason':_0x3db307,'entity':_0x4efc7c,'log':_0x5008('0x2')});};exports['swapAdditionalPhones']=function(_0x4f7f60,_0x5e6587,_0x21c5db){return client[_0x5008('0x1')]('SwapAdditionalPhones',{'body':_0x4f7f60,'duration':_0x5e6587,'waitTime':_0x21c5db,'log':_0x5008('0x3')});};exports[_0x5008('0x4')]=function(_0x4f3139){return function(){return client[_0x5008('0x1')]('IncrementPreviewCounters',{'body':_0x4f3139,'log':_0x5008('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index aea44f7..d6f43c1 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x541a=['GetCmHopperBlack','checkIsBlackListIvr','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','VoiceQueueId','phone'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0x541a,0x16b));var _0xa541=function(_0x5f139c,_0x34abe0){_0x5f139c=_0x5f139c-0x0;var _0xd3bd61=_0x541a[_0x5f139c];return _0xd3bd61;};'use strict';var client=require(_0xa541('0x0'));exports[_0xa541('0x1')]=function(_0x5d002e){return client[_0xa541('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x5d002e[_0xa541('0x3')],'phone':_0x5d002e[_0xa541('0x4')]},'raw':![]},'log':_0xa541('0x5')});};exports[_0xa541('0x6')]=function(_0x2dd410){return client[_0xa541('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x2dd410['CampaignId'],'phone':_0x2dd410['phone']},'raw':![]},'log':_0xa541('0x7')});}; \ No newline at end of file +var _0x120c=['VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x3af093,_0x408050){var _0x155441=function(_0x46267d){while(--_0x46267d){_0x3af093['push'](_0x3af093['shift']());}};_0x155441(++_0x408050);}(_0x120c,0x101));var _0xc120=function(_0xe383d0,_0x17b254){_0xe383d0=_0xe383d0-0x0;var _0x44ac7c=_0x120c[_0xe383d0];return _0x44ac7c;};'use strict';var client=require(_0xc120('0x0'));exports[_0xc120('0x1')]=function(_0x229bf8){return client[_0xc120('0x2')](_0xc120('0x3'),{'options':{'where':{'VoiceQueueId':_0x229bf8[_0xc120('0x4')],'phone':_0x229bf8[_0xc120('0x5')]},'raw':![]},'log':_0xc120('0x3')});};exports[_0xc120('0x6')]=function(_0x2294a8){return client[_0xc120('0x2')](_0xc120('0x3'),{'options':{'where':{'CampaignId':_0x2294a8[_0xc120('0x7')],'phone':_0x2294a8[_0xc120('0x5')]},'raw':![]},'log':_0xc120('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index a9d5982..1f284f8 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a55=['../client','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x9a55,0x13b));var _0x59a5=function(_0x43ecc4,_0x565ff6){_0x43ecc4=_0x43ecc4-0x0;var _0x39c2cd=_0x9a55[_0x43ecc4];return _0x39c2cd;};'use strict';var client=require(_0x59a5('0x0'));exports['createContact']=function(_0x1f490c){return function(){_0x1f490c[_0x59a5('0x1')]=_0x1f490c[_0x59a5('0x2')];return client[_0x59a5('0x3')](_0x59a5('0x4'),{'body':_0x1f490c,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xe569=['Request','CreateCmHopperFinal','../client','createContact','campaign','queue'];(function(_0x3e380e,_0x5d136a){var _0x4b08e5=function(_0x3e461a){while(--_0x3e461a){_0x3e380e['push'](_0x3e380e['shift']());}};_0x4b08e5(++_0x5d136a);}(_0xe569,0x110));var _0x9e56=function(_0x2332e1,_0x433415){_0x2332e1=_0x2332e1-0x0;var _0x2c3bda=_0xe569[_0x2332e1];return _0x2c3bda;};'use strict';var client=require(_0x9e56('0x0'));exports[_0x9e56('0x1')]=function(_0x133854){return function(){_0x133854[_0x9e56('0x2')]=_0x133854[_0x9e56('0x3')];return client[_0x9e56('0x4')]('CreateCmHopperFinal',{'body':_0x133854,'log':_0x9e56('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 0248dd9..8cab51c 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x986e=['format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','startOf','day','endOf','queue','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x986e,0xb4));var _0xe986=function(_0x635036,_0x5e542d){_0x635036=_0x635036-0x0;var _0x477e47=_0x986e[_0x635036];return _0x477e47;};'use strict';var client=require(_0xe986('0x0'));var moment=require(_0xe986('0x1'));exports[_0xe986('0x2')]=function(_0x2a1e79){_0x2a1e79[_0xe986('0x3')]=_0x2a1e79['queue'];return client[_0xe986('0x4')](_0xe986('0x5'),{'body':_0x2a1e79,'log':_0xe986('0x5')});};exports[_0xe986('0x6')]=function(_0x4d8b4d){return client[_0xe986('0x4')](_0xe986('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xe986('0x8')](_0x4d8b4d,_0xe986('0x9'))[_0xe986('0xa')](_0xe986('0xb')),moment()[_0xe986('0xa')](_0xe986('0xb'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0xe986('0xc')]=function(){return function(){return client['Request']('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xe986('0xd')](_0xe986('0xe'))['format'](_0xe986('0xb')),moment()[_0xe986('0xf')](_0xe986('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xe986('0x10')},'raw':![]},'log':_0xe986('0x11')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0xe986('0x4')](_0xe986('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xe986('0xe'))[_0xe986('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xe986('0xe'))[_0xe986('0xa')](_0xe986('0xb'))]},'campaigntype':'ivr'},'raw':![]},'log':_0xe986('0x12')});};}; \ No newline at end of file +var _0x8dd6=['queue','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','getCampaignHopperHistory','GetCampaignHopperHistory','YYYY-MM-DD\x20HH:mm:ss','ivr','../client','createHistory','campaign'];(function(_0x25db49,_0x28f4f5){var _0x5163ba=function(_0x34b6ec){while(--_0x34b6ec){_0x25db49['push'](_0x25db49['shift']());}};_0x5163ba(++_0x28f4f5);}(_0x8dd6,0x19f));var _0x68dd=function(_0x1996b1,_0x2818d0){_0x1996b1=_0x1996b1-0x0;var _0x5c6fcf=_0x8dd6[_0x1996b1];return _0x5c6fcf;};'use strict';var client=require(_0x68dd('0x0'));var moment=require('moment');exports[_0x68dd('0x1')]=function(_0x332d64){_0x332d64[_0x68dd('0x2')]=_0x332d64[_0x68dd('0x3')];return client[_0x68dd('0x4')](_0x68dd('0x5'),{'body':_0x332d64,'log':_0x68dd('0x5')});};exports[_0x68dd('0x6')]=function(_0x5d05c7){return client[_0x68dd('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x68dd('0x7')](_0x5d05c7,_0x68dd('0x8'))[_0x68dd('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x68dd('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0x68dd('0xa')});};exports[_0x68dd('0xb')]=function(){return function(){return client[_0x68dd('0x4')](_0x68dd('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x68dd('0xd')](_0x68dd('0xe'))[_0x68dd('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x68dd('0xe'))[_0x68dd('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x68dd('0x3')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x68dd('0xf')]=function(){return function(){return client[_0x68dd('0x4')](_0x68dd('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x68dd('0xd')]('day')[_0x68dd('0x9')](_0x68dd('0x11')),moment()['endOf']('day')[_0x68dd('0x9')](_0x68dd('0x11'))]},'campaigntype':_0x68dd('0x12')},'raw':![]},'log':_0x68dd('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 51d08ae..9d84292 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef4d=['modem','gateway','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xef4d,0x165));var _0xdef4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xef4d[_0x3c2a69];return _0x596bc8;};'use strict';var client=require(_0xdef4('0x0'));exports[_0xdef4('0x1')]=function(){return function(){return client[_0xdef4('0x2')](_0xdef4('0x3'),{'options':{'raw':![],'attributes':['id',_0xdef4('0x4'),_0xdef4('0x5'),_0xdef4('0x6'),_0xdef4('0x7'),_0xdef4('0x8'),_0xdef4('0x9'),_0xdef4('0xa'),_0xdef4('0xb'),_0xdef4('0xc'),'faxdetect',_0xdef4('0xd'),_0xdef4('0xe'),_0xdef4('0xf'),_0xdef4('0x10'),_0xdef4('0x11')],'include':[{'model':_0xdef4('0x12'),'as':_0xdef4('0x12'),'attributes':['id',_0xdef4('0x4'),_0xdef4('0x13'),'active']}]},'log':_0xdef4('0x14')});};};exports[_0xdef4('0x15')]=function(_0x35c826,_0x3fa15d){return client[_0xdef4('0x2')](_0xdef4('0x16'),{'account':{'id':_0x35c826},'body':_0x3fa15d,'log':_0xdef4('0x16')});}; \ No newline at end of file +var _0x431b=['Request','name','description','ecm','headerinfo','localstationid','minrate','maxrate','gateway','t38timeout','ListId','Trunk','callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts'];(function(_0xb60ae4,_0x48b458){var _0x53d530=function(_0x5c0743){while(--_0x5c0743){_0xb60ae4['push'](_0xb60ae4['shift']());}};_0x53d530(++_0x48b458);}(_0x431b,0x18d));var _0xb431=function(_0x1d130e,_0x314633){_0x1d130e=_0x1d130e-0x0;var _0x156c2f=_0x431b[_0x1d130e];return _0x156c2f;};'use strict';var client=require(_0xb431('0x0'));exports[_0xb431('0x1')]=function(){return function(){return client[_0xb431('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xb431('0x3'),_0xb431('0x4'),_0xb431('0x5'),_0xb431('0x6'),_0xb431('0x7'),_0xb431('0x8'),_0xb431('0x9'),'modem',_0xb431('0xa'),'faxdetect',_0xb431('0xb'),'tech','TrunkId',_0xb431('0xc'),'key'],'include':[{'model':'Trunk','as':_0xb431('0xd'),'attributes':['id',_0xb431('0x3'),_0xb431('0xe'),_0xb431('0xf')]}]},'log':_0xb431('0x10')});};};exports[_0xb431('0x11')]=function(_0x413c63,_0x492f5c){return client[_0xb431('0x2')](_0xb431('0x12'),{'account':{'id':_0x413c63},'body':_0x492f5c,'log':_0xb431('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 403f3be..7663b52 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x028a=['../client','update','UpdateFaxMessage'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x028a,0x84));var _0xa028=function(_0x489efc,_0x2449eb){_0x489efc=_0x489efc-0x0;var _0x44c521=_0x028a[_0x489efc];return _0x44c521;};'use strict';var client=require(_0xa028('0x0'));exports[_0xa028('0x1')]=function(_0x5926bd,_0x5b48f2){return client['Request'](_0xa028('0x2'),{'body':_0x5b48f2,'options':{'where':{'AttachmentId':_0x5926bd}},'log':_0xa028('0x2')});}; \ No newline at end of file +var _0xcd97=['../client','update','Request','UpdateFaxMessage'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0xcd97,0x1d0));var _0x7cd9=function(_0x28be72,_0x2b83af){_0x28be72=_0x28be72-0x0;var _0x46c5da=_0xcd97[_0x28be72];return _0x46c5da;};'use strict';var client=require(_0x7cd9('0x0'));exports[_0x7cd9('0x1')]=function(_0xdee122,_0x222a72){return client[_0x7cd9('0x2')](_0x7cd9('0x3'),{'body':_0x222a72,'options':{'where':{'AttachmentId':_0xdee122}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index fb0c409..f6b27a9 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdeb=['content','variableName','Variable','DeskField','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','Tags','../../client','getDeskAccounts','Request','name','description','username','remoteUri','serverUrl','DeskConfiguration','Configurations','Subjects','type'];(function(_0x51019f,_0x57c7b1){var _0x354cc0=function(_0x97cd6c){while(--_0x97cd6c){_0x51019f['push'](_0x51019f['shift']());}};_0x354cc0(++_0x57c7b1);}(_0xbdeb,0x194));var _0xbbde=function(_0x5638cc,_0x240781){_0x5638cc=_0x5638cc-0x0;var _0x475e9a=_0xbdeb[_0x5638cc];return _0x475e9a;};'use strict';var client=require(_0xbbde('0x0'));exports[_0xbbde('0x1')]=function(){return function(_0x2bfeb5){return client[_0xbbde('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xbbde('0x3'),_0xbbde('0x4'),_0xbbde('0x5'),'password',_0xbbde('0x6'),'authType','type',_0xbbde('0x7')],'include':[{'model':_0xbbde('0x8'),'as':_0xbbde('0x9'),'attributes':['id',_0xbbde('0x3')],'include':[{'model':'DeskField','as':_0xbbde('0xa'),'attributes':['id',_0xbbde('0xb'),_0xbbde('0xc'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':_0xbbde('0xe'),'attributes':['id','name']}]},{'model':_0xbbde('0xf'),'as':_0xbbde('0x10'),'attributes':['id',_0xbbde('0xb'),'content',_0xbbde('0x11'),_0xbbde('0x12'),_0xbbde('0x13'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':_0xbbde('0xe'),'attributes':['id',_0xbbde('0x3')]}]},{'model':_0xbbde('0xf'),'as':_0xbbde('0x14'),'attributes':['id','type',_0xbbde('0xc'),_0xbbde('0x15'),_0xbbde('0x16'),_0xbbde('0x17'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':'Variable','attributes':['id','name']}]},{'model':_0xbbde('0x18'),'as':_0xbbde('0x19'),'attributes':['id',_0xbbde('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x3b09=['remoteUri','authType','type','DeskConfiguration','Configurations','DeskField','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','GetDeskAccount','name','description','username','password'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x3b09,0x6d));var _0x93b0=function(_0x332862,_0x374c82){_0x332862=_0x332862-0x0;var _0xa37e14=_0x3b09[_0x332862];return _0xa37e14;};'use strict';var client=require(_0x93b0('0x0'));exports['getDeskAccounts']=function(){return function(_0x3314db){return client['Request'](_0x93b0('0x1'),{'options':{'raw':![],'attributes':['id',_0x93b0('0x2'),_0x93b0('0x3'),_0x93b0('0x4'),_0x93b0('0x5'),_0x93b0('0x6'),_0x93b0('0x7'),_0x93b0('0x8'),'serverUrl'],'include':[{'model':_0x93b0('0x9'),'as':_0x93b0('0xa'),'attributes':['id','name'],'include':[{'model':_0x93b0('0xb'),'as':'Subjects','attributes':['id',_0x93b0('0x8'),_0x93b0('0xc'),_0x93b0('0xd')],'include':[{'model':_0x93b0('0xe'),'as':_0x93b0('0xe'),'attributes':['id',_0x93b0('0x2')]}]},{'model':_0x93b0('0xb'),'as':_0x93b0('0xf'),'attributes':['id',_0x93b0('0x8'),_0x93b0('0xc'),'key',_0x93b0('0x10'),_0x93b0('0x11'),_0x93b0('0xd')],'include':[{'model':'Variable','as':_0x93b0('0xe'),'attributes':['id',_0x93b0('0x2')]}]},{'model':_0x93b0('0xb'),'as':_0x93b0('0x12'),'attributes':['id',_0x93b0('0x8'),'content',_0x93b0('0x13'),'nameField',_0x93b0('0x14'),_0x93b0('0xd')],'include':[{'model':_0x93b0('0xe'),'as':_0x93b0('0xe'),'attributes':['id','name']}]},{'model':_0x93b0('0x15'),'as':_0x93b0('0x16'),'attributes':['id',_0x93b0('0x2')]}]}]},'log':_0x93b0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 421501b..7b967d8 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd6f=['tenantId','clientSecret','serverUrl','description','modernAuthentication','Configurations','name','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','Variable','type','keyType','keyContent','variableName','Fields','idField','nameField','CloudProvider','data2','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','username','password','remoteUri'];(function(_0x5b78f3,_0x3d9ed7){var _0x8c221=function(_0x2d7e5e){while(--_0x2d7e5e){_0x5b78f3['push'](_0x5b78f3['shift']());}};_0x8c221(++_0x3d9ed7);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5ed58e,_0x5477ee){_0x5ed58e=_0x5ed58e-0x0;var _0x318863=_0xfd6f[_0x5ed58e];return _0x318863;};'use strict';var client=require(_0xffd6('0x0'));exports[_0xffd6('0x1')]=function(){return function(_0x29b163){return client[_0xffd6('0x2')](_0xffd6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xffd6('0x4'),_0xffd6('0x5'),_0xffd6('0x6'),_0xffd6('0x7'),'clientId',_0xffd6('0x8'),_0xffd6('0x9'),_0xffd6('0xa'),_0xffd6('0xb')],'include':[{'model':'Dynamics365Configuration','as':_0xffd6('0xc'),'attributes':['id',_0xffd6('0xd'),'ticketType','moduleCreate',_0xffd6('0xe'),_0xffd6('0xf')],'include':[{'model':_0xffd6('0x10'),'as':_0xffd6('0x11'),'attributes':['id','type',_0xffd6('0x12'),'variableName'],'include':[{'model':'Variable','as':_0xffd6('0x13'),'attributes':['id',_0xffd6('0xd')]}]},{'model':_0xffd6('0x10'),'as':'Descriptions','attributes':['id',_0xffd6('0x14'),_0xffd6('0x12'),'key',_0xffd6('0x15'),_0xffd6('0x16'),_0xffd6('0x17')],'include':[{'model':_0xffd6('0x13'),'as':'Variable','attributes':['id','name']}]},{'model':_0xffd6('0x10'),'as':_0xffd6('0x18'),'attributes':['id',_0xffd6('0x14'),'content',_0xffd6('0x19'),_0xffd6('0x1a'),'customField',_0xffd6('0x17')],'include':[{'model':'Variable','as':_0xffd6('0x13'),'attributes':['id',_0xffd6('0xd')]}]}]},{'model':_0xffd6('0x1b'),'as':_0xffd6('0x1b'),'attributes':['id',_0xffd6('0x1c'),'data5',_0xffd6('0x1d')]}]},'log':_0xffd6('0x3')});};}; \ No newline at end of file +var _0x56bd=['keyType','keyContent','variableName','idField','nameField','customField','CloudProvider','data2','data5','getDynamics365Accounts','Request','name','username','password','remoteUri','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','type','content','Variable','Dynamics365Field','Descriptions','key'];(function(_0x2d9351,_0x5ea4a6){var _0x52b495=function(_0x4dfad7){while(--_0x4dfad7){_0x2d9351['push'](_0x2d9351['shift']());}};_0x52b495(++_0x5ea4a6);}(_0x56bd,0xe9));var _0xd56b=function(_0x182698,_0x431017){_0x182698=_0x182698-0x0;var _0x26be6f=_0x56bd[_0x182698];return _0x26be6f;};'use strict';var client=require('../../client');exports[_0xd56b('0x0')]=function(){return function(_0x2535c1){return client[_0xd56b('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xd56b('0x2'),_0xd56b('0x3'),_0xd56b('0x4'),_0xd56b('0x5'),'tenantId',_0xd56b('0x6'),_0xd56b('0x7'),_0xd56b('0x8'),_0xd56b('0x9'),_0xd56b('0xa')],'include':[{'model':_0xd56b('0xb'),'as':_0xd56b('0xc'),'attributes':['id','name',_0xd56b('0xd'),_0xd56b('0xe'),_0xd56b('0xf'),_0xd56b('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),'variableName'],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':_0xd56b('0x15'),'attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),_0xd56b('0x16'),_0xd56b('0x17'),_0xd56b('0x18'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':'Fields','attributes':['id',_0xd56b('0x11'),'content',_0xd56b('0x1a'),_0xd56b('0x1b'),_0xd56b('0x1c'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]}]},{'model':_0xd56b('0x1d'),'as':_0xd56b('0x1d'),'attributes':['id',_0xd56b('0x1e'),_0xd56b('0x1f'),'data7']}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 8119e1f..e75975f 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeffd=['FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','nameField','customField','../../client','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xeffd,0x6b));var _0xdeff=function(_0x4bf174,_0x2fc65a){_0x4bf174=_0x4bf174-0x0;var _0x5853fc=_0xeffd[_0x4bf174];return _0x5853fc;};'use strict';var client=require(_0xdeff('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x1f45fd){return client[_0xdeff('0x1')](_0xdeff('0x2'),{'options':{'raw':![],'attributes':['id',_0xdeff('0x3'),_0xdeff('0x4'),_0xdeff('0x5'),_0xdeff('0x6'),_0xdeff('0x7')],'include':[{'model':_0xdeff('0x8'),'as':_0xdeff('0x9'),'attributes':['id',_0xdeff('0x3')],'include':[{'model':_0xdeff('0xa'),'attributes':['id',_0xdeff('0x3')]},{'model':_0xdeff('0xb'),'as':_0xdeff('0xc'),'attributes':['id',_0xdeff('0xd'),_0xdeff('0xe'),'variableName'],'include':[{'model':_0xdeff('0xf'),'as':_0xdeff('0xf'),'attributes':['id',_0xdeff('0x3')]}]},{'model':'FreshdeskField','as':_0xdeff('0x10'),'attributes':['id',_0xdeff('0xd'),_0xdeff('0xe'),_0xdeff('0x11'),_0xdeff('0x12'),_0xdeff('0x13'),_0xdeff('0x14')],'include':[{'model':_0xdeff('0xf'),'as':'Variable','attributes':['id',_0xdeff('0x3')]}]},{'model':_0xdeff('0xb'),'as':'Fields','attributes':['id',_0xdeff('0xd'),'content','idField',_0xdeff('0x15'),_0xdeff('0x16'),_0xdeff('0x14')],'include':[{'model':_0xdeff('0xf'),'as':'Variable','attributes':['id',_0xdeff('0x3')]}]}]}]},'log':_0xdeff('0x2')});};}; \ No newline at end of file +var _0xa958=['variableName','Variable','Descriptions','key','keyContent','Fields','idField','customField','../../client','Request','GetFreshdeskAccount','name','username','apiKey','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','content'];(function(_0x36b3d0,_0x5694e7){var _0x28a496=function(_0x30610b){while(--_0x30610b){_0x36b3d0['push'](_0x36b3d0['shift']());}};_0x28a496(++_0x5694e7);}(_0xa958,0x94));var _0x8a95=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa958[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x8a95('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x3f9109){return client[_0x8a95('0x1')](_0x8a95('0x2'),{'options':{'raw':![],'attributes':['id',_0x8a95('0x3'),_0x8a95('0x4'),_0x8a95('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x8a95('0x6'),'as':_0x8a95('0x7'),'attributes':['id',_0x8a95('0x3')],'include':[{'model':_0x8a95('0x8'),'attributes':['id',_0x8a95('0x3')]},{'model':_0x8a95('0x9'),'as':_0x8a95('0xa'),'attributes':['id','type',_0x8a95('0xb'),_0x8a95('0xc')],'include':[{'model':_0x8a95('0xd'),'as':_0x8a95('0xd'),'attributes':['id',_0x8a95('0x3')]}]},{'model':_0x8a95('0x9'),'as':_0x8a95('0xe'),'attributes':['id','type',_0x8a95('0xb'),_0x8a95('0xf'),'keyType',_0x8a95('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x8a95('0xd'),'attributes':['id','name']}]},{'model':_0x8a95('0x9'),'as':_0x8a95('0x11'),'attributes':['id','type',_0x8a95('0xb'),_0x8a95('0x12'),'nameField',_0x8a95('0x13'),_0x8a95('0xc')],'include':[{'model':_0x8a95('0xd'),'as':_0x8a95('0xd'),'attributes':['id',_0x8a95('0x3')]}]}]}]},'log':_0x8a95('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index b44a8a8..ef5f89d 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf98=['type','content','variableName','Descriptions','key','keyType','keyContent','Variable','GetFreshsalesccount','../../client','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdf98,0xcf));var _0x8df9=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0xdf98[_0x1ffff7];return _0x49d017;};'use strict';var client=require(_0x8df9('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x1f9abd){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x8df9('0x1'),_0x8df9('0x2'),_0x8df9('0x3'),_0x8df9('0x4'),_0x8df9('0x5')],'include':[{'model':_0x8df9('0x6'),'as':_0x8df9('0x7'),'attributes':['id',_0x8df9('0x1')],'include':[{'model':_0x8df9('0x8'),'as':'Subjects','attributes':['id',_0x8df9('0x9'),_0x8df9('0xa'),_0x8df9('0xb')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x8df9('0x1')]}]},{'model':'FreshsalesField','as':_0x8df9('0xc'),'attributes':['id',_0x8df9('0x9'),_0x8df9('0xa'),_0x8df9('0xd'),_0x8df9('0xe'),_0x8df9('0xf'),_0x8df9('0xb')],'include':[{'model':_0x8df9('0x10'),'as':'Variable','attributes':['id',_0x8df9('0x1')]}]}]}]},'log':_0x8df9('0x11')});};}; \ No newline at end of file +var _0x0309=['username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','FreshsalesField','Subjects','content','Variable','Descriptions','type','keyType','keyContent','variableName','GetFreshsalesccount','../../client','GetFreshsalesAccount','name'];(function(_0x48163a,_0x27ccc){var _0x2aaeda=function(_0x3dfcbe){while(--_0x3dfcbe){_0x48163a['push'](_0x48163a['shift']());}};_0x2aaeda(++_0x27ccc);}(_0x0309,0x165));var _0x9030=function(_0x2b4186,_0x4fa2b1){_0x2b4186=_0x2b4186-0x0;var _0x1b074b=_0x0309[_0x2b4186];return _0x1b074b;};'use strict';var client=require(_0x9030('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x19fdcc){return client['Request'](_0x9030('0x1'),{'options':{'raw':![],'attributes':['id',_0x9030('0x2'),_0x9030('0x3'),_0x9030('0x4'),_0x9030('0x5'),_0x9030('0x6')],'include':[{'model':_0x9030('0x7'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x9030('0x8'),'as':_0x9030('0x9'),'attributes':['id','type',_0x9030('0xa'),'variableName'],'include':[{'model':_0x9030('0xb'),'as':_0x9030('0xb'),'attributes':['id',_0x9030('0x2')]}]},{'model':'FreshsalesField','as':_0x9030('0xc'),'attributes':['id',_0x9030('0xd'),_0x9030('0xa'),'key',_0x9030('0xe'),_0x9030('0xf'),_0x9030('0x10')],'include':[{'model':_0x9030('0xb'),'as':_0x9030('0xb'),'attributes':['id',_0x9030('0x2')]}]}]}]},'log':_0x9030('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 81c8b3d..f3d85e3 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x349f=['clientSecret','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','SalesforceField','Subjects','Variable','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name','username','password','remoteUri','clientId'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x349f,0xa8));var _0xf349=function(_0x24a992,_0x5c49eb){_0x24a992=_0x24a992-0x0;var _0x26e1d4=_0x349f[_0x24a992];return _0x26e1d4;};'use strict';var client=require(_0xf349('0x0'));exports[_0xf349('0x1')]=function(){return function(_0x3a3487){return client['Request'](_0xf349('0x2'),{'options':{'raw':![],'attributes':['id',_0xf349('0x3'),_0xf349('0x4'),_0xf349('0x5'),_0xf349('0x6'),_0xf349('0x7'),_0xf349('0x8'),_0xf349('0x9'),_0xf349('0xa'),_0xf349('0xb')],'include':[{'model':'SalesforceConfiguration','as':_0xf349('0xc'),'attributes':['id',_0xf349('0x3'),_0xf349('0xd'),_0xf349('0xe'),_0xf349('0xf'),_0xf349('0x10'),_0xf349('0x11'),'additionalSearchContact','additionalSearchLead'],'include':[{'model':_0xf349('0x12'),'as':_0xf349('0x13'),'include':[{'model':_0xf349('0x14'),'as':_0xf349('0x14'),'attributes':['id',_0xf349('0x3')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':'Variable','as':_0xf349('0x14'),'attributes':['id',_0xf349('0x3')]}]},{'model':_0xf349('0x12'),'as':_0xf349('0x15'),'include':[{'model':_0xf349('0x14'),'as':'Variable','attributes':['id',_0xf349('0x3')]}]}]}]},'log':_0xf349('0x2')});};}; \ No newline at end of file +var _0x7bf2=['clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','password','clientId'];(function(_0x3fbc8f,_0xa5f43c){var _0x132201=function(_0x20a7e1){while(--_0x20a7e1){_0x3fbc8f['push'](_0x3fbc8f['shift']());}};_0x132201(++_0xa5f43c);}(_0x7bf2,0xc8));var _0x27bf=function(_0x2da2d1,_0x57bba4){_0x2da2d1=_0x2da2d1-0x0;var _0x5f47c4=_0x7bf2[_0x2da2d1];return _0x5f47c4;};'use strict';var client=require(_0x27bf('0x0'));exports[_0x27bf('0x1')]=function(){return function(_0x51337a){return client[_0x27bf('0x2')](_0x27bf('0x3'),{'options':{'raw':![],'attributes':['id',_0x27bf('0x4'),'username',_0x27bf('0x5'),'remoteUri',_0x27bf('0x6'),_0x27bf('0x7'),_0x27bf('0x8'),_0x27bf('0x9'),_0x27bf('0xa')],'include':[{'model':_0x27bf('0xb'),'as':_0x27bf('0xc'),'attributes':['id',_0x27bf('0x4'),_0x27bf('0xd'),_0x27bf('0xe'),_0x27bf('0xf'),'leadId','additionalSearchAccount',_0x27bf('0x10'),_0x27bf('0x11')],'include':[{'model':_0x27bf('0x12'),'as':_0x27bf('0x13'),'include':[{'model':_0x27bf('0x14'),'as':'Variable','attributes':['id',_0x27bf('0x4')]}]},{'model':_0x27bf('0x12'),'as':_0x27bf('0x15'),'include':[{'model':_0x27bf('0x14'),'as':_0x27bf('0x14'),'attributes':['id',_0x27bf('0x4')]}]},{'model':'SalesforceField','as':_0x27bf('0x16'),'include':[{'model':_0x27bf('0x14'),'as':_0x27bf('0x14'),'attributes':['id','name']}]}]}]},'log':_0x27bf('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 78d799f..31a04de 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyContent','Fields'];(function(_0x4e33c0,_0x555fda){var _0x1f7aa3=function(_0x2b688b){while(--_0x2b688b){_0x4e33c0['push'](_0x4e33c0['shift']());}};_0x1f7aa3(++_0x555fda);}(_0xf494,0x1c6));var _0x4f49=function(_0x41e51b,_0x4bc6f2){_0x41e51b=_0x41e51b-0x0;var _0x38fbc2=_0xf494[_0x41e51b];return _0x38fbc2;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(_0x3063f3){return client['Request'](_0x4f49('0x2'),{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9')],'include':[{'model':_0x4f49('0xa'),'as':_0x4f49('0xb'),'attributes':['id',_0x4f49('0x3')],'include':[{'model':'ServicenowField','as':'Subjects','attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0xe')],'include':[{'model':_0x4f49('0xf'),'as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':_0x4f49('0x10'),'as':_0x4f49('0x11'),'attributes':['id','type',_0x4f49('0xd'),_0x4f49('0x12'),'keyType',_0x4f49('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':'ServicenowField','as':_0x4f49('0x14'),'attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0x15'),_0x4f49('0x16'),_0x4f49('0x17'),_0x4f49('0xe')],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]}]}]},'log':_0x4f49('0x18')});};}; \ No newline at end of file +var _0x814b=['variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','ServicenowField','type','content'];(function(_0x3b10f2,_0x5d4930){var _0xce2eca=function(_0x25ad2c){while(--_0x25ad2c){_0x3b10f2['push'](_0x3b10f2['shift']());}};_0xce2eca(++_0x5d4930);}(_0x814b,0x1a2));var _0xb814=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x814b[_0x4456a2];return _0xf36b56;};'use strict';var client=require(_0xb814('0x0'));exports[_0xb814('0x1')]=function(){return function(_0x434f30){return client[_0xb814('0x2')](_0xb814('0x3'),{'options':{'raw':![],'attributes':['id',_0xb814('0x4'),'description',_0xb814('0x5'),_0xb814('0x6'),_0xb814('0x7'),_0xb814('0x8'),_0xb814('0x9')],'include':[{'model':_0xb814('0xa'),'as':'Configurations','attributes':['id',_0xb814('0x4')],'include':[{'model':_0xb814('0xb'),'as':'Subjects','attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0xe')],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]},{'model':_0xb814('0xb'),'as':_0xb814('0x10'),'attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0x11'),'keyType',_0xb814('0x12'),'variableName'],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]},{'model':_0xb814('0xb'),'as':_0xb814('0x13'),'attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0x14'),_0xb814('0x15'),_0xb814('0x16'),_0xb814('0xe')],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]}]}]},'log':_0xb814('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index ac5a541..f44808e 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0xda2d,0x102));var _0xdda2=function(_0x3e9c1b,_0x29f936){_0x3e9c1b=_0x3e9c1b-0x0;var _0x1a3e1f=_0xda2d[_0x3e9c1b];return _0x1a3e1f;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0x0295=['remoteUri','serverUrl','SugarcrmConfiguration','Configurations','name','SugarcrmField','Subjects','Variable','Descriptions','content','key','keyType','variableName','Fields','customField','GetSugarcrmAccount','../../client','Request','username','password'];(function(_0x35260c,_0x631d06){var _0x102e2b=function(_0x5ce2fe){while(--_0x5ce2fe){_0x35260c['push'](_0x35260c['shift']());}};_0x102e2b(++_0x631d06);}(_0x0295,0x1f0));var _0x5029=function(_0x5f5c59,_0x169b7c){_0x5f5c59=_0x5f5c59-0x0;var _0x5a5f48=_0x0295[_0x5f5c59];return _0x5a5f48;};'use strict';var client=require(_0x5029('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0x5e71d0){return client[_0x5029('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5')],'include':[{'model':_0x5029('0x6'),'as':_0x5029('0x7'),'attributes':['id',_0x5029('0x8')],'include':[{'model':_0x5029('0x9'),'as':_0x5029('0xa'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x5029('0xb'),'as':'Variable','attributes':['id',_0x5029('0x8')]}]},{'model':'SugarcrmField','as':_0x5029('0xc'),'attributes':['id','type',_0x5029('0xd'),_0x5029('0xe'),_0x5029('0xf'),'keyContent',_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id','name']}]},{'model':_0x5029('0x9'),'as':_0x5029('0x11'),'attributes':['id','type','content','idField','nameField',_0x5029('0x12'),_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id',_0x5029('0x8')]}]}]}]},'log':_0x5029('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 68b75ba..41ec68e 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x790c=['Request','description','username','remoteUri','Configurations','VtigerField','type','content','variableName','Variable','name','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getVtigerAccounts'];(function(_0x537702,_0x156ad5){var _0x13aa9e=function(_0x6536c5){while(--_0x6536c5){_0x537702['push'](_0x537702['shift']());}};_0x13aa9e(++_0x156ad5);}(_0x790c,0x102));var _0xc790=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x790c[_0x2f87cd];return _0x5d7eda;};'use strict';var client=require(_0xc790('0x0'));exports[_0xc790('0x1')]=function(){return function(_0x292829){return client[_0xc790('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name',_0xc790('0x3'),_0xc790('0x4'),'accessKey',_0xc790('0x5'),'serverUrl'],'include':[{'model':'VtigerConfiguration','as':_0xc790('0x6'),'attributes':['id','name'],'include':[{'model':_0xc790('0x7'),'as':'Subjects','attributes':['id',_0xc790('0x8'),_0xc790('0x9'),_0xc790('0xa')],'include':[{'model':_0xc790('0xb'),'as':_0xc790('0xb'),'attributes':['id',_0xc790('0xc')]}]},{'model':'VtigerField','as':_0xc790('0xd'),'attributes':['id',_0xc790('0x8'),_0xc790('0x9'),_0xc790('0xe'),_0xc790('0xf'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0xc790('0xb'),'attributes':['id',_0xc790('0xc')]}]},{'model':_0xc790('0x7'),'as':_0xc790('0x10'),'attributes':['id',_0xc790('0x8'),'content',_0xc790('0x11'),_0xc790('0x12'),_0xc790('0x13'),_0xc790('0xa')],'include':[{'model':_0xc790('0xb'),'as':'Variable','attributes':['id',_0xc790('0xc')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x33a1=['remoteUri','serverUrl','VtigerField','Subjects','Variable','type','content','key','keyType','variableName','Fields','idField','nameField','GetVtigerAccount','getVtigerAccounts','Request','name','description','username','accessKey'];(function(_0xa4cc47,_0x4b2cb9){var _0x280d8f=function(_0x5d5895){while(--_0x5d5895){_0xa4cc47['push'](_0xa4cc47['shift']());}};_0x280d8f(++_0x4b2cb9);}(_0x33a1,0x1b2));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require('../../client');exports[_0x133a('0x0')]=function(){return function(_0x716268){return client[_0x133a('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x133a('0x2'),_0x133a('0x3'),_0x133a('0x4'),_0x133a('0x5'),_0x133a('0x6'),_0x133a('0x7')],'include':[{'model':'VtigerConfiguration','as':'Configurations','attributes':['id',_0x133a('0x2')],'include':[{'model':_0x133a('0x8'),'as':_0x133a('0x9'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x133a('0xa'),'as':_0x133a('0xa'),'attributes':['id','name']}]},{'model':_0x133a('0x8'),'as':'Descriptions','attributes':['id',_0x133a('0xb'),_0x133a('0xc'),_0x133a('0xd'),_0x133a('0xe'),'keyContent',_0x133a('0xf')],'include':[{'model':_0x133a('0xa'),'as':_0x133a('0xa'),'attributes':['id',_0x133a('0x2')]}]},{'model':_0x133a('0x8'),'as':_0x133a('0x10'),'attributes':['id','type',_0x133a('0xc'),_0x133a('0x11'),_0x133a('0x12'),'customField',_0x133a('0xf')],'include':[{'model':_0x133a('0xa'),'as':_0x133a('0xa'),'attributes':['id','name']}]}]}]},'log':_0x133a('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index e7d9250..4fa390d 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf784=['variableName','Fields','GetZendeskAccount','../../client','getZendeskAccounts','name','username','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','Variable','Descriptions','content','keyType','keyContent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf784,0x146));var _0x4f78=function(_0x3c637a,_0x5630c4){_0x3c637a=_0x3c637a-0x0;var _0x577cf1=_0xf784[_0x3c637a];return _0x577cf1;};'use strict';var client=require(_0x4f78('0x0'));exports[_0x4f78('0x1')]=function(){return function(_0xc6c87d){return client['Request']('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x4f78('0x2'),_0x4f78('0x3'),'password','token',_0x4f78('0x4'),_0x4f78('0x5'),_0x4f78('0x6'),_0x4f78('0x7')],'include':[{'model':_0x4f78('0x8'),'as':'Configurations','attributes':['id',_0x4f78('0x2')],'include':[{'model':_0x4f78('0x9'),'attributes':['id','name']},{'model':_0x4f78('0xa'),'as':'Subjects','attributes':['id',_0x4f78('0x7'),'content','variableName'],'include':[{'model':'Variable','as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]},{'model':_0x4f78('0xa'),'as':_0x4f78('0xc'),'attributes':['id',_0x4f78('0x7'),_0x4f78('0xd'),'key',_0x4f78('0xe'),_0x4f78('0xf'),_0x4f78('0x10')],'include':[{'model':_0x4f78('0xb'),'as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]},{'model':_0x4f78('0xa'),'as':_0x4f78('0x11'),'attributes':['id','type',_0x4f78('0xd'),'idField','nameField','customField',_0x4f78('0x10')],'include':[{'model':_0x4f78('0xb'),'as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]}]}]},'log':_0x4f78('0x12')});};}; \ No newline at end of file +var _0x190b=['customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyType','keyContent','Fields','nameField'];(function(_0x267210,_0x2e390f){var _0x5d0893=function(_0x4dedb1){while(--_0x4dedb1){_0x267210['push'](_0x267210['shift']());}};_0x5d0893(++_0x2e390f);}(_0x190b,0xd9));var _0xb190=function(_0x573219,_0x4f9863){_0x573219=_0x573219-0x0;var _0x1d48f1=_0x190b[_0x573219];return _0x1d48f1;};'use strict';var client=require(_0xb190('0x0'));exports[_0xb190('0x1')]=function(){return function(_0x241ab5){return client[_0xb190('0x2')](_0xb190('0x3'),{'options':{'raw':![],'attributes':['id',_0xb190('0x4'),_0xb190('0x5'),_0xb190('0x6'),'token',_0xb190('0x7'),_0xb190('0x8'),_0xb190('0x9'),_0xb190('0xa')],'include':[{'model':_0xb190('0xb'),'as':'Configurations','attributes':['id',_0xb190('0x4')],'include':[{'model':_0xb190('0xc'),'attributes':['id','name']},{'model':_0xb190('0xd'),'as':_0xb190('0xe'),'attributes':['id',_0xb190('0xa'),_0xb190('0xf'),_0xb190('0x10')],'include':[{'model':_0xb190('0x11'),'as':_0xb190('0x11'),'attributes':['id','name']}]},{'model':_0xb190('0xd'),'as':'Descriptions','attributes':['id',_0xb190('0xa'),_0xb190('0xf'),_0xb190('0x12'),_0xb190('0x13'),_0xb190('0x14'),_0xb190('0x10')],'include':[{'model':_0xb190('0x11'),'as':_0xb190('0x11'),'attributes':['id',_0xb190('0x4')]}]},{'model':_0xb190('0xd'),'as':_0xb190('0x15'),'attributes':['id',_0xb190('0xa'),_0xb190('0xf'),'idField',_0xb190('0x16'),_0xb190('0x17'),_0xb190('0x10')],'include':[{'model':_0xb190('0x11'),'as':_0xb190('0x11'),'attributes':['id','name']}]}]}]},'log':_0xb190('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 82b0131..b6749de 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8583=['content','variableName','Variable','key','keyType','keyContent','Fields','customField','GetZohoAccount','getZohoAccounts','Request','name','description','host','clientId','clientSecret','code','refreshToken','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x8583,0x171));var _0x3858=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8583[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../../client');exports[_0x3858('0x0')]=function(){return function(_0x5a4c8d){return client[_0x3858('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x3858('0x2'),_0x3858('0x3'),_0x3858('0x4'),'zone',_0x3858('0x5'),_0x3858('0x6'),'serverUrl',_0x3858('0x7'),_0x3858('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x3858('0x9'),'attributes':['id',_0x3858('0x2'),_0x3858('0xa'),_0x3858('0xb'),'description'],'include':[{'model':_0x3858('0xc'),'as':_0x3858('0xd'),'attributes':['id',_0x3858('0xe'),_0x3858('0xf'),_0x3858('0x10')],'include':[{'model':_0x3858('0x11'),'as':_0x3858('0x11'),'attributes':['id',_0x3858('0x2')]}]},{'model':_0x3858('0xc'),'as':'Descriptions','attributes':['id',_0x3858('0xe'),_0x3858('0xf'),_0x3858('0x12'),_0x3858('0x13'),_0x3858('0x14'),'variableName'],'include':[{'model':_0x3858('0x11'),'as':_0x3858('0x11'),'attributes':['id',_0x3858('0x2')]}]},{'model':'ZohoField','as':_0x3858('0x15'),'attributes':['id',_0x3858('0xe'),_0x3858('0xf'),'idField','nameField',_0x3858('0x16'),'variableName'],'include':[{'model':_0x3858('0x11'),'as':'Variable','attributes':['id',_0x3858('0x2')]}]}]}]},'log':_0x3858('0x17')});};}; \ No newline at end of file +var _0x2198=['keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','moduleCreate','moduleSearch','ZohoField','Subjects','type','variableName','Variable','Descriptions','content','key'];(function(_0x1e1777,_0x171134){var _0xdd150e=function(_0x27722f){while(--_0x27722f){_0x1e1777['push'](_0x1e1777['shift']());}};_0xdd150e(++_0x171134);}(_0x2198,0x10b));var _0x8219=function(_0x43979,_0x5d527a){_0x43979=_0x43979-0x0;var _0x2fada3=_0x2198[_0x43979];return _0x2fada3;};'use strict';var client=require(_0x8219('0x0'));exports[_0x8219('0x1')]=function(){return function(_0x5899b5){return client['Request'](_0x8219('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8219('0x3'),_0x8219('0x4'),_0x8219('0x5'),_0x8219('0x6'),_0x8219('0x7'),_0x8219('0x8'),_0x8219('0x9'),_0x8219('0xa')],'include':[{'model':'ZohoConfiguration','as':_0x8219('0xb'),'attributes':['id',_0x8219('0xc'),_0x8219('0xd'),_0x8219('0xe'),'description'],'include':[{'model':_0x8219('0xf'),'as':_0x8219('0x10'),'attributes':['id',_0x8219('0x11'),'content',_0x8219('0x12')],'include':[{'model':_0x8219('0x13'),'as':'Variable','attributes':['id',_0x8219('0xc')]}]},{'model':'ZohoField','as':_0x8219('0x14'),'attributes':['id',_0x8219('0x11'),_0x8219('0x15'),_0x8219('0x16'),_0x8219('0x17'),_0x8219('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x8219('0x13'),'attributes':['id',_0x8219('0xc')]}]},{'model':'ZohoField','as':_0x8219('0x19'),'attributes':['id','type',_0x8219('0x15'),_0x8219('0x1a'),_0x8219('0x1b'),_0x8219('0x1c'),_0x8219('0x12')],'include':[{'model':'Variable','as':_0x8219('0x13'),'attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index ea92052..2b9261c 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d9d=['isArray','length','resolve','every','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','silly'];(function(_0x2c1c99,_0x12d060){var _0x77cbf0=function(_0x856824){while(--_0x856824){_0x2c1c99['push'](_0x2c1c99['shift']());}};_0x77cbf0(++_0x12d060);}(_0x3d9d,0x17b));var _0xd3d9=function(_0x469e05,_0x35a1d5){_0x469e05=_0x469e05-0x0;var _0x582aec=_0x3d9d[_0x469e05];return _0x582aec;};var logger=require(_0xd3d9('0x0'))(_0xd3d9('0x1'));var client=require(_0xd3d9('0x2'));function intervalIftime(_0x51ec80,_0x779695){const _0x473ef1=new Error()['stack'][_0xd3d9('0x3')](/^Error/,'')['trim']();logger[_0xd3d9('0x4')]('intervalIftime\x20called\x20with',_0x51ec80,_0x779695,_0x473ef1);const _0x5858ca=Array[_0xd3d9('0x5')](_0x51ec80);if(!_0x51ec80||_0x5858ca&&_0x51ec80[_0xd3d9('0x6')]===0x0){return Promise[_0xd3d9('0x7')](![]);}else{var _0xf35932=[];var _0x3123a9=[];var _0x4a1ad8=_0x5858ca?_0x51ec80:[_0x51ec80];var _0x46ae40=_0x4a1ad8['every'](function(_0x13a312){return typeof _0x13a312==='number';});var _0x5ecf9e=_0x4a1ad8[_0xd3d9('0x8')](function(_0x554883){return typeof _0x554883===_0xd3d9('0x9');});if(!_0x46ae40&&!_0x5ecf9e){_0xf35932=_0x4a1ad8[_0xd3d9('0xa')](function(_0x2c56c8){return _0x2c56c8['id'];});if(_0xf35932[_0xd3d9('0x6')]===0x0){_0x3123a9=_0x4a1ad8['map'](function(_0x21181d){return _0x21181d[_0xd3d9('0xb')];});}}else{if(_0x46ae40){_0xf35932=_0xf35932[_0xd3d9('0xc')](_0x4a1ad8);}if(_0x5ecf9e){_0x3123a9=_0x3123a9[_0xd3d9('0xc')](_0x4a1ad8);}}return client[_0xd3d9('0xd')](_0xd3d9('0xe'),{'intervalIds':_0xf35932,'intervals':_0x3123a9,'timezone':_0x779695,'log':'IntervalIftime'});}}exports[_0xd3d9('0xf')]=intervalIftime; \ No newline at end of file +var _0xc1b1=['isArray','length','resolve','every','number','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with'];(function(_0x4fae53,_0x518059){var _0x8dcd83=function(_0x2ae214){while(--_0x2ae214){_0x4fae53['push'](_0x4fae53['shift']());}};_0x8dcd83(++_0x518059);}(_0xc1b1,0x1c1));var _0x1c1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1b1[_0x14add3];return _0x4a174f;};var logger=require(_0x1c1b('0x0'))(_0x1c1b('0x1'));var client=require(_0x1c1b('0x2'));function intervalIftime(_0x366c1a,_0x1d982b){const _0x20fa1f=new Error()['stack'][_0x1c1b('0x3')](/^Error/,'')[_0x1c1b('0x4')]();logger[_0x1c1b('0x5')](_0x1c1b('0x6'),_0x366c1a,_0x1d982b,_0x20fa1f);const _0x133d29=Array[_0x1c1b('0x7')](_0x366c1a);if(!_0x366c1a||_0x133d29&&_0x366c1a[_0x1c1b('0x8')]===0x0){return Promise[_0x1c1b('0x9')](![]);}else{var _0x353687=[];var _0x33b6a6=[];var _0x39bd98=_0x133d29?_0x366c1a:[_0x366c1a];var _0x483247=_0x39bd98[_0x1c1b('0xa')](function(_0xffe07f){return typeof _0xffe07f===_0x1c1b('0xb');});var _0x1d6cfe=_0x39bd98['every'](function(_0x2ed20e){return typeof _0x2ed20e===_0x1c1b('0xc');});if(!_0x483247&&!_0x1d6cfe){_0x353687=_0x39bd98[_0x1c1b('0xd')](function(_0x528639){return _0x528639['id'];});if(_0x353687[_0x1c1b('0x8')]===0x0){_0x33b6a6=_0x39bd98[_0x1c1b('0xd')](function(_0x3af901){return _0x3af901[_0x1c1b('0xe')];});}}else{if(_0x483247){_0x353687=_0x353687['concat'](_0x39bd98);}if(_0x1d6cfe){_0x33b6a6=_0x33b6a6[_0x1c1b('0xf')](_0x39bd98);}}return client[_0x1c1b('0x10')](_0x1c1b('0x11'),{'intervalIds':_0x353687,'intervals':_0x33b6a6,'timezone':_0x1d982b,'log':'IntervalIftime'});}}exports[_0x1c1b('0x12')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index d963f39..6487c7f 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3cf=['queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent','toNumber','uniqueid','voiceDialReport','Request','membername','starttime','endtime','diff','outbound','accountcode','exten','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x20bbd3,_0x2fbaa4){var _0x3fe1f1=function(_0x40950c){while(--_0x40950c){_0x20bbd3['push'](_0x20bbd3['shift']());}};_0x3fe1f1(++_0x2fbaa4);}(_0xa3cf,0x6c));var _0xfa3c=function(_0x357866,_0x1403e5){_0x357866=_0x357866-0x0;var _0x46f9d2=_0xa3cf[_0x357866];return _0x46f9d2;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xfa3c('0x0'));var client=require(_0xfa3c('0x1'));exports[_0xfa3c('0x2')]=function(_0x338616){var _0xefcb0=_0x338616[_0xfa3c('0x3')]||_0x338616[_0xfa3c('0x4')];return client['Request'](_0xfa3c('0x5'),{'body':{'channel':_0xfa3c('0x6'),'membername':_0x338616[_0xfa3c('0x7')],'interface':_[_0xfa3c('0x8')](_0x338616[_0xfa3c('0x9')])?util['format']('SIP/%s',_0x338616[_0xfa3c('0x7')]):_0x338616[_0xfa3c('0x9')],'type':_0xfa3c('0xa'),'enterAt':_0x338616[_0xfa3c('0xb')],'exitAt':_0xefcb0,'duration':moment(_0xefcb0)['diff'](_0x338616[_0xfa3c('0xb')],_0xfa3c('0xc')),'data1':_0xfa3c('0xd'),'data2':_0x338616[_0xfa3c('0xe')],'data3':_0x338616['exten'],'data4':null,'data5':_0x338616[_0xfa3c('0xf')],'role':_0xfa3c('0x10'),'internal':_0x338616['accountcode']?_[_0xfa3c('0x11')](_0x338616['accountcode']):undefined,'uniqueid':_0x338616[_0xfa3c('0x12')]},'log':_0xfa3c('0x5')});};exports[_0xfa3c('0x13')]=function(_0x157d2e){return client[_0xfa3c('0x14')](_0xfa3c('0x5'),{'body':{'channel':_0xfa3c('0x6'),'membername':_0x157d2e[_0xfa3c('0x15')],'interface':_0x157d2e[_0xfa3c('0x9')],'type':_0xfa3c('0xa'),'enterAt':_0x157d2e[_0xfa3c('0x16')],'exitAt':_0x157d2e[_0xfa3c('0x17')],'duration':moment(_0x157d2e[_0xfa3c('0x17')])[_0xfa3c('0x18')](_0x157d2e[_0xfa3c('0x16')],_0xfa3c('0xc'))>=0x0?moment(_0x157d2e[_0xfa3c('0x17')])['diff'](_0x157d2e[_0xfa3c('0x16')],_0xfa3c('0xc')):null,'data1':_0xfa3c('0x19'),'data2':_0x157d2e[_0xfa3c('0x1a')],'data3':_0x157d2e[_0xfa3c('0x1b')],'data4':_0x157d2e['dialstring']||null,'role':'agent','internal':_0x157d2e[_0xfa3c('0x1a')]?_['toNumber'](_0x157d2e[_0xfa3c('0x1a')]):undefined,'uniqueid':_0x157d2e[_0xfa3c('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x9203=['toNumber','uniqueid','CreateMemberReport','membername','starttime','endtime','outbound','dialstring','agent','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','accountcode'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9203,0x183));var _0x3920=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x9203[_0x150bff];return _0x296f9a;};'use strict';var moment=require(_0x3920('0x0'));var _=require('lodash');var util=require(_0x3920('0x1'));var client=require('../client');exports[_0x3920('0x2')]=function(_0x27f7ea){var _0xaa2b9b=_0x27f7ea[_0x3920('0x3')]||_0x27f7ea[_0x3920('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':_0x3920('0x5'),'membername':_0x27f7ea[_0x3920('0x6')],'interface':_[_0x3920('0x7')](_0x27f7ea[_0x3920('0x8')])?util[_0x3920('0x9')]('SIP/%s',_0x27f7ea[_0x3920('0x6')]):_0x27f7ea['interface'],'type':_0x3920('0xa'),'enterAt':_0x27f7ea[_0x3920('0xb')],'exitAt':_0xaa2b9b,'duration':moment(_0xaa2b9b)[_0x3920('0xc')](_0x27f7ea['queuecallerleaveAt'],_0x3920('0xd')),'data1':_0x3920('0xe'),'data2':_0x27f7ea[_0x3920('0xf')],'data3':_0x27f7ea[_0x3920('0x10')],'data4':null,'data5':_0x27f7ea['queue'],'role':'agent','internal':_0x27f7ea[_0x3920('0x11')]?_[_0x3920('0x12')](_0x27f7ea[_0x3920('0x11')]):undefined,'uniqueid':_0x27f7ea[_0x3920('0x13')]},'log':_0x3920('0x14')});};exports['voiceDialReport']=function(_0x22705b){return client['Request'](_0x3920('0x14'),{'body':{'channel':_0x3920('0x5'),'membername':_0x22705b[_0x3920('0x15')],'interface':_0x22705b[_0x3920('0x8')],'type':_0x3920('0xa'),'enterAt':_0x22705b[_0x3920('0x16')],'exitAt':_0x22705b[_0x3920('0x17')],'duration':moment(_0x22705b[_0x3920('0x17')])[_0x3920('0xc')](_0x22705b[_0x3920('0x16')],_0x3920('0xd'))>=0x0?moment(_0x22705b[_0x3920('0x17')])[_0x3920('0xc')](_0x22705b['starttime'],'seconds'):null,'data1':_0x3920('0x18'),'data2':_0x22705b[_0x3920('0x11')],'data3':_0x22705b[_0x3920('0x10')],'data4':_0x22705b[_0x3920('0x19')]||null,'role':_0x3920('0x1a'),'internal':_0x22705b[_0x3920('0x11')]?_[_0x3920('0x12')](_0x22705b[_0x3920('0x11')]):undefined,'uniqueid':_0x22705b[_0x3920('0x13')]},'log':_0x3920('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ebfc502..f917787 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 _0xe5b5=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xe5b5[_0x291f8b];return _0x275171;};'use strict';var client=require(_0x5e5b('0x0'));exports[_0x5e5b('0x1')]=function(){return client[_0x5e5b('0x2')](_0x5e5b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5e5b('0x4'),_0x5e5b('0x5')]},'log':_0x5e5b('0x6')});}; \ No newline at end of file +var _0xe06f=['Request','ShowSetting','getSettings'];(function(_0x5846b7,_0x3255d2){var _0x10c90f=function(_0x1db927){while(--_0x1db927){_0x5846b7['push'](_0x5846b7['shift']());}};_0x10c90f(++_0x3255d2);}(_0xe06f,0x104));var _0xfe06=function(_0x5c9734,_0x491666){_0x5c9734=_0x5c9734-0x0;var _0x5cd170=_0xe06f[_0x5c9734];return _0x5cd170;};'use strict';var client=require('../client');exports[_0xfe06('0x0')]=function(){return client[_0xfe06('0x1')](_0xfe06('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4160882..dad777b 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 _0x55a6=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x56d5fc,_0x26a702){var _0x19925e=function(_0x3369e5){while(--_0x3369e5){_0x56d5fc['push'](_0x56d5fc['shift']());}};_0x19925e(++_0x26a702);}(_0x55a6,0x74));var _0x655a=function(_0x3c2c28,_0x159dee){_0x3c2c28=_0x3c2c28-0x0;var _0x5a7df3=_0x55a6[_0x3c2c28];return _0x5a7df3;};'use strict';var client=require(_0x655a('0x0'));exports[_0x655a('0x1')]=function(_0x3b23b5){return function(_0x32e2bd){return client[_0x655a('0x2')](_0x655a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x655a('0x4'),_0x655a('0x5')]},'log':_0x655a('0x3')});};}; \ No newline at end of file +var _0xc6e8=['Request','name','GetTemplate','../client','getTemplates'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc6e8,0x9e));var _0x8c6e=function(_0x28a89c,_0xdcdc99){_0x28a89c=_0x28a89c-0x0;var _0x38f976=_0xc6e8[_0x28a89c];return _0x38f976;};'use strict';var client=require(_0x8c6e('0x0'));exports[_0x8c6e('0x1')]=function(_0x213e68){return function(_0x2b4809){return client[_0x8c6e('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x8c6e('0x3'),'html']},'log':_0x8c6e('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c1f8496..9a23c6e 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 _0xadfb=['data5','data6','../client','getTriggers','GetTrigger','name','channel','AllConditions','operator','value','Condition','Actions','action','data3','data4'];(function(_0x386e16,_0x4c47de){var _0x5e39a7=function(_0x3baf79){while(--_0x3baf79){_0x386e16['push'](_0x386e16['shift']());}};_0x5e39a7(++_0x4c47de);}(_0xadfb,0xe3));var _0xbadf=function(_0x2954d1,_0x5e160e){_0x2954d1=_0x2954d1-0x0;var _0x3fd43f=_0xadfb[_0x2954d1];return _0x3fd43f;};'use strict';var client=require(_0xbadf('0x0'));exports[_0xbadf('0x1')]=function(_0x37ca27){return function(_0x450e8e){return client['Request'](_0xbadf('0x2'),{'options':{'raw':![],'attributes':['id',_0xbadf('0x3'),_0xbadf('0x4'),'status'],'include':[{'model':'Condition','as':_0xbadf('0x5'),'attributes':['id','field',_0xbadf('0x6'),_0xbadf('0x7')]},{'model':_0xbadf('0x8'),'as':'AnyConditions','attributes':['id','field',_0xbadf('0x6'),_0xbadf('0x7')]},{'model':'Action','as':_0xbadf('0x9'),'attributes':['id',_0xbadf('0xa'),'data1','data2',_0xbadf('0xb'),_0xbadf('0xc'),_0xbadf('0xd'),_0xbadf('0xe'),'data7']}]},'log':_0xbadf('0x2')});};}; \ No newline at end of file +var _0xc05a=['data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','data1','data2','data3','data4'];(function(_0x263a2a,_0xbbe976){var _0x2222d0=function(_0x4cbdcf){while(--_0x4cbdcf){_0x263a2a['push'](_0x263a2a['shift']());}};_0x2222d0(++_0xbbe976);}(_0xc05a,0x12f));var _0xac05=function(_0x3994b9,_0x283537){_0x3994b9=_0x3994b9-0x0;var _0x31b998=_0xc05a[_0x3994b9];return _0x31b998;};'use strict';var client=require('../client');exports[_0xac05('0x0')]=function(_0x43958f){return function(_0x3a0c2e){return client[_0xac05('0x1')](_0xac05('0x2'),{'options':{'raw':![],'attributes':['id',_0xac05('0x3'),_0xac05('0x4'),_0xac05('0x5')],'include':[{'model':_0xac05('0x6'),'as':_0xac05('0x7'),'attributes':['id',_0xac05('0x8'),_0xac05('0x9'),_0xac05('0xa')]},{'model':'Condition','as':_0xac05('0xb'),'attributes':['id',_0xac05('0x8'),'operator',_0xac05('0xa')]},{'model':_0xac05('0xc'),'as':'Actions','attributes':['id','action',_0xac05('0xd'),_0xac05('0xe'),_0xac05('0xf'),_0xac05('0x10'),_0xac05('0x11'),_0xac05('0x12'),_0xac05('0x13')]}]},'log':_0xac05('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e26dd89..3648585 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 _0x903b=['GetTrunk','defaultuser','Request'];(function(_0x565ee7,_0x1b3861){var _0x1f4331=function(_0x3f98ed){while(--_0x3f98ed){_0x565ee7['push'](_0x565ee7['shift']());}};_0x1f4331(++_0x1b3861);}(_0x903b,0x104));var _0xb903=function(_0x572286,_0x32c2bc){_0x572286=_0x572286-0x0;var _0x25fcbb=_0x903b[_0x572286];return _0x25fcbb;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4b0e5f){return function(_0x5b5bf2){return client[_0xb903('0x0')](_0xb903('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xb903('0x2')]},'log':_0xb903('0x1')});};}; \ No newline at end of file +var _0x285c=['../client','getTrunks','name','registry','defaultuser'];(function(_0x515d4c,_0x17eeaa){var _0x189cc4=function(_0x4130ff){while(--_0x4130ff){_0x515d4c['push'](_0x515d4c['shift']());}};_0x189cc4(++_0x17eeaa);}(_0x285c,0xb9));var _0xc285=function(_0x9817b8,_0xefa1d8){_0x9817b8=_0x9817b8-0x0;var _0x34ff08=_0x285c[_0x9817b8];return _0x34ff08;};'use strict';var client=require(_0xc285('0x0'));exports[_0xc285('0x1')]=function(_0x42488d){return function(_0x2b60df){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc285('0x2'),_0xc285('0x3'),_0xc285('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 817df79..47e4fe3 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe706,0xa3));var _0x6e70=function(_0x5d5373,_0x10cd97){_0x5d5373=_0x5d5373-0x0;var _0x360a4a=_0xe706[_0x5d5373];return _0x360a4a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x58712a,_0x1d88a9){_0x58712a=_0x58712a-0x0;var _0x342032=_0xe706[_0x58712a];return _0x342032;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 69d652e..e87a0ab 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 _0x7e5b=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x40585e,_0x453078){var _0x5e2166=function(_0x41e640){while(--_0x41e640){_0x40585e['push'](_0x40585e['shift']());}};_0x5e2166(++_0x453078);}(_0x7e5b,0x1a1));var _0xb7e5=function(_0x5c4d5d,_0x46778b){_0x5c4d5d=_0x5c4d5d-0x0;var _0x465cde=_0x7e5b[_0x5c4d5d];return _0x465cde;};'use strict';var client=require('../client');exports[_0xb7e5('0x0')]=function(_0x551986){return client[_0xb7e5('0x1')](_0xb7e5('0x2'),{'body':_0x551986,'log':_0xb7e5('0x2')});};exports[_0xb7e5('0x3')]=function(_0x326348,_0xa88fde,_0x35aa01){return client[_0xb7e5('0x1')](_0xb7e5('0x4'),{'body':_0x326348,'options':{'where':{'uniqueid':_0xa88fde,'interface':_0x35aa01,'agentcomplete':!![]}},'log':_0xb7e5('0x4')});}; \ No newline at end of file +var _0x3eff=['../client','create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x1f0f2f,_0x2b467c){var _0x4c4ac7=function(_0x434374){while(--_0x434374){_0x1f0f2f['push'](_0x1f0f2f['shift']());}};_0x4c4ac7(++_0x2b467c);}(_0x3eff,0xaf));var _0xf3ef=function(_0x176259,_0x30e46f){_0x176259=_0x176259-0x0;var _0x48dc40=_0x3eff[_0x176259];return _0x48dc40;};'use strict';var client=require(_0xf3ef('0x0'));exports[_0xf3ef('0x1')]=function(_0x5b2d48){return client['Request'](_0xf3ef('0x2'),{'body':_0x5b2d48,'log':'CreateVoiceAgentReport'});};exports[_0xf3ef('0x3')]=function(_0x40a7dd,_0x2007d1,_0x7d6a57){return client['Request']('UpdateVoiceAgentReport',{'body':_0x40a7dd,'options':{'where':{'uniqueid':_0x2007d1,'interface':_0x7d6a57,'agentcomplete':!![]}},'log':_0xf3ef('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c5f99ab..3d47e11 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 _0x43a8=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x43a8,0x1c3));var _0x843a=function(_0x51bc31,_0x334d8e){_0x51bc31=_0x51bc31-0x0;var _0x21c03e=_0x43a8[_0x51bc31];return _0x21c03e;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x843a('0x0'));exports['create']=function(_0x2caef5){return client[_0x843a('0x1')]('CreateVoiceCallReport',{'body':_[_0x843a('0x2')](_0x2caef5,{'source':_0x2caef5[_0x843a('0x3')],'destinationcontext':_0x2caef5[_0x843a('0x4')],'callerid':_0x2caef5[_0x843a('0x5')],'amaflags':_0x843a('0x6')}),'log':_0x843a('0x7')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x843a('0x1')](_0x843a('0x8'),{'options':{'where':{'type':[_0x843a('0x9')],'createdAt':{'$between':[moment()[_0x843a('0xa')](_0x843a('0xb'))[_0x843a('0xc')](_0x843a('0xd')),moment()[_0x843a('0xe')](_0x843a('0xb'))[_0x843a('0xc')](_0x843a('0xd'))]}},'attributes':[_0x843a('0xf'),_0x843a('0x10'),_0x843a('0x11'),_0x843a('0x12')]},'log':_0x843a('0x13')});};}; \ No newline at end of file +var _0x4b81=['merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x4deab0,_0x113ed5){var _0x362260=function(_0x77bd6e){while(--_0x77bd6e){_0x4deab0['push'](_0x4deab0['shift']());}};_0x362260(++_0x113ed5);}(_0x4b81,0x112));var _0x14b8=function(_0x38972a,_0x5cf50c){_0x38972a=_0x38972a-0x0;var _0x46963f=_0x4b81[_0x38972a];return _0x46963f;};'use strict';var moment=require('moment');var util=require(_0x14b8('0x0'));var _=require(_0x14b8('0x1'));var client=require(_0x14b8('0x2'));exports[_0x14b8('0x3')]=function(_0x399143){return client[_0x14b8('0x4')](_0x14b8('0x5'),{'body':_[_0x14b8('0x6')](_0x399143,{'source':_0x399143['calleridnum'],'destinationcontext':_0x399143[_0x14b8('0x7')],'callerid':_0x399143['callerid'],'amaflags':_0x14b8('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x14b8('0x9')]=function(){return function(){return client[_0x14b8('0x4')](_0x14b8('0xa'),{'options':{'where':{'type':[_0x14b8('0xb')],'createdAt':{'$between':[moment()[_0x14b8('0xc')](_0x14b8('0xd'))[_0x14b8('0xe')](_0x14b8('0xf')),moment()['endOf']('day')['format'](_0x14b8('0xf'))]}},'attributes':[_0x14b8('0x10'),_0x14b8('0x11'),_0x14b8('0x12'),'billableseconds']},'log':_0x14b8('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4366b1c..94e97c3 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 _0xbec3=['CreateVoiceDialReport','../client','create'];(function(_0x10fac0,_0x59160c){var _0x22bc13=function(_0x1d91c7){while(--_0x1d91c7){_0x10fac0['push'](_0x10fac0['shift']());}};_0x22bc13(++_0x59160c);}(_0xbec3,0x190));var _0x3bec=function(_0x5045d6,_0x4a1ab8){_0x5045d6=_0x5045d6-0x0;var _0x576c36=_0xbec3[_0x5045d6];return _0x576c36;};'use strict';var client=require(_0x3bec('0x0'));exports[_0x3bec('0x1')]=function(_0x2b0268){return client['Request']('CreateVoiceDialReport',{'body':_0x2b0268,'log':_0x3bec('0x2')});}; \ No newline at end of file +var _0xa436=['Request','CreateVoiceDialReport','../client','create'];(function(_0x4634f8,_0x1ac5ec){var _0x2374f1=function(_0x7dcc77){while(--_0x7dcc77){_0x4634f8['push'](_0x4634f8['shift']());}};_0x2374f1(++_0x1ac5ec);}(_0xa436,0x9e));var _0x6a43=function(_0x191f30,_0xd61c00){_0x191f30=_0x191f30-0x0;var _0x537713=_0xa436[_0x191f30];return _0x537713;};'use strict';var client=require(_0x6a43('0x0'));exports[_0x6a43('0x1')]=function(_0xf3cd2f){return client[_0x6a43('0x2')](_0x6a43('0x3'),{'body':_0xf3cd2f,'log':_0x6a43('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index aea1b65..918a684 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 _0x7794=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x7794,0x7b));var _0x4779=function(_0x39d6eb,_0x3269ec){_0x39d6eb=_0x39d6eb-0x0;var _0x1bb532=_0x7794[_0x39d6eb];return _0x1bb532;};'use strict';var client=require('../client');exports[_0x4779('0x0')]=function(){return function(){return client[_0x4779('0x1')](_0x4779('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4779('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4779('0x0')});};}; \ No newline at end of file +var _0x6c76=['Request','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x18f7f3,_0x4dea57){var _0x3783dc=function(_0x37f9a0){while(--_0x37f9a0){_0x18f7f3['push'](_0x18f7f3['shift']());}};_0x3783dc(++_0x4dea57);}(_0x6c76,0x184));var _0x66c7=function(_0x4b1152,_0xf14476){_0x4b1152=_0x4b1152-0x0;var _0x5bf47e=_0x6c76[_0x4b1152];return _0x5bf47e;};'use strict';var client=require(_0x66c7('0x0'));exports[_0x66c7('0x1')]=function(){return function(){return client[_0x66c7('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x66c7('0x3'),_0x66c7('0x4')],'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 8c12d92..bf53c6e 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 _0x3664=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x1d559,_0x384522){var _0x3d03b3=function(_0x5040b7){while(--_0x5040b7){_0x1d559['push'](_0x1d559['shift']());}};_0x3d03b3(++_0x384522);}(_0x3664,0x69));var _0x4366=function(_0x19d625,_0x5c80c7){_0x19d625=_0x19d625-0x0;var _0x49eb35=_0x3664[_0x19d625];return _0x49eb35;};'use strict';var client=require(_0x4366('0x0'));exports[_0x4366('0x1')]=function(){return function(){return client[_0x4366('0x2')](_0x4366('0x3'),{'options':{'raw':![],'attributes':['id',_0x4366('0x4'),_0x4366('0x5'),_0x4366('0x6'),_0x4366('0x7'),_0x4366('0x8'),_0x4366('0x9'),_0x4366('0xa'),_0x4366('0xb'),_0x4366('0xc'),_0x4366('0xd'),_0x4366('0xe'),_0x4366('0xf'),_0x4366('0x10'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x4366('0x11'),_0x4366('0x12'),_0x4366('0x13'),_0x4366('0x14'),_0x4366('0x15'),_0x4366('0x16'),_0x4366('0x17'),_0x4366('0x18'),_0x4366('0x19'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x4366('0x1a'),_0x4366('0x1b'),_0x4366('0x1c'),'dialCheckDuplicateType',_0x4366('0x1d'),'dialAMDInitialSilence','dialAMDGreeting',_0x4366('0x1e'),_0x4366('0x1f'),'dialAMDMinWordLength',_0x4366('0x20'),_0x4366('0x21'),_0x4366('0x22'),_0x4366('0x23'),'timeout',_0x4366('0x24'),_0x4366('0x25'),'dialOrderByScheduledAt',_0x4366('0x26'),_0x4366('0x27'),'dialQueueProject2','monitor_format',_0x4366('0x28'),_0x4366('0x29'),_0x4366('0x2a'),_0x4366('0x2b'),_0x4366('0x2c'),'dialDropMaxRetry',_0x4366('0x2d'),_0x4366('0x2e'),_0x4366('0x2f'),_0x4366('0x30'),_0x4366('0x31'),'dialAgentRejectMaxRetry',_0x4366('0x32'),_0x4366('0x33'),_0x4366('0x34'),_0x4366('0x35'),_0x4366('0x36'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x4366('0x37'),'attributes':['id',_0x4366('0x4'),_0x4366('0x38'),'active']},{'model':_0x4366('0x39'),'as':_0x4366('0x3a'),'attributes':['id',_0x4366('0x4')]},{'model':_0x4366('0x37'),'as':'TrunkBackup','attributes':['id',_0x4366('0x4'),_0x4366('0x38'),_0x4366('0x3b')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x4366('0x3c'),'as':_0x4366('0x3d'),'attributes':['id','name',_0x4366('0x3e')]}]}]},'log':_0x4366('0x1')});};}; \ No newline at end of file +var _0xf7a0=['Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','active','mandatoryDispositionPause','TrunkBackup'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xf7a0,0x80));var _0x0f7a=function(_0xa1dfbf,_0x59ef41){_0xa1dfbf=_0xa1dfbf-0x0;var _0x10994c=_0xf7a0[_0xa1dfbf];return _0x10994c;};'use strict';var client=require(_0x0f7a('0x0'));exports[_0x0f7a('0x1')]=function(){return function(){return client[_0x0f7a('0x2')](_0x0f7a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0f7a('0x4'),_0x0f7a('0x5'),'autopause','monitor_format',_0x0f7a('0x6'),_0x0f7a('0x7'),_0x0f7a('0x8'),_0x0f7a('0x9'),'dialLimitQueue','dialPowerLevel',_0x0f7a('0xa'),'dialPredictiveOptimizationPercentage',_0x0f7a('0xb'),_0x0f7a('0xc'),_0x0f7a('0xd'),_0x0f7a('0xe'),_0x0f7a('0xf'),'dialQueueTimeout',_0x0f7a('0x10'),_0x0f7a('0x11'),_0x0f7a('0x12'),_0x0f7a('0x13'),_0x0f7a('0x14'),_0x0f7a('0x15'),_0x0f7a('0x16'),_0x0f7a('0x17'),_0x0f7a('0x18'),_0x0f7a('0x19'),_0x0f7a('0x1a'),_0x0f7a('0x1b'),'dialAMDActive','dialAMDInitialSilence',_0x0f7a('0x1c'),_0x0f7a('0x1d'),_0x0f7a('0x1e'),'dialAMDMinWordLength',_0x0f7a('0x1f'),_0x0f7a('0x20'),_0x0f7a('0x21'),_0x0f7a('0x22'),_0x0f7a('0x23'),_0x0f7a('0x24'),_0x0f7a('0x25'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x0f7a('0x26'),'dialQueueProject2',_0x0f7a('0x27'),_0x0f7a('0x28'),_0x0f7a('0x29'),_0x0f7a('0x2a'),_0x0f7a('0x2b'),_0x0f7a('0x2c'),_0x0f7a('0x2d'),_0x0f7a('0x2e'),_0x0f7a('0x2f'),_0x0f7a('0x30'),_0x0f7a('0x31'),_0x0f7a('0x32'),_0x0f7a('0x33'),_0x0f7a('0x34'),_0x0f7a('0x35'),_0x0f7a('0x36'),_0x0f7a('0x37'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x0f7a('0x38'),'as':_0x0f7a('0x38'),'attributes':['id',_0x0f7a('0x39'),'callerid',_0x0f7a('0x3a')]},{'model':'Pause','as':_0x0f7a('0x3b'),'attributes':['id',_0x0f7a('0x39')]},{'model':_0x0f7a('0x38'),'as':_0x0f7a('0x3c'),'attributes':['id',_0x0f7a('0x39'),'callerid','active']},{'model':_0x0f7a('0x3d'),'as':'Interval','attributes':['id',_0x0f7a('0x39')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x0f7a('0x39'),_0x0f7a('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 308603c..192c592 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(_0x4312af,_0x354dad){var _0x19cbff=function(_0x1c3a32){while(--_0x1c3a32){_0x4312af['push'](_0x4312af['shift']());}};_0x19cbff(++_0x354dad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x3a1b3b,_0x29ef2a){var _0x535ff9=function(_0x2c9542){while(--_0x2c9542){_0x3a1b3b['push'](_0x3a1b3b['shift']());}};_0x535ff9(++_0x29ef2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 f53e6ef..7b88b8e 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 _0x38c2=['getVoiceQueueRtPauses'];(function(_0x440adf,_0x525f25){var _0x4e5d9e=function(_0x5c47bb){while(--_0x5c47bb){_0x440adf['push'](_0x440adf['shift']());}};_0x4e5d9e(++_0x525f25);}(_0x38c2,0x1ea));var _0x238c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38c2[_0x4b369d];return _0x571a98;};'use strict';var client=require('../client');exports[_0x238c('0x0')]=function(_0x25d1dc){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x25d1dc,'paused':!![]},'raw':!![]},'log':_0x238c('0x0')});};}; \ No newline at end of file +var _0x435d=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x435d,0x120));var _0xd435=function(_0x4e608d,_0x42668c){_0x4e608d=_0x4e608d-0x0;var _0x266a58=_0x435d[_0x4e608d];return _0x266a58;};'use strict';var client=require(_0xd435('0x0'));exports[_0xd435('0x1')]=function(_0x1daa45){return function(){return client[_0xd435('0x2')](_0xd435('0x3'),{'options':{'where':{'VoiceQueueId':_0x1daa45,'paused':!![]},'raw':!![]},'log':_0xd435('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f2a771b..79533d1 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2d184e,_0x281ac8){var _0x382767=function(_0x5b431d){while(--_0x5b431d){_0x2d184e['push'](_0x2d184e['shift']());}};_0x382767(++_0x281ac8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1fa631,_0x416fd0){var _0x479bc3=function(_0x59dbff){while(--_0x59dbff){_0x1fa631['push'](_0x1fa631['shift']());}};_0x479bc3(++_0x416fd0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 b60a543..b75d194 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 _0x8a7b=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8a7b,0x91));var _0xb8a7=function(_0x2ca63b,_0x2e8b0){_0x2ca63b=_0x2ca63b-0x0;var _0x14d053=_0x8a7b[_0x2ca63b];return _0x14d053;};'use strict';var client=require('../client');exports[_0xb8a7('0x0')]={};exports[_0xb8a7('0x1')]=function(_0x310ebf){return client[_0xb8a7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x310ebf[_0xb8a7('0x3')],'transfererchannel':_0x310ebf['transfererchannel'],'transferercalleridnum':_0x310ebf['transferercalleridnum'],'transferercalleridname':_0x310ebf[_0xb8a7('0x4')],'transfererconnectedlinenum':_0x310ebf[_0xb8a7('0x5')],'transfererconnectedlinename':_0x310ebf[_0xb8a7('0x6')],'transfereraccountcode':_0x310ebf[_0xb8a7('0x7')],'transferercontext':_0x310ebf[_0xb8a7('0x8')],'transfererexten':_0x310ebf['transfererexten'],'transfererlinkedid':_0x310ebf[_0xb8a7('0x9')],'transfereechannel':_0x310ebf[_0xb8a7('0xa')],'transfereecalleridnum':_0x310ebf[_0xb8a7('0xb')],'transfereecalleridname':_0x310ebf[_0xb8a7('0xc')],'transfereeconnectedlinenum':_0x310ebf['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x310ebf[_0xb8a7('0xd')],'transfereeaccountcode':_0x310ebf[_0xb8a7('0xe')],'transfereecontext':_0x310ebf[_0xb8a7('0xf')],'transfereeexten':_0x310ebf['transfereeexten'],'transfereelinkedid':_0x310ebf['transfereelinkedid'],'isexternal':_0x310ebf['isexternal'],'context':_0x310ebf[_0xb8a7('0x10')],'extension':_0x310ebf[_0xb8a7('0x11')],'type':_0xb8a7('0x12')},'log':_0xb8a7('0x13')});};exports[_0xb8a7('0x14')]=function(_0x235c20){return client[_0xb8a7('0x2')](_0xb8a7('0x13'),{'body':{'result':_0x235c20[_0xb8a7('0x3')],'transfererchannel':_0x235c20[_0xb8a7('0x15')],'transferercalleridnum':_0x235c20[_0xb8a7('0x16')],'transferercalleridname':_0x235c20[_0xb8a7('0x17')],'transfererconnectedlinenum':_0x235c20['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x235c20[_0xb8a7('0x18')],'transfereraccountcode':_0x235c20[_0xb8a7('0x19')],'transferercontext':_0x235c20[_0xb8a7('0x1a')],'transfererexten':_0x235c20['secondtransfererexten'],'transfererlinkedid':_0x235c20[_0xb8a7('0x1b')],'transfereechannel':_0x235c20[_0xb8a7('0x1c')],'transfereecalleridnum':_0x235c20[_0xb8a7('0x1d')],'transfereecalleridname':_0x235c20[_0xb8a7('0x1e')],'transfereeconnectedlinenum':_0x235c20['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x235c20[_0xb8a7('0x1f')],'transfereeaccountcode':_0x235c20[_0xb8a7('0x20')],'transfereecontext':_0x235c20[_0xb8a7('0x21')],'transfereeexten':_0x235c20['transfertargetexten'],'transfereelinkedid':_0x235c20[_0xb8a7('0x22')],'isexternal':_0x235c20[_0xb8a7('0x23')],'context':_0x235c20[_0xb8a7('0x24')],'extension':_0x235c20[_0xb8a7('0x25')],'type':_0xb8a7('0x26')},'log':_0xb8a7('0x13')});}; \ No newline at end of file +var _0x4f16=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum'];(function(_0x47cdf9,_0x54afa8){var _0x460c09=function(_0x4ada05){while(--_0x4ada05){_0x47cdf9['push'](_0x47cdf9['shift']());}};_0x460c09(++_0x54afa8);}(_0x4f16,0x14e));var _0x64f1=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0x4f16[_0x4d03d6];return _0x22752e;};'use strict';var client=require(_0x64f1('0x0'));exports[_0x64f1('0x1')]={};exports[_0x64f1('0x2')]=function(_0x42ad70){return client[_0x64f1('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x42ad70[_0x64f1('0x4')],'transfererchannel':_0x42ad70['transfererchannel'],'transferercalleridnum':_0x42ad70[_0x64f1('0x5')],'transferercalleridname':_0x42ad70[_0x64f1('0x6')],'transfererconnectedlinenum':_0x42ad70[_0x64f1('0x7')],'transfererconnectedlinename':_0x42ad70['transfererconnectedlinename'],'transfereraccountcode':_0x42ad70[_0x64f1('0x8')],'transferercontext':_0x42ad70['transferercontext'],'transfererexten':_0x42ad70['transfererexten'],'transfererlinkedid':_0x42ad70[_0x64f1('0x9')],'transfereechannel':_0x42ad70[_0x64f1('0xa')],'transfereecalleridnum':_0x42ad70[_0x64f1('0xb')],'transfereecalleridname':_0x42ad70[_0x64f1('0xc')],'transfereeconnectedlinenum':_0x42ad70[_0x64f1('0xd')],'transfereeconnectedlinename':_0x42ad70[_0x64f1('0xe')],'transfereeaccountcode':_0x42ad70[_0x64f1('0xf')],'transfereecontext':_0x42ad70[_0x64f1('0x10')],'transfereeexten':_0x42ad70[_0x64f1('0x11')],'transfereelinkedid':_0x42ad70[_0x64f1('0x12')],'isexternal':_0x42ad70[_0x64f1('0x13')],'context':_0x42ad70[_0x64f1('0x14')],'extension':_0x42ad70[_0x64f1('0x15')],'type':_0x64f1('0x16')},'log':_0x64f1('0x17')});};exports['attendedTransfer']=function(_0x44d8ce){return client['Request'](_0x64f1('0x17'),{'body':{'result':_0x44d8ce['result'],'transfererchannel':_0x44d8ce[_0x64f1('0x18')],'transferercalleridnum':_0x44d8ce[_0x64f1('0x19')],'transferercalleridname':_0x44d8ce[_0x64f1('0x1a')],'transfererconnectedlinenum':_0x44d8ce[_0x64f1('0x1b')],'transfererconnectedlinename':_0x44d8ce[_0x64f1('0x1c')],'transfereraccountcode':_0x44d8ce[_0x64f1('0x1d')],'transferercontext':_0x44d8ce['secondtransferercontext'],'transfererexten':_0x44d8ce[_0x64f1('0x1e')],'transfererlinkedid':_0x44d8ce[_0x64f1('0x1f')],'transfereechannel':_0x44d8ce[_0x64f1('0x20')],'transfereecalleridnum':_0x44d8ce['transfertargetcalleridnum'],'transfereecalleridname':_0x44d8ce['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x44d8ce[_0x64f1('0x21')],'transfereeconnectedlinename':_0x44d8ce[_0x64f1('0x22')],'transfereeaccountcode':_0x44d8ce['transfertargetaccountcode'],'transfereecontext':_0x44d8ce[_0x64f1('0x23')],'transfereeexten':_0x44d8ce[_0x64f1('0x24')],'transfereelinkedid':_0x44d8ce[_0x64f1('0x25')],'isexternal':_0x44d8ce[_0x64f1('0x13')],'context':_0x44d8ce[_0x64f1('0x26')],'extension':_0x44d8ce['origtransfererexten'],'type':_0x64f1('0x27')},'log':_0x64f1('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index defecf4..b84d636 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3d1d5d,_0x2343b2){var _0x236bb7=function(_0x1396b5){while(--_0x1396b5){_0x3d1d5d['push'](_0x3d1d5d['shift']());}};_0x236bb7(++_0x2343b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d1187,_0x2a8e79){_0x3d1187=_0x3d1187-0x0;var _0x3ceb4d=_0xb10b[_0x3d1187];return _0x3ceb4d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x372fb4,_0x265d57){var _0xdad073=function(_0xb2e50d){while(--_0xb2e50d){_0x372fb4['push'](_0x372fb4['shift']());}};_0xdad073(++_0x265d57);}(_0xb10b,0x12a));var _0xbb10=function(_0x1103e6,_0x3a0217){_0x1103e6=_0x1103e6-0x0;var _0x5bc0ef=_0xb10b[_0x1103e6];return _0x5bc0ef;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index c603ea5..2d80790 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 _0xed8c=['lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','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','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xed8c,0x1e8));var _0xced8=function(_0x38969a,_0x2576b9){_0x38969a=_0x38969a-0x0;var _0x53930e=_0xed8c[_0x38969a];return _0x53930e;};'use strict';var _=require(_0xced8('0x0'));var BPromise=require(_0xced8('0x1'));var Redis=require(_0xced8('0x2'));var util=require(_0xced8('0x3'));var config=require(_0xced8('0x4'));var logger=require(_0xced8('0x5'))(_0xced8('0x6'));var cmContactRpc=require(_0xced8('0x7'));config[_0xced8('0x8')]=_[_0xced8('0x9')](config['redis'],{'host':_0xced8('0xa'),'port':0x18eb});var io=require(_0xced8('0xb'))(new Redis(config['redis']));function emit(_0x57c1cd,_0x1398a5,_0x5106c3,_0x32a2f4,_0x40300a){logger[_0xced8('0xc')]('[CM][%s][%s]',_0x57c1cd,_0x1398a5['id'],_0x5106c3,_0x32a2f4,JSON[_0xced8('0xd')](_0x40300a));io['to'](_0x5106c3)['emit'](_0x32a2f4,_0x40300a);}exports[_0xced8('0xe')]=function(_0x49aa56,_0x2a0c63,_0x88cdc2,_0x4785a5){var _0x2d711c,_0x4b5c79;var _0x32b469={};var _0x55f973;var _0x1b5c47=Number(_0x88cdc2[_0xced8('0xf')]);var _0x26dd70=_0x88cdc2[_0xced8('0x10')]?Boolean(Number(_0x88cdc2[_0xced8('0x10')])):![];var _0x3c512f;var _0x170d0b=![];if(!_[_0xced8('0x11')](_0x88cdc2[_0xced8('0x12')])){if(_0x88cdc2[_0xced8('0x12')]=='1')_0x170d0b=!![];}if(!_0x170d0b){if(_0x4785a5[_0xced8('0x13')]){_0x32b469['id']=_0x4785a5['xmd-contactid'];}}if(!_0x32b469['id']){_0x32b469[_0xced8('0x14')]=_0x1b5c47;_0x3c512f=_0x88cdc2[_0xced8('0x15')]&&_0x88cdc2[_0xced8('0x15')]!=='0'?_0x88cdc2['data3'][_0xced8('0x16')](','):['phone'];_0x32b469[_0xced8('0x17')]=_[_0xced8('0x18')](_0x3c512f,function(_0x439bf9){var _0x150c7c={};_0x150c7c[_0x439bf9]=_0x4785a5['routeId']?_0x4785a5['destcalleridnum']:_0x4785a5[_0xced8('0x19')];return _0x150c7c;});_0x55f973=_0x4785a5[_0xced8('0x1a')]?_0x4785a5[_0xced8('0x1b')]:_0x4785a5[_0xced8('0x19')];}var _0x5e2794=['id',_0xced8('0x1c'),_0xced8('0x1d'),'phone',_0xced8('0x1e'),_0xced8('0x1f'),_0xced8('0x14'),_0xced8('0x20'),_0xced8('0x21'),_0xced8('0x22')];var _0x1a38ac=_[_0xced8('0x23')](_0x5e2794,_0x3c512f);BPromise[_0xced8('0x24')]()[_0xced8('0x25')](cmContactRpc[_0xced8('0x26')]({'attributes':_0x1a38ac,'where':_0x32b469,'phone':_0x55f973}))[_0xced8('0x25')](function(_0x58180){_0x4b5c79=_0x58180;if(!_[_0xced8('0x27')](_0x4b5c79)){if(_0x4b5c79[_0xced8('0x28')]===0x1){_0x2d711c=_0x4b5c79[0x0];logger['info'](_0xced8('0x29'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id'],_0x2d711c['id']);}else{logger['info'](_0xced8('0x2b'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id'],_[_0xced8('0x18')](_0x4b5c79,'id')['join'](','));}return;}else{logger[_0xced8('0xc')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id']);var _0x52b5fd={'ListId':_0x1b5c47};var _0x2e6dfd=_0x88cdc2['data4']&&_0x88cdc2[_0xced8('0x2c')]!=='0'?_0x88cdc2[_0xced8('0x2c')]:_0xced8('0x2d');if(_0x26dd70){logger[_0xced8('0xc')](_0xced8('0x2e'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id']);_0x52b5fd[_0x2e6dfd]=_[_0xced8('0x11')](_0x4785a5['routeId'])?_0x4785a5[_0xced8('0x19')]:_0x4785a5[_0xced8('0x1b')];if(_[_0xced8('0x11')](_0x4785a5['routeId'])){_0x52b5fd[_0xced8('0x1c')]=_0x4785a5['calleridname']&&_0x4785a5[_0xced8('0x2f')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x2f')]:_0xced8('0x31');}else{_0x52b5fd[_0xced8('0x1c')]=_0x4785a5['destcalleridname']&&_0x4785a5[_0xced8('0x32')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x32')]:'Unknown';}return BPromise[_0xced8('0x24')]()[_0xced8('0x25')](cmContactRpc['createContact'](_0x52b5fd))['then'](function(_0x220eb7){_0x2d711c=_0x220eb7;_0x4b5c79[_0xced8('0x33')](_0x220eb7);if(_0x2d711c){logger[_0xced8('0xc')](_0xced8('0x34'),_0x4785a5['uniqueid'],_0x2a0c63['id'],_0x2d711c['id']);}return;});}else{logger['info'](_0xced8('0x35'),_0x4785a5['uniqueid'],_0x2a0c63['id']);_0x52b5fd[_0x2e6dfd]=_['isNil'](_0x4785a5[_0xced8('0x1a')])?_0x4785a5['calleridnum']:_0x4785a5['destcalleridnum'];if(_['isNil'](_0x4785a5[_0xced8('0x1a')])){_0x52b5fd['firstName']=_0x4785a5[_0xced8('0x2f')]&&_0x4785a5[_0xced8('0x2f')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x2f')]:_0xced8('0x31');}else{_0x52b5fd[_0xced8('0x1c')]=_0x4785a5[_0xced8('0x32')]&&_0x4785a5[_0xced8('0x32')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x32')]:'Unknown';}_0x2d711c=_0x52b5fd;_0x4b5c79[_0xced8('0x33')](_0x52b5fd);return;}}})['then'](function(){if(_0x49aa56){emit(_0x4785a5[_0xced8('0x2a')],_0x2a0c63,util[_0xced8('0x36')](_0xced8('0x37'),_0x49aa56[_0xced8('0x38')]),util[_0xced8('0x36')](_0xced8('0x39'),_0x88cdc2[_0xced8('0x3a')][_0xced8('0x3b')]()),{'evt':_[_0xced8('0x3c')](_0x4785a5,{'autoCreate':_0x26dd70}),'contact':_0x2d711c===undefined?{}:_0x2d711c,'contacts':_0x4b5c79['length']===0x0?undefined:_0x4b5c79});}});}; \ No newline at end of file +var _0x2d94=['[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','lastName','mobile','createdAt','union','resolve','then','getContacts','isEmpty','length'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x2d94,0x86));var _0x42d9=function(_0xdda9d9,_0x50bc62){_0xdda9d9=_0xdda9d9-0x0;var _0x164cb3=_0x2d94[_0xdda9d9];return _0x164cb3;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x42d9('0x0'));var util=require(_0x42d9('0x1'));var config=require(_0x42d9('0x2'));var logger=require(_0x42d9('0x3'))(_0x42d9('0x4'));var cmContactRpc=require(_0x42d9('0x5'));config[_0x42d9('0x6')]=_[_0x42d9('0x7')](config[_0x42d9('0x6')],{'host':_0x42d9('0x8'),'port':0x18eb});var io=require(_0x42d9('0x9'))(new Redis(config[_0x42d9('0x6')]));function emit(_0x200d5a,_0x5582fd,_0x3a87c4,_0x2a22f8,_0x567438){logger[_0x42d9('0xa')](_0x42d9('0xb'),_0x200d5a,_0x5582fd['id'],_0x3a87c4,_0x2a22f8,JSON[_0x42d9('0xc')](_0x567438));io['to'](_0x3a87c4)[_0x42d9('0xd')](_0x2a22f8,_0x567438);}exports['exec']=function(_0x463682,_0x25ac00,_0x52485f,_0x28be42){var _0x1ffbb1,_0x34e9c2;var _0x5750d7={};var _0x3b37bd;var _0x19cded=Number(_0x52485f[_0x42d9('0xe')]);var _0x4756f0=_0x52485f[_0x42d9('0xf')]?Boolean(Number(_0x52485f['data2'])):![];var _0x4facd;var _0x562068=![];if(!_[_0x42d9('0x10')](_0x52485f[_0x42d9('0x11')])){if(_0x52485f[_0x42d9('0x11')]=='1')_0x562068=!![];}if(!_0x562068){if(_0x28be42['xmd-contactid']){_0x5750d7['id']=_0x28be42[_0x42d9('0x12')];}}if(!_0x5750d7['id']){_0x5750d7[_0x42d9('0x13')]=_0x19cded;_0x4facd=_0x52485f[_0x42d9('0x14')]&&_0x52485f['data3']!=='0'?_0x52485f[_0x42d9('0x14')][_0x42d9('0x15')](','):[_0x42d9('0x16')];_0x5750d7[_0x42d9('0x17')]=_[_0x42d9('0x18')](_0x4facd,function(_0x525884){var _0x3859c3={};_0x3859c3[_0x525884]=_0x28be42[_0x42d9('0x19')]?_0x28be42['destcalleridnum']:_0x28be42[_0x42d9('0x1a')];return _0x3859c3;});_0x3b37bd=_0x28be42[_0x42d9('0x19')]?_0x28be42[_0x42d9('0x1b')]:_0x28be42[_0x42d9('0x1a')];}var _0x42f304=['id','firstName',_0x42d9('0x1c'),_0x42d9('0x16'),_0x42d9('0x1d'),'fax',_0x42d9('0x13'),_0x42d9('0x1e'),'scheduledAt','updatedAt'];var _0x1a9e5a=_[_0x42d9('0x1f')](_0x42f304,_0x4facd);BPromise[_0x42d9('0x20')]()[_0x42d9('0x21')](cmContactRpc[_0x42d9('0x22')]({'attributes':_0x1a9e5a,'where':_0x5750d7,'phone':_0x3b37bd}))['then'](function(_0x3acbee){_0x34e9c2=_0x3acbee;if(!_[_0x42d9('0x23')](_0x34e9c2)){if(_0x34e9c2[_0x42d9('0x24')]===0x1){_0x1ffbb1=_0x34e9c2[0x0];logger[_0x42d9('0xa')](_0x42d9('0x25'),_0x28be42[_0x42d9('0x26')],_0x25ac00['id'],_0x1ffbb1['id']);}else{logger[_0x42d9('0xa')](_0x42d9('0x27'),_0x28be42['uniqueid'],_0x25ac00['id'],_[_0x42d9('0x18')](_0x34e9c2,'id')[_0x42d9('0x28')](','));}return;}else{logger[_0x42d9('0xa')](_0x42d9('0x29'),_0x28be42[_0x42d9('0x26')],_0x25ac00['id']);var _0x1d63d3={'ListId':_0x19cded};var _0x57cb47=_0x52485f[_0x42d9('0x2a')]&&_0x52485f['data4']!=='0'?_0x52485f[_0x42d9('0x2a')]:_0x42d9('0x16');if(_0x4756f0){logger[_0x42d9('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x28be42[_0x42d9('0x26')],_0x25ac00['id']);_0x1d63d3[_0x57cb47]=_[_0x42d9('0x10')](_0x28be42[_0x42d9('0x19')])?_0x28be42[_0x42d9('0x1a')]:_0x28be42[_0x42d9('0x1b')];if(_[_0x42d9('0x10')](_0x28be42[_0x42d9('0x19')])){_0x1d63d3[_0x42d9('0x2b')]=_0x28be42[_0x42d9('0x2c')]&&_0x28be42[_0x42d9('0x2c')]!==_0x42d9('0x2d')?_0x28be42['calleridname']:_0x42d9('0x2e');}else{_0x1d63d3['firstName']=_0x28be42[_0x42d9('0x2f')]&&_0x28be42[_0x42d9('0x2f')]!==''?_0x28be42[_0x42d9('0x2f')]:_0x42d9('0x2e');}return BPromise['resolve']()[_0x42d9('0x21')](cmContactRpc['createContact'](_0x1d63d3))[_0x42d9('0x21')](function(_0x2ba18b){_0x1ffbb1=_0x2ba18b;_0x34e9c2['push'](_0x2ba18b);if(_0x1ffbb1){logger[_0x42d9('0xa')](_0x42d9('0x30'),_0x28be42[_0x42d9('0x26')],_0x25ac00['id'],_0x1ffbb1['id']);}return;});}else{logger['info'](_0x42d9('0x31'),_0x28be42['uniqueid'],_0x25ac00['id']);_0x1d63d3[_0x57cb47]=_[_0x42d9('0x10')](_0x28be42[_0x42d9('0x19')])?_0x28be42[_0x42d9('0x1a')]:_0x28be42['destcalleridnum'];if(_[_0x42d9('0x10')](_0x28be42[_0x42d9('0x19')])){_0x1d63d3[_0x42d9('0x2b')]=_0x28be42[_0x42d9('0x2c')]&&_0x28be42[_0x42d9('0x2c')]!==_0x42d9('0x2d')?_0x28be42[_0x42d9('0x2c')]:'Unknown';}else{_0x1d63d3['firstName']=_0x28be42[_0x42d9('0x2f')]&&_0x28be42[_0x42d9('0x2f')]!==_0x42d9('0x2d')?_0x28be42[_0x42d9('0x2f')]:_0x42d9('0x2e');}_0x1ffbb1=_0x1d63d3;_0x34e9c2[_0x42d9('0x32')](_0x1d63d3);return;}}})[_0x42d9('0x21')](function(){if(_0x463682){emit(_0x28be42[_0x42d9('0x26')],_0x25ac00,util[_0x42d9('0x33')](_0x42d9('0x34'),_0x463682['name']),util['format'](_0x42d9('0x35'),_0x52485f[_0x42d9('0x36')][_0x42d9('0x37')]()),{'evt':_[_0x42d9('0x38')](_0x28be42,{'autoCreate':_0x4756f0}),'contact':_0x1ffbb1===undefined?{}:_0x1ffbb1,'contacts':_0x34e9c2[_0x42d9('0x24')]===0x0?undefined:_0x34e9c2});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c2beada..0923aa4 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 _0x832b=['jscripty','trigger:%s','contactmanager','exec','queue','routeId','urlforward','script','parse','query','search','channel','AllConditions','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','event','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','lodash','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','accounts','dynamics365Accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','action','browser','data1','TemplateId','data2','html','render','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','user:%s','name','format','trigger:%s:%s','toLowerCase'];(function(_0x466f68,_0xcd30df){var _0x39c523=function(_0x16a236){while(--_0x16a236){_0x466f68['push'](_0x466f68['shift']());}};_0x39c523(++_0xcd30df);}(_0x832b,0x194));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xb832('0x0'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xb832('0x1'));var urlforward=require(_0xb832('0x2'));var integration=require(_0xb832('0x3'));var cmContact=require(_0xb832('0x4'));var script=require(_0xb832('0x5'));var config=require(_0xb832('0x6'));var logger=require(_0xb832('0x7'))('trigger');var ami=require(_0xb832('0x8'));config[_0xb832('0x9')]=_['defaults'](config[_0xb832('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb832('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x3629c6,_0x44f127){return _0x3629c6==_0x44f127;},'not_equals':function(_0x483cc3,_0x4aebbf){return _0x483cc3!=_0x4aebbf;}};var barAndWebActions=[_0xb832('0xb'),'url','winapp'];function Trigger(_0x56ca46){this[_0xb832('0xc')]=_0x56ca46['triggers'];this[_0xb832('0xd')]=_0x56ca46[_0xb832('0xd')];this[_0xb832('0xe')]=_0x56ca46[_0xb832('0xe')];this[_0xb832('0xf')]=_0x56ca46['templates'];this['voiceExtensions']=_0x56ca46[_0xb832('0x10')];this[_0xb832('0x11')]=_0x56ca46[_0xb832('0x11')];this[_0xb832('0x12')]=_0x56ca46[_0xb832('0x12')];this[_0xb832('0x13')]=_0x56ca46['salesforceAccounts'];this['sugarcrmAccounts']=_0x56ca46[_0xb832('0x14')];this['zohoAccounts']=_0x56ca46[_0xb832('0x15')];this[_0xb832('0x16')]=_0x56ca46[_0xb832('0x16')];this[_0xb832('0x17')]=_0x56ca46[_0xb832('0x17')];this['servicenowAccounts']=_0x56ca46['servicenowAccounts'];this['dynamics365Accounts']=_0x56ca46['dynamics365Accounts'];this[_0xb832('0x18')]=_0x56ca46[_0xb832('0x18')];this[_0xb832('0x19')]={'zendesk':this[_0xb832('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xb832('0x12')],'sugarcrm':this[_0xb832('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0xb832('0x16')],'vtiger':this[_0xb832('0x17')],'dynamics365':this[_0xb832('0x1a')],'freshsales':this[_0xb832('0x18')],'servicenow':this['servicenowAccounts']};ami['on'](_0xb832('0x1b'),this[_0xb832('0x1c')]['bind'](this));ami['on'](_0xb832('0x1d'),this['syncCustomEvent'][_0xb832('0x1e')](this));ami['on'](_0xb832('0x1f'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x20'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x21'),this['syncCustomEvent'][_0xb832('0x1e')](this));ami['on']('custom:agentnoanswer',this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on']('custom:agentbusy',this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x22'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x23'),this['syncCustomEvent'][_0xb832('0x1e')](this));ami['on'](_0xb832('0x24'),this['syncCustomEvent'][_0xb832('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on']('custom:timeout',this[_0xb832('0x1c')]['bind'](this));ami['on'](_0xb832('0x25'),this[_0xb832('0x26')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x27'),this[_0xb832('0x26')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x28'),this[_0xb832('0x26')]['bind'](this));ami['on'](_0xb832('0x29'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x2a'),this[_0xb832('0x1c')]['bind'](this));ami['on']('custom:substatus',this[_0xb832('0x1c')]['bind'](this));ami['on'](_0xb832('0x2b'),this[_0xb832('0x1c')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on']('custom:acceptmessage',this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x2c'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));ami['on'](_0xb832('0x2d'),this[_0xb832('0x1c')][_0xb832('0x1e')](this));}Trigger[_0xb832('0x2e')][_0xb832('0x2f')]=function(_0x57a94e,_0x1eb339,_0x4bc56b){logger[_0xb832('0x30')](_0x57a94e,_0x1eb339,JSON[_0xb832('0x31')](_0x4bc56b));io['to'](_0x57a94e)['emit'](_0x1eb339,_0x4bc56b);};Trigger[_0xb832('0x2e')]['syncCustomEvent']=function(_0xd78e7a){var _0x111b77=_[_0xb832('0x32')](_0xd78e7a);if(typeof _0x111b77[_0xb832('0x33')]===_0xb832('0x34')){_0x111b77[_0xb832('0x33')]=_0xb832('0x35');}logger[_0xb832('0x36')](_0xb832('0x1c'),util[_0xb832('0x37')](_0x111b77,{'showHidden':!![],'depth':null}));this[_0xb832('0x38')](_0x111b77);};Trigger[_0xb832('0x2e')][_0xb832('0x26')]=function(_0x492090){if(this[_0xb832('0xd')][_0x492090[_0xb832('0x39')]]){this[_0xb832('0x1c')](_0x492090);}};Trigger['prototype'][_0xb832('0x38')]=function(_0x5a60dd){var _0x13fe03;for(var _0x44a5bb in this['triggers']){if(this[_0xb832('0xc')][_0xb832('0x3a')](_0x44a5bb)){if(this[_0xb832('0xc')][_0x44a5bb][_0xb832('0x3b')]){_0x13fe03=this[_0xb832('0x3c')](this['triggers'][_0x44a5bb],_0x5a60dd);if(_0x13fe03){_[_0xb832('0x3d')](_0x5a60dd,_0x5a60dd[_0xb832('0x3e')]);for(var _0x57c729=0x0,_0x297af3,_0x5451d3,_0x4fb8a5;_0x57c7290x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5fc3[_0x13b02f];return _0x12e9a6;};'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 665a634..f226ef0 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 _0xe853=['serverUrl','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\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','ioredis','../../../../config/logger','dynamics365','redis','socket.io-emitter','CloudProvider','tenantId','data2','data5','POST','clientId','remoteUri','password','then','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','nothing','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','customField','idField','indexOf','incident','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','assign','Subjects','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe853,0x87));var _0x3e85=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe853[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3e85('0x0'));var rp=require(_0x3e85('0x1'));var util=require(_0x3e85('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x3e85('0x3'));var logger=require(_0x3e85('0x4'))(_0x3e85('0x5'));var config=require('../../../../config/environment');config[_0x3e85('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3e85('0x7'))(new Redis(config['redis']));function getAuthToken(_0xaa2c17,_0x468f62,_0xff9c4f){if(_0xaa2c17['modernAuthentication']){_0xaa2c17['remoteUri']=_0xaa2c17[_0x3e85('0x8')]['data7'];_0xaa2c17[_0x3e85('0x9')]=_0xaa2c17[_0x3e85('0x8')][_0x3e85('0xa')];return Promise['resolve'](_0xaa2c17[_0x3e85('0x8')][_0x3e85('0xb')]);}var _0x372caa={'method':_0x3e85('0xc'),'uri':_0x468f62,'form':{'client_id':_0xaa2c17[_0x3e85('0xd')],'resource':_0xaa2c17[_0x3e85('0xe')],'username':_0xaa2c17['username'],'password':_0xaa2c17[_0x3e85('0xf')],'grant_type':'password','client_secret':_0xaa2c17['clientSecret']},'json':!![]};return rp(_0x372caa)[_0x3e85('0x10')](function(_0x51f13d){return _0x51f13d['access_token'];})[_0x3e85('0x11')](function(_0x4cc3e4){logger[_0x3e85('0x12')]('['+[_0xff9c4f['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x4cc3e4[_0x3e85('0x13')];});}function getUser(_0x509c51,_0x164fe3,_0x1cd339,_0x1145a2,_0x5c39ec,_0x2adecf){return new Promise(function(_0x4eb885,_0x484456){return getAuthToken(_0x164fe3,_0x1145a2,_0x2adecf)['then'](function(_0x5c2b03){var _0x366dbf={'method':_0x3e85('0x14'),'uri':_0x5c39ec+_0x3e85('0x15'),'headers':{'Authorization':_0x3e85('0x16')+_0x5c2b03,'OData-Version':_0x3e85('0x17')},'json':!![]};return rp(_0x366dbf);})[_0x3e85('0x10')](function(_0x183c2f){var _0x3acfb4=_0x183c2f[_0x3e85('0x18')];var _0x21e266=![];var _0x5c09f6=null;if(!_['isNil'](_0x1cd339)){if(intUtil[_0x3e85('0x19')](_0x1cd339['email'])){_0x509c51['userEmail']=_0x1cd339[_0x3e85('0x1a')];for(_0x5c09f6=0x0;_0x5c09f6<_0x3acfb4[_0x3e85('0x1b')];_0x5c09f6++){if(_0x3acfb4[_0x5c09f6][_0x3e85('0x1c')]===_0x1cd339[_0x3e85('0x1a')]&&!_0x3acfb4[_0x5c09f6][_0x3e85('0x1d')]){_0x21e266=!![];logger[_0x3e85('0x1e')]('['+[_0x2adecf['toUpperCase']()]+_0x3e85('0x1f')+_0x3acfb4[_0x5c09f6][_0x3e85('0x20')]+'!');_0x509c51['userId']=_0x3acfb4[_0x5c09f6]['systemuserid'];}}}}if(!_0x21e266){logger[_0x3e85('0x1e')]('['+[_0x2adecf['toUpperCase']()]+_0x3e85('0x21'));_0x509c51[_0x3e85('0x22')]=_0x164fe3[_0x3e85('0x23')];for(_0x5c09f6=0x0;_0x5c09f6<_0x3acfb4['length'];_0x5c09f6++){if(_0x3acfb4[_0x5c09f6][_0x3e85('0x1c')]===_0x164fe3[_0x3e85('0x23')]){_0x509c51[_0x3e85('0x24')]=_0x3acfb4[_0x5c09f6]['systemuserid'];}}}_0x4eb885(_0x509c51);})[_0x3e85('0x11')](function(_0x286258){_0x484456(_0x286258[_0x3e85('0x13')]);});});}function createEndUser(_0x41cb79,_0x9aabf1,_0x71f4cb,_0x50b467,_0x57d70b,_0xf49b5a,_0x481340){return new Promise(function(_0x2d6127,_0x1d79d5){return getAuthToken(_0x9aabf1,_0x71f4cb,_0xf49b5a)[_0x3e85('0x10')](function(_0x583c80){var _0x152a1a=_0xf49b5a['toLowerCase']()==='outbound'?_0x57d70b[_0x3e85('0x25')]:_0x57d70b[_0x3e85('0x26')];var _0xcf5e2b={'method':_0x3e85('0xc'),'uri':_0x50b467+_0x3e85('0x27'),'body':{'fullname':_0x152a1a,'firstname':_0x152a1a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3e85('0x28')+_0x41cb79[_0x3e85('0x24')]+')'},'headers':{'Authorization':_0x3e85('0x16')+_0x583c80,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};_0xcf5e2b['body'][_0x481340]=_0x152a1a;return rp(_0xcf5e2b);})[_0x3e85('0x10')](function(_0x4c7243){var _0x2e6d3b=_0x4c7243[_0x3e85('0x29')][_0x3e85('0x2a')];var _0x3cd9d0=_0x2e6d3b[_0x3e85('0x2b')](_0x2e6d3b[_0x3e85('0x2c')]('(')+0x1,_0x2e6d3b[_0x3e85('0x2c')](')'));_0x41cb79[_0x3e85('0x2d')]=_0x3cd9d0;_0x2d6127(_0x41cb79);})['catch'](function(_0x1f0721){_0x1d79d5(_0x1f0721[_0x3e85('0x13')]);});});}function getEndUser(_0xe268e0,_0xa1c0fa,_0x24ddcb,_0x3a832a,_0x260026,_0x37e982,_0x2a4bc1,_0x205753){var _0x25163d=_0x37e982[_0x3e85('0x2e')]()===_0x3e85('0x2f')?_0x260026[_0x3e85('0x25')]:_0x260026[_0x3e85('0x26')];return getAuthToken(_0xa1c0fa,_0x24ddcb,_0x37e982)[_0x3e85('0x10')](function(_0x5a92b2){_0x205753=_0x205753?_0x205753:_0x3e85('0x30');var _0x32a204={'method':_0x3e85('0x14'),'uri':_0x3a832a+'contacts?$select='+_0x205753+_0x3e85('0x31')+_0x205753+_0x3e85('0x32')+_0x25163d[_0x3e85('0x33')]('+',_0x3e85('0x34'))+'\x27','headers':{'Authorization':_0x3e85('0x16')+_0x5a92b2,'If-None-Match':null,'OData-Version':_0x3e85('0x17')},'json':!![]};return rp(_0x32a204);})[_0x3e85('0x10')](function(_0x28221a){var _0x468c43=![];if(!_0x28221a)return _0x468c43;var _0x37ebcd=_0x28221a['value'];for(var _0xb37f31=0x0;_0xb37f31<_0x37ebcd[_0x3e85('0x1b')];_0xb37f31++){if(_0x37ebcd[_0xb37f31][_0x205753]===_0x25163d){_0x468c43=!![];_0xe268e0[_0x3e85('0x2d')]=_0x37ebcd[_0xb37f31]['contactid'];}}return _0x468c43;})['then'](function(_0x45e5ab){if(_0x45e5ab)return _0xe268e0;if(_0x2a4bc1===_0x3e85('0x35')){logger['info']('['+[_0x37e982[_0x3e85('0x36')]()]+_0x3e85('0x37'));return _0xe268e0;}return createEndUser(_0xe268e0,_0xa1c0fa,_0x24ddcb,_0x3a832a,_0x260026,_0x37e982,_0x205753)['then'](function(_0x1a3a80){logger[_0x3e85('0x1e')]('['+[_0x37e982[_0x3e85('0x36')]()]+_0x3e85('0x38'),_0x1a3a80[_0x3e85('0x2d')]);return _0x1a3a80;});});}function getCustomFields(_0x46bbc9,_0x429c81,_0x1ce598){var _0x2a26c1={};if(_0x46bbc9[_0x3e85('0x1b')]>0x0){_[_0x3e85('0x39')](_0x46bbc9,function(_0x30c7a5){if(_['includes']([_0x3e85('0x3a'),_0x3e85('0x3b')],_0x30c7a5['type'])&&_0x30c7a5['nameField']&&!_0x30c7a5[_0x3e85('0x3c')]){var _0x1213ff=_0x30c7a5[_0x3e85('0x3d')][_0x3e85('0x2e')]();var _0x5972cc=_0x1213ff[_0x3e85('0x2b')](0x0,_0x1213ff[_0x3e85('0x3e')]('_'));var _0x46ef6a=_0x1213ff[_0x3e85('0x2b')](_0x1213ff[_0x3e85('0x3e')]('_')+0x1);if(_0x5972cc===_0x1ce598){_0x2a26c1[_0x46ef6a]=_0x30c7a5['content'];}}});}return _0x2a26c1;}function getTicket(_0x32d40c,_0x45ca5b,_0x4effef,_0x385ee3,_0x4cafed,_0x433d93,_0x145ae4){return new Promise(function(_0x2c13cd,_0x3e22b7){var _0x1e22a7;return getAuthToken(_0x45ca5b,_0x4effef,_0x145ae4)[_0x3e85('0x10')](function(_0x37cde3){if(_0x433d93['ticketType']===_0x3e85('0x3f')){_0x1e22a7={'method':_0x3e85('0xc'),'uri':_0x385ee3+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x433d93['Subjects'],_0x4cafed,'\x20'),'description':intUtil[_0x3e85('0x40')](_0x433d93[_0x3e85('0x41')],_0x4cafed,'\x0a'),'customerid_contact@odata.bind':_0x32d40c[_0x3e85('0x2d')]?_0x3e85('0x42')+_0x32d40c[_0x3e85('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32d40c[_0x3e85('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x433d93[_0x3e85('0x43')],_0x4cafed,_0x433d93[_0x3e85('0x44')])),'headers':{'Authorization':_0x3e85('0x16')+_0x37cde3,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x433d93['ticketType']===_0x3e85('0x45')){var _0x2bd161=_0x32d40c[_0x3e85('0x2d')]?[{'partyid_systemuser@odata.bind':_0x3e85('0x28')+_0x32d40c[_0x3e85('0x24')]+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]===_0x3e85('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x3e85('0x42')+_0x32d40c[_0x3e85('0x2d')]+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x32d40c['userId']+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]===_0x3e85('0x47')?0x2:0x1}];_0x1e22a7={'method':_0x3e85('0xc'),'uri':_0x385ee3+_0x3e85('0x48'),'body':Object[_0x3e85('0x49')]({},{'subject':intUtil[_0x3e85('0x40')](_0x433d93[_0x3e85('0x4a')],_0x4cafed,'\x20'),'phonenumber':String(_0x4cafed[_0x3e85('0x26')]),'description':intUtil['getString'](_0x433d93[_0x3e85('0x41')],_0x4cafed,'\x0a'),'regardingobjectid_contact@odata.bind':_0x32d40c[_0x3e85('0x2d')]?_0x3e85('0x42')+_0x32d40c['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32d40c[_0x3e85('0x24')]+')','directioncode':_0x32d40c[_0x3e85('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2bd161},getCustomFields(_0x433d93[_0x3e85('0x43')],_0x4cafed,_0x433d93['ticketType'])),'headers':{'Authorization':_0x3e85('0x16')+_0x37cde3,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e22a7);})[_0x3e85('0x10')](function(_0x3b1572){var _0x178b09=_0x3b1572[_0x3e85('0x29')][_0x3e85('0x2a')];var _0x41a5a2=_0x178b09[_0x3e85('0x2b')](_0x178b09['lastIndexOf']('(')+0x1,_0x178b09[_0x3e85('0x2c')](')'));_0x32d40c[_0x3e85('0x4b')]=_0x41a5a2;_0x2c13cd(_0x32d40c);})['catch'](function(_0x3e7481){_0x3e22b7(_0x3e7481['message']);});});}function emit(_0x5b5684,_0x342fd0,_0x2b3f0a,_0x1361aa){var _0x353660={'uri':util['format'](_0x3e85('0x4c'),_0x5b5684,_0x2b3f0a,_0x1361aa)};io['to'](util[_0x3e85('0x4d')](_0x3e85('0x4e'),_0x342fd0))[_0x3e85('0x4f')](_0x3e85('0x50'),_0x353660);}exports['cs']=function(_0x4f6d25,_0x59b91,_0xfe0a4b,_0x11208f,_0x24c1d5,_0x263774,_0x21c231,_0x42de16){var _0xcd3bf0={};_0x263774['remoteUri']=_0x263774['modernAuthentication']?intUtil[_0x3e85('0x51')](_0x263774[_0x3e85('0x8')][_0x3e85('0x52')]):intUtil['stripTrailingSlash'](_0x263774[_0x3e85('0xe')]);_0x263774['serverUrl']=intUtil[_0x3e85('0x51')](_0x263774[_0x3e85('0x53')]);_0xcd3bf0[_0x3e85('0x46')]=_0x42de16==='queue'||_0x42de16==='unmanaged'?_0x3e85('0x47'):'outbound';var _0x29a05b=_0x263774[_0x3e85('0x54')]?util['format'](_0x3e85('0x55'),_0x263774['CloudProvider'][_0x3e85('0x52')]):util[_0x3e85('0x4d')](_0x3e85('0x55'),_0x263774[_0x3e85('0xe')]);var _0x194cf4=util[_0x3e85('0x4d')](_0x3e85('0x56'),_0x263774[_0x3e85('0x9')]);var _0x3bb170=util[_0x3e85('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x263774[_0x3e85('0x53')],_0x59b91['uniqueid'],md5(_0x59b91[_0x3e85('0x57')]));if(_0x24c1d5&&_0x24c1d5[_0x3e85('0x58')]){logger[_0x3e85('0x1e')](_0x3e85('0x59'),_0x3e85('0x5a'));_0x59b91[_0x3e85('0x5b')]=_0x3bb170;}else if(_0x21c231&&_0x21c231[_0x3e85('0x5c')]&&_0x21c231[_0x3e85('0x5c')]!==_0x3e85('0x5d')){logger[_0x3e85('0x1e')](_0x3e85('0x5e'),_0x3e85('0x5a'));_0x59b91[_0x3e85('0x5b')]=_0x3bb170;}else{_0x59b91['recordingURL']='';}return getUser(_0xcd3bf0,_0x263774,_0x11208f,_0x194cf4,_0x29a05b,_0x42de16)['then'](function(_0x1ba06b){logger['info']('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x5f'),_0x1ba06b[_0x3e85('0x24')]);logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x60'),_0x1ba06b[_0x3e85('0x22')]);return getEndUser(_0x1ba06b,_0x263774,_0x194cf4,_0x29a05b,_0x59b91,_0x42de16,_0xfe0a4b[_0x3e85('0x61')],_0xfe0a4b[_0x3e85('0x62')]);})[_0x3e85('0x10')](function(_0x43bbad){logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x63'),_0x43bbad['enduserId']);logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x64'),_0x59b91[_0x3e85('0x26')]);return getTicket(_0x43bbad,_0x263774,_0x194cf4,_0x29a05b,_0x59b91,_0xfe0a4b,_0x42de16);})[_0x3e85('0x10')](function(_0x3c5bef){logger[_0x3e85('0x1e')](util[_0x3e85('0x4d')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x65'),_0xfe0a4b[_0x3e85('0x44')],_0x3c5bef[_0x3e85('0x4b')]));logger[_0x3e85('0x1e')](util[_0x3e85('0x4d')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x66'),_0x42de16));if(_0x42de16!==_0x3e85('0x67')&&_0xfe0a4b[_0x3e85('0x68')]){logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+']',_0x3e85('0x69'));emit(_0x263774['remoteUri'],_0x11208f[_0x3e85('0x6a')],_0xfe0a4b[_0x3e85('0x44')],_0x3c5bef[_0x3e85('0x4b')]);}})['catch'](function(_0x227ba5){logger[_0x3e85('0x12')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x6b'),_0x227ba5[_0x3e85('0x13')]);console['error'](_0x3e85('0x6c'),_0x227ba5);});}; \ No newline at end of file +var _0x1899=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','outbound','calleridnum','POST','contacts','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','Subjects','getString','Descriptions','/contacts(','/systemusers(','Fields','queue','callDirection','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','tenantId','CloudProvider','data2','resolve','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message'];(function(_0x17e9c4,_0x13991b){var _0x53922a=function(_0x47bd57){while(--_0x47bd57){_0x17e9c4['push'](_0x17e9c4['shift']());}};_0x53922a(++_0x13991b);}(_0x1899,0x140));var _0x9189=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x1899[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x9189('0x0'));var rp=require(_0x9189('0x1'));var util=require(_0x9189('0x2'));var intUtil=require(_0x9189('0x3'));var md5=require('md5');var Redis=require(_0x9189('0x4'));var logger=require(_0x9189('0x5'))(_0x9189('0x6'));var config=require(_0x9189('0x7'));config[_0x9189('0x8')]=_[_0x9189('0x9')](config[_0x9189('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9189('0xa'))(new Redis(config[_0x9189('0x8')]));function getAuthToken(_0x1e1e27,_0x12ecc1,_0x31bd5f){if(_0x1e1e27[_0x9189('0xb')]){_0x1e1e27[_0x9189('0xc')]=_0x1e1e27['CloudProvider']['data7'];_0x1e1e27[_0x9189('0xd')]=_0x1e1e27[_0x9189('0xe')][_0x9189('0xf')];return Promise[_0x9189('0x10')](_0x1e1e27[_0x9189('0xe')]['data5']);}var _0xb836dd={'method':'POST','uri':_0x12ecc1,'form':{'client_id':_0x1e1e27[_0x9189('0x11')],'resource':_0x1e1e27[_0x9189('0xc')],'username':_0x1e1e27[_0x9189('0x12')],'password':_0x1e1e27[_0x9189('0x13')],'grant_type':'password','client_secret':_0x1e1e27[_0x9189('0x14')]},'json':!![]};return rp(_0xb836dd)[_0x9189('0x15')](function(_0x6d395c){return _0x6d395c[_0x9189('0x16')];})[_0x9189('0x17')](function(_0x49a5af){logger[_0x9189('0x18')]('['+[_0x31bd5f[_0x9189('0x19')]()]+_0x9189('0x1a'));return _0x49a5af[_0x9189('0x1b')];});}function getUser(_0x26aebe,_0x4255d8,_0x5c4ee1,_0x3d75d5,_0xc0b116,_0x51bc95){return new Promise(function(_0x963f19,_0x4e7e5d){return getAuthToken(_0x4255d8,_0x3d75d5,_0x51bc95)[_0x9189('0x15')](function(_0x19ce8c){var _0x27bb97={'method':'GET','uri':_0xc0b116+_0x9189('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x19ce8c,'OData-Version':_0x9189('0x1d')},'json':!![]};return rp(_0x27bb97);})['then'](function(_0x555eb5){var _0x41af39=_0x555eb5[_0x9189('0x1e')];var _0x5d7c31=![];var _0x4e6643=null;if(!_[_0x9189('0x1f')](_0x5c4ee1)){if(intUtil[_0x9189('0x20')](_0x5c4ee1[_0x9189('0x21')])){_0x26aebe[_0x9189('0x22')]=_0x5c4ee1[_0x9189('0x21')];for(_0x4e6643=0x0;_0x4e6643<_0x41af39[_0x9189('0x23')];_0x4e6643++){if(_0x41af39[_0x4e6643][_0x9189('0x24')]===_0x5c4ee1[_0x9189('0x21')]&&!_0x41af39[_0x4e6643][_0x9189('0x25')]){_0x5d7c31=!![];logger[_0x9189('0x26')]('['+[_0x51bc95[_0x9189('0x19')]()]+_0x9189('0x27')+_0x41af39[_0x4e6643][_0x9189('0x28')]+'!');_0x26aebe['userId']=_0x41af39[_0x4e6643][_0x9189('0x28')];}}}}if(!_0x5d7c31){logger[_0x9189('0x26')]('['+[_0x51bc95['toUpperCase']()]+_0x9189('0x29'));_0x26aebe[_0x9189('0x22')]=_0x4255d8['username'];for(_0x4e6643=0x0;_0x4e6643<_0x41af39['length'];_0x4e6643++){if(_0x41af39[_0x4e6643][_0x9189('0x24')]===_0x4255d8['username']){_0x26aebe[_0x9189('0x2a')]=_0x41af39[_0x4e6643][_0x9189('0x28')];}}}_0x963f19(_0x26aebe);})['catch'](function(_0x5bff42){_0x4e7e5d(_0x5bff42[_0x9189('0x1b')]);});});}function createEndUser(_0x21d1e2,_0x4bed4d,_0x1056d5,_0x4e949a,_0x168ab6,_0x1e2a18,_0x4c7fef){return new Promise(function(_0x131bad,_0x307c07){return getAuthToken(_0x4bed4d,_0x1056d5,_0x1e2a18)[_0x9189('0x15')](function(_0x582e25){var _0x541a8f=_0x1e2a18[_0x9189('0x2b')]()===_0x9189('0x2c')?_0x168ab6['destcalleridnum']:_0x168ab6[_0x9189('0x2d')];var _0x3c7ccf={'method':_0x9189('0x2e'),'uri':_0x4e949a+_0x9189('0x2f'),'body':{'fullname':_0x541a8f,'firstname':_0x541a8f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x21d1e2[_0x9189('0x2a')]+')'},'headers':{'Authorization':_0x9189('0x30')+_0x582e25,'OData-Version':_0x9189('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x3c7ccf[_0x9189('0x31')][_0x4c7fef]=_0x541a8f;return rp(_0x3c7ccf);})[_0x9189('0x15')](function(_0x37b219){var _0x4f25ad=_0x37b219[_0x9189('0x32')][_0x9189('0x33')];var _0xefbcae=_0x4f25ad[_0x9189('0x34')](_0x4f25ad[_0x9189('0x35')]('(')+0x1,_0x4f25ad['lastIndexOf'](')'));_0x21d1e2[_0x9189('0x36')]=_0xefbcae;_0x131bad(_0x21d1e2);})['catch'](function(_0x3244fb){_0x307c07(_0x3244fb[_0x9189('0x1b')]);});});}function getEndUser(_0xf54950,_0x1e81b7,_0x202367,_0x1f2aaf,_0x3d247d,_0x36d2d4,_0x1e9336,_0x278274){var _0x25997a=_0x36d2d4[_0x9189('0x2b')]()===_0x9189('0x2c')?_0x3d247d[_0x9189('0x37')]:_0x3d247d[_0x9189('0x2d')];return getAuthToken(_0x1e81b7,_0x202367,_0x36d2d4)[_0x9189('0x15')](function(_0x4fc915){_0x278274=_0x278274?_0x278274:_0x9189('0x38');var _0x302333={'method':_0x9189('0x39'),'uri':_0x1f2aaf+_0x9189('0x3a')+_0x278274+_0x9189('0x3b')+_0x278274+'\x20eq\x20\x27'+_0x25997a[_0x9189('0x3c')]('+',_0x9189('0x3d'))+'\x27','headers':{'Authorization':_0x9189('0x30')+_0x4fc915,'If-None-Match':null,'OData-Version':_0x9189('0x1d')},'json':!![]};return rp(_0x302333);})['then'](function(_0x39628d){var _0x81b271=![];if(!_0x39628d)return _0x81b271;var _0x3fbcbf=_0x39628d[_0x9189('0x1e')];for(var _0x11f6b6=0x0;_0x11f6b6<_0x3fbcbf[_0x9189('0x23')];_0x11f6b6++){if(_0x3fbcbf[_0x11f6b6][_0x278274]===_0x25997a){_0x81b271=!![];_0xf54950[_0x9189('0x36')]=_0x3fbcbf[_0x11f6b6][_0x9189('0x3e')];}}return _0x81b271;})[_0x9189('0x15')](function(_0x33cb50){if(_0x33cb50)return _0xf54950;if(_0x1e9336===_0x9189('0x3f')){logger['info']('['+[_0x36d2d4['toUpperCase']()]+_0x9189('0x40'));return _0xf54950;}return createEndUser(_0xf54950,_0x1e81b7,_0x202367,_0x1f2aaf,_0x3d247d,_0x36d2d4,_0x278274)[_0x9189('0x15')](function(_0x2666b1){logger[_0x9189('0x26')]('['+[_0x36d2d4[_0x9189('0x19')]()]+']\x20Enduser\x20created!',_0x2666b1[_0x9189('0x36')]);return _0x2666b1;});});}function getCustomFields(_0x212165,_0x4a10a0,_0x320bf8){var _0x12abea={};if(_0x212165[_0x9189('0x23')]>0x0){_[_0x9189('0x41')](_0x212165,function(_0x1b1d5e){if(_[_0x9189('0x42')](['string',_0x9189('0x43')],_0x1b1d5e[_0x9189('0x44')])&&_0x1b1d5e[_0x9189('0x45')]&&!_0x1b1d5e[_0x9189('0x46')]){var _0x48e72d=_0x1b1d5e[_0x9189('0x47')][_0x9189('0x2b')]();var _0x336fb7=_0x48e72d[_0x9189('0x34')](0x0,_0x48e72d['indexOf']('_'));var _0x2289b7=_0x48e72d[_0x9189('0x34')](_0x48e72d[_0x9189('0x48')]('_')+0x1);if(_0x336fb7===_0x320bf8){_0x12abea[_0x2289b7]=_0x1b1d5e[_0x9189('0x49')];}}});}return _0x12abea;}function getTicket(_0x5ea458,_0x3f3337,_0x25e57d,_0x1a6a4f,_0x25e257,_0x4c6952,_0x4bbffa){return new Promise(function(_0x63835c,_0x4ad22f){var _0x38ed40;return getAuthToken(_0x3f3337,_0x25e57d,_0x4bbffa)[_0x9189('0x15')](function(_0x2d95e7){if(_0x4c6952[_0x9189('0x4a')]===_0x9189('0x4b')){_0x38ed40={'method':_0x9189('0x2e'),'uri':_0x1a6a4f+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x4c6952[_0x9189('0x4c')],_0x25e257,'\x20'),'description':intUtil[_0x9189('0x4d')](_0x4c6952[_0x9189('0x4e')],_0x25e257,'\x0a'),'customerid_contact@odata.bind':_0x5ea458[_0x9189('0x36')]?_0x9189('0x4f')+_0x5ea458[_0x9189('0x36')]+')':undefined,'ownerid@odata.bind':_0x9189('0x50')+_0x5ea458[_0x9189('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x4c6952[_0x9189('0x51')],_0x25e257,_0x4c6952[_0x9189('0x4a')])),'headers':{'Authorization':_0x9189('0x30')+_0x2d95e7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4c6952[_0x9189('0x4a')]==='phonecall'){var _0x2908c7=_0x5ea458['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5ea458[_0x9189('0x2a')]+')','participationtypemask':_0x5ea458['callDirection']===_0x9189('0x52')?0x2:0x1},{'partyid_contact@odata.bind':_0x9189('0x4f')+_0x5ea458[_0x9189('0x36')]+')','participationtypemask':_0x5ea458[_0x9189('0x53')]===_0x9189('0x52')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x9189('0x50')+_0x5ea458[_0x9189('0x2a')]+')','participationtypemask':_0x5ea458[_0x9189('0x53')]===_0x9189('0x52')?0x2:0x1}];_0x38ed40={'method':_0x9189('0x2e'),'uri':_0x1a6a4f+_0x9189('0x54'),'body':Object[_0x9189('0x55')]({},{'subject':intUtil[_0x9189('0x4d')](_0x4c6952['Subjects'],_0x25e257,'\x20'),'phonenumber':String(_0x25e257[_0x9189('0x2d')]),'description':intUtil[_0x9189('0x4d')](_0x4c6952[_0x9189('0x4e')],_0x25e257,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5ea458['enduserId']?_0x9189('0x4f')+_0x5ea458[_0x9189('0x36')]+')':undefined,'ownerid@odata.bind':_0x9189('0x50')+_0x5ea458['userId']+')','directioncode':_0x5ea458[_0x9189('0x53')]===_0x9189('0x52')?![]:!![],'phonecall_activity_parties':_0x2908c7},getCustomFields(_0x4c6952[_0x9189('0x51')],_0x25e257,_0x4c6952[_0x9189('0x4a')])),'headers':{'Authorization':_0x9189('0x30')+_0x2d95e7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x38ed40);})[_0x9189('0x15')](function(_0x7606a1){var _0xb4667e=_0x7606a1[_0x9189('0x32')][_0x9189('0x33')];var _0x336b89=_0xb4667e[_0x9189('0x34')](_0xb4667e[_0x9189('0x35')]('(')+0x1,_0xb4667e[_0x9189('0x35')](')'));_0x5ea458[_0x9189('0x56')]=_0x336b89;_0x63835c(_0x5ea458);})[_0x9189('0x17')](function(_0x5d56cf){_0x4ad22f(_0x5d56cf[_0x9189('0x1b')]);});});}function emit(_0x1b5e80,_0x491647,_0x359f38,_0x52727e){var _0x558564={'uri':util['format'](_0x9189('0x57'),_0x1b5e80,_0x359f38,_0x52727e)};io['to'](util[_0x9189('0x58')](_0x9189('0x59'),_0x491647))[_0x9189('0x5a')](_0x9189('0x5b'),_0x558564);}exports['cs']=function(_0xcb8373,_0x5cede5,_0x4377b0,_0x502822,_0x5755c0,_0x113e86,_0x7b2447,_0x288012){var _0x3d8633={};_0x113e86[_0x9189('0xc')]=_0x113e86[_0x9189('0xb')]?intUtil[_0x9189('0x5c')](_0x113e86[_0x9189('0xe')]['data7']):intUtil['stripTrailingSlash'](_0x113e86[_0x9189('0xc')]);_0x113e86['serverUrl']=intUtil['stripTrailingSlash'](_0x113e86['serverUrl']);_0x3d8633[_0x9189('0x53')]=_0x288012==='queue'||_0x288012===_0x9189('0x5d')?_0x9189('0x52'):_0x9189('0x2c');var _0x5543d2=_0x113e86[_0x9189('0xb')]?util['format'](_0x9189('0x5e'),_0x113e86[_0x9189('0xe')][_0x9189('0x5f')]):util[_0x9189('0x58')](_0x9189('0x5e'),_0x113e86['remoteUri']);var _0x38a965=util['format'](_0x9189('0x60'),_0x113e86[_0x9189('0xd')]);var _0x333c44=util[_0x9189('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x113e86[_0x9189('0x61')],_0x5cede5[_0x9189('0x62')],md5(_0x5cede5['uniqueid']));if(_0x5755c0&&_0x5755c0[_0x9189('0x63')]){logger[_0x9189('0x26')](_0x9189('0x64'),'Recording\x20is\x20enabled!');_0x5cede5[_0x9189('0x65')]=_0x333c44;}else if(_0x7b2447&&_0x7b2447[_0x9189('0x66')]&&_0x7b2447[_0x9189('0x66')]!=='none'){logger[_0x9189('0x26')](_0x9189('0x67'),_0x9189('0x68'));_0x5cede5['recordingURL']=_0x333c44;}else{_0x5cede5[_0x9189('0x65')]='';}return getUser(_0x3d8633,_0x113e86,_0x502822,_0x38a965,_0x5543d2,_0x288012)[_0x9189('0x15')](function(_0x394f53){logger[_0x9189('0x26')]('['+_0x288012[_0x9189('0x19')]()+_0x9189('0x69'),_0x394f53[_0x9189('0x2a')]);logger['info']('['+_0x288012[_0x9189('0x19')]()+_0x9189('0x6a'),_0x394f53[_0x9189('0x22')]);return getEndUser(_0x394f53,_0x113e86,_0x38a965,_0x5543d2,_0x5cede5,_0x288012,_0x4377b0[_0x9189('0x6b')],_0x4377b0['additionalSearchContact']);})[_0x9189('0x15')](function(_0x4040a0){logger[_0x9189('0x26')]('['+_0x288012['toUpperCase']()+_0x9189('0x6c'),_0x4040a0[_0x9189('0x36')]);logger[_0x9189('0x26')]('['+_0x288012[_0x9189('0x19')]()+_0x9189('0x6d'),_0x5cede5['calleridnum']);return getTicket(_0x4040a0,_0x113e86,_0x38a965,_0x5543d2,_0x5cede5,_0x4377b0,_0x288012);})[_0x9189('0x15')](function(_0x1a3ac6){logger[_0x9189('0x26')](util[_0x9189('0x58')]('['+_0x288012[_0x9189('0x19')]()+_0x9189('0x6e'),_0x4377b0[_0x9189('0x4a')],_0x1a3ac6[_0x9189('0x56')]));logger[_0x9189('0x26')](util[_0x9189('0x58')]('['+_0x288012['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x288012));if(_0x288012!==_0x9189('0x5d')&&_0x4377b0[_0x9189('0x6f')]){logger[_0x9189('0x26')]('['+_0x288012[_0x9189('0x19')]()+']',_0x9189('0x70'));emit(_0x113e86[_0x9189('0xc')],_0x502822[_0x9189('0x71')],_0x4377b0[_0x9189('0x4a')],_0x1a3ac6[_0x9189('0x56')]);}})[_0x9189('0x17')](function(_0x3ee7e1){logger[_0x9189('0x18')]('['+_0x288012['toUpperCase']()+_0x9189('0x72'),_0x3ee7e1[_0x9189('0x1b')]);console[_0x9189('0x18')](_0x9189('0x73'),_0x3ee7e1);});}; \ 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 3cabd83..37cdd4a 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 _0xa7e2=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','toString','base64','stringify','map','includes','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','type','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','catch','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost'];(function(_0xa80ac,_0x250812){var _0x3b64cf=function(_0x47773e){while(--_0x47773e){_0xa80ac['push'](_0xa80ac['shift']());}};_0x3b64cf(++_0x250812);}(_0xa7e2,0x10c));var _0x2a7e=function(_0x3a6eda,_0x3a0cd4){_0x3a6eda=_0x3a6eda-0x0;var _0x322bcd=_0xa7e2[_0x3a6eda];return _0x322bcd;};'use strict';var _=require(_0x2a7e('0x0'));var rp=require(_0x2a7e('0x1'));var md5=require(_0x2a7e('0x2'));var util=require('util');var Redis=require(_0x2a7e('0x3'));var intUtil=require(_0x2a7e('0x4'));var config=require(_0x2a7e('0x5'));var logger=require(_0x2a7e('0x6'))(_0x2a7e('0x7'));config['redis']=_[_0x2a7e('0x8')](config[_0x2a7e('0x9')],{'host':_0x2a7e('0xa'),'port':0x18eb});var io=require(_0x2a7e('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x2a7e('0xc'),'Accept':'application/json'};function emit(_0x314059,_0x105ff5,_0x429780){io['to'](_0x314059)[_0x2a7e('0xd')](_0x105ff5,_0x429780);}function getTicket(_0x36ec34,_0x59457c,_0x3be733,_0x2135ea,_0x356c8d){logger[_0x2a7e('0xe')](_0x2a7e('0xf'));var _0x43e0bb=_[_0x2a7e('0x10')]({'responder_id':_0x59457c['id'],'requester_id':_0x3be733['id'],'name':util[_0x2a7e('0x11')](_0x2a7e('0x12'),_0x356c8d[_0x2a7e('0x13')]),'phone':_0x356c8d[_0x2a7e('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2a7e('0x15')](_0x2135ea[_0x2a7e('0x16')],_0x356c8d,'\x20'),'description':intUtil[_0x2a7e('0x15')](_0x2135ea[_0x2a7e('0x17')],_0x356c8d,'
'),'tags':getTags(_0x2135ea[_0x2a7e('0x18')],_0x2a7e('0x19'))},getCustomFields(_0x2135ea[_0x2a7e('0x1a')],_0x356c8d));_0x43e0bb[_0x2a7e('0x1b')]=_[_0x2a7e('0x1c')](_[_0x2a7e('0x1d')](_0x43e0bb[_0x2a7e('0x1b')],'id'),_0x2a7e('0x1e'));return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x1f'),_0x36ec34[_0x2a7e('0x20')]),'method':'POST','body':_0x43e0bb})[_0x2a7e('0x21')](function(_0x1f93a1){logger[_0x2a7e('0xe')](_0x2a7e('0x22'));return _0x1f93a1;});}function getUser(_0x23b639,_0x25c4ae){if(intUtil[_0x2a7e('0x23')](_0x25c4ae)){return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x24'),_0x23b639[_0x2a7e('0x20')]),'qs':{'email':_0x25c4ae}})[_0x2a7e('0x21')](function(_0x125ef3){if(_0x125ef3[_0x2a7e('0x25')]){logger['info'](_0x2a7e('0x26'));return _[_0x2a7e('0x27')](_0x125ef3,function(_0x33e9d5){return _0x33e9d5['contact'][_0x2a7e('0x28')]===_0x25c4ae;});}else{logger['info'](_0x2a7e('0x29'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x23b639[_0x2a7e('0x20')])})[_0x2a7e('0x21')](function(_0x7983ac){logger[_0x2a7e('0xe')](_0x2a7e('0x2a'));return _0x7983ac;});}});}else{logger[_0x2a7e('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x2b'),_0x23b639[_0x2a7e('0x20')])})[_0x2a7e('0x21')](function(_0x2ace1e){logger['info'](_0x2a7e('0x2a'));return _0x2ace1e;});}}function getEndUser(_0x324b44,_0x47b456,_0x1e0834){logger[_0x2a7e('0xe')](_0x2a7e('0x2c'),_0x1e0834);return request({'uri':util[_0x2a7e('0x11')]('%s/api/v2/contacts',_0x324b44[_0x2a7e('0x20')]),'qs':{'phone':_0x1e0834}})[_0x2a7e('0x21')](function(_0x4789f9){if(_0x4789f9[_0x2a7e('0x25')]){logger[_0x2a7e('0xe')](_0x2a7e('0x2d'));return _['find'](_0x4789f9,{'phone':_0x1e0834});}else{logger[_0x2a7e('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x2e'),_0x324b44[_0x2a7e('0x20')]),'method':_0x2a7e('0x2f'),'body':{'name':_0x47b456,'phone':_0x1e0834}})['then'](function(_0x5677f1){logger[_0x2a7e('0xe')](_0x2a7e('0x30'));return _0x5677f1;});}});}function getAuth(_0x4cb83d){return util[_0x2a7e('0x11')](_0x2a7e('0x31'),new Buffer(_0x4cb83d['apiKey']+':X')[_0x2a7e('0x32')](_0x2a7e('0x33')));}function request(_0x46d8e2){logger['debug']('[HTTP]',JSON[_0x2a7e('0x34')](_0x46d8e2));return rp(_['defaults'](_0x46d8e2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e2c93,_0x4e2719){var _0x1bb4e6=[];if(_0x3e2c93&&_0x3e2c93['length']>0x0){_0x1bb4e6=_[_0x2a7e('0x35')](_0x3e2c93,_0x4e2719);}return _0x1bb4e6;}function getCustomFields(_0x327986,_0x2c4b29){var _0x368956=[];var _0x116e84={'custom_fields':[]};if(_0x327986[_0x2a7e('0x25')]>0x0){_['forEach'](_0x327986,function(_0x5b6b59){if(_[_0x2a7e('0x36')]([_0x2a7e('0x37'),'picklist'],_0x5b6b59['type'])&&_0x5b6b59[_0x2a7e('0x38')]&&!_0x5b6b59[_0x2a7e('0x39')]){_0x116e84[_0x5b6b59[_0x2a7e('0x38')][_0x2a7e('0x3a')]()]=_0x5b6b59[_0x2a7e('0x3b')][_0x2a7e('0x32')]();}else if(_['includes'](['string','picklist'],_0x5b6b59['type'])&&_0x5b6b59[_0x2a7e('0x3c')]&&_0x5b6b59[_0x2a7e('0x39')]){_0x116e84['custom_fields'][_0x2a7e('0x3d')]({'id':_0x5b6b59['idField'],'value':_0x5b6b59[_0x2a7e('0x3b')]['toString']()});}else if(_0x5b6b59['type']===_0x2a7e('0x3e')&&_0x5b6b59[_0x2a7e('0x3f')]&&_0x5b6b59['idField']&&_0x5b6b59['customField']){_0x2c4b29[_0x5b6b59['variableName']]&&_0x116e84[_0x2a7e('0x1b')][_0x2a7e('0x3d')]({'id':_0x5b6b59[_0x2a7e('0x3c')],'value':_0x2c4b29[_0x5b6b59[_0x2a7e('0x3f')]]['toString']()});}else if(_0x5b6b59[_0x2a7e('0x40')]==='customVariable'&&_0x5b6b59['Variable']&&_0x5b6b59[_0x2a7e('0x41')]['name']&&_0x5b6b59[_0x2a7e('0x3c')]&&_0x5b6b59[_0x2a7e('0x39')]){_0x2c4b29[_0x5b6b59[_0x2a7e('0x41')]['name'][_0x2a7e('0x3a')]()]&&_0x116e84[_0x2a7e('0x1b')][_0x2a7e('0x3d')]({'id':_0x5b6b59[_0x2a7e('0x3c')],'value':_0x2c4b29[_0x5b6b59[_0x2a7e('0x41')]['name'][_0x2a7e('0x3a')]()][_0x2a7e('0x32')]()});}});}return _0x116e84;}exports[_0x2a7e('0x42')]=function(_0x470c77,_0x35fc68,_0x1baaad,_0x560934,_0x4338c3,_0x3fa188){var _0x732b37,_0x33749b;_0x3fa188[_0x2a7e('0x20')]=intUtil['stripTrailingSlash'](_0x3fa188[_0x2a7e('0x20')]);_0x3fa188['serverUrl']=intUtil[_0x2a7e('0x43')](_0x3fa188[_0x2a7e('0x44')]);if(_0x4338c3&&_0x4338c3[_0x2a7e('0x45')]){logger[_0x2a7e('0xe')]('[QUEUE]',_0x2a7e('0x46'));_0x35fc68[_0x2a7e('0x47')]=util['format'](_0x2a7e('0x48'),_0x3fa188['serverUrl'],_0x35fc68[_0x2a7e('0x49')],md5(_0x35fc68[_0x2a7e('0x49')]));}else{_0x35fc68[_0x2a7e('0x47')]='';}headers[_0x2a7e('0x4a')]=getAuth(_0x3fa188);return getUser(_0x3fa188,_0x560934['email'])[_0x2a7e('0x21')](function(_0x3b3ec2){_0x732b37=_0x3b3ec2;logger[_0x2a7e('0xe')](_0x2a7e('0x4b'),_0x732b37['id']);return getEndUser(_0x3fa188,_0x35fc68[_0x2a7e('0x13')],_0x35fc68[_0x2a7e('0x14')]);})[_0x2a7e('0x21')](function(_0x2cbbbd){_0x33749b=_0x2cbbbd;logger[_0x2a7e('0xe')](_0x2a7e('0x4c'),_0x33749b['id']);return getTicket(_0x3fa188,_0x732b37,_0x33749b,_0x1baaad,_0x35fc68);})[_0x2a7e('0x21')](function(_0x105fb5){if(_0x105fb5&&_0x105fb5['id']){logger['info'](_0x2a7e('0x22'));logger[_0x2a7e('0xe')](_0x2a7e('0x4d'),_0x105fb5['id']);logger[_0x2a7e('0xe')](_0x2a7e('0x4e'),_0x2a7e('0x4f'));emit(util[_0x2a7e('0x11')](_0x2a7e('0x50'),_0x560934[_0x2a7e('0x19')]),_0x2a7e('0x51'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3fa188['remoteUri'],_0x105fb5['id'])});}})['catch'](function(_0x4c66f8){logger['error'](_0x2a7e('0x4e'),JSON[_0x2a7e('0x34')](_0x4c66f8));});};exports[_0x2a7e('0x52')]=function(_0x16289d,_0x53f397,_0x6bc56,_0x5af831,_0x43c85b,_0x3213dc,_0x1d4aaf){var _0x2b9b26,_0x2ec70b;_0x3213dc[_0x2a7e('0x20')]=intUtil[_0x2a7e('0x43')](_0x3213dc[_0x2a7e('0x20')]);_0x3213dc['serverUrl']=intUtil['stripTrailingSlash'](_0x3213dc['serverUrl']);if(_0x1d4aaf&&_0x1d4aaf['recordingFormat']&&_0x1d4aaf[_0x2a7e('0x53')]!=='none'){logger[_0x2a7e('0xe')](_0x2a7e('0x54'),_0x2a7e('0x46'));_0x53f397[_0x2a7e('0x47')]=util[_0x2a7e('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3213dc['serverUrl'],_0x53f397[_0x2a7e('0x49')],md5(_0x53f397[_0x2a7e('0x49')]));}headers['Authorization']=getAuth(_0x3213dc);return getUser(_0x3213dc,_0x5af831['email'])[_0x2a7e('0x21')](function(_0x2578d6){_0x2b9b26=_0x2578d6;logger[_0x2a7e('0xe')](_0x2a7e('0x4b'),_0x2b9b26['id']);return getEndUser(_0x3213dc,_0x53f397[_0x2a7e('0x55')],_0x53f397[_0x2a7e('0x56')]);})[_0x2a7e('0x21')](function(_0x196c9e){_0x2ec70b=_0x196c9e;logger[_0x2a7e('0xe')](_0x2a7e('0x4c'),_0x2ec70b['id']);return getTicket(_0x3213dc,_0x2b9b26,_0x2ec70b,_0x6bc56,_0x53f397);})['then'](function(_0x520e7e){if(_0x520e7e&&_0x520e7e['id']){logger[_0x2a7e('0xe')](_0x2a7e('0x22'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x520e7e['id']);logger['info'](_0x2a7e('0x54'),_0x2a7e('0x4f'));emit(util[_0x2a7e('0x11')](_0x2a7e('0x50'),_0x5af831['name']),_0x2a7e('0x51'),{'uri':util[_0x2a7e('0x11')](_0x2a7e('0x57'),_0x3213dc[_0x2a7e('0x20')],_0x520e7e['id'])});}})[_0x2a7e('0x58')](function(_0x420c19){logger[_0x2a7e('0x59')](_0x2a7e('0x54'),JSON[_0x2a7e('0x34')](_0x420c19));});};exports[_0x2a7e('0x5a')]=function(_0x237f08,_0x551ac2,_0x422282,_0x4268f0,_0x48d945,_0x1ec964){var _0x2a5401,_0x3f71dc;_0x1ec964[_0x2a7e('0x20')]=intUtil[_0x2a7e('0x43')](_0x1ec964[_0x2a7e('0x20')]);_0x1ec964[_0x2a7e('0x44')]=intUtil[_0x2a7e('0x43')](_0x1ec964[_0x2a7e('0x44')]);if(_0x48d945&&_0x48d945['monitor_format']){logger[_0x2a7e('0xe')]('['+_0x551ac2[_0x2a7e('0x5b')][_0x2a7e('0x5c')]()+']','Recording\x20is\x20enabled!');_0x551ac2[_0x2a7e('0x47')]=util[_0x2a7e('0x11')](_0x2a7e('0x48'),_0x1ec964[_0x2a7e('0x44')],_0x551ac2[_0x2a7e('0x49')],md5(_0x551ac2[_0x2a7e('0x49')]));}else{_0x551ac2[_0x2a7e('0x47')]='';}headers[_0x2a7e('0x4a')]=getAuth(_0x1ec964);return getUser(_0x1ec964,'')['then'](function(_0x5eb7dc){_0x2a5401=_0x5eb7dc;logger['info'](_0x2a7e('0x4b'),_0x2a5401['id']);return getEndUser(_0x1ec964,_0x551ac2[_0x2a7e('0x13')],_0x551ac2['calleridnum']);})[_0x2a7e('0x21')](function(_0x17ad8a){_0x3f71dc=_0x17ad8a;logger['info'](_0x2a7e('0x4c'),_0x3f71dc['id']);return getTicket(_0x1ec964,_0x2a5401,_0x3f71dc,_0x422282,_0x551ac2);})[_0x2a7e('0x21')](function(_0x395650){if(_0x395650){logger['info'](_0x2a7e('0x22'));logger[_0x2a7e('0xe')](_0x2a7e('0x4d'),_0x395650['id']);}})[_0x2a7e('0x58')](function(_0x4d85e5){logger[_0x2a7e('0x59')]('['+_0x551ac2[_0x2a7e('0x5b')]['toUpperCase']()+']',JSON['stringify'](_0x4d85e5));});}; \ No newline at end of file +var _0x308b=['picklist','type','customField','nameField','toLowerCase','content','string','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridnum','catch','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','POST','then','Ticket\x20created!','validateEmail','remoteUri','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','defaults','GET','forEach','includes'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x308b,0x88));var _0xb308=function(_0x10e8f0,_0x407486){_0x10e8f0=_0x10e8f0-0x0;var _0x13c9a1=_0x308b[_0x10e8f0];return _0x13c9a1;};'use strict';var _=require(_0xb308('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xb308('0x1'));var Redis=require(_0xb308('0x2'));var intUtil=require('./util');var config=require(_0xb308('0x3'));var logger=require(_0xb308('0x4'))(_0xb308('0x5'));config[_0xb308('0x6')]=_['defaults'](config[_0xb308('0x6')],{'host':_0xb308('0x7'),'port':0x18eb});var io=require(_0xb308('0x8'))(new Redis(config[_0xb308('0x6')]));var headers={'Content-Type':_0xb308('0x9'),'Accept':_0xb308('0x9')};function emit(_0x289249,_0xcb765d,_0x57c01d){io['to'](_0x289249)[_0xb308('0xa')](_0xcb765d,_0x57c01d);}function getTicket(_0x2d5976,_0x3fcfd5,_0x47e0ad,_0x27aacd,_0x5e3e96){logger[_0xb308('0xb')](_0xb308('0xc'));var _0x2e516d=_[_0xb308('0xd')]({'responder_id':_0x3fcfd5['id'],'requester_id':_0x47e0ad['id'],'name':util[_0xb308('0xe')](_0xb308('0xf'),_0x5e3e96[_0xb308('0x10')]),'phone':_0x5e3e96['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x27aacd[_0xb308('0x11')],_0x5e3e96,'\x20'),'description':intUtil[_0xb308('0x12')](_0x27aacd[_0xb308('0x13')],_0x5e3e96,_0xb308('0x14')),'tags':getTags(_0x27aacd[_0xb308('0x15')],_0xb308('0x16'))},getCustomFields(_0x27aacd[_0xb308('0x17')],_0x5e3e96));_0x2e516d[_0xb308('0x18')]=_[_0xb308('0x19')](_[_0xb308('0x1a')](_0x2e516d[_0xb308('0x18')],'id'),_0xb308('0x1b'));return request({'uri':util[_0xb308('0xe')]('%s/api/v2/tickets',_0x2d5976['remoteUri']),'method':_0xb308('0x1c'),'body':_0x2e516d})[_0xb308('0x1d')](function(_0x5bf851){logger[_0xb308('0xb')](_0xb308('0x1e'));return _0x5bf851;});}function getUser(_0x53d1ca,_0x1d1951){if(intUtil[_0xb308('0x1f')](_0x1d1951)){return request({'uri':util[_0xb308('0xe')]('%s/api/v2/agents',_0x53d1ca[_0xb308('0x20')]),'qs':{'email':_0x1d1951}})[_0xb308('0x1d')](function(_0x375970){if(_0x375970['length']){logger[_0xb308('0xb')]('Agent\x20found!');return _[_0xb308('0x21')](_0x375970,function(_0x31b88e){return _0x31b88e[_0xb308('0x22')]['email']===_0x1d1951;});}else{logger[_0xb308('0xb')](_0xb308('0x23'));return request({'uri':util[_0xb308('0xe')](_0xb308('0x24'),_0x53d1ca[_0xb308('0x20')])})[_0xb308('0x1d')](function(_0x317235){logger[_0xb308('0xb')](_0xb308('0x25'));return _0x317235;});}});}else{logger[_0xb308('0xb')](_0xb308('0x26'));return request({'uri':util['format'](_0xb308('0x24'),_0x53d1ca[_0xb308('0x20')])})['then'](function(_0x202f6f){logger['info'](_0xb308('0x25'));return _0x202f6f;});}}function getEndUser(_0xd769ff,_0x42a6af,_0x1356d0){logger[_0xb308('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1356d0);return request({'uri':util[_0xb308('0xe')](_0xb308('0x27'),_0xd769ff[_0xb308('0x20')]),'qs':{'phone':_0x1356d0}})['then'](function(_0x16a228){if(_0x16a228[_0xb308('0x28')]){logger[_0xb308('0xb')]('Enduser\x20found!');return _[_0xb308('0x21')](_0x16a228,{'phone':_0x1356d0});}else{logger[_0xb308('0xb')](_0xb308('0x29'));return request({'uri':util['format'](_0xb308('0x27'),_0xd769ff[_0xb308('0x20')]),'method':_0xb308('0x1c'),'body':{'name':_0x42a6af,'phone':_0x1356d0}})[_0xb308('0x1d')](function(_0x1c2751){logger[_0xb308('0xb')](_0xb308('0x2a'));return _0x1c2751;});}});}function getAuth(_0x726b2f){return util[_0xb308('0xe')]('Basic\x20%s',new Buffer(_0x726b2f[_0xb308('0x2b')]+':X')[_0xb308('0x2c')]('base64'));}function request(_0x137701){logger[_0xb308('0x2d')](_0xb308('0x2e'),JSON[_0xb308('0x2f')](_0x137701));return rp(_[_0xb308('0x30')](_0x137701,{'method':_0xb308('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x152ba6,_0x46efae){var _0x15ce8e=[];if(_0x152ba6&&_0x152ba6['length']>0x0){_0x15ce8e=_['map'](_0x152ba6,_0x46efae);}return _0x15ce8e;}function getCustomFields(_0xec5f9,_0x45a012){var _0x777b4e=[];var _0x2fc0c3={'custom_fields':[]};if(_0xec5f9[_0xb308('0x28')]>0x0){_[_0xb308('0x32')](_0xec5f9,function(_0x1b89ff){if(_[_0xb308('0x33')](['string',_0xb308('0x34')],_0x1b89ff[_0xb308('0x35')])&&_0x1b89ff['nameField']&&!_0x1b89ff[_0xb308('0x36')]){_0x2fc0c3[_0x1b89ff[_0xb308('0x37')][_0xb308('0x38')]()]=_0x1b89ff[_0xb308('0x39')][_0xb308('0x2c')]();}else if(_['includes']([_0xb308('0x3a'),_0xb308('0x34')],_0x1b89ff['type'])&&_0x1b89ff[_0xb308('0x3b')]&&_0x1b89ff['customField']){_0x2fc0c3[_0xb308('0x18')]['push']({'id':_0x1b89ff['idField'],'value':_0x1b89ff[_0xb308('0x39')][_0xb308('0x2c')]()});}else if(_0x1b89ff[_0xb308('0x35')]===_0xb308('0x3c')&&_0x1b89ff['variableName']&&_0x1b89ff[_0xb308('0x3b')]&&_0x1b89ff[_0xb308('0x36')]){_0x45a012[_0x1b89ff[_0xb308('0x3d')]]&&_0x2fc0c3[_0xb308('0x18')][_0xb308('0x3e')]({'id':_0x1b89ff[_0xb308('0x3b')],'value':_0x45a012[_0x1b89ff[_0xb308('0x3d')]][_0xb308('0x2c')]()});}else if(_0x1b89ff[_0xb308('0x35')]===_0xb308('0x3f')&&_0x1b89ff[_0xb308('0x40')]&&_0x1b89ff['Variable']['name']&&_0x1b89ff['idField']&&_0x1b89ff[_0xb308('0x36')]){_0x45a012[_0x1b89ff[_0xb308('0x40')]['name'][_0xb308('0x38')]()]&&_0x2fc0c3['custom_fields']['push']({'id':_0x1b89ff[_0xb308('0x3b')],'value':_0x45a012[_0x1b89ff[_0xb308('0x40')][_0xb308('0x16')][_0xb308('0x38')]()][_0xb308('0x2c')]()});}});}return _0x2fc0c3;}exports[_0xb308('0x41')]=function(_0x1c8ee6,_0x26ad5f,_0x1807f4,_0x231fce,_0x2f8b50,_0x5157d4){var _0x13329c,_0x447449;_0x5157d4[_0xb308('0x20')]=intUtil[_0xb308('0x42')](_0x5157d4[_0xb308('0x20')]);_0x5157d4[_0xb308('0x43')]=intUtil[_0xb308('0x42')](_0x5157d4[_0xb308('0x43')]);if(_0x2f8b50&&_0x2f8b50[_0xb308('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x26ad5f[_0xb308('0x45')]=util[_0xb308('0xe')](_0xb308('0x46'),_0x5157d4['serverUrl'],_0x26ad5f[_0xb308('0x47')],md5(_0x26ad5f[_0xb308('0x47')]));}else{_0x26ad5f['recordingURL']='';}headers[_0xb308('0x48')]=getAuth(_0x5157d4);return getUser(_0x5157d4,_0x231fce[_0xb308('0x49')])[_0xb308('0x1d')](function(_0x1c90ed){_0x13329c=_0x1c90ed;logger[_0xb308('0xb')](_0xb308('0x4a'),_0x13329c['id']);return getEndUser(_0x5157d4,_0x26ad5f[_0xb308('0x10')],_0x26ad5f['calleridnum']);})[_0xb308('0x1d')](function(_0x438810){_0x447449=_0x438810;logger['info'](_0xb308('0x4b'),_0x447449['id']);return getTicket(_0x5157d4,_0x13329c,_0x447449,_0x1807f4,_0x26ad5f);})[_0xb308('0x1d')](function(_0x557a05){if(_0x557a05&&_0x557a05['id']){logger[_0xb308('0xb')](_0xb308('0x1e'));logger[_0xb308('0xb')](_0xb308('0x4c'),_0x557a05['id']);logger[_0xb308('0xb')](_0xb308('0x4d'),_0xb308('0x4e'));emit(util[_0xb308('0xe')](_0xb308('0x4f'),_0x231fce[_0xb308('0x16')]),_0xb308('0x50'),{'uri':util[_0xb308('0xe')](_0xb308('0x51'),_0x5157d4[_0xb308('0x20')],_0x557a05['id'])});}})['catch'](function(_0x4a9e7e){logger[_0xb308('0x52')](_0xb308('0x4d'),JSON[_0xb308('0x2f')](_0x4a9e7e));});};exports[_0xb308('0x53')]=function(_0x5bdeb3,_0x418883,_0x2fbf39,_0x96e97e,_0x366340,_0x5f1bcb,_0x456e71){var _0x1732a0,_0x5a5792;_0x5f1bcb[_0xb308('0x20')]=intUtil[_0xb308('0x42')](_0x5f1bcb[_0xb308('0x20')]);_0x5f1bcb[_0xb308('0x43')]=intUtil[_0xb308('0x42')](_0x5f1bcb[_0xb308('0x43')]);if(_0x456e71&&_0x456e71[_0xb308('0x54')]&&_0x456e71[_0xb308('0x54')]!==_0xb308('0x55')){logger['info'](_0xb308('0x56'),'Recording\x20is\x20enabled!');_0x418883[_0xb308('0x45')]=util[_0xb308('0xe')](_0xb308('0x46'),_0x5f1bcb['serverUrl'],_0x418883[_0xb308('0x47')],md5(_0x418883[_0xb308('0x47')]));}headers['Authorization']=getAuth(_0x5f1bcb);return getUser(_0x5f1bcb,_0x96e97e[_0xb308('0x49')])[_0xb308('0x1d')](function(_0x16144d){_0x1732a0=_0x16144d;logger[_0xb308('0xb')](_0xb308('0x4a'),_0x1732a0['id']);return getEndUser(_0x5f1bcb,_0x418883[_0xb308('0x57')],_0x418883[_0xb308('0x58')]);})[_0xb308('0x1d')](function(_0x3aede5){_0x5a5792=_0x3aede5;logger['info'](_0xb308('0x4b'),_0x5a5792['id']);return getTicket(_0x5f1bcb,_0x1732a0,_0x5a5792,_0x2fbf39,_0x418883);})['then'](function(_0x5f1128){if(_0x5f1128&&_0x5f1128['id']){logger[_0xb308('0xb')](_0xb308('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f1128['id']);logger[_0xb308('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb308('0xe')](_0xb308('0x4f'),_0x96e97e[_0xb308('0x16')]),_0xb308('0x50'),{'uri':util['format'](_0xb308('0x51'),_0x5f1bcb[_0xb308('0x20')],_0x5f1128['id'])});}})['catch'](function(_0x2745fb){logger['error'](_0xb308('0x56'),JSON[_0xb308('0x2f')](_0x2745fb));});};exports['unmanaged']=function(_0x2842e3,_0x183684,_0x246a65,_0x37cc69,_0x4a7775,_0x10e553){var _0x1f8660,_0x43db2a;_0x10e553[_0xb308('0x20')]=intUtil[_0xb308('0x42')](_0x10e553[_0xb308('0x20')]);_0x10e553['serverUrl']=intUtil[_0xb308('0x42')](_0x10e553[_0xb308('0x43')]);if(_0x4a7775&&_0x4a7775[_0xb308('0x44')]){logger[_0xb308('0xb')]('['+_0x183684[_0xb308('0x59')][_0xb308('0x5a')]()+']',_0xb308('0x5b'));_0x183684['recordingURL']=util['format'](_0xb308('0x46'),_0x10e553[_0xb308('0x43')],_0x183684[_0xb308('0x47')],md5(_0x183684['uniqueid']));}else{_0x183684[_0xb308('0x45')]='';}headers['Authorization']=getAuth(_0x10e553);return getUser(_0x10e553,'')[_0xb308('0x1d')](function(_0x1a5e0c){_0x1f8660=_0x1a5e0c;logger[_0xb308('0xb')](_0xb308('0x4a'),_0x1f8660['id']);return getEndUser(_0x10e553,_0x183684[_0xb308('0x10')],_0x183684[_0xb308('0x5c')]);})[_0xb308('0x1d')](function(_0x53435d){_0x43db2a=_0x53435d;logger[_0xb308('0xb')](_0xb308('0x4b'),_0x43db2a['id']);return getTicket(_0x10e553,_0x1f8660,_0x43db2a,_0x246a65,_0x183684);})[_0xb308('0x1d')](function(_0x3c1e19){if(_0x3c1e19){logger[_0xb308('0xb')](_0xb308('0x1e'));logger['info'](_0xb308('0x4c'),_0x3c1e19['id']);}})[_0xb308('0x5d')](function(_0x53b7d8){logger[_0xb308('0x52')]('['+_0x183684[_0xb308('0x59')][_0xb308('0x5a')]()+']',JSON[_0xb308('0x2f')](_0x53b7d8));});}; \ 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 36f9c47..db14c1f 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 _0x8925=['contacts','format','mobile_number','endUserId','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','%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','ticketId','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','info','Getting\x20user\x20with\x20email','length','email','userId','User\x20found:','Admin\x20selected','userEmail','message','/api/lookup?q=','&f=','find'];(function(_0xadaf72,_0x190c5e){var _0x3c9164=function(_0x1f56fd){while(--_0x1f56fd){_0xadaf72['push'](_0xadaf72['shift']());}};_0x3c9164(++_0x190c5e);}(_0x8925,0x1c8));var _0x5892=function(_0x47c6b9,_0x210b3c){_0x47c6b9=_0x47c6b9-0x0;var _0x34f34d=_0x8925[_0x47c6b9];return _0x34f34d;};'use strict';var _=require(_0x5892('0x0'));var rp=require('request-promise');var md5=require(_0x5892('0x1'));var util=require(_0x5892('0x2'));var moment=require('moment');var Promise=require(_0x5892('0x3'));var Redis=require(_0x5892('0x4'));var intUtil=require(_0x5892('0x5'));var config=require(_0x5892('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x5892('0x7')]=_[_0x5892('0x8')](config[_0x5892('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5892('0x7')]));function getAdminId(_0x430ea3,_0x4612c5,_0x1f16f3,_0x48b615){return new Promise(function(_0x2799f5,_0x56524a){var _0x2ab9a9=![];var _0x6f7137={'method':_0x5892('0x9'),'uri':_0x48b615+_0x5892('0xa'),'json':!![]};_0x6f7137[_0x5892('0xb')]=_0x1f16f3;logger['info'](_0x5892('0xc'));return rp(_0x6f7137)[_0x5892('0xd')](function(_0x37fedf){if(_0x37fedf){var _0x1dfcae=_0x37fedf[_0x5892('0xe')];var _0x2482d1=null;for(_0x2482d1=0x0;_0x2482d1<_0x1dfcae['length'];_0x2482d1++){if(_0x1dfcae[_0x2482d1]['email']===_0x430ea3[_0x5892('0xf')]){_0x430ea3[_0x5892('0x10')]=_0x1dfcae[_0x2482d1]['id'];_0x2ab9a9=!![];}}if(_0x2ab9a9){logger['info'](_0x5892('0x11'),_0x430ea3[_0x5892('0x10')]);_0x2799f5(_0x430ea3);}else{_0x56524a({'statusCode':0x194,'message':_0x5892('0x12')});}}else{_0x56524a({'statusCode':0x194,'message':_0x5892('0x12')});}})[_0x5892('0x13')](function(_0xbc1e29){logger[_0x5892('0x14')]('['+[_0x4612c5[_0x5892('0x15')]()]+']',_0xbc1e29['message']);_0x56524a(_0xbc1e29);});});}function getUser(_0x2549b3,_0x3b710a,_0x5272ad){return function(_0x4fe48f){return new Promise(function(_0x451d73,_0x34cdc1){var _0x4e8321={'method':_0x5892('0x9'),'uri':_0x5272ad+'/api/selector/owners','json':!![]};_0x4e8321['headers']=_0x3b710a;logger['info'](_0x5892('0x16'));return rp(_0x4e8321)['then'](function(_0x54d1c3){if(_0x54d1c3){var _0xf47873=_0x54d1c3[_0x5892('0xe')];var _0xb79684=![];var _0x3f3ccb=null;if(_0x4fe48f[_0x5892('0x17')]!==null){logger[_0x5892('0x18')](_0x5892('0x19'),_0x4fe48f[_0x5892('0x17')]);_0x4fe48f['userEmail']=_0x4fe48f[_0x5892('0x17')];for(_0x3f3ccb=0x0;_0x3f3ccb<_0xf47873[_0x5892('0x1a')];_0x3f3ccb++){if(_0xf47873[_0x3f3ccb][_0x5892('0x1b')]===_0x4fe48f[_0x5892('0x17')]){_0xb79684=!![];_0x4fe48f[_0x5892('0x1c')]=_0xf47873[_0x3f3ccb]['id'];logger[_0x5892('0x18')](_0x5892('0x1d'),_0x4fe48f['userId']);}}}if(!_0xb79684){logger[_0x5892('0x18')](_0x5892('0x1e'));_0x4fe48f[_0x5892('0x1f')]=_0x4fe48f[_0x5892('0xf')];_0x4fe48f[_0x5892('0x1c')]=_0x4fe48f[_0x5892('0x10')];_0xb79684=!![];}if(_0xb79684){_0x451d73(_0x4fe48f);}else{_0x34cdc1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x34cdc1({'statusCode':0x194,'message':_0x5892('0x12')});}})[_0x5892('0x13')](function(_0x13d141){logger[_0x5892('0x14')]('['+[_0x2549b3['toUpperCase']()]+']',_0x13d141[_0x5892('0x20')]);_0x34cdc1(_0x13d141);});});};}function searchContact(_0x50de47,_0x13c281,_0x264559,_0xe09b26){return new Promise(function(_0x4a21a9,_0xa74282){var _0x44b821={'method':_0x5892('0x9'),'headers':_0x13c281,'uri':_0x50de47+_0x5892('0x21')+_0xe09b26+_0x5892('0x22')+_0x264559+'&entities=contact','json':!![]};rp(_0x44b821)['then'](function(_0x25c6d1){var _0x2f4df3=_[_0x5892('0x23')](_0x25c6d1['contacts'][_0x5892('0x24')],[_0x264559,_0xe09b26]);_0x4a21a9(_0x2f4df3);})[_0x5892('0x13')](function(_0x4afa2c){_0xa74282(_0x4afa2c);});});}function getEndUser(_0x30ee4f,_0x48db0a,_0x61635b){return function(_0x1de1a9){return new Promise(function(_0x42cf11,_0x181d0e){logger[_0x5892('0x18')](util[_0x5892('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1de1a9['contactNumber']));searchContact(_0x61635b,_0x48db0a,_0x5892('0x26'),_0x1de1a9['contactNumber'])[_0x5892('0xd')](function(_0x3b3428){if(_0x3b3428){_0x1de1a9[_0x5892('0x27')]=_0x3b3428['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x1de1a9[_0x5892('0x27')]);return _0x42cf11(_0x1de1a9);}searchContact(_0x61635b,_0x48db0a,_0x5892('0x28'),_0x1de1a9[_0x5892('0x29')])[_0x5892('0xd')](function(_0x3a81e2){if(_0x3a81e2){_0x1de1a9[_0x5892('0x27')]=_0x3a81e2['id'];logger['info'](_0x5892('0x2a'),_0x1de1a9['endUserId']);return _0x42cf11(_0x1de1a9);}createEndUser(_0x1de1a9,_0x30ee4f,_0x48db0a,_0x61635b)[_0x5892('0xd')](function(_0x26e6bf){logger[_0x5892('0x18')](_0x5892('0x2b'),_0x26e6bf[_0x5892('0x27')]);return _0x42cf11(_0x26e6bf);});});})[_0x5892('0x13')](function(_0x4261c7){_0x181d0e(_0x4261c7);});});};}function createEndUser(_0x1e1c29,_0x2fb061,_0x4861c8,_0x36d76f){return new Promise(function(_0x8a9694,_0x107032){var _0x47c611=moment();var _0x3fbd25={'method':_0x5892('0x2c'),'uri':_0x36d76f+_0x5892('0x2d'),'body':{'contact':{'last_name':_0x1e1c29[_0x5892('0x29')],'work_number':_0x1e1c29[_0x5892('0x29')],'mobile_number':_0x1e1c29[_0x5892('0x29')],'owner_id':_0x1e1c29[_0x5892('0x1c')],'created_at':_0x47c611[_0x5892('0x25')](_0x5892('0x2e'))}},'json':!![]};_0x3fbd25[_0x5892('0xb')]=_0x4861c8;logger[_0x5892('0x18')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3fbd25)[_0x5892('0xd')](function(_0x1b8c53){_0x1e1c29['endUserId']=_0x1b8c53[_0x5892('0x2f')]['id'];_0x8a9694(_0x1e1c29);})[_0x5892('0x13')](function(_0x31b716){logger[_0x5892('0x14')]('['+[_0x2fb061['toUpperCase']()]+']',_0x31b716[_0x5892('0x20')]);_0x107032(_0x31b716[_0x5892('0x20')]);});});}function getTicket(_0x6857fe,_0x2b06b1,_0x1121ee,_0x29815e,_0x27bdfd){return function(_0x47e19b){logger[_0x5892('0x18')]('Creating\x20new\x20task');return new Promise(function(_0xf1dce6,_0x302f85){var _0x426cdb=moment();var _0x579cc2={'method':_0x5892('0x2c'),'uri':_0x1121ee+_0x5892('0x30'),'body':{'title':intUtil[_0x5892('0x31')](_0x29815e['Subjects'],_0x27bdfd,'\x20'),'description':intUtil['getString'](_0x29815e[_0x5892('0x32')],_0x27bdfd,'\x0a'),'owner_id':_0x47e19b[_0x5892('0x1c')],'creater_id':_0x47e19b[_0x5892('0x10')],'targetable_id':_0x47e19b[_0x5892('0x27')],'targetable_type':_0x5892('0x33'),'created_at':_0x426cdb[_0x5892('0x25')](_0x5892('0x2e')),'due_date':_0x426cdb[_0x5892('0x34')](0x1e,'m')[_0x5892('0x25')](_0x5892('0x2e'))},'json':!![]};_0x579cc2[_0x5892('0xb')]=_0x2b06b1;return rp(_0x579cc2)[_0x5892('0xd')](function(_0x4c0f9a){_0x47e19b['ticketId']=_0x4c0f9a[_0x5892('0x35')]['id'];logger['info'](_0x5892('0x36'),_0x47e19b['ticketId']);_0xf1dce6(_0x47e19b);})[_0x5892('0x13')](function(_0x28b06e){logger['error']('['+[_0x6857fe[_0x5892('0x15')]()]+']',_0x28b06e[_0x5892('0x20')]);_0x302f85(_0x28b06e['message']);});});};}function emit(_0x16ff60,_0x2a1c10,_0x127b48){var _0x2f182f={'uri':_0x16ff60+'/contacts/'+_0x127b48};io['to'](util['format'](_0x5892('0x37'),_0x2a1c10))[_0x5892('0x38')](_0x5892('0x39'),_0x2f182f);}exports['cs']=function(_0x4b8fd5,_0x2dd4e9,_0x429817,_0x1f6988,_0x34aa8d,_0x1bd691,_0x3e1c3f,_0x1dff9f){var _0x4a2121={};var _0x54eb43={'Authorization':'Token\x20token='+_0x1bd691[_0x5892('0x3a')]};_0x1bd691[_0x5892('0x3b')]=intUtil[_0x5892('0x3c')](_0x1bd691[_0x5892('0x3b')]);_0x1bd691[_0x5892('0x3d')]=intUtil[_0x5892('0x3c')](_0x1bd691[_0x5892('0x3d')]);var _0x450cae=_0x1bd691[_0x5892('0x3b')];_0x4a2121[_0x5892('0xf')]=_0x1bd691[_0x5892('0x3e')];_0x4a2121[_0x5892('0x29')]=_0x1dff9f[_0x5892('0x3f')]()===_0x5892('0x40')?_0x2dd4e9[_0x5892('0x41')]:_0x2dd4e9['calleridnum'];_0x4a2121['callDirection']=_0x1dff9f==='queue'||_0x1dff9f==='unmanaged'?'queue':_0x5892('0x40');if(_0x1f6988){_0x4a2121[_0x5892('0x17')]=_0x1f6988[_0x5892('0x1b')];}var _0x60cd18=util[_0x5892('0x25')](_0x5892('0x42'),_0x1bd691[_0x5892('0x3d')],_0x2dd4e9[_0x5892('0x43')],md5(_0x2dd4e9[_0x5892('0x43')]));if(_0x34aa8d&&_0x34aa8d[_0x5892('0x44')]){logger[_0x5892('0x18')](_0x5892('0x45'),_0x5892('0x46'));_0x2dd4e9[_0x5892('0x47')]=_0x60cd18;}else if(_0x3e1c3f&&_0x3e1c3f[_0x5892('0x48')]&&_0x3e1c3f[_0x5892('0x48')]!==_0x5892('0x49')){logger[_0x5892('0x18')](_0x5892('0x4a'),_0x5892('0x46'));_0x2dd4e9[_0x5892('0x47')]=_0x60cd18;}else{_0x2dd4e9[_0x5892('0x47')]='';}return getAdminId(_0x4a2121,_0x1dff9f,_0x54eb43,_0x450cae)[_0x5892('0xd')](getUser(_0x1dff9f,_0x54eb43,_0x450cae))[_0x5892('0xd')](getEndUser(_0x1dff9f,_0x54eb43,_0x450cae))[_0x5892('0xd')](getTicket(_0x1dff9f,_0x54eb43,_0x450cae,_0x429817,_0x2dd4e9))[_0x5892('0xd')](function(_0x443ca7){logger['info'](util['format'](_0x5892('0x4b'),_0x443ca7[_0x5892('0x4c')]));if(_0x1dff9f!==_0x5892('0x4d')){logger[_0x5892('0x18')]('['+[_0x1dff9f[_0x5892('0x15')]()]+']',_0x5892('0x4e'));emit(_0x450cae,_0x1f6988[_0x5892('0x4f')],_0x443ca7[_0x5892('0x27')]);}})[_0x5892('0x13')](function(_0x2e7991){logger[_0x5892('0x14')]('['+[_0x1dff9f[_0x5892('0x15')]()]+_0x5892('0x50'),util[_0x5892('0x51')](_0x2e7991,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc2a3=['redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','agentEmail','User\x20found:','userEmail','userId','/api/lookup?q=','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','adminEmail','toLowerCase','outbound','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','../../../../config/environment','freshsales'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xc2a3,0x185));var _0x3c2a=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0xc2a3[_0x37ded3];return _0x51e49e;};'use strict';var _=require(_0x3c2a('0x0'));var rp=require('request-promise');var md5=require(_0x3c2a('0x1'));var util=require('util');var moment=require(_0x3c2a('0x2'));var Promise=require(_0x3c2a('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3c2a('0x4'));var logger=require('../../../../config/logger')(_0x3c2a('0x5'));config[_0x3c2a('0x6')]=_[_0x3c2a('0x7')](config['redis'],{'host':_0x3c2a('0x8'),'port':0x18eb});var io=require(_0x3c2a('0x9'))(new Redis(config['redis']));function getAdminId(_0x9a8889,_0xd61fb0,_0x308f11,_0x982c29){return new Promise(function(_0x283f26,_0x38fbde){var _0x41aa66=![];var _0x4ba337={'method':'GET','uri':_0x982c29+_0x3c2a('0xa'),'json':!![]};_0x4ba337[_0x3c2a('0xb')]=_0x308f11;logger[_0x3c2a('0xc')](_0x3c2a('0xd'));return rp(_0x4ba337)[_0x3c2a('0xe')](function(_0xdd5ef0){if(_0xdd5ef0){var _0x37a456=_0xdd5ef0[_0x3c2a('0xf')];var _0x38bee5=null;for(_0x38bee5=0x0;_0x38bee5<_0x37a456[_0x3c2a('0x10')];_0x38bee5++){if(_0x37a456[_0x38bee5]['email']===_0x9a8889['adminEmail']){_0x9a8889[_0x3c2a('0x11')]=_0x37a456[_0x38bee5]['id'];_0x41aa66=!![];}}if(_0x41aa66){logger['info']('Admin\x20found:',_0x9a8889[_0x3c2a('0x11')]);_0x283f26(_0x9a8889);}else{_0x38fbde({'statusCode':0x194,'message':_0x3c2a('0x12')});}}else{_0x38fbde({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3c2a('0x13')](function(_0x23f11b){logger[_0x3c2a('0x14')]('['+[_0xd61fb0[_0x3c2a('0x15')]()]+']',_0x23f11b[_0x3c2a('0x16')]);_0x38fbde(_0x23f11b);});});}function getUser(_0x550bf6,_0x1dc4d1,_0x5e7528){return function(_0x2fa18c){return new Promise(function(_0x45ee98,_0x51bee3){var _0x9c989a={'method':_0x3c2a('0x17'),'uri':_0x5e7528+'/api/selector/owners','json':!![]};_0x9c989a[_0x3c2a('0xb')]=_0x1dc4d1;logger[_0x3c2a('0xc')]('Getting\x20user\x20list');return rp(_0x9c989a)[_0x3c2a('0xe')](function(_0x2c5c68){if(_0x2c5c68){var _0xa76b6c=_0x2c5c68[_0x3c2a('0xf')];var _0xac15e1=![];var _0x58f401=null;if(_0x2fa18c[_0x3c2a('0x18')]!==null){logger[_0x3c2a('0xc')]('Getting\x20user\x20with\x20email',_0x2fa18c[_0x3c2a('0x18')]);_0x2fa18c['userEmail']=_0x2fa18c['agentEmail'];for(_0x58f401=0x0;_0x58f401<_0xa76b6c[_0x3c2a('0x10')];_0x58f401++){if(_0xa76b6c[_0x58f401]['email']===_0x2fa18c[_0x3c2a('0x18')]){_0xac15e1=!![];_0x2fa18c['userId']=_0xa76b6c[_0x58f401]['id'];logger[_0x3c2a('0xc')](_0x3c2a('0x19'),_0x2fa18c['userId']);}}}if(!_0xac15e1){logger[_0x3c2a('0xc')]('Admin\x20selected');_0x2fa18c[_0x3c2a('0x1a')]=_0x2fa18c['adminEmail'];_0x2fa18c[_0x3c2a('0x1b')]=_0x2fa18c['adminId'];_0xac15e1=!![];}if(_0xac15e1){_0x45ee98(_0x2fa18c);}else{_0x51bee3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x51bee3({'statusCode':0x194,'message':_0x3c2a('0x12')});}})[_0x3c2a('0x13')](function(_0x292f4e){logger[_0x3c2a('0x14')]('['+[_0x550bf6[_0x3c2a('0x15')]()]+']',_0x292f4e[_0x3c2a('0x16')]);_0x51bee3(_0x292f4e);});});};}function searchContact(_0x39f795,_0x1bf69d,_0x1766b8,_0x46f9d9){return new Promise(function(_0x1cd3cf,_0x38306d){var _0x1243ce={'method':_0x3c2a('0x17'),'headers':_0x1bf69d,'uri':_0x39f795+_0x3c2a('0x1c')+_0x46f9d9+_0x3c2a('0x1d')+_0x1766b8+'&entities=contact','json':!![]};rp(_0x1243ce)['then'](function(_0x3c2cf2){var _0x50854f=_[_0x3c2a('0x1e')](_0x3c2cf2['contacts'][_0x3c2a('0x1f')],[_0x1766b8,_0x46f9d9]);_0x1cd3cf(_0x50854f);})['catch'](function(_0x2c9795){_0x38306d(_0x2c9795);});});}function getEndUser(_0x3641ca,_0x9df930,_0x434638){return function(_0x64455c){return new Promise(function(_0x40bfb6,_0x4ee6aa){logger['info'](util['format'](_0x3c2a('0x20'),_0x64455c['contactNumber']));searchContact(_0x434638,_0x9df930,_0x3c2a('0x21'),_0x64455c[_0x3c2a('0x22')])[_0x3c2a('0xe')](function(_0x2bdb61){if(_0x2bdb61){_0x64455c[_0x3c2a('0x23')]=_0x2bdb61['id'];logger[_0x3c2a('0xc')](_0x3c2a('0x24'),_0x64455c[_0x3c2a('0x23')]);return _0x40bfb6(_0x64455c);}searchContact(_0x434638,_0x9df930,_0x3c2a('0x25'),_0x64455c[_0x3c2a('0x22')])[_0x3c2a('0xe')](function(_0x304f98){if(_0x304f98){_0x64455c['endUserId']=_0x304f98['id'];logger[_0x3c2a('0xc')](_0x3c2a('0x26'),_0x64455c[_0x3c2a('0x23')]);return _0x40bfb6(_0x64455c);}createEndUser(_0x64455c,_0x3641ca,_0x9df930,_0x434638)[_0x3c2a('0xe')](function(_0x2356bb){logger[_0x3c2a('0xc')](_0x3c2a('0x27'),_0x2356bb[_0x3c2a('0x23')]);return _0x40bfb6(_0x2356bb);});});})['catch'](function(_0x2c3c5d){_0x4ee6aa(_0x2c3c5d);});});};}function createEndUser(_0x25859f,_0x584f27,_0x1a3aeb,_0x5ec3b0){return new Promise(function(_0x173420,_0x39be6c){var _0x567ec0=moment();var _0x48d246={'method':'POST','uri':_0x5ec3b0+_0x3c2a('0x28'),'body':{'contact':{'last_name':_0x25859f['contactNumber'],'work_number':_0x25859f[_0x3c2a('0x22')],'mobile_number':_0x25859f[_0x3c2a('0x22')],'owner_id':_0x25859f[_0x3c2a('0x1b')],'created_at':_0x567ec0[_0x3c2a('0x29')](_0x3c2a('0x2a'))}},'json':!![]};_0x48d246['headers']=_0x1a3aeb;logger[_0x3c2a('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x48d246)[_0x3c2a('0xe')](function(_0x5f45eb){_0x25859f['endUserId']=_0x5f45eb[_0x3c2a('0x2b')]['id'];_0x173420(_0x25859f);})[_0x3c2a('0x13')](function(_0x3b0a70){logger[_0x3c2a('0x14')]('['+[_0x584f27['toUpperCase']()]+']',_0x3b0a70[_0x3c2a('0x16')]);_0x39be6c(_0x3b0a70[_0x3c2a('0x16')]);});});}function getTicket(_0x582660,_0x6687b7,_0x5ecfbd,_0x2d85ae,_0x364425){return function(_0x5bdc2f){logger[_0x3c2a('0xc')](_0x3c2a('0x2c'));return new Promise(function(_0x5a2202,_0x45f47d){var _0x34bf8d=moment();var _0x4924e5={'method':_0x3c2a('0x2d'),'uri':_0x5ecfbd+'/api/tasks','body':{'title':intUtil[_0x3c2a('0x2e')](_0x2d85ae[_0x3c2a('0x2f')],_0x364425,'\x20'),'description':intUtil['getString'](_0x2d85ae[_0x3c2a('0x30')],_0x364425,'\x0a'),'owner_id':_0x5bdc2f[_0x3c2a('0x1b')],'creater_id':_0x5bdc2f[_0x3c2a('0x11')],'targetable_id':_0x5bdc2f[_0x3c2a('0x23')],'targetable_type':_0x3c2a('0x31'),'created_at':_0x34bf8d[_0x3c2a('0x29')](_0x3c2a('0x2a')),'due_date':_0x34bf8d['add'](0x1e,'m')[_0x3c2a('0x29')](_0x3c2a('0x2a'))},'json':!![]};_0x4924e5[_0x3c2a('0xb')]=_0x6687b7;return rp(_0x4924e5)['then'](function(_0xe95dee){_0x5bdc2f[_0x3c2a('0x32')]=_0xe95dee[_0x3c2a('0x33')]['id'];logger[_0x3c2a('0xc')]('Task\x20created:',_0x5bdc2f['ticketId']);_0x5a2202(_0x5bdc2f);})[_0x3c2a('0x13')](function(_0x9d18fa){logger[_0x3c2a('0x14')]('['+[_0x582660[_0x3c2a('0x15')]()]+']',_0x9d18fa[_0x3c2a('0x16')]);_0x45f47d(_0x9d18fa[_0x3c2a('0x16')]);});});};}function emit(_0x2bfcba,_0x25e583,_0x114d11){var _0x1ee1d8={'uri':_0x2bfcba+_0x3c2a('0x34')+_0x114d11};io['to'](util[_0x3c2a('0x29')](_0x3c2a('0x35'),_0x25e583))[_0x3c2a('0x36')](_0x3c2a('0x37'),_0x1ee1d8);}exports['cs']=function(_0x2a53d4,_0x58355b,_0x17fcd0,_0x388522,_0x3758cb,_0x4d23e3,_0x3073d3,_0xef144){var _0x466a75={};var _0x24196c={'Authorization':'Token\x20token='+_0x4d23e3['apiKey']};_0x4d23e3[_0x3c2a('0x38')]=intUtil[_0x3c2a('0x39')](_0x4d23e3['remoteUri']);_0x4d23e3['serverUrl']=intUtil[_0x3c2a('0x39')](_0x4d23e3[_0x3c2a('0x3a')]);var _0x1bb2f=_0x4d23e3[_0x3c2a('0x38')];_0x466a75[_0x3c2a('0x3b')]=_0x4d23e3['username'];_0x466a75[_0x3c2a('0x22')]=_0xef144[_0x3c2a('0x3c')]()===_0x3c2a('0x3d')?_0x58355b['destcalleridnum']:_0x58355b['calleridnum'];_0x466a75[_0x3c2a('0x3e')]=_0xef144==='queue'||_0xef144===_0x3c2a('0x3f')?_0x3c2a('0x40'):_0x3c2a('0x3d');if(_0x388522){_0x466a75[_0x3c2a('0x18')]=_0x388522['email'];}var _0x3e3fa0=util[_0x3c2a('0x29')](_0x3c2a('0x41'),_0x4d23e3[_0x3c2a('0x3a')],_0x58355b['uniqueid'],md5(_0x58355b[_0x3c2a('0x42')]));if(_0x3758cb&&_0x3758cb[_0x3c2a('0x43')]){logger['info'](_0x3c2a('0x44'),_0x3c2a('0x45'));_0x58355b[_0x3c2a('0x46')]=_0x3e3fa0;}else if(_0x3073d3&&_0x3073d3['recordingFormat']&&_0x3073d3[_0x3c2a('0x47')]!==_0x3c2a('0x48')){logger[_0x3c2a('0xc')](_0x3c2a('0x49'),_0x3c2a('0x45'));_0x58355b[_0x3c2a('0x46')]=_0x3e3fa0;}else{_0x58355b[_0x3c2a('0x46')]='';}return getAdminId(_0x466a75,_0xef144,_0x24196c,_0x1bb2f)[_0x3c2a('0xe')](getUser(_0xef144,_0x24196c,_0x1bb2f))['then'](getEndUser(_0xef144,_0x24196c,_0x1bb2f))[_0x3c2a('0xe')](getTicket(_0xef144,_0x24196c,_0x1bb2f,_0x17fcd0,_0x58355b))['then'](function(_0x57a17a){logger['info'](util[_0x3c2a('0x29')](_0x3c2a('0x4a'),_0x57a17a[_0x3c2a('0x32')]));if(_0xef144!==_0x3c2a('0x3f')){logger[_0x3c2a('0xc')]('['+[_0xef144[_0x3c2a('0x15')]()]+']',_0x3c2a('0x4b'));emit(_0x1bb2f,_0x388522[_0x3c2a('0x4c')],_0x57a17a[_0x3c2a('0x23')]);}})[_0x3c2a('0x13')](function(_0x261508){logger[_0x3c2a('0x14')]('['+[_0xef144['toUpperCase']()]+_0x3c2a('0x4d'),util[_0x3c2a('0x4e')](_0x261508,{'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 292401b..b06711b 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 _0xe209=['dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe209,0xce));var _0x9e20=function(_0x32c39a,_0x569b40){_0x32c39a=_0x32c39a-0x0;var _0x5ce9dc=_0xe209[_0x32c39a];return _0x5ce9dc;};'use strict';var _=require(_0x9e20('0x0'));var util=require('util');var zendesk=require(_0x9e20('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9e20('0x2'));var freshdesk=require(_0x9e20('0x3'));var zoho=require(_0x9e20('0x4'));var desk=require(_0x9e20('0x5'));var vtiger=require(_0x9e20('0x6'));var servicenow=require(_0x9e20('0x7'));var dynamics365=require(_0x9e20('0x8'));var freshsales=require(_0x9e20('0x9'));var integrations=[_0x9e20('0xa'),_0x9e20('0xb'),'sugarcrm',_0x9e20('0xc'),_0x9e20('0xd'),_0x9e20('0xe'),_0x9e20('0xf'),_0x9e20('0x10'),_0x9e20('0x11'),_0x9e20('0x12')];exports['exec']=function(_0x46b320,_0x3e39d8,_0x5f01f1,_0x5c4b7a,_0x5b18ff,_0x1bb3b9){if(_0x5f01f1){if(_['includes'](integrations,_0x46b320[_0x9e20('0x13')][_0x9e20('0x14')]())){try{var _0x40c2b7=null;var _0x3a770d='';var _0x25e74b=_0x5f01f1[_0x46b320[_0x9e20('0x13')][_0x9e20('0x14')]()];if(_0x25e74b){var _0x4a1c75=_0x25e74b[_0x46b320[_0x9e20('0x15')]];if(_0x4a1c75){var _0x10d7a0=_[_0x9e20('0x16')](_0x4a1c75[_0x9e20('0x17')],{'id':parseInt(_0x46b320[_0x9e20('0x18')],0xa)});if(_0x10d7a0){if(_0x5c4b7a){if(_0x5b18ff&&_0x3e39d8[_0x9e20('0x19')]){_0x3a770d='queue';}else if(_0x3e39d8[_0x9e20('0x1a')]){_0x3a770d='outbound';}else{console[_0x9e20('0x1b')](_0x9e20('0x1c'),_0x3e39d8);}}else{_0x3a770d=_0x9e20('0x1d');}switch(_0x46b320[_0x9e20('0x13')]['toLowerCase']()){case _0x9e20('0xa'):zendesk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xb'):salesforce[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case'sugarcrm':sugarcrm[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xc'):freshdesk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xd'):zoho[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xe'):desk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case'vtiger':vtiger[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0x11'):freshsales['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;case'servicenow':servicenow['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;case'dynamics365':dynamics365['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;default:console['log'](_0x9e20('0x1e'));}}else{_0x40c2b7=require('../../../../config/logger')(_0x46b320[_0x9e20('0x13')]['toLowerCase']());_0x40c2b7[_0x9e20('0x1f')](_0x9e20('0x20'),util[_0x9e20('0x21')](_0x9e20('0x22'),_0x46b320[_0x9e20('0x13')]['toLowerCase'](),_0x46b320[_0x9e20('0x18')]));}}else{_0x40c2b7=require(_0x9e20('0x23'))(_0x46b320['data1'][_0x9e20('0x14')]());_0x40c2b7[_0x9e20('0x1f')](_0x9e20('0x20'),util[_0x9e20('0x21')](_0x9e20('0x24'),_0x46b320['data1'][_0x9e20('0x14')](),_0x46b320[_0x9e20('0x15')]));}}else{}}catch(_0x55eb8c){console[_0x9e20('0x1f')](_0x55eb8c);}}}}; \ No newline at end of file +var _0x2f8c=['EVENT\x20UNKNOWN','unmanaged','freshsales','dynamics365','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x2f8c,0x102));var _0xc2f8=function(_0xd42db8,_0x42feb5){_0xd42db8=_0xd42db8-0x0;var _0x1da5a2=_0x2f8c[_0xd42db8];return _0x1da5a2;};'use strict';var _=require(_0xc2f8('0x0'));var util=require(_0xc2f8('0x1'));var zendesk=require(_0xc2f8('0x2'));var salesforce=require(_0xc2f8('0x3'));var sugarcrm=require(_0xc2f8('0x4'));var freshdesk=require(_0xc2f8('0x5'));var zoho=require(_0xc2f8('0x6'));var desk=require(_0xc2f8('0x7'));var vtiger=require(_0xc2f8('0x8'));var servicenow=require(_0xc2f8('0x9'));var dynamics365=require(_0xc2f8('0xa'));var freshsales=require('./freshsales');var integrations=[_0xc2f8('0xb'),_0xc2f8('0xc'),'sugarcrm',_0xc2f8('0xd'),_0xc2f8('0xe'),_0xc2f8('0xf'),_0xc2f8('0x10'),'dynamics365','freshsales',_0xc2f8('0x11')];exports[_0xc2f8('0x12')]=function(_0x36b1ba,_0x1c3804,_0x169050,_0x569e0d,_0x4b1a49,_0x47ad60){if(_0x169050){if(_[_0xc2f8('0x13')](integrations,_0x36b1ba[_0xc2f8('0x14')][_0xc2f8('0x15')]())){try{var _0x290d86=null;var _0x3dfd46='';var _0xc99666=_0x169050[_0x36b1ba[_0xc2f8('0x14')][_0xc2f8('0x15')]()];if(_0xc99666){var _0xbb20c1=_0xc99666[_0x36b1ba['data2']];if(_0xbb20c1){var _0x2fb17c=_[_0xc2f8('0x16')](_0xbb20c1[_0xc2f8('0x17')],{'id':parseInt(_0x36b1ba[_0xc2f8('0x18')],0xa)});if(_0x2fb17c){if(_0x569e0d){if(_0x4b1a49&&_0x1c3804[_0xc2f8('0x19')]){_0x3dfd46=_0xc2f8('0x19');}else if(_0x1c3804[_0xc2f8('0x1a')]){_0x3dfd46=_0xc2f8('0x1b');}else{console[_0xc2f8('0x1c')](_0xc2f8('0x1d'),_0x1c3804);}}else{_0x3dfd46=_0xc2f8('0x1e');}switch(_0x36b1ba['data1'][_0xc2f8('0x15')]()){case'zendesk':zendesk[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0xc'):salesforce[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case'sugarcrm':sugarcrm[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0xd'):freshdesk[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0xe'):zoho[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0xf'):desk[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0x10'):vtiger[_0x3dfd46](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60);break;case _0xc2f8('0x1f'):freshsales['cs'](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60,_0x3dfd46);break;case _0xc2f8('0x11'):servicenow['cs'](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60,_0x3dfd46);break;case _0xc2f8('0x20'):dynamics365['cs'](_0x36b1ba,_0x1c3804,_0x2fb17c,_0x569e0d,_0x4b1a49,_0xbb20c1,_0x47ad60,_0x3dfd46);break;default:console['log'](_0xc2f8('0x21'));}}else{_0x290d86=require('../../../../config/logger')(_0x36b1ba[_0xc2f8('0x14')]['toLowerCase']());_0x290d86[_0xc2f8('0x22')](_0xc2f8('0x23'),util[_0xc2f8('0x24')](_0xc2f8('0x25'),_0x36b1ba[_0xc2f8('0x14')][_0xc2f8('0x15')](),_0x36b1ba['data3']));}}else{_0x290d86=require(_0xc2f8('0x26'))(_0x36b1ba[_0xc2f8('0x14')][_0xc2f8('0x15')]());_0x290d86[_0xc2f8('0x22')](_0xc2f8('0x23'),util['format'](_0xc2f8('0x27'),_0x36b1ba[_0xc2f8('0x14')]['toLowerCase'](),_0x36b1ba[_0xc2f8('0x28')]));}}else{}}catch(_0x138b05){console[_0xc2f8('0x22')](_0x138b05);}}}}; \ 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 94f24aa..b34983d 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 _0x675a=['endUserType','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','additionalSearchAccount','merge','Lead','Account','first','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Company','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','Fields','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact'];(function(_0x5865b9,_0x4e5ca2){var _0x183404=function(_0x391a23){while(--_0x391a23){_0x5865b9['push'](_0x5865b9['shift']());}};_0x183404(++_0x4e5ca2);}(_0x675a,0x68));var _0xa675=function(_0x3f1068,_0x2d4f61){_0x3f1068=_0x3f1068-0x0;var _0x54c89c=_0x675a[_0x3f1068];return _0x54c89c;};'use strict';var _=require(_0xa675('0x0'));var rp=require(_0xa675('0x1'));var moment=require(_0xa675('0x2'));var BPromise=require(_0xa675('0x3'));var md5=require(_0xa675('0x4'));var jsforce=require(_0xa675('0x5'));var util=require('util');var Redis=require(_0xa675('0x6'));var intUtil=require(_0xa675('0x7'));var config=require(_0xa675('0x8'));var logger=require(_0xa675('0x9'))(_0xa675('0xa'));config[_0xa675('0xb')]=_[_0xa675('0xc')](config[_0xa675('0xb')],{'host':_0xa675('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x44b339,_0xbce3e0,_0x6adde){io['to'](_0x44b339)[_0xa675('0xe')](_0xbce3e0,_0x6adde);}function getTicket(_0x1caa35,_0x3c2fc3,_0x275939,_0x26b8f7,_0x137f36,_0x1fd06d,_0x9f5eb7,_0x2952a9){var _0x135682=Object['assign']({},{'OwnerId':_0x3c2fc3['id'],'Subject':intUtil[_0xa675('0xf')](_0x26b8f7[_0xa675('0x10')],_0x137f36,'\x20'),'Description':intUtil[_0xa675('0xf')](_0x26b8f7[_0xa675('0x11')],_0x137f36,'\x0a')},getCustomFields(_0x1fd06d,_0x137f36));if(_0x275939){if(_0x26b8f7[_0xa675('0x12')]===_0xa675('0x13')){_0x135682[_0xa675('0x14')]=moment[_0xa675('0x15')]();_0x135682[_0xa675('0x16')]=![];_0x135682[_0xa675('0x17')]=![];if(_0x275939['endUserType']===_0xa675('0x18')||_0x275939[_0xa675('0x19')]===_0xa675('0x1a')){_0x135682[_0xa675('0x1b')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]===_0xa675('0x1c')){_0x135682[_0xa675('0x1d')]=_0x275939['id'];}}else if(_0x26b8f7['ticketType']==='Case'){if(_0x275939[_0xa675('0x19')]===_0xa675('0x18')){_0x135682[_0xa675('0x1e')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]==='account'){_0x135682[_0xa675('0x1f')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]==='lead'&&_0x26b8f7['leadId']){_0x135682[_0x26b8f7[_0xa675('0x20')]]=_0x275939['id'];}else{logger[_0xa675('0x21')](_0xa675('0x22'));}}}return _0x9f5eb7[_0xa675('0x23')](_0x26b8f7[_0xa675('0x12')])[_0xa675('0x24')](_0x135682);}function getUser(_0x58b46e,_0x5b0784,_0x47ee7a){if(!_[_0xa675('0x25')](_0x5b0784)&&intUtil[_0xa675('0x26')](_0x5b0784)){var _0x14f2d0={'Email':_0x5b0784};var _0x2f9ca3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x47ee7a['sobject']('User')[_0xa675('0x27')](_0x14f2d0,_0x2f9ca3)[_0xa675('0x28')]()[_0xa675('0x29')](function(_0x502cf3){if(_0x502cf3[_0xa675('0x2a')]){var _0x120e71=_[_0xa675('0x27')](_0x502cf3,function(_0x331821){return _0x331821['Email']===_0x5b0784;});if(_0x120e71){logger[_0xa675('0x21')](_0xa675('0x2b'),_0x5b0784);return BPromise[_0xa675('0x2c')]({'id':_0x120e71['Id'],'name':_0x120e71[_0xa675('0x2d')]});}}else{logger[_0xa675('0x21')](_0xa675('0x2e'),_0x5b0784);return _0x47ee7a[_0xa675('0x2f')]()[_0xa675('0x29')](function(_0x52eed1){return BPromise[_0xa675('0x2c')]({'id':_0x52eed1[_0xa675('0x30')],'name':_0x52eed1[_0xa675('0x31')]});});}});}else{logger[_0xa675('0x21')](_0xa675('0x2e'),_0x5b0784);return _0x47ee7a[_0xa675('0x2f')]()[_0xa675('0x29')](function(_0x11b418){return BPromise[_0xa675('0x2c')]({'id':_0x11b418[_0xa675('0x30')],'name':_0x11b418[_0xa675('0x31')]});});}}function getEndUser(_0x325d98,_0x414509,_0x544921,_0x4fcf10,_0x3c22de){var _0x59fb39={'$or':{'Phone':_0x4fcf10}};var _0x17a0f3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa675('0x29')](function(){logger[_0xa675('0x21')](_0xa675('0x32'),_0x4fcf10,_0x414509[_0xa675('0x33')]);switch(_0x414509[_0xa675('0x33')]){case _0xa675('0x34'):var _0x751f7d=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x36')]){var _0x63aeb1={};_0x63aeb1[_0x414509['additionalSearchContact']]=_0x4fcf10;_['merge'](_0x751f7d[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de['sobject'](_0xa675('0x38'))[_0xa675('0x27')](_0x751f7d,_0x17a0f3)[_0xa675('0x28')]()['then'](function(_0x1bfc90){if(_0x1bfc90&&_0x1bfc90['length']){return _0x1bfc90;}else{var _0x37e5b0=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x39')]){var _0x371240={};_0x371240[_0x414509['additionalSearchLead']]=_0x4fcf10;_['merge'](_0x37e5b0['$or'],_0x371240);}return _0x3c22de[_0xa675('0x23')]('Lead')['find'](_0x37e5b0,_0x17a0f3);}});case'account_contact_lead':var _0x39b18f=_['cloneDeep'](_0x59fb39);if(_0x414509['additionalSearchAccount']){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x3a')]]=_0x4fcf10;_['merge'](_0x39b18f[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')]('Account')[_0xa675('0x27')](_0x39b18f,_0x17a0f3)[_0xa675('0x28')]()[_0xa675('0x29')](function(_0x38842c){if(_0x38842c&&_0x38842c[_0xa675('0x2a')]){return _0x38842c;}else{var _0x5e2456=_[_0xa675('0x35')](_0x59fb39);if(_0x414509['additionalSearchContact']){var _0x14c14={};_0x14c14[_0x414509[_0xa675('0x36')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x5e2456['$or'],_0x14c14);}return _0x3c22de['sobject'](_0xa675('0x38'))[_0xa675('0x27')](_0x5e2456,_0x17a0f3)[_0xa675('0x29')](function(_0x10cbfc){if(_0x10cbfc&&_0x10cbfc[_0xa675('0x2a')]){return _0x10cbfc;}else{var _0x815d1a=_[_0xa675('0x35')](_0x59fb39);if(_0x414509['additionalSearchLead']){var _0x178455={};_0x178455[_0x414509[_0xa675('0x39')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x815d1a[_0xa675('0x37')],_0x178455);}return _0x3c22de[_0xa675('0x23')](_0xa675('0x3c'))[_0xa675('0x27')](_0x815d1a,_0x17a0f3);}});}});case _0xa675('0x18'):var _0x751f7d=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x36')]){var _0x63aeb1={};_0x63aeb1[_0x414509['additionalSearchContact']]=_0x4fcf10;_['merge'](_0x751f7d['$or'],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')](_0xa675('0x38'))[_0xa675('0x27')](_0x751f7d,_0x17a0f3)[_0xa675('0x28')]();case _0xa675('0x1a'):var _0x9bda98=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x39')]){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x39')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x9bda98[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')]('Lead')[_0xa675('0x27')](_0x9bda98,_0x17a0f3);case _0xa675('0x1c'):var _0x39b18f=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x3a')]){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x3a')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x39b18f['$or'],_0x63aeb1);}return _0x3c22de['sobject'](_0xa675('0x3d'))[_0xa675('0x27')](_0x39b18f,_0x17a0f3);default:return null;}})[_0xa675('0x29')](function(_0xc009af){if(_0xc009af&&_0xc009af[_0xa675('0x2a')]){var _0x3fd5b1=_[_0xa675('0x3e')](_0xc009af);if(_0x3fd5b1){return BPromise[_0xa675('0x2c')]({'id':_0x3fd5b1['Id'],'name':_0x3fd5b1[_0xa675('0x2d')],'phone':_0x3fd5b1[_0xa675('0x3f')],'endUserType':_0x3fd5b1['attributes'][_0xa675('0x40')]['toLowerCase']()});}}})[_0xa675('0x29')](function(_0x13b428){if(_0x13b428){logger['info'](_0xa675('0x41'),_0x13b428[_0xa675('0x19')],_0x4fcf10);return BPromise['resolve'](_0x13b428);}else{logger[_0xa675('0x21')](_0xa675('0x42'),_0x4fcf10);var _0x3a9301={'Phone':_0x4fcf10};if(_0x414509['moduleCreate']){if(_0x414509[_0xa675('0x43')]==='contact'){logger[_0xa675('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x44')]=_0x544921!==''?_0x544921:util[_0xa675('0x45')]('Caller\x20-\x20%s',_0x4fcf10);}else if(_0x414509[_0xa675('0x43')]==='lead'){logger[_0xa675('0x21')](_0xa675('0x46'),_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x44')]=_0x544921!==_0xa675('0x47')?_0x544921:util[_0xa675('0x45')]('Caller\x20-\x20%s',_0x4fcf10);_0x3a9301[_0xa675('0x48')]=_0xa675('0x49');}else if(_0x414509[_0xa675('0x43')]==='account'){logger['info'](_0xa675('0x46'),_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x2d')]=_0x544921!==_0xa675('0x47')?_0x544921:util[_0xa675('0x45')](_0xa675('0x4a'),_0x4fcf10);}else{return null;}}return _0x3c22de[_0xa675('0x23')](_['upperFirst'](_0x414509[_0xa675('0x43')]))[_0xa675('0x24')](_0x3a9301)['then'](function(_0x286a79){return BPromise['resolve']({'id':_0x286a79['id'],'endUserType':_0x414509[_0xa675('0x43')]});});}});}function getCustomFields(_0x3e28ce,_0x1424ad){var _0x2867fe={};if(_0x3e28ce[_0xa675('0x2a')]>0x0){_[_0xa675('0x4b')](_0x3e28ce,function(_0x8c4d48){if(_[_0xa675('0x4c')]([_0xa675('0x4d'),_0xa675('0x4e')],_0x8c4d48[_0xa675('0x40')])&&_0x8c4d48[_0xa675('0x4f')]){_0x2867fe[_0x8c4d48[_0xa675('0x4f')]]=_0x8c4d48[_0xa675('0x50')][_0xa675('0x51')]();}else if(_0x8c4d48[_0xa675('0x40')]===_0xa675('0x52')&&_0x8c4d48[_0xa675('0x53')]&&_0x8c4d48[_0xa675('0x4f')]){_0x1424ad[_0x8c4d48[_0xa675('0x53')]]&&(_0x2867fe[_0x8c4d48['idField']]=_0x1424ad[_0x8c4d48[_0xa675('0x53')]]['toString']());}else if(_0x8c4d48['type']===_0xa675('0x54')&&_0x8c4d48['Variable']&&_0x8c4d48[_0xa675('0x55')][_0xa675('0x56')]&&_0x8c4d48[_0xa675('0x4f')]){_0x1424ad[_0x8c4d48[_0xa675('0x55')]['name'][_0xa675('0x57')]()]&&(_0x2867fe[_0x8c4d48['idField']]=_0x1424ad[_0x8c4d48[_0xa675('0x55')][_0xa675('0x56')][_0xa675('0x57')]()][_0xa675('0x51')]());}});}return _0x2867fe;}function getConnection(_0x5a0a01){var _0x322431=_0x5a0a01[_0xa675('0x58')][_0xa675('0x59')](_0x5a0a01[_0xa675('0x5a')]);var _0x5c43e5=new jsforce[(_0xa675('0x5b'))]({'oauth2':{'loginUrl':_0x5a0a01[_0xa675('0x5c')]||'https://login.salesforce.com','clientId':_0x5a0a01[_0xa675('0x5d')],'clientSecret':_0x5a0a01[_0xa675('0x5e')]}});return _0x5c43e5['login'](_0x5a0a01['username'],_0x322431)[_0xa675('0x29')](function(){logger[_0xa675('0x21')](_0xa675('0x5f'));return _0x5c43e5;});}exports[_0xa675('0x60')]=function(_0x591e96,_0x3ce8fd,_0xb6b187,_0x10a344,_0x26f41d,_0x51601d){var _0x1492ea,_0x4893d6,_0x91047e,_0x11c733;_0x51601d[_0xa675('0x61')]=intUtil[_0xa675('0x62')](_0x51601d['serverUrl']);_0x51601d[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x51601d[_0xa675('0x5c')]);if(_0x26f41d&&_0x26f41d[_0xa675('0x63')]){logger[_0xa675('0x21')](_0xa675('0x64'),_0xa675('0x65'));_0x3ce8fd[_0xa675('0x66')]=util[_0xa675('0x45')](_0xa675('0x67'),_0x51601d[_0xa675('0x61')],_0x3ce8fd['uniqueid'],md5(_0x3ce8fd['uniqueid']));}else{_0x3ce8fd['recordingURL']='';}return getConnection(_0x51601d)[_0xa675('0x29')](function(_0x3d1881){_0x11c733=_0x3d1881;return getUser(_0x51601d,_0x10a344[_0xa675('0x68')],_0x11c733);})[_0xa675('0x29')](function(_0x4c6381){_0x1492ea=_0x4c6381;return getEndUser(_0x51601d,_0xb6b187,_0x3ce8fd['calleridname'],_0x3ce8fd[_0xa675('0x69')],_0x11c733);})['then'](function(_0x28a98f){_0x4893d6=_0x28a98f;return getTicket(_0x51601d,_0x1492ea,_0x4893d6,_0xb6b187,_0x3ce8fd,_0xb6b187['Fields'],_0x11c733,'queue');})[_0xa675('0x29')](function(_0x662fa1){_0x91047e=_0x662fa1;logger[_0xa675('0x21')](_0xa675('0x6a'),_0x91047e['id']);logger[_0xa675('0x21')](_0xa675('0x6b'),_0x91047e['id'],_0x10a344[_0xa675('0x56')],_0x51601d[_0xa675('0x40')]);switch(_0x51601d['type']){case _0xa675('0x6c'):emit(util['format']('user:%s',_0x10a344['name']),_0xa675('0x6d'),{'recordId':_0x91047e['id']});break;case _0xa675('0x6e'):emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x10a344[_0xa675('0x56')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x11c733[_0xa675('0x70')],_0x91047e['id'])});break;default:logger[_0xa675('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa675('0x72')](function(_0x473ff9){logger[_0xa675('0x71')](_0xa675('0x64'),_0x473ff9);});};exports[_0xa675('0x73')]=function(_0x4f20c7,_0x1f4d52,_0x48ff48,_0x345e8a,_0x40ca50,_0x59568e,_0x57ee18){var _0x6eaa09,_0x440df5,_0x41eb8a,_0x2b69f2;_0x59568e['serverUrl']=intUtil['stripTrailingSlash'](_0x59568e[_0xa675('0x61')]);_0x59568e[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x59568e[_0xa675('0x5c')]);if(_0x57ee18&&_0x57ee18[_0xa675('0x74')]&&_0x57ee18['recordingFormat']!==_0xa675('0x75')){logger[_0xa675('0x21')](_0xa675('0x76'),_0xa675('0x65'));_0x1f4d52[_0xa675('0x66')]=util[_0xa675('0x45')](_0xa675('0x67'),_0x59568e[_0xa675('0x61')],_0x1f4d52[_0xa675('0x77')],md5(_0x1f4d52[_0xa675('0x77')]));}return getConnection(_0x59568e)[_0xa675('0x29')](function(_0x78b998){_0x2b69f2=_0x78b998;return getUser(_0x59568e,_0x345e8a['email'],_0x2b69f2);})[_0xa675('0x29')](function(_0x261e10){_0x6eaa09=_0x261e10;return getEndUser(_0x59568e,_0x48ff48,_0x1f4d52[_0xa675('0x78')],_0x1f4d52['destcalleridnum'],_0x2b69f2);})[_0xa675('0x29')](function(_0x1297a2){_0x440df5=_0x1297a2;return getTicket(_0x59568e,_0x6eaa09,_0x440df5,_0x48ff48,_0x1f4d52,_0x48ff48[_0xa675('0x79')],_0x2b69f2,_0xa675('0x73'));})['then'](function(_0x442ad8){_0x41eb8a=_0x442ad8;logger[_0xa675('0x21')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x41eb8a['id']);logger[_0xa675('0x21')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x41eb8a['id'],_0x345e8a[_0xa675('0x56')],_0x59568e[_0xa675('0x40')]);switch(_0x59568e[_0xa675('0x40')]){case _0xa675('0x6c'):emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x345e8a['name']),_0xa675('0x6d'),{'recordId':_0x41eb8a['id']});break;case'newTab':emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x345e8a[_0xa675('0x56')]),_0xa675('0x7a'),{'uri':util['format'](_0xa675('0x7b'),_0x2b69f2['instanceUrl'],_0x41eb8a['id'])});break;default:logger[_0xa675('0x71')]('[OUTBOUND]',_0xa675('0x7c'));}})[_0xa675('0x72')](function(_0x5bc5eb){logger['error']('[OUTBOUND]',_0x5bc5eb);});};exports[_0xa675('0x7d')]=function(_0x512820,_0x2678a1,_0x4f252,_0x5bab1f,_0xe3045b,_0x43b50a){var _0x26baa1,_0x36ba3b,_0x4b5fa9,_0x41d0ae;_0x43b50a[_0xa675('0x61')]=intUtil[_0xa675('0x62')](_0x43b50a[_0xa675('0x61')]);_0x43b50a[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x43b50a[_0xa675('0x5c')]);if(_0xe3045b&&_0xe3045b[_0xa675('0x63')]){logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']',_0xa675('0x65'));_0x2678a1[_0xa675('0x66')]=util['format'](_0xa675('0x67'),_0x43b50a[_0xa675('0x61')],_0x2678a1[_0xa675('0x77')],md5(_0x2678a1[_0xa675('0x77')]));}else{_0x2678a1['recordingURL']='';}return getConnection(_0x43b50a)[_0xa675('0x29')](function(_0x539c1d){_0x41d0ae=_0x539c1d;if(!_[_0xa675('0x25')](_0x5bab1f)){return getUser(_0x43b50a,_0x5bab1f[_0xa675('0x56')],_0x41d0ae);}else{return getUser(_0x43b50a,null,_0x41d0ae);}})[_0xa675('0x29')](function(_0x59b344){_0x26baa1=_0x59b344;return getEndUser(_0x43b50a,_0x4f252,_0x2678a1[_0xa675('0x80')],_0x2678a1['calleridnum'],_0x41d0ae);})[_0xa675('0x29')](function(_0x4e6258){_0x36ba3b=_0x4e6258;return getTicket(_0x43b50a,_0x26baa1,_0x36ba3b,_0x4f252,_0x2678a1,_0x4f252['Fields'],_0x41d0ae);})[_0xa675('0x29')](function(_0x307b8e){_0x4b5fa9=_0x307b8e;logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x4b5fa9['id']);logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x43b50a[_0xa675('0x40')]);})[_0xa675('0x72')](function(_0x306802){logger[_0xa675('0x71')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']',_0x306802);});}; \ No newline at end of file +var _0x85d8=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','request-promise','jsforce','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','WhatId','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','resolve','user_id','display_name','identity','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields'];(function(_0x5870f7,_0x5d6542){var _0x45df2d=function(_0x1939ba){while(--_0x1939ba){_0x5870f7['push'](_0x5870f7['shift']());}};_0x45df2d(++_0x5d6542);}(_0x85d8,0x105));var _0x885d=function(_0x59ef9f,_0x272a36){_0x59ef9f=_0x59ef9f-0x0;var _0x121799=_0x85d8[_0x59ef9f];return _0x121799;};'use strict';var _=require(_0x885d('0x0'));var rp=require(_0x885d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x885d('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x885d('0x3'));var config=require('../../../../config/environment');var logger=require(_0x885d('0x4'))(_0x885d('0x5'));config[_0x885d('0x6')]=_[_0x885d('0x7')](config[_0x885d('0x6')],{'host':_0x885d('0x8'),'port':0x18eb});var io=require(_0x885d('0x9'))(new Redis(config[_0x885d('0x6')]));function emit(_0x32070f,_0x175eab,_0x37bf80){io['to'](_0x32070f)[_0x885d('0xa')](_0x175eab,_0x37bf80);}function getTicket(_0x114126,_0xc2b2bf,_0x54ca3b,_0x365e89,_0xc6ec3,_0x5adcb7,_0x1676e8,_0x3f7583){var _0x52da63=Object[_0x885d('0xb')]({},{'OwnerId':_0xc2b2bf['id'],'Subject':intUtil['getString'](_0x365e89['Subjects'],_0xc6ec3,'\x20'),'Description':intUtil[_0x885d('0xc')](_0x365e89[_0x885d('0xd')],_0xc6ec3,'\x0a')},getCustomFields(_0x5adcb7,_0xc6ec3));if(_0x54ca3b){if(_0x365e89[_0x885d('0xe')]===_0x885d('0xf')){_0x52da63['ActivityDate']=moment[_0x885d('0x10')]();_0x52da63[_0x885d('0x11')]=![];_0x52da63[_0x885d('0x12')]=![];if(_0x54ca3b[_0x885d('0x13')]==='contact'||_0x54ca3b[_0x885d('0x13')]===_0x885d('0x14')){_0x52da63[_0x885d('0x15')]=_0x54ca3b['id'];}else if(_0x54ca3b[_0x885d('0x13')]==='account'){_0x52da63[_0x885d('0x16')]=_0x54ca3b['id'];}}else if(_0x365e89[_0x885d('0xe')]==='Case'){if(_0x54ca3b['endUserType']===_0x885d('0x17')){_0x52da63[_0x885d('0x18')]=_0x54ca3b['id'];}else if(_0x54ca3b[_0x885d('0x13')]===_0x885d('0x19')){_0x52da63[_0x885d('0x1a')]=_0x54ca3b['id'];}else if(_0x54ca3b['endUserType']===_0x885d('0x14')&&_0x365e89[_0x885d('0x1b')]){_0x52da63[_0x365e89[_0x885d('0x1b')]]=_0x54ca3b['id'];}else{logger[_0x885d('0x1c')](_0x885d('0x1d'));}}}return _0x1676e8[_0x885d('0x1e')](_0x365e89[_0x885d('0xe')])[_0x885d('0x1f')](_0x52da63);}function getUser(_0x1ac01,_0x1cdfd6,_0x3a7dc6){if(!_['isNil'](_0x1cdfd6)&&intUtil[_0x885d('0x20')](_0x1cdfd6)){var _0x58fd4c={'Email':_0x1cdfd6};var _0x2f8077={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3a7dc6[_0x885d('0x1e')](_0x885d('0x21'))[_0x885d('0x22')](_0x58fd4c,_0x2f8077)[_0x885d('0x23')]()['then'](function(_0x99c4f5){if(_0x99c4f5[_0x885d('0x24')]){var _0x551340=_[_0x885d('0x22')](_0x99c4f5,function(_0x4218ea){return _0x4218ea[_0x885d('0x25')]===_0x1cdfd6;});if(_0x551340){logger[_0x885d('0x1c')]('Agent\x20%s\x20found.',_0x1cdfd6);return BPromise['resolve']({'id':_0x551340['Id'],'name':_0x551340[_0x885d('0x26')]});}}else{logger[_0x885d('0x1c')](_0x885d('0x27'),_0x1cdfd6);return _0x3a7dc6['identity']()[_0x885d('0x28')](function(_0x409d66){return BPromise[_0x885d('0x29')]({'id':_0x409d66[_0x885d('0x2a')],'name':_0x409d66[_0x885d('0x2b')]});});}});}else{logger['info'](_0x885d('0x27'),_0x1cdfd6);return _0x3a7dc6[_0x885d('0x2c')]()[_0x885d('0x28')](function(_0x362294){return BPromise['resolve']({'id':_0x362294[_0x885d('0x2a')],'name':_0x362294['display_name']});});}}function getEndUser(_0x41ff34,_0xfb7ada,_0x1284e5,_0x41c437,_0x2212f6){var _0x9e6da5={'$or':{'Phone':_0x41c437}};var _0x3a7e57={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x885d('0x29')]()['then'](function(){logger[_0x885d('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x41c437,_0xfb7ada[_0x885d('0x2d')]);switch(_0xfb7ada[_0x885d('0x2d')]){case _0x885d('0x2e'):var _0x178c68=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x30')]){var _0x75478f={};_0x75478f[_0xfb7ada[_0x885d('0x30')]]=_0x41c437;_[_0x885d('0x31')](_0x178c68['$or'],_0x75478f);}return _0x2212f6['sobject'](_0x885d('0x32'))['find'](_0x178c68,_0x3a7e57)[_0x885d('0x23')]()[_0x885d('0x28')](function(_0x54ec8f){if(_0x54ec8f&&_0x54ec8f[_0x885d('0x24')]){return _0x54ec8f;}else{var _0x530883=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x33')]){var _0x1bf88f={};_0x1bf88f[_0xfb7ada['additionalSearchLead']]=_0x41c437;_[_0x885d('0x31')](_0x530883[_0x885d('0x34')],_0x1bf88f);}return _0x2212f6[_0x885d('0x1e')](_0x885d('0x35'))[_0x885d('0x22')](_0x530883,_0x3a7e57);}});case'account_contact_lead':var _0x4ada12=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x36')]){var _0x75478f={};_0x75478f[_0xfb7ada['additionalSearchAccount']]=_0x41c437;_[_0x885d('0x31')](_0x4ada12[_0x885d('0x34')],_0x75478f);}return _0x2212f6['sobject'](_0x885d('0x37'))['find'](_0x4ada12,_0x3a7e57)[_0x885d('0x23')]()[_0x885d('0x28')](function(_0x5f5712){if(_0x5f5712&&_0x5f5712[_0x885d('0x24')]){return _0x5f5712;}else{var _0x33826c=_['cloneDeep'](_0x9e6da5);if(_0xfb7ada['additionalSearchContact']){var _0x2ef9ed={};_0x2ef9ed[_0xfb7ada[_0x885d('0x30')]]=_0x41c437;_[_0x885d('0x31')](_0x33826c['$or'],_0x2ef9ed);}return _0x2212f6[_0x885d('0x1e')](_0x885d('0x32'))[_0x885d('0x22')](_0x33826c,_0x3a7e57)[_0x885d('0x28')](function(_0x243376){if(_0x243376&&_0x243376[_0x885d('0x24')]){return _0x243376;}else{var _0x1b14fd=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x33')]){var _0x857780={};_0x857780[_0xfb7ada[_0x885d('0x33')]]=_0x41c437;_['merge'](_0x1b14fd['$or'],_0x857780);}return _0x2212f6['sobject'](_0x885d('0x35'))[_0x885d('0x22')](_0x1b14fd,_0x3a7e57);}});}});case _0x885d('0x17'):var _0x178c68=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada['additionalSearchContact']){var _0x75478f={};_0x75478f[_0xfb7ada[_0x885d('0x30')]]=_0x41c437;_['merge'](_0x178c68['$or'],_0x75478f);}return _0x2212f6['sobject']('Contact')[_0x885d('0x22')](_0x178c68,_0x3a7e57)['execute']();case _0x885d('0x14'):var _0x5b0d1c=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x33')]){var _0x75478f={};_0x75478f[_0xfb7ada['additionalSearchLead']]=_0x41c437;_['merge'](_0x5b0d1c[_0x885d('0x34')],_0x75478f);}return _0x2212f6['sobject']('Lead')['find'](_0x5b0d1c,_0x3a7e57);case _0x885d('0x19'):var _0x4ada12=_[_0x885d('0x2f')](_0x9e6da5);if(_0xfb7ada[_0x885d('0x36')]){var _0x75478f={};_0x75478f[_0xfb7ada[_0x885d('0x36')]]=_0x41c437;_[_0x885d('0x31')](_0x4ada12[_0x885d('0x34')],_0x75478f);}return _0x2212f6[_0x885d('0x1e')](_0x885d('0x37'))[_0x885d('0x22')](_0x4ada12,_0x3a7e57);default:return null;}})[_0x885d('0x28')](function(_0x3a5235){if(_0x3a5235&&_0x3a5235[_0x885d('0x24')]){var _0x457d17=_['first'](_0x3a5235);if(_0x457d17){return BPromise[_0x885d('0x29')]({'id':_0x457d17['Id'],'name':_0x457d17[_0x885d('0x26')],'phone':_0x457d17['Phone'],'endUserType':_0x457d17[_0x885d('0x38')][_0x885d('0x39')][_0x885d('0x3a')]()});}}})[_0x885d('0x28')](function(_0x5e048f){if(_0x5e048f){logger['info'](_0x885d('0x3b'),_0x5e048f[_0x885d('0x13')],_0x41c437);return BPromise['resolve'](_0x5e048f);}else{logger[_0x885d('0x1c')](_0x885d('0x3c'),_0x41c437);var _0x4beb74={'Phone':_0x41c437};if(_0xfb7ada['moduleCreate']){if(_0xfb7ada[_0x885d('0x3d')]==='contact'){logger[_0x885d('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x41c437,_0xfb7ada[_0x885d('0x3d')]);_0x4beb74[_0x885d('0x3e')]=_0x1284e5!==_0x885d('0x3f')?_0x1284e5:util[_0x885d('0x40')](_0x885d('0x41'),_0x41c437);}else if(_0xfb7ada[_0x885d('0x3d')]===_0x885d('0x14')){logger[_0x885d('0x1c')](_0x885d('0x42'),_0x41c437,_0xfb7ada[_0x885d('0x3d')]);_0x4beb74[_0x885d('0x3e')]=_0x1284e5!==_0x885d('0x3f')?_0x1284e5:util['format'](_0x885d('0x41'),_0x41c437);_0x4beb74[_0x885d('0x43')]=_0x885d('0x44');}else if(_0xfb7ada[_0x885d('0x3d')]===_0x885d('0x19')){logger['info'](_0x885d('0x42'),_0x41c437,_0xfb7ada['moduleCreate']);_0x4beb74['Name']=_0x1284e5!==_0x885d('0x3f')?_0x1284e5:util[_0x885d('0x40')](_0x885d('0x41'),_0x41c437);}else{return null;}}return _0x2212f6['sobject'](_[_0x885d('0x45')](_0xfb7ada[_0x885d('0x3d')]))[_0x885d('0x1f')](_0x4beb74)['then'](function(_0x38430f){return BPromise[_0x885d('0x29')]({'id':_0x38430f['id'],'endUserType':_0xfb7ada[_0x885d('0x3d')]});});}});}function getCustomFields(_0x15db33,_0x7e782b){var _0xb863d0={};if(_0x15db33[_0x885d('0x24')]>0x0){_[_0x885d('0x46')](_0x15db33,function(_0x267e72){if(_[_0x885d('0x47')]([_0x885d('0x48'),_0x885d('0x49')],_0x267e72[_0x885d('0x39')])&&_0x267e72[_0x885d('0x4a')]){_0xb863d0[_0x267e72[_0x885d('0x4a')]]=_0x267e72['content']['toString']();}else if(_0x267e72[_0x885d('0x39')]===_0x885d('0x4b')&&_0x267e72[_0x885d('0x4c')]&&_0x267e72[_0x885d('0x4a')]){_0x7e782b[_0x267e72[_0x885d('0x4c')]]&&(_0xb863d0[_0x267e72[_0x885d('0x4a')]]=_0x7e782b[_0x267e72[_0x885d('0x4c')]][_0x885d('0x4d')]());}else if(_0x267e72[_0x885d('0x39')]===_0x885d('0x4e')&&_0x267e72[_0x885d('0x4f')]&&_0x267e72['Variable'][_0x885d('0x50')]&&_0x267e72['idField']){_0x7e782b[_0x267e72[_0x885d('0x4f')]['name']['toLowerCase']()]&&(_0xb863d0[_0x267e72[_0x885d('0x4a')]]=_0x7e782b[_0x267e72[_0x885d('0x4f')][_0x885d('0x50')][_0x885d('0x3a')]()][_0x885d('0x4d')]());}});}return _0xb863d0;}function getConnection(_0x1086cd){var _0x16f1bf=_0x1086cd[_0x885d('0x51')][_0x885d('0x52')](_0x1086cd[_0x885d('0x53')]);var _0x4784d7=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1086cd[_0x885d('0x54')]||'https://login.salesforce.com','clientId':_0x1086cd[_0x885d('0x55')],'clientSecret':_0x1086cd[_0x885d('0x56')]}});return _0x4784d7['login'](_0x1086cd['username'],_0x16f1bf)['then'](function(){logger[_0x885d('0x1c')](_0x885d('0x57'));return _0x4784d7;});}exports[_0x885d('0x58')]=function(_0x3353d3,_0x15bddb,_0x2a1a8a,_0x242b73,_0x5d3958,_0x29379d){var _0x23e48e,_0xe33400,_0x4f3eff,_0x1b589b;_0x29379d[_0x885d('0x59')]=intUtil[_0x885d('0x5a')](_0x29379d['serverUrl']);_0x29379d[_0x885d('0x54')]=intUtil[_0x885d('0x5a')](_0x29379d['remoteUri']);if(_0x5d3958&&_0x5d3958[_0x885d('0x5b')]){logger[_0x885d('0x1c')](_0x885d('0x5c'),_0x885d('0x5d'));_0x15bddb[_0x885d('0x5e')]=util[_0x885d('0x40')](_0x885d('0x5f'),_0x29379d[_0x885d('0x59')],_0x15bddb[_0x885d('0x60')],md5(_0x15bddb['uniqueid']));}else{_0x15bddb[_0x885d('0x5e')]='';}return getConnection(_0x29379d)[_0x885d('0x28')](function(_0xa2378b){_0x1b589b=_0xa2378b;return getUser(_0x29379d,_0x242b73[_0x885d('0x61')],_0x1b589b);})['then'](function(_0xd2ca1b){_0x23e48e=_0xd2ca1b;return getEndUser(_0x29379d,_0x2a1a8a,_0x15bddb[_0x885d('0x62')],_0x15bddb['calleridnum'],_0x1b589b);})[_0x885d('0x28')](function(_0x4f613d){_0xe33400=_0x4f613d;return getTicket(_0x29379d,_0x23e48e,_0xe33400,_0x2a1a8a,_0x15bddb,_0x2a1a8a['Fields'],_0x1b589b,_0x885d('0x58'));})[_0x885d('0x28')](function(_0x39eadc){_0x4f3eff=_0x39eadc;logger[_0x885d('0x1c')](_0x885d('0x63'),_0x4f3eff['id']);logger[_0x885d('0x1c')](_0x885d('0x64'),_0x4f3eff['id'],_0x242b73[_0x885d('0x50')],_0x29379d[_0x885d('0x39')]);switch(_0x29379d['type']){case _0x885d('0x65'):emit(util[_0x885d('0x40')](_0x885d('0x66'),_0x242b73[_0x885d('0x50')]),_0x885d('0x67'),{'recordId':_0x4f3eff['id']});break;case'newTab':emit(util[_0x885d('0x40')](_0x885d('0x66'),_0x242b73[_0x885d('0x50')]),_0x885d('0x68'),{'uri':util['format'](_0x885d('0x69'),_0x1b589b['instanceUrl'],_0x4f3eff['id'])});break;default:logger[_0x885d('0x6a')](_0x885d('0x6b'));}})['catch'](function(_0x6ff615){logger[_0x885d('0x6a')](_0x885d('0x5c'),_0x6ff615);});};exports[_0x885d('0x6c')]=function(_0x2ed87d,_0x73613c,_0x2e1cdc,_0x4da172,_0x15db91,_0x535177,_0xfbc560){var _0x260b28,_0x515992,_0x4d61bd,_0x281f6c;_0x535177[_0x885d('0x59')]=intUtil[_0x885d('0x5a')](_0x535177[_0x885d('0x59')]);_0x535177[_0x885d('0x54')]=intUtil[_0x885d('0x5a')](_0x535177[_0x885d('0x54')]);if(_0xfbc560&&_0xfbc560[_0x885d('0x6d')]&&_0xfbc560['recordingFormat']!=='none'){logger['info'](_0x885d('0x6e'),_0x885d('0x5d'));_0x73613c['recordingURL']=util[_0x885d('0x40')](_0x885d('0x5f'),_0x535177[_0x885d('0x59')],_0x73613c['uniqueid'],md5(_0x73613c[_0x885d('0x60')]));}return getConnection(_0x535177)[_0x885d('0x28')](function(_0x163e5b){_0x281f6c=_0x163e5b;return getUser(_0x535177,_0x4da172['email'],_0x281f6c);})[_0x885d('0x28')](function(_0xc7b188){_0x260b28=_0xc7b188;return getEndUser(_0x535177,_0x2e1cdc,_0x73613c[_0x885d('0x6f')],_0x73613c[_0x885d('0x70')],_0x281f6c);})[_0x885d('0x28')](function(_0x390a3c){_0x515992=_0x390a3c;return getTicket(_0x535177,_0x260b28,_0x515992,_0x2e1cdc,_0x73613c,_0x2e1cdc[_0x885d('0x71')],_0x281f6c,_0x885d('0x6c'));})[_0x885d('0x28')](function(_0x5c26c4){_0x4d61bd=_0x5c26c4;logger[_0x885d('0x1c')](_0x885d('0x72'),_0x4d61bd['id']);logger[_0x885d('0x1c')](_0x885d('0x73'),_0x4d61bd['id'],_0x4da172[_0x885d('0x50')],_0x535177['type']);switch(_0x535177[_0x885d('0x39')]){case'integrationTab':emit(util[_0x885d('0x40')]('user:%s',_0x4da172['name']),_0x885d('0x67'),{'recordId':_0x4d61bd['id']});break;case'newTab':emit(util[_0x885d('0x40')](_0x885d('0x66'),_0x4da172[_0x885d('0x50')]),_0x885d('0x68'),{'uri':util[_0x885d('0x40')](_0x885d('0x69'),_0x281f6c[_0x885d('0x74')],_0x4d61bd['id'])});break;default:logger['error'](_0x885d('0x6e'),_0x885d('0x75'));}})[_0x885d('0x76')](function(_0x2c1d40){logger[_0x885d('0x6a')](_0x885d('0x6e'),_0x2c1d40);});};exports[_0x885d('0x77')]=function(_0x473421,_0x35eac7,_0x1a3cc4,_0x35c485,_0x5ab1bc,_0x943c){var _0x295885,_0x2a3ac6,_0x56ec9b,_0x42471e;_0x943c[_0x885d('0x59')]=intUtil[_0x885d('0x5a')](_0x943c[_0x885d('0x59')]);_0x943c[_0x885d('0x54')]=intUtil['stripTrailingSlash'](_0x943c[_0x885d('0x54')]);if(_0x5ab1bc&&_0x5ab1bc[_0x885d('0x5b')]){logger[_0x885d('0x1c')]('['+_0x35eac7[_0x885d('0x78')][_0x885d('0x79')]()+']',_0x885d('0x5d'));_0x35eac7[_0x885d('0x5e')]=util[_0x885d('0x40')](_0x885d('0x5f'),_0x943c[_0x885d('0x59')],_0x35eac7[_0x885d('0x60')],md5(_0x35eac7[_0x885d('0x60')]));}else{_0x35eac7[_0x885d('0x5e')]='';}return getConnection(_0x943c)['then'](function(_0x2ac4c5){_0x42471e=_0x2ac4c5;if(!_[_0x885d('0x7a')](_0x35c485)){return getUser(_0x943c,_0x35c485[_0x885d('0x50')],_0x42471e);}else{return getUser(_0x943c,null,_0x42471e);}})[_0x885d('0x28')](function(_0x1b8284){_0x295885=_0x1b8284;return getEndUser(_0x943c,_0x1a3cc4,_0x35eac7[_0x885d('0x62')],_0x35eac7[_0x885d('0x7b')],_0x42471e);})['then'](function(_0x4041ab){_0x2a3ac6=_0x4041ab;return getTicket(_0x943c,_0x295885,_0x2a3ac6,_0x1a3cc4,_0x35eac7,_0x1a3cc4[_0x885d('0x71')],_0x42471e);})['then'](function(_0x193ec7){_0x56ec9b=_0x193ec7;logger[_0x885d('0x1c')]('['+_0x35eac7['lastevent'][_0x885d('0x79')]()+_0x885d('0x7c'),_0x56ec9b['id']);logger[_0x885d('0x1c')]('['+_0x35eac7[_0x885d('0x78')][_0x885d('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x943c[_0x885d('0x39')]);})['catch'](function(_0xd6c54a){logger[_0x885d('0x6a')]('['+_0x35eac7[_0x885d('0x78')][_0x885d('0x79')]()+']',_0xd6c54a);});}; \ 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 cd2ec75..80ada29 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 _0xc924=[']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','adminEmail','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','content','toString','string','picklist','idField','variable','variableName','toLowerCase','Variable','name'];(function(_0x27354f,_0x2972a5){var _0x573b7e=function(_0x401665){while(--_0x401665){_0x27354f['push'](_0x27354f['shift']());}};_0x573b7e(++_0x2972a5);}(_0xc924,0x1e0));var _0x4c92=function(_0x5babf9,_0x51b7be){_0x5babf9=_0x5babf9-0x0;var _0x42f6f4=_0xc924[_0x5babf9];return _0x42f6f4;};'use strict';var _=require(_0x4c92('0x0'));var Promise=require(_0x4c92('0x1'));var rp=require(_0x4c92('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x4c92('0x3'));var intUtil=require(_0x4c92('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4c92('0x5'))(_0x4c92('0x6'));config[_0x4c92('0x7')]=_[_0x4c92('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4c92('0x9'))(new Redis(config[_0x4c92('0x7')]));function getAdminUser(_0x4d7f2a,_0x24830a,_0x72fb5b,_0x33d42d,_0xf0700f,_0x5bb597){return new Promise(function(_0x3840bb,_0x3ea092){var _0x1bdc6e={'method':_0x4c92('0xa'),'uri':_0x33d42d+_0x4c92('0xb')+'&'+_0xf0700f+'&'+_0x5bb597,'auth':_0x24830a,'json':!![]};return rp(_0x1bdc6e)[_0x4c92('0xc')](function(_0x333f73){if(_0x333f73['result'][_0x4c92('0xd')]>0x0){_0x72fb5b[_0x4c92('0xe')]=_0x333f73[_0x4c92('0xf')][0x0]['sys_id'];}logger[_0x4c92('0x10')]('['+[_0x4d7f2a[_0x4c92('0x11')]()]+_0x4c92('0x12'),_0x72fb5b);_0x3840bb(_0x72fb5b);})[_0x4c92('0x13')](function(_0x16b107){logger[_0x4c92('0x14')]('['+[_0x4d7f2a[_0x4c92('0x11')]()]+']',_0x16b107[_0x4c92('0x15')]);_0x3ea092(_0x16b107[_0x4c92('0x15')]);});});}function getUser(_0x30251f,_0x438ce1,_0xc12dc1,_0x3c1f9c,_0xa37464){return function(_0xb07ae2){logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+'],\x20getUser\x20input\x20crm',_0xb07ae2);return new Promise(function(_0x85cbc7,_0x45f1d7){if(intUtil['validateEmail'](_0xb07ae2[_0x4c92('0x16')])){var _0x12f1a1={'method':'GET','uri':_0xc12dc1+_0x4c92('0x17')+_0xb07ae2[_0x4c92('0x16')]+'&'+_0x3c1f9c+'&'+_0xa37464,'auth':_0x438ce1,'json':!![]};logger[_0x4c92('0x10')]('['+[_0x30251f['toUpperCase']()]+_0x4c92('0x18'),_0x12f1a1);return rp(_0x12f1a1)[_0x4c92('0xc')](function(_0xd3c2e6){logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x19'),_0xd3c2e6);if(_0xd3c2e6[_0x4c92('0xf')][_0x4c92('0xd')]>0x0&&String(_0xd3c2e6[_0x4c92('0xf')][0x0]['active'])==='true'){_0xb07ae2[_0x4c92('0x1a')]=_0xd3c2e6[_0x4c92('0xf')][0x0][_0x4c92('0x1b')];}else{_0xb07ae2[_0x4c92('0x1a')]=_0xb07ae2[_0x4c92('0xe')];_0xb07ae2[_0x4c92('0x16')]=_0xb07ae2['adminEmail'];}logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x1c'),_0xb07ae2);_0x85cbc7(_0xb07ae2);})['catch'](function(_0x3313a5){logger[_0x4c92('0x14')]('['+[_0x30251f[_0x4c92('0x11')]()]+']',_0x3313a5['message']);_0x45f1d7(_0x3313a5['message']);});}else{logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x1d'));_0xb07ae2['userId']=_0xb07ae2[_0x4c92('0xe')];_0xb07ae2[_0x4c92('0x16')]=_0xb07ae2['adminEmail'];_0x85cbc7(_0xb07ae2);}});};}function createEndUser(_0xf56ba,_0x2b193b,_0x166c5b,_0x10f255,_0x4358fa){logger['info']('['+[_0xf56ba['toUpperCase']()]+_0x4c92('0x1e'),_0x166c5b);return new Promise(function(_0x5bbdc0,_0x5789cb){var _0x314d52={'method':_0x4c92('0x1f'),'uri':_0x10f255+_0x4c92('0x20')+_0x4358fa,'body':{'user_name':_0x166c5b['endUserNumber'],'roles':_0x4c92('0x21'),'first_name':_0x166c5b[_0x4c92('0x22')],'active':_0x4c92('0x23'),'date_format':'System','phone':_0x166c5b['endUserNumber']},'auth':_0x2b193b,'json':!![]};return rp(_0x314d52)[_0x4c92('0xc')](function(_0x55137a){logger['info']('['+[_0xf56ba['toUpperCase']()]+'],\x20EndUser\x20schema',_0x55137a['result']);_0x166c5b[_0x4c92('0x24')]=_0x55137a['result'][_0x4c92('0x1b')];_0x5bbdc0(_0x166c5b);})[_0x4c92('0x13')](function(_0x30bd09){logger[_0x4c92('0x14')]('['+[_0xf56ba['toUpperCase']()]+']',_0x30bd09[_0x4c92('0x15')]);_0x5789cb(_0x30bd09[_0x4c92('0x15')]);});});}function getEndUser(_0x1b7502,_0x8205df,_0x2de63b,_0x271e39,_0x296b93){return function(_0x1272a9){logger['info']('['+[_0x1b7502[_0x4c92('0x11')]()]+_0x4c92('0x25'),_0x1272a9);return new Promise(function(_0x1aaef3,_0x3d8b74){var _0x218e99={'method':'GET','uri':_0x2de63b+_0x4c92('0x26')+_0x1272a9[_0x4c92('0x22')]+'&'+_0x271e39+'&'+_0x296b93,'auth':_0x8205df,'json':!![]};return rp(_0x218e99)[_0x4c92('0xc')](function(_0x188a98){if(_0x188a98[_0x4c92('0xf')]['length']>0x0){_0x1272a9[_0x4c92('0x24')]=_0x188a98[_0x4c92('0xf')][0x0][_0x4c92('0x1b')];logger[_0x4c92('0x10')]('['+[_0x1b7502['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x1272a9);_0x1aaef3(_0x1272a9);}else{return createEndUser(_0x1b7502,_0x8205df,_0x1272a9,_0x2de63b,_0x271e39)['then'](function(_0x378bd3){logger[_0x4c92('0x10')]('['+[_0x1b7502[_0x4c92('0x11')]()]+_0x4c92('0x27'),_0x378bd3);_0x1aaef3(_0x378bd3);});}})[_0x4c92('0x13')](function(_0x27a9ae){logger['error']('['+[_0x1b7502[_0x4c92('0x11')]()]+']',_0x27a9ae[_0x4c92('0x15')]);_0x3d8b74(_0x27a9ae[_0x4c92('0x15')]);});});};}function getCustomFields(_0x3fa8b6,_0x4868ad){var _0xa68d2e={};if(_0x3fa8b6[_0x4c92('0xd')]>0x0){_[_0x4c92('0x28')](_0x3fa8b6,function(_0x465458){if(_[_0x4c92('0x29')](['string','picklist'],_0x465458[_0x4c92('0x2a')])&&_0x465458[_0x4c92('0x2b')]&&!_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x2b')]['toLowerCase']()]=_0x465458[_0x4c92('0x2d')][_0x4c92('0x2e')]();}else if(_[_0x4c92('0x29')]([_0x4c92('0x2f'),_0x4c92('0x30')],_0x465458[_0x4c92('0x2a')])&&_0x465458[_0x4c92('0x31')]&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x31')]['toLowerCase']()]=_0x465458[_0x4c92('0x2d')][_0x4c92('0x2e')]();}else if(_0x465458[_0x4c92('0x2a')]===_0x4c92('0x32')&&_0x465458[_0x4c92('0x33')]&&_0x465458['idField']&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x31')][_0x4c92('0x34')]()]=_0x4868ad[_0x465458[_0x4c92('0x33')]]['toString']();}else if(_0x465458[_0x4c92('0x2a')]==='customVariable'&&_0x465458[_0x4c92('0x35')]&&_0x465458['Variable'][_0x4c92('0x36')]&&_0x465458[_0x4c92('0x31')]&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458['idField'][_0x4c92('0x34')]()]=_0x4868ad[_0x465458[_0x4c92('0x35')][_0x4c92('0x36')][_0x4c92('0x34')]()]['toString']();}});}return _0xa68d2e;}function getTicket(_0x56da95,_0x3562ae,_0x3272c2,_0x84cc75,_0x1fcca0,_0x58c245){return function(_0x3469b0){logger[_0x4c92('0x10')]('['+[_0x56da95[_0x4c92('0x11')]()]+_0x4c92('0x37'),_0x3469b0);return new Promise(function(_0x6169d9,_0x343e29){var _0x3c4b23=_0x56da95['toLowerCase']()==='outbound'?_0x3469b0[_0x4c92('0x1a')]:_0x3469b0[_0x4c92('0x24')];var _0x21311f={'method':'POST','uri':_0x3272c2+_0x4c92('0x38')+'?'+_0x58c245,'body':Object[_0x4c92('0x39')]({},{'active':_0x4c92('0x23'),'caller_id':_0x3c4b23,'assigned_to':_0x3469b0['userId'],'short_description':intUtil['getString'](_0x84cc75['Subjects'],_0x1fcca0,'\x20'),'description':intUtil[_0x4c92('0x3a')](_0x84cc75[_0x4c92('0x3b')],_0x1fcca0,'\x0a')},getCustomFields(_0x84cc75['Fields'],_0x1fcca0)),'auth':_0x3562ae,'json':!![]};return rp(_0x21311f)[_0x4c92('0xc')](function(_0x576f93){logger[_0x4c92('0x10')]('['+[_0x56da95[_0x4c92('0x11')]()]+_0x4c92('0x3c'),_0x576f93['result']);_0x3469b0[_0x4c92('0x3d')]=_0x576f93['result']['sys_id'];_0x3469b0[_0x4c92('0x3e')]=_0x576f93[_0x4c92('0xf')][_0x4c92('0x3f')];logger[_0x4c92('0x10')]('['+[_0x56da95['toUpperCase']()]+_0x4c92('0x40'),_0x3469b0);_0x6169d9(_0x3469b0);})[_0x4c92('0x13')](function(_0x59d511){logger['error']('['+[_0x56da95[_0x4c92('0x11')]()]+']',_0x59d511['message']);_0x343e29(_0x59d511['message']);});});};}function createRemoteTag(_0x579e93,_0x5ab655,_0xd343c8,_0x1bfd83){return new Promise(function(_0x5e247c,_0x58f03a){var _0x2d20ce={'method':_0x4c92('0x1f'),'uri':_0xd343c8+_0x4c92('0x41')+'?'+_0x1bfd83,'body':{'short_description':_0x579e93,'global':!![],'active':!![],'name':_0x579e93},'auth':_0x5ab655,'json':!![]};return rp(_0x2d20ce)[_0x4c92('0xc')](function(_0x5ad824){var _0x7238b2=_0x5ad824[_0x4c92('0xf')][_0x4c92('0x1b')];_0x5e247c(_0x7238b2);});});}function getRemoteTag(_0x3cf9d1,_0x278e81,_0x3c0035,_0x59aa38,_0x3f034){return new Promise(function(_0x3e08df,_0x9e64b1){var _0x5c2403={'method':_0x4c92('0xa'),'uri':_0x3c0035+'label'+'?sysparm_query=name%3D'+_0x3cf9d1+'&'+_0x59aa38,'auth':_0x278e81,'json':!![]};return rp(_0x5c2403)[_0x4c92('0xc')](function(_0x3103f9){if(_0x3103f9['result']['length']>0x0){var _0x55049d=_0x3103f9[_0x4c92('0xf')][0x0]['sys_id'];_0x3e08df(_0x55049d);}else{return createRemoteTag(_0x3cf9d1,_0x278e81,_0x3c0035,_0x59aa38)[_0x4c92('0xc')](function(_0x47d7fd){_0x3e08df(_0x47d7fd);});}});});}function assignTagToIncident(_0xbdfdfa,_0x487219,_0x347d02,_0x4f145e,_0x57bf08){return new Promise(function(_0x311703,_0x193368){var _0x1769c4={'method':_0x4c92('0x1f'),'uri':_0x347d02+'label_entry'+'?'+_0x57bf08,'body':{'label':_0xbdfdfa,'table':'incident','id_type':_0x4c92('0x42'),'table_key':_0x4f145e[_0x4c92('0x3d')],'title':'Incident\x20-\x20'+_0x4f145e[_0x4c92('0x3e')],'id_display':_0x4f145e[_0x4c92('0x3e')]},'auth':_0x487219,'json':!![]};return rp(_0x1769c4)[_0x4c92('0xc')](function(_0x89a56c){_0x311703();})[_0x4c92('0x13')](function(){_0x311703();});});}function manageTags(_0x21171e,_0x26f416,_0x45fe79,_0x41e677,_0xb5c1ee,_0x4f126d,_0x5dd103){return new Promise(function(_0x1a679d,_0x3e31ec){var _0x3b3015=[];_0x26f416[_0x4c92('0x28')](function(_0x3a90d4){_0x3b3015[_0x4c92('0x43')](getRemoteTag(_0x3a90d4,_0x45fe79,_0x41e677,_0x4f126d,_0x5dd103));});return Promise[_0x4c92('0x44')](_0x3b3015)[_0x4c92('0xc')](function(_0x48fa5f){if(_0x48fa5f['length']){logger[_0x4c92('0x10')]('['+[_0x21171e[_0x4c92('0x11')]()]+_0x4c92('0x45'),_0x48fa5f);var _0xec997b=[];_0x48fa5f['forEach'](function(_0x21f113){_0xec997b[_0x4c92('0x43')](assignTagToIncident(_0x21f113,_0x45fe79,_0x41e677,_0xb5c1ee,_0x4f126d));});return Promise[_0x4c92('0x44')](_0xec997b)['then'](function(){_0x1a679d();})[_0x4c92('0x13')](function(){_0x1a679d();});}else{_0x1a679d();}});});}function getTags(_0x536d29,_0xb66ca7,_0x2eecf9,_0x1ea2ea,_0xb8932c,_0x790070){return function(_0xd07822){return new Promise(function(_0x389c43,_0x15a047){var _0x219c67=[];var _0x10804d=_0x1ea2ea[_0x4c92('0x46')];if(_0x10804d&&_0x10804d[_0x4c92('0xd')]>0x0){_0x219c67=_[_0x4c92('0x47')](_0x10804d,_0x4c92('0x36'));}if(_0x219c67[_0x4c92('0xd')]>0x0){return manageTags(_0x536d29,_0x219c67,_0xb66ca7,_0x2eecf9,_0xd07822,_0xb8932c,_0x790070)[_0x4c92('0xc')](function(){_0x389c43(_0xd07822);});}else{_0x389c43(_0xd07822);}});};}function emit(_0x216dde,_0x12c6e3,_0x38a716){var _0x3067b6=_0x4c92('0x48')+_0x4c92('0x49')+_0x4c92('0x4a')+_0x4c92('0x4b');var _0x3429da={'uri':_0x216dde+_0x4c92('0x4c')+_0x38a716+_0x3067b6};io['to'](util[_0x4c92('0x4d')](_0x4c92('0x4e'),_0x12c6e3))[_0x4c92('0x4f')](_0x4c92('0x50'),_0x3429da);}exports['cs']=function(_0x423753,_0x558340,_0x37ff01,_0x55e471,_0x394683,_0x2da286,_0x1254e4,_0x8aedf0){var _0x37fb91={};var _0x5649da={'user':_0x2da286['username'],'pass':_0x2da286[_0x4c92('0x51')]};var _0x567233=_0x4c92('0x52');var _0x125703=_0x4c92('0x53');_0x2da286[_0x4c92('0x54')]=intUtil[_0x4c92('0x55')](_0x2da286[_0x4c92('0x54')]);_0x2da286['serverUrl']=intUtil[_0x4c92('0x55')](_0x2da286['serverUrl']);var _0x367d47=util['format'](_0x4c92('0x56'),_0x2da286[_0x4c92('0x54')]);_0x37fb91[_0x4c92('0x16')]=!_[_0x4c92('0x57')](_0x55e471)?_0x55e471['email']:null;_0x37fb91[_0x4c92('0x58')]=_0x2da286['email'];_0x37fb91['endUserNumber']=_0x8aedf0['toLowerCase']()===_0x4c92('0x59')?_0x558340['destcalleridnum']:_0x558340[_0x4c92('0x5a')];_0x37fb91[_0x4c92('0x5b')]=_0x8aedf0===_0x4c92('0x5c')||_0x8aedf0===_0x4c92('0x5d')?_0x4c92('0x5c'):_0x4c92('0x59');var _0x177b05=util[_0x4c92('0x4d')](_0x4c92('0x5e'),_0x2da286[_0x4c92('0x5f')],_0x558340[_0x4c92('0x60')],md5(_0x558340[_0x4c92('0x60')]));if(_0x394683&&_0x394683['monitor_format']){logger['info'](_0x4c92('0x61'),'Recording\x20is\x20enabled!');_0x558340[_0x4c92('0x62')]=_0x177b05;}else if(_0x1254e4&&_0x1254e4[_0x4c92('0x63')]&&_0x1254e4[_0x4c92('0x63')]!==_0x4c92('0x64')){logger[_0x4c92('0x10')](_0x4c92('0x65'),'Recording\x20is\x20enabled!');_0x558340['recordingURL']=_0x177b05;}else{_0x558340[_0x4c92('0x62')]='';}return getAdminUser(_0x8aedf0,_0x5649da,_0x37fb91,_0x367d47,_0x125703,_0x567233)[_0x4c92('0xc')](getUser(_0x8aedf0,_0x5649da,_0x367d47,_0x125703,_0x567233))[_0x4c92('0xc')](getEndUser(_0x8aedf0,_0x5649da,_0x367d47,_0x125703,_0x567233))['then'](getTicket(_0x8aedf0,_0x5649da,_0x367d47,_0x37ff01,_0x558340,_0x125703))[_0x4c92('0xc')](function(_0x2730db){logger[_0x4c92('0x10')](util[_0x4c92('0x4d')](_0x4c92('0x66'),_0x2730db['ticketId']));logger['info'](util['format'](_0x4c92('0x67'),_0x8aedf0));if(_0x8aedf0!=='unmanaged'){logger[_0x4c92('0x10')]('['+[_0x8aedf0[_0x4c92('0x11')]()]+']',_0x4c92('0x68'));emit(_0x2da286[_0x4c92('0x54')],_0x55e471[_0x4c92('0x36')],_0x2730db[_0x4c92('0x3d')]);}})['catch'](function(_0x2a74be){logger[_0x4c92('0x14')]('['+[_0x8aedf0[_0x4c92('0x11')]()]+_0x4c92('0x69'),util[_0x4c92('0x6a')](_0x2a74be,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc0c0=['ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','push','all','Tags','%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','emit','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','],\x20getAdminUser\x20crm','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','catch','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','string','picklist','type','customField','content','includes','idField','toLowerCase','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','sys_id'];(function(_0x5811b4,_0x4dee34){var _0xbc3f9e=function(_0x5661a6){while(--_0x5661a6){_0x5811b4['push'](_0x5811b4['shift']());}};_0xbc3f9e(++_0x4dee34);}(_0xc0c0,0x1de));var _0x0c0c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xc0c0[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var Promise=require(_0x0c0c('0x0'));var rp=require(_0x0c0c('0x1'));var util=require(_0x0c0c('0x2'));var md5=require(_0x0c0c('0x3'));var Redis=require(_0x0c0c('0x4'));var intUtil=require(_0x0c0c('0x5'));var config=require(_0x0c0c('0x6'));var logger=require('../../../../config/logger')(_0x0c0c('0x7'));config[_0x0c0c('0x8')]=_[_0x0c0c('0x9')](config[_0x0c0c('0x8')],{'host':_0x0c0c('0xa'),'port':0x18eb});var io=require(_0x0c0c('0xb'))(new Redis(config['redis']));function getAdminUser(_0x5b5091,_0x469731,_0x32366a,_0x4622df,_0x3fa8a2,_0x5ca8ff){return new Promise(function(_0x30beed,_0x3db551){var _0x42f396={'method':_0x0c0c('0xc'),'uri':_0x4622df+_0x0c0c('0xd')+'&'+_0x3fa8a2+'&'+_0x5ca8ff,'auth':_0x469731,'json':!![]};return rp(_0x42f396)[_0x0c0c('0xe')](function(_0x1ec515){if(_0x1ec515[_0x0c0c('0xf')][_0x0c0c('0x10')]>0x0){_0x32366a[_0x0c0c('0x11')]=_0x1ec515[_0x0c0c('0xf')][0x0]['sys_id'];}logger['info']('['+[_0x5b5091['toUpperCase']()]+_0x0c0c('0x12'),_0x32366a);_0x30beed(_0x32366a);})['catch'](function(_0x2cd33f){logger[_0x0c0c('0x13')]('['+[_0x5b5091[_0x0c0c('0x14')]()]+']',_0x2cd33f[_0x0c0c('0x15')]);_0x3db551(_0x2cd33f[_0x0c0c('0x15')]);});});}function getUser(_0x15cbf6,_0x245119,_0x5bc843,_0x5b18be,_0x411efc){return function(_0x4fe03a){logger[_0x0c0c('0x16')]('['+[_0x15cbf6[_0x0c0c('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x4fe03a);return new Promise(function(_0x2c7088,_0xcf4cb9){if(intUtil['validateEmail'](_0x4fe03a[_0x0c0c('0x17')])){var _0x2cd736={'method':_0x0c0c('0xc'),'uri':_0x5bc843+_0x0c0c('0x18')+_0x4fe03a[_0x0c0c('0x17')]+'&'+_0x5b18be+'&'+_0x411efc,'auth':_0x245119,'json':!![]};logger['info']('['+[_0x15cbf6[_0x0c0c('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x2cd736);return rp(_0x2cd736)[_0x0c0c('0xe')](function(_0x40a379){logger[_0x0c0c('0x16')]('['+[_0x15cbf6[_0x0c0c('0x14')]()]+_0x0c0c('0x19'),_0x40a379);if(_0x40a379[_0x0c0c('0xf')][_0x0c0c('0x10')]>0x0&&String(_0x40a379[_0x0c0c('0xf')][0x0][_0x0c0c('0x1a')])===_0x0c0c('0x1b')){_0x4fe03a['userId']=_0x40a379[_0x0c0c('0xf')][0x0]['sys_id'];}else{_0x4fe03a[_0x0c0c('0x1c')]=_0x4fe03a[_0x0c0c('0x11')];_0x4fe03a[_0x0c0c('0x17')]=_0x4fe03a['adminEmail'];}logger[_0x0c0c('0x16')]('['+[_0x15cbf6['toUpperCase']()]+_0x0c0c('0x1d'),_0x4fe03a);_0x2c7088(_0x4fe03a);})[_0x0c0c('0x1e')](function(_0x17ac41){logger['error']('['+[_0x15cbf6[_0x0c0c('0x14')]()]+']',_0x17ac41[_0x0c0c('0x15')]);_0xcf4cb9(_0x17ac41['message']);});}else{logger['info']('['+[_0x15cbf6[_0x0c0c('0x14')]()]+']\x20using\x20admin\x20profile');_0x4fe03a[_0x0c0c('0x1c')]=_0x4fe03a[_0x0c0c('0x11')];_0x4fe03a['userEmail']=_0x4fe03a[_0x0c0c('0x1f')];_0x2c7088(_0x4fe03a);}});};}function createEndUser(_0x3212b5,_0x426738,_0x5bba36,_0x27bba1,_0x137892){logger[_0x0c0c('0x16')]('['+[_0x3212b5['toUpperCase']()]+_0x0c0c('0x20'),_0x5bba36);return new Promise(function(_0x283175,_0x2b3ff0){var _0x20ef15={'method':'POST','uri':_0x27bba1+_0x0c0c('0x21')+_0x137892,'body':{'user_name':_0x5bba36[_0x0c0c('0x22')],'roles':_0x0c0c('0x23'),'first_name':_0x5bba36[_0x0c0c('0x22')],'active':_0x0c0c('0x1b'),'date_format':_0x0c0c('0x24'),'phone':_0x5bba36[_0x0c0c('0x22')]},'auth':_0x426738,'json':!![]};return rp(_0x20ef15)[_0x0c0c('0xe')](function(_0x5c598c){logger[_0x0c0c('0x16')]('['+[_0x3212b5['toUpperCase']()]+_0x0c0c('0x25'),_0x5c598c[_0x0c0c('0xf')]);_0x5bba36[_0x0c0c('0x26')]=_0x5c598c[_0x0c0c('0xf')]['sys_id'];_0x283175(_0x5bba36);})[_0x0c0c('0x1e')](function(_0x36f506){logger[_0x0c0c('0x13')]('['+[_0x3212b5[_0x0c0c('0x14')]()]+']',_0x36f506[_0x0c0c('0x15')]);_0x2b3ff0(_0x36f506[_0x0c0c('0x15')]);});});}function getEndUser(_0x38a8c0,_0x22d858,_0x4b20af,_0x256839,_0x2c5447){return function(_0x45cdfe){logger[_0x0c0c('0x16')]('['+[_0x38a8c0[_0x0c0c('0x14')]()]+_0x0c0c('0x27'),_0x45cdfe);return new Promise(function(_0x530319,_0x1a8b45){var _0x5cd866={'method':_0x0c0c('0xc'),'uri':_0x4b20af+_0x0c0c('0x28')+_0x45cdfe['endUserNumber']+'&'+_0x256839+'&'+_0x2c5447,'auth':_0x22d858,'json':!![]};return rp(_0x5cd866)[_0x0c0c('0xe')](function(_0x216ff2){if(_0x216ff2[_0x0c0c('0xf')][_0x0c0c('0x10')]>0x0){_0x45cdfe['endUserId']=_0x216ff2[_0x0c0c('0xf')][0x0]['sys_id'];logger[_0x0c0c('0x16')]('['+[_0x38a8c0[_0x0c0c('0x14')]()]+_0x0c0c('0x29'),_0x45cdfe);_0x530319(_0x45cdfe);}else{return createEndUser(_0x38a8c0,_0x22d858,_0x45cdfe,_0x4b20af,_0x256839)[_0x0c0c('0xe')](function(_0x516929){logger[_0x0c0c('0x16')]('['+[_0x38a8c0[_0x0c0c('0x14')]()]+'],\x20createEndUser\x20crm',_0x516929);_0x530319(_0x516929);});}})[_0x0c0c('0x1e')](function(_0x554381){logger['error']('['+[_0x38a8c0[_0x0c0c('0x14')]()]+']',_0x554381[_0x0c0c('0x15')]);_0x1a8b45(_0x554381[_0x0c0c('0x15')]);});});};}function getCustomFields(_0x24a599,_0x15b9f9){var _0x4fcf89={};if(_0x24a599[_0x0c0c('0x10')]>0x0){_[_0x0c0c('0x2a')](_0x24a599,function(_0xaaa94b){if(_['includes']([_0x0c0c('0x2b'),_0x0c0c('0x2c')],_0xaaa94b[_0x0c0c('0x2d')])&&_0xaaa94b['nameField']&&!_0xaaa94b[_0x0c0c('0x2e')]){_0x4fcf89[_0xaaa94b['nameField']['toLowerCase']()]=_0xaaa94b[_0x0c0c('0x2f')]['toString']();}else if(_[_0x0c0c('0x30')](['string',_0x0c0c('0x2c')],_0xaaa94b['type'])&&_0xaaa94b[_0x0c0c('0x31')]&&_0xaaa94b[_0x0c0c('0x2e')]){_0x4fcf89[_0xaaa94b['idField'][_0x0c0c('0x32')]()]=_0xaaa94b[_0x0c0c('0x2f')]['toString']();}else if(_0xaaa94b['type']===_0x0c0c('0x33')&&_0xaaa94b[_0x0c0c('0x34')]&&_0xaaa94b[_0x0c0c('0x31')]&&_0xaaa94b[_0x0c0c('0x2e')]){_0x4fcf89[_0xaaa94b[_0x0c0c('0x31')][_0x0c0c('0x32')]()]=_0x15b9f9[_0xaaa94b['variableName']][_0x0c0c('0x35')]();}else if(_0xaaa94b[_0x0c0c('0x2d')]===_0x0c0c('0x36')&&_0xaaa94b[_0x0c0c('0x37')]&&_0xaaa94b[_0x0c0c('0x37')][_0x0c0c('0x38')]&&_0xaaa94b[_0x0c0c('0x31')]&&_0xaaa94b['customField']){_0x4fcf89[_0xaaa94b['idField'][_0x0c0c('0x32')]()]=_0x15b9f9[_0xaaa94b[_0x0c0c('0x37')][_0x0c0c('0x38')]['toLowerCase']()][_0x0c0c('0x35')]();}});}return _0x4fcf89;}function getTicket(_0x3462ca,_0x8edc3a,_0x53d4e3,_0x1d53a4,_0x294c05,_0x24b860){return function(_0xdbb54){logger[_0x0c0c('0x16')]('['+[_0x3462ca[_0x0c0c('0x14')]()]+_0x0c0c('0x39'),_0xdbb54);return new Promise(function(_0x43dfd3,_0x31d27b){var _0x1825b2=_0x3462ca[_0x0c0c('0x32')]()==='outbound'?_0xdbb54['userId']:_0xdbb54[_0x0c0c('0x26')];var _0x1467c3={'method':_0x0c0c('0x3a'),'uri':_0x53d4e3+_0x0c0c('0x3b')+'?'+_0x24b860,'body':Object[_0x0c0c('0x3c')]({},{'active':'true','caller_id':_0x1825b2,'assigned_to':_0xdbb54[_0x0c0c('0x1c')],'short_description':intUtil[_0x0c0c('0x3d')](_0x1d53a4[_0x0c0c('0x3e')],_0x294c05,'\x20'),'description':intUtil[_0x0c0c('0x3d')](_0x1d53a4[_0x0c0c('0x3f')],_0x294c05,'\x0a')},getCustomFields(_0x1d53a4['Fields'],_0x294c05)),'auth':_0x8edc3a,'json':!![]};return rp(_0x1467c3)[_0x0c0c('0xe')](function(_0x1b58f0){logger[_0x0c0c('0x16')]('['+[_0x3462ca['toUpperCase']()]+_0x0c0c('0x40'),_0x1b58f0[_0x0c0c('0xf')]);_0xdbb54[_0x0c0c('0x41')]=_0x1b58f0[_0x0c0c('0xf')][_0x0c0c('0x42')];_0xdbb54[_0x0c0c('0x43')]=_0x1b58f0[_0x0c0c('0xf')][_0x0c0c('0x44')];logger[_0x0c0c('0x16')]('['+[_0x3462ca[_0x0c0c('0x14')]()]+_0x0c0c('0x45'),_0xdbb54);_0x43dfd3(_0xdbb54);})[_0x0c0c('0x1e')](function(_0x400737){logger[_0x0c0c('0x13')]('['+[_0x3462ca['toUpperCase']()]+']',_0x400737[_0x0c0c('0x15')]);_0x31d27b(_0x400737[_0x0c0c('0x15')]);});});};}function createRemoteTag(_0x91f910,_0x45a04c,_0x59bc2c,_0x2d370c){return new Promise(function(_0x3ac4e1,_0x526e91){var _0x1a335d={'method':_0x0c0c('0x3a'),'uri':_0x59bc2c+'label'+'?'+_0x2d370c,'body':{'short_description':_0x91f910,'global':!![],'active':!![],'name':_0x91f910},'auth':_0x45a04c,'json':!![]};return rp(_0x1a335d)[_0x0c0c('0xe')](function(_0x58655a){var _0x33a7ee=_0x58655a['result'][_0x0c0c('0x42')];_0x3ac4e1(_0x33a7ee);});});}function getRemoteTag(_0x584367,_0x1ee2da,_0x580734,_0x130522,_0x567346){return new Promise(function(_0x20d02a,_0x694c3e){var _0x27bae8={'method':_0x0c0c('0xc'),'uri':_0x580734+_0x0c0c('0x46')+'?sysparm_query=name%3D'+_0x584367+'&'+_0x130522,'auth':_0x1ee2da,'json':!![]};return rp(_0x27bae8)[_0x0c0c('0xe')](function(_0x548f16){if(_0x548f16[_0x0c0c('0xf')][_0x0c0c('0x10')]>0x0){var _0x4af661=_0x548f16[_0x0c0c('0xf')][0x0][_0x0c0c('0x42')];_0x20d02a(_0x4af661);}else{return createRemoteTag(_0x584367,_0x1ee2da,_0x580734,_0x130522)[_0x0c0c('0xe')](function(_0x2c8a5c){_0x20d02a(_0x2c8a5c);});}});});}function assignTagToIncident(_0x182828,_0x1c0f1c,_0x46f54b,_0x1db1cc,_0x2f8bf3){return new Promise(function(_0x1ff03a,_0x508ca9){var _0x1259a2={'method':_0x0c0c('0x3a'),'uri':_0x46f54b+_0x0c0c('0x47')+'?'+_0x2f8bf3,'body':{'label':_0x182828,'table':_0x0c0c('0x3b'),'id_type':_0x0c0c('0x48'),'table_key':_0x1db1cc['ticketId'],'title':'Incident\x20-\x20'+_0x1db1cc[_0x0c0c('0x43')],'id_display':_0x1db1cc[_0x0c0c('0x43')]},'auth':_0x1c0f1c,'json':!![]};return rp(_0x1259a2)[_0x0c0c('0xe')](function(_0x3eaf0c){_0x1ff03a();})[_0x0c0c('0x1e')](function(){_0x1ff03a();});});}function manageTags(_0x192839,_0x42d416,_0x339dd6,_0x2b6362,_0x5497ae,_0xfd9442,_0x19cde7){return new Promise(function(_0x3717a5,_0x39e096){var _0x24a139=[];_0x42d416[_0x0c0c('0x2a')](function(_0x347c0d){_0x24a139[_0x0c0c('0x49')](getRemoteTag(_0x347c0d,_0x339dd6,_0x2b6362,_0xfd9442,_0x19cde7));});return Promise[_0x0c0c('0x4a')](_0x24a139)[_0x0c0c('0xe')](function(_0x189829){if(_0x189829[_0x0c0c('0x10')]){logger[_0x0c0c('0x16')]('['+[_0x192839['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x189829);var _0x23de13=[];_0x189829[_0x0c0c('0x2a')](function(_0x1425b4){_0x23de13['push'](assignTagToIncident(_0x1425b4,_0x339dd6,_0x2b6362,_0x5497ae,_0xfd9442));});return Promise[_0x0c0c('0x4a')](_0x23de13)[_0x0c0c('0xe')](function(){_0x3717a5();})[_0x0c0c('0x1e')](function(){_0x3717a5();});}else{_0x3717a5();}});});}function getTags(_0x4b6446,_0x3aac60,_0x2f8397,_0x5b7716,_0x3e1464,_0x54f2ff){return function(_0x9966a){return new Promise(function(_0xffb3e6,_0x15607f){var _0x58f98f=[];var _0xd5ab73=_0x5b7716[_0x0c0c('0x4b')];if(_0xd5ab73&&_0xd5ab73[_0x0c0c('0x10')]>0x0){_0x58f98f=_['map'](_0xd5ab73,_0x0c0c('0x38'));}if(_0x58f98f[_0x0c0c('0x10')]>0x0){return manageTags(_0x4b6446,_0x58f98f,_0x3aac60,_0x2f8397,_0x9966a,_0x3e1464,_0x54f2ff)[_0x0c0c('0xe')](function(){_0xffb3e6(_0x9966a);});}else{_0xffb3e6(_0x9966a);}});};}function emit(_0x51dea8,_0x247ced,_0x42b902){var _0x18a134=_0x0c0c('0x4c')+_0x0c0c('0x4d')+_0x0c0c('0x4e')+_0x0c0c('0x4f');var _0x90dfa4={'uri':_0x51dea8+_0x0c0c('0x50')+_0x42b902+_0x18a134};io['to'](util[_0x0c0c('0x51')]('user:%s',_0x247ced))[_0x0c0c('0x52')]('trigger:browser:url',_0x90dfa4);}exports['cs']=function(_0x43d1a7,_0x28ca80,_0x4d2e45,_0x12f797,_0x94bc07,_0x408b59,_0x59d5c1,_0x55fc03){var _0x3847d5={};var _0x52be47={'user':_0x408b59[_0x0c0c('0x53')],'pass':_0x408b59[_0x0c0c('0x54')]};var _0x4a6d74=_0x0c0c('0x55');var _0xf8634f='sysparm_display_value=true';_0x408b59[_0x0c0c('0x56')]=intUtil['stripTrailingSlash'](_0x408b59[_0x0c0c('0x56')]);_0x408b59[_0x0c0c('0x57')]=intUtil[_0x0c0c('0x58')](_0x408b59[_0x0c0c('0x57')]);var _0x3d1f3a=util[_0x0c0c('0x51')](_0x0c0c('0x59'),_0x408b59[_0x0c0c('0x56')]);_0x3847d5[_0x0c0c('0x17')]=!_[_0x0c0c('0x5a')](_0x12f797)?_0x12f797[_0x0c0c('0x5b')]:null;_0x3847d5[_0x0c0c('0x1f')]=_0x408b59[_0x0c0c('0x5b')];_0x3847d5[_0x0c0c('0x22')]=_0x55fc03['toLowerCase']()===_0x0c0c('0x5c')?_0x28ca80['destcalleridnum']:_0x28ca80[_0x0c0c('0x5d')];_0x3847d5[_0x0c0c('0x5e')]=_0x55fc03===_0x0c0c('0x5f')||_0x55fc03===_0x0c0c('0x60')?_0x0c0c('0x5f'):'outbound';var _0x12ff30=util[_0x0c0c('0x51')](_0x0c0c('0x61'),_0x408b59[_0x0c0c('0x57')],_0x28ca80[_0x0c0c('0x62')],md5(_0x28ca80['uniqueid']));if(_0x94bc07&&_0x94bc07[_0x0c0c('0x63')]){logger[_0x0c0c('0x16')](_0x0c0c('0x64'),'Recording\x20is\x20enabled!');_0x28ca80[_0x0c0c('0x65')]=_0x12ff30;}else if(_0x59d5c1&&_0x59d5c1[_0x0c0c('0x66')]&&_0x59d5c1[_0x0c0c('0x66')]!==_0x0c0c('0x67')){logger['info'](_0x0c0c('0x68'),_0x0c0c('0x69'));_0x28ca80[_0x0c0c('0x65')]=_0x12ff30;}else{_0x28ca80['recordingURL']='';}return getAdminUser(_0x55fc03,_0x52be47,_0x3847d5,_0x3d1f3a,_0xf8634f,_0x4a6d74)[_0x0c0c('0xe')](getUser(_0x55fc03,_0x52be47,_0x3d1f3a,_0xf8634f,_0x4a6d74))['then'](getEndUser(_0x55fc03,_0x52be47,_0x3d1f3a,_0xf8634f,_0x4a6d74))[_0x0c0c('0xe')](getTicket(_0x55fc03,_0x52be47,_0x3d1f3a,_0x4d2e45,_0x28ca80,_0xf8634f))[_0x0c0c('0xe')](function(_0x3161e8){logger[_0x0c0c('0x16')](util[_0x0c0c('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3161e8[_0x0c0c('0x41')]));logger[_0x0c0c('0x16')](util[_0x0c0c('0x51')](_0x0c0c('0x6a'),_0x55fc03));if(_0x55fc03!==_0x0c0c('0x60')){logger[_0x0c0c('0x16')]('['+[_0x55fc03[_0x0c0c('0x14')]()]+']',_0x0c0c('0x6b'));emit(_0x408b59['remoteUri'],_0x12f797[_0x0c0c('0x38')],_0x3161e8['ticketId']);}})[_0x0c0c('0x1e')](function(_0x24ae25){logger[_0x0c0c('0x13')]('['+[_0x55fc03[_0x0c0c('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x0c0c('0x6c')](_0x24ae25,{'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 d259b81..f018594 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 _0xc115=['get_entry_list','Employees','format','entry_list','name_value_list','user_name','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','push','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','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:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','replace','duration_hours','duration_minutes','parent_type','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Basic\x20%s','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name'];(function(_0x2fe7f5,_0x3ec1db){var _0x106f34=function(_0xcdebda){while(--_0xcdebda){_0x2fe7f5['push'](_0x2fe7f5['shift']());}};_0x106f34(++_0x3ec1db);}(_0xc115,0xd4));var _0x5c11=function(_0x477824,_0x50597f){_0x477824=_0x477824-0x0;var _0x285e56=_0xc115[_0x477824];return _0x285e56;};'use strict';var _=require(_0x5c11('0x0'));var rp=require(_0x5c11('0x1'));var BPromise=require(_0x5c11('0x2'));var md5=require(_0x5c11('0x3'));var util=require('util');var Redis=require(_0x5c11('0x4'));var intUtil=require(_0x5c11('0x5'));var config=require(_0x5c11('0x6'));var logger=require(_0x5c11('0x7'))(_0x5c11('0x8'));config[_0x5c11('0x9')]=_[_0x5c11('0xa')](config[_0x5c11('0x9')],{'host':_0x5c11('0xb'),'port':0x18eb});var io=require(_0x5c11('0xc'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x2d2f9c,_0x32073a,_0x3e3bb7){io['to'](_0x2d2f9c)[_0x5c11('0xd')](_0x32073a,_0x3e3bb7);}function getTicket(_0x325e37,_0x49edb7,_0x547736,_0x750b75,_0x206f6b,_0x2b9291,_0x30e03c,_0x13e72b){logger['info']('Creating\x20new\x20ticket...');var _0x374c96=new Date();var _0x1ada3e=[{'name':_0x5c11('0xe'),'value':intUtil['getString'](_0x750b75[_0x5c11('0xf')],_0x206f6b,'\x20')},{'name':_0x5c11('0x10'),'value':_0x49edb7['id']},{'name':_0x5c11('0x11'),'value':_0x49edb7['id']},{'name':_0x5c11('0x12'),'value':intUtil[_0x5c11('0x13')](_0x750b75[_0x5c11('0x14')],_0x206f6b,'\x0a')},{'name':_0x5c11('0x15'),'value':_0x374c96['toISOString']()['slice'](0x0,0x13)[_0x5c11('0x16')]('T','\x20')},{'name':_0x5c11('0x17'),'value':'0'},{'name':_0x5c11('0x18'),'value':'15'},{'name':'parent_id','value':_0x547736['id']},{'name':_0x5c11('0x19'),'value':'Contacts'},{'name':'parent_name','value':_0x547736['name']},{'name':_0x5c11('0x1a'),'value':_0x13e72b}];if(_0x2b9291[_0x5c11('0x1b')]){_[_0x5c11('0x1c')](_0x2b9291,function(_0x1815f7){if(_0x206f6b[_0x1815f7['variableName']]){_0x1ada3e['push']({'name':_0x1815f7[_0x5c11('0x1d')],'value':_0x206f6b[_0x1815f7[_0x5c11('0x1e')]]});}});}return request({'form':{'method':_0x5c11('0x1f'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x30e03c['id'],'module_name':'Calls','name_value_list':_0x1ada3e})}});}function getAuth(_0x12e971){return util['format'](_0x5c11('0x22'),new Buffer(_0x12e971['apiKey']+':X')[_0x5c11('0x23')]('base64'));}function getServerInfo(_0x1acdf2){return request({'form':{'method':_0x5c11('0x24'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x1acdf2['id']})}});}function getUser(_0x13cc28,_0x8d97bf,_0x26a2a8){if(!_[_0x5c11('0x25')](_0x8d97bf)){logger[_0x5c11('0x26')](_0x5c11('0x27'),_0x8d97bf);return request({'form':{'method':_0x5c11('0x28'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x26a2a8['id'],'module_name':_0x5c11('0x29'),'query':util[_0x5c11('0x2a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x8d97bf),'order_by':'','offset':'0','select_fields':['id',_0x5c11('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x419e73){if(_0x419e73['entry_list'][_0x5c11('0x1b')]){var _0x24cb46=_['find'](_0x419e73[_0x5c11('0x2b')],function(_0x122b8f){return _0x122b8f[_0x5c11('0x2c')][_0x5c11('0x2d')]['value']===_0x8d97bf;});if(_0x24cb46){logger[_0x5c11('0x26')](_0x5c11('0x2e'));return BPromise['resolve']({'id':_0x24cb46[_0x5c11('0x2c')]['id'][_0x5c11('0x2f')],'name':_0x24cb46[_0x5c11('0x2c')][_0x5c11('0xe')][_0x5c11('0x2f')]});}}logger['info'](_0x5c11('0x30'));return BPromise[_0x5c11('0x31')]({'id':_0x26a2a8[_0x5c11('0x2c')]['user_id']['value'],'name':_0x26a2a8['name_value_list'][_0x5c11('0x2d')]['value']});});}else{logger[_0x5c11('0x26')](_0x5c11('0x32'));return BPromise[_0x5c11('0x31')]({'id':_0x26a2a8[_0x5c11('0x2c')][_0x5c11('0x33')][_0x5c11('0x2f')],'name':_0x26a2a8['name_value_list'][_0x5c11('0x2d')]['value']});}}function getEndUser(_0x292b48,_0x56e9f6,_0x1de3af,_0x52cb34){logger[_0x5c11('0x26')](_0x5c11('0x34'),_0x1de3af);return request({'form':{'method':_0x5c11('0x28'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x52cb34['id'],'module_name':'Contacts','query':util[_0x5c11('0x2a')](_0x5c11('0x35'),_0x1de3af),'order_by':'','offset':'0','select_fields':['id',_0x5c11('0xe'),_0x5c11('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c11('0x37')](function(_0x56ae50){if(_0x56ae50[_0x5c11('0x2b')][_0x5c11('0x1b')]){var _0x12adcc=_[_0x5c11('0x38')](_0x56ae50['entry_list'],function(_0x286bc2){return _0x286bc2['name_value_list'][_0x5c11('0x36')][_0x5c11('0x2f')]===_0x1de3af;});if(_0x12adcc){logger[_0x5c11('0x26')](_0x5c11('0x39'));return BPromise[_0x5c11('0x31')]({'id':_0x12adcc[_0x5c11('0x2c')]['id']['value'],'name':_0x12adcc[_0x5c11('0x2c')][_0x5c11('0xe')][_0x5c11('0x2f')],'phone':_0x12adcc[_0x5c11('0x2c')]['phone_home']['value']});}}else{logger['info'](_0x5c11('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x52cb34['id'],'module_name':_0x5c11('0x3b'),'name_value_list':[{'name':_0x5c11('0x3c'),'value':_0x56e9f6!==_0x5c11('0x3d')?_0x56e9f6:util[_0x5c11('0x2a')]('Caller\x20-\x20%s',_0x1de3af)},{'name':_0x5c11('0x36'),'value':_0x1de3af}]})}})[_0x5c11('0x37')](function(_0x245b82){logger[_0x5c11('0x26')]('Enduser\x20created.');return BPromise[_0x5c11('0x31')]({'id':_0x245b82['id'],'name':_0x245b82[_0x5c11('0x2b')]['first_name'][_0x5c11('0x2f')],'phone':_0x245b82[_0x5c11('0x2b')]['phone_home'][_0x5c11('0x2f')]});});}});}function request(_0x5b444d){logger[_0x5c11('0x3e')](_0x5c11('0x3f'),JSON[_0x5c11('0x21')](_0x5b444d));return rp(_[_0x5c11('0x40')](def,_0x5b444d));}function getTags(_0x458566,_0x3bd5c3){var _0x149969=[];if(_0x458566&&_0x458566[_0x5c11('0x1b')]>0x0){_0x149969=_[_0x5c11('0x41')](_0x458566,_0x3bd5c3);}return _0x149969;}function getCustomFields(_0x49e6fe,_0x30235d){var _0x357fd9=[];var _0xc41b7f={'custom_fields':[]};if(_0x49e6fe[_0x5c11('0x1b')]>0x0){_['forEach'](_0x49e6fe,function(_0x2ed77a){if(_0x2ed77a[_0x5c11('0x42')]===_0x5c11('0x43')&&_0x2ed77a[_0x5c11('0x44')]&&!_0x2ed77a[_0x5c11('0x45')]){_0xc41b7f[_0x2ed77a[_0x5c11('0x44')][_0x5c11('0x46')]()]=_0x2ed77a[_0x5c11('0x47')][_0x5c11('0x23')]();}else if(_0x2ed77a[_0x5c11('0x42')]==='string'&&_0x2ed77a[_0x5c11('0x1d')]&&_0x2ed77a[_0x5c11('0x45')]){_0xc41b7f[_0x5c11('0x48')]['push']({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x2ed77a['content']['toString']()});}else if(_0x2ed77a['type']===_0x5c11('0x49')&&_0x2ed77a[_0x5c11('0x1e')]&&_0x2ed77a[_0x5c11('0x1d')]&&_0x2ed77a[_0x5c11('0x45')]){_0x30235d[_0x2ed77a[_0x5c11('0x1e')]]&&_0xc41b7f[_0x5c11('0x48')][_0x5c11('0x4a')]({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x30235d[_0x2ed77a['variableName']][_0x5c11('0x23')]()});}else if(_0x2ed77a[_0x5c11('0x42')]===_0x5c11('0x4b')&&_0x2ed77a[_0x5c11('0x4c')]&&_0x2ed77a['Variable'][_0x5c11('0xe')]&&_0x2ed77a['idField']&&_0x2ed77a['customField']){_0x30235d[_0x2ed77a[_0x5c11('0x4c')][_0x5c11('0xe')][_0x5c11('0x46')]()]&&_0xc41b7f[_0x5c11('0x48')]['push']({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x30235d[_0x2ed77a[_0x5c11('0x4c')]['name'][_0x5c11('0x46')]()]['toString']()});}});}return _0xc41b7f;}function getConnection(_0x3f0d5){return request({'method':_0x5c11('0x4d'),'form':{'method':_0x5c11('0x4e'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'user_auth':{'user_name':_0x3f0d5[_0x5c11('0x4f')],'password':_0x3f0d5[_0x5c11('0x50')],'encryption':_0x5c11('0x51')},'application':_0x5c11('0x52')})}})[_0x5c11('0x37')](function(_0x2e46fd){var _0x348862=_0x2e46fd;if(_0x348862['id']){def[_0x5c11('0x53')]=_0x348862['id'];return BPromise['resolve'](_0x348862);}else{throw new Error(util[_0x5c11('0x2a')](_0x5c11('0x54'),_0x3f0d5['id']));}});}function setRelationship(_0x5d7de5,_0x4b7fb9,_0x3ca334,_0x761d4d){return request({'form':{'method':_0x5c11('0x55'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON['stringify']({'session':_0x5d7de5['id'],'module_name':_0x5c11('0x56'),'module_id':_0x3ca334['id'],'link_field_name':_0x761d4d,'related_ids':[_0x4b7fb9['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3b3834,_0x21da0f,_0x59372d,_0x1e74e0,_0x1dd39a,_0x195378){var _0x5273f1,_0x2b031c,_0x1f35a1,_0x19f27e;_0x195378[_0x5c11('0x57')]=intUtil[_0x5c11('0x58')](_0x195378[_0x5c11('0x57')]);_0x195378[_0x5c11('0x59')]=intUtil['stripTrailingSlash'](_0x195378[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util['format'](_0x5c11('0x5b'),_0x195378['remoteUri']);if(_0x1dd39a&&_0x1dd39a[_0x5c11('0x5c')]){logger[_0x5c11('0x26')]('[QUEUE]',_0x5c11('0x5d'));_0x21da0f[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x195378[_0x5c11('0x59')],_0x21da0f[_0x5c11('0x60')],md5(_0x21da0f[_0x5c11('0x60')]));}else{_0x21da0f[_0x5c11('0x5e')]='';}return getConnection(_0x195378)[_0x5c11('0x37')](function(_0x253211){_0x19f27e=_0x253211;return getUser(_0x195378,_0x1e74e0[_0x5c11('0xe')],_0x19f27e);})[_0x5c11('0x37')](function(_0x205503){_0x5273f1=_0x205503;logger['info'](_0x5c11('0x61'),_0x5273f1['id']);return getEndUser(_0x195378,_0x21da0f[_0x5c11('0x62')],_0x21da0f[_0x5c11('0x63')],_0x19f27e);})['then'](function(_0x2d661e){_0x2b031c=_0x2d661e;logger[_0x5c11('0x26')](_0x5c11('0x64'),_0x2b031c['id']);return getTicket(_0x195378,_0x5273f1,_0x2b031c,_0x59372d,_0x21da0f,_0x59372d[_0x5c11('0x65')],_0x19f27e,_0x5c11('0x66'));})[_0x5c11('0x37')](function(_0x89ab1d){_0x1f35a1=_0x89ab1d;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x1f35a1['id']);return setRelationship(_0x19f27e,_0x5273f1,_0x1f35a1,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x19f27e,_0x2b031c,_0x1f35a1,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x19f27e);})[_0x5c11('0x37')](function(_0x733add){var _0x8f66a5=parseInt(_0x733add[_0x5c11('0x6a')][_0x5c11('0x6b')](0x0));var _0x8caaad=util[_0x5c11('0x2a')](_0x5c11('0x6c'),_0x195378[_0x5c11('0x57')],_0x1f35a1['id']);if(_0x8f66a5>0x6){_0x8caaad=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x195378[_0x5c11('0x57')],_0x1f35a1['id']);}logger[_0x5c11('0x26')](_0x5c11('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5c11('0x6e'),_0x1e74e0[_0x5c11('0xe')]),_0x5c11('0x6f'),{'uri':_0x8caaad});})[_0x5c11('0x70')](function(_0x54e627){logger[_0x5c11('0x71')](_0x5c11('0x6d'),JSON[_0x5c11('0x21')](_0x54e627));});};exports[_0x5c11('0x72')]=function(_0x44c5bb,_0xf5e531,_0x212df0,_0x11edbe,_0x2d3088,_0x530db3,_0x43e0ff){var _0x146e4b,_0x3c04e5,_0x161a8b,_0x300142;_0x530db3[_0x5c11('0x57')]=intUtil[_0x5c11('0x58')](_0x530db3[_0x5c11('0x57')]);_0x530db3[_0x5c11('0x59')]=intUtil[_0x5c11('0x58')](_0x530db3[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util['format'](_0x5c11('0x5b'),_0x530db3[_0x5c11('0x57')]);if(_0x43e0ff&&_0x43e0ff['recordingFormat']&&_0x43e0ff[_0x5c11('0x73')]!==_0x5c11('0x74')){logger[_0x5c11('0x26')](_0x5c11('0x75'),_0x5c11('0x5d'));_0xf5e531[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x530db3[_0x5c11('0x59')],_0xf5e531[_0x5c11('0x60')],md5(_0xf5e531[_0x5c11('0x60')]));}return getConnection(_0x530db3)[_0x5c11('0x37')](function(_0x40b1e7){_0x300142=_0x40b1e7;return getUser(_0x530db3,_0x11edbe[_0x5c11('0xe')],_0x300142);})[_0x5c11('0x37')](function(_0x1268df){_0x146e4b=_0x1268df;logger[_0x5c11('0x26')](_0x5c11('0x61'),_0x146e4b['id']);return getEndUser(_0x530db3,_0xf5e531[_0x5c11('0x76')],_0xf5e531[_0x5c11('0x77')],_0x300142);})[_0x5c11('0x37')](function(_0x5b1f08){_0x3c04e5=_0x5b1f08;logger['info'](_0x5c11('0x64'),_0x3c04e5['id']);return getTicket(_0x530db3,_0x146e4b,_0x3c04e5,_0x212df0,_0xf5e531,_0x212df0[_0x5c11('0x65')],_0x300142,_0x5c11('0x78'));})['then'](function(_0x264e9f){_0x161a8b=_0x264e9f;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x161a8b['id']);return setRelationship(_0x300142,_0x146e4b,_0x161a8b,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x300142,_0x3c04e5,_0x161a8b,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x300142);})[_0x5c11('0x37')](function(_0x4da324){var _0x56192a=parseInt(_0x4da324[_0x5c11('0x6a')][_0x5c11('0x6b')](0x0));var _0xcdcbd=util['format'](_0x5c11('0x6c'),_0x530db3[_0x5c11('0x57')],_0x161a8b['id']);if(_0x56192a>0x6){_0xcdcbd=util['format'](_0x5c11('0x79'),_0x530db3[_0x5c11('0x57')],_0x161a8b['id']);}logger[_0x5c11('0x26')]('[OUTBOUND]',_0x5c11('0x7a'));emit(util['format'](_0x5c11('0x6e'),_0x11edbe[_0x5c11('0xe')]),_0x5c11('0x6f'),{'uri':_0xcdcbd});})['catch'](function(_0x21d4cb){logger[_0x5c11('0x71')](_0x5c11('0x75'),JSON['stringify'](_0x21d4cb));});};exports[_0x5c11('0x7b')]=function(_0x16bc65,_0x1c6fff,_0x29cfe4,_0x243d41,_0x1f3fd1,_0x441561){var _0x3ec9b1,_0x75bfac,_0x2752d8,_0x1ca859;_0x441561['remoteUri']=intUtil[_0x5c11('0x58')](_0x441561[_0x5c11('0x57')]);_0x441561['serverUrl']=intUtil[_0x5c11('0x58')](_0x441561[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util[_0x5c11('0x2a')](_0x5c11('0x5b'),_0x441561[_0x5c11('0x57')]);if(_0x1f3fd1&&_0x1f3fd1[_0x5c11('0x5c')]){logger['info']('['+_0x1c6fff[_0x5c11('0x7c')][_0x5c11('0x7d')]()+']',_0x5c11('0x5d'));_0x1c6fff[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x441561['serverUrl'],_0x1c6fff[_0x5c11('0x60')],md5(_0x1c6fff[_0x5c11('0x60')]));}else{_0x1c6fff['recordingURL']='';}return getConnection(_0x441561)[_0x5c11('0x37')](function(_0x53ced2){_0x1ca859=_0x53ced2;if(!_['isNil'](_0x243d41)){return getUser(_0x441561,_0x243d41['name'],_0x1ca859);}else{return getUser(_0x441561,null,_0x1ca859);}})[_0x5c11('0x37')](function(_0x255f22){_0x3ec9b1=_0x255f22;logger[_0x5c11('0x26')](_0x5c11('0x61'),_0x3ec9b1['id']);return getEndUser(_0x441561,_0x1c6fff[_0x5c11('0x62')],_0x1c6fff[_0x5c11('0x63')],_0x1ca859);})['then'](function(_0x3fe0b3){_0x75bfac=_0x3fe0b3;logger[_0x5c11('0x26')](_0x5c11('0x64'),_0x75bfac['id']);return getTicket(_0x441561,_0x3ec9b1,_0x75bfac,_0x29cfe4,_0x1c6fff,_0x29cfe4[_0x5c11('0x65')],_0x1ca859,_0x5c11('0x66'));})[_0x5c11('0x37')](function(_0x20269e){_0x2752d8=_0x20269e;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x2752d8['id']);return setRelationship(_0x1ca859,_0x3ec9b1,_0x2752d8,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x1ca859,_0x75bfac,_0x2752d8,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x1ca859);})['catch'](function(_0x56f684){logger[_0x5c11('0x71')]('['+_0x1c6fff[_0x5c11('0x7c')][_0x5c11('0x7d')]()+']',JSON[_0x5c11('0x21')](_0x56f684));});}; \ No newline at end of file +var _0xa50e=['monitor_format','[QUEUE]','uniqueid','recordingURL','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','request-promise','bluebird','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','push','idField','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','toString','base64','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','string','customField','nameField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php'];(function(_0x1ddb7b,_0x333bd0){var _0x271230=function(_0x342914){while(--_0x342914){_0x1ddb7b['push'](_0x1ddb7b['shift']());}};_0x271230(++_0x333bd0);}(_0xa50e,0x96));var _0xea50=function(_0x5e2e19,_0x2d6637){_0x5e2e19=_0x5e2e19-0x0;var _0x4424c8=_0xa50e[_0x5e2e19];return _0x4424c8;};'use strict';var _=require('lodash');var rp=require(_0xea50('0x0'));var BPromise=require(_0xea50('0x1'));var md5=require('md5');var util=require(_0xea50('0x2'));var Redis=require(_0xea50('0x3'));var intUtil=require(_0xea50('0x4'));var config=require('../../../../config/environment');var logger=require(_0xea50('0x5'))(_0xea50('0x6'));config[_0xea50('0x7')]=_[_0xea50('0x8')](config[_0xea50('0x7')],{'host':_0xea50('0x9'),'port':0x18eb});var io=require(_0xea50('0xa'))(new Redis(config[_0xea50('0x7')]));var def={'method':_0xea50('0xb'),'json':!![]};function emit(_0x1dade2,_0x27b123,_0x313bff){io['to'](_0x1dade2)[_0xea50('0xc')](_0x27b123,_0x313bff);}function getTicket(_0x2ae17c,_0x3cef8a,_0x59ad47,_0x3d466b,_0x470ce3,_0x26132d,_0x5a680a,_0x4bf935){logger[_0xea50('0xd')](_0xea50('0xe'));var _0x127651=new Date();var _0x3e1142=[{'name':_0xea50('0xf'),'value':intUtil[_0xea50('0x10')](_0x3d466b[_0xea50('0x11')],_0x470ce3,'\x20')},{'name':_0xea50('0x12'),'value':_0x3cef8a['id']},{'name':'created_by','value':_0x3cef8a['id']},{'name':_0xea50('0x13'),'value':intUtil[_0xea50('0x10')](_0x3d466b['Descriptions'],_0x470ce3,'\x0a')},{'name':_0xea50('0x14'),'value':_0x127651[_0xea50('0x15')]()[_0xea50('0x16')](0x0,0x13)[_0xea50('0x17')]('T','\x20')},{'name':_0xea50('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xea50('0x19'),'value':_0x59ad47['id']},{'name':_0xea50('0x1a'),'value':_0xea50('0x1b')},{'name':_0xea50('0x1c'),'value':_0x59ad47[_0xea50('0xf')]},{'name':_0xea50('0x1d'),'value':_0x4bf935}];if(_0x26132d['length']){_['forEach'](_0x26132d,function(_0x4fae0c){if(_0x470ce3[_0x4fae0c['variableName']]){_0x3e1142[_0xea50('0x1e')]({'name':_0x4fae0c[_0xea50('0x1f')],'value':_0x470ce3[_0x4fae0c[_0xea50('0x20')]]});}});}return request({'form':{'method':_0xea50('0x21'),'input_type':_0xea50('0x22'),'response_type':_0xea50('0x22'),'rest_data':JSON[_0xea50('0x23')]({'session':_0x5a680a['id'],'module_name':_0xea50('0x24'),'name_value_list':_0x3e1142})}});}function getAuth(_0x3df8cf){return util['format'](_0xea50('0x25'),new Buffer(_0x3df8cf['apiKey']+':X')[_0xea50('0x26')](_0xea50('0x27')));}function getServerInfo(_0x235bf4){return request({'form':{'method':'get_server_info','input_type':_0xea50('0x22'),'response_type':_0xea50('0x22'),'rest_data':JSON['stringify']({'session':_0x235bf4['id']})}});}function getUser(_0x229d7c,_0x451ba7,_0x41ee0e){if(!_[_0xea50('0x28')](_0x451ba7)){logger['info'](_0xea50('0x29'),_0x451ba7);return request({'form':{'method':'get_entry_list','input_type':_0xea50('0x22'),'response_type':_0xea50('0x22'),'rest_data':JSON['stringify']({'session':_0x41ee0e['id'],'module_name':_0xea50('0x2a'),'query':util[_0xea50('0x2b')](_0xea50('0x2c'),_0x451ba7),'order_by':'','offset':'0','select_fields':['id','name',_0xea50('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x543edf){if(_0x543edf[_0xea50('0x2e')][_0xea50('0x2f')]){var _0x1d6cd1=_[_0xea50('0x30')](_0x543edf[_0xea50('0x2e')],function(_0x8a12b7){return _0x8a12b7[_0xea50('0x31')]['user_name'][_0xea50('0x32')]===_0x451ba7;});if(_0x1d6cd1){logger[_0xea50('0xd')](_0xea50('0x33'));return BPromise[_0xea50('0x34')]({'id':_0x1d6cd1[_0xea50('0x31')]['id']['value'],'name':_0x1d6cd1[_0xea50('0x31')]['name']['value']});}}logger[_0xea50('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xea50('0x34')]({'id':_0x41ee0e[_0xea50('0x31')]['user_id'][_0xea50('0x32')],'name':_0x41ee0e['name_value_list'][_0xea50('0x2d')][_0xea50('0x32')]});});}else{logger[_0xea50('0xd')](_0xea50('0x35'));return BPromise['resolve']({'id':_0x41ee0e[_0xea50('0x31')]['user_id'][_0xea50('0x32')],'name':_0x41ee0e[_0xea50('0x31')][_0xea50('0x2d')]['value']});}}function getEndUser(_0x3fa8c9,_0x1627f1,_0x2dc0bc,_0x40e714){logger[_0xea50('0xd')]('Searching\x20enduser\x20with\x20phone',_0x2dc0bc);return request({'form':{'method':_0xea50('0x36'),'input_type':'JSON','response_type':_0xea50('0x22'),'rest_data':JSON['stringify']({'session':_0x40e714['id'],'module_name':'Contacts','query':util[_0xea50('0x2b')](_0xea50('0x37'),_0x2dc0bc),'order_by':'','offset':'0','select_fields':['id',_0xea50('0xf'),_0xea50('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xea50('0x39')](function(_0xcd3165){if(_0xcd3165['entry_list'][_0xea50('0x2f')]){var _0x12bc55=_[_0xea50('0x30')](_0xcd3165[_0xea50('0x2e')],function(_0x1e9d16){return _0x1e9d16[_0xea50('0x31')][_0xea50('0x38')][_0xea50('0x32')]===_0x2dc0bc;});if(_0x12bc55){logger[_0xea50('0xd')](_0xea50('0x3a'));return BPromise[_0xea50('0x34')]({'id':_0x12bc55[_0xea50('0x31')]['id'][_0xea50('0x32')],'name':_0x12bc55[_0xea50('0x31')][_0xea50('0xf')][_0xea50('0x32')],'phone':_0x12bc55[_0xea50('0x31')][_0xea50('0x38')][_0xea50('0x32')]});}}else{logger['info'](_0xea50('0x3b'));return request({'form':{'method':'set_entry','input_type':_0xea50('0x22'),'response_type':_0xea50('0x22'),'rest_data':JSON[_0xea50('0x23')]({'session':_0x40e714['id'],'module_name':_0xea50('0x1b'),'name_value_list':[{'name':'first_name','value':_0x1627f1!==_0xea50('0x3c')?_0x1627f1:util[_0xea50('0x2b')]('Caller\x20-\x20%s',_0x2dc0bc)},{'name':_0xea50('0x38'),'value':_0x2dc0bc}]})}})['then'](function(_0x54cb88){logger[_0xea50('0xd')](_0xea50('0x3d'));return BPromise['resolve']({'id':_0x54cb88['id'],'name':_0x54cb88[_0xea50('0x2e')][_0xea50('0x3e')]['value'],'phone':_0x54cb88[_0xea50('0x2e')][_0xea50('0x38')][_0xea50('0x32')]});});}});}function request(_0x1507b1){logger[_0xea50('0x3f')](_0xea50('0x40'),JSON[_0xea50('0x23')](_0x1507b1));return rp(_[_0xea50('0x41')](def,_0x1507b1));}function getTags(_0x3fb71c,_0x2a7184){var _0x3c06e3=[];if(_0x3fb71c&&_0x3fb71c[_0xea50('0x2f')]>0x0){_0x3c06e3=_[_0xea50('0x42')](_0x3fb71c,_0x2a7184);}return _0x3c06e3;}function getCustomFields(_0x280fc9,_0x31c0cf){var _0x186cc4=[];var _0x364eed={'custom_fields':[]};if(_0x280fc9[_0xea50('0x2f')]>0x0){_[_0xea50('0x43')](_0x280fc9,function(_0x28e9f8){if(_0x28e9f8[_0xea50('0x44')]===_0xea50('0x45')&&_0x28e9f8['nameField']&&!_0x28e9f8[_0xea50('0x46')]){_0x364eed[_0x28e9f8[_0xea50('0x47')][_0xea50('0x48')]()]=_0x28e9f8['content'][_0xea50('0x26')]();}else if(_0x28e9f8[_0xea50('0x44')]===_0xea50('0x45')&&_0x28e9f8[_0xea50('0x1f')]&&_0x28e9f8[_0xea50('0x46')]){_0x364eed[_0xea50('0x49')]['push']({'id':_0x28e9f8[_0xea50('0x1f')],'value':_0x28e9f8[_0xea50('0x4a')][_0xea50('0x26')]()});}else if(_0x28e9f8[_0xea50('0x44')]===_0xea50('0x4b')&&_0x28e9f8[_0xea50('0x20')]&&_0x28e9f8[_0xea50('0x1f')]&&_0x28e9f8[_0xea50('0x46')]){_0x31c0cf[_0x28e9f8[_0xea50('0x20')]]&&_0x364eed[_0xea50('0x49')][_0xea50('0x1e')]({'id':_0x28e9f8[_0xea50('0x1f')],'value':_0x31c0cf[_0x28e9f8['variableName']]['toString']()});}else if(_0x28e9f8[_0xea50('0x44')]===_0xea50('0x4c')&&_0x28e9f8[_0xea50('0x4d')]&&_0x28e9f8[_0xea50('0x4d')][_0xea50('0xf')]&&_0x28e9f8['idField']&&_0x28e9f8[_0xea50('0x46')]){_0x31c0cf[_0x28e9f8[_0xea50('0x4d')][_0xea50('0xf')]['toLowerCase']()]&&_0x364eed[_0xea50('0x49')][_0xea50('0x1e')]({'id':_0x28e9f8[_0xea50('0x1f')],'value':_0x31c0cf[_0x28e9f8[_0xea50('0x4d')][_0xea50('0xf')][_0xea50('0x48')]()][_0xea50('0x26')]()});}});}return _0x364eed;}function getConnection(_0x51b996){return request({'method':_0xea50('0xb'),'form':{'method':_0xea50('0x4e'),'input_type':_0xea50('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x51b996[_0xea50('0x4f')],'password':_0x51b996[_0xea50('0x50')],'encryption':_0xea50('0x51')},'application':_0xea50('0x52')})}})['then'](function(_0x12ebfb){var _0x57e530=_0x12ebfb;if(_0x57e530['id']){def[_0xea50('0x53')]=_0x57e530['id'];return BPromise[_0xea50('0x34')](_0x57e530);}else{throw new Error(util[_0xea50('0x2b')](_0xea50('0x54'),_0x51b996['id']));}});}function setRelationship(_0x5dac64,_0x280715,_0x1c3f75,_0x318047){return request({'form':{'method':_0xea50('0x55'),'input_type':_0xea50('0x22'),'response_type':_0xea50('0x22'),'rest_data':JSON[_0xea50('0x23')]({'session':_0x5dac64['id'],'module_name':_0xea50('0x24'),'module_id':_0x1c3f75['id'],'link_field_name':_0x318047,'related_ids':[_0x280715['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xea50('0x56')]=function(_0x5940c5,_0x37ea2b,_0x31ffbd,_0x1f833d,_0x4c867d,_0x350c99){var _0x23a525,_0x2e53eb,_0x425da8,_0x513a71;_0x350c99[_0xea50('0x57')]=intUtil[_0xea50('0x58')](_0x350c99[_0xea50('0x57')]);_0x350c99[_0xea50('0x59')]=intUtil['stripTrailingSlash'](_0x350c99[_0xea50('0x59')]);def[_0xea50('0x5a')]=util[_0xea50('0x2b')](_0xea50('0x5b'),_0x350c99['remoteUri']);if(_0x4c867d&&_0x4c867d[_0xea50('0x5c')]){logger[_0xea50('0xd')](_0xea50('0x5d'),'Recording\x20is\x20enabled!');_0x37ea2b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x350c99[_0xea50('0x59')],_0x37ea2b[_0xea50('0x5e')],md5(_0x37ea2b[_0xea50('0x5e')]));}else{_0x37ea2b[_0xea50('0x5f')]='';}return getConnection(_0x350c99)['then'](function(_0x2b75dd){_0x513a71=_0x2b75dd;return getUser(_0x350c99,_0x1f833d[_0xea50('0xf')],_0x513a71);})[_0xea50('0x39')](function(_0x334bfd){_0x23a525=_0x334bfd;logger[_0xea50('0xd')]('The\x20User\x20ID\x20is:',_0x23a525['id']);return getEndUser(_0x350c99,_0x37ea2b[_0xea50('0x60')],_0x37ea2b[_0xea50('0x61')],_0x513a71);})[_0xea50('0x39')](function(_0x449eb4){_0x2e53eb=_0x449eb4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2e53eb['id']);return getTicket(_0x350c99,_0x23a525,_0x2e53eb,_0x31ffbd,_0x37ea2b,_0x31ffbd['Fields'],_0x513a71,'Inbound');})['then'](function(_0x187d2a){_0x425da8=_0x187d2a;logger[_0xea50('0xd')](_0xea50('0x62'));logger[_0xea50('0xd')](_0xea50('0x63'),_0x425da8['id']);return setRelationship(_0x513a71,_0x23a525,_0x425da8,_0xea50('0x64'));})[_0xea50('0x39')](function(){return setRelationship(_0x513a71,_0x2e53eb,_0x425da8,_0xea50('0x65'));})[_0xea50('0x39')](function(){return getServerInfo(_0x513a71);})[_0xea50('0x39')](function(_0x45e125){var _0x1df248=parseInt(_0x45e125[_0xea50('0x66')]['charAt'](0x0));var _0x17d1e8=util[_0xea50('0x2b')](_0xea50('0x67'),_0x350c99[_0xea50('0x57')],_0x425da8['id']);if(_0x1df248>0x6){_0x17d1e8=util[_0xea50('0x2b')](_0xea50('0x68'),_0x350c99[_0xea50('0x57')],_0x425da8['id']);}logger[_0xea50('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1f833d['name']),_0xea50('0x69'),{'uri':_0x17d1e8});})[_0xea50('0x6a')](function(_0x145f67){logger[_0xea50('0x6b')]('[QUEUE]',JSON[_0xea50('0x23')](_0x145f67));});};exports[_0xea50('0x6c')]=function(_0x53bf79,_0x158bf9,_0x32d0c1,_0x3e5f15,_0x3914b2,_0x465dc7,_0x3ef20c){var _0x312f5b,_0x193436,_0x3a3a94,_0x2bbc92;_0x465dc7[_0xea50('0x57')]=intUtil['stripTrailingSlash'](_0x465dc7[_0xea50('0x57')]);_0x465dc7[_0xea50('0x59')]=intUtil[_0xea50('0x58')](_0x465dc7[_0xea50('0x59')]);def[_0xea50('0x5a')]=util[_0xea50('0x2b')](_0xea50('0x5b'),_0x465dc7['remoteUri']);if(_0x3ef20c&&_0x3ef20c[_0xea50('0x6d')]&&_0x3ef20c[_0xea50('0x6d')]!==_0xea50('0x6e')){logger['info'](_0xea50('0x6f'),'Recording\x20is\x20enabled!');_0x158bf9[_0xea50('0x5f')]=util['format'](_0xea50('0x70'),_0x465dc7[_0xea50('0x59')],_0x158bf9['uniqueid'],md5(_0x158bf9[_0xea50('0x5e')]));}return getConnection(_0x465dc7)[_0xea50('0x39')](function(_0x3c446b){_0x2bbc92=_0x3c446b;return getUser(_0x465dc7,_0x3e5f15[_0xea50('0xf')],_0x2bbc92);})[_0xea50('0x39')](function(_0x2aebeb){_0x312f5b=_0x2aebeb;logger[_0xea50('0xd')](_0xea50('0x71'),_0x312f5b['id']);return getEndUser(_0x465dc7,_0x158bf9['destcalleridname'],_0x158bf9[_0xea50('0x72')],_0x2bbc92);})[_0xea50('0x39')](function(_0x56196c){_0x193436=_0x56196c;logger[_0xea50('0xd')](_0xea50('0x73'),_0x193436['id']);return getTicket(_0x465dc7,_0x312f5b,_0x193436,_0x32d0c1,_0x158bf9,_0x32d0c1[_0xea50('0x74')],_0x2bbc92,_0xea50('0x75'));})[_0xea50('0x39')](function(_0x58f905){_0x3a3a94=_0x58f905;logger[_0xea50('0xd')](_0xea50('0x62'));logger[_0xea50('0xd')](_0xea50('0x63'),_0x3a3a94['id']);return setRelationship(_0x2bbc92,_0x312f5b,_0x3a3a94,_0xea50('0x64'));})[_0xea50('0x39')](function(){return setRelationship(_0x2bbc92,_0x193436,_0x3a3a94,'contacts');})[_0xea50('0x39')](function(){return getServerInfo(_0x2bbc92);})['then'](function(_0x562a0c){var _0x5a5264=parseInt(_0x562a0c[_0xea50('0x66')][_0xea50('0x76')](0x0));var _0x4ccd28=util[_0xea50('0x2b')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x465dc7['remoteUri'],_0x3a3a94['id']);if(_0x5a5264>0x6){_0x4ccd28=util[_0xea50('0x2b')](_0xea50('0x68'),_0x465dc7[_0xea50('0x57')],_0x3a3a94['id']);}logger[_0xea50('0xd')](_0xea50('0x6f'),_0xea50('0x77'));emit(util[_0xea50('0x2b')]('user:%s',_0x3e5f15[_0xea50('0xf')]),'trigger:browser:url',{'uri':_0x4ccd28});})[_0xea50('0x6a')](function(_0x211fa9){logger[_0xea50('0x6b')](_0xea50('0x6f'),JSON['stringify'](_0x211fa9));});};exports['unmanaged']=function(_0x300e38,_0x487910,_0x315146,_0x4b2a9f,_0x562710,_0x4aec11){var _0x497b3a,_0x48909a,_0x314758,_0x4152a4;_0x4aec11[_0xea50('0x57')]=intUtil[_0xea50('0x58')](_0x4aec11[_0xea50('0x57')]);_0x4aec11[_0xea50('0x59')]=intUtil[_0xea50('0x58')](_0x4aec11[_0xea50('0x59')]);def[_0xea50('0x5a')]=util[_0xea50('0x2b')](_0xea50('0x5b'),_0x4aec11[_0xea50('0x57')]);if(_0x562710&&_0x562710[_0xea50('0x5c')]){logger[_0xea50('0xd')]('['+_0x487910['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x487910['recordingURL']=util[_0xea50('0x2b')](_0xea50('0x70'),_0x4aec11['serverUrl'],_0x487910[_0xea50('0x5e')],md5(_0x487910['uniqueid']));}else{_0x487910[_0xea50('0x5f')]='';}return getConnection(_0x4aec11)[_0xea50('0x39')](function(_0x1f34c0){_0x4152a4=_0x1f34c0;if(!_['isNil'](_0x4b2a9f)){return getUser(_0x4aec11,_0x4b2a9f[_0xea50('0xf')],_0x4152a4);}else{return getUser(_0x4aec11,null,_0x4152a4);}})['then'](function(_0x377085){_0x497b3a=_0x377085;logger[_0xea50('0xd')](_0xea50('0x71'),_0x497b3a['id']);return getEndUser(_0x4aec11,_0x487910[_0xea50('0x60')],_0x487910[_0xea50('0x61')],_0x4152a4);})[_0xea50('0x39')](function(_0x38f396){_0x48909a=_0x38f396;logger['info'](_0xea50('0x73'),_0x48909a['id']);return getTicket(_0x4aec11,_0x497b3a,_0x48909a,_0x315146,_0x487910,_0x315146['Fields'],_0x4152a4,'Inbound');})[_0xea50('0x39')](function(_0x1cec62){_0x314758=_0x1cec62;logger['info'](_0xea50('0x62'));logger[_0xea50('0xd')]('The\x20Ticket\x20ID\x20is:',_0x314758['id']);return setRelationship(_0x4152a4,_0x497b3a,_0x314758,_0xea50('0x64'));})['then'](function(){return setRelationship(_0x4152a4,_0x48909a,_0x314758,'contacts');})['then'](function(){return getServerInfo(_0x4152a4);})['catch'](function(_0xaf690d){logger[_0xea50('0x6b')]('['+_0x487910['lastevent'][_0xea50('0x78')]()+']',JSON[_0xea50('0x23')](_0xaf690d));});}; \ 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 03739d6..4553cee 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 _0xc030=['string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type'];(function(_0x41cf15,_0x3fe936){var _0x12e427=function(_0x18534c){while(--_0x18534c){_0x41cf15['push'](_0x41cf15['shift']());}};_0x12e427(++_0x3fe936);}(_0xc030,0x180));var _0x0c03=function(_0x411064,_0x5ce362){_0x411064=_0x411064-0x0;var _0x26cc42=_0xc030[_0x411064];return _0x26cc42;};'use strict';var _=require(_0x0c03('0x0'));var util=require(_0x0c03('0x1'));exports[_0x0c03('0x2')]=function(_0x475818,_0x3a1afe,_0x4afa8b){var _0x3f874b=[];if(_0x475818[_0x0c03('0x3')]>0x0){var _0x3e8c42=_[_0x0c03('0x4')](_0x475818,['id']);for(var _0x4a975e=0x0;_0x4a975e<_0x3e8c42[_0x0c03('0x3')];_0x4a975e++){var _0x2a4f9f=_0x3e8c42[_0x4a975e];if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x6')){_0x3f874b[_0x0c03('0x7')](_0x2a4f9f[_0x0c03('0x8')]);}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x9')&&_0x2a4f9f[_0x0c03('0xa')]){_0x3a1afe[_0x2a4f9f['variableName']]&&_0x3f874b[_0x0c03('0x7')](_0x3a1afe[_0x2a4f9f[_0x0c03('0xa')]][_0x0c03('0xb')]());}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0xc')&&_0x2a4f9f[_0x0c03('0xd')]&&_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')]){_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()]&&_0x3f874b[_0x0c03('0x7')](_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()][_0x0c03('0xb')]());}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x10')){if(_0x2a4f9f[_0x0c03('0x11')]===_0x0c03('0x6')&&_0x2a4f9f[_0x0c03('0x12')]){_0x3f874b[_0x0c03('0x7')](util[_0x0c03('0x13')]('%s:\x20%s',_0x2a4f9f[_0x0c03('0x12')],_0x2a4f9f[_0x0c03('0x14')]));}else if(_0x2a4f9f[_0x0c03('0x11')]==='variable'&&_0x2a4f9f[_0x0c03('0xa')]&&_0x2a4f9f[_0x0c03('0x12')]){_0x3a1afe[_0x2a4f9f['variableName']]&&_0x3f874b[_0x0c03('0x7')](util['format'](_0x0c03('0x15'),_0x2a4f9f[_0x0c03('0x12')],_0x3a1afe[_0x2a4f9f[_0x0c03('0xa')]]));}else if(_0x2a4f9f[_0x0c03('0x11')]===_0x0c03('0xc')&&_0x2a4f9f[_0x0c03('0xd')]&&_0x2a4f9f[_0x0c03('0xd')]['name']&&_0x2a4f9f[_0x0c03('0x12')]){_0x3a1afe[_0x2a4f9f['Variable'][_0x0c03('0xe')]['toLowerCase']()]&&_0x3f874b[_0x0c03('0x7')](util[_0x0c03('0x13')](_0x0c03('0x15'),_0x2a4f9f[_0x0c03('0x12')],_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()]));}}}}return _0x3f874b[_0x0c03('0x16')](_0x4afa8b);};exports[_0x0c03('0x17')]=function(_0x13ae45){var _0x166343=_0x13ae45[_0x0c03('0x18')](-0x1);if(_0x166343==='/'){_0x13ae45=_0x13ae45[_0x0c03('0x19')](0x0,_0x13ae45[_0x0c03('0x1a')](_0x166343));}return _0x13ae45;};exports[_0x0c03('0x1b')]=function(_0x2767f0){if(!_[_0x0c03('0x1c')](_0x2767f0)&&_0x2767f0!==''){var _0x410441=/^(([^<>()\[\]\\.,;:\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 _0x410441[_0x0c03('0x1d')](String(_0x2767f0)[_0x0c03('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x960a=['push','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent'];(function(_0x394739,_0x19ce1e){var _0x48d11e=function(_0x570c40){while(--_0x570c40){_0x394739['push'](_0x394739['shift']());}};_0x48d11e(++_0x19ce1e);}(_0x960a,0x158));var _0xa960=function(_0x3bdc60,_0x1097ed){_0x3bdc60=_0x3bdc60-0x0;var _0x3358a3=_0x960a[_0x3bdc60];return _0x3358a3;};'use strict';var _=require(_0xa960('0x0'));var util=require(_0xa960('0x1'));exports[_0xa960('0x2')]=function(_0x4e3d9d,_0x218f8b,_0xffcf9e){var _0x2d98d8=[];if(_0x4e3d9d[_0xa960('0x3')]>0x0){var _0x2fd743=_[_0xa960('0x4')](_0x4e3d9d,['id']);for(var _0x3308c3=0x0;_0x3308c3<_0x2fd743[_0xa960('0x3')];_0x3308c3++){var _0xe342c2=_0x2fd743[_0x3308c3];if(_0xe342c2['type']===_0xa960('0x5')){_0x2d98d8['push'](_0xe342c2['content']);}else if(_0xe342c2[_0xa960('0x6')]===_0xa960('0x7')&&_0xe342c2[_0xa960('0x8')]){_0x218f8b[_0xe342c2[_0xa960('0x8')]]&&_0x2d98d8['push'](_0x218f8b[_0xe342c2[_0xa960('0x8')]][_0xa960('0x9')]());}else if(_0xe342c2[_0xa960('0x6')]===_0xa960('0xa')&&_0xe342c2[_0xa960('0xb')]&&_0xe342c2[_0xa960('0xb')][_0xa960('0xc')]){_0x218f8b[_0xe342c2[_0xa960('0xb')][_0xa960('0xc')]['toLowerCase']()]&&_0x2d98d8['push'](_0x218f8b[_0xe342c2[_0xa960('0xb')][_0xa960('0xc')][_0xa960('0xd')]()]['toString']());}else if(_0xe342c2['type']===_0xa960('0xe')){if(_0xe342c2[_0xa960('0xf')]===_0xa960('0x5')&&_0xe342c2['key']){_0x2d98d8['push'](util[_0xa960('0x10')](_0xa960('0x11'),_0xe342c2[_0xa960('0x12')],_0xe342c2[_0xa960('0x13')]));}else if(_0xe342c2[_0xa960('0xf')]==='variable'&&_0xe342c2[_0xa960('0x8')]&&_0xe342c2['key']){_0x218f8b[_0xe342c2[_0xa960('0x8')]]&&_0x2d98d8[_0xa960('0x14')](util[_0xa960('0x10')](_0xa960('0x11'),_0xe342c2[_0xa960('0x12')],_0x218f8b[_0xe342c2[_0xa960('0x8')]]));}else if(_0xe342c2[_0xa960('0xf')]===_0xa960('0xa')&&_0xe342c2[_0xa960('0xb')]&&_0xe342c2[_0xa960('0xb')][_0xa960('0xc')]&&_0xe342c2[_0xa960('0x12')]){_0x218f8b[_0xe342c2[_0xa960('0xb')]['name'][_0xa960('0xd')]()]&&_0x2d98d8[_0xa960('0x14')](util[_0xa960('0x10')](_0xa960('0x11'),_0xe342c2['key'],_0x218f8b[_0xe342c2[_0xa960('0xb')][_0xa960('0xc')]['toLowerCase']()]));}}}}return _0x2d98d8[_0xa960('0x15')](_0xffcf9e);};exports[_0xa960('0x16')]=function(_0x11cd08){var _0x2e9ca8=_0x11cd08[_0xa960('0x17')](-0x1);if(_0x2e9ca8==='/'){_0x11cd08=_0x11cd08['substring'](0x0,_0x11cd08[_0xa960('0x18')](_0x2e9ca8));}return _0x11cd08;};exports[_0xa960('0x19')]=function(_0x585a82){if(!_[_0xa960('0x1a')](_0x585a82)&&_0x585a82!==''){var _0x2a70aa=/^(([^<>()\[\]\\.,;:\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 _0x2a70aa[_0xa960('0x1b')](String(_0x585a82)[_0xa960('0xd')]());}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 c2bbc5a..66fc234 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','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]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 312e65d..134c7cf 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 _0x4b0a=['picklist','nameField','customField','toLowerCase','content','type','idField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','The\x20User\x20ID\x20is:','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/logger','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','results','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','string'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0x4b0a,0xa1));var _0xa4b0=function(_0x543544,_0x282b66){_0x543544=_0x543544-0x0;var _0x19f200=_0x4b0a[_0x543544];return _0x19f200;};'use strict';var _=require(_0xa4b0('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa4b0('0x1'));var Redis=require(_0xa4b0('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa4b0('0x3'))('zendesk');config['redis']=_['defaults'](config[_0xa4b0('0x4')],{'host':_0xa4b0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4b0('0x4')]));function emit(_0x7ded08,_0x3c67ee,_0x119d27){io['to'](_0x7ded08)[_0xa4b0('0x6')](_0x3c67ee,_0x119d27);}var headers={'Content-Type':_0xa4b0('0x7'),'Accept':_0xa4b0('0x7')};function getTicket(_0x23691d,_0x43a794,_0x3b99bd,_0x15a94d,_0x4d3827){logger[_0xa4b0('0x8')](_0xa4b0('0x9'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0xb'),_0x23691d[_0xa4b0('0xc')]),'method':_0xa4b0('0xd'),'body':{'ticket':_[_0xa4b0('0xe')]({'requester_id':_0x3b99bd['id'],'submitter_id':_0x43a794?_0x43a794['id']:undefined,'assignee_id':_0x43a794?_0x43a794['id']:undefined,'tags':getTags(_0x15a94d['Tags'],_0xa4b0('0xf')),'subject':intUtil['getString'](_0x15a94d['Subjects'],_0x4d3827,'\x20'),'description':intUtil['getString'](_0x15a94d[_0xa4b0('0x10')],_0x4d3827,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x15a94d[_0xa4b0('0x10')],_0x4d3827,'\x0a')}},getCustomFields(_0x15a94d[_0xa4b0('0x11')],_0x4d3827))}})[_0xa4b0('0x12')](function(_0x69c484){logger[_0xa4b0('0x8')]('Ticket\x20created!');return _0x69c484[_0xa4b0('0x13')];});}function getUser(_0x50cfd5,_0x644b74){if(intUtil['validateEmail'](_0x644b74)){logger[_0xa4b0('0x8')](_0xa4b0('0x14'),_0x644b74);return request({'uri':util['format'](_0xa4b0('0x15'),_0x50cfd5[_0xa4b0('0xc')]),'qs':{'query':util[_0xa4b0('0xa')](_0xa4b0('0x16'),_0x644b74)}})['then'](function(_0x283e56){if(_0x283e56[_0xa4b0('0x17')]){logger[_0xa4b0('0x8')](_0xa4b0('0x18'));return _['find'](_0x283e56['results'],{'email':_0x644b74,'role':'agent'});}else{logger[_0xa4b0('0x8')](_0xa4b0('0x19'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x1a'),_0x50cfd5[_0xa4b0('0xc')])})[_0xa4b0('0x12')](function(_0x3bad9f){logger[_0xa4b0('0x8')](_0xa4b0('0x1b'));return _0x3bad9f['user'];});}});}else{logger[_0xa4b0('0x8')](_0xa4b0('0x19'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x1a'),_0x50cfd5[_0xa4b0('0xc')])})[_0xa4b0('0x12')](function(_0x4fb8de){logger[_0xa4b0('0x8')]('Admin\x20account\x20selected.');return _0x4fb8de['user'];});}}function getEndUser(_0x161e8a,_0x45ec0f,_0x1f5975){logger[_0xa4b0('0x8')]('Searching\x20enduser\x20with\x20phone',_0x1f5975);return request({'uri':util['format'](_0xa4b0('0x15'),_0x161e8a[_0xa4b0('0xc')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1f5975)}})[_0xa4b0('0x12')](function(_0x44d80f){var _0x46e3ae;if(_0x44d80f[_0xa4b0('0x1c')][_0xa4b0('0x1d')]){_0x44d80f[_0xa4b0('0x1c')]=_['filter'](_0x44d80f[_0xa4b0('0x1c')],{'suspended':![],'role':_0xa4b0('0x1e')});if(_0x44d80f['results'][_0xa4b0('0x1d')]){_0x46e3ae=_['first'](_0x44d80f[_0xa4b0('0x1c')]);}}if(_0x46e3ae){logger[_0xa4b0('0x8')](_0xa4b0('0x1f'));return _0x46e3ae;}else{logger['info'](_0xa4b0('0x20'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x21'),_0x161e8a[_0xa4b0('0xc')]),'method':_0xa4b0('0xd'),'body':{'user':{'role':_0xa4b0('0x1e'),'name':util[_0xa4b0('0xa')](_0xa4b0('0x22'),_0x45ec0f||_0x1f5975),'phone':_0x1f5975}}})[_0xa4b0('0x12')](function(_0x2671b0){logger['info'](_0xa4b0('0x23'));return _0x2671b0[_0xa4b0('0x24')];});}});}function getAuth(_0x38f73d){var _0x51ebbf;if(_0x38f73d[_0xa4b0('0x25')]===_0xa4b0('0x26')){_0x51ebbf=util[_0xa4b0('0xa')](_0xa4b0('0x27'),_0x38f73d[_0xa4b0('0x28')],_0x38f73d[_0xa4b0('0x26')]);}else if(_0x38f73d[_0xa4b0('0x25')]===_0xa4b0('0x29')){_0x51ebbf=util[_0xa4b0('0xa')](_0xa4b0('0x2a'),_0x38f73d['username'],_0x38f73d[_0xa4b0('0x29')]);}return util[_0xa4b0('0xa')]('Basic\x20%s',new Buffer(_0x51ebbf)[_0xa4b0('0x2b')](_0xa4b0('0x2c')));}function request(_0x5edd1d){logger[_0xa4b0('0x2d')](_0xa4b0('0x2e'),JSON[_0xa4b0('0x2f')](_0x5edd1d));return rp(_[_0xa4b0('0x30')](_0x5edd1d,{'method':_0xa4b0('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x2db6cd,_0x2e0e89){var _0x34f778=[];if(_0x2db6cd&&_0x2db6cd[_0xa4b0('0x1d')]>0x0){_0x34f778=_[_0xa4b0('0x32')](_0x2db6cd,_0x2e0e89);}return _0x34f778;}function getCustomFields(_0x4a0660,_0x59be17){var _0x4a3ad2=[];var _0x6e8250={'custom_fields':[]};if(_0x4a0660[_0xa4b0('0x1d')]>0x0){_['forEach'](_0x4a0660,function(_0x351624){if(_[_0xa4b0('0x33')]([_0xa4b0('0x34'),_0xa4b0('0x35')],_0x351624['type'])&&_0x351624[_0xa4b0('0x36')]&&!_0x351624[_0xa4b0('0x37')]){_0x6e8250[_0x351624[_0xa4b0('0x36')][_0xa4b0('0x38')]()]=_0x351624[_0xa4b0('0x39')][_0xa4b0('0x2b')]();}else if(_[_0xa4b0('0x33')]([_0xa4b0('0x34'),'picklist'],_0x351624[_0xa4b0('0x3a')])&&_0x351624[_0xa4b0('0x3b')]&&_0x351624[_0xa4b0('0x37')]){_0x6e8250['custom_fields']['push']({'id':_0x351624[_0xa4b0('0x3b')],'value':_0x351624[_0xa4b0('0x39')][_0xa4b0('0x2b')]()});}else if(_0x351624[_0xa4b0('0x3a')]===_0xa4b0('0x3c')&&_0x351624[_0xa4b0('0x3d')]&&_0x351624[_0xa4b0('0x3b')]&&_0x351624['customField']){_0x59be17[_0x351624[_0xa4b0('0x3d')]]&&_0x6e8250[_0xa4b0('0x3e')][_0xa4b0('0x3f')]({'id':_0x351624[_0xa4b0('0x3b')],'value':_0x59be17[_0x351624[_0xa4b0('0x3d')]][_0xa4b0('0x2b')]()});}else if(_0x351624['type']===_0xa4b0('0x40')&&_0x351624[_0xa4b0('0x41')]&&_0x351624[_0xa4b0('0x41')][_0xa4b0('0xf')]&&_0x351624[_0xa4b0('0x3b')]&&_0x351624[_0xa4b0('0x37')]){_0x59be17[_0x351624['Variable'][_0xa4b0('0xf')][_0xa4b0('0x38')]()]&&_0x6e8250[_0xa4b0('0x3e')][_0xa4b0('0x3f')]({'id':_0x351624['idField'],'value':_0x59be17[_0x351624[_0xa4b0('0x41')][_0xa4b0('0xf')][_0xa4b0('0x38')]()]['toString']()});}});}return _0x6e8250;}exports[_0xa4b0('0x42')]=function(_0x186b62,_0x271e48,_0x170c54,_0x574333,_0x589f8e,_0x364a57){var _0x4f12e8,_0x11fa1e;_0x364a57[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x364a57[_0xa4b0('0xc')]);_0x364a57[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x364a57['serverUrl']);if(_0x589f8e&&_0x589f8e[_0xa4b0('0x45')]){logger[_0xa4b0('0x8')](_0xa4b0('0x46'),_0xa4b0('0x47'));_0x271e48['recordingURL']=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x364a57[_0xa4b0('0x44')],_0x271e48[_0xa4b0('0x49')],md5(_0x271e48[_0xa4b0('0x49')]));}else{_0x271e48[_0xa4b0('0x4a')]='';}headers[_0xa4b0('0x4b')]=getAuth(_0x364a57);return getUser(_0x364a57,_0x574333['email'])[_0xa4b0('0x12')](function(_0x125995){_0x4f12e8=_0x125995;logger[_0xa4b0('0x8')]('The\x20User\x20ID\x20is:',_0x4f12e8['id']);return getEndUser(_0x364a57,_0x271e48['calleridname'],_0x271e48[_0xa4b0('0x4c')]);})[_0xa4b0('0x12')](function(_0x31de93){_0x11fa1e=_0x31de93;logger['info'](_0xa4b0('0x4d'),_0x11fa1e['id']);return getTicket(_0x364a57,_0x4f12e8,_0x11fa1e,_0x170c54,_0x271e48);})[_0xa4b0('0x12')](function(_0x2943dd){if(_0x2943dd){logger[_0xa4b0('0x8')](_0xa4b0('0x4e'),_0x2943dd['id']);switch(_0x364a57['type']){case _0xa4b0('0x4f'):logger['info']('[QUEUE]',_0xa4b0('0x50'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x51'),_0x364a57[_0xa4b0('0xc')],_0x4f12e8['id'],_0x2943dd['id']),'method':_0xa4b0('0xd')});case _0xa4b0('0x52'):logger[_0xa4b0('0x8')](_0xa4b0('0x46'),_0xa4b0('0x53'));emit(util[_0xa4b0('0xa')](_0xa4b0('0x54'),_0x574333[_0xa4b0('0xf')]),_0xa4b0('0x55'),{'uri':util[_0xa4b0('0xa')](_0xa4b0('0x56'),_0x364a57[_0xa4b0('0xc')]['replace'](_0xa4b0('0x57'),''),_0x2943dd['id'])});break;default:logger[_0xa4b0('0x58')](_0xa4b0('0x46'),_0xa4b0('0x59'));}}})['catch'](function(_0x44c029){logger['error'](_0xa4b0('0x5a'),util[_0xa4b0('0x5b')](_0x44c029,{'showHidden':!![],'depth':null}));});};exports[_0xa4b0('0x5c')]=function(_0x446881,_0x114b5f,_0x510407,_0x393f7e,_0x5a76e5,_0x58101a,_0x59d4bf){var _0x3f7049,_0x1870f2;_0x58101a[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x58101a['remoteUri']);_0x58101a[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x58101a[_0xa4b0('0x44')]);if(_0x59d4bf&&_0x59d4bf[_0xa4b0('0x5d')]&&_0x59d4bf[_0xa4b0('0x5d')]!==_0xa4b0('0x5e')){logger['info'](_0xa4b0('0x5f'),_0xa4b0('0x47'));_0x114b5f[_0xa4b0('0x4a')]=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x58101a[_0xa4b0('0x44')],_0x114b5f['uniqueid'],md5(_0x114b5f[_0xa4b0('0x49')]));}headers[_0xa4b0('0x4b')]=getAuth(_0x58101a);return getUser(_0x58101a,_0x393f7e[_0xa4b0('0x60')])[_0xa4b0('0x12')](function(_0x3dfa11){_0x3f7049=_0x3dfa11;logger['info']('The\x20User\x20ID\x20is:',_0x3f7049['id']);return getEndUser(_0x58101a,_0x114b5f[_0xa4b0('0x61')],_0x114b5f[_0xa4b0('0x62')]);})[_0xa4b0('0x12')](function(_0x436e9d){_0x1870f2=_0x436e9d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1870f2['id']);return getTicket(_0x58101a,_0x3f7049,_0x1870f2,_0x510407,_0x114b5f);})[_0xa4b0('0x12')](function(_0x394df9){if(_0x394df9){logger[_0xa4b0('0x8')](_0xa4b0('0x4e'),_0x394df9['id']);switch(_0x58101a[_0xa4b0('0x3a')]){case _0xa4b0('0x4f'):logger[_0xa4b0('0x8')](_0xa4b0('0x5f'),_0xa4b0('0x50'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x51'),_0x58101a['remoteUri'],_0x3f7049['id'],_0x394df9['id']),'method':_0xa4b0('0xd')});case _0xa4b0('0x52'):logger[_0xa4b0('0x8')](_0xa4b0('0x5f'),_0xa4b0('0x53'));emit(util['format'](_0xa4b0('0x54'),_0x393f7e[_0xa4b0('0xf')]),_0xa4b0('0x55'),{'uri':util[_0xa4b0('0xa')](_0xa4b0('0x56'),_0x58101a[_0xa4b0('0xc')][_0xa4b0('0x63')](_0xa4b0('0x57'),''),_0x394df9['id'])});break;default:logger[_0xa4b0('0x58')](_0xa4b0('0x5f'),_0xa4b0('0x59'));}}})[_0xa4b0('0x64')](function(_0x3211e4){logger['error'](_0xa4b0('0x65'),util[_0xa4b0('0x5b')](_0x3211e4,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2b21da,_0x37ea0e,_0x13f6e6,_0x29192f,_0x3d4893,_0x2136fe){var _0x31c44e,_0x5ef6f6;_0x2136fe[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x2136fe[_0xa4b0('0xc')]);_0x2136fe[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x2136fe[_0xa4b0('0x44')]);if(_0x3d4893&&_0x3d4893['monitor_format']){logger[_0xa4b0('0x8')]('['+_0x37ea0e['lastevent'][_0xa4b0('0x66')]()+']','Recording\x20is\x20enabled!');_0x37ea0e[_0xa4b0('0x4a')]=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x2136fe[_0xa4b0('0x44')],_0x37ea0e[_0xa4b0('0x49')],md5(_0x37ea0e['uniqueid']));}else{_0x37ea0e[_0xa4b0('0x4a')]='';}headers[_0xa4b0('0x4b')]=getAuth(_0x2136fe);return getUser(_0x2136fe)[_0xa4b0('0x12')](function(_0x12911a){_0x31c44e=_0x12911a;logger[_0xa4b0('0x8')](_0xa4b0('0x67'),_0x31c44e['id']);return getEndUser(_0x2136fe,_0x37ea0e[_0xa4b0('0x68')],_0x37ea0e['calleridnum']);})['then'](function(_0x1b3242){_0x5ef6f6=_0x1b3242;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5ef6f6['id']);return getTicket(_0x2136fe,_0x31c44e,_0x5ef6f6,_0x13f6e6,_0x37ea0e);})[_0xa4b0('0x12')](function(_0xaa750f){if(_0xaa750f){logger[_0xa4b0('0x8')]('The\x20Ticket\x20ID\x20is:',_0xaa750f['id']);}})[_0xa4b0('0x64')](function(_0x3b3cd2){logger['error']('['+_0x37ea0e[_0xa4b0('0x69')][_0xa4b0('0x66')]()+']'+_0xa4b0('0x6a'),util[_0xa4b0('0x5b')](_0x3b3cd2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf890=['../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','user','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','debug','GET','forEach','includes','string','picklist','nameField','customField','content','toString','idField','custom_fields','push','type','variableName','Variable','toLowerCase','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','integrationTab','user:%s','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util'];(function(_0x1f1f4c,_0x5da224){var _0x29112a=function(_0x3d63d7){while(--_0x3d63d7){_0x1f1f4c['push'](_0x1f1f4c['shift']());}};_0x29112a(++_0x5da224);}(_0xf890,0x69));var _0x0f89=function(_0x1e8462,_0x4c0443){_0x1e8462=_0x1e8462-0x0;var _0x34774f=_0xf890[_0x1e8462];return _0x34774f;};'use strict';var _=require(_0x0f89('0x0'));var rp=require(_0x0f89('0x1'));var md5=require(_0x0f89('0x2'));var util=require('util');var Redis=require(_0x0f89('0x3'));var intUtil=require(_0x0f89('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0f89('0x5'))(_0x0f89('0x6'));config['redis']=_[_0x0f89('0x7')](config[_0x0f89('0x8')],{'host':_0x0f89('0x9'),'port':0x18eb});var io=require(_0x0f89('0xa'))(new Redis(config[_0x0f89('0x8')]));function emit(_0x8cc495,_0x56afe5,_0x53db62){io['to'](_0x8cc495)[_0x0f89('0xb')](_0x56afe5,_0x53db62);}var headers={'Content-Type':_0x0f89('0xc'),'Accept':_0x0f89('0xc')};function getTicket(_0x1029ac,_0x1d895e,_0x3db3c6,_0x350573,_0x27d407){logger[_0x0f89('0xd')](_0x0f89('0xe'));return request({'uri':util[_0x0f89('0xf')](_0x0f89('0x10'),_0x1029ac[_0x0f89('0x11')]),'method':_0x0f89('0x12'),'body':{'ticket':_[_0x0f89('0x13')]({'requester_id':_0x3db3c6['id'],'submitter_id':_0x1d895e?_0x1d895e['id']:undefined,'assignee_id':_0x1d895e?_0x1d895e['id']:undefined,'tags':getTags(_0x350573['Tags'],_0x0f89('0x14')),'subject':intUtil[_0x0f89('0x15')](_0x350573[_0x0f89('0x16')],_0x27d407,'\x20'),'description':intUtil[_0x0f89('0x15')](_0x350573[_0x0f89('0x17')],_0x27d407,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0f89('0x15')](_0x350573[_0x0f89('0x17')],_0x27d407,'\x0a')}},getCustomFields(_0x350573[_0x0f89('0x18')],_0x27d407))}})[_0x0f89('0x19')](function(_0x5d56b5){logger[_0x0f89('0xd')]('Ticket\x20created!');return _0x5d56b5[_0x0f89('0x1a')];});}function getUser(_0x29e399,_0x20b7e9){if(intUtil[_0x0f89('0x1b')](_0x20b7e9)){logger[_0x0f89('0xd')](_0x0f89('0x1c'),_0x20b7e9);return request({'uri':util[_0x0f89('0xf')](_0x0f89('0x1d'),_0x29e399[_0x0f89('0x11')]),'qs':{'query':util[_0x0f89('0xf')](_0x0f89('0x1e'),_0x20b7e9)}})[_0x0f89('0x19')](function(_0x43a248){if(_0x43a248[_0x0f89('0x1f')]){logger[_0x0f89('0xd')](_0x0f89('0x20'));return _[_0x0f89('0x21')](_0x43a248['results'],{'email':_0x20b7e9,'role':'agent'});}else{logger['info'](_0x0f89('0x22'));return request({'uri':util[_0x0f89('0xf')](_0x0f89('0x23'),_0x29e399[_0x0f89('0x11')])})['then'](function(_0x18cb10){logger[_0x0f89('0xd')](_0x0f89('0x24'));return _0x18cb10['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0f89('0xf')]('%s/users/me.json',_0x29e399[_0x0f89('0x11')])})[_0x0f89('0x19')](function(_0x3f1b9d){logger[_0x0f89('0xd')](_0x0f89('0x24'));return _0x3f1b9d['user'];});}}function getEndUser(_0x366c04,_0x4c25d1,_0x3b0775){logger[_0x0f89('0xd')](_0x0f89('0x25'),_0x3b0775);return request({'uri':util[_0x0f89('0xf')]('%s/search.json',_0x366c04[_0x0f89('0x11')]),'qs':{'query':util[_0x0f89('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x3b0775)}})['then'](function(_0x32f064){var _0x3f6ff5;if(_0x32f064['results'][_0x0f89('0x26')]){_0x32f064[_0x0f89('0x27')]=_[_0x0f89('0x28')](_0x32f064['results'],{'suspended':![],'role':_0x0f89('0x29')});if(_0x32f064['results'][_0x0f89('0x26')]){_0x3f6ff5=_[_0x0f89('0x2a')](_0x32f064[_0x0f89('0x27')]);}}if(_0x3f6ff5){logger[_0x0f89('0xd')](_0x0f89('0x2b'));return _0x3f6ff5;}else{logger['info'](_0x0f89('0x2c'));return request({'uri':util[_0x0f89('0xf')](_0x0f89('0x2d'),_0x366c04[_0x0f89('0x11')]),'method':_0x0f89('0x12'),'body':{'user':{'role':_0x0f89('0x29'),'name':util[_0x0f89('0xf')]('Caller\x20-\x20%s',_0x4c25d1||_0x3b0775),'phone':_0x3b0775}}})[_0x0f89('0x19')](function(_0x5c917e){logger[_0x0f89('0xd')](_0x0f89('0x2e'));return _0x5c917e[_0x0f89('0x2f')];});}});}function getAuth(_0x86e880){var _0x59d29f;if(_0x86e880[_0x0f89('0x30')]===_0x0f89('0x31')){_0x59d29f=util['format'](_0x0f89('0x32'),_0x86e880[_0x0f89('0x33')],_0x86e880[_0x0f89('0x31')]);}else if(_0x86e880[_0x0f89('0x30')]===_0x0f89('0x34')){_0x59d29f=util[_0x0f89('0xf')](_0x0f89('0x35'),_0x86e880[_0x0f89('0x33')],_0x86e880['token']);}return util['format'](_0x0f89('0x36'),new Buffer(_0x59d29f)['toString']('base64'));}function request(_0x1621cb){logger[_0x0f89('0x37')]('[HTTP]',JSON['stringify'](_0x1621cb));return rp(_[_0x0f89('0x7')](_0x1621cb,{'method':_0x0f89('0x38'),'headers':headers,'json':!![]}));}function getTags(_0xefca94,_0x5bb1a0){var _0x373853=[];if(_0xefca94&&_0xefca94[_0x0f89('0x26')]>0x0){_0x373853=_['map'](_0xefca94,_0x5bb1a0);}return _0x373853;}function getCustomFields(_0x23f604,_0x2f6e3c){var _0x2a1a03=[];var _0x33e5c2={'custom_fields':[]};if(_0x23f604[_0x0f89('0x26')]>0x0){_[_0x0f89('0x39')](_0x23f604,function(_0x377231){if(_[_0x0f89('0x3a')]([_0x0f89('0x3b'),_0x0f89('0x3c')],_0x377231['type'])&&_0x377231[_0x0f89('0x3d')]&&!_0x377231[_0x0f89('0x3e')]){_0x33e5c2[_0x377231['nameField']['toLowerCase']()]=_0x377231[_0x0f89('0x3f')][_0x0f89('0x40')]();}else if(_['includes']([_0x0f89('0x3b'),_0x0f89('0x3c')],_0x377231['type'])&&_0x377231[_0x0f89('0x41')]&&_0x377231[_0x0f89('0x3e')]){_0x33e5c2[_0x0f89('0x42')][_0x0f89('0x43')]({'id':_0x377231['idField'],'value':_0x377231[_0x0f89('0x3f')][_0x0f89('0x40')]()});}else if(_0x377231[_0x0f89('0x44')]==='variable'&&_0x377231['variableName']&&_0x377231[_0x0f89('0x41')]&&_0x377231[_0x0f89('0x3e')]){_0x2f6e3c[_0x377231['variableName']]&&_0x33e5c2['custom_fields']['push']({'id':_0x377231['idField'],'value':_0x2f6e3c[_0x377231[_0x0f89('0x45')]][_0x0f89('0x40')]()});}else if(_0x377231['type']==='customVariable'&&_0x377231[_0x0f89('0x46')]&&_0x377231[_0x0f89('0x46')][_0x0f89('0x14')]&&_0x377231[_0x0f89('0x41')]&&_0x377231[_0x0f89('0x3e')]){_0x2f6e3c[_0x377231[_0x0f89('0x46')][_0x0f89('0x14')][_0x0f89('0x47')]()]&&_0x33e5c2[_0x0f89('0x42')][_0x0f89('0x43')]({'id':_0x377231[_0x0f89('0x41')],'value':_0x2f6e3c[_0x377231[_0x0f89('0x46')][_0x0f89('0x14')][_0x0f89('0x47')]()][_0x0f89('0x40')]()});}});}return _0x33e5c2;}exports['queue']=function(_0x37622e,_0x60cddd,_0x20807c,_0x170c9f,_0x247650,_0x25da74){var _0x549ea0,_0x308325;_0x25da74['remoteUri']=intUtil['stripTrailingSlash'](_0x25da74[_0x0f89('0x11')]);_0x25da74[_0x0f89('0x48')]=intUtil[_0x0f89('0x49')](_0x25da74[_0x0f89('0x48')]);if(_0x247650&&_0x247650[_0x0f89('0x4a')]){logger[_0x0f89('0xd')](_0x0f89('0x4b'),_0x0f89('0x4c'));_0x60cddd[_0x0f89('0x4d')]=util[_0x0f89('0xf')](_0x0f89('0x4e'),_0x25da74[_0x0f89('0x48')],_0x60cddd[_0x0f89('0x4f')],md5(_0x60cddd[_0x0f89('0x4f')]));}else{_0x60cddd[_0x0f89('0x4d')]='';}headers[_0x0f89('0x50')]=getAuth(_0x25da74);return getUser(_0x25da74,_0x170c9f[_0x0f89('0x51')])[_0x0f89('0x19')](function(_0x12ea92){_0x549ea0=_0x12ea92;logger[_0x0f89('0xd')](_0x0f89('0x52'),_0x549ea0['id']);return getEndUser(_0x25da74,_0x60cddd[_0x0f89('0x53')],_0x60cddd[_0x0f89('0x54')]);})[_0x0f89('0x19')](function(_0x53fba1){_0x308325=_0x53fba1;logger[_0x0f89('0xd')](_0x0f89('0x55'),_0x308325['id']);return getTicket(_0x25da74,_0x549ea0,_0x308325,_0x20807c,_0x60cddd);})['then'](function(_0x55bd9e){if(_0x55bd9e){logger[_0x0f89('0xd')](_0x0f89('0x56'),_0x55bd9e['id']);switch(_0x25da74['type']){case'integrationTab':logger[_0x0f89('0xd')](_0x0f89('0x4b'),_0x0f89('0x57'));return request({'uri':util['format'](_0x0f89('0x58'),_0x25da74[_0x0f89('0x11')],_0x549ea0['id'],_0x55bd9e['id']),'method':_0x0f89('0x12')});case _0x0f89('0x59'):logger['info'](_0x0f89('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x170c9f['name']),_0x0f89('0x5a'),{'uri':util['format'](_0x0f89('0x5b'),_0x25da74['remoteUri']['replace']('/api/v2',''),_0x55bd9e['id'])});break;default:logger[_0x0f89('0x5c')](_0x0f89('0x4b'),_0x0f89('0x5d'));}}})[_0x0f89('0x5e')](function(_0x2dcc92){logger[_0x0f89('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x0f89('0x5f')](_0x2dcc92,{'showHidden':!![],'depth':null}));});};exports[_0x0f89('0x60')]=function(_0x19354a,_0x286051,_0x2f7c1f,_0x1a58d4,_0x5db78f,_0x434bac,_0x49f144){var _0x3fa4e9,_0x3ee6b1;_0x434bac['remoteUri']=intUtil[_0x0f89('0x49')](_0x434bac[_0x0f89('0x11')]);_0x434bac[_0x0f89('0x48')]=intUtil[_0x0f89('0x49')](_0x434bac[_0x0f89('0x48')]);if(_0x49f144&&_0x49f144[_0x0f89('0x61')]&&_0x49f144['recordingFormat']!==_0x0f89('0x62')){logger[_0x0f89('0xd')](_0x0f89('0x63'),'Recording\x20is\x20enabled!');_0x286051[_0x0f89('0x4d')]=util[_0x0f89('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x434bac[_0x0f89('0x48')],_0x286051[_0x0f89('0x4f')],md5(_0x286051[_0x0f89('0x4f')]));}headers[_0x0f89('0x50')]=getAuth(_0x434bac);return getUser(_0x434bac,_0x1a58d4[_0x0f89('0x51')])['then'](function(_0x19b5be){_0x3fa4e9=_0x19b5be;logger[_0x0f89('0xd')]('The\x20User\x20ID\x20is:',_0x3fa4e9['id']);return getEndUser(_0x434bac,_0x286051['destcalleridname'],_0x286051[_0x0f89('0x64')]);})['then'](function(_0x5fbdea){_0x3ee6b1=_0x5fbdea;logger[_0x0f89('0xd')](_0x0f89('0x55'),_0x3ee6b1['id']);return getTicket(_0x434bac,_0x3fa4e9,_0x3ee6b1,_0x2f7c1f,_0x286051);})[_0x0f89('0x19')](function(_0x5de462){if(_0x5de462){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5de462['id']);switch(_0x434bac[_0x0f89('0x44')]){case _0x0f89('0x65'):logger['info'](_0x0f89('0x63'),_0x0f89('0x57'));return request({'uri':util[_0x0f89('0xf')](_0x0f89('0x58'),_0x434bac[_0x0f89('0x11')],_0x3fa4e9['id'],_0x5de462['id']),'method':_0x0f89('0x12')});case _0x0f89('0x59'):logger[_0x0f89('0xd')](_0x0f89('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0f89('0xf')](_0x0f89('0x66'),_0x1a58d4[_0x0f89('0x14')]),_0x0f89('0x5a'),{'uri':util[_0x0f89('0xf')](_0x0f89('0x5b'),_0x434bac[_0x0f89('0x11')][_0x0f89('0x67')](_0x0f89('0x68'),''),_0x5de462['id'])});break;default:logger[_0x0f89('0x5c')](_0x0f89('0x63'),_0x0f89('0x5d'));}}})[_0x0f89('0x5e')](function(_0x136b4d){logger['error'](_0x0f89('0x69'),util[_0x0f89('0x5f')](_0x136b4d,{'showHidden':!![],'depth':null}));});};exports[_0x0f89('0x6a')]=function(_0x1b5589,_0x492944,_0xe554bf,_0x1c3283,_0x551a74,_0xb58e58){var _0x251369,_0x4d998f;_0xb58e58['remoteUri']=intUtil[_0x0f89('0x49')](_0xb58e58['remoteUri']);_0xb58e58[_0x0f89('0x48')]=intUtil[_0x0f89('0x49')](_0xb58e58[_0x0f89('0x48')]);if(_0x551a74&&_0x551a74[_0x0f89('0x4a')]){logger[_0x0f89('0xd')]('['+_0x492944[_0x0f89('0x6b')][_0x0f89('0x6c')]()+']',_0x0f89('0x4c'));_0x492944[_0x0f89('0x4d')]=util['format'](_0x0f89('0x4e'),_0xb58e58[_0x0f89('0x48')],_0x492944[_0x0f89('0x4f')],md5(_0x492944[_0x0f89('0x4f')]));}else{_0x492944[_0x0f89('0x4d')]='';}headers[_0x0f89('0x50')]=getAuth(_0xb58e58);return getUser(_0xb58e58)[_0x0f89('0x19')](function(_0x365ff6){_0x251369=_0x365ff6;logger[_0x0f89('0xd')](_0x0f89('0x52'),_0x251369['id']);return getEndUser(_0xb58e58,_0x492944[_0x0f89('0x53')],_0x492944[_0x0f89('0x54')]);})[_0x0f89('0x19')](function(_0x2bd4e7){_0x4d998f=_0x2bd4e7;logger[_0x0f89('0xd')](_0x0f89('0x55'),_0x4d998f['id']);return getTicket(_0xb58e58,_0x251369,_0x4d998f,_0xe554bf,_0x492944);})[_0x0f89('0x19')](function(_0x444907){if(_0x444907){logger[_0x0f89('0xd')]('The\x20Ticket\x20ID\x20is:',_0x444907['id']);}})[_0x0f89('0x5e')](function(_0x2de7fc){logger[_0x0f89('0x5c')]('['+_0x492944['lastevent']['toUpperCase']()+']'+_0x0f89('0x6d'),util[_0x0f89('0x5f')](_0x2de7fc,{'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 db0a1e9..73e8022 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 _0x9de3=['Contacts','https://www.zohoapis.','Leads','nothing','contact','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','lodash','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:'];(function(_0x4a47fc,_0x25208f){var _0x30f1ee=function(_0x33ea17){while(--_0x33ea17){_0x4a47fc['push'](_0x4a47fc['shift']());}};_0x30f1ee(++_0x25208f);}(_0x9de3,0xea));var _0x39de=function(_0x580c7f,_0x5a4519){_0x580c7f=_0x580c7f-0x0;var _0x4d35cc=_0x9de3[_0x580c7f];return _0x4d35cc;};'use strict';var _=require(_0x39de('0x0'));var rp=require('request-promise');var md5=require(_0x39de('0x1'));var util=require(_0x39de('0x2'));var intUtil=require(_0x39de('0x3'));var moment=require('moment');var Redis=require(_0x39de('0x4'));var BPromise=require('bluebird');var config=require(_0x39de('0x5'));var logger=require(_0x39de('0x6'))(_0x39de('0x7'));config[_0x39de('0x8')]=_['defaults'](config[_0x39de('0x8')],{'host':_0x39de('0x9'),'port':0x18eb});var io=require(_0x39de('0xa'))(new Redis(config[_0x39de('0x8')]));function emit(_0x2604fa,_0x59ce28,_0x4e7204){io['to'](_0x2604fa)['emit'](_0x59ce28,_0x4e7204);}function request(_0x27e596){logger[_0x39de('0xb')](_0x39de('0xc'),JSON[_0x39de('0xd')](_0x27e596));return rp(_0x27e596);}function getCustomFields(_0x4450ec,_0x31a203){var _0x431b4a={};if(_0x4450ec[_0x39de('0xe')]>0x0){_['forEach'](_0x4450ec,function(_0x27772d){if(_['includes'](['string',_0x39de('0xf')],_0x27772d[_0x39de('0x10')])&&_0x27772d[_0x39de('0x11')]){_0x431b4a[_0x27772d['idField']]=_0x27772d[_0x39de('0x12')][_0x39de('0x13')]();}else if(_0x27772d[_0x39de('0x10')]===_0x39de('0x14')&&_0x27772d[_0x39de('0x15')]&&_0x27772d[_0x39de('0x11')]&&_0x31a203[_0x27772d[_0x39de('0x15')]]){_0x431b4a[_0x27772d[_0x39de('0x11')]]=_0x31a203[_0x27772d[_0x39de('0x15')]][_0x39de('0x13')]();}else if(_0x27772d['type']===_0x39de('0x16')&&_0x27772d[_0x39de('0x17')]&&_0x27772d[_0x39de('0x17')][_0x39de('0x18')]&&_0x27772d['idField']&&_0x31a203[_0x27772d['Variable'][_0x39de('0x18')]['toLowerCase']()]){_0x431b4a[_0x27772d[_0x39de('0x11')]]=_0x31a203[_0x27772d[_0x39de('0x17')]['name'][_0x39de('0x19')]()]['toString']();}});}return _0x431b4a;}function getName(_0x440201){if(_0x440201[_0x39de('0x1a')]('\x20')>0x0){var _0x4933ff=_0x440201['split'](/ (.+)/);if(_0x4933ff[0x1]){return _0x4933ff;}}return[_0x440201,_0x440201];}var accountsTokens={};function getAccessToken(_0xab6f89){return new Promise(function(_0x5e4ab2,_0x552590){if(!_[_0x39de('0x1b')](accountsTokens[_0xab6f89['id']])&&!_[_0x39de('0x1b')](accountsTokens[_0xab6f89['id']][_0x39de('0x1c')])){if(moment()[_0x39de('0x1d')](accountsTokens[_0xab6f89['id']][_0x39de('0x1e')])){_0x5e4ab2(accountsTokens[_0xab6f89['id']][_0x39de('0x1c')]);}}var _0x510765;switch(_0xab6f89[_0x39de('0x1f')]){case'US':_0x510765=_0x39de('0x20');break;case'AU':_0x510765=_0x39de('0x21');break;case'EU':_0x510765='https://accounts.zoho.eu';break;case'IN':_0x510765=_0x39de('0x22');break;case'CN':_0x510765='https://accounts.zoho.com.cn';break;default:_0x510765=_0x39de('0x23');break;}var _0x102c5b={'method':_0x39de('0x24'),'uri':_0x510765+_0x39de('0x25'),'qs':{'refresh_token':_0xab6f89[_0x39de('0x26')],'client_id':_0xab6f89['clientId'],'client_secret':_0xab6f89[_0x39de('0x27')],'grant_type':_0x39de('0x28')},'json':!![]};return rp(_0x102c5b)[_0x39de('0x29')](function(_0x73b579){accountsTokens[_0xab6f89['id']]={'access_token':_0x73b579['access_token'],'expires_in':moment()[_0x39de('0x2a')](_0x73b579['expires_in'],'seconds')};_0x5e4ab2(_0x73b579[_0x39de('0x1c')]);})[_0x39de('0x2b')](function(_0xfd80c8){logger[_0x39de('0x2c')](_0x39de('0x2d'),_0xfd80c8['stack']);_0x552590(_0xfd80c8);});});}function getUser(_0x352060,_0xe979d1,_0x46dfd2,_0x1037c9){logger[_0x39de('0x2e')](_0x39de('0x2f'));return request({'method':_0x39de('0x30'),'uri':util['format'](_0x39de('0x31'),_0xe979d1),'qs':{'type':_0x39de('0x32')},'headers':{'Authorization':_0x39de('0x33')+_0x352060},'json':!![]})[_0x39de('0x29')](function(_0x4b12d9){if(_0x4b12d9[_0x39de('0x34')]){var _0x3d6562=-0x1;if(_[_0x39de('0x35')](_0x4b12d9[_0x39de('0x34')])){if(!_['isNil'](_0x1037c9)){_0x3d6562=_[_0x39de('0x36')](_0x4b12d9[_0x39de('0x34')],function(_0x2b09b1){return _0x2b09b1[_0x39de('0x37')]===_0x1037c9;});}if(_0x3d6562>=0x0){logger[_0x39de('0x2e')]('Agent\x20found!');}else{logger['info'](_0x39de('0x38'));_0x3d6562=_[_0x39de('0x36')](_0x4b12d9[_0x39de('0x34')],function(_0x34cfd3){return _0x34cfd3['profile'][_0x39de('0x18')]==='Administrator';});}return _0x4b12d9[_0x39de('0x34')][_0x3d6562];}else{if(_0x4b12d9[_0x39de('0x39')][_0x39de('0x3a')]['name']===_0x39de('0x3b')){logger[_0x39de('0x2e')](_0x39de('0x38'));user=_0x4b12d9[_0x39de('0x39')];return user;}else{logger[_0x39de('0x2c')](_0x39de('0x3c'),JSON[_0x39de('0xd')](_0x4b12d9));throw new Error(_0x39de('0x3d')+JSON[_0x39de('0xd')](_0x4b12d9));}}}else{logger['error'](_0x39de('0x3c'),JSON[_0x39de('0xd')](_0x4b12d9));throw new Error(_0x39de('0x3d')+JSON[_0x39de('0xd')](_0x4b12d9));}})[_0x39de('0x2b')](function(_0x4ca613){console[_0x39de('0x2c')](_0x4ca613);});}function getZohoUser(_0x543bc4,_0x10c6c3){return new BPromise(function(_0x51f1a3,_0x1b841e){request(_0x543bc4)[_0x39de('0x29')](function(_0x342c0f){var _0x124bdb=null;if(_0x342c0f){_0x124bdb=_0x342c0f[_0x39de('0x3e')][0x0];_0x124bdb[_0x39de('0x3f')]=_0x10c6c3;}_0x51f1a3(_0x124bdb);})[_0x39de('0x2b')](function(_0x52d527){_0x1b841e(_0x52d527);});});}function createEndUser(_0x155451,_0x3dd32d,_0x208f24,_0x4b55ea,_0x6f1636,_0x443ab7){var _0x208f24=getName(_0x208f24);return request({'method':_0x39de('0x24'),'uri':'https://www.zohoapis.'+_0x3dd32d+'/crm/v2/'+_[_0x39de('0x40')](_0x443ab7[_0x39de('0x41')])+'s','body':{'data':[{'Last_Name':_0x208f24[0x1],'First_Name':_0x208f24[0x0],'Phone':_0x4b55ea,'Owner':{'name':!_[_0x39de('0x1b')](_0x6f1636[_0x39de('0x42')]['name'])?_0x6f1636[_0x39de('0x42')][_0x39de('0x18')]:!_[_0x39de('0x1b')](_0x6f1636[_0x39de('0x43')])?_0x6f1636[_0x39de('0x43')]+'\x20'+_0x6f1636[_0x39de('0x44')]:_0x6f1636[_0x39de('0x44')],'id':_0x6f1636['id']}}]},'headers':{'Authorization':_0x39de('0x33')+_0x155451},'json':!![]})['then'](function(_0x42ba71){if(_0x42ba71&&_0x42ba71[_0x39de('0x3e')][0x0][_0x39de('0x45')]==='SUCCESS'){var _0x1bfc75=_0x42ba71[_0x39de('0x3e')][0x0][_0x39de('0x46')];_0x1bfc75['enduserType']=_[_0x39de('0x40')](_0x443ab7[_0x39de('0x41')])+'s';return _0x1bfc75;}logger[_0x39de('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x39de('0xd')](data));throw new Error(_0x39de('0x47')+JSON[_0x39de('0xd')](data));})[_0x39de('0x2b')](function(_0x496d3f){console[_0x39de('0x48')](_0x39de('0x49'),_0x496d3f);});}function getEndUser(_0x494f19,_0x5cd01a,_0x5dfbdf,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f){var _0x2ce9c8={'method':_0x39de('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x494f19},'json':!![]};switch(_0xeb763f[_0x39de('0x4a')]){case _0x39de('0x4b'):_0x2ce9c8[_0x39de('0x4c')]='https://www.zohoapis.'+_0x5cd01a+_0x39de('0x4d')+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x4e'))['then'](function(_0x5ee1a6){if(_0x5ee1a6)return _0x5ee1a6;_0x2ce9c8[_0x39de('0x4c')]=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x50'))[_0x39de('0x29')](function(_0x49514c){if(_0x49514c)return _0x49514c;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});});break;case _0x39de('0x52'):_0x2ce9c8[_0x39de('0x4c')]=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x4e'))[_0x39de('0x29')](function(_0x5064c8){if(_0x5064c8)return _0x5064c8;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});break;case'lead':_0x2ce9c8['uri']=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x50'))['then'](function(_0x20c9a2){if(_0x20c9a2)return _0x20c9a2;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});break;}}function getCall(_0x58a177,_0x34130d,_0xacad75,_0x3b5d57,_0x511d4c,_0x303bcc,_0x216d9d,_0x5670a4){logger['info'](_0x39de('0x53'));var _0x292fc4={};_0x292fc4[_0x39de('0x54')]={'name':!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x42')][_0x39de('0x18')])&&!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x3a')][_0x39de('0x18')])&&_0x3b5d57['profile'][_0x39de('0x18')]==='administrator'?_0x3b5d57[_0x39de('0x42')][_0x39de('0x18')]:!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x43')])?_0x3b5d57['first_name']+'\x20'+_0x3b5d57[_0x39de('0x44')]:_0x3b5d57[_0x39de('0x44')],'id':_0x3b5d57['id']};_0x292fc4[_0x39de('0x55')]=intUtil[_0x39de('0x56')](_0x303bcc[_0x39de('0x57')],_0x216d9d,'\x20');_0x292fc4['Description']=intUtil['getString'](_0x303bcc[_0x39de('0x58')],_0x216d9d,'\x0a');if(_0x511d4c['enduserType']===_0x39de('0x4e')){_0x292fc4[_0x39de('0x59')]={'name':!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5a')])?_0x511d4c[_0x39de('0x5a')]:!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5b')])?_0x511d4c[_0x39de('0x5b')]+'\x20'+_0x511d4c['Last_Name']:_0x511d4c['Last_Name'],'id':_0x511d4c['id']};}if(_0x511d4c[_0x39de('0x3f')]===_0x39de('0x50')){_0x292fc4[_0x39de('0x5c')]={'name':!_[_0x39de('0x1b')](_0x511d4c['Full_Name'])?_0x511d4c[_0x39de('0x5a')]:!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5b')])?_0x511d4c[_0x39de('0x5b')]+'\x20'+_0x511d4c[_0x39de('0x5d')]:_0x511d4c[_0x39de('0x5d')],'id':_0x511d4c['id']};_0x292fc4['$se_module']=_[_0x39de('0x40')](_0x511d4c[_0x39de('0x3f')]);}if(_0x216d9d[_0x39de('0x5e')]){_0x292fc4[_0x39de('0x5f')]=moment[_0x39de('0x60')](parseInt(_0x216d9d[_0x39de('0x5e')])*0x3e8)[_0x39de('0x61')](_0x39de('0x62'));}else if(_0x216d9d['answertime']&&_0x216d9d['endtime']){_0x292fc4[_0x39de('0x5f')]=moment[_0x39de('0x60')](moment(_0x216d9d[_0x39de('0x63')],_0x39de('0x64'))[_0x39de('0x65')](moment(_0x216d9d[_0x39de('0x66')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x216d9d[_0x39de('0x67')]){case _0x39de('0x68'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6a');break;case _0x39de('0x6b'):case _0x39de('0x6c'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6d');break;case _0x39de('0x6e'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6f');break;case'abandoned':_0x292fc4['Call_Result']=_0x39de('0x70');break;case _0x39de('0x71'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x72');default:}_0x292fc4[_0x39de('0x73')]=(_0x5670a4===_0x39de('0x74')?moment(_0x216d9d[_0x39de('0x66')])[_0x39de('0x61')](_0x39de('0x64')):moment(_0x216d9d[_0x39de('0x75')])[_0x39de('0x61')](_0x39de('0x64')))||moment()[_0x39de('0x61')](_0x39de('0x64'));_0x292fc4[_0x39de('0x76')]=_0x5670a4||_0x39de('0x77');_0x292fc4=_[_0x39de('0x78')](_0x292fc4,getCustomFields(_0x303bcc['Fields'],_0x216d9d));return request({'method':_0x39de('0x24'),'uri':_0x39de('0x4f')+_0x34130d+_0x39de('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x58a177},'body':{'data':[_0x292fc4]},'json':!![]})[_0x39de('0x29')](function(_0x2a2932){if(_0x2a2932&&_0x2a2932[_0x39de('0x3e')][0x0][_0x39de('0x45')]===_0x39de('0x7a')){logger[_0x39de('0x2e')](_0x39de('0x7b'));return{'id':_0x2a2932['data'][0x0][_0x39de('0x46')]['id']};}})[_0x39de('0x2b')](function(_0x445cd1){logger[_0x39de('0x2e')](_0x39de('0x7c'),_0x445cd1[_0x39de('0x7d')]);console[_0x39de('0x48')](_0x39de('0x7c'),_0x445cd1);});}exports[_0x39de('0x7e')]=function(_0x15bd17,_0x41a3e6,_0xb7d5be,_0x40a4c4,_0x1ff0b1,_0x4123a2){var _0x2873bc,_0x5ebbbb,_0x58a180;_0x4123a2['host']=intUtil[_0x39de('0x7f')](_0x4123a2[_0x39de('0x80')]);_0x4123a2[_0x39de('0x81')]=intUtil[_0x39de('0x7f')](_0x4123a2[_0x39de('0x81')]);if(_0x1ff0b1&&_0x1ff0b1[_0x39de('0x82')]){logger[_0x39de('0x2e')]('[QUEUE]',_0x39de('0x83'));_0x41a3e6[_0x39de('0x84')]=_0x4123a2['serverUrl']+_0x39de('0x85')+_0x41a3e6[_0x39de('0x86')]+_0x39de('0x87')+md5(_0x41a3e6['uniqueid']);}else{_0x41a3e6[_0x39de('0x84')]='';}var _0x1e8274=_0x4123a2[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x4123a2)[_0x39de('0x29')](function(_0x36f03a){_0x58a180=_0x36f03a;return getUser(_0x58a180,_0x1e8274,_0x4123a2,_0x40a4c4['email']);})[_0x39de('0x29')](function(_0xa676ee){_0x2873bc=_0xa676ee;logger[_0x39de('0x2e')](_0x39de('0x8a'),_0x2873bc['id']);return getEndUser(_0x58a180,_0x1e8274,_0x4123a2,_0x41a3e6[_0x39de('0x8b')],_0x41a3e6[_0x39de('0x8c')],_0x2873bc,_0xb7d5be);})[_0x39de('0x29')](function(_0x59252f){_0x5ebbbb=_0x59252f;return getCall(_0x58a180,_0x1e8274,_0x4123a2,_0x2873bc,_0x5ebbbb,_0xb7d5be,_0x41a3e6,'Inbound');})['then'](function(_0x1d41e2){if(_0x1d41e2){logger[_0x39de('0x2e')](_0x39de('0x8d'),_0x1d41e2['id']);logger['info'](_0x39de('0x8e'),_0x39de('0x8f'));emit(util['format'](_0x39de('0x90'),_0x40a4c4[_0x39de('0x18')]),'trigger:browser:url',{'uri':_0x39de('0x91')+_0x4123a2[_0x39de('0x80')]+_0x39de('0x92')+_0x1d41e2['id']});}})[_0x39de('0x2b')](function(_0x48a024){logger[_0x39de('0x2c')]('[QUEUE]',JSON[_0x39de('0xd')](_0x48a024));});};exports['outbound']=function(_0x451025,_0x46aa4d,_0x4d0920,_0x474d7b,_0x3a1d87,_0x1c0243,_0x5812e6){var _0x11a5f4,_0x451e5d,_0x5bf505;_0x1c0243[_0x39de('0x80')]=intUtil[_0x39de('0x7f')](_0x1c0243[_0x39de('0x80')]);_0x1c0243[_0x39de('0x81')]=intUtil[_0x39de('0x7f')](_0x1c0243[_0x39de('0x81')]);if(_0x5812e6&&_0x5812e6[_0x39de('0x93')]&&_0x5812e6[_0x39de('0x93')]!==_0x39de('0x94')){logger[_0x39de('0x2e')](_0x39de('0x95'),'Recording\x20is\x20enabled!');_0x46aa4d[_0x39de('0x84')]=_0x1c0243['serverUrl']+_0x39de('0x85')+_0x46aa4d['uniqueid']+_0x39de('0x87')+md5(_0x46aa4d[_0x39de('0x86')]);}var _0x564d6d=_0x1c0243[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x1c0243)[_0x39de('0x29')](function(_0x4ab7ee){_0x5bf505=_0x4ab7ee;return getUser(_0x5bf505,_0x564d6d,_0x1c0243,_0x474d7b[_0x39de('0x37')]);})[_0x39de('0x29')](function(_0x6acc5c){_0x11a5f4=_0x6acc5c;logger['info'](_0x39de('0x8a'),_0x11a5f4['id']);return getEndUser(_0x5bf505,_0x564d6d,_0x1c0243,_0x46aa4d[_0x39de('0x96')],_0x46aa4d[_0x39de('0x97')],_0x11a5f4,_0x4d0920);})[_0x39de('0x29')](function(_0x159189){_0x451e5d=_0x159189;return getCall(_0x5bf505,_0x564d6d,_0x1c0243,_0x11a5f4,_0x451e5d,_0x4d0920,_0x46aa4d,_0x39de('0x98'));})['then'](function(_0x57f085){if(_0x57f085){logger[_0x39de('0x2e')](_0x39de('0x8d'),_0x57f085['id']);logger[_0x39de('0x2e')](_0x39de('0x95'),_0x39de('0x8f'));emit(util[_0x39de('0x61')](_0x39de('0x90'),_0x474d7b[_0x39de('0x18')]),_0x39de('0x99'),{'uri':_0x39de('0x91')+_0x1c0243[_0x39de('0x80')]+_0x39de('0x92')+_0x57f085['id']});}})[_0x39de('0x2b')](function(_0x33ab49){logger[_0x39de('0x2c')](_0x39de('0x95'),JSON[_0x39de('0xd')](_0x33ab49));});};exports[_0x39de('0x9a')]=function(_0x374709,_0x384206,_0x10a5a4,_0x1d5197,_0x4d360b,_0x21e284){var _0x5331eb,_0x20696e,_0x21ba5e;_0x21e284[_0x39de('0x80')]=intUtil['stripTrailingSlash'](_0x21e284[_0x39de('0x80')]);_0x21e284['serverUrl']=intUtil[_0x39de('0x7f')](_0x21e284[_0x39de('0x81')]);if(_0x4d360b&&_0x4d360b[_0x39de('0x82')]){logger[_0x39de('0x2e')]('['+_0x384206[_0x39de('0x67')][_0x39de('0x9b')]()+']',_0x39de('0x83'));_0x384206[_0x39de('0x84')]=_0x21e284[_0x39de('0x81')]+_0x39de('0x85')+_0x384206[_0x39de('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x384206[_0x39de('0x86')]);}else{_0x384206[_0x39de('0x84')]='';}var _0x265edb=_0x21e284[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x21e284)['then'](function(_0x2b2dae){_0x21ba5e=_0x2b2dae;return getUser(_0x21ba5e,_0x265edb,_0x21e284);})[_0x39de('0x29')](function(_0x3e5dfa){_0x5331eb=_0x3e5dfa;logger[_0x39de('0x2e')](_0x39de('0x8a'),_0x5331eb['id']);return getEndUser(_0x21ba5e,_0x265edb,_0x21e284,_0x384206[_0x39de('0x8b')],_0x384206[_0x39de('0x8c')],_0x5331eb,_0x10a5a4);})[_0x39de('0x29')](function(_0x343ead){_0x20696e=_0x343ead;return getCall(_0x21ba5e,_0x265edb,_0x21e284,_0x5331eb,_0x20696e,_0x10a5a4,_0x384206,_0x39de('0x77'));})[_0x39de('0x29')](function(_0x1e8e2d){if(_0x1e8e2d){logger['info'](_0x39de('0x8d'),_0x1e8e2d['id']);}})['catch'](function(_0x44a809){logger[_0x39de('0x2c')]('['+_0x384206[_0x39de('0x67')]['toUpperCase']()+']',JSON[_0x39de('0xd')](_0x44a809));});}; \ No newline at end of file +var _0xebef=['Recording\x20is\x20enabled!','recordingURL','uniqueid','com','email','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','stringify','length','forEach','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','add','seconds','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','startCase','Error:\x20','log','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Owner','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x523490,_0x5d4cf2){var _0x342a64=function(_0x2ab604){while(--_0x2ab604){_0x523490['push'](_0x523490['shift']());}};_0x342a64(++_0x5d4cf2);}(_0xebef,0xb2));var _0xfebe=function(_0x331a05,_0xd59ee5){_0x331a05=_0x331a05-0x0;var _0x4dd7da=_0xebef[_0x331a05];return _0x4dd7da;};'use strict';var _=require(_0xfebe('0x0'));var rp=require(_0xfebe('0x1'));var md5=require(_0xfebe('0x2'));var util=require(_0xfebe('0x3'));var intUtil=require(_0xfebe('0x4'));var moment=require(_0xfebe('0x5'));var Redis=require(_0xfebe('0x6'));var BPromise=require('bluebird');var config=require(_0xfebe('0x7'));var logger=require(_0xfebe('0x8'))(_0xfebe('0x9'));config[_0xfebe('0xa')]=_[_0xfebe('0xb')](config[_0xfebe('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfebe('0xa')]));function emit(_0x234c36,_0x170bc5,_0x127f2b){io['to'](_0x234c36)[_0xfebe('0xc')](_0x170bc5,_0x127f2b);}function request(_0x4c7412){logger[_0xfebe('0xd')](_0xfebe('0xe'),JSON[_0xfebe('0xf')](_0x4c7412));return rp(_0x4c7412);}function getCustomFields(_0x5a69fb,_0x596c39){var _0x28cb4e={};if(_0x5a69fb[_0xfebe('0x10')]>0x0){_[_0xfebe('0x11')](_0x5a69fb,function(_0x130f64){if(_['includes'](['string',_0xfebe('0x12')],_0x130f64[_0xfebe('0x13')])&&_0x130f64[_0xfebe('0x14')]){_0x28cb4e[_0x130f64['idField']]=_0x130f64['content'][_0xfebe('0x15')]();}else if(_0x130f64[_0xfebe('0x13')]===_0xfebe('0x16')&&_0x130f64[_0xfebe('0x17')]&&_0x130f64['idField']&&_0x596c39[_0x130f64[_0xfebe('0x17')]]){_0x28cb4e[_0x130f64[_0xfebe('0x14')]]=_0x596c39[_0x130f64[_0xfebe('0x17')]]['toString']();}else if(_0x130f64[_0xfebe('0x13')]===_0xfebe('0x18')&&_0x130f64[_0xfebe('0x19')]&&_0x130f64['Variable'][_0xfebe('0x1a')]&&_0x130f64[_0xfebe('0x14')]&&_0x596c39[_0x130f64[_0xfebe('0x19')][_0xfebe('0x1a')][_0xfebe('0x1b')]()]){_0x28cb4e[_0x130f64[_0xfebe('0x14')]]=_0x596c39[_0x130f64[_0xfebe('0x19')]['name']['toLowerCase']()]['toString']();}});}return _0x28cb4e;}function getName(_0x29f738){if(_0x29f738['indexOf']('\x20')>0x0){var _0x3ef943=_0x29f738[_0xfebe('0x1c')](/ (.+)/);if(_0x3ef943[0x1]){return _0x3ef943;}}return[_0x29f738,_0x29f738];}var accountsTokens={};function getAccessToken(_0x1ade51){return new Promise(function(_0x39aded,_0xe91201){if(!_[_0xfebe('0x1d')](accountsTokens[_0x1ade51['id']])&&!_[_0xfebe('0x1d')](accountsTokens[_0x1ade51['id']][_0xfebe('0x1e')])){if(moment()[_0xfebe('0x1f')](accountsTokens[_0x1ade51['id']][_0xfebe('0x20')])){_0x39aded(accountsTokens[_0x1ade51['id']][_0xfebe('0x1e')]);}}var _0x133b08;switch(_0x1ade51[_0xfebe('0x21')]){case'US':_0x133b08=_0xfebe('0x22');break;case'AU':_0x133b08=_0xfebe('0x23');break;case'EU':_0x133b08=_0xfebe('0x24');break;case'IN':_0x133b08=_0xfebe('0x25');break;case'CN':_0x133b08=_0xfebe('0x26');break;default:_0x133b08=_0xfebe('0x24');break;}var _0x54804b={'method':_0xfebe('0x27'),'uri':_0x133b08+_0xfebe('0x28'),'qs':{'refresh_token':_0x1ade51[_0xfebe('0x29')],'client_id':_0x1ade51[_0xfebe('0x2a')],'client_secret':_0x1ade51['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x54804b)['then'](function(_0x150c95){accountsTokens[_0x1ade51['id']]={'access_token':_0x150c95[_0xfebe('0x1e')],'expires_in':moment()[_0xfebe('0x2b')](_0x150c95[_0xfebe('0x20')],_0xfebe('0x2c'))};_0x39aded(_0x150c95[_0xfebe('0x1e')]);})['catch'](function(_0x3b74a0){logger['error'](_0xfebe('0x2d'),_0x3b74a0[_0xfebe('0x2e')]);_0xe91201(_0x3b74a0);});});}function getUser(_0x488fb0,_0x15968f,_0x5e21a4,_0x14a38a){logger[_0xfebe('0x2f')]('Search\x20user');return request({'method':_0xfebe('0x30'),'uri':util[_0xfebe('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x15968f),'qs':{'type':_0xfebe('0x32')},'headers':{'Authorization':_0xfebe('0x33')+_0x488fb0},'json':!![]})[_0xfebe('0x34')](function(_0x276567){if(_0x276567['users']){var _0x15411b=-0x1;if(_['isArrayLikeObject'](_0x276567[_0xfebe('0x35')])){if(!_[_0xfebe('0x1d')](_0x14a38a)){_0x15411b=_[_0xfebe('0x36')](_0x276567[_0xfebe('0x35')],function(_0x7ef478){return _0x7ef478['email']===_0x14a38a;});}if(_0x15411b>=0x0){logger[_0xfebe('0x2f')](_0xfebe('0x37'));}else{logger[_0xfebe('0x2f')](_0xfebe('0x38'));_0x15411b=_['findIndex'](_0x276567['users'],function(_0x666165){return _0x666165[_0xfebe('0x39')][_0xfebe('0x1a')]==='Administrator';});}return _0x276567['users'][_0x15411b];}else{if(_0x276567[_0xfebe('0x3a')]['profile']['name']===_0xfebe('0x3b')){logger[_0xfebe('0x2f')](_0xfebe('0x38'));user=_0x276567[_0xfebe('0x3a')];return user;}else{logger[_0xfebe('0x3c')](_0xfebe('0x3d'),JSON['stringify'](_0x276567));throw new Error(_0xfebe('0x3e')+JSON['stringify'](_0x276567));}}}else{logger[_0xfebe('0x3c')](_0xfebe('0x3d'),JSON[_0xfebe('0xf')](_0x276567));throw new Error(_0xfebe('0x3e')+JSON['stringify'](_0x276567));}})[_0xfebe('0x3f')](function(_0x584b70){console['error'](_0x584b70);});}function getZohoUser(_0x20e721,_0x12c4b8){return new BPromise(function(_0x275035,_0x6a286){request(_0x20e721)['then'](function(_0x4acd19){var _0x50d3b7=null;if(_0x4acd19){_0x50d3b7=_0x4acd19[_0xfebe('0x40')][0x0];_0x50d3b7[_0xfebe('0x41')]=_0x12c4b8;}_0x275035(_0x50d3b7);})[_0xfebe('0x3f')](function(_0x5f0c28){_0x6a286(_0x5f0c28);});});}function createEndUser(_0x27be50,_0xd3b2a,_0x4120a4,_0x16d8fb,_0x2aaa27,_0x11fa2){var _0x4120a4=getName(_0x4120a4);return request({'method':_0xfebe('0x27'),'uri':_0xfebe('0x42')+_0xd3b2a+'/crm/v2/'+_['startCase'](_0x11fa2[_0xfebe('0x43')])+'s','body':{'data':[{'Last_Name':_0x4120a4[0x1],'First_Name':_0x4120a4[0x0],'Phone':_0x16d8fb,'Owner':{'name':!_['isNil'](_0x2aaa27[_0xfebe('0x44')]['name'])?_0x2aaa27[_0xfebe('0x44')][_0xfebe('0x1a')]:!_['isNil'](_0x2aaa27[_0xfebe('0x45')])?_0x2aaa27[_0xfebe('0x45')]+'\x20'+_0x2aaa27[_0xfebe('0x46')]:_0x2aaa27[_0xfebe('0x46')],'id':_0x2aaa27['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x27be50},'json':!![]})[_0xfebe('0x34')](function(_0x1a6fdb){if(_0x1a6fdb&&_0x1a6fdb[_0xfebe('0x40')][0x0][_0xfebe('0x47')]===_0xfebe('0x48')){var _0x19a760=_0x1a6fdb[_0xfebe('0x40')][0x0]['details'];_0x19a760[_0xfebe('0x41')]=_[_0xfebe('0x49')](_0x11fa2[_0xfebe('0x43')])+'s';return _0x19a760;}logger[_0xfebe('0x3c')]('The\x20failing\x20result\x20is',JSON[_0xfebe('0xf')](data));throw new Error(_0xfebe('0x4a')+JSON[_0xfebe('0xf')](data));})['catch'](function(_0x28c0fb){console[_0xfebe('0x4b')]('CREATE\x20ERROR',_0x28c0fb);});}function getEndUser(_0x1d1018,_0x577ded,_0x42eac1,_0x40a5b1,_0x1ffbae,_0x3e3d4e,_0x3860e2){var _0x5f029e={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1d1018},'json':!![]};switch(_0x3860e2[_0xfebe('0x4c')]){case _0xfebe('0x4d'):_0x5f029e[_0xfebe('0x4e')]=_0xfebe('0x42')+_0x577ded+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1ffbae+'))';return getZohoUser(_0x5f029e,_0xfebe('0x4f'))[_0xfebe('0x34')](function(_0x528d80){if(_0x528d80)return _0x528d80;_0x5f029e[_0xfebe('0x4e')]=_0xfebe('0x42')+_0x577ded+_0xfebe('0x50')+_0x1ffbae+'))';return getZohoUser(_0x5f029e,_0xfebe('0x51'))[_0xfebe('0x34')](function(_0x719a2c){if(_0x719a2c)return _0x719a2c;if(_0x3860e2[_0xfebe('0x43')]!=_0xfebe('0x52')){return createEndUser(_0x1d1018,_0x577ded,_0x40a5b1,_0x1ffbae,_0x3e3d4e,_0x3860e2);}else{return{};}});});break;case'contact':_0x5f029e['uri']=_0xfebe('0x42')+_0x577ded+_0xfebe('0x53')+_0x1ffbae+'))';return getZohoUser(_0x5f029e,_0xfebe('0x4f'))['then'](function(_0x2931f6){if(_0x2931f6)return _0x2931f6;if(_0x3860e2[_0xfebe('0x43')]!=_0xfebe('0x52')){return createEndUser(_0x1d1018,_0x577ded,_0x40a5b1,_0x1ffbae,_0x3e3d4e,_0x3860e2);}else{return{};}});break;case _0xfebe('0x54'):_0x5f029e[_0xfebe('0x4e')]=_0xfebe('0x42')+_0x577ded+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1ffbae+'))';return getZohoUser(_0x5f029e,_0xfebe('0x51'))[_0xfebe('0x34')](function(_0x2ba02f){if(_0x2ba02f)return _0x2ba02f;if(_0x3860e2['moduleCreate']!=_0xfebe('0x52')){return createEndUser(_0x1d1018,_0x577ded,_0x40a5b1,_0x1ffbae,_0x3e3d4e,_0x3860e2);}else{return{};}});break;}}function getCall(_0xfbc171,_0x1648f4,_0x366fde,_0x26bc2f,_0x229745,_0x35721d,_0x48098c,_0x2ee704){logger[_0xfebe('0x2f')]('Creating\x20new\x20call...');var _0x37ba53={};_0x37ba53[_0xfebe('0x55')]={'name':!_[_0xfebe('0x1d')](_0x26bc2f['role'][_0xfebe('0x1a')])&&!_[_0xfebe('0x1d')](_0x26bc2f[_0xfebe('0x39')][_0xfebe('0x1a')])&&_0x26bc2f['profile'][_0xfebe('0x1a')]==='administrator'?_0x26bc2f['role']['name']:!_[_0xfebe('0x1d')](_0x26bc2f['first_name'])?_0x26bc2f[_0xfebe('0x45')]+'\x20'+_0x26bc2f['last_name']:_0x26bc2f[_0xfebe('0x46')],'id':_0x26bc2f['id']};_0x37ba53[_0xfebe('0x56')]=intUtil[_0xfebe('0x57')](_0x35721d[_0xfebe('0x58')],_0x48098c,'\x20');_0x37ba53[_0xfebe('0x59')]=intUtil[_0xfebe('0x57')](_0x35721d[_0xfebe('0x5a')],_0x48098c,'\x0a');if(_0x229745[_0xfebe('0x41')]==='Contacts'){_0x37ba53['Who_Id']={'name':!_[_0xfebe('0x1d')](_0x229745[_0xfebe('0x5b')])?_0x229745[_0xfebe('0x5b')]:!_[_0xfebe('0x1d')](_0x229745[_0xfebe('0x5c')])?_0x229745[_0xfebe('0x5c')]+'\x20'+_0x229745[_0xfebe('0x5d')]:_0x229745['Last_Name'],'id':_0x229745['id']};}if(_0x229745[_0xfebe('0x41')]===_0xfebe('0x51')){_0x37ba53[_0xfebe('0x5e')]={'name':!_['isNil'](_0x229745[_0xfebe('0x5b')])?_0x229745['Full_Name']:!_['isNil'](_0x229745[_0xfebe('0x5c')])?_0x229745['First_Name']+'\x20'+_0x229745[_0xfebe('0x5d')]:_0x229745[_0xfebe('0x5d')],'id':_0x229745['id']};_0x37ba53[_0xfebe('0x5f')]=_[_0xfebe('0x49')](_0x229745['enduserType']);}if(_0x48098c[_0xfebe('0x60')]){_0x37ba53[_0xfebe('0x61')]=moment[_0xfebe('0x62')](parseInt(_0x48098c[_0xfebe('0x60')])*0x3e8)[_0xfebe('0x31')](_0xfebe('0x63'));}else if(_0x48098c[_0xfebe('0x64')]&&_0x48098c[_0xfebe('0x65')]){_0x37ba53[_0xfebe('0x61')]=moment['utc'](moment(_0x48098c['endtime'],_0xfebe('0x66'))[_0xfebe('0x67')](moment(_0x48098c['starttime'],_0xfebe('0x66'))))[_0xfebe('0x31')](_0xfebe('0x63'));}switch(_0x48098c[_0xfebe('0x68')]){case _0xfebe('0x69'):_0x37ba53[_0xfebe('0x6a')]=_0xfebe('0x6b');break;case _0xfebe('0x6c'):case'connect':_0x37ba53[_0xfebe('0x6a')]=_0xfebe('0x6d');break;case _0xfebe('0x6e'):_0x37ba53['Call_Result']=_0xfebe('0x6f');break;case _0xfebe('0x70'):_0x37ba53[_0xfebe('0x6a')]='Abandoned';break;case _0xfebe('0x71'):_0x37ba53[_0xfebe('0x6a')]=_0xfebe('0x72');default:}_0x37ba53[_0xfebe('0x73')]=(_0x2ee704===_0xfebe('0x74')?moment(_0x48098c[_0xfebe('0x75')])[_0xfebe('0x31')](_0xfebe('0x66')):moment(_0x48098c['agentcalledAt'])[_0xfebe('0x31')](_0xfebe('0x66')))||moment()[_0xfebe('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x37ba53[_0xfebe('0x76')]=_0x2ee704||_0xfebe('0x77');_0x37ba53=_[_0xfebe('0x78')](_0x37ba53,getCustomFields(_0x35721d[_0xfebe('0x79')],_0x48098c));return request({'method':'POST','uri':_0xfebe('0x42')+_0x1648f4+_0xfebe('0x7a'),'headers':{'Authorization':_0xfebe('0x33')+_0xfbc171},'body':{'data':[_0x37ba53]},'json':!![]})[_0xfebe('0x34')](function(_0xc363c2){if(_0xc363c2&&_0xc363c2[_0xfebe('0x40')][0x0]['code']===_0xfebe('0x48')){logger[_0xfebe('0x2f')](_0xfebe('0x7b'));return{'id':_0xc363c2[_0xfebe('0x40')][0x0][_0xfebe('0x7c')]['id']};}})[_0xfebe('0x3f')](function(_0x1f43be){logger[_0xfebe('0x2f')](_0xfebe('0x7d'),_0x1f43be[_0xfebe('0x2e')]);console[_0xfebe('0x4b')](_0xfebe('0x7d'),_0x1f43be);});}exports[_0xfebe('0x7e')]=function(_0xb3ff81,_0x38e0fc,_0x5e27a1,_0x2c8641,_0x22d87b,_0x3cceba){var _0x3687af,_0x90cab,_0x3cfad5;_0x3cceba[_0xfebe('0x7f')]=intUtil[_0xfebe('0x80')](_0x3cceba['host']);_0x3cceba[_0xfebe('0x81')]=intUtil[_0xfebe('0x80')](_0x3cceba[_0xfebe('0x81')]);if(_0x22d87b&&_0x22d87b[_0xfebe('0x82')]){logger['info'](_0xfebe('0x83'),_0xfebe('0x84'));_0x38e0fc[_0xfebe('0x85')]=_0x3cceba[_0xfebe('0x81')]+'/api/voice/recordings/'+_0x38e0fc[_0xfebe('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x38e0fc[_0xfebe('0x86')]);}else{_0x38e0fc[_0xfebe('0x85')]='';}var _0x2770d3=_0x3cceba[_0xfebe('0x7f')]==='zoho.eu'?'eu':_0xfebe('0x87');return getAccessToken(_0x3cceba)[_0xfebe('0x34')](function(_0x5ce2cd){_0x3cfad5=_0x5ce2cd;return getUser(_0x3cfad5,_0x2770d3,_0x3cceba,_0x2c8641[_0xfebe('0x88')]);})['then'](function(_0x2b5859){_0x3687af=_0x2b5859;logger[_0xfebe('0x2f')]('The\x20User\x20ID\x20is:',_0x3687af['id']);return getEndUser(_0x3cfad5,_0x2770d3,_0x3cceba,_0x38e0fc[_0xfebe('0x89')],_0x38e0fc[_0xfebe('0x8a')],_0x3687af,_0x5e27a1);})[_0xfebe('0x34')](function(_0x2b455b){_0x90cab=_0x2b455b;return getCall(_0x3cfad5,_0x2770d3,_0x3cceba,_0x3687af,_0x90cab,_0x5e27a1,_0x38e0fc,'Inbound');})[_0xfebe('0x34')](function(_0xcc7260){if(_0xcc7260){logger['info'](_0xfebe('0x8b'),_0xcc7260['id']);logger[_0xfebe('0x2f')](_0xfebe('0x83'),_0xfebe('0x8c'));emit(util['format'](_0xfebe('0x8d'),_0x2c8641[_0xfebe('0x1a')]),_0xfebe('0x8e'),{'uri':_0xfebe('0x8f')+_0x3cceba[_0xfebe('0x7f')]+_0xfebe('0x90')+_0xcc7260['id']});}})['catch'](function(_0x37a60b){logger[_0xfebe('0x3c')](_0xfebe('0x83'),JSON['stringify'](_0x37a60b));});};exports[_0xfebe('0x74')]=function(_0x270e5e,_0x418e50,_0x5e5167,_0xdc66a0,_0x7e10d8,_0x41c15c,_0x1a72b1){var _0x410297,_0x12a1e1,_0x50874b;_0x41c15c[_0xfebe('0x7f')]=intUtil['stripTrailingSlash'](_0x41c15c[_0xfebe('0x7f')]);_0x41c15c[_0xfebe('0x81')]=intUtil[_0xfebe('0x80')](_0x41c15c['serverUrl']);if(_0x1a72b1&&_0x1a72b1[_0xfebe('0x91')]&&_0x1a72b1['recordingFormat']!=='none'){logger[_0xfebe('0x2f')](_0xfebe('0x92'),_0xfebe('0x84'));_0x418e50['recordingURL']=_0x41c15c[_0xfebe('0x81')]+_0xfebe('0x93')+_0x418e50[_0xfebe('0x86')]+_0xfebe('0x94')+md5(_0x418e50['uniqueid']);}var _0x58875e=_0x41c15c[_0xfebe('0x7f')]==='zoho.eu'?'eu':_0xfebe('0x87');return getAccessToken(_0x41c15c)['then'](function(_0x380609){_0x50874b=_0x380609;return getUser(_0x50874b,_0x58875e,_0x41c15c,_0xdc66a0['email']);})[_0xfebe('0x34')](function(_0x5f2625){_0x410297=_0x5f2625;logger[_0xfebe('0x2f')](_0xfebe('0x95'),_0x410297['id']);return getEndUser(_0x50874b,_0x58875e,_0x41c15c,_0x418e50[_0xfebe('0x96')],_0x418e50[_0xfebe('0x97')],_0x410297,_0x5e5167);})[_0xfebe('0x34')](function(_0x497a5e){_0x12a1e1=_0x497a5e;return getCall(_0x50874b,_0x58875e,_0x41c15c,_0x410297,_0x12a1e1,_0x5e5167,_0x418e50,_0xfebe('0x98'));})['then'](function(_0x51e4a1){if(_0x51e4a1){logger[_0xfebe('0x2f')](_0xfebe('0x8b'),_0x51e4a1['id']);logger[_0xfebe('0x2f')]('[OUTBOUND]',_0xfebe('0x8c'));emit(util[_0xfebe('0x31')](_0xfebe('0x8d'),_0xdc66a0[_0xfebe('0x1a')]),_0xfebe('0x8e'),{'uri':'https://crm.'+_0x41c15c['host']+_0xfebe('0x90')+_0x51e4a1['id']});}})['catch'](function(_0x11f16f){logger[_0xfebe('0x3c')](_0xfebe('0x92'),JSON[_0xfebe('0xf')](_0x11f16f));});};exports[_0xfebe('0x99')]=function(_0xe32724,_0x25c6a1,_0x34752a,_0xaa9528,_0x52fb90,_0x268ec3){var _0x4ad938,_0x52849f,_0x4dbf56;_0x268ec3[_0xfebe('0x7f')]=intUtil['stripTrailingSlash'](_0x268ec3['host']);_0x268ec3[_0xfebe('0x81')]=intUtil[_0xfebe('0x80')](_0x268ec3['serverUrl']);if(_0x52fb90&&_0x52fb90[_0xfebe('0x82')]){logger[_0xfebe('0x2f')]('['+_0x25c6a1[_0xfebe('0x68')][_0xfebe('0x9a')]()+']',_0xfebe('0x84'));_0x25c6a1[_0xfebe('0x85')]=_0x268ec3['serverUrl']+_0xfebe('0x93')+_0x25c6a1[_0xfebe('0x86')]+_0xfebe('0x94')+md5(_0x25c6a1[_0xfebe('0x86')]);}else{_0x25c6a1['recordingURL']='';}var _0x454147=_0x268ec3[_0xfebe('0x7f')]==='zoho.eu'?'eu':_0xfebe('0x87');return getAccessToken(_0x268ec3)[_0xfebe('0x34')](function(_0xe3fb0e){_0x4dbf56=_0xe3fb0e;return getUser(_0x4dbf56,_0x454147,_0x268ec3);})[_0xfebe('0x34')](function(_0x540ea9){_0x4ad938=_0x540ea9;logger['info'](_0xfebe('0x95'),_0x4ad938['id']);return getEndUser(_0x4dbf56,_0x454147,_0x268ec3,_0x25c6a1['calleridname'],_0x25c6a1[_0xfebe('0x8a')],_0x4ad938,_0x34752a);})['then'](function(_0x538746){_0x52849f=_0x538746;return getCall(_0x4dbf56,_0x454147,_0x268ec3,_0x4ad938,_0x52849f,_0x34752a,_0x25c6a1,_0xfebe('0x77'));})[_0xfebe('0x34')](function(_0x14d4b5){if(_0x14d4b5){logger['info'](_0xfebe('0x8b'),_0x14d4b5['id']);}})['catch'](function(_0x58ced7){logger[_0xfebe('0x3c')]('['+_0x25c6a1['lastevent'][_0xfebe('0x9a')]()+']',JSON['stringify'](_0x58ced7));});}; \ 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 7e4360d..aa737ac 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 _0xa26d=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','exec','data2','Script','data3','render'];(function(_0xa81ad1,_0x3c10b8){var _0xb9d9f=function(_0x20f06a){while(--_0x20f06a){_0xa81ad1['push'](_0xa81ad1['shift']());}};_0xb9d9f(++_0x3c10b8);}(_0xa26d,0x14f));var _0xda26=function(_0x15c692,_0x414976){_0x15c692=_0x15c692-0x0;var _0x39abf4=_0xa26d[_0x15c692];return _0x39abf4;};'use strict';var util=require('util');var sh=require(_0xda26('0x0'));var Mustache=require('mustache');var logger=require(_0xda26('0x1'))('trigger');exports[_0xda26('0x2')]=function(_0x3d9f3e,_0x209506){var _0x4a6193=_0x3d9f3e[_0xda26('0x3')]?_0x3d9f3e[_0xda26('0x3')]:_0xda26('0x4');var _0x261e4e=_0x3d9f3e[_0xda26('0x5')]?Mustache[_0xda26('0x6')](_0x3d9f3e[_0xda26('0x5')],_0x209506):_0x209506;sh[_0xda26('0x2')](_0x261e4e,function(_0x33b46d,_0x33bc66,_0x5d6da1){if(_0x33b46d!==0x0){logger['error'](util[_0xda26('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4a6193,_0x261e4e,_0x33b46d,_0x5d6da1));}else{logger['info'](util['format'](_0xda26('0x8'),_0x4a6193,_0x261e4e,_0x33bc66));}});}; \ No newline at end of file +var _0x640b=['shelljs','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','info'];(function(_0x185a5a,_0x19442b){var _0x39bd2d=function(_0xfe0213){while(--_0xfe0213){_0x185a5a['push'](_0x185a5a['shift']());}};_0x39bd2d(++_0x19442b);}(_0x640b,0x129));var _0xb640=function(_0x42cb8d,_0x273bca){_0x42cb8d=_0x42cb8d-0x0;var _0x2713b6=_0x640b[_0x42cb8d];return _0x2713b6;};'use strict';var util=require('util');var sh=require(_0xb640('0x0'));var Mustache=require('mustache');var logger=require(_0xb640('0x1'))(_0xb640('0x2'));exports[_0xb640('0x3')]=function(_0x5c716f,_0x1486b1){var _0x34abe7=_0x5c716f['data2']?_0x5c716f[_0xb640('0x4')]:_0xb640('0x5');var _0x553d5b=_0x5c716f[_0xb640('0x6')]?Mustache[_0xb640('0x7')](_0x5c716f['data3'],_0x1486b1):_0x1486b1;sh['exec'](_0x553d5b,function(_0x4bb6b1,_0x4128bc,_0x5281ab){if(_0x4bb6b1!==0x0){logger[_0xb640('0x8')](util[_0xb640('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x34abe7,_0x553d5b,_0x4bb6b1,_0x5281ab));}else{logger[_0xb640('0xa')](util[_0xb640('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x34abe7,_0x553d5b,_0x4128bc));}});}; \ 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 4a6f22d..580e0ce 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 _0x491a=['data6','data1','GET','POST','PUT','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','statusCode','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','trigger','exec','toUpperCase','render','data5','number'];(function(_0x227edb,_0x54f5d7){var _0xe0abd1=function(_0x488448){while(--_0x488448){_0x227edb['push'](_0x227edb['shift']());}};_0xe0abd1(++_0x54f5d7);}(_0x491a,0x124));var _0xa491=function(_0x3c4f40,_0x302e0b){_0x3c4f40=_0x3c4f40-0x0;var _0x12032f=_0x491a[_0x3c4f40];return _0x12032f;};'use strict';var rp=require(_0xa491('0x0'));var util=require('util');var _=require(_0xa491('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xa491('0x2'));exports[_0xa491('0x3')]=function(_0x43510f,_0x340479){var _0x3a2fa7,_0x5147e6;var _0xb280a4={'method':_0x43510f['data1'][_0xa491('0x4')](),'uri':Mustache[_0xa491('0x5')](_0x43510f['data2'],_0x340479),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x43510f[_0xa491('0x6')])===_0xa491('0x7')&&parseInt(_0x43510f['data5'])>=0x1&&parseInt(_0x43510f[_0xa491('0x6')])<=0xa?parseInt(_0x43510f[_0xa491('0x6')])*0x3e8:0x5*0x3e8};try{_0xb280a4['headers']=_0x43510f[_0xa491('0x8')]?JSON['parse'](Mustache['render'](_0x43510f[_0xa491('0x8')],_0x340479)):{};}catch(_0x5771f1){logger['error'](_0x5771f1['stack']);}switch(_0x43510f[_0xa491('0x9')][_0xa491('0x4')]()){case _0xa491('0xa'):case'DELETE':_0x3a2fa7=null;_0xb280a4['qs']=_0x340479;break;case _0xa491('0xb'):case _0xa491('0xc'):if(_0x43510f[_0xa491('0xd')]){try{_0x3a2fa7=JSON[_0xa491('0xe')](Mustache[_0xa491('0x5')](_0x43510f[_0xa491('0xd')],_0x340479));_0xb280a4[_0xa491('0xf')]=_0x3a2fa7;}catch(_0xa89047){logger['error'](_0xa89047[_0xa491('0x10')]);logger['error'](_0xa491('0x11'));}}else{_0x3a2fa7=_0x340479;_0xb280a4[_0xa491('0xf')]=_0x3a2fa7;}break;}logger[_0xa491('0x12')](util[_0xa491('0x13')](_0xa491('0x14'),_0x43510f[_0xa491('0x9')],_0x43510f[_0xa491('0x15')],JSON[_0xa491('0x16')](_0xb280a4)));rp(_0xb280a4)[_0xa491('0x17')](function(_0x1de759){_0x3a2fa7=!_[_0xa491('0x18')](_0x3a2fa7)?',\x20request\x20body:\x20'+_0x3a2fa7:'';_0x5147e6=typeof _0x1de759[_0xa491('0xf')]===_0xa491('0x19')?JSON[_0xa491('0x16')](_0x1de759[_0xa491('0xf')]):_0x1de759['body'];logger[_0xa491('0x12')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x43510f['data1'],_0x43510f['data2'],_0x1de759[_0xa491('0x1a')],_0x5147e6));})['catch'](function(_0x1829cc){logger[_0xa491('0x1b')](util[_0xa491('0x13')](_0xa491('0x1c'),_0x43510f['data1'],_0x43510f[_0xa491('0x15')],_0x1829cc[_0xa491('0x1a')],_0x1829cc[_0xa491('0x1d')],_0x1829cc['message']));});}; \ No newline at end of file +var _0xec53=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','DELETE','PUT','data7','body','info','stringify','isNil'];(function(_0x4d6fe5,_0x33031f){var _0x3754af=function(_0x5d949e){while(--_0x5d949e){_0x4d6fe5['push'](_0x4d6fe5['shift']());}};_0x3754af(++_0x33031f);}(_0xec53,0xa3));var _0x3ec5=function(_0x3c274c,_0x4107e2){_0x3c274c=_0x3c274c-0x0;var _0x5c6f22=_0xec53[_0x3c274c];return _0x5c6f22;};'use strict';var rp=require(_0x3ec5('0x0'));var util=require(_0x3ec5('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x3ec5('0x2'))(_0x3ec5('0x3'));exports[_0x3ec5('0x4')]=function(_0x457163,_0xb3ce71){var _0x56ef7a,_0x3e1bed;var _0x1ae0ca={'method':_0x457163[_0x3ec5('0x5')][_0x3ec5('0x6')](),'uri':Mustache[_0x3ec5('0x7')](_0x457163[_0x3ec5('0x8')],_0xb3ce71),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x457163[_0x3ec5('0x9')])===_0x3ec5('0xa')&&parseInt(_0x457163[_0x3ec5('0x9')])>=0x1&&parseInt(_0x457163[_0x3ec5('0x9')])<=0xa?parseInt(_0x457163[_0x3ec5('0x9')])*0x3e8:0x5*0x3e8};try{_0x1ae0ca[_0x3ec5('0xb')]=_0x457163[_0x3ec5('0xc')]?JSON[_0x3ec5('0xd')](Mustache['render'](_0x457163['data6'],_0xb3ce71)):{};}catch(_0x12270e){logger[_0x3ec5('0xe')](_0x12270e[_0x3ec5('0xf')]);}switch(_0x457163['data1'][_0x3ec5('0x6')]()){case'GET':case _0x3ec5('0x10'):_0x56ef7a=null;_0x1ae0ca['qs']=_0xb3ce71;break;case'POST':case _0x3ec5('0x11'):if(_0x457163[_0x3ec5('0x12')]){try{_0x56ef7a=JSON[_0x3ec5('0xd')](Mustache['render'](_0x457163[_0x3ec5('0x12')],_0xb3ce71));_0x1ae0ca[_0x3ec5('0x13')]=_0x56ef7a;}catch(_0x2b31e8){logger[_0x3ec5('0xe')](_0x2b31e8['stack']);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x56ef7a=_0xb3ce71;_0x1ae0ca[_0x3ec5('0x13')]=_0x56ef7a;}break;}logger[_0x3ec5('0x14')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x457163['data1'],_0x457163['data2'],JSON[_0x3ec5('0x15')](_0x1ae0ca)));rp(_0x1ae0ca)['then'](function(_0x365168){_0x56ef7a=!_[_0x3ec5('0x16')](_0x56ef7a)?',\x20request\x20body:\x20'+_0x56ef7a:'';_0x3e1bed=typeof _0x365168[_0x3ec5('0x13')]===_0x3ec5('0x17')?JSON['stringify'](_0x365168[_0x3ec5('0x13')]):_0x365168[_0x3ec5('0x13')];logger[_0x3ec5('0x14')](util['format'](_0x3ec5('0x18'),_0x457163['data1'],_0x457163[_0x3ec5('0x8')],_0x365168[_0x3ec5('0x19')],_0x3e1bed));})[_0x3ec5('0x1a')](function(_0x4e37c7){logger[_0x3ec5('0xe')](util[_0x3ec5('0x1b')](_0x3ec5('0x1c'),_0x457163[_0x3ec5('0x5')],_0x457163[_0x3ec5('0x8')],_0x4e37c7[_0x3ec5('0x19')],_0x4e37c7[_0x3ec5('0x1d')],_0x4e37c7[_0x3ec5('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 40b0dd4..519f76e 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 _0x07a3=['exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','result','catch'];(function(_0x5bdd93,_0x208ccb){var _0x2caf5e=function(_0x3a8a9b){while(--_0x3a8a9b){_0x5bdd93['push'](_0x5bdd93['shift']());}};_0x2caf5e(++_0x208ccb);}(_0x07a3,0x11f));var _0x307a=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x07a3[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x307a('0x0'));var BPromise=require(_0x307a('0x1'));var logger=require(_0x307a('0x2'))(_0x307a('0x3'));var client=jayson['client'][_0x307a('0x4')]({'port':0x2329});client[_0x307a('0x5')]=function(_0x2e3eeb,_0x104f49){return new BPromise(function(_0x5860d6,_0x53aced){return client[_0x307a('0x6')](_0x2e3eeb,_0x104f49)[_0x307a('0x7')](function(_0x16ec3e){logger['debug'](_0x307a('0x8'),'routing',_0x2e3eeb,_0x104f49,_0x16ec3e);if(_0x16ec3e[_0x307a('0x9')]){logger[_0x307a('0x9')](_0x307a('0x8'),_0x307a('0x3'),_0x2e3eeb,_0x16ec3e['error']['message'],_0x104f49);return _0x53aced(_0x16ec3e[_0x307a('0x9')]['message']);}else{return _0x5860d6(_0x16ec3e[_0x307a('0xa')]);}})[_0x307a('0xb')](function(_0xb0d975){logger[_0x307a('0x9')]('rpc',_0x307a('0x3'),_0x2e3eeb,_0xb0d975,_0x104f49);return _0x53aced(_0xb0d975);});});};module[_0x307a('0xc')]=client; \ No newline at end of file +var _0x66c1=['client','http','Request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x5e11e9,_0x28f46a){var _0x84703=function(_0x12bb0a){while(--_0x12bb0a){_0x5e11e9['push'](_0x5e11e9['shift']());}};_0x84703(++_0x28f46a);}(_0x66c1,0x1ae));var _0x166c=function(_0x384bda,_0x108681){_0x384bda=_0x384bda-0x0;var _0x31e53a=_0x66c1[_0x384bda];return _0x31e53a;};'use strict';var jayson=require(_0x166c('0x0'));var BPromise=require(_0x166c('0x1'));var logger=require(_0x166c('0x2'))(_0x166c('0x3'));var client=jayson[_0x166c('0x4')][_0x166c('0x5')]({'port':0x2329});client[_0x166c('0x6')]=function(_0x59f26c,_0x32d19f){return new BPromise(function(_0x3892ed,_0x1f598e){return client['request'](_0x59f26c,_0x32d19f)[_0x166c('0x7')](function(_0x205072){logger[_0x166c('0x8')](_0x166c('0x9'),_0x166c('0x3'),_0x59f26c,_0x32d19f,_0x205072);if(_0x205072['error']){logger[_0x166c('0xa')]('rpc',_0x166c('0x3'),_0x59f26c,_0x205072['error'][_0x166c('0xb')],_0x32d19f);return _0x1f598e(_0x205072[_0x166c('0xa')][_0x166c('0xb')]);}else{return _0x3892ed(_0x205072['result']);}})[_0x166c('0xc')](function(_0x2c4334){logger[_0x166c('0xa')](_0x166c('0x9'),_0x166c('0x3'),_0x59f26c,_0x2c4334,_0x32d19f);return _0x1f598e(_0x2c4334);});});};module[_0x166c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 086bb1f..937b3ab 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 _0x7387=['resolve','then','getMailAccounts','refresh','listen','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0x7387,0x140));var _0x7738=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7387[_0x122ef9];return _0x42fba0;};'use strict';var server=require(_0x7738('0x0'));var Realtime=require(_0x7738('0x1'));var EmailChannel=require(_0x7738('0x2'));var mailAccount=require(_0x7738('0x3'));var setting=require(_0x7738('0x4'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7738('0x5')]()[_0x7738('0x6')](mailAccount[_0x7738('0x7')]())['then'](realtime['initMailAccounts']())[_0x7738('0x6')](function(){email[_0x7738('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7738('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x7738('0x6')](function(){return setting['getSettings']();})[_0x7738('0x6')](function(_0x194290){return setInterval(initRealtime,_0x194290['loginMailFrequency']*0x3e8);})[_0x7738('0xa')](function(_0x507c11){logger[_0x7738('0xb')](_0x7738('0xc'),_0x507c11);});}main(); \ No newline at end of file +var _0x3713=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3713,0x186));var _0x3371=function(_0x286855,_0x2747ad){_0x286855=_0x286855-0x0;var _0x3644c9=_0x3713[_0x286855];return _0x3644c9;};'use strict';var server=require(_0x3371('0x0'));var Realtime=require(_0x3371('0x1'));var EmailChannel=require(_0x3371('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3371('0x3'));var logger=require(_0x3371('0x4'))(_0x3371('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3371('0x6')]()[_0x3371('0x7')](mailAccount[_0x3371('0x8')]())['then'](realtime[_0x3371('0x9')]())[_0x3371('0x7')](function(){email[_0x3371('0xa')](realtime[_0x3371('0xb')]);return realtime;});}function main(){return server[_0x3371('0xc')](realtime,email)[_0x3371('0x7')](function(){return initRealtime();})[_0x3371('0x7')](function(){return setting[_0x3371('0xd')]();})[_0x3371('0x7')](function(_0x36ed67){return setInterval(initRealtime,_0x36ed67[_0x3371('0xe')]*0x3e8);})[_0x3371('0xf')](function(_0x5b975b){logger[_0x3371('0x10')](_0x3371('0x11'),_0x5b975b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7723281..e0d769f 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 _0x11fa=['redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','name','Imap','isNil','stringify','emit','mailAccount:update','hasOwnProperty','active','service','provider','custom','email','bind','handleImapEmail','end','error','handleImapError','disabled','messageStatus','handleImapBox','status','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment'];(function(_0x3a9cf3,_0xb6541b){var _0x1df4a8=function(_0x3b04f0){while(--_0x3b04f0){_0x3a9cf3['push'](_0x3a9cf3['shift']());}};_0x1df4a8(++_0xb6541b);}(_0x11fa,0x189));var _0xa11f=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x11fa[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0xa11f('0x0'));var moment=require(_0xa11f('0x1'));var BPromise=require(_0xa11f('0x2'));var md5=require(_0xa11f('0x3'));var Redis=require(_0xa11f('0x4'));var config=require(_0xa11f('0x5'));var logger=require('../../../config/logger')('email');config[_0xa11f('0x6')]=_[_0xa11f('0x7')](config[_0xa11f('0x6')],{'host':_0xa11f('0x8'),'port':0x18eb});var io=require(_0xa11f('0x9'))(new Redis(config[_0xa11f('0x6')]));var EmailImap=require(_0xa11f('0xa'));var EmailSmtp=require(_0xa11f('0xb'));var mailAccount=require(_0xa11f('0xc'));var md5Accounts={};function EmailChannel(_0x26bb2c){logger[_0xa11f('0xd')]('start\x20email\x20channel');this[_0xa11f('0xe')]=_0x26bb2c['mailAccounts'];this[_0xa11f('0xf')]={};this[_0xa11f('0x10')]=new EmailSmtp();}EmailChannel[_0xa11f('0x11')]['emit']=function(_0x2e750a){var _0xc76654=this[_0xa11f('0xe')][_0x2e750a];var _0x5a5e08={'id':_0xc76654['id'],'name':_0xc76654[_0xa11f('0x12')],'key':_0xc76654['key'],'active':_0xc76654['active'],'Imap':{'status':_0xc76654[_0xa11f('0x13')]['status'],'messageStatus':_0xc76654[_0xa11f('0x13')]['messageStatus'],'total':_0xc76654[_0xa11f('0x13')]['total']}};if(_[_0xa11f('0x14')](md5Accounts[_0x2e750a])){md5Accounts[_0x2e750a]={};}var _0x46494b=md5(JSON[_0xa11f('0x15')](_0x5a5e08));if(md5Accounts[_0x2e750a][_0xa11f('0x3')]!==_0x46494b){md5Accounts[_0x2e750a]['md5']=_0x46494b;io[_0xa11f('0x16')](_0xa11f('0x17'),_0x5a5e08);}};EmailChannel[_0xa11f('0x11')]['refresh']=function(_0x5143cd){for(var _0x1b2068 in _0x5143cd){if(_0x5143cd[_0xa11f('0x18')](_0x1b2068)){if(_0x5143cd[_0x1b2068]['Imap']&&_0x5143cd[_0x1b2068][_0xa11f('0x19')]){var _0x14be8f=_0x5143cd[_0x1b2068][_0xa11f('0x13')];if(!_0x14be8f[_0xa11f('0x1a')]&&_0x5143cd[_0x1b2068][_0xa11f('0x1b')]!==_0xa11f('0x1c'))_0x14be8f[_0xa11f('0x1a')]=_0x5143cd[_0x1b2068][_0xa11f('0x1b')];if(!this[_0xa11f('0xf')][_0xa11f('0x18')](_0x14be8f['id'])){this[_0xa11f('0xf')][_0x14be8f['id']]=new EmailImap(_0x14be8f,_0x5143cd[_0x1b2068][_0xa11f('0x1d')]);this[_0xa11f('0xf')][_0x14be8f['id']]['on']('box',this['handleImapBox'][_0xa11f('0x1e')](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x1d'),this[_0xa11f('0x1f')]['bind'](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x20'),this['handleImapEnd'][_0xa11f('0x1e')](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x21'),this[_0xa11f('0x22')][_0xa11f('0x1e')](this,_0x1b2068));}}else{if(_[_0xa11f('0x14')](this[_0xa11f('0xe')][_0x1b2068][_0xa11f('0x13')])){this[_0xa11f('0xe')][_0x1b2068]['Imap']={};}this[_0xa11f('0xe')][_0x1b2068]['Imap']['status']=_0xa11f('0x23');this[_0xa11f('0xe')][_0x1b2068][_0xa11f('0x13')][_0xa11f('0x24')]='';this['emit'](_0x1b2068);}}}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x25')]=function(_0x5710ec,_0x2ba5b1){if(this[_0xa11f('0xe')][_0x5710ec]){this[_0xa11f('0xe')][_0x5710ec]['Imap'][_0xa11f('0x26')]=_0xa11f('0x27');this[_0xa11f('0xe')][_0x5710ec][_0xa11f('0x13')][_0xa11f('0x24')]=_0x2ba5b1[_0xa11f('0x12')];if(_0x2ba5b1['messages']){this[_0xa11f('0xe')][_0x5710ec][_0xa11f('0x13')]['total']=_0x2ba5b1[_0xa11f('0x28')][_0xa11f('0x29')];}return this[_0xa11f('0x16')](_0x5710ec);}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x1f')]=function(_0x2ebef8,_0x13c629){logger['info'](_0xa11f('0x2a'),_0x13c629[_0xa11f('0x2b')],_0x13c629[_0xa11f('0x2c')],_0x13c629[_0xa11f('0x2d')],_0x2ebef8);if(this[_0xa11f('0xe')][_0x2ebef8]){return mailAccount['notify'](_0x2ebef8,_0x13c629)[_0xa11f('0x2e')](function(_0x21c133){if(_0x21c133){logger[_0xa11f('0xd')](_0xa11f('0x2f'));}})[_0xa11f('0x30')](function(_0x3bcace){logger[_0xa11f('0x21')](_0xa11f('0x31'),JSON[_0xa11f('0x15')](_0x3bcace));});}};EmailChannel[_0xa11f('0x11')]['handleImapEnd']=function(_0x4b8a12){if(this['mailAccounts'][_0x4b8a12]&&this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]){if(this[_0xa11f('0xf')][this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]['id']]){delete this[_0xa11f('0xf')][this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]['id']];}this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')][_0xa11f('0x32')]=moment();this[_0xa11f('0x16')](_0x4b8a12);}};EmailChannel[_0xa11f('0x11')]['handleImapError']=function(_0x496885,_0x18edc0){if(this[_0xa11f('0xe')][_0x496885]){this[_0xa11f('0xe')][_0x496885]['Imap'][_0xa11f('0x26')]=_0xa11f('0x21');this[_0xa11f('0xe')][_0x496885][_0xa11f('0x13')][_0xa11f('0x24')]=_0x18edc0;return this[_0xa11f('0x16')](_0x496885);}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x33')]=function(_0x124715,_0x21d1cb){return this[_0xa11f('0x10')][_0xa11f('0x34')](_0x124715,_0x21d1cb);};EmailChannel[_0xa11f('0x11')][_0xa11f('0x35')]=function(_0x1d1176){var _0x376c8e=this;if(this['mailAccounts'][_0x1d1176['id']]){if(_['isNil'](this[_0xa11f('0xe')][_0x1d1176['id']]['Smtp'])){this[_0xa11f('0xe')][_0x1d1176['id']]['Smtp']={};}this[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x32')]=moment();return new BPromise(function(_0x36964b,_0x1cf10a){return _0x376c8e[_0xa11f('0x10')][_0xa11f('0x37')](_0x1d1176)[_0xa11f('0x2e')](function(_0x53e9ff){_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x26')]='verified';_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x24')]='';_0x376c8e['emit'](_0x1d1176['id']);_0x36964b(_0x53e9ff);})[_0xa11f('0x30')](function(_0x5557cb){_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x26')]=_0xa11f('0x21');_0x376c8e['mailAccounts'][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x24')]=_0x5557cb;_0x376c8e[_0xa11f('0x16')](_0x1d1176['id']);_0x1cf10a(_0x5557cb);});});}return this[_0xa11f('0x10')]['verify'](_0x1d1176);};module[_0xa11f('0x38')]=EmailChannel; \ No newline at end of file +var _0xc2ad=['handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','status','messageStatus','Imap','total','isNil','stringify','hasOwnProperty','custom','service','imapAccounts','box'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0xc2ad,0x88));var _0xdc2a=function(_0x17b2f8,_0x595beb){_0x17b2f8=_0x17b2f8-0x0;var _0x312fa5=_0xc2ad[_0x17b2f8];return _0x312fa5;};'use strict';var _=require(_0xdc2a('0x0'));var moment=require(_0xdc2a('0x1'));var BPromise=require(_0xdc2a('0x2'));var md5=require(_0xdc2a('0x3'));var Redis=require(_0xdc2a('0x4'));var config=require('../../../config/environment');var logger=require(_0xdc2a('0x5'))(_0xdc2a('0x6'));config[_0xdc2a('0x7')]=_['defaults'](config[_0xdc2a('0x7')],{'host':_0xdc2a('0x8'),'port':0x18eb});var io=require(_0xdc2a('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xdc2a('0xa'));var mailAccount=require(_0xdc2a('0xb'));var md5Accounts={};function EmailChannel(_0x49cc14){logger[_0xdc2a('0xc')](_0xdc2a('0xd'));this[_0xdc2a('0xe')]=_0x49cc14[_0xdc2a('0xe')];this['imapAccounts']={};this[_0xdc2a('0xf')]=new EmailSmtp();}EmailChannel[_0xdc2a('0x10')][_0xdc2a('0x11')]=function(_0x1c97ef){var _0x4d0b22=this[_0xdc2a('0xe')][_0x1c97ef];var _0x23657={'id':_0x4d0b22['id'],'name':_0x4d0b22[_0xdc2a('0x12')],'key':_0x4d0b22[_0xdc2a('0x13')],'active':_0x4d0b22[_0xdc2a('0x14')],'Imap':{'status':_0x4d0b22['Imap'][_0xdc2a('0x15')],'messageStatus':_0x4d0b22['Imap'][_0xdc2a('0x16')],'total':_0x4d0b22[_0xdc2a('0x17')][_0xdc2a('0x18')]}};if(_[_0xdc2a('0x19')](md5Accounts[_0x1c97ef])){md5Accounts[_0x1c97ef]={};}var _0xfb920a=md5(JSON[_0xdc2a('0x1a')](_0x23657));if(md5Accounts[_0x1c97ef][_0xdc2a('0x3')]!==_0xfb920a){md5Accounts[_0x1c97ef][_0xdc2a('0x3')]=_0xfb920a;io['emit']('mailAccount:update',_0x23657);}};EmailChannel[_0xdc2a('0x10')]['refresh']=function(_0x3f63ad){for(var _0x45e870 in _0x3f63ad){if(_0x3f63ad[_0xdc2a('0x1b')](_0x45e870)){if(_0x3f63ad[_0x45e870][_0xdc2a('0x17')]&&_0x3f63ad[_0x45e870]['active']){var _0x32914c=_0x3f63ad[_0x45e870]['Imap'];if(!_0x32914c['service']&&_0x3f63ad[_0x45e870]['provider']!==_0xdc2a('0x1c'))_0x32914c[_0xdc2a('0x1d')]=_0x3f63ad[_0x45e870]['provider'];if(!this['imapAccounts'][_0xdc2a('0x1b')](_0x32914c['id'])){this[_0xdc2a('0x1e')][_0x32914c['id']]=new EmailImap(_0x32914c,_0x3f63ad[_0x45e870][_0xdc2a('0x6')]);this[_0xdc2a('0x1e')][_0x32914c['id']]['on'](_0xdc2a('0x1f'),this[_0xdc2a('0x20')][_0xdc2a('0x21')](this,_0x45e870));this[_0xdc2a('0x1e')][_0x32914c['id']]['on'](_0xdc2a('0x6'),this[_0xdc2a('0x22')][_0xdc2a('0x21')](this,_0x45e870));this[_0xdc2a('0x1e')][_0x32914c['id']]['on'](_0xdc2a('0x23'),this[_0xdc2a('0x24')][_0xdc2a('0x21')](this,_0x45e870));this['imapAccounts'][_0x32914c['id']]['on'](_0xdc2a('0x25'),this[_0xdc2a('0x26')][_0xdc2a('0x21')](this,_0x45e870));}}else{if(_[_0xdc2a('0x19')](this['mailAccounts'][_0x45e870][_0xdc2a('0x17')])){this['mailAccounts'][_0x45e870][_0xdc2a('0x17')]={};}this['mailAccounts'][_0x45e870][_0xdc2a('0x17')][_0xdc2a('0x15')]=_0xdc2a('0x27');this[_0xdc2a('0xe')][_0x45e870][_0xdc2a('0x17')]['messageStatus']='';this[_0xdc2a('0x11')](_0x45e870);}}}};EmailChannel[_0xdc2a('0x10')]['handleImapBox']=function(_0x2178a7,_0xb2f1a8){if(this['mailAccounts'][_0x2178a7]){this[_0xdc2a('0xe')][_0x2178a7][_0xdc2a('0x17')][_0xdc2a('0x15')]=_0xdc2a('0x28');this[_0xdc2a('0xe')][_0x2178a7][_0xdc2a('0x17')][_0xdc2a('0x16')]=_0xb2f1a8[_0xdc2a('0x12')];if(_0xb2f1a8[_0xdc2a('0x29')]){this[_0xdc2a('0xe')][_0x2178a7][_0xdc2a('0x17')][_0xdc2a('0x18')]=_0xb2f1a8[_0xdc2a('0x29')][_0xdc2a('0x18')];}return this[_0xdc2a('0x11')](_0x2178a7);}};EmailChannel[_0xdc2a('0x10')][_0xdc2a('0x22')]=function(_0x220a29,_0x3a53a3){logger['info'](_0xdc2a('0x2a'),_0x3a53a3[_0xdc2a('0x2b')],_0x3a53a3['lastName'],_0x3a53a3[_0xdc2a('0x2c')],_0x220a29);if(this[_0xdc2a('0xe')][_0x220a29]){return mailAccount[_0xdc2a('0x2d')](_0x220a29,_0x3a53a3)[_0xdc2a('0x2e')](function(_0x3e3bac){if(_0x3e3bac){logger['info'](_0xdc2a('0x2f'));}})[_0xdc2a('0x30')](function(_0x1bd060){logger[_0xdc2a('0x25')](_0xdc2a('0x31'),JSON[_0xdc2a('0x1a')](_0x1bd060));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x4564df){if(this[_0xdc2a('0xe')][_0x4564df]&&this[_0xdc2a('0xe')][_0x4564df][_0xdc2a('0x17')]){if(this['imapAccounts'][this[_0xdc2a('0xe')][_0x4564df][_0xdc2a('0x17')]['id']]){delete this[_0xdc2a('0x1e')][this['mailAccounts'][_0x4564df][_0xdc2a('0x17')]['id']];}this[_0xdc2a('0xe')][_0x4564df]['Imap'][_0xdc2a('0x32')]=moment();this[_0xdc2a('0x11')](_0x4564df);}};EmailChannel['prototype'][_0xdc2a('0x26')]=function(_0x3b009d,_0x3f09ab){if(this[_0xdc2a('0xe')][_0x3b009d]){this[_0xdc2a('0xe')][_0x3b009d][_0xdc2a('0x17')][_0xdc2a('0x15')]=_0xdc2a('0x25');this[_0xdc2a('0xe')][_0x3b009d]['Imap']['messageStatus']=_0x3f09ab;return this['emit'](_0x3b009d);}};EmailChannel[_0xdc2a('0x10')][_0xdc2a('0x33')]=function(_0x48edd8,_0x212de2){return this['smtp']['send'](_0x48edd8,_0x212de2);};EmailChannel[_0xdc2a('0x10')][_0xdc2a('0x34')]=function(_0x15f193){var _0x261737=this;if(this['mailAccounts'][_0x15f193['id']]){if(_['isNil'](this['mailAccounts'][_0x15f193['id']][_0xdc2a('0x35')])){this[_0xdc2a('0xe')][_0x15f193['id']]['Smtp']={};}this['mailAccounts'][_0x15f193['id']]['Smtp'][_0xdc2a('0x32')]=moment();return new BPromise(function(_0x16cc3a,_0x5ba6ba){return _0x261737[_0xdc2a('0xf')][_0xdc2a('0x36')](_0x15f193)[_0xdc2a('0x2e')](function(_0x13f0ec){_0x261737[_0xdc2a('0xe')][_0x15f193['id']][_0xdc2a('0x35')][_0xdc2a('0x15')]=_0xdc2a('0x37');_0x261737[_0xdc2a('0xe')][_0x15f193['id']][_0xdc2a('0x35')][_0xdc2a('0x16')]='';_0x261737['emit'](_0x15f193['id']);_0x16cc3a(_0x13f0ec);})['catch'](function(_0x2fd0bd){_0x261737[_0xdc2a('0xe')][_0x15f193['id']]['Smtp'][_0xdc2a('0x15')]='error';_0x261737['mailAccounts'][_0x15f193['id']][_0xdc2a('0x35')][_0xdc2a('0x16')]=_0x2fd0bd;_0x261737[_0xdc2a('0x11')](_0x15f193['id']);_0x5ba6ba(_0x2fd0bd);});});}return this[_0xdc2a('0xf')][_0xdc2a('0x36')](_0x15f193);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b9d30c0..c3a9a46 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 _0x70e4=['error','handleError','connect','inherits','getAccount','connTimeout','authTimeout','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','handleOpenBox','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','closeBox','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','ready','handleReady','once','end','handleEnd','bind'];(function(_0x4d98fe,_0x2bac74){var _0x2d9e01=function(_0x4b2be7){while(--_0x4b2be7){_0x4d98fe['push'](_0x4d98fe['shift']());}};_0x2d9e01(++_0x2bac74);}(_0x70e4,0x15d));var _0x470e=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x70e4[_0x16a223];return _0x5ded66;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var Imap=require(_0x470e('0x2'));var simpleParser=require(_0x470e('0x3'))['simpleParser'];var Iconv=require(_0x470e('0x4'))[_0x470e('0x5')];var EventEmitter=require('events')[_0x470e('0x6')];var utils=require('./utils');var logger=require(_0x470e('0x7'))(_0x470e('0x8'));function EmailImap(_0x28cde0,_0x227fcf){this['mailbox']=_0x28cde0[_0x470e('0x9')];this[_0x470e('0xa')]=this['getAccount'](_0x28cde0,_0x227fcf);this[_0x470e('0x2')]=new Imap(this[_0x470e('0xa')]);this[_0x470e('0x2')]['once'](_0x470e('0xb'),this[_0x470e('0xc')]['bind'](this));this[_0x470e('0x2')][_0x470e('0xd')](_0x470e('0xe'),this[_0x470e('0xf')][_0x470e('0x10')](this));this[_0x470e('0x2')]['on'](_0x470e('0x11'),this[_0x470e('0x12')][_0x470e('0x10')](this));this[_0x470e('0x2')][_0x470e('0x13')]();}util[_0x470e('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x470e('0x15')]=function(_0x507559,_0x559157){var _0x4ea05c={'connTimeout':_0x507559[_0x470e('0x16')]?_0x507559[_0x470e('0x16')]*0x3e8:0x2710,'authTimeout':_0x507559['authTimeout']?_0x507559[_0x470e('0x17')]*0x3e8:0x1388};if(_0x507559['service']){_0x4ea05c['user']=_0x507559['user'];if(_0x507559['modernAuthentication']){_0x4ea05c[_0x470e('0x18')]=utils[_0x470e('0x19')](_0x507559[_0x470e('0x1a')][_0x470e('0x1b')],_0x507559[_0x470e('0x1c')]);}else{_0x4ea05c[_0x470e('0x1d')]=_0x507559[_0x470e('0x1d')];}}else{if(_0x507559[_0x470e('0x1e')]){_0x4ea05c['user']=_0x507559['user'];_0x4ea05c['password']=_0x507559[_0x470e('0x1d')];}}_0x4ea05c['email']=_0x559157||_0x507559[_0x470e('0x1c')]||_0x470e('0x1f');_0x4ea05c[_0x470e('0x20')]=_0x507559[_0x470e('0x20')];_0x4ea05c[_0x470e('0x21')]=_0x507559[_0x470e('0x21')]||0x3e1;if(_0x507559['tls']){_0x4ea05c[_0x470e('0x22')]=!![];}else{_0x4ea05c['tls']=![];_0x4ea05c[_0x470e('0x23')]='required';}return _0x4ea05c;};EmailImap[_0x470e('0x24')][_0x470e('0xc')]=function(){this[_0x470e('0x2')]['openBox'](this[_0x470e('0x9')],![],this[_0x470e('0x25')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x25')]=function(_0x1d310f,_0x4f9363){if(_0x1d310f){this['handleError'](_0x1d310f,!![]);}else{this['emit']('box',_0x4f9363);this[_0x470e('0x26')]();}};EmailImap[_0x470e('0x24')][_0x470e('0x27')]=function(_0x7f2439){if(_0x7f2439){this['handleError'](_0x7f2439,!![]);}else{this[_0x470e('0x2')][_0x470e('0xe')]();}};EmailImap[_0x470e('0x24')][_0x470e('0x26')]=function(){this[_0x470e('0x2')][_0x470e('0x28')](['UNSEEN'],this[_0x470e('0x29')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')]['handleReadUnseen']=function(_0x5ba804,_0x5dfecc){if(_0x5ba804){this['handleError'](_0x5ba804,!![]);}else{if(_0x5dfecc[_0x470e('0x2a')]){try{var _0x2b2fbe=this[_0x470e('0x2')][_0x470e('0x2b')](_0x5dfecc,{'bodies':'','markSeen':!![]});_0x2b2fbe['on'](_0x470e('0x2c'),this[_0x470e('0x2d')][_0x470e('0x10')](this));_0x2b2fbe['once']('error',this['handleFetchError']['bind'](this));_0x2b2fbe[_0x470e('0xd')](_0x470e('0xe'),this[_0x470e('0x2e')][_0x470e('0x10')](this));}catch(_0x1fb3b5){logger['error'](_0x1fb3b5);}}else{this[_0x470e('0x2')]['closeBox'](!![],this[_0x470e('0x27')][_0x470e('0x10')](this));}}};EmailImap[_0x470e('0x24')][_0x470e('0x2d')]=function(_0x2cdec6){_0x2cdec6['on'](_0x470e('0x2f'),this[_0x470e('0x30')][_0x470e('0x10')](this));_0x2cdec6['once'](_0x470e('0x31'),this[_0x470e('0x32')][_0x470e('0x10')](this));_0x2cdec6[_0x470e('0xd')]('end',this[_0x470e('0x33')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x30')]=function(_0x171e1c){simpleParser(_0x171e1c,{'Iconv':Iconv},this[_0x470e('0x34')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x32')]=function(){};EmailImap[_0x470e('0x24')][_0x470e('0x33')]=function(){};EmailImap[_0x470e('0x24')][_0x470e('0x34')]=function(_0x230e56,_0x2414bb){if(_0x230e56){logger[_0x470e('0x11')](_0x230e56);}else{var _0x5087a1=this;utils[_0x470e('0x35')](this['account'],_0x2414bb,function(_0x174c93){_0x5087a1[_0x470e('0x36')](_0x470e('0x8'),_0x174c93);});}};EmailImap['prototype'][_0x470e('0x2e')]=function(){this[_0x470e('0x2')]['closeBox'](!![],this[_0x470e('0x27')]['bind'](this));};EmailImap[_0x470e('0x24')][_0x470e('0x37')]=function(_0x193e28){this[_0x470e('0x12')](_0x193e28);this[_0x470e('0x2')][_0x470e('0x38')](!![],this[_0x470e('0x27')]['bind'](this));};EmailImap[_0x470e('0x24')][_0x470e('0xf')]=function(){this[_0x470e('0x36')]('end');};EmailImap[_0x470e('0x24')][_0x470e('0x12')]=function(_0x4920b1,_0x447f38){logger['error'](_0x470e('0x12'),this[_0x470e('0xa')][_0x470e('0x8')],JSON['stringify'](_0x4920b1));var _0x41e53a='';if(_0x4920b1){if(_0x4920b1[_0x470e('0x39')]){_0x41e53a=_0x4920b1['textCode'];}else{for(var _0x17e92e in _0x4920b1){if(_0x4920b1[_0x470e('0x3a')](_0x17e92e)){_0x41e53a+=_[_0x470e('0x3b')](_0x17e92e)+':\x20'+_0x4920b1[_0x17e92e]+'\x0a';}}}}if(_0x447f38){this[_0x470e('0x2')]['end']();}else{this[_0x470e('0x36')](_0x470e('0x11'),_0x41e53a);this[_0x470e('0x36')](_0x470e('0xe'));}};module[_0x470e('0x3c')]=EmailImap; \ No newline at end of file +var _0x9904=['./utils','email','mailbox','account','once','ready','handleReady','bind','handleEnd','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','modernAuthentication','xoauth2','CloudProvider','data5','user','password','host','port','tls','required','openBox','handleOpenBox','emit','handleCloseBox','end','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','error','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','simpleParser','iconv','Iconv','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9904,0x1a4));var _0x4990=function(_0x57eff0,_0x3f4684){_0x57eff0=_0x57eff0-0x0;var _0x448ff1=_0x9904[_0x57eff0];return _0x448ff1;};'use strict';var _=require(_0x4990('0x0'));var util=require('util');var Imap=require(_0x4990('0x1'));var simpleParser=require('mailparser')[_0x4990('0x2')];var Iconv=require(_0x4990('0x3'))[_0x4990('0x4')];var EventEmitter=require(_0x4990('0x5'))[_0x4990('0x6')];var utils=require(_0x4990('0x7'));var logger=require('../../../config/logger')(_0x4990('0x8'));function EmailImap(_0x7c2b5d,_0x3b1ba5){this[_0x4990('0x9')]=_0x7c2b5d['mailbox'];this[_0x4990('0xa')]=this['getAccount'](_0x7c2b5d,_0x3b1ba5);this[_0x4990('0x1')]=new Imap(this[_0x4990('0xa')]);this['imap'][_0x4990('0xb')](_0x4990('0xc'),this[_0x4990('0xd')][_0x4990('0xe')](this));this[_0x4990('0x1')]['once']('end',this[_0x4990('0xf')][_0x4990('0xe')](this));this[_0x4990('0x1')]['on']('error',this[_0x4990('0x10')]['bind'](this));this[_0x4990('0x1')][_0x4990('0x11')]();}util[_0x4990('0x12')](EmailImap,EventEmitter);EmailImap[_0x4990('0x13')][_0x4990('0x14')]=function(_0x466c85,_0x450f8f){var _0xa54284={'connTimeout':_0x466c85['connTimeout']?_0x466c85[_0x4990('0x15')]*0x3e8:0x2710,'authTimeout':_0x466c85['authTimeout']?_0x466c85[_0x4990('0x16')]*0x3e8:0x1388};if(_0x466c85[_0x4990('0x17')]){_0xa54284['user']=_0x466c85['user'];if(_0x466c85[_0x4990('0x18')]){_0xa54284[_0x4990('0x19')]=utils['generateXOAuth2Token'](_0x466c85[_0x4990('0x1a')][_0x4990('0x1b')],_0x466c85[_0x4990('0x1c')]);}else{_0xa54284[_0x4990('0x1d')]=_0x466c85[_0x4990('0x1d')];}}else{if(_0x466c85['authentication']){_0xa54284[_0x4990('0x1c')]=_0x466c85[_0x4990('0x1c')];_0xa54284[_0x4990('0x1d')]=_0x466c85[_0x4990('0x1d')];}}_0xa54284[_0x4990('0x8')]=_0x450f8f||_0x466c85['user']||'anonymous@xcally.com';_0xa54284['host']=_0x466c85[_0x4990('0x1e')];_0xa54284[_0x4990('0x1f')]=_0x466c85['port']||0x3e1;if(_0x466c85[_0x4990('0x20')]){_0xa54284[_0x4990('0x20')]=!![];}else{_0xa54284[_0x4990('0x20')]=![];_0xa54284['autotls']=_0x4990('0x21');}return _0xa54284;};EmailImap['prototype'][_0x4990('0xd')]=function(){this[_0x4990('0x1')][_0x4990('0x22')](this[_0x4990('0x9')],![],this[_0x4990('0x23')][_0x4990('0xe')](this));};EmailImap[_0x4990('0x13')][_0x4990('0x23')]=function(_0x77bf5e,_0x304a57){if(_0x77bf5e){this[_0x4990('0x10')](_0x77bf5e,!![]);}else{this[_0x4990('0x24')]('box',_0x304a57);this['readUnseen']();}};EmailImap['prototype'][_0x4990('0x25')]=function(_0x3162a1){if(_0x3162a1){this['handleError'](_0x3162a1,!![]);}else{this[_0x4990('0x1')][_0x4990('0x26')]();}};EmailImap[_0x4990('0x13')][_0x4990('0x27')]=function(){this[_0x4990('0x1')]['search']([_0x4990('0x28')],this[_0x4990('0x29')]['bind'](this));};EmailImap[_0x4990('0x13')]['handleReadUnseen']=function(_0x2a77e9,_0x3b15ac){if(_0x2a77e9){this[_0x4990('0x10')](_0x2a77e9,!![]);}else{if(_0x3b15ac[_0x4990('0x2a')]){try{var _0x4d6a52=this[_0x4990('0x1')][_0x4990('0x2b')](_0x3b15ac,{'bodies':'','markSeen':!![]});_0x4d6a52['on'](_0x4990('0x2c'),this['handleFetchMessage'][_0x4990('0xe')](this));_0x4d6a52[_0x4990('0xb')](_0x4990('0x2d'),this['handleFetchError'][_0x4990('0xe')](this));_0x4d6a52[_0x4990('0xb')](_0x4990('0x26'),this['handleFetchEnd'][_0x4990('0xe')](this));}catch(_0x424f31){logger[_0x4990('0x2d')](_0x424f31);}}else{this[_0x4990('0x1')][_0x4990('0x2e')](!![],this[_0x4990('0x25')][_0x4990('0xe')](this));}}};EmailImap[_0x4990('0x13')][_0x4990('0x2f')]=function(_0x5df3d9){_0x5df3d9['on'](_0x4990('0x30'),this[_0x4990('0x31')]['bind'](this));_0x5df3d9[_0x4990('0xb')]('attributes',this[_0x4990('0x32')][_0x4990('0xe')](this));_0x5df3d9[_0x4990('0xb')](_0x4990('0x26'),this[_0x4990('0x33')][_0x4990('0xe')](this));};EmailImap['prototype'][_0x4990('0x31')]=function(_0x455179){simpleParser(_0x455179,{'Iconv':Iconv},this['handleSimpleParser'][_0x4990('0xe')](this));};EmailImap[_0x4990('0x13')][_0x4990('0x32')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x4990('0x13')][_0x4990('0x34')]=function(_0x2c2ebd,_0x1d85fd){if(_0x2c2ebd){logger[_0x4990('0x2d')](_0x2c2ebd);}else{var _0x2ee0f2=this;utils[_0x4990('0x35')](this[_0x4990('0xa')],_0x1d85fd,function(_0x294737){_0x2ee0f2[_0x4990('0x24')](_0x4990('0x8'),_0x294737);});}};EmailImap['prototype'][_0x4990('0x36')]=function(){this['imap'][_0x4990('0x2e')](!![],this[_0x4990('0x25')][_0x4990('0xe')](this));};EmailImap['prototype'][_0x4990('0x37')]=function(_0x109f8b){this[_0x4990('0x10')](_0x109f8b);this['imap'][_0x4990('0x2e')](!![],this[_0x4990('0x25')][_0x4990('0xe')](this));};EmailImap[_0x4990('0x13')]['handleEnd']=function(){this[_0x4990('0x24')](_0x4990('0x26'));};EmailImap['prototype'][_0x4990('0x10')]=function(_0x2a4200,_0x18c4a6){logger[_0x4990('0x2d')](_0x4990('0x10'),this[_0x4990('0xa')]['email'],JSON[_0x4990('0x38')](_0x2a4200));var _0x461d58='';if(_0x2a4200){if(_0x2a4200[_0x4990('0x39')]){_0x461d58=_0x2a4200[_0x4990('0x39')];}else{for(var _0x3292a1 in _0x2a4200){if(_0x2a4200[_0x4990('0x3a')](_0x3292a1)){_0x461d58+=_[_0x4990('0x3b')](_0x3292a1)+':\x20'+_0x2a4200[_0x3292a1]+'\x0a';}}}}if(_0x18c4a6){this[_0x4990('0x1')]['end']();}else{this['emit'](_0x4990('0x2d'),_0x461d58);this[_0x4990('0x24')]('end');}};module[_0x4990('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d22463f..ba06cc9 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 _0x5047=['prototype','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','toString'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5047,0x10b));var _0x7504=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x5047[_0x2c96f6];return _0x6d4808;};'use strict';var nodemailer=require(_0x7504('0x0'));var inlineBase64=require(_0x7504('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x7504('0x2')]=function(_0xa344db,_0x41e920){return new Promise(function(_0x952637,_0x167435){var _0x46875b=nodemailer[_0x7504('0x3')](_0xa344db);_0x46875b['use']('compile',inlineBase64());_0x46875b['sendMail'](_0x41e920,function(_0x3e619f,_0x22dbac){if(_0x3e619f){_0x167435(_0x3e619f[_0x7504('0x4')]());}else{_0x952637(_0x22dbac);}});});};EmailSmtp[_0x7504('0x5')][_0x7504('0x6')]=function(_0x2e4767){return new Promise(function(_0x16508d,_0x32c2f8){var _0x2c18a8=nodemailer[_0x7504('0x3')](_0x2e4767);_0x2c18a8['verify'](function(_0x21ef3c,_0x50eb3a){if(_0x21ef3c){_0x32c2f8(_0x21ef3c[_0x7504('0x4')]());}else{if(_0x50eb3a){_0x16508d(_0x50eb3a);}else{_0x32c2f8(_0x7504('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x2ef6=['send','createTransport','compile','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x22ea80,_0x2e80ca){var _0x4adadf=function(_0x1dc7f6){while(--_0x1dc7f6){_0x22ea80['push'](_0x22ea80['shift']());}};_0x4adadf(++_0x2e80ca);}(_0x2ef6,0x10b));var _0x62ef=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x2ef6[_0x1a9e78];return _0x113e06;};'use strict';var nodemailer=require(_0x62ef('0x0'));var inlineBase64=require(_0x62ef('0x1'));function EmailSmtp(){}EmailSmtp[_0x62ef('0x2')][_0x62ef('0x3')]=function(_0x27272a,_0x2422fe){return new Promise(function(_0x234002,_0x432e1a){var _0x1876cc=nodemailer[_0x62ef('0x4')](_0x27272a);_0x1876cc['use'](_0x62ef('0x5'),inlineBase64());_0x1876cc[_0x62ef('0x6')](_0x2422fe,function(_0x1b65e9,_0x539872){if(_0x1b65e9){_0x432e1a(_0x1b65e9[_0x62ef('0x7')]());}else{_0x234002(_0x539872);}});});};EmailSmtp['prototype'][_0x62ef('0x8')]=function(_0x4a2cd8){return new Promise(function(_0xf5a1bf,_0xb0b55e){var _0x626228=nodemailer[_0x62ef('0x4')](_0x4a2cd8);_0x626228[_0x62ef('0x8')](function(_0x5aa4c7,_0x2a4410){if(_0x5aa4c7){_0xb0b55e(_0x5aa4c7[_0x62ef('0x7')]());}else{if(_0x2a4410){_0xf5a1bf(_0x2a4410);}else{_0xb0b55e('Not\x20verifired');}}});});};module[_0x62ef('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9043a6e..c8cd354 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 _0x3edc=['indexOf','split','length','slice','join','pop','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','toString','base64','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','head','address','anonymous','generate','value','name'];(function(_0x9353e9,_0x569417){var _0x23341e=function(_0x11bb7c){while(--_0x11bb7c){_0x9353e9['push'](_0x9353e9['shift']());}};_0x23341e(++_0x569417);}(_0x3edc,0x160));var _0xc3ed=function(_0x3e751a,_0x4804ae){_0x3e751a=_0x3e751a-0x0;var _0x1d5aa1=_0x3edc[_0x3e751a];return _0x1d5aa1;};'use strict';var _=require(_0xc3ed('0x0'));var moment=require(_0xc3ed('0x1'));var random=require(_0xc3ed('0x2'));var fs=require('fs');var path=require(_0xc3ed('0x3'));var util=require('util');var tnef=require(_0xc3ed('0x4'));var logger=require('../../../config/logger')(_0xc3ed('0x5'));var config=require(_0xc3ed('0x6'));function getAddress(_0x526d98){var _0x3f15f5=_[_0xc3ed('0x7')](_0x526d98['value']);return _0x3f15f5&&_0x3f15f5[_0xc3ed('0x8')]?_0x3f15f5[_0xc3ed('0x8')]:_0xc3ed('0x9')+random[_0xc3ed('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x2aa130){var _0x4a55c4=_[_0xc3ed('0x7')](_0x2aa130[_0xc3ed('0xb')]);if(_0x4a55c4&&_0x4a55c4[_0xc3ed('0xc')]){if(_0x4a55c4[_0xc3ed('0xc')]==_0x4a55c4['address']){return _0x4a55c4[_0xc3ed('0xc')]['substring'](0x0,_0x4a55c4[_0xc3ed('0xc')][_0xc3ed('0xd')]('@'));}var _0x348b64=_0x4a55c4[_0xc3ed('0xc')][_0xc3ed('0xe')](/\s+/);return _0x348b64[_0xc3ed('0xf')]>0x1?_0x348b64[_0xc3ed('0x10')](0x0,-0x1)[_0xc3ed('0x11')]('\x20'):_0x4a55c4[_0xc3ed('0xc')];}return'Anonymous';}function getLastName(_0x5ef050){var _0x337df8=_['head'](_0x5ef050['value']);if(_0x337df8&&_0x337df8[_0xc3ed('0xc')]){var _0x13863b=_0x337df8[_0xc3ed('0xc')][_0xc3ed('0xe')](/\s+/);return _0x13863b[_0xc3ed('0xf')]>0x1?_0x13863b[_0xc3ed('0x12')]():'';}return'';}function getMails(_0x442337,_0x2fb91f){var _0x4a42b1='';for(var _0x1c404c=0x0;_0x1c404c<_0x2fb91f[_0xc3ed('0xb')]['length'];_0x1c404c+=0x1){if(_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0x8')]!==_0x442337){if(!_[_0xc3ed('0x13')](_0x4a42b1)){_0x4a42b1+=',';}_0x4a42b1+=_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0xc')]||_0x2fb91f[_0xc3ed('0xb')][_0x1c404c]['address']||'';_0x4a42b1+='\x20<';_0x4a42b1+=_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0x8')]?_0x2fb91f['value'][_0x1c404c][_0xc3ed('0x8')]:_0xc3ed('0x9')+random[_0xc3ed('0xa')](0x6)+'@xcally.com';_0x4a42b1+='>';}}return _0x4a42b1;}function parseEmail(_0x28983d,_0x422f6d,_0x33f7cb){if(_0x422f6d['html']){var _0x27a78d=/)<[^<]*)*<\/script>/gi;while(_0x27a78d['test'](_0x422f6d['html'])){_0x422f6d[_0xc3ed('0x14')]=_0x422f6d['html'][_0xc3ed('0x15')](_0x27a78d,'');}if(_0x422f6d[_0xc3ed('0x14')]['includes'](_0xc3ed('0x16'))){var _0x309c73=[];_0x422f6d[_0xc3ed('0x17')][_0xc3ed('0x18')](_0xa5d923=>{_0x309c73[_0xc3ed('0x19')](_0xa5d923['filename']);});var _0x2156d8=/]+>/g;var _0x1fa221=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1382b3=_0x422f6d[_0xc3ed('0x14')]['replace'](_0x1fa221,_0xc3ed('0x1a'));var _0x4a728f=_0x1382b3[_0xc3ed('0x15')](_0x2156d8,'_IMG');for(let _0x302b69=0x0;_0x302b69<_0x309c73[_0xc3ed('0xf')];_0x302b69++){var _0x52843f=_0x4a728f['replace'](_0xc3ed('0x1b'),_0xc3ed('0x1c')+_0x309c73[_0x302b69]+_0xc3ed('0x1d'));_0x4a728f=_0x52843f;}_0x422f6d[_0xc3ed('0x14')]=_0x4a728f;}_0x33f7cb[_0xc3ed('0x1e')]=_0x422f6d[_0xc3ed('0x14')];}else{_0x33f7cb[_0xc3ed('0x1e')]=_0x422f6d['textAsHtml'];}if(_0x33f7cb[_0xc3ed('0x1e')]){_0x33f7cb[_0xc3ed('0x1e')]=_0x33f7cb['body']['replace'](/0x0){var _0x404ee1=[_0xc3ed('0x30'),_0xc3ed('0x31'),_0xc3ed('0x32')];for(var _0x352eef=0x0;_0x352eef<_0x422f6d[_0xc3ed('0x2f')]['length'];_0x352eef++){var _0x1f6cc0=_[_0xc3ed('0xd')](_0x404ee1,_0x422f6d[_0xc3ed('0x2f')][_0x352eef]['line']);if(_0x1f6cc0>=0x0){_0x33f7cb[_0xc3ed('0x33')]=!![];}}}return _0x33f7cb;}exports[_0xc3ed('0x34')]=function(_0x42f51d,_0x5c40c1,_0x33b058){var _0x1a0e13={'from':getAddress(_0x5c40c1['from']),'firstName':getFirstName(_0x5c40c1[_0xc3ed('0x35')]),'lastName':getLastName(_0x5c40c1[_0xc3ed('0x35')]),'mapKey':_0xc3ed('0x5'),'message':{'from':getMails(_0x42f51d[_0xc3ed('0x5')],_0x5c40c1['from']),'to':_0x42f51d[_0xc3ed('0x5')],'cc':'','subject':_0x5c40c1[_0xc3ed('0x36')]||'','messageId':_0x5c40c1[_0xc3ed('0x37')],'inReplyTo':_0x5c40c1[_0xc3ed('0x38')],'sentAt':moment(_0x5c40c1[_0xc3ed('0x39')])[_0xc3ed('0x28')](_0xc3ed('0x3a')),'attach':![],'attachments':[]}};if(!_0x5c40c1[_0xc3ed('0x14')]&&!_0x5c40c1[_0xc3ed('0x3b')]){var _0x3d3214=_[_0xc3ed('0x3c')](_0x5c40c1[_0xc3ed('0x17')],{'contentType':_0xc3ed('0x3d')});if(_0x3d3214[_0xc3ed('0xf')]){logger['info'](util['format'](_0xc3ed('0x3e'),_0x5c40c1[_0xc3ed('0x37')]));tnef['parseBuffer'](_[_0xc3ed('0x3f')](_0x3d3214)[_0xc3ed('0x2d')],function(_0x278957,_0x5c1b69){if(_0x5c1b69){_0x5c40c1[_0xc3ed('0x14')]=_0x5c1b69[_0xc3ed('0x40')]||_0xc3ed('0x41');if(_0x5c1b69['Attachments']){for(var _0xec0eb8=0x0;_0xec0eb8<_0x5c1b69[_0xc3ed('0x42')][_0xc3ed('0xf')];_0xec0eb8++){var _0x28c00d=_0x5c1b69[_0xc3ed('0x42')][_0xec0eb8];_0x1a0e13['message']['attachments'][_0xc3ed('0x19')]({'filename':_0x28c00d[_0xc3ed('0x43')],'content':Buffer['from'](_0x28c00d[_0xc3ed('0x44')])});}}}_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));});}else{_0x5c40c1[_0xc3ed('0x14')]=_0xc3ed('0x41');_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));}}else{_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));}};exports[_0xc3ed('0x45')]=function(_0x5ddcc8,_0x231a09){var _0x31e63a=[_0xc3ed('0x46')+(_0x231a09||''),'auth=Bearer\x20'+_0x5ddcc8,'',''];return Buffer[_0xc3ed('0x35')](_0x31e63a['join'](''),'utf-8')[_0xc3ed('0x47')](_0xc3ed('0x48'));}; \ No newline at end of file +var _0xb3df=['util','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','split','length','slice','Anonymous','pop','test','html','includes','attachments','forEach','filename','replace','_IMG','\x20[Attachment:\x20','\x20]','body','message','isEmpty','originTo','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','join','server/files/attachments/','writeFileSync','content','push','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','textAsHtml','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0xb3df,0x89));var _0xfb3d=function(_0x2472cd,_0x16c777){_0x2472cd=_0x2472cd-0x0;var _0x74d44b=_0xb3df[_0x2472cd];return _0x74d44b;};'use strict';var _=require(_0xfb3d('0x0'));var moment=require(_0xfb3d('0x1'));var random=require(_0xfb3d('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xfb3d('0x3'));var tnef=require('node-tnef');var logger=require(_0xfb3d('0x4'))(_0xfb3d('0x5'));var config=require(_0xfb3d('0x6'));function getAddress(_0x5e2995){var _0x37bb80=_[_0xfb3d('0x7')](_0x5e2995['value']);return _0x37bb80&&_0x37bb80[_0xfb3d('0x8')]?_0x37bb80[_0xfb3d('0x8')]:_0xfb3d('0x9')+random[_0xfb3d('0xa')](0x6)+_0xfb3d('0xb');}function getFirstName(_0x18e38f){var _0x1c576c=_[_0xfb3d('0x7')](_0x18e38f[_0xfb3d('0xc')]);if(_0x1c576c&&_0x1c576c[_0xfb3d('0xd')]){if(_0x1c576c[_0xfb3d('0xd')]==_0x1c576c[_0xfb3d('0x8')]){return _0x1c576c[_0xfb3d('0xd')][_0xfb3d('0xe')](0x0,_0x1c576c[_0xfb3d('0xd')]['indexOf']('@'));}var _0x29b487=_0x1c576c['name'][_0xfb3d('0xf')](/\s+/);return _0x29b487[_0xfb3d('0x10')]>0x1?_0x29b487[_0xfb3d('0x11')](0x0,-0x1)['join']('\x20'):_0x1c576c[_0xfb3d('0xd')];}return _0xfb3d('0x12');}function getLastName(_0x5e49b6){var _0x353baf=_[_0xfb3d('0x7')](_0x5e49b6[_0xfb3d('0xc')]);if(_0x353baf&&_0x353baf['name']){var _0x220594=_0x353baf[_0xfb3d('0xd')][_0xfb3d('0xf')](/\s+/);return _0x220594['length']>0x1?_0x220594[_0xfb3d('0x13')]():'';}return'';}function getMails(_0x42c44a,_0x58f2ec){var _0x3af84a='';for(var _0x37efd3=0x0;_0x37efd3<_0x58f2ec[_0xfb3d('0xc')][_0xfb3d('0x10')];_0x37efd3+=0x1){if(_0x58f2ec['value'][_0x37efd3][_0xfb3d('0x8')]!==_0x42c44a){if(!_['isEmpty'](_0x3af84a)){_0x3af84a+=',';}_0x3af84a+=_0x58f2ec[_0xfb3d('0xc')][_0x37efd3][_0xfb3d('0xd')]||_0x58f2ec[_0xfb3d('0xc')][_0x37efd3][_0xfb3d('0x8')]||'';_0x3af84a+='\x20<';_0x3af84a+=_0x58f2ec[_0xfb3d('0xc')][_0x37efd3][_0xfb3d('0x8')]?_0x58f2ec[_0xfb3d('0xc')][_0x37efd3][_0xfb3d('0x8')]:_0xfb3d('0x9')+random[_0xfb3d('0xa')](0x6)+_0xfb3d('0xb');_0x3af84a+='>';}}return _0x3af84a;}function parseEmail(_0x5ad272,_0xbe6dfb,_0xbb4d1b){if(_0xbe6dfb['html']){var _0x29d4b7=/)<[^<]*)*<\/script>/gi;while(_0x29d4b7[_0xfb3d('0x14')](_0xbe6dfb[_0xfb3d('0x15')])){_0xbe6dfb[_0xfb3d('0x15')]=_0xbe6dfb[_0xfb3d('0x15')]['replace'](_0x29d4b7,'');}if(_0xbe6dfb[_0xfb3d('0x15')][_0xfb3d('0x16')]('{_0x4aefa4['push'](_0x2bd4e8[_0xfb3d('0x19')]);});var _0x512aa6=/]+>/g;var _0x263c3e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x419a11=_0xbe6dfb['html'][_0xfb3d('0x1a')](_0x263c3e,'_SRC');var _0x245382=_0x419a11[_0xfb3d('0x1a')](_0x512aa6,_0xfb3d('0x1b'));for(let _0x3103c1=0x0;_0x3103c1<_0x4aefa4['length'];_0x3103c1++){var _0x1a9c9f=_0x245382[_0xfb3d('0x1a')](_0xfb3d('0x1b'),_0xfb3d('0x1c')+_0x4aefa4[_0x3103c1]+_0xfb3d('0x1d'));_0x245382=_0x1a9c9f;}_0xbe6dfb['html']=_0x245382;}_0xbb4d1b[_0xfb3d('0x1e')]=_0xbe6dfb[_0xfb3d('0x15')];}else{_0xbb4d1b[_0xfb3d('0x1e')]=_0xbe6dfb['textAsHtml'];}if(_0xbb4d1b[_0xfb3d('0x1e')]){_0xbb4d1b['body']=_0xbb4d1b[_0xfb3d('0x1e')]['replace'](/0x0){var _0x3eeeb8=[_0xfb3d('0x30'),'X-Auto-Response-Suppress:\x20All',_0xfb3d('0x31')];for(var _0x2bb235=0x0;_0x2bb235<_0xbe6dfb[_0xfb3d('0x2f')][_0xfb3d('0x10')];_0x2bb235++){var _0x50ec89=_['indexOf'](_0x3eeeb8,_0xbe6dfb[_0xfb3d('0x2f')][_0x2bb235][_0xfb3d('0x32')]);if(_0x50ec89>=0x0){_0xbb4d1b[_0xfb3d('0x33')]=!![];}}}return _0xbb4d1b;}exports[_0xfb3d('0x34')]=function(_0x293115,_0x4b9968,_0xf8b916){var _0x15d968={'from':getAddress(_0x4b9968[_0xfb3d('0x35')]),'firstName':getFirstName(_0x4b9968[_0xfb3d('0x35')]),'lastName':getLastName(_0x4b9968[_0xfb3d('0x35')]),'mapKey':_0xfb3d('0x5'),'message':{'from':getMails(_0x293115[_0xfb3d('0x5')],_0x4b9968[_0xfb3d('0x35')]),'to':_0x293115[_0xfb3d('0x5')],'cc':'','subject':_0x4b9968[_0xfb3d('0x36')]||'','messageId':_0x4b9968[_0xfb3d('0x37')],'inReplyTo':_0x4b9968[_0xfb3d('0x38')],'sentAt':moment(_0x4b9968['date'])[_0xfb3d('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4b9968[_0xfb3d('0x15')]&&!_0x4b9968[_0xfb3d('0x39')]){var _0x52c1ad=_['filter'](_0x4b9968[_0xfb3d('0x17')],{'contentType':_0xfb3d('0x3a')});if(_0x52c1ad['length']){logger[_0xfb3d('0x3b')](util['format'](_0xfb3d('0x3c'),_0x4b9968[_0xfb3d('0x37')]));tnef[_0xfb3d('0x3d')](_[_0xfb3d('0x3e')](_0x52c1ad)[_0xfb3d('0x2d')],function(_0x42d712,_0x2855aa){if(_0x2855aa){_0x4b9968[_0xfb3d('0x15')]=_0x2855aa['BodyHTML']||_0xfb3d('0x3f');if(_0x2855aa['Attachments']){for(var _0x393cbc=0x0;_0x393cbc<_0x2855aa['Attachments']['length'];_0x393cbc++){var _0x30cb6c=_0x2855aa[_0xfb3d('0x40')][_0x393cbc];_0x15d968['message'][_0xfb3d('0x17')][_0xfb3d('0x2e')]({'filename':_0x30cb6c['Title'],'content':Buffer['from'](_0x30cb6c['Data'])});}}}_0xf8b916(parseEmail(_0x293115,_0x4b9968,_0x15d968));});}else{_0x4b9968[_0xfb3d('0x15')]='

Empty\x20message

';_0xf8b916(parseEmail(_0x293115,_0x4b9968,_0x15d968));}}else{_0xf8b916(parseEmail(_0x293115,_0x4b9968,_0x15d968));}};exports[_0xfb3d('0x41')]=function(_0xee4c20,_0x3d49b0){var _0x32579e=[_0xfb3d('0x42')+(_0x3d49b0||''),'auth=Bearer\x20'+_0xee4c20,'',''];return Buffer[_0xfb3d('0x35')](_0x32579e['join'](''),_0xfb3d('0x43'))[_0xfb3d('0x44')](_0xfb3d('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 14b279a..a3dd81a 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 _0xa7c6=['key','SERV','active','Imap','Smtp','exports','name','Service'];(function(_0x51c211,_0x1d7385){var _0x35a5a5=function(_0x37eca3){while(--_0x37eca3){_0x51c211['push'](_0x51c211['shift']());}};_0x35a5a5(++_0x1d7385);}(_0xa7c6,0x9e));var _0x6a7c=function(_0x45d920,_0x5d4b26){_0x45d920=_0x45d920-0x0;var _0x5c8138=_0xa7c6[_0x45d920];return _0x5c8138;};'use strict';var _=require('lodash');function MailAccount(_0x20f93a){this['id']=_0x20f93a['id']||0x0;this[_0x6a7c('0x0')]=_0x20f93a[_0x6a7c('0x0')]||_0x6a7c('0x1');this['key']=_0x20f93a[_0x6a7c('0x2')]||_0x6a7c('0x3');this[_0x6a7c('0x4')]=_0x20f93a[_0x6a7c('0x4')]||![];this['Imap']=_0x20f93a[_0x6a7c('0x5')]||[];this[_0x6a7c('0x6')]=_0x20f93a[_0x6a7c('0x6')]||[];}module[_0x6a7c('0x7')]=MailAccount; \ No newline at end of file +var _0xadf2=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x127ed7,_0x18c2c5){var _0x17c7bb=function(_0x212045){while(--_0x212045){_0x127ed7['push'](_0x127ed7['shift']());}};_0x17c7bb(++_0x18c2c5);}(_0xadf2,0x188));var _0x2adf=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xadf2[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x2adf('0x0'));function MailAccount(_0x1faca1){this['id']=_0x1faca1['id']||0x0;this[_0x2adf('0x1')]=_0x1faca1[_0x2adf('0x1')]||_0x2adf('0x2');this[_0x2adf('0x3')]=_0x1faca1['key']||_0x2adf('0x4');this[_0x2adf('0x5')]=_0x1faca1['active']||![];this[_0x2adf('0x6')]=_0x1faca1[_0x2adf('0x6')]||[];this[_0x2adf('0x7')]=_0x1faca1[_0x2adf('0x7')]||[];}module[_0x2adf('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0e8daf0..34812de 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 _0xb8db=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb8db,0x1aa));var _0xbb8d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8db[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbb8d('0x0'));var MailAccount=require(_0xbb8d('0x1'));var Realtime=function(){this[_0xbb8d('0x2')]={};};function freeIsNotKey(_0x4fc986,_0x390721,_0x315dec){var _0x336364=_[_0xbb8d('0x3')](_0x4fc986,function(_0x1141ad,_0x3523d7){return _0x1141ad[_0x315dec];});for(var _0x53c021 in _0x390721){if(_0x390721[_0xbb8d('0x4')](_0x53c021)){if(!_0x336364[_0x53c021]){delete _0x390721[_0x53c021];}}}}Realtime['prototype'][_0xbb8d('0x5')]=function(_0x39bfcc,_0x17625b){for(var _0x50226a in _0x17625b){if(_0x39bfcc[_0xbb8d('0x4')](_0x50226a)){_0x39bfcc[_0x50226a]=_0x17625b[_0x50226a];}}};Realtime[_0xbb8d('0x6')][_0xbb8d('0x7')]=function(){var _0x109207=this;return function(_0x5b79df){if(_0x5b79df){freeIsNotKey(_0x5b79df,_0x109207[_0xbb8d('0x2')],'id');for(var _0x413058=0x0,_0x8a1a6={},_0x4bec06={};_0x413058<_0x5b79df[_0xbb8d('0x8')];_0x413058+=0x1){_0x8a1a6=_0x5b79df[_0x413058];if(_[_0xbb8d('0x9')](_0x109207['mailAccounts'][_0x8a1a6['id']])){_0x109207['mailAccounts'][_0x8a1a6['id']]=new MailAccount(_0x8a1a6);}else{_[_0xbb8d('0xa')](_0x109207['mailAccounts'][_0x8a1a6['id']],_0x8a1a6);}}}return _0x109207[_0xbb8d('0x2')];};};module[_0xbb8d('0xb')]=Realtime; \ No newline at end of file +var _0x0cd6=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge'];(function(_0x1a8c42,_0x1b04be){var _0x575c74=function(_0x35d634){while(--_0x35d634){_0x1a8c42['push'](_0x1a8c42['shift']());}};_0x575c74(++_0x1b04be);}(_0x0cd6,0x14b));var _0x60cd=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x0cd6[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x60cd('0x0'));var MailAccount=require(_0x60cd('0x1'));var Realtime=function(){this[_0x60cd('0x2')]={};};function freeIsNotKey(_0x22c251,_0x286e81,_0x390d56){var _0x4f1f00=_['mapKeys'](_0x22c251,function(_0x493ca4,_0x3840dd){return _0x493ca4[_0x390d56];});for(var _0x16892b in _0x286e81){if(_0x286e81[_0x60cd('0x3')](_0x16892b)){if(!_0x4f1f00[_0x16892b]){delete _0x286e81[_0x16892b];}}}}Realtime[_0x60cd('0x4')][_0x60cd('0x5')]=function(_0x404f90,_0xbf3a0a){for(var _0x46e3de in _0xbf3a0a){if(_0x404f90[_0x60cd('0x3')](_0x46e3de)){_0x404f90[_0x46e3de]=_0xbf3a0a[_0x46e3de];}}};Realtime[_0x60cd('0x4')][_0x60cd('0x6')]=function(){var _0xda9b63=this;return function(_0x524635){if(_0x524635){freeIsNotKey(_0x524635,_0xda9b63[_0x60cd('0x2')],'id');for(var _0x4931c2=0x0,_0x4f4fc9={},_0x23cf39={};_0x4931c2<_0x524635[_0x60cd('0x7')];_0x4931c2+=0x1){_0x4f4fc9=_0x524635[_0x4931c2];if(_['isUndefined'](_0xda9b63[_0x60cd('0x2')][_0x4f4fc9['id']])){_0xda9b63[_0x60cd('0x2')][_0x4f4fc9['id']]=new MailAccount(_0x4f4fc9);}else{_[_0x60cd('0x8')](_0xda9b63[_0x60cd('0x2')][_0x4f4fc9['id']],_0x4f4fc9);}}}return _0xda9b63['mailAccounts'];};};module[_0x60cd('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 284ed05..6aace41 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 _0x377e=['active','key','ListId','TemplateId','MailServerIn','Imap','type','data5','Smtp','CloudProvider','getMailAccount','notify','Request','NotifyMailAccount','../client','name','provider','service','email'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x377e,0x1e9));var _0xe377=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x377e[_0x2850c0];return _0x21e830;};'use strict';var client=require(_0xe377('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xe377('0x1'),_0xe377('0x2'),_0xe377('0x3'),_0xe377('0x4'),_0xe377('0x5'),_0xe377('0x6'),_0xe377('0x7'),_0xe377('0x8')],'raw':![],'include':[{'model':_0xe377('0x9'),'as':_0xe377('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xe377('0x1'),'service',_0xe377('0xb'),_0xe377('0xc')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xe377('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0xe377('0x1'),_0xe377('0x3'),_0xe377('0xb'),'data5'],'as':_0xe377('0xe')}]}]},'log':_0xe377('0xf')});};};exports[_0xe377('0x10')]=function(_0x2bdf60,_0x1abf8a){return client[_0xe377('0x11')]('NotifyMailAccount',{'account':{'id':_0x2bdf60},'body':_0x1abf8a,'log':_0xe377('0x12')});}; \ No newline at end of file +var _0x43a2=['name','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','provider','email','active','key','ListId','MailServerIn','data5','CloudProvider','MailServerOut','Smtp'];(function(_0x4f394f,_0x166be0){var _0x128d76=function(_0x1f8c6e){while(--_0x1f8c6e){_0x4f394f['push'](_0x4f394f['shift']());}};_0x128d76(++_0x166be0);}(_0x43a2,0xd0));var _0x243a=function(_0x63f24d,_0x38c45e){_0x63f24d=_0x63f24d-0x0;var _0x1daa91=_0x43a2[_0x63f24d];return _0x1daa91;};'use strict';var client=require('../client');exports[_0x243a('0x0')]=function(){return function(){return client[_0x243a('0x1')](_0x243a('0x2'),{'options':{'attributes':['id','name',_0x243a('0x3'),'service',_0x243a('0x4'),_0x243a('0x5'),_0x243a('0x6'),_0x243a('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x243a('0x8'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id','name','service','type',_0x243a('0x9')],'as':_0x243a('0xa')}]},{'model':_0x243a('0xb'),'as':_0x243a('0xc'),'include':[{'model':_0x243a('0xa'),'attributes':['id',_0x243a('0xd'),'service','type',_0x243a('0x9')],'as':_0x243a('0xa')}]}]},'log':_0x243a('0xe')});};};exports[_0x243a('0xf')]=function(_0x92d6a7,_0x114499){return client[_0x243a('0x1')](_0x243a('0x10'),{'account':{'id':_0x92d6a7},'body':_0x114499,'log':_0x243a('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 63835df..b5cd5e2 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 _0x6ac4=['Request','ShowSetting','GetSettings'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0x6ac4,0x177));var _0x46ac=function(_0x57d0ac,_0xf5f513){_0x57d0ac=_0x57d0ac-0x0;var _0x3adbb4=_0x6ac4[_0x57d0ac];return _0x3adbb4;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x46ac('0x0')](_0x46ac('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x46ac('0x2')});}; \ No newline at end of file +var _0xa58d=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0xa58d,0x11c));var _0xda58=function(_0x393d9c,_0x3ce422){_0x393d9c=_0x393d9c-0x0;var _0x255fc2=_0xa58d[_0x393d9c];return _0x255fc2;};'use strict';var client=require(_0xda58('0x0'));exports[_0xda58('0x1')]=function(){return client[_0xda58('0x2')](_0xda58('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xda58('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 773e9f3..21fa8e4 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 4231ffc..ac580bb 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 _0x0853=['../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','adapter','default','../../config/express'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x0853,0x194));var _0x3085=function(_0x2e68e4,_0x288073){_0x2e68e4=_0x2e68e4-0x0;var _0x33caa2=_0x0853[_0x2e68e4];return _0x33caa2;};'use strict';var _=require(_0x3085('0x0'));var http=require(_0x3085('0x1'));var express=require('express');var sticky=require(_0x3085('0x2'));var Redis=require(_0x3085('0x3'));var config=require(_0x3085('0x4'));var app=express();var server=http[_0x3085('0x5')](app);server[_0x3085('0x6')]=0xdbba0;if(sticky[_0x3085('0x7')](server,config[_0x3085('0x8')])){var socketio=require(_0x3085('0x9'))(server,{'transports':[_0x3085('0xa'),'polling']});config[_0x3085('0xb')]=_[_0x3085('0xc')](config[_0x3085('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x3085('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x3085('0xb')]),'subClient':new Redis(config[_0x3085('0xb')])}));require('../../config/triggers')[_0x3085('0xe')]();require('../../config/socketio')[_0x3085('0xe')](socketio);require(_0x3085('0xf'))[_0x3085('0xe')](app);require(_0x3085('0x10'))[_0x3085('0xe')](app);}else{server[_0x3085('0x11')]('listening',function(){console[_0x3085('0x12')](_0x3085('0x13'),config[_0x3085('0x8')]);});}exports=module[_0x3085('0x14')]=app; \ No newline at end of file +var _0x3339=['exports','lodash','http','sticky-session','createServer','timeout','listen','port','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x2cad47,_0x41c582){var _0x496024=function(_0x28e602){while(--_0x28e602){_0x2cad47['push'](_0x2cad47['shift']());}};_0x496024(++_0x41c582);}(_0x3339,0x6a));var _0x9333=function(_0x21e9e9,_0x4bd075){_0x21e9e9=_0x21e9e9-0x0;var _0x313bbb=_0x3339[_0x21e9e9];return _0x313bbb;};'use strict';var _=require(_0x9333('0x0'));var http=require(_0x9333('0x1'));var express=require('express');var sticky=require(_0x9333('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x9333('0x3')](app);server[_0x9333('0x4')]=0xdbba0;if(sticky[_0x9333('0x5')](server,config[_0x9333('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x9333('0x7'),_0x9333('0x8')]});config[_0x9333('0x9')]=_['defaults'](config[_0x9333('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x9333('0xa')](require(_0x9333('0xb'))({'pubClient':new Redis(config[_0x9333('0x9')]),'subClient':new Redis(config[_0x9333('0x9')])}));require(_0x9333('0xc'))[_0x9333('0xd')]();require('../../config/socketio')['default'](socketio);require(_0x9333('0xe'))[_0x9333('0xd')](app);require(_0x9333('0xf'))['default'](app);}else{server[_0x9333('0x10')](_0x9333('0x11'),function(){console[_0x9333('0x12')](_0x9333('0x13'),config[_0x9333('0x6')]);});}exports=module[_0x9333('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 069bda4..77766d2 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 _0xd854=['routing','client','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd854,0x1bf));var _0x4d85=function(_0x467093,_0x2fb2bb){_0x467093=_0x467093-0x0;var _0xb401f2=_0xd854[_0x467093];return _0xb401f2;};'use strict';var jayson=require(_0x4d85('0x0'));var BPromise=require(_0x4d85('0x1'));var logger=require(_0x4d85('0x2'))(_0x4d85('0x3'));var client=jayson[_0x4d85('0x4')]['http']({'port':0x2329});client[_0x4d85('0x5')]=function(_0x4e1956,_0x5a71a0){return new BPromise(function(_0x3a22d8,_0x2c6b54){return client[_0x4d85('0x6')](_0x4e1956,_0x5a71a0)[_0x4d85('0x7')](function(_0x528b19){logger[_0x4d85('0x8')](_0x4d85('0x9'),_0x4d85('0x3'),_0x4e1956,_0x5a71a0,_0x528b19);if(_0x528b19[_0x4d85('0xa')]){logger[_0x4d85('0xa')](_0x4d85('0x9'),'routing',_0x4e1956,_0x528b19[_0x4d85('0xa')][_0x4d85('0xb')],_0x5a71a0);return _0x2c6b54(_0x528b19[_0x4d85('0xa')][_0x4d85('0xb')]);}else{return _0x3a22d8(_0x528b19[_0x4d85('0xc')]);}})[_0x4d85('0xd')](function(_0x4a7e46){logger[_0x4d85('0xa')](_0x4d85('0x9'),'routing',_0x4e1956,_0x4a7e46,_0x5a71a0);return _0x2c6b54(_0x4a7e46);});});};module[_0x4d85('0xe')]=client; \ No newline at end of file +var _0x75fc=['routing','error','message','result','catch','exports','jayson/promise','bluebird','client','http','Request','then','debug','rpc'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x75fc,0x12c));var _0xc75f=function(_0x1d5ad9,_0xaadb37){_0x1d5ad9=_0x1d5ad9-0x0;var _0x2c08d0=_0x75fc[_0x1d5ad9];return _0x2c08d0;};'use strict';var jayson=require(_0xc75f('0x0'));var BPromise=require(_0xc75f('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xc75f('0x2')][_0xc75f('0x3')]({'port':0x2329});client[_0xc75f('0x4')]=function(_0x3141b0,_0x30ddda){return new BPromise(function(_0x23da7b,_0x1cfa11){return client['request'](_0x3141b0,_0x30ddda)[_0xc75f('0x5')](function(_0x288eb5){logger[_0xc75f('0x6')](_0xc75f('0x7'),_0xc75f('0x8'),_0x3141b0,_0x30ddda,_0x288eb5);if(_0x288eb5['error']){logger[_0xc75f('0x9')](_0xc75f('0x7'),'routing',_0x3141b0,_0x288eb5[_0xc75f('0x9')][_0xc75f('0xa')],_0x30ddda);return _0x1cfa11(_0x288eb5[_0xc75f('0x9')][_0xc75f('0xa')]);}else{return _0x23da7b(_0x288eb5[_0xc75f('0xb')]);}})[_0xc75f('0xc')](function(_0x56ed31){logger['error']('rpc','routing',_0x3141b0,_0x56ed31,_0x30ddda);return _0x1cfa11(_0x56ed31);});});};module[_0xc75f('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 60c8611..ace1c68 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 _0xb53e=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0x183664,_0x235864){var _0x564963=function(_0x5c36c7){while(--_0x5c36c7){_0x183664['push'](_0x183664['shift']());}};_0x564963(++_0x235864);}(_0xb53e,0xbd));var _0xeb53=function(_0x166bd2,_0x142b0b){_0x166bd2=_0x166bd2-0x0;var _0x4da1ee=_0xb53e[_0x166bd2];return _0x4da1ee;};'use strict';var BPromise=require('bluebird');var server=require(_0xeb53('0x0'));var Realtime=require(_0xeb53('0x1'));var user=require(_0xeb53('0x2'));var interval=require(_0xeb53('0x3'));var openchannelQueue=require(_0xeb53('0x4'));var chatQueue=require(_0xeb53('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xeb53('0x6'));var faxQueue=require(_0xeb53('0x7'));var whatsappQueue=require(_0xeb53('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xeb53('0x9')]()[_0xeb53('0xa')](user[_0xeb53('0xb')]())['then'](realtime[_0xeb53('0xc')]())[_0xeb53('0xa')](interval['getIntervals']())['then'](realtime[_0xeb53('0xd')]())[_0xeb53('0xa')](openchannelQueue[_0xeb53('0xe')]())[_0xeb53('0xa')](realtime[_0xeb53('0xf')]())[_0xeb53('0xa')](chatQueue[_0xeb53('0x10')]())['then'](realtime[_0xeb53('0x11')]())[_0xeb53('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0xeb53('0x12')]())[_0xeb53('0xa')](mailQueue[_0xeb53('0x13')]())['then'](realtime[_0xeb53('0x14')]())[_0xeb53('0xa')](faxQueue[_0xeb53('0x15')]())[_0xeb53('0xa')](realtime[_0xeb53('0x16')]())[_0xeb53('0xa')](whatsappQueue[_0xeb53('0x17')]())['then'](realtime[_0xeb53('0x18')]())[_0xeb53('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x1ea8fe){return initRealtime();})[_0xeb53('0xa')](function(_0x3449cc){return setInterval(initRealtime,0x1388);})[_0xeb53('0x19')](function(_0xba5e80){console[_0xeb53('0x1a')](_0xba5e80);});}main(); \ No newline at end of file +var _0xd3f2=['initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd3f2,0x17b));var _0x2d3f=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0xd3f2[_0x42bd43];return _0x421e88;};'use strict';var BPromise=require(_0x2d3f('0x0'));var server=require(_0x2d3f('0x1'));var Realtime=require(_0x2d3f('0x2'));var user=require(_0x2d3f('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x2d3f('0x4'));var smsQueue=require(_0x2d3f('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x2d3f('0x6'));var whatsappQueue=require(_0x2d3f('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2d3f('0x8')]()[_0x2d3f('0x9')](user[_0x2d3f('0xa')]())[_0x2d3f('0x9')](realtime[_0x2d3f('0xb')]())['then'](interval[_0x2d3f('0xc')]())[_0x2d3f('0x9')](realtime['initIntervals']())['then'](openchannelQueue['getOpenchannelQueues']())[_0x2d3f('0x9')](realtime[_0x2d3f('0xd')]())[_0x2d3f('0x9')](chatQueue[_0x2d3f('0xe')]())[_0x2d3f('0x9')](realtime[_0x2d3f('0xf')]())[_0x2d3f('0x9')](smsQueue['getSmsQueues']())[_0x2d3f('0x9')](realtime[_0x2d3f('0x10')]())[_0x2d3f('0x9')](mailQueue[_0x2d3f('0x11')]())['then'](realtime[_0x2d3f('0x12')]())[_0x2d3f('0x9')](faxQueue[_0x2d3f('0x13')]())['then'](realtime['initFaxQueues']())[_0x2d3f('0x9')](whatsappQueue[_0x2d3f('0x14')]())[_0x2d3f('0x9')](realtime[_0x2d3f('0x15')]())[_0x2d3f('0x9')](function(){return realtime;});}function main(){return server[_0x2d3f('0x16')](realtime)[_0x2d3f('0x9')](function(_0x4ac024){return initRealtime();})['then'](function(_0x38a968){return setInterval(initRealtime,0x1388);})[_0x2d3f('0x17')](function(_0x3c0ffa){console[_0x2d3f('0x18')](_0x3c0ffa);});}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 3978e7f..7823a59 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x1f9a44,_0x572d0f){var _0xed2749=function(_0x39546e){while(--_0x39546e){_0x1f9a44['push'](_0x1f9a44['shift']());}};_0xed2749(++_0x572d0f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x5fc3[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x5ccaff,_0x58ca11){var _0x1ad917=function(_0x142f54){while(--_0x142f54){_0x5ccaff['push'](_0x5ccaff['shift']());}};_0x1ad917(++_0x58ca11);}(_0xe14b,0x93));var _0xbe14=function(_0x435944,_0x3730ea){_0x435944=_0x435944-0x0;var _0x5631b4=_0xe14b[_0x435944];return _0x5631b4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index de642a4..ab58c47 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 _0x3525=['message','result','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error'];(function(_0x22146f,_0x3490c9){var _0xc35a1f=function(_0x23f3a8){while(--_0x23f3a8){_0x22146f['push'](_0x22146f['shift']());}};_0xc35a1f(++_0x3490c9);}(_0x3525,0xe0));var _0x5352=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0x3525[_0x25d6ce];return _0x1aef15;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5352('0x0'));var client=jayson[_0x5352('0x1')][_0x5352('0x2')]({'port':0x232b});function request(_0x1bc367,_0x119e5b){return new BPromise(function(_0x77109b,_0x9b1873){return client[_0x5352('0x3')](_0x1bc367,_0x119e5b)[_0x5352('0x4')](function(_0x4cff07){if(_0x4cff07[_0x5352('0x5')]){return _0x9b1873(_0x4cff07[_0x5352('0x5')][_0x5352('0x6')]);}else{return _0x77109b(_0x4cff07[_0x5352('0x7')]);}})['catch'](function(_0x3caa49){return _0x9b1873(_0x3caa49);});});}exports[_0x5352('0x8')]=function(_0x1845e2,_0x3721d1){return request(_0x5352('0x9'),{'account':_0x1845e2,'message':_0x3721d1});}; \ No newline at end of file +var _0xd638=['client','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xd638,0x1d8));var _0x8d63=function(_0x59c1be,_0xba160a){_0x59c1be=_0x59c1be-0x0;var _0x47c031=_0xd638[_0x59c1be];return _0x47c031;};'use strict';var BPromise=require(_0x8d63('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8d63('0x1')][_0x8d63('0x2')]({'port':0x232b});function request(_0x2be853,_0x279735){return new BPromise(function(_0x16a77a,_0x5e3bfd){return client[_0x8d63('0x3')](_0x2be853,_0x279735)[_0x8d63('0x4')](function(_0x1fc16e){if(_0x1fc16e[_0x8d63('0x5')]){return _0x5e3bfd(_0x1fc16e[_0x8d63('0x5')][_0x8d63('0x6')]);}else{return _0x16a77a(_0x1fc16e[_0x8d63('0x7')]);}})[_0x8d63('0x8')](function(_0x373ac8){return _0x5e3bfd(_0x373ac8);});});}exports[_0x8d63('0x9')]=function(_0xe9dfc7,_0x3b92dc){return request(_0x8d63('0xa'),{'account':_0xe9dfc7,'message':_0x3b92dc});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 9a1bea7..5868bad 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 _0x583c=['busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','chatStatus','smsStatus','whatsappStatus','whatsappCurrentCapacity','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity'];(function(_0x206a16,_0x2dd251){var _0x3f58b0=function(_0xe394b8){while(--_0xe394b8){_0x206a16['push'](_0x206a16['shift']());}};_0x3f58b0(++_0x2dd251);}(_0x583c,0x12b));var _0xc583=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x583c[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xc583('0x0'));var md5=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var Redis=require(_0xc583('0x3'));var config=require('../../../config/environment');config[_0xc583('0x4')]=_[_0xc583('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc583('0x6'))(new Redis(config[_0xc583('0x4')]));function Agent(_0x5b7292){this['id']=_0x5b7292['id']||0x0;this[_0xc583('0x7')]=_0x5b7292[_0xc583('0x7')]||'';this[_0xc583('0x8')]=_0x5b7292[_0xc583('0x8')]||!![];this['voicePause']=_0x5b7292[_0xc583('0x9')]||![];this[_0xc583('0xa')]=_0x5b7292['chatPause']||![];this[_0xc583('0xb')]=_0x5b7292[_0xc583('0xb')]||![];this[_0xc583('0xc')]=_0x5b7292[_0xc583('0xc')]||![];this[_0xc583('0xd')]=_0x5b7292['smsPause']||![];this[_0xc583('0xe')]=_0x5b7292[_0xc583('0xe')]||![];this['chatStatus']=_0xc583('0xf');this[_0xc583('0x10')]=0x0;this['chatCapacity']=_0x5b7292[_0xc583('0x11')]||0x0;this[_0xc583('0x12')]=0x0;this[_0xc583('0x13')]=_0xc583('0xf');this[_0xc583('0x14')]=0x0;this[_0xc583('0x15')]=_0x5b7292[_0xc583('0x15')]||0x0;this[_0xc583('0x16')]=0x0;this[_0xc583('0x17')]='unknown';this[_0xc583('0x18')]=0x0;this['faxCapacity']=_0x5b7292[_0xc583('0x19')]||0x0;this[_0xc583('0x1a')]=0x0;this['smsStatus']=_0xc583('0xf');this[_0xc583('0x1b')]=0x0;this['smsCapacity']=_0x5b7292[_0xc583('0x1c')]||0x0;this[_0xc583('0x1d')]=0x0;this['whatsappStatus']=_0xc583('0xf');this[_0xc583('0x1e')]=0x0;this[_0xc583('0x1f')]=_0x5b7292[_0xc583('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xc583('0x20')]='unknown';this[_0xc583('0x21')]=0x0;this[_0xc583('0x22')]=_0x5b7292[_0xc583('0x22')]||0x0;this[_0xc583('0x23')]=0x0;this[_0xc583('0x24')]=![];this[_0xc583('0x25')]=undefined;this[_0xc583('0x1')]='';this[_0xc583('0x26')]={};this[_0xc583('0x27')]={};this[_0xc583('0x28')]={};this[_0xc583('0x29')]={};this[_0xc583('0x2a')]={};this[_0xc583('0x2b')]={};this['updateRealtime']();}Agent['prototype'][_0xc583('0x2c')]=function(_0x3e075c){if(this[_0x3e075c+_0xc583('0x2d')]>0x0){if(this[_0x3e075c+'Capacity']>0x0&&this[_0x3e075c+_0xc583('0x2d')]>=this[_0x3e075c+_0xc583('0x2e')]){return _0xc583('0x2f');}else{return _0xc583('0x30');}}else{return _0xc583('0x31');}};Agent['prototype']['updateRealtime']=function(){var _0x45871c=['mail',_0xc583('0x32'),_0xc583('0x33'),_0xc583('0x34'),_0xc583('0x35'),_0xc583('0x36')];for(var _0x4b1c18=0x0;_0x4b1c18<_0x45871c[_0xc583('0x37')];_0x4b1c18+=0x1){var _0x44f76a=this['getChannelStatus'](_0x45871c[_0x4b1c18]);if(this[_0x45871c[_0x4b1c18]+_0xc583('0x38')]!==_0x44f76a){this[_0x45871c[_0x4b1c18]+'StatusTime']=_[_0xc583('0x39')](moment()[_0xc583('0x3a')]('x'));}this[_0x45871c[_0x4b1c18]+_0xc583('0x38')]=_0x44f76a;}var _0x3ed083={'id':this['id'],'name':this[_0xc583('0x7')],'online':this[_0xc583('0x8')],'voicePause':this[_0xc583('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xc583('0xb')],'smsPause':this[_0xc583('0xd')],'faxPause':this[_0xc583('0xc')],'openchannelPause':this[_0xc583('0xe')],'chatStatus':this[_0xc583('0x3b')],'chatStatusTime':this[_0xc583('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc583('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc583('0x15')],'mailCurrentCapacity':this[_0xc583('0x16')],'faxStatus':this[_0xc583('0x17')],'faxStatusTime':this[_0xc583('0x18')],'faxCapacity':this[_0xc583('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xc583('0x3c')],'smsStatusTime':this[_0xc583('0x1b')],'smsCapacity':this[_0xc583('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc583('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xc583('0x1f')],'whatsappCurrentCapacity':this[_0xc583('0x3e')],'openchannelStatus':this[_0xc583('0x20')],'openchannelStatusTime':this[_0xc583('0x21')],'openchannelCapacity':this[_0xc583('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc583('0x24')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xc583('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xc583('0x28')],'openchannelWaitingInteractions':this[_0xc583('0x29')],'smsWaitingInteractions':this[_0xc583('0x2a')],'whatsappWaitingInteractions':this[_0xc583('0x2b')]};var _0xa44825=md5(JSON[_0xc583('0x3f')](_0x3ed083));if(this['md5']!==_0xa44825){this['md5']=_0xa44825;io[_0xc583('0x40')](_0xc583('0x41'),_['omit'](_0x3ed083,[_0xc583('0x8')]));}};module[_0xc583('0x42')]=Agent; \ No newline at end of file +var _0x160f=['faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','fax','sms','whatsapp','length','toNumber','format','Status','chatPause','whatsappStatus','busy','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity'];(function(_0x260b6f,_0x1edc36){var _0x3f672e=function(_0x4b536c){while(--_0x4b536c){_0x260b6f['push'](_0x260b6f['shift']());}};_0x3f672e(++_0x1edc36);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var md5=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var Redis=require(_0xf160('0x3'));var config=require('../../../config/environment');config[_0xf160('0x4')]=_[_0xf160('0x5')](config[_0xf160('0x4')],{'host':_0xf160('0x6'),'port':0x18eb});var io=require(_0xf160('0x7'))(new Redis(config[_0xf160('0x4')]));function Agent(_0x4a6f3d){this['id']=_0x4a6f3d['id']||0x0;this[_0xf160('0x8')]=_0x4a6f3d[_0xf160('0x8')]||'';this['online']=_0x4a6f3d['online']||!![];this[_0xf160('0x9')]=_0x4a6f3d['voicePause']||![];this['chatPause']=_0x4a6f3d['chatPause']||![];this[_0xf160('0xa')]=_0x4a6f3d[_0xf160('0xa')]||![];this[_0xf160('0xb')]=_0x4a6f3d[_0xf160('0xb')]||![];this['smsPause']=_0x4a6f3d['smsPause']||![];this[_0xf160('0xc')]=_0x4a6f3d[_0xf160('0xc')]||![];this[_0xf160('0xd')]='unknown';this[_0xf160('0xe')]=0x0;this[_0xf160('0xf')]=_0x4a6f3d[_0xf160('0xf')]||0x0;this[_0xf160('0x10')]=0x0;this[_0xf160('0x11')]='unknown';this[_0xf160('0x12')]=0x0;this['mailCapacity']=_0x4a6f3d[_0xf160('0x13')]||0x0;this[_0xf160('0x14')]=0x0;this[_0xf160('0x15')]=_0xf160('0x16');this[_0xf160('0x17')]=0x0;this[_0xf160('0x18')]=_0x4a6f3d[_0xf160('0x18')]||0x0;this[_0xf160('0x19')]=0x0;this[_0xf160('0x1a')]='unknown';this[_0xf160('0x1b')]=0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=0x0;this['whatsappStatus']=_0xf160('0x16');this['whatsappStatusTime']=0x0;this[_0xf160('0x1e')]=_0x4a6f3d[_0xf160('0x1e')]||0x0;this[_0xf160('0x1f')]=0x0;this[_0xf160('0x20')]=_0xf160('0x16');this[_0xf160('0x21')]=0x0;this[_0xf160('0x22')]=_0x4a6f3d[_0xf160('0x22')]||0x0;this[_0xf160('0x23')]=0x0;this['busy']=![];this[_0xf160('0x24')]=undefined;this[_0xf160('0x1')]='';this[_0xf160('0x25')]={};this['faxWaitingInteractions']={};this[_0xf160('0x26')]={};this[_0xf160('0x27')]={};this[_0xf160('0x28')]={};this[_0xf160('0x29')]={};this[_0xf160('0x2a')]();}Agent[_0xf160('0x2b')][_0xf160('0x2c')]=function(_0x5a72d1){if(this[_0x5a72d1+_0xf160('0x2d')]>0x0){if(this[_0x5a72d1+_0xf160('0x2e')]>0x0&&this[_0x5a72d1+_0xf160('0x2d')]>=this[_0x5a72d1+_0xf160('0x2e')]){return'maxcapacity';}else{return _0xf160('0x2f');}}else{return _0xf160('0x30');}};Agent['prototype']['updateRealtime']=function(){var _0x168a09=[_0xf160('0x31'),_0xf160('0x32'),'openchannel',_0xf160('0x33'),_0xf160('0x34'),_0xf160('0x35')];for(var _0x2e2b00=0x0;_0x2e2b00<_0x168a09[_0xf160('0x36')];_0x2e2b00+=0x1){var _0x193e1e=this['getChannelStatus'](_0x168a09[_0x2e2b00]);if(this[_0x168a09[_0x2e2b00]+'Status']!==_0x193e1e){this[_0x168a09[_0x2e2b00]+'StatusTime']=_[_0xf160('0x37')](moment()[_0xf160('0x38')]('x'));}this[_0x168a09[_0x2e2b00]+_0xf160('0x39')]=_0x193e1e;}var _0x26e06b={'id':this['id'],'name':this[_0xf160('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xf160('0x3a')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xf160('0xb')],'openchannelPause':this[_0xf160('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xf160('0xe')],'chatCapacity':this[_0xf160('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xf160('0x14')],'faxStatus':this[_0xf160('0x15')],'faxStatusTime':this[_0xf160('0x17')],'faxCapacity':this[_0xf160('0x18')],'faxCurrentCapacity':this[_0xf160('0x19')],'smsStatus':this[_0xf160('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf160('0x3b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xf160('0x1f')],'openchannelStatus':this[_0xf160('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf160('0x22')],'openchannelCurrentCapacity':this[_0xf160('0x23')],'busy':this[_0xf160('0x3c')],'busyQueue':this[_0xf160('0x24')],'chatWaitingInteractions':this[_0xf160('0x25')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xf160('0x26')],'openchannelWaitingInteractions':this[_0xf160('0x27')],'smsWaitingInteractions':this[_0xf160('0x28')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2dfe7b=md5(JSON[_0xf160('0x3d')](_0x26e06b));if(this[_0xf160('0x1')]!==_0x2dfe7b){this[_0xf160('0x1')]=_0x2dfe7b;io[_0xf160('0x3e')](_0xf160('0x3f'),_['omit'](_0x26e06b,['online']));}};module[_0xf160('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index aeef926..d074e09 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 _0xa26a=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','md5','chat:queue:%s','emit','chat_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x4da3de,_0x532168){var _0x5ac4c0=function(_0x313ab5){while(--_0x313ab5){_0x4da3de['push'](_0x4da3de['shift']());}};_0x5ac4c0(++_0x532168);}(_0xa26a,0x147));var _0xaa26=function(_0x55b49a,_0x31c0c6){_0x55b49a=_0x55b49a-0x0;var _0x4ec8f2=_0xa26a[_0x55b49a];return _0x4ec8f2;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xaa26('0x0'));var Redis=require(_0xaa26('0x1'));var config=require(_0xaa26('0x2'));config[_0xaa26('0x3')]=_[_0xaa26('0x4')](config[_0xaa26('0x3')],{'host':_0xaa26('0x5'),'port':0x18eb});var io=require(_0xaa26('0x6'))(new Redis(config[_0xaa26('0x3')]));function ChatQueue(_0x4a10ac){this['id']=_0x4a10ac['id']||0x0;this['name']=_0x4a10ac[_0xaa26('0x7')]||'';this[_0xaa26('0x8')]=_0x4a10ac[_0xaa26('0x8')]||0xa;this[_0xaa26('0x9')]=_0x4a10ac[_0xaa26('0x9')]||_0xaa26('0xa');this[_0xaa26('0xb')]=_0x4a10ac['Agents'];this[_0xaa26('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xaa26('0xd')]();this[_0xaa26('0xe')]();}ChatQueue['prototype'][_0xaa26('0xd')]=function(){var _0x3cc1bd=this['mapAgentsId'][_0xaa26('0xf')];this[_0xaa26('0xc')]=_[_0xaa26('0x10')](this[_0xaa26('0xb')],'id');this['mapAgentsId'][_0xaa26('0xf')]=_0x3cc1bd;};ChatQueue[_0xaa26('0x11')]['updateRealtime']=function(){this[_0xaa26('0x12')]=0x0;this[_0xaa26('0x13')]=0x0;for(var _0x43c568=0x0;_0x43c568=0x0?this[_0xaa26('0x16')]:0x0;var _0x47d2ff={'id':this['id'],'available':this[_0xaa26('0x16')],'loggedIn':this[_0xaa26('0x12')],'name':this[_0xaa26('0x7')],'paused':this[_0xaa26('0x13')],'waiting':this['waiting']};var _0x87bd17=md5(JSON[_0xaa26('0x17')](_0x47d2ff));if(this[_0xaa26('0x18')]!==_0x87bd17){this[_0xaa26('0x18')]=_0x87bd17;io['to'](util['format'](_0xaa26('0x19'),_0x47d2ff[_0xaa26('0x7')]))[_0xaa26('0x1a')](_0xaa26('0x1b'),_0x47d2ff);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xfd70=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','redis','defaults'];(function(_0x2a2611,_0x79ba52){var _0x49a125=function(_0x5852e6){while(--_0x5852e6){_0x2a2611['push'](_0x2a2611['shift']());}};_0x49a125(++_0x79ba52);}(_0xfd70,0x87));var _0x0fd7=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0xfd70[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0x0fd7('0x0'));var md5=require(_0x0fd7('0x1'));var util=require(_0x0fd7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0fd7('0x3')]=_[_0x0fd7('0x4')](config[_0x0fd7('0x3')],{'host':_0x0fd7('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0fd7('0x3')]));function ChatQueue(_0x340415){this['id']=_0x340415['id']||0x0;this[_0x0fd7('0x6')]=_0x340415[_0x0fd7('0x6')]||'';this['timeout']=_0x340415[_0x0fd7('0x7')]||0xa;this[_0x0fd7('0x8')]=_0x340415[_0x0fd7('0x8')]||_0x0fd7('0x9');this[_0x0fd7('0xa')]=_0x340415['Agents'];this[_0x0fd7('0xb')]={};this[_0x0fd7('0xc')]=0x0;this[_0x0fd7('0x1')]='';this[_0x0fd7('0xd')]();this[_0x0fd7('0xe')]();}ChatQueue[_0x0fd7('0xf')][_0x0fd7('0xd')]=function(){var _0x1c7ca2=this[_0x0fd7('0xb')]['_rr'];this[_0x0fd7('0xb')]=_[_0x0fd7('0x10')](this[_0x0fd7('0xa')],'id');this[_0x0fd7('0xb')][_0x0fd7('0x11')]=_0x1c7ca2;};ChatQueue[_0x0fd7('0xf')][_0x0fd7('0xe')]=function(){this['loggedIn']=0x0;this[_0x0fd7('0x12')]=0x0;for(var _0x35aa25=0x0;_0x35aa25=0x0?this['available']:0x0;var _0x1d42f9={'id':this['id'],'available':this[_0x0fd7('0x16')],'loggedIn':this[_0x0fd7('0x15')],'name':this['name'],'paused':this[_0x0fd7('0x12')],'waiting':this[_0x0fd7('0xc')]};var _0x287cae=md5(JSON[_0x0fd7('0x17')](_0x1d42f9));if(this[_0x0fd7('0x1')]!==_0x287cae){this[_0x0fd7('0x1')]=_0x287cae;io['to'](util[_0x0fd7('0x18')](_0x0fd7('0x19'),_0x1d42f9[_0x0fd7('0x6')]))[_0x0fd7('0x1a')](_0x0fd7('0x1b'),_0x1d42f9);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1c05458..f5abc37 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 _0xf092=['updateRealtime','paused','length','online','loggedIn','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xf092,0xe3));var _0x2f09=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xf092[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0x2f09('0x0'));var md5=require(_0x2f09('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2f09('0x2')]=_[_0x2f09('0x3')](config[_0x2f09('0x2')],{'host':_0x2f09('0x4'),'port':0x18eb});var io=require(_0x2f09('0x5'))(new Redis(config[_0x2f09('0x2')]));function FaxQueue(_0x18a6fb){this['id']=_0x18a6fb['id']||0x0;this[_0x2f09('0x6')]=_0x18a6fb[_0x2f09('0x6')]||'';this[_0x2f09('0x7')]=_0x18a6fb['timeout']||0xa;this['strategy']=_0x18a6fb['strategy']||_0x2f09('0x8');this[_0x2f09('0x9')]=_0x18a6fb['Agents'];this[_0x2f09('0xa')]={};this[_0x2f09('0xb')]=0x0;this[_0x2f09('0x1')]='';this[_0x2f09('0xc')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x1c8388=this[_0x2f09('0xa')][_0x2f09('0xd')];this['mapAgentsId']=_[_0x2f09('0xe')](this[_0x2f09('0x9')],'id');this['mapAgentsId'][_0x2f09('0xd')]=_0x1c8388;};FaxQueue[_0x2f09('0xf')][_0x2f09('0x10')]=function(){this['loggedIn']=0x0;this[_0x2f09('0x11')]=0x0;for(var _0x446287=0x0;_0x446287=0x0?this[_0x2f09('0x15')]:0x0;var _0x53f48a={'id':this['id'],'available':this[_0x2f09('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x2f09('0x11')],'waiting':this[_0x2f09('0xb')]};var _0x56415c=md5(JSON[_0x2f09('0x16')](_0x53f48a));if(this[_0x2f09('0x1')]!==_0x56415c){this[_0x2f09('0x1')]=_0x56415c;io['to'](util[_0x2f09('0x17')](_0x2f09('0x18'),_0x53f48a['name']))[_0x2f09('0x19')](_0x2f09('0x1a'),_0x53f48a);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x25c1=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','faxPause','available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x3e0077,_0x27f277){var _0x512b2c=function(_0x117c3a){while(--_0x117c3a){_0x3e0077['push'](_0x3e0077['shift']());}};_0x512b2c(++_0x27f277);}(_0x25c1,0xd0));var _0x125c=function(_0x4f5af0,_0x2710d0){_0x4f5af0=_0x4f5af0-0x0;var _0x1ad6c4=_0x25c1[_0x4f5af0];return _0x1ad6c4;};'use strict';var _=require(_0x125c('0x0'));var md5=require(_0x125c('0x1'));var util=require(_0x125c('0x2'));var Redis=require(_0x125c('0x3'));var config=require(_0x125c('0x4'));config[_0x125c('0x5')]=_['defaults'](config[_0x125c('0x5')],{'host':_0x125c('0x6'),'port':0x18eb});var io=require(_0x125c('0x7'))(new Redis(config[_0x125c('0x5')]));function FaxQueue(_0x4231b3){this['id']=_0x4231b3['id']||0x0;this[_0x125c('0x8')]=_0x4231b3[_0x125c('0x8')]||'';this['timeout']=_0x4231b3[_0x125c('0x9')]||0xa;this[_0x125c('0xa')]=_0x4231b3[_0x125c('0xa')]||_0x125c('0xb');this[_0x125c('0xc')]=_0x4231b3['Agents'];this[_0x125c('0xd')]={};this[_0x125c('0xe')]=0x0;this[_0x125c('0x1')]='';this['updateRouting']();this[_0x125c('0xf')]();}FaxQueue[_0x125c('0x10')][_0x125c('0x11')]=function(){var _0xf2f26f=this[_0x125c('0xd')][_0x125c('0x12')];this[_0x125c('0xd')]=_['map'](this[_0x125c('0xc')],'id');this[_0x125c('0xd')][_0x125c('0x12')]=_0xf2f26f;};FaxQueue[_0x125c('0x10')][_0x125c('0xf')]=function(){this[_0x125c('0x13')]=0x0;this['paused']=0x0;for(var _0x3456c6=0x0;_0x3456c6=0x0?this[_0x125c('0x17')]:0x0;var _0x970844={'id':this['id'],'available':this[_0x125c('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x125c('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x310d3b=md5(JSON[_0x125c('0x19')](_0x970844));if(this[_0x125c('0x1')]!==_0x310d3b){this[_0x125c('0x1')]=_0x310d3b;io['to'](util[_0x125c('0x1a')](_0x125c('0x1b'),_0x970844[_0x125c('0x8')]))[_0x125c('0x1c')](_0x125c('0x1d'),_0x970844);}};module[_0x125c('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 41f5330..f62db3a 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 _0xe663=['name','Intervals','exports'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xe663,0x16b));var _0x3e66=function(_0x42a563,_0x16291e){_0x42a563=_0x42a563-0x0;var _0x2ee5fe=_0xe663[_0x42a563];return _0x2ee5fe;};'use strict';function Interval(_0xe7567e){this['id']=_0xe7567e['id']||0x0;this['name']=_0xe7567e[_0x3e66('0x0')]||'';this[_0x3e66('0x1')]=_0xe7567e[_0x3e66('0x1')]||{};}module[_0x3e66('0x2')]=Interval; \ No newline at end of file +var _0x687f=['Intervals','name'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0x687f,0xe3));var _0xf687=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x687f[_0x55fb83];return _0x59a87a;};'use strict';function Interval(_0x28eaa8){this['id']=_0x28eaa8['id']||0x0;this[_0xf687('0x0')]=_0x28eaa8[_0xf687('0x0')]||'';this[_0xf687('0x1')]=_0x28eaa8[_0xf687('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 62fe302..a7570f0 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 _0x2a03=['format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','updateRouting','map','Agents','_rr','prototype','paused','length','online','loggedIn','mailPause','available','waiting','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a03,0xb8));var _0x32a0=function(_0x299027,_0x5d2e4f){_0x299027=_0x299027-0x0;var _0x1bc622=_0x2a03[_0x299027];return _0x1bc622;};'use strict';var _=require(_0x32a0('0x0'));var md5=require(_0x32a0('0x1'));var util=require(_0x32a0('0x2'));var Redis=require(_0x32a0('0x3'));var config=require(_0x32a0('0x4'));config['redis']=_[_0x32a0('0x5')](config[_0x32a0('0x6')],{'host':_0x32a0('0x7'),'port':0x18eb});var io=require(_0x32a0('0x8'))(new Redis(config[_0x32a0('0x6')]));function MailQueue(_0x1d90e9){this['id']=_0x1d90e9['id']||0x0;this[_0x32a0('0x9')]=_0x1d90e9[_0x32a0('0x9')]||'';this[_0x32a0('0xa')]=_0x1d90e9['timeout']||0xa;this['strategy']=_0x1d90e9['strategy']||_0x32a0('0xb');this['Agents']=_0x1d90e9['Agents'];this[_0x32a0('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x32a0('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0x32a0('0xd')]=function(){var _0x49fe09=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x32a0('0xe')](this[_0x32a0('0xf')],'id');this['mapAgentsId'][_0x32a0('0x10')]=_0x49fe09;};MailQueue[_0x32a0('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32a0('0x12')]=0x0;for(var _0x1fcbb1=0x0;_0x1fcbb1=0x0?this['available']:0x0;var _0x31c5df={'id':this['id'],'available':this[_0x32a0('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x32a0('0x9')],'paused':this[_0x32a0('0x12')],'waiting':this[_0x32a0('0x18')]};var _0x5584b4=md5(JSON[_0x32a0('0x19')](_0x31c5df));if(this[_0x32a0('0x1')]!==_0x5584b4){this[_0x32a0('0x1')]=_0x5584b4;io['to'](util[_0x32a0('0x1a')](_0x32a0('0x1b'),_0x31c5df[_0x32a0('0x9')]))['emit'](_0x32a0('0x1c'),_0x31c5df);}};module[_0x32a0('0x1d')]=MailQueue; \ No newline at end of file +var _0x5de0=['Agents','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','mailPause','available','paused','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall'];(function(_0x24c1d0,_0x4dec43){var _0x388583=function(_0x213304){while(--_0x213304){_0x24c1d0['push'](_0x24c1d0['shift']());}};_0x388583(++_0x4dec43);}(_0x5de0,0x1d3));var _0x05de=function(_0x5b7b0e,_0x207da2){_0x5b7b0e=_0x5b7b0e-0x0;var _0x138627=_0x5de0[_0x5b7b0e];return _0x138627;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x05de('0x0'));var config=require(_0x05de('0x1'));config['redis']=_[_0x05de('0x2')](config[_0x05de('0x3')],{'host':_0x05de('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05de('0x3')]));function MailQueue(_0x3d8695){this['id']=_0x3d8695['id']||0x0;this['name']=_0x3d8695[_0x05de('0x5')]||'';this[_0x05de('0x6')]=_0x3d8695['timeout']||0xa;this[_0x05de('0x7')]=_0x3d8695['strategy']||_0x05de('0x8');this[_0x05de('0x9')]=_0x3d8695['Agents'];this['mapAgentsId']={};this[_0x05de('0xa')]=0x0;this[_0x05de('0xb')]='';this[_0x05de('0xc')]();this[_0x05de('0xd')]();}MailQueue[_0x05de('0xe')]['updateRouting']=function(){var _0x165ac9=this['mapAgentsId'][_0x05de('0xf')];this['mapAgentsId']=_[_0x05de('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x165ac9;};MailQueue[_0x05de('0xe')][_0x05de('0xd')]=function(){this[_0x05de('0x11')]=0x0;this['paused']=0x0;for(var _0x1e9795=0x0;_0x1e9795=0x0?this[_0x05de('0x14')]:0x0;var _0x2684e9={'id':this['id'],'available':this[_0x05de('0x14')],'loggedIn':this[_0x05de('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x05de('0xa')]};var _0x1737f7=md5(JSON[_0x05de('0x16')](_0x2684e9));if(this[_0x05de('0xb')]!==_0x1737f7){this[_0x05de('0xb')]=_0x1737f7;io['to'](util[_0x05de('0x17')](_0x05de('0x18'),_0x2684e9[_0x05de('0x5')]))[_0x05de('0x19')](_0x05de('0x1a'),_0x2684e9);}};module[_0x05de('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d109559..d79d1a1 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d43cc,_0x23227d){_0x5d43cc=_0x5d43cc-0x0;var _0x270ecb=_0x2ef3[_0x5d43cc];return _0x270ecb;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x156229,_0x5770e3){var _0x15497d=function(_0x36343d){while(--_0x36343d){_0x156229['push'](_0x156229['shift']());}};_0x15497d(++_0x5770e3);}(_0x814b,0x1a2));var _0xb814=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0x814b[_0x6c59fc];return _0x17c96f;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 507990f..f32d077 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 _0x9567=['updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9567,0xdc));var _0x7956=function(_0x49f73d,_0x5cb41e){_0x49f73d=_0x49f73d-0x0;var _0x372d74=_0x9567[_0x49f73d];return _0x372d74;};'use strict';var _=require(_0x7956('0x0'));var md5=require(_0x7956('0x1'));var util=require(_0x7956('0x2'));var Redis=require(_0x7956('0x3'));var config=require(_0x7956('0x4'));config['redis']=_['defaults'](config[_0x7956('0x5')],{'host':_0x7956('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7956('0x5')]));function SmsQueue(_0x518f0a){this['id']=_0x518f0a['id']||0x0;this[_0x7956('0x7')]=_0x518f0a['name']||'';this[_0x7956('0x8')]=_0x518f0a[_0x7956('0x8')]||0xa;this['strategy']=_0x518f0a[_0x7956('0x9')]||'beepall';this[_0x7956('0xa')]=_0x518f0a[_0x7956('0xa')];this['mapAgentsId']={};this[_0x7956('0xb')]=0x0;this[_0x7956('0x1')]='';this['updateRouting']();this[_0x7956('0xc')]();}SmsQueue[_0x7956('0xd')][_0x7956('0xe')]=function(){var _0x4bfc14=this[_0x7956('0xf')][_0x7956('0x10')];this[_0x7956('0xf')]=_[_0x7956('0x11')](this['Agents'],'id');this[_0x7956('0xf')][_0x7956('0x10')]=_0x4bfc14;};SmsQueue[_0x7956('0xd')]['updateRealtime']=function(){this[_0x7956('0x12')]=0x0;this[_0x7956('0x13')]=0x0;for(var _0x248b79=0x0;_0x248b79=0x0?this['available']:0x0;var _0x5c3afb={'id':this['id'],'available':this[_0x7956('0x17')],'loggedIn':this[_0x7956('0x12')],'name':this['name'],'paused':this[_0x7956('0x13')],'waiting':this['waiting']};var _0x635d5b=md5(JSON[_0x7956('0x18')](_0x5c3afb));if(this['md5']!==_0x635d5b){this[_0x7956('0x1')]=_0x635d5b;io['to'](util[_0x7956('0x19')](_0x7956('0x1a'),_0x5c3afb['name']))[_0x7956('0x1b')]('sms_queue:save',_0x5c3afb);}};module[_0x7956('0x1c')]=SmsQueue; \ No newline at end of file +var _0xcb99=['util','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','smsPause','available','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x25a191,_0x119e4e){var _0x10ffb8=function(_0x5872fa){while(--_0x5872fa){_0x25a191['push'](_0x25a191['shift']());}};_0x10ffb8(++_0x119e4e);}(_0xcb99,0x8b));var _0x9cb9=function(_0x5f170f,_0x553d8e){_0x5f170f=_0x5f170f-0x0;var _0x2419de=_0xcb99[_0x5f170f];return _0x2419de;};'use strict';var _=require(_0x9cb9('0x0'));var md5=require('md5');var util=require(_0x9cb9('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9cb9('0x2')]=_[_0x9cb9('0x3')](config[_0x9cb9('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x9cb9('0x4'))(new Redis(config[_0x9cb9('0x2')]));function SmsQueue(_0x544d32){this['id']=_0x544d32['id']||0x0;this[_0x9cb9('0x5')]=_0x544d32['name']||'';this[_0x9cb9('0x6')]=_0x544d32[_0x9cb9('0x6')]||0xa;this[_0x9cb9('0x7')]=_0x544d32[_0x9cb9('0x7')]||_0x9cb9('0x8');this[_0x9cb9('0x9')]=_0x544d32[_0x9cb9('0x9')];this[_0x9cb9('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x9cb9('0xb')]();this[_0x9cb9('0xc')]();}SmsQueue[_0x9cb9('0xd')]['updateRouting']=function(){var _0x3be02c=this[_0x9cb9('0xa')]['_rr'];this['mapAgentsId']=_[_0x9cb9('0xe')](this[_0x9cb9('0x9')],'id');this[_0x9cb9('0xa')][_0x9cb9('0xf')]=_0x3be02c;};SmsQueue['prototype'][_0x9cb9('0xc')]=function(){this[_0x9cb9('0x10')]=0x0;this[_0x9cb9('0x11')]=0x0;for(var _0x32352d=0x0;_0x32352d=0x0?this[_0x9cb9('0x15')]:0x0;var _0x4e89cf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9cb9('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x97ecd2=md5(JSON['stringify'](_0x4e89cf));if(this[_0x9cb9('0x16')]!==_0x97ecd2){this[_0x9cb9('0x16')]=_0x97ecd2;io['to'](util[_0x9cb9('0x17')](_0x9cb9('0x18'),_0x4e89cf[_0x9cb9('0x5')]))[_0x9cb9('0x19')](_0x9cb9('0x1a'),_0x4e89cf);}};module[_0x9cb9('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b4555ef..a0b8cfb 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 _0x65b6=['Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall'];(function(_0x152afe,_0x2ff8cb){var _0x23a369=function(_0x3dee1c){while(--_0x3dee1c){_0x152afe['push'](_0x152afe['shift']());}};_0x23a369(++_0x2ff8cb);}(_0x65b6,0x122));var _0x665b=function(_0x944e7,_0x5722a4){_0x944e7=_0x944e7-0x0;var _0x3cb03a=_0x65b6[_0x944e7];return _0x3cb03a;};'use strict';var _=require('lodash');var md5=require(_0x665b('0x0'));var util=require(_0x665b('0x1'));var Redis=require(_0x665b('0x2'));var config=require('../../../config/environment');config[_0x665b('0x3')]=_[_0x665b('0x4')](config[_0x665b('0x3')],{'host':_0x665b('0x5'),'port':0x18eb});var io=require(_0x665b('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x38e86a){this['id']=_0x38e86a['id']||0x0;this['name']=_0x38e86a[_0x665b('0x7')]||'';this['timeout']=_0x38e86a['timeout']||0xa;this[_0x665b('0x8')]=_0x38e86a['strategy']||_0x665b('0x9');this['Agents']=_0x38e86a[_0x665b('0xa')];this[_0x665b('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x665b('0xc')]();this[_0x665b('0xd')]();}WhatsappQueue[_0x665b('0xe')][_0x665b('0xc')]=function(){var _0x5496d8=this['mapAgentsId']['_rr'];this[_0x665b('0xb')]=_[_0x665b('0xf')](this[_0x665b('0xa')],'id');this['mapAgentsId'][_0x665b('0x10')]=_0x5496d8;};WhatsappQueue[_0x665b('0xe')][_0x665b('0xd')]=function(){this['loggedIn']=0x0;this[_0x665b('0x11')]=0x0;for(var _0x3b2b16=0x0;_0x3b2b16=0x0?this[_0x665b('0x15')]:0x0;var _0x3e9f78={'id':this['id'],'available':this[_0x665b('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x665b('0x7')],'paused':this[_0x665b('0x11')],'waiting':this['waiting']};var _0x3578be=md5(JSON[_0x665b('0x16')](_0x3e9f78));if(this['md5']!==_0x3578be){this[_0x665b('0x0')]=_0x3578be;io['to'](util['format'](_0x665b('0x17'),_0x3e9f78[_0x665b('0x7')]))['emit'](_0x665b('0x18'),_0x3e9f78);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xad8b=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x55b7c5,_0xb4e7ac){var _0x5310aa=function(_0x11e63a){while(--_0x11e63a){_0x55b7c5['push'](_0x55b7c5['shift']());}};_0x5310aa(++_0xb4e7ac);}(_0xad8b,0x1b9));var _0xbad8=function(_0x58f073,_0x440c14){_0x58f073=_0x58f073-0x0;var _0x4d3a50=_0xad8b[_0x58f073];return _0x4d3a50;};'use strict';var _=require(_0xbad8('0x0'));var md5=require('md5');var util=require(_0xbad8('0x1'));var Redis=require(_0xbad8('0x2'));var config=require(_0xbad8('0x3'));config[_0xbad8('0x4')]=_[_0xbad8('0x5')](config[_0xbad8('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbad8('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x31813c){this['id']=_0x31813c['id']||0x0;this[_0xbad8('0x7')]=_0x31813c['name']||'';this[_0xbad8('0x8')]=_0x31813c[_0xbad8('0x8')]||0xa;this[_0xbad8('0x9')]=_0x31813c[_0xbad8('0x9')]||_0xbad8('0xa');this[_0xbad8('0xb')]=_0x31813c['Agents'];this[_0xbad8('0xc')]={};this[_0xbad8('0xd')]=0x0;this[_0xbad8('0xe')]='';this['updateRouting']();this[_0xbad8('0xf')]();}WhatsappQueue[_0xbad8('0x10')]['updateRouting']=function(){var _0x21114e=this[_0xbad8('0xc')][_0xbad8('0x11')];this[_0xbad8('0xc')]=_[_0xbad8('0x12')](this[_0xbad8('0xb')],'id');this['mapAgentsId'][_0xbad8('0x11')]=_0x21114e;};WhatsappQueue[_0xbad8('0x10')][_0xbad8('0xf')]=function(){this[_0xbad8('0x13')]=0x0;this[_0xbad8('0x14')]=0x0;for(var _0x477893=0x0;_0x477893=0x0?this[_0xbad8('0x18')]:0x0;var _0x26af7d={'id':this['id'],'available':this[_0xbad8('0x18')],'loggedIn':this[_0xbad8('0x13')],'name':this[_0xbad8('0x7')],'paused':this[_0xbad8('0x14')],'waiting':this[_0xbad8('0xd')]};var _0x5bfbf4=md5(JSON['stringify'](_0x26af7d));if(this['md5']!==_0x5bfbf4){this['md5']=_0x5bfbf4;io['to'](util[_0xbad8('0x19')](_0xbad8('0x1a'),_0x26af7d[_0xbad8('0x7')]))[_0xbad8('0x1b')](_0xbad8('0x1c'),_0x26af7d);}};module[_0xbad8('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4f41d55..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(_0x315655,_0xb3bb5e){var _0x493db7=function(_0x2cc0d0){while(--_0x2cc0d0){_0x315655['push'](_0x315655['shift']());}};_0x493db7(++_0xb3bb5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xb10b[_0x40348a];return _0x290d46;};'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 1e5fa49..54cb017 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 _0x1d49=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d49,0x154));var _0x91d4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1d49[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x91d4('0x0'));exports['update']=function(_0x14e2ae,_0x2ef400){return client[_0x91d4('0x1')](_0x91d4('0x2'),{'body':_0x2ef400,'options':{'where':{'id':_0x14e2ae}},'log':_0x91d4('0x3')});};exports[_0x91d4('0x4')]=function(_0x1a5207,_0x519f4d){return client[_0x91d4('0x1')](_0x91d4('0x5'),{'body':_0x519f4d,'options':{'where':{'id':_0x1a5207}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6a6e=['addTags','../client','update','Request','updateChatInteraction'];(function(_0x1f7bc9,_0xd2e513){var _0x4c470b=function(_0x35ed26){while(--_0x35ed26){_0x1f7bc9['push'](_0x1f7bc9['shift']());}};_0x4c470b(++_0xd2e513);}(_0x6a6e,0x8d));var _0xe6a6=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x6a6e[_0x199c03];return _0x11a7d4;};'use strict';var client=require(_0xe6a6('0x0'));exports[_0xe6a6('0x1')]=function(_0x50787d,_0x56c0ff){return client[_0xe6a6('0x2')]('UpdateChatInteraction',{'body':_0x56c0ff,'options':{'where':{'id':_0x50787d}},'log':_0xe6a6('0x3')});};exports[_0xe6a6('0x4')]=function(_0x4e718a,_0x2fd6e1){return client[_0xe6a6('0x2')]('AddTagsToChatInteraction',{'body':_0x2fd6e1,'options':{'where':{'id':_0x4e718a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0a34eac..d253238 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 _0x795d=['create','CreateChatMessage'];(function(_0x55308f,_0x1b86e0){var _0xfa9b65=function(_0x312317){while(--_0x312317){_0x55308f['push'](_0x55308f['shift']());}};_0xfa9b65(++_0x1b86e0);}(_0x795d,0x9a));var _0xd795=function(_0x95a001,_0xe13511){_0x95a001=_0x95a001-0x0;var _0x31c10a=_0x795d[_0x95a001];return _0x31c10a;};'use strict';var client=require('../client');exports[_0xd795('0x0')]=function(_0x3fec3f){return client['Request'](_0xd795('0x1'),{'body':_0x3fec3f,'log':'createChatMessage'});}; \ No newline at end of file +var _0x222e=['create','Request','CreateChatMessage','../client'];(function(_0x47f60b,_0x12b379){var _0x53be2e=function(_0x1585e0){while(--_0x1585e0){_0x47f60b['push'](_0x47f60b['shift']());}};_0x53be2e(++_0x12b379);}(_0x222e,0xdb));var _0xe222=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x222e[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xe222('0x0'));exports[_0xe222('0x1')]=function(_0x28684a){return client[_0xe222('0x2')](_0xe222('0x3'),{'body':_0x28684a,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a071d22..60da6d3 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 _0x36bb=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x27ca91,_0x5f5359){var _0x59e0fc=function(_0x2c7aba){while(--_0x2c7aba){_0x27ca91['push'](_0x27ca91['shift']());}};_0x59e0fc(++_0x5f5359);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb36b('0x0'));exports[_0xb36b('0x1')]=function(){return function(){return client[_0xb36b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xb36b('0x3'),_0xb36b('0x4'),_0xb36b('0x5')],'include':[{'model':_0xb36b('0x6'),'as':_0xb36b('0x7'),'attributes':['id',_0xb36b('0x3'),_0xb36b('0x8'),_0xb36b('0x9')]}]},'log':_0xb36b('0x1')});};}; \ No newline at end of file +var _0x39d9=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x24966f,_0x457ce7){var _0x3e2fec=function(_0x12aa3a){while(--_0x12aa3a){_0x24966f['push'](_0x24966f['shift']());}};_0x3e2fec(++_0x457ce7);}(_0x39d9,0x17f));var _0x939d=function(_0x4064b6,_0x45ed94){_0x4064b6=_0x4064b6-0x0;var _0x174f0b=_0x39d9[_0x4064b6];return _0x174f0b;};'use strict';var client=require(_0x939d('0x0'));exports[_0x939d('0x1')]=function(){return function(){return client[_0x939d('0x2')](_0x939d('0x3'),{'options':{'raw':![],'attributes':['id',_0x939d('0x4'),_0x939d('0x5'),_0x939d('0x6')],'include':[{'model':_0x939d('0x7'),'as':'Agents','attributes':['id',_0x939d('0x4'),_0x939d('0x8'),_0x939d('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 27c523c..f4f873e 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 _0x544a=['create','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client'];(function(_0x2dc252,_0x3da532){var _0x189959=function(_0x360e49){while(--_0x360e49){_0x2dc252['push'](_0x2dc252['shift']());}};_0x189959(++_0x3da532);}(_0x544a,0xbd));var _0xa544=function(_0xae6bc8,_0x11049e){_0xae6bc8=_0xae6bc8-0x0;var _0x1b2cd7=_0x544a[_0xae6bc8];return _0x1b2cd7;};'use strict';var client=require(_0xa544('0x0'));exports[_0xa544('0x1')]=function(_0x311c86){return client['Request']('CreateChatQueueReport',{'body':_0x311c86,'log':_0xa544('0x2')});};exports['update']=function(_0x42b8f1,_0xdca212){return client['Request'](_0xa544('0x3'),{'body':_0xdca212,'options':{'where':{'uniqueid':_0x42b8f1},'order':[['id',_0xa544('0x4')]],'limit':0x1},'log':_0xa544('0x3')});}; \ No newline at end of file +var _0x976a=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','../client','create'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x976a,0xf4));var _0xa976=function(_0x4e668b,_0x35b443){_0x4e668b=_0x4e668b-0x0;var _0xba75aa=_0x976a[_0x4e668b];return _0xba75aa;};'use strict';var client=require(_0xa976('0x0'));exports[_0xa976('0x1')]=function(_0x231566){return client['Request'](_0xa976('0x2'),{'body':_0x231566,'log':_0xa976('0x2')});};exports[_0xa976('0x3')]=function(_0x3a593b,_0x2ea74e){return client[_0xa976('0x4')](_0xa976('0x5'),{'body':_0x2ea74e,'options':{'where':{'uniqueid':_0x3a593b},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 20d41e2..08b1af5 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4559c1,_0x276738){var _0x10510f=function(_0x163979){while(--_0x163979){_0x4559c1['push'](_0x4559c1['shift']());}};_0x10510f(++_0x276738);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xad9801,_0x4f85f0){var _0x1bd3c=function(_0x26bad3){while(--_0x26bad3){_0xad9801['push'](_0xad9801['shift']());}};_0x1bd3c(++_0x4f85f0);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 4e09acd..9ffa452 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 _0x17c0=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x4345ef,_0x40d76b){var _0x52e0f8=function(_0x49b5cd){while(--_0x49b5cd){_0x4345ef['push'](_0x4345ef['shift']());}};_0x52e0f8(++_0x40d76b);}(_0x17c0,0x1d6));var _0x017c=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x17c0[_0x4c5c97];return _0xd5d2cb;};'use strict';var client=require(_0x017c('0x0'));exports[_0x017c('0x1')]=function(_0x3bf225){return client[_0x017c('0x2')](_0x017c('0x3'),{'body':_0x3bf225,'log':_0x017c('0x4')});}; \ No newline at end of file +var _0x53f4=['CreateFaxMessage','create'];(function(_0x3fef3e,_0x5b4089){var _0x5423ed=function(_0x56f276){while(--_0x56f276){_0x3fef3e['push'](_0x3fef3e['shift']());}};_0x5423ed(++_0x5b4089);}(_0x53f4,0xab));var _0x453f=function(_0xff77d1,_0x18c62d){_0xff77d1=_0xff77d1-0x0;var _0x19cc2a=_0x53f4[_0xff77d1];return _0x19cc2a;};'use strict';var client=require('../client');exports[_0x453f('0x0')]=function(_0x396dce){return client['Request'](_0x453f('0x1'),{'body':_0x396dce,'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 50da8f1..241ea6b 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 _0xc69c=['strategy','User','Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x280419,_0x265ab0){var _0x513d83=function(_0x1545cd){while(--_0x1545cd){_0x280419['push'](_0x280419['shift']());}};_0x513d83(++_0x265ab0);}(_0xc69c,0xcc));var _0xcc69=function(_0x357be4,_0x3bc32f){_0x357be4=_0x357be4-0x0;var _0xa8b73d=_0xc69c[_0x357be4];return _0xa8b73d;};'use strict';var client=require(_0xcc69('0x0'));exports[_0xcc69('0x1')]=function(){return function(){return client[_0xcc69('0x2')](_0xcc69('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xcc69('0x4'),_0xcc69('0x5')],'include':[{'model':_0xcc69('0x6'),'as':_0xcc69('0x7'),'attributes':['id',_0xcc69('0x8'),_0xcc69('0x9'),_0xcc69('0xa')]}]},'log':_0xcc69('0x1')});};}; \ No newline at end of file +var _0x2941=['name','timeout','strategy','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x42bc52,_0x1c479b){var _0x5b152b=function(_0x1af8ad){while(--_0x1af8ad){_0x42bc52['push'](_0x42bc52['shift']());}};_0x5b152b(++_0x1c479b);}(_0x2941,0xa8));var _0x1294=function(_0x4c8833,_0x14e755){_0x4c8833=_0x4c8833-0x0;var _0x30df54=_0x2941[_0x4c8833];return _0x30df54;};'use strict';var client=require('../client');exports[_0x1294('0x0')]=function(){return function(){return client[_0x1294('0x1')](_0x1294('0x2'),{'options':{'raw':![],'attributes':['id',_0x1294('0x3'),_0x1294('0x4'),_0x1294('0x5')],'include':[{'model':'User','as':_0x1294('0x6'),'attributes':['id',_0x1294('0x3'),_0x1294('0x7'),_0x1294('0x8')]}]},'log':_0x1294('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 5481d36..10962e5 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 _0x570c=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x1f3295,_0x111dcd){var _0x209c64=function(_0x299e61){while(--_0x299e61){_0x1f3295['push'](_0x1f3295['shift']());}};_0x209c64(++_0x111dcd);}(_0x570c,0x1ad));var _0xc570=function(_0x2e7c3b,_0x14b816){_0x2e7c3b=_0x2e7c3b-0x0;var _0x2ef798=_0x570c[_0x2e7c3b];return _0x2ef798;};'use strict';var client=require(_0xc570('0x0'));exports[_0xc570('0x1')]=function(_0x1aa14a){return client[_0xc570('0x2')]('CreateFaxQueueReport',{'body':_0x1aa14a,'log':_0xc570('0x3')});};exports['update']=function(_0x1f9812,_0x53afed){return client[_0xc570('0x2')](_0xc570('0x4'),{'body':_0x53afed,'options':{'where':{'uniqueid':_0x1f9812},'order':[['id',_0xc570('0x5')]],'limit':0x1},'log':_0xc570('0x4')});}; \ No newline at end of file +var _0xbef6=['UpdateFaxQueueReport','../client','create','CreateFaxQueueReport'];(function(_0xb55b47,_0x4acac6){var _0x53650f=function(_0x2d1cd1){while(--_0x2d1cd1){_0xb55b47['push'](_0xb55b47['shift']());}};_0x53650f(++_0x4acac6);}(_0xbef6,0x1e1));var _0x6bef=function(_0xb7b1be,_0x426c6a){_0xb7b1be=_0xb7b1be-0x0;var _0x3d5d61=_0xbef6[_0xb7b1be];return _0x3d5d61;};'use strict';var client=require(_0x6bef('0x0'));exports[_0x6bef('0x1')]=function(_0x4090da){return client['Request'](_0x6bef('0x2'),{'body':_0x4090da,'log':_0x6bef('0x2')});};exports['update']=function(_0x25169f,_0xb52e0e){return client['Request'](_0x6bef('0x3'),{'body':_0xb52e0e,'options':{'where':{'uniqueid':_0x25169f},'order':[['id','DESC']],'limit':0x1},'log':_0x6bef('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fe923a3..19359d7 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 _0xbd96=['../client','getIntervals','Request','name','Interval','interval'];(function(_0x48b25d,_0x3b0205){var _0x15fc99=function(_0x488da8){while(--_0x488da8){_0x48b25d['push'](_0x48b25d['shift']());}};_0x15fc99(++_0x3b0205);}(_0xbd96,0x1c2));var _0x6bd9=function(_0x10cadc,_0x5e9bb2){_0x10cadc=_0x10cadc-0x0;var _0x45aaa0=_0xbd96[_0x10cadc];return _0x45aaa0;};'use strict';var client=require(_0x6bd9('0x0'));exports[_0x6bd9('0x1')]=function(){return function(){return client[_0x6bd9('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6bd9('0x3')],'include':[{'model':_0x6bd9('0x4'),'as':'Intervals','attributes':['id','name',_0x6bd9('0x5')]}]},'log':_0x6bd9('0x1')});};}; \ No newline at end of file +var _0x1fba=['interval','../client','getIntervals','Request','name','Intervals'];(function(_0x3ead2d,_0x29f3c6){var _0x2e6bed=function(_0xd7dc78){while(--_0xd7dc78){_0x3ead2d['push'](_0x3ead2d['shift']());}};_0x2e6bed(++_0x29f3c6);}(_0x1fba,0xa9));var _0xa1fb=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x1fba[_0x2c0dc0];return _0x4c0990;};'use strict';var client=require(_0xa1fb('0x0'));exports[_0xa1fb('0x1')]=function(){return function(){return client[_0xa1fb('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa1fb('0x3')],'include':[{'model':'Interval','as':_0xa1fb('0x4'),'attributes':['id',_0xa1fb('0x3'),_0xa1fb('0x5')]}]},'log':_0xa1fb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a9062a0..c71eb9b 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 _0xa456=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0xd8e9f5,_0x29df60){var _0x4b915e=function(_0xb395cb){while(--_0xb395cb){_0xd8e9f5['push'](_0xd8e9f5['shift']());}};_0x4b915e(++_0x29df60);}(_0xa456,0x142));var _0x6a45=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa456[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(_0x56dfe8,_0xd5464e){return client['Request'](_0x6a45('0x2'),{'body':_0xd5464e,'options':{'where':{'id':_0x56dfe8}},'log':_0x6a45('0x3')});};exports[_0x6a45('0x4')]=function(_0x500c72,_0x1f0701){return client[_0x6a45('0x5')](_0x6a45('0x6'),{'body':_0x1f0701,'options':{'where':{'id':_0x500c72}},'log':_0x6a45('0x7')});}; \ No newline at end of file +var _0xb78e=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4436ac,_0x1643ec){var _0x16960d=function(_0x52c795){while(--_0x52c795){_0x4436ac['push'](_0x4436ac['shift']());}};_0x16960d(++_0x1643ec);}(_0xb78e,0x1c9));var _0xeb78=function(_0x49c36d,_0x1140a5){_0x49c36d=_0x49c36d-0x0;var _0x16ed32=_0xb78e[_0x49c36d];return _0x16ed32;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(_0x4b8534,_0x1570f5){return client[_0xeb78('0x2')](_0xeb78('0x3'),{'body':_0x1570f5,'options':{'where':{'id':_0x4b8534}},'log':_0xeb78('0x4')});};exports[_0xeb78('0x5')]=function(_0x308d12,_0x13ef9d){return client[_0xeb78('0x2')]('AddTagsToMailInteraction',{'body':_0x13ef9d,'options':{'where':{'id':_0x308d12}},'log':_0xeb78('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b61f84e..bac00c9 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 _0x1102=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x1b96c6,_0x45e55a){var _0x4a20fa=function(_0x2b6da4){while(--_0x2b6da4){_0x1b96c6['push'](_0x1b96c6['shift']());}};_0x4a20fa(++_0x45e55a);}(_0x1102,0x1f3));var _0x2110=function(_0x1329eb,_0x486a85){_0x1329eb=_0x1329eb-0x0;var _0x7a2e77=_0x1102[_0x1329eb];return _0x7a2e77;};'use strict';var client=require(_0x2110('0x0'));exports[_0x2110('0x1')]=function(_0x539fd9){return client[_0x2110('0x2')](_0x2110('0x3'),{'body':_0x539fd9,'log':_0x2110('0x4')});}; \ No newline at end of file +var _0xf389=['create','Request','createMailMessage','../client'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xf389,0x18f));var _0x9f38=function(_0x5cb8ed,_0x50ec0f){_0x5cb8ed=_0x5cb8ed-0x0;var _0x25e81e=_0xf389[_0x5cb8ed];return _0x25e81e;};'use strict';var client=require(_0x9f38('0x0'));exports[_0x9f38('0x1')]=function(_0x23be57){return client[_0x9f38('0x2')]('CreateMailMessage',{'body':_0x23be57,'log':_0x9f38('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d88c329..4b04504 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 _0x1246=['Agents','name','online','mailPause','getMailQueues','../client','Request','GetMailQueue','strategy'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0x1246,0x17f));var _0x6124=function(_0x1bdba0,_0x305c9d){_0x1bdba0=_0x1bdba0-0x0;var _0x3f2686=_0x1246[_0x1bdba0];return _0x3f2686;};'use strict';var client=require(_0x6124('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x6124('0x1')](_0x6124('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x6124('0x3')],'include':[{'model':'User','as':_0x6124('0x4'),'attributes':['id',_0x6124('0x5'),_0x6124('0x6'),_0x6124('0x7')]}]},'log':_0x6124('0x8')});};}; \ No newline at end of file +var _0xce99=['Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User'];(function(_0x18b269,_0x4b9725){var _0x20807b=function(_0x259048){while(--_0x259048){_0x18b269['push'](_0x18b269['shift']());}};_0x20807b(++_0x4b9725);}(_0xce99,0x1b1));var _0x9ce9=function(_0x1d20e5,_0x3d4f74){_0x1d20e5=_0x1d20e5-0x0;var _0x14c8d3=_0xce99[_0x1d20e5];return _0x14c8d3;};'use strict';var client=require(_0x9ce9('0x0'));exports[_0x9ce9('0x1')]=function(){return function(){return client[_0x9ce9('0x2')](_0x9ce9('0x3'),{'options':{'raw':![],'attributes':['id',_0x9ce9('0x4'),'timeout',_0x9ce9('0x5')],'include':[{'model':_0x9ce9('0x6'),'as':_0x9ce9('0x7'),'attributes':['id',_0x9ce9('0x4'),_0x9ce9('0x8'),_0x9ce9('0x9')]}]},'log':_0x9ce9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b09c0bf..84dc49f 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 _0x29a4=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','create'];(function(_0x5dc670,_0x52fb7b){var _0x39acb=function(_0x31dcef){while(--_0x31dcef){_0x5dc670['push'](_0x5dc670['shift']());}};_0x39acb(++_0x52fb7b);}(_0x29a4,0x11f));var _0x429a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x29a4[_0xbd08b4];return _0x314f1e;};'use strict';var client=require('../client');exports[_0x429a('0x0')]=function(_0x1d6b2b){return client['Request'](_0x429a('0x1'),{'body':_0x1d6b2b,'log':'CreateMailQueueReport'});};exports[_0x429a('0x2')]=function(_0x3c4f78,_0x3ddf3e){return client[_0x429a('0x3')](_0x429a('0x4'),{'body':_0x3ddf3e,'options':{'where':{'uniqueid':_0x3c4f78},'order':[['id',_0x429a('0x5')]],'limit':0x1},'log':_0x429a('0x4')});}; \ No newline at end of file +var _0xe0ec=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','Request'];(function(_0x5ee16d,_0x3da087){var _0x1f0011=function(_0x2c1c86){while(--_0x2c1c86){_0x5ee16d['push'](_0x5ee16d['shift']());}};_0x1f0011(++_0x3da087);}(_0xe0ec,0x1ee));var _0xce0e=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xe0ec[_0x291d3f];return _0x242080;};'use strict';var client=require('../client');exports['create']=function(_0x2e9180){return client[_0xce0e('0x0')](_0xce0e('0x1'),{'body':_0x2e9180,'log':_0xce0e('0x1')});};exports[_0xce0e('0x2')]=function(_0x21017d,_0x504574){return client[_0xce0e('0x0')]('UpdateMailQueueReport',{'body':_0x504574,'options':{'where':{'uniqueid':_0x21017d},'order':[['id',_0xce0e('0x3')]],'limit':0x1},'log':_0xce0e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 84bb663..45b699b 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 _0xef89=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xef89,0xeb));var _0x9ef8=function(_0x468a4b,_0x46be00){_0x468a4b=_0x468a4b-0x0;var _0x174e06=_0xef89[_0x468a4b];return _0x174e06;};'use strict';var client=require(_0x9ef8('0x0'));exports[_0x9ef8('0x1')]=function(_0x2282bd,_0x253726){return client[_0x9ef8('0x2')](_0x9ef8('0x3'),{'body':_0x253726,'options':{'where':{'id':_0x2282bd}},'log':_0x9ef8('0x4')});};exports['addTags']=function(_0x42f895,_0x562995){return client[_0x9ef8('0x2')](_0x9ef8('0x5'),{'body':_0x562995,'options':{'where':{'id':_0x42f895}},'log':_0x9ef8('0x6')});}; \ No newline at end of file +var _0xee80=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xee80,0xb5));var _0x0ee8=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xee80[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0x0ee8('0x0'));exports['update']=function(_0x596171,_0x595295){return client['Request'](_0x0ee8('0x1'),{'body':_0x595295,'options':{'where':{'id':_0x596171}},'log':_0x0ee8('0x2')});};exports[_0x0ee8('0x3')]=function(_0x44c488,_0x41dad6){return client[_0x0ee8('0x4')](_0x0ee8('0x5'),{'body':_0x41dad6,'options':{'where':{'id':_0x44c488}},'log':_0x0ee8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0988b45..b6302eb 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 _0xb5d6=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xb5d6,0x194));var _0x6b5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5d6[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports['create']=function(_0xaac1b0){return client[_0x6b5d('0x0')](_0x6b5d('0x1'),{'body':_0xaac1b0,'log':_0x6b5d('0x2')});}; \ No newline at end of file +var _0x3d15=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x194794,_0x2858f2){var _0x4720fb=function(_0x2baeb0){while(--_0x2baeb0){_0x194794['push'](_0x194794['shift']());}};_0x4720fb(++_0x2858f2);}(_0x3d15,0x197));var _0x53d1=function(_0x26d2a9,_0x154f8b){_0x26d2a9=_0x26d2a9-0x0;var _0x5d31f1=_0x3d15[_0x26d2a9];return _0x5d31f1;};'use strict';var client=require(_0x53d1('0x0'));exports[_0x53d1('0x1')]=function(_0x46ce44){return client[_0x53d1('0x2')](_0x53d1('0x3'),{'body':_0x46ce44,'log':_0x53d1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index afc28f7..42869ad 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 _0x2f76=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','online'];(function(_0x104d83,_0x97aa07){var _0x31d84e=function(_0x5c9560){while(--_0x5c9560){_0x104d83['push'](_0x104d83['shift']());}};_0x31d84e(++_0x97aa07);}(_0x2f76,0x1a5));var _0x62f7=function(_0x1a536b,_0x1f275e){_0x1a536b=_0x1a536b-0x0;var _0x10a2d5=_0x2f76[_0x1a536b];return _0x10a2d5;};'use strict';var client=require(_0x62f7('0x0'));exports[_0x62f7('0x1')]=function(){return function(){return client[_0x62f7('0x2')](_0x62f7('0x3'),{'options':{'raw':![],'attributes':['id',_0x62f7('0x4'),_0x62f7('0x5'),'strategy'],'include':[{'model':_0x62f7('0x6'),'as':_0x62f7('0x7'),'attributes':['id','name',_0x62f7('0x8'),_0x62f7('0x9')]}]},'log':_0x62f7('0x1')});};}; \ No newline at end of file +var _0xd8fb=['Agents','name','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','strategy','User'];(function(_0x23f4d1,_0x234a4c){var _0x1d7997=function(_0x4e4e14){while(--_0x4e4e14){_0x23f4d1['push'](_0x23f4d1['shift']());}};_0x1d7997(++_0x234a4c);}(_0xd8fb,0x79));var _0xbd8f=function(_0x4f8a19,_0x280027){_0x4f8a19=_0x4f8a19-0x0;var _0x1848ab=_0xd8fb[_0x4f8a19];return _0x1848ab;};'use strict';var client=require(_0xbd8f('0x0'));exports[_0xbd8f('0x1')]=function(){return function(){return client['Request'](_0xbd8f('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xbd8f('0x3')],'include':[{'model':_0xbd8f('0x4'),'as':_0xbd8f('0x5'),'attributes':['id',_0xbd8f('0x6'),_0xbd8f('0x7'),_0xbd8f('0x8')]}]},'log':_0xbd8f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1fd8917..ac05aed 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 _0x6ebe=['update','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x507c91,_0x3eb556){var _0x274171=function(_0xe67bb6){while(--_0xe67bb6){_0x507c91['push'](_0x507c91['shift']());}};_0x274171(++_0x3eb556);}(_0x6ebe,0x146));var _0xe6eb=function(_0x4761cc,_0x35f634){_0x4761cc=_0x4761cc-0x0;var _0x1198d1=_0x6ebe[_0x4761cc];return _0x1198d1;};'use strict';var client=require(_0xe6eb('0x0'));exports[_0xe6eb('0x1')]=function(_0x1f1250){return client[_0xe6eb('0x2')](_0xe6eb('0x3'),{'body':_0x1f1250,'log':_0xe6eb('0x3')});};exports[_0xe6eb('0x4')]=function(_0x1ab014,_0x2c1381){return client[_0xe6eb('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2c1381,'options':{'where':{'uniqueid':_0x1ab014},'order':[['id',_0xe6eb('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xd86a=['create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0xa09f0f,_0x20db4d){var _0x23f890=function(_0x57012e){while(--_0x57012e){_0xa09f0f['push'](_0xa09f0f['shift']());}};_0x23f890(++_0x20db4d);}(_0xd86a,0xd1));var _0xad86=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xd86a[_0x33155c];return _0x5becf7;};'use strict';var client=require(_0xad86('0x0'));exports[_0xad86('0x1')]=function(_0x92279b){return client['Request'](_0xad86('0x2'),{'body':_0x92279b,'log':_0xad86('0x2')});};exports[_0xad86('0x3')]=function(_0x23f5d9,_0x2d8c23){return client['Request'](_0xad86('0x4'),{'body':_0x2d8c23,'options':{'where':{'uniqueid':_0x23f5d9},'order':[['id',_0xad86('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 08985fb..7f7a034 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 _0x4abf=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','addTags'];(function(_0x95af52,_0x23ca0c){var _0x5101d2=function(_0x59e6bc){while(--_0x59e6bc){_0x95af52['push'](_0x95af52['shift']());}};_0x5101d2(++_0x23ca0c);}(_0x4abf,0xac));var _0xf4ab=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0x4abf[_0x49a57f];return _0x2fa2a5;};'use strict';var client=require(_0xf4ab('0x0'));exports[_0xf4ab('0x1')]=function(_0x5cddfe,_0x321a54){return client['Request']('UpdateSmsInteraction',{'body':_0x321a54,'options':{'where':{'id':_0x5cddfe}},'log':'updateSmsInteraction'});};exports[_0xf4ab('0x2')]=function(_0x4599f6,_0x592623){return client['Request'](_0xf4ab('0x3'),{'body':_0x592623,'options':{'where':{'id':_0x4599f6}},'log':_0xf4ab('0x4')});}; \ No newline at end of file +var _0xbcba=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x410f1d,_0x1e326c){var _0x632645=function(_0x9e5b0d){while(--_0x9e5b0d){_0x410f1d['push'](_0x410f1d['shift']());}};_0x632645(++_0x1e326c);}(_0xbcba,0x6d));var _0xabcb=function(_0x3cd920,_0x4db0ec){_0x3cd920=_0x3cd920-0x0;var _0x1ae314=_0xbcba[_0x3cd920];return _0x1ae314;};'use strict';var client=require(_0xabcb('0x0'));exports[_0xabcb('0x1')]=function(_0x562380,_0x11136e){return client[_0xabcb('0x2')](_0xabcb('0x3'),{'body':_0x11136e,'options':{'where':{'id':_0x562380}},'log':_0xabcb('0x4')});};exports[_0xabcb('0x5')]=function(_0x3e3b9b,_0x5e10df){return client['Request'](_0xabcb('0x6'),{'body':_0x5e10df,'options':{'where':{'id':_0x3e3b9b}},'log':_0xabcb('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 70877d0..9510646 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 _0xa29a=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa29a,0x1ee));var _0xaa29=function(_0x3319c9,_0x15c3c4){_0x3319c9=_0x3319c9-0x0;var _0x4d21fe=_0xa29a[_0x3319c9];return _0x4d21fe;};'use strict';var client=require(_0xaa29('0x0'));exports['create']=function(_0x41e9b2){return client[_0xaa29('0x1')](_0xaa29('0x2'),{'body':_0x41e9b2,'log':_0xaa29('0x3')});}; \ No newline at end of file +var _0xda71=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x4c4e96,_0x26c032){var _0x102a57=function(_0x39d1e7){while(--_0x39d1e7){_0x4c4e96['push'](_0x4c4e96['shift']());}};_0x102a57(++_0x26c032);}(_0xda71,0x115));var _0x1da7=function(_0x5ad445,_0x12f387){_0x5ad445=_0x5ad445-0x0;var _0x153296=_0xda71[_0x5ad445];return _0x153296;};'use strict';var client=require(_0x1da7('0x0'));exports[_0x1da7('0x1')]=function(_0x12de00){return client[_0x1da7('0x2')](_0x1da7('0x3'),{'body':_0x12de00,'log':_0x1da7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1e717ed..23a36a1 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x20550a,_0x4d59f4){var _0x3e58f9=function(_0x29d06b){while(--_0x29d06b){_0x20550a['push'](_0x20550a['shift']());}};_0x3e58f9(++_0x4d59f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x284bf1,_0x490a1b){var _0x17a93a=function(_0x1ed61f){while(--_0x1ed61f){_0x284bf1['push'](_0x284bf1['shift']());}};_0x17a93a(++_0x490a1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b0c48f3..baf366c 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xb7203e,_0x97d39c){var _0x29e8df=function(_0x763660){while(--_0x763660){_0xb7203e['push'](_0xb7203e['shift']());}};_0x29e8df(++_0x97d39c);}(_0x34e8,0x12c));var _0x834e=function(_0x4c98f0,_0x19486d){_0x4c98f0=_0x4c98f0-0x0;var _0x360374=_0x34e8[_0x4c98f0];return _0x360374;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3ef892,_0x38fb64){var _0x19f2c0=function(_0x441ba3){while(--_0x441ba3){_0x3ef892['push'](_0x3ef892['shift']());}};_0x19f2c0(++_0x38fb64);}(_0x70e0,0x17b));var _0x070e=function(_0x259ae1,_0x297f26){_0x259ae1=_0x259ae1-0x0;var _0x509dd1=_0x70e0[_0x259ae1];return _0x509dd1;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 585a26b..6d277b5 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(_0x32bddc,_0x5d3e25){var _0x4cdc30=function(_0x4659f1){while(--_0x4659f1){_0x32bddc['push'](_0x32bddc['shift']());}};_0x4cdc30(++_0x5d3e25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x144f18,_0x39c0ae){var _0x49ef67=function(_0x44b1a4){while(--_0x44b1a4){_0x144f18['push'](_0x144f18['shift']());}};_0x49ef67(++_0x39c0ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 f927209..296a5c8 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 _0x326f=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x716faa,_0x43dca4){var _0x50e13b=function(_0x374872){while(--_0x374872){_0x716faa['push'](_0x716faa['shift']());}};_0x50e13b(++_0x43dca4);}(_0x326f,0xd1));var _0xf326=function(_0x518c06,_0x3d1a05){_0x518c06=_0x518c06-0x0;var _0x28d642=_0x326f[_0x518c06];return _0x28d642;};'use strict';var client=require(_0xf326('0x0'));exports['update']=function(_0x5452cc,_0x1d7a51){return client[_0xf326('0x1')](_0xf326('0x2'),{'body':_0x1d7a51,'options':{'where':{'id':_0x5452cc}},'log':_0xf326('0x3')});};exports[_0xf326('0x4')]=function(_0x120a26,_0x9445c6){return client[_0xf326('0x1')](_0xf326('0x5'),{'body':_0x9445c6,'options':{'where':{'id':_0x120a26}},'log':_0xf326('0x6')});}; \ No newline at end of file +var _0x7bd0=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x2c0bbb,_0x4fa674){var _0x203e49=function(_0x43eaad){while(--_0x43eaad){_0x2c0bbb['push'](_0x2c0bbb['shift']());}};_0x203e49(++_0x4fa674);}(_0x7bd0,0x111));var _0x07bd=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x7bd0[_0x4ab3fb];return _0x34fe1e;};'use strict';var client=require(_0x07bd('0x0'));exports[_0x07bd('0x1')]=function(_0x20836d,_0x3b79f2){return client[_0x07bd('0x2')](_0x07bd('0x3'),{'body':_0x3b79f2,'options':{'where':{'id':_0x20836d}},'log':_0x07bd('0x4')});};exports[_0x07bd('0x5')]=function(_0x5beba7,_0x2d7245){return client[_0x07bd('0x2')](_0x07bd('0x6'),{'body':_0x2d7245,'options':{'where':{'id':_0x5beba7}},'log':_0x07bd('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d2e820d..3c9b96f 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 _0x5f46=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x364df5,_0x34c8cc){var _0xef86ef=function(_0x519e5b){while(--_0x519e5b){_0x364df5['push'](_0x364df5['shift']());}};_0xef86ef(++_0x34c8cc);}(_0x5f46,0x159));var _0x65f4=function(_0x247583,_0x5a8133){_0x247583=_0x247583-0x0;var _0x23562b=_0x5f46[_0x247583];return _0x23562b;};'use strict';var client=require(_0x65f4('0x0'));exports[_0x65f4('0x1')]=function(_0x468458){return client[_0x65f4('0x2')](_0x65f4('0x3'),{'body':_0x468458,'log':_0x65f4('0x4')});}; \ No newline at end of file +var _0x13f7=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x13f7,0x180));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x713f('0x0')]=function(_0x23948a){return client['Request'](_0x713f('0x1'),{'body':_0x23948a,'log':_0x713f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 11e8647..80fe0b9 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 _0x461f=['Request','GetWhatsappQueue','name','strategy','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x461f,0x177));var _0xf461=function(_0x5f4777,_0x1df9ba){_0x5f4777=_0x5f4777-0x0;var _0x187998=_0x461f[_0x5f4777];return _0x187998;};'use strict';var client=require('../client');exports[_0xf461('0x0')]=function(){return function(){return client[_0xf461('0x1')](_0xf461('0x2'),{'options':{'raw':![],'attributes':['id',_0xf461('0x3'),'timeout',_0xf461('0x4')],'include':[{'model':'User','as':_0xf461('0x5'),'attributes':['id',_0xf461('0x3'),_0xf461('0x6'),_0xf461('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7875=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x133bad,_0x4d9eed){var _0x570152=function(_0x182459){while(--_0x182459){_0x133bad['push'](_0x133bad['shift']());}};_0x570152(++_0x4d9eed);}(_0x7875,0x6d));var _0x5787=function(_0x1cdadd,_0x2be05d){_0x1cdadd=_0x1cdadd-0x0;var _0x34287f=_0x7875[_0x1cdadd];return _0x34287f;};'use strict';var client=require(_0x5787('0x0'));exports[_0x5787('0x1')]=function(){return function(){return client[_0x5787('0x2')](_0x5787('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5787('0x4'),_0x5787('0x5')],'include':[{'model':_0x5787('0x6'),'as':_0x5787('0x7'),'attributes':['id',_0x5787('0x8'),_0x5787('0x9'),_0x5787('0xa')]}]},'log':_0x5787('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0007335..a964a58 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 _0xd443=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xd443,0x122));var _0x3d44=function(_0x439a95,_0x3f2636){_0x439a95=_0x439a95-0x0;var _0x16393f=_0xd443[_0x439a95];return _0x16393f;};'use strict';var client=require(_0x3d44('0x0'));exports[_0x3d44('0x1')]=function(_0x24c1a6){return client[_0x3d44('0x2')](_0x3d44('0x3'),{'body':_0x24c1a6,'log':'CreateWhatsappQueueReport'});};exports[_0x3d44('0x4')]=function(_0x406e55,_0x48a4d0){return client[_0x3d44('0x2')](_0x3d44('0x5'),{'body':_0x48a4d0,'options':{'where':{'uniqueid':_0x406e55},'order':[['id','DESC']],'limit':0x1},'log':_0x3d44('0x5')});}; \ No newline at end of file +var _0xfd6a=['update','Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xfd6a,0xba));var _0xafd6=function(_0x2b2d9f,_0x6ff294){_0x2b2d9f=_0x2b2d9f-0x0;var _0x2e60ea=_0xfd6a[_0x2b2d9f];return _0x2e60ea;};'use strict';var client=require(_0xafd6('0x0'));exports[_0xafd6('0x1')]=function(_0x2952c2){return client['Request'](_0xafd6('0x2'),{'body':_0x2952c2,'log':'CreateWhatsappQueueReport'});};exports[_0xafd6('0x3')]=function(_0x5539c0,_0x17fdb3){return client[_0xafd6('0x4')](_0xafd6('0x5'),{'body':_0x17fdb3,'options':{'where':{'uniqueid':_0x5539c0},'order':[['id',_0xafd6('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 5caf3aa..9a4f319 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 _0xc9f9=['error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length'];(function(_0x56bb19,_0x4f2136){var _0x1d1475=function(_0x4e7762){while(--_0x4e7762){_0x56bb19['push'](_0x56bb19['shift']());}};_0x1d1475(++_0x4f2136);}(_0xc9f9,0x1d1));var _0x9c9f=function(_0x37be14,_0x3d78de){_0x37be14=_0x37be14-0x0;var _0x4a089e=_0xc9f9[_0x37be14];return _0x4a089e;};'use strict';var schema=require('validate');var _=require(_0x9c9f('0x0'));var util=require(_0x9c9f('0x1'));var seqqueue=require(_0x9c9f('0x2'));var logger=require(_0x9c9f('0x3'))(_0x9c9f('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9c9f('0x5')},'timeout':{'type':_0x9c9f('0x6'),'message':_0x9c9f('0x7')}});function writeLog(_0x138903,_0x1dc695,_0x4018a0){return logger[_0x9c9f('0x8')](util[_0x9c9f('0x9')](_0x9c9f('0xa'),_0x138903,_0x1dc695[_0x9c9f('0xb')],_0x4018a0));}function handleFindAgent(_0x411f3a){return function(_0x3290d0){return _0x3290d0['name'][_0x9c9f('0xc')]()===_0x411f3a['toLowerCase']();};}exports[_0x9c9f('0xd')]=function(_0x15879c,_0x33c8e1,_0x588085,_0x4a0e6b){return function(_0x259afe){try{var _0x7ac1={'name':_0x33c8e1[0x0],'timeout':_0x33c8e1[0x1]};var _0x9e6bd0=queue[_0x9c9f('0xe')](_0x7ac1,{'typecast':!![]});if(_0x9e6bd0[_0x9c9f('0xf')]){logger[_0x9c9f('0x10')](_0x9c9f('0x11'),_0x15879c,_[_0x9c9f('0x12')](_0x9e6bd0,_0x9c9f('0x13'))[_0x9c9f('0x14')](',\x20'));_0x259afe[_0x9c9f('0x15')]();}else{var _0x3e8091=_['find'](_0x588085[_0x9c9f('0x16')],handleFindAgent(_0x7ac1[_0x9c9f('0xb')]));if(_0x3e8091){var _0x15f949=(_0x7ac1[_0x9c9f('0x17')]||0xa)*0x3e8;var _0x3abdac,_0x2a5445;var _0xe8b881=seqqueue[_0x9c9f('0x18')](_0x15f949);_0xe8b881['id']=_0x15879c;_0xe8b881[_0x9c9f('0x19')]=_0x15f949;_0xe8b881[_0x9c9f('0x1a')]=_0x4a0e6b['channel'];writeLog(_0x15879c,_0x3e8091,util[_0x9c9f('0x9')](_0x9c9f('0x1b'),_0x15f949));_0x588085[_0x9c9f('0x1c')][_0x15879c]['on']('end',function(){logger[_0x9c9f('0x8')](_0x9c9f('0x1d'),_0x15879c);clearTimeout(_0x2a5445);_0x2a5445=undefined;_0xe8b881[_0x9c9f('0x1e')]();if(_0x588085[_0x9c9f('0x1c')][_0x15879c]){delete _0x588085[_0x9c9f('0x1c')][_0x15879c];}_0x259afe[_0x9c9f('0x15')]();});_0x588085[_0x9c9f('0x1c')][_0x15879c]['on']('complete',function(){if(_0x588085['rules'][_0x15879c]){delete _0x588085['rules'][_0x15879c];}});_0x2a5445=setTimeout(function(){logger[_0x9c9f('0x8')](_0x9c9f('0x1f'),_0x15879c);clearTimeout(_0x2a5445);_0xe8b881[_0x9c9f('0x1e')]();_0x259afe['next']();},_0x15f949);strategy[_0x9c9f('0x20')](_0xe8b881,_0x3e8091,_0x588085,_0x4a0e6b);}else{logger[_0x9c9f('0x10')](_0x9c9f('0x21'),_0x15879c,_0x7ac1['name']);_0x259afe['stop']();}}}catch(_0x3e2ebc){console[_0x9c9f('0x22')](_0x3e2ebc);logger[_0x9c9f('0x10')](_0x9c9f('0x23'),_0x15879c,_0x3e2ebc[_0x9c9f('0x24')]);_0x259afe[_0x9c9f('0x15')]();}};}; \ No newline at end of file +var _0xe958=['error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','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','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe958,0x161));var _0x8e95=function(_0x3ee7ee,_0x479255){_0x3ee7ee=_0x3ee7ee-0x0;var _0x547971=_0xe958[_0x3ee7ee];return _0x547971;};'use strict';var schema=require(_0x8e95('0x0'));var _=require(_0x8e95('0x1'));var util=require(_0x8e95('0x2'));var seqqueue=require(_0x8e95('0x3'));var logger=require(_0x8e95('0x4'))(_0x8e95('0x5'));var strategy=require(_0x8e95('0x6'));var queue=schema({'name':{'type':_0x8e95('0x7'),'required':!![],'message':_0x8e95('0x8')},'timeout':{'type':_0x8e95('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x27d710,_0x2c3688,_0x3ed11d){return logger[_0x8e95('0xa')](util['format'](_0x8e95('0xb'),_0x27d710,_0x2c3688[_0x8e95('0xc')],_0x3ed11d));}function handleFindAgent(_0x52a0d5){return function(_0x1c6033){return _0x1c6033['name']['toLowerCase']()===_0x52a0d5[_0x8e95('0xd')]();};}exports[_0x8e95('0xe')]=function(_0x3dc908,_0x502bba,_0x515b5e,_0xf1f818){return function(_0x37660f){try{var _0x1267cb={'name':_0x502bba[0x0],'timeout':_0x502bba[0x1]};var _0x2ad50a=queue[_0x8e95('0x0')](_0x1267cb,{'typecast':!![]});if(_0x2ad50a[_0x8e95('0xf')]){logger[_0x8e95('0x10')](_0x8e95('0x11'),_0x3dc908,_[_0x8e95('0x12')](_0x2ad50a,_0x8e95('0x13'))[_0x8e95('0x14')](',\x20'));_0x37660f[_0x8e95('0x15')]();}else{var _0x472fb7=_[_0x8e95('0x16')](_0x515b5e[_0x8e95('0x17')],handleFindAgent(_0x1267cb[_0x8e95('0xc')]));if(_0x472fb7){var _0x18fc34=(_0x1267cb[_0x8e95('0x18')]||0xa)*0x3e8;var _0x3ed17a,_0x314aad;var _0x5df37a=seqqueue[_0x8e95('0x19')](_0x18fc34);_0x5df37a['id']=_0x3dc908;_0x5df37a[_0x8e95('0x1a')]=_0x18fc34;_0x5df37a[_0x8e95('0x1b')]=_0xf1f818[_0x8e95('0x1b')];writeLog(_0x3dc908,_0x472fb7,util['format'](_0x8e95('0x1c'),_0x18fc34));_0x515b5e[_0x8e95('0x1d')][_0x3dc908]['on'](_0x8e95('0x1e'),function(){logger[_0x8e95('0xa')](_0x8e95('0x1f'),_0x3dc908);clearTimeout(_0x314aad);_0x314aad=undefined;_0x5df37a[_0x8e95('0x20')]();if(_0x515b5e['rules'][_0x3dc908]){delete _0x515b5e[_0x8e95('0x1d')][_0x3dc908];}_0x37660f[_0x8e95('0x15')]();});_0x515b5e[_0x8e95('0x1d')][_0x3dc908]['on'](_0x8e95('0x21'),function(){if(_0x515b5e['rules'][_0x3dc908]){delete _0x515b5e[_0x8e95('0x1d')][_0x3dc908];}});_0x314aad=setTimeout(function(){logger['info'](_0x8e95('0x22'),_0x3dc908);clearTimeout(_0x314aad);_0x5df37a['close']();_0x37660f[_0x8e95('0x23')]();},_0x18fc34);strategy[_0x8e95('0x24')](_0x5df37a,_0x472fb7,_0x515b5e,_0xf1f818);}else{logger[_0x8e95('0x10')](_0x8e95('0x25'),_0x3dc908,_0x1267cb['name']);_0x37660f[_0x8e95('0x15')]();}}}catch(_0x4d3873){console[_0x8e95('0x26')](_0x4d3873);logger['error'](_0x8e95('0x27'),_0x3dc908,_0x4d3873[_0x8e95('0x28')]);_0x37660f[_0x8e95('0x15')]();}};}; \ 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 47eac4a..e03fedd 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 _0x6a49=['create','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!','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','then','dialogState','lodash','moment','aws-sdk','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x6a49,0x9b));var _0x96a4=function(_0x3bc509,_0x4b208f){_0x3bc509=_0x3bc509-0x0;var _0x21c169=_0x6a49[_0x3bc509];return _0x21c169;};'use strict';var _=require(_0x96a4('0x0'));var moment=require(_0x96a4('0x1'));var AWS=require(_0x96a4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x96a4('0x3')),'mailMessage':require(_0x96a4('0x4')),'smsMessage':require(_0x96a4('0x5')),'faxMessage':require(_0x96a4('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x96a4('0x7')]=function(_0x293689,_0x574ba8){return function(_0xf3fb03){try{if(!_[_0x96a4('0x8')](this['interaction'][_0x96a4('0x9')])){logger[_0x96a4('0xa')](_0x96a4('0xb'),_0x293689,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xf3fb03[_0x96a4('0xc')]();}var _0x59034a={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x96a4('0xd')),'direction':_0x96a4('0xe')};if(this[_0x96a4('0xf')]===_0x96a4('0x10')||this[_0x96a4('0xf')]===_0x96a4('0x11')){_0x59034a[_0x96a4('0x12')]=this[_0x96a4('0x13')]['phone'];}var _0xdcdb57=this[_0x96a4('0xf')];if(_0xdcdb57==='chat'){_0x59034a[_0x96a4('0x14')]=this[_0x96a4('0x15')]['id'];}else{_0x59034a[_[_0x96a4('0x16')](_0xdcdb57)+_0x96a4('0x17')]=this['account']['id'];}_0x59034a[_[_0x96a4('0x16')](_0xdcdb57)+'InteractionId']=this[_0x96a4('0x13')]['id'];if(this[_0x96a4('0x13')][_0x96a4('0x18')]){var _0x55baee=_0x574ba8[0x4];if(!_[_0x96a4('0x19')](_0x55baee)){_0x59034a[_0x96a4('0x1a')]=utils[_0x96a4('0x1b')](_0x55baee,this);return rpc[_0xdcdb57+_0x96a4('0x1c')][_0x96a4('0x1d')](_0x59034a)['then'](function(_0x21b1d1){logger[_0x96a4('0xa')](_0x96a4('0xb'),_0x293689,_0x59034a['body']);})[_0x96a4('0x1e')](function(_0x4aab87){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON[_0x96a4('0x20')](_0x4aab87));})[_0x96a4('0x21')](function(){logger[_0x96a4('0xa')](_0x96a4('0x22'),_0x293689);_0xf3fb03[_0x96a4('0x23')]();});}else{logger[_0x96a4('0xa')](_0x96a4('0x24'),_0x293689);_0xf3fb03[_0x96a4('0x23')]();}}else{var _0x5dc779=this;var _0x1db6c3=new AWS['LexRuntime']({'accessKeyId':_0x574ba8[0x0],'secretAccessKey':_0x574ba8[0x1],'region':_0x574ba8[0x2]});var _0x2c68f4={'botAlias':_0x96a4('0x25'),'botName':_0x574ba8[0x3],'inputText':this[_0x96a4('0x26')][_0x96a4('0x1a')],'userId':this['channel']+':'+this[_0x96a4('0x13')]['id'][_0x96a4('0x27')]()};_0x1db6c3[_0x96a4('0x28')](_0x2c68f4,function(_0x3160af,_0x5a12f2){if(_0x3160af){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,_0x3160af[_0x96a4('0x26')]);_0xf3fb03[_0x96a4('0xc')]();}else if(_0x5a12f2&&_0x5a12f2['message']){_0x5dc779[_0x96a4('0x1a')][_0x96a4('0x29')]=_0x5a12f2;_0x59034a[_0x96a4('0x1a')]=_0x5a12f2['message'];_0x59034a[_0x96a4('0x2a')]=_0x96a4('0x29');_0x59034a[_0x96a4('0x2b')]=JSON['stringify'](_0x5a12f2);return rpc[_0xdcdb57+_0x96a4('0x1c')]['create'](_0x59034a)[_0x96a4('0x2c')](function(_0x2693cb){logger['info']('[%s][AMAZONLEX]\x20%s',_0x293689,_0x59034a[_0x96a4('0x1a')]);if(_0x5a12f2[_0x96a4('0x2d')]=='Failed'){_0xf3fb03[_0x96a4('0xc')]();}else{_0xf3fb03[_0x96a4('0x23')]();}})['catch'](function(_0xfda478){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON['stringify'](_0xfda478));_0xf3fb03[_0x96a4('0xc')]();});}else{_0xf3fb03[_0x96a4('0xc')]();}});}}catch(_0x34f5f0){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON[_0x96a4('0x20')](_0x34f5f0));_0xf3fb03['stop']();}};}; \ No newline at end of file +var _0xf5f8=['body','toString','postText','amazonlex','providerName','providerResponse','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf5f8,0x1c9));var _0x8f5f=function(_0x1b360e,_0x4527fa){_0x1b360e=_0x1b360e-0x0;var _0x5be027=_0xf5f8[_0x1b360e];return _0x5be027;};'use strict';var _=require(_0x8f5f('0x0'));var moment=require(_0x8f5f('0x1'));var AWS=require(_0x8f5f('0x2'));var utils=require(_0x8f5f('0x3'));var logger=require('../../../../config/logger')(_0x8f5f('0x4'));var rpc={'chatMessage':require(_0x8f5f('0x5')),'openchannelMessage':require(_0x8f5f('0x6')),'mailMessage':require(_0x8f5f('0x7')),'smsMessage':require(_0x8f5f('0x8')),'faxMessage':require(_0x8f5f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8f5f('0xa')]=function(_0xcbdc49,_0x4ae049){return function(_0x3a3f1d){try{if(!_['isNil'](this[_0x8f5f('0xb')][_0x8f5f('0xc')])){logger[_0x8f5f('0xd')](_0x8f5f('0xe'),_0xcbdc49,_0x8f5f('0xf'));return _0x3a3f1d[_0x8f5f('0x10')]();}var _0x19f9ca={'ContactId':this[_0x8f5f('0x11')]['id'],'sentAt':moment()[_0x8f5f('0x12')](_0x8f5f('0x13')),'direction':_0x8f5f('0x14')};if(this[_0x8f5f('0x15')]===_0x8f5f('0x16')||this['channel']==='whatsapp'){_0x19f9ca[_0x8f5f('0x17')]=this[_0x8f5f('0xb')][_0x8f5f('0x17')];}var _0x3d959e=this[_0x8f5f('0x15')];if(_0x3d959e==='chat'){_0x19f9ca[_0x8f5f('0x18')]=this[_0x8f5f('0x19')]['id'];}else{_0x19f9ca[_[_0x8f5f('0x1a')](_0x3d959e)+_0x8f5f('0x1b')]=this['account']['id'];}_0x19f9ca[_[_0x8f5f('0x1a')](_0x3d959e)+_0x8f5f('0x1c')]=this['interaction']['id'];if(this[_0x8f5f('0xb')][_0x8f5f('0x1d')]){var _0x5b7707=_0x4ae049[0x4];if(!_[_0x8f5f('0x1e')](_0x5b7707)){_0x19f9ca['body']=utils['getMustacheRender'](_0x5b7707,this);return rpc[_0x3d959e+_0x8f5f('0x1f')][_0x8f5f('0x20')](_0x19f9ca)[_0x8f5f('0x21')](function(_0x48e1cd){logger[_0x8f5f('0xd')]('[%s][AMAZONLEX]\x20%s',_0xcbdc49,_0x19f9ca['body']);})[_0x8f5f('0x22')](function(_0x58b170){logger[_0x8f5f('0x23')](_0x8f5f('0xe'),_0xcbdc49,JSON[_0x8f5f('0x24')](_0x58b170));})[_0x8f5f('0x25')](function(){logger[_0x8f5f('0xd')](_0x8f5f('0x26'),_0xcbdc49);_0x3a3f1d['stop']();});}else{logger[_0x8f5f('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xcbdc49);_0x3a3f1d[_0x8f5f('0x27')]();}}else{var _0x151c3f=this;var _0x22362e=new AWS[(_0x8f5f('0x28'))]({'accessKeyId':_0x4ae049[0x0],'secretAccessKey':_0x4ae049[0x1],'region':_0x4ae049[0x2]});var _0x4124bb={'botAlias':_0x8f5f('0x29'),'botName':_0x4ae049[0x3],'inputText':this[_0x8f5f('0x2a')][_0x8f5f('0x2b')],'userId':this[_0x8f5f('0x15')]+':'+this[_0x8f5f('0xb')]['id'][_0x8f5f('0x2c')]()};_0x22362e[_0x8f5f('0x2d')](_0x4124bb,function(_0x399219,_0x47e396){if(_0x399219){logger[_0x8f5f('0x23')]('[%s][AMAZONLEX]\x20%s',_0xcbdc49,_0x399219[_0x8f5f('0x2a')]);_0x3a3f1d[_0x8f5f('0x10')]();}else if(_0x47e396&&_0x47e396[_0x8f5f('0x2a')]){_0x151c3f[_0x8f5f('0x2b')][_0x8f5f('0x2e')]=_0x47e396;_0x19f9ca[_0x8f5f('0x2b')]=_0x47e396['message'];_0x19f9ca[_0x8f5f('0x2f')]=_0x8f5f('0x2e');_0x19f9ca[_0x8f5f('0x30')]=JSON[_0x8f5f('0x24')](_0x47e396);return rpc[_0x3d959e+'Message']['create'](_0x19f9ca)[_0x8f5f('0x21')](function(_0x5646ec){logger[_0x8f5f('0xd')](_0x8f5f('0xe'),_0xcbdc49,_0x19f9ca['body']);if(_0x47e396['dialogState']==_0x8f5f('0x31')){_0x3a3f1d[_0x8f5f('0x10')]();}else{_0x3a3f1d['stop']();}})[_0x8f5f('0x22')](function(_0xf519d4){logger[_0x8f5f('0x23')](_0x8f5f('0xe'),_0xcbdc49,JSON[_0x8f5f('0x24')](_0xf519d4));_0x3a3f1d[_0x8f5f('0x10')]();});}else{_0x3a3f1d[_0x8f5f('0x10')]();}});}}catch(_0x5bf8a1){logger[_0x8f5f('0x23')](_0x8f5f('0xe'),_0xcbdc49,JSON['stringify'](_0x5bf8a1));_0x3a3f1d[_0x8f5f('0x27')]();}};}; \ 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 59bbe04..f9ec865 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 _0xf313=['[%s][AUTOREPLY]\x20%s','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','inReplyTo','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf313,0xe6));var _0x3f31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf313[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x3f31('0x0'));var moment=require(_0x3f31('0x1'));var utils=require(_0x3f31('0x2'));var logger=require(_0x3f31('0x3'))(_0x3f31('0x4'));var rpc={'chatMessage':require(_0x3f31('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3f31('0x6')),'smsMessage':require(_0x3f31('0x7')),'faxMessage':require(_0x3f31('0x8')),'whatsappMessage':require(_0x3f31('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x3f31('0xa')),'faxInteraction':require(_0x3f31('0xb')),'whatsappInteraction':require(_0x3f31('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3b3a3b,_0x5d6b9d,_0x5cc77b,_0x29cf1e){return function(_0xced047){try{var _0x19da82=this[_0x3f31('0xd')];if(_0x19da82===_0x3f31('0xe')&&_0x29cf1e[_0x3f31('0xf')][_0x3f31('0x10')]){logger[_0x3f31('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,_0x3f31('0x12'));return _0xced047[_0x3f31('0x13')]();}if(_0x5d6b9d[0x0]==='1'&&(_[_0x3f31('0x14')](this['interaction'][_0x3f31('0x15')])||!this['interaction'][_0x3f31('0x15')])){logger[_0x3f31('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,_0x3f31('0x16'));return _0xced047['next']();}if(_0x5d6b9d[0x0]==='2'&&this['interaction'][_0x3f31('0x17')]){logger['info'](_0x3f31('0x18'),_0x3b3a3b,_0x3f31('0x19'));return _0xced047[_0x3f31('0x13')]();}var _0x5137e9={'ContactId':this[_0x3f31('0x1a')]['id'],'sentAt':moment()[_0x3f31('0x1b')](_0x3f31('0x1c')),'direction':_0x3f31('0x1d')};if(this[_0x3f31('0xd')]==='mail'){_0x5137e9[_0x3f31('0xf')]=utils[_0x3f31('0x1e')](_0x5d6b9d[0x2],this);}else{_0x5137e9[_0x3f31('0xf')]=utils[_0x3f31('0x1e')](_0x5d6b9d[0x1],this);}if(this[_0x3f31('0x1f')]){_0x5137e9['to']=this['message'][_0x3f31('0x20')]||'';if(this[_0x3f31('0xd')]===_0x3f31('0xe')&&_0x5d6b9d[0x1]==='1'){_0x5137e9['cc']=this[_0x3f31('0x1f')]['cc']||'';}_0x5137e9[_0x3f31('0x20')]=this[_0x3f31('0x1f')]['to']||'';_0x5137e9['phone']=this['message'][_0x3f31('0x21')]||'';_0x5137e9['read']=!![];if(this[_0x3f31('0x1f')][_0x3f31('0x22')]){_0x5137e9[_0x3f31('0x22')]='';_0x5137e9[_0x3f31('0x22')]+=_[_0x3f31('0x23')](this[_0x3f31('0x1f')][_0x3f31('0x22')],_0x3f31('0x24'))?'':_0x3f31('0x25');_0x5137e9[_0x3f31('0x22')]+=this['message']['subject'];}}if(this[_0x3f31('0xd')]===_0x3f31('0x26')){_0x5137e9[_0x3f31('0x27')]=this[_0x3f31('0x28')]['id'];}else{_0x5137e9[_[_0x3f31('0x29')](this[_0x3f31('0xd')])+_0x3f31('0x2a')]=this[_0x3f31('0x28')]['id'];}_0x5137e9[_[_0x3f31('0x29')](this['channel'])+_0x3f31('0x2b')]=this[_0x3f31('0x2c')]['id'];var _0x390ee9=this['interaction'];if(rpc[this[_0x3f31('0xd')]+_0x3f31('0x2d')]){if(this[_0x3f31('0xd')]===_0x3f31('0xe')){_0x5137e9[_0x3f31('0x2e')]=this[_0x3f31('0x1f')]['messageId'];_0x5137e9[_0x3f31('0x2f')]=_0x3f31('0x30')+_[_0x3f31('0x31')](_0x5137e9[_0x3f31('0xf')],_0x3f31('0x32'),_0x3f31('0x33'))+_0x3f31('0x34');_0x5137e9[_0x3f31('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x3f31('0x36'),'Precedence':_0x3f31('0x37')};return mailRpc[_0x3f31('0x38')](this[_0x3f31('0x28')][_0x3f31('0x39')],_0x5137e9)[_0x3f31('0x3a')](function(_0xde0ff7){logger['info'](_0x3f31('0x3b'),_0x3b3a3b);_0x5137e9[_0x3f31('0x3c')]=_0xde0ff7[_0x3f31('0x1f')][_0x3f31('0x3c')];return rpc[_0x19da82+'Message'][_0x3f31('0x3d')](_0x5137e9);})[_0x3f31('0x3a')](function(_0x36d5c3){logger[_0x3f31('0x11')](_0x3f31('0x3e'),_0x3b3a3b,JSON['stringify'](_0x36d5c3));})[_0x3f31('0x3f')](function(_0x2ca3bd){logger[_0x3f31('0x40')](_0x3f31('0x41'),_0x3b3a3b,JSON[_0x3f31('0x42')](_0x2ca3bd));})[_0x3f31('0x43')](function(){Promise[_0x3f31('0x44')]()['then'](function(){if(_0x5d6b9d[0x0]!=='2'||_0x390ee9['autoreplyExecuted'])return;return rpc[_0x19da82+'Interaction'][_0x3f31('0x45')](_0x390ee9['id'],{'autoreplyExecuted':!![]})[_0x3f31('0x3a')](function(_0x37cce1){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x37cce1));})[_0x3f31('0x3f')](function(_0x565d49){logger[_0x3f31('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x565d49));});})[_0x3f31('0x3a')](function(){_0xced047[_0x3f31('0x13')]();});});}else{return rpc[this[_0x3f31('0xd')]+'Message'][_0x3f31('0x3d')](_0x5137e9)[_0x3f31('0x3a')](function(){logger[_0x3f31('0x11')](_0x3f31('0x3e'),_0x3b3a3b,_0x5137e9['body']);})[_0x3f31('0x3f')](function(_0x19c39f){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x19c39f));})[_0x3f31('0x43')](function(){Promise['resolve']()[_0x3f31('0x3a')](function(){if(_0x5d6b9d[0x0]!=='2'||_0x390ee9[_0x3f31('0x17')])return;return rpc[_0x19da82+_0x3f31('0x46')][_0x3f31('0x45')](_0x390ee9['id'],{'autoreplyExecuted':!![]})['then'](function(_0x240a2a){logger[_0x3f31('0x11')](_0x3f31('0x18'),_0x3b3a3b,JSON['stringify'](_0x240a2a));})['catch'](function(_0x27b41a){logger[_0x3f31('0x40')](_0x3f31('0x47'),_0x3b3a3b,JSON['stringify'](_0x27b41a));});})[_0x3f31('0x3a')](function(){_0xced047['next']();});});}}}catch(_0x33d524){logger[_0x3f31('0x40')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x33d524));_0xced047[_0x3f31('0x48')]();}};}; \ No newline at end of file +var _0x714d=['interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','mail','body','getMustacheRender','message','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','stringify','create','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created'];(function(_0x51f9bd,_0x1b85f3){var _0x229c60=function(_0xc0b529){while(--_0xc0b529){_0x51f9bd['push'](_0x51f9bd['shift']());}};_0x229c60(++_0x1b85f3);}(_0x714d,0xb1));var _0xd714=function(_0x53c924,_0x464cd5){_0x53c924=_0x53c924-0x0;var _0x3b4f2b=_0x714d[_0x53c924];return _0x3b4f2b;};'use strict';var _=require(_0xd714('0x0'));var moment=require(_0xd714('0x1'));var utils=require(_0xd714('0x2'));var logger=require(_0xd714('0x3'))('routing');var rpc={'chatMessage':require(_0xd714('0x4')),'openchannelMessage':require(_0xd714('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd714('0x6')),'faxMessage':require(_0xd714('0x7')),'whatsappMessage':require(_0xd714('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd714('0x9')),'mailInteraction':require(_0xd714('0xa')),'smsInteraction':require(_0xd714('0xb')),'faxInteraction':require(_0xd714('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xd714('0xd')]=function(_0x2a7ff6,_0x3ea62d,_0x254d8d,_0x1a0e1a){return function(_0x3fbae5){try{var _0x1d0768=this[_0xd714('0xe')];if(_0x1d0768==='mail'&&_0x1a0e1a['body'][_0xd714('0xf')]){logger['info'](_0xd714('0x10'),_0x2a7ff6,_0xd714('0x11'));return _0x3fbae5[_0xd714('0x12')]();}if(_0x3ea62d[0x0]==='1'&&(_[_0xd714('0x13')](this['interaction'][_0xd714('0x14')])||!this[_0xd714('0x15')][_0xd714('0x14')])){logger['info'](_0xd714('0x10'),_0x2a7ff6,'Autoreply\x20already\x20sent');return _0x3fbae5[_0xd714('0x12')]();}if(_0x3ea62d[0x0]==='2'&&this['interaction'][_0xd714('0x16')]){logger['info'](_0xd714('0x17'),_0x2a7ff6,_0xd714('0x18'));return _0x3fbae5[_0xd714('0x12')]();}var _0x334b6b={'ContactId':this[_0xd714('0x19')]['id'],'sentAt':moment()[_0xd714('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd714('0x1b')};if(this[_0xd714('0xe')]===_0xd714('0x1c')){_0x334b6b[_0xd714('0x1d')]=utils[_0xd714('0x1e')](_0x3ea62d[0x2],this);}else{_0x334b6b[_0xd714('0x1d')]=utils[_0xd714('0x1e')](_0x3ea62d[0x1],this);}if(this[_0xd714('0x1f')]){_0x334b6b['to']=this['message']['from']||'';if(this['channel']==='mail'&&_0x3ea62d[0x1]==='1'){_0x334b6b['cc']=this[_0xd714('0x1f')]['cc']||'';}_0x334b6b['from']=this[_0xd714('0x1f')]['to']||'';_0x334b6b[_0xd714('0x20')]=this[_0xd714('0x1f')][_0xd714('0x20')]||'';_0x334b6b[_0xd714('0x21')]=!![];if(this[_0xd714('0x1f')][_0xd714('0x22')]){_0x334b6b[_0xd714('0x22')]='';_0x334b6b['subject']+=_[_0xd714('0x23')](this[_0xd714('0x1f')][_0xd714('0x22')],_0xd714('0x24'))?'':'Re:\x20';_0x334b6b[_0xd714('0x22')]+=this[_0xd714('0x1f')][_0xd714('0x22')];}}if(this[_0xd714('0xe')]==='chat'){_0x334b6b[_0xd714('0x25')]=this[_0xd714('0x26')]['id'];}else{_0x334b6b[_[_0xd714('0x27')](this[_0xd714('0xe')])+_0xd714('0x28')]=this[_0xd714('0x26')]['id'];}_0x334b6b[_[_0xd714('0x27')](this[_0xd714('0xe')])+'InteractionId']=this['interaction']['id'];var _0x40a500=this[_0xd714('0x15')];if(rpc[this['channel']+_0xd714('0x29')]){if(this[_0xd714('0xe')]===_0xd714('0x1c')){_0x334b6b[_0xd714('0x2a')]=this[_0xd714('0x1f')][_0xd714('0x2b')];_0x334b6b[_0xd714('0x2c')]=''+_[_0xd714('0x2d')](_0x334b6b[_0xd714('0x1d')],_0xd714('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x137d14[0x1],'priorityFalse':_0x137d14[0x2]};var _0x41331a=gotoif[_0xe6c9('0xb')](_0x32ac14,{'typecast':!![]});if(_0x41331a[_0xe6c9('0xc')]){logger['error'](_0xe6c9('0xd'),_0x1f5e80,_['map'](_0x41331a,_0xe6c9('0xe'))[_0xe6c9('0xf')](',\x20'));_0x1e3765[_0xe6c9('0x10')]();}else{try{var _0x3cf382=eval('('+_0x32ac14[_0xe6c9('0x11')]+')');var _0x5e292c=_0x3cf382?_0x32ac14[_0xe6c9('0x12')]:_0x32ac14[_0xe6c9('0x13')];logger['info'](_0xe6c9('0x14'),_0x1f5e80,_0x32ac14[_0xe6c9('0x11')],_0x3cf382,_0x5e292c||'next');if(_0x5e292c){var _0x2685f7=_[_0xe6c9('0x15')](_0x1e3765[_0xe6c9('0x16')](),{'p':_0x5e292c});if(_0x2685f7>=0x0){logger[_0xe6c9('0x17')](_0xe6c9('0x18'),_0x1f5e80,_0x5e292c||_0xe6c9('0x19'),_0x2685f7);_0x1e3765[_0xe6c9('0x19')](_0x2685f7);}else{logger[_0xe6c9('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1f5e80,_0x5e292c||_0xe6c9('0x19'));_0x1e3765[_0xe6c9('0x10')]();}}else{_0x1e3765['next']();}}catch(_0x527751){logger[_0xe6c9('0x1a')](_0xe6c9('0x1b'),_0x1f5e80,_0x527751[_0xe6c9('0xe')]);_0x1e3765[_0xe6c9('0x10')]();}}}catch(_0x1946b2){logger[_0xe6c9('0x1a')](_0xe6c9('0xd'),_0x1f5e80,JSON['stringify'](_0x1946b2));_0x1e3765[_0xe6c9('0x10')]();}};}; \ No newline at end of file +var _0x6ff0=['stop','priorityTrue','priorityFalse','info','condition','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x469de5,_0x49543f){var _0x2345da=function(_0x2f5f70){while(--_0x2f5f70){_0x469de5['push'](_0x469de5['shift']());}};_0x2345da(++_0x49543f);}(_0x6ff0,0x190));var _0x06ff=function(_0x56285f,_0x27efed){_0x56285f=_0x56285f-0x0;var _0x16cdc7=_0x6ff0[_0x56285f];return _0x16cdc7;};'use strict';var schema=require(_0x06ff('0x0'));var _=require(_0x06ff('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x06ff('0x2'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x06ff('0x3')},'priorityTrue':{'type':_0x06ff('0x4'),'message':_0x06ff('0x5')},'priorityFalse':{'type':'number','message':_0x06ff('0x6')}});exports[_0x06ff('0x7')]=function(_0x1faae9,_0x4c732f){return function(_0x533eb0){try{var _0x3cb8d0={'condition':htmlToText[_0x06ff('0x8')](utils['getMustacheRender'](_0x4c732f[0x0],this),{'wordwrap':![]})[_0x06ff('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4c732f[0x1],'priorityFalse':_0x4c732f[0x2]};var _0x50835d=gotoif['validate'](_0x3cb8d0,{'typecast':!![]});if(_0x50835d[_0x06ff('0xa')]){logger[_0x06ff('0xb')](_0x06ff('0xc'),_0x1faae9,_[_0x06ff('0xd')](_0x50835d,_0x06ff('0xe'))[_0x06ff('0xf')](',\x20'));_0x533eb0[_0x06ff('0x10')]();}else{try{var _0x3dc4d3=eval('('+_0x3cb8d0['condition']+')');var _0x22d019=_0x3dc4d3?_0x3cb8d0[_0x06ff('0x11')]:_0x3cb8d0[_0x06ff('0x12')];logger[_0x06ff('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1faae9,_0x3cb8d0[_0x06ff('0x14')],_0x3dc4d3,_0x22d019||'next');if(_0x22d019){var _0x554495=_[_0x06ff('0x15')](_0x533eb0[_0x06ff('0x16')](),{'p':_0x22d019});if(_0x554495>=0x0){logger['info'](_0x06ff('0x17'),_0x1faae9,_0x22d019||_0x06ff('0x18'),_0x554495);_0x533eb0[_0x06ff('0x18')](_0x554495);}else{logger[_0x06ff('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1faae9,_0x22d019||_0x06ff('0x18'));_0x533eb0[_0x06ff('0x10')]();}}else{_0x533eb0[_0x06ff('0x18')]();}}catch(_0x4a7a3c){logger[_0x06ff('0xb')](_0x06ff('0x19'),_0x1faae9,_0x4a7a3c['message']);_0x533eb0['stop']();}}}catch(_0x39a739){logger[_0x06ff('0xb')](_0x06ff('0xc'),_0x1faae9,JSON['stringify'](_0x39a739));_0x533eb0[_0x06ff('0x10')]();}};}; \ 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 37ca930..5685aac 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 _0x0b5c=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','routing','number'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x0b5c,0x15d));var _0xc0b5=function(_0xb0267,_0x5bfd39){_0xb0267=_0xb0267-0x0;var _0x305232=_0x0b5c[_0xb0267];return _0x305232;};'use strict';var schema=require('validate');var _=require(_0xc0b5('0x0'));var logger=require('../../../../config/logger')(_0xc0b5('0x1'));var gotop=schema({'priority':{'type':_0xc0b5('0x2'),'required':!![],'message':_0xc0b5('0x3')}});exports[_0xc0b5('0x4')]=function(_0x2c3aaf,_0x377460){return function(_0x51682a){try{var _0x45abf6={'priority':_0x377460[0x0]};var _0xa16f1=gotop[_0xc0b5('0x5')](_0x45abf6,{'typecast':!![]});if(_0xa16f1[_0xc0b5('0x6')]){logger[_0xc0b5('0x7')](_0xc0b5('0x8'),_0x2c3aaf,_[_0xc0b5('0x9')](_0xa16f1,_0xc0b5('0xa'))[_0xc0b5('0xb')](',\x20'));_0x51682a[_0xc0b5('0xc')]();}else{logger[_0xc0b5('0xd')](_0xc0b5('0xe'),_0x2c3aaf,_0x45abf6[_0xc0b5('0xf')]);if(_0x45abf6[_0xc0b5('0xf')]){var _0x1286e6=_[_0xc0b5('0x10')](_0x51682a[_0xc0b5('0x11')](),{'p':_0x45abf6[_0xc0b5('0xf')]});if(_0x1286e6>=0x0){logger['info'](_0xc0b5('0x12'),_0x2c3aaf,_0x45abf6['priority']||_0xc0b5('0x13'),_0x1286e6);_0x51682a[_0xc0b5('0x13')](_0x1286e6);}else{logger[_0xc0b5('0xd')](_0xc0b5('0x14'),_0x2c3aaf,_0x45abf6[_0xc0b5('0xf')]||'next');_0x51682a[_0xc0b5('0xc')]();}}else{_0x51682a[_0xc0b5('0x13')]();}}}catch(_0x28be3a){logger[_0xc0b5('0x7')](_0xc0b5('0x8'),_0x2c3aaf,JSON[_0xc0b5('0x15')](_0x28be3a));_0x51682a['stop']();}};}; \ No newline at end of file +var _0x8dfb=['priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','consequence','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0xc703ef,_0x45177c){var _0x5147b3=function(_0x456242){while(--_0x456242){_0xc703ef['push'](_0xc703ef['shift']());}};_0x5147b3(++_0x45177c);}(_0x8dfb,0x75));var _0xb8df=function(_0x21bf22,_0x16172a){_0x21bf22=_0x21bf22-0x0;var _0x144ee9=_0x8dfb[_0x21bf22];return _0x144ee9;};'use strict';var schema=require(_0xb8df('0x0'));var _=require(_0xb8df('0x1'));var logger=require(_0xb8df('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xb8df('0x3')]=function(_0x43f240,_0x7eba77){return function(_0x1fb8c6){try{var _0x51ec57={'priority':_0x7eba77[0x0]};var _0x1eeb96=gotop[_0xb8df('0x0')](_0x51ec57,{'typecast':!![]});if(_0x1eeb96['length']){logger[_0xb8df('0x4')](_0xb8df('0x5'),_0x43f240,_['map'](_0x1eeb96,_0xb8df('0x6'))[_0xb8df('0x7')](',\x20'));_0x1fb8c6[_0xb8df('0x8')]();}else{logger[_0xb8df('0x9')](_0xb8df('0xa'),_0x43f240,_0x51ec57[_0xb8df('0xb')]);if(_0x51ec57[_0xb8df('0xb')]){var _0x48a7c8=_['findIndex'](_0x1fb8c6['rules'](),{'p':_0x51ec57[_0xb8df('0xb')]});if(_0x48a7c8>=0x0){logger[_0xb8df('0x9')](_0xb8df('0xc'),_0x43f240,_0x51ec57[_0xb8df('0xb')]||_0xb8df('0xd'),_0x48a7c8);_0x1fb8c6['next'](_0x48a7c8);}else{logger[_0xb8df('0x9')](_0xb8df('0xe'),_0x43f240,_0x51ec57[_0xb8df('0xb')]||_0xb8df('0xd'));_0x1fb8c6[_0xb8df('0x8')]();}}else{_0x1fb8c6[_0xb8df('0xd')]();}}}catch(_0x18f8fb){logger[_0xb8df('0x4')]('[%s][GOTOP]\x20%s',_0x43f240,JSON[_0xb8df('0xf')](_0x18f8fb));_0x1fb8c6[_0xb8df('0x8')]();}};}; \ 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 fa70e38..f1fc856 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 _0x367e=['./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','lodash'];(function(_0x132849,_0x191063){var _0x17ebcf=function(_0x5ceb6a){while(--_0x5ceb6a){_0x132849['push'](_0x132849['shift']());}};_0x17ebcf(++_0x191063);}(_0x367e,0xa1));var _0xe367=function(_0x33a999,_0x31508b){_0x33a999=_0x33a999-0x0;var _0x1e4345=_0x367e[_0x33a999];return _0x1e4345;};'use strict';var _=require(_0xe367('0x0'));var utils=require(_0xe367('0x1'));var logger=require('../../../../config/logger')(_0xe367('0x2'));var rpc={'chatMessage':require(_0xe367('0x3')),'openchannelMessage':require(_0xe367('0x4')),'mailMessage':require(_0xe367('0x5')),'smsMessage':require(_0xe367('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe367('0x7'))};exports['consequence']=function(_0x340e90,_0x55656a){return function(_0x3e9517){try{var _0x3a3434={'body':utils[_0xe367('0x8')](_0x55656a[0x0],this),'ContactId':this[_0xe367('0x9')]['id']};if(this[_0xe367('0xa')]===_0xe367('0xb')){_0x3a3434[_0xe367('0xc')]=this[_0xe367('0xd')]['id'];}else{_0x3a3434[_[_0xe367('0xe')](this[_0xe367('0xa')])+_0xe367('0xf')]=this[_0xe367('0xd')]['id'];}_0x3a3434[_[_0xe367('0xe')](this[_0xe367('0xa')])+_0xe367('0x10')]=this[_0xe367('0x11')]['id'];if(rpc[this['channel']+_0xe367('0x12')]){return rpc[this[_0xe367('0xa')]+'Message'][_0xe367('0x13')](_0x3a3434)[_0xe367('0x14')](function(_0xc15758){logger[_0xe367('0x15')](_0xe367('0x16'),_0x340e90,_0x3a3434[_0xe367('0x17')]);_0x3e9517['next']();})[_0xe367('0x18')](function(_0x2b9fc4){logger[_0xe367('0x19')]('[%s][MESSAGE]\x20%s',_0x340e90,JSON[_0xe367('0x1a')](_0x2b9fc4));_0x3e9517['stop']();});}}catch(_0x567104){logger[_0xe367('0x19')]('[%s][MESSAGE]\x20%s',_0x340e90,JSON[_0xe367('0x1a')](_0x567104));_0x3e9517['stop']();}};}; \ No newline at end of file +var _0x2a85=['[%s][MESSAGE]\x20%s','stop','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','upperFirst','AccountId','account','InteractionId','Message','create','then','body','next'];(function(_0x3d3006,_0x4ae59d){var _0x1e55a2=function(_0x28d8ab){while(--_0x28d8ab){_0x3d3006['push'](_0x3d3006['shift']());}};_0x1e55a2(++_0x4ae59d);}(_0x2a85,0x1be));var _0x52a8=function(_0x405d46,_0x478e6a){_0x405d46=_0x405d46-0x0;var _0x53ca91=_0x2a85[_0x405d46];return _0x53ca91;};'use strict';var _=require(_0x52a8('0x0'));var utils=require(_0x52a8('0x1'));var logger=require(_0x52a8('0x2'))(_0x52a8('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x52a8('0x4')),'mailMessage':require(_0x52a8('0x5')),'smsMessage':require(_0x52a8('0x6')),'faxMessage':require(_0x52a8('0x7')),'whatsappMessage':require(_0x52a8('0x8'))};exports['consequence']=function(_0x2913be,_0x1a4894){return function(_0x540d81){try{var _0x540748={'body':utils[_0x52a8('0x9')](_0x1a4894[0x0],this),'ContactId':this[_0x52a8('0xa')]['id']};if(this[_0x52a8('0xb')]===_0x52a8('0xc')){_0x540748['ChatWebsiteId']=this['account']['id'];}else{_0x540748[_[_0x52a8('0xd')](this['channel'])+_0x52a8('0xe')]=this[_0x52a8('0xf')]['id'];}_0x540748[_['upperFirst'](this['channel'])+_0x52a8('0x10')]=this['interaction']['id'];if(rpc[this[_0x52a8('0xb')]+'Message']){return rpc[this[_0x52a8('0xb')]+_0x52a8('0x11')][_0x52a8('0x12')](_0x540748)[_0x52a8('0x13')](function(_0x138de4){logger['info']('[%s][MESSAGE]\x20%s',_0x2913be,_0x540748[_0x52a8('0x14')]);_0x540d81[_0x52a8('0x15')]();})['catch'](function(_0x1fcce1){logger['error'](_0x52a8('0x16'),_0x2913be,JSON['stringify'](_0x1fcce1));_0x540d81[_0x52a8('0x17')]();});}}catch(_0x3de993){logger[_0x52a8('0x18')](_0x52a8('0x16'),_0x2913be,JSON[_0x52a8('0x19')](_0x3de993));_0x540d81[_0x52a8('0x17')]();}};}; \ 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 b93e2a0..0904f45 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 _0xa841=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa841,0x14b));var _0x1a84=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa841[_0x1cc8fe];return _0x230054;};'use strict';var utils=require(_0x1a84('0x0'));var logger=require(_0x1a84('0x1'))('routing');exports[_0x1a84('0x2')]=function(_0x3de2f0,_0x3270a0){return function(_0x523a6f){try{logger[_0x1a84('0x3')](_0x1a84('0x4'),_0x3de2f0,utils[_0x1a84('0x5')](_0x3270a0[0x0],this));_0x523a6f[_0x1a84('0x6')]();}catch(_0x482946){logger[_0x1a84('0x7')](_0x1a84('0x4'),_0x3de2f0,JSON[_0x1a84('0x8')](_0x482946));_0x523a6f['stop']();}};}; \ No newline at end of file +var _0xde1f=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x4ea99c,_0x370ada){var _0xba1de8=function(_0x35868c){while(--_0x35868c){_0x4ea99c['push'](_0x4ea99c['shift']());}};_0xba1de8(++_0x370ada);}(_0xde1f,0x1e3));var _0xfde1=function(_0x29cb9b,_0x247dd1){_0x29cb9b=_0x29cb9b-0x0;var _0x544ff3=_0xde1f[_0x29cb9b];return _0x544ff3;};'use strict';var utils=require(_0xfde1('0x0'));var logger=require(_0xfde1('0x1'))(_0xfde1('0x2'));exports['consequence']=function(_0x4cf9da,_0x262dde){return function(_0x12e98b){try{logger[_0xfde1('0x3')](_0xfde1('0x4'),_0x4cf9da,utils['getMustacheRender'](_0x262dde[0x0],this));_0x12e98b[_0xfde1('0x5')]();}catch(_0x12b9fa){logger[_0xfde1('0x6')](_0xfde1('0x4'),_0x4cf9da,JSON[_0xfde1('0x7')](_0x12b9fa));_0x12e98b[_0xfde1('0x8')]();}};}; \ 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 0490678..30f5cb7 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 _0x0580=['update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','clone','account','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0580,0x1d0));var _0x0058=function(_0x3b5f36,_0x20330b){_0x3b5f36=_0x3b5f36-0x0;var _0xbb061e=_0x0580[_0x3b5f36];return _0xbb061e;};'use strict';var schema=require(_0x0058('0x0'));var _=require(_0x0058('0x1'));var util=require(_0x0058('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x0058('0x3'));var Redis=require(_0x0058('0x4'));var config=require(_0x0058('0x5'));var logger=require('../../../../config/logger')(_0x0058('0x6'));var strategy=require(_0x0058('0x7'));config[_0x0058('0x8')]=_[_0x0058('0x9')](config[_0x0058('0x8')],{'host':_0x0058('0xa'),'port':0x18eb});var io=require(_0x0058('0xb'))(new Redis(config[_0x0058('0x8')]));var attributes=['id','queue_id','account',_0x0058('0xc'),_0x0058('0xd'),_0x0058('0xe')];function emit(_0x57d2aa,_0x117d9a,_0xbf9687){io['to'](_0x57d2aa)[_0x0058('0xf')](_0x117d9a,_0xbf9687);}function emitChannelQueueInteraction(_0x571dbd,_0x139c33,_0x1ac2fe,_0x7451da,_0x4d1135,_0x1c2daa,_0x5b9782,_0x45940d){var _0x367d21=_[_0x0058('0x10')](_0x1ac2fe);_0x367d21['queue_id']=_0x45940d;_0x367d21[_0x0058('0xc')]=_0x139c33;_0x367d21[_0x0058('0x11')]=_0x7451da;_0x367d21['id']=_0x4d1135;if(_0x1c2daa){attributes[_0x0058('0x12')](_['capitalize'](_0x571dbd)+_0x0058('0x13'));_0x5b9782[util[_0x0058('0x14')](_0x0058('0x15'),_0x571dbd)][_0x4d1135]=_['pick'](_0x367d21,attributes);}else{delete _0x5b9782[util[_0x0058('0x14')](_0x0058('0x15'),_0x571dbd)][_0x4d1135];}emit(util['format'](_0x0058('0x16'),_0x571dbd,_0x139c33),util[_0x0058('0x14')](_0x0058('0x17'),_0x571dbd,_0x1c2daa?_0x0058('0x18'):_0x0058('0x19')),_[_0x0058('0x1a')](_0x367d21,attributes));}var rpc={'openchannelQueueReport':require(_0x0058('0x1b')),'mailQueueReport':require(_0x0058('0x1c')),'chatQueueReport':require(_0x0058('0x1d')),'smsQueueReport':require(_0x0058('0x1e')),'faxQueueReport':require(_0x0058('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x0058('0x20')),'mailInteraction':require(_0x0058('0x21')),'openchannelInteraction':require(_0x0058('0x22')),'smsInteraction':require(_0x0058('0x23')),'whatsappInteraction':require(_0x0058('0x24'))};var queue=schema({'name':{'type':_0x0058('0x25'),'required':!![],'message':_0x0058('0x26')},'timeout':{'type':_0x0058('0x27'),'message':_0x0058('0x28')}});function startRouting(_0x4fc5c9,_0xd36342,_0x5ab123,_0x23825e){if(_0x4fc5c9&&_0xd36342&&_0x5ab123){_0xd36342[_0x0058('0x29')]+=0x1;var _0x35b0fa={'uniqueid':_0x4fc5c9,'from':_0x5ab123['body']?_0x5ab123[_0x0058('0x2a')][_0x0058('0xd')]:'','joinAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'ContactId':_0x5ab123[_0x0058('0x2c')]?_0x5ab123[_0x0058('0x2c')]['id']:null,'ListId':_0x5ab123['list']?_0x5ab123['list']['id']:null};_0x35b0fa[_['upperFirst'](_0x5ab123[_0x0058('0x2d')])+_0x0058('0x2e')]=_0xd36342['id']||null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123[_0x0058('0x2d')])+_0x0058('0x13')]=_0x5ab123['interaction']?_0x5ab123[_0x0058('0x30')]['id']:null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123['channel'])+_0x0058('0x31')]=_0x5ab123[_0x0058('0x32')]?_0x5ab123[_0x0058('0x32')]['id']:null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123[_0x0058('0x2d')])+(_0x5ab123[_0x0058('0x2d')]!=='chat'?_0x0058('0x33'):_0x0058('0x34'))]=_0x5ab123[_0x0058('0x11')]?_0x5ab123[_0x0058('0x11')]['id']:null;logger['info'](util[_0x0058('0x14')](_0x0058('0x35'),_0x4fc5c9,_0xd36342[_0x0058('0x36')]));emitChannelQueueInteraction(_0x5ab123[_0x0058('0x2d')],_0xd36342[_0x0058('0x36')],_0x35b0fa,_0x5ab123[_0x0058('0x11')]['name'],_0x5ab123[_0x0058('0x32')]['id'],!![],_0x23825e,_0xd36342['id']);if(rpc[_0x5ab123['channel']+_0x0058('0x37')]){return rpc[_0x5ab123[_0x0058('0x2d')]+_0x0058('0x37')][_0x0058('0x38')](_0x35b0fa)[_0x0058('0x39')](function(_0x43355a){logger[_0x0058('0x3a')]('create\x20queue\x20report',_0x43355a);});}}}function stopRouting(_0x1d8338,_0x206de4,_0x2c5b5e,_0x5d9c2c){if(_0x1d8338&&_0x206de4){_0x206de4[_0x0058('0x29')]-=0x1;var _0xa74779={'leaveAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'acceptAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'reason':_0x0058('0x3b')};logger[_0x0058('0x3c')](util[_0x0058('0x14')](_0x0058('0x3d'),_0x1d8338,_0x206de4[_0x0058('0x36')]));emitChannelQueueInteraction(_0x2c5b5e[_0x0058('0x2d')],_0x206de4[_0x0058('0x36')],_0x2c5b5e['body'],_0x2c5b5e['account'][_0x0058('0x36')],_0x2c5b5e[_0x0058('0x32')]['id'],![],_0x5d9c2c,_0x206de4['id']);return rpc[_0x2c5b5e[_0x0058('0x2d')]+_0x0058('0x3e')]['update'](_0x2c5b5e['interaction']['id'],{'queueId':_0x206de4['id']})[_0x0058('0x3f')](function(){if(rpc[_0x2c5b5e['channel']+_0x0058('0x37')]){return rpc[_0x2c5b5e[_0x0058('0x2d')]+_0x0058('0x37')][_0x0058('0x40')](_0x1d8338,_0xa74779)[_0x0058('0x39')](function(_0x186c9b){logger[_0x0058('0x3a')](_0x0058('0x41'),_0x186c9b);});}});}}function endRouting(_0x212dc3,_0x44e7b1,_0x342405,_0x23e9f6){if(_0x212dc3&&_0x44e7b1){_0x44e7b1[_0x0058('0x29')]-=0x1;var _0x1a0ebf={'leaveAt':moment()[_0x0058('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x0058('0x2b')),'reason':_0x0058('0x42')};logger[_0x0058('0x3c')](util['format'](_0x0058('0x43'),_0x212dc3,_0x44e7b1['name']));emitChannelQueueInteraction(_0x342405[_0x0058('0x2d')],_0x44e7b1[_0x0058('0x36')],_0x342405[_0x0058('0x2a')],_0x342405['account'][_0x0058('0x36')],_0x342405[_0x0058('0x32')]['id'],![],_0x23e9f6);if(rpc[_0x342405['channel']+'QueueReport']){return rpc[_0x342405[_0x0058('0x2d')]+_0x0058('0x37')]['update'](_0x212dc3,_0x1a0ebf)['catch'](function(_0x2d28c3){logger[_0x0058('0x3a')]('update\x20queue\x20report',_0x2d28c3);});}}}function handleFindQueue(_0x4f86f1){return function(_0x4976b4){return _0x4976b4['name'][_0x0058('0x44')]()===_0x4f86f1['toLowerCase']();};}exports[_0x0058('0x45')]=function(_0x4b77e0,_0x3459bc,_0x4d1e0f,_0x320d68){return function(_0x32ad97){try{var _0x367627={'name':_0x3459bc[0x0],'timeout':_0x3459bc[0x1]};var _0x1d573c=queue[_0x0058('0x0')](_0x367627,{'typecast':!![]});if(_0x1d573c[_0x0058('0x46')]){logger[_0x0058('0x3a')](_0x0058('0x47'),_0x4b77e0,_['map'](_0x1d573c,'message')[_0x0058('0x48')](',\x20'));_0x32ad97[_0x0058('0x49')]();}else{var _0x3137b1=_[_0x0058('0x4a')](_0x4d1e0f[_0x320d68['channel']+_0x0058('0x4b')],handleFindQueue(_0x367627[_0x0058('0x36')]));if(_0x3137b1){startRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);var _0x443f79=(_0x3137b1[_0x0058('0x42')]||0xa)*0x3e8;var _0x416172=(_0x367627['timeout']||0x14)*0x3e8;var _0x1a1e72;if(_0x443f79>_0x416172){_0x416172=_0x443f79;}var _0x3f651a=seqqueue[_0x0058('0x4c')](_0x443f79);_0x3f651a['id']=_0x4b77e0;_0x3f651a[_0x0058('0x4d')]=_0x443f79;_0x3f651a[_0x0058('0x4e')]=_0x416172;_0x3f651a[_0x0058('0x2d')]=_0x320d68[_0x0058('0x2d')];_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]['on']('end',function(){logger[_0x0058('0x3c')](_0x0058('0x50'),_0x4b77e0);stopRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);clearTimeout(_0x1a1e72);_0x1a1e72=undefined;_0x3f651a[_0x0058('0x51')](!![]);if(_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]){delete _0x4d1e0f['rules'][_0x4b77e0];}_0x32ad97[_0x0058('0x49')]();});_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]['on'](_0x0058('0x52'),function(){if(_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]){delete _0x4d1e0f[_0x0058('0x4f')][_0x4b77e0];}});_0x1a1e72=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4b77e0);endRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);clearTimeout(_0x1a1e72);_0x3f651a[_0x0058('0x51')](!![]);_0x32ad97[_0x0058('0x53')]();},_0x416172);switch(_0x3137b1['strategy']){case'rrmemory':strategy[_0x0058('0x54')](_0x3f651a,_0x3137b1,_0x4d1e0f,_0x320d68);break;default:strategy[_0x0058('0x55')](_0x3f651a,_0x3137b1,_0x4d1e0f,_0x320d68);}}else{logger[_0x0058('0x3a')](_0x0058('0x56'),_0x4b77e0,_0x367627[_0x0058('0x36')]);_0x32ad97[_0x0058('0x49')]();}}}catch(_0x47bc0b){logger['error'](_0x0058('0x47'),_0x4b77e0,_0x47bc0b[_0x0058('0x57')]);_0x32ad97['stop']();}};}; \ No newline at end of file +var _0xeca3=['push','capitalize','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','name','Interaction','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','consequence','length','[%s][QUEUE]\x20%s','join','stop','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','clone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeca3,0x99));var _0x3eca=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xeca3[_0x51020b];return _0x371e47;};'use strict';var schema=require(_0x3eca('0x0'));var _=require(_0x3eca('0x1'));var util=require(_0x3eca('0x2'));var seqqueue=require(_0x3eca('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x3eca('0x4'));var logger=require(_0x3eca('0x5'))(_0x3eca('0x6'));var strategy=require(_0x3eca('0x7'));config[_0x3eca('0x8')]=_[_0x3eca('0x9')](config['redis'],{'host':_0x3eca('0xa'),'port':0x18eb});var io=require(_0x3eca('0xb'))(new Redis(config[_0x3eca('0x8')]));var attributes=['id',_0x3eca('0xc'),_0x3eca('0xd'),_0x3eca('0xe'),_0x3eca('0xf'),'joinAt'];function emit(_0x25d3e2,_0x3ab227,_0x46696e){io['to'](_0x25d3e2)['emit'](_0x3ab227,_0x46696e);}function emitChannelQueueInteraction(_0x1530cc,_0x1fb388,_0x10a3e4,_0x51a9f2,_0x1e25c5,_0x9441ed,_0x4c1f3e,_0x34272d){var _0x534e40=_[_0x3eca('0x10')](_0x10a3e4);_0x534e40[_0x3eca('0xc')]=_0x34272d;_0x534e40[_0x3eca('0xe')]=_0x1fb388;_0x534e40['account']=_0x51a9f2;_0x534e40['id']=_0x1e25c5;if(_0x9441ed){attributes[_0x3eca('0x11')](_[_0x3eca('0x12')](_0x1530cc)+'InteractionId');_0x4c1f3e[util[_0x3eca('0x13')](_0x3eca('0x14'),_0x1530cc)][_0x1e25c5]=_['pick'](_0x534e40,attributes);}else{delete _0x4c1f3e[util['format'](_0x3eca('0x14'),_0x1530cc)][_0x1e25c5];}emit(util['format']('%s:queue:%s',_0x1530cc,_0x1fb388),util[_0x3eca('0x13')](_0x3eca('0x15'),_0x1530cc,_0x9441ed?'save':_0x3eca('0x16')),_[_0x3eca('0x17')](_0x534e40,attributes));}var rpc={'openchannelQueueReport':require(_0x3eca('0x18')),'mailQueueReport':require(_0x3eca('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x3eca('0x1a')),'faxQueueReport':require(_0x3eca('0x1b')),'whatsappQueueReport':require(_0x3eca('0x1c')),'chatInteraction':require(_0x3eca('0x1d')),'faxInteraction':require(_0x3eca('0x1e')),'mailInteraction':require(_0x3eca('0x1f')),'openchannelInteraction':require(_0x3eca('0x20')),'smsInteraction':require(_0x3eca('0x21')),'whatsappInteraction':require(_0x3eca('0x22'))};var queue=schema({'name':{'type':_0x3eca('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x3eca('0x24'),'message':_0x3eca('0x25')}});function startRouting(_0x30c64a,_0x74ca32,_0x4acdc5,_0x4d0192){if(_0x30c64a&&_0x74ca32&&_0x4acdc5){_0x74ca32[_0x3eca('0x26')]+=0x1;var _0x4d0730={'uniqueid':_0x30c64a,'from':_0x4acdc5[_0x3eca('0x27')]?_0x4acdc5[_0x3eca('0x27')][_0x3eca('0xf')]:'','joinAt':moment()[_0x3eca('0x13')](_0x3eca('0x28')),'ContactId':_0x4acdc5['contact']?_0x4acdc5[_0x3eca('0x29')]['id']:null,'ListId':_0x4acdc5[_0x3eca('0x2a')]?_0x4acdc5['list']['id']:null};_0x4d0730[_[_0x3eca('0x2b')](_0x4acdc5[_0x3eca('0x2c')])+_0x3eca('0x2d')]=_0x74ca32['id']||null;_0x4d0730[_[_0x3eca('0x2b')](_0x4acdc5['channel'])+_0x3eca('0x2e')]=_0x4acdc5[_0x3eca('0x2f')]?_0x4acdc5[_0x3eca('0x2f')]['id']:null;_0x4d0730[_[_0x3eca('0x2b')](_0x4acdc5['channel'])+_0x3eca('0x30')]=_0x4acdc5[_0x3eca('0x31')]?_0x4acdc5[_0x3eca('0x31')]['id']:null;_0x4d0730[_[_0x3eca('0x2b')](_0x4acdc5[_0x3eca('0x2c')])+(_0x4acdc5[_0x3eca('0x2c')]!=='chat'?_0x3eca('0x32'):_0x3eca('0x33'))]=_0x4acdc5[_0x3eca('0xd')]?_0x4acdc5['account']['id']:null;logger[_0x3eca('0x34')](util['format'](_0x3eca('0x35'),_0x30c64a,_0x74ca32['name']));emitChannelQueueInteraction(_0x4acdc5[_0x3eca('0x2c')],_0x74ca32['name'],_0x4d0730,_0x4acdc5[_0x3eca('0xd')]['name'],_0x4acdc5['message']['id'],!![],_0x4d0192,_0x74ca32['id']);if(rpc[_0x4acdc5[_0x3eca('0x2c')]+_0x3eca('0x36')]){return rpc[_0x4acdc5['channel']+_0x3eca('0x36')][_0x3eca('0x37')](_0x4d0730)[_0x3eca('0x38')](function(_0x2170ab){logger[_0x3eca('0x39')](_0x3eca('0x3a'),_0x2170ab);});}}}function stopRouting(_0x14b64e,_0xd63341,_0x50b916,_0x5568ca){if(_0x14b64e&&_0xd63341){_0xd63341[_0x3eca('0x26')]-=0x1;var _0x541560={'leaveAt':moment()[_0x3eca('0x13')](_0x3eca('0x28')),'acceptAt':moment()[_0x3eca('0x13')](_0x3eca('0x28')),'reason':'accepted'};logger[_0x3eca('0x34')](util[_0x3eca('0x13')](_0x3eca('0x3b'),_0x14b64e,_0xd63341[_0x3eca('0x3c')]));emitChannelQueueInteraction(_0x50b916['channel'],_0xd63341[_0x3eca('0x3c')],_0x50b916[_0x3eca('0x27')],_0x50b916['account']['name'],_0x50b916[_0x3eca('0x31')]['id'],![],_0x5568ca,_0xd63341['id']);return rpc[_0x50b916['channel']+_0x3eca('0x3d')][_0x3eca('0x3e')](_0x50b916[_0x3eca('0x2f')]['id'],{'queueId':_0xd63341['id']})['then'](function(){if(rpc[_0x50b916[_0x3eca('0x2c')]+_0x3eca('0x36')]){return rpc[_0x50b916[_0x3eca('0x2c')]+'QueueReport'][_0x3eca('0x3e')](_0x14b64e,_0x541560)[_0x3eca('0x38')](function(_0x7056dc){logger[_0x3eca('0x39')](_0x3eca('0x3f'),_0x7056dc);});}});}}function endRouting(_0x5d580c,_0x3d4671,_0x309726,_0x2c8ada){if(_0x5d580c&&_0x3d4671){_0x3d4671[_0x3eca('0x26')]-=0x1;var _0x181e36={'leaveAt':moment()[_0x3eca('0x13')](_0x3eca('0x28')),'exitAt':moment()[_0x3eca('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x3eca('0x34')](util[_0x3eca('0x13')](_0x3eca('0x40'),_0x5d580c,_0x3d4671[_0x3eca('0x3c')]));emitChannelQueueInteraction(_0x309726[_0x3eca('0x2c')],_0x3d4671[_0x3eca('0x3c')],_0x309726['body'],_0x309726[_0x3eca('0xd')][_0x3eca('0x3c')],_0x309726[_0x3eca('0x31')]['id'],![],_0x2c8ada);if(rpc[_0x309726[_0x3eca('0x2c')]+'QueueReport']){return rpc[_0x309726['channel']+_0x3eca('0x36')]['update'](_0x5d580c,_0x181e36)[_0x3eca('0x38')](function(_0x4fcda7){logger[_0x3eca('0x39')](_0x3eca('0x3f'),_0x4fcda7);});}}}function handleFindQueue(_0x44c30c){return function(_0x23d2e0){return _0x23d2e0['name']['toLowerCase']()===_0x44c30c['toLowerCase']();};}exports[_0x3eca('0x41')]=function(_0x85ff1d,_0x256c30,_0x5dca58,_0x468d82){return function(_0x498641){try{var _0x258b71={'name':_0x256c30[0x0],'timeout':_0x256c30[0x1]};var _0x1c56a6=queue[_0x3eca('0x0')](_0x258b71,{'typecast':!![]});if(_0x1c56a6[_0x3eca('0x42')]){logger[_0x3eca('0x39')](_0x3eca('0x43'),_0x85ff1d,_['map'](_0x1c56a6,_0x3eca('0x31'))[_0x3eca('0x44')](',\x20'));_0x498641[_0x3eca('0x45')]();}else{var _0xc4031c=_['find'](_0x5dca58[_0x468d82[_0x3eca('0x2c')]+_0x3eca('0x46')],handleFindQueue(_0x258b71['name']));if(_0xc4031c){startRouting(_0x85ff1d,_0xc4031c,_0x468d82,_0x5dca58);var _0x50859c=(_0xc4031c[_0x3eca('0x47')]||0xa)*0x3e8;var _0x16e2e4=(_0x258b71[_0x3eca('0x47')]||0x14)*0x3e8;var _0x34d046;if(_0x50859c>_0x16e2e4){_0x16e2e4=_0x50859c;}var _0x18361e=seqqueue[_0x3eca('0x48')](_0x50859c);_0x18361e['id']=_0x85ff1d;_0x18361e[_0x3eca('0x49')]=_0x50859c;_0x18361e[_0x3eca('0x4a')]=_0x16e2e4;_0x18361e[_0x3eca('0x2c')]=_0x468d82[_0x3eca('0x2c')];_0x5dca58[_0x3eca('0x4b')][_0x85ff1d]['on'](_0x3eca('0x4c'),function(){logger[_0x3eca('0x34')](_0x3eca('0x4d'),_0x85ff1d);stopRouting(_0x85ff1d,_0xc4031c,_0x468d82,_0x5dca58);clearTimeout(_0x34d046);_0x34d046=undefined;_0x18361e[_0x3eca('0x4e')](!![]);if(_0x5dca58[_0x3eca('0x4b')][_0x85ff1d]){delete _0x5dca58[_0x3eca('0x4b')][_0x85ff1d];}_0x498641[_0x3eca('0x45')]();});_0x5dca58[_0x3eca('0x4b')][_0x85ff1d]['on'](_0x3eca('0x4f'),function(){if(_0x5dca58[_0x3eca('0x4b')][_0x85ff1d]){delete _0x5dca58['rules'][_0x85ff1d];}});_0x34d046=setTimeout(function(){logger[_0x3eca('0x34')](_0x3eca('0x50'),_0x85ff1d);endRouting(_0x85ff1d,_0xc4031c,_0x468d82,_0x5dca58);clearTimeout(_0x34d046);_0x18361e[_0x3eca('0x4e')](!![]);_0x498641['next']();},_0x16e2e4);switch(_0xc4031c[_0x3eca('0x51')]){case _0x3eca('0x52'):strategy['rrmemory'](_0x18361e,_0xc4031c,_0x5dca58,_0x468d82);break;default:strategy[_0x3eca('0x53')](_0x18361e,_0xc4031c,_0x5dca58,_0x468d82);}}else{logger[_0x3eca('0x39')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x85ff1d,_0x258b71[_0x3eca('0x3c')]);_0x498641[_0x3eca('0x45')]();}}}catch(_0x39070f){logger['error'](_0x3eca('0x43'),_0x85ff1d,_0x39070f[_0x3eca('0x54')]);_0x498641[_0x3eca('0x45')]();}};}; \ 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 bdf845a..f3e1e7b 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 _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2fc5d4,_0x514199){_0x2fc5d4=_0x2fc5d4-0x0;var _0x3b273c=_0xd0bb[_0x2fc5d4];return _0x3b273c;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=agent; \ No newline at end of file +var _0x57d4=['[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busy','showNotification','RINGING','handleTimeout','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','debug'];(function(_0x4f454a,_0xac1097){var _0x4e7471=function(_0x597466){while(--_0x597466){_0x4f454a['push'](_0x4f454a['shift']());}};_0x4e7471(++_0xac1097);}(_0x57d4,0x78));var _0x457d=function(_0x43129e,_0x241252){_0x43129e=_0x43129e-0x0;var _0x27b732=_0x57d4[_0x43129e];return _0x27b732;};'use strict';var _=require(_0x457d('0x0'));var uuid=require(_0x457d('0x1'));var util=require('./util');var logger=require(_0x457d('0x2'))(_0x457d('0x3'));var Agent=function(_0x1e26ab,_0x30a25c,_0x1219e1,_0x3c89b2){this[_0x457d('0x4')]=uuid['v4']();this[_0x457d('0x5')]=_0x1e26ab;this[_0x457d('0x6')]=_0x30a25c;this[_0x457d('0x7')]=_0x1219e1;this[_0x457d('0x3')]=_0x3c89b2;this['squeue'][_0x457d('0x8')](this[_0x457d('0x9')]['bind'](this),this['handleTimeout'][_0x457d('0xa')](this));this[_0x457d('0x5')]['on'](_0x457d('0xb'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x457d('0xc'),this[_0x457d('0xd')][_0x457d('0xa')](this));};Agent[_0x457d('0xe')][_0x457d('0x8')]=function(){this[_0x457d('0x5')][_0x457d('0x8')](this[_0x457d('0x9')][_0x457d('0xa')](this),this['handleTimeout'][_0x457d('0xa')](this));};Agent[_0x457d('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x457d('0xe')][_0x457d('0x9')]=function(){logger[_0x457d('0xf')](_0x457d('0x10'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);if(_[_0x457d('0x11')](this[_0x457d('0x7')]['agents'][this[_0x457d('0x6')]['id']])){logger[_0x457d('0xf')](_0x457d('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}else{if(this[_0x457d('0x3')][_0x457d('0x13')]||util['isAgentAvailable'](this[_0x457d('0x5')]['id'],this['realtime']['agents'][this[_0x457d('0x6')]['id']],this[_0x457d('0x5')][_0x457d('0x14')],![])){this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']][_0x457d('0x16')]=!![];this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x457d('0x3')],this['agent'],this['squeue']['channel']);util[_0x457d('0x17')](this[_0x457d('0x4')],this['squeue']['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],null,this[_0x457d('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x457d('0x7')]['agents'][this[_0x457d('0x6')]['id']],_0x457d('0x18')+(this[_0x457d('0x3')][_0x457d('0x13')]?':FORCED':''));}else{logger[_0x457d('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x457d('0x6')]['id']);setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}}};Agent[_0x457d('0xe')][_0x457d('0x19')]=function(_0x5b5b31){if(_[_0x457d('0x11')](this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']])){return logger[_0x457d('0xf')](_0x457d('0x12'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);}else{logger[_0x457d('0xf')](_0x457d('0x1a'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);util[_0x457d('0x1b')](this[_0x457d('0x4')],this[_0x457d('0x5')]['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],null,this['routing']);this[_0x457d('0x7')][_0x457d('0x15')][this['agent']['id']]['busy']=![];this[_0x457d('0x7')][_0x457d('0x15')][this['agent']['id']][_0x457d('0x1c')]=undefined;util[_0x457d('0x1d')](this[_0x457d('0x7')],this[_0x457d('0x3')],this[_0x457d('0x6')],this[_0x457d('0x5')][_0x457d('0x14')]);util[_0x457d('0x1e')](this[_0x457d('0x5')]['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],_0x5b5b31?_0x457d('0x1f'):_0x457d('0x20'));}if(!_0x5b5b31){setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}};function agent(_0x27811b,_0x4a4cea,_0x5a3db2,_0x482f74){return new Agent(_0x27811b,_0x4a4cea,_0x5a3db2,_0x482f74);}module[_0x457d('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 3feaa34..8ab51f8 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 _0x86e7=['queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','debug','writeLog','RINGING','busy','busyQueue','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x3c6755,_0x210dc3){var _0x3e6b43=function(_0x549f3c){while(--_0x549f3c){_0x3c6755['push'](_0x3c6755['shift']());}};_0x3e6b43(++_0x210dc3);}(_0x86e7,0xc5));var _0x786e=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x86e7[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x786e('0x0'));var uuid=require(_0x786e('0x1'));var util=require(_0x786e('0x2'));var logger=require(_0x786e('0x3'))(_0x786e('0x4'));var Beepall=function(_0x4d77e2,_0x665f57,_0x1d540c,_0x5d0699){this[_0x786e('0x5')]=uuid['v4']();this[_0x786e('0x6')]=_0x4d77e2;this[_0x786e('0x7')]=_0x665f57;this[_0x786e('0x8')]=_0x1d540c;this[_0x786e('0x4')]=_0x5d0699;this[_0x786e('0x6')][_0x786e('0x9')](this['handleRun'][_0x786e('0xa')](this),this[_0x786e('0xb')][_0x786e('0xa')](this));this[_0x786e('0x6')]['on'](_0x786e('0xc'),this[_0x786e('0xb')][_0x786e('0xa')](this));this['squeue']['on'](_0x786e('0xd'),this[_0x786e('0xe')][_0x786e('0xa')](this));};Beepall[_0x786e('0xf')][_0x786e('0x9')]=function(){this[_0x786e('0x6')][_0x786e('0x9')](this[_0x786e('0x10')][_0x786e('0xa')](this),this[_0x786e('0xb')][_0x786e('0xa')](this));};Beepall[_0x786e('0xf')][_0x786e('0xe')]=function(){this[_0x786e('0xb')](!![]);};Beepall[_0x786e('0xf')][_0x786e('0x10')]=function(){var _0x352875=!![];if(!_[_0x786e('0x11')](this[_0x786e('0x7')])&&!_['isNil'](this[_0x786e('0x7')]['Agents'])&&this[_0x786e('0x7')][_0x786e('0x12')][_0x786e('0x13')]>0x0){for(var _0x4f7978=0x0,_0x402111;_0x4f79780x0){for(var _0x148329=0x0,_0x3a34ef;_0x1483290x0&&_0x7919ab[_0x2f5b24+_0x5813('0x21')]>=_0x7919ab[_0x2f5b24+_0x5813('0x22')]){writeLog(_0x1debe5,_0x7919ab,_0x2f5b24[_0x5813('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5813('0x24')]=function(_0x4e3744,_0x44af32,_0x203a77,_0x69cf30,_0x16372c){return sendNotification(!![],_0x4e3744,_0x44af32,_0x203a77,_0x69cf30,_0x16372c);};exports[_0x5813('0x25')]=function(_0xd1fed9,_0x347c19,_0x31aa3d,_0xb80317,_0x1ea914){return sendNotification(![],_0xd1fed9,_0x347c19,_0x31aa3d,_0xb80317,_0x1ea914);};exports['checkWaitingNotifications']=function(_0x1a2ac9,_0x199120,_0x1b946a){var _0x2090b5=_0x199120[_0x5813('0x26')]['UserId'];if(!_0x2090b5&&_0x1b946a){_0x2090b5=_0x1b946a['id'];}var _0x32688c=_[_0x5813('0x27')](_0x1a2ac9[_0x199120[_0x5813('0x28')]+'QueuesWaitingInteractions'],function(_0x25db63){var _0x2ba613=_[_0x5813('0x29')](_0x199120['channel'])+_0x5813('0x2a');return _0x25db63[_0x2ba613]===_0x199120['interaction']['id'];});if(!_0x32688c&&_0x2090b5&&_0x1a2ac9['agents'][_0x2090b5]){_0x32688c=_['some'](_0x1a2ac9['agents'][_0x2090b5][_0x199120[_0x5813('0x28')]+_0x5813('0x2b')],function(_0x25f850){return _0x25f850['id']===_0x199120[_0x5813('0x26')]['id'];});}return _0x32688c;};exports[_0x5813('0x2c')]=function(_0x5758ff,_0x250f09,_0x56941c,_0x2fdd2a){if(_0x56941c&&_0x56941c['id']&&_0x5758ff[_0x5813('0x2d')]&&_0x5758ff[_0x5813('0x2d')][_0x56941c['id']]){_0x5758ff[_0x5813('0x2d')][_0x56941c['id']][_0x2fdd2a+_0x5813('0x2b')][_0x250f09[_0x5813('0x14')]['id']]={'id':_0x250f09[_0x5813('0x26')]['id']};}};exports[_0x5813('0x2e')]=function(_0x2578a1,_0x43ca12,_0x11844e,_0x10ad59){if(_0x11844e&&_0x11844e['id']&&_0x2578a1['agents']&&_0x2578a1['agents'][_0x11844e['id']]){delete _0x2578a1[_0x5813('0x2d')][_0x11844e['id']][_0x10ad59+'WaitingInteractions'][_0x43ca12['message']['id']];}};exports[_0x5813('0x2f')]=writeLog; \ No newline at end of file +var _0x5a69=['OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','toUpperCase','hideNotification','checkWaitingNotifications','interaction','UserId','channel','agents','some','WaitingInteractions','removeWaitingNotification','writeLog','lodash','util','ioredis','routing','redis','localhost','socket.io-emitter','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','name','emit','notification:%s','save','remove','debug','isAgentAvailable','busy','BUSY','online'];(function(_0x550dd8,_0x1068f5){var _0x303d68=function(_0x5e38c4){while(--_0x5e38c4){_0x550dd8['push'](_0x550dd8['shift']());}};_0x303d68(++_0x1068f5);}(_0x5a69,0x1c0));var _0x95a6=function(_0x121c35,_0x5689d6){_0x121c35=_0x121c35-0x0;var _0x126c65=_0x5a69[_0x121c35];return _0x126c65;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var utils=require('../utils');var Redis=require(_0x95a6('0x2'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x95a6('0x3'));config[_0x95a6('0x4')]=_['defaults'](config['redis'],{'host':_0x95a6('0x5'),'port':0x18eb});var io=require(_0x95a6('0x6'))(new Redis(config[_0x95a6('0x4')]));function sendNotification(_0x30fbd2,_0x2e9e6a,_0x462328,_0x5749b8,_0x289f3a,_0x4efb8d){var _0x4fc4f8=_0x4efb8d||{};var _0x444727=_0x462328[_0x95a6('0x7')]('.');var _0x3ac44a={'uniqueid':_0x2e9e6a,'channel':_0x444727[0x0],'id':_0x444727[0x1],'title':_0x444727[0x0]+_0x95a6('0x8'),'interactionId':_0x444727[0x2],'queue':_0x289f3a?_0x289f3a['name']:null,'sound':_0x4fc4f8[_0x95a6('0x9')][_0x95a6('0xa')],'shake':_0x4fc4f8[_0x95a6('0x9')][_0x95a6('0xb')]};try{if(!_0x4fc4f8[_0x95a6('0xc')]){_0x4fc4f8[_0x95a6('0xc')]={};}if(_0x289f3a){_0x4fc4f8[_0x95a6('0xc')][_0x95a6('0xd')]=_0x289f3a;}else if(_0x4fc4f8['body'][_0x95a6('0xd')]){delete _0x4fc4f8['body'][_0x95a6('0xd')];}_0x3ac44a[_0x95a6('0xe')]=utils[_0x95a6('0xf')](_0x4fc4f8[_0x95a6('0x9')]['notificationTemplate'],_0x4fc4f8);}catch(_0x168d7d){_0x3ac44a[_0x95a6('0xe')]=_0x95a6('0x10');logger[_0x95a6('0x11')](util[_0x95a6('0x12')](_0x95a6('0x13'),_0x2e9e6a,_0x168d7d[_0x95a6('0x14')]));}io['to'](util['format'](_0x95a6('0x15'),_0x5749b8[_0x95a6('0x16')]))[_0x95a6('0x17')](util[_0x95a6('0x12')](_0x95a6('0x18'),_0x30fbd2?_0x95a6('0x19'):_0x95a6('0x1a')),_0x3ac44a);}function writeLog(_0x57f3e2,_0x3b127c,_0x17c8de){return logger[_0x95a6('0x1b')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x57f3e2,_0x3b127c[_0x95a6('0x16')],_0x17c8de));}exports[_0x95a6('0x1c')]=function(_0x145b63,_0xafa971,_0x67451f,_0x48a43e){if(_0xafa971[_0x95a6('0x1d')]){writeLog(_0x145b63,_0xafa971,_0x95a6('0x1e'));return![];}if(!_0xafa971[_0x95a6('0x1f')]){writeLog(_0x145b63,_0xafa971,_0x95a6('0x20'));return![];}if(_0xafa971[_0x67451f+_0x95a6('0x21')]){writeLog(_0x145b63,_0xafa971,_0x95a6('0x22'));return![];}if(_0x48a43e&&_0xafa971[_0x95a6('0x23')](_0x67451f+'Capacity')&&_0xafa971['hasOwnProperty'](_0x67451f+_0x95a6('0x24'))){if(_0xafa971[_0x67451f+'Capacity']>0x0&&_0xafa971[_0x67451f+'CurrentCapacity']>=_0xafa971[_0x67451f+'Capacity']){writeLog(_0x145b63,_0xafa971,_0x67451f[_0x95a6('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x53740c,_0x2648f0,_0x2ccbfd,_0x511bfc,_0x5a1dda){return sendNotification(!![],_0x53740c,_0x2648f0,_0x2ccbfd,_0x511bfc,_0x5a1dda);};exports[_0x95a6('0x26')]=function(_0x5235c7,_0x3e2b44,_0x333887,_0x2b59b2,_0x18c578){return sendNotification(![],_0x5235c7,_0x3e2b44,_0x333887,_0x2b59b2,_0x18c578);};exports[_0x95a6('0x27')]=function(_0x1e1f39,_0xfed28b,_0x16e966){var _0x49ab58=_0xfed28b[_0x95a6('0x28')][_0x95a6('0x29')];if(!_0x49ab58&&_0x16e966){_0x49ab58=_0x16e966['id'];}var _0x5aae75=_['some'](_0x1e1f39[_0xfed28b[_0x95a6('0x2a')]+'QueuesWaitingInteractions'],function(_0x4381c9){var _0x1f0f07=_['capitalize'](_0xfed28b[_0x95a6('0x2a')])+'InteractionId';return _0x4381c9[_0x1f0f07]===_0xfed28b['interaction']['id'];});if(!_0x5aae75&&_0x49ab58&&_0x1e1f39[_0x95a6('0x2b')][_0x49ab58]){_0x5aae75=_[_0x95a6('0x2c')](_0x1e1f39[_0x95a6('0x2b')][_0x49ab58][_0xfed28b[_0x95a6('0x2a')]+_0x95a6('0x2d')],function(_0x16336d){return _0x16336d['id']===_0xfed28b[_0x95a6('0x28')]['id'];});}return _0x5aae75;};exports['saveWaitingNotification']=function(_0x3e0c20,_0x53cf9a,_0x2532d2,_0x23576b){if(_0x2532d2&&_0x2532d2['id']&&_0x3e0c20[_0x95a6('0x2b')]&&_0x3e0c20[_0x95a6('0x2b')][_0x2532d2['id']]){_0x3e0c20[_0x95a6('0x2b')][_0x2532d2['id']][_0x23576b+_0x95a6('0x2d')][_0x53cf9a['message']['id']]={'id':_0x53cf9a[_0x95a6('0x28')]['id']};}};exports[_0x95a6('0x2e')]=function(_0x3ba28a,_0x821ec6,_0x4e4bb8,_0xdb0892){if(_0x4e4bb8&&_0x4e4bb8['id']&&_0x3ba28a['agents']&&_0x3ba28a[_0x95a6('0x2b')][_0x4e4bb8['id']]){delete _0x3ba28a['agents'][_0x4e4bb8['id']][_0xdb0892+_0x95a6('0x2d')][_0x821ec6[_0x95a6('0x14')]['id']];}};exports[_0x95a6('0x2f')]=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 61491dd..852b5e0 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 _0x0738=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','next'];(function(_0x28ee69,_0xac3a4f){var _0x175b38=function(_0x16ec94){while(--_0x16ec94){_0x28ee69['push'](_0x28ee69['shift']());}};_0x175b38(++_0xac3a4f);}(_0x0738,0xb9));var _0x8073=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0738[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x8073('0x0'));var sh=require(_0x8073('0x1'));var _=require(_0x8073('0x2'));var utils=require(_0x8073('0x3'));var logger=require(_0x8073('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x8073('0x5')}});exports[_0x8073('0x6')]=function(_0x1133f4,_0x683b93){return function(_0x323d7b){try{var _0xb545c5={'command':_0x683b93[0x0]};var _0x3844f7=system[_0x8073('0x0')](_0xb545c5,{'typecast':!![]});if(_0x3844f7[_0x8073('0x7')]){logger[_0x8073('0x8')](_0x8073('0x9'),_0x1133f4,_['map'](_0x3844f7,'message')[_0x8073('0xa')](',\x20'));logger[_0x8073('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1133f4);_0x323d7b[_0x8073('0xc')]();}else{var _0x33674f=this;var _0x28031e=utils[_0x8073('0xd')](_0x683b93[0x0],this);logger['info'](_0x8073('0xe'),_0x1133f4,_0x28031e);sh['exec'](_[_0x8073('0xf')](_0x28031e),function(_0x4fc66e,_0x503250){logger[_0x8073('0xb')](_0x8073('0x10'),_0x1133f4,_0x4fc66e);if(_0x4fc66e==0x0){var _0x4bfe3d=_0x503250[_0x8073('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x8073('0x12')](_0x683b93[0x1])||_['isEmpty'](_0x683b93[0x1])){logger[_0x8073('0xb')](_0x8073('0x13'),_0x1133f4);_0x33674f[_0x8073('0x14')][_0x683b93[0x1]]=_0x4bfe3d;}else{logger[_0x8073('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1133f4,_0x683b93[0x1],_0x4bfe3d);_0x33674f[_0x8073('0x14')][_0x683b93[0x1]]=_0x4bfe3d;}}_0x323d7b[_0x8073('0xc')]();});}}catch(_0x1507df){logger[_0x8073('0x8')](_0x8073('0x9'),_0x1133f4,_[_0x8073('0x15')](_0x1507df)?JSON['stringify'](_0x1507df):_0x1507df);logger[_0x8073('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1133f4);_0x323d7b[_0x8073('0xc')]();}};}; \ No newline at end of file +var _0x933b=['isObject','stringify','validate','shelljs','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next'];(function(_0x530514,_0x3e81bb){var _0x31ee70=function(_0x2fbd46){while(--_0x2fbd46){_0x530514['push'](_0x530514['shift']());}};_0x31ee70(++_0x3e81bb);}(_0x933b,0x16e));var _0xb933=function(_0x38cc20,_0x2dca6b){_0x38cc20=_0x38cc20-0x0;var _0x9cee23=_0x933b[_0x38cc20];return _0x9cee23;};'use strict';var schema=require(_0xb933('0x0'));var sh=require(_0xb933('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xb933('0x2'))(_0xb933('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb933('0x4')}});exports[_0xb933('0x5')]=function(_0x4a3e02,_0x55dc07){return function(_0xebaef4){try{var _0x322df5={'command':_0x55dc07[0x0]};var _0x105a1f=system[_0xb933('0x0')](_0x322df5,{'typecast':!![]});if(_0x105a1f['length']){logger[_0xb933('0x6')](_0xb933('0x7'),_0x4a3e02,_[_0xb933('0x8')](_0x105a1f,_0xb933('0x9'))[_0xb933('0xa')](',\x20'));logger['info'](_0xb933('0xb'),_0x4a3e02);_0xebaef4['next']();}else{var _0x2d8553=this;var _0x4e9bff=utils[_0xb933('0xc')](_0x55dc07[0x0],this);logger[_0xb933('0xd')](_0xb933('0xe'),_0x4a3e02,_0x4e9bff);sh[_0xb933('0xf')](_[_0xb933('0x10')](_0x4e9bff),function(_0x30820a,_0x3cfb7b){logger[_0xb933('0xd')](_0xb933('0x11'),_0x4a3e02,_0x30820a);if(_0x30820a==0x0){var _0x143f6a=_0x3cfb7b[_0xb933('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x55dc07[0x1])||_[_0xb933('0x13')](_0x55dc07[0x1])){logger[_0xb933('0xd')](_0xb933('0x14'),_0x4a3e02);_0x2d8553[_0xb933('0x15')][_0x55dc07[0x1]]=_0x143f6a;}else{logger[_0xb933('0xd')](_0xb933('0x16'),_0x4a3e02,_0x55dc07[0x1],_0x143f6a);_0x2d8553[_0xb933('0x15')][_0x55dc07[0x1]]=_0x143f6a;}}_0xebaef4[_0xb933('0x17')]();});}}catch(_0x315b2b){logger[_0xb933('0x6')](_0xb933('0x7'),_0x4a3e02,_[_0xb933('0x18')](_0x315b2b)?JSON[_0xb933('0x19')](_0x315b2b):_0x315b2b);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4a3e02);_0xebaef4[_0xb933('0x17')]();}};}; \ 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 b3b309e..53aa8d1 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 _0x41fb=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x41fb,0x12d));var _0xb41f=function(_0x197576,_0xf4aa75){_0x197576=_0x197576-0x0;var _0x3e6603=_0x41fb[_0x197576];return _0x3e6603;};'use strict';var schema=require(_0xb41f('0x0'));var _=require(_0xb41f('0x1'));var rpc={'chatInteraction':require(_0xb41f('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb41f('0x3')),'mailInteraction':require(_0xb41f('0x4')),'faxInteraction':require(_0xb41f('0x5')),'whatsappInteraction':require(_0xb41f('0x6'))};var logger=require(_0xb41f('0x7'))(_0xb41f('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb41f('0x9')}});exports[_0xb41f('0xa')]=function(_0x4fe848,_0x4f2e85,_0x3ab2ff,_0x4a3b22){return function(_0x202ea4){try{var _0xc0a7f={'tag':_0x4f2e85[0x0]};var _0x3657dc=tag[_0xb41f('0x0')](_0xc0a7f,{'typecast':!![]});if(_0x3657dc[_0xb41f('0xb')]){logger['error'](_0xb41f('0xc'),_0x4fe848,_[_0xb41f('0xd')](_0x3657dc,_0xb41f('0xe'))[_0xb41f('0xf')](',\x20'));logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}else{var _0x2dc513={'ids':[_0x4f2e85[0x0]]};if(rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')]){rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')][_0xb41f('0x15')](_0x4a3b22['interaction']['id'],_0x2dc513)[_0xb41f('0x16')](function(_0x3946c3){logger['info'](_0xb41f('0x17'),_0x4fe848,_0x4f2e85[0x1],_0x4a3b22['channel'],_0x4a3b22[_0xb41f('0x18')]['id']);})[_0xb41f('0x19')](function(_0x123eef){logger['error'](_0xb41f('0xc'),_0x4fe848,JSON[_0xb41f('0x1a')](_0x123eef));logger[_0xb41f('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4fe848);})[_0xb41f('0x1b')](function(){_0x202ea4[_0xb41f('0x12')]();});}}}catch(_0x3ec825){logger[_0xb41f('0x1c')]('[%s][TAG]\x20%s',_0x4fe848,_['isObject'](_0x3ec825)?JSON[_0xb41f('0x1a')](_0x3ec825):_0x3ec825);logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}};}; \ No newline at end of file +var _0x7f7a=['interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','finally','isObject','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction'];(function(_0x2a8f25,_0x1edff3){var _0x168034=function(_0xece351){while(--_0xece351){_0x2a8f25['push'](_0x2a8f25['shift']());}};_0x168034(++_0x1edff3);}(_0x7f7a,0xa8));var _0xa7f7=function(_0x26bfd4,_0x85de7f){_0x26bfd4=_0x26bfd4-0x0;var _0x58738a=_0x7f7a[_0x26bfd4];return _0x58738a;};'use strict';var schema=require(_0xa7f7('0x0'));var _=require(_0xa7f7('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa7f7('0x2')),'mailInteraction':require(_0xa7f7('0x3')),'faxInteraction':require(_0xa7f7('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xa7f7('0x5'))(_0xa7f7('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x2231b7,_0x36adf8,_0x2f6ecc,_0x1b5884){return function(_0x580f48){try{var _0x15826d={'tag':_0x36adf8[0x0]};var _0x4accc2=tag['validate'](_0x15826d,{'typecast':!![]});if(_0x4accc2[_0xa7f7('0x7')]){logger[_0xa7f7('0x8')]('[%s][TAG]\x20%s',_0x2231b7,_[_0xa7f7('0x9')](_0x4accc2,_0xa7f7('0xa'))[_0xa7f7('0xb')](',\x20'));logger['info'](_0xa7f7('0xc'),_0x2231b7);_0x580f48[_0xa7f7('0xd')]();}else{var _0x4ceddd={'ids':[_0x36adf8[0x0]]};if(rpc[_0x1b5884[_0xa7f7('0xe')]+'Interaction']){rpc[_0x1b5884['channel']+_0xa7f7('0xf')]['addTags'](_0x1b5884[_0xa7f7('0x10')]['id'],_0x4ceddd)[_0xa7f7('0x11')](function(_0x190799){logger[_0xa7f7('0x12')](_0xa7f7('0x13'),_0x2231b7,_0x36adf8[0x1],_0x1b5884[_0xa7f7('0xe')],_0x1b5884[_0xa7f7('0x10')]['id']);})['catch'](function(_0x16f819){logger[_0xa7f7('0x8')](_0xa7f7('0x14'),_0x2231b7,JSON['stringify'](_0x16f819));logger[_0xa7f7('0x12')](_0xa7f7('0xc'),_0x2231b7);})[_0xa7f7('0x15')](function(){_0x580f48[_0xa7f7('0xd')]();});}}}catch(_0x1ad2a1){logger[_0xa7f7('0x8')](_0xa7f7('0x14'),_0x2231b7,_[_0xa7f7('0x16')](_0x1ad2a1)?JSON['stringify'](_0x1ad2a1):_0x1ad2a1);logger[_0xa7f7('0x12')](_0xa7f7('0xc'),_0x2231b7);_0x580f48['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 2adbdf0..3a42bdb 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 _0x79e3=['stringify','utf8','POST','then','parse','result','logged','&serviceId=','info','stop','catch','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','push','params'];(function(_0xdfcfd1,_0x1ec03b){var _0x4e8035=function(_0x18d1c9){while(--_0x18d1c9){_0xdfcfd1['push'](_0xdfcfd1['shift']());}};_0x4e8035(++_0x1ec03b);}(_0x79e3,0xb6));var _0x379e=function(_0xed166d,_0x293da6){_0xed166d=_0xed166d-0x0;var _0x1dac5f=_0x79e3[_0xed166d];return _0x1dac5f;};'use strict';var rp=require(_0x379e('0x0'));var logger=require(_0x379e('0x1'))('routing');var _=require(_0x379e('0x2'));var arr=[];exports['consequence']=function(_0x56cb22,_0x148da8){return function(_0x513ba3){var _0x777754=_0x148da8[0xa];var _0x137b7a=_0x148da8[0xb];var _0x4705c0=_0x148da8[0xc];var _0x5caa66=_0x148da8[0xd];var _0x1430bc=_0x148da8[0xe];var _0x4ea8d9=_0x148da8[0xf][_0x379e('0x3')](/\n/g,_0x379e('0x4'));var _0x12b5a1=_0x148da8[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x379e('0x5')](_0x137b7a)){arr['push'](_0x137b7a);var _0x22f703=_0x148da8[0x3];var _0x58af78=_0x148da8[0x4];var _0x2c6dc6=_0x148da8[0x1];var _0x8d72a2=_0x148da8[0x0];var _0x9f2f58={};_0x9f2f58[_0x379e('0x6')]=_0x148da8[0x8]+_0x379e('0x7')+_0x4705c0+'|'+_0x777754+'|'+_0x5caa66+'|'+_0x137b7a+'|'+_0x1430bc;_0x9f2f58[_0x379e('0x8')]=_0x148da8[0x7]+_0x379e('0x7')+_0x4705c0+'|'+_0x777754+'|'+_0x5caa66+'|'+_0x137b7a+'|'+_0x1430bc+'|'+_0x4ea8d9+'|'+_0x12b5a1;_0x9f2f58['title']=_0x148da8[0x9];var _0x3d43b3={};_0x3d43b3[_0x379e('0x9')]=_0x379e('0xa');_0x3d43b3[_0x379e('0xb')]='login';var _0x1718c5=[];_0x1718c5[_0x379e('0xc')](_0x148da8[0x2]);_0x1718c5[_0x379e('0xc')](_0x148da8[0x5]);_0x1718c5[_0x379e('0xc')](_0x148da8[0x6]);_0x3d43b3[_0x379e('0xd')]=_0x1718c5;_0x3d43b3['id']=0x1;var _0x1fbc82=JSON[_0x379e('0xe')](_0x3d43b3);var _0x20165a={'encoding':_0x379e('0xf'),'method':_0x379e('0x10'),'timeout':0x2710,'url':_0x22f703,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1fbc82};return rp(_0x20165a)[_0x379e('0x11')](function(_0x3baa86){const _0x4f36b3=JSON[_0x379e('0x12')](_0x3baa86);if(!_0x4f36b3[_0x379e('0x13')][_0x379e('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x291db2=_0x137b7a;var _0x55340d='channelId='+_0x2c6dc6+_0x379e('0x15')+_0x8d72a2+'&sessionId='+_0x291db2+'&data='+JSON[_0x379e('0xe')](_0x9f2f58);var _0xe500fa=_0x58af78+'?'+_0x55340d;return rp(_0xe500fa);})[_0x379e('0x11')](function(_0x33756b){logger[_0x379e('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x56cb22,_0x33756b);_0x513ba3[_0x379e('0x17')]();})[_0x379e('0x18')](function(_0x58c450){logger['error']('[%s][TVOX]\x20%s',_0x56cb22,_[_0x379e('0x19')](_0x58c450)?JSON[_0x379e('0xe')](_0x58c450):_0x58c450);_0x513ba3[_0x379e('0x17')]();});}else{logger['info'](_0x379e('0x1a'),_0x56cb22);_0x513ba3[_0x379e('0x1b')]();}};}; \ No newline at end of file +var _0x1ca1=['result','logged','channelId=','&serviceId=','&sessionId=','&data=','stop','error','[%s][TVOX]\x20%s','isObject','info','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse'];(function(_0xe65a0,_0x4e3148){var _0x51b736=function(_0x2577fd){while(--_0x2577fd){_0xe65a0['push'](_0xe65a0['shift']());}};_0x51b736(++_0x4e3148);}(_0x1ca1,0x98));var _0x11ca=function(_0x28431f,_0x51a5d1){_0x28431f=_0x28431f-0x0;var _0x174ede=_0x1ca1[_0x28431f];return _0x174ede;};'use strict';var rp=require(_0x11ca('0x0'));var logger=require(_0x11ca('0x1'))(_0x11ca('0x2'));var _=require(_0x11ca('0x3'));var arr=[];exports[_0x11ca('0x4')]=function(_0x40a9c8,_0x2e2511){return function(_0x8196a0){var _0x24f609=_0x2e2511[0xa];var _0x3facf4=_0x2e2511[0xb];var _0xeb122e=_0x2e2511[0xc];var _0x25bc0d=_0x2e2511[0xd];var _0x431d73=_0x2e2511[0xe];var _0x5e0086=_0x2e2511[0xf][_0x11ca('0x5')](/\n/g,_0x11ca('0x6'));var _0x43ef97=_0x2e2511[0x10][_0x11ca('0x5')](/\n/g,'\x20');if(!arr[_0x11ca('0x7')](_0x3facf4)){arr[_0x11ca('0x8')](_0x3facf4);var _0xc6379a=_0x2e2511[0x3];var _0x430b80=_0x2e2511[0x4];var _0x14af44=_0x2e2511[0x1];var _0x575242=_0x2e2511[0x0];var _0x2ea5b1={};_0x2ea5b1[_0x11ca('0x9')]=_0x2e2511[0x8]+_0x11ca('0xa')+_0xeb122e+'|'+_0x24f609+'|'+_0x25bc0d+'|'+_0x3facf4+'|'+_0x431d73;_0x2ea5b1[_0x11ca('0xb')]=_0x2e2511[0x7]+'?params='+_0xeb122e+'|'+_0x24f609+'|'+_0x25bc0d+'|'+_0x3facf4+'|'+_0x431d73+'|'+_0x5e0086+'|'+_0x43ef97;_0x2ea5b1[_0x11ca('0xc')]=_0x2e2511[0x9];var _0x124c2e={};_0x124c2e[_0x11ca('0xd')]=_0x11ca('0xe');_0x124c2e[_0x11ca('0xf')]=_0x11ca('0x10');var _0x58a88b=[];_0x58a88b['push'](_0x2e2511[0x2]);_0x58a88b['push'](_0x2e2511[0x5]);_0x58a88b['push'](_0x2e2511[0x6]);_0x124c2e[_0x11ca('0x11')]=_0x58a88b;_0x124c2e['id']=0x1;var _0x249830=JSON[_0x11ca('0x12')](_0x124c2e);var _0x3b9e10={'encoding':'utf8','method':_0x11ca('0x13'),'timeout':0x2710,'url':_0xc6379a,'headers':{'Content-Type':_0x11ca('0x14')},'body':_0x249830};return rp(_0x3b9e10)[_0x11ca('0x15')](function(_0x3fc016){const _0x4d983e=JSON[_0x11ca('0x16')](_0x3fc016);if(!_0x4d983e[_0x11ca('0x17')][_0x11ca('0x18')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x34cb6a=_0x3facf4;var _0x5a1cbf=_0x11ca('0x19')+_0x14af44+_0x11ca('0x1a')+_0x575242+_0x11ca('0x1b')+_0x34cb6a+_0x11ca('0x1c')+JSON['stringify'](_0x2ea5b1);var _0x5b8a03=_0x430b80+'?'+_0x5a1cbf;return rp(_0x5b8a03);})['then'](function(_0x27d6ba){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x40a9c8,_0x27d6ba);_0x8196a0[_0x11ca('0x1d')]();})['catch'](function(_0x2a5dd3){logger[_0x11ca('0x1e')](_0x11ca('0x1f'),_0x40a9c8,_[_0x11ca('0x20')](_0x2a5dd3)?JSON[_0x11ca('0x12')](_0x2a5dd3):_0x2a5dd3);_0x8196a0[_0x11ca('0x1d')]();});}else{logger[_0x11ca('0x21')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x40a9c8);_0x8196a0[_0x11ca('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 263c051..1a3e510 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5a064a,_0x29c990){var _0x33b4a5=function(_0x2565d4){while(--_0x2565d4){_0x5a064a['push'](_0x5a064a['shift']());}};_0x33b4a5(++_0x29c990);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x7afa73,_0x29ba5d){var _0x496ea6=function(_0x35da8b){while(--_0x35da8b){_0x7afa73['push'](_0x7afa73['shift']());}};_0x496ea6(++_0x29ba5d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 e5b7274..e182841 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 _0x52a1=['error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','.js','app','toLowerCase','split','channel','mail','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x52a1,0x1b7));var _0x152a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52a1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x152a('0x0'));var util=require(_0x152a('0x1'));var path=require(_0x152a('0x2'));var fs=require('fs');var jayson=require(_0x152a('0x3'));var BPromise=require(_0x152a('0x4'));var utils=require(_0x152a('0x5'));var sUtils=require(_0x152a('0x6'));var logger=require('../../../config/logger')(_0x152a('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x152a('0x8')),'chatQueueReport':require(_0x152a('0x9')),'smsQueueReport':require(_0x152a('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x520d61,_0x4221d3,_0x578506){return util['format'](_0x152a('0xb'),_0x520d61,_0x4221d3||0x0,_0x578506||0x0);}function getIntervals(_0x22bf70,_0x5ce978){var _0x5810e9=[];if(!_[_0x152a('0xc')](_0x5ce978[_0x152a('0xd')])&&!_['isNil'](_0x22bf70[_0x5ce978[_0x152a('0xd')]])&&!_[_0x152a('0xc')](_0x22bf70[_0x5ce978[_0x152a('0xd')]][_0x152a('0xe')])){_0x5810e9=_[_0x152a('0xf')](_0x22bf70[_0x5ce978[_0x152a('0xd')]]['Intervals'],_0x152a('0x10'));}else if(!_[_0x152a('0xc')](_0x5ce978[_0x152a('0x10')])){_0x5810e9=[_0x5ce978['interval']];}return _0x5810e9;}exports[_0x152a('0x11')]=function(_0x2f8817){_0x2f8817['rules']={};return new BPromise(function(_0x40a8d0,_0x5a76e4){var _0x6e4b4f={'Start':function(_0x404bb8){var _0x1c4b71=this;return new Promise(function(_0x40e403,_0x1e411c){if(_0x404bb8){try{var _0x1ec269=[];var _0xd1d182=getId(_0x404bb8['channel'],_0x404bb8[_0x152a('0x12')]?_0x404bb8[_0x152a('0x12')]['id']:0x0,_0x404bb8['interaction']?_0x404bb8[_0x152a('0x13')]['id']:0x0);var _0x3bc038=sUtils[_0x152a('0x14')](_0x2f8817,_0x404bb8);if(_0x404bb8[_0x152a('0x15')]||!_0x3bc038&&_0x404bb8[_0x152a('0x16')]&&_[_0x152a('0x17')](_0x404bb8[_0x152a('0x16')])&&_0x404bb8['applications']['length']){for(var _0xcc7805=0x0;_0xcc7805<_0x404bb8['applications'][_0x152a('0x18')];_0xcc7805+=0x1){var _0x2b94d4=_0x404bb8[_0x152a('0x16')][_0xcc7805];if(fs['existsSync'](path[_0x152a('0x19')](__dirname,_0x152a('0x16'),_0x2b94d4['app']+_0x152a('0x1a')))){var _0x53e96e=[];switch(_0x2b94d4[_0x152a('0x1b')][_0x152a('0x1c')]()){case'autoreply':var _0x2b99c2=_0x2b94d4['appdata'][_0x152a('0x1d')](',');if(_0x404bb8[_0x152a('0x1e')]===_0x152a('0x1f')){_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x0]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x1]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[_0x152a('0x21')](0x2,_0x2b99c2[_0x152a('0x18')])[_0x152a('0x19')](','));}else{_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x0]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[_0x152a('0x21')](0x1,_0x2b99c2[_0x152a('0x18')])[_0x152a('0x19')](','));}break;case _0x152a('0x22'):var _0x21cc4e=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x21cc4e[0x0]);_0x53e96e[_0x152a('0x20')](_0x21cc4e[0x1]);_0x53e96e[_0x152a('0x20')](_0x21cc4e['slice'](0x2,_0x21cc4e['length'])[_0x152a('0x19')](','));break;case _0x152a('0x24'):var _0x20589b=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x20589b[0x0]);_0x53e96e[_0x152a('0x20')](_0x20589b[0x1]);_0x53e96e[_0x152a('0x20')](_0x20589b[0x2]);_0x53e96e['push'](_0x20589b[0x3]);_0x53e96e[_0x152a('0x20')](_0x20589b[_0x152a('0x21')](0x4,_0x20589b[_0x152a('0x18')])['join'](','));break;case'amazonlex':var _0x20fed9=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x20fed9[0x0]);_0x53e96e['push'](_0x20fed9[0x1]);_0x53e96e[_0x152a('0x20')](_0x20fed9[0x2]);_0x53e96e[_0x152a('0x20')](_0x20fed9[0x3]);_0x53e96e[_0x152a('0x20')](_0x20fed9[_0x152a('0x21')](0x4,_0x20fed9[_0x152a('0x18')])[_0x152a('0x19')](','));break;case'message':_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x23')]);break;case _0x152a('0x25'):_0x53e96e['push'](_0x2b94d4[_0x152a('0x26')]);_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x23')]);break;case _0x152a('0x27'):var _0x4ce720=utils['getMustacheRender'](_0x404bb8[_0x152a('0x28')][_0x152a('0x29')],_0x404bb8);var _0x1be122=_0x2b94d4[_0x152a('0x23')]['split'](',');_0x53e96e['push'](_0x1be122[0x0]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x1]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x2]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x3]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x4]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x5]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x6]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x7]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x8]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x9]);_0x53e96e[_0x152a('0x20')](_0x1be122[0xa]);_0x53e96e[_0x152a('0x20')](_0x404bb8['interaction']['id']);_0x53e96e[_0x152a('0x20')](_0x404bb8[_0x152a('0x12')]['id']);_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x2a')]);_0x53e96e[_0x152a('0x20')](_0x404bb8[_0x152a('0x13')][_0x152a('0x2b')]);_0x53e96e['push'](_0x404bb8[_0x152a('0x2c')][_0x152a('0x2c')]);_0x53e96e[_0x152a('0x20')](_0x4ce720);break;default:_0x53e96e=_['isNil'](_0x2b94d4[_0x152a('0x23')])?[]:_0x2b94d4[_0x152a('0x23')]['split'](',');}var _0x5e69ae={'id':util[_0x152a('0x2d')](_0x152a('0x2e'),_0xd1d182,_0x2b94d4['id'],_0x2b94d4[_0x152a('0x1b')]),'condition':require(_0x152a('0x2f'))['condition'](_0xd1d182,getIntervals(_0x2f8817[_0x152a('0x30')],_0x2b94d4),_0x2f8817),'consequence':require(_0x152a('0x31')+_0x2b94d4['app'])[_0x152a('0x32')](_0xd1d182,_0x53e96e,_0x2f8817,_0x404bb8),'p':_0x2b94d4[_0x152a('0x33')]||0x0};logger['info'](_0x152a('0x34'),_0x5e69ae['id'],'on\x20interval',getIntervals(_0x2f8817['intervals'],_0x2b94d4)[_0x152a('0x19')](_0x152a('0x35')));_0x1ec269[_0x152a('0x20')](_0x5e69ae);}else{logger[_0x152a('0x36')](_0x152a('0x37'),path['join'](__dirname,_0x152a('0x16'),_0x2b94d4[_0x152a('0x1b')]+_0x152a('0x1a')));}}_0x2f8817[_0x152a('0x38')][_0xd1d182]=new RuleEngine(_0x1ec269);_0x2f8817[_0x152a('0x38')][_0xd1d182][_0x152a('0x39')](_0x404bb8,function(_0xc2473b){logger['info'](_0x152a('0x3a'),JSON[_0x152a('0x3b')](_0xc2473b[_0x152a('0x3c')]));if(_0x2f8817[_0x152a('0x38')][_0xd1d182]){_0x2f8817[_0x152a('0x38')][_0xd1d182][_0x152a('0x3d')](_0x152a('0x3e'));}});return _0x40e403({'code':0xc8,'message':_0x404bb8});}else{if(_0x3bc038){logger['info'](util[_0x152a('0x2d')](_0x152a('0x3f'),_0xd1d182));}else{logger[_0x152a('0x40')](_0x152a('0x41'));}return _0x40e403({'code':0xc8,'message':_0x404bb8});}}catch(_0xdee60e){logger[_0x152a('0x36')](_0xdee60e[_0x152a('0x42')]);return _0x1e411c(_0x1c4b71[_0x152a('0x36')](0x1f4,_0xdee60e));}}return _0x1e411c(_0x152a('0x43'));});},'AcceptMessage':function(_0x4e346f){var _0x415a58=this;return new Promise(function(_0x26ce9c,_0x3e9583){if(_0x4e346f['agent']&&_0x4e346f[_0x152a('0x44')]['id']){if(_0x2f8817[_0x152a('0x45')][_0x4e346f[_0x152a('0x44')]['id']]){_0x2f8817['agents'][_0x4e346f[_0x152a('0x44')]['id']][_0x152a('0x46')]=![];_0x2f8817[_0x152a('0x45')][_0x4e346f['agent']['id']][_0x152a('0x47')]=undefined;}}if(_0x4e346f[_0x152a('0x12')]&&_0x4e346f['message']['id']){try{var _0x504d18=getId(_0x4e346f[_0x152a('0x1e')],_0x4e346f[_0x152a('0x12')]?_0x4e346f[_0x152a('0x12')]['id']:0x0,_0x4e346f[_0x152a('0x13')]?_0x4e346f[_0x152a('0x13')]['id']:0x0);if(_0x2f8817[_0x152a('0x38')][_0x504d18]){_0x2f8817[_0x152a('0x38')][_0x504d18][_0x152a('0x3d')]('end');if(rpc[_0x4e346f[_0x152a('0x1e')]+_0x152a('0x48')]){rpc[_0x4e346f[_0x152a('0x1e')]+_0x152a('0x48')][_0x152a('0x49')](_0x504d18,{'UserId':_0x4e346f['message'][_0x152a('0x4a')]})[_0x152a('0x4b')](function(){logger[_0x152a('0x36')](_0x152a('0x4c'));});}}return _0x26ce9c({'code':0xc8,'message':_0x4e346f});}catch(_0x12fee5){logger[_0x152a('0x36')](_0x12fee5[_0x152a('0x42')]);return _0x3e9583(_0x415a58['error'](0x1f4,_0x12fee5));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x3e9583(_0x415a58[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'RejectMessage':function(_0x5599ed){var _0x34fe06=this;return new Promise(function(_0x3f1938,_0x349426){if(_0x5599ed[_0x152a('0x44')]&&_0x5599ed[_0x152a('0x44')]['id']){try{if(_0x2f8817[_0x152a('0x45')][_0x5599ed[_0x152a('0x44')]['id']]){_0x2f8817['agents'][_0x5599ed[_0x152a('0x44')]['id']][_0x152a('0x46')]=![];_0x2f8817[_0x152a('0x45')][_0x5599ed[_0x152a('0x44')]['id']][_0x152a('0x47')]=undefined;}return _0x3f1938({'code':0xc8,'message':_0x5599ed});}catch(_0x4cd9fa){logger[_0x152a('0x36')](_0x4cd9fa[_0x152a('0x42')]);return _0x349426(_0x34fe06[_0x152a('0x36')](0x1f4,_0x4cd9fa));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x349426(_0x34fe06[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'AbandonInteraction':function(_0x32fb5c){var _0x17205e=this;return new Promise(function(_0x418a91,_0x483b80){if(_0x32fb5c[_0x152a('0x1e')]&&_0x32fb5c[_0x152a('0x13')]&&_0x32fb5c[_0x152a('0x13')]['id']){try{var _0x118fea=getId(_0x32fb5c[_0x152a('0x1e')],_0x32fb5c['message']?_0x32fb5c[_0x152a('0x12')]['id']:0x0,_0x32fb5c[_0x152a('0x13')]?_0x32fb5c[_0x152a('0x13')]['id']:0x0);if(_0x2f8817['rules'][_0x118fea]){_0x2f8817[_0x152a('0x38')][_0x118fea][_0x152a('0x3d')](_0x152a('0x4e'));}return _0x418a91({'code':0xc8,'message':_0x32fb5c});}catch(_0xc861f4){logger['error'](_0xc861f4[_0x152a('0x42')]);return _0x483b80(_0x17205e[_0x152a('0x36')](0x1f4,_0xc861f4));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x483b80(_0x17205e[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'AgentCapacity':function(_0x533110){var _0xe9fc75=this;return new Promise(function(_0x104803,_0x526f12){if(_0x2f8817[_0x152a('0x45')][_0x152a('0x4f')](_0x533110['id'])){for(var _0x3274d7 in _0x533110[_0x152a('0x50')]){if(_0x533110[_0x152a('0x50')][_0x152a('0x4f')](_0x3274d7)){if(_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x152a('0x4f')](_0x3274d7+_0x152a('0x51'))){_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x3274d7+_0x152a('0x51')]=parseInt(_0x533110['capacity'][_0x3274d7],0xa);}}}_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x152a('0x52')]();return _0x104803({'code':0xc8,'message':_0x2f8817[_0x152a('0x45')][_0x533110['id']]});}else{return _0x526f12(_0xe9fc75[_0x152a('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x571683){return new Promise(function(_0x1906e8){var _0x3d61c2=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x45')]);if(_0x571683&&_0x571683['id']){var _0x47551d=_['find'](_0x3d61c2,function(_0x265476){return _0x265476['id']===_0x571683['id'];});_0x1906e8(_0x47551d);}else{_0x1906e8({'count':_0x3d61c2[_0x152a('0x18')],'rows':_0x3d61c2});}});},'ChatQueues':function(){return new Promise(function(_0x4db35b){var _0x3e4c7c=[];for(var _0x447ba4 in _0x2f8817[_0x152a('0x54')]){if(_0x2f8817[_0x152a('0x54')]['hasOwnProperty'](_0x447ba4)){var _0x4410ac=_0x2f8817[_0x152a('0x54')][_0x447ba4];var _0x1b5784={'id':_0x4410ac['id'],'available':_0x4410ac[_0x152a('0x55')],'loggedIn':_0x4410ac[_0x152a('0x56')],'name':_0x4410ac[_0x152a('0x57')],'paused':_0x4410ac[_0x152a('0x58')],'waiting':_0x4410ac[_0x152a('0x59')]};_0x3e4c7c[_0x152a('0x20')](_0x1b5784);}}_0x4db35b({'count':_0x3e4c7c['length'],'rows':_0x3e4c7c});});},'MailQueues':function(){return new Promise(function(_0x12a033){var _0x5014c7=[];for(var _0xbe601b in _0x2f8817[_0x152a('0x5a')]){if(_0x2f8817[_0x152a('0x5a')][_0x152a('0x4f')](_0xbe601b)){var _0x553b0d=_0x2f8817['mailQueues'][_0xbe601b];var _0xebbfa1={'id':_0x553b0d['id'],'available':_0x553b0d[_0x152a('0x55')],'loggedIn':_0x553b0d['loggedIn'],'name':_0x553b0d[_0x152a('0x57')],'paused':_0x553b0d[_0x152a('0x58')],'waiting':_0x553b0d['waiting']};_0x5014c7[_0x152a('0x20')](_0xebbfa1);}}_0x12a033({'count':_0x5014c7[_0x152a('0x18')],'rows':_0x5014c7});});},'OpenchannelQueues':function(){return new Promise(function(_0x3d7848){var _0xd93b86=[];for(var _0xde7ed2 in _0x2f8817['openchannelQueues']){if(_0x2f8817[_0x152a('0x5b')][_0x152a('0x4f')](_0xde7ed2)){var _0x459760=_0x2f8817['openchannelQueues'][_0xde7ed2];var _0x486471={'id':_0x459760['id'],'available':_0x459760[_0x152a('0x55')],'loggedIn':_0x459760['loggedIn'],'name':_0x459760[_0x152a('0x57')],'paused':_0x459760[_0x152a('0x58')],'waiting':_0x459760['waiting']};_0xd93b86[_0x152a('0x20')](_0x486471);}}_0x3d7848({'count':_0xd93b86[_0x152a('0x18')],'rows':_0xd93b86});});},'SmsQueues':function(){return new Promise(function(_0x1610ad){var _0x41ac07=[];for(var _0x2071b1 in _0x2f8817['smsQueues']){if(_0x2f8817['smsQueues']['hasOwnProperty'](_0x2071b1)){var _0x472576=_0x2f8817['smsQueues'][_0x2071b1];var _0x33b52a={'id':_0x472576['id'],'available':_0x472576[_0x152a('0x55')],'loggedIn':_0x472576[_0x152a('0x56')],'name':_0x472576[_0x152a('0x57')],'paused':_0x472576[_0x152a('0x58')],'waiting':_0x472576['waiting']};_0x41ac07[_0x152a('0x20')](_0x33b52a);}}_0x1610ad({'count':_0x41ac07[_0x152a('0x18')],'rows':_0x41ac07});});},'FaxQueues':function(){return new Promise(function(_0x55941f){var _0x40b01f=[];for(var _0x140815 in _0x2f8817[_0x152a('0x5c')]){if(_0x2f8817[_0x152a('0x5c')]['hasOwnProperty'](_0x140815)){var _0x2e6c58=_0x2f8817[_0x152a('0x5c')][_0x140815];var _0x1a08d5={'id':_0x2e6c58['id'],'available':_0x2e6c58[_0x152a('0x55')],'loggedIn':_0x2e6c58['loggedIn'],'name':_0x2e6c58[_0x152a('0x57')],'paused':_0x2e6c58[_0x152a('0x58')],'waiting':_0x2e6c58['waiting']};_0x40b01f[_0x152a('0x20')](_0x1a08d5);}}_0x55941f({'count':_0x40b01f[_0x152a('0x18')],'rows':_0x40b01f});});},'WhatsappQueues':function(){return new Promise(function(_0x135f8e){var _0x317526=[];for(var _0x22be06 in _0x2f8817[_0x152a('0x5d')]){if(_0x2f8817[_0x152a('0x5d')][_0x152a('0x4f')](_0x22be06)){var _0x427996=_0x2f8817['whatsappQueues'][_0x22be06];var _0x43e738={'id':_0x427996['id'],'available':_0x427996[_0x152a('0x55')],'loggedIn':_0x427996[_0x152a('0x56')],'name':_0x427996['name'],'paused':_0x427996[_0x152a('0x58')],'waiting':_0x427996[_0x152a('0x59')]};_0x317526[_0x152a('0x20')](_0x43e738);}}_0x135f8e({'count':_0x317526[_0x152a('0x18')],'rows':_0x317526});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1fe51b){var _0x12c6fa=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x5e')]);_0x1fe51b({'count':_0x12c6fa[_0x152a('0x18')],'rows':_0x12c6fa});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x6532b3){var _0x2cef87=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x5f')]);_0x6532b3({'count':_0x2cef87[_0x152a('0x18')],'rows':_0x2cef87});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xea03e1){var _0x1c272b=_['values'](_0x2f8817['openchannelQueuesWaitingInteractions']);_0xea03e1({'count':_0x1c272b[_0x152a('0x18')],'rows':_0x1c272b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x214551){var _0x29bbba=_[_0x152a('0x53')](_0x2f8817['smsQueuesWaitingInteractions']);_0x214551({'count':_0x29bbba[_0x152a('0x18')],'rows':_0x29bbba});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1c5739){var _0x4af1ec=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x60')]);_0x1c5739({'count':_0x4af1ec[_0x152a('0x18')],'rows':_0x4af1ec});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xc4514d){var _0x2bbd7e=_['values'](_0x2f8817[_0x152a('0x61')]);_0xc4514d({'count':_0x2bbd7e[_0x152a('0x18')],'rows':_0x2bbd7e});});}};var _0x29eeaa=jayson[_0x152a('0x62')](_0x6e4b4f)[_0x152a('0x63')]();_0x29eeaa['on'](_0x152a('0x36'),function(_0x1f6d55){logger['error'](JSON[_0x152a('0x3b')](_0x1f6d55));return _0x5a76e4(_0x1f6d55);});_0x29eeaa['listen'](0x232c,_0x152a('0x64'),function(){console[_0x152a('0x65')](_0x152a('0x66'),0x232c);return _0x40a8d0('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xf3e2=['hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','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','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','dialogflowv2','split','amazonlex','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','emit','complete','format','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error','stack','message\x20is\x20empty','capacity'];(function(_0x299511,_0x2cc6e2){var _0x54b23f=function(_0x59fa4c){while(--_0x59fa4c){_0x299511['push'](_0x299511['shift']());}};_0x54b23f(++_0x2cc6e2);}(_0xf3e2,0x168));var _0x2f3e=function(_0x38c21f,_0x5d27a5){_0x38c21f=_0x38c21f-0x0;var _0x2e1b03=_0xf3e2[_0x38c21f];return _0x2e1b03;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var path=require(_0x2f3e('0x2'));var fs=require('fs');var jayson=require(_0x2f3e('0x3'));var BPromise=require(_0x2f3e('0x4'));var utils=require(_0x2f3e('0x5'));var sUtils=require(_0x2f3e('0x6'));var logger=require(_0x2f3e('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x2f3e('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x2f3e('0x9')),'smsQueueReport':require(_0x2f3e('0xa')),'faxQueueReport':require(_0x2f3e('0xb')),'whatsappQueueReport':require(_0x2f3e('0xc'))};var RuleEngine=require(_0x2f3e('0xd'));function getId(_0x1ac142,_0x30f939,_0x46ec1b){return util['format'](_0x2f3e('0xe'),_0x1ac142,_0x30f939||0x0,_0x46ec1b||0x0);}function getIntervals(_0x4d7f7d,_0x8de6e2){var _0x298b4b=[];if(!_[_0x2f3e('0xf')](_0x8de6e2[_0x2f3e('0x10')])&&!_[_0x2f3e('0xf')](_0x4d7f7d[_0x8de6e2[_0x2f3e('0x10')]])&&!_[_0x2f3e('0xf')](_0x4d7f7d[_0x8de6e2[_0x2f3e('0x10')]][_0x2f3e('0x11')])){_0x298b4b=_[_0x2f3e('0x12')](_0x4d7f7d[_0x8de6e2[_0x2f3e('0x10')]][_0x2f3e('0x11')],'interval');}else if(!_[_0x2f3e('0xf')](_0x8de6e2['interval'])){_0x298b4b=[_0x8de6e2[_0x2f3e('0x13')]];}return _0x298b4b;}exports[_0x2f3e('0x14')]=function(_0x5f3734){_0x5f3734['rules']={};return new BPromise(function(_0x1ad130,_0x2ecb10){var _0x341fff={'Start':function(_0x14a2a1){var _0x38ac85=this;return new Promise(function(_0xd6710,_0x4ecd41){if(_0x14a2a1){try{var _0x10aa3e=[];var _0x32f26f=getId(_0x14a2a1[_0x2f3e('0x15')],_0x14a2a1[_0x2f3e('0x16')]?_0x14a2a1['message']['id']:0x0,_0x14a2a1[_0x2f3e('0x17')]?_0x14a2a1['interaction']['id']:0x0);var _0x18dc6=sUtils[_0x2f3e('0x18')](_0x5f3734,_0x14a2a1);if(_0x14a2a1[_0x2f3e('0x19')]||!_0x18dc6&&_0x14a2a1[_0x2f3e('0x1a')]&&_[_0x2f3e('0x1b')](_0x14a2a1[_0x2f3e('0x1a')])&&_0x14a2a1[_0x2f3e('0x1a')][_0x2f3e('0x1c')]){for(var _0xdebdf=0x0;_0xdebdf<_0x14a2a1[_0x2f3e('0x1a')][_0x2f3e('0x1c')];_0xdebdf+=0x1){var _0x14113e=_0x14a2a1[_0x2f3e('0x1a')][_0xdebdf];if(fs[_0x2f3e('0x1d')](path[_0x2f3e('0x1e')](__dirname,_0x2f3e('0x1a'),_0x14113e[_0x2f3e('0x1f')]+_0x2f3e('0x20')))){var _0x22dd45=[];switch(_0x14113e[_0x2f3e('0x1f')][_0x2f3e('0x21')]()){case _0x2f3e('0x22'):var _0x16c8fc=_0x14113e[_0x2f3e('0x23')]['split'](',');if(_0x14a2a1[_0x2f3e('0x15')]===_0x2f3e('0x24')){_0x22dd45['push'](_0x16c8fc[0x0]);_0x22dd45[_0x2f3e('0x25')](_0x16c8fc[0x1]);_0x22dd45[_0x2f3e('0x25')](_0x16c8fc[_0x2f3e('0x26')](0x2,_0x16c8fc[_0x2f3e('0x1c')])['join'](','));}else{_0x22dd45['push'](_0x16c8fc[0x0]);_0x22dd45[_0x2f3e('0x25')](_0x16c8fc[_0x2f3e('0x26')](0x1,_0x16c8fc[_0x2f3e('0x1c')])[_0x2f3e('0x1e')](','));}break;case _0x2f3e('0x27'):var _0x5bce49=_0x14113e[_0x2f3e('0x23')]['split'](',');_0x22dd45['push'](_0x5bce49[0x0]);_0x22dd45[_0x2f3e('0x25')](_0x5bce49[0x1]);_0x22dd45['push'](_0x5bce49[_0x2f3e('0x26')](0x2,_0x5bce49['length'])['join'](','));break;case _0x2f3e('0x28'):var _0x362eb4=_0x14113e['appdata'][_0x2f3e('0x29')](',');_0x22dd45[_0x2f3e('0x25')](_0x362eb4[0x0]);_0x22dd45[_0x2f3e('0x25')](_0x362eb4[0x1]);_0x22dd45[_0x2f3e('0x25')](_0x362eb4[0x2]);_0x22dd45[_0x2f3e('0x25')](_0x362eb4[0x3]);_0x22dd45['push'](_0x362eb4[_0x2f3e('0x26')](0x4,_0x362eb4[_0x2f3e('0x1c')])['join'](','));break;case _0x2f3e('0x2a'):var _0x468b9a=_0x14113e[_0x2f3e('0x23')][_0x2f3e('0x29')](',');_0x22dd45[_0x2f3e('0x25')](_0x468b9a[0x0]);_0x22dd45['push'](_0x468b9a[0x1]);_0x22dd45['push'](_0x468b9a[0x2]);_0x22dd45[_0x2f3e('0x25')](_0x468b9a[0x3]);_0x22dd45[_0x2f3e('0x25')](_0x468b9a[_0x2f3e('0x26')](0x4,_0x468b9a[_0x2f3e('0x1c')])[_0x2f3e('0x1e')](','));break;case _0x2f3e('0x16'):_0x22dd45['push'](_0x14113e[_0x2f3e('0x23')]);break;case'tag':_0x22dd45[_0x2f3e('0x25')](_0x14113e[_0x2f3e('0x2b')]);_0x22dd45[_0x2f3e('0x25')](_0x14113e[_0x2f3e('0x23')]);break;case _0x2f3e('0x2c'):var _0x1d62c8=utils[_0x2f3e('0x2d')](_0x14a2a1[_0x2f3e('0x2e')]['notificationTemplate'],_0x14a2a1);var _0xd91b7=_0x14113e[_0x2f3e('0x23')]['split'](',');_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0x0]);_0x22dd45['push'](_0xd91b7[0x1]);_0x22dd45['push'](_0xd91b7[0x2]);_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0x3]);_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0x4]);_0x22dd45['push'](_0xd91b7[0x5]);_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0x6]);_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0x7]);_0x22dd45['push'](_0xd91b7[0x8]);_0x22dd45['push'](_0xd91b7[0x9]);_0x22dd45[_0x2f3e('0x25')](_0xd91b7[0xa]);_0x22dd45[_0x2f3e('0x25')](_0x14a2a1[_0x2f3e('0x17')]['id']);_0x22dd45[_0x2f3e('0x25')](_0x14a2a1[_0x2f3e('0x16')]['id']);_0x22dd45[_0x2f3e('0x25')](_0x14113e[_0x2f3e('0x2f')]);_0x22dd45[_0x2f3e('0x25')](_0x14a2a1[_0x2f3e('0x17')][_0x2f3e('0x30')]);_0x22dd45[_0x2f3e('0x25')](_0x14a2a1[_0x2f3e('0x31')][_0x2f3e('0x31')]);_0x22dd45[_0x2f3e('0x25')](_0x1d62c8);break;default:_0x22dd45=_[_0x2f3e('0xf')](_0x14113e['appdata'])?[]:_0x14113e[_0x2f3e('0x23')][_0x2f3e('0x29')](',');}var _0x4320b9={'id':util['format'](_0x2f3e('0x32'),_0x32f26f,_0x14113e['id'],_0x14113e[_0x2f3e('0x1f')]),'condition':require(_0x2f3e('0x33'))[_0x2f3e('0x34')](_0x32f26f,getIntervals(_0x5f3734[_0x2f3e('0x35')],_0x14113e),_0x5f3734),'consequence':require(_0x2f3e('0x36')+_0x14113e[_0x2f3e('0x1f')])[_0x2f3e('0x37')](_0x32f26f,_0x22dd45,_0x5f3734,_0x14a2a1),'p':_0x14113e[_0x2f3e('0x38')]||0x0};logger[_0x2f3e('0x39')]('Push\x20new\x20rule',_0x4320b9['id'],_0x2f3e('0x3a'),getIntervals(_0x5f3734[_0x2f3e('0x35')],_0x14113e)['join'](_0x2f3e('0x3b')));_0x10aa3e[_0x2f3e('0x25')](_0x4320b9);}else{logger['error'](_0x2f3e('0x3c'),path[_0x2f3e('0x1e')](__dirname,_0x2f3e('0x1a'),_0x14113e['app']+_0x2f3e('0x20')));}}_0x5f3734[_0x2f3e('0x3d')][_0x32f26f]=new RuleEngine(_0x10aa3e);_0x5f3734[_0x2f3e('0x3d')][_0x32f26f][_0x2f3e('0x3e')](_0x14a2a1,function(_0x52fad4){logger[_0x2f3e('0x39')](_0x2f3e('0x3f'),JSON['stringify'](_0x52fad4[_0x2f3e('0x40')]));if(_0x5f3734['rules'][_0x32f26f]){_0x5f3734[_0x2f3e('0x3d')][_0x32f26f][_0x2f3e('0x41')](_0x2f3e('0x42'));}});return _0xd6710({'code':0xc8,'message':_0x14a2a1});}else{if(_0x18dc6){logger[_0x2f3e('0x39')](util[_0x2f3e('0x43')](_0x2f3e('0x44'),_0x32f26f));}else{logger[_0x2f3e('0x39')](_0x2f3e('0x45'));}return _0xd6710({'code':0xc8,'message':_0x14a2a1});}}catch(_0x5506c2){logger['error'](_0x5506c2['stack']);return _0x4ecd41(_0x38ac85['error'](0x1f4,_0x5506c2));}}return _0x4ecd41(_0x2f3e('0x46'));});},'AcceptMessage':function(_0x1c0b22){var _0x100a13=this;return new Promise(function(_0x227baf,_0x4ad5d6){if(_0x1c0b22[_0x2f3e('0x47')]&&_0x1c0b22[_0x2f3e('0x47')]['id']){if(_0x5f3734['agents'][_0x1c0b22['agent']['id']]){_0x5f3734[_0x2f3e('0x48')][_0x1c0b22[_0x2f3e('0x47')]['id']][_0x2f3e('0x49')]=![];_0x5f3734[_0x2f3e('0x48')][_0x1c0b22[_0x2f3e('0x47')]['id']][_0x2f3e('0x4a')]=undefined;}}if(_0x1c0b22[_0x2f3e('0x16')]&&_0x1c0b22[_0x2f3e('0x16')]['id']){try{var _0x5cc1aa=getId(_0x1c0b22[_0x2f3e('0x15')],_0x1c0b22[_0x2f3e('0x16')]?_0x1c0b22[_0x2f3e('0x16')]['id']:0x0,_0x1c0b22[_0x2f3e('0x17')]?_0x1c0b22[_0x2f3e('0x17')]['id']:0x0);if(_0x5f3734[_0x2f3e('0x3d')][_0x5cc1aa]){_0x5f3734[_0x2f3e('0x3d')][_0x5cc1aa]['emit'](_0x2f3e('0x4b'));if(rpc[_0x1c0b22[_0x2f3e('0x15')]+'QueueReport']){rpc[_0x1c0b22[_0x2f3e('0x15')]+_0x2f3e('0x4c')][_0x2f3e('0x4d')](_0x5cc1aa,{'UserId':_0x1c0b22[_0x2f3e('0x16')][_0x2f3e('0x4e')]})[_0x2f3e('0x4f')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x227baf({'code':0xc8,'message':_0x1c0b22});}catch(_0x308bf2){logger[_0x2f3e('0x50')](_0x308bf2[_0x2f3e('0x51')]);return _0x4ad5d6(_0x100a13[_0x2f3e('0x50')](0x1f4,_0x308bf2));}}logger[_0x2f3e('0x50')]('message\x20is\x20empty');return _0x4ad5d6(_0x100a13['error'](0x1f4,_0x2f3e('0x52')));});},'RejectMessage':function(_0x13367a){var _0x4301e1=this;return new Promise(function(_0x3fc90b,_0x578578){if(_0x13367a['agent']&&_0x13367a['agent']['id']){try{if(_0x5f3734['agents'][_0x13367a['agent']['id']]){_0x5f3734[_0x2f3e('0x48')][_0x13367a[_0x2f3e('0x47')]['id']][_0x2f3e('0x49')]=![];_0x5f3734['agents'][_0x13367a[_0x2f3e('0x47')]['id']][_0x2f3e('0x4a')]=undefined;}return _0x3fc90b({'code':0xc8,'message':_0x13367a});}catch(_0x44a92e){logger['error'](_0x44a92e[_0x2f3e('0x51')]);return _0x578578(_0x4301e1[_0x2f3e('0x50')](0x1f4,_0x44a92e));}}logger[_0x2f3e('0x50')](_0x2f3e('0x52'));return _0x578578(_0x4301e1['error'](0x1f4,_0x2f3e('0x52')));});},'AbandonInteraction':function(_0x4034fe){var _0xf4f614=this;return new Promise(function(_0x12ee5b,_0x491f89){if(_0x4034fe['channel']&&_0x4034fe[_0x2f3e('0x17')]&&_0x4034fe[_0x2f3e('0x17')]['id']){try{var _0x13ad58=getId(_0x4034fe[_0x2f3e('0x15')],_0x4034fe[_0x2f3e('0x16')]?_0x4034fe[_0x2f3e('0x16')]['id']:0x0,_0x4034fe['interaction']?_0x4034fe[_0x2f3e('0x17')]['id']:0x0);if(_0x5f3734[_0x2f3e('0x3d')][_0x13ad58]){_0x5f3734[_0x2f3e('0x3d')][_0x13ad58]['emit'](_0x2f3e('0x4b'));}return _0x12ee5b({'code':0xc8,'message':_0x4034fe});}catch(_0x2ccd3e){logger['error'](_0x2ccd3e['stack']);return _0x491f89(_0xf4f614[_0x2f3e('0x50')](0x1f4,_0x2ccd3e));}}logger['error']('message\x20is\x20empty');return _0x491f89(_0xf4f614[_0x2f3e('0x50')](0x1f4,_0x2f3e('0x52')));});},'AgentCapacity':function(_0x1fbebe){var _0xe91fe7=this;return new Promise(function(_0x5ef17d,_0x372474){if(_0x5f3734[_0x2f3e('0x48')]['hasOwnProperty'](_0x1fbebe['id'])){for(var _0x54cb38 in _0x1fbebe[_0x2f3e('0x53')]){if(_0x1fbebe['capacity'][_0x2f3e('0x54')](_0x54cb38)){if(_0x5f3734[_0x2f3e('0x48')][_0x1fbebe['id']]['hasOwnProperty'](_0x54cb38+_0x2f3e('0x55'))){_0x5f3734[_0x2f3e('0x48')][_0x1fbebe['id']][_0x54cb38+_0x2f3e('0x55')]=parseInt(_0x1fbebe[_0x2f3e('0x53')][_0x54cb38],0xa);}}}_0x5f3734[_0x2f3e('0x48')][_0x1fbebe['id']][_0x2f3e('0x56')]();return _0x5ef17d({'code':0xc8,'message':_0x5f3734[_0x2f3e('0x48')][_0x1fbebe['id']]});}else{return _0x372474(_0xe91fe7[_0x2f3e('0x50')](0x1f4,_0x2f3e('0x57')));}});},'Agents':function(_0x24302a){return new Promise(function(_0x34ae9a){var _0xe657d2=_[_0x2f3e('0x58')](_0x5f3734['agents']);if(_0x24302a&&_0x24302a['id']){var _0x218ce6=_[_0x2f3e('0x59')](_0xe657d2,function(_0x349037){return _0x349037['id']===_0x24302a['id'];});_0x34ae9a(_0x218ce6);}else{_0x34ae9a({'count':_0xe657d2['length'],'rows':_0xe657d2});}});},'ChatQueues':function(){return new Promise(function(_0x2f2d2d){var _0x9cf6af=[];for(var _0xa4f400 in _0x5f3734[_0x2f3e('0x5a')]){if(_0x5f3734[_0x2f3e('0x5a')][_0x2f3e('0x54')](_0xa4f400)){var _0x37c763=_0x5f3734[_0x2f3e('0x5a')][_0xa4f400];var _0xb35bfc={'id':_0x37c763['id'],'available':_0x37c763['available'],'loggedIn':_0x37c763[_0x2f3e('0x5b')],'name':_0x37c763[_0x2f3e('0x5c')],'paused':_0x37c763[_0x2f3e('0x5d')],'waiting':_0x37c763[_0x2f3e('0x5e')]};_0x9cf6af[_0x2f3e('0x25')](_0xb35bfc);}}_0x2f2d2d({'count':_0x9cf6af[_0x2f3e('0x1c')],'rows':_0x9cf6af});});},'MailQueues':function(){return new Promise(function(_0x2bd5b8){var _0x25e677=[];for(var _0x54535d in _0x5f3734['mailQueues']){if(_0x5f3734[_0x2f3e('0x5f')][_0x2f3e('0x54')](_0x54535d)){var _0x1072f1=_0x5f3734[_0x2f3e('0x5f')][_0x54535d];var _0x57b923={'id':_0x1072f1['id'],'available':_0x1072f1[_0x2f3e('0x60')],'loggedIn':_0x1072f1[_0x2f3e('0x5b')],'name':_0x1072f1[_0x2f3e('0x5c')],'paused':_0x1072f1['paused'],'waiting':_0x1072f1[_0x2f3e('0x5e')]};_0x25e677[_0x2f3e('0x25')](_0x57b923);}}_0x2bd5b8({'count':_0x25e677['length'],'rows':_0x25e677});});},'OpenchannelQueues':function(){return new Promise(function(_0x549060){var _0x5d72e1=[];for(var _0x1f58c6 in _0x5f3734[_0x2f3e('0x61')]){if(_0x5f3734['openchannelQueues'][_0x2f3e('0x54')](_0x1f58c6)){var _0x19e16c=_0x5f3734[_0x2f3e('0x61')][_0x1f58c6];var _0x33d705={'id':_0x19e16c['id'],'available':_0x19e16c['available'],'loggedIn':_0x19e16c[_0x2f3e('0x5b')],'name':_0x19e16c[_0x2f3e('0x5c')],'paused':_0x19e16c[_0x2f3e('0x5d')],'waiting':_0x19e16c['waiting']};_0x5d72e1['push'](_0x33d705);}}_0x549060({'count':_0x5d72e1[_0x2f3e('0x1c')],'rows':_0x5d72e1});});},'SmsQueues':function(){return new Promise(function(_0x2b3151){var _0x26ecbf=[];for(var _0xbcd353 in _0x5f3734[_0x2f3e('0x62')]){if(_0x5f3734['smsQueues'][_0x2f3e('0x54')](_0xbcd353)){var _0x1bf9af=_0x5f3734[_0x2f3e('0x62')][_0xbcd353];var _0x43474a={'id':_0x1bf9af['id'],'available':_0x1bf9af[_0x2f3e('0x60')],'loggedIn':_0x1bf9af[_0x2f3e('0x5b')],'name':_0x1bf9af[_0x2f3e('0x5c')],'paused':_0x1bf9af[_0x2f3e('0x5d')],'waiting':_0x1bf9af[_0x2f3e('0x5e')]};_0x26ecbf[_0x2f3e('0x25')](_0x43474a);}}_0x2b3151({'count':_0x26ecbf[_0x2f3e('0x1c')],'rows':_0x26ecbf});});},'FaxQueues':function(){return new Promise(function(_0x516a72){var _0x210102=[];for(var _0x5274a7 in _0x5f3734[_0x2f3e('0x63')]){if(_0x5f3734['faxQueues'][_0x2f3e('0x54')](_0x5274a7)){var _0xa6e9d9=_0x5f3734[_0x2f3e('0x63')][_0x5274a7];var _0x59f5a1={'id':_0xa6e9d9['id'],'available':_0xa6e9d9[_0x2f3e('0x60')],'loggedIn':_0xa6e9d9[_0x2f3e('0x5b')],'name':_0xa6e9d9[_0x2f3e('0x5c')],'paused':_0xa6e9d9[_0x2f3e('0x5d')],'waiting':_0xa6e9d9['waiting']};_0x210102[_0x2f3e('0x25')](_0x59f5a1);}}_0x516a72({'count':_0x210102[_0x2f3e('0x1c')],'rows':_0x210102});});},'WhatsappQueues':function(){return new Promise(function(_0x1f2f2e){var _0x12eb95=[];for(var _0xc75ee9 in _0x5f3734[_0x2f3e('0x64')]){if(_0x5f3734[_0x2f3e('0x64')][_0x2f3e('0x54')](_0xc75ee9)){var _0x580be0=_0x5f3734[_0x2f3e('0x64')][_0xc75ee9];var _0x1c3ca6={'id':_0x580be0['id'],'available':_0x580be0[_0x2f3e('0x60')],'loggedIn':_0x580be0[_0x2f3e('0x5b')],'name':_0x580be0[_0x2f3e('0x5c')],'paused':_0x580be0[_0x2f3e('0x5d')],'waiting':_0x580be0[_0x2f3e('0x5e')]};_0x12eb95[_0x2f3e('0x25')](_0x1c3ca6);}}_0x1f2f2e({'count':_0x12eb95[_0x2f3e('0x1c')],'rows':_0x12eb95});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x315321){var _0x244050=_[_0x2f3e('0x58')](_0x5f3734[_0x2f3e('0x65')]);_0x315321({'count':_0x244050[_0x2f3e('0x1c')],'rows':_0x244050});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xbdf1ff){var _0x5b31fe=_[_0x2f3e('0x58')](_0x5f3734['mailQueuesWaitingInteractions']);_0xbdf1ff({'count':_0x5b31fe['length'],'rows':_0x5b31fe});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1b0b70){var _0xd18361=_[_0x2f3e('0x58')](_0x5f3734['openchannelQueuesWaitingInteractions']);_0x1b0b70({'count':_0xd18361['length'],'rows':_0xd18361});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x386dee){var _0x42bef9=_[_0x2f3e('0x58')](_0x5f3734[_0x2f3e('0x66')]);_0x386dee({'count':_0x42bef9[_0x2f3e('0x1c')],'rows':_0x42bef9});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x325acc){var _0x4a1f48=_[_0x2f3e('0x58')](_0x5f3734[_0x2f3e('0x67')]);_0x325acc({'count':_0x4a1f48['length'],'rows':_0x4a1f48});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1ac1cc){var _0x930381=_[_0x2f3e('0x58')](_0x5f3734[_0x2f3e('0x68')]);_0x1ac1cc({'count':_0x930381[_0x2f3e('0x1c')],'rows':_0x930381});});}};var _0x164c19=jayson[_0x2f3e('0x69')](_0x341fff)[_0x2f3e('0x6a')]();_0x164c19['on']('error',function(_0x59dc98){logger[_0x2f3e('0x50')](JSON['stringify'](_0x59dc98));return _0x2ecb10(_0x59dc98);});_0x164c19['listen'](0x232c,_0x2f3e('0x6b'),function(){console[_0x2f3e('0x6c')](_0x2f3e('0x6d'),0x232c);return _0x1ad130(_0x2f3e('0x6e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6a89e43..f5e503b 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 _0x6b84=['routing','http','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','lodash'];(function(_0x2e5e02,_0x34b6d6){var _0x1670c1=function(_0x52031a){while(--_0x52031a){_0x2e5e02['push'](_0x2e5e02['shift']());}};_0x1670c1(++_0x34b6d6);}(_0x6b84,0x84));var _0x46b8=function(_0x50e71c,_0x4e4649){_0x50e71c=_0x50e71c-0x0;var _0x29c891=_0x6b84[_0x50e71c];return _0x29c891;};'use strict';var util=require(_0x46b8('0x0'));var BPromise=require(_0x46b8('0x1'));var jayson=require('jayson/promise');var _=require(_0x46b8('0x2'));var logger=require('../../../config/logger')(_0x46b8('0x3'));var client=jayson['client'][_0x46b8('0x4')]({'port':0x232a});function request(_0x15dcaf,_0x4c6385){return new BPromise(function(_0x37bd48,_0x32564b){return client['request'](_0x15dcaf,_0x4c6385)[_0x46b8('0x5')](function(_0x3f5f76){if(_0x3f5f76[_0x46b8('0x6')]){return _0x32564b(_0x3f5f76[_0x46b8('0x6')][_0x46b8('0x7')]);}else{return _0x37bd48(_0x3f5f76['result']);}})[_0x46b8('0x8')](function(_0x2754d5){return _0x32564b(_0x2754d5);});});}exports[_0x46b8('0x9')]=function(_0x5c7c34,_0x3622fc,_0x338c81){return function(_0x3c79d0){if(_0x338c81[_0x46b8('0xa')]&&!_0x338c81[_0x46b8('0xa')][_0x5c7c34]){logger[_0x46b8('0xb')](_0x46b8('0xc'),_0x5c7c34);return _0x3c79d0[_0x46b8('0xd')]();}var _0x29739c=[];for(var _0x2a5116=0x0;_0x2a5116<_0x3622fc[_0x46b8('0xe')];_0x2a5116+=0x1){_0x29739c[_0x46b8('0xf')](request(_0x46b8('0x10'),{'command':util[_0x46b8('0x11')](_0x46b8('0x12'),_0x3622fc[_0x2a5116])})[_0x46b8('0x5')](function(_0x379bbf){return _0x379bbf&&_0x379bbf[_0x46b8('0x7')]&&_0x379bbf['message']['indexOf'](_0x46b8('0x13'))>=0x0?!![]:![];})['catch'](function(){logger[_0x46b8('0x6')](_0x46b8('0x14'),_0x5c7c34,_0x3622fc[_0x2a5116]);}));}BPromise[_0x46b8('0x15')](_0x29739c)[_0x46b8('0x5')](function(_0xd3ecb2){var _0x2d47d1=_['some'](_0xd3ecb2);logger['info'](_0x46b8('0x16'),_0x5c7c34,_0x3622fc[_0x46b8('0x17')](_0x46b8('0x18')),_0x2d47d1);_0x3c79d0[_0x46b8('0x19')](_0x2d47d1);})['catch'](function(_0x402ee3){logger[_0x46b8('0x6')](_0x46b8('0x16'),_0x5c7c34,_0x3622fc[_0x46b8('0x17')]('\x20|\x20'),_0x402ee3[_0x46b8('0x1a')]);_0x3c79d0['stop']();});};}; \ No newline at end of file +var _0x5bd2=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','message','indexOf','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','then','error','result','catch','condition','rules'];(function(_0x180a8f,_0x38325d){var _0x97c22b=function(_0x5d358b){while(--_0x5d358b){_0x180a8f['push'](_0x180a8f['shift']());}};_0x97c22b(++_0x38325d);}(_0x5bd2,0xb7));var _0x25bd=function(_0x16784e,_0x4b15ed){_0x16784e=_0x16784e-0x0;var _0x25c2c4=_0x5bd2[_0x16784e];return _0x25c2c4;};'use strict';var util=require(_0x25bd('0x0'));var BPromise=require(_0x25bd('0x1'));var jayson=require(_0x25bd('0x2'));var _=require(_0x25bd('0x3'));var logger=require(_0x25bd('0x4'))(_0x25bd('0x5'));var client=jayson[_0x25bd('0x6')]['http']({'port':0x232a});function request(_0x3fefb5,_0x243911){return new BPromise(function(_0x2f82d9,_0x2e415c){return client['request'](_0x3fefb5,_0x243911)[_0x25bd('0x7')](function(_0x3b0a85){if(_0x3b0a85[_0x25bd('0x8')]){return _0x2e415c(_0x3b0a85[_0x25bd('0x8')]['message']);}else{return _0x2f82d9(_0x3b0a85[_0x25bd('0x9')]);}})[_0x25bd('0xa')](function(_0x589156){return _0x2e415c(_0x589156);});});}exports[_0x25bd('0xb')]=function(_0x2300aa,_0x2e6eb0,_0xc12ddc){return function(_0x836090){if(_0xc12ddc[_0x25bd('0xc')]&&!_0xc12ddc[_0x25bd('0xc')][_0x2300aa]){logger[_0x25bd('0xd')](_0x25bd('0xe'),_0x2300aa);return _0x836090[_0x25bd('0xf')]();}var _0x510028=[];for(var _0x1d7998=0x0;_0x1d7998<_0x2e6eb0[_0x25bd('0x10')];_0x1d7998+=0x1){_0x510028[_0x25bd('0x11')](request('Command',{'command':util[_0x25bd('0x12')](_0x25bd('0x13'),_0x2e6eb0[_0x1d7998])})[_0x25bd('0x7')](function(_0x5a2d5f){return _0x5a2d5f&&_0x5a2d5f[_0x25bd('0x14')]&&_0x5a2d5f[_0x25bd('0x14')][_0x25bd('0x15')]('true')>=0x0?!![]:![];})['catch'](function(){logger[_0x25bd('0x8')]('[%s][INTERVAL]\x20%s',_0x2300aa,_0x2e6eb0[_0x1d7998]);}));}BPromise[_0x25bd('0x16')](_0x510028)[_0x25bd('0x7')](function(_0x2ab03c){var _0x21454d=_['some'](_0x2ab03c);logger[_0x25bd('0xd')](_0x25bd('0x17'),_0x2300aa,_0x2e6eb0['join'](_0x25bd('0x18')),_0x21454d);_0x836090[_0x25bd('0x19')](_0x21454d);})['catch'](function(_0x1824c8){logger[_0x25bd('0x8')](_0x25bd('0x17'),_0x2300aa,_0x2e6eb0[_0x25bd('0x1a')](_0x25bd('0x18')),_0x1824c8[_0x25bd('0x1b')]);_0x836090[_0x25bd('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bbe7a73..4eaaeb9 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 _0x5ec6=['connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agentcompleteAt','agent','lodash','util','./utils','format','uniqueid','queue','interface','calleridnum','lastevent','then','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]'];(function(_0x12c676,_0x4e075b){var _0x1d2c8d=function(_0x5e3a41){while(--_0x5e3a41){_0x12c676['push'](_0x12c676['shift']());}};_0x1d2c8d(++_0x4e075b);}(_0x5ec6,0x7f));var _0x65ec=function(_0xb1c7c3,_0x1a6502){_0xb1c7c3=_0xb1c7c3-0x0;var _0x40c15c=_0x5ec6[_0xb1c7c3];return _0x40c15c;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var utils=require(_0x65ec('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5c0775,_0x1b924d){utils['info'](util[_0x65ec('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5c0775[_0x65ec('0x4')],_0x5c0775['channel'],_0x5c0775[_0x65ec('0x5')],_0x5c0775['membername'],_0x5c0775[_0x65ec('0x6')],_0x5c0775[_0x65ec('0x7')],_0x5c0775['connectedlinenum'],_0x5c0775[_0x65ec('0x8')]));if(_0x5c0775[_0x65ec('0x5')]){utils['getVoiceQueueByName'](_0x5c0775[_0x65ec('0x5')])[_0x65ec('0x9')](function(_0x300f83){if(_0x300f83){_0x5c0775['type']=_0x300f83['type'];_0x5c0775[_0x65ec('0xa')]=_0x5c0775['agentcomplete']?_0x300f83[_0x65ec('0xb')]:![];_0x5c0775[_0x65ec('0xc')]=_0x5c0775['agentacw']?_0x300f83[_0x65ec('0xd')]:0x0;}utils[_0x65ec('0xe')]('CreateVoiceAgentReport',_0x5c0775);});}else{utils[_0x65ec('0xe')](_0x65ec('0xf'),_0x5c0775);}if(_0x1b924d){delete transfers[_0x5c0775['uniqueid']];}else{delete agents[_0x5c0775[_0x65ec('0x10')]];}}exports[_0x65ec('0x11')]=function(_0x411a7b){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x411a7b);agents[_0x411a7b[_0x65ec('0x10')]]=_0x411a7b;agents[_0x411a7b['destuniqueid']][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();agents[_0x411a7b[_0x65ec('0x10')]]['lastevent']='called';agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x16')]=null;agents[_0x411a7b[_0x65ec('0x10')]]['connectedlinename']=null;utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x18'),_0x411a7b[_0x65ec('0x4')],agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x19')],_0x411a7b[_0x65ec('0x10')]));}catch(_0x3ef058){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x3ef058);}};exports[_0x65ec('0x1b')]=function(_0x1467ac){try{if(!_[_0x65ec('0x1c')](agents[_0x1467ac[_0x65ec('0x10')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac['uniqueid']),_0x1467ac);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x1e'),_0x1467ac[_0x65ec('0x4')],agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x19')],_0x1467ac[_0x65ec('0x10')]));agents[_0x1467ac['destuniqueid']][_0x65ec('0x1b')]=!![];agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x20');agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x21')]='timeout';agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x1467ac[_0x65ec('0x23')]?parseInt(_0x1467ac[_0x65ec('0x23')])/0x3e8:0x0;agents[_0x1467ac['destuniqueid']][_0x65ec('0x24')]=0x0;unanswered['push'](_0x1467ac[_0x65ec('0x10')]);}}catch(_0x1ada47){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac[_0x65ec('0x4')]),_0x1ada47);}};exports[_0x65ec('0x25')]=function(_0x39410f){try{_[_0x65ec('0x26')](agents,function(_0xeec5d4,_0x3c97e2){if(_0xeec5d4['uniqueid']==_0x39410f['uniqueid']&&!_[_0x65ec('0x27')](unanswered,_0xeec5d4['destuniqueid'])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')]('[%s][agents][queuecallerabandon]',_0x39410f[_0x65ec('0x4')]),_0x39410f);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x28'),_0x39410f['uniqueid'],_0xeec5d4[_0x65ec('0x19')],_0xeec5d4[_0x65ec('0x10')]));_0xeec5d4[_0x65ec('0x1b')]=!![];_0xeec5d4[_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();_0xeec5d4[_0x65ec('0x8')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x21')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x22')]=_0x39410f['holdtime'];_0xeec5d4[_0x65ec('0x24')]=0x0;writeDB(_0xeec5d4);}});}catch(_0x1e20c4){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2a'),_0x39410f[_0x65ec('0x4')]),_0x1e20c4);}};exports[_0x65ec('0x2b')]=function(_0x134cce){try{if(agents[_0x134cce[_0x65ec('0x10')]]){utils[_0x65ec('0x12')](util['format'](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x134cce);utils[_0x65ec('0x17')](util[_0x65ec('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x134cce[_0x65ec('0x4')],agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x19')],_0x134cce[_0x65ec('0x10')]));agents[_0x134cce['destuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();agents[_0x134cce['destuniqueid']][_0x65ec('0x16')]=_0x134cce[_0x65ec('0x16')];agents[_0x134cce['destuniqueid']][_0x65ec('0x2d')]=_0x134cce[_0x65ec('0x2d')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x2e');_[_0x65ec('0x26')](agents,function(_0x2ce56f,_0x3561ef){if(_0x2ce56f['destuniqueid']!=_0x134cce[_0x65ec('0x10')]&&_0x2ce56f['uniqueid']==_0x134cce[_0x65ec('0x4')]){_0x2ce56f[_0x65ec('0x24')]=0x0;_0x2ce56f[_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];_0x2ce56f[_0x65ec('0x1b')]=!![];_0x2ce56f[_0x65ec('0x1f')]=utils['now']();_0x2ce56f[_0x65ec('0x8')]='answered_elsewhere';_0x2ce56f['reason']=_0x65ec('0x2f');_0x2ce56f[_0x65ec('0x30')]=_0x134cce[_0x65ec('0x10')];_0x2ce56f[_0x65ec('0x31')]=_0x134cce[_0x65ec('0x19')];writeDB(_0x2ce56f);}});}}catch(_0x524235){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x524235);}};exports[_0x65ec('0x32')]=function(_0x11edd1){try{if(!_['isNil'](agents[_0x11edd1['destuniqueid']])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x11edd1);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x34'),_0x11edd1['uniqueid'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x19')],_0x11edd1[_0x65ec('0x10')]));agents[_0x11edd1['destuniqueid']][_0x65ec('0x32')]=!![];agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x36')]);agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x21')]=_0x11edd1['reason'];agents[_0x11edd1[_0x65ec('0x10')]]['lastevent']=_0x65ec('0x37');writeDB(agents[_0x11edd1[_0x65ec('0x10')]]);}}catch(_0x3095f5){utils['error'](util['format'](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x3095f5);}};exports[_0x65ec('0x38')]=function(_0x2111af){try{if(!_[_0x65ec('0x1c')](agents[_0x2111af[_0x65ec('0x39')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x2111af);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x3b'),_0x2111af[_0x65ec('0x4')],agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x19')],agents[_0x2111af[_0x65ec('0x39')]]['uniqueid']));agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x3c')]=!![];agents[_0x2111af['transfereruniqueid']][_0x65ec('0x3d')]=_0x65ec('0x3e');agents[_0x2111af[_0x65ec('0x39')]]['transferexten']=_0x2111af[_0x65ec('0x3f')];agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x40')]=agents[_0x2111af['transfereruniqueid']][_0x65ec('0x4')];}}catch(_0x5e5e48){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x5e5e48);}};exports['attendedtransfer']=function(_0x2df855){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855[_0x65ec('0x42')]),_0x2df855);if(_0x2df855[_0x65ec('0x42')]==_0x2df855[_0x65ec('0x43')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x44')]])){utils['info'](util['format'](_0x65ec('0x45'),_0x2df855['origtransfereruniqueid'],agents[_0x2df855[_0x65ec('0x44')]]['membername']));agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3d')]=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x47')]=_0x2df855['origtransfererexten'];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x42')];}if(_0x2df855[_0x65ec('0x48')]&&agents[_0x2df855[_0x65ec('0x48')]]){agents[_0x2df855['transfereeuniqueid']][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x48')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x48')]]);transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x7')];transfers[_0x2df855['transfereeuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x4b')];transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855[_0x65ec('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x2df855[_0x65ec('0x48')]]['holdtime']=0x0;transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x49')]=0x2;}}else if(_0x2df855['secondtransfereruniqueid']==_0x2df855[_0x65ec('0x4c')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x42')]])){utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x45'),_0x2df855[_0x65ec('0x42')],agents[_0x2df855['origtransfereruniqueid']]['membername']));agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x42')]]['transfertype']=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x47')]=_0x2df855[_0x65ec('0x4d')];agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x44')];}if(_0x2df855['transfertargetuniqueid']&&agents[_0x2df855[_0x65ec('0x4e')]]){agents[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x4e')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x4e')]]);transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x42')]]['calleridnum'];transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855['origtransfereruniqueid']]['calleridname'];transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x49')]=0x2;}}}catch(_0x4f52ed){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855['origtransfereruniqueid']),_0x4f52ed);}};exports['hangup']=function(_0x258e14){try{utils['debug'](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x258e14);if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]===_0x65ec('0x20')){if(_0x258e14[_0x65ec('0x50')]==='21'){agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]='rejected';agents[_0x258e14[_0x65ec('0x4')]]['lastevent']=_0x65ec('0x51');}utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],agents[_0x258e14[_0x65ec('0x4')]]['membername'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14['uniqueid']]);var _0x5307ac=unanswered['indexOf'](_0x258e14[_0x65ec('0x4')]);if(_0x5307ac>-0x1){unanswered[_0x65ec('0x53')](_0x5307ac,0x1);}}if(transfers[_0x258e14[_0x65ec('0x4')]]){transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x32')]=!![];transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')]=utils[_0x65ec('0x15')]();transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],transfers[_0x258e14['uniqueid']][_0x65ec('0x36')]);transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=_0x65ec('0x55');transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]=_0x65ec('0x37');utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],transfers[_0x258e14[_0x65ec('0x4')]]['membername'],transfers[_0x258e14['uniqueid']][_0x65ec('0x21')],transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(transfers[_0x258e14[_0x65ec('0x4')]],!![]);}if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]){agents[_0x258e14[_0x65ec('0x4')]]['agentcomplete']=!![];agents[_0x258e14[_0x65ec('0x4')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils['diffTime'](agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]);agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=agents[_0x258e14[_0x65ec('0x4')]]['transfer']?_0x65ec('0x3c'):_0x65ec('0x55');agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]='complete';utils['info'](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14[_0x65ec('0x4')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x19')],agents[_0x258e14[_0x65ec('0x4')]]['reason'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14[_0x65ec('0x4')]]);}}catch(_0x127e67){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x127e67);}}; \ No newline at end of file +var _0xac4a=['now','lastevent','called','connectedlinename','format','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','calleridnum','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','channel','queue','interface','connectedlinenum','getVoiceQueueByName','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x2196d5,_0x26a7bf){var _0x5290a1=function(_0x1ee421){while(--_0x1ee421){_0x2196d5['push'](_0x2196d5['shift']());}};_0x5290a1(++_0x26a7bf);}(_0xac4a,0x13f));var _0xaac4=function(_0xc56c46,_0x3fc792){_0xc56c46=_0xc56c46-0x0;var _0x2055d6=_0xac4a[_0xc56c46];return _0x2055d6;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var utils=require(_0xaac4('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x132fc3,_0x38f4f4){utils[_0xaac4('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x132fc3[_0xaac4('0x4')],_0x132fc3[_0xaac4('0x5')],_0x132fc3[_0xaac4('0x6')],_0x132fc3['membername'],_0x132fc3[_0xaac4('0x7')],_0x132fc3['calleridnum'],_0x132fc3[_0xaac4('0x8')],_0x132fc3['lastevent']));if(_0x132fc3[_0xaac4('0x6')]){utils[_0xaac4('0x9')](_0x132fc3['queue'])['then'](function(_0x349671){if(_0x349671){_0x132fc3['type']=_0x349671[_0xaac4('0xa')];_0x132fc3['agentacw']=_0x132fc3['agentcomplete']?_0x349671[_0xaac4('0xb')]:![];_0x132fc3[_0xaac4('0xc')]=_0x132fc3[_0xaac4('0xd')]?_0x349671[_0xaac4('0xe')]:0x0;}utils[_0xaac4('0xf')]('CreateVoiceAgentReport',_0x132fc3);});}else{utils['request'](_0xaac4('0x10'),_0x132fc3);}if(_0x38f4f4){delete transfers[_0x132fc3[_0xaac4('0x4')]];}else{delete agents[_0x132fc3[_0xaac4('0x11')]];}}exports['agentcalled']=function(_0x6a808d){try{utils[_0xaac4('0x12')](util['format'](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0x6a808d);agents[_0x6a808d[_0xaac4('0x11')]]=_0x6a808d;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x14')]=utils[_0xaac4('0x15')]();agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x17');agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x8')]=null;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x18')]=null;utils['info'](util[_0xaac4('0x19')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x6a808d[_0xaac4('0x4')],agents[_0x6a808d['destuniqueid']][_0xaac4('0x1a')],_0x6a808d[_0xaac4('0x11')]));}catch(_0xa22b76){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0xa22b76);}};exports[_0xaac4('0x1c')]=function(_0x4166ee){try{if(!_['isNil'](agents[_0x4166ee[_0xaac4('0x11')]])){utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x4166ee);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x1e'),_0x4166ee['uniqueid'],agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x4166ee[_0xaac4('0x11')]));agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1c')]=!![];agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1f')]=utils['now']();agents[_0x4166ee[_0xaac4('0x11')]]['lastevent']='timeout';agents[_0x4166ee['destuniqueid']]['reason']=_0xaac4('0x20');agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x4166ee[_0xaac4('0x22')]?parseInt(_0x4166ee[_0xaac4('0x22')])/0x3e8:0x0;agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x23')]=0x0;unanswered[_0xaac4('0x24')](_0x4166ee[_0xaac4('0x11')]);}}catch(_0x386c9b){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x386c9b);}};exports[_0xaac4('0x25')]=function(_0x669b34){try{_[_0xaac4('0x26')](agents,function(_0x5e469a,_0xcf6c1){if(_0x5e469a['uniqueid']==_0x669b34[_0xaac4('0x4')]&&!_[_0xaac4('0x27')](unanswered,_0x5e469a[_0xaac4('0x11')])){utils[_0xaac4('0x12')](util['format']('[%s][agents][queuecallerabandon]',_0x669b34['uniqueid']),_0x669b34);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x28'),_0x669b34[_0xaac4('0x4')],_0x5e469a[_0xaac4('0x1a')],_0x5e469a[_0xaac4('0x11')]));_0x5e469a[_0xaac4('0x1c')]=!![];_0x5e469a[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5e469a[_0xaac4('0x16')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x2a')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x21')]=_0x669b34[_0xaac4('0x21')];_0x5e469a['talktime']=0x0;writeDB(_0x5e469a);}});}catch(_0x5bad9f){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2b'),_0x669b34['uniqueid']),_0x5bad9f);}};exports[_0xaac4('0x2c')]=function(_0x16fae8){try{if(agents[_0x16fae8[_0xaac4('0x11')]]){utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x16fae8);utils['info'](util[_0xaac4('0x19')](_0xaac4('0x2e'),_0x16fae8[_0xaac4('0x4')],agents[_0x16fae8['destuniqueid']][_0xaac4('0x1a')],_0x16fae8['destuniqueid']));agents[_0x16fae8['destuniqueid']][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();agents[_0x16fae8[_0xaac4('0x11')]]['connectedlinenum']=_0x16fae8['connectedlinenum'];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x18')]=_0x16fae8[_0xaac4('0x18')];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x16fae8[_0xaac4('0x22')];agents[_0x16fae8['destuniqueid']]['lastevent']=_0xaac4('0x30');_[_0xaac4('0x26')](agents,function(_0x5371b4,_0x416a5b){if(_0x5371b4[_0xaac4('0x11')]!=_0x16fae8[_0xaac4('0x11')]&&_0x5371b4['uniqueid']==_0x16fae8[_0xaac4('0x4')]){_0x5371b4[_0xaac4('0x23')]=0x0;_0x5371b4[_0xaac4('0x21')]=_0x16fae8['ringtime'];_0x5371b4[_0xaac4('0x1c')]=!![];_0x5371b4[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5371b4[_0xaac4('0x16')]='answered_elsewhere';_0x5371b4[_0xaac4('0x2a')]='answered_elsewhere';_0x5371b4['answeredelsewheredestinationuniqueid']=_0x16fae8[_0xaac4('0x11')];_0x5371b4[_0xaac4('0x31')]=_0x16fae8[_0xaac4('0x1a')];writeDB(_0x5371b4);}});}}catch(_0x40c007){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x40c007);}};exports['agentcomplete']=function(_0x15191a){try{if(!_[_0xaac4('0x32')](agents[_0x15191a[_0xaac4('0x11')]])){utils[_0xaac4('0x12')](util['format'](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x15191a);utils[_0xaac4('0x3')](util['format'](_0xaac4('0x34'),_0x15191a[_0xaac4('0x4')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x15191a['destuniqueid']));agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x35')]=!![];agents[_0x15191a[_0xaac4('0x11')]]['agentcompleteAt']=utils[_0xaac4('0x15')]();agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x37')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x2f')]);agents[_0x15191a[_0xaac4('0x11')]]['reason']=_0x15191a[_0xaac4('0x2a')];agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x38');writeDB(agents[_0x15191a[_0xaac4('0x11')]]);}}catch(_0x5dca5c){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x5dca5c);}};exports[_0xaac4('0x39')]=function(_0x5f33ea){try{if(!_[_0xaac4('0x32')](agents[_0x5f33ea['transfereruniqueid']])){utils[_0xaac4('0x12')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]',_0x5f33ea[_0xaac4('0x4')]),_0x5f33ea);utils[_0xaac4('0x3')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5f33ea['uniqueid'],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x1a')],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')]));agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3b')]=!![];agents[_0x5f33ea['transfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x3d');agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3e')]=_0x5f33ea['extension'];agents[_0x5f33ea[_0xaac4('0x3a')]]['transferuniqueid']=agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')];}}catch(_0x460252){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x3f'),_0x5f33ea[_0xaac4('0x4')]),_0x460252);}};exports[_0xaac4('0x40')]=function(_0x28aed5){try{utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x28aed5);if(_0x28aed5[_0xaac4('0x42')]==_0x28aed5['origtransfererlinkedid']){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x43')]])){utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x44'),_0x28aed5[_0xaac4('0x42')],agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x1a')]));agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3c')]='ATTENDED';agents[_0x28aed5[_0xaac4('0x43')]]['transferexten']=_0x28aed5['origtransfererexten'];agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x45')]=_0x28aed5['origtransfereruniqueid'];}if(_0x28aed5[_0xaac4('0x46')]&&agents[_0x28aed5[_0xaac4('0x46')]]){agents[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x46')]]=_[_0xaac4('0x48')](agents[_0x28aed5['transfereeuniqueid']]);transfers[_0x28aed5[_0xaac4('0x46')]]['calleridnum']=agents[_0x28aed5[_0xaac4('0x43')]]['calleridnum'];transfers[_0x28aed5['transfereeuniqueid']]['calleridname']=agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x49')];transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();transfers[_0x28aed5['transfereeuniqueid']][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x2;}}else if(_0x28aed5[_0xaac4('0x43')]==_0x28aed5[_0xaac4('0x4a')]){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x42')]])){utils['info'](util['format'](_0xaac4('0x44'),_0x28aed5['origtransfereruniqueid'],agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x1a')]));agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x4b');agents[_0x28aed5['origtransfereruniqueid']]['transferexten']=_0x28aed5['secondtransfererexten'];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x45')]=_0x28aed5[_0xaac4('0x43')];}if(_0x28aed5[_0xaac4('0x4c')]&&agents[_0x28aed5[_0xaac4('0x4c')]]){agents[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x4c')]]=_[_0xaac4('0x48')](agents[_0x28aed5[_0xaac4('0x4c')]]);transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x4d')]=agents[_0x28aed5[_0xaac4('0x42')]][_0xaac4('0x4d')];transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x49')]=agents[_0x28aed5[_0xaac4('0x42')]]['calleridname'];transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x2f')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x47')]=0x2;}}}catch(_0x50eeee){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x50eeee);}};exports[_0xaac4('0x4e')]=function(_0x3a1b41){try{utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x4f'),_0x3a1b41['uniqueid']),_0x3a1b41);if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]]['reason']==='timeout'){if(_0x3a1b41[_0xaac4('0x50')]==='21'){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x51');agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]=_0xaac4('0x51');}utils[_0xaac4('0x3')](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x16')]));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);var _0x53059b=unanswered['indexOf'](_0x3a1b41['uniqueid']);if(_0x53059b>-0x1){unanswered[_0xaac4('0x53')](_0x53059b,0x1);}}if(transfers[_0x3a1b41['uniqueid']]){transfers[_0x3a1b41['uniqueid']]['agentcomplete']=!![];transfers[_0x3a1b41['uniqueid']]['agentcompleteAt']=utils[_0xaac4('0x15')]();transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](transfers[_0x3a1b41['uniqueid']][_0xaac4('0x37')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x54');transfers[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils['info'](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]));writeDB(transfers[_0x3a1b41[_0xaac4('0x4')]],!![]);}if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x35')]=!![];agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')]=utils[_0xaac4('0x15')]();agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);agents[_0x3a1b41[_0xaac4('0x4')]]['reason']=agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x3b')]?_0xaac4('0x3b'):_0xaac4('0x54');agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x1a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x2a')],agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);}}catch(_0x55cf3c){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')]('[%s][agents][hangup]',_0x3a1b41[_0xaac4('0x4')]),_0x55cf3c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 76e169d..e3ddfba 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 _0x11da=['NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','lodash','util','./utils'];(function(_0x273040,_0x4f8bb4){var _0x522882=function(_0x34e1da){while(--_0x34e1da){_0x273040['push'](_0x273040['shift']());}};_0x522882(++_0x4f8bb4);}(_0x11da,0x195));var _0xa11d=function(_0x2ba1c7,_0x2e4a24){_0x2ba1c7=_0x2ba1c7-0x0;var _0x1ff608=_0x11da[_0x2ba1c7];return _0x1ff608;};'use strict';var _=require(_0xa11d('0x0'));var util=require(_0xa11d('0x1'));var utils=require(_0xa11d('0x2'));var dispositions=[_0xa11d('0x3'),_0xa11d('0x4'),_0xa11d('0x4'),'NO\x20ANSWER',_0xa11d('0x3'),'NO\x20ANSWER',_0xa11d('0x5'),_0xa11d('0x6'),'FAILED',_0xa11d('0x4'),_0xa11d('0x4')];var channels={};function writeDB(_0x273cc9){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x9'),_0x273cc9[_0xa11d('0xa')],_0x273cc9[_0xa11d('0xb')],_0x273cc9[_0xa11d('0xc')],_0x273cc9[_0xa11d('0xd')],_0x273cc9[_0xa11d('0xe')],_0x273cc9[_0xa11d('0xf')],_0x273cc9['connectedlinenum'],_0x273cc9[_0xa11d('0x10')]));if(_0x273cc9[_0xa11d('0x11')]){utils[_0xa11d('0x12')](_0x273cc9[_0xa11d('0x11')])['then'](function(_0x102b06){if(_0x102b06){_0x273cc9[_0xa11d('0x13')]=_0x102b06['id'];}utils['request'](_0xa11d('0x14'),_0x273cc9);});}else{utils[_0xa11d('0x15')](_0xa11d('0x14'),_0x273cc9);}if(channels[_0x273cc9[_0xa11d('0xa')]]){delete channels[_0x273cc9[_0xa11d('0xa')]];}}exports['newchannel']=function(_0x3bffd7){try{utils[_0xa11d('0x16')](util[_0xa11d('0x8')]('[%s][calls][newchannel]',_0x3bffd7[_0xa11d('0xa')]),_0x3bffd7);if(_0x3bffd7[_0xa11d('0xa')]==_0x3bffd7[_0xa11d('0x17')]&&_0x3bffd7[_0xa11d('0xb')]!=_0xa11d('0x18')){utils[_0xa11d('0x7')](util['format'](_0xa11d('0x19'),_0x3bffd7[_0xa11d('0xa')],_0x3bffd7['context'],_0x3bffd7[_0xa11d('0x1a')]));channels[_0x3bffd7['uniqueid']]={'uniqueid':_0x3bffd7['uniqueid'],'accountcode':_0x3bffd7[_0xa11d('0x11')],'source':_0x3bffd7[_0xa11d('0xf')],'destination':_0x3bffd7['exten'],'destinationcontext':_0x3bffd7[_0xa11d('0x1b')],'channel':_0x3bffd7[_0xa11d('0xb')],'starttime':utils[_0xa11d('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa11d('0x3'),'amaflags':_0xa11d('0x1d')};}}catch(_0x359ba2){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x1f'),_0x3bffd7[_0xa11d('0xa')]),_0x359ba2);}};exports[_0xa11d('0x20')]=function(_0x17f371){try{utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x21'),_0x17f371[_0xa11d('0xa')]),_0x17f371);if(!_['isNil'](channels[_0x17f371[_0xa11d('0xa')]])&&_0x17f371[_0xa11d('0x22')]==0x6){utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x17f371['uniqueid'],_0x17f371[_0xa11d('0x1b')],_0x17f371[_0xa11d('0xb')]));if(_[_0xa11d('0x23')](channels[_0x17f371[_0xa11d('0xa')]][_0xa11d('0x24')])){channels[_0x17f371[_0xa11d('0xa')]][_0xa11d('0x24')]=utils[_0xa11d('0x1c')]();}}else if(!_[_0xa11d('0x23')](channels[_0x17f371[_0xa11d('0x17')]])&&_0x17f371['channelstate']==0x6&&_0x17f371['context']!=_0xa11d('0x25')){utils[_0xa11d('0x7')](util['format'](_0xa11d('0x26'),_0x17f371[_0xa11d('0xa')],_0x17f371[_0xa11d('0x17')],_0x17f371[_0xa11d('0x1b')],_0x17f371['channel']));channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x11')]=_0x17f371[_0xa11d('0x11')];channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x27')]=_0x17f371[_0xa11d('0xb')];if(_[_0xa11d('0x23')](channels[_0x17f371['linkedid']][_0xa11d('0x28')])){channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x28')]=utils[_0xa11d('0x1c')]();}channels[_0x17f371[_0xa11d('0x17')]]['disposition']=dispositions[_[_0xa11d('0x29')](_0x17f371[_0xa11d('0x22')])]||_0xa11d('0x5');}}catch(_0x1e1a98){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x21'),_0x17f371[_0xa11d('0xa')]),_0x1e1a98);}};exports[_0xa11d('0x2a')]=function(_0x583c5b){try{if(!_[_0xa11d('0x23')](channels[_0x583c5b[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')]('[%s][calls][hangup]',_0x583c5b['uniqueid']),_0x583c5b);if(_[_0xa11d('0x23')](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2b')])){channels[_0x583c5b['uniqueid']][_0xa11d('0x2b')]=_0x583c5b[_0xa11d('0x2c')]+'\x20<'+_0x583c5b[_0xa11d('0xf')]+'>';}utils[_0xa11d('0x7')](util['format'](_0xa11d('0x2d'),_0x583c5b['uniqueid'],channels[_0x583c5b[_0xa11d('0xa')]]['callerid'],_0x583c5b[_0xa11d('0x2e')]));channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')]=utils[_0xa11d('0x1c')]();channels[_0x583c5b[_0xa11d('0xa')]]['duration']=utils[_0xa11d('0x30')](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')],channels[_0x583c5b['uniqueid']][_0xa11d('0x31')]);channels[_0x583c5b[_0xa11d('0xa')]]['billableseconds']=channels[_0x583c5b[_0xa11d('0xa')]]['answertime']?utils['diffTime'](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')],channels[_0x583c5b['uniqueid']][_0xa11d('0x28')]):0x0;writeDB(channels[_0x583c5b[_0xa11d('0xa')]]);}}catch(_0x1b14f7){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x32'),_0x583c5b[_0xa11d('0xa')]),_0x1b14f7);}};exports[_0xa11d('0x33')]=function(_0x4df244){try{if(!_['isNil'](channels[_0x4df244['localtwolinkedid']])){utils['debug'](util['format'](_0xa11d('0x34'),_0x4df244[_0xa11d('0x35')]),_0x4df244);if(channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0xb')]==_0x4df244[_0xa11d('0x37')]){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x38'),_0x4df244['origtransfereruniqueid'],_0x4df244[_0xa11d('0x36')],_0x4df244[_0xa11d('0x39')]));channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x27')]=_0x4df244['secondtransfererchannel'];channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x3a')]=_0xa11d('0x3b');}else if(channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0xb')]=_0x4df244[_0xa11d('0x3c')]){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x38'),_0x4df244[_0xa11d('0x35')],_0x4df244[_0xa11d('0x36')],_0x4df244[_0xa11d('0x3d')]));channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x27')]=_0x4df244[_0xa11d('0x3d')];channels[_0x4df244[_0xa11d('0x36')]]['userfield']='_attended';}}}catch(_0x2dda6c){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x34'),_0x4df244['origtransfereruniqueid']),_0x2dda6c);}};exports['musiconholdstart']=function(_0x32e226){try{if(!_[_0xa11d('0x23')](channels[_0x32e226['uniqueid']])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x3e'),_0x32e226[_0xa11d('0xa')]),_0x32e226);channels[_0x32e226[_0xa11d('0xa')]][_0xa11d('0x3f')]=utils[_0xa11d('0x1c')]();utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x32e226['uniqueid'],channels[_0x32e226[_0xa11d('0xa')]][_0xa11d('0x3f')]));}}catch(_0x2c7f79){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x3e'),_0x32e226[_0xa11d('0xa')]),_0x2c7f79);}};exports[_0xa11d('0x40')]=function(_0x495e4b){try{if(!_['isNil'](channels[_0x495e4b['uniqueid']])){utils[_0xa11d('0x16')](util['format']('[%s][calls][musiconholdstop]',_0x495e4b[_0xa11d('0xa')]),_0x495e4b);if(!_[_0xa11d('0x23')](channels[_0x495e4b[_0xa11d('0xa')]]['musiconholdstartAt'])){channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x41')]+=utils[_0xa11d('0x30')](utils[_0xa11d('0x1c')](),channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x3f')]);utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x42'),_0x495e4b[_0xa11d('0xa')],channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x41')]));delete channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x3f')];}}}catch(_0x202719){utils['error'](util[_0xa11d('0x8')]('[%s][calls][musiconholdstop]',_0x495e4b[_0xa11d('0xa')]),_0x202719);}};exports[_0xa11d('0x43')]=function(_0x1fcabb){try{if(!_[_0xa11d('0x23')](channels[_0x1fcabb[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x44'),_0x1fcabb[_0xa11d('0xa')]),_0x1fcabb);if(!_['isNil'](_0x1fcabb[_0xa11d('0x45')]['xmd-originatecalleridnum'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x46'),_0x1fcabb['uniqueid'],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['source']=_0x1fcabb[_0xa11d('0x47')];}if(!_[_0xa11d('0x23')](_0x1fcabb['variable']['xmd-phone'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x48')]=_0x1fcabb['value'];channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x2b')]='\x22'+_0x1fcabb['value']+_0xa11d('0x49')+_0x1fcabb[_0xa11d('0x47')]+'>';}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4a')])||!_[_0xa11d('0x23')](_0x1fcabb['variable'][_0xa11d('0x4b')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x4c'),_0x1fcabb['uniqueid'],!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4a')])?_0xa11d('0x4a'):_0xa11d('0x4b'),_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['callerid']=_0x1fcabb[_0xa11d('0x47')];}if(!_['isNil'](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4d')])||!_[_0xa11d('0x23')](_0x1fcabb['variable']['xmcs-queue'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x4c'),_0x1fcabb[_0xa11d('0xa')],!_['isNil'](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4d')])?_0xa11d('0x4d'):_0xa11d('0x4e'),_0x1fcabb['value']));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x4f')]=_0xa11d('0x50');channels[_0x1fcabb['uniqueid']][_0xa11d('0x51')]=_0x1fcabb[_0xa11d('0x47')];channels[_0x1fcabb['uniqueid']][_0xa11d('0xc')]=!![];}if(!_['isNil'](_0x1fcabb['variable'][_0xa11d('0x52')])){utils['info'](util[_0xa11d('0x8')](_0xa11d('0x53'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['ContactId']=_0x1fcabb[_0xa11d('0x47')];}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')]['xmd-cdrtype'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x54'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['type']=_0x1fcabb['value'];}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x55')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x56'),_0x1fcabb['uniqueid'],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb['uniqueid']][_0xa11d('0x57')]=_0x1fcabb['value'];}if(!_[_0xa11d('0x23')](_0x1fcabb['variable'][_0xa11d('0x58')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x59'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb['value']));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x58')]=_0x1fcabb['value'];}}}catch(_0x3c8166){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x44'),_0x1fcabb[_0xa11d('0xa')]),_0x3c8166);}};exports[_0xa11d('0x5a')]=function(_0x255dca){try{if(!_[_0xa11d('0x23')](channels[_0x255dca[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util['format'](_0xa11d('0x5b'),_0x255dca[_0xa11d('0xa')]),_0x255dca);utils[_0xa11d('0x7')](util['format'](_0xa11d('0x5c'),_0x255dca[_0xa11d('0xa')],_0x255dca['application'],_0x255dca[_0xa11d('0x5d')]));if(_0x255dca[_0xa11d('0x5e')][_0xa11d('0x5f')]()==_0xa11d('0x60')&&_[_0xa11d('0x61')](_0x255dca[_0xa11d('0x5d')][_0xa11d('0x5f')](),'cdr')){var _0x450f6c=_0x255dca[_0xa11d('0x5d')][_0xa11d('0x62')]('=');var _0x2deb33=_0x450f6c[0x0][_0xa11d('0x63')](_0x450f6c[0x0][_0xa11d('0x64')]('(')+0x1,_0x450f6c[0x0]['lastIndexOf'](')'));var _0x59db9b=_0x450f6c[0x1];channels[_0x255dca['uniqueid']][_0x2deb33]=_0x59db9b;}if(!_['includes']([_0xa11d('0x2a'),_0xa11d('0x65'),'execif','set','gotoif'],_0x255dca[_0xa11d('0x5e')][_0xa11d('0x5f')]())){channels[_0x255dca[_0xa11d('0xa')]][_0xa11d('0x4f')]=_0x255dca[_0xa11d('0x5e')];channels[_0x255dca[_0xa11d('0xa')]][_0xa11d('0x51')]=_0x255dca[_0xa11d('0x5d')];}}}catch(_0x18ee9e){utils[_0xa11d('0x1e')](util['format'](_0xa11d('0x5b'),_0x255dca['uniqueid']),_0x18ee9e);}}; \ No newline at end of file +var _0xc2b6=['xmd-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','hangup','execif','gotoif','lastdata','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','callerid','calleridname','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s'];(function(_0x580dc9,_0x44819f){var _0x199170=function(_0x35072b){while(--_0x35072b){_0x580dc9['push'](_0x580dc9['shift']());}};_0x199170(++_0x44819f);}(_0xc2b6,0x8d));var _0x6c2b=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xc2b6[_0x1b3564];return _0x504069;};'use strict';var _=require('lodash');var util=require(_0x6c2b('0x0'));var utils=require(_0x6c2b('0x1'));var dispositions=[_0x6c2b('0x2'),_0x6c2b('0x3'),_0x6c2b('0x3'),'NO\x20ANSWER',_0x6c2b('0x2'),_0x6c2b('0x2'),_0x6c2b('0x4'),_0x6c2b('0x5'),'FAILED',_0x6c2b('0x3'),_0x6c2b('0x3')];var channels={};function writeDB(_0x11f2c5){utils['info'](util[_0x6c2b('0x6')](_0x6c2b('0x7'),_0x11f2c5['uniqueid'],_0x11f2c5['channel'],_0x11f2c5[_0x6c2b('0x8')],_0x11f2c5['membername'],_0x11f2c5['interface'],_0x11f2c5[_0x6c2b('0x9')],_0x11f2c5[_0x6c2b('0xa')],_0x11f2c5[_0x6c2b('0xb')]));if(_0x11f2c5['accountcode']){utils[_0x6c2b('0xc')](_0x11f2c5[_0x6c2b('0xd')])[_0x6c2b('0xe')](function(_0x1b8d60){if(_0x1b8d60){_0x11f2c5['UserId']=_0x1b8d60['id'];}utils[_0x6c2b('0xf')](_0x6c2b('0x10'),_0x11f2c5);});}else{utils[_0x6c2b('0xf')](_0x6c2b('0x10'),_0x11f2c5);}if(channels[_0x11f2c5[_0x6c2b('0x11')]]){delete channels[_0x11f2c5['uniqueid']];}}exports[_0x6c2b('0x12')]=function(_0x5494a8){try{utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')](_0x6c2b('0x14'),_0x5494a8[_0x6c2b('0x11')]),_0x5494a8);if(_0x5494a8[_0x6c2b('0x11')]==_0x5494a8['linkedid']&&_0x5494a8[_0x6c2b('0x15')]!=_0x6c2b('0x16')){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x18'),_0x5494a8[_0x6c2b('0x11')],_0x5494a8[_0x6c2b('0x19')],_0x5494a8[_0x6c2b('0x1a')]));channels[_0x5494a8['uniqueid']]={'uniqueid':_0x5494a8[_0x6c2b('0x11')],'accountcode':_0x5494a8[_0x6c2b('0xd')],'source':_0x5494a8[_0x6c2b('0x9')],'destination':_0x5494a8[_0x6c2b('0x1a')],'destinationcontext':_0x5494a8[_0x6c2b('0x19')],'channel':_0x5494a8[_0x6c2b('0x15')],'starttime':utils[_0x6c2b('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x6c2b('0x1c')};}}catch(_0xd73c3f){utils[_0x6c2b('0x1d')](util[_0x6c2b('0x6')]('[%s][calls][newchannel]',_0x5494a8['uniqueid']),_0xd73c3f);}};exports[_0x6c2b('0x1e')]=function(_0x5af348){try{utils[_0x6c2b('0x13')](util['format']('[%s][calls][newstate]',_0x5af348[_0x6c2b('0x11')]),_0x5af348);if(!_[_0x6c2b('0x1f')](channels[_0x5af348[_0x6c2b('0x11')]])&&_0x5af348[_0x6c2b('0x20')]==0x6){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x21'),_0x5af348[_0x6c2b('0x11')],_0x5af348[_0x6c2b('0x19')],_0x5af348[_0x6c2b('0x15')]));if(_[_0x6c2b('0x1f')](channels[_0x5af348[_0x6c2b('0x11')]]['systemanswertime'])){channels[_0x5af348[_0x6c2b('0x11')]][_0x6c2b('0x22')]=utils[_0x6c2b('0x1b')]();}}else if(!_[_0x6c2b('0x1f')](channels[_0x5af348[_0x6c2b('0x23')]])&&_0x5af348[_0x6c2b('0x20')]==0x6&&_0x5af348['context']!=_0x6c2b('0x24')){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x25'),_0x5af348[_0x6c2b('0x11')],_0x5af348[_0x6c2b('0x23')],_0x5af348[_0x6c2b('0x19')],_0x5af348['channel']));channels[_0x5af348[_0x6c2b('0x23')]][_0x6c2b('0xd')]=_0x5af348[_0x6c2b('0xd')];channels[_0x5af348[_0x6c2b('0x23')]]['destinationchannel']=_0x5af348[_0x6c2b('0x15')];if(_[_0x6c2b('0x1f')](channels[_0x5af348[_0x6c2b('0x23')]][_0x6c2b('0x26')])){channels[_0x5af348['linkedid']][_0x6c2b('0x26')]=utils['now']();}channels[_0x5af348[_0x6c2b('0x23')]][_0x6c2b('0x27')]=dispositions[_[_0x6c2b('0x28')](_0x5af348[_0x6c2b('0x20')])]||_0x6c2b('0x4');}}catch(_0x25de99){utils[_0x6c2b('0x1d')](util[_0x6c2b('0x6')](_0x6c2b('0x29'),_0x5af348[_0x6c2b('0x11')]),_0x25de99);}};exports['hangup']=function(_0x4f89c6){try{if(!_[_0x6c2b('0x1f')](channels[_0x4f89c6['uniqueid']])){utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')]('[%s][calls][hangup]',_0x4f89c6['uniqueid']),_0x4f89c6);if(_[_0x6c2b('0x1f')](channels[_0x4f89c6['uniqueid']][_0x6c2b('0x2a')])){channels[_0x4f89c6[_0x6c2b('0x11')]]['callerid']=_0x4f89c6[_0x6c2b('0x2b')]+'\x20<'+_0x4f89c6['calleridnum']+'>';}utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4f89c6[_0x6c2b('0x11')],channels[_0x4f89c6[_0x6c2b('0x11')]][_0x6c2b('0x2a')],_0x4f89c6[_0x6c2b('0x2c')]));channels[_0x4f89c6[_0x6c2b('0x11')]][_0x6c2b('0x2d')]=utils[_0x6c2b('0x1b')]();channels[_0x4f89c6[_0x6c2b('0x11')]]['duration']=utils[_0x6c2b('0x2e')](channels[_0x4f89c6[_0x6c2b('0x11')]][_0x6c2b('0x2d')],channels[_0x4f89c6['uniqueid']][_0x6c2b('0x2f')]);channels[_0x4f89c6[_0x6c2b('0x11')]][_0x6c2b('0x30')]=channels[_0x4f89c6['uniqueid']][_0x6c2b('0x26')]?utils[_0x6c2b('0x2e')](channels[_0x4f89c6[_0x6c2b('0x11')]][_0x6c2b('0x2d')],channels[_0x4f89c6[_0x6c2b('0x11')]]['answertime']):0x0;writeDB(channels[_0x4f89c6[_0x6c2b('0x11')]]);}}catch(_0x1bcfdf){utils[_0x6c2b('0x1d')](util['format'](_0x6c2b('0x31'),_0x4f89c6['uniqueid']),_0x1bcfdf);}};exports[_0x6c2b('0x32')]=function(_0x1b2811){try{if(!_[_0x6c2b('0x1f')](channels[_0x1b2811[_0x6c2b('0x33')]])){utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')](_0x6c2b('0x34'),_0x1b2811[_0x6c2b('0x35')]),_0x1b2811);if(channels[_0x1b2811[_0x6c2b('0x33')]]['channel']==_0x1b2811[_0x6c2b('0x36')]){utils['info'](util[_0x6c2b('0x6')](_0x6c2b('0x37'),_0x1b2811['origtransfereruniqueid'],_0x1b2811[_0x6c2b('0x33')],_0x1b2811[_0x6c2b('0x38')]));channels[_0x1b2811['localtwolinkedid']]['destinationchannel']=_0x1b2811[_0x6c2b('0x38')];channels[_0x1b2811[_0x6c2b('0x33')]][_0x6c2b('0x39')]=_0x6c2b('0x3a');}else if(channels[_0x1b2811['localtwolinkedid']][_0x6c2b('0x15')]=_0x1b2811[_0x6c2b('0x3b')]){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x37'),_0x1b2811[_0x6c2b('0x35')],_0x1b2811['localtwolinkedid'],_0x1b2811[_0x6c2b('0x3c')]));channels[_0x1b2811[_0x6c2b('0x33')]][_0x6c2b('0x3d')]=_0x1b2811[_0x6c2b('0x3c')];channels[_0x1b2811[_0x6c2b('0x33')]]['userfield']=_0x6c2b('0x3a');}}}catch(_0x43f499){utils['error'](util['format'](_0x6c2b('0x34'),_0x1b2811[_0x6c2b('0x35')]),_0x43f499);}};exports['musiconholdstart']=function(_0x27c577){try{if(!_[_0x6c2b('0x1f')](channels[_0x27c577[_0x6c2b('0x11')]])){utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')](_0x6c2b('0x3e'),_0x27c577[_0x6c2b('0x11')]),_0x27c577);channels[_0x27c577[_0x6c2b('0x11')]]['musiconholdstartAt']=utils[_0x6c2b('0x1b')]();utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x3f'),_0x27c577['uniqueid'],channels[_0x27c577[_0x6c2b('0x11')]][_0x6c2b('0x40')]));}}catch(_0x25be6f){utils[_0x6c2b('0x1d')](util['format'](_0x6c2b('0x3e'),_0x27c577[_0x6c2b('0x11')]),_0x25be6f);}};exports[_0x6c2b('0x41')]=function(_0xb0f8db){try{if(!_[_0x6c2b('0x1f')](channels[_0xb0f8db[_0x6c2b('0x11')]])){utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')](_0x6c2b('0x42'),_0xb0f8db[_0x6c2b('0x11')]),_0xb0f8db);if(!_[_0x6c2b('0x1f')](channels[_0xb0f8db[_0x6c2b('0x11')]][_0x6c2b('0x40')])){channels[_0xb0f8db[_0x6c2b('0x11')]][_0x6c2b('0x43')]+=utils[_0x6c2b('0x2e')](utils[_0x6c2b('0x1b')](),channels[_0xb0f8db[_0x6c2b('0x11')]][_0x6c2b('0x40')]);utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x44'),_0xb0f8db['uniqueid'],channels[_0xb0f8db[_0x6c2b('0x11')]]['mohtime']));delete channels[_0xb0f8db[_0x6c2b('0x11')]][_0x6c2b('0x40')];}}}catch(_0x5eda1b){utils[_0x6c2b('0x1d')](util['format'](_0x6c2b('0x42'),_0xb0f8db[_0x6c2b('0x11')]),_0x5eda1b);}};exports[_0x6c2b('0x45')]=function(_0x382806){try{if(!_[_0x6c2b('0x1f')](channels[_0x382806[_0x6c2b('0x11')]])){utils[_0x6c2b('0x13')](util['format'](_0x6c2b('0x46'),_0x382806[_0x6c2b('0x11')]),_0x382806);if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x48')])){utils[_0x6c2b('0x17')](util['format'](_0x6c2b('0x49'),_0x382806[_0x6c2b('0x11')],_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]]['source']=_0x382806['value'];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x4b')])){utils['info'](util['format'](_0x6c2b('0x4c'),_0x382806[_0x6c2b('0x11')],_0x382806['value']));channels[_0x382806[_0x6c2b('0x11')]]['destination']=_0x382806['value'];channels[_0x382806['uniqueid']][_0x6c2b('0x2a')]='\x22'+_0x382806[_0x6c2b('0x4a')]+_0x6c2b('0x4d')+_0x382806[_0x6c2b('0x4a')]+'>';}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x4e')])||!_['isNil'](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x4f')])){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x50'),_0x382806[_0x6c2b('0x11')],!_['isNil'](_0x382806[_0x6c2b('0x47')]['xmd-callerid-preview'])?_0x6c2b('0x4e'):_0x6c2b('0x4f'),_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x2a')]=_0x382806['value'];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x51')])||!_[_0x6c2b('0x1f')](_0x382806['variable']['xmcs-queue'])){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x50'),_0x382806['uniqueid'],!_[_0x6c2b('0x1f')](_0x382806['variable']['xmd-queue'])?_0x6c2b('0x51'):'xmcs-queue',_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x52')]=_0x6c2b('0x53');channels[_0x382806['uniqueid']]['lastdata']=_0x382806[_0x6c2b('0x4a')];channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x8')]=!![];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x54')])){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x55'),_0x382806[_0x6c2b('0x11')],_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x56')]=_0x382806['value'];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x57')])){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')](_0x6c2b('0x58'),_0x382806['uniqueid'],_0x382806['value']));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x59')]=_0x382806[_0x6c2b('0x4a')];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')][_0x6c2b('0x5a')])){utils[_0x6c2b('0x17')](util[_0x6c2b('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x382806[_0x6c2b('0x11')],_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x5b')]=_0x382806[_0x6c2b('0x4a')];}if(!_[_0x6c2b('0x1f')](_0x382806[_0x6c2b('0x47')]['sipcallid'])){utils[_0x6c2b('0x17')](util['format'](_0x6c2b('0x5c'),_0x382806[_0x6c2b('0x11')],_0x382806[_0x6c2b('0x4a')]));channels[_0x382806[_0x6c2b('0x11')]][_0x6c2b('0x5d')]=_0x382806['value'];}}}catch(_0x5b83f0){utils[_0x6c2b('0x1d')](util[_0x6c2b('0x6')](_0x6c2b('0x46'),_0x382806[_0x6c2b('0x11')]),_0x5b83f0);}};exports[_0x6c2b('0x5e')]=function(_0x3a3975){try{if(!_[_0x6c2b('0x1f')](channels[_0x3a3975['uniqueid']])){utils[_0x6c2b('0x13')](util[_0x6c2b('0x6')](_0x6c2b('0x5f'),_0x3a3975[_0x6c2b('0x11')]),_0x3a3975);utils[_0x6c2b('0x17')](util['format'](_0x6c2b('0x60'),_0x3a3975[_0x6c2b('0x11')],_0x3a3975[_0x6c2b('0x61')],_0x3a3975['appdata']));if(_0x3a3975[_0x6c2b('0x61')][_0x6c2b('0x62')]()==_0x6c2b('0x63')&&_[_0x6c2b('0x64')](_0x3a3975['appdata'][_0x6c2b('0x62')](),_0x6c2b('0x65'))){var _0x371c5b=_0x3a3975[_0x6c2b('0x66')][_0x6c2b('0x67')]('=');var _0x4fdc79=_0x371c5b[0x0][_0x6c2b('0x68')](_0x371c5b[0x0][_0x6c2b('0x69')]('(')+0x1,_0x371c5b[0x0][_0x6c2b('0x69')](')'));var _0xa371b5=_0x371c5b[0x1];channels[_0x3a3975[_0x6c2b('0x11')]][_0x4fdc79]=_0xa371b5;}if(!_[_0x6c2b('0x6a')]([_0x6c2b('0x6b'),'noop',_0x6c2b('0x6c'),_0x6c2b('0x63'),_0x6c2b('0x6d')],_0x3a3975['application'][_0x6c2b('0x62')]())){channels[_0x3a3975['uniqueid']]['lastapplication']=_0x3a3975[_0x6c2b('0x61')];channels[_0x3a3975[_0x6c2b('0x11')]][_0x6c2b('0x6e')]=_0x3a3975['appdata'];}}}catch(_0xabb052){utils['error'](util[_0x6c2b('0x6')]('[%s][calls][newexten]',_0x3a3975[_0x6c2b('0x11')]),_0xabb052);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e8e1899..4746e1d 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 _0x649b=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','info','[core]\x20connected'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x649b,0x166));var _0xb649=function(_0x4020c3,_0x4314ee){_0x4020c3=_0x4020c3-0x0;var _0x11df1a=_0x649b[_0x4020c3];return _0x11df1a;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xb649('0x0')](_0xb649('0x1'));};exports['shutdown']=function(){utils['info'](_0xb649('0x2'));};exports['fullybooted']=function(){utils[_0xb649('0x0')](_0xb649('0x3'));};exports[_0xb649('0x4')]=function(_0x4b30c5){utils[_0xb649('0x4')](_0xb649('0x5'),_0x4b30c5);};exports[_0xb649('0x6')]=function(){utils['info']('[core]\x20close');};exports[_0xb649('0x7')]=function(_0x4c5c97){}; \ No newline at end of file +var _0x481d=['error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20shutdown'];(function(_0x2ec5b9,_0x56e0a3){var _0x10dcea=function(_0x1d403d){while(--_0x1d403d){_0x2ec5b9['push'](_0x2ec5b9['shift']());}};_0x10dcea(++_0x56e0a3);}(_0x481d,0x9c));var _0xd481=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x481d[_0x3712e2];return _0x1faff4;};'use strict';var utils=require(_0xd481('0x0'));exports[_0xd481('0x1')]=function(){utils[_0xd481('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0xd481('0x3'));};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x902df2){utils[_0xd481('0x4')](_0xd481('0x5'),_0x902df2);};exports[_0xd481('0x6')]=function(){utils['info']('[core]\x20close');};exports[_0xd481('0x7')]=function(_0x46e782){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a161bb9..47083e3 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 _0x94f0=['[%s][dials][dialbegin]','starttime','now','called','dialend','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','format','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin'];(function(_0x176a61,_0x451421){var _0xa3aedd=function(_0x5d26ab){while(--_0x5d26ab){_0x176a61['push'](_0x176a61['shift']());}};_0xa3aedd(++_0x451421);}(_0x94f0,0xae));var _0x094f=function(_0x47b99a,_0x5719f9){_0x47b99a=_0x47b99a-0x0;var _0x47aa79=_0x94f0[_0x47b99a];return _0x47aa79;};'use strict';var _=require(_0x094f('0x0'));var util=require(_0x094f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x37d26e){utils[_0x094f('0x2')](util['format'](_0x094f('0x3'),_0x37d26e['uniqueid'],_0x37d26e[_0x094f('0x4')],_0x37d26e['dialstring'],_0x37d26e[_0x094f('0x5')],_0x37d26e['connectedlinenum'],_0x37d26e[_0x094f('0x6')]));utils[_0x094f('0x7')](_0x094f('0x8'),_0x37d26e);delete dials[_0x37d26e[_0x094f('0x9')]];}exports[_0x094f('0xa')]=function(_0x56af58){try{utils[_0x094f('0xb')](util['format']('[%s][dials][newexten]',_0x56af58[_0x094f('0x9')]),_0x56af58);utils[_0x094f('0x2')](util['format'](_0x094f('0xc'),_0x56af58[_0x094f('0x9')],_0x56af58[_0x094f('0xd')],_0x56af58[_0x094f('0xe')]));if(_0x56af58[_0x094f('0xd')][_0x094f('0xf')]()==_0x094f('0x10')&&_[_0x094f('0x11')](_0x56af58[_0x094f('0xe')][_0x094f('0xf')](),'cdr(routeid)')){var _0x444bbb=_0x56af58['appdata'][_0x094f('0x12')]('=');dials[_0x56af58[_0x094f('0x9')]]={'routeId':_0x444bbb[0x1]};}}catch(_0x463327){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x15'),_0x56af58[_0x094f('0x9')]),_0x463327);}};exports[_0x094f('0x16')]=function(_0x16f660){try{utils[_0x094f('0xb')](util[_0x094f('0x14')](_0x094f('0x17'),_0x16f660[_0x094f('0x9')]),_0x16f660);if(!_[_0x094f('0x18')](_0x16f660[_0x094f('0x19')][_0x094f('0x1a')])){utils['info'](util[_0x094f('0x14')](_0x094f('0x1b'),_0x16f660[_0x094f('0x9')],_0x16f660[_0x094f('0x1c')]));dials[_0x16f660[_0x094f('0x9')]]={'routeId':_0x16f660[_0x094f('0x1c')]};}}catch(_0x4408ac){utils[_0x094f('0x13')](util['format'](_0x094f('0x17'),_0x16f660['uniqueid']),_0x4408ac);}};exports[_0x094f('0x1d')]=function(_0x4e7e2a){try{if(!_[_0x094f('0x18')](dials[_0x4e7e2a[_0x094f('0x9')]])){utils[_0x094f('0xb')](util['format'](_0x094f('0x1e'),_0x4e7e2a[_0x094f('0x9')]),_0x4e7e2a);dials[_0x4e7e2a[_0x094f('0x9')]]=_['assign'](dials[_0x4e7e2a['uniqueid']],_0x4e7e2a);dials[_0x4e7e2a[_0x094f('0x9')]][_0x094f('0x1f')]=utils[_0x094f('0x20')]();dials[_0x4e7e2a[_0x094f('0x9')]]['lastevent']=_0x094f('0x21');utils[_0x094f('0x2')](util[_0x094f('0x14')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4e7e2a[_0x094f('0x9')],dials[_0x4e7e2a[_0x094f('0x9')]][_0x094f('0x1f')]));}}catch(_0x4cc4f0){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x1e'),_0x4e7e2a[_0x094f('0x9')]),_0x4cc4f0);}};exports[_0x094f('0x22')]=function(_0x14d1e4){try{if(!_['isNil'](dials[_0x14d1e4['uniqueid']])){utils[_0x094f('0xb')](util[_0x094f('0x14')]('[%s][dials][dialend]',_0x14d1e4[_0x094f('0x9')]),_0x14d1e4);dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x6')]=_0x14d1e4['dialstatus'];if(_0x14d1e4[_0x094f('0x6')]==_0x094f('0x23')){dials[_0x14d1e4['uniqueid']]=_[_0x094f('0x24')](dials[_0x14d1e4[_0x094f('0x9')]],_0x14d1e4);dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x25')]=utils['now']();dials[_0x14d1e4[_0x094f('0x9')]]['lastevent']=_0x094f('0x26');utils[_0x094f('0x2')](util[_0x094f('0x14')](_0x094f('0x27'),_0x14d1e4[_0x094f('0x9')],_0x14d1e4[_0x094f('0x6')],dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x25')]));}else{utils['info'](util['format'](_0x094f('0x28'),_0x14d1e4[_0x094f('0x9')],_0x14d1e4[_0x094f('0x6')]));}}}catch(_0x13c468){utils['error'](util[_0x094f('0x14')]('[%s][dials][dialend]',_0x14d1e4['uniqueid']),_0x13c468);}};exports[_0x094f('0x29')]=function(_0x4db937){try{if(!_['isNil'](dials[_0x4db937[_0x094f('0x9')]])){utils['debug'](util[_0x094f('0x14')]('[%s][dials][hangup]',_0x4db937[_0x094f('0x9')]),_0x4db937);utils['info'](util[_0x094f('0x14')](_0x094f('0x2a'),_0x4db937[_0x094f('0x9')],_0x4db937[_0x094f('0x5')],_0x4db937[_0x094f('0x2b')],_0x4db937[_0x094f('0x2c')]));dials[_0x4db937['uniqueid']]=_[_0x094f('0x24')](dials[_0x4db937['uniqueid']],{'endtime':utils[_0x094f('0x20')](),'lastevent':_0x094f('0x2d')});dials[_0x4db937['uniqueid']][_0x094f('0x2e')]=utils[_0x094f('0x2f')](dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]]['starttime']);dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x31')]=utils[_0x094f('0x2f')](dials[_0x4db937['uniqueid']]['answertime']||dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x1f')]);dials[_0x4db937[_0x094f('0x9')]]['billableseconds']=dials[_0x4db937[_0x094f('0x9')]]['answertime']?utils[_0x094f('0x2f')](dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x25')]):0x0;writeDB(dials[_0x4db937['uniqueid']]);}}catch(_0x3c6d40){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x32'),_0x4db937[_0x094f('0x9')]),_0x3c6d40);}}; \ No newline at end of file +var _0xcd7e=['appdata','toLowerCase','startsWith','split','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','endtime','holdtime','diffTime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x1e0eee,_0x3f69a3){var _0x350a17=function(_0x33eeeb){while(--_0x33eeeb){_0x1e0eee['push'](_0x1e0eee['shift']());}};_0x350a17(++_0x3f69a3);}(_0xcd7e,0xed));var _0xecd7=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xcd7e[_0x5f746f];return _0x198d15;};'use strict';var _=require(_0xecd7('0x0'));var util=require(_0xecd7('0x1'));var utils=require(_0xecd7('0x2'));var dials={};function writeDB(_0x150b24){utils[_0xecd7('0x3')](util[_0xecd7('0x4')](_0xecd7('0x5'),_0x150b24['uniqueid'],_0x150b24[_0xecd7('0x6')],_0x150b24[_0xecd7('0x7')],_0x150b24[_0xecd7('0x8')],_0x150b24['connectedlinenum'],_0x150b24[_0xecd7('0x9')]));utils[_0xecd7('0xa')](_0xecd7('0xb'),_0x150b24);delete dials[_0x150b24[_0xecd7('0xc')]];}exports[_0xecd7('0xd')]=function(_0x39809f){try{utils[_0xecd7('0xe')](util[_0xecd7('0x4')](_0xecd7('0xf'),_0x39809f['uniqueid']),_0x39809f);utils['info'](util[_0xecd7('0x4')](_0xecd7('0x10'),_0x39809f['uniqueid'],_0x39809f[_0xecd7('0x11')],_0x39809f[_0xecd7('0x12')]));if(_0x39809f[_0xecd7('0x11')][_0xecd7('0x13')]()=='set'&&_[_0xecd7('0x14')](_0x39809f['appdata'][_0xecd7('0x13')](),'cdr(routeid)')){var _0x40076d=_0x39809f[_0xecd7('0x12')][_0xecd7('0x15')]('=');dials[_0x39809f['uniqueid']]={'routeId':_0x40076d[0x1]};}}catch(_0x2c0ca2){utils['error'](util[_0xecd7('0x4')](_0xecd7('0xf'),_0x39809f[_0xecd7('0xc')]),_0x2c0ca2);}};exports[_0xecd7('0x16')]=function(_0x3af705){try{utils[_0xecd7('0xe')](util[_0xecd7('0x4')]('[%s][dials][varset]',_0x3af705[_0xecd7('0xc')]),_0x3af705);if(!_[_0xecd7('0x17')](_0x3af705[_0xecd7('0x18')][_0xecd7('0x19')])){utils[_0xecd7('0x3')](util[_0xecd7('0x4')](_0xecd7('0x1a'),_0x3af705[_0xecd7('0xc')],_0x3af705[_0xecd7('0x1b')]));dials[_0x3af705[_0xecd7('0xc')]]={'routeId':_0x3af705[_0xecd7('0x1b')]};}}catch(_0x353b18){utils[_0xecd7('0x1c')](util[_0xecd7('0x4')](_0xecd7('0x1d'),_0x3af705[_0xecd7('0xc')]),_0x353b18);}};exports[_0xecd7('0x1e')]=function(_0x10515a){try{if(!_[_0xecd7('0x17')](dials[_0x10515a[_0xecd7('0xc')]])){utils[_0xecd7('0xe')](util[_0xecd7('0x4')]('[%s][dials][dialbegin]',_0x10515a[_0xecd7('0xc')]),_0x10515a);dials[_0x10515a[_0xecd7('0xc')]]=_[_0xecd7('0x1f')](dials[_0x10515a[_0xecd7('0xc')]],_0x10515a);dials[_0x10515a[_0xecd7('0xc')]][_0xecd7('0x20')]=utils[_0xecd7('0x21')]();dials[_0x10515a[_0xecd7('0xc')]][_0xecd7('0x22')]=_0xecd7('0x23');utils['info'](util[_0xecd7('0x4')](_0xecd7('0x24'),_0x10515a[_0xecd7('0xc')],dials[_0x10515a['uniqueid']][_0xecd7('0x20')]));}}catch(_0x2c4aa5){utils['error'](util['format']('[%s][dials][dialbegin]',_0x10515a[_0xecd7('0xc')]),_0x2c4aa5);}};exports[_0xecd7('0x25')]=function(_0x3827ad){try{if(!_[_0xecd7('0x17')](dials[_0x3827ad[_0xecd7('0xc')]])){utils['debug'](util['format'](_0xecd7('0x26'),_0x3827ad[_0xecd7('0xc')]),_0x3827ad);dials[_0x3827ad[_0xecd7('0xc')]]['dialstatus']=_0x3827ad[_0xecd7('0x9')];if(_0x3827ad[_0xecd7('0x9')]==_0xecd7('0x27')){dials[_0x3827ad['uniqueid']]=_[_0xecd7('0x1f')](dials[_0x3827ad[_0xecd7('0xc')]],_0x3827ad);dials[_0x3827ad[_0xecd7('0xc')]]['answertime']=utils['now']();dials[_0x3827ad[_0xecd7('0xc')]][_0xecd7('0x22')]=_0xecd7('0x28');utils['info'](util[_0xecd7('0x4')](_0xecd7('0x29'),_0x3827ad['uniqueid'],_0x3827ad[_0xecd7('0x9')],dials[_0x3827ad[_0xecd7('0xc')]][_0xecd7('0x2a')]));}else{utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x3827ad['uniqueid'],_0x3827ad['dialstatus']));}}}catch(_0x2db9a1){utils[_0xecd7('0x1c')](util['format']('[%s][dials][dialend]',_0x3827ad['uniqueid']),_0x2db9a1);}};exports[_0xecd7('0x2b')]=function(_0x16bbe4){try{if(!_[_0xecd7('0x17')](dials[_0x16bbe4[_0xecd7('0xc')]])){utils[_0xecd7('0xe')](util[_0xecd7('0x4')](_0xecd7('0x2c'),_0x16bbe4[_0xecd7('0xc')]),_0x16bbe4);utils['info'](util[_0xecd7('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x16bbe4['uniqueid'],_0x16bbe4[_0xecd7('0x8')],_0x16bbe4[_0xecd7('0x2d')],_0x16bbe4[_0xecd7('0x2e')]));dials[_0x16bbe4[_0xecd7('0xc')]]=_[_0xecd7('0x1f')](dials[_0x16bbe4[_0xecd7('0xc')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x2f')]=utils['diffTime'](dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x30')],dials[_0x16bbe4['uniqueid']][_0xecd7('0x20')]);dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x31')]=utils[_0xecd7('0x32')](dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x2a')]||dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x30')],dials[_0x16bbe4['uniqueid']][_0xecd7('0x20')]);dials[_0x16bbe4[_0xecd7('0xc')]]['billableseconds']=dials[_0x16bbe4['uniqueid']][_0xecd7('0x2a')]?utils[_0xecd7('0x32')](dials[_0x16bbe4[_0xecd7('0xc')]][_0xecd7('0x30')],dials[_0x16bbe4['uniqueid']]['answertime']):0x0;writeDB(dials[_0x16bbe4[_0xecd7('0xc')]]);}}catch(_0x55455b){utils[_0xecd7('0x1c')](util[_0xecd7('0x4')](_0xecd7('0x2c'),_0x16bbe4[_0xecd7('0xc')]),_0x55455b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1019f4e..fae647c 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 _0x7865=['uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','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','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','xdr','disabled','production','asterisk','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','format','device','debug'];(function(_0x2ea93c,_0x571de5){var _0xf0070f=function(_0x2bb51e){while(--_0x2bb51e){_0x2ea93c['push'](_0x2ea93c['shift']());}};_0xf0070f(++_0x571de5);}(_0x7865,0x166));var _0x5786=function(_0x1d1a87,_0x51d145){_0x1d1a87=_0x1d1a87-0x0;var _0x142f90=_0x7865[_0x1d1a87];return _0x142f90;};var AsteriskManager=require(_0x5786('0x0'));var config=require('../../config/environment');var utils=require(_0x5786('0x1'));var util=require('util');var isXDREnabled=config[_0x5786('0x2')]&&config[_0x5786('0x2')]['disabled']?!config[_0x5786('0x2')][_0x5786('0x3')]:!![];var isProduction=config['env']===_0x5786('0x4')||![];var isLocalAsterisk=config['xdr']&&config[_0x5786('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x5786('0x5')]['port'],config['asterisk']['ip'],config[_0x5786('0x5')]['username'],config[_0x5786('0x5')][_0x5786('0x6')],!![]);ami[_0x5786('0x7')]();if(!isXDREnabled){utils['info'](_0x5786('0x8'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5786('0x9')](_0x5786('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x5786('0xb'));var queues=require(_0x5786('0xc'));var recordings=require('./recordings.controller');var members=require(_0x5786('0xd'));var dials=require(_0x5786('0xe'));var transfers=require(_0x5786('0xf'));var core=require(_0x5786('0x10'));ami['on'](_0x5786('0x11'),core[_0x5786('0x11')]);ami['on'](_0x5786('0x12'),core[_0x5786('0x12')]);ami['on']('fullybooted',core[_0x5786('0x13')]);ami['on']('error',core[_0x5786('0x14')]);ami['on'](_0x5786('0x15'),core[_0x5786('0x15')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x5786('0x16'),function(_0x486d25){try{utils['debug'](util[_0x5786('0x17')]('[%s][index][devicestatechange]',_0x486d25[_0x5786('0x18')]),_0x486d25);members[_0x5786('0x16')](_0x486d25);}catch(_0x159812){utils[_0x5786('0x14')](util['format']('[%s][index][devicestatechange]',_0x486d25['device']),_0x159812);}});ami['on']('agentcalled',function(_0x423b7e){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][agentcalled]',_0x423b7e[_0x5786('0x1a')]),_0x423b7e);agents[_0x5786('0x1b')](_0x423b7e);}catch(_0x1f8a85){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][agentcalled]',_0x423b7e[_0x5786('0x1a')]),_0x1f8a85);}});ami['on'](_0x5786('0x1c'),function(_0x45e480){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x1d'),_0x45e480[_0x5786('0x1a')]),_0x45e480);agents[_0x5786('0x1c')](_0x45e480);}catch(_0x481001){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x1d'),_0x45e480[_0x5786('0x1a')]),_0x481001);}});ami['on'](_0x5786('0x1e'),function(_0x576b20){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x1f'),_0x576b20[_0x5786('0x1a')]),_0x576b20);agents['agentconnect'](_0x576b20);queues[_0x5786('0x1e')](_0x576b20);}catch(_0x53b0af){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x1f'),_0x576b20[_0x5786('0x1a')]),_0x53b0af);}});ami['on'](_0x5786('0x20'),function(_0x427ef6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x21'),_0x427ef6['uniqueid']),_0x427ef6);agents[_0x5786('0x20')](_0x427ef6);queues[_0x5786('0x20')](_0x427ef6);members[_0x5786('0x20')](_0x427ef6);}catch(_0x434e5d){utils[_0x5786('0x14')](util['format'](_0x5786('0x21'),_0x427ef6[_0x5786('0x1a')]),_0x434e5d);}});ami['on'](_0x5786('0x22'),function(_0x4db6f6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x23'),_0x4db6f6[_0x5786('0x1a')]),_0x4db6f6);agents[_0x5786('0x22')](_0x4db6f6);queues[_0x5786('0x22')](_0x4db6f6);}catch(_0x26c9ca){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x23'),_0x4db6f6[_0x5786('0x1a')]),_0x26c9ca);}});ami['on']('queuecallerjoin',function(_0x1cfaf2){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x1cfaf2[_0x5786('0x1a')]),_0x1cfaf2);queues[_0x5786('0x24')](_0x1cfaf2);recordings[_0x5786('0x24')](_0x1cfaf2);}catch(_0x3159fc){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][queuecallerjoin]',_0x1cfaf2[_0x5786('0x1a')]),_0x3159fc);}});ami['on'](_0x5786('0x25'),function(_0x737a7d){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x26'),_0x737a7d[_0x5786('0x1a')]),_0x737a7d);queues['queuecallerleave'](_0x737a7d);}catch(_0x4a509d){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x26'),_0x737a7d[_0x5786('0x1a')]),_0x4a509d);}});ami['on'](_0x5786('0x27'),function(_0xd103e6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x28'),_0xd103e6[_0x5786('0x1a')]),_0xd103e6);queues['musiconholdstart'](_0xd103e6);calls['musiconholdstart'](_0xd103e6);}catch(_0x247206){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][musiconholdstart]',_0xd103e6[_0x5786('0x1a')]),_0x247206);}});ami['on'](_0x5786('0x29'),function(_0x2edf92){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][musiconholdstop]',_0x2edf92[_0x5786('0x1a')]),_0x2edf92);queues[_0x5786('0x29')](_0x2edf92);calls[_0x5786('0x29')](_0x2edf92);}catch(_0x5bff20){utils[_0x5786('0x14')](util['format'](_0x5786('0x2a'),_0x2edf92[_0x5786('0x1a')]),_0x5bff20);}});ami['on'](_0x5786('0x2b'),function(_0x629f4){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x2c'),_0x629f4['uniqueid']),_0x629f4);calls[_0x5786('0x2b')](_0x629f4);recordings[_0x5786('0x2b')](_0x629f4);}catch(_0x7d7703){utils['error'](util[_0x5786('0x17')](_0x5786('0x2c'),_0x629f4[_0x5786('0x1a')]),_0x7d7703);}});ami['on'](_0x5786('0x2d'),function(_0x59ec38){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x2e'),_0x59ec38[_0x5786('0x1a')]),_0x59ec38);calls['hangup'](_0x59ec38);recordings[_0x5786('0x2d')](_0x59ec38);dials[_0x5786('0x2d')](_0x59ec38);agents[_0x5786('0x2d')](_0x59ec38);queues[_0x5786('0x2d')](_0x59ec38);}catch(_0x3af329){utils['error'](util[_0x5786('0x17')](_0x5786('0x2e'),_0x59ec38[_0x5786('0x1a')]),_0x3af329);}});ami['on'](_0x5786('0x2f'),function(_0x4e30c1){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x30'),_0x4e30c1['uniqueid']),_0x4e30c1);members[_0x5786('0x2f')](_0x4e30c1);}catch(_0x5df205){utils[_0x5786('0x14')](util['format'](_0x5786('0x30'),_0x4e30c1[_0x5786('0x1a')]),_0x5df205);}});ami['on'](_0x5786('0x31'),function(_0x4549a0){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x32'),_0x4549a0[_0x5786('0x1a')]),_0x4549a0);queues[_0x5786('0x31')](_0x4549a0);agents[_0x5786('0x31')](_0x4549a0);transfers['blindtransfer'](_0x4549a0);}catch(_0x3e8c7b){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x32'),_0x4549a0[_0x5786('0x1a')]),_0x3e8c7b);}});ami['on'](_0x5786('0x33'),function(_0x3ee999){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x34'),_0x3ee999['origtransfereruniqueid']),_0x3ee999);queues[_0x5786('0x33')](_0x3ee999);transfers[_0x5786('0x33')](_0x3ee999);agents[_0x5786('0x33')](_0x3ee999);calls[_0x5786('0x33')](_0x3ee999);}catch(_0x480664){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x34'),_0x3ee999[_0x5786('0x35')]),_0x480664);}});ami['on']('varset',function(_0x44c298){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x36'),_0x44c298[_0x5786('0x1a')]),_0x44c298);queues['varset'](_0x44c298);recordings[_0x5786('0x37')](_0x44c298);calls['varset'](_0x44c298);dials[_0x5786('0x37')](_0x44c298);}catch(_0x222415){utils[_0x5786('0x14')](util['format'](_0x5786('0x36'),_0x44c298['uniqueid']),_0x222415);}});ami['on'](_0x5786('0x38'),function(_0x202096){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x39'),_0x202096['uniqueid']),_0x202096);calls['newexten'](_0x202096);recordings[_0x5786('0x38')](_0x202096);dials[_0x5786('0x38')](_0x202096);}catch(_0x16ca57){utils['error'](util[_0x5786('0x17')](_0x5786('0x39'),_0x202096[_0x5786('0x1a')]),_0x16ca57);}});ami['on']('newchannel',function(_0x1ff690){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][newchannel]',_0x1ff690[_0x5786('0x1a')]),_0x1ff690);calls[_0x5786('0x3a')](_0x1ff690);recordings[_0x5786('0x3a')](_0x1ff690);}catch(_0x584c98){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x3b'),_0x1ff690[_0x5786('0x1a')]),_0x584c98);}});ami['on']('dialbegin',function(_0x349d29){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x3c'),_0x349d29[_0x5786('0x1a')]),_0x349d29);dials['dialbegin'](_0x349d29);}catch(_0x1cbd17){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x3d'),_0x349d29['uniqueid']),_0x1cbd17);}});ami['on'](_0x5786('0x3e'),function(_0x1966b5){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x3f'),_0x1966b5[_0x5786('0x1a')]),_0x1966b5);dials[_0x5786('0x3e')](_0x1966b5);}catch(_0x295ddd){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][dialend]',_0x1966b5[_0x5786('0x1a')]),_0x295ddd);}});} \ No newline at end of file +var _0x257f=['uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%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','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','../../config/environment','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]'];(function(_0x3114c2,_0x814d6d){var _0x2fb40a=function(_0x34feda){while(--_0x34feda){_0x3114c2['push'](_0x3114c2['shift']());}};_0x2fb40a(++_0x814d6d);}(_0x257f,0x1f2));var _0xf257=function(_0x25fe11,_0x487571){_0x25fe11=_0x25fe11-0x0;var _0x480f63=_0x257f[_0x25fe11];return _0x480f63;};var AsteriskManager=require('asterisk-manager');var config=require(_0xf257('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config['xdr']&&config[_0xf257('0x1')][_0xf257('0x2')]?!config[_0xf257('0x1')][_0xf257('0x2')]:!![];var isProduction=config[_0xf257('0x3')]===_0xf257('0x4')||![];var isLocalAsterisk=config[_0xf257('0x1')]&&config['xdr'][_0xf257('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xf257('0x6')][_0xf257('0x7')],config[_0xf257('0x6')]['ip'],config['asterisk']['username'],config[_0xf257('0x6')][_0xf257('0x8')],!![]);ami[_0xf257('0x9')]();if(!isXDREnabled){utils[_0xf257('0xa')](_0xf257('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xf257('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xf257('0xc'));var calls=require(_0xf257('0xd'));var queues=require(_0xf257('0xe'));var recordings=require(_0xf257('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xf257('0x10'));var core=require('./core.controller');ami['on'](_0xf257('0x11'),core[_0xf257('0x11')]);ami['on'](_0xf257('0x12'),core[_0xf257('0x12')]);ami['on'](_0xf257('0x13'),core[_0xf257('0x13')]);ami['on'](_0xf257('0x14'),core[_0xf257('0x14')]);ami['on'](_0xf257('0x15'),core[_0xf257('0x15')]);ami['on'](_0xf257('0x16'),core[_0xf257('0x16')]);ami['on']('devicestatechange',function(_0xe65695){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x19'),_0xe65695[_0xf257('0x1a')]),_0xe65695);members[_0xf257('0x1b')](_0xe65695);}catch(_0x16d818){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x19'),_0xe65695[_0xf257('0x1a')]),_0x16d818);}});ami['on'](_0xf257('0x1c'),function(_0x206bbb){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x1d'),_0x206bbb[_0xf257('0x1e')]),_0x206bbb);agents[_0xf257('0x1c')](_0x206bbb);}catch(_0x62936d){utils['error'](util['format'](_0xf257('0x1d'),_0x206bbb['uniqueid']),_0x62936d);}});ami['on'](_0xf257('0x1f'),function(_0x29f930){try{utils[_0xf257('0x17')](util[_0xf257('0x18')]('[%s][index][agentringnoanswer]',_0x29f930[_0xf257('0x1e')]),_0x29f930);agents[_0xf257('0x1f')](_0x29f930);}catch(_0x5e8b94){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x20'),_0x29f930[_0xf257('0x1e')]),_0x5e8b94);}});ami['on'](_0xf257('0x21'),function(_0x50dafa){try{utils[_0xf257('0x17')](util['format']('[%s][index][agentconnect]',_0x50dafa['uniqueid']),_0x50dafa);agents[_0xf257('0x21')](_0x50dafa);queues[_0xf257('0x21')](_0x50dafa);}catch(_0x3b8ede){utils[_0xf257('0x14')](util[_0xf257('0x18')]('[%s][index][agentconnect]',_0x50dafa['uniqueid']),_0x3b8ede);}});ami['on'](_0xf257('0x22'),function(_0x553e48){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x23'),_0x553e48[_0xf257('0x1e')]),_0x553e48);agents['agentcomplete'](_0x553e48);queues['agentcomplete'](_0x553e48);members[_0xf257('0x22')](_0x553e48);}catch(_0x3f5a2b){utils['error'](util[_0xf257('0x18')](_0xf257('0x23'),_0x553e48[_0xf257('0x1e')]),_0x3f5a2b);}});ami['on']('queuecallerabandon',function(_0x172508){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x24'),_0x172508[_0xf257('0x1e')]),_0x172508);agents['queuecallerabandon'](_0x172508);queues['queuecallerabandon'](_0x172508);}catch(_0x373be4){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x24'),_0x172508[_0xf257('0x1e')]),_0x373be4);}});ami['on']('queuecallerjoin',function(_0x257a71){try{utils[_0xf257('0x17')](util['format'](_0xf257('0x25'),_0x257a71[_0xf257('0x1e')]),_0x257a71);queues[_0xf257('0x26')](_0x257a71);recordings[_0xf257('0x26')](_0x257a71);}catch(_0x1b797b){utils[_0xf257('0x14')](util[_0xf257('0x18')]('[%s][index][queuecallerjoin]',_0x257a71[_0xf257('0x1e')]),_0x1b797b);}});ami['on'](_0xf257('0x27'),function(_0x13d71a){try{utils[_0xf257('0x17')](util[_0xf257('0x18')]('[%s][index][queuecallerleave]',_0x13d71a[_0xf257('0x1e')]),_0x13d71a);queues[_0xf257('0x27')](_0x13d71a);}catch(_0x2f8c65){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x28'),_0x13d71a[_0xf257('0x1e')]),_0x2f8c65);}});ami['on'](_0xf257('0x29'),function(_0x422f39){try{utils['debug'](util[_0xf257('0x18')](_0xf257('0x2a'),_0x422f39[_0xf257('0x1e')]),_0x422f39);queues[_0xf257('0x29')](_0x422f39);calls[_0xf257('0x29')](_0x422f39);}catch(_0x11890d){utils[_0xf257('0x14')](util['format']('[%s][index][musiconholdstart]',_0x422f39[_0xf257('0x1e')]),_0x11890d);}});ami['on'](_0xf257('0x2b'),function(_0x5df3cb){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x2c'),_0x5df3cb[_0xf257('0x1e')]),_0x5df3cb);queues[_0xf257('0x2b')](_0x5df3cb);calls[_0xf257('0x2b')](_0x5df3cb);}catch(_0x1a4e13){utils['error'](util['format'](_0xf257('0x2c'),_0x5df3cb['uniqueid']),_0x1a4e13);}});ami['on'](_0xf257('0x2d'),function(_0x122fc9){try{utils['debug'](util[_0xf257('0x18')](_0xf257('0x2e'),_0x122fc9[_0xf257('0x1e')]),_0x122fc9);calls[_0xf257('0x2d')](_0x122fc9);recordings[_0xf257('0x2d')](_0x122fc9);}catch(_0x323d46){utils[_0xf257('0x14')](util[_0xf257('0x18')]('[%s][index][newstate]',_0x122fc9[_0xf257('0x1e')]),_0x323d46);}});ami['on'](_0xf257('0x2f'),function(_0x4f1aca){try{utils[_0xf257('0x17')](util[_0xf257('0x18')]('[%s][index][hangup]',_0x4f1aca['uniqueid']),_0x4f1aca);calls[_0xf257('0x2f')](_0x4f1aca);recordings['hangup'](_0x4f1aca);dials['hangup'](_0x4f1aca);agents[_0xf257('0x2f')](_0x4f1aca);queues[_0xf257('0x2f')](_0x4f1aca);}catch(_0x33f983){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x30'),_0x4f1aca['uniqueid']),_0x33f983);}});ami['on'](_0xf257('0x31'),function(_0x94fe3b){try{utils[_0xf257('0x17')](util['format'](_0xf257('0x32'),_0x94fe3b[_0xf257('0x1e')]),_0x94fe3b);members[_0xf257('0x31')](_0x94fe3b);}catch(_0x4c2f31){utils['error'](util[_0xf257('0x18')](_0xf257('0x32'),_0x94fe3b[_0xf257('0x1e')]),_0x4c2f31);}});ami['on'](_0xf257('0x33'),function(_0x225688){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x34'),_0x225688[_0xf257('0x1e')]),_0x225688);queues[_0xf257('0x33')](_0x225688);agents['blindtransfer'](_0x225688);transfers['blindtransfer'](_0x225688);}catch(_0x47c04f){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x34'),_0x225688[_0xf257('0x1e')]),_0x47c04f);}});ami['on'](_0xf257('0x35'),function(_0x40b11e){try{utils['debug'](util[_0xf257('0x18')](_0xf257('0x36'),_0x40b11e[_0xf257('0x37')]),_0x40b11e);queues[_0xf257('0x35')](_0x40b11e);transfers[_0xf257('0x35')](_0x40b11e);agents['attendedtransfer'](_0x40b11e);calls[_0xf257('0x35')](_0x40b11e);}catch(_0x43cfea){utils['error'](util[_0xf257('0x18')](_0xf257('0x36'),_0x40b11e[_0xf257('0x37')]),_0x43cfea);}});ami['on']('varset',function(_0x425236){try{utils['debug'](util[_0xf257('0x18')]('[%s][index][varset]',_0x425236[_0xf257('0x1e')]),_0x425236);queues[_0xf257('0x38')](_0x425236);recordings[_0xf257('0x38')](_0x425236);calls[_0xf257('0x38')](_0x425236);dials['varset'](_0x425236);}catch(_0x49107e){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x39'),_0x425236[_0xf257('0x1e')]),_0x49107e);}});ami['on'](_0xf257('0x3a'),function(_0x4c7aa4){try{utils[_0xf257('0x17')](util[_0xf257('0x18')]('[%s][index][newexten]',_0x4c7aa4[_0xf257('0x1e')]),_0x4c7aa4);calls[_0xf257('0x3a')](_0x4c7aa4);recordings[_0xf257('0x3a')](_0x4c7aa4);dials['newexten'](_0x4c7aa4);}catch(_0x34de5b){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x3b'),_0x4c7aa4[_0xf257('0x1e')]),_0x34de5b);}});ami['on'](_0xf257('0x3c'),function(_0x2b09bc){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x3d'),_0x2b09bc['uniqueid']),_0x2b09bc);calls['newchannel'](_0x2b09bc);recordings[_0xf257('0x3c')](_0x2b09bc);}catch(_0x5240b3){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x3d'),_0x2b09bc['uniqueid']),_0x5240b3);}});ami['on']('dialbegin',function(_0x3f5b24){try{utils[_0xf257('0x17')](util[_0xf257('0x18')]('[%s][index][dialbegin]',_0x3f5b24['uniqueid']),_0x3f5b24);dials[_0xf257('0x3e')](_0x3f5b24);}catch(_0x2a63fa){utils[_0xf257('0x14')](util[_0xf257('0x18')](_0xf257('0x3f'),_0x3f5b24['uniqueid']),_0x2a63fa);}});ami['on']('dialend',function(_0x24c13c){try{utils[_0xf257('0x17')](util[_0xf257('0x18')](_0xf257('0x40'),_0x24c13c[_0xf257('0x1e')]),_0x24c13c);dials[_0xf257('0x41')](_0x24c13c);}catch(_0x4c710b){utils['error'](util[_0xf257('0x18')]('[%s][index][dialend]',_0x24c13c[_0xf257('0x1e')]),_0x4c710b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4ceaa66..f06d068 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 _0xe650=['./utils','Queue:','info','uniqueid','interface','channel','data2','membername','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','name','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','type','source','lodash','util'];(function(_0x6499bc,_0xf81042){var _0x39d373=function(_0xbf0d99){while(--_0xbf0d99){_0x6499bc['push'](_0x6499bc['shift']());}};_0x39d373(++_0xf81042);}(_0xe650,0xfd));var _0x0e65=function(_0x36e059,_0x19ee27){_0x36e059=_0x36e059-0x0;var _0x52ee13=_0xe650[_0x36e059];return _0x52ee13;};'use strict';var _=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var utils=require(_0x0e65('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x0e65('0x3')];function writeDB(_0xf80e84){utils[_0x0e65('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xf80e84[_0x0e65('0x5')],_0xf80e84[_0x0e65('0x6')],_0xf80e84[_0x0e65('0x7')],_0xf80e84[_0x0e65('0x8')],_0xf80e84[_0x0e65('0x9')],_0xf80e84['type']));if(_0xf80e84[_0x0e65('0x6')]){utils[_0x0e65('0xa')](_0xf80e84[_0x0e65('0x6')])[_0x0e65('0xb')](function(_0x10b833){if(_0x10b833){_0xf80e84['membername']=_0x10b833['name'];_0xf80e84[_0x0e65('0xc')]=_0x10b833[_0x0e65('0xc')];utils[_0x0e65('0xd')](_0x0e65('0xe'),_0xf80e84);}else{utils[_0x0e65('0xf')](_0xf80e84[_0x0e65('0x6')]['split']('/')[0x1])[_0x0e65('0xb')](function(_0x29b1fb){if(_0x29b1fb){_0xf80e84[_0x0e65('0x9')]=_0x29b1fb[_0x0e65('0x10')];_0xf80e84[_0x0e65('0xc')]=_0x29b1fb[_0x0e65('0xc')];utils[_0x0e65('0xd')](_0x0e65('0xe'),_0xf80e84);}});}})['catch'](function(_0x545844){utils[_0x0e65('0x11')](util[_0x0e65('0x12')](_0x0e65('0x13'),_0xf80e84[_0x0e65('0x5')]),_0x545844);});}delete members[_0xf80e84[_0x0e65('0x6')]];}function startsWith(_0x23e22b,_0x19d095){return _[_0x0e65('0x14')](_0x23e22b,function(_0x58dc35){return _[_0x0e65('0x15')](_0x19d095,_0x58dc35);});}exports[_0x0e65('0x16')]=function(_0x149688){try{utils[_0x0e65('0x17')](util[_0x0e65('0x12')](_0x0e65('0x18'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688['device']][_0x0e65('0x5')]:_0x149688[_0x0e65('0x19')]),_0x149688);utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x1a'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688['device']][_0x0e65('0x5')]:_0x149688[_0x0e65('0x19')],_0x149688[_0x0e65('0x1b')],_0x149688[_0x0e65('0x19')]));switch(_0x149688[_0x0e65('0x1b')]){case'INUSE':case _0x0e65('0x1c'):if(!startsWith(exclude,_0x149688['device'])){members[_0x149688['device']]={'channel':'voice','interface':_0x149688['device'],'type':_0x0e65('0x1d'),'enterAt':utils[_0x0e65('0x1e')](),'role':_0x0e65('0x1f')};}break;case _0x0e65('0x20'):if(!_[_0x0e65('0x21')](members[_0x149688[_0x0e65('0x19')]])){members[_0x149688[_0x0e65('0x19')]]['exitAt']=utils[_0x0e65('0x1e')]();members[_0x149688[_0x0e65('0x19')]][_0x0e65('0x22')]=utils[_0x0e65('0x23')](members[_0x149688['device']][_0x0e65('0x24')],members[_0x149688['device']][_0x0e65('0x25')]);if(members[_0x149688[_0x0e65('0x19')]][_0x0e65('0x5')]){writeDB(members[_0x149688[_0x0e65('0x19')]]);}}break;default:break;}}catch(_0xaa601){utils[_0x0e65('0x11')](util['format'](_0x0e65('0x18'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688[_0x0e65('0x19')]]['uniqueid']:_0x149688[_0x0e65('0x19')]),_0xaa601);}};exports['agentcomplete']=function(_0x3e4cdf){try{if(!_[_0x0e65('0x21')](members[_0x3e4cdf[_0x0e65('0x6')]])){utils['debug'](util[_0x0e65('0x12')](_0x0e65('0x26'),_0x3e4cdf[_0x0e65('0x5')]),_0x3e4cdf);utils['info'](util[_0x0e65('0x12')](_0x0e65('0x27'),_0x3e4cdf[_0x0e65('0x5')],_0x3e4cdf[_0x0e65('0x6')],_0x3e4cdf[_0x0e65('0x28')]));members[_0x3e4cdf[_0x0e65('0x6')]]=_[_0x0e65('0x29')](members[_0x3e4cdf['interface']],{'data4':_0x3e4cdf[_0x0e65('0x28')],'uniqueid':_0x3e4cdf[_0x0e65('0x5')]});}}catch(_0x6d53f2){utils['error'](util[_0x0e65('0x12')](_0x0e65('0x26'),_0x3e4cdf[_0x0e65('0x5')]),_0x6d53f2);}};exports[_0x0e65('0x2a')]=function(_0x28c725){try{utils[_0x0e65('0x17')](util[_0x0e65('0x12')]('[%s][members][cdr]',_0x28c725[_0x0e65('0x5')]),_0x28c725);if(_0x28c725[_0x0e65('0x7')]){var _0x10a93a=_0x28c725[_0x0e65('0x7')]['split']('-')[0x0];if(!_[_0x0e65('0x21')](members[_0x10a93a])){members[_0x10a93a]=_[_0x0e65('0x29')](members[_0x10a93a],{'data1':members[_0x10a93a][_0x0e65('0x2b')]||_0x28c725['type'],'data2':members[_0x10a93a][_0x0e65('0x8')]||_0x28c725['source'],'data3':members[_0x10a93a]['data3']||_0x28c725[_0x0e65('0x2c')],'uniqueid':members[_0x10a93a][_0x0e65('0x5')]||_0x28c725[_0x0e65('0x5')]});utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x2d'),_0x28c725[_0x0e65('0x5')],members[_0x10a93a][_0x0e65('0x2b')],members[_0x10a93a]['data2'],members[_0x10a93a][_0x0e65('0x2e')]));if(members[_0x10a93a]['exitAt']){writeDB(members[_0x10a93a]);}}}if(_0x28c725[_0x0e65('0x2f')]){var _0x55094c=_0x28c725[_0x0e65('0x2f')][_0x0e65('0x30')]('-')[0x0];if(!_[_0x0e65('0x21')](members[_0x55094c])){members[_0x55094c]=_[_0x0e65('0x29')](members[_0x55094c],{'data1':members[_0x55094c]['data1']||_0x28c725[_0x0e65('0x31')],'data2':members[_0x55094c]['data2']||_0x28c725[_0x0e65('0x32')],'data3':members[_0x55094c]['data3']||_0x28c725[_0x0e65('0x2c')],'uniqueid':members[_0x55094c][_0x0e65('0x5')]||_0x28c725[_0x0e65('0x5')]});utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x2d'),_0x28c725[_0x0e65('0x5')],members[_0x55094c][_0x0e65('0x2b')],members[_0x55094c][_0x0e65('0x8')],members[_0x55094c][_0x0e65('0x2e')]));if(members[_0x55094c][_0x0e65('0x24')]){writeDB(members[_0x55094c]);}}}}catch(_0x573728){utils[_0x0e65('0x11')](util[_0x0e65('0x12')]('[%s][members][cdr]',_0x28c725[_0x0e65('0x5')]),_0x573728);}}; \ No newline at end of file +var _0x6f75=['internal','CreateMemberReport','getUserByName','split','request','catch','error','uniqueid','some','startsWith','devicestatechange','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','getUserByInterface','then','name'];(function(_0x66af9c,_0x1bee73){var _0x4d720f=function(_0x42a071){while(--_0x42a071){_0x66af9c['push'](_0x66af9c['shift']());}};_0x4d720f(++_0x1bee73);}(_0x6f75,0x15a));var _0x56f7=function(_0x29b80a,_0x3e2126){_0x29b80a=_0x29b80a-0x0;var _0x468009=_0x6f75[_0x29b80a];return _0x468009;};'use strict';var _=require(_0x56f7('0x0'));var util=require('util');var utils=require(_0x56f7('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x56f7('0x2')];function writeDB(_0xe664a4){utils[_0x56f7('0x3')](util['format'](_0x56f7('0x4'),_0xe664a4['uniqueid'],_0xe664a4[_0x56f7('0x5')],_0xe664a4[_0x56f7('0x6')],_0xe664a4['data2'],_0xe664a4[_0x56f7('0x7')],_0xe664a4['type']));if(_0xe664a4[_0x56f7('0x5')]){utils[_0x56f7('0x8')](_0xe664a4[_0x56f7('0x5')])[_0x56f7('0x9')](function(_0x15ba28){if(_0x15ba28){_0xe664a4[_0x56f7('0x7')]=_0x15ba28[_0x56f7('0xa')];_0xe664a4[_0x56f7('0xb')]=_0x15ba28['internal'];utils['request'](_0x56f7('0xc'),_0xe664a4);}else{utils[_0x56f7('0xd')](_0xe664a4[_0x56f7('0x5')][_0x56f7('0xe')]('/')[0x1])['then'](function(_0x1b2c8c){if(_0x1b2c8c){_0xe664a4[_0x56f7('0x7')]=_0x1b2c8c[_0x56f7('0xa')];_0xe664a4[_0x56f7('0xb')]=_0x1b2c8c['internal'];utils[_0x56f7('0xf')](_0x56f7('0xc'),_0xe664a4);}});}})[_0x56f7('0x10')](function(_0x39e2d0){utils[_0x56f7('0x11')](util['format']('[%s][members][writeDB]',_0xe664a4[_0x56f7('0x12')]),_0x39e2d0);});}delete members[_0xe664a4[_0x56f7('0x5')]];}function startsWith(_0x8e4526,_0x3aa932){return _[_0x56f7('0x13')](_0x8e4526,function(_0x4f4e1d){return _[_0x56f7('0x14')](_0x3aa932,_0x4f4e1d);});}exports[_0x56f7('0x15')]=function(_0x44efd9){try{utils[_0x56f7('0x16')](util[_0x56f7('0x17')]('[%s][members][devicestatechange]',members[_0x44efd9['device']]?members[_0x44efd9[_0x56f7('0x18')]][_0x56f7('0x12')]:_0x44efd9[_0x56f7('0x18')]),_0x44efd9);utils['info'](util['format'](_0x56f7('0x19'),members[_0x44efd9['device']]?members[_0x44efd9['device']][_0x56f7('0x12')]:_0x44efd9[_0x56f7('0x18')],_0x44efd9[_0x56f7('0x1a')],_0x44efd9[_0x56f7('0x18')]));switch(_0x44efd9['state']){case'INUSE':case _0x56f7('0x1b'):if(!startsWith(exclude,_0x44efd9[_0x56f7('0x18')])){members[_0x44efd9[_0x56f7('0x18')]]={'channel':_0x56f7('0x1c'),'interface':_0x44efd9[_0x56f7('0x18')],'type':_0x56f7('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x56f7('0x1e'):if(!_[_0x56f7('0x1f')](members[_0x44efd9['device']])){members[_0x44efd9[_0x56f7('0x18')]][_0x56f7('0x20')]=utils[_0x56f7('0x21')]();members[_0x44efd9['device']][_0x56f7('0x22')]=utils[_0x56f7('0x23')](members[_0x44efd9[_0x56f7('0x18')]]['exitAt'],members[_0x44efd9[_0x56f7('0x18')]][_0x56f7('0x24')]);if(members[_0x44efd9[_0x56f7('0x18')]]['uniqueid']){writeDB(members[_0x44efd9[_0x56f7('0x18')]]);}}break;default:break;}}catch(_0x5f2ffb){utils[_0x56f7('0x11')](util[_0x56f7('0x17')](_0x56f7('0x25'),members[_0x44efd9[_0x56f7('0x18')]]?members[_0x44efd9[_0x56f7('0x18')]][_0x56f7('0x12')]:_0x44efd9[_0x56f7('0x18')]),_0x5f2ffb);}};exports[_0x56f7('0x26')]=function(_0x230af8){try{if(!_[_0x56f7('0x1f')](members[_0x230af8[_0x56f7('0x5')]])){utils[_0x56f7('0x16')](util[_0x56f7('0x17')]('[%s][members][agentcomplete]',_0x230af8['uniqueid']),_0x230af8);utils['info'](util[_0x56f7('0x17')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x230af8[_0x56f7('0x12')],_0x230af8['interface'],_0x230af8[_0x56f7('0x27')]));members[_0x230af8[_0x56f7('0x5')]]=_[_0x56f7('0x28')](members[_0x230af8['interface']],{'data4':_0x230af8[_0x56f7('0x27')],'uniqueid':_0x230af8[_0x56f7('0x12')]});}}catch(_0x571ea6){utils[_0x56f7('0x11')](util[_0x56f7('0x17')](_0x56f7('0x29'),_0x230af8[_0x56f7('0x12')]),_0x571ea6);}};exports[_0x56f7('0x2a')]=function(_0x4a7e99){try{utils[_0x56f7('0x16')](util[_0x56f7('0x17')](_0x56f7('0x2b'),_0x4a7e99['uniqueid']),_0x4a7e99);if(_0x4a7e99['channel']){var _0x226a62=_0x4a7e99[_0x56f7('0x6')][_0x56f7('0xe')]('-')[0x0];if(!_[_0x56f7('0x1f')](members[_0x226a62])){members[_0x226a62]=_['assign'](members[_0x226a62],{'data1':members[_0x226a62]['data1']||_0x4a7e99['type'],'data2':members[_0x226a62][_0x56f7('0x2c')]||_0x4a7e99[_0x56f7('0x2d')],'data3':members[_0x226a62][_0x56f7('0x2e')]||_0x4a7e99[_0x56f7('0x2f')],'uniqueid':members[_0x226a62]['uniqueid']||_0x4a7e99['uniqueid']});utils[_0x56f7('0x3')](util[_0x56f7('0x17')](_0x56f7('0x30'),_0x4a7e99[_0x56f7('0x12')],members[_0x226a62][_0x56f7('0x31')],members[_0x226a62][_0x56f7('0x2c')],members[_0x226a62]['data3']));if(members[_0x226a62][_0x56f7('0x20')]){writeDB(members[_0x226a62]);}}}if(_0x4a7e99[_0x56f7('0x32')]){var _0x3cc759=_0x4a7e99[_0x56f7('0x32')][_0x56f7('0xe')]('-')[0x0];if(!_[_0x56f7('0x1f')](members[_0x3cc759])){members[_0x3cc759]=_[_0x56f7('0x28')](members[_0x3cc759],{'data1':members[_0x3cc759][_0x56f7('0x31')]||_0x4a7e99['type'],'data2':members[_0x3cc759][_0x56f7('0x2c')]||_0x4a7e99[_0x56f7('0x2d')],'data3':members[_0x3cc759]['data3']||_0x4a7e99[_0x56f7('0x2f')],'uniqueid':members[_0x3cc759][_0x56f7('0x12')]||_0x4a7e99[_0x56f7('0x12')]});utils[_0x56f7('0x3')](util[_0x56f7('0x17')](_0x56f7('0x30'),_0x4a7e99[_0x56f7('0x12')],members[_0x3cc759]['data1'],members[_0x3cc759][_0x56f7('0x2c')],members[_0x3cc759][_0x56f7('0x2e')]));if(members[_0x3cc759][_0x56f7('0x20')]){writeDB(members[_0x3cc759]);}}}}catch(_0x52035f){utils['error'](util[_0x56f7('0x17')](_0x56f7('0x2b'),_0x4a7e99[_0x56f7('0x12')]),_0x52035f);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 21bd08e..259b575 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 _0xcc26=['queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','isNil','queuecallerabandonAt'];(function(_0x4b3cc3,_0x22bf1a){var _0x117aa1=function(_0x5b58c2){while(--_0x5b58c2){_0x4b3cc3['push'](_0x4b3cc3['shift']());}};_0x117aa1(++_0x22bf1a);}(_0xcc26,0x15d));var _0x6cc2=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xcc26[_0x546aaf];return _0x1cbf6d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6cc2('0x0'));var queues={};function writeDB(_0x15472a){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x3'),_0x15472a[_0x6cc2('0x4')],_0x15472a['channel'],_0x15472a[_0x6cc2('0x5')],_0x15472a['lastAssignedTo'],_0x15472a[_0x6cc2('0x6')],_0x15472a[_0x6cc2('0x7')],_0x15472a['queuecallerexitreason']));if(_0x15472a[_0x6cc2('0x5')]){utils[_0x6cc2('0x8')](_0x15472a[_0x6cc2('0x5')])['then'](function(_0x4772db){if(_0x4772db){_0x15472a[_0x6cc2('0x9')]=_0x4772db[_0x6cc2('0x9')];}utils[_0x6cc2('0xa')](_0x6cc2('0xb'),_0x15472a);});}else{utils[_0x6cc2('0xa')](_0x6cc2('0xb'),_0x15472a);}if(_0x15472a[_0x6cc2('0xc')]){delete queues[_0x15472a[_0x6cc2('0xc')]];}else{delete queues[_0x15472a[_0x6cc2('0x4')]];}}exports[_0x6cc2('0xd')]=function(_0x32635){try{utils[_0x6cc2('0xe')](util['format']('[%s][queues][queuecallerjoin]',_0x32635['uniqueid']),_0x32635);utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0xf'),_0x32635[_0x6cc2('0x4')],_0x32635[_0x6cc2('0x5')],_0x32635[_0x6cc2('0x10')]));queues[_0x32635[_0x6cc2('0x4')]]=_[_0x6cc2('0x11')](_0x32635,{'originalposition':_0x32635[_0x6cc2('0x10')],'queuecallerjoinAt':utils[_0x6cc2('0x12')](),'mohtime':0x0});}catch(_0x38ba8a){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][queuecallerjoin]',_0x32635[_0x6cc2('0x4')]),_0x38ba8a);}};exports[_0x6cc2('0x14')]=function(_0x5152b2){try{if(!_['isNil'](queues[_0x5152b2['uniqueid']])){utils['debug'](util['format'](_0x6cc2('0x15'),_0x5152b2[_0x6cc2('0x4')]),_0x5152b2);if(queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x16')]){if(!queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x17')]&&!queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x18')]){queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x19')]=!![];queues[_0x5152b2['uniqueid']][_0x6cc2('0x1a')]=utils['now']();queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]=_0x6cc2('0x1c');}utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x1d'),_0x5152b2[_0x6cc2('0x4')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x5152b2[_0x6cc2('0x4')]]);}else if(queues[_0x5152b2[_0x6cc2('0x4')]]['transfereduniqueid']){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5152b2[_0x6cc2('0x4')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x5152b2[_0x6cc2('0x4')]]['transfereduniqueid']));queues[queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0xc')]]=queues[_0x5152b2[_0x6cc2('0x4')]];queues[queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0xc')]][_0x6cc2('0x1f')]=0x2;delete queues[_0x5152b2['uniqueid']];}}}catch(_0x58a387){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][hangup]',_0x5152b2[_0x6cc2('0x4')]),_0x58a387);}};exports[_0x6cc2('0x20')]=function(_0x235b8c){try{utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x21'),_0x235b8c[_0x6cc2('0x4')]),_0x235b8c);if(!_['isNil'](_0x235b8c['variable'][_0x6cc2('0x22')])&&_0x235b8c[_0x6cc2('0x23')][_0x6cc2('0x24')]()!=='CONTINUE'){if(!_[_0x6cc2('0x25')](queues[_0x235b8c[_0x6cc2('0x4')]])){queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x26')]=null;queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x18')]=!![];queues[_0x235b8c['uniqueid']][_0x6cc2('0x27')]=utils[_0x6cc2('0x12')]();queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1b')]=_0x235b8c['value'][_0x6cc2('0x24')]();utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0x28'),_0x235b8c['uniqueid'],queues[_0x235b8c[_0x6cc2('0x4')]]['name'],_0x235b8c[_0x6cc2('0x23')],queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x235b8c[_0x6cc2('0x4')]]);}}else if(!_[_0x6cc2('0x25')](_0x235b8c['variable'][_0x6cc2('0x29')])){if(!_['isNil'](queues[_0x235b8c[_0x6cc2('0x4')]])&&!queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]){queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerabandonAt']=null;queues[_0x235b8c['uniqueid']][_0x6cc2('0x18')]=!![];queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x27')]=utils['now']();queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x2a'),_0x235b8c[_0x6cc2('0x4')],queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x235b8c[_0x6cc2('0x23')],queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerexitreason']));}}}catch(_0x24d2d6){utils['error'](util[_0x6cc2('0x2')](_0x6cc2('0x21'),_0x235b8c[_0x6cc2('0x4')]),_0x24d2d6);}};exports[_0x6cc2('0x17')]=function(_0x572af2){try{if(!_[_0x6cc2('0x25')](queues[_0x572af2[_0x6cc2('0x4')]])){utils['debug'](util[_0x6cc2('0x2')]('[%s][queues][queuecallerabandon]',_0x572af2['uniqueid']),_0x572af2);queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x27')]=null;queues[_0x572af2[_0x6cc2('0x4')]]['queuecallerabandon']=!![];queues[_0x572af2[_0x6cc2('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]='ABANDONED';utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0x2b'),_0x572af2[_0x6cc2('0x4')],queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));}}catch(_0x3c0f97){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][queuecallerabandon]',_0x572af2[_0x6cc2('0x4')]),_0x3c0f97);}};exports[_0x6cc2('0x2c')]=function(_0x8a56ba){try{if(!_[_0x6cc2('0x25')](queues[_0x8a56ba[_0x6cc2('0x4')]])){utils['debug'](util['format'](_0x6cc2('0x2d'),_0x8a56ba[_0x6cc2('0x4')]),_0x8a56ba);utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x2e'),_0x8a56ba['uniqueid'],queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x8a56ba['connectedlinenum'],_0x8a56ba[_0x6cc2('0x2f')]));queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x2c')]=!![];queues[_0x8a56ba['uniqueid']][_0x6cc2('0x16')]=utils[_0x6cc2('0x12')]();queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x30')]=utils[_0x6cc2('0x31')](queues[_0x8a56ba[_0x6cc2('0x4')]]['queuecallerleaveAt'],queues[_0x8a56ba['uniqueid']][_0x6cc2('0x32')]);queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x10')]=_0x8a56ba[_0x6cc2('0x10')];queues[_0x8a56ba['uniqueid']]['count']=_0x8a56ba['count'];queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x33')]=_0x8a56ba[_0x6cc2('0x33')];queues[_0x8a56ba[_0x6cc2('0x4')]]['connectedlinename']=_0x8a56ba['connectedlinename'];}}catch(_0x37e4b3){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x2d'),_0x8a56ba[_0x6cc2('0x4')]),_0x37e4b3);}};exports[_0x6cc2('0x34')]=function(_0x57d418){try{if(!_['isNil'](queues[_0x57d418[_0x6cc2('0x4')]])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x35'),_0x57d418[_0x6cc2('0x4')]),_0x57d418);utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x36'),_0x57d418[_0x6cc2('0x4')],queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x57d418[_0x6cc2('0x37')],_0x57d418[_0x6cc2('0x38')]));queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x26')]=null;queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x57d418['uniqueid']]['queuecallerexitreason']=null;queues[_0x57d418[_0x6cc2('0x4')]]['queuecallerexitAt']=null;queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x39')]=!![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x7')]=_0x57d418[_0x6cc2('0x38')];queues[_0x57d418['uniqueid']]['lastAssignedTo']=_0x57d418[_0x6cc2('0x37')];}}catch(_0xfc8277){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][agentconnect]',_0x57d418[_0x6cc2('0x4')]),_0xfc8277);}};exports['agentcomplete']=function(_0x2efe4a){try{if(!_[_0x6cc2('0x25')](queues[_0x2efe4a[_0x6cc2('0x4')]])){if(queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x16')]){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x3a'),_0x2efe4a[_0x6cc2('0x4')]),_0x2efe4a);queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x2efe4a[_0x6cc2('0x4')]]['queuecallerabandon']=![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x26')]=null;queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x27')]=null;queues[_0x2efe4a[_0x6cc2('0x4')]]['assigned']=!![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x3b')]=_0x2efe4a[_0x6cc2('0x37')];queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x19')]=!![];queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1a')]=utils['now']();if(_0x2efe4a[_0x6cc2('0x3c')]==_0x6cc2('0x3d')){if(!queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x3d')]){queues[_0x2efe4a[_0x6cc2('0x4')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x2efe4a['uniqueid']][_0x6cc2('0x1b')]='COMPLETEDBY'+_0x2efe4a[_0x6cc2('0x3c')]['toUpperCase']();}utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x3e'),_0x2efe4a[_0x6cc2('0x4')],queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x2efe4a['membername'],queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x2efe4a['uniqueid']]);}}}catch(_0x1cf559){utils[_0x6cc2('0x13')](util['format'](_0x6cc2('0x3a'),_0x2efe4a[_0x6cc2('0x4')]),_0x1cf559);}};exports[_0x6cc2('0x3f')]=function(_0x77fcef){try{if(!_[_0x6cc2('0x25')](queues[_0x77fcef['transfereeuniqueid']])){utils[_0x6cc2('0xe')](util['format'](_0x6cc2('0x40'),_0x77fcef[_0x6cc2('0x4')]),_0x77fcef);queues[_0x77fcef['transfereeuniqueid']]['transfer']=!![];queues[_0x77fcef[_0x6cc2('0x41')]]['transfertype']=_0x6cc2('0x42');queues[_0x77fcef['transfereeuniqueid']][_0x6cc2('0x43')]=_0x77fcef[_0x6cc2('0x44')];queues[_0x77fcef[_0x6cc2('0x41')]][_0x6cc2('0x45')]=_0x77fcef[_0x6cc2('0x41')];queues[_0x77fcef[_0x6cc2('0x41')]][_0x6cc2('0x1b')]='BLINDTRANSFER';utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x46'),_0x77fcef[_0x6cc2('0x4')],queues[_0x77fcef[_0x6cc2('0x41')]]['name'],_0x77fcef[_0x6cc2('0x41')],_0x77fcef[_0x6cc2('0x44')]));}}catch(_0x13bcaa){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x40'),_0x77fcef[_0x6cc2('0x4')]),_0x13bcaa);}};exports[_0x6cc2('0x47')]=function(_0x184754){try{utils[_0x6cc2('0xe')](util['format'](_0x6cc2('0x48'),_0x184754[_0x6cc2('0x49')]),_0x184754);if(_0x184754[_0x6cc2('0x49')]==_0x184754[_0x6cc2('0x4a')]){if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4b')]])){utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x4c'),_0x184754['origtransfereruniqueid'],queues[_0x184754['secondtransfererlinkedid']]['name'],_0x184754['origtransfererexten']));queues[_0x184754[_0x6cc2('0x4b')]]['transfer']=!![];queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0x4d')]=_0x6cc2('0x4e');queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0x43')]=_0x184754['origtransfererexten'];queues[_0x184754[_0x6cc2('0x4b')]]['transferuniqueid']=_0x184754[_0x6cc2('0x49')];queues[_0x184754[_0x6cc2('0x4b')]]['queuecallerexitreason']=_0x6cc2('0x4f');}if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4a')]])){if(_0x184754[_0x6cc2('0x50')]&&queues[_0x184754[_0x6cc2('0x50')]]){queues[_0x184754[_0x6cc2('0x50')]][_0x6cc2('0x1f')]=0x1;queues[_0x184754['transfereeuniqueid']]=_[_0x6cc2('0x51')](queues[_0x184754['transfereelinkedid']]);queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0xc')]=_0x184754['transfertargetuniqueid'];queues[_0x184754[_0x6cc2('0x41')]]['queuecallerenterreason']=0x2;queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x6')]=queues[_0x184754['secondtransfererlinkedid']][_0x6cc2('0x6')];queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x52')]=queues[_0x184754[_0x6cc2('0x4b')]]['calleridname'];queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x32')]=utils['now']();queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x16')]=utils[_0x6cc2('0x12')]();queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x30')]=0x0;queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x53')]=0x0;utils[_0x6cc2('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x184754[_0x6cc2('0x49')],queues[_0x184754[_0x6cc2('0x41')]]['name'],queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x6')],queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x52')]));}else{utils[_0x6cc2('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x184754['origtransfereruniqueid'],queues[_0x184754[_0x6cc2('0x4a')]]['name'],_0x184754[_0x6cc2('0x4b')]));queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x4b')];}}}else if(_0x184754[_0x6cc2('0x54')]==_0x184754['secondtransfererlinkedid']){if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4a')]])){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x55'),_0x184754[_0x6cc2('0x49')],queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x1e')],_0x184754[_0x6cc2('0x54')],_0x184754[_0x6cc2('0x56')]));queues[_0x184754['origtransfererlinkedid']][_0x6cc2('0x3d')]=!![];queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x4d')]=_0x6cc2('0x4e');queues[_0x184754[_0x6cc2('0x4a')]]['transferexten']=_0x184754[_0x6cc2('0x56')];queues[_0x184754['origtransfererlinkedid']]['transferuniqueid']=_0x184754['secondtransfereruniqueid'];queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x1b')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x184754[_0x6cc2('0x4b')]])){if(_0x184754[_0x6cc2('0x57')]&&queues[_0x184754['transfertargetlinkedid']]){queues[_0x184754['transfertargetlinkedid']][_0x6cc2('0x1f')]=0x1;queues[_0x184754[_0x6cc2('0x58')]]=_['clone'](queues[_0x184754['transfertargetlinkedid']]);queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x58')];queues[_0x184754[_0x6cc2('0x58')]]['queuecallerenterreason']=0x2;queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x6')]=queues[_0x184754[_0x6cc2('0x4a')]]['calleridnum'];queues[_0x184754[_0x6cc2('0x58')]]['calleridname']=queues[_0x184754['origtransfererlinkedid']][_0x6cc2('0x52')];queues[_0x184754[_0x6cc2('0x58')]]['queuecallerjoinAt']=utils['now']();queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x16')]=utils['now']();queues[_0x184754['transfertargetuniqueid']][_0x6cc2('0x30')]=0x0;queues[_0x184754['transfertargetuniqueid']][_0x6cc2('0x53')]=0x0;utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x59'),_0x184754['origtransfereruniqueid'],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x1e')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0xc')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x6')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x52')]));}else{utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x5a'),_0x184754['origtransfereruniqueid'],queues[_0x184754['secondtransfererlinkedid']]['name'],_0x184754[_0x6cc2('0x4a')]));queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x4a')];}}}}catch(_0x84378c){utils[_0x6cc2('0x13')](util['format']('[%s][queues][attendedtransfer]',_0x184754[_0x6cc2('0x49')]),_0x84378c);}};exports['musiconholdstart']=function(_0x5dae85){try{if(!_[_0x6cc2('0x25')](queues[_0x5dae85[_0x6cc2('0x4')]])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')]('[%s][queues][musiconholdstart]',_0x5dae85['uniqueid']),_0x5dae85);queues[_0x5dae85[_0x6cc2('0x4')]][_0x6cc2('0x5b')]=utils['now']();utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x5c'),_0x5dae85[_0x6cc2('0x4')],queues[_0x5dae85['uniqueid']][_0x6cc2('0x1e')],queues[_0x5dae85[_0x6cc2('0x4')]][_0x6cc2('0x5b')]));}}catch(_0x4d9a80){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x5d'),_0x5dae85[_0x6cc2('0x4')]),_0x4d9a80);}};exports[_0x6cc2('0x5e')]=function(_0x357a11){try{if(!_[_0x6cc2('0x25')](queues[_0x357a11[_0x6cc2('0x4')]])){if(!_[_0x6cc2('0x25')](queues[_0x357a11[_0x6cc2('0x4')]][_0x6cc2('0x5b')])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x5f'),_0x357a11[_0x6cc2('0x4')]),_0x357a11);queues[_0x357a11[_0x6cc2('0x4')]]['mohtime']+=utils[_0x6cc2('0x31')](utils[_0x6cc2('0x12')](),queues[_0x357a11['uniqueid']][_0x6cc2('0x5b')]);utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x60'),_0x357a11[_0x6cc2('0x4')],queues[_0x357a11['uniqueid']][_0x6cc2('0x1e')],queues[_0x357a11[_0x6cc2('0x4')]]['mohtime']));delete queues[_0x357a11[_0x6cc2('0x4')]][_0x6cc2('0x5b')];}}}catch(_0x2ee2bf){utils['error'](util[_0x6cc2('0x2')](_0x6cc2('0x5f'),_0x357a11[_0x6cc2('0x4')]),_0x2ee2bf);}}; \ No newline at end of file +var _0x34e0=['queuecallerenterreason','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','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','transfertargetlinkedid','queuecallerjoinAt','musiconholdstart','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x53f5ec,_0x34bca9){var _0x4e2d6a=function(_0x31d64d){while(--_0x31d64d){_0x53f5ec['push'](_0x53f5ec['shift']());}};_0x4e2d6a(++_0x34bca9);}(_0x34e0,0x112));var _0x034e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x34e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x034e('0x0'));var util=require(_0x034e('0x1'));var utils=require(_0x034e('0x2'));var queues={};function writeDB(_0x361fce){utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x5'),_0x361fce[_0x034e('0x6')],_0x361fce[_0x034e('0x7')],_0x361fce[_0x034e('0x8')],_0x361fce[_0x034e('0x9')],_0x361fce[_0x034e('0xa')],_0x361fce[_0x034e('0xb')],_0x361fce[_0x034e('0xc')]));if(_0x361fce[_0x034e('0x8')]){utils[_0x034e('0xd')](_0x361fce['queue'])[_0x034e('0xe')](function(_0x2c7a27){if(_0x2c7a27){_0x361fce[_0x034e('0xf')]=_0x2c7a27[_0x034e('0xf')];}utils['request'](_0x034e('0x10'),_0x361fce);});}else{utils[_0x034e('0x11')](_0x034e('0x10'),_0x361fce);}if(_0x361fce[_0x034e('0x12')]){delete queues[_0x361fce['transfereduniqueid']];}else{delete queues[_0x361fce[_0x034e('0x6')]];}}exports[_0x034e('0x13')]=function(_0x515123){try{utils[_0x034e('0x14')](util['format'](_0x034e('0x15'),_0x515123[_0x034e('0x6')]),_0x515123);utils[_0x034e('0x3')](util['format'](_0x034e('0x16'),_0x515123[_0x034e('0x6')],_0x515123[_0x034e('0x8')],_0x515123['position']));queues[_0x515123['uniqueid']]=_[_0x034e('0x17')](_0x515123,{'originalposition':_0x515123[_0x034e('0x18')],'queuecallerjoinAt':utils[_0x034e('0x19')](),'mohtime':0x0});}catch(_0x45ce87){utils[_0x034e('0x1a')](util[_0x034e('0x4')]('[%s][queues][queuecallerjoin]',_0x515123[_0x034e('0x6')]),_0x45ce87);}};exports[_0x034e('0x1b')]=function(_0x508934){try{if(!_[_0x034e('0x1c')](queues[_0x508934[_0x034e('0x6')]])){utils[_0x034e('0x14')](util[_0x034e('0x4')](_0x034e('0x1d'),_0x508934[_0x034e('0x6')]),_0x508934);if(queues[_0x508934[_0x034e('0x6')]][_0x034e('0x1e')]){if(!queues[_0x508934[_0x034e('0x6')]][_0x034e('0x1f')]&&!queues[_0x508934[_0x034e('0x6')]][_0x034e('0x20')]){queues[_0x508934[_0x034e('0x6')]][_0x034e('0x21')]=!![];queues[_0x508934[_0x034e('0x6')]][_0x034e('0x22')]=utils[_0x034e('0x19')]();queues[_0x508934[_0x034e('0x6')]][_0x034e('0xc')]='COMPLETEDBYAGENT';}utils['info'](util[_0x034e('0x4')](_0x034e('0x23'),_0x508934[_0x034e('0x6')],queues[_0x508934[_0x034e('0x6')]][_0x034e('0x24')],queues[_0x508934[_0x034e('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x508934[_0x034e('0x6')]]);}else if(queues[_0x508934['uniqueid']]['transfereduniqueid']){utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x25'),_0x508934['uniqueid'],queues[_0x508934[_0x034e('0x6')]][_0x034e('0x24')],queues[_0x508934[_0x034e('0x6')]][_0x034e('0x12')]));queues[queues[_0x508934[_0x034e('0x6')]][_0x034e('0x12')]]=queues[_0x508934['uniqueid']];queues[queues[_0x508934['uniqueid']][_0x034e('0x12')]][_0x034e('0x26')]=0x2;delete queues[_0x508934['uniqueid']];}}}catch(_0x4769df){utils['error'](util[_0x034e('0x4')](_0x034e('0x1d'),_0x508934[_0x034e('0x6')]),_0x4769df);}};exports['varset']=function(_0x206588){try{utils[_0x034e('0x14')](util[_0x034e('0x4')](_0x034e('0x27'),_0x206588['uniqueid']),_0x206588);if(!_[_0x034e('0x1c')](_0x206588['variable'][_0x034e('0x28')])&&_0x206588[_0x034e('0x29')][_0x034e('0x2a')]()!==_0x034e('0x2b')){if(!_[_0x034e('0x1c')](queues[_0x206588[_0x034e('0x6')]])){queues[_0x206588['uniqueid']][_0x034e('0x1f')]=![];queues[_0x206588[_0x034e('0x6')]][_0x034e('0x2c')]=null;queues[_0x206588['uniqueid']][_0x034e('0x20')]=!![];queues[_0x206588['uniqueid']][_0x034e('0x2d')]=utils[_0x034e('0x19')]();queues[_0x206588[_0x034e('0x6')]]['queuecallerexitreason']=_0x206588[_0x034e('0x29')][_0x034e('0x2a')]();utils[_0x034e('0x3')](util['format'](_0x034e('0x2e'),_0x206588['uniqueid'],queues[_0x206588[_0x034e('0x6')]]['name'],_0x206588[_0x034e('0x29')],queues[_0x206588[_0x034e('0x6')]][_0x034e('0xc')]));writeDB(queues[_0x206588['uniqueid']]);}}else if(!_['isNil'](_0x206588[_0x034e('0x2f')][_0x034e('0x30')])){if(!_[_0x034e('0x1c')](queues[_0x206588['uniqueid']])&&!queues[_0x206588['uniqueid']][_0x034e('0x1f')]){queues[_0x206588[_0x034e('0x6')]][_0x034e('0x1f')]=![];queues[_0x206588['uniqueid']][_0x034e('0x2c')]=null;queues[_0x206588[_0x034e('0x6')]][_0x034e('0x20')]=!![];queues[_0x206588['uniqueid']][_0x034e('0x2d')]=utils[_0x034e('0x19')]();queues[_0x206588['uniqueid']][_0x034e('0xc')]='EXITWITHKEY';utils['info'](util[_0x034e('0x4')](_0x034e('0x31'),_0x206588[_0x034e('0x6')],queues[_0x206588[_0x034e('0x6')]][_0x034e('0x24')],_0x206588[_0x034e('0x29')],queues[_0x206588['uniqueid']][_0x034e('0xc')]));}}}catch(_0x28bd8c){utils[_0x034e('0x1a')](util['format'](_0x034e('0x27'),_0x206588[_0x034e('0x6')]),_0x28bd8c);}};exports[_0x034e('0x1f')]=function(_0x2bcda2){try{if(!_[_0x034e('0x1c')](queues[_0x2bcda2[_0x034e('0x6')]])){utils[_0x034e('0x14')](util[_0x034e('0x4')]('[%s][queues][queuecallerabandon]',_0x2bcda2[_0x034e('0x6')]),_0x2bcda2);queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0x20')]=![];queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0x2d')]=null;queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0x1f')]=!![];queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0x2c')]=utils['now']();queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0xc')]=_0x034e('0x32');utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x33'),_0x2bcda2[_0x034e('0x6')],queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0x24')],queues[_0x2bcda2[_0x034e('0x6')]][_0x034e('0xc')]));}}catch(_0x5a180c){utils[_0x034e('0x1a')](util[_0x034e('0x4')](_0x034e('0x34'),_0x2bcda2[_0x034e('0x6')]),_0x5a180c);}};exports['queuecallerleave']=function(_0x26a041){try{if(!_[_0x034e('0x1c')](queues[_0x26a041[_0x034e('0x6')]])){utils[_0x034e('0x14')](util[_0x034e('0x4')](_0x034e('0x35'),_0x26a041[_0x034e('0x6')]),_0x26a041);utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x36'),_0x26a041[_0x034e('0x6')],queues[_0x26a041[_0x034e('0x6')]]['name'],_0x26a041['connectedlinenum'],_0x26a041[_0x034e('0x37')]));queues[_0x26a041['uniqueid']][_0x034e('0x38')]=!![];queues[_0x26a041[_0x034e('0x6')]]['queuecallerleaveAt']=utils[_0x034e('0x19')]();queues[_0x26a041[_0x034e('0x6')]][_0x034e('0x39')]=utils[_0x034e('0x3a')](queues[_0x26a041[_0x034e('0x6')]]['queuecallerleaveAt'],queues[_0x26a041[_0x034e('0x6')]]['queuecallerjoinAt']);queues[_0x26a041[_0x034e('0x6')]][_0x034e('0x18')]=_0x26a041[_0x034e('0x18')];queues[_0x26a041['uniqueid']][_0x034e('0x3b')]=_0x26a041['count'];queues[_0x26a041[_0x034e('0x6')]][_0x034e('0x3c')]=_0x26a041['connectedlinenum'];queues[_0x26a041[_0x034e('0x6')]][_0x034e('0x37')]=_0x26a041['connectedlinename'];}}catch(_0x3b2c35){utils[_0x034e('0x1a')](util[_0x034e('0x4')](_0x034e('0x35'),_0x26a041[_0x034e('0x6')]),_0x3b2c35);}};exports[_0x034e('0x3d')]=function(_0x3b2f3f){try{if(!_[_0x034e('0x1c')](queues[_0x3b2f3f[_0x034e('0x6')]])){utils['debug'](util[_0x034e('0x4')](_0x034e('0x3e'),_0x3b2f3f[_0x034e('0x6')]),_0x3b2f3f);utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x3f'),_0x3b2f3f[_0x034e('0x6')],queues[_0x3b2f3f[_0x034e('0x6')]][_0x034e('0x24')],_0x3b2f3f[_0x034e('0x40')],_0x3b2f3f[_0x034e('0x41')]));queues[_0x3b2f3f['uniqueid']]['queuecallerabandon']=![];queues[_0x3b2f3f[_0x034e('0x6')]][_0x034e('0x1f')]=![];queues[_0x3b2f3f[_0x034e('0x6')]][_0x034e('0x2c')]=null;queues[_0x3b2f3f['uniqueid']][_0x034e('0x20')]=![];queues[_0x3b2f3f[_0x034e('0x6')]][_0x034e('0xc')]=null;queues[_0x3b2f3f['uniqueid']][_0x034e('0x2d')]=null;queues[_0x3b2f3f[_0x034e('0x6')]]['assigned']=!![];queues[_0x3b2f3f[_0x034e('0x6')]]['accountcode']=_0x3b2f3f[_0x034e('0x41')];queues[_0x3b2f3f[_0x034e('0x6')]][_0x034e('0x9')]=_0x3b2f3f[_0x034e('0x40')];}}catch(_0xe93007){utils[_0x034e('0x1a')](util[_0x034e('0x4')](_0x034e('0x3e'),_0x3b2f3f[_0x034e('0x6')]),_0xe93007);}};exports['agentcomplete']=function(_0x10cf79){try{if(!_[_0x034e('0x1c')](queues[_0x10cf79[_0x034e('0x6')]])){if(queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x1e')]){utils[_0x034e('0x14')](util[_0x034e('0x4')]('[%s][queues][agentcomplete]',_0x10cf79['uniqueid']),_0x10cf79);queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x1f')]=![];queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x1f')]=![];queues[_0x10cf79['uniqueid']]['queuecallerabandonAt']=null;queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x20')]=![];queues[_0x10cf79[_0x034e('0x6')]]['queuecallerexitAt']=null;queues[_0x10cf79[_0x034e('0x6')]]['assigned']=!![];queues[_0x10cf79['uniqueid']][_0x034e('0x9')]=_0x10cf79[_0x034e('0x40')];queues[_0x10cf79['uniqueid']][_0x034e('0x21')]=!![];queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x22')]=utils[_0x034e('0x19')]();if(_0x10cf79['reason']==_0x034e('0x42')){if(!queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0x42')]){queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0xc')]=_0x034e('0x43');}}else{queues[_0x10cf79[_0x034e('0x6')]][_0x034e('0xc')]='COMPLETEDBY'+_0x10cf79[_0x034e('0x44')][_0x034e('0x2a')]();}utils[_0x034e('0x3')](util['format'](_0x034e('0x45'),_0x10cf79['uniqueid'],queues[_0x10cf79['uniqueid']][_0x034e('0x24')],_0x10cf79[_0x034e('0x40')],queues[_0x10cf79['uniqueid']][_0x034e('0xc')]));writeDB(queues[_0x10cf79[_0x034e('0x6')]]);}}}catch(_0x5f1289){utils['error'](util[_0x034e('0x4')](_0x034e('0x46'),_0x10cf79[_0x034e('0x6')]),_0x5f1289);}};exports[_0x034e('0x47')]=function(_0x381c38){try{if(!_[_0x034e('0x1c')](queues[_0x381c38[_0x034e('0x48')]])){utils[_0x034e('0x14')](util[_0x034e('0x4')](_0x034e('0x49'),_0x381c38['uniqueid']),_0x381c38);queues[_0x381c38[_0x034e('0x48')]]['transfer']=!![];queues[_0x381c38[_0x034e('0x48')]][_0x034e('0x4a')]=_0x034e('0x4b');queues[_0x381c38[_0x034e('0x48')]][_0x034e('0x4c')]=_0x381c38[_0x034e('0x4d')];queues[_0x381c38[_0x034e('0x48')]]['transferuniqueid']=_0x381c38['transfereeuniqueid'];queues[_0x381c38[_0x034e('0x48')]]['queuecallerexitreason']=_0x034e('0x4e');utils['info'](util[_0x034e('0x4')](_0x034e('0x4f'),_0x381c38[_0x034e('0x6')],queues[_0x381c38[_0x034e('0x48')]][_0x034e('0x24')],_0x381c38[_0x034e('0x48')],_0x381c38[_0x034e('0x4d')]));}}catch(_0x19934b){utils[_0x034e('0x1a')](util['format'](_0x034e('0x49'),_0x381c38[_0x034e('0x6')]),_0x19934b);}};exports[_0x034e('0x50')]=function(_0x26e35f){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x26e35f[_0x034e('0x51')]),_0x26e35f);if(_0x26e35f[_0x034e('0x51')]==_0x26e35f['origtransfererlinkedid']){if(!_[_0x034e('0x1c')](queues[_0x26e35f[_0x034e('0x52')]])){utils[_0x034e('0x3')](util[_0x034e('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x26e35f['origtransfereruniqueid'],queues[_0x26e35f[_0x034e('0x52')]]['name'],_0x26e35f[_0x034e('0x53')]));queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x42')]=!![];queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x4a')]=_0x034e('0x54');queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x4c')]=_0x26e35f[_0x034e('0x53')];queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x55')]=_0x26e35f[_0x034e('0x51')];queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0xc')]=_0x034e('0x56');}if(!_[_0x034e('0x1c')](queues[_0x26e35f[_0x034e('0x57')]])){if(_0x26e35f[_0x034e('0x58')]&&queues[_0x26e35f[_0x034e('0x58')]]){queues[_0x26e35f[_0x034e('0x58')]]['queuecallerenterreason']=0x1;queues[_0x26e35f[_0x034e('0x48')]]=_[_0x034e('0x59')](queues[_0x26e35f[_0x034e('0x58')]]);queues[_0x26e35f[_0x034e('0x48')]]['transfereduniqueid']=_0x26e35f[_0x034e('0x5a')];queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x26')]=0x2;queues[_0x26e35f['transfereeuniqueid']][_0x034e('0xa')]=queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0xa')];queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x5b')]=queues[_0x26e35f['secondtransfererlinkedid']][_0x034e('0x5b')];queues[_0x26e35f[_0x034e('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x1e')]=utils['now']();queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x39')]=0x0;queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x5c')]=0x0;utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x5d'),_0x26e35f[_0x034e('0x51')],queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x24')],queues[_0x26e35f[_0x034e('0x48')]]['calleridnum'],queues[_0x26e35f[_0x034e('0x48')]][_0x034e('0x5b')]));}else{utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x5e'),_0x26e35f['origtransfereruniqueid'],queues[_0x26e35f[_0x034e('0x57')]]['name'],_0x26e35f['secondtransfererlinkedid']));queues[_0x26e35f[_0x034e('0x57')]]['transfereduniqueid']=_0x26e35f[_0x034e('0x52')];}}}else if(_0x26e35f[_0x034e('0x5f')]==_0x26e35f[_0x034e('0x52')]){if(!_[_0x034e('0x1c')](queues[_0x26e35f['origtransfererlinkedid']])){utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x60'),_0x26e35f[_0x034e('0x51')],queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0x24')],_0x26e35f[_0x034e('0x5f')],_0x26e35f[_0x034e('0x61')]));queues[_0x26e35f['origtransfererlinkedid']]['transfer']=!![];queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0x4a')]='ATTENDED';queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0x4c')]=_0x26e35f['secondtransfererexten'];queues[_0x26e35f['origtransfererlinkedid']][_0x034e('0x55')]=_0x26e35f[_0x034e('0x5f')];queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0xc')]=_0x034e('0x56');}if(!_['isNil'](queues[_0x26e35f[_0x034e('0x52')]])){if(_0x26e35f[_0x034e('0x62')]&&queues[_0x26e35f[_0x034e('0x62')]]){queues[_0x26e35f[_0x034e('0x62')]][_0x034e('0x26')]=0x1;queues[_0x26e35f[_0x034e('0x5a')]]=_[_0x034e('0x59')](queues[_0x26e35f[_0x034e('0x62')]]);queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x12')]=_0x26e35f['transfertargetuniqueid'];queues[_0x26e35f['transfertargetuniqueid']][_0x034e('0x26')]=0x2;queues[_0x26e35f['transfertargetuniqueid']][_0x034e('0xa')]=queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0xa')];queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x5b')]=queues[_0x26e35f[_0x034e('0x57')]][_0x034e('0x5b')];queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x63')]=utils[_0x034e('0x19')]();queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x1e')]=utils[_0x034e('0x19')]();queues[_0x26e35f['transfertargetuniqueid']][_0x034e('0x39')]=0x0;queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x5c')]=0x0;utils[_0x034e('0x3')](util[_0x034e('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x26e35f[_0x034e('0x51')],queues[_0x26e35f[_0x034e('0x5a')]]['name'],queues[_0x26e35f[_0x034e('0x5a')]][_0x034e('0x12')],queues[_0x26e35f['transfertargetuniqueid']]['calleridnum'],queues[_0x26e35f[_0x034e('0x5a')]]['calleridname']));}else{utils[_0x034e('0x3')](util[_0x034e('0x4')](_0x034e('0x5e'),_0x26e35f[_0x034e('0x51')],queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x24')],_0x26e35f['origtransfererlinkedid']));queues[_0x26e35f[_0x034e('0x52')]][_0x034e('0x12')]=_0x26e35f[_0x034e('0x57')];}}}}catch(_0x130f12){utils[_0x034e('0x1a')](util[_0x034e('0x4')]('[%s][queues][attendedtransfer]',_0x26e35f[_0x034e('0x51')]),_0x130f12);}};exports[_0x034e('0x64')]=function(_0x394ad8){try{if(!_[_0x034e('0x1c')](queues[_0x394ad8[_0x034e('0x6')]])){utils[_0x034e('0x14')](util['format']('[%s][queues][musiconholdstart]',_0x394ad8[_0x034e('0x6')]),_0x394ad8);queues[_0x394ad8[_0x034e('0x6')]][_0x034e('0x65')]=utils['now']();utils['info'](util[_0x034e('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x394ad8['uniqueid'],queues[_0x394ad8['uniqueid']][_0x034e('0x24')],queues[_0x394ad8[_0x034e('0x6')]][_0x034e('0x65')]));}}catch(_0x3ff6ea){utils[_0x034e('0x1a')](util[_0x034e('0x4')]('[%s][queues][musiconholdstart]',_0x394ad8[_0x034e('0x6')]),_0x3ff6ea);}};exports[_0x034e('0x66')]=function(_0x296a50){try{if(!_[_0x034e('0x1c')](queues[_0x296a50['uniqueid']])){if(!_['isNil'](queues[_0x296a50[_0x034e('0x6')]][_0x034e('0x65')])){utils[_0x034e('0x14')](util['format']('[%s][queues][musiconholdstop]',_0x296a50[_0x034e('0x6')]),_0x296a50);queues[_0x296a50[_0x034e('0x6')]][_0x034e('0x5c')]+=utils['diffTime'](utils[_0x034e('0x19')](),queues[_0x296a50['uniqueid']][_0x034e('0x65')]);utils[_0x034e('0x3')](util[_0x034e('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x296a50['uniqueid'],queues[_0x296a50[_0x034e('0x6')]][_0x034e('0x24')],queues[_0x296a50[_0x034e('0x6')]][_0x034e('0x5c')]));delete queues[_0x296a50['uniqueid']][_0x034e('0x65')];}}}catch(_0x3d1045){utils[_0x034e('0x1a')](util[_0x034e('0x4')](_0x034e('0x67'),_0x296a50[_0x034e('0x6')]),_0x3d1045);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ae8a035..d8480ca 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 _0xcc2d=['startsWith','toLowerCase','cdr','split','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','monitors','push','debug','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set'];(function(_0x2c6336,_0x1fb3a4){var _0x5b07ec=function(_0x1cbbd9){while(--_0x1cbbd9){_0x2c6336['push'](_0x2c6336['shift']());}};_0x5b07ec(++_0x1fb3a4);}(_0xcc2d,0x7d));var _0xdcc2=function(_0x33a91a,_0x4a2db5){_0x33a91a=_0x33a91a-0x0;var _0x284314=_0xcc2d[_0x33a91a];return _0x284314;};'use strict';var _=require(_0xdcc2('0x0'));var util=require(_0xdcc2('0x1'));var utils=require(_0xdcc2('0x2'));var recordings={};function writeDB(_0x3ad1f2){utils['info'](util[_0xdcc2('0x3')](_0xdcc2('0x4'),_0x3ad1f2['uniqueid']));if(_0x3ad1f2[_0xdcc2('0x5')]){utils['getUserByInternal'](_0x3ad1f2[_0xdcc2('0x5')])['then'](function(_0x179caf){if(_0x179caf){_0x3ad1f2[_0xdcc2('0x6')]=_0x179caf['name'];_0x3ad1f2[_0xdcc2('0x7')]=_0x179caf['id'];}utils[_0xdcc2('0x8')](_0xdcc2('0x9'),_0x3ad1f2);});}else{utils[_0xdcc2('0x8')](_0xdcc2('0x9'),_0x3ad1f2);}}exports[_0xdcc2('0xa')]=function(_0x5c0b96){try{utils['debug'](util[_0xdcc2('0x3')](_0xdcc2('0xb'),_0x5c0b96[_0xdcc2('0xc')]),_0x5c0b96);if(_0x5c0b96[_0xdcc2('0xc')]==_0x5c0b96[_0xdcc2('0xd')]){utils['info'](util[_0xdcc2('0x3')](_0xdcc2('0xe'),_0x5c0b96[_0xdcc2('0xc')],_0x5c0b96[_0xdcc2('0xf')],_0x5c0b96[_0xdcc2('0x10')]));recordings[_0x5c0b96[_0xdcc2('0xc')]]={'uniqueid':_0x5c0b96[_0xdcc2('0xc')],'accountcode':_0x5c0b96['accountcode'],'exten':_0x5c0b96[_0xdcc2('0x10')],'context':_0x5c0b96[_0xdcc2('0xf')],'channel':_0x5c0b96[_0xdcc2('0x11')],'monitors':[]};}}catch(_0x1cf3af){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0xb'),_0x5c0b96[_0xdcc2('0xc')]),_0x1cf3af);}};exports['newstate']=function(_0x37fedb){try{utils['debug'](util[_0xdcc2('0x3')]('[%s][recordings][newstate]',_0x37fedb['uniqueid']),_0x37fedb);if(!_[_0xdcc2('0x13')](recordings[_0x37fedb[_0xdcc2('0xc')]])&&_0x37fedb[_0xdcc2('0x14')]==0x6){utils[_0xdcc2('0x15')](util[_0xdcc2('0x3')](_0xdcc2('0x16'),_0x37fedb['uniqueid'],_0x37fedb['context'],_0x37fedb[_0xdcc2('0x11')]));}else if(!_['isNil'](recordings[_0x37fedb[_0xdcc2('0xd')]])&&_0x37fedb[_0xdcc2('0x14')]==0x6&&_0x37fedb[_0xdcc2('0xf')]!='transfer'){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x37fedb[_0xdcc2('0xc')],_0x37fedb[_0xdcc2('0xd')],_0x37fedb['context'],_0x37fedb[_0xdcc2('0x11')]));recordings[_0x37fedb[_0xdcc2('0xd')]][_0xdcc2('0x5')]=_0x37fedb['accountcode'];}}catch(_0x44ac10){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x17'),_0x37fedb[_0xdcc2('0xc')]),_0x44ac10);}};exports[_0xdcc2('0x18')]=function(_0x188a71){try{if(!_[_0xdcc2('0x13')](_0x188a71['variable'])&&!_['isNil'](_0x188a71[_0xdcc2('0x19')][_0xdcc2('0x1a')])){utils['debug'](util[_0xdcc2('0x3')](_0xdcc2('0x1b'),_0x188a71[_0xdcc2('0xc')]),_0x188a71);utils[_0xdcc2('0x15')](util[_0xdcc2('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x188a71['uniqueid'],_0x188a71[_0xdcc2('0x19')],_0x188a71[_0xdcc2('0x1c')]));if(_[_0xdcc2('0x1d')](_0x188a71[_0xdcc2('0x1c')],_0xdcc2('0x1e'))){_0x188a71[_0xdcc2('0x1c')]=_0x188a71['value']['replace'](_0xdcc2('0x1e'),_0xdcc2('0x1f'));}if(recordings[_0x188a71[_0xdcc2('0xd')]]){var _0x5c7a1d=_['find'](recordings[_0x188a71['linkedid']][_0xdcc2('0x20')],{'value':_0x188a71[_0xdcc2('0x1c')]});if(_[_0xdcc2('0x13')](_0x5c7a1d)){recordings[_0x188a71['linkedid']][_0xdcc2('0x20')][_0xdcc2('0x21')]({'value':_0x188a71[_0xdcc2('0x1c')]});}}}}catch(_0x23aace){utils['error'](util[_0xdcc2('0x3')](_0xdcc2('0x1b'),_0x188a71[_0xdcc2('0xc')]),_0x23aace);}};exports['hangup']=function(_0x4070c3){try{if(!_[_0xdcc2('0x13')](recordings[_0x4070c3['uniqueid']])){utils[_0xdcc2('0x22')](util[_0xdcc2('0x3')](_0xdcc2('0x23'),_0x4070c3[_0xdcc2('0xc')]),_0x4070c3);utils[_0xdcc2('0x15')](util['format'](_0xdcc2('0x24'),_0x4070c3[_0xdcc2('0xc')],_0x4070c3[_0xdcc2('0x25')],_0x4070c3[_0xdcc2('0x26')],_0x4070c3['cause-txt']));recordings[_0x4070c3[_0xdcc2('0xc')]]['calleridnum']=_0x4070c3['calleridnum'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x26')]=_0x4070c3['calleridname'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x27')]=_0x4070c3[_0xdcc2('0x27')];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x28')]=_0x4070c3[_0xdcc2('0x28')];if(recordings[_0x4070c3[_0xdcc2('0xc')]]['type']==_0xdcc2('0x29')&&recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x5')]){recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x27')]=recordings[_0x4070c3[_0xdcc2('0xc')]]['accountcode'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x28')]='';}recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x20')][_0xdcc2('0x2a')](function(_0x6b3cc5){var _0x11e54c=_[_0xdcc2('0x2b')](recordings[_0x4070c3[_0xdcc2('0xc')]]);_0x11e54c[_0xdcc2('0x1c')]=_0x6b3cc5[_0xdcc2('0x1c')];writeDB(_0x11e54c);});delete recordings[_0x4070c3[_0xdcc2('0xc')]];}}catch(_0x1ddea0){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x23'),_0x4070c3[_0xdcc2('0xc')]),_0x1ddea0);}};exports[_0xdcc2('0x2c')]=function(_0x14a62a){try{if(!_['isNil'](recordings[_0x14a62a[_0xdcc2('0xc')]])){utils['debug'](util[_0xdcc2('0x3')]('[%s][recordings][newexten]',_0x14a62a[_0xdcc2('0xc')]),_0x14a62a);utils['info'](util['format'](_0xdcc2('0x2d'),_0x14a62a[_0xdcc2('0xc')],_0x14a62a[_0xdcc2('0x2e')],_0x14a62a[_0xdcc2('0x2f')]));if(_0x14a62a[_0xdcc2('0x2e')]['toLowerCase']()==_0xdcc2('0x30')&&_[_0xdcc2('0x31')](_0x14a62a[_0xdcc2('0x2f')][_0xdcc2('0x32')](),_0xdcc2('0x33'))){var _0x54de02=_0x14a62a[_0xdcc2('0x2f')][_0xdcc2('0x34')]('=');var _0x4cacb2=_0x54de02[0x0]['substring'](_0x54de02[0x0]['lastIndexOf']('(')+0x1,_0x54de02[0x0][_0xdcc2('0x35')](')'));var _0x1dcd08=_0x54de02[0x1];recordings[_0x14a62a[_0xdcc2('0xc')]][_0x4cacb2]=_0x1dcd08;}}}catch(_0x4f19af){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x36'),_0x14a62a[_0xdcc2('0xc')]),_0x4f19af);}};exports['queuecallerjoin']=function(_0x12af14){try{if(!_[_0xdcc2('0x13')](recordings[_0x12af14['uniqueid']])){utils[_0xdcc2('0x22')](util[_0xdcc2('0x3')](_0xdcc2('0x37'),_0x12af14['uniqueid']),_0x12af14);utils[_0xdcc2('0x15')](util['format'](_0xdcc2('0x38'),_0x12af14[_0xdcc2('0xc')],_0x12af14[_0xdcc2('0x39')]));recordings[_0x12af14[_0xdcc2('0xc')]][_0xdcc2('0x39')]=_0x12af14[_0xdcc2('0x39')];}}catch(_0x30f464){utils['error'](util['format'](_0xdcc2('0x37'),_0x12af14[_0xdcc2('0xc')]),_0x30f464);}}; \ No newline at end of file +var _0x8333=['uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','format','[%s][recordings][writeDB]'];(function(_0x39ee87,_0x3c1d80){var _0x16bf6c=function(_0x1e0697){while(--_0x1e0697){_0x39ee87['push'](_0x39ee87['shift']());}};_0x16bf6c(++_0x3c1d80);}(_0x8333,0x19f));var _0x3833=function(_0x51d06f,_0x2084cd){_0x51d06f=_0x51d06f-0x0;var _0x561138=_0x8333[_0x51d06f];return _0x561138;};'use strict';var _=require(_0x3833('0x0'));var util=require(_0x3833('0x1'));var utils=require(_0x3833('0x2'));var recordings={};function writeDB(_0x1f1eac){utils['info'](util[_0x3833('0x3')](_0x3833('0x4'),_0x1f1eac[_0x3833('0x5')]));if(_0x1f1eac[_0x3833('0x6')]){utils[_0x3833('0x7')](_0x1f1eac[_0x3833('0x6')])[_0x3833('0x8')](function(_0x52799f){if(_0x52799f){_0x1f1eac['membername']=_0x52799f[_0x3833('0x9')];_0x1f1eac[_0x3833('0xa')]=_0x52799f['id'];}utils[_0x3833('0xb')]('CreateVoiceRecording',_0x1f1eac);});}else{utils[_0x3833('0xb')](_0x3833('0xc'),_0x1f1eac);}}exports[_0x3833('0xd')]=function(_0x5e9d37){try{utils[_0x3833('0xe')](util[_0x3833('0x3')](_0x3833('0xf'),_0x5e9d37[_0x3833('0x5')]),_0x5e9d37);if(_0x5e9d37[_0x3833('0x5')]==_0x5e9d37[_0x3833('0x10')]){utils[_0x3833('0x11')](util[_0x3833('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5e9d37['uniqueid'],_0x5e9d37[_0x3833('0x12')],_0x5e9d37[_0x3833('0x13')]));recordings[_0x5e9d37['uniqueid']]={'uniqueid':_0x5e9d37[_0x3833('0x5')],'accountcode':_0x5e9d37['accountcode'],'exten':_0x5e9d37[_0x3833('0x13')],'context':_0x5e9d37[_0x3833('0x12')],'channel':_0x5e9d37['channel'],'monitors':[]};}}catch(_0xd51474){utils[_0x3833('0x14')](util[_0x3833('0x3')](_0x3833('0xf'),_0x5e9d37[_0x3833('0x5')]),_0xd51474);}};exports['newstate']=function(_0x3dd475){try{utils[_0x3833('0xe')](util[_0x3833('0x3')](_0x3833('0x15'),_0x3dd475[_0x3833('0x5')]),_0x3dd475);if(!_[_0x3833('0x16')](recordings[_0x3dd475[_0x3833('0x5')]])&&_0x3dd475[_0x3833('0x17')]==0x6){utils[_0x3833('0x11')](util['format'](_0x3833('0x18'),_0x3dd475[_0x3833('0x5')],_0x3dd475[_0x3833('0x12')],_0x3dd475['channel']));}else if(!_['isNil'](recordings[_0x3dd475[_0x3833('0x10')]])&&_0x3dd475[_0x3833('0x17')]==0x6&&_0x3dd475['context']!=_0x3833('0x19')){utils[_0x3833('0x11')](util[_0x3833('0x3')](_0x3833('0x1a'),_0x3dd475['uniqueid'],_0x3dd475[_0x3833('0x10')],_0x3dd475[_0x3833('0x12')],_0x3dd475[_0x3833('0x1b')]));recordings[_0x3dd475[_0x3833('0x10')]][_0x3833('0x6')]=_0x3dd475['accountcode'];}}catch(_0x36d1b6){utils[_0x3833('0x14')](util['format']('[%s][recordings][newstate]',_0x3dd475[_0x3833('0x5')]),_0x36d1b6);}};exports[_0x3833('0x1c')]=function(_0x12cd13){try{if(!_[_0x3833('0x16')](_0x12cd13[_0x3833('0x1d')])&&!_[_0x3833('0x16')](_0x12cd13[_0x3833('0x1d')]['mixmonitor_filename'])){utils['debug'](util[_0x3833('0x3')](_0x3833('0x1e'),_0x12cd13['uniqueid']),_0x12cd13);utils['info'](util[_0x3833('0x3')](_0x3833('0x1f'),_0x12cd13['uniqueid'],_0x12cd13['variable'],_0x12cd13['value']));if(_[_0x3833('0x20')](_0x12cd13[_0x3833('0x21')],_0x3833('0x22'))){_0x12cd13['value']=_0x12cd13['value']['replace'](_0x3833('0x22'),_0x3833('0x23'));}if(recordings[_0x12cd13[_0x3833('0x10')]]){var _0x3dec58=_[_0x3833('0x24')](recordings[_0x12cd13[_0x3833('0x10')]][_0x3833('0x25')],{'value':_0x12cd13[_0x3833('0x21')]});if(_[_0x3833('0x16')](_0x3dec58)){recordings[_0x12cd13[_0x3833('0x10')]][_0x3833('0x25')][_0x3833('0x26')]({'value':_0x12cd13[_0x3833('0x21')]});}}}}catch(_0x5cb4e9){utils[_0x3833('0x14')](util['format'](_0x3833('0x1e'),_0x12cd13[_0x3833('0x5')]),_0x5cb4e9);}};exports[_0x3833('0x27')]=function(_0x3fcc7e){try{if(!_[_0x3833('0x16')](recordings[_0x3fcc7e[_0x3833('0x5')]])){utils[_0x3833('0xe')](util[_0x3833('0x3')]('[%s][recordings][hangup]',_0x3fcc7e[_0x3833('0x5')]),_0x3fcc7e);utils[_0x3833('0x11')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3fcc7e[_0x3833('0x5')],_0x3fcc7e[_0x3833('0x28')],_0x3fcc7e['calleridname'],_0x3fcc7e['cause-txt']));recordings[_0x3fcc7e[_0x3833('0x5')]][_0x3833('0x28')]=_0x3fcc7e[_0x3833('0x28')];recordings[_0x3fcc7e['uniqueid']][_0x3833('0x29')]=_0x3fcc7e[_0x3833('0x29')];recordings[_0x3fcc7e[_0x3833('0x5')]][_0x3833('0x2a')]=_0x3fcc7e['connectedlinenum'];recordings[_0x3fcc7e['uniqueid']][_0x3833('0x2b')]=_0x3fcc7e[_0x3833('0x2b')];if(recordings[_0x3fcc7e['uniqueid']]['type']==_0x3833('0x2c')&&recordings[_0x3fcc7e[_0x3833('0x5')]]['accountcode']){recordings[_0x3fcc7e['uniqueid']][_0x3833('0x2a')]=recordings[_0x3fcc7e[_0x3833('0x5')]][_0x3833('0x6')];recordings[_0x3fcc7e['uniqueid']][_0x3833('0x2b')]='';}recordings[_0x3fcc7e[_0x3833('0x5')]][_0x3833('0x25')][_0x3833('0x2d')](function(_0x4af2bf){var _0x26ff10=_[_0x3833('0x2e')](recordings[_0x3fcc7e[_0x3833('0x5')]]);_0x26ff10['value']=_0x4af2bf['value'];writeDB(_0x26ff10);});delete recordings[_0x3fcc7e['uniqueid']];}}catch(_0x35805c){utils[_0x3833('0x14')](util['format']('[%s][recordings][hangup]',_0x3fcc7e[_0x3833('0x5')]),_0x35805c);}};exports['newexten']=function(_0x3491c1){try{if(!_[_0x3833('0x16')](recordings[_0x3491c1['uniqueid']])){utils[_0x3833('0xe')](util[_0x3833('0x3')](_0x3833('0x2f'),_0x3491c1['uniqueid']),_0x3491c1);utils[_0x3833('0x11')](util[_0x3833('0x3')](_0x3833('0x30'),_0x3491c1[_0x3833('0x5')],_0x3491c1[_0x3833('0x31')],_0x3491c1[_0x3833('0x32')]));if(_0x3491c1[_0x3833('0x31')][_0x3833('0x33')]()==_0x3833('0x34')&&_['startsWith'](_0x3491c1[_0x3833('0x32')][_0x3833('0x33')](),_0x3833('0x35'))){var _0x4de9ce=_0x3491c1[_0x3833('0x32')][_0x3833('0x36')]('=');var _0x5543bc=_0x4de9ce[0x0][_0x3833('0x37')](_0x4de9ce[0x0]['lastIndexOf']('(')+0x1,_0x4de9ce[0x0]['lastIndexOf'](')'));var _0x3c63d5=_0x4de9ce[0x1];recordings[_0x3491c1['uniqueid']][_0x5543bc]=_0x3c63d5;}}}catch(_0xa8ce00){utils[_0x3833('0x14')](util['format'](_0x3833('0x2f'),_0x3491c1['uniqueid']),_0xa8ce00);}};exports[_0x3833('0x38')]=function(_0x155610){try{if(!_[_0x3833('0x16')](recordings[_0x155610['uniqueid']])){utils['debug'](util[_0x3833('0x3')]('[%s][recordings][queuecallerjoin]',_0x155610[_0x3833('0x5')]),_0x155610);utils[_0x3833('0x11')](util[_0x3833('0x3')](_0x3833('0x39'),_0x155610[_0x3833('0x5')],_0x155610['queue']));recordings[_0x155610[_0x3833('0x5')]][_0x3833('0x3a')]=_0x155610[_0x3833('0x3a')];}}catch(_0x517d61){utils[_0x3833('0x14')](util['format'](_0x3833('0x3b'),_0x155610[_0x3833('0x5')]),_0x517d61);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a2ae1da..050bdd6 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 _0xf98e=['transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign'];(function(_0xbfa874,_0x41c78f){var _0x411bca=function(_0x42fd84){while(--_0x42fd84){_0xbfa874['push'](_0xbfa874['shift']());}};_0x411bca(++_0x41c78f);}(_0xf98e,0x1e9));var _0xef98=function(_0x429851,_0xd7de37){_0x429851=_0x429851-0x0;var _0x2f70c8=_0xf98e[_0x429851];return _0x2f70c8;};'use strict';var _=require(_0xef98('0x0'));var util=require('util');var utils=require(_0xef98('0x1'));function writeDB(_0x30debe){utils[_0xef98('0x2')](util[_0xef98('0x3')](_0xef98('0x4'),_0x30debe[_0xef98('0x5')]===_0xef98('0x6')?_0x30debe[_0xef98('0x7')]:_0x30debe[_0xef98('0x8')],_0x30debe[_0xef98('0x5')]));utils['request'](_0xef98('0x9'),_0x30debe);}exports[_0xef98('0xa')]=function(_0x4f773e){try{utils[_0xef98('0xb')](util[_0xef98('0x3')]('[%s][transfers][blindtransfer]',_0x4f773e[_0xef98('0x8')]),_0x4f773e);utils[_0xef98('0x2')](util[_0xef98('0x3')](_0xef98('0xc'),_0x4f773e[_0xef98('0x8')],_0x4f773e[_0xef98('0xd')],_0x4f773e['transferercalleridname'],_0x4f773e['transfereecalleridnum'],_0x4f773e[_0xef98('0xe')]));_0x4f773e[_0xef98('0x5')]=_0xef98('0xf');writeDB(_0x4f773e);}catch(_0x4bfa3b){utils['error'](util[_0xef98('0x3')](_0xef98('0x10'),_0x4f773e[_0xef98('0x8')]),_0x4bfa3b);}};exports[_0xef98('0x11')]=function(_0x1a1dbe){try{utils[_0xef98('0xb')](util[_0xef98('0x3')](_0xef98('0x12'),_0x1a1dbe['origtransfereruniqueid']),_0x1a1dbe);utils[_0xef98('0x2')](util['format'](_0xef98('0x13'),_0x1a1dbe[_0xef98('0x7')],_0x1a1dbe[_0xef98('0x14')],_0x1a1dbe['origtransferercalleridname'],_0x1a1dbe[_0xef98('0x15')],_0x1a1dbe['transfertargetcalleridname']));_0x1a1dbe=_['assign'](_0x1a1dbe,{'transfererchannel':_0x1a1dbe['origtransfererchannel'],'transferercalleridnum':_0x1a1dbe['origtransferercalleridnum'],'transferercalleridname':_0x1a1dbe['origtransferercalleridname'],'transfererconnectedlinenum':_0x1a1dbe['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1a1dbe[_0xef98('0x16')],'transfereraccountcode':_0x1a1dbe[_0xef98('0x17')],'transferercontext':_0x1a1dbe[_0xef98('0x18')],'transfererexten':_0x1a1dbe[_0xef98('0x19')],'transfererlinkedid':_0x1a1dbe['origtransfererlinkedid'],'context':_0x1a1dbe[_0xef98('0x1a')],'extension':_0x1a1dbe[_0xef98('0x1b')],'type':'attended'});if(_[_0xef98('0x1c')](_0x1a1dbe[_0xef98('0x1d')])){_0x1a1dbe=_[_0xef98('0x1e')](_0x1a1dbe,{'transfereechannel':_0x1a1dbe[_0xef98('0x1f')],'transfereecalleridnum':_0x1a1dbe['transfertargetcalleridnum'],'transfereecalleridname':_0x1a1dbe[_0xef98('0x20')],'transfereeconnectedlinenum':_0x1a1dbe[_0xef98('0x21')],'transfereeconnectedlinename':_0x1a1dbe[_0xef98('0x22')],'transfereeaccountcode':_0x1a1dbe[_0xef98('0x23')],'transfereecontext':_0x1a1dbe[_0xef98('0x24')],'transfereeexten':_0x1a1dbe[_0xef98('0x25')],'transfereelinkedid':_0x1a1dbe[_0xef98('0x26')]});}writeDB(_0x1a1dbe);}catch(_0x354026){utils[_0xef98('0x27')](util[_0xef98('0x3')]('[%s][transfers][attendedtransfer]',_0x1a1dbe[_0xef98('0x7')]),_0x354026);}}; \ No newline at end of file +var _0xff2e=['./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash'];(function(_0x2c9f51,_0x2eec01){var _0x12abf9=function(_0x2d463f){while(--_0x2d463f){_0x2c9f51['push'](_0x2c9f51['shift']());}};_0x12abf9(++_0x2eec01);}(_0xff2e,0x15e));var _0xeff2=function(_0x3c1601,_0x154b1e){_0x3c1601=_0x3c1601-0x0;var _0x5b96e7=_0xff2e[_0x3c1601];return _0x5b96e7;};'use strict';var _=require(_0xeff2('0x0'));var util=require('util');var utils=require(_0xeff2('0x1'));function writeDB(_0x412a4f){utils[_0xeff2('0x2')](util[_0xeff2('0x3')](_0xeff2('0x4'),_0x412a4f[_0xeff2('0x5')]===_0xeff2('0x6')?_0x412a4f[_0xeff2('0x7')]:_0x412a4f[_0xeff2('0x8')],_0x412a4f[_0xeff2('0x5')]));utils[_0xeff2('0x9')](_0xeff2('0xa'),_0x412a4f);}exports[_0xeff2('0xb')]=function(_0x2f70fb){try{utils[_0xeff2('0xc')](util[_0xeff2('0x3')]('[%s][transfers][blindtransfer]',_0x2f70fb[_0xeff2('0x8')]),_0x2f70fb);utils[_0xeff2('0x2')](util[_0xeff2('0x3')](_0xeff2('0xd'),_0x2f70fb[_0xeff2('0x8')],_0x2f70fb[_0xeff2('0xe')],_0x2f70fb[_0xeff2('0xf')],_0x2f70fb[_0xeff2('0x10')],_0x2f70fb[_0xeff2('0x11')]));_0x2f70fb[_0xeff2('0x5')]=_0xeff2('0x12');writeDB(_0x2f70fb);}catch(_0x219d89){utils[_0xeff2('0x13')](util[_0xeff2('0x3')]('[%s][transfers][blindtransfer]',_0x2f70fb['uniqueid']),_0x219d89);}};exports[_0xeff2('0x14')]=function(_0x237e4e){try{utils[_0xeff2('0xc')](util['format'](_0xeff2('0x15'),_0x237e4e['origtransfereruniqueid']),_0x237e4e);utils[_0xeff2('0x2')](util[_0xeff2('0x3')](_0xeff2('0x16'),_0x237e4e[_0xeff2('0x7')],_0x237e4e[_0xeff2('0x17')],_0x237e4e[_0xeff2('0x18')],_0x237e4e[_0xeff2('0x19')],_0x237e4e[_0xeff2('0x1a')]));_0x237e4e=_['assign'](_0x237e4e,{'transfererchannel':_0x237e4e[_0xeff2('0x1b')],'transferercalleridnum':_0x237e4e[_0xeff2('0x17')],'transferercalleridname':_0x237e4e[_0xeff2('0x18')],'transfererconnectedlinenum':_0x237e4e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x237e4e[_0xeff2('0x1c')],'transfereraccountcode':_0x237e4e[_0xeff2('0x1d')],'transferercontext':_0x237e4e[_0xeff2('0x1e')],'transfererexten':_0x237e4e[_0xeff2('0x1f')],'transfererlinkedid':_0x237e4e['origtransfererlinkedid'],'context':_0x237e4e[_0xeff2('0x20')],'extension':_0x237e4e['origtransfererexten'],'type':_0xeff2('0x6')});if(_[_0xeff2('0x21')](_0x237e4e[_0xeff2('0x22')])){_0x237e4e=_['assign'](_0x237e4e,{'transfereechannel':_0x237e4e['transfertargetchannel'],'transfereecalleridnum':_0x237e4e[_0xeff2('0x19')],'transfereecalleridname':_0x237e4e[_0xeff2('0x1a')],'transfereeconnectedlinenum':_0x237e4e[_0xeff2('0x23')],'transfereeconnectedlinename':_0x237e4e[_0xeff2('0x24')],'transfereeaccountcode':_0x237e4e[_0xeff2('0x25')],'transfereecontext':_0x237e4e[_0xeff2('0x26')],'transfereeexten':_0x237e4e['transfertargetexten'],'transfereelinkedid':_0x237e4e['transfertargetlinkedid']});}writeDB(_0x237e4e);}catch(_0x17f5fe){utils['error'](util[_0xeff2('0x3')](_0xeff2('0x15'),_0x237e4e[_0xeff2('0x7')]),_0x17f5fe);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 57fba38..ce7d221 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 _0x625a=['xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','length','getUserByInternal','found','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http'];(function(_0x4a91c1,_0xe61fec){var _0x10feda=function(_0x453834){while(--_0x453834){_0x4a91c1['push'](_0x4a91c1['shift']());}};_0x10feda(++_0xe61fec);}(_0x625a,0x15a));var _0xa625=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x625a[_0x3cea78];return _0x33b66b;};'use strict';var BPromise=require(_0xa625('0x0'));var jayson=require(_0xa625('0x1'));var moment=require(_0xa625('0x2'));var util=require(_0xa625('0x3'));var client=jayson[_0xa625('0x4')][_0xa625('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xa625('0x6'));exports[_0xa625('0x7')]=function(_0x4f6226,_0x1d3866){logger[_0xa625('0x7')](_0x4f6226,_0x1d3866?util['inspect'](_0x1d3866,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0x8')]=function(_0x597403,_0x18e302){logger['debug'](_0x597403,_0x18e302?util[_0xa625('0x9')](_0x18e302,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0xa')]=function(_0x5e7a27,_0xb414cb){logger[_0xa625('0xa')](_0x5e7a27,_0xb414cb?util[_0xa625('0x9')](_0xb414cb,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0xb')]=function(_0x3ace6d,_0x53e6ee){return client[_0xa625('0xb')](_0x3ace6d,{'body':_0x53e6ee})['then'](function(_0x1df2bf){logger['debug'](_0xa625('0xc'),_0x3ace6d,_0x1df2bf?util[_0xa625('0x9')](_0x1df2bf,{'showHidden':![],'depth':null}):'');})[_0xa625('0xd')](function(_0x86e1b7){logger['error']('[utils][request]\x20name:%s',_0x3ace6d,_0x86e1b7?util['inspect'](_0x86e1b7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4081bd){return client[_0xa625('0xb')](_0xa625('0xe'),{'options':{'raw':!![],'attributes':['id',_0xa625('0xf'),_0xa625('0x10'),_0xa625('0x11')],'where':_0x4081bd,'limit':0x1}})[_0xa625('0x12')](function(_0x1a68a2){logger[_0xa625('0x8')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x4081bd),_0x1a68a2?util['inspect'](_0x1a68a2,{'showHidden':![],'depth':null}):'');return _0x1a68a2['result'][_0xa625('0x13')]?_0x1a68a2['result'][0x0]:null;});}exports[_0xa625('0x14')]=function(_0x2b7a6c){return new BPromise(function(_0x149947,_0x260b57){if(_0x2b7a6c){return getUser({'internal':_0x2b7a6c})['then'](function(_0x210222){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2b7a6c,_0x210222?_0xa625('0x15'):_0xa625('0x16'));return _0x149947(_0x210222);})[_0xa625('0xd')](function(_0xbd9dec){logger[_0xa625('0xa')]('[utils][getUserByInternal]',_0xbd9dec?util[_0xa625('0x9')](_0xbd9dec,{'showHidden':![],'depth':null}):'');return _0x149947(null);});}return _0x149947(null);});};exports['getUserByInterface']=function(_0x412642){return new BPromise(function(_0x313a32,_0x2fb9bf){if(_0x412642){return getUser({'interface':_0x412642})[_0xa625('0x12')](function(_0x1ebda1){logger[_0xa625('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x412642,_0x1ebda1?_0xa625('0x15'):_0xa625('0x16'));return _0x313a32(_0x1ebda1);})[_0xa625('0xd')](function(_0xe308ba){logger['error'](_0xa625('0x17'),_0xe308ba?util['inspect'](_0xe308ba,{'showHidden':![],'depth':null}):'');return _0x313a32(null);});}return _0x313a32(null);});};exports['getUserByName']=function(_0xcffd26){return new BPromise(function(_0x251315,_0x224562){if(_0xcffd26){return getUser({'name':_0xcffd26})[_0xa625('0x12')](function(_0x1b38b1){logger[_0xa625('0x7')](_0xa625('0x18'),_0xcffd26,_0x1b38b1?_0xa625('0x15'):_0xa625('0x16'));return _0x251315(_0x1b38b1);})[_0xa625('0xd')](function(_0x4139b5){logger[_0xa625('0xa')](_0xa625('0x19'),_0x4139b5?util[_0xa625('0x9')](_0x4139b5,{'showHidden':![],'depth':null}):'');return _0x251315(null);});}return _0x251315(null);});};exports[_0xa625('0x1a')]=function(_0x1e6496){return new BPromise(function(_0x271056,_0xb0dad9){if(_0x1e6496){return client[_0xa625('0xb')](_0xa625('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xa625('0x10'),'type',_0xa625('0x1c'),_0xa625('0x1d')],'where':{'name':_0x1e6496},'limit':0x1}})['then'](function(_0xb5ab29){logger[_0xa625('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1e6496,_0xb5ab29?util[_0xa625('0x9')](_0xb5ab29,{'showHidden':![],'depth':null}):'');logger['info'](_0xa625('0x1e'),_0x1e6496,_0xb5ab29?_0xa625('0x15'):_0xa625('0x16'));return _0x271056(_0xb5ab29[_0xa625('0x1f')][_0xa625('0x13')]?_0xb5ab29['result'][0x0]:null);})[_0xa625('0xd')](function(_0x4d4df8){logger[_0xa625('0xa')](_0xa625('0x20'),_0x4d4df8?util[_0xa625('0x9')](_0x4d4df8,{'showHidden':![],'depth':null}):'');return _0x271056(null);});}return _0x271056(null);});};exports['addTime']=function(_0x2821e1,_0x24d579){return moment(_0x2821e1)[_0xa625('0x21')](_0x24d579,_0xa625('0x22'))[_0xa625('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa625('0x24')]=function(_0x2ee683,_0x357160){return moment(_0x2ee683)[_0xa625('0x25')](_0x357160,_0xa625('0x22'))['format'](_0xa625('0x26'));};exports[_0xa625('0x27')]=function(_0x344c57,_0x3816a1){return moment(_0x344c57)[_0xa625('0x28')](moment(_0x3816a1),_0xa625('0x22'));};exports['sumTime']=function(_0x1e9d3b,_0x145740){return parseInt(_0x1e9d3b,0xa)+parseInt(_0x145740,0xa);};exports[_0xa625('0x29')]=function(){return moment()[_0xa625('0x23')](_0xa625('0x26'));};exports[_0xa625('0x2a')]=function(_0x2b6d96,_0xe18013){if(_0xe18013){return moment(_0x2b6d96)[_0xa625('0x2a')](_0xe18013);}return!![];};exports[_0xa625('0x2b')]=function(_0x220080,_0x36e86f){if(_0x36e86f){return moment(_0x220080)[_0xa625('0x2b')](_0x36e86f);}else if(_0x220080){return!![];}return![];}; \ No newline at end of file +var _0xaecc=['notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','request','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s'];(function(_0x43cf79,_0x2bbc55){var _0x360ade=function(_0x4ea6d2){while(--_0x4ea6d2){_0x43cf79['push'](_0x43cf79['shift']());}};_0x360ade(++_0x2bbc55);}(_0xaecc,0x172));var _0xcaec=function(_0xf01579,_0x914885){_0xf01579=_0xf01579-0x0;var _0x146774=_0xaecc[_0xf01579];return _0x146774;};'use strict';var BPromise=require(_0xcaec('0x0'));var jayson=require('jayson/promise');var moment=require(_0xcaec('0x1'));var util=require(_0xcaec('0x2'));var client=jayson[_0xcaec('0x3')][_0xcaec('0x4')]({'port':0x2329});var logger=require(_0xcaec('0x5'))(_0xcaec('0x6'));exports[_0xcaec('0x7')]=function(_0x5ab26c,_0x366499){logger[_0xcaec('0x7')](_0x5ab26c,_0x366499?util[_0xcaec('0x8')](_0x366499,{'showHidden':![],'depth':null}):'');};exports[_0xcaec('0x9')]=function(_0x10d8f8,_0x270b40){logger[_0xcaec('0x9')](_0x10d8f8,_0x270b40?util[_0xcaec('0x8')](_0x270b40,{'showHidden':![],'depth':null}):'');};exports[_0xcaec('0xa')]=function(_0x505f4b,_0x2c6d02){logger[_0xcaec('0xa')](_0x505f4b,_0x2c6d02?util[_0xcaec('0x8')](_0x2c6d02,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x29f19e,_0xfd38f){return client['request'](_0x29f19e,{'body':_0xfd38f})[_0xcaec('0xb')](function(_0x4abdfa){logger[_0xcaec('0x9')](_0xcaec('0xc'),_0x29f19e,_0x4abdfa?util[_0xcaec('0x8')](_0x4abdfa,{'showHidden':![],'depth':null}):'');})[_0xcaec('0xd')](function(_0xd68ff2){logger['error'](_0xcaec('0xc'),_0x29f19e,_0xd68ff2?util[_0xcaec('0x8')](_0xd68ff2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x23b4c5){return client['request'](_0xcaec('0xe'),{'options':{'raw':!![],'attributes':['id',_0xcaec('0xf'),_0xcaec('0x10'),'interface'],'where':_0x23b4c5,'limit':0x1}})[_0xcaec('0xb')](function(_0x1272c9){logger[_0xcaec('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xcaec('0x11')](_0x23b4c5),_0x1272c9?util[_0xcaec('0x8')](_0x1272c9,{'showHidden':![],'depth':null}):'');return _0x1272c9[_0xcaec('0x12')][_0xcaec('0x13')]?_0x1272c9['result'][0x0]:null;});}exports[_0xcaec('0x14')]=function(_0x33dc4e){return new BPromise(function(_0x19b83b,_0x250db3){if(_0x33dc4e){return getUser({'internal':_0x33dc4e})[_0xcaec('0xb')](function(_0x59518e){logger[_0xcaec('0x7')](_0xcaec('0x15'),_0x33dc4e,_0x59518e?'found':_0xcaec('0x16'));return _0x19b83b(_0x59518e);})[_0xcaec('0xd')](function(_0x43de16){logger[_0xcaec('0xa')](_0xcaec('0x17'),_0x43de16?util[_0xcaec('0x8')](_0x43de16,{'showHidden':![],'depth':null}):'');return _0x19b83b(null);});}return _0x19b83b(null);});};exports[_0xcaec('0x18')]=function(_0x30312e){return new BPromise(function(_0x2124ac,_0x23dd41){if(_0x30312e){return getUser({'interface':_0x30312e})[_0xcaec('0xb')](function(_0x42683a){logger['info'](_0xcaec('0x19'),_0x30312e,_0x42683a?_0xcaec('0x1a'):_0xcaec('0x16'));return _0x2124ac(_0x42683a);})[_0xcaec('0xd')](function(_0x381399){logger[_0xcaec('0xa')](_0xcaec('0x1b'),_0x381399?util[_0xcaec('0x8')](_0x381399,{'showHidden':![],'depth':null}):'');return _0x2124ac(null);});}return _0x2124ac(null);});};exports[_0xcaec('0x1c')]=function(_0x2732a1){return new BPromise(function(_0x8baeec,_0x23e22a){if(_0x2732a1){return getUser({'name':_0x2732a1})['then'](function(_0x4c4193){logger[_0xcaec('0x7')](_0xcaec('0x1d'),_0x2732a1,_0x4c4193?_0xcaec('0x1a'):'notfound');return _0x8baeec(_0x4c4193);})[_0xcaec('0xd')](function(_0x32ee0e){logger['error'](_0xcaec('0x1e'),_0x32ee0e?util['inspect'](_0x32ee0e,{'showHidden':![],'depth':null}):'');return _0x8baeec(null);});}return _0x8baeec(null);});};exports['getVoiceQueueByName']=function(_0x4aa29d){return new BPromise(function(_0x203099,_0x3c3df8){if(_0x4aa29d){return client[_0xcaec('0x1f')](_0xcaec('0x20'),{'options':{'raw':!![],'attributes':['id',_0xcaec('0x10'),_0xcaec('0x21'),'acw',_0xcaec('0x22')],'where':{'name':_0x4aa29d},'limit':0x1}})[_0xcaec('0xb')](function(_0x5befeb){logger['debug'](_0xcaec('0x23'),_0x4aa29d,_0x5befeb?util[_0xcaec('0x8')](_0x5befeb,{'showHidden':![],'depth':null}):'');logger[_0xcaec('0x7')](_0xcaec('0x24'),_0x4aa29d,_0x5befeb?_0xcaec('0x1a'):'notfound');return _0x203099(_0x5befeb['result'][_0xcaec('0x13')]?_0x5befeb[_0xcaec('0x12')][0x0]:null);})['catch'](function(_0x309955){logger['error'](_0xcaec('0x25'),_0x309955?util[_0xcaec('0x8')](_0x309955,{'showHidden':![],'depth':null}):'');return _0x203099(null);});}return _0x203099(null);});};exports[_0xcaec('0x26')]=function(_0x5bf7d7,_0x1c2ebb){return moment(_0x5bf7d7)[_0xcaec('0x27')](_0x1c2ebb,'seconds')['format'](_0xcaec('0x28'));};exports[_0xcaec('0x29')]=function(_0x1e332b,_0xda8795){return moment(_0x1e332b)['subtract'](_0xda8795,'seconds')[_0xcaec('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xcaec('0x2b')]=function(_0x401d0a,_0x26eaa1){return moment(_0x401d0a)[_0xcaec('0x2c')](moment(_0x26eaa1),'seconds');};exports[_0xcaec('0x2d')]=function(_0x28a177,_0x5f1306){return parseInt(_0x28a177,0xa)+parseInt(_0x5f1306,0xa);};exports[_0xcaec('0x2e')]=function(){return moment()[_0xcaec('0x2a')](_0xcaec('0x28'));};exports['isAfter']=function(_0x538cfe,_0x16a4ec){if(_0x16a4ec){return moment(_0x538cfe)[_0xcaec('0x2f')](_0x16a4ec);}return!![];};exports['isBefore']=function(_0x1ab55b,_0x46e872){if(_0x46e872){return moment(_0x1ab55b)[_0xcaec('0x30')](_0x46e872);}else if(_0x1ab55b){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 112ed6e..d9dbfa4 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 _0xd605=['path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','api','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','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','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','other','agent_name','test','setupLoggers','fs-extra','express-winston'];(function(_0x40e454,_0xfb8102){var _0x4340e9=function(_0x28f1b2){while(--_0x28f1b2){_0x40e454['push'](_0x40e454['shift']());}};_0x4340e9(++_0xfb8102);}(_0xd605,0xf3));var _0x5d60=function(_0x448ae2,_0x309172){_0x448ae2=_0x448ae2-0x0;var _0x2bfa92=_0xd605[_0x448ae2];return _0x2bfa92;};var fs=require(_0x5d60('0x0'));var _=require('lodash');var ewinston=require(_0x5d60('0x1'));var path=require(_0x5d60('0x2'));var util=require('util');var fileLogger=require(_0x5d60('0x3'))[_0x5d60('0x4')];var safeTemplate=require(_0x5d60('0x5'))[_0x5d60('0x6')];var maskSensitiveData=require(_0x5d60('0x7'))[_0x5d60('0x8')];function ClientSideLogger(){function _0x3d856b(_0x41d1fb){var _0x23a905=path[_0x5d60('0x9')](_0x5d60('0xa'),_0x5d60('0xb'),_0x5d60('0xc'));var _0x4ecae5=path['join'](_0x5d60('0xd'),_0x41d1fb[_0x5d60('0xe')]+'-'+_0x41d1fb['name']);return fs[_0x5d60('0xf')](path['join'](_0x23a905,_0x4ecae5))[_0x5d60('0x10')](function(){var _0x39bf4c=fileLogger('client',path[_0x5d60('0x9')](_0x23a905,_0x4ecae5));return _0x39bf4c;})[_0x5d60('0x11')](function(_0x1afa0a){throw _0x1afa0a;});}this[_0x5d60('0xb')]=function(_0x104ac3,_0x21cf1d,_0x591850,_0x1e81df){return _0x3d856b(_0x104ac3[_0x5d60('0x12')])[_0x5d60('0x10')](function(_0x4d65e7){var _0x3e9818=_0x4d65e7[_0x21cf1d];return _0x3e9818;})[_0x5d60('0x10')](function(_0x1c77cc){var _0x256d25=_0x104ac3['user']?_0x104ac3[_0x5d60('0x12')]['id']:_0x5d60('0x13');var _0x3d66d0=_0x1e81df[_0x5d60('0x14')];var _0x23ad17=_0x1e81df[_0x5d60('0x15')];var _0x18294b=new Date(Number(_0x23ad17));return _0x1c77cc(_0x256d25,_0x18294b,_0x591850,_0x3d66d0);})['catch'](function(_0x337b66){fileLogger(_0x5d60('0xd'))[_0x5d60('0x16')](_0x337b66);});};}function setupLoggers(_0x498096){return new Promise(function(_0xd9b38){var _0x4a46ac=new ClientSideLogger();var _0x318042=fileLogger(_0x5d60('0x17'));var _0x45a6ed=fileLogger('auth');_0x498096[_0x5d60('0x18')]('client-side-logger',_0x4a46ac);_0x498096[_0x5d60('0x19')](ewinston['logger']({'winstonInstance':_0x318042,'meta':![],'statusLevels':!![],'msg':function(_0x4ea24f,_0x9fed5b){var _0x58d261=_0x5d60('0x1a');if(!_[_0x5d60('0x1b')](_0x4ea24f[_0x5d60('0x1c')])){_0x58d261+=_0x5d60('0x1d');var _0x139ab0=_0x4ea24f[_0x5d60('0x1c')];maskSensitiveData(_0x139ab0);}return safeTemplate(util[_0x5d60('0x1e')](_0x58d261,_0x4ea24f[_0x5d60('0x1f')],_0x4ea24f['headers']['x-forwarded-for']?_0x4ea24f['headers'][_0x5d60('0x20')]:_0x4ea24f[_0x5d60('0x21')][_0x5d60('0x22')]||_0x4ea24f['ip'],_0x4ea24f[_0x5d60('0x23')],_0x9fed5b[_0x5d60('0x24')],_0x9fed5b[_0x5d60('0x25')],_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')]['id']:null,_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')]['name']:null,_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')][_0x5d60('0xe')]:null,_0x139ab0?util[_0x5d60('0x26')](_0x139ab0,![],null):''));}}));_0x498096[_0x5d60('0x19')](ewinston[_0x5d60('0x27')]({'winstonInstance':_0x45a6ed,'meta':![],'statusLevels':!![],'msg':function(_0x4af388,_0x21a55b){var _0xc1d0f7=_0x5d60('0x28');if(_0x4af388[_0x5d60('0x1c')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2a')]){_0xc1d0f7=_0x5d60('0x2b');}return util['format'](_0xc1d0f7,_0x4af388['method'],_0x4af388['headers'][_0x5d60('0x20')]?_0x4af388[_0x5d60('0x2c')][_0x5d60('0x20')]:_0x4af388['connection'][_0x5d60('0x22')]||_0x4af388['ip'],_0x4af388[_0x5d60('0x23')],_0x21a55b[_0x5d60('0x24')],_0x21a55b['responseTime'],_0x4af388[_0x5d60('0x12')]?_0x4af388[_0x5d60('0x12')]['id']:null,_0x4af388['user']?_0x4af388[_0x5d60('0x12')]['name']:null,_0x4af388[_0x5d60('0x12')]?_0x4af388[_0x5d60('0x12')][_0x5d60('0xe')]:null,_0x4af388[_0x5d60('0x1c')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]:_0x5d60('0x2d'),_0x4af388['body']&&_0x4af388['body'][_0x5d60('0x2a')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2a')]:'',_0x4af388[_0x5d60('0x1c')]&&_0x4af388['body'][_0x5d60('0x2e')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2e')]:'');},'ignoreRoute':function(_0x3bebe4){var _0xf4f645=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf4f645[_0x5d60('0x2f')](_0x3bebe4[_0x5d60('0x23')]);}}));return _0xd9b38();});}exports[_0x5d60('0x30')]=setupLoggers; \ No newline at end of file +var _0xe31b=['lodash','express-winston','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','agent_name','test','setupLoggers','fs-extra'];(function(_0x53b135,_0x3aa0d3){var _0x56e52f=function(_0x2159e4){while(--_0x2159e4){_0x53b135['push'](_0x53b135['shift']());}};_0x56e52f(++_0x3aa0d3);}(_0xe31b,0xf4));var _0xbe31=function(_0x37d8ae,_0x17e484){_0x37d8ae=_0x37d8ae-0x0;var _0x4de500=_0xe31b[_0x37d8ae];return _0x4de500;};var fs=require(_0xbe31('0x0'));var _=require(_0xbe31('0x1'));var ewinston=require(_0xbe31('0x2'));var path=require(_0xbe31('0x3'));var util=require('util');var fileLogger=require(_0xbe31('0x4'))[_0xbe31('0x5')];var safeTemplate=require('./safe-template')[_0xbe31('0x6')];var maskSensitiveData=require(_0xbe31('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x5e78e6(_0x26be20){var _0x3f9e85=path[_0xbe31('0x8')](_0xbe31('0x9'),_0xbe31('0xa'),_0xbe31('0xb'));var _0x5c12a3=path[_0xbe31('0x8')](_0xbe31('0xc'),_0x26be20[_0xbe31('0xd')]+'-'+_0x26be20[_0xbe31('0xe')]);return fs[_0xbe31('0xf')](path[_0xbe31('0x8')](_0x3f9e85,_0x5c12a3))[_0xbe31('0x10')](function(){var _0x49b783=fileLogger('client',path['join'](_0x3f9e85,_0x5c12a3));return _0x49b783;})[_0xbe31('0x11')](function(_0x1de9d5){throw _0x1de9d5;});}this['log']=function(_0x1148ce,_0x5edcbb,_0x476822,_0x25a102){return _0x5e78e6(_0x1148ce['user'])['then'](function(_0x4675b4){var _0x3a3479=_0x4675b4[_0x5edcbb];return _0x3a3479;})[_0xbe31('0x10')](function(_0x3e7bfe){var _0x121524=_0x1148ce['user']?_0x1148ce[_0xbe31('0x12')]['id']:_0xbe31('0x13');var _0x2b9139=_0x25a102[_0xbe31('0x14')];var _0x56375b=_0x25a102[_0xbe31('0x15')];var _0xff3e4a=new Date(Number(_0x56375b));return _0x3e7bfe(_0x121524,_0xff3e4a,_0x476822,_0x2b9139);})[_0xbe31('0x11')](function(_0x365681){fileLogger(_0xbe31('0xc'))[_0xbe31('0x16')](_0x365681);});};}function setupLoggers(_0x1e43e2){return new Promise(function(_0x5a3870){var _0x170396=new ClientSideLogger();var _0xfb62f3=fileLogger(_0xbe31('0x17'));var _0x40a07e=fileLogger(_0xbe31('0x18'));_0x1e43e2[_0xbe31('0x19')](_0xbe31('0x1a'),_0x170396);_0x1e43e2[_0xbe31('0x1b')](ewinston[_0xbe31('0x1c')]({'winstonInstance':_0xfb62f3,'meta':![],'statusLevels':!![],'msg':function(_0x132140,_0x5f2d90){var _0x5ec6e1=_0xbe31('0x1d');if(!_['isEmpty'](_0x132140[_0xbe31('0x1e')])){_0x5ec6e1+=_0xbe31('0x1f');var _0x5d0eee=_0x132140[_0xbe31('0x1e')];maskSensitiveData(_0x5d0eee);}return safeTemplate(util['format'](_0x5ec6e1,_0x132140[_0xbe31('0x20')],_0x132140['headers'][_0xbe31('0x21')]?_0x132140[_0xbe31('0x22')]['x-forwarded-for']:_0x132140[_0xbe31('0x23')][_0xbe31('0x24')]||_0x132140['ip'],_0x132140['url'],_0x5f2d90[_0xbe31('0x25')],_0x5f2d90[_0xbe31('0x26')],_0x132140[_0xbe31('0x12')]?_0x132140[_0xbe31('0x12')]['id']:null,_0x132140[_0xbe31('0x12')]?_0x132140['user'][_0xbe31('0xe')]:null,_0x132140[_0xbe31('0x12')]?_0x132140[_0xbe31('0x12')][_0xbe31('0xd')]:null,_0x5d0eee?util[_0xbe31('0x27')](_0x5d0eee,![],null):''));}}));_0x1e43e2[_0xbe31('0x1b')](ewinston[_0xbe31('0x1c')]({'winstonInstance':_0x40a07e,'meta':![],'statusLevels':!![],'msg':function(_0x20ac59,_0x138db3){var _0x5b0a32=_0xbe31('0x28');if(_0x20ac59[_0xbe31('0x1e')]&&_0x20ac59[_0xbe31('0x1e')][_0xbe31('0x29')]&&_0x20ac59[_0xbe31('0x1e')][_0xbe31('0x2a')]){_0x5b0a32=_0xbe31('0x2b');}return util[_0xbe31('0x2c')](_0x5b0a32,_0x20ac59['method'],_0x20ac59[_0xbe31('0x22')][_0xbe31('0x21')]?_0x20ac59[_0xbe31('0x22')][_0xbe31('0x21')]:_0x20ac59[_0xbe31('0x23')][_0xbe31('0x24')]||_0x20ac59['ip'],_0x20ac59[_0xbe31('0x2d')],_0x138db3[_0xbe31('0x25')],_0x138db3['responseTime'],_0x20ac59['user']?_0x20ac59[_0xbe31('0x12')]['id']:null,_0x20ac59['user']?_0x20ac59[_0xbe31('0x12')][_0xbe31('0xe')]:null,_0x20ac59[_0xbe31('0x12')]?_0x20ac59[_0xbe31('0x12')][_0xbe31('0xd')]:null,_0x20ac59[_0xbe31('0x1e')]&&_0x20ac59[_0xbe31('0x1e')][_0xbe31('0x29')]?_0x20ac59[_0xbe31('0x1e')][_0xbe31('0x29')]:'other',_0x20ac59[_0xbe31('0x1e')]&&_0x20ac59['body']['agent_id']?_0x20ac59[_0xbe31('0x1e')]['agent_id']:'',_0x20ac59[_0xbe31('0x1e')]&&_0x20ac59[_0xbe31('0x1e')][_0xbe31('0x2e')]?_0x20ac59[_0xbe31('0x1e')]['agent_name']:'');},'ignoreRoute':function(_0x865a49){var _0xde90f4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xde90f4[_0xbe31('0x2f')](_0x865a49[_0xbe31('0x2d')]);}}));return _0x5a3870();});}exports[_0xbe31('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 82ff28f..a13e464 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3526=['locale','indexOf','slice','exports','monthsShort','concat','circularMonthInterval','hours','minutes','clone','isBefore','endOf','day','isBetween','format','includes','daysInMonth','max','min','MMM','monthCompare','guess','test','isMoment','split','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','weekdaysShort','toLowerCase'];(function(_0x2f5d63,_0x2f6efe){var _0x7da526=function(_0x583422){while(--_0x583422){_0x2f5d63['push'](_0x2f5d63['shift']());}};_0x7da526(++_0x2f6efe);}(_0x3526,0x65));var _0x6352=function(_0x3703ed,_0x5bb358){_0x3703ed=_0x3703ed-0x0;var _0x1b3809=_0x3526[_0x3703ed];return _0x1b3809;};var _=require(_0x6352('0x0'));var moment=require(_0x6352('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x6352('0x2')](function(_0xd41d28){return _0xd41d28[_0x6352('0x3')];})[_0x6352('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6352('0x5');var EINVALID_DATE=_0x6352('0x6');function throwIfDateNotValid(_0x5ddd08){if(!_0x5ddd08[_0x6352('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x24935e){var _0x254ec7=_0x24935e['split'](':')[_0x6352('0x2')](function(_0x17db18){return parseInt(_0x17db18,0xa);});var _0x3f9e4c=_0x254ec7[0x0];var _0x1264ba=_0x254ec7[0x1];if(_0x3f9e4c<0x0||_0x3f9e4c>0x17||_0x1264ba<0x0||_0x1264ba>0x3b){throw new Error(EINVALID_DATE);}return[_0x3f9e4c,_0x1264ba];}function circularDoWInterval(_0x2c5d82,_0x516a00){if(_0x2c5d82===_0x516a00){return[_0x2c5d82];}else{var _0x1410b3=moment['locale']();moment['locale']('en');var _0x2e1d85=moment[_0x6352('0x8')]()[_0x6352('0x2')](function(_0x3260b6){return _0x3260b6[_0x6352('0x9')]();});moment[_0x6352('0xa')](_0x1410b3);var _0x2b75e6=_0x2e1d85['indexOf'](_0x2c5d82);var _0x56d596=_0x2e1d85[_0x6352('0xb')](_0x516a00);if(_0x56d596>_0x2b75e6){return _0x2e1d85[_0x6352('0xc')](_0x2b75e6,_0x56d596+0x1);}else{var _0x5afcbc=_0x2e1d85[_0x6352('0xc')](0x0,_0x56d596+0x1);var _0x441a9a=_0x2e1d85[_0x6352('0xc')](_0x2b75e6);return _0x441a9a['concat'](_0x5afcbc);}}}module[_0x6352('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xaecdad,_0x57f987){if(_0xaecdad===_0x57f987){return[_0xaecdad];}else{var _0x2e6671=moment[_0x6352('0xa')]();moment['locale']('en');var _0x4b0607=moment[_0x6352('0xe')]()[_0x6352('0x2')](function(_0x2fbcfd){return _0x2fbcfd['toLowerCase']();});moment['locale'](_0x2e6671);var _0x19c082=_0x4b0607[_0x6352('0xb')](_0xaecdad);var _0x49563f=_0x4b0607[_0x6352('0xb')](_0x57f987);if(_0x49563f>_0x19c082){return _0x4b0607[_0x6352('0xc')](_0x19c082,_0x49563f+0x1);}else{var _0x369174=_0x4b0607[_0x6352('0xc')](0x0,_0x49563f+0x1);var _0x28c274=_0x4b0607[_0x6352('0xc')](_0x19c082);return _0x28c274[_0x6352('0xf')](_0x369174);}}}module['exports'][_0x6352('0x10')]=circularMonthInterval;function parseDom(_0x2af48f){var _0x5ac87b=parseInt(_0x2af48f,0xa);if(_0x5ac87b<0x1||_0x5ac87b>0x1f){throw new Error(EINVALID_DATE);}return _0x5ac87b;}function timeCompare(_0x138a93,_0x898674,_0x192a22){var _0x1cf735=_0x138a93['clone']();var _0x1b0ae0=extractTime(_0x898674);var _0x5e7725=_0x1b0ae0[0x0];var _0x2ac48b=_0x1b0ae0[0x1];var _0x3d8b93=_0x138a93['clone']()[_0x6352('0x11')](_0x5e7725)[_0x6352('0x12')](_0x2ac48b);throwIfDateNotValid(_0x3d8b93);var _0x7d2b94=extractTime(_0x192a22);var _0x12c563=_0x7d2b94[0x0];var _0x559a7e=_0x7d2b94[0x1];var _0x547268=_0x138a93[_0x6352('0x13')]()['hours'](_0x12c563)[_0x6352('0x12')](_0x559a7e);throwIfDateNotValid(_0x547268);if(_0x547268[_0x6352('0x14')](_0x3d8b93)){var _0x1c59a1=_0x1cf735[_0x6352('0x13')]()['startOf']('day');var _0x28b771=_0x1cf735[_0x6352('0x13')]()[_0x6352('0x15')](_0x6352('0x16'));return _0x1cf735['isBetween'](_0x3d8b93,_0x28b771,undefined,'[]')||_0x1cf735[_0x6352('0x17')](_0x1c59a1,_0x547268,undefined,'[]');}else{return _0x1cf735[_0x6352('0x17')](_0x3d8b93,_0x547268,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x2901ee,_0x41b616,_0x2d81ad){var _0x347d54=_0x2901ee[_0x6352('0xa')]('en')[_0x6352('0x18')]('ddd')[_0x6352('0x9')]();return circularDoWInterval(_0x41b616,_0x2d81ad)[_0x6352('0x19')](_0x347d54);}module[_0x6352('0xd')]['dowCompare']=dowCompare;function domCompare(_0x4e4179,_0x14c509,_0x1683bc){var _0xc53fe=_0x4e4179['date']();if(_0x14c509===_0x1683bc){return _0xc53fe===_0x14c509;}else{var _0x33f59e=_0x4e4179[_0x6352('0x1a')]();var _0x35cc11=_0x14c509<_0x1683bc;let _0x54cffe=![];var _0x14fa0b=0x0;var _0x47fd73=0x0;if(_0x35cc11){_0x14fa0b=Math[_0x6352('0x1b')](0x1,_0x14c509);_0x47fd73=Math[_0x6352('0x1c')](_0x1683bc,_0x33f59e);_0x54cffe=_0xc53fe>=_0x14fa0b&&_0xc53fe<=_0x47fd73;}else{_0x14fa0b=Math[_0x6352('0x1c')](_0x14c509,_0x33f59e);_0x47fd73=Math['max'](0x1,_0x1683bc);_0x54cffe=_0xc53fe>=_0x14fa0b||_0xc53fe<=_0x47fd73;}return _0x54cffe;}}module[_0x6352('0xd')]['domCompare']=domCompare;function monthCompare(_0x27af96,_0x1a6f16,_0x2b5c78){var _0x4f546f=_0x27af96[_0x6352('0xa')]('en')[_0x6352('0x18')](_0x6352('0x1d'))[_0x6352('0x9')]();return circularMonthInterval(_0x1a6f16,_0x2b5c78)['includes'](_0x4f546f);}module[_0x6352('0xd')][_0x6352('0x1e')]=monthCompare;function iftime(_0x4426aa,_0x218eab=moment['tz'][_0x6352('0x1f')](),_0x52e94c=moment()){if(!validateRx[_0x6352('0x20')](_0x4426aa)){throw new Error(EINVALID_STRING);}else{var _0x56ad0e=(moment[_0x6352('0x21')](_0x52e94c)?_0x52e94c[_0x6352('0x13')]():moment(_0x52e94c))['tz'](_0x218eab)[_0x6352('0xa')]('en');throwIfDateNotValid(_0x56ad0e);var _0x2dee70=_0x4426aa['split'](',');var _0x2349fd=_0x2dee70[0x0];var _0x2bf4bc=_0x2dee70[0x1];var _0x590750=_0x2dee70[0x2];var _0x2ed757=_0x2dee70[0x3];let _0x5867b6=!![];if(_0x2349fd!=='*'){var _0x460711=_0x2349fd[_0x6352('0x22')]('-');var _0x25312b=_['padStart'](_0x460711[0x0],0x5,'0');var _0x33e4f9=_0x460711[_0x6352('0x23')]===0x2?_['padStart'](_0x460711[0x1],0x5,'0'):_0x25312b;_0x5867b6=timeCompare(_0x56ad0e,_0x25312b,_0x33e4f9);}let _0x36f34c=!![];if(_0x2bf4bc!=='*'){var _0x1199cb=_0x2bf4bc[_0x6352('0x22')]('-');var _0x1480e1=_0x1199cb[0x0];var _0x491f49=_0x1199cb['length']===0x2?_0x1199cb[0x1]:_0x1480e1;_0x36f34c=dowCompare(_0x56ad0e,_0x1480e1,_0x491f49);}let _0x4cc7ad=!![];if(_0x590750!=='*'){var _0x1778fb=_0x590750[_0x6352('0x22')]('-');var _0x7c2e60=parseDom(_0x1778fb[0x0]);var _0x1359d0=_0x1778fb[_0x6352('0x23')]===0x2?parseDom(_0x1778fb[0x1]):_0x7c2e60;_0x4cc7ad=domCompare(_0x56ad0e,_0x7c2e60,_0x1359d0);}let _0x15d32d=!![];if(_0x2ed757!=='*'){var _0x30c9a1=_0x2ed757[_0x6352('0x22')]('-');var _0x2c6810=_0x30c9a1[0x0];var _0x16cf5e=_0x30c9a1[_0x6352('0x23')]===0x2?_0x30c9a1[0x1]:_0x30c9a1[0x0];_0x15d32d=monthCompare(_0x56ad0e,_0x2c6810,_0x16cf5e);}return _0x5867b6&&_0x36f34c&&_0x4cc7ad&&_0x15d32d;}}module['exports'][_0x6352('0x24')]=iftime; \ No newline at end of file +var _0x3121=['guess','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','exports','clone','hours','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','date','min','domCompare','MMM'];(function(_0x5b3bca,_0x4b0a40){var _0x3edace=function(_0x53619b){while(--_0x53619b){_0x5b3bca['push'](_0x5b3bca['shift']());}};_0x3edace(++_0x4b0a40);}(_0x3121,0x1f2));var _0x1312=function(_0x133bbc,_0x370588){_0x133bbc=_0x133bbc-0x0;var _0x1a531a=_0x3121[_0x133bbc];return _0x1a531a;};var _=require(_0x1312('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1312('0x1')](function(_0x43469b){return _0x43469b[_0x1312('0x2')];})[_0x1312('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1312('0x4');var EINVALID_DATE=_0x1312('0x5');function throwIfDateNotValid(_0x412ce0){if(!_0x412ce0['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x39bae4){var _0x2a0f88=_0x39bae4[_0x1312('0x6')](':')[_0x1312('0x1')](function(_0x52de47){return parseInt(_0x52de47,0xa);});var _0xf0ac77=_0x2a0f88[0x0];var _0x493424=_0x2a0f88[0x1];if(_0xf0ac77<0x0||_0xf0ac77>0x17||_0x493424<0x0||_0x493424>0x3b){throw new Error(EINVALID_DATE);}return[_0xf0ac77,_0x493424];}function circularDoWInterval(_0x375206,_0x38b10f){if(_0x375206===_0x38b10f){return[_0x375206];}else{var _0x22fafb=moment['locale']();moment[_0x1312('0x7')]('en');var _0x193799=moment[_0x1312('0x8')]()[_0x1312('0x1')](function(_0x46398a){return _0x46398a[_0x1312('0x9')]();});moment['locale'](_0x22fafb);var _0x4e5f2a=_0x193799[_0x1312('0xa')](_0x375206);var _0x54fbc0=_0x193799['indexOf'](_0x38b10f);if(_0x54fbc0>_0x4e5f2a){return _0x193799['slice'](_0x4e5f2a,_0x54fbc0+0x1);}else{var _0x2e98fa=_0x193799['slice'](0x0,_0x54fbc0+0x1);var _0x5ab1ac=_0x193799[_0x1312('0xb')](_0x4e5f2a);return _0x5ab1ac[_0x1312('0xc')](_0x2e98fa);}}}module['exports'][_0x1312('0xd')]=circularDoWInterval;function circularMonthInterval(_0x276f8c,_0x51c838){if(_0x276f8c===_0x51c838){return[_0x276f8c];}else{var _0x51a444=moment[_0x1312('0x7')]();moment['locale']('en');var _0x1e252f=moment['monthsShort']()[_0x1312('0x1')](function(_0x6f5e17){return _0x6f5e17[_0x1312('0x9')]();});moment['locale'](_0x51a444);var _0x107c8a=_0x1e252f[_0x1312('0xa')](_0x276f8c);var _0x76a6a=_0x1e252f[_0x1312('0xa')](_0x51c838);if(_0x76a6a>_0x107c8a){return _0x1e252f[_0x1312('0xb')](_0x107c8a,_0x76a6a+0x1);}else{var _0x28616c=_0x1e252f['slice'](0x0,_0x76a6a+0x1);var _0x344bf6=_0x1e252f[_0x1312('0xb')](_0x107c8a);return _0x344bf6[_0x1312('0xc')](_0x28616c);}}}module[_0x1312('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x1e5fd5){var _0x581fa7=parseInt(_0x1e5fd5,0xa);if(_0x581fa7<0x1||_0x581fa7>0x1f){throw new Error(EINVALID_DATE);}return _0x581fa7;}function timeCompare(_0x131955,_0x3b100a,_0x5e8cd2){var _0x1fe6b0=_0x131955[_0x1312('0xf')]();var _0x1d0121=extractTime(_0x3b100a);var _0xd40038=_0x1d0121[0x0];var _0x3557f6=_0x1d0121[0x1];var _0x29a552=_0x131955['clone']()[_0x1312('0x10')](_0xd40038)['minutes'](_0x3557f6);throwIfDateNotValid(_0x29a552);var _0x52d705=extractTime(_0x5e8cd2);var _0x4162c8=_0x52d705[0x0];var _0x382214=_0x52d705[0x1];var _0x2cf779=_0x131955[_0x1312('0xf')]()[_0x1312('0x10')](_0x4162c8)['minutes'](_0x382214);throwIfDateNotValid(_0x2cf779);if(_0x2cf779[_0x1312('0x11')](_0x29a552)){var _0x2a2c3a=_0x1fe6b0[_0x1312('0xf')]()[_0x1312('0x12')](_0x1312('0x13'));var _0x5a359c=_0x1fe6b0[_0x1312('0xf')]()[_0x1312('0x14')](_0x1312('0x13'));return _0x1fe6b0[_0x1312('0x15')](_0x29a552,_0x5a359c,undefined,'[]')||_0x1fe6b0[_0x1312('0x15')](_0x2a2c3a,_0x2cf779,undefined,'[]');}else{return _0x1fe6b0[_0x1312('0x15')](_0x29a552,_0x2cf779,undefined,'[]');}}module[_0x1312('0xe')][_0x1312('0x16')]=timeCompare;function dowCompare(_0x5828c5,_0x422dc6,_0x131b45){var _0x5cb4c4=_0x5828c5['locale']('en')[_0x1312('0x17')](_0x1312('0x18'))[_0x1312('0x9')]();return circularDoWInterval(_0x422dc6,_0x131b45)[_0x1312('0x19')](_0x5cb4c4);}module[_0x1312('0xe')]['dowCompare']=dowCompare;function domCompare(_0x2a3f6f,_0x346136,_0x798ea7){var _0x4f5815=_0x2a3f6f[_0x1312('0x1a')]();if(_0x346136===_0x798ea7){return _0x4f5815===_0x346136;}else{var _0x837b0d=_0x2a3f6f['daysInMonth']();var _0x5bb738=_0x346136<_0x798ea7;let _0x5b65b0=![];var _0x1a6477=0x0;var _0x3f6e66=0x0;if(_0x5bb738){_0x1a6477=Math['max'](0x1,_0x346136);_0x3f6e66=Math[_0x1312('0x1b')](_0x798ea7,_0x837b0d);_0x5b65b0=_0x4f5815>=_0x1a6477&&_0x4f5815<=_0x3f6e66;}else{_0x1a6477=Math[_0x1312('0x1b')](_0x346136,_0x837b0d);_0x3f6e66=Math['max'](0x1,_0x798ea7);_0x5b65b0=_0x4f5815>=_0x1a6477||_0x4f5815<=_0x3f6e66;}return _0x5b65b0;}}module[_0x1312('0xe')][_0x1312('0x1c')]=domCompare;function monthCompare(_0x57b915,_0x17ddc2,_0x38388a){var _0x1b3a8b=_0x57b915[_0x1312('0x7')]('en')[_0x1312('0x17')](_0x1312('0x1d'))[_0x1312('0x9')]();return circularMonthInterval(_0x17ddc2,_0x38388a)[_0x1312('0x19')](_0x1b3a8b);}module[_0x1312('0xe')]['monthCompare']=monthCompare;function iftime(_0x18a48e,_0x3d5ac3=moment['tz'][_0x1312('0x1e')](),_0x23b0e5=moment()){if(!validateRx['test'](_0x18a48e)){throw new Error(EINVALID_STRING);}else{var _0x406d59=(moment['isMoment'](_0x23b0e5)?_0x23b0e5[_0x1312('0xf')]():moment(_0x23b0e5))['tz'](_0x3d5ac3)[_0x1312('0x7')]('en');throwIfDateNotValid(_0x406d59);var _0x3e074c=_0x18a48e['split'](',');var _0x45560d=_0x3e074c[0x0];var _0x2f3bc7=_0x3e074c[0x1];var _0x49ea06=_0x3e074c[0x2];var _0x5f1a2d=_0x3e074c[0x3];let _0x4cdd72=!![];if(_0x45560d!=='*'){var _0x115554=_0x45560d[_0x1312('0x6')]('-');var _0x549037=_[_0x1312('0x1f')](_0x115554[0x0],0x5,'0');var _0x488ac9=_0x115554['length']===0x2?_[_0x1312('0x1f')](_0x115554[0x1],0x5,'0'):_0x549037;_0x4cdd72=timeCompare(_0x406d59,_0x549037,_0x488ac9);}let _0x121b65=!![];if(_0x2f3bc7!=='*'){var _0x5e2696=_0x2f3bc7[_0x1312('0x6')]('-');var _0x3dc358=_0x5e2696[0x0];var _0x2110da=_0x5e2696[_0x1312('0x20')]===0x2?_0x5e2696[0x1]:_0x3dc358;_0x121b65=dowCompare(_0x406d59,_0x3dc358,_0x2110da);}let _0x362c9e=!![];if(_0x49ea06!=='*'){var _0x47ee11=_0x49ea06[_0x1312('0x6')]('-');var _0x595c69=parseDom(_0x47ee11[0x0]);var _0xd7803=_0x47ee11[_0x1312('0x20')]===0x2?parseDom(_0x47ee11[0x1]):_0x595c69;_0x362c9e=domCompare(_0x406d59,_0x595c69,_0xd7803);}let _0x3cb956=!![];if(_0x5f1a2d!=='*'){var _0x17f48c=_0x5f1a2d[_0x1312('0x6')]('-');var _0xb14273=_0x17f48c[0x0];var _0x257763=_0x17f48c[_0x1312('0x20')]===0x2?_0x17f48c[0x1]:_0x17f48c[0x0];_0x3cb956=monthCompare(_0x406d59,_0xb14273,_0x257763);}return _0x4cdd72&&_0x121b65&&_0x362c9e&&_0x3cb956;}}module[_0x1312('0xe')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f8c4769..ad83164 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d4b=['{{{','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','transports','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','join','%s-%s.log','message'];(function(_0x38782c,_0x5c9fef){var _0x3708bf=function(_0x595e13){while(--_0x595e13){_0x38782c['push'](_0x38782c['shift']());}};_0x3708bf(++_0x5c9fef);}(_0x5d4b,0x105));var _0xb5d4=function(_0x304d85,_0x3bd383){_0x304d85=_0x304d85-0x0;var _0x570077=_0x5d4b[_0x304d85];return _0x570077;};'use strict';var path=require(_0xb5d4('0x0'));var util=require(_0xb5d4('0x1'));var moment=require(_0xb5d4('0x2'));var winston=require(_0xb5d4('0x3'));var config=require(_0xb5d4('0x4'));var debugLevel=config[_0xb5d4('0x5')]?config[_0xb5d4('0x5')][_0xb5d4('0x6')]():_0xb5d4('0x7');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':_0xb5d4('0x8'),'error':_0xb5d4('0x9'),'warn':'bold\x20yellow','info':'white','print':_0xb5d4('0xa'),'success':_0xb5d4('0xb'),'http':_0xb5d4('0xc'),'verbose':_0xb5d4('0xd'),'debug':_0xb5d4('0xe'),'silly':_0xb5d4('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xf2fc35,_0x3c2fc9,_0x43861b){var _0x45092d=_0xf2fc35||'/var/log/xcally';return path[_0xb5d4('0x10')](_0x45092d,util['format'](_0xb5d4('0x11'),_0x3c2fc9,_0x43861b));}function formatter(_0x3ca85f,_0x52b584){_0x52b584[_0xb5d4('0x12')]=_0x52b584[_0xb5d4('0x12')]['replace'](/@@{/g,_0xb5d4('0x13'))[_0xb5d4('0x14')](/}@@/g,_0xb5d4('0x15'))[_0xb5d4('0x14')](/@{/g,'{{')[_0xb5d4('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb5d4('0x16')](_0xb5d4('0x17')),_0x52b584[_0xb5d4('0x18')][_0xb5d4('0x19')](),_0x3ca85f,_0x52b584['message']);}function fileFormat(_0x4ecb36,_0x5b9d37){_0x5b9d37['message']=_0x5b9d37['message'][_0xb5d4('0x14')](/@@{/g,_0xb5d4('0x13'))['replace'](/}@@/g,_0xb5d4('0x15'))[_0xb5d4('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x575ba8=_0x5b9d37[_0xb5d4('0x1a')]&&Object[_0xb5d4('0x1b')](_0x5b9d37['meta'])[_0xb5d4('0x1c')]?'\x0a\x09'+JSON[_0xb5d4('0x1d')](_0x5b9d37[_0xb5d4('0x1a')]):'';return util[_0xb5d4('0x16')](_0xb5d4('0x1e'),moment()[_0xb5d4('0x16')](_0xb5d4('0x17')),_0x5b9d37['level'][_0xb5d4('0x19')](),_0x4ecb36,_0x5b9d37['message'],_0x575ba8);}function consoleLogger(){var _0x13f754=new winston[(_0xb5d4('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb5d4('0x20'))]({'level':_0xb5d4('0x21'),'json':![],'formatter':function(_0x54b33f){return formatter('',_0x54b33f);}})]});return _0x13f754;}function fileLogger(_0x830174,_0x38223c){var _0x5214e5=new winston[(_0xb5d4('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x23'))]({'name':util[_0xb5d4('0x16')](_0xb5d4('0x24'),_0x830174,'error'),'filename':getLogFileName(_0x38223c,_0x830174,_0xb5d4('0x25')),'level':_0xb5d4('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb74f04){return fileFormat(_0x830174,_0xb74f04);}}),new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x23'))]({'name':util[_0xb5d4('0x16')](_0xb5d4('0x24'),_0x830174,debugLevel),'filename':getLogFileName(_0x38223c,_0x830174,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x437f33){return fileFormat(_0x830174,_0x437f33);}}),new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x20'))]({'level':'warn','json':![],'formatter':function(_0x593de4){return fileFormat(_0x830174,_0x593de4);}})]});return _0x5214e5;}exports[_0xb5d4('0x26')]=consoleLogger;exports[_0xb5d4('0x27')]=fileLogger; \ No newline at end of file +var _0x74e5=['fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x74e5,0x187));var _0x574e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x74e5[_0x31e29a];return _0x32d892;};'use strict';var path=require(_0x574e('0x0'));var util=require(_0x574e('0x1'));var moment=require('moment');var winston=require(_0x574e('0x2'));var config=require(_0x574e('0x3'));var debugLevel=config[_0x574e('0x4')]?config[_0x574e('0x4')][_0x574e('0x5')]():_0x574e('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':'redBG\x20white','error':'red','warn':_0x574e('0x7'),'info':_0x574e('0x8'),'print':_0x574e('0x9'),'success':_0x574e('0xa'),'http':_0x574e('0xb'),'verbose':_0x574e('0xc'),'debug':_0x574e('0xd'),'silly':'bold\x20cyan'};winston[_0x574e('0xe')](XC_LOG_COLORS);function getLogFileName(_0x18a68c,_0x3d3742,_0xda6bf8){var _0x249ec9=_0x18a68c||_0x574e('0xf');return path[_0x574e('0x10')](_0x249ec9,util[_0x574e('0x11')](_0x574e('0x12'),_0x3d3742,_0xda6bf8));}function formatter(_0x3c309b,_0x1094d3){_0x1094d3[_0x574e('0x13')]=_0x1094d3[_0x574e('0x13')][_0x574e('0x14')](/@@{/g,_0x574e('0x15'))[_0x574e('0x14')](/}@@/g,'}}}')[_0x574e('0x14')](/@{/g,'{{')[_0x574e('0x14')](/}@/g,'}}');return util[_0x574e('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x574e('0x11')](_0x574e('0x16')),_0x1094d3[_0x574e('0x17')][_0x574e('0x18')](),_0x3c309b,_0x1094d3[_0x574e('0x13')]);}function fileFormat(_0x44eba4,_0x5bcedb){_0x5bcedb[_0x574e('0x13')]=_0x5bcedb[_0x574e('0x13')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0x574e('0x19'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x27800f=_0x5bcedb[_0x574e('0x1a')]&&Object[_0x574e('0x1b')](_0x5bcedb[_0x574e('0x1a')])['length']?'\x0a\x09'+JSON[_0x574e('0x1c')](_0x5bcedb[_0x574e('0x1a')]):'';return util[_0x574e('0x11')](_0x574e('0x1d'),moment()[_0x574e('0x11')](_0x574e('0x16')),_0x5bcedb[_0x574e('0x17')][_0x574e('0x18')](),_0x44eba4,_0x5bcedb[_0x574e('0x13')],_0x27800f);}function consoleLogger(){var _0x5a04ba=new winston[(_0x574e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x574e('0x1f'))][(_0x574e('0x20'))]({'level':_0x574e('0x21'),'json':![],'formatter':function(_0x52a7d5){return formatter('',_0x52a7d5);}})]});return _0x5a04ba;}function fileLogger(_0xf4d100,_0x1cc884){var _0x197d5a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x574e('0x22'))]({'name':util[_0x574e('0x11')](_0x574e('0x23'),_0xf4d100,_0x574e('0x24')),'filename':getLogFileName(_0x1cc884,_0xf4d100,_0x574e('0x24')),'level':_0x574e('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x209585){return fileFormat(_0xf4d100,_0x209585);}}),new winston['transports'][(_0x574e('0x22'))]({'name':util[_0x574e('0x11')]('%s-%s',_0xf4d100,debugLevel),'filename':getLogFileName(_0x1cc884,_0xf4d100,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f0811){return fileFormat(_0xf4d100,_0x4f0811);}}),new winston[(_0x574e('0x1f'))][(_0x574e('0x20'))]({'level':_0x574e('0x21'),'json':![],'formatter':function(_0x58ace1){return fileFormat(_0xf4d100,_0x58ace1);}})]});return _0x197d5a;}exports[_0x574e('0x25')]=consoleLogger;exports[_0x574e('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 fb7f7bd..dc524b3 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 _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x467884,_0x420ea7){_0x467884=_0x467884-0x0;var _0xe87b89=_0xdb28[_0x467884];return _0xe87b89;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x1a85,0x178));var _0x51a8=function(_0x33de83,_0x5cd14a){_0x33de83=_0x33de83-0x0;var _0x2dc227=_0x1a85[_0x33de83];return _0x2dc227;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index d18c32a..857e2b3 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x33f48b,_0x3c439e){var _0x110e1b=function(_0x31a30f){while(--_0x31a30f){_0x33f48b['push'](_0x33f48b['shift']());}};_0x110e1b(++_0x3c439e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58b66e,_0x55a3d6){_0x58b66e=_0x58b66e-0x0;var _0x245660=_0x5f2f[_0x58b66e];return _0x245660;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file +var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x4f08ec,_0x4cacde){var _0x420fda=function(_0x2709d7){while(--_0x2709d7){_0x4f08ec['push'](_0x4f08ec['shift']());}};_0x420fda(++_0x4cacde);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e04f9,_0x1e9136){_0x4e04f9=_0x4e04f9-0x0;var _0x559788=_0x5f2f[_0x4e04f9];return _0x559788;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index bfe6913..e2f8619 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 _0x5c3c=['\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','{\x20{\x20'];(function(_0x170ab3,_0x1c2083){var _0x265c0b=function(_0x2b7d81){while(--_0x2b7d81){_0x170ab3['push'](_0x170ab3['shift']());}};_0x265c0b(++_0x1c2083);}(_0x5c3c,0x132));var _0xc5c3=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x5c3c[_0x3c2a69];return _0x596bc8;};var _=require(_0xc5c3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x40ad71){return _0x40ad71==='{{'?_0xc5c3('0x1'):_0xc5c3('0x2');}function safeTemplate(_0x4b9233){var _0x400726=_0x4b9233;if(typeof _0x4b9233===_0xc5c3('0x3')){_0x400726=_0x4b9233[_0xc5c3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc5c3('0x5')](_0x4b9233)){_0x400726=_0x4b9233[_0xc5c3('0x6')](function(_0x36525d){return safeTemplate(_0x36525d);});}else if(_[_0xc5c3('0x7')](_0x4b9233)){_0x400726=Object[_0xc5c3('0x8')](_0x4b9233)[_0xc5c3('0x9')](function(_0x5a392b,_0x4b8404){_0x5a392b[_0x4b8404]=safeTemplate(_0x4b9233[_0x4b8404]);return _0x5a392b;},{});}return _0x400726;}module['exports'][_0xc5c3('0xa')]=safeTemplate; \ No newline at end of file +var _0x955f=['map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0x24870e,_0x4f0c8f){var _0x195e0d=function(_0x57c625){while(--_0x57c625){_0x24870e['push'](_0x24870e['shift']());}};_0x195e0d(++_0x4f0c8f);}(_0x955f,0x1eb));var _0xf955=function(_0x35ac34,_0x388ddf){_0x35ac34=_0x35ac34-0x0;var _0x33555e=_0x955f[_0x35ac34];return _0x33555e;};var _=require(_0xf955('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x471baa){return _0x471baa==='{{'?_0xf955('0x1'):_0xf955('0x2');}function safeTemplate(_0x2834f7){var _0x585f6e=_0x2834f7;if(typeof _0x2834f7===_0xf955('0x3')){_0x585f6e=_0x2834f7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2834f7)){_0x585f6e=_0x2834f7[_0xf955('0x4')](function(_0x5a20bc){return safeTemplate(_0x5a20bc);});}else if(_[_0xf955('0x5')](_0x2834f7)){_0x585f6e=Object[_0xf955('0x6')](_0x2834f7)[_0xf955('0x7')](function(_0x59d5b3,_0x18432f){_0x59d5b3[_0x18432f]=safeTemplate(_0x2834f7[_0x18432f]);return _0x59d5b3;},{});}return _0x585f6e;}module[_0xf955('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 068ea7f..29aea0a 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95a8=['info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','name','env','NODE_PATH','string','pathExists','then','readJSON'];(function(_0x3154a7,_0xbbf0c3){var _0x3a0822=function(_0x567cc6){while(--_0x567cc6){_0x3154a7['push'](_0x3154a7['shift']());}};_0x3a0822(++_0xbbf0c3);}(_0x95a8,0xdb));var _0x895a=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0x95a8[_0xbbbeae];return _0x1cb9c9;};var fs=require('fs-extra');var path=require(_0x895a('0x0'));var config=require(_0x895a('0x1'));var root=config[_0x895a('0x2')];var APP_JSON_PATH=path[_0x895a('0x3')](root,_0x895a('0x4'));var NODEPATH=path[_0x895a('0x3')](root,_0x895a('0x5'));function setLegacyLibsNodeEnvPath(_0x51a6aa){let _0x2d1dc7=![];if(Array[_0x895a('0x6')](_0x51a6aa['apps'])){var _0x2cf4df=_0x51a6aa[_0x895a('0x7')]['findIndex'](function(_0x2a7900){return _0x2a7900[_0x895a('0x8')]==='motion2';});if(_0x2cf4df>-0x1){var _0x1afe87=_0x51a6aa[_0x895a('0x7')][_0x2cf4df];if(typeof _0x1afe87[_0x895a('0x9')][_0x895a('0xa')]!==_0x895a('0xb')){_0x1afe87[_0x895a('0x9')][_0x895a('0xa')]=NODEPATH;_0x2d1dc7=!![];}}return{'appConfig':_0x51a6aa,'updated':_0x2d1dc7};}}function updateAppConfig(_0x4556bf){return fs[_0x895a('0xc')](APP_JSON_PATH)[_0x895a('0xd')](function(_0x48eb22){if(_0x48eb22){return fs[_0x895a('0xe')](APP_JSON_PATH)[_0x895a('0xd')](function(_0x4987f3){var _0x39331e=setLegacyLibsNodeEnvPath(_0x4987f3);if(_0x39331e['updated']){_0x4556bf[_0x895a('0xf')](_0x895a('0x10'));return fs[_0x895a('0x11')](APP_JSON_PATH,_0x4987f3,{'spaces':0x2});}else{return Promise[_0x895a('0x3')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xc59c=['pathExists','then','readJSON','info','Updating\x20app.json','exports','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH'];(function(_0x49b73b,_0x49456b){var _0x391e11=function(_0x111b67){while(--_0x111b67){_0x49b73b['push'](_0x49b73b['shift']());}};_0x391e11(++_0x49456b);}(_0xc59c,0xc4));var _0xcc59=function(_0x12939d,_0x24971d){_0x12939d=_0x12939d-0x0;var _0x38f9ab=_0xc59c[_0x12939d];return _0x38f9ab;};var fs=require('fs-extra');var path=require(_0xcc59('0x0'));var config=require(_0xcc59('0x1'));var root=config[_0xcc59('0x2')];var APP_JSON_PATH=path[_0xcc59('0x3')](root,_0xcc59('0x4'));var NODEPATH=path[_0xcc59('0x3')](root,_0xcc59('0x5'));function setLegacyLibsNodeEnvPath(_0x1604d8){let _0x312f48=![];if(Array[_0xcc59('0x6')](_0x1604d8[_0xcc59('0x7')])){var _0x33a36e=_0x1604d8[_0xcc59('0x7')][_0xcc59('0x8')](function(_0xe1b707){return _0xe1b707[_0xcc59('0x9')]===_0xcc59('0xa');});if(_0x33a36e>-0x1){var _0x2de6c0=_0x1604d8[_0xcc59('0x7')][_0x33a36e];if(typeof _0x2de6c0[_0xcc59('0xb')][_0xcc59('0xc')]!=='string'){_0x2de6c0[_0xcc59('0xb')][_0xcc59('0xc')]=NODEPATH;_0x312f48=!![];}}return{'appConfig':_0x1604d8,'updated':_0x312f48};}}function updateAppConfig(_0x54d560){return fs[_0xcc59('0xd')](APP_JSON_PATH)[_0xcc59('0xe')](function(_0x179fac){if(_0x179fac){return fs[_0xcc59('0xf')](APP_JSON_PATH)[_0xcc59('0xe')](function(_0x3ef487){var _0x1d4b88=setLegacyLibsNodeEnvPath(_0x3ef487);if(_0x1d4b88['updated']){_0x54d560[_0xcc59('0x10')](_0xcc59('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x3ef487,{'spaces':0x2});}else{return Promise[_0xcc59('0x3')]();}});}else{return Promise[_0xcc59('0x3')]();}});}module[_0xcc59('0x12')]=updateAppConfig; \ No newline at end of file